diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 000000000..7dffba6f3 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,17 @@ + + + + + +Page Not Found | Odra + + + + + +
+
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

+ + + + \ No newline at end of file diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 000000000..3ee5c10b9 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +odra.dev diff --git a/docs/LiberationMono-Regular.ttf b/docs/LiberationMono-Regular.ttf new file mode 100644 index 000000000..1a39bc756 Binary files /dev/null and b/docs/LiberationMono-Regular.ttf differ diff --git a/docs/assets/css/styles.9398f3f8.css b/docs/assets/css/styles.9398f3f8.css new file mode 100644 index 000000000..871ae5b81 --- /dev/null +++ b/docs/assets/css/styles.9398f3f8.css @@ -0,0 +1 @@ +@import url(https://fonts.googleapis.com/css2?family=Ubuntu+Mono&display=swap);.col,.container{padding:0 var(--ifm-spacing-horizontal);width:100%}.markdown>h2,.markdown>h3,.markdown>h4,.markdown>h5,.markdown>h6{margin-bottom:calc(var(--ifm-heading-vertical-rhythm-bottom)*var(--ifm-leading))}body,ol ol,ol ul,ul ol,ul ul{margin:0}blockquote,pre{margin:0 0 var(--ifm-spacing-vertical)}.breadcrumbs__link,.button{transition-timing-function:var(--ifm-transition-timing-default)}.button,code{vertical-align:middle}.button--outline.button--active,.button--outline:active,.button--outline:hover,:root{--ifm-button-color:var(--ifm-font-color-base-inverse)}.menu__link:hover,a{transition:color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.navbar--dark,:root{--ifm-navbar-link-hover-color:var(--ifm-color-primary)}.menu,.navbar-sidebar{overflow-x:hidden}:root,html[data-theme=dark]{--ifm-color-emphasis-500:var(--ifm-color-gray-500)}.toggleButton_gllP,html{-webkit-tap-highlight-color:transparent}.button,.dropdown__link,.searchbox,.text--truncate{white-space:nowrap}.searchbox__reset:focus,.searchbox__submit:focus,body:not(.navigation-with-keyboard) :not(input):focus{outline:0}pre,table{overflow:auto}.markdown li,body{word-wrap:break-word}.clean-list,.containsTaskList_mC6p,.details_lb9f>summary,.dropdown__menu,.menu__list{list-style:none}:root{--ifm-color-scheme:light;--ifm-dark-value:10%;--ifm-darker-value:15%;--ifm-darkest-value:30%;--ifm-light-value:15%;--ifm-lighter-value:30%;--ifm-lightest-value:50%;--ifm-contrast-background-value:90%;--ifm-contrast-foreground-value:70%;--ifm-contrast-background-dark-value:70%;--ifm-contrast-foreground-dark-value:90%;--ifm-color-primary:#3578e5;--ifm-color-secondary:#ebedf0;--ifm-color-success:#00a400;--ifm-color-info:#54c7ec;--ifm-color-warning:#ffba00;--ifm-color-danger:#fa383e;--ifm-color-primary-dark:#306cce;--ifm-color-primary-darker:#2d66c3;--ifm-color-primary-darkest:#2554a0;--ifm-color-primary-light:#538ce9;--ifm-color-primary-lighter:#72a1ed;--ifm-color-primary-lightest:#9abcf2;--ifm-color-primary-contrast-background:#ebf2fc;--ifm-color-primary-contrast-foreground:#102445;--ifm-color-secondary-dark:#d4d5d8;--ifm-color-secondary-darker:#c8c9cc;--ifm-color-secondary-darkest:#a4a6a8;--ifm-color-secondary-light:#eef0f2;--ifm-color-secondary-lighter:#f1f2f5;--ifm-color-secondary-lightest:#f5f6f8;--ifm-color-secondary-contrast-background:#fdfdfe;--ifm-color-secondary-contrast-foreground:#474748;--ifm-color-success-dark:#009400;--ifm-color-success-darker:#008b00;--ifm-color-success-darkest:#007300;--ifm-color-success-light:#26b226;--ifm-color-success-lighter:#4dbf4d;--ifm-color-success-lightest:#80d280;--ifm-color-success-contrast-background:#e6f6e6;--ifm-color-success-contrast-foreground:#003100;--ifm-color-info-dark:#4cb3d4;--ifm-color-info-darker:#47a9c9;--ifm-color-info-darkest:#3b8ba5;--ifm-color-info-light:#6ecfef;--ifm-color-info-lighter:#87d8f2;--ifm-color-info-lightest:#aae3f6;--ifm-color-info-contrast-background:#eef9fd;--ifm-color-info-contrast-foreground:#193c47;--ifm-color-warning-dark:#e6a700;--ifm-color-warning-darker:#d99e00;--ifm-color-warning-darkest:#b38200;--ifm-color-warning-light:#ffc426;--ifm-color-warning-lighter:#ffcf4d;--ifm-color-warning-lightest:#ffdd80;--ifm-color-warning-contrast-background:#fff8e6;--ifm-color-warning-contrast-foreground:#4d3800;--ifm-color-danger-dark:#e13238;--ifm-color-danger-darker:#d53035;--ifm-color-danger-darkest:#af272b;--ifm-color-danger-light:#fb565b;--ifm-color-danger-lighter:#fb7478;--ifm-color-danger-lightest:#fd9c9f;--ifm-color-danger-contrast-background:#ffebec;--ifm-color-danger-contrast-foreground:#4b1113;--ifm-color-white:#fff;--ifm-color-black:#000;--ifm-color-gray-0:var(--ifm-color-white);--ifm-color-gray-100:#f5f6f7;--ifm-color-gray-200:#ebedf0;--ifm-color-gray-300:#dadde1;--ifm-color-gray-400:#ccd0d5;--ifm-color-gray-500:#bec3c9;--ifm-color-gray-600:#8d949e;--ifm-color-gray-700:#606770;--ifm-color-gray-800:#444950;--ifm-color-gray-900:#1c1e21;--ifm-color-gray-1000:var(--ifm-color-black);--ifm-color-emphasis-0:var(--ifm-color-gray-0);--ifm-color-emphasis-100:var(--ifm-color-gray-100);--ifm-color-emphasis-200:var(--ifm-color-gray-200);--ifm-color-emphasis-300:var(--ifm-color-gray-300);--ifm-color-emphasis-400:var(--ifm-color-gray-400);--ifm-color-emphasis-600:var(--ifm-color-gray-600);--ifm-color-emphasis-700:var(--ifm-color-gray-700);--ifm-color-emphasis-800:var(--ifm-color-gray-800);--ifm-color-emphasis-900:var(--ifm-color-gray-900);--ifm-color-emphasis-1000:var(--ifm-color-gray-1000);--ifm-color-content:var(--ifm-color-emphasis-900);--ifm-color-content-inverse:var(--ifm-color-emphasis-0);--ifm-color-content-secondary:#525860;--ifm-background-color:#0000;--ifm-background-surface-color:var(--ifm-color-content-inverse);--ifm-global-border-width:1px;--ifm-global-radius:0.4rem;--ifm-hover-overlay:#0000000d;--ifm-font-color-base:var(--ifm-color-content);--ifm-font-color-base-inverse:var(--ifm-color-content-inverse);--ifm-font-color-secondary:var(--ifm-color-content-secondary);--ifm-font-family-base:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ifm-font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--ifm-font-size-base:100%;--ifm-font-weight-light:300;--ifm-font-weight-normal:400;--ifm-font-weight-semibold:500;--ifm-font-weight-bold:700;--ifm-font-weight-base:var(--ifm-font-weight-normal);--ifm-line-height-base:1.65;--ifm-global-spacing:1rem;--ifm-spacing-vertical:var(--ifm-global-spacing);--ifm-spacing-horizontal:var(--ifm-global-spacing);--ifm-transition-fast:200ms;--ifm-transition-slow:400ms;--ifm-transition-timing-default:cubic-bezier(0.08,0.52,0.52,1);--ifm-global-shadow-lw:0 1px 2px 0 #0000001a;--ifm-global-shadow-md:0 5px 40px #0003;--ifm-global-shadow-tl:0 12px 28px 0 #0003,0 2px 4px 0 #0000001a;--ifm-z-index-dropdown:100;--ifm-z-index-fixed:200;--ifm-z-index-overlay:400;--ifm-container-width:1140px;--ifm-container-width-xl:1320px;--ifm-code-background:#f6f7f8;--ifm-code-border-radius:var(--ifm-global-radius);--ifm-code-font-size:90%;--ifm-code-padding-horizontal:0.1rem;--ifm-code-padding-vertical:0.1rem;--ifm-pre-background:var(--ifm-code-background);--ifm-pre-border-radius:var(--ifm-code-border-radius);--ifm-pre-color:inherit;--ifm-pre-line-height:1.45;--ifm-pre-padding:1rem;--ifm-heading-color:inherit;--ifm-heading-margin-top:0;--ifm-heading-margin-bottom:var(--ifm-spacing-vertical);--ifm-heading-font-family:var(--ifm-font-family-base);--ifm-heading-font-weight:var(--ifm-font-weight-bold);--ifm-heading-line-height:1.25;--ifm-h1-font-size:2rem;--ifm-h2-font-size:1.5rem;--ifm-h3-font-size:1.25rem;--ifm-h4-font-size:1rem;--ifm-h5-font-size:0.875rem;--ifm-h6-font-size:0.85rem;--ifm-image-alignment-padding:1.25rem;--ifm-leading-desktop:1.25;--ifm-leading:calc(var(--ifm-leading-desktop)*1rem);--ifm-list-left-padding:2rem;--ifm-list-margin:1rem;--ifm-list-item-margin:0.25rem;--ifm-list-paragraph-margin:1rem;--ifm-table-cell-padding:0.75rem;--ifm-table-background:#0000;--ifm-table-stripe-background:#00000008;--ifm-table-border-width:1px;--ifm-table-border-color:var(--ifm-color-emphasis-300);--ifm-table-head-background:inherit;--ifm-table-head-color:inherit;--ifm-table-head-font-weight:var(--ifm-font-weight-bold);--ifm-table-cell-color:inherit;--ifm-link-color:var(--ifm-color-primary);--ifm-link-decoration:none;--ifm-link-hover-color:var(--ifm-link-color);--ifm-link-hover-decoration:underline;--ifm-paragraph-margin-bottom:var(--ifm-leading);--ifm-blockquote-font-size:var(--ifm-font-size-base);--ifm-blockquote-border-left-width:2px;--ifm-blockquote-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-blockquote-padding-vertical:0;--ifm-blockquote-shadow:none;--ifm-blockquote-color:var(--ifm-color-emphasis-800);--ifm-blockquote-border-color:var(--ifm-color-emphasis-300);--ifm-hr-background-color:var(--ifm-color-emphasis-500);--ifm-hr-height:1px;--ifm-hr-margin-vertical:1.5rem;--ifm-scrollbar-size:7px;--ifm-scrollbar-track-background-color:#f1f1f1;--ifm-scrollbar-thumb-background-color:silver;--ifm-scrollbar-thumb-hover-background-color:#a7a7a7;--ifm-alert-background-color:inherit;--ifm-alert-border-color:inherit;--ifm-alert-border-radius:var(--ifm-global-radius);--ifm-alert-border-width:0px;--ifm-alert-border-left-width:5px;--ifm-alert-color:var(--ifm-font-color-base);--ifm-alert-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-alert-padding-vertical:var(--ifm-spacing-vertical);--ifm-alert-shadow:var(--ifm-global-shadow-lw);--ifm-avatar-intro-margin:1rem;--ifm-avatar-intro-alignment:inherit;--ifm-avatar-photo-size:3rem;--ifm-badge-background-color:inherit;--ifm-badge-border-color:inherit;--ifm-badge-border-radius:var(--ifm-global-radius);--ifm-badge-border-width:var(--ifm-global-border-width);--ifm-badge-color:var(--ifm-color-white);--ifm-badge-padding-horizontal:calc(var(--ifm-spacing-horizontal)*0.5);--ifm-badge-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-breadcrumb-border-radius:1.5rem;--ifm-breadcrumb-spacing:0.5rem;--ifm-breadcrumb-color-active:var(--ifm-color-primary);--ifm-breadcrumb-item-background-active:var(--ifm-hover-overlay);--ifm-breadcrumb-padding-horizontal:0.8rem;--ifm-breadcrumb-padding-vertical:0.4rem;--ifm-breadcrumb-size-multiplier:1;--ifm-breadcrumb-separator:url('data:image/svg+xml;utf8,');--ifm-breadcrumb-separator-filter:none;--ifm-breadcrumb-separator-size:0.5rem;--ifm-breadcrumb-separator-size-multiplier:1.25;--ifm-button-background-color:inherit;--ifm-button-border-color:var(--ifm-button-background-color);--ifm-button-border-width:var(--ifm-global-border-width);--ifm-button-font-weight:var(--ifm-font-weight-bold);--ifm-button-padding-horizontal:1.5rem;--ifm-button-padding-vertical:0.375rem;--ifm-button-size-multiplier:1;--ifm-button-transition-duration:var(--ifm-transition-fast);--ifm-button-border-radius:calc(var(--ifm-global-radius)*var(--ifm-button-size-multiplier));--ifm-button-group-spacing:2px;--ifm-card-background-color:var(--ifm-background-surface-color);--ifm-card-border-radius:calc(var(--ifm-global-radius)*2);--ifm-card-horizontal-spacing:var(--ifm-global-spacing);--ifm-card-vertical-spacing:var(--ifm-global-spacing);--ifm-toc-border-color:var(--ifm-color-emphasis-300);--ifm-toc-link-color:var(--ifm-color-content-secondary);--ifm-toc-padding-vertical:0.5rem;--ifm-toc-padding-horizontal:0.5rem;--ifm-dropdown-background-color:var(--ifm-background-surface-color);--ifm-dropdown-font-weight:var(--ifm-font-weight-semibold);--ifm-dropdown-link-color:var(--ifm-font-color-base);--ifm-dropdown-hover-background-color:var(--ifm-hover-overlay);--ifm-footer-background-color:var(--ifm-color-emphasis-100);--ifm-footer-color:inherit;--ifm-footer-link-color:var(--ifm-color-emphasis-700);--ifm-footer-link-hover-color:var(--ifm-color-primary);--ifm-footer-link-horizontal-spacing:0.5rem;--ifm-footer-padding-horizontal:calc(var(--ifm-spacing-horizontal)*2);--ifm-footer-padding-vertical:calc(var(--ifm-spacing-vertical)*2);--ifm-footer-title-color:inherit;--ifm-footer-logo-max-width:min(30rem,90vw);--ifm-hero-background-color:var(--ifm-background-surface-color);--ifm-hero-text-color:var(--ifm-color-emphasis-800);--ifm-menu-color:var(--ifm-color-emphasis-700);--ifm-menu-color-active:var(--ifm-color-primary);--ifm-menu-color-background-active:var(--ifm-hover-overlay);--ifm-menu-color-background-hover:var(--ifm-hover-overlay);--ifm-menu-link-padding-horizontal:0.75rem;--ifm-menu-link-padding-vertical:0.375rem;--ifm-menu-link-sublist-icon:url('data:image/svg+xml;utf8,');--ifm-menu-link-sublist-icon-filter:none;--ifm-navbar-background-color:var(--ifm-background-surface-color);--ifm-navbar-height:3.75rem;--ifm-navbar-item-padding-horizontal:0.75rem;--ifm-navbar-item-padding-vertical:0.25rem;--ifm-navbar-link-color:var(--ifm-font-color-base);--ifm-navbar-link-active-color:var(--ifm-link-color);--ifm-navbar-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-navbar-padding-vertical:calc(var(--ifm-spacing-vertical)*0.5);--ifm-navbar-shadow:var(--ifm-global-shadow-lw);--ifm-navbar-search-input-background-color:var(--ifm-color-emphasis-200);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-800);--ifm-navbar-search-input-placeholder-color:var(--ifm-color-emphasis-500);--ifm-navbar-search-input-icon:url('data:image/svg+xml;utf8,');--ifm-navbar-sidebar-width:83vw;--ifm-pagination-border-radius:var(--ifm-global-radius);--ifm-pagination-color-active:var(--ifm-color-primary);--ifm-pagination-font-size:1rem;--ifm-pagination-item-active-background:var(--ifm-hover-overlay);--ifm-pagination-page-spacing:0.2em;--ifm-pagination-padding-horizontal:calc(var(--ifm-spacing-horizontal)*1);--ifm-pagination-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-pagination-nav-border-radius:var(--ifm-global-radius);--ifm-pagination-nav-color-hover:var(--ifm-color-primary);--ifm-pills-color-active:var(--ifm-color-primary);--ifm-pills-color-background-active:var(--ifm-hover-overlay);--ifm-pills-spacing:0.125rem;--ifm-tabs-color:var(--ifm-font-color-secondary);--ifm-tabs-color-active:var(--ifm-color-primary);--ifm-tabs-color-active-border:var(--ifm-tabs-color-active);--ifm-tabs-padding-horizontal:1rem;--ifm-tabs-padding-vertical:1rem;--docusaurus-progress-bar-color:var(--ifm-color-primary);--ifm-font-size-base:19px;--ifm-font-family-base:"Gill Sans",Arial,sans-serif;--docusaurus-announcement-bar-height:auto;--docusaurus-collapse-button-bg:#0000;--docusaurus-collapse-button-bg-hover:#0000001a;--doc-sidebar-width:300px;--doc-sidebar-hidden-width:30px;--docusaurus-tag-list-border:var(--ifm-color-emphasis-300)}.badge--danger,.badge--info,.badge--primary,.badge--secondary,.badge--success,.badge--warning{--ifm-badge-border-color:var(--ifm-badge-background-color)}.button--link,.button--outline{--ifm-button-background-color:#0000}*,.algolia-autocomplete .ds-dropdown-menu *{box-sizing:border-box}html{-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-size-adjust:100%;background-color:var(--ifm-background-color);color:var(--ifm-font-color-base);color-scheme:var(--ifm-color-scheme);font:var(--ifm-font-size-base)/var(--ifm-line-height-base) var(--ifm-font-family-base);text-rendering:optimizelegibility}iframe{border:0;color-scheme:auto}.container{margin:0 auto;max-width:var(--ifm-container-width)}.container--fluid{max-width:inherit}.row{display:flex;flex-wrap:wrap;margin:0 calc(var(--ifm-spacing-horizontal)*-1)}.list_eTzJ article:last-child,.margin-bottom--none,.margin-vert--none,.markdown>:last-child{margin-bottom:0!important}.margin-top--none,.margin-vert--none,.tabItem_LNqP{margin-top:0!important}.row--no-gutters{margin-left:0;margin-right:0}.margin-horiz--none,.margin-right--none{margin-right:0!important}.row--no-gutters>.col{padding-left:0;padding-right:0}.row--align-top{align-items:flex-start}.row--align-bottom{align-items:flex-end}.menuExternalLink_NmtK,.row--align-center{align-items:center}.row--align-stretch{align-items:stretch}.row--align-baseline{align-items:baseline}.col{--ifm-col-width:100%;flex:1 0;margin-left:0;max-width:var(--ifm-col-width)}.padding-bottom--none,.padding-vert--none{padding-bottom:0!important}.padding-top--none,.padding-vert--none{padding-top:0!important}.padding-horiz--none,.padding-left--none{padding-left:0!important}.padding-horiz--none,.padding-right--none{padding-right:0!important}.col[class*=col--]{flex:0 0 var(--ifm-col-width)}.col--1{--ifm-col-width:8.33333%}.col--offset-1{margin-left:8.33333%}.col--2{--ifm-col-width:16.66667%}.col--offset-2{margin-left:16.66667%}.col--3{--ifm-col-width:25%}.col--offset-3{margin-left:25%}.col--4{--ifm-col-width:33.33333%}.col--offset-4{margin-left:33.33333%}.col--5{--ifm-col-width:41.66667%}.col--offset-5{margin-left:41.66667%}.col--6{--ifm-col-width:50%}.col--offset-6{margin-left:50%}.col--7{--ifm-col-width:58.33333%}.col--offset-7{margin-left:58.33333%}.col--8{--ifm-col-width:66.66667%}.col--offset-8{margin-left:66.66667%}.col--9{--ifm-col-width:75%}.col--offset-9{margin-left:75%}.col--10{--ifm-col-width:83.33333%}.col--offset-10{margin-left:83.33333%}.col--11{--ifm-col-width:91.66667%}.col--offset-11{margin-left:91.66667%}.col--12{--ifm-col-width:100%}.col--offset-12{margin-left:100%}.margin-horiz--none,.margin-left--none{margin-left:0!important}.margin--none{margin:0!important}.margin-bottom--xs,.margin-vert--xs{margin-bottom:.25rem!important}.margin-top--xs,.margin-vert--xs{margin-top:.25rem!important}.margin-horiz--xs,.margin-left--xs{margin-left:.25rem!important}.margin-horiz--xs,.margin-right--xs{margin-right:.25rem!important}.margin--xs{margin:.25rem!important}.margin-bottom--sm,.margin-vert--sm{margin-bottom:.5rem!important}.margin-top--sm,.margin-vert--sm{margin-top:.5rem!important}.margin-horiz--sm,.margin-left--sm{margin-left:.5rem!important}.margin-horiz--sm,.margin-right--sm{margin-right:.5rem!important}.margin--sm{margin:.5rem!important}.margin-bottom--md,.margin-vert--md{margin-bottom:1rem!important}.margin-top--md,.margin-vert--md{margin-top:1rem!important}.margin-horiz--md,.margin-left--md{margin-left:1rem!important}.margin-horiz--md,.margin-right--md{margin-right:1rem!important}.margin--md{margin:1rem!important}.margin-bottom--lg,.margin-vert--lg{margin-bottom:2rem!important}.margin-top--lg,.margin-vert--lg{margin-top:2rem!important}.margin-horiz--lg,.margin-left--lg{margin-left:2rem!important}.margin-horiz--lg,.margin-right--lg{margin-right:2rem!important}.margin--lg{margin:2rem!important}.margin-bottom--xl,.margin-vert--xl{margin-bottom:5rem!important}.margin-top--xl,.margin-vert--xl{margin-top:5rem!important}.margin-horiz--xl,.margin-left--xl{margin-left:5rem!important}.margin-horiz--xl,.margin-right--xl{margin-right:5rem!important}.margin--xl{margin:5rem!important}.padding--none{padding:0!important}.padding-bottom--xs,.padding-vert--xs{padding-bottom:.25rem!important}.padding-top--xs,.padding-vert--xs{padding-top:.25rem!important}.padding-horiz--xs,.padding-left--xs{padding-left:.25rem!important}.padding-horiz--xs,.padding-right--xs{padding-right:.25rem!important}.padding--xs{padding:.25rem!important}.padding-bottom--sm,.padding-vert--sm{padding-bottom:.5rem!important}.padding-top--sm,.padding-vert--sm{padding-top:.5rem!important}.padding-horiz--sm,.padding-left--sm{padding-left:.5rem!important}.padding-horiz--sm,.padding-right--sm{padding-right:.5rem!important}.padding--sm{padding:.5rem!important}.padding-bottom--md,.padding-vert--md{padding-bottom:1rem!important}.padding-top--md,.padding-vert--md{padding-top:1rem!important}.padding-horiz--md,.padding-left--md{padding-left:1rem!important}.padding-horiz--md,.padding-right--md{padding-right:1rem!important}.padding--md{padding:1rem!important}.padding-bottom--lg,.padding-vert--lg{padding-bottom:2rem!important}.padding-top--lg,.padding-vert--lg{padding-top:2rem!important}.padding-horiz--lg,.padding-left--lg{padding-left:2rem!important}.padding-horiz--lg,.padding-right--lg{padding-right:2rem!important}.padding--lg{padding:2rem!important}.padding-bottom--xl,.padding-vert--xl{padding-bottom:5rem!important}.padding-top--xl,.padding-vert--xl{padding-top:5rem!important}.padding-horiz--xl,.padding-left--xl{padding-left:5rem!important}.padding-horiz--xl,.padding-right--xl{padding-right:5rem!important}.padding--xl{padding:5rem!important}code{background-color:var(--ifm-code-background);border:.1rem solid #0000001a;border-radius:var(--ifm-code-border-radius);font-family:var(--ifm-font-family-monospace);font-size:var(--ifm-code-font-size);padding:var(--ifm-code-padding-vertical) var(--ifm-code-padding-horizontal)}a code{color:inherit}pre{background-color:var(--ifm-pre-background);border-radius:var(--ifm-pre-border-radius);color:var(--ifm-pre-color);font:var(--ifm-code-font-size)/var(--ifm-pre-line-height) var(--ifm-font-family-monospace);padding:var(--ifm-pre-padding)}pre code{background-color:initial;border:none;font-size:100%;line-height:inherit;padding:0}kbd{background-color:var(--ifm-color-emphasis-0);border:1px solid var(--ifm-color-emphasis-400);border-radius:.2rem;box-shadow:inset 0 -1px 0 var(--ifm-color-emphasis-400);color:var(--ifm-color-emphasis-800);font:80% var(--ifm-font-family-monospace);padding:.15rem .3rem}h1,h2,h3,h4,h5,h6{color:var(--ifm-heading-color);font-family:var(--ifm-heading-font-family);font-weight:var(--ifm-heading-font-weight);line-height:var(--ifm-heading-line-height);margin:var(--ifm-heading-margin-top) 0 var(--ifm-heading-margin-bottom) 0}h1{font-size:var(--ifm-h1-font-size)}h2{font-size:var(--ifm-h2-font-size)}h3{font-size:var(--ifm-h3-font-size)}h4{font-size:var(--ifm-h4-font-size)}h5{font-size:var(--ifm-h5-font-size)}h6{font-size:var(--ifm-h6-font-size)}.container_lyt7,.container_lyt7>svg,img{max-width:100%}img[align=right]{padding-left:var(--image-alignment-padding)}img[align=left]{padding-right:var(--image-alignment-padding)}.markdown{--ifm-h1-vertical-rhythm-top:3;--ifm-h2-vertical-rhythm-top:2;--ifm-h3-vertical-rhythm-top:1.5;--ifm-heading-vertical-rhythm-top:1.25;--ifm-h1-vertical-rhythm-bottom:1.25;--ifm-heading-vertical-rhythm-bottom:1}.markdown:after,.markdown:before{content:"";display:table}.markdown:after{clear:both}.markdown h1:first-child{--ifm-h1-font-size:3rem;margin-bottom:calc(var(--ifm-h1-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown>h2{--ifm-h2-font-size:2rem;margin-top:calc(var(--ifm-h2-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h3{--ifm-h3-font-size:1.5rem;margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h4,.markdown>h5,.markdown>h6{margin-top:calc(var(--ifm-heading-vertical-rhythm-top)*var(--ifm-leading))}.markdown>p,.markdown>pre,.markdown>ul,.tabList__CuJ{margin-bottom:var(--ifm-leading)}.markdown li>p{margin-top:var(--ifm-list-paragraph-margin)}.markdown li+li{margin-top:var(--ifm-list-item-margin)}ol,ul{margin:0 0 var(--ifm-list-margin);padding-left:var(--ifm-list-left-padding)}ol ol,ul ol{list-style-type:lower-roman}ol ol ol,ol ul ol,ul ol ol,ul ul ol{list-style-type:lower-alpha}table{border-collapse:collapse;display:block;margin-bottom:var(--ifm-spacing-vertical)}table thead tr{border-bottom:2px solid var(--ifm-table-border-color)}table thead,table tr:nth-child(2n){background-color:var(--ifm-table-stripe-background)}table tr{background-color:var(--ifm-table-background);border-top:var(--ifm-table-border-width) solid var(--ifm-table-border-color)}table td,table th{border:var(--ifm-table-border-width) solid var(--ifm-table-border-color);padding:var(--ifm-table-cell-padding)}table th{background-color:var(--ifm-table-head-background);color:var(--ifm-table-head-color);font-weight:var(--ifm-table-head-font-weight)}table td{color:var(--ifm-table-cell-color)}strong{font-weight:var(--ifm-font-weight-bold)}a{color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}a:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button:hover,.text--no-decoration,.text--no-decoration:hover,a:not([href]){text-decoration:none}p{margin:0 0 var(--ifm-paragraph-margin-bottom)}blockquote{border-left:var(--ifm-blockquote-border-left-width) solid var(--ifm-blockquote-border-color);box-shadow:var(--ifm-blockquote-shadow);color:var(--ifm-blockquote-color);font-size:var(--ifm-blockquote-font-size);padding:var(--ifm-blockquote-padding-vertical) var(--ifm-blockquote-padding-horizontal)}blockquote>:first-child{margin-top:0}blockquote>:last-child{margin-bottom:0}hr{background-color:var(--ifm-hr-background-color);border:0;height:var(--ifm-hr-height);margin:var(--ifm-hr-margin-vertical) 0}.shadow--lw{box-shadow:var(--ifm-global-shadow-lw)!important}.shadow--md{box-shadow:var(--ifm-global-shadow-md)!important}.shadow--tl{box-shadow:var(--ifm-global-shadow-tl)!important}.text--primary,.wordWrapButtonEnabled_EoeP .wordWrapButtonIcon_Bwma{color:var(--ifm-color-primary)}.text--secondary{color:var(--ifm-color-secondary)}.text--success{color:var(--ifm-color-success)}.text--info{color:var(--ifm-color-info)}.text--warning{color:var(--ifm-color-warning)}.text--danger{color:var(--ifm-color-danger)}.text--center{text-align:center}.text--left{text-align:left}.text--justify{text-align:justify}.text--right{text-align:right}.text--capitalize{text-transform:capitalize}.text--lowercase{text-transform:lowercase}.admonitionHeading_tbUL,.alert__heading,.text--uppercase{text-transform:uppercase}.text--light{font-weight:var(--ifm-font-weight-light)}.text--normal{font-weight:var(--ifm-font-weight-normal)}.text--semibold{font-weight:var(--ifm-font-weight-semibold)}.text--bold{font-weight:var(--ifm-font-weight-bold)}.text--italic{font-style:italic}.text--truncate{overflow:hidden;text-overflow:ellipsis}.text--break{word-wrap:break-word!important;word-break:break-word!important}.clean-btn{background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;padding:0}.alert,.alert .close{color:var(--ifm-alert-foreground-color)}.clean-list{padding-left:0}.alert--primary{--ifm-alert-background-color:var(--ifm-color-primary-contrast-background);--ifm-alert-background-color-highlight:#3578e526;--ifm-alert-foreground-color:var(--ifm-color-primary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-primary-dark)}.alert--secondary{--ifm-alert-background-color:var(--ifm-color-secondary-contrast-background);--ifm-alert-background-color-highlight:#ebedf026;--ifm-alert-foreground-color:var(--ifm-color-secondary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-secondary-dark)}.alert--success{--ifm-alert-background-color:var(--ifm-color-success-contrast-background);--ifm-alert-background-color-highlight:#00a40026;--ifm-alert-foreground-color:var(--ifm-color-success-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-success-dark)}.alert--info{--ifm-alert-background-color:var(--ifm-color-info-contrast-background);--ifm-alert-background-color-highlight:#54c7ec26;--ifm-alert-foreground-color:var(--ifm-color-info-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-info-dark)}.alert--warning{--ifm-alert-background-color:var(--ifm-color-warning-contrast-background);--ifm-alert-background-color-highlight:#ffba0026;--ifm-alert-foreground-color:var(--ifm-color-warning-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-warning-dark)}.alert--danger{--ifm-alert-background-color:var(--ifm-color-danger-contrast-background);--ifm-alert-background-color-highlight:#fa383e26;--ifm-alert-foreground-color:var(--ifm-color-danger-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-danger-dark)}.alert{--ifm-code-background:var(--ifm-alert-background-color-highlight);--ifm-link-color:var(--ifm-alert-foreground-color);--ifm-link-hover-color:var(--ifm-alert-foreground-color);--ifm-link-decoration:underline;--ifm-tabs-color:var(--ifm-alert-foreground-color);--ifm-tabs-color-active:var(--ifm-alert-foreground-color);--ifm-tabs-color-active-border:var(--ifm-alert-border-color);background-color:var(--ifm-alert-background-color);border:var(--ifm-alert-border-width) solid var(--ifm-alert-border-color);border-left-width:var(--ifm-alert-border-left-width);border-radius:var(--ifm-alert-border-radius);box-shadow:var(--ifm-alert-shadow);padding:var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal)}.alert__heading{align-items:center;display:flex;font:700 var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.5rem}.alert__icon{display:inline-flex;margin-right:.4em}.alert__icon svg{fill:var(--ifm-alert-foreground-color);stroke:var(--ifm-alert-foreground-color);stroke-width:0}.alert .close{margin:calc(var(--ifm-alert-padding-vertical)*-1) calc(var(--ifm-alert-padding-horizontal)*-1) 0 0;opacity:.75}.alert .close:focus,.alert .close:hover{opacity:1}.alert a{text-decoration-color:var(--ifm-alert-border-color)}.alert a:hover{text-decoration-thickness:2px}.avatar{column-gap:var(--ifm-avatar-intro-margin);display:flex}.avatar__photo{border-radius:50%;display:block;height:var(--ifm-avatar-photo-size);overflow:hidden;width:var(--ifm-avatar-photo-size)}.card--full-height,.navbar__logo img,body,html{height:100%}.avatar__photo--sm{--ifm-avatar-photo-size:2rem}.avatar__photo--lg{--ifm-avatar-photo-size:4rem}.avatar__photo--xl{--ifm-avatar-photo-size:6rem}.avatar__intro{display:flex;flex:1 1;flex-direction:column;justify-content:center;text-align:var(--ifm-avatar-intro-alignment)}.badge,.breadcrumbs__item,.breadcrumbs__link,.button,.dropdown>.navbar__link:after{display:inline-block}.avatar__name{font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base)}.avatar__subtitle{margin-top:.25rem}.avatar--vertical{--ifm-avatar-intro-alignment:center;--ifm-avatar-intro-margin:0.5rem;align-items:center;flex-direction:column}.badge{background-color:var(--ifm-badge-background-color);border:var(--ifm-badge-border-width) solid var(--ifm-badge-border-color);border-radius:var(--ifm-badge-border-radius);color:var(--ifm-badge-color);font-size:75%;font-weight:var(--ifm-font-weight-bold);line-height:1;padding:var(--ifm-badge-padding-vertical) var(--ifm-badge-padding-horizontal)}.badge--primary{--ifm-badge-background-color:var(--ifm-color-primary)}.badge--secondary{--ifm-badge-background-color:var(--ifm-color-secondary);color:var(--ifm-color-black)}.breadcrumbs__link,.button.button--secondary.button--outline:not(.button--active):not(:hover){color:var(--ifm-font-color-base)}.badge--success{--ifm-badge-background-color:var(--ifm-color-success)}.badge--info{--ifm-badge-background-color:var(--ifm-color-info)}.badge--warning{--ifm-badge-background-color:var(--ifm-color-warning)}.badge--danger{--ifm-badge-background-color:var(--ifm-color-danger)}.breadcrumbs{margin-bottom:0;padding-left:0}.breadcrumbs__item:not(:last-child):after{background:var(--ifm-breadcrumb-separator) center;content:" ";display:inline-block;filter:var(--ifm-breadcrumb-separator-filter);height:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier));margin:0 var(--ifm-breadcrumb-spacing);opacity:.5;width:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier))}.breadcrumbs__item--active .breadcrumbs__link{background:var(--ifm-breadcrumb-item-background-active);color:var(--ifm-breadcrumb-color-active)}.breadcrumbs__link{border-radius:var(--ifm-breadcrumb-border-radius);font-size:calc(1rem*var(--ifm-breadcrumb-size-multiplier));padding:calc(var(--ifm-breadcrumb-padding-vertical)*var(--ifm-breadcrumb-size-multiplier)) calc(var(--ifm-breadcrumb-padding-horizontal)*var(--ifm-breadcrumb-size-multiplier));transition-duration:var(--ifm-transition-fast);transition-property:background,color}.breadcrumbs__link:any-link:hover,.breadcrumbs__link:link:hover,.breadcrumbs__link:visited:hover,area.breadcrumbs__link[href]:hover{background:var(--ifm-breadcrumb-item-background-active);text-decoration:none}.breadcrumbs--sm{--ifm-breadcrumb-size-multiplier:0.8}.breadcrumbs--lg{--ifm-breadcrumb-size-multiplier:1.2}.button{background-color:var(--ifm-button-background-color);border:var(--ifm-button-border-width) solid var(--ifm-button-border-color);border-radius:var(--ifm-button-border-radius);cursor:pointer;font-size:calc(.875rem*var(--ifm-button-size-multiplier));font-weight:var(--ifm-button-font-weight);line-height:1.5;padding:calc(var(--ifm-button-padding-vertical)*var(--ifm-button-size-multiplier)) calc(var(--ifm-button-padding-horizontal)*var(--ifm-button-size-multiplier));text-align:center;transition-duration:var(--ifm-button-transition-duration);transition-property:color,background,border-color;-webkit-user-select:none;user-select:none}.button,.button:hover{color:var(--ifm-button-color)}.button--outline{--ifm-button-color:var(--ifm-button-border-color)}.button--outline:hover{--ifm-button-background-color:var(--ifm-button-border-color)}.button--link{--ifm-button-border-color:#0000;color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}.button--link.button--active,.button--link:active,.button--link:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button.disabled,.button:disabled,.button[disabled]{opacity:.65;pointer-events:none}.button--sm{--ifm-button-size-multiplier:0.8}.button--lg{--ifm-button-size-multiplier:1.35}.button--block{display:block;width:100%}.button.button--secondary{color:var(--ifm-color-gray-900)}:where(.button--primary){--ifm-button-background-color:var(--ifm-color-primary);--ifm-button-border-color:var(--ifm-color-primary)}:where(.button--primary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-primary-dark);--ifm-button-border-color:var(--ifm-color-primary-dark)}.button--primary.button--active,.button--primary:active{--ifm-button-background-color:var(--ifm-color-primary-darker);--ifm-button-border-color:var(--ifm-color-primary-darker)}:where(.button--secondary){--ifm-button-background-color:var(--ifm-color-secondary);--ifm-button-border-color:var(--ifm-color-secondary)}:where(.button--secondary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-secondary-dark);--ifm-button-border-color:var(--ifm-color-secondary-dark)}.button--secondary.button--active,.button--secondary:active{--ifm-button-background-color:var(--ifm-color-secondary-darker);--ifm-button-border-color:var(--ifm-color-secondary-darker)}:where(.button--success){--ifm-button-background-color:var(--ifm-color-success);--ifm-button-border-color:var(--ifm-color-success)}:where(.button--success):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-success-dark);--ifm-button-border-color:var(--ifm-color-success-dark)}.button--success.button--active,.button--success:active{--ifm-button-background-color:var(--ifm-color-success-darker);--ifm-button-border-color:var(--ifm-color-success-darker)}:where(.button--info){--ifm-button-background-color:var(--ifm-color-info);--ifm-button-border-color:var(--ifm-color-info)}:where(.button--info):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-info-dark);--ifm-button-border-color:var(--ifm-color-info-dark)}.button--info.button--active,.button--info:active{--ifm-button-background-color:var(--ifm-color-info-darker);--ifm-button-border-color:var(--ifm-color-info-darker)}:where(.button--warning){--ifm-button-background-color:var(--ifm-color-warning);--ifm-button-border-color:var(--ifm-color-warning)}:where(.button--warning):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-warning-dark);--ifm-button-border-color:var(--ifm-color-warning-dark)}.button--warning.button--active,.button--warning:active{--ifm-button-background-color:var(--ifm-color-warning-darker);--ifm-button-border-color:var(--ifm-color-warning-darker)}:where(.button--danger){--ifm-button-background-color:var(--ifm-color-danger);--ifm-button-border-color:var(--ifm-color-danger)}:where(.button--danger):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-danger-dark);--ifm-button-border-color:var(--ifm-color-danger-dark)}.button--danger.button--active,.button--danger:active{--ifm-button-background-color:var(--ifm-color-danger-darker);--ifm-button-border-color:var(--ifm-color-danger-darker)}.button-group{display:inline-flex;gap:var(--ifm-button-group-spacing)}.button-group>.button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.button-group>.button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.button-group--block{display:flex;justify-content:stretch}.button-group--block>.button{flex-grow:1}.card{background-color:var(--ifm-card-background-color);border-radius:var(--ifm-card-border-radius);box-shadow:var(--ifm-global-shadow-lw);display:flex;flex-direction:column;overflow:hidden}.card__image{padding-top:var(--ifm-card-vertical-spacing)}.card__image:first-child{padding-top:0}.card__body,.card__footer,.card__header{padding:var(--ifm-card-vertical-spacing) var(--ifm-card-horizontal-spacing)}.card__body:not(:last-child),.card__footer:not(:last-child),.card__header:not(:last-child){padding-bottom:0}.card__body>:last-child,.card__footer>:last-child,.card__header>:last-child{margin-bottom:0}.card__footer{margin-top:auto}.table-of-contents{font-size:.8rem;margin-bottom:0;padding:var(--ifm-toc-padding-vertical) 0}.table-of-contents,.table-of-contents ul{list-style:none;padding-left:var(--ifm-toc-padding-horizontal)}.table-of-contents li{margin:var(--ifm-toc-padding-vertical) var(--ifm-toc-padding-horizontal)}.table-of-contents__left-border{border-left:1px solid var(--ifm-toc-border-color)}.table-of-contents__link{color:var(--ifm-toc-link-color);display:block}.table-of-contents__link--active,.table-of-contents__link--active code,.table-of-contents__link:hover,.table-of-contents__link:hover code{color:var(--ifm-color-primary);text-decoration:none}.close{color:var(--ifm-color-black);float:right;font-size:1.5rem;font-weight:var(--ifm-font-weight-bold);line-height:1;opacity:.5;padding:1rem;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.close:hover{opacity:.7}.close:focus,.theme-code-block-highlighted-line .codeLineNumber_Tfdd:before{opacity:.8}.dropdown{display:inline-flex;font-weight:var(--ifm-dropdown-font-weight);position:relative;vertical-align:top}.dropdown--hoverable:hover .dropdown__menu,.dropdown--show .dropdown__menu{opacity:1;pointer-events:all;transform:translateY(-1px);visibility:visible}#nprogress,.dropdown__menu,.navbar__item.dropdown .navbar__link:not([href]){pointer-events:none}.dropdown--right .dropdown__menu{left:inherit;right:0}.dropdown--nocaret .navbar__link:after{content:none!important}.dropdown__menu{background-color:var(--ifm-dropdown-background-color);border-radius:var(--ifm-global-radius);box-shadow:var(--ifm-global-shadow-md);left:0;max-height:80vh;min-width:10rem;opacity:0;overflow-y:auto;padding:.5rem;position:absolute;top:calc(100% - var(--ifm-navbar-item-padding-vertical) + .3rem);transform:translateY(-.625rem);transition-duration:var(--ifm-transition-fast);transition-property:opacity,transform,visibility;transition-timing-function:var(--ifm-transition-timing-default);visibility:hidden;z-index:var(--ifm-z-index-dropdown)}.sidebar_re4s,.tableOfContents_bqdL{max-height:calc(100vh - var(--ifm-navbar-height) - 2rem)}.menu__caret,.menu__link,.menu__list-item-collapsible{border-radius:.25rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.dropdown__link{border-radius:.25rem;color:var(--ifm-dropdown-link-color);display:block;font-size:.875rem;margin-top:.2rem;padding:.25rem .5rem}.dropdown__link--active,.dropdown__link:hover{background-color:var(--ifm-dropdown-hover-background-color);color:var(--ifm-dropdown-link-color);text-decoration:none}.dropdown__link--active,.dropdown__link--active:hover{--ifm-dropdown-link-color:var(--ifm-link-color)}.dropdown>.navbar__link:after{border-color:currentcolor #0000;border-style:solid;border-width:.4em .4em 0;content:"";margin-left:.3em;position:relative;top:2px;transform:translateY(-50%)}.footer{background-color:var(--ifm-footer-background-color);color:var(--ifm-footer-color);padding:var(--ifm-footer-padding-vertical) var(--ifm-footer-padding-horizontal)}.footer--dark{--ifm-footer-background-color:#303846;--ifm-footer-color:var(--ifm-footer-link-color);--ifm-footer-link-color:var(--ifm-color-secondary);--ifm-footer-title-color:var(--ifm-color-white)}.footer__links{margin-bottom:1rem}.footer__link-item{color:var(--ifm-footer-link-color);line-height:2}.footer__link-item:hover{color:var(--ifm-footer-link-hover-color)}.footer__link-separator{margin:0 var(--ifm-footer-link-horizontal-spacing)}.footer__logo{margin-top:1rem;max-width:var(--ifm-footer-logo-max-width)}.footer__title{color:var(--ifm-footer-title-color);font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base);margin-bottom:var(--ifm-heading-margin-bottom)}.menu,.navbar__link{font-weight:var(--ifm-font-weight-semibold)}.docItemContainer_Djhp article>:first-child,.docItemContainer_Djhp header+*,.footer__item{margin-top:0}.admonitionContent_S0QG>:last-child,.cardContainer_fWXF :last-child,.collapsibleContent_i85q>:last-child,.footer__items,.tabItem_Ymn6>:last-child{margin-bottom:0}.codeBlockStandalone_MEMb,[type=checkbox]{padding:0}.hero{align-items:center;background-color:var(--ifm-hero-background-color);color:var(--ifm-hero-text-color);display:flex;padding:4rem 2rem}.hero--primary{--ifm-hero-background-color:var(--ifm-color-primary);--ifm-hero-text-color:var(--ifm-font-color-base-inverse)}.hero--dark{--ifm-hero-background-color:#303846;--ifm-hero-text-color:var(--ifm-color-white)}.hero__title,.title_f1Hy{font-size:3rem}.hero__subtitle{font-size:1.5rem}.menu__list{margin:0;padding-left:0}.menu__caret,.menu__link{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu__list .menu__list{flex:0 0 100%;margin-top:.25rem;padding-left:var(--ifm-menu-link-padding-horizontal)}.menu__list-item:not(:first-child){margin-top:.25rem}.menu__list-item--collapsed .menu__list{height:0;overflow:hidden}.details_lb9f[data-collapsed=false].isBrowser_bmU9>summary:before,.details_lb9f[open]:not(.isBrowser_bmU9)>summary:before,.menu__list-item--collapsed .menu__caret:before,.menu__list-item--collapsed .menu__link--sublist:after{transform:rotate(90deg)}.menu__list-item-collapsible{display:flex;flex-wrap:wrap;position:relative}.menu__caret:hover,.menu__link:hover,.menu__list-item-collapsible--active,.menu__list-item-collapsible:hover{background:var(--ifm-menu-color-background-hover)}.menu__list-item-collapsible .menu__link--active,.menu__list-item-collapsible .menu__link:hover{background:none!important}.menu__caret,.menu__link{align-items:center;display:flex}.menu__link{color:var(--ifm-menu-color);flex:1;line-height:1.25}.menu__link:hover{color:var(--ifm-menu-color);text-decoration:none}.menu__caret:before,.menu__link--sublist-caret:after{content:"";height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast) linear;width:1.25rem;filter:var(--ifm-menu-link-sublist-icon-filter)}.menu__link--sublist-caret:after{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem;margin-left:auto;min-width:1.25rem}.menu__link--active,.menu__link--active:hover{color:var(--ifm-menu-color-active)}.navbar__brand,.navbar__link{color:var(--ifm-navbar-link-color)}.menu__link--active:not(.menu__link--sublist){background-color:var(--ifm-menu-color-background-active)}.menu__caret:before{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem}.navbar--dark,html[data-theme=dark]{--ifm-menu-link-sublist-icon-filter:invert(100%) sepia(94%) saturate(17%) hue-rotate(223deg) brightness(104%) contrast(98%)}.navbar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-navbar-shadow);height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar,.navbar>.container,.navbar>.container-fluid{display:flex}.navbar--fixed-top{position:sticky;top:0;z-index:var(--ifm-z-index-fixed)}.navbar-sidebar,.navbar-sidebar__backdrop{bottom:0;opacity:0;position:fixed;transition-timing-function:ease-in-out;left:0;top:0;visibility:hidden}.navbar__inner{display:flex;flex-wrap:wrap;justify-content:space-between;width:100%}.navbar__brand{align-items:center;display:flex;margin-right:1rem;min-width:0}.navbar__brand:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.announcementBarContent_xLdY,.navbar__title{flex:1 1 auto}.navbar__toggle{display:none;margin-right:.5rem}.navbar__logo{flex:0 0 auto;height:2rem;margin-right:.5rem}.navbar__items{align-items:center;display:flex;flex:1;min-width:0}.navbar__items--center{flex:0 0 auto}.navbar__items--center .navbar__brand{margin:0}.navbar__items--center+.navbar__items--right{flex:1}.navbar__items--right{flex:0 0 auto;justify-content:flex-end}.navbar__items--right>:last-child{padding-right:0}.navbar__item{display:inline-block;padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.navbar__link--active,.navbar__link:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.navbar--dark,.navbar--primary{--ifm-menu-color:var(--ifm-color-gray-300);--ifm-navbar-link-color:var(--ifm-color-gray-100);--ifm-navbar-search-input-background-color:#ffffff1a;--ifm-navbar-search-input-placeholder-color:#ffffff80;color:var(--ifm-color-white)}.navbar--dark{--ifm-navbar-background-color:#242526;--ifm-menu-color-background-active:#ffffff0d;--ifm-navbar-search-input-color:var(--ifm-color-white)}.navbar--primary{--ifm-navbar-background-color:var(--ifm-color-primary);--ifm-navbar-link-hover-color:var(--ifm-color-white);--ifm-menu-color-active:var(--ifm-color-white);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-500)}.navbar__search-input{-webkit-appearance:none;appearance:none;background:var(--ifm-navbar-search-input-background-color) var(--ifm-navbar-search-input-icon) no-repeat .75rem center/1rem 1rem;border:none;border-radius:2rem;color:var(--ifm-navbar-search-input-color);cursor:text;display:inline-block;font-size:.9rem;height:2rem;padding:0 .5rem 0 2.25rem;width:12.5rem}.navbar__search-input::placeholder{color:var(--ifm-navbar-search-input-placeholder-color)}.navbar-sidebar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-global-shadow-md);transform:translate3d(-100%,0,0);transition-duration:.25s;transition-property:opacity,visibility,transform;width:var(--ifm-navbar-sidebar-width)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar__items{transform:translateZ(0)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar--show .navbar-sidebar__backdrop{opacity:1;visibility:visible}.navbar-sidebar__backdrop{background-color:#0009;right:0;transition-duration:.1s;transition-property:opacity,visibility}.navbar-sidebar__brand{align-items:center;box-shadow:var(--ifm-navbar-shadow);display:flex;flex:1;height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar-sidebar__items{display:flex;height:calc(100% - var(--ifm-navbar-height));transition:transform var(--ifm-transition-fast) ease-in-out}.navbar-sidebar__items--show-secondary{transform:translate3d(calc((var(--ifm-navbar-sidebar-width))*-1),0,0)}.navbar-sidebar__item{flex-shrink:0;padding:.5rem;width:calc(var(--ifm-navbar-sidebar-width))}.navbar-sidebar__back{background:var(--ifm-menu-color-background-active);font-size:15px;font-weight:var(--ifm-button-font-weight);margin:0 0 .2rem -.5rem;padding:.6rem 1.5rem;position:relative;text-align:left;top:-.5rem;width:calc(100% + 1rem)}.navbar-sidebar__close{display:flex;margin-left:auto}.pagination{column-gap:var(--ifm-pagination-page-spacing);display:flex;font-size:var(--ifm-pagination-font-size);padding-left:0}.pagination--sm{--ifm-pagination-font-size:0.8rem;--ifm-pagination-padding-horizontal:0.8rem;--ifm-pagination-padding-vertical:0.2rem}.pagination--lg{--ifm-pagination-font-size:1.2rem;--ifm-pagination-padding-horizontal:1.2rem;--ifm-pagination-padding-vertical:0.3rem}.pagination__item{display:inline-flex}.pagination__item>span{padding:var(--ifm-pagination-padding-vertical)}.pagination__item--active .pagination__link{color:var(--ifm-pagination-color-active)}.pagination__item--active .pagination__link,.pagination__item:not(.pagination__item--active):hover .pagination__link{background:var(--ifm-pagination-item-active-background)}.pagination__item--disabled,.pagination__item[disabled]{opacity:.25;pointer-events:none}.pagination__link{border-radius:var(--ifm-pagination-border-radius);color:var(--ifm-font-color-base);display:inline-block;padding:var(--ifm-pagination-padding-vertical) var(--ifm-pagination-padding-horizontal);transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination__link:hover,.sidebarItemLink_mo7H:hover{text-decoration:none}.pagination-nav{grid-gap:var(--ifm-spacing-horizontal);display:grid;gap:var(--ifm-spacing-horizontal);grid-template-columns:repeat(2,1fr)}.pagination-nav__link{border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-pagination-nav-border-radius);display:block;height:100%;line-height:var(--ifm-heading-line-height);padding:var(--ifm-global-spacing);transition:border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav__link:hover{border-color:var(--ifm-pagination-nav-color-hover);text-decoration:none}.pagination-nav__link--next{grid-column:2/3;text-align:right}.pagination-nav__label{font-size:var(--ifm-h4-font-size);font-weight:var(--ifm-heading-font-weight);word-break:break-word}.pagination-nav__link--prev .pagination-nav__label:before{content:"« "}.pagination-nav__link--next .pagination-nav__label:after{content:" »"}.pagination-nav__sublabel{color:var(--ifm-color-content-secondary);font-size:var(--ifm-h5-font-size);font-weight:var(--ifm-font-weight-semibold);margin-bottom:.25rem}.pills__item,.sidebarItemTitle_pO2u,.tabs{font-weight:var(--ifm-font-weight-bold)}.pills{display:flex;gap:var(--ifm-pills-spacing);padding-left:0}.pills__item{border-radius:.5rem;cursor:pointer;display:inline-block;padding:.25rem 1rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pills__item--active{color:var(--ifm-pills-color-active)}.pills__item--active,.pills__item:not(.pills__item--active):hover{background:var(--ifm-pills-color-background-active)}.pills--block{justify-content:stretch}.pills--block .pills__item{flex-grow:1;text-align:center}.tabs{color:var(--ifm-tabs-color);display:flex;margin-bottom:0;overflow-x:auto;padding-left:0}.tabs__item{border-bottom:3px solid #0000;border-radius:var(--ifm-global-radius);cursor:pointer;display:inline-flex;padding:var(--ifm-tabs-padding-vertical) var(--ifm-tabs-padding-horizontal);transition:background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs__item--active{border-bottom-color:var(--ifm-tabs-color-active-border);border-bottom-left-radius:0;border-bottom-right-radius:0;color:var(--ifm-tabs-color-active)}.tabs__item:hover{background-color:var(--ifm-hover-overlay)}.tabs--block{justify-content:stretch}.tabs--block .tabs__item{flex-grow:1;justify-content:center}html[data-theme=dark]{--ifm-color-scheme:dark;--ifm-color-emphasis-0:var(--ifm-color-gray-1000);--ifm-color-emphasis-100:var(--ifm-color-gray-900);--ifm-color-emphasis-200:var(--ifm-color-gray-800);--ifm-color-emphasis-300:var(--ifm-color-gray-700);--ifm-color-emphasis-400:var(--ifm-color-gray-600);--ifm-color-emphasis-600:var(--ifm-color-gray-400);--ifm-color-emphasis-700:var(--ifm-color-gray-300);--ifm-color-emphasis-800:var(--ifm-color-gray-200);--ifm-color-emphasis-900:var(--ifm-color-gray-100);--ifm-color-emphasis-1000:var(--ifm-color-gray-0);--ifm-background-color:#1b1b1d;--ifm-background-surface-color:#242526;--ifm-hover-overlay:#ffffff0d;--ifm-color-content:#e3e3e3;--ifm-color-content-secondary:#fff;--ifm-breadcrumb-separator-filter:invert(64%) sepia(11%) saturate(0%) hue-rotate(149deg) brightness(99%) contrast(95%);--ifm-code-background:#ffffff1a;--ifm-scrollbar-track-background-color:#444;--ifm-scrollbar-thumb-background-color:#686868;--ifm-scrollbar-thumb-hover-background-color:#7a7a7a;--ifm-table-stripe-background:#ffffff12;--ifm-toc-border-color:var(--ifm-color-emphasis-200);--ifm-color-primary-contrast-background:#102445;--ifm-color-primary-contrast-foreground:#ebf2fc;--ifm-color-secondary-contrast-background:#474748;--ifm-color-secondary-contrast-foreground:#fdfdfe;--ifm-color-success-contrast-background:#003100;--ifm-color-success-contrast-foreground:#e6f6e6;--ifm-color-info-contrast-background:#193c47;--ifm-color-info-contrast-foreground:#eef9fd;--ifm-color-warning-contrast-background:#4d3800;--ifm-color-warning-contrast-foreground:#fff8e6;--ifm-color-danger-contrast-background:#4b1113;--ifm-color-danger-contrast-foreground:#ffebec}#nprogress .bar{background:var(--docusaurus-progress-bar-color);height:2px;left:0;position:fixed;top:0;width:100%;z-index:1031}#nprogress .peg{box-shadow:0 0 10px var(--docusaurus-progress-bar-color),0 0 5px var(--docusaurus-progress-bar-color);height:100%;opacity:1;position:absolute;right:0;transform:rotate(3deg) translateY(-4px);width:100px}[data-theme=dark]{--ifm-color-primary:#509ef2;--ifm-background-color:#191922!important}article{margin-left:auto;margin-right:auto;max-width:800px}#docusaurus-base-url-issue-banner-container,.docSidebarContainer_b6E3,.sidebarLogo_isFc,.themedImage_ToTc,[data-theme=dark] .lightToggleIcon_pyhR,[data-theme=light] .darkToggleIcon_wfgR,html[data-announcement-bar-initially-dismissed=true] .announcementBar_mb4j{display:none}.skipToContent_fXgn{background-color:var(--ifm-background-surface-color);color:var(--ifm-color-emphasis-900);left:100%;padding:calc(var(--ifm-global-spacing)/2) var(--ifm-global-spacing);position:fixed;top:1rem;z-index:calc(var(--ifm-z-index-fixed) + 1)}.skipToContent_fXgn:focus{box-shadow:var(--ifm-global-shadow-md);left:1rem}.closeButton_CVFx{line-height:0;padding:0}.content_knG7{font-size:85%;padding:5px 0;text-align:center}.content_knG7 a{color:inherit;text-decoration:underline}.announcementBar_mb4j{align-items:center;background-color:var(--ifm-color-white);border-bottom:1px solid var(--ifm-color-emphasis-100);color:var(--ifm-color-black);display:flex;height:var(--docusaurus-announcement-bar-height)}.announcementBarPlaceholder_vyr4{flex:0 0 10px}.announcementBarClose_gvF7{align-self:stretch;flex:0 0 30px}.toggle_vylO{height:2rem;width:2rem}.toggleButton_gllP{align-items:center;border-radius:50%;display:flex;height:100%;justify-content:center;transition:background var(--ifm-transition-fast);width:100%}.toggleButton_gllP:hover{background:var(--ifm-color-emphasis-200)}.toggleButtonDisabled_aARS{cursor:not-allowed}[data-theme=dark] .themedImage--dark_i4oU,[data-theme=light] .themedImage--light_HNdA{display:initial}.iconExternalLink_nPIU{margin-left:.3rem}.iconLanguage_nlXk{margin-right:5px;vertical-align:text-bottom}.navbarHideable_m1mJ{transition:transform var(--ifm-transition-fast) ease}.navbarHidden_jGov{transform:translate3d(0,calc(-100% - 2px),0)}.footerLogoLink_BH7S{opacity:.5;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.footerLogoLink_BH7S:hover,.hash-link:focus,:hover>.hash-link{opacity:1}.mainWrapper_z2l0{display:flex;flex:1 0 auto;flex-direction:column}.docusaurus-mt-lg{margin-top:3rem}#__docusaurus{display:flex;flex-direction:column;min-height:100%}.cardContainer_fWXF{--ifm-link-color:var(--ifm-color-emphasis-800);--ifm-link-hover-color:var(--ifm-color-emphasis-700);--ifm-link-hover-decoration:none;border:1px solid var(--ifm-color-emphasis-200);box-shadow:0 1.5px 3px 0 #00000026;transition:all var(--ifm-transition-fast) ease;transition-property:border,box-shadow}.cardContainer_fWXF:hover{border-color:var(--ifm-color-primary);box-shadow:0 3px 6px 0 #0003}.cardTitle_rnsV{font-size:1.2rem}.cardDescription_PWke{font-size:.8rem}.backToTopButton_sjWU{background-color:var(--ifm-color-emphasis-200);border-radius:50%;bottom:1.3rem;box-shadow:var(--ifm-global-shadow-lw);height:3rem;opacity:0;position:fixed;right:1.3rem;transform:scale(0);transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default);visibility:hidden;width:3rem;z-index:calc(var(--ifm-z-index-fixed) - 1)}.backToTopButton_sjWU:after{background-color:var(--ifm-color-emphasis-1000);content:" ";display:inline-block;height:100%;-webkit-mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;width:100%}.backToTopButtonShow_xfvO{opacity:1;transform:scale(1);visibility:visible}[data-theme=dark]:root{--docusaurus-collapse-button-bg:#ffffff0d;--docusaurus-collapse-button-bg-hover:#ffffff1a}.collapseSidebarButton_PEFL{display:none;margin:0}.docMainContainer_gTbr,.docPage__5DB{display:flex;width:100%}.docsWrapper_BCFX{display:flex;flex:1 0 auto}.sidebar_re4s{overflow-y:auto;position:sticky;top:calc(var(--ifm-navbar-height) + 2rem)}.sidebarItemTitle_pO2u{font-size:var(--ifm-h3-font-size)}.container_mt6G,.sidebarItemList_Yudw{font-size:.9rem}.sidebarItem__DBe{margin-top:.7rem}.sidebarItemLink_mo7H{color:var(--ifm-font-color-base);display:block}.sidebarItemLinkActive_I1ZP{color:var(--ifm-color-primary)!important}.authorCol_q4o9{flex-grow:1!important;max-width:inherit!important}.imageOnlyAuthorRow_lXe7{display:flex;flex-flow:row wrap}.buttons_AeoN,.features_t9lD{align-items:center;display:flex}.imageOnlyAuthorCol_cxD5{margin-left:.3rem;margin-right:.3rem}.features_t9lD{padding:2rem 0;width:100%}.featureSvg_GfXr{height:200px;width:200px}.heroBanner_qdFl{overflow:hidden;padding:4rem 0;position:relative;text-align:center}.buttons_AeoN{justify-content:center}.searchbox,.searchbox__input{box-sizing:border-box;display:inline-block}.algolia-docsearch-suggestion{border-bottom-color:#3a3dd1}.algolia-docsearch-suggestion--category-header{background-color:#4b54de}.algolia-docsearch-suggestion--highlight{color:#3a33d1}.algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--highlight{background-color:#4d47d5}.aa-cursor .algolia-docsearch-suggestion--content{color:#272296}.aa-cursor .algolia-docsearch-suggestion{background:#ebebfb}.searchbox{height:32px!important;position:relative;visibility:visible!important;width:200px}.searchbox .algolia-autocomplete{display:block;height:100%;width:100%}.searchbox__wrapper{height:100%;position:relative;width:100%;z-index:999}.searchbox__input{-webkit-appearance:none;appearance:none;background:#fff!important;border:0;border-radius:16px;box-shadow:inset 0 0 0 1px #ccc;font-size:12px;height:100%;padding:0 26px 0 32px;transition:box-shadow .4s,background .4s;vertical-align:middle;white-space:normal;width:100%}.searchbox__reset,.searchbox__submit{font-size:inherit;-webkit-user-select:none;position:absolute}.searchbox__input::-webkit-search-cancel-button,.searchbox__input::-webkit-search-decoration,.searchbox__input::-webkit-search-results-button,.searchbox__input::-webkit-search-results-decoration{display:none}.searchbox__input:hover{box-shadow:inset 0 0 0 1px #b3b3b3}.searchbox__input:active,.searchbox__input:focus{background:#fff;box-shadow:inset 0 0 0 1px #aaa;outline:0}.searchbox__input::placeholder{color:#aaa}.searchbox__submit{background-color:#458ee100;border:0;border-radius:16px 0 0 16px;height:100%;left:0;margin:0;padding:0;right:inherit;text-align:center;top:0;user-select:none;vertical-align:middle;width:32px}.searchbox__submit:before{content:"";display:inline-block;height:100%;margin-right:-4px;vertical-align:middle}.algolia-autocomplete .ds-dropdown-menu .ds-suggestion,.searchbox__submit:active,.searchbox__submit:hover{cursor:pointer}.searchbox__submit svg{fill:#6d7e96;height:14px;vertical-align:middle;width:14px}.searchbox__reset{fill:#00000080;background:none;border:0;cursor:pointer;display:block;margin:0;padding:0;right:8px;top:8px;user-select:none}.buttonGroup__atx button,.codeBlockContainer_Ckt0{background:var(--prism-background-color);color:var(--prism-color)}.searchbox__reset.hide{display:none}.searchbox__reset svg{display:block;height:8px;margin:4px;width:8px}.searchbox__input:valid~.searchbox__reset{animation-duration:.15s;animation-name:a;display:block}@keyframes a{0%{opacity:0;transform:translate3d(-20%,0,0)}to{opacity:1;transform:none}}.algolia-autocomplete .ds-dropdown-menu:before{background:#373940;border-radius:2px;border-right:1px solid #373940;border-top:1px solid #373940;content:"";display:block;height:14px;position:absolute;top:-7px;transform:rotate(-45deg);width:14px;z-index:1000}.algolia-autocomplete .ds-dropdown-menu{box-shadow:0 1px 0 0 #0003,0 2px 3px 0 #0000001a}.algolia-autocomplete .ds-dropdown-menu .ds-suggestions{position:relative;z-index:1000}.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-]{background:#fff;border-radius:4px;overflow:auto;padding:0;position:relative}.algolia-autocomplete .algolia-docsearch-suggestion{display:block;overflow:hidden;padding:0;position:relative;text-decoration:none}.algolia-autocomplete .ds-cursor .algolia-docsearch-suggestion--wrapper{background:#f1f1f1;box-shadow:inset -2px 0 0 #61dafb}.algolia-autocomplete .algolia-docsearch-suggestion--highlight{background:#ffe564;padding:.1em .05em}.algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl0 .algolia-docsearch-suggestion--highlight,.algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl1 .algolia-docsearch-suggestion--highlight{background:inherit;color:inherit}.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight{background:inherit;box-shadow:inset 0 -2px 0 0 #458ee1cc;color:inherit;padding:0 0 1px}.algolia-autocomplete .algolia-docsearch-suggestion--content{cursor:pointer;display:block;float:right;padding:5.33333px 0 5.33333px 10.66667px;position:relative;width:70%}.algolia-autocomplete .algolia-docsearch-suggestion--content:before{background:#ececec;content:"";display:block;height:100%;left:-1px;position:absolute;top:0;width:1px}.algolia-autocomplete .algolia-docsearch-suggestion--category-header{background-color:#373940;color:#fff;display:none;font-size:14px;font-weight:700;letter-spacing:.08em;margin:0;padding:5px 8px;position:relative;text-transform:uppercase}.algolia-autocomplete .algolia-docsearch-suggestion--wrapper{background-color:#fff;float:left;padding:8px 0 0;width:100%}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column{word-wrap:break-word;color:#777;display:none;float:left;font-size:.9em;padding:5.33333px 10.66667px;position:relative;text-align:right;width:30%}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column:before{background:#ececec;content:"";display:block;height:100%;position:absolute;right:0;top:0;width:1px}.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main .algolia-docsearch-suggestion--category-header,.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__secondary{display:block}.algolia-autocomplete .algolia-docsearch-suggestion--no-results:before,.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-inline{display:none}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column .algolia-docsearch-suggestion--highlight{background-color:inherit;color:inherit}.algolia-autocomplete .algolia-docsearch-suggestion--title{color:#02060c;font-size:.9em;font-weight:700;margin-bottom:4px}.algolia-autocomplete .algolia-docsearch-suggestion--text{color:#63676d;display:block;font-size:.85em;line-height:1.2em;padding-right:2px}.algolia-autocomplete .algolia-docsearch-suggestion--version{color:#a6aab1;display:block;font-size:.65em;padding-right:2px;padding-top:2px}.algolia-autocomplete .algolia-docsearch-suggestion--no-results{background-color:#373940;font-size:1.2em;margin-top:-8px;padding:8px 0;text-align:center;width:100%}.algolia-autocomplete .algolia-docsearch-suggestion--no-results .algolia-docsearch-suggestion--text{color:#fff;margin-top:4px}.algolia-autocomplete .algolia-docsearch-suggestion code{background-color:#ebebeb;border:none;border-radius:3px;color:#222;font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace;font-size:90%;padding:1px 5px}.algolia-autocomplete .algolia-docsearch-suggestion code .algolia-docsearch-suggestion--highlight{background:none}.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main .algolia-docsearch-suggestion--category-header{color:#fff;display:block}.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__secondary .algolia-docsearch-suggestion--subcategory-column,.tocCollapsibleContent_vkbj a{display:block}.algolia-autocomplete .algolia-docsearch-footer{background-color:#fff;float:right;font-size:0;height:30px;line-height:0;width:100%;z-index:2000}.algolia-autocomplete .algolia-docsearch-footer--logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 18'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath fill='url(%2523a)' d='M59.4.02h13.3a2.37 2.37 0 0 1 2.38 2.37V15.6a2.37 2.37 0 0 1-2.38 2.36H59.4a2.37 2.37 0 0 1-2.38-2.36V2.38A2.37 2.37 0 0 1 59.4.02z'/%3E%3Cpath fill='%2523FFF' d='M66.26 4.56c-2.82 0-5.1 2.27-5.1 5.08 0 2.8 2.28 5.07 5.1 5.07 2.8 0 5.1-2.26 5.1-5.07 0-2.8-2.28-5.07-5.1-5.07zm0 8.65c-2 0-3.6-1.6-3.6-3.56 0-1.97 1.6-3.58 3.6-3.58 1.98 0 3.6 1.6 3.6 3.58a3.58 3.58 0 0 1-3.6 3.57zm0-6.4v2.66c0 .07.08.13.15.1l2.4-1.24c.04-.02.06-.1.03-.14a2.96 2.96 0 0 0-2.46-1.5.1.1 0 0 0-.1.1zm-3.33-1.96-.3-.3a.78.78 0 0 0-1.12 0l-.36.36a.77.77 0 0 0 0 1.1l.3.3c.05.05.13.04.17 0 .2-.25.4-.5.6-.7.23-.23.46-.43.7-.6.07-.04.07-.1.03-.16zm5-.8V3.4a.78.78 0 0 0-.78-.78h-1.83a.78.78 0 0 0-.78.78v.63c0 .07.06.12.14.1a5.74 5.74 0 0 1 1.58-.22c.52 0 1.04.07 1.54.2a.1.1 0 0 0 .13-.1z'/%3E%3Cpath fill='%2523182359' d='M102.16 13.76c0 1.46-.37 2.52-1.12 3.2-.75.67-1.9 1-3.44 1-.56 0-1.74-.1-2.67-.3l.34-1.7c.78.17 1.82.2 2.36.2.86 0 1.48-.16 1.84-.5.37-.36.55-.88.55-1.57v-.35a6.37 6.37 0 0 1-.84.3 4.15 4.15 0 0 1-1.2.17 4.5 4.5 0 0 1-1.6-.28 3.38 3.38 0 0 1-1.26-.82 3.74 3.74 0 0 1-.8-1.35c-.2-.54-.3-1.5-.3-2.2 0-.67.1-1.5.3-2.06a3.92 3.92 0 0 1 .9-1.43 4.12 4.12 0 0 1 1.45-.92 5.3 5.3 0 0 1 1.94-.37c.7 0 1.35.1 1.97.2a15.86 15.86 0 0 1 1.6.33v8.46zm-5.95-4.2c0 .9.2 1.88.6 2.3.4.4.9.62 1.53.62.34 0 .66-.05.96-.15a2.75 2.75 0 0 0 .73-.33V6.7a8.53 8.53 0 0 0-1.42-.17c-.76-.02-1.36.3-1.77.8-.4.5-.62 1.4-.62 2.23zm16.13 0c0 .72-.1 1.26-.32 1.85a4.4 4.4 0 0 1-.9 1.53c-.38.42-.85.75-1.4.98-.54.24-1.4.37-1.8.37-.43 0-1.27-.13-1.8-.36a4.1 4.1 0 0 1-1.4-.97 4.5 4.5 0 0 1-.92-1.52 5.04 5.04 0 0 1-.33-1.84c0-.72.1-1.4.32-2 .22-.6.53-1.1.92-1.5.4-.43.86-.75 1.4-.98a4.55 4.55 0 0 1 1.78-.34 4.7 4.7 0 0 1 1.8.34c.54.23 1 .55 1.4.97.38.42.68.92.9 1.5.23.6.35 1.3.35 2zm-2.2 0c0-.92-.2-1.7-.6-2.22-.38-.54-.94-.8-1.64-.8-.72 0-1.27.26-1.67.8-.4.54-.58 1.3-.58 2.22 0 .93.2 1.56.6 2.1.38.54.94.8 1.64.8s1.25-.26 1.65-.8c.4-.55.6-1.17.6-2.1zm6.97 4.7c-3.5.02-3.5-2.8-3.5-3.27L113.57.92l2.15-.34v10c0 .25 0 1.87 1.37 1.88v1.8zm3.77 0h-2.15v-9.2l2.15-.33v9.54zM119.8 3.74c.7 0 1.3-.58 1.3-1.3 0-.7-.58-1.3-1.3-1.3-.73 0-1.3.6-1.3 1.3 0 .72.58 1.3 1.3 1.3zm6.43 1c.7 0 1.3.1 1.78.27.5.18.88.42 1.17.73.28.3.5.74.6 1.18.13.46.2.95.2 1.5v5.47a25.24 25.24 0 0 1-1.5.25c-.67.1-1.42.15-2.25.15a6.83 6.83 0 0 1-1.52-.16 3.2 3.2 0 0 1-1.18-.5 2.46 2.46 0 0 1-.76-.9c-.18-.37-.27-.9-.27-1.44 0-.52.1-.85.3-1.2.2-.37.48-.67.83-.9a3.6 3.6 0 0 1 1.23-.5 7.07 7.07 0 0 1 2.2-.1l.83.16V8.4c0-.25-.03-.48-.1-.7a1.5 1.5 0 0 0-.3-.58c-.15-.18-.34-.3-.58-.4a2.54 2.54 0 0 0-.92-.17c-.5 0-.94.06-1.35.13-.4.08-.75.16-1 .25l-.27-1.74c.27-.1.67-.18 1.2-.28a9.34 9.34 0 0 1 1.65-.14zm.18 7.74c.66 0 1.15-.04 1.5-.1V10.2a5.1 5.1 0 0 0-2-.1c-.23.03-.45.1-.64.2a1.17 1.17 0 0 0-.47.38c-.13.17-.18.26-.18.52 0 .5.17.8.5.98.32.2.74.3 1.3.3zM84.1 4.8c.72 0 1.3.08 1.8.26.48.17.87.42 1.15.73.3.3.5.72.6 1.17.14.45.2.94.2 1.47v5.48a25.24 25.24 0 0 1-1.5.26c-.67.1-1.42.14-2.25.14a6.83 6.83 0 0 1-1.52-.16 3.2 3.2 0 0 1-1.18-.5 2.46 2.46 0 0 1-.76-.9c-.18-.38-.27-.9-.27-1.44 0-.53.1-.86.3-1.22.2-.36.5-.65.84-.88a3.6 3.6 0 0 1 1.24-.5 7.07 7.07 0 0 1 2.2-.1c.26.03.54.08.84.15v-.35c0-.24-.03-.48-.1-.7a1.5 1.5 0 0 0-.3-.58c-.15-.17-.34-.3-.58-.4a2.54 2.54 0 0 0-.9-.15c-.5 0-.96.05-1.37.12-.4.07-.75.15-1 .24l-.26-1.75c.27-.08.67-.17 1.18-.26a8.9 8.9 0 0 1 1.66-.15zm.2 7.73c.65 0 1.14-.04 1.48-.1v-2.17a5.1 5.1 0 0 0-1.98-.1c-.24.03-.46.1-.65.18a1.17 1.17 0 0 0-.47.4c-.12.17-.17.26-.17.52 0 .5.18.8.5.98.32.2.75.3 1.3.3zm8.68 1.74c-3.5 0-3.5-2.82-3.5-3.28L89.45.92 91.6.6v10c0 .25 0 1.87 1.38 1.88v1.8z'/%3E%3Cpath fill='%25231D3657' d='M5.03 11.03c0 .7-.26 1.24-.76 1.64-.5.4-1.2.6-2.1.6-.88 0-1.6-.14-2.17-.42v-1.2c.36.16.74.3 1.14.38.4.1.78.15 1.13.15.5 0 .88-.1 1.12-.3a.94.94 0 0 0 .35-.77.98.98 0 0 0-.33-.74c-.22-.2-.68-.44-1.37-.72-.72-.3-1.22-.62-1.52-1C.23 8.27.1 7.82.1 7.3c0-.65.22-1.17.7-1.55.46-.37 1.08-.56 1.86-.56.76 0 1.5.16 2.25.48l-.4 1.05c-.7-.3-1.32-.44-1.87-.44-.4 0-.73.08-.94.26a.9.9 0 0 0-.33.72c0 .2.04.38.12.52.08.15.22.3.42.4.2.14.55.3 1.06.52.58.24 1 .47 1.27.67.27.2.47.44.6.7.12.26.18.57.18.92zM9 13.27c-.92 0-1.64-.27-2.16-.8-.52-.55-.78-1.3-.78-2.24 0-.97.24-1.73.72-2.3.5-.54 1.15-.82 2-.82.78 0 1.4.25 1.85.72.46.48.7 1.14.7 1.97v.67H7.35c0 .58.17 1.02.46 1.33.3.3.7.47 1.24.47.36 0 .68-.04.98-.1a5.1 5.1 0 0 0 .98-.33v1.02a3.87 3.87 0 0 1-.94.32 5.72 5.72 0 0 1-1.08.1zm-.22-5.2c-.4 0-.73.12-.97.38s-.37.62-.42 1.1h2.7c0-.48-.13-.85-.36-1.1-.23-.26-.54-.38-.94-.38zm7.7 5.1-.26-.84h-.05c-.28.36-.57.6-.86.74-.28.13-.65.2-1.1.2-.6 0-1.05-.16-1.38-.48-.32-.32-.5-.77-.5-1.34 0-.62.24-1.08.7-1.4.45-.3 1.14-.47 2.07-.5l1.02-.03V9.2c0-.37-.1-.65-.27-.84-.17-.2-.45-.28-.82-.28-.3 0-.6.04-.88.13a6.68 6.68 0 0 0-.8.33l-.4-.9a4.4 4.4 0 0 1 1.05-.4 4.86 4.86 0 0 1 1.08-.12c.76 0 1.33.18 1.7.5.4.33.6.85.6 1.56v4h-.9zm-1.9-.87c.47 0 .83-.13 1.1-.38.3-.26.43-.62.43-1.08v-.52l-.76.03c-.6.03-1.02.13-1.3.3s-.4.45-.4.82c0 .26.08.47.24.6.16.16.4.23.7.23zm7.57-5.2c.25 0 .46.03.62.06l-.12 1.18a2.38 2.38 0 0 0-.56-.06c-.5 0-.92.16-1.24.5-.3.32-.47.75-.47 1.27v3.1h-1.27V7.23h1l.16 1.05h.05c.2-.36.45-.64.77-.85a1.83 1.83 0 0 1 1.02-.3zm4.12 6.17c-.9 0-1.58-.27-2.05-.8-.47-.52-.7-1.27-.7-2.25 0-1 .24-1.77.73-2.3.5-.54 1.2-.8 2.12-.8.63 0 1.2.1 1.7.34l-.4 1c-.52-.2-.96-.3-1.3-.3-1.04 0-1.55.68-1.55 2.05 0 .67.13 1.17.38 1.5.26.34.64.5 1.13.5a3.23 3.23 0 0 0 1.6-.4v1.1a2.53 2.53 0 0 1-.73.28 4.36 4.36 0 0 1-.93.08zm8.28-.1h-1.27V9.5c0-.45-.1-.8-.28-1.02-.18-.23-.47-.34-.88-.34-.53 0-.9.16-1.16.48-.25.3-.38.85-.38 1.6v2.94h-1.26V4.8h1.26v2.12c0 .34-.02.7-.06 1.1h.08a1.76 1.76 0 0 1 .72-.67c.3-.16.66-.24 1.07-.24 1.43 0 2.15.74 2.15 2.2v3.86zM42.2 7.1c.74 0 1.32.28 1.73.82.4.53.62 1.3.62 2.26 0 .97-.2 1.73-.63 2.27-.42.54-1 .82-1.75.82s-1.33-.27-1.75-.8h-.08l-.23.7h-.94V4.8h1.26v2l-.02.64-.03.56h.05c.4-.6 1-.9 1.78-.9zm-.33 1.04c-.5 0-.88.15-1.1.45-.22.3-.34.8-.35 1.5v.08c0 .72.12 1.24.35 1.57.23.32.6.48 1.12.48.44 0 .78-.17 1-.53.24-.35.36-.87.36-1.53 0-1.35-.47-2.03-1.4-2.03zm3.24-.92h1.4l1.2 3.37c.18.47.3.92.36 1.34h.04l.18-.72 1.37-4H51l-2.53 6.73c-.46 1.23-1.23 1.85-2.3 1.85-.3 0-.56-.03-.83-.1v-1c.2.05.4.08.65.08.6 0 1.03-.36 1.28-1.06l.22-.56-2.4-5.94z'/%3E%3C/g%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100%;display:block;height:100%;margin-left:auto;margin-right:5px;overflow:hidden;text-indent:-9000px;width:110px}html[data-theme=dark] .algolia-docsearch-footer,html[data-theme=dark] .algolia-docsearch-suggestion--category-header,html[data-theme=dark] .algolia-docsearch-suggestion--wrapper{background:var(--ifm-background-color)!important;color:var(--ifm-font-color-base)!important}html[data-theme=dark] .algolia-docsearch-suggestion--title{color:var(--ifm-font-color-base)!important}html[data-theme=dark] .ds-cursor .algolia-docsearch-suggestion--wrapper{background:var(--ifm-background-surface-color)!important}mark{background-color:#add8e6}.codeBlockContainer_Ckt0{border-radius:var(--ifm-code-border-radius);box-shadow:var(--ifm-global-shadow-lw);margin-bottom:var(--ifm-leading)}.codeBlockContent_biex{border-radius:inherit;direction:ltr;position:relative}.codeBlockTitle_Ktv7{border-bottom:1px solid var(--ifm-color-emphasis-300);border-top-left-radius:inherit;border-top-right-radius:inherit;font-size:var(--ifm-code-font-size);font-weight:500;padding:.75rem var(--ifm-pre-padding)}.codeBlock_bY9V{--ifm-pre-background:var(--prism-background-color);margin:0;padding:0}.codeBlockTitle_Ktv7+.codeBlockContent_biex .codeBlock_bY9V{border-top-left-radius:0;border-top-right-radius:0}.codeBlockLines_e6Vv{float:left;font:inherit;min-width:100%;padding:var(--ifm-pre-padding)}.codeBlockLinesWithNumbering_o6Pm{display:table;padding:var(--ifm-pre-padding) 0}.buttonGroup__atx{column-gap:.2rem;display:flex;position:absolute;right:calc(var(--ifm-pre-padding)/2);top:calc(var(--ifm-pre-padding)/2)}.buttonGroup__atx button{align-items:center;border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-global-radius);display:flex;line-height:0;opacity:0;padding:.4rem;transition:opacity .2s ease-in-out}.buttonGroup__atx button:focus-visible,.buttonGroup__atx button:hover{opacity:1!important}.theme-code-block:hover .buttonGroup__atx button{opacity:.4}:where(:root){--docusaurus-highlighted-code-line-bg:#484d5b}:where([data-theme=dark]){--docusaurus-highlighted-code-line-bg:#646464}.theme-code-block-highlighted-line{background-color:var(--docusaurus-highlighted-code-line-bg);display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.codeLine_lJS_{counter-increment:a;display:table-row}.codeLineNumber_Tfdd{background:var(--ifm-pre-background);display:table-cell;left:0;overflow-wrap:normal;padding:0 var(--ifm-pre-padding);position:sticky;text-align:right;width:1%}.codeLineNumber_Tfdd:before{content:counter(a);opacity:.4}.codeLineContent_feaV{padding-right:var(--ifm-pre-padding)}.iconEdit_Z9Sw{margin-right:.3em;vertical-align:sub}.theme-code-block:hover .copyButtonCopied_obH4{opacity:1!important}.copyButtonIcons_eSgA{height:1.125rem;position:relative;width:1.125rem}.copyButtonIcon_y97N,.copyButtonSuccessIcon_LjdS{fill:currentColor;height:inherit;left:0;opacity:inherit;position:absolute;top:0;transition:.15s;width:inherit}.copyButtonSuccessIcon_LjdS{color:#00d600;left:50%;opacity:0;top:50%;transform:translate(-50%,-50%) scale(.33)}.copyButtonCopied_obH4 .copyButtonIcon_y97N{opacity:0;transform:scale(.33)}.copyButtonCopied_obH4 .copyButtonSuccessIcon_LjdS{opacity:1;transform:translate(-50%,-50%) scale(1);transition-delay:75ms}.tag_zVej{border:1px solid var(--docusaurus-tag-list-border);transition:border var(--ifm-transition-fast)}.tag_zVej:hover{--docusaurus-tag-list-border:var(--ifm-link-color);text-decoration:none}.tagRegular_sFm0{border-radius:var(--ifm-global-radius);font-size:90%;padding:.2rem .5rem .3rem}.tagWithCount_h2kH{align-items:center;border-left:0;display:flex;padding:0 .5rem 0 1rem;position:relative}.tagWithCount_h2kH:after,.tagWithCount_h2kH:before{border:1px solid var(--docusaurus-tag-list-border);content:"";position:absolute;top:50%;transition:inherit}.tagWithCount_h2kH:before{border-bottom:0;border-right:0;height:1.18rem;right:100%;transform:translate(50%,-50%) rotate(-45deg);width:1.18rem}.tagWithCount_h2kH:after{border-radius:50%;height:.5rem;left:0;transform:translateY(-50%);width:.5rem}.tagWithCount_h2kH span{background:var(--ifm-color-secondary);border-radius:var(--ifm-global-radius);color:var(--ifm-color-black);font-size:.7rem;line-height:1.2;margin-left:.3rem;padding:.1rem .4rem}.wordWrapButtonIcon_Bwma{height:1.2rem;width:1.2rem}.tags_jXut{display:inline}.tag_QGVx{display:inline-block;margin:0 .4rem .5rem 0}.lastUpdated_vwxv{font-size:smaller;font-style:italic;margin-top:.2rem}.tocCollapsibleButton_TO0P{align-items:center;display:flex;font-size:inherit;justify-content:space-between;padding:.4rem .8rem;width:100%}.tocCollapsibleButton_TO0P:after{background:var(--ifm-menu-link-sublist-icon) 50% 50%/2rem 2rem no-repeat;content:"";filter:var(--ifm-menu-link-sublist-icon-filter);height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast);width:1.25rem}.tocCollapsibleButtonExpanded_MG3E:after,.tocCollapsibleExpanded_sAul{transform:none}.tocCollapsible_ETCw{background-color:var(--ifm-menu-color-background-active);border-radius:var(--ifm-global-radius);margin:1rem 0}.tocCollapsibleContent_vkbj>ul{border-left:none;border-top:1px solid var(--ifm-color-emphasis-300);font-size:15px;padding:.2rem 0}.tocCollapsibleContent_vkbj ul li{margin:.4rem .8rem}.details_lb9f{--docusaurus-details-summary-arrow-size:0.38rem;--docusaurus-details-transition:transform 200ms ease;--docusaurus-details-decoration-color:grey}.details_lb9f>summary{cursor:pointer;padding-left:1rem;position:relative}.details_lb9f>summary::-webkit-details-marker{display:none}.details_lb9f>summary:before{border-color:#0000 #0000 #0000 var(--docusaurus-details-decoration-color);border-style:solid;border-width:var(--docusaurus-details-summary-arrow-size);content:"";left:0;position:absolute;top:.45rem;transform:rotate(0);transform-origin:calc(var(--docusaurus-details-summary-arrow-size)/2) 50%;transition:var(--docusaurus-details-transition)}.collapsibleContent_i85q{border-top:1px solid var(--docusaurus-details-decoration-color);margin-top:1rem;padding-top:1rem}.details_b_Ee{--docusaurus-details-decoration-color:var(--ifm-alert-border-color);--docusaurus-details-transition:transform var(--ifm-transition-fast) ease;border:1px solid var(--ifm-alert-border-color);margin:0 0 var(--ifm-spacing-vertical)}.anchorWithStickyNavbar_LWe7{scroll-margin-top:calc(var(--ifm-navbar-height) + .5rem)}.anchorWithHideOnScrollNavbar_WYt5{scroll-margin-top:.5rem}.hash-link{opacity:0;padding-left:.5rem;transition:opacity var(--ifm-transition-fast);-webkit-user-select:none;user-select:none}.hash-link:before{content:"#"}:not(.containsTaskList_mC6p>li)>.containsTaskList_mC6p{padding-left:0}.img_ev3q{height:auto}.admonition_LlT9{margin-bottom:1em}.admonitionHeading_tbUL{font:var(--ifm-heading-font-weight) var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.3rem}.admonitionHeading_tbUL code{text-transform:none}.admonitionIcon_kALy{display:inline-block;margin-right:.4em;vertical-align:middle}.admonitionIcon_kALy svg{fill:var(--ifm-alert-foreground-color);display:inline-block;height:1.6em;width:1.6em}.blogPostFooterDetailsFull_mRVl{flex-direction:column}.tableOfContents_bqdL{overflow-y:auto;position:sticky;top:calc(var(--ifm-navbar-height) + 1rem)}.breadcrumbHomeIcon_YNFT{height:1.1rem;position:relative;top:1px;vertical-align:top;width:1.1rem}.breadcrumbsContainer_Z_bl{--ifm-breadcrumb-size-multiplier:0.8;margin-bottom:.8rem}.title_kItE{--ifm-h1-font-size:3rem;margin-bottom:calc(var(--ifm-leading)*1.25)}@media (min-width:601px){.algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu{left:inherit!important;right:0!important}.algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu:before{right:48px}.algolia-autocomplete .ds-dropdown-menu{background:#0000;border:none;border-radius:4px;height:auto;margin:6px 0 0;max-width:600px;min-width:500px;padding:0;position:relative;text-align:left;top:-6px;z-index:999}}@media (min-width:768px){.algolia-docsearch-suggestion{border-bottom-color:#7671df}.algolia-docsearch-suggestion--subcategory-column{border-right-color:#7671df;color:#4e4726}}@media (min-width:997px){.collapseSidebarButton_PEFL,.expandButton_m80_{background-color:var(--docusaurus-collapse-button-bg)}:root{--docusaurus-announcement-bar-height:30px}.announcementBarClose_gvF7,.announcementBarPlaceholder_vyr4{flex-basis:50px}.searchBox_ZlJk{padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.collapseSidebarButton_PEFL{border:1px solid var(--ifm-toc-border-color);border-radius:0;bottom:0;display:block!important;height:40px;position:sticky}.collapseSidebarButtonIcon_kv0_{margin-top:4px;transform:rotate(180deg)}.expandButtonIcon_BlDH,[dir=rtl] .collapseSidebarButtonIcon_kv0_{transform:rotate(0)}.collapseSidebarButton_PEFL:focus,.collapseSidebarButton_PEFL:hover,.expandButton_m80_:focus,.expandButton_m80_:hover{background-color:var(--docusaurus-collapse-button-bg-hover)}.menuHtmlItem_M9Kj{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu_SIkG{flex-grow:1;padding:.5rem}@supports (scrollbar-gutter:stable){.menu_SIkG{padding:.5rem 0 .5rem .5rem;scrollbar-gutter:stable}}.menuWithAnnouncementBar_GW3s{margin-bottom:var(--docusaurus-announcement-bar-height)}.sidebar_njMd{display:flex;flex-direction:column;height:100%;padding-top:var(--ifm-navbar-height);width:var(--doc-sidebar-width)}.sidebarWithHideableNavbar_wUlq{padding-top:0}.sidebarHidden_VK0M{opacity:0;visibility:hidden}.sidebarLogo_isFc{align-items:center;color:inherit!important;display:flex!important;margin:0 var(--ifm-navbar-padding-horizontal);max-height:var(--ifm-navbar-height);min-height:var(--ifm-navbar-height);text-decoration:none!important}.sidebarLogo_isFc img{height:2rem;margin-right:.5rem}.expandButton_m80_{align-items:center;display:flex;height:100%;justify-content:center;position:absolute;right:0;top:0;transition:background-color var(--ifm-transition-fast) ease;width:100%}[dir=rtl] .expandButtonIcon_BlDH{transform:rotate(180deg)}.docSidebarContainer_b6E3{border-right:1px solid var(--ifm-toc-border-color);-webkit-clip-path:inset(0);clip-path:inset(0);display:block;margin-top:calc(var(--ifm-navbar-height)*-1);transition:width var(--ifm-transition-fast) ease;width:var(--doc-sidebar-width);will-change:width}.docSidebarContainerHidden_b3ry{cursor:pointer;width:var(--doc-sidebar-hidden-width)}.sidebarViewport_Xe31{height:100%;max-height:100vh;position:sticky;top:0}.docMainContainer_gTbr{flex-grow:1;max-width:calc(100% - var(--doc-sidebar-width))}.docMainContainerEnhanced_Uz_u{max-width:calc(100% - var(--doc-sidebar-hidden-width))}.docItemWrapperEnhanced_czyv{max-width:calc(var(--ifm-container-width) + var(--doc-sidebar-width))!important}.lastUpdated_vwxv{text-align:right}.tocMobile_ITEo{display:none}.docItemCol_VOVn,.generatedIndexPage_vN6x{max-width:75%!important}.list_eTzJ article:nth-last-child(-n+2){margin-bottom:0!important}}@media (min-width:1440px){.container{max-width:var(--ifm-container-width-xl)}}@media (max-width:996px){.col{--ifm-col-width:100%;flex-basis:var(--ifm-col-width);margin-left:0}.footer{--ifm-footer-padding-horizontal:0}.colorModeToggle_DEke,.footer__link-separator,.navbar__item,.sidebar_re4s,.tableOfContents_bqdL{display:none}.footer__col{margin-bottom:calc(var(--ifm-spacing-vertical)*3)}.footer__link-item{display:block}.hero{padding-left:0;padding-right:0}.navbar>.container,.navbar>.container-fluid{padding:0}.navbar__toggle{display:inherit}.navbar__search-input{width:9rem}.pills--block,.tabs--block{flex-direction:column}.searchBox_ZlJk{position:absolute;right:var(--ifm-navbar-padding-horizontal)}.docItemContainer_F8PC{padding:0 .3rem}}@media screen and (max-width:996px){.heroBanner_qdFl{padding:2rem}}@media (max-width:600px){.algolia-autocomplete .ds-dropdown-menu{display:block;left:auto!important;max-height:calc(100% - 5rem);max-width:calc(100% - 2rem);position:fixed!important;right:1rem!important;top:50px!important;width:600px;z-index:100}.algolia-autocomplete .ds-dropdown-menu:before{right:6rem}}@media (max-width:576px){.markdown h1:first-child{--ifm-h1-font-size:2rem}.markdown>h2{--ifm-h2-font-size:1.5rem}.markdown>h3{--ifm-h3-font-size:1.25rem}.title_f1Hy{font-size:2rem}}@media (hover:hover){.backToTopButton_sjWU:hover{background-color:var(--ifm-color-emphasis-300)}}@media (pointer:fine){.thin-scrollbar{scrollbar-width:thin}.thin-scrollbar::-webkit-scrollbar{height:var(--ifm-scrollbar-size);width:var(--ifm-scrollbar-size)}.thin-scrollbar::-webkit-scrollbar-track{background:var(--ifm-scrollbar-track-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb{background:var(--ifm-scrollbar-thumb-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--ifm-scrollbar-thumb-hover-background-color)}}@media print{.announcementBar_mb4j,.footer,.menu,.navbar,.pagination-nav,.table-of-contents,.tocMobile_ITEo{display:none}.tabs{page-break-inside:avoid}.codeBlockLines_e6Vv{white-space:pre-wrap}} \ No newline at end of file diff --git a/docs/assets/images/cargo_odra-57b32f7c1e40dbb498e7b1619f4860e0.gif b/docs/assets/images/cargo_odra-57b32f7c1e40dbb498e7b1619f4860e0.gif new file mode 100644 index 000000000..352fddb46 Binary files /dev/null and b/docs/assets/images/cargo_odra-57b32f7c1e40dbb498e7b1619f4860e0.gif differ diff --git a/docs/assets/images/contract-4a6ad767dffcbb5b1b7e793447a41680.png b/docs/assets/images/contract-4a6ad767dffcbb5b1b7e793447a41680.png new file mode 100644 index 000000000..f89e7939e Binary files /dev/null and b/docs/assets/images/contract-4a6ad767dffcbb5b1b7e793447a41680.png differ diff --git a/docs/assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png b/docs/assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png new file mode 100644 index 000000000..c43be0374 Binary files /dev/null and b/docs/assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png differ diff --git a/docs/assets/images/nysa_generic.drawio-9478454b52585f4bd5c3a825f50917f2.svg b/docs/assets/images/nysa_generic.drawio-9478454b52585f4bd5c3a825f50917f2.svg new file mode 100644 index 000000000..1092d0cc5 --- /dev/null +++ b/docs/assets/images/nysa_generic.drawio-9478454b52585f4bd5c3a825f50917f2.svg @@ -0,0 +1,4 @@ + + + +NYSA
C3 AST
C3 AST
Solidity Parser
Solidity Parser
C3 linearization
C3 linearization
Parser
Parser
Solidity
code
Solidity...
Generates
target
specific code
Generates...
Builds
Builds
Target Platform
Target Platform
WASM
WASM
Text is not SVG - cannot display
\ No newline at end of file diff --git a/docs/assets/images/nysa_odra.drawio-e8d8d662f0a2e5e364005985245721fd.svg b/docs/assets/images/nysa_odra.drawio-e8d8d662f0a2e5e364005985245721fd.svg new file mode 100644 index 000000000..8986e2d04 --- /dev/null +++ b/docs/assets/images/nysa_odra.drawio-e8d8d662f0a2e5e364005985245721fd.svg @@ -0,0 +1,4 @@ + + + +NYSA
C3 AST
C3 AST
Solidity Parser
Solidity Parser
C3 linearization
C3 linearization
ODRA PARSER
ODRA PARSER
Solidity
code
Solidity...
Generates
Odra module
Generates...
Builds
Builds
ODRA
ODRA
WASM
WASM
Text is not SVG - cannot display
\ No newline at end of file diff --git a/docs/assets/images/roadmap-8255e4b08deb4134a7e97e32c21ad0dc.png b/docs/assets/images/roadmap-8255e4b08deb4134a7e97e32c21ad0dc.png new file mode 100644 index 000000000..2feeb5666 Binary files /dev/null and b/docs/assets/images/roadmap-8255e4b08deb4134a7e97e32c21ad0dc.png differ diff --git a/docs/assets/images/transactions-3d96ebac6e49c7b9bee5ef5bc14a4ef4.png b/docs/assets/images/transactions-3d96ebac6e49c7b9bee5ef5bc14a4ef4.png new file mode 100644 index 000000000..2b3bbd757 Binary files /dev/null and b/docs/assets/images/transactions-3d96ebac6e49c7b9bee5ef5bc14a4ef4.png differ diff --git a/docs/assets/images/twitter-card-0f7e768e63da0acd629609954ba26f62.png b/docs/assets/images/twitter-card-0f7e768e63da0acd629609954ba26f62.png new file mode 100644 index 000000000..fa6769541 Binary files /dev/null and b/docs/assets/images/twitter-card-0f7e768e63da0acd629609954ba26f62.png differ diff --git a/docs/assets/images/twitter-card-941b7cfa84d4da7dd4848d3556845b53.png b/docs/assets/images/twitter-card-941b7cfa84d4da7dd4848d3556845b53.png new file mode 100644 index 000000000..5ad018378 Binary files /dev/null and b/docs/assets/images/twitter-card-941b7cfa84d4da7dd4848d3556845b53.png differ diff --git a/docs/assets/images/wallet-d80c30c75d661377a4d31b1c8fb24664.png b/docs/assets/images/wallet-d80c30c75d661377a4d31b1c8fb24664.png new file mode 100644 index 000000000..7ac8d99fd Binary files /dev/null and b/docs/assets/images/wallet-d80c30c75d661377a4d31b1c8fb24664.png differ diff --git a/docs/assets/js/0030fd86.5a85d5cb.js b/docs/assets/js/0030fd86.5a85d5cb.js new file mode 100644 index 000000000..9261dd0f5 --- /dev/null +++ b/docs/assets/js/0030fd86.5a85d5cb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[21887],{47619:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.5.0","label":"0.5.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.5.0","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.5.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.5.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.5.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.5.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.5.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.5.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.5.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.5.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.5.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.5.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.5.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.5.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.5.0/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.5.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.5.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.5.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.5.0/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Module reusing","href":"/docs/0.5.0/advanced/using","docId":"advanced/using"},{"type":"link","label":"Delegate","href":"/docs/0.5.0/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.5.0/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.5.0/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Signatures","href":"/docs/0.5.0/advanced/signatures","docId":"advanced/signatures"}],"href":"/docs/0.5.0/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.5.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"MockVM","href":"/docs/0.5.0/backends/mock-vm","docId":"backends/mock-vm"},{"type":"link","label":"Casper","href":"/docs/0.5.0/backends/casper","docId":"backends/casper"}],"href":"/docs/0.5.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.5.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.5.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.5.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.5.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.5.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.5.0/tutorials/owned-token","docId":"tutorials/owned-token"}],"href":"/docs/0.5.0/category/tutorials"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/signatures":{"id":"advanced/signatures","title":"Signatures","description":"As each backend can use a different scheme for generating key pairs,","sidebar":"tutorialSidebar"},"advanced/using":{"id":"advanced/using","title":"Module reusing","description":"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/mock-vm":{"id":"backends/mock-vm","title":"MockVM","description":"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/0093993c.dc79e333.js b/docs/assets/js/0093993c.dc79e333.js new file mode 100644 index 000000000..9f7060ee7 --- /dev/null +++ b/docs/assets/js/0093993c.dc79e333.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[87945],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=d(n),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return n?a.createElement(w,o(o({ref:t},u),{},{components:n})):a.createElement(w,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.9.1/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.9.1/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.9.1/tutorials/ownable",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.9.1/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.9.1/tutorials/erc20"}},s={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining a constructor,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(events = [OwnershipChanged])]\npub struct Ownable {\n owner: Var>\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basics before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4")," - Firstly, we need to create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module(events = [OwnershipChanged])]")," attribute to it. The ",(0,r.kt)("inlineCode",{parentName:"li"},"events")," attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," is a type that will be defined later."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n pub fn init(&mut self, owner: Address) {\n if self.owner.get_or_default().is_some() {\n self.env().revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(Some(owner));\n \n self.env().emit_event(OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n });\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerIsAlreadyInitialized = 1,\n}\n\n#[odra::event]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an Odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is a constructor. This matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-L20")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]")," attribute is applied to the enum. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4-L6")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::revert()")," function with an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsAlreadyInitialized")," argument. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Then we write the owner passed as an argument to the storage. To do so, we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22-L26")," - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::event]")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L10")," - Finally, call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::emit_event()")," passing the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," instance to the function. Hence, we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),". ")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get_or_default().as_ref() {\n self.env().revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&self.env().caller());\n let current_owner = self.get_owner();\n self.owner.set(Some(*new_owner));\n self.env().emit_event(OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n });\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get_or_default() {\n Some(owner) => owner,\n None => self.env().revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n NotOwner = 1,\n OwnerIsAlreadyInitialized = 2,\n OwnerIsNotInitialized = 3,\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7,L31")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," reads the current owner and reverts if it does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also, we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum by adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in the ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::caller()")," function. Then we update the state and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L21,L33")," - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),". There is one worth-mentioning subtlety: ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," function returns ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements the ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call the ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function, and the contract does not fail even if the value is not initialized. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"owner")," is of type ",(0,r.kt)("inlineCode",{parentName:"li"},"Option
")," the ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," would return ",(0,r.kt)("inlineCode",{parentName:"li"},"Option>"),", we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get_or_default()")," instead.")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::{Deployer, HostEnv, HostRef};\n\n fn setup() -> (OwnableHostRef, HostEnv, Address) {\n let env: HostEnv = odra_test::env();\n let init_args = OwnableInitArgs {\n owner: env.get_account(0)\n };\n (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))\n }\n\n #[test]\n fn initialization_works() {\n let (ownable, env, owner) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (mut ownable, env, owner) = setup();\n let new_owner = env.get_account(1);\n \n env.set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n\n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (mut ownable, env, _) = setup();\n let new_owner = env.get_account(1);\n ownable.change_ownership(&new_owner);\n \n assert_eq!(\n ownable.try_change_ownership(&new_owner), \n Err(Error::NotOwner.into())\n );\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we have defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, which we call in the first statement of each test. Take a look at the signature: ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (OwnableHostRef, HostEnv, Address)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef")," is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7-L11")," - The starting point of every test is getting an instance of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," by calling ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),". Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," attribute implements a ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer")," for ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableInitArgs")," that we pass as the second argument of the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function. Lastly, the module needs an owner. The easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". We choose the address of first account (which is the default one). "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - It is time to define the first test. As you see, it is a regular Rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16-17")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L19-25")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event to have been emitted. To assert that, let's use ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". To get the env, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"env()")," on the contract, then call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::emitted_event"),". As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L31")," - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L33")," - As mentioned, the default is the 0th account, if you want to change the executor, call the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L46-55")," - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::try_change_ownership()")," instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::change_ownership()"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," provides try_ functions for each contract's entrypoint. The ",(0,r.kt)("inlineCode",{parentName:"li"},"try")," functions return ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraResult")," (an alias for ",(0,r.kt)("inlineCode",{parentName:"li"},"Result"),") instead of panicking and halting the execution. In our case, we expect the contract to revert with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::NotOwner")," error. To compare the error, we use the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::into()")," function, which converts the error into the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," type.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/01086ac7.7e27c5ae.js b/docs/assets/js/01086ac7.7e27c5ae.js new file mode 100644 index 000000000..b69cec47c --- /dev/null +++ b/docs/assets/js/01086ac7.7e27c5ae.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[60516],{54816:a=>{a.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.9.1/category/backends","navigation":{"previous":{"title":"Building contracts manually","permalink":"/docs/0.9.1/advanced/building-manually"},"next":{"title":"What is a backend?","permalink":"/docs/0.9.1/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/01337889.3f9ca992.js b/docs/assets/js/01337889.3f9ca992.js new file mode 100644 index 000000000..2b076051f --- /dev/null +++ b/docs/assets/js/01337889.3f9ca992.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[65969],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=l(n),d=o,f=p["".concat(c,".").concat(d)]||p[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.9.1/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.9.1/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.9.1/basics/communicating-with-host",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.9.1/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.9.1/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],u={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module]\npub struct HostContract {\n name: Var,\n created_at: Var,\n created_by: Var
\n}\n\n#[odra::module]\nimpl HostContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(self.env().get_block_time());\n self.created_by.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"self.env()"),". It is an implementation of ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/module/trait.Module.html#tymehtod.env"},(0,o.kt)("inlineCode",{parentName:"a"},"Module::env()")),", autogenerated\nby ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The function returns a reference to the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/struct.ContractEnv.html"},(0,o.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," (you can read more in\nthe ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/what-is-a-backend#contract-env"},(0,o.kt)("inlineCode",{parentName:"a"},"Backend section")),"). This is a structure that provides access to the host functions and variables. "),(0,o.kt)("p",null,"In this example, we use two of them:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"get_block_time()")," - returns the current block time as u64. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"caller()")," - returns an Odra ",(0,o.kt)("inlineCode",{parentName:"li"},"Address")," of the caller (this can be an external caller or another contract).")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/01e5113f.00e09ea3.js b/docs/assets/js/01e5113f.00e09ea3.js new file mode 100644 index 000000000..e31d44d32 --- /dev/null +++ b/docs/assets/js/01e5113f.00e09ea3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83052],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.6.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.6.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.6.0/basics/odra-toml",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.6.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.6.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," will be used as a name for the contract - the generated wasm file will be in the above case named\n",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the builder to locate the exact struct where\nthe contract is defined."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n\n[[contracts]]\nname = "counter"\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/02192c58.fcf39d71.js b/docs/assets/js/02192c58.fcf39d71.js new file mode 100644 index 000000000..75a3cad46 --- /dev/null +++ b/docs/assets/js/02192c58.fcf39d71.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[64836],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(h,s(s({ref:t},d),{},{components:n})):r.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.5.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.5.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.5.0/basics/testing",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.5.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.5.0/basics/errors"}},l={},c=[{value:"Test env",id:"test-env",level:2},{value:"Deployer",id:"deployer",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{Variable, List};\n\n#[cfg(test)]\nmod tests {\n use super::DogContract3Deployer;\n\n #[test]\n fn init_test() {\n let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(module)]")," macro created a Deployer code for us, which will deploy the contract on the\nVM:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n')),(0,a.kt)("p",null,"From now on, we can use ",(0,a.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with a macro are available to us:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,a.kt)("h2",{id:"test-env"},"Test env"),(0,a.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use super::TestingContractDeployer;\n\n #[test]\n fn test_env() {\n let testing_contract = TestingContractDeployer::init("MyContract".to_string());\n let creator = testing_contract.created_by();\n odra::test_env::set_caller(odra::test_env::get_account(1));\n let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());\n let creator2 = testing_contract2.created_by();\n assert!(creator != creator2);\n }\n}\n')),(0,a.kt)("p",null,"In the code above, we are deploying two instances of the same contract, but we're using ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::test_env::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::contract_env::caller()"),"\nthe function we are calling inside the contract."),(0,a.kt)("p",null,"Each test env comes with a set of functions that will let you write better tests:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_caller(address: Address)")," - you've seen it in action just now"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn token_balance(address: Address) -> Balance")," - it returns the balance of the account associated with the given address"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn advance_block_time_by(seconds: BlockTime)")," - it increases the current value of block_time"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_account(n: usize) -> Address")," - it returns an nth address that was prepared for you by Odra in advance;\nby default, you start with the 0th account"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn assert_exception(err: E, block: F)")," - it executes the ",(0,a.kt)("inlineCode",{parentName:"li"},"block")," code and expects ",(0,a.kt)("inlineCode",{parentName:"li"},"err")," to happen"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_event(address: Address, index: i32) -> Result")," - returns\nthe event emitted by the contract")),(0,a.kt)("p",null,"Again, we'll see those used in the next articles."),(0,a.kt)("h2",{id:"deployer"},"Deployer"),(0,a.kt)("p",null,"You may be wondering what is the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractDeployer")," and where did it come from.\nIt is a piece of code generated automatically for you, thanks to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nIf you used the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," on one of the methods, it will be the constructor of your contract.\nOdra will make sure that it is called only once, so you can use it to initialize your data structures etc."),(0,a.kt)("p",null,"If you do not provide the init method, you can deploy the contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"::default()")," method.\nIn the end, you will get a ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," instance (in our case the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractRef"),") which reimplements all\nthe methods you defined in the contract, but executes them on a blockchain!"),(0,a.kt)("p",null,"To learn more about the ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," contract, visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/cross-calls"},"Cross calls")," article."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We take a look at how Odra handles errors!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/028141a3.0f670700.js b/docs/assets/js/028141a3.0f670700.js new file mode 100644 index 000000000..38dc9c545 --- /dev/null +++ b/docs/assets/js/028141a3.0f670700.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[18283],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},d),{},{components:r})):n.createElement(f,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.2.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.2.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.2.0/basics/directory-structure",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"defaultSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.2.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.2.0/basics/odra-toml"}},s={},c=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:".builder_* folders",id:"builder_-folders",level:2},{value:"src/",id:"src",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 .builder_casper/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.2.0", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. We are using two features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/mock-vm")," - it is responsible for running tests on Odra's MockVM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/casper")," - backend implementation of Casper blockchain\nMore backends will be released as features that will be possible to enable here.")),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"builder_-folders"},".builder_* folders"),(0,a.kt)("p",null,"Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary\nfor building wasm files and running them against blockchain VMs. As it is not necessary to modify\nfiles in those folders in any way, by default they are hidden (hence the ",(0,a.kt)("inlineCode",{parentName:"p"},".")," at the beginning of the\nfolder name)."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain of your choosing."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/02a3f783.1a12f8e6.js b/docs/assets/js/02a3f783.1a12f8e6.js new file mode 100644 index 000000000..08280cae9 --- /dev/null +++ b/docs/assets/js/02a3f783.1a12f8e6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99410],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(t),m=o,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.5.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.5.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.5.0/tutorials/owned-token",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.5.0/tutorials/erc20"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function c(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow minting tokens but only the module owner."),(0,o.kt)("li",{parentName:"ol"},"The current owner should be able to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use odra::types::{Address, Balance}\n\n...\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.ownable.ensure_ownership(&contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L11")," - A constructor is a great place to init both modules at once. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L14-L16")," - Most of the entrypoints do not need any modification, so we simply delegates them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L52")," - The same we do with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L58-L61")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/030cb818.91616ce2.js b/docs/assets/js/030cb818.91616ce2.js new file mode 100644 index 000000000..6085a0721 --- /dev/null +++ b/docs/assets/js/030cb818.91616ce2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[86683],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function l(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=t.createContext({}),d=function(e){var n=t.useContext(i),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},p=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=d(r),m=o,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||a;return r?t.createElement(f,l(l({ref:n},c),{},{components:r})):t.createElement(f,l({ref:n},c))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=p;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var d=2;d{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var t=r(87462),o=(r(67294),r(3905));const a={sidebar_position:4},l="Access Control",s={unversionedId:"tutorials/access-control",id:"version-0.9.0/tutorials/access-control",title:"Access Control",description:"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,",source:"@site/versioned_docs/version-0.9.0/tutorials/access-control.md",sourceDirName:"tutorials",slug:"/tutorials/access-control",permalink:"/docs/0.9.0/tutorials/access-control",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"OwnedToken",permalink:"/docs/0.9.0/tutorials/owned-token"},next:{title:"Pausable",permalink:"/docs/0.9.0/tutorials/pauseable"}},i={},d=[{value:"Code",id:"code",level:2},{value:"Project Structure",id:"project-structure",level:3},{value:"Events and Errors",id:"events-and-errors",level:3},{value:"Module",id:"module",level:3}],c={toc:d};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"access-control"},"Access Control"),(0,o.kt)("p",null,"In a previous tutorial, we introduced the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.0/tutorials/ownable"},(0,o.kt)("inlineCode",{parentName:"a"},"Ownable"))," module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient, "),(0,o.kt)("p",null,"In this article we design and implement a more fine-grained access control layer."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"Before we start writing code, we list the functionalities of our access control layer."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type is used across the module."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be assigned to many ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es."),(0,o.kt)("li",{parentName:"ol"},"Each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," may have a corresponding admin role."),(0,o.kt)("li",{parentName:"ol"},"Only an admin can grant/revoke a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),"."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be renounced."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," cannot be renounced on someone's behalf."),(0,o.kt)("li",{parentName:"ol"},"Each action triggers an event."),(0,o.kt)("li",{parentName:"ol"},"Unauthorized access stops contract execution.")),(0,o.kt)("h3",{id:"project-structure"},"Project Structure"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-plaintext"},"access-control\n\u251c\u2500\u2500 src\n\u2502 \u251c\u2500\u2500 access\n\u2502 \u2502 \u251c\u2500\u2500 access_control.rs\n\u2502 \u2502 \u251c\u2500\u2500 events.rs\n\u2502 \u2502 \u2514\u2500\u2500 errors.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n|\u2500\u2500 build.rs\n|\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 Odra.toml\n")),(0,o.kt)("h3",{id:"events-and-errors"},"Events and Errors"),(0,o.kt)("p",null,"There are three actions that can be performed concerning a ",(0,o.kt)("inlineCode",{parentName:"p"},"Role"),": granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=events.rs showLineNumbers",title:"events.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\nuse super::access_control::Role;\n\n#[odra::event]\npub struct RoleGranted {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleRevoked {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleAdminChanged {\n pub role: Role,\n pub previous_admin_role: Role,\n pub new_admin_role: Role\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L5-L17")," - to describe the grant or revoke actions, our events specify the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", and ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es indicating who receives or loses access and who provides or withdraws it."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L19-L24")," - the event describing the admin role change, requires the subject ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", the previous and the current admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=errors.rs",title:"errors.rs"},"#[odra::odra_error]\npub enum Error {\n MissingRole = 20_000,\n RoleRenounceForAnotherAddress = 20_001,\n}\n")),(0,o.kt)("p",null,"Errors definition is straightforward - there are only two invalid states: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"An action is triggered by an unauthorized actor."),(0,o.kt)("li",{parentName:"ol"},"The caller is attempting to resign the Role on someone's behalf. ")),(0,o.kt)("h3",{id:"module"},"Module"),(0,o.kt)("p",null,"Now, we are stepping into the most interesting part: the module definition and implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=access_control.rs showLineNumbers",title:"access_control.rs",showLineNumbers:!0},"use super::events::*;\nuse super::errors::Error;\nuse odra::prelude::*;\nuse odra::{Address, Mapping};\n\npub type Role = [u8; 32];\n\npub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];\n\n#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]\npub struct AccessControl {\n roles: Mapping<(Role, Address), bool>,\n role_admin: Mapping\n}\n\n#[odra::module]\nimpl AccessControl {\n pub fn has_role(&self, role: &Role, address: &Address) -> bool {\n self.roles.get_or_default(&(*role, *address))\n }\n\n pub fn get_role_admin(&self, role: &Role) -> Role {\n let admin_role = self.role_admin.get(role);\n if let Some(admin) = admin_role {\n admin\n } else {\n DEFAULT_ADMIN_ROLE\n }\n }\n\n pub fn grant_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_grant_role(role, address);\n }\n\n pub fn revoke_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_revoke_role(role, address);\n }\n\n pub fn renounce_role(&mut self, role: &Role, address: &Address) {\n if address != &self.env().caller() {\n self.env().revert(Error::RoleRenounceForAnotherAddress);\n }\n self.unchecked_revoke_role(role, address);\n }\n}\n\nimpl AccessControl {\n pub fn check_role(&self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.env().revert(Error::MissingRole);\n }\n }\n\n pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {\n let previous_admin_role = self.get_role_admin(role);\n self.role_admin.set(role, *admin_role);\n self.env().emit_event(RoleAdminChanged {\n role: *role,\n previous_admin_role,\n new_admin_role: *admin_role\n });\n }\n\n pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.roles.set(&(*role, *address), true);\n self.env().emit_event(RoleGranted {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n\n pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {\n if self.has_role(role, address) {\n self.roles.set(&(*role, *address), false);\n self.env().emit_event(RoleRevoked {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L6")," - Firstly, we need the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type. It is simply an alias for a 32-byte array."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L8")," - The default role is an array filled with zeros."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L13")," - The storage consists of two mappings:")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"roles")," - a nested mapping that stores information about whether a certain Role is granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"role_admin")," - each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can have a single admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L18-L20")," - This is a simple check to determine if a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," has been granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),". It is an exposed entry point and an important building block widely used throughout the entire module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49")," - This is a non-exported block containing helper functions."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L54")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," function serves as a guard function. Before a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with ",(0,o.kt)("inlineCode",{parentName:"li"},"Error::MissingRole"),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L56-L64")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"set_admin_role()")," function simply updates the role_admin mapping and emits the ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleAdminChanged")," event."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L66-L86")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_revoke_role()")," functions are mirror functions that update the roles mapping and post ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleGranted")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleRevoked")," events. If the role is already granted, ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," has no effect (the opposite check is made in the case of revoking a role)."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L22-L29")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"get_role_admin()")," entry point reads the role_admin. If there is no admin role for a given role, it returns the default role."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L31-L46")," - This is a combination of ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_*_role()"),". Entry points fail on unauthorized access.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/031cd168.a427750a.js b/docs/assets/js/031cd168.a427750a.js new file mode 100644 index 000000000..e4011a278 --- /dev/null +++ b/docs/assets/js/031cd168.a427750a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74861],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>d});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),u=s(n),d=r,g=u["".concat(c,".").concat(d)]||u[d]||p[d]||o;return n?a.createElement(g,i(i({ref:t},m),{},{components:n})):a.createElement(g,i({ref:t},m))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Building contracts manually",l={unversionedId:"advanced/building-manually",id:"version-0.8.1/advanced/building-manually",title:"Building contracts manually",description:"cargo odra is a great tool to build and test your contracts, but sometimes",source:"@site/versioned_docs/version-0.8.1/advanced/06-building-manually.md",sourceDirName:"advanced",slug:"/advanced/building-manually",permalink:"/docs/0.8.1/advanced/building-manually",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:6,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Memory allocators",permalink:"/docs/0.8.1/advanced/using-different-allocator"},next:{title:"Backends",permalink:"/docs/0.8.1/category/backends"}},c={},s=[{value:"Building the contract manually",id:"building-the-contract-manually",level:2},{value:"Optimizing the contract",id:"optimizing-the-contract",level:2},{value:"Running the tests manually",id:"running-the-tests-manually",level:2},{value:"Wrapping up",id:"wrapping-up",level:2}],m={toc:s};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"building-contracts-manually"},"Building contracts manually"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a great tool to build and test your contracts, but sometimes\na better control over the parameters that are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),"\nor the compiler is needed. "),(0,r.kt)("p",null,"This is especially useful when the project has multiple features, and there is a need\nto switch between them during the building and testing."),(0,r.kt)("p",null,"Knowing that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a simple wrapper around ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),", it is easy to replicate\nthe same behavior by using ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo")," directly."),(0,r.kt)("h2",{id:"building-the-contract-manually"},"Building the contract manually"),(0,r.kt)("p",null,"To build the contract manually, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Odra uses the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"ODRA_MODULE")," to determine which contract to build.")),(0,r.kt)("p",null,"Assuming that project's crate is named ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),", this command will build\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," contract in release mode and generate the wasm file.\nThe file will be put into the ",(0,r.kt)("inlineCode",{parentName:"p"},"target/wasm32-unknown-unknown/release")," directory under\nthe name ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project_build_contract.wasm"),"."),(0,r.kt)("p",null,"The Odra Framework expects the contracts to be placed in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory, and\nto be named correctly, so the next step would be to move the file:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm\n")),(0,r.kt)("h2",{id:"optimizing-the-contract"},"Optimizing the contract"),(0,r.kt)("p",null,"To lower the size of the wasm file, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-strip")," tool:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-strip wasm/my_contract.wasm\n")),(0,r.kt)("p",null,"To further optimize the wasm file, the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-opt")," tool is also used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"This step is required, as the wasm file generated by the Rust compiler is not\nfully compatible with the Casper execution engine.")),(0,r.kt)("h2",{id:"running-the-tests-manually"},"Running the tests manually"),(0,r.kt)("p",null,"To run the tests manually, Odra needs to know which backend to use.\nTo run tests agains Casper backend, the following command needs to be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_BACKEND=casper cargo test\n")),(0,r.kt)("h2",{id:"wrapping-up"},"Wrapping up"),(0,r.kt)("p",null,"Let's say we want to build the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," in debug mode, run the tests against the\ncasper backend and use the ",(0,r.kt)("inlineCode",{parentName:"p"},"my-own-allocator")," feature from our ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," project."),(0,r.kt)("p",null,"To do that, we can use the following set of commands:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract\nmv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm\nwasm-strip wasm/my_contract.wasm\nwasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\nODRA_BACKEND=casper cargo test --features my-own-allocator\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/03436d61.8b173a40.js b/docs/assets/js/03436d61.8b173a40.js new file mode 100644 index 000000000..2fe5ddfea --- /dev/null +++ b/docs/assets/js/03436d61.8b173a40.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97417],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,f=d["".concat(l,".").concat(k)]||d[k]||p[k]||i;return n?r.createElement(f,o(o({ref:t},u),{},{components:n})):r.createElement(f,o({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:6},o="Ticketing System",s={unversionedId:"tutorials/nft",id:"version-1.0.0/tutorials/nft",title:"Ticketing System",description:"Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens.",source:"@site/versioned_docs/version-1.0.0/tutorials/nft.md",sourceDirName:"tutorials",slug:"/tutorials/nft",permalink:"/docs/tutorials/nft",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"tutorialSidebar",previous:{title:"Pausable",permalink:"/docs/tutorials/pauseable"},next:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/tutorials/build-deploy-read"}},l={},c=[{value:"Ticket Office Contract",id:"ticket-office-contract",level:3},{value:"Setup the project",id:"setup-the-project",level:3},{value:"Contract implementation",id:"contract-implementation",level:3},{value:"Redesign",id:"redesign",level:3},{value:"Ticket Operator Contract",id:"ticket-operator-contract",level:4},{value:"Conclusion",id:"conclusion",level:3}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ticketing-system"},"Ticketing System"),(0,a.kt)("p",null,"Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens."),(0,a.kt)("p",null,"Our contract will adhere to the CEP-78 standard, which is the standard for NFTs on the Casper blockchain."),(0,a.kt)("p",null,"Learn more about the CEP-78 standard ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/casper-ecosystem/cep-78-enhanced-nft/tree/dev/docs"},"here"),"."),(0,a.kt)("h3",{id:"ticket-office-contract"},"Ticket Office Contract"),(0,a.kt)("p",null,"Our TicketOffice contract will include the following features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Compliance with the CEP-78 standard."),(0,a.kt)("li",{parentName:"ul"},"Ownership functionality."),(0,a.kt)("li",{parentName:"ul"},"Only the owner can issue new event tickets."),(0,a.kt)("li",{parentName:"ul"},"Users can purchase tickets for events."),(0,a.kt)("li",{parentName:"ul"},"Tickets are limited to a one-time sale."),(0,a.kt)("li",{parentName:"ul"},"Public access to view the total income of the ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOffice"),".")),(0,a.kt)("h3",{id:"setup-the-project"},"Setup the project"),(0,a.kt)("p",null,"Creating a new NFT token with Odra is straightforward. Use the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command to create a new project with the CEP-78 template:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name ticket-office --template cep78\n")),(0,a.kt)("h3",{id:"contract-implementation"},"Contract implementation"),(0,a.kt)("p",null,"Let's start implementing the ",(0,a.kt)("inlineCode",{parentName:"p"},"TicketOffice")," contract by modify the code generated from the template. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},'use odra::{\n args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert\n};\nuse odra_modules::access::Ownable;\nuse odra_modules::cep78::{\n modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode},\n token::Cep78,\n};\n\npub type TicketId = u64;\n\n#[odra::odra_type]\npub enum TicketStatus {\n Available,\n Sold,\n}\n\n#[odra::odra_type]\npub struct TicketInfo {\n event_name: String,\n price: U512,\n status: TicketStatus,\n}\n\n#[odra::event]\npub struct OnTicketIssue {\n ticket_id: TicketId,\n event_name: String,\n price: U512,\n}\n\n#[odra::event]\npub struct OnTicketSell {\n ticket_id: TicketId,\n buyer: Address,\n}\n\n#[odra::odra_error]\npub enum Error {\n TicketNotAvailableForSale = 200,\n InsufficientFunds = 201,\n InvalidTicketId = 202,\n TicketDoesNotExist = 203,\n}\n\n#[odra::module(\n events = [OnTicketIssue, OnTicketSell],\n errors = Error\n)]\npub struct TicketOffice {\n token: SubModule,\n ownable: SubModule,\n tickets: Mapping,\n}\n\n#[odra::module]\nimpl TicketOffice {\n pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) {\n self.ownable.init();\n let receipt_name = format!("cep78_{}", collection_name);\n self.token.init(\n collection_name,\n collection_symbol,\n total_supply,\n OwnershipMode::Transferable,\n NFTKind::Digital,\n NFTIdentifierMode::Ordinal,\n NFTMetadataKind::Raw,\n MetadataMutability::Immutable,\n receipt_name,\n // remaining args are optional and can set to Maybe::None\n ...\n );\n }\n\n pub fn issue_ticket(&mut self, event_name: String, price: U512) {\n let env = self.env();\n let caller = env.caller();\n self.ownable.assert_owner(&caller);\n // mint a new token\n let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None);\n let ticket_id: u64 = token_id\n .parse()\n .map_err(|_| Error::InvalidTicketId)\n .unwrap_or_revert(&env);\n // store ticket info\n self.tickets.set(\n &ticket_id,\n TicketInfo {\n event_name: event_name.clone(),\n price,\n status: TicketStatus::Available,\n },\n );\n // emit an event\n env.emit_event(OnTicketIssue {\n ticket_id,\n event_name,\n price,\n });\n }\n\n #[odra(payable)]\n pub fn buy_ticket(&mut self, ticket_id: TicketId) {\n let env = self.env();\n let owner = self.ownable.get_owner();\n let buyer = env.caller();\n let value = env.attached_value();\n // only tokens owned by the owner can be sold\n if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner {\n env.revert(Error::TicketNotAvailableForSale);\n }\n let mut ticket = self\n .tickets\n .get(&ticket_id)\n .unwrap_or_revert_with(&env, Error::TicketDoesNotExist);\n // only available tickets can be sold\n if ticket.status != TicketStatus::Available {\n env.revert(Error::TicketNotAvailableForSale);\n }\n // check if the buyer sends enough funds\n if value < ticket.price {\n env.revert(Error::InsufficientFunds);\n }\n // transfer csprs to the owner\n env.transfer_tokens(&owner, &value);\n // transfer the ticket to the buyer\n self.token\n .transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer);\n ticket.status = TicketStatus::Sold;\n self.tickets.set(&ticket_id, ticket);\n\n env.emit_event(OnTicketSell { ticket_id, buyer });\n }\n\n pub fn balance_of(&self) -> U512 {\n self.env().self_balance()\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10-L44")," - We define structures and enums that will be used in our contract. ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketStatus")," enum represents the status of a ticket, ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketInfo")," struct contains information about a ticket that is written to the storage, ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketId")," is a type alias for ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),". ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketIssue")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketSell")," are events that will be emitted when a ticket is issued or sold."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L46-L49")," - Register errors and events that will be used in our contract, required to produce a complete contract schema."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L51-L53")," - ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOffice")," module definition. The module contains a ",(0,a.kt)("inlineCode",{parentName:"li"},"Cep78")," token, an ",(0,a.kt)("inlineCode",{parentName:"li"},"Ownable")," module, and a ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," that stores information about tickets."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L58-L74")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"init")," function has been generated from the template and there is no need to modify it, except the ",(0,a.kt)("inlineCode",{parentName:"li"},"Ownable")," module initialization."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L76-L94")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"issue_ticket")," function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketIssue")," event."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L103")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"payable")," attribute indicates that the ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function can receive funds."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L104-L134")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketSell")," event.")),(0,a.kt)("p",null,"Lets test the contract. The test scenario will be as follows:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Deploy the contract."),(0,a.kt)("li",{parentName:"ol"},"Issue two tickets."),(0,a.kt)("li",{parentName:"ol"},"Try to buy a ticket with insufficient funds."),(0,a.kt)("li",{parentName:"ol"},"Buy tickets."),(0,a.kt)("li",{parentName:"ol"},"Try to buy the same ticket again."),(0,a.kt)("li",{parentName:"ol"},"Check the balance of the contract.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/tests.rs"',showLineNumbers:!0,title:'"src/tests.rs"'},'use odra::{\n casper_types::U512,\n host::{Deployer, HostRef},\n};\n\nuse crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs};\n\n#[test]\nfn it_works() {\n let env = odra_test::env();\n let init_args = TicketOfficeInitArgs {\n collection_name: "Ticket".to_string(),\n collection_symbol: "T".to_string(),\n total_supply: 100,\n }; \n let mut contract = TicketOfficeHostRef::deploy(&env, init_args);\n contract.issue_ticket("Ev".to_string(), U512::from(100));\n contract.issue_ticket("Ev".to_string(), U512::from(50));\n\n let buyer = env.get_account(1);\n env.set_caller(buyer);\n\n assert_eq!(\n contract\n .with_tokens(U512::from(50))\n .try_buy_ticket(0),\n Err(Error::InsufficientFunds.into())\n );\n\n assert_eq!(\n contract\n .with_tokens(U512::from(100))\n .try_buy_ticket(0),\n Ok(())\n );\n assert_eq!(\n contract\n .with_tokens(U512::from(50))\n .try_buy_ticket(1),\n Ok(())\n );\n\n assert_eq!(\n contract\n .with_tokens(U512::from(100))\n .try_buy_ticket(0),\n Err(Error::TicketNotAvailableForSale.into())\n );\n}\n')),(0,a.kt)("p",null,"Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with ",(0,a.kt)("inlineCode",{parentName:"p"},"Cep78Error::InvalidTokenOwner")," because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="odra/modules/src/cep78/token78.rs"',title:'"odra/modules/src/cep78/token78.rs"'},"pub fn transfer(\n &mut self,\n token_id: Maybe,\n token_hash: Maybe,\n source_key: Address,\n target_key: Address\n) -> TransferReceipt {\n ...\n\n if !is_owner && !is_approved && !is_operator {\n self.revert(CEP78Error::InvalidTokenOwner);\n }\n\n ...\n}\n")),(0,a.kt)("p",null,"Let's fix it by redesigning our little system."),(0,a.kt)("h3",{id:"redesign"},"Redesign"),(0,a.kt)("p",null,"Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary \u2014 an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets."),(0,a.kt)("p",null,"The sequence diagram below illustrates the new flow:"),(0,a.kt)("mermaid",{value:"sequenceDiagram;\n autonumber\n actor Owner\n Owner->>+TicketOffice: Deploy\n Owner->>+Operator: Deploy\n actor Buyer\n Owner->>TicketOffice: call register_operator\n TicketOffice->>Operator: Register\n Operator->>TicketOffice: Register\n Owner->>TicketOffice: call issue_ticket\n TicketOffice->>Operator: Approve\n Buyer->>Operator: call buy_ticket\n Operator->>TicketOffice: call buy_ticket\n TicketOffice->>Buyer: Transfer ticket"}),(0,a.kt)("h4",{id:"ticket-operator-contract"},"Ticket Operator Contract"),(0,a.kt)("p",null,"As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra generate -c ticket_operator\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/ticket_operator.rs"',showLineNumbers:!0,title:'"src/ticket_operator.rs"'},"use crate::token::{TicketId, TicketOfficeContractRef};\nuse odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var};\n\n#[odra::odra_error]\npub enum Error {\n UnknownTicketOffice = 300,\n}\n\n#[odra::module(errors = Error)]\npub struct TicketOperator {\n ticket_office_address: Var
,\n}\n\n#[odra::module]\nimpl TicketOperator {\n pub fn register(&mut self, ticket_office_address: Address) {\n self.ticket_office_address.set(ticket_office_address);\n }\n\n // now the operator's `buy_ticket` receives funds.\n #[odra(payable)]\n pub fn buy_ticket(&mut self, ticket_id: TicketId) {\n let env = self.env();\n let buyer = env.caller();\n let value = env.attached_value();\n let center = self\n .ticket_office_address\n .get()\n .unwrap_or_revert_with(&env, Error::UnknownTicketOffice);\n let mut ticket_contract = TicketOfficeContractRef::new(env, center);\n // now and approved entity - the operator - buys the ticket on behalf of the buyer\n ticket_contract.buy_ticket(ticket_id, buyer, value);\n }\n\n pub fn balance_of(&self) -> U512 {\n self.env().self_balance()\n }\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L4-L7")," - Define errors that will be used in the contract."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L9-L13")," - Define the ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOperator")," module that stores the address of the ticketing office."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L16-L18")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"register")," function sets the address of the ticketing office."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L20-L32")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOfficeContractRef")," to interact we the ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOffice")," contract. Note that, the operator's ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," now receives funds.")),(0,a.kt)("p",null,"Now we need to adjust the ",(0,a.kt)("inlineCode",{parentName:"p"},"TicketOffice")," contract to use the ",(0,a.kt)("inlineCode",{parentName:"p"},"TicketOperator")," contract to buy tickets."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"use odra::Var;\n\n... \n\n#[odra::odra_error]\npub enum Error {\n ...\n MissingOperator = 204,\n Unauthorized = 205,\n}\n\n#[odra::module]\npub struct TicketOffice {\n ...\n operator: Var
,\n}\n\n#[odra::module]\nimpl TicketOffice {\n ... \n\n pub fn register_operator(&mut self, operator: Address) {\n // only the owner can register an operator\n let caller = self.env().caller();\n self.ownable.assert_owner(&caller);\n // store the ticketing center address in the operator contract\n TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address());\n self.operator.set(operator);\n }\n\n pub fn issue_ticket(&mut self, event_name: String, price: U512) {\n // minting logic remains the same...\n ...\n\n // approve the operator to transfer the ticket\n let operator = self.operator();\n self.token\n .approve(operator, Maybe::Some(ticket_id), Maybe::None);\n\n // emit an event\n ...\n }\n\n pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) {\n let env = self.env();\n let owner = self.ownable.get_owner();\n let caller = env.caller();\n // make sure the caller is the operator\n if !self.is_operator(caller) {\n env.revert(Error::Unauthorized);\n }\n\n ...\n // the logic remains the same, except for the csprs transfer\n // it is now handled by the operator contract.\n // env.transfer_tokens(&owner, &value);\n }\n\n #[inline]\n fn is_operator(&self, caller: Address) -> bool {\n Some(caller) == self.operator.get()\n }\n\n #[inline]\n fn operator(&self) -> Address {\n self.operator\n .get()\n .unwrap_or_revert_with(&self.env(), Error::MissingOperator)\n }\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L15")," - the contract stores the operator address."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L22-L29")," - a new function ",(0,a.kt)("inlineCode",{parentName:"li"},"register_operator")," allows the owner to register an operator. Also calls the ",(0,a.kt)("inlineCode",{parentName:"li"},"register")," entry point on the operator contract."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L36-38")," - modify the ",(0,a.kt)("inlineCode",{parentName:"li"},"issue_ticket")," function: once a new token is minted, approves the operator to transfer the ticket later."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L44-L57")," - modify the ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds."),(0,a.kt)("li",{parentName:"ul"},"We also added two helper functions: ",(0,a.kt)("inlineCode",{parentName:"li"},"is_operator")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"operator")," to check if the caller is the operator and get the operator address. Two new errors were added: ",(0,a.kt)("inlineCode",{parentName:"li"},"MissingOperator")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"Unauthorized"),".")),(0,a.kt)("p",null,"Now we need to update our tests to create a scenario we presented in the sequence diagram."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/tests.rs"',showLineNumbers:!0,title:'"src/tests.rs"'},'use odra::{\n casper_types::U512,\n host::{Deployer, HostRef, NoArgs},\n OdraResult,\n};\n\nuse crate::{\n ticket_operator::TicketOperatorHostRef,\n token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs},\n};\n\n#[test]\nfn it_works() {\n let env = odra_test::env();\n let init_args = TicketOfficeInitArgs {\n collection_name: "Ticket".to_string(),\n collection_symbol: "T".to_string(),\n total_supply: 100,\n };\n let operator = TicketOperatorHostRef::deploy(&env, NoArgs);\n let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args);\n ticket_office.register_operator(operator.address().clone());\n ticket_office.issue_ticket("Ev".to_string(), U512::from(100));\n ticket_office.issue_ticket("Ev".to_string(), U512::from(50));\n\n let buyer = env.get_account(1);\n env.set_caller(buyer);\n\n assert_eq!(\n buy_ticket(&operator, 0, 50),\n Err(Error::InsufficientFunds.into())\n );\n assert_eq!(buy_ticket(&operator, 0, 100), Ok(()));\n assert_eq!(buy_ticket(&operator, 1, 50), Ok(()));\n assert_eq!(\n buy_ticket(&operator, 0, 100),\n Err(Error::TicketNotAvailableForSale.into())\n );\n\n assert_eq!(operator.balance_of(), U512::from(150));\n}\n\nfn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> {\n operator.with_tokens(U512::from(price)).try_buy_ticket(id)\n}\n\n')),(0,a.kt)("h3",{id:"conclusion"},"Conclusion"),(0,a.kt)("p",null,"In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/037547ca.36ecaa56.js b/docs/assets/js/037547ca.36ecaa56.js new file mode 100644 index 000000000..7172b79f3 --- /dev/null +++ b/docs/assets/js/037547ca.36ecaa56.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[9184],{33709:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.3.1/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.3.1/"},"next":{"title":"Installation","permalink":"/docs/0.3.1/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/03d24697.06b0b929.js b/docs/assets/js/03d24697.06b0b929.js new file mode 100644 index 000000000..320047db6 --- /dev/null +++ b/docs/assets/js/03d24697.06b0b929.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[45333],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),l=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=l(n),m=r,f=p["".concat(u,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(f,o(o({ref:t},c),{},{components:n})):a.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=p;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5},o="Pausable",i={unversionedId:"tutorials/pauseable",id:"version-0.7.0/tutorials/pauseable",title:"Pausable",description:"The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.",source:"@site/versioned_docs/version-0.7.0/tutorials/pauseable.md",sourceDirName:"tutorials",slug:"/tutorials/pauseable",permalink:"/docs/0.7.0/tutorials/pauseable",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Access Control",permalink:"/docs/0.7.0/tutorials/access-control"}},u={},l=[{value:"Code",id:"code",level:2},{value:"Events and Error",id:"events-and-error",level:3},{value:"Module definition",id:"module-definition",level:3},{value:"Checks and guards",id:"checks-and-guards",level:3},{value:"Actions",id:"actions",level:3},{value:"Pausable counter",id:"pausable-counter",level:2}],c={toc:l};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently."),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"As always, we will start with defining functionalities of our module."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Check the state - is it paused or not."),(0,r.kt)("li",{parentName:"ol"},"State guards - a contract should stop execution if is in a state we don't expect."),(0,r.kt)("li",{parentName:"ol"},"Switch the state.")),(0,r.kt)("h3",{id:"events-and-error"},"Events and Error"),(0,r.kt)("p",null,"There just two errors that may occur: ",(0,r.kt)("inlineCode",{parentName:"p"},"PausedRequired"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"UnpausedRequired"),". We define them in a standard Odra way."),(0,r.kt)("p",null,"Events definition is highly uncomplicated: ",(0,r.kt)("inlineCode",{parentName:"p"},"Paused")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused")," events holds only the address of the pauser."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{Event, types::Address};\n\nodra::execution_error! {\n pub enum Error {\n PausedRequired => 1_000,\n UnpausedRequired => 1_001,\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Paused {\n pub account: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Unpaused {\n pub account: Address\n}\n")),(0,r.kt)("h3",{id:"module-definition"},"Module definition"),(0,r.kt)("p",null,"The module storage is extremely simple - has a single ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," of type bool, that indicates if a contract is paused."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\npub struct Pausable {\n is_paused: Variable\n}\n")),(0,r.kt)("h3",{id:"checks-and-guards"},"Checks and guards"),(0,r.kt)("p",null,"Now, let's move to state checks and guards."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn is_paused(&self) -> bool {\n self.is_paused.get_or_default()\n }\n\n pub fn require_not_paused(&self) {\n if self.is_paused() {\n contract_env::revert(Error::UnpausedRequired);\n }\n }\n\n pub fn require_paused(&self) {\n if !self.is_paused() {\n contract_env::revert(Error::PausedRequired);\n }\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - as mentioned in the intro, the module is not intended to be a standalone contract, so the only ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block is not annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::module")," and hence does not expose any entrypoint."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L2")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused()")," checks the contract state, if the Variable ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused")," has not been initialized, the default value (false) is returned."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - to guarantee the code is executed when the contract is not paused, ",(0,r.kt)("inlineCode",{parentName:"li"},"require_not_paused()")," function reads the state and reverts if the contract is paused. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"require_paused()")," is a mirror function - stops the contract execution if the contract is not paused.")),(0,r.kt)("h3",{id:"actions"},"Actions"),(0,r.kt)("p",null,"Finally, we will add the ability to switch the module state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"impl Pausable {\n pub fn pause(&mut self) {\n self.require_not_paused();\n self.is_paused.set(true);\n\n Paused {\n account: contract_env::caller()\n }\n .emit();\n }\n\n pub fn unpause(&mut self) {\n self.require_paused();\n self.is_paused.set(false);\n\n Unpaused {\n account: contract_env::caller()\n }\n .emit();\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"pause()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()")," functions do three things: ensure the contract is the right state (unpaused for ",(0,r.kt)("inlineCode",{parentName:"p"},"pause()"),", not paused for ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()"),"), updates the state, and finally emits events (",(0,r.kt)("inlineCode",{parentName:"p"},"Paused"),"/",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused"),")."),(0,r.kt)("h2",{id:"pausable-counter"},"Pausable counter"),(0,r.kt)("p",null,"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called ",(0,r.kt)("inlineCode",{parentName:"p"},"PausableCounter"),". The contract consists of a Variable ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module. The counter can only be incremented if the contract is in a normal state (is not paused)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::Variable;\nuse odra_modules::security::Pausable;\n\n#[odra::module]\npub struct PausableCounter {\n value: Variable,\n pauseable: Pausable\n}\n\n#[odra::module]\nimpl PausableCounter {\n pub fn increment(&mut self) {\n self.pauseable.require_not_paused();\n\n let new_value = self.value.get_or_default() + 1;\n self.value.set(new_value);\n }\n\n pub fn pause(&mut self) {\n self.pauseable.pause();\n }\n\n pub fn unpause(&mut self) {\n self.pauseable.unpause();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::PausableCounterDeployer;\n use odra_modules::security::errors::Error;\n\n #[test]\n fn increment_only_if_unpaused() {\n let mut contract = PausableCounterDeployer::default();\n assert_eq!(contract.get_value(), 0);\n\n contract.increment();\n assert_eq!(contract.get_value(), 1);\n \n contract.pause();\n odra::test_env::assert_exception(\n Error::UnpausedRequired, \n || contract.increment()\n );\n assert_eq!(contract.get_value(), 1);\n\n contract.unpause();\n contract.increment();\n assert_eq!(contract.get_value(), 2);\n\n }\n}\n")),(0,r.kt)("p",null,"As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/03ddc63e.27dad346.js b/docs/assets/js/03ddc63e.27dad346.js new file mode 100644 index 000000000..43e827887 --- /dev/null +++ b/docs/assets/js/03ddc63e.27dad346.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37077],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),i=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=i(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=i(n),m=r,h=p["".concat(c,".").concat(m)]||p[m]||d[m]||o;return n?a.createElement(h,l(l({ref:t},u),{},{components:n})):a.createElement(h,l({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var i=2;i{n.d(t,{Z:()=>l});var a=n(67294),r=n(86010);const o="tabItem_Ymn6";function l(e){let{children:t,hidden:n,className:l}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,l),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>_});var a=n(87462),r=n(67294),o=n(86010),l=n(12466),s=n(16550),c=n(91980),i=n(67392),u=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,s.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,c._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(a.location.search);t.set(o,e),a.replace({...a.location,search:t.toString()})}),[o,a])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,o=p(e),[l,s]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:o}))),[c,i]=h({queryString:n,groupId:a}),[d,f]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,o]=(0,u.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:a}),b=(()=>{const e=c??d;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{b&&s(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),i(e),f(e)}),[i,f,o]),tabValues:o}}var b=n(72389);const y="tabList__CuJ",g="tabItem_LNqP";function k(e){let{className:t,block:n,selectedValue:s,selectValue:c,tabValues:i}=e;const u=[],{blockElementScrollPositionUntilNextRender:d}=(0,l.o5)(),p=e=>{const t=e.currentTarget,n=u.indexOf(t),a=i[n].value;a!==s&&(d(t),c(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=u.indexOf(e.currentTarget)+1;t=u[n]??u[0];break}case"ArrowLeft":{const n=u.indexOf(e.currentTarget)-1;t=u[n]??u[u.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:l}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>u.push(e),onKeyDown:m,onClick:p},l,{className:(0,o.Z)("tabs__item",g,l?.className,{"tabs__item--active":s===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",y)},r.createElement(k,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function _(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},98620:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),o=n(74866),l=n(85162);const s={sidebar_position:7},c="Using Proxy Caller",i={unversionedId:"tutorials/using-proxy-caller",id:"version-0.9.1/tutorials/using-proxy-caller",title:"Using Proxy Caller",description:"In this tutorial, we will learn how to use the proxycaller wasm to call an Odra payable function. The proxycaller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.",source:"@site/versioned_docs/version-0.9.1/tutorials/using-proxy-caller.md",sourceDirName:"tutorials",slug:"/tutorials/using-proxy-caller",permalink:"/docs/0.9.1/tutorials/using-proxy-caller",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7},sidebar:"tutorialSidebar",previous:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/0.9.1/tutorials/build-deploy-read"},next:{title:"Migrations",permalink:"/docs/0.9.1/category/migrations"}},u={},d=[{value:"Contract",id:"contract",level:2},{value:"Client",id:"client",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-proxy-caller"},"Using Proxy Caller"),(0,r.kt)("p",null,"In this tutorial, we will learn how to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," wasm to call an Odra ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/casper#payable"},"payable")," function. The ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," is a session code that top-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some ",(0,r.kt)("inlineCode",{parentName:"p"},"CSPR"),"s to the call."),(0,r.kt)("p",null,"Read more about the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/casper#using-proxy_callerwasm"},"here"),"."),(0,r.kt)("h2",{id:"contract"},"Contract"),(0,r.kt)("p",null,"For this tutorial, we will use the ",(0,r.kt)("inlineCode",{parentName:"p"},"TimeLockWallet")," contract from our examples."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs showLineNumbers",title:"examples/src/contracts/tlw.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{casper_types::U512, Address, Mapping, Var};\n\n#[odra::module(errors = Error, events = [Deposit, Withdrawal])]\npub struct TimeLockWallet {\n balances: Mapping,\n lock_expiration_map: Mapping,\n lock_duration: Var\n}\n\n#[odra::module]\nimpl TimeLockWallet {\n /// Initializes the contract with the lock duration.\n pub fn init(&mut self, lock_duration: u64) {\n self.lock_duration.set(lock_duration);\n }\n\n /// Deposits the tokens into the contract.\n #[odra(payable)]\n pub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U512 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env().revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env().emit_event(Deposit {\n address: caller,\n amount\n });\n }\n\n /// Withdraws the tokens from the contract.\n pub fn withdraw(&mut self, amount: &U512) {\n // code omitted for brevity\n }\n\n /// Returns the balance of the given account.\n pub fn get_balance(&self, address: &Address) -> U512 {\n // code omitted for brevity\n }\n\n /// Returns the lock duration.\n pub fn lock_duration(&self) -> u64 {\n // code omitted for brevity\n }\n}\n\n/// Errors that may occur during the contract execution.\n#[odra::odra_error]\npub enum Error {\n LockIsNotOver = 1,\n CannotLockTwice = 2,\n InsufficientBalance = 3\n}\n\n/// Deposit event.\n#[odra::event]\npub struct Deposit {\n pub address: Address,\n pub amount: U512\n}\n\n/// Withdrawal event.\n#[odra::event]\npub struct Withdrawal {\n pub address: Address,\n pub amount: U512\n}\n")),(0,r.kt)("p",null,"Full code can be found ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/examples/src/contracts/tlw.rs"},"here"),"."),(0,r.kt)("h2",{id:"client"},"Client"),(0,r.kt)("p",null,"Before we can interact with the node, we need to set it up. We will use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-nctl-docker"},(0,r.kt)("inlineCode",{parentName:"a"},"casper-nctl-docker"))," image."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Make sure you have the contract's wasm file and the secret key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# Build the contract\ncargo odra build -c TimeLockWallet\n# Extract secret key\ndocker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem\n')),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("p",null,"To interact with the contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"livenet")," backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "odra-examples"\nversion = "1.0.0"\nedition = "2021"\n\n[dependencies]\nodra = { path = "../odra", default-features = false }\n... # other dependencies\nodra-casper-livenet-env = { version = "1.0.0", optional = true }\n\n... # other sections\n\n[features]\ndefault = []\nlivenet = ["odra-casper-livenet-env"]\n\n... # other sections\n\n[[bin]]\nname = "tlw_on_livenet"\npath = "bin/tlw_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n\n... # other sections\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/bin/tlw_on_livenet.rs showLineNumbers",title:"examples/bin/tlw_on_livenet.rs",showLineNumbers:!0},'//! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs.\nuse odra::casper_types::{AsymmetricType, PublicKey, U512};\nuse odra::host::{Deployer, HostRef};\nuse odra::Address;\nuse odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs};\n\nconst DEPOSIT: u64 = 100;\nconst WITHDRAWAL: u64 = 99;\nconst GAS: u64 = 20u64.pow(9);\n\nfn main() {\n let env = odra_casper_livenet_env::env();\n let caller = env.get_account(0);\n\n env.set_caller(caller);\n env.set_gas(GAS);\n\n let mut contract = TimeLockWalletHostRef::deploy(\n &env, \n TimeLockWalletInitArgs { lock_duration: 60 * 60 }\n );\n // Send 100 CSPRs to the contract.\n contract\n .with_tokens(U512::from(DEPOSIT))\n .deposit();\n \n println!("Caller\'s balance: {:?}", contract.get_balance(&caller));\n // Withdraw 99 CSPRs from the contract.\n contract.withdraw(&U512::from(WITHDRAWAL));\n println!("Remaining balance: {:?}", contract.get_balance(&caller));\n}\n')),(0,r.kt)("p",null,"To run the code, execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \\\nODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \\\nODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \\ \ncargo run --bin tlw_on_livenet --features=livenet\n# Sample output\n\ud83d\udc81 INFO : Deploying "TimeLockWallet".\n\ud83d\udc81 INFO : Found wasm under "wasm/TimeLockWallet.wasm".\n\ud83d\ude44 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558".\n\ud83d\udc81 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed.\n\ud83d\udc81 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed.\n\ud83d\udc81 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy.\n\ud83d\ude44 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3".\n\ud83d\udc81 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed.\nCaller\'s balance: 100\n\ud83d\udc81 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw".\n\ud83d\ude44 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e".\n\ud83d\udc81 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed.\nRemaining balance: 1\n')),(0,r.kt)("p",null,"As observed, the contract was successfully deployed, and the ",(0,r.kt)("inlineCode",{parentName:"p"},"Caller")," deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR.\nThe logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity.")),(0,r.kt)(l.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("p",null,"Since TypeScript code often requires considerable boilerplate, we offer a streamlined version of the code. We demonstrate how to deploy the contract and prepare a deploy that utilizes the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," to invoke a payable function with attached ",(0,r.kt)("inlineCode",{parentName:"p"},"CSPR")," tokens. The ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/tutorials/build-deploy-read"},"previous tutorial")," details how to read the state, which is not the focus of our current discussion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'import {\n CLByteArray,\n CLList,\n CLU8,\n CLValueBuilder,\n CasperClient,\n Contracts,\n Keys,\n RuntimeArgs,\n csprToMotes,\n decodeBase16,\n} from "casper-js-sdk";\nimport fs from "fs";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\nconst SECRET_KEY_PATH = "keys/secret_key.pem"\nconst PROXY_CALLER_PATH = "wasm/proxy_caller.wasm"\nconst CONTRACT_PATH = "wasm/TimeLockWallet.wasm";\nconst CHAIN_NAME = "casper-net-1";\nconst ENTRY_POINT = "deposit";\nconst DEPOSIT = 100;\nconst GAS = 110;\n// Once the contract is deployed, the contract package hash\n// can be obtained from the global state.\nconst CONTRACT_PACKAGE_HASH = "...";\n\nconst casperClient = new CasperClient(LOCAL_NODE_URL);\nconst keypair = Keys.Ed25519.loadKeyPairFromPrivateFile(\n SECRET_KEY_PATH\n);\nconst contract = new Contracts.Contract(casperClient);\n\nexport async function deploy_contract(): Promise {\n // Required odra_cfg args and the constructor args\n const args = RuntimeArgs.fromMap({\n odra_cfg_package_hash_key_name: CLValueBuilder.string("tlw"),\n odra_cfg_allow_key_override: CLValueBuilder.bool(true),\n odra_cfg_is_upgradable: CLValueBuilder.bool(true),\n lock_duration: CLValueBuilder.u64(60 * 60)\n });\n \n const wasm = new Uint8Array(fs.readFileSync(CONTRACT_PATH));\n const deploy = contract.install(\n wasm,\n args,\n csprToMotes(GAS).toString(),\n keypair.publicKey,\n CHAIN_NAME,\n [keypair],\n );\n return casperClient.putDeploy(deploy);\n}\n \nexport async function deposit(): Promise {\n // Contract package hash is a 32-byte array, \n // so take the hex string and convert it to a byte array.\n // This is done using the decodeBase16 function from \n // the casper-js-sdk.\n const contractPackageHashBytes = new CLByteArray(\n decodeBase16(CONTRACT_PACKAGE_HASH)\n );\n // Next, create RuntimeArgs for the deploy \n // and pass them as bytes to the contract.\n // Note that the args are not a byte array, but a CLList \n // of CLU8s - a different type of CLValue.\n // Finally, create a Uint8Array from the bytes and \n // then transform it into a CLList.\n const args_bytes: Uint8Array = RuntimeArgs.fromMap({})\n .toBytes()\n .unwrap();\n const serialized_args = new CLList(\n Array.from(args_bytes)\n .map(value => new CLU8(value))\n );\n\n const args = RuntimeArgs.fromMap({\n attached_value: CLValueBuilder.u512(DEPOSIT),\n amount: CLValueBuilder.u512(DEPOSIT),\n entry_point: CLValueBuilder.string(ENTRY_POINT),\n contract_package_hash: contractPackageHashBytes,\n args: serialized_args\n });\n // Use proxy_caller to send tokens to the contract.\n const wasm = new Uint8Array(fs.readFileSync(PROXY_CALLER_PATH));\n const deploy = contract.install(\n wasm,\n args,\n csprToMotes(GAS).toString(),\n keypair.publicKey,\n CHAIN_NAME,\n [keypair],\n );\n return casperClient.putDeploy(deploy);\n}\n \ndeploy_contract()\n .then((result) => { console.log(result); });\n\n// One you obatin the contract hash, you can call the deposit function:\n// deposit()\n// .then((result) => { console.log(result); });\n')),(0,r.kt)("p",null,"To run the code, execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \n# Sample output\nf40e3ca983034435d829462dd53d801df4e98013009cbf4a6654b3ee467063a1 # the deploy hash\n")))),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"In this tutorial, we learned how to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," wasm to make a payable function call. We deployed the ",(0,r.kt)("inlineCode",{parentName:"p"},"TimeLockWallet")," contract, deposited tokens using the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," with attached CSPRs, and withdrew them. You got to try it out in both ",(0,r.kt)("inlineCode",{parentName:"p"},"Rust")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"TypeScript"),", so you can choose whichever you prefer. ",(0,r.kt)("inlineCode",{parentName:"p"},"Rust")," code seemed simpler, thanks to the Odra ",(0,r.kt)("inlineCode",{parentName:"p"},"livenet")," backend making chain interactions easier to handle."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/03f3dff9.a9b8cff3.js b/docs/assets/js/03f3dff9.a9b8cff3.js new file mode 100644 index 000000000..a09e8e173 --- /dev/null +++ b/docs/assets/js/03f3dff9.a9b8cff3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73044],{70199:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.8.1/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.8.1/basics/native-token"},"next":{"title":"Delegate","permalink":"/docs/0.8.1/advanced/delegate"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/0413f781.a3a1549e.js b/docs/assets/js/0413f781.a3a1549e.js new file mode 100644 index 000000000..ab987dd31 --- /dev/null +++ b/docs/assets/js/0413f781.a3a1549e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[65666],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,h=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(h,i(i({ref:t},d),{},{components:n})):a.createElement(h,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.9.1/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.9.1/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.9.1/backends/what-is-a-backend",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.9.1/category/backends"},next:{title:"OdraVM",permalink:"/docs/0.9.1/backends/odra-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Host Env",id:"host-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/odra-vm"},"OdraVM"),",\na complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/casper"},"CasperVM"),",\nor even a real blockchain - when using ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/casper"},"Livenet backend"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"host-env"},"Host Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/04477b87.ef2fdb17.js b/docs/assets/js/04477b87.ef2fdb17.js new file mode 100644 index 000000000..7a2c9db8e --- /dev/null +++ b/docs/assets/js/04477b87.ef2fdb17.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[56056],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>g});var n=a(67294);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 l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(a),g=r,m=d["".concat(s,".").concat(g)]||d[g]||u[g]||o;return a?n.createElement(m,l(l({ref:t},p),{},{components:a})):n.createElement(m,l({ref:t},p))}));function g(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.3.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.3.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.3.0/getting-started/installation",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Getting started",permalink:"/docs/0.3.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.3.0/getting-started/flipper"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-uknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my-project\n")),(0,r.kt)("p",null,'This will create a new folder called "my-project" and initialize Odra there. Cargo Odra\nwill create a sample contract for you in src directory. You can run the tests of this contract\nby executing:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal MockVM. You can run those tests against a real backend, to do so\nwe need to add a new backend. Let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra backend add -p casper\n")),(0,r.kt)("p",null,"Now we can run the tests against it:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/04d6639f.fd92504b.js b/docs/assets/js/04d6639f.fd92504b.js new file mode 100644 index 000000000..0084a03b7 --- /dev/null +++ b/docs/assets/js/04d6639f.fd92504b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41258],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:11,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-1.0.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-1.0.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/basics/cross-calls",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Casper Contract Schema",permalink:"/docs/basics/casper-contract-schema"},next:{title:"Modules",permalink:"/docs/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Loading the contract",id:"loading-the-contract",level:3},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::prelude::*;\nuse odra::{Address, UnwrapOrRevert, Var};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Var
\n}\n\n#[odra::module]\nimpl CrossContract {\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());\n MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine;\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To perform a cross-contact call, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"HostRef")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/testing"},"Testing")," article - a host side reference to already deployed contract."),(0,r.kt)("p",null,"In the module context we use a ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractRef")," instead, to call other contracts."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," is generated automatically,\nby the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("p",null,"To obtain an instance of a contract reference, we simply call the constructor - ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env: Rc, address: Address)"),", as shown above."),(0,r.kt)("p",null,"The reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), and the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::address()")," function, which returns the address of the contract."),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderContractRef")," struct (and ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderHostRef")," to be used in tests, but do not implement the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer")," trait). Having an address, in the module context we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"AdderContractRef::new(self.env(), address).add(3, 5)\n")),(0,r.kt)("h3",{id:"loading-the-contract"},"Loading the contract"),(0,r.kt)("p",null,"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test\nour contracts in ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/livenet"},"Livenet")," backend. We can load the contract using ",(0,r.kt)("inlineCode",{parentName:"p"},"load")," method on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/bin/erc20_on_livenet.rs"',title:'"examples/bin/erc20_on_livenet.rs"'},'fn _load(env: &HostEnv) -> Erc20HostRef {\n let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n let address = Address::from_str(address).unwrap();\n ::load(env, address)\n}\n')),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};\n use odra::host::{Deployer, HostRef, NoArgs};\n\n #[test]\n fn test_cross_calls() {\n let test_env = odra_test::env();\n let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);\n let cross_contract = CrossContractHostRef::deploy(\n &test_env,\n CrossContractInitArgs {\n math_engine_address: *math_engine_contract.address()\n }\n );\n assert_eq!(cross_contract.add_using_another(), 8);\n }\n}\n")),(0,r.kt)("p",null,"Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that we intend to utilize."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{Address, host::{Deployer, HostRef, NoArgs}};\n \n #[test]\n fn test_ext() {\n let test_env = odra_test::env();\n let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address(test_env: &HostEnv) -> Address {\n let contract = MathEngineHostRef::deploy(test_env, NoArgs);\n *contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/06a0fa51.a0324118.js b/docs/assets/js/06a0fa51.a0324118.js new file mode 100644 index 000000000..5a3d042bd --- /dev/null +++ b/docs/assets/js/06a0fa51.a0324118.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[20348],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/docs/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/next/backends/casper",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"OdraVM",permalink:"/docs/next/backends/odra-vm"},next:{title:"Livenet",permalink:"/docs/next/backends/livenet"}},l={},p=[{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Deploying a contract to Casper network",id:"deploying-a-contract-to-casper-network",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement traits defined by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard"),", thankfully you can derive them using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::event]"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance,\nyou call ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_balance()"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"deploying-a-contract-to-casper-network"},"Deploying a contract to Casper network"),(0,r.kt)("p",null,"There would be no point in writing a contract if you couldn't deploy it to the blockchain.\nYou can do it in two ways: provided by the Casper itself: using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool\nor using the Odra's Livenet integration."),(0,r.kt)("p",null,"Let's explore the first option to better understand the process."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you wish, you can skip the following section and jump to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/livenet"},"Livenet integration"),".")),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you can pass some arguments to it.\nEvery contract written in Odra expects those arguments to be set:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Additionally, if required by the contract, you can pass constructor arguments."),(0,r.kt)("p",null,"When working with the test env via ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," or when using\n",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/livenet"},"Livenet integration")," this is handled automatically. However, if you rather use\n",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," directly, you have to pass them manually:"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.1.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.1.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.1.0/odra-casper/test-vm/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK. See an example in the ",(0,r.kt)("a",{parentName:"p",href:"../tutorials/using-proxy-caller"},"Tutorial section"),"."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/odra-vm"},"OdraVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/06d8044c.87feadbf.js b/docs/assets/js/06d8044c.87feadbf.js new file mode 100644 index 000000000..21f7ba0ce --- /dev/null +++ b/docs/assets/js/06d8044c.87feadbf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73807],{36924:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.8.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.8.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.8.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/07fff18d.20c4e66f.js b/docs/assets/js/07fff18d.20c4e66f.js new file mode 100644 index 000000000..3f3404c15 --- /dev/null +++ b/docs/assets/js/07fff18d.20c4e66f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11577],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=l(t),u=r,h=p["".concat(c,".").concat(u)]||p[u]||m[u]||i;return t?a.createElement(h,o(o({ref:n},d),{},{components:t})):a.createElement(h,o({ref:n},d))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=p;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:10,description:"Casper Contract Schema"},o="Casper Contract Schema",s={unversionedId:"basics/casper-contract-schema",id:"version-1.0.0/basics/casper-contract-schema",title:"Casper Contract Schema",description:"Casper Contract Schema",source:"@site/versioned_docs/version-1.0.0/basics/13-casper-contract-schema.md",sourceDirName:"basics",slug:"/basics/casper-contract-schema",permalink:"/docs/basics/casper-contract-schema",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Casper Contract Schema"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/basics/events"},next:{title:"Cross calls",permalink:"/docs/basics/cross-calls"}},c={},l=[{value:"Odra and CCS",id:"odra-and-ccs",level:2},{value:"Generating the Schema",id:"generating-the-schema",level:2},{value:"Schema Output",id:"schema-output",level:2},{value:"Schema Fields",id:"schema-fields",level:2}],d={toc:l};function m(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper-contract-schema"},"Casper Contract Schema"),(0,r.kt)("p",null," Working in collaboration with the Casper Association we designed the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema")," (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability."),(0,r.kt)("h2",{id:"odra-and-ccs"},"Odra and CCS"),(0,r.kt)("p",null,"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: ",(0,r.kt)("inlineCode",{parentName:"p"},"module"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"event"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_type"),". The schema will be generated for you and available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/contract.rs"',showLineNumbers:!0,title:'"src/contract.rs"'},'use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(\n // the name of the contract, default is the module name\n name = "MyContract",\n // the version of the contract, default is the version of the crate\n version = "0.1.0", \n // events that the contract can emit, collected recursively if submodules are used\n events = [ \n Created,\n Updated\n ],\n // the error enum the contract can revert with, collected recursively if submodules are used\n errors = MyErrors \n)]\npub struct MyContract {\n name: Var,\n owner: Var
,\n}\n\n#[odra::module]\nimpl MyContract {\n /// Initializes the contract, sets the name and owner and emits an event\n pub fn init(&mut self, name: String, owner: Address) {\n self.name.set(name.clone());\n self.owner.set(owner.clone());\n self.env().emit_event(Created { name });\n }\n\n /// Updates the name of the contract and emits an event\n pub fn update(&mut self, name: String) {\n self.name.set(name.clone());\n self.env().emit_event(Updated { name });\n }\n\n /// Returns the data of the contract\n pub fn get_data(&self) -> Data {\n Data {\n name: self.name.get_or_default(),\n owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),\n }\n }\n}\n\n// The struct will we visible in the schema in the types section\n#[odra::odra_type]\npub struct Data {\n name: String,\n owner: Address,\n}\n\n// The enum variants will we visible in the schema in the errors section\n#[odra::odra_error]\npub enum MyErrors {\n /// The owner is invalid\n InvalidOwner,\n /// The name is invalid\n InvalidName,\n}\n\n// The struct will we visible in the schema in the types and events section\n#[odra::event]\npub struct Updated {\n name: String,\n}\n\n// The struct will we visible in the schema in the types section and events section\n#[odra::event]\npub struct Created {\n name: String,\n}\n')),(0,r.kt)("h2",{id:"generating-the-schema"},"Generating the Schema"),(0,r.kt)("p",null,"To generate the schema run the following ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo-odra")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema # or pass -c flag to generate the schema for a specific contract\n")),(0,r.kt)("h2",{id:"schema-output"},"Schema Output"),(0,r.kt)("p",null,"The generated schema will be available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'showLineNumbers title="resources/my_contract_schema.json"',showLineNumbers:!0,title:'"resources/my_contract_schema.json"'},'{\n "casper_contract_schema_version": 1,\n "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",\n "authors": [],\n "repository": null,\n "homepage": null,\n "contract_name": "MyContract",\n "contract_version": "0.1.0",\n "types": [\n {\n "struct": {\n "name": "Created",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Data",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Updated",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n }\n ],\n "errors": [\n {\n "name": "InvalidName",\n "description": "The name is invalid",\n "discriminant": 1\n },\n {\n "name": "InvalidOwner",\n "description": "The owner is invalid",\n "discriminant": 0\n }\n ],\n "entry_points": [\n {\n "name": "update",\n "description": "Updates the name of the contract and emits an event",\n "is_mutable": true,\n "arguments": [\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n }\n ],\n "return_ty": "Unit",\n "is_contract_context": true,\n "access": "public"\n },\n {\n "name": "get_data",\n "description": "Returns the data of the contract",\n "is_mutable": false,\n "arguments": [],\n "return_ty": "Data",\n "is_contract_context": true,\n "access": "public"\n }\n ],\n "events": [\n {\n "name": "Created",\n "ty": "Created"\n },\n {\n "name": "Updated",\n "ty": "Updated"\n }\n ],\n "call": {\n "wasm_file_name": "MyContract.wasm",\n "description": "Initializes the contract, sets the name and owner and emits an event",\n "arguments": [\n {\n "name": "odra_cfg_package_hash_key_name",\n "description": "The arg name for the package hash key name.",\n "ty": "String",\n "optional": false\n },\n {\n "name": "odra_cfg_allow_key_override",\n "description": "The arg name for the allow key override.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "odra_cfg_is_upgradable",\n "description": "The arg name for the contract upgradeability setting.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key",\n "optional": false\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"schema-fields"},"Schema Fields"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"casper_contract_schema_version")," is the version of the schema.\n",(0,r.kt)("inlineCode",{parentName:"li"},"toolchain")," is the version of the Rust compiler used to compile the contract."),(0,r.kt)("li",{parentName:"ul"},"Fields ",(0,r.kt)("inlineCode",{parentName:"li"},"authors"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"repository"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"homepage")," are optional and can be set in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_name")," is the name of the contract - by default is the module name, may be overriden by the module attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_version")," denotes the version of the contract, defaulting to the version specified in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file, but can be overridden by the ",(0,r.kt)("inlineCode",{parentName:"li"},"module")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"types")," comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), and a list of members."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"errors")," is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_points")," is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"events")," is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in ",(0,r.kt)("inlineCode",{parentName:"li"},"types"),") of the event."),(0,r.kt)("li",{parentName:"ul"},"The ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," section provides details regarding the contract's ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/09109da1.8b20ba8d.js b/docs/assets/js/09109da1.8b20ba8d.js new file mode 100644 index 000000000..f4963a753 --- /dev/null +++ b/docs/assets/js/09109da1.8b20ba8d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[68492],{3905:(e,r,n)=>{n.d(r,{Zo:()=>u,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},u=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},p={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return n?t.createElement(f,s(s({ref:r},u),{},{components:n})):t.createElement(f,s({ref:r},u))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.7.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.7.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.7.0/basics/errors",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.7.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.7.0/basics/events"}},l={},c=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function p(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},u,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::{execution_error, Variable, UnwrapOrRevert};\nuse odra::types::Address;\n\n#[odra::module]\npub struct OwnedContract {\n name: Variable,\n owner: Variable
,\n}\n\nexecution_error! {\n pub enum Error {\n OwnerNotSet => 1,\n NotAnOwner => 2,\n }\n}\n\n\n#[odra::module]\nimpl OwnedContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = odra::contract_env::caller();\n if caller != self.owner() {\n odra::contract_env::revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,a.kt)("p",null,"Firstly, we are using ",(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You and the users of your contract will be thankful for a meaningful error message!"),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"odra::contract_env::revert(Error::NotAnOwner)\n")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? We've already mentioned a function - ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_exception"),". This is how you will\nuse it:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'use super::{OwnedContractDeployer, OwnedContractRef};\nuse super::Error;\n\n#[test]\nfn test_owner_error() {\n let owner = odra::test_env::get_account(0);\n let not_an_owner = odra::test_env::get_account(1);\n\n odra::test_env::set_caller(owner);\n let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());\n\n odra::test_env::set_caller(not_an_owner);\n odra::test_env::assert_exception(Error::NotAnOwner, || {\n owned_contract.change_name("NewName".to_string());\n })\n}\n')),(0,a.kt)("p",null,"In the example above, because we are calling the ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),' method as an address which is not an "owner",\nwe are expecting that "NotAnOwner" error will be thrown.'),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"Here we are creating another reference to the already deployed contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractRef::at()")," and passing to it\nits Address. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractDeployer::init()")," returns the same type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0993954b.41f9d80a.js b/docs/assets/js/0993954b.41f9d80a.js new file mode 100644 index 000000000..a218390ad --- /dev/null +++ b/docs/assets/js/0993954b.41f9d80a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67646],{83769:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-docs","id":"default"}')}}]); \ No newline at end of file diff --git a/docs/assets/js/0a44181e.f9264a07.js b/docs/assets/js/0a44181e.f9264a07.js new file mode 100644 index 000000000..c3c966a2c --- /dev/null +++ b/docs/assets/js/0a44181e.f9264a07.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[27731],{55448:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/next/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/next/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/next/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/0a8f7599.8e63a745.js b/docs/assets/js/0a8f7599.8e63a745.js new file mode 100644 index 000000000..a090c73a8 --- /dev/null +++ b/docs/assets/js/0a8f7599.8e63a745.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[54589],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.4.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.4.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.4.0/basics/native-token",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.4.0/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.4.0/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"native-token"},"Native token"),(0,r.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::contract_env;\n\n#[odra::module]\npub struct PublicWallet {\n}\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {\n }\n\n pub fn withdraw(&mut self, amount: Balance) {\n contract_env::transfer_tokens(contract_env::caller(), amount);\n }\n}\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,r.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/tlw.rs")," in the odra main repository.")),(0,r.kt)("p",null,"You can see a new macro used here: ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from contract_env - ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_tokens"),".\nIt does exactly what you are expecting it to do - it will transfer native tokens from the contract to the\nspecified address."),(0,r.kt)("p",null,"We are also using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Balance")," - an Odra type that wraps around the type that the underlying blockchain uses\nfor counting tokens."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,r.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a function -\n",(0,r.kt)("inlineCode",{parentName:"p"},"token_balance"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::test_env;\nuse super::PublicWalletDeployer;\n\n#[test]\nfn test_modules() {\n let mut my_contract = PublicWalletDeployer::default();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());\n\n my_contract.with_tokens(Balance::from(100)).deposit();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));\n\n my_contract.withdraw(Balance::from(25));\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0abf45c2.dcd1e6ff.js b/docs/assets/js/0abf45c2.dcd1e6ff.js new file mode 100644 index 000000000..26e962af4 --- /dev/null +++ b/docs/assets/js/0abf45c2.dcd1e6ff.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37625],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/docs/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/next/basics/cargo-odra",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/next/category/basics"},next:{title:"Directory structure",permalink:"/docs/next/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Generating contract schema",id:"generating-contract-schema",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them with various configurations."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This creates a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"The third available template is ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace"),", which creates a workspace with two projects, similar to the one created\nwith the ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template."),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 1.1.0 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it creates a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This creates a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"The most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It runs your tests against Odra's ",(0,r.kt)("inlineCode",{parentName:"p"},"MockVM"),". It is substantially faster than ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM"),"\nand implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra builds the project, generates the wasm files,\nspin up ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM")," instance, deploys the contracts onto it and runs the tests against it. Pretty neat."),(0,r.kt)("p",null,"Keep in mind that this is a lot slower than ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," and you cannot use the debugger.\nThis is why ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build\n")),(0,r.kt)("p",null,"If the build process finishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder.\nNotice, that this command does not require the ",(0,r.kt)("inlineCode",{parentName:"p"},"-b")," option."),(0,r.kt)("p",null,"If you want to build specific contract, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -c counter # you pass many comma separated contracts\n")),(0,r.kt)("h2",{id:"generating-contract-schema"},"Generating contract schema"),(0,r.kt)("p",null,"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"schema")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema \n")),(0,r.kt)("p",null,"This generates a schema file in JSON format for all your contracts and places them in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder.\nIf the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder does not exist, it creates the folder for you."),(0,r.kt)("p",null,"Like with the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," command, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option to generate a schema for a specific contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0b779dad.d62c6414.js b/docs/assets/js/0b779dad.d62c6414.js new file mode 100644 index 000000000..3f7acd17a --- /dev/null +++ b/docs/assets/js/0b779dad.d62c6414.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53538],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.8.1/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.8.1/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.8.1/basics/directory-structure",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.8.1/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.8.1/basics/odra-toml"}},s={},d=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:"src/",id:"src",level:2},{value:"bin/",id:"bin",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],c={toc:d};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 bin/\n| |\u2500\u2500 build_contract.rs\n| \u2514\u2500\u2500 build_schema.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.1"\n\n[dev-dependencies]\nodra-test = "0.8.1"\n\n[[bin]]\nname = "sample_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "sample_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. For testing purposes, ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-test")," is also\nadded as a dev dependency."),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"bin"},"bin/"),(0,a.kt)("p",null,"This is the folder where scripts that will be used to generate code or schemas live.\nYou don't need to modify those files, they are generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command and\nare used by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra schema")," commands."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0be49901.749ace4a.js b/docs/assets/js/0be49901.749ace4a.js new file mode 100644 index 000000000..0ac09cdff --- /dev/null +++ b/docs/assets/js/0be49901.749ace4a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[61109],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,m=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.4.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.4.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.4.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.4.0/category/backends"},next:{title:"MockVM",permalink:"/docs/0.4.0/backends/mock-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Test Env",id:"test-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/backends/mock-vm"},"MockVM"),",\nor a complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/backends/casper"},"CasperVM"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0bf9d8ab.1f694098.js b/docs/assets/js/0bf9d8ab.1f694098.js new file mode 100644 index 000000000..324adda38 --- /dev/null +++ b/docs/assets/js/0bf9d8ab.1f694098.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52325],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,v=p["".concat(s,".").concat(m)]||p[m]||c[m]||o;return n?a.createElement(v,l(l({ref:t},d),{},{components:n})):a.createElement(v,l({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>u});var a=n(87462),r=(n(67294),n(3905));const o={},l="Module reusing",i={unversionedId:"advanced/using",id:"version-0.7.0/advanced/using",title:"Module reusing",description:"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.",source:"@site/versioned_docs/version-0.7.0/advanced/01-using.md",sourceDirName:"advanced",slug:"/advanced/using",permalink:"/docs/0.7.0/advanced/using",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.7.0/category/advanced"},next:{title:"Delegate",permalink:"/docs/0.7.0/advanced/delegate"}},s={},u=[{value:"Conceptual Overview",id:"conceptual-overview",level:2},{value:"Usage",id:"usage",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"module-reusing"},"Module reusing"),(0,r.kt)("p",null,"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples."),(0,r.kt)("h2",{id:"conceptual-overview"},"Conceptual Overview"),(0,r.kt)("p",null,"By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n value: Variable, // the default namespace would be "value"\n module: Module\n}\n\n#[odra::module]\nstruct Module {\n secret: Variable // the default namespace would be "module_secret"\n}\n')),(0,r.kt)("p",null,"While this isolation often proves useful, there are scenarios where shared storage is beneficial."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null," Odra generates an array of keys, prefixing the storage key of child modules with the parent namespace, like in the example above. But what if you want to reuse the same instance of a module? Add a ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(using)]"),' attribute to a module to override the default behavior. This is information for the module "Do not prefix storage keys for the given module." so effectively, the child and the parent use the same module instance.'),(0,r.kt)("p",null,"Let's illustrate it with a simple example. The example provided below introduces some additional complexity by featuring deeper module nesting."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::Variable;\n\n#[odra::module]\npub struct SharedStorage {\n pub value: Variable\n}\n\n#[odra::module]\npub struct MyStorage {\n pub shared: SharedStorage,\n pub version: Variable\n}\n\n#[odra::module]\npub struct ComposableContract {\n pub shared: SharedStorage,\n #[odra(using = "shared")]\n pub storage: MyStorage\n}\n\n#[odra::module]\nimpl ComposableContract {\n #[odra(init)]\n pub fn init(&mut self, version: u8, value: String) {\n self.storage.version.set(version);\n self.shared.value.set(value);\n }\n\n pub fn get_value(&self) -> String {\n self.shared.value.get_or_default()\n }\n\n pub fn get_value_via_storage(&self) -> String {\n self.storage.shared.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use crate::composer::ComplexContractDeployer;\n\n #[test]\n fn t() {\n let shared_value = "shared_value".to_string();\n let extra_value: u32 = 314;\n let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);\n\n assert_eq!(token.get_value(), shared_value);\n assert_eq!(token.get_value_via_storage(), shared_value);\n assert_eq!(token.get_extra_value(), extra_value);\n }\n}\n')),(0,r.kt)("p",null,"In this example, we've introduced a new module, ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", which nests ",(0,r.kt)("inlineCode",{parentName:"p"},"MyStorage")," and includes an extra value. The ",(0,r.kt)("inlineCode",{parentName:"p"},"ComplexContract")," contains ",(0,r.kt)("inlineCode",{parentName:"p"},"SharedStorage")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels."),(0,r.kt)("p",null,"If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"On the contract level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_shared_value"),"."),(0,r.kt)("li",{parentName:"ol"},"On the ",(0,r.kt)("inlineCode",{parentName:"li"},"MyStorage")," module level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_more_storage_shared_value"),".")),(0,r.kt)("p",null,"This example showcases how you can effectively use the module reusing feature to build intricate and efficient smart contracts."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0c77f976.49d1f801.js b/docs/assets/js/0c77f976.49d1f801.js new file mode 100644 index 000000000..1479c81be --- /dev/null +++ b/docs/assets/js/0c77f976.49d1f801.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[4781],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=p;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var u=2;u{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>w});var a=n(87462),r=n(67294),s=n(86010),i=n(12466),o=n(16550),l=n(91980),u=n(67392),c=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,o.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function y(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[i,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[l,u]=h({queryString:n,groupId:a}),[d,y]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=l??d;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{b&&o(b)}),[b]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);o(e),u(e),y(e)}),[u,y,s]),tabValues:s}}var b=n(72389);const g="tabList__CuJ",f="tabItem_LNqP";function _(e){let{className:t,block:n,selectedValue:o,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),p=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==o&&(d(t),l(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:p},i,{className:(0,s.Z)("tabs__item",f,i?.className,{"tabs__item--active":o===t})}),n??t)})))}function k(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=y(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",g)},r.createElement(_,(0,a.Z)({},e,t)),r.createElement(k,(0,a.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},10330:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),i=n(85162);const o={sidebar_position:7},l="Build, Deploy and Read the State of a Contract",u={unversionedId:"tutorials/build-deploy-read",id:"tutorials/build-deploy-read",title:"Build, Deploy and Read the State of a Contract",description:"In this guide, we will show the full path from creating a contract, deploying it and reading the state.",source:"@site/docs/tutorials/build-deploy-read.md",sourceDirName:"tutorials",slug:"/tutorials/build-deploy-read",permalink:"/docs/next/tutorials/build-deploy-read",draft:!1,tags:[],version:"current",lastUpdatedAt:1716209688,formattedLastUpdatedAt:"May 20, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7},sidebar:"tutorialSidebar",previous:{title:"Ticketing System",permalink:"/docs/next/tutorials/nft"},next:{title:"Using Proxy Caller",permalink:"/docs/next/tutorials/using-proxy-caller"}},c={},d=[{value:"Contract",id:"contract",level:3},{value:"Deploying the contract",id:"deploying-the-contract",level:3},{value:"Storage Layout",id:"storage-layout",level:3},{value:"Reading the state",id:"reading-the-state",level:3}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"build-deploy-and-read-the-state-of-a-contract"},"Build, Deploy and Read the State of a Contract"),(0,r.kt)("p",null,"In this guide, we will show the full path from creating a contract, deploying it and reading the state."),(0,r.kt)("p",null,"We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript."),(0,r.kt)("p",null,"Before you start, make sure you completed the following steps:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Read the ",(0,r.kt)("a",{parentName:"li",href:"../category/getting-started"},"Getting Started")," guide"),(0,r.kt)("li",{parentName:"ul"},"Get familiar with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.casper.network/developers/dapps/setup-nctl/"},"NCTL tutorial")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/make-software/casper-nctl-docker"},"NCTL docker")," image"),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/casper-ecosystem/casper-client-rs"},"casper-client"))),(0,r.kt)("h3",{id:"contract"},"Contract"),(0,r.kt)("p",null,"Let's write a contract with complex storage layout."),(0,r.kt)("p",null,"The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"."),(0,r.kt)("p",null,"We will expose two methods:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The constructor ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," which sets the metadata and the version of the contract."),(0,r.kt)("li",{parentName:"ol"},"The method ",(0,r.kt)("inlineCode",{parentName:"li"},"set_data")," which sets the value of the numeric field and the values of the mapping.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=custom_item.rs showLineNumbers",title:"custom_item.rs",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};\n\n// A custom type with a vector of another custom type\n#[odra::odra_type]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[odra::odra_type]\npub struct Price {\n value: U256,\n}\n\n// The main contract with a version, metadata and a submodule\n#[odra::module]\npub struct CustomItem {\n version: Var,\n meta: Var,\n data: SubModule\n}\n\n#[odra::module]\nimpl CustomItem {\n pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {\n let meta = Metadata {\n name,\n description,\n prices: vec![\n Price { value: price_1 },\n Price { value: price_2 }\n ]\n };\n self.meta.set(meta);\n self.version.set(self.version.get_or_default() + 1);\n }\n\n pub fn set_data(&mut self, value: u32, name: String, name2: String) {\n self.data.value.set(value);\n self.data.inner.named_values.set(&name, 10);\n self.data.inner.named_values.set(&name2, 20);\n }\n}\n\n// A submodule with a numeric value and another submodule\n#[odra::module]\nstruct Data {\n value: Var,\n inner: SubModule,\n}\n\n// A submodule with a mapping\n#[odra::module]\nstruct InnerData {\n named_values: Mapping,\n}\n\n")),(0,r.kt)("h3",{id:"deploying-the-contract"},"Deploying the contract"),(0,r.kt)("p",null,"First, we need to setup the chain. We will use the NCTL docker image to run a local network."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Next, we need to compile the contract to a Wasm file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra build -c custom_item \n")),(0,r.kt)("p",null,"Then, we can deploy the contract using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"casper-client put-deploy \\\n --node-address http://localhost:11101 \\\n --chain-name casper-net-1 \\\n --secret-key path/to/your/secret_key.pem \\ \n --session-path [PATH_TO_WASM] \\\n --payment-amount 100000000000 \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'test_contract_package_hash'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'true'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string='My Name'\" \\\n --session-arg \"description:string='My Description'\" \\ \n --session-arg \"price_1:u256='101'\" \\\n --session-arg \"price_2:u256='202'\"\n")),(0,r.kt)("p",null,"Finally, we can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"set_data")," method to set the values of the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'casper-client put-deploy \\\n --node-address http://localhost:11101 \\ \n --chain-name casper-net-1 \\\n --secret-key ./keys/secret_key.pem \\ \n --payment-amount 2000000000 \\\n --session-hash [DEPLOYED_CONTRACT_HASH] \\\n --session-entry-point "set_data" \\\n --session-arg "value:u32:\'666\'" \\\n --session-arg "name:string=\'alice\'" \\ \n --session-arg "name2:string=\'bob\'"\n')),(0,r.kt)("h3",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"To read the state of the contract, we need to understand the storage layout."),(0,r.kt)("p",null,"The first step is to calculate the index of the keys. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Storage Layout\n\nCustomItem: prefix: 0x0..._0000_0000_0000 0\n version: u32, 0x0..._0000_0000_0001 1\n meta: Metadata, 0x0..._0000_0000_0010 2\n data: Data: prefix: 0x0..._0000_0000_0011 3\n value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1\n inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2\n named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1\n")),(0,r.kt)("p",null,"The actual key is obtained as follows:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Convert the index to a big-endian byte array."),(0,r.kt)("li",{parentName:"ol"},"Concatenate the index with the mapping data."),(0,r.kt)("li",{parentName:"ol"},"Hash the concatenated bytes using blake2b."),(0,r.kt)("li",{parentName:"ol"},"Return the hex representation of the hash (the stored key must be utf-8 encoded).")),(0,r.kt)("p",null,"In more detail, the storage layout is described in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/advanced/storage-layout"},"Storage Layout article"),"."),(0,r.kt)("h3",{id:"reading-the-state"},"Reading the state"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=main.rs showLineNumbers",title:"main.rs",showLineNumbers:!0},'use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};\nuse casper_types::{\n bytesrepr::{FromBytes, ToBytes},\n U256,\n};\n\n// replace with your contract hash\nconst CONTRACT_HASH: &str = "hash-...";\nconst NODE_ADDRESS: &str = "http://localhost:11101/rpc";\nconst RPC_ID: &str = "casper-net-1";\nconst DICTIONARY_NAME: &str = "state";\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\nasync fn read_state_key(key: String) -> Vec {\n let state_root_hash = casper_client::get_state_root_hash(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n None,\n )\n .await\n .unwrap()\n .result\n .state_root_hash\n .unwrap();\n\n // Read the value from the `state` dictionary.\n let result = casper_client::get_dictionary_item(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n state_root_hash,\n DictionaryItemIdentifier::ContractNamedKey {\n key: CONTRACT_HASH.to_string(),\n dictionary_name: DICTIONARY_NAME.to_string(),\n dictionary_item_key: key,\n },\n )\n .await\n .unwrap()\n .result\n .stored_value;\n\n // We expect the value to be a CLValue\n if let StoredValue::CLValue(cl_value) = result {\n // Ignore the first 4 bytes, which are the length of the CLType.\n cl_value.inner_bytes()[4..].to_vec()\n } else {\n vec![]\n }\n}\n\nasync fn metadata() -> Metadata {\n // The key for the metadata is 2, and it has no mapping data\n let key = key(2, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the name and store the remaining bytes\n let (name, bytes) = String::from_bytes(&bytes).unwrap();\n // Read the description and store the remaining bytes\n let (description, bytes) = String::from_bytes(&bytes).unwrap();\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();\n\n let mut prices = vec![];\n // As we know the size of the vector, we can loop over it\n for _ in 0..size {\n // Read the value and store the remaining bytes\n let (value, rem) = U256::from_bytes(&bytes).unwrap();\n bytes = rem;\n prices.push(Price { value });\n }\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n Metadata {\n name,\n description,\n prices\n }\n}\n\nasync fn value() -> u32 {\n // The key for the value is (3 << 4) + 1, and it has no mapping data\n let key = key((3 << 4) + 1, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nasync fn named_value(name: &str) -> u32 {\n // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes\n let mapping_data = name.to_bytes().unwrap();\n let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nfn main() {\n let runtime = tokio::runtime::Runtime::new().unwrap();\n dbg!(runtime.block_on(metadata()));\n dbg!(runtime.block_on(value()));\n dbg!(runtime.block_on(named_value("alice")));\n dbg!(runtime.block_on(named_value("bob")));\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfn key(idx: u32, mapping_data: &[u8]) -> String {\n let mut key = Vec::new();\n key.extend_from_slice(idx.to_be_bytes().as_ref());\n key.extend_from_slice(mapping_data);\n let hashed_key = blake2b(&key);\n\n hex::encode(&hashed_key)\n}\n\nfn blake2b(bytes: &[u8]) -> [u8; 32] {\n let mut result = [0u8; 32];\n let mut hasher = ::new(32)\n .expect("should create hasher");\n let _ = std::io::Write::write(&mut hasher, bytes);\n blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)\n .expect("should copy hash to the result array");\n result\n}\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'cargo run\n[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {\n name: "My Contract",\n description: "My Description",\n prices: [\n Price {\n value: 123,\n },\n Price {\n value: 321,\n },\n ],\n}\n[src/main.rs:117:5] runtime.block_on(value()) = 666\n[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20\n[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10\n'))),(0,r.kt)(i.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'\nimport { blake2bHex } from "blakejs";\nimport {\n CLList,\n CLListBytesParser,\n CLStringBytesParser,\n CLU256BytesParser,\n CLU32BytesParser,\n CLU8,\n CLValueBuilder,\n CasperClient,\n CasperServiceByJsonRPC,\n Contracts,\n ToBytes,\n} from "casper-js-sdk";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\n// replace with your contract hash\nconst CONTRACT_HASH = "hash-...";\nconst STATE_DICTIONARY_NAME = "state";\nconst U32_SIZE = 4;\n\nclass Price {\n value: bigint;\n\n constructor(value: bigint) {\n this.value = value;\n }\n}\n\nclass Metadata {\n name: string;\n description: string;\n prices: Price[];\n\n constructor(name: string, description: string, prices: Price[]) {\n this.name = name;\n this.description = description;\n this.prices = prices;\n }\n}\n\nexport class Contract {\n client: CasperClient;\n service: CasperServiceByJsonRPC;\n contract: Contracts.Contract;\n\n private constructor() {\n this.client = new CasperClient(LOCAL_NODE_URL);\n this.service = new CasperServiceByJsonRPC(LOCAL_NODE_URL);\n this.contract = new Contracts.Contract(this.client);\n this.contract.setContractHash(CONTRACT_HASH);\n }\n\n static async load() {\n return new Contract();\n }\n\n async read_state(key: string) {\n const response = await this.contract.queryContractDictionary(STATE_DICTIONARY_NAME, key);\n let data: CLList = CLValueBuilder.list(response.value());\n let bytes = new CLListBytesParser().toBytes(data).unwrap();\n // Ignore the first 4 bytes, which are the length of the CLType\n return bytes.slice(4);\n }\n\n async metadata() {\n // The key for the metadata is 2, and it has no mapping data\n let bytes: Uint8Array = await this.read_state(key(2));\n\n // Read the name and store the remaining bytes\n let name = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = name.remainder as Uint8Array;\n\n // Read the description and store the remaining bytes\n let description = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = description.remainder as Uint8Array;\n\n let prices: Price[] = [];\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let size = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n bytes = size.remainder as Uint8Array;\n\n // As we know the size of the vector, we can loop over it\n for (let i = 0; i < size.result.unwrap().data.toNumber(); i++) {\n let price = new CLU256BytesParser().fromBytesWithRemainder(bytes);\n bytes = price.remainder as Uint8Array;\n prices.push(new Price(price.result.unwrap().data.toBigInt()));\n }\n\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n return new Metadata(\n name.result.unwrap().data,\n description.result.unwrap().data,\n prices\n );\n }\n \n async value() {\n // The key for the value is (3 << 4) + 1, and it has no mapping data\n const bytes = await this.read_state(key((3 << 4) + 1));\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n\n async named_value(name: string) {\n // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes\n let mapping_data = new CLStringBytesParser()\n .toBytes(CLValueBuilder.string(name))\n .unwrap();\n let bytes: Uint8Array = await this.read_state(\n key((((3 << 4) + 2) << 4) + 1, mapping_data)\n );\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfunction key(idx: number, mapping_data: Uint8Array = new Uint8Array([])) {\n let key = new Uint8Array(U32_SIZE + mapping_data.length);\n new DataView(key.buffer).setUint32(0, idx, false); // false for big-endian\n key.set(mapping_data, U32_SIZE);\n\n return blake2bHex(key, undefined, 32);\n}\n\nconst contract = Contract.load();\ncontract.then(async (c) => {\n console.log(await c.value());\n console.log(await c.metadata());\n console.log(await c.named_value("alice"));\n console.log(await c.named_value("bob"));\n});\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \nMetadata {\n name: 'My Contract',\n description: 'My Description',\n prices: [ Price { value: 123n }, Price { value: 321n } ]\n}\n666n\n20n\n10n\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0cc148ac.4f84770a.js b/docs/assets/js/0cc148ac.4f84770a.js new file mode 100644 index 000000000..103f49b74 --- /dev/null +++ b/docs/assets/js/0cc148ac.4f84770a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[23697],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,f=c["".concat(s,".").concat(m)]||c[m]||p[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.8.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.8.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.8.0/tutorials/owned-token",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.8.0/tutorials/erc20"},next:{title:"Access Control",permalink:"/docs/0.8.0/tutorials/access-control"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow only the module owner to mint tokens."),(0,o.kt)("li",{parentName:"ol"},"Enable the current owner to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::prelude::*;\nuse odra::module::SubModule;\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"...\nuse odra::{Address, casper_types::U256};\n...\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.ownable.ensure_ownership(&self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L9-L10")," - A constructor is an excellent place to initialize both modules at once."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L13-L15")," - Most of the entrypoints do not need any modification, so we simply delegate them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49-L51")," - The same is done with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L57-L60")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is indeed the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0d02cb66.aeb2473a.js b/docs/assets/js/0d02cb66.aeb2473a.js new file mode 100644 index 000000000..d9aa09b13 --- /dev/null +++ b/docs/assets/js/0d02cb66.aeb2473a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37282],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.9.1/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.9.1/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.9.1/backends/casper",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"OdraVM",permalink:"/docs/0.9.1/backends/odra-vm"},next:{title:"Livenet",permalink:"/docs/0.9.1/backends/livenet"}},l={},p=[{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Deploying a contract to Casper network",id:"deploying-a-contract-to-casper-network",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement traits defined by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard"),", thankfully you can derive them using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::event]"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance,\nyou call ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_balance()"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"deploying-a-contract-to-casper-network"},"Deploying a contract to Casper network"),(0,r.kt)("p",null,"There would be no point in writing a contract if you couldn't deploy it to the blockchain.\nYou can do it in two ways: provided by the Casper itself: using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool\nor using the Odra's Livenet integration."),(0,r.kt)("p",null,"Let's explore the first option to better understand the process."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you wish, you can skip the following section and jump to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/livenet"},"Livenet integration"),".")),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you can pass some arguments to it.\nEvery contract written in Odra expects those arguments to be set:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Additionally, if required by the contract, you can pass constructor arguments."),(0,r.kt)("p",null,"When working with the test env via ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," or when using\n",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/livenet"},"Livenet integration")," this is handled automatically. However, if you rather use\n",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," directly, you have to pass them manually:"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/odra-casper/test-vm/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK. See an example in the ",(0,r.kt)("a",{parentName:"p",href:"../tutorials/using-proxy-caller"},"Tutorial section"),"."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/odra-vm"},"OdraVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/0d4fe067.f7ed9d8b.js b/docs/assets/js/0d4fe067.f7ed9d8b.js new file mode 100644 index 000000000..a43341700 --- /dev/null +++ b/docs/assets/js/0d4fe067.f7ed9d8b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[13030],{16750:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.9.1/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.9.1/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.9.1/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/0e384e19.727c42f9.js b/docs/assets/js/0e384e19.727c42f9.js new file mode 100644 index 000000000..3d1462102 --- /dev/null +++ b/docs/assets/js/0e384e19.727c42f9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59671],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",c={unversionedId:"intro",id:"intro",title:"Odra framework",description:"Odra Docs",source:"@site/docs/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/next/",draft:!1,tags:[],version:"current",lastUpdatedAt:1707130258,formattedLastUpdatedAt:"Feb 5, 2024",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/next/category/getting-started"}},s={image:r(35798).Z},p=[{value:"What's next",id:"whats-next",level:2}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,a.kt)("p",null,"Odra is a Rust-based smart contract framework for ",(0,a.kt)("a",{parentName:"p",href:"https://casper.network"},"Casper Network"),". Odra encourages rapid development and clean,\npragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. "),(0,a.kt)("p",null,"It's free and open source!"),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"See the ",(0,a.kt)("a",{parentName:"p",href:"/docs/next/getting-started/installation"},"Installation")," and our ",(0,a.kt)("a",{parentName:"p",href:"/docs/next/getting-started/flipper"},"Flipper example")," to find out how to start your new project with Odra."))}d.isMDXComponent=!0},35798:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/0ea00542.a2c2d17e.js b/docs/assets/js/0ea00542.a2c2d17e.js new file mode 100644 index 000000000..ba1a30dea --- /dev/null +++ b/docs/assets/js/0ea00542.a2c2d17e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[56388],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return n?a.createElement(h,o(o({ref:t},p),{},{components:n})):a.createElement(h,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:3},o="Casper",i={unversionedId:"backends/casper",id:"version-0.3.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.3.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.3.0/backends/casper",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"defaultSidebar",previous:{title:"MockVM",permalink:"/docs/0.3.0/backends/mock-vm"},next:{title:"Examples",permalink:"/docs/0.3.0/category/examples"}},l={},c=[{value:"Types",id:"types",level:2},{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Constructors",id:"constructors",level:2},{value:"Execution",id:"execution",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"types"},"Types"),(0,r.kt)("p",null,"A struct to be written into the storage must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait OdraType: \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("p",null,"The other exposed types are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CallArgs")," - wraps around casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"RuntimeArgs")),";"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," - U512 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"BlockTime")," - u64 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Address")," - an enum that encapsulates casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/account/struct.AccountHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"AccountHash"))," and ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/struct.ContractPackageHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractPackageHash")))),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ","[Casper Event Standard]"," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"SerializableEvent")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait SerializableEvent: \n odra_types::event::OdraEvent + \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance, you call ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_balance"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("p",null,"Let's define a basic Odra module that includes a constructor:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\nstruct Counter {\n value: Variable\n}\n\n#[odra::module]\nimpl Counter {\n #[odra(init)]\n pub initialize(&mut self, value: u32) {\n self.value.set(value);\n }\n}\n")),(0,r.kt)("p",null,"Read more about constructors ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/advanced/attributes#init"},"here"),"."),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"constructor")," argument with a value of ",(0,r.kt)("inlineCode",{parentName:"p"},"initialize")," - this represents the name of the constructor function. Additionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "constructor:string:\'initialize\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/backends/mock-vm"},"MockVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1030000d.32178e3d.js b/docs/assets/js/1030000d.32178e3d.js new file mode 100644 index 000000000..d54a80b61 --- /dev/null +++ b/docs/assets/js/1030000d.32178e3d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[72042],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||s;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.3.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.3.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.3.0/basics/storage-interaction",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"defaultSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.3.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.3.0/basics/communicating-with-host"}},l={},p=[{value:"Variable",id:"variable",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"variable"},"Variable"),(0,r.kt)("p",null,"The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Variable,\n weight: Variable,\n name: Variable,\n pets: Variable>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"use odra::Variable;\n\n#[odra::module]\nimpl DogContract {\n #[odra(init)]\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A Variable is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses Mapping to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"use odra::{Mapping, Variable};\n\n#[odra::module]\npub struct DogContract2 {\n name: Variable,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a Mapping we use a similar approach\nto the one shown in the Variables section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Variable working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{Variable, List};\n\npub struct List {\n values: Mapping,\n index: Variable\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Variable,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/docs/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/11071.136fff66.js b/docs/assets/js/11071.136fff66.js new file mode 100644 index 000000000..9e044a787 --- /dev/null +++ b/docs/assets/js/11071.136fff66.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11071],{11071:(t,e,n)=>{n.r(e),n.d(e,{diagram:()=>A});var i=n(74737),s=n(59373),r=n(91619),a=n(12281),o=n(7201),c=(n(30381),n(17967),n(27856),n(70277),n(45625),n(39354),n(91518),function(){var t=function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},e=[1,2],n=[1,5],i=[6,9,11,17,18,20,22,23,26,27,28],s=[1,15],r=[1,16],a=[1,17],o=[1,18],c=[1,19],l=[1,23],h=[1,24],d=[1,27],u=[4,6,9,11,17,18,20,22,23,26,27,28],p={trace:function(){},yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,period_statement:24,event_statement:25,period:26,event:27,open_directive:28,type_directive:29,arg_directive:30,close_directive:31,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",26:"period",27:"event",28:"open_directive",29:"type_directive",30:"arg_directive",31:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[24,1],[25,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,i,s,r,a){var o=r.length-1;switch(s){case 1:return r[o-1];case 3:case 7:case 8:this.$=[];break;case 4:r[o-1].push(r[o]),this.$=r[o-1];break;case 5:case 6:this.$=r[o];break;case 11:i.getCommonDb().setDiagramTitle(r[o].substr(6)),this.$=r[o].substr(6);break;case 12:this.$=r[o].trim(),i.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=r[o].trim(),i.getCommonDb().setAccDescription(this.$);break;case 15:i.addSection(r[o].substr(8)),this.$=r[o].substr(8);break;case 19:i.addTask(r[o],0,""),this.$=r[o];break;case 20:i.addEvent(r[o].substr(2)),this.$=r[o];break;case 21:i.parseDirective("%%{","open_directive");break;case 22:i.parseDirective(r[o],"type_directive");break;case 23:r[o]=r[o].trim().replace(/'/g,'"'),i.parseDirective(r[o],"arg_directive");break;case 24:i.parseDirective("}%%","close_directive","timeline")}},table:[{3:1,4:e,7:3,12:4,28:n},{1:[3]},t(i,[2,3],{5:6}),{3:7,4:e,7:3,12:4,28:n},{13:8,29:[1,9]},{29:[2,21]},{6:[1,10],7:22,8:11,9:[1,12],10:13,11:[1,14],12:4,17:s,18:r,20:a,22:o,23:c,24:20,25:21,26:l,27:h,28:n},{1:[2,2]},{14:25,15:[1,26],31:d},t([15,31],[2,22]),t(i,[2,8],{1:[2,1]}),t(i,[2,4]),{7:22,10:28,12:4,17:s,18:r,20:a,22:o,23:c,24:20,25:21,26:l,27:h,28:n},t(i,[2,6]),t(i,[2,7]),t(i,[2,11]),{19:[1,29]},{21:[1,30]},t(i,[2,14]),t(i,[2,15]),t(i,[2,16]),t(i,[2,17]),t(i,[2,18]),t(i,[2,19]),t(i,[2,20]),{11:[1,31]},{16:32,30:[1,33]},{11:[2,24]},t(i,[2,5]),t(i,[2,12]),t(i,[2,13]),t(u,[2,9]),{14:34,31:d},{31:[2,23]},{11:[1,35]},t(u,[2,10])],defaultActions:{5:[2,21],7:[2,2],27:[2,24],33:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],i=[],s=[null],r=[],a=this.table,o="",c=0,l=0,h=2,d=1,u=r.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var f=p.yylloc;r.push(f);var m=p.options&&p.options.ranges;function _(){var t;return"number"!=typeof(t=i.pop()||p.lex()||d)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,x,v,w,S,$,E,I={};;){if(k=n[n.length-1],this.defaultActions[k]?x=this.defaultActions[k]:(null==b&&(b=_()),x=a[k]&&a[k][b]),void 0===x||!x.length||!x[0]){var T="";for(w in E=[],a[k])this.terminals_[w]&&w>h&&E.push("'"+this.terminals_[w]+"'");T=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(c+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(T,{text:p.match,token:this.terminals_[b]||b,line:p.yylineno,loc:f,expected:E})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(x[0]){case 1:n.push(b),s.push(p.yytext),r.push(p.yylloc),n.push(x[1]),b=null,l=p.yyleng,o=p.yytext,c=p.yylineno,f=p.yylloc;break;case 2:if(S=this.productions_[x[1]][1],I.$=s[s.length-S],I._$={first_line:r[r.length-(S||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(S||1)].first_column,last_column:r[r.length-1].last_column},m&&(I._$.range=[r[r.length-(S||1)].range[0],r[r.length-1].range[1]]),void 0!==(v=this.performAction.apply(I,[o,l,c,y.yy,x[1],s,r].concat(u))))return v;S&&(n=n.slice(0,-1*S*2),s=s.slice(0,-1*S),r=r.slice(0,-1*S)),n.push(this.productions_[x[1]][0]),s.push(I.$),r.push(I._$),$=a[n[n.length-2]][n[n.length-1]],n.push($);break;case 3:return!0}}return!0}},y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,i,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;re[0].length)){if(e=n,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,i){switch(n){case 0:return this.begin("open_directive"),28;case 1:return this.begin("type_directive"),29;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),31;case 4:return 30;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:return 23;case 20:return 27;case 21:return 26;case 22:return 6;case 23:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?::\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23],inclusive:!0}}};function g(){this.yy={}}return p.lexer=y,g.prototype=p,p.Parser=g,new g}());c.parser=c;const l=c;let h="",d=0;const u=[],p=[],y=[],g=()=>i.j,f=(t,e,n)=>{(0,i.k)(globalThis,t,e,n)},m=function(){u.length=0,p.length=0,h="",y.length=0,(0,i.m)()},_=function(t){h=t,u.push(t)},b=function(){return u},k=function(){let t=S();let e=0;for(;!t&&e<100;)t=S(),e++;return p.push(...y),p},x=function(t,e,n){const i={id:d++,section:h,type:h,task:t,score:e||0,events:n?[n]:[]};y.push(i)},v=function(t){y.find((t=>t.id===d-1)).events.push(t)},w=function(t){const e={section:h,type:h,description:t,task:t,classes:[]};p.push(e)},S=function(){let t=!0;for(const[e,n]of y.entries())y[e].processed,t=t&&n.processed;return t},$={clear:m,getCommonDb:g,addSection:_,getSections:b,getTasks:k,addTask:x,addTaskOrg:w,addEvent:v,parseDirective:f},E=Object.freeze(Object.defineProperty({__proto__:null,getCommonDb:g,parseDirective:f,clear:m,addSection:_,getSections:b,getTasks:k,addTask:x,addEvent:v,addTaskOrg:w,default:$},Symbol.toStringTag,{value:"Module"}));!function(){function t(t,e,n,s,r,a,o,c){i(e.append("text").attr("x",n+r/2).attr("y",s+a/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function e(t,e,n,s,r,a,o,c,l){const{taskFontSize:h,taskFontFamily:d}=c,u=t.split(//gi);for(let p=0;p)/).reverse(),r=[],a=n.attr("y"),o=parseFloat(n.attr("dy")),c=n.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",o+"em");for(let s=0;se||"
"===t)&&(r.pop(),c.text(r.join(" ").trim()),r="
"===t?[""]:[t],c=n.append("tspan").attr("x",0).attr("y",a).attr("dy","1.1em").text(t))}))}const T=function(t,e,n){t.append("path").attr("id","node-"+e.id).attr("class","node-bkg node-"+e.type).attr("d",`M0 ${e.height-5} v${10-e.height} q0,-5 5,-5 h${e.width-10} q5,0 5,5 v${e.height-5} H0 Z`),t.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",e.height).attr("x2",e.width).attr("y2",e.height)},D=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},L=function(t,e,n,i){const s=n%12-1,r=t.append("g");e.section=s,r.attr("class",(e.class?e.class+" ":"")+"timeline-node section-"+s);const a=r.append("g"),o=r.append("g"),c=o.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(I,e.width).node().getBBox(),l=i.fontSize&&i.fontSize.replace?i.fontSize.replace("px",""):i.fontSize;return e.height=c.height+1.1*l*.5+e.padding,e.height=Math.max(e.height,e.maxHeight),e.width=e.width+2*e.padding,o.attr("transform","translate("+e.width/2+", "+e.padding/2+")"),T(a,e,s),e},C=function(t,e,n){const i=t.append("g"),s=i.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(I,e.width).node().getBBox(),r=n.fontSize&&n.fontSize.replace?n.fontSize.replace("px",""):n.fontSize;return i.remove(),s.height+1.1*r*.5+e.padding},M=function(t,e,n,s,r,a,o,c,l,h,d){for(const u of e){const e={descr:u.task,section:n,number:n,width:150,padding:20,maxHeight:a};i.l.debug("taskNode",e);const c=t.append("g").attr("class","taskWrapper"),p=L(c,e,n,o).height;if(i.l.debug("taskHeight after draw",p),c.attr("transform",`translate(${s}, ${r})`),a=Math.max(a,p),u.events){const e=t.append("g").attr("class","lineWrapper");let i=a;r+=100,i+=O(t,u.events,n,s,r,o),r-=100,e.append("line").attr("x1",s+95).attr("y1",r+a).attr("x2",s+95).attr("y2",r+a+(d?a:h)+l+120).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}s+=200,d&&!(0,i.g)().timeline.disableMulticolor&&n++}r-=10},O=function(t,e,n,s,r,a){let o=0;const c=r;r+=100;for(const l of e){const e={descr:l,section:n,number:n,width:150,padding:20,maxHeight:50};i.l.debug("eventNode",e);const c=t.append("g").attr("class","eventWrapper"),h=L(c,e,n,a).height;o+=h,c.attr("transform",`translate(${s}, ${r})`),r=r+10+h}return r=c,o},A={db:E,renderer:{setConf:function(t){Object.keys(t).forEach((function(e){conf[e]=t[e]}))},draw:function(t,e,n,r){const a=(0,i.g)(),o=a.leftMargin?a.leftMargin:50;r.db.clear(),r.parser.parse(t+"\n"),i.l.debug("timeline",r.db);const c=a.securityLevel;let l;"sandbox"===c&&(l=(0,s.Ys)("#i"+e));const h=("sandbox"===c?(0,s.Ys)(l.nodes()[0].contentDocument.body):(0,s.Ys)("body")).select("#"+e);h.append("g");const d=r.db.getTasks(),u=r.db.getCommonDb().getDiagramTitle();i.l.debug("task",d),D(h);const p=r.db.getSections();i.l.debug("sections",p);let y=0,g=0,f=0,m=0,_=50+o,b=50;m=50;let k=0,x=!0;p.forEach((function(t){const e=C(h,{number:k,descr:t,section:k,width:150,padding:20,maxHeight:y},a);i.l.debug("sectionHeight before draw",e),y=Math.max(y,e+20)}));let v=0,w=0;i.l.debug("tasks.length",d.length);for(const[s,$]of d.entries()){const t={number:s,descr:$,section:$.section,width:150,padding:20,maxHeight:g},e=C(h,t,a);i.l.debug("taskHeight before draw",e),g=Math.max(g,e+20),v=Math.max(v,$.events.length);let n=0;for(let i=0;i<$.events.length;i++){const t={descr:$.events[i],section:$.section,number:$.section,width:150,padding:20,maxHeight:50};n+=C(h,t,a)}w=Math.max(w,n)}i.l.debug("maxSectionHeight before draw",y),i.l.debug("maxTaskHeight before draw",g),p&&p.length>0?p.forEach((t=>{const e={number:k,descr:t,section:k,width:150,padding:20,maxHeight:y};i.l.debug("sectionNode",e);const n=h.append("g"),s=L(n,e,k,a);i.l.debug("sectionNode output",s),n.attr("transform",`translate(${_}, 50)`),b+=y+50;const r=d.filter((e=>e.section===t));r.length>0&&M(h,r,k,_,b,g,a,v,w,y,!1),_+=200*Math.max(r.length,1),b=50,k++})):(x=!1,M(h,d,k,_,b,g,a,v,w,y,!0));const S=h.node().getBBox();i.l.debug("bounds",S),u&&h.append("text").text(u).attr("x",S.width/2-o).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),f=x?y+g+150:g+100;h.append("g").attr("class","lineWrapper").append("line").attr("x1",o).attr("y1",f).attr("x2",S.width+3*o).attr("y2",f).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),(0,i.s)(void 0,h,a.timeline.padding?a.timeline.padding:50,!!a.timeline.useMaxWidth&&a.timeline.useMaxWidth)}},parser:l,styles:t=>`\n .edge {\n stroke-width: 3;\n }\n ${(t=>{let e="";for(let n=0;n{n.d(e,{Z:()=>o});var i=n(61691),s=n(71610);const r=t=>{const{r:e,g:n,b:r}=s.Z.parse(t),a=.2126*i.Z.channel.toLinear(e)+.7152*i.Z.channel.toLinear(n)+.0722*i.Z.channel.toLinear(r);return i.Z.lang.round(a)},a=t=>r(t)>=.5,o=t=>!a(t)}}]); \ No newline at end of file diff --git a/docs/assets/js/112c15b6.945bb02c.js b/docs/assets/js/112c15b6.945bb02c.js new file mode 100644 index 000000000..98b9fbdad --- /dev/null +++ b/docs/assets/js/112c15b6.945bb02c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40922],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),d=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=d(n),f=a,m=p["".concat(c,".").concat(f)]||p[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={},l="Memory allocators",i={unversionedId:"advanced/using-different-allocator",id:"version-1.0.0/advanced/using-different-allocator",title:"Memory allocators",description:"When compiling contracts to wasm, your code needs to be no-std.",source:"@site/versioned_docs/version-1.0.0/advanced/05-using-different-allocator.md",sourceDirName:"advanced",slug:"/advanced/using-different-allocator",permalink:"/docs/advanced/using-different-allocator",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Storage Layout",permalink:"/docs/advanced/storage-layout"},next:{title:"Building contracts manually",permalink:"/docs/advanced/building-manually"}},c={},d=[{value:"Using a different allocator",id:"using-a-different-allocator",level:2}],s={toc:d};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"memory-allocators"},"Memory allocators"),(0,a.kt)("p",null,"When compiling contracts to wasm, your code needs to be ",(0,a.kt)("inlineCode",{parentName:"p"},"no-std"),".\nThis means that instead of using the standard library, the ",(0,a.kt)("inlineCode",{parentName:"p"},"core"),"\ncrate will be linked to your code. This crate does not contain\na memory allocator."),(0,a.kt)("p",null,"Happily, Odra automatically enables allocator - from our tests\nthe one developed by ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/ink_allocator/latest/ink_allocator/"},"ink!"),"\nseems to be the best."),(0,a.kt)("h2",{id:"using-a-different-allocator"},"Using a different allocator"),(0,a.kt)("p",null,"If the default allocator does not suit your needs, or you use a crate that\nalready provides an allocator, you can disable the default allocator by enabling\nthe ",(0,a.kt)("inlineCode",{parentName:"p"},"disable-allocator")," feature in the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra")," dependency in your project:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[dependencies]\nodra = { path = "../odra", features = ["disable-allocator"] }\n')),(0,a.kt)("p",null,"If you want to have a better control over the features that are enabled\nduring the building and tests, see the next article on ",(0,a.kt)("a",{parentName:"p",href:"/docs/advanced/building-manually"},"building manually"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/116347ba.db2b0ea7.js b/docs/assets/js/116347ba.db2b0ea7.js new file mode 100644 index 000000000..73d0071ea --- /dev/null +++ b/docs/assets/js/116347ba.db2b0ea7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[466],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),u=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=u(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},d),{},{components:t})):r.createElement(f,o({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var u=2;u{t.d(n,{Z:()=>o});var r=t(67294),a=t(86010);const s="tabItem_Ymn6";function o(e){let{children:n,hidden:t,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(s,o),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>_});var r=t(87462),a=t(67294),s=t(86010),o=t(12466),l=t(16550),i=t(91980),u=t(67392),d=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,u.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),s=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(s),(0,a.useCallback)((e=>{if(!s)return;const n=new URLSearchParams(r.location.search);n.set(s,e),r.replace({...r.location,search:n.toString()})}),[s,r])]}function b(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,s=c(e),[o,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:s}))),[i,u]=f({queryString:t,groupId:r}),[p,b]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,s]=(0,d.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&s.set(e)}),[t,s])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:s})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),b(e)}),[u,b,s]),tabValues:s}}var g=t(72389);const v="tabList__CuJ",h="tabItem_LNqP";function y(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:u}=e;const d=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),c=e=>{const n=e.currentTarget,t=d.indexOf(n),r=u[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;n=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;n=d[t]??d[d.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":t},n)},u.map((e=>{let{value:n,label:t,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>d.push(e),onKeyDown:m,onClick:c},o,{className:(0,s.Z)("tabs__item",h,o?.className,{"tabs__item--active":l===n})}),t??n)})))}function w(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function k(e){const n=b(e);return a.createElement("div",{className:(0,s.Z)("tabs-container",v)},a.createElement(y,(0,r.Z)({},e,n)),a.createElement(w,(0,r.Z)({},e,n)))}function _(e){const n=(0,g.Z)();return a.createElement(k,(0,r.Z)({key:String(n)},e))}},33222:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),s=t(74866),o=t(85162);const l={sidebar_position:2,description:"Migration guide to v0.9.0"},i="Migration guide to v0.9.0",u={unversionedId:"migrations/to-0.9.0",id:"version-0.9.1/migrations/to-0.9.0",title:"Migration guide to v0.9.0",description:"Migration guide to v0.9.0",source:"@site/versioned_docs/version-0.9.1/migrations/to-0.9.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.9.0",permalink:"/docs/0.9.1/migrations/to-0.9.0",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Migration guide to v0.9.0"},sidebar:"tutorialSidebar",previous:{title:"Migration guide to v0.8.0",permalink:"/docs/0.9.1/migrations/to-0.8.0"}},d={},p=[{value:"1. Prerequisites",id:"1-prerequisites",level:2},{value:"1.1. Update cargo-odra",id:"11-update-cargo-odra",level:3},{value:"1.2. Review the Changelog",id:"12-review-the-changelog",level:3},{value:"2. Migration Steps",id:"2-migration-steps",level:2},{value:"2.1 Update build_schema.rs bin",id:"21-update-build_schemars-bin",level:3},{value:"2.2 Update smart contract code",id:"22-update-smart-contract-code",level:3},{value:"2.2.1. Update custom types definitions.",id:"221-update-custom-types-definitions",level:4},{value:"2.2.2. Update errors definitions.",id:"222-update-errors-definitions",level:4},{value:"2.2.3. Update events definitions.",id:"223-update-events-definitions",level:4},{value:"3. Code Examples",id:"3-code-examples",level:2},{value:"4. Troubleshooting",id:"4-troubleshooting",level:2},{value:"5. References",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v090"},"Migration guide to v0.9.0"),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.7.1")," and below, start with the ",(0,a.kt)("a",{parentName:"p",href:"./to-0.8.0"},"previous guide"),". It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant change in ",(0,a.kt)("inlineCode",{parentName:"p"},"0.9.0")," is the way of defining custom elements namely type, events and errors."),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.9.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-update-build_schemars-bin"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Update build_schema.rs bin")),(0,a.kt)("p",null,"Odra 0.9.0 adds a new standardized way of generating contract schema - ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema"),". You can find the updated ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," file in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-smart-contract-code"},"2.2 ",(0,a.kt)("strong",{parentName:"h3"},"Update smart contract code")),(0,a.kt)("p",null,"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes."),(0,a.kt)("h4",{id:"221-update-custom-types-definitions"},"2.2.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update custom types definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraType)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")))),(0,a.kt)("h4",{id:"222-update-errors-definitions"},"2.2.2. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraError)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute.\nError enum should be passed as a parameter to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */], errors = Error)]\npub struct Erc20 {\n // fields\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */])]\npub struct Erc20 {\n // fields\n}\n\nuse odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n")))),(0,a.kt)("h4",{id:"223-update-events-definitions"},"2.2.3. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256};\n\n#[odra::event]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Event};\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.9.0."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer], errors = Error)]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address};\n\n #[odra::event]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[odra::event]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n #[odra::odra_error]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n")))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P9k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/119fbfb6.bd53aeee.js b/docs/assets/js/119fbfb6.bd53aeee.js new file mode 100644 index 000000000..a38279acb --- /dev/null +++ b/docs/assets/js/119fbfb6.bd53aeee.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11969],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.7.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.7.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.7.0/",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.7.0/category/getting-started"}},c={image:r(67583).Z},l=[{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean,\npragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open\nsource."),(0,o.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains."),(0,o.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems. We can do it\nby abstracting over core concepts that all the above systems are built around. These are type system,\nstorage, entry points, execution context, and testing environment. We believe it will bring standardization\nto the development of Rust-based smart contracts and enable code reusability we have not yet seen in this\necosystem."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.7.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.7.0/getting-started/flipper"},"Flipper example"),"\nto find out how to start your new project with Odra."))}p.isMDXComponent=!0},67583:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/11e5b730.56c24770.js b/docs/assets/js/11e5b730.56c24770.js new file mode 100644 index 000000000..82c209342 --- /dev/null +++ b/docs/assets/js/11e5b730.56c24770.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29906],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.2.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.2.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.2.0/basics/odra-toml",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"defaultSidebar",previous:{title:"Directory structure",permalink:"/docs/0.2.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.2.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," will be used as a name for the contract - the generated wasm file will be in the above case named\n",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the builder to locate the exact struct where\nthe contract is defined."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n\n[[contracts]]\nname = "counter"\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/120e723d.0f481bf7.js b/docs/assets/js/120e723d.0f481bf7.js new file mode 100644 index 000000000..74109096b --- /dev/null +++ b/docs/assets/js/120e723d.0f481bf7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11502],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,g=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return t?a.createElement(g,i(i({ref:n},p),{},{components:t})):a.createElement(g,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const o={},i="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.9.1/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.9.1/advanced/02-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.9.1/advanced/advanced-storage",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.9.1/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.9.1/advanced/attributes"}},c={},l=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:l};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Var"),": A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + ToBytes + FromBytes + CLTyped\n{\n value: Var\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is a key-value storage system where the key is associated with a value.\nIn previous examples, the value of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,r.kt)("p",null,"However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{casper_types::U256, Mapping, UnwrapOrRevert};\nuse odra::prelude::*;\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct Mappings {\n strings: Mapping<(String, u32, String), String>,\n tokens: Mapping\n}\n\n#[odra::module]\nimpl Mappings {\n\n ...\n\n pub fn total_supply(&mut self, token_name: String) -> U256 {\n self.tokens.module(&token_name).total_supply()\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let opt_string = self.strings.get(&(key1, key2, key3));\n opt_string.unwrap_or_revert(&self.env())\n }\n}\n")),(0,r.kt)("p",null,"As you can see, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," key can consist of a tuple of values, not limited to a single value."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra modules differs from accessing regular values such as strings or numbers."),(0,r.kt)("p",{parentName:"admonition"},"Firstly, within a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you don't encapsulate the module with ",(0,r.kt)("inlineCode",{parentName:"p"},"Submodule"),"."),(0,r.kt)("p",{parentName:"admonition"},"Secondly, rather than utilizing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::module()"),", which returns ",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule")," and sets the appropriate namespace for nested modules.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, casper_types::U512, Sequence, Mapping};\nuse odra::prelude::*;\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n counter: Sequence,\n tokens: Mapping<(String, String), Token>,\n}\n\nimpl AdvancedStorage {\n pub fn current_value(&self) -> u32 {\n self.counter.get_current_value()\n }\n\n pub fn increment_and_get(&mut self) -> u32 {\n self.counter.next_value()\n }\n\n pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {\n let token = self.tokens.module(&(token_name, creator));\n token.balance_of(&address)\n }\n\n pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {\n let mut token = self.tokens.module(&(token_name, creator));\n token.mint(amount, to);\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra offers a Sequence module, enabling contracts to store and increment a single value."),(0,r.kt)("li",{parentName:"ol"},"Mappings support composite keys expressed as tuples and can store modules as values.")),(0,r.kt)("p",null,"Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/120e9383.0372d791.js b/docs/assets/js/120e9383.0372d791.js new file mode 100644 index 000000000..e926bc7d0 --- /dev/null +++ b/docs/assets/js/120e9383.0372d791.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25867],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),i=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=i(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=i(n),m=r,h=p["".concat(c,".").concat(m)]||p[m]||d[m]||o;return n?a.createElement(h,l(l({ref:t},u),{},{components:n})):a.createElement(h,l({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var i=2;i{n.d(t,{Z:()=>l});var a=n(67294),r=n(86010);const o="tabItem_Ymn6";function l(e){let{children:t,hidden:n,className:l}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,l),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>_});var a=n(87462),r=n(67294),o=n(86010),l=n(12466),s=n(16550),c=n(91980),i=n(67392),u=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,s.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,c._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(a.location.search);t.set(o,e),a.replace({...a.location,search:t.toString()})}),[o,a])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,o=p(e),[l,s]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:o}))),[c,i]=h({queryString:n,groupId:a}),[d,f]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,o]=(0,u.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:a}),b=(()=>{const e=c??d;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{b&&s(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),i(e),f(e)}),[i,f,o]),tabValues:o}}var b=n(72389);const y="tabList__CuJ",g="tabItem_LNqP";function k(e){let{className:t,block:n,selectedValue:s,selectValue:c,tabValues:i}=e;const u=[],{blockElementScrollPositionUntilNextRender:d}=(0,l.o5)(),p=e=>{const t=e.currentTarget,n=u.indexOf(t),a=i[n].value;a!==s&&(d(t),c(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=u.indexOf(e.currentTarget)+1;t=u[n]??u[0];break}case"ArrowLeft":{const n=u.indexOf(e.currentTarget)-1;t=u[n]??u[u.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:l}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>u.push(e),onKeyDown:m,onClick:p},l,{className:(0,o.Z)("tabs__item",g,l?.className,{"tabs__item--active":s===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",y)},r.createElement(k,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function _(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},28158:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),o=n(74866),l=n(85162);const s={sidebar_position:8},c="Using Proxy Caller",i={unversionedId:"tutorials/using-proxy-caller",id:"tutorials/using-proxy-caller",title:"Using Proxy Caller",description:"In this tutorial, we will learn how to use the proxycaller wasm to call an Odra payable function. The proxycaller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.",source:"@site/docs/tutorials/using-proxy-caller.md",sourceDirName:"tutorials",slug:"/tutorials/using-proxy-caller",permalink:"/docs/next/tutorials/using-proxy-caller",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8},sidebar:"tutorialSidebar",previous:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/next/tutorials/build-deploy-read"},next:{title:"CEP-18",permalink:"/docs/next/tutorials/cep18"}},u={},d=[{value:"Contract",id:"contract",level:2},{value:"Client",id:"client",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-proxy-caller"},"Using Proxy Caller"),(0,r.kt)("p",null,"In this tutorial, we will learn how to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," wasm to call an Odra ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/casper#payable"},"payable")," function. The ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," is a session code that top-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some ",(0,r.kt)("inlineCode",{parentName:"p"},"CSPR"),"s to the call."),(0,r.kt)("p",null,"Read more about the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/casper#using-proxy_callerwasm"},"here"),"."),(0,r.kt)("h2",{id:"contract"},"Contract"),(0,r.kt)("p",null,"For this tutorial, we will use the ",(0,r.kt)("inlineCode",{parentName:"p"},"TimeLockWallet")," contract from our examples."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs showLineNumbers",title:"examples/src/contracts/tlw.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{casper_types::U512, Address, Mapping, Var};\n\n#[odra::module(errors = Error, events = [Deposit, Withdrawal])]\npub struct TimeLockWallet {\n balances: Mapping,\n lock_expiration_map: Mapping,\n lock_duration: Var\n}\n\n#[odra::module]\nimpl TimeLockWallet {\n /// Initializes the contract with the lock duration.\n pub fn init(&mut self, lock_duration: u64) {\n self.lock_duration.set(lock_duration);\n }\n\n /// Deposits the tokens into the contract.\n #[odra(payable)]\n pub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U512 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env().revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env().emit_event(Deposit {\n address: caller,\n amount\n });\n }\n\n /// Withdraws the tokens from the contract.\n pub fn withdraw(&mut self, amount: &U512) {\n // code omitted for brevity\n }\n\n /// Returns the balance of the given account.\n pub fn get_balance(&self, address: &Address) -> U512 {\n // code omitted for brevity\n }\n\n /// Returns the lock duration.\n pub fn lock_duration(&self) -> u64 {\n // code omitted for brevity\n }\n}\n\n/// Errors that may occur during the contract execution.\n#[odra::odra_error]\npub enum Error {\n LockIsNotOver = 1,\n CannotLockTwice = 2,\n InsufficientBalance = 3\n}\n\n/// Deposit event.\n#[odra::event]\npub struct Deposit {\n pub address: Address,\n pub amount: U512\n}\n\n/// Withdrawal event.\n#[odra::event]\npub struct Withdrawal {\n pub address: Address,\n pub amount: U512\n}\n")),(0,r.kt)("p",null,"Full code can be found ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.1.0/examples/src/contracts/tlw.rs"},"here"),"."),(0,r.kt)("h2",{id:"client"},"Client"),(0,r.kt)("p",null,"Before we can interact with the node, we need to set it up. We will use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-nctl-docker"},(0,r.kt)("inlineCode",{parentName:"a"},"casper-nctl-docker"))," image."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Make sure you have the contract's wasm file and the secret key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# Build the contract\ncargo odra build -c TimeLockWallet\n# Extract secret key\ndocker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem\n')),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("p",null,"To interact with the contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"livenet")," backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "odra-examples"\nversion = "1.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { path = "../odra", default-features = false }\n... # other dependencies\nodra-casper-livenet-env = { version = "1.1.0", optional = true }\n\n... # other sections\n\n[features]\ndefault = []\nlivenet = ["odra-casper-livenet-env"]\n\n... # other sections\n\n[[bin]]\nname = "tlw_on_livenet"\npath = "bin/tlw_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n\n... # other sections\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/bin/tlw_on_livenet.rs showLineNumbers",title:"examples/bin/tlw_on_livenet.rs",showLineNumbers:!0},'//! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs.\nuse odra::casper_types::{AsymmetricType, PublicKey, U512};\nuse odra::host::{Deployer, HostRef};\nuse odra::Address;\nuse odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs};\n\nconst DEPOSIT: u64 = 100;\nconst WITHDRAWAL: u64 = 99;\nconst GAS: u64 = 20u64.pow(9);\n\nfn main() {\n let env = odra_casper_livenet_env::env();\n let caller = env.get_account(0);\n\n env.set_caller(caller);\n env.set_gas(GAS);\n\n let mut contract = TimeLockWalletHostRef::deploy(\n &env, \n TimeLockWalletInitArgs { lock_duration: 60 * 60 }\n );\n // Send 100 CSPRs to the contract.\n contract\n .with_tokens(U512::from(DEPOSIT))\n .deposit();\n \n println!("Caller\'s balance: {:?}", contract.get_balance(&caller));\n // Withdraw 99 CSPRs from the contract.\n contract.withdraw(&U512::from(WITHDRAWAL));\n println!("Remaining balance: {:?}", contract.get_balance(&caller));\n}\n')),(0,r.kt)("p",null,"To run the code, execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \\\nODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \\\nODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \\ \ncargo run --bin tlw_on_livenet --features=livenet\n# Sample output\n\ud83d\udc81 INFO : Deploying "TimeLockWallet".\n\ud83d\udc81 INFO : Found wasm under "wasm/TimeLockWallet.wasm".\n\ud83d\ude44 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558".\n\ud83d\udc81 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed.\n\ud83d\udc81 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed.\n\ud83d\udc81 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy.\n\ud83d\ude44 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3".\n\ud83d\udc81 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed.\nCaller\'s balance: 100\n\ud83d\udc81 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw".\n\ud83d\ude44 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e".\n\ud83d\udc81 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed.\nRemaining balance: 1\n')),(0,r.kt)("p",null,"As observed, the contract was successfully deployed, and the ",(0,r.kt)("inlineCode",{parentName:"p"},"Caller")," deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR.\nThe logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity.")),(0,r.kt)(l.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("p",null,"Since TypeScript code often requires considerable boilerplate, we offer a streamlined version of the code. We demonstrate how to deploy the contract and prepare a deploy that utilizes the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," to invoke a payable function with attached ",(0,r.kt)("inlineCode",{parentName:"p"},"CSPR")," tokens. The ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/tutorials/build-deploy-read"},"previous tutorial")," details how to read the state, which is not the focus of our current discussion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'import {\n CLByteArray,\n CLList,\n CLU8,\n CLValueBuilder,\n CasperClient,\n Contracts,\n Keys,\n RuntimeArgs,\n csprToMotes,\n decodeBase16,\n} from "casper-js-sdk";\nimport fs from "fs";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\nconst SECRET_KEY_PATH = "keys/secret_key.pem"\nconst PROXY_CALLER_PATH = "wasm/proxy_caller.wasm"\nconst CONTRACT_PATH = "wasm/TimeLockWallet.wasm";\nconst CHAIN_NAME = "casper-net-1";\nconst ENTRY_POINT = "deposit";\nconst DEPOSIT = 100;\nconst GAS = 110;\n// Once the contract is deployed, the contract package hash\n// can be obtained from the global state.\nconst CONTRACT_PACKAGE_HASH = "...";\n\nconst casperClient = new CasperClient(LOCAL_NODE_URL);\nconst keypair = Keys.Ed25519.loadKeyPairFromPrivateFile(\n SECRET_KEY_PATH\n);\nconst contract = new Contracts.Contract(casperClient);\n\nexport async function deploy_contract(): Promise {\n // Required odra_cfg args and the constructor args\n const args = RuntimeArgs.fromMap({\n odra_cfg_package_hash_key_name: CLValueBuilder.string("tlw"),\n odra_cfg_allow_key_override: CLValueBuilder.bool(true),\n odra_cfg_is_upgradable: CLValueBuilder.bool(true),\n lock_duration: CLValueBuilder.u64(60 * 60)\n });\n \n const wasm = new Uint8Array(fs.readFileSync(CONTRACT_PATH));\n const deploy = contract.install(\n wasm,\n args,\n csprToMotes(GAS).toString(),\n keypair.publicKey,\n CHAIN_NAME,\n [keypair],\n );\n return casperClient.putDeploy(deploy);\n}\n \nexport async function deposit(): Promise {\n // Contract package hash is a 32-byte array, \n // so take the hex string and convert it to a byte array.\n // This is done using the decodeBase16 function from \n // the casper-js-sdk.\n const contractPackageHashBytes = new CLByteArray(\n decodeBase16(CONTRACT_PACKAGE_HASH)\n );\n // Next, create RuntimeArgs for the deploy \n // and pass them as bytes to the contract.\n // Note that the args are not a byte array, but a CLList \n // of CLU8s - a different type of CLValue.\n // Finally, create a Uint8Array from the bytes and \n // then transform it into a CLList.\n const args_bytes: Uint8Array = RuntimeArgs.fromMap({})\n .toBytes()\n .unwrap();\n const serialized_args = new CLList(\n Array.from(args_bytes)\n .map(value => new CLU8(value))\n );\n\n const args = RuntimeArgs.fromMap({\n attached_value: CLValueBuilder.u512(DEPOSIT),\n amount: CLValueBuilder.u512(DEPOSIT),\n entry_point: CLValueBuilder.string(ENTRY_POINT),\n contract_package_hash: contractPackageHashBytes,\n args: serialized_args\n });\n // Use proxy_caller to send tokens to the contract.\n const wasm = new Uint8Array(fs.readFileSync(PROXY_CALLER_PATH));\n const deploy = contract.install(\n wasm,\n args,\n csprToMotes(GAS).toString(),\n keypair.publicKey,\n CHAIN_NAME,\n [keypair],\n );\n return casperClient.putDeploy(deploy);\n}\n \ndeploy_contract()\n .then((result) => { console.log(result); });\n\n// One you obatin the contract hash, you can call the deposit function:\n// deposit()\n// .then((result) => { console.log(result); });\n')),(0,r.kt)("p",null,"To run the code, execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \n# Sample output\nf40e3ca983034435d829462dd53d801df4e98013009cbf4a6654b3ee467063a1 # the deploy hash\n")))),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"In this tutorial, we learned how to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," wasm to make a payable function call. We deployed the ",(0,r.kt)("inlineCode",{parentName:"p"},"TimeLockWallet")," contract, deposited tokens using the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," with attached CSPRs, and withdrew them. You got to try it out in both ",(0,r.kt)("inlineCode",{parentName:"p"},"Rust")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"TypeScript"),", so you can choose whichever you prefer. ",(0,r.kt)("inlineCode",{parentName:"p"},"Rust")," code seemed simpler, thanks to the Odra ",(0,r.kt)("inlineCode",{parentName:"p"},"livenet")," backend making chain interactions easier to handle."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/12366.ba3d5d9a.js b/docs/assets/js/12366.ba3d5d9a.js new file mode 100644 index 000000000..f6246f94f --- /dev/null +++ b/docs/assets/js/12366.ba3d5d9a.js @@ -0,0 +1,2 @@ +/*! For license information please see 12366.ba3d5d9a.js.LICENSE.txt */ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12366],{84182:function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},m.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},m.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n1)for(s=0;sr&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(c.WORLD_CENTER_X-o.x/2,c.WORLD_CENTER_Y-o.y/2))},m.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);m.branchRadialLayout(t,null,0,359,0,r);var i=v.calculateBounds(e),a=new y;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o1;){var y=v[0];v.splice(0,1);var b=c.indexOf(y);b>=0&&c.splice(b,1),g--,h--}d=null!=t?(c.indexOf(v[0])+1)%g:0;for(var x=Math.abs(r-n)/h,w=d;p!=h;w=++w%g){var E=c[w].getOtherEnd(e);if(E!=t){var _=(n+p*x)%360,T=(_+x)%360;m.branchRadialLayout(E,e,_,T,i+a,a),p++}}},m.maxDiagonalInTree=function(e){for(var t=g.MIN_VALUE,n=0;nt&&(t=r)}return t},m.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},m.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var u=0;u=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},m.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach((function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)}))},m.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i0)return this.toBeTiled[t]=!1,!1;if(null!=a.getChild()){if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}else this.toBeTiled[a.id]=!1}return this.toBeTiled[t]=!0,!0},m.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;rl&&(l=c.rect.height)}n+=l+e.verticalPadding}},m.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach((function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height}))},m.prototype.tileNodes=function(e,t){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:l.TILING_PADDING_VERTICAL,horizontalPadding:l.TILING_PADDING_HORIZONTAL};e.sort((function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:e.rect.width*e.rect.height0&&(a+=e.horizontalPadding),e.rowWidth[n]=a,e.width0&&(o+=e.verticalPadding);var s=0;o>e.rowHeight[n]&&(s=e.rowHeight[n],e.rowHeight[n]=o,s=e.rowHeight[n]-s),e.height+=s,e.rows[n].push(t)},m.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;rn&&(t=r,n=e.rowWidth[r]);return t},m.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a,o,s=0;return e.rowHeight[r]0&&(s=n+e.verticalPadding-e.rowHeight[r]),a=e.width-i>=t+e.horizontalPadding?(e.height+s)/(i+t+e.horizontalPadding):(e.height+s)/e.width,s=n+e.verticalPadding,(o=e.widtha&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;so&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]0)for(var c=i;c<=a;c++)l[0]+=this.grid[c][o-1].length+this.grid[c][o].length-1;if(a0)for(c=o;c<=s;c++)l[3]+=this.grid[i-1][c].length+this.grid[i][c].length-1;for(var h,d,p=g.MAX_VALUE,f=0;f0&&(o=n.getGraphManager().add(n.newGraph(),a),this.processChildrenList(o,h,n))}},h.prototype.stop=function(){return this.stopped=!0,this};var p=function(e){e("layout","cose-bilkent",h)};"undefined"!=typeof cytoscape&&p(cytoscape),e.exports=p}])},e.exports=r(n(84182))},59058:(e,t,n)=>{"use strict";var r=n(23279),i=n(54485),a=n(27361),o=n(36968),s=n(30084);function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=l(r),c=l(i),h=l(a),d=l(o),p=l(s);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nt?1:0},W=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t}(e)},K={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Z=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:ie,r=n;!(t=e.next()).done;)r=r*ae+t.value|0;return r},le=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ie;return t*ae+e|0},ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oe;return(t<<5)+t+e|0},ce=function(e){return 2097152*e[0]+e[1]},he=function(e,t){return[le(e[0],t[0]),ue(e[1],t[1])]},de=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return se({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Ie=function(e){e.splice(0,e.length)},Me=function(e,t,n){return n&&(t=U(n,t)),e[t]},Oe=function(e,t,n,r){n&&(t=U(n,t)),e[t]=r},Pe="undefined"!=typeof Map?Map:function(){function e(){f(this,e),this._obj={}}return y(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Re=function(){function e(t){if(f(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&B(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Be,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];k(t.classes)?l=t.classes:A(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u0;){var E=m.pop(),_=v(E),T=E.id();if(d[T]=_,_!==1/0)for(var D=E.neighborhood().intersect(g),C=0;C0)for(n.unshift(t);h[i];){var a=h[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},Ve={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=v.pop(),u=l.id(),y.delete(u),E++,u===d){for(var _=[],T=i,D=d,C=b[D];_.unshift(T),null!=C&&_.unshift(C),null!=(T=m[D]);)C=b[D=T.id()];return{found:!0,distance:p[u],path:this.spawn(_),steps:E}}f[u]=!0;for(var N=l._private.edges,A=0;AC&&(p[D]=C,y[D]=T,m[D]=x),!i){var N=T*u+_;!i&&p[N]>C&&(p[N]=C,y[N]=_,m[N]=x)}}}for(var L=0;L1&&void 0!==arguments[1]?arguments[1]:a,r=m(e),i=[],o=r;;){if(null==o)return t.spawn();var l=y(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:g,negativeWeightCycles:f}}},Ke=Math.sqrt(2),Ze=function(e,t,n){0===n.length&&_e("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=Ze(i,e,t),n--}return t},Je={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/Ke);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},ot=function(e,t){return Math.sqrt(st(e,t))},st=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},lt=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},pt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},gt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ft=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=b(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},vt=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},yt=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},mt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},bt=function(e,t){return mt(e,t.x1,t.y1)&&mt(e,t.x2,t.y2)},xt=function(e,t,n,r,i,a,o){var s,l=Ft(i,a),u=i/2,c=a/2,h=r-c-o;if((s=It(e,t,n,r,n-u+l-o,h,n+u-l+o,h,!1)).length>0)return s;var d=n+u+o;if((s=It(e,t,n,r,d,r-c+l-o,d,r+c-l+o,!1)).length>0)return s;var p=r+c+o;if((s=It(e,t,n,r,n-u+l-o,p,n+u-l+o,p,!1)).length>0)return s;var g,f=n-u-o;if((s=It(e,t,n,r,f,r-c+l-o,f,r+c-l+o,!1)).length>0)return s;var v=n-u+l,y=r-c+l;if((g=kt(e,t,n,r,v,y,l+o)).length>0&&g[0]<=v&&g[1]<=y)return[g[0],g[1]];var m=n+u-l,b=r-c+l;if((g=kt(e,t,n,r,m,b,l+o)).length>0&&g[0]>=m&&g[1]<=b)return[g[0],g[1]];var x=n+u-l,w=r+c-l;if((g=kt(e,t,n,r,x,w,l+o)).length>0&&g[0]>=x&&g[1]>=w)return[g[0],g[1]];var E=n-u+l,_=r+c-l;return(g=kt(e,t,n,r,E,_,l+o)).length>0&&g[0]<=E&&g[1]>=_?[g[0],g[1]]:[]},wt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},Et=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,h=Math.min(r,s,a)-l,d=Math.max(r,s,a)+l;return!(ec||td)},_t=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,h,d;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,h=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,i[5]=-h):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,i[4]=i[2]=-(d+h)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),i[4]=-h+d*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var h,d,p,g=-1,f=0;f=0?pl?(e-i)*(e-i)+(t-a)*(t-a):u-h},Dt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Ct=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h,d=Math.cos(-u),p=Math.sin(-u),g=0;g0){var f=At(c,-l);h=Nt(f)}else h=c;return Dt(e,t,h)},Nt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c=0&&g<=1&&v.push(g),f>=0&&f<=1&&v.push(f),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},St=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},It=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,p=r-t,g=s-a,f=h*d-g*u,v=c*d-p*u,y=g*c-h*p;if(0!==y){var m=f/y,b=v/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===f||0===v?St(e,n,o)===o?[o,s]:St(e,n,i)===i?[i,a]:St(i,o,n)===n?[n,r]:[]:[]},Mt=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,p,g=[],f=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=At(f,-s);u=Nt(m)}else u=f}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},p=0;p0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var E=r(w);b=b.id(),p[b]>p[y]+E&&(p[b]=p[y]+E,g.nodes.indexOf(b)<0?g.push(b):g.updateItem(b),u[b]=0,l[b]=[]),p[b]==p[y]+E&&(u[b]=u[b]+u[y],l[b].push(y))}else for(var _=0;_0;){for(var N=n.pop(),A=0;A0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:on,o=r,s=0;s=2?dn(e,t,n,0,un,cn):dn(e,t,n,0,ln)},squaredEuclidean:function(e,t,n){return dn(e,t,n,0,un)},manhattan:function(e,t,n){return dn(e,t,n,0,ln)},max:function(e,t,n){return dn(e,t,n,-1/0,hn)}};function gn(e,t,n,r,i,a){var o;return o=L(e)?e:pn[e]||pn.euclidean,0===t&&L(e)?o(i,a):o(t,n,r,i,a)}pn["squared-euclidean"]=pn.squaredEuclidean,pn.squaredeuclidean=pn.squaredEuclidean;var fn=ke({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),vn=function(e){return fn(e)},yn=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return gn(e,r.length,a,(function(e){return r[e](t)}),o,s)},mn=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},En=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,g=t[o],f=t[r[o]];p="dendrogram"===i.mode?{left:g,right:f,key:g.key}:{value:g.value.concat(f.value),key:g.key},e[g.index]=p,e.splice(f.index,1),t[g.key]=p;for(var v=0;vn[f.key][y.key]&&(a=n[f.key][y.key])):"max"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var a=0,o=e.length-1;o>=0;o--){var s=e[o];i?isFinite(s)||(e[o]=-1/0,a++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!=0?e[u+1+a]:(e[u-1+a]+e[u+a])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u=C?(N=C,C=L,A=k):L>N&&(N=L);for(var S=0;S0?1:0;_[E%u.minIterations*t+F]=z,B+=z}if(B>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var G=0,Y=0;Y0&&r.push(i);return r}(t,a,o),U=function(e,t,n){for(var r=Gn(e,t,n),i=0;il&&(s=u,l=c)}n[i]=a[s]}return Gn(e,t,n)}(t,r,V),j={},q=0;q1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},jn=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);r.push(h),a=a.difference(h)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:a,components:r}},qn={};[Ge,Xe,Ve,je,He,$e,Je,Xt,Ut,qt,Wt,an,An,Rn,Xn,{hierholzer:function(e){if(!S(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=Vn(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=A(o)?this.filter(o)[0].id():o[0].id());var c={},h={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else h[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):h[t]=[e.source().id(),e.target().id()]}));var d={found:!1,trail:void 0};if(u)return d;if(r&&n)if(s){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=h[t][0],i!=(r=h[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},g=[],f=[];for(f=p(i);1!=f.length;)0==c[f[0]].length?(g.unshift(l.getElementById(f.shift())),g.unshift(l.getElementById(f.shift()))):f=p(f.shift()).concat(f);for(var v in g.unshift(l.getElementById(f.shift())),c)if(c[v].length)return d;return d.found=!0,d.trail=this.spawn(g,!0),d}},{hopcroftTarjanBiconnected:Un,htbc:Un,htb:Un,hopcroftTarjanBiconnectedComponents:Un},{tarjanStronglyConnected:jn,tsc:jn,tscc:jn,tarjanStronglyConnectedComponents:jn}].forEach((function(e){W(qn,e)}));var Hn=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Hn.prototype={fulfill:function(e){return Wn(this,1,"fulfillValue",e)},reject:function(e){return Wn(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Hn;return n.onFulfilled.push(Zn(e,r,"fulfill")),n.onRejected.push(Zn(t,r,"reject")),$n(n),r.proxy}};var Wn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,$n(e)),e},$n=function(e){1===e.state?Kn(e,"onFulfilled",e.fulfillValue):2===e.state&&Kn(e,"onRejected",e.rejectReason)},Kn=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){k(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};sr.className=sr.classNames=sr.classes;var lr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:q,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};lr.variable="(?:[\\w-.]|(?:\\\\"+lr.metaChar+"))+",lr.className="(?:[\\w-]|(?:\\\\"+lr.metaChar+"))+",lr.value=lr.string+"|"+lr.number,lr.id=lr.variable,function(){var e,t,n;for(e=lr.comparatorOp.split("|"),n=0;n=0||"="!==t&&(lr.comparatorOp+="|\\!"+t)}();var ur=0,cr=1,hr=2,dr=3,pr=4,gr=5,fr=6,vr=7,yr=8,mr=9,br=10,xr=11,wr=12,Er=13,_r=14,Tr=15,Dr=16,Cr=17,Nr=18,Ar=19,Lr=20,kr=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*H(e,t)}(e.selector,t.selector)})),Sr=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return De("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return De("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&De("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return A(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case ur:var l=e(s);return l.substring(0,l.length-1);case dr:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case gr:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case pr:return"["+r.field+"]";case fr:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case vr:return s;case yr:return"#"+s;case mr:return"."+s;case Cr:case Tr:return i(r.parent,a)+n(">")+i(r.child,a);case Nr:case Dr:return i(r.ancestor,a)+" "+i(r.descendant,a);case Ar:var g=i(r.left,a),f=i(r.subject,a),v=i(r.right,a);return g+(g.length>0?" ":"")+f+v;case Lr:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Zr(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Kr(this,e,t,Zr)},$r.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Kr(this,e,t,Qr)},$r.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Kr(this,e,t,Jr)},$r.ancestors=$r.parents,(qr=Hr={data:ar.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:ar.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ar.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ar.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ar.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ar.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=qr.data,qr.removeAttr=qr.removeData;var ei,ti,ni=Hr,ri={};function ii(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;ot})),minIndegree:ai("indegree",(function(e,t){return et})),minOutdegree:ai("outdegree",(function(e,t){return et}))}),W(ri,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var d=0;d0,v=f;f&&(g=g[0]);var y=v?g.position():{x:0,y:0};void 0!==t?p.position(e,t+y[e]):void 0!==i&&p.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}},ei.modelPosition=ei.point=ei.position,ei.modelPositions=ei.points=ei.positions,ei.renderedPoint=ei.renderedPosition,ei.relativePoint=ei.relativePosition;var li,ui,ci=ti;li=ui={},ui.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},ui.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},ui.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,p=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),f=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-f+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},pi=function(e,t){return null==t?e:di(e,t.x1,t.y1,t.x2,t.y2)},gi=function(e,t,n){return Me(e,t,n)},fi=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,gt(u,1),di(e,u.x1,u.y1,u.x2,u.y2)}}},vi=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=gi(a,"labelWidth",n),p=gi(a,"labelHeight",n),g=gi(a,"labelX",n),f=gi(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,_=p,T=d,D=T/2,C=_/2;if(m)o=g-D,s=g+D,l=f-C,u=f+C;else{switch(c.value){case"left":o=g-T,s=g;break;case"center":o=g-D,s=g+D;break;case"right":o=g,s=g+T}switch(h.value){case"top":l=f-_,u=f;break;case"center":l=f-C,u=f+C;break;case"bottom":l=f,u=f+_}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var N=n||"main",A=i.labelBounds,L=A[N]=A[N]||{};L.x1=o,L.y1=l,L.x2=s,L.y2=u,L.w=s-o,L.h=u-l;var k=m&&"autorotate"===b.strValue,S=null!=b.pfValue&&0!==b.pfValue;if(k||S){var I=k?gi(i.rstyle,"labelAngle",n):b.pfValue,M=Math.cos(I),O=Math.sin(I),P=(o+s)/2,R=(l+u)/2;if(!m){switch(c.value){case"left":P=s;break;case"right":P=o}switch(h.value){case"top":R=u;break;case"bottom":R=l}}var B=function(e,t){return{x:(e-=P)*M-(t-=R)*O+P,y:e*O+t*M+R}},F=B(o,l),z=B(o,u),G=B(s,l),Y=B(s,u);o=Math.min(F.x,z.x,G.x,Y.x),s=Math.max(F.x,z.x,G.x,Y.x),l=Math.min(F.y,z.y,G.y,Y.y),u=Math.max(F.y,z.y,G.y,Y.y)}var X=N+"Rot",V=A[X]=A[X]||{};V.x1=o,V.y1=l,V.x2=s,V.y2=u,V.w=s-o,V.h=u-l,di(e,o,l,s,u),di(i.labelBounds.all,o,l,s,u)}return e}},yi=function(e){var t=0,n=function(e){return(e?1:0)<(r=A[1].x)){var L=n;n=r,r=L}if(i>(a=A[1].y)){var k=i;i=a,a=k}di(d,n-_,i-_,r+_,a+_)}}else if("bezier"===N||"unbundled-bezier"===N||"segments"===N||"taxi"===N){var S;switch(N){case"bezier":case"unbundled-bezier":S=v.bezierPts;break;case"segments":case"taxi":S=v.linePts}if(null!=S)for(var I=0;I(r=P.x)){var R=n;n=r,r=R}if((i=O.y)>(a=P.y)){var B=i;i=a,a=B}di(d,n-=_,i-=_,r+=_,a+=_)}if(c&&t.includeEdges&&f&&(fi(d,e,"mid-source"),fi(d,e,"mid-target"),fi(d,e,"source"),fi(d,e,"target")),c&&"yes"===e.pstyle("ghost").value){var F=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;di(d,d.x1+F,d.y1+z,d.x2+F,d.y2+z)}var G=p.bodyBounds=p.bodyBounds||{};vt(G,d),ft(G,y),gt(G,1),c&&(n=d.x1,r=d.x2,i=d.y1,a=d.y2,di(d,n-E,i-E,r+E,a+E));var Y=p.overlayBounds=p.overlayBounds||{};vt(Y,d),ft(Y,y),gt(Y,1);var X=p.labelBounds=p.labelBounds||{};null!=X.all?((l=X.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):X.all=dt(),c&&t.includeLabels&&(t.includeMainLabels&&vi(d,e,null),f&&(t.includeSourceLabels&&vi(d,e,"source"),t.includeTargetLabels&&vi(d,e,"target")))}return d.x1=hi(d.x1),d.y1=hi(d.y1),d.x2=hi(d.x2),d.y2=hi(d.y2),d.w=hi(d.x2-d.x1),d.h=hi(d.y2-d.y1),d.w>0&&d.h>0&&b&&(ft(d,y),gt(d,1)),d}(e,xi),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,!a){var c=e.isNode();n=dt(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?pi(n,r.overlayBounds):pi(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?pi(n,r.labelBounds.all):(t.includeMainLabels&&pi(n,r.labelBounds.mainRot),t.includeSourceLabels&&pi(n,r.labelBounds.sourceRot),t.includeTargetLabels&&pi(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},xi={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,useCache:!0},wi=yi(xi),Ei=ke(xi);ui.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=dt();var n=Ei(e=e||xi),r=this;if(r.cy().styleEnabled())for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:Bi,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},zi.removeAllListeners=function(){return this.removeListener("*")},zi.emit=zi.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,k(t)||(t=[t]),Xi(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&A(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;ir&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(S(e)){var i=e;r.applyBypass(this,i,false),this.emitAndNotify("style")}else if(A(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,false),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style(),r=this;if(void 0===e)for(var i=0;i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),pa.neighbourhood=pa.neighborhood,pa.closedNeighbourhood=pa.closedNeighborhood,pa.openNeighbourhood=pa.openNeighborhood,W(pa,{source:Wr((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Wr((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:ya({attr:"source"}),targets:ya({attr:"target"})}),W(pa,{edgesWith:Wr(ma(),"edgesWith"),edgesTo:Wr(ma({thisIsSrc:!0}),"edgesTo")}),W(pa,{connectedEdges:Wr((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),pa.componentsOf=pa.components;var xa=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new Pe,a=!1;if(t){if(t.length>0&&S(t[0])&&!P(t[0])){a=!0;for(var o=[],s=new Be,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var B=e.length===i.length?i:new xa(a,e),F=0;F0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?N.emitAndNotify("remove"):t&&N.emit("remove"));for(var A=0;Ah&&Math.abs(s.v)>h;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),Ta=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var h=0;h<4;++h)if("number"!=typeof arguments[h]||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var d=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function g(e,t){return 3*t-6*e}function f(e){return 3*e}function v(e,t,n){return((p(t,n)*e+g(t,n))*e+f(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*g(t,n)*e+f(t)}function m(t,r){for(var a=0;a0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function _(){E=!0,e===t&&n===r||b()}var T=function(i){return E||_(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};T.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var D="generateBezier("+[e,t,n,r]+")";return T.toString=function(){return D},T}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},Da={linear:function(e,t,n){return e+(t-e)*n},ease:Ta(.25,.1,.25,1),"ease-in":Ta(.42,0,1,1),"ease-out":Ta(0,0,.58,1),"ease-in-out":Ta(.42,0,.58,1),"ease-in-sine":Ta(.47,0,.745,.715),"ease-out-sine":Ta(.39,.575,.565,1),"ease-in-out-sine":Ta(.445,.05,.55,.95),"ease-in-quad":Ta(.55,.085,.68,.53),"ease-out-quad":Ta(.25,.46,.45,.94),"ease-in-out-quad":Ta(.455,.03,.515,.955),"ease-in-cubic":Ta(.55,.055,.675,.19),"ease-out-cubic":Ta(.215,.61,.355,1),"ease-in-out-cubic":Ta(.645,.045,.355,1),"ease-in-quart":Ta(.895,.03,.685,.22),"ease-out-quart":Ta(.165,.84,.44,1),"ease-in-out-quart":Ta(.77,0,.175,1),"ease-in-quint":Ta(.755,.05,.855,.06),"ease-out-quint":Ta(.23,1,.32,1),"ease-in-out-quint":Ta(.86,0,.07,1),"ease-in-expo":Ta(.95,.05,.795,.035),"ease-out-expo":Ta(.19,1,.22,1),"ease-in-out-expo":Ta(1,0,0,1),"ease-in-circ":Ta(.6,.04,.98,.335),"ease-out-circ":Ta(.075,.82,.165,1),"ease-in-out-circ":Ta(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Da.linear;var r=_a(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Ta};function Ca(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function Na(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function Aa(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=Na(e,i),s=Na(t,i);if(I(o)&&I(s))return Ca(a,o,s,n,r);if(k(o)&&k(s)){for(var l=[],u=0;u0?("spring"===h&&d.push(o.duration),o.easingImpl=Da[h].apply(null,d)):o.easingImpl=Da[h]}var p,g=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var f=o.startPosition,v=o.position;if(v&&i&&!e.locked()){var y={};ka(f.x,v.x)&&(y.x=Aa(f.x,v.x,p,g)),ka(f.y,v.y)&&(y.y=Aa(f.y,v.y,p,g)),e.position(y)}var m=o.startPan,b=o.pan,x=a.pan,w=null!=b&&r;w&&(ka(m.x,b.x)&&(x.x=Aa(m.x,b.x,p,g)),ka(m.y,b.y)&&(x.y=Aa(m.y,b.y,p,g)),e.emit("pan"));var E=o.startZoom,_=o.zoom,T=null!=_&&r;T&&(ka(E,_)&&(a.zoom=ht(a.minZoom,Aa(E,_,p,g),a.maxZoom)),e.emit("zoom")),(w||T)&&e.emit("viewport");var D=o.style;if(D&&D.length>0&&i){for(var C=0;C=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;d.stopped?(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||Sa(0,h,e),La(t,h,e,n),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Ma={animate:ar.animate(),animation:ar.animation(),animated:ar.animated(),clearQueue:ar.clearQueue(),delay:ar.delay(),delayAnimation:ar.delayAnimation(),stop:ar.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){Ia(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&ne((function(n){Ia(n,e),t()}))}()}}},Oa={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&P(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Pa=function(e){return A(e)?new Vr(e):e},Ra={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Fi(Oa,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Pa(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Pa(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Pa(t),n),this},once:function(e,t,n){return this.emitter().one(e,Pa(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};ar.eventAliasesOn(Ra);var Ba={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Ba.jpeg=Ba.jpg;var Fa={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=A(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var a=new r(W({},e,{cy:t,eles:i}));return a}_e("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else _e("A `name` must be specified to make a layout");else _e("Layout options must be specified to make a layout")}};Fa.createLayout=Fa.makeLayout=Fa.layout;var za={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ya.invalidateDimensions=Ya.resize;var Xa={collection:function(e,t){return A(e)?this.$(e):O(e)?e.collection():k(e)?(t||(t={}),new xa(this,e,t.unique,t.removed)):new xa(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Xa.elements=Xa.filter=Xa.$;var Va={},Ua="t";Va.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(d||h&&p){var g=void 0;d&&p||d?g=u.properties:p&&(g=u.mappedProperties);for(var f=0;f1&&(v=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],_=i.valueMin[1],T=i.valueMax[1],D=i.valueMin[2],C=i.valueMax[2],N=null==i.valueMin[3]?1:i.valueMin[3],A=null==i.valueMax[3]?1:i.valueMax[3],L=[Math.round(w+(E-w)*v),Math.round(_+(T-_)*v),Math.round(D+(C-D)*v),Math.round(N+(A-N)*v)];n={bypass:i.bypass,name:i.name,value:L,strValue:"rgb("+L[0]+", "+L[1]+", "+L[2]+")"}}else{if(!s.number)return!1;var k=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,k,i.bypass,d)}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var S=i.field.split("."),M=h.data,O=0;O0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Va.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Va.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Va.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||("curve-style"!==t||"bezier"!==n&&"bezier"!==r)&&("display"!==t||"none"!==n&&"none"!==r)||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Va.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var ja={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?a.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(a.match(/^\s*$/))break;var l=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){De("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}t=l[0];var u=l[1];if("core"!==u)if(new Vr(u).invalid){De("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),o();continue}var c=l[2],h=!1;n=c;for(var d=[];;){if(n.match(/^\s*$/))break;var p=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){De("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),h=!0;break}r=p[0];var g=p[1],f=p[2];if(this.properties[g])i.parse(g,f)?(d.push({name:g,val:f}),s()):(De("Skipping property: Invalid property definition in: "+r),s());else De("Skipping property: Invalid property name in: "+r),s()}if(h){o();break}i.selector(u);for(var v=0;v=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var d=s.data;return{name:e,value:u,strValue:""+t,mapped:d,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(h.multiple)return!1;var p=s.mapData;if(!h.color&&!h.number)return!1;var g=this.parse(e,c[4]);if(!g||g.mapped)return!1;var f=this.parse(e,c[5]);if(!f||f.mapped)return!1;if(g.pfValue===f.pfValue||g.strValue===f.strValue)return De("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(h.color){var v=g.value,y=f.value;if(!(v[0]!==y[0]||v[1]!==y[1]||v[2]!==y[2]||v[3]!==y[3]&&(null!=v[3]&&1!==v[3]||null!=y[3]&&1!==y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:g.value,valueMax:f.value,bypass:n}}}if(h.multiple&&"multiple"!==r){var m;if(m=l?t.split(/\s+/):k(t)?t:[t],h.evenMultiple&&m.length%2!=0)return null;for(var b=[],x=[],w=[],E="",_=!1,T=0;T0?" ":"")+D.strValue}return h.validate&&!h.validate(b,x)?null:h.singleEnum&&_?1===b.length&&A(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var C,N,S=function(){for(var r=0;rh.max||h.strictMax&&t===h.max))return null;var B={name:e,value:t,strValue:""+t+(M||""),units:M,bypass:n};return h.unitless||"px"!==M&&"em"!==M?B.pfValue=t:B.pfValue="px"!==M&&M?this.getEmSizeInPixels()*t:t,"ms"!==M&&"s"!==M||(B.pfValue="ms"===M?t:1e3*t),"deg"!==M&&"rad"!==M||(B.pfValue="rad"===M?t:(C=t,Math.PI*C/180)),"%"===M&&(B.pfValue=t/100),B}if(h.propList){var F=[],z=""+t;if("none"===z);else{for(var G=z.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),I(e)?n=e:S(e)&&(n=e.level,null!=e.position?t=et(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;I(l.x)&&(t.pan.x=l.x,o=!1),I(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(A(e)){var n=e;e=this.mutableElements().filter(n)}else O(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=w.getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};to.centre=to.center,to.autolockNodes=to.autolock,to.autoungrabifyNodes=to.autoungrabify;var no={data:ar.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ar.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ar.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ar.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};no.attr=no.data,no.removeAttr=no.removeData;var ro=function(e){var t=this,n=(e=W({},e)).container;n&&!M(n)&&M(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==w&&void 0!==n&&!e.headless,o=e;o.layout=W({name:a?"grid":"null"},o.layout),o.renderer=W({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new xa(this),listeners:[],aniEles:new xa(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:I(o.zoom)?o.zoom:1,pan:{x:S(o.pan)&&I(o.pan.x)?o.pan.x:0,y:S(o.pan)&&I(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var u=W({},o,o.renderer);t.initRenderer(u);!function(e,t){if(e.some(G))return Jn.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(S(e)||k(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=W({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),l.ready=!0,L(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=dt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(O(n.roots))e=n.roots;else if(k(n.roots)){for(var c=[],h=0;h0;){var S=C.shift(),I=D(S,N);if(I)S.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(L);else if(null===I){De("Detected double maximal shift for node `"+S.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}T();var M=0;if(n.avoidOverlap)for(var P=0;P0&&y[0].length<=3?l/2:0),h=2*Math.PI/y[r].length*i;return 0===r&&1===y[0].length&&(c=1),{x:W+c*Math.cos(h),y:$+c*Math.sin(h)}}return{x:W+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var uo={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function co(e){this.options=W({},uo,e)}co.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=dt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),h=0,d=0;d1&&t.avoidOverlap){h*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(h*h/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var ho,po={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function go(e){this.options=W({},po,e)}go.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=dt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,h=0;h0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,_=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,_)}for(var T=0,D=0;D1&&t.avoidOverlap){var L=Math.cos(A)-Math.cos(0),k=Math.sin(A)-Math.sin(0),S=Math.sqrt(w*w/(L*L+k*k));T=Math.max(S,T)}C.r=T,T+=w}if(t.equidistant){for(var I=0,M=0,O=0;O=e.numIter)&&(_o(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),ne(t)):(Po(r,e),s())}()}else{for(;u;)u=o(l),l++;Po(r,e),s()}return this},vo.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},vo.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var yo=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:dt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=n.eles.components(),s={},l=0;l0){a.graphSet.push(x);for(l=0;lr.count?0:r.graph},bo=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*i/(f=Math.sqrt(i*i+a*a)),l=u*a/f;else{var u,c=Ao(e,i,a),h=Ao(t,-1*i,-1*a),d=h.x-c.x,p=h.y-c.y,g=d*d+p*p,f=Math.sqrt(g);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/g)*d/f,l=u*p/f}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},No=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},Ao=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},Lo=function(e,t){for(var n=0;n1){var g=t.gravity*h/p,f=t.gravity*d/p;c.offsetX+=g,c.offsetY+=f}}}}},So=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},Oo=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopg&&(h+=p+t.componentSpacing,c=0,d=0,p=0)}}},Ro={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Bo(e){this.options=W({},Ro,e)}Bo.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=dt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},h=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},d=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=p)l=d,u=p;else if(null!=d&&null==p)l=d,u=Math.ceil(o/l);else if(null==d&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var g=c(),f=h();(g-1)*f>=o?c(g-1):(f-1)*g>=o&&h(f-1)}else for(;u*l=o?h(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(S=0,k++)},M={},O=0;O(r=Tt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=_t(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),_=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w<_.length;w++){var T=_[w],D=s.arrowShapes[n.pstyle(T.name+"-arrow-shape").value],C=n.pstyle("width").pfValue;if(D.roughCollide(e,t,E,T.angle,{x:T.x,y:T.y},C,d)&&D.collide(e,t,E,T.angle,{x:T.x,y:T.y},C,d))return v(n),!0}h&&u.length>0&&(y(m),y(b))}function b(e,t,n){return Me(e,t,n)}function x(n,r){var i,a=n._private,o=g;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),h=b(a.rscratch,"labelAngle",r),d=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,f=s.x1-o-d,y=s.x2+o-d,m=s.y1-o-p,x=s.y2+o-p;if(h){var w=Math.cos(h),E=Math.sin(h),_=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},T=_(f,m),D=_(f,x),C=_(y,m),N=_(y,x),A=[T.x+d,T.y+p,C.x+d,C.y+p,N.x+d,N.y+p,D.x+d,D.y+p];if(Dt(e,t,A))return v(n),!0}else if(mt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),h=Math.max(t,r),d=dt({x1:e=l,y1:t=c,x2:n=u,y2:r=h}),p=0;p0?Math.max(e-t,0):Math.min(e+t,0)},N=C(T,E),A=C(D,_),L=!1;"auto"===v?f=Math.abs(N)>Math.abs(A)?i:r:v===l||v===s?(f=r,L=!0):v!==a&&v!==o||(f=i,L=!0);var k,S=f===r,I=S?A:N,M=S?D:T,O=at(M),P=!1;(L&&(m||x)||!(v===s&&M<0||v===l&&M>0||v===a&&M>0||v===o&&M<0)||(I=(O*=-1)*Math.abs(I),P=!0),m)?k=(b<0?1+b:b)*I:k=(b<0?I:0)+b*O;var R=function(e){return Math.abs(e)=Math.abs(I)},B=R(k),F=R(Math.abs(I)-Math.abs(k));if((B||F)&&!P)if(S){var z=Math.abs(M)<=h/2,G=Math.abs(T)<=d/2;if(z){var Y=(u.x1+u.x2)/2,X=u.y1,V=u.y2;n.segpts=[Y,X,Y,V]}else if(G){var U=(u.y1+u.y2)/2,j=u.x1,q=u.x2;n.segpts=[j,U,q,U]}else n.segpts=[u.x1,u.y2]}else{var H=Math.abs(M)<=c/2,W=Math.abs(D)<=p/2;if(H){var $=(u.y1+u.y2)/2,K=u.x1,Z=u.x2;n.segpts=[K,$,Z,$]}else if(W){var Q=(u.x1+u.x2)/2,J=u.y1,ee=u.y2;n.segpts=[Q,J,Q,ee]}else n.segpts=[u.x2,u.y1]}else if(S){var te=u.y1+k+(g?h/2*O:0),ne=u.x1,re=u.x2;n.segpts=[ne,te,re,te]}else{var ie=u.x1+k+(g?c/2*O:0),ae=u.y1,oe=u.y2;n.segpts=[ie,ae,ie,oe]}},Zo.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=!I(n.startX)||!I(n.startY),d=!I(n.arrowStartX)||!I(n.arrowStartY),p=!I(n.endX)||!I(n.endY),g=!I(n.arrowEndX)||!I(n.arrowEndY),f=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),v=ot({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),y=vd.poolIndex()){var p=h;h=d,d=p}var g=s.srcPos=h.position(),f=s.tgtPos=d.position(),v=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),m=s.tgtW=d.outerWidth(),b=s.tgtH=d.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(h)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(d)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var E=0;E0){var X=u,V=st(X,nt(t)),U=st(X,nt(Y)),j=V;if(U2)st(X,{x:Y[2],y:Y[3]})0){var ie=c,ae=st(ie,nt(t)),oe=st(ie,nt(re)),se=ae;if(oe2)st(ie,{x:re[2],y:re[3]})=u||m){c={cp:f,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-d)/x.length,E=x.t1-x.t0,_=s?x.t0+E*w:x.t1-E*w;_=ht(0,_,1),t=ct(b.p0,b.p1,b.p2,_),i=function(e,t,n,r){var i=ht(0,r-.001,1),a=ht(0,r+.001,1),o=ct(e,t,n,i),s=ct(e,t,n,a);return is(o,s)}(b.p0,b.p1,b.p2,_);break;case"straight":case"segments":case"haystack":for(var T,D,C,N,A=0,L=r.allpts.length,k=0;k+3=u));k+=2);var S=(u-D)/T;S=ht(0,S,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=ot(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(C,N,S),i=is(C,N)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},ns.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},ns.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Me(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;Oe(n.rstyle,"labelWidth",t,h),Oe(n.rscratch,"labelWidth",t,h),Oe(n.rstyle,"labelHeight",t,d),Oe(n.rscratch,"labelHeight",t,d),Oe(n.rscratch,"labelLineHeight",t,c)},ns.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Oe(n.rscratch,e,t,r),r):Me(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],p=/[\s\u200b]+/,g=h?"":" ",f=0;fc){for(var b=v.split(p),x="",w=0;wT)break;D+=i[N],N===i.length-1&&(C=!0)}return C||(D+="\u2026"),D}return i},ns.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},ns.calculateLabelDimensions=function(e,t){var n=de(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!u){u=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=u.getContext("2d");var h=u.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}c.font="".concat(a," ").concat(l," ").concat(o,"px ").concat(s);for(var d=0,p=0,g=t.split("\n"),f=0;f1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var C=r(t);v&&(e.hoverData.tapholdCancelled=!0);a=!0,n(f,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var N=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),g[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var A={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};m?m.emit(A):o.emit(A),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&f===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=f,f&&f.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(a=!0,o.panningEnabled()&&o.userPanningEnabled()){var L;if(e.hoverData.justStartedPan){var k=e.hoverData.mdownPos;L={x:(c[0]-k[0])*s,y:(c[1]-k[1])*s},e.hoverData.justStartedPan=!1}else L={x:b[0]*s,y:b[1]*s};o.panBy(L),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=g[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||f==y||(y&&n(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),f&&n(f,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=f),m)if(v){if(o.boxSelectionEnabled()&&C)m&&m.grabbed()&&(h(x),m.emit("freeon"),x.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),x.emit("dragfree"))),N();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var S=!e.dragData.didDrag;S&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||l(x,{inDragLayer:!0});var M={x:0,y:0};if(I(b[0])&&I(b[1])&&(M.x+=b[0],M.y+=b[1],S)){var O=e.hoverData.dragDelta;O&&I(O[0])&&I(O[1])&&(M.x+=O[0],M.y+=O[1])}e.hoverData.draggingEles=!0,x.silentShift(M).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();a=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!C&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){i(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,g[4]=0,e.data.bgActivePosistion=nt(d),e.redrawHint("select",!0),e.redraw())}}else N();m&&m.pannable()&&m.active()&&m.unactivate()}return g[2]=c[0],g[3]=c[1],a?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(window,"mouseup",(function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,d=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):a.emit(p),!e.hoverData.cxtDragged){var g={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(g):a.emit(g)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(l,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(n(c,["click","tap","vclick"],i,{x:o[0],y:o[1]}),b=!1,i.timeStamp-x<=a.multiClickDebounceTime()?(m&&clearTimeout(m),b=!0,x=null,n(c,["dblclick","dbltap","vdblclick"],i,{x:o[0],y:o[1]})):(m=setTimeout((function(){b||n(c,["oneclick","onetap","voneclick"],i,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),x=i.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(a.$(t).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||d?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):d||(a.$(t).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var f=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),f.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||d||a.$(t).unmerge(f).unselect(),f.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();h(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}}),!1);var E,_,T,D,C,N,A,L,k,S,M,O,P,R=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",R,!0),e.registerBinding(window,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||R(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var B,F,z,G,Y,X,V,U=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},j=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",B=function(t){if(e.hasTouchStarted=!0,w(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var s=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=s[0],i[1]=s[1]}if(t.touches[1]){s=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=s[0],i[3]=s[1]}if(t.touches[2]){s=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=s[0],i[5]=s[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,h(e.dragData.touchDragEles);var u=e.findContainerClientCoords();k=u[0],S=u[1],M=u[2],O=u[3],E=t.touches[0].clientX-k,_=t.touches[0].clientY-S,T=t.touches[1].clientX-k,D=t.touches[1].clientY-S,P=0<=E&&E<=M&&0<=T&&T<=M&&0<=_&&_<=O&&0<=D&&D<=O;var d=r.pan(),g=r.zoom();C=U(E,_,T,D),N=j(E,_,T,D),L=[((A=[(E+T)/2,(_+D)/2])[0]-d.x)/g,(A[1]-d.y)/g];if(N<4e4&&!t.touches[2]){var f=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return f&&f.isNode()?(f.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=f):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):r.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])r.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=r.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),l(x,{addToList:b})):c(m,{addToList:b}),o(m);var I=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(I("grabon")),x?x.forEach((function(e){e.emit(I("grab"))})):m.emit(I("grab"))}n(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:s[0],y:s[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var R=e.touchData.startPosition=[],B=0;B=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-k,A=t.touches[0].clientY-S,M=t.touches[1].clientX-k,O=t.touches[1].clientY-S,R=j(x,A,M,O);if(R/N>=2.25||R>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var B={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(B),e.touchData.start=null):o.emit(B)}}if(r&&e.touchData.cxt){B={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(B):o.emit(B),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var F=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&F===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=F,F&&F.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var z=0;z0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",z=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",G=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(r.touches[0]){var d=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);u[0]=d[0],u[1]=d[1]}if(r.touches[1]){d=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);u[2]=d[0],u[3]=d[1]}if(r.touches[2]){d=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);u[4]=d[0],u[5]=d[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:r,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:r,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var g=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:u[0],y:u[1]}});g.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),g.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var f=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;h(f),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),f.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),f.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);n(y,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:u[0],y:u[1]}),Y=!1,r.timeStamp-V<=s.multiClickDebounceTime()?(X&&clearTimeout(X),Y=!0,V=null,n(i,["dbltap","vdblclick"],r,{x:u[0],y:u[1]})):(X=setTimeout((function(){Y||n(i,["onetap","voneclick"],r,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),V=r.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var A=[u[0],u[1]],L=Math.pow(A[0]-e,2)+Math.pow(A[1]-t,2),k=1;k0)return f[0]}return null},d=Object.keys(c),p=0;p0?l:xt(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Ft(r,i),l=2*s;if(Ct(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Ct(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Dt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Lt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Lt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},ds.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Pt(3,0)),this.generateRoundPolygon("round-triangle",Pt(3,0)),this.generatePolygon("rectangle",Pt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Pt(5,0)),this.generateRoundPolygon("round-pentagon",Pt(5,0)),this.generatePolygon("hexagon",Pt(6,0)),this.generateRoundPolygon("round-hexagon",Pt(6,0)),this.generatePolygon("heptagon",Pt(7,0)),this.generateRoundPolygon("round-heptagon",Pt(7,0)),this.generatePolygon("octagon",Pt(8,0)),this.generateRoundPolygon("round-octagon",Pt(8,0));var r=new Array(20),i=Bt(5,0),a=Bt(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*f)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*ys)break;var v=e.deq(t,h,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())}),i(t))}}},bs=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xe;f(this,e),this.idsByKey=new Pe,this.keyForId=new Pe,this.cachesByLvl=new Pe,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return y(e,[{key:"getIdsFor",value:function(e){null==e&&_e("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Be,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new Pe,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),xs={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ws=ke({getKey:null,doesEleInvalidateKey:xe,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:be,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Es=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=ws(t);W(n,r),n.lookup=new bs(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},_s=Es.prototype;_s.reasons=xs,_s.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},_s.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},_s.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new c.default((function(e,t){return t.reqs-e.reqs}))},_s.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},_s.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(it(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p,g=l.get(e,r);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||h>1024)return null;var f=a.getTextureQueue(p),v=f[f.length-2],y=function(){return a.recycleTexture(p,h)||a.addTexture(p,h)};v||(v=f[f.length-1]),v||(v=y()),v.width-v.usedWidthr;N--)D=a.getElement(e,t,n,N,xs.downscale);C()}else{var A;if(!x&&!w&&!E)for(var L=r-1;L>=-4;L--){var k=l.get(e,L);if(k){A=k;break}}if(b(A))return a.queueElement(e,r),A;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return g={x:v.usedWidth,texture:v,level:r,scale:u,width:h,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(h+8),v.eleCaches.push(g),l.set(e,r,g),a.checkTextureFullness(v),g},_s.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},_s.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Se(t,e):e.fullnessChecks++},_s.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Se(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Ie(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Se(r,a),n.push(a),a}},_s.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},_s.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=a.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var h=t.getBoundingBox(u);t.getElement(u,h,e,s.level,xs.dequeue)}}return i},_s.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=me,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},_s.onDequeue=function(e){this.onDequeues.push(e)},_s.offDequeue=function(e){Se(this.onDequeues,e)},_s.setupDequeueing=ms({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Se(c,o)}}();var h=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=dt();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var d=null,p=e.length/1,g=!a,f=0;f=p||!bt(d.bb,v.boundingBox()))&&!(d=h({insert:!0,after:d})))return null;s||g?r.queueLayer(d,v):r.drawEleInLayer(d,v,n,t),d.eles.push(v),m[n]=d}}return s||(g?null:c)},Ds.getEleLevelForLayerLevel=function(e,t){return e},Ds.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,true),i.setImgSmoothing(a,!0))},Ds.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Ds.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Ds.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=re(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Ds.invalidateLayer=function(e){if(this.lastInvalidationTime=re(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Se(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,f=u*c,v=u*c,y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f;"straight-triangle"===h?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=g,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")},m=function(){i&&o.drawEdgeOverlay(e,t)},b=function(){i&&o.drawEdgeUnderlay(e,t)},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var E="yes"===t.pstyle("ghost").value;if(E){var _=t.pstyle("ghost-offset-x").pfValue,T=t.pstyle("ghost-offset-y").pfValue,D=t.pstyle("ghost-opacity").value,C=f*D;e.translate(_,T),y(C),x(C),e.translate(-_,-T)}b(),y(),x(),m(),w(),n&&e.translate(l.x1,l.y1)}}},Vs=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Xs.drawEdgeOverlay=Vs("overlay"),Xs.drawEdgeUnderlay=Vs("underlay"),Xs.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+35&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill()}js.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(it(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,g=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,g,a),t.isEdge()&&(o.drawText(e,t,"source",g,a),o.drawText(e,t,"target",g,a))):o.drawText(e,t,i,g,a),n&&e.translate(p.x1,p.y1)},js.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},js.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Me(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},js.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=Me(o,"labelX",n),h=Me(o,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(c)&&!isNaN(h)){this.setupTextStyle(e,t,i);var p,g=n?n+"-":"",f=Me(o,"labelWidth",n),v=Me(o,"labelHeight",n),y=t.pstyle(g+"text-margin-x").pfValue,m=t.pstyle(g+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,h+=m,0!==(p=r?this.getTextAngle(t,n):0)&&(l=c,u=h,e.translate(l,u),e.rotate(p),c=0,h=0),w){case"top":break;case"center":h+=v/2;break;case"bottom":h+=v}var E=t.pstyle("text-background-opacity").value,_=t.pstyle("text-border-opacity").value,T=t.pstyle("text-border-width").pfValue,D=t.pstyle("text-background-padding").pfValue;if(E>0||T>0&&_>0){var C=c-D;switch(x){case"left":C-=f;break;case"center":C-=f/2}var N=h-v-D,A=f+2*D,L=v+2*D;if(E>0){var k=e.fillStyle,S=t.pstyle("text-background-color").value;e.fillStyle="rgba("+S[0]+","+S[1]+","+S[2]+","+E*s+")";var I=t.pstyle("text-background-shape").strValue;0===I.indexOf("round")?qs(e,C,N,A,L,2):e.fillRect(C,N,A,L),e.fillStyle=k}if(T>0&&_>0){var M=e.strokeStyle,O=e.lineWidth,P=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+_*s+")",e.lineWidth=T,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=T/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(C,N,A,L),"double"===R){var B=T/2;e.strokeRect(C+B,N+B,A-2*B,L-2*B)}e.setLineDash&&e.setLineDash([]),e.lineWidth=O,e.strokeStyle=M}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var z=Me(o,"labelWrapCachedLines",n),G=Me(o,"labelLineHeight",n),Y=f/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===x?"left"===X?c+=-f:"center"===X&&(c+=-Y):"center"===x?"left"===X?c+=-Y:"right"===X&&(c+=Y):"right"===x&&("center"===X?c+=Y:"right"===X&&(c+=f))),w){case"top":case"center":case"bottom":h-=(z.length-1)*G}for(var V=0;V0&&e.strokeText(z[V],c,h),e.fillText(z[V],c,h),h+=G}else F>0&&e.strokeText(d,c,h),e.fillText(d,c,h);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var Hs={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,h=t.position();if(I(h.x)&&I(h.y)&&(!s||t.visible())){var d,p,g=s?t.effectiveOpacity():1,f=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,x=new Array(b.length),w=new Array(b.length),E=0,_=0;_0&&void 0!==arguments[0]?arguments[0]:L;l.eleFillStyle(e,t,n)},P=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;l.colorStrokeStyle(e,k[0],k[1],k[2],t)},R=t.pstyle("shape").strValue,B=t.pstyle("shape-polygon-points").pfValue;if(f){e.translate(h.x,h.y);var F=l.nodePathCache=l.nodePathCache||[],z=pe("polygon"===R?R+","+B.join(","):R,""+i,""+r),G=F[z];null!=G?(d=G,v=!0,c.pathCache=d):(d=new Path2D,F[z]=c.pathCache=d)}var Y=function(){if(!v){var n=h;f&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i)}f?e.fill(d):e.fill()},X=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(f||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i)))},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,n=(N>0?N:-N)*t,r=N>0?0:255;0!==N&&(l.colorFillStyle(e,r,r,r,n),f?e.fill(d):e.fill())},j=function(){if(A>0){if(e.lineWidth=A,e.lineCap="butt",e.setLineDash)switch(S){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(f?e.stroke(d):e.stroke(),"double"===S){e.lineWidth=A/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(d):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},q=function(){o&&l.drawNodeOverlay(e,t,h,r,i)},H=function(){o&&l.drawNodeUnderlay(e,t,h,r,i)},W=function(){l.drawElementText(e,t,null,a)},$="yes"===t.pstyle("ghost").value;if($){var K=t.pstyle("ghost-offset-x").pfValue,Z=t.pstyle("ghost-offset-y").pfValue,Q=t.pstyle("ghost-opacity").value,J=Q*g;e.translate(K,Z),O(Q*L),Y(),X(J,!0),P(Q*M),j(),V(0!==N||0!==A),X(J,!1),U(J),e.translate(-K,-Z)}f&&e.translate(-h.x,-h.y),H(),f&&e.translate(h.x,h.y),O(),Y(),X(g,!0),P(),j(),V(0!==N||0!==A),X(g,!1),U(),f&&e.translate(-h.x,-h.y),W(),q(),n&&e.translate(p.x1,p.y1)}}},Ws=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,a){if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,u=n.pstyle("".concat(e,"-shape")).value;if(s>0){if(r=r||n.position(),null==i||null==a){var c=n.padding();i=n.width()+2*c,a=n.height()+2*c}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o),t.fill()}}}};Hs.drawNodeOverlay=Ws("overlay"),Hs.drawNodeUnderlay=Ws("underlay"),Hs.hasPie=function(e){return(e=e[0])._private.hasPie},Hs.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var d=1;d<=i.pieBackgroundN;d++){var p=t.pstyle("pie-"+d+"-background-size").value,g=t.pstyle("pie-"+d+"-background-color").value,f=t.pstyle("pie-"+d+"-background-opacity").value*n,v=p/100;v+h>1&&(v=1-h);var y=1.5*Math.PI+2*Math.PI*h,m=y+2*Math.PI*v;0===p||h>=1||h+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],f),e.fill(),h+=v)}};var $s={};$s.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},$s.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!h&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},_={zoom:b,pan:{x:w.x,y:w.y}},T=o.prevViewport;void 0===T||_.zoom!==T.zoom||_.pan.x!==T.pan.x||_.pan.y!==T.pan.y||f&&!g||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var D=o.getCachedZSortedEles();function C(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function N(e,r){var s,l,c,h;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,h=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,h=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?C(e,0,0,c,h):t||void 0!==r&&!r||e.clearRect(0,0,c,h),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(h||(o.textureDrawLastFrame=!1),h){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var A=o.data.bufferContexts[o.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(_=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-_.pan.x)/_.zoom,y:(0-_.pan.y)/_.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var L=u.contexts[o.NODE],k=o.textureCache.texture;_=o.textureCache.viewport;L.setTransform(1,0,0,1,0,0),d?C(L,0,0,_.width,_.height):L.clearRect(0,0,_.width,_.height);var S=m.core("outside-texture-bg-color").value,I=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(L,S[0],S[1],S[2],I),L.fillRect(0,0,_.width,_.height);b=l.zoom();N(L,!1),L.clearRect(_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s),L.drawImage(k,_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var M=l.extent(),O=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),P=o.hideEdgesOnViewport&&O,R=[];if(R[o.NODE]=!c[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,R[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),R[o.DRAG]=!c[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,R[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||R[o.NODE]){var B=d&&!R[o.NODE]&&1!==p;N(L=t||(B?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),d&&!B?"motionBlur":void 0),P?o.drawCachedNodes(L,D.nondrag,s,M):o.drawLayeredElements(L,D.nondrag,s,M),o.debug&&o.drawDebugPoints(L,D.nondrag),n||d||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||R[o.DRAG])){B=d&&!R[o.DRAG]&&1!==p;N(L=t||(B?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),d&&!B?"motionBlur":void 0),P?o.drawCachedNodes(L,D.drag,s,M):o.drawCachedElements(L,D.drag,s,M),o.debug&&o.drawDebugPoints(L,D.drag),n||d||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(N(L=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var F=m.core("selection-box-border-width").value/b;L.lineWidth=F,L.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",L.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),F>0&&(L.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",L.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var z=u.bgActivePosistion;L.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",L.beginPath(),L.arc(z.x,z.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),L.fill()}var G=o.lastRedrawTime;if(o.showFps&&G){G=Math.round(G);var Y=Math.round(1e3/G);L.setTransform(1,0,0,1,0,0),L.fillStyle="rgba(255, 0, 0, 0.75)",L.strokeStyle="rgba(255, 0, 0, 0.75)",L.lineWidth=1,L.fillText("1 frame = "+G+" ms = "+Y+" fps",0,20);L.strokeRect(0,30,250,20),L.fillRect(0,30,250*Math.min(Y/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(d&&1!==p){var X=u.contexts[o.NODE],V=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],U=u.contexts[o.DRAG],j=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],q=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):C(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||R[o.NODE])&&(q(X,V,R[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||R[o.DRAG])&&(q(U,j,R[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=_,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!h,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Ks={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var g=t.pan(),f={x:g.x*l,y:g.y*l};l*=t.zoom(),d.translate(f.x,f.y),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(-f.x,-f.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},rl.png=function(e){return al(e,this.bufferCanvasImage(e),"image/png")},rl.jpg=function(e){return al(e,this.bufferCanvasImage(e),"image/jpeg")};var ol={nodeShapeImpl:function(e,t,n,r,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},sl=ul,ll=ul.prototype;function ul(e){var t=this;t.data={canvases:new Array(ll.CANVAS_LAYERS),contexts:new Array(ll.CANVAS_LAYERS),canvasNeedsRedraw:new Array(ll.CANVAS_LAYERS),bufferCanvases:new Array(ll.BUFFER_COUNT),bufferContexts:new Array(ll.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",r="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=r,i.position="relative",i.zIndex="0",i.overflow="hidden";var a=e.cy.container();a.appendChild(t.data.canvasContainer),a.style[n]=r;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};E&&E.userAgent.match(/msie|trident|edge/i)&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var s=0;s{e.exports=n(22894)},22894:function(e,t){var n,r,i;(function(){var a,o,s,l,u,c,h,d,p,g,f,v,y,m,b;s=Math.floor,g=Math.min,o=function(e,t){return et?1:0},p=function(e,t,n,r,i){var a;if(null==n&&(n=0),null==i&&(i=o),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],r=0,i=a.length;rf;0<=f?++c:--c)v.push(u(e,n));return v},m=function(e,t,n,r){var i,a,s;for(null==r&&(r=o),i=e[n];n>t&&r(i,a=e[s=n-1>>1])<0;)e[n]=a,n=s;return e[n]=i},b=function(e,t,n){var r,i,a,s,l;for(null==n&&(n=o),i=e.length,l=t,a=e[t],r=2*t+1;rt&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-n)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=u},function(e,t,n){"use strict";function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),l=n(1),u=n(13),c=n(12),h=n(11);function d(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in d.prototype=Object.create(r.prototype),r)d[p]=r[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(e,t,n){if(null==t&&null==n){var r=e;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i)},d.prototype.remove=function(e){var t=e;if(e instanceof s){if(null==t)throw"Node is null!";if(null==t.owner||t.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var n=t.edges.slice(),r=n.length,i=0;i-1&&c>-1))throw"Source and/or target doesn't know this edge!";if(a.source.edges.splice(u,1),a.target!=a.source&&a.target.edges.splice(c,1),-1==(o=a.source.owner.getEdges().indexOf(a)))throw"Not in owner's edge list!";a.source.owner.getEdges().splice(o,1)}},d.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;l(e=u.getTop())&&(r=e),a>(t=u.getLeft())&&(a=t)}return r==i.MAX_VALUE?null:(n=null!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new c(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,c=i.MAX_VALUE,h=-i.MAX_VALUE,d=this.nodes,p=d.length,g=0;g(t=f.getLeft())&&(s=t),l<(n=f.getRight())&&(l=n),c>(r=f.getTop())&&(c=r),h<(a=f.getBottom())&&(h=a)}var v=new u(s,c,l-s,h-c);s==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),o=null!=d[0].getParent().paddingLeft?d[0].getParent().paddingLeft:this.margin,this.left=v.x-o,this.right=v.x+v.width+o,this.top=v.y-o,this.bottom=v.y+v.height+o},d.calculateBounds=function(e){for(var t,n,r,a,o=i.MAX_VALUE,s=-i.MAX_VALUE,l=i.MAX_VALUE,c=-i.MAX_VALUE,h=e.length,d=0;d(t=p.getLeft())&&(o=t),s<(n=p.getRight())&&(s=n),l>(r=p.getTop())&&(l=r),c<(a=p.getBottom())&&(c=a)}return new u(o,l,s-o,c-l)},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r=this.nodes.length){var l=0;i.forEach((function(t){t.owner==e&&l++})),l==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},e.exports=d},function(e,t,n){"use strict";var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,n=e;var a=(r=t).getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw"Graph not in this graph mgr";if(t!=this.rootGraph&&(null==t.parent||t.parent.graphManager!=this))throw"Invalid parent node!";for(var n,a=[],o=(a=a.concat(t.getEdges())).length,s=0;s=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]o)return n[0]=r,n[1]=l,n[2]=a,n[3]=b,!1;if(ia)return n[0]=s,n[1]=i,n[2]=y,n[3]=o,!1;if(ra?(n[0]=c,n[1]=h,_=!0):(n[0]=u,n[1]=l,_=!0):D===N&&(r>a?(n[0]=s,n[1]=l,_=!0):(n[0]=d,n[1]=h,_=!0)),-C===N?a>r?(n[2]=m,n[3]=b,T=!0):(n[2]=y,n[3]=v,T=!0):C===N&&(a>r?(n[2]=f,n[3]=v,T=!0):(n[2]=x,n[3]=b,T=!0)),_&&T)return!1;if(r>a?i>o?(A=this.getCardinalDirection(D,N,4),L=this.getCardinalDirection(C,N,2)):(A=this.getCardinalDirection(-D,N,3),L=this.getCardinalDirection(-C,N,1)):i>o?(A=this.getCardinalDirection(-D,N,1),L=this.getCardinalDirection(-C,N,3)):(A=this.getCardinalDirection(D,N,2),L=this.getCardinalDirection(C,N,4)),!_)switch(A){case 1:S=l,k=r+-g/N,n[0]=k,n[1]=S;break;case 2:k=d,S=i+p*N,n[0]=k,n[1]=S;break;case 3:S=h,k=r+g/N,n[0]=k,n[1]=S;break;case 4:k=c,S=i+-p*N,n[0]=k,n[1]=S}if(!T)switch(L){case 1:M=v,I=a+-E/N,n[2]=I,n[3]=M;break;case 2:I=x,M=o+w*N,n[2]=I,n[3]=M;break;case 3:M=b,I=a+E/N,n[2]=I,n[3]=M;break;case 4:I=m,M=o+-w*N,n[2]=I,n[3]=M}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a,o,s,l,u,c,h,d=e.x,p=e.y,g=t.x,f=t.y,v=n.x,y=n.y,m=i.x,b=i.y;return 0==(h=(a=f-p)*(l=v-m)-(o=b-y)*(s=d-g))?null:new r((s*(c=m*y-v*b)-l*(u=g*p-d*f))/h,(o*u-a*c)/h)},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){"use strict";function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n0&&t;){for(s.push(u[0]);s.length>0&&t;){var c=s[0];s.splice(0,1),o.add(c);var h=c.getEdges();for(a=0;a-1&&u.splice(f,1)}o=new Set,l=new Map}else e=[]}return e},d.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i0){for(var i=this.edgeToDummyNodes.get(n),a=0;a=0&&t.splice(h,1),c.getNeighborsList().forEach((function(e){if(n.indexOf(e)<0){var t=r.get(e)-1;1==t&&l.push(e),r.set(e,t)}}))}n=n.concat(l),1!=t.length&&2!=t.length||(i=!0,a=t[0])}return a},d.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=d},function(e,t,n){"use strict";function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){"use strict";var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i},function(e,t,n){"use strict";var r=n(15),i=n(7),a=n(0),o=n(8),s=n(9);function l(){r.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=i.DEFAULT_EDGE_LENGTH,this.springConstant=i.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=i.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,o,s,l=this.getGraphManager().getAllEdges(),u=0;ui.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),a=new Set,e=0;e(l=t.getEstimatedSize()*this.gravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a):(o>(l=t.getEstimatedSize()*this.compoundGravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant)},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement=s.length||u>=s[0].length))for(var c=0;ce}}]),e}();e.exports=a},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;i(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=a,this.gap_penalty=o,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n{var r=n(51789),i=n(80401),a=n(57667),o=n(21327),s=n(81866);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(27040),i=n(14125),a=n(82117),o=n(67518),s=n(54705);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(10852)(n(55639),"Map");e.exports=r},83369:(e,t,n)=>{var r=n(24785),i=n(11285),a=n(96e3),o=n(49916),s=n(95265);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(55639).Symbol;e.exports=r},29932:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n{var r=n(89465),i=n(77813),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var o=e[t];a.call(e,t)&&i(o,n)&&(void 0!==n||t in e)||r(e,t,n)}},18470:(e,t,n)=>{var r=n(77813);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},89465:(e,t,n)=>{var r=n(38777);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},97786:(e,t,n)=>{var r=n(71811),i=n(40327);e.exports=function(e,t){for(var n=0,a=(t=r(t,e)).length;null!=e&&n{var r=n(62705),i=n(89607),a=n(2333),o=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):a(e)}},28458:(e,t,n)=>{var r=n(23560),i=n(15346),a=n(13218),o=n(80346),s=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,c=l.toString,h=u.hasOwnProperty,d=RegExp("^"+c.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!a(e)||i(e))&&(r(e)?d:s).test(o(e))}},10611:(e,t,n)=>{var r=n(34865),i=n(71811),a=n(65776),o=n(13218),s=n(40327);e.exports=function(e,t,n,l){if(!o(e))return e;for(var u=-1,c=(t=i(t,e)).length,h=c-1,d=e;null!=d&&++u{var r=n(62705),i=n(29932),a=n(1469),o=n(33448),s=r?r.prototype:void 0,l=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(a(t))return i(t,e)+"";if(o(t))return l?l.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n}},27561:(e,t,n)=>{var r=n(67990),i=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(i,""):e}},71811:(e,t,n)=>{var r=n(1469),i=n(15403),a=n(55514),o=n(79833);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:a(o(e))}},278:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n{var r=n(55639)["__core-js_shared__"];e.exports=r},38777:(e,t,n)=>{var r=n(10852),i=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();e.exports=i},31957:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},45050:(e,t,n)=>{var r=n(37019);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},10852:(e,t,n)=>{var r=n(28458),i=n(47801);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},89607:(e,t,n)=>{var r=n(62705),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(l){}var i=o.call(e);return r&&(t?e[s]=n:delete e[s]),i}},47801:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},51789:(e,t,n)=>{var r=n(94536);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},80401:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},57667:(e,t,n)=>{var r=n(94536),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(t,e)?t[e]:void 0}},21327:(e,t,n)=>{var r=n(94536),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:i.call(t,e)}},81866:(e,t,n)=>{var r=n(94536);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},65776:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e{var r=n(1469),i=n(33448),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(o.test(e)||!a.test(e)||null!=t&&e in Object(t))}},37019:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},15346:(e,t,n)=>{var r,i=n(14429),a=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!a&&a in e}},27040:e=>{e.exports=function(){this.__data__=[],this.size=0}},14125:(e,t,n)=>{var r=n(18470),i=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():i.call(t,n,1),--this.size,!0)}},82117:(e,t,n)=>{var r=n(18470);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},67518:(e,t,n)=>{var r=n(18470);e.exports=function(e){return r(this.__data__,e)>-1}},54705:(e,t,n)=>{var r=n(18470);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}},24785:(e,t,n)=>{var r=n(1989),i=n(38407),a=n(57071);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(a||i),string:new r}}},11285:(e,t,n)=>{var r=n(45050);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},96e3:(e,t,n)=>{var r=n(45050);e.exports=function(e){return r(this,e).get(e)}},49916:(e,t,n)=>{var r=n(45050);e.exports=function(e){return r(this,e).has(e)}},95265:(e,t,n)=>{var r=n(45050);e.exports=function(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}},24523:(e,t,n)=>{var r=n(88306);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},94536:(e,t,n)=>{var r=n(10852)(Object,"create");e.exports=r},2333:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},55639:(e,t,n)=>{var r=n(31957),i="object"==typeof self&&self&&self.Object===Object&&self,a=r||i||Function("return this")();e.exports=a},55514:(e,t,n)=>{var r=n(24523),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,o=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,(function(e,n,r,i){t.push(r?i.replace(a,"$1"):n||e)})),t}));e.exports=o},40327:(e,t,n)=>{var r=n(33448);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}},80346:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(n){}try{return e+""}catch(n){}}return""}},67990:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},23279:(e,t,n)=>{var r=n(13218),i=n(7771),a=n(14841),o=Math.max,s=Math.min;e.exports=function(e,t,n){var l,u,c,h,d,p,g=0,f=!1,v=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=l,r=u;return l=u=void 0,g=t,h=e.apply(r,n)}function b(e){return g=e,d=setTimeout(w,t),f?m(e):h}function x(e){var n=e-p;return void 0===p||n>=t||n<0||v&&e-g>=c}function w(){var e=i();if(x(e))return E(e);d=setTimeout(w,function(e){var n=t-(e-p);return v?s(n,c-(e-g)):n}(e))}function E(e){return d=void 0,y&&l?m(e):(l=u=void 0,h)}function _(){var e=i(),n=x(e);if(l=arguments,u=this,p=e,n){if(void 0===d)return b(p);if(v)return clearTimeout(d),d=setTimeout(w,t),m(p)}return void 0===d&&(d=setTimeout(w,t)),h}return t=a(t)||0,r(n)&&(f=!!n.leading,c=(v="maxWait"in n)?o(a(n.maxWait)||0,t):c,y="trailing"in n?!!n.trailing:y),_.cancel=function(){void 0!==d&&clearTimeout(d),g=0,l=p=u=d=void 0},_.flush=function(){return void 0===d?h:E(i())},_}},77813:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},27361:(e,t,n)=>{var r=n(97786);e.exports=function(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}},1469:e=>{var t=Array.isArray;e.exports=t},23560:(e,t,n)=>{var r=n(44239),i=n(13218);e.exports=function(e){if(!i(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},13218:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},37005:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},33448:(e,t,n)=>{var r=n(44239),i=n(37005);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},88306:(e,t,n)=>{var r=n(83369);function i(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(i.Cache||r),n}i.Cache=r,e.exports=i},7771:(e,t,n)=>{var r=n(55639);e.exports=function(){return r.Date.now()}},36968:(e,t,n)=>{var r=n(10611);e.exports=function(e,t,n){return null==e?e:r(e,t,n)}},14841:(e,t,n)=>{var r=n(27561),i=n(13218),a=n(33448),o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||l.test(e)?u(e.slice(2),n?2:8):o.test(e)?NaN:+e}},30084:(e,t,n)=>{var r=n(29932),i=n(278),a=n(1469),o=n(33448),s=n(55514),l=n(40327),u=n(79833);e.exports=function(e){return a(e)?r(e,l):o(e)?[e]:i(s(u(e)))}},79833:(e,t,n)=>{var r=n(80531);e.exports=function(e){return null==e?"":r(e)}},12366:(e,t,n)=>{"use strict";n.r(t),n.d(t,{diagram:()=>k});var r=n(74737),i=n(59373),a=n(59058),o=n.n(a),s=n(14607),l=n.n(s),u=n(91619),c=n(12281),h=n(7201),d=(n(30381),n(17967),n(27856),n(70277),n(45625),n(39354),n(91518),function(){var e=function(e,t,n,r){for(n=n||{},r=e.length;r--;n[e[r]]=t);return n},t=[1,4],n=[1,13],r=[1,12],i=[1,15],a=[1,16],o=[1,20],s=[1,19],l=[6,7,8],u=[1,26],c=[1,24],h=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],g=[1,33],f=[1,34],v=[1,6,7,11,13,15,16,19,22],y={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace("Stop NL ");break;case 9:r.getLogger().trace("Stop EOF ");break;case 11:r.getLogger().trace("Stop NL2 ");break;case 12:r.getLogger().trace("Stop EOF2 ");break;case 15:r.getLogger().info("Node: ",a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 16:r.getLogger().trace("Icon: ",a[s]),r.decorateNode({icon:a[s]});break;case 17:case 21:r.decorateNode({class:a[s]});break;case 18:r.getLogger().trace("SPACELIST");break;case 19:r.getLogger().trace("Node: ",a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 20:r.decorateNode({icon:a[s]});break;case 25:r.getLogger().trace("node found ..",a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 26:this.$={id:a[s],descr:a[s],type:r.nodeType.DEFAULT};break;case 27:r.getLogger().trace("node found ..",a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])}}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:n,7:[1,10],9:9,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:n,9:22,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:u,7:c,10:23,11:h},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:c,10:32,11:h},{1:[2,7],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(p,[2,14],{7:g,11:f}),e(v,[2,8]),e(v,[2,9]),e(v,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:g,11:f}),e(v,[2,11]),e(v,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(e,t){if(!t.recoverable){var n=new Error(e);throw n.hash=t,n}this.trace(e)},parse:function(e){var t=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",l=0,u=0,c=2,h=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var f in this.yy)Object.prototype.hasOwnProperty.call(this.yy,f)&&(g.yy[f]=this.yy[f]);p.setInput(e,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var v=p.yylloc;a.push(v);var y=p.options&&p.options.ranges;function m(){var e;return"number"!=typeof(e=r.pop()||p.lex()||h)&&(e instanceof Array&&(e=(r=e).pop()),e=t.symbols_[e]||e),e}"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,x,w,E,_,T,D,C,N={};;){if(x=n[n.length-1],this.defaultActions[x]?w=this.defaultActions[x]:(null==b&&(b=m()),w=o[x]&&o[x][b]),void 0===w||!w.length||!w[0]){var A="";for(_ in C=[],o[x])this.terminals_[_]&&_>c&&C.push("'"+this.terminals_[_]+"'");A=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==h?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(A,{text:p.match,token:this.terminals_[b]||b,line:p.yylineno,loc:v,expected:C})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+b);switch(w[0]){case 1:n.push(b),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),b=null,u=p.yyleng,s=p.yytext,l=p.yylineno,v=p.yylloc;break;case 2:if(T=this.productions_[w[1]][1],N.$=i[i.length-T],N._$={first_line:a[a.length-(T||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(T||1)].first_column,last_column:a[a.length-1].last_column},y&&(N._$.range=[a[a.length-(T||1)].range[0],a[a.length-1].range[1]]),void 0!==(E=this.performAction.apply(N,[s,u,l,g.yy,w[1],i,a].concat(d))))return E;T&&(n=n.slice(0,-1*T*2),i=i.slice(0,-1*T),a=a.slice(0,-1*T)),n.push(this.productions_[w[1]][0]),i.push(N.$),a.push(N._$),D=o[n[n.length-2]][n[n.length-1]],n.push(D);break;case 3:return!0}}return!0}},m={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;at[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(n,i[a])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[r]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,n,r){switch(n){case 0:e.getLogger().trace("Found comment",t.yytext);break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:case 23:this.popState();break;case 5:e.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return e.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace("end icon"),this.popState();break;case 10:return e.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return e.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return e.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return e.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:case 15:case 16:case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:e.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 22:return e.getLogger().trace("description:",t.yytext),"NODE_DESCR";case 24:return this.popState(),e.getLogger().trace("node end ))"),"NODE_DEND";case 25:return this.popState(),e.getLogger().trace("node end )"),"NODE_DEND";case 26:return this.popState(),e.getLogger().trace("node end ...",t.yytext),"NODE_DEND";case 27:case 30:case 31:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 28:case 29:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 32:case 33:return e.getLogger().trace("Long description:",t.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\-\)\{\}]+)/i,/^(?:$)/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR:{rules:[22,23],inclusive:!1},NODE:{rules:[21,24,25,26,27,28,29,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};function b(){this.yy={}}return y.lexer=m,b.prototype=y,y.Parser=b,new b}());d.parser=d;const p=d,g=e=>(0,r.n)(e,(0,r.g)());let f=[],v=0,y={};const m={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},b=(e,t)=>{y[e]=t},x=e=>{switch(e){case m.DEFAULT:return"no-border";case m.RECT:return"rect";case m.ROUNDED_RECT:return"rounded-rect";case m.CIRCLE:return"circle";case m.CLOUD:return"cloud";case m.BANG:return"bang";case m.HEXAGON:return"hexgon";default:return"no-border"}};let w;const E=e=>y[e],_=Object.freeze(Object.defineProperty({__proto__:null,sanitizeText:g,clear:()=>{f=[],v=0,y={}},getMindmap:()=>f.length>0?f[0]:null,addNode:(e,t,n,i)=>{r.l.info("addNode",e,t,n,i);const a=(0,r.g)(),o={id:v++,nodeId:g(t),level:e,descr:g(n),type:i,children:[],width:(0,r.g)().mindmap.maxNodeWidth};switch(o.type){case m.ROUNDED_RECT:case m.RECT:case m.HEXAGON:o.padding=2*a.mindmap.padding;break;default:o.padding=a.mindmap.padding}const s=function(e){for(let t=f.length-1;t>=0;t--)if(f[t].level{switch(r.l.debug("In get type",e,t),e){case"[":return m.RECT;case"(":return")"===t?m.ROUNDED_RECT:m.CLOUD;case"((":return m.CIRCLE;case")":return m.CLOUD;case"))":return m.BANG;case"{{":return m.HEXAGON;default:return m.DEFAULT}},setElementForId:b,decorateNode:e=>{const t=f[f.length-1];e&&e.icon&&(t.icon=g(e.icon)),e&&e.class&&(t.class=g(e.class))},type2Str:x,get parseError(){return w},setErrorHandler:e=>{w=e},getLogger:()=>r.l,getNodeById:e=>f[e],getElementById:E},Symbol.toStringTag,{value:"Module"}));function T(e,t){e.each((function(){var e,n=(0,i.Ys)(this),r=n.text().split(/(\s+|
)/).reverse(),a=[],o=n.attr("y"),s=parseFloat(n.attr("dy")),l=n.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em");for(let i=0;it||"
"===e)&&(a.pop(),l.text(a.join(" ").trim()),a="
"===e?[""]:[e],l=n.append("tspan").attr("x",0).attr("y",o).attr("dy","1.1em").text(e))}))}const D=function(e,t,n,r){const i=n%11,a=e.append("g");t.section=i;let o="section-"+i;i<0&&(o+=" section-root"),a.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+o);const s=a.append("g"),l=a.append("g"),u=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(T,t.width).node().getBBox(),c=r.fontSize.replace?r.fontSize.replace("px",""):r.fontSize;if(t.height=u.height+1.1*c*.5+t.padding,t.width=u.width+2*t.padding,t.icon)if(t.type===m.CIRCLE){t.height+=50,t.width+=50;a.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")")}else{t.width+=50;const e=t.height;t.height=Math.max(e,60);const n=Math.abs(t.height-e);a.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+n/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+(25+t.width/2)+", "+(n/2+t.padding/2)+")")}else l.attr("transform","translate("+t.width/2+", "+t.padding/2+")");switch(t.type){case m.DEFAULT:!function(e,t,n){e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("d",`M0 ${t.height-5} v${10-t.height} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)}(s,t,i);break;case m.ROUNDED_RECT:!function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)}(s,t);break;case m.RECT:!function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("height",t.height).attr("width",t.width)}(s,t);break;case m.CIRCLE:s.attr("transform","translate("+t.width/2+", "+ +t.height/2+")"),function(e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("r",t.width/2)}(s,t);break;case m.CLOUD:!function(e,t){const n=t.width,r=t.height,i=.15*n,a=.25*n,o=.35*n,s=.2*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${.25*n},${-1*n*.1}\n a${o},${o} 1 0,1 ${.4*n},${-1*n*.1}\n a${a},${a} 1 0,1 ${.35*n},${1*n*.2}\n\n a${i},${i} 1 0,1 ${.15*n},${1*r*.35}\n a${s},${s} 1 0,1 ${-1*n*.15},${1*r*.65}\n\n a${a},${i} 1 0,1 ${-1*n*.25},${.15*n}\n a${o},${o} 1 0,1 ${-1*n*.5},0\n a${i},${i} 1 0,1 ${-1*n*.25},${-1*n*.15}\n\n a${i},${i} 1 0,1 ${-1*n*.1},${-1*r*.35}\n a${s},${s} 1 0,1 ${.1*n},${-1*r*.65}\n\n H0 V0 Z`)}(s,t);break;case m.BANG:!function(e,t){const n=t.width,r=t.height,i=.15*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${.25*n},${-1*r*.1}\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},${1*r*.1}\n\n a${i},${i} 1 0,0 ${.15*n},${1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${1*r*.34}\n a${i},${i} 1 0,0 ${-1*n*.15},${1*r*.33}\n\n a${i},${i} 1 0,0 ${-1*n*.25},${.15*r}\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},${-1*r*.15}\n\n a${i},${i} 1 0,0 ${-1*n*.1},${-1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${-1*r*.34}\n a${i},${i} 1 0,0 ${.1*n},${-1*r*.33}\n\n H0 V0 Z`)}(s,t);break;case m.HEXAGON:!function(e,t){const n=t.height,r=n/4,i=t.width-t.padding+2*r;!function(e,t,n,r,i){e.insert("polygon",":first-child").attr("points",r.map((function(e){return e.x+","+e.y})).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+n+")")}(e,i,n,[{x:r,y:0},{x:i-r,y:0},{x:i,y:-n/2},{x:i-r,y:-n},{x:r,y:-n},{x:0,y:-n/2}],t)}(s,t)}return b(t.id,a),t.height},C=function(e){const t=E(e.id),n=e.x||0,r=e.y||0;t.attr("transform","translate("+n+","+r+")")};function N(e,t,n,r){D(e,t,n,r),t.children&&t.children.forEach(((t,i)=>{N(e,t,n<0?i:n,r)}))}function A(e,t,n,r){t.add({group:"nodes",data:{id:e.id,labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach((i=>{A(i,t,n,r+1),t.add({group:"edges",data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:r,section:i.section}})}))}function L(e,t){return new Promise((n=>{const a=(0,i.Ys)("body").append("div").attr("id","cy").attr("style","display:none"),s=o()({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),A(e,s,t,0),s.nodes().forEach((function(e){e.layoutDimensions=()=>{const t=e.data();return{w:t.width,h:t.height}}})),s.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),s.ready((e=>{r.l.info("Ready",e),n(s)}))}))}o().use(l());const k={db:_,renderer:{draw:async(e,t,n,a)=>{const o=(0,r.g)();a.db.clear(),a.parser.parse(e),r.l.debug("Renering info diagram\n"+e);const s=(0,r.g)().securityLevel;let l;"sandbox"===s&&(l=(0,i.Ys)("#i"+t));const u=("sandbox"===s?(0,i.Ys)(l.nodes()[0].contentDocument.body):(0,i.Ys)("body")).select("#"+t);u.append("g");const c=a.db.getMindmap(),h=u.append("g");h.attr("class","mindmap-edges");const d=u.append("g");d.attr("class","mindmap-nodes"),N(d,c,-1,o);const p=await L(c,o);!function(e,t){t.edges().map(((t,n)=>{const i=t.data();if(t[0]._private.bodyBounds){const a=t[0]._private.rscratch;r.l.trace("Edge: ",n,i),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}}))}(h,p),function(e){e.nodes().map(((e,t)=>{const n=e.data();n.x=e.position().x,n.y=e.position().y,C(n);const i=E(n.nodeId);r.l.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",n),i.attr("transform",`translate(${e.position().x-n.width/2}, ${e.position().y-n.height/2})`),i.attr("attr",`apa-${t})`)}))}(p),(0,r.s)(void 0,u,o.mindmap.padding,o.mindmap.useMaxWidth)}},parser:p,styles:e=>`\n .edge {\n stroke-width: 3;\n }\n ${(e=>{let t="";for(let n=0;n{"use strict";n.d(t,{Z:()=>s});var r=n(61691),i=n(71610);const a=e=>{const{r:t,g:n,b:a}=i.Z.parse(e),o=.2126*r.Z.channel.toLinear(t)+.7152*r.Z.channel.toLinear(n)+.0722*r.Z.channel.toLinear(a);return r.Z.lang.round(o)},o=e=>a(e)>=.5,s=e=>!o(e)}}]); \ No newline at end of file diff --git a/docs/assets/js/12366.ba3d5d9a.js.LICENSE.txt b/docs/assets/js/12366.ba3d5d9a.js.LICENSE.txt new file mode 100644 index 000000000..a9f6f1244 --- /dev/null +++ b/docs/assets/js/12366.ba3d5d9a.js.LICENSE.txt @@ -0,0 +1,9 @@ +/*! +Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable +Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) +Licensed under The MIT License (http://opensource.org/licenses/MIT) +*/ + +/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ + +/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ diff --git a/docs/assets/js/125a74bf.d0f30e3e.js b/docs/assets/js/125a74bf.d0f30e3e.js new file mode 100644 index 000000000..23cf7419c --- /dev/null +++ b/docs/assets/js/125a74bf.d0f30e3e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37904],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-1.0.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-1.0.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/basics/events",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/basics/errors"},next:{title:"Casper Contract Schema",permalink:"/docs/basics/casper-contract-schema"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract;\n\n#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64\n}\n\n#[odra::module]\nimpl PartyContract {\n pub fn init(&self) {\n self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n });\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64,\n}\n")),(0,a.kt)("p",null,"To emit an event, we use the ",(0,a.kt)("inlineCode",{parentName:"p"},"emit_event")," function from the ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),", passing the event as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n});\n")),(0,a.kt)("p",null,"To determine all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The registered events will also be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a few functions which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},'use super::{PartyContractHostRef, PartyStarted};\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\n#[test]\nfn test_party() {\n let test_env: HostEnv = odra_test::env();\n let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);\n test_env.emitted_event(\n party_contract.address(),\n &PartyStarted {\n caller: test_env.get_account(0),\n block_time: 0\n }\n );\n // If you do not want to check the exact event, you can use `emitted` function\n test_env.emitted(party_contract.address(), "PartyStarted");\n // You can also check how many events were emitted.\n assert_eq!(test_env.events_count(party_contract.address()), 1);\n}\n')),(0,a.kt)("p",null,"To explore more event testing functions, check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/13066500.d533b27c.js b/docs/assets/js/13066500.d533b27c.js new file mode 100644 index 000000000..33a602a48 --- /dev/null +++ b/docs/assets/js/13066500.d533b27c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53772],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,v=p["".concat(s,".").concat(m)]||p[m]||c[m]||o;return n?a.createElement(v,l(l({ref:t},d),{},{components:n})):a.createElement(v,l({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>u});var a=n(87462),r=(n(67294),n(3905));const o={},l="Module reusing",i={unversionedId:"advanced/using",id:"version-0.5.0/advanced/using",title:"Module reusing",description:"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.",source:"@site/versioned_docs/version-0.5.0/advanced/01-using.md",sourceDirName:"advanced",slug:"/advanced/using",permalink:"/docs/0.5.0/advanced/using",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.5.0/category/advanced"},next:{title:"Delegate",permalink:"/docs/0.5.0/advanced/delegate"}},s={},u=[{value:"Conceptual Overview",id:"conceptual-overview",level:2},{value:"Usage",id:"usage",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"module-reusing"},"Module reusing"),(0,r.kt)("p",null,"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples."),(0,r.kt)("h2",{id:"conceptual-overview"},"Conceptual Overview"),(0,r.kt)("p",null,"By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n value: Variable, // the default namespace would be "value"\n module: Module\n}\n\n#[odra::module]\nstruct Module {\n secret: Variable // the default namespace would be "module_secret"\n}\n')),(0,r.kt)("p",null,"While this isolation often proves useful, there are scenarios where shared storage is beneficial."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null," Odra generates an array of keys, prefixing the storage key of child modules with the parent namespace, like in the example above. But what if you want to reuse the same instance of a module? Add a ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(using)]"),' attribute to a module to override the default behavior. This is information for the module "Do not prefix storage keys for the given module." so effectively, the child and the parent use the same module instance.'),(0,r.kt)("p",null,"Let's illustrate it with a simple example. The example provided below introduces some additional complexity by featuring deeper module nesting."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::Variable;\n\n#[odra::module]\npub struct SharedStorage {\n pub value: Variable\n}\n\n#[odra::module]\npub struct MyStorage {\n pub shared: SharedStorage,\n pub version: Variable\n}\n\n#[odra::module]\npub struct ComposableContract {\n pub shared: SharedStorage,\n #[odra(using = "shared")]\n pub storage: MyStorage\n}\n\n#[odra::module]\nimpl ComposableContract {\n #[odra(init)]\n pub fn init(&mut self, version: u8, value: String) {\n self.storage.version.set(version);\n self.shared.value.set(value);\n }\n\n pub fn get_value(&self) -> String {\n self.shared.value.get_or_default()\n }\n\n pub fn get_value_via_storage(&self) -> String {\n self.storage.shared.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use crate::composer::ComplexContractDeployer;\n\n #[test]\n fn t() {\n let shared_value = "shared_value".to_string();\n let extra_value: u32 = 314;\n let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);\n\n assert_eq!(token.get_value(), shared_value);\n assert_eq!(token.get_value_via_storage(), shared_value);\n assert_eq!(token.get_extra_value(), extra_value);\n }\n}\n')),(0,r.kt)("p",null,"In this example, we've introduced a new module, ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", which nests ",(0,r.kt)("inlineCode",{parentName:"p"},"MyStorage")," and includes an extra value. The ",(0,r.kt)("inlineCode",{parentName:"p"},"ComplexContract")," contains ",(0,r.kt)("inlineCode",{parentName:"p"},"SharedStorage")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels."),(0,r.kt)("p",null,"If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"On the contract level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_shared_value"),"."),(0,r.kt)("li",{parentName:"ol"},"On the ",(0,r.kt)("inlineCode",{parentName:"li"},"MyStorage")," module level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_more_storage_shared_value"),".")),(0,r.kt)("p",null,"This example showcases how you can effectively use the module reusing feature to build intricate and efficient smart contracts."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/13ab0148.1e22ac78.js b/docs/assets/js/13ab0148.1e22ac78.js new file mode 100644 index 000000000..6801e8397 --- /dev/null +++ b/docs/assets/js/13ab0148.1e22ac78.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[20523],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.3.1/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.3.1/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.3.1/",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.3.1/category/getting-started"}},c={image:r(59236).Z},l=[{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean,\npragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open\nsource."),(0,o.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains."),(0,o.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems. We can do it\nby abstracting over core concepts that all the above systems are built around. These are type system,\nstorage, entry points, execution context, and testing environment. We believe it will bring standardization\nto the development of Rust-based smart contracts and enable code reusability we have not yet seen in this\necosystem."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.3.1/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.3.1/getting-started/flipper"},"Flipper example"),"\nto find out how to start your new project with Odra."))}p.isMDXComponent=!0},59236:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/1416c8f4.c1dfbbd3.js b/docs/assets/js/1416c8f4.c1dfbbd3.js new file mode 100644 index 000000000..17a2bb490 --- /dev/null +++ b/docs/assets/js/1416c8f4.c1dfbbd3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[28700],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),d=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=o,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||a;return t?r.createElement(f,l(l({ref:n},u),{},{components:t})):r.createElement(f,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>d});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.7.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.7.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.7.0/tutorials/owned-token",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.7.0/tutorials/erc20"},next:{title:"Access Control",permalink:"/docs/0.7.0/tutorials/access-control"}},s={},d=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],u={toc:d};function c(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow minting tokens but only the module owner."),(0,o.kt)("li",{parentName:"ol"},"The current owner should be able to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use odra::types::{Address, Balance}\n\n...\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.ownable.ensure_ownership(&contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L11")," - A constructor is a great place to init both modules at once. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L14-L16")," - Most of the entrypoints do not need any modification, so we simply delegates them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L52")," - The same we do with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L58-L61")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/14355e8c.7cb7d1ac.js b/docs/assets/js/14355e8c.7cb7d1ac.js new file mode 100644 index 000000000..20d023b67 --- /dev/null +++ b/docs/assets/js/14355e8c.7cb7d1ac.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76693],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(h,s(s({ref:t},d),{},{components:n})):r.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.4.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.4.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.4.0/basics/testing",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.4.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.4.0/basics/errors"}},l={},c=[{value:"Test env",id:"test-env",level:2},{value:"Deployer",id:"deployer",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'use odra::{Variable, List};\n\n#[cfg(test)]\nmod tests {\n use super::DogContract3Deployer;\n\n #[test]\n fn init_test() {\n let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(module)]")," macro created a Deployer code for us, which will deploy the contract on the\nVM:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n')),(0,a.kt)("p",null,"From now on, we can use ",(0,a.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with a macro are available to us:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,a.kt)("h2",{id:"test-env"},"Test env"),(0,a.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/testing.rs"',title:'"examples/src/docs/testing.rs"'},'#[cfg(test)]\nmod tests {\n use super::TestingContractDeployer;\n\n #[test]\n fn test_env() {\n let testing_contract = TestingContractDeployer::init("MyContract".to_string());\n let creator = testing_contract.created_by();\n odra::test_env::set_caller(odra::test_env::get_account(1));\n let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());\n let creator2 = testing_contract2.created_by();\n assert!(creator != creator2);\n }\n}\n')),(0,a.kt)("p",null,"In the code above, we are deploying two instances of the same contract, but we're using ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::test_env::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::contract_env::caller()"),"\nthe function we are calling inside the contract."),(0,a.kt)("p",null,"Each test env comes with a set of functions that will let you write better tests:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_caller(address: Address)")," - you've seen it in action just now"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn token_balance(address: Address) -> Balance")," - it returns the balance of the account associated with the given address"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn advance_block_time_by(seconds: BlockTime)")," - it increases the current value of block_time"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_account(n: usize) -> Address")," - it returns an nth address that was prepared for you by Odra in advance;\nby default, you start with the 0th account"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn assert_exception(err: E, block: F)")," - it executes the ",(0,a.kt)("inlineCode",{parentName:"li"},"block")," code and expects ",(0,a.kt)("inlineCode",{parentName:"li"},"err")," to happen"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_event(address: Address, index: i32) -> Result")," - returns\nthe event emitted by the contract")),(0,a.kt)("p",null,"Again, we'll see those used in the next articles."),(0,a.kt)("h2",{id:"deployer"},"Deployer"),(0,a.kt)("p",null,"You may be wondering what is the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractDeployer")," and where did it come from.\nIt is a piece of code generated automatically for you, thanks to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nIf you used the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," on one of the methods, it will be the constructor of your contract.\nOdra will make sure that it is called only once, so you can use it to initialize your data structures etc."),(0,a.kt)("p",null,"If you do not provide the init method, you can deploy the contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"::default()")," method.\nIn the end, you will get a ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," instance (in our case the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractRef"),") which reimplements all\nthe methods you defined in the contract, but executes them on a blockchain!"),(0,a.kt)("p",null,"To learn more about the ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," contract, visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/cross-calls"},"Cross calls")," article."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We take a look at how Odra handles errors!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/145548d1.2d24085b.js b/docs/assets/js/145548d1.2d24085b.js new file mode 100644 index 000000000..7823cf2d9 --- /dev/null +++ b/docs/assets/js/145548d1.2d24085b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[1615],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=d(n),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return n?a.createElement(w,o(o({ref:t},u),{},{components:n})):a.createElement(w,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.8.1/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.8.1/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.8.1/tutorials/ownable",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.8.1/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.8.1/tutorials/erc20"}},s={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining a constructor,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(events = [OwnershipChanged])]\npub struct Ownable {\n owner: Var>\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basics before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4")," - Firstly, we need to create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module(events = [OwnershipChanged])]")," attribute to it. The ",(0,r.kt)("inlineCode",{parentName:"li"},"events")," attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," is a type that will be defined later."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"...\nuse odra::{Event, OdraError};\n\n...\n\n#[odra::module]\nimpl Ownable {\n pub fn init(&mut self, owner: Address) {\n if self.owner.get_or_default().is_some() {\n self.env().revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(Some(owner));\n \n self.env().emit_event(OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n });\n }\n}\n\n#[derive(OdraError)]\npub enum Error {\n OwnerIsAlreadyInitialized = 1,\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an Odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is a constructor. This matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23-26")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," derive macro is applied to the enum. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L10-L12")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::revert()")," function with an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsAlreadyInitialized")," argument. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - Then we write the owner passed as an argument to the storage. To do so, we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L28-L32")," - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16")," - Finally, call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::emit_event()")," passing the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," instance to the function. Hence, we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),". ")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get_or_default().as_ref() {\n self.env().revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&self.env().caller());\n let current_owner = self.get_owner();\n self.owner.set(Some(*new_owner));\n self.env().emit_event(OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n });\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get_or_default() {\n Some(owner) => owner,\n None => self.env().revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\n#[derive(OdraError)]\npub enum Error {\n NotOwner = 1,\n OwnerIsAlreadyInitialized = 2,\n OwnerIsNotInitialized = 3,\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7,L31")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," reads the current owner and reverts if it does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also, we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum by adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in the ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::caller()")," function. Then we update the state and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L21,L33")," - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),". There is one worth-mentioning subtlety: ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," function returns ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements the ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call the ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function, and the contract does not fail even if the value is not initialized. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"owner")," is of type ",(0,r.kt)("inlineCode",{parentName:"li"},"Option
")," the ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," would return ",(0,r.kt)("inlineCode",{parentName:"li"},"Option>"),", we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get_or_default()")," instead.")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::{Deployer, HostEnv, HostRef};\n\n fn setup() -> (OwnableHostRef, HostEnv, Address) {\n let env: HostEnv = odra_test::env();\n let init_args = OwnableInitArgs {\n owner: env.get_account(0)\n };\n (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))\n }\n\n #[test]\n fn initialization_works() {\n let (ownable, env, owner) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (mut ownable, env, owner) = setup();\n let new_owner = env.get_account(1);\n \n env.set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n\n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (mut ownable, env, _) = setup();\n let new_owner = env.get_account(1);\n ownable.change_ownership(&new_owner);\n \n assert_eq!(\n ownable.try_change_ownership(&new_owner), \n Err(Error::NotOwner.into())\n );\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we have defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, which we call in the first statement of each test. Take a look at the signature: ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (OwnableHostRef, HostEnv, Address)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef")," is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7-L11")," - The starting point of every test is getting an instance of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," by calling ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),". Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," attribute implements a ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer")," for ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableInitArgs")," that we pass as the second argument of the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function. Lastly, the module needs an owner. The easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". We choose the address of first account (which is the default one). "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - It is time to define the first test. As you see, it is a regular Rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16-17")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L19-25")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event to have been emitted. To assert that, let's use ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". To get the env, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"env()")," on the contract, then call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::emitted_event"),". As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L31")," - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L33")," - As mentioned, the default is the 0th account, if you want to change the executor, call the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L46-55")," - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::try_change_ownership()")," instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::change_ownership()"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," provides try_ functions for each contract's entrypoint. The ",(0,r.kt)("inlineCode",{parentName:"li"},"try")," functions return ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraResult")," (an alias for ",(0,r.kt)("inlineCode",{parentName:"li"},"Result"),") instead of panicking and halting the execution. In our case, we expect the contract to revert with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::NotOwner")," error. To compare the error, we use the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::into()")," function, which converts the error into the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," type.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/14eb3368.5911e1e7.js b/docs/assets/js/14eb3368.5911e1e7.js new file mode 100644 index 000000000..36e09d39e --- /dev/null +++ b/docs/assets/js/14eb3368.5911e1e7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[9817],{1310:(e,t,n)=>{n.d(t,{Z:()=>p});var a=n(87462),r=n(67294),i=n(86010),l=n(35281),s=n(53438),c=n(48596),o=n(39960),m=n(95999),d=n(44996);function u(e){return r.createElement("svg",(0,a.Z)({viewBox:"0 0 24 24"},e),r.createElement("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"}))}const h="breadcrumbHomeIcon_YNFT";function b(){const e=(0,d.Z)("/");return r.createElement("li",{className:"breadcrumbs__item"},r.createElement(o.Z,{"aria-label":(0,m.I)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:"breadcrumbs__link",href:e},r.createElement(u,{className:h})))}const v="breadcrumbsContainer_Z_bl";function g(e){let{children:t,href:n,isLast:a}=e;const i="breadcrumbs__link";return a?r.createElement("span",{className:i,itemProp:"name"},t):n?r.createElement(o.Z,{className:i,href:n,itemProp:"item"},r.createElement("span",{itemProp:"name"},t)):r.createElement("span",{className:i},t)}function E(e){let{children:t,active:n,index:l,addMicrodata:s}=e;return r.createElement("li",(0,a.Z)({},s&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},{className:(0,i.Z)("breadcrumbs__item",{"breadcrumbs__item--active":n})}),t,r.createElement("meta",{itemProp:"position",content:String(l+1)}))}function p(){const e=(0,s.s1)(),t=(0,c.Ns)();return e?r.createElement("nav",{className:(0,i.Z)(l.k.docs.docBreadcrumbs,v),"aria-label":(0,m.I)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"})},r.createElement("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList"},t&&r.createElement(b,null),e.map(((t,n)=>{const a=n===e.length-1;return r.createElement(E,{key:n,active:a,index:n,addMicrodata:!!t.href},r.createElement(g,{href:t.href,isLast:a},t.label))})))):null}},34228:(e,t,n)=>{n.r(t),n.d(t,{default:()=>A});var a=n(67294),r=n(1944),i=n(53438),l=n(44996),s=n(86010),c=n(39960),o=n(13919),m=n(95999);const d="cardContainer_fWXF",u="cardTitle_rnsV",h="cardDescription_PWke";function b(e){let{href:t,children:n}=e;return a.createElement(c.Z,{href:t,className:(0,s.Z)("card padding--lg",d)},n)}function v(e){let{href:t,icon:n,title:r,description:i}=e;return a.createElement(b,{href:t},a.createElement("h2",{className:(0,s.Z)("text--truncate",u),title:r},n," ",r),i&&a.createElement("p",{className:(0,s.Z)("text--truncate",h),title:i},i))}function g(e){let{item:t}=e;const n=(0,i.Wl)(t);return n?a.createElement(v,{href:n,icon:"\ud83d\uddc3\ufe0f",title:t.label,description:(0,m.I)({message:"{count} items",id:"theme.docs.DocCard.categoryDescription",description:"The default description for a category card in the generated index about how many items this category includes"},{count:t.items.length})}):null}function E(e){let{item:t}=e;const n=(0,o.Z)(t.href)?"\ud83d\udcc4\ufe0f":"\ud83d\udd17",r=(0,i.xz)(t.docId??void 0);return a.createElement(v,{href:t.href,icon:n,title:t.label,description:r?.description})}function p(e){let{item:t}=e;switch(t.type){case"link":return a.createElement(E,{item:t});case"category":return a.createElement(g,{item:t});default:throw new Error(`unknown item type ${JSON.stringify(t)}`)}}function f(e){let{className:t}=e;const n=(0,i.jA)();return a.createElement(N,{items:n.items,className:t})}function N(e){const{items:t,className:n}=e;if(!t)return a.createElement(f,e);const r=(0,i.MN)(t);return a.createElement("section",{className:(0,s.Z)("row",n)},r.map(((e,t)=>a.createElement("article",{key:t,className:"col col--6 margin-bottom--lg"},a.createElement(p,{item:e})))))}var Z=n(80049),k=n(23120),_=n(44364),L=n(1310),T=n(92503);const x="generatedIndexPage_vN6x",y="list_eTzJ",w="title_kItE";function I(e){let{categoryGeneratedIndex:t}=e;return a.createElement(r.d,{title:t.title,description:t.description,keywords:t.keywords,image:(0,l.Z)(t.image)})}function V(e){let{categoryGeneratedIndex:t}=e;const n=(0,i.jA)();return a.createElement("div",{className:x},a.createElement(k.Z,null),a.createElement(L.Z,null),a.createElement(_.Z,null),a.createElement("header",null,a.createElement(T.Z,{as:"h1",className:w},t.title),t.description&&a.createElement("p",null,t.description)),a.createElement("article",{className:"margin-top--lg"},a.createElement(N,{items:n.items,className:y})),a.createElement("footer",{className:"margin-top--lg"},a.createElement(Z.Z,{previous:t.navigation.previous,next:t.navigation.next})))}function A(e){return a.createElement(a.Fragment,null,a.createElement(I,e),a.createElement(V,e))}},80049:(e,t,n)=>{n.d(t,{Z:()=>s});var a=n(87462),r=n(67294),i=n(95999),l=n(32244);function s(e){const{previous:t,next:n}=e;return r.createElement("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,i.I)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages navigation",description:"The ARIA label for the docs pagination"})},t&&r.createElement(l.Z,(0,a.Z)({},t,{subLabel:r.createElement(i.Z,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc"},"Previous")})),n&&r.createElement(l.Z,(0,a.Z)({},n,{subLabel:r.createElement(i.Z,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc"},"Next"),isNext:!0})))}},44364:(e,t,n)=>{n.d(t,{Z:()=>c});var a=n(67294),r=n(86010),i=n(95999),l=n(35281),s=n(74477);function c(e){let{className:t}=e;const n=(0,s.E)();return n.badge?a.createElement("span",{className:(0,r.Z)(t,l.k.docs.docVersionBadge,"badge badge--secondary")},a.createElement(i.Z,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label}},"Version: {versionLabel}")):null}},23120:(e,t,n)=>{n.d(t,{Z:()=>g});var a=n(67294),r=n(86010),i=n(52263),l=n(39960),s=n(95999),c=n(94104),o=n(35281),m=n(60373),d=n(74477);const u={unreleased:function(e){let{siteTitle:t,versionMetadata:n}=e;return a.createElement(s.Z,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:t,versionLabel:a.createElement("b",null,n.label)}},"This is unreleased documentation for {siteTitle} {versionLabel} version.")},unmaintained:function(e){let{siteTitle:t,versionMetadata:n}=e;return a.createElement(s.Z,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:t,versionLabel:a.createElement("b",null,n.label)}},"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.")}};function h(e){const t=u[e.versionMetadata.banner];return a.createElement(t,e)}function b(e){let{versionLabel:t,to:n,onClick:r}=e;return a.createElement(s.Z,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:t,latestVersionLink:a.createElement("b",null,a.createElement(l.Z,{to:n,onClick:r},a.createElement(s.Z,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label"},"latest version")))}},"For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).")}function v(e){let{className:t,versionMetadata:n}=e;const{siteConfig:{title:l}}=(0,i.Z)(),{pluginId:s}=(0,c.gA)({failfast:!0}),{savePreferredVersionName:d}=(0,m.J)(s),{latestDocSuggestion:u,latestVersionSuggestion:v}=(0,c.Jo)(s),g=u??(E=v).docs.find((e=>e.id===E.mainDocId));var E;return a.createElement("div",{className:(0,r.Z)(t,o.k.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert"},a.createElement("div",null,a.createElement(h,{siteTitle:l,versionMetadata:n})),a.createElement("div",{className:"margin-top--md"},a.createElement(b,{versionLabel:v.label,to:g.path,onClick:()=>d(v.name)})))}function g(e){let{className:t}=e;const n=(0,d.E)();return n.banner?a.createElement(v,{className:t,versionMetadata:n}):null}},92503:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(87462),r=n(67294),i=n(86010),l=n(95999),s=n(86668),c=n(39960);const o="anchorWithStickyNavbar_LWe7",m="anchorWithHideOnScrollNavbar_WYt5";function d(e){let{as:t,id:n,...d}=e;const{navbar:{hideOnScroll:u}}=(0,s.L)();if("h1"===t||!n)return r.createElement(t,(0,a.Z)({},d,{id:void 0}));const h=(0,l.I)({id:"theme.common.headingLinkTitle",message:"Direct link to {heading}",description:"Title for link to heading"},{heading:"string"==typeof d.children?d.children:n});return r.createElement(t,(0,a.Z)({},d,{className:(0,i.Z)("anchor",u?m:o,d.className),id:n}),d.children,r.createElement(c.Z,{className:"hash-link",to:`#${n}`,"aria-label":h,title:h},"\u200b"))}},32244:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(67294),r=n(86010),i=n(39960);function l(e){const{permalink:t,title:n,subLabel:l,isNext:s}=e;return a.createElement(i.Z,{className:(0,r.Z)("pagination-nav__link",s?"pagination-nav__link--next":"pagination-nav__link--prev"),to:t},l&&a.createElement("div",{className:"pagination-nav__sublabel"},l),a.createElement("div",{className:"pagination-nav__label"},n))}}}]); \ No newline at end of file diff --git a/docs/assets/js/1524a02c.4db2e1c4.js b/docs/assets/js/1524a02c.4db2e1c4.js new file mode 100644 index 000000000..f5038102a --- /dev/null +++ b/docs/assets/js/1524a02c.4db2e1c4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[55399],{28289:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.5.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.5.0/"},"next":{"title":"Installation","permalink":"/docs/0.5.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/156a315c.f6984bfd.js b/docs/assets/js/156a315c.f6984bfd.js new file mode 100644 index 000000000..f3b977405 --- /dev/null +++ b/docs/assets/js/156a315c.f6984bfd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95278],{58437:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.8.0/category/backends","navigation":{"previous":{"title":"Storage Layout","permalink":"/docs/0.8.0/advanced/storage-layout"},"next":{"title":"What is a backend?","permalink":"/docs/0.8.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/16691bef.357a29b0.js b/docs/assets/js/16691bef.357a29b0.js new file mode 100644 index 000000000..545ef4a6d --- /dev/null +++ b/docs/assets/js/16691bef.357a29b0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[2536],{96992:e=>{e.exports=JSON.parse('{"title":"Migrations","description":"How to keep your code in sync with the latest version of the Odra Framework.","slug":"/category/migrations","permalink":"/docs/0.8.1/category/migrations","navigation":{"previous":{"title":"Build, Deploy and Read the State of a Contract","permalink":"/docs/0.8.1/tutorials/build-deploy-read"},"next":{"title":"Migration guide to v0.8.0","permalink":"/docs/0.8.1/migrations/to-0.8.0"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/1684519a.a1abee45.js b/docs/assets/js/1684519a.a1abee45.js new file mode 100644 index 000000000..b5080bc6b --- /dev/null +++ b/docs/assets/js/1684519a.a1abee45.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[78381],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>g});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),c=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=c(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(t),g=r,m=u["".concat(p,".").concat(g)]||u[g]||d[g]||i;return t?a.createElement(m,o(o({ref:n},l),{},{components:t})):a.createElement(m,o({ref:n},l))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const i={},o="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.4.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.4.0/advanced/03-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.4.0/advanced/advanced-storage",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.4.0/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.4.0/advanced/attributes"}},p={},c=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],l={toc:c};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Variable"),": A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The Sequence in Odra is a basic module that holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + OdraType\n{\n value: Variable\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/mapping.rs"',title:'"examples/mapping.rs"'},"use odra::{map, types::U256, Mapping, UnwrapOrRevert};\n\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct NestedMapping {\n strings: Mapping>>,\n tokens: Mapping>>\n}\n\n#[odra::module]\nimpl NestedMapping {\n\n ...\n\n pub fn set_token(\n &mut self,\n key1: String,\n key2: u32,\n key3: String,\n token_name: String,\n decimals: u8,\n symbol: String,\n initial_supply: &U256\n ) {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .init(token_name, symbol, decimals, initial_supply);\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let mapping = self.strings.get_instance(&key1).get_instance(&key2);\n mapping.get(&key3).unwrap_or_revert()\n }\n\n pub fn total_supply(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> U256 {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .total_supply()\n }\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers. "),(0,r.kt)("p",{parentName:"admonition"},"Instead of using the ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()"),", which sets the correct namespace for nested modules.")),(0,r.kt)("p",null,"If the terminal value is deeply nested, a long chain of ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()")," calls is required."),(0,r.kt)("p",null,"To keep the codebase consistent, a ",(0,r.kt)("inlineCode",{parentName:"p"},"map!")," macro can be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/mapping.rs"',title:'"examples/mapping.rs"'},"...\n\npub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {\n map!(self.strings[key1][key2][key3] = value);\n}\n\npub fn get_string_macro(\n &self, \n key1: String, \n key2: u32, \n key3: String\n) -> String {\n map!(self.strings[key1][key2][key3])\n}\n\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The terminal value must not be an Odra Module.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Sequence, Mapping};\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n my_sequence: Sequence,\n my_mapping: Mapping>,\n}\n\nimpl AdvancedStorage {\n pub fn get_sequence_current_value(&self) -> u32 {\n self.my_sequence.get_current_value()\n }\n\n pub fn next_sequence_value(&mut self) -> u32 {\n self.my_sequence.next_value()\n }\n\n pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.set(&inner_key, value);\n }\n\n pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.get(&inner_key)\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/16c5018d.6ba1e1a0.js b/docs/assets/js/16c5018d.6ba1e1a0.js new file mode 100644 index 000000000..9693e33c0 --- /dev/null +++ b/docs/assets/js/16c5018d.6ba1e1a0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[34437],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(r),m=a,b=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(b,i(i({ref:t},c),{},{components:r})):n.createElement(b,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.8.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.8.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.8.0/basics/directory-structure",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.8.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.8.0/basics/odra-toml"}},s={},d=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:"src/",id:"src",level:2},{value:"bin/",id:"bin",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],c={toc:d};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 bin/\n| |\u2500\u2500 build_contract.rs\n| \u2514\u2500\u2500 build_schema.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "sample_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "sample_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. For testing purposes, ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-test")," is also\nadded as a dev dependency."),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"bin"},"bin/"),(0,a.kt)("p",null,"This is the folder where scripts that will be used to generate code or schemas live.\nYou don't need to modify those files, they are generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command and\nare used by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra schema")," commands."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/17498f44.7f7ba661.js b/docs/assets/js/17498f44.7f7ba661.js new file mode 100644 index 000000000..8469f1abd --- /dev/null +++ b/docs/assets/js/17498f44.7f7ba661.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[19828],{8173:e=>{e.exports=JSON.parse('{"title":"Migrations","description":"How to keep your code in sync with the latest version of the Odra Framework.","slug":"/category/migrations","permalink":"/docs/next/category/migrations","navigation":{"previous":{"title":"Deploying a Token on Casper Livenet","permalink":"/docs/next/tutorials/deploying-on-casper"},"next":{"title":"Migration guide to v0.8.0","permalink":"/docs/next/migrations/to-0.8.0"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/175a5a59.a325bdf1.js b/docs/assets/js/175a5a59.a325bdf1.js new file mode 100644 index 000000000..653da1a0f --- /dev/null +++ b/docs/assets/js/175a5a59.a325bdf1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63024],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.8.1/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.8.1/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.8.1/backends/casper",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"OdraVM",permalink:"/docs/0.8.1/backends/odra-vm"},next:{title:"Livenet",permalink:"/docs/0.8.1/backends/livenet"}},l={},p=[{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Deploying a contract to Casper network",id:"deploying-a-contract-to-casper-network",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement traits defined by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard"),", thankfully you can derive them using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance,\nyou call ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_balance()"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"deploying-a-contract-to-casper-network"},"Deploying a contract to Casper network"),(0,r.kt)("p",null,"There would be no point in writing a contract if you couldn't deploy it to the blockchain.\nYou can do it in two ways: provided by the Casper itself: using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool\nor using the Odra's Livenet integration."),(0,r.kt)("p",null,"Let's explore the first option to better understand the process."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you wish, you can skip the following section and jump to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/livenet"},"Livenet integration"),".")),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you can pass some arguments to it.\nEvery contract written in Odra expects those arguments to be set:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Additionally, if required by the contract, you can pass constructor arguments."),(0,r.kt)("p",null,"When working with the test env via ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," or when using\n",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/livenet"},"Livenet integration")," this is handled automatically. However, if you rather use\n",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," directly, you have to pass them manually:"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.1/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.1/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.1/odra-casper/test-vm/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/odra-vm"},"OdraVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/177939f6.be774bf0.js b/docs/assets/js/177939f6.be774bf0.js new file mode 100644 index 000000000..c913c62f7 --- /dev/null +++ b/docs/assets/js/177939f6.be774bf0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[60995],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>h});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),c=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),h=n,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return r?a.createElement(m,i(i({ref:t},p),{},{components:r})):a.createElement(m,i({ref:t},p))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:n,i[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=r(87462),n=(r(67294),r(3905));const o={slug:"release-020",title:"Odra 0.2.0 Released",authors:["kubaplas","kpob","zie1ony"],image:"https://github.com/odradev.png"},i=void 0,s={permalink:"/blog/release-020",source:"@site/blog/2022-11-30-release-020/index.md",title:"Odra 0.2.0 Released",description:"We want to introduce you to the very first public release of the Odra Framework proudly!",date:"2022-11-30T00:00:00.000Z",formattedDate:"November 30, 2022",tags:[],readingTime:3.07,hasTruncateMarker:!0,authors:[{name:"Kuba P\u0142askonka",title:"Lead Developer",url:"https://github.com/kubaplas",key:"kubaplas"},{name:"Krzysztof Pobiar\u017cyn",title:"Lead Developer",url:"https://github.com/kpob",key:"kpob"},{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"release-020",title:"Odra 0.2.0 Released",authors:["kubaplas","kpob","zie1ony"],image:"https://github.com/odradev.png"},prevItem:{title:"Zero Knowledge on Casper",permalink:"/blog/casper-zk-risc0"}},l={authorsImageUrls:[void 0,void 0,void 0]},c=[{value:"A bit of history",id:"a-bit-of-history",level:2},{value:"Odra for Casper",id:"odra-for-casper",level:2},{value:"Odra Framework",id:"odra-framework",level:2},{value:"What next",id:"what-next",level:2},{value:"Join us",id:"join-us",level:2}],p={toc:c};function d(e){let{components:t,...o}=e;return(0,n.kt)("wrapper",(0,a.Z)({},p,o,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"We want to introduce you to the very first public release of the Odra Framework proudly!"),(0,n.kt)("h2",{id:"a-bit-of-history"},"A bit of history"),(0,n.kt)("p",null,"More than a year ago Maciej Zieli\u0144ski resigned from the position of Ecosystem Leader at ",(0,n.kt)("a",{parentName:"p",href:"https://casperlabs.io"},"CasperLabs"),".\nAlong with Krzysztof Pobiar\u017cyn and Kuba P\u0142askonka, we formed an engineering team dedicated to smart contracts."),(0,n.kt)("p",null,"Looking at the blockchain ecosystems from the smart contract developer perspective there are two universes.\nThe first one is Solidity, which thrives and is at its best now.\nIt has a ton of well-tested code and security tooling.\nWhenever an EVM-based blockchain pops out it gets populated by forks of DeFi and DAO protocols.\nFascinating network effect emerges - code written for one EVM-based blockchain can be run on every other EVM-based blockchain.\nThe second universe is Rust which compiles to WebAssembly.\nHere developer communities live in the guarded cities of Polkadot, Cosmos, Solana, Casper, and Near.\nThe code written for one platform is not portable.\nThe network effect never had a chance to arise."),(0,n.kt)("p",null,'The main reason why Odra exists is achieving this cross-chain code reusability.\nWe could paraphrase a bit and say:\n"One to bring them all and in the code bind them."'),(0,n.kt)("h2",{id:"odra-for-casper"},"Odra for Casper"),(0,n.kt)("p",null,"The very first blockchain we have integrated with Odra is Casper.\nIn comparison to ",(0,n.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-contract"},"casper-contract")," API, it greatly cuts development time and offers a much lower entry level.\nThe Odra interface is developer friendly and people familiar with Solidity, ",(0,n.kt)("a",{parentName:"p",href:"https://crates.io/crates/ink_lang"},"Ink"),", or ",(0,n.kt)("a",{parentName:"p",href:"https://crates.io/crates/near-sdk"},"Near")," will feel like at home.\nWe hope it will unleash the creativity and bring a whole bunch of products onto Casper."),(0,n.kt)("h2",{id:"odra-framework"},"Odra Framework"),(0,n.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design.\nBuilt by experienced developers, it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel.\nIt's free and open source."),(0,n.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains. "),(0,n.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems.\nWe can do it by abstracting over core concepts that all the above systems are built around.\nThese are type system, storage, entry points, execution context, and testing environment.\nWe believe it will bring standardization to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this ecosystem."),(0,n.kt)("p",null,"Let\u2019s look at a Flipper contract, that holds a boolean value.\nThe contract has a constructor that sets the initial value, and two entry points: ",(0,n.kt)("inlineCode",{parentName:"p"},"flip()")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"get()"),", to change and query the current value, respectively."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Variable;\n\n#[odra::module]\npub struct Flipper {\n value: Variable,\n}\n\n#[odra::module]\nimpl Flipper {\n\n #[odra(init)]\n pub fn init(&mut self, value: bool) {\n self.value.set(value);\n }\n\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n")),(0,n.kt)("p",null,"It comes with the CLI tool ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/odradev/cargo-odra"},"cargo-odra")," that makes it easy to use Odra."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"cargo-odra",src:r(38860).Z,width:"910",height:"482"})),(0,n.kt)("p",null,"Neat and simple, isn't it? Do you like it? Start flowing with us!"),(0,n.kt)("h2",{id:"what-next"},"What next"),(0,n.kt)("p",null,"Let's be honest, we are just starting.\nThe codebase is still hot.\nOn the other hand, we are happy with the interfaces we designed.\nNow is the time to write documentation and tutorials.\nWe are also building the modules library inspired by ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/"},"OpenZeppelin"),".\nThe security code audit is still ahead of us."),(0,n.kt)("h2",{id:"join-us"},"Join us"),(0,n.kt)("p",null,"Check out the ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra GitHub repository")," for more info on how to get the most out of Odra.\nShould you have questions, join ",(0,n.kt)("a",{parentName:"p",href:"https://discord.gg/Mm5ABc9P8k"},"our Discord"),", ",(0,n.kt)("a",{parentName:"p",href:"https://twitter.com/odradev"},"our Twitter")," or write us at ",(0,n.kt)("a",{parentName:"p",href:"mailto:contact@odra.dev"},"contact@odra.dev"),"."))}d.isMDXComponent=!0},38860:(e,t,r)=>{r.d(t,{Z:()=>a});const a=r.p+"assets/images/cargo_odra-57b32f7c1e40dbb498e7b1619f4860e0.gif"}}]); \ No newline at end of file diff --git a/docs/assets/js/17896441.de6aaa32.js b/docs/assets/js/17896441.de6aaa32.js new file mode 100644 index 000000000..fa2561f7e --- /dev/null +++ b/docs/assets/js/17896441.de6aaa32.js @@ -0,0 +1 @@ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[27918],{1310:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var a=n(87462),s=n(67294),l=n(86010),r=n(35281),o=n(53438),c=n(48596),i=n(39960),d=n(95999),m=n(44996);function u(e){return s.createElement("svg",(0,a.Z)({viewBox:"0 0 24 24"},e),s.createElement("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"}))}const v="breadcrumbHomeIcon_YNFT";function h(){const e=(0,m.Z)("/");return s.createElement("li",{className:"breadcrumbs__item"},s.createElement(i.Z,{"aria-label":(0,d.I)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:"breadcrumbs__link",href:e},s.createElement(u,{className:v})))}const b="breadcrumbsContainer_Z_bl";function f(e){let{children:t,href:n,isLast:a}=e;const l="breadcrumbs__link";return a?s.createElement("span",{className:l,itemProp:"name"},t):n?s.createElement(i.Z,{className:l,href:n,itemProp:"item"},s.createElement("span",{itemProp:"name"},t)):s.createElement("span",{className:l},t)}function j(e){let{children:t,active:n,index:r,addMicrodata:o}=e;return s.createElement("li",(0,a.Z)({},o&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},{className:(0,l.Z)("breadcrumbs__item",{"breadcrumbs__item--active":n})}),t,s.createElement("meta",{itemProp:"position",content:String(r+1)}))}function p(){const e=(0,o.s1)(),t=(0,c.Ns)();return e?s.createElement("nav",{className:(0,l.Z)(r.k.docs.docBreadcrumbs,b),"aria-label":(0,d.I)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"})},s.createElement("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList"},t&&s.createElement(h,null),e.map(((t,n)=>{const a=n===e.length-1;return s.createElement(j,{key:n,active:a,index:n,addMicrodata:!!t.href},s.createElement(f,{href:t.href,isLast:a},t.label))})))):null}},15154:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>J});var a=n(67294),s=n(1944),l=n(902);const r=a.createContext(null);function o(e){let{children:t,content:n}=e;const s=function(e){return(0,a.useMemo)((()=>({metadata:e.metadata,frontMatter:e.frontMatter,assets:e.assets,contentTitle:e.contentTitle,toc:e.toc})),[e])}(n);return a.createElement(r.Provider,{value:s},t)}function c(){const e=(0,a.useContext)(r);if(null===e)throw new l.i6("DocProvider");return e}function i(){const{metadata:e,frontMatter:t,assets:n}=c();return a.createElement(s.d,{title:e.title,description:e.description,keywords:t.keywords,image:n.image??t.image})}var d=n(86010),m=n(87524),u=n(80049);function v(){const{metadata:e}=c();return a.createElement(u.Z,{previous:e.previous,next:e.next})}var h=n(23120),b=n(44364),f=n(35281),j=n(95999);function p(e){let{lastUpdatedAt:t,formattedLastUpdatedAt:n}=e;return a.createElement(j.Z,{id:"theme.lastUpdated.atDate",description:"The words used to describe on which date a page has been last updated",values:{date:a.createElement("b",null,a.createElement("time",{dateTime:new Date(1e3*t).toISOString()},n))}}," on {date}")}function g(e){let{lastUpdatedBy:t}=e;return a.createElement(j.Z,{id:"theme.lastUpdated.byUser",description:"The words used to describe by who the page has been last updated",values:{user:a.createElement("b",null,t)}}," by {user}")}function E(e){let{lastUpdatedAt:t,formattedLastUpdatedAt:n,lastUpdatedBy:s}=e;return a.createElement("span",{className:f.k.common.lastUpdated},a.createElement(j.Z,{id:"theme.lastUpdated.lastUpdatedAtBy",description:"The sentence used to display when a page has been last updated, and by who",values:{atDate:t&&n?a.createElement(p,{lastUpdatedAt:t,formattedLastUpdatedAt:n}):"",byUser:s?a.createElement(g,{lastUpdatedBy:s}):""}},"Last updated{atDate}{byUser}"),!1)}var k=n(84881),L=n(86233);const N="lastUpdated_vwxv";function Z(e){return a.createElement("div",{className:(0,d.Z)(f.k.docs.docFooterTagsRow,"row margin-bottom--sm")},a.createElement("div",{className:"col"},a.createElement(L.Z,e)))}function y(e){let{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:s,formattedLastUpdatedAt:l}=e;return a.createElement("div",{className:(0,d.Z)(f.k.docs.docFooterEditMetaRow,"row")},a.createElement("div",{className:"col"},t&&a.createElement(k.Z,{editUrl:t})),a.createElement("div",{className:(0,d.Z)("col",N)},(n||s)&&a.createElement(E,{lastUpdatedAt:n,formattedLastUpdatedAt:l,lastUpdatedBy:s})))}function _(){const{metadata:e}=c(),{editUrl:t,lastUpdatedAt:n,formattedLastUpdatedAt:s,lastUpdatedBy:l,tags:r}=e,o=r.length>0,i=!!(t||n||l);return o||i?a.createElement("footer",{className:(0,d.Z)(f.k.docs.docFooter,"docusaurus-mt-lg")},o&&a.createElement(Z,{tags:r}),i&&a.createElement(y,{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:l,formattedLastUpdatedAt:s})):null}var C=n(86043),x=n(93743),T=n(87462);const w="tocCollapsibleButton_TO0P",U="tocCollapsibleButtonExpanded_MG3E";function H(e){let{collapsed:t,...n}=e;return a.createElement("button",(0,T.Z)({type:"button"},n,{className:(0,d.Z)("clean-btn",w,!t&&U,n.className)}),a.createElement(j.Z,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component"},"On this page"))}const A="tocCollapsible_ETCw",z="tocCollapsibleContent_vkbj",M="tocCollapsibleExpanded_sAul";function B(e){let{toc:t,className:n,minHeadingLevel:s,maxHeadingLevel:l}=e;const{collapsed:r,toggleCollapsed:o}=(0,C.u)({initialState:!0});return a.createElement("div",{className:(0,d.Z)(A,!r&&M,n)},a.createElement(H,{collapsed:r,onClick:o}),a.createElement(C.z,{lazy:!0,className:z,collapsed:r},a.createElement(x.Z,{toc:t,minHeadingLevel:s,maxHeadingLevel:l})))}const I="tocMobile_ITEo";function O(){const{toc:e,frontMatter:t}=c();return a.createElement(B,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:(0,d.Z)(f.k.docs.docTocMobile,I)})}var S=n(39407);function V(){const{toc:e,frontMatter:t}=c();return a.createElement(S.Z,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:f.k.docs.docTocDesktop})}var D=n(92503),P=n(88905);function R(e){let{children:t}=e;const n=function(){const{metadata:e,frontMatter:t,contentTitle:n}=c();return t.hide_title||void 0!==n?null:e.title}();return a.createElement("div",{className:(0,d.Z)(f.k.docs.docMarkdown,"markdown")},n&&a.createElement("header",null,a.createElement(D.Z,{as:"h1"},n)),a.createElement(P.Z,null,t))}var F=n(1310);const q="docItemContainer_Djhp",$="docItemCol_VOVn";function G(e){let{children:t}=e;const n=function(){const{frontMatter:e,toc:t}=c(),n=(0,m.i)(),s=e.hide_table_of_contents,l=!s&&t.length>0;return{hidden:s,mobile:l?a.createElement(O,null):void 0,desktop:!l||"desktop"!==n&&"ssr"!==n?void 0:a.createElement(V,null)}}();return a.createElement("div",{className:"row"},a.createElement("div",{className:(0,d.Z)("col",!n.hidden&&$)},a.createElement(h.Z,null),a.createElement("div",{className:q},a.createElement("article",null,a.createElement(F.Z,null),a.createElement(b.Z,null),n.mobile,a.createElement(R,null,t),a.createElement(_,null)),a.createElement(v,null))),n.desktop&&a.createElement("div",{className:"col col--3"},n.desktop))}function J(e){const t=`docs-doc-id-${e.content.metadata.unversionedId}`,n=e.content;return a.createElement(o,{content:e.content},a.createElement(s.FG,{className:t},a.createElement(i,null),a.createElement(G,null,a.createElement(n,null))))}},80049:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var a=n(87462),s=n(67294),l=n(95999),r=n(32244);function o(e){const{previous:t,next:n}=e;return s.createElement("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,l.I)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages navigation",description:"The ARIA label for the docs pagination"})},t&&s.createElement(r.Z,(0,a.Z)({},t,{subLabel:s.createElement(l.Z,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc"},"Previous")})),n&&s.createElement(r.Z,(0,a.Z)({},n,{subLabel:s.createElement(l.Z,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc"},"Next"),isNext:!0})))}},44364:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var a=n(67294),s=n(86010),l=n(95999),r=n(35281),o=n(74477);function c(e){let{className:t}=e;const n=(0,o.E)();return n.badge?a.createElement("span",{className:(0,s.Z)(t,r.k.docs.docVersionBadge,"badge badge--secondary")},a.createElement(l.Z,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label}},"Version: {versionLabel}")):null}},23120:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var a=n(67294),s=n(86010),l=n(52263),r=n(39960),o=n(95999),c=n(94104),i=n(35281),d=n(60373),m=n(74477);const u={unreleased:function(e){let{siteTitle:t,versionMetadata:n}=e;return a.createElement(o.Z,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:t,versionLabel:a.createElement("b",null,n.label)}},"This is unreleased documentation for {siteTitle} {versionLabel} version.")},unmaintained:function(e){let{siteTitle:t,versionMetadata:n}=e;return a.createElement(o.Z,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:t,versionLabel:a.createElement("b",null,n.label)}},"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.")}};function v(e){const t=u[e.versionMetadata.banner];return a.createElement(t,e)}function h(e){let{versionLabel:t,to:n,onClick:s}=e;return a.createElement(o.Z,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:t,latestVersionLink:a.createElement("b",null,a.createElement(r.Z,{to:n,onClick:s},a.createElement(o.Z,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label"},"latest version")))}},"For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).")}function b(e){let{className:t,versionMetadata:n}=e;const{siteConfig:{title:r}}=(0,l.Z)(),{pluginId:o}=(0,c.gA)({failfast:!0}),{savePreferredVersionName:m}=(0,d.J)(o),{latestDocSuggestion:u,latestVersionSuggestion:b}=(0,c.Jo)(o),f=u??(j=b).docs.find((e=>e.id===j.mainDocId));var j;return a.createElement("div",{className:(0,s.Z)(t,i.k.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert"},a.createElement("div",null,a.createElement(v,{siteTitle:r,versionMetadata:n})),a.createElement("div",{className:"margin-top--md"},a.createElement(h,{versionLabel:b.label,to:f.path,onClick:()=>m(b.name)})))}function f(e){let{className:t}=e;const n=(0,m.E)();return n.banner?a.createElement(b,{className:t,versionMetadata:n}):null}},39407:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var a=n(87462),s=n(67294),l=n(86010),r=n(93743);const o="tableOfContents_bqdL";function c(e){let{className:t,...n}=e;return s.createElement("div",{className:(0,l.Z)(o,"thin-scrollbar",t)},s.createElement(r.Z,(0,a.Z)({},n,{linkClassName:"table-of-contents__link toc-highlight",linkActiveClassName:"table-of-contents__link--active"})))}},93743:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var a=n(87462),s=n(67294),l=n(86668);function r(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const a=n.slice(2,e.level);e.parentIndex=Math.max(...a),n[e.level]=t}));const a=[];return t.forEach((e=>{const{parentIndex:n,...s}=e;n>=0?t[n].children.push(s):a.push(s)})),a}function o(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return t.flatMap((e=>{const t=o({toc:e.children,minHeadingLevel:n,maxHeadingLevel:a});return function(e){return e.level>=n&&e.level<=a}(e)?[{...e,children:t}]:t}))}function c(e){const t=e.getBoundingClientRect();return t.top===t.bottom?c(e.parentNode):t}function i(e,t){let{anchorTopOffset:n}=t;const a=e.find((e=>c(e).top>=n));if(a){return function(e){return e.top>0&&e.bottom{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function m(e){const t=(0,s.useRef)(void 0),n=d();(0,s.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:a,linkActiveClassName:s,minHeadingLevel:l,maxHeadingLevel:r}=e;function o(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(a),o=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const a=[];for(let s=t;s<=n;s+=1)a.push(`h${s}.anchor`);return Array.from(document.querySelectorAll(a.join()))}({minHeadingLevel:l,maxHeadingLevel:r}),c=i(o,{anchorTopOffset:n.current}),d=e.find((e=>c&&c.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(s),e.classList.add(s),t.current=e):e.classList.remove(s)}(e,e===d)}))}return document.addEventListener("scroll",o),document.addEventListener("resize",o),o(),()=>{document.removeEventListener("scroll",o),document.removeEventListener("resize",o)}}),[e,n])}function u(e){let{toc:t,className:n,linkClassName:a,isChild:l}=e;return t.length?s.createElement("ul",{className:l?void 0:n},t.map((e=>s.createElement("li",{key:e.id},s.createElement("a",{href:`#${e.id}`,className:a??void 0,dangerouslySetInnerHTML:{__html:e.value}}),s.createElement(u,{isChild:!0,toc:e.children,className:n,linkClassName:a}))))):null}const v=s.memo(u);function h(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:c="table-of-contents__link",linkActiveClassName:i,minHeadingLevel:d,maxHeadingLevel:u,...h}=e;const b=(0,l.L)(),f=d??b.tableOfContents.minHeadingLevel,j=u??b.tableOfContents.maxHeadingLevel,p=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return(0,s.useMemo)((()=>o({toc:r(t),minHeadingLevel:n,maxHeadingLevel:a})),[t,n,a])}({toc:t,minHeadingLevel:f,maxHeadingLevel:j});return m((0,s.useMemo)((()=>{if(c&&i)return{linkClassName:c,linkActiveClassName:i,minHeadingLevel:f,maxHeadingLevel:j}}),[c,i,f,j])),s.createElement(v,(0,a.Z)({toc:p,className:n,linkClassName:c},h))}},46700:(e,t,n)=>{var a={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function s(e){var t=l(e);return n(t)}function l(e){if(!n.o(a,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return a[e]}s.keys=function(){return Object.keys(a)},s.resolve=l,e.exports=s,s.id=46700}}]); \ No newline at end of file diff --git a/docs/assets/js/17908ca6.f9fc0d33.js b/docs/assets/js/17908ca6.f9fc0d33.js new file mode 100644 index 000000000..967869baf --- /dev/null +++ b/docs/assets/js/17908ca6.f9fc0d33.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[87671],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,h=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(h,i(i({ref:t},d),{},{components:n})):a.createElement(h,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.8.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.8.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.8.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.8.0/category/backends"},next:{title:"OdraVM",permalink:"/docs/0.8.0/backends/odra-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Host Env",id:"host-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/odra-vm"},"OdraVM"),",\na complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/casper"},"CasperVM"),",\nor even a real blockchain - when using ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/casper"},"Livenet backend"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"host-env"},"Host Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/17e51713.e47787e4.js b/docs/assets/js/17e51713.e47787e4.js new file mode 100644 index 000000000..a60a34ee9 --- /dev/null +++ b/docs/assets/js/17e51713.e47787e4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[34926],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||p[f]||o;return n?r.createElement(m,l(l({ref:t},u),{},{components:n})):r.createElement(m,l({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-0.9.1/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that",source:"@site/versioned_docs/version-0.9.1/advanced/03-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.9.1/advanced/attributes",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.9.1/advanced/advanced-storage"},next:{title:"Storage Layout",permalink:"/docs/0.9.1/advanced/storage-layout"}},s={},c=[{value:"Payable",id:"payable",level:2},{value:"Example",id:"example",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Example",id:"example-1",level:3},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"attributes"},"Attributes"),(0,a.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that\nallows developers to embed common checks into function definitions in a readable and reusable manner.\nThese are essentially prerequisites for function execution."),(0,a.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,a.kt)("h2",{id:"payable"},"Payable"),(0,a.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,a.kt)("h3",{id:"example"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U256 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env.revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env()\n .emit_event(Deposit {\n address: caller,\n amount\n });\n}\n")),(0,a.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,a.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,a.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,a.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,a.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,a.kt)("p",null,"In Odra you can just apply the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,a.kt)("h3",{id:"example-1"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct NonReentrantCounter {\n counter: Var\n}\n\n#[odra::module]\nimpl NonReentrantCounter {\n #[odra(non_reentrant)]\n pub fn count_ref_recursive(&mut self, n: u32) {\n if n > 0 {\n self.count();\n ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);\n }\n }\n}\n\nimpl NonReentrantCounter {\n fn count(&mut self) {\n let c = self.counter.get_or_default();\n self.counter.set(c + 1);\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::{host::{Deployer, NoArgs}, ExecutionError};\n\n #[test]\n fn ref_recursion_not_allowed() {\n let test_env = odra_test::env();\n let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);\n\n let result = contract.count_ref_recursive(11);\n assert_eq!(result, ExecutionError::ReentrantCall.into());\n }\n}\n")),(0,a.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,a.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"or "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"In both cases attributes order does not matter."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/181ab02d.a47d9657.js b/docs/assets/js/181ab02d.a47d9657.js new file mode 100644 index 000000000..2667ca873 --- /dev/null +++ b/docs/assets/js/181ab02d.a47d9657.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[8099],{89891:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.2.0/category/backends","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.2.0/basics/native-token"},"next":{"title":"What is a backend?","permalink":"/docs/0.2.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/192dc956.412c3489.js b/docs/assets/js/192dc956.412c3489.js new file mode 100644 index 000000000..2cbc293eb --- /dev/null +++ b/docs/assets/js/192dc956.412c3489.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[81133],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=d(t),m=a,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||s;return t?r.createElement(f,o(o({ref:n},c),{},{components:t})):r.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=p;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var d=2;d{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const s={sidebar_position:3},o="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.8.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.8.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.8.0/tutorials/erc20",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.8.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.8.0/tutorials/owned-token"}},i={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"erc-20"},"ERC-20"),(0,a.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,a.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,a.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value."),(0,a.kt)("h2",{id:"framework-features"},"Framework features"),(0,a.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Advanced storage using key-value pairs,"),(0,a.kt)("li",{parentName:"ul"},"Odra types such as ",(0,a.kt)("inlineCode",{parentName:"li"},"Address"),","),(0,a.kt)("li",{parentName:"ul"},"Advanced event assertion.")),(0,a.kt)("h2",{id:"code"},"Code"),(0,a.kt)("p",null,"Our module features a considerably more complex storage layout compared to the previous example. "),(0,a.kt)("p",null,"It is designed to store the following data:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol, and decimals."),(0,a.kt)("li",{parentName:"ol"},"Total supply."),(0,a.kt)("li",{parentName:"ol"},"Balances of individual users."),(0,a.kt)("li",{parentName:"ol"},"Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.")),(0,a.kt)("h2",{id:"module-definition"},"Module definition"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Mapping, Var};\n\n#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,a.kt)("inlineCode",{parentName:"li"},"mapping"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L11")," - Odra does not allows nested ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),"s as Solidity does. Instead, you can create a compound key using a tuple of keys.")),(0,a.kt)("h3",{id:"metadata"},"Metadata"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"...\nuse odra::Event;\n\n...\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let caller = self.env().caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, &initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.balances.add(address, *amount);\n self.total_supply.add(*amount);\n \n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L6")," - The first ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L8-L14")," - A constructor sets the token metadata and mints the initial supply."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L33")," - The second ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," is not an Odra module; in other words, these functions will not be part of the contract's public interface."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L34-L43")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"mint")," function is public, so, like in regular Rust code, it will be accessible from the outside. ",(0,a.kt)("inlineCode",{parentName:"li"},"mint()")," uses the notation ",(0,a.kt)("inlineCode",{parentName:"li"},"self.balances.add(address, *amount);"),", which is syntactic sugar for:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::UnwrapOrRevert;\n\nlet current_balance = self.balances.get(address).unwrap_or_default();\nlet new_balance = ::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());\nself.balances.set(address, new_balance);\n")),(0,a.kt)("h3",{id:"core"},"Core"),(0,a.kt)("p",null,"To ensure comprehensive functionality, let's implement the remaining features such as ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer_from"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"approve"),". Since they do not introduce any new concepts, we will present them without additional remarks."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers title=erc20.rs",showLineNumbers:!0,title:"erc20.rs"},"...\nuse odra::OdraError;\n\n#[odra::module]\nimpl Erc20 {\n ...\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n self.env().revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowance(owner, spender);\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .set(&(*owner, *spender), new_allowance);\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 1,\n InsufficientAllowance = 2,\n}\n")),(0,a.kt)("p",null,"Now, compare the code we have written, with ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,a.kt)("h3",{id:"test"},"Test"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::*;\n use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: INITIAL_SUPPLY.into()\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let (env, mut erc20) = setup();\n\n let (owner, recipient, spender) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount\n }\n ));\n\n // Spender transfers tokens from Owner to Recipient.\n env.set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n ));\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n ));\n // assert!(env.emitted(erc20.address(), "Transfer"));\n }\n\n #[test]\n fn transfer_from_error() {\n // Given a new instance.\n let (env, mut erc20) = setup();\n\n // When the spender\'s allowance is zero.\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n // Then transfer fails.\n assert_eq!(\n erc20.try_transfer_from(&owner, &recipient, &amount),\n Err(Error::InsufficientAllowance.into())\n );\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L146")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Having two modules: ",(0,a.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1999a842.96b6056c.js b/docs/assets/js/1999a842.96b6056c.js new file mode 100644 index 000000000..5fb1273da --- /dev/null +++ b/docs/assets/js/1999a842.96b6056c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40427],{89813:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.3.1/category/backends","navigation":{"previous":{"title":"Attributes","permalink":"/docs/0.3.1/advanced/attributes"},"next":{"title":"What is a backend?","permalink":"/docs/0.3.1/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/1b34e22f.e8e90041.js b/docs/assets/js/1b34e22f.e8e90041.js new file mode 100644 index 000000000..78e952cc6 --- /dev/null +++ b/docs/assets/js/1b34e22f.e8e90041.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73785],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>g});var n=a(67294);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 l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(a),g=r,m=d["".concat(s,".").concat(g)]||d[g]||u[g]||o;return a?n.createElement(m,l(l({ref:t},p),{},{components:a})):n.createElement(m,l({ref:t},p))}));function g(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.2.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.2.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.2.0/getting-started/installation",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Getting started",permalink:"/docs/0.2.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.2.0/getting-started/flipper"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-uknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my-project\n")),(0,r.kt)("p",null,'This will create a new folder called "my-project" and initialize Odra there. Cargo Odra\nwill create a sample contract for you in src directory. You can run the tests of this contract\nby executing:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal MockVM. You can run those tests against a real backend, to do so\nwe need to add a new backend. Let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra backend add -p casper\n")),(0,r.kt)("p",null,"Now we can run the tests against it:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1b36f1ff.bdb158a2.js b/docs/assets/js/1b36f1ff.bdb158a2.js new file mode 100644 index 000000000..3bdcd5295 --- /dev/null +++ b/docs/assets/js/1b36f1ff.bdb158a2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[38602],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||p[f]||o;return n?r.createElement(m,l(l({ref:t},u),{},{components:n})):r.createElement(m,l({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-1.0.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that",source:"@site/versioned_docs/version-1.0.0/advanced/03-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/advanced/attributes",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/advanced/advanced-storage"},next:{title:"Storage Layout",permalink:"/docs/advanced/storage-layout"}},s={},c=[{value:"Payable",id:"payable",level:2},{value:"Example",id:"example",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Example",id:"example-1",level:3},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"attributes"},"Attributes"),(0,a.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that\nallows developers to embed common checks into function definitions in a readable and reusable manner.\nThese are essentially prerequisites for function execution."),(0,a.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,a.kt)("h2",{id:"payable"},"Payable"),(0,a.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,a.kt)("h3",{id:"example"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U256 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env.revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env()\n .emit_event(Deposit {\n address: caller,\n amount\n });\n}\n")),(0,a.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,a.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,a.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,a.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,a.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,a.kt)("p",null,"In Odra you can just apply the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,a.kt)("h3",{id:"example-1"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct NonReentrantCounter {\n counter: Var\n}\n\n#[odra::module]\nimpl NonReentrantCounter {\n #[odra(non_reentrant)]\n pub fn count_ref_recursive(&mut self, n: u32) {\n if n > 0 {\n self.count();\n ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);\n }\n }\n}\n\nimpl NonReentrantCounter {\n fn count(&mut self) {\n let c = self.counter.get_or_default();\n self.counter.set(c + 1);\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::{host::{Deployer, NoArgs}, ExecutionError};\n\n #[test]\n fn ref_recursion_not_allowed() {\n let test_env = odra_test::env();\n let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);\n\n let result = contract.count_ref_recursive(11);\n assert_eq!(result, ExecutionError::ReentrantCall.into());\n }\n}\n")),(0,a.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,a.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"or "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"In both cases attributes order does not matter."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1bc92503.619287f3.js b/docs/assets/js/1bc92503.619287f3.js new file mode 100644 index 000000000..18509b5af --- /dev/null +++ b/docs/assets/js/1bc92503.619287f3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[65010],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:11,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.9.1/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.9.1/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.9.1/basics/cross-calls",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Casper Contract Schema",permalink:"/docs/0.9.1/basics/casper-contract-schema"},next:{title:"Modules",permalink:"/docs/0.9.1/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Loading the contract",id:"loading-the-contract",level:3},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::prelude::*;\nuse odra::{Address, UnwrapOrRevert, Var};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Var
\n}\n\n#[odra::module]\nimpl CrossContract {\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());\n MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine;\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To perform a cross-contact call, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"HostRef")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/testing"},"Testing")," article - a host side reference to already deployed contract."),(0,r.kt)("p",null,"In the module context we use a ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractRef")," instead, to call other contracts."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," is generated automatically,\nby the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("p",null,"To obtain an instance of a contract reference, we simply call the constructor - ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env: Rc, address: Address)"),", as shown above."),(0,r.kt)("p",null,"The reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), and the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::address()")," function, which returns the address of the contract."),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderContractRef")," struct (and ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderHostRef")," to be used in tests, but do not implement the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer")," trait). Having an address, in the module context we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"AdderContractRef::new(self.env(), address).add(3, 5)\n")),(0,r.kt)("h3",{id:"loading-the-contract"},"Loading the contract"),(0,r.kt)("p",null,"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test\nour contracts in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/backends/livenet"},"Livenet")," backend. We can load the contract using ",(0,r.kt)("inlineCode",{parentName:"p"},"load")," method on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/bin/erc20_on_livenet.rs"',title:'"examples/bin/erc20_on_livenet.rs"'},'fn _load(env: &HostEnv) -> Erc20HostRef {\n let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n let address = Address::from_str(address).unwrap();\n ::load(env, address)\n}\n')),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};\n use odra::host::{Deployer, HostRef, NoArgs};\n\n #[test]\n fn test_cross_calls() {\n let test_env = odra_test::env();\n let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);\n let cross_contract = CrossContractHostRef::deploy(\n &test_env,\n CrossContractInitArgs {\n math_engine_address: *math_engine_contract.address()\n }\n );\n assert_eq!(cross_contract.add_using_another(), 8);\n }\n}\n")),(0,r.kt)("p",null,"Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that we intend to utilize."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{Address, host::{Deployer, HostRef, NoArgs}};\n \n #[test]\n fn test_ext() {\n let test_env = odra_test::env();\n let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address(test_env: &HostEnv) -> Address {\n let contract = MathEngineHostRef::deploy(test_env, NoArgs);\n *contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1be56b3c.bc52f942.js b/docs/assets/js/1be56b3c.bc52f942.js new file mode 100644 index 000000000..406c4c82a --- /dev/null +++ b/docs/assets/js/1be56b3c.bc52f942.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63962],{80396:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.8.1/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.8.1/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.8.1/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/1be78505.a6a0c605.js b/docs/assets/js/1be78505.a6a0c605.js new file mode 100644 index 000000000..8a3289f80 --- /dev/null +++ b/docs/assets/js/1be78505.a6a0c605.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29514,4972],{19963:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ce});var a=n(67294),l=n(86010),o=n(1944),r=n(35281),i=n(43320),c=n(53438),s=n(74477),d=n(1116),m=n(12684),u=n(95999),b=n(12466),p=n(85936);const h="backToTopButton_sjWU",E="backToTopButtonShow_xfvO";function f(){const{shown:e,scrollToTop:t}=function(e){let{threshold:t}=e;const[n,l]=(0,a.useState)(!1),o=(0,a.useRef)(!1),{startScroll:r,cancelScroll:i}=(0,b.Ct)();return(0,b.RF)(((e,n)=>{let{scrollY:a}=e;const r=n?.scrollY;r&&(o.current?o.current=!1:a>=r?(i(),l(!1)):a{e.location.hash&&(o.current=!0,l(!1))})),{shown:n,scrollToTop:()=>r(0)}}({threshold:300});return a.createElement("button",{"aria-label":(0,u.I)({id:"theme.BackToTopButton.buttonAriaLabel",message:"Scroll back to top",description:"The ARIA label for the back to top button"}),className:(0,l.Z)("clean-btn",r.k.common.backToTopButton,h,e&&E),type:"button",onClick:t})}var g=n(16550),_=n(87524),v=n(86668),k=n(11231),C=n(87462);function S(e){return a.createElement("svg",(0,C.Z)({width:"20",height:"20","aria-hidden":"true"},e),a.createElement("g",{fill:"#7a7a7a"},a.createElement("path",{d:"M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"}),a.createElement("path",{d:"M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"})))}const I="collapseSidebarButton_PEFL",N="collapseSidebarButtonIcon_kv0_";function Z(e){let{onClick:t}=e;return a.createElement("button",{type:"button",title:(0,u.I)({id:"theme.docs.sidebar.collapseButtonTitle",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),"aria-label":(0,u.I)({id:"theme.docs.sidebar.collapseButtonAriaLabel",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),className:(0,l.Z)("button button--secondary button--outline",I),onClick:t},a.createElement(S,{className:N}))}var T=n(59689),y=n(902);const x=Symbol("EmptyContext"),w=a.createContext(x);function L(e){let{children:t}=e;const[n,l]=(0,a.useState)(null),o=(0,a.useMemo)((()=>({expandedItem:n,setExpandedItem:l})),[n]);return a.createElement(w.Provider,{value:o},t)}var A=n(86043),M=n(48596),B=n(39960),F=n(72389);function H(e){let{categoryLabel:t,onClick:n}=e;return a.createElement("button",{"aria-label":(0,u.I)({id:"theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel",message:"Toggle the collapsible sidebar category '{label}'",description:"The ARIA label to toggle the collapsible sidebar category"},{label:t}),type:"button",className:"clean-btn menu__caret",onClick:n})}function P(e){let{item:t,onItemClick:n,activePath:o,level:i,index:s,...d}=e;const{items:m,label:u,collapsible:b,className:p,href:h}=t,{docs:{sidebar:{autoCollapseCategories:E}}}=(0,v.L)(),f=function(e){const t=(0,F.Z)();return(0,a.useMemo)((()=>e.href?e.href:!t&&e.collapsible?(0,c.Wl)(e):void 0),[e,t])}(t),g=(0,c._F)(t,o),_=(0,M.Mg)(h,o),{collapsed:k,setCollapsed:S}=(0,A.u)({initialState:()=>!!b&&(!g&&t.collapsed)}),{expandedItem:I,setExpandedItem:N}=function(){const e=(0,a.useContext)(w);if(e===x)throw new y.i6("DocSidebarItemsExpandedStateProvider");return e}(),Z=function(e){void 0===e&&(e=!k),N(e?null:s),S(e)};return function(e){let{isActive:t,collapsed:n,updateCollapsed:l}=e;const o=(0,y.D9)(t);(0,a.useEffect)((()=>{t&&!o&&n&&l(!1)}),[t,o,n,l])}({isActive:g,collapsed:k,updateCollapsed:Z}),(0,a.useEffect)((()=>{b&&null!=I&&I!==s&&E&&S(!0)}),[b,I,s,S,E]),a.createElement("li",{className:(0,l.Z)(r.k.docs.docSidebarItemCategory,r.k.docs.docSidebarItemCategoryLevel(i),"menu__list-item",{"menu__list-item--collapsed":k},p)},a.createElement("div",{className:(0,l.Z)("menu__list-item-collapsible",{"menu__list-item-collapsible--active":_})},a.createElement(B.Z,(0,C.Z)({className:(0,l.Z)("menu__link",{"menu__link--sublist":b,"menu__link--sublist-caret":!h&&b,"menu__link--active":g}),onClick:b?e=>{n?.(t),h?Z(!1):(e.preventDefault(),Z())}:()=>{n?.(t)},"aria-current":_?"page":void 0,"aria-expanded":b?!k:void 0,href:b?f??"#":f},d),u),h&&b&&a.createElement(H,{categoryLabel:u,onClick:e=>{e.preventDefault(),Z()}})),a.createElement(A.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:k},a.createElement(G,{items:m,tabIndex:k?-1:0,onItemClick:n,activePath:o,level:i+1})))}var W=n(13919),D=n(39471);const R="menuExternalLink_NmtK";function V(e){let{item:t,onItemClick:n,activePath:o,level:i,index:s,...d}=e;const{href:m,label:u,className:b,autoAddBaseUrl:p}=t,h=(0,c._F)(t,o),E=(0,W.Z)(m);return a.createElement("li",{className:(0,l.Z)(r.k.docs.docSidebarItemLink,r.k.docs.docSidebarItemLinkLevel(i),"menu__list-item",b),key:u},a.createElement(B.Z,(0,C.Z)({className:(0,l.Z)("menu__link",!E&&R,{"menu__link--active":h}),autoAddBaseUrl:p,"aria-current":h?"page":void 0,to:m},E&&{onClick:n?()=>n(t):void 0},d),u,!E&&a.createElement(D.Z,null)))}const z="menuHtmlItem_M9Kj";function U(e){let{item:t,level:n,index:o}=e;const{value:i,defaultStyle:c,className:s}=t;return a.createElement("li",{className:(0,l.Z)(r.k.docs.docSidebarItemLink,r.k.docs.docSidebarItemLinkLevel(n),c&&[z,"menu__list-item"],s),key:o,dangerouslySetInnerHTML:{__html:i}})}function K(e){let{item:t,...n}=e;switch(t.type){case"category":return a.createElement(P,(0,C.Z)({item:t},n));case"html":return a.createElement(U,(0,C.Z)({item:t},n));default:return a.createElement(V,(0,C.Z)({item:t},n))}}function j(e){let{items:t,...n}=e;return a.createElement(L,null,t.map(((e,t)=>a.createElement(K,(0,C.Z)({key:t,item:e,index:t},n)))))}const G=(0,a.memo)(j),Y="menu_SIkG",q="menuWithAnnouncementBar_GW3s";function O(e){let{path:t,sidebar:n,className:o}=e;const i=function(){const{isActive:e}=(0,T.nT)(),[t,n]=(0,a.useState)(e);return(0,b.RF)((t=>{let{scrollY:a}=t;e&&n(0===a)}),[e]),e&&t}();return a.createElement("nav",{"aria-label":(0,u.I)({id:"theme.docs.sidebar.navAriaLabel",message:"Docs sidebar",description:"The ARIA label for the sidebar navigation"}),className:(0,l.Z)("menu thin-scrollbar",Y,i&&q,o)},a.createElement("ul",{className:(0,l.Z)(r.k.docs.docSidebarMenu,"menu__list")},a.createElement(G,{items:n,activePath:t,level:1})))}const X="sidebar_njMd",J="sidebarWithHideableNavbar_wUlq",Q="sidebarHidden_VK0M",$="sidebarLogo_isFc";function ee(e){let{path:t,sidebar:n,onCollapse:o,isHidden:r}=e;const{navbar:{hideOnScroll:i},docs:{sidebar:{hideable:c}}}=(0,v.L)();return a.createElement("div",{className:(0,l.Z)(X,i&&J,r&&Q)},i&&a.createElement(k.Z,{tabIndex:-1,className:$}),a.createElement(O,{path:t,sidebar:n}),c&&a.createElement(Z,{onClick:o}))}const te=a.memo(ee);var ne=n(13102),ae=n(93163);const le=e=>{let{sidebar:t,path:n}=e;const o=(0,ae.e)();return a.createElement("ul",{className:(0,l.Z)(r.k.docs.docSidebarMenu,"menu__list")},a.createElement(G,{items:t,activePath:n,onItemClick:e=>{"category"===e.type&&e.href&&o.toggle(),"link"===e.type&&o.toggle()},level:1}))};function oe(e){return a.createElement(ne.Zo,{component:le,props:e})}const re=a.memo(oe);function ie(e){const t=(0,_.i)(),n="desktop"===t||"ssr"===t,l="mobile"===t;return a.createElement(a.Fragment,null,n&&a.createElement(te,e),l&&a.createElement(re,e))}const ce="expandButton_m80_",se="expandButtonIcon_BlDH";function de(e){let{toggleSidebar:t}=e;return a.createElement("div",{className:ce,title:(0,u.I)({id:"theme.docs.sidebar.expandButtonTitle",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),"aria-label":(0,u.I)({id:"theme.docs.sidebar.expandButtonAriaLabel",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),tabIndex:0,role:"button",onKeyDown:t,onClick:t},a.createElement(S,{className:se}))}const me={docSidebarContainer:"docSidebarContainer_b6E3",docSidebarContainerHidden:"docSidebarContainerHidden_b3ry",sidebarViewport:"sidebarViewport_Xe31"};function ue(e){let{children:t}=e;const n=(0,d.V)();return a.createElement(a.Fragment,{key:n?.name??"noSidebar"},t)}function be(e){let{sidebar:t,hiddenSidebarContainer:n,setHiddenSidebarContainer:o}=e;const{pathname:i}=(0,g.TH)(),[c,s]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>{c&&s(!1),o((e=>!e))}),[o,c]);return a.createElement("aside",{className:(0,l.Z)(r.k.docs.docSidebarContainer,me.docSidebarContainer,n&&me.docSidebarContainerHidden),onTransitionEnd:e=>{e.currentTarget.classList.contains(me.docSidebarContainer)&&n&&s(!0)}},a.createElement(ue,null,a.createElement("div",{className:(0,l.Z)(me.sidebarViewport,c&&me.sidebarViewportHidden)},a.createElement(ie,{sidebar:t,path:i,onCollapse:d,isHidden:c}),c&&a.createElement(de,{toggleSidebar:d}))))}const pe={docMainContainer:"docMainContainer_gTbr",docMainContainerEnhanced:"docMainContainerEnhanced_Uz_u",docItemWrapperEnhanced:"docItemWrapperEnhanced_czyv"};function he(e){let{hiddenSidebarContainer:t,children:n}=e;const o=(0,d.V)();return a.createElement("main",{className:(0,l.Z)(pe.docMainContainer,(t||!o)&&pe.docMainContainerEnhanced)},a.createElement("div",{className:(0,l.Z)("container padding-top--md padding-bottom--lg",pe.docItemWrapper,t&&pe.docItemWrapperEnhanced)},n))}const Ee="docPage__5DB",fe="docsWrapper_BCFX";function ge(e){let{children:t}=e;const n=(0,d.V)(),[l,o]=(0,a.useState)(!1);return a.createElement(m.Z,{wrapperClassName:fe},a.createElement(f,null),a.createElement("div",{className:Ee},n&&a.createElement(be,{sidebar:n.items,hiddenSidebarContainer:l,setHiddenSidebarContainer:o}),a.createElement(he,{hiddenSidebarContainer:l},t)))}var _e=n(4972),ve=n(90197);function ke(e){const{versionMetadata:t}=e;return a.createElement(a.Fragment,null,a.createElement(ve.Z,{version:t.version,tag:(0,i.os)(t.pluginId,t.version)}),a.createElement(o.d,null,t.noIndex&&a.createElement("meta",{name:"robots",content:"noindex, nofollow"})))}function Ce(e){const{versionMetadata:t}=e,n=(0,c.hI)(e);if(!n)return a.createElement(_e.default,null);const{docElement:i,sidebarName:m,sidebarItems:u}=n;return a.createElement(a.Fragment,null,a.createElement(ke,e),a.createElement(o.FG,{className:(0,l.Z)(r.k.wrapper.docsPages,r.k.page.docsDocPage,e.versionMetadata.className)},a.createElement(s.q,{version:t},a.createElement(d.b,{name:m,items:u},a.createElement(ge,null,i)))))}},4972:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var a=n(67294),l=n(95999),o=n(1944),r=n(12684);function i(){return a.createElement(a.Fragment,null,a.createElement(o.d,{title:(0,l.I)({id:"theme.NotFound.title",message:"Page Not Found"})}),a.createElement(r.Z,null,a.createElement("main",{className:"container margin-vert--xl"},a.createElement("div",{className:"row"},a.createElement("div",{className:"col col--6 col--offset-3"},a.createElement("h1",{className:"hero__title"},a.createElement(l.Z,{id:"theme.NotFound.title",description:"The title of the 404 page"},"Page Not Found")),a.createElement("p",null,a.createElement(l.Z,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page"},"We could not find what you were looking for.")),a.createElement("p",null,a.createElement(l.Z,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page"},"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))))}}}]); \ No newline at end of file diff --git a/docs/assets/js/1d7f9163.b6cce7da.js b/docs/assets/js/1d7f9163.b6cce7da.js new file mode 100644 index 000000000..e97d53802 --- /dev/null +++ b/docs/assets/js/1d7f9163.b6cce7da.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90627],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||l;return t?a.createElement(f,o(o({ref:n},c),{},{components:t})):a.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,o=new Array(l);o[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const l={},o="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.9.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.9.0/advanced/01-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.9.0/advanced/delegate",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.9.0/category/advanced"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.9.0/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::{\n Address, casper_types::U256,\n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n fn approve(&mut self, spender: Address, amount: U256);\n fn name(&self) -> String;\n fn symbol(&self) -> String;\n fn decimals(&self) -> u8;\n fn total_supply(&self) -> U256;\n fn balance_of(&self, owner: Address) -> U256;\n fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\nuse odra::{\n Address, casper_types::U256, \n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: SubModule,\n erc20: SubModule,\n exchange: SubModule\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n fn swap(&mut self, sender: Address, recipient: Address);\n fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1d854f2b.7ee594a4.js b/docs/assets/js/1d854f2b.7ee594a4.js new file mode 100644 index 000000000..4db25663c --- /dev/null +++ b/docs/assets/js/1d854f2b.7ee594a4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53230],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(a),m=r,f=c["".concat(l,".").concat(m)]||c[m]||d[m]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=c;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.8.1/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.8.1/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.8.1/basics/storage-interaction",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.8.1/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.8.1/basics/communicating-with-host"}},l={},p=[{value:"Var",id:"var",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"var"},"Var"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Var,\n weight: Var,\n name: Var,\n walks: Var>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::Var;\n\n#[odra::module]\nimpl DogContract {\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is used to store and access data as key-value pairs. To define a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{Mapping, Var};\n\n#[odra::module]\npub struct DogContract2 {\n name: Var,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," we use a similar approach\nto the one shown in the Vars section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Var working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{List, Var};\n\npub struct List {\n values: Mapping,\n index: Var\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Var,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the Odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/features/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1dd27823.0ecd9d7e.js b/docs/assets/js/1dd27823.0ecd9d7e.js new file mode 100644 index 000000000..624a8eb74 --- /dev/null +++ b/docs/assets/js/1dd27823.0ecd9d7e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[31529],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=l(n),d=o,f=p["".concat(c,".").concat(d)]||p[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.9.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.9.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.9.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.9.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.9.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],u={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module]\npub struct HostContract {\n name: Var,\n created_at: Var,\n created_by: Var
\n}\n\n#[odra::module]\nimpl HostContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(self.env().get_block_time());\n self.created_by.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"self.env()"),". It is an implementation of ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/module/trait.Module.html#tymehtod.env"},(0,o.kt)("inlineCode",{parentName:"a"},"Module::env()")),", autogenerated\nby ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The function returns a reference to the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/struct.ContractEnv.html"},(0,o.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," (you can read more in\nthe ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/what-is-a-backend#contract-env"},(0,o.kt)("inlineCode",{parentName:"a"},"Backend section")),"). This is a structure that provides access to the host functions and variables. "),(0,o.kt)("p",null,"In this example, we use two of them:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"get_block_time()")," - returns the current block time as u64. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"caller()")," - returns an Odra ",(0,o.kt)("inlineCode",{parentName:"li"},"Address")," of the caller (this can be an external caller or another contract).")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1e877671.1c98356b.js b/docs/assets/js/1e877671.1c98356b.js new file mode 100644 index 000000000..4aafeb865 --- /dev/null +++ b/docs/assets/js/1e877671.1c98356b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37139],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||o;return t?r.createElement(f,s(s({ref:n},u),{},{components:t})):r.createElement(f,s({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var d=2;d{t.d(n,{Z:()=>s});var r=t(67294),a=t(86010);const o="tabItem_Ymn6";function s(e){let{children:n,hidden:t,className:s}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(o,s),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>y});var r=t(87462),a=t(67294),o=t(86010),s=t(12466),l=t(16550),i=t(91980),d=t(67392),u=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(o),(0,a.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function v(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=c(e),[s,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[i,d]=f({queryString:t,groupId:r}),[p,v]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,u.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:o})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:s,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),v(e)}),[d,v,o]),tabValues:o}}var g=t(72389);const h="tabList__CuJ",k="tabItem_LNqP";function b(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:d}=e;const u=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),c=e=>{const n=e.currentTarget,t=u.indexOf(n),r=d[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;n=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;n=u[t]??u[u.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},n)},d.map((e=>{let{value:n,label:t,attributes:s}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>u.push(e),onKeyDown:m,onClick:c},s,{className:(0,o.Z)("tabs__item",k,s?.className,{"tabs__item--active":l===n})}),t??n)})))}function _(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function N(e){const n=v(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",h)},a.createElement(b,(0,r.Z)({},e,n)),a.createElement(_,(0,r.Z)({},e,n)))}function y(e){const n=(0,g.Z)();return a.createElement(N,(0,r.Z)({key:String(n)},e))}},72865:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),o=t(74866),s=t(85162);const l={sidebar_position:1,description:"Migration guide to v0.8.0"},i="Migration guide to v0.8.0",d={unversionedId:"migrations/to-0.8.0",id:"version-1.0.0/migrations/to-0.8.0",title:"Migration guide to v0.8.0",description:"Migration guide to v0.8.0",source:"@site/versioned_docs/version-1.0.0/migrations/to-0.8.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.8.0",permalink:"/docs/migrations/to-0.8.0",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Migration guide to v0.8.0"},sidebar:"tutorialSidebar",previous:{title:"Migrations",permalink:"/docs/category/migrations"},next:{title:"Migration guide to v0.9.0",permalink:"/docs/migrations/to-0.9.0"}},u={},p=[{value:"1. Prerequisites",id:"1-prerequisites",level:2},{value:"1.1. Update cargo-odra",id:"11-update-cargo-odra",level:3},{value:"1.2. Review the Changelog",id:"12-review-the-changelog",level:3},{value:"2. Migration Steps",id:"2-migration-steps",level:2},{value:"2.1 Add bin directory",id:"21-add-bin-directory",level:3},{value:"2.2. Update Cargo.toml",id:"22-update-cargotoml",level:3},{value:"2.2. Update Odra.toml",id:"22-update-odratoml",level:3},{value:"2.3. Update Smart Contracts",id:"23-update-smart-contracts",level:3},{value:"2.3.1. Update the use statements to reflect the new module structure.",id:"231-update-the-use-statements-to-reflect-the-new-module-structure",level:4},{value:"2.3.2. Some type aliases are no longer in use.",id:"232-some-type-aliases-are-no-longer-in-use",level:4},{value:"2.3.3. Consider import odra::prelude::* in your module files.",id:"233-consider-import-odraprelude-in-your-module-files",level:4},{value:"2.3.4. Flatten nested Mappings.",id:"234-flatten-nested-mappings",level:4},{value:"2.3.5. Update errors definitions.",id:"235-update-errors-definitions",level:4},{value:"2.3.6. Update events definitions.",id:"236-update-events-definitions",level:4},{value:"2.3.7. Replace contract_env with self.env() in your modules.",id:"237-replace-contract_env-with-selfenv-in-your-modules",level:4},{value:"2.3.8. Wrap submodules of your module with odra::SubModule<T>.",id:"238-wrap-submodules-of-your-module-with-odrasubmodulet",level:4},{value:"2.3.9. Update external contract calls.",id:"239-update-external-contract-calls",level:4},{value:"2.3.10. Update constructors.",id:"2310-update-constructors",level:4},{value:"2.3.11. Update UnwrapOrRevert calls.",id:"2311-update-unwraporrevert-calls",level:4},{value:"2.3.12. Remove #[odra(using)] attribute from your module definition.",id:"2312-remove-odrausing-attribute-from-your-module-definition",level:4},{value:"2.4. Update Tests",id:"24-update-tests",level:3},{value:"2.4.1. Contract deployment.",id:"241-contract-deployment",level:4},{value:"2.4.2. Host interactions.",id:"242-host-interactions",level:4},{value:"2.4.3. Testing failing scenarios.",id:"243-testing-failing-scenarios",level:4},{value:"2.4.4. Testing events.",id:"244-testing-events",level:4},{value:"3. Code Examples",id:"3-code-examples",level:2},{value:"4. Troubleshooting",id:"4-troubleshooting",level:2},{value:"5. References",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v080"},"Migration guide to v0.8.0"),(0,a.kt)("p",null,"Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version."),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant changes in v0.8.0 include:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only."),(0,a.kt)("li",{parentName:"ul"},"Framework internals redesign.")),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.8.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-add-bin-directory"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Add bin directory")),(0,a.kt)("p",null,"Odra 0.8.0 introduces a new way to build smart contracts. The ",(0,a.kt)("inlineCode",{parentName:"p"},".builder_casper")," directory is no longer used. Instead, you should create a new directory called ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," in the root of your project and add the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files to the ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," directory."),(0,a.kt)("p",null,"You can find the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-cargotoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Cargo.toml")),(0,a.kt)("p",null,"There a bunch of changes in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"You don't have to specify the features anymore - remove the ",(0,a.kt)("inlineCode",{parentName:"li"},"features")," section and ",(0,a.kt)("inlineCode",{parentName:"li"},"default-features")," flag from the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra")," dependency."),(0,a.kt)("li",{parentName:"ul"},"Register bins you added in the previous step."),(0,a.kt)("li",{parentName:"ul"},"Add ",(0,a.kt)("inlineCode",{parentName:"li"},"dev-dependencies")," section with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra-test")," crate."),(0,a.kt)("li",{parentName:"ul"},"Add recommended profiles for ",(0,a.kt)("inlineCode",{parentName:"li"},"release")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," to optimize the build process.")),(0,a.kt)("p",null,"Below you can compare the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file after and before the migration to v0.8.0:"),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.7.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')))),(0,a.kt)("h3",{id:"22-update-odratoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Odra.toml")),(0,a.kt)("p",null,"Due to the changes in cargo-odra, the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file has been simplified. The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," property is no longer required."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "my_project::Flipper"\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "my_project::Flipper"\n')))),(0,a.kt)("h3",{id:"23-update-smart-contracts"},"2.3. ",(0,a.kt)("strong",{parentName:"h3"},"Update Smart Contracts")),(0,a.kt)("p",null,"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"231-update-the-use-statements-to-reflect-the-new-module-structure"},"2.3.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update the ",(0,a.kt)("inlineCode",{parentName:"strong"},"use")," statements to reflect the new module structure.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Big integer types are now located in the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types")," module."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::Address")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::Address"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Variable")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::contract_env"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::OdraType")," as it is no longer required."),(0,a.kt)("li",{parentName:"ul"},"Change ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::casper_types::*;")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::*;"),".")),(0,a.kt)("h4",{id:"232-some-type-aliases-are-no-longer-in-use"},"2.3.2. ",(0,a.kt)("strong",{parentName:"h4"},"Some type aliases are no longer in use.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Balance")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::U512"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BlockTime")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"EventData")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::bytesrepr::Bytes"),".")),(0,a.kt)("h4",{id:"233-consider-import-odraprelude-in-your-module-files"},"2.3.3. ",(0,a.kt)("strong",{parentName:"h4"},"Consider import ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::prelude::*")," in your module files.")),(0,a.kt)("h4",{id:"234-flatten-nested-mappings"},"2.3.4. ",(0,a.kt)("strong",{parentName:"h4"},"Flatten nested ",(0,a.kt)("inlineCode",{parentName:"strong"},"Mapping"),"s.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// Before\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping>\n}\n// After\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("h4",{id:"235-update-errors-definitions"},"2.3.5. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::execution_error;\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n}\n")))),(0,a.kt)("h4",{id:"236-update-events-definitions"},"2.3.6. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nself.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n});\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nuse odra::types::event::OdraEvent;\n\nTransfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n}.emit();\n")))),(0,a.kt)("h4",{id:"237-replace-contract_env-with-selfenv-in-your-modules"},"2.3.7. ",(0,a.kt)("strong",{parentName:"h4"},"Replace ",(0,a.kt)("inlineCode",{parentName:"strong"},"contract_env")," with ",(0,a.kt)("inlineCode",{parentName:"strong"},"self.env()")," in your modules.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"self.env()")," is a new way to access the contract environment, returns a reference to ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),". The API is similar to the previous ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env")," but with some changes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_var(key: &[u8]) -> Option")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn get_value(&self, key: &[u8]) -> Option"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_var(key: &[u8], value: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn set_value(&self, key: &[u8], value: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"set_dict_value()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_dict_value()")," has been removed. All the dictionary operations should be performed using ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," type, internally using ",(0,a.kt)("inlineCode",{parentName:"li"},"set_var()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_var()")," functions. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn hash>(input: T) -> Vec")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn hash(&self, value: T) -> [u8; 32]"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(error: E) -> !")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(&self, error: E) -> !"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(event: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(&self, event: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option) -> T")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(&self, address: Address, call: CallDef) -> T"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"native_token_metadata()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"one_token()")," have been removed.")),(0,a.kt)("h4",{id:"238-wrap-submodules-of-your-module-with-odrasubmodulet"},"2.3.8. ",(0,a.kt)("strong",{parentName:"h4"},"Wrap submodules of your module with ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::SubModule"),".")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: SubModule,\n metadata: SubModule,\n ownable: SubModule\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: Erc721Base,\n metadata: Erc721MetadataExtension,\n ownable: Ownable\n}\n")))),(0,a.kt)("h4",{id:"239-update-external-contract-calls"},"2.3.9. ",(0,a.kt)("strong",{parentName:"h4"},"Update external contract calls.")),(0,a.kt)("p",null,"However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref"),") and you can call it using ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env, address)")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref::at()"),")."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenContractRef::new(env, token).balance_of(account)\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenRef::at(token).balance_of(account)\n")))),(0,a.kt)("h4",{id:"2310-update-constructors"},"2.3.10. ",(0,a.kt)("strong",{parentName:"h4"},"Update constructors.")),(0,a.kt)("p",null,"Remove the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::init]")," attribute from the constructor and ensure that the constructor function is named ",(0,a.kt)("inlineCode",{parentName:"p"},"init"),"."),(0,a.kt)("h4",{id:"2311-update-unwraporrevert-calls"},"2.3.11. ",(0,a.kt)("strong",{parentName:"h4"},"Update ",(0,a.kt)("inlineCode",{parentName:"strong"},"UnwrapOrRevert")," calls.")),(0,a.kt)("p",null,"The functions ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," now require ",(0,a.kt)("inlineCode",{parentName:"p"},"&HostEnv")," as the first parameter."),(0,a.kt)("h4",{id:"2312-remove-odrausing-attribute-from-your-module-definition"},"2.3.12. ",(0,a.kt)("strong",{parentName:"h4"},"Remove ",(0,a.kt)("inlineCode",{parentName:"strong"},"#[odra(using)]")," attribute from your module definition.")),(0,a.kt)("p",null,"Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required."),(0,a.kt)("h3",{id:"24-update-tests"},"2.4. ",(0,a.kt)("strong",{parentName:"h3"},"Update Tests")),(0,a.kt)("p",null,"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"241-contract-deployment"},"2.4.1. ",(0,a.kt)("strong",{parentName:"h4"},"Contract deployment.")),(0,a.kt)("p",null,"The way you deploy a contract has changed:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef::deploy(&env, args)")," instead of ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}Deployer::init()"),". The ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef")," implements ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer"),"."),(0,a.kt)("li",{parentName:"ol"},"Instantiate the ",(0,a.kt)("inlineCode",{parentName:"li"},"HostEnv")," using ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),", required by the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract doesn't have init args, you should use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract has init args, you should pass the autogenerated ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableHostRef;\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\nlet env: HostEnv = odra_test::env();\nlet ownable = OwnableHostRef::deploy(&env, NoArgs)\n\n// A contract with init args\nuse super::{Erc20HostRef, Erc20InitArgs};\nuse odra::host::{Deployer, HostEnv};\n\nlet env: HostEnv = odra_test::env();\nlet init_args = Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n};\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableDeployer;\n\nlet ownable = OwnableDeployer::init();\n\n// A contract with init args\nlet erc20 = Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n);\n")))),(0,a.kt)("h4",{id:"242-host-interactions"},"2.4.2. ",(0,a.kt)("strong",{parentName:"h4"},"Host interactions.")),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Replace ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),"."),(0,a.kt)("li",{parentName:"ol"},"The API of ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()")," are similar, but there are some differences:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::advance_block_time_by(BlockTime)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.advance_block_time(u64)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::token_balance(Address)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.balance_of(&Address)"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_cost()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_used()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::total_gas_used(Address)"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::gas_report()")," have been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef::last_call()")," and extract the data from a ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::ContractCallResult")," instance. ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef")," is a trait implemented by ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef"),".")))),(0,a.kt)("h4",{id:"243-testing-failing-scenarios"},"2.4.3. ",(0,a.kt)("strong",{parentName:"h4"},"Testing failing scenarios.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"test_env::assert_exception()")," has been removed. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix to call the function and then assert the result.\n",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix is a new way to call a function that might fail. It returns a ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult"))," type, which you can then assert using the standard Rust ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n let (env, mut erc20) = setup();\n\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n assert_eq!(\n erc20.try_transfer_from(owner, recipient, amount),\n Err(Error::InsufficientAllowance.into())\n );\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n test_env::assert_exception(Error::InsufficientAllowance, || {\n let mut erc20 = setup();\n\n let (owner, spender, recipient) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let amount = 1_000.into();\n test_env::set_caller(spender);\n\n erc20.transfer_from(&owner, &recipient, &amount)\n });\n}\n")))),(0,a.kt)("h4",{id:"244-testing-events"},"2.4.4. ",(0,a.kt)("strong",{parentName:"h4"},"Testing events.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," macro has been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv::emitted_event()")," to assert the emitted events.\nThe new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation to explore the available options."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let env: HostEnv = odra_test::env();\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n\n...\n\nassert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n));\nassert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n));\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let erc20 = Erc20HostDeployer::init(&env, ...);\n\n...\n\nassert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n);\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.8.0."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20HostRef, Erc20InitArgs\n };\n use odra::{\n casper_types::U256,\n host::{Deployer, HostEnv, HostRef},\n prelude::*\n };\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n // Other tests...\n}\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use odra::prelude::string::String;\nuse odra::{\n contract_env,\n types::{event::OdraEvent, Address, U256},\n Mapping, UnwrapOrRevert, Variable\n};\n\nuse self::{\n errors::Error,\n events::{Approval, Transfer}\n};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n\n#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: &Option\n ) {\n let caller = contract_env::caller();\n\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = *initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n }\n .emit();\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = contract_env::caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = contract_env::caller();\n\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn name(&self) -> String {\n self.name.get().unwrap_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n contract_env::revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n }\n .emit();\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n contract_env::revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n self.allowances\n .get_instance(owner)\n .subtract(spender, *amount);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\npub mod events {\n use odra::types::{casper_types::U256, Address};\n use odra::Event;\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::execution_error;\n\n execution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20Deployer, Erc20Ref\n };\n use odra::prelude::string::ToString;\n use odra::{assert_events, test_env, types::casper_types::U256};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let erc20 = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When transfer tokens to a recipient.\n let sender = test_env::get_account(0);\n let recipient = test_env::get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n test_env::assert_exception(Error::InsufficientBalance, || {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n erc20.transfer(&recipient, &amount)\n });\n }\n\n // Other tests...\n}\n')))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/1f63a7a5.d372f3bd.js b/docs/assets/js/1f63a7a5.d372f3bd.js new file mode 100644 index 000000000..9f6ed3936 --- /dev/null +++ b/docs/assets/js/1f63a7a5.d372f3bd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[55914],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),c=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=c(e.components);return r.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(t),m=a,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return t?r.createElement(f,s(s({ref:n},p),{},{components:t})):r.createElement(f,s({ref:n},p))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var c=2;c{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var r=t(87462),a=(t(67294),t(3905));const o={sidebar_position:3},s="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.2.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.2.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.2.0/tutorials/erc20",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"defaultSidebar",previous:{title:"Ownable",permalink:"/docs/0.2.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.2.0/tutorials/owned-token"}},i={},c=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"erc-20"},"ERC-20"),(0,a.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,a.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,a.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value. "),(0,a.kt)("h2",{id:"framework-features"},"Framework features"),(0,a.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"advanced storage - key-value pairs, "),(0,a.kt)("li",{parentName:"ul"},"Odra types like ",(0,a.kt)("inlineCode",{parentName:"li"},"Address")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"Balance"),", "),(0,a.kt)("li",{parentName:"ul"},"advanced events assertion.")),(0,a.kt)("h2",{id:"code"},"Code"),(0,a.kt)("p",null,"Our module has a pretty complex storage layout in comparison to the previous example."),(0,a.kt)("p",null,"We need to store the following data:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol and decimals."),(0,a.kt)("li",{parentName:"ol"},"Total supply."),(0,a.kt)("li",{parentName:"ol"},"Users' balances."),(0,a.kt)("li",{parentName:"ol"},"Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.")),(0,a.kt)("h2",{id:"module-definition"},"Module definition"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping<(Address, Address), Balance>\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L6")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,a.kt)("inlineCode",{parentName:"li"},"mapping"),". You may notice the ",(0,a.kt)("inlineCode",{parentName:"li"},"balances")," property maps ",(0,a.kt)("inlineCode",{parentName:"li"},"Address")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"Balance"),". If you deal with addresses or you operate on tokens, you should always choose ",(0,a.kt)("inlineCode",{parentName:"li"},"Address")," over ",(0,a.kt)("inlineCode",{parentName:"li"},"String")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"Balance")," over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L7")," - Odra does not allow nested ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),"s, but you can overcome it using a tuple as a key.")),(0,a.kt)("h3",{id:"metadata"},"Metadata"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: Balance) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(caller, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: Address, amount: Balance) {\n self.balances.add(&address, amount);\n self.total_supply.add(amount);\n Transfer {\n from: None,\n to: Some(address),\n amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: Balance\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L3-L10")," - A constructor sets the token metadata and mints the initial supply."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L12-L14")," - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the ",(0,a.kt)("inlineCode",{parentName:"li"},"Ownable")," example, we used the ",(0,a.kt)("inlineCode",{parentName:"li"},"get()")," function returning an ",(0,a.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements ",(0,a.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call ",(0,a.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function and the contract does not fail even if the value is not initialized."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L29")," - The second ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," is not an odra module, in other words these function will not be a part of contract's ABI."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L30-L39")," - Mint function is public, so like in a regular rust code will be accessible from the outside. ",(0,a.kt)("inlineCode",{parentName:"li"},"mint()")," use notation ",(0,a.kt)("inlineCode",{parentName:"li"},"self.balances.add(&address, amount);"),", which it is syntactic sugar for:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let current_balance = self.balances.get(&address).unwrap_or_default();\nlet new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();\nself.balances.set(&address, new_balance);\n")),(0,a.kt)("h3",{id:"core"},"Core"),(0,a.kt)("p",null,"For the sake of completeness, let's implement the remaining functionalities like ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer_from"),", or ",(0,a.kt)("inlineCode",{parentName:"p"},"approve"),". They are not introducing any new concepts, so we leave them without additional remarks."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs",title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n let caller = contract_env::caller();\n self.raw_transfer(caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n let spender = contract_env::caller();\n self.spend_allowance(owner, spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n let owner = contract_env::caller();\n self.allowances.set(&(owner, spender), amount);\n Approval {\n owner,\n spender,\n value: amount\n }\n .emit();\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.allowances.get_or_default(&(owner, spender))\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: Address, recipient: Address, amount: U256) {\n let owner_balance = self.balances.get_or_default(&owner);\n if amount > owner_balance {\n contract_env::revert(Error::InsufficientBalance)\n }\n self.balances.set(&owner, owner_balance - amount);\n self.balances.add(&recipient, amount);\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: Address, spender: Address, amount: U256) {\n let key = (owner, spender);\n let allowance = self.allowances.get_or_default(&key);\n if allowance < amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n self.allowances.set(&key, allowance - amount);\n Approval {\n owner,\n spender,\n value: allowance - amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,a.kt)("p",null,"Now, compare the code we have written, with ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,a.kt)("h3",{id:"test"},"Test"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20rs showLineNumbers",title:"erc20rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};\n use odra::{assert_events, test_env, types::U256};\n\n pub const NAME: &str = "Plascoin";\n pub const SYMBOL: &str = "PLS";\n pub const DECIMALS: u8 = 10;\n pub const INITIAL_SUPPLY: u32 = 10_000;\n\n pub fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n String::from(NAME),\n String::from(SYMBOL),\n DECIMALS,\n INITIAL_SUPPLY.into()\n )\n }\n\n #[test]\n fn initialization() {\n let erc20 = setup();\n\n assert_eq!(&erc20.symbol(), SYMBOL);\n assert_eq!(&erc20.name(), NAME);\n assert_eq!(erc20.decimals(), DECIMALS);\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n let mut erc20 = setup();\n let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n erc20.transfer(recipient, amount);\n\n assert_eq!(\n erc20.balance_of(sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n assert_eq!(erc20.balance_of(recipient), amount);\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n let erc20 = setup();\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);\n\n test_env::assert_exception(Error::InsufficientBalance, || {\n // If we don\'t create a new ref, an error occurs:\n // cannot borrow `erc20` as mutable, as it is a captured variable \n // in a `Fn` closure cannot borrow as mutable\n let mut erc20 = Erc20Ref::at(erc20.address());\n erc20.transfer(recipient, amount)\n });\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let mut erc20 = setup();\n let (owner, recipient, spender) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n // Owner approves Spender.\n erc20.approve(spender, approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(owner, spender), approved_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount\n }\n );\n\n // Spender transfers tokens from Owner to Recipient.\n test_env::set_caller(spender);\n erc20.transfer_from(owner, recipient, transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(recipient), transfer_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n );\n \n assert_events!(erc20, Approval, Transfer);\n }\n\n #[test]\n fn transfer_from_error() {\n let erc20 = setup();\n let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n test_env::set_caller(spender);\n test_env::assert_exception(Error::InsufficientAllowance, || {\n // If we don\'t create a new ref, an error occurs:\n // cannot borrow `erc20` as mutable, as it is a captured variable \n // in a `Fn` closure cannot borrow as mutable\n let mut erc20 = Erc20Ref::at(erc20.address());\n erc20.transfer_from(owner, spender, amount)\n });\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L111-123")," - ",(0,a.kt)("inlineCode",{parentName:"li"},"assert_events!()")," macro accepts multiple events. You must pass them in the order they were emitted. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L125")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},"You can not mix both approaches, you pass full events or types only.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Having two modules: ",(0,a.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/2033cf69.7fc7f3bc.js b/docs/assets/js/2033cf69.7fc7f3bc.js new file mode 100644 index 000000000..dbf72c828 --- /dev/null +++ b/docs/assets/js/2033cf69.7fc7f3bc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67808],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return a?n.createElement(g,l(l({ref:t},c),{},{components:a})):n.createElement(g,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.9.1/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.9.1/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.9.1/getting-started/installation",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.9.1/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.9.1/getting-started/flipper"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-unknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --locked\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,r.kt)("p",null,"This will create a new folder called ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," and initialize Odra there. Cargo Odra\nwill create a sample contract for you in ",(0,r.kt)("inlineCode",{parentName:"p"},"src")," directory. You can run the tests of this contract\nby executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/208794bf.72cd6324.js b/docs/assets/js/208794bf.72cd6324.js new file mode 100644 index 000000000..2448706eb --- /dev/null +++ b/docs/assets/js/208794bf.72cd6324.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11172],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>g});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),c=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=c(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(t),g=r,m=u["".concat(p,".").concat(g)]||u[g]||d[g]||i;return t?a.createElement(m,o(o({ref:n},l),{},{components:t})):a.createElement(m,o({ref:n},l))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const i={},o="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.3.1/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.3.1/advanced/03-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.3.1/advanced/advanced-storage",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.3.1/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.3.1/advanced/attributes"}},p={},c=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],l={toc:c};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Variable"),": A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The Sequence in Odra is a basic module that holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + OdraType\n{\n value: Variable\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/mapping.rs"',title:'"examples/mapping.rs"'},"use odra::{map, types::U256, Mapping, UnwrapOrRevert};\n\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct NestedMapping {\n strings: Mapping>>,\n tokens: Mapping>>\n}\n\n#[odra::module]\nimpl NestedMapping {\n\n ...\n\n pub fn set_token(\n &mut self,\n key1: String,\n key2: u32,\n key3: String,\n token_name: String,\n decimals: u8,\n symbol: String,\n initial_supply: &U256\n ) {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .init(token_name, symbol, decimals, initial_supply);\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let mapping = self.strings.get_instance(&key1).get_instance(&key2);\n mapping.get(&key3).unwrap_or_revert()\n }\n\n pub fn total_supply(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> U256 {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .total_supply()\n }\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers. "),(0,r.kt)("p",{parentName:"admonition"},"Instead of using the ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()"),", which sets the correct namespace for nested modules.")),(0,r.kt)("p",null,"If the terminal value is deeply nested, a long chain of ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()")," calls is required."),(0,r.kt)("p",null,"To keep the codebase consistent, a ",(0,r.kt)("inlineCode",{parentName:"p"},"map!")," macro can be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/mapping.rs"',title:'"examples/mapping.rs"'},"...\n\npub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {\n map!(self.strings[key1][key2][key3] = value);\n}\n\npub fn get_string_macro(\n &self, \n key1: String, \n key2: u32, \n key3: String\n) -> String {\n map!(self.strings[key1][key2][key3])\n}\n\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The terminal value must not be an Odra Module.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Sequence, Mapping};\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n my_sequence: Sequence,\n my_mapping: Mapping>,\n}\n\nimpl AdvancedStorage {\n pub fn get_sequence_current_value(&self) -> u32 {\n self.my_sequence.get_current_value()\n }\n\n pub fn next_sequence_value(&mut self) -> u32 {\n self.my_sequence.next_value()\n }\n\n pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.set(&inner_key, value);\n }\n\n pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.get(&inner_key)\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/209.7bb508af.js b/docs/assets/js/209.7bb508af.js new file mode 100644 index 000000000..bc36d56c2 --- /dev/null +++ b/docs/assets/js/209.7bb508af.js @@ -0,0 +1,7344 @@ +exports.id = 209; +exports.ids = [209]; +exports.modules = { + +/***/ 17295: +/***/ ((module) => { + +(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$defaultLayoutOpt = _ref.defaultLayoutOptions, + defaultLayoutOptions = _ref$defaultLayoutOpt === undefined ? {} : _ref$defaultLayoutOpt, + _ref$algorithms = _ref.algorithms, + algorithms = _ref$algorithms === undefined ? ['layered', 'stress', 'mrtree', 'radial', 'force', 'disco', 'sporeOverlap', 'sporeCompaction', 'rectpacking'] : _ref$algorithms, + workerFactory = _ref.workerFactory, + workerUrl = _ref.workerUrl; + + _classCallCheck(this, ELK); + + this.defaultLayoutOptions = defaultLayoutOptions; + this.initialized = false; + + // check valid worker construction possible + if (typeof workerUrl === 'undefined' && typeof workerFactory === 'undefined') { + throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'."); + } + var factory = workerFactory; + if (typeof workerUrl !== 'undefined' && typeof workerFactory === 'undefined') { + // use default Web Worker + factory = function factory(url) { + return new Worker(url); + }; + } + + // create the worker + var worker = factory(workerUrl); + if (typeof worker.postMessage !== 'function') { + throw new TypeError("Created worker does not provide" + " the required 'postMessage' function."); + } + + // wrap the worker to return promises + this.worker = new PromisedWorker(worker); + + // initially register algorithms + this.worker.postMessage({ + cmd: 'register', + algorithms: algorithms + }).then(function (r) { + return _this.initialized = true; + }).catch(console.err); + } + + _createClass(ELK, [{ + key: 'layout', + value: function layout(graph) { + var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref2$layoutOptions = _ref2.layoutOptions, + layoutOptions = _ref2$layoutOptions === undefined ? this.defaultLayoutOptions : _ref2$layoutOptions, + _ref2$logging = _ref2.logging, + logging = _ref2$logging === undefined ? false : _ref2$logging, + _ref2$measureExecutio = _ref2.measureExecutionTime, + measureExecutionTime = _ref2$measureExecutio === undefined ? false : _ref2$measureExecutio; + + if (!graph) { + return Promise.reject(new Error("Missing mandatory parameter 'graph'.")); + } + return this.worker.postMessage({ + cmd: 'layout', + graph: graph, + layoutOptions: layoutOptions, + options: { + logging: logging, + measureExecutionTime: measureExecutionTime + } + }); + } + }, { + key: 'knownLayoutAlgorithms', + value: function knownLayoutAlgorithms() { + return this.worker.postMessage({ cmd: 'algorithms' }); + } + }, { + key: 'knownLayoutOptions', + value: function knownLayoutOptions() { + return this.worker.postMessage({ cmd: 'options' }); + } + }, { + key: 'knownLayoutCategories', + value: function knownLayoutCategories() { + return this.worker.postMessage({ cmd: 'categories' }); + } + }, { + key: 'terminateWorker', + value: function terminateWorker() { + this.worker.terminate(); + } + }]); + + return ELK; +}(); + +exports.default = ELK; + +var PromisedWorker = function () { + function PromisedWorker(worker) { + var _this2 = this; + + _classCallCheck(this, PromisedWorker); + + if (worker === undefined) { + throw new Error("Missing mandatory parameter 'worker'."); + } + this.resolvers = {}; + this.worker = worker; + this.worker.onmessage = function (answer) { + // why is this necessary? + setTimeout(function () { + _this2.receive(_this2, answer); + }, 0); + }; + } + + _createClass(PromisedWorker, [{ + key: 'postMessage', + value: function postMessage(msg) { + var id = this.id || 0; + this.id = id + 1; + msg.id = id; + var self = this; + return new Promise(function (resolve, reject) { + // prepare the resolver + self.resolvers[id] = function (err, res) { + if (err) { + self.convertGwtStyleError(err); + reject(err); + } else { + resolve(res); + } + }; + // post the message + self.worker.postMessage(msg); + }); + } + }, { + key: 'receive', + value: function receive(self, answer) { + var json = answer.data; + var resolver = self.resolvers[json.id]; + if (resolver) { + delete self.resolvers[json.id]; + if (json.error) { + resolver(json.error); + } else { + resolver(null, json.data); + } + } + } + }, { + key: 'terminate', + value: function terminate() { + if (this.worker.terminate) { + this.worker.terminate(); + } + } + }, { + key: 'convertGwtStyleError', + value: function convertGwtStyleError(err) { + if (!err) { + return; + } + // Somewhat flatten the way GWT stores nested exception(s) + var javaException = err['__java$exception']; + if (javaException) { + // Note that the property name of the nested exception is different + // in the non-minified ('cause') and the minified (not deterministic) version. + // Hence, the version below only works for the non-minified version. + // However, as the minified stack trace is not of much use anyway, one + // should switch the used version for debugging in such a case. + if (javaException.cause && javaException.cause.backingJsObject) { + err.cause = javaException.cause.backingJsObject; + this.convertGwtStyleError(err.cause); + } + delete err['__java$exception']; + } + } + }]); + + return PromisedWorker; +}(); +},{}],2:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +// -------------- FAKE ELEMENTS GWT ASSUMES EXIST -------------- +var $wnd; +if (typeof window !== 'undefined') + $wnd = window +else if (typeof global !== 'undefined') + $wnd = global // nodejs +else if (typeof self !== 'undefined') + $wnd = self // web worker + +var $moduleName, + $moduleBase; + +// -------------- WORKAROUND STRICT MODE, SEE #127 -------------- +var g, i, o; + +// -------------- GENERATED CODE -------------- +function nb(){} +function xb(){} +function Fd(){} +function $g(){} +function _p(){} +function yq(){} +function Sq(){} +function Es(){} +function Jw(){} +function Vw(){} +function VA(){} +function dA(){} +function MA(){} +function PA(){} +function PB(){} +function bx(){} +function cx(){} +function vy(){} +function Nz(){} +function Yz(){} +function Ylb(){} +function Ymb(){} +function xmb(){} +function Fmb(){} +function Qmb(){} +function gcb(){} +function ccb(){} +function jcb(){} +function jtb(){} +function otb(){} +function qtb(){} +function _fb(){} +function bpb(){} +function kpb(){} +function ppb(){} +function Gpb(){} +function drb(){} +function dzb(){} +function fzb(){} +function fxb(){} +function Vxb(){} +function Ovb(){} +function byb(){} +function zyb(){} +function Zyb(){} +function _yb(){} +function hzb(){} +function jzb(){} +function lzb(){} +function nzb(){} +function rzb(){} +function zzb(){} +function Czb(){} +function Ezb(){} +function Gzb(){} +function Izb(){} +function Mzb(){} +function bBb(){} +function NBb(){} +function PBb(){} +function RBb(){} +function iCb(){} +function OCb(){} +function SCb(){} +function GDb(){} +function JDb(){} +function fEb(){} +function xEb(){} +function CEb(){} +function GEb(){} +function yFb(){} +function KGb(){} +function tIb(){} +function vIb(){} +function xIb(){} +function zIb(){} +function OIb(){} +function SIb(){} +function TJb(){} +function VJb(){} +function XJb(){} +function XKb(){} +function fKb(){} +function VKb(){} +function VLb(){} +function jLb(){} +function nLb(){} +function GLb(){} +function KLb(){} +function MLb(){} +function OLb(){} +function RLb(){} +function YLb(){} +function bMb(){} +function gMb(){} +function lMb(){} +function pMb(){} +function wMb(){} +function zMb(){} +function CMb(){} +function FMb(){} +function LMb(){} +function zNb(){} +function PNb(){} +function kOb(){} +function pOb(){} +function tOb(){} +function yOb(){} +function FOb(){} +function GPb(){} +function aQb(){} +function cQb(){} +function eQb(){} +function gQb(){} +function iQb(){} +function CQb(){} +function MQb(){} +function OQb(){} +function ASb(){} +function fTb(){} +function kTb(){} +function STb(){} +function fUb(){} +function DUb(){} +function VUb(){} +function YUb(){} +function _Ub(){} +function _Wb(){} +function QWb(){} +function XWb(){} +function jVb(){} +function DVb(){} +function VVb(){} +function $Vb(){} +function dXb(){} +function hXb(){} +function lXb(){} +function gYb(){} +function HYb(){} +function SYb(){} +function VYb(){} +function dZb(){} +function P$b(){} +function T$b(){} +function h1b(){} +function m1b(){} +function q1b(){} +function u1b(){} +function y1b(){} +function C1b(){} +function e2b(){} +function g2b(){} +function m2b(){} +function q2b(){} +function u2b(){} +function S2b(){} +function U2b(){} +function W2b(){} +function _2b(){} +function e3b(){} +function h3b(){} +function p3b(){} +function t3b(){} +function w3b(){} +function y3b(){} +function A3b(){} +function M3b(){} +function Q3b(){} +function U3b(){} +function Y3b(){} +function l4b(){} +function q4b(){} +function s4b(){} +function u4b(){} +function w4b(){} +function y4b(){} +function L4b(){} +function N4b(){} +function P4b(){} +function R4b(){} +function T4b(){} +function X4b(){} +function I5b(){} +function Q5b(){} +function T5b(){} +function Z5b(){} +function l6b(){} +function o6b(){} +function t6b(){} +function z6b(){} +function L6b(){} +function M6b(){} +function P6b(){} +function X6b(){} +function $6b(){} +function a7b(){} +function c7b(){} +function g7b(){} +function j7b(){} +function m7b(){} +function r7b(){} +function x7b(){} +function D7b(){} +function D9b(){} +function b9b(){} +function h9b(){} +function j9b(){} +function l9b(){} +function w9b(){} +function F9b(){} +function hac(){} +function jac(){} +function pac(){} +function uac(){} +function Iac(){} +function Kac(){} +function Sac(){} +function obc(){} +function rbc(){} +function vbc(){} +function Fbc(){} +function Jbc(){} +function Xbc(){} +function ccc(){} +function fcc(){} +function lcc(){} +function occ(){} +function tcc(){} +function ycc(){} +function Acc(){} +function Ccc(){} +function Ecc(){} +function Gcc(){} +function Zcc(){} +function _cc(){} +function bdc(){} +function fdc(){} +function jdc(){} +function pdc(){} +function sdc(){} +function ydc(){} +function Adc(){} +function Cdc(){} +function Edc(){} +function Idc(){} +function Ndc(){} +function Qdc(){} +function Sdc(){} +function Udc(){} +function Wdc(){} +function Ydc(){} +function aec(){} +function hec(){} +function jec(){} +function lec(){} +function nec(){} +function uec(){} +function wec(){} +function yec(){} +function Aec(){} +function Fec(){} +function Jec(){} +function Lec(){} +function Nec(){} +function Rec(){} +function Uec(){} +function Zec(){} +function Zfc(){} +function lfc(){} +function tfc(){} +function xfc(){} +function zfc(){} +function Ffc(){} +function Jfc(){} +function Nfc(){} +function Pfc(){} +function Vfc(){} +function _fc(){} +function fgc(){} +function jgc(){} +function lgc(){} +function Bgc(){} +function ehc(){} +function ghc(){} +function ihc(){} +function khc(){} +function mhc(){} +function ohc(){} +function qhc(){} +function yhc(){} +function Ahc(){} +function Ghc(){} +function Ihc(){} +function Khc(){} +function Mhc(){} +function Shc(){} +function Uhc(){} +function Whc(){} +function dic(){} +function dlc(){} +function blc(){} +function flc(){} +function hlc(){} +function jlc(){} +function Glc(){} +function Ilc(){} +function Klc(){} +function Mlc(){} +function Mjc(){} +function Qjc(){} +function Qlc(){} +function Ulc(){} +function Ylc(){} +function Lkc(){} +function Nkc(){} +function Pkc(){} +function Rkc(){} +function Xkc(){} +function _kc(){} +function gmc(){} +function kmc(){} +function zmc(){} +function Fmc(){} +function Wmc(){} +function $mc(){} +function anc(){} +function mnc(){} +function wnc(){} +function Hnc(){} +function Jnc(){} +function Lnc(){} +function Nnc(){} +function Pnc(){} +function Ync(){} +function eoc(){} +function Aoc(){} +function Coc(){} +function Eoc(){} +function Joc(){} +function Loc(){} +function Zoc(){} +function _oc(){} +function bpc(){} +function hpc(){} +function kpc(){} +function ppc(){} +function pFc(){} +function Ryc(){} +function QCc(){} +function PDc(){} +function xGc(){} +function HGc(){} +function JGc(){} +function NGc(){} +function GIc(){} +function iKc(){} +function mKc(){} +function wKc(){} +function yKc(){} +function AKc(){} +function EKc(){} +function KKc(){} +function OKc(){} +function QKc(){} +function SKc(){} +function UKc(){} +function YKc(){} +function aLc(){} +function fLc(){} +function hLc(){} +function nLc(){} +function pLc(){} +function tLc(){} +function vLc(){} +function zLc(){} +function BLc(){} +function DLc(){} +function FLc(){} +function sMc(){} +function JMc(){} +function hNc(){} +function RNc(){} +function ZNc(){} +function _Nc(){} +function bOc(){} +function dOc(){} +function fOc(){} +function hOc(){} +function hRc(){} +function jRc(){} +function KRc(){} +function NRc(){} +function NQc(){} +function LQc(){} +function _Qc(){} +function cPc(){} +function iPc(){} +function kPc(){} +function mPc(){} +function xPc(){} +function zPc(){} +function zSc(){} +function BSc(){} +function GSc(){} +function ISc(){} +function NSc(){} +function TSc(){} +function NTc(){} +function NVc(){} +function oVc(){} +function SVc(){} +function VVc(){} +function XVc(){} +function ZVc(){} +function bWc(){} +function bXc(){} +function CXc(){} +function FXc(){} +function IXc(){} +function MXc(){} +function UXc(){} +function bYc(){} +function fYc(){} +function oYc(){} +function qYc(){} +function uYc(){} +function pZc(){} +function G$c(){} +function h0c(){} +function N0c(){} +function k1c(){} +function I1c(){} +function Q1c(){} +function f2c(){} +function i2c(){} +function k2c(){} +function w2c(){} +function O2c(){} +function S2c(){} +function Z2c(){} +function v3c(){} +function x3c(){} +function R3c(){} +function U3c(){} +function e4c(){} +function w4c(){} +function x4c(){} +function z4c(){} +function B4c(){} +function D4c(){} +function F4c(){} +function H4c(){} +function J4c(){} +function L4c(){} +function N4c(){} +function P4c(){} +function R4c(){} +function T4c(){} +function V4c(){} +function X4c(){} +function Z4c(){} +function _4c(){} +function _7c(){} +function b5c(){} +function d5c(){} +function f5c(){} +function h5c(){} +function H5c(){} +function Hfd(){} +function Zfd(){} +function Zed(){} +function ged(){} +function Jed(){} +function Ned(){} +function Red(){} +function Ved(){} +function bbd(){} +function mdd(){} +function _fd(){} +function fgd(){} +function kgd(){} +function Mgd(){} +function Ahd(){} +function Ald(){} +function Tld(){} +function xkd(){} +function rmd(){} +function knd(){} +function Jod(){} +function JCd(){} +function Bpd(){} +function BFd(){} +function oFd(){} +function bqd(){} +function bvd(){} +function jvd(){} +function yud(){} +function Hxd(){} +function EBd(){} +function aDd(){} +function MGd(){} +function vHd(){} +function RHd(){} +function wNd(){} +function zNd(){} +function CNd(){} +function KNd(){} +function XNd(){} +function $Nd(){} +function HPd(){} +function lUd(){} +function XUd(){} +function DWd(){} +function GWd(){} +function JWd(){} +function MWd(){} +function PWd(){} +function SWd(){} +function VWd(){} +function YWd(){} +function _Wd(){} +function xYd(){} +function BYd(){} +function mZd(){} +function EZd(){} +function GZd(){} +function JZd(){} +function MZd(){} +function PZd(){} +function SZd(){} +function VZd(){} +function YZd(){} +function _Zd(){} +function c$d(){} +function f$d(){} +function i$d(){} +function l$d(){} +function o$d(){} +function r$d(){} +function u$d(){} +function x$d(){} +function A$d(){} +function D$d(){} +function G$d(){} +function J$d(){} +function M$d(){} +function P$d(){} +function S$d(){} +function V$d(){} +function Y$d(){} +function _$d(){} +function c_d(){} +function f_d(){} +function i_d(){} +function l_d(){} +function o_d(){} +function r_d(){} +function u_d(){} +function x_d(){} +function A_d(){} +function D_d(){} +function G_d(){} +function J_d(){} +function M_d(){} +function P_d(){} +function S_d(){} +function V_d(){} +function Y_d(){} +function h5d(){} +function U6d(){} +function U9d(){} +function _8d(){} +function fae(){} +function hae(){} +function kae(){} +function nae(){} +function qae(){} +function tae(){} +function wae(){} +function zae(){} +function Cae(){} +function Fae(){} +function Iae(){} +function Lae(){} +function Oae(){} +function Rae(){} +function Uae(){} +function Xae(){} +function $ae(){} +function bbe(){} +function ebe(){} +function hbe(){} +function kbe(){} +function nbe(){} +function qbe(){} +function tbe(){} +function wbe(){} +function zbe(){} +function Cbe(){} +function Fbe(){} +function Ibe(){} +function Lbe(){} +function Obe(){} +function Rbe(){} +function Ube(){} +function Xbe(){} +function $be(){} +function bce(){} +function ece(){} +function hce(){} +function kce(){} +function nce(){} +function qce(){} +function tce(){} +function wce(){} +function zce(){} +function Cce(){} +function Fce(){} +function Ice(){} +function Lce(){} +function Oce(){} +function Rce(){} +function Uce(){} +function Xce(){} +function ude(){} +function Vge(){} +function dhe(){} +function s_b(a){} +function jSd(a){} +function ol(){wb()} +function oPb(){nPb()} +function EPb(){CPb()} +function gFb(){fFb()} +function TRb(){SRb()} +function ySb(){wSb()} +function PSb(){OSb()} +function dTb(){bTb()} +function i4b(){b4b()} +function D2b(){x2b()} +function J6b(){D6b()} +function u9b(){q9b()} +function $9b(){I9b()} +function Umc(){Imc()} +function abc(){Vac()} +function ZCc(){VCc()} +function kCc(){hCc()} +function rCc(){oCc()} +function Tcc(){Occ()} +function xkc(){gkc()} +function xDc(){rDc()} +function iDc(){cDc()} +function kwc(){jwc()} +function tJc(){jJc()} +function dJc(){aJc()} +function Pyc(){Nyc()} +function VBc(){SBc()} +function CFc(){yFc()} +function CUc(){wUc()} +function lUc(){fUc()} +function sUc(){pUc()} +function IUc(){GUc()} +function IWc(){HWc()} +function _Wc(){ZWc()} +function fHc(){dHc()} +function f0c(){d0c()} +function B0c(){A0c()} +function L0c(){J0c()} +function LTc(){JTc()} +function sTc(){rTc()} +function KLc(){ILc()} +function wNc(){tNc()} +function PYc(){OYc()} +function nZc(){lZc()} +function q3c(){p3c()} +function Z7c(){X7c()} +function Z9c(){Y9c()} +function _ad(){Zad()} +function kdd(){idd()} +function $md(){Smd()} +function HGd(){tGd()} +function hLd(){NKd()} +function J6d(){Uge()} +function Mvb(a){uCb(a)} +function Yb(a){this.a=a} +function cc(a){this.a=a} +function cj(a){this.a=a} +function ij(a){this.a=a} +function Dj(a){this.a=a} +function df(a){this.a=a} +function kf(a){this.a=a} +function ah(a){this.a=a} +function lh(a){this.a=a} +function th(a){this.a=a} +function Ph(a){this.a=a} +function vi(a){this.a=a} +function Ci(a){this.a=a} +function Fk(a){this.a=a} +function Ln(a){this.a=a} +function ap(a){this.a=a} +function zp(a){this.a=a} +function Yp(a){this.a=a} +function qq(a){this.a=a} +function Dq(a){this.a=a} +function wr(a){this.a=a} +function Ir(a){this.b=a} +function sj(a){this.c=a} +function sw(a){this.a=a} +function fw(a){this.a=a} +function xw(a){this.a=a} +function Cw(a){this.a=a} +function Qw(a){this.a=a} +function Rw(a){this.a=a} +function Xw(a){this.a=a} +function Xv(a){this.a=a} +function Sv(a){this.a=a} +function eu(a){this.a=a} +function Zx(a){this.a=a} +function _x(a){this.a=a} +function xy(a){this.a=a} +function xB(a){this.a=a} +function HB(a){this.a=a} +function TB(a){this.a=a} +function fC(a){this.a=a} +function wB(){this.a=[]} +function MBb(a,b){a.a=b} +function w_b(a,b){a.a=b} +function x_b(a,b){a.b=b} +function YOb(a,b){a.b=b} +function $Ob(a,b){a.b=b} +function ZGb(a,b){a.j=b} +function qNb(a,b){a.g=b} +function rNb(a,b){a.i=b} +function dRb(a,b){a.c=b} +function eRb(a,b){a.d=b} +function z_b(a,b){a.d=b} +function y_b(a,b){a.c=b} +function __b(a,b){a.k=b} +function E0b(a,b){a.c=b} +function njc(a,b){a.c=b} +function mjc(a,b){a.a=b} +function dFc(a,b){a.a=b} +function eFc(a,b){a.f=b} +function nOc(a,b){a.a=b} +function oOc(a,b){a.b=b} +function pOc(a,b){a.d=b} +function qOc(a,b){a.i=b} +function rOc(a,b){a.o=b} +function sOc(a,b){a.r=b} +function $Pc(a,b){a.a=b} +function _Pc(a,b){a.b=b} +function DVc(a,b){a.e=b} +function EVc(a,b){a.f=b} +function FVc(a,b){a.g=b} +function SZc(a,b){a.e=b} +function TZc(a,b){a.f=b} +function c$c(a,b){a.f=b} +function bJd(a,b){a.n=b} +function A1d(a,b){a.a=b} +function J1d(a,b){a.a=b} +function B1d(a,b){a.c=b} +function K1d(a,b){a.c=b} +function L1d(a,b){a.d=b} +function M1d(a,b){a.e=b} +function N1d(a,b){a.g=b} +function d2d(a,b){a.a=b} +function e2d(a,b){a.c=b} +function f2d(a,b){a.d=b} +function g2d(a,b){a.e=b} +function h2d(a,b){a.f=b} +function i2d(a,b){a.j=b} +function Z8d(a,b){a.a=b} +function $8d(a,b){a.b=b} +function g9d(a,b){a.a=b} +function Cic(a){a.b=a.a} +function Dg(a){a.c=a.d.d} +function vib(a){this.d=a} +function eib(a){this.a=a} +function Pib(a){this.a=a} +function Vib(a){this.a=a} +function $ib(a){this.a=a} +function mcb(a){this.a=a} +function Mcb(a){this.a=a} +function Xcb(a){this.a=a} +function Ndb(a){this.a=a} +function _db(a){this.a=a} +function teb(a){this.a=a} +function Qeb(a){this.a=a} +function djb(a){this.a=a} +function Gjb(a){this.a=a} +function Njb(a){this.a=a} +function Bjb(a){this.b=a} +function lnb(a){this.b=a} +function Dnb(a){this.b=a} +function anb(a){this.a=a} +function Mob(a){this.a=a} +function Rob(a){this.a=a} +function iob(a){this.c=a} +function olb(a){this.c=a} +function qub(a){this.c=a} +function Tub(a){this.a=a} +function Vub(a){this.a=a} +function Xub(a){this.a=a} +function Zub(a){this.a=a} +function tpb(a){this.a=a} +function _pb(a){this.a=a} +function Wqb(a){this.a=a} +function nsb(a){this.a=a} +function Rxb(a){this.a=a} +function Txb(a){this.a=a} +function Xxb(a){this.a=a} +function bzb(a){this.a=a} +function tzb(a){this.a=a} +function vzb(a){this.a=a} +function xzb(a){this.a=a} +function Kzb(a){this.a=a} +function Ozb(a){this.a=a} +function iAb(a){this.a=a} +function kAb(a){this.a=a} +function mAb(a){this.a=a} +function BAb(a){this.a=a} +function hBb(a){this.a=a} +function jBb(a){this.a=a} +function nBb(a){this.a=a} +function TBb(a){this.a=a} +function XBb(a){this.a=a} +function QCb(a){this.a=a} +function WCb(a){this.a=a} +function _Cb(a){this.a=a} +function dEb(a){this.a=a} +function QGb(a){this.a=a} +function YGb(a){this.a=a} +function tKb(a){this.a=a} +function CLb(a){this.a=a} +function JMb(a){this.a=a} +function RNb(a){this.a=a} +function kQb(a){this.a=a} +function mQb(a){this.a=a} +function FQb(a){this.a=a} +function ETb(a){this.a=a} +function UTb(a){this.a=a} +function dUb(a){this.a=a} +function hUb(a){this.a=a} +function EZb(a){this.a=a} +function j$b(a){this.a=a} +function v$b(a){this.e=a} +function J0b(a){this.a=a} +function M0b(a){this.a=a} +function R0b(a){this.a=a} +function U0b(a){this.a=a} +function i2b(a){this.a=a} +function k2b(a){this.a=a} +function o2b(a){this.a=a} +function s2b(a){this.a=a} +function G2b(a){this.a=a} +function I2b(a){this.a=a} +function K2b(a){this.a=a} +function M2b(a){this.a=a} +function W3b(a){this.a=a} +function $3b(a){this.a=a} +function V4b(a){this.a=a} +function u5b(a){this.a=a} +function A7b(a){this.a=a} +function G7b(a){this.a=a} +function J7b(a){this.a=a} +function M7b(a){this.a=a} +function Mbc(a){this.a=a} +function Pbc(a){this.a=a} +function lac(a){this.a=a} +function nac(a){this.a=a} +function qcc(a){this.a=a} +function Gdc(a){this.a=a} +function $dc(a){this.a=a} +function cec(a){this.a=a} +function _ec(a){this.a=a} +function pfc(a){this.a=a} +function Bfc(a){this.a=a} +function Lfc(a){this.a=a} +function ygc(a){this.a=a} +function Dgc(a){this.a=a} +function shc(a){this.a=a} +function uhc(a){this.a=a} +function whc(a){this.a=a} +function Chc(a){this.a=a} +function Ehc(a){this.a=a} +function Ohc(a){this.a=a} +function Yhc(a){this.a=a} +function Tkc(a){this.a=a} +function Vkc(a){this.a=a} +function Olc(a){this.a=a} +function pnc(a){this.a=a} +function rnc(a){this.a=a} +function dpc(a){this.a=a} +function fpc(a){this.a=a} +function GCc(a){this.a=a} +function KCc(a){this.a=a} +function mDc(a){this.a=a} +function jEc(a){this.a=a} +function HEc(a){this.a=a} +function FEc(a){this.c=a} +function qoc(a){this.b=a} +function bFc(a){this.a=a} +function GFc(a){this.a=a} +function iGc(a){this.a=a} +function kGc(a){this.a=a} +function mGc(a){this.a=a} +function $Gc(a){this.a=a} +function hIc(a){this.a=a} +function lIc(a){this.a=a} +function pIc(a){this.a=a} +function tIc(a){this.a=a} +function xIc(a){this.a=a} +function zIc(a){this.a=a} +function CIc(a){this.a=a} +function LIc(a){this.a=a} +function CKc(a){this.a=a} +function IKc(a){this.a=a} +function MKc(a){this.a=a} +function $Kc(a){this.a=a} +function cLc(a){this.a=a} +function jLc(a){this.a=a} +function rLc(a){this.a=a} +function xLc(a){this.a=a} +function OMc(a){this.a=a} +function ZOc(a){this.a=a} +function ZRc(a){this.a=a} +function aSc(a){this.a=a} +function I$c(a){this.a=a} +function K$c(a){this.a=a} +function M$c(a){this.a=a} +function O$c(a){this.a=a} +function U$c(a){this.a=a} +function n1c(a){this.a=a} +function z1c(a){this.a=a} +function B1c(a){this.a=a} +function Q2c(a){this.a=a} +function U2c(a){this.a=a} +function z3c(a){this.a=a} +function med(a){this.a=a} +function Xed(a){this.a=a} +function _ed(a){this.a=a} +function Qfd(a){this.a=a} +function Bgd(a){this.a=a} +function $gd(a){this.a=a} +function lrd(a){this.a=a} +function urd(a){this.a=a} +function vrd(a){this.a=a} +function wrd(a){this.a=a} +function xrd(a){this.a=a} +function yrd(a){this.a=a} +function zrd(a){this.a=a} +function Ard(a){this.a=a} +function Brd(a){this.a=a} +function Crd(a){this.a=a} +function Ird(a){this.a=a} +function Krd(a){this.a=a} +function Lrd(a){this.a=a} +function Mrd(a){this.a=a} +function Nrd(a){this.a=a} +function Prd(a){this.a=a} +function Srd(a){this.a=a} +function Yrd(a){this.a=a} +function Zrd(a){this.a=a} +function _rd(a){this.a=a} +function asd(a){this.a=a} +function bsd(a){this.a=a} +function csd(a){this.a=a} +function dsd(a){this.a=a} +function msd(a){this.a=a} +function osd(a){this.a=a} +function qsd(a){this.a=a} +function ssd(a){this.a=a} +function Wsd(a){this.a=a} +function Lsd(a){this.b=a} +function thd(a){this.f=a} +function qtd(a){this.a=a} +function yBd(a){this.a=a} +function GBd(a){this.a=a} +function MBd(a){this.a=a} +function SBd(a){this.a=a} +function iCd(a){this.a=a} +function YMd(a){this.a=a} +function GNd(a){this.a=a} +function EPd(a){this.a=a} +function EQd(a){this.a=a} +function NTd(a){this.a=a} +function qOd(a){this.b=a} +function lVd(a){this.c=a} +function VVd(a){this.e=a} +function iYd(a){this.a=a} +function RYd(a){this.a=a} +function ZYd(a){this.a=a} +function z0d(a){this.a=a} +function O0d(a){this.a=a} +function s0d(a){this.d=a} +function W5d(a){this.a=a} +function cge(a){this.a=a} +function xfe(a){this.e=a} +function Tfd(){this.a=0} +function jkb(){Vjb(this)} +function Rkb(){Ckb(this)} +function Lqb(){Uhb(this)} +function lEb(){kEb(this)} +function A_b(){s_b(this)} +function UQd(){this.c=FQd} +function v6d(a,b){b.Wb(a)} +function moc(a,b){a.b+=b} +function yXb(a){a.b=new Ji} +function vbb(a){return a.e} +function DB(a){return a.a} +function LB(a){return a.a} +function ZB(a){return a.a} +function lC(a){return a.a} +function EC(a){return a.a} +function wC(){return null} +function SB(){return null} +function hcb(){mvd();ovd()} +function zJb(a){a.b.tf(a.e)} +function j5b(a,b){a.b=b-a.b} +function g5b(a,b){a.a=b-a.a} +function PXc(a,b){b.ad(a.a)} +function plc(a,b){G0b(b,a)} +function hp(a,b,c){a.Od(c,b)} +function As(a,b){a.e=b;b.b=a} +function Zl(a){Ql();this.a=a} +function jq(a){Ql();this.a=a} +function sq(a){Ql();this.a=a} +function Fq(a){im();this.a=a} +function Sz(a){Rz();Qz.be(a)} +function gz(){Xy.call(this)} +function xcb(){Xy.call(this)} +function pcb(){gz.call(this)} +function tcb(){gz.call(this)} +function Bdb(){gz.call(this)} +function Vdb(){gz.call(this)} +function Ydb(){gz.call(this)} +function Geb(){gz.call(this)} +function bgb(){gz.call(this)} +function Apb(){gz.call(this)} +function Jpb(){gz.call(this)} +function utb(){gz.call(this)} +function x2c(){gz.call(this)} +function rQd(){this.a=this} +function MPd(){this.Bb|=256} +function tTb(){this.b=new mt} +function fA(){fA=ccb;new Lqb} +function rcb(){pcb.call(this)} +function dCb(a,b){a.length=b} +function Tvb(a,b){Ekb(a.a,b)} +function sKb(a,b){UHb(a.c,b)} +function SMc(a,b){Qqb(a.b,b)} +function vBd(a,b){uAd(a.a,b)} +function wBd(a,b){vAd(a.a,b)} +function GLd(a,b){Uhd(a.e,b)} +function d7d(a){D2d(a.c,a.b)} +function mj(a,b){a.kc().Nb(b)} +function Odb(a){this.a=Tdb(a)} +function Tqb(){this.a=new Lqb} +function gyb(){this.a=new Lqb} +function Wvb(){this.a=new Rkb} +function KFb(){this.a=new Rkb} +function PFb(){this.a=new Rkb} +function FFb(){this.a=new yFb} +function pGb(){this.a=new MFb} +function ZQb(){this.a=new MQb} +function Gxb(){this.a=new Pwb} +function jUb(){this.a=new PTb} +function sDb(){this.a=new oDb} +function zDb(){this.a=new tDb} +function CWb(){this.a=new Rkb} +function HXb(){this.a=new Rkb} +function nYb(){this.a=new Rkb} +function BYb(){this.a=new Rkb} +function fLb(){this.d=new Rkb} +function vYb(){this.a=new Tqb} +function a2b(){this.a=new Lqb} +function wZb(){this.b=new Lqb} +function TCc(){this.b=new Rkb} +function zJc(){this.e=new Rkb} +function uMc(){this.d=new Rkb} +function wdc(){this.a=new xkc} +function vKc(){Rkb.call(this)} +function twb(){Wvb.call(this)} +function oHb(){$Gb.call(this)} +function LXb(){HXb.call(this)} +function L_b(){H_b.call(this)} +function H_b(){A_b.call(this)} +function p0b(){A_b.call(this)} +function s0b(){p0b.call(this)} +function WMc(){VMc.call(this)} +function bNc(){VMc.call(this)} +function EPc(){CPc.call(this)} +function JPc(){CPc.call(this)} +function OPc(){CPc.call(this)} +function w1c(){s1c.call(this)} +function s7c(){Psb.call(this)} +function apd(){Ald.call(this)} +function ppd(){Ald.call(this)} +function lDd(){YCd.call(this)} +function NDd(){YCd.call(this)} +function mFd(){Lqb.call(this)} +function vFd(){Lqb.call(this)} +function GFd(){Lqb.call(this)} +function KPd(){Tqb.call(this)} +function OJd(){hJd.call(this)} +function aQd(){MPd.call(this)} +function SSd(){FId.call(this)} +function rUd(){FId.call(this)} +function oUd(){Lqb.call(this)} +function NYd(){Lqb.call(this)} +function cZd(){Lqb.call(this)} +function R8d(){MGd.call(this)} +function o9d(){MGd.call(this)} +function i9d(){R8d.call(this)} +function hee(){ude.call(this)} +function Dd(a){yd.call(this,a)} +function Hd(a){yd.call(this,a)} +function ph(a){lh.call(this,a)} +function Sh(a){Wc.call(this,a)} +function oi(a){Sh.call(this,a)} +function Ii(a){Wc.call(this,a)} +function Zdd(){this.a=new Psb} +function CPc(){this.a=new Tqb} +function s1c(){this.a=new Lqb} +function QSc(){this.a=new Rkb} +function D2c(){this.j=new Rkb} +function QXc(){this.a=new UXc} +function e_c(){this.a=new d_c} +function YCd(){this.a=new aDd} +function _k(){_k=ccb;$k=new al} +function Lk(){Lk=ccb;Kk=new Mk} +function wb(){wb=ccb;vb=new xb} +function hs(){hs=ccb;gs=new is} +function rs(a){Sh.call(this,a)} +function Gp(a){Sh.call(this,a)} +function xp(a){Lo.call(this,a)} +function Ep(a){Lo.call(this,a)} +function Tp(a){Wn.call(this,a)} +function wx(a){un.call(this,a)} +function ov(a){dv.call(this,a)} +function Mv(a){Br.call(this,a)} +function Ov(a){Br.call(this,a)} +function Lw(a){Br.call(this,a)} +function hz(a){Yy.call(this,a)} +function MB(a){hz.call(this,a)} +function eC(){fC.call(this,{})} +function Ftb(a){Atb();this.a=a} +function zwb(a){a.b=null;a.c=0} +function Vy(a,b){a.e=b;Sy(a,b)} +function LVb(a,b){a.a=b;NVb(a)} +function lIb(a,b,c){a.a[b.g]=c} +function vfd(a,b,c){Dfd(c,a,b)} +function Odc(a,b){rjc(b.i,a.n)} +function Wyc(a,b){Xyc(a).td(b)} +function ERb(a,b){return a*a/b} +function Xr(a,b){return a.g-b.g} +function tC(a){return new TB(a)} +function vC(a){return new yC(a)} +function ocb(a){hz.call(this,a)} +function qcb(a){hz.call(this,a)} +function ucb(a){hz.call(this,a)} +function vcb(a){Yy.call(this,a)} +function fGc(a){LFc();this.a=a} +function c0d(a){kzd();this.a=a} +function bhd(a){Rgd();this.f=a} +function dhd(a){Rgd();this.f=a} +function Cdb(a){hz.call(this,a)} +function Wdb(a){hz.call(this,a)} +function Zdb(a){hz.call(this,a)} +function Feb(a){hz.call(this,a)} +function Heb(a){hz.call(this,a)} +function Ccb(a){return uCb(a),a} +function Edb(a){return uCb(a),a} +function Gdb(a){return uCb(a),a} +function jfb(a){return uCb(a),a} +function tfb(a){return uCb(a),a} +function akb(a){return a.b==a.c} +function Hwb(a){return !!a&&a.b} +function pIb(a){return !!a&&a.k} +function qIb(a){return !!a&&a.j} +function amb(a){uCb(a);this.a=a} +function wVb(a){qVb(a);return a} +function Blb(a){Glb(a,a.length)} +function cgb(a){hz.call(this,a)} +function cqd(a){hz.call(this,a)} +function n8d(a){hz.call(this,a)} +function y2c(a){hz.call(this,a)} +function z2c(a){hz.call(this,a)} +function mde(a){hz.call(this,a)} +function pc(a){qc.call(this,a,0)} +function Ji(){Ki.call(this,12,3)} +function Kz(){Kz=ccb;Jz=new Nz} +function jz(){jz=ccb;iz=new nb} +function KA(){KA=ccb;JA=new MA} +function OB(){OB=ccb;NB=new PB} +function jc(){throw vbb(new bgb)} +function zh(){throw vbb(new bgb)} +function Pi(){throw vbb(new bgb)} +function Pj(){throw vbb(new bgb)} +function Qj(){throw vbb(new bgb)} +function Ym(){throw vbb(new bgb)} +function Gb(){this.a=GD(Qb(She))} +function oy(a){Ql();this.a=Qb(a)} +function Bs(a,b){a.Td(b);b.Sd(a)} +function iw(a,b){a.a.ec().Mc(b)} +function CYb(a,b,c){a.c.lf(b,c)} +function scb(a){qcb.call(this,a)} +function Oeb(a){Wdb.call(this,a)} +function Hfb(){mcb.call(this,'')} +function Ifb(){mcb.call(this,'')} +function Ufb(){mcb.call(this,'')} +function Vfb(){mcb.call(this,'')} +function Xfb(a){qcb.call(this,a)} +function zob(a){lnb.call(this,a)} +function Yob(a){Inb.call(this,a)} +function Gob(a){zob.call(this,a)} +function Mk(){Fk.call(this,null)} +function al(){Fk.call(this,null)} +function Az(){Az=ccb;!!(Rz(),Qz)} +function wrb(){wrb=ccb;vrb=yrb()} +function Mtb(a){return a.a?a.b:0} +function Vtb(a){return a.a?a.b:0} +function Lcb(a,b){return a.a-b.a} +function Wcb(a,b){return a.a-b.a} +function Peb(a,b){return a.a-b.a} +function eCb(a,b){return PC(a,b)} +function GC(a,b){return rdb(a,b)} +function _B(b,a){return a in b.a} +function _Db(a,b){a.f=b;return a} +function ZDb(a,b){a.b=b;return a} +function $Db(a,b){a.c=b;return a} +function aEb(a,b){a.g=b;return a} +function HGb(a,b){a.a=b;return a} +function IGb(a,b){a.f=b;return a} +function JGb(a,b){a.k=b;return a} +function dLb(a,b){a.a=b;return a} +function eLb(a,b){a.e=b;return a} +function zVb(a,b){a.e=b;return a} +function AVb(a,b){a.f=b;return a} +function KOb(a,b){a.b=true;a.d=b} +function DHb(a,b){a.b=new g7c(b)} +function uvb(a,b,c){b.td(a.a[c])} +function zvb(a,b,c){b.we(a.a[c])} +function wJc(a,b){return a.b-b.b} +function kOc(a,b){return a.g-b.g} +function WQc(a,b){return a.s-b.s} +function Lic(a,b){return a?0:b-1} +function SFc(a,b){return a?0:b-1} +function RFc(a,b){return a?b-1:0} +function M2c(a,b){return b.Yf(a)} +function M3c(a,b){a.b=b;return a} +function L3c(a,b){a.a=b;return a} +function N3c(a,b){a.c=b;return a} +function O3c(a,b){a.d=b;return a} +function P3c(a,b){a.e=b;return a} +function Q3c(a,b){a.f=b;return a} +function b4c(a,b){a.a=b;return a} +function c4c(a,b){a.b=b;return a} +function d4c(a,b){a.c=b;return a} +function z5c(a,b){a.c=b;return a} +function y5c(a,b){a.b=b;return a} +function A5c(a,b){a.d=b;return a} +function B5c(a,b){a.e=b;return a} +function C5c(a,b){a.f=b;return a} +function D5c(a,b){a.g=b;return a} +function E5c(a,b){a.a=b;return a} +function F5c(a,b){a.i=b;return a} +function G5c(a,b){a.j=b;return a} +function Vdd(a,b){a.k=b;return a} +function Wdd(a,b){a.j=b;return a} +function ykc(a,b){gkc();F0b(b,a)} +function T$c(a,b,c){R$c(a.a,b,c)} +function RGc(a){cEc.call(this,a)} +function iHc(a){cEc.call(this,a)} +function t7c(a){Qsb.call(this,a)} +function aPb(a){_Ob.call(this,a)} +function Ixd(a){zud.call(this,a)} +function dCd(a){ZBd.call(this,a)} +function fCd(a){ZBd.call(this,a)} +function p_b(){q_b.call(this,'')} +function d7c(){this.a=0;this.b=0} +function aPc(){this.b=0;this.a=0} +function NJd(a,b){a.b=0;DId(a,b)} +function X1d(a,b){a.c=b;a.b=true} +function Oc(a,b){return a.c._b(b)} +function gdb(a){return a.e&&a.e()} +function Vd(a){return !a?null:a.d} +function sn(a,b){return Gv(a.b,b)} +function Fv(a){return !a?null:a.g} +function Kv(a){return !a?null:a.i} +function hdb(a){fdb(a);return a.o} +function Fhd(){Fhd=ccb;Ehd=ond()} +function Hhd(){Hhd=ccb;Ghd=Cod()} +function LFd(){LFd=ccb;KFd=qZd()} +function p8d(){p8d=ccb;o8d=Y9d()} +function r8d(){r8d=ccb;q8d=dae()} +function mvd(){mvd=ccb;lvd=n4c()} +function Srb(){throw vbb(new bgb)} +function enb(){throw vbb(new bgb)} +function fnb(){throw vbb(new bgb)} +function gnb(){throw vbb(new bgb)} +function jnb(){throw vbb(new bgb)} +function Cnb(){throw vbb(new bgb)} +function Uqb(a){this.a=new Mqb(a)} +function tgb(a){lgb();ngb(this,a)} +function Hxb(a){this.a=new Qwb(a)} +function _ub(a,b){while(a.ye(b));} +function Sub(a,b){while(a.sd(b));} +function Bfb(a,b){a.a+=b;return a} +function Cfb(a,b){a.a+=b;return a} +function Ffb(a,b){a.a+=b;return a} +function Lfb(a,b){a.a+=b;return a} +function WAb(a){Tzb(a);return a.a} +function Wsb(a){return a.b!=a.d.c} +function pD(a){return a.l|a.m<<22} +function aIc(a,b){return a.d[b.p]} +function h2c(a,b){return c2c(a,b)} +function cCb(a,b,c){a.splice(b,c)} +function WHb(a){a.c?VHb(a):XHb(a)} +function jVc(a){this.a=0;this.b=a} +function ZUc(){this.a=new L2c(K$)} +function tRc(){this.b=new L2c(h$)} +function Q$c(){this.b=new L2c(J_)} +function d_c(){this.b=new L2c(J_)} +function OCd(){throw vbb(new bgb)} +function PCd(){throw vbb(new bgb)} +function QCd(){throw vbb(new bgb)} +function RCd(){throw vbb(new bgb)} +function SCd(){throw vbb(new bgb)} +function TCd(){throw vbb(new bgb)} +function UCd(){throw vbb(new bgb)} +function VCd(){throw vbb(new bgb)} +function WCd(){throw vbb(new bgb)} +function XCd(){throw vbb(new bgb)} +function ahe(){throw vbb(new utb)} +function bhe(){throw vbb(new utb)} +function Rge(a){this.a=new ege(a)} +function ege(a){dge(this,a,Vee())} +function Fhe(a){return !a||Ehe(a)} +function dde(a){return $ce[a]!=-1} +function Iz(){xz!=0&&(xz=0);zz=-1} +function Ybb(){Wbb==null&&(Wbb=[])} +function ONd(a,b){Rxd(ZKd(a.a),b)} +function TNd(a,b){Rxd(ZKd(a.a),b)} +function Yf(a,b){zf.call(this,a,b)} +function $f(a,b){Yf.call(this,a,b)} +function Hf(a,b){this.b=a;this.c=b} +function rk(a,b){this.b=a;this.a=b} +function ek(a,b){this.a=a;this.b=b} +function gk(a,b){this.a=a;this.b=b} +function pk(a,b){this.a=a;this.b=b} +function yk(a,b){this.a=a;this.b=b} +function Ak(a,b){this.a=a;this.b=b} +function Fj(a,b){this.a=a;this.b=b} +function _j(a,b){this.a=a;this.b=b} +function dr(a,b){this.a=a;this.b=b} +function zr(a,b){this.b=a;this.a=b} +function So(a,b){this.b=a;this.a=b} +function qp(a,b){this.b=a;this.a=b} +function $q(a,b){this.b=a;this.a=b} +function $r(a,b){this.f=a;this.g=b} +function ne(a,b){this.e=a;this.d=b} +function Wo(a,b){this.g=a;this.i=b} +function bu(a,b){this.a=a;this.b=b} +function qu(a,b){this.a=a;this.f=b} +function qv(a,b){this.b=a;this.c=b} +function ox(a,b){this.a=a;this.b=b} +function Px(a,b){this.a=a;this.b=b} +function mC(a,b){this.a=a;this.b=b} +function Wc(a){Lb(a.dc());this.c=a} +function rf(a){this.b=BD(Qb(a),83)} +function Zv(a){this.a=BD(Qb(a),83)} +function dv(a){this.a=BD(Qb(a),15)} +function $u(a){this.a=BD(Qb(a),15)} +function Br(a){this.b=BD(Qb(a),47)} +function eB(){this.q=new $wnd.Date} +function Zfb(){Zfb=ccb;Yfb=new jcb} +function Emb(){Emb=ccb;Dmb=new Fmb} +function Vhb(a){return a.f.c+a.g.c} +function hnb(a,b){return a.b.Hc(b)} +function inb(a,b){return a.b.Ic(b)} +function knb(a,b){return a.b.Qc(b)} +function Dob(a,b){return a.b.Hc(b)} +function dob(a,b){return a.c.uc(b)} +function Rqb(a,b){return a.a._b(b)} +function fob(a,b){return pb(a.c,b)} +function jt(a,b){return Mhb(a.b,b)} +function Lp(a,b){return a>b&&b0} +function Gbb(a,b){return ybb(a,b)<0} +function Crb(a,b){return a.a.get(b)} +function icb(b,a){return a.split(b)} +function Vrb(a,b){return Mhb(a.e,b)} +function Nvb(a){return uCb(a),false} +function Rub(a){Kub.call(this,a,21)} +function wcb(a,b){Zy.call(this,a,b)} +function mxb(a,b){$r.call(this,a,b)} +function Gyb(a,b){$r.call(this,a,b)} +function zx(a){yx();Wn.call(this,a)} +function zlb(a,b){Dlb(a,a.length,b)} +function Alb(a,b){Flb(a,a.length,b)} +function ABb(a,b,c){b.ud(a.a.Ge(c))} +function uBb(a,b,c){b.we(a.a.Fe(c))} +function GBb(a,b,c){b.td(a.a.Kb(c))} +function Zq(a,b,c){a.Mb(c)&&b.td(c)} +function aCb(a,b,c){a.splice(b,0,c)} +function lDb(a,b){return uqb(a.e,b)} +function pjb(a,b){this.d=a;this.e=b} +function kqb(a,b){this.b=a;this.a=b} +function VBb(a,b){this.b=a;this.a=b} +function BEb(a,b){this.b=a;this.a=b} +function sBb(a,b){this.a=a;this.b=b} +function yBb(a,b){this.a=a;this.b=b} +function EBb(a,b){this.a=a;this.b=b} +function KBb(a,b){this.a=a;this.b=b} +function aDb(a,b){this.a=a;this.b=b} +function tMb(a,b){this.b=a;this.a=b} +function oOb(a,b){this.b=a;this.a=b} +function SOb(a,b){$r.call(this,a,b)} +function SMb(a,b){$r.call(this,a,b)} +function NEb(a,b){$r.call(this,a,b)} +function VEb(a,b){$r.call(this,a,b)} +function sFb(a,b){$r.call(this,a,b)} +function hHb(a,b){$r.call(this,a,b)} +function OHb(a,b){$r.call(this,a,b)} +function FIb(a,b){$r.call(this,a,b)} +function wLb(a,b){$r.call(this,a,b)} +function YRb(a,b){$r.call(this,a,b)} +function zTb(a,b){$r.call(this,a,b)} +function rUb(a,b){$r.call(this,a,b)} +function oWb(a,b){$r.call(this,a,b)} +function SXb(a,b){$r.call(this,a,b)} +function k0b(a,b){$r.call(this,a,b)} +function z5b(a,b){$r.call(this,a,b)} +function T8b(a,b){$r.call(this,a,b)} +function ibc(a,b){$r.call(this,a,b)} +function Cec(a,b){this.a=a;this.b=b} +function rfc(a,b){this.a=a;this.b=b} +function Rfc(a,b){this.a=a;this.b=b} +function Tfc(a,b){this.a=a;this.b=b} +function bgc(a,b){this.a=a;this.b=b} +function ngc(a,b){this.a=a;this.b=b} +function Qhc(a,b){this.a=a;this.b=b} +function $hc(a,b){this.a=a;this.b=b} +function Z0b(a,b){this.a=a;this.b=b} +function ZVb(a,b){this.b=a;this.a=b} +function Dfc(a,b){this.b=a;this.a=b} +function dgc(a,b){this.b=a;this.a=b} +function Bmc(a,b){this.b=a;this.a=b} +function cWb(a,b){this.c=a;this.d=b} +function I$b(a,b){this.e=a;this.d=b} +function Unc(a,b){this.a=a;this.b=b} +function Oic(a,b){this.b=b;this.c=a} +function Bjc(a,b){$r.call(this,a,b)} +function Yjc(a,b){$r.call(this,a,b)} +function Gkc(a,b){$r.call(this,a,b)} +function Bpc(a,b){$r.call(this,a,b)} +function Jpc(a,b){$r.call(this,a,b)} +function Tpc(a,b){$r.call(this,a,b)} +function cqc(a,b){$r.call(this,a,b)} +function oqc(a,b){$r.call(this,a,b)} +function yqc(a,b){$r.call(this,a,b)} +function Hqc(a,b){$r.call(this,a,b)} +function Uqc(a,b){$r.call(this,a,b)} +function arc(a,b){$r.call(this,a,b)} +function mrc(a,b){$r.call(this,a,b)} +function zrc(a,b){$r.call(this,a,b)} +function Prc(a,b){$r.call(this,a,b)} +function Yrc(a,b){$r.call(this,a,b)} +function fsc(a,b){$r.call(this,a,b)} +function nsc(a,b){$r.call(this,a,b)} +function nzc(a,b){$r.call(this,a,b)} +function zzc(a,b){$r.call(this,a,b)} +function Kzc(a,b){$r.call(this,a,b)} +function Xzc(a,b){$r.call(this,a,b)} +function Dtc(a,b){$r.call(this,a,b)} +function lAc(a,b){$r.call(this,a,b)} +function uAc(a,b){$r.call(this,a,b)} +function CAc(a,b){$r.call(this,a,b)} +function LAc(a,b){$r.call(this,a,b)} +function UAc(a,b){$r.call(this,a,b)} +function aBc(a,b){$r.call(this,a,b)} +function uBc(a,b){$r.call(this,a,b)} +function DBc(a,b){$r.call(this,a,b)} +function MBc(a,b){$r.call(this,a,b)} +function sGc(a,b){$r.call(this,a,b)} +function VIc(a,b){$r.call(this,a,b)} +function EIc(a,b){this.b=a;this.a=b} +function qKc(a,b){this.a=a;this.b=b} +function GKc(a,b){this.a=a;this.b=b} +function lLc(a,b){this.a=a;this.b=b} +function mMc(a,b){this.a=a;this.b=b} +function fMc(a,b){$r.call(this,a,b)} +function ZLc(a,b){$r.call(this,a,b)} +function ZMc(a,b){this.b=a;this.d=b} +function IOc(a,b){$r.call(this,a,b)} +function GQc(a,b){$r.call(this,a,b)} +function PQc(a,b){this.a=a;this.b=b} +function RQc(a,b){this.a=a;this.b=b} +function ARc(a,b){$r.call(this,a,b)} +function rSc(a,b){$r.call(this,a,b)} +function TTc(a,b){$r.call(this,a,b)} +function _Tc(a,b){$r.call(this,a,b)} +function RUc(a,b){$r.call(this,a,b)} +function uVc(a,b){$r.call(this,a,b)} +function hWc(a,b){$r.call(this,a,b)} +function rWc(a,b){$r.call(this,a,b)} +function kXc(a,b){$r.call(this,a,b)} +function uXc(a,b){$r.call(this,a,b)} +function AYc(a,b){$r.call(this,a,b)} +function l$c(a,b){$r.call(this,a,b)} +function Z$c(a,b){$r.call(this,a,b)} +function D_c(a,b){$r.call(this,a,b)} +function O_c(a,b){$r.call(this,a,b)} +function c1c(a,b){$r.call(this,a,b)} +function cVb(a,b){return uqb(a.c,b)} +function nnc(a,b){return uqb(b.b,a)} +function x1c(a,b){return -a.b.Je(b)} +function D3c(a,b){return uqb(a.g,b)} +function O5c(a,b){$r.call(this,a,b)} +function a6c(a,b){$r.call(this,a,b)} +function m2c(a,b){this.a=a;this.b=b} +function W2c(a,b){this.a=a;this.b=b} +function f7c(a,b){this.a=a;this.b=b} +function G7c(a,b){$r.call(this,a,b)} +function j8c(a,b){$r.call(this,a,b)} +function iad(a,b){$r.call(this,a,b)} +function rad(a,b){$r.call(this,a,b)} +function Bad(a,b){$r.call(this,a,b)} +function Nad(a,b){$r.call(this,a,b)} +function ibd(a,b){$r.call(this,a,b)} +function tbd(a,b){$r.call(this,a,b)} +function Ibd(a,b){$r.call(this,a,b)} +function Ubd(a,b){$r.call(this,a,b)} +function gcd(a,b){$r.call(this,a,b)} +function scd(a,b){$r.call(this,a,b)} +function Ycd(a,b){$r.call(this,a,b)} +function udd(a,b){$r.call(this,a,b)} +function Jdd(a,b){$r.call(this,a,b)} +function Eed(a,b){$r.call(this,a,b)} +function bfd(a,b){this.a=a;this.b=b} +function dfd(a,b){this.a=a;this.b=b} +function ffd(a,b){this.a=a;this.b=b} +function Kfd(a,b){this.a=a;this.b=b} +function Mfd(a,b){this.a=a;this.b=b} +function Ofd(a,b){this.a=a;this.b=b} +function vgd(a,b){this.a=a;this.b=b} +function qgd(a,b){$r.call(this,a,b)} +function jrd(a,b){this.a=a;this.b=b} +function krd(a,b){this.a=a;this.b=b} +function mrd(a,b){this.a=a;this.b=b} +function nrd(a,b){this.a=a;this.b=b} +function qrd(a,b){this.a=a;this.b=b} +function rrd(a,b){this.a=a;this.b=b} +function srd(a,b){this.b=a;this.a=b} +function trd(a,b){this.b=a;this.a=b} +function Drd(a,b){this.b=a;this.a=b} +function Frd(a,b){this.b=a;this.a=b} +function Hrd(a,b){this.a=a;this.b=b} +function Jrd(a,b){this.a=a;this.b=b} +function Ord(a,b){Xqd(a.a,BD(b,56))} +function BIc(a,b){gIc(a.a,BD(b,11))} +function fIc(a,b){FHc();return b!=a} +function Arb(){wrb();return new vrb} +function CMc(){wMc();this.b=new Tqb} +function NNc(){FNc();this.a=new Tqb} +function eCc(){ZBc();aCc.call(this)} +function Dsd(a,b){$r.call(this,a,b)} +function Urd(a,b){this.a=a;this.b=b} +function Wrd(a,b){this.a=a;this.b=b} +function kGd(a,b){this.a=a;this.b=b} +function nGd(a,b){this.a=a;this.b=b} +function bUd(a,b){this.a=a;this.b=b} +function zVd(a,b){this.a=a;this.b=b} +function C1d(a,b){this.d=a;this.b=b} +function MLd(a,b){this.d=a;this.e=b} +function Wud(a,b){this.f=a;this.c=b} +function f7d(a,b){this.b=a;this.c=b} +function _zd(a,b){this.i=a;this.g=b} +function Y1d(a,b){this.e=a;this.a=b} +function c8d(a,b){this.a=a;this.b=b} +function $Id(a,b){a.i=null;_Id(a,b)} +function ivd(a,b){!!a&&Rhb(cvd,a,b)} +function hCd(a,b){return qAd(a.a,b)} +function e7d(a){return R2d(a.c,a.b)} +function Wd(a){return !a?null:a.dd()} +function PD(a){return a==null?null:a} +function KD(a){return typeof a===Khe} +function LD(a){return typeof a===Lhe} +function ND(a){return typeof a===Mhe} +function Em(a,b){return a.Hd().Xb(b)} +function Kq(a,b){return hr(a.Kc(),b)} +function Bbb(a,b){return ybb(a,b)==0} +function Ebb(a,b){return ybb(a,b)>=0} +function Kbb(a,b){return ybb(a,b)!=0} +function Jdb(a){return ''+(uCb(a),a)} +function pfb(a,b){return a.substr(b)} +function cg(a){ag(a);return a.d.gc()} +function oVb(a){pVb(a,a.c);return a} +function RD(a){CCb(a==null);return a} +function Dfb(a,b){a.a+=''+b;return a} +function Efb(a,b){a.a+=''+b;return a} +function Nfb(a,b){a.a+=''+b;return a} +function Pfb(a,b){a.a+=''+b;return a} +function Qfb(a,b){a.a+=''+b;return a} +function Mfb(a,b){return a.a+=''+b,a} +function Esb(a,b){Gsb(a,b,a.a,a.a.a)} +function Fsb(a,b){Gsb(a,b,a.c.b,a.c)} +function Mqd(a,b,c){Rpd(b,kqd(a,c))} +function Nqd(a,b,c){Rpd(b,kqd(a,c))} +function Dhe(a,b){Hhe(new Fyd(a),b)} +function cB(a,b){a.q.setTime(Sbb(b))} +function fvb(a,b){bvb.call(this,a,b)} +function jvb(a,b){bvb.call(this,a,b)} +function nvb(a,b){bvb.call(this,a,b)} +function Nqb(a){Uhb(this);Ld(this,a)} +function wmb(a){tCb(a,0);return null} +function X6c(a){a.a=0;a.b=0;return a} +function f3c(a,b){a.a=b.g+1;return a} +function PJc(a,b){return a.j[b.p]==2} +function _Pb(a){return VPb(BD(a,79))} +function yJb(){yJb=ccb;xJb=as(wJb())} +function Y8b(){Y8b=ccb;X8b=as(W8b())} +function mt(){this.b=new Mqb(Cv(12))} +function Otb(){this.b=0;this.a=false} +function Wtb(){this.b=0;this.a=false} +function sl(a){this.a=a;ol.call(this)} +function vl(a){this.a=a;ol.call(this)} +function Nsd(a,b){Msd.call(this,a,b)} +function $zd(a,b){Cyd.call(this,a,b)} +function nNd(a,b){_zd.call(this,a,b)} +function s4d(a,b){p4d.call(this,a,b)} +function w4d(a,b){qRd.call(this,a,b)} +function rEd(a,b){pEd();Rhb(oEd,a,b)} +function lcb(a,b){return qfb(a.a,0,b)} +function ww(a,b){return a.a.a.a.cc(b)} +function mb(a,b){return PD(a)===PD(b)} +function Mdb(a,b){return Kdb(a.a,b.a)} +function $db(a,b){return beb(a.a,b.a)} +function seb(a,b){return ueb(a.a,b.a)} +function hfb(a,b){return a.indexOf(b)} +function Ny(a,b){return a==b?0:a?1:-1} +function kB(a){return a<10?'0'+a:''+a} +function Mq(a){return Qb(a),new sl(a)} +function SC(a){return TC(a.l,a.m,a.h)} +function Hdb(a){return QD((uCb(a),a))} +function Idb(a){return QD((uCb(a),a))} +function NIb(a,b){return beb(a.g,b.g)} +function Fbb(a){return typeof a===Lhe} +function mWb(a){return a==hWb||a==kWb} +function nWb(a){return a==hWb||a==iWb} +function G1b(a){return Jkb(a.b.b,a,0)} +function lrb(a){this.a=Arb();this.b=a} +function Frb(a){this.a=Arb();this.b=a} +function swb(a,b){Ekb(a.a,b);return b} +function Z1c(a,b){Ekb(a.c,b);return a} +function E2c(a,b){d3c(a.a,b);return a} +function _gc(a,b){Hgc();return b.a+=a} +function bhc(a,b){Hgc();return b.a+=a} +function ahc(a,b){Hgc();return b.c+=a} +function Nlb(a,b){Klb(a,0,a.length,b)} +function zsb(){Wqb.call(this,new $rb)} +function I_b(){B_b.call(this,0,0,0,0)} +function I6c(){J6c.call(this,0,0,0,0)} +function g7c(a){this.a=a.a;this.b=a.b} +function fad(a){return a==aad||a==bad} +function gad(a){return a==dad||a==_9c} +function Jzc(a){return a==Fzc||a==Ezc} +function fcd(a){return a!=bcd&&a!=ccd} +function oid(a){return a.Lg()&&a.Mg()} +function Gfd(a){return Kkd(BD(a,118))} +function k3c(a){return d3c(new j3c,a)} +function y2d(a,b){return new p4d(b,a)} +function z2d(a,b){return new p4d(b,a)} +function ukd(a,b,c){vkd(a,b);wkd(a,c)} +function _kd(a,b,c){cld(a,b);ald(a,c)} +function bld(a,b,c){dld(a,b);eld(a,c)} +function gmd(a,b,c){hmd(a,b);imd(a,c)} +function nmd(a,b,c){omd(a,b);pmd(a,c)} +function iKd(a,b){$Jd(a,b);_Jd(a,a.D)} +function _ud(a){Wud.call(this,a,true)} +function Xg(a,b,c){Vg.call(this,a,b,c)} +function Ygb(a){Hgb();Zgb.call(this,a)} +function rxb(){mxb.call(this,'Head',1)} +function wxb(){mxb.call(this,'Tail',3)} +function Ckb(a){a.c=KC(SI,Uhe,1,0,5,1)} +function Vjb(a){a.a=KC(SI,Uhe,1,8,5,1)} +function MGb(a){Hkb(a.xf(),new QGb(a))} +function xtb(a){return a!=null?tb(a):0} +function b2b(a,b){return ntd(b,mpd(a))} +function c2b(a,b){return ntd(b,mpd(a))} +function dAb(a,b){return a[a.length]=b} +function gAb(a,b){return a[a.length]=b} +function Vq(a){return lr(a.b.Kc(),a.a)} +function dqd(a,b){return _o(qo(a.d),b)} +function eqd(a,b){return _o(qo(a.g),b)} +function fqd(a,b){return _o(qo(a.j),b)} +function Osd(a,b){Msd.call(this,a.b,b)} +function q0b(a){B_b.call(this,a,a,a,a)} +function HOb(a){a.b&&LOb(a);return a.a} +function IOb(a){a.b&&LOb(a);return a.c} +function uyb(a,b){if(lyb){return}a.b=b} +function lzd(a,b,c){NC(a,b,c);return c} +function mBc(a,b,c){NC(a.c[b.g],b.g,c)} +function _Hd(a,b,c){BD(a.c,69).Xh(b,c)} +function wfd(a,b,c){bld(c,c.i+a,c.j+b)} +function UOd(a,b){wtd(VKd(a.a),XOd(b))} +function bTd(a,b){wtd(QSd(a.a),eTd(b))} +function Lge(a){wfe();xfe.call(this,a)} +function CAd(a){return a==null?0:tb(a)} +function fNc(){fNc=ccb;eNc=new Rpb(v1)} +function h0d(){h0d=ccb;new i0d;new Rkb} +function i0d(){new Lqb;new Lqb;new Lqb} +function GA(){GA=ccb;fA();FA=new Lqb} +function Iy(){Iy=ccb;$wnd.Math.log(2)} +function UVd(){UVd=ccb;TVd=(AFd(),zFd)} +function _ge(){throw vbb(new cgb(Cxe))} +function ohe(){throw vbb(new cgb(Cxe))} +function che(){throw vbb(new cgb(Dxe))} +function rhe(){throw vbb(new cgb(Dxe))} +function Mg(a){this.a=a;Gg.call(this,a)} +function up(a){this.a=a;rf.call(this,a)} +function Bp(a){this.a=a;rf.call(this,a)} +function Okb(a,b){Mlb(a.c,a.c.length,b)} +function llb(a){return a.ab?1:0} +function Deb(a,b){return ybb(a,b)>0?a:b} +function TC(a,b,c){return {l:a,m:b,h:c}} +function Ctb(a,b){a.a!=null&&BIc(b,a.a)} +function Csb(a){a.a=new jtb;a.c=new jtb} +function hDb(a){this.b=a;this.a=new Rkb} +function dOb(a){this.b=new pOb;this.a=a} +function q_b(a){n_b.call(this);this.a=a} +function txb(){mxb.call(this,'Range',2)} +function bUb(){ZTb();this.a=new L2c(zP)} +function Bh(a,b){Qb(b);Ah(a).Jc(new Vw)} +function fKc(a,b){FJc();return b.n.b+=a} +function Tgc(a,b,c){return Rhb(a.g,c,b)} +function LJc(a,b,c){return Rhb(a.k,c,b)} +function r1c(a,b){return Rhb(a.a,b.a,b)} +function jBc(a,b,c){return hBc(b,c,a.c)} +function E6c(a){return new f7c(a.c,a.d)} +function F6c(a){return new f7c(a.c,a.d)} +function R6c(a){return new f7c(a.a,a.b)} +function CQd(a,b){return hA(a.a,b,null)} +function fec(a){QZb(a,null);RZb(a,null)} +function AOc(a){BOc(a,null);COc(a,null)} +function u4d(){qRd.call(this,null,null)} +function y4d(){RRd.call(this,null,null)} +function a7d(a){this.a=a;Lqb.call(this)} +function Pp(a){this.b=(mmb(),new iob(a))} +function Py(a){a.j=KC(VI,nie,310,0,0,1)} +function oAd(a,b,c){a.c.Vc(b,BD(c,133))} +function GAd(a,b,c){a.c.ji(b,BD(c,133))} +function JLd(a,b){Uxd(a);a.Gc(BD(b,15))} +function b7d(a,b){return t2d(a.c,a.b,b)} +function Bv(a,b){return new Qv(a.Kc(),b)} +function Lq(a,b){return rr(a.Kc(),b)!=-1} +function Sqb(a,b){return a.a.Bc(b)!=null} +function pr(a){return a.Ob()?a.Pb():null} +function yfb(a){return zfb(a,0,a.length)} +function JD(a,b){return a!=null&&AD(a,b)} +function $A(a,b){a.q.setHours(b);YA(a,b)} +function Yrb(a,b){if(a.c){jsb(b);isb(b)}} +function nk(a,b,c){BD(a.Kb(c),164).Nb(b)} +function RJc(a,b,c){SJc(a,b,c);return c} +function Eub(a,b,c){a.a=b^1502;a.b=c^kke} +function xHb(a,b,c){return a.a[b.g][c.g]} +function REc(a,b){return a.a[b.c.p][b.p]} +function aEc(a,b){return a.e[b.c.p][b.p]} +function tEc(a,b){return a.c[b.c.p][b.p]} +function OJc(a,b){return a.j[b.p]=aKc(b)} +function k5c(a,b){return cfb(a.f,b.tg())} +function Isd(a,b){return cfb(a.b,b.tg())} +function Sfd(a,b){return a.a0?b*b/a:b*b*100} +function CRb(a,b){return a>0?b/(a*a):b*100} +function G2c(a,b,c){return Ekb(b,I2c(a,c))} +function t3c(a,b,c){p3c();a.Xe(b)&&c.td(a)} +function St(a,b,c){var d;d=a.Zc(b);d.Rb(c)} +function O6c(a,b,c){a.a+=b;a.b+=c;return a} +function Z6c(a,b,c){a.a*=b;a.b*=c;return a} +function b7c(a,b,c){a.a-=b;a.b-=c;return a} +function a7c(a,b){a.a=b.a;a.b=b.b;return a} +function V6c(a){a.a=-a.a;a.b=-a.b;return a} +function Dic(a){this.c=a;this.a=1;this.b=1} +function xed(a){this.c=a;dld(a,0);eld(a,0)} +function u7c(a){Psb.call(this);n7c(this,a)} +function AXb(a){xXb();yXb(this);this.mf(a)} +function GRd(a,b){nRd();qRd.call(this,a,b)} +function dSd(a,b){LRd();RRd.call(this,a,b)} +function hSd(a,b){LRd();RRd.call(this,a,b)} +function fSd(a,b){LRd();dSd.call(this,a,b)} +function sId(a,b,c){dId.call(this,a,b,c,2)} +function zXd(a,b){UVd();nXd.call(this,a,b)} +function BXd(a,b){UVd();zXd.call(this,a,b)} +function DXd(a,b){UVd();zXd.call(this,a,b)} +function FXd(a,b){UVd();DXd.call(this,a,b)} +function PXd(a,b){UVd();nXd.call(this,a,b)} +function RXd(a,b){UVd();PXd.call(this,a,b)} +function XXd(a,b){UVd();nXd.call(this,a,b)} +function pAd(a,b){return a.c.Fc(BD(b,133))} +function w1d(a,b,c){return V1d(p1d(a,b),c)} +function N2d(a,b,c){return b.Qk(a.e,a.c,c)} +function P2d(a,b,c){return b.Rk(a.e,a.c,c)} +function a3d(a,b){return xid(a.e,BD(b,49))} +function aTd(a,b,c){vtd(QSd(a.a),b,eTd(c))} +function TOd(a,b,c){vtd(VKd(a.a),b,XOd(c))} +function ypb(a,b){b.$modCount=a.$modCount} +function MUc(){MUc=ccb;LUc=new Lsd('root')} +function LCd(){LCd=ccb;KCd=new lDd;new NDd} +function KVc(){this.a=new Hp;this.b=new Hp} +function FUd(){hJd.call(this);this.Bb|=Tje} +function t_c(){$r.call(this,'GROW_TREE',0)} +function C9d(a){return a==null?null:cde(a)} +function G9d(a){return a==null?null:jde(a)} +function J9d(a){return a==null?null:fcb(a)} +function K9d(a){return a==null?null:fcb(a)} +function fdb(a){if(a.o!=null){return}vdb(a)} +function DD(a){CCb(a==null||KD(a));return a} +function ED(a){CCb(a==null||LD(a));return a} +function GD(a){CCb(a==null||ND(a));return a} +function gB(a){this.q=new $wnd.Date(Sbb(a))} +function Mf(a,b){this.c=a;ne.call(this,a,b)} +function Sf(a,b){this.a=a;Mf.call(this,a,b)} +function Hg(a,b){this.d=a;Dg(this);this.b=b} +function bAb(a,b){Vzb.call(this,a);this.a=b} +function vAb(a,b){Vzb.call(this,a);this.a=b} +function sNb(a){pNb.call(this,0,0);this.f=a} +function Vg(a,b,c){dg.call(this,a,b,c,null)} +function Yg(a,b,c){dg.call(this,a,b,c,null)} +function Pxb(a,b,c){return a.ue(b,c)<=0?c:b} +function Qxb(a,b,c){return a.ue(b,c)<=0?b:c} +function g4c(a,b){return BD(Wrb(a.b,b),149)} +function i4c(a,b){return BD(Wrb(a.c,b),229)} +function wic(a){return BD(Ikb(a.a,a.b),287)} +function B6c(a){return new f7c(a.c,a.d+a.a)} +function eLc(a){return FJc(),Jzc(BD(a,197))} +function $Jb(){$Jb=ccb;ZJb=pqb((tdd(),sdd))} +function fOb(a,b){b.a?gOb(a,b):Fxb(a.a,b.b)} +function qyb(a,b){if(lyb){return}Ekb(a.a,b)} +function F2b(a,b){x2b();return f_b(b.d.i,a)} +function _9b(a,b){I9b();return new gac(b,a)} +function _Hb(a,b){ytb(b,lle);a.f=b;return a} +function Kld(a,b,c){c=_hd(a,b,3,c);return c} +function bmd(a,b,c){c=_hd(a,b,6,c);return c} +function kpd(a,b,c){c=_hd(a,b,9,c);return c} +function Cvd(a,b,c){++a.j;a.Ki();Atd(a,b,c)} +function Avd(a,b,c){++a.j;a.Hi(b,a.oi(b,c))} +function bRd(a,b,c){var d;d=a.Zc(b);d.Rb(c)} +function c7d(a,b,c){return C2d(a.c,a.b,b,c)} +function DAd(a,b){return (b&Ohe)%a.d.length} +function Msd(a,b){Lsd.call(this,a);this.a=b} +function uVd(a,b){lVd.call(this,a);this.a=b} +function sYd(a,b){lVd.call(this,a);this.a=b} +function zyd(a,b){this.c=a;zud.call(this,b)} +function YOd(a,b){this.a=a;qOd.call(this,b)} +function fTd(a,b){this.a=a;qOd.call(this,b)} +function Xp(a){this.a=(Xj(a,Jie),new Skb(a))} +function cq(a){this.a=(Xj(a,Jie),new Skb(a))} +function LA(a){!a.a&&(a.a=new VA);return a.a} +function XMb(a){if(a>8){return 0}return a+1} +function Ecb(a,b){Bcb();return a==b?0:a?1:-1} +function Opb(a,b,c){return Npb(a,BD(b,22),c)} +function Bz(a,b,c){return a.apply(b,c);var d} +function Sfb(a,b,c){a.a+=zfb(b,0,c);return a} +function ijb(a,b){var c;c=a.e;a.e=b;return c} +function trb(a,b){var c;c=a[hke];c.call(a,b)} +function urb(a,b){var c;c=a[hke];c.call(a,b)} +function Aib(a,b){a.a.Vc(a.b,b);++a.b;a.c=-1} +function Urb(a){Uhb(a.e);a.d.b=a.d;a.d.a=a.d} +function _f(a){a.b?_f(a.b):a.f.c.zc(a.e,a.d)} +function _Ab(a,b,c){EAb();MBb(a,b.Ce(a.a,c))} +function Bxb(a,b){return Vd(Cwb(a.a,b,true))} +function Cxb(a,b){return Vd(Dwb(a.a,b,true))} +function _Bb(a,b){return eCb(new Array(b),a)} +function HD(a){return String.fromCharCode(a)} +function mz(a){return a==null?null:a.message} +function gRb(){this.a=new Rkb;this.b=new Rkb} +function iTb(){this.a=new MQb;this.b=new tTb} +function tDb(){this.b=new d7c;this.c=new Rkb} +function _Qb(){this.d=new d7c;this.e=new d7c} +function n_b(){this.n=new d7c;this.o=new d7c} +function $Gb(){this.n=new p0b;this.i=new I6c} +function sec(){this.a=new Umc;this.b=new mnc} +function NIc(){this.a=new Rkb;this.d=new Rkb} +function LDc(){this.b=new Tqb;this.a=new Tqb} +function hSc(){this.b=new Lqb;this.a=new Lqb} +function HRc(){this.b=new tRc;this.a=new hRc} +function aHb(){$Gb.call(this);this.a=new d7c} +function Ywb(a){Zwb.call(this,a,(lxb(),hxb))} +function J_b(a,b,c,d){B_b.call(this,a,b,c,d)} +function sqd(a,b,c){c!=null&&kmd(b,Wqd(a,c))} +function tqd(a,b,c){c!=null&&lmd(b,Wqd(a,c))} +function Tod(a,b,c){c=_hd(a,b,11,c);return c} +function P6c(a,b){a.a+=b.a;a.b+=b.b;return a} +function c7c(a,b){a.a-=b.a;a.b-=b.b;return a} +function u7b(a,b){return a.n.a=(uCb(b),b)+10} +function v7b(a,b){return a.n.a=(uCb(b),b)+10} +function dLd(a,b){return b==a||pud(UKd(b),a)} +function PYd(a,b){return Rhb(a.a,b,'')==null} +function E2b(a,b){x2b();return !f_b(b.d.i,a)} +function rjc(a,b){fad(a.f)?sjc(a,b):tjc(a,b)} +function h1d(a,b){var c;c=b.Hh(a.a);return c} +function Cyd(a,b){qcb.call(this,gve+a+mue+b)} +function gUd(a,b,c,d){cUd.call(this,a,b,c,d)} +function Q4d(a,b,c,d){cUd.call(this,a,b,c,d)} +function U4d(a,b,c,d){Q4d.call(this,a,b,c,d)} +function n5d(a,b,c,d){i5d.call(this,a,b,c,d)} +function p5d(a,b,c,d){i5d.call(this,a,b,c,d)} +function v5d(a,b,c,d){i5d.call(this,a,b,c,d)} +function t5d(a,b,c,d){p5d.call(this,a,b,c,d)} +function A5d(a,b,c,d){p5d.call(this,a,b,c,d)} +function y5d(a,b,c,d){v5d.call(this,a,b,c,d)} +function D5d(a,b,c,d){A5d.call(this,a,b,c,d)} +function d6d(a,b,c,d){Y5d.call(this,a,b,c,d)} +function Vp(a,b,c){this.a=a;qc.call(this,b,c)} +function tk(a,b,c){this.c=b;this.b=c;this.a=a} +function ik(a,b,c){return a.d=BD(b.Kb(c),164)} +function j6d(a,b){return a.Aj().Nh().Kh(a,b)} +function h6d(a,b){return a.Aj().Nh().Ih(a,b)} +function Fdb(a,b){return uCb(a),PD(a)===PD(b)} +function dfb(a,b){return uCb(a),PD(a)===PD(b)} +function Dxb(a,b){return Vd(Cwb(a.a,b,false))} +function Exb(a,b){return Vd(Dwb(a.a,b,false))} +function vBb(a,b){return a.b.sd(new yBb(a,b))} +function BBb(a,b){return a.b.sd(new EBb(a,b))} +function HBb(a,b){return a.b.sd(new KBb(a,b))} +function lfb(a,b,c){return a.lastIndexOf(b,c)} +function uTb(a,b,c){return Kdb(a[b.b],a[c.b])} +function RTb(a,b){return yNb(b,(Nyc(),Cwc),a)} +function fmc(a,b){return beb(b.a.d.p,a.a.d.p)} +function emc(a,b){return beb(a.a.d.p,b.a.d.p)} +function _Oc(a,b){return Kdb(a.c-a.s,b.c-b.s)} +function S_b(a){return !a.c?-1:Jkb(a.c.a,a,0)} +function Vxd(a){return a<100?null:new Ixd(a)} +function ecd(a){return a==Zbd||a==_bd||a==$bd} +function zAd(a,b){return JD(b,15)&&Btd(a.c,b)} +function vyb(a,b){if(lyb){return}!!b&&(a.d=b)} +function ujb(a,b){var c;c=b;return !!Awb(a,c)} +function czd(a,b){this.c=a;Pyd.call(this,a,b)} +function fBb(a){this.c=a;nvb.call(this,rie,0)} +function Avb(a,b){Bvb.call(this,a,a.length,b)} +function aId(a,b,c){return BD(a.c,69).lk(b,c)} +function bId(a,b,c){return BD(a.c,69).mk(b,c)} +function O2d(a,b,c){return N2d(a,BD(b,332),c)} +function Q2d(a,b,c){return P2d(a,BD(b,332),c)} +function i3d(a,b,c){return h3d(a,BD(b,332),c)} +function k3d(a,b,c){return j3d(a,BD(b,332),c)} +function tn(a,b){return b==null?null:Hv(a.b,b)} +function Kcb(a){return LD(a)?(uCb(a),a):a.ke()} +function Ldb(a){return !isNaN(a)&&!isFinite(a)} +function Wn(a){Ql();this.a=(mmb(),new zob(a))} +function dIc(a){FHc();this.d=a;this.a=new jkb} +function xqb(a,b,c){this.a=a;this.b=b;this.c=c} +function Nrb(a,b,c){this.a=a;this.b=b;this.c=c} +function $sb(a,b,c){this.d=a;this.b=c;this.a=b} +function Qsb(a){Csb(this);Osb(this);ye(this,a)} +function Tkb(a){Ckb(this);bCb(this.c,0,a.Pc())} +function Xwb(a){uib(a.a);Kwb(a.c,a.b);a.b=null} +function iyb(a){this.a=a;Zfb();Cbb(Date.now())} +function JCb(){JCb=ccb;GCb=new nb;ICb=new nb} +function ntb(){ntb=ccb;ltb=new otb;mtb=new qtb} +function kzd(){kzd=ccb;jzd=KC(SI,Uhe,1,0,5,1)} +function tGd(){tGd=ccb;sGd=KC(SI,Uhe,1,0,5,1)} +function $Gd(){$Gd=ccb;ZGd=KC(SI,Uhe,1,0,5,1)} +function Ql(){Ql=ccb;new Zl((mmb(),mmb(),jmb))} +function pxb(a){lxb();return es((zxb(),yxb),a)} +function Hyb(a){Fyb();return es((Kyb(),Jyb),a)} +function OEb(a){MEb();return es((REb(),QEb),a)} +function WEb(a){UEb();return es((ZEb(),YEb),a)} +function tFb(a){rFb();return es((wFb(),vFb),a)} +function iHb(a){gHb();return es((lHb(),kHb),a)} +function PHb(a){NHb();return es((SHb(),RHb),a)} +function GIb(a){EIb();return es((JIb(),IIb),a)} +function vJb(a){qJb();return es((yJb(),xJb),a)} +function xLb(a){vLb();return es((ALb(),zLb),a)} +function TMb(a){RMb();return es((WMb(),VMb),a)} +function TOb(a){ROb();return es((WOb(),VOb),a)} +function ePb(a){cPb();return es((hPb(),gPb),a)} +function ZRb(a){XRb();return es((aSb(),_Rb),a)} +function ATb(a){yTb();return es((DTb(),CTb),a)} +function sUb(a){qUb();return es((vUb(),uUb),a)} +function rWb(a){lWb();return es((uWb(),tWb),a)} +function TXb(a){RXb();return es((WXb(),VXb),a)} +function Mb(a,b){if(!a){throw vbb(new Wdb(b))}} +function l0b(a){j0b();return es((o0b(),n0b),a)} +function r0b(a){B_b.call(this,a.d,a.c,a.a,a.b)} +function K_b(a){B_b.call(this,a.d,a.c,a.a,a.b)} +function mKb(a,b,c){this.b=a;this.c=b;this.a=c} +function BZb(a,b,c){this.b=a;this.a=b;this.c=c} +function TNb(a,b,c){this.a=a;this.b=b;this.c=c} +function uOb(a,b,c){this.a=a;this.b=b;this.c=c} +function S3b(a,b,c){this.a=a;this.b=b;this.c=c} +function Z6b(a,b,c){this.a=a;this.b=b;this.c=c} +function n9b(a,b,c){this.b=a;this.a=b;this.c=c} +function x$b(a,b,c){this.e=b;this.b=a;this.d=c} +function $Ab(a,b,c){EAb();a.a.Od(b,c);return b} +function LGb(a){var b;b=new KGb;b.e=a;return b} +function iLb(a){var b;b=new fLb;b.b=a;return b} +function D6b(){D6b=ccb;B6b=new M6b;C6b=new P6b} +function Hgc(){Hgc=ccb;Fgc=new ghc;Ggc=new ihc} +function jbc(a){gbc();return es((mbc(),lbc),a)} +function Cjc(a){Ajc();return es((Fjc(),Ejc),a)} +function Clc(a){Alc();return es((Flc(),Elc),a)} +function Cpc(a){Apc();return es((Fpc(),Epc),a)} +function Kpc(a){Ipc();return es((Npc(),Mpc),a)} +function Wpc(a){Rpc();return es((Zpc(),Ypc),a)} +function $jc(a){Xjc();return es((bkc(),akc),a)} +function Hkc(a){Fkc();return es((Kkc(),Jkc),a)} +function dqc(a){bqc();return es((gqc(),fqc),a)} +function rqc(a){mqc();return es((uqc(),tqc),a)} +function zqc(a){xqc();return es((Cqc(),Bqc),a)} +function Iqc(a){Gqc();return es((Lqc(),Kqc),a)} +function Vqc(a){Sqc();return es((Yqc(),Xqc),a)} +function brc(a){_qc();return es((erc(),drc),a)} +function nrc(a){lrc();return es((qrc(),prc),a)} +function Arc(a){yrc();return es((Drc(),Crc),a)} +function Qrc(a){Orc();return es((Trc(),Src),a)} +function Zrc(a){Xrc();return es((asc(),_rc),a)} +function gsc(a){esc();return es((jsc(),isc),a)} +function osc(a){msc();return es((rsc(),qsc),a)} +function Etc(a){Ctc();return es((Htc(),Gtc),a)} +function qzc(a){lzc();return es((tzc(),szc),a)} +function Azc(a){xzc();return es((Dzc(),Czc),a)} +function Mzc(a){Izc();return es((Pzc(),Ozc),a)} +function MAc(a){KAc();return es((PAc(),OAc),a)} +function mAc(a){kAc();return es((pAc(),oAc),a)} +function vAc(a){tAc();return es((yAc(),xAc),a)} +function DAc(a){BAc();return es((GAc(),FAc),a)} +function VAc(a){TAc();return es((YAc(),XAc),a)} +function $zc(a){Vzc();return es((bAc(),aAc),a)} +function bBc(a){_Ac();return es((eBc(),dBc),a)} +function vBc(a){tBc();return es((yBc(),xBc),a)} +function EBc(a){CBc();return es((HBc(),GBc),a)} +function NBc(a){LBc();return es((QBc(),PBc),a)} +function tGc(a){rGc();return es((wGc(),vGc),a)} +function WIc(a){UIc();return es((ZIc(),YIc),a)} +function $Lc(a){YLc();return es((bMc(),aMc),a)} +function gMc(a){eMc();return es((jMc(),iMc),a)} +function JOc(a){HOc();return es((MOc(),LOc),a)} +function HQc(a){FQc();return es((KQc(),JQc),a)} +function DRc(a){yRc();return es((GRc(),FRc),a)} +function tSc(a){qSc();return es((wSc(),vSc),a)} +function UTc(a){STc();return es((XTc(),WTc),a)} +function UUc(a){PUc();return es((XUc(),WUc),a)} +function aUc(a){$Tc();return es((dUc(),cUc),a)} +function wVc(a){tVc();return es((zVc(),yVc),a)} +function iWc(a){fWc();return es((lWc(),kWc),a)} +function sWc(a){pWc();return es((vWc(),uWc),a)} +function lXc(a){iXc();return es((oXc(),nXc),a)} +function vXc(a){sXc();return es((yXc(),xXc),a)} +function BYc(a){zYc();return es((EYc(),DYc),a)} +function m$c(a){k$c();return es((p$c(),o$c),a)} +function $$c(a){Y$c();return es((b_c(),a_c),a)} +function n_c(a){i_c();return es((q_c(),p_c),a)} +function w_c(a){s_c();return es((z_c(),y_c),a)} +function E_c(a){C_c();return es((H_c(),G_c),a)} +function P_c(a){N_c();return es((S_c(),R_c),a)} +function W0c(a){R0c();return es((Z0c(),Y0c),a)} +function f1c(a){a1c();return es((i1c(),h1c),a)} +function P5c(a){N5c();return es((S5c(),R5c),a)} +function b6c(a){_5c();return es((e6c(),d6c),a)} +function H7c(a){F7c();return es((K7c(),J7c),a)} +function k8c(a){i8c();return es((n8c(),m8c),a)} +function V8b(a){S8b();return es((Y8b(),X8b),a)} +function A5b(a){y5b();return es((D5b(),C5b),a)} +function jad(a){ead();return es((mad(),lad),a)} +function sad(a){qad();return es((vad(),uad),a)} +function Cad(a){Aad();return es((Fad(),Ead),a)} +function Oad(a){Mad();return es((Rad(),Qad),a)} +function jbd(a){hbd();return es((mbd(),lbd),a)} +function ubd(a){rbd();return es((xbd(),wbd),a)} +function Kbd(a){Hbd();return es((Nbd(),Mbd),a)} +function Vbd(a){Tbd();return es((Ybd(),Xbd),a)} +function hcd(a){dcd();return es((kcd(),jcd),a)} +function vcd(a){rcd();return es((ycd(),xcd),a)} +function vdd(a){tdd();return es((ydd(),xdd),a)} +function Kdd(a){Idd();return es((Ndd(),Mdd),a)} +function $cd(a){Ucd();return es((cdd(),bdd),a)} +function Fed(a){Ded();return es((Ied(),Hed),a)} +function rgd(a){pgd();return es((ugd(),tgd),a)} +function Esd(a){Csd();return es((Hsd(),Gsd),a)} +function Yoc(a,b){return (uCb(a),a)+(uCb(b),b)} +function NNd(a,b){Zfb();return wtd(ZKd(a.a),b)} +function SNd(a,b){Zfb();return wtd(ZKd(a.a),b)} +function bPc(a,b){this.c=a;this.a=b;this.b=b-a} +function nYc(a,b,c){this.a=a;this.b=b;this.c=c} +function L1c(a,b,c){this.a=a;this.b=b;this.c=c} +function T1c(a,b,c){this.a=a;this.b=b;this.c=c} +function Rrd(a,b,c){this.a=a;this.b=b;this.c=c} +function zCd(a,b,c){this.a=a;this.b=b;this.c=c} +function IVd(a,b,c){this.e=a;this.a=b;this.c=c} +function kWd(a,b,c){UVd();cWd.call(this,a,b,c)} +function HXd(a,b,c){UVd();oXd.call(this,a,b,c)} +function TXd(a,b,c){UVd();oXd.call(this,a,b,c)} +function ZXd(a,b,c){UVd();oXd.call(this,a,b,c)} +function JXd(a,b,c){UVd();HXd.call(this,a,b,c)} +function LXd(a,b,c){UVd();HXd.call(this,a,b,c)} +function NXd(a,b,c){UVd();LXd.call(this,a,b,c)} +function VXd(a,b,c){UVd();TXd.call(this,a,b,c)} +function _Xd(a,b,c){UVd();ZXd.call(this,a,b,c)} +function $j(a,b){Qb(a);Qb(b);return new _j(a,b)} +function Nq(a,b){Qb(a);Qb(b);return new Wq(a,b)} +function Rq(a,b){Qb(a);Qb(b);return new ar(a,b)} +function lr(a,b){Qb(a);Qb(b);return new zr(a,b)} +function BD(a,b){CCb(a==null||AD(a,b));return a} +function Nu(a){var b;b=new Rkb;fr(b,a);return b} +function Ex(a){var b;b=new Tqb;fr(b,a);return b} +function Hx(a){var b;b=new Gxb;Jq(b,a);return b} +function Ru(a){var b;b=new Psb;Jq(b,a);return b} +function YEc(a){!a.e&&(a.e=new Rkb);return a.e} +function SMd(a){!a.c&&(a.c=new xYd);return a.c} +function Ekb(a,b){a.c[a.c.length]=b;return true} +function WA(a,b){this.c=a;this.b=b;this.a=false} +function Gg(a){this.d=a;Dg(this);this.b=ed(a.d)} +function pzb(){this.a=';,;';this.b='';this.c=''} +function Bvb(a,b,c){qvb.call(this,b,c);this.a=a} +function fAb(a,b,c){this.b=a;fvb.call(this,b,c)} +function lsb(a,b,c){this.c=a;pjb.call(this,b,c)} +function bCb(a,b,c){$Bb(c,0,a,b,c.length,false)} +function HVb(a,b,c,d,e){a.b=b;a.c=c;a.d=d;a.a=e} +function eBb(a,b){if(b){a.b=b;a.a=(Tzb(b),b.a)}} +function v_b(a,b,c,d,e){a.d=b;a.c=c;a.a=d;a.b=e} +function h5b(a){var b,c;b=a.b;c=a.c;a.b=c;a.c=b} +function k5b(a){var b,c;c=a.d;b=a.a;a.d=b;a.a=c} +function Lbb(a){return zbb(iD(Fbb(a)?Rbb(a):a))} +function rlc(a,b){return beb(D0b(a.d),D0b(b.d))} +function uic(a,b){return b==(Ucd(),Tcd)?a.c:a.d} +function FHc(){FHc=ccb;DHc=(Ucd(),Tcd);EHc=zcd} +function DRb(){this.b=Edb(ED(Ksd((wSb(),vSb))))} +function aBb(a){return EAb(),KC(SI,Uhe,1,a,5,1)} +function C6c(a){return new f7c(a.c+a.b,a.d+a.a)} +function Vmc(a,b){Imc();return beb(a.d.p,b.d.p)} +function Lsb(a){sCb(a.b!=0);return Nsb(a,a.a.a)} +function Msb(a){sCb(a.b!=0);return Nsb(a,a.c.b)} +function rCb(a,b){if(!a){throw vbb(new ucb(b))}} +function mCb(a,b){if(!a){throw vbb(new Wdb(b))}} +function dWb(a,b,c){cWb.call(this,a,b);this.b=c} +function pMd(a,b,c){MLd.call(this,a,b);this.c=c} +function Dnc(a,b,c){Cnc.call(this,b,c);this.d=a} +function _Gd(a){$Gd();MGd.call(this);this.th(a)} +function PNd(a,b,c){this.a=a;nNd.call(this,b,c)} +function UNd(a,b,c){this.a=a;nNd.call(this,b,c)} +function k2d(a,b,c){MLd.call(this,a,b);this.c=c} +function y1d(){T0d();z1d.call(this,(yFd(),xFd))} +function gFd(a){return a!=null&&!OEd(a,CEd,DEd)} +function dFd(a,b){return (jFd(a)<<4|jFd(b))&aje} +function ln(a,b){return Vm(),Wj(a,b),new iy(a,b)} +function Sdd(a,b){var c;if(a.n){c=b;Ekb(a.f,c)}} +function Upd(a,b,c){var d;d=new yC(c);cC(a,b,d)} +function WUd(a,b){var c;c=a.c;VUd(a,b);return c} +function Ydd(a,b){b<0?(a.g=-1):(a.g=b);return a} +function $6c(a,b){W6c(a);a.a*=b;a.b*=b;return a} +function G6c(a,b,c,d,e){a.c=b;a.d=c;a.b=d;a.a=e} +function Dsb(a,b){Gsb(a,b,a.c.b,a.c);return true} +function jsb(a){a.a.b=a.b;a.b.a=a.a;a.a=a.b=null} +function Aq(a){this.b=a;this.a=Wm(this.b.a).Ed()} +function Wq(a,b){this.b=a;this.a=b;ol.call(this)} +function ar(a,b){this.a=a;this.b=b;ol.call(this)} +function vvb(a,b){qvb.call(this,b,1040);this.a=a} +function Eeb(a){return a==0||isNaN(a)?a:a<0?-1:1} +function WPb(a){QPb();return jtd(a)==Xod(ltd(a))} +function XPb(a){QPb();return ltd(a)==Xod(jtd(a))} +function iYb(a,b){return hYb(a,new cWb(b.a,b.b))} +function NZb(a){return !OZb(a)&&a.c.i.c==a.d.i.c} +function _Gb(a){var b;b=a.n;return a.a.b+b.d+b.a} +function YHb(a){var b;b=a.n;return a.e.b+b.d+b.a} +function ZHb(a){var b;b=a.n;return a.e.a+b.b+b.c} +function zfe(a){wfe();++vfe;return new ige(0,a)} +function o_b(a){if(a.a){return a.a}return JZb(a)} +function CCb(a){if(!a){throw vbb(new Cdb(null))}} +function X6d(){X6d=ccb;W6d=(mmb(),new anb(Fwe))} +function ex(){ex=ccb;new gx((_k(),$k),(Lk(),Kk))} +function oeb(){oeb=ccb;neb=KC(JI,nie,19,256,0,1)} +function d$c(a,b,c,d){e$c.call(this,a,b,c,d,0,0)} +function sQc(a,b,c){return Rhb(a.b,BD(c.b,17),b)} +function tQc(a,b,c){return Rhb(a.b,BD(c.b,17),b)} +function xfd(a,b){return Ekb(a,new f7c(b.a,b.b))} +function Bic(a,b){return a.c=b){throw vbb(new rcb)}} +function Pyb(a,b,c){NC(b,0,Bzb(b[0],c[0]));return b} +function _yc(a,b,c){b.Ye(c,Edb(ED(Ohb(a.b,c)))*a.a)} +function n6c(a,b,c){i6c();return m6c(a,b)&&m6c(a,c)} +function tcd(a){rcd();return !a.Hc(ncd)&&!a.Hc(pcd)} +function D6c(a){return new f7c(a.c+a.b/2,a.d+a.a/2)} +function oOd(a,b){return b.kh()?xid(a.b,BD(b,49)):b} +function bvb(a,b){this.e=a;this.d=(b&64)!=0?b|oie:b} +function qvb(a,b){this.c=0;this.d=a;this.b=b|64|oie} +function gub(a){this.b=new Skb(11);this.a=(ipb(),a)} +function Qwb(a){this.b=null;this.a=(ipb(),!a?fpb:a)} +function nHc(a){this.a=lHc(a.a);this.b=new Tkb(a.b)} +function Pzd(a){this.b=a;Oyd.call(this,a);Ozd(this)} +function Xzd(a){this.b=a;bzd.call(this,a);Wzd(this)} +function jUd(a,b,c){this.a=a;gUd.call(this,b,c,5,6)} +function Y5d(a,b,c,d){this.b=a;xMd.call(this,b,c,d)} +function nSd(a,b,c,d,e){oSd.call(this,a,b,c,d,e,-1)} +function DSd(a,b,c,d,e){ESd.call(this,a,b,c,d,e,-1)} +function cUd(a,b,c,d){xMd.call(this,a,b,c);this.b=d} +function i5d(a,b,c,d){pMd.call(this,a,b,c);this.b=d} +function x0d(a){Wud.call(this,a,false);this.a=false} +function Lj(a,b){this.b=a;sj.call(this,a.b);this.a=b} +function px(a,b){im();ox.call(this,a,Dm(new amb(b)))} +function Cfe(a,b){wfe();++vfe;return new Dge(a,b,0)} +function Efe(a,b){wfe();++vfe;return new Dge(6,a,b)} +function nfb(a,b){return dfb(a.substr(0,b.length),b)} +function Mhb(a,b){return ND(b)?Qhb(a,b):!!irb(a.f,b)} +function Rrb(a,b){uCb(b);while(a.Ob()){b.td(a.Pb())}} +function Vgb(a,b,c){Hgb();this.e=a;this.d=b;this.a=c} +function amc(a,b,c,d){var e;e=a.i;e.i=b;e.a=c;e.b=d} +function xJc(a){var b;b=a;while(b.f){b=b.f}return b} +function fkb(a){var b;b=bkb(a);sCb(b!=null);return b} +function gkb(a){var b;b=ckb(a);sCb(b!=null);return b} +function cv(a,b){var c;c=a.a.gc();Sb(b,c);return c-b} +function Glb(a,b){var c;for(c=0;c0?$wnd.Math.log(a/b):-100} +function ueb(a,b){return ybb(a,b)<0?-1:ybb(a,b)>0?1:0} +function HMb(a,b,c){return IMb(a,BD(b,46),BD(c,167))} +function iq(a,b){return BD(Rl(Wm(a.a)).Xb(b),42).cd()} +function Olb(a,b){return avb(b,a.length),new vvb(a,b)} +function Pyd(a,b){this.d=a;Fyd.call(this,a);this.e=b} +function Lub(a){this.d=(uCb(a),a);this.a=0;this.c=rie} +function rge(a,b){xfe.call(this,1);this.a=a;this.b=b} +function Rzb(a,b){!a.c?Ekb(a.b,b):Rzb(a.c,b);return a} +function uB(a,b,c){var d;d=tB(a,b);vB(a,b,c);return d} +function ZBb(a,b){var c;c=a.slice(0,b);return PC(c,a)} +function Flb(a,b,c){var d;for(d=0;d=a.g} +function NHc(a,b,c){var d;d=THc(a,b,c);return MHc(a,d)} +function Qpd(a,b){var c;c=a.a.length;tB(a,c);vB(a,c,b)} +function gCb(a,b){var c;c=console[a];c.call(console,b)} +function Bvd(a,b){var c;++a.j;c=a.Vi();a.Ii(a.oi(c,b))} +function E1c(a,b,c){BD(b.b,65);Hkb(b.a,new L1c(a,c,b))} +function oXd(a,b,c){VVd.call(this,b);this.a=a;this.b=c} +function Dge(a,b,c){xfe.call(this,a);this.a=b;this.b=c} +function dYd(a,b,c){this.a=a;lVd.call(this,b);this.b=c} +function f0d(a,b,c){this.a=a;mxd.call(this,8,b,null,c)} +function z1d(a){this.a=(uCb(Rve),Rve);this.b=a;new oUd} +function ct(a){this.c=a;this.b=this.c.a;this.a=this.c.e} +function usb(a){this.c=a;this.b=a.a.d.a;ypb(a.a.e,this)} +function uib(a){yCb(a.c!=-1);a.d.$c(a.c);a.b=a.c;a.c=-1} +function U6c(a){return $wnd.Math.sqrt(a.a*a.a+a.b*a.b)} +function Uvb(a,b){return _vb(b,a.a.c.length),Ikb(a.a,b)} +function Hb(a,b){return PD(a)===PD(b)||a!=null&&pb(a,b)} +function oAb(a){if(0>=a){return new yAb}return pAb(a-1)} +function Nfe(a){if(!bfe)return false;return Qhb(bfe,a)} +function Ehe(a){if(a)return a.dc();return !a.Kc().Ob()} +function Q_b(a){if(!a.a&&!!a.c){return a.c.b}return a.a} +function LHd(a){!a.a&&(a.a=new xMd(m5,a,4));return a.a} +function LQd(a){!a.d&&(a.d=new xMd(j5,a,1));return a.d} +function uCb(a){if(a==null){throw vbb(new Geb)}return a} +function Qzb(a){if(!a.c){a.d=true;Szb(a)}else{a.c.He()}} +function Tzb(a){if(!a.c){Uzb(a);a.d=true}else{Tzb(a.c)}} +function Kpb(a){Ae(a.a);a.b=KC(SI,Uhe,1,a.b.length,5,1)} +function qlc(a,b){return beb(b.j.c.length,a.j.c.length)} +function igd(a,b){a.c<0||a.b.b=0?a.Bh(c):vid(a,b)} +function WHc(a){var b,c;b=a.c.i.c;c=a.d.i.c;return b==c} +function Wwd(a){if(a.p!=4)throw vbb(new Ydb);return a.e} +function Vwd(a){if(a.p!=3)throw vbb(new Ydb);return a.e} +function Ywd(a){if(a.p!=6)throw vbb(new Ydb);return a.f} +function fxd(a){if(a.p!=6)throw vbb(new Ydb);return a.k} +function cxd(a){if(a.p!=3)throw vbb(new Ydb);return a.j} +function dxd(a){if(a.p!=4)throw vbb(new Ydb);return a.j} +function AYd(a){!a.b&&(a.b=new RYd(new NYd));return a.b} +function $1d(a){a.c==-2&&e2d(a,X0d(a.g,a.b));return a.c} +function pdb(a,b){var c;c=ldb('',a);c.n=b;c.i=1;return c} +function MNb(a,b){$Nb(BD(b.b,65),a);Hkb(b.a,new RNb(a))} +function Cnd(a,b){wtd((!a.a&&(a.a=new fTd(a,a)),a.a),b)} +function Qzd(a,b){this.b=a;Pyd.call(this,a,b);Ozd(this)} +function Yzd(a,b){this.b=a;czd.call(this,a,b);Wzd(this)} +function Ms(a,b,c,d){Wo.call(this,a,b);this.d=c;this.a=d} +function $o(a,b,c,d){Wo.call(this,a,c);this.a=b;this.f=d} +function iy(a,b){Pp.call(this,umb(Qb(a),Qb(b)));this.a=b} +function cae(){fod.call(this,Ewe,(p8d(),o8d));$9d(this)} +function AZd(){fod.call(this,_ve,(LFd(),KFd));uZd(this)} +function T0c(){$r.call(this,'DELAUNAY_TRIANGULATION',0)} +function vfb(a){return String.fromCharCode.apply(null,a)} +function Rhb(a,b,c){return ND(b)?Shb(a,b,c):jrb(a.f,b,c)} +function tmb(a){mmb();return !a?(ipb(),ipb(),hpb):a.ve()} +function d2c(a,b,c){Y1c();return c.pg(a,BD(b.cd(),146))} +function ix(a,b){ex();return new gx(new il(a),new Uk(b))} +function Iu(a){Xj(a,Mie);return Oy(wbb(wbb(5,a),a/10|0))} +function Vm(){Vm=ccb;Um=new wx(OC(GC(CK,1),zie,42,0,[]))} +function hob(a){!a.d&&(a.d=new lnb(a.c.Cc()));return a.d} +function eob(a){!a.a&&(a.a=new Gob(a.c.vc()));return a.a} +function gob(a){!a.b&&(a.b=new zob(a.c.ec()));return a.b} +function keb(a,b){while(b-->0){a=a<<1|(a<0?1:0)}return a} +function wtb(a,b){return PD(a)===PD(b)||a!=null&&pb(a,b)} +function Gbc(a,b){return Bcb(),BD(b.b,19).ad&&++d;return d} +function Nnd(a){var b,c;c=(b=new UQd,b);NQd(c,a);return c} +function Ond(a){var b,c;c=(b=new UQd,b);RQd(c,a);return c} +function hqd(a,b){var c;c=Ohb(a.f,b);Yqd(b,c);return null} +function JZb(a){var b;b=P2b(a);if(b){return b}return null} +function Wod(a){!a.b&&(a.b=new cUd(B2,a,12,3));return a.b} +function YEd(a){return a!=null&&hnb(GEd,a.toLowerCase())} +function ied(a,b){return Kdb(red(a)*qed(a),red(b)*qed(b))} +function jed(a,b){return Kdb(red(a)*qed(a),red(b)*qed(b))} +function wEb(a,b){return Kdb(a.d.c+a.d.b/2,b.d.c+b.d.b/2)} +function UVb(a,b){return Kdb(a.g.c+a.g.b/2,b.g.c+b.g.b/2)} +function pQb(a,b,c){c.a?eld(a,b.b-a.f/2):dld(a,b.a-a.g/2)} +function prd(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d} +function ord(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d} +function JVd(a,b,c,d){this.e=a;this.a=b;this.c=c;this.d=d} +function ZVd(a,b,c,d){this.a=a;this.c=b;this.d=c;this.b=d} +function cXd(a,b,c,d){UVd();mWd.call(this,b,c,d);this.a=a} +function jXd(a,b,c,d){UVd();mWd.call(this,b,c,d);this.a=a} +function Ng(a,b){this.a=a;Hg.call(this,a,BD(a.d,15).Zc(b))} +function ZBd(a){this.f=a;this.c=this.f.e;a.f>0&&YBd(this)} +function lBb(a,b,c,d){this.b=a;this.c=d;nvb.call(this,b,c)} +function tib(a){sCb(a.b=0&&dfb(a.substr(c,b.length),b)} +function H2d(a,b,c,d,e,f,g){return new O7d(a.e,b,c,d,e,f,g)} +function Cxd(a,b,c,d,e,f){this.a=a;nxd.call(this,b,c,d,e,f)} +function vyd(a,b,c,d,e,f){this.a=a;nxd.call(this,b,c,d,e,f)} +function $Ec(a,b){this.g=a;this.d=OC(GC(OQ,1),kne,10,0,[b])} +function KVd(a,b){this.e=a;this.a=SI;this.b=R5d(b);this.c=b} +function cIb(a,b){$Gb.call(this);THb(this);this.a=a;this.c=b} +function kBc(a,b,c,d){NC(a.c[b.g],c.g,d);NC(a.c[c.g],b.g,d)} +function nBc(a,b,c,d){NC(a.c[b.g],b.g,c);NC(a.b[b.g],b.g,d)} +function cBc(){_Ac();return OC(GC(fX,1),Kie,376,0,[$Ac,ZAc])} +function crc(){_qc();return OC(GC(MW,1),Kie,479,0,[$qc,Zqc])} +function Aqc(){xqc();return OC(GC(JW,1),Kie,419,0,[vqc,wqc])} +function Lpc(){Ipc();return OC(GC(FW,1),Kie,422,0,[Gpc,Hpc])} +function psc(){msc();return OC(GC(SW,1),Kie,420,0,[ksc,lsc])} +function EAc(){BAc();return OC(GC(cX,1),Kie,421,0,[zAc,AAc])} +function XIc(){UIc();return OC(GC(mY,1),Kie,523,0,[TIc,SIc])} +function KOc(){HOc();return OC(GC(DZ,1),Kie,520,0,[GOc,FOc])} +function _Lc(){YLc();return OC(GC(fZ,1),Kie,516,0,[XLc,WLc])} +function hMc(){eMc();return OC(GC(gZ,1),Kie,515,0,[cMc,dMc])} +function IQc(){FQc();return OC(GC(YZ,1),Kie,455,0,[DQc,EQc])} +function bUc(){$Tc();return OC(GC(F$,1),Kie,425,0,[ZTc,YTc])} +function VTc(){STc();return OC(GC(E$,1),Kie,480,0,[QTc,RTc])} +function VUc(){PUc();return OC(GC(K$,1),Kie,495,0,[NUc,OUc])} +function jWc(){fWc();return OC(GC(X$,1),Kie,426,0,[dWc,eWc])} +function g1c(){a1c();return OC(GC(X_,1),Kie,429,0,[_0c,$0c])} +function F_c(){C_c();return OC(GC(P_,1),Kie,430,0,[B_c,A_c])} +function PEb(){MEb();return OC(GC(aN,1),Kie,428,0,[LEb,KEb])} +function XEb(){UEb();return OC(GC(bN,1),Kie,427,0,[SEb,TEb])} +function $Rb(){XRb();return OC(GC(gP,1),Kie,424,0,[VRb,WRb])} +function B5b(){y5b();return OC(GC(ZR,1),Kie,511,0,[x5b,w5b])} +function lid(a,b,c,d){return c>=0?a.jh(b,c,d):a.Sg(null,c,d)} +function hgd(a){if(a.b.b==0){return a.a.$e()}return Lsb(a.b)} +function Xwd(a){if(a.p!=5)throw vbb(new Ydb);return Tbb(a.f)} +function exd(a){if(a.p!=5)throw vbb(new Ydb);return Tbb(a.k)} +function pNd(a){PD(a.a)===PD((NKd(),MKd))&&qNd(a);return a.a} +function by(a){this.a=BD(Qb(a),271);this.b=(mmb(),new Zob(a))} +function bQc(a,b){$Pc(this,new f7c(a.a,a.b));_Pc(this,Ru(b))} +function FQc(){FQc=ccb;DQc=new GQc(jle,0);EQc=new GQc(kle,1)} +function YLc(){YLc=ccb;XLc=new ZLc(kle,0);WLc=new ZLc(jle,1)} +function Hp(){Gp.call(this,new Mqb(Cv(12)));Lb(true);this.a=2} +function Hge(a,b,c){wfe();xfe.call(this,a);this.b=b;this.a=c} +function cWd(a,b,c){UVd();VVd.call(this,b);this.a=a;this.b=c} +function aIb(a){$Gb.call(this);THb(this);this.a=a;this.c=true} +function isb(a){var b;b=a.c.d.b;a.b=b;a.a=a.c.d;b.a=a.c.d.b=a} +function $Cb(a){var b;NGb(a.a);MGb(a.a);b=new YGb(a.a);UGb(b)} +function iKb(a,b){hKb(a,true);Hkb(a.e.wf(),new mKb(a,true,b))} +function tlb(a,b){pCb(b);return vlb(a,KC(WD,oje,25,b,15,1),b)} +function YPb(a,b){QPb();return a==Xod(jtd(b))||a==Xod(ltd(b))} +function Phb(a,b){return b==null?Wd(irb(a.f,null)):Crb(a.g,b)} +function Ksb(a){return a.b==0?null:(sCb(a.b!=0),Nsb(a,a.a.a))} +function QD(a){return Math.max(Math.min(a,Ohe),-2147483648)|0} +function uz(a,b){var c=tz[a.charCodeAt(0)];return c==null?a:c} +function Cx(a,b){Rb(a,'set1');Rb(b,'set2');return new Px(a,b)} +function QUb(a,b){var c;c=zUb(a.f,b);return P6c(V6c(c),a.f.d)} +function Jwb(a,b){var c,d;c=b;d=new fxb;Lwb(a,c,d);return d.d} +function NJb(a,b,c,d){var e;e=new aHb;b.a[c.g]=e;Npb(a.b,d,e)} +function zid(a,b,c){var d;d=a.Yg(b);d>=0?a.sh(d,c):uid(a,b,c)} +function hvd(a,b,c){evd();!!a&&Rhb(dvd,a,b);!!a&&Rhb(cvd,a,c)} +function g_c(a,b,c){this.i=new Rkb;this.b=a;this.g=b;this.a=c} +function VZc(a,b,c){this.c=new Rkb;this.e=a;this.f=b;this.b=c} +function b$c(a,b,c){this.a=new Rkb;this.e=a;this.f=b;this.c=c} +function Zy(a,b){Py(this);this.f=b;this.g=a;Ry(this);this._d()} +function ZA(a,b){var c;c=a.q.getHours();a.q.setDate(b);YA(a,c)} +function no(a,b){var c;Qb(b);for(c=a.a;c;c=c.c){b.Od(c.g,c.i)}} +function Fx(a){var b;b=new Uqb(Cv(a.length));nmb(b,a);return b} +function ecb(a){function b(){} +;b.prototype=a||{};return new b} +function dkb(a,b){if(Zjb(a,b)){wkb(a);return true}return false} +function aC(a,b){if(b==null){throw vbb(new Geb)}return bC(a,b)} +function tdb(a){if(a.qe()){return null}var b=a.n;return _bb[b]} +function Mld(a){if(a.Db>>16!=3)return null;return BD(a.Cb,33)} +function mpd(a){if(a.Db>>16!=9)return null;return BD(a.Cb,33)} +function fmd(a){if(a.Db>>16!=6)return null;return BD(a.Cb,79)} +function Ind(a){if(a.Db>>16!=7)return null;return BD(a.Cb,235)} +function Fod(a){if(a.Db>>16!=7)return null;return BD(a.Cb,160)} +function Xod(a){if(a.Db>>16!=11)return null;return BD(a.Cb,33)} +function nid(a,b){var c;c=a.Yg(b);return c>=0?a.lh(c):tid(a,b)} +function Dtd(a,b){var c;c=new Bsb(b);Ve(c,a);return new Tkb(c)} +function Uud(a){var b;b=a.d;b=a.si(a.f);wtd(a,b);return b.Ob()} +function t_b(a,b){a.b+=b.b;a.c+=b.c;a.d+=b.d;a.a+=b.a;return a} +function A4b(a,b){return $wnd.Math.abs(a)<$wnd.Math.abs(b)?a:b} +function Zod(a){return !a.a&&(a.a=new cUd(E2,a,10,11)),a.a.i>0} +function oDb(){this.a=new zsb;this.e=new Tqb;this.g=0;this.i=0} +function BGc(a){this.a=a;this.b=KC(SX,nie,1944,a.e.length,0,2)} +function RHc(a,b,c){var d;d=SHc(a,b,c);a.b=new BHc(d.c.length)} +function eMc(){eMc=ccb;cMc=new fMc(vle,0);dMc=new fMc('UP',1)} +function STc(){STc=ccb;QTc=new TTc(Yqe,0);RTc=new TTc('FAN',1)} +function evd(){evd=ccb;dvd=new Lqb;cvd=new Lqb;ivd(hK,new jvd)} +function Swd(a){if(a.p!=0)throw vbb(new Ydb);return Kbb(a.f,0)} +function _wd(a){if(a.p!=0)throw vbb(new Ydb);return Kbb(a.k,0)} +function MHd(a){if(a.Db>>16!=3)return null;return BD(a.Cb,147)} +function ZJd(a){if(a.Db>>16!=6)return null;return BD(a.Cb,235)} +function WId(a){if(a.Db>>16!=17)return null;return BD(a.Cb,26)} +function rdb(a,b){var c=a.a=a.a||[];return c[b]||(c[b]=a.le(b))} +function hrb(a,b){var c;c=a.a.get(b);return c==null?new Array:c} +function aB(a,b){var c;c=a.q.getHours();a.q.setMonth(b);YA(a,c)} +function Shb(a,b,c){return b==null?jrb(a.f,null,c):Drb(a.g,b,c)} +function FLd(a,b,c,d,e,f){return new pSd(a.e,b,a.aj(),c,d,e,f)} +function Tfb(a,b,c){a.a=qfb(a.a,0,b)+(''+c)+pfb(a.a,b);return a} +function bq(a,b,c){Ekb(a.a,(Vm(),Wj(b,c),new Wo(b,c)));return a} +function uu(a){ot(a.c);a.e=a.a=a.c;a.c=a.c.c;++a.d;return a.a.f} +function vu(a){ot(a.e);a.c=a.a=a.e;a.e=a.e.e;--a.d;return a.a.f} +function RZb(a,b){!!a.d&&Lkb(a.d.e,a);a.d=b;!!a.d&&Ekb(a.d.e,a)} +function QZb(a,b){!!a.c&&Lkb(a.c.g,a);a.c=b;!!a.c&&Ekb(a.c.g,a)} +function $_b(a,b){!!a.c&&Lkb(a.c.a,a);a.c=b;!!a.c&&Ekb(a.c.a,a)} +function F0b(a,b){!!a.i&&Lkb(a.i.j,a);a.i=b;!!a.i&&Ekb(a.i.j,a)} +function jDb(a,b,c){this.a=b;this.c=a;this.b=(Qb(c),new Tkb(c))} +function qXb(a,b,c){this.a=b;this.c=a;this.b=(Qb(c),new Tkb(c))} +function aOb(a,b){this.a=a;this.c=R6c(this.a);this.b=new K6c(b)} +function IAb(a){var b;Uzb(a);b=new Tqb;return JAb(a,new jBb(b))} +function wCb(a,b){if(a<0||a>b){throw vbb(new qcb(Ake+a+Bke+b))}} +function Ppb(a,b){return vqb(a.a,b)?Qpb(a,BD(b,22).g,null):null} +function WUb(a){LUb();return Bcb(),BD(a.a,81).d.e!=0?true:false} +function qs(){qs=ccb;ps=as((hs(),OC(GC(yG,1),Kie,538,0,[gs])))} +function SBc(){SBc=ccb;RBc=c3c(new j3c,(qUb(),pUb),(S8b(),J8b))} +function ZBc(){ZBc=ccb;YBc=c3c(new j3c,(qUb(),pUb),(S8b(),J8b))} +function oCc(){oCc=ccb;nCc=c3c(new j3c,(qUb(),pUb),(S8b(),J8b))} +function aJc(){aJc=ccb;_Ic=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function FJc(){FJc=ccb;EJc=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function ILc(){ILc=ccb;HLc=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function wMc(){wMc=ccb;vMc=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function fUc(){fUc=ccb;eUc=c3c(new j3c,(yRc(),xRc),(qSc(),kSc))} +function DOc(a,b,c,d){this.c=a;this.d=d;BOc(this,b);COc(this,c)} +function W3c(a){this.c=new Psb;this.b=a.b;this.d=a.c;this.a=a.a} +function e7c(a){this.a=$wnd.Math.cos(a);this.b=$wnd.Math.sin(a)} +function BOc(a,b){!!a.a&&Lkb(a.a.k,a);a.a=b;!!a.a&&Ekb(a.a.k,a)} +function COc(a,b){!!a.b&&Lkb(a.b.f,a);a.b=b;!!a.b&&Ekb(a.b.f,a)} +function D1c(a,b){E1c(a,a.b,a.c);BD(a.b.b,65);!!b&&BD(b.b,65).b} +function BUd(a,b){CUd(a,b);JD(a.Cb,88)&&XMd($Kd(BD(a.Cb,88)),2)} +function cJd(a,b){JD(a.Cb,88)&&XMd($Kd(BD(a.Cb,88)),4);pnd(a,b)} +function lKd(a,b){JD(a.Cb,179)&&(BD(a.Cb,179).tb=null);pnd(a,b)} +function T2d(a,b){return Q6d(),YId(b)?new R7d(b,a):new f7d(b,a)} +function jsd(a,b){var c,d;c=b.c;d=c!=null;d&&Qpd(a,new yC(b.c))} +function XOd(a){var b,c;c=(LFd(),b=new UQd,b);NQd(c,a);return c} +function eTd(a){var b,c;c=(LFd(),b=new UQd,b);NQd(c,a);return c} +function yCc(a,b){var c;c=new H1b(a);b.c[b.c.length]=c;return c} +function Aw(a,b){var c;c=BD(Hv(nd(a.a),b),14);return !c?0:c.gc()} +function UAb(a){var b;Uzb(a);b=(ipb(),ipb(),gpb);return VAb(a,b)} +function nr(a){var b;while(true){b=a.Pb();if(!a.Ob()){return b}}} +function Ki(a,b){Ii.call(this,new Mqb(Cv(a)));Xj(b,mie);this.a=b} +function Jib(a,b,c){xCb(b,c,a.gc());this.c=a;this.a=b;this.b=c-b} +function Mkb(a,b,c){var d;xCb(b,c,a.c.length);d=c-b;cCb(a.c,b,d)} +function Fub(a,b){Eub(a,Tbb(xbb(Obb(b,24),nke)),Tbb(xbb(b,nke)))} +function tCb(a,b){if(a<0||a>=b){throw vbb(new qcb(Ake+a+Bke+b))}} +function BCb(a,b){if(a<0||a>=b){throw vbb(new Xfb(Ake+a+Bke+b))}} +function Kub(a,b){this.b=(uCb(a),a);this.a=(b&Rje)==0?b|64|oie:b} +function kkb(a){Vjb(this);dCb(this.a,geb($wnd.Math.max(8,a))<<1)} +function A0b(a){return l7c(OC(GC(m1,1),nie,8,0,[a.i.n,a.n,a.a]))} +function Iyb(){Fyb();return OC(GC(xL,1),Kie,132,0,[Cyb,Dyb,Eyb])} +function jHb(){gHb();return OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])} +function QHb(){NHb();return OC(GC(sN,1),Kie,461,0,[LHb,KHb,MHb])} +function HIb(){EIb();return OC(GC(zN,1),Kie,462,0,[DIb,CIb,BIb])} +function UXb(){RXb();return OC(GC(hQ,1),Kie,423,0,[QXb,PXb,OXb])} +function BTb(){yTb();return OC(GC(oP,1),Kie,379,0,[wTb,vTb,xTb])} +function Bzc(){xzc();return OC(GC(ZW,1),Kie,378,0,[uzc,vzc,wzc])} +function Xpc(){Rpc();return OC(GC(GW,1),Kie,314,0,[Ppc,Opc,Qpc])} +function eqc(){bqc();return OC(GC(HW,1),Kie,337,0,[$pc,aqc,_pc])} +function Jqc(){Gqc();return OC(GC(KW,1),Kie,450,0,[Eqc,Dqc,Fqc])} +function Ikc(){Fkc();return OC(GC(vV,1),Kie,361,0,[Ekc,Dkc,Ckc])} +function hsc(){esc();return OC(GC(RW,1),Kie,303,0,[csc,dsc,bsc])} +function $rc(){Xrc();return OC(GC(QW,1),Kie,292,0,[Vrc,Wrc,Urc])} +function NAc(){KAc();return OC(GC(dX,1),Kie,452,0,[JAc,HAc,IAc])} +function wAc(){tAc();return OC(GC(bX,1),Kie,339,0,[rAc,qAc,sAc])} +function WAc(){TAc();return OC(GC(eX,1),Kie,375,0,[QAc,RAc,SAc])} +function OBc(){LBc();return OC(GC(jX,1),Kie,377,0,[JBc,KBc,IBc])} +function wBc(){tBc();return OC(GC(hX,1),Kie,336,0,[qBc,rBc,sBc])} +function FBc(){CBc();return OC(GC(iX,1),Kie,338,0,[BBc,zBc,ABc])} +function uGc(){rGc();return OC(GC(PX,1),Kie,454,0,[oGc,pGc,qGc])} +function xVc(){tVc();return OC(GC(O$,1),Kie,442,0,[sVc,qVc,rVc])} +function tWc(){pWc();return OC(GC(Y$,1),Kie,380,0,[mWc,nWc,oWc])} +function CYc(){zYc();return OC(GC(q_,1),Kie,381,0,[xYc,yYc,wYc])} +function wXc(){sXc();return OC(GC(b_,1),Kie,293,0,[qXc,rXc,pXc])} +function _$c(){Y$c();return OC(GC(J_,1),Kie,437,0,[V$c,W$c,X$c])} +function kbd(){hbd();return OC(GC(z1,1),Kie,334,0,[fbd,ebd,gbd])} +function tad(){qad();return OC(GC(u1,1),Kie,272,0,[nad,oad,pad])} +function o3d(a,b){return p3d(a,b,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function LZc(a,b,c){var d;d=MZc(a,b,false);return d.b<=b&&d.a<=c} +function tMc(a,b,c){var d;d=new sMc;d.b=b;d.a=c;++b.b;Ekb(a.d,d)} +function fs(a,b){var c;c=(uCb(a),a).g;lCb(!!c);uCb(b);return c(b)} +function av(a,b){var c,d;d=cv(a,b);c=a.a.Zc(d);return new qv(a,c)} +function cKd(a){if(a.Db>>16!=6)return null;return BD(aid(a),235)} +function Uwd(a){if(a.p!=2)throw vbb(new Ydb);return Tbb(a.f)&aje} +function bxd(a){if(a.p!=2)throw vbb(new Ydb);return Tbb(a.k)&aje} +function Z1d(a){a.a==(T0d(),S0d)&&d2d(a,U0d(a.g,a.b));return a.a} +function _1d(a){a.d==(T0d(),S0d)&&f2d(a,Y0d(a.g,a.b));return a.d} +function mlb(a){sCb(a.ad?1:0} +function bjc(a,b){var c,d;c=ajc(b);d=c;return BD(Ohb(a.c,d),19).a} +function iSc(a,b){var c;c=a+'';while(c.length0&&a.a[--a.d]==0);a.a[a.d++]==0&&(a.e=0)} +function wwb(a){return !a.a?a.c:a.e.length==0?a.a.a:a.a.a+(''+a.e)} +function RSd(a){return !!a.a&&QSd(a.a.a).i!=0&&!(!!a.b&&QTd(a.b))} +function cLd(a){return !!a.u&&VKd(a.u.a).i!=0&&!(!!a.n&&FMd(a.n))} +function $i(a){return Zj(a.e.Hd().gc()*a.c.Hd().gc(),16,new ij(a))} +function XA(a,b){return ueb(Cbb(a.q.getTime()),Cbb(b.q.getTime()))} +function k_b(a){return BD(Qkb(a,KC(AQ,jne,17,a.c.length,0,1)),474)} +function l_b(a){return BD(Qkb(a,KC(OQ,kne,10,a.c.length,0,1)),193)} +function cKc(a){FJc();return !OZb(a)&&!(!OZb(a)&&a.c.i.c==a.d.i.c)} +function kDb(a,b,c){var d;d=(Qb(a),new Tkb(a));iDb(new jDb(d,b,c))} +function rXb(a,b,c){var d;d=(Qb(a),new Tkb(a));pXb(new qXb(d,b,c))} +function Nwb(a,b){var c;c=1-b;a.a[c]=Owb(a.a[c],c);return Owb(a,b)} +function YXc(a,b){var c;a.e=new QXc;c=gVc(b);Okb(c,a.c);ZXc(a,c,0)} +function o4c(a,b,c,d){var e;e=new w4c;e.a=b;e.b=c;e.c=d;Dsb(a.a,e)} +function p4c(a,b,c,d){var e;e=new w4c;e.a=b;e.b=c;e.c=d;Dsb(a.b,e)} +function i6d(a){var b,c,d;b=new A6d;c=s6d(b,a);z6d(b);d=c;return d} +function vZd(){var a,b,c;b=(c=(a=new UQd,a),c);Ekb(rZd,b);return b} +function H2c(a){a.j.c=KC(SI,Uhe,1,0,5,1);Ae(a.c);h3c(a.a);return a} +function tgc(a){qgc();if(JD(a.g,10)){return BD(a.g,10)}return null} +function Zw(a){if(Ah(a).dc()){return false}Bh(a,new bx);return true} +function _y(b){if(!('stack' in b)){try{throw b}catch(a){}}return b} +function Pb(a,b){if(a<0||a>=b){throw vbb(new qcb(Ib(a,b)))}return a} +function Tb(a,b,c){if(a<0||bc){throw vbb(new qcb(Kb(a,b,c)))}} +function eVb(a,b){Qqb(a.a,b);if(b.d){throw vbb(new hz(Hke))}b.d=a} +function xpb(a,b){if(b.$modCount!=a.$modCount){throw vbb(new Apb)}} +function $pb(a,b){if(JD(b,42)){return Jd(a.a,BD(b,42))}return false} +function dib(a,b){if(JD(b,42)){return Jd(a.a,BD(b,42))}return false} +function msb(a,b){if(JD(b,42)){return Jd(a.a,BD(b,42))}return false} +function qAb(a,b){if(a.a<=a.b){b.ud(a.a++);return true}return false} +function Sbb(a){var b;if(Fbb(a)){b=a;return b==-0.?0:b}return oD(a)} +function tAb(a){var b;Tzb(a);b=new drb;_ub(a.a,new BAb(b));return b} +function Yzb(a){var b;Tzb(a);b=new Gpb;_ub(a.a,new mAb(b));return b} +function Bib(a,b){this.a=a;vib.call(this,a);wCb(b,a.gc());this.b=b} +function orb(a){this.e=a;this.b=this.e.a.entries();this.a=new Array} +function Oi(a){return Zj(a.e.Hd().gc()*a.c.Hd().gc(),273,new cj(a))} +function Qu(a){return new Skb((Xj(a,Mie),Oy(wbb(wbb(5,a),a/10|0))))} +function m_b(a){return BD(Qkb(a,KC(aR,lne,11,a.c.length,0,1)),1943)} +function sMb(a,b,c){return c.f.c.length>0?HMb(a.a,b,c):HMb(a.b,b,c)} +function SZb(a,b,c){!!a.d&&Lkb(a.d.e,a);a.d=b;!!a.d&&Dkb(a.d.e,c,a)} +function a5b(a,b){i5b(b,a);k5b(a.d);k5b(BD(vNb(a,(Nyc(),wxc)),207))} +function _4b(a,b){f5b(b,a);h5b(a.d);h5b(BD(vNb(a,(Nyc(),wxc)),207))} +function Ypd(a,b){var c,d;c=aC(a,b);d=null;!!c&&(d=c.fe());return d} +function Zpd(a,b){var c,d;c=tB(a,b);d=null;!!c&&(d=c.ie());return d} +function $pd(a,b){var c,d;c=aC(a,b);d=null;!!c&&(d=c.ie());return d} +function _pd(a,b){var c,d;c=aC(a,b);d=null;!!c&&(d=aqd(c));return d} +function Tqd(a,b,c){var d;d=Wpd(c);ro(a.g,d,b);ro(a.i,b,c);return b} +function Ez(a,b,c){var d;d=Cz();try{return Bz(a,b,c)}finally{Fz(d)}} +function C6d(a){var b;b=a.Wg();this.a=JD(b,69)?BD(b,69).Zh():b.Kc()} +function j3c(){D2c.call(this);this.j.c=KC(SI,Uhe,1,0,5,1);this.a=-1} +function mxd(a,b,c,d){this.d=a;this.n=b;this.g=c;this.o=d;this.p=-1} +function jk(a,b,c,d){this.e=d;this.d=null;this.c=a;this.a=b;this.b=c} +function uEc(a,b,c){this.d=new HEc(this);this.e=a;this.i=b;this.f=c} +function msc(){msc=ccb;ksc=new nsc(gle,0);lsc=new nsc('TOP_LEFT',1)} +function cDc(){cDc=ccb;bDc=ix(meb(1),meb(4));aDc=ix(meb(1),meb(2))} +function z_c(){z_c=ccb;y_c=as((s_c(),OC(GC(O_,1),Kie,551,0,[r_c])))} +function q_c(){q_c=ccb;p_c=as((i_c(),OC(GC(N_,1),Kie,482,0,[h_c])))} +function Z0c(){Z0c=ccb;Y0c=as((R0c(),OC(GC(W_,1),Kie,530,0,[Q0c])))} +function hPb(){hPb=ccb;gPb=as((cPb(),OC(GC(GO,1),Kie,481,0,[bPb])))} +function yLb(){vLb();return OC(GC(PN,1),Kie,406,0,[uLb,rLb,sLb,tLb])} +function qxb(){lxb();return OC(GC(iL,1),Kie,297,0,[hxb,ixb,jxb,kxb])} +function UOb(){ROb();return OC(GC(CO,1),Kie,394,0,[OOb,NOb,POb,QOb])} +function UMb(){RMb();return OC(GC(jO,1),Kie,323,0,[OMb,NMb,PMb,QMb])} +function sWb(){lWb();return OC(GC(SP,1),Kie,405,0,[hWb,kWb,iWb,jWb])} +function kbc(){gbc();return OC(GC(VS,1),Kie,360,0,[fbc,dbc,ebc,cbc])} +function Vc(a,b,c,d){return JD(c,54)?new Cg(a,b,c,d):new qg(a,b,c,d)} +function Djc(){Ajc();return OC(GC(mV,1),Kie,411,0,[wjc,xjc,yjc,zjc])} +function okc(a){var b;return a.j==(Ucd(),Rcd)&&(b=pkc(a),uqb(b,zcd))} +function Mdc(a,b){var c;c=b.a;QZb(c,b.c.d);RZb(c,b.d.d);q7c(c.a,a.n)} +function Smc(a,b){return BD(Btb(QAb(BD(Qc(a.k,b),15).Oc(),Hmc)),113)} +function Tmc(a,b){return BD(Btb(RAb(BD(Qc(a.k,b),15).Oc(),Hmc)),113)} +function _w(a){return new Kub(rmb(BD(a.a.dd(),14).gc(),a.a.cd()),16)} +function Qq(a){if(JD(a,14)){return BD(a,14).dc()}return !a.Kc().Ob()} +function ugc(a){qgc();if(JD(a.g,145)){return BD(a.g,145)}return null} +function Ko(a){if(a.e.g!=a.b){throw vbb(new Apb)}return !!a.c&&a.d>0} +function Xsb(a){sCb(a.b!=a.d.c);a.c=a.b;a.b=a.b.a;++a.a;return a.c.c} +function Xjb(a,b){uCb(b);NC(a.a,a.c,b);a.c=a.c+1&a.a.length-1;_jb(a)} +function Wjb(a,b){uCb(b);a.b=a.b-1&a.a.length-1;NC(a.a,a.b,b);_jb(a)} +function A2c(a,b){var c;for(c=a.j.c.length;c0&&$fb(a.g,0,b,0,a.i);return b} +function qEd(a,b){pEd();var c;c=BD(Ohb(oEd,a),55);return !c||c.wj(b)} +function Twd(a){if(a.p!=1)throw vbb(new Ydb);return Tbb(a.f)<<24>>24} +function axd(a){if(a.p!=1)throw vbb(new Ydb);return Tbb(a.k)<<24>>24} +function gxd(a){if(a.p!=7)throw vbb(new Ydb);return Tbb(a.k)<<16>>16} +function Zwd(a){if(a.p!=7)throw vbb(new Ydb);return Tbb(a.f)<<16>>16} +function sr(a){var b;b=0;while(a.Ob()){a.Pb();b=wbb(b,1)}return Oy(b)} +function nx(a,b){var c;c=new Vfb;a.xd(c);c.a+='..';b.yd(c);return c.a} +function Sgc(a,b,c){var d;d=BD(Ohb(a.g,c),57);Ekb(a.a.c,new vgd(b,d))} +function VCb(a,b,c){return Ddb(ED(Wd(irb(a.f,b))),ED(Wd(irb(a.f,c))))} +function E2d(a,b,c){return F2d(a,b,c,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function L2d(a,b,c){return M2d(a,b,c,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function q3d(a,b,c){return r3d(a,b,c,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function JJc(a,b){return a==(j0b(),h0b)&&b==h0b?4:a==h0b||b==h0b?8:32} +function Nd(a,b){return PD(b)===PD(a)?'(this Map)':b==null?Xhe:fcb(b)} +function kFd(a,b){return BD(b==null?Wd(irb(a.f,null)):Crb(a.g,b),281)} +function Rqd(a,b,c){var d;d=Wpd(c);Rhb(a.b,d,b);Rhb(a.c,b,c);return b} +function Bfd(a,b){var c;c=b;while(c){O6c(a,c.i,c.j);c=Xod(c)}return a} +function kt(a,b){var c;c=vmb(Nu(new wu(a,b)));ir(new wu(a,b));return c} +function R6d(a,b){Q6d();var c;c=BD(a,66).Mj();kVd(c,b);return c.Ok(b)} +function TOc(a,b,c,d,e){var f;f=OOc(e,c,d);Ekb(b,tOc(e,f));XOc(a,e,b)} +function mic(a,b,c){a.i=0;a.e=0;if(b==c){return}lic(a,b,c);kic(a,b,c)} +function dB(a,b){var c;c=a.q.getHours();a.q.setFullYear(b+nje);YA(a,c)} +function dC(d,a,b){if(b){var c=b.ee();d.a[a]=c(b)}else{delete d.a[a]}} +function vB(d,a,b){if(b){var c=b.ee();b=c(b)}else{b=undefined}d.a[a]=b} +function pCb(a){if(a<0){throw vbb(new Feb('Negative array size: '+a))}} +function VKd(a){if(!a.n){$Kd(a);a.n=new JMd(a,j5,a);_Kd(a)}return a.n} +function Fqb(a){sCb(a.a=0&&a.a[c]===b[c];c--);return c<0} +function Ucc(a,b){Occ();var c;c=a.j.g-b.j.g;if(c!=0){return c}return 0} +function Dtb(a,b){uCb(b);if(a.a!=null){return Itb(b.Kb(a.a))}return ztb} +function Gx(a){var b;if(a){return new Bsb(a)}b=new zsb;Jq(b,a);return b} +function GAb(a,b){var c;return b.b.Kb(SAb(a,b.c.Ee(),(c=new TBb(b),c)))} +function Hub(a){zub();Eub(this,Tbb(xbb(Obb(a,24),nke)),Tbb(xbb(a,nke)))} +function REb(){REb=ccb;QEb=as((MEb(),OC(GC(aN,1),Kie,428,0,[LEb,KEb])))} +function ZEb(){ZEb=ccb;YEb=as((UEb(),OC(GC(bN,1),Kie,427,0,[SEb,TEb])))} +function aSb(){aSb=ccb;_Rb=as((XRb(),OC(GC(gP,1),Kie,424,0,[VRb,WRb])))} +function D5b(){D5b=ccb;C5b=as((y5b(),OC(GC(ZR,1),Kie,511,0,[x5b,w5b])))} +function Cqc(){Cqc=ccb;Bqc=as((xqc(),OC(GC(JW,1),Kie,419,0,[vqc,wqc])))} +function erc(){erc=ccb;drc=as((_qc(),OC(GC(MW,1),Kie,479,0,[$qc,Zqc])))} +function eBc(){eBc=ccb;dBc=as((_Ac(),OC(GC(fX,1),Kie,376,0,[$Ac,ZAc])))} +function GAc(){GAc=ccb;FAc=as((BAc(),OC(GC(cX,1),Kie,421,0,[zAc,AAc])))} +function Npc(){Npc=ccb;Mpc=as((Ipc(),OC(GC(FW,1),Kie,422,0,[Gpc,Hpc])))} +function rsc(){rsc=ccb;qsc=as((msc(),OC(GC(SW,1),Kie,420,0,[ksc,lsc])))} +function MOc(){MOc=ccb;LOc=as((HOc(),OC(GC(DZ,1),Kie,520,0,[GOc,FOc])))} +function ZIc(){ZIc=ccb;YIc=as((UIc(),OC(GC(mY,1),Kie,523,0,[TIc,SIc])))} +function bMc(){bMc=ccb;aMc=as((YLc(),OC(GC(fZ,1),Kie,516,0,[XLc,WLc])))} +function jMc(){jMc=ccb;iMc=as((eMc(),OC(GC(gZ,1),Kie,515,0,[cMc,dMc])))} +function KQc(){KQc=ccb;JQc=as((FQc(),OC(GC(YZ,1),Kie,455,0,[DQc,EQc])))} +function dUc(){dUc=ccb;cUc=as(($Tc(),OC(GC(F$,1),Kie,425,0,[ZTc,YTc])))} +function XUc(){XUc=ccb;WUc=as((PUc(),OC(GC(K$,1),Kie,495,0,[NUc,OUc])))} +function XTc(){XTc=ccb;WTc=as((STc(),OC(GC(E$,1),Kie,480,0,[QTc,RTc])))} +function lWc(){lWc=ccb;kWc=as((fWc(),OC(GC(X$,1),Kie,426,0,[dWc,eWc])))} +function i1c(){i1c=ccb;h1c=as((a1c(),OC(GC(X_,1),Kie,429,0,[_0c,$0c])))} +function H_c(){H_c=ccb;G_c=as((C_c(),OC(GC(P_,1),Kie,430,0,[B_c,A_c])))} +function UIc(){UIc=ccb;TIc=new VIc('UPPER',0);SIc=new VIc('LOWER',1)} +function Lqd(a,b){var c;c=new eC;Spd(c,'x',b.a);Spd(c,'y',b.b);Qpd(a,c)} +function Oqd(a,b){var c;c=new eC;Spd(c,'x',b.a);Spd(c,'y',b.b);Qpd(a,c)} +function Jic(a,b){var c,d;d=false;do{c=Mic(a,b);d=d|c}while(c);return d} +function zHc(a,b){var c,d;c=b;d=0;while(c>0){d+=a.a[c];c-=c&-c}return d} +function Cfd(a,b){var c;c=b;while(c){O6c(a,-c.i,-c.j);c=Xod(c)}return a} +function reb(a,b){var c,d;uCb(b);for(d=a.Kc();d.Ob();){c=d.Pb();b.td(c)}} +function me(a,b){var c;c=b.cd();return new Wo(c,a.e.pc(c,BD(b.dd(),14)))} +function Gsb(a,b,c,d){var e;e=new jtb;e.c=b;e.b=c;e.a=d;d.b=c.a=e;++a.b} +function Nkb(a,b,c){var d;d=(tCb(b,a.c.length),a.c[b]);a.c[b]=c;return d} +function lFd(a,b,c){return BD(b==null?jrb(a.f,null,c):Drb(a.g,b,c),281)} +function fRb(a){return !!a.c&&!!a.d?oRb(a.c)+'->'+oRb(a.d):'e_'+FCb(a)} +function FAb(a,b){return (Uzb(a),WAb(new YAb(a,new qBb(b,a.a)))).sd(DAb)} +function tUb(){qUb();return OC(GC(zP,1),Kie,356,0,[lUb,mUb,nUb,oUb,pUb])} +function _cd(){Ucd();return OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])} +function Dz(b){Az();return function(){return Ez(b,this,arguments);var a}} +function sz(){if(Date.now){return Date.now()}return (new Date).getTime()} +function OZb(a){if(!a.c||!a.d){return false}return !!a.c.i&&a.c.i==a.d.i} +function pv(a){if(!a.c.Sb()){throw vbb(new utb)}a.a=true;return a.c.Ub()} +function ko(a){a.i=0;Alb(a.b,null);Alb(a.c,null);a.a=null;a.e=null;++a.g} +function ycb(a){wcb.call(this,a==null?Xhe:fcb(a),JD(a,78)?BD(a,78):null)} +function PYb(a){MYb();yXb(this);this.a=new Psb;NYb(this,a);Dsb(this.a,a)} +function jYb(){Ckb(this);this.b=new f7c(Pje,Pje);this.a=new f7c(Qje,Qje)} +function rAb(a,b){this.c=0;this.b=b;jvb.call(this,a,17493);this.a=this.c} +function wyb(a){oyb();if(lyb){return}this.c=a;this.e=true;this.a=new Rkb} +function oyb(){oyb=ccb;lyb=true;jyb=false;kyb=false;nyb=false;myb=false} +function C3c(a,b){if(JD(b,149)){return dfb(a.c,BD(b,149).c)}return false} +function zUc(a,b){var c;c=0;!!a&&(c+=a.f.a/2);!!b&&(c+=b.f.a/2);return c} +function j4c(a,b){var c;c=BD(Wrb(a.d,b),23);return c?c:BD(Wrb(a.e,b),23)} +function Lzd(a){this.b=a;Fyd.call(this,a);this.a=BD(Ajd(this.b.a,4),126)} +function Uzd(a){this.b=a;$yd.call(this,a);this.a=BD(Ajd(this.b.a,4),126)} +function $Kd(a){if(!a.t){a.t=new YMd(a);vtd(new c0d(a),0,a.t)}return a.t} +function kad(){ead();return OC(GC(t1,1),Kie,103,0,[cad,bad,aad,_9c,dad])} +function Wbd(){Tbd();return OC(GC(C1,1),Kie,249,0,[Qbd,Sbd,Obd,Pbd,Rbd])} +function Q5c(){N5c();return OC(GC(e1,1),Kie,175,0,[L5c,K5c,I5c,M5c,J5c])} +function Q_c(){N_c();return OC(GC(Q_,1),Kie,316,0,[I_c,J_c,M_c,K_c,L_c])} +function _zc(){Vzc();return OC(GC(_W,1),Kie,315,0,[Uzc,Rzc,Szc,Qzc,Tzc])} +function sqc(){mqc();return OC(GC(IW,1),Kie,335,0,[iqc,hqc,kqc,lqc,jqc])} +function n$c(){k$c();return OC(GC(y_,1),Kie,355,0,[g$c,f$c,i$c,h$c,j$c])} +function _jc(){Xjc();return OC(GC(uV,1),Kie,363,0,[Tjc,Vjc,Wjc,Ujc,Sjc])} +function Ftc(){Ctc();return OC(GC(TW,1),Kie,163,0,[Btc,xtc,ytc,ztc,Atc])} +function T0d(){T0d=ccb;var a,b;R0d=(LFd(),b=new MPd,b);S0d=(a=new OJd,a)} +function yUd(a){var b;if(!a.c){b=a.r;JD(b,88)&&(a.c=BD(b,26))}return a.c} +function zc(a){a.e=3;a.d=a.Yb();if(a.e!=2){a.e=0;return true}return false} +function RC(a){var b,c,d;b=a&Eje;c=a>>22&Eje;d=a<0?Fje:0;return TC(b,c,d)} +function uy(a){var b,c,d,e;for(c=a,d=0,e=c.length;d0?ihb(a,b):lhb(a,-b)} +function Rgb(a,b){if(b==0||a.e==0){return a}return b>0?lhb(a,b):ihb(a,-b)} +function Rr(a){if(Qr(a)){a.c=a.a;return a.a.Pb()}else{throw vbb(new utb)}} +function Yac(a){var b,c;b=a.c.i;c=a.d.i;return b.k==(j0b(),e0b)&&c.k==e0b} +function kZb(a){var b;b=new UZb;tNb(b,a);yNb(b,(Nyc(),jxc),null);return b} +function hid(a,b,c){var d;return d=a.Yg(b),d>=0?a._g(d,c,true):sid(a,b,c)} +function uHb(a,b,c,d){var e;for(e=0;eb){throw vbb(new qcb(Jb(a,b,'index')))}return a} +function zhb(a,b,c,d){var e;e=KC(WD,oje,25,b,15,1);Ahb(e,a,b,c,d);return e} +function _A(a,b){var c;c=a.q.getHours()+(b/60|0);a.q.setMinutes(b);YA(a,c)} +function A$c(a,b){return $wnd.Math.min(S6c(b.a,a.d.d.c),S6c(b.b,a.d.d.c))} +function Thb(a,b){return ND(b)?b==null?krb(a.f,null):Erb(a.g,b):krb(a.f,b)} +function b1b(a){this.c=a;this.a=new olb(this.c.a);this.b=new olb(this.c.b)} +function kRb(){this.e=new Rkb;this.c=new Rkb;this.d=new Rkb;this.b=new Rkb} +function MFb(){this.g=new PFb;this.b=new PFb;this.a=new Rkb;this.k=new Rkb} +function Gjc(a,b,c){this.a=a;this.c=b;this.d=c;Ekb(b.e,this);Ekb(c.b,this)} +function wBb(a,b){fvb.call(this,b.rd(),b.qd()&-6);uCb(a);this.a=a;this.b=b} +function CBb(a,b){jvb.call(this,b.rd(),b.qd()&-6);uCb(a);this.a=a;this.b=b} +function IBb(a,b){nvb.call(this,b.rd(),b.qd()&-6);uCb(a);this.a=a;this.b=b} +function BQc(a,b,c){this.a=a;this.b=b;this.c=c;Ekb(a.t,this);Ekb(b.i,this)} +function SRc(){this.b=new Psb;this.a=new Psb;this.b=new Psb;this.a=new Psb} +function g6c(){g6c=ccb;f6c=new Lsd('org.eclipse.elk.labels.labelManager')} +function Vac(){Vac=ccb;Uac=new Msd('separateLayerConnections',(gbc(),fbc))} +function HOc(){HOc=ccb;GOc=new IOc('REGULAR',0);FOc=new IOc('CRITICAL',1)} +function _Ac(){_Ac=ccb;$Ac=new aBc('STACKED',0);ZAc=new aBc('SEQUENCED',1)} +function C_c(){C_c=ccb;B_c=new D_c('FIXED',0);A_c=new D_c('CENTER_NODE',1)} +function PHc(a,b){var c;c=VHc(a,b);a.b=new BHc(c.c.length);return OHc(a,c)} +function KAd(a,b,c){var d;++a.e;--a.f;d=BD(a.d[b].$c(c),133);return d.dd()} +function JJd(a){var b;if(!a.a){b=a.r;JD(b,148)&&(a.a=BD(b,148))}return a.a} +function poc(a){if(a.a){if(a.e){return poc(a.e)}}else{return a}return null} +function ODc(a,b){if(a.pb.p){return -1}return 0} +function pvb(a,b){uCb(b);if(a.c=0,'Initial capacity must not be negative')} +function lHb(){lHb=ccb;kHb=as((gHb(),OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])))} +function SHb(){SHb=ccb;RHb=as((NHb(),OC(GC(sN,1),Kie,461,0,[LHb,KHb,MHb])))} +function JIb(){JIb=ccb;IIb=as((EIb(),OC(GC(zN,1),Kie,462,0,[DIb,CIb,BIb])))} +function Kyb(){Kyb=ccb;Jyb=as((Fyb(),OC(GC(xL,1),Kie,132,0,[Cyb,Dyb,Eyb])))} +function DTb(){DTb=ccb;CTb=as((yTb(),OC(GC(oP,1),Kie,379,0,[wTb,vTb,xTb])))} +function WXb(){WXb=ccb;VXb=as((RXb(),OC(GC(hQ,1),Kie,423,0,[QXb,PXb,OXb])))} +function Zpc(){Zpc=ccb;Ypc=as((Rpc(),OC(GC(GW,1),Kie,314,0,[Ppc,Opc,Qpc])))} +function gqc(){gqc=ccb;fqc=as((bqc(),OC(GC(HW,1),Kie,337,0,[$pc,aqc,_pc])))} +function Lqc(){Lqc=ccb;Kqc=as((Gqc(),OC(GC(KW,1),Kie,450,0,[Eqc,Dqc,Fqc])))} +function Kkc(){Kkc=ccb;Jkc=as((Fkc(),OC(GC(vV,1),Kie,361,0,[Ekc,Dkc,Ckc])))} +function jsc(){jsc=ccb;isc=as((esc(),OC(GC(RW,1),Kie,303,0,[csc,dsc,bsc])))} +function asc(){asc=ccb;_rc=as((Xrc(),OC(GC(QW,1),Kie,292,0,[Vrc,Wrc,Urc])))} +function Dzc(){Dzc=ccb;Czc=as((xzc(),OC(GC(ZW,1),Kie,378,0,[uzc,vzc,wzc])))} +function YAc(){YAc=ccb;XAc=as((TAc(),OC(GC(eX,1),Kie,375,0,[QAc,RAc,SAc])))} +function yAc(){yAc=ccb;xAc=as((tAc(),OC(GC(bX,1),Kie,339,0,[rAc,qAc,sAc])))} +function PAc(){PAc=ccb;OAc=as((KAc(),OC(GC(dX,1),Kie,452,0,[JAc,HAc,IAc])))} +function QBc(){QBc=ccb;PBc=as((LBc(),OC(GC(jX,1),Kie,377,0,[JBc,KBc,IBc])))} +function yBc(){yBc=ccb;xBc=as((tBc(),OC(GC(hX,1),Kie,336,0,[qBc,rBc,sBc])))} +function HBc(){HBc=ccb;GBc=as((CBc(),OC(GC(iX,1),Kie,338,0,[BBc,zBc,ABc])))} +function wGc(){wGc=ccb;vGc=as((rGc(),OC(GC(PX,1),Kie,454,0,[oGc,pGc,qGc])))} +function zVc(){zVc=ccb;yVc=as((tVc(),OC(GC(O$,1),Kie,442,0,[sVc,qVc,rVc])))} +function vWc(){vWc=ccb;uWc=as((pWc(),OC(GC(Y$,1),Kie,380,0,[mWc,nWc,oWc])))} +function EYc(){EYc=ccb;DYc=as((zYc(),OC(GC(q_,1),Kie,381,0,[xYc,yYc,wYc])))} +function yXc(){yXc=ccb;xXc=as((sXc(),OC(GC(b_,1),Kie,293,0,[qXc,rXc,pXc])))} +function b_c(){b_c=ccb;a_c=as((Y$c(),OC(GC(J_,1),Kie,437,0,[V$c,W$c,X$c])))} +function mbd(){mbd=ccb;lbd=as((hbd(),OC(GC(z1,1),Kie,334,0,[fbd,ebd,gbd])))} +function vad(){vad=ccb;uad=as((qad(),OC(GC(u1,1),Kie,272,0,[nad,oad,pad])))} +function icd(){dcd();return OC(GC(D1,1),Kie,98,0,[ccd,bcd,acd,Zbd,_bd,$bd])} +function ikd(a,b){return !a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),qAd(a.o,b)} +function NAd(a){!a.g&&(a.g=new JCd);!a.g.d&&(a.g.d=new MBd(a));return a.g.d} +function yAd(a){!a.g&&(a.g=new JCd);!a.g.a&&(a.g.a=new SBd(a));return a.g.a} +function EAd(a){!a.g&&(a.g=new JCd);!a.g.b&&(a.g.b=new GBd(a));return a.g.b} +function FAd(a){!a.g&&(a.g=new JCd);!a.g.c&&(a.g.c=new iCd(a));return a.g.c} +function A2d(a,b,c){var d,e;e=new p4d(b,a);for(d=0;dc||b=0?a._g(c,true,true):sid(a,b,true)} +function s6b(a,b){return Kdb(Edb(ED(vNb(a,(wtc(),htc)))),Edb(ED(vNb(b,htc))))} +function pUc(){pUc=ccb;oUc=b3c(b3c(g3c(new j3c,(yRc(),vRc)),(qSc(),pSc)),lSc)} +function IHc(a,b,c){var d;d=SHc(a,b,c);a.b=new BHc(d.c.length);return KHc(a,d)} +function qhe(a){if(a.b<=0)throw vbb(new utb);--a.b;a.a-=a.c.c;return meb(a.a)} +function ptd(a){var b;if(!a.a){throw vbb(new vtb)}b=a.a;a.a=Xod(a.a);return b} +function dBb(a){while(!a.a){if(!HBb(a.c,new hBb(a))){return false}}return true} +function vr(a){var b;Qb(a);if(JD(a,198)){b=BD(a,198);return b}return new wr(a)} +function r3c(a){p3c();BD(a.We((Y9c(),x9c)),174).Fc((rcd(),ocd));a.Ye(w9c,null)} +function p3c(){p3c=ccb;m3c=new v3c;o3c=new x3c;n3c=mn((Y9c(),w9c),m3c,b9c,o3c)} +function fWc(){fWc=ccb;dWc=new hWc('LEAF_NUMBER',0);eWc=new hWc('NODE_SIZE',1)} +function UMc(a,b,c){a.a=b;a.c=c;a.b.a.$b();Osb(a.d);a.e.a.c=KC(SI,Uhe,1,0,5,1)} +function yHc(a){a.a=KC(WD,oje,25,a.b+1,15,1);a.c=KC(WD,oje,25,a.b,15,1);a.d=0} +function MWb(a,b){if(a.a.ue(b.d,a.b)>0){Ekb(a.c,new dWb(b.c,b.d,a.d));a.b=b.d}} +function nud(a,b){if(a.g==null||b>=a.i)throw vbb(new $zd(b,a.i));return a.g[b]} +function pOd(a,b,c){Itd(a,c);if(c!=null&&!a.wj(c)){throw vbb(new tcb)}return c} +function KLd(a){var b;if(a.Ek()){for(b=a.i-1;b>=0;--b){qud(a,b)}}return wud(a)} +function Bwb(a){var b,c;if(!a.b){return null}c=a.b;while(b=c.a[0]){c=b}return c} +function ulb(a,b){var c,d;pCb(b);return c=(d=a.slice(0,b),PC(d,a)),c.length=b,c} +function Klb(a,b,c,d){var e;d=(ipb(),!d?fpb:d);e=a.slice(b,c);Llb(e,a,b,c,-b,d)} +function bid(a,b,c,d,e){return b<0?sid(a,c,d):BD(c,66).Nj().Pj(a,a.yh(),b,d,e)} +function hZd(a){if(JD(a,172)){return ''+BD(a,172).a}return a==null?null:fcb(a)} +function iZd(a){if(JD(a,172)){return ''+BD(a,172).a}return a==null?null:fcb(a)} +function nDb(a,b){if(b.a){throw vbb(new hz(Hke))}Qqb(a.a,b);b.a=a;!a.j&&(a.j=b)} +function qBb(a,b){nvb.call(this,b.rd(),b.qd()&-16449);uCb(a);this.a=a;this.c=b} +function Ti(a,b){var c,d;d=b/a.c.Hd().gc()|0;c=b%a.c.Hd().gc();return Mi(a,d,c)} +function NHb(){NHb=ccb;LHb=new OHb(jle,0);KHb=new OHb(gle,1);MHb=new OHb(kle,2)} +function lxb(){lxb=ccb;hxb=new mxb('All',0);ixb=new rxb;jxb=new txb;kxb=new wxb} +function zxb(){zxb=ccb;yxb=as((lxb(),OC(GC(iL,1),Kie,297,0,[hxb,ixb,jxb,kxb])))} +function uWb(){uWb=ccb;tWb=as((lWb(),OC(GC(SP,1),Kie,405,0,[hWb,kWb,iWb,jWb])))} +function ALb(){ALb=ccb;zLb=as((vLb(),OC(GC(PN,1),Kie,406,0,[uLb,rLb,sLb,tLb])))} +function WMb(){WMb=ccb;VMb=as((RMb(),OC(GC(jO,1),Kie,323,0,[OMb,NMb,PMb,QMb])))} +function WOb(){WOb=ccb;VOb=as((ROb(),OC(GC(CO,1),Kie,394,0,[OOb,NOb,POb,QOb])))} +function GRc(){GRc=ccb;FRc=as((yRc(),OC(GC(h$,1),Kie,393,0,[uRc,vRc,wRc,xRc])))} +function mbc(){mbc=ccb;lbc=as((gbc(),OC(GC(VS,1),Kie,360,0,[fbc,dbc,ebc,cbc])))} +function oXc(){oXc=ccb;nXc=as((iXc(),OC(GC(a_,1),Kie,340,0,[hXc,fXc,gXc,eXc])))} +function Fjc(){Fjc=ccb;Ejc=as((Ajc(),OC(GC(mV,1),Kie,411,0,[wjc,xjc,yjc,zjc])))} +function Pzc(){Pzc=ccb;Ozc=as((Izc(),OC(GC($W,1),Kie,197,0,[Gzc,Hzc,Fzc,Ezc])))} +function ugd(){ugd=ccb;tgd=as((pgd(),OC(GC(k2,1),Kie,396,0,[mgd,ngd,lgd,ogd])))} +function xbd(){xbd=ccb;wbd=as((rbd(),OC(GC(A1,1),Kie,285,0,[qbd,nbd,obd,pbd])))} +function Fad(){Fad=ccb;Ead=as((Aad(),OC(GC(v1,1),Kie,218,0,[zad,xad,wad,yad])))} +function Ied(){Ied=ccb;Hed=as((Ded(),OC(GC(O1,1),Kie,311,0,[Ced,zed,Bed,Aed])))} +function ydd(){ydd=ccb;xdd=as((tdd(),OC(GC(I1,1),Kie,374,0,[rdd,sdd,qdd,pdd])))} +function A9d(){A9d=ccb;Smd();x9d=Pje;w9d=Qje;z9d=new Ndb(Pje);y9d=new Ndb(Qje)} +function _qc(){_qc=ccb;$qc=new arc(ane,0);Zqc=new arc('IMPROVE_STRAIGHTNESS',1)} +function eIc(a,b){FHc();return Ekb(a,new vgd(b,meb(b.e.c.length+b.g.c.length)))} +function gIc(a,b){FHc();return Ekb(a,new vgd(b,meb(b.e.c.length+b.g.c.length)))} +function PC(a,b){HC(b)!=10&&OC(rb(b),b.hm,b.__elementTypeId$,HC(b),a);return a} +function Lkb(a,b){var c;c=Jkb(a,b,0);if(c==-1){return false}Kkb(a,c);return true} +function Zrb(a,b){var c;c=BD(Thb(a.e,b),387);if(c){jsb(c);return c.e}return null} +function Jbb(a){var b;if(Fbb(a)){b=0-a;if(!isNaN(b)){return b}}return zbb(hD(a))} +function Jkb(a,b,c){for(;c=0?fid(a,c,true,true):sid(a,b,true)} +function vgc(a,b){qgc();var c,d;c=ugc(a);d=ugc(b);return !!c&&!!d&&!omb(c.k,d.k)} +function Gqd(a,b){dld(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function Hqd(a,b){eld(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function Iqd(a,b){cld(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function Jqd(a,b){ald(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function agd(a){(!this.q?(mmb(),mmb(),kmb):this.q).Ac(!a.q?(mmb(),mmb(),kmb):a.q)} +function S2d(a,b){return JD(b,99)&&(BD(b,18).Bb&Tje)!=0?new s4d(b,a):new p4d(b,a)} +function U2d(a,b){return JD(b,99)&&(BD(b,18).Bb&Tje)!=0?new s4d(b,a):new p4d(b,a)} +function INb(a,b){HNb=new tOb;FNb=b;GNb=a;BD(GNb.b,65);KNb(GNb,HNb,null);JNb(GNb)} +function uud(a,b,c){var d;d=a.g[b];mud(a,b,a.oi(b,c));a.gi(b,c,d);a.ci();return d} +function Ftd(a,b){var c;c=a.Xc(b);if(c>=0){a.$c(c);return true}else{return false}} +function YId(a){var b;if(a.d!=a.r){b=wId(a);a.e=!!b&&b.Cj()==Bve;a.d=b}return a.e} +function fr(a,b){var c;Qb(a);Qb(b);c=false;while(b.Ob()){c=c|a.Fc(b.Pb())}return c} +function Wrb(a,b){var c;c=BD(Ohb(a.e,b),387);if(c){Yrb(a,c);return c.e}return null} +function UA(a){var b,c;b=a/60|0;c=a%60;if(c==0){return ''+b}return ''+b+':'+(''+c)} +function LAb(a,b){var c,d;Uzb(a);d=new IBb(b,a.a);c=new fBb(d);return new YAb(a,c)} +function tB(d,a){var b=d.a[a];var c=(rC(),qC)[typeof b];return c?c(b):xC(typeof b)} +function yzc(a){switch(a.g){case 0:return Ohe;case 1:return -1;default:return 0;}} +function oD(a){if(eD(a,(wD(),vD))<0){return -aD(hD(a))}return a.l+a.m*Hje+a.h*Ije} +function HC(a){return a.__elementTypeCategory$==null?10:a.__elementTypeCategory$} +function dub(a){var b;b=a.b.c.length==0?null:Ikb(a.b,0);b!=null&&fub(a,0);return b} +function uA(a,b){while(b[0]=0){++b[0]}} +function sgb(a,b){this.e=b;this.a=vgb(a);this.a<54?(this.f=Sbb(a)):(this.c=ghb(a))} +function vge(a,b,c,d){wfe();xfe.call(this,26);this.c=a;this.a=b;this.d=c;this.b=d} +function EA(a,b,c){var d,e;d=10;for(e=0;ea.a[d]&&(d=c)}return d} +function fic(a,b){var c;c=Jy(a.e.c,b.e.c);if(c==0){return Kdb(a.e.d,b.e.d)}return c} +function Ogb(a,b){if(b.e==0){return Ggb}if(a.e==0){return Ggb}return Dhb(),Ehb(a,b)} +function nCb(a,b){if(!a){throw vbb(new Wdb(DCb('Enum constant undefined: %s',b)))}} +function AWb(){AWb=ccb;xWb=new XWb;yWb=new _Wb;vWb=new dXb;wWb=new hXb;zWb=new lXb} +function UEb(){UEb=ccb;SEb=new VEb('BY_SIZE',0);TEb=new VEb('BY_SIZE_AND_SHAPE',1)} +function XRb(){XRb=ccb;VRb=new YRb('EADES',0);WRb=new YRb('FRUCHTERMAN_REINGOLD',1)} +function xqc(){xqc=ccb;vqc=new yqc('READING_DIRECTION',0);wqc=new yqc('ROTATION',1)} +function uqc(){uqc=ccb;tqc=as((mqc(),OC(GC(IW,1),Kie,335,0,[iqc,hqc,kqc,lqc,jqc])))} +function bAc(){bAc=ccb;aAc=as((Vzc(),OC(GC(_W,1),Kie,315,0,[Uzc,Rzc,Szc,Qzc,Tzc])))} +function bkc(){bkc=ccb;akc=as((Xjc(),OC(GC(uV,1),Kie,363,0,[Tjc,Vjc,Wjc,Ujc,Sjc])))} +function Htc(){Htc=ccb;Gtc=as((Ctc(),OC(GC(TW,1),Kie,163,0,[Btc,xtc,ytc,ztc,Atc])))} +function S_c(){S_c=ccb;R_c=as((N_c(),OC(GC(Q_,1),Kie,316,0,[I_c,J_c,M_c,K_c,L_c])))} +function S5c(){S5c=ccb;R5c=as((N5c(),OC(GC(e1,1),Kie,175,0,[L5c,K5c,I5c,M5c,J5c])))} +function p$c(){p$c=ccb;o$c=as((k$c(),OC(GC(y_,1),Kie,355,0,[g$c,f$c,i$c,h$c,j$c])))} +function vUb(){vUb=ccb;uUb=as((qUb(),OC(GC(zP,1),Kie,356,0,[lUb,mUb,nUb,oUb,pUb])))} +function mad(){mad=ccb;lad=as((ead(),OC(GC(t1,1),Kie,103,0,[cad,bad,aad,_9c,dad])))} +function Ybd(){Ybd=ccb;Xbd=as((Tbd(),OC(GC(C1,1),Kie,249,0,[Qbd,Sbd,Obd,Pbd,Rbd])))} +function cdd(){cdd=ccb;bdd=as((Ucd(),OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])))} +function _1c(a,b){var c;c=BD(Ohb(a.a,b),134);if(!c){c=new zNb;Rhb(a.a,b,c)}return c} +function hoc(a){var b;b=BD(vNb(a,(wtc(),usc)),305);if(b){return b.a==a}return false} +function ioc(a){var b;b=BD(vNb(a,(wtc(),usc)),305);if(b){return b.i==a}return false} +function Jub(a,b){uCb(b);Iub(a);if(a.d.Ob()){b.td(a.d.Pb());return true}return false} +function Oy(a){if(ybb(a,Ohe)>0){return Ohe}if(ybb(a,Rie)<0){return Rie}return Tbb(a)} +function Cv(a){if(a<3){Xj(a,Hie);return a+1}if(a=0&&b=-0.01&&a.a<=ple&&(a.a=0);a.b>=-0.01&&a.b<=ple&&(a.b=0);return a} +function sfb(a,b){return b==(ntb(),ntb(),mtb)?a.toLocaleLowerCase():a.toLowerCase()} +function idb(a){return ((a.i&2)!=0?'interface ':(a.i&1)!=0?'':'class ')+(fdb(a),a.o)} +function Pnd(a){var b,c;c=(b=new SSd,b);wtd((!a.q&&(a.q=new cUd(n5,a,11,10)),a.q),c)} +function Pdd(a,b){var c;c=b>0?b-1:b;return Vdd(Wdd(Xdd(Ydd(new Zdd,c),a.n),a.j),a.k)} +function u2d(a,b,c,d){var e;a.j=-1;Qxd(a,I2d(a,b,c),(Q6d(),e=BD(b,66).Mj(),e.Ok(d)))} +function VWb(a){this.g=a;this.f=new Rkb;this.a=$wnd.Math.min(this.g.c.c,this.g.d.c)} +function mDb(a){this.b=new Rkb;this.a=new Rkb;this.c=new Rkb;this.d=new Rkb;this.e=a} +function Cnc(a,b){this.a=new Lqb;this.e=new Lqb;this.b=(xzc(),wzc);this.c=a;this.b=b} +function bIb(a,b,c){$Gb.call(this);THb(this);this.a=a;this.c=c;this.b=b.d;this.f=b.e} +function yd(a){this.d=a;this.c=a.c.vc().Kc();this.b=null;this.a=null;this.e=(hs(),gs)} +function zud(a){if(a<0){throw vbb(new Wdb('Illegal Capacity: '+a))}this.g=this.ri(a)} +function avb(a,b){if(0>a||a>b){throw vbb(new scb('fromIndex: 0, toIndex: '+a+oke+b))}} +function Gs(a){var b;if(a.a==a.b.a){throw vbb(new utb)}b=a.a;a.c=b;a.a=a.a.e;return b} +function Zsb(a){var b;yCb(!!a.c);b=a.c.a;Nsb(a.d,a.c);a.b==a.c?(a.b=b):--a.a;a.c=null} +function VAb(a,b){var c;Uzb(a);c=new lBb(a,a.a.rd(),a.a.qd()|4,b);return new YAb(a,c)} +function ke(a,b){var c,d;c=BD(Hv(a.d,b),14);if(!c){return null}d=b;return a.e.pc(d,c)} +function xac(a,b){var c,d;for(d=a.Kc();d.Ob();){c=BD(d.Pb(),70);yNb(c,(wtc(),Ssc),b)}} +function t9b(a){var b;b=Edb(ED(vNb(a,(Nyc(),Zwc))));if(b<0){b=0;yNb(a,Zwc,b)}return b} +function ifc(a,b,c){var d;d=$wnd.Math.max(0,a.b/2-0.5);cfc(c,d,1);Ekb(b,new rfc(c,d))} +function NMc(a,b,c){var d;d=a.a.e[BD(b.a,10).p]-a.a.e[BD(c.a,10).p];return QD(Eeb(d))} +function iZb(a,b,c,d,e,f){var g;g=kZb(d);QZb(g,e);RZb(g,f);Rc(a.a,d,new BZb(g,b,c.f))} +function Bid(a,b){var c;c=YKd(a.Tg(),b);if(!c){throw vbb(new Wdb(ite+b+lte))}return c} +function ntd(a,b){var c;c=a;while(Xod(c)){c=Xod(c);if(c==b){return true}}return false} +function Uw(a,b){var c,d,e;d=b.a.cd();c=BD(b.a.dd(),14).gc();for(e=0;e0){a.a/=b;a.b/=b}return a} +function bKd(a){var b;if(a.w){return a.w}else{b=cKd(a);!!b&&!b.kh()&&(a.w=b);return b}} +function gZd(a){var b;if(a==null){return null}else{b=BD(a,190);return Umd(b,b.length)}} +function qud(a,b){if(a.g==null||b>=a.i)throw vbb(new $zd(b,a.i));return a.li(b,a.g[b])} +function Mmc(a){var b,c;b=a.a.d.j;c=a.c.d.j;while(b!=c){rqb(a.b,b);b=Xcd(b)}rqb(a.b,b)} +function Jmc(a){var b;for(b=0;b=14&&b<=16)));return a} +function dcb(a,b,c){var d=function(){return a.apply(d,arguments)};b.apply(d,c);return d} +function TLc(a,b,c){var d,e;d=b;do{e=Edb(a.p[d.p])+c;a.p[d.p]=e;d=a.a[d.p]}while(d!=b)} +function NQd(a,b){var c,d;d=a.a;c=OQd(a,b,null);d!=b&&!a.e&&(c=QQd(a,b,c));!!c&&c.Fi()} +function ADb(a,b){return Iy(),My(Qie),$wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)} +function Ky(a,b){Iy();My(Qie);return $wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)} +function Akc(a,b){gkc();return beb(a.b.c.length-a.e.c.length,b.b.c.length-b.e.c.length)} +function oo(a,b){return Kv(uo(a,b,Tbb(Ibb(Eie,keb(Tbb(Ibb(b==null?0:tb(b),Fie)),15)))))} +function o0b(){o0b=ccb;n0b=as((j0b(),OC(GC(NQ,1),Kie,267,0,[h0b,g0b,e0b,i0b,f0b,d0b])))} +function n8c(){n8c=ccb;m8c=as((i8c(),OC(GC(r1,1),Kie,291,0,[h8c,g8c,f8c,d8c,c8c,e8c])))} +function K7c(){K7c=ccb;J7c=as((F7c(),OC(GC(o1,1),Kie,248,0,[z7c,C7c,D7c,E7c,A7c,B7c])))} +function Fpc(){Fpc=ccb;Epc=as((Apc(),OC(GC(EW,1),Kie,227,0,[wpc,ypc,vpc,xpc,zpc,upc])))} +function Drc(){Drc=ccb;Crc=as((yrc(),OC(GC(OW,1),Kie,275,0,[wrc,trc,xrc,vrc,urc,rrc])))} +function qrc(){qrc=ccb;prc=as((lrc(),OC(GC(NW,1),Kie,274,0,[irc,hrc,krc,grc,jrc,frc])))} +function tzc(){tzc=ccb;szc=as((lzc(),OC(GC(YW,1),Kie,313,0,[jzc,hzc,fzc,gzc,kzc,izc])))} +function Yqc(){Yqc=ccb;Xqc=as((Sqc(),OC(GC(LW,1),Kie,276,0,[Nqc,Mqc,Pqc,Oqc,Rqc,Qqc])))} +function wSc(){wSc=ccb;vSc=as((qSc(),OC(GC(t$,1),Kie,327,0,[pSc,lSc,nSc,mSc,oSc,kSc])))} +function ycd(){ycd=ccb;xcd=as((rcd(),OC(GC(E1,1),Kie,273,0,[pcd,ncd,ocd,mcd,lcd,qcd])))} +function Rad(){Rad=ccb;Qad=as((Mad(),OC(GC(w1,1),Kie,312,0,[Kad,Iad,Lad,Gad,Jad,Had])))} +function Lbd(){Hbd();return OC(GC(B1,1),Kie,93,0,[zbd,ybd,Bbd,Gbd,Fbd,Ebd,Cbd,Dbd,Abd])} +function vkd(a,b){var c;c=a.a;a.a=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,0,c,a.a))} +function wkd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,1,c,a.b))} +function hmd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,3,c,a.b))} +function ald(a,b){var c;c=a.f;a.f=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,3,c,a.f))} +function cld(a,b){var c;c=a.g;a.g=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,4,c,a.g))} +function dld(a,b){var c;c=a.i;a.i=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,5,c,a.i))} +function eld(a,b){var c;c=a.j;a.j=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,6,c,a.j))} +function omd(a,b){var c;c=a.j;a.j=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,1,c,a.j))} +function imd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,4,c,a.c))} +function pmd(a,b){var c;c=a.k;a.k=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,2,c,a.k))} +function qQd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new mSd(a,2,c,a.d))} +function AId(a,b){var c;c=a.s;a.s=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new mSd(a,4,c,a.s))} +function DId(a,b){var c;c=a.t;a.t=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new mSd(a,5,c,a.t))} +function _Jd(a,b){var c;c=a.F;a.F=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,5,c,b))} +function izd(a,b){var c;c=BD(Ohb((pEd(),oEd),a),55);return c?c.xj(b):KC(SI,Uhe,1,b,5,1)} +function Xpd(a,b){var c,d;c=b in a.a;if(c){d=aC(a,b).he();if(d){return d.a}}return null} +function ftd(a,b){var c,d,e;c=(d=(Fhd(),e=new Jod,e),!!b&&God(d,b),d);Hod(c,a);return c} +function LLd(a,b,c){Itd(a,c);if(!a.Bk()&&c!=null&&!a.wj(c)){throw vbb(new tcb)}return c} +function Xdd(a,b){a.n=b;if(a.n){a.f=new Rkb;a.e=new Rkb}else{a.f=null;a.e=null}return a} +function ndb(a,b,c,d,e,f){var g;g=ldb(a,b);zdb(c,g);g.i=e?8:0;g.f=d;g.e=e;g.g=f;return g} +function rSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=1;this.c=a;this.a=c} +function tSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=2;this.c=a;this.a=c} +function BSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=6;this.c=a;this.a=c} +function GSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=7;this.c=a;this.a=c} +function xSd(a,b,c,d,e){this.d=b;this.j=d;this.e=e;this.o=-1;this.p=4;this.c=a;this.a=c} +function rDb(a,b){var c,d,e,f;for(d=b,e=0,f=d.length;e=0);if(ekb(a.d,a.c)<0){a.a=a.a-1&a.d.a.length-1;a.b=a.d.c}a.c=-1} +function pgb(a){if(a.a<54){return a.f<0?-1:a.f>0?1:0}return (!a.c&&(a.c=fhb(a.f)),a.c).e} +function My(a){if(!(a>=0)){throw vbb(new Wdb('tolerance ('+a+') must be >= 0'))}return a} +function n4c(){if(!f4c){f4c=new m4c;l4c(f4c,OC(GC(C0,1),Uhe,130,0,[new Z9c]))}return f4c} +function KAc(){KAc=ccb;JAc=new LAc(ole,0);HAc=new LAc('INPUT',1);IAc=new LAc('OUTPUT',2)} +function bqc(){bqc=ccb;$pc=new cqc('ARD',0);aqc=new cqc('MSD',1);_pc=new cqc('MANUAL',2)} +function rGc(){rGc=ccb;oGc=new sGc('BARYCENTER',0);pGc=new sGc(Bne,1);qGc=new sGc(Cne,2)} +function ztd(a,b){var c;c=a.gc();if(b<0||b>c)throw vbb(new Cyd(b,c));return new czd(a,b)} +function JAd(a,b){var c;if(JD(b,42)){return a.c.Mc(b)}else{c=qAd(a,b);LAd(a,b);return c}} +function $nd(a,b,c){yId(a,b);pnd(a,c);AId(a,0);DId(a,1);CId(a,true);BId(a,true);return a} +function Xj(a,b){if(a<0){throw vbb(new Wdb(b+' cannot be negative but was: '+a))}return a} +function Bt(a,b){var c,d;for(c=0,d=a.gc();c0){return BD(Ikb(c.a,d-1),10)}return null} +function Lkd(a,b){var c;c=a.k;a.k=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,2,c,a.k))} +function kmd(a,b){var c;c=a.f;a.f=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,8,c,a.f))} +function lmd(a,b){var c;c=a.i;a.i=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,7,c,a.i))} +function Hod(a,b){var c;c=a.a;a.a=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,8,c,a.a))} +function zpd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,0,c,a.b))} +function UUd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,0,c,a.b))} +function VUd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,1,c,a.c))} +function Apd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,1,c,a.c))} +function pQd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,4,c,a.c))} +function PHd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,1,c,a.d))} +function jKd(a,b){var c;c=a.D;a.D=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,2,c,a.D))} +function Rdd(a,b){if(a.r>0&&a.c0&&a.g!=0&&Rdd(a.i,b/a.r*a.i.d)}} +function dge(a,b,c){var d;a.b=b;a.a=c;d=(a.a&512)==512?new hee:new ude;a.c=ode(d,a.b,a.a)} +function g3d(a,b){return T6d(a.e,b)?(Q6d(),YId(b)?new R7d(b,a):new f7d(b,a)):new c8d(b,a)} +function _o(a,b){return Fv(vo(a.a,b,Tbb(Ibb(Eie,keb(Tbb(Ibb(b==null?0:tb(b),Fie)),15)))))} +function Nyb(a,b,c){return Ayb(a,new Kzb(b),new Mzb,new Ozb(c),OC(GC(xL,1),Kie,132,0,[]))} +function pAb(a){var b,c;if(0>a){return new yAb}b=a+1;c=new rAb(b,a);return new vAb(null,c)} +function umb(a,b){mmb();var c;c=new Mqb(1);ND(a)?Shb(c,a,b):jrb(c.f,a,b);return new iob(c)} +function aMb(a,b){var c,d;c=a.o+a.p;d=b.o+b.p;if(cb){b<<=1;return b>0?b:Iie}return b} +function xc(a){Ub(a.e!=3);switch(a.e){case 2:return false;case 0:return true;}return zc(a)} +function T6c(a,b){var c;if(JD(b,8)){c=BD(b,8);return a.a==c.a&&a.b==c.b}else{return false}} +function _Mb(a,b,c){var d,e,f;f=b>>5;e=b&31;d=xbb(Pbb(a.n[c][f],Tbb(Nbb(e,1))),3);return d} +function IAd(a,b){var c,d;for(d=b.vc().Kc();d.Ob();){c=BD(d.Pb(),42);HAd(a,c.cd(),c.dd())}} +function N1c(a,b){var c;c=new tOb;BD(b.b,65);BD(b.b,65);BD(b.b,65);Hkb(b.a,new T1c(a,c,b))} +function DUd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,21,c,a.b))} +function jmd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,11,c,a.d))} +function _Id(a,b){var c;c=a.j;a.j=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,13,c,a.j))} +function $jb(a,b,c){var d,e,f;f=a.a.length-1;for(e=a.b,d=0;d>>31}d!=0&&(a[c]=d)} +function rmb(a,b){mmb();var c,d;d=new Rkb;for(c=0;c0){this.g=this.ri(this.i+(this.i/8|0)+1);a.Qc(this.g)}} +function u3d(a,b){k2d.call(this,D9,a,b);this.b=this;this.a=S6d(a.Tg(),XKd(this.e.Tg(),this.c))} +function Ld(a,b){var c,d;uCb(b);for(d=b.vc().Kc();d.Ob();){c=BD(d.Pb(),42);a.zc(c.cd(),c.dd())}} +function G2d(a,b,c){var d;for(d=c.Kc();d.Ob();){if(!E2d(a,b,d.Pb())){return false}}return true} +function sVd(a,b,c,d,e){var f;if(c){f=bLd(b.Tg(),a.c);e=c.gh(b,-1-(f==-1?d:f),null,e)}return e} +function tVd(a,b,c,d,e){var f;if(c){f=bLd(b.Tg(),a.c);e=c.ih(b,-1-(f==-1?d:f),null,e)}return e} +function Mgb(a){var b;if(a.b==-2){if(a.e==0){b=-1}else{for(b=0;a.a[b]==0;b++);}a.b=b}return a.b} +function Z4b(a){switch(a.g){case 2:return Ucd(),Tcd;case 4:return Ucd(),zcd;default:return a;}} +function $4b(a){switch(a.g){case 1:return Ucd(),Rcd;case 3:return Ucd(),Acd;default:return a;}} +function nkc(a){var b,c,d;return a.j==(Ucd(),Acd)&&(b=pkc(a),c=uqb(b,zcd),d=uqb(b,Tcd),d||d&&c)} +function oqb(a){var b,c;b=BD(a.e&&a.e(),9);c=BD(ZBb(b,b.length),9);return new xqb(b,c,b.length)} +function l7b(a,b){Odd(b,zne,1);UGb(TGb(new YGb((a$b(),new l$b(a,false,false,new T$b)))));Qdd(b)} +function Fcb(a,b){Bcb();return ND(a)?cfb(a,GD(b)):LD(a)?Ddb(a,ED(b)):KD(a)?Dcb(a,DD(b)):a.wd(b)} +function WZc(a,b){b.q=a;a.d=$wnd.Math.max(a.d,b.r);a.b+=b.d+(a.a.c.length==0?0:a.c);Ekb(a.a,b)} +function m6c(a,b){var c,d,e,f;e=a.c;c=a.c+a.b;f=a.d;d=a.d+a.a;return b.a>e&&b.af&&b.b1||a.Ob()){++a.a;a.g=0;b=a.i;a.Ob();return b}else{throw vbb(new utb)}} +function kNc(a){fNc();var b;if(!Lpb(eNc,a)){b=new hNc;b.a=a;Opb(eNc,a,b)}return BD(Mpb(eNc,a),635)} +function Rbb(a){var b,c,d,e;e=a;d=0;if(e<0){e+=Ije;d=Fje}c=QD(e/Hje);b=QD(e-c*Hje);return TC(b,c,d)} +function Ox(a){var b,c,d;d=0;for(c=new Gqb(a.a);c.a>22);e=a.h+b.h+(d>>22);return TC(c&Eje,d&Eje,e&Fje)} +function nD(a,b){var c,d,e;c=a.l-b.l;d=a.m-b.m+(c>>22);e=a.h-b.h+(d>>22);return TC(c&Eje,d&Eje,e&Fje)} +function bdb(a){var b;if(a<128){b=(ddb(),cdb)[a];!b&&(b=cdb[a]=new Xcb(a));return b}return new Xcb(a)} +function ubb(a){var b;if(JD(a,78)){return a}b=a&&a.__java$exception;if(!b){b=new lz(a);Sz(b)}return b} +function btd(a){if(JD(a,186)){return BD(a,118)}else if(!a){throw vbb(new Heb(gue))}else{return null}} +function Zjb(a,b){if(b==null){return false}while(a.a!=a.b){if(pb(b,vkb(a))){return true}}return false} +function kib(a){if(a.a.Ob()){return true}if(a.a!=a.d){return false}a.a=new orb(a.e.f);return a.a.Ob()} +function Gkb(a,b){var c,d;c=b.Pc();d=c.length;if(d==0){return false}bCb(a.c,a.c.length,c);return true} +function Vyb(a,b,c){var d,e;for(e=b.vc().Kc();e.Ob();){d=BD(e.Pb(),42);a.yc(d.cd(),d.dd(),c)}return a} +function yac(a,b){var c,d;for(d=new olb(a.b);d.a=0,'Negative initial capacity');mCb(b>=0,'Non-positive load factor');Uhb(this)} +function _Ed(a,b,c){if(a>=128)return false;return a<64?Kbb(xbb(Nbb(1,a),c),0):Kbb(xbb(Nbb(1,a-64),b),0)} +function bOb(a,b){if(!a||!b||a==b){return false}return Jy(a.b.c,b.b.c+b.b.b)<0&&Jy(b.b.c,a.b.c+a.b.b)<0} +function I4b(a){var b,c,d;c=a.n;d=a.o;b=a.d;return new J6c(c.a-b.b,c.b-b.d,d.a+(b.b+b.c),d.b+(b.d+b.a))} +function $ic(a){var b,c,d,e;for(c=a.a,d=0,e=c.length;dd)throw vbb(new Cyd(b,d));a.hi()&&(c=Dtd(a,c));return a.Vh(b,c)} +function xNb(a,b,c){return c==null?(!a.q&&(a.q=new Lqb),Thb(a.q,b)):(!a.q&&(a.q=new Lqb),Rhb(a.q,b,c)),a} +function yNb(a,b,c){c==null?(!a.q&&(a.q=new Lqb),Thb(a.q,b)):(!a.q&&(a.q=new Lqb),Rhb(a.q,b,c));return a} +function TQb(a){var b,c;c=new kRb;tNb(c,a);yNb(c,(HSb(),FSb),a);b=new Lqb;VQb(a,c,b);UQb(a,c,b);return c} +function j6c(a){i6c();var b,c,d;c=KC(m1,nie,8,2,0,1);d=0;for(b=0;b<2;b++){d+=0.5;c[b]=r6c(d,a)}return c} +function Mic(a,b){var c,d,e,f;c=false;d=a.a[b].length;for(f=0;f>=1);return b}} +function $C(a){var b,c;c=heb(a.h);if(c==32){b=heb(a.m);return b==32?heb(a.l)+32:b+20-10}else{return c-12}} +function bkb(a){var b;b=a.a[a.b];if(b==null){return null}NC(a.a,a.b,null);a.b=a.b+1&a.a.length-1;return b} +function EDc(a){var b,c;b=a.t-a.k[a.o.p]*a.d+a.j[a.o.p]>a.f;c=a.u+a.e[a.o.p]*a.d>a.f*a.s*a.d;return b||c} +function Iwb(a,b,c){var d,e;d=new exb(b,c);e=new fxb;a.b=Gwb(a,a.b,d,e);e.b||++a.c;a.b.b=false;return e.d} +function djc(a,b,c){var d,e,f,g;g=CHc(b,c);f=0;for(e=g.Kc();e.Ob();){d=BD(e.Pb(),11);Rhb(a.c,d,meb(f++))}} +function xVb(a){var b,c;for(c=new olb(a.a.b);c.ac&&(c=a[b])}return c} +function SHc(a,b,c){var d;d=new Rkb;UHc(a,b,d,(Ucd(),zcd),true,false);UHc(a,c,d,Tcd,false,false);return d} +function crd(a,b,c){var d,e,f,g;f=null;g=b;e=Ypd(g,'labels');d=new Hrd(a,c);f=(Dqd(d.a,d.b,e),e);return f} +function j1d(a,b,c,d){var e;e=r1d(a,b,c,d);if(!e){e=i1d(a,c,d);if(!!e&&!e1d(a,b,e)){return null}}return e} +function m1d(a,b,c,d){var e;e=s1d(a,b,c,d);if(!e){e=l1d(a,c,d);if(!!e&&!e1d(a,b,e)){return null}}return e} +function Xb(a,b){var c;for(c=0;c1||b>=0&&a.b<3} +function w7c(a){var b,c,d;b=new s7c;for(d=Jsb(a,0);d.b!=d.d.c;){c=BD(Xsb(d),8);St(b,0,new g7c(c))}return b} +function qVb(a){var b,c;for(c=new olb(a.a.b);c.ad?1:0} +function NYb(a,b){if(OYb(a,b)){Rc(a.b,BD(vNb(b,(wtc(),Esc)),21),b);Dsb(a.a,b);return true}else{return false}} +function d3b(a){var b,c;b=BD(vNb(a,(wtc(),gtc)),10);if(b){c=b.c;Lkb(c.a,b);c.a.c.length==0&&Lkb(Q_b(b).b,c)}} +function syb(a){if(lyb){return KC(qL,tke,572,0,0,1)}return BD(Qkb(a.a,KC(qL,tke,572,a.a.c.length,0,1)),842)} +function mn(a,b,c,d){Vm();return new wx(OC(GC(CK,1),zie,42,0,[(Wj(a,b),new Wo(a,b)),(Wj(c,d),new Wo(c,d))]))} +function Dnd(a,b,c){var d,e;e=(d=new SSd,d);$nd(e,b,c);wtd((!a.q&&(a.q=new cUd(n5,a,11,10)),a.q),e);return e} +function Zmd(a){var b,c,d,e;e=icb(Rmd,a);c=e.length;d=KC(ZI,nie,2,c,6,1);for(b=0;b=a.b.c.length){return}aub(a,2*b+1);c=2*b+2;c=0&&a[d]===b[d];d--);return d<0?0:Gbb(xbb(a[d],Yje),xbb(b[d],Yje))?-1:1} +function UFc(a,b){var c,d;for(d=Jsb(a,0);d.b!=d.d.c;){c=BD(Xsb(d),214);if(c.e.length>0){b.td(c);c.i&&_Fc(c)}}} +function nzd(a,b){var c,d;d=BD(Ajd(a.a,4),126);c=KC($3,hve,415,b,0,1);d!=null&&$fb(d,0,c,0,d.length);return c} +function JEd(a,b){var c;c=new NEd((a.f&256)!=0,a.i,a.a,a.d,(a.f&16)!=0,a.j,a.g,b);a.e!=null||(c.c=a);return c} +function Dc(a,b){var c,d;for(d=a.Zb().Cc().Kc();d.Ob();){c=BD(d.Pb(),14);if(c.Hc(b)){return true}}return false} +function oNb(a,b,c,d,e){var f,g;for(g=c;g<=e;g++){for(f=b;f<=d;f++){if(YMb(a,f,g)){return true}}}return false} +function Tt(a,b,c){var d,e,f,g;uCb(c);g=false;f=a.Zc(b);for(e=c.Kc();e.Ob();){d=e.Pb();f.Rb(d);g=true}return g} +function Dv(a,b){var c;if(a===b){return true}else if(JD(b,83)){c=BD(b,83);return Ax(Wm(a),c.vc())}return false} +function Nhb(a,b,c){var d,e;for(e=c.Kc();e.Ob();){d=BD(e.Pb(),42);if(a.re(b,d.dd())){return true}}return false} +function Hic(a,b,c){if(!a.d[b.p][c.p]){Gic(a,b,c);a.d[b.p][c.p]=true;a.d[c.p][b.p]=true}return a.a[b.p][c.p]} +function Itd(a,b){if(!a.ai()&&b==null){throw vbb(new Wdb("The 'no null' constraint is violated"))}return b} +function $Jd(a,b){if(a.D==null&&a.B!=null){a.D=a.B;a.B=null}jKd(a,b==null?null:(uCb(b),b));!!a.C&&a.yk(null)} +function XHc(a,b){var c;if(!a||a==b||!wNb(b,(wtc(),Psc))){return false}c=BD(vNb(b,(wtc(),Psc)),10);return c!=a} +function b4d(a){switch(a.i){case 2:{return true}case 1:{return false}case -1:{++a.c}default:{return a.pl()}}} +function c4d(a){switch(a.i){case -2:{return true}case -1:{return false}case 1:{--a.c}default:{return a.ql()}}} +function Xdb(a){Zy.call(this,'The given string does not match the expected format for individual spacings.',a)} +function pgd(){pgd=ccb;mgd=new qgd('ELK',0);ngd=new qgd('JSON',1);lgd=new qgd('DOT',2);ogd=new qgd('SVG',3)} +function pWc(){pWc=ccb;mWc=new rWc(ane,0);nWc=new rWc('RADIAL_COMPACTION',1);oWc=new rWc('WEDGE_COMPACTION',2)} +function Fyb(){Fyb=ccb;Cyb=new Gyb('CONCURRENT',0);Dyb=new Gyb('IDENTITY_FINISH',1);Eyb=new Gyb('UNORDERED',2)} +function nPb(){nPb=ccb;kPb=(cPb(),bPb);jPb=new Nsd(Tle,kPb);iPb=new Lsd(Ule);lPb=new Lsd(Vle);mPb=new Lsd(Wle)} +function Occ(){Occ=ccb;Mcc=new Zcc;Ncc=new _cc;Lcc=new bdc;Kcc=new fdc;Jcc=new jdc;Icc=(uCb(Jcc),new bpb)} +function tBc(){tBc=ccb;qBc=new uBc('CONSERVATIVE',0);rBc=new uBc('CONSERVATIVE_SOFT',1);sBc=new uBc('SLOPPY',2)} +function Zad(){Zad=ccb;Xad=new q0b(15);Wad=new Osd((Y9c(),f9c),Xad);Yad=C9c;Sad=s8c;Tad=Y8c;Vad=_8c;Uad=$8c} +function o7c(a,b,c){var d,e,f;d=new Psb;for(f=Jsb(c,0);f.b!=f.d.c;){e=BD(Xsb(f),8);Dsb(d,new g7c(e))}Tt(a,b,d)} +function r7c(a){var b,c,d;b=0;d=KC(m1,nie,8,a.b,0,1);c=Jsb(a,0);while(c.b!=c.d.c){d[b++]=BD(Xsb(c),8)}return d} +function $Pd(a){var b;b=(!a.a&&(a.a=new cUd(g5,a,9,5)),a.a);if(b.i!=0){return nQd(BD(qud(b,0),678))}return null} +function Ly(a,b){var c;c=wbb(a,b);if(Gbb(Vbb(a,b),0)|Ebb(Vbb(a,c),0)){return c}return wbb(rie,Vbb(Pbb(c,63),1))} +function Yyc(a,b){var c;c=Ksd((dzc(),bzc))!=null&&b.wg()!=null?Edb(ED(b.wg()))/Edb(ED(Ksd(bzc))):1;Rhb(a.b,b,c)} +function le(a,b){var c,d;c=BD(a.d.Bc(b),14);if(!c){return null}d=a.e.hc();d.Gc(c);a.e.d-=c.gc();c.$b();return d} +function AHc(a,b){var c,d;d=a.c[b];if(d==0){return}a.c[b]=0;a.d-=d;c=b+1;while(c0){return _vb(b-1,a.a.c.length),Kkb(a.a,b-1)}else{throw vbb(new Jpb)}} +function C2c(a,b,c){if(b<0){throw vbb(new qcb(ese+b))}if(bb){throw vbb(new Wdb(xke+a+yke+b))}if(a<0||b>c){throw vbb(new scb(xke+a+zke+b+oke+c))}} +function j5c(a){if(!a.a||(a.a.i&8)==0){throw vbb(new Zdb('Enumeration class expected for layout option '+a.f))}} +function vud(a){var b;++a.j;if(a.i==0){a.g=null}else if(a.iRqe?a-c>Rqe:c-a>Rqe} +function pHb(a,b){if(!a){return 0}if(b&&!a.j){return 0}if(JD(a,124)){if(BD(a,124).a.b==0){return 0}}return a.Re()} +function qHb(a,b){if(!a){return 0}if(b&&!a.k){return 0}if(JD(a,124)){if(BD(a,124).a.a==0){return 0}}return a.Se()} +function fhb(a){Hgb();if(a<0){if(a!=-1){return new Tgb(-1,-a)}return Bgb}else return a<=10?Dgb[QD(a)]:new Tgb(1,a)} +function xC(a){rC();throw vbb(new MB("Unexpected typeof result '"+a+"'; please report this bug to the GWT team"))} +function lz(a){jz();Py(this);Ry(this);this.e=a;Sy(this,a);this.g=a==null?Xhe:fcb(a);this.a='';this.b=a;this.a=''} +function F$c(){this.a=new G$c;this.f=new I$c(this);this.b=new K$c(this);this.i=new M$c(this);this.e=new O$c(this)} +function ss(){rs.call(this,new _rb(Cv(16)));Xj(2,mie);this.b=2;this.a=new Ms(null,null,0,null);As(this.a,this.a)} +function xzc(){xzc=ccb;uzc=new zzc('DUMMY_NODE_OVER',0);vzc=new zzc('DUMMY_NODE_UNDER',1);wzc=new zzc('EQUAL',2)} +function LUb(){LUb=ccb;JUb=Fx(OC(GC(t1,1),Kie,103,0,[(ead(),aad),bad]));KUb=Fx(OC(GC(t1,1),Kie,103,0,[dad,_9c]))} +function VQc(a){return (Ucd(),Lcd).Hc(a.j)?Edb(ED(vNb(a,(wtc(),qtc)))):l7c(OC(GC(m1,1),nie,8,0,[a.i.n,a.n,a.a])).b} +function DOb(a){var b,c,d,e;d=a.b.a;for(c=d.a.ec().Kc();c.Ob();){b=BD(c.Pb(),561);e=new MPb(b,a.e,a.f);Ekb(a.g,e)}} +function yId(a,b){var c,d,e;d=a.nk(b,null);e=null;if(b){e=(LFd(),c=new UQd,c);NQd(e,a.r)}d=xId(a,e,d);!!d&&d.Fi()} +function VFc(a,b){var c,d;d=Cub(a.d,1)!=0;c=true;while(c){c=false;c=b.c.Tf(b.e,d);c=c|dGc(a,b,d,false);d=!d}$Fc(a)} +function wZc(a,b){var c,d,e;d=false;c=b.q.d;if(b.de){$Zc(b.q,e);d=c!=b.q.d}}return d} +function PVc(a,b){var c,d,e,f,g,h,i,j;i=b.i;j=b.j;d=a.f;e=d.i;f=d.j;g=i-e;h=j-f;c=$wnd.Math.sqrt(g*g+h*h);return c} +function Rnd(a,b){var c,d;d=jid(a);if(!d){!And&&(And=new lUd);c=(IEd(),PEd(b));d=new s0d(c);wtd(d.Vk(),a)}return d} +function Sc(a,b){var c,d;c=BD(a.c.Bc(b),14);if(!c){return a.jc()}d=a.hc();d.Gc(c);a.d-=c.gc();c.$b();return a.mc(d)} +function j7c(a,b){var c;for(c=0;c=a.c.b:a.a<=a.c.b)){throw vbb(new utb)}b=a.a;a.a+=a.c.c;++a.b;return meb(b)} +function BWb(a){var b;b=new VWb(a);rXb(a.a,zWb,new amb(OC(GC(bQ,1),Uhe,369,0,[b])));!!b.d&&Ekb(b.f,b.d);return b.f} +function Z1b(a){var b;b=new q_b(a.a);tNb(b,a);yNb(b,(wtc(),$sc),a);b.o.a=a.g;b.o.b=a.f;b.n.a=a.i;b.n.b=a.j;return b} +function A9b(a,b,c,d){var e,f;for(f=a.Kc();f.Ob();){e=BD(f.Pb(),70);e.n.a=b.a+(d.a-e.o.a)/2;e.n.b=b.b;b.b+=e.o.b+c}} +function UDb(a,b,c){var d,e;for(e=b.a.a.ec().Kc();e.Ob();){d=BD(e.Pb(),57);if(VDb(a,d,c)){return true}}return false} +function JDc(a){var b,c;for(c=new olb(a.r);c.a=0?b:-b;while(d>0){if(d%2==0){c*=c;d=d/2|0}else{e*=c;d-=1}}return b<0?1/e:e} +function y6c(a,b){var c,d,e;e=1;c=a;d=b>=0?b:-b;while(d>0){if(d%2==0){c*=c;d=d/2|0}else{e*=c;d-=1}}return b<0?1/e:e} +function sAd(a){var b,c,d,e;if(a!=null){for(c=0;c0){c=BD(Ikb(a.a,a.a.c.length-1),570);if(NYb(c,b)){return}}Ekb(a.a,new PYb(b))} +function $gc(a){Hgc();var b,c;b=a.d.c-a.e.c;c=BD(a.g,145);Hkb(c.b,new shc(b));Hkb(c.c,new uhc(b));reb(c.i,new whc(b))} +function gic(a){var b;b=new Ufb;b.a+='VerticalSegment ';Pfb(b,a.e);b.a+=' ';Qfb(b,Eb(new Gb,new olb(a.k)));return b.a} +function u4c(a){var b;b=BD(Wrb(a.c.c,''),229);if(!b){b=new W3c(d4c(c4c(new e4c,''),'Other'));Xrb(a.c.c,'',b)}return b} +function qnd(a){var b;if((a.Db&64)!=0)return Eid(a);b=new Jfb(Eid(a));b.a+=' (name: ';Efb(b,a.zb);b.a+=')';return b.a} +function Jnd(a,b,c){var d,e;e=a.sb;a.sb=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,4,e,b);!c?(c=d):c.Ei(d)}return c} +function _ic(a,b){var c,d,e;c=0;for(e=V_b(a,b).Kc();e.Ob();){d=BD(e.Pb(),11);c+=vNb(d,(wtc(),gtc))!=null?1:0}return c} +function vPc(a,b,c){var d,e,f;d=0;for(f=Jsb(a,0);f.b!=f.d.c;){e=Edb(ED(Xsb(f)));if(e>c){break}else e>=b&&++d}return d} +function RTd(a,b,c){var d,e;d=new pSd(a.e,3,13,null,(e=b.c,e?e:(jGd(),YFd)),HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function STd(a,b,c){var d,e;d=new pSd(a.e,4,13,(e=b.c,e?e:(jGd(),YFd)),null,HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function zId(a,b,c){var d,e;e=a.r;a.r=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,8,e,a.r);!c?(c=d):c.Ei(d)}return c} +function o1d(a,b){var c,d;c=BD(b,676);d=c.vk();!d&&c.wk(d=JD(b,88)?new C1d(a,BD(b,26)):new O1d(a,BD(b,148)));return d} +function kud(a,b,c){var d;a.qi(a.i+1);d=a.oi(b,c);b!=a.i&&$fb(a.g,b,a.g,b+1,a.i-b);NC(a.g,b,d);++a.i;a.bi(b,c);a.ci()} +function vwb(a,b){var c;if(b.a){c=b.a.a.length;!a.a?(a.a=new Wfb(a.d)):Qfb(a.a,a.b);Ofb(a.a,b.a,b.d.length,c)}return a} +function __d(a,b){var c,d,e,f;b.vi(a.a);f=BD(Ajd(a.a,8),1936);if(f!=null){for(c=f,d=0,e=c.length;dc){throw vbb(new qcb(xke+a+zke+b+', size: '+c))}if(a>b){throw vbb(new Wdb(xke+a+yke+b))}} +function eid(a,b,c){if(b<0){vid(a,c)}else{if(!c.Ij()){throw vbb(new Wdb(ite+c.ne()+jte))}BD(c,66).Nj().Vj(a,a.yh(),b)}} +function Jlb(a,b,c,d,e,f,g,h){var i;i=c;while(f=d||b=65&&a<=70){return a-65+10}if(a>=97&&a<=102){return a-97+10}if(a>=48&&a<=57){return a-48}return 0} +function QHd(a){var b;if((a.Db&64)!=0)return Eid(a);b=new Jfb(Eid(a));b.a+=' (source: ';Efb(b,a.d);b.a+=')';return b.a} +function OQd(a,b,c){var d,e;e=a.a;a.a=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,5,e,a.a);!c?(c=d):Qwd(c,d)}return c} +function BId(a,b){var c;c=(a.Bb&256)!=0;b?(a.Bb|=256):(a.Bb&=-257);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,2,c,b))} +function eLd(a,b){var c;c=(a.Bb&256)!=0;b?(a.Bb|=256):(a.Bb&=-257);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,8,c,b))} +function LPd(a,b){var c;c=(a.Bb&256)!=0;b?(a.Bb|=256):(a.Bb&=-257);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,8,c,b))} +function CId(a,b){var c;c=(a.Bb&512)!=0;b?(a.Bb|=512):(a.Bb&=-513);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,3,c,b))} +function fLd(a,b){var c;c=(a.Bb&512)!=0;b?(a.Bb|=512):(a.Bb&=-513);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,9,c,b))} +function N7d(a,b){var c;if(a.b==-1&&!!a.a){c=a.a.Gj();a.b=!c?bLd(a.c.Tg(),a.a):a.c.Xg(a.a.aj(),c)}return a.c.Og(a.b,b)} +function meb(a){var b,c;if(a>-129&&a<128){b=a+128;c=(oeb(),neb)[b];!c&&(c=neb[b]=new _db(a));return c}return new _db(a)} +function Web(a){var b,c;if(a>-129&&a<128){b=a+128;c=(Yeb(),Xeb)[b];!c&&(c=Xeb[b]=new Qeb(a));return c}return new Qeb(a)} +function L5b(a){var b,c;b=a.k;if(b==(j0b(),e0b)){c=BD(vNb(a,(wtc(),Hsc)),61);return c==(Ucd(),Acd)||c==Rcd}return false} +function i1d(a,b,c){var d,e,f;f=(e=nUd(a.b,b),e);if(f){d=BD(V1d(p1d(a,f),''),26);if(d){return r1d(a,d,b,c)}}return null} +function l1d(a,b,c){var d,e,f;f=(e=nUd(a.b,b),e);if(f){d=BD(V1d(p1d(a,f),''),26);if(d){return s1d(a,d,b,c)}}return null} +function cTd(a,b){var c,d;for(d=new Fyd(a);d.e!=d.i.gc();){c=BD(Dyd(d),138);if(PD(b)===PD(c)){return true}}return false} +function vtd(a,b,c){var d;d=a.gc();if(b>d)throw vbb(new Cyd(b,d));if(a.hi()&&a.Hc(c)){throw vbb(new Wdb(kue))}a.Xh(b,c)} +function iqd(a,b){var c;c=oo(a.i,b);if(c==null){throw vbb(new cqd('Node did not exist in input.'))}Yqd(b,c);return null} +function $hd(a,b){var c;c=YKd(a,b);if(JD(c,322)){return BD(c,34)}throw vbb(new Wdb(ite+b+"' is not a valid attribute"))} +function V2d(a,b,c){var d,e;e=JD(b,99)&&(BD(b,18).Bb&Tje)!=0?new s4d(b,a):new p4d(b,a);for(d=0;db){return 1}if(a==b){return a==0?Kdb(1/a,1/b):0}return isNaN(a)?isNaN(b)?0:1:-1} +function f4b(a,b){Odd(b,'Sort end labels',1);MAb(JAb(LAb(new YAb(null,new Kub(a.b,16)),new q4b),new s4b),new u4b);Qdd(b)} +function Wxd(a,b,c){var d,e;if(a.ej()){e=a.fj();d=sud(a,b,c);a.$i(a.Zi(7,meb(c),d,b,e));return d}else{return sud(a,b,c)}} +function vAd(a,b){var c,d,e;if(a.d==null){++a.e;--a.f}else{e=b.cd();c=b.Sh();d=(c&Ohe)%a.d.length;KAd(a,d,xAd(a,d,c,e))}} +function ZId(a,b){var c;c=(a.Bb&zte)!=0;b?(a.Bb|=zte):(a.Bb&=-1025);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,10,c,b))} +function dJd(a,b){var c;c=(a.Bb&Rje)!=0;b?(a.Bb|=Rje):(a.Bb&=-4097);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,12,c,b))} +function eJd(a,b){var c;c=(a.Bb&Cve)!=0;b?(a.Bb|=Cve):(a.Bb&=-8193);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,15,c,b))} +function fJd(a,b){var c;c=(a.Bb&Dve)!=0;b?(a.Bb|=Dve):(a.Bb&=-2049);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,11,c,b))} +function jOb(a,b){var c;c=Kdb(a.b.c,b.b.c);if(c!=0){return c}c=Kdb(a.a.a,b.a.a);if(c!=0){return c}return Kdb(a.a.b,b.a.b)} +function jqd(a,b){var c;c=Ohb(a.k,b);if(c==null){throw vbb(new cqd('Port did not exist in input.'))}Yqd(b,c);return null} +function k6d(a){var b,c;for(c=l6d(bKd(a)).Kc();c.Ob();){b=GD(c.Pb());if(Dmd(a,b)){return uFd((tFd(),sFd),b)}}return null} +function n3d(a,b){var c,d,e,f,g;g=S6d(a.e.Tg(),b);f=0;c=BD(a.g,119);for(e=0;e>10)+Uje&aje;b[1]=(a&1023)+56320&aje;return zfb(b,0,b.length)} +function a_b(a){var b,c;c=BD(vNb(a,(Nyc(),Lwc)),103);if(c==(ead(),cad)){b=Edb(ED(vNb(a,owc)));return b>=1?bad:_9c}return c} +function rec(a){switch(BD(vNb(a,(Nyc(),Swc)),218).g){case 1:return new Fmc;case 3:return new wnc;default:return new zmc;}} +function Uzb(a){if(a.c){Uzb(a.c)}else if(a.d){throw vbb(new Zdb("Stream already terminated, can't be modified or used"))}} +function Mkd(a){var b;if((a.Db&64)!=0)return Eid(a);b=new Jfb(Eid(a));b.a+=' (identifier: ';Efb(b,a.k);b.a+=')';return b.a} +function ctd(a,b,c){var d,e;d=(Fhd(),e=new xkd,e);vkd(d,b);wkd(d,c);!!a&&wtd((!a.a&&(a.a=new xMd(y2,a,5)),a.a),d);return d} +function ttb(a,b,c,d){var e,f;uCb(d);uCb(c);e=a.xc(b);f=e==null?c:Myb(BD(e,15),BD(c,14));f==null?a.Bc(b):a.zc(b,f);return f} +function pqb(a){var b,c,d,e;c=(b=BD(gdb((d=a.gm,e=d.f,e==CI?d:e)),9),new xqb(b,BD(_Bb(b,b.length),9),0));rqb(c,a);return c} +function hDc(a,b,c){var d,e;for(e=a.a.ec().Kc();e.Ob();){d=BD(e.Pb(),10);if(Be(c,BD(Ikb(b,d.p),14))){return d}}return null} +function Db(b,c,d){var e;try{Cb(b,c,d)}catch(a){a=ubb(a);if(JD(a,597)){e=a;throw vbb(new ycb(e))}else throw vbb(a)}return c} +function Qbb(a,b){var c;if(Fbb(a)&&Fbb(b)){c=a-b;if(Kje>1;a.k=c-1>>1} +function Gub(){zub();var a,b,c;c=yub+++Date.now();a=QD($wnd.Math.floor(c*lke))&nke;b=QD(c-a*mke);this.a=a^1502;this.b=b^kke} +function O_b(a){var b,c,d;b=new Rkb;for(d=new olb(a.j);d.a3.4028234663852886E38){return Pje}else if(b<-3.4028234663852886E38){return Qje}return b} +function aeb(a){a-=a>>1&1431655765;a=(a>>2&858993459)+(a&858993459);a=(a>>4)+a&252645135;a+=a>>8;a+=a>>16;return a&63} +function Ev(a){var b,c,d,e;b=new cq(a.Hd().gc());e=0;for(d=vr(a.Hd().Kc());d.Ob();){c=d.Pb();bq(b,c,meb(e++))}return fn(b.a)} +function Uyb(a,b){var c,d,e;e=new Lqb;for(d=b.vc().Kc();d.Ob();){c=BD(d.Pb(),42);Rhb(e,c.cd(),Yyb(a,BD(c.dd(),15)))}return e} +function EZc(a,b){a.n.c.length==0&&Ekb(a.n,new VZc(a.s,a.t,a.i));Ekb(a.b,b);QZc(BD(Ikb(a.n,a.n.c.length-1),211),b);GZc(a,b)} +function LFb(a){if(a.c!=a.b.b||a.i!=a.g.b){a.a.c=KC(SI,Uhe,1,0,5,1);Gkb(a.a,a.b);Gkb(a.a,a.g);a.c=a.b.b;a.i=a.g.b}return a.a} +function Ycc(a,b){var c,d,e;e=0;for(d=BD(b.Kb(a),20).Kc();d.Ob();){c=BD(d.Pb(),17);Ccb(DD(vNb(c,(wtc(),ltc))))||++e}return e} +function efc(a,b){var c,d,e;d=tgc(b);e=Edb(ED(pBc(d,(Nyc(),lyc))));c=$wnd.Math.max(0,e/2-0.5);cfc(b,c,1);Ekb(a,new Dfc(b,c))} +function Ctc(){Ctc=ccb;Btc=new Dtc(ane,0);xtc=new Dtc('FIRST',1);ytc=new Dtc(Gne,2);ztc=new Dtc('LAST',3);Atc=new Dtc(Hne,4)} +function Aad(){Aad=ccb;zad=new Bad(ole,0);xad=new Bad('POLYLINE',1);wad=new Bad('ORTHOGONAL',2);yad=new Bad('SPLINES',3)} +function zYc(){zYc=ccb;xYc=new AYc('ASPECT_RATIO_DRIVEN',0);yYc=new AYc('MAX_SCALE_DRIVEN',1);wYc=new AYc('AREA_DRIVEN',2)} +function Y$c(){Y$c=ccb;V$c=new Z$c('P1_STRUCTURE',0);W$c=new Z$c('P2_PROCESSING_ORDER',1);X$c=new Z$c('P3_EXECUTION',2)} +function tVc(){tVc=ccb;sVc=new uVc('OVERLAP_REMOVAL',0);qVc=new uVc('COMPACTION',1);rVc=new uVc('GRAPH_SIZE_CALCULATION',2)} +function Jy(a,b){Iy();return My(Qie),$wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b))} +function yOc(a,b){var c,d;c=Jsb(a,0);while(c.b!=c.d.c){d=Gdb(ED(Xsb(c)));if(d==b){return}else if(d>b){Ysb(c);break}}Vsb(c,b)} +function t4c(a,b){var c,d,e,f,g;c=b.f;Xrb(a.c.d,c,b);if(b.g!=null){for(e=b.g,f=0,g=e.length;fb&&d.ue(a[f-1],a[f])>0;--f){g=a[f];NC(a,f,a[f-1]);NC(a,f-1,g)}}} +function did(a,b,c,d){if(b<0){uid(a,c,d)}else{if(!c.Ij()){throw vbb(new Wdb(ite+c.ne()+jte))}BD(c,66).Nj().Tj(a,a.yh(),b,d)}} +function xFb(a,b){if(b==a.d){return a.e}else if(b==a.e){return a.d}else{throw vbb(new Wdb('Node '+b+' not part of edge '+a))}} +function iEb(a,b){switch(b.g){case 2:return a.b;case 1:return a.c;case 4:return a.d;case 3:return a.a;default:return false;}} +function GVb(a,b){switch(b.g){case 2:return a.b;case 1:return a.c;case 4:return a.d;case 3:return a.a;default:return false;}} +function Xkd(a,b,c,d){switch(b){case 3:return a.f;case 4:return a.g;case 5:return a.i;case 6:return a.j;}return Ekd(a,b,c,d)} +function Ljc(a){if(a.k!=(j0b(),h0b)){return false}return FAb(new YAb(null,new Lub(new Sr(ur(U_b(a).a.Kc(),new Sq)))),new Mjc)} +function MEd(a){if(a.e==null){return a}else !a.c&&(a.c=new NEd((a.f&256)!=0,a.i,a.a,a.d,(a.f&16)!=0,a.j,a.g,null));return a.c} +function VC(a,b){if(a.h==Gje&&a.m==0&&a.l==0){b&&(QC=TC(0,0,0));return SC((wD(),uD))}b&&(QC=TC(a.l,a.m,a.h));return TC(0,0,0)} +function fcb(a){var b;if(Array.isArray(a)&&a.im===gcb){return hdb(rb(a))+'@'+(b=tb(a)>>>0,b.toString(16))}return a.toString()} +function Rpb(a){var b;this.a=(b=BD(a.e&&a.e(),9),new xqb(b,BD(_Bb(b,b.length),9),0));this.b=KC(SI,Uhe,1,this.a.a.length,5,1)} +function _Ob(a){var b,c,d;this.a=new zsb;for(d=new olb(a);d.a0&&(BCb(b-1,a.length),a.charCodeAt(b-1)==58)&&!OEd(a,CEd,DEd)} +function OEd(a,b,c){var d,e;for(d=0,e=a.length;d=e){return b.c+c}}return b.c+b.b.gc()} +function NCd(a,b){LCd();var c,d,e,f;d=KLd(a);e=b;Klb(d,0,d.length,e);for(c=0;c0){d+=e;++c}}c>1&&(d+=a.d*(c-1));return d} +function Htd(a){var b,c,d;d=new Hfb;d.a+='[';for(b=0,c=a.gc();b0&&this.b>0&&q$c(this.c,this.b,this.a)} +function ezc(a){dzc();this.c=Ou(OC(GC(h0,1),Uhe,831,0,[Uyc]));this.b=new Lqb;this.a=a;Rhb(this.b,bzc,1);Hkb(czc,new Xed(this))} +function I2c(a,b){var c;if(a.d){if(Mhb(a.b,b)){return BD(Ohb(a.b,b),51)}else{c=b.Kf();Rhb(a.b,b,c);return c}}else{return b.Kf()}} +function Kgb(a,b){var c;if(PD(a)===PD(b)){return true}if(JD(b,91)){c=BD(b,91);return a.e==c.e&&a.d==c.d&&Lgb(a,c.a)}return false} +function Zcd(a){Ucd();switch(a.g){case 4:return Acd;case 1:return zcd;case 3:return Rcd;case 2:return Tcd;default:return Scd;}} +function Ykd(a,b){switch(b){case 3:return a.f!=0;case 4:return a.g!=0;case 5:return a.i!=0;case 6:return a.j!=0;}return Hkd(a,b)} +function gWc(a){switch(a.g){case 0:return new FXc;case 1:return new IXc;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function QUc(a){switch(a.g){case 0:return new CXc;case 1:return new MXc;default:throw vbb(new Wdb(Dne+(a.f!=null?a.f:''+a.g)));}} +function b1c(a){switch(a.g){case 0:return new s1c;case 1:return new w1c;default:throw vbb(new Wdb(Mre+(a.f!=null?a.f:''+a.g)));}} +function qWc(a){switch(a.g){case 1:return new SVc;case 2:return new KVc;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function ryb(a){var b,c;if(a.b){return a.b}c=lyb?null:a.d;while(c){b=lyb?null:c.b;if(b){return b}c=lyb?null:c.d}return $xb(),Zxb} +function hhb(a){var b,c,d;if(a.e==0){return 0}b=a.d<<5;c=a.a[a.d-1];if(a.e<0){d=Mgb(a);if(d==a.d-1){--c;c=c|0}}b-=heb(c);return b} +function bhb(a){var b,c,d;if(a>5;b=a&31;d=KC(WD,oje,25,c+1,15,1);d[c]=1<3){e*=10;--f}a=(a+(e>>1))/e|0}d.i=a;return true} +function XUb(a){LUb();return Bcb(),GVb(BD(a.a,81).j,BD(a.b,103))||BD(a.a,81).d.e!=0&&GVb(BD(a.a,81).j,BD(a.b,103))?true:false} +function s3c(a){p3c();if(BD(a.We((Y9c(),b9c)),174).Hc((Idd(),Gdd))){BD(a.We(x9c),174).Fc((rcd(),qcd));BD(a.We(b9c),174).Mc(Gdd)}} +function Gxd(a,b){var c,d;if(!b){return false}else{for(c=0;c=0;--d){b=c[d];for(e=0;e>1;this.k=b-1>>1} +function r3b(a,b){Odd(b,'End label post-processing',1);MAb(JAb(LAb(new YAb(null,new Kub(a.b,16)),new w3b),new y3b),new A3b);Qdd(b)} +function NLc(a,b,c){var d,e;d=Edb(a.p[b.i.p])+Edb(a.d[b.i.p])+b.n.b+b.a.b;e=Edb(a.p[c.i.p])+Edb(a.d[c.i.p])+c.n.b+c.a.b;return e-d} +function xhb(a,b,c){var d,e;d=xbb(c,Yje);for(e=0;ybb(d,0)!=0&&e0&&(BCb(0,b.length),b.charCodeAt(0)==43)?b.substr(1):b))} +function T9d(a){var b;return a==null?null:new Ygb((b=Qge(a,true),b.length>0&&(BCb(0,b.length),b.charCodeAt(0)==43)?b.substr(1):b))} +function xud(a,b){var c;if(a.i>0){if(b.lengtha.i&&NC(b,a.i,null);return b} +function Sxd(a,b,c){var d,e,f;if(a.ej()){d=a.i;f=a.fj();kud(a,d,b);e=a.Zi(3,null,b,d,f);!c?(c=e):c.Ei(e)}else{kud(a,a.i,b)}return c} +function HMd(a,b,c){var d,e;d=new pSd(a.e,4,10,(e=b.c,JD(e,88)?BD(e,26):(jGd(),_Fd)),null,HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function GMd(a,b,c){var d,e;d=new pSd(a.e,3,10,null,(e=b.c,JD(e,88)?BD(e,26):(jGd(),_Fd)),HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function _Jb(a){$Jb();var b;b=new g7c(BD(a.e.We((Y9c(),_8c)),8));if(a.B.Hc((Idd(),Bdd))){b.a<=0&&(b.a=20);b.b<=0&&(b.b=20)}return b} +function Lzc(a){Izc();var b;(!a.q?(mmb(),mmb(),kmb):a.q)._b((Nyc(),Cxc))?(b=BD(vNb(a,Cxc),197)):(b=BD(vNb(Q_b(a),Dxc),197));return b} +function pBc(a,b){var c,d;d=null;if(wNb(a,(Nyc(),qyc))){c=BD(vNb(a,qyc),94);c.Xe(b)&&(d=c.We(b))}d==null&&(d=vNb(Q_b(a),b));return d} +function Ze(a,b){var c,d,e;if(JD(b,42)){c=BD(b,42);d=c.cd();e=Hv(a.Rc(),d);return Hb(e,c.dd())&&(e!=null||a.Rc()._b(d))}return false} +function qAd(a,b){var c,d,e;if(a.f>0){a.qj();d=b==null?0:tb(b);e=(d&Ohe)%a.d.length;c=xAd(a,e,d,b);return c!=-1}else{return false}} +function AAd(a,b){var c,d,e;if(a.f>0){a.qj();d=b==null?0:tb(b);e=(d&Ohe)%a.d.length;c=wAd(a,e,d,b);if(c){return c.dd()}}return null} +function R2d(a,b){var c,d,e,f;f=S6d(a.e.Tg(),b);c=BD(a.g,119);for(e=0;e1?Mbb(Nbb(b.a[1],32),xbb(b.a[0],Yje)):xbb(b.a[0],Yje),Sbb(Ibb(b.e,c))))} +function Hbb(a,b){var c;if(Fbb(a)&&Fbb(b)){c=a%b;if(Kje>5;b&=31;e=a.d+c+(b==0?0:1);d=KC(WD,oje,25,e,15,1);jhb(d,a.a,c,b);f=new Vgb(a.e,e,d);Jgb(f);return f} +function Ofe(a,b,c){var d,e;d=BD(Phb(Zee,b),117);e=BD(Phb($ee,b),117);if(c){Shb(Zee,a,d);Shb($ee,a,e)}else{Shb($ee,a,d);Shb(Zee,a,e)}} +function Cwb(a,b,c){var d,e,f;e=null;f=a.b;while(f){d=a.a.ue(b,f.d);if(c&&d==0){return f}if(d>=0){f=f.a[1]}else{e=f;f=f.a[0]}}return e} +function Dwb(a,b,c){var d,e,f;e=null;f=a.b;while(f){d=a.a.ue(b,f.d);if(c&&d==0){return f}if(d<=0){f=f.a[0]}else{e=f;f=f.a[1]}}return e} +function Nic(a,b,c,d){var e,f,g;e=false;if(fjc(a.f,c,d)){ijc(a.f,a.a[b][c],a.a[b][d]);f=a.a[b];g=f[d];f[d]=f[c];f[c]=g;e=true}return e} +function QHc(a,b,c,d,e){var f,g,h;g=e;while(b.b!=b.c){f=BD(fkb(b),10);h=BD(V_b(f,d).Xb(0),11);a.d[h.p]=g++;c.c[c.c.length]=h}return g} +function hBc(a,b,c){var d,e,f,g,h;g=a.k;h=b.k;d=c[g.g][h.g];e=ED(pBc(a,d));f=ED(pBc(b,d));return $wnd.Math.max((uCb(e),e),(uCb(f),f))} +function zZc(a,b,c){var d,e,f,g;d=c/a.c.length;e=0;for(g=new olb(a);g.a2000){yz=a;zz=$wnd.setTimeout(Iz,10)}}if(xz++==0){Lz((Kz(),Jz));return true}return false} +function wCc(a,b){var c,d,e;for(d=new Sr(ur(U_b(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);e=c.d.i;if(e.c==b){return false}}return true} +function Ek(b,c){var d,e;if(JD(c,245)){e=BD(c,245);try{d=b.vd(e);return d==0}catch(a){a=ubb(a);if(!JD(a,205))throw vbb(a)}}return false} +function Xz(){if(Error.stackTraceLimit>0){$wnd.Error.stackTraceLimit=Error.stackTraceLimit=64;return true}return 'stack' in new Error} +function BDb(a,b){return Iy(),Iy(),My(Qie),($wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b)))>0} +function DDb(a,b){return Iy(),Iy(),My(Qie),($wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b)))<0} +function CDb(a,b){return Iy(),Iy(),My(Qie),($wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b)))<=0} +function ydb(a,b){var c=0;while(!b[c]||b[c]==''){c++}var d=b[c++];for(;cWje){return c.fh()}d=c.Zg();if(!!d||c==a){break}}}return d} +function fvd(a){evd();if(JD(a,156)){return BD(Ohb(cvd,hK),288).vg(a)}if(Mhb(cvd,rb(a))){return BD(Ohb(cvd,rb(a)),288).vg(a)}return null} +function fZd(a){if(efb(kse,a)){return Bcb(),Acb}else if(efb(lse,a)){return Bcb(),zcb}else{throw vbb(new Wdb('Expecting true or false'))}} +function uDc(a,b){if(b.c==a){return b.d}else if(b.d==a){return b.c}throw vbb(new Wdb('Input edge is not connected to the input port.'))} +function Igb(a,b){if(a.e>b.e){return 1}if(a.eb.d){return a.e}if(a.d=48&&a<48+$wnd.Math.min(10,10)){return a-48}if(a>=97&&a<97){return a-97+10}if(a>=65&&a<65){return a-65+10}return -1} +function Ue(a,b){var c;if(PD(b)===PD(a)){return true}if(!JD(b,21)){return false}c=BD(b,21);if(c.gc()!=a.gc()){return false}return a.Ic(c)} +function ekb(a,b){var c,d,e,f;d=a.a.length-1;c=b-a.b&d;f=a.c-b&d;e=a.c-a.b&d;mkb(c=f){hkb(a,b);return -1}else{ikb(a,b);return 1}} +function lA(a,b){var c,d;c=(BCb(b,a.length),a.charCodeAt(b));d=b+1;while(db.e){return 1}else if(a.fb.f){return 1}return tb(a)-tb(b)} +function efb(a,b){uCb(a);if(b==null){return false}if(dfb(a,b)){return true}return a.length==b.length&&dfb(a.toLowerCase(),b.toLowerCase())} +function x6d(a,b){var c,d,e,f;for(d=0,e=b.gc();d0&&ybb(a,128)<0){b=Tbb(a)+128;c=(Ceb(),Beb)[b];!c&&(c=Beb[b]=new teb(a));return c}return new teb(a)} +function _0d(a,b){var c,d;c=b.Hh(a.a);if(c){d=GD(AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),fue));if(d!=null){return d}}return b.ne()} +function a1d(a,b){var c,d;c=b.Hh(a.a);if(c){d=GD(AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),fue));if(d!=null){return d}}return b.ne()} +function FMc(a,b){wMc();var c,d;for(d=new Sr(ur(O_b(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);if(c.d.i==b||c.c.i==b){return c}}return null} +function HUb(a,b,c){this.c=a;this.f=new Rkb;this.e=new d7c;this.j=new IVb;this.n=new IVb;this.b=b;this.g=new J6c(b.c,b.d,b.b,b.a);this.a=c} +function gVb(a){var b,c,d,e;this.a=new zsb;this.d=new Tqb;this.e=0;for(c=a,d=0,e=c.length;d0}else{return false}} +function q2c(a){var b;if(PD(hkd(a,(Y9c(),J8c)))===PD((hbd(),fbd))){if(!Xod(a)){jkd(a,J8c,gbd)}else{b=BD(hkd(Xod(a),J8c),334);jkd(a,J8c,b)}}} +function ijc(a,b,c){var d,e;bIc(a.e,b,c,(Ucd(),Tcd));bIc(a.i,b,c,zcd);if(a.a){e=BD(vNb(b,(wtc(),$sc)),11);d=BD(vNb(c,$sc),11);cIc(a.g,e,d)}} +function OEc(a,b,c){var d,e,f;d=b.c.p;f=b.p;a.b[d][f]=new $Ec(a,b);if(c){a.a[d][f]=new FEc(b);e=BD(vNb(b,(wtc(),Psc)),10);!!e&&Rc(a.d,e,b)}} +function TPb(a,b){var c,d,e;Ekb(PPb,a);b.Fc(a);c=BD(Ohb(OPb,a),21);if(c){for(e=c.Kc();e.Ob();){d=BD(e.Pb(),33);Jkb(PPb,d,0)!=-1||TPb(d,b)}}} +function tyb(a,b,c){var d;(jyb?(ryb(a),true):kyb?($xb(),true):nyb?($xb(),true):myb&&($xb(),false))&&(d=new iyb(b),d.b=c,pyb(a,d),undefined)} +function xKb(a,b){var c;c=!a.A.Hc((tdd(),sdd))||a.q==(dcd(),$bd);a.u.Hc((rcd(),ncd))?c?vKb(a,b):zKb(a,b):a.u.Hc(pcd)&&(c?wKb(a,b):AKb(a,b))} +function b0d(a,b){var c,d;++a.j;if(b!=null){c=(d=a.a.Cb,JD(d,97)?BD(d,97).Jg():null);if(xlb(b,c)){Cjd(a.a,4,c);return}}Cjd(a.a,4,BD(b,126))} +function dYb(a,b,c){return new J6c($wnd.Math.min(a.a,b.a)-c/2,$wnd.Math.min(a.b,b.b)-c/2,$wnd.Math.abs(a.a-b.a)+c,$wnd.Math.abs(a.b-b.b)+c)} +function k4b(a,b){var c,d;c=beb(a.a.c.p,b.a.c.p);if(c!=0){return c}d=beb(a.a.d.i.p,b.a.d.i.p);if(d!=0){return d}return beb(b.a.d.p,a.a.d.p)} +function _Dc(a,b,c){var d,e,f,g;f=b.j;g=c.j;if(f!=g){return f.g-g.g}else{d=a.f[b.p];e=a.f[c.p];return d==0&&e==0?0:d==0?-1:e==0?1:Kdb(d,e)}} +function HFb(a,b,c){var d,e,f;if(c[b.d]){return}c[b.d]=true;for(e=new olb(LFb(b));e.a=e)return e;for(b=b>0?b:0;bd&&NC(b,d,null);return b} +function _lb(a,b){var c,d;d=a.a.length;b.lengthd&&NC(b,d,null);return b} +function Xrb(a,b,c){var d,e,f;e=BD(Ohb(a.e,b),387);if(!e){d=new lsb(a,b,c);Rhb(a.e,b,d);isb(d);return null}else{f=ijb(e,c);Yrb(a,e);return f}} +function P9d(a){var b;if(a==null)return null;b=ide(Qge(a,true));if(b==null){throw vbb(new n8d("Invalid hexBinary value: '"+a+"'"))}return b} +function ghb(a){Hgb();if(ybb(a,0)<0){if(ybb(a,-1)!=0){return new Wgb(-1,Jbb(a))}return Bgb}else return ybb(a,10)<=0?Dgb[Tbb(a)]:new Wgb(1,a)} +function wJb(){qJb();return OC(GC(DN,1),Kie,159,0,[nJb,mJb,oJb,eJb,dJb,fJb,iJb,hJb,gJb,lJb,kJb,jJb,bJb,aJb,cJb,$Ib,ZIb,_Ib,XIb,WIb,YIb,pJb])} +function vjc(a){var b;this.d=new Rkb;this.j=new d7c;this.g=new d7c;b=a.g.b;this.f=BD(vNb(Q_b(b),(Nyc(),Lwc)),103);this.e=Edb(ED(c_b(b,ryc)))} +function Pjc(a){this.b=new Rkb;this.e=new Rkb;this.d=a;this.a=!WAb(JAb(new YAb(null,new Lub(new b1b(a.b))),new Xxb(new Qjc))).sd((EAb(),DAb))} +function N5c(){N5c=ccb;L5c=new O5c('PARENTS',0);K5c=new O5c('NODES',1);I5c=new O5c('EDGES',2);M5c=new O5c('PORTS',3);J5c=new O5c('LABELS',4)} +function Tbd(){Tbd=ccb;Qbd=new Ubd('DISTRIBUTED',0);Sbd=new Ubd('JUSTIFIED',1);Obd=new Ubd('BEGIN',2);Pbd=new Ubd(gle,3);Rbd=new Ubd('END',4)} +function UMd(a){var b;b=a.yi(null);switch(b){case 10:return 0;case 15:return 1;case 14:return 2;case 11:return 3;case 21:return 4;}return -1} +function cYb(a){switch(a.g){case 1:return ead(),dad;case 4:return ead(),aad;case 2:return ead(),bad;case 3:return ead(),_9c;}return ead(),cad} +function kA(a,b,c){var d;d=c.q.getFullYear()-nje+nje;d<0&&(d=-d);switch(b){case 1:a.a+=d;break;case 2:EA(a,d%100,2);break;default:EA(a,d,b);}} +function Jsb(a,b){var c,d;wCb(b,a.b);if(b>=a.b>>1){d=a.c;for(c=a.b;c>b;--c){d=d.b}}else{d=a.a.a;for(c=0;c=64&&b<128&&(e=Mbb(e,Nbb(1,b-64)))}return e} +function c_b(a,b){var c,d;d=null;if(wNb(a,(Y9c(),O9c))){c=BD(vNb(a,O9c),94);c.Xe(b)&&(d=c.We(b))}d==null&&!!Q_b(a)&&(d=vNb(Q_b(a),b));return d} +function oQc(a,b){var c,d,e;e=b.d.i;d=e.k;if(d==(j0b(),h0b)||d==d0b){return}c=new Sr(ur(U_b(e).a.Kc(),new Sq));Qr(c)&&Rhb(a.k,b,BD(Rr(c),17))} +function mid(a,b){var c,d,e;d=XKd(a.Tg(),b);c=b-a.Ah();return c<0?(e=a.Yg(d),e>=0?a.lh(e):tid(a,d)):c<0?tid(a,d):BD(d,66).Nj().Sj(a,a.yh(),c)} +function Ksd(a){var b;if(JD(a.a,4)){b=fvd(a.a);if(b==null){throw vbb(new Zdb(mse+a.b+"'. "+ise+(fdb(Y3),Y3.k)+jse))}return b}else{return a.a}} +function L9d(a){var b;if(a==null)return null;b=bde(Qge(a,true));if(b==null){throw vbb(new n8d("Invalid base64Binary value: '"+a+"'"))}return b} +function Dyd(b){var c;try{c=b.i.Xb(b.e);b.mj();b.g=b.e++;return c}catch(a){a=ubb(a);if(JD(a,73)){b.mj();throw vbb(new utb)}else throw vbb(a)}} +function Zyd(b){var c;try{c=b.c.ki(b.e);b.mj();b.g=b.e++;return c}catch(a){a=ubb(a);if(JD(a,73)){b.mj();throw vbb(new utb)}else throw vbb(a)}} +function CPb(){CPb=ccb;BPb=(Y9c(),K9c);vPb=G8c;qPb=r8c;wPb=f9c;zPb=(fFb(),bFb);yPb=_Eb;APb=dFb;xPb=$Eb;sPb=(nPb(),jPb);rPb=iPb;tPb=lPb;uPb=mPb} +function NWb(a){LWb();this.c=new Rkb;this.d=a;switch(a.g){case 0:case 2:this.a=tmb(KWb);this.b=Pje;break;case 3:case 1:this.a=KWb;this.b=Qje;}} +function ued(a,b,c){var d,e;if(a.c){dld(a.c,a.c.i+b);eld(a.c,a.c.j+c)}else{for(e=new olb(a.b);e.a0){Ekb(a.b,new WA(b.a,c));d=b.a.length;0d&&(b.a+=yfb(KC(TD,$ie,25,-d,15,1)))}} +function JKb(a,b){var c,d,e;c=a.o;for(e=BD(BD(Qc(a.r,b),21),84).Kc();e.Ob();){d=BD(e.Pb(),111);d.e.a=DKb(d,c.a);d.e.b=c.b*Edb(ED(d.b.We(BKb)))}} +function S5b(a,b){var c,d,e,f;e=a.k;c=Edb(ED(vNb(a,(wtc(),htc))));f=b.k;d=Edb(ED(vNb(b,htc)));return f!=(j0b(),e0b)?-1:e!=e0b?1:c==d?0:c=0){return a.hh(b,c,d)}else{!!a.eh()&&(d=(e=a.Vg(),e>=0?a.Qg(d):a.eh().ih(a,-1-e,null,d)));return a.Sg(b,c,d)}} +function zld(a,b){switch(b){case 7:!a.e&&(a.e=new y5d(B2,a,7,4));Uxd(a.e);return;case 8:!a.d&&(a.d=new y5d(B2,a,8,5));Uxd(a.d);return;}$kd(a,b)} +function Ut(b,c){var d;d=b.Zc(c);try{return d.Pb()}catch(a){a=ubb(a);if(JD(a,109)){throw vbb(new qcb("Can't get element "+c))}else throw vbb(a)}} +function Tgb(a,b){this.e=a;if(b=0&&(c.d=a.t);break;case 3:a.t>=0&&(c.a=a.t);}if(a.C){c.b=a.C.b;c.c=a.C.c}} +function RMb(){RMb=ccb;OMb=new SMb(xle,0);NMb=new SMb(yle,1);PMb=new SMb(zle,2);QMb=new SMb(Ale,3);OMb.a=false;NMb.a=true;PMb.a=false;QMb.a=true} +function ROb(){ROb=ccb;OOb=new SOb(xle,0);NOb=new SOb(yle,1);POb=new SOb(zle,2);QOb=new SOb(Ale,3);OOb.a=false;NOb.a=true;POb.a=false;QOb.a=true} +function dac(a){var b;b=a.a;do{b=BD(Rr(new Sr(ur(R_b(b).a.Kc(),new Sq))),17).c.i;b.k==(j0b(),g0b)&&a.b.Fc(b)}while(b.k==(j0b(),g0b));a.b=Su(a.b)} +function CDc(a){var b,c,d;d=a.c.a;a.p=(Qb(d),new Tkb(d));for(c=new olb(d);c.ac.b){return true}}}return false} +function AD(a,b){if(ND(a)){return !!zD[b]}else if(a.hm){return !!a.hm[b]}else if(LD(a)){return !!yD[b]}else if(KD(a)){return !!xD[b]}return false} +function jkd(a,b,c){c==null?(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),LAd(a.o,b)):(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),HAd(a.o,b,c));return a} +function jKb(a,b,c,d){var e,f;f=b.Xe((Y9c(),W8c))?BD(b.We(W8c),21):a.j;e=uJb(f);if(e==(qJb(),pJb)){return}if(c&&!sJb(e)){return}UHb(lKb(a,e,d),b)} +function fid(a,b,c,d){var e,f,g;f=XKd(a.Tg(),b);e=b-a.Ah();return e<0?(g=a.Yg(f),g>=0?a._g(g,c,true):sid(a,f,c)):BD(f,66).Nj().Pj(a,a.yh(),e,c,d)} +function u6d(a,b,c,d){var e,f,g;if(c.mh(b)){Q6d();if(YId(b)){e=BD(c.ah(b),153);x6d(a,e)}else{f=(g=b,!g?null:BD(d,49).xh(g));!!f&&v6d(c.ah(b),f)}}} +function H3b(a){switch(a.g){case 1:return vLb(),uLb;case 3:return vLb(),rLb;case 2:return vLb(),tLb;case 4:return vLb(),sLb;default:return null;}} +function kCb(a){switch(typeof(a)){case Mhe:return LCb(a);case Lhe:return QD(a);case Khe:return Bcb(),a?1231:1237;default:return a==null?0:FCb(a);}} +function Gic(a,b,c){if(a.e){switch(a.b){case 1:oic(a.c,b,c);break;case 0:pic(a.c,b,c);}}else{mic(a.c,b,c)}a.a[b.p][c.p]=a.c.i;a.a[c.p][b.p]=a.c.e} +function lHc(a){var b,c;if(a==null){return null}c=KC(OQ,nie,193,a.length,0,2);for(b=0;b=0)return e;if(a.Fk()){for(d=0;d=e)throw vbb(new Cyd(b,e));if(a.hi()){d=a.Xc(c);if(d>=0&&d!=b){throw vbb(new Wdb(kue))}}return a.mi(b,c)} +function gx(a,b){this.a=BD(Qb(a),245);this.b=BD(Qb(b),245);if(a.vd(b)>0||a==(Lk(),Kk)||b==(_k(),$k)){throw vbb(new Wdb('Invalid range: '+nx(a,b)))}} +function mYb(a){var b,c;this.b=new Rkb;this.c=a;this.a=false;for(c=new olb(a.a);c.a0);if((b&-b)==b){return QD(b*Cub(a,31)*4.6566128730773926E-10)}do{c=Cub(a,31);d=c%b}while(c-d+(b-1)<0);return QD(d)} +function LCb(a){JCb();var b,c,d;c=':'+a;d=ICb[c];if(d!=null){return QD((uCb(d),d))}d=GCb[c];b=d==null?KCb(a):QD((uCb(d),d));MCb();ICb[c]=b;return b} +function qZb(a,b,c){Odd(c,'Compound graph preprocessor',1);a.a=new Hp;vZb(a,b,null);pZb(a,b);uZb(a);yNb(b,(wtc(),zsc),a.a);a.a=null;Uhb(a.b);Qdd(c)} +function X$b(a,b,c){switch(c.g){case 1:a.a=b.a/2;a.b=0;break;case 2:a.a=b.a;a.b=b.b/2;break;case 3:a.a=b.a/2;a.b=b.b;break;case 4:a.a=0;a.b=b.b/2;}} +function tkc(a){var b,c,d;for(d=BD(Qc(a.a,(Xjc(),Vjc)),15).Kc();d.Ob();){c=BD(d.Pb(),101);b=Bkc(c);kkc(a,c,b[0],(Fkc(),Ckc),0);kkc(a,c,b[1],Ekc,1)}} +function ukc(a){var b,c,d;for(d=BD(Qc(a.a,(Xjc(),Wjc)),15).Kc();d.Ob();){c=BD(d.Pb(),101);b=Bkc(c);kkc(a,c,b[0],(Fkc(),Ckc),0);kkc(a,c,b[1],Ekc,1)}} +function tXc(a){switch(a.g){case 0:return null;case 1:return new $Xc;case 2:return new QXc;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function OZc(a,b,c){var d,e;FZc(a,b-a.s,c-a.t);for(e=new olb(a.n);e.a1&&(f=GFb(a,b));return f} +function dmd(a){var b;if(!!a.f&&a.f.kh()){b=BD(a.f,49);a.f=BD(xid(a,b),82);a.f!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,8,b,a.f))}return a.f} +function emd(a){var b;if(!!a.i&&a.i.kh()){b=BD(a.i,49);a.i=BD(xid(a,b),82);a.i!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,7,b,a.i))}return a.i} +function zUd(a){var b;if(!!a.b&&(a.b.Db&64)!=0){b=a.b;a.b=BD(xid(a,b),18);a.b!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,21,b,a.b))}return a.b} +function uAd(a,b){var c,d,e;if(a.d==null){++a.e;++a.f}else{d=b.Sh();BAd(a,a.f+1);e=(d&Ohe)%a.d.length;c=a.d[e];!c&&(c=a.d[e]=a.uj());c.Fc(b);++a.f}} +function m3d(a,b,c){var d;if(b.Kj()){return false}else if(b.Zj()!=-2){d=b.zj();return d==null?c==null:pb(d,c)}else return b.Hj()==a.e.Tg()&&c==null} +function wo(){var a;Xj(16,Hie);a=Kp(16);this.b=KC(GF,Gie,317,a,0,1);this.c=KC(GF,Gie,317,a,0,1);this.a=null;this.e=null;this.i=0;this.f=a-1;this.g=0} +function b0b(a){n_b.call(this);this.k=(j0b(),h0b);this.j=(Xj(6,Jie),new Skb(6));this.b=(Xj(2,Jie),new Skb(2));this.d=new L_b;this.f=new s0b;this.a=a} +function Scc(a){var b,c;if(a.c.length<=1){return}b=Pcc(a,(Ucd(),Rcd));Rcc(a,BD(b.a,19).a,BD(b.b,19).a);c=Pcc(a,Tcd);Rcc(a,BD(c.a,19).a,BD(c.b,19).a)} +function Vzc(){Vzc=ccb;Uzc=new Xzc('SIMPLE',0);Rzc=new Xzc(Tne,1);Szc=new Xzc('LINEAR_SEGMENTS',2);Qzc=new Xzc('BRANDES_KOEPF',3);Tzc=new Xzc(Aqe,4)} +function XDc(a,b,c){if(!ecd(BD(vNb(b,(Nyc(),Vxc)),98))){WDc(a,b,Y_b(b,c));WDc(a,b,Y_b(b,(Ucd(),Rcd)));WDc(a,b,Y_b(b,Acd));mmb();Okb(b.j,new jEc(a))}} +function HVc(a,b,c,d){var e,f,g;e=d?BD(Qc(a.a,b),21):BD(Qc(a.b,b),21);for(g=e.Kc();g.Ob();){f=BD(g.Pb(),33);if(BVc(a,c,f)){return true}}return false} +function FMd(a){var b,c;for(c=new Fyd(a);c.e!=c.i.gc();){b=BD(Dyd(c),87);if(!!b.e||(!b.d&&(b.d=new xMd(j5,b,1)),b.d).i!=0){return true}}return false} +function QTd(a){var b,c;for(c=new Fyd(a);c.e!=c.i.gc();){b=BD(Dyd(c),87);if(!!b.e||(!b.d&&(b.d=new xMd(j5,b,1)),b.d).i!=0){return true}}return false} +function FDc(a){var b,c,d;b=0;for(d=new olb(a.c.a);d.a102)return -1;if(a<=57)return a-48;if(a<65)return -1;if(a<=70)return a-65+10;if(a<97)return -1;return a-97+10} +function Wj(a,b){if(a==null){throw vbb(new Heb('null key in entry: null='+b))}else if(b==null){throw vbb(new Heb('null value in entry: '+a+'=null'))}} +function kr(a,b){var c,d;while(a.Ob()){if(!b.Ob()){return false}c=a.Pb();d=b.Pb();if(!(PD(c)===PD(d)||c!=null&&pb(c,d))){return false}}return !b.Ob()} +function jIb(a,b){var c;c=OC(GC(UD,1),Vje,25,15,[pHb(a.a[0],b),pHb(a.a[1],b),pHb(a.a[2],b)]);if(a.d){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0]}return c} +function kIb(a,b){var c;c=OC(GC(UD,1),Vje,25,15,[qHb(a.a[0],b),qHb(a.a[1],b),qHb(a.a[2],b)]);if(a.d){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0]}return c} +function mqc(){mqc=ccb;iqc=new oqc('GREEDY',0);hqc=new oqc(Une,1);kqc=new oqc(Tne,2);lqc=new oqc('MODEL_ORDER',3);jqc=new oqc('GREEDY_MODEL_ORDER',4)} +function iUc(a,b){var c,d,e;a.b[b.g]=1;for(d=Jsb(b.d,0);d.b!=d.d.c;){c=BD(Xsb(d),188);e=c.c;a.b[e.g]==1?Dsb(a.a,c):a.b[e.g]==2?(a.b[e.g]=1):iUc(a,e)}} +function V9b(a,b){var c,d,e;e=new Skb(b.gc());for(d=b.Kc();d.Ob();){c=BD(d.Pb(),286);c.c==c.f?K9b(a,c,c.c):L9b(a,c)||(e.c[e.c.length]=c,true)}return e} +function IZc(a,b,c){var d,e,f,g,h;h=a.r+b;a.r+=b;a.d+=c;d=c/a.n.c.length;e=0;for(g=new olb(a.n);g.af&&NC(b,f,null);return b} +function Lu(a,b){var c,d;d=a.gc();if(b==null){for(c=0;c0&&(i+=e);j[k]=g;g+=h*(i+d)}} +function Uoc(a){var b,c,d;d=a.f;a.n=KC(UD,Vje,25,d,15,1);a.d=KC(UD,Vje,25,d,15,1);for(b=0;b0?a.c:0);++e}a.b=d;a.d=f} +function BZc(a,b){var c,d,e,f,g;d=0;e=0;c=0;for(g=new olb(b);g.a0?a.g:0);++c}a.c=e;a.d=d} +function AHb(a,b){var c;c=OC(GC(UD,1),Vje,25,15,[zHb(a,(gHb(),dHb),b),zHb(a,eHb,b),zHb(a,fHb,b)]);if(a.f){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0]}return c} +function lNb(b,c,d){var e;try{aNb(b,c+b.j,d+b.k,false,true)}catch(a){a=ubb(a);if(JD(a,73)){e=a;throw vbb(new qcb(e.g+Gle+c+She+d+').'))}else throw vbb(a)}} +function mNb(b,c,d){var e;try{aNb(b,c+b.j,d+b.k,true,false)}catch(a){a=ubb(a);if(JD(a,73)){e=a;throw vbb(new qcb(e.g+Gle+c+She+d+').'))}else throw vbb(a)}} +function d5b(a){var b;if(!wNb(a,(Nyc(),xxc))){return}b=BD(vNb(a,xxc),21);if(b.Hc((Hbd(),zbd))){b.Mc(zbd);b.Fc(Bbd)}else if(b.Hc(Bbd)){b.Mc(Bbd);b.Fc(zbd)}} +function e5b(a){var b;if(!wNb(a,(Nyc(),xxc))){return}b=BD(vNb(a,xxc),21);if(b.Hc((Hbd(),Gbd))){b.Mc(Gbd);b.Fc(Ebd)}else if(b.Hc(Ebd)){b.Mc(Ebd);b.Fc(Gbd)}} +function udc(a,b,c){Odd(c,'Self-Loop ordering',1);MAb(NAb(JAb(JAb(LAb(new YAb(null,new Kub(b.b,16)),new ydc),new Adc),new Cdc),new Edc),new Gdc(a));Qdd(c)} +function ikc(a,b,c,d){var e,f;for(e=b;e0&&(e.b+=b);return e} +function GXb(a,b){var c,d,e;e=new d7c;for(d=a.Kc();d.Ob();){c=BD(d.Pb(),37);uXb(c,0,e.b);e.b+=c.f.b+b;e.a=$wnd.Math.max(e.a,c.f.a)}e.a>0&&(e.a+=b);return e} +function d_b(a){var b,c,d;d=Ohe;for(c=new olb(a.a);c.a>16==6){return a.Cb.ih(a,5,o5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?a.zh():c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Wz(a){Rz();var b=a.e;if(b&&b.stack){var c=b.stack;var d=b+'\n';c.substring(0,d.length)==d&&(c=c.substring(d.length));return c.split('\n')}return []} +function jeb(a){var b;b=(qeb(),peb);return b[a>>>28]|b[a>>24&15]<<4|b[a>>20&15]<<8|b[a>>16&15]<<12|b[a>>12&15]<<16|b[a>>8&15]<<20|b[a>>4&15]<<24|b[a&15]<<28} +function _jb(a){var b,c,d;if(a.b!=a.c){return}d=a.a.length;c=geb($wnd.Math.max(8,d))<<1;if(a.b!=0){b=_Bb(a.a,c);$jb(a,b,d);a.a=b;a.b=0}else{dCb(a.a,c)}a.c=d} +function DKb(a,b){var c;c=a.b;return c.Xe((Y9c(),s9c))?c.Hf()==(Ucd(),Tcd)?-c.rf().a-Edb(ED(c.We(s9c))):b+Edb(ED(c.We(s9c))):c.Hf()==(Ucd(),Tcd)?-c.rf().a:b} +function P_b(a){var b;if(a.b.c.length!=0&&!!BD(Ikb(a.b,0),70).a){return BD(Ikb(a.b,0),70).a}b=JZb(a);if(b!=null){return b}return ''+(!a.c?-1:Jkb(a.c.a,a,0))} +function C0b(a){var b;if(a.f.c.length!=0&&!!BD(Ikb(a.f,0),70).a){return BD(Ikb(a.f,0),70).a}b=JZb(a);if(b!=null){return b}return ''+(!a.i?-1:Jkb(a.i.j,a,0))} +function Ogc(a,b){var c,d;if(b<0||b>=a.gc()){return null}for(c=b;c0?a.c:0);e=$wnd.Math.max(e,b.d);++d}a.e=f;a.b=e} +function shd(a){var b,c;if(!a.b){a.b=Qu(BD(a.f,118).Ag().i);for(c=new Fyd(BD(a.f,118).Ag());c.e!=c.i.gc();){b=BD(Dyd(c),137);Ekb(a.b,new dhd(b))}}return a.b} +function Ctd(a,b){var c,d,e;if(b.dc()){return LCd(),LCd(),KCd}else{c=new zyd(a,b.gc());for(e=new Fyd(a);e.e!=e.i.gc();){d=Dyd(e);b.Hc(d)&&wtd(c,d)}return c}} +function bkd(a,b,c,d){if(b==0){return d?(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),a.o):(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),FAd(a.o))}return fid(a,b,c,d)} +function Tnd(a){var b,c;if(a.rb){for(b=0,c=a.rb.i;b>22);e+=d>>22;if(e<0){return false}a.l=c&Eje;a.m=d&Eje;a.h=e&Fje;return true} +function Fwb(a,b,c,d,e,f,g){var h,i;if(b.Ae()&&(i=a.a.ue(c,d),i<0||!e&&i==0)){return false}if(b.Be()&&(h=a.a.ue(c,f),h>0||!g&&h==0)){return false}return true} +function Vcc(a,b){Occ();var c;c=a.j.g-b.j.g;if(c!=0){return 0}switch(a.j.g){case 2:return Ycc(b,Ncc)-Ycc(a,Ncc);case 4:return Ycc(a,Mcc)-Ycc(b,Mcc);}return 0} +function Tqc(a){switch(a.g){case 0:return Mqc;case 1:return Nqc;case 2:return Oqc;case 3:return Pqc;case 4:return Qqc;case 5:return Rqc;default:return null;}} +function End(a,b,c){var d,e;d=(e=new rUd,yId(e,b),pnd(e,c),wtd((!a.c&&(a.c=new cUd(p5,a,12,10)),a.c),e),e);AId(d,0);DId(d,1);CId(d,true);BId(d,true);return d} +function tud(a,b){var c,d;if(b>=a.i)throw vbb(new $zd(b,a.i));++a.j;c=a.g[b];d=a.i-b-1;d>0&&$fb(a.g,b+1,a.g,b,d);NC(a.g,--a.i,null);a.fi(b,c);a.ci();return c} +function UId(a,b){var c,d;if(a.Db>>16==17){return a.Cb.ih(a,21,c5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?a.zh():c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function iDb(a){var b,c,d,e;mmb();Okb(a.c,a.a);for(e=new olb(a.c);e.ac.a.c.length)){throw vbb(new Wdb('index must be >= 0 and <= layer node count'))}!!a.c&&Lkb(a.c.a,a);a.c=c;!!c&&Dkb(c.a,b,a)} +function p7b(a,b){var c,d,e;for(d=new Sr(ur(O_b(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);e=BD(b.Kb(c),10);return new cc(Qb(e.n.b+e.o.b/2))}return wb(),wb(),vb} +function rMc(a,b){this.c=new Lqb;this.a=a;this.b=b;this.d=BD(vNb(a,(wtc(),otc)),304);PD(vNb(a,(Nyc(),yxc)))===PD((_qc(),Zqc))?(this.e=new bNc):(this.e=new WMc)} +function $dd(a,b){var c,d,e,f;f=0;for(d=new olb(a);d.a>16==6){return a.Cb.ih(a,6,B2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Lhd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Eod(a,b){var c,d;if(a.Db>>16==7){return a.Cb.ih(a,1,C2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Nhd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function lpd(a,b){var c,d;if(a.Db>>16==9){return a.Cb.ih(a,9,E2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Phd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function mQd(a,b){var c,d;if(a.Db>>16==5){return a.Cb.ih(a,9,h5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),VFd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function KHd(a,b){var c,d;if(a.Db>>16==3){return a.Cb.ih(a,0,k5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),OFd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Snd(a,b){var c,d;if(a.Db>>16==7){return a.Cb.ih(a,6,o5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),cGd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function ird(){this.a=new bqd;this.g=new wo;this.j=new wo;this.b=new Lqb;this.d=new wo;this.i=new wo;this.k=new Lqb;this.c=new Lqb;this.e=new Lqb;this.f=new Lqb} +function MCd(a,b,c){var d,e,f;c<0&&(c=0);f=a.i;for(e=c;eWje){return p6d(a,d)}if(d==a){return true}}}return false} +function HKb(a){CKb();switch(a.q.g){case 5:EKb(a,(Ucd(),Acd));EKb(a,Rcd);break;case 4:FKb(a,(Ucd(),Acd));FKb(a,Rcd);break;default:GKb(a,(Ucd(),Acd));GKb(a,Rcd);}} +function LKb(a){CKb();switch(a.q.g){case 5:IKb(a,(Ucd(),zcd));IKb(a,Tcd);break;case 4:JKb(a,(Ucd(),zcd));JKb(a,Tcd);break;default:KKb(a,(Ucd(),zcd));KKb(a,Tcd);}} +function XQb(a){var b,c;b=BD(vNb(a,(wSb(),pSb)),19);if(b){c=b.a;c==0?yNb(a,(HSb(),GSb),new Gub):yNb(a,(HSb(),GSb),new Hub(c))}else{yNb(a,(HSb(),GSb),new Hub(1))}} +function V$b(a,b){var c;c=a.i;switch(b.g){case 1:return -(a.n.b+a.o.b);case 2:return a.n.a-c.o.a;case 3:return a.n.b-c.o.b;case 4:return -(a.n.a+a.o.a);}return 0} +function hbc(a,b){switch(a.g){case 0:return b==(Ctc(),ytc)?dbc:ebc;case 1:return b==(Ctc(),ytc)?dbc:cbc;case 2:return b==(Ctc(),ytc)?cbc:ebc;default:return cbc;}} +function v$c(a,b){var c,d,e;Lkb(a.a,b);a.e-=b.r+(a.a.c.length==0?0:a.c);e=ere;for(d=new olb(a.a);d.a>16==3){return a.Cb.ih(a,12,E2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Khd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Uod(a,b){var c,d;if(a.Db>>16==11){return a.Cb.ih(a,10,E2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Ohd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function PSd(a,b){var c,d;if(a.Db>>16==10){return a.Cb.ih(a,11,c5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),aGd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function qUd(a,b){var c,d;if(a.Db>>16==10){return a.Cb.ih(a,12,n5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),dGd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function wId(a){var b;if((a.Bb&1)==0&&!!a.r&&a.r.kh()){b=BD(a.r,49);a.r=BD(xid(a,b),138);a.r!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,8,b,a.r))}return a.r} +function yHb(a,b,c){var d;d=OC(GC(UD,1),Vje,25,15,[BHb(a,(gHb(),dHb),b,c),BHb(a,eHb,b,c),BHb(a,fHb,b,c)]);if(a.f){d[0]=$wnd.Math.max(d[0],d[2]);d[2]=d[0]}return d} +function O9b(a,b){var c,d,e;e=V9b(a,b);if(e.c.length==0){return}Okb(e,new pac);c=e.c.length;for(d=0;d>19;j=b.h>>19;if(i!=j){return j-i}e=a.h;h=b.h;if(e!=h){return e-h}d=a.m;g=b.m;if(d!=g){return d-g}c=a.l;f=b.l;return c-f} +function fFb(){fFb=ccb;eFb=(rFb(),oFb);dFb=new Nsd(Yke,eFb);cFb=(UEb(),TEb);bFb=new Nsd(Zke,cFb);aFb=(MEb(),LEb);_Eb=new Nsd($ke,aFb);$Eb=new Nsd(_ke,(Bcb(),true))} +function cfc(a,b,c){var d,e;d=b*c;if(JD(a.g,145)){e=ugc(a);if(e.f.d){e.f.a||(a.d.a+=d+ple)}else{a.d.d-=d+ple;a.d.a+=d+ple}}else if(JD(a.g,10)){a.d.d-=d;a.d.a+=2*d}} +function vmc(a,b,c){var d,e,f,g,h;e=a[c.g];for(h=new olb(b.d);h.a0?a.g:0);++c}b.b=d;b.e=e} +function to(a){var b,c,d;d=a.b;if(Lp(a.i,d.length)){c=d.length*2;a.b=KC(GF,Gie,317,c,0,1);a.c=KC(GF,Gie,317,c,0,1);a.f=c-1;a.i=0;for(b=a.a;b;b=b.c){po(a,b,b)}++a.g}} +function cNb(a,b,c,d){var e,f,g,h;for(e=0;eg&&(h=g/d);e>f&&(i=f/e);Y6c(a,$wnd.Math.min(h,i));return a} +function ond(){Smd();var b,c;try{c=BD(mUd((yFd(),xFd),yte),2014);if(c){return c}}catch(a){a=ubb(a);if(JD(a,102)){b=a;uvd((h0d(),b))}else throw vbb(a)}return new knd} +function Y9d(){A9d();var b,c;try{c=BD(mUd((yFd(),xFd),Ewe),2024);if(c){return c}}catch(a){a=ubb(a);if(JD(a,102)){b=a;uvd((h0d(),b))}else throw vbb(a)}return new U9d} +function qZd(){Smd();var b,c;try{c=BD(mUd((yFd(),xFd),_ve),1941);if(c){return c}}catch(a){a=ubb(a);if(JD(a,102)){b=a;uvd((h0d(),b))}else throw vbb(a)}return new mZd} +function HQd(a,b,c){var d,e;e=a.e;a.e=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,4,e,b);!c?(c=d):c.Ei(d)}e!=b&&(b?(c=QQd(a,MQd(a,b),c)):(c=QQd(a,a.a,c)));return c} +function nB(){eB.call(this);this.e=-1;this.a=false;this.p=Rie;this.k=-1;this.c=-1;this.b=-1;this.g=false;this.f=-1;this.j=-1;this.n=-1;this.i=-1;this.d=-1;this.o=Rie} +function qEb(a,b){var c,d,e;d=a.b.d.d;a.a||(d+=a.b.d.a);e=b.b.d.d;b.a||(e+=b.b.d.a);c=Kdb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c} +function eOb(a,b){var c,d,e;d=a.b.b.d;a.a||(d+=a.b.b.a);e=b.b.b.d;b.a||(e+=b.b.b.a);c=Kdb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c} +function PVb(a,b){var c,d,e;d=a.b.g.d;a.a||(d+=a.b.g.a);e=b.b.g.d;b.a||(e+=b.b.g.a);c=Kdb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c} +function ZTb(){ZTb=ccb;WTb=c3c(e3c(e3c(e3c(new j3c,(qUb(),oUb),(S8b(),m8b)),oUb,q8b),pUb,x8b),pUb,a8b);YTb=e3c(e3c(new j3c,oUb,S7b),oUb,b8b);XTb=c3c(new j3c,pUb,d8b)} +function s3b(a){var b,c,d,e,f;b=BD(vNb(a,(wtc(),Csc)),83);f=a.n;for(d=b.Cc().Kc();d.Ob();){c=BD(d.Pb(),306);e=c.i;e.c+=f.a;e.d+=f.b;c.c?VHb(c):XHb(c)}yNb(a,Csc,null)} +function qmc(a,b,c){var d,e;e=a.b;d=e.d;switch(b.g){case 1:return -d.d-c;case 2:return e.o.a+d.c+c;case 3:return e.o.b+d.a+c;case 4:return -d.b-c;default:return -1;}} +function BXc(a){var b,c,d,e,f;d=0;e=dme;if(a.b){for(b=0;b<360;b++){c=b*0.017453292519943295;zXc(a,a.d,0,0,dre,c);f=a.b.ig(a.d);if(f0){g=(f&Ohe)%a.d.length;e=wAd(a,g,f,b);if(e){h=e.ed(c);return h}}d=a.tj(f,b,c);a.c.Fc(d);return null} +function t1d(a,b){var c,d,e,f;switch(o1d(a,b)._k()){case 3:case 2:{c=OKd(b);for(e=0,f=c.i;e=0;d--){if(dfb(a[d].d,b)||dfb(a[d].d,c)){a.length>=d+1&&a.splice(0,d+1);break}}return a} +function Abb(a,b){var c;if(Fbb(a)&&Fbb(b)){c=a/b;if(Kje0){a.b+=2;a.a+=d}}else{a.b+=1;a.a+=$wnd.Math.min(d,e)}} +function Rpd(a,b){var c,d;d=false;if(ND(b)){d=true;Qpd(a,new yC(GD(b)))}if(!d){if(JD(b,236)){d=true;Qpd(a,(c=Kcb(BD(b,236)),new TB(c)))}}if(!d){throw vbb(new vcb(Ute))}} +function IMd(a,b,c,d){var e,f,g;e=new pSd(a.e,1,10,(g=b.c,JD(g,88)?BD(g,26):(jGd(),_Fd)),(f=c.c,JD(f,88)?BD(f,26):(jGd(),_Fd)),HLd(a,b),false);!d?(d=e):d.Ei(e);return d} +function T_b(a){var b,c;switch(BD(vNb(Q_b(a),(Nyc(),ixc)),420).g){case 0:b=a.n;c=a.o;return new f7c(b.a+c.a/2,b.b+c.b/2);case 1:return new g7c(a.n);default:return null;}} +function lrc(){lrc=ccb;irc=new mrc(ane,0);hrc=new mrc('LEFTUP',1);krc=new mrc('RIGHTUP',2);grc=new mrc('LEFTDOWN',3);jrc=new mrc('RIGHTDOWN',4);frc=new mrc('BALANCED',5)} +function FFc(a,b,c){var d,e,f;d=Kdb(a.a[b.p],a.a[c.p]);if(d==0){e=BD(vNb(b,(wtc(),Qsc)),15);f=BD(vNb(c,Qsc),15);if(e.Hc(c)){return -1}else if(f.Hc(b)){return 1}}return d} +function jXc(a){switch(a.g){case 1:return new XVc;case 2:return new ZVc;case 3:return new VVc;case 0:return null;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function Ikd(a,b,c){switch(b){case 1:!a.n&&(a.n=new cUd(D2,a,1,7));Uxd(a.n);!a.n&&(a.n=new cUd(D2,a,1,7));ytd(a.n,BD(c,14));return;case 2:Lkd(a,GD(c));return;}ekd(a,b,c)} +function Zkd(a,b,c){switch(b){case 3:ald(a,Edb(ED(c)));return;case 4:cld(a,Edb(ED(c)));return;case 5:dld(a,Edb(ED(c)));return;case 6:eld(a,Edb(ED(c)));return;}Ikd(a,b,c)} +function Fnd(a,b,c){var d,e,f;f=(d=new rUd,d);e=xId(f,b,null);!!e&&e.Fi();pnd(f,c);wtd((!a.c&&(a.c=new cUd(p5,a,12,10)),a.c),f);AId(f,0);DId(f,1);CId(f,true);BId(f,true)} +function mUd(a,b){var c,d,e;c=Crb(a.g,b);if(JD(c,235)){e=BD(c,235);e.Qh()==null&&undefined;return e.Nh()}else if(JD(c,498)){d=BD(c,1938);e=d.b;return e}else{return null}} +function Ui(a,b,c,d){var e,f;Qb(b);Qb(c);f=BD(tn(a.d,b),19);Ob(!!f,'Row %s not in %s',b,a.e);e=BD(tn(a.b,c),19);Ob(!!e,'Column %s not in %s',c,a.c);return Wi(a,f.a,e.a,d)} +function JC(a,b,c,d,e,f,g){var h,i,j,k,l;k=e[f];j=f==g-1;h=j?d:0;l=LC(h,k);d!=10&&OC(GC(a,g-f),b[f],c[f],h,l);if(!j){++f;for(i=0;i1||h==-1){f=BD(i,15);e.Wb(t6d(a,f))}else{e.Wb(s6d(a,BD(i,56)))}}}} +function Zbb(b,c,d,e){Ybb();var f=Wbb;$moduleName=c;$moduleBase=d;tbb=e;function g(){for(var a=0;aOqe){return c}else e>-1.0E-6&&++c}return c} +function PQd(a,b){var c;if(b!=a.b){c=null;!!a.b&&(c=lid(a.b,a,-4,c));!!b&&(c=kid(b,a,-4,c));c=GQd(a,b,c);!!c&&c.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,b,b))} +function SQd(a,b){var c;if(b!=a.f){c=null;!!a.f&&(c=lid(a.f,a,-1,c));!!b&&(c=kid(b,a,-1,c));c=IQd(a,b,c);!!c&&c.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,0,b,b))} +function E9d(a){var b,c,d;if(a==null)return null;c=BD(a,15);if(c.dc())return '';d=new Hfb;for(b=c.Kc();b.Ob();){Efb(d,(Q8d(),GD(b.Pb())));d.a+=' '}return lcb(d,d.a.length-1)} +function I9d(a){var b,c,d;if(a==null)return null;c=BD(a,15);if(c.dc())return '';d=new Hfb;for(b=c.Kc();b.Ob();){Efb(d,(Q8d(),GD(b.Pb())));d.a+=' '}return lcb(d,d.a.length-1)} +function qEc(a,b,c){var d,e;d=a.c[b.c.p][b.p];e=a.c[c.c.p][c.p];if(d.a!=null&&e.a!=null){return Ddb(d.a,e.a)}else if(d.a!=null){return -1}else if(e.a!=null){return 1}return 0} +function zqd(a,b){var c,d,e,f,g,h;if(b){f=b.a.length;c=new Yge(f);for(h=(c.b-c.a)*c.c<0?(Xge(),Wge):new she(c);h.Ob();){g=BD(h.Pb(),19);e=Zpd(b,g.a);d=new Crd(a);Aqd(d.a,e)}}} +function Qqd(a,b){var c,d,e,f,g,h;if(b){f=b.a.length;c=new Yge(f);for(h=(c.b-c.a)*c.c<0?(Xge(),Wge):new she(c);h.Ob();){g=BD(h.Pb(),19);e=Zpd(b,g.a);d=new lrd(a);nqd(d.a,e)}}} +function eFd(b){var c;if(b!=null&&b.length>0&&bfb(b,b.length-1)==33){try{c=PEd(qfb(b,0,b.length-1));return c.e==null}catch(a){a=ubb(a);if(!JD(a,32))throw vbb(a)}}return false} +function h3d(a,b,c){var d,e,f;d=b.ak();f=b.dd();e=d.$j()?H2d(a,3,d,null,f,M2d(a,d,f,JD(d,99)&&(BD(d,18).Bb&Tje)!=0),true):H2d(a,1,d,d.zj(),f,-1,true);c?c.Ei(e):(c=e);return c} +function Vee(){var a,b,c;b=0;for(a=0;a<'X'.length;a++){c=Uee((BCb(a,'X'.length),'X'.charCodeAt(a)));if(c==0)throw vbb(new mde('Unknown Option: '+'X'.substr(a)));b|=c}return b} +function mZb(a,b,c){var d,e,f;d=Q_b(b);e=a_b(d);f=new H0b;F0b(f,b);switch(c.g){case 1:G0b(f,Wcd(Zcd(e)));break;case 2:G0b(f,Zcd(e));}yNb(f,(Nyc(),Uxc),ED(vNb(a,Uxc)));return f} +function U9b(a){var b,c;b=BD(Rr(new Sr(ur(R_b(a.a).a.Kc(),new Sq))),17);c=BD(Rr(new Sr(ur(U_b(a.a).a.Kc(),new Sq))),17);return Ccb(DD(vNb(b,(wtc(),ltc))))||Ccb(DD(vNb(c,ltc)))} +function Xjc(){Xjc=ccb;Tjc=new Yjc('ONE_SIDE',0);Vjc=new Yjc('TWO_SIDES_CORNER',1);Wjc=new Yjc('TWO_SIDES_OPPOSING',2);Ujc=new Yjc('THREE_SIDES',3);Sjc=new Yjc('FOUR_SIDES',4)} +function jkc(a,b,c,d,e){var f,g;f=BD(GAb(JAb(b.Oc(),new _kc),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);g=BD(Si(a.b,c,d),15);e==0?g.Wc(0,f):g.Gc(f)} +function KDc(a,b){var c,d,e,f,g;for(f=new olb(b.a);f.a0&&ric(this,this.c-1,(Ucd(),zcd));this.c0&&a[0].length>0&&(this.c=Ccb(DD(vNb(Q_b(a[0][0]),(wtc(),Rsc)))));this.a=KC(CX,nie,2018,a.length,0,2);this.b=KC(FX,nie,2019,a.length,0,2);this.d=new ss} +function tKc(a){if(a.c.length==0){return false}if((tCb(0,a.c.length),BD(a.c[0],17)).c.i.k==(j0b(),g0b)){return true}return FAb(NAb(new YAb(null,new Kub(a,16)),new wKc),new yKc)} +function rRc(a,b,c){Odd(c,'Tree layout',1);H2c(a.b);K2c(a.b,(yRc(),uRc),uRc);K2c(a.b,vRc,vRc);K2c(a.b,wRc,wRc);K2c(a.b,xRc,xRc);a.a=F2c(a.b,b);sRc(a,b,Udd(c,1));Qdd(c);return b} +function HXc(a,b){var c,d,e,f,g,h,i;h=gVc(b);f=b.f;i=b.g;g=$wnd.Math.sqrt(f*f+i*i);e=0;for(d=new olb(h);d.a=0){c=Abb(a,Jje);d=Hbb(a,Jje)}else{b=Pbb(a,1);c=Abb(b,500000000);d=Hbb(b,500000000);d=wbb(Nbb(d,1),xbb(a,1))}return Mbb(Nbb(d,32),xbb(c,Yje))} +function oQb(a,b,c){var d,e;d=(sCb(b.b!=0),BD(Nsb(b,b.a.a),8));switch(c.g){case 0:d.b=0;break;case 2:d.b=a.f;break;case 3:d.a=0;break;default:d.a=a.g;}e=Jsb(b,0);Vsb(e,d);return b} +function pmc(a,b,c,d){var e,f,g,h,i;i=a.b;f=b.d;g=f.j;h=umc(g,i.d[g.g],c);e=P6c(R6c(f.n),f.a);switch(f.j.g){case 1:case 3:h.a+=e.a;break;case 2:case 4:h.b+=e.b;}Gsb(d,h,d.c.b,d.c)} +function yJc(a,b,c){var d,e,f,g;g=Jkb(a.e,b,0);f=new zJc;f.b=c;d=new Bib(a.e,g);while(d.b1;b>>=1){(b&1)!=0&&(d=Ogb(d,c));c.d==1?(c=Ogb(c,c)):(c=new Xgb(Lhb(c.a,c.d,KC(WD,oje,25,c.d<<1,15,1))))}d=Ogb(d,c);return d} +function zub(){zub=ccb;var a,b,c,d;wub=KC(UD,Vje,25,25,15,1);xub=KC(UD,Vje,25,33,15,1);d=1.52587890625E-5;for(b=32;b>=0;b--){xub[b]=d;d*=0.5}c=1;for(a=24;a>=0;a--){wub[a]=c;c*=0.5}} +function S1b(a){var b,c;if(Ccb(DD(hkd(a,(Nyc(),fxc))))){for(c=new Sr(ur(_sd(a).a.Kc(),new Sq));Qr(c);){b=BD(Rr(c),79);if(Qld(b)){if(Ccb(DD(hkd(b,gxc)))){return true}}}}return false} +function kjc(a,b){var c,d,e;if(Qqb(a.f,b)){b.b=a;d=b.c;Jkb(a.j,d,0)!=-1||Ekb(a.j,d);e=b.d;Jkb(a.j,e,0)!=-1||Ekb(a.j,e);c=b.a.b;if(c.c.length!=0){!a.i&&(a.i=new vjc(a));qjc(a.i,c)}}} +function rmc(a){var b,c,d,e,f;c=a.c.d;d=c.j;e=a.d.d;f=e.j;if(d==f){return c.p=0&&dfb(a.substr(b,'GMT'.length),'GMT')){c[0]=b+3;return tA(a,c,d)}if(b>=0&&dfb(a.substr(b,'UTC'.length),'UTC')){c[0]=b+3;return tA(a,c,d)}return tA(a,c,d)} +function tjc(a,b){var c,d,e,f,g;f=a.g.a;g=a.g.b;for(d=new olb(a.d);d.ac;f--){a[f]|=b[f-c-1]>>>g;a[f-1]=b[f-c-1]<=a.f){break}f.c[f.c.length]=c}return f} +function sfd(a){var b,c,d,e;b=null;for(e=new olb(a.wf());e.a0&&$fb(a.g,b,a.g,b+d,h);g=c.Kc();a.i+=d;for(e=0;ef&&nfb(j,sfb(c[h],ltb))){e=h;f=i}}e>=0&&(d[0]=b+f);return e} +function MIb(a,b){var c;c=NIb(a.b.Hf(),b.b.Hf());if(c!=0){return c}switch(a.b.Hf().g){case 1:case 2:return beb(a.b.sf(),b.b.sf());case 3:case 4:return beb(b.b.sf(),a.b.sf());}return 0} +function iRb(a){var b,c,d;d=a.e.c.length;a.a=IC(WD,[nie,oje],[48,25],15,[d,d],2);for(c=new olb(a.c);c.a>4&15;f=a[d]&15;g[e++]=Qmd[c];g[e++]=Qmd[f]}return zfb(g,0,g.length)}} +function j3d(a,b,c){var d,e,f;d=b.ak();f=b.dd();e=d.$j()?H2d(a,4,d,f,null,M2d(a,d,f,JD(d,99)&&(BD(d,18).Bb&Tje)!=0),true):H2d(a,d.Kj()?2:1,d,f,d.zj(),-1,true);c?c.Ei(e):(c=e);return c} +function wfb(a){var b,c;if(a>=Tje){b=Uje+(a-Tje>>10&1023)&aje;c=56320+(a-Tje&1023)&aje;return String.fromCharCode(b)+(''+String.fromCharCode(c))}else{return String.fromCharCode(a&aje)}} +function bKb(a,b){$Jb();var c,d,e,f;e=BD(BD(Qc(a.r,b),21),84);if(e.gc()>=2){d=BD(e.Kc().Pb(),111);c=a.u.Hc((rcd(),mcd));f=a.u.Hc(qcd);return !d.a&&!c&&(e.gc()==2||f)}else{return false}} +function IVc(a,b,c,d,e){var f,g,h;f=JVc(a,b,c,d,e);h=false;while(!f){AVc(a,e,true);h=true;f=JVc(a,b,c,d,e)}h&&AVc(a,e,false);g=dVc(e);if(g.c.length!=0){!!a.d&&a.d.lg(g);IVc(a,e,c,d,g)}} +function Mad(){Mad=ccb;Kad=new Nad(ane,0);Iad=new Nad('DIRECTED',1);Lad=new Nad('UNDIRECTED',2);Gad=new Nad('ASSOCIATION',3);Jad=new Nad('GENERALIZATION',4);Had=new Nad('DEPENDENCY',5)} +function kfd(a,b){var c;if(!mpd(a)){throw vbb(new Zdb(Sse))}c=mpd(a);switch(b.g){case 1:return -(a.j+a.f);case 2:return a.i-c.g;case 3:return a.j-c.f;case 4:return -(a.i+a.g);}return 0} +function cub(a,b){var c,d;uCb(b);d=a.b.c.length;Ekb(a.b,b);while(d>0){c=d;d=(d-1)/2|0;if(a.a.ue(Ikb(a.b,d),b)<=0){Nkb(a.b,c,b);return true}Nkb(a.b,c,Ikb(a.b,d))}Nkb(a.b,d,b);return true} +function BHb(a,b,c,d){var e,f;e=0;if(!c){for(f=0;f=h} +function Tpd(a,b,c,d){var e;e=false;if(ND(d)){e=true;Upd(b,c,GD(d))}if(!e){if(KD(d)){e=true;Tpd(a,b,c,d)}}if(!e){if(JD(d,236)){e=true;Spd(b,c,BD(d,236))}}if(!e){throw vbb(new vcb(Ute))}} +function W0d(a,b){var c,d,e;c=b.Hh(a.a);if(c){e=AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),Sve);if(e!=null){for(d=1;d<(O6d(),K6d).length;++d){if(dfb(K6d[d],e)){return d}}}}return 0} +function X0d(a,b){var c,d,e;c=b.Hh(a.a);if(c){e=AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),Sve);if(e!=null){for(d=1;d<(O6d(),L6d).length;++d){if(dfb(L6d[d],e)){return d}}}}return 0} +function Ve(a,b){var c,d,e,f;uCb(b);f=a.a.gc();if(f0?1:0;while(f.a[e]!=c){f=f.a[e];e=a.a.ue(c.d,f.d)>0?1:0}f.a[e]=d;d.b=c.b;d.a[0]=c.a[0];d.a[1]=c.a[1];c.a[0]=null;c.a[1]=null} +function ucd(a){rcd();var b,c;b=qqb(ncd,OC(GC(E1,1),Kie,273,0,[pcd]));if(Ox(Cx(b,a))>1){return false}c=qqb(mcd,OC(GC(E1,1),Kie,273,0,[lcd,qcd]));if(Ox(Cx(c,a))>1){return false}return true} +function fod(a,b){var c;c=Phb((yFd(),xFd),a);JD(c,498)?Shb(xFd,a,new bUd(this,b)):Shb(xFd,a,this);bod(this,b);if(b==(LFd(),KFd)){this.wb=BD(this,1939);BD(b,1941)}else{this.wb=(NFd(),MFd)}} +function lZd(b){var c,d,e;if(b==null){return null}c=null;for(d=0;d=_ie?'error':d>=900?'warn':d>=800?'info':'log');gCb(c,a.a);!!a.b&&hCb(b,c,a.b,'Exception: ',true)} +function vNb(a,b){var c,d;d=(!a.q&&(a.q=new Lqb),Ohb(a.q,b));if(d!=null){return d}c=b.wg();JD(c,4)&&(c==null?(!a.q&&(a.q=new Lqb),Thb(a.q,b)):(!a.q&&(a.q=new Lqb),Rhb(a.q,b,c)),a);return c} +function qUb(){qUb=ccb;lUb=new rUb('P1_CYCLE_BREAKING',0);mUb=new rUb('P2_LAYERING',1);nUb=new rUb('P3_NODE_ORDERING',2);oUb=new rUb('P4_NODE_PLACEMENT',3);pUb=new rUb('P5_EDGE_ROUTING',4)} +function SUb(a,b){var c,d,e,f,g;e=b==1?KUb:JUb;for(d=e.a.ec().Kc();d.Ob();){c=BD(d.Pb(),103);for(g=BD(Qc(a.f.c,c),21).Kc();g.Ob();){f=BD(g.Pb(),46);Lkb(a.b.b,f.b);Lkb(a.b.a,BD(f.b,81).d)}}} +function IWb(a,b){AWb();var c;if(a.c==b.c){if(a.b==b.b||pWb(a.b,b.b)){c=mWb(a.b)?1:-1;if(a.a&&!b.a){return c}else if(!a.a&&b.a){return -c}}return beb(a.b.g,b.b.g)}else{return Kdb(a.c,b.c)}} +function y6b(a,b){var c;Odd(b,'Hierarchical port position processing',1);c=a.b;c.c.length>0&&x6b((tCb(0,c.c.length),BD(c.c[0],29)),a);c.c.length>1&&x6b(BD(Ikb(c,c.c.length-1),29),a);Qdd(b)} +function RVc(a,b){var c,d,e;if(CVc(a,b)){return true}for(d=new olb(b);d.a=e||b<0)throw vbb(new qcb(lue+b+mue+e));if(c>=e||c<0)throw vbb(new qcb(nue+c+mue+e));b!=c?(d=(f=a.Ti(c),a.Hi(b,f),f)):(d=a.Oi(c));return d} +function m6d(a){var b,c,d;d=a;if(a){b=0;for(c=a.Ug();c;c=c.Ug()){if(++b>Wje){return m6d(c)}d=c;if(c==a){throw vbb(new Zdb('There is a cycle in the containment hierarchy of '+a))}}}return d} +function Fe(a){var b,c,d;d=new xwb(She,'[',']');for(c=a.Kc();c.Ob();){b=c.Pb();uwb(d,PD(b)===PD(a)?'(this Collection)':b==null?Xhe:fcb(b))}return !d.a?d.c:d.e.length==0?d.a.a:d.a.a+(''+d.e)} +function CVc(a,b){var c,d;d=false;if(b.gc()<2){return false}for(c=0;cd&&(BCb(b-1,a.length),a.charCodeAt(b-1)<=32)){--b}return d>0||b1&&(a.j.b+=a.e)}else{a.j.a+=c.a;a.j.b=$wnd.Math.max(a.j.b,c.b);a.d.c.length>1&&(a.j.a+=a.e)}} +function gkc(){gkc=ccb;dkc=OC(GC(F1,1),bne,61,0,[(Ucd(),Acd),zcd,Rcd]);ckc=OC(GC(F1,1),bne,61,0,[zcd,Rcd,Tcd]);ekc=OC(GC(F1,1),bne,61,0,[Rcd,Tcd,Acd]);fkc=OC(GC(F1,1),bne,61,0,[Tcd,Acd,zcd])} +function omc(a,b,c,d){var e,f,g,h,i,j,k;g=a.c.d;h=a.d.d;if(g.j==h.j){return}k=a.b;e=g.j;i=null;while(e!=h.j){i=b==0?Xcd(e):Vcd(e);f=umc(e,k.d[e.g],c);j=umc(i,k.d[i.g],c);Dsb(d,P6c(f,j));e=i}} +function oFc(a,b,c,d){var e,f,g,h,i;g=JHc(a.a,b,c);h=BD(g.a,19).a;f=BD(g.b,19).a;if(d){i=BD(vNb(b,(wtc(),gtc)),10);e=BD(vNb(c,gtc),10);if(!!i&&!!e){mic(a.b,i,e);h+=a.b.i;f+=a.b.e}}return h>f} +function oHc(a){var b,c,d,e,f,g,h,i,j;this.a=lHc(a);this.b=new Rkb;for(c=a,d=0,e=c.length;dwic(a.d).c){a.i+=a.g.c;yic(a.d)}else if(wic(a.d).c>wic(a.g).c){a.e+=a.d.c;yic(a.g)}else{a.i+=vic(a.g);a.e+=vic(a.d);yic(a.g);yic(a.d)}}} +function XOc(a,b,c){var d,e,f,g;f=b.q;g=b.r;new DOc((HOc(),FOc),b,f,1);new DOc(FOc,f,g,1);for(e=new olb(c);e.ah&&(i=h/d);e>f&&(j=f/e);g=$wnd.Math.min(i,j);a.a+=g*(b.a-a.a);a.b+=g*(b.b-a.b)} +function sZc(a,b,c,d,e){var f,g;g=false;f=BD(Ikb(c.b,0),33);while(yZc(a,b,f,d,e)){g=true;NZc(c,f);if(c.b.c.length==0){break}f=BD(Ikb(c.b,0),33)}c.b.c.length==0&&v$c(c.j,c);g&&a$c(b.q);return g} +function t6c(a,b){i6c();var c,d,e,f;if(b.b<2){return false}f=Jsb(b,0);c=BD(Xsb(f),8);d=c;while(f.b!=f.d.c){e=BD(Xsb(f),8);if(s6c(a,d,e)){return true}d=e}if(s6c(a,d,c)){return true}return false} +function ckd(a,b,c,d){var e,f;if(c==0){return !a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),bId(a.o,b,d)}return f=BD(XKd((e=BD(Ajd(a,16),26),!e?a.zh():e),c),66),f.Nj().Rj(a,yjd(a),c-aLd(a.zh()),b,d)} +function bod(a,b){var c;if(b!=a.sb){c=null;!!a.sb&&(c=BD(a.sb,49).ih(a,1,i5,c));!!b&&(c=BD(b,49).gh(a,1,i5,c));c=Jnd(a,b,c);!!c&&c.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,4,b,b))} +function yqd(a,b){var c,d,e,f;if(b){e=Xpd(b,'x');c=new zrd(a);hmd(c.a,(uCb(e),e));f=Xpd(b,'y');d=new Ard(a);imd(d.a,(uCb(f),f))}else{throw vbb(new cqd('All edge sections need an end point.'))}} +function wqd(a,b){var c,d,e,f;if(b){e=Xpd(b,'x');c=new wrd(a);omd(c.a,(uCb(e),e));f=Xpd(b,'y');d=new xrd(a);pmd(d.a,(uCb(f),f))}else{throw vbb(new cqd('All edge sections need a start point.'))}} +function pyb(a,b){var c,d,e,f,g,h,i;for(d=syb(a),f=0,h=d.length;f>22-b;e=a.h<>22-b}else if(b<44){c=0;d=a.l<>44-b}else{c=0;d=0;e=a.l<a){throw vbb(new Wdb('k must be smaller than n'))}else return b==0||b==a?1:a==0?0:q6c(a)/(q6c(b)*q6c(a-b))} +function jfd(a,b){var c,d,e,f;c=new _ud(a);while(c.g==null&&!c.c?Uud(c):c.g==null||c.i!=0&&BD(c.g[c.i-1],47).Ob()){f=BD(Vud(c),56);if(JD(f,160)){d=BD(f,160);for(e=0;e>4];b[c*2+1]=gde[f&15]}return zfb(b,0,b.length)} +function fn(a){Vm();var b,c,d;d=a.c.length;switch(d){case 0:return Um;case 1:b=BD(qr(new olb(a)),42);return ln(b.cd(),b.dd());default:c=BD(Qkb(a,KC(CK,zie,42,a.c.length,0,1)),165);return new wx(c);}} +function ITb(a){var b,c,d,e,f,g;b=new jkb;c=new jkb;Wjb(b,a);Wjb(c,a);while(c.b!=c.c){e=BD(fkb(c),37);for(g=new olb(e.a);g.a0&&WGc(a,c,b);return e}return TGc(a,b,c)} +function MSc(a,b,c){var d,e,f,g;if(b.b!=0){d=new Psb;for(g=Jsb(b,0);g.b!=g.d.c;){f=BD(Xsb(g),86);ye(d,URc(f));e=f.e;e.a=BD(vNb(f,(mTc(),kTc)),19).a;e.b=BD(vNb(f,lTc),19).a}MSc(a,d,Udd(c,d.b/a.a|0))}} +function JZc(a,b){var c,d,e,f,g;if(a.e<=b){return a.g}if(LZc(a,a.g,b)){return a.g}f=a.r;d=a.g;g=a.r;e=(f-d)/2+d;while(d+11&&(a.e.b+=a.a)}else{a.e.a+=c.a;a.e.b=$wnd.Math.max(a.e.b,c.b);a.d.c.length>1&&(a.e.a+=a.a)}} +function cmc(a){var b,c,d,e;e=a.i;b=e.b;d=e.j;c=e.g;switch(e.a.g){case 0:c.a=(a.g.b.o.a-d.a)/2;break;case 1:c.a=b.d.n.a+b.d.a.a;break;case 2:c.a=b.d.n.a+b.d.a.a-d.a;break;case 3:c.b=b.d.n.b+b.d.a.b;}} +function Q6c(a,b,c,d,e){if(dd&&(a.a=d);a.be&&(a.b=e);return a} +function lsd(a){if(JD(a,149)){return esd(BD(a,149))}else if(JD(a,229)){return fsd(BD(a,229))}else if(JD(a,23)){return gsd(BD(a,23))}else{throw vbb(new Wdb(Xte+Fe(new amb(OC(GC(SI,1),Uhe,1,5,[a])))))}} +function mhb(a,b,c,d,e){var f,g,h;f=true;for(g=0;g>>e|c[g+d+1]<>>e;++g}return f} +function zMc(a,b,c,d){var e,f,g;if(b.k==(j0b(),g0b)){for(f=new Sr(ur(R_b(b).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);g=e.c.i.k;if(g==g0b&&a.c.a[e.c.i.c.p]==d&&a.c.a[b.c.p]==c){return true}}}return false} +function mD(a,b){var c,d,e,f;b&=63;c=a.h&Fje;if(b<22){f=c>>>b;e=a.m>>b|c<<22-b;d=a.l>>b|a.m<<22-b}else if(b<44){f=0;e=c>>>b-22;d=a.m>>b-22|a.h<<44-b}else{f=0;e=0;d=c>>>b-44}return TC(d&Eje,e&Eje,f&Fje)} +function Iic(a,b,c,d){var e;this.b=d;this.e=a==(rGc(),pGc);e=b[c];this.d=IC(sbb,[nie,dle],[177,25],16,[e.length,e.length],2);this.a=IC(WD,[nie,oje],[48,25],15,[e.length,e.length],2);this.c=new sic(b,c)} +function ljc(a){var b,c,d;a.k=new Ki((Ucd(),OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])).length,a.j.c.length);for(d=new olb(a.j);d.a=c){K9b(a,b,d.p);return true}}return false} +function Iod(a){var b;if((a.Db&64)!=0)return fld(a);b=new Wfb(dte);!a.a||Qfb(Qfb((b.a+=' "',b),a.a),'"');Qfb(Lfb(Qfb(Lfb(Qfb(Lfb(Qfb(Lfb((b.a+=' (',b),a.i),','),a.j),' | '),a.g),','),a.f),')');return b.a} +function Z2d(a,b,c){var d,e,f,g,h;h=S6d(a.e.Tg(),b);e=BD(a.g,119);d=0;for(g=0;gc){return Jb(a,c,'start index')}if(b<0||b>c){return Jb(b,c,'end index')}return hc('end index (%s) must not be less than start index (%s)',OC(GC(SI,1),Uhe,1,5,[meb(b),meb(a)]))} +function Pz(b,c){var d,e,f,g;for(e=0,f=b.length;e0&&iCc(a,f,c))}}b.p=0} +function p5c(a){var b;this.c=new Psb;this.f=a.e;this.e=a.d;this.i=a.g;this.d=a.c;this.b=a.b;this.k=a.j;this.a=a.a;!a.i?(this.j=(b=BD(gdb(e1),9),new xqb(b,BD(_Bb(b,b.length),9),0))):(this.j=a.i);this.g=a.f} +function Wb(a){var b,c,d,e;b=Kfb(Qfb(new Wfb('Predicates.'),'and'),40);c=true;for(e=new vib(a);e.b0?h[g-1]:KC(OQ,kne,10,0,0,1);e=h[g];j=g=0?a.Bh(e):vid(a,d)}else{throw vbb(new Wdb(ite+d.ne()+jte))}}else{eid(a,c,d)}} +function aqd(a){var b,c;c=null;b=false;if(JD(a,204)){b=true;c=BD(a,204).a}if(!b){if(JD(a,258)){b=true;c=''+BD(a,258).a}}if(!b){if(JD(a,483)){b=true;c=''+BD(a,483).a}}if(!b){throw vbb(new vcb(Ute))}return c} +function ORd(a,b){var c,d;if(a.f){while(b.Ob()){c=BD(b.Pb(),72);d=c.ak();if(JD(d,99)&&(BD(d,18).Bb&ote)!=0&&(!a.e||d.Gj()!=x2||d.aj()!=0)&&c.dd()!=null){b.Ub();return true}}return false}else{return b.Ob()}} +function QRd(a,b){var c,d;if(a.f){while(b.Sb()){c=BD(b.Ub(),72);d=c.ak();if(JD(d,99)&&(BD(d,18).Bb&ote)!=0&&(!a.e||d.Gj()!=x2||d.aj()!=0)&&c.dd()!=null){b.Pb();return true}}return false}else{return b.Sb()}} +function I2d(a,b,c){var d,e,f,g,h,i;i=S6d(a.e.Tg(),b);d=0;h=a.i;e=BD(a.g,119);for(g=0;g1&&(b.c[b.c.length]=f,true)}} +function TJc(a){var b,c,d,e;c=new Psb;ye(c,a.o);d=new twb;while(c.b!=0){b=BD(c.b==0?null:(sCb(c.b!=0),Nsb(c,c.a.a)),508);e=KJc(a,b,true);e&&Ekb(d.a,b)}while(d.a.c.length!=0){b=BD(rwb(d),508);KJc(a,b,false)}} +function _5c(){_5c=ccb;$5c=new a6c(ole,0);T5c=new a6c('BOOLEAN',1);X5c=new a6c('INT',2);Z5c=new a6c('STRING',3);U5c=new a6c('DOUBLE',4);V5c=new a6c('ENUM',5);W5c=new a6c('ENUMSET',6);Y5c=new a6c('OBJECT',7)} +function H6c(a,b){var c,d,e,f,g;d=$wnd.Math.min(a.c,b.c);f=$wnd.Math.min(a.d,b.d);e=$wnd.Math.max(a.c+a.b,b.c+b.b);g=$wnd.Math.max(a.d+a.a,b.d+b.a);if(e=(e/2|0)){this.e=!d?null:d.c;this.d=e;while(c++0){uu(this)}}this.b=b;this.a=null} +function rEb(a,b){var c,d;b.a?sEb(a,b):(c=BD(Exb(a.b,b.b),57),!!c&&c==a.a[b.b.f]&&!!c.a&&c.a!=b.b.a&&c.c.Fc(b.b),d=BD(Dxb(a.b,b.b),57),!!d&&a.a[d.f]==b.b&&!!d.a&&d.a!=b.b.a&&b.b.c.Fc(d),Fxb(a.b,b.b),undefined)} +function FJb(a,b){var c,d;c=BD(Mpb(a.b,b),124);if(BD(BD(Qc(a.r,b),21),84).dc()){c.n.b=0;c.n.c=0;return}c.n.b=a.C.b;c.n.c=a.C.c;a.A.Hc((tdd(),sdd))&&KJb(a,b);d=JJb(a,b);KIb(a,b)==(Tbd(),Qbd)&&(d+=2*a.w);c.a.a=d} +function OKb(a,b){var c,d;c=BD(Mpb(a.b,b),124);if(BD(BD(Qc(a.r,b),21),84).dc()){c.n.d=0;c.n.a=0;return}c.n.d=a.C.d;c.n.a=a.C.a;a.A.Hc((tdd(),sdd))&&SKb(a,b);d=RKb(a,b);KIb(a,b)==(Tbd(),Qbd)&&(d+=2*a.w);c.a.b=d} +function cOb(a,b){var c,d,e,f;f=new Rkb;for(d=new olb(b);d.ac.a&&(d.Hc((i8c(),c8c))?(e=(b.a-c.a)/2):d.Hc(e8c)&&(e=b.a-c.a));b.b>c.b&&(d.Hc((i8c(),g8c))?(f=(b.b-c.b)/2):d.Hc(f8c)&&(f=b.b-c.b));Efd(a,e,f)} +function aod(a,b,c,d,e,f,g,h,i,j,k,l,m){JD(a.Cb,88)&&XMd($Kd(BD(a.Cb,88)),4);pnd(a,c);a.f=g;dJd(a,h);fJd(a,i);ZId(a,j);eJd(a,k);CId(a,l);aJd(a,m);BId(a,true);AId(a,e);a.ok(f);yId(a,b);d!=null&&(a.i=null,_Id(a,d))} +function PRd(a){var b,c;if(a.f){while(a.n>0){b=BD(a.k.Xb(a.n-1),72);c=b.ak();if(JD(c,99)&&(BD(c,18).Bb&ote)!=0&&(!a.e||c.Gj()!=x2||c.aj()!=0)&&b.dd()!=null){return true}else{--a.n}}return false}else{return a.n>0}} +function Jb(a,b,c){if(a<0){return hc(The,OC(GC(SI,1),Uhe,1,5,[c,meb(a)]))}else if(b<0){throw vbb(new Wdb(Vhe+b))}else{return hc('%s (%s) must not be greater than size (%s)',OC(GC(SI,1),Uhe,1,5,[c,meb(a),meb(b)]))}} +function Llb(a,b,c,d,e,f){var g,h,i,j;g=d-c;if(g<7){Ilb(b,c,d,f);return}i=c+e;h=d+e;j=i+(h-i>>1);Llb(b,a,i,j,-e,f);Llb(b,a,j,h,-e,f);if(f.ue(a[j-1],a[j])<=0){while(c=0?a.sh(f,c):uid(a,e,c)}else{throw vbb(new Wdb(ite+e.ne()+jte))}}else{did(a,d,e,c)}} +function q6d(b){var c,d,e,f;d=BD(b,49).qh();if(d){try{e=null;c=nUd((yFd(),xFd),LEd(MEd(d)));if(c){f=c.rh();!!f&&(e=f.Wk(tfb(d.e)))}if(!!e&&e!=b){return q6d(e)}}catch(a){a=ubb(a);if(!JD(a,60))throw vbb(a)}}return b} +function jrb(a,b,c){var d,e,f,g;g=b==null?0:a.b.se(b);e=(d=a.a.get(g),d==null?new Array:d);if(e.length==0){a.a.set(g,e)}else{f=grb(a,b,e);if(f){return f.ed(c)}}NC(e,e.length,new pjb(b,c));++a.c;zpb(a.b);return null} +function YUc(a,b){var c,d;H2c(a.a);K2c(a.a,(PUc(),NUc),NUc);K2c(a.a,OUc,OUc);d=new j3c;e3c(d,OUc,(tVc(),sVc));PD(hkd(b,(ZWc(),LWc)))!==PD((pWc(),mWc))&&e3c(d,OUc,qVc);e3c(d,OUc,rVc);E2c(a.a,d);c=F2c(a.a,b);return c} +function uC(a){if(!a){return OB(),NB}var b=a.valueOf?a.valueOf():a;if(b!==a){var c=qC[typeof b];return c?c(b):xC(typeof b)}else if(a instanceof Array||a instanceof $wnd.Array){return new xB(a)}else{return new fC(a)}} +function RJb(a,b,c){var d,e,f;f=a.o;d=BD(Mpb(a.p,c),244);e=d.i;e.b=gIb(d);e.a=fIb(d);e.b=$wnd.Math.max(e.b,f.a);e.b>f.a&&!b&&(e.b=f.a);e.c=-(e.b-f.a)/2;switch(c.g){case 1:e.d=-e.a;break;case 3:e.d=f.b;}hIb(d);iIb(d)} +function SJb(a,b,c){var d,e,f;f=a.o;d=BD(Mpb(a.p,c),244);e=d.i;e.b=gIb(d);e.a=fIb(d);e.a=$wnd.Math.max(e.a,f.b);e.a>f.b&&!b&&(e.a=f.b);e.d=-(e.a-f.b)/2;switch(c.g){case 4:e.c=-e.b;break;case 2:e.c=f.a;}hIb(d);iIb(d)} +function Jgc(a,b){var c,d,e,f,g;if(b.dc()){return}e=BD(b.Xb(0),128);if(b.gc()==1){Igc(a,e,e,1,0,b);return}c=1;while(c0){try{f=Icb(c,Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){e=a;throw vbb(new rFd(e))}else throw vbb(a)}}d=(!b.a&&(b.a=new z0d(b)),b.a);return f=0?BD(qud(d,f),56):null} +function Ib(a,b){if(a<0){return hc(The,OC(GC(SI,1),Uhe,1,5,['index',meb(a)]))}else if(b<0){throw vbb(new Wdb(Vhe+b))}else{return hc('%s (%s) must be less than size (%s)',OC(GC(SI,1),Uhe,1,5,['index',meb(a),meb(b)]))}} +function Slb(a){var b,c,d,e,f;if(a==null){return Xhe}f=new xwb(She,'[',']');for(c=a,d=0,e=c.length;d0){g=a.c.d;h=a.d.d;e=Y6c(c7c(new f7c(h.a,h.b),g),1/(d+1));f=new f7c(g.a,g.b);for(c=new olb(a.a);c.a=0?a._g(c,true,true):sid(a,e,true),153));BD(d,215).ol(b)}else{throw vbb(new Wdb(ite+b.ne()+jte))}} +function ugb(a){var b,c;if(a>-140737488355328&&a<140737488355328){if(a==0){return 0}b=a<0;b&&(a=-a);c=QD($wnd.Math.floor($wnd.Math.log(a)/0.6931471805599453));(!b||a!=$wnd.Math.pow(2,c))&&++c;return c}return vgb(Cbb(a))} +function QOc(a){var b,c,d,e,f,g,h;f=new zsb;for(c=new olb(a);c.a2&&h.e.b+h.j.b<=2){e=h;d=g}f.a.zc(e,f);e.q=d}return f} +function K5b(a,b){var c,d,e;d=new b0b(a);tNb(d,b);yNb(d,(wtc(),Gsc),b);yNb(d,(Nyc(),Vxc),(dcd(),$bd));yNb(d,mwc,(F7c(),B7c));__b(d,(j0b(),e0b));c=new H0b;F0b(c,d);G0b(c,(Ucd(),Tcd));e=new H0b;F0b(e,d);G0b(e,zcd);return d} +function Spc(a){switch(a.g){case 0:return new fGc((rGc(),oGc));case 1:return new CFc;case 2:return new fHc;default:throw vbb(new Wdb('No implementation is available for the crossing minimizer '+(a.f!=null?a.f:''+a.g)));}} +function tDc(a,b){var c,d,e,f,g;a.c[b.p]=true;Ekb(a.a,b);for(g=new olb(b.j);g.a=f){g.$b()}else{e=g.Kc();for(d=0;d0?zh():g<0&&Bw(a,b,-g);return true}else{return false}} +function fIb(a){var b,c,d,e,f,g,h;h=0;if(a.b==0){g=jIb(a,true);b=0;for(d=g,e=0,f=d.length;e0){h+=c;++b}}b>1&&(h+=a.c*(b-1))}else{h=Mtb(Zzb(OAb(JAb(Plb(a.a),new xIb),new zIb)))}return h>0?h+a.n.d+a.n.a:0} +function gIb(a){var b,c,d,e,f,g,h;h=0;if(a.b==0){h=Mtb(Zzb(OAb(JAb(Plb(a.a),new tIb),new vIb)))}else{g=kIb(a,true);b=0;for(d=g,e=0,f=d.length;e0){h+=c;++b}}b>1&&(h+=a.c*(b-1))}return h>0?h+a.n.b+a.n.c:0} +function MJb(a,b){var c,d,e,f;f=BD(Mpb(a.b,b),124);c=f.a;for(e=BD(BD(Qc(a.r,b),21),84).Kc();e.Ob();){d=BD(e.Pb(),111);!!d.c&&(c.a=$wnd.Math.max(c.a,ZHb(d.c)))}if(c.a>0){switch(b.g){case 2:f.n.c=a.s;break;case 4:f.n.b=a.s;}}} +function NQb(a,b){var c,d,e;c=BD(vNb(b,(wSb(),oSb)),19).a-BD(vNb(a,oSb),19).a;if(c==0){d=c7c(R6c(BD(vNb(a,(HSb(),DSb)),8)),BD(vNb(a,ESb),8));e=c7c(R6c(BD(vNb(b,DSb),8)),BD(vNb(b,ESb),8));return Kdb(d.a*d.b,e.a*e.b)}return c} +function iRc(a,b){var c,d,e;c=BD(vNb(b,(JTc(),ETc)),19).a-BD(vNb(a,ETc),19).a;if(c==0){d=c7c(R6c(BD(vNb(a,(mTc(),VSc)),8)),BD(vNb(a,WSc),8));e=c7c(R6c(BD(vNb(b,VSc),8)),BD(vNb(b,WSc),8));return Kdb(d.a*d.b,e.a*e.b)}return c} +function TZb(a){var b,c;c=new Ufb;c.a+='e_';b=KZb(a);b!=null&&(c.a+=''+b,c);if(!!a.c&&!!a.d){Qfb((c.a+=' ',c),C0b(a.c));Qfb(Pfb((c.a+='[',c),a.c.i),']');Qfb((c.a+=gne,c),C0b(a.d));Qfb(Pfb((c.a+='[',c),a.d.i),']')}return c.a} +function zRc(a){switch(a.g){case 0:return new lUc;case 1:return new sUc;case 2:return new CUc;case 3:return new IUc;default:throw vbb(new Wdb('No implementation is available for the layout phase '+(a.f!=null?a.f:''+a.g)));}} +function mfd(a,b,c,d,e){var f;f=0;switch(e.g){case 1:f=$wnd.Math.max(0,b.b+a.b-(c.b+d));break;case 3:f=$wnd.Math.max(0,-a.b-d);break;case 2:f=$wnd.Math.max(0,-a.a-d);break;case 4:f=$wnd.Math.max(0,b.a+a.a-(c.a+d));}return f} +function mqd(a,b,c){var d,e,f,g,h;if(c){e=c.a.length;d=new Yge(e);for(h=(d.b-d.a)*d.c<0?(Xge(),Wge):new she(d);h.Ob();){g=BD(h.Pb(),19);f=Zpd(c,g.a);Lte in f.a||Mte in f.a?$qd(a,f,b):erd(a,f,b);otd(BD(Ohb(a.b,Wpd(f)),79))}}} +function LJd(a){var b,c;switch(a.b){case -1:{return true}case 0:{c=a.t;if(c>1||c==-1){a.b=-1;return true}else{b=wId(a);if(!!b&&(Q6d(),b.Cj()==Bve)){a.b=-1;return true}else{a.b=1;return false}}}default:case 1:{return false}}} +function k1d(a,b){var c,d,e,f,g;d=(!b.s&&(b.s=new cUd(t5,b,21,17)),b.s);f=null;for(e=0,g=d.i;e=0&&f=0?a._g(c,true,true):sid(a,e,true),153));return BD(d,215).ll(b)}else{throw vbb(new Wdb(ite+b.ne()+lte))}} +function BZd(){tZd();var a;if(sZd)return BD(nUd((yFd(),xFd),_ve),1939);rEd(CK,new J_d);CZd();a=BD(JD(Phb((yFd(),xFd),_ve),547)?Phb(xFd,_ve):new AZd,547);sZd=true;yZd(a);zZd(a);Rhb((JFd(),IFd),a,new EZd);Shb(xFd,_ve,a);return a} +function v2d(a,b){var c,d,e,f;a.j=-1;if(oid(a.e)){c=a.i;f=a.i!=0;lud(a,b);d=new pSd(a.e,3,a.c,null,b,c,f);e=b.Qk(a.e,a.c,null);e=h3d(a,b,e);if(!e){Uhd(a.e,d)}else{e.Ei(d);e.Fi()}}else{lud(a,b);e=b.Qk(a.e,a.c,null);!!e&&e.Fi()}} +function rA(a,b){var c,d,e;e=0;d=b[0];if(d>=a.length){return -1}c=(BCb(d,a.length),a.charCodeAt(d));while(c>=48&&c<=57){e=e*10+(c-48);++d;if(d>=a.length){break}c=(BCb(d,a.length),a.charCodeAt(d))}d>b[0]?(b[0]=d):(e=-1);return e} +function vMb(a){var b,c,d,e,f;e=BD(a.a,19).a;f=BD(a.b,19).a;c=e;d=f;b=$wnd.Math.max($wnd.Math.abs(e),$wnd.Math.abs(f));if(e<=0&&e==f){c=0;d=f-1}else{if(e==-b&&f!=b){c=f;d=e;f>=0&&++c}else{c=-f;d=e}}return new vgd(meb(c),meb(d))} +function fNb(a,b,c,d){var e,f,g,h,i,j;for(e=0;e=0&&j>=0&&i=a.i)throw vbb(new qcb(lue+b+mue+a.i));if(c>=a.i)throw vbb(new qcb(nue+c+mue+a.i));d=a.g[c];if(b!=c){b>16);b=d>>16&16;c=16-b;a=a>>b;d=a-256;b=d>>16&8;c+=b;a<<=b;d=a-Rje;b=d>>16&4;c+=b;a<<=b;d=a-oie;b=d>>16&2;c+=b;a<<=b;d=a>>14;b=d&~(d>>1);return c+2-b}} +function $Pb(a){QPb();var b,c,d,e;PPb=new Rkb;OPb=new Lqb;NPb=new Rkb;b=(!a.a&&(a.a=new cUd(E2,a,10,11)),a.a);SPb(b);for(e=new Fyd(b);e.e!=e.i.gc();){d=BD(Dyd(e),33);if(Jkb(PPb,d,0)==-1){c=new Rkb;Ekb(NPb,c);TPb(d,c)}}return NPb} +function BQb(a,b,c){var d,e,f,g;a.a=c.b.d;if(JD(b,352)){e=itd(BD(b,79),false,false);f=ofd(e);d=new FQb(a);reb(f,d);ifd(f,e);b.We((Y9c(),Q8c))!=null&&reb(BD(b.We(Q8c),74),d)}else{g=BD(b,470);g.Hg(g.Dg()+a.a.a);g.Ig(g.Eg()+a.a.b)}} +function _5b(a,b){var c,d,e,f,g,h,i,j;j=Edb(ED(vNb(b,(Nyc(),zyc))));i=a[0].n.a+a[0].o.a+a[0].d.c+j;for(h=1;h=0){return c}h=U6c(c7c(new f7c(g.c+g.b/2,g.d+g.a/2),new f7c(f.c+f.b/2,f.d+f.a/2)));return -(xOb(f,g)-1)*h} +function ufd(a,b,c){var d;MAb(new YAb(null,(!c.a&&(c.a=new cUd(A2,c,6,6)),new Kub(c.a,16))),new Mfd(a,b));MAb(new YAb(null,(!c.n&&(c.n=new cUd(D2,c,1,7)),new Kub(c.n,16))),new Ofd(a,b));d=BD(hkd(c,(Y9c(),Q8c)),74);!!d&&p7c(d,a,b)} +function sid(a,b,c){var d,e,f;f=e1d((O6d(),M6d),a.Tg(),b);if(f){Q6d();BD(f,66).Oj()||(f=_1d(q1d(M6d,f)));e=(d=a.Yg(f),BD(d>=0?a._g(d,true,true):sid(a,f,true),153));return BD(e,215).hl(b,c)}else{throw vbb(new Wdb(ite+b.ne()+lte))}} +function wAd(a,b,c,d){var e,f,g,h,i;e=a.d[b];if(e){f=e.g;i=e.i;if(d!=null){for(h=0;h=c){d=b;j=(i.c+i.a)/2;g=j-c;if(i.c<=j-c){e=new bPc(i.c,g);Dkb(a,d++,e)}h=j+c;if(h<=i.a){f=new bPc(h,i.a);wCb(d,a.c.length);aCb(a.c,d,f)}}} +function u0d(a){var b;if(!a.c&&a.g==null){a.d=a.si(a.f);wtd(a,a.d);b=a.d}else{if(a.g==null){return true}else if(a.i==0){return false}else{b=BD(a.g[a.i-1],47)}}if(b==a.b&&null.km>=null.jm()){Vud(a);return u0d(a)}else{return b.Ob()}} +function KTb(a,b,c){var d,e,f,g,h;h=c;!h&&(h=Ydd(new Zdd,0));Odd(h,Vme,1);aUb(a.c,b);g=EYb(a.a,b);if(g.gc()==1){MTb(BD(g.Xb(0),37),h)}else{f=1/g.gc();for(e=g.Kc();e.Ob();){d=BD(e.Pb(),37);MTb(d,Udd(h,f))}}CYb(a.a,g,b);NTb(b);Qdd(h)} +function qYb(a){this.a=a;if(a.c.i.k==(j0b(),e0b)){this.c=a.c;this.d=BD(vNb(a.c.i,(wtc(),Hsc)),61)}else if(a.d.i.k==e0b){this.c=a.d;this.d=BD(vNb(a.d.i,(wtc(),Hsc)),61)}else{throw vbb(new Wdb('Edge '+a+' is not an external edge.'))}} +function oQd(a,b){var c,d,e;e=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,e,a.b));if(!b){pnd(a,null);qQd(a,0);pQd(a,null)}else if(b!=a){pnd(a,b.zb);qQd(a,b.d);c=(d=b.c,d==null?b.zb:d);pQd(a,c==null||dfb(c,b.zb)?null:c)}} +function NRd(a){var b,c;if(a.f){while(a.n=g)throw vbb(new Cyd(b,g));e=c[b];if(g==1){d=null}else{d=KC($3,hve,415,g-1,0,1);$fb(c,0,d,0,b);f=g-b-1;f>0&&$fb(c,b+1,d,b,f)}b0d(a,d);a0d(a,b,e);return e} +function m8d(){m8d=ccb;k8d=BD(qud(ZKd((r8d(),q8d).qb),6),34);h8d=BD(qud(ZKd(q8d.qb),3),34);i8d=BD(qud(ZKd(q8d.qb),4),34);j8d=BD(qud(ZKd(q8d.qb),5),18);XId(k8d);XId(h8d);XId(i8d);XId(j8d);l8d=new amb(OC(GC(t5,1),Mve,170,0,[k8d,h8d]))} +function AJb(a,b){var c;this.d=new H_b;this.b=b;this.e=new g7c(b.qf());c=a.u.Hc((rcd(),ocd));a.u.Hc(ncd)?a.D?(this.a=c&&!b.If()):(this.a=true):a.u.Hc(pcd)?c?(this.a=!(b.zf().Kc().Ob()||b.Bf().Kc().Ob())):(this.a=false):(this.a=false)} +function IKb(a,b){var c,d,e,f;c=a.o.a;for(f=BD(BD(Qc(a.r,b),21),84).Kc();f.Ob();){e=BD(f.Pb(),111);e.e.a=(d=e.b,d.Xe((Y9c(),s9c))?d.Hf()==(Ucd(),Tcd)?-d.rf().a-Edb(ED(d.We(s9c))):c+Edb(ED(d.We(s9c))):d.Hf()==(Ucd(),Tcd)?-d.rf().a:c)}} +function Q1b(a,b){var c,d,e,f;c=BD(vNb(a,(Nyc(),Lwc)),103);f=BD(hkd(b,$xc),61);e=BD(vNb(a,Vxc),98);if(e!=(dcd(),bcd)&&e!=ccd){if(f==(Ucd(),Scd)){f=lfd(b,c);f==Scd&&(f=Zcd(c))}}else{d=M1b(b);d>0?(f=Zcd(c)):(f=Wcd(Zcd(c)))}jkd(b,$xc,f)} +function olc(a,b){var c,d,e,f,g;g=a.j;b.a!=b.b&&Okb(g,new Ulc);e=g.c.length/2|0;for(d=0;d0&&WGc(a,c,b);return f}else if(d.a!=null){WGc(a,b,c);return -1}else if(e.a!=null){WGc(a,c,b);return 1}return 0} +function swd(a,b){var c,d,e,f;if(a.ej()){c=a.Vi();f=a.fj();++a.j;a.Hi(c,a.oi(c,b));d=a.Zi(3,null,b,c,f);if(a.bj()){e=a.cj(b,null);if(!e){a.$i(d)}else{e.Ei(d);e.Fi()}}else{a.$i(d)}}else{Bvd(a,b);if(a.bj()){e=a.cj(b,null);!!e&&e.Fi()}}} +function D2d(a,b){var c,d,e,f,g;g=S6d(a.e.Tg(),b);e=new yud;c=BD(a.g,119);for(f=a.i;--f>=0;){d=c[f];g.rl(d.ak())&&wtd(e,d)}!Yxd(a,e)&&oid(a.e)&&GLd(a,b.$j()?H2d(a,6,b,(mmb(),jmb),null,-1,false):H2d(a,b.Kj()?2:1,b,null,null,-1,false))} +function Dhb(){Dhb=ccb;var a,b;Bhb=KC(cJ,nie,91,32,0,1);Chb=KC(cJ,nie,91,32,0,1);a=1;for(b=0;b<=18;b++){Bhb[b]=ghb(a);Chb[b]=ghb(Nbb(a,b));a=Ibb(a,5)}for(;bg){return false}}if(b.q){d=b.C;g=d.c.c.a-d.o.a/2;e=d.n.a-c;if(e>g){return false}}return true} +function wcc(a,b){var c;Odd(b,'Partition preprocessing',1);c=BD(GAb(JAb(LAb(JAb(new YAb(null,new Kub(a.a,16)),new Acc),new Ccc),new Ecc),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);MAb(c.Oc(),new Gcc);Qdd(b)} +function DMc(a){wMc();var b,c,d,e,f,g,h;c=new $rb;for(e=new olb(a.e.b);e.a1?(a.e*=Edb(a.a)):(a.f/=Edb(a.a));DOb(a);EOb(a);AOb(a);yNb(a.b,(CPb(),uPb),a.g)} +function Y5b(a,b,c){var d,e,f,g,h,i;d=0;i=c;if(!b){d=c*(a.c.length-1);i*=-1}for(f=new olb(a);f.a=0){if(!b){b=new Ifb;d>0&&Efb(b,a.substr(0,d))}b.a+='\\';Afb(b,c&aje)}else !!b&&Afb(b,c&aje)}return b?b.a:a} +function l5c(a){var b;if(!a.a){throw vbb(new Zdb('IDataType class expected for layout option '+a.f))}b=gvd(a.a);if(b==null){throw vbb(new Zdb("Couldn't create new instance of property '"+a.f+"'. "+ise+(fdb(Y3),Y3.k)+jse))}return BD(b,414)} +function aid(a){var b,c,d,e,f;f=a.eh();if(f){if(f.kh()){e=xid(a,f);if(e!=f){c=a.Vg();d=(b=a.Vg(),b>=0?a.Qg(null):a.eh().ih(a,-1-b,null,null));a.Rg(BD(e,49),c);!!d&&d.Fi();a.Lg()&&a.Mg()&&c>-1&&Uhd(a,new nSd(a,9,c,f,e));return e}}}return f} +function nTb(a){var b,c,d,e,f,g,h,i;g=0;f=a.f.e;for(d=0;d>5;if(e>=a.d){return a.e<0}c=a.a[e];b=1<<(b&31);if(a.e<0){d=Mgb(a);if(e>16)),15).Xc(f);if(h0){!(fad(a.a.c)&&b.n.d)&&!(gad(a.a.c)&&b.n.b)&&(b.g.d+=$wnd.Math.max(0,d/2-0.5));!(fad(a.a.c)&&b.n.a)&&!(gad(a.a.c)&&b.n.c)&&(b.g.a-=d-1)}}} +function N3b(a){var b,c,d,e,f;e=new Rkb;f=O3b(a,e);b=BD(vNb(a,(wtc(),gtc)),10);if(b){for(d=new olb(b.j);d.a>b;f=a.m>>b|c<<22-b;e=a.l>>b|a.m<<22-b}else if(b<44){g=d?Fje:0;f=c>>b-22;e=a.m>>b-22|c<<44-b}else{g=d?Fje:0;f=d?Eje:0;e=c>>b-44}return TC(e&Eje,f&Eje,g&Fje)} +function XOb(a){var b,c,d,e,f,g;this.c=new Rkb;this.d=a;d=Pje;e=Pje;b=Qje;c=Qje;for(g=Jsb(a,0);g.b!=g.d.c;){f=BD(Xsb(g),8);d=$wnd.Math.min(d,f.a);e=$wnd.Math.min(e,f.b);b=$wnd.Math.max(b,f.a);c=$wnd.Math.max(c,f.b)}this.a=new J6c(d,e,b-d,c-e)} +function Dac(a,b){var c,d,e,f,g,h;for(f=new olb(a.b);f.a0&&JD(b,42)){a.a.qj();j=BD(b,42);i=j.cd();f=i==null?0:tb(i);g=DAd(a.a,f);c=a.a.d[g];if(c){d=BD(c.g,367);k=c.i;for(h=0;h=2){c=e.Kc();b=ED(c.Pb());while(c.Ob()){f=b;b=ED(c.Pb());d=$wnd.Math.min(d,(uCb(b),b)-(uCb(f),f))}}return d} +function gUc(a,b){var c,d,e,f,g;d=new Psb;Gsb(d,b,d.c.b,d.c);do{c=(sCb(d.b!=0),BD(Nsb(d,d.a.a),86));a.b[c.g]=1;for(f=Jsb(c.d,0);f.b!=f.d.c;){e=BD(Xsb(f),188);g=e.c;a.b[g.g]==1?Dsb(a.a,e):a.b[g.g]==2?(a.b[g.g]=1):Gsb(d,g,d.c.b,d.c)}}while(d.b!=0)} +function Ju(a,b){var c,d,e;if(PD(b)===PD(Qb(a))){return true}if(!JD(b,15)){return false}d=BD(b,15);e=a.gc();if(e!=d.gc()){return false}if(JD(d,54)){for(c=0;c0&&(e=c);for(g=new olb(a.f.e);g.a0){b-=1;c-=1}else{if(d>=0&&e<0){b+=1;c+=1}else{if(d>0&&e>=0){b-=1;c+=1}else{b+=1;c-=1}}}}}return new vgd(meb(b),meb(c))} +function PIc(a,b){if(a.cb.c){return 1}else if(a.bb.b){return 1}else if(a.a!=b.a){return tb(a.a)-tb(b.a)}else if(a.d==(UIc(),TIc)&&b.d==SIc){return -1}else if(a.d==SIc&&b.d==TIc){return 1}return 0} +function aNc(a,b){var c,d,e,f,g;f=b.a;f.c.i==b.b?(g=f.d):(g=f.c);f.c.i==b.b?(d=f.c):(d=f.d);e=NLc(a.a,g,d);if(e>0&&e0}else if(e<0&&-e0}return false} +function RZc(a,b,c,d){var e,f,g,h,i,j,k,l;e=(b-a.d)/a.c.c.length;f=0;a.a+=c;a.d=b;for(l=new olb(a.c);l.a>24}return g} +function vdb(a){if(a.pe()){var b=a.c;b.qe()?(a.o='['+b.n):!b.pe()?(a.o='[L'+b.ne()+';'):(a.o='['+b.ne());a.b=b.me()+'[]';a.k=b.oe()+'[]';return}var c=a.j;var d=a.d;d=d.split('/');a.o=ydb('.',[c,ydb('$',d)]);a.b=ydb('.',[c,ydb('.',d)]);a.k=d[d.length-1]} +function qGb(a,b){var c,d,e,f,g;g=null;for(f=new olb(a.e.a);f.a=0;b-=2){for(c=0;c<=b;c+=2){if(a.b[c]>a.b[c+2]||a.b[c]===a.b[c+2]&&a.b[c+1]>a.b[c+3]){d=a.b[c+2];a.b[c+2]=a.b[c];a.b[c]=d;d=a.b[c+3];a.b[c+3]=a.b[c+1];a.b[c+1]=d}}}a.c=true} +function UUb(a,b){var c,d,e,f,g,h,i,j;g=b==1?KUb:JUb;for(f=g.a.ec().Kc();f.Ob();){e=BD(f.Pb(),103);for(i=BD(Qc(a.f.c,e),21).Kc();i.Ob();){h=BD(i.Pb(),46);d=BD(h.b,81);j=BD(h.a,189);c=j.c;switch(e.g){case 2:case 1:d.g.d+=c;break;case 4:case 3:d.g.c+=c;}}}} +function PFc(a,b){var c,d,e,f,g,h,i,j,k;j=-1;k=0;for(g=a,h=0,i=g.length;h0&&++k}}++j}return k} +function Eid(a){var b,c;c=new Wfb(hdb(a.gm));c.a+='@';Qfb(c,(b=tb(a)>>>0,b.toString(16)));if(a.kh()){c.a+=' (eProxyURI: ';Pfb(c,a.qh());if(a.$g()){c.a+=' eClass: ';Pfb(c,a.$g())}c.a+=')'}else if(a.$g()){c.a+=' (eClass: ';Pfb(c,a.$g());c.a+=')'}return c.a} +function TDb(a){var b,c,d,e;if(a.e){throw vbb(new Zdb((fdb(TM),Jke+TM.k+Kke)))}a.d==(ead(),cad)&&SDb(a,aad);for(c=new olb(a.a.a);c.a>24}return c} +function lKb(a,b,c){var d,e,f;e=BD(Mpb(a.i,b),306);if(!e){e=new bIb(a.d,b,c);Npb(a.i,b,e);if(sJb(b)){CHb(a.a,b.c,b.b,e)}else{f=rJb(b);d=BD(Mpb(a.p,f),244);switch(f.g){case 1:case 3:e.j=true;lIb(d,b.b,e);break;case 4:case 2:e.k=true;lIb(d,b.c,e);}}}return e} +function r3d(a,b,c,d){var e,f,g,h,i,j;h=new yud;i=S6d(a.e.Tg(),b);e=BD(a.g,119);Q6d();if(BD(b,66).Oj()){for(g=0;g=0){return e}else{f=1;for(h=new olb(b.j);h.a0&&b.ue((tCb(e-1,a.c.length),BD(a.c[e-1],10)),f)>0){Nkb(a,e,(tCb(e-1,a.c.length),BD(a.c[e-1],10)));--e}tCb(e,a.c.length);a.c[e]=f}c.a=new Lqb;c.b=new Lqb} +function n5c(a,b,c){var d,e,f,g,h,i,j,k;k=(d=BD(b.e&&b.e(),9),new xqb(d,BD(_Bb(d,d.length),9),0));i=mfb(c,'[\\[\\]\\s,]+');for(f=i,g=0,h=f.length;g0){!(fad(a.a.c)&&b.n.d)&&!(gad(a.a.c)&&b.n.b)&&(b.g.d-=$wnd.Math.max(0,d/2-0.5));!(fad(a.a.c)&&b.n.a)&&!(gad(a.a.c)&&b.n.c)&&(b.g.a+=$wnd.Math.max(0,d-1))}}} +function Hac(a,b,c){var d,e;if((a.c-a.b&a.a.length-1)==2){if(b==(Ucd(),Acd)||b==zcd){xac(BD(bkb(a),15),(rbd(),nbd));xac(BD(bkb(a),15),obd)}else{xac(BD(bkb(a),15),(rbd(),obd));xac(BD(bkb(a),15),nbd)}}else{for(e=new xkb(a);e.a!=e.b;){d=BD(vkb(e),15);xac(d,c)}}} +function htd(a,b){var c,d,e,f,g,h,i;e=Nu(new qtd(a));h=new Bib(e,e.c.length);f=Nu(new qtd(b));i=new Bib(f,f.c.length);g=null;while(h.b>0&&i.b>0){c=(sCb(h.b>0),BD(h.a.Xb(h.c=--h.b),33));d=(sCb(i.b>0),BD(i.a.Xb(i.c=--i.b),33));if(c==d){g=c}else{break}}return g} +function Cub(a,b){var c,d,e,f,g,h;f=a.a*kke+a.b*1502;h=a.b*kke+11;c=$wnd.Math.floor(h*lke);f+=c;h-=c*mke;f%=mke;a.a=f;a.b=h;if(b<=24){return $wnd.Math.floor(a.a*wub[b])}else{e=a.a*(1<=2147483648&&(d-=Zje);return d}} +function Zic(a,b,c){var d,e,f,g;if(bjc(a,b)>bjc(a,c)){d=V_b(c,(Ucd(),zcd));a.d=d.dc()?0:B0b(BD(d.Xb(0),11));g=V_b(b,Tcd);a.b=g.dc()?0:B0b(BD(g.Xb(0),11))}else{e=V_b(c,(Ucd(),Tcd));a.d=e.dc()?0:B0b(BD(e.Xb(0),11));f=V_b(b,zcd);a.b=f.dc()?0:B0b(BD(f.Xb(0),11))}} +function l6d(a){var b,c,d,e,f,g,h;if(a){b=a.Hh(_ve);if(b){g=GD(AAd((!b.b&&(b.b=new sId((jGd(),fGd),x6,b)),b.b),'conversionDelegates'));if(g!=null){h=new Rkb;for(d=mfb(g,'\\w+'),e=0,f=d.length;ea.c){break}else if(e.a>=a.s){f<0&&(f=g);h=g}}i=(a.s+a.c)/2;if(f>=0){d=NOc(a,b,f,h);i=$Oc((tCb(d,b.c.length),BD(b.c[d],329)));YOc(b,d,c)}return i} +function lZc(){lZc=ccb;RYc=new Osd((Y9c(),r8c),1.3);VYc=I8c;gZc=new q0b(15);fZc=new Osd(f9c,gZc);jZc=new Osd(T9c,15);SYc=w8c;_Yc=Y8c;aZc=_8c;bZc=b9c;$Yc=W8c;cZc=e9c;hZc=x9c;eZc=(OYc(),KYc);ZYc=IYc;dZc=JYc;iZc=MYc;WYc=HYc;XYc=O8c;YYc=P8c;UYc=GYc;TYc=FYc;kZc=NYc} +function Bnd(a,b,c){var d,e,f,g,h,i,j;g=(f=new RHd,f);PHd(g,(uCb(b),b));j=(!g.b&&(g.b=new sId((jGd(),fGd),x6,g)),g.b);for(i=1;i0&&JPb(this,e)}} +function IQb(a,b,c,d,e,f){var g,h,i;if(!e[b.b]){e[b.b]=true;g=d;!g&&(g=new kRb);Ekb(g.e,b);for(i=f[b.b].Kc();i.Ob();){h=BD(i.Pb(),282);if(h.d==c||h.c==c){continue}h.c!=b&&IQb(a,h.c,b,g,e,f);h.d!=b&&IQb(a,h.d,b,g,e,f);Ekb(g.c,h);Gkb(g.d,h.b)}return g}return null} +function e4b(a){var b,c,d,e,f,g,h;b=0;for(e=new olb(a.e);e.a=2} +function gec(a,b){var c,d,e,f;Odd(b,'Self-Loop pre-processing',1);for(d=new olb(a.a);d.a1){return false}b=qqb(zbd,OC(GC(B1,1),Kie,93,0,[ybd,Bbd]));if(Ox(Cx(b,a))>1){return false}d=qqb(Gbd,OC(GC(B1,1),Kie,93,0,[Fbd,Ebd]));if(Ox(Cx(d,a))>1){return false}return true} +function U0d(a,b){var c,d,e;c=b.Hh(a.a);if(c){e=GD(AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),'affiliation'));if(e!=null){d=kfb(e,wfb(35));return d==-1?l1d(a,u1d(a,bKd(b.Hj())),e):d==0?l1d(a,null,e.substr(1)):l1d(a,e.substr(0,d),e.substr(d+1))}}return null} +function ic(b){var c,d,e;try{return b==null?Xhe:fcb(b)}catch(a){a=ubb(a);if(JD(a,102)){c=a;e=hdb(rb(b))+'@'+(d=(Zfb(),kCb(b))>>>0,d.toString(16));tyb(xyb(),($xb(),'Exception during lenientFormat for '+e),c);return '<'+e+' threw '+hdb(c.gm)+'>'}else throw vbb(a)}} +function mzc(a){switch(a.g){case 0:return new xDc;case 1:return new ZCc;case 2:return new DCc;case 3:return new QCc;case 4:return new LDc;case 5:return new iDc;default:throw vbb(new Wdb('No implementation is available for the layerer '+(a.f!=null?a.f:''+a.g)));}} +function AQc(a,b,c){var d,e,f;for(f=new olb(a.t);f.a0){d.b.n-=d.c;d.b.n<=0&&d.b.u>0&&Dsb(b,d.b)}}for(e=new olb(a.i);e.a0){d.a.u-=d.c;d.a.u<=0&&d.a.n>0&&Dsb(c,d.a)}}} +function Vud(a){var b,c,d,e,f;if(a.g==null){a.d=a.si(a.f);wtd(a,a.d);if(a.c){f=a.f;return f}}b=BD(a.g[a.i-1],47);e=b.Pb();a.e=b;c=a.si(e);if(c.Ob()){a.d=c;wtd(a,c)}else{a.d=null;while(!b.Ob()){NC(a.g,--a.i,null);if(a.i==0){break}d=BD(a.g[a.i-1],47);b=d}}return e} +function r2d(a,b){var c,d,e,f,g,h;d=b;e=d.ak();if(T6d(a.e,e)){if(e.hi()&&E2d(a,e,d.dd())){return false}}else{h=S6d(a.e.Tg(),e);c=BD(a.g,119);for(f=0;f1||c>1){return 2}}if(b+c==1){return 2}return 0} +function WQb(a,b,c){var d,e,f,g,h;Odd(c,'ELK Force',1);Ccb(DD(hkd(b,(wSb(),jSb))))||$Cb((d=new _Cb((Pgd(),new bhd(b))),d));h=TQb(b);XQb(h);YQb(a,BD(vNb(h,fSb),424));g=LQb(a.a,h);for(f=g.Kc();f.Ob();){e=BD(f.Pb(),231);tRb(a.b,e,Udd(c,1/g.gc()))}h=KQb(g);SQb(h);Qdd(c)} +function yoc(a,b){var c,d,e,f,g;Odd(b,'Breaking Point Processor',1);xoc(a);if(Ccb(DD(vNb(a,(Nyc(),Jyc))))){for(e=new olb(a.b);e.a=0?a._g(d,true,true):sid(a,f,true),153));BD(e,215).ml(b,c)}else{throw vbb(new Wdb(ite+b.ne()+jte))}} +function ROc(a,b){var c,d,e,f,g;c=new Rkb;e=LAb(new YAb(null,new Kub(a,16)),new iPc);f=LAb(new YAb(null,new Kub(a,16)),new kPc);g=aAb(_zb(OAb(ty(OC(GC(xM,1),Uhe,833,0,[e,f])),new mPc)));for(d=1;d=2*b&&Ekb(c,new bPc(g[d-1]+b,g[d]-b))}return c} +function AXc(a,b,c){Odd(c,'Eades radial',1);c.n&&!!b&&Tdd(c,i6d(b),(pgd(),mgd));a.d=BD(hkd(b,(MUc(),LUc)),33);a.c=Edb(ED(hkd(b,(ZWc(),VWc))));a.e=tXc(BD(hkd(b,WWc),293));a.a=gWc(BD(hkd(b,YWc),426));a.b=jXc(BD(hkd(b,RWc),340));BXc(a);c.n&&!!b&&Tdd(c,i6d(b),(pgd(),mgd))} +function Fqd(a,b,c){var d,e,f,g,h,j,k,l;if(c){f=c.a.length;d=new Yge(f);for(h=(d.b-d.a)*d.c<0?(Xge(),Wge):new she(d);h.Ob();){g=BD(h.Pb(),19);e=Zpd(c,g.a);!!e&&(i=null,j=Uqd(a,(k=(Fhd(),l=new ppd,l),!!b&&npd(k,b),k),e),Lkd(j,_pd(e,Vte)),grd(e,j),hrd(e,j),crd(a,e,j))}}} +function UKd(a){var b,c,d,e,f,g;if(!a.j){g=new HPd;b=KKd;f=b.a.zc(a,b);if(f==null){for(d=new Fyd(_Kd(a));d.e!=d.i.gc();){c=BD(Dyd(d),26);e=UKd(c);ytd(g,e);wtd(g,c)}b.a.Bc(a)!=null}vud(g);a.j=new nNd((BD(qud(ZKd((NFd(),MFd).o),11),18),g.i),g.g);$Kd(a).b&=-33}return a.j} +function O9d(a){var b,c,d,e;if(a==null){return null}else{d=Qge(a,true);e=Nwe.length;if(dfb(d.substr(d.length-e,e),Nwe)){c=d.length;if(c==4){b=(BCb(0,d.length),d.charCodeAt(0));if(b==43){return z9d}else if(b==45){return y9d}}else if(c==3){return z9d}}return new Odb(d)}} +function _C(a){var b,c,d;c=a.l;if((c&c-1)!=0){return -1}d=a.m;if((d&d-1)!=0){return -1}b=a.h;if((b&b-1)!=0){return -1}if(b==0&&d==0&&c==0){return -1}if(b==0&&d==0&&c!=0){return ieb(c)}if(b==0&&d!=0&&c==0){return ieb(d)+22}if(b!=0&&d==0&&c==0){return ieb(b)+44}return -1} +function qbc(a,b){var c,d,e,f,g;Odd(b,'Edge joining',1);c=Ccb(DD(vNb(a,(Nyc(),Byc))));for(e=new olb(a.b);e.a1){for(e=new olb(a.a);e.a0);f.a.Xb(f.c=--f.b);Aib(f,e);sCb(f.b3&&EA(a,0,b-3)}} +function cUb(a){var b,c,d,e;if(PD(vNb(a,(Nyc(),axc)))===PD((hbd(),ebd))){return !a.e&&PD(vNb(a,Cwc))!==PD((Xrc(),Urc))}d=BD(vNb(a,Dwc),292);e=Ccb(DD(vNb(a,Hwc)))||PD(vNb(a,Iwc))===PD((Rpc(),Opc));b=BD(vNb(a,Bwc),19).a;c=a.a.c.length;return !e&&d!=(Xrc(),Urc)&&(b==0||b>c)} +function lkc(a){var b,c;c=0;for(;c0){break}}if(c>0&&c0){break}}if(b>0&&c>16!=6&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+qmd(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?cmd(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,6,d));d=bmd(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,6,b,b))} +function npd(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=9&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+opd(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?lpd(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,9,d));d=kpd(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,9,b,b))} +function Rld(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=3&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+Sld(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?Lld(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,12,d));d=Kld(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,b,b))} +function VId(b){var c,d,e,f,g;e=wId(b);g=b.j;if(g==null&&!!e){return b.$j()?null:e.zj()}else if(JD(e,148)){d=e.Aj();if(d){f=d.Nh();if(f!=b.i){c=BD(e,148);if(c.Ej()){try{b.g=f.Kh(c,g)}catch(a){a=ubb(a);if(JD(a,78)){b.g=null}else throw vbb(a)}}b.i=f}}return b.g}return null} +function wOb(a){var b;b=new Rkb;Ekb(b,new aDb(new f7c(a.c,a.d),new f7c(a.c+a.b,a.d)));Ekb(b,new aDb(new f7c(a.c,a.d),new f7c(a.c,a.d+a.a)));Ekb(b,new aDb(new f7c(a.c+a.b,a.d+a.a),new f7c(a.c+a.b,a.d)));Ekb(b,new aDb(new f7c(a.c+a.b,a.d+a.a),new f7c(a.c,a.d+a.a)));return b} +function IJc(a,b,c,d){var e,f,g;g=LZb(b,c);d.c[d.c.length]=b;if(a.j[g.p]==-1||a.j[g.p]==2||a.a[b.p]){return d}a.j[g.p]=-1;for(f=new Sr(ur(O_b(g).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);if(!(!OZb(e)&&!(!OZb(e)&&e.c.i.c==e.d.i.c))||e==b){continue}return IJc(a,e,g,d)}return d} +function vQb(a,b,c){var d,e,f;for(f=b.a.ec().Kc();f.Ob();){e=BD(f.Pb(),79);d=BD(Ohb(a.b,e),266);!d&&(Xod(jtd(e))==Xod(ltd(e))?uQb(a,e,c):jtd(e)==Xod(ltd(e))?Ohb(a.c,e)==null&&Ohb(a.b,ltd(e))!=null&&xQb(a,e,c,false):Ohb(a.d,e)==null&&Ohb(a.b,jtd(e))!=null&&xQb(a,e,c,true))}} +function jcc(a,b){var c,d,e,f,g,h,i;for(e=a.Kc();e.Ob();){d=BD(e.Pb(),10);h=new H0b;F0b(h,d);G0b(h,(Ucd(),zcd));yNb(h,(wtc(),ftc),(Bcb(),true));for(g=b.Kc();g.Ob();){f=BD(g.Pb(),10);i=new H0b;F0b(i,f);G0b(i,Tcd);yNb(i,ftc,true);c=new UZb;yNb(c,ftc,true);QZb(c,h);RZb(c,i)}}} +function jnc(a,b,c,d){var e,f,g,h;e=hnc(a,b,c);f=hnc(a,c,b);g=BD(Ohb(a.c,b),112);h=BD(Ohb(a.c,c),112);if(ed.b.g&&(f.c[f.c.length]=d,true)}}return f} +function k$c(){k$c=ccb;g$c=new l$c('CANDIDATE_POSITION_LAST_PLACED_RIGHT',0);f$c=new l$c('CANDIDATE_POSITION_LAST_PLACED_BELOW',1);i$c=new l$c('CANDIDATE_POSITION_WHOLE_DRAWING_RIGHT',2);h$c=new l$c('CANDIDATE_POSITION_WHOLE_DRAWING_BELOW',3);j$c=new l$c('WHOLE_DRAWING',4)} +function Xqd(a,b){if(JD(b,239)){return iqd(a,BD(b,33))}else if(JD(b,186)){return jqd(a,BD(b,118))}else if(JD(b,354)){return hqd(a,BD(b,137))}else if(JD(b,352)){return gqd(a,BD(b,79))}else if(b){return null}else{throw vbb(new Wdb(Xte+Fe(new amb(OC(GC(SI,1),Uhe,1,5,[b])))))}} +function aic(a){var b,c,d,e,f,g,h;f=new Psb;for(e=new olb(a.d.a);e.a1){b=nGb((c=new pGb,++a.b,c),a.d);for(h=Jsb(f,0);h.b!=h.d.c;){g=BD(Xsb(h),121);AFb(DFb(CFb(EFb(BFb(new FFb,1),0),b),g))}}} +function $od(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=11&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+_od(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?Uod(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,10,d));d=Tod(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,11,b,b))} +function uZb(a){var b,c,d,e;for(d=new nib((new eib(a.b)).a);d.b;){c=lib(d);e=BD(c.cd(),11);b=BD(c.dd(),10);yNb(b,(wtc(),$sc),e);yNb(e,gtc,b);yNb(e,Nsc,(Bcb(),true));G0b(e,BD(vNb(b,Hsc),61));vNb(b,Hsc);yNb(e.i,(Nyc(),Vxc),(dcd(),acd));BD(vNb(Q_b(e.i),Ksc),21).Fc((Orc(),Krc))}} +function G4b(a,b,c){var d,e,f,g,h,i;f=0;g=0;if(a.c){for(i=new olb(a.d.i.j);i.af.a){return -1}else if(e.ai){k=a.d;a.d=KC(y4,jve,63,2*i+4,0,1);for(f=0;f=9223372036854775807){return wD(),sD}e=false;if(a<0){e=true;a=-a}d=0;if(a>=Ije){d=QD(a/Ije);a-=d*Ije}c=0;if(a>=Hje){c=QD(a/Hje);a-=c*Hje}b=QD(a);f=TC(b,c,d);e&&ZC(f);return f} +function rKb(a,b){var c,d,e,f;c=!b||!a.u.Hc((rcd(),ncd));f=0;for(e=new olb(a.e.Cf());e.a=-b&&d==b){return new vgd(meb(c-1),meb(d))}return new vgd(meb(c),meb(d-1))} +function W8b(){S8b();return OC(GC(AS,1),Kie,77,0,[Y7b,V7b,Z7b,n8b,G8b,r8b,M8b,w8b,E8b,i8b,A8b,v8b,F8b,e8b,O8b,P7b,z8b,I8b,o8b,H8b,Q8b,C8b,Q7b,D8b,R8b,K8b,P8b,p8b,b8b,q8b,m8b,N8b,T7b,_7b,t8b,S7b,u8b,k8b,f8b,x8b,h8b,W7b,U7b,l8b,g8b,y8b,L8b,R7b,B8b,j8b,s8b,c8b,a8b,J8b,$7b,d8b,X7b])} +function Yic(a,b,c){a.d=0;a.b=0;b.k==(j0b(),i0b)&&c.k==i0b&&BD(vNb(b,(wtc(),$sc)),10)==BD(vNb(c,$sc),10)&&(ajc(b).j==(Ucd(),Acd)?Zic(a,b,c):Zic(a,c,b));b.k==i0b&&c.k==g0b?ajc(b).j==(Ucd(),Acd)?(a.d=1):(a.b=1):c.k==i0b&&b.k==g0b&&(ajc(c).j==(Ucd(),Acd)?(a.b=1):(a.d=1));cjc(a,b,c)} +function esd(a){var b,c,d,e,f,g,h,i,j,k,l;l=hsd(a);b=a.a;i=b!=null;i&&Upd(l,'category',a.a);e=Fhe(new Pib(a.d));g=!e;if(g){j=new wB;cC(l,'knownOptions',j);c=new msd(j);reb(new Pib(a.d),c)}f=Fhe(a.g);h=!f;if(h){k=new wB;cC(l,'supportedFeatures',k);d=new osd(k);reb(a.g,d)}return l} +function ty(a){var b,c,d,e,f,g,h,i,j;d=false;b=336;c=0;f=new Xp(a.length);for(h=a,i=0,j=h.length;i>16!=7&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+Iod(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?Eod(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=BD(b,49).gh(a,1,C2,d));d=Dod(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,7,b,b))} +function NHd(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=3&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+QHd(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?KHd(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=BD(b,49).gh(a,0,k5,d));d=JHd(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,b,b))} +function Ehb(a,b){Dhb();var c,d,e,f,g,h,i,j,k;if(b.d>a.d){h=a;a=b;b=h}if(b.d<63){return Ihb(a,b)}g=(a.d&-2)<<4;j=Rgb(a,g);k=Rgb(b,g);d=yhb(a,Qgb(j,g));e=yhb(b,Qgb(k,g));i=Ehb(j,k);c=Ehb(d,e);f=Ehb(yhb(j,d),yhb(e,k));f=thb(thb(f,i),c);f=Qgb(f,g);i=Qgb(i,g<<1);return thb(thb(i,f),c)} +function aGc(a,b,c){var d,e,f,g,h;g=CHc(a,c);h=KC(OQ,kne,10,b.length,0,1);d=0;for(f=g.Kc();f.Ob();){e=BD(f.Pb(),11);Ccb(DD(vNb(e,(wtc(),Nsc))))&&(h[d++]=BD(vNb(e,gtc),10))}if(d=0;f+=c?1:-1){g=g|b.c.Sf(i,f,c,d&&!Ccb(DD(vNb(b.j,(wtc(),Jsc))))&&!Ccb(DD(vNb(b.j,(wtc(),mtc)))));g=g|b.q._f(i,f,c);g=g|cGc(a,i[f],c,d)}Qqb(a.c,b);return g} +function o3b(a,b,c){var d,e,f,g,h,i,j,k,l,m;for(k=m_b(a.j),l=0,m=k.length;l1&&(a.a=true);ZNb(BD(c.b,65),P6c(R6c(BD(b.b,65).c),Y6c(c7c(R6c(BD(c.b,65).a),BD(b.b,65).a),e)));D1c(a,b);F1c(a,c)}} +function rVb(a){var b,c,d,e,f,g,h;for(f=new olb(a.a.a);f.a0&&f>0?(g.p=b++):d>0?(g.p=c++):f>0?(g.p=e++):(g.p=c++);}}mmb();Okb(a.j,new fcc)} +function Vec(a){var b,c;c=null;b=BD(Ikb(a.g,0),17);do{c=b.d.i;if(wNb(c,(wtc(),Wsc))){return BD(vNb(c,Wsc),11).i}if(c.k!=(j0b(),h0b)&&Qr(new Sr(ur(U_b(c).a.Kc(),new Sq)))){b=BD(Rr(new Sr(ur(U_b(c).a.Kc(),new Sq))),17)}else if(c.k!=h0b){return null}}while(!!c&&c.k!=(j0b(),h0b));return c} +function Omc(a,b){var c,d,e,f,g,h,i,j,k;h=b.j;g=b.g;i=BD(Ikb(h,h.c.length-1),113);k=(tCb(0,h.c.length),BD(h.c[0],113));j=Kmc(a,g,i,k);for(f=1;fj){i=c;k=e;j=d}}b.a=k;b.c=i} +function sEb(a,b){var c,d;d=Axb(a.b,b.b);if(!d){throw vbb(new Zdb('Invalid hitboxes for scanline constraint calculation.'))}(mEb(b.b,BD(Cxb(a.b,b.b),57))||mEb(b.b,BD(Bxb(a.b,b.b),57)))&&(Zfb(),b.b+' has overlap.');a.a[b.b.f]=BD(Exb(a.b,b.b),57);c=BD(Dxb(a.b,b.b),57);!!c&&(a.a[c.f]=b.b)} +function AFb(a){if(!a.a.d||!a.a.e){throw vbb(new Zdb((fdb(fN),fN.k+' must have a source and target '+(fdb(jN),jN.k)+' specified.')))}if(a.a.d==a.a.e){throw vbb(new Zdb('Network simplex does not support self-loops: '+a.a+' '+a.a.d+' '+a.a.e))}NFb(a.a.d.g,a.a);NFb(a.a.e.b,a.a);return a.a} +function HHc(a,b,c){var d,e,f,g,h,i,j;j=new Hxb(new tIc(a));for(g=OC(GC(aR,1),lne,11,0,[b,c]),h=0,i=g.length;hi-a.b&&hi-a.a&&h0&&++n}}}++m}return n} +function hUc(a,b){var c,d,e,f,g;g=BD(vNb(b,(JTc(),FTc)),425);for(f=Jsb(b.b,0);f.b!=f.d.c;){e=BD(Xsb(f),86);if(a.b[e.g]==0){switch(g.g){case 0:iUc(a,e);break;case 1:gUc(a,e);}a.b[e.g]=2}}for(d=Jsb(a.a,0);d.b!=d.d.c;){c=BD(Xsb(d),188);ze(c.b.d,c,true);ze(c.c.b,c,true)}yNb(b,(mTc(),gTc),a.a)} +function S6d(a,b){Q6d();var c,d,e,f;if(!b){return P6d}else if(b==(Q8d(),N8d)||(b==v8d||b==t8d||b==u8d)&&a!=s8d){return new Z6d(a,b)}else{d=BD(b,677);c=d.pk();if(!c){a2d(q1d((O6d(),M6d),b));c=d.pk()}f=(!c.i&&(c.i=new Lqb),c.i);e=BD(Wd(irb(f.f,a)),1942);!e&&Rhb(f,a,e=new Z6d(a,b));return e}} +function Tbc(a,b){var c,d,e,f,g,h,i,j,k;i=BD(vNb(a,(wtc(),$sc)),11);j=l7c(OC(GC(m1,1),nie,8,0,[i.i.n,i.n,i.a])).a;k=a.i.n.b;c=k_b(a.e);for(e=c,f=0,g=e.length;f0){if(f.a){h=f.b.rf().a;if(c>h){e=(c-h)/2;f.d.b=e;f.d.c=e}}else{f.d.c=a.s+c}}else if(tcd(a.u)){d=sfd(f.b);d.c<0&&(f.d.b=-d.c);d.c+d.b>f.b.rf().a&&(f.d.c=d.c+d.b-f.b.rf().a)}}} +function Eec(a,b){var c,d,e,f;Odd(b,'Semi-Interactive Crossing Minimization Processor',1);c=false;for(e=new olb(a.b);e.a=0){if(b==c){return new vgd(meb(-b-1),meb(-b-1))}if(b==-c){return new vgd(meb(-b),meb(c+1))}}if($wnd.Math.abs(b)>$wnd.Math.abs(c)){if(b<0){return new vgd(meb(-b),meb(c))}return new vgd(meb(-b),meb(c+1))}return new vgd(meb(b+1),meb(c))} +function q5b(a){var b,c;c=BD(vNb(a,(Nyc(),mxc)),163);b=BD(vNb(a,(wtc(),Osc)),303);if(c==(Ctc(),ytc)){yNb(a,mxc,Btc);yNb(a,Osc,(esc(),dsc))}else if(c==Atc){yNb(a,mxc,Btc);yNb(a,Osc,(esc(),bsc))}else if(b==(esc(),dsc)){yNb(a,mxc,ytc);yNb(a,Osc,csc)}else if(b==bsc){yNb(a,mxc,Atc);yNb(a,Osc,csc)}} +function FNc(){FNc=ccb;DNc=new RNc;zNc=e3c(new j3c,(qUb(),nUb),(S8b(),o8b));CNc=c3c(e3c(new j3c,nUb,C8b),pUb,B8b);ENc=b3c(b3c(g3c(c3c(e3c(new j3c,lUb,M8b),pUb,L8b),oUb),K8b),N8b);ANc=c3c(e3c(e3c(e3c(new j3c,mUb,r8b),oUb,t8b),oUb,u8b),pUb,s8b);BNc=c3c(e3c(e3c(new j3c,oUb,u8b),oUb,_7b),pUb,$7b)} +function hQc(){hQc=ccb;cQc=e3c(c3c(new j3c,(qUb(),pUb),(S8b(),c8b)),nUb,o8b);gQc=b3c(b3c(g3c(c3c(e3c(new j3c,lUb,M8b),pUb,L8b),oUb),K8b),N8b);dQc=c3c(e3c(e3c(e3c(new j3c,mUb,r8b),oUb,t8b),oUb,u8b),pUb,s8b);fQc=e3c(e3c(new j3c,nUb,C8b),pUb,B8b);eQc=c3c(e3c(e3c(new j3c,oUb,u8b),oUb,_7b),pUb,$7b)} +function GNc(a,b,c,d,e){var f,g;if((!OZb(b)&&b.c.i.c==b.d.i.c||!T6c(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])),c))&&!OZb(b)){b.c==e?St(b.a,0,new g7c(c)):Dsb(b.a,new g7c(c));if(d&&!Rqb(a.a,c)){g=BD(vNb(b,(Nyc(),jxc)),74);if(!g){g=new s7c;yNb(b,jxc,g)}f=new g7c(c);Gsb(g,f,g.c.b,g.c);Qqb(a.a,f)}}} +function Qac(a){var b,c;for(c=new Sr(ur(R_b(a).a.Kc(),new Sq));Qr(c);){b=BD(Rr(c),17);if(b.c.i.k!=(j0b(),f0b)){throw vbb(new y2c(Fne+P_b(a)+"' has its layer constraint set to FIRST, but has at least one incoming edge that "+' does not come from a FIRST_SEPARATE node. That must not happen.'))}}} +function vjd(a,b,c){var d,e,f,g,h,i,j;e=aeb(a.Db&254);if(e==0){a.Eb=c}else{if(e==1){h=KC(SI,Uhe,1,2,5,1);f=zjd(a,b);if(f==0){h[0]=c;h[1]=a.Eb}else{h[0]=a.Eb;h[1]=c}}else{h=KC(SI,Uhe,1,e+1,5,1);g=CD(a.Eb);for(d=2,i=0,j=0;d<=128;d<<=1){d==b?(h[j++]=c):(a.Db&d)!=0&&(h[j++]=g[i++])}}a.Eb=h}a.Db|=b} +function ENb(a,b,c){var d,e,f,g;this.b=new Rkb;e=0;d=0;for(g=new olb(a);g.a0){f=BD(Ikb(this.b,0),167);e+=f.o;d+=f.p}e*=2;d*=2;b>1?(e=QD($wnd.Math.ceil(e*b))):(d=QD($wnd.Math.ceil(d/b)));this.a=new pNb(e,d)} +function Igc(a,b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r;k=d;if(b.j&&b.o){n=BD(Ohb(a.f,b.A),57);p=n.d.c+n.d.b;--k}else{p=b.a.c+b.a.b}l=e;if(c.q&&c.o){n=BD(Ohb(a.f,c.C),57);j=n.d.c;++l}else{j=c.a.c}q=j-p;i=$wnd.Math.max(2,l-k);h=q/i;o=p+h;for(m=k;m=0;g+=e?1:-1){h=b[g];i=d==(Ucd(),zcd)?e?V_b(h,d):Su(V_b(h,d)):e?Su(V_b(h,d)):V_b(h,d);f&&(a.c[h.p]=i.gc());for(l=i.Kc();l.Ob();){k=BD(l.Pb(),11);a.d[k.p]=j++}Gkb(c,i)}} +function aQc(a,b,c){var d,e,f,g,h,i,j,k;f=Edb(ED(a.b.Kc().Pb()));j=Edb(ED(Pq(b.b)));d=Y6c(R6c(a.a),j-c);e=Y6c(R6c(b.a),c-f);k=P6c(d,e);Y6c(k,1/(j-f));this.a=k;this.b=new Rkb;h=true;g=a.b.Kc();g.Pb();while(g.Ob()){i=Edb(ED(g.Pb()));if(h&&i-c>Oqe){this.b.Fc(c);h=false}this.b.Fc(i)}h&&this.b.Fc(c)} +function vGb(a){var b,c,d,e;yGb(a,a.n);if(a.d.c.length>0){Blb(a.c);while(GGb(a,BD(mlb(new olb(a.e.a)),121))>5;b&=31;if(d>=a.d){return a.e<0?(Hgb(),Bgb):(Hgb(),Ggb)}f=a.d-d;e=KC(WD,oje,25,f+1,15,1);mhb(e,f,a.a,d,b);if(a.e<0){for(c=0;c0&&a.a[c]<<32-b!=0){for(c=0;c=0){return false}else{c=e1d((O6d(),M6d),e,b);if(!c){return true}else{d=c.Zj();return (d>1||d==-1)&&$1d(q1d(M6d,c))!=3}}}}else{return false}} +function R1b(a,b,c,d){var e,f,g,h,i;h=atd(BD(qud((!b.b&&(b.b=new y5d(z2,b,4,7)),b.b),0),82));i=atd(BD(qud((!b.c&&(b.c=new y5d(z2,b,5,8)),b.c),0),82));if(Xod(h)==Xod(i)){return null}if(ntd(i,h)){return null}g=Mld(b);if(g==c){return d}else{f=BD(Ohb(a.a,g),10);if(f){e=f.e;if(e){return e}}}return null} +function Cac(a,b){var c;c=BD(vNb(a,(Nyc(),Rwc)),276);Odd(b,'Label side selection ('+c+')',1);switch(c.g){case 0:Dac(a,(rbd(),nbd));break;case 1:Dac(a,(rbd(),obd));break;case 2:Bac(a,(rbd(),nbd));break;case 3:Bac(a,(rbd(),obd));break;case 4:Eac(a,(rbd(),nbd));break;case 5:Eac(a,(rbd(),obd));}Qdd(b)} +function bGc(a,b,c){var d,e,f,g,h,i;d=RFc(c,a.length);g=a[d];if(g[0].k!=(j0b(),e0b)){return}f=SFc(c,g.length);i=b.j;for(e=0;e0){c[0]+=a.d;g-=c[0]}if(c[2]>0){c[2]+=a.d;g-=c[2]}f=$wnd.Math.max(0,g);c[1]=$wnd.Math.max(c[1],g);vHb(a,eHb,e.c+d.b+c[0]-(c[1]-g)/2,c);if(b==eHb){a.c.b=f;a.c.c=e.c+d.b+(f-g)/2}} +function AYb(){this.c=KC(UD,Vje,25,(Ucd(),OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])).length,15,1);this.b=KC(UD,Vje,25,OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd]).length,15,1);this.a=KC(UD,Vje,25,OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd]).length,15,1);zlb(this.c,Pje);zlb(this.b,Qje);zlb(this.a,Qje)} +function Ufe(a,b,c){var d,e,f,g;if(b<=c){e=b;f=c}else{e=c;f=b}d=0;if(a.b==null){a.b=KC(WD,oje,25,2,15,1);a.b[0]=e;a.b[1]=f;a.c=true}else{d=a.b.length;if(a.b[d-1]+1==e){a.b[d-1]=f;return}g=KC(WD,oje,25,d+2,15,1);$fb(a.b,0,g,0,d);a.b=g;a.b[d-1]>=e&&(a.c=false,a.a=false);a.b[d++]=e;a.b[d]=f;a.c||Yfe(a)}} +function inc(a,b,c){var d,e,f,g,h,i,j;j=b.d;a.a=new Skb(j.c.length);a.c=new Lqb;for(h=new olb(j);h.a=0?a._g(j,false,true):sid(a,c,false),58));n:for(f=l.Kc();f.Ob();){e=BD(f.Pb(),56);for(k=0;k1){Xxd(e,e.i-1)}}return d}} +function Z2b(a,b){var c,d,e,f,g,h,i;Odd(b,'Comment post-processing',1);for(f=new olb(a.b);f.aa.d[g.p]){c+=zHc(a.b,f);Wjb(a.a,meb(f))}}while(!akb(a.a)){xHc(a.b,BD(fkb(a.a),19).a)}}return c} +function o2c(a,b,c){var d,e,f,g;f=(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a).i;for(e=new Fyd((!b.a&&(b.a=new cUd(E2,b,10,11)),b.a));e.e!=e.i.gc();){d=BD(Dyd(e),33);(!d.a&&(d.a=new cUd(E2,d,10,11)),d.a).i==0||(f+=o2c(a,d,false))}if(c){g=Xod(b);while(g){f+=(!g.a&&(g.a=new cUd(E2,g,10,11)),g.a).i;g=Xod(g)}}return f} +function Xxd(a,b){var c,d,e,f;if(a.ej()){d=null;e=a.fj();a.ij()&&(d=a.kj(a.pi(b),null));c=a.Zi(4,f=tud(a,b),null,b,e);if(a.bj()&&f!=null){d=a.dj(f,d);if(!d){a.$i(c)}else{d.Ei(c);d.Fi()}}else{if(!d){a.$i(c)}else{d.Ei(c);d.Fi()}}return f}else{f=tud(a,b);if(a.bj()&&f!=null){d=a.dj(f,null);!!d&&d.Fi()}return f}} +function UKb(a){var b,c,d,e,f,g,h,i,j,k;j=a.a;b=new Tqb;i=0;for(d=new olb(a.d);d.ah.d&&(k=h.d+h.a+j)}}c.c.d=k;b.a.zc(c,b);i=$wnd.Math.max(i,c.c.d+c.c.a)}return i} +function Orc(){Orc=ccb;Frc=new Prc('COMMENTS',0);Hrc=new Prc('EXTERNAL_PORTS',1);Irc=new Prc('HYPEREDGES',2);Jrc=new Prc('HYPERNODES',3);Krc=new Prc('NON_FREE_PORTS',4);Lrc=new Prc('NORTH_SOUTH_PORTS',5);Nrc=new Prc(Wne,6);Erc=new Prc('CENTER_LABELS',7);Grc=new Prc('END_LABELS',8);Mrc=new Prc('PARTITIONS',9)} +function gVc(a){var b,c,d,e,f;e=new Rkb;b=new Vqb((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));for(d=new Sr(ur(_sd(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),79);if(!JD(qud((!c.b&&(c.b=new y5d(z2,c,4,7)),c.b),0),186)){f=atd(BD(qud((!c.c&&(c.c=new y5d(z2,c,5,8)),c.c),0),82));b.a._b(f)||(e.c[e.c.length]=f,true)}}return e} +function fVc(a){var b,c,d,e,f,g;f=new Tqb;b=new Vqb((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));for(e=new Sr(ur(_sd(a).a.Kc(),new Sq));Qr(e);){d=BD(Rr(e),79);if(!JD(qud((!d.b&&(d.b=new y5d(z2,d,4,7)),d.b),0),186)){g=atd(BD(qud((!d.c&&(d.c=new y5d(z2,d,5,8)),d.c),0),82));b.a._b(g)||(c=f.a.zc(g,f),c==null)}}return f} +function zA(a,b,c,d,e){if(d<0){d=oA(a,e,OC(GC(ZI,1),nie,2,6,[bje,cje,dje,eje,fje,gje,hje,ije,jje,kje,lje,mje]),b);d<0&&(d=oA(a,e,OC(GC(ZI,1),nie,2,6,['Jan','Feb','Mar','Apr',fje,'Jun','Jul','Aug','Sep','Oct','Nov','Dec']),b));if(d<0){return false}c.k=d;return true}else if(d>0){c.k=d-1;return true}return false} +function BA(a,b,c,d,e){if(d<0){d=oA(a,e,OC(GC(ZI,1),nie,2,6,[bje,cje,dje,eje,fje,gje,hje,ije,jje,kje,lje,mje]),b);d<0&&(d=oA(a,e,OC(GC(ZI,1),nie,2,6,['Jan','Feb','Mar','Apr',fje,'Jun','Jul','Aug','Sep','Oct','Nov','Dec']),b));if(d<0){return false}c.k=d;return true}else if(d>0){c.k=d-1;return true}return false} +function DA(a,b,c,d,e,f){var g,h,i,j;h=32;if(d<0){if(b[0]>=a.length){return false}h=bfb(a,b[0]);if(h!=43&&h!=45){return false}++b[0];d=rA(a,b);if(d<0){return false}h==45&&(d=-d)}if(h==32&&b[0]-c==2&&e.b==2){i=new eB;j=i.q.getFullYear()-nje+nje-80;g=j%100;f.a=d==g;d+=(j/100|0)*100+(d=j&&(i=d)}!!i&&(k=$wnd.Math.max(k,i.a.o.a));if(k>m){l=j;m=k}}return l} +function ode(a,b,c){var d,e,f;a.e=c;a.d=0;a.b=0;a.f=1;a.i=b;(a.e&16)==16&&(a.i=Xee(a.i));a.j=a.i.length;nde(a);f=rde(a);if(a.d!=a.j)throw vbb(new mde(tvd((h0d(),sue))));if(a.g){for(d=0;dvre?Okb(i,a.b):d<=vre&&d>wre?Okb(i,a.d):d<=wre&&d>xre?Okb(i,a.c):d<=xre&&Okb(i,a.a);f=ZXc(a,i,f)}return e} +function Hgb(){Hgb=ccb;var a;Cgb=new Ugb(1,1);Egb=new Ugb(1,10);Ggb=new Ugb(0,0);Bgb=new Ugb(-1,1);Dgb=OC(GC(cJ,1),nie,91,0,[Ggb,Cgb,new Ugb(1,2),new Ugb(1,3),new Ugb(1,4),new Ugb(1,5),new Ugb(1,6),new Ugb(1,7),new Ugb(1,8),new Ugb(1,9),Egb]);Fgb=KC(cJ,nie,91,32,0,1);for(a=0;a1;if(h){d=new f7c(e,c.b);Dsb(b.a,d)}n7c(b.a,OC(GC(m1,1),nie,8,0,[m,l]))} +function jdd(a){r4c(a,new E3c(P3c(M3c(O3c(N3c(new R3c,Rse),'ELK Randomizer'),'Distributes the nodes randomly on the plane, leading to very obfuscating layouts. Can be useful to demonstrate the power of "real" layout algorithms.'),new mdd)));p4c(a,Rse,ame,fdd);p4c(a,Rse,wme,15);p4c(a,Rse,yme,meb(0));p4c(a,Rse,_le,tme)} +function hde(){hde=ccb;var a,b,c,d,e,f;fde=KC(SD,wte,25,255,15,1);gde=KC(TD,$ie,25,16,15,1);for(b=0;b<255;b++){fde[b]=-1}for(c=57;c>=48;c--){fde[c]=c-48<<24>>24}for(d=70;d>=65;d--){fde[d]=d-65+10<<24>>24}for(e=102;e>=97;e--){fde[e]=e-97+10<<24>>24}for(f=0;f<10;f++)gde[f]=48+f&aje;for(a=10;a<=15;a++)gde[a]=65+a-10&aje} +function BVc(a,b,c){var d,e,f,g,h,i,j,k;h=b.i-a.g/2;i=c.i-a.g/2;j=b.j-a.g/2;k=c.j-a.g/2;f=b.g+a.g/2;g=c.g+a.g/2;d=b.f+a.g/2;e=c.f+a.g/2;if(h>19!=0){return '-'+qD(hD(a))}c=a;d='';while(!(c.l==0&&c.m==0&&c.h==0)){e=RC(Jje);c=UC(c,e,true);b=''+pD(QC);if(!(c.l==0&&c.m==0&&c.h==0)){f=9-b.length;for(;f>0;f--){b='0'+b}}d=b+d}return d} +function xrb(){if(!Object.create||!Object.getOwnPropertyNames){return false}var a='__proto__';var b=Object.create(null);if(b[a]!==undefined){return false}var c=Object.getOwnPropertyNames(b);if(c.length!=0){return false}b[a]=42;if(b[a]!==42){return false}if(Object.getOwnPropertyNames(b).length==0){return false}return true} +function Pgc(a){var b,c,d,e,f,g,h;b=false;c=0;for(e=new olb(a.d.b);e.a=a.a){return -1}if(!F6b(b,c)){return -1}if(Qq(BD(d.Kb(b),20))){return 1}e=0;for(g=BD(d.Kb(b),20).Kc();g.Ob();){f=BD(g.Pb(),17);i=f.c.i==b?f.d.i:f.c.i;h=G6b(a,i,c,d);if(h==-1){return -1}e=$wnd.Math.max(e,h);if(e>a.c-1){return -1}}return e+1} +function Btd(a,b){var c,d,e,f,g,h;if(PD(b)===PD(a)){return true}if(!JD(b,15)){return false}d=BD(b,15);h=a.gc();if(d.gc()!=h){return false}g=d.Kc();if(a.ni()){for(c=0;c0){a.qj();if(b!=null){for(f=0;f>24}case 97:case 98:case 99:case 100:case 101:case 102:{return a-97+10<<24>>24}case 65:case 66:case 67:case 68:case 69:case 70:{return a-65+10<<24>>24}default:{throw vbb(new Oeb('Invalid hexadecimal'))}}} +function AUc(a,b,c){var d,e,f,g;Odd(c,'Processor order nodes',2);a.a=Edb(ED(vNb(b,(JTc(),HTc))));e=new Psb;for(g=Jsb(b.b,0);g.b!=g.d.c;){f=BD(Xsb(g),86);Ccb(DD(vNb(f,(mTc(),jTc))))&&(Gsb(e,f,e.c.b,e.c),true)}d=(sCb(e.b!=0),BD(e.a.a.c,86));yUc(a,d);!c.b&&Rdd(c,1);BUc(a,d,0-Edb(ED(vNb(d,(mTc(),bTc))))/2,0);!c.b&&Rdd(c,1);Qdd(c)} +function rFb(){rFb=ccb;qFb=new sFb('SPIRAL',0);lFb=new sFb('LINE_BY_LINE',1);mFb=new sFb('MANHATTAN',2);kFb=new sFb('JITTER',3);oFb=new sFb('QUADRANTS_LINE_BY_LINE',4);pFb=new sFb('QUADRANTS_MANHATTAN',5);nFb=new sFb('QUADRANTS_JITTER',6);jFb=new sFb('COMBINE_LINE_BY_LINE_MANHATTAN',7);iFb=new sFb('COMBINE_JITTER_MANHATTAN',8)} +function roc(a,b,c,d){var e,f,g,h,i,j;i=woc(a,c);j=woc(b,c);e=false;while(!!i&&!!j){if(d||uoc(i,j,c)){g=woc(i,c);h=woc(j,c);zoc(b);zoc(a);f=i.c;sbc(i,false);sbc(j,false);if(c){Z_b(b,j.p,f);b.p=j.p;Z_b(a,i.p+1,f);a.p=i.p}else{Z_b(a,i.p,f);a.p=i.p;Z_b(b,j.p+1,f);b.p=j.p}$_b(i,null);$_b(j,null);i=g;j=h;e=true}else{break}}return e} +function VDc(a,b,c,d){var e,f,g,h,i;e=false;f=false;for(h=new olb(d.j);h.a=b.length){throw vbb(new qcb('Greedy SwitchDecider: Free layer not in graph.'))}this.c=b[a];this.e=new dIc(d);THc(this.e,this.c,(Ucd(),Tcd));this.i=new dIc(d);THc(this.i,this.c,zcd);this.f=new ejc(this.c);this.a=!f&&e.i&&!e.s&&this.c[0].k==(j0b(),e0b);this.a&&hjc(this,a,b.length)} +function hKb(a,b){var c,d,e,f,g,h;f=!a.B.Hc((Idd(),zdd));g=a.B.Hc(Cdd);a.a=new FHb(g,f,a.c);!!a.n&&u_b(a.a.n,a.n);lIb(a.g,(gHb(),eHb),a.a);if(!b){d=new mIb(1,f,a.c);d.n.a=a.k;Npb(a.p,(Ucd(),Acd),d);e=new mIb(1,f,a.c);e.n.d=a.k;Npb(a.p,Rcd,e);h=new mIb(0,f,a.c);h.n.c=a.k;Npb(a.p,Tcd,h);c=new mIb(0,f,a.c);c.n.b=a.k;Npb(a.p,zcd,c)}} +function Vgc(a){var b,c,d;b=BD(vNb(a.d,(Nyc(),Swc)),218);switch(b.g){case 2:c=Ngc(a);break;case 3:c=(d=new Rkb,MAb(JAb(NAb(LAb(LAb(new YAb(null,new Kub(a.d.b,16)),new Shc),new Uhc),new Whc),new ehc),new Yhc(d)),d);break;default:throw vbb(new Zdb('Compaction not supported for '+b+' edges.'));}Ugc(a,c);reb(new Pib(a.g),new Ehc(a))} +function a2c(a,b){var c;c=new zNb;!!b&&tNb(c,BD(Ohb(a.a,C2),94));JD(b,470)&&tNb(c,BD(Ohb(a.a,G2),94));if(JD(b,354)){tNb(c,BD(Ohb(a.a,D2),94));return c}JD(b,82)&&tNb(c,BD(Ohb(a.a,z2),94));if(JD(b,239)){tNb(c,BD(Ohb(a.a,E2),94));return c}if(JD(b,186)){tNb(c,BD(Ohb(a.a,F2),94));return c}JD(b,352)&&tNb(c,BD(Ohb(a.a,B2),94));return c} +function wSb(){wSb=ccb;oSb=new Osd((Y9c(),D9c),meb(1));uSb=new Osd(T9c,80);tSb=new Osd(M9c,5);bSb=new Osd(r8c,tme);pSb=new Osd(E9c,meb(1));sSb=new Osd(H9c,(Bcb(),true));lSb=new q0b(50);kSb=new Osd(f9c,lSb);dSb=O8c;mSb=t9c;cSb=new Osd(B8c,false);jSb=e9c;iSb=b9c;hSb=Y8c;gSb=W8c;nSb=x9c;fSb=(SRb(),LRb);vSb=QRb;eSb=KRb;qSb=NRb;rSb=PRb} +function ZXb(a){var b,c,d,e,f,g,h,i;i=new jYb;for(h=new olb(a.a);h.a0&&b=0){return false}else{b.p=c.b;Ekb(c.e,b)}if(e==(j0b(),g0b)||e==i0b){for(g=new olb(b.j);g.a1||g==-1)&&(f|=16);(e.Bb&ote)!=0&&(f|=64)}(c.Bb&Tje)!=0&&(f|=Dve);f|=zte}else{if(JD(b,457)){f|=512}else{d=b.Bj();!!d&&(d.i&1)!=0&&(f|=256)}}(a.Bb&512)!=0&&(f|=128);return f} +function hc(a,b){var c,d,e,f,g;a=a==null?Xhe:(uCb(a),a);for(e=0;ea.d[h.p]){c+=zHc(a.b,f);Wjb(a.a,meb(f))}}else{++g}}c+=a.b.d*g;while(!akb(a.a)){xHc(a.b,BD(fkb(a.a),19).a)}}return c} +function Y6d(a,b){var c;if(a.f==W6d){c=$1d(q1d((O6d(),M6d),b));return a.e?c==4&&b!=(m8d(),k8d)&&b!=(m8d(),h8d)&&b!=(m8d(),i8d)&&b!=(m8d(),j8d):c==2}if(!!a.d&&(a.d.Hc(b)||a.d.Hc(_1d(q1d((O6d(),M6d),b)))||a.d.Hc(e1d((O6d(),M6d),a.b,b)))){return true}if(a.f){if(x1d((O6d(),a.f),b2d(q1d(M6d,b)))){c=$1d(q1d(M6d,b));return a.e?c==4:c==2}}return false} +function iVc(a,b,c,d){var e,f,g,h,i,j,k,l;g=BD(hkd(c,(Y9c(),C9c)),8);i=g.a;k=g.b+a;e=$wnd.Math.atan2(k,i);e<0&&(e+=dre);e+=b;e>dre&&(e-=dre);h=BD(hkd(d,C9c),8);j=h.a;l=h.b+a;f=$wnd.Math.atan2(l,j);f<0&&(f+=dre);f+=b;f>dre&&(f-=dre);return Iy(),My(1.0E-10),$wnd.Math.abs(e-f)<=1.0E-10||e==f||isNaN(e)&&isNaN(f)?0:ef?1:Ny(isNaN(e),isNaN(f))} +function YDb(a){var b,c,d,e,f,g,h;h=new Lqb;for(d=new olb(a.a.b);d.a=b.o){throw vbb(new rcb)}i=c>>5;h=c&31;g=Nbb(1,Tbb(Nbb(h,1)));f?(b.n[d][i]=Mbb(b.n[d][i],g)):(b.n[d][i]=xbb(b.n[d][i],Lbb(g)));g=Nbb(g,1);e?(b.n[d][i]=Mbb(b.n[d][i],g)):(b.n[d][i]=xbb(b.n[d][i],Lbb(g)))}catch(a){a=ubb(a);if(JD(a,320)){throw vbb(new qcb(Dle+b.o+'*'+b.p+Ele+c+She+d+Fle))}else throw vbb(a)}} +function BUc(a,b,c,d){var e,f,g;if(b){f=Edb(ED(vNb(b,(mTc(),fTc))))+d;g=c+Edb(ED(vNb(b,bTc)))/2;yNb(b,kTc,meb(Tbb(Cbb($wnd.Math.round(f)))));yNb(b,lTc,meb(Tbb(Cbb($wnd.Math.round(g)))));b.d.b==0||BUc(a,BD(pr((e=Jsb((new ZRc(b)).a.d,0),new aSc(e))),86),c+Edb(ED(vNb(b,bTc)))+a.a,d+Edb(ED(vNb(b,cTc))));vNb(b,iTc)!=null&&BUc(a,BD(vNb(b,iTc),86),c,d)}} +function N9b(a,b){var c,d,e,f,g,h,i,j,k,l,m;i=Q_b(b.a);e=Edb(ED(vNb(i,(Nyc(),pyc))))*2;k=Edb(ED(vNb(i,wyc)));j=$wnd.Math.max(e,k);f=KC(UD,Vje,25,b.f-b.c+1,15,1);d=-j;c=0;for(h=b.b.Kc();h.Ob();){g=BD(h.Pb(),10);d+=a.a[g.c.p]+j;f[c++]=d}d+=a.a[b.a.c.p]+j;f[c++]=d;for(m=new olb(b.e);m.a0){d=(!a.n&&(a.n=new cUd(D2,a,1,7)),BD(qud(a.n,0),137)).a;!d||Qfb(Qfb((b.a+=' "',b),d),'"')}}else{Qfb(Qfb((b.a+=' "',b),c),'"')}Qfb(Lfb(Qfb(Lfb(Qfb(Lfb(Qfb(Lfb((b.a+=' (',b),a.i),','),a.j),' | '),a.g),','),a.f),')');return b.a} +function opd(a){var b,c,d;if((a.Db&64)!=0)return fld(a);b=new Wfb(fte);c=a.k;if(!c){!a.n&&(a.n=new cUd(D2,a,1,7));if(a.n.i>0){d=(!a.n&&(a.n=new cUd(D2,a,1,7)),BD(qud(a.n,0),137)).a;!d||Qfb(Qfb((b.a+=' "',b),d),'"')}}else{Qfb(Qfb((b.a+=' "',b),c),'"')}Qfb(Lfb(Qfb(Lfb(Qfb(Lfb(Qfb(Lfb((b.a+=' (',b),a.i),','),a.j),' | '),a.g),','),a.f),')');return b.a} +function h4c(a,b){var c,d,e,f,g,h,i;if(b==null||b.length==0){return null}e=BD(Phb(a.a,b),149);if(!e){for(d=(h=(new $ib(a.b)).a.vc().Kc(),new djb(h));d.a.Ob();){c=(f=BD(d.a.Pb(),42),BD(f.dd(),149));g=c.c;i=b.length;if(dfb(g.substr(g.length-i,i),b)&&(b.length==g.length||bfb(g,g.length-b.length-1)==46)){if(e){return null}e=c}}!!e&&Shb(a.a,b,e)}return e} +function QLb(a,b){var c,d,e,f;c=new VLb;d=BD(GAb(NAb(new YAb(null,new Kub(a.f,16)),c),Ayb(new hzb,new jzb,new Gzb,new Izb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Eyb),Dyb]))),21);e=d.gc();d=BD(GAb(NAb(new YAb(null,new Kub(b.f,16)),c),Ayb(new hzb,new jzb,new Gzb,new Izb,OC(GC(xL,1),Kie,132,0,[Eyb,Dyb]))),21);f=d.gc();if(ee.p){G0b(f,Rcd);if(f.d){h=f.o.b;b=f.a.b;f.a.b=h-b}}else if(f.j==Rcd&&e.p>a.p){G0b(f,Acd);if(f.d){h=f.o.b;b=f.a.b;f.a.b=-(h-b)}}break}}return e} +function NOc(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o;f=c;if(c1;if(h){d=new f7c(e,c.b);Dsb(b.a,d)}n7c(b.a,OC(GC(m1,1),nie,8,0,[m,l]))} +function Nid(a,b,c){var d,e,f,g,h,i;if(!b){return null}else{if(c<=-1){d=XKd(b.Tg(),-1-c);if(JD(d,99)){return BD(d,18)}else{g=BD(b.ah(d),153);for(h=0,i=g.gc();h0){e=i.length;while(e>0&&i[e-1]==''){--e}e=40;g&&FGb(a);wGb(a);vGb(a);c=zGb(a);d=0;while(!!c&&d0&&Dsb(a.f,f)}else{a.c[g]-=j+1;a.c[g]<=0&&a.a[g]>0&&Dsb(a.e,f)}}}}} +function _Kb(a){var b,c,d,e,f,g,h,i,j;h=new Hxb(BD(Qb(new nLb),62));j=Qje;for(c=new olb(a.d);c.a=0&&ic?b:c;j<=l;++j){if(j==c){h=d++}else{f=e[j];k=o.rl(f.ak());j==b&&(i=j==l&&!k?d-1:d);k&&++d}}m=BD(Wxd(a,b,c),72);h!=i&&GLd(a,new ESd(a.e,7,g,meb(h),n.dd(),i));return m}}}else{return BD(sud(a,b,c),72)}return BD(Wxd(a,b,c),72)} +function Qcc(a,b){var c,d,e,f,g,h,i;Odd(b,'Port order processing',1);i=BD(vNb(a,(Nyc(),_xc)),421);for(d=new olb(a.b);d.a=0){h=bD(a,g);if(h){j<22?(i.l|=1<>>1;g.m=k>>>1|(l&1)<<21;g.l=m>>>1|(k&1)<<21;--j}c&&ZC(i);if(f){if(d){QC=hD(a);e&&(QC=nD(QC,(wD(),uD)))}else{QC=TC(a.l,a.m,a.h)}}return i} +function TDc(a,b){var c,d,e,f,g,h,i,j,k,l;j=a.e[b.c.p][b.p]+1;i=b.c.a.c.length+1;for(h=new olb(a.a);h.a0&&(BCb(0,a.length),a.charCodeAt(0)==45||(BCb(0,a.length),a.charCodeAt(0)==43))?1:0;for(d=g;dc){throw vbb(new Oeb(Oje+a+'"'))}return h} +function dnc(a){var b,c,d,e,f,g,h;g=new Psb;for(f=new olb(a.a);f.a1)&&b==1&&BD(a.a[a.b],10).k==(j0b(),f0b)){zac(BD(a.a[a.b],10),(rbd(),nbd))}else if(d&&(!c||(a.c-a.b&a.a.length-1)>1)&&b==1&&BD(a.a[a.c-1&a.a.length-1],10).k==(j0b(),f0b)){zac(BD(a.a[a.c-1&a.a.length-1],10),(rbd(),obd))}else if((a.c-a.b&a.a.length-1)==2){zac(BD(bkb(a),10),(rbd(),nbd));zac(BD(bkb(a),10),obd)}else{wac(a,e)}Yjb(a)} +function pRc(a,b,c){var d,e,f,g,h;f=0;for(e=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));e.e!=e.i.gc();){d=BD(Dyd(e),33);g='';(!d.n&&(d.n=new cUd(D2,d,1,7)),d.n).i==0||(g=BD(qud((!d.n&&(d.n=new cUd(D2,d,1,7)),d.n),0),137).a);h=new XRc(f++,b,g);tNb(h,d);yNb(h,(mTc(),dTc),d);h.e.b=d.j+d.f/2;h.f.a=$wnd.Math.max(d.g,1);h.e.a=d.i+d.g/2;h.f.b=$wnd.Math.max(d.f,1);Dsb(b.b,h);jrb(c.f,d,h)}} +function B2b(a){var b,c,d,e,f;d=BD(vNb(a,(wtc(),$sc)),33);f=BD(hkd(d,(Nyc(),Fxc)),174).Hc((tdd(),sdd));if(!a.e){e=BD(vNb(a,Ksc),21);b=new f7c(a.f.a+a.d.b+a.d.c,a.f.b+a.d.d+a.d.a);if(e.Hc((Orc(),Hrc))){jkd(d,Vxc,(dcd(),$bd));Afd(d,b.a,b.b,false,true)}else{Ccb(DD(hkd(d,Gxc)))||Afd(d,b.a,b.b,true,true)}}f?jkd(d,Fxc,pqb(sdd)):jkd(d,Fxc,(c=BD(gdb(I1),9),new xqb(c,BD(_Bb(c,c.length),9),0)))} +function tA(a,b,c){var d,e,f,g;if(b[0]>=a.length){c.o=0;return true}switch(bfb(a,b[0])){case 43:e=1;break;case 45:e=-1;break;default:c.o=0;return true;}++b[0];f=b[0];g=rA(a,b);if(g==0&&b[0]==f){return false}if(b[0]=0&&h!=c){f=new nSd(a,1,h,g,null);!d?(d=f):d.Ei(f)}if(c>=0){f=new nSd(a,1,c,h==c?g:null,b);!d?(d=f):d.Ei(f)}}return d} +function LEd(a){var b,c,d;if(a.b==null){d=new Hfb;if(a.i!=null){Efb(d,a.i);d.a+=':'}if((a.f&256)!=0){if((a.f&256)!=0&&a.a!=null){YEd(a.i)||(d.a+='//',d);Efb(d,a.a)}if(a.d!=null){d.a+='/';Efb(d,a.d)}(a.f&16)!=0&&(d.a+='/',d);for(b=0,c=a.j.length;bm){return false}l=(i=MZc(d,m,false),i.a);if(k+h+l<=b.b){KZc(c,f-c.s);c.c=true;KZc(d,f-c.s);OZc(d,c.s,c.t+c.d+h);d.k=true;WZc(c.q,d);n=true;if(e){s$c(b,d);d.j=b;if(a.c.length>g){v$c((tCb(g,a.c.length),BD(a.c[g],200)),d);(tCb(g,a.c.length),BD(a.c[g],200)).a.c.length==0&&Kkb(a,g)}}}return n} +function kcc(a,b){var c,d,e,f,g,h;Odd(b,'Partition midprocessing',1);e=new Hp;MAb(JAb(new YAb(null,new Kub(a.a,16)),new occ),new qcc(e));if(e.d==0){return}h=BD(GAb(UAb((f=e.i,new YAb(null,(!f?(e.i=new zf(e,e.c)):f).Nc()))),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);d=h.Kc();c=BD(d.Pb(),19);while(d.Ob()){g=BD(d.Pb(),19);jcc(BD(Qc(e,c),21),BD(Qc(e,g),21));c=g}Qdd(b)} +function DYb(a,b,c){var d,e,f,g,h,i,j,k;if(b.p==0){b.p=1;g=c;if(!g){e=new Rkb;f=(d=BD(gdb(F1),9),new xqb(d,BD(_Bb(d,d.length),9),0));g=new vgd(e,f)}BD(g.a,15).Fc(b);b.k==(j0b(),e0b)&&BD(g.b,21).Fc(BD(vNb(b,(wtc(),Hsc)),61));for(i=new olb(b.j);i.a0){e=BD(a.Ab.g,1934);if(b==null){for(f=0;f1){for(d=new olb(e);d.ac.s&&hh){h=e;k.c=KC(SI,Uhe,1,0,5,1)}e==h&&Ekb(k,new vgd(c.c.i,c))}mmb();Okb(k,a.c);Dkb(a.b,i.p,k)}}} +function MMc(a,b){var c,d,e,f,g,h,i,j,k;for(g=new olb(b.b);g.ah){h=e;k.c=KC(SI,Uhe,1,0,5,1)}e==h&&Ekb(k,new vgd(c.d.i,c))}mmb();Okb(k,a.c);Dkb(a.f,i.p,k)}}} +function Y7c(a){r4c(a,new E3c(P3c(M3c(O3c(N3c(new R3c,qse),'ELK Box'),'Algorithm for packing of unconnected boxes, i.e. graphs without edges.'),new _7c)));p4c(a,qse,ame,U7c);p4c(a,qse,wme,15);p4c(a,qse,vme,meb(0));p4c(a,qse,Jre,Ksd(O7c));p4c(a,qse,Fme,Ksd(Q7c));p4c(a,qse,Eme,Ksd(S7c));p4c(a,qse,_le,pse);p4c(a,qse,Ame,Ksd(P7c));p4c(a,qse,Tme,Ksd(R7c));p4c(a,qse,rse,Ksd(M7c));p4c(a,qse,lqe,Ksd(N7c))} +function W$b(a,b){var c,d,e,f,g,h,i,j,k;e=a.i;g=e.o.a;f=e.o.b;if(g<=0&&f<=0){return Ucd(),Scd}j=a.n.a;k=a.n.b;h=a.o.a;c=a.o.b;switch(b.g){case 2:case 1:if(j<0){return Ucd(),Tcd}else if(j+h>g){return Ucd(),zcd}break;case 4:case 3:if(k<0){return Ucd(),Acd}else if(k+c>f){return Ucd(),Rcd}}i=(j+h/2)/g;d=(k+c/2)/f;return i+d<=1&&i-d<=0?(Ucd(),Tcd):i+d>=1&&i-d>=0?(Ucd(),zcd):d<0.5?(Ucd(),Acd):(Ucd(),Rcd)} +function pJc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;c=false;k=Edb(ED(vNb(b,(Nyc(),vyc))));o=Qie*k;for(e=new olb(b.b);e.ai+o){p=l.g+m.g;m.a=(m.g*m.a+l.g*l.a)/p;m.g=p;l.f=m;c=true}}f=h;l=m}}return c} +function VGb(a,b,c,d,e,f,g){var h,i,j,k,l,m;m=new I6c;for(j=b.Kc();j.Ob();){h=BD(j.Pb(),839);for(l=new olb(h.wf());l.a0){if(h.a){j=h.b.rf().b;if(e>j){if(a.v||h.c.d.c.length==1){g=(e-j)/2;h.d.d=g;h.d.a=g}else{c=BD(Ikb(h.c.d,0),181).rf().b;d=(c-j)/2;h.d.d=$wnd.Math.max(0,d);h.d.a=e-d-j}}}else{h.d.a=a.t+e}}else if(tcd(a.u)){f=sfd(h.b);f.d<0&&(h.d.d=-f.d);f.d+f.a>h.b.rf().b&&(h.d.a=f.d+f.a-h.b.rf().b)}}} +function FC(a,b){var c;switch(HC(a)){case 6:return ND(b);case 7:return LD(b);case 8:return KD(b);case 3:return Array.isArray(b)&&(c=HC(b),!(c>=14&&c<=16));case 11:return b!=null&&typeof b===Nhe;case 12:return b!=null&&(typeof b===Jhe||typeof b==Nhe);case 0:return AD(b,a.__elementTypeId$);case 2:return OD(b)&&!(b.im===gcb);case 1:return OD(b)&&!(b.im===gcb)||AD(b,a.__elementTypeId$);default:return true;}} +function xOb(a,b){var c,d,e,f;d=$wnd.Math.min($wnd.Math.abs(a.c-(b.c+b.b)),$wnd.Math.abs(a.c+a.b-b.c));f=$wnd.Math.min($wnd.Math.abs(a.d-(b.d+b.a)),$wnd.Math.abs(a.d+a.a-b.d));c=$wnd.Math.abs(a.c+a.b/2-(b.c+b.b/2));if(c>a.b/2+b.b/2){return 1}e=$wnd.Math.abs(a.d+a.a/2-(b.d+b.a/2));if(e>a.a/2+b.a/2){return 1}if(c==0&&e==0){return 0}if(c==0){return f/e+1}if(e==0){return d/c+1}return $wnd.Math.min(d/c,f/e)+1} +function mgb(a,b){var c,d,e,f,g,h;e=pgb(a);h=pgb(b);if(e==h){if(a.e==b.e&&a.a<54&&b.a<54){return a.fb.f?1:0}d=a.e-b.e;c=(a.d>0?a.d:$wnd.Math.floor((a.a-1)*Xje)+1)-(b.d>0?b.d:$wnd.Math.floor((b.a-1)*Xje)+1);if(c>d+1){return e}else if(c0&&(g=Ogb(g,Khb(d)));return Igb(f,g)}}else return e0&&a.d!=(yTb(),xTb)&&(h+=g*(d.d.a+a.a[b.b][d.b]*(b.d.a-d.d.a)/c));c>0&&a.d!=(yTb(),vTb)&&(i+=g*(d.d.b+a.a[b.b][d.b]*(b.d.b-d.d.b)/c))}switch(a.d.g){case 1:return new f7c(h/f,b.d.b);case 2:return new f7c(b.d.a,i/f);default:return new f7c(h/f,i/f);}} +function Wcc(a,b){Occ();var c,d,e,f,g;g=BD(vNb(a.i,(Nyc(),Vxc)),98);f=a.j.g-b.j.g;if(f!=0||!(g==(dcd(),Zbd)||g==_bd||g==$bd)){return 0}if(g==(dcd(),Zbd)){c=BD(vNb(a,Wxc),19);d=BD(vNb(b,Wxc),19);if(!!c&&!!d){e=c.a-d.a;if(e!=0){return e}}}switch(a.j.g){case 1:return Kdb(a.n.a,b.n.a);case 2:return Kdb(a.n.b,b.n.b);case 3:return Kdb(b.n.a,a.n.a);case 4:return Kdb(b.n.b,a.n.b);default:throw vbb(new Zdb(ine));}} +function tfd(a){var b,c,d,e,f,g;c=(!a.a&&(a.a=new xMd(y2,a,5)),a.a).i+2;g=new Skb(c);Ekb(g,new f7c(a.j,a.k));MAb(new YAb(null,(!a.a&&(a.a=new xMd(y2,a,5)),new Kub(a.a,16))),new Qfd(g));Ekb(g,new f7c(a.b,a.c));b=1;while(b0){jEb(i,false,(ead(),aad));jEb(i,true,bad)}Hkb(b.g,new $hc(a,c));Rhb(a.g,b,c)} +function Neb(){Neb=ccb;var a;Jeb=OC(GC(WD,1),oje,25,15,[-1,-1,30,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5]);Keb=KC(WD,oje,25,37,15,1);Leb=OC(GC(WD,1),oje,25,15,[-1,-1,63,40,32,28,25,23,21,20,19,19,18,18,17,17,16,16,16,15,15,15,15,14,14,14,14,14,14,13,13,13,13,13,13,13,13]);Meb=KC(XD,Sje,25,37,14,1);for(a=2;a<=36;a++){Keb[a]=QD($wnd.Math.pow(a,Jeb[a]));Meb[a]=Abb(rie,Keb[a])}} +function pfd(a){var b;if((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i!=1){throw vbb(new Wdb(Tse+(!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i))}b=new s7c;!!btd(BD(qud((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b),0),82))&&ye(b,qfd(a,btd(BD(qud((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b),0),82)),false));!!btd(BD(qud((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c),0),82))&&ye(b,qfd(a,btd(BD(qud((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c),0),82)),true));return b} +function _Mc(a,b){var c,d,e,f,g;b.d?(e=a.a.c==(YLc(),XLc)?R_b(b.b):U_b(b.b)):(e=a.a.c==(YLc(),WLc)?R_b(b.b):U_b(b.b));f=false;for(d=new Sr(ur(e.a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);g=Ccb(a.a.f[a.a.g[b.b.p].p]);if(!g&&!OZb(c)&&c.c.i.c==c.d.i.c){continue}if(Ccb(a.a.n[a.a.g[b.b.p].p])||Ccb(a.a.n[a.a.g[b.b.p].p])){continue}f=true;if(Rqb(a.b,a.a.g[TMc(c,b.b).p])){b.c=true;b.a=c;return b}}b.c=f;b.a=null;return b} +function bed(a,b,c,d,e){var f,g,h,i,j,k,l;mmb();Okb(a,new Red);h=new Bib(a,0);l=new Rkb;f=0;while(h.bf*2){k=new wed(l);j=red(g)/qed(g);i=fed(k,b,new p0b,c,d,e,j);P6c(X6c(k.e),i);l.c=KC(SI,Uhe,1,0,5,1);f=0;l.c[l.c.length]=k;l.c[l.c.length]=g;f=red(k)*qed(k)+red(g)*qed(g)}else{l.c[l.c.length]=g;f+=red(g)*qed(g)}}return l} +function qwd(a,b,c){var d,e,f,g,h,i,j;d=c.gc();if(d==0){return false}else{if(a.ej()){i=a.fj();zvd(a,b,c);g=d==1?a.Zi(3,null,c.Kc().Pb(),b,i):a.Zi(5,null,c,b,i);if(a.bj()){h=d<100?null:new Ixd(d);f=b+d;for(e=b;e0){for(g=0;g>16==-15&&a.Cb.nh()&&Rwd(new oSd(a.Cb,9,13,c,a.c,HLd(QSd(BD(a.Cb,59)),a)))}else if(JD(a.Cb,88)){if(a.Db>>16==-23&&a.Cb.nh()){b=a.c;JD(b,88)||(b=(jGd(),_Fd));JD(c,88)||(c=(jGd(),_Fd));Rwd(new oSd(a.Cb,9,10,c,b,HLd(VKd(BD(a.Cb,26)),a)))}}}}return a.c} +function f7b(a,b){var c,d,e,f,g,h,i,j,k,l;Odd(b,'Hypernodes processing',1);for(e=new olb(a.b);e.ac);return e} +function XFc(a,b){var c,d,e;d=Cub(a.d,1)!=0;!Ccb(DD(vNb(b.j,(wtc(),Jsc))))&&!Ccb(DD(vNb(b.j,mtc)))||PD(vNb(b.j,(Nyc(),ywc)))===PD((tAc(),rAc))?b.c.Tf(b.e,d):(d=Ccb(DD(vNb(b.j,Jsc))));dGc(a,b,d,true);Ccb(DD(vNb(b.j,mtc)))&&yNb(b.j,mtc,(Bcb(),false));if(Ccb(DD(vNb(b.j,Jsc)))){yNb(b.j,Jsc,(Bcb(),false));yNb(b.j,mtc,true)}c=NFc(a,b);do{$Fc(a);if(c==0){return 0}d=!d;e=c;dGc(a,b,d,false);c=NFc(a,b)}while(e>c);return e} +function uNd(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;if(b==c){return true}else{b=vNd(a,b);c=vNd(a,c);d=JQd(b);if(d){k=JQd(c);if(k!=d){if(!k){return false}else{i=d.Dj();o=k.Dj();return i==o&&i!=null}}else{g=(!b.d&&(b.d=new xMd(j5,b,1)),b.d);f=g.i;m=(!c.d&&(c.d=new xMd(j5,c,1)),c.d);if(f==m.i){for(j=0;j0;h=xFb(b,f);c?OFb(h.b,b):OFb(h.g,b);LFb(h).c.length==1&&(Gsb(d,h,d.c.b,d.c),true);e=new vgd(f,b);Wjb(a.o,e);Lkb(a.e.a,f)}} +function _Nb(a,b){var c,d,e,f,g,h,i;d=$wnd.Math.abs(D6c(a.b).a-D6c(b.b).a);h=$wnd.Math.abs(D6c(a.b).b-D6c(b.b).b);e=0;i=0;c=1;g=1;if(d>a.b.b/2+b.b.b/2){e=$wnd.Math.min($wnd.Math.abs(a.b.c-(b.b.c+b.b.b)),$wnd.Math.abs(a.b.c+a.b.b-b.b.c));c=1-e/d}if(h>a.b.a/2+b.b.a/2){i=$wnd.Math.min($wnd.Math.abs(a.b.d-(b.b.d+b.b.a)),$wnd.Math.abs(a.b.d+a.b.a-b.b.d));g=1-i/h}f=$wnd.Math.min(c,g);return (1-f)*$wnd.Math.sqrt(d*d+h*h)} +function lQc(a){var b,c,d,e;nQc(a,a.e,a.f,(FQc(),DQc),true,a.c,a.i);nQc(a,a.e,a.f,DQc,false,a.c,a.i);nQc(a,a.e,a.f,EQc,true,a.c,a.i);nQc(a,a.e,a.f,EQc,false,a.c,a.i);mQc(a,a.c,a.e,a.f,a.i);d=new Bib(a.i,0);while(d.b=65;c--){$ce[c]=c-65<<24>>24}for(d=122;d>=97;d--){$ce[d]=d-97+26<<24>>24}for(e=57;e>=48;e--){$ce[e]=e-48+52<<24>>24}$ce[43]=62;$ce[47]=63;for(f=0;f<=25;f++)_ce[f]=65+f&aje;for(g=26,i=0;g<=51;++g,i++)_ce[g]=97+i&aje;for(a=52,h=0;a<=61;++a,h++)_ce[a]=48+h&aje;_ce[62]=43;_ce[63]=47} +function FXb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;if(a.dc()){return new d7c}j=0;l=0;for(e=a.Kc();e.Ob();){d=BD(e.Pb(),37);f=d.f;j=$wnd.Math.max(j,f.a);l+=f.a*f.b}j=$wnd.Math.max(j,$wnd.Math.sqrt(l)*Edb(ED(vNb(BD(a.Kc().Pb(),37),(Nyc(),owc)))));m=0;n=0;i=0;c=b;for(h=a.Kc();h.Ob();){g=BD(h.Pb(),37);k=g.f;if(m+k.a>j){m=0;n+=i+b;i=0}uXb(g,m,n);c=$wnd.Math.max(c,m+k.a);i=$wnd.Math.max(i,k.b);m+=k.a+b}return new f7c(c+b,n+i+b)} +function mQc(a,b,c,d,e){var f,g,h,i,j,k,l;for(g=new olb(b);g.af){return Ucd(),zcd}break;case 4:case 3:if(i<0){return Ucd(),Acd}else if(i+a.f>e){return Ucd(),Rcd}}g=(h+a.g/2)/f;c=(i+a.f/2)/e;return g+c<=1&&g-c<=0?(Ucd(),Tcd):g+c>=1&&g-c>=0?(Ucd(),zcd):c<0.5?(Ucd(),Acd):(Ucd(),Rcd)} +function vhb(a,b,c,d,e){var f,g;f=wbb(xbb(b[0],Yje),xbb(d[0],Yje));a[0]=Tbb(f);f=Obb(f,32);if(c>=e){for(g=1;g0){e.b[g++]=0;e.b[g++]=f.b[0]-1}for(b=1;b0){pOc(i,i.d-e.d);e.c==(HOc(),FOc)&&nOc(i,i.a-e.d);i.d<=0&&i.i>0&&(Gsb(b,i,b.c.b,b.c),true)}}}for(f=new olb(a.f);f.a0){qOc(h,h.i-e.d);e.c==(HOc(),FOc)&&oOc(h,h.b-e.d);h.i<=0&&h.d>0&&(Gsb(c,h,c.c.b,c.c),true)}}}} +function gSc(a,b,c){var d,e,f,g,h,i,j,k;Odd(c,'Processor compute fanout',1);Uhb(a.b);Uhb(a.a);h=null;f=Jsb(b.b,0);while(!h&&f.b!=f.d.c){j=BD(Xsb(f),86);Ccb(DD(vNb(j,(mTc(),jTc))))&&(h=j)}i=new Psb;Gsb(i,h,i.c.b,i.c);fSc(a,i);for(k=Jsb(b.b,0);k.b!=k.d.c;){j=BD(Xsb(k),86);g=GD(vNb(j,(mTc(),$Sc)));e=Phb(a.b,g)!=null?BD(Phb(a.b,g),19).a:0;yNb(j,ZSc,meb(e));d=1+(Phb(a.a,g)!=null?BD(Phb(a.a,g),19).a:0);yNb(j,XSc,meb(d))}Qdd(c)} +function WPc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o;m=VPc(a,c);for(i=0;i0);d.a.Xb(d.c=--d.b);l>m+i&&uib(d)}for(g=new olb(n);g.a0);d.a.Xb(d.c=--d.b)}}}} +function Jfe(){wfe();var a,b,c,d,e,f;if(gfe)return gfe;a=(++vfe,new $fe(4));Xfe(a,Kfe(vxe,true));Zfe(a,Kfe('M',true));Zfe(a,Kfe('C',true));f=(++vfe,new $fe(4));for(d=0;d<11;d++){Ufe(f,d,d)}b=(++vfe,new $fe(4));Xfe(b,Kfe('M',true));Ufe(b,4448,4607);Ufe(b,65438,65439);e=(++vfe,new Lge(2));Kge(e,a);Kge(e,ffe);c=(++vfe,new Lge(2));c.$l(Bfe(f,Kfe('L',true)));c.$l(b);c=(++vfe,new lge(3,c));c=(++vfe,new rge(e,c));gfe=c;return gfe} +function S3c(a){var b,c;b=GD(hkd(a,(Y9c(),o8c)));if(T3c(b,a)){return}if(!ikd(a,F9c)&&((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a).i!=0||Ccb(DD(hkd(a,M8c))))){if(b==null||ufb(b).length==0){if(!T3c(sne,a)){c=Qfb(Qfb(new Wfb('Unable to load default layout algorithm '),sne),' for unconfigured node ');yfd(a,c);throw vbb(new y2c(c.a))}}else{c=Qfb(Qfb(new Wfb("Layout algorithm '"),b),"' not found for ");yfd(a,c);throw vbb(new y2c(c.a))}}} +function hIb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;c=a.i;b=a.n;if(a.b==0){n=c.c+b.b;m=c.b-b.b-b.c;for(g=a.a,i=0,k=g.length;i0){l-=d[0]+a.c;d[0]+=a.c}d[2]>0&&(l-=d[2]+a.c);d[1]=$wnd.Math.max(d[1],l);mHb(a.a[1],c.c+b.b+d[0]-(d[1]-l)/2,d[1])}for(f=a.a,h=0,j=f.length;h0?(a.n.c.length-1)*a.i:0;for(d=new olb(a.n);d.a1){for(d=Jsb(e,0);d.b!=d.d.c;){c=BD(Xsb(d),231);f=0;for(i=new olb(c.e);i.a0){b[0]+=a.c;l-=b[0]}b[2]>0&&(l-=b[2]+a.c);b[1]=$wnd.Math.max(b[1],l);nHb(a.a[1],d.d+c.d+b[0]-(b[1]-l)/2,b[1])}else{o=d.d+c.d;n=d.a-c.d-c.a;for(g=a.a,i=0,k=g.length;i=0&&f!=c){throw vbb(new Wdb(kue))}}e=0;for(i=0;i0||Jy(e.b.d,a.b.d+a.b.a)==0&&d.b<0||Jy(e.b.d+e.b.a,a.b.d)==0&&d.b>0){h=0;break}}else{h=$wnd.Math.min(h,YNb(a,e,d))}h=$wnd.Math.min(h,ONb(a,f,h,d))}return h} +function ifd(a,b){var c,d,e,f,g,h,i;if(a.b<2){throw vbb(new Wdb('The vector chain must contain at least a source and a target point.'))}e=(sCb(a.b!=0),BD(a.a.a.c,8));nmd(b,e.a,e.b);i=new Oyd((!b.a&&(b.a=new xMd(y2,b,5)),b.a));g=Jsb(a,1);while(g.aEdb(REc(g.g,g.d[0]).a)){sCb(i.b>0);i.a.Xb(i.c=--i.b);Aib(i,g);e=true}else if(!!h.e&&h.e.gc()>0){f=(!h.e&&(h.e=new Rkb),h.e).Mc(b);j=(!h.e&&(h.e=new Rkb),h.e).Mc(c);if(f||j){(!h.e&&(h.e=new Rkb),h.e).Fc(g);++g.c}}}e||(d.c[d.c.length]=g,true)} +function odc(a){var b,c,d;if(fcd(BD(vNb(a,(Nyc(),Vxc)),98))){for(c=new olb(a.j);c.a>>0,'0'+b.toString(16));d='\\x'+qfb(c,c.length-2,c.length)}else if(a>=Tje){c=(b=a>>>0,'0'+b.toString(16));d='\\v'+qfb(c,c.length-6,c.length)}else d=''+String.fromCharCode(a&aje);}return d} +function yhb(a,b){var c,d,e,f,g,h,i,j,k,l;g=a.e;i=b.e;if(i==0){return a}if(g==0){return b.e==0?b:new Vgb(-b.e,b.d,b.a)}f=a.d;h=b.d;if(f+h==2){c=xbb(a.a[0],Yje);d=xbb(b.a[0],Yje);g<0&&(c=Jbb(c));i<0&&(d=Jbb(d));return ghb(Qbb(c,d))}e=f!=h?f>h?1:-1:whb(a.a,b.a,f);if(e==-1){l=-i;k=g==i?zhb(b.a,h,a.a,f):uhb(b.a,h,a.a,f)}else{l=g;if(g==i){if(e==0){return Hgb(),Ggb}k=zhb(a.a,f,b.a,h)}else{k=uhb(a.a,f,b.a,h)}}j=new Vgb(l,k.length,k);Jgb(j);return j} +function YPc(a){var b,c,d,e,f,g;this.e=new Rkb;this.a=new Rkb;for(c=a.b-1;c<3;c++){St(a,0,BD(Ut(a,0),8))}if(a.b<4){throw vbb(new Wdb('At (least dimension + 1) control points are necessary!'))}else{this.b=3;this.d=true;this.c=false;TPc(this,a.b+this.b-1);g=new Rkb;f=new olb(this.e);for(b=0;b=b.o&&c.f<=b.f||b.a*0.5<=c.f&&b.a*1.5>=c.f){g=BD(Ikb(b.n,b.n.c.length-1),211);if(g.e+g.d+c.g+e<=d&&(f=BD(Ikb(b.n,b.n.c.length-1),211),f.f-a.f+c.f<=a.b||a.a.c.length==1)){EZc(b,c);return true}else if(b.s+c.g<=d&&(b.t+b.d+c.f+e<=a.b||a.a.c.length==1)){Ekb(b.b,c);h=BD(Ikb(b.n,b.n.c.length-1),211);Ekb(b.n,new VZc(b.s,h.f+h.a+b.i,b.i));QZc(BD(Ikb(b.n,b.n.c.length-1),211),c);GZc(b,c);return true}}return false} +function Zxd(a,b,c){var d,e,f,g;if(a.ej()){e=null;f=a.fj();d=a.Zi(1,g=uud(a,b,c),c,b,f);if(a.bj()&&!(a.ni()&&g!=null?pb(g,c):PD(g)===PD(c))){g!=null&&(e=a.dj(g,e));e=a.cj(c,e);a.ij()&&(e=a.lj(g,c,e));if(!e){a.$i(d)}else{e.Ei(d);e.Fi()}}else{a.ij()&&(e=a.lj(g,c,e));if(!e){a.$i(d)}else{e.Ei(d);e.Fi()}}return g}else{g=uud(a,b,c);if(a.bj()&&!(a.ni()&&g!=null?pb(g,c):PD(g)===PD(c))){e=null;g!=null&&(e=a.dj(g,null));e=a.cj(c,e);!!e&&e.Fi()}return g}} +function YA(a,b){var c,d,e,f,g,h,i,j;b%=24;if(a.q.getHours()!=b){d=new $wnd.Date(a.q.getTime());d.setDate(d.getDate()+1);h=a.q.getTimezoneOffset()-d.getTimezoneOffset();if(h>0){i=h/60|0;j=h%60;e=a.q.getDate();c=a.q.getHours();c+i>=24&&++e;f=new $wnd.Date(a.q.getFullYear(),a.q.getMonth(),e,b+i,a.q.getMinutes()+j,a.q.getSeconds(),a.q.getMilliseconds());a.q.setTime(f.getTime())}}g=a.q.getTime();a.q.setTime(g+3600000);a.q.getHours()!=b&&a.q.setTime(g)} +function opc(a,b){var c,d,e,f,g;Odd(b,'Path-Like Graph Wrapping',1);if(a.b.c.length==0){Qdd(b);return}e=new Xoc(a);g=(e.i==null&&(e.i=Soc(e,new Zoc)),Edb(e.i)*e.f);c=g/(e.i==null&&(e.i=Soc(e,new Zoc)),Edb(e.i));if(e.b>c){Qdd(b);return}switch(BD(vNb(a,(Nyc(),Gyc)),337).g){case 2:f=new hpc;break;case 0:f=new Ync;break;default:f=new kpc;}d=f.Vf(a,e);if(!f.Wf()){switch(BD(vNb(a,Myc),338).g){case 2:d=tpc(e,d);break;case 1:d=rpc(e,d);}}npc(a,e,d);Qdd(b)} +function MFc(a,b){var c,d,e,f;Fub(a.d,a.e);a.c.a.$b();if(Edb(ED(vNb(b.j,(Nyc(),uwc))))!=0||Edb(ED(vNb(b.j,uwc)))!=0){c=dme;PD(vNb(b.j,ywc))!==PD((tAc(),rAc))&&yNb(b.j,(wtc(),Jsc),(Bcb(),true));f=BD(vNb(b.j,Ayc),19).a;for(e=0;ee&&++j;Ekb(g,(tCb(h+j,b.c.length),BD(b.c[h+j],19)));i+=(tCb(h+j,b.c.length),BD(b.c[h+j],19)).a-d;++c;while(c1&&(i>red(h)*qed(h)/2||g.b==0)){l=new wed(m);k=red(h)/qed(h);j=fed(l,b,new p0b,c,d,e,k);P6c(X6c(l.e),j);h=l;n.c[n.c.length]=l;i=0;m.c=KC(SI,Uhe,1,0,5,1)}}}Gkb(n,m);return n} +function y6d(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p;if(c.mh(b)){k=(n=b,!n?null:BD(d,49).xh(n));if(k){p=c.bh(b,a.a);o=b.t;if(o>1||o==-1){l=BD(p,69);m=BD(k,69);if(l.dc()){m.$b()}else{g=!!zUd(b);f=0;for(h=a.a?l.Kc():l.Zh();h.Ob();){j=BD(h.Pb(),56);e=BD(Wrb(a,j),56);if(!e){if(a.b&&!g){m.Xh(f,j);++f}}else{if(g){i=m.Xc(e);i==-1?m.Xh(f,e):f!=i&&m.ji(f,e)}else{m.Xh(f,e)}++f}}}}else{if(p==null){k.Wb(null)}else{e=Wrb(a,p);e==null?a.b&&!zUd(b)&&k.Wb(p):k.Wb(e)}}}}} +function E6b(a,b){var c,d,e,f,g,h,i,j;c=new L6b;for(e=new Sr(ur(R_b(b).a.Kc(),new Sq));Qr(e);){d=BD(Rr(e),17);if(OZb(d)){continue}h=d.c.i;if(F6b(h,C6b)){j=G6b(a,h,C6b,B6b);if(j==-1){continue}c.b=$wnd.Math.max(c.b,j);!c.a&&(c.a=new Rkb);Ekb(c.a,h)}}for(g=new Sr(ur(U_b(b).a.Kc(),new Sq));Qr(g);){f=BD(Rr(g),17);if(OZb(f)){continue}i=f.d.i;if(F6b(i,B6b)){j=G6b(a,i,B6b,C6b);if(j==-1){continue}c.d=$wnd.Math.max(c.d,j);!c.c&&(c.c=new Rkb);Ekb(c.c,i)}}return c} +function Khb(a){Dhb();var b,c,d,e;b=QD(a);if(a1000000){throw vbb(new ocb('power of ten too big'))}if(a<=Ohe){return Qgb(Pgb(Bhb[1],b),b)}d=Pgb(Bhb[1],Ohe);e=d;c=Cbb(a-Ohe);b=QD(a%Ohe);while(ybb(c,Ohe)>0){e=Ogb(e,d);c=Qbb(c,Ohe)}e=Ogb(e,Pgb(Bhb[1],b));e=Qgb(e,Ohe);c=Cbb(a-Ohe);while(ybb(c,Ohe)>0){e=Qgb(e,Ohe);c=Qbb(c,Ohe)}e=Qgb(e,b);return e} +function X5b(a,b){var c,d,e,f,g,h,i,j,k;Odd(b,'Hierarchical port dummy size processing',1);i=new Rkb;k=new Rkb;d=Edb(ED(vNb(a,(Nyc(),myc))));c=d*2;for(f=new olb(a.b);f.aj&&d>j){k=h;j=Edb(b.p[h.p])+Edb(b.d[h.p])+h.o.b+h.d.a}else{e=false;c.n&&Sdd(c,'bk node placement breaks on '+h+' which should have been after '+k);break}}if(!e){break}}c.n&&Sdd(c,b+' is feasible: '+e);return e} +function XNc(a,b,c,d){var e,f,g,h,i,j,k;h=-1;for(k=new olb(a);k.a=q&&a.e[i.p]>o*a.b||t>=c*q){m.c[m.c.length]=h;h=new Rkb;ye(g,f);f.a.$b();j-=k;n=$wnd.Math.max(n,j*a.b+p);j+=t;s=t;t=0;k=0;p=0}}return new vgd(n,m)} +function q4c(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;for(c=(j=(new $ib(a.c.b)).a.vc().Kc(),new djb(j));c.a.Ob();){b=(h=BD(c.a.Pb(),42),BD(h.dd(),149));e=b.a;e==null&&(e='');d=i4c(a.c,e);!d&&e.length==0&&(d=u4c(a));!!d&&!ze(d.c,b,false)&&Dsb(d.c,b)}for(g=Jsb(a.a,0);g.b!=g.d.c;){f=BD(Xsb(g),478);k=j4c(a.c,f.a);n=j4c(a.c,f.b);!!k&&!!n&&Dsb(k.c,new vgd(n,f.c))}Osb(a.a);for(m=Jsb(a.b,0);m.b!=m.d.c;){l=BD(Xsb(m),478);b=g4c(a.c,l.a);i=j4c(a.c,l.b);!!b&&!!i&&B3c(b,i,l.c)}Osb(a.b)} +function qvd(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;f=new fC(a);g=new ird;e=(ko(g.g),ko(g.j),Uhb(g.b),ko(g.d),ko(g.i),Uhb(g.k),Uhb(g.c),Uhb(g.e),n=drd(g,f,null),ard(g,f),n);if(b){j=new fC(b);h=rvd(j);jfd(e,OC(GC(g2,1),Uhe,527,0,[h]))}m=false;l=false;if(c){j=new fC(c);que in j.a&&(m=aC(j,que).ge().a);rue in j.a&&(l=aC(j,rue).ge().a)}k=Vdd(Xdd(new Zdd,m),l);t2c(new w2c,e,k);que in f.a&&cC(f,que,null);if(m||l){i=new eC;nvd(k,i,m,l);cC(f,que,i)}d=new Prd(g);Ghe(new _ud(e),d)} +function pA(a,b,c){var d,e,f,g,h,i,j,k,l;g=new nB;j=OC(GC(WD,1),oje,25,15,[0]);e=-1;f=0;d=0;for(i=0;i0){if(e<0&&k.a){e=i;f=j[0];d=0}if(e>=0){h=k.b;if(i==e){h-=d++;if(h==0){return 0}}if(!wA(b,j,k,h,g)){i=e-1;j[0]=f;continue}}else{e=-1;if(!wA(b,j,k,0,g)){return 0}}}else{e=-1;if(bfb(k.c,0)==32){l=j[0];uA(b,j);if(j[0]>l){continue}}else if(ofb(b,k.c,j[0])){j[0]+=k.c.length;continue}return 0}}if(!mB(g,c)){return 0}return j[0]} +function SKd(a){var b,c,d,e,f,g,h,i;if(!a.f){i=new CNd;h=new CNd;b=KKd;g=b.a.zc(a,b);if(g==null){for(f=new Fyd(_Kd(a));f.e!=f.i.gc();){e=BD(Dyd(f),26);ytd(i,SKd(e))}b.a.Bc(a)!=null;b.a.gc()==0&&undefined}for(d=(!a.s&&(a.s=new cUd(t5,a,21,17)),new Fyd(a.s));d.e!=d.i.gc();){c=BD(Dyd(d),170);JD(c,99)&&wtd(h,BD(c,18))}vud(h);a.r=new UNd(a,(BD(qud(ZKd((NFd(),MFd).o),6),18),h.i),h.g);ytd(i,a.r);vud(i);a.f=new nNd((BD(qud(ZKd(MFd.o),5),18),i.i),i.g);$Kd(a).b&=-3}return a.f} +function rMb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;g=a.o;d=KC(WD,oje,25,g,15,1);e=KC(WD,oje,25,g,15,1);c=a.p;b=KC(WD,oje,25,c,15,1);f=KC(WD,oje,25,c,15,1);for(j=0;j=0&&!YMb(a,k,l)){--l}e[k]=l}for(n=0;n=0&&!YMb(a,h,o)){--h}f[o]=h}for(i=0;ib[m]&&md[i]&&aNb(a,i,m,false,true)}}} +function lRb(a){var b,c,d,e,f,g,h,i;c=Ccb(DD(vNb(a,(wSb(),cSb))));f=a.a.c.d;h=a.a.d.d;if(c){g=Y6c(c7c(new f7c(h.a,h.b),f),0.5);i=Y6c(R6c(a.e),0.5);b=c7c(P6c(new f7c(f.a,f.b),g),i);a7c(a.d,b)}else{e=Edb(ED(vNb(a.a,tSb)));d=a.d;if(f.a>=h.a){if(f.b>=h.b){d.a=h.a+(f.a-h.a)/2+e;d.b=h.b+(f.b-h.b)/2-e-a.e.b}else{d.a=h.a+(f.a-h.a)/2+e;d.b=f.b+(h.b-f.b)/2+e}}else{if(f.b>=h.b){d.a=f.a+(h.a-f.a)/2+e;d.b=h.b+(f.b-h.b)/2+e}else{d.a=f.a+(h.a-f.a)/2+e;d.b=f.b+(h.b-f.b)/2-e-a.e.b}}}} +function Qge(a,b){var c,d,e,f,g,h,i;if(a==null){return null}f=a.length;if(f==0){return ''}i=KC(TD,$ie,25,f,15,1);ACb(0,f,a.length);ACb(0,f,i.length);ffb(a,0,f,i,0);c=null;h=b;for(e=0,g=0;e0?qfb(c.a,0,f-1):''}}else{return !c?a:c.a}} +function DPb(a){r4c(a,new E3c(P3c(M3c(O3c(N3c(new R3c,Yle),'ELK DisCo'),'Layouter for arranging unconnected subgraphs. The subgraphs themselves are, by default, not laid out.'),new GPb)));p4c(a,Yle,Zle,Ksd(BPb));p4c(a,Yle,$le,Ksd(vPb));p4c(a,Yle,_le,Ksd(qPb));p4c(a,Yle,ame,Ksd(wPb));p4c(a,Yle,Zke,Ksd(zPb));p4c(a,Yle,$ke,Ksd(yPb));p4c(a,Yle,Yke,Ksd(APb));p4c(a,Yle,_ke,Ksd(xPb));p4c(a,Yle,Tle,Ksd(sPb));p4c(a,Yle,Ule,Ksd(rPb));p4c(a,Yle,Vle,Ksd(tPb));p4c(a,Yle,Wle,Ksd(uPb))} +function Zbc(a,b,c,d){var e,f,g,h,i,j,k,l,m;f=new b0b(a);__b(f,(j0b(),i0b));yNb(f,(Nyc(),Vxc),(dcd(),$bd));e=0;if(b){g=new H0b;yNb(g,(wtc(),$sc),b);yNb(f,$sc,b.i);G0b(g,(Ucd(),Tcd));F0b(g,f);m=k_b(b.e);for(j=m,k=0,l=j.length;k0){c-=d.length-b;if(c>=0){e.a+='0.';for(;c>egb.length;c-=egb.length){Rfb(e,egb)}Sfb(e,egb,QD(c));Qfb(e,d.substr(b))}else{c=b-c;Qfb(e,qfb(d,b,QD(c)));e.a+='.';Qfb(e,pfb(d,QD(c)))}}else{Qfb(e,d.substr(b));for(;c<-egb.length;c+=egb.length){Rfb(e,egb)}Sfb(e,egb,QD(-c))}return e.a} +function v6c(a,b,c,d){var e,f,g,h,i,j,k,l,m;i=c7c(new f7c(c.a,c.b),a);j=i.a*b.b-i.b*b.a;k=b.a*d.b-b.b*d.a;l=(i.a*d.b-i.b*d.a)/k;m=j/k;if(k==0){if(j==0){e=P6c(new f7c(c.a,c.b),Y6c(new f7c(d.a,d.b),0.5));f=S6c(a,e);g=S6c(P6c(new f7c(a.a,a.b),b),e);h=$wnd.Math.sqrt(d.a*d.a+d.b*d.b)*0.5;if(f=0&&l<=1&&m>=0&&m<=1?P6c(new f7c(a.a,a.b),Y6c(new f7c(b.a,b.b),l)):null}} +function OTb(a,b,c){var d,e,f,g,h;d=BD(vNb(a,(Nyc(),zwc)),21);c.a>b.a&&(d.Hc((i8c(),c8c))?(a.c.a+=(c.a-b.a)/2):d.Hc(e8c)&&(a.c.a+=c.a-b.a));c.b>b.b&&(d.Hc((i8c(),g8c))?(a.c.b+=(c.b-b.b)/2):d.Hc(f8c)&&(a.c.b+=c.b-b.b));if(BD(vNb(a,(wtc(),Ksc)),21).Hc((Orc(),Hrc))&&(c.a>b.a||c.b>b.b)){for(h=new olb(a.a);h.ab.a&&(d.Hc((i8c(),c8c))?(a.c.a+=(c.a-b.a)/2):d.Hc(e8c)&&(a.c.a+=c.a-b.a));c.b>b.b&&(d.Hc((i8c(),g8c))?(a.c.b+=(c.b-b.b)/2):d.Hc(f8c)&&(a.c.b+=c.b-b.b));if(BD(vNb(a,(wtc(),Ksc)),21).Hc((Orc(),Hrc))&&(c.a>b.a||c.b>b.b)){for(g=new olb(a.a);g.ab){e=0;f+=k.b+c;l.c[l.c.length]=k;k=new x$c(f,c);d=new PZc(0,k.f,k,c);s$c(k,d);e=0}if(d.b.c.length==0||i.f>=d.o&&i.f<=d.f||d.a*0.5<=i.f&&d.a*1.5>=i.f){EZc(d,i)}else{g=new PZc(d.s+d.r+c,k.f,k,c);s$c(k,g);EZc(g,i)}e=i.i+i.g}l.c[l.c.length]=k;return l} +function OKd(a){var b,c,d,e,f,g,h,i;if(!a.a){a.o=null;i=new GNd(a);b=new KNd;c=KKd;h=c.a.zc(a,c);if(h==null){for(g=new Fyd(_Kd(a));g.e!=g.i.gc();){f=BD(Dyd(g),26);ytd(i,OKd(f))}c.a.Bc(a)!=null;c.a.gc()==0&&undefined}for(e=(!a.s&&(a.s=new cUd(t5,a,21,17)),new Fyd(a.s));e.e!=e.i.gc();){d=BD(Dyd(e),170);JD(d,322)&&wtd(b,BD(d,34))}vud(b);a.k=new PNd(a,(BD(qud(ZKd((NFd(),MFd).o),7),18),b.i),b.g);ytd(i,a.k);vud(i);a.a=new nNd((BD(qud(ZKd(MFd.o),4),18),i.i),i.g);$Kd(a).b&=-2}return a.a} +function vZc(a,b,c,d,e,f,g){var h,i,j,k,l,m;l=false;i=ZZc(c.q,b.f+b.b-c.q.f);m=e-(c.q.e+i-g);if(m=(tCb(f,a.c.length),BD(a.c[f],200)).e;k=(h=MZc(d,m,false),h.a);if(k>b.b&&!j){return false}if(j||k<=b.b){if(j&&k>b.b){c.d=k;KZc(c,JZc(c,k))}else{$Zc(c.q,i);c.c=true}KZc(d,e-(c.s+c.r));OZc(d,c.q.e+c.q.d,b.f);s$c(b,d);if(a.c.length>f){v$c((tCb(f,a.c.length),BD(a.c[f],200)),d);(tCb(f,a.c.length),BD(a.c[f],200)).a.c.length==0&&Kkb(a,f)}l=true}return l} +function C2d(a,b,c,d){var e,f,g,h,i,j,k;k=S6d(a.e.Tg(),b);e=0;f=BD(a.g,119);i=null;Q6d();if(BD(b,66).Oj()){for(h=0;ha.o.a){k=(i-a.o.a)/2;h.b=$wnd.Math.max(h.b,k);h.c=$wnd.Math.max(h.c,k)}} +function rvd(a){var b,c,d,e,f,g,h,i;f=new b2c;Z1c(f,(Y1c(),V1c));for(d=(e=$B(a,KC(ZI,nie,2,0,6,1)),new vib(new amb((new mC(a,e)).b)));d.b0?a.i:0)>b&&i>0){f=0;g+=i+a.i;e=$wnd.Math.max(e,m);d+=i+a.i;i=0;m=0;if(c){++l;Ekb(a.n,new VZc(a.s,g,a.i))}h=0}m+=j.g+(h>0?a.i:0);i=$wnd.Math.max(i,j.f);c&&QZc(BD(Ikb(a.n,l),211),j);f+=j.g+(h>0?a.i:0);++h}e=$wnd.Math.max(e,m);d+=i;if(c){a.r=e;a.d=d;u$c(a.j)}return new J6c(a.s,a.t,e,d)} +function $fb(a,b,c,d,e){Zfb();var f,g,h,i,j,k,l,m,n;vCb(a,'src');vCb(c,'dest');m=rb(a);i=rb(c);rCb((m.i&4)!=0,'srcType is not an array');rCb((i.i&4)!=0,'destType is not an array');l=m.c;g=i.c;rCb((l.i&1)!=0?l==g:(g.i&1)==0,"Array types don't match");n=a.length;j=c.length;if(b<0||d<0||e<0||b+e>n||d+e>j){throw vbb(new pcb)}if((l.i&1)==0&&m!=i){k=CD(a);f=CD(c);if(PD(a)===PD(c)&&bd;){NC(f,h,k[--b])}}else{for(h=d+e;d0&&$Bb(a,b,c,d,e,true)} +function phb(){phb=ccb;nhb=OC(GC(WD,1),oje,25,15,[Rie,1162261467,Iie,1220703125,362797056,1977326743,Iie,387420489,Jje,214358881,429981696,815730721,1475789056,170859375,268435456,410338673,612220032,893871739,1280000000,1801088541,113379904,148035889,191102976,244140625,308915776,387420489,481890304,594823321,729000000,887503681,Iie,1291467969,1544804416,1838265625,60466176]);ohb=OC(GC(WD,1),oje,25,15,[-1,-1,31,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5])} +function soc(a){var b,c,d,e,f,g,h,i;for(e=new olb(a.b);e.a=a.b.length){f[e++]=g.b[d++];f[e++]=g.b[d++]}else if(d>=g.b.length){f[e++]=a.b[c++];f[e++]=a.b[c++]}else if(g.b[d]0?a.i:0)}++b}Ce(a.n,i);a.d=c;a.r=d;a.g=0;a.f=0;a.e=0;a.o=Pje;a.p=Pje;for(f=new olb(a.b);f.a0){e=(!a.n&&(a.n=new cUd(D2,a,1,7)),BD(qud(a.n,0),137)).a;!e||Qfb(Qfb((b.a+=' "',b),e),'"')}}else{Qfb(Qfb((b.a+=' "',b),d),'"')}c=(!a.b&&(a.b=new y5d(z2,a,4,7)),!(a.b.i<=1&&(!a.c&&(a.c=new y5d(z2,a,5,8)),a.c.i<=1)));c?(b.a+=' [',b):(b.a+=' ',b);Qfb(b,Eb(new Gb,new Fyd(a.b)));c&&(b.a+=']',b);b.a+=gne;c&&(b.a+='[',b);Qfb(b,Eb(new Gb,new Fyd(a.c)));c&&(b.a+=']',b);return b.a} +function TQd(a,b){var c,d,e,f,g,h,i;if(a.a){h=a.a.ne();i=null;if(h!=null){b.a+=''+h}else{g=a.a.Dj();if(g!=null){f=hfb(g,wfb(91));if(f!=-1){i=g.substr(f);b.a+=''+qfb(g==null?Xhe:(uCb(g),g),0,f)}else{b.a+=''+g}}}if(!!a.d&&a.d.i!=0){e=true;b.a+='<';for(d=new Fyd(a.d);d.e!=d.i.gc();){c=BD(Dyd(d),87);e?(e=false):(b.a+=She,b);TQd(c,b)}b.a+='>'}i!=null&&(b.a+=''+i,b)}else if(a.e){h=a.e.zb;h!=null&&(b.a+=''+h,b)}else{b.a+='?';if(a.b){b.a+=' super ';TQd(a.b,b)}else{if(a.f){b.a+=' extends ';TQd(a.f,b)}}}} +function Z9b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D;v=a.c;w=b.c;c=Jkb(v.a,a,0);d=Jkb(w.a,b,0);t=BD(W_b(a,(KAc(),HAc)).Kc().Pb(),11);C=BD(W_b(a,IAc).Kc().Pb(),11);u=BD(W_b(b,HAc).Kc().Pb(),11);D=BD(W_b(b,IAc).Kc().Pb(),11);r=k_b(t.e);A=k_b(C.g);s=k_b(u.e);B=k_b(D.g);Z_b(a,d,w);for(g=s,k=0,o=g.length;kk){new DOc((HOc(),GOc),c,b,j-k)}else if(j>0&&k>0){new DOc((HOc(),GOc),b,c,0);new DOc(GOc,c,b,0)}}return g} +function TUb(a,b){var c,d,e,f,g,h;for(g=new nib((new eib(a.f.b)).a);g.b;){f=lib(g);e=BD(f.cd(),594);if(b==1){if(e.gf()!=(ead(),dad)&&e.gf()!=_9c){continue}}else{if(e.gf()!=(ead(),aad)&&e.gf()!=bad){continue}}d=BD(BD(f.dd(),46).b,81);h=BD(BD(f.dd(),46).a,189);c=h.c;switch(e.gf().g){case 2:d.g.c=a.e.a;d.g.b=$wnd.Math.max(1,d.g.b+c);break;case 1:d.g.c=d.g.c+c;d.g.b=$wnd.Math.max(1,d.g.b-c);break;case 4:d.g.d=a.e.b;d.g.a=$wnd.Math.max(1,d.g.a+c);break;case 3:d.g.d=d.g.d+c;d.g.a=$wnd.Math.max(1,d.g.a-c);}}} +function nJc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;h=KC(WD,oje,25,b.b.c.length,15,1);j=KC(NQ,Kie,267,b.b.c.length,0,1);i=KC(OQ,kne,10,b.b.c.length,0,1);for(l=a.a,m=0,n=l.length;m0&&!!i[d]&&(o=jBc(a.b,i[d],e));p=$wnd.Math.max(p,e.c.c.b+o)}for(f=new olb(k.e);f.a1){throw vbb(new Wdb(Hwe))}if(!i){f=R6d(b,d.Kc().Pb());g.Fc(f)}}return xtd(a,I2d(a,b,c),g)} +function Pmc(a,b){var c,d,e,f;Jmc(b.b.j);MAb(NAb(new YAb(null,new Kub(b.d,16)),new $mc),new anc);for(f=new olb(b.d);f.aa.o.b){return false}c=V_b(a,zcd);h=b.d+b.a+(c.gc()-1)*g;if(h>a.o.b){return false}}return true} +function thb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;g=a.e;i=b.e;if(g==0){return b}if(i==0){return a}f=a.d;h=b.d;if(f+h==2){c=xbb(a.a[0],Yje);d=xbb(b.a[0],Yje);if(g==i){k=wbb(c,d);o=Tbb(k);n=Tbb(Pbb(k,32));return n==0?new Ugb(g,o):new Vgb(g,2,OC(GC(WD,1),oje,25,15,[o,n]))}return ghb(g<0?Qbb(d,c):Qbb(c,d))}else if(g==i){m=g;l=f>=h?uhb(a.a,f,b.a,h):uhb(b.a,h,a.a,f)}else{e=f!=h?f>h?1:-1:whb(a.a,b.a,f);if(e==0){return Hgb(),Ggb}if(e==1){m=g;l=zhb(a.a,f,b.a,h)}else{m=i;l=zhb(b.a,h,a.a,f)}}j=new Vgb(m,l.length,l);Jgb(j);return j} +function oZb(a,b,c,d,e,f,g){var h,i,j,k,l,m,n;l=Ccb(DD(vNb(b,(Nyc(),vxc))));m=null;f==(KAc(),HAc)&&d.c.i==c?(m=d.c):f==IAc&&d.d.i==c&&(m=d.d);j=g;if(!j||!l||!!m){k=(Ucd(),Scd);m?(k=m.j):fcd(BD(vNb(c,Vxc),98))&&(k=f==HAc?Tcd:zcd);i=lZb(a,b,c,f,k,d);h=kZb((Q_b(c),d));if(f==HAc){QZb(h,BD(Ikb(i.j,0),11));RZb(h,e)}else{QZb(h,e);RZb(h,BD(Ikb(i.j,0),11))}j=new yZb(d,h,i,BD(vNb(i,(wtc(),$sc)),11),f,!m)}else{Ekb(j.e,d);n=$wnd.Math.max(Edb(ED(vNb(j.d,Zwc))),Edb(ED(vNb(d,Zwc))));yNb(j.d,Zwc,n)}Rc(a.a,d,new BZb(j.d,b,f));return j} +function V1d(a,b){var c,d,e,f,g,h,i,j,k,l;k=null;!!a.d&&(k=BD(Phb(a.d,b),138));if(!k){f=a.a.Mh();l=f.i;if(!a.d||Vhb(a.d)!=l){i=new Lqb;!!a.d&&Ld(i,a.d);j=i.f.c+i.g.c;for(h=j;h0){n=(o-1)*c;!!h&&(n+=d);!!k&&(n+=d);n=a.b[e+1]){e+=2}else if(c0){d=new Tkb(BD(Qc(a.a,f),21));mmb();Okb(d,new EZb(b));e=new Bib(f.b,0);while(e.bv)){i=2;g=Ohe}else if(i==0){i=1;g=A}else{i=0;g=A}}else{n=A>=g||g-A0?1:Ny(isNaN(d),isNaN(0)))>=0^(null,My(Jqe),($wnd.Math.abs(h)<=Jqe||h==0||isNaN(h)&&isNaN(0)?0:h<0?-1:h>0?1:Ny(isNaN(h),isNaN(0)))>=0)){return $wnd.Math.max(h,d)}My(Jqe);if(($wnd.Math.abs(d)<=Jqe||d==0||isNaN(d)&&isNaN(0)?0:d<0?-1:d>0?1:Ny(isNaN(d),isNaN(0)))>0){return $wnd.Math.sqrt(h*h+d*d)}return -$wnd.Math.sqrt(h*h+d*d)} +function Kge(a,b){var c,d,e,f,g,h;if(!b)return;!a.a&&(a.a=new Wvb);if(a.e==2){Tvb(a.a,b);return}if(b.e==1){for(e=0;e=Tje?Efb(c,Tee(d)):Afb(c,d&aje);g=(++vfe,new Hge(10,null,0));Vvb(a.a,g,h-1)}else{c=(g.bm().length+f,new Ifb);Efb(c,g.bm())}if(b.e==0){d=b._l();d>=Tje?Efb(c,Tee(d)):Afb(c,d&aje)}else{Efb(c,b.bm())}BD(g,521).b=c.a} +function rgb(a){var b,c,d,e,f;if(a.g!=null){return a.g}if(a.a<32){a.g=rhb(Cbb(a.f),QD(a.e));return a.g}e=shb((!a.c&&(a.c=fhb(a.f)),a.c),0);if(a.e==0){return e}b=(!a.c&&(a.c=fhb(a.f)),a.c).e<0?2:1;c=e.length;d=-a.e+c-b;f=new Ufb;f.a+=''+e;if(a.e>0&&d>=-6){if(d>=0){Tfb(f,c-QD(a.e),String.fromCharCode(46))}else{f.a=qfb(f.a,0,b-1)+'0.'+pfb(f.a,b-1);Tfb(f,b+1,zfb(egb,0,-QD(d)-1))}}else{if(c-b>=1){Tfb(f,b,String.fromCharCode(46));++c}Tfb(f,c,String.fromCharCode(69));d>0&&Tfb(f,++c,String.fromCharCode(43));Tfb(f,++c,''+Ubb(Cbb(d)))}a.g=f.a;return a.g} +function npc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(c.dc()){return}h=0;m=0;d=c.Kc();o=BD(d.Pb(),19).a;while(h1&&(i=j.mg(i,a.a,h))}if(i.c.length==1){return BD(Ikb(i,i.c.length-1),220)}if(i.c.length==2){return lYc((tCb(0,i.c.length),BD(i.c[0],220)),(tCb(1,i.c.length),BD(i.c[1],220)),g,f)}return null} +function JNb(a){var b,c,d,e,f,g;Hkb(a.a,new PNb);for(c=new olb(a.a);c.a=$wnd.Math.abs(d.b)){d.b=0;f.d+f.a>g.d&&f.dg.c&&f.c0){b=new _zd(a.i,a.g);c=a.i;f=c<100?null:new Ixd(c);if(a.ij()){for(d=0;d0){h=a.g;j=a.i;oud(a);f=j<100?null:new Ixd(j);for(d=0;d>13|(a.m&15)<<9;e=a.m>>4&8191;f=a.m>>17|(a.h&255)<<5;g=(a.h&1048320)>>8;h=b.l&8191;i=b.l>>13|(b.m&15)<<9;j=b.m>>4&8191;k=b.m>>17|(b.h&255)<<5;l=(b.h&1048320)>>8;B=c*h;C=d*h;D=e*h;F=f*h;G=g*h;if(i!=0){C+=c*i;D+=d*i;F+=e*i;G+=f*i}if(j!=0){D+=c*j;F+=d*j;G+=e*j}if(k!=0){F+=c*k;G+=d*k}l!=0&&(G+=c*l);n=B&Eje;o=(C&511)<<13;m=n+o;q=B>>22;r=C>>9;s=(D&262143)<<4;t=(F&31)<<17;p=q+r+s+t;v=D>>18;w=F>>5;A=(G&4095)<<8;u=v+w+A;p+=m>>22;m&=Eje;u+=p>>22;p&=Eje;u&=Fje;return TC(m,p,u)} +function o7b(a){var b,c,d,e,f,g,h;h=BD(Ikb(a.j,0),11);if(h.g.c.length!=0&&h.e.c.length!=0){throw vbb(new Zdb('Interactive layout does not support NORTH/SOUTH ports with incoming _and_ outgoing edges.'))}if(h.g.c.length!=0){f=Pje;for(c=new olb(h.g);c.a4){if(a.wj(b)){if(a.rk()){e=BD(b,49);d=e.Ug();i=d==a.e&&(a.Dk()?e.Og(e.Vg(),a.zk())==a.Ak():-1-e.Vg()==a.aj());if(a.Ek()&&!i&&!d&&!!e.Zg()){for(f=0;f0&&(j=a.n.a/f);break;case 2:case 4:e=a.i.o.b;e>0&&(j=a.n.b/e);}yNb(a,(wtc(),htc),j)}i=a.o;g=a.a;if(d){g.a=d.a;g.b=d.b;a.d=true}else if(b!=bcd&&b!=ccd&&h!=Scd){switch(h.g){case 1:g.a=i.a/2;break;case 2:g.a=i.a;g.b=i.b/2;break;case 3:g.a=i.a/2;g.b=i.b;break;case 4:g.b=i.b/2;}}else{g.a=i.a/2;g.b=i.b/2}} +function vwd(a){var b,c,d,e,f,g,h,i,j,k;if(a.ej()){k=a.Vi();i=a.fj();if(k>0){b=new Aud(a.Gi());c=k;f=c<100?null:new Ixd(c);Cvd(a,c,b.g);e=c==1?a.Zi(4,qud(b,0),null,0,i):a.Zi(6,b,null,-1,i);if(a.bj()){for(d=new Fyd(b);d.e!=d.i.gc();){f=a.dj(Dyd(d),f)}if(!f){a.$i(e)}else{f.Ei(e);f.Fi()}}else{if(!f){a.$i(e)}else{f.Ei(e);f.Fi()}}}else{Cvd(a,a.Vi(),a.Wi());a.$i(a.Zi(6,(mmb(),jmb),null,-1,i))}}else if(a.bj()){k=a.Vi();if(k>0){h=a.Wi();j=k;Cvd(a,k,h);f=j<100?null:new Ixd(j);for(d=0;da.d[g.p]){c+=zHc(a.b,f)*BD(i.b,19).a;Wjb(a.a,meb(f))}}while(!akb(a.a)){xHc(a.b,BD(fkb(a.a),19).a)}}return c} +function eed(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q;l=new g7c(BD(hkd(a,(X7c(),R7c)),8));l.a=$wnd.Math.max(l.a-c.b-c.c,0);l.b=$wnd.Math.max(l.b-c.d-c.a,0);e=ED(hkd(a,L7c));(e==null||(uCb(e),e)<=0)&&(e=1.3);h=new Rkb;for(o=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));o.e!=o.i.gc();){n=BD(Dyd(o),33);g=new xed(n);h.c[h.c.length]=g}m=BD(hkd(a,M7c),311);switch(m.g){case 3:q=bed(h,b,l.a,l.b,(j=d,uCb(e),e,j));break;case 1:q=aed(h,b,l.a,l.b,(k=d,uCb(e),e,k));break;default:q=ced(h,b,l.a,l.b,(i=d,uCb(e),e,i));}f=new wed(q);p=fed(f,b,c,l.a,l.b,d,(uCb(e),e));Afd(a,p.a,p.b,false,true)} +function vkc(a,b){var c,d,e,f;c=b.b;f=new Tkb(c.j);e=0;d=c.j;d.c=KC(SI,Uhe,1,0,5,1);hkc(BD(Si(a.b,(Ucd(),Acd),(Fkc(),Ekc)),15),c);e=ikc(f,e,new blc,d);hkc(BD(Si(a.b,Acd,Dkc),15),c);e=ikc(f,e,new dlc,d);hkc(BD(Si(a.b,Acd,Ckc),15),c);hkc(BD(Si(a.b,zcd,Ekc),15),c);hkc(BD(Si(a.b,zcd,Dkc),15),c);e=ikc(f,e,new flc,d);hkc(BD(Si(a.b,zcd,Ckc),15),c);hkc(BD(Si(a.b,Rcd,Ekc),15),c);e=ikc(f,e,new hlc,d);hkc(BD(Si(a.b,Rcd,Dkc),15),c);e=ikc(f,e,new jlc,d);hkc(BD(Si(a.b,Rcd,Ckc),15),c);hkc(BD(Si(a.b,Tcd,Ekc),15),c);e=ikc(f,e,new Pkc,d);hkc(BD(Si(a.b,Tcd,Dkc),15),c);hkc(BD(Si(a.b,Tcd,Ckc),15),c)} +function nbc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;Odd(b,'Layer size calculation',1);k=Pje;j=Qje;e=false;for(h=new olb(a.b);h.a0.5?(r-=g*2*(o-0.5)):o<0.5&&(r+=f*2*(0.5-o));e=h.d.b;rq.a-p-k&&(r=q.a-p-k);h.n.a=b+r}} +function ced(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q;h=KC(UD,Vje,25,a.c.length,15,1);m=new gub(new Ned);_tb(m,a);j=0;p=new Rkb;while(m.b.c.length!=0){g=BD(m.b.c.length==0?null:Ikb(m.b,0),157);if(j>1&&red(g)*qed(g)/2>h[0]){f=0;while(fh[f]){++f}o=new Jib(p,0,f+1);l=new wed(o);k=red(g)/qed(g);i=fed(l,b,new p0b,c,d,e,k);P6c(X6c(l.e),i);zCb(cub(m,l));n=new Jib(p,f+1,p.c.length);_tb(m,n);p.c=KC(SI,Uhe,1,0,5,1);j=0;Dlb(h,h.length,0)}else{q=m.b.c.length==0?null:Ikb(m.b,0);q!=null&&fub(m,0);j>0&&(h[j]=h[j-1]);h[j]+=red(g)*qed(g);++j;p.c[p.c.length]=g}}return p} +function Wac(a){var b,c,d,e,f;d=BD(vNb(a,(Nyc(),mxc)),163);if(d==(Ctc(),ytc)){for(c=new Sr(ur(R_b(a).a.Kc(),new Sq));Qr(c);){b=BD(Rr(c),17);if(!Yac(b)){throw vbb(new y2c(Fne+P_b(a)+"' has its layer constraint set to FIRST_SEPARATE, but has at least one incoming edge. "+'FIRST_SEPARATE nodes must not have incoming edges.'))}}}else if(d==Atc){for(f=new Sr(ur(U_b(a).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);if(!Yac(e)){throw vbb(new y2c(Fne+P_b(a)+"' has its layer constraint set to LAST_SEPARATE, but has at least one outgoing edge. "+'LAST_SEPARATE nodes must not have outgoing edges.'))}}}} +function C9b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;Odd(b,'Label dummy removal',1);d=Edb(ED(vNb(a,(Nyc(),nyc))));e=Edb(ED(vNb(a,ryc)));j=BD(vNb(a,Lwc),103);for(i=new olb(a.b);i.a0&&iCc(a,h,l)}for(e=new olb(l);e.a>19!=0){b=hD(b);i=!i}g=_C(b);f=false;e=false;d=false;if(a.h==Gje&&a.m==0&&a.l==0){e=true;f=true;if(g==-1){a=SC((wD(),sD));d=true;i=!i}else{h=lD(a,g);i&&ZC(h);c&&(QC=TC(0,0,0));return h}}else if(a.h>>19!=0){f=true;a=hD(a);d=true;i=!i}if(g!=-1){return WC(a,g,i,f,c)}if(eD(a,b)<0){c&&(f?(QC=hD(a)):(QC=TC(a.l,a.m,a.h)));return TC(0,0,0)}return XC(d?a:TC(a.l,a.m,a.h),b,i,f,e,c)} +function F2c(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(a.e&&a.c.cb.f||b.g>a.f){return}c=0;d=0;for(g=a.w.a.ec().Kc();g.Ob();){e=BD(g.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,b.g,b.f)&&++c}for(h=a.r.a.ec().Kc();h.Ob();){e=BD(h.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,b.g,b.f)&&--c}for(i=b.w.a.ec().Kc();i.Ob();){e=BD(i.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,a.g,a.f)&&++d}for(f=b.r.a.ec().Kc();f.Ob();){e=BD(f.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,a.g,a.f)&&--d}if(c=0){f=wid(b,c.substr(1,h-1));l=c.substr(h+1,j-(h+1));return pid(b,l,f)}}else{d=-1;Vcb==null&&(Vcb=new RegExp('\\d'));if(Vcb.test(String.fromCharCode(i))){d=lfb(c,wfb(46),j-1);if(d>=0){e=BD(hid(b,Bid(b,c.substr(1,d-1)),false),58);k=0;try{k=Icb(c.substr(d+1),Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){g=a;throw vbb(new rFd(g))}else throw vbb(a)}if(k=0){return c}switch($1d(q1d(a,c))){case 2:{if(dfb('',o1d(a,c.Hj()).ne())){i=b2d(q1d(a,c));h=a2d(q1d(a,c));k=r1d(a,b,i,h);if(k){return k}e=f1d(a,b);for(g=0,l=e.gc();g1){throw vbb(new Wdb(Hwe))}k=S6d(a.e.Tg(),b);d=BD(a.g,119);for(g=0;g1;for(j=new b1b(m.b);llb(j.a)||llb(j.b);){i=BD(llb(j.a)?mlb(j.a):mlb(j.b),17);l=i.c==m?i.d:i.c;$wnd.Math.abs(l7c(OC(GC(m1,1),nie,8,0,[l.i.n,l.n,l.a])).b-g.b)>1&&GNc(a,i,g,f,m)}}} +function XPc(a){var b,c,d,e,f,g;e=new Bib(a.e,0);d=new Bib(a.a,0);if(a.d){for(c=0;cOqe){f=b;g=0;while($wnd.Math.abs(b-f)0);e.a.Xb(e.c=--e.b);WPc(a,a.b-g,f,d,e);sCb(e.b0);d.a.Xb(d.c=--d.b)}if(!a.d){for(c=0;c0){a.f[k.p]=n/(k.e.c.length+k.g.c.length);a.c=$wnd.Math.min(a.c,a.f[k.p]);a.b=$wnd.Math.max(a.b,a.f[k.p])}else h&&(a.f[k.p]=n)}} +function $9d(a){a.b=null;a.bb=null;a.fb=null;a.qb=null;a.a=null;a.c=null;a.d=null;a.e=null;a.f=null;a.n=null;a.M=null;a.L=null;a.Q=null;a.R=null;a.K=null;a.db=null;a.eb=null;a.g=null;a.i=null;a.j=null;a.k=null;a.gb=null;a.o=null;a.p=null;a.q=null;a.r=null;a.$=null;a.ib=null;a.S=null;a.T=null;a.t=null;a.s=null;a.u=null;a.v=null;a.w=null;a.B=null;a.A=null;a.C=null;a.D=null;a.F=null;a.G=null;a.H=null;a.I=null;a.J=null;a.P=null;a.Z=null;a.U=null;a.V=null;a.W=null;a.X=null;a.Y=null;a._=null;a.ab=null;a.cb=null;a.hb=null;a.nb=null;a.lb=null;a.mb=null;a.ob=null;a.pb=null;a.jb=null;a.kb=null;a.N=false;a.O=false} +function l5b(a,b,c){var d,e,f,g;Odd(c,'Graph transformation ('+a.a+')',1);g=Mu(b.a);for(f=new olb(b.b);f.a0){a.a=i+(n-1)*f;b.c.b+=a.a;b.f.b+=a.a}}if(o.a.gc()!=0){m=new tPc(1,f);n=sPc(m,b,o,p,b.f.b+i-b.c.b);n>0&&(b.f.b+=i+(n-1)*f)}} +function kKd(a,b){var c,d,e,f;f=a.F;if(b==null){a.F=null;$Jd(a,null)}else{a.F=(uCb(b),b);d=hfb(b,wfb(60));if(d!=-1){e=b.substr(0,d);hfb(b,wfb(46))==-1&&!dfb(e,Khe)&&!dfb(e,Eve)&&!dfb(e,Fve)&&!dfb(e,Gve)&&!dfb(e,Hve)&&!dfb(e,Ive)&&!dfb(e,Jve)&&!dfb(e,Kve)&&(e=Lve);c=kfb(b,wfb(62));c!=-1&&(e+=''+b.substr(c+1));$Jd(a,e)}else{e=b;if(hfb(b,wfb(46))==-1){d=hfb(b,wfb(91));d!=-1&&(e=b.substr(0,d));if(!dfb(e,Khe)&&!dfb(e,Eve)&&!dfb(e,Fve)&&!dfb(e,Gve)&&!dfb(e,Hve)&&!dfb(e,Ive)&&!dfb(e,Jve)&&!dfb(e,Kve)){e=Lve;d!=-1&&(e+=''+b.substr(d))}else{e=b}}$Jd(a,e);e==b&&(a.F=a.D)}}(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,5,f,b))} +function AMc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;p=b.b.c.length;if(p<3){return}n=KC(WD,oje,25,p,15,1);l=0;for(k=new olb(b.b);k.ag)&&Qqb(a.b,BD(q.b,17))}}++h}f=g}}}} +function o5c(b,c){var d;if(c==null||dfb(c,Xhe)){return null}if(c.length==0&&b.k!=(_5c(),W5c)){return null}switch(b.k.g){case 1:return efb(c,kse)?(Bcb(),Acb):efb(c,lse)?(Bcb(),zcb):null;case 2:try{return meb(Icb(c,Rie,Ohe))}catch(a){a=ubb(a);if(JD(a,127)){return null}else throw vbb(a)}case 4:try{return Hcb(c)}catch(a){a=ubb(a);if(JD(a,127)){return null}else throw vbb(a)}case 3:return c;case 5:j5c(b);return m5c(b,c);case 6:j5c(b);return n5c(b,b.a,c);case 7:try{d=l5c(b);d.Jf(c);return d}catch(a){a=ubb(a);if(JD(a,32)){return null}else throw vbb(a)}default:throw vbb(new Zdb('Invalid type set for this layout option.'));}} +function JWb(a){AWb();var b,c,d,e,f,g,h;h=new CWb;for(c=new olb(a);c.a=h.b.c)&&(h.b=b);if(!h.c||b.c<=h.c.c){h.d=h.c;h.c=b}(!h.e||b.d>=h.e.d)&&(h.e=b);(!h.f||b.d<=h.f.d)&&(h.f=b)}d=new NWb((lWb(),hWb));rXb(a,yWb,new amb(OC(GC(bQ,1),Uhe,369,0,[d])));g=new NWb(kWb);rXb(a,xWb,new amb(OC(GC(bQ,1),Uhe,369,0,[g])));e=new NWb(iWb);rXb(a,wWb,new amb(OC(GC(bQ,1),Uhe,369,0,[e])));f=new NWb(jWb);rXb(a,vWb,new amb(OC(GC(bQ,1),Uhe,369,0,[f])));DWb(d.c,hWb);DWb(e.c,iWb);DWb(f.c,jWb);DWb(g.c,kWb);h.a.c=KC(SI,Uhe,1,0,5,1);Gkb(h.a,d.c);Gkb(h.a,Su(e.c));Gkb(h.a,f.c);Gkb(h.a,Su(g.c));return h} +function jxd(a){var b;switch(a.d){case 1:{if(a.hj()){return a.o!=-2}break}case 2:{if(a.hj()){return a.o==-2}break}case 3:case 5:case 4:case 6:case 7:{return a.o>-2}default:{return false}}b=a.gj();switch(a.p){case 0:return b!=null&&Ccb(DD(b))!=Kbb(a.k,0);case 1:return b!=null&&BD(b,217).a!=Tbb(a.k)<<24>>24;case 2:return b!=null&&BD(b,172).a!=(Tbb(a.k)&aje);case 6:return b!=null&&Kbb(BD(b,162).a,a.k);case 5:return b!=null&&BD(b,19).a!=Tbb(a.k);case 7:return b!=null&&BD(b,184).a!=Tbb(a.k)<<16>>16;case 3:return b!=null&&Edb(ED(b))!=a.j;case 4:return b!=null&&BD(b,155).a!=a.j;default:return b==null?a.n!=null:!pb(b,a.n);}} +function nOd(a,b,c){var d,e,f,g;if(a.Fk()&&a.Ek()){g=oOd(a,BD(c,56));if(PD(g)!==PD(c)){a.Oi(b);a.Ui(b,pOd(a,b,g));if(a.rk()){f=(e=BD(c,49),a.Dk()?a.Bk()?e.ih(a.b,zUd(BD(XKd(wjd(a.b),a.aj()),18)).n,BD(XKd(wjd(a.b),a.aj()).Yj(),26).Bj(),null):e.ih(a.b,bLd(e.Tg(),zUd(BD(XKd(wjd(a.b),a.aj()),18))),null,null):e.ih(a.b,-1-a.aj(),null,null));!BD(g,49).eh()&&(f=(d=BD(g,49),a.Dk()?a.Bk()?d.gh(a.b,zUd(BD(XKd(wjd(a.b),a.aj()),18)).n,BD(XKd(wjd(a.b),a.aj()).Yj(),26).Bj(),f):d.gh(a.b,bLd(d.Tg(),zUd(BD(XKd(wjd(a.b),a.aj()),18))),null,f):d.gh(a.b,-1-a.aj(),null,f)));!!f&&f.Fi()}oid(a.b)&&a.$i(a.Zi(9,c,g,b,false));return g}}return c} +function Noc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;k=Edb(ED(vNb(a,(Nyc(),oyc))));d=Edb(ED(vNb(a,Cyc)));m=new _fd;yNb(m,oyc,k+d);j=b;r=j.d;p=j.c.i;s=j.d.i;q=G1b(p.c);t=G1b(s.c);e=new Rkb;for(l=q;l<=t;l++){h=new b0b(a);__b(h,(j0b(),g0b));yNb(h,(wtc(),$sc),j);yNb(h,Vxc,(dcd(),$bd));yNb(h,qyc,m);n=BD(Ikb(a.b,l),29);l==q?Z_b(h,n.a.c.length-c,n):$_b(h,n);u=Edb(ED(vNb(j,Zwc)));if(u<0){u=0;yNb(j,Zwc,u)}h.o.b=u;o=$wnd.Math.floor(u/2);g=new H0b;G0b(g,(Ucd(),Tcd));F0b(g,h);g.n.b=o;i=new H0b;G0b(i,zcd);F0b(i,h);i.n.b=o;RZb(j,g);f=new UZb;tNb(f,j);yNb(f,jxc,null);QZb(f,i);RZb(f,r);Ooc(h,j,f);e.c[e.c.length]=f;j=f}return e} +function sbc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;i=BD(Y_b(a,(Ucd(),Tcd)).Kc().Pb(),11).e;n=BD(Y_b(a,zcd).Kc().Pb(),11).g;h=i.c.length;t=A0b(BD(Ikb(a.j,0),11));while(h-->0){p=(tCb(0,i.c.length),BD(i.c[0],17));e=(tCb(0,n.c.length),BD(n.c[0],17));s=e.d.e;f=Jkb(s,e,0);SZb(p,e.d,f);QZb(e,null);RZb(e,null);o=p.a;b&&Dsb(o,new g7c(t));for(d=Jsb(e.a,0);d.b!=d.d.c;){c=BD(Xsb(d),8);Dsb(o,new g7c(c))}r=p.b;for(m=new olb(e.b);m.a0&&(g=$wnd.Math.max(g,IJb(a.C.b+d.d.b,e)))}else{n=m+k.d.c+a.w+d.d.b;g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(l-e)<=ple||l==e||isNaN(l)&&isNaN(e)?0:n/(e-l)))}k=d;l=e;m=f}if(!!a.C&&a.C.c>0){n=m+a.C.c;j&&(n+=k.d.c);g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(l-1)<=ple||l==1||isNaN(l)&&isNaN(1)?0:n/(1-l)))}c.n.b=0;c.a.a=g} +function NKb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;c=BD(Mpb(a.b,b),124);i=BD(BD(Qc(a.r,b),21),84);if(i.dc()){c.n.d=0;c.n.a=0;return}j=a.u.Hc((rcd(),ncd));g=0;a.A.Hc((tdd(),sdd))&&SKb(a,b);h=i.Kc();k=null;m=0;l=0;while(h.Ob()){d=BD(h.Pb(),111);f=Edb(ED(d.b.We((CKb(),BKb))));e=d.b.rf().b;if(!k){!!a.C&&a.C.d>0&&(g=$wnd.Math.max(g,IJb(a.C.d+d.d.d,f)))}else{n=l+k.d.a+a.w+d.d.d;g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(m-f)<=ple||m==f||isNaN(m)&&isNaN(f)?0:n/(f-m)))}k=d;m=f;l=e}if(!!a.C&&a.C.a>0){n=l+a.C.a;j&&(n+=k.d.a);g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(m-1)<=ple||m==1||isNaN(m)&&isNaN(1)?0:n/(1-m)))}c.n.d=0;c.a.b=g} +function _Ec(a,b,c){var d,e,f,g,h,i;this.g=a;h=b.d.length;i=c.d.length;this.d=KC(OQ,kne,10,h+i,0,1);for(g=0;g0?ZEc(this,this.f/this.a):REc(b.g,b.d[0]).a!=null&&REc(c.g,c.d[0]).a!=null?ZEc(this,(Edb(REc(b.g,b.d[0]).a)+Edb(REc(c.g,c.d[0]).a))/2):REc(b.g,b.d[0]).a!=null?ZEc(this,REc(b.g,b.d[0]).a):REc(c.g,c.d[0]).a!=null&&ZEc(this,REc(c.g,c.d[0]).a)} +function BUb(a,b){var c,d,e,f,g,h,i,j,k,l;a.a=new dVb(oqb(t1));for(d=new olb(b.a);d.a=1){if(q-g>0&&l>=0){i.n.a+=p;i.n.b+=f*g}else if(q-g<0&&k>=0){i.n.a+=p*q;i.n.b+=f}}}a.o.a=b.a;a.o.b=b.b;yNb(a,(Nyc(),Fxc),(tdd(),d=BD(gdb(I1),9),new xqb(d,BD(_Bb(d,d.length),9),0)))} +function iFd(a,b,c,d,e,f){var g;if(!(b==null||!OEd(b,zEd,AEd))){throw vbb(new Wdb('invalid scheme: '+b))}if(!a&&!(c!=null&&hfb(c,wfb(35))==-1&&c.length>0&&(BCb(0,c.length),c.charCodeAt(0)!=47))){throw vbb(new Wdb('invalid opaquePart: '+c))}if(a&&!(b!=null&&hnb(GEd,b.toLowerCase()))&&!(c==null||!OEd(c,CEd,DEd))){throw vbb(new Wdb(mve+c))}if(a&&b!=null&&hnb(GEd,b.toLowerCase())&&!eFd(c)){throw vbb(new Wdb(mve+c))}if(!fFd(d)){throw vbb(new Wdb('invalid device: '+d))}if(!hFd(e)){g=e==null?'invalid segments: null':'invalid segment: '+VEd(e);throw vbb(new Wdb(g))}if(!(f==null||hfb(f,wfb(35))==-1)){throw vbb(new Wdb('invalid query: '+f))}} +function nVc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;Odd(b,'Calculate Graph Size',1);b.n&&!!a&&Tdd(b,i6d(a),(pgd(),mgd));h=dme;i=dme;f=ere;g=ere;for(l=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));l.e!=l.i.gc();){j=BD(Dyd(l),33);o=j.i;p=j.j;r=j.g;d=j.f;e=BD(hkd(j,(Y9c(),S8c)),142);h=$wnd.Math.min(h,o-e.b);i=$wnd.Math.min(i,p-e.d);f=$wnd.Math.max(f,o+r+e.c);g=$wnd.Math.max(g,p+d+e.a)}n=BD(hkd(a,(Y9c(),f9c)),116);m=new f7c(h-n.b,i-n.d);for(k=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));k.e!=k.i.gc();){j=BD(Dyd(k),33);dld(j,j.i-m.a);eld(j,j.j-m.b)}q=f-h+(n.b+n.c);c=g-i+(n.d+n.a);cld(a,q);ald(a,c);b.n&&!!a&&Tdd(b,i6d(a),(pgd(),mgd))} +function rGb(a){var b,c,d,e,f,g,h,i,j,k;d=new Rkb;for(g=new olb(a.e.a);g.a0){gA(a,c,0);c.a+=String.fromCharCode(d);e=lA(b,f);gA(a,c,e);f+=e-1;continue}if(d==39){if(f+11){p=KC(WD,oje,25,a.b.b.c.length,15,1);l=0;for(j=new olb(a.b.b);j.a=h&&e<=i){if(h<=e&&f<=i){c[k++]=e;c[k++]=f;d+=2}else if(h<=e){c[k++]=e;c[k++]=i;a.b[d]=i+1;g+=2}else if(f<=i){c[k++]=h;c[k++]=f;d+=2}else{c[k++]=h;c[k++]=i;a.b[d]=i+1}}else if(iQie)&&h<10);zVb(a.c,new _Ub);OUb(a);vVb(a.c);yUb(a.f)} +function sZb(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(!Ccb(DD(vNb(c,(Nyc(),fxc))))){return}for(h=new olb(c.j);h.a=2){i=Jsb(c,0);g=BD(Xsb(i),8);h=BD(Xsb(i),8);while(h.a0&&jEb(j,true,(ead(),bad));h.k==(j0b(),e0b)&&kEb(j);Rhb(a.f,h,b)}}} +function Bbc(a,b,c){var d,e,f,g,h,i,j,k,l,m;Odd(c,'Node promotion heuristic',1);a.g=b;Abc(a);a.q=BD(vNb(b,(Nyc(),rxc)),260);k=BD(vNb(a.g,qxc),19).a;f=new Jbc;switch(a.q.g){case 2:case 1:Dbc(a,f);break;case 3:a.q=(kAc(),jAc);Dbc(a,f);i=0;for(h=new olb(a.a);h.aa.j){a.q=dAc;Dbc(a,f)}break;case 4:a.q=(kAc(),jAc);Dbc(a,f);j=0;for(e=new olb(a.b);e.aa.k){a.q=gAc;Dbc(a,f)}break;case 6:m=QD($wnd.Math.ceil(a.f.length*k/100));Dbc(a,new Mbc(m));break;case 5:l=QD($wnd.Math.ceil(a.d*k/100));Dbc(a,new Pbc(l));break;default:Dbc(a,f);}Ebc(a,b);Qdd(c)} +function fFc(a,b,c){var d,e,f,g;this.j=a;this.e=WZb(a);this.o=this.j.e;this.i=!!this.o;this.p=this.i?BD(Ikb(c,Q_b(this.o).p),214):null;e=BD(vNb(a,(wtc(),Ksc)),21);this.g=e.Hc((Orc(),Hrc));this.b=new Rkb;this.d=new rHc(this.e);g=BD(vNb(this.j,jtc),230);this.q=wFc(b,g,this.e);this.k=new BGc(this);f=Ou(OC(GC(qY,1),Uhe,225,0,[this,this.d,this.k,this.q]));if(b==(rGc(),oGc)&&!Ccb(DD(vNb(a,(Nyc(),Awc))))){d=new SEc(this.e);f.c[f.c.length]=d;this.c=new uEc(d,g,BD(this.q,402))}else if(b==oGc&&Ccb(DD(vNb(a,(Nyc(),Awc))))){d=new SEc(this.e);f.c[f.c.length]=d;this.c=new XGc(d,g,BD(this.q,402))}else{this.c=new Oic(b,this)}Ekb(f,this.c);$Ic(f,this.e);this.s=AGc(this.k)} +function xUc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;l=BD(pr((g=Jsb((new ZRc(b)).a.d,0),new aSc(g))),86);o=l?BD(vNb(l,(mTc(),_Sc)),86):null;e=1;while(!!l&&!!o){i=0;u=0;c=l;d=o;for(h=0;h=a.i){++a.i;Ekb(a.a,meb(1));Ekb(a.b,k)}else{d=a.c[b.p][1];Nkb(a.a,j,meb(BD(Ikb(a.a,j),19).a+1-d));Nkb(a.b,j,Edb(ED(Ikb(a.b,j)))+k-d*a.e)}(a.q==(kAc(),dAc)&&(BD(Ikb(a.a,j),19).a>a.j||BD(Ikb(a.a,j-1),19).a>a.j)||a.q==gAc&&(Edb(ED(Ikb(a.b,j)))>a.k||Edb(ED(Ikb(a.b,j-1)))>a.k))&&(i=false);for(g=new Sr(ur(R_b(b).a.Kc(),new Sq));Qr(g);){f=BD(Rr(g),17);h=f.c.i;if(a.f[h.p]==j){l=Cbc(a,h);e=e+BD(l.a,19).a;i=i&&Ccb(DD(l.b))}}a.f[b.p]=j;e=e+a.c[b.p][0];return new vgd(meb(e),(Bcb(),i?true:false))} +function sPc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r;l=new Lqb;g=new Rkb;qPc(a,c,a.d.fg(),g,l);qPc(a,d,a.d.gg(),g,l);a.b=0.2*(p=rPc(LAb(new YAb(null,new Kub(g,16)),new xPc)),q=rPc(LAb(new YAb(null,new Kub(g,16)),new zPc)),$wnd.Math.min(p,q));f=0;for(h=0;h=2&&(r=WNc(g,true,m),!a.e&&(a.e=new ZOc(a)),VOc(a.e,r,g,a.b),undefined);uPc(g,m);wPc(g);n=-1;for(k=new olb(g);k.ah} +function k6b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;c=BD(vNb(a,(Nyc(),Vxc)),98);g=a.f;f=a.d;h=g.a+f.b+f.c;i=0-f.d-a.c.b;k=g.b+f.d+f.a-a.c.b;j=new Rkb;l=new Rkb;for(e=new olb(b);e.a0),BD(k.a.Xb(k.c=--k.b),17));while(f!=d&&k.b>0){a.a[f.p]=true;a.a[d.p]=true;f=(sCb(k.b>0),BD(k.a.Xb(k.c=--k.b),17))}k.b>0&&uib(k)}}}} +function Vmd(b,c,d){var e,f,g,h,i,j,k,l,m;if(b.a!=c.Aj()){throw vbb(new Wdb(tte+c.ne()+ute))}e=o1d((O6d(),M6d),c).$k();if(e){return e.Aj().Nh().Ih(e,d)}h=o1d(M6d,c).al();if(h){if(d==null){return null}i=BD(d,15);if(i.dc()){return ''}m=new Hfb;for(g=i.Kc();g.Ob();){f=g.Pb();Efb(m,h.Aj().Nh().Ih(h,f));m.a+=' '}return lcb(m,m.a.length-1)}l=o1d(M6d,c).bl();if(!l.dc()){for(k=l.Kc();k.Ob();){j=BD(k.Pb(),148);if(j.wj(d)){try{m=j.Aj().Nh().Ih(j,d);if(m!=null){return m}}catch(a){a=ubb(a);if(!JD(a,102))throw vbb(a)}}}throw vbb(new Wdb("Invalid value: '"+d+"' for datatype :"+c.ne()))}BD(c,834).Fj();return d==null?null:JD(d,172)?''+BD(d,172).a:rb(d)==$J?CQd(Pmd[0],BD(d,199)):fcb(d)} +function zQc(a){var b,c,d,e,f,g,h,i,j,k;j=new Psb;h=new Psb;for(f=new olb(a);f.a-1){for(e=Jsb(h,0);e.b!=e.d.c;){d=BD(Xsb(e),128);d.v=g}while(h.b!=0){d=BD(Vt(h,0),128);for(c=new olb(d.i);c.a0){c+=i.n.a+i.o.a/2;++l}for(o=new olb(i.j);o.a0&&(c/=l);r=KC(UD,Vje,25,d.a.c.length,15,1);h=0;for(j=new olb(d.a);j.a=h&&e<=i){if(h<=e&&f<=i){d+=2}else if(h<=e){a.b[d]=i+1;g+=2}else if(f<=i){c[k++]=e;c[k++]=h-1;d+=2}else{c[k++]=e;c[k++]=h-1;a.b[d]=i+1;g+=2}}else if(i0?(e-=86400000):(e+=86400000);i=new gB(wbb(Cbb(b.q.getTime()),e))}k=new Vfb;j=a.a.length;for(f=0;f=97&&d<=122||d>=65&&d<=90){for(g=f+1;g=j){throw vbb(new Wdb("Missing trailing '"))}g+10&&c.c==0){!b&&(b=new Rkb);b.c[b.c.length]=c}}if(b){while(b.c.length!=0){c=BD(Kkb(b,0),233);if(!!c.b&&c.b.c.length>0){for(f=(!c.b&&(c.b=new Rkb),new olb(c.b));f.aJkb(a,c,0)){return new vgd(e,c)}}else if(Edb(REc(e.g,e.d[0]).a)>Edb(REc(c.g,c.d[0]).a)){return new vgd(e,c)}}}for(h=(!c.e&&(c.e=new Rkb),c.e).Kc();h.Ob();){g=BD(h.Pb(),233);i=(!g.b&&(g.b=new Rkb),g.b);wCb(0,i.c.length);aCb(i.c,0,c);g.c==i.c.length&&(b.c[b.c.length]=g,true)}}}return null} +function wlb(a,b){var c,d,e,f,g,h,i,j,k;if(a==null){return Xhe}i=b.a.zc(a,b);if(i!=null){return '[...]'}c=new xwb(She,'[',']');for(e=a,f=0,g=e.length;f=14&&k<=16))){if(b.a._b(d)){!c.a?(c.a=new Wfb(c.d)):Qfb(c.a,c.b);Nfb(c.a,'[...]')}else{h=CD(d);j=new Vqb(b);uwb(c,wlb(h,j))}}else JD(d,177)?uwb(c,Xlb(BD(d,177))):JD(d,190)?uwb(c,Qlb(BD(d,190))):JD(d,195)?uwb(c,Rlb(BD(d,195))):JD(d,2012)?uwb(c,Wlb(BD(d,2012))):JD(d,48)?uwb(c,Ulb(BD(d,48))):JD(d,364)?uwb(c,Vlb(BD(d,364))):JD(d,832)?uwb(c,Tlb(BD(d,832))):JD(d,104)&&uwb(c,Slb(BD(d,104)))}else{uwb(c,d==null?Xhe:fcb(d))}}return !c.a?c.c:c.e.length==0?c.a.a:c.a.a+(''+c.e)} +function xQb(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;h=itd(b,false,false);r=ofd(h);d&&(r=w7c(r));t=Edb(ED(hkd(b,(CPb(),vPb))));q=(sCb(r.b!=0),BD(r.a.a.c,8));l=BD(Ut(r,1),8);if(r.b>2){k=new Rkb;Gkb(k,new Jib(r,1,r.b));f=sQb(k,t+a.a);s=new XOb(f);tNb(s,b);c.c[c.c.length]=s}else{d?(s=BD(Ohb(a.b,jtd(b)),266)):(s=BD(Ohb(a.b,ltd(b)),266))}i=jtd(b);d&&(i=ltd(b));g=zQb(q,i);j=t+a.a;if(g.a){j+=$wnd.Math.abs(q.b-l.b);p=new f7c(l.a,(l.b+q.b)/2)}else{j+=$wnd.Math.abs(q.a-l.a);p=new f7c((l.a+q.a)/2,l.b)}d?Rhb(a.d,b,new ZOb(s,g,p,j)):Rhb(a.c,b,new ZOb(s,g,p,j));Rhb(a.b,b,s);o=(!b.n&&(b.n=new cUd(D2,b,1,7)),b.n);for(n=new Fyd(o);n.e!=n.i.gc();){m=BD(Dyd(n),137);e=wQb(a,m,true,0,0);c.c[c.c.length]=e}} +function wPc(a){var b,c,d,e,f,g,h,i,j,k;j=new Rkb;h=new Rkb;for(g=new olb(a);g.a-1){for(f=new olb(h);f.a0){continue}rOc(i,$wnd.Math.min(i.o,e.o-1));qOc(i,i.i-1);i.i==0&&(h.c[h.c.length]=i,true)}}}} +function QQd(a,b,c){var d,e,f,g,h,i,j;j=a.c;!b&&(b=FQd);a.c=b;if((a.Db&4)!=0&&(a.Db&1)==0){i=new nSd(a,1,2,j,a.c);!c?(c=i):c.Ei(i)}if(j!=b){if(JD(a.Cb,284)){if(a.Db>>16==-10){c=BD(a.Cb,284).nk(b,c)}else if(a.Db>>16==-15){!b&&(b=(jGd(),YFd));!j&&(j=(jGd(),YFd));if(a.Cb.nh()){i=new pSd(a.Cb,1,13,j,b,HLd(QSd(BD(a.Cb,59)),a),false);!c?(c=i):c.Ei(i)}}}else if(JD(a.Cb,88)){if(a.Db>>16==-23){JD(b,88)||(b=(jGd(),_Fd));JD(j,88)||(j=(jGd(),_Fd));if(a.Cb.nh()){i=new pSd(a.Cb,1,10,j,b,HLd(VKd(BD(a.Cb,26)),a),false);!c?(c=i):c.Ei(i)}}}else if(JD(a.Cb,444)){h=BD(a.Cb,836);g=(!h.b&&(h.b=new RYd(new NYd)),h.b);for(f=(d=new nib((new eib(g.a)).a),new ZYd(d));f.a.b;){e=BD(lib(f.a).cd(),87);c=QQd(e,MQd(e,h),c)}}}return c} +function O1b(a,b){var c,d,e,f,g,h,i,j,k,l,m;g=Ccb(DD(hkd(a,(Nyc(),fxc))));m=BD(hkd(a,Yxc),21);i=false;j=false;l=new Fyd((!a.c&&(a.c=new cUd(F2,a,9,9)),a.c));while(l.e!=l.i.gc()&&(!i||!j)){f=BD(Dyd(l),118);h=0;for(e=ul(pl(OC(GC(KI,1),Uhe,20,0,[(!f.d&&(f.d=new y5d(B2,f,8,5)),f.d),(!f.e&&(f.e=new y5d(B2,f,7,4)),f.e)])));Qr(e);){d=BD(Rr(e),79);k=g&&Qld(d)&&Ccb(DD(hkd(d,gxc)));c=ELd((!d.b&&(d.b=new y5d(z2,d,4,7)),d.b),f)?a==Xod(atd(BD(qud((!d.c&&(d.c=new y5d(z2,d,5,8)),d.c),0),82))):a==Xod(atd(BD(qud((!d.b&&(d.b=new y5d(z2,d,4,7)),d.b),0),82)));if(k||c){++h;if(h>1){break}}}h>0?(i=true):m.Hc((rcd(),ncd))&&(!f.n&&(f.n=new cUd(D2,f,1,7)),f.n).i>0&&(i=true);h>1&&(j=true)}i&&b.Fc((Orc(),Hrc));j&&b.Fc((Orc(),Irc))} +function zfd(a){var b,c,d,e,f,g,h,i,j,k,l,m;m=BD(hkd(a,(Y9c(),Y8c)),21);if(m.dc()){return null}h=0;g=0;if(m.Hc((tdd(),rdd))){k=BD(hkd(a,t9c),98);d=2;c=2;e=2;f=2;b=!Xod(a)?BD(hkd(a,z8c),103):BD(hkd(Xod(a),z8c),103);for(j=new Fyd((!a.c&&(a.c=new cUd(F2,a,9,9)),a.c));j.e!=j.i.gc();){i=BD(Dyd(j),118);l=BD(hkd(i,A9c),61);if(l==(Ucd(),Scd)){l=lfd(i,b);jkd(i,A9c,l)}if(k==(dcd(),$bd)){switch(l.g){case 1:d=$wnd.Math.max(d,i.i+i.g);break;case 2:c=$wnd.Math.max(c,i.j+i.f);break;case 3:e=$wnd.Math.max(e,i.i+i.g);break;case 4:f=$wnd.Math.max(f,i.j+i.f);}}else{switch(l.g){case 1:d+=i.g+2;break;case 2:c+=i.f+2;break;case 3:e+=i.g+2;break;case 4:f+=i.f+2;}}}h=$wnd.Math.max(d,e);g=$wnd.Math.max(c,f)}return Afd(a,h,g,true,true)} +function lnc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;s=BD(GAb(VAb(JAb(new YAb(null,new Kub(b.d,16)),new pnc(c)),new rnc(c)),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);l=Ohe;k=Rie;for(i=new olb(b.b.j);i.a0;if(j){if(j){m=r.p;g?++m:--m;l=BD(Ikb(r.c.a,m),10);d=I4b(l);n=!(s6c(d,w,c[0])||n6c(d,w,c[0]))}}else{n=true}}o=false;v=b.D.i;if(!!v&&!!v.c&&h.e){k=g&&v.p>0||!g&&v.p0&&(b.a+=She,b);yfd(BD(Dyd(h),160),b)}b.a+=gne;i=new Oyd((!d.c&&(d.c=new y5d(z2,d,5,8)),d.c));while(i.e!=i.i.gc()){i.e>0&&(b.a+=She,b);yfd(BD(Dyd(i),160),b)}b.a+=')'}}} +function y2b(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;f=BD(vNb(a,(wtc(),$sc)),79);if(!f){return}d=a.a;e=new g7c(c);P6c(e,C2b(a));if(f_b(a.d.i,a.c.i)){m=a.c;l=l7c(OC(GC(m1,1),nie,8,0,[m.n,m.a]));c7c(l,c)}else{l=A0b(a.c)}Gsb(d,l,d.a,d.a.a);n=A0b(a.d);vNb(a,utc)!=null&&P6c(n,BD(vNb(a,utc),8));Gsb(d,n,d.c.b,d.c);q7c(d,e);g=itd(f,true,true);kmd(g,BD(qud((!f.b&&(f.b=new y5d(z2,f,4,7)),f.b),0),82));lmd(g,BD(qud((!f.c&&(f.c=new y5d(z2,f,5,8)),f.c),0),82));ifd(d,g);for(k=new olb(a.b);k.a=0){i=null;h=new Bib(k.a,j+1);while(h.bg?1:Ny(isNaN(0),isNaN(g)))<0&&(null,My(Jqe),($wnd.Math.abs(g-1)<=Jqe||g==1||isNaN(g)&&isNaN(1)?0:g<1?-1:g>1?1:Ny(isNaN(g),isNaN(1)))<0)&&(null,My(Jqe),($wnd.Math.abs(0-h)<=Jqe||0==h||isNaN(0)&&isNaN(h)?0:0h?1:Ny(isNaN(0),isNaN(h)))<0)&&(null,My(Jqe),($wnd.Math.abs(h-1)<=Jqe||h==1||isNaN(h)&&isNaN(1)?0:h<1?-1:h>1?1:Ny(isNaN(h),isNaN(1)))<0));return f} +function z6d(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(l=new usb(new nsb(a));l.b!=l.c.a.d;){k=tsb(l);h=BD(k.d,56);b=BD(k.e,56);g=h.Tg();for(p=0,u=(g.i==null&&TKd(g),g.i).length;p=0&&p=j.c.c.length?(k=JJc((j0b(),h0b),g0b)):(k=JJc((j0b(),g0b),g0b));k*=2;f=c.a.g;c.a.g=$wnd.Math.max(f,f+(k-f));g=c.b.g;c.b.g=$wnd.Math.max(g,g+(k-g));e=b}}} +function VNc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;v=Hx(a);k=new Rkb;h=a.c.length;l=h-1;m=h+1;while(v.a.c!=0){while(c.b!=0){t=(sCb(c.b!=0),BD(Nsb(c,c.a.a),112));Jwb(v.a,t)!=null;t.g=l--;YNc(t,b,c,d)}while(b.b!=0){u=(sCb(b.b!=0),BD(Nsb(b,b.a.a),112));Jwb(v.a,u)!=null;u.g=m++;YNc(u,b,c,d)}j=Rie;for(r=(g=new Ywb((new cxb((new Gjb(v.a)).a)).b),new Njb(g));sib(r.a.a);){q=(f=Wwb(r.a),BD(f.cd(),112));if(!d&&q.b>0&&q.a<=0){k.c=KC(SI,Uhe,1,0,5,1);k.c[k.c.length]=q;break}p=q.i-q.d;if(p>=j){if(p>j){k.c=KC(SI,Uhe,1,0,5,1);j=p}k.c[k.c.length]=q}}if(k.c.length!=0){i=BD(Ikb(k,Bub(e,k.c.length)),112);Jwb(v.a,i)!=null;i.g=m++;YNc(i,b,c,d);k.c=KC(SI,Uhe,1,0,5,1)}}s=a.c.length+1;for(o=new olb(a);o.a0){m.d+=k.n.d;m.d+=k.d}if(m.a>0){m.a+=k.n.a;m.a+=k.d}if(m.b>0){m.b+=k.n.b;m.b+=k.d}if(m.c>0){m.c+=k.n.c;m.c+=k.d}return m} +function d6b(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;m=c.d;l=c.c;f=new f7c(c.f.a+c.d.b+c.d.c,c.f.b+c.d.d+c.d.a);g=f.b;for(j=new olb(a.a);j.a0){a.c[b.c.p][b.p].d+=Cub(a.i,24)*lke*0.07000000029802322-0.03500000014901161;a.c[b.c.p][b.p].a=a.c[b.c.p][b.p].d/a.c[b.c.p][b.p].b}} +function m5b(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(o=new olb(a);o.ad.d;d.d=$wnd.Math.max(d.d,b);if(h&&c){d.d=$wnd.Math.max(d.d,d.a);d.a=d.d+e}break;case 3:c=b>d.a;d.a=$wnd.Math.max(d.a,b);if(h&&c){d.a=$wnd.Math.max(d.a,d.d);d.d=d.a+e}break;case 2:c=b>d.c;d.c=$wnd.Math.max(d.c,b);if(h&&c){d.c=$wnd.Math.max(d.b,d.c);d.b=d.c+e}break;case 4:c=b>d.b;d.b=$wnd.Math.max(d.b,b);if(h&&c){d.b=$wnd.Math.max(d.b,d.c);d.c=d.b+e}}}}} +function l3b(a){var b,c,d,e,f,g,h,i,j,k,l;for(j=new olb(a);j.a0||k.j==Tcd&&k.e.c.length-k.g.c.length<0)){b=false;break}for(e=new olb(k.g);e.a=j&&v>=q){m+=o.n.b+p.n.b+p.a.b-u;++h}}}}if(c){for(g=new olb(s.e);g.a=j&&v>=q){m+=o.n.b+p.n.b+p.a.b-u;++h}}}}}if(h>0){w+=m/h;++n}}if(n>0){b.a=e*w/n;b.g=n}else{b.a=0;b.g=0}} +function oMc(a,b){var c,d,e,f,g,h,i,j,k,l,m;for(e=new olb(a.a.b);e.aQje||b.o==cMc&&k0&&dld(r,u*w);v>0&&eld(r,v*A)}stb(a.b,new CQb);b=new Rkb;for(h=new nib((new eib(a.c)).a);h.b;){g=lib(h);d=BD(g.cd(),79);c=BD(g.dd(),395).a;e=itd(d,false,false);l=oQb(jtd(d),ofd(e),c);ifd(l,e);t=ktd(d);if(!!t&&Jkb(b,t,0)==-1){b.c[b.c.length]=t;pQb(t,(sCb(l.b!=0),BD(l.a.a.c,8)),c)}}for(q=new nib((new eib(a.d)).a);q.b;){p=lib(q);d=BD(p.cd(),79);c=BD(p.dd(),395).a;e=itd(d,false,false);l=oQb(ltd(d),w7c(ofd(e)),c);l=w7c(l);ifd(l,e);t=mtd(d);if(!!t&&Jkb(b,t,0)==-1){b.c[b.c.length]=t;pQb(t,(sCb(l.b!=0),BD(l.c.b.c,8)),c)}}} +function _Vc(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B;if(c.c.length!=0){o=new Rkb;for(n=new olb(c);n.a1){n=new ZQc(o,t,d);reb(t,new PQc(a,n));g.c[g.c.length]=n;for(l=t.a.ec().Kc();l.Ob();){k=BD(l.Pb(),46);Lkb(f,k.b)}}if(h.a.gc()>1){n=new ZQc(o,h,d);reb(h,new RQc(a,n));g.c[g.c.length]=n;for(l=h.a.ec().Kc();l.Ob();){k=BD(l.Pb(),46);Lkb(f,k.b)}}}} +function $Wc(a){r4c(a,new E3c(L3c(P3c(M3c(O3c(N3c(new R3c,sre),'ELK Radial'),'A radial layout provider which is based on the algorithm of Peter Eades published in "Drawing free trees.", published by International Institute for Advanced Study of Social Information Science, Fujitsu Limited in 1991. The radial layouter takes a tree and places the nodes in radial order around the root. The nodes of the same tree level are placed on the same radius.'),new bXc),sre)));p4c(a,sre,uqe,Ksd(UWc));p4c(a,sre,wme,Ksd(XWc));p4c(a,sre,Fme,Ksd(NWc));p4c(a,sre,Tme,Ksd(OWc));p4c(a,sre,Eme,Ksd(PWc));p4c(a,sre,Gme,Ksd(MWc));p4c(a,sre,Dme,Ksd(QWc));p4c(a,sre,Hme,Ksd(TWc));p4c(a,sre,ore,Ksd(KWc));p4c(a,sre,nre,Ksd(LWc));p4c(a,sre,rre,Ksd(RWc));p4c(a,sre,lre,Ksd(SWc));p4c(a,sre,mre,Ksd(VWc));p4c(a,sre,pre,Ksd(WWc));p4c(a,sre,qre,Ksd(YWc))} +function LIb(a){var b;this.r=Cy(new OIb,new SIb);this.b=new Rpb(BD(Qb(F1),290));this.p=new Rpb(BD(Qb(F1),290));this.i=new Rpb(BD(Qb(DN),290));this.e=a;this.o=new g7c(a.rf());this.D=a.Df()||Ccb(DD(a.We((Y9c(),M8c))));this.A=BD(a.We((Y9c(),Y8c)),21);this.B=BD(a.We(b9c),21);this.q=BD(a.We(t9c),98);this.u=BD(a.We(x9c),21);if(!ucd(this.u)){throw vbb(new y2c('Invalid port label placement: '+this.u))}this.v=Ccb(DD(a.We(z9c)));this.j=BD(a.We(W8c),21);if(!Jbd(this.j)){throw vbb(new y2c('Invalid node label placement: '+this.j))}this.n=BD(bgd(a,U8c),116);this.k=Edb(ED(bgd(a,Q9c)));this.d=Edb(ED(bgd(a,P9c)));this.w=Edb(ED(bgd(a,X9c)));this.s=Edb(ED(bgd(a,R9c)));this.t=Edb(ED(bgd(a,S9c)));this.C=BD(bgd(a,V9c),142);this.c=2*this.d;b=!this.B.Hc((Idd(),zdd));this.f=new mIb(0,b,0);this.g=new mIb(1,b,0);lIb(this.f,(gHb(),eHb),this.g)} +function Lgd(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D;t=0;o=0;n=0;m=1;for(s=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));s.e!=s.i.gc();){q=BD(Dyd(s),33);m+=sr(new Sr(ur(_sd(q).a.Kc(),new Sq)));B=q.g;o=$wnd.Math.max(o,B);l=q.f;n=$wnd.Math.max(n,l);t+=B*l}p=(!a.a&&(a.a=new cUd(E2,a,10,11)),a.a).i;g=t+2*d*d*m*p;f=$wnd.Math.sqrt(g);i=$wnd.Math.max(f*c,o);h=$wnd.Math.max(f/c,n);for(r=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));r.e!=r.i.gc();){q=BD(Dyd(r),33);C=e.b+(Cub(b,26)*ike+Cub(b,27)*jke)*(i-q.g);D=e.b+(Cub(b,26)*ike+Cub(b,27)*jke)*(h-q.f);dld(q,C);eld(q,D)}A=i+(e.b+e.c);w=h+(e.d+e.a);for(v=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));v.e!=v.i.gc();){u=BD(Dyd(v),33);for(k=new Sr(ur(_sd(u).a.Kc(),new Sq));Qr(k);){j=BD(Rr(k),79);Pld(j)||Kgd(j,b,A,w)}}A+=e.b+e.c;w+=e.d+e.a;Afd(a,A,w,false,true)} +function Jcb(a){var b,c,d,e,f,g,h,i,j,k,l;if(a==null){throw vbb(new Oeb(Xhe))}j=a;f=a.length;i=false;if(f>0){b=(BCb(0,a.length),a.charCodeAt(0));if(b==45||b==43){a=a.substr(1);--f;i=b==45}}if(f==0){throw vbb(new Oeb(Oje+j+'"'))}while(a.length>0&&(BCb(0,a.length),a.charCodeAt(0)==48)){a=a.substr(1);--f}if(f>(Neb(),Leb)[10]){throw vbb(new Oeb(Oje+j+'"'))}for(e=0;e0){l=-parseInt(a.substr(0,d),10);a=a.substr(d);f-=d;c=false}while(f>=g){d=parseInt(a.substr(0,g),10);a=a.substr(g);f-=g;if(c){c=false}else{if(ybb(l,h)<0){throw vbb(new Oeb(Oje+j+'"'))}l=Ibb(l,k)}l=Qbb(l,d)}if(ybb(l,0)>0){throw vbb(new Oeb(Oje+j+'"'))}if(!i){l=Jbb(l);if(ybb(l,0)<0){throw vbb(new Oeb(Oje+j+'"'))}}return l} +function Z6d(a,b){X6d();var c,d,e,f,g,h,i;this.a=new a7d(this);this.b=a;this.c=b;this.f=c2d(q1d((O6d(),M6d),b));if(this.f.dc()){if((h=t1d(M6d,a))==b){this.e=true;this.d=new Rkb;this.f=new oFd;this.f.Fc(Ewe);BD(V1d(p1d(M6d,bKd(a)),''),26)==a&&this.f.Fc(u1d(M6d,bKd(a)));for(e=g1d(M6d,a).Kc();e.Ob();){d=BD(e.Pb(),170);switch($1d(q1d(M6d,d))){case 4:{this.d.Fc(d);break}case 5:{this.f.Gc(c2d(q1d(M6d,d)));break}}}}else{Q6d();if(BD(b,66).Oj()){this.e=true;this.f=null;this.d=new Rkb;for(g=0,i=(a.i==null&&TKd(a),a.i).length;g=0&&g0&&(BD(Mpb(a.b,b),124).a.b=c)} +function b3b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;Odd(b,'Comment pre-processing',1);c=0;i=new olb(a.a);while(i.a0){j=(BCb(0,c.length),c.charCodeAt(0));if(j!=64){if(j==37){m=c.lastIndexOf('%');k=false;if(m!=0&&(m==n-1||(k=(BCb(m+1,c.length),c.charCodeAt(m+1)==46)))){h=c.substr(1,m-1);u=dfb('%',h)?null:QEd(h);e=0;if(k){try{e=Icb(c.substr(m+2),Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){i=a;throw vbb(new rFd(i))}else throw vbb(a)}}for(r=pRd(b.Wg());r.Ob();){p=MRd(r);if(JD(p,510)){f=BD(p,590);t=f.d;if((u==null?t==null:dfb(u,t))&&e--==0){return f}}}return null}}l=c.lastIndexOf('.');o=l==-1?c:c.substr(0,l);d=0;if(l!=-1){try{d=Icb(c.substr(l+1),Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){o=c}else throw vbb(a)}}o=dfb('%',o)?null:QEd(o);for(q=pRd(b.Wg());q.Ob();){p=MRd(q);if(JD(p,191)){g=BD(p,191);s=g.ne();if((o==null?s==null:dfb(o,s))&&d--==0){return g}}}return null}}return rid(b,c)} +function f6b(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F;w=new Rkb;for(o=new olb(a.b);o.a=b.length)return {done:true};var a=b[d++];return {value:[a,c.get(a)],done:false}}}};if(!xrb()){e.prototype.createObject=function(){return {}};e.prototype.get=function(a){return this.obj[':'+a]};e.prototype.set=function(a,b){this.obj[':'+a]=b};e.prototype[hke]=function(a){delete this.obj[':'+a]};e.prototype.keys=function(){var a=[];for(var b in this.obj){b.charCodeAt(0)==58&&a.push(b.substring(1))}return a}}return e} +function cde(a){ade();var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(a==null)return null;l=a.length*8;if(l==0){return ''}h=l%24;n=l/24|0;m=h!=0?n+1:n;f=null;f=KC(TD,$ie,25,m*4,15,1);j=0;k=0;b=0;c=0;d=0;g=0;e=0;for(i=0;i>24;j=(b&3)<<24>>24;o=(b&-128)==0?b>>2<<24>>24:(b>>2^192)<<24>>24;p=(c&-128)==0?c>>4<<24>>24:(c>>4^240)<<24>>24;q=(d&-128)==0?d>>6<<24>>24:(d>>6^252)<<24>>24;f[g++]=_ce[o];f[g++]=_ce[p|j<<4];f[g++]=_ce[k<<2|q];f[g++]=_ce[d&63]}if(h==8){b=a[e];j=(b&3)<<24>>24;o=(b&-128)==0?b>>2<<24>>24:(b>>2^192)<<24>>24;f[g++]=_ce[o];f[g++]=_ce[j<<4];f[g++]=61;f[g++]=61}else if(h==16){b=a[e];c=a[e+1];k=(c&15)<<24>>24;j=(b&3)<<24>>24;o=(b&-128)==0?b>>2<<24>>24:(b>>2^192)<<24>>24;p=(c&-128)==0?c>>4<<24>>24:(c>>4^240)<<24>>24;f[g++]=_ce[o];f[g++]=_ce[p|j<<4];f[g++]=_ce[k<<2];f[g++]=61}return zfb(f,0,f.length)} +function mB(a,b){var c,d,e,f,g,h,i;a.e==0&&a.p>0&&(a.p=-(a.p-1));a.p>Rie&&dB(b,a.p-nje);g=b.q.getDate();ZA(b,1);a.k>=0&&aB(b,a.k);if(a.c>=0){ZA(b,a.c)}else if(a.k>=0){i=new fB(b.q.getFullYear()-nje,b.q.getMonth(),35);d=35-i.q.getDate();ZA(b,$wnd.Math.min(d,g))}else{ZA(b,g)}a.f<0&&(a.f=b.q.getHours());a.b>0&&a.f<12&&(a.f+=12);$A(b,a.f==24&&a.g?0:a.f);a.j>=0&&_A(b,a.j);a.n>=0&&bB(b,a.n);a.i>=0&&cB(b,wbb(Ibb(Abb(Cbb(b.q.getTime()),_ie),_ie),a.i));if(a.a){e=new eB;dB(e,e.q.getFullYear()-nje-80);Gbb(Cbb(b.q.getTime()),Cbb(e.q.getTime()))&&dB(b,e.q.getFullYear()-nje+100)}if(a.d>=0){if(a.c==-1){c=(7+a.d-b.q.getDay())%7;c>3&&(c-=7);h=b.q.getMonth();ZA(b,b.q.getDate()+c);b.q.getMonth()!=h&&ZA(b,b.q.getDate()+(c>0?-7:7))}else{if(b.q.getDay()!=a.d){return false}}}if(a.o>Rie){f=b.q.getTimezoneOffset();cB(b,wbb(Cbb(b.q.getTime()),(a.o-f)*60*_ie))}return true} +function z2b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;e=vNb(b,(wtc(),$sc));if(!JD(e,239)){return}o=BD(e,33);p=b.e;m=new g7c(b.c);f=b.d;m.a+=f.b;m.b+=f.d;u=BD(hkd(o,(Nyc(),Ixc)),174);if(uqb(u,(Idd(),Add))){n=BD(hkd(o,Kxc),116);w_b(n,f.a);z_b(n,f.d);x_b(n,f.b);y_b(n,f.c)}c=new Rkb;for(k=new olb(b.a);k.a0&&Ekb(a.p,k);Ekb(a.o,k)}b-=d;n=i+b;j+=b*a.e;Nkb(a.a,h,meb(n));Nkb(a.b,h,j);a.j=$wnd.Math.max(a.j,n);a.k=$wnd.Math.max(a.k,j);a.d+=b;b+=p}} +function Ucd(){Ucd=ccb;var a;Scd=new Ycd(ole,0);Acd=new Ycd(xle,1);zcd=new Ycd(yle,2);Rcd=new Ycd(zle,3);Tcd=new Ycd(Ale,4);Fcd=(mmb(),new zob((a=BD(gdb(F1),9),new xqb(a,BD(_Bb(a,a.length),9),0))));Gcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[])));Bcd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[])));Ocd=Up(qqb(Rcd,OC(GC(F1,1),bne,61,0,[])));Qcd=Up(qqb(Tcd,OC(GC(F1,1),bne,61,0,[])));Lcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[Rcd])));Ecd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[Tcd])));Ncd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[Tcd])));Hcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd])));Pcd=Up(qqb(Rcd,OC(GC(F1,1),bne,61,0,[Tcd])));Ccd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[Rcd])));Kcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd,Tcd])));Dcd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[Rcd,Tcd])));Mcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[Rcd,Tcd])));Icd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd,Rcd])));Jcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd,Rcd,Tcd])))} +function fSc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;if(b.b!=0){n=new Psb;h=null;o=null;d=QD($wnd.Math.floor($wnd.Math.log(b.b)*$wnd.Math.LOG10E)+1);i=0;for(t=Jsb(b,0);t.b!=t.d.c;){r=BD(Xsb(t),86);if(PD(o)!==PD(vNb(r,(mTc(),$Sc)))){o=GD(vNb(r,$Sc));i=0}o!=null?(h=o+iSc(i++,d)):(h=iSc(i++,d));yNb(r,$Sc,h);for(q=(e=Jsb((new ZRc(r)).a.d,0),new aSc(e));Wsb(q.a);){p=BD(Xsb(q.a),188).c;Gsb(n,p,n.c.b,n.c);yNb(p,$Sc,h)}}m=new Lqb;for(g=0;g=i){sCb(r.b>0);r.a.Xb(r.c=--r.b);break}else if(p.a>j){if(!e){Ekb(p.b,l);p.c=$wnd.Math.min(p.c,j);p.a=$wnd.Math.max(p.a,i);e=p}else{Gkb(e.b,p.b);e.a=$wnd.Math.max(e.a,p.a);uib(r)}}}if(!e){e=new TCc;e.c=j;e.a=i;Aib(r,e);Ekb(e.b,l)}}h=b.b;k=0;for(q=new olb(d);q.ah?1:0}if(a.b){a.b._b(f)&&(e=BD(a.b.xc(f),19).a);a.b._b(i)&&(h=BD(a.b.xc(i),19).a)}return eh?1:0}return b.e.c.length!=0&&c.g.c.length!=0?1:-1} +function acc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A;Odd(b,Ine,1);p=new Rkb;w=new Rkb;for(j=new olb(a.b);j.a0&&(t-=n);h_b(g,t);k=0;for(m=new olb(g.a);m.a0);h.a.Xb(h.c=--h.b)}i=0.4*d*k;!f&&h.bb.d.c){n=a.c[b.a.d];q=a.c[l.a.d];if(n==q){continue}AFb(DFb(CFb(EFb(BFb(new FFb,1),100),n),q))}}}}}}} +function QEd(a){IEd();var b,c,d,e,f,g,h,i;if(a==null)return null;e=hfb(a,wfb(37));if(e<0){return a}else{i=new Wfb(a.substr(0,e));b=KC(SD,wte,25,4,15,1);h=0;d=0;for(g=a.length;ee+2&&_Ed((BCb(e+1,a.length),a.charCodeAt(e+1)),xEd,yEd)&&_Ed((BCb(e+2,a.length),a.charCodeAt(e+2)),xEd,yEd)){c=dFd((BCb(e+1,a.length),a.charCodeAt(e+1)),(BCb(e+2,a.length),a.charCodeAt(e+2)));e+=2;if(d>0){(c&192)==128?(b[h++]=c<<24>>24):(d=0)}else if(c>=128){if((c&224)==192){b[h++]=c<<24>>24;d=2}else if((c&240)==224){b[h++]=c<<24>>24;d=3}else if((c&248)==240){b[h++]=c<<24>>24;d=4}}if(d>0){if(h==d){switch(h){case 2:{Kfb(i,((b[0]&31)<<6|b[1]&63)&aje);break}case 3:{Kfb(i,((b[0]&15)<<12|(b[1]&63)<<6|b[2]&63)&aje);break}}h=0;d=0}}else{for(f=0;f0){if(g+d>a.length){return false}h=rA(a.substr(0,g+d),b)}else{h=rA(a,b)}}switch(f){case 71:h=oA(a,g,OC(GC(ZI,1),nie,2,6,[pje,qje]),b);e.e=h;return true;case 77:return zA(a,b,e,h,g);case 76:return BA(a,b,e,h,g);case 69:return xA(a,b,g,e);case 99:return AA(a,b,g,e);case 97:h=oA(a,g,OC(GC(ZI,1),nie,2,6,['AM','PM']),b);e.b=h;return true;case 121:return DA(a,b,g,h,c,e);case 100:if(h<=0){return false}e.c=h;return true;case 83:if(h<0){return false}return yA(h,g,b[0],e);case 104:h==12&&(h=0);case 75:case 72:if(h<0){return false}e.f=h;e.g=false;return true;case 107:if(h<0){return false}e.f=h;e.g=true;return true;case 109:if(h<0){return false}e.j=h;return true;case 115:if(h<0){return false}e.n=h;return true;case 90:if(gw&&(o.c=w-o.b);Ekb(g.d,new BLb(o,bLb(g,o)));s=b==Acd?$wnd.Math.max(s,p.b+j.b.rf().b):$wnd.Math.min(s,p.b)}s+=b==Acd?a.t:-a.t;t=cLb((g.e=s,g));t>0&&(BD(Mpb(a.b,b),124).a.b=t);for(k=m.Kc();k.Ob();){j=BD(k.Pb(),111);if(!j.c||j.c.d.c.length<=0){continue}o=j.c.i;o.c-=j.e.a;o.d-=j.e.b}} +function SPb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;b=new Lqb;for(i=new Fyd(a);i.e!=i.i.gc();){h=BD(Dyd(i),33);c=new Tqb;Rhb(OPb,h,c);n=new aQb;e=BD(GAb(new YAb(null,new Lub(new Sr(ur($sd(h).a.Kc(),new Sq)))),Wyb(n,Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)])))),83);RPb(c,BD(e.xc((Bcb(),true)),14),new cQb);d=BD(GAb(JAb(BD(e.xc(false),15).Lc(),new eQb),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[Dyb]))),15);for(g=d.Kc();g.Ob();){f=BD(g.Pb(),79);m=ktd(f);if(m){j=BD(Wd(irb(b.f,m)),21);if(!j){j=UPb(m);jrb(b.f,m,j)}ye(c,j)}}e=BD(GAb(new YAb(null,new Lub(new Sr(ur(_sd(h).a.Kc(),new Sq)))),Wyb(n,Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[Dyb])))),83);RPb(c,BD(e.xc(true),14),new gQb);d=BD(GAb(JAb(BD(e.xc(false),15).Lc(),new iQb),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[Dyb]))),15);for(l=d.Kc();l.Ob();){k=BD(l.Pb(),79);m=mtd(k);if(m){j=BD(Wd(irb(b.f,m)),21);if(!j){j=UPb(m);jrb(b.f,m,j)}ye(c,j)}}}} +function rhb(a,b){phb();var c,d,e,f,g,h,i,j,k,l,m,n,o,p;i=ybb(a,0)<0;i&&(a=Jbb(a));if(ybb(a,0)==0){switch(b){case 0:return '0';case 1:return $je;case 2:return '0.00';case 3:return '0.000';case 4:return '0.0000';case 5:return '0.00000';case 6:return '0.000000';default:n=new Ufb;b<0?(n.a+='0E+',n):(n.a+='0E',n);n.a+=b==Rie?'2147483648':''+-b;return n.a;}}k=18;l=KC(TD,$ie,25,k+1,15,1);c=k;p=a;do{j=p;p=Abb(p,10);l[--c]=Tbb(wbb(48,Qbb(j,Ibb(p,10))))&aje}while(ybb(p,0)!=0);e=Qbb(Qbb(Qbb(k,c),b),1);if(b==0){i&&(l[--c]=45);return zfb(l,c,k-c)}if(b>0&&ybb(e,-6)>=0){if(ybb(e,0)>=0){f=c+Tbb(e);for(h=k-1;h>=f;h--){l[h+1]=l[h]}l[++f]=46;i&&(l[--c]=45);return zfb(l,c,k-c+1)}for(g=2;Gbb(g,wbb(Jbb(e),1));g++){l[--c]=48}l[--c]=46;l[--c]=48;i&&(l[--c]=45);return zfb(l,c,k-c)}o=c+1;d=k;m=new Vfb;i&&(m.a+='-',m);if(d-o>=1){Kfb(m,l[c]);m.a+='.';m.a+=zfb(l,c+1,k-c-1)}else{m.a+=zfb(l,c,k-c)}m.a+='E';ybb(e,0)>0&&(m.a+='+',m);m.a+=''+Ubb(e);return m.a} +function iQc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;a.e.a.$b();a.f.a.$b();a.c.c=KC(SI,Uhe,1,0,5,1);a.i.c=KC(SI,Uhe,1,0,5,1);a.g.a.$b();if(b){for(g=new olb(b.a);g.a=1){if(v-j>0&&o>=0){dld(l,l.i+u);eld(l,l.j+i*j)}else if(v-j<0&&n>=0){dld(l,l.i+u*v);eld(l,l.j+i)}}}}jkd(a,(Y9c(),Y8c),(tdd(),f=BD(gdb(I1),9),new xqb(f,BD(_Bb(f,f.length),9),0)));return new f7c(w,k)} +function Yfd(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;n=Xod(atd(BD(qud((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b),0),82)));o=Xod(atd(BD(qud((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c),0),82)));l=n==o;h=new d7c;b=BD(hkd(a,(Zad(),Sad)),74);if(!!b&&b.b>=2){if((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i==0){c=(Fhd(),e=new rmd,e);wtd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a),c)}else if((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i>1){m=new Oyd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a));while(m.e!=m.i.gc()){Eyd(m)}}ifd(b,BD(qud((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a),0),202))}if(l){for(d=new Fyd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a));d.e!=d.i.gc();){c=BD(Dyd(d),202);for(j=new Fyd((!c.a&&(c.a=new xMd(y2,c,5)),c.a));j.e!=j.i.gc();){i=BD(Dyd(j),469);h.a=$wnd.Math.max(h.a,i.a);h.b=$wnd.Math.max(h.b,i.b)}}}for(g=new Fyd((!a.n&&(a.n=new cUd(D2,a,1,7)),a.n));g.e!=g.i.gc();){f=BD(Dyd(g),137);k=BD(hkd(f,Yad),8);!!k&&bld(f,k.a,k.b);if(l){h.a=$wnd.Math.max(h.a,f.i+f.g);h.b=$wnd.Math.max(h.b,f.j+f.f)}}return h} +function yMc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B;t=b.c.length;e=new ULc(a.a,c,null,null);B=KC(UD,Vje,25,t,15,1);p=KC(UD,Vje,25,t,15,1);o=KC(UD,Vje,25,t,15,1);q=0;for(h=0;hB[i]&&(q=i);for(l=new olb(a.a.b);l.an){if(f){Fsb(w,m);Fsb(B,meb(j.b-1))}H=c.b;I+=m+b;m=0;k=$wnd.Math.max(k,c.b+c.c+G)}dld(h,H);eld(h,I);k=$wnd.Math.max(k,H+G+c.c);m=$wnd.Math.max(m,l);H+=G+b}k=$wnd.Math.max(k,d);F=I+m+c.a;if(Fqme;C=$wnd.Math.abs(m.b-o.b)>qme;(!c&&B&&C||c&&(B||C))&&Dsb(q.a,u)}ye(q.a,d);d.b==0?(m=u):(m=(sCb(d.b!=0),BD(d.c.b.c,8)));bZb(n,l,p);if(AZb(e)==A){if(Q_b(A.i)!=e.a){p=new d7c;Y$b(p,Q_b(A.i),s)}yNb(q,utc,p)}cZb(n,q,s);k.a.zc(n,k)}QZb(q,v);RZb(q,A)}for(j=k.a.ec().Kc();j.Ob();){i=BD(j.Pb(),17);QZb(i,null);RZb(i,null)}Qdd(b)} +function KQb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(a.gc()==1){return BD(a.Xb(0),231)}else if(a.gc()<=0){return new kRb}for(e=a.Kc();e.Ob();){c=BD(e.Pb(),231);o=0;k=Ohe;l=Ohe;i=Rie;j=Rie;for(n=new olb(c.e);n.ah){t=0;u+=g+r;g=0}JQb(p,c,t,u);b=$wnd.Math.max(b,t+q.a);g=$wnd.Math.max(g,q.b);t+=q.a+r}return p} +function Ioc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=new s7c;switch(a.a.g){case 3:m=BD(vNb(b.e,(wtc(),rtc)),15);n=BD(vNb(b.j,rtc),15);o=BD(vNb(b.f,rtc),15);c=BD(vNb(b.e,ptc),15);d=BD(vNb(b.j,ptc),15);e=BD(vNb(b.f,ptc),15);g=new Rkb;Gkb(g,m);n.Jc(new Loc);Gkb(g,JD(n,152)?km(BD(n,152)):JD(n,131)?BD(n,131).a:JD(n,54)?new ov(n):new dv(n));Gkb(g,o);f=new Rkb;Gkb(f,c);Gkb(f,JD(d,152)?km(BD(d,152)):JD(d,131)?BD(d,131).a:JD(d,54)?new ov(d):new dv(d));Gkb(f,e);yNb(b.f,rtc,g);yNb(b.f,ptc,f);yNb(b.f,stc,b.f);yNb(b.e,rtc,null);yNb(b.e,ptc,null);yNb(b.j,rtc,null);yNb(b.j,ptc,null);break;case 1:ye(k,b.e.a);Dsb(k,b.i.n);ye(k,Su(b.j.a));Dsb(k,b.a.n);ye(k,b.f.a);break;default:ye(k,b.e.a);ye(k,Su(b.j.a));ye(k,b.f.a);}Osb(b.f.a);ye(b.f.a,k);QZb(b.f,b.e.c);h=BD(vNb(b.e,(Nyc(),jxc)),74);j=BD(vNb(b.j,jxc),74);i=BD(vNb(b.f,jxc),74);if(!!h||!!j||!!i){l=new s7c;Goc(l,i);Goc(l,j);Goc(l,h);yNb(b.f,jxc,l)}QZb(b.j,null);RZb(b.j,null);QZb(b.e,null);RZb(b.e,null);$_b(b.a,null);$_b(b.i,null);!!b.g&&Ioc(a,b.g)} +function bde(a){ade();var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(a==null)return null;f=rfb(a);o=ede(f);if(o%4!=0){return null}p=o/4|0;if(p==0)return KC(SD,wte,25,0,15,1);l=null;b=0;c=0;d=0;e=0;g=0;h=0;i=0;j=0;n=0;m=0;k=0;l=KC(SD,wte,25,p*3,15,1);for(;n>4)<<24>>24;l[m++]=((c&15)<<4|d>>2&15)<<24>>24;l[m++]=(d<<6|e)<<24>>24}if(!dde(g=f[k++])||!dde(h=f[k++])){return null}b=$ce[g];c=$ce[h];i=f[k++];j=f[k++];if($ce[i]==-1||$ce[j]==-1){if(i==61&&j==61){if((c&15)!=0)return null;q=KC(SD,wte,25,n*3+1,15,1);$fb(l,0,q,0,n*3);q[m]=(b<<2|c>>4)<<24>>24;return q}else if(i!=61&&j==61){d=$ce[i];if((d&3)!=0)return null;q=KC(SD,wte,25,n*3+2,15,1);$fb(l,0,q,0,n*3);q[m++]=(b<<2|c>>4)<<24>>24;q[m]=((c&15)<<4|d>>2&15)<<24>>24;return q}else{return null}}else{d=$ce[i];e=$ce[j];l[m++]=(b<<2|c>>4)<<24>>24;l[m++]=((c&15)<<4|d>>2&15)<<24>>24;l[m++]=(d<<6|e)<<24>>24}return l} +function Sbc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;Odd(b,Ine,1);o=BD(vNb(a,(Nyc(),Swc)),218);for(e=new olb(a.b);e.a=2){p=true;m=new olb(f.j);c=BD(mlb(m),11);n=null;while(m.a0){e=BD(Ikb(q.c.a,w-1),10);g=a.i[e.p];B=$wnd.Math.ceil(jBc(a.n,e,q));f=v.a.e-q.d.d-(g.a.e+e.o.b+e.d.a)-B}j=Pje;if(w0&&A.a.e.e-A.a.a-(A.b.e.e-A.b.a)<0;o=t.a.e.e-t.a.a-(t.b.e.e-t.b.a)<0&&A.a.e.e-A.a.a-(A.b.e.e-A.b.a)>0;n=t.a.e.e+t.b.aA.b.e.e+A.a.a;u=0;!p&&!o&&(m?f+l>0?(u=l):j-d>0&&(u=d):n&&(f+h>0?(u=h):j-s>0&&(u=s)));v.a.e+=u;v.b&&(v.d.e+=u);return false} +function XGb(a,b,c){var d,e,f,g,h,i,j,k,l,m;d=new J6c(b.qf().a,b.qf().b,b.rf().a,b.rf().b);e=new I6c;if(a.c){for(g=new olb(b.wf());g.aj&&(d.a+=yfb(KC(TD,$ie,25,-j,15,1)));d.a+='Is';if(hfb(i,wfb(32))>=0){for(e=0;e=d.o.b/2}else{s=!l}if(s){r=BD(vNb(d,(wtc(),vtc)),15);if(!r){f=new Rkb;yNb(d,vtc,f)}else if(m){f=r}else{e=BD(vNb(d,tsc),15);if(!e){f=new Rkb;yNb(d,tsc,f)}else{r.gc()<=e.gc()?(f=r):(f=e)}}}else{e=BD(vNb(d,(wtc(),tsc)),15);if(!e){f=new Rkb;yNb(d,tsc,f)}else if(l){f=e}else{r=BD(vNb(d,vtc),15);if(!r){f=new Rkb;yNb(d,vtc,f)}else{e.gc()<=r.gc()?(f=e):(f=r)}}}f.Fc(a);yNb(a,(wtc(),vsc),c);if(b.d==c){RZb(b,null);c.e.c.length+c.g.c.length==0&&F0b(c,null);d3b(c)}else{QZb(b,null);c.e.c.length+c.g.c.length==0&&F0b(c,null)}Osb(b.a)} +function aoc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H;s=new Bib(a.b,0);k=b.Kc();o=0;j=BD(k.Pb(),19).a;v=0;c=new Tqb;A=new zsb;while(s.b=a.a){d=E6b(a,s);k=$wnd.Math.max(k,d.b);u=$wnd.Math.max(u,d.d);Ekb(h,new vgd(s,d))}}B=new Rkb;for(j=0;j0),q.a.Xb(q.c=--q.b),C=new H1b(a.b),Aib(q,C),sCb(q.b0){j=0;!!q&&(j+=h);j+=(C-1)*g;!!t&&(j+=h);B&&!!t&&(j=$wnd.Math.max(j,jQc(t,g,s,A)));if(j0){m=k<100?null:new Ixd(k);j=new Aud(b);o=j.g;r=KC(WD,oje,25,k,15,1);d=0;u=new zud(k);for(e=0;e=0;){if(n!=null?pb(n,o[i]):PD(n)===PD(o[i])){if(r.length<=d){q=r;r=KC(WD,oje,25,2*r.length,15,1);$fb(q,0,r,0,d)}r[d++]=e;wtd(u,o[i]);break v}}n=n;if(PD(n)===PD(h)){break}}}j=u;o=u.g;k=d;if(d>r.length){q=r;r=KC(WD,oje,25,d,15,1);$fb(q,0,r,0,d)}if(d>0){t=true;for(f=0;f=0;){tud(a,r[g])}if(d!=k){for(e=k;--e>=d;){tud(j,e)}q=r;r=KC(WD,oje,25,d,15,1);$fb(q,0,r,0,d)}b=j}}}else{b=Ctd(a,b);for(e=a.i;--e>=0;){if(b.Hc(a.g[e])){tud(a,e);t=true}}}if(t){if(r!=null){c=b.gc();l=c==1?FLd(a,4,b.Kc().Pb(),null,r[0],p):FLd(a,6,b,r,r[0],p);m=c<100?null:new Ixd(c);for(e=b.Kc();e.Ob();){n=e.Pb();m=Q2d(a,BD(n,72),m)}if(!m){Uhd(a.e,l)}else{m.Ei(l);m.Fi()}}else{m=Vxd(b.gc());for(e=b.Kc();e.Ob();){n=e.Pb();m=Q2d(a,BD(n,72),m)}!!m&&m.Fi()}return true}else{return false}} +function fYb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;c=new mYb(b);c.a||$Xb(b);j=ZXb(b);i=new Hp;q=new AYb;for(p=new olb(b.a);p.a0||c.o==dMc&&e0){l=BD(Ikb(m.c.a,g-1),10);B=jBc(a.b,m,l);q=m.n.b-m.d.d-(l.n.b+l.o.b+l.d.a+B)}else{q=m.n.b-m.d.d}j=$wnd.Math.min(q,j);if(gg?Anc(a,b,c):Anc(a,c,b);return eg?1:0}}d=BD(vNb(b,(wtc(),Zsc)),19).a;f=BD(vNb(c,Zsc),19).a;d>f?Anc(a,b,c):Anc(a,c,b);return df?1:0} +function u2c(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(Ccb(DD(hkd(b,(Y9c(),d9c))))){return mmb(),mmb(),jmb}j=(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a).i!=0;l=s2c(b);k=!l.dc();if(j||k){e=BD(hkd(b,F9c),149);if(!e){throw vbb(new y2c('Resolved algorithm is not set; apply a LayoutAlgorithmResolver before computing layout.'))}s=D3c(e,(Csd(),ysd));q2c(b);if(!j&&k&&!s){return mmb(),mmb(),jmb}i=new Rkb;if(PD(hkd(b,J8c))===PD((hbd(),ebd))&&(D3c(e,vsd)||D3c(e,usd))){n=p2c(a,b);o=new Psb;ye(o,(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a));while(o.b!=0){m=BD(o.b==0?null:(sCb(o.b!=0),Nsb(o,o.a.a)),33);q2c(m);r=PD(hkd(m,J8c))===PD(gbd);if(r||ikd(m,o8c)&&!C3c(e,hkd(m,F9c))){h=u2c(a,m,c,d);Gkb(i,h);jkd(m,J8c,gbd);hfd(m)}else{ye(o,(!m.a&&(m.a=new cUd(E2,m,10,11)),m.a))}}}else{n=(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a).i;for(g=new Fyd((!b.a&&(b.a=new cUd(E2,b,10,11)),b.a));g.e!=g.i.gc();){f=BD(Dyd(g),33);h=u2c(a,f,c,d);Gkb(i,h);hfd(f)}}for(q=new olb(i);q.a=0?(n=Zcd(h)):(n=Wcd(Zcd(h)));a.Ye($xc,n)}j=new d7c;m=false;if(a.Xe(Txc)){a7c(j,BD(a.We(Txc),8));m=true}else{_6c(j,g.a/2,g.b/2)}switch(n.g){case 4:yNb(k,mxc,(Ctc(),ytc));yNb(k,Bsc,(Gqc(),Fqc));k.o.b=g.b;p<0&&(k.o.a=-p);G0b(l,(Ucd(),zcd));m||(j.a=g.a);j.a-=g.a;break;case 2:yNb(k,mxc,(Ctc(),Atc));yNb(k,Bsc,(Gqc(),Dqc));k.o.b=g.b;p<0&&(k.o.a=-p);G0b(l,(Ucd(),Tcd));m||(j.a=0);break;case 1:yNb(k,Osc,(esc(),dsc));k.o.a=g.a;p<0&&(k.o.b=-p);G0b(l,(Ucd(),Rcd));m||(j.b=g.b);j.b-=g.b;break;case 3:yNb(k,Osc,(esc(),bsc));k.o.a=g.a;p<0&&(k.o.b=-p);G0b(l,(Ucd(),Acd));m||(j.b=0);}a7c(l.n,j);yNb(k,Txc,j);if(b==Zbd||b==_bd||b==$bd){o=0;if(b==Zbd&&a.Xe(Wxc)){switch(n.g){case 1:case 2:o=BD(a.We(Wxc),19).a;break;case 3:case 4:o=-BD(a.We(Wxc),19).a;}}else{switch(n.g){case 4:case 2:o=f.b;b==_bd&&(o/=e.b);break;case 1:case 3:o=f.a;b==_bd&&(o/=e.a);}}yNb(k,htc,o)}yNb(k,Hsc,n);return k} +function AGc(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C;c=Edb(ED(vNb(a.a.j,(Nyc(),Ewc))));if(c<-1||!a.a.i||ecd(BD(vNb(a.a.o,Vxc),98))||V_b(a.a.o,(Ucd(),zcd)).gc()<2&&V_b(a.a.o,Tcd).gc()<2){return true}if(a.a.c.Rf()){return false}v=0;u=0;t=new Rkb;for(i=a.a.e,j=0,k=i.length;j=c} +function ovd(){mvd();function h(f){var g=this;this.dispatch=function(a){var b=a.data;switch(b.cmd){case 'algorithms':var c=pvd((mmb(),new lnb(new $ib(lvd.b))));f.postMessage({id:b.id,data:c});break;case 'categories':var d=pvd((mmb(),new lnb(new $ib(lvd.c))));f.postMessage({id:b.id,data:d});break;case 'options':var e=pvd((mmb(),new lnb(new $ib(lvd.d))));f.postMessage({id:b.id,data:e});break;case 'register':svd(b.algorithms);f.postMessage({id:b.id});break;case 'layout':qvd(b.graph,b.layoutOptions||{},b.options||{});f.postMessage({id:b.id,data:b.graph});break;}};this.saveDispatch=function(b){try{g.dispatch(b)}catch(a){f.postMessage({id:b.data.id,error:a})}}} +function j(b){var c=this;this.dispatcher=new h({postMessage:function(a){c.onmessage({data:a})}});this.postMessage=function(a){setTimeout(function(){c.dispatcher.saveDispatch({data:a})},0)}} +if(typeof document===uke&&typeof self!==uke){var i=new h(self);self.onmessage=i.saveDispatch}else if(typeof module!==uke&&module.exports){Object.defineProperty(exports,'__esModule',{value:true});module.exports={'default':j,Worker:j}}} +function aae(a){if(a.N)return;a.N=true;a.b=Lnd(a,0);Knd(a.b,0);Knd(a.b,1);Knd(a.b,2);a.bb=Lnd(a,1);Knd(a.bb,0);Knd(a.bb,1);a.fb=Lnd(a,2);Knd(a.fb,3);Knd(a.fb,4);Qnd(a.fb,5);a.qb=Lnd(a,3);Knd(a.qb,0);Qnd(a.qb,1);Qnd(a.qb,2);Knd(a.qb,3);Knd(a.qb,4);Qnd(a.qb,5);Knd(a.qb,6);a.a=Mnd(a,4);a.c=Mnd(a,5);a.d=Mnd(a,6);a.e=Mnd(a,7);a.f=Mnd(a,8);a.g=Mnd(a,9);a.i=Mnd(a,10);a.j=Mnd(a,11);a.k=Mnd(a,12);a.n=Mnd(a,13);a.o=Mnd(a,14);a.p=Mnd(a,15);a.q=Mnd(a,16);a.s=Mnd(a,17);a.r=Mnd(a,18);a.t=Mnd(a,19);a.u=Mnd(a,20);a.v=Mnd(a,21);a.w=Mnd(a,22);a.B=Mnd(a,23);a.A=Mnd(a,24);a.C=Mnd(a,25);a.D=Mnd(a,26);a.F=Mnd(a,27);a.G=Mnd(a,28);a.H=Mnd(a,29);a.J=Mnd(a,30);a.I=Mnd(a,31);a.K=Mnd(a,32);a.M=Mnd(a,33);a.L=Mnd(a,34);a.P=Mnd(a,35);a.Q=Mnd(a,36);a.R=Mnd(a,37);a.S=Mnd(a,38);a.T=Mnd(a,39);a.U=Mnd(a,40);a.V=Mnd(a,41);a.X=Mnd(a,42);a.W=Mnd(a,43);a.Y=Mnd(a,44);a.Z=Mnd(a,45);a.$=Mnd(a,46);a._=Mnd(a,47);a.ab=Mnd(a,48);a.cb=Mnd(a,49);a.db=Mnd(a,50);a.eb=Mnd(a,51);a.gb=Mnd(a,52);a.hb=Mnd(a,53);a.ib=Mnd(a,54);a.jb=Mnd(a,55);a.kb=Mnd(a,56);a.lb=Mnd(a,57);a.mb=Mnd(a,58);a.nb=Mnd(a,59);a.ob=Mnd(a,60);a.pb=Mnd(a,61)} +function f5b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;s=0;if(b.f.a==0){for(q=new olb(a);q.aj&&(tCb(j,b.c.length),BD(b.c[j],200)).a.c.length==0){Lkb(b,(tCb(j,b.c.length),b.c[j]))}}if(!i){--f;continue}if(uZc(b,k,e,i,m,c,j,d)){l=true;continue}if(m){if(vZc(b,k,e,i,c,j,d)){l=true;continue}else if(wZc(k,e)){e.c=true;l=true;continue}}else if(wZc(k,e)){e.c=true;l=true;continue}if(l){continue}}if(wZc(k,e)){e.c=true;l=true;!!i&&(i.k=false);continue}else{a$c(e.q)}}return l} +function fed(a,b,c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I;p=0;D=0;for(j=new olb(a.b);j.ap){if(f){Fsb(w,n);Fsb(B,meb(k.b-1));Ekb(a.d,o);h.c=KC(SI,Uhe,1,0,5,1)}H=c.b;I+=n+b;n=0;l=$wnd.Math.max(l,c.b+c.c+G)}h.c[h.c.length]=i;ued(i,H,I);l=$wnd.Math.max(l,H+G+c.c);n=$wnd.Math.max(n,m);H+=G+b;o=i}Gkb(a.a,h);Ekb(a.d,BD(Ikb(h,h.c.length-1),157));l=$wnd.Math.max(l,d);F=I+n+c.a;if(F1&&(g=$wnd.Math.min(g,$wnd.Math.abs(BD(Ut(h.a,1),8).b-k.b)))}}}}}else{for(p=new olb(b.j);p.ae){f=m.a-e;g=Ohe;d.c=KC(SI,Uhe,1,0,5,1);e=m.a}if(m.a>=e){d.c[d.c.length]=h;h.a.b>1&&(g=$wnd.Math.min(g,$wnd.Math.abs(BD(Ut(h.a,h.a.b-2),8).b-m.b)))}}}}}if(d.c.length!=0&&f>b.o.a/2&&g>b.o.b/2){n=new H0b;F0b(n,b);G0b(n,(Ucd(),Acd));n.n.a=b.o.a/2;r=new H0b;F0b(r,b);G0b(r,Rcd);r.n.a=b.o.a/2;r.n.b=b.o.b;for(i=new olb(d);i.a=j.b?QZb(h,r):QZb(h,n)}else{j=BD(Msb(h.a),8);q=h.a.b==0?A0b(h.c):BD(Isb(h.a),8);q.b>=j.b?RZb(h,r):RZb(h,n)}l=BD(vNb(h,(Nyc(),jxc)),74);!!l&&ze(l,j,true)}b.n.a=e-b.o.a/2}} +function erd(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I,J,K;D=null;G=b;F=Rqd(a,dtd(c),G);Lkd(F,_pd(G,Vte));H=BD(oo(a.g,Vpd(aC(G,Cte))),33);m=aC(G,'sourcePort');d=null;!!m&&(d=Vpd(m));I=BD(oo(a.j,d),118);if(!H){h=Wpd(G);o="An edge must have a source node (edge id: '"+h;p=o+$te;throw vbb(new cqd(p))}if(!!I&&!Hb(mpd(I),H)){i=_pd(G,Vte);q="The source port of an edge must be a port of the edge's source node (edge id: '"+i;r=q+$te;throw vbb(new cqd(r))}B=(!F.b&&(F.b=new y5d(z2,F,4,7)),F.b);f=null;I?(f=I):(f=H);wtd(B,f);J=BD(oo(a.g,Vpd(aC(G,bue))),33);n=aC(G,'targetPort');e=null;!!n&&(e=Vpd(n));K=BD(oo(a.j,e),118);if(!J){l=Wpd(G);s="An edge must have a target node (edge id: '"+l;t=s+$te;throw vbb(new cqd(t))}if(!!K&&!Hb(mpd(K),J)){j=_pd(G,Vte);u="The target port of an edge must be a port of the edge's target node (edge id: '"+j;v=u+$te;throw vbb(new cqd(v))}C=(!F.c&&(F.c=new y5d(z2,F,5,8)),F.c);g=null;K?(g=K):(g=J);wtd(C,g);if((!F.b&&(F.b=new y5d(z2,F,4,7)),F.b).i==0||(!F.c&&(F.c=new y5d(z2,F,5,8)),F.c).i==0){k=_pd(G,Vte);w=Zte+k;A=w+$te;throw vbb(new cqd(A))}grd(G,F);frd(G,F);D=crd(a,G,F);return D} +function DXb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D;l=FXb(zXb(a,(Ucd(),Fcd)),b);o=EXb(zXb(a,Gcd),b);u=EXb(zXb(a,Ocd),b);B=GXb(zXb(a,Qcd),b);m=GXb(zXb(a,Bcd),b);s=EXb(zXb(a,Ncd),b);p=EXb(zXb(a,Hcd),b);w=EXb(zXb(a,Pcd),b);v=EXb(zXb(a,Ccd),b);C=GXb(zXb(a,Ecd),b);r=EXb(zXb(a,Lcd),b);t=EXb(zXb(a,Kcd),b);A=EXb(zXb(a,Dcd),b);D=GXb(zXb(a,Mcd),b);n=GXb(zXb(a,Icd),b);q=EXb(zXb(a,Jcd),b);c=w6c(OC(GC(UD,1),Vje,25,15,[s.a,B.a,w.a,D.a]));d=w6c(OC(GC(UD,1),Vje,25,15,[o.a,l.a,u.a,q.a]));e=r.a;f=w6c(OC(GC(UD,1),Vje,25,15,[p.a,m.a,v.a,n.a]));j=w6c(OC(GC(UD,1),Vje,25,15,[s.b,o.b,p.b,t.b]));i=w6c(OC(GC(UD,1),Vje,25,15,[B.b,l.b,m.b,q.b]));k=C.b;h=w6c(OC(GC(UD,1),Vje,25,15,[w.b,u.b,v.b,A.b]));vXb(zXb(a,Fcd),c+e,j+k);vXb(zXb(a,Jcd),c+e,j+k);vXb(zXb(a,Gcd),c+e,0);vXb(zXb(a,Ocd),c+e,j+k+i);vXb(zXb(a,Qcd),0,j+k);vXb(zXb(a,Bcd),c+e+d,j+k);vXb(zXb(a,Hcd),c+e+d,0);vXb(zXb(a,Pcd),0,j+k+i);vXb(zXb(a,Ccd),c+e+d,j+k+i);vXb(zXb(a,Ecd),0,j);vXb(zXb(a,Lcd),c,0);vXb(zXb(a,Dcd),0,j+k+i);vXb(zXb(a,Icd),c+e+d,0);g=new d7c;g.a=w6c(OC(GC(UD,1),Vje,25,15,[c+d+e+f,C.a,t.a,A.a]));g.b=w6c(OC(GC(UD,1),Vje,25,15,[j+i+k+h,r.b,D.b,n.b]));return g} +function Ngc(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;p=new Rkb;for(m=new olb(a.d.b);m.ae.d.d+e.d.a){k.f.d=true}else{k.f.d=true;k.f.a=true}}}d.b!=d.d.c&&(b=c)}if(k){f=BD(Ohb(a.f,g.d.i),57);if(b.bf.d.d+f.d.a){k.f.d=true}else{k.f.d=true;k.f.a=true}}}}for(h=new Sr(ur(R_b(n).a.Kc(),new Sq));Qr(h);){g=BD(Rr(h),17);if(g.a.b!=0){b=BD(Isb(g.a),8);if(g.d.j==(Ucd(),Acd)){q=new hic(b,new f7c(b.a,e.d.d),e,g);q.f.a=true;q.a=g.d;p.c[p.c.length]=q}if(g.d.j==Rcd){q=new hic(b,new f7c(b.a,e.d.d+e.d.a),e,g);q.f.d=true;q.a=g.d;p.c[p.c.length]=q}}}}}return p} +function WJc(a,b,c){var d,e,f,g,h,i,j,k,l;Odd(c,'Network simplex node placement',1);a.e=b;a.n=BD(vNb(b,(wtc(),otc)),304);VJc(a);HJc(a);MAb(LAb(new YAb(null,new Kub(a.e.b,16)),new KKc),new MKc(a));MAb(JAb(LAb(JAb(LAb(new YAb(null,new Kub(a.e.b,16)),new zLc),new BLc),new DLc),new FLc),new IKc(a));if(Ccb(DD(vNb(a.e,(Nyc(),Axc))))){g=Udd(c,1);Odd(g,'Straight Edges Pre-Processing',1);UJc(a);Qdd(g)}JFb(a.f);f=BD(vNb(b,Ayc),19).a*a.f.a.c.length;uGb(HGb(IGb(LGb(a.f),f),false),Udd(c,1));if(a.d.a.gc()!=0){g=Udd(c,1);Odd(g,'Flexible Where Space Processing',1);h=BD(Btb(RAb(NAb(new YAb(null,new Kub(a.f.a,16)),new OKc),new iKc)),19).a;i=BD(Btb(QAb(NAb(new YAb(null,new Kub(a.f.a,16)),new QKc),new mKc)),19).a;j=i-h;k=nGb(new pGb,a.f);l=nGb(new pGb,a.f);AFb(DFb(CFb(BFb(EFb(new FFb,20000),j),k),l));MAb(JAb(JAb(Plb(a.i),new SKc),new UKc),new WKc(h,k,j,l));for(e=a.d.a.ec().Kc();e.Ob();){d=BD(e.Pb(),213);d.g=1}uGb(HGb(IGb(LGb(a.f),f),false),Udd(g,1));Qdd(g)}if(Ccb(DD(vNb(b,Axc)))){g=Udd(c,1);Odd(g,'Straight Edges Post-Processing',1);TJc(a);Qdd(g)}GJc(a);a.e=null;a.f=null;a.i=null;a.c=null;Uhb(a.k);a.j=null;a.a=null;a.o=null;a.d.a.$b();Qdd(c)} +function lMc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;for(h=new olb(a.a.b);h.a0){d=l.gc();j=QD($wnd.Math.floor((d+1)/2))-1;e=QD($wnd.Math.ceil((d+1)/2))-1;if(b.o==dMc){for(k=e;k>=j;k--){if(b.a[u.p]==u){p=BD(l.Xb(k),46);o=BD(p.a,10);if(!Rqb(c,p.b)&&n>a.b.e[o.p]){b.a[o.p]=u;b.g[u.p]=b.g[o.p];b.a[u.p]=b.g[u.p];b.f[b.g[u.p].p]=(Bcb(),Ccb(b.f[b.g[u.p].p])&u.k==(j0b(),g0b)?true:false);n=a.b.e[o.p]}}}}else{for(k=j;k<=e;k++){if(b.a[u.p]==u){r=BD(l.Xb(k),46);q=BD(r.a,10);if(!Rqb(c,r.b)&&n=o){if(s>o){n.c=KC(SI,Uhe,1,0,5,1);o=s}n.c[n.c.length]=g}}if(n.c.length!=0){m=BD(Ikb(n,Bub(b,n.c.length)),128);F.a.Bc(m)!=null;m.s=p++;AQc(m,C,w);n.c=KC(SI,Uhe,1,0,5,1)}}u=a.c.length+1;for(h=new olb(a);h.aD.s){uib(c);Lkb(D.i,d);if(d.c>0){d.a=D;Ekb(D.t,d);d.b=A;Ekb(A.i,d)}}}}} +function qde(a){var b,c,d,e,f;b=a.c;switch(b){case 11:return a.Ml();case 12:return a.Ol();case 14:return a.Ql();case 15:return a.Tl();case 16:return a.Rl();case 17:return a.Ul();case 21:nde(a);return wfe(),wfe(),ffe;case 10:switch(a.a){case 65:return a.yl();case 90:return a.Dl();case 122:return a.Kl();case 98:return a.El();case 66:return a.zl();case 60:return a.Jl();case 62:return a.Hl();}}f=pde(a);b=a.c;switch(b){case 3:return a.Zl(f);case 4:return a.Xl(f);case 5:return a.Yl(f);case 0:if(a.a==123&&a.d=48&&b<=57){d=b-48;while(e=48&&b<=57){d=d*10+b-48;if(d<0)throw vbb(new mde(tvd((h0d(),bve))))}}else{throw vbb(new mde(tvd((h0d(),Zue))))}c=d;if(b==44){if(e>=a.j){throw vbb(new mde(tvd((h0d(),_ue))))}else if((b=bfb(a.i,e++))>=48&&b<=57){c=b-48;while(e=48&&b<=57){c=c*10+b-48;if(c<0)throw vbb(new mde(tvd((h0d(),bve))))}if(d>c)throw vbb(new mde(tvd((h0d(),ave))))}else{c=-1}}if(b!=125)throw vbb(new mde(tvd((h0d(),$ue))));if(a.sl(e)){f=(wfe(),wfe(),++vfe,new lge(9,f));a.d=e+1}else{f=(wfe(),wfe(),++vfe,new lge(3,f));a.d=e}f.dm(d);f.cm(c);nde(a)}}return f} +function $bc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F;p=new Skb(b.b);u=new Skb(b.b);m=new Skb(b.b);B=new Skb(b.b);q=new Skb(b.b);for(A=Jsb(b,0);A.b!=A.d.c;){v=BD(Xsb(A),11);for(h=new olb(v.g);h.a0;r=v.g.c.length>0;j&&r?(m.c[m.c.length]=v,true):j?(p.c[p.c.length]=v,true):r&&(u.c[u.c.length]=v,true)}for(o=new olb(p);o.a1){o=new Oyd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a));while(o.e!=o.i.gc()){Eyd(o)}}g=BD(qud((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a),0),202);q=H;H>v+u?(q=v+u):Hw+p?(r=w+p):Iv-u&&qw-p&&rH+G?(B=H+G):vI+A?(C=I+A):wH-G&&BI-A&&Cc&&(m=c-1);n=N+Cub(b,24)*lke*l-l/2;n<0?(n=1):n>d&&(n=d-1);e=(Fhd(),i=new xkd,i);vkd(e,m);wkd(e,n);wtd((!g.a&&(g.a=new xMd(y2,g,5)),g.a),e)}} +function Nyc(){Nyc=ccb;iyc=(Y9c(),I9c);jyc=J9c;kyc=K9c;lyc=L9c;nyc=M9c;oyc=N9c;ryc=P9c;tyc=R9c;uyc=S9c;syc=Q9c;vyc=T9c;xyc=U9c;zyc=X9c;qyc=O9c;hyc=(jwc(),Bvc);myc=Cvc;pyc=Dvc;wyc=Evc;byc=new Osd(D9c,meb(0));cyc=yvc;dyc=zvc;eyc=Avc;Kyc=awc;Cyc=Hvc;Dyc=Kvc;Gyc=Svc;Eyc=Nvc;Fyc=Pvc;Myc=fwc;Lyc=cwc;Iyc=Yvc;Hyc=Wvc;Jyc=$vc;Cxc=pvc;Dxc=qvc;Xwc=Auc;Ywc=Duc;Lxc=new q0b(12);Kxc=new Osd(f9c,Lxc);Twc=(Aad(),wad);Swc=new Osd(E8c,Twc);Uxc=new Osd(s9c,0);fyc=new Osd(E9c,meb(1));owc=new Osd(r8c,tme);Jxc=d9c;Vxc=t9c;$xc=A9c;Kwc=y8c;mwc=p8c;axc=J8c;gyc=new Osd(H9c,(Bcb(),true));fxc=M8c;gxc=N8c;Fxc=Y8c;Ixc=b9c;Gxc=$8c;Nwc=(ead(),cad);Lwc=new Osd(z8c,Nwc);xxc=W8c;wxc=U8c;Yxc=x9c;Xxc=w9c;Zxc=z9c;Oxc=(Tbd(),Sbd);new Osd(l9c,Oxc);Qxc=o9c;Rxc=p9c;Sxc=q9c;Pxc=n9c;Byc=Gvc;sxc=avc;rxc=$uc;Ayc=Fvc;mxc=Suc;Jwc=muc;Iwc=kuc;Awc=Xtc;Bwc=Ytc;Dwc=buc;Cwc=Ztc;Hwc=iuc;uxc=cvc;vxc=dvc;ixc=Luc;Exc=uvc;zxc=hvc;$wc=Guc;Bxc=nvc;Vwc=wuc;Wwc=yuc;zwc=w8c;yxc=evc;swc=Mtc;rwc=Ktc;qwc=Jtc;cxc=Juc;bxc=Iuc;dxc=Kuc;Hxc=_8c;jxc=Q8c;Zwc=G8c;Qwc=C8c;Pwc=B8c;Ewc=euc;Wxc=v9c;pwc=v8c;exc=L8c;Txc=r9c;Mxc=h9c;Nxc=j9c;oxc=Vuc;pxc=Xuc;ayc=C9c;nwc=Itc;qxc=Zuc;Rwc=suc;Owc=quc;txc=S8c;kxc=Puc;Axc=kvc;yyc=V9c;Mwc=ouc;_xc=wvc;Uwc=uuc;lxc=Ruc;Fwc=guc;hxc=P8c;nxc=Uuc;Gwc=huc;ywc=Vtc;wwc=Stc;uwc=Qtc;vwc=Rtc;xwc=Utc;twc=Otc;_wc=Huc} +function shb(a,b){phb();var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H;B=a.e;o=a.d;e=a.a;if(B==0){switch(b){case 0:return '0';case 1:return $je;case 2:return '0.00';case 3:return '0.000';case 4:return '0.0000';case 5:return '0.00000';case 6:return '0.000000';default:w=new Ufb;b<0?(w.a+='0E+',w):(w.a+='0E',w);w.a+=-b;return w.a;}}t=o*10+1+7;u=KC(TD,$ie,25,t+1,15,1);c=t;if(o==1){h=e[0];if(h<0){H=xbb(h,Yje);do{p=H;H=Abb(H,10);u[--c]=48+Tbb(Qbb(p,Ibb(H,10)))&aje}while(ybb(H,0)!=0)}else{H=h;do{p=H;H=H/10|0;u[--c]=48+(p-H*10)&aje}while(H!=0)}}else{D=KC(WD,oje,25,o,15,1);G=o;$fb(e,0,D,0,G);I:while(true){A=0;for(j=G-1;j>=0;j--){F=wbb(Nbb(A,32),xbb(D[j],Yje));r=qhb(F);D[j]=Tbb(r);A=Tbb(Obb(r,32))}s=Tbb(A);q=c;do{u[--c]=48+s%10&aje}while((s=s/10|0)!=0&&c!=0);d=9-q+c;for(i=0;i0;i++){u[--c]=48}l=G-1;for(;D[l]==0;l--){if(l==0){break I}}G=l+1}while(u[c]==48){++c}}n=B<0;g=t-c-b-1;if(b==0){n&&(u[--c]=45);return zfb(u,c,t-c)}if(b>0&&g>=-6){if(g>=0){k=c+g;for(m=t-1;m>=k;m--){u[m+1]=u[m]}u[++k]=46;n&&(u[--c]=45);return zfb(u,c,t-c+1)}for(l=2;l<-g+1;l++){u[--c]=48}u[--c]=46;u[--c]=48;n&&(u[--c]=45);return zfb(u,c,t-c)}C=c+1;f=t;v=new Vfb;n&&(v.a+='-',v);if(f-C>=1){Kfb(v,u[c]);v.a+='.';v.a+=zfb(u,c+1,t-c-1)}else{v.a+=zfb(u,c,t-c)}v.a+='E';g>0&&(v.a+='+',v);v.a+=''+g;return v.a} +function z$c(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;a.c=b;a.g=new Lqb;c=(Pgd(),new bhd(a.c));d=new YGb(c);UGb(d);t=GD(hkd(a.c,(d0c(),Y_c)));i=BD(hkd(a.c,$_c),316);v=BD(hkd(a.c,__c),429);g=BD(hkd(a.c,T_c),482);u=BD(hkd(a.c,Z_c),430);a.j=Edb(ED(hkd(a.c,a0c)));h=a.a;switch(i.g){case 0:h=a.a;break;case 1:h=a.b;break;case 2:h=a.i;break;case 3:h=a.e;break;case 4:h=a.f;break;default:throw vbb(new Wdb(Mre+(i.f!=null?i.f:''+i.g)));}a.d=new g_c(h,v,g);yNb(a.d,(XNb(),VNb),DD(hkd(a.c,V_c)));a.d.c=Ccb(DD(hkd(a.c,U_c)));if(Vod(a.c).i==0){return a.d}for(l=new Fyd(Vod(a.c));l.e!=l.i.gc();){k=BD(Dyd(l),33);n=k.g/2;m=k.f/2;w=new f7c(k.i+n,k.j+m);while(Mhb(a.g,w)){O6c(w,($wnd.Math.random()-0.5)*qme,($wnd.Math.random()-0.5)*qme)}p=BD(hkd(k,(Y9c(),S8c)),142);q=new aOb(w,new J6c(w.a-n-a.j/2-p.b,w.b-m-a.j/2-p.d,k.g+a.j+(p.b+p.c),k.f+a.j+(p.d+p.a)));Ekb(a.d.i,q);Rhb(a.g,w,new vgd(q,k))}switch(u.g){case 0:if(t==null){a.d.d=BD(Ikb(a.d.i,0),65)}else{for(s=new olb(a.d.i);s.a1&&(Gsb(k,r,k.c.b,k.c),true);Zsb(e)}}}r=s}}return k} +function $Bc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I,J,K,L;Odd(c,'Greedy cycle removal',1);t=b.a;L=t.c.length;a.a=KC(WD,oje,25,L,15,1);a.c=KC(WD,oje,25,L,15,1);a.b=KC(WD,oje,25,L,15,1);j=0;for(r=new olb(t);r.a0?G+1:1}for(g=new olb(w.g);g.a0?G+1:1}}a.c[j]==0?Dsb(a.e,p):a.a[j]==0&&Dsb(a.f,p);++j}o=-1;n=1;l=new Rkb;a.d=BD(vNb(b,(wtc(),jtc)),230);while(L>0){while(a.e.b!=0){I=BD(Lsb(a.e),10);a.b[I.p]=o--;_Bc(a,I);--L}while(a.f.b!=0){J=BD(Lsb(a.f),10);a.b[J.p]=n++;_Bc(a,J);--L}if(L>0){m=Rie;for(s=new olb(t);s.a=m){if(u>m){l.c=KC(SI,Uhe,1,0,5,1);m=u}l.c[l.c.length]=p}}}k=a.Zf(l);a.b[k.p]=n++;_Bc(a,k);--L}}H=t.c.length+1;for(j=0;ja.b[K]){PZb(d,true);yNb(b,Asc,(Bcb(),true))}}}}a.a=null;a.c=null;a.b=null;Osb(a.f);Osb(a.e);Qdd(c)} +function sQb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;d=new Rkb;h=new Rkb;q=b/2;n=a.gc();e=BD(a.Xb(0),8);r=BD(a.Xb(1),8);o=tQb(e.a,e.b,r.a,r.b,q);Ekb(d,(tCb(0,o.c.length),BD(o.c[0],8)));Ekb(h,(tCb(1,o.c.length),BD(o.c[1],8)));for(j=2;j=0;i--){Dsb(c,(tCb(i,g.c.length),BD(g.c[i],8)))}return c} +function aFd(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;g=true;l=null;d=null;e=null;b=false;n=BEd;j=null;f=null;h=0;i=UEd(a,h,zEd,AEd);if(i=0&&dfb(a.substr(h,'//'.length),'//')){h+=2;i=UEd(a,h,CEd,DEd);d=a.substr(h,i-h);h=i}else if(l!=null&&(h==a.length||(BCb(h,a.length),a.charCodeAt(h)!=47))){g=false;i=ifb(a,wfb(35),h);i==-1&&(i=a.length);d=a.substr(h,i-h);h=i}if(!c&&h0&&bfb(k,k.length-1)==58){e=k;h=i}}if(h=a.j){a.a=-1;a.c=1;return}b=bfb(a.i,a.d++);a.a=b;if(a.b==1){switch(b){case 92:d=10;if(a.d>=a.j)throw vbb(new mde(tvd((h0d(),uue))));a.a=bfb(a.i,a.d++);break;case 45:if((a.e&512)==512&&a.d=a.j)break;if(bfb(a.i,a.d)!=63)break;if(++a.d>=a.j)throw vbb(new mde(tvd((h0d(),vue))));b=bfb(a.i,a.d++);switch(b){case 58:d=13;break;case 61:d=14;break;case 33:d=15;break;case 91:d=19;break;case 62:d=18;break;case 60:if(a.d>=a.j)throw vbb(new mde(tvd((h0d(),vue))));b=bfb(a.i,a.d++);if(b==61){d=16}else if(b==33){d=17}else throw vbb(new mde(tvd((h0d(),wue))));break;case 35:while(a.d=a.j)throw vbb(new mde(tvd((h0d(),uue))));a.a=bfb(a.i,a.d++);break;default:d=0;}a.c=d} +function P5b(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G;A=BD(vNb(a,(Nyc(),Vxc)),98);if(!(A!=(dcd(),bcd)&&A!=ccd)){return}o=a.b;n=o.c.length;k=new Skb((Xj(n+2,Mie),Oy(wbb(wbb(5,n+2),(n+2)/10|0))));p=new Skb((Xj(n+2,Mie),Oy(wbb(wbb(5,n+2),(n+2)/10|0))));Ekb(k,new Lqb);Ekb(k,new Lqb);Ekb(p,new Rkb);Ekb(p,new Rkb);w=new Rkb;for(b=0;b=v||!wCc(r,d))&&(d=yCc(b,k));$_b(r,d);for(f=new Sr(ur(R_b(r).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);if(a.a[e.p]){continue}p=e.c.i;--a.e[p.p];a.e[p.p]==0&&(zCb(cub(n,p)),true)}}for(j=k.c.length-1;j>=0;--j){Ekb(b.b,(tCb(j,k.c.length),BD(k.c[j],29)))}b.a.c=KC(SI,Uhe,1,0,5,1);Qdd(c)} +function gee(a){var b,c,d,e,f,g,h,i,j;a.b=1;nde(a);b=null;if(a.c==0&&a.a==94){nde(a);b=(wfe(),wfe(),++vfe,new $fe(4));Ufe(b,0,lxe);h=(null,++vfe,new $fe(4))}else{h=(wfe(),wfe(),++vfe,new $fe(4))}e=true;while((j=a.c)!=1){if(j==0&&a.a==93&&!e){if(b){Zfe(b,h);h=b}break}c=a.a;d=false;if(j==10){switch(c){case 100:case 68:case 119:case 87:case 115:case 83:Xfe(h,fee(c));d=true;break;case 105:case 73:case 99:case 67:c=(Xfe(h,fee(c)),-1);c<0&&(d=true);break;case 112:case 80:i=tde(a,c);if(!i)throw vbb(new mde(tvd((h0d(),Iue))));Xfe(h,i);d=true;break;default:c=eee(a);}}else if(j==24&&!e){if(b){Zfe(b,h);h=b}f=gee(a);Zfe(h,f);if(a.c!=0||a.a!=93)throw vbb(new mde(tvd((h0d(),Mue))));break}nde(a);if(!d){if(j==0){if(c==91)throw vbb(new mde(tvd((h0d(),Nue))));if(c==93)throw vbb(new mde(tvd((h0d(),Oue))));if(c==45&&!e&&a.a!=93)throw vbb(new mde(tvd((h0d(),Pue))))}if(a.c!=0||a.a!=45||c==45&&e){Ufe(h,c,c)}else{nde(a);if((j=a.c)==1)throw vbb(new mde(tvd((h0d(),Kue))));if(j==0&&a.a==93){Ufe(h,c,c);Ufe(h,45,45)}else if(j==0&&a.a==93||j==24){throw vbb(new mde(tvd((h0d(),Pue))))}else{g=a.a;if(j==0){if(g==91)throw vbb(new mde(tvd((h0d(),Nue))));if(g==93)throw vbb(new mde(tvd((h0d(),Oue))));if(g==45)throw vbb(new mde(tvd((h0d(),Pue))))}else j==10&&(g=eee(a));nde(a);if(c>g)throw vbb(new mde(tvd((h0d(),Sue))));Ufe(h,c,g)}}}e=false}if(a.c==1)throw vbb(new mde(tvd((h0d(),Kue))));Yfe(h);Vfe(h);a.b=0;nde(a);return h} +function xZd(a){Bnd(a.c,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#decimal']));Bnd(a.d,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#integer']));Bnd(a.e,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#boolean']));Bnd(a.f,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EBoolean',fue,'EBoolean:Object']));Bnd(a.i,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#byte']));Bnd(a.g,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#hexBinary']));Bnd(a.j,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EByte',fue,'EByte:Object']));Bnd(a.n,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EChar',fue,'EChar:Object']));Bnd(a.t,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#double']));Bnd(a.u,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EDouble',fue,'EDouble:Object']));Bnd(a.F,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#float']));Bnd(a.G,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EFloat',fue,'EFloat:Object']));Bnd(a.I,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#int']));Bnd(a.J,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EInt',fue,'EInt:Object']));Bnd(a.N,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#long']));Bnd(a.O,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'ELong',fue,'ELong:Object']));Bnd(a.Z,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#short']));Bnd(a.$,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EShort',fue,'EShort:Object']));Bnd(a._,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#string']))} +function fRc(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G;if(a.c.length==1){return tCb(0,a.c.length),BD(a.c[0],135)}else if(a.c.length<=0){return new SRc}for(i=new olb(a);i.al){F=0;G+=k+A;k=0}eRc(v,g,F,G);b=$wnd.Math.max(b,F+w.a);k=$wnd.Math.max(k,w.b);F+=w.a+A}u=new Lqb;c=new Lqb;for(C=new olb(a);C.aSLc(f))&&(l=f)}}!l&&(l=(tCb(0,q.c.length),BD(q.c[0],180)));for(p=new olb(b.b);p.a=-1900?1:0;c>=4?Qfb(a,OC(GC(ZI,1),nie,2,6,[pje,qje])[h]):Qfb(a,OC(GC(ZI,1),nie,2,6,['BC','AD'])[h]);break;case 121:kA(a,c,d);break;case 77:jA(a,c,d);break;case 107:i=e.q.getHours();i==0?EA(a,24,c):EA(a,i,c);break;case 83:iA(a,c,e);break;case 69:k=d.q.getDay();c==5?Qfb(a,OC(GC(ZI,1),nie,2,6,['S','M','T','W','T','F','S'])[k]):c==4?Qfb(a,OC(GC(ZI,1),nie,2,6,[rje,sje,tje,uje,vje,wje,xje])[k]):Qfb(a,OC(GC(ZI,1),nie,2,6,['Sun','Mon','Tue','Wed','Thu','Fri','Sat'])[k]);break;case 97:e.q.getHours()>=12&&e.q.getHours()<24?Qfb(a,OC(GC(ZI,1),nie,2,6,['AM','PM'])[1]):Qfb(a,OC(GC(ZI,1),nie,2,6,['AM','PM'])[0]);break;case 104:l=e.q.getHours()%12;l==0?EA(a,12,c):EA(a,l,c);break;case 75:m=e.q.getHours()%12;EA(a,m,c);break;case 72:n=e.q.getHours();EA(a,n,c);break;case 99:o=d.q.getDay();c==5?Qfb(a,OC(GC(ZI,1),nie,2,6,['S','M','T','W','T','F','S'])[o]):c==4?Qfb(a,OC(GC(ZI,1),nie,2,6,[rje,sje,tje,uje,vje,wje,xje])[o]):c==3?Qfb(a,OC(GC(ZI,1),nie,2,6,['Sun','Mon','Tue','Wed','Thu','Fri','Sat'])[o]):EA(a,o,1);break;case 76:p=d.q.getMonth();c==5?Qfb(a,OC(GC(ZI,1),nie,2,6,['J','F','M','A','M','J','J','A','S','O','N','D'])[p]):c==4?Qfb(a,OC(GC(ZI,1),nie,2,6,[bje,cje,dje,eje,fje,gje,hje,ije,jje,kje,lje,mje])[p]):c==3?Qfb(a,OC(GC(ZI,1),nie,2,6,['Jan','Feb','Mar','Apr',fje,'Jun','Jul','Aug','Sep','Oct','Nov','Dec'])[p]):EA(a,p+1,c);break;case 81:q=d.q.getMonth()/3|0;c<4?Qfb(a,OC(GC(ZI,1),nie,2,6,['Q1','Q2','Q3','Q4'])[q]):Qfb(a,OC(GC(ZI,1),nie,2,6,['1st quarter','2nd quarter','3rd quarter','4th quarter'])[q]);break;case 100:r=d.q.getDate();EA(a,r,c);break;case 109:j=e.q.getMinutes();EA(a,j,c);break;case 115:g=e.q.getSeconds();EA(a,g,c);break;case 122:c<4?Qfb(a,f.c[0]):Qfb(a,f.c[1]);break;case 118:Qfb(a,f.b);break;case 90:c<3?Qfb(a,OA(f)):c==3?Qfb(a,NA(f)):Qfb(a,QA(f.a));break;default:return false;}return true} +function X1b(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H;N1b(b);i=BD(qud((!b.b&&(b.b=new y5d(z2,b,4,7)),b.b),0),82);k=BD(qud((!b.c&&(b.c=new y5d(z2,b,5,8)),b.c),0),82);h=atd(i);j=atd(k);g=(!b.a&&(b.a=new cUd(A2,b,6,6)),b.a).i==0?null:BD(qud((!b.a&&(b.a=new cUd(A2,b,6,6)),b.a),0),202);A=BD(Ohb(a.a,h),10);F=BD(Ohb(a.a,j),10);B=null;G=null;if(JD(i,186)){w=BD(Ohb(a.a,i),299);if(JD(w,11)){B=BD(w,11)}else if(JD(w,10)){A=BD(w,10);B=BD(Ikb(A.j,0),11)}}if(JD(k,186)){D=BD(Ohb(a.a,k),299);if(JD(D,11)){G=BD(D,11)}else if(JD(D,10)){F=BD(D,10);G=BD(Ikb(F.j,0),11)}}if(!A||!F){throw vbb(new z2c('The source or the target of edge '+b+' could not be found. '+'This usually happens when an edge connects a node laid out by ELK Layered to a node in '+'another level of hierarchy laid out by either another instance of ELK Layered or another '+'layout algorithm alltogether. The former can be solved by setting the hierarchyHandling '+'option to INCLUDE_CHILDREN.'))}p=new UZb;tNb(p,b);yNb(p,(wtc(),$sc),b);yNb(p,(Nyc(),jxc),null);n=BD(vNb(d,Ksc),21);A==F&&n.Fc((Orc(),Nrc));if(!B){v=(KAc(),IAc);C=null;if(!!g&&fcd(BD(vNb(A,Vxc),98))){C=new f7c(g.j,g.k);Bfd(C,Mld(b));Cfd(C,c);if(ntd(j,h)){v=HAc;P6c(C,A.n)}}B=$$b(A,C,v,d)}if(!G){v=(KAc(),HAc);H=null;if(!!g&&fcd(BD(vNb(F,Vxc),98))){H=new f7c(g.b,g.c);Bfd(H,Mld(b));Cfd(H,c)}G=$$b(F,H,v,Q_b(F))}QZb(p,B);RZb(p,G);(B.e.c.length>1||B.g.c.length>1||G.e.c.length>1||G.g.c.length>1)&&n.Fc((Orc(),Irc));for(m=new Fyd((!b.n&&(b.n=new cUd(D2,b,1,7)),b.n));m.e!=m.i.gc();){l=BD(Dyd(m),137);if(!Ccb(DD(hkd(l,Jxc)))&&!!l.a){q=Z1b(l);Ekb(p.b,q);switch(BD(vNb(q,Qwc),272).g){case 1:case 2:n.Fc((Orc(),Grc));break;case 0:n.Fc((Orc(),Erc));yNb(q,Qwc,(qad(),nad));}}}f=BD(vNb(d,Iwc),314);r=BD(vNb(d,Exc),315);e=f==(Rpc(),Opc)||r==(Vzc(),Rzc);if(!!g&&(!g.a&&(g.a=new xMd(y2,g,5)),g.a).i!=0&&e){s=ofd(g);o=new s7c;for(u=Jsb(s,0);u.b!=u.d.c;){t=BD(Xsb(u),8);Dsb(o,new g7c(t))}yNb(p,_sc,o)}return p} +function yZd(a){if(a.gb)return;a.gb=true;a.b=Lnd(a,0);Knd(a.b,18);Qnd(a.b,19);a.a=Lnd(a,1);Knd(a.a,1);Qnd(a.a,2);Qnd(a.a,3);Qnd(a.a,4);Qnd(a.a,5);a.o=Lnd(a,2);Knd(a.o,8);Knd(a.o,9);Qnd(a.o,10);Qnd(a.o,11);Qnd(a.o,12);Qnd(a.o,13);Qnd(a.o,14);Qnd(a.o,15);Qnd(a.o,16);Qnd(a.o,17);Qnd(a.o,18);Qnd(a.o,19);Qnd(a.o,20);Qnd(a.o,21);Qnd(a.o,22);Qnd(a.o,23);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);a.p=Lnd(a,3);Knd(a.p,2);Knd(a.p,3);Knd(a.p,4);Knd(a.p,5);Qnd(a.p,6);Qnd(a.p,7);Pnd(a.p);Pnd(a.p);a.q=Lnd(a,4);Knd(a.q,8);a.v=Lnd(a,5);Qnd(a.v,9);Pnd(a.v);Pnd(a.v);Pnd(a.v);a.w=Lnd(a,6);Knd(a.w,2);Knd(a.w,3);Knd(a.w,4);Qnd(a.w,5);a.B=Lnd(a,7);Qnd(a.B,1);Pnd(a.B);Pnd(a.B);Pnd(a.B);a.Q=Lnd(a,8);Qnd(a.Q,0);Pnd(a.Q);a.R=Lnd(a,9);Knd(a.R,1);a.S=Lnd(a,10);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);a.T=Lnd(a,11);Qnd(a.T,10);Qnd(a.T,11);Qnd(a.T,12);Qnd(a.T,13);Qnd(a.T,14);Pnd(a.T);Pnd(a.T);a.U=Lnd(a,12);Knd(a.U,2);Knd(a.U,3);Qnd(a.U,4);Qnd(a.U,5);Qnd(a.U,6);Qnd(a.U,7);Pnd(a.U);a.V=Lnd(a,13);Qnd(a.V,10);a.W=Lnd(a,14);Knd(a.W,18);Knd(a.W,19);Knd(a.W,20);Qnd(a.W,21);Qnd(a.W,22);Qnd(a.W,23);a.bb=Lnd(a,15);Knd(a.bb,10);Knd(a.bb,11);Knd(a.bb,12);Knd(a.bb,13);Knd(a.bb,14);Knd(a.bb,15);Knd(a.bb,16);Qnd(a.bb,17);Pnd(a.bb);Pnd(a.bb);a.eb=Lnd(a,16);Knd(a.eb,2);Knd(a.eb,3);Knd(a.eb,4);Knd(a.eb,5);Knd(a.eb,6);Knd(a.eb,7);Qnd(a.eb,8);Qnd(a.eb,9);a.ab=Lnd(a,17);Knd(a.ab,0);Knd(a.ab,1);a.H=Lnd(a,18);Qnd(a.H,0);Qnd(a.H,1);Qnd(a.H,2);Qnd(a.H,3);Qnd(a.H,4);Qnd(a.H,5);Pnd(a.H);a.db=Lnd(a,19);Qnd(a.db,2);a.c=Mnd(a,20);a.d=Mnd(a,21);a.e=Mnd(a,22);a.f=Mnd(a,23);a.i=Mnd(a,24);a.g=Mnd(a,25);a.j=Mnd(a,26);a.k=Mnd(a,27);a.n=Mnd(a,28);a.r=Mnd(a,29);a.s=Mnd(a,30);a.t=Mnd(a,31);a.u=Mnd(a,32);a.fb=Mnd(a,33);a.A=Mnd(a,34);a.C=Mnd(a,35);a.D=Mnd(a,36);a.F=Mnd(a,37);a.G=Mnd(a,38);a.I=Mnd(a,39);a.J=Mnd(a,40);a.L=Mnd(a,41);a.M=Mnd(a,42);a.N=Mnd(a,43);a.O=Mnd(a,44);a.P=Mnd(a,45);a.X=Mnd(a,46);a.Y=Mnd(a,47);a.Z=Mnd(a,48);a.$=Mnd(a,49);a._=Mnd(a,50);a.cb=Mnd(a,51);a.K=Mnd(a,52)} +function Y9c(){Y9c=ccb;var a,b;o8c=new Lsd(sse);F9c=new Lsd(tse);q8c=(F7c(),z7c);p8c=new Nsd($pe,q8c);new Tfd;r8c=new Nsd(_le,null);s8c=new Lsd(use);x8c=(i8c(),qqb(h8c,OC(GC(r1,1),Kie,291,0,[d8c])));w8c=new Nsd(lqe,x8c);y8c=new Nsd(Zpe,(Bcb(),false));A8c=(ead(),cad);z8c=new Nsd(cqe,A8c);F8c=(Aad(),zad);E8c=new Nsd(ype,F8c);I8c=new Nsd(Jre,false);K8c=(hbd(),fbd);J8c=new Nsd(tpe,K8c);g9c=new q0b(12);f9c=new Nsd(ame,g9c);O8c=new Nsd(Ame,false);P8c=new Nsd(xqe,false);e9c=new Nsd(Dme,false);u9c=(dcd(),ccd);t9c=new Nsd(Bme,u9c);C9c=new Lsd(uqe);D9c=new Lsd(vme);E9c=new Lsd(yme);H9c=new Lsd(zme);R8c=new s7c;Q8c=new Nsd(mqe,R8c);v8c=new Nsd(pqe,false);L8c=new Nsd(qqe,false);new Lsd(vse);T8c=new H_b;S8c=new Nsd(vqe,T8c);d9c=new Nsd(Xpe,false);new Tfd;G9c=new Nsd(wse,1);new Nsd(xse,true);meb(0);new Nsd(yse,meb(100));new Nsd(zse,false);meb(0);new Nsd(Ase,meb(4000));meb(0);new Nsd(Bse,meb(400));new Nsd(Cse,false);new Nsd(Dse,false);new Nsd(Ese,true);new Nsd(Fse,false);u8c=(Ded(),Ced);t8c=new Nsd(rse,u8c);I9c=new Nsd(Lpe,10);J9c=new Nsd(Mpe,10);K9c=new Nsd(Zle,20);L9c=new Nsd(Npe,10);M9c=new Nsd(xme,2);N9c=new Nsd(Ope,10);P9c=new Nsd(Ppe,0);Q9c=new Nsd(Spe,5);R9c=new Nsd(Qpe,1);S9c=new Nsd(Rpe,1);T9c=new Nsd(wme,20);U9c=new Nsd(Tpe,10);X9c=new Nsd(Upe,10);O9c=new Lsd(Vpe);W9c=new I_b;V9c=new Nsd(wqe,W9c);j9c=new Lsd(tqe);i9c=false;h9c=new Nsd(sqe,i9c);V8c=new q0b(5);U8c=new Nsd(dqe,V8c);X8c=(Hbd(),b=BD(gdb(B1),9),new xqb(b,BD(_Bb(b,b.length),9),0));W8c=new Nsd(Gme,X8c);m9c=(Tbd(),Qbd);l9c=new Nsd(gqe,m9c);o9c=new Lsd(hqe);p9c=new Lsd(iqe);q9c=new Lsd(jqe);n9c=new Lsd(kqe);Z8c=(a=BD(gdb(I1),9),new xqb(a,BD(_Bb(a,a.length),9),0));Y8c=new Nsd(Fme,Z8c);c9c=pqb((Idd(),Bdd));b9c=new Nsd(Eme,c9c);a9c=new f7c(0,0);_8c=new Nsd(Tme,a9c);$8c=new Nsd(bqe,false);D8c=(qad(),nad);C8c=new Nsd(nqe,D8c);B8c=new Nsd(Cme,false);new Lsd(Gse);meb(1);new Nsd(Hse,null);r9c=new Lsd(rqe);v9c=new Lsd(oqe);B9c=(Ucd(),Scd);A9c=new Nsd(Ype,B9c);s9c=new Lsd(Wpe);y9c=(rcd(),pqb(pcd));x9c=new Nsd(Hme,y9c);w9c=new Nsd(eqe,false);z9c=new Nsd(fqe,true);M8c=new Nsd(_pe,false);N8c=new Nsd(aqe,false);G8c=new Nsd($le,1);H8c=(Mad(),Kad);new Nsd(Ise,H8c);k9c=true} +function wtc(){wtc=ccb;var a,b;$sc=new Lsd(Ime);xsc=new Lsd('coordinateOrigin');itc=new Lsd('processors');wsc=new Msd('compoundNode',(Bcb(),false));Nsc=new Msd('insideConnections',false);_sc=new Lsd('originalBendpoints');atc=new Lsd('originalDummyNodePosition');btc=new Lsd('originalLabelEdge');ktc=new Lsd('representedLabels');Csc=new Lsd('endLabels');Dsc=new Lsd('endLabel.origin');Ssc=new Msd('labelSide',(rbd(),qbd));Ysc=new Msd('maxEdgeThickness',0);ltc=new Msd('reversed',false);jtc=new Lsd(Jme);Vsc=new Msd('longEdgeSource',null);Wsc=new Msd('longEdgeTarget',null);Usc=new Msd('longEdgeHasLabelDummies',false);Tsc=new Msd('longEdgeBeforeLabelDummy',false);Bsc=new Msd('edgeConstraint',(Gqc(),Eqc));Psc=new Lsd('inLayerLayoutUnit');Osc=new Msd('inLayerConstraint',(esc(),csc));Qsc=new Msd('inLayerSuccessorConstraint',new Rkb);Rsc=new Msd('inLayerSuccessorConstraintBetweenNonDummies',false);gtc=new Lsd('portDummy');ysc=new Msd('crossingHint',meb(0));Ksc=new Msd('graphProperties',(b=BD(gdb(PW),9),new xqb(b,BD(_Bb(b,b.length),9),0)));Hsc=new Msd('externalPortSide',(Ucd(),Scd));Isc=new Msd('externalPortSize',new d7c);Fsc=new Lsd('externalPortReplacedDummies');Gsc=new Lsd('externalPortReplacedDummy');Esc=new Msd('externalPortConnections',(a=BD(gdb(F1),9),new xqb(a,BD(_Bb(a,a.length),9),0)));htc=new Msd(tle,0);ssc=new Lsd('barycenterAssociates');vtc=new Lsd('TopSideComments');tsc=new Lsd('BottomSideComments');vsc=new Lsd('CommentConnectionPort');Msc=new Msd('inputCollect',false);etc=new Msd('outputCollect',false);Asc=new Msd('cyclic',false);zsc=new Lsd('crossHierarchyMap');utc=new Lsd('targetOffset');new Msd('splineLabelSize',new d7c);otc=new Lsd('spacings');ftc=new Msd('partitionConstraint',false);usc=new Lsd('breakingPoint.info');stc=new Lsd('splines.survivingEdge');rtc=new Lsd('splines.route.start');ptc=new Lsd('splines.edgeChain');dtc=new Lsd('originalPortConstraints');ntc=new Lsd('selfLoopHolder');qtc=new Lsd('splines.nsPortY');Zsc=new Lsd('modelOrder');Xsc=new Lsd('longEdgeTargetNode');Jsc=new Msd(Xne,false);mtc=new Msd(Xne,false);Lsc=new Lsd('layerConstraints.hiddenNodes');ctc=new Lsd('layerConstraints.opposidePort');ttc=new Lsd('targetNode.modelOrder')} +function jwc(){jwc=ccb;puc=(xqc(),vqc);ouc=new Nsd(Yne,puc);Guc=new Nsd(Zne,(Bcb(),false));Muc=(msc(),ksc);Luc=new Nsd($ne,Muc);cvc=new Nsd(_ne,false);dvc=new Nsd(aoe,true);Itc=new Nsd(boe,false);xvc=(BAc(),zAc);wvc=new Nsd(coe,xvc);meb(1);Fvc=new Nsd(doe,meb(7));Gvc=new Nsd(eoe,false);Huc=new Nsd(foe,false);nuc=(mqc(),iqc);muc=new Nsd(goe,nuc);bvc=(lzc(),jzc);avc=new Nsd(hoe,bvc);Tuc=(Ctc(),Btc);Suc=new Nsd(ioe,Tuc);meb(-1);Ruc=new Nsd(joe,meb(-1));meb(-1);Uuc=new Nsd(koe,meb(-1));meb(-1);Vuc=new Nsd(loe,meb(4));meb(-1);Xuc=new Nsd(moe,meb(2));_uc=(kAc(),iAc);$uc=new Nsd(noe,_uc);meb(0);Zuc=new Nsd(ooe,meb(0));Puc=new Nsd(poe,meb(Ohe));luc=(Rpc(),Ppc);kuc=new Nsd(qoe,luc);Xtc=new Nsd(roe,false);euc=new Nsd(soe,0.1);iuc=new Nsd(toe,false);meb(-1);guc=new Nsd(uoe,meb(-1));meb(-1);huc=new Nsd(voe,meb(-1));meb(0);Ytc=new Nsd(woe,meb(40));cuc=(Xrc(),Wrc);buc=new Nsd(xoe,cuc);$tc=Urc;Ztc=new Nsd(yoe,$tc);vvc=(Vzc(),Qzc);uvc=new Nsd(zoe,vvc);kvc=new Lsd(Aoe);fvc=(_qc(),Zqc);evc=new Nsd(Boe,fvc);ivc=(lrc(),irc);hvc=new Nsd(Coe,ivc);new Tfd;nvc=new Nsd(Doe,0.3);pvc=new Lsd(Eoe);rvc=(Izc(),Gzc);qvc=new Nsd(Foe,rvc);xuc=(TAc(),RAc);wuc=new Nsd(Goe,xuc);zuc=(_Ac(),$Ac);yuc=new Nsd(Hoe,zuc);Buc=(tBc(),sBc);Auc=new Nsd(Ioe,Buc);Duc=new Nsd(Joe,0.2);uuc=new Nsd(Koe,2);Bvc=new Nsd(Loe,null);Dvc=new Nsd(Moe,10);Cvc=new Nsd(Noe,10);Evc=new Nsd(Ooe,20);meb(0);yvc=new Nsd(Poe,meb(0));meb(0);zvc=new Nsd(Qoe,meb(0));meb(0);Avc=new Nsd(Roe,meb(0));Jtc=new Nsd(Soe,false);Ntc=(yrc(),wrc);Mtc=new Nsd(Toe,Ntc);Ltc=(Ipc(),Hpc);Ktc=new Nsd(Uoe,Ltc);Juc=new Nsd(Voe,false);meb(0);Iuc=new Nsd(Woe,meb(16));meb(0);Kuc=new Nsd(Xoe,meb(5));bwc=(LBc(),JBc);awc=new Nsd(Yoe,bwc);Hvc=new Nsd(Zoe,10);Kvc=new Nsd($oe,1);Tvc=(bqc(),aqc);Svc=new Nsd(_oe,Tvc);Nvc=new Lsd(ape);Qvc=meb(1);meb(0);Pvc=new Nsd(bpe,Qvc);gwc=(CBc(),zBc);fwc=new Nsd(cpe,gwc);cwc=new Lsd(dpe);Yvc=new Nsd(epe,true);Wvc=new Nsd(fpe,2);$vc=new Nsd(gpe,true);tuc=(Sqc(),Qqc);suc=new Nsd(hpe,tuc);ruc=(Apc(),wpc);quc=new Nsd(ipe,ruc);Wtc=(tAc(),rAc);Vtc=new Nsd(jpe,Wtc);Utc=new Nsd(kpe,false);Ptc=(RXb(),QXb);Otc=new Nsd(lpe,Ptc);Ttc=(xzc(),uzc);Stc=new Nsd(mpe,Ttc);Qtc=new Nsd(npe,0);Rtc=new Nsd(ope,0);Ouc=kqc;Nuc=Opc;Wuc=izc;Yuc=izc;Quc=fzc;fuc=(hbd(),ebd);juc=Ppc;duc=Ppc;_tc=Ppc;auc=ebd;lvc=Tzc;mvc=Qzc;gvc=Qzc;jvc=Qzc;ovc=Szc;tvc=Tzc;svc=Tzc;Cuc=(Aad(),yad);Euc=yad;Fuc=sBc;vuc=xad;Ivc=KBc;Jvc=IBc;Lvc=KBc;Mvc=IBc;Uvc=KBc;Vvc=IBc;Ovc=_pc;Rvc=aqc;hwc=KBc;iwc=IBc;dwc=KBc;ewc=IBc;Zvc=IBc;Xvc=IBc;_vc=IBc} +function S8b(){S8b=ccb;Y7b=new T8b('DIRECTION_PREPROCESSOR',0);V7b=new T8b('COMMENT_PREPROCESSOR',1);Z7b=new T8b('EDGE_AND_LAYER_CONSTRAINT_EDGE_REVERSER',2);n8b=new T8b('INTERACTIVE_EXTERNAL_PORT_POSITIONER',3);G8b=new T8b('PARTITION_PREPROCESSOR',4);r8b=new T8b('LABEL_DUMMY_INSERTER',5);M8b=new T8b('SELF_LOOP_PREPROCESSOR',6);w8b=new T8b('LAYER_CONSTRAINT_PREPROCESSOR',7);E8b=new T8b('PARTITION_MIDPROCESSOR',8);i8b=new T8b('HIGH_DEGREE_NODE_LAYER_PROCESSOR',9);A8b=new T8b('NODE_PROMOTION',10);v8b=new T8b('LAYER_CONSTRAINT_POSTPROCESSOR',11);F8b=new T8b('PARTITION_POSTPROCESSOR',12);e8b=new T8b('HIERARCHICAL_PORT_CONSTRAINT_PROCESSOR',13);O8b=new T8b('SEMI_INTERACTIVE_CROSSMIN_PROCESSOR',14);P7b=new T8b('BREAKING_POINT_INSERTER',15);z8b=new T8b('LONG_EDGE_SPLITTER',16);I8b=new T8b('PORT_SIDE_PROCESSOR',17);o8b=new T8b('INVERTED_PORT_PROCESSOR',18);H8b=new T8b('PORT_LIST_SORTER',19);Q8b=new T8b('SORT_BY_INPUT_ORDER_OF_MODEL',20);C8b=new T8b('NORTH_SOUTH_PORT_PREPROCESSOR',21);Q7b=new T8b('BREAKING_POINT_PROCESSOR',22);D8b=new T8b(Bne,23);R8b=new T8b(Cne,24);K8b=new T8b('SELF_LOOP_PORT_RESTORER',25);P8b=new T8b('SINGLE_EDGE_GRAPH_WRAPPER',26);p8b=new T8b('IN_LAYER_CONSTRAINT_PROCESSOR',27);b8b=new T8b('END_NODE_PORT_LABEL_MANAGEMENT_PROCESSOR',28);q8b=new T8b('LABEL_AND_NODE_SIZE_PROCESSOR',29);m8b=new T8b('INNERMOST_NODE_MARGIN_CALCULATOR',30);N8b=new T8b('SELF_LOOP_ROUTER',31);T7b=new T8b('COMMENT_NODE_MARGIN_CALCULATOR',32);_7b=new T8b('END_LABEL_PREPROCESSOR',33);t8b=new T8b('LABEL_DUMMY_SWITCHER',34);S7b=new T8b('CENTER_LABEL_MANAGEMENT_PROCESSOR',35);u8b=new T8b('LABEL_SIDE_SELECTOR',36);k8b=new T8b('HYPEREDGE_DUMMY_MERGER',37);f8b=new T8b('HIERARCHICAL_PORT_DUMMY_SIZE_PROCESSOR',38);x8b=new T8b('LAYER_SIZE_AND_GRAPH_HEIGHT_CALCULATOR',39);h8b=new T8b('HIERARCHICAL_PORT_POSITION_PROCESSOR',40);W7b=new T8b('CONSTRAINTS_POSTPROCESSOR',41);U7b=new T8b('COMMENT_POSTPROCESSOR',42);l8b=new T8b('HYPERNODE_PROCESSOR',43);g8b=new T8b('HIERARCHICAL_PORT_ORTHOGONAL_EDGE_ROUTER',44);y8b=new T8b('LONG_EDGE_JOINER',45);L8b=new T8b('SELF_LOOP_POSTPROCESSOR',46);R7b=new T8b('BREAKING_POINT_REMOVER',47);B8b=new T8b('NORTH_SOUTH_PORT_POSTPROCESSOR',48);j8b=new T8b('HORIZONTAL_COMPACTOR',49);s8b=new T8b('LABEL_DUMMY_REMOVER',50);c8b=new T8b('FINAL_SPLINE_BENDPOINTS_CALCULATOR',51);a8b=new T8b('END_LABEL_SORTER',52);J8b=new T8b('REVERSED_EDGE_RESTORER',53);$7b=new T8b('END_LABEL_POSTPROCESSOR',54);d8b=new T8b('HIERARCHICAL_NODE_RESIZER',55);X7b=new T8b('DIRECTION_POSTPROCESSOR',56)} +function KIc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb;cb=0;for(H=b,K=0,N=H.length;K0&&(a.a[U.p]=cb++)}}hb=0;for(I=c,L=0,O=I.length;L0){U=(sCb(Y.b>0),BD(Y.a.Xb(Y.c=--Y.b),11));X=0;for(h=new olb(U.e);h.a0){if(U.j==(Ucd(),Acd)){a.a[U.p]=hb;++hb}else{a.a[U.p]=hb+P+R;++R}}}hb+=R}W=new Lqb;o=new zsb;for(G=b,J=0,M=G.length;Jj.b&&(j.b=Z)}else if(U.i.c==bb){Zj.c&&(j.c=Z)}}}Klb(p,0,p.length,null);gb=KC(WD,oje,25,p.length,15,1);d=KC(WD,oje,25,hb+1,15,1);for(r=0;r0){A%2>0&&(e+=kb[A+1]);A=(A-1)/2|0;++kb[A]}}C=KC(nY,Uhe,362,p.length*2,0,1);for(u=0;u'?":dfb(wue,a)?"'(?<' or '(? toIndex: ',zke=', toIndex: ',Ake='Index: ',Bke=', Size: ',Cke='org.eclipse.elk.alg.common',Dke={62:1},Eke='org.eclipse.elk.alg.common.compaction',Fke='Scanline/EventHandler',Gke='org.eclipse.elk.alg.common.compaction.oned',Hke='CNode belongs to another CGroup.',Ike='ISpacingsHandler/1',Jke='The ',Kke=' instance has been finished already.',Lke='The direction ',Mke=' is not supported by the CGraph instance.',Nke='OneDimensionalCompactor',Oke='OneDimensionalCompactor/lambda$0$Type',Pke='Quadruplet',Qke='ScanlineConstraintCalculator',Rke='ScanlineConstraintCalculator/ConstraintsScanlineHandler',Ske='ScanlineConstraintCalculator/ConstraintsScanlineHandler/lambda$0$Type',Tke='ScanlineConstraintCalculator/Timestamp',Uke='ScanlineConstraintCalculator/lambda$0$Type',Vke={169:1,45:1},Wke='org.eclipse.elk.alg.common.compaction.options',Xke='org.eclipse.elk.core.data',Yke='org.eclipse.elk.polyomino.traversalStrategy',Zke='org.eclipse.elk.polyomino.lowLevelSort',$ke='org.eclipse.elk.polyomino.highLevelSort',_ke='org.eclipse.elk.polyomino.fill',ale={130:1},ble='polyomino',cle='org.eclipse.elk.alg.common.networksimplex',dle={177:1,3:1,4:1},ele='org.eclipse.elk.alg.common.nodespacing',fle='org.eclipse.elk.alg.common.nodespacing.cellsystem',gle='CENTER',hle={212:1,326:1},ile={3:1,4:1,5:1,595:1},jle='LEFT',kle='RIGHT',lle='Vertical alignment cannot be null',mle='BOTTOM',nle='org.eclipse.elk.alg.common.nodespacing.internal',ole='UNDEFINED',ple=0.01,qle='org.eclipse.elk.alg.common.nodespacing.internal.algorithm',rle='LabelPlacer/lambda$0$Type',sle='LabelPlacer/lambda$1$Type',tle='portRatioOrPosition',ule='org.eclipse.elk.alg.common.overlaps',vle='DOWN',wle='org.eclipse.elk.alg.common.polyomino',xle='NORTH',yle='EAST',zle='SOUTH',Ale='WEST',Ble='org.eclipse.elk.alg.common.polyomino.structures',Cle='Direction',Dle='Grid is only of size ',Ele='. Requested point (',Fle=') is out of bounds.',Gle=' Given center based coordinates were (',Hle='org.eclipse.elk.graph.properties',Ile='IPropertyHolder',Jle={3:1,94:1,134:1},Kle='org.eclipse.elk.alg.common.spore',Lle='org.eclipse.elk.alg.common.utils',Mle={209:1},Nle='org.eclipse.elk.core',Ole='Connected Components Compaction',Ple='org.eclipse.elk.alg.disco',Qle='org.eclipse.elk.alg.disco.graph',Rle='org.eclipse.elk.alg.disco.options',Sle='CompactionStrategy',Tle='org.eclipse.elk.disco.componentCompaction.strategy',Ule='org.eclipse.elk.disco.componentCompaction.componentLayoutAlgorithm',Vle='org.eclipse.elk.disco.debug.discoGraph',Wle='org.eclipse.elk.disco.debug.discoPolys',Xle='componentCompaction',Yle='org.eclipse.elk.disco',Zle='org.eclipse.elk.spacing.componentComponent',$le='org.eclipse.elk.edge.thickness',_le='org.eclipse.elk.aspectRatio',ame='org.eclipse.elk.padding',bme='org.eclipse.elk.alg.disco.transform',cme=1.5707963267948966,dme=1.7976931348623157E308,eme={3:1,4:1,5:1,192:1},fme={3:1,6:1,4:1,5:1,106:1,120:1},gme='org.eclipse.elk.alg.force',hme='ComponentsProcessor',ime='ComponentsProcessor/1',jme='org.eclipse.elk.alg.force.graph',kme='Component Layout',lme='org.eclipse.elk.alg.force.model',mme='org.eclipse.elk.force.model',nme='org.eclipse.elk.force.iterations',ome='org.eclipse.elk.force.repulsivePower',pme='org.eclipse.elk.force.temperature',qme=0.001,rme='org.eclipse.elk.force.repulsion',sme='org.eclipse.elk.alg.force.options',tme=1.600000023841858,ume='org.eclipse.elk.force',vme='org.eclipse.elk.priority',wme='org.eclipse.elk.spacing.nodeNode',xme='org.eclipse.elk.spacing.edgeLabel',yme='org.eclipse.elk.randomSeed',zme='org.eclipse.elk.separateConnectedComponents',Ame='org.eclipse.elk.interactive',Bme='org.eclipse.elk.portConstraints',Cme='org.eclipse.elk.edgeLabels.inline',Dme='org.eclipse.elk.omitNodeMicroLayout',Eme='org.eclipse.elk.nodeSize.options',Fme='org.eclipse.elk.nodeSize.constraints',Gme='org.eclipse.elk.nodeLabels.placement',Hme='org.eclipse.elk.portLabels.placement',Ime='origin',Jme='random',Kme='boundingBox.upLeft',Lme='boundingBox.lowRight',Mme='org.eclipse.elk.stress.fixed',Nme='org.eclipse.elk.stress.desiredEdgeLength',Ome='org.eclipse.elk.stress.dimension',Pme='org.eclipse.elk.stress.epsilon',Qme='org.eclipse.elk.stress.iterationLimit',Rme='org.eclipse.elk.stress',Sme='ELK Stress',Tme='org.eclipse.elk.nodeSize.minimum',Ume='org.eclipse.elk.alg.force.stress',Vme='Layered layout',Wme='org.eclipse.elk.alg.layered',Xme='org.eclipse.elk.alg.layered.compaction.components',Yme='org.eclipse.elk.alg.layered.compaction.oned',Zme='org.eclipse.elk.alg.layered.compaction.oned.algs',$me='org.eclipse.elk.alg.layered.compaction.recthull',_me='org.eclipse.elk.alg.layered.components',ane='NONE',bne={3:1,6:1,4:1,9:1,5:1,122:1},cne={3:1,6:1,4:1,5:1,141:1,106:1,120:1},dne='org.eclipse.elk.alg.layered.compound',ene={51:1},fne='org.eclipse.elk.alg.layered.graph',gne=' -> ',hne='Not supported by LGraph',ine='Port side is undefined',jne={3:1,6:1,4:1,5:1,474:1,141:1,106:1,120:1},kne={3:1,6:1,4:1,5:1,141:1,193:1,203:1,106:1,120:1},lne={3:1,6:1,4:1,5:1,141:1,1943:1,203:1,106:1,120:1},mne='([{"\' \t\r\n',nne=')]}"\' \t\r\n',one='The given string contains parts that cannot be parsed as numbers.',pne='org.eclipse.elk.core.math',qne={3:1,4:1,142:1,207:1,414:1},rne={3:1,4:1,116:1,207:1,414:1},sne='org.eclipse.elk.layered',tne='org.eclipse.elk.alg.layered.graph.transform',une='ElkGraphImporter',vne='ElkGraphImporter/lambda$0$Type',wne='ElkGraphImporter/lambda$1$Type',xne='ElkGraphImporter/lambda$2$Type',yne='ElkGraphImporter/lambda$4$Type',zne='Node margin calculation',Ane='org.eclipse.elk.alg.layered.intermediate',Bne='ONE_SIDED_GREEDY_SWITCH',Cne='TWO_SIDED_GREEDY_SWITCH',Dne='No implementation is available for the layout processor ',Ene='IntermediateProcessorStrategy',Fne="Node '",Gne='FIRST_SEPARATE',Hne='LAST_SEPARATE',Ine='Odd port side processing',Jne='org.eclipse.elk.alg.layered.intermediate.compaction',Kne='org.eclipse.elk.alg.layered.intermediate.greedyswitch',Lne='org.eclipse.elk.alg.layered.p3order.counting',Mne={225:1},Nne='org.eclipse.elk.alg.layered.intermediate.loops',One='org.eclipse.elk.alg.layered.intermediate.loops.ordering',Pne='org.eclipse.elk.alg.layered.intermediate.loops.routing',Qne='org.eclipse.elk.alg.layered.intermediate.preserveorder',Rne='org.eclipse.elk.alg.layered.intermediate.wrapping',Sne='org.eclipse.elk.alg.layered.options',Tne='INTERACTIVE',Une='DEPTH_FIRST',Vne='EDGE_LENGTH',Wne='SELF_LOOPS',Xne='firstTryWithInitialOrder',Yne='org.eclipse.elk.layered.directionCongruency',Zne='org.eclipse.elk.layered.feedbackEdges',$ne='org.eclipse.elk.layered.interactiveReferencePoint',_ne='org.eclipse.elk.layered.mergeEdges',aoe='org.eclipse.elk.layered.mergeHierarchyEdges',boe='org.eclipse.elk.layered.allowNonFlowPortsToSwitchSides',coe='org.eclipse.elk.layered.portSortingStrategy',doe='org.eclipse.elk.layered.thoroughness',eoe='org.eclipse.elk.layered.unnecessaryBendpoints',foe='org.eclipse.elk.layered.generatePositionAndLayerIds',goe='org.eclipse.elk.layered.cycleBreaking.strategy',hoe='org.eclipse.elk.layered.layering.strategy',ioe='org.eclipse.elk.layered.layering.layerConstraint',joe='org.eclipse.elk.layered.layering.layerChoiceConstraint',koe='org.eclipse.elk.layered.layering.layerId',loe='org.eclipse.elk.layered.layering.minWidth.upperBoundOnWidth',moe='org.eclipse.elk.layered.layering.minWidth.upperLayerEstimationScalingFactor',noe='org.eclipse.elk.layered.layering.nodePromotion.strategy',ooe='org.eclipse.elk.layered.layering.nodePromotion.maxIterations',poe='org.eclipse.elk.layered.layering.coffmanGraham.layerBound',qoe='org.eclipse.elk.layered.crossingMinimization.strategy',roe='org.eclipse.elk.layered.crossingMinimization.forceNodeModelOrder',soe='org.eclipse.elk.layered.crossingMinimization.hierarchicalSweepiness',toe='org.eclipse.elk.layered.crossingMinimization.semiInteractive',uoe='org.eclipse.elk.layered.crossingMinimization.positionChoiceConstraint',voe='org.eclipse.elk.layered.crossingMinimization.positionId',woe='org.eclipse.elk.layered.crossingMinimization.greedySwitch.activationThreshold',xoe='org.eclipse.elk.layered.crossingMinimization.greedySwitch.type',yoe='org.eclipse.elk.layered.crossingMinimization.greedySwitchHierarchical.type',zoe='org.eclipse.elk.layered.nodePlacement.strategy',Aoe='org.eclipse.elk.layered.nodePlacement.favorStraightEdges',Boe='org.eclipse.elk.layered.nodePlacement.bk.edgeStraightening',Coe='org.eclipse.elk.layered.nodePlacement.bk.fixedAlignment',Doe='org.eclipse.elk.layered.nodePlacement.linearSegments.deflectionDampening',Eoe='org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility',Foe='org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility.default',Goe='org.eclipse.elk.layered.edgeRouting.selfLoopDistribution',Hoe='org.eclipse.elk.layered.edgeRouting.selfLoopOrdering',Ioe='org.eclipse.elk.layered.edgeRouting.splines.mode',Joe='org.eclipse.elk.layered.edgeRouting.splines.sloppy.layerSpacingFactor',Koe='org.eclipse.elk.layered.edgeRouting.polyline.slopedEdgeZoneWidth',Loe='org.eclipse.elk.layered.spacing.baseValue',Moe='org.eclipse.elk.layered.spacing.edgeNodeBetweenLayers',Noe='org.eclipse.elk.layered.spacing.edgeEdgeBetweenLayers',Ooe='org.eclipse.elk.layered.spacing.nodeNodeBetweenLayers',Poe='org.eclipse.elk.layered.priority.direction',Qoe='org.eclipse.elk.layered.priority.shortness',Roe='org.eclipse.elk.layered.priority.straightness',Soe='org.eclipse.elk.layered.compaction.connectedComponents',Toe='org.eclipse.elk.layered.compaction.postCompaction.strategy',Uoe='org.eclipse.elk.layered.compaction.postCompaction.constraints',Voe='org.eclipse.elk.layered.highDegreeNodes.treatment',Woe='org.eclipse.elk.layered.highDegreeNodes.threshold',Xoe='org.eclipse.elk.layered.highDegreeNodes.treeHeight',Yoe='org.eclipse.elk.layered.wrapping.strategy',Zoe='org.eclipse.elk.layered.wrapping.additionalEdgeSpacing',$oe='org.eclipse.elk.layered.wrapping.correctionFactor',_oe='org.eclipse.elk.layered.wrapping.cutting.strategy',ape='org.eclipse.elk.layered.wrapping.cutting.cuts',bpe='org.eclipse.elk.layered.wrapping.cutting.msd.freedom',cpe='org.eclipse.elk.layered.wrapping.validify.strategy',dpe='org.eclipse.elk.layered.wrapping.validify.forbiddenIndices',epe='org.eclipse.elk.layered.wrapping.multiEdge.improveCuts',fpe='org.eclipse.elk.layered.wrapping.multiEdge.distancePenalty',gpe='org.eclipse.elk.layered.wrapping.multiEdge.improveWrappedEdges',hpe='org.eclipse.elk.layered.edgeLabels.sideSelection',ipe='org.eclipse.elk.layered.edgeLabels.centerLabelPlacementStrategy',jpe='org.eclipse.elk.layered.considerModelOrder.strategy',kpe='org.eclipse.elk.layered.considerModelOrder.noModelOrder',lpe='org.eclipse.elk.layered.considerModelOrder.components',mpe='org.eclipse.elk.layered.considerModelOrder.longEdgeStrategy',npe='org.eclipse.elk.layered.considerModelOrder.crossingCounterNodeInfluence',ope='org.eclipse.elk.layered.considerModelOrder.crossingCounterPortInfluence',ppe='layering',qpe='layering.minWidth',rpe='layering.nodePromotion',spe='crossingMinimization',tpe='org.eclipse.elk.hierarchyHandling',upe='crossingMinimization.greedySwitch',vpe='nodePlacement',wpe='nodePlacement.bk',xpe='edgeRouting',ype='org.eclipse.elk.edgeRouting',zpe='spacing',Ape='priority',Bpe='compaction',Cpe='compaction.postCompaction',Dpe='Specifies whether and how post-process compaction is applied.',Epe='highDegreeNodes',Fpe='wrapping',Gpe='wrapping.cutting',Hpe='wrapping.validify',Ipe='wrapping.multiEdge',Jpe='edgeLabels',Kpe='considerModelOrder',Lpe='org.eclipse.elk.spacing.commentComment',Mpe='org.eclipse.elk.spacing.commentNode',Npe='org.eclipse.elk.spacing.edgeEdge',Ope='org.eclipse.elk.spacing.edgeNode',Ppe='org.eclipse.elk.spacing.labelLabel',Qpe='org.eclipse.elk.spacing.labelPortHorizontal',Rpe='org.eclipse.elk.spacing.labelPortVertical',Spe='org.eclipse.elk.spacing.labelNode',Tpe='org.eclipse.elk.spacing.nodeSelfLoop',Upe='org.eclipse.elk.spacing.portPort',Vpe='org.eclipse.elk.spacing.individual',Wpe='org.eclipse.elk.port.borderOffset',Xpe='org.eclipse.elk.noLayout',Ype='org.eclipse.elk.port.side',Zpe='org.eclipse.elk.debugMode',$pe='org.eclipse.elk.alignment',_pe='org.eclipse.elk.insideSelfLoops.activate',aqe='org.eclipse.elk.insideSelfLoops.yo',bqe='org.eclipse.elk.nodeSize.fixedGraphSize',cqe='org.eclipse.elk.direction',dqe='org.eclipse.elk.nodeLabels.padding',eqe='org.eclipse.elk.portLabels.nextToPortIfPossible',fqe='org.eclipse.elk.portLabels.treatAsGroup',gqe='org.eclipse.elk.portAlignment.default',hqe='org.eclipse.elk.portAlignment.north',iqe='org.eclipse.elk.portAlignment.south',jqe='org.eclipse.elk.portAlignment.west',kqe='org.eclipse.elk.portAlignment.east',lqe='org.eclipse.elk.contentAlignment',mqe='org.eclipse.elk.junctionPoints',nqe='org.eclipse.elk.edgeLabels.placement',oqe='org.eclipse.elk.port.index',pqe='org.eclipse.elk.commentBox',qqe='org.eclipse.elk.hypernode',rqe='org.eclipse.elk.port.anchor',sqe='org.eclipse.elk.partitioning.activate',tqe='org.eclipse.elk.partitioning.partition',uqe='org.eclipse.elk.position',vqe='org.eclipse.elk.margins',wqe='org.eclipse.elk.spacing.portsSurrounding',xqe='org.eclipse.elk.interactiveLayout',yqe='org.eclipse.elk.core.util',zqe={3:1,4:1,5:1,593:1},Aqe='NETWORK_SIMPLEX',Bqe={123:1,51:1},Cqe='org.eclipse.elk.alg.layered.p1cycles',Dqe='org.eclipse.elk.alg.layered.p2layers',Eqe={402:1,225:1},Fqe={832:1,3:1,4:1},Gqe='org.eclipse.elk.alg.layered.p3order',Hqe='org.eclipse.elk.alg.layered.p4nodes',Iqe={3:1,4:1,5:1,840:1},Jqe=1.0E-5,Kqe='org.eclipse.elk.alg.layered.p4nodes.bk',Lqe='org.eclipse.elk.alg.layered.p5edges',Mqe='org.eclipse.elk.alg.layered.p5edges.orthogonal',Nqe='org.eclipse.elk.alg.layered.p5edges.orthogonal.direction',Oqe=1.0E-6,Pqe='org.eclipse.elk.alg.layered.p5edges.splines',Qqe=0.09999999999999998,Rqe=1.0E-8,Sqe=4.71238898038469,Tqe=3.141592653589793,Uqe='org.eclipse.elk.alg.mrtree',Vqe='org.eclipse.elk.alg.mrtree.graph',Wqe='org.eclipse.elk.alg.mrtree.intermediate',Xqe='Set neighbors in level',Yqe='DESCENDANTS',Zqe='org.eclipse.elk.mrtree.weighting',$qe='org.eclipse.elk.mrtree.searchOrder',_qe='org.eclipse.elk.alg.mrtree.options',are='org.eclipse.elk.mrtree',bre='org.eclipse.elk.tree',cre='org.eclipse.elk.alg.radial',dre=6.283185307179586,ere=4.9E-324,fre='org.eclipse.elk.alg.radial.intermediate',gre='org.eclipse.elk.alg.radial.intermediate.compaction',hre={3:1,4:1,5:1,106:1},ire='org.eclipse.elk.alg.radial.intermediate.optimization',jre='No implementation is available for the layout option ',kre='org.eclipse.elk.alg.radial.options',lre='org.eclipse.elk.radial.orderId',mre='org.eclipse.elk.radial.radius',nre='org.eclipse.elk.radial.compactor',ore='org.eclipse.elk.radial.compactionStepSize',pre='org.eclipse.elk.radial.sorter',qre='org.eclipse.elk.radial.wedgeCriteria',rre='org.eclipse.elk.radial.optimizationCriteria',sre='org.eclipse.elk.radial',tre='org.eclipse.elk.alg.radial.p1position.wedge',ure='org.eclipse.elk.alg.radial.sorting',vre=5.497787143782138,wre=3.9269908169872414,xre=2.356194490192345,yre='org.eclipse.elk.alg.rectpacking',zre='org.eclipse.elk.alg.rectpacking.firstiteration',Are='org.eclipse.elk.alg.rectpacking.options',Bre='org.eclipse.elk.rectpacking.optimizationGoal',Cre='org.eclipse.elk.rectpacking.lastPlaceShift',Dre='org.eclipse.elk.rectpacking.currentPosition',Ere='org.eclipse.elk.rectpacking.desiredPosition',Fre='org.eclipse.elk.rectpacking.onlyFirstIteration',Gre='org.eclipse.elk.rectpacking.rowCompaction',Hre='org.eclipse.elk.rectpacking.expandToAspectRatio',Ire='org.eclipse.elk.rectpacking.targetWidth',Jre='org.eclipse.elk.expandNodes',Kre='org.eclipse.elk.rectpacking',Lre='org.eclipse.elk.alg.rectpacking.util',Mre='No implementation available for ',Nre='org.eclipse.elk.alg.spore',Ore='org.eclipse.elk.alg.spore.options',Pre='org.eclipse.elk.sporeCompaction',Qre='org.eclipse.elk.underlyingLayoutAlgorithm',Rre='org.eclipse.elk.processingOrder.treeConstruction',Sre='org.eclipse.elk.processingOrder.spanningTreeCostFunction',Tre='org.eclipse.elk.processingOrder.preferredRoot',Ure='org.eclipse.elk.processingOrder.rootSelection',Vre='org.eclipse.elk.structure.structureExtractionStrategy',Wre='org.eclipse.elk.compaction.compactionStrategy',Xre='org.eclipse.elk.compaction.orthogonal',Yre='org.eclipse.elk.overlapRemoval.maxIterations',Zre='org.eclipse.elk.overlapRemoval.runScanline',$re='processingOrder',_re='overlapRemoval',ase='org.eclipse.elk.sporeOverlap',bse='org.eclipse.elk.alg.spore.p1structure',cse='org.eclipse.elk.alg.spore.p2processingorder',dse='org.eclipse.elk.alg.spore.p3execution',ese='Invalid index: ',fse='org.eclipse.elk.core.alg',gse={331:1},hse={288:1},ise='Make sure its type is registered with the ',jse=' utility class.',kse='true',lse='false',mse="Couldn't clone property '",nse=0.05,ose='org.eclipse.elk.core.options',pse=1.2999999523162842,qse='org.eclipse.elk.box',rse='org.eclipse.elk.box.packingMode',sse='org.eclipse.elk.algorithm',tse='org.eclipse.elk.resolvedAlgorithm',use='org.eclipse.elk.bendPoints',vse='org.eclipse.elk.labelManager',wse='org.eclipse.elk.scaleFactor',xse='org.eclipse.elk.animate',yse='org.eclipse.elk.animTimeFactor',zse='org.eclipse.elk.layoutAncestors',Ase='org.eclipse.elk.maxAnimTime',Bse='org.eclipse.elk.minAnimTime',Cse='org.eclipse.elk.progressBar',Dse='org.eclipse.elk.validateGraph',Ese='org.eclipse.elk.validateOptions',Fse='org.eclipse.elk.zoomToFit',Gse='org.eclipse.elk.font.name',Hse='org.eclipse.elk.font.size',Ise='org.eclipse.elk.edge.type',Jse='partitioning',Kse='nodeLabels',Lse='portAlignment',Mse='nodeSize',Nse='port',Ose='portLabels',Pse='insideSelfLoops',Qse='org.eclipse.elk.fixed',Rse='org.eclipse.elk.random',Sse='port must have a parent node to calculate the port side',Tse='The edge needs to have exactly one edge section. Found: ',Use='org.eclipse.elk.core.util.adapters',Vse='org.eclipse.emf.ecore',Wse='org.eclipse.elk.graph',Xse='EMapPropertyHolder',Yse='ElkBendPoint',Zse='ElkGraphElement',$se='ElkConnectableShape',_se='ElkEdge',ate='ElkEdgeSection',bte='EModelElement',cte='ENamedElement',dte='ElkLabel',ete='ElkNode',fte='ElkPort',gte={92:1,90:1},hte='org.eclipse.emf.common.notify.impl',ite="The feature '",jte="' is not a valid changeable feature",kte='Expecting null',lte="' is not a valid feature",mte='The feature ID',nte=' is not a valid feature ID',ote=32768,pte={105:1,92:1,90:1,56:1,49:1,97:1},qte='org.eclipse.emf.ecore.impl',rte='org.eclipse.elk.graph.impl',ste='Recursive containment not allowed for ',tte="The datatype '",ute="' is not a valid classifier",vte="The value '",wte={190:1,3:1,4:1},xte="The class '",yte='http://www.eclipse.org/elk/ElkGraph',zte=1024,Ate='property',Bte='value',Cte='source',Dte='properties',Ete='identifier',Fte='height',Gte='width',Hte='parent',Ite='text',Jte='children',Kte='hierarchical',Lte='sources',Mte='targets',Nte='sections',Ote='bendPoints',Pte='outgoingShape',Qte='incomingShape',Rte='outgoingSections',Ste='incomingSections',Tte='org.eclipse.emf.common.util',Ute='Severe implementation error in the Json to ElkGraph importer.',Vte='id',Wte='org.eclipse.elk.graph.json',Xte='Unhandled parameter types: ',Yte='startPoint',Zte="An edge must have at least one source and one target (edge id: '",$te="').",_te='Referenced edge section does not exist: ',aue=" (edge id: '",bue='target',cue='sourcePoint',due='targetPoint',eue='group',fue='name',gue='connectableShape cannot be null',hue='edge cannot be null',iue="Passed edge is not 'simple'.",jue='org.eclipse.elk.graph.util',kue="The 'no duplicates' constraint is violated",lue='targetIndex=',mue=', size=',nue='sourceIndex=',oue={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1},pue={3:1,4:1,20:1,28:1,52:1,14:1,47:1,15:1,54:1,67:1,63:1,58:1,588:1},que='logging',rue='measureExecutionTime',sue='parser.parse.1',tue='parser.parse.2',uue='parser.next.1',vue='parser.next.2',wue='parser.next.3',xue='parser.next.4',yue='parser.factor.1',zue='parser.factor.2',Aue='parser.factor.3',Bue='parser.factor.4',Cue='parser.factor.5',Due='parser.factor.6',Eue='parser.atom.1',Fue='parser.atom.2',Gue='parser.atom.3',Hue='parser.atom.4',Iue='parser.atom.5',Jue='parser.cc.1',Kue='parser.cc.2',Lue='parser.cc.3',Mue='parser.cc.5',Nue='parser.cc.6',Oue='parser.cc.7',Pue='parser.cc.8',Que='parser.ope.1',Rue='parser.ope.2',Sue='parser.ope.3',Tue='parser.descape.1',Uue='parser.descape.2',Vue='parser.descape.3',Wue='parser.descape.4',Xue='parser.descape.5',Yue='parser.process.1',Zue='parser.quantifier.1',$ue='parser.quantifier.2',_ue='parser.quantifier.3',ave='parser.quantifier.4',bve='parser.quantifier.5',cve='org.eclipse.emf.common.notify',dve={415:1,672:1},eve={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1},fve={366:1,143:1},gve='index=',hve={3:1,4:1,5:1,126:1},ive={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,58:1},jve={3:1,6:1,4:1,5:1,192:1},kve={3:1,4:1,5:1,165:1,367:1},lve=';/?:@&=+$,',mve='invalid authority: ',nve='EAnnotation',ove='ETypedElement',pve='EStructuralFeature',qve='EAttribute',rve='EClassifier',sve='EEnumLiteral',tve='EGenericType',uve='EOperation',vve='EParameter',wve='EReference',xve='ETypeParameter',yve='org.eclipse.emf.ecore.util',zve={76:1},Ave={3:1,20:1,14:1,15:1,58:1,589:1,76:1,69:1,95:1},Bve='org.eclipse.emf.ecore.util.FeatureMap$Entry',Cve=8192,Dve=2048,Eve='byte',Fve='char',Gve='double',Hve='float',Ive='int',Jve='long',Kve='short',Lve='java.lang.Object',Mve={3:1,4:1,5:1,247:1},Nve={3:1,4:1,5:1,673:1},Ove={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,69:1},Pve={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,69:1,95:1},Qve='mixed',Rve='http:///org/eclipse/emf/ecore/util/ExtendedMetaData',Sve='kind',Tve={3:1,4:1,5:1,674:1},Uve={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1,76:1,69:1,95:1},Vve={20:1,28:1,52:1,14:1,15:1,58:1,69:1},Wve={47:1,125:1,279:1},Xve={72:1,332:1},Yve="The value of type '",Zve="' must be of type '",$ve=1316,_ve='http://www.eclipse.org/emf/2002/Ecore',awe=-32768,bwe='constraints',cwe='baseType',dwe='getEStructuralFeature',ewe='getFeatureID',fwe='feature',gwe='getOperationID',hwe='operation',iwe='defaultValue',jwe='eTypeParameters',kwe='isInstance',lwe='getEEnumLiteral',mwe='eContainingClass',nwe={55:1},owe={3:1,4:1,5:1,119:1},pwe='org.eclipse.emf.ecore.resource',qwe={92:1,90:1,591:1,1935:1},rwe='org.eclipse.emf.ecore.resource.impl',swe='unspecified',twe='simple',uwe='attribute',vwe='attributeWildcard',wwe='element',xwe='elementWildcard',ywe='collapse',zwe='itemType',Awe='namespace',Bwe='##targetNamespace',Cwe='whiteSpace',Dwe='wildcards',Ewe='http://www.eclipse.org/emf/2003/XMLType',Fwe='##any',Gwe='uninitialized',Hwe='The multiplicity constraint is violated',Iwe='org.eclipse.emf.ecore.xml.type',Jwe='ProcessingInstruction',Kwe='SimpleAnyType',Lwe='XMLTypeDocumentRoot',Mwe='org.eclipse.emf.ecore.xml.type.impl',Nwe='INF',Owe='processing',Pwe='ENTITIES_._base',Qwe='minLength',Rwe='ENTITY',Swe='NCName',Twe='IDREFS_._base',Uwe='integer',Vwe='token',Wwe='pattern',Xwe='[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*',Ywe='\\i\\c*',Zwe='[\\i-[:]][\\c-[:]]*',$we='nonPositiveInteger',_we='maxInclusive',axe='NMTOKEN',bxe='NMTOKENS_._base',cxe='nonNegativeInteger',dxe='minInclusive',exe='normalizedString',fxe='unsignedByte',gxe='unsignedInt',hxe='18446744073709551615',ixe='unsignedShort',jxe='processingInstruction',kxe='org.eclipse.emf.ecore.xml.type.internal',lxe=1114111,mxe='Internal Error: shorthands: \\u',nxe='xml:isDigit',oxe='xml:isWord',pxe='xml:isSpace',qxe='xml:isNameChar',rxe='xml:isInitialNameChar',sxe='09\u0660\u0669\u06F0\u06F9\u0966\u096F\u09E6\u09EF\u0A66\u0A6F\u0AE6\u0AEF\u0B66\u0B6F\u0BE7\u0BEF\u0C66\u0C6F\u0CE6\u0CEF\u0D66\u0D6F\u0E50\u0E59\u0ED0\u0ED9\u0F20\u0F29',txe='AZaz\xC0\xD6\xD8\xF6\xF8\u0131\u0134\u013E\u0141\u0148\u014A\u017E\u0180\u01C3\u01CD\u01F0\u01F4\u01F5\u01FA\u0217\u0250\u02A8\u02BB\u02C1\u0386\u0386\u0388\u038A\u038C\u038C\u038E\u03A1\u03A3\u03CE\u03D0\u03D6\u03DA\u03DA\u03DC\u03DC\u03DE\u03DE\u03E0\u03E0\u03E2\u03F3\u0401\u040C\u040E\u044F\u0451\u045C\u045E\u0481\u0490\u04C4\u04C7\u04C8\u04CB\u04CC\u04D0\u04EB\u04EE\u04F5\u04F8\u04F9\u0531\u0556\u0559\u0559\u0561\u0586\u05D0\u05EA\u05F0\u05F2\u0621\u063A\u0641\u064A\u0671\u06B7\u06BA\u06BE\u06C0\u06CE\u06D0\u06D3\u06D5\u06D5\u06E5\u06E6\u0905\u0939\u093D\u093D\u0958\u0961\u0985\u098C\u098F\u0990\u0993\u09A8\u09AA\u09B0\u09B2\u09B2\u09B6\u09B9\u09DC\u09DD\u09DF\u09E1\u09F0\u09F1\u0A05\u0A0A\u0A0F\u0A10\u0A13\u0A28\u0A2A\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59\u0A5C\u0A5E\u0A5E\u0A72\u0A74\u0A85\u0A8B\u0A8D\u0A8D\u0A8F\u0A91\u0A93\u0AA8\u0AAA\u0AB0\u0AB2\u0AB3\u0AB5\u0AB9\u0ABD\u0ABD\u0AE0\u0AE0\u0B05\u0B0C\u0B0F\u0B10\u0B13\u0B28\u0B2A\u0B30\u0B32\u0B33\u0B36\u0B39\u0B3D\u0B3D\u0B5C\u0B5D\u0B5F\u0B61\u0B85\u0B8A\u0B8E\u0B90\u0B92\u0B95\u0B99\u0B9A\u0B9C\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8\u0BAA\u0BAE\u0BB5\u0BB7\u0BB9\u0C05\u0C0C\u0C0E\u0C10\u0C12\u0C28\u0C2A\u0C33\u0C35\u0C39\u0C60\u0C61\u0C85\u0C8C\u0C8E\u0C90\u0C92\u0CA8\u0CAA\u0CB3\u0CB5\u0CB9\u0CDE\u0CDE\u0CE0\u0CE1\u0D05\u0D0C\u0D0E\u0D10\u0D12\u0D28\u0D2A\u0D39\u0D60\u0D61\u0E01\u0E2E\u0E30\u0E30\u0E32\u0E33\u0E40\u0E45\u0E81\u0E82\u0E84\u0E84\u0E87\u0E88\u0E8A\u0E8A\u0E8D\u0E8D\u0E94\u0E97\u0E99\u0E9F\u0EA1\u0EA3\u0EA5\u0EA5\u0EA7\u0EA7\u0EAA\u0EAB\u0EAD\u0EAE\u0EB0\u0EB0\u0EB2\u0EB3\u0EBD\u0EBD\u0EC0\u0EC4\u0F40\u0F47\u0F49\u0F69\u10A0\u10C5\u10D0\u10F6\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110B\u110C\u110E\u1112\u113C\u113C\u113E\u113E\u1140\u1140\u114C\u114C\u114E\u114E\u1150\u1150\u1154\u1155\u1159\u1159\u115F\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116D\u116E\u1172\u1173\u1175\u1175\u119E\u119E\u11A8\u11A8\u11AB\u11AB\u11AE\u11AF\u11B7\u11B8\u11BA\u11BA\u11BC\u11C2\u11EB\u11EB\u11F0\u11F0\u11F9\u11F9\u1E00\u1E9B\u1EA0\u1EF9\u1F00\u1F15\u1F18\u1F1D\u1F20\u1F45\u1F48\u1F4D\u1F50\u1F57\u1F59\u1F59\u1F5B\u1F5B\u1F5D\u1F5D\u1F5F\u1F7D\u1F80\u1FB4\u1FB6\u1FBC\u1FBE\u1FBE\u1FC2\u1FC4\u1FC6\u1FCC\u1FD0\u1FD3\u1FD6\u1FDB\u1FE0\u1FEC\u1FF2\u1FF4\u1FF6\u1FFC\u2126\u2126\u212A\u212B\u212E\u212E\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30A1\u30FA\u3105\u312C\u4E00\u9FA5\uAC00\uD7A3',uxe='Private Use',vxe='ASSIGNED',wxe='\x00\x7F\x80\xFF\u0100\u017F\u0180\u024F\u0250\u02AF\u02B0\u02FF\u0300\u036F\u0370\u03FF\u0400\u04FF\u0530\u058F\u0590\u05FF\u0600\u06FF\u0700\u074F\u0780\u07BF\u0900\u097F\u0980\u09FF\u0A00\u0A7F\u0A80\u0AFF\u0B00\u0B7F\u0B80\u0BFF\u0C00\u0C7F\u0C80\u0CFF\u0D00\u0D7F\u0D80\u0DFF\u0E00\u0E7F\u0E80\u0EFF\u0F00\u0FFF\u1000\u109F\u10A0\u10FF\u1100\u11FF\u1200\u137F\u13A0\u13FF\u1400\u167F\u1680\u169F\u16A0\u16FF\u1780\u17FF\u1800\u18AF\u1E00\u1EFF\u1F00\u1FFF\u2000\u206F\u2070\u209F\u20A0\u20CF\u20D0\u20FF\u2100\u214F\u2150\u218F\u2190\u21FF\u2200\u22FF\u2300\u23FF\u2400\u243F\u2440\u245F\u2460\u24FF\u2500\u257F\u2580\u259F\u25A0\u25FF\u2600\u26FF\u2700\u27BF\u2800\u28FF\u2E80\u2EFF\u2F00\u2FDF\u2FF0\u2FFF\u3000\u303F\u3040\u309F\u30A0\u30FF\u3100\u312F\u3130\u318F\u3190\u319F\u31A0\u31BF\u3200\u32FF\u3300\u33FF\u3400\u4DB5\u4E00\u9FFF\uA000\uA48F\uA490\uA4CF\uAC00\uD7A3\uE000\uF8FF\uF900\uFAFF\uFB00\uFB4F\uFB50\uFDFF\uFE20\uFE2F\uFE30\uFE4F\uFE50\uFE6F\uFE70\uFEFE\uFEFF\uFEFF\uFF00\uFFEF',xxe='UNASSIGNED',yxe={3:1,117:1},zxe='org.eclipse.emf.ecore.xml.type.util',Axe={3:1,4:1,5:1,368:1},Bxe='org.eclipse.xtext.xbase.lib',Cxe='Cannot add elements to a Range',Dxe='Cannot set elements in a Range',Exe='Cannot remove elements from a Range',Fxe='locale',Gxe='default',Hxe='user.agent';var _,_bb,Wbb,tbb=-1;$wnd.goog=$wnd.goog||{};$wnd.goog.global=$wnd.goog.global||$wnd;acb();bcb(1,null,{},nb);_.Fb=function ob(a){return mb(this,a)};_.Gb=function qb(){return this.gm};_.Hb=function sb(){return FCb(this)};_.Ib=function ub(){var a;return hdb(rb(this))+'@'+(a=tb(this)>>>0,a.toString(16))};_.equals=function(a){return this.Fb(a)};_.hashCode=function(){return this.Hb()};_.toString=function(){return this.Ib()};var xD,yD,zD;bcb(290,1,{290:1,2026:1},jdb);_.le=function kdb(a){var b;b=new jdb;b.i=4;a>1?(b.c=rdb(this,a-1)):(b.c=this);return b};_.me=function qdb(){fdb(this);return this.b};_.ne=function sdb(){return hdb(this)};_.oe=function udb(){return fdb(this),this.k};_.pe=function wdb(){return (this.i&4)!=0};_.qe=function xdb(){return (this.i&1)!=0};_.Ib=function Adb(){return idb(this)};_.i=0;var edb=1;var SI=mdb(Phe,'Object',1);var AI=mdb(Phe,'Class',290);bcb(1998,1,Qhe);var $D=mdb(Rhe,'Optional',1998);bcb(1170,1998,Qhe,xb);_.Fb=function yb(a){return a===this};_.Hb=function zb(){return 2040732332};_.Ib=function Ab(){return 'Optional.absent()'};_.Jb=function Bb(a){Qb(a);return wb(),vb};var vb;var YD=mdb(Rhe,'Absent',1170);bcb(628,1,{},Gb);var ZD=mdb(Rhe,'Joiner',628);var _D=odb(Rhe,'Predicate');bcb(582,1,{169:1,582:1,3:1,45:1},Yb);_.Mb=function ac(a){return Xb(this,a)};_.Lb=function Zb(a){return Xb(this,a)};_.Fb=function $b(a){var b;if(JD(a,582)){b=BD(a,582);return At(this.a,b.a)}return false};_.Hb=function _b(){return qmb(this.a)+306654252};_.Ib=function bc(){return Wb(this.a)};var aE=mdb(Rhe,'Predicates/AndPredicate',582);bcb(408,1998,{408:1,3:1},cc);_.Fb=function dc(a){var b;if(JD(a,408)){b=BD(a,408);return pb(this.a,b.a)}return false};_.Hb=function ec(){return 1502476572+tb(this.a)};_.Ib=function fc(){return Whe+this.a+')'};_.Jb=function gc(a){return new cc(Rb(a.Kb(this.a),'the Function passed to Optional.transform() must not return null.'))};var bE=mdb(Rhe,'Present',408);bcb(198,1,Yhe);_.Nb=function kc(a){Rrb(this,a)};_.Qb=function lc(){jc()};var MH=mdb(Zhe,'UnmodifiableIterator',198);bcb(1978,198,$he);_.Qb=function nc(){jc()};_.Rb=function mc(a){throw vbb(new bgb)};_.Wb=function oc(a){throw vbb(new bgb)};var NH=mdb(Zhe,'UnmodifiableListIterator',1978);bcb(386,1978,$he);_.Ob=function rc(){return this.c0};_.Pb=function tc(){if(this.c>=this.d){throw vbb(new utb)}return this.Xb(this.c++)};_.Tb=function uc(){return this.c};_.Ub=function vc(){if(this.c<=0){throw vbb(new utb)}return this.Xb(--this.c)};_.Vb=function wc(){return this.c-1};_.c=0;_.d=0;var cE=mdb(Zhe,'AbstractIndexedListIterator',386);bcb(699,198,Yhe);_.Ob=function Ac(){return xc(this)};_.Pb=function Bc(){return yc(this)};_.e=1;var dE=mdb(Zhe,'AbstractIterator',699);bcb(1986,1,{224:1});_.Zb=function Hc(){var a;return a=this.f,!a?(this.f=this.ac()):a};_.Fb=function Ic(a){return hw(this,a)};_.Hb=function Jc(){return tb(this.Zb())};_.dc=function Kc(){return this.gc()==0};_.ec=function Lc(){return Ec(this)};_.Ib=function Mc(){return fcb(this.Zb())};var IE=mdb(Zhe,'AbstractMultimap',1986);bcb(726,1986,_he);_.$b=function Xc(){Nc(this)};_._b=function Yc(a){return Oc(this,a)};_.ac=function Zc(){return new ne(this,this.c)};_.ic=function $c(a){return this.hc()};_.bc=function _c(){return new zf(this,this.c)};_.jc=function ad(){return this.mc(this.hc())};_.kc=function bd(){return new Hd(this)};_.lc=function cd(){return Yj(this.c.vc().Nc(),new $g,64,this.d)};_.cc=function dd(a){return Qc(this,a)};_.fc=function gd(a){return Sc(this,a)};_.gc=function hd(){return this.d};_.mc=function jd(a){return mmb(),new lnb(a)};_.nc=function kd(){return new Dd(this)};_.oc=function ld(){return Yj(this.c.Cc().Nc(),new Fd,64,this.d)};_.pc=function md(a,b){return new dg(this,a,b,null)};_.d=0;var DE=mdb(Zhe,'AbstractMapBasedMultimap',726);bcb(1631,726,_he);_.hc=function pd(){return new Skb(this.a)};_.jc=function qd(){return mmb(),mmb(),jmb};_.cc=function sd(a){return BD(Qc(this,a),15)};_.fc=function ud(a){return BD(Sc(this,a),15)};_.Zb=function od(){return nd(this)};_.Fb=function rd(a){return hw(this,a)};_.qc=function td(a){return BD(Qc(this,a),15)};_.rc=function vd(a){return BD(Sc(this,a),15)};_.mc=function wd(a){return vmb(BD(a,15))};_.pc=function xd(a,b){return Vc(this,a,BD(b,15),null)};var eE=mdb(Zhe,'AbstractListMultimap',1631);bcb(732,1,aie);_.Nb=function zd(a){Rrb(this,a)};_.Ob=function Ad(){return this.c.Ob()||this.e.Ob()};_.Pb=function Bd(){var a;if(!this.e.Ob()){a=BD(this.c.Pb(),42);this.b=a.cd();this.a=BD(a.dd(),14);this.e=this.a.Kc()}return this.sc(this.b,this.e.Pb())};_.Qb=function Cd(){this.e.Qb();this.a.dc()&&this.c.Qb();--this.d.d};var mE=mdb(Zhe,'AbstractMapBasedMultimap/Itr',732);bcb(1099,732,aie,Dd);_.sc=function Ed(a,b){return b};var fE=mdb(Zhe,'AbstractMapBasedMultimap/1',1099);bcb(1100,1,{},Fd);_.Kb=function Gd(a){return BD(a,14).Nc()};var gE=mdb(Zhe,'AbstractMapBasedMultimap/1methodref$spliterator$Type',1100);bcb(1101,732,aie,Hd);_.sc=function Id(a,b){return new Wo(a,b)};var hE=mdb(Zhe,'AbstractMapBasedMultimap/2',1101);var DK=odb(bie,'Map');bcb(1967,1,cie);_.wc=function Td(a){stb(this,a)};_.yc=function $d(a,b,c){return ttb(this,a,b,c)};_.$b=function Od(){this.vc().$b()};_.tc=function Pd(a){return Jd(this,a)};_._b=function Qd(a){return !!Kd(this,a,false)};_.uc=function Rd(a){var b,c,d;for(c=this.vc().Kc();c.Ob();){b=BD(c.Pb(),42);d=b.dd();if(PD(a)===PD(d)||a!=null&&pb(a,d)){return true}}return false};_.Fb=function Sd(a){var b,c,d;if(a===this){return true}if(!JD(a,83)){return false}d=BD(a,83);if(this.gc()!=d.gc()){return false}for(c=d.vc().Kc();c.Ob();){b=BD(c.Pb(),42);if(!this.tc(b)){return false}}return true};_.xc=function Ud(a){return Wd(Kd(this,a,false))};_.Hb=function Xd(){return pmb(this.vc())};_.dc=function Yd(){return this.gc()==0};_.ec=function Zd(){return new Pib(this)};_.zc=function _d(a,b){throw vbb(new cgb('Put not supported on this map'))};_.Ac=function ae(a){Ld(this,a)};_.Bc=function be(a){return Wd(Kd(this,a,true))};_.gc=function ce(){return this.vc().gc()};_.Ib=function de(){return Md(this)};_.Cc=function ee(){return new $ib(this)};var sJ=mdb(bie,'AbstractMap',1967);bcb(1987,1967,cie);_.bc=function ge(){return new rf(this)};_.vc=function he(){return fe(this)};_.ec=function ie(){var a;a=this.g;return !a?(this.g=this.bc()):a};_.Cc=function je(){var a;a=this.i;return !a?(this.i=new Zv(this)):a};var bH=mdb(Zhe,'Maps/ViewCachingAbstractMap',1987);bcb(389,1987,cie,ne);_.xc=function se(a){return ke(this,a)};_.Bc=function ve(a){return le(this,a)};_.$b=function oe(){this.d==this.e.c?this.e.$b():ir(new mf(this))};_._b=function pe(a){return Gv(this.d,a)};_.Ec=function qe(){return new df(this)};_.Dc=function(){return this.Ec()};_.Fb=function re(a){return this===a||pb(this.d,a)};_.Hb=function te(){return tb(this.d)};_.ec=function ue(){return this.e.ec()};_.gc=function we(){return this.d.gc()};_.Ib=function xe(){return fcb(this.d)};var lE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap',389);var KI=odb(Phe,'Iterable');bcb(28,1,die);_.Jc=function Le(a){reb(this,a)};_.Lc=function Ne(){return this.Oc()};_.Nc=function Pe(){return new Kub(this,0)};_.Oc=function Qe(){return new YAb(null,this.Nc())};_.Fc=function Ge(a){throw vbb(new cgb('Add not supported on this collection'))};_.Gc=function He(a){return ye(this,a)};_.$b=function Ie(){Ae(this)};_.Hc=function Je(a){return ze(this,a,false)};_.Ic=function Ke(a){return Be(this,a)};_.dc=function Me(){return this.gc()==0};_.Mc=function Oe(a){return ze(this,a,true)};_.Pc=function Re(){return De(this)};_.Qc=function Se(a){return Ee(this,a)};_.Ib=function Te(){return Fe(this)};var dJ=mdb(bie,'AbstractCollection',28);var LK=odb(bie,'Set');bcb(eie,28,fie);_.Nc=function Ye(){return new Kub(this,1)};_.Fb=function We(a){return Ue(this,a)};_.Hb=function Xe(){return pmb(this)};var zJ=mdb(bie,'AbstractSet',eie);bcb(1970,eie,fie);var BH=mdb(Zhe,'Sets/ImprovedAbstractSet',1970);bcb(1971,1970,fie);_.$b=function $e(){this.Rc().$b()};_.Hc=function _e(a){return Ze(this,a)};_.dc=function af(){return this.Rc().dc()};_.Mc=function bf(a){var b;if(this.Hc(a)){b=BD(a,42);return this.Rc().ec().Mc(b.cd())}return false};_.gc=function cf(){return this.Rc().gc()};var WG=mdb(Zhe,'Maps/EntrySet',1971);bcb(1097,1971,fie,df);_.Hc=function ef(a){return Ck(this.a.d.vc(),a)};_.Kc=function ff(){return new mf(this.a)};_.Rc=function gf(){return this.a};_.Mc=function hf(a){var b;if(!Ck(this.a.d.vc(),a)){return false}b=BD(a,42);Tc(this.a.e,b.cd());return true};_.Nc=function jf(){return $j(this.a.d.vc().Nc(),new kf(this.a))};var jE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap/AsMapEntries',1097);bcb(1098,1,{},kf);_.Kb=function lf(a){return me(this.a,BD(a,42))};var iE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap/AsMapEntries/0methodref$wrapEntry$Type',1098);bcb(730,1,aie,mf);_.Nb=function nf(a){Rrb(this,a)};_.Pb=function pf(){var a;return a=BD(this.b.Pb(),42),this.a=BD(a.dd(),14),me(this.c,a)};_.Ob=function of(){return this.b.Ob()};_.Qb=function qf(){Vb(!!this.a);this.b.Qb();this.c.e.d-=this.a.gc();this.a.$b();this.a=null};var kE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap/AsMapIterator',730);bcb(532,1970,fie,rf);_.$b=function sf(){this.b.$b()};_.Hc=function tf(a){return this.b._b(a)};_.Jc=function uf(a){Qb(a);this.b.wc(new Xv(a))};_.dc=function vf(){return this.b.dc()};_.Kc=function wf(){return new Mv(this.b.vc().Kc())};_.Mc=function xf(a){if(this.b._b(a)){this.b.Bc(a);return true}return false};_.gc=function yf(){return this.b.gc()};var $G=mdb(Zhe,'Maps/KeySet',532);bcb(318,532,fie,zf);_.$b=function Af(){var a;ir((a=this.b.vc().Kc(),new Hf(this,a)))};_.Ic=function Bf(a){return this.b.ec().Ic(a)};_.Fb=function Cf(a){return this===a||pb(this.b.ec(),a)};_.Hb=function Df(){return tb(this.b.ec())};_.Kc=function Ef(){var a;return a=this.b.vc().Kc(),new Hf(this,a)};_.Mc=function Ff(a){var b,c;c=0;b=BD(this.b.Bc(a),14);if(b){c=b.gc();b.$b();this.a.d-=c}return c>0};_.Nc=function Gf(){return this.b.ec().Nc()};var oE=mdb(Zhe,'AbstractMapBasedMultimap/KeySet',318);bcb(731,1,aie,Hf);_.Nb=function If(a){Rrb(this,a)};_.Ob=function Jf(){return this.c.Ob()};_.Pb=function Kf(){this.a=BD(this.c.Pb(),42);return this.a.cd()};_.Qb=function Lf(){var a;Vb(!!this.a);a=BD(this.a.dd(),14);this.c.Qb();this.b.a.d-=a.gc();a.$b();this.a=null};var nE=mdb(Zhe,'AbstractMapBasedMultimap/KeySet/1',731);bcb(491,389,{83:1,161:1},Mf);_.bc=function Nf(){return this.Sc()};_.ec=function Pf(){return this.Tc()};_.Sc=function Of(){return new Yf(this.c,this.Uc())};_.Tc=function Qf(){var a;return a=this.b,!a?(this.b=this.Sc()):a};_.Uc=function Rf(){return BD(this.d,161)};var sE=mdb(Zhe,'AbstractMapBasedMultimap/SortedAsMap',491);bcb(542,491,gie,Sf);_.bc=function Tf(){return new $f(this.a,BD(BD(this.d,161),171))};_.Sc=function Uf(){return new $f(this.a,BD(BD(this.d,161),171))};_.ec=function Vf(){var a;return a=this.b,BD(!a?(this.b=new $f(this.a,BD(BD(this.d,161),171))):a,271)};_.Tc=function Wf(){var a;return a=this.b,BD(!a?(this.b=new $f(this.a,BD(BD(this.d,161),171))):a,271)};_.Uc=function Xf(){return BD(BD(this.d,161),171)};var pE=mdb(Zhe,'AbstractMapBasedMultimap/NavigableAsMap',542);bcb(490,318,hie,Yf);_.Nc=function Zf(){return this.b.ec().Nc()};var tE=mdb(Zhe,'AbstractMapBasedMultimap/SortedKeySet',490);bcb(388,490,iie,$f);var qE=mdb(Zhe,'AbstractMapBasedMultimap/NavigableKeySet',388);bcb(541,28,die,dg);_.Fc=function eg(a){var b,c;ag(this);c=this.d.dc();b=this.d.Fc(a);if(b){++this.f.d;c&&_f(this)}return b};_.Gc=function fg(a){var b,c,d;if(a.dc()){return false}d=(ag(this),this.d.gc());b=this.d.Gc(a);if(b){c=this.d.gc();this.f.d+=c-d;d==0&&_f(this)}return b};_.$b=function gg(){var a;a=(ag(this),this.d.gc());if(a==0){return}this.d.$b();this.f.d-=a;bg(this)};_.Hc=function hg(a){ag(this);return this.d.Hc(a)};_.Ic=function ig(a){ag(this);return this.d.Ic(a)};_.Fb=function jg(a){if(a===this){return true}ag(this);return pb(this.d,a)};_.Hb=function kg(){ag(this);return tb(this.d)};_.Kc=function lg(){ag(this);return new Gg(this)};_.Mc=function mg(a){var b;ag(this);b=this.d.Mc(a);if(b){--this.f.d;bg(this)}return b};_.gc=function ng(){return cg(this)};_.Nc=function og(){return ag(this),this.d.Nc()};_.Ib=function pg(){ag(this);return fcb(this.d)};var vE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedCollection',541);var yK=odb(bie,'List');bcb(728,541,{20:1,28:1,14:1,15:1},qg);_.ad=function zg(a){ktb(this,a)};_.Nc=function Ag(){return ag(this),this.d.Nc()};_.Vc=function rg(a,b){var c;ag(this);c=this.d.dc();BD(this.d,15).Vc(a,b);++this.a.d;c&&_f(this)};_.Wc=function sg(a,b){var c,d,e;if(b.dc()){return false}e=(ag(this),this.d.gc());c=BD(this.d,15).Wc(a,b);if(c){d=this.d.gc();this.a.d+=d-e;e==0&&_f(this)}return c};_.Xb=function tg(a){ag(this);return BD(this.d,15).Xb(a)};_.Xc=function ug(a){ag(this);return BD(this.d,15).Xc(a)};_.Yc=function vg(){ag(this);return new Mg(this)};_.Zc=function wg(a){ag(this);return new Ng(this,a)};_.$c=function xg(a){var b;ag(this);b=BD(this.d,15).$c(a);--this.a.d;bg(this);return b};_._c=function yg(a,b){ag(this);return BD(this.d,15)._c(a,b)};_.bd=function Bg(a,b){ag(this);return Vc(this.a,this.e,BD(this.d,15).bd(a,b),!this.b?this:this.b)};var xE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedList',728);bcb(1096,728,{20:1,28:1,14:1,15:1,54:1},Cg);var rE=mdb(Zhe,'AbstractMapBasedMultimap/RandomAccessWrappedList',1096);bcb(620,1,aie,Gg);_.Nb=function Ig(a){Rrb(this,a)};_.Ob=function Jg(){Fg(this);return this.b.Ob()};_.Pb=function Kg(){Fg(this);return this.b.Pb()};_.Qb=function Lg(){Eg(this)};var uE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedCollection/WrappedIterator',620);bcb(729,620,jie,Mg,Ng);_.Qb=function Tg(){Eg(this)};_.Rb=function Og(a){var b;b=cg(this.a)==0;(Fg(this),BD(this.b,125)).Rb(a);++this.a.a.d;b&&_f(this.a)};_.Sb=function Pg(){return (Fg(this),BD(this.b,125)).Sb()};_.Tb=function Qg(){return (Fg(this),BD(this.b,125)).Tb()};_.Ub=function Rg(){return (Fg(this),BD(this.b,125)).Ub()};_.Vb=function Sg(){return (Fg(this),BD(this.b,125)).Vb()};_.Wb=function Ug(a){(Fg(this),BD(this.b,125)).Wb(a)};var wE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedList/WrappedListIterator',729);bcb(727,541,hie,Vg);_.Nc=function Wg(){return ag(this),this.d.Nc()};var AE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedSortedSet',727);bcb(1095,727,iie,Xg);var yE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedNavigableSet',1095);bcb(1094,541,fie,Yg);_.Nc=function Zg(){return ag(this),this.d.Nc()};var zE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedSet',1094);bcb(1103,1,{},$g);_.Kb=function _g(a){return fd(BD(a,42))};var BE=mdb(Zhe,'AbstractMapBasedMultimap/lambda$1$Type',1103);bcb(1102,1,{},ah);_.Kb=function bh(a){return new Wo(this.a,a)};var CE=mdb(Zhe,'AbstractMapBasedMultimap/lambda$2$Type',1102);var CK=odb(bie,'Map/Entry');bcb(345,1,kie);_.Fb=function dh(a){var b;if(JD(a,42)){b=BD(a,42);return Hb(this.cd(),b.cd())&&Hb(this.dd(),b.dd())}return false};_.Hb=function eh(){var a,b;a=this.cd();b=this.dd();return (a==null?0:tb(a))^(b==null?0:tb(b))};_.ed=function fh(a){throw vbb(new bgb)};_.Ib=function gh(){return this.cd()+'='+this.dd()};var EE=mdb(Zhe,lie,345);bcb(1988,28,die);_.$b=function hh(){this.fd().$b()};_.Hc=function ih(a){var b;if(JD(a,42)){b=BD(a,42);return Cc(this.fd(),b.cd(),b.dd())}return false};_.Mc=function jh(a){var b;if(JD(a,42)){b=BD(a,42);return Gc(this.fd(),b.cd(),b.dd())}return false};_.gc=function kh(){return this.fd().d};var fH=mdb(Zhe,'Multimaps/Entries',1988);bcb(733,1988,die,lh);_.Kc=function mh(){return this.a.kc()};_.fd=function nh(){return this.a};_.Nc=function oh(){return this.a.lc()};var FE=mdb(Zhe,'AbstractMultimap/Entries',733);bcb(734,733,fie,ph);_.Nc=function sh(){return this.a.lc()};_.Fb=function qh(a){return Ax(this,a)};_.Hb=function rh(){return Bx(this)};var GE=mdb(Zhe,'AbstractMultimap/EntrySet',734);bcb(735,28,die,th);_.$b=function uh(){this.a.$b()};_.Hc=function vh(a){return Dc(this.a,a)};_.Kc=function wh(){return this.a.nc()};_.gc=function xh(){return this.a.d};_.Nc=function yh(){return this.a.oc()};var HE=mdb(Zhe,'AbstractMultimap/Values',735);bcb(1989,28,{835:1,20:1,28:1,14:1});_.Jc=function Gh(a){Qb(a);Ah(this).Jc(new Xw(a))};_.Nc=function Kh(){var a;return a=Ah(this).Nc(),Yj(a,new cx,64|a.qd()&1296,this.a.d)};_.Fc=function Ch(a){zh();return true};_.Gc=function Dh(a){return Qb(this),Qb(a),JD(a,543)?Zw(BD(a,835)):!a.dc()&&fr(this,a.Kc())};_.Hc=function Eh(a){var b;return b=BD(Hv(nd(this.a),a),14),(!b?0:b.gc())>0};_.Fb=function Fh(a){return $w(this,a)};_.Hb=function Hh(){return tb(Ah(this))};_.dc=function Ih(){return Ah(this).dc()};_.Mc=function Jh(a){return Bw(this,a,1)>0};_.Ib=function Lh(){return fcb(Ah(this))};var KE=mdb(Zhe,'AbstractMultiset',1989);bcb(1991,1970,fie);_.$b=function Mh(){Nc(this.a.a)};_.Hc=function Nh(a){var b,c;if(JD(a,492)){c=BD(a,416);if(BD(c.a.dd(),14).gc()<=0){return false}b=Aw(this.a,c.a.cd());return b==BD(c.a.dd(),14).gc()}return false};_.Mc=function Oh(a){var b,c,d,e;if(JD(a,492)){c=BD(a,416);b=c.a.cd();d=BD(c.a.dd(),14).gc();if(d!=0){e=this.a;return ax(e,b,d)}}return false};var pH=mdb(Zhe,'Multisets/EntrySet',1991);bcb(1109,1991,fie,Ph);_.Kc=function Qh(){return new Lw(fe(nd(this.a.a)).Kc())};_.gc=function Rh(){return nd(this.a.a).gc()};var JE=mdb(Zhe,'AbstractMultiset/EntrySet',1109);bcb(619,726,_he);_.hc=function Uh(){return this.gd()};_.jc=function Vh(){return this.hd()};_.cc=function Yh(a){return this.jd(a)};_.fc=function $h(a){return this.kd(a)};_.Zb=function Th(){var a;return a=this.f,!a?(this.f=this.ac()):a};_.hd=function Wh(){return mmb(),mmb(),lmb};_.Fb=function Xh(a){return hw(this,a)};_.jd=function Zh(a){return BD(Qc(this,a),21)};_.kd=function _h(a){return BD(Sc(this,a),21)};_.mc=function ai(a){return mmb(),new zob(BD(a,21))};_.pc=function bi(a,b){return new Yg(this,a,BD(b,21))};var LE=mdb(Zhe,'AbstractSetMultimap',619);bcb(1657,619,_he);_.hc=function ei(){return new Hxb(this.b)};_.gd=function fi(){return new Hxb(this.b)};_.jc=function gi(){return Ix(new Hxb(this.b))};_.hd=function hi(){return Ix(new Hxb(this.b))};_.cc=function ii(a){return BD(BD(Qc(this,a),21),84)};_.jd=function ji(a){return BD(BD(Qc(this,a),21),84)};_.fc=function ki(a){return BD(BD(Sc(this,a),21),84)};_.kd=function li(a){return BD(BD(Sc(this,a),21),84)};_.mc=function mi(a){return JD(a,271)?Ix(BD(a,271)):(mmb(),new Zob(BD(a,84)))};_.Zb=function di(){var a;return a=this.f,!a?(this.f=JD(this.c,171)?new Sf(this,BD(this.c,171)):JD(this.c,161)?new Mf(this,BD(this.c,161)):new ne(this,this.c)):a};_.pc=function ni(a,b){return JD(b,271)?new Xg(this,a,BD(b,271)):new Vg(this,a,BD(b,84))};var NE=mdb(Zhe,'AbstractSortedSetMultimap',1657);bcb(1658,1657,_he);_.Zb=function pi(){var a;return a=this.f,BD(BD(!a?(this.f=JD(this.c,171)?new Sf(this,BD(this.c,171)):JD(this.c,161)?new Mf(this,BD(this.c,161)):new ne(this,this.c)):a,161),171)};_.ec=function ri(){var a;return a=this.i,BD(BD(!a?(this.i=JD(this.c,171)?new $f(this,BD(this.c,171)):JD(this.c,161)?new Yf(this,BD(this.c,161)):new zf(this,this.c)):a,84),271)};_.bc=function qi(){return JD(this.c,171)?new $f(this,BD(this.c,171)):JD(this.c,161)?new Yf(this,BD(this.c,161)):new zf(this,this.c)};var ME=mdb(Zhe,'AbstractSortedKeySortedSetMultimap',1658);bcb(2010,1,{1947:1});_.Fb=function si(a){return zy(this,a)};_.Hb=function ti(){var a;return pmb((a=this.g,!a?(this.g=new vi(this)):a))};_.Ib=function ui(){var a;return Md((a=this.f,!a?(this.f=new Rj(this)):a))};var QE=mdb(Zhe,'AbstractTable',2010);bcb(665,eie,fie,vi);_.$b=function wi(){Pi()};_.Hc=function xi(a){var b,c;if(JD(a,468)){b=BD(a,682);c=BD(Hv(Vi(this.a),Em(b.c.e,b.b)),83);return !!c&&Ck(c.vc(),new Wo(Em(b.c.c,b.a),Mi(b.c,b.b,b.a)))}return false};_.Kc=function yi(){return Ni(this.a)};_.Mc=function zi(a){var b,c;if(JD(a,468)){b=BD(a,682);c=BD(Hv(Vi(this.a),Em(b.c.e,b.b)),83);return !!c&&Dk(c.vc(),new Wo(Em(b.c.c,b.a),Mi(b.c,b.b,b.a)))}return false};_.gc=function Ai(){return Xi(this.a)};_.Nc=function Bi(){return Oi(this.a)};var OE=mdb(Zhe,'AbstractTable/CellSet',665);bcb(1928,28,die,Ci);_.$b=function Di(){Pi()};_.Hc=function Ei(a){return Qi(this.a,a)};_.Kc=function Fi(){return Zi(this.a)};_.gc=function Gi(){return Xi(this.a)};_.Nc=function Hi(){return $i(this.a)};var PE=mdb(Zhe,'AbstractTable/Values',1928);bcb(1632,1631,_he);var RE=mdb(Zhe,'ArrayListMultimapGwtSerializationDependencies',1632);bcb(513,1632,_he,Ji,Ki);_.hc=function Li(){return new Skb(this.a)};_.a=0;var SE=mdb(Zhe,'ArrayListMultimap',513);bcb(664,2010,{664:1,1947:1,3:1},_i);var cF=mdb(Zhe,'ArrayTable',664);bcb(1924,386,$he,aj);_.Xb=function bj(a){return new hj(this.a,a)};var TE=mdb(Zhe,'ArrayTable/1',1924);bcb(1925,1,{},cj);_.ld=function dj(a){return new hj(this.a,a)};var UE=mdb(Zhe,'ArrayTable/1methodref$getCell$Type',1925);bcb(2011,1,{682:1});_.Fb=function ej(a){var b;if(a===this){return true}if(JD(a,468)){b=BD(a,682);return Hb(Em(this.c.e,this.b),Em(b.c.e,b.b))&&Hb(Em(this.c.c,this.a),Em(b.c.c,b.a))&&Hb(Mi(this.c,this.b,this.a),Mi(b.c,b.b,b.a))}return false};_.Hb=function fj(){return Hlb(OC(GC(SI,1),Uhe,1,5,[Em(this.c.e,this.b),Em(this.c.c,this.a),Mi(this.c,this.b,this.a)]))};_.Ib=function gj(){return '('+Em(this.c.e,this.b)+','+Em(this.c.c,this.a)+')='+Mi(this.c,this.b,this.a)};var JH=mdb(Zhe,'Tables/AbstractCell',2011);bcb(468,2011,{468:1,682:1},hj);_.a=0;_.b=0;_.d=0;var VE=mdb(Zhe,'ArrayTable/2',468);bcb(1927,1,{},ij);_.ld=function jj(a){return Ti(this.a,a)};var WE=mdb(Zhe,'ArrayTable/2methodref$getValue$Type',1927);bcb(1926,386,$he,kj);_.Xb=function lj(a){return Ti(this.a,a)};var XE=mdb(Zhe,'ArrayTable/3',1926);bcb(1979,1967,cie);_.$b=function nj(){ir(this.kc())};_.vc=function oj(){return new Sv(this)};_.lc=function pj(){return new Mub(this.kc(),this.gc())};var YG=mdb(Zhe,'Maps/IteratorBasedAbstractMap',1979);bcb(828,1979,cie);_.$b=function tj(){throw vbb(new bgb)};_._b=function uj(a){return sn(this.c,a)};_.kc=function vj(){return new Jj(this,this.c.b.c.gc())};_.lc=function wj(){return Zj(this.c.b.c.gc(),16,new Dj(this))};_.xc=function xj(a){var b;b=BD(tn(this.c,a),19);return !b?null:this.nd(b.a)};_.dc=function yj(){return this.c.b.c.dc()};_.ec=function zj(){return Xm(this.c)};_.zc=function Aj(a,b){var c;c=BD(tn(this.c,a),19);if(!c){throw vbb(new Wdb(this.md()+' '+a+' not in '+Xm(this.c)))}return this.od(c.a,b)};_.Bc=function Bj(a){throw vbb(new bgb)};_.gc=function Cj(){return this.c.b.c.gc()};var _E=mdb(Zhe,'ArrayTable/ArrayMap',828);bcb(1923,1,{},Dj);_.ld=function Ej(a){return qj(this.a,a)};var YE=mdb(Zhe,'ArrayTable/ArrayMap/0methodref$getEntry$Type',1923);bcb(1921,345,kie,Fj);_.cd=function Gj(){return rj(this.a,this.b)};_.dd=function Hj(){return this.a.nd(this.b)};_.ed=function Ij(a){return this.a.od(this.b,a)};_.b=0;var ZE=mdb(Zhe,'ArrayTable/ArrayMap/1',1921);bcb(1922,386,$he,Jj);_.Xb=function Kj(a){return qj(this.a,a)};var $E=mdb(Zhe,'ArrayTable/ArrayMap/2',1922);bcb(1920,828,cie,Lj);_.md=function Mj(){return 'Column'};_.nd=function Nj(a){return Mi(this.b,this.a,a)};_.od=function Oj(a,b){return Wi(this.b,this.a,a,b)};_.a=0;var bF=mdb(Zhe,'ArrayTable/Row',1920);bcb(829,828,cie,Rj);_.nd=function Tj(a){return new Lj(this.a,a)};_.zc=function Uj(a,b){return BD(b,83),Pj()};_.od=function Vj(a,b){return BD(b,83),Qj()};_.md=function Sj(){return 'Row'};var aF=mdb(Zhe,'ArrayTable/RowMap',829);bcb(1120,1,pie,_j);_.qd=function ak(){return this.a.qd()&-262};_.rd=function bk(){return this.a.rd()};_.Nb=function ck(a){this.a.Nb(new gk(a,this.b))};_.sd=function dk(a){return this.a.sd(new ek(a,this.b))};var lF=mdb(Zhe,'CollectSpliterators/1',1120);bcb(1121,1,qie,ek);_.td=function fk(a){this.a.td(this.b.Kb(a))};var dF=mdb(Zhe,'CollectSpliterators/1/lambda$0$Type',1121);bcb(1122,1,qie,gk);_.td=function hk(a){this.a.td(this.b.Kb(a))};var eF=mdb(Zhe,'CollectSpliterators/1/lambda$1$Type',1122);bcb(1123,1,pie,jk);_.qd=function kk(){return this.a};_.rd=function lk(){!!this.d&&(this.b=Deb(this.b,this.d.rd()));return Deb(this.b,0)};_.Nb=function mk(a){if(this.d){this.d.Nb(a);this.d=null}this.c.Nb(new rk(this.e,a));this.b=0};_.sd=function ok(a){while(true){if(!!this.d&&this.d.sd(a)){Kbb(this.b,rie)&&(this.b=Qbb(this.b,1));return true}else{this.d=null}if(!this.c.sd(new pk(this,this.e))){return false}}};_.a=0;_.b=0;var hF=mdb(Zhe,'CollectSpliterators/1FlatMapSpliterator',1123);bcb(1124,1,qie,pk);_.td=function qk(a){ik(this.a,this.b,a)};var fF=mdb(Zhe,'CollectSpliterators/1FlatMapSpliterator/lambda$0$Type',1124);bcb(1125,1,qie,rk);_.td=function sk(a){nk(this.b,this.a,a)};var gF=mdb(Zhe,'CollectSpliterators/1FlatMapSpliterator/lambda$1$Type',1125);bcb(1117,1,pie,tk);_.qd=function uk(){return 16464|this.b};_.rd=function vk(){return this.a.rd()};_.Nb=function wk(a){this.a.xe(new Ak(a,this.c))};_.sd=function xk(a){return this.a.ye(new yk(a,this.c))};_.b=0;var kF=mdb(Zhe,'CollectSpliterators/1WithCharacteristics',1117);bcb(1118,1,sie,yk);_.ud=function zk(a){this.a.td(this.b.ld(a))};var iF=mdb(Zhe,'CollectSpliterators/1WithCharacteristics/lambda$0$Type',1118);bcb(1119,1,sie,Ak);_.ud=function Bk(a){this.a.td(this.b.ld(a))};var jF=mdb(Zhe,'CollectSpliterators/1WithCharacteristics/lambda$1$Type',1119);bcb(245,1,tie);_.wd=function Hk(a){return this.vd(BD(a,245))};_.vd=function Gk(a){var b;if(a==(_k(),$k)){return 1}if(a==(Lk(),Kk)){return -1}b=(ex(),Fcb(this.a,a.a));if(b!=0){return b}return JD(this,519)==JD(a,519)?0:JD(this,519)?1:-1};_.zd=function Ik(){return this.a};_.Fb=function Jk(a){return Ek(this,a)};var qF=mdb(Zhe,'Cut',245);bcb(1761,245,tie,Mk);_.vd=function Nk(a){return a==this?0:1};_.xd=function Ok(a){throw vbb(new xcb)};_.yd=function Pk(a){a.a+='+\u221E)'};_.zd=function Qk(){throw vbb(new Zdb(uie))};_.Hb=function Rk(){return Zfb(),kCb(this)};_.Ad=function Sk(a){return false};_.Ib=function Tk(){return '+\u221E'};var Kk;var mF=mdb(Zhe,'Cut/AboveAll',1761);bcb(519,245,{245:1,519:1,3:1,35:1},Uk);_.xd=function Vk(a){Pfb((a.a+='(',a),this.a)};_.yd=function Wk(a){Kfb(Pfb(a,this.a),93)};_.Hb=function Xk(){return ~tb(this.a)};_.Ad=function Yk(a){return ex(),Fcb(this.a,a)<0};_.Ib=function Zk(){return '/'+this.a+'\\'};var nF=mdb(Zhe,'Cut/AboveValue',519);bcb(1760,245,tie,al);_.vd=function bl(a){return a==this?0:-1};_.xd=function cl(a){a.a+='(-\u221E'};_.yd=function dl(a){throw vbb(new xcb)};_.zd=function el(){throw vbb(new Zdb(uie))};_.Hb=function fl(){return Zfb(),kCb(this)};_.Ad=function gl(a){return true};_.Ib=function hl(){return '-\u221E'};var $k;var oF=mdb(Zhe,'Cut/BelowAll',1760);bcb(1762,245,tie,il);_.xd=function jl(a){Pfb((a.a+='[',a),this.a)};_.yd=function kl(a){Kfb(Pfb(a,this.a),41)};_.Hb=function ll(){return tb(this.a)};_.Ad=function ml(a){return ex(),Fcb(this.a,a)<=0};_.Ib=function nl(){return '\\'+this.a+'/'};var pF=mdb(Zhe,'Cut/BelowValue',1762);bcb(537,1,vie);_.Jc=function ql(a){reb(this,a)};_.Ib=function rl(){return tr(BD(Rb(this,'use Optional.orNull() instead of Optional.or(null)'),20).Kc())};var uF=mdb(Zhe,'FluentIterable',537);bcb(433,537,vie,sl);_.Kc=function tl(){return new Sr(ur(this.a.Kc(),new Sq))};var rF=mdb(Zhe,'FluentIterable/2',433);bcb(1046,537,vie,vl);_.Kc=function wl(){return ul(this)};var tF=mdb(Zhe,'FluentIterable/3',1046);bcb(708,386,$he,xl);_.Xb=function yl(a){return this.a[a].Kc()};var sF=mdb(Zhe,'FluentIterable/3/1',708);bcb(1972,1,{});_.Ib=function zl(){return fcb(this.Bd().b)};var BF=mdb(Zhe,'ForwardingObject',1972);bcb(1973,1972,wie);_.Bd=function Fl(){return this.Cd()};_.Jc=function Gl(a){reb(this,a)};_.Lc=function Jl(){return this.Oc()};_.Nc=function Ml(){return new Kub(this,0)};_.Oc=function Nl(){return new YAb(null,this.Nc())};_.Fc=function Al(a){return this.Cd(),enb()};_.Gc=function Bl(a){return this.Cd(),fnb()};_.$b=function Cl(){this.Cd(),gnb()};_.Hc=function Dl(a){return this.Cd().Hc(a)};_.Ic=function El(a){return this.Cd().Ic(a)};_.dc=function Hl(){return this.Cd().b.dc()};_.Kc=function Il(){return this.Cd().Kc()};_.Mc=function Kl(a){return this.Cd(),jnb()};_.gc=function Ll(){return this.Cd().b.gc()};_.Pc=function Ol(){return this.Cd().Pc()};_.Qc=function Pl(a){return this.Cd().Qc(a)};var vF=mdb(Zhe,'ForwardingCollection',1973);bcb(1980,28,xie);_.Kc=function Xl(){return this.Ed()};_.Fc=function Sl(a){throw vbb(new bgb)};_.Gc=function Tl(a){throw vbb(new bgb)};_.$b=function Ul(){throw vbb(new bgb)};_.Hc=function Vl(a){return a!=null&&ze(this,a,false)};_.Dd=function Wl(){switch(this.gc()){case 0:return im(),im(),hm;case 1:return im(),new my(Qb(this.Ed().Pb()));default:return new px(this,this.Pc());}};_.Mc=function Yl(a){throw vbb(new bgb)};var WF=mdb(Zhe,'ImmutableCollection',1980);bcb(712,1980,xie,Zl);_.Kc=function cm(){return vr(this.a.Kc())};_.Hc=function $l(a){return a!=null&&this.a.Hc(a)};_.Ic=function _l(a){return this.a.Ic(a)};_.dc=function am(){return this.a.dc()};_.Ed=function bm(){return vr(this.a.Kc())};_.gc=function dm(){return this.a.gc()};_.Pc=function em(){return this.a.Pc()};_.Qc=function fm(a){return this.a.Qc(a)};_.Ib=function gm(){return fcb(this.a)};var wF=mdb(Zhe,'ForwardingImmutableCollection',712);bcb(152,1980,yie);_.Kc=function sm(){return this.Ed()};_.Yc=function tm(){return this.Fd(0)};_.Zc=function vm(a){return this.Fd(a)};_.ad=function zm(a){ktb(this,a)};_.Nc=function Am(){return new Kub(this,16)};_.bd=function Cm(a,b){return this.Gd(a,b)};_.Vc=function lm(a,b){throw vbb(new bgb)};_.Wc=function mm(a,b){throw vbb(new bgb)};_.Fb=function om(a){return Ju(this,a)};_.Hb=function pm(){return Ku(this)};_.Xc=function qm(a){return a==null?-1:Lu(this,a)};_.Ed=function rm(){return this.Fd(0)};_.Fd=function um(a){return jm(this,a)};_.$c=function xm(a){throw vbb(new bgb)};_._c=function ym(a,b){throw vbb(new bgb)};_.Gd=function Bm(a,b){var c;return Dm((c=new $u(this),new Jib(c,a,b)))};var hm;var _F=mdb(Zhe,'ImmutableList',152);bcb(2006,152,yie);_.Kc=function Nm(){return vr(this.Hd().Kc())};_.bd=function Qm(a,b){return Dm(this.Hd().bd(a,b))};_.Hc=function Fm(a){return a!=null&&this.Hd().Hc(a)};_.Ic=function Gm(a){return this.Hd().Ic(a)};_.Fb=function Hm(a){return pb(this.Hd(),a)};_.Xb=function Im(a){return Em(this,a)};_.Hb=function Jm(){return tb(this.Hd())};_.Xc=function Km(a){return this.Hd().Xc(a)};_.dc=function Lm(){return this.Hd().dc()};_.Ed=function Mm(){return vr(this.Hd().Kc())};_.gc=function Om(){return this.Hd().gc()};_.Gd=function Pm(a,b){return Dm(this.Hd().bd(a,b))};_.Pc=function Rm(){return this.Hd().Qc(KC(SI,Uhe,1,this.Hd().gc(),5,1))};_.Qc=function Sm(a){return this.Hd().Qc(a)};_.Ib=function Tm(){return fcb(this.Hd())};var xF=mdb(Zhe,'ForwardingImmutableList',2006);bcb(714,1,Aie);_.vc=function cn(){return Wm(this)};_.wc=function en(a){stb(this,a)};_.ec=function jn(){return Xm(this)};_.yc=function kn(a,b,c){return ttb(this,a,b,c)};_.Cc=function rn(){return this.Ld()};_.$b=function Zm(){throw vbb(new bgb)};_._b=function $m(a){return this.xc(a)!=null};_.uc=function _m(a){return this.Ld().Hc(a)};_.Jd=function an(){return new jq(this)};_.Kd=function bn(){return new sq(this)};_.Fb=function dn(a){return Dv(this,a)};_.Hb=function gn(){return Wm(this).Hb()};_.dc=function hn(){return this.gc()==0};_.zc=function nn(a,b){return Ym()};_.Bc=function on(a){throw vbb(new bgb)};_.Ib=function pn(){return Jv(this)};_.Ld=function qn(){if(this.e){return this.e}return this.e=this.Kd()};_.c=null;_.d=null;_.e=null;var Um;var iG=mdb(Zhe,'ImmutableMap',714);bcb(715,714,Aie);_._b=function vn(a){return sn(this,a)};_.uc=function wn(a){return dob(this.b,a)};_.Id=function xn(){return Vn(new Ln(this))};_.Jd=function yn(){return Vn(gob(this.b))};_.Kd=function zn(){return Ql(),new Zl(hob(this.b))};_.Fb=function An(a){return fob(this.b,a)};_.xc=function Bn(a){return tn(this,a)};_.Hb=function Cn(){return tb(this.b.c)};_.dc=function Dn(){return this.b.c.dc()};_.gc=function En(){return this.b.c.gc()};_.Ib=function Fn(){return fcb(this.b.c)};var zF=mdb(Zhe,'ForwardingImmutableMap',715);bcb(1974,1973,Bie);_.Bd=function Gn(){return this.Md()};_.Cd=function Hn(){return this.Md()};_.Nc=function Kn(){return new Kub(this,1)};_.Fb=function In(a){return a===this||this.Md().Fb(a)};_.Hb=function Jn(){return this.Md().Hb()};var CF=mdb(Zhe,'ForwardingSet',1974);bcb(1069,1974,Bie,Ln);_.Bd=function Nn(){return eob(this.a.b)};_.Cd=function On(){return eob(this.a.b)};_.Hc=function Mn(b){if(JD(b,42)&&BD(b,42).cd()==null){return false}try{return Dob(eob(this.a.b),b)}catch(a){a=ubb(a);if(JD(a,205)){return false}else throw vbb(a)}};_.Md=function Pn(){return eob(this.a.b)};_.Qc=function Qn(a){var b;b=Eob(eob(this.a.b),a);eob(this.a.b).b.gc()=0?'+':'')+(c/60|0);b=kB($wnd.Math.abs(c)%60);return (Dpb(),Bpb)[this.q.getDay()]+' '+Cpb[this.q.getMonth()]+' '+kB(this.q.getDate())+' '+kB(this.q.getHours())+':'+kB(this.q.getMinutes())+':'+kB(this.q.getSeconds())+' GMT'+a+b+' '+this.q.getFullYear()};var $J=mdb(bie,'Date',199);bcb(1915,199,Cje,nB);_.a=false;_.b=0;_.c=0;_.d=0;_.e=0;_.f=0;_.g=false;_.i=0;_.j=0;_.k=0;_.n=0;_.o=0;_.p=0;var eI=mdb('com.google.gwt.i18n.shared.impl','DateRecord',1915);bcb(1966,1,{});_.fe=function oB(){return null};_.ge=function pB(){return null};_.he=function qB(){return null};_.ie=function rB(){return null};_.je=function sB(){return null};var nI=mdb(Dje,'JSONValue',1966);bcb(216,1966,{216:1},wB,xB);_.Fb=function yB(a){if(!JD(a,216)){return false}return qz(this.a,BD(a,216).a)};_.ee=function zB(){return DB};_.Hb=function AB(){return rz(this.a)};_.fe=function BB(){return this};_.Ib=function CB(){var a,b,c;c=new Wfb('[');for(b=0,a=this.a.length;b0&&(c.a+=',',c);Pfb(c,tB(this,b))}c.a+=']';return c.a};var fI=mdb(Dje,'JSONArray',216);bcb(483,1966,{483:1},HB);_.ee=function IB(){return LB};_.ge=function JB(){return this};_.Ib=function KB(){return Bcb(),''+this.a};_.a=false;var EB,FB;var gI=mdb(Dje,'JSONBoolean',483);bcb(985,60,Tie,MB);var hI=mdb(Dje,'JSONException',985);bcb(1023,1966,{},PB);_.ee=function QB(){return SB};_.Ib=function RB(){return Xhe};var NB;var iI=mdb(Dje,'JSONNull',1023);bcb(258,1966,{258:1},TB);_.Fb=function UB(a){if(!JD(a,258)){return false}return this.a==BD(a,258).a};_.ee=function VB(){return ZB};_.Hb=function WB(){return Hdb(this.a)};_.he=function XB(){return this};_.Ib=function YB(){return this.a+''};_.a=0;var jI=mdb(Dje,'JSONNumber',258);bcb(183,1966,{183:1},eC,fC);_.Fb=function gC(a){if(!JD(a,183)){return false}return qz(this.a,BD(a,183).a)};_.ee=function hC(){return lC};_.Hb=function iC(){return rz(this.a)};_.ie=function jC(){return this};_.Ib=function kC(){var a,b,c,d,e,f,g;g=new Wfb('{');a=true;f=$B(this,KC(ZI,nie,2,0,6,1));for(c=f,d=0,e=c.length;d=0?':'+this.c:'')+')'};_.c=0;var VI=mdb(Phe,'StackTraceElement',310);zD={3:1,475:1,35:1,2:1};var ZI=mdb(Phe,Vie,2);bcb(107,418,{475:1},Hfb,Ifb,Jfb);var WI=mdb(Phe,'StringBuffer',107);bcb(100,418,{475:1},Ufb,Vfb,Wfb);var XI=mdb(Phe,'StringBuilder',100);bcb(687,73,Mje,Xfb);var YI=mdb(Phe,'StringIndexOutOfBoundsException',687);bcb(2043,1,{});var Yfb;bcb(844,1,{},_fb);_.Kb=function agb(a){return BD(a,78).e};var $I=mdb(Phe,'Throwable/lambda$0$Type',844);bcb(41,60,{3:1,102:1,60:1,78:1,41:1},bgb,cgb);var aJ=mdb(Phe,'UnsupportedOperationException',41);bcb(240,236,{3:1,35:1,236:1,240:1},sgb,tgb);_.wd=function wgb(a){return mgb(this,BD(a,240))};_.ke=function xgb(){return Hcb(rgb(this))};_.Fb=function ygb(a){var b;if(this===a){return true}if(JD(a,240)){b=BD(a,240);return this.e==b.e&&mgb(this,b)==0}return false};_.Hb=function zgb(){var a;if(this.b!=0){return this.b}if(this.a<54){a=Cbb(this.f);this.b=Tbb(xbb(a,-1));this.b=33*this.b+Tbb(xbb(Obb(a,32),-1));this.b=17*this.b+QD(this.e);return this.b}this.b=17*Ngb(this.c)+QD(this.e);return this.b};_.Ib=function Agb(){return rgb(this)};_.a=0;_.b=0;_.d=0;_.e=0;_.f=0;var dgb,egb,fgb,ggb,hgb,igb,jgb,kgb;var bJ=mdb('java.math','BigDecimal',240);bcb(91,236,{3:1,35:1,236:1,91:1},Tgb,Ugb,Vgb,Wgb,Xgb,Ygb);_.wd=function $gb(a){return Igb(this,BD(a,91))};_.ke=function _gb(){return Hcb(shb(this,0))};_.Fb=function ahb(a){return Kgb(this,a)};_.Hb=function chb(){return Ngb(this)};_.Ib=function ehb(){return shb(this,0)};_.b=-2;_.c=0;_.d=0;_.e=0;var Bgb,Cgb,Dgb,Egb,Fgb,Ggb;var cJ=mdb('java.math','BigInteger',91);var nhb,ohb;var Bhb,Chb;bcb(488,1967,cie);_.$b=function Xhb(){Uhb(this)};_._b=function Yhb(a){return Mhb(this,a)};_.uc=function Zhb(a){return Nhb(this,a,this.g)||Nhb(this,a,this.f)};_.vc=function $hb(){return new eib(this)};_.xc=function _hb(a){return Ohb(this,a)};_.zc=function aib(a,b){return Rhb(this,a,b)};_.Bc=function bib(a){return Thb(this,a)};_.gc=function cib(){return Vhb(this)};var gJ=mdb(bie,'AbstractHashMap',488);bcb(261,eie,fie,eib);_.$b=function fib(){this.a.$b()};_.Hc=function gib(a){return dib(this,a)};_.Kc=function hib(){return new nib(this.a)};_.Mc=function iib(a){var b;if(dib(this,a)){b=BD(a,42).cd();this.a.Bc(b);return true}return false};_.gc=function jib(){return this.a.gc()};var fJ=mdb(bie,'AbstractHashMap/EntrySet',261);bcb(262,1,aie,nib);_.Nb=function oib(a){Rrb(this,a)};_.Pb=function qib(){return lib(this)};_.Ob=function pib(){return this.b};_.Qb=function rib(){mib(this)};_.b=false;var eJ=mdb(bie,'AbstractHashMap/EntrySetIterator',262);bcb(417,1,aie,vib);_.Nb=function wib(a){Rrb(this,a)};_.Ob=function xib(){return sib(this)};_.Pb=function yib(){return tib(this)};_.Qb=function zib(){uib(this)};_.b=0;_.c=-1;var hJ=mdb(bie,'AbstractList/IteratorImpl',417);bcb(96,417,jie,Bib);_.Qb=function Hib(){uib(this)};_.Rb=function Cib(a){Aib(this,a)};_.Sb=function Dib(){return this.b>0};_.Tb=function Eib(){return this.b};_.Ub=function Fib(){return sCb(this.b>0),this.a.Xb(this.c=--this.b)};_.Vb=function Gib(){return this.b-1};_.Wb=function Iib(a){yCb(this.c!=-1);this.a._c(this.c,a)};var iJ=mdb(bie,'AbstractList/ListIteratorImpl',96);bcb(219,52,Lie,Jib);_.Vc=function Kib(a,b){wCb(a,this.b);this.c.Vc(this.a+a,b);++this.b};_.Xb=function Lib(a){tCb(a,this.b);return this.c.Xb(this.a+a)};_.$c=function Mib(a){var b;tCb(a,this.b);b=this.c.$c(this.a+a);--this.b;return b};_._c=function Nib(a,b){tCb(a,this.b);return this.c._c(this.a+a,b)};_.gc=function Oib(){return this.b};_.a=0;_.b=0;var jJ=mdb(bie,'AbstractList/SubList',219);bcb(384,eie,fie,Pib);_.$b=function Qib(){this.a.$b()};_.Hc=function Rib(a){return this.a._b(a)};_.Kc=function Sib(){var a;return a=this.a.vc().Kc(),new Vib(a)};_.Mc=function Tib(a){if(this.a._b(a)){this.a.Bc(a);return true}return false};_.gc=function Uib(){return this.a.gc()};var mJ=mdb(bie,'AbstractMap/1',384);bcb(691,1,aie,Vib);_.Nb=function Wib(a){Rrb(this,a)};_.Ob=function Xib(){return this.a.Ob()};_.Pb=function Yib(){var a;return a=BD(this.a.Pb(),42),a.cd()};_.Qb=function Zib(){this.a.Qb()};var lJ=mdb(bie,'AbstractMap/1/1',691);bcb(226,28,die,$ib);_.$b=function _ib(){this.a.$b()};_.Hc=function ajb(a){return this.a.uc(a)};_.Kc=function bjb(){var a;return a=this.a.vc().Kc(),new djb(a)};_.gc=function cjb(){return this.a.gc()};var oJ=mdb(bie,'AbstractMap/2',226);bcb(294,1,aie,djb);_.Nb=function ejb(a){Rrb(this,a)};_.Ob=function fjb(){return this.a.Ob()};_.Pb=function gjb(){var a;return a=BD(this.a.Pb(),42),a.dd()};_.Qb=function hjb(){this.a.Qb()};var nJ=mdb(bie,'AbstractMap/2/1',294);bcb(484,1,{484:1,42:1});_.Fb=function jjb(a){var b;if(!JD(a,42)){return false}b=BD(a,42);return wtb(this.d,b.cd())&&wtb(this.e,b.dd())};_.cd=function kjb(){return this.d};_.dd=function ljb(){return this.e};_.Hb=function mjb(){return xtb(this.d)^xtb(this.e)};_.ed=function njb(a){return ijb(this,a)};_.Ib=function ojb(){return this.d+'='+this.e};var pJ=mdb(bie,'AbstractMap/AbstractEntry',484);bcb(383,484,{484:1,383:1,42:1},pjb);var qJ=mdb(bie,'AbstractMap/SimpleEntry',383);bcb(1984,1,_je);_.Fb=function qjb(a){var b;if(!JD(a,42)){return false}b=BD(a,42);return wtb(this.cd(),b.cd())&&wtb(this.dd(),b.dd())};_.Hb=function rjb(){return xtb(this.cd())^xtb(this.dd())};_.Ib=function sjb(){return this.cd()+'='+this.dd()};var rJ=mdb(bie,lie,1984);bcb(1992,1967,gie);_.tc=function vjb(a){return tjb(this,a)};_._b=function wjb(a){return ujb(this,a)};_.vc=function xjb(){return new Bjb(this)};_.xc=function yjb(a){var b;b=a;return Wd(Awb(this,b))};_.ec=function Ajb(){return new Gjb(this)};var wJ=mdb(bie,'AbstractNavigableMap',1992);bcb(739,eie,fie,Bjb);_.Hc=function Cjb(a){return JD(a,42)&&tjb(this.b,BD(a,42))};_.Kc=function Djb(){return new Ywb(this.b)};_.Mc=function Ejb(a){var b;if(JD(a,42)){b=BD(a,42);return Kwb(this.b,b)}return false};_.gc=function Fjb(){return this.b.c};var tJ=mdb(bie,'AbstractNavigableMap/EntrySet',739);bcb(493,eie,iie,Gjb);_.Nc=function Mjb(){return new Rub(this)};_.$b=function Hjb(){zwb(this.a)};_.Hc=function Ijb(a){return ujb(this.a,a)};_.Kc=function Jjb(){var a;return a=new Ywb((new cxb(this.a)).b),new Njb(a)};_.Mc=function Kjb(a){if(ujb(this.a,a)){Jwb(this.a,a);return true}return false};_.gc=function Ljb(){return this.a.c};var vJ=mdb(bie,'AbstractNavigableMap/NavigableKeySet',493);bcb(494,1,aie,Njb);_.Nb=function Ojb(a){Rrb(this,a)};_.Ob=function Pjb(){return sib(this.a.a)};_.Pb=function Qjb(){var a;return a=Wwb(this.a),a.cd()};_.Qb=function Rjb(){Xwb(this.a)};var uJ=mdb(bie,'AbstractNavigableMap/NavigableKeySet/1',494);bcb(2004,28,die);_.Fc=function Sjb(a){return zCb(cub(this,a)),true};_.Gc=function Tjb(a){uCb(a);mCb(a!=this,"Can't add a queue to itself");return ye(this,a)};_.$b=function Ujb(){while(dub(this)!=null);};var xJ=mdb(bie,'AbstractQueue',2004);bcb(302,28,{4:1,20:1,28:1,14:1},jkb,kkb);_.Fc=function lkb(a){return Xjb(this,a),true};_.$b=function nkb(){Yjb(this)};_.Hc=function okb(a){return Zjb(new xkb(this),a)};_.dc=function pkb(){return akb(this)};_.Kc=function qkb(){return new xkb(this)};_.Mc=function rkb(a){return dkb(new xkb(this),a)};_.gc=function skb(){return this.c-this.b&this.a.length-1};_.Nc=function tkb(){return new Kub(this,272)};_.Qc=function ukb(a){var b;b=this.c-this.b&this.a.length-1;a.lengthb&&NC(a,b,null);return a};_.b=0;_.c=0;var BJ=mdb(bie,'ArrayDeque',302);bcb(446,1,aie,xkb);_.Nb=function ykb(a){Rrb(this,a)};_.Ob=function zkb(){return this.a!=this.b};_.Pb=function Akb(){return vkb(this)};_.Qb=function Bkb(){wkb(this)};_.a=0;_.b=0;_.c=-1;var AJ=mdb(bie,'ArrayDeque/IteratorImpl',446);bcb(12,52,ake,Rkb,Skb,Tkb);_.Vc=function Ukb(a,b){Dkb(this,a,b)};_.Fc=function Vkb(a){return Ekb(this,a)};_.Wc=function Wkb(a,b){return Fkb(this,a,b)};_.Gc=function Xkb(a){return Gkb(this,a)};_.$b=function Ykb(){this.c=KC(SI,Uhe,1,0,5,1)};_.Hc=function Zkb(a){return Jkb(this,a,0)!=-1};_.Jc=function $kb(a){Hkb(this,a)};_.Xb=function _kb(a){return Ikb(this,a)};_.Xc=function alb(a){return Jkb(this,a,0)};_.dc=function blb(){return this.c.length==0};_.Kc=function clb(){return new olb(this)};_.$c=function dlb(a){return Kkb(this,a)};_.Mc=function elb(a){return Lkb(this,a)};_.Ud=function flb(a,b){Mkb(this,a,b)};_._c=function glb(a,b){return Nkb(this,a,b)};_.gc=function hlb(){return this.c.length};_.ad=function ilb(a){Okb(this,a)};_.Pc=function jlb(){return Pkb(this)};_.Qc=function klb(a){return Qkb(this,a)};var DJ=mdb(bie,'ArrayList',12);bcb(7,1,aie,olb);_.Nb=function plb(a){Rrb(this,a)};_.Ob=function qlb(){return llb(this)};_.Pb=function rlb(){return mlb(this)};_.Qb=function slb(){nlb(this)};_.a=0;_.b=-1;var CJ=mdb(bie,'ArrayList/1',7);bcb(2013,$wnd.Function,{},Ylb);_.te=function Zlb(a,b){return Kdb(a,b)};bcb(154,52,bke,amb);_.Hc=function bmb(a){return Bt(this,a)!=-1};_.Jc=function cmb(a){var b,c,d,e;uCb(a);for(c=this.a,d=0,e=c.length;d>>0,a.toString(16))};_.f=0;_.i=Qje;var PM=mdb(Gke,'CNode',57);bcb(814,1,{},zDb);var OM=mdb(Gke,'CNode/CNodeBuilder',814);var EDb;bcb(1525,1,{},GDb);_.Oe=function HDb(a,b){return 0};_.Pe=function IDb(a,b){return 0};var QM=mdb(Gke,Ike,1525);bcb(1790,1,{},JDb);_.Le=function KDb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;j=Pje;for(d=new olb(a.a.b);d.ad.d.c||d.d.c==f.d.c&&d.d.b0?a+this.n.d+this.n.a:0};_.Se=function HHb(){var a,b,c,d,e;e=0;if(this.e){this.b?(e=this.b.a):!!this.a[1][1]&&(e=this.a[1][1].Se())}else if(this.g){e=EHb(this,yHb(this,null,true))}else{for(b=(gHb(),OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])),c=0,d=b.length;c0?e+this.n.b+this.n.c:0};_.Te=function IHb(){var a,b,c,d,e;if(this.g){a=yHb(this,null,false);for(c=(gHb(),OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])),d=0,e=c.length;d0){d[0]+=this.d;c-=d[0]}if(d[2]>0){d[2]+=this.d;c-=d[2]}this.c.a=$wnd.Math.max(0,c);this.c.d=b.d+a.d+(this.c.a-c)/2;d[1]=$wnd.Math.max(d[1],c);uHb(this,eHb,b.d+a.d+d[0]-(d[1]-c)/2,d)};_.b=null;_.d=0;_.e=false;_.f=false;_.g=false;var rHb=0,sHb=0;var rN=mdb(fle,'GridContainerCell',1473);bcb(461,22,{3:1,35:1,22:1,461:1},OHb);var KHb,LHb,MHb;var sN=ndb(fle,'HorizontalLabelAlignment',461,CI,QHb,PHb);var RHb;bcb(306,212,{212:1,306:1},aIb,bIb,cIb);_.Re=function dIb(){return YHb(this)};_.Se=function eIb(){return ZHb(this)};_.a=0;_.c=false;var tN=mdb(fle,'LabelCell',306);bcb(244,326,{212:1,326:1,244:1},mIb);_.Re=function nIb(){return fIb(this)};_.Se=function oIb(){return gIb(this)};_.Te=function rIb(){hIb(this)};_.Ue=function sIb(){iIb(this)};_.b=0;_.c=0;_.d=false;var yN=mdb(fle,'StripContainerCell',244);bcb(1626,1,Oie,tIb);_.Mb=function uIb(a){return pIb(BD(a,212))};var uN=mdb(fle,'StripContainerCell/lambda$0$Type',1626);bcb(1627,1,{},vIb);_.Fe=function wIb(a){return BD(a,212).Se()};var vN=mdb(fle,'StripContainerCell/lambda$1$Type',1627);bcb(1628,1,Oie,xIb);_.Mb=function yIb(a){return qIb(BD(a,212))};var wN=mdb(fle,'StripContainerCell/lambda$2$Type',1628);bcb(1629,1,{},zIb);_.Fe=function AIb(a){return BD(a,212).Re()};var xN=mdb(fle,'StripContainerCell/lambda$3$Type',1629);bcb(462,22,{3:1,35:1,22:1,462:1},FIb);var BIb,CIb,DIb;var zN=ndb(fle,'VerticalLabelAlignment',462,CI,HIb,GIb);var IIb;bcb(789,1,{},LIb);_.c=0;_.d=0;_.k=0;_.s=0;_.t=0;_.v=false;_.w=0;_.D=false;var CN=mdb(nle,'NodeContext',789);bcb(1471,1,Dke,OIb);_.ue=function PIb(a,b){return NIb(BD(a,61),BD(b,61))};_.Fb=function QIb(a){return this===a};_.ve=function RIb(){return new tpb(this)};var AN=mdb(nle,'NodeContext/0methodref$comparePortSides$Type',1471);bcb(1472,1,Dke,SIb);_.ue=function TIb(a,b){return MIb(BD(a,111),BD(b,111))};_.Fb=function UIb(a){return this===a};_.ve=function VIb(){return new tpb(this)};var BN=mdb(nle,'NodeContext/1methodref$comparePortContexts$Type',1472);bcb(159,22,{3:1,35:1,22:1,159:1},tJb);var WIb,XIb,YIb,ZIb,$Ib,_Ib,aJb,bJb,cJb,dJb,eJb,fJb,gJb,hJb,iJb,jJb,kJb,lJb,mJb,nJb,oJb,pJb;var DN=ndb(nle,'NodeLabelLocation',159,CI,wJb,vJb);var xJb;bcb(111,1,{111:1},AJb);_.a=false;var EN=mdb(nle,'PortContext',111);bcb(1476,1,qie,TJb);_.td=function UJb(a){WHb(BD(a,306))};var FN=mdb(qle,rle,1476);bcb(1477,1,Oie,VJb);_.Mb=function WJb(a){return !!BD(a,111).c};var GN=mdb(qle,sle,1477);bcb(1478,1,qie,XJb);_.td=function YJb(a){WHb(BD(a,111).c)};var HN=mdb(qle,'LabelPlacer/lambda$2$Type',1478);var ZJb;bcb(1475,1,qie,fKb);_.td=function gKb(a){$Jb();zJb(BD(a,111))};var IN=mdb(qle,'NodeLabelAndSizeUtilities/lambda$0$Type',1475);bcb(790,1,qie,mKb);_.td=function nKb(a){kKb(this.b,this.c,this.a,BD(a,181))};_.a=false;_.c=false;var JN=mdb(qle,'NodeLabelCellCreator/lambda$0$Type',790);bcb(1474,1,qie,tKb);_.td=function uKb(a){sKb(this.a,BD(a,181))};var KN=mdb(qle,'PortContextCreator/lambda$0$Type',1474);var BKb;bcb(1829,1,{},VKb);var MN=mdb(ule,'GreedyRectangleStripOverlapRemover',1829);bcb(1830,1,Dke,XKb);_.ue=function YKb(a,b){return WKb(BD(a,222),BD(b,222))};_.Fb=function ZKb(a){return this===a};_.ve=function $Kb(){return new tpb(this)};var LN=mdb(ule,'GreedyRectangleStripOverlapRemover/0methodref$compareByYCoordinate$Type',1830);bcb(1786,1,{},fLb);_.a=5;_.e=0;var SN=mdb(ule,'RectangleStripOverlapRemover',1786);bcb(1787,1,Dke,jLb);_.ue=function kLb(a,b){return gLb(BD(a,222),BD(b,222))};_.Fb=function lLb(a){return this===a};_.ve=function mLb(){return new tpb(this)};var NN=mdb(ule,'RectangleStripOverlapRemover/0methodref$compareLeftRectangleBorders$Type',1787);bcb(1789,1,Dke,nLb);_.ue=function oLb(a,b){return hLb(BD(a,222),BD(b,222))};_.Fb=function pLb(a){return this===a};_.ve=function qLb(){return new tpb(this)};var ON=mdb(ule,'RectangleStripOverlapRemover/1methodref$compareRightRectangleBorders$Type',1789);bcb(406,22,{3:1,35:1,22:1,406:1},wLb);var rLb,sLb,tLb,uLb;var PN=ndb(ule,'RectangleStripOverlapRemover/OverlapRemovalDirection',406,CI,yLb,xLb);var zLb;bcb(222,1,{222:1},BLb);var QN=mdb(ule,'RectangleStripOverlapRemover/RectangleNode',222);bcb(1788,1,qie,CLb);_.td=function DLb(a){aLb(this.a,BD(a,222))};var RN=mdb(ule,'RectangleStripOverlapRemover/lambda$1$Type',1788);bcb(1304,1,Dke,GLb);_.ue=function HLb(a,b){return FLb(BD(a,167),BD(b,167))};_.Fb=function ILb(a){return this===a};_.ve=function JLb(){return new tpb(this)};var WN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator',1304);bcb(1307,1,{},KLb);_.Kb=function LLb(a){return BD(a,324).a};var TN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$0$Type',1307);bcb(1308,1,Oie,MLb);_.Mb=function NLb(a){return BD(a,323).a};var UN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$1$Type',1308);bcb(1309,1,Oie,OLb);_.Mb=function PLb(a){return BD(a,323).a};var VN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$2$Type',1309);bcb(1302,1,Dke,RLb);_.ue=function SLb(a,b){return QLb(BD(a,167),BD(b,167))};_.Fb=function TLb(a){return this===a};_.ve=function ULb(){return new tpb(this)};var YN=mdb(wle,'PolyominoCompactor/MinNumOfExtensionDirectionsComparator',1302);bcb(1305,1,{},VLb);_.Kb=function WLb(a){return BD(a,324).a};var XN=mdb(wle,'PolyominoCompactor/MinNumOfExtensionDirectionsComparator/lambda$0$Type',1305);bcb(767,1,Dke,YLb);_.ue=function ZLb(a,b){return XLb(BD(a,167),BD(b,167))};_.Fb=function $Lb(a){return this===a};_.ve=function _Lb(){return new tpb(this)};var ZN=mdb(wle,'PolyominoCompactor/MinNumOfExtensionsComparator',767);bcb(1300,1,Dke,bMb);_.ue=function cMb(a,b){return aMb(BD(a,321),BD(b,321))};_.Fb=function dMb(a){return this===a};_.ve=function eMb(){return new tpb(this)};var _N=mdb(wle,'PolyominoCompactor/MinPerimeterComparator',1300);bcb(1301,1,Dke,gMb);_.ue=function hMb(a,b){return fMb(BD(a,321),BD(b,321))};_.Fb=function iMb(a){return this===a};_.ve=function jMb(){return new tpb(this)};var $N=mdb(wle,'PolyominoCompactor/MinPerimeterComparatorWithShape',1301);bcb(1303,1,Dke,lMb);_.ue=function mMb(a,b){return kMb(BD(a,167),BD(b,167))};_.Fb=function nMb(a){return this===a};_.ve=function oMb(){return new tpb(this)};var bO=mdb(wle,'PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator',1303);bcb(1306,1,{},pMb);_.Kb=function qMb(a){return BD(a,324).a};var aO=mdb(wle,'PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator/lambda$0$Type',1306);bcb(777,1,{},tMb);_.Ce=function uMb(a,b){return sMb(this,BD(a,46),BD(b,167))};var cO=mdb(wle,'SuccessorCombination',777);bcb(644,1,{},wMb);_.Ce=function xMb(a,b){var c;return vMb((c=BD(a,46),BD(b,167),c))};var dO=mdb(wle,'SuccessorJitter',644);bcb(643,1,{},zMb);_.Ce=function AMb(a,b){var c;return yMb((c=BD(a,46),BD(b,167),c))};var eO=mdb(wle,'SuccessorLineByLine',643);bcb(568,1,{},CMb);_.Ce=function DMb(a,b){var c;return BMb((c=BD(a,46),BD(b,167),c))};var fO=mdb(wle,'SuccessorManhattan',568);bcb(1356,1,{},FMb);_.Ce=function GMb(a,b){var c;return EMb((c=BD(a,46),BD(b,167),c))};var gO=mdb(wle,'SuccessorMaxNormWindingInMathPosSense',1356);bcb(400,1,{},JMb);_.Ce=function KMb(a,b){return HMb(this,a,b)};_.c=false;_.d=false;_.e=false;_.f=false;var iO=mdb(wle,'SuccessorQuadrantsGeneric',400);bcb(1357,1,{},LMb);_.Kb=function MMb(a){return BD(a,324).a};var hO=mdb(wle,'SuccessorQuadrantsGeneric/lambda$0$Type',1357);bcb(323,22,{3:1,35:1,22:1,323:1},SMb);_.a=false;var NMb,OMb,PMb,QMb;var jO=ndb(Ble,Cle,323,CI,UMb,TMb);var VMb;bcb(1298,1,{});_.Ib=function bNb(){var a,b,c,d,e,f;c=' ';a=meb(0);for(e=0;e=0?'b'+a+'['+fRb(this.a)+']':'b['+fRb(this.a)+']'}return 'b_'+FCb(this)};var YO=mdb(jme,'FBendpoint',559);bcb(282,134,{3:1,282:1,94:1,134:1},gRb);_.Ib=function hRb(){return fRb(this)};var ZO=mdb(jme,'FEdge',282);bcb(231,134,{3:1,231:1,94:1,134:1},kRb);var $O=mdb(jme,'FGraph',231);bcb(447,357,{3:1,447:1,357:1,94:1,134:1},mRb);_.Ib=function nRb(){return this.b==null||this.b.length==0?'l['+fRb(this.a)+']':'l_'+this.b};var _O=mdb(jme,'FLabel',447);bcb(144,357,{3:1,144:1,357:1,94:1,134:1},pRb);_.Ib=function qRb(){return oRb(this)};_.b=0;var aP=mdb(jme,'FNode',144);bcb(2003,1,{});_.bf=function vRb(a){rRb(this,a)};_.cf=function wRb(){sRb(this)};_.d=0;var cP=mdb(lme,'AbstractForceModel',2003);bcb(631,2003,{631:1},xRb);_.af=function zRb(a,b){var c,d,e,f,g;uRb(this.f,a,b);e=c7c(R6c(b.d),a.d);g=$wnd.Math.sqrt(e.a*e.a+e.b*e.b);d=$wnd.Math.max(0,g-U6c(a.e)/2-U6c(b.e)/2);c=jRb(this.e,a,b);c>0?(f=-yRb(d,this.c)*c):(f=CRb(d,this.b)*BD(vNb(a,(wSb(),oSb)),19).a);Y6c(e,f/g);return e};_.bf=function ARb(a){rRb(this,a);this.a=BD(vNb(a,(wSb(),eSb)),19).a;this.c=Edb(ED(vNb(a,uSb)));this.b=Edb(ED(vNb(a,qSb)))};_.df=function BRb(a){return a0&&(f-=ERb(d,this.a)*c);Y6c(e,f*this.b/g);return e};_.bf=function GRb(a){var b,c,d,e,f,g,h;rRb(this,a);this.b=Edb(ED(vNb(a,(wSb(),vSb))));this.c=this.b/BD(vNb(a,eSb),19).a;d=a.e.c.length;f=0;e=0;for(h=new olb(a.e);h.a0};_.a=0;_.b=0;_.c=0;var eP=mdb(lme,'FruchtermanReingoldModel',632);bcb(849,1,ale,TRb);_.Qe=function URb(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,mme),''),'Force Model'),'Determines the model for force calculation.'),MRb),(_5c(),V5c)),gP),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,nme),''),'Iterations'),'The number of iterations on the force model.'),meb(300)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ome),''),'Repulsive Power'),'Determines how many bend points are added to the edge; such bend points are regarded as repelling particles in the force model'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,pme),''),'FR Temperature'),'The temperature is used as a scaling factor for particle displacements.'),qme),U5c),BI),pqb(L5c))));o4c(a,pme,mme,RRb);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,rme),''),'Eades Repulsion'),"Factor for repulsive forces in Eades' model."),5),U5c),BI),pqb(L5c))));o4c(a,rme,mme,ORb);xSb((new ySb,a))};var KRb,LRb,MRb,NRb,ORb,PRb,QRb,RRb;var fP=mdb(sme,'ForceMetaDataProvider',849);bcb(424,22,{3:1,35:1,22:1,424:1},YRb);var VRb,WRb;var gP=ndb(sme,'ForceModelStrategy',424,CI,$Rb,ZRb);var _Rb;bcb(988,1,ale,ySb);_.Qe=function zSb(a){xSb(a)};var bSb,cSb,dSb,eSb,fSb,gSb,hSb,iSb,jSb,kSb,lSb,mSb,nSb,oSb,pSb,qSb,rSb,sSb,tSb,uSb,vSb;var iP=mdb(sme,'ForceOptions',988);bcb(989,1,{},ASb);_.$e=function BSb(){var a;return a=new ZQb,a};_._e=function CSb(a){};var hP=mdb(sme,'ForceOptions/ForceFactory',989);var DSb,ESb,FSb,GSb;bcb(850,1,ale,PSb);_.Qe=function QSb(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Mme),''),'Fixed Position'),'Prevent that the node is moved by the layout algorithm.'),(Bcb(),false)),(_5c(),T5c)),wI),pqb((N5c(),K5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Nme),''),'Desired Edge Length'),'Either specified for parent nodes or for individual edges, where the latter takes higher precedence.'),100),U5c),BI),qqb(L5c,OC(GC(e1,1),Kie,175,0,[I5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ome),''),'Layout Dimension'),'Dimensions that are permitted to be altered during layout.'),KSb),V5c),oP),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Pme),''),'Stress Epsilon'),'Termination criterion for the iterative process.'),qme),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Qme),''),'Iteration Limit'),"Maximum number of performed iterations. Takes higher precedence than 'epsilon'."),meb(Ohe)),X5c),JI),pqb(L5c))));cTb((new dTb,a))};var ISb,JSb,KSb,LSb,MSb,NSb;var jP=mdb(sme,'StressMetaDataProvider',850);bcb(992,1,ale,dTb);_.Qe=function eTb(a){cTb(a)};var RSb,SSb,TSb,USb,VSb,WSb,XSb,YSb,ZSb,$Sb,_Sb,aTb;var lP=mdb(sme,'StressOptions',992);bcb(993,1,{},fTb);_.$e=function gTb(){var a;return a=new iTb,a};_._e=function hTb(a){};var kP=mdb(sme,'StressOptions/StressFactory',993);bcb(1128,209,Mle,iTb);_.Ze=function jTb(a,b){var c,d,e,f,g;Odd(b,Sme,1);Ccb(DD(hkd(a,(bTb(),VSb))))?Ccb(DD(hkd(a,_Sb)))||$Cb((c=new _Cb((Pgd(),new bhd(a))),c)):WQb(new ZQb,a,Udd(b,1));e=TQb(a);d=LQb(this.a,e);for(g=d.Kc();g.Ob();){f=BD(g.Pb(),231);if(f.e.c.length<=1){continue}sTb(this.b,f);qTb(this.b);Hkb(f.d,new kTb)}e=KQb(d);SQb(e);Qdd(b)};var nP=mdb(Ume,'StressLayoutProvider',1128);bcb(1129,1,qie,kTb);_.td=function lTb(a){lRb(BD(a,447))};var mP=mdb(Ume,'StressLayoutProvider/lambda$0$Type',1129);bcb(990,1,{},tTb);_.c=0;_.e=0;_.g=0;var qP=mdb(Ume,'StressMajorization',990);bcb(379,22,{3:1,35:1,22:1,379:1},zTb);var vTb,wTb,xTb;var oP=ndb(Ume,'StressMajorization/Dimension',379,CI,BTb,ATb);var CTb;bcb(991,1,Dke,ETb);_.ue=function FTb(a,b){return uTb(this.a,BD(a,144),BD(b,144))};_.Fb=function GTb(a){return this===a};_.ve=function HTb(){return new tpb(this)};var pP=mdb(Ume,'StressMajorization/lambda$0$Type',991);bcb(1229,1,{},PTb);var tP=mdb(Wme,'ElkLayered',1229);bcb(1230,1,qie,STb);_.td=function TTb(a){QTb(BD(a,37))};var rP=mdb(Wme,'ElkLayered/lambda$0$Type',1230);bcb(1231,1,qie,UTb);_.td=function VTb(a){RTb(this.a,BD(a,37))};var sP=mdb(Wme,'ElkLayered/lambda$1$Type',1231);bcb(1263,1,{},bUb);var WTb,XTb,YTb;var xP=mdb(Wme,'GraphConfigurator',1263);bcb(759,1,qie,dUb);_.td=function eUb(a){$Tb(this.a,BD(a,10))};var uP=mdb(Wme,'GraphConfigurator/lambda$0$Type',759);bcb(760,1,{},fUb);_.Kb=function gUb(a){return ZTb(),new YAb(null,new Kub(BD(a,29).a,16))};var vP=mdb(Wme,'GraphConfigurator/lambda$1$Type',760);bcb(761,1,qie,hUb);_.td=function iUb(a){$Tb(this.a,BD(a,10))};var wP=mdb(Wme,'GraphConfigurator/lambda$2$Type',761);bcb(1127,209,Mle,jUb);_.Ze=function kUb(a,b){var c;c=U1b(new a2b,a);PD(hkd(a,(Nyc(),axc)))===PD((hbd(),ebd))?JTb(this.a,c,b):KTb(this.a,c,b);z2b(new D2b,c)};var yP=mdb(Wme,'LayeredLayoutProvider',1127);bcb(356,22,{3:1,35:1,22:1,356:1},rUb);var lUb,mUb,nUb,oUb,pUb;var zP=ndb(Wme,'LayeredPhases',356,CI,tUb,sUb);var uUb;bcb(1651,1,{},CUb);_.i=0;var wUb;var CP=mdb(Xme,'ComponentsToCGraphTransformer',1651);var hVb;bcb(1652,1,{},DUb);_.ef=function EUb(a,b){return $wnd.Math.min(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};_.ff=function FUb(a,b){return $wnd.Math.min(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};var AP=mdb(Xme,'ComponentsToCGraphTransformer/1',1652);bcb(81,1,{81:1});_.i=0;_.k=true;_.o=Qje;var IP=mdb(Yme,'CNode',81);bcb(460,81,{460:1,81:1},GUb,HUb);_.Ib=function IUb(){return ''};var BP=mdb(Xme,'ComponentsToCGraphTransformer/CRectNode',460);bcb(1623,1,{},VUb);var JUb,KUb;var FP=mdb(Xme,'OneDimensionalComponentsCompaction',1623);bcb(1624,1,{},YUb);_.Kb=function ZUb(a){return WUb(BD(a,46))};_.Fb=function $Ub(a){return this===a};var DP=mdb(Xme,'OneDimensionalComponentsCompaction/lambda$0$Type',1624);bcb(1625,1,{},_Ub);_.Kb=function aVb(a){return XUb(BD(a,46))};_.Fb=function bVb(a){return this===a};var EP=mdb(Xme,'OneDimensionalComponentsCompaction/lambda$1$Type',1625);bcb(1654,1,{},dVb);var GP=mdb(Yme,'CGraph',1654);bcb(189,1,{189:1},gVb);_.b=0;_.c=0;_.e=0;_.g=true;_.i=Qje;var HP=mdb(Yme,'CGroup',189);bcb(1653,1,{},jVb);_.ef=function kVb(a,b){return $wnd.Math.max(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};_.ff=function lVb(a,b){return $wnd.Math.max(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};var JP=mdb(Yme,Ike,1653);bcb(1655,1,{},CVb);_.d=false;var mVb;var LP=mdb(Yme,Nke,1655);bcb(1656,1,{},DVb);_.Kb=function EVb(a){return nVb(),Bcb(),BD(BD(a,46).a,81).d.e!=0?true:false};_.Fb=function FVb(a){return this===a};var KP=mdb(Yme,Oke,1656);bcb(823,1,{},IVb);_.a=false;_.b=false;_.c=false;_.d=false;var MP=mdb(Yme,Pke,823);bcb(1825,1,{},OVb);var RP=mdb(Zme,Qke,1825);var bQ=odb($me,Fke);bcb(1826,1,{369:1},SVb);_.Ke=function TVb(a){QVb(this,BD(a,466))};var OP=mdb(Zme,Rke,1826);bcb(1827,1,Dke,VVb);_.ue=function WVb(a,b){return UVb(BD(a,81),BD(b,81))};_.Fb=function XVb(a){return this===a};_.ve=function YVb(){return new tpb(this)};var NP=mdb(Zme,Ske,1827);bcb(466,1,{466:1},ZVb);_.a=false;var PP=mdb(Zme,Tke,466);bcb(1828,1,Dke,$Vb);_.ue=function _Vb(a,b){return PVb(BD(a,466),BD(b,466))};_.Fb=function aWb(a){return this===a};_.ve=function bWb(){return new tpb(this)};var QP=mdb(Zme,Uke,1828);bcb(140,1,{140:1},cWb,dWb);_.Fb=function eWb(a){var b;if(a==null){return false}if(TP!=rb(a)){return false}b=BD(a,140);return wtb(this.c,b.c)&&wtb(this.d,b.d)};_.Hb=function fWb(){return Hlb(OC(GC(SI,1),Uhe,1,5,[this.c,this.d]))};_.Ib=function gWb(){return '('+this.c+She+this.d+(this.a?'cx':'')+this.b+')'};_.a=true;_.c=0;_.d=0;var TP=mdb($me,'Point',140);bcb(405,22,{3:1,35:1,22:1,405:1},oWb);var hWb,iWb,jWb,kWb;var SP=ndb($me,'Point/Quadrant',405,CI,sWb,rWb);var tWb;bcb(1642,1,{},CWb);_.b=null;_.c=null;_.d=null;_.e=null;_.f=null;var vWb,wWb,xWb,yWb,zWb;var aQ=mdb($me,'RectilinearConvexHull',1642);bcb(574,1,{369:1},NWb);_.Ke=function OWb(a){MWb(this,BD(a,140))};_.b=0;var KWb;var VP=mdb($me,'RectilinearConvexHull/MaximalElementsEventHandler',574);bcb(1644,1,Dke,QWb);_.ue=function RWb(a,b){return PWb(ED(a),ED(b))};_.Fb=function SWb(a){return this===a};_.ve=function TWb(){return new tpb(this)};var UP=mdb($me,'RectilinearConvexHull/MaximalElementsEventHandler/lambda$0$Type',1644);bcb(1643,1,{369:1},VWb);_.Ke=function WWb(a){UWb(this,BD(a,140))};_.a=0;_.b=null;_.c=null;_.d=null;_.e=null;var WP=mdb($me,'RectilinearConvexHull/RectangleEventHandler',1643);bcb(1645,1,Dke,XWb);_.ue=function YWb(a,b){return EWb(BD(a,140),BD(b,140))};_.Fb=function ZWb(a){return this===a};_.ve=function $Wb(){return new tpb(this)};var XP=mdb($me,'RectilinearConvexHull/lambda$0$Type',1645);bcb(1646,1,Dke,_Wb);_.ue=function aXb(a,b){return FWb(BD(a,140),BD(b,140))};_.Fb=function bXb(a){return this===a};_.ve=function cXb(){return new tpb(this)};var YP=mdb($me,'RectilinearConvexHull/lambda$1$Type',1646);bcb(1647,1,Dke,dXb);_.ue=function eXb(a,b){return GWb(BD(a,140),BD(b,140))};_.Fb=function fXb(a){return this===a};_.ve=function gXb(){return new tpb(this)};var ZP=mdb($me,'RectilinearConvexHull/lambda$2$Type',1647);bcb(1648,1,Dke,hXb);_.ue=function iXb(a,b){return HWb(BD(a,140),BD(b,140))};_.Fb=function jXb(a){return this===a};_.ve=function kXb(){return new tpb(this)};var $P=mdb($me,'RectilinearConvexHull/lambda$3$Type',1648);bcb(1649,1,Dke,lXb);_.ue=function mXb(a,b){return IWb(BD(a,140),BD(b,140))};_.Fb=function nXb(a){return this===a};_.ve=function oXb(){return new tpb(this)};var _P=mdb($me,'RectilinearConvexHull/lambda$4$Type',1649);bcb(1650,1,{},qXb);var cQ=mdb($me,'Scanline',1650);bcb(2005,1,{});var dQ=mdb(_me,'AbstractGraphPlacer',2005);bcb(325,1,{325:1},AXb);_.mf=function BXb(a){if(this.nf(a)){Rc(this.b,BD(vNb(a,(wtc(),Esc)),21),a);return true}else{return false}};_.nf=function CXb(a){var b,c,d,e;b=BD(vNb(a,(wtc(),Esc)),21);e=BD(Qc(wXb,b),21);for(d=e.Kc();d.Ob();){c=BD(d.Pb(),21);if(!BD(Qc(this.b,c),15).dc()){return false}}return true};var wXb;var gQ=mdb(_me,'ComponentGroup',325);bcb(765,2005,{},HXb);_.of=function IXb(a){var b,c;for(c=new olb(this.a);c.an){v=0;w+=m+e;m=0}q=g.c;uXb(g,v+q.a,w+q.b);X6c(q);c=$wnd.Math.max(c,v+s.a);m=$wnd.Math.max(m,s.b);v+=s.a+e}b.f.a=c;b.f.b=w+m;if(Ccb(DD(vNb(f,qwc)))){d=new gYb;YXb(d,a,e);for(l=a.Kc();l.Ob();){k=BD(l.Pb(),37);P6c(X6c(k.c),d.e)}P6c(X6c(b.f),d.a)}tXb(b,a)};var uQ=mdb(_me,'SimpleRowGraphPlacer',1291);bcb(1292,1,Dke,VYb);_.ue=function WYb(a,b){return UYb(BD(a,37),BD(b,37))};_.Fb=function XYb(a){return this===a};_.ve=function YYb(){return new tpb(this)};var tQ=mdb(_me,'SimpleRowGraphPlacer/1',1292);var ZYb;bcb(1262,1,Vke,dZb);_.Lb=function eZb(a){var b;return b=BD(vNb(BD(a,243).b,(Nyc(),jxc)),74),!!b&&b.b!=0};_.Fb=function fZb(a){return this===a};_.Mb=function gZb(a){var b;return b=BD(vNb(BD(a,243).b,(Nyc(),jxc)),74),!!b&&b.b!=0};var vQ=mdb(dne,'CompoundGraphPostprocessor/1',1262);bcb(1261,1,ene,wZb);_.pf=function xZb(a,b){qZb(this,BD(a,37),b)};var xQ=mdb(dne,'CompoundGraphPreprocessor',1261);bcb(441,1,{441:1},yZb);_.c=false;var wQ=mdb(dne,'CompoundGraphPreprocessor/ExternalPort',441);bcb(243,1,{243:1},BZb);_.Ib=function CZb(){return Zr(this.c)+':'+TZb(this.b)};var zQ=mdb(dne,'CrossHierarchyEdge',243);bcb(763,1,Dke,EZb);_.ue=function FZb(a,b){return DZb(this,BD(a,243),BD(b,243))};_.Fb=function GZb(a){return this===a};_.ve=function IZb(){return new tpb(this)};var yQ=mdb(dne,'CrossHierarchyEdgeComparator',763);bcb(299,134,{3:1,299:1,94:1,134:1});_.p=0;var JQ=mdb(fne,'LGraphElement',299);bcb(17,299,{3:1,17:1,299:1,94:1,134:1},UZb);_.Ib=function VZb(){return TZb(this)};var AQ=mdb(fne,'LEdge',17);bcb(37,299,{3:1,20:1,37:1,299:1,94:1,134:1},XZb);_.Jc=function YZb(a){reb(this,a)};_.Kc=function ZZb(){return new olb(this.b)};_.Ib=function $Zb(){if(this.b.c.length==0){return 'G-unlayered'+Fe(this.a)}else if(this.a.c.length==0){return 'G-layered'+Fe(this.b)}return 'G[layerless'+Fe(this.a)+', layers'+Fe(this.b)+']'};var KQ=mdb(fne,'LGraph',37);var _Zb;bcb(657,1,{});_.qf=function b$b(){return this.e.n};_.We=function c$b(a){return vNb(this.e,a)};_.rf=function d$b(){return this.e.o};_.sf=function e$b(){return this.e.p};_.Xe=function f$b(a){return wNb(this.e,a)};_.tf=function g$b(a){this.e.n.a=a.a;this.e.n.b=a.b};_.uf=function h$b(a){this.e.o.a=a.a;this.e.o.b=a.b};_.vf=function i$b(a){this.e.p=a};var BQ=mdb(fne,'LGraphAdapters/AbstractLShapeAdapter',657);bcb(577,1,{839:1},j$b);_.wf=function k$b(){var a,b;if(!this.b){this.b=Pu(this.a.b.c.length);for(b=new olb(this.a.b);b.a0&&E_b((BCb(c-1,b.length),b.charCodeAt(c-1)),nne)){--c}if(g> ',a),C0b(c));Qfb(Pfb((a.a+='[',a),c.i),']')}return a.a};_.c=true;_.d=false;var t0b,u0b,v0b,w0b,x0b,y0b;var aR=mdb(fne,'LPort',11);bcb(397,1,vie,J0b);_.Jc=function K0b(a){reb(this,a)};_.Kc=function L0b(){var a;a=new olb(this.a.e);return new M0b(a)};var RQ=mdb(fne,'LPort/1',397);bcb(1290,1,aie,M0b);_.Nb=function N0b(a){Rrb(this,a)};_.Pb=function P0b(){return BD(mlb(this.a),17).c};_.Ob=function O0b(){return llb(this.a)};_.Qb=function Q0b(){nlb(this.a)};var QQ=mdb(fne,'LPort/1/1',1290);bcb(359,1,vie,R0b);_.Jc=function S0b(a){reb(this,a)};_.Kc=function T0b(){var a;return a=new olb(this.a.g),new U0b(a)};var TQ=mdb(fne,'LPort/2',359);bcb(762,1,aie,U0b);_.Nb=function V0b(a){Rrb(this,a)};_.Pb=function X0b(){return BD(mlb(this.a),17).d};_.Ob=function W0b(){return llb(this.a)};_.Qb=function Y0b(){nlb(this.a)};var SQ=mdb(fne,'LPort/2/1',762);bcb(1283,1,vie,Z0b);_.Jc=function $0b(a){reb(this,a)};_.Kc=function _0b(){return new b1b(this)};var VQ=mdb(fne,'LPort/CombineIter',1283);bcb(201,1,aie,b1b);_.Nb=function c1b(a){Rrb(this,a)};_.Qb=function f1b(){Srb()};_.Ob=function d1b(){return a1b(this)};_.Pb=function e1b(){return llb(this.a)?mlb(this.a):mlb(this.b)};var UQ=mdb(fne,'LPort/CombineIter/1',201);bcb(1285,1,Vke,h1b);_.Lb=function i1b(a){return g1b(a)};_.Fb=function j1b(a){return this===a};_.Mb=function k1b(a){return z0b(),BD(a,11).e.c.length!=0};var WQ=mdb(fne,'LPort/lambda$0$Type',1285);bcb(1284,1,Vke,m1b);_.Lb=function n1b(a){return l1b(a)};_.Fb=function o1b(a){return this===a};_.Mb=function p1b(a){return z0b(),BD(a,11).g.c.length!=0};var XQ=mdb(fne,'LPort/lambda$1$Type',1284);bcb(1286,1,Vke,q1b);_.Lb=function r1b(a){return z0b(),BD(a,11).j==(Ucd(),Acd)};_.Fb=function s1b(a){return this===a};_.Mb=function t1b(a){return z0b(),BD(a,11).j==(Ucd(),Acd)};var YQ=mdb(fne,'LPort/lambda$2$Type',1286);bcb(1287,1,Vke,u1b);_.Lb=function v1b(a){return z0b(),BD(a,11).j==(Ucd(),zcd)};_.Fb=function w1b(a){return this===a};_.Mb=function x1b(a){return z0b(),BD(a,11).j==(Ucd(),zcd)};var ZQ=mdb(fne,'LPort/lambda$3$Type',1287);bcb(1288,1,Vke,y1b);_.Lb=function z1b(a){return z0b(),BD(a,11).j==(Ucd(),Rcd)};_.Fb=function A1b(a){return this===a};_.Mb=function B1b(a){return z0b(),BD(a,11).j==(Ucd(),Rcd)};var $Q=mdb(fne,'LPort/lambda$4$Type',1288);bcb(1289,1,Vke,C1b);_.Lb=function D1b(a){return z0b(),BD(a,11).j==(Ucd(),Tcd)};_.Fb=function E1b(a){return this===a};_.Mb=function F1b(a){return z0b(),BD(a,11).j==(Ucd(),Tcd)};var _Q=mdb(fne,'LPort/lambda$5$Type',1289);bcb(29,299,{3:1,20:1,299:1,29:1,94:1,134:1},H1b);_.Jc=function I1b(a){reb(this,a)};_.Kc=function J1b(){return new olb(this.a)};_.Ib=function K1b(){return 'L_'+Jkb(this.b.b,this,0)+Fe(this.a)};var cR=mdb(fne,'Layer',29);bcb(1342,1,{},a2b);var mR=mdb(tne,une,1342);bcb(1346,1,{},e2b);_.Kb=function f2b(a){return atd(BD(a,82))};var dR=mdb(tne,'ElkGraphImporter/0methodref$connectableShapeToNode$Type',1346);bcb(1349,1,{},g2b);_.Kb=function h2b(a){return atd(BD(a,82))};var eR=mdb(tne,'ElkGraphImporter/1methodref$connectableShapeToNode$Type',1349);bcb(1343,1,qie,i2b);_.td=function j2b(a){Q1b(this.a,BD(a,118))};var fR=mdb(tne,vne,1343);bcb(1344,1,qie,k2b);_.td=function l2b(a){Q1b(this.a,BD(a,118))};var gR=mdb(tne,wne,1344);bcb(1345,1,{},m2b);_.Kb=function n2b(a){return new YAb(null,new Kub(Old(BD(a,79)),16))};var hR=mdb(tne,xne,1345);bcb(1347,1,Oie,o2b);_.Mb=function p2b(a){return b2b(this.a,BD(a,33))};var iR=mdb(tne,yne,1347);bcb(1348,1,{},q2b);_.Kb=function r2b(a){return new YAb(null,new Kub(Nld(BD(a,79)),16))};var jR=mdb(tne,'ElkGraphImporter/lambda$5$Type',1348);bcb(1350,1,Oie,s2b);_.Mb=function t2b(a){return c2b(this.a,BD(a,33))};var kR=mdb(tne,'ElkGraphImporter/lambda$7$Type',1350);bcb(1351,1,Oie,u2b);_.Mb=function v2b(a){return d2b(BD(a,79))};var lR=mdb(tne,'ElkGraphImporter/lambda$8$Type',1351);bcb(1278,1,{},D2b);var w2b;var rR=mdb(tne,'ElkGraphLayoutTransferrer',1278);bcb(1279,1,Oie,G2b);_.Mb=function H2b(a){return E2b(this.a,BD(a,17))};var nR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$0$Type',1279);bcb(1280,1,qie,I2b);_.td=function J2b(a){x2b();Ekb(this.a,BD(a,17))};var oR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$1$Type',1280);bcb(1281,1,Oie,K2b);_.Mb=function L2b(a){return F2b(this.a,BD(a,17))};var pR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$2$Type',1281);bcb(1282,1,qie,M2b);_.td=function N2b(a){x2b();Ekb(this.a,BD(a,17))};var qR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$3$Type',1282);bcb(1485,1,ene,S2b);_.pf=function T2b(a,b){Q2b(BD(a,37),b)};var uR=mdb(Ane,'CommentNodeMarginCalculator',1485);bcb(1486,1,{},U2b);_.Kb=function V2b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var sR=mdb(Ane,'CommentNodeMarginCalculator/lambda$0$Type',1486);bcb(1487,1,qie,W2b);_.td=function X2b(a){R2b(BD(a,10))};var tR=mdb(Ane,'CommentNodeMarginCalculator/lambda$1$Type',1487);bcb(1488,1,ene,_2b);_.pf=function a3b(a,b){Z2b(BD(a,37),b)};var vR=mdb(Ane,'CommentPostprocessor',1488);bcb(1489,1,ene,e3b);_.pf=function f3b(a,b){b3b(BD(a,37),b)};var wR=mdb(Ane,'CommentPreprocessor',1489);bcb(1490,1,ene,h3b);_.pf=function i3b(a,b){g3b(BD(a,37),b)};var xR=mdb(Ane,'ConstraintsPostprocessor',1490);bcb(1491,1,ene,p3b);_.pf=function q3b(a,b){n3b(BD(a,37),b)};var yR=mdb(Ane,'EdgeAndLayerConstraintEdgeReverser',1491);bcb(1492,1,ene,t3b);_.pf=function v3b(a,b){r3b(BD(a,37),b)};var CR=mdb(Ane,'EndLabelPostprocessor',1492);bcb(1493,1,{},w3b);_.Kb=function x3b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var zR=mdb(Ane,'EndLabelPostprocessor/lambda$0$Type',1493);bcb(1494,1,Oie,y3b);_.Mb=function z3b(a){return u3b(BD(a,10))};var AR=mdb(Ane,'EndLabelPostprocessor/lambda$1$Type',1494);bcb(1495,1,qie,A3b);_.td=function B3b(a){s3b(BD(a,10))};var BR=mdb(Ane,'EndLabelPostprocessor/lambda$2$Type',1495);bcb(1496,1,ene,M3b);_.pf=function P3b(a,b){I3b(BD(a,37),b)};var JR=mdb(Ane,'EndLabelPreprocessor',1496);bcb(1497,1,{},Q3b);_.Kb=function R3b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var DR=mdb(Ane,'EndLabelPreprocessor/lambda$0$Type',1497);bcb(1498,1,qie,S3b);_.td=function T3b(a){E3b(this.a,this.b,this.c,BD(a,10))};_.a=0;_.b=0;_.c=false;var ER=mdb(Ane,'EndLabelPreprocessor/lambda$1$Type',1498);bcb(1499,1,Oie,U3b);_.Mb=function V3b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),pad))};var FR=mdb(Ane,'EndLabelPreprocessor/lambda$2$Type',1499);bcb(1500,1,qie,W3b);_.td=function X3b(a){Dsb(this.a,BD(a,70))};var GR=mdb(Ane,'EndLabelPreprocessor/lambda$3$Type',1500);bcb(1501,1,Oie,Y3b);_.Mb=function Z3b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),oad))};var HR=mdb(Ane,'EndLabelPreprocessor/lambda$4$Type',1501);bcb(1502,1,qie,$3b);_.td=function _3b(a){Dsb(this.a,BD(a,70))};var IR=mdb(Ane,'EndLabelPreprocessor/lambda$5$Type',1502);bcb(1551,1,ene,i4b);_.pf=function j4b(a,b){f4b(BD(a,37),b)};var a4b;var RR=mdb(Ane,'EndLabelSorter',1551);bcb(1552,1,Dke,l4b);_.ue=function m4b(a,b){return k4b(BD(a,456),BD(b,456))};_.Fb=function n4b(a){return this===a};_.ve=function o4b(){return new tpb(this)};var KR=mdb(Ane,'EndLabelSorter/1',1552);bcb(456,1,{456:1},p4b);var LR=mdb(Ane,'EndLabelSorter/LabelGroup',456);bcb(1553,1,{},q4b);_.Kb=function r4b(a){return b4b(),new YAb(null,new Kub(BD(a,29).a,16))};var MR=mdb(Ane,'EndLabelSorter/lambda$0$Type',1553);bcb(1554,1,Oie,s4b);_.Mb=function t4b(a){return b4b(),BD(a,10).k==(j0b(),h0b)};var NR=mdb(Ane,'EndLabelSorter/lambda$1$Type',1554);bcb(1555,1,qie,u4b);_.td=function v4b(a){g4b(BD(a,10))};var OR=mdb(Ane,'EndLabelSorter/lambda$2$Type',1555);bcb(1556,1,Oie,w4b);_.Mb=function x4b(a){return b4b(),PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),oad))};var PR=mdb(Ane,'EndLabelSorter/lambda$3$Type',1556);bcb(1557,1,Oie,y4b);_.Mb=function z4b(a){return b4b(),PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),pad))};var QR=mdb(Ane,'EndLabelSorter/lambda$4$Type',1557);bcb(1503,1,ene,L4b);_.pf=function M4b(a,b){J4b(this,BD(a,37))};_.b=0;_.c=0;var YR=mdb(Ane,'FinalSplineBendpointsCalculator',1503);bcb(1504,1,{},N4b);_.Kb=function O4b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var SR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$0$Type',1504);bcb(1505,1,{},P4b);_.Kb=function Q4b(a){return new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var TR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$1$Type',1505);bcb(1506,1,Oie,R4b);_.Mb=function S4b(a){return !OZb(BD(a,17))};var UR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$2$Type',1506);bcb(1507,1,Oie,T4b);_.Mb=function U4b(a){return wNb(BD(a,17),(wtc(),rtc))};var VR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$3$Type',1507);bcb(1508,1,qie,V4b);_.td=function W4b(a){C4b(this.a,BD(a,128))};var WR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$4$Type',1508);bcb(1509,1,qie,X4b);_.td=function Y4b(a){smb(BD(a,17).a)};var XR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$5$Type',1509);bcb(792,1,ene,u5b);_.pf=function v5b(a,b){l5b(this,BD(a,37),b)};var $R=mdb(Ane,'GraphTransformer',792);bcb(511,22,{3:1,35:1,22:1,511:1},z5b);var w5b,x5b;var ZR=ndb(Ane,'GraphTransformer/Mode',511,CI,B5b,A5b);var C5b;bcb(1510,1,ene,I5b);_.pf=function J5b(a,b){F5b(BD(a,37),b)};var _R=mdb(Ane,'HierarchicalNodeResizingProcessor',1510);bcb(1511,1,ene,Q5b);_.pf=function R5b(a,b){M5b(BD(a,37),b)};var bS=mdb(Ane,'HierarchicalPortConstraintProcessor',1511);bcb(1512,1,Dke,T5b);_.ue=function U5b(a,b){return S5b(BD(a,10),BD(b,10))};_.Fb=function V5b(a){return this===a};_.ve=function W5b(){return new tpb(this)};var aS=mdb(Ane,'HierarchicalPortConstraintProcessor/NodeComparator',1512);bcb(1513,1,ene,Z5b);_.pf=function $5b(a,b){X5b(BD(a,37),b)};var cS=mdb(Ane,'HierarchicalPortDummySizeProcessor',1513);bcb(1514,1,ene,l6b);_.pf=function m6b(a,b){e6b(this,BD(a,37),b)};_.a=0;var fS=mdb(Ane,'HierarchicalPortOrthogonalEdgeRouter',1514);bcb(1515,1,Dke,o6b);_.ue=function p6b(a,b){return n6b(BD(a,10),BD(b,10))};_.Fb=function q6b(a){return this===a};_.ve=function r6b(){return new tpb(this)};var dS=mdb(Ane,'HierarchicalPortOrthogonalEdgeRouter/1',1515);bcb(1516,1,Dke,t6b);_.ue=function u6b(a,b){return s6b(BD(a,10),BD(b,10))};_.Fb=function v6b(a){return this===a};_.ve=function w6b(){return new tpb(this)};var eS=mdb(Ane,'HierarchicalPortOrthogonalEdgeRouter/2',1516);bcb(1517,1,ene,z6b);_.pf=function A6b(a,b){y6b(BD(a,37),b)};var gS=mdb(Ane,'HierarchicalPortPositionProcessor',1517);bcb(1518,1,ene,J6b);_.pf=function K6b(a,b){I6b(this,BD(a,37))};_.a=0;_.c=0;var B6b,C6b;var kS=mdb(Ane,'HighDegreeNodeLayeringProcessor',1518);bcb(571,1,{571:1},L6b);_.b=-1;_.d=-1;var hS=mdb(Ane,'HighDegreeNodeLayeringProcessor/HighDegreeNodeInformation',571);bcb(1519,1,{},M6b);_.Kb=function N6b(a){return D6b(),R_b(BD(a,10))};_.Fb=function O6b(a){return this===a};var iS=mdb(Ane,'HighDegreeNodeLayeringProcessor/lambda$0$Type',1519);bcb(1520,1,{},P6b);_.Kb=function Q6b(a){return D6b(),U_b(BD(a,10))};_.Fb=function R6b(a){return this===a};var jS=mdb(Ane,'HighDegreeNodeLayeringProcessor/lambda$1$Type',1520);bcb(1526,1,ene,X6b);_.pf=function Y6b(a,b){W6b(this,BD(a,37),b)};var pS=mdb(Ane,'HyperedgeDummyMerger',1526);bcb(793,1,{},Z6b);_.a=false;_.b=false;_.c=false;var lS=mdb(Ane,'HyperedgeDummyMerger/MergeState',793);bcb(1527,1,{},$6b);_.Kb=function _6b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var mS=mdb(Ane,'HyperedgeDummyMerger/lambda$0$Type',1527);bcb(1528,1,{},a7b);_.Kb=function b7b(a){return new YAb(null,new Kub(BD(a,10).j,16))};var nS=mdb(Ane,'HyperedgeDummyMerger/lambda$1$Type',1528);bcb(1529,1,qie,c7b);_.td=function d7b(a){BD(a,11).p=-1};var oS=mdb(Ane,'HyperedgeDummyMerger/lambda$2$Type',1529);bcb(1530,1,ene,g7b);_.pf=function h7b(a,b){f7b(BD(a,37),b)};var qS=mdb(Ane,'HypernodesProcessor',1530);bcb(1531,1,ene,j7b);_.pf=function k7b(a,b){i7b(BD(a,37),b)};var rS=mdb(Ane,'InLayerConstraintProcessor',1531);bcb(1532,1,ene,m7b);_.pf=function n7b(a,b){l7b(BD(a,37),b)};var sS=mdb(Ane,'InnermostNodeMarginCalculator',1532);bcb(1533,1,ene,r7b);_.pf=function w7b(a,b){q7b(this,BD(a,37))};_.a=Qje;_.b=Qje;_.c=Pje;_.d=Pje;var zS=mdb(Ane,'InteractiveExternalPortPositioner',1533);bcb(1534,1,{},x7b);_.Kb=function y7b(a){return BD(a,17).d.i};_.Fb=function z7b(a){return this===a};var tS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$0$Type',1534);bcb(1535,1,{},A7b);_.Kb=function B7b(a){return s7b(this.a,ED(a))};_.Fb=function C7b(a){return this===a};var uS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$1$Type',1535);bcb(1536,1,{},D7b);_.Kb=function E7b(a){return BD(a,17).c.i};_.Fb=function F7b(a){return this===a};var vS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$2$Type',1536);bcb(1537,1,{},G7b);_.Kb=function H7b(a){return t7b(this.a,ED(a))};_.Fb=function I7b(a){return this===a};var wS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$3$Type',1537);bcb(1538,1,{},J7b);_.Kb=function K7b(a){return u7b(this.a,ED(a))};_.Fb=function L7b(a){return this===a};var xS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$4$Type',1538);bcb(1539,1,{},M7b);_.Kb=function N7b(a){return v7b(this.a,ED(a))};_.Fb=function O7b(a){return this===a};var yS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$5$Type',1539);bcb(77,22,{3:1,35:1,22:1,77:1,234:1},T8b);_.Kf=function U8b(){switch(this.g){case 15:return new eoc;case 22:return new Aoc;case 47:return new Joc;case 28:case 35:return new uac;case 32:return new S2b;case 42:return new _2b;case 1:return new e3b;case 41:return new h3b;case 56:return new u5b((y5b(),x5b));case 0:return new u5b((y5b(),w5b));case 2:return new p3b;case 54:return new t3b;case 33:return new M3b;case 51:return new L4b;case 55:return new I5b;case 13:return new Q5b;case 38:return new Z5b;case 44:return new l6b;case 40:return new z6b;case 9:return new J6b;case 49:return new sgc;case 37:return new X6b;case 43:return new g7b;case 27:return new j7b;case 30:return new m7b;case 3:return new r7b;case 18:return new b9b;case 29:return new h9b;case 5:return new u9b;case 50:return new D9b;case 34:return new $9b;case 36:return new Iac;case 52:return new i4b;case 11:return new Sac;case 7:return new abc;case 39:return new obc;case 45:return new rbc;case 16:return new vbc;case 10:return new Fbc;case 48:return new Xbc;case 21:return new ccc;case 23:return new fGc((rGc(),pGc));case 8:return new lcc;case 12:return new tcc;case 4:return new ycc;case 19:return new Tcc;case 17:return new pdc;case 53:return new sdc;case 6:return new hec;case 25:return new wdc;case 46:return new Ndc;case 31:return new sec;case 14:return new Fec;case 26:return new ppc;case 20:return new Uec;case 24:return new fGc((rGc(),qGc));default:throw vbb(new Wdb(Dne+(this.f!=null?this.f:''+this.g)));}};var P7b,Q7b,R7b,S7b,T7b,U7b,V7b,W7b,X7b,Y7b,Z7b,$7b,_7b,a8b,b8b,c8b,d8b,e8b,f8b,g8b,h8b,i8b,j8b,k8b,l8b,m8b,n8b,o8b,p8b,q8b,r8b,s8b,t8b,u8b,v8b,w8b,x8b,y8b,z8b,A8b,B8b,C8b,D8b,E8b,F8b,G8b,H8b,I8b,J8b,K8b,L8b,M8b,N8b,O8b,P8b,Q8b,R8b;var AS=ndb(Ane,Ene,77,CI,W8b,V8b);var X8b;bcb(1540,1,ene,b9b);_.pf=function c9b(a,b){_8b(BD(a,37),b)};var BS=mdb(Ane,'InvertedPortProcessor',1540);bcb(1541,1,ene,h9b);_.pf=function i9b(a,b){g9b(BD(a,37),b)};var FS=mdb(Ane,'LabelAndNodeSizeProcessor',1541);bcb(1542,1,Oie,j9b);_.Mb=function k9b(a){return BD(a,10).k==(j0b(),h0b)};var CS=mdb(Ane,'LabelAndNodeSizeProcessor/lambda$0$Type',1542);bcb(1543,1,Oie,l9b);_.Mb=function m9b(a){return BD(a,10).k==(j0b(),e0b)};var DS=mdb(Ane,'LabelAndNodeSizeProcessor/lambda$1$Type',1543);bcb(1544,1,qie,n9b);_.td=function o9b(a){e9b(this.b,this.a,this.c,BD(a,10))};_.a=false;_.c=false;var ES=mdb(Ane,'LabelAndNodeSizeProcessor/lambda$2$Type',1544);bcb(1545,1,ene,u9b);_.pf=function v9b(a,b){s9b(BD(a,37),b)};var p9b;var HS=mdb(Ane,'LabelDummyInserter',1545);bcb(1546,1,Vke,w9b);_.Lb=function x9b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),nad))};_.Fb=function y9b(a){return this===a};_.Mb=function z9b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),nad))};var GS=mdb(Ane,'LabelDummyInserter/1',1546);bcb(1547,1,ene,D9b);_.pf=function E9b(a,b){C9b(BD(a,37),b)};var JS=mdb(Ane,'LabelDummyRemover',1547);bcb(1548,1,Oie,F9b);_.Mb=function G9b(a){return Ccb(DD(vNb(BD(a,70),(Nyc(),Pwc))))};var IS=mdb(Ane,'LabelDummyRemover/lambda$0$Type',1548);bcb(1359,1,ene,$9b);_.pf=function cac(a,b){W9b(this,BD(a,37),b)};_.a=null;var H9b;var QS=mdb(Ane,'LabelDummySwitcher',1359);bcb(286,1,{286:1},gac);_.c=0;_.d=null;_.f=0;var KS=mdb(Ane,'LabelDummySwitcher/LabelDummyInfo',286);bcb(1360,1,{},hac);_.Kb=function iac(a){return I9b(),new YAb(null,new Kub(BD(a,29).a,16))};var LS=mdb(Ane,'LabelDummySwitcher/lambda$0$Type',1360);bcb(1361,1,Oie,jac);_.Mb=function kac(a){return I9b(),BD(a,10).k==(j0b(),f0b)};var MS=mdb(Ane,'LabelDummySwitcher/lambda$1$Type',1361);bcb(1362,1,{},lac);_.Kb=function mac(a){return _9b(this.a,BD(a,10))};var NS=mdb(Ane,'LabelDummySwitcher/lambda$2$Type',1362);bcb(1363,1,qie,nac);_.td=function oac(a){aac(this.a,BD(a,286))};var OS=mdb(Ane,'LabelDummySwitcher/lambda$3$Type',1363);bcb(1364,1,Dke,pac);_.ue=function qac(a,b){return bac(BD(a,286),BD(b,286))};_.Fb=function rac(a){return this===a};_.ve=function sac(){return new tpb(this)};var PS=mdb(Ane,'LabelDummySwitcher/lambda$4$Type',1364);bcb(791,1,ene,uac);_.pf=function vac(a,b){tac(BD(a,37),b)};var RS=mdb(Ane,'LabelManagementProcessor',791);bcb(1549,1,ene,Iac);_.pf=function Jac(a,b){Cac(BD(a,37),b)};var TS=mdb(Ane,'LabelSideSelector',1549);bcb(1550,1,Oie,Kac);_.Mb=function Lac(a){return Ccb(DD(vNb(BD(a,70),(Nyc(),Pwc))))};var SS=mdb(Ane,'LabelSideSelector/lambda$0$Type',1550);bcb(1558,1,ene,Sac);_.pf=function Tac(a,b){Oac(BD(a,37),b)};var US=mdb(Ane,'LayerConstraintPostprocessor',1558);bcb(1559,1,ene,abc);_.pf=function bbc(a,b){$ac(BD(a,37),b)};var Uac;var WS=mdb(Ane,'LayerConstraintPreprocessor',1559);bcb(360,22,{3:1,35:1,22:1,360:1},ibc);var cbc,dbc,ebc,fbc;var VS=ndb(Ane,'LayerConstraintPreprocessor/HiddenNodeConnections',360,CI,kbc,jbc);var lbc;bcb(1560,1,ene,obc);_.pf=function pbc(a,b){nbc(BD(a,37),b)};var XS=mdb(Ane,'LayerSizeAndGraphHeightCalculator',1560);bcb(1561,1,ene,rbc);_.pf=function tbc(a,b){qbc(BD(a,37),b)};var YS=mdb(Ane,'LongEdgeJoiner',1561);bcb(1562,1,ene,vbc);_.pf=function xbc(a,b){ubc(BD(a,37),b)};var ZS=mdb(Ane,'LongEdgeSplitter',1562);bcb(1563,1,ene,Fbc);_.pf=function Ibc(a,b){Bbc(this,BD(a,37),b)};_.d=0;_.e=0;_.i=0;_.j=0;_.k=0;_.n=0;var bT=mdb(Ane,'NodePromotion',1563);bcb(1564,1,{},Jbc);_.Kb=function Kbc(a){return BD(a,46),Bcb(),true};_.Fb=function Lbc(a){return this===a};var $S=mdb(Ane,'NodePromotion/lambda$0$Type',1564);bcb(1565,1,{},Mbc);_.Kb=function Nbc(a){return Gbc(this.a,BD(a,46))};_.Fb=function Obc(a){return this===a};_.a=0;var _S=mdb(Ane,'NodePromotion/lambda$1$Type',1565);bcb(1566,1,{},Pbc);_.Kb=function Qbc(a){return Hbc(this.a,BD(a,46))};_.Fb=function Rbc(a){return this===a};_.a=0;var aT=mdb(Ane,'NodePromotion/lambda$2$Type',1566);bcb(1567,1,ene,Xbc);_.pf=function Ybc(a,b){Sbc(BD(a,37),b)};var cT=mdb(Ane,'NorthSouthPortPostprocessor',1567);bcb(1568,1,ene,ccc);_.pf=function ecc(a,b){acc(BD(a,37),b)};var eT=mdb(Ane,'NorthSouthPortPreprocessor',1568);bcb(1569,1,Dke,fcc);_.ue=function gcc(a,b){return dcc(BD(a,11),BD(b,11))};_.Fb=function hcc(a){return this===a};_.ve=function icc(){return new tpb(this)};var dT=mdb(Ane,'NorthSouthPortPreprocessor/lambda$0$Type',1569);bcb(1570,1,ene,lcc);_.pf=function ncc(a,b){kcc(BD(a,37),b)};var hT=mdb(Ane,'PartitionMidprocessor',1570);bcb(1571,1,Oie,occ);_.Mb=function pcc(a){return wNb(BD(a,10),(Nyc(),Nxc))};var fT=mdb(Ane,'PartitionMidprocessor/lambda$0$Type',1571);bcb(1572,1,qie,qcc);_.td=function rcc(a){mcc(this.a,BD(a,10))};var gT=mdb(Ane,'PartitionMidprocessor/lambda$1$Type',1572);bcb(1573,1,ene,tcc);_.pf=function ucc(a,b){scc(BD(a,37),b)};var iT=mdb(Ane,'PartitionPostprocessor',1573);bcb(1574,1,ene,ycc);_.pf=function zcc(a,b){wcc(BD(a,37),b)};var nT=mdb(Ane,'PartitionPreprocessor',1574);bcb(1575,1,Oie,Acc);_.Mb=function Bcc(a){return wNb(BD(a,10),(Nyc(),Nxc))};var jT=mdb(Ane,'PartitionPreprocessor/lambda$0$Type',1575);bcb(1576,1,{},Ccc);_.Kb=function Dcc(a){return new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var kT=mdb(Ane,'PartitionPreprocessor/lambda$1$Type',1576);bcb(1577,1,Oie,Ecc);_.Mb=function Fcc(a){return vcc(BD(a,17))};var lT=mdb(Ane,'PartitionPreprocessor/lambda$2$Type',1577);bcb(1578,1,qie,Gcc);_.td=function Hcc(a){xcc(BD(a,17))};var mT=mdb(Ane,'PartitionPreprocessor/lambda$3$Type',1578);bcb(1579,1,ene,Tcc);_.pf=function Xcc(a,b){Qcc(BD(a,37),b)};var Icc,Jcc,Kcc,Lcc,Mcc,Ncc;var tT=mdb(Ane,'PortListSorter',1579);bcb(1580,1,{},Zcc);_.Kb=function $cc(a){return Occ(),BD(a,11).e};var oT=mdb(Ane,'PortListSorter/lambda$0$Type',1580);bcb(1581,1,{},_cc);_.Kb=function adc(a){return Occ(),BD(a,11).g};var pT=mdb(Ane,'PortListSorter/lambda$1$Type',1581);bcb(1582,1,Dke,bdc);_.ue=function cdc(a,b){return Ucc(BD(a,11),BD(b,11))};_.Fb=function ddc(a){return this===a};_.ve=function edc(){return new tpb(this)};var qT=mdb(Ane,'PortListSorter/lambda$2$Type',1582);bcb(1583,1,Dke,fdc);_.ue=function gdc(a,b){return Vcc(BD(a,11),BD(b,11))};_.Fb=function hdc(a){return this===a};_.ve=function idc(){return new tpb(this)};var rT=mdb(Ane,'PortListSorter/lambda$3$Type',1583);bcb(1584,1,Dke,jdc);_.ue=function kdc(a,b){return Wcc(BD(a,11),BD(b,11))};_.Fb=function ldc(a){return this===a};_.ve=function mdc(){return new tpb(this)};var sT=mdb(Ane,'PortListSorter/lambda$4$Type',1584);bcb(1585,1,ene,pdc);_.pf=function qdc(a,b){ndc(BD(a,37),b)};var uT=mdb(Ane,'PortSideProcessor',1585);bcb(1586,1,ene,sdc);_.pf=function tdc(a,b){rdc(BD(a,37),b)};var vT=mdb(Ane,'ReversedEdgeRestorer',1586);bcb(1591,1,ene,wdc);_.pf=function xdc(a,b){udc(this,BD(a,37),b)};var CT=mdb(Ane,'SelfLoopPortRestorer',1591);bcb(1592,1,{},ydc);_.Kb=function zdc(a){return new YAb(null,new Kub(BD(a,29).a,16))};var wT=mdb(Ane,'SelfLoopPortRestorer/lambda$0$Type',1592);bcb(1593,1,Oie,Adc);_.Mb=function Bdc(a){return BD(a,10).k==(j0b(),h0b)};var xT=mdb(Ane,'SelfLoopPortRestorer/lambda$1$Type',1593);bcb(1594,1,Oie,Cdc);_.Mb=function Ddc(a){return wNb(BD(a,10),(wtc(),ntc))};var yT=mdb(Ane,'SelfLoopPortRestorer/lambda$2$Type',1594);bcb(1595,1,{},Edc);_.Kb=function Fdc(a){return BD(vNb(BD(a,10),(wtc(),ntc)),403)};var zT=mdb(Ane,'SelfLoopPortRestorer/lambda$3$Type',1595);bcb(1596,1,qie,Gdc);_.td=function Hdc(a){vdc(this.a,BD(a,403))};var AT=mdb(Ane,'SelfLoopPortRestorer/lambda$4$Type',1596);bcb(794,1,qie,Idc);_.td=function Jdc(a){ljc(BD(a,101))};var BT=mdb(Ane,'SelfLoopPortRestorer/lambda$5$Type',794);bcb(1597,1,ene,Ndc);_.pf=function Pdc(a,b){Kdc(BD(a,37),b)};var LT=mdb(Ane,'SelfLoopPostProcessor',1597);bcb(1598,1,{},Qdc);_.Kb=function Rdc(a){return new YAb(null,new Kub(BD(a,29).a,16))};var DT=mdb(Ane,'SelfLoopPostProcessor/lambda$0$Type',1598);bcb(1599,1,Oie,Sdc);_.Mb=function Tdc(a){return BD(a,10).k==(j0b(),h0b)};var ET=mdb(Ane,'SelfLoopPostProcessor/lambda$1$Type',1599);bcb(1600,1,Oie,Udc);_.Mb=function Vdc(a){return wNb(BD(a,10),(wtc(),ntc))};var FT=mdb(Ane,'SelfLoopPostProcessor/lambda$2$Type',1600);bcb(1601,1,qie,Wdc);_.td=function Xdc(a){Ldc(BD(a,10))};var GT=mdb(Ane,'SelfLoopPostProcessor/lambda$3$Type',1601);bcb(1602,1,{},Ydc);_.Kb=function Zdc(a){return new YAb(null,new Kub(BD(a,101).f,1))};var HT=mdb(Ane,'SelfLoopPostProcessor/lambda$4$Type',1602);bcb(1603,1,qie,$dc);_.td=function _dc(a){Mdc(this.a,BD(a,409))};var IT=mdb(Ane,'SelfLoopPostProcessor/lambda$5$Type',1603);bcb(1604,1,Oie,aec);_.Mb=function bec(a){return !!BD(a,101).i};var JT=mdb(Ane,'SelfLoopPostProcessor/lambda$6$Type',1604);bcb(1605,1,qie,cec);_.td=function dec(a){Odc(this.a,BD(a,101))};var KT=mdb(Ane,'SelfLoopPostProcessor/lambda$7$Type',1605);bcb(1587,1,ene,hec);_.pf=function iec(a,b){gec(BD(a,37),b)};var PT=mdb(Ane,'SelfLoopPreProcessor',1587);bcb(1588,1,{},jec);_.Kb=function kec(a){return new YAb(null,new Kub(BD(a,101).f,1))};var MT=mdb(Ane,'SelfLoopPreProcessor/lambda$0$Type',1588);bcb(1589,1,{},lec);_.Kb=function mec(a){return BD(a,409).a};var NT=mdb(Ane,'SelfLoopPreProcessor/lambda$1$Type',1589);bcb(1590,1,qie,nec);_.td=function oec(a){fec(BD(a,17))};var OT=mdb(Ane,'SelfLoopPreProcessor/lambda$2$Type',1590);bcb(1606,1,ene,sec);_.pf=function tec(a,b){qec(this,BD(a,37),b)};var VT=mdb(Ane,'SelfLoopRouter',1606);bcb(1607,1,{},uec);_.Kb=function vec(a){return new YAb(null,new Kub(BD(a,29).a,16))};var QT=mdb(Ane,'SelfLoopRouter/lambda$0$Type',1607);bcb(1608,1,Oie,wec);_.Mb=function xec(a){return BD(a,10).k==(j0b(),h0b)};var RT=mdb(Ane,'SelfLoopRouter/lambda$1$Type',1608);bcb(1609,1,Oie,yec);_.Mb=function zec(a){return wNb(BD(a,10),(wtc(),ntc))};var ST=mdb(Ane,'SelfLoopRouter/lambda$2$Type',1609);bcb(1610,1,{},Aec);_.Kb=function Bec(a){return BD(vNb(BD(a,10),(wtc(),ntc)),403)};var TT=mdb(Ane,'SelfLoopRouter/lambda$3$Type',1610);bcb(1611,1,qie,Cec);_.td=function Dec(a){pec(this.a,this.b,BD(a,403))};var UT=mdb(Ane,'SelfLoopRouter/lambda$4$Type',1611);bcb(1612,1,ene,Fec);_.pf=function Iec(a,b){Eec(BD(a,37),b)};var $T=mdb(Ane,'SemiInteractiveCrossMinProcessor',1612);bcb(1613,1,Oie,Jec);_.Mb=function Kec(a){return BD(a,10).k==(j0b(),h0b)};var WT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$0$Type',1613);bcb(1614,1,Oie,Lec);_.Mb=function Mec(a){return uNb(BD(a,10))._b((Nyc(),ayc))};var XT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$1$Type',1614);bcb(1615,1,Dke,Nec);_.ue=function Oec(a,b){return Gec(BD(a,10),BD(b,10))};_.Fb=function Pec(a){return this===a};_.ve=function Qec(){return new tpb(this)};var YT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$2$Type',1615);bcb(1616,1,{},Rec);_.Ce=function Sec(a,b){return Hec(BD(a,10),BD(b,10))};var ZT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$3$Type',1616);bcb(1618,1,ene,Uec);_.pf=function Yec(a,b){Tec(BD(a,37),b)};var bU=mdb(Ane,'SortByInputModelProcessor',1618);bcb(1619,1,Oie,Zec);_.Mb=function $ec(a){return BD(a,11).g.c.length!=0};var _T=mdb(Ane,'SortByInputModelProcessor/lambda$0$Type',1619);bcb(1620,1,qie,_ec);_.td=function afc(a){Wec(this.a,BD(a,11))};var aU=mdb(Ane,'SortByInputModelProcessor/lambda$1$Type',1620);bcb(1693,803,{},jfc);_.Me=function kfc(a){var b,c,d,e;this.c=a;switch(this.a.g){case 2:b=new Rkb;MAb(JAb(new YAb(null,new Kub(this.c.a.b,16)),new lgc),new ngc(this,b));nEb(this,new tfc);Hkb(b,new xfc);b.c=KC(SI,Uhe,1,0,5,1);MAb(JAb(new YAb(null,new Kub(this.c.a.b,16)),new zfc),new Bfc(b));nEb(this,new Ffc);Hkb(b,new Jfc);b.c=KC(SI,Uhe,1,0,5,1);c=Ntb($zb(OAb(new YAb(null,new Kub(this.c.a.b,16)),new Lfc(this))),new Nfc);MAb(new YAb(null,new Kub(this.c.a.a,16)),new Rfc(c,b));nEb(this,new Vfc);Hkb(b,new Zfc);b.c=KC(SI,Uhe,1,0,5,1);break;case 3:d=new Rkb;nEb(this,new lfc);e=Ntb($zb(OAb(new YAb(null,new Kub(this.c.a.b,16)),new pfc(this))),new Pfc);MAb(JAb(new YAb(null,new Kub(this.c.a.b,16)),new _fc),new bgc(e,d));nEb(this,new fgc);Hkb(d,new jgc);d.c=KC(SI,Uhe,1,0,5,1);break;default:throw vbb(new x2c);}};_.b=0;var AU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation',1693);bcb(1694,1,Vke,lfc);_.Lb=function mfc(a){return JD(BD(a,57).g,145)};_.Fb=function nfc(a){return this===a};_.Mb=function ofc(a){return JD(BD(a,57).g,145)};var cU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$0$Type',1694);bcb(1695,1,{},pfc);_.Fe=function qfc(a){return dfc(this.a,BD(a,57))};var dU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$1$Type',1695);bcb(1703,1,Pie,rfc);_.Vd=function sfc(){cfc(this.a,this.b,-1)};_.b=0;var eU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$10$Type',1703);bcb(1705,1,Vke,tfc);_.Lb=function ufc(a){return JD(BD(a,57).g,145)};_.Fb=function vfc(a){return this===a};_.Mb=function wfc(a){return JD(BD(a,57).g,145)};var fU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$11$Type',1705);bcb(1706,1,qie,xfc);_.td=function yfc(a){BD(a,365).Vd()};var gU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$12$Type',1706);bcb(1707,1,Oie,zfc);_.Mb=function Afc(a){return JD(BD(a,57).g,10)};var hU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$13$Type',1707);bcb(1709,1,qie,Bfc);_.td=function Cfc(a){efc(this.a,BD(a,57))};var iU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$14$Type',1709);bcb(1708,1,Pie,Dfc);_.Vd=function Efc(){cfc(this.b,this.a,-1)};_.a=0;var jU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$15$Type',1708);bcb(1710,1,Vke,Ffc);_.Lb=function Gfc(a){return JD(BD(a,57).g,10)};_.Fb=function Hfc(a){return this===a};_.Mb=function Ifc(a){return JD(BD(a,57).g,10)};var kU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$16$Type',1710);bcb(1711,1,qie,Jfc);_.td=function Kfc(a){BD(a,365).Vd()};var lU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$17$Type',1711);bcb(1712,1,{},Lfc);_.Fe=function Mfc(a){return ffc(this.a,BD(a,57))};var mU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$18$Type',1712);bcb(1713,1,{},Nfc);_.De=function Ofc(){return 0};var nU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$19$Type',1713);bcb(1696,1,{},Pfc);_.De=function Qfc(){return 0};var oU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$2$Type',1696);bcb(1715,1,qie,Rfc);_.td=function Sfc(a){gfc(this.a,this.b,BD(a,307))};_.a=0;var pU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$20$Type',1715);bcb(1714,1,Pie,Tfc);_.Vd=function Ufc(){bfc(this.a,this.b,-1)};_.b=0;var qU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$21$Type',1714);bcb(1716,1,Vke,Vfc);_.Lb=function Wfc(a){return BD(a,57),true};_.Fb=function Xfc(a){return this===a};_.Mb=function Yfc(a){return BD(a,57),true};var rU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$22$Type',1716);bcb(1717,1,qie,Zfc);_.td=function $fc(a){BD(a,365).Vd()};var sU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$23$Type',1717);bcb(1697,1,Oie,_fc);_.Mb=function agc(a){return JD(BD(a,57).g,10)};var tU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$3$Type',1697);bcb(1699,1,qie,bgc);_.td=function cgc(a){hfc(this.a,this.b,BD(a,57))};_.a=0;var uU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$4$Type',1699);bcb(1698,1,Pie,dgc);_.Vd=function egc(){cfc(this.b,this.a,-1)};_.a=0;var vU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$5$Type',1698);bcb(1700,1,Vke,fgc);_.Lb=function ggc(a){return BD(a,57),true};_.Fb=function hgc(a){return this===a};_.Mb=function igc(a){return BD(a,57),true};var wU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$6$Type',1700);bcb(1701,1,qie,jgc);_.td=function kgc(a){BD(a,365).Vd()};var xU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$7$Type',1701);bcb(1702,1,Oie,lgc);_.Mb=function mgc(a){return JD(BD(a,57).g,145)};var yU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$8$Type',1702);bcb(1704,1,qie,ngc);_.td=function ogc(a){ifc(this.a,this.b,BD(a,57))};var zU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$9$Type',1704);bcb(1521,1,ene,sgc);_.pf=function xgc(a,b){rgc(this,BD(a,37),b)};var pgc;var EU=mdb(Jne,'HorizontalGraphCompactor',1521);bcb(1522,1,{},ygc);_.Oe=function zgc(a,b){var c,d,e;if(vgc(a,b)){return 0}c=tgc(a);d=tgc(b);if(!!c&&c.k==(j0b(),e0b)||!!d&&d.k==(j0b(),e0b)){return 0}e=BD(vNb(this.a.a,(wtc(),otc)),304);return fBc(e,c?c.k:(j0b(),g0b),d?d.k:(j0b(),g0b))};_.Pe=function Agc(a,b){var c,d,e;if(vgc(a,b)){return 1}c=tgc(a);d=tgc(b);e=BD(vNb(this.a.a,(wtc(),otc)),304);return iBc(e,c?c.k:(j0b(),g0b),d?d.k:(j0b(),g0b))};var BU=mdb(Jne,'HorizontalGraphCompactor/1',1522);bcb(1523,1,{},Bgc);_.Ne=function Cgc(a,b){return qgc(),a.a.i==0};var CU=mdb(Jne,'HorizontalGraphCompactor/lambda$0$Type',1523);bcb(1524,1,{},Dgc);_.Ne=function Egc(a,b){return wgc(this.a,a,b)};var DU=mdb(Jne,'HorizontalGraphCompactor/lambda$1$Type',1524);bcb(1664,1,{},Ygc);var Fgc,Ggc;var cV=mdb(Jne,'LGraphToCGraphTransformer',1664);bcb(1672,1,Oie,ehc);_.Mb=function fhc(a){return a!=null};var FU=mdb(Jne,'LGraphToCGraphTransformer/0methodref$nonNull$Type',1672);bcb(1665,1,{},ghc);_.Kb=function hhc(a){return Hgc(),fcb(vNb(BD(BD(a,57).g,10),(wtc(),$sc)))};var GU=mdb(Jne,'LGraphToCGraphTransformer/lambda$0$Type',1665);bcb(1666,1,{},ihc);_.Kb=function jhc(a){return Hgc(),gic(BD(BD(a,57).g,145))};var HU=mdb(Jne,'LGraphToCGraphTransformer/lambda$1$Type',1666);bcb(1675,1,Oie,khc);_.Mb=function lhc(a){return Hgc(),JD(BD(a,57).g,10)};var IU=mdb(Jne,'LGraphToCGraphTransformer/lambda$10$Type',1675);bcb(1676,1,qie,mhc);_.td=function nhc(a){Zgc(BD(a,57))};var JU=mdb(Jne,'LGraphToCGraphTransformer/lambda$11$Type',1676);bcb(1677,1,Oie,ohc);_.Mb=function phc(a){return Hgc(),JD(BD(a,57).g,145)};var KU=mdb(Jne,'LGraphToCGraphTransformer/lambda$12$Type',1677);bcb(1681,1,qie,qhc);_.td=function rhc(a){$gc(BD(a,57))};var LU=mdb(Jne,'LGraphToCGraphTransformer/lambda$13$Type',1681);bcb(1678,1,qie,shc);_.td=function thc(a){_gc(this.a,BD(a,8))};_.a=0;var MU=mdb(Jne,'LGraphToCGraphTransformer/lambda$14$Type',1678);bcb(1679,1,qie,uhc);_.td=function vhc(a){ahc(this.a,BD(a,110))};_.a=0;var NU=mdb(Jne,'LGraphToCGraphTransformer/lambda$15$Type',1679);bcb(1680,1,qie,whc);_.td=function xhc(a){bhc(this.a,BD(a,8))};_.a=0;var OU=mdb(Jne,'LGraphToCGraphTransformer/lambda$16$Type',1680);bcb(1682,1,{},yhc);_.Kb=function zhc(a){return Hgc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var PU=mdb(Jne,'LGraphToCGraphTransformer/lambda$17$Type',1682);bcb(1683,1,Oie,Ahc);_.Mb=function Bhc(a){return Hgc(),OZb(BD(a,17))};var QU=mdb(Jne,'LGraphToCGraphTransformer/lambda$18$Type',1683);bcb(1684,1,qie,Chc);_.td=function Dhc(a){Qgc(this.a,BD(a,17))};var RU=mdb(Jne,'LGraphToCGraphTransformer/lambda$19$Type',1684);bcb(1668,1,qie,Ehc);_.td=function Fhc(a){Rgc(this.a,BD(a,145))};var SU=mdb(Jne,'LGraphToCGraphTransformer/lambda$2$Type',1668);bcb(1685,1,{},Ghc);_.Kb=function Hhc(a){return Hgc(),new YAb(null,new Kub(BD(a,29).a,16))};var TU=mdb(Jne,'LGraphToCGraphTransformer/lambda$20$Type',1685);bcb(1686,1,{},Ihc);_.Kb=function Jhc(a){return Hgc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var UU=mdb(Jne,'LGraphToCGraphTransformer/lambda$21$Type',1686);bcb(1687,1,{},Khc);_.Kb=function Lhc(a){return Hgc(),BD(vNb(BD(a,17),(wtc(),rtc)),15)};var VU=mdb(Jne,'LGraphToCGraphTransformer/lambda$22$Type',1687);bcb(1688,1,Oie,Mhc);_.Mb=function Nhc(a){return chc(BD(a,15))};var WU=mdb(Jne,'LGraphToCGraphTransformer/lambda$23$Type',1688);bcb(1689,1,qie,Ohc);_.td=function Phc(a){Jgc(this.a,BD(a,15))};var XU=mdb(Jne,'LGraphToCGraphTransformer/lambda$24$Type',1689);bcb(1667,1,qie,Qhc);_.td=function Rhc(a){Sgc(this.a,this.b,BD(a,145))};var YU=mdb(Jne,'LGraphToCGraphTransformer/lambda$3$Type',1667);bcb(1669,1,{},Shc);_.Kb=function Thc(a){return Hgc(),new YAb(null,new Kub(BD(a,29).a,16))};var ZU=mdb(Jne,'LGraphToCGraphTransformer/lambda$4$Type',1669);bcb(1670,1,{},Uhc);_.Kb=function Vhc(a){return Hgc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var $U=mdb(Jne,'LGraphToCGraphTransformer/lambda$5$Type',1670);bcb(1671,1,{},Whc);_.Kb=function Xhc(a){return Hgc(),BD(vNb(BD(a,17),(wtc(),rtc)),15)};var _U=mdb(Jne,'LGraphToCGraphTransformer/lambda$6$Type',1671);bcb(1673,1,qie,Yhc);_.td=function Zhc(a){dhc(this.a,BD(a,15))};var aV=mdb(Jne,'LGraphToCGraphTransformer/lambda$8$Type',1673);bcb(1674,1,qie,$hc);_.td=function _hc(a){Tgc(this.a,this.b,BD(a,145))};var bV=mdb(Jne,'LGraphToCGraphTransformer/lambda$9$Type',1674);bcb(1663,1,{},dic);_.Le=function eic(a){var b,c,d,e,f;this.a=a;this.d=new KFb;this.c=KC(jN,Uhe,121,this.a.a.a.c.length,0,1);this.b=0;for(c=new olb(this.a.a.a);c.a=p){Ekb(f,meb(k));s=$wnd.Math.max(s,t[k-1]-l);h+=o;q+=t[k-1]-q;l=t[k-1];o=i[k]}o=$wnd.Math.max(o,i[k]);++k}h+=o}n=$wnd.Math.min(1/s,1/b.b/h);if(n>d){d=n;c=f}}return c};_.Wf=function mpc(){return false};var CW=mdb(Rne,'MSDCutIndexHeuristic',802);bcb(1617,1,ene,ppc);_.pf=function qpc(a,b){opc(BD(a,37),b)};var DW=mdb(Rne,'SingleEdgeGraphWrapper',1617);bcb(227,22,{3:1,35:1,22:1,227:1},Bpc);var upc,vpc,wpc,xpc,ypc,zpc;var EW=ndb(Sne,'CenterEdgeLabelPlacementStrategy',227,CI,Dpc,Cpc);var Epc;bcb(422,22,{3:1,35:1,22:1,422:1},Jpc);var Gpc,Hpc;var FW=ndb(Sne,'ConstraintCalculationStrategy',422,CI,Lpc,Kpc);var Mpc;bcb(314,22,{3:1,35:1,22:1,314:1,246:1,234:1},Tpc);_.Kf=function Vpc(){return Spc(this)};_.Xf=function Upc(){return Spc(this)};var Opc,Ppc,Qpc;var GW=ndb(Sne,'CrossingMinimizationStrategy',314,CI,Xpc,Wpc);var Ypc;bcb(337,22,{3:1,35:1,22:1,337:1},cqc);var $pc,_pc,aqc;var HW=ndb(Sne,'CuttingStrategy',337,CI,eqc,dqc);var fqc;bcb(335,22,{3:1,35:1,22:1,335:1,246:1,234:1},oqc);_.Kf=function qqc(){return nqc(this)};_.Xf=function pqc(){return nqc(this)};var hqc,iqc,jqc,kqc,lqc;var IW=ndb(Sne,'CycleBreakingStrategy',335,CI,sqc,rqc);var tqc;bcb(419,22,{3:1,35:1,22:1,419:1},yqc);var vqc,wqc;var JW=ndb(Sne,'DirectionCongruency',419,CI,Aqc,zqc);var Bqc;bcb(450,22,{3:1,35:1,22:1,450:1},Hqc);var Dqc,Eqc,Fqc;var KW=ndb(Sne,'EdgeConstraint',450,CI,Jqc,Iqc);var Kqc;bcb(276,22,{3:1,35:1,22:1,276:1},Uqc);var Mqc,Nqc,Oqc,Pqc,Qqc,Rqc;var LW=ndb(Sne,'EdgeLabelSideSelection',276,CI,Wqc,Vqc);var Xqc;bcb(479,22,{3:1,35:1,22:1,479:1},arc);var Zqc,$qc;var MW=ndb(Sne,'EdgeStraighteningStrategy',479,CI,crc,brc);var drc;bcb(274,22,{3:1,35:1,22:1,274:1},mrc);var frc,grc,hrc,irc,jrc,krc;var NW=ndb(Sne,'FixedAlignment',274,CI,orc,nrc);var prc;bcb(275,22,{3:1,35:1,22:1,275:1},zrc);var rrc,trc,urc,vrc,wrc,xrc;var OW=ndb(Sne,'GraphCompactionStrategy',275,CI,Brc,Arc);var Crc;bcb(256,22,{3:1,35:1,22:1,256:1},Prc);var Erc,Frc,Grc,Hrc,Irc,Jrc,Krc,Lrc,Mrc,Nrc;var PW=ndb(Sne,'GraphProperties',256,CI,Rrc,Qrc);var Src;bcb(292,22,{3:1,35:1,22:1,292:1},Yrc);var Urc,Vrc,Wrc;var QW=ndb(Sne,'GreedySwitchType',292,CI,$rc,Zrc);var _rc;bcb(303,22,{3:1,35:1,22:1,303:1},fsc);var bsc,csc,dsc;var RW=ndb(Sne,'InLayerConstraint',303,CI,hsc,gsc);var isc;bcb(420,22,{3:1,35:1,22:1,420:1},nsc);var ksc,lsc;var SW=ndb(Sne,'InteractiveReferencePoint',420,CI,psc,osc);var qsc;var ssc,tsc,usc,vsc,wsc,xsc,ysc,zsc,Asc,Bsc,Csc,Dsc,Esc,Fsc,Gsc,Hsc,Isc,Jsc,Ksc,Lsc,Msc,Nsc,Osc,Psc,Qsc,Rsc,Ssc,Tsc,Usc,Vsc,Wsc,Xsc,Ysc,Zsc,$sc,_sc,atc,btc,ctc,dtc,etc,ftc,gtc,htc,itc,jtc,ktc,ltc,mtc,ntc,otc,ptc,qtc,rtc,stc,ttc,utc,vtc;bcb(163,22,{3:1,35:1,22:1,163:1},Dtc);var xtc,ytc,ztc,Atc,Btc;var TW=ndb(Sne,'LayerConstraint',163,CI,Ftc,Etc);var Gtc;bcb(848,1,ale,kwc);_.Qe=function lwc(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Yne),''),'Direction Congruency'),'Specifies how drawings of the same graph with different layout directions compare to each other: either a natural reading direction is preserved or the drawings are rotated versions of each other.'),puc),(_5c(),V5c)),JW),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zne),''),'Feedback Edges'),'Whether feedback edges should be highlighted by routing around the nodes.'),(Bcb(),false)),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$ne),''),'Interactive Reference Point'),'Determines which point of a node is considered by interactive layout phases.'),Muc),V5c),SW),pqb(L5c))));o4c(a,$ne,goe,Ouc);o4c(a,$ne,qoe,Nuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,_ne),''),'Merge Edges'),'Edges that have no ports are merged so they touch the connected nodes at the same points. When this option is disabled, one port is created for each edge directly connected to a node. When it is enabled, all such incoming edges share an input port, and all outgoing edges share an output port.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,aoe),''),'Merge Hierarchy-Crossing Edges'),'If hierarchical layout is active, hierarchy-crossing edges use as few hierarchical ports as possible. They are broken by the algorithm, with hierarchical ports inserted as required. Usually, one such port is created for each edge at each hierarchy crossing point. With this option set to true, we try to create as few hierarchical ports as possible in the process. In particular, all edges that form a hyperedge can share a port.'),true),T5c),wI),pqb(L5c))));t4c(a,new p5c(C5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,boe),''),'Allow Non-Flow Ports To Switch Sides'),"Specifies whether non-flow ports may switch sides if their node's port constraints are either FIXED_SIDE or FIXED_ORDER. A non-flow port is a port on a side that is not part of the currently configured layout flow. For instance, given a left-to-right layout direction, north and south ports would be considered non-flow ports. Further note that the underlying criterium whether to switch sides or not solely relies on the minimization of edge crossings. Hence, edge length and other aesthetics criteria are not addressed."),false),T5c),wI),pqb(M5c)),OC(GC(ZI,1),nie,2,6,['org.eclipse.elk.layered.northOrSouthPort']))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,coe),''),'Port Sorting Strategy'),"Only relevant for nodes with FIXED_SIDE port constraints. Determines the way a node's ports are distributed on the sides of a node if their order is not prescribed. The option is set on parent nodes."),xvc),V5c),cX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,doe),''),'Thoroughness'),'How much effort should be spent to produce a nice layout.'),meb(7)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,eoe),''),'Add Unnecessary Bendpoints'),'Adds bend points even if an edge does not change direction. If true, each long edge dummy will contribute a bend point to its edges and hierarchy-crossing edges will always get a bend point where they cross hierarchy boundaries. By default, bend points are only added where an edge changes direction.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,foe),''),'Generate Position and Layer IDs'),'If enabled position id and layer id are generated, which are usually only used internally when setting the interactiveLayout option. This option should be specified on the root node.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,goe),'cycleBreaking'),'Cycle Breaking Strategy'),'Strategy for cycle breaking. Cycle breaking looks for cycles in the graph and determines which edges to reverse to break the cycles. Reversed edges will end up pointing to the opposite direction of regular edges (that is, reversed edges will point left if edges usually point right).'),nuc),V5c),IW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,hoe),ppe),'Node Layering Strategy'),'Strategy for node layering.'),bvc),V5c),YW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ioe),ppe),'Layer Constraint'),'Determines a constraint on the placement of the node regarding the layering.'),Tuc),V5c),TW),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,joe),ppe),'Layer Choice Constraint'),"Allows to set a constraint regarding the layer placement of a node. Let i be the value of teh constraint. Assumed the drawing has n layers and i < n. If set to i, it expresses that the node should be placed in i-th layer. Should i>=n be true then the node is placed in the last layer of the drawing. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,koe),ppe),'Layer ID'),'Layer identifier that was calculated by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set.'),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,loe),qpe),'Upper Bound On Width [MinWidth Layerer]'),"Defines a loose upper bound on the width of the MinWidth layerer. If set to '-1' multiple values are tested and the best result is selected."),meb(4)),X5c),JI),pqb(L5c))));o4c(a,loe,hoe,Wuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,moe),qpe),'Upper Layer Estimation Scaling Factor [MinWidth Layerer]'),"Multiplied with Upper Bound On Width for defining an upper bound on the width of layers which haven't been determined yet, but whose maximum width had been (roughly) estimated by the MinWidth algorithm. Compensates for too high estimations. If set to '-1' multiple values are tested and the best result is selected."),meb(2)),X5c),JI),pqb(L5c))));o4c(a,moe,hoe,Yuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,noe),rpe),'Node Promotion Strategy'),'Reduces number of dummy nodes after layering phase (if possible).'),_uc),V5c),aX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ooe),rpe),'Max Node Promotion Iterations'),'Limits the number of iterations for node promotion.'),meb(0)),X5c),JI),pqb(L5c))));o4c(a,ooe,noe,null);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,poe),'layering.coffmanGraham'),'Layer Bound'),'The maximum number of nodes allowed per layer.'),meb(Ohe)),X5c),JI),pqb(L5c))));o4c(a,poe,hoe,Quc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,qoe),spe),'Crossing Minimization Strategy'),'Strategy for crossing minimization.'),luc),V5c),GW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,roe),spe),'Force Node Model Order'),'The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,soe),spe),'Hierarchical Sweepiness'),'How likely it is to use cross-hierarchy (1) vs bottom-up (-1).'),0.1),U5c),BI),pqb(L5c))));o4c(a,soe,tpe,fuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,toe),spe),'Semi-Interactive Crossing Minimization'),"Preserves the order of nodes within a layer but still minimizes crossings between edges connecting long edge dummies. Derives the desired order from positions specified by the 'org.eclipse.elk.position' layout option. Requires a crossing minimization strategy that is able to process 'in-layer' constraints."),false),T5c),wI),pqb(L5c))));o4c(a,toe,qoe,juc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,uoe),spe),'Position Choice Constraint'),"Allows to set a constraint regarding the position placement of a node in a layer. Assumed the layer in which the node placed includes n other nodes and i < n. If set to i, it expresses that the node should be placed at the i-th position. Should i>=n be true then the node is placed at the last position in the layer. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,voe),spe),'Position ID'),'Position within a layer that was determined by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set.'),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,woe),upe),'Greedy Switch Activation Threshold'),"By default it is decided automatically if the greedy switch is activated or not. The decision is based on whether the size of the input graph (without dummy nodes) is smaller than the value of this option. A '0' enforces the activation."),meb(40)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xoe),upe),'Greedy Switch Crossing Minimization'),"Greedy Switch strategy for crossing minimization. The greedy switch heuristic is executed after the regular crossing minimization as a post-processor. Note that if 'hierarchyHandling' is set to 'INCLUDE_CHILDREN', the 'greedySwitchHierarchical.type' option must be used."),cuc),V5c),QW),pqb(L5c))));o4c(a,xoe,qoe,duc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,yoe),'crossingMinimization.greedySwitchHierarchical'),'Greedy Switch Crossing Minimization (hierarchical)'),"Activates the greedy switch heuristic in case hierarchical layout is used. The differences to the non-hierarchical case (see 'greedySwitch.type') are: 1) greedy switch is inactive by default, 3) only the option value set on the node at which hierarchical layout starts is relevant, and 2) if it's activated by the user, it properly addresses hierarchy-crossing edges."),$tc),V5c),QW),pqb(L5c))));o4c(a,yoe,qoe,_tc);o4c(a,yoe,tpe,auc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,zoe),vpe),'Node Placement Strategy'),'Strategy for node placement.'),vvc),V5c),_W),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Aoe),vpe),'Favor Straight Edges Over Balancing'),"Favor straight edges over a balanced node placement. The default behavior is determined automatically based on the used 'edgeRouting'. For an orthogonal style it is set to true, for all other styles to false."),T5c),wI),pqb(L5c))));o4c(a,Aoe,zoe,lvc);o4c(a,Aoe,zoe,mvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Boe),wpe),'BK Edge Straightening'),"Specifies whether the Brandes Koepf node placer tries to increase the number of straight edges at the expense of diagram size. There is a subtle difference to the 'favorStraightEdges' option, which decides whether a balanced placement of the nodes is desired, or not. In bk terms this means combining the four alignments into a single balanced one, or not. This option on the other hand tries to straighten additional edges during the creation of each of the four alignments."),fvc),V5c),MW),pqb(L5c))));o4c(a,Boe,zoe,gvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Coe),wpe),'BK Fixed Alignment'),'Tells the BK node placer to use a certain alignment (out of its four) instead of the one producing the smallest height, or the combination of all four.'),ivc),V5c),NW),pqb(L5c))));o4c(a,Coe,zoe,jvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Doe),'nodePlacement.linearSegments'),'Linear Segments Deflection Dampening'),'Dampens the movement of nodes to keep the diagram from getting too large.'),0.3),U5c),BI),pqb(L5c))));o4c(a,Doe,zoe,ovc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Eoe),'nodePlacement.networkSimplex'),'Node Flexibility'),"Aims at shorter and straighter edges. Two configurations are possible: (a) allow ports to move freely on the side they are assigned to (the order is always defined beforehand), (b) additionally allow to enlarge a node wherever it helps. If this option is not configured for a node, the 'nodeFlexibility.default' value is used, which is specified for the node's parent."),V5c),$W),pqb(K5c))));o4c(a,Eoe,zoe,tvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Foe),'nodePlacement.networkSimplex.nodeFlexibility'),'Node Flexibility Default'),"Default value of the 'nodeFlexibility' option for the children of a hierarchical node."),rvc),V5c),$W),pqb(L5c))));o4c(a,Foe,zoe,svc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Goe),xpe),'Self-Loop Distribution'),'Alter the distribution of the loops around the node. It only takes effect for PortConstraints.FREE.'),xuc),V5c),eX),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Hoe),xpe),'Self-Loop Ordering'),'Alter the ordering of the loops they can either be stacked or sequenced. It only takes effect for PortConstraints.FREE.'),zuc),V5c),fX),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ioe),'edgeRouting.splines'),'Spline Routing Mode'),'Specifies the way control points are assembled for each individual edge. CONSERVATIVE ensures that edges are properly routed around the nodes but feels rather orthogonal at times. SLOPPY uses fewer control points to obtain curvier edge routes but may result in edges overlapping nodes.'),Buc),V5c),hX),pqb(L5c))));o4c(a,Ioe,ype,Cuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Joe),'edgeRouting.splines.sloppy'),'Sloppy Spline Layer Spacing Factor'),'Spacing factor for routing area between layers when using sloppy spline routing.'),0.2),U5c),BI),pqb(L5c))));o4c(a,Joe,ype,Euc);o4c(a,Joe,Ioe,Fuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Koe),'edgeRouting.polyline'),'Sloped Edge Zone Width'),'Width of the strip to the left and to the right of each layer where the polyline edge router is allowed to refrain from ensuring that edges are routed horizontally. This prevents awkward bend points for nodes that extent almost to the edge of their layer.'),2),U5c),BI),pqb(L5c))));o4c(a,Koe,ype,vuc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Loe),zpe),'Spacing Base Value'),"An optional base value for all other layout options of the 'spacing' group. It can be used to conveniently alter the overall 'spaciousness' of the drawing. Whenever an explicit value is set for the other layout options, this base value will have no effect. The base value is not inherited, i.e. it must be set for each hierarchical node."),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Moe),zpe),'Edge Node Between Layers Spacing'),"The spacing to be preserved between nodes and edges that are routed next to the node's layer. For the spacing between nodes and edges that cross the node's layer 'spacing.edgeNode' is used."),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Noe),zpe),'Edge Edge Between Layer Spacing'),"Spacing to be preserved between pairs of edges that are routed between the same pair of layers. Note that 'spacing.edgeEdge' is used for the spacing between pairs of edges crossing the same layer."),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ooe),zpe),'Node Node Between Layers Spacing'),"The spacing to be preserved between any pair of nodes of two adjacent layers. Note that 'spacing.nodeNode' is used for the spacing between nodes within the layer itself."),20),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Poe),Ape),'Direction Priority'),'Defines how important it is to have a certain edge point into the direction of the overall layout. This option is evaluated during the cycle breaking phase.'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Qoe),Ape),'Shortness Priority'),'Defines how important it is to keep an edge as short as possible. This option is evaluated during the layering phase.'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Roe),Ape),'Straightness Priority'),'Defines how important it is to keep an edge straight, i.e. aligned with one of the two axes. This option is evaluated during node placement.'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Soe),Bpe),Ole),'Tries to further compact components (disconnected sub-graphs).'),false),T5c),wI),pqb(L5c))));o4c(a,Soe,zme,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Toe),Cpe),'Post Compaction Strategy'),Dpe),Ntc),V5c),OW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Uoe),Cpe),'Post Compaction Constraint Calculation'),Dpe),Ltc),V5c),FW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Voe),Epe),'High Degree Node Treatment'),'Makes room around high degree nodes to place leafs and trees.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Woe),Epe),'High Degree Node Threshold'),'Whether a node is considered to have a high degree.'),meb(16)),X5c),JI),pqb(L5c))));o4c(a,Woe,Voe,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Xoe),Epe),'High Degree Node Maximum Tree Height'),'Maximum height of a subtree connected to a high degree node to be moved to separate layers.'),meb(5)),X5c),JI),pqb(L5c))));o4c(a,Xoe,Voe,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Yoe),Fpe),'Graph Wrapping Strategy'),"For certain graphs and certain prescribed drawing areas it may be desirable to split the laid out graph into chunks that are placed side by side. The edges that connect different chunks are 'wrapped' around from the end of one chunk to the start of the other chunk. The points between the chunks are referred to as 'cuts'."),bwc),V5c),jX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zoe),Fpe),'Additional Wrapped Edges Spacing'),'To visually separate edges that are wrapped from regularly routed edges an additional spacing value can be specified in form of this layout option. The spacing is added to the regular edgeNode spacing.'),10),U5c),BI),pqb(L5c))));o4c(a,Zoe,Yoe,Ivc);o4c(a,Zoe,Yoe,Jvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$oe),Fpe),'Correction Factor for Wrapping'),"At times and for certain types of graphs the executed wrapping may produce results that are consistently biased in the same fashion: either wrapping to often or to rarely. This factor can be used to correct the bias. Internally, it is simply multiplied with the 'aspect ratio' layout option."),1),U5c),BI),pqb(L5c))));o4c(a,$oe,Yoe,Lvc);o4c(a,$oe,Yoe,Mvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,_oe),Gpe),'Cutting Strategy'),'The strategy by which the layer indexes are determined at which the layering crumbles into chunks.'),Tvc),V5c),HW),pqb(L5c))));o4c(a,_oe,Yoe,Uvc);o4c(a,_oe,Yoe,Vvc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,ape),Gpe),'Manually Specified Cuts'),'Allows the user to specify her own cuts for a certain graph.'),Y5c),yK),pqb(L5c))));o4c(a,ape,_oe,Ovc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,bpe),'wrapping.cutting.msd'),'MSD Freedom'),'The MSD cutting strategy starts with an initial guess on the number of chunks the graph should be split into. The freedom specifies how much the strategy may deviate from this guess. E.g. if an initial number of 3 is computed, a freedom of 1 allows 2, 3, and 4 cuts.'),Qvc),X5c),JI),pqb(L5c))));o4c(a,bpe,_oe,Rvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,cpe),Hpe),'Validification Strategy'),'When wrapping graphs, one can specify indices that are not allowed as split points. The validification strategy makes sure every computed split point is allowed.'),gwc),V5c),iX),pqb(L5c))));o4c(a,cpe,Yoe,hwc);o4c(a,cpe,Yoe,iwc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,dpe),Hpe),'Valid Indices for Wrapping'),null),Y5c),yK),pqb(L5c))));o4c(a,dpe,Yoe,dwc);o4c(a,dpe,Yoe,ewc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,epe),Ipe),'Improve Cuts'),'For general graphs it is important that not too many edges wrap backwards. Thus a compromise between evenly-distributed cuts and the total number of cut edges is sought.'),true),T5c),wI),pqb(L5c))));o4c(a,epe,Yoe,Zvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,fpe),Ipe),'Distance Penalty When Improving Cuts'),null),2),U5c),BI),pqb(L5c))));o4c(a,fpe,Yoe,Xvc);o4c(a,fpe,epe,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,gpe),Ipe),'Improve Wrapped Edges'),'The initial wrapping is performed in a very simple way. As a consequence, edges that wrap from one chunk to another may be unnecessarily long. Activating this option tries to shorten such edges.'),true),T5c),wI),pqb(L5c))));o4c(a,gpe,Yoe,_vc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,hpe),Jpe),'Edge Label Side Selection'),'Method to decide on edge label sides.'),tuc),V5c),LW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ipe),Jpe),'Edge Center Label Placement Strategy'),'Determines in which layer center labels of long edges should be placed.'),ruc),V5c),EW),qqb(L5c,OC(GC(e1,1),Kie,175,0,[J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,jpe),Kpe),'Consider Model Order'),'Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting.'),Wtc),V5c),bX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,kpe),Kpe),'No Model Order'),'Set on a node to not set a model order for this node even though it is a real node.'),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,lpe),Kpe),'Consider Model Order for Components'),'If set to NONE the usual ordering strategy (by cumulative node priority and size of nodes) is used. INSIDE_PORT_SIDES orders the components with external ports only inside the groups with the same port side. FORCE_MODEL_ORDER enforces the mode order on components. This option might produce bad alignments and sub optimal drawings in terms of used area since the ordering should be respected.'),Ptc),V5c),hQ),pqb(L5c))));o4c(a,lpe,zme,null);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,mpe),Kpe),'Long Edge Ordering Strategy'),'Indicates whether long edges are sorted under, over, or equal to nodes that have no connection to a previous layer in a left-to-right or right-to-left layout. Under and over changes to right and left in a vertical layout.'),Ttc),V5c),ZW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,npe),Kpe),'Crossing Counter Node Order Influence'),'Indicates with what percentage (1 for 100%) violations of the node model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal node order. Defaults to no influence (0).'),0),U5c),BI),pqb(L5c))));o4c(a,npe,jpe,null);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ope),Kpe),'Crossing Counter Port Order Influence'),'Indicates with what percentage (1 for 100%) violations of the port model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal port order. Defaults to no influence (0).'),0),U5c),BI),pqb(L5c))));o4c(a,ope,jpe,null);Oyc((new Pyc,a))};var Itc,Jtc,Ktc,Ltc,Mtc,Ntc,Otc,Ptc,Qtc,Rtc,Stc,Ttc,Utc,Vtc,Wtc,Xtc,Ytc,Ztc,$tc,_tc,auc,buc,cuc,duc,euc,fuc,guc,huc,iuc,juc,kuc,luc,muc,nuc,ouc,puc,quc,ruc,suc,tuc,uuc,vuc,wuc,xuc,yuc,zuc,Auc,Buc,Cuc,Duc,Euc,Fuc,Guc,Huc,Iuc,Juc,Kuc,Luc,Muc,Nuc,Ouc,Puc,Quc,Ruc,Suc,Tuc,Uuc,Vuc,Wuc,Xuc,Yuc,Zuc,$uc,_uc,avc,bvc,cvc,dvc,evc,fvc,gvc,hvc,ivc,jvc,kvc,lvc,mvc,nvc,ovc,pvc,qvc,rvc,svc,tvc,uvc,vvc,wvc,xvc,yvc,zvc,Avc,Bvc,Cvc,Dvc,Evc,Fvc,Gvc,Hvc,Ivc,Jvc,Kvc,Lvc,Mvc,Nvc,Ovc,Pvc,Qvc,Rvc,Svc,Tvc,Uvc,Vvc,Wvc,Xvc,Yvc,Zvc,$vc,_vc,awc,bwc,cwc,dwc,ewc,fwc,gwc,hwc,iwc;var UW=mdb(Sne,'LayeredMetaDataProvider',848);bcb(986,1,ale,Pyc);_.Qe=function Qyc(a){Oyc(a)};var mwc,nwc,owc,pwc,qwc,rwc,swc,twc,uwc,vwc,wwc,xwc,ywc,zwc,Awc,Bwc,Cwc,Dwc,Ewc,Fwc,Gwc,Hwc,Iwc,Jwc,Kwc,Lwc,Mwc,Nwc,Owc,Pwc,Qwc,Rwc,Swc,Twc,Uwc,Vwc,Wwc,Xwc,Ywc,Zwc,$wc,_wc,axc,bxc,cxc,dxc,exc,fxc,gxc,hxc,ixc,jxc,kxc,lxc,mxc,nxc,oxc,pxc,qxc,rxc,sxc,txc,uxc,vxc,wxc,xxc,yxc,zxc,Axc,Bxc,Cxc,Dxc,Exc,Fxc,Gxc,Hxc,Ixc,Jxc,Kxc,Lxc,Mxc,Nxc,Oxc,Pxc,Qxc,Rxc,Sxc,Txc,Uxc,Vxc,Wxc,Xxc,Yxc,Zxc,$xc,_xc,ayc,byc,cyc,dyc,eyc,fyc,gyc,hyc,iyc,jyc,kyc,lyc,myc,nyc,oyc,pyc,qyc,ryc,syc,tyc,uyc,vyc,wyc,xyc,yyc,zyc,Ayc,Byc,Cyc,Dyc,Eyc,Fyc,Gyc,Hyc,Iyc,Jyc,Kyc,Lyc,Myc;var WW=mdb(Sne,'LayeredOptions',986);bcb(987,1,{},Ryc);_.$e=function Syc(){var a;return a=new jUb,a};_._e=function Tyc(a){};var VW=mdb(Sne,'LayeredOptions/LayeredFactory',987);bcb(1372,1,{});_.a=0;var Uyc;var $1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder',1372);bcb(779,1372,{},ezc);var bzc,czc;var XW=mdb(Sne,'LayeredSpacings/LayeredSpacingsBuilder',779);bcb(313,22,{3:1,35:1,22:1,313:1,246:1,234:1},nzc);_.Kf=function pzc(){return mzc(this)};_.Xf=function ozc(){return mzc(this)};var fzc,gzc,hzc,izc,jzc,kzc;var YW=ndb(Sne,'LayeringStrategy',313,CI,rzc,qzc);var szc;bcb(378,22,{3:1,35:1,22:1,378:1},zzc);var uzc,vzc,wzc;var ZW=ndb(Sne,'LongEdgeOrderingStrategy',378,CI,Bzc,Azc);var Czc;bcb(197,22,{3:1,35:1,22:1,197:1},Kzc);var Ezc,Fzc,Gzc,Hzc;var $W=ndb(Sne,'NodeFlexibility',197,CI,Nzc,Mzc);var Ozc;bcb(315,22,{3:1,35:1,22:1,315:1,246:1,234:1},Xzc);_.Kf=function Zzc(){return Wzc(this)};_.Xf=function Yzc(){return Wzc(this)};var Qzc,Rzc,Szc,Tzc,Uzc;var _W=ndb(Sne,'NodePlacementStrategy',315,CI,_zc,$zc);var aAc;bcb(260,22,{3:1,35:1,22:1,260:1},lAc);var cAc,dAc,eAc,fAc,gAc,hAc,iAc,jAc;var aX=ndb(Sne,'NodePromotionStrategy',260,CI,nAc,mAc);var oAc;bcb(339,22,{3:1,35:1,22:1,339:1},uAc);var qAc,rAc,sAc;var bX=ndb(Sne,'OrderingStrategy',339,CI,wAc,vAc);var xAc;bcb(421,22,{3:1,35:1,22:1,421:1},CAc);var zAc,AAc;var cX=ndb(Sne,'PortSortingStrategy',421,CI,EAc,DAc);var FAc;bcb(452,22,{3:1,35:1,22:1,452:1},LAc);var HAc,IAc,JAc;var dX=ndb(Sne,'PortType',452,CI,NAc,MAc);var OAc;bcb(375,22,{3:1,35:1,22:1,375:1},UAc);var QAc,RAc,SAc;var eX=ndb(Sne,'SelfLoopDistributionStrategy',375,CI,WAc,VAc);var XAc;bcb(376,22,{3:1,35:1,22:1,376:1},aBc);var ZAc,$Ac;var fX=ndb(Sne,'SelfLoopOrderingStrategy',376,CI,cBc,bBc);var dBc;bcb(304,1,{304:1},oBc);var gX=mdb(Sne,'Spacings',304);bcb(336,22,{3:1,35:1,22:1,336:1},uBc);var qBc,rBc,sBc;var hX=ndb(Sne,'SplineRoutingMode',336,CI,wBc,vBc);var xBc;bcb(338,22,{3:1,35:1,22:1,338:1},DBc);var zBc,ABc,BBc;var iX=ndb(Sne,'ValidifyStrategy',338,CI,FBc,EBc);var GBc;bcb(377,22,{3:1,35:1,22:1,377:1},MBc);var IBc,JBc,KBc;var jX=ndb(Sne,'WrappingStrategy',377,CI,OBc,NBc);var PBc;bcb(1383,1,Bqe,VBc);_.Yf=function WBc(a){return BD(a,37),RBc};_.pf=function XBc(a,b){UBc(this,BD(a,37),b)};var RBc;var kX=mdb(Cqe,'DepthFirstCycleBreaker',1383);bcb(782,1,Bqe,aCc);_.Yf=function cCc(a){return BD(a,37),YBc};_.pf=function dCc(a,b){$Bc(this,BD(a,37),b)};_.Zf=function bCc(a){return BD(Ikb(a,Bub(this.d,a.c.length)),10)};var YBc;var lX=mdb(Cqe,'GreedyCycleBreaker',782);bcb(1386,782,Bqe,eCc);_.Zf=function fCc(a){var b,c,d,e;e=null;b=Ohe;for(d=new olb(a);d.a1){Ccb(DD(vNb(Q_b((tCb(0,a.c.length),BD(a.c[0],10))),(Nyc(),Awc))))?YGc(a,this.d,BD(this,660)):(mmb(),Okb(a,this.d));PEc(this.e,a)}};_.Sf=function DEc(a,b,c,d){var e,f,g,h,i,j,k;if(b!=sEc(c,a.length)){f=a[b-(c?1:-1)];UDc(this.f,f,c?(KAc(),IAc):(KAc(),HAc))}e=a[b][0];k=!d||e.k==(j0b(),e0b);j=Ou(a[b]);this.ag(j,k,false,c);g=0;for(i=new olb(j);i.a');a0?(RHc(this.a,a[b-1],a[b]),undefined):!c&&b1){Ccb(DD(vNb(Q_b((tCb(0,a.c.length),BD(a.c[0],10))),(Nyc(),Awc))))?YGc(a,this.d,this):(mmb(),Okb(a,this.d));Ccb(DD(vNb(Q_b((tCb(0,a.c.length),BD(a.c[0],10))),Awc)))||PEc(this.e,a)}};var YX=mdb(Gqe,'ModelOrderBarycenterHeuristic',660);bcb(1803,1,Dke,$Gc);_.ue=function _Gc(a,b){return VGc(this.a,BD(a,10),BD(b,10))};_.Fb=function aHc(a){return this===a};_.ve=function bHc(){return new tpb(this)};var XX=mdb(Gqe,'ModelOrderBarycenterHeuristic/lambda$0$Type',1803);bcb(1403,1,Bqe,fHc);_.Yf=function gHc(a){var b;return BD(a,37),b=k3c(cHc),e3c(b,(qUb(),nUb),(S8b(),H8b)),b};_.pf=function hHc(a,b){eHc((BD(a,37),b))};var cHc;var ZX=mdb(Gqe,'NoCrossingMinimizer',1403);bcb(796,402,Eqe,iHc);_.$f=function jHc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;l=this.g;switch(c.g){case 1:{e=0;f=0;for(k=new olb(a.j);k.a1&&(e.j==(Ucd(),zcd)?(this.b[a]=true):e.j==Tcd&&a>0&&(this.b[a-1]=true))};_.f=0;var aY=mdb(Lne,'AllCrossingsCounter',1798);bcb(587,1,{},BHc);_.b=0;_.d=0;var bY=mdb(Lne,'BinaryIndexedTree',587);bcb(524,1,{},dIc);var DHc,EHc;var lY=mdb(Lne,'CrossingsCounter',524);bcb(1906,1,Dke,hIc);_.ue=function iIc(a,b){return YHc(this.a,BD(a,11),BD(b,11))};_.Fb=function jIc(a){return this===a};_.ve=function kIc(){return new tpb(this)};var cY=mdb(Lne,'CrossingsCounter/lambda$0$Type',1906);bcb(1907,1,Dke,lIc);_.ue=function mIc(a,b){return ZHc(this.a,BD(a,11),BD(b,11))};_.Fb=function nIc(a){return this===a};_.ve=function oIc(){return new tpb(this)};var dY=mdb(Lne,'CrossingsCounter/lambda$1$Type',1907);bcb(1908,1,Dke,pIc);_.ue=function qIc(a,b){return $Hc(this.a,BD(a,11),BD(b,11))};_.Fb=function rIc(a){return this===a};_.ve=function sIc(){return new tpb(this)};var eY=mdb(Lne,'CrossingsCounter/lambda$2$Type',1908);bcb(1909,1,Dke,tIc);_.ue=function uIc(a,b){return _Hc(this.a,BD(a,11),BD(b,11))};_.Fb=function vIc(a){return this===a};_.ve=function wIc(){return new tpb(this)};var fY=mdb(Lne,'CrossingsCounter/lambda$3$Type',1909);bcb(1910,1,qie,xIc);_.td=function yIc(a){eIc(this.a,BD(a,11))};var gY=mdb(Lne,'CrossingsCounter/lambda$4$Type',1910);bcb(1911,1,Oie,zIc);_.Mb=function AIc(a){return fIc(this.a,BD(a,11))};var hY=mdb(Lne,'CrossingsCounter/lambda$5$Type',1911);bcb(1912,1,qie,CIc);_.td=function DIc(a){BIc(this,a)};var iY=mdb(Lne,'CrossingsCounter/lambda$6$Type',1912);bcb(1913,1,qie,EIc);_.td=function FIc(a){var b;FHc();Wjb(this.b,(b=this.a,BD(a,11),b))};var jY=mdb(Lne,'CrossingsCounter/lambda$7$Type',1913);bcb(826,1,Vke,GIc);_.Lb=function HIc(a){return FHc(),wNb(BD(a,11),(wtc(),gtc))};_.Fb=function IIc(a){return this===a};_.Mb=function JIc(a){return FHc(),wNb(BD(a,11),(wtc(),gtc))};var kY=mdb(Lne,'CrossingsCounter/lambda$8$Type',826);bcb(1905,1,{},LIc);var pY=mdb(Lne,'HyperedgeCrossingsCounter',1905);bcb(467,1,{35:1,467:1},NIc);_.wd=function OIc(a){return MIc(this,BD(a,467))};_.b=0;_.c=0;_.e=0;_.f=0;var oY=mdb(Lne,'HyperedgeCrossingsCounter/Hyperedge',467);bcb(362,1,{35:1,362:1},QIc);_.wd=function RIc(a){return PIc(this,BD(a,362))};_.b=0;_.c=0;var nY=mdb(Lne,'HyperedgeCrossingsCounter/HyperedgeCorner',362);bcb(523,22,{3:1,35:1,22:1,523:1},VIc);var SIc,TIc;var mY=ndb(Lne,'HyperedgeCrossingsCounter/HyperedgeCorner/Type',523,CI,XIc,WIc);var YIc;bcb(1405,1,Bqe,dJc);_.Yf=function eJc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?_Ic:null};_.pf=function fJc(a,b){cJc(this,BD(a,37),b)};var _Ic;var rY=mdb(Hqe,'InteractiveNodePlacer',1405);bcb(1406,1,Bqe,tJc);_.Yf=function uJc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?gJc:null};_.pf=function vJc(a,b){rJc(this,BD(a,37),b)};var gJc,hJc,iJc;var tY=mdb(Hqe,'LinearSegmentsNodePlacer',1406);bcb(257,1,{35:1,257:1},zJc);_.wd=function AJc(a){return wJc(this,BD(a,257))};_.Fb=function BJc(a){var b;if(JD(a,257)){b=BD(a,257);return this.b==b.b}return false};_.Hb=function CJc(){return this.b};_.Ib=function DJc(){return 'ls'+Fe(this.e)};_.a=0;_.b=0;_.c=-1;_.d=-1;_.g=0;var sY=mdb(Hqe,'LinearSegmentsNodePlacer/LinearSegment',257);bcb(1408,1,Bqe,$Jc);_.Yf=function _Jc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?EJc:null};_.pf=function hKc(a,b){WJc(this,BD(a,37),b)};_.b=0;_.g=0;var EJc;var dZ=mdb(Hqe,'NetworkSimplexPlacer',1408);bcb(1427,1,Dke,iKc);_.ue=function jKc(a,b){return beb(BD(a,19).a,BD(b,19).a)};_.Fb=function kKc(a){return this===a};_.ve=function lKc(){return new tpb(this)};var uY=mdb(Hqe,'NetworkSimplexPlacer/0methodref$compare$Type',1427);bcb(1429,1,Dke,mKc);_.ue=function nKc(a,b){return beb(BD(a,19).a,BD(b,19).a)};_.Fb=function oKc(a){return this===a};_.ve=function pKc(){return new tpb(this)};var vY=mdb(Hqe,'NetworkSimplexPlacer/1methodref$compare$Type',1429);bcb(649,1,{649:1},qKc);var wY=mdb(Hqe,'NetworkSimplexPlacer/EdgeRep',649);bcb(401,1,{401:1},rKc);_.b=false;var xY=mdb(Hqe,'NetworkSimplexPlacer/NodeRep',401);bcb(508,12,{3:1,4:1,20:1,28:1,52:1,12:1,14:1,15:1,54:1,508:1},vKc);var CY=mdb(Hqe,'NetworkSimplexPlacer/Path',508);bcb(1409,1,{},wKc);_.Kb=function xKc(a){return BD(a,17).d.i.k};var yY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$0$Type',1409);bcb(1410,1,Oie,yKc);_.Mb=function zKc(a){return BD(a,267)==(j0b(),g0b)};var zY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$1$Type',1410);bcb(1411,1,{},AKc);_.Kb=function BKc(a){return BD(a,17).d.i};var AY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$2$Type',1411);bcb(1412,1,Oie,CKc);_.Mb=function DKc(a){return eLc(Lzc(BD(a,10)))};var BY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$3$Type',1412);bcb(1413,1,Oie,EKc);_.Mb=function FKc(a){return dKc(BD(a,11))};var DY=mdb(Hqe,'NetworkSimplexPlacer/lambda$0$Type',1413);bcb(1414,1,qie,GKc);_.td=function HKc(a){LJc(this.a,this.b,BD(a,11))};var EY=mdb(Hqe,'NetworkSimplexPlacer/lambda$1$Type',1414);bcb(1423,1,qie,IKc);_.td=function JKc(a){MJc(this.a,BD(a,17))};var FY=mdb(Hqe,'NetworkSimplexPlacer/lambda$10$Type',1423);bcb(1424,1,{},KKc);_.Kb=function LKc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var GY=mdb(Hqe,'NetworkSimplexPlacer/lambda$11$Type',1424);bcb(1425,1,qie,MKc);_.td=function NKc(a){NJc(this.a,BD(a,10))};var HY=mdb(Hqe,'NetworkSimplexPlacer/lambda$12$Type',1425);bcb(1426,1,{},OKc);_.Kb=function PKc(a){return FJc(),meb(BD(a,121).e)};var IY=mdb(Hqe,'NetworkSimplexPlacer/lambda$13$Type',1426);bcb(1428,1,{},QKc);_.Kb=function RKc(a){return FJc(),meb(BD(a,121).e)};var JY=mdb(Hqe,'NetworkSimplexPlacer/lambda$15$Type',1428);bcb(1430,1,Oie,SKc);_.Mb=function TKc(a){return FJc(),BD(a,401).c.k==(j0b(),h0b)};var KY=mdb(Hqe,'NetworkSimplexPlacer/lambda$17$Type',1430);bcb(1431,1,Oie,UKc);_.Mb=function VKc(a){return FJc(),BD(a,401).c.j.c.length>1};var LY=mdb(Hqe,'NetworkSimplexPlacer/lambda$18$Type',1431);bcb(1432,1,qie,WKc);_.td=function XKc(a){eKc(this.c,this.b,this.d,this.a,BD(a,401))};_.c=0;_.d=0;var MY=mdb(Hqe,'NetworkSimplexPlacer/lambda$19$Type',1432);bcb(1415,1,{},YKc);_.Kb=function ZKc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var NY=mdb(Hqe,'NetworkSimplexPlacer/lambda$2$Type',1415);bcb(1433,1,qie,$Kc);_.td=function _Kc(a){fKc(this.a,BD(a,11))};_.a=0;var OY=mdb(Hqe,'NetworkSimplexPlacer/lambda$20$Type',1433);bcb(1434,1,{},aLc);_.Kb=function bLc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var PY=mdb(Hqe,'NetworkSimplexPlacer/lambda$21$Type',1434);bcb(1435,1,qie,cLc);_.td=function dLc(a){OJc(this.a,BD(a,10))};var QY=mdb(Hqe,'NetworkSimplexPlacer/lambda$22$Type',1435);bcb(1436,1,Oie,fLc);_.Mb=function gLc(a){return eLc(a)};var RY=mdb(Hqe,'NetworkSimplexPlacer/lambda$23$Type',1436);bcb(1437,1,{},hLc);_.Kb=function iLc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var SY=mdb(Hqe,'NetworkSimplexPlacer/lambda$24$Type',1437);bcb(1438,1,Oie,jLc);_.Mb=function kLc(a){return PJc(this.a,BD(a,10))};var TY=mdb(Hqe,'NetworkSimplexPlacer/lambda$25$Type',1438);bcb(1439,1,qie,lLc);_.td=function mLc(a){QJc(this.a,this.b,BD(a,10))};var UY=mdb(Hqe,'NetworkSimplexPlacer/lambda$26$Type',1439);bcb(1440,1,Oie,nLc);_.Mb=function oLc(a){return FJc(),!OZb(BD(a,17))};var VY=mdb(Hqe,'NetworkSimplexPlacer/lambda$27$Type',1440);bcb(1441,1,Oie,pLc);_.Mb=function qLc(a){return FJc(),!OZb(BD(a,17))};var WY=mdb(Hqe,'NetworkSimplexPlacer/lambda$28$Type',1441);bcb(1442,1,{},rLc);_.Ce=function sLc(a,b){return RJc(this.a,BD(a,29),BD(b,29))};var XY=mdb(Hqe,'NetworkSimplexPlacer/lambda$29$Type',1442);bcb(1416,1,{},tLc);_.Kb=function uLc(a){return FJc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var YY=mdb(Hqe,'NetworkSimplexPlacer/lambda$3$Type',1416);bcb(1417,1,Oie,vLc);_.Mb=function wLc(a){return FJc(),cKc(BD(a,17))};var ZY=mdb(Hqe,'NetworkSimplexPlacer/lambda$4$Type',1417);bcb(1418,1,qie,xLc);_.td=function yLc(a){XJc(this.a,BD(a,17))};var $Y=mdb(Hqe,'NetworkSimplexPlacer/lambda$5$Type',1418);bcb(1419,1,{},zLc);_.Kb=function ALc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var _Y=mdb(Hqe,'NetworkSimplexPlacer/lambda$6$Type',1419);bcb(1420,1,Oie,BLc);_.Mb=function CLc(a){return FJc(),BD(a,10).k==(j0b(),h0b)};var aZ=mdb(Hqe,'NetworkSimplexPlacer/lambda$7$Type',1420);bcb(1421,1,{},DLc);_.Kb=function ELc(a){return FJc(),new YAb(null,new Lub(new Sr(ur(O_b(BD(a,10)).a.Kc(),new Sq))))};var bZ=mdb(Hqe,'NetworkSimplexPlacer/lambda$8$Type',1421);bcb(1422,1,Oie,FLc);_.Mb=function GLc(a){return FJc(),NZb(BD(a,17))};var cZ=mdb(Hqe,'NetworkSimplexPlacer/lambda$9$Type',1422);bcb(1404,1,Bqe,KLc);_.Yf=function LLc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?HLc:null};_.pf=function MLc(a,b){JLc(BD(a,37),b)};var HLc;var eZ=mdb(Hqe,'SimpleNodePlacer',1404);bcb(180,1,{180:1},ULc);_.Ib=function VLc(){var a;a='';this.c==(YLc(),XLc)?(a+=kle):this.c==WLc&&(a+=jle);this.o==(eMc(),cMc)?(a+=vle):this.o==dMc?(a+='UP'):(a+='BALANCED');return a};var hZ=mdb(Kqe,'BKAlignedLayout',180);bcb(516,22,{3:1,35:1,22:1,516:1},ZLc);var WLc,XLc;var fZ=ndb(Kqe,'BKAlignedLayout/HDirection',516,CI,_Lc,$Lc);var aMc;bcb(515,22,{3:1,35:1,22:1,515:1},fMc);var cMc,dMc;var gZ=ndb(Kqe,'BKAlignedLayout/VDirection',515,CI,hMc,gMc);var iMc;bcb(1634,1,{},mMc);var iZ=mdb(Kqe,'BKAligner',1634);bcb(1637,1,{},rMc);var lZ=mdb(Kqe,'BKCompactor',1637);bcb(654,1,{654:1},sMc);_.a=0;var jZ=mdb(Kqe,'BKCompactor/ClassEdge',654);bcb(458,1,{458:1},uMc);_.a=null;_.b=0;var kZ=mdb(Kqe,'BKCompactor/ClassNode',458);bcb(1407,1,Bqe,CMc);_.Yf=function GMc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?vMc:null};_.pf=function HMc(a,b){BMc(this,BD(a,37),b)};_.d=false;var vMc;var mZ=mdb(Kqe,'BKNodePlacer',1407);bcb(1635,1,{},JMc);_.d=0;var oZ=mdb(Kqe,'NeighborhoodInformation',1635);bcb(1636,1,Dke,OMc);_.ue=function PMc(a,b){return NMc(this,BD(a,46),BD(b,46))};_.Fb=function QMc(a){return this===a};_.ve=function RMc(){return new tpb(this)};var nZ=mdb(Kqe,'NeighborhoodInformation/NeighborComparator',1636);bcb(808,1,{});var sZ=mdb(Kqe,'ThresholdStrategy',808);bcb(1763,808,{},WMc);_.bg=function XMc(a,b,c){return this.a.o==(eMc(),dMc)?Pje:Qje};_.cg=function YMc(){};var pZ=mdb(Kqe,'ThresholdStrategy/NullThresholdStrategy',1763);bcb(579,1,{579:1},ZMc);_.c=false;_.d=false;var qZ=mdb(Kqe,'ThresholdStrategy/Postprocessable',579);bcb(1764,808,{},bNc);_.bg=function cNc(a,b,c){var d,e,f;e=b==c;d=this.a.a[c.p]==b;if(!(e||d)){return a}f=a;if(this.a.c==(YLc(),XLc)){e&&(f=$Mc(this,b,true));!isNaN(f)&&!isFinite(f)&&d&&(f=$Mc(this,c,false))}else{e&&(f=$Mc(this,b,true));!isNaN(f)&&!isFinite(f)&&d&&(f=$Mc(this,c,false))}return f};_.cg=function dNc(){var a,b,c,d,e;while(this.d.b!=0){e=BD(Ksb(this.d),579);d=_Mc(this,e);if(!d.a){continue}a=d.a;c=Ccb(this.a.f[this.a.g[e.b.p].p]);if(!c&&!OZb(a)&&a.c.i.c==a.d.i.c){continue}b=aNc(this,e);b||swb(this.e,e)}while(this.e.a.c.length!=0){aNc(this,BD(rwb(this.e),579))}};var rZ=mdb(Kqe,'ThresholdStrategy/SimpleThresholdStrategy',1764);bcb(635,1,{635:1,246:1,234:1},hNc);_.Kf=function jNc(){return gNc(this)};_.Xf=function iNc(){return gNc(this)};var eNc;var tZ=mdb(Lqe,'EdgeRouterFactory',635);bcb(1458,1,Bqe,wNc);_.Yf=function xNc(a){return uNc(BD(a,37))};_.pf=function yNc(a,b){vNc(BD(a,37),b)};var lNc,mNc,nNc,oNc,pNc,qNc,rNc,sNc;var uZ=mdb(Lqe,'OrthogonalEdgeRouter',1458);bcb(1451,1,Bqe,NNc);_.Yf=function ONc(a){return INc(BD(a,37))};_.pf=function PNc(a,b){KNc(this,BD(a,37),b)};var zNc,ANc,BNc,CNc,DNc,ENc;var wZ=mdb(Lqe,'PolylineEdgeRouter',1451);bcb(1452,1,Vke,RNc);_.Lb=function SNc(a){return QNc(BD(a,10))};_.Fb=function TNc(a){return this===a};_.Mb=function UNc(a){return QNc(BD(a,10))};var vZ=mdb(Lqe,'PolylineEdgeRouter/1',1452);bcb(1809,1,Oie,ZNc);_.Mb=function $Nc(a){return BD(a,129).c==(HOc(),FOc)};var xZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$0$Type',1809);bcb(1810,1,{},_Nc);_.Ge=function aOc(a){return BD(a,129).d};var yZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$1$Type',1810);bcb(1811,1,Oie,bOc);_.Mb=function cOc(a){return BD(a,129).c==(HOc(),FOc)};var zZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$2$Type',1811);bcb(1812,1,{},dOc);_.Ge=function eOc(a){return BD(a,129).d};var AZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$3$Type',1812);bcb(1813,1,{},fOc);_.Ge=function gOc(a){return BD(a,129).d};var BZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$4$Type',1813);bcb(1814,1,{},hOc);_.Ge=function iOc(a){return BD(a,129).d};var CZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$5$Type',1814);bcb(112,1,{35:1,112:1},uOc);_.wd=function vOc(a){return kOc(this,BD(a,112))};_.Fb=function wOc(a){var b;if(JD(a,112)){b=BD(a,112);return this.g==b.g}return false};_.Hb=function xOc(){return this.g};_.Ib=function zOc(){var a,b,c,d;a=new Wfb('{');d=new olb(this.n);while(d.a'+this.b+' ('+Yr(this.c)+')'};_.d=0;var EZ=mdb(Mqe,'HyperEdgeSegmentDependency',129);bcb(520,22,{3:1,35:1,22:1,520:1},IOc);var FOc,GOc;var DZ=ndb(Mqe,'HyperEdgeSegmentDependency/DependencyType',520,CI,KOc,JOc);var LOc;bcb(1815,1,{},ZOc);var MZ=mdb(Mqe,'HyperEdgeSegmentSplitter',1815);bcb(1816,1,{},aPc);_.a=0;_.b=0;var FZ=mdb(Mqe,'HyperEdgeSegmentSplitter/AreaRating',1816);bcb(329,1,{329:1},bPc);_.a=0;_.b=0;_.c=0;var GZ=mdb(Mqe,'HyperEdgeSegmentSplitter/FreeArea',329);bcb(1817,1,Dke,cPc);_.ue=function dPc(a,b){return _Oc(BD(a,112),BD(b,112))};_.Fb=function ePc(a){return this===a};_.ve=function fPc(){return new tpb(this)};var HZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$0$Type',1817);bcb(1818,1,qie,gPc);_.td=function hPc(a){TOc(this.a,this.d,this.c,this.b,BD(a,112))};_.b=0;var IZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$1$Type',1818);bcb(1819,1,{},iPc);_.Kb=function jPc(a){return new YAb(null,new Kub(BD(a,112).e,16))};var JZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$2$Type',1819);bcb(1820,1,{},kPc);_.Kb=function lPc(a){return new YAb(null,new Kub(BD(a,112).j,16))};var KZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$3$Type',1820);bcb(1821,1,{},mPc);_.Fe=function nPc(a){return Edb(ED(a))};var LZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$4$Type',1821);bcb(655,1,{},tPc);_.a=0;_.b=0;_.c=0;var QZ=mdb(Mqe,'OrthogonalRoutingGenerator',655);bcb(1638,1,{},xPc);_.Kb=function yPc(a){return new YAb(null,new Kub(BD(a,112).e,16))};var OZ=mdb(Mqe,'OrthogonalRoutingGenerator/lambda$0$Type',1638);bcb(1639,1,{},zPc);_.Kb=function APc(a){return new YAb(null,new Kub(BD(a,112).j,16))};var PZ=mdb(Mqe,'OrthogonalRoutingGenerator/lambda$1$Type',1639);bcb(661,1,{});var RZ=mdb(Nqe,'BaseRoutingDirectionStrategy',661);bcb(1807,661,{},EPc);_.dg=function FPc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p;if(!!a.r&&!a.q){return}k=b+a.o*c;for(j=new olb(a.n);j.aqme){f=k;e=a;d=new f7c(l,f);Dsb(g.a,d);BPc(this,g,e,d,false);m=a.r;if(m){n=Edb(ED(Ut(m.e,0)));d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false);f=b+m.o*c;e=m;d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false)}d=new f7c(p,f);Dsb(g.a,d);BPc(this,g,e,d,false)}}}}};_.eg=function GPc(a){return a.i.n.a+a.n.a+a.a.a};_.fg=function HPc(){return Ucd(),Rcd};_.gg=function IPc(){return Ucd(),Acd};var SZ=mdb(Nqe,'NorthToSouthRoutingStrategy',1807);bcb(1808,661,{},JPc);_.dg=function KPc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p;if(!!a.r&&!a.q){return}k=b-a.o*c;for(j=new olb(a.n);j.aqme){f=k;e=a;d=new f7c(l,f);Dsb(g.a,d);BPc(this,g,e,d,false);m=a.r;if(m){n=Edb(ED(Ut(m.e,0)));d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false);f=b-m.o*c;e=m;d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false)}d=new f7c(p,f);Dsb(g.a,d);BPc(this,g,e,d,false)}}}}};_.eg=function LPc(a){return a.i.n.a+a.n.a+a.a.a};_.fg=function MPc(){return Ucd(),Acd};_.gg=function NPc(){return Ucd(),Rcd};var TZ=mdb(Nqe,'SouthToNorthRoutingStrategy',1808);bcb(1806,661,{},OPc);_.dg=function PPc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p;if(!!a.r&&!a.q){return}k=b+a.o*c;for(j=new olb(a.n);j.aqme){f=k;e=a;d=new f7c(f,l);Dsb(g.a,d);BPc(this,g,e,d,true);m=a.r;if(m){n=Edb(ED(Ut(m.e,0)));d=new f7c(f,n);Dsb(g.a,d);BPc(this,g,e,d,true);f=b+m.o*c;e=m;d=new f7c(f,n);Dsb(g.a,d);BPc(this,g,e,d,true)}d=new f7c(f,p);Dsb(g.a,d);BPc(this,g,e,d,true)}}}}};_.eg=function QPc(a){return a.i.n.b+a.n.b+a.a.b};_.fg=function RPc(){return Ucd(),zcd};_.gg=function SPc(){return Ucd(),Tcd};var UZ=mdb(Nqe,'WestToEastRoutingStrategy',1806);bcb(813,1,{},YPc);_.Ib=function ZPc(){return Fe(this.a)};_.b=0;_.c=false;_.d=false;_.f=0;var WZ=mdb(Pqe,'NubSpline',813);bcb(407,1,{407:1},aQc,bQc);var VZ=mdb(Pqe,'NubSpline/PolarCP',407);bcb(1453,1,Bqe,vQc);_.Yf=function xQc(a){return qQc(BD(a,37))};_.pf=function yQc(a,b){uQc(this,BD(a,37),b)};var cQc,dQc,eQc,fQc,gQc;var b$=mdb(Pqe,'SplineEdgeRouter',1453);bcb(268,1,{268:1},BQc);_.Ib=function CQc(){return this.a+' ->('+this.c+') '+this.b};_.c=0;var XZ=mdb(Pqe,'SplineEdgeRouter/Dependency',268);bcb(455,22,{3:1,35:1,22:1,455:1},GQc);var DQc,EQc;var YZ=ndb(Pqe,'SplineEdgeRouter/SideToProcess',455,CI,IQc,HQc);var JQc;bcb(1454,1,Oie,LQc);_.Mb=function MQc(a){return hQc(),!BD(a,128).o};var ZZ=mdb(Pqe,'SplineEdgeRouter/lambda$0$Type',1454);bcb(1455,1,{},NQc);_.Ge=function OQc(a){return hQc(),BD(a,128).v+1};var $Z=mdb(Pqe,'SplineEdgeRouter/lambda$1$Type',1455);bcb(1456,1,qie,PQc);_.td=function QQc(a){sQc(this.a,this.b,BD(a,46))};var _Z=mdb(Pqe,'SplineEdgeRouter/lambda$2$Type',1456);bcb(1457,1,qie,RQc);_.td=function SQc(a){tQc(this.a,this.b,BD(a,46))};var a$=mdb(Pqe,'SplineEdgeRouter/lambda$3$Type',1457);bcb(128,1,{35:1,128:1},YQc,ZQc);_.wd=function $Qc(a){return WQc(this,BD(a,128))};_.b=0;_.e=false;_.f=0;_.g=0;_.j=false;_.k=false;_.n=0;_.o=false;_.p=false;_.q=false;_.s=0;_.u=0;_.v=0;_.F=0;var d$=mdb(Pqe,'SplineSegment',128);bcb(459,1,{459:1},_Qc);_.a=0;_.b=false;_.c=false;_.d=false;_.e=false;_.f=0;var c$=mdb(Pqe,'SplineSegment/EdgeInformation',459);bcb(1234,1,{},hRc);var f$=mdb(Uqe,hme,1234);bcb(1235,1,Dke,jRc);_.ue=function kRc(a,b){return iRc(BD(a,135),BD(b,135))};_.Fb=function lRc(a){return this===a};_.ve=function mRc(){return new tpb(this)};var e$=mdb(Uqe,ime,1235);bcb(1233,1,{},tRc);var g$=mdb(Uqe,'MrTree',1233);bcb(393,22,{3:1,35:1,22:1,393:1,246:1,234:1},ARc);_.Kf=function CRc(){return zRc(this)};_.Xf=function BRc(){return zRc(this)};var uRc,vRc,wRc,xRc;var h$=ndb(Uqe,'TreeLayoutPhases',393,CI,ERc,DRc);var FRc;bcb(1130,209,Mle,HRc);_.Ze=function IRc(a,b){var c,d,e,f,g,h,i;Ccb(DD(hkd(a,(JTc(),ATc))))||$Cb((c=new _Cb((Pgd(),new bhd(a))),c));g=(h=new SRc,tNb(h,a),yNb(h,(mTc(),dTc),a),i=new Lqb,pRc(a,h,i),oRc(a,h,i),h);f=gRc(this.a,g);for(e=new olb(f);e.a'+WRc(this.c):'e_'+tb(this)};var l$=mdb(Vqe,'TEdge',188);bcb(135,134,{3:1,135:1,94:1,134:1},SRc);_.Ib=function TRc(){var a,b,c,d,e;e=null;for(d=Jsb(this.b,0);d.b!=d.d.c;){c=BD(Xsb(d),86);e+=(c.c==null||c.c.length==0?'n_'+c.g:'n_'+c.c)+'\n'}for(b=Jsb(this.a,0);b.b!=b.d.c;){a=BD(Xsb(b),188);e+=(!!a.b&&!!a.c?WRc(a.b)+'->'+WRc(a.c):'e_'+tb(a))+'\n'}return e};var n$=mdb(Vqe,'TGraph',135);bcb(633,502,{3:1,502:1,633:1,94:1,134:1});var r$=mdb(Vqe,'TShape',633);bcb(86,633,{3:1,502:1,86:1,633:1,94:1,134:1},XRc);_.Ib=function YRc(){return WRc(this)};var q$=mdb(Vqe,'TNode',86);bcb(255,1,vie,ZRc);_.Jc=function $Rc(a){reb(this,a)};_.Kc=function _Rc(){var a;return a=Jsb(this.a.d,0),new aSc(a)};var p$=mdb(Vqe,'TNode/2',255);bcb(358,1,aie,aSc);_.Nb=function bSc(a){Rrb(this,a)};_.Pb=function dSc(){return BD(Xsb(this.a),188).c};_.Ob=function cSc(){return Wsb(this.a)};_.Qb=function eSc(){Zsb(this.a)};var o$=mdb(Vqe,'TNode/2/1',358);bcb(1840,1,ene,hSc);_.pf=function jSc(a,b){gSc(this,BD(a,135),b)};var s$=mdb(Wqe,'FanProcessor',1840);bcb(327,22,{3:1,35:1,22:1,327:1,234:1},rSc);_.Kf=function sSc(){switch(this.g){case 0:return new QSc;case 1:return new hSc;case 2:return new GSc;case 3:return new zSc;case 4:return new NSc;case 5:return new TSc;default:throw vbb(new Wdb(Dne+(this.f!=null?this.f:''+this.g)));}};var kSc,lSc,mSc,nSc,oSc,pSc;var t$=ndb(Wqe,Ene,327,CI,uSc,tSc);var vSc;bcb(1843,1,ene,zSc);_.pf=function ASc(a,b){xSc(this,BD(a,135),b)};_.a=0;var v$=mdb(Wqe,'LevelHeightProcessor',1843);bcb(1844,1,vie,BSc);_.Jc=function CSc(a){reb(this,a)};_.Kc=function DSc(){return mmb(),Emb(),Dmb};var u$=mdb(Wqe,'LevelHeightProcessor/1',1844);bcb(1841,1,ene,GSc);_.pf=function HSc(a,b){ESc(this,BD(a,135),b)};_.a=0;var x$=mdb(Wqe,'NeighborsProcessor',1841);bcb(1842,1,vie,ISc);_.Jc=function JSc(a){reb(this,a)};_.Kc=function KSc(){return mmb(),Emb(),Dmb};var w$=mdb(Wqe,'NeighborsProcessor/1',1842);bcb(1845,1,ene,NSc);_.pf=function OSc(a,b){LSc(this,BD(a,135),b)};_.a=0;var y$=mdb(Wqe,'NodePositionProcessor',1845);bcb(1839,1,ene,QSc);_.pf=function RSc(a,b){PSc(this,BD(a,135))};var z$=mdb(Wqe,'RootProcessor',1839);bcb(1846,1,ene,TSc);_.pf=function USc(a,b){SSc(BD(a,135))};var A$=mdb(Wqe,'Untreeifyer',1846);var VSc,WSc,XSc,YSc,ZSc,$Sc,_Sc,aTc,bTc,cTc,dTc,eTc,fTc,gTc,hTc,iTc,jTc,kTc,lTc;bcb(851,1,ale,sTc);_.Qe=function tTc(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zqe),''),'Weighting of Nodes'),'Which weighting to use when computing a node order.'),qTc),(_5c(),V5c)),E$),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$qe),''),'Search Order'),'Which search order to use when computing a spanning tree.'),oTc),V5c),F$),pqb(L5c))));KTc((new LTc,a))};var nTc,oTc,pTc,qTc;var B$=mdb(_qe,'MrTreeMetaDataProvider',851);bcb(994,1,ale,LTc);_.Qe=function MTc(a){KTc(a)};var uTc,vTc,wTc,xTc,yTc,zTc,ATc,BTc,CTc,DTc,ETc,FTc,GTc,HTc,ITc;var D$=mdb(_qe,'MrTreeOptions',994);bcb(995,1,{},NTc);_.$e=function OTc(){var a;return a=new HRc,a};_._e=function PTc(a){};var C$=mdb(_qe,'MrTreeOptions/MrtreeFactory',995);bcb(480,22,{3:1,35:1,22:1,480:1},TTc);var QTc,RTc;var E$=ndb(_qe,'OrderWeighting',480,CI,VTc,UTc);var WTc;bcb(425,22,{3:1,35:1,22:1,425:1},_Tc);var YTc,ZTc;var F$=ndb(_qe,'TreeifyingOrder',425,CI,bUc,aUc);var cUc;bcb(1459,1,Bqe,lUc);_.Yf=function mUc(a){return BD(a,135),eUc};_.pf=function nUc(a,b){kUc(this,BD(a,135),b)};var eUc;var G$=mdb('org.eclipse.elk.alg.mrtree.p1treeify','DFSTreeifyer',1459);bcb(1460,1,Bqe,sUc);_.Yf=function tUc(a){return BD(a,135),oUc};_.pf=function uUc(a,b){rUc(this,BD(a,135),b)};var oUc;var H$=mdb('org.eclipse.elk.alg.mrtree.p2order','NodeOrderer',1460);bcb(1461,1,Bqe,CUc);_.Yf=function DUc(a){return BD(a,135),vUc};_.pf=function EUc(a,b){AUc(this,BD(a,135),b)};_.a=0;var vUc;var I$=mdb('org.eclipse.elk.alg.mrtree.p3place','NodePlacer',1461);bcb(1462,1,Bqe,IUc);_.Yf=function JUc(a){return BD(a,135),FUc};_.pf=function KUc(a,b){HUc(BD(a,135),b)};var FUc;var J$=mdb('org.eclipse.elk.alg.mrtree.p4route','EdgeRouter',1462);var LUc;bcb(495,22,{3:1,35:1,22:1,495:1,246:1,234:1},RUc);_.Kf=function TUc(){return QUc(this)};_.Xf=function SUc(){return QUc(this)};var NUc,OUc;var K$=ndb(cre,'RadialLayoutPhases',495,CI,VUc,UUc);var WUc;bcb(1131,209,Mle,ZUc);_.Ze=function $Uc(a,b){var c,d,e,f,g,h;c=YUc(this,a);Odd(b,'Radial layout',c.c.length);Ccb(DD(hkd(a,(ZWc(),QWc))))||$Cb((d=new _Cb((Pgd(),new bhd(a))),d));h=aVc(a);jkd(a,(MUc(),LUc),h);if(!h){throw vbb(new Wdb('The given graph is not a tree!'))}e=Edb(ED(hkd(a,VWc)));e==0&&(e=_Uc(a));jkd(a,VWc,e);for(g=new olb(YUc(this,a));g.a0&&j7c((BCb(c-1,b.length),b.charCodeAt(c-1)),nne)){--c}if(e>=c){throw vbb(new Wdb('The given string does not contain any numbers.'))}f=mfb(b.substr(e,c-e),',|;|\r|\n');if(f.length!=2){throw vbb(new Wdb('Exactly two numbers are expected, '+f.length+' were found.'))}try{this.a=Hcb(ufb(f[0]));this.b=Hcb(ufb(f[1]))}catch(a){a=ubb(a);if(JD(a,127)){d=a;throw vbb(new Wdb(one+d))}else throw vbb(a)}};_.Ib=function m7c(){return '('+this.a+','+this.b+')'};_.a=0;_.b=0;var m1=mdb(pne,'KVector',8);bcb(74,68,{3:1,4:1,20:1,28:1,52:1,14:1,68:1,15:1,74:1,414:1},s7c,t7c,u7c);_.Pc=function x7c(){return r7c(this)};_.Jf=function v7c(b){var c,d,e,f,g,h;e=mfb(b,',|;|\\(|\\)|\\[|\\]|\\{|\\}| |\t|\n');Osb(this);try{d=0;g=0;f=0;h=0;while(d0){g%2==0?(f=Hcb(e[d])):(h=Hcb(e[d]));g>0&&g%2!=0&&Dsb(this,new f7c(f,h));++g}++d}}catch(a){a=ubb(a);if(JD(a,127)){c=a;throw vbb(new Wdb('The given string does not match the expected format for vectors.'+c))}else throw vbb(a)}};_.Ib=function y7c(){var a,b,c;a=new Wfb('(');b=Jsb(this,0);while(b.b!=b.d.c){c=BD(Xsb(b),8);Qfb(a,c.a+','+c.b);b.b!=b.d.c&&(a.a+='; ',a)}return (a.a+=')',a).a};var l1=mdb(pne,'KVectorChain',74);bcb(248,22,{3:1,35:1,22:1,248:1},G7c);var z7c,A7c,B7c,C7c,D7c,E7c;var o1=ndb(ose,'Alignment',248,CI,I7c,H7c);var J7c;bcb(979,1,ale,Z7c);_.Qe=function $7c(a){Y7c(a)};var L7c,M7c,N7c,O7c,P7c,Q7c,R7c,S7c,T7c,U7c,V7c,W7c;var q1=mdb(ose,'BoxLayouterOptions',979);bcb(980,1,{},_7c);_.$e=function a8c(){var a;return a=new ged,a};_._e=function b8c(a){};var p1=mdb(ose,'BoxLayouterOptions/BoxFactory',980);bcb(291,22,{3:1,35:1,22:1,291:1},j8c);var c8c,d8c,e8c,f8c,g8c,h8c;var r1=ndb(ose,'ContentAlignment',291,CI,l8c,k8c);var m8c;bcb(684,1,ale,Z9c);_.Qe=function $9c(a){t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,sse),''),'Layout Algorithm'),'Select a specific layout algorithm.'),(_5c(),Z5c)),ZI),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,tse),''),'Resolved Layout Algorithm'),'Meta data associated with the selected algorithm.'),Y5c),E0),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$pe),''),'Alignment'),'Alignment of the selected node relative to other nodes; the exact meaning depends on the used algorithm.'),q8c),V5c),o1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,_le),''),'Aspect Ratio'),'The desired aspect ratio of the drawing, that is the quotient of width by height.'),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,use),''),'Bend Points'),"A fixed list of bend points for the edge. This is used by the 'Fixed Layout' algorithm to specify a pre-defined routing for an edge. The vector chain must include the source point, any bend points, and the target point, so it must have at least two points."),Y5c),l1),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,lqe),''),'Content Alignment'),'Specifies how the content of a node are aligned. Each node can individually control the alignment of its contents. I.e. if a node should be aligned top left in its parent node, the parent node should specify that option.'),x8c),W5c),r1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zpe),''),'Debug Mode'),'Whether additional debug information shall be generated.'),(Bcb(),false)),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,cqe),''),Cle),'Overall direction of edges: horizontal (right / left) or vertical (down / up).'),A8c),V5c),t1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ype),''),'Edge Routing'),'What kind of edge routing style should be applied for the content of a parent node. Algorithms may also set this option to single edges in order to mark them as splines. The bend point list of edges with this option set to SPLINES must be interpreted as control points for a piecewise cubic spline.'),F8c),V5c),v1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Jre),''),'Expand Nodes'),'If active, nodes are expanded to fill the area of their parent.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,tpe),''),'Hierarchy Handling'),"Determines whether separate layout runs are triggered for different compound nodes in a hierarchical graph. Setting a node's hierarchy handling to `INCLUDE_CHILDREN` will lay out that node and all of its descendants in a single layout run, until a descendant is encountered which has its hierarchy handling set to `SEPARATE_CHILDREN`. In general, `SEPARATE_CHILDREN` will ensure that a new layout run is triggered for a node with that setting. Including multiple levels of hierarchy in a single layout run may allow cross-hierarchical edges to be laid out properly. If the root node is set to `INHERIT` (or not set at all), the default behavior is `SEPARATE_CHILDREN`."),K8c),V5c),z1),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ame),''),'Padding'),"The padding to be left to a parent element's border when placing child elements. This can also serve as an output option of a layout algorithm if node size calculation is setup appropriately."),g9c),Y5c),j1),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ame),''),'Interactive'),'Whether the algorithm should be run in interactive mode for the content of a parent node. What this means exactly depends on how the specific algorithm interprets this option. Usually in the interactive mode algorithms try to modify the current layout as little as possible.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xqe),''),'interactive Layout'),'Whether the graph should be changeable interactively and by setting constraints'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Dme),''),'Omit Node Micro Layout'),"Node micro layout comprises the computation of node dimensions (if requested), the placement of ports and their labels, and the placement of node labels. The functionality is implemented independent of any specific layout algorithm and shouldn't have any negative impact on the layout algorithm's performance itself. Yet, if any unforeseen behavior occurs, this option allows to deactivate the micro layout."),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Bme),''),'Port Constraints'),'Defines constraints of the position of the ports of a node.'),u9c),V5c),D1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,uqe),''),'Position'),"The position of a node, port, or label. This is used by the 'Fixed Layout' algorithm to specify a pre-defined position."),Y5c),m1),qqb(K5c,OC(GC(e1,1),Kie,175,0,[M5c,J5c])))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,vme),''),'Priority'),'Defines the priority of an object; its meaning depends on the specific layout algorithm and the context where it is used.'),X5c),JI),qqb(K5c,OC(GC(e1,1),Kie,175,0,[I5c])))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,yme),''),'Randomization Seed'),'Seed used for pseudo-random number generators to control the layout algorithm. If the value is 0, the seed shall be determined pseudo-randomly (e.g. from the system time).'),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,zme),''),'Separate Connected Components'),'Whether each connected component should be processed separately.'),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,mqe),''),'Junction Points'),'This option is not used as option, but as output of the layout algorithms. It is attached to edges and determines the points where junction symbols should be drawn in order to represent hyperedges with orthogonal routing. Whether such points are computed depends on the chosen layout algorithm and edge routing style. The points are put into the vector chain with no specific order.'),R8c),Y5c),l1),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,pqe),''),'Comment Box'),'Whether the node should be regarded as a comment box instead of a regular node. In that case its placement should be similar to how labels are handled. Any edges incident to a comment box specify to which graph elements the comment is related.'),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,qqe),''),'Hypernode'),'Whether the node should be handled as a hypernode.'),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,vse),''),'Label Manager'),"Label managers can shorten labels upon a layout algorithm's request."),Y5c),h1),qqb(L5c,OC(GC(e1,1),Kie,175,0,[J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,vqe),''),'Margins'),"Margins define additional space around the actual bounds of a graph element. For instance, ports or labels being placed on the outside of a node's border might introduce such a margin. The margin is used to guarantee non-overlap of other graph elements with those ports or labels."),T8c),Y5c),i1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Xpe),''),'No Layout'),"No layout is done for the associated element. This is used to mark parts of a diagram to avoid their inclusion in the layout graph, or to mark parts of the layout graph to prevent layout engines from processing them. If you wish to exclude the contents of a compound node from automatic layout, while the node itself is still considered on its own layer, use the 'Fixed Layout' algorithm for that node."),false),T5c),wI),qqb(K5c,OC(GC(e1,1),Kie,175,0,[I5c,M5c,J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,wse),''),'Scale Factor'),"The scaling factor to be applied to the corresponding node in recursive layout. It causes the corresponding node's size to be adjusted, and its ports and labels to be sized and placed accordingly after the layout of that node has been determined (and before the node itself and its siblings are arranged). The scaling is not reverted afterwards, so the resulting layout graph contains the adjusted size and position data. This option is currently not supported if 'Layout Hierarchy' is set."),1),U5c),BI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xse),''),'Animate'),'Whether the shift from the old layout to the new computed layout shall be animated.'),true),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,yse),''),'Animation Time Factor'),"Factor for computation of animation time. The higher the value, the longer the animation time. If the value is 0, the resulting time is always equal to the minimum defined by 'Minimal Animation Time'."),meb(100)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,zse),''),'Layout Ancestors'),'Whether the hierarchy levels on the path from the selected element to the root of the diagram shall be included in the layout process.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ase),''),'Maximal Animation Time'),'The maximal time for animations, in milliseconds.'),meb(4000)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Bse),''),'Minimal Animation Time'),'The minimal time for animations, in milliseconds.'),meb(400)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Cse),''),'Progress Bar'),'Whether a progress bar shall be displayed during layout computations.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Dse),''),'Validate Graph'),'Whether the graph shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ese),''),'Validate Options'),'Whether layout options shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user.'),true),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Fse),''),'Zoom to Fit'),'Whether the zoom level shall be set to view the whole diagram after layout.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,rse),'box'),'Box Layout Mode'),'Configures the packing mode used by the {@link BoxLayoutProvider}. If SIMPLE is not required (neither priorities are used nor the interactive mode), GROUP_DEC can improve the packing and decrease the area. GROUP_MIXED and GROUP_INC may, in very specific scenarios, work better.'),u8c),V5c),O1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Lpe),zpe),'Comment Comment Spacing'),'Spacing to be preserved between a comment box and other comment boxes connected to the same node. The space left between comment boxes of different nodes is controlled by the node-node spacing.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Mpe),zpe),'Comment Node Spacing'),'Spacing to be preserved between a node and its connected comment boxes. The space left between a node and the comments of another node is controlled by the node-node spacing.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zle),zpe),'Components Spacing'),"Spacing to be preserved between pairs of connected components. This option is only relevant if 'separateConnectedComponents' is activated."),20),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Npe),zpe),'Edge Spacing'),'Spacing to be preserved between any two edges. Note that while this can somewhat easily be satisfied for the segments of orthogonally drawn edges, it is harder for general polylines or splines.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xme),zpe),'Edge Label Spacing'),"The minimal distance to be preserved between a label and the edge it is associated with. Note that the placement of a label is influenced by the 'edgelabels.placement' option."),2),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ope),zpe),'Edge Node Spacing'),'Spacing to be preserved between nodes and edges.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ppe),zpe),'Label Spacing'),'Determines the amount of space to be left between two labels of the same graph element.'),0),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Spe),zpe),'Label Node Spacing'),"Spacing to be preserved between labels and the border of node they are associated with. Note that the placement of a label is influenced by the 'nodelabels.placement' option."),5),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Qpe),zpe),'Horizontal spacing between Label and Port'),"Horizontal spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Rpe),zpe),'Vertical spacing between Label and Port'),"Vertical spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,wme),zpe),'Node Spacing'),'The minimal distance to be preserved between each two nodes.'),20),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Tpe),zpe),'Node Self Loop Spacing'),'Spacing to be preserved between a node and its self loops.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Upe),zpe),'Port Spacing'),'Spacing between pairs of ports of the same node.'),10),U5c),BI),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Vpe),zpe),'Individual Spacing'),"Allows to specify individual spacing values for graph elements that shall be different from the value specified for the element's parent."),Y5c),i2),qqb(K5c,OC(GC(e1,1),Kie,175,0,[I5c,M5c,J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,wqe),zpe),'Additional Port Space'),'Additional space around the sets of ports on each node side. For each side of a node, this option can reserve additional space before and after the ports on each side. For example, a top spacing of 20 makes sure that the first port on the western and eastern side is 20 units away from the northern border.'),W9c),Y5c),i1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,tqe),Jse),'Layout Partition'),'Partition to which the node belongs. This requires Layout Partitioning to be active. Nodes with lower partition IDs will appear to the left of nodes with higher partition IDs (assuming a left-to-right layout direction).'),X5c),JI),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));o4c(a,tqe,sqe,k9c);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,sqe),Jse),'Layout Partitioning'),'Whether to activate partitioned layout. This will allow to group nodes through the Layout Partition option. a pair of nodes with different partition indices is then placed such that the node with lower index is placed to the left of the other node (with left-to-right layout direction). Depending on the layout algorithm, this may only be guaranteed to work if all nodes have a layout partition configured, or at least if edges that cross partitions are not part of a partition-crossing cycle.'),i9c),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,dqe),Kse),'Node Label Padding'),'Define padding for node labels that are placed inside of a node.'),V8c),Y5c),j1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Gme),Kse),'Node Label Placement'),"Hints for where node labels are to be placed; if empty, the node label's position is not modified."),X8c),W5c),B1),qqb(K5c,OC(GC(e1,1),Kie,175,0,[J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,gqe),Lse),'Port Alignment'),'Defines the default port distribution for a node. May be overridden for each side individually.'),m9c),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,hqe),Lse),'Port Alignment (North)'),"Defines how ports on the northern side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,iqe),Lse),'Port Alignment (South)'),"Defines how ports on the southern side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,jqe),Lse),'Port Alignment (West)'),"Defines how ports on the western side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,kqe),Lse),'Port Alignment (East)'),"Defines how ports on the eastern side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Fme),Mse),'Node Size Constraints'),"What should be taken into account when calculating a node's size. Empty size constraints specify that a node's size is already fixed and should not be changed."),Z8c),W5c),I1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Eme),Mse),'Node Size Options'),'Options modifying the behavior of the size constraints set on a node. Each member of the set specifies something that should be taken into account when calculating node sizes. The empty set corresponds to no further modifications.'),c9c),W5c),J1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Tme),Mse),'Node Size Minimum'),'The minimal size to which a node can be reduced.'),a9c),Y5c),m1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,bqe),Mse),'Fixed Graph Size'),"By default, the fixed layout provider will enlarge a graph until it is large enough to contain its children. If this option is set, it won't do so."),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,nqe),Jpe),'Edge Label Placement'),'Gives a hint on where to put edge labels.'),D8c),V5c),u1),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Cme),Jpe),'Inline Edge Labels'),"If true, an edge label is placed directly on its edge. May only apply to center edge labels. This kind of label placement is only advisable if the label's rendering is such that it is not crossed by its edge and thus stays legible."),false),T5c),wI),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Gse),'font'),'Font Name'),'Font name used for a label.'),Z5c),ZI),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Hse),'font'),'Font Size'),'Font size used for a label.'),X5c),JI),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,rqe),Nse),'Port Anchor Offset'),'The offset to the port position where connections shall be attached.'),Y5c),m1),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,oqe),Nse),'Port Index'),"The index of a port in the fixed order around a node. The order is assumed as clockwise, starting with the leftmost port on the top side. This option must be set if 'Port Constraints' is set to FIXED_ORDER and no specific positions are given for the ports. Additionally, the option 'Port Side' must be defined in this case."),X5c),JI),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ype),Nse),'Port Side'),"The side of a node on which a port is situated. This option must be set if 'Port Constraints' is set to FIXED_SIDE or FIXED_ORDER and no specific positions are given for the ports."),B9c),V5c),F1),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Wpe),Nse),'Port Border Offset'),"The offset of ports on the node border. With a positive offset the port is moved outside of the node, while with a negative offset the port is moved towards the inside. An offset of 0 means that the port is placed directly on the node border, i.e. if the port side is north, the port's south border touches the nodes's north border; if the port side is east, the port's west border touches the nodes's east border; if the port side is south, the port's north border touches the node's south border; if the port side is west, the port's east border touches the node's west border."),U5c),BI),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Hme),Ose),'Port Label Placement'),"Decides on a placement method for port labels; if empty, the node label's position is not modified."),y9c),W5c),E1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,eqe),Ose),'Port Labels Next to Port'),"Use 'portLabels.placement': NEXT_TO_PORT_OF_POSSIBLE."),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,fqe),Ose),'Treat Port Labels as Group'),'If this option is true (default), the labels of a port will be treated as a group when it comes to centering them next to their port. If this option is false, only the first label will be centered next to the port, with the others being placed below. This only applies to labels of eastern and western ports and will have no effect if labels are not placed next to their port.'),true),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,_pe),Pse),'Activate Inside Self Loops'),"Whether this node allows to route self loops inside of it instead of around it. If set to true, this will make the node a compound node if it isn't already, and will require the layout algorithm to support compound nodes with hierarchical ports."),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,aqe),Pse),'Inside Self Loop'),'Whether a self loop should be routed inside a node instead of around that node.'),false),T5c),wI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$le),'edge'),'Edge Thickness'),'The thickness of an edge. This is a hint on the line width used to draw an edge, possibly requiring more space to be reserved for it.'),1),U5c),BI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ise),'edge'),'Edge Type'),'The type of an edge. This is usually used for UML class diagrams, where associations must be handled differently from generalizations.'),H8c),V5c),w1),pqb(I5c))));s4c(a,new W3c(b4c(d4c(c4c(new e4c,sne),'Layered'),'The layer-based method was introduced by Sugiyama, Tagawa and Toda in 1981. It emphasizes the direction of edges by pointing as many edges as possible into the same direction. The nodes are arranged in layers, which are sometimes called "hierarchies", and then reordered such that the number of edge crossings is minimized. Afterwards, concrete coordinates are computed for the nodes and edge bend points.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,'org.eclipse.elk.orthogonal'),'Orthogonal'),'Orthogonal methods that follow the "topology-shape-metrics" approach by Batini, Nardelli and Tamassia \'86. The first phase determines the topology of the drawing by applying a planarization technique, which results in a planar representation of the graph. The orthogonal shape is computed in the second phase, which aims at minimizing the number of edge bends, and is called orthogonalization. The third phase leads to concrete coordinates for nodes and edge bend points by applying a compaction method, thus defining the metrics.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,ume),'Force'),'Layout algorithms that follow physical analogies by simulating a system of attractive and repulsive forces. The first successful method of this kind was proposed by Eades in 1984.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,'org.eclipse.elk.circle'),'Circle'),'Circular layout algorithms emphasize cycles or biconnected components of a graph by arranging them in circles. This is useful if a drawing is desired where such components are clearly grouped, or where cycles are shown as prominent OPTIONS of the graph.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,bre),'Tree'),'Specialized layout methods for trees, i.e. acyclic graphs. The regular structure of graphs that have no undirected cycles can be emphasized using an algorithm of this type.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,'org.eclipse.elk.planar'),'Planar'),'Algorithms that require a planar or upward planar graph. Most of these algorithms are theoretically interesting, but not practically usable.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,sre),'Radial'),'Radial layout algorithms usually position the nodes of the graph on concentric circles.')));$ad((new _ad,a));Y7c((new Z7c,a));jdd((new kdd,a))};var o8c,p8c,q8c,r8c,s8c,t8c,u8c,v8c,w8c,x8c,y8c,z8c,A8c,B8c,C8c,D8c,E8c,F8c,G8c,H8c,I8c,J8c,K8c,L8c,M8c,N8c,O8c,P8c,Q8c,R8c,S8c,T8c,U8c,V8c,W8c,X8c,Y8c,Z8c,$8c,_8c,a9c,b9c,c9c,d9c,e9c,f9c,g9c,h9c,i9c,j9c,k9c,l9c,m9c,n9c,o9c,p9c,q9c,r9c,s9c,t9c,u9c,v9c,w9c,x9c,y9c,z9c,A9c,B9c,C9c,D9c,E9c,F9c,G9c,H9c,I9c,J9c,K9c,L9c,M9c,N9c,O9c,P9c,Q9c,R9c,S9c,T9c,U9c,V9c,W9c,X9c;var s1=mdb(ose,'CoreOptions',684);bcb(103,22,{3:1,35:1,22:1,103:1},iad);var _9c,aad,bad,cad,dad;var t1=ndb(ose,Cle,103,CI,kad,jad);var lad;bcb(272,22,{3:1,35:1,22:1,272:1},rad);var nad,oad,pad;var u1=ndb(ose,'EdgeLabelPlacement',272,CI,tad,sad);var uad;bcb(218,22,{3:1,35:1,22:1,218:1},Bad);var wad,xad,yad,zad;var v1=ndb(ose,'EdgeRouting',218,CI,Dad,Cad);var Ead;bcb(312,22,{3:1,35:1,22:1,312:1},Nad);var Gad,Had,Iad,Jad,Kad,Lad;var w1=ndb(ose,'EdgeType',312,CI,Pad,Oad);var Qad;bcb(977,1,ale,_ad);_.Qe=function abd(a){$ad(a)};var Sad,Tad,Uad,Vad,Wad,Xad,Yad;var y1=mdb(ose,'FixedLayouterOptions',977);bcb(978,1,{},bbd);_.$e=function cbd(){var a;return a=new Zfd,a};_._e=function dbd(a){};var x1=mdb(ose,'FixedLayouterOptions/FixedFactory',978);bcb(334,22,{3:1,35:1,22:1,334:1},ibd);var ebd,fbd,gbd;var z1=ndb(ose,'HierarchyHandling',334,CI,kbd,jbd);var lbd;bcb(285,22,{3:1,35:1,22:1,285:1},tbd);var nbd,obd,pbd,qbd;var A1=ndb(ose,'LabelSide',285,CI,vbd,ubd);var wbd;bcb(93,22,{3:1,35:1,22:1,93:1},Ibd);var ybd,zbd,Abd,Bbd,Cbd,Dbd,Ebd,Fbd,Gbd;var B1=ndb(ose,'NodeLabelPlacement',93,CI,Lbd,Kbd);var Mbd;bcb(249,22,{3:1,35:1,22:1,249:1},Ubd);var Obd,Pbd,Qbd,Rbd,Sbd;var C1=ndb(ose,'PortAlignment',249,CI,Wbd,Vbd);var Xbd;bcb(98,22,{3:1,35:1,22:1,98:1},gcd);var Zbd,$bd,_bd,acd,bcd,ccd;var D1=ndb(ose,'PortConstraints',98,CI,icd,hcd);var jcd;bcb(273,22,{3:1,35:1,22:1,273:1},scd);var lcd,mcd,ncd,ocd,pcd,qcd;var E1=ndb(ose,'PortLabelPlacement',273,CI,wcd,vcd);var xcd;bcb(61,22,{3:1,35:1,22:1,61:1},Ycd);var zcd,Acd,Bcd,Ccd,Dcd,Ecd,Fcd,Gcd,Hcd,Icd,Jcd,Kcd,Lcd,Mcd,Ncd,Ocd,Pcd,Qcd,Rcd,Scd,Tcd;var F1=ndb(ose,'PortSide',61,CI,_cd,$cd);var bdd;bcb(981,1,ale,kdd);_.Qe=function ldd(a){jdd(a)};var ddd,edd,fdd,gdd,hdd;var H1=mdb(ose,'RandomLayouterOptions',981);bcb(982,1,{},mdd);_.$e=function ndd(){var a;return a=new Mgd,a};_._e=function odd(a){};var G1=mdb(ose,'RandomLayouterOptions/RandomFactory',982);bcb(374,22,{3:1,35:1,22:1,374:1},udd);var pdd,qdd,rdd,sdd;var I1=ndb(ose,'SizeConstraint',374,CI,wdd,vdd);var xdd;bcb(259,22,{3:1,35:1,22:1,259:1},Jdd);var zdd,Add,Bdd,Cdd,Ddd,Edd,Fdd,Gdd,Hdd;var J1=ndb(ose,'SizeOptions',259,CI,Ldd,Kdd);var Mdd;bcb(370,1,{1949:1},Zdd);_.b=false;_.c=0;_.d=-1;_.e=null;_.f=null;_.g=-1;_.j=false;_.k=false;_.n=false;_.o=0;_.q=0;_.r=0;var L1=mdb(yqe,'BasicProgressMonitor',370);bcb(972,209,Mle,ged);_.Ze=function ked(a,b){var c,d,e,f,g,h,i,j,k;Odd(b,'Box layout',2);e=Gdb(ED(hkd(a,(X7c(),W7c))));f=BD(hkd(a,T7c),116);c=Ccb(DD(hkd(a,O7c)));d=Ccb(DD(hkd(a,P7c)));switch(BD(hkd(a,M7c),311).g){case 0:g=(h=new Tkb((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a)),mmb(),Okb(h,new med(d)),h);i=rfd(a);j=ED(hkd(a,L7c));(j==null||(uCb(j),j)<=0)&&(j=1.3);k=ded(g,e,f,i.a,i.b,c,(uCb(j),j));Afd(a,k.a,k.b,false,true);break;default:eed(a,e,f,c);}Qdd(b)};var S1=mdb(yqe,'BoxLayoutProvider',972);bcb(973,1,Dke,med);_.ue=function ned(a,b){return led(this,BD(a,33),BD(b,33))};_.Fb=function oed(a){return this===a};_.ve=function ped(){return new tpb(this)};_.a=false;var M1=mdb(yqe,'BoxLayoutProvider/1',973);bcb(157,1,{157:1},wed,xed);_.Ib=function yed(){return this.c?_od(this.c):Fe(this.b)};var N1=mdb(yqe,'BoxLayoutProvider/Group',157);bcb(311,22,{3:1,35:1,22:1,311:1},Eed);var zed,Aed,Bed,Ced;var O1=ndb(yqe,'BoxLayoutProvider/PackingMode',311,CI,Ged,Fed);var Hed;bcb(974,1,Dke,Jed);_.ue=function Ked(a,b){return hed(BD(a,157),BD(b,157))};_.Fb=function Led(a){return this===a};_.ve=function Med(){return new tpb(this)};var P1=mdb(yqe,'BoxLayoutProvider/lambda$0$Type',974);bcb(975,1,Dke,Ned);_.ue=function Oed(a,b){return ied(BD(a,157),BD(b,157))};_.Fb=function Ped(a){return this===a};_.ve=function Qed(){return new tpb(this)};var Q1=mdb(yqe,'BoxLayoutProvider/lambda$1$Type',975);bcb(976,1,Dke,Red);_.ue=function Sed(a,b){return jed(BD(a,157),BD(b,157))};_.Fb=function Ted(a){return this===a};_.ve=function Ued(){return new tpb(this)};var R1=mdb(yqe,'BoxLayoutProvider/lambda$2$Type',976);bcb(1365,1,{831:1},Ved);_.qg=function Wed(a,b){return Vyc(),!JD(b,160)||h2c((Y1c(),X1c,BD(a,160)),b)};var T1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$0$Type',1365);bcb(1366,1,qie,Xed);_.td=function Yed(a){Yyc(this.a,BD(a,146))};var U1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$1$Type',1366);bcb(1367,1,qie,Zed);_.td=function $ed(a){BD(a,94);Vyc()};var V1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$2$Type',1367);bcb(1371,1,qie,_ed);_.td=function afd(a){Zyc(this.a,BD(a,94))};var W1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$3$Type',1371);bcb(1369,1,Oie,bfd);_.Mb=function cfd(a){return $yc(this.a,this.b,BD(a,146))};var X1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$4$Type',1369);bcb(1368,1,Oie,dfd);_.Mb=function efd(a){return azc(this.a,this.b,BD(a,831))};var Y1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$5$Type',1368);bcb(1370,1,qie,ffd);_.td=function gfd(a){_yc(this.a,this.b,BD(a,146))};var Z1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$6$Type',1370);bcb(935,1,{},Hfd);_.Kb=function Ifd(a){return Gfd(a)};_.Fb=function Jfd(a){return this===a};var _1=mdb(yqe,'ElkUtil/lambda$0$Type',935);bcb(936,1,qie,Kfd);_.td=function Lfd(a){ufd(this.a,this.b,BD(a,79))};_.a=0;_.b=0;var a2=mdb(yqe,'ElkUtil/lambda$1$Type',936);bcb(937,1,qie,Mfd);_.td=function Nfd(a){vfd(this.a,this.b,BD(a,202))};_.a=0;_.b=0;var b2=mdb(yqe,'ElkUtil/lambda$2$Type',937);bcb(938,1,qie,Ofd);_.td=function Pfd(a){wfd(this.a,this.b,BD(a,137))};_.a=0;_.b=0;var c2=mdb(yqe,'ElkUtil/lambda$3$Type',938);bcb(939,1,qie,Qfd);_.td=function Rfd(a){xfd(this.a,BD(a,469))};var d2=mdb(yqe,'ElkUtil/lambda$4$Type',939);bcb(342,1,{35:1,342:1},Tfd);_.wd=function Ufd(a){return Sfd(this,BD(a,236))};_.Fb=function Vfd(a){var b;if(JD(a,342)){b=BD(a,342);return this.a==b.a}return false};_.Hb=function Wfd(){return QD(this.a)};_.Ib=function Xfd(){return this.a+' (exclusive)'};_.a=0;var e2=mdb(yqe,'ExclusiveBounds/ExclusiveLowerBound',342);bcb(1138,209,Mle,Zfd);_.Ze=function $fd(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B;Odd(b,'Fixed Layout',1);f=BD(hkd(a,(Y9c(),E8c)),218);l=0;m=0;for(s=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));s.e!=s.i.gc();){q=BD(Dyd(s),33);B=BD(hkd(q,(Zad(),Yad)),8);if(B){bld(q,B.a,B.b);if(BD(hkd(q,Tad),174).Hc((tdd(),pdd))){n=BD(hkd(q,Vad),8);n.a>0&&n.b>0&&Afd(q,n.a,n.b,true,true)}}l=$wnd.Math.max(l,q.i+q.g);m=$wnd.Math.max(m,q.j+q.f);for(j=new Fyd((!q.n&&(q.n=new cUd(D2,q,1,7)),q.n));j.e!=j.i.gc();){h=BD(Dyd(j),137);B=BD(hkd(h,Yad),8);!!B&&bld(h,B.a,B.b);l=$wnd.Math.max(l,q.i+h.i+h.g);m=$wnd.Math.max(m,q.j+h.j+h.f)}for(v=new Fyd((!q.c&&(q.c=new cUd(F2,q,9,9)),q.c));v.e!=v.i.gc();){u=BD(Dyd(v),118);B=BD(hkd(u,Yad),8);!!B&&bld(u,B.a,B.b);w=q.i+u.i;A=q.j+u.j;l=$wnd.Math.max(l,w+u.g);m=$wnd.Math.max(m,A+u.f);for(i=new Fyd((!u.n&&(u.n=new cUd(D2,u,1,7)),u.n));i.e!=i.i.gc();){h=BD(Dyd(i),137);B=BD(hkd(h,Yad),8);!!B&&bld(h,B.a,B.b);l=$wnd.Math.max(l,w+h.i+h.g);m=$wnd.Math.max(m,A+h.j+h.f)}}for(e=new Sr(ur(_sd(q).a.Kc(),new Sq));Qr(e);){c=BD(Rr(e),79);k=Yfd(c);l=$wnd.Math.max(l,k.a);m=$wnd.Math.max(m,k.b)}for(d=new Sr(ur($sd(q).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),79);if(Xod(jtd(c))!=a){k=Yfd(c);l=$wnd.Math.max(l,k.a);m=$wnd.Math.max(m,k.b)}}}if(f==(Aad(),wad)){for(r=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));r.e!=r.i.gc();){q=BD(Dyd(r),33);for(d=new Sr(ur(_sd(q).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),79);g=pfd(c);g.b==0?jkd(c,Q8c,null):jkd(c,Q8c,g)}}}if(!Ccb(DD(hkd(a,(Zad(),Uad))))){t=BD(hkd(a,Wad),116);p=l+t.b+t.c;o=m+t.d+t.a;Afd(a,p,o,true,true)}Qdd(b)};var f2=mdb(yqe,'FixedLayoutProvider',1138);bcb(373,134,{3:1,414:1,373:1,94:1,134:1},_fd,agd);_.Jf=function dgd(b){var c,d,e,f,g,h,i,j,k;if(!b){return}try{j=mfb(b,';,;');for(g=j,h=0,i=g.length;h>16&aje|b^d<<16};_.Kc=function zgd(){return new Bgd(this)};_.Ib=function Agd(){return this.a==null&&this.b==null?'pair(null,null)':this.a==null?'pair(null,'+fcb(this.b)+')':this.b==null?'pair('+fcb(this.a)+',null)':'pair('+fcb(this.a)+','+fcb(this.b)+')'};var n2=mdb(yqe,'Pair',46);bcb(983,1,aie,Bgd);_.Nb=function Cgd(a){Rrb(this,a)};_.Ob=function Dgd(){return !this.c&&(!this.b&&this.a.a!=null||this.a.b!=null)};_.Pb=function Egd(){if(!this.c&&!this.b&&this.a.a!=null){this.b=true;return this.a.a}else if(!this.c&&this.a.b!=null){this.c=true;return this.a.b}throw vbb(new utb)};_.Qb=function Fgd(){this.c&&this.a.b!=null?(this.a.b=null):this.b&&this.a.a!=null&&(this.a.a=null);throw vbb(new Ydb)};_.b=false;_.c=false;var m2=mdb(yqe,'Pair/1',983);bcb(448,1,{448:1},Ggd);_.Fb=function Hgd(a){return wtb(this.a,BD(a,448).a)&&wtb(this.c,BD(a,448).c)&&wtb(this.d,BD(a,448).d)&&wtb(this.b,BD(a,448).b)};_.Hb=function Igd(){return Hlb(OC(GC(SI,1),Uhe,1,5,[this.a,this.c,this.d,this.b]))};_.Ib=function Jgd(){return '('+this.a+She+this.c+She+this.d+She+this.b+')'};var o2=mdb(yqe,'Quadruple',448);bcb(1126,209,Mle,Mgd);_.Ze=function Ngd(a,b){var c,d,e,f,g;Odd(b,'Random Layout',1);if((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a).i==0){Qdd(b);return}f=BD(hkd(a,(idd(),gdd)),19);!!f&&f.a!=0?(e=new Hub(f.a)):(e=new Gub);c=Gdb(ED(hkd(a,ddd)));g=Gdb(ED(hkd(a,hdd)));d=BD(hkd(a,edd),116);Lgd(a,e,c,g,d);Qdd(b)};var p2=mdb(yqe,'RandomLayoutProvider',1126);var Ogd;bcb(553,1,{});_.qf=function Sgd(){return new f7c(this.f.i,this.f.j)};_.We=function Tgd(a){if(Jsd(a,(Y9c(),s9c))){return hkd(this.f,Qgd)}return hkd(this.f,a)};_.rf=function Ugd(){return new f7c(this.f.g,this.f.f)};_.sf=function Vgd(){return this.g};_.Xe=function Wgd(a){return ikd(this.f,a)};_.tf=function Xgd(a){dld(this.f,a.a);eld(this.f,a.b)};_.uf=function Ygd(a){cld(this.f,a.a);ald(this.f,a.b)};_.vf=function Zgd(a){this.g=a};_.g=0;var Qgd;var q2=mdb(Use,'ElkGraphAdapters/AbstractElkGraphElementAdapter',553);bcb(554,1,{839:1},$gd);_.wf=function _gd(){var a,b;if(!this.b){this.b=Qu(Kkd(this.a).i);for(b=new Fyd(Kkd(this.a));b.e!=b.i.gc();){a=BD(Dyd(b),137);Ekb(this.b,new dhd(a))}}return this.b};_.b=null;var r2=mdb(Use,'ElkGraphAdapters/ElkEdgeAdapter',554);bcb(301,553,{},bhd);_.xf=function chd(){return ahd(this)};_.a=null;var s2=mdb(Use,'ElkGraphAdapters/ElkGraphAdapter',301);bcb(630,553,{181:1},dhd);var t2=mdb(Use,'ElkGraphAdapters/ElkLabelAdapter',630);bcb(629,553,{680:1},hhd);_.wf=function khd(){return ehd(this)};_.Af=function lhd(){var a;return a=BD(hkd(this.f,(Y9c(),S8c)),142),!a&&(a=new H_b),a};_.Cf=function nhd(){return fhd(this)};_.Ef=function phd(a){var b;b=new K_b(a);jkd(this.f,(Y9c(),S8c),b)};_.Ff=function qhd(a){jkd(this.f,(Y9c(),f9c),new r0b(a))};_.yf=function ihd(){return this.d};_.zf=function jhd(){var a,b;if(!this.a){this.a=new Rkb;for(b=new Sr(ur($sd(BD(this.f,33)).a.Kc(),new Sq));Qr(b);){a=BD(Rr(b),79);Ekb(this.a,new $gd(a))}}return this.a};_.Bf=function mhd(){var a,b;if(!this.c){this.c=new Rkb;for(b=new Sr(ur(_sd(BD(this.f,33)).a.Kc(),new Sq));Qr(b);){a=BD(Rr(b),79);Ekb(this.c,new $gd(a))}}return this.c};_.Df=function ohd(){return Vod(BD(this.f,33)).i!=0||Ccb(DD(BD(this.f,33).We((Y9c(),M8c))))};_.Gf=function rhd(){ghd(this,(Pgd(),Ogd))};_.a=null;_.b=null;_.c=null;_.d=null;_.e=null;var u2=mdb(Use,'ElkGraphAdapters/ElkNodeAdapter',629);bcb(1266,553,{838:1},thd);_.wf=function vhd(){return shd(this)};_.zf=function uhd(){var a,b;if(!this.a){this.a=Pu(BD(this.f,118).xg().i);for(b=new Fyd(BD(this.f,118).xg());b.e!=b.i.gc();){a=BD(Dyd(b),79);Ekb(this.a,new $gd(a))}}return this.a};_.Bf=function whd(){var a,b;if(!this.c){this.c=Pu(BD(this.f,118).yg().i);for(b=new Fyd(BD(this.f,118).yg());b.e!=b.i.gc();){a=BD(Dyd(b),79);Ekb(this.c,new $gd(a))}}return this.c};_.Hf=function xhd(){return BD(BD(this.f,118).We((Y9c(),A9c)),61)};_.If=function yhd(){var a,b,c,d,e,f,g,h;d=mpd(BD(this.f,118));for(c=new Fyd(BD(this.f,118).yg());c.e!=c.i.gc();){a=BD(Dyd(c),79);for(h=new Fyd((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c));h.e!=h.i.gc();){g=BD(Dyd(h),82);if(ntd(atd(g),d)){return true}else if(atd(g)==d&&Ccb(DD(hkd(a,(Y9c(),N8c))))){return true}}}for(b=new Fyd(BD(this.f,118).xg());b.e!=b.i.gc();){a=BD(Dyd(b),79);for(f=new Fyd((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b));f.e!=f.i.gc();){e=BD(Dyd(f),82);if(ntd(atd(e),d)){return true}}}return false};_.a=null;_.b=null;_.c=null;var v2=mdb(Use,'ElkGraphAdapters/ElkPortAdapter',1266);bcb(1267,1,Dke,Ahd);_.ue=function Bhd(a,b){return zhd(BD(a,118),BD(b,118))};_.Fb=function Chd(a){return this===a};_.ve=function Dhd(){return new tpb(this)};var w2=mdb(Use,'ElkGraphAdapters/PortComparator',1267);var m5=odb(Vse,'EObject');var x2=odb(Wse,Xse);var y2=odb(Wse,Yse);var C2=odb(Wse,Zse);var G2=odb(Wse,'ElkShape');var z2=odb(Wse,$se);var B2=odb(Wse,_se);var A2=odb(Wse,ate);var k5=odb(Vse,bte);var i5=odb(Vse,'EFactory');var Ehd;var l5=odb(Vse,cte);var o5=odb(Vse,'EPackage');var Ghd;var Ihd,Jhd,Khd,Lhd,Mhd,Nhd,Ohd,Phd,Qhd,Rhd,Shd;var D2=odb(Wse,dte);var E2=odb(Wse,ete);var F2=odb(Wse,fte);bcb(90,1,gte);_.Jg=function Vhd(){this.Kg();return null};_.Kg=function Whd(){return null};_.Lg=function Xhd(){return this.Kg(),false};_.Mg=function Yhd(){return false};_.Ng=function Zhd(a){Uhd(this,a)};var b4=mdb(hte,'BasicNotifierImpl',90);bcb(97,90,pte);_.nh=function fjd(){return oid(this)};_.Og=function Fid(a,b){return a};_.Pg=function Gid(){throw vbb(new bgb)};_.Qg=function Hid(a){var b;return b=zUd(BD(XKd(this.Tg(),this.Vg()),18)),this.eh().ih(this,b.n,b.f,a)};_.Rg=function Iid(a,b){throw vbb(new bgb)};_.Sg=function Jid(a,b,c){return _hd(this,a,b,c)};_.Tg=function Kid(){var a;if(this.Pg()){a=this.Pg().ck();if(a){return a}}return this.zh()};_.Ug=function Lid(){return aid(this)};_.Vg=function Mid(){throw vbb(new bgb)};_.Wg=function Oid(){var a,b;b=this.ph().dk();!b&&this.Pg().ik(b=(nRd(),a=pNd(TKd(this.Tg())),a==null?mRd:new qRd(this,a)));return b};_.Xg=function Qid(a,b){return a};_.Yg=function Rid(a){var b;b=a.Gj();return !b?bLd(this.Tg(),a):a.aj()};_.Zg=function Sid(){var a;a=this.Pg();return !a?null:a.fk()};_.$g=function Tid(){return !this.Pg()?null:this.Pg().ck()};_._g=function Uid(a,b,c){return fid(this,a,b,c)};_.ah=function Vid(a){return gid(this,a)};_.bh=function Wid(a,b){return hid(this,a,b)};_.dh=function Xid(){var a;a=this.Pg();return !!a&&a.gk()};_.eh=function Yid(){throw vbb(new bgb)};_.fh=function Zid(){return jid(this)};_.gh=function $id(a,b,c,d){return kid(this,a,b,d)};_.hh=function _id(a,b,c){var d;return d=BD(XKd(this.Tg(),b),66),d.Nj().Qj(this,this.yh(),b-this.Ah(),a,c)};_.ih=function ajd(a,b,c,d){return lid(this,a,b,d)};_.jh=function bjd(a,b,c){var d;return d=BD(XKd(this.Tg(),b),66),d.Nj().Rj(this,this.yh(),b-this.Ah(),a,c)};_.kh=function cjd(){return !!this.Pg()&&!!this.Pg().ek()};_.lh=function djd(a){return mid(this,a)};_.mh=function ejd(a){return nid(this,a)};_.oh=function gjd(a){return rid(this,a)};_.ph=function hjd(){throw vbb(new bgb)};_.qh=function ijd(){return !this.Pg()?null:this.Pg().ek()};_.rh=function jjd(){return jid(this)};_.sh=function kjd(a,b){yid(this,a,b)};_.th=function ljd(a){this.ph().hk(a)};_.uh=function mjd(a){this.ph().kk(a)};_.vh=function njd(a){this.ph().jk(a)};_.wh=function ojd(a,b){var c,d,e,f;f=this.Zg();if(!!f&&!!a){b=Txd(f.Vk(),this,b);f.Zk(this)}d=this.eh();if(d){if((Nid(this,this.eh(),this.Vg()).Bb&Tje)!=0){e=d.fh();!!e&&(!a?e.Yk(this):!f&&e.Zk(this))}else{b=(c=this.Vg(),c>=0?this.Qg(b):this.eh().ih(this,-1-c,null,b));b=this.Sg(null,-1,b)}}this.uh(a);return b};_.xh=function pjd(a){var b,c,d,e,f,g,h,i;c=this.Tg();f=bLd(c,a);b=this.Ah();if(f>=b){return BD(a,66).Nj().Uj(this,this.yh(),f-b)}else if(f<=-1){g=e1d((O6d(),M6d),c,a);if(g){Q6d();BD(g,66).Oj()||(g=_1d(q1d(M6d,g)));e=(d=this.Yg(g),BD(d>=0?this._g(d,true,true):sid(this,g,true),153));i=g.Zj();if(i>1||i==-1){return BD(BD(e,215).hl(a,false),76)}}else{throw vbb(new Wdb(ite+a.ne()+lte))}}else if(a.$j()){return d=this.Yg(a),BD(d>=0?this._g(d,false,true):sid(this,a,false),76)}h=new nGd(this,a);return h};_.yh=function qjd(){return Aid(this)};_.zh=function rjd(){return (NFd(),MFd).S};_.Ah=function sjd(){return aLd(this.zh())};_.Bh=function tjd(a){Cid(this,a)};_.Ib=function ujd(){return Eid(this)};var B5=mdb(qte,'BasicEObjectImpl',97);var zFd;bcb(114,97,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1});_.Ch=function Djd(a){var b;b=xjd(this);return b[a]};_.Dh=function Ejd(a,b){var c;c=xjd(this);NC(c,a,b)};_.Eh=function Fjd(a){var b;b=xjd(this);NC(b,a,null)};_.Jg=function Gjd(){return BD(Ajd(this,4),126)};_.Kg=function Hjd(){throw vbb(new bgb)};_.Lg=function Ijd(){return (this.Db&4)!=0};_.Pg=function Jjd(){throw vbb(new bgb)};_.Fh=function Kjd(a){Cjd(this,2,a)};_.Rg=function Ljd(a,b){this.Db=b<<16|this.Db&255;this.Fh(a)};_.Tg=function Mjd(){return wjd(this)};_.Vg=function Njd(){return this.Db>>16};_.Wg=function Ojd(){var a,b;return nRd(),b=pNd(TKd((a=BD(Ajd(this,16),26),!a?this.zh():a))),b==null?(null,mRd):new qRd(this,b)};_.Mg=function Pjd(){return (this.Db&1)==0};_.Zg=function Qjd(){return BD(Ajd(this,128),1935)};_.$g=function Rjd(){return BD(Ajd(this,16),26)};_.dh=function Sjd(){return (this.Db&32)!=0};_.eh=function Tjd(){return BD(Ajd(this,2),49)};_.kh=function Ujd(){return (this.Db&64)!=0};_.ph=function Vjd(){throw vbb(new bgb)};_.qh=function Wjd(){return BD(Ajd(this,64),281)};_.th=function Xjd(a){Cjd(this,16,a)};_.uh=function Yjd(a){Cjd(this,128,a)};_.vh=function Zjd(a){Cjd(this,64,a)};_.yh=function $jd(){return yjd(this)};_.Db=0;var s8=mdb(qte,'MinimalEObjectImpl',114);bcb(115,114,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_.Fh=function _jd(a){this.Cb=a};_.eh=function akd(){return this.Cb};var r8=mdb(qte,'MinimalEObjectImpl/Container',115);bcb(1985,115,{105:1,413:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function kkd(a,b,c){return bkd(this,a,b,c)};_.jh=function lkd(a,b,c){return ckd(this,a,b,c)};_.lh=function mkd(a){return dkd(this,a)};_.sh=function nkd(a,b){ekd(this,a,b)};_.zh=function okd(){return Thd(),Shd};_.Bh=function pkd(a){fkd(this,a)};_.Ve=function qkd(){return gkd(this)};_.We=function rkd(a){return hkd(this,a)};_.Xe=function skd(a){return ikd(this,a)};_.Ye=function tkd(a,b){return jkd(this,a,b)};var H2=mdb(rte,'EMapPropertyHolderImpl',1985);bcb(567,115,{105:1,469:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},xkd);_._g=function ykd(a,b,c){switch(a){case 0:return this.a;case 1:return this.b;}return fid(this,a,b,c)};_.lh=function zkd(a){switch(a){case 0:return this.a!=0;case 1:return this.b!=0;}return mid(this,a)};_.sh=function Akd(a,b){switch(a){case 0:vkd(this,Edb(ED(b)));return;case 1:wkd(this,Edb(ED(b)));return;}yid(this,a,b)};_.zh=function Bkd(){return Thd(),Ihd};_.Bh=function Ckd(a){switch(a){case 0:vkd(this,0);return;case 1:wkd(this,0);return;}Cid(this,a)};_.Ib=function Dkd(){var a;if((this.Db&64)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (x: ';Bfb(a,this.a);a.a+=', y: ';Bfb(a,this.b);a.a+=')';return a.a};_.a=0;_.b=0;var I2=mdb(rte,'ElkBendPointImpl',567);bcb(723,1985,{105:1,413:1,160:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function Nkd(a,b,c){return Ekd(this,a,b,c)};_.hh=function Okd(a,b,c){return Fkd(this,a,b,c)};_.jh=function Pkd(a,b,c){return Gkd(this,a,b,c)};_.lh=function Qkd(a){return Hkd(this,a)};_.sh=function Rkd(a,b){Ikd(this,a,b)};_.zh=function Skd(){return Thd(),Mhd};_.Bh=function Tkd(a){Jkd(this,a)};_.zg=function Ukd(){return this.k};_.Ag=function Vkd(){return Kkd(this)};_.Ib=function Wkd(){return Mkd(this)};_.k=null;var M2=mdb(rte,'ElkGraphElementImpl',723);bcb(724,723,{105:1,413:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function gld(a,b,c){return Xkd(this,a,b,c)};_.lh=function hld(a){return Ykd(this,a)};_.sh=function ild(a,b){Zkd(this,a,b)};_.zh=function jld(){return Thd(),Rhd};_.Bh=function kld(a){$kd(this,a)};_.Bg=function lld(){return this.f};_.Cg=function mld(){return this.g};_.Dg=function nld(){return this.i};_.Eg=function old(){return this.j};_.Fg=function pld(a,b){_kd(this,a,b)};_.Gg=function qld(a,b){bld(this,a,b)};_.Hg=function rld(a){dld(this,a)};_.Ig=function sld(a){eld(this,a)};_.Ib=function tld(){return fld(this)};_.f=0;_.g=0;_.i=0;_.j=0;var T2=mdb(rte,'ElkShapeImpl',724);bcb(725,724,{105:1,413:1,82:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function Bld(a,b,c){return uld(this,a,b,c)};_.hh=function Cld(a,b,c){return vld(this,a,b,c)};_.jh=function Dld(a,b,c){return wld(this,a,b,c)};_.lh=function Eld(a){return xld(this,a)};_.sh=function Fld(a,b){yld(this,a,b)};_.zh=function Gld(){return Thd(),Jhd};_.Bh=function Hld(a){zld(this,a)};_.xg=function Ild(){return !this.d&&(this.d=new y5d(B2,this,8,5)),this.d};_.yg=function Jld(){return !this.e&&(this.e=new y5d(B2,this,7,4)),this.e};var J2=mdb(rte,'ElkConnectableShapeImpl',725);bcb(352,723,{105:1,413:1,79:1,160:1,352:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},Tld);_.Qg=function Uld(a){return Lld(this,a)};_._g=function Vld(a,b,c){switch(a){case 3:return Mld(this);case 4:return !this.b&&(this.b=new y5d(z2,this,4,7)),this.b;case 5:return !this.c&&(this.c=new y5d(z2,this,5,8)),this.c;case 6:return !this.a&&(this.a=new cUd(A2,this,6,6)),this.a;case 7:return Bcb(),!this.b&&(this.b=new y5d(z2,this,4,7)),this.b.i<=1&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i<=1)?false:true;case 8:return Bcb(),Pld(this)?true:false;case 9:return Bcb(),Qld(this)?true:false;case 10:return Bcb(),!this.b&&(this.b=new y5d(z2,this,4,7)),this.b.i!=0&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i!=0)?true:false;}return Ekd(this,a,b,c)};_.hh=function Wld(a,b,c){var d;switch(b){case 3:!!this.Cb&&(c=(d=this.Db>>16,d>=0?Lld(this,c):this.Cb.ih(this,-1-d,null,c)));return Kld(this,BD(a,33),c);case 4:return !this.b&&(this.b=new y5d(z2,this,4,7)),Sxd(this.b,a,c);case 5:return !this.c&&(this.c=new y5d(z2,this,5,8)),Sxd(this.c,a,c);case 6:return !this.a&&(this.a=new cUd(A2,this,6,6)),Sxd(this.a,a,c);}return Fkd(this,a,b,c)};_.jh=function Xld(a,b,c){switch(b){case 3:return Kld(this,null,c);case 4:return !this.b&&(this.b=new y5d(z2,this,4,7)),Txd(this.b,a,c);case 5:return !this.c&&(this.c=new y5d(z2,this,5,8)),Txd(this.c,a,c);case 6:return !this.a&&(this.a=new cUd(A2,this,6,6)),Txd(this.a,a,c);}return Gkd(this,a,b,c)};_.lh=function Yld(a){switch(a){case 3:return !!Mld(this);case 4:return !!this.b&&this.b.i!=0;case 5:return !!this.c&&this.c.i!=0;case 6:return !!this.a&&this.a.i!=0;case 7:return !this.b&&(this.b=new y5d(z2,this,4,7)),!(this.b.i<=1&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i<=1));case 8:return Pld(this);case 9:return Qld(this);case 10:return !this.b&&(this.b=new y5d(z2,this,4,7)),this.b.i!=0&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i!=0);}return Hkd(this,a)};_.sh=function Zld(a,b){switch(a){case 3:Rld(this,BD(b,33));return;case 4:!this.b&&(this.b=new y5d(z2,this,4,7));Uxd(this.b);!this.b&&(this.b=new y5d(z2,this,4,7));ytd(this.b,BD(b,14));return;case 5:!this.c&&(this.c=new y5d(z2,this,5,8));Uxd(this.c);!this.c&&(this.c=new y5d(z2,this,5,8));ytd(this.c,BD(b,14));return;case 6:!this.a&&(this.a=new cUd(A2,this,6,6));Uxd(this.a);!this.a&&(this.a=new cUd(A2,this,6,6));ytd(this.a,BD(b,14));return;}Ikd(this,a,b)};_.zh=function $ld(){return Thd(),Khd};_.Bh=function _ld(a){switch(a){case 3:Rld(this,null);return;case 4:!this.b&&(this.b=new y5d(z2,this,4,7));Uxd(this.b);return;case 5:!this.c&&(this.c=new y5d(z2,this,5,8));Uxd(this.c);return;case 6:!this.a&&(this.a=new cUd(A2,this,6,6));Uxd(this.a);return;}Jkd(this,a)};_.Ib=function amd(){return Sld(this)};var K2=mdb(rte,'ElkEdgeImpl',352);bcb(439,1985,{105:1,413:1,202:1,439:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},rmd);_.Qg=function smd(a){return cmd(this,a)};_._g=function tmd(a,b,c){switch(a){case 1:return this.j;case 2:return this.k;case 3:return this.b;case 4:return this.c;case 5:return !this.a&&(this.a=new xMd(y2,this,5)),this.a;case 6:return fmd(this);case 7:if(b)return emd(this);return this.i;case 8:if(b)return dmd(this);return this.f;case 9:return !this.g&&(this.g=new y5d(A2,this,9,10)),this.g;case 10:return !this.e&&(this.e=new y5d(A2,this,10,9)),this.e;case 11:return this.d;}return bkd(this,a,b,c)};_.hh=function umd(a,b,c){var d,e,f;switch(b){case 6:!!this.Cb&&(c=(e=this.Db>>16,e>=0?cmd(this,c):this.Cb.ih(this,-1-e,null,c)));return bmd(this,BD(a,79),c);case 9:return !this.g&&(this.g=new y5d(A2,this,9,10)),Sxd(this.g,a,c);case 10:return !this.e&&(this.e=new y5d(A2,this,10,9)),Sxd(this.e,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(Thd(),Lhd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((Thd(),Lhd)),a,c)};_.jh=function vmd(a,b,c){switch(b){case 5:return !this.a&&(this.a=new xMd(y2,this,5)),Txd(this.a,a,c);case 6:return bmd(this,null,c);case 9:return !this.g&&(this.g=new y5d(A2,this,9,10)),Txd(this.g,a,c);case 10:return !this.e&&(this.e=new y5d(A2,this,10,9)),Txd(this.e,a,c);}return ckd(this,a,b,c)};_.lh=function wmd(a){switch(a){case 1:return this.j!=0;case 2:return this.k!=0;case 3:return this.b!=0;case 4:return this.c!=0;case 5:return !!this.a&&this.a.i!=0;case 6:return !!fmd(this);case 7:return !!this.i;case 8:return !!this.f;case 9:return !!this.g&&this.g.i!=0;case 10:return !!this.e&&this.e.i!=0;case 11:return this.d!=null;}return dkd(this,a)};_.sh=function xmd(a,b){switch(a){case 1:omd(this,Edb(ED(b)));return;case 2:pmd(this,Edb(ED(b)));return;case 3:hmd(this,Edb(ED(b)));return;case 4:imd(this,Edb(ED(b)));return;case 5:!this.a&&(this.a=new xMd(y2,this,5));Uxd(this.a);!this.a&&(this.a=new xMd(y2,this,5));ytd(this.a,BD(b,14));return;case 6:mmd(this,BD(b,79));return;case 7:lmd(this,BD(b,82));return;case 8:kmd(this,BD(b,82));return;case 9:!this.g&&(this.g=new y5d(A2,this,9,10));Uxd(this.g);!this.g&&(this.g=new y5d(A2,this,9,10));ytd(this.g,BD(b,14));return;case 10:!this.e&&(this.e=new y5d(A2,this,10,9));Uxd(this.e);!this.e&&(this.e=new y5d(A2,this,10,9));ytd(this.e,BD(b,14));return;case 11:jmd(this,GD(b));return;}ekd(this,a,b)};_.zh=function ymd(){return Thd(),Lhd};_.Bh=function zmd(a){switch(a){case 1:omd(this,0);return;case 2:pmd(this,0);return;case 3:hmd(this,0);return;case 4:imd(this,0);return;case 5:!this.a&&(this.a=new xMd(y2,this,5));Uxd(this.a);return;case 6:mmd(this,null);return;case 7:lmd(this,null);return;case 8:kmd(this,null);return;case 9:!this.g&&(this.g=new y5d(A2,this,9,10));Uxd(this.g);return;case 10:!this.e&&(this.e=new y5d(A2,this,10,9));Uxd(this.e);return;case 11:jmd(this,null);return;}fkd(this,a)};_.Ib=function Amd(){return qmd(this)};_.b=0;_.c=0;_.d=null;_.j=0;_.k=0;var L2=mdb(rte,'ElkEdgeSectionImpl',439);bcb(150,115,{105:1,92:1,90:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1});_._g=function Emd(a,b,c){var d;if(a==0){return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.hh=function Fmd(a,b,c){var d,e;if(b==0){return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c)}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Qj(this,yjd(this),b-aLd(this.zh()),a,c)};_.jh=function Gmd(a,b,c){var d,e;if(b==0){return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c)}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function Hmd(a){var b;if(a==0){return !!this.Ab&&this.Ab.i!=0}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.oh=function Imd(a){return Bmd(this,a)};_.sh=function Jmd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.uh=function Kmd(a){Cjd(this,128,a)};_.zh=function Lmd(){return jGd(),ZFd};_.Bh=function Mmd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.Gh=function Nmd(){this.Bb|=1};_.Hh=function Omd(a){return Dmd(this,a)};_.Bb=0;var f6=mdb(qte,'EModelElementImpl',150);bcb(704,150,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},$md);_.Ih=function _md(a,b){return Vmd(this,a,b)};_.Jh=function and(a){var b,c,d,e,f;if(this.a!=bKd(a)||(a.Bb&256)!=0){throw vbb(new Wdb(xte+a.zb+ute))}for(d=_Kd(a);VKd(d.a).i!=0;){c=BD(nOd(d,0,(b=BD(qud(VKd(d.a),0),87),f=b.c,JD(f,88)?BD(f,26):(jGd(),_Fd))),26);if(dKd(c)){e=bKd(c).Nh().Jh(c);BD(e,49).th(a);return e}d=_Kd(c)}return (a.D!=null?a.D:a.B)=='java.util.Map$Entry'?new lHd(a):new _Gd(a)};_.Kh=function bnd(a,b){return Wmd(this,a,b)};_._g=function cnd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.a;}return bid(this,a-aLd((jGd(),WFd)),XKd((d=BD(Ajd(this,16),26),!d?WFd:d),a),b,c)};_.hh=function dnd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 1:!!this.a&&(c=BD(this.a,49).ih(this,4,o5,c));return Tmd(this,BD(a,235),c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),WFd):d),b),66),e.Nj().Qj(this,yjd(this),b-aLd((jGd(),WFd)),a,c)};_.jh=function end(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 1:return Tmd(this,null,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),WFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),WFd)),a,c)};_.lh=function fnd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return !!this.a;}return cid(this,a-aLd((jGd(),WFd)),XKd((b=BD(Ajd(this,16),26),!b?WFd:b),a))};_.sh=function gnd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:Ymd(this,BD(b,235));return;}did(this,a-aLd((jGd(),WFd)),XKd((c=BD(Ajd(this,16),26),!c?WFd:c),a),b)};_.zh=function hnd(){return jGd(),WFd};_.Bh=function ind(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:Ymd(this,null);return;}eid(this,a-aLd((jGd(),WFd)),XKd((b=BD(Ajd(this,16),26),!b?WFd:b),a))};var Pmd,Qmd,Rmd;var d6=mdb(qte,'EFactoryImpl',704);bcb(zte,704,{105:1,2014:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},knd);_.Ih=function lnd(a,b){switch(a.yj()){case 12:return BD(b,146).tg();case 13:return fcb(b);default:throw vbb(new Wdb(tte+a.ne()+ute));}};_.Jh=function mnd(a){var b,c,d,e,f,g,h,i;switch(a.G==-1&&(a.G=(b=bKd(a),b?HLd(b.Mh(),a):-1)),a.G){case 4:return f=new Jod,f;case 6:return g=new apd,g;case 7:return h=new ppd,h;case 8:return d=new Tld,d;case 9:return c=new xkd,c;case 10:return e=new rmd,e;case 11:return i=new Bpd,i;default:throw vbb(new Wdb(xte+a.zb+ute));}};_.Kh=function nnd(a,b){switch(a.yj()){case 13:case 12:return null;default:throw vbb(new Wdb(tte+a.ne()+ute));}};var N2=mdb(rte,'ElkGraphFactoryImpl',zte);bcb(438,150,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1});_.Wg=function rnd(){var a,b;b=(a=BD(Ajd(this,16),26),pNd(TKd(!a?this.zh():a)));return b==null?(nRd(),nRd(),mRd):new GRd(this,b)};_._g=function snd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.ne();}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.lh=function tnd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function und(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:this.Lh(GD(b));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function vnd(){return jGd(),$Fd};_.Bh=function wnd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:this.Lh(null);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.ne=function xnd(){return this.zb};_.Lh=function ynd(a){pnd(this,a)};_.Ib=function znd(){return qnd(this)};_.zb=null;var j6=mdb(qte,'ENamedElementImpl',438);bcb(179,438,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},eod);_.Qg=function god(a){return Snd(this,a)};_._g=function hod(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.yb;case 3:return this.xb;case 4:return this.sb;case 5:return !this.rb&&(this.rb=new jUd(this,d5,this)),this.rb;case 6:return !this.vb&&(this.vb=new gUd(o5,this,6,7)),this.vb;case 7:if(b)return this.Db>>16==7?BD(this.Cb,235):null;return Ind(this);}return bid(this,a-aLd((jGd(),cGd)),XKd((d=BD(Ajd(this,16),26),!d?cGd:d),a),b,c)};_.hh=function iod(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 4:!!this.sb&&(c=BD(this.sb,49).ih(this,1,i5,c));return Jnd(this,BD(a,471),c);case 5:return !this.rb&&(this.rb=new jUd(this,d5,this)),Sxd(this.rb,a,c);case 6:return !this.vb&&(this.vb=new gUd(o5,this,6,7)),Sxd(this.vb,a,c);case 7:!!this.Cb&&(c=(e=this.Db>>16,e>=0?Snd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,7,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),cGd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),cGd)),a,c)};_.jh=function jod(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 4:return Jnd(this,null,c);case 5:return !this.rb&&(this.rb=new jUd(this,d5,this)),Txd(this.rb,a,c);case 6:return !this.vb&&(this.vb=new gUd(o5,this,6,7)),Txd(this.vb,a,c);case 7:return _hd(this,null,7,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),cGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),cGd)),a,c)};_.lh=function kod(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.yb!=null;case 3:return this.xb!=null;case 4:return !!this.sb;case 5:return !!this.rb&&this.rb.i!=0;case 6:return !!this.vb&&this.vb.i!=0;case 7:return !!Ind(this);}return cid(this,a-aLd((jGd(),cGd)),XKd((b=BD(Ajd(this,16),26),!b?cGd:b),a))};_.oh=function lod(a){var b;b=Und(this,a);return b?b:Bmd(this,a)};_.sh=function mod(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:dod(this,GD(b));return;case 3:cod(this,GD(b));return;case 4:bod(this,BD(b,471));return;case 5:!this.rb&&(this.rb=new jUd(this,d5,this));Uxd(this.rb);!this.rb&&(this.rb=new jUd(this,d5,this));ytd(this.rb,BD(b,14));return;case 6:!this.vb&&(this.vb=new gUd(o5,this,6,7));Uxd(this.vb);!this.vb&&(this.vb=new gUd(o5,this,6,7));ytd(this.vb,BD(b,14));return;}did(this,a-aLd((jGd(),cGd)),XKd((c=BD(Ajd(this,16),26),!c?cGd:c),a),b)};_.vh=function nod(a){var b,c;if(!!a&&!!this.rb){for(c=new Fyd(this.rb);c.e!=c.i.gc();){b=Dyd(c);JD(b,351)&&(BD(b,351).w=null)}}Cjd(this,64,a)};_.zh=function ood(){return jGd(),cGd};_.Bh=function pod(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:dod(this,null);return;case 3:cod(this,null);return;case 4:bod(this,null);return;case 5:!this.rb&&(this.rb=new jUd(this,d5,this));Uxd(this.rb);return;case 6:!this.vb&&(this.vb=new gUd(o5,this,6,7));Uxd(this.vb);return;}eid(this,a-aLd((jGd(),cGd)),XKd((b=BD(Ajd(this,16),26),!b?cGd:b),a))};_.Gh=function qod(){Tnd(this)};_.Mh=function rod(){return !this.rb&&(this.rb=new jUd(this,d5,this)),this.rb};_.Nh=function sod(){return this.sb};_.Oh=function tod(){return this.ub};_.Ph=function uod(){return this.xb};_.Qh=function vod(){return this.yb};_.Rh=function wod(a){this.ub=a};_.Ib=function xod(){var a;if((this.Db&64)!=0)return qnd(this);a=new Jfb(qnd(this));a.a+=' (nsURI: ';Efb(a,this.yb);a.a+=', nsPrefix: ';Efb(a,this.xb);a.a+=')';return a.a};_.xb=null;_.yb=null;var And;var t6=mdb(qte,'EPackageImpl',179);bcb(555,179,{105:1,2016:1,555:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},Bod);_.q=false;_.r=false;var yod=false;var O2=mdb(rte,'ElkGraphPackageImpl',555);bcb(354,724,{105:1,413:1,160:1,137:1,470:1,354:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},Jod);_.Qg=function Kod(a){return Eod(this,a)};_._g=function Lod(a,b,c){switch(a){case 7:return Fod(this);case 8:return this.a;}return Xkd(this,a,b,c)};_.hh=function Mod(a,b,c){var d;switch(b){case 7:!!this.Cb&&(c=(d=this.Db>>16,d>=0?Eod(this,c):this.Cb.ih(this,-1-d,null,c)));return Dod(this,BD(a,160),c);}return Fkd(this,a,b,c)};_.jh=function Nod(a,b,c){if(b==7){return Dod(this,null,c)}return Gkd(this,a,b,c)};_.lh=function Ood(a){switch(a){case 7:return !!Fod(this);case 8:return !dfb('',this.a);}return Ykd(this,a)};_.sh=function Pod(a,b){switch(a){case 7:God(this,BD(b,160));return;case 8:Hod(this,GD(b));return;}Zkd(this,a,b)};_.zh=function Qod(){return Thd(),Nhd};_.Bh=function Rod(a){switch(a){case 7:God(this,null);return;case 8:Hod(this,'');return;}$kd(this,a)};_.Ib=function Sod(){return Iod(this)};_.a='';var P2=mdb(rte,'ElkLabelImpl',354);bcb(239,725,{105:1,413:1,82:1,160:1,33:1,470:1,239:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},apd);_.Qg=function bpd(a){return Uod(this,a)};_._g=function cpd(a,b,c){switch(a){case 9:return !this.c&&(this.c=new cUd(F2,this,9,9)),this.c;case 10:return !this.a&&(this.a=new cUd(E2,this,10,11)),this.a;case 11:return Xod(this);case 12:return !this.b&&(this.b=new cUd(B2,this,12,3)),this.b;case 13:return Bcb(),!this.a&&(this.a=new cUd(E2,this,10,11)),this.a.i>0?true:false;}return uld(this,a,b,c)};_.hh=function dpd(a,b,c){var d;switch(b){case 9:return !this.c&&(this.c=new cUd(F2,this,9,9)),Sxd(this.c,a,c);case 10:return !this.a&&(this.a=new cUd(E2,this,10,11)),Sxd(this.a,a,c);case 11:!!this.Cb&&(c=(d=this.Db>>16,d>=0?Uod(this,c):this.Cb.ih(this,-1-d,null,c)));return Tod(this,BD(a,33),c);case 12:return !this.b&&(this.b=new cUd(B2,this,12,3)),Sxd(this.b,a,c);}return vld(this,a,b,c)};_.jh=function epd(a,b,c){switch(b){case 9:return !this.c&&(this.c=new cUd(F2,this,9,9)),Txd(this.c,a,c);case 10:return !this.a&&(this.a=new cUd(E2,this,10,11)),Txd(this.a,a,c);case 11:return Tod(this,null,c);case 12:return !this.b&&(this.b=new cUd(B2,this,12,3)),Txd(this.b,a,c);}return wld(this,a,b,c)};_.lh=function fpd(a){switch(a){case 9:return !!this.c&&this.c.i!=0;case 10:return !!this.a&&this.a.i!=0;case 11:return !!Xod(this);case 12:return !!this.b&&this.b.i!=0;case 13:return !this.a&&(this.a=new cUd(E2,this,10,11)),this.a.i>0;}return xld(this,a)};_.sh=function gpd(a,b){switch(a){case 9:!this.c&&(this.c=new cUd(F2,this,9,9));Uxd(this.c);!this.c&&(this.c=new cUd(F2,this,9,9));ytd(this.c,BD(b,14));return;case 10:!this.a&&(this.a=new cUd(E2,this,10,11));Uxd(this.a);!this.a&&(this.a=new cUd(E2,this,10,11));ytd(this.a,BD(b,14));return;case 11:$od(this,BD(b,33));return;case 12:!this.b&&(this.b=new cUd(B2,this,12,3));Uxd(this.b);!this.b&&(this.b=new cUd(B2,this,12,3));ytd(this.b,BD(b,14));return;}yld(this,a,b)};_.zh=function hpd(){return Thd(),Ohd};_.Bh=function ipd(a){switch(a){case 9:!this.c&&(this.c=new cUd(F2,this,9,9));Uxd(this.c);return;case 10:!this.a&&(this.a=new cUd(E2,this,10,11));Uxd(this.a);return;case 11:$od(this,null);return;case 12:!this.b&&(this.b=new cUd(B2,this,12,3));Uxd(this.b);return;}zld(this,a)};_.Ib=function jpd(){return _od(this)};var Q2=mdb(rte,'ElkNodeImpl',239);bcb(186,725,{105:1,413:1,82:1,160:1,118:1,470:1,186:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},ppd);_.Qg=function qpd(a){return lpd(this,a)};_._g=function rpd(a,b,c){if(a==9){return mpd(this)}return uld(this,a,b,c)};_.hh=function spd(a,b,c){var d;switch(b){case 9:!!this.Cb&&(c=(d=this.Db>>16,d>=0?lpd(this,c):this.Cb.ih(this,-1-d,null,c)));return kpd(this,BD(a,33),c);}return vld(this,a,b,c)};_.jh=function tpd(a,b,c){if(b==9){return kpd(this,null,c)}return wld(this,a,b,c)};_.lh=function upd(a){if(a==9){return !!mpd(this)}return xld(this,a)};_.sh=function vpd(a,b){switch(a){case 9:npd(this,BD(b,33));return;}yld(this,a,b)};_.zh=function wpd(){return Thd(),Phd};_.Bh=function xpd(a){switch(a){case 9:npd(this,null);return;}zld(this,a)};_.Ib=function ypd(){return opd(this)};var R2=mdb(rte,'ElkPortImpl',186);var J4=odb(Tte,'BasicEMap/Entry');bcb(1092,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,114:1,115:1},Bpd);_.Fb=function Hpd(a){return this===a};_.cd=function Jpd(){return this.b};_.Hb=function Lpd(){return FCb(this)};_.Uh=function Npd(a){zpd(this,BD(a,146))};_._g=function Cpd(a,b,c){switch(a){case 0:return this.b;case 1:return this.c;}return fid(this,a,b,c)};_.lh=function Dpd(a){switch(a){case 0:return !!this.b;case 1:return this.c!=null;}return mid(this,a)};_.sh=function Epd(a,b){switch(a){case 0:zpd(this,BD(b,146));return;case 1:Apd(this,b);return;}yid(this,a,b)};_.zh=function Fpd(){return Thd(),Qhd};_.Bh=function Gpd(a){switch(a){case 0:zpd(this,null);return;case 1:Apd(this,null);return;}Cid(this,a)};_.Sh=function Ipd(){var a;if(this.a==-1){a=this.b;this.a=!a?0:tb(a)}return this.a};_.dd=function Kpd(){return this.c};_.Th=function Mpd(a){this.a=a};_.ed=function Opd(a){var b;b=this.c;Apd(this,a);return b};_.Ib=function Ppd(){var a;if((this.Db&64)!=0)return Eid(this);a=new Ufb;Qfb(Qfb(Qfb(a,this.b?this.b.tg():Xhe),gne),xfb(this.c));return a.a};_.a=-1;_.c=null;var S2=mdb(rte,'ElkPropertyToValueMapEntryImpl',1092);bcb(984,1,{},bqd);var U2=mdb(Wte,'JsonAdapter',984);bcb(210,60,Tie,cqd);var V2=mdb(Wte,'JsonImportException',210);bcb(857,1,{},ird);var J3=mdb(Wte,'JsonImporter',857);bcb(891,1,{},jrd);var W2=mdb(Wte,'JsonImporter/lambda$0$Type',891);bcb(892,1,{},krd);var X2=mdb(Wte,'JsonImporter/lambda$1$Type',892);bcb(900,1,{},lrd);var Y2=mdb(Wte,'JsonImporter/lambda$10$Type',900);bcb(902,1,{},mrd);var Z2=mdb(Wte,'JsonImporter/lambda$11$Type',902);bcb(903,1,{},nrd);var $2=mdb(Wte,'JsonImporter/lambda$12$Type',903);bcb(909,1,{},ord);var _2=mdb(Wte,'JsonImporter/lambda$13$Type',909);bcb(908,1,{},prd);var a3=mdb(Wte,'JsonImporter/lambda$14$Type',908);bcb(904,1,{},qrd);var b3=mdb(Wte,'JsonImporter/lambda$15$Type',904);bcb(905,1,{},rrd);var c3=mdb(Wte,'JsonImporter/lambda$16$Type',905);bcb(906,1,{},srd);var d3=mdb(Wte,'JsonImporter/lambda$17$Type',906);bcb(907,1,{},trd);var e3=mdb(Wte,'JsonImporter/lambda$18$Type',907);bcb(912,1,{},urd);var f3=mdb(Wte,'JsonImporter/lambda$19$Type',912);bcb(893,1,{},vrd);var g3=mdb(Wte,'JsonImporter/lambda$2$Type',893);bcb(910,1,{},wrd);var h3=mdb(Wte,'JsonImporter/lambda$20$Type',910);bcb(911,1,{},xrd);var i3=mdb(Wte,'JsonImporter/lambda$21$Type',911);bcb(915,1,{},yrd);var j3=mdb(Wte,'JsonImporter/lambda$22$Type',915);bcb(913,1,{},zrd);var k3=mdb(Wte,'JsonImporter/lambda$23$Type',913);bcb(914,1,{},Ard);var l3=mdb(Wte,'JsonImporter/lambda$24$Type',914);bcb(917,1,{},Brd);var m3=mdb(Wte,'JsonImporter/lambda$25$Type',917);bcb(916,1,{},Crd);var n3=mdb(Wte,'JsonImporter/lambda$26$Type',916);bcb(918,1,qie,Drd);_.td=function Erd(a){Bqd(this.b,this.a,GD(a))};var o3=mdb(Wte,'JsonImporter/lambda$27$Type',918);bcb(919,1,qie,Frd);_.td=function Grd(a){Cqd(this.b,this.a,GD(a))};var p3=mdb(Wte,'JsonImporter/lambda$28$Type',919);bcb(920,1,{},Hrd);var q3=mdb(Wte,'JsonImporter/lambda$29$Type',920);bcb(896,1,{},Ird);var r3=mdb(Wte,'JsonImporter/lambda$3$Type',896);bcb(921,1,{},Jrd);var s3=mdb(Wte,'JsonImporter/lambda$30$Type',921);bcb(922,1,{},Krd);var t3=mdb(Wte,'JsonImporter/lambda$31$Type',922);bcb(923,1,{},Lrd);var u3=mdb(Wte,'JsonImporter/lambda$32$Type',923);bcb(924,1,{},Mrd);var v3=mdb(Wte,'JsonImporter/lambda$33$Type',924);bcb(925,1,{},Nrd);var w3=mdb(Wte,'JsonImporter/lambda$34$Type',925);bcb(859,1,{},Prd);var x3=mdb(Wte,'JsonImporter/lambda$35$Type',859);bcb(929,1,{},Rrd);var y3=mdb(Wte,'JsonImporter/lambda$36$Type',929);bcb(926,1,qie,Srd);_.td=function Trd(a){Lqd(this.a,BD(a,469))};var z3=mdb(Wte,'JsonImporter/lambda$37$Type',926);bcb(927,1,qie,Urd);_.td=function Vrd(a){Mqd(this.a,this.b,BD(a,202))};var A3=mdb(Wte,'JsonImporter/lambda$38$Type',927);bcb(928,1,qie,Wrd);_.td=function Xrd(a){Nqd(this.a,this.b,BD(a,202))};var B3=mdb(Wte,'JsonImporter/lambda$39$Type',928);bcb(894,1,{},Yrd);var C3=mdb(Wte,'JsonImporter/lambda$4$Type',894);bcb(930,1,qie,Zrd);_.td=function $rd(a){Oqd(this.a,BD(a,8))};var D3=mdb(Wte,'JsonImporter/lambda$40$Type',930);bcb(895,1,{},_rd);var E3=mdb(Wte,'JsonImporter/lambda$5$Type',895);bcb(899,1,{},asd);var F3=mdb(Wte,'JsonImporter/lambda$6$Type',899);bcb(897,1,{},bsd);var G3=mdb(Wte,'JsonImporter/lambda$7$Type',897);bcb(898,1,{},csd);var H3=mdb(Wte,'JsonImporter/lambda$8$Type',898);bcb(901,1,{},dsd);var I3=mdb(Wte,'JsonImporter/lambda$9$Type',901);bcb(948,1,qie,msd);_.td=function nsd(a){Qpd(this.a,new yC(GD(a)))};var K3=mdb(Wte,'JsonMetaDataConverter/lambda$0$Type',948);bcb(949,1,qie,osd);_.td=function psd(a){isd(this.a,BD(a,237))};var L3=mdb(Wte,'JsonMetaDataConverter/lambda$1$Type',949);bcb(950,1,qie,qsd);_.td=function rsd(a){jsd(this.a,BD(a,149))};var M3=mdb(Wte,'JsonMetaDataConverter/lambda$2$Type',950);bcb(951,1,qie,ssd);_.td=function tsd(a){ksd(this.a,BD(a,175))};var N3=mdb(Wte,'JsonMetaDataConverter/lambda$3$Type',951);bcb(237,22,{3:1,35:1,22:1,237:1},Dsd);var usd,vsd,wsd,xsd,ysd,zsd,Asd,Bsd;var O3=ndb(Hle,'GraphFeature',237,CI,Fsd,Esd);var Gsd;bcb(13,1,{35:1,146:1},Lsd,Msd,Nsd,Osd);_.wd=function Psd(a){return Isd(this,BD(a,146))};_.Fb=function Qsd(a){return Jsd(this,a)};_.wg=function Rsd(){return Ksd(this)};_.tg=function Ssd(){return this.b};_.Hb=function Tsd(){return LCb(this.b)};_.Ib=function Usd(){return this.b};var T3=mdb(Hle,'Property',13);bcb(818,1,Dke,Wsd);_.ue=function Xsd(a,b){return Vsd(this,BD(a,94),BD(b,94))};_.Fb=function Ysd(a){return this===a};_.ve=function Zsd(){return new tpb(this)};var S3=mdb(Hle,'PropertyHolderComparator',818);bcb(695,1,aie,qtd);_.Nb=function rtd(a){Rrb(this,a)};_.Pb=function ttd(){return ptd(this)};_.Qb=function utd(){Srb()};_.Ob=function std(){return !!this.a};var U3=mdb(jue,'ElkGraphUtil/AncestorIterator',695);var T4=odb(Tte,'EList');bcb(67,52,{20:1,28:1,52:1,14:1,15:1,67:1,58:1});_.Vc=function Jtd(a,b){vtd(this,a,b)};_.Fc=function Ktd(a){return wtd(this,a)};_.Wc=function Ltd(a,b){return xtd(this,a,b)};_.Gc=function Mtd(a){return ytd(this,a)};_.Zh=function Ntd(){return new $yd(this)};_.$h=function Otd(){return new bzd(this)};_._h=function Ptd(a){return ztd(this,a)};_.ai=function Qtd(){return true};_.bi=function Rtd(a,b){};_.ci=function Std(){};_.di=function Ttd(a,b){Atd(this,a,b)};_.ei=function Utd(a,b,c){};_.fi=function Vtd(a,b){};_.gi=function Wtd(a,b,c){};_.Fb=function Xtd(a){return Btd(this,a)};_.Hb=function Ytd(){return Etd(this)};_.hi=function Ztd(){return false};_.Kc=function $td(){return new Fyd(this)};_.Yc=function _td(){return new Oyd(this)};_.Zc=function aud(a){var b;b=this.gc();if(a<0||a>b)throw vbb(new Cyd(a,b));return new Pyd(this,a)};_.ji=function bud(a,b){this.ii(a,this.Xc(b))};_.Mc=function cud(a){return Ftd(this,a)};_.li=function dud(a,b){return b};_._c=function eud(a,b){return Gtd(this,a,b)};_.Ib=function fud(){return Htd(this)};_.ni=function gud(){return true};_.oi=function hud(a,b){return Itd(this,b)};var p4=mdb(Tte,'AbstractEList',67);bcb(63,67,oue,yud,zud,Aud);_.Vh=function Bud(a,b){return iud(this,a,b)};_.Wh=function Cud(a){return jud(this,a)};_.Xh=function Dud(a,b){kud(this,a,b)};_.Yh=function Eud(a){lud(this,a)};_.pi=function Fud(a){return nud(this,a)};_.$b=function Gud(){oud(this)};_.Hc=function Hud(a){return pud(this,a)};_.Xb=function Iud(a){return qud(this,a)};_.qi=function Jud(a){var b,c,d;++this.j;c=this.g==null?0:this.g.length;if(a>c){d=this.g;b=c+(c/2|0)+4;b=0){this.$c(b);return true}else{return false}};_.mi=function lwd(a,b){return this.Ui(a,this.oi(a,b))};_.gc=function mwd(){return this.Vi()};_.Pc=function nwd(){return this.Wi()};_.Qc=function owd(a){return this.Xi(a)};_.Ib=function pwd(){return this.Yi()};var M4=mdb(Tte,'DelegatingEList',1995);bcb(1996,1995,eve);_.Vh=function xwd(a,b){return qwd(this,a,b)};_.Wh=function ywd(a){return this.Vh(this.Vi(),a)};_.Xh=function zwd(a,b){rwd(this,a,b)};_.Yh=function Awd(a){swd(this,a)};_.ai=function Bwd(){return !this.bj()};_.$b=function Cwd(){vwd(this)};_.Zi=function Dwd(a,b,c,d,e){return new Cxd(this,a,b,c,d,e)};_.$i=function Ewd(a){Uhd(this.Ai(),a)};_._i=function Fwd(){return null};_.aj=function Gwd(){return -1};_.Ai=function Hwd(){return null};_.bj=function Iwd(){return false};_.cj=function Jwd(a,b){return b};_.dj=function Kwd(a,b){return b};_.ej=function Lwd(){return false};_.fj=function Mwd(){return !this.Ri()};_.ii=function Nwd(a,b){var c,d;if(this.ej()){d=this.fj();c=Dvd(this,a,b);this.$i(this.Zi(7,meb(b),c,a,d));return c}else{return Dvd(this,a,b)}};_.$c=function Owd(a){var b,c,d,e;if(this.ej()){c=null;d=this.fj();b=this.Zi(4,e=Evd(this,a),null,a,d);if(this.bj()&&!!e){c=this.dj(e,c);if(!c){this.$i(b)}else{c.Ei(b);c.Fi()}}else{if(!c){this.$i(b)}else{c.Ei(b);c.Fi()}}return e}else{e=Evd(this,a);if(this.bj()&&!!e){c=this.dj(e,null);!!c&&c.Fi()}return e}};_.mi=function Pwd(a,b){return wwd(this,a,b)};var d4=mdb(hte,'DelegatingNotifyingListImpl',1996);bcb(143,1,fve);_.Ei=function pxd(a){return Qwd(this,a)};_.Fi=function qxd(){Rwd(this)};_.xi=function rxd(){return this.d};_._i=function sxd(){return null};_.gj=function txd(){return null};_.yi=function uxd(a){return -1};_.zi=function vxd(){return $wd(this)};_.Ai=function wxd(){return null};_.Bi=function xxd(){return hxd(this)};_.Ci=function yxd(){return this.o<0?this.o<-2?-2-this.o-1:-1:this.o};_.hj=function zxd(){return false};_.Di=function Axd(a){var b,c,d,e,f,g,h,i,j,k,l;switch(this.d){case 1:case 2:{e=a.xi();switch(e){case 1:case 2:{f=a.Ai();if(PD(f)===PD(this.Ai())&&this.yi(null)==a.yi(null)){this.g=a.zi();a.xi()==1&&(this.d=1);return true}}}}case 4:{e=a.xi();switch(e){case 4:{f=a.Ai();if(PD(f)===PD(this.Ai())&&this.yi(null)==a.yi(null)){j=jxd(this);i=this.o<0?this.o<-2?-2-this.o-1:-1:this.o;g=a.Ci();this.d=6;l=new zud(2);if(i<=g){wtd(l,this.n);wtd(l,a.Bi());this.g=OC(GC(WD,1),oje,25,15,[this.o=i,g+1])}else{wtd(l,a.Bi());wtd(l,this.n);this.g=OC(GC(WD,1),oje,25,15,[this.o=g,i])}this.n=l;j||(this.o=-2-this.o-1);return true}break}}break}case 6:{e=a.xi();switch(e){case 4:{f=a.Ai();if(PD(f)===PD(this.Ai())&&this.yi(null)==a.yi(null)){j=jxd(this);g=a.Ci();k=BD(this.g,48);d=KC(WD,oje,25,k.length+1,15,1);b=0;while(b>>0,b.toString(16)));d.a+=' (eventType: ';switch(this.d){case 1:{d.a+='SET';break}case 2:{d.a+='UNSET';break}case 3:{d.a+='ADD';break}case 5:{d.a+='ADD_MANY';break}case 4:{d.a+='REMOVE';break}case 6:{d.a+='REMOVE_MANY';break}case 7:{d.a+='MOVE';break}case 8:{d.a+='REMOVING_ADAPTER';break}case 9:{d.a+='RESOLVE';break}default:{Cfb(d,this.d);break}}ixd(this)&&(d.a+=', touch: true',d);d.a+=', position: ';Cfb(d,this.o<0?this.o<-2?-2-this.o-1:-1:this.o);d.a+=', notifier: ';Dfb(d,this.Ai());d.a+=', feature: ';Dfb(d,this._i());d.a+=', oldValue: ';Dfb(d,hxd(this));d.a+=', newValue: ';if(this.d==6&&JD(this.g,48)){c=BD(this.g,48);d.a+='[';for(a=0;a10){if(!this.b||this.c.j!=this.a){this.b=new Vqb(this);this.a=this.j}return Rqb(this.b,a)}else{return pud(this,a)}};_.ni=function Byd(){return true};_.a=0;var j4=mdb(Tte,'AbstractEList/1',953);bcb(295,73,Mje,Cyd);var k4=mdb(Tte,'AbstractEList/BasicIndexOutOfBoundsException',295);bcb(40,1,aie,Fyd);_.Nb=function Iyd(a){Rrb(this,a)};_.mj=function Gyd(){if(this.i.j!=this.f){throw vbb(new Apb)}};_.nj=function Hyd(){return Dyd(this)};_.Ob=function Jyd(){return this.e!=this.i.gc()};_.Pb=function Kyd(){return this.nj()};_.Qb=function Lyd(){Eyd(this)};_.e=0;_.f=0;_.g=-1;var l4=mdb(Tte,'AbstractEList/EIterator',40);bcb(278,40,jie,Oyd,Pyd);_.Qb=function Xyd(){Eyd(this)};_.Rb=function Qyd(a){Myd(this,a)};_.oj=function Ryd(){var b;try{b=this.d.Xb(--this.e);this.mj();this.g=this.e;return b}catch(a){a=ubb(a);if(JD(a,73)){this.mj();throw vbb(new utb)}else throw vbb(a)}};_.pj=function Syd(a){Nyd(this,a)};_.Sb=function Tyd(){return this.e!=0};_.Tb=function Uyd(){return this.e};_.Ub=function Vyd(){return this.oj()};_.Vb=function Wyd(){return this.e-1};_.Wb=function Yyd(a){this.pj(a)};var m4=mdb(Tte,'AbstractEList/EListIterator',278);bcb(341,40,aie,$yd);_.nj=function _yd(){return Zyd(this)};_.Qb=function azd(){throw vbb(new bgb)};var n4=mdb(Tte,'AbstractEList/NonResolvingEIterator',341);bcb(385,278,jie,bzd,czd);_.Rb=function dzd(a){throw vbb(new bgb)};_.nj=function ezd(){var b;try{b=this.c.ki(this.e);this.mj();this.g=this.e++;return b}catch(a){a=ubb(a);if(JD(a,73)){this.mj();throw vbb(new utb)}else throw vbb(a)}};_.oj=function fzd(){var b;try{b=this.c.ki(--this.e);this.mj();this.g=this.e;return b}catch(a){a=ubb(a);if(JD(a,73)){this.mj();throw vbb(new utb)}else throw vbb(a)}};_.Qb=function gzd(){throw vbb(new bgb)};_.Wb=function hzd(a){throw vbb(new bgb)};var o4=mdb(Tte,'AbstractEList/NonResolvingEListIterator',385);bcb(1982,67,ive);_.Vh=function pzd(a,b){var c,d,e,f,g,h,i,j,k,l,m;e=b.gc();if(e!=0){j=BD(Ajd(this.a,4),126);k=j==null?0:j.length;m=k+e;d=nzd(this,m);l=k-a;l>0&&$fb(j,a,d,a+e,l);i=b.Kc();for(g=0;gc)throw vbb(new Cyd(a,c));return new Yzd(this,a)};_.$b=function wzd(){var a,b;++this.j;a=BD(Ajd(this.a,4),126);b=a==null?0:a.length;b0d(this,null);Atd(this,b,a)};_.Hc=function xzd(a){var b,c,d,e,f;b=BD(Ajd(this.a,4),126);if(b!=null){if(a!=null){for(d=b,e=0,f=d.length;e=c)throw vbb(new Cyd(a,c));return b[a]};_.Xc=function zzd(a){var b,c,d;b=BD(Ajd(this.a,4),126);if(b!=null){if(a!=null){for(c=0,d=b.length;cc)throw vbb(new Cyd(a,c));return new Qzd(this,a)};_.ii=function Ezd(a,b){var c,d,e;c=mzd(this);e=c==null?0:c.length;if(a>=e)throw vbb(new qcb(lue+a+mue+e));if(b>=e)throw vbb(new qcb(nue+b+mue+e));d=c[b];if(a!=b){a0&&$fb(a,0,b,0,c);return b};_.Qc=function Kzd(a){var b,c,d;b=BD(Ajd(this.a,4),126);d=b==null?0:b.length;if(d>0){if(a.lengthd&&NC(a,d,null);return a};var jzd;var v4=mdb(Tte,'ArrayDelegatingEList',1982);bcb(1038,40,aie,Lzd);_.mj=function Mzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};_.Qb=function Nzd(){Eyd(this);this.a=BD(Ajd(this.b.a,4),126)};var r4=mdb(Tte,'ArrayDelegatingEList/EIterator',1038);bcb(706,278,jie,Pzd,Qzd);_.mj=function Rzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};_.pj=function Szd(a){Nyd(this,a);this.a=BD(Ajd(this.b.a,4),126)};_.Qb=function Tzd(){Eyd(this);this.a=BD(Ajd(this.b.a,4),126)};var s4=mdb(Tte,'ArrayDelegatingEList/EListIterator',706);bcb(1039,341,aie,Uzd);_.mj=function Vzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};var t4=mdb(Tte,'ArrayDelegatingEList/NonResolvingEIterator',1039);bcb(707,385,jie,Xzd,Yzd);_.mj=function Zzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};var u4=mdb(Tte,'ArrayDelegatingEList/NonResolvingEListIterator',707);bcb(606,295,Mje,$zd);var w4=mdb(Tte,'BasicEList/BasicIndexOutOfBoundsException',606);bcb(696,63,oue,_zd);_.Vc=function aAd(a,b){throw vbb(new bgb)};_.Fc=function bAd(a){throw vbb(new bgb)};_.Wc=function cAd(a,b){throw vbb(new bgb)};_.Gc=function dAd(a){throw vbb(new bgb)};_.$b=function eAd(){throw vbb(new bgb)};_.qi=function fAd(a){throw vbb(new bgb)};_.Kc=function gAd(){return this.Zh()};_.Yc=function hAd(){return this.$h()};_.Zc=function iAd(a){return this._h(a)};_.ii=function jAd(a,b){throw vbb(new bgb)};_.ji=function kAd(a,b){throw vbb(new bgb)};_.$c=function lAd(a){throw vbb(new bgb)};_.Mc=function mAd(a){throw vbb(new bgb)};_._c=function nAd(a,b){throw vbb(new bgb)};var x4=mdb(Tte,'BasicEList/UnmodifiableEList',696);bcb(705,1,{3:1,20:1,14:1,15:1,58:1,589:1});_.Vc=function OAd(a,b){oAd(this,a,BD(b,42))};_.Fc=function PAd(a){return pAd(this,BD(a,42))};_.Jc=function XAd(a){reb(this,a)};_.Xb=function YAd(a){return BD(qud(this.c,a),133)};_.ii=function fBd(a,b){return BD(this.c.ii(a,b),42)};_.ji=function gBd(a,b){GAd(this,a,BD(b,42))};_.Lc=function jBd(){return new YAb(null,new Kub(this,16))};_.$c=function kBd(a){return BD(this.c.$c(a),42)};_._c=function mBd(a,b){return MAd(this,a,BD(b,42))};_.ad=function oBd(a){ktb(this,a)};_.Nc=function pBd(){return new Kub(this,16)};_.Oc=function qBd(){return new YAb(null,new Kub(this,16))};_.Wc=function QAd(a,b){return this.c.Wc(a,b)};_.Gc=function RAd(a){return this.c.Gc(a)};_.$b=function SAd(){this.c.$b()};_.Hc=function TAd(a){return this.c.Hc(a)};_.Ic=function UAd(a){return Be(this.c,a)};_.qj=function VAd(){var a,b,c;if(this.d==null){this.d=KC(y4,jve,63,2*this.f+1,0,1);c=this.e;this.f=0;for(b=this.c.Kc();b.e!=b.i.gc();){a=BD(b.nj(),133);uAd(this,a)}this.e=c}};_.Fb=function WAd(a){return zAd(this,a)};_.Hb=function ZAd(){return Etd(this.c)};_.Xc=function $Ad(a){return this.c.Xc(a)};_.rj=function _Ad(){this.c=new yBd(this)};_.dc=function aBd(){return this.f==0};_.Kc=function bBd(){return this.c.Kc()};_.Yc=function cBd(){return this.c.Yc()};_.Zc=function dBd(a){return this.c.Zc(a)};_.sj=function eBd(){return FAd(this)};_.tj=function hBd(a,b,c){return new zCd(a,b,c)};_.uj=function iBd(){return new EBd};_.Mc=function lBd(a){return JAd(this,a)};_.gc=function nBd(){return this.f};_.bd=function rBd(a,b){return new Jib(this.c,a,b)};_.Pc=function sBd(){return this.c.Pc()};_.Qc=function tBd(a){return this.c.Qc(a)};_.Ib=function uBd(){return Htd(this.c)};_.e=0;_.f=0;var L4=mdb(Tte,'BasicEMap',705);bcb(1033,63,oue,yBd);_.bi=function zBd(a,b){vBd(this,BD(b,133))};_.ei=function BBd(a,b,c){var d;++(d=this,BD(b,133),d).a.e};_.fi=function CBd(a,b){wBd(this,BD(b,133))};_.gi=function DBd(a,b,c){xBd(this,BD(b,133),BD(c,133))};_.di=function ABd(a,b){tAd(this.a)};var z4=mdb(Tte,'BasicEMap/1',1033);bcb(1034,63,oue,EBd);_.ri=function FBd(a){return KC(I4,kve,612,a,0,1)};var A4=mdb(Tte,'BasicEMap/2',1034);bcb(1035,eie,fie,GBd);_.$b=function HBd(){this.a.c.$b()};_.Hc=function IBd(a){return qAd(this.a,a)};_.Kc=function JBd(){return this.a.f==0?(LCd(),KCd.a):new dCd(this.a)};_.Mc=function KBd(a){var b;b=this.a.f;LAd(this.a,a);return this.a.f!=b};_.gc=function LBd(){return this.a.f};var B4=mdb(Tte,'BasicEMap/3',1035);bcb(1036,28,die,MBd);_.$b=function NBd(){this.a.c.$b()};_.Hc=function OBd(a){return rAd(this.a,a)};_.Kc=function PBd(){return this.a.f==0?(LCd(),KCd.a):new fCd(this.a)};_.gc=function QBd(){return this.a.f};var C4=mdb(Tte,'BasicEMap/4',1036);bcb(1037,eie,fie,SBd);_.$b=function TBd(){this.a.c.$b()};_.Hc=function UBd(a){var b,c,d,e,f,g,h,i,j;if(this.a.f>0&&JD(a,42)){this.a.qj();i=BD(a,42);h=i.cd();e=h==null?0:tb(h);f=DAd(this.a,e);b=this.a.d[f];if(b){c=BD(b.g,367);j=b.i;for(g=0;g'+this.c};_.a=0;var I4=mdb(Tte,'BasicEMap/EntryImpl',612);bcb(536,1,{},JCd);var K4=mdb(Tte,'BasicEMap/View',536);var KCd;bcb(768,1,{});_.Fb=function ZCd(a){return At((mmb(),jmb),a)};_.Hb=function $Cd(){return qmb((mmb(),jmb))};_.Ib=function _Cd(){return Fe((mmb(),jmb))};var Q4=mdb(Tte,'ECollections/BasicEmptyUnmodifiableEList',768);bcb(1312,1,jie,aDd);_.Nb=function cDd(a){Rrb(this,a)};_.Rb=function bDd(a){throw vbb(new bgb)};_.Ob=function dDd(){return false};_.Sb=function eDd(){return false};_.Pb=function fDd(){throw vbb(new utb)};_.Tb=function gDd(){return 0};_.Ub=function hDd(){throw vbb(new utb)};_.Vb=function iDd(){return -1};_.Qb=function jDd(){throw vbb(new bgb)};_.Wb=function kDd(a){throw vbb(new bgb)};var P4=mdb(Tte,'ECollections/BasicEmptyUnmodifiableEList/1',1312);bcb(1310,768,{20:1,14:1,15:1,58:1},lDd);_.Vc=function mDd(a,b){OCd()};_.Fc=function nDd(a){return PCd()};_.Wc=function oDd(a,b){return QCd()};_.Gc=function pDd(a){return RCd()};_.$b=function qDd(){SCd()};_.Hc=function rDd(a){return false};_.Ic=function sDd(a){return false};_.Jc=function tDd(a){reb(this,a)};_.Xb=function uDd(a){return wmb((mmb(),jmb,a)),null};_.Xc=function vDd(a){return -1};_.dc=function wDd(){return true};_.Kc=function xDd(){return this.a};_.Yc=function yDd(){return this.a};_.Zc=function zDd(a){return this.a};_.ii=function ADd(a,b){return TCd()};_.ji=function BDd(a,b){UCd()};_.Lc=function CDd(){return new YAb(null,new Kub(this,16))};_.$c=function DDd(a){return VCd()};_.Mc=function EDd(a){return WCd()};_._c=function FDd(a,b){return XCd()};_.gc=function GDd(){return 0};_.ad=function HDd(a){ktb(this,a)};_.Nc=function IDd(){return new Kub(this,16)};_.Oc=function JDd(){return new YAb(null,new Kub(this,16))};_.bd=function KDd(a,b){return mmb(),new Jib(jmb,a,b)};_.Pc=function LDd(){return De((mmb(),jmb))};_.Qc=function MDd(a){return mmb(),Ee(jmb,a)};var R4=mdb(Tte,'ECollections/EmptyUnmodifiableEList',1310);bcb(1311,768,{20:1,14:1,15:1,58:1,589:1},NDd);_.Vc=function ODd(a,b){OCd()};_.Fc=function PDd(a){return PCd()};_.Wc=function QDd(a,b){return QCd()};_.Gc=function RDd(a){return RCd()};_.$b=function SDd(){SCd()};_.Hc=function TDd(a){return false};_.Ic=function UDd(a){return false};_.Jc=function VDd(a){reb(this,a)};_.Xb=function WDd(a){return wmb((mmb(),jmb,a)),null};_.Xc=function XDd(a){return -1};_.dc=function YDd(){return true};_.Kc=function ZDd(){return this.a};_.Yc=function $Dd(){return this.a};_.Zc=function _Dd(a){return this.a};_.ii=function bEd(a,b){return TCd()};_.ji=function cEd(a,b){UCd()};_.Lc=function dEd(){return new YAb(null,new Kub(this,16))};_.$c=function eEd(a){return VCd()};_.Mc=function fEd(a){return WCd()};_._c=function gEd(a,b){return XCd()};_.gc=function hEd(){return 0};_.ad=function iEd(a){ktb(this,a)};_.Nc=function jEd(){return new Kub(this,16)};_.Oc=function kEd(){return new YAb(null,new Kub(this,16))};_.bd=function lEd(a,b){return mmb(),new Jib(jmb,a,b)};_.Pc=function mEd(){return De((mmb(),jmb))};_.Qc=function nEd(a){return mmb(),Ee(jmb,a)};_.sj=function aEd(){return mmb(),mmb(),kmb};var S4=mdb(Tte,'ECollections/EmptyUnmodifiableEMap',1311);var U4=odb(Tte,'Enumerator');var oEd;bcb(281,1,{281:1},NEd);_.Fb=function REd(a){var b;if(this===a)return true;if(!JD(a,281))return false;b=BD(a,281);return this.f==b.f&&TEd(this.i,b.i)&&SEd(this.a,(this.f&256)!=0?(b.f&256)!=0?b.a:null:(b.f&256)!=0?null:b.a)&&SEd(this.d,b.d)&&SEd(this.g,b.g)&&SEd(this.e,b.e)&&KEd(this,b)};_.Hb=function WEd(){return this.f};_.Ib=function cFd(){return LEd(this)};_.f=0;var sEd=0,tEd=0,uEd=0,vEd=0,wEd=0,xEd=0,yEd=0,zEd=0,AEd=0,BEd,CEd=0,DEd=0,EEd=0,FEd=0,GEd,HEd;var Z4=mdb(Tte,'URI',281);bcb(1091,43,fke,mFd);_.zc=function nFd(a,b){return BD(Shb(this,GD(a),BD(b,281)),281)};var Y4=mdb(Tte,'URI/URICache',1091);bcb(497,63,oue,oFd,pFd);_.hi=function qFd(){return true};var $4=mdb(Tte,'UniqueEList',497);bcb(581,60,Tie,rFd);var _4=mdb(Tte,'WrappedException',581);var a5=odb(Vse,nve);var v5=odb(Vse,ove);var t5=odb(Vse,pve);var b5=odb(Vse,qve);var d5=odb(Vse,rve);var c5=odb(Vse,'EClass');var f5=odb(Vse,'EDataType');var sFd;bcb(1183,43,fke,vFd);_.xc=function wFd(a){return ND(a)?Phb(this,a):Wd(irb(this.f,a))};var e5=mdb(Vse,'EDataType/Internal/ConversionDelegate/Factory/Registry/Impl',1183);var h5=odb(Vse,'EEnum');var g5=odb(Vse,sve);var j5=odb(Vse,tve);var n5=odb(Vse,uve);var xFd;var p5=odb(Vse,vve);var q5=odb(Vse,wve);bcb(1029,1,{},BFd);_.Ib=function CFd(){return 'NIL'};var r5=mdb(Vse,'EStructuralFeature/Internal/DynamicValueHolder/1',1029);var DFd;bcb(1028,43,fke,GFd);_.xc=function HFd(a){return ND(a)?Phb(this,a):Wd(irb(this.f,a))};var s5=mdb(Vse,'EStructuralFeature/Internal/SettingDelegate/Factory/Registry/Impl',1028);var u5=odb(Vse,xve);var w5=odb(Vse,'EValidator/PatternMatcher');var IFd;var KFd;var MFd;var OFd,PFd,QFd,RFd,SFd,TFd,UFd,VFd,WFd,XFd,YFd,ZFd,$Fd,_Fd,aGd,bGd,cGd,dGd,eGd,fGd,gGd,hGd,iGd;var E9=odb(yve,'FeatureMap/Entry');bcb(535,1,{72:1},kGd);_.ak=function lGd(){return this.a};_.dd=function mGd(){return this.b};var x5=mdb(qte,'BasicEObjectImpl/1',535);bcb(1027,1,zve,nGd);_.Wj=function oGd(a){return hid(this.a,this.b,a)};_.fj=function pGd(){return nid(this.a,this.b)};_.Wb=function qGd(a){zid(this.a,this.b,a)};_.Xj=function rGd(){Did(this.a,this.b)};var y5=mdb(qte,'BasicEObjectImpl/4',1027);bcb(1983,1,{108:1});_.bk=function uGd(a){this.e=a==0?sGd:KC(SI,Uhe,1,a,5,1)};_.Ch=function vGd(a){return this.e[a]};_.Dh=function wGd(a,b){this.e[a]=b};_.Eh=function xGd(a){this.e[a]=null};_.ck=function yGd(){return this.c};_.dk=function zGd(){throw vbb(new bgb)};_.ek=function AGd(){throw vbb(new bgb)};_.fk=function BGd(){return this.d};_.gk=function CGd(){return this.e!=null};_.hk=function DGd(a){this.c=a};_.ik=function EGd(a){throw vbb(new bgb)};_.jk=function FGd(a){throw vbb(new bgb)};_.kk=function GGd(a){this.d=a};var sGd;var z5=mdb(qte,'BasicEObjectImpl/EPropertiesHolderBaseImpl',1983);bcb(185,1983,{108:1},HGd);_.dk=function IGd(){return this.a};_.ek=function JGd(){return this.b};_.ik=function KGd(a){this.a=a};_.jk=function LGd(a){this.b=a};var A5=mdb(qte,'BasicEObjectImpl/EPropertiesHolderImpl',185);bcb(506,97,pte,MGd);_.Kg=function NGd(){return this.f};_.Pg=function OGd(){return this.k};_.Rg=function PGd(a,b){this.g=a;this.i=b};_.Tg=function QGd(){return (this.j&2)==0?this.zh():this.ph().ck()};_.Vg=function RGd(){return this.i};_.Mg=function SGd(){return (this.j&1)!=0};_.eh=function TGd(){return this.g};_.kh=function UGd(){return (this.j&4)!=0};_.ph=function VGd(){return !this.k&&(this.k=new HGd),this.k};_.th=function WGd(a){this.ph().hk(a);a?(this.j|=2):(this.j&=-3)};_.vh=function XGd(a){this.ph().jk(a);a?(this.j|=4):(this.j&=-5)};_.zh=function YGd(){return (NFd(),MFd).S};_.i=0;_.j=1;var l6=mdb(qte,'EObjectImpl',506);bcb(780,506,{105:1,92:1,90:1,56:1,108:1,49:1,97:1},_Gd);_.Ch=function aHd(a){return this.e[a]};_.Dh=function bHd(a,b){this.e[a]=b};_.Eh=function cHd(a){this.e[a]=null};_.Tg=function dHd(){return this.d};_.Yg=function eHd(a){return bLd(this.d,a)};_.$g=function fHd(){return this.d};_.dh=function gHd(){return this.e!=null};_.ph=function hHd(){!this.k&&(this.k=new vHd);return this.k};_.th=function iHd(a){this.d=a};_.yh=function jHd(){var a;if(this.e==null){a=aLd(this.d);this.e=a==0?ZGd:KC(SI,Uhe,1,a,5,1)}return this};_.Ah=function kHd(){return 0};var ZGd;var E5=mdb(qte,'DynamicEObjectImpl',780);bcb(1376,780,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1},lHd);_.Fb=function nHd(a){return this===a};_.Hb=function rHd(){return FCb(this)};_.th=function mHd(a){this.d=a;this.b=YKd(a,'key');this.c=YKd(a,Bte)};_.Sh=function oHd(){var a;if(this.a==-1){a=iid(this,this.b);this.a=a==null?0:tb(a)}return this.a};_.cd=function pHd(){return iid(this,this.b)};_.dd=function qHd(){return iid(this,this.c)};_.Th=function sHd(a){this.a=a};_.Uh=function tHd(a){zid(this,this.b,a)};_.ed=function uHd(a){var b;b=iid(this,this.c);zid(this,this.c,a);return b};_.a=0;var C5=mdb(qte,'DynamicEObjectImpl/BasicEMapEntry',1376);bcb(1377,1,{108:1},vHd);_.bk=function wHd(a){throw vbb(new bgb)};_.Ch=function xHd(a){throw vbb(new bgb)};_.Dh=function yHd(a,b){throw vbb(new bgb)};_.Eh=function zHd(a){throw vbb(new bgb)};_.ck=function AHd(){throw vbb(new bgb)};_.dk=function BHd(){return this.a};_.ek=function CHd(){return this.b};_.fk=function DHd(){return this.c};_.gk=function EHd(){throw vbb(new bgb)};_.hk=function FHd(a){throw vbb(new bgb)};_.ik=function GHd(a){this.a=a};_.jk=function HHd(a){this.b=a};_.kk=function IHd(a){this.c=a};var D5=mdb(qte,'DynamicEObjectImpl/DynamicEPropertiesHolderImpl',1377);bcb(510,150,{105:1,92:1,90:1,590:1,147:1,56:1,108:1,49:1,97:1,510:1,150:1,114:1,115:1},RHd);_.Qg=function SHd(a){return KHd(this,a)};_._g=function THd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.d;case 2:return c?(!this.b&&(this.b=new sId((jGd(),fGd),x6,this)),this.b):(!this.b&&(this.b=new sId((jGd(),fGd),x6,this)),FAd(this.b));case 3:return MHd(this);case 4:return !this.a&&(this.a=new xMd(m5,this,4)),this.a;case 5:return !this.c&&(this.c=new _4d(m5,this,5)),this.c;}return bid(this,a-aLd((jGd(),OFd)),XKd((d=BD(Ajd(this,16),26),!d?OFd:d),a),b,c)};_.hh=function UHd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 3:!!this.Cb&&(c=(e=this.Db>>16,e>=0?KHd(this,c):this.Cb.ih(this,-1-e,null,c)));return JHd(this,BD(a,147),c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),OFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),OFd)),a,c)};_.jh=function VHd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 2:return !this.b&&(this.b=new sId((jGd(),fGd),x6,this)),bId(this.b,a,c);case 3:return JHd(this,null,c);case 4:return !this.a&&(this.a=new xMd(m5,this,4)),Txd(this.a,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),OFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),OFd)),a,c)};_.lh=function WHd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.d!=null;case 2:return !!this.b&&this.b.f!=0;case 3:return !!MHd(this);case 4:return !!this.a&&this.a.i!=0;case 5:return !!this.c&&this.c.i!=0;}return cid(this,a-aLd((jGd(),OFd)),XKd((b=BD(Ajd(this,16),26),!b?OFd:b),a))};_.sh=function XHd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:OHd(this,GD(b));return;case 2:!this.b&&(this.b=new sId((jGd(),fGd),x6,this));cId(this.b,b);return;case 3:NHd(this,BD(b,147));return;case 4:!this.a&&(this.a=new xMd(m5,this,4));Uxd(this.a);!this.a&&(this.a=new xMd(m5,this,4));ytd(this.a,BD(b,14));return;case 5:!this.c&&(this.c=new _4d(m5,this,5));Uxd(this.c);!this.c&&(this.c=new _4d(m5,this,5));ytd(this.c,BD(b,14));return;}did(this,a-aLd((jGd(),OFd)),XKd((c=BD(Ajd(this,16),26),!c?OFd:c),a),b)};_.zh=function YHd(){return jGd(),OFd};_.Bh=function ZHd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:PHd(this,null);return;case 2:!this.b&&(this.b=new sId((jGd(),fGd),x6,this));this.b.c.$b();return;case 3:NHd(this,null);return;case 4:!this.a&&(this.a=new xMd(m5,this,4));Uxd(this.a);return;case 5:!this.c&&(this.c=new _4d(m5,this,5));Uxd(this.c);return;}eid(this,a-aLd((jGd(),OFd)),XKd((b=BD(Ajd(this,16),26),!b?OFd:b),a))};_.Ib=function $Hd(){return QHd(this)};_.d=null;var G5=mdb(qte,'EAnnotationImpl',510);bcb(151,705,Ave,dId);_.Xh=function eId(a,b){_Hd(this,a,BD(b,42))};_.lk=function fId(a,b){return aId(this,BD(a,42),b)};_.pi=function gId(a){return BD(BD(this.c,69).pi(a),133)};_.Zh=function hId(){return BD(this.c,69).Zh()};_.$h=function iId(){return BD(this.c,69).$h()};_._h=function jId(a){return BD(this.c,69)._h(a)};_.mk=function kId(a,b){return bId(this,a,b)};_.Wj=function lId(a){return BD(this.c,76).Wj(a)};_.rj=function mId(){};_.fj=function nId(){return BD(this.c,76).fj()};_.tj=function oId(a,b,c){var d;d=BD(bKd(this.b).Nh().Jh(this.b),133);d.Th(a);d.Uh(b);d.ed(c);return d};_.uj=function pId(){return new W5d(this)};_.Wb=function qId(a){cId(this,a)};_.Xj=function rId(){BD(this.c,76).Xj()};var y9=mdb(yve,'EcoreEMap',151);bcb(158,151,Ave,sId);_.qj=function tId(){var a,b,c,d,e,f;if(this.d==null){f=KC(y4,jve,63,2*this.f+1,0,1);for(c=this.c.Kc();c.e!=c.i.gc();){b=BD(c.nj(),133);d=b.Sh();e=(d&Ohe)%f.length;a=f[e];!a&&(a=f[e]=new W5d(this));a.Fc(b)}this.d=f}};var F5=mdb(qte,'EAnnotationImpl/1',158);bcb(284,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,472:1,49:1,97:1,150:1,284:1,114:1,115:1});_._g=function GId(a,b,c){var d,e;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),this.$j()?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.jh=function HId(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function IId(a){var b,c;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return this.$j();case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function JId(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:this.Lh(GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:this.ok(BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function KId(){return jGd(),hGd};_.Bh=function LId(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:this.Lh(null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:this.ok(1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.Gh=function MId(){wId(this);this.Bb|=1};_.Yj=function NId(){return wId(this)};_.Zj=function OId(){return this.t};_.$j=function PId(){var a;return a=this.t,a>1||a==-1};_.hi=function QId(){return (this.Bb&512)!=0};_.nk=function RId(a,b){return zId(this,a,b)};_.ok=function SId(a){DId(this,a)};_.Ib=function TId(){return EId(this)};_.s=0;_.t=1;var v7=mdb(qte,'ETypedElementImpl',284);bcb(449,284,{105:1,92:1,90:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,449:1,284:1,114:1,115:1,677:1});_.Qg=function iJd(a){return UId(this,a)};_._g=function jJd(a,b,c){var d,e;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),this.$j()?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return Bcb(),(this.Bb&zte)!=0?true:false;case 11:return Bcb(),(this.Bb&Dve)!=0?true:false;case 12:return Bcb(),(this.Bb&Rje)!=0?true:false;case 13:return this.j;case 14:return VId(this);case 15:return Bcb(),(this.Bb&Cve)!=0?true:false;case 16:return Bcb(),(this.Bb&oie)!=0?true:false;case 17:return WId(this);}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.hh=function kJd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 17:!!this.Cb&&(c=(e=this.Db>>16,e>=0?UId(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,17,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),f.Nj().Qj(this,yjd(this),b-aLd(this.zh()),a,c)};_.jh=function lJd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);case 17:return _hd(this,null,17,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function mJd(a){var b,c;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return this.$j();case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return (this.Bb&zte)==0;case 11:return (this.Bb&Dve)!=0;case 12:return (this.Bb&Rje)!=0;case 13:return this.j!=null;case 14:return VId(this)!=null;case 15:return (this.Bb&Cve)!=0;case 16:return (this.Bb&oie)!=0;case 17:return !!WId(this);}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function nJd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:cJd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:this.ok(BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 10:ZId(this,Ccb(DD(b)));return;case 11:fJd(this,Ccb(DD(b)));return;case 12:dJd(this,Ccb(DD(b)));return;case 13:$Id(this,GD(b));return;case 15:eJd(this,Ccb(DD(b)));return;case 16:aJd(this,Ccb(DD(b)));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function oJd(){return jGd(),gGd};_.Bh=function pJd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),4);pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:this.ok(1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 10:ZId(this,true);return;case 11:fJd(this,false);return;case 12:dJd(this,false);return;case 13:this.i=null;_Id(this,null);return;case 15:eJd(this,false);return;case 16:aJd(this,false);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.Gh=function qJd(){a2d(q1d((O6d(),M6d),this));wId(this);this.Bb|=1};_.Gj=function rJd(){return this.f};_.zj=function sJd(){return VId(this)};_.Hj=function tJd(){return WId(this)};_.Lj=function uJd(){return null};_.pk=function vJd(){return this.k};_.aj=function wJd(){return this.n};_.Mj=function xJd(){return XId(this)};_.Nj=function yJd(){var a,b,c,d,e,f,g,h,i;if(!this.p){c=WId(this);(c.i==null&&TKd(c),c.i).length;d=this.Lj();!!d&&aLd(WId(d));e=wId(this);g=e.Bj();a=!g?null:(g.i&1)!=0?g==sbb?wI:g==WD?JI:g==VD?FI:g==UD?BI:g==XD?MI:g==rbb?UI:g==SD?xI:yI:g;b=VId(this);h=e.zj();n6d(this);(this.Bb&oie)!=0&&(!!(f=t1d((O6d(),M6d),c))&&f!=this||!!(f=_1d(q1d(M6d,this))))?(this.p=new zVd(this,f)):this.$j()?this.rk()?!d?(this.Bb&Cve)!=0?!a?this.sk()?(this.p=new KVd(42,this)):(this.p=new KVd(0,this)):a==CK?(this.p=new IVd(50,J4,this)):this.sk()?(this.p=new IVd(43,a,this)):(this.p=new IVd(1,a,this)):!a?this.sk()?(this.p=new KVd(44,this)):(this.p=new KVd(2,this)):a==CK?(this.p=new IVd(41,J4,this)):this.sk()?(this.p=new IVd(45,a,this)):(this.p=new IVd(3,a,this)):(this.Bb&Cve)!=0?!a?this.sk()?(this.p=new LVd(46,this,d)):(this.p=new LVd(4,this,d)):this.sk()?(this.p=new JVd(47,a,this,d)):(this.p=new JVd(5,a,this,d)):!a?this.sk()?(this.p=new LVd(48,this,d)):(this.p=new LVd(6,this,d)):this.sk()?(this.p=new JVd(49,a,this,d)):(this.p=new JVd(7,a,this,d)):JD(e,148)?a==E9?(this.p=new KVd(40,this)):(this.Bb&512)!=0?(this.Bb&Cve)!=0?!a?(this.p=new KVd(8,this)):(this.p=new IVd(9,a,this)):!a?(this.p=new KVd(10,this)):(this.p=new IVd(11,a,this)):(this.Bb&Cve)!=0?!a?(this.p=new KVd(12,this)):(this.p=new IVd(13,a,this)):!a?(this.p=new KVd(14,this)):(this.p=new IVd(15,a,this)):!d?this.sk()?(this.Bb&Cve)!=0?!a?(this.p=new KVd(16,this)):(this.p=new IVd(17,a,this)):!a?(this.p=new KVd(18,this)):(this.p=new IVd(19,a,this)):(this.Bb&Cve)!=0?!a?(this.p=new KVd(20,this)):(this.p=new IVd(21,a,this)):!a?(this.p=new KVd(22,this)):(this.p=new IVd(23,a,this)):(i=d.t,i>1||i==-1?this.sk()?(this.Bb&Cve)!=0?!a?(this.p=new LVd(24,this,d)):(this.p=new JVd(25,a,this,d)):!a?(this.p=new LVd(26,this,d)):(this.p=new JVd(27,a,this,d)):(this.Bb&Cve)!=0?!a?(this.p=new LVd(28,this,d)):(this.p=new JVd(29,a,this,d)):!a?(this.p=new LVd(30,this,d)):(this.p=new JVd(31,a,this,d)):this.sk()?(this.Bb&Cve)!=0?!a?(this.p=new LVd(32,this,d)):(this.p=new JVd(33,a,this,d)):!a?(this.p=new LVd(34,this,d)):(this.p=new JVd(35,a,this,d)):(this.Bb&Cve)!=0?!a?(this.p=new LVd(36,this,d)):(this.p=new JVd(37,a,this,d)):!a?(this.p=new LVd(38,this,d)):(this.p=new JVd(39,a,this,d))):this.qk()?this.sk()?(this.p=new kWd(BD(e,26),this,d)):(this.p=new cWd(BD(e,26),this,d)):JD(e,148)?a==E9?(this.p=new KVd(40,this)):(this.Bb&Cve)!=0?!a?(this.p=new jXd(BD(e,148),b,h,this)):(this.p=new lXd(b,h,this,(CWd(),g==WD?yWd:g==sbb?tWd:g==XD?zWd:g==VD?xWd:g==UD?wWd:g==rbb?BWd:g==SD?uWd:g==TD?vWd:AWd))):!a?(this.p=new cXd(BD(e,148),b,h,this)):(this.p=new eXd(b,h,this,(CWd(),g==WD?yWd:g==sbb?tWd:g==XD?zWd:g==VD?xWd:g==UD?wWd:g==rbb?BWd:g==SD?uWd:g==TD?vWd:AWd))):this.rk()?!d?(this.Bb&Cve)!=0?this.sk()?(this.p=new FXd(BD(e,26),this)):(this.p=new DXd(BD(e,26),this)):this.sk()?(this.p=new BXd(BD(e,26),this)):(this.p=new zXd(BD(e,26),this)):(this.Bb&Cve)!=0?this.sk()?(this.p=new NXd(BD(e,26),this,d)):(this.p=new LXd(BD(e,26),this,d)):this.sk()?(this.p=new JXd(BD(e,26),this,d)):(this.p=new HXd(BD(e,26),this,d)):this.sk()?!d?(this.Bb&Cve)!=0?(this.p=new RXd(BD(e,26),this)):(this.p=new PXd(BD(e,26),this)):(this.Bb&Cve)!=0?(this.p=new VXd(BD(e,26),this,d)):(this.p=new TXd(BD(e,26),this,d)):!d?(this.Bb&Cve)!=0?(this.p=new XXd(BD(e,26),this)):(this.p=new nXd(BD(e,26),this)):(this.Bb&Cve)!=0?(this.p=new _Xd(BD(e,26),this,d)):(this.p=new ZXd(BD(e,26),this,d))}return this.p};_.Ij=function zJd(){return (this.Bb&zte)!=0};_.qk=function AJd(){return false};_.rk=function BJd(){return false};_.Jj=function CJd(){return (this.Bb&oie)!=0};_.Oj=function DJd(){return YId(this)};_.sk=function EJd(){return false};_.Kj=function FJd(){return (this.Bb&Cve)!=0};_.tk=function GJd(a){this.k=a};_.Lh=function HJd(a){cJd(this,a)};_.Ib=function IJd(){return gJd(this)};_.e=false;_.n=0;var n7=mdb(qte,'EStructuralFeatureImpl',449);bcb(322,449,{105:1,92:1,90:1,34:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,322:1,150:1,449:1,284:1,114:1,115:1,677:1},OJd);_._g=function PJd(a,b,c){var d,e;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),LJd(this)?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return Bcb(),(this.Bb&zte)!=0?true:false;case 11:return Bcb(),(this.Bb&Dve)!=0?true:false;case 12:return Bcb(),(this.Bb&Rje)!=0?true:false;case 13:return this.j;case 14:return VId(this);case 15:return Bcb(),(this.Bb&Cve)!=0?true:false;case 16:return Bcb(),(this.Bb&oie)!=0?true:false;case 17:return WId(this);case 18:return Bcb(),(this.Bb&ote)!=0?true:false;case 19:if(b)return KJd(this);return JJd(this);}return bid(this,a-aLd((jGd(),PFd)),XKd((d=BD(Ajd(this,16),26),!d?PFd:d),a),b,c)};_.lh=function QJd(a){var b,c;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return LJd(this);case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return (this.Bb&zte)==0;case 11:return (this.Bb&Dve)!=0;case 12:return (this.Bb&Rje)!=0;case 13:return this.j!=null;case 14:return VId(this)!=null;case 15:return (this.Bb&Cve)!=0;case 16:return (this.Bb&oie)!=0;case 17:return !!WId(this);case 18:return (this.Bb&ote)!=0;case 19:return !!JJd(this);}return cid(this,a-aLd((jGd(),PFd)),XKd((b=BD(Ajd(this,16),26),!b?PFd:b),a))};_.sh=function RJd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:cJd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:NJd(this,BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 10:ZId(this,Ccb(DD(b)));return;case 11:fJd(this,Ccb(DD(b)));return;case 12:dJd(this,Ccb(DD(b)));return;case 13:$Id(this,GD(b));return;case 15:eJd(this,Ccb(DD(b)));return;case 16:aJd(this,Ccb(DD(b)));return;case 18:MJd(this,Ccb(DD(b)));return;}did(this,a-aLd((jGd(),PFd)),XKd((c=BD(Ajd(this,16),26),!c?PFd:c),a),b)};_.zh=function SJd(){return jGd(),PFd};_.Bh=function TJd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),4);pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:this.b=0;DId(this,1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 10:ZId(this,true);return;case 11:fJd(this,false);return;case 12:dJd(this,false);return;case 13:this.i=null;_Id(this,null);return;case 15:eJd(this,false);return;case 16:aJd(this,false);return;case 18:MJd(this,false);return;}eid(this,a-aLd((jGd(),PFd)),XKd((b=BD(Ajd(this,16),26),!b?PFd:b),a))};_.Gh=function UJd(){KJd(this);a2d(q1d((O6d(),M6d),this));wId(this);this.Bb|=1};_.$j=function VJd(){return LJd(this)};_.nk=function WJd(a,b){this.b=0;this.a=null;return zId(this,a,b)};_.ok=function XJd(a){NJd(this,a)};_.Ib=function YJd(){var a;if((this.Db&64)!=0)return gJd(this);a=new Jfb(gJd(this));a.a+=' (iD: ';Ffb(a,(this.Bb&ote)!=0);a.a+=')';return a.a};_.b=0;var H5=mdb(qte,'EAttributeImpl',322);bcb(351,438,{105:1,92:1,90:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,351:1,150:1,114:1,115:1,676:1});_.uk=function nKd(a){return a.Tg()==this};_.Qg=function oKd(a){return aKd(this,a)};_.Rg=function pKd(a,b){this.w=null;this.Db=b<<16|this.Db&255;this.Cb=a};_._g=function qKd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.D!=null?this.D:this.B;case 3:return dKd(this);case 4:return this.zj();case 5:return this.F;case 6:if(b)return bKd(this);return ZJd(this);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),this.A;}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.hh=function rKd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 6:!!this.Cb&&(c=(e=this.Db>>16,e>=0?aKd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,6,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),f.Nj().Qj(this,yjd(this),b-aLd(this.zh()),a,c)};_.jh=function sKd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 6:return _hd(this,null,6,c);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),Txd(this.A,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function tKd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.D!=null&&this.D==this.F;case 3:return !!dKd(this);case 4:return this.zj()!=null;case 5:return this.F!=null&&this.F!=this.D&&this.F!=this.B;case 6:return !!ZJd(this);case 7:return !!this.A&&this.A.i!=0;}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function uKd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:lKd(this,GD(b));return;case 2:iKd(this,GD(b));return;case 5:kKd(this,GD(b));return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);!this.A&&(this.A=new K4d(u5,this,7));ytd(this.A,BD(b,14));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function vKd(){return jGd(),RFd};_.Bh=function wKd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,179)&&(BD(this.Cb,179).tb=null);pnd(this,null);return;case 2:$Jd(this,null);_Jd(this,this.D);return;case 5:kKd(this,null);return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.yj=function xKd(){var a;return this.G==-1&&(this.G=(a=bKd(this),a?HLd(a.Mh(),this):-1)),this.G};_.zj=function yKd(){return null};_.Aj=function zKd(){return bKd(this)};_.vk=function AKd(){return this.v};_.Bj=function BKd(){return dKd(this)};_.Cj=function CKd(){return this.D!=null?this.D:this.B};_.Dj=function DKd(){return this.F};_.wj=function EKd(a){return fKd(this,a)};_.wk=function FKd(a){this.v=a};_.xk=function GKd(a){gKd(this,a)};_.yk=function HKd(a){this.C=a};_.Lh=function IKd(a){lKd(this,a)};_.Ib=function JKd(){return mKd(this)};_.C=null;_.D=null;_.G=-1;var Z5=mdb(qte,'EClassifierImpl',351);bcb(88,351,{105:1,92:1,90:1,26:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,88:1,351:1,150:1,473:1,114:1,115:1,676:1},hLd);_.uk=function iLd(a){return dLd(this,a.Tg())};_._g=function jLd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.D!=null?this.D:this.B;case 3:return dKd(this);case 4:return null;case 5:return this.F;case 6:if(b)return bKd(this);return ZJd(this);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),this.A;case 8:return Bcb(),(this.Bb&256)!=0?true:false;case 9:return Bcb(),(this.Bb&512)!=0?true:false;case 10:return _Kd(this);case 11:return !this.q&&(this.q=new cUd(n5,this,11,10)),this.q;case 12:return OKd(this);case 13:return SKd(this);case 14:return SKd(this),this.r;case 15:return OKd(this),this.k;case 16:return PKd(this);case 17:return RKd(this);case 18:return TKd(this);case 19:return UKd(this);case 20:return OKd(this),this.o;case 21:return !this.s&&(this.s=new cUd(t5,this,21,17)),this.s;case 22:return VKd(this);case 23:return QKd(this);}return bid(this,a-aLd((jGd(),QFd)),XKd((d=BD(Ajd(this,16),26),!d?QFd:d),a),b,c)};_.hh=function kLd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 6:!!this.Cb&&(c=(e=this.Db>>16,e>=0?aKd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,6,c);case 11:return !this.q&&(this.q=new cUd(n5,this,11,10)),Sxd(this.q,a,c);case 21:return !this.s&&(this.s=new cUd(t5,this,21,17)),Sxd(this.s,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),QFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),QFd)),a,c)};_.jh=function lLd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 6:return _hd(this,null,6,c);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),Txd(this.A,a,c);case 11:return !this.q&&(this.q=new cUd(n5,this,11,10)),Txd(this.q,a,c);case 21:return !this.s&&(this.s=new cUd(t5,this,21,17)),Txd(this.s,a,c);case 22:return Txd(VKd(this),a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),QFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),QFd)),a,c)};_.lh=function mLd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.D!=null&&this.D==this.F;case 3:return !!dKd(this);case 4:return false;case 5:return this.F!=null&&this.F!=this.D&&this.F!=this.B;case 6:return !!ZJd(this);case 7:return !!this.A&&this.A.i!=0;case 8:return (this.Bb&256)!=0;case 9:return (this.Bb&512)!=0;case 10:return !!this.u&&VKd(this.u.a).i!=0&&!(!!this.n&&FMd(this.n));case 11:return !!this.q&&this.q.i!=0;case 12:return OKd(this).i!=0;case 13:return SKd(this).i!=0;case 14:return SKd(this),this.r.i!=0;case 15:return OKd(this),this.k.i!=0;case 16:return PKd(this).i!=0;case 17:return RKd(this).i!=0;case 18:return TKd(this).i!=0;case 19:return UKd(this).i!=0;case 20:return OKd(this),!!this.o;case 21:return !!this.s&&this.s.i!=0;case 22:return !!this.n&&FMd(this.n);case 23:return QKd(this).i!=0;}return cid(this,a-aLd((jGd(),QFd)),XKd((b=BD(Ajd(this,16),26),!b?QFd:b),a))};_.oh=function nLd(a){var b;b=this.i==null||!!this.q&&this.q.i!=0?null:YKd(this,a);return b?b:Bmd(this,a)};_.sh=function oLd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:lKd(this,GD(b));return;case 2:iKd(this,GD(b));return;case 5:kKd(this,GD(b));return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);!this.A&&(this.A=new K4d(u5,this,7));ytd(this.A,BD(b,14));return;case 8:eLd(this,Ccb(DD(b)));return;case 9:fLd(this,Ccb(DD(b)));return;case 10:vwd(_Kd(this));ytd(_Kd(this),BD(b,14));return;case 11:!this.q&&(this.q=new cUd(n5,this,11,10));Uxd(this.q);!this.q&&(this.q=new cUd(n5,this,11,10));ytd(this.q,BD(b,14));return;case 21:!this.s&&(this.s=new cUd(t5,this,21,17));Uxd(this.s);!this.s&&(this.s=new cUd(t5,this,21,17));ytd(this.s,BD(b,14));return;case 22:Uxd(VKd(this));ytd(VKd(this),BD(b,14));return;}did(this,a-aLd((jGd(),QFd)),XKd((c=BD(Ajd(this,16),26),!c?QFd:c),a),b)};_.zh=function pLd(){return jGd(),QFd};_.Bh=function qLd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,179)&&(BD(this.Cb,179).tb=null);pnd(this,null);return;case 2:$Jd(this,null);_Jd(this,this.D);return;case 5:kKd(this,null);return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);return;case 8:eLd(this,false);return;case 9:fLd(this,false);return;case 10:!!this.u&&vwd(this.u);return;case 11:!this.q&&(this.q=new cUd(n5,this,11,10));Uxd(this.q);return;case 21:!this.s&&(this.s=new cUd(t5,this,21,17));Uxd(this.s);return;case 22:!!this.n&&Uxd(this.n);return;}eid(this,a-aLd((jGd(),QFd)),XKd((b=BD(Ajd(this,16),26),!b?QFd:b),a))};_.Gh=function rLd(){var a,b;OKd(this);SKd(this);PKd(this);RKd(this);TKd(this);UKd(this);QKd(this);oud(SMd($Kd(this)));if(this.s){for(a=0,b=this.s.i;a=0;--b){qud(this,b)}}return xud(this,a)};_.Xj=function nMd(){Uxd(this)};_.oi=function oMd(a,b){return LLd(this,a,b)};var t9=mdb(yve,'EcoreEList',622);bcb(496,622,Pve,pMd);_.ai=function qMd(){return false};_.aj=function rMd(){return this.c};_.bj=function sMd(){return false};_.Fk=function tMd(){return true};_.hi=function uMd(){return true};_.li=function vMd(a,b){return b};_.ni=function wMd(){return false};_.c=0;var d9=mdb(yve,'EObjectEList',496);bcb(85,496,Pve,xMd);_.bj=function yMd(){return true};_.Dk=function zMd(){return false};_.rk=function AMd(){return true};var Z8=mdb(yve,'EObjectContainmentEList',85);bcb(545,85,Pve,BMd);_.ci=function CMd(){this.b=true};_.fj=function DMd(){return this.b};_.Xj=function EMd(){var a;Uxd(this);if(oid(this.e)){a=this.b;this.b=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.b=false}};_.b=false;var Y8=mdb(yve,'EObjectContainmentEList/Unsettable',545);bcb(1140,545,Pve,JMd);_.ii=function NMd(a,b){var c,d;return c=BD(Wxd(this,a,b),87),oid(this.e)&&GLd(this,new ESd(this.a,7,(jGd(),SFd),meb(b),(d=c.c,JD(d,88)?BD(d,26):_Fd),a)),c};_.jj=function OMd(a,b){return GMd(this,BD(a,87),b)};_.kj=function PMd(a,b){return HMd(this,BD(a,87),b)};_.lj=function QMd(a,b,c){return IMd(this,BD(a,87),BD(b,87),c)};_.Zi=function KMd(a,b,c,d,e){switch(a){case 3:{return FLd(this,a,b,c,d,this.i>1)}case 5:{return FLd(this,a,b,c,d,this.i-BD(c,15).gc()>0)}default:{return new pSd(this.e,a,this.c,b,c,d,true)}}};_.ij=function LMd(){return true};_.fj=function MMd(){return FMd(this)};_.Xj=function RMd(){Uxd(this)};var N5=mdb(qte,'EClassImpl/1',1140);bcb(1154,1153,dve);_.ui=function VMd(a){var b,c,d,e,f,g,h;c=a.xi();if(c!=8){d=UMd(a);if(d==0){switch(c){case 1:case 9:{h=a.Bi();if(h!=null){b=$Kd(BD(h,473));!b.c&&(b.c=new xYd);Ftd(b.c,a.Ai())}g=a.zi();if(g!=null){e=BD(g,473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);wtd(b.c,BD(a.Ai(),26))}}break}case 3:{g=a.zi();if(g!=null){e=BD(g,473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);wtd(b.c,BD(a.Ai(),26))}}break}case 5:{g=a.zi();if(g!=null){for(f=BD(g,14).Kc();f.Ob();){e=BD(f.Pb(),473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);wtd(b.c,BD(a.Ai(),26))}}}break}case 4:{h=a.Bi();if(h!=null){e=BD(h,473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);Ftd(b.c,a.Ai())}}break}case 6:{h=a.Bi();if(h!=null){for(f=BD(h,14).Kc();f.Ob();){e=BD(f.Pb(),473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);Ftd(b.c,a.Ai())}}}break}}}this.Hk(d)}};_.Hk=function WMd(a){TMd(this,a)};_.b=63;var p7=mdb(qte,'ESuperAdapter',1154);bcb(1155,1154,dve,YMd);_.Hk=function ZMd(a){XMd(this,a)};var I5=mdb(qte,'EClassImpl/10',1155);bcb(1144,696,Pve);_.Vh=function $Md(a,b){return iud(this,a,b)};_.Wh=function _Md(a){return jud(this,a)};_.Xh=function aNd(a,b){kud(this,a,b)};_.Yh=function bNd(a){lud(this,a)};_.pi=function dNd(a){return nud(this,a)};_.mi=function lNd(a,b){return uud(this,a,b)};_.lk=function cNd(a,b){throw vbb(new bgb)};_.Zh=function eNd(){return new $yd(this)};_.$h=function fNd(){return new bzd(this)};_._h=function gNd(a){return ztd(this,a)};_.mk=function hNd(a,b){throw vbb(new bgb)};_.Wj=function iNd(a){return this};_.fj=function jNd(){return this.i!=0};_.Wb=function kNd(a){throw vbb(new bgb)};_.Xj=function mNd(){throw vbb(new bgb)};var s9=mdb(yve,'EcoreEList/UnmodifiableEList',1144);bcb(319,1144,Pve,nNd);_.ni=function oNd(){return false};var r9=mdb(yve,'EcoreEList/UnmodifiableEList/FastCompare',319);bcb(1147,319,Pve,rNd);_.Xc=function sNd(a){var b,c,d;if(JD(a,170)){b=BD(a,170);c=b.aj();if(c!=-1){for(d=this.i;c4){if(this.wj(a)){if(this.rk()){d=BD(a,49);c=d.Ug();h=c==this.b&&(this.Dk()?d.Og(d.Vg(),BD(XKd(wjd(this.b),this.aj()).Yj(),26).Bj())==zUd(BD(XKd(wjd(this.b),this.aj()),18)).n:-1-d.Vg()==this.aj());if(this.Ek()&&!h&&!c&&!!d.Zg()){for(e=0;e1||d==-1)}else{return false}};_.Dk=function COd(){var a,b,c;b=XKd(wjd(this.b),this.aj());if(JD(b,99)){a=BD(b,18);c=zUd(a);return !!c}else{return false}};_.Ek=function DOd(){var a,b;b=XKd(wjd(this.b),this.aj());if(JD(b,99)){a=BD(b,18);return (a.Bb&Tje)!=0}else{return false}};_.Xc=function EOd(a){var b,c,d,e;d=this.Qi(a);if(d>=0)return d;if(this.Fk()){for(c=0,e=this.Vi();c=0;--a){nOd(this,a,this.Oi(a))}}return this.Wi()};_.Qc=function QOd(a){var b;if(this.Ek()){for(b=this.Vi()-1;b>=0;--b){nOd(this,b,this.Oi(b))}}return this.Xi(a)};_.Xj=function ROd(){vwd(this)};_.oi=function SOd(a,b){return pOd(this,a,b)};var K8=mdb(yve,'DelegatingEcoreEList',742);bcb(1150,742,Uve,YOd);_.Hi=function _Od(a,b){TOd(this,a,BD(b,26))};_.Ii=function aPd(a){UOd(this,BD(a,26))};_.Oi=function gPd(a){var b,c;return b=BD(qud(VKd(this.a),a),87),c=b.c,JD(c,88)?BD(c,26):(jGd(),_Fd)};_.Ti=function lPd(a){var b,c;return b=BD(Xxd(VKd(this.a),a),87),c=b.c,JD(c,88)?BD(c,26):(jGd(),_Fd)};_.Ui=function mPd(a,b){return WOd(this,a,BD(b,26))};_.ai=function ZOd(){return false};_.Zi=function $Od(a,b,c,d,e){return null};_.Ji=function bPd(){return new EPd(this)};_.Ki=function cPd(){Uxd(VKd(this.a))};_.Li=function dPd(a){return VOd(this,a)};_.Mi=function ePd(a){var b,c;for(c=a.Kc();c.Ob();){b=c.Pb();if(!VOd(this,b)){return false}}return true};_.Ni=function fPd(a){var b,c,d;if(JD(a,15)){d=BD(a,15);if(d.gc()==VKd(this.a).i){for(b=d.Kc(),c=new Fyd(this);b.Ob();){if(PD(b.Pb())!==PD(Dyd(c))){return false}}return true}}return false};_.Pi=function hPd(){var a,b,c,d,e;c=1;for(b=new Fyd(VKd(this.a));b.e!=b.i.gc();){a=BD(Dyd(b),87);d=(e=a.c,JD(e,88)?BD(e,26):(jGd(),_Fd));c=31*c+(!d?0:FCb(d))}return c};_.Qi=function iPd(a){var b,c,d,e;d=0;for(c=new Fyd(VKd(this.a));c.e!=c.i.gc();){b=BD(Dyd(c),87);if(PD(a)===PD((e=b.c,JD(e,88)?BD(e,26):(jGd(),_Fd)))){return d}++d}return -1};_.Ri=function jPd(){return VKd(this.a).i==0};_.Si=function kPd(){return null};_.Vi=function nPd(){return VKd(this.a).i};_.Wi=function oPd(){var a,b,c,d,e,f;f=VKd(this.a).i;e=KC(SI,Uhe,1,f,5,1);c=0;for(b=new Fyd(VKd(this.a));b.e!=b.i.gc();){a=BD(Dyd(b),87);e[c++]=(d=a.c,JD(d,88)?BD(d,26):(jGd(),_Fd))}return e};_.Xi=function pPd(a){var b,c,d,e,f,g,h;h=VKd(this.a).i;if(a.lengthh&&NC(a,h,null);d=0;for(c=new Fyd(VKd(this.a));c.e!=c.i.gc();){b=BD(Dyd(c),87);f=(g=b.c,JD(g,88)?BD(g,26):(jGd(),_Fd));NC(a,d++,f)}return a};_.Yi=function qPd(){var a,b,c,d,e;e=new Hfb;e.a+='[';a=VKd(this.a);for(b=0,d=VKd(this.a).i;b>16,e>=0?aKd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,6,c);case 9:return !this.a&&(this.a=new cUd(g5,this,9,5)),Sxd(this.a,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),UFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),UFd)),a,c)};_.jh=function dQd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 6:return _hd(this,null,6,c);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),Txd(this.A,a,c);case 9:return !this.a&&(this.a=new cUd(g5,this,9,5)),Txd(this.a,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),UFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),UFd)),a,c)};_.lh=function eQd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.D!=null&&this.D==this.F;case 3:return !!dKd(this);case 4:return !!$Pd(this);case 5:return this.F!=null&&this.F!=this.D&&this.F!=this.B;case 6:return !!ZJd(this);case 7:return !!this.A&&this.A.i!=0;case 8:return (this.Bb&256)==0;case 9:return !!this.a&&this.a.i!=0;}return cid(this,a-aLd((jGd(),UFd)),XKd((b=BD(Ajd(this,16),26),!b?UFd:b),a))};_.sh=function fQd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:lKd(this,GD(b));return;case 2:iKd(this,GD(b));return;case 5:kKd(this,GD(b));return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);!this.A&&(this.A=new K4d(u5,this,7));ytd(this.A,BD(b,14));return;case 8:LPd(this,Ccb(DD(b)));return;case 9:!this.a&&(this.a=new cUd(g5,this,9,5));Uxd(this.a);!this.a&&(this.a=new cUd(g5,this,9,5));ytd(this.a,BD(b,14));return;}did(this,a-aLd((jGd(),UFd)),XKd((c=BD(Ajd(this,16),26),!c?UFd:c),a),b)};_.zh=function gQd(){return jGd(),UFd};_.Bh=function hQd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,179)&&(BD(this.Cb,179).tb=null);pnd(this,null);return;case 2:$Jd(this,null);_Jd(this,this.D);return;case 5:kKd(this,null);return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);return;case 8:LPd(this,true);return;case 9:!this.a&&(this.a=new cUd(g5,this,9,5));Uxd(this.a);return;}eid(this,a-aLd((jGd(),UFd)),XKd((b=BD(Ajd(this,16),26),!b?UFd:b),a))};_.Gh=function iQd(){var a,b;if(this.a){for(a=0,b=this.a.i;a>16==5?BD(this.Cb,671):null;}return bid(this,a-aLd((jGd(),VFd)),XKd((d=BD(Ajd(this,16),26),!d?VFd:d),a),b,c)};_.hh=function uQd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 5:!!this.Cb&&(c=(e=this.Db>>16,e>=0?mQd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,5,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),VFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),VFd)),a,c)};_.jh=function vQd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 5:return _hd(this,null,5,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),VFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),VFd)),a,c)};_.lh=function wQd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.d!=0;case 3:return !!this.b;case 4:return this.c!=null;case 5:return !!(this.Db>>16==5?BD(this.Cb,671):null);}return cid(this,a-aLd((jGd(),VFd)),XKd((b=BD(Ajd(this,16),26),!b?VFd:b),a))};_.sh=function xQd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:qQd(this,BD(b,19).a);return;case 3:oQd(this,BD(b,1940));return;case 4:pQd(this,GD(b));return;}did(this,a-aLd((jGd(),VFd)),XKd((c=BD(Ajd(this,16),26),!c?VFd:c),a),b)};_.zh=function yQd(){return jGd(),VFd};_.Bh=function zQd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:qQd(this,0);return;case 3:oQd(this,null);return;case 4:pQd(this,null);return;}eid(this,a-aLd((jGd(),VFd)),XKd((b=BD(Ajd(this,16),26),!b?VFd:b),a))};_.Ib=function BQd(){var a;return a=this.c,a==null?this.zb:a};_.b=null;_.c=null;_.d=0;var a6=mdb(qte,'EEnumLiteralImpl',573);var c6=odb(qte,'EFactoryImpl/InternalEDateTimeFormat');bcb(489,1,{2015:1},EQd);var b6=mdb(qte,'EFactoryImpl/1ClientInternalEDateTimeFormat',489);bcb(241,115,{105:1,92:1,90:1,87:1,56:1,108:1,49:1,97:1,241:1,114:1,115:1},UQd);_.Sg=function VQd(a,b,c){var d;c=_hd(this,a,b,c);if(!!this.e&&JD(a,170)){d=MQd(this,this.e);d!=this.c&&(c=QQd(this,d,c))}return c};_._g=function WQd(a,b,c){var d;switch(a){case 0:return this.f;case 1:return !this.d&&(this.d=new xMd(j5,this,1)),this.d;case 2:if(b)return KQd(this);return this.c;case 3:return this.b;case 4:return this.e;case 5:if(b)return JQd(this);return this.a;}return bid(this,a-aLd((jGd(),XFd)),XKd((d=BD(Ajd(this,16),26),!d?XFd:d),a),b,c)};_.jh=function XQd(a,b,c){var d,e;switch(b){case 0:return IQd(this,null,c);case 1:return !this.d&&(this.d=new xMd(j5,this,1)),Txd(this.d,a,c);case 3:return GQd(this,null,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),XFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),XFd)),a,c)};_.lh=function YQd(a){var b;switch(a){case 0:return !!this.f;case 1:return !!this.d&&this.d.i!=0;case 2:return !!this.c;case 3:return !!this.b;case 4:return !!this.e;case 5:return !!this.a;}return cid(this,a-aLd((jGd(),XFd)),XKd((b=BD(Ajd(this,16),26),!b?XFd:b),a))};_.sh=function ZQd(a,b){var c;switch(a){case 0:SQd(this,BD(b,87));return;case 1:!this.d&&(this.d=new xMd(j5,this,1));Uxd(this.d);!this.d&&(this.d=new xMd(j5,this,1));ytd(this.d,BD(b,14));return;case 3:PQd(this,BD(b,87));return;case 4:RQd(this,BD(b,836));return;case 5:NQd(this,BD(b,138));return;}did(this,a-aLd((jGd(),XFd)),XKd((c=BD(Ajd(this,16),26),!c?XFd:c),a),b)};_.zh=function $Qd(){return jGd(),XFd};_.Bh=function _Qd(a){var b;switch(a){case 0:SQd(this,null);return;case 1:!this.d&&(this.d=new xMd(j5,this,1));Uxd(this.d);return;case 3:PQd(this,null);return;case 4:RQd(this,null);return;case 5:NQd(this,null);return;}eid(this,a-aLd((jGd(),XFd)),XKd((b=BD(Ajd(this,16),26),!b?XFd:b),a))};_.Ib=function aRd(){var a;a=new Wfb(Eid(this));a.a+=' (expression: ';TQd(this,a);a.a+=')';return a.a};var FQd;var e6=mdb(qte,'EGenericTypeImpl',241);bcb(1969,1964,Vve);_.Xh=function cRd(a,b){bRd(this,a,b)};_.lk=function dRd(a,b){bRd(this,this.gc(),a);return b};_.pi=function eRd(a){return Ut(this.Gi(),a)};_.Zh=function fRd(){return this.$h()};_.Gi=function gRd(){return new O0d(this)};_.$h=function hRd(){return this._h(0)};_._h=function iRd(a){return this.Gi().Zc(a)};_.mk=function jRd(a,b){ze(this,a,true);return b};_.ii=function kRd(a,b){var c,d;d=Vt(this,b);c=this.Zc(a);c.Rb(d);return d};_.ji=function lRd(a,b){var c;ze(this,b,true);c=this.Zc(a);c.Rb(b)};var B8=mdb(yve,'AbstractSequentialInternalEList',1969);bcb(486,1969,Vve,qRd);_.pi=function rRd(a){return Ut(this.Gi(),a)};_.Zh=function sRd(){if(this.b==null){return LRd(),LRd(),KRd}return this.Jk()};_.Gi=function tRd(){return new w4d(this.a,this.b)};_.$h=function uRd(){if(this.b==null){return LRd(),LRd(),KRd}return this.Jk()};_._h=function vRd(a){var b,c;if(this.b==null){if(a<0||a>1){throw vbb(new qcb(gve+a+', size=0'))}return LRd(),LRd(),KRd}c=this.Jk();for(b=0;b0){b=this.c[--this.d];if((!this.e||b.Gj()!=x2||b.aj()!=0)&&(!this.Mk()||this.b.mh(b))){f=this.b.bh(b,this.Lk());this.f=(Q6d(),BD(b,66).Oj());if(this.f||b.$j()){if(this.Lk()){d=BD(f,15);this.k=d}else{d=BD(f,69);this.k=this.j=d}if(JD(this.k,54)){this.o=this.k.gc();this.n=this.o}else{this.p=!this.j?this.k.Zc(this.k.gc()):this.j._h(this.k.gc())}if(!this.p?PRd(this):QRd(this,this.p)){e=!this.p?!this.j?this.k.Xb(--this.n):this.j.pi(--this.n):this.p.Ub();if(this.f){a=BD(e,72);a.ak();c=a.dd();this.i=c}else{c=e;this.i=c}this.g=-3;return true}}else if(f!=null){this.k=null;this.p=null;c=f;this.i=c;this.g=-2;return true}}}this.k=null;this.p=null;this.g=-1;return false}else{e=!this.p?!this.j?this.k.Xb(--this.n):this.j.pi(--this.n):this.p.Ub();if(this.f){a=BD(e,72);a.ak();c=a.dd();this.i=c}else{c=e;this.i=c}this.g=-3;return true}}}};_.Pb=function XRd(){return MRd(this)};_.Tb=function YRd(){return this.a};_.Ub=function ZRd(){var a;if(this.g<-1||this.Sb()){--this.a;this.g=0;a=this.i;this.Sb();return a}else{throw vbb(new utb)}};_.Vb=function $Rd(){return this.a-1};_.Qb=function _Rd(){throw vbb(new bgb)};_.Lk=function aSd(){return false};_.Wb=function bSd(a){throw vbb(new bgb)};_.Mk=function cSd(){return true};_.a=0;_.d=0;_.f=false;_.g=0;_.n=0;_.o=0;var KRd;var P8=mdb(yve,'EContentsEList/FeatureIteratorImpl',279);bcb(697,279,Wve,dSd);_.Lk=function eSd(){return true};var Q8=mdb(yve,'EContentsEList/ResolvingFeatureIteratorImpl',697);bcb(1157,697,Wve,fSd);_.Mk=function gSd(){return false};var g6=mdb(qte,'ENamedElementImpl/1/1',1157);bcb(1158,279,Wve,hSd);_.Mk=function iSd(){return false};var h6=mdb(qte,'ENamedElementImpl/1/2',1158);bcb(36,143,fve,lSd,mSd,nSd,oSd,pSd,qSd,rSd,sSd,tSd,uSd,vSd,wSd,xSd,ySd,zSd,ASd,BSd,CSd,DSd,ESd,FSd,GSd,HSd,ISd,JSd);_._i=function KSd(){return kSd(this)};_.gj=function LSd(){var a;a=kSd(this);if(a){return a.zj()}return null};_.yi=function MSd(a){this.b==-1&&!!this.a&&(this.b=this.c.Xg(this.a.aj(),this.a.Gj()));return this.c.Og(this.b,a)};_.Ai=function NSd(){return this.c};_.hj=function OSd(){var a;a=kSd(this);if(a){return a.Kj()}return false};_.b=-1;var k6=mdb(qte,'ENotificationImpl',36);bcb(399,284,{105:1,92:1,90:1,147:1,191:1,56:1,59:1,108:1,472:1,49:1,97:1,150:1,399:1,284:1,114:1,115:1},SSd);_.Qg=function TSd(a){return PSd(this,a)};_._g=function USd(a,b,c){var d,e,f;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),f=this.t,f>1||f==-1?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return this.Db>>16==10?BD(this.Cb,26):null;case 11:return !this.d&&(this.d=new K4d(u5,this,11)),this.d;case 12:return !this.c&&(this.c=new cUd(p5,this,12,10)),this.c;case 13:return !this.a&&(this.a=new fTd(this,this)),this.a;case 14:return QSd(this);}return bid(this,a-aLd((jGd(),aGd)),XKd((d=BD(Ajd(this,16),26),!d?aGd:d),a),b,c)};_.hh=function VSd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 10:!!this.Cb&&(c=(e=this.Db>>16,e>=0?PSd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,10,c);case 12:return !this.c&&(this.c=new cUd(p5,this,12,10)),Sxd(this.c,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),aGd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),aGd)),a,c)};_.jh=function WSd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);case 10:return _hd(this,null,10,c);case 11:return !this.d&&(this.d=new K4d(u5,this,11)),Txd(this.d,a,c);case 12:return !this.c&&(this.c=new cUd(p5,this,12,10)),Txd(this.c,a,c);case 14:return Txd(QSd(this),a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),aGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),aGd)),a,c)};_.lh=function XSd(a){var b,c,d;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return d=this.t,d>1||d==-1;case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return !!(this.Db>>16==10?BD(this.Cb,26):null);case 11:return !!this.d&&this.d.i!=0;case 12:return !!this.c&&this.c.i!=0;case 13:return !!this.a&&QSd(this.a.a).i!=0&&!(!!this.b&&QTd(this.b));case 14:return !!this.b&&QTd(this.b);}return cid(this,a-aLd((jGd(),aGd)),XKd((b=BD(Ajd(this,16),26),!b?aGd:b),a))};_.sh=function YSd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:DId(this,BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 11:!this.d&&(this.d=new K4d(u5,this,11));Uxd(this.d);!this.d&&(this.d=new K4d(u5,this,11));ytd(this.d,BD(b,14));return;case 12:!this.c&&(this.c=new cUd(p5,this,12,10));Uxd(this.c);!this.c&&(this.c=new cUd(p5,this,12,10));ytd(this.c,BD(b,14));return;case 13:!this.a&&(this.a=new fTd(this,this));vwd(this.a);!this.a&&(this.a=new fTd(this,this));ytd(this.a,BD(b,14));return;case 14:Uxd(QSd(this));ytd(QSd(this),BD(b,14));return;}did(this,a-aLd((jGd(),aGd)),XKd((c=BD(Ajd(this,16),26),!c?aGd:c),a),b)};_.zh=function ZSd(){return jGd(),aGd};_.Bh=function $Sd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:DId(this,1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 11:!this.d&&(this.d=new K4d(u5,this,11));Uxd(this.d);return;case 12:!this.c&&(this.c=new cUd(p5,this,12,10));Uxd(this.c);return;case 13:!!this.a&&vwd(this.a);return;case 14:!!this.b&&Uxd(this.b);return;}eid(this,a-aLd((jGd(),aGd)),XKd((b=BD(Ajd(this,16),26),!b?aGd:b),a))};_.Gh=function _Sd(){var a,b;if(this.c){for(a=0,b=this.c.i;ah&&NC(a,h,null);d=0;for(c=new Fyd(QSd(this.a));c.e!=c.i.gc();){b=BD(Dyd(c),87);f=(g=b.c,g?g:(jGd(),YFd));NC(a,d++,f)}return a};_.Yi=function zTd(){var a,b,c,d,e;e=new Hfb;e.a+='[';a=QSd(this.a);for(b=0,d=QSd(this.a).i;b1)}case 5:{return FLd(this,a,b,c,d,this.i-BD(c,15).gc()>0)}default:{return new pSd(this.e,a,this.c,b,c,d,true)}}};_.ij=function WTd(){return true};_.fj=function XTd(){return QTd(this)};_.Xj=function aUd(){Uxd(this)};var o6=mdb(qte,'EOperationImpl/2',1341);bcb(498,1,{1938:1,498:1},bUd);var q6=mdb(qte,'EPackageImpl/1',498);bcb(16,85,Pve,cUd);_.zk=function dUd(){return this.d};_.Ak=function eUd(){return this.b};_.Dk=function fUd(){return true};_.b=0;var b9=mdb(yve,'EObjectContainmentWithInverseEList',16);bcb(353,16,Pve,gUd);_.Ek=function hUd(){return true};_.li=function iUd(a,b){return ILd(this,a,BD(b,56))};var $8=mdb(yve,'EObjectContainmentWithInverseEList/Resolving',353);bcb(298,353,Pve,jUd);_.ci=function kUd(){this.a.tb=null};var r6=mdb(qte,'EPackageImpl/2',298);bcb(1228,1,{},lUd);var s6=mdb(qte,'EPackageImpl/3',1228);bcb(718,43,fke,oUd);_._b=function pUd(a){return ND(a)?Qhb(this,a):!!irb(this.f,a)};var u6=mdb(qte,'EPackageRegistryImpl',718);bcb(509,284,{105:1,92:1,90:1,147:1,191:1,56:1,2017:1,108:1,472:1,49:1,97:1,150:1,509:1,284:1,114:1,115:1},rUd);_.Qg=function sUd(a){return qUd(this,a)};_._g=function tUd(a,b,c){var d,e,f;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),f=this.t,f>1||f==-1?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return this.Db>>16==10?BD(this.Cb,59):null;}return bid(this,a-aLd((jGd(),dGd)),XKd((d=BD(Ajd(this,16),26),!d?dGd:d),a),b,c)};_.hh=function uUd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 10:!!this.Cb&&(c=(e=this.Db>>16,e>=0?qUd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,10,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),dGd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),dGd)),a,c)};_.jh=function vUd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);case 10:return _hd(this,null,10,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),dGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),dGd)),a,c)};_.lh=function wUd(a){var b,c,d;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return d=this.t,d>1||d==-1;case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return !!(this.Db>>16==10?BD(this.Cb,59):null);}return cid(this,a-aLd((jGd(),dGd)),XKd((b=BD(Ajd(this,16),26),!b?dGd:b),a))};_.zh=function xUd(){return jGd(),dGd};var v6=mdb(qte,'EParameterImpl',509);bcb(99,449,{105:1,92:1,90:1,147:1,191:1,56:1,18:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,99:1,449:1,284:1,114:1,115:1,677:1},FUd);_._g=function GUd(a,b,c){var d,e,f,g;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),g=this.t,g>1||g==-1?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return Bcb(),(this.Bb&zte)!=0?true:false;case 11:return Bcb(),(this.Bb&Dve)!=0?true:false;case 12:return Bcb(),(this.Bb&Rje)!=0?true:false;case 13:return this.j;case 14:return VId(this);case 15:return Bcb(),(this.Bb&Cve)!=0?true:false;case 16:return Bcb(),(this.Bb&oie)!=0?true:false;case 17:return WId(this);case 18:return Bcb(),(this.Bb&ote)!=0?true:false;case 19:return Bcb(),f=zUd(this),!!f&&(f.Bb&ote)!=0?true:false;case 20:return Bcb(),(this.Bb&Tje)!=0?true:false;case 21:if(b)return zUd(this);return this.b;case 22:if(b)return AUd(this);return yUd(this);case 23:return !this.a&&(this.a=new _4d(b5,this,23)),this.a;}return bid(this,a-aLd((jGd(),eGd)),XKd((d=BD(Ajd(this,16),26),!d?eGd:d),a),b,c)};_.lh=function HUd(a){var b,c,d,e;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return e=this.t,e>1||e==-1;case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return (this.Bb&zte)==0;case 11:return (this.Bb&Dve)!=0;case 12:return (this.Bb&Rje)!=0;case 13:return this.j!=null;case 14:return VId(this)!=null;case 15:return (this.Bb&Cve)!=0;case 16:return (this.Bb&oie)!=0;case 17:return !!WId(this);case 18:return (this.Bb&ote)!=0;case 19:return d=zUd(this),!!d&&(d.Bb&ote)!=0;case 20:return (this.Bb&Tje)==0;case 21:return !!this.b;case 22:return !!yUd(this);case 23:return !!this.a&&this.a.i!=0;}return cid(this,a-aLd((jGd(),eGd)),XKd((b=BD(Ajd(this,16),26),!b?eGd:b),a))};_.sh=function IUd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:cJd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:DId(this,BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 10:ZId(this,Ccb(DD(b)));return;case 11:fJd(this,Ccb(DD(b)));return;case 12:dJd(this,Ccb(DD(b)));return;case 13:$Id(this,GD(b));return;case 15:eJd(this,Ccb(DD(b)));return;case 16:aJd(this,Ccb(DD(b)));return;case 18:BUd(this,Ccb(DD(b)));return;case 20:EUd(this,Ccb(DD(b)));return;case 21:DUd(this,BD(b,18));return;case 23:!this.a&&(this.a=new _4d(b5,this,23));Uxd(this.a);!this.a&&(this.a=new _4d(b5,this,23));ytd(this.a,BD(b,14));return;}did(this,a-aLd((jGd(),eGd)),XKd((c=BD(Ajd(this,16),26),!c?eGd:c),a),b)};_.zh=function JUd(){return jGd(),eGd};_.Bh=function KUd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),4);pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:DId(this,1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 10:ZId(this,true);return;case 11:fJd(this,false);return;case 12:dJd(this,false);return;case 13:this.i=null;_Id(this,null);return;case 15:eJd(this,false);return;case 16:aJd(this,false);return;case 18:CUd(this,false);JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),2);return;case 20:EUd(this,true);return;case 21:DUd(this,null);return;case 23:!this.a&&(this.a=new _4d(b5,this,23));Uxd(this.a);return;}eid(this,a-aLd((jGd(),eGd)),XKd((b=BD(Ajd(this,16),26),!b?eGd:b),a))};_.Gh=function LUd(){AUd(this);a2d(q1d((O6d(),M6d),this));wId(this);this.Bb|=1};_.Lj=function MUd(){return zUd(this)};_.qk=function NUd(){var a;return a=zUd(this),!!a&&(a.Bb&ote)!=0};_.rk=function OUd(){return (this.Bb&ote)!=0};_.sk=function PUd(){return (this.Bb&Tje)!=0};_.nk=function QUd(a,b){this.c=null;return zId(this,a,b)};_.Ib=function RUd(){var a;if((this.Db&64)!=0)return gJd(this);a=new Jfb(gJd(this));a.a+=' (containment: ';Ffb(a,(this.Bb&ote)!=0);a.a+=', resolveProxies: ';Ffb(a,(this.Bb&Tje)!=0);a.a+=')';return a.a};var w6=mdb(qte,'EReferenceImpl',99);bcb(548,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,548:1,114:1,115:1},XUd);_.Fb=function bVd(a){return this===a};_.cd=function dVd(){return this.b};_.dd=function eVd(){return this.c};_.Hb=function fVd(){return FCb(this)};_.Uh=function hVd(a){SUd(this,GD(a))};_.ed=function iVd(a){return WUd(this,GD(a))};_._g=function YUd(a,b,c){var d;switch(a){case 0:return this.b;case 1:return this.c;}return bid(this,a-aLd((jGd(),fGd)),XKd((d=BD(Ajd(this,16),26),!d?fGd:d),a),b,c)};_.lh=function ZUd(a){var b;switch(a){case 0:return this.b!=null;case 1:return this.c!=null;}return cid(this,a-aLd((jGd(),fGd)),XKd((b=BD(Ajd(this,16),26),!b?fGd:b),a))};_.sh=function $Ud(a,b){var c;switch(a){case 0:TUd(this,GD(b));return;case 1:VUd(this,GD(b));return;}did(this,a-aLd((jGd(),fGd)),XKd((c=BD(Ajd(this,16),26),!c?fGd:c),a),b)};_.zh=function _Ud(){return jGd(),fGd};_.Bh=function aVd(a){var b;switch(a){case 0:UUd(this,null);return;case 1:VUd(this,null);return;}eid(this,a-aLd((jGd(),fGd)),XKd((b=BD(Ajd(this,16),26),!b?fGd:b),a))};_.Sh=function cVd(){var a;if(this.a==-1){a=this.b;this.a=a==null?0:LCb(a)}return this.a};_.Th=function gVd(a){this.a=a};_.Ib=function jVd(){var a;if((this.Db&64)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (key: ';Efb(a,this.b);a.a+=', value: ';Efb(a,this.c);a.a+=')';return a.a};_.a=-1;_.b=null;_.c=null;var x6=mdb(qte,'EStringToStringMapEntryImpl',548);var D9=odb(yve,'FeatureMap/Entry/Internal');bcb(565,1,Xve);_.Ok=function mVd(a){return this.Pk(BD(a,49))};_.Pk=function nVd(a){return this.Ok(a)};_.Fb=function oVd(a){var b,c;if(this===a){return true}else if(JD(a,72)){b=BD(a,72);if(b.ak()==this.c){c=this.dd();return c==null?b.dd()==null:pb(c,b.dd())}else{return false}}else{return false}};_.ak=function pVd(){return this.c};_.Hb=function qVd(){var a;a=this.dd();return tb(this.c)^(a==null?0:tb(a))};_.Ib=function rVd(){var a,b;a=this.c;b=bKd(a.Hj()).Ph();a.ne();return (b!=null&&b.length!=0?b+':'+a.ne():a.ne())+'='+this.dd()};var y6=mdb(qte,'EStructuralFeatureImpl/BasicFeatureMapEntry',565);bcb(776,565,Xve,uVd);_.Pk=function vVd(a){return new uVd(this.c,a)};_.dd=function wVd(){return this.a};_.Qk=function xVd(a,b,c){return sVd(this,a,this.a,b,c)};_.Rk=function yVd(a,b,c){return tVd(this,a,this.a,b,c)};var z6=mdb(qte,'EStructuralFeatureImpl/ContainmentUpdatingFeatureMapEntry',776);bcb(1314,1,{},zVd);_.Pj=function AVd(a,b,c,d,e){var f;f=BD(gid(a,this.b),215);return f.nl(this.a).Wj(d)};_.Qj=function BVd(a,b,c,d,e){var f;f=BD(gid(a,this.b),215);return f.el(this.a,d,e)};_.Rj=function CVd(a,b,c,d,e){var f;f=BD(gid(a,this.b),215);return f.fl(this.a,d,e)};_.Sj=function DVd(a,b,c){var d;d=BD(gid(a,this.b),215);return d.nl(this.a).fj()};_.Tj=function EVd(a,b,c,d){var e;e=BD(gid(a,this.b),215);e.nl(this.a).Wb(d)};_.Uj=function FVd(a,b,c){return BD(gid(a,this.b),215).nl(this.a)};_.Vj=function GVd(a,b,c){var d;d=BD(gid(a,this.b),215);d.nl(this.a).Xj()};var A6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateFeatureMapDelegator',1314);bcb(89,1,{},IVd,JVd,KVd,LVd);_.Pj=function MVd(a,b,c,d,e){var f;f=b.Ch(c);f==null&&b.Dh(c,f=HVd(this,a));if(!e){switch(this.e){case 50:case 41:return BD(f,589).sj();case 40:return BD(f,215).kl();}}return f};_.Qj=function NVd(a,b,c,d,e){var f,g;g=b.Ch(c);g==null&&b.Dh(c,g=HVd(this,a));f=BD(g,69).lk(d,e);return f};_.Rj=function OVd(a,b,c,d,e){var f;f=b.Ch(c);f!=null&&(e=BD(f,69).mk(d,e));return e};_.Sj=function PVd(a,b,c){var d;d=b.Ch(c);return d!=null&&BD(d,76).fj()};_.Tj=function QVd(a,b,c,d){var e;e=BD(b.Ch(c),76);!e&&b.Dh(c,e=HVd(this,a));e.Wb(d)};_.Uj=function RVd(a,b,c){var d,e;e=b.Ch(c);e==null&&b.Dh(c,e=HVd(this,a));if(JD(e,76)){return BD(e,76)}else{d=BD(b.Ch(c),15);return new iYd(d)}};_.Vj=function SVd(a,b,c){var d;d=BD(b.Ch(c),76);!d&&b.Dh(c,d=HVd(this,a));d.Xj()};_.b=0;_.e=0;var B6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateMany',89);bcb(504,1,{});_.Qj=function WVd(a,b,c,d,e){throw vbb(new bgb)};_.Rj=function XVd(a,b,c,d,e){throw vbb(new bgb)};_.Uj=function YVd(a,b,c){return new ZVd(this,a,b,c)};var TVd;var i7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingle',504);bcb(1331,1,zve,ZVd);_.Wj=function $Vd(a){return this.a.Pj(this.c,this.d,this.b,a,true)};_.fj=function _Vd(){return this.a.Sj(this.c,this.d,this.b)};_.Wb=function aWd(a){this.a.Tj(this.c,this.d,this.b,a)};_.Xj=function bWd(){this.a.Vj(this.c,this.d,this.b)};_.b=0;var C6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingle/1',1331);bcb(769,504,{},cWd);_.Pj=function dWd(a,b,c,d,e){return Nid(a,a.eh(),a.Vg())==this.b?this.sk()&&d?aid(a):a.eh():null};_.Qj=function eWd(a,b,c,d,e){var f,g;!!a.eh()&&(e=(f=a.Vg(),f>=0?a.Qg(e):a.eh().ih(a,-1-f,null,e)));g=bLd(a.Tg(),this.e);return a.Sg(d,g,e)};_.Rj=function fWd(a,b,c,d,e){var f;f=bLd(a.Tg(),this.e);return a.Sg(null,f,e)};_.Sj=function gWd(a,b,c){var d;d=bLd(a.Tg(),this.e);return !!a.eh()&&a.Vg()==d};_.Tj=function hWd(a,b,c,d){var e,f,g,h,i;if(d!=null&&!fKd(this.a,d)){throw vbb(new Cdb(Yve+(JD(d,56)?gLd(BD(d,56).Tg()):idb(rb(d)))+Zve+this.a+"'"))}e=a.eh();g=bLd(a.Tg(),this.e);if(PD(d)!==PD(e)||a.Vg()!=g&&d!=null){if(p6d(a,BD(d,56)))throw vbb(new Wdb(ste+a.Ib()));i=null;!!e&&(i=(f=a.Vg(),f>=0?a.Qg(i):a.eh().ih(a,-1-f,null,i)));h=BD(d,49);!!h&&(i=h.gh(a,bLd(h.Tg(),this.b),null,i));i=a.Sg(h,g,i);!!i&&i.Fi()}else{a.Lg()&&a.Mg()&&Uhd(a,new nSd(a,1,g,d,d))}};_.Vj=function iWd(a,b,c){var d,e,f,g;d=a.eh();if(d){g=(e=a.Vg(),e>=0?a.Qg(null):a.eh().ih(a,-1-e,null,null));f=bLd(a.Tg(),this.e);g=a.Sg(null,f,g);!!g&&g.Fi()}else{a.Lg()&&a.Mg()&&Uhd(a,new DSd(a,1,this.e,null,null))}};_.sk=function jWd(){return false};var E6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleContainer',769);bcb(1315,769,{},kWd);_.sk=function lWd(){return true};var D6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleContainerResolving',1315);bcb(563,504,{});_.Pj=function oWd(a,b,c,d,e){var f;return f=b.Ch(c),f==null?this.b:PD(f)===PD(TVd)?null:f};_.Sj=function pWd(a,b,c){var d;d=b.Ch(c);return d!=null&&(PD(d)===PD(TVd)||!pb(d,this.b))};_.Tj=function qWd(a,b,c,d){var e,f;if(a.Lg()&&a.Mg()){e=(f=b.Ch(c),f==null?this.b:PD(f)===PD(TVd)?null:f);if(d==null){if(this.c!=null){b.Dh(c,null);d=this.b}else this.b!=null?b.Dh(c,TVd):b.Dh(c,null)}else{this.Sk(d);b.Dh(c,d)}Uhd(a,this.d.Tk(a,1,this.e,e,d))}else{if(d==null){this.c!=null?b.Dh(c,null):this.b!=null?b.Dh(c,TVd):b.Dh(c,null)}else{this.Sk(d);b.Dh(c,d)}}};_.Vj=function rWd(a,b,c){var d,e;if(a.Lg()&&a.Mg()){d=(e=b.Ch(c),e==null?this.b:PD(e)===PD(TVd)?null:e);b.Eh(c);Uhd(a,this.d.Tk(a,1,this.e,d,this.b))}else{b.Eh(c)}};_.Sk=function sWd(a){throw vbb(new Bdb)};var T6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData',563);bcb($ve,1,{},DWd);_.Tk=function EWd(a,b,c,d,e){return new DSd(a,b,c,d,e)};_.Uk=function FWd(a,b,c,d,e,f){return new FSd(a,b,c,d,e,f)};var tWd,uWd,vWd,wWd,xWd,yWd,zWd,AWd,BWd;var N6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator',$ve);bcb(1332,$ve,{},GWd);_.Tk=function HWd(a,b,c,d,e){return new ISd(a,b,c,Ccb(DD(d)),Ccb(DD(e)))};_.Uk=function IWd(a,b,c,d,e,f){return new JSd(a,b,c,Ccb(DD(d)),Ccb(DD(e)),f)};var F6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/1',1332);bcb(1333,$ve,{},JWd);_.Tk=function KWd(a,b,c,d,e){return new rSd(a,b,c,BD(d,217).a,BD(e,217).a)};_.Uk=function LWd(a,b,c,d,e,f){return new sSd(a,b,c,BD(d,217).a,BD(e,217).a,f)};var G6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/2',1333);bcb(1334,$ve,{},MWd);_.Tk=function NWd(a,b,c,d,e){return new tSd(a,b,c,BD(d,172).a,BD(e,172).a)};_.Uk=function OWd(a,b,c,d,e,f){return new uSd(a,b,c,BD(d,172).a,BD(e,172).a,f)};var H6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/3',1334);bcb(1335,$ve,{},PWd);_.Tk=function QWd(a,b,c,d,e){return new vSd(a,b,c,Edb(ED(d)),Edb(ED(e)))};_.Uk=function RWd(a,b,c,d,e,f){return new wSd(a,b,c,Edb(ED(d)),Edb(ED(e)),f)};var I6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/4',1335);bcb(1336,$ve,{},SWd);_.Tk=function TWd(a,b,c,d,e){return new xSd(a,b,c,BD(d,155).a,BD(e,155).a)};_.Uk=function UWd(a,b,c,d,e,f){return new ySd(a,b,c,BD(d,155).a,BD(e,155).a,f)};var J6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/5',1336);bcb(1337,$ve,{},VWd);_.Tk=function WWd(a,b,c,d,e){return new zSd(a,b,c,BD(d,19).a,BD(e,19).a)};_.Uk=function XWd(a,b,c,d,e,f){return new ASd(a,b,c,BD(d,19).a,BD(e,19).a,f)};var K6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/6',1337);bcb(1338,$ve,{},YWd);_.Tk=function ZWd(a,b,c,d,e){return new BSd(a,b,c,BD(d,162).a,BD(e,162).a)};_.Uk=function $Wd(a,b,c,d,e,f){return new CSd(a,b,c,BD(d,162).a,BD(e,162).a,f)};var L6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/7',1338);bcb(1339,$ve,{},_Wd);_.Tk=function aXd(a,b,c,d,e){return new GSd(a,b,c,BD(d,184).a,BD(e,184).a)};_.Uk=function bXd(a,b,c,d,e,f){return new HSd(a,b,c,BD(d,184).a,BD(e,184).a,f)};var M6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/8',1339);bcb(1317,563,{},cXd);_.Sk=function dXd(a){if(!this.a.wj(a)){throw vbb(new Cdb(Yve+rb(a)+Zve+this.a+"'"))}};var O6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataDynamic',1317);bcb(1318,563,{},eXd);_.Sk=function fXd(a){};var P6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataStatic',1318);bcb(770,563,{});_.Sj=function gXd(a,b,c){var d;d=b.Ch(c);return d!=null};_.Tj=function hXd(a,b,c,d){var e,f;if(a.Lg()&&a.Mg()){e=true;f=b.Ch(c);if(f==null){e=false;f=this.b}else PD(f)===PD(TVd)&&(f=null);if(d==null){if(this.c!=null){b.Dh(c,null);d=this.b}else{b.Dh(c,TVd)}}else{this.Sk(d);b.Dh(c,d)}Uhd(a,this.d.Uk(a,1,this.e,f,d,!e))}else{if(d==null){this.c!=null?b.Dh(c,null):b.Dh(c,TVd)}else{this.Sk(d);b.Dh(c,d)}}};_.Vj=function iXd(a,b,c){var d,e;if(a.Lg()&&a.Mg()){d=true;e=b.Ch(c);if(e==null){d=false;e=this.b}else PD(e)===PD(TVd)&&(e=null);b.Eh(c);Uhd(a,this.d.Uk(a,2,this.e,e,this.b,d))}else{b.Eh(c)}};var S6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettable',770);bcb(1319,770,{},jXd);_.Sk=function kXd(a){if(!this.a.wj(a)){throw vbb(new Cdb(Yve+rb(a)+Zve+this.a+"'"))}};var Q6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableDynamic',1319);bcb(1320,770,{},lXd);_.Sk=function mXd(a){};var R6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableStatic',1320);bcb(398,504,{},nXd);_.Pj=function pXd(a,b,c,d,e){var f,g,h,i,j;j=b.Ch(c);if(this.Kj()&&PD(j)===PD(TVd)){return null}else if(this.sk()&&d&&j!=null){h=BD(j,49);if(h.kh()){i=xid(a,h);if(h!=i){if(!fKd(this.a,i)){throw vbb(new Cdb(Yve+rb(i)+Zve+this.a+"'"))}b.Dh(c,j=i);if(this.rk()){f=BD(i,49);g=h.ih(a,!this.b?-1-bLd(a.Tg(),this.e):bLd(h.Tg(),this.b),null,null);!f.eh()&&(g=f.gh(a,!this.b?-1-bLd(a.Tg(),this.e):bLd(f.Tg(),this.b),null,g));!!g&&g.Fi()}a.Lg()&&a.Mg()&&Uhd(a,new DSd(a,9,this.e,h,i))}}return j}else{return j}};_.Qj=function qXd(a,b,c,d,e){var f,g;g=b.Ch(c);PD(g)===PD(TVd)&&(g=null);b.Dh(c,d);if(this.bj()){if(PD(g)!==PD(d)&&g!=null){f=BD(g,49);e=f.ih(a,bLd(f.Tg(),this.b),null,e)}}else this.rk()&&g!=null&&(e=BD(g,49).ih(a,-1-bLd(a.Tg(),this.e),null,e));if(a.Lg()&&a.Mg()){!e&&(e=new Ixd(4));e.Ei(new DSd(a,1,this.e,g,d))}return e};_.Rj=function rXd(a,b,c,d,e){var f;f=b.Ch(c);PD(f)===PD(TVd)&&(f=null);b.Eh(c);if(a.Lg()&&a.Mg()){!e&&(e=new Ixd(4));this.Kj()?e.Ei(new DSd(a,2,this.e,f,null)):e.Ei(new DSd(a,1,this.e,f,null))}return e};_.Sj=function sXd(a,b,c){var d;d=b.Ch(c);return d!=null};_.Tj=function tXd(a,b,c,d){var e,f,g,h,i;if(d!=null&&!fKd(this.a,d)){throw vbb(new Cdb(Yve+(JD(d,56)?gLd(BD(d,56).Tg()):idb(rb(d)))+Zve+this.a+"'"))}i=b.Ch(c);h=i!=null;this.Kj()&&PD(i)===PD(TVd)&&(i=null);g=null;if(this.bj()){if(PD(i)!==PD(d)){if(i!=null){e=BD(i,49);g=e.ih(a,bLd(e.Tg(),this.b),null,g)}if(d!=null){e=BD(d,49);g=e.gh(a,bLd(e.Tg(),this.b),null,g)}}}else if(this.rk()){if(PD(i)!==PD(d)){i!=null&&(g=BD(i,49).ih(a,-1-bLd(a.Tg(),this.e),null,g));d!=null&&(g=BD(d,49).gh(a,-1-bLd(a.Tg(),this.e),null,g))}}d==null&&this.Kj()?b.Dh(c,TVd):b.Dh(c,d);if(a.Lg()&&a.Mg()){f=new FSd(a,1,this.e,i,d,this.Kj()&&!h);if(!g){Uhd(a,f)}else{g.Ei(f);g.Fi()}}else !!g&&g.Fi()};_.Vj=function uXd(a,b,c){var d,e,f,g,h;h=b.Ch(c);g=h!=null;this.Kj()&&PD(h)===PD(TVd)&&(h=null);f=null;if(h!=null){if(this.bj()){d=BD(h,49);f=d.ih(a,bLd(d.Tg(),this.b),null,f)}else this.rk()&&(f=BD(h,49).ih(a,-1-bLd(a.Tg(),this.e),null,f))}b.Eh(c);if(a.Lg()&&a.Mg()){e=new FSd(a,this.Kj()?2:1,this.e,h,null,g);if(!f){Uhd(a,e)}else{f.Ei(e);f.Fi()}}else !!f&&f.Fi()};_.bj=function vXd(){return false};_.rk=function wXd(){return false};_.sk=function xXd(){return false};_.Kj=function yXd(){return false};var h7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObject',398);bcb(564,398,{},zXd);_.rk=function AXd(){return true};var _6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainment',564);bcb(1323,564,{},BXd);_.sk=function CXd(){return true};var U6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentResolving',1323);bcb(772,564,{},DXd);_.Kj=function EXd(){return true};var W6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettable',772);bcb(1325,772,{},FXd);_.sk=function GXd(){return true};var V6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettableResolving',1325);bcb(640,564,{},HXd);_.bj=function IXd(){return true};var $6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverse',640);bcb(1324,640,{},JXd);_.sk=function KXd(){return true};var X6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseResolving',1324);bcb(773,640,{},LXd);_.Kj=function MXd(){return true};var Z6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettable',773);bcb(1326,773,{},NXd);_.sk=function OXd(){return true};var Y6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettableResolving',1326);bcb(641,398,{},PXd);_.sk=function QXd(){return true};var d7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolving',641);bcb(1327,641,{},RXd);_.Kj=function SXd(){return true};var a7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingUnsettable',1327);bcb(774,641,{},TXd);_.bj=function UXd(){return true};var c7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverse',774);bcb(1328,774,{},VXd);_.Kj=function WXd(){return true};var b7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverseUnsettable',1328);bcb(1321,398,{},XXd);_.Kj=function YXd(){return true};var e7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectUnsettable',1321);bcb(771,398,{},ZXd);_.bj=function $Xd(){return true};var g7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverse',771);bcb(1322,771,{},_Xd);_.Kj=function aYd(){return true};var f7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverseUnsettable',1322);bcb(775,565,Xve,dYd);_.Pk=function eYd(a){return new dYd(this.a,this.c,a)};_.dd=function fYd(){return this.b};_.Qk=function gYd(a,b,c){return bYd(this,a,this.b,c)};_.Rk=function hYd(a,b,c){return cYd(this,a,this.b,c)};var j7=mdb(qte,'EStructuralFeatureImpl/InverseUpdatingFeatureMapEntry',775);bcb(1329,1,zve,iYd);_.Wj=function jYd(a){return this.a};_.fj=function kYd(){return JD(this.a,95)?BD(this.a,95).fj():!this.a.dc()};_.Wb=function lYd(a){this.a.$b();this.a.Gc(BD(a,15))};_.Xj=function mYd(){JD(this.a,95)?BD(this.a,95).Xj():this.a.$b()};var k7=mdb(qte,'EStructuralFeatureImpl/SettingMany',1329);bcb(1330,565,Xve,nYd);_.Ok=function oYd(a){return new sYd((Q8d(),P8d),this.b.Ih(this.a,a))};_.dd=function pYd(){return null};_.Qk=function qYd(a,b,c){return c};_.Rk=function rYd(a,b,c){return c};var l7=mdb(qte,'EStructuralFeatureImpl/SimpleContentFeatureMapEntry',1330);bcb(642,565,Xve,sYd);_.Ok=function tYd(a){return new sYd(this.c,a)};_.dd=function uYd(){return this.a};_.Qk=function vYd(a,b,c){return c};_.Rk=function wYd(a,b,c){return c};var m7=mdb(qte,'EStructuralFeatureImpl/SimpleFeatureMapEntry',642);bcb(391,497,oue,xYd);_.ri=function yYd(a){return KC(c5,Uhe,26,a,0,1)};_.ni=function zYd(){return false};var o7=mdb(qte,'ESuperAdapter/1',391);bcb(444,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,836:1,49:1,97:1,150:1,444:1,114:1,115:1},BYd);_._g=function CYd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return !this.a&&(this.a=new KYd(this,j5,this)),this.a;}return bid(this,a-aLd((jGd(),iGd)),XKd((d=BD(Ajd(this,16),26),!d?iGd:d),a),b,c)};_.jh=function DYd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 2:return !this.a&&(this.a=new KYd(this,j5,this)),Txd(this.a,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),iGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),iGd)),a,c)};_.lh=function EYd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return !!this.a&&this.a.i!=0;}return cid(this,a-aLd((jGd(),iGd)),XKd((b=BD(Ajd(this,16),26),!b?iGd:b),a))};_.sh=function FYd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:!this.a&&(this.a=new KYd(this,j5,this));Uxd(this.a);!this.a&&(this.a=new KYd(this,j5,this));ytd(this.a,BD(b,14));return;}did(this,a-aLd((jGd(),iGd)),XKd((c=BD(Ajd(this,16),26),!c?iGd:c),a),b)};_.zh=function GYd(){return jGd(),iGd};_.Bh=function HYd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:!this.a&&(this.a=new KYd(this,j5,this));Uxd(this.a);return;}eid(this,a-aLd((jGd(),iGd)),XKd((b=BD(Ajd(this,16),26),!b?iGd:b),a))};var u7=mdb(qte,'ETypeParameterImpl',444);bcb(445,85,Pve,KYd);_.cj=function LYd(a,b){return IYd(this,BD(a,87),b)};_.dj=function MYd(a,b){return JYd(this,BD(a,87),b)};var q7=mdb(qte,'ETypeParameterImpl/1',445);bcb(634,43,fke,NYd);_.ec=function OYd(){return new RYd(this)};var t7=mdb(qte,'ETypeParameterImpl/2',634);bcb(556,eie,fie,RYd);_.Fc=function SYd(a){return PYd(this,BD(a,87))};_.Gc=function TYd(a){var b,c,d;d=false;for(c=a.Kc();c.Ob();){b=BD(c.Pb(),87);Rhb(this.a,b,'')==null&&(d=true)}return d};_.$b=function UYd(){Uhb(this.a)};_.Hc=function VYd(a){return Mhb(this.a,a)};_.Kc=function WYd(){var a;return a=new nib((new eib(this.a)).a),new ZYd(a)};_.Mc=function XYd(a){return QYd(this,a)};_.gc=function YYd(){return Vhb(this.a)};var s7=mdb(qte,'ETypeParameterImpl/2/1',556);bcb(557,1,aie,ZYd);_.Nb=function $Yd(a){Rrb(this,a)};_.Pb=function aZd(){return BD(lib(this.a).cd(),87)};_.Ob=function _Yd(){return this.a.b};_.Qb=function bZd(){mib(this.a)};var r7=mdb(qte,'ETypeParameterImpl/2/1/1',557);bcb(1276,43,fke,cZd);_._b=function dZd(a){return ND(a)?Qhb(this,a):!!irb(this.f,a)};_.xc=function eZd(a){var b,c;b=ND(a)?Phb(this,a):Wd(irb(this.f,a));if(JD(b,837)){c=BD(b,837);b=c._j();Rhb(this,BD(a,235),b);return b}else return b!=null?b:a==null?(g5d(),f5d):null};var w7=mdb(qte,'EValidatorRegistryImpl',1276);bcb(1313,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,1941:1,49:1,97:1,150:1,114:1,115:1},mZd);_.Ih=function nZd(a,b){switch(a.yj()){case 21:case 22:case 23:case 24:case 26:case 31:case 32:case 37:case 38:case 39:case 40:case 43:case 44:case 48:case 49:case 20:return b==null?null:fcb(b);case 25:return gZd(b);case 27:return hZd(b);case 28:return iZd(b);case 29:return b==null?null:CQd(Pmd[0],BD(b,199));case 41:return b==null?'':hdb(BD(b,290));case 42:return fcb(b);case 50:return GD(b);default:throw vbb(new Wdb(tte+a.ne()+ute));}};_.Jh=function oZd(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;switch(a.G==-1&&(a.G=(m=bKd(a),m?HLd(m.Mh(),a):-1)),a.G){case 0:return c=new OJd,c;case 1:return b=new RHd,b;case 2:return d=new hLd,d;case 4:return e=new MPd,e;case 5:return f=new aQd,f;case 6:return g=new rQd,g;case 7:return h=new $md,h;case 10:return j=new MGd,j;case 11:return k=new SSd,k;case 12:return l=new eod,l;case 13:return n=new rUd,n;case 14:return o=new FUd,o;case 17:return p=new XUd,p;case 18:return i=new UQd,i;case 19:return q=new BYd,q;default:throw vbb(new Wdb(xte+a.zb+ute));}};_.Kh=function pZd(a,b){switch(a.yj()){case 20:return b==null?null:new tgb(b);case 21:return b==null?null:new Ygb(b);case 23:case 22:return b==null?null:fZd(b);case 26:case 24:return b==null?null:Scb(Icb(b,-128,127)<<24>>24);case 25:return Xmd(b);case 27:return jZd(b);case 28:return kZd(b);case 29:return lZd(b);case 32:case 31:return b==null?null:Hcb(b);case 38:case 37:return b==null?null:new Odb(b);case 40:case 39:return b==null?null:meb(Icb(b,Rie,Ohe));case 41:return null;case 42:return b==null?null:null;case 44:case 43:return b==null?null:Aeb(Jcb(b));case 49:case 48:return b==null?null:Web(Icb(b,awe,32767)<<16>>16);case 50:return b;default:throw vbb(new Wdb(tte+a.ne()+ute));}};var x7=mdb(qte,'EcoreFactoryImpl',1313);bcb(547,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,1939:1,49:1,97:1,150:1,179:1,547:1,114:1,115:1,675:1},AZd);_.gb=false;_.hb=false;var rZd,sZd=false;var o8=mdb(qte,'EcorePackageImpl',547);bcb(1184,1,{837:1},EZd);_._j=function FZd(){return I6d(),H6d};var I7=mdb(qte,'EcorePackageImpl/1',1184);bcb(1193,1,nwe,GZd);_.wj=function HZd(a){return JD(a,147)};_.xj=function IZd(a){return KC(k5,Uhe,147,a,0,1)};var y7=mdb(qte,'EcorePackageImpl/10',1193);bcb(1194,1,nwe,JZd);_.wj=function KZd(a){return JD(a,191)};_.xj=function LZd(a){return KC(l5,Uhe,191,a,0,1)};var z7=mdb(qte,'EcorePackageImpl/11',1194);bcb(1195,1,nwe,MZd);_.wj=function NZd(a){return JD(a,56)};_.xj=function OZd(a){return KC(m5,Uhe,56,a,0,1)};var A7=mdb(qte,'EcorePackageImpl/12',1195);bcb(1196,1,nwe,PZd);_.wj=function QZd(a){return JD(a,399)};_.xj=function RZd(a){return KC(n5,Nve,59,a,0,1)};var B7=mdb(qte,'EcorePackageImpl/13',1196);bcb(1197,1,nwe,SZd);_.wj=function TZd(a){return JD(a,235)};_.xj=function UZd(a){return KC(o5,Uhe,235,a,0,1)};var C7=mdb(qte,'EcorePackageImpl/14',1197);bcb(1198,1,nwe,VZd);_.wj=function WZd(a){return JD(a,509)};_.xj=function XZd(a){return KC(p5,Uhe,2017,a,0,1)};var D7=mdb(qte,'EcorePackageImpl/15',1198);bcb(1199,1,nwe,YZd);_.wj=function ZZd(a){return JD(a,99)};_.xj=function $Zd(a){return KC(q5,Mve,18,a,0,1)};var E7=mdb(qte,'EcorePackageImpl/16',1199);bcb(1200,1,nwe,_Zd);_.wj=function a$d(a){return JD(a,170)};_.xj=function b$d(a){return KC(t5,Mve,170,a,0,1)};var F7=mdb(qte,'EcorePackageImpl/17',1200);bcb(1201,1,nwe,c$d);_.wj=function d$d(a){return JD(a,472)};_.xj=function e$d(a){return KC(v5,Uhe,472,a,0,1)};var G7=mdb(qte,'EcorePackageImpl/18',1201);bcb(1202,1,nwe,f$d);_.wj=function g$d(a){return JD(a,548)};_.xj=function h$d(a){return KC(x6,kve,548,a,0,1)};var H7=mdb(qte,'EcorePackageImpl/19',1202);bcb(1185,1,nwe,i$d);_.wj=function j$d(a){return JD(a,322)};_.xj=function k$d(a){return KC(b5,Mve,34,a,0,1)};var T7=mdb(qte,'EcorePackageImpl/2',1185);bcb(1203,1,nwe,l$d);_.wj=function m$d(a){return JD(a,241)};_.xj=function n$d(a){return KC(j5,Tve,87,a,0,1)};var J7=mdb(qte,'EcorePackageImpl/20',1203);bcb(1204,1,nwe,o$d);_.wj=function p$d(a){return JD(a,444)};_.xj=function q$d(a){return KC(u5,Uhe,836,a,0,1)};var K7=mdb(qte,'EcorePackageImpl/21',1204);bcb(1205,1,nwe,r$d);_.wj=function s$d(a){return KD(a)};_.xj=function t$d(a){return KC(wI,nie,476,a,8,1)};var L7=mdb(qte,'EcorePackageImpl/22',1205);bcb(1206,1,nwe,u$d);_.wj=function v$d(a){return JD(a,190)};_.xj=function w$d(a){return KC(SD,nie,190,a,0,2)};var M7=mdb(qte,'EcorePackageImpl/23',1206);bcb(1207,1,nwe,x$d);_.wj=function y$d(a){return JD(a,217)};_.xj=function z$d(a){return KC(xI,nie,217,a,0,1)};var N7=mdb(qte,'EcorePackageImpl/24',1207);bcb(1208,1,nwe,A$d);_.wj=function B$d(a){return JD(a,172)};_.xj=function C$d(a){return KC(yI,nie,172,a,0,1)};var O7=mdb(qte,'EcorePackageImpl/25',1208);bcb(1209,1,nwe,D$d);_.wj=function E$d(a){return JD(a,199)};_.xj=function F$d(a){return KC($J,nie,199,a,0,1)};var P7=mdb(qte,'EcorePackageImpl/26',1209);bcb(1210,1,nwe,G$d);_.wj=function H$d(a){return false};_.xj=function I$d(a){return KC(O4,Uhe,2110,a,0,1)};var Q7=mdb(qte,'EcorePackageImpl/27',1210);bcb(1211,1,nwe,J$d);_.wj=function K$d(a){return LD(a)};_.xj=function L$d(a){return KC(BI,nie,333,a,7,1)};var R7=mdb(qte,'EcorePackageImpl/28',1211);bcb(1212,1,nwe,M$d);_.wj=function N$d(a){return JD(a,58)};_.xj=function O$d(a){return KC(T4,eme,58,a,0,1)};var S7=mdb(qte,'EcorePackageImpl/29',1212);bcb(1186,1,nwe,P$d);_.wj=function Q$d(a){return JD(a,510)};_.xj=function R$d(a){return KC(a5,{3:1,4:1,5:1,1934:1},590,a,0,1)};var c8=mdb(qte,'EcorePackageImpl/3',1186);bcb(1213,1,nwe,S$d);_.wj=function T$d(a){return JD(a,573)};_.xj=function U$d(a){return KC(U4,Uhe,1940,a,0,1)};var U7=mdb(qte,'EcorePackageImpl/30',1213);bcb(1214,1,nwe,V$d);_.wj=function W$d(a){return JD(a,153)};_.xj=function X$d(a){return KC(O9,eme,153,a,0,1)};var V7=mdb(qte,'EcorePackageImpl/31',1214);bcb(1215,1,nwe,Y$d);_.wj=function Z$d(a){return JD(a,72)};_.xj=function $$d(a){return KC(E9,owe,72,a,0,1)};var W7=mdb(qte,'EcorePackageImpl/32',1215);bcb(1216,1,nwe,_$d);_.wj=function a_d(a){return JD(a,155)};_.xj=function b_d(a){return KC(FI,nie,155,a,0,1)};var X7=mdb(qte,'EcorePackageImpl/33',1216);bcb(1217,1,nwe,c_d);_.wj=function d_d(a){return JD(a,19)};_.xj=function e_d(a){return KC(JI,nie,19,a,0,1)};var Y7=mdb(qte,'EcorePackageImpl/34',1217);bcb(1218,1,nwe,f_d);_.wj=function g_d(a){return JD(a,290)};_.xj=function h_d(a){return KC(AI,Uhe,290,a,0,1)};var Z7=mdb(qte,'EcorePackageImpl/35',1218);bcb(1219,1,nwe,i_d);_.wj=function j_d(a){return JD(a,162)};_.xj=function k_d(a){return KC(MI,nie,162,a,0,1)};var $7=mdb(qte,'EcorePackageImpl/36',1219);bcb(1220,1,nwe,l_d);_.wj=function m_d(a){return JD(a,83)};_.xj=function n_d(a){return KC(DK,Uhe,83,a,0,1)};var _7=mdb(qte,'EcorePackageImpl/37',1220);bcb(1221,1,nwe,o_d);_.wj=function p_d(a){return JD(a,591)};_.xj=function q_d(a){return KC(v8,Uhe,591,a,0,1)};var a8=mdb(qte,'EcorePackageImpl/38',1221);bcb(1222,1,nwe,r_d);_.wj=function s_d(a){return false};_.xj=function t_d(a){return KC(u8,Uhe,2111,a,0,1)};var b8=mdb(qte,'EcorePackageImpl/39',1222);bcb(1187,1,nwe,u_d);_.wj=function v_d(a){return JD(a,88)};_.xj=function w_d(a){return KC(c5,Uhe,26,a,0,1)};var i8=mdb(qte,'EcorePackageImpl/4',1187);bcb(1223,1,nwe,x_d);_.wj=function y_d(a){return JD(a,184)};_.xj=function z_d(a){return KC(UI,nie,184,a,0,1)};var d8=mdb(qte,'EcorePackageImpl/40',1223);bcb(1224,1,nwe,A_d);_.wj=function B_d(a){return ND(a)};_.xj=function C_d(a){return KC(ZI,nie,2,a,6,1)};var e8=mdb(qte,'EcorePackageImpl/41',1224);bcb(1225,1,nwe,D_d);_.wj=function E_d(a){return JD(a,588)};_.xj=function F_d(a){return KC(X4,Uhe,588,a,0,1)};var f8=mdb(qte,'EcorePackageImpl/42',1225);bcb(1226,1,nwe,G_d);_.wj=function H_d(a){return false};_.xj=function I_d(a){return KC(V4,nie,2112,a,0,1)};var g8=mdb(qte,'EcorePackageImpl/43',1226);bcb(1227,1,nwe,J_d);_.wj=function K_d(a){return JD(a,42)};_.xj=function L_d(a){return KC(CK,zie,42,a,0,1)};var h8=mdb(qte,'EcorePackageImpl/44',1227);bcb(1188,1,nwe,M_d);_.wj=function N_d(a){return JD(a,138)};_.xj=function O_d(a){return KC(d5,Uhe,138,a,0,1)};var j8=mdb(qte,'EcorePackageImpl/5',1188);bcb(1189,1,nwe,P_d);_.wj=function Q_d(a){return JD(a,148)};_.xj=function R_d(a){return KC(f5,Uhe,148,a,0,1)};var k8=mdb(qte,'EcorePackageImpl/6',1189);bcb(1190,1,nwe,S_d);_.wj=function T_d(a){return JD(a,457)};_.xj=function U_d(a){return KC(h5,Uhe,671,a,0,1)};var l8=mdb(qte,'EcorePackageImpl/7',1190);bcb(1191,1,nwe,V_d);_.wj=function W_d(a){return JD(a,573)};_.xj=function X_d(a){return KC(g5,Uhe,678,a,0,1)};var m8=mdb(qte,'EcorePackageImpl/8',1191);bcb(1192,1,nwe,Y_d);_.wj=function Z_d(a){return JD(a,471)};_.xj=function $_d(a){return KC(i5,Uhe,471,a,0,1)};var n8=mdb(qte,'EcorePackageImpl/9',1192);bcb(1025,1982,ive,c0d);_.bi=function d0d(a,b){__d(this,BD(b,415))};_.fi=function e0d(a,b){a0d(this,a,BD(b,415))};var q8=mdb(qte,'MinimalEObjectImpl/1ArrayDelegatingAdapterList',1025);bcb(1026,143,fve,f0d);_.Ai=function g0d(){return this.a.a};var p8=mdb(qte,'MinimalEObjectImpl/1ArrayDelegatingAdapterList/1',1026);bcb(1053,1052,{},i0d);var t8=mdb('org.eclipse.emf.ecore.plugin','EcorePlugin',1053);var v8=odb(pwe,'Resource');bcb(781,1378,qwe);_.Yk=function m0d(a){};_.Zk=function n0d(a){};_.Vk=function o0d(){return !this.a&&(this.a=new z0d(this)),this.a};_.Wk=function p0d(a){var b,c,d,e,f;d=a.length;if(d>0){BCb(0,a.length);if(a.charCodeAt(0)==47){f=new Skb(4);e=1;for(b=1;b0&&(a=a.substr(0,c))}}}return k0d(this,a)};_.Xk=function q0d(){return this.c};_.Ib=function r0d(){var a;return hdb(this.gm)+'@'+(a=tb(this)>>>0,a.toString(16))+" uri='"+this.d+"'"};_.b=false;var z8=mdb(rwe,'ResourceImpl',781);bcb(1379,781,qwe,s0d);var w8=mdb(rwe,'BinaryResourceImpl',1379);bcb(1169,694,pue);_.si=function v0d(a){return JD(a,56)?t0d(this,BD(a,56)):JD(a,591)?new Fyd(BD(a,591).Vk()):PD(a)===PD(this.f)?BD(a,14).Kc():(LCd(),KCd.a)};_.Ob=function w0d(){return u0d(this)};_.a=false;var z9=mdb(yve,'EcoreUtil/ContentTreeIterator',1169);bcb(1380,1169,pue,x0d);_.si=function y0d(a){return PD(a)===PD(this.f)?BD(a,15).Kc():new C6d(BD(a,56))};var x8=mdb(rwe,'ResourceImpl/5',1380);bcb(648,1994,Ove,z0d);_.Hc=function A0d(a){return this.i<=4?pud(this,a):JD(a,49)&&BD(a,49).Zg()==this.a};_.bi=function B0d(a,b){a==this.i-1&&(this.a.b||(this.a.b=true,null))};_.di=function C0d(a,b){a==0?this.a.b||(this.a.b=true,null):Atd(this,a,b)};_.fi=function D0d(a,b){};_.gi=function E0d(a,b,c){};_.aj=function F0d(){return 2};_.Ai=function G0d(){return this.a};_.bj=function H0d(){return true};_.cj=function I0d(a,b){var c;c=BD(a,49);b=c.wh(this.a,b);return b};_.dj=function J0d(a,b){var c;c=BD(a,49);return c.wh(null,b)};_.ej=function K0d(){return false};_.hi=function L0d(){return true};_.ri=function M0d(a){return KC(m5,Uhe,56,a,0,1)};_.ni=function N0d(){return false};var y8=mdb(rwe,'ResourceImpl/ContentsEList',648);bcb(957,1964,Lie,O0d);_.Zc=function P0d(a){return this.a._h(a)};_.gc=function Q0d(){return this.a.gc()};var A8=mdb(yve,'AbstractSequentialInternalEList/1',957);var K6d,L6d,M6d,N6d;bcb(624,1,{},y1d);var R0d,S0d;var G8=mdb(yve,'BasicExtendedMetaData',624);bcb(1160,1,{},C1d);_.$k=function D1d(){return null};_._k=function E1d(){this.a==-2&&A1d(this,W0d(this.d,this.b));return this.a};_.al=function F1d(){return null};_.bl=function G1d(){return mmb(),mmb(),jmb};_.ne=function H1d(){this.c==Gwe&&B1d(this,_0d(this.d,this.b));return this.c};_.cl=function I1d(){return 0};_.a=-2;_.c=Gwe;var C8=mdb(yve,'BasicExtendedMetaData/EClassExtendedMetaDataImpl',1160);bcb(1161,1,{},O1d);_.$k=function P1d(){this.a==(T0d(),R0d)&&J1d(this,V0d(this.f,this.b));return this.a};_._k=function Q1d(){return 0};_.al=function R1d(){this.c==(T0d(),R0d)&&K1d(this,Z0d(this.f,this.b));return this.c};_.bl=function S1d(){!this.d&&L1d(this,$0d(this.f,this.b));return this.d};_.ne=function T1d(){this.e==Gwe&&M1d(this,_0d(this.f,this.b));return this.e};_.cl=function U1d(){this.g==-2&&N1d(this,c1d(this.f,this.b));return this.g};_.e=Gwe;_.g=-2;var D8=mdb(yve,'BasicExtendedMetaData/EDataTypeExtendedMetaDataImpl',1161);bcb(1159,1,{},Y1d);_.b=false;_.c=false;var E8=mdb(yve,'BasicExtendedMetaData/EPackageExtendedMetaDataImpl',1159);bcb(1162,1,{},j2d);_.c=-2;_.e=Gwe;_.f=Gwe;var F8=mdb(yve,'BasicExtendedMetaData/EStructuralFeatureExtendedMetaDataImpl',1162);bcb(585,622,Pve,k2d);_.aj=function l2d(){return this.c};_.Fk=function m2d(){return false};_.li=function n2d(a,b){return b};_.c=0;var T8=mdb(yve,'EDataTypeEList',585);var O9=odb(yve,'FeatureMap');bcb(75,585,{3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},u3d);_.Vc=function v3d(a,b){o2d(this,a,BD(b,72))};_.Fc=function w3d(a){return r2d(this,BD(a,72))};_.Yh=function B3d(a){w2d(this,BD(a,72))};_.cj=function M3d(a,b){return O2d(this,BD(a,72),b)};_.dj=function N3d(a,b){return Q2d(this,BD(a,72),b)};_.ii=function P3d(a,b){return W2d(this,a,b)};_.li=function R3d(a,b){return _2d(this,a,BD(b,72))};_._c=function T3d(a,b){return c3d(this,a,BD(b,72))};_.jj=function X3d(a,b){return i3d(this,BD(a,72),b)};_.kj=function Y3d(a,b){return k3d(this,BD(a,72),b)};_.lj=function Z3d(a,b,c){return l3d(this,BD(a,72),BD(b,72),c)};_.oi=function _3d(a,b){return t3d(this,a,BD(b,72))};_.dl=function x3d(a,b){return q2d(this,a,b)};_.Wc=function y3d(a,b){var c,d,e,f,g,h,i,j,k;j=new zud(b.gc());for(e=b.Kc();e.Ob();){d=BD(e.Pb(),72);f=d.ak();if(T6d(this.e,f)){(!f.hi()||!E2d(this,f,d.dd())&&!pud(j,d))&&wtd(j,d)}else{k=S6d(this.e.Tg(),f);c=BD(this.g,119);g=true;for(h=0;h=0){b=a[this.c];if(this.k.rl(b.ak())){this.j=this.f?b:b.dd();this.i=-2;return true}}this.i=-1;this.g=-1;return false};var H8=mdb(yve,'BasicFeatureMap/FeatureEIterator',410);bcb(662,410,jie,s4d);_.Lk=function t4d(){return true};var I8=mdb(yve,'BasicFeatureMap/ResolvingFeatureEIterator',662);bcb(955,486,Vve,u4d);_.Gi=function v4d(){return this};var M8=mdb(yve,'EContentsEList/1',955);bcb(956,486,Vve,w4d);_.Lk=function x4d(){return false};var N8=mdb(yve,'EContentsEList/2',956);bcb(954,279,Wve,y4d);_.Nk=function z4d(a){};_.Ob=function A4d(){return false};_.Sb=function B4d(){return false};var O8=mdb(yve,'EContentsEList/FeatureIteratorImpl/1',954);bcb(825,585,Pve,C4d);_.ci=function D4d(){this.a=true};_.fj=function E4d(){return this.a};_.Xj=function F4d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var S8=mdb(yve,'EDataTypeEList/Unsettable',825);bcb(1849,585,Pve,G4d);_.hi=function H4d(){return true};var V8=mdb(yve,'EDataTypeUniqueEList',1849);bcb(1850,825,Pve,I4d);_.hi=function J4d(){return true};var U8=mdb(yve,'EDataTypeUniqueEList/Unsettable',1850);bcb(139,85,Pve,K4d);_.Ek=function L4d(){return true};_.li=function M4d(a,b){return ILd(this,a,BD(b,56))};var W8=mdb(yve,'EObjectContainmentEList/Resolving',139);bcb(1163,545,Pve,N4d);_.Ek=function O4d(){return true};_.li=function P4d(a,b){return ILd(this,a,BD(b,56))};var X8=mdb(yve,'EObjectContainmentEList/Unsettable/Resolving',1163);bcb(748,16,Pve,Q4d);_.ci=function R4d(){this.a=true};_.fj=function S4d(){return this.a};_.Xj=function T4d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var a9=mdb(yve,'EObjectContainmentWithInverseEList/Unsettable',748);bcb(1173,748,Pve,U4d);_.Ek=function V4d(){return true};_.li=function W4d(a,b){return ILd(this,a,BD(b,56))};var _8=mdb(yve,'EObjectContainmentWithInverseEList/Unsettable/Resolving',1173);bcb(743,496,Pve,X4d);_.ci=function Y4d(){this.a=true};_.fj=function Z4d(){return this.a};_.Xj=function $4d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var c9=mdb(yve,'EObjectEList/Unsettable',743);bcb(328,496,Pve,_4d);_.Ek=function a5d(){return true};_.li=function b5d(a,b){return ILd(this,a,BD(b,56))};var f9=mdb(yve,'EObjectResolvingEList',328);bcb(1641,743,Pve,c5d);_.Ek=function d5d(){return true};_.li=function e5d(a,b){return ILd(this,a,BD(b,56))};var e9=mdb(yve,'EObjectResolvingEList/Unsettable',1641);bcb(1381,1,{},h5d);var f5d;var g9=mdb(yve,'EObjectValidator',1381);bcb(546,496,Pve,i5d);_.zk=function j5d(){return this.d};_.Ak=function k5d(){return this.b};_.bj=function l5d(){return true};_.Dk=function m5d(){return true};_.b=0;var k9=mdb(yve,'EObjectWithInverseEList',546);bcb(1176,546,Pve,n5d);_.Ck=function o5d(){return true};var h9=mdb(yve,'EObjectWithInverseEList/ManyInverse',1176);bcb(625,546,Pve,p5d);_.ci=function q5d(){this.a=true};_.fj=function r5d(){return this.a};_.Xj=function s5d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var j9=mdb(yve,'EObjectWithInverseEList/Unsettable',625);bcb(1175,625,Pve,t5d);_.Ck=function u5d(){return true};var i9=mdb(yve,'EObjectWithInverseEList/Unsettable/ManyInverse',1175);bcb(749,546,Pve,v5d);_.Ek=function w5d(){return true};_.li=function x5d(a,b){return ILd(this,a,BD(b,56))};var o9=mdb(yve,'EObjectWithInverseResolvingEList',749);bcb(31,749,Pve,y5d);_.Ck=function z5d(){return true};var l9=mdb(yve,'EObjectWithInverseResolvingEList/ManyInverse',31);bcb(750,625,Pve,A5d);_.Ek=function B5d(){return true};_.li=function C5d(a,b){return ILd(this,a,BD(b,56))};var n9=mdb(yve,'EObjectWithInverseResolvingEList/Unsettable',750);bcb(1174,750,Pve,D5d);_.Ck=function E5d(){return true};var m9=mdb(yve,'EObjectWithInverseResolvingEList/Unsettable/ManyInverse',1174);bcb(1164,622,Pve);_.ai=function F5d(){return (this.b&1792)==0};_.ci=function G5d(){this.b|=1};_.Bk=function H5d(){return (this.b&4)!=0};_.bj=function I5d(){return (this.b&40)!=0};_.Ck=function J5d(){return (this.b&16)!=0};_.Dk=function K5d(){return (this.b&8)!=0};_.Ek=function L5d(){return (this.b&Dve)!=0};_.rk=function M5d(){return (this.b&32)!=0};_.Fk=function N5d(){return (this.b&zte)!=0};_.wj=function O5d(a){return !this.d?this.ak().Yj().wj(a):qEd(this.d,a)};_.fj=function P5d(){return (this.b&2)!=0?(this.b&1)!=0:this.i!=0};_.hi=function Q5d(){return (this.b&128)!=0};_.Xj=function S5d(){var a;Uxd(this);if((this.b&2)!=0){if(oid(this.e)){a=(this.b&1)!=0;this.b&=-2;GLd(this,new qSd(this.e,2,bLd(this.e.Tg(),this.ak()),a,false))}else{this.b&=-2}}};_.ni=function T5d(){return (this.b&1536)==0};_.b=0;var q9=mdb(yve,'EcoreEList/Generic',1164);bcb(1165,1164,Pve,U5d);_.ak=function V5d(){return this.a};var p9=mdb(yve,'EcoreEList/Dynamic',1165);bcb(747,63,oue,W5d);_.ri=function X5d(a){return izd(this.a.a,a)};var u9=mdb(yve,'EcoreEMap/1',747);bcb(746,85,Pve,Y5d);_.bi=function Z5d(a,b){uAd(this.b,BD(b,133))};_.di=function $5d(a,b){tAd(this.b)};_.ei=function _5d(a,b,c){var d;++(d=this.b,BD(b,133),d).e};_.fi=function a6d(a,b){vAd(this.b,BD(b,133))};_.gi=function b6d(a,b,c){vAd(this.b,BD(c,133));PD(c)===PD(b)&&BD(c,133).Th(CAd(BD(b,133).cd()));uAd(this.b,BD(b,133))};var v9=mdb(yve,'EcoreEMap/DelegateEObjectContainmentEList',746);bcb(1171,151,Ave,c6d);var x9=mdb(yve,'EcoreEMap/Unsettable',1171);bcb(1172,746,Pve,d6d);_.ci=function e6d(){this.a=true};_.fj=function f6d(){return this.a};_.Xj=function g6d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var w9=mdb(yve,'EcoreEMap/Unsettable/UnsettableDelegateEObjectContainmentEList',1172);bcb(1168,228,fke,A6d);_.a=false;_.b=false;var A9=mdb(yve,'EcoreUtil/Copier',1168);bcb(745,1,aie,C6d);_.Nb=function D6d(a){Rrb(this,a)};_.Ob=function E6d(){return B6d(this)};_.Pb=function F6d(){var a;B6d(this);a=this.b;this.b=null;return a};_.Qb=function G6d(){this.a.Qb()};var B9=mdb(yve,'EcoreUtil/ProperContentIterator',745);bcb(1382,1381,{},J6d);var H6d;var C9=mdb(yve,'EcoreValidator',1382);var P6d;var N9=odb(yve,'FeatureMapUtil/Validator');bcb(1260,1,{1942:1},U6d);_.rl=function V6d(a){return true};var F9=mdb(yve,'FeatureMapUtil/1',1260);bcb(757,1,{1942:1},Z6d);_.rl=function $6d(a){var b;if(this.c==a)return true;b=DD(Ohb(this.a,a));if(b==null){if(Y6d(this,a)){_6d(this.a,a,(Bcb(),Acb));return true}else{_6d(this.a,a,(Bcb(),zcb));return false}}else{return b==(Bcb(),Acb)}};_.e=false;var W6d;var I9=mdb(yve,'FeatureMapUtil/BasicValidator',757);bcb(758,43,fke,a7d);var H9=mdb(yve,'FeatureMapUtil/BasicValidator/Cache',758);bcb(501,52,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,69:1,95:1},f7d);_.Vc=function g7d(a,b){p2d(this.c,this.b,a,b)};_.Fc=function h7d(a){return q2d(this.c,this.b,a)};_.Wc=function i7d(a,b){return s2d(this.c,this.b,a,b)};_.Gc=function j7d(a){return b7d(this,a)};_.Xh=function k7d(a,b){u2d(this.c,this.b,a,b)};_.lk=function l7d(a,b){return x2d(this.c,this.b,a,b)};_.pi=function m7d(a){return J2d(this.c,this.b,a,false)};_.Zh=function n7d(){return y2d(this.c,this.b)};_.$h=function o7d(){return z2d(this.c,this.b)};_._h=function p7d(a){return A2d(this.c,this.b,a)};_.mk=function q7d(a,b){return c7d(this,a,b)};_.$b=function r7d(){d7d(this)};_.Hc=function s7d(a){return E2d(this.c,this.b,a)};_.Ic=function t7d(a){return G2d(this.c,this.b,a)};_.Xb=function u7d(a){return J2d(this.c,this.b,a,true)};_.Wj=function v7d(a){return this};_.Xc=function w7d(a){return L2d(this.c,this.b,a)};_.dc=function x7d(){return e7d(this)};_.fj=function y7d(){return !R2d(this.c,this.b)};_.Kc=function z7d(){return S2d(this.c,this.b)};_.Yc=function A7d(){return U2d(this.c,this.b)};_.Zc=function B7d(a){return V2d(this.c,this.b,a)};_.ii=function C7d(a,b){return X2d(this.c,this.b,a,b)};_.ji=function D7d(a,b){Y2d(this.c,this.b,a,b)};_.$c=function E7d(a){return Z2d(this.c,this.b,a)};_.Mc=function F7d(a){return $2d(this.c,this.b,a)};_._c=function G7d(a,b){return e3d(this.c,this.b,a,b)};_.Wb=function H7d(a){D2d(this.c,this.b);b7d(this,BD(a,15))};_.gc=function I7d(){return n3d(this.c,this.b)};_.Pc=function J7d(){return o3d(this.c,this.b)};_.Qc=function K7d(a){return q3d(this.c,this.b,a)};_.Ib=function L7d(){var a,b;b=new Hfb;b.a+='[';for(a=y2d(this.c,this.b);b4d(a);){Efb(b,xfb(d4d(a)));b4d(a)&&(b.a+=She,b)}b.a+=']';return b.a};_.Xj=function M7d(){D2d(this.c,this.b)};var J9=mdb(yve,'FeatureMapUtil/FeatureEList',501);bcb(627,36,fve,O7d);_.yi=function P7d(a){return N7d(this,a)};_.Di=function Q7d(a){var b,c,d,e,f,g,h;switch(this.d){case 1:case 2:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.g=a.zi();a.xi()==1&&(this.d=1);return true}break}case 3:{e=a.xi();switch(e){case 3:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.d=5;b=new zud(2);wtd(b,this.g);wtd(b,a.zi());this.g=b;return true}break}}break}case 5:{e=a.xi();switch(e){case 3:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){c=BD(this.g,14);c.Fc(a.zi());return true}break}}break}case 4:{e=a.xi();switch(e){case 3:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.d=1;this.g=a.zi();return true}break}case 4:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.d=6;h=new zud(2);wtd(h,this.n);wtd(h,a.Bi());this.n=h;g=OC(GC(WD,1),oje,25,15,[this.o,a.Ci()]);this.g=g;return true}break}}break}case 6:{e=a.xi();switch(e){case 4:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){c=BD(this.n,14);c.Fc(a.Bi());g=BD(this.g,48);d=KC(WD,oje,25,g.length+1,15,1);$fb(g,0,d,0,g.length);d[g.length]=a.Ci();this.g=d;return true}break}}break}}return false};var K9=mdb(yve,'FeatureMapUtil/FeatureENotificationImpl',627);bcb(552,501,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},R7d);_.dl=function S7d(a,b){return q2d(this.c,a,b)};_.el=function T7d(a,b,c){return x2d(this.c,a,b,c)};_.fl=function U7d(a,b,c){return C2d(this.c,a,b,c)};_.gl=function V7d(){return this};_.hl=function W7d(a,b){return K2d(this.c,a,b)};_.il=function X7d(a){return BD(J2d(this.c,this.b,a,false),72).ak()};_.jl=function Y7d(a){return BD(J2d(this.c,this.b,a,false),72).dd()};_.kl=function Z7d(){return this.a};_.ll=function $7d(a){return !R2d(this.c,a)};_.ml=function _7d(a,b){f3d(this.c,a,b)};_.nl=function a8d(a){return g3d(this.c,a)};_.ol=function b8d(a){s3d(this.c,a)};var L9=mdb(yve,'FeatureMapUtil/FeatureFeatureMap',552);bcb(1259,1,zve,c8d);_.Wj=function d8d(a){return J2d(this.b,this.a,-1,a)};_.fj=function e8d(){return !R2d(this.b,this.a)};_.Wb=function f8d(a){f3d(this.b,this.a,a)};_.Xj=function g8d(){D2d(this.b,this.a)};var M9=mdb(yve,'FeatureMapUtil/FeatureValue',1259);var h8d,i8d,j8d,k8d,l8d;var Q9=odb(Iwe,'AnyType');bcb(666,60,Tie,n8d);var R9=mdb(Iwe,'InvalidDatatypeValueException',666);var S9=odb(Iwe,Jwe);var T9=odb(Iwe,Kwe);var U9=odb(Iwe,Lwe);var o8d;var q8d;var s8d,t8d,u8d,v8d,w8d,x8d,y8d,z8d,A8d,B8d,C8d,D8d,E8d,F8d,G8d,H8d,I8d,J8d,K8d,L8d,M8d,N8d,O8d,P8d;bcb(830,506,{105:1,92:1,90:1,56:1,49:1,97:1,843:1},R8d);_._g=function S8d(a,b,c){switch(a){case 0:if(c)return !this.c&&(this.c=new u3d(this,0)),this.c;return !this.c&&(this.c=new u3d(this,0)),this.c.b;case 1:if(c)return !this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153);return (!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).kl();case 2:if(c)return !this.b&&(this.b=new u3d(this,2)),this.b;return !this.b&&(this.b=new u3d(this,2)),this.b.b;}return bid(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.jh=function T8d(a,b,c){var d;switch(b){case 0:return !this.c&&(this.c=new u3d(this,0)),B2d(this.c,a,c);case 1:return (!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),69)).mk(a,c);case 2:return !this.b&&(this.b=new u3d(this,2)),B2d(this.b,a,c);}return d=BD(XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),b),66),d.Nj().Rj(this,Aid(this),b-aLd(this.zh()),a,c)};_.lh=function U8d(a){switch(a){case 0:return !!this.c&&this.c.i!=0;case 1:return !(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).dc();case 2:return !!this.b&&this.b.i!=0;}return cid(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function V8d(a,b){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));d3d(this.c,b);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).Wb(b);return;case 2:!this.b&&(this.b=new u3d(this,2));d3d(this.b,b);return;}did(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function W8d(){return Q8d(),s8d};_.Bh=function X8d(a){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));Uxd(this.c);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).$b();return;case 2:!this.b&&(this.b=new u3d(this,2));Uxd(this.b);return;}eid(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.Ib=function Y8d(){var a;if((this.j&4)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (mixed: ';Dfb(a,this.c);a.a+=', anyAttribute: ';Dfb(a,this.b);a.a+=')';return a.a};var V9=mdb(Mwe,'AnyTypeImpl',830);bcb(667,506,{105:1,92:1,90:1,56:1,49:1,97:1,2021:1,667:1},_8d);_._g=function a9d(a,b,c){switch(a){case 0:return this.a;case 1:return this.b;}return bid(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.lh=function b9d(a){switch(a){case 0:return this.a!=null;case 1:return this.b!=null;}return cid(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function c9d(a,b){switch(a){case 0:Z8d(this,GD(b));return;case 1:$8d(this,GD(b));return;}did(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function d9d(){return Q8d(),F8d};_.Bh=function e9d(a){switch(a){case 0:this.a=null;return;case 1:this.b=null;return;}eid(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.Ib=function f9d(){var a;if((this.j&4)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (data: ';Efb(a,this.a);a.a+=', target: ';Efb(a,this.b);a.a+=')';return a.a};_.a=null;_.b=null;var W9=mdb(Mwe,'ProcessingInstructionImpl',667);bcb(668,830,{105:1,92:1,90:1,56:1,49:1,97:1,843:1,2022:1,668:1},i9d);_._g=function j9d(a,b,c){switch(a){case 0:if(c)return !this.c&&(this.c=new u3d(this,0)),this.c;return !this.c&&(this.c=new u3d(this,0)),this.c.b;case 1:if(c)return !this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153);return (!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).kl();case 2:if(c)return !this.b&&(this.b=new u3d(this,2)),this.b;return !this.b&&(this.b=new u3d(this,2)),this.b.b;case 3:return !this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true));case 4:return j6d(this.a,(!this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true))));case 5:return this.a;}return bid(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.lh=function k9d(a){switch(a){case 0:return !!this.c&&this.c.i!=0;case 1:return !(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).dc();case 2:return !!this.b&&this.b.i!=0;case 3:return !this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true))!=null;case 4:return j6d(this.a,(!this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true))))!=null;case 5:return !!this.a;}return cid(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function l9d(a,b){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));d3d(this.c,b);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).Wb(b);return;case 2:!this.b&&(this.b=new u3d(this,2));d3d(this.b,b);return;case 3:h9d(this,GD(b));return;case 4:h9d(this,h6d(this.a,b));return;case 5:g9d(this,BD(b,148));return;}did(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function m9d(){return Q8d(),H8d};_.Bh=function n9d(a){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));Uxd(this.c);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).$b();return;case 2:!this.b&&(this.b=new u3d(this,2));Uxd(this.b);return;case 3:!this.c&&(this.c=new u3d(this,0));f3d(this.c,(Q8d(),I8d),null);return;case 4:h9d(this,h6d(this.a,null));return;case 5:this.a=null;return;}eid(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};var X9=mdb(Mwe,'SimpleAnyTypeImpl',668);bcb(669,506,{105:1,92:1,90:1,56:1,49:1,97:1,2023:1,669:1},o9d);_._g=function p9d(a,b,c){switch(a){case 0:if(c)return !this.a&&(this.a=new u3d(this,0)),this.a;return !this.a&&(this.a=new u3d(this,0)),this.a.b;case 1:return c?(!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1)),this.b):(!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1)),FAd(this.b));case 2:return c?(!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2)),this.c):(!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2)),FAd(this.c));case 3:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),L8d));case 4:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),M8d));case 5:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),O8d));case 6:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),P8d));}return bid(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.jh=function q9d(a,b,c){var d;switch(b){case 0:return !this.a&&(this.a=new u3d(this,0)),B2d(this.a,a,c);case 1:return !this.b&&(this.b=new dId((jGd(),fGd),x6,this,1)),bId(this.b,a,c);case 2:return !this.c&&(this.c=new dId((jGd(),fGd),x6,this,2)),bId(this.c,a,c);case 5:return !this.a&&(this.a=new u3d(this,0)),c7d(T2d(this.a,(Q8d(),O8d)),a,c);}return d=BD(XKd((this.j&2)==0?(Q8d(),K8d):(!this.k&&(this.k=new HGd),this.k).ck(),b),66),d.Nj().Rj(this,Aid(this),b-aLd((Q8d(),K8d)),a,c)};_.lh=function r9d(a){switch(a){case 0:return !!this.a&&this.a.i!=0;case 1:return !!this.b&&this.b.f!=0;case 2:return !!this.c&&this.c.f!=0;case 3:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),L8d)));case 4:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),M8d)));case 5:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),O8d)));case 6:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),P8d)));}return cid(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function s9d(a,b){switch(a){case 0:!this.a&&(this.a=new u3d(this,0));d3d(this.a,b);return;case 1:!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1));cId(this.b,b);return;case 2:!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2));cId(this.c,b);return;case 3:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),L8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,L8d),BD(b,14));return;case 4:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),M8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,M8d),BD(b,14));return;case 5:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),O8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,O8d),BD(b,14));return;case 6:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),P8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,P8d),BD(b,14));return;}did(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function t9d(){return Q8d(),K8d};_.Bh=function u9d(a){switch(a){case 0:!this.a&&(this.a=new u3d(this,0));Uxd(this.a);return;case 1:!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1));this.b.c.$b();return;case 2:!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2));this.c.c.$b();return;case 3:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),L8d)));return;case 4:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),M8d)));return;case 5:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),O8d)));return;case 6:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),P8d)));return;}eid(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.Ib=function v9d(){var a;if((this.j&4)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (mixed: ';Dfb(a,this.a);a.a+=')';return a.a};var Y9=mdb(Mwe,'XMLTypeDocumentRootImpl',669);bcb(1919,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1,2024:1},U9d);_.Ih=function V9d(a,b){switch(a.yj()){case 7:case 8:case 9:case 10:case 16:case 22:case 23:case 24:case 25:case 26:case 32:case 33:case 34:case 36:case 37:case 44:case 45:case 50:case 51:case 53:case 55:case 56:case 57:case 58:case 60:case 61:case 4:return b==null?null:fcb(b);case 19:case 28:case 29:case 35:case 38:case 39:case 41:case 46:case 52:case 54:case 5:return GD(b);case 6:return C9d(BD(b,190));case 12:case 47:case 49:case 11:return Vmd(this,a,b);case 13:return b==null?null:qgb(BD(b,240));case 15:case 14:return b==null?null:D9d(Edb(ED(b)));case 17:return E9d((Q8d(),b));case 18:return E9d(b);case 21:case 20:return b==null?null:F9d(BD(b,155).a);case 27:return G9d(BD(b,190));case 30:return H9d((Q8d(),BD(b,15)));case 31:return H9d(BD(b,15));case 40:return K9d((Q8d(),b));case 42:return I9d((Q8d(),b));case 43:return I9d(b);case 59:case 48:return J9d((Q8d(),b));default:throw vbb(new Wdb(tte+a.ne()+ute));}};_.Jh=function W9d(a){var b,c,d,e,f;switch(a.G==-1&&(a.G=(c=bKd(a),c?HLd(c.Mh(),a):-1)),a.G){case 0:return b=new R8d,b;case 1:return d=new _8d,d;case 2:return e=new i9d,e;case 3:return f=new o9d,f;default:throw vbb(new Wdb(xte+a.zb+ute));}};_.Kh=function X9d(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;switch(a.yj()){case 5:case 52:case 4:return b;case 6:return L9d(b);case 8:case 7:return b==null?null:B9d(b);case 9:return b==null?null:Scb(Icb((d=Qge(b,true),d.length>0&&(BCb(0,d.length),d.charCodeAt(0)==43)?d.substr(1):d),-128,127)<<24>>24);case 10:return b==null?null:Scb(Icb((e=Qge(b,true),e.length>0&&(BCb(0,e.length),e.charCodeAt(0)==43)?e.substr(1):e),-128,127)<<24>>24);case 11:return GD(Wmd(this,(Q8d(),w8d),b));case 12:return GD(Wmd(this,(Q8d(),x8d),b));case 13:return b==null?null:new tgb(Qge(b,true));case 15:case 14:return M9d(b);case 16:return GD(Wmd(this,(Q8d(),y8d),b));case 17:return N9d((Q8d(),b));case 18:return N9d(b);case 28:case 29:case 35:case 38:case 39:case 41:case 54:case 19:return Qge(b,true);case 21:case 20:return O9d(b);case 22:return GD(Wmd(this,(Q8d(),z8d),b));case 23:return GD(Wmd(this,(Q8d(),A8d),b));case 24:return GD(Wmd(this,(Q8d(),B8d),b));case 25:return GD(Wmd(this,(Q8d(),C8d),b));case 26:return GD(Wmd(this,(Q8d(),D8d),b));case 27:return P9d(b);case 30:return Q9d((Q8d(),b));case 31:return Q9d(b);case 32:return b==null?null:meb(Icb((k=Qge(b,true),k.length>0&&(BCb(0,k.length),k.charCodeAt(0)==43)?k.substr(1):k),Rie,Ohe));case 33:return b==null?null:new Ygb((l=Qge(b,true),l.length>0&&(BCb(0,l.length),l.charCodeAt(0)==43)?l.substr(1):l));case 34:return b==null?null:meb(Icb((m=Qge(b,true),m.length>0&&(BCb(0,m.length),m.charCodeAt(0)==43)?m.substr(1):m),Rie,Ohe));case 36:return b==null?null:Aeb(Jcb((n=Qge(b,true),n.length>0&&(BCb(0,n.length),n.charCodeAt(0)==43)?n.substr(1):n)));case 37:return b==null?null:Aeb(Jcb((o=Qge(b,true),o.length>0&&(BCb(0,o.length),o.charCodeAt(0)==43)?o.substr(1):o)));case 40:return T9d((Q8d(),b));case 42:return R9d((Q8d(),b));case 43:return R9d(b);case 44:return b==null?null:new Ygb((p=Qge(b,true),p.length>0&&(BCb(0,p.length),p.charCodeAt(0)==43)?p.substr(1):p));case 45:return b==null?null:new Ygb((q=Qge(b,true),q.length>0&&(BCb(0,q.length),q.charCodeAt(0)==43)?q.substr(1):q));case 46:return Qge(b,false);case 47:return GD(Wmd(this,(Q8d(),E8d),b));case 59:case 48:return S9d((Q8d(),b));case 49:return GD(Wmd(this,(Q8d(),G8d),b));case 50:return b==null?null:Web(Icb((r=Qge(b,true),r.length>0&&(BCb(0,r.length),r.charCodeAt(0)==43)?r.substr(1):r),awe,32767)<<16>>16);case 51:return b==null?null:Web(Icb((f=Qge(b,true),f.length>0&&(BCb(0,f.length),f.charCodeAt(0)==43)?f.substr(1):f),awe,32767)<<16>>16);case 53:return GD(Wmd(this,(Q8d(),J8d),b));case 55:return b==null?null:Web(Icb((g=Qge(b,true),g.length>0&&(BCb(0,g.length),g.charCodeAt(0)==43)?g.substr(1):g),awe,32767)<<16>>16);case 56:return b==null?null:Web(Icb((h=Qge(b,true),h.length>0&&(BCb(0,h.length),h.charCodeAt(0)==43)?h.substr(1):h),awe,32767)<<16>>16);case 57:return b==null?null:Aeb(Jcb((i=Qge(b,true),i.length>0&&(BCb(0,i.length),i.charCodeAt(0)==43)?i.substr(1):i)));case 58:return b==null?null:Aeb(Jcb((j=Qge(b,true),j.length>0&&(BCb(0,j.length),j.charCodeAt(0)==43)?j.substr(1):j)));case 60:return b==null?null:meb(Icb((c=Qge(b,true),c.length>0&&(BCb(0,c.length),c.charCodeAt(0)==43)?c.substr(1):c),Rie,Ohe));case 61:return b==null?null:meb(Icb(Qge(b,true),Rie,Ohe));default:throw vbb(new Wdb(tte+a.ne()+ute));}};var w9d,x9d,y9d,z9d;var Z9=mdb(Mwe,'XMLTypeFactoryImpl',1919);bcb(586,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1,1945:1,586:1},cae);_.N=false;_.O=false;var Z9d=false;var Yab=mdb(Mwe,'XMLTypePackageImpl',586);bcb(1852,1,{837:1},fae);_._j=function gae(){return Uge(),Tge};var iab=mdb(Mwe,'XMLTypePackageImpl/1',1852);bcb(1861,1,nwe,hae);_.wj=function iae(a){return ND(a)};_.xj=function jae(a){return KC(ZI,nie,2,a,6,1)};var $9=mdb(Mwe,'XMLTypePackageImpl/10',1861);bcb(1862,1,nwe,kae);_.wj=function lae(a){return ND(a)};_.xj=function mae(a){return KC(ZI,nie,2,a,6,1)};var _9=mdb(Mwe,'XMLTypePackageImpl/11',1862);bcb(1863,1,nwe,nae);_.wj=function oae(a){return ND(a)};_.xj=function pae(a){return KC(ZI,nie,2,a,6,1)};var aab=mdb(Mwe,'XMLTypePackageImpl/12',1863);bcb(1864,1,nwe,qae);_.wj=function rae(a){return LD(a)};_.xj=function sae(a){return KC(BI,nie,333,a,7,1)};var bab=mdb(Mwe,'XMLTypePackageImpl/13',1864);bcb(1865,1,nwe,tae);_.wj=function uae(a){return ND(a)};_.xj=function vae(a){return KC(ZI,nie,2,a,6,1)};var cab=mdb(Mwe,'XMLTypePackageImpl/14',1865);bcb(1866,1,nwe,wae);_.wj=function xae(a){return JD(a,15)};_.xj=function yae(a){return KC(yK,eme,15,a,0,1)};var dab=mdb(Mwe,'XMLTypePackageImpl/15',1866);bcb(1867,1,nwe,zae);_.wj=function Aae(a){return JD(a,15)};_.xj=function Bae(a){return KC(yK,eme,15,a,0,1)};var eab=mdb(Mwe,'XMLTypePackageImpl/16',1867);bcb(1868,1,nwe,Cae);_.wj=function Dae(a){return ND(a)};_.xj=function Eae(a){return KC(ZI,nie,2,a,6,1)};var fab=mdb(Mwe,'XMLTypePackageImpl/17',1868);bcb(1869,1,nwe,Fae);_.wj=function Gae(a){return JD(a,155)};_.xj=function Hae(a){return KC(FI,nie,155,a,0,1)};var gab=mdb(Mwe,'XMLTypePackageImpl/18',1869);bcb(1870,1,nwe,Iae);_.wj=function Jae(a){return ND(a)};_.xj=function Kae(a){return KC(ZI,nie,2,a,6,1)};var hab=mdb(Mwe,'XMLTypePackageImpl/19',1870);bcb(1853,1,nwe,Lae);_.wj=function Mae(a){return JD(a,843)};_.xj=function Nae(a){return KC(Q9,Uhe,843,a,0,1)};var tab=mdb(Mwe,'XMLTypePackageImpl/2',1853);bcb(1871,1,nwe,Oae);_.wj=function Pae(a){return ND(a)};_.xj=function Qae(a){return KC(ZI,nie,2,a,6,1)};var jab=mdb(Mwe,'XMLTypePackageImpl/20',1871);bcb(1872,1,nwe,Rae);_.wj=function Sae(a){return ND(a)};_.xj=function Tae(a){return KC(ZI,nie,2,a,6,1)};var kab=mdb(Mwe,'XMLTypePackageImpl/21',1872);bcb(1873,1,nwe,Uae);_.wj=function Vae(a){return ND(a)};_.xj=function Wae(a){return KC(ZI,nie,2,a,6,1)};var lab=mdb(Mwe,'XMLTypePackageImpl/22',1873);bcb(1874,1,nwe,Xae);_.wj=function Yae(a){return ND(a)};_.xj=function Zae(a){return KC(ZI,nie,2,a,6,1)};var mab=mdb(Mwe,'XMLTypePackageImpl/23',1874);bcb(1875,1,nwe,$ae);_.wj=function _ae(a){return JD(a,190)};_.xj=function abe(a){return KC(SD,nie,190,a,0,2)};var nab=mdb(Mwe,'XMLTypePackageImpl/24',1875);bcb(1876,1,nwe,bbe);_.wj=function cbe(a){return ND(a)};_.xj=function dbe(a){return KC(ZI,nie,2,a,6,1)};var oab=mdb(Mwe,'XMLTypePackageImpl/25',1876);bcb(1877,1,nwe,ebe);_.wj=function fbe(a){return ND(a)};_.xj=function gbe(a){return KC(ZI,nie,2,a,6,1)};var pab=mdb(Mwe,'XMLTypePackageImpl/26',1877);bcb(1878,1,nwe,hbe);_.wj=function ibe(a){return JD(a,15)};_.xj=function jbe(a){return KC(yK,eme,15,a,0,1)};var qab=mdb(Mwe,'XMLTypePackageImpl/27',1878);bcb(1879,1,nwe,kbe);_.wj=function lbe(a){return JD(a,15)};_.xj=function mbe(a){return KC(yK,eme,15,a,0,1)};var rab=mdb(Mwe,'XMLTypePackageImpl/28',1879);bcb(1880,1,nwe,nbe);_.wj=function obe(a){return ND(a)};_.xj=function pbe(a){return KC(ZI,nie,2,a,6,1)};var sab=mdb(Mwe,'XMLTypePackageImpl/29',1880);bcb(1854,1,nwe,qbe);_.wj=function rbe(a){return JD(a,667)};_.xj=function sbe(a){return KC(S9,Uhe,2021,a,0,1)};var Eab=mdb(Mwe,'XMLTypePackageImpl/3',1854);bcb(1881,1,nwe,tbe);_.wj=function ube(a){return JD(a,19)};_.xj=function vbe(a){return KC(JI,nie,19,a,0,1)};var uab=mdb(Mwe,'XMLTypePackageImpl/30',1881);bcb(1882,1,nwe,wbe);_.wj=function xbe(a){return ND(a)};_.xj=function ybe(a){return KC(ZI,nie,2,a,6,1)};var vab=mdb(Mwe,'XMLTypePackageImpl/31',1882);bcb(1883,1,nwe,zbe);_.wj=function Abe(a){return JD(a,162)};_.xj=function Bbe(a){return KC(MI,nie,162,a,0,1)};var wab=mdb(Mwe,'XMLTypePackageImpl/32',1883);bcb(1884,1,nwe,Cbe);_.wj=function Dbe(a){return ND(a)};_.xj=function Ebe(a){return KC(ZI,nie,2,a,6,1)};var xab=mdb(Mwe,'XMLTypePackageImpl/33',1884);bcb(1885,1,nwe,Fbe);_.wj=function Gbe(a){return ND(a)};_.xj=function Hbe(a){return KC(ZI,nie,2,a,6,1)};var yab=mdb(Mwe,'XMLTypePackageImpl/34',1885);bcb(1886,1,nwe,Ibe);_.wj=function Jbe(a){return ND(a)};_.xj=function Kbe(a){return KC(ZI,nie,2,a,6,1)};var zab=mdb(Mwe,'XMLTypePackageImpl/35',1886);bcb(1887,1,nwe,Lbe);_.wj=function Mbe(a){return ND(a)};_.xj=function Nbe(a){return KC(ZI,nie,2,a,6,1)};var Aab=mdb(Mwe,'XMLTypePackageImpl/36',1887);bcb(1888,1,nwe,Obe);_.wj=function Pbe(a){return JD(a,15)};_.xj=function Qbe(a){return KC(yK,eme,15,a,0,1)};var Bab=mdb(Mwe,'XMLTypePackageImpl/37',1888);bcb(1889,1,nwe,Rbe);_.wj=function Sbe(a){return JD(a,15)};_.xj=function Tbe(a){return KC(yK,eme,15,a,0,1)};var Cab=mdb(Mwe,'XMLTypePackageImpl/38',1889);bcb(1890,1,nwe,Ube);_.wj=function Vbe(a){return ND(a)};_.xj=function Wbe(a){return KC(ZI,nie,2,a,6,1)};var Dab=mdb(Mwe,'XMLTypePackageImpl/39',1890);bcb(1855,1,nwe,Xbe);_.wj=function Ybe(a){return JD(a,668)};_.xj=function Zbe(a){return KC(T9,Uhe,2022,a,0,1)};var Pab=mdb(Mwe,'XMLTypePackageImpl/4',1855);bcb(1891,1,nwe,$be);_.wj=function _be(a){return ND(a)};_.xj=function ace(a){return KC(ZI,nie,2,a,6,1)};var Fab=mdb(Mwe,'XMLTypePackageImpl/40',1891);bcb(1892,1,nwe,bce);_.wj=function cce(a){return ND(a)};_.xj=function dce(a){return KC(ZI,nie,2,a,6,1)};var Gab=mdb(Mwe,'XMLTypePackageImpl/41',1892);bcb(1893,1,nwe,ece);_.wj=function fce(a){return ND(a)};_.xj=function gce(a){return KC(ZI,nie,2,a,6,1)};var Hab=mdb(Mwe,'XMLTypePackageImpl/42',1893);bcb(1894,1,nwe,hce);_.wj=function ice(a){return ND(a)};_.xj=function jce(a){return KC(ZI,nie,2,a,6,1)};var Iab=mdb(Mwe,'XMLTypePackageImpl/43',1894);bcb(1895,1,nwe,kce);_.wj=function lce(a){return ND(a)};_.xj=function mce(a){return KC(ZI,nie,2,a,6,1)};var Jab=mdb(Mwe,'XMLTypePackageImpl/44',1895);bcb(1896,1,nwe,nce);_.wj=function oce(a){return JD(a,184)};_.xj=function pce(a){return KC(UI,nie,184,a,0,1)};var Kab=mdb(Mwe,'XMLTypePackageImpl/45',1896);bcb(1897,1,nwe,qce);_.wj=function rce(a){return ND(a)};_.xj=function sce(a){return KC(ZI,nie,2,a,6,1)};var Lab=mdb(Mwe,'XMLTypePackageImpl/46',1897);bcb(1898,1,nwe,tce);_.wj=function uce(a){return ND(a)};_.xj=function vce(a){return KC(ZI,nie,2,a,6,1)};var Mab=mdb(Mwe,'XMLTypePackageImpl/47',1898);bcb(1899,1,nwe,wce);_.wj=function xce(a){return ND(a)};_.xj=function yce(a){return KC(ZI,nie,2,a,6,1)};var Nab=mdb(Mwe,'XMLTypePackageImpl/48',1899);bcb(nje,1,nwe,zce);_.wj=function Ace(a){return JD(a,184)};_.xj=function Bce(a){return KC(UI,nie,184,a,0,1)};var Oab=mdb(Mwe,'XMLTypePackageImpl/49',nje);bcb(1856,1,nwe,Cce);_.wj=function Dce(a){return JD(a,669)};_.xj=function Ece(a){return KC(U9,Uhe,2023,a,0,1)};var Tab=mdb(Mwe,'XMLTypePackageImpl/5',1856);bcb(1901,1,nwe,Fce);_.wj=function Gce(a){return JD(a,162)};_.xj=function Hce(a){return KC(MI,nie,162,a,0,1)};var Qab=mdb(Mwe,'XMLTypePackageImpl/50',1901);bcb(1902,1,nwe,Ice);_.wj=function Jce(a){return ND(a)};_.xj=function Kce(a){return KC(ZI,nie,2,a,6,1)};var Rab=mdb(Mwe,'XMLTypePackageImpl/51',1902);bcb(1903,1,nwe,Lce);_.wj=function Mce(a){return JD(a,19)};_.xj=function Nce(a){return KC(JI,nie,19,a,0,1)};var Sab=mdb(Mwe,'XMLTypePackageImpl/52',1903);bcb(1857,1,nwe,Oce);_.wj=function Pce(a){return ND(a)};_.xj=function Qce(a){return KC(ZI,nie,2,a,6,1)};var Uab=mdb(Mwe,'XMLTypePackageImpl/6',1857);bcb(1858,1,nwe,Rce);_.wj=function Sce(a){return JD(a,190)};_.xj=function Tce(a){return KC(SD,nie,190,a,0,2)};var Vab=mdb(Mwe,'XMLTypePackageImpl/7',1858);bcb(1859,1,nwe,Uce);_.wj=function Vce(a){return KD(a)};_.xj=function Wce(a){return KC(wI,nie,476,a,8,1)};var Wab=mdb(Mwe,'XMLTypePackageImpl/8',1859);bcb(1860,1,nwe,Xce);_.wj=function Yce(a){return JD(a,217)};_.xj=function Zce(a){return KC(xI,nie,217,a,0,1)};var Xab=mdb(Mwe,'XMLTypePackageImpl/9',1860);var $ce,_ce;var fde,gde;var kde;bcb(50,60,Tie,mde);var Zab=mdb(kxe,'RegEx/ParseException',50);bcb(820,1,{},ude);_.sl=function vde(a){return ac*16)throw vbb(new mde(tvd((h0d(),Uue))));c=c*16+e}while(true);if(this.a!=125)throw vbb(new mde(tvd((h0d(),Vue))));if(c>lxe)throw vbb(new mde(tvd((h0d(),Wue))));a=c}else{e=0;if(this.c!=0||(e=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));c=e;nde(this);if(this.c!=0||(e=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));c=c*16+e;a=c}break;case 117:d=0;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;a=b;break;case 118:nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;if(b>lxe)throw vbb(new mde(tvd((h0d(),'parser.descappe.4'))));a=b;break;case 65:case 90:case 122:throw vbb(new mde(tvd((h0d(),Xue))));}return a};_.ul=function xde(a){var b,c;switch(a){case 100:c=(this.e&32)==32?Kfe('Nd',true):(wfe(),cfe);break;case 68:c=(this.e&32)==32?Kfe('Nd',false):(wfe(),jfe);break;case 119:c=(this.e&32)==32?Kfe('IsWord',true):(wfe(),sfe);break;case 87:c=(this.e&32)==32?Kfe('IsWord',false):(wfe(),lfe);break;case 115:c=(this.e&32)==32?Kfe('IsSpace',true):(wfe(),nfe);break;case 83:c=(this.e&32)==32?Kfe('IsSpace',false):(wfe(),kfe);break;default:throw vbb(new hz((b=a,mxe+b.toString(16))));}return c};_.vl=function zde(a){var b,c,d,e,f,g,h,i,j,k,l,m;this.b=1;nde(this);b=null;if(this.c==0&&this.a==94){nde(this);if(a){k=(wfe(),wfe(),++vfe,new $fe(5))}else{b=(wfe(),wfe(),++vfe,new $fe(4));Ufe(b,0,lxe);k=(null,++vfe,new $fe(4))}}else{k=(wfe(),wfe(),++vfe,new $fe(4))}e=true;while((m=this.c)!=1){if(m==0&&this.a==93&&!e)break;e=false;c=this.a;d=false;if(m==10){switch(c){case 100:case 68:case 119:case 87:case 115:case 83:Xfe(k,this.ul(c));d=true;break;case 105:case 73:case 99:case 67:c=this.Ll(k,c);c<0&&(d=true);break;case 112:case 80:l=tde(this,c);if(!l)throw vbb(new mde(tvd((h0d(),Iue))));Xfe(k,l);d=true;break;default:c=this.tl();}}else if(m==20){g=gfb(this.i,58,this.d);if(g<0)throw vbb(new mde(tvd((h0d(),Jue))));h=true;if(bfb(this.i,this.d)==94){++this.d;h=false}f=qfb(this.i,this.d,g);i=Lfe(f,h,(this.e&512)==512);if(!i)throw vbb(new mde(tvd((h0d(),Lue))));Xfe(k,i);d=true;if(g+1>=this.j||bfb(this.i,g+1)!=93)throw vbb(new mde(tvd((h0d(),Jue))));this.d=g+2}nde(this);if(!d){if(this.c!=0||this.a!=45){Ufe(k,c,c)}else{nde(this);if((m=this.c)==1)throw vbb(new mde(tvd((h0d(),Kue))));if(m==0&&this.a==93){Ufe(k,c,c);Ufe(k,45,45)}else{j=this.a;m==10&&(j=this.tl());nde(this);Ufe(k,c,j)}}}(this.e&zte)==zte&&this.c==0&&this.a==44&&nde(this)}if(this.c==1)throw vbb(new mde(tvd((h0d(),Kue))));if(b){Zfe(b,k);k=b}Yfe(k);Vfe(k);this.b=0;nde(this);return k};_.wl=function Ade(){var a,b,c,d;c=this.vl(false);while((d=this.c)!=7){a=this.a;if(d==0&&(a==45||a==38)||d==4){nde(this);if(this.c!=9)throw vbb(new mde(tvd((h0d(),Que))));b=this.vl(false);if(d==4)Xfe(c,b);else if(a==45)Zfe(c,b);else if(a==38)Wfe(c,b);else throw vbb(new hz('ASSERT'))}else{throw vbb(new mde(tvd((h0d(),Rue))))}}nde(this);return c};_.xl=function Bde(){var a,b;a=this.a-48;b=(wfe(),wfe(),++vfe,new Hge(12,null,a));!this.g&&(this.g=new Wvb);Tvb(this.g,new cge(a));nde(this);return b};_.yl=function Cde(){nde(this);return wfe(),ofe};_.zl=function Dde(){nde(this);return wfe(),mfe};_.Al=function Ede(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Bl=function Fde(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Cl=function Gde(){nde(this);return Ife()};_.Dl=function Hde(){nde(this);return wfe(),qfe};_.El=function Ide(){nde(this);return wfe(),tfe};_.Fl=function Jde(){var a;if(this.d>=this.j||((a=bfb(this.i,this.d++))&65504)!=64)throw vbb(new mde(tvd((h0d(),Eue))));nde(this);return wfe(),wfe(),++vfe,new ige(0,a-64)};_.Gl=function Kde(){nde(this);return Jfe()};_.Hl=function Lde(){nde(this);return wfe(),ufe};_.Il=function Mde(){var a;a=(wfe(),wfe(),++vfe,new ige(0,105));nde(this);return a};_.Jl=function Nde(){nde(this);return wfe(),rfe};_.Kl=function Ode(){nde(this);return wfe(),pfe};_.Ll=function Pde(a,b){return this.tl()};_.Ml=function Qde(){nde(this);return wfe(),hfe};_.Nl=function Rde(){var a,b,c,d,e;if(this.d+1>=this.j)throw vbb(new mde(tvd((h0d(),Bue))));d=-1;b=null;a=bfb(this.i,this.d);if(49<=a&&a<=57){d=a-48;!this.g&&(this.g=new Wvb);Tvb(this.g,new cge(d));++this.d;if(bfb(this.i,this.d)!=41)throw vbb(new mde(tvd((h0d(),yue))));++this.d}else{a==63&&--this.d;nde(this);b=qde(this);switch(b.e){case 20:case 21:case 22:case 23:break;case 8:if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));break;default:throw vbb(new mde(tvd((h0d(),Cue))));}}nde(this);e=rde(this);c=null;if(e.e==2){if(e.em()!=2)throw vbb(new mde(tvd((h0d(),Due))));c=e.am(1);e=e.am(0)}if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return wfe(),wfe(),++vfe,new vge(d,b,e,c)};_.Ol=function Sde(){nde(this);return wfe(),ife};_.Pl=function Tde(){var a;nde(this);a=Cfe(24,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Ql=function Ude(){var a;nde(this);a=Cfe(20,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Rl=function Vde(){var a;nde(this);a=Cfe(22,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Sl=function Wde(){var a,b,c,d,e;a=0;c=0;b=-1;while(this.d=this.j)throw vbb(new mde(tvd((h0d(),zue))));if(b==45){++this.d;while(this.d=this.j)throw vbb(new mde(tvd((h0d(),zue))))}if(b==58){++this.d;nde(this);d=Dfe(rde(this),a,c);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this)}else if(b==41){++this.d;nde(this);d=Dfe(rde(this),a,c)}else throw vbb(new mde(tvd((h0d(),Aue))));return d};_.Tl=function Xde(){var a;nde(this);a=Cfe(21,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Ul=function Yde(){var a;nde(this);a=Cfe(23,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Vl=function Zde(){var a,b;nde(this);a=this.f++;b=Efe(rde(this),a);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return b};_.Wl=function $de(){var a;nde(this);a=Efe(rde(this),0);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Xl=function _de(a){nde(this);if(this.c==5){nde(this);return Bfe(a,(wfe(),wfe(),++vfe,new lge(9,a)))}else return Bfe(a,(wfe(),wfe(),++vfe,new lge(3,a)))};_.Yl=function aee(a){var b;nde(this);b=(wfe(),wfe(),++vfe,new Lge(2));if(this.c==5){nde(this);Kge(b,(null,ffe));Kge(b,a)}else{Kge(b,a);Kge(b,(null,ffe))}return b};_.Zl=function bee(a){nde(this);if(this.c==5){nde(this);return wfe(),wfe(),++vfe,new lge(9,a)}else return wfe(),wfe(),++vfe,new lge(3,a)};_.a=0;_.b=0;_.c=0;_.d=0;_.e=0;_.f=1;_.g=null;_.j=0;var bbb=mdb(kxe,'RegEx/RegexParser',820);bcb(1824,820,{},hee);_.sl=function iee(a){return false};_.tl=function jee(){return eee(this)};_.ul=function lee(a){return fee(a)};_.vl=function mee(a){return gee(this)};_.wl=function nee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.xl=function oee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.yl=function pee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.zl=function qee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Al=function ree(){nde(this);return fee(67)};_.Bl=function see(){nde(this);return fee(73)};_.Cl=function tee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Dl=function uee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.El=function vee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Fl=function wee(){nde(this);return fee(99)};_.Gl=function xee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Hl=function yee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Il=function zee(){nde(this);return fee(105)};_.Jl=function Aee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Kl=function Bee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ll=function Cee(a,b){return Xfe(a,fee(b)),-1};_.Ml=function Dee(){nde(this);return wfe(),wfe(),++vfe,new ige(0,94)};_.Nl=function Eee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ol=function Fee(){nde(this);return wfe(),wfe(),++vfe,new ige(0,36)};_.Pl=function Gee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ql=function Hee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Rl=function Iee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Sl=function Jee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Tl=function Kee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ul=function Lee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Vl=function Mee(){var a;nde(this);a=Efe(rde(this),0);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Wl=function Nee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Xl=function Oee(a){nde(this);return Bfe(a,(wfe(),wfe(),++vfe,new lge(3,a)))};_.Yl=function Pee(a){var b;nde(this);b=(wfe(),wfe(),++vfe,new Lge(2));Kge(b,a);Kge(b,(null,ffe));return b};_.Zl=function Qee(a){nde(this);return wfe(),wfe(),++vfe,new lge(3,a)};var cee=null,dee=null;var $ab=mdb(kxe,'RegEx/ParserForXMLSchema',1824);bcb(117,1,yxe,xfe);_.$l=function yfe(a){throw vbb(new hz('Not supported.'))};_._l=function Gfe(){return -1};_.am=function Hfe(a){return null};_.bm=function Mfe(){return null};_.cm=function Pfe(a){};_.dm=function Qfe(a){};_.em=function Rfe(){return 0};_.Ib=function Sfe(){return this.fm(0)};_.fm=function Tfe(a){return this.e==11?'.':''};_.e=0;var Yee,Zee,$ee,_ee,afe,bfe=null,cfe,dfe=null,efe,ffe,gfe=null,hfe,ife,jfe,kfe,lfe,mfe,nfe,ofe,pfe,qfe,rfe,sfe,tfe,ufe,vfe=0;var lbb=mdb(kxe,'RegEx/Token',117);bcb(136,117,{3:1,136:1,117:1},$fe);_.fm=function bge(a){var b,c,d;if(this.e==4){if(this==efe)c='.';else if(this==cfe)c='\\d';else if(this==sfe)c='\\w';else if(this==nfe)c='\\s';else{d=new Hfb;d.a+='[';for(b=0;b0&&(d.a+=',',d);if(this.b[b]===this.b[b+1]){Efb(d,age(this.b[b]))}else{Efb(d,age(this.b[b]));d.a+='-';Efb(d,age(this.b[b+1]))}}d.a+=']';c=d.a}}else{if(this==jfe)c='\\D';else if(this==lfe)c='\\W';else if(this==kfe)c='\\S';else{d=new Hfb;d.a+='[^';for(b=0;b0&&(d.a+=',',d);if(this.b[b]===this.b[b+1]){Efb(d,age(this.b[b]))}else{Efb(d,age(this.b[b]));d.a+='-';Efb(d,age(this.b[b+1]))}}d.a+=']';c=d.a}}return c};_.a=false;_.c=false;var _ab=mdb(kxe,'RegEx/RangeToken',136);bcb(584,1,{584:1},cge);_.a=0;var abb=mdb(kxe,'RegEx/RegexParser/ReferencePosition',584);bcb(583,1,{3:1,583:1},ege);_.Fb=function fge(a){var b;if(a==null)return false;if(!JD(a,583))return false;b=BD(a,583);return dfb(this.b,b.b)&&this.a==b.a};_.Hb=function gge(){return LCb(this.b+'/'+See(this.a))};_.Ib=function hge(){return this.c.fm(this.a)};_.a=0;var cbb=mdb(kxe,'RegEx/RegularExpression',583);bcb(223,117,yxe,ige);_._l=function jge(){return this.a};_.fm=function kge(a){var b,c,d;switch(this.e){case 0:switch(this.a){case 124:case 42:case 43:case 63:case 40:case 41:case 46:case 91:case 123:case 92:d='\\'+HD(this.a&aje);break;case 12:d='\\f';break;case 10:d='\\n';break;case 13:d='\\r';break;case 9:d='\\t';break;case 27:d='\\e';break;default:if(this.a>=Tje){c=(b=this.a>>>0,'0'+b.toString(16));d='\\v'+qfb(c,c.length-6,c.length)}else d=''+HD(this.a&aje);}break;case 8:this==hfe||this==ife?(d=''+HD(this.a&aje)):(d='\\'+HD(this.a&aje));break;default:d=null;}return d};_.a=0;var dbb=mdb(kxe,'RegEx/Token/CharToken',223);bcb(309,117,yxe,lge);_.am=function mge(a){return this.a};_.cm=function nge(a){this.b=a};_.dm=function oge(a){this.c=a};_.em=function pge(){return 1};_.fm=function qge(a){var b;if(this.e==3){if(this.c<0&&this.b<0){b=this.a.fm(a)+'*'}else if(this.c==this.b){b=this.a.fm(a)+'{'+this.c+'}'}else if(this.c>=0&&this.b>=0){b=this.a.fm(a)+'{'+this.c+','+this.b+'}'}else if(this.c>=0&&this.b<0){b=this.a.fm(a)+'{'+this.c+',}'}else throw vbb(new hz('Token#toString(): CLOSURE '+this.c+She+this.b))}else{if(this.c<0&&this.b<0){b=this.a.fm(a)+'*?'}else if(this.c==this.b){b=this.a.fm(a)+'{'+this.c+'}?'}else if(this.c>=0&&this.b>=0){b=this.a.fm(a)+'{'+this.c+','+this.b+'}?'}else if(this.c>=0&&this.b<0){b=this.a.fm(a)+'{'+this.c+',}?'}else throw vbb(new hz('Token#toString(): NONGREEDYCLOSURE '+this.c+She+this.b))}return b};_.b=0;_.c=0;var ebb=mdb(kxe,'RegEx/Token/ClosureToken',309);bcb(821,117,yxe,rge);_.am=function sge(a){return a==0?this.a:this.b};_.em=function tge(){return 2};_.fm=function uge(a){var b;this.b.e==3&&this.b.am(0)==this.a?(b=this.a.fm(a)+'+'):this.b.e==9&&this.b.am(0)==this.a?(b=this.a.fm(a)+'+?'):(b=this.a.fm(a)+(''+this.b.fm(a)));return b};var fbb=mdb(kxe,'RegEx/Token/ConcatToken',821);bcb(1822,117,yxe,vge);_.am=function wge(a){if(a==0)return this.d;if(a==1)return this.b;throw vbb(new hz('Internal Error: '+a))};_.em=function xge(){return !this.b?1:2};_.fm=function yge(a){var b;this.c>0?(b='(?('+this.c+')'):this.a.e==8?(b='(?('+this.a+')'):(b='(?'+this.a);!this.b?(b+=this.d+')'):(b+=this.d+'|'+this.b+')');return b};_.c=0;var gbb=mdb(kxe,'RegEx/Token/ConditionToken',1822);bcb(1823,117,yxe,zge);_.am=function Age(a){return this.b};_.em=function Bge(){return 1};_.fm=function Cge(a){return '(?'+(this.a==0?'':See(this.a))+(this.c==0?'':See(this.c))+':'+this.b.fm(a)+')'};_.a=0;_.c=0;var hbb=mdb(kxe,'RegEx/Token/ModifierToken',1823);bcb(822,117,yxe,Dge);_.am=function Ege(a){return this.a};_.em=function Fge(){return 1};_.fm=function Gge(a){var b;b=null;switch(this.e){case 6:this.b==0?(b='(?:'+this.a.fm(a)+')'):(b='('+this.a.fm(a)+')');break;case 20:b='(?='+this.a.fm(a)+')';break;case 21:b='(?!'+this.a.fm(a)+')';break;case 22:b='(?<='+this.a.fm(a)+')';break;case 23:b='(?'+this.a.fm(a)+')';}return b};_.b=0;var ibb=mdb(kxe,'RegEx/Token/ParenToken',822);bcb(521,117,{3:1,117:1,521:1},Hge);_.bm=function Ige(){return this.b};_.fm=function Jge(a){return this.e==12?'\\'+this.a:Wee(this.b)};_.a=0;var jbb=mdb(kxe,'RegEx/Token/StringToken',521);bcb(465,117,yxe,Lge);_.$l=function Mge(a){Kge(this,a)};_.am=function Nge(a){return BD(Uvb(this.a,a),117)};_.em=function Oge(){return !this.a?0:this.a.a.c.length};_.fm=function Pge(a){var b,c,d,e,f;if(this.e==1){if(this.a.a.c.length==2){b=BD(Uvb(this.a,0),117);c=BD(Uvb(this.a,1),117);c.e==3&&c.am(0)==b?(e=b.fm(a)+'+'):c.e==9&&c.am(0)==b?(e=b.fm(a)+'+?'):(e=b.fm(a)+(''+c.fm(a)))}else{f=new Hfb;for(d=0;d=this.c.b:this.a<=this.c.b};_.Sb=function whe(){return this.b>0};_.Tb=function yhe(){return this.b};_.Vb=function Ahe(){return this.b-1};_.Qb=function Bhe(){throw vbb(new cgb(Exe))};_.a=0;_.b=0;var pbb=mdb(Bxe,'ExclusiveRange/RangeIterator',254);var TD=pdb(Fve,'C');var WD=pdb(Ive,'I');var sbb=pdb(Khe,'Z');var XD=pdb(Jve,'J');var SD=pdb(Eve,'B');var UD=pdb(Gve,'D');var VD=pdb(Hve,'F');var rbb=pdb(Kve,'S');var h1=odb('org.eclipse.elk.core.labels','ILabelManager');var O4=odb(Tte,'DiagnosticChain');var u8=odb(pwe,'ResourceSet');var V4=mdb(Tte,'InvocationTargetException',null);var Ihe=(Az(),Dz);var gwtOnLoad=gwtOnLoad=Zbb;Xbb(hcb);$bb('permProps',[[[Fxe,Gxe],[Hxe,'gecko1_8']],[[Fxe,Gxe],[Hxe,'ie10']],[[Fxe,Gxe],[Hxe,'ie8']],[[Fxe,Gxe],[Hxe,'ie9']],[[Fxe,Gxe],[Hxe,'safari']]]); +// -------------- RUN GWT INITIALIZATION CODE -------------- +gwtOnLoad(null, 'elk', null); + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],3:[function(require,module,exports){ +'use strict'; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/******************************************************************************* + * Copyright (c) 2021 Kiel University and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +var ELK = require('./elk-api.js').default; + +var ELKNode = function (_ELK) { + _inherits(ELKNode, _ELK); + + function ELKNode() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, ELKNode); + + var optionsClone = Object.assign({}, options); + + var workerThreadsExist = false; + try { + require.resolve('web-worker'); + workerThreadsExist = true; + } catch (e) {} + + // user requested a worker + if (options.workerUrl) { + if (workerThreadsExist) { + var Worker = require('web-worker'); + optionsClone.workerFactory = function (url) { + return new Worker(url); + }; + } else { + console.warn('Web worker requested but \'web-worker\' package not installed. \nConsider installing the package or pass your own \'workerFactory\' to ELK\'s constructor.\n... Falling back to non-web worker version.'); + } + } + + // unless no other workerFactory is registered, use the fake worker + if (!optionsClone.workerFactory) { + var _require = require('./elk-worker.min.js'), + _Worker = _require.Worker; + + optionsClone.workerFactory = function (url) { + return new _Worker(url); + }; + } + + return _possibleConstructorReturn(this, (ELKNode.__proto__ || Object.getPrototypeOf(ELKNode)).call(this, optionsClone)); + } + + return ELKNode; +}(ELK); + +Object.defineProperty(module.exports, "__esModule", { + value: true +}); +module.exports = ELKNode; +ELKNode.default = ELKNode; +},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(require,module,exports){ +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module.exports = Worker; +},{}]},{},[3])(3) +}); + + +/***/ }), + +/***/ 83209: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "diagram": () => (/* binding */ diagram) +/* harmony export */ }); +/* harmony import */ var _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99794); +/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59373); +/* harmony import */ var dagre_d3_es_src_dagre_js_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(43349); +/* harmony import */ var elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17295); +/* harmony import */ var elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30381); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17967); +/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(20683); +/* harmony import */ var dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(70277); +/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(45625); +/* harmony import */ var dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(39354); +/* harmony import */ var dagre_d3_es__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91518); + + + + + + + + + + + + + + + + + + + + +const findCommonAncestor = (id1, id2, treeData) => { + const { parentById } = treeData; + const visited = /* @__PURE__ */ new Set(); + let currentId = id1; + while (currentId) { + visited.add(currentId); + if (currentId === id2) { + return currentId; + } + currentId = parentById[currentId]; + } + currentId = id2; + while (currentId) { + if (visited.has(currentId)) { + return currentId; + } + currentId = parentById[currentId]; + } + return "root"; +}; +const elk = new (elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1___default())(); +const portPos = {}; +const conf = {}; +let nodeDb = {}; +const addVertices = function(vert, svgId, root, doc, diagObj, parentLookupDb, graph) { + const svg = root.select(`[id="${svgId}"]`); + const nodes = svg.insert("g").attr("class", "nodes"); + const keys = Object.keys(vert); + keys.forEach(function(id) { + const vertex = vert[id]; + let classStr = "default"; + if (vertex.classes.length > 0) { + classStr = vertex.classes.join(" "); + } + const styles2 = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.a)(vertex.styles); + let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id; + let vertexNode; + const labelData = { width: 0, height: 0 }; + if ((0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.e)((0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.g)().flowchart.htmlLabels)) { + const node2 = { + label: vertexText.replace( + /fa[blrs]?:fa-[\w-]+/g, + (s) => `` + ) + }; + vertexNode = (0,dagre_d3_es_src_dagre_js_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_10__/* .addHtmlLabel */ .a)(svg, node2).node(); + const bbox = vertexNode.getBBox(); + labelData.width = bbox.width; + labelData.height = bbox.height; + labelData.labelNode = vertexNode; + vertexNode.parentNode.removeChild(vertexNode); + } else { + const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text"); + svgLabel.setAttribute("style", styles2.labelStyle.replace("color:", "fill:")); + const rows = vertexText.split(_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.c.lineBreakRegex); + for (const row of rows) { + const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan"); + tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"); + tspan.setAttribute("dy", "1em"); + tspan.setAttribute("x", "1"); + tspan.textContent = row; + svgLabel.appendChild(tspan); + } + vertexNode = svgLabel; + const bbox = vertexNode.getBBox(); + labelData.width = bbox.width; + labelData.height = bbox.height; + labelData.labelNode = vertexNode; + } + const ports = [ + { + id: vertex.id + "-west", + layoutOptions: { + "port.side": "WEST" + } + }, + { + id: vertex.id + "-east", + layoutOptions: { + "port.side": "EAST" + } + }, + { + id: vertex.id + "-south", + layoutOptions: { + "port.side": "SOUTH" + } + }, + { + id: vertex.id + "-north", + layoutOptions: { + "port.side": "NORTH" + } + } + ]; + let radious = 0; + let _shape = ""; + let layoutOptions = {}; + switch (vertex.type) { + case "round": + radious = 5; + _shape = "rect"; + break; + case "square": + _shape = "rect"; + break; + case "diamond": + _shape = "question"; + layoutOptions = { + portConstraints: "FIXED_SIDE" + }; + break; + case "hexagon": + _shape = "hexagon"; + break; + case "odd": + _shape = "rect_left_inv_arrow"; + break; + case "lean_right": + _shape = "lean_right"; + break; + case "lean_left": + _shape = "lean_left"; + break; + case "trapezoid": + _shape = "trapezoid"; + break; + case "inv_trapezoid": + _shape = "inv_trapezoid"; + break; + case "odd_right": + _shape = "rect_left_inv_arrow"; + break; + case "circle": + _shape = "circle"; + break; + case "ellipse": + _shape = "ellipse"; + break; + case "stadium": + _shape = "stadium"; + break; + case "subroutine": + _shape = "subroutine"; + break; + case "cylinder": + _shape = "cylinder"; + break; + case "group": + _shape = "rect"; + break; + case "doublecircle": + _shape = "doublecircle"; + break; + default: + _shape = "rect"; + } + const node = { + labelStyle: styles2.labelStyle, + shape: _shape, + labelText: vertexText, + rx: radious, + ry: radious, + class: classStr, + style: styles2.style, + id: vertex.id, + link: vertex.link, + linkTarget: vertex.linkTarget, + tooltip: diagObj.db.getTooltip(vertex.id) || "", + domId: diagObj.db.lookUpDomId(vertex.id), + haveCallback: vertex.haveCallback, + width: vertex.type === "group" ? 500 : void 0, + dir: vertex.dir, + type: vertex.type, + props: vertex.props, + padding: (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.g)().flowchart.padding + }; + let boundingBox; + let nodeEl; + if (node.type !== "group") { + nodeEl = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.b)(nodes, node, vertex.dir); + boundingBox = nodeEl.node().getBBox(); + } + const data = { + id: vertex.id, + ports: vertex.type === "diamond" ? ports : [], + layoutOptions, + labelText: vertexText, + labelData, + domId: diagObj.db.lookUpDomId(vertex.id), + width: boundingBox == null ? void 0 : boundingBox.width, + height: boundingBox == null ? void 0 : boundingBox.height, + type: vertex.type, + el: nodeEl, + parent: parentLookupDb.parentById[vertex.id] + }; + nodeDb[node.id] = data; + }); + return graph; +}; +const getNextPosition = (position, edgeDirection, graphDirection) => { + const portPos2 = { + TB: { + in: { + north: "north" + }, + out: { + south: "west", + west: "east", + east: "south" + } + }, + LR: { + in: { + west: "west" + }, + out: { + east: "south", + south: "north", + north: "east" + } + }, + RL: { + in: { + east: "east" + }, + out: { + west: "north", + north: "south", + south: "west" + } + }, + BT: { + in: { + south: "south" + }, + out: { + north: "east", + east: "west", + west: "north" + } + } + }; + portPos2.TD = portPos2.TB; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("abc88", graphDirection, edgeDirection, position); + return portPos2[graphDirection][edgeDirection][position]; +}; +const getNextPort = (node, edgeDirection, graphDirection) => { + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("getNextPort abc88", { node, edgeDirection, graphDirection }); + if (!portPos[node]) { + switch (graphDirection) { + case "TB": + case "TD": + portPos[node] = { + inPosition: "north", + outPosition: "south" + }; + break; + case "BT": + portPos[node] = { + inPosition: "south", + outPosition: "north" + }; + break; + case "RL": + portPos[node] = { + inPosition: "east", + outPosition: "west" + }; + break; + case "LR": + portPos[node] = { + inPosition: "west", + outPosition: "east" + }; + break; + } + } + const result = edgeDirection === "in" ? portPos[node].inPosition : portPos[node].outPosition; + if (edgeDirection === "in") { + portPos[node].inPosition = getNextPosition( + portPos[node].inPosition, + edgeDirection, + graphDirection + ); + } else { + portPos[node].outPosition = getNextPosition( + portPos[node].outPosition, + edgeDirection, + graphDirection + ); + } + return result; +}; +const getEdgeStartEndPoint = (edge, dir) => { + let source = edge.start; + let target = edge.end; + const startNode = nodeDb[source]; + const endNode = nodeDb[target]; + if (!startNode || !endNode) { + return { source, target }; + } + if (startNode.type === "diamond") { + source = `${source}-${getNextPort(source, "out", dir)}`; + } + if (endNode.type === "diamond") { + target = `${target}-${getNextPort(target, "in", dir)}`; + } + return { source, target }; +}; +const addEdges = function(edges, diagObj, graph, svg) { + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("abc78 edges = ", edges); + const labelsEl = svg.insert("g").attr("class", "edgeLabels"); + let linkIdCnt = {}; + let dir = diagObj.db.getDirection(); + let defaultStyle; + let defaultLabelStyle; + if (edges.defaultStyle !== void 0) { + const defaultStyles = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.a)(edges.defaultStyle); + defaultStyle = defaultStyles.style; + defaultLabelStyle = defaultStyles.labelStyle; + } + edges.forEach(function(edge) { + var linkIdBase = "L-" + edge.start + "-" + edge.end; + if (linkIdCnt[linkIdBase] === void 0) { + linkIdCnt[linkIdBase] = 0; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]); + } else { + linkIdCnt[linkIdBase]++; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]); + } + let linkId = linkIdBase + "-" + linkIdCnt[linkIdBase]; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("abc78 new link id to be used is", linkIdBase, linkId, linkIdCnt[linkIdBase]); + var linkNameStart = "LS-" + edge.start; + var linkNameEnd = "LE-" + edge.end; + const edgeData = { style: "", labelStyle: "" }; + edgeData.minlen = edge.length || 1; + if (edge.type === "arrow_open") { + edgeData.arrowhead = "none"; + } else { + edgeData.arrowhead = "normal"; + } + edgeData.arrowTypeStart = "arrow_open"; + edgeData.arrowTypeEnd = "arrow_open"; + switch (edge.type) { + case "double_arrow_cross": + edgeData.arrowTypeStart = "arrow_cross"; + case "arrow_cross": + edgeData.arrowTypeEnd = "arrow_cross"; + break; + case "double_arrow_point": + edgeData.arrowTypeStart = "arrow_point"; + case "arrow_point": + edgeData.arrowTypeEnd = "arrow_point"; + break; + case "double_arrow_circle": + edgeData.arrowTypeStart = "arrow_circle"; + case "arrow_circle": + edgeData.arrowTypeEnd = "arrow_circle"; + break; + } + let style = ""; + let labelStyle = ""; + switch (edge.stroke) { + case "normal": + style = "fill:none;"; + if (defaultStyle !== void 0) { + style = defaultStyle; + } + if (defaultLabelStyle !== void 0) { + labelStyle = defaultLabelStyle; + } + edgeData.thickness = "normal"; + edgeData.pattern = "solid"; + break; + case "dotted": + edgeData.thickness = "normal"; + edgeData.pattern = "dotted"; + edgeData.style = "fill:none;stroke-width:2px;stroke-dasharray:3;"; + break; + case "thick": + edgeData.thickness = "thick"; + edgeData.pattern = "solid"; + edgeData.style = "stroke-width: 3.5px;fill:none;"; + break; + } + if (edge.style !== void 0) { + const styles2 = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.a)(edge.style); + style = styles2.style; + labelStyle = styles2.labelStyle; + } + edgeData.style = edgeData.style += style; + edgeData.labelStyle = edgeData.labelStyle += labelStyle; + if (edge.interpolate !== void 0) { + edgeData.curve = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.d)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + } else if (edges.defaultInterpolate !== void 0) { + edgeData.curve = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.d)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + } else { + edgeData.curve = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.d)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + } + if (edge.text === void 0) { + if (edge.style !== void 0) { + edgeData.arrowheadStyle = "fill: #333"; + } + } else { + edgeData.arrowheadStyle = "fill: #333"; + edgeData.labelpos = "c"; + } + edgeData.labelType = "text"; + edgeData.label = edge.text.replace(_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.c.lineBreakRegex, "\n"); + if (edge.style === void 0) { + edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none;"; + } + edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:"); + edgeData.id = linkId; + edgeData.classes = "flowchart-link " + linkNameStart + " " + linkNameEnd; + const labelEl = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.f)(labelsEl, edgeData); + const { source, target } = getEdgeStartEndPoint(edge, dir); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.debug("abc78 source and target", source, target); + graph.edges.push({ + id: "e" + edge.start + edge.end, + sources: [source], + targets: [target], + labelEl, + labels: [ + { + width: edgeData.width, + height: edgeData.height, + orgWidth: edgeData.width, + orgHeight: edgeData.height, + text: edgeData.label, + layoutOptions: { + "edgeLabels.inline": "true", + "edgeLabels.placement": "CENTER" + } + } + ], + edgeData + }); + }); + return graph; +}; +const addMarkersToEdge = function(svgPath, edgeData, diagramType, arrowMarkerAbsolute) { + let url = ""; + if (arrowMarkerAbsolute) { + url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search; + url = url.replace(/\(/g, "\\("); + url = url.replace(/\)/g, "\\)"); + } + switch (edgeData.arrowTypeStart) { + case "arrow_cross": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-crossStart)"); + break; + case "arrow_point": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-pointStart)"); + break; + case "arrow_barb": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-barbStart)"); + break; + case "arrow_circle": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-circleStart)"); + break; + case "aggregation": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-aggregationStart)"); + break; + case "extension": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-extensionStart)"); + break; + case "composition": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-compositionStart)"); + break; + case "dependency": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-dependencyStart)"); + break; + case "lollipop": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-lollipopStart)"); + break; + } + switch (edgeData.arrowTypeEnd) { + case "arrow_cross": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-crossEnd)"); + break; + case "arrow_point": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-pointEnd)"); + break; + case "arrow_barb": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-barbEnd)"); + break; + case "arrow_circle": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-circleEnd)"); + break; + case "aggregation": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-aggregationEnd)"); + break; + case "extension": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-extensionEnd)"); + break; + case "composition": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-compositionEnd)"); + break; + case "dependency": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-dependencyEnd)"); + break; + case "lollipop": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-lollipopEnd)"); + break; + } +}; +const getClasses = function(text, diagObj) { + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("Extracting classes"); + diagObj.db.clear("ver-2"); + try { + diagObj.parse(text); + return diagObj.db.getClasses(); + } catch (e) { + return {}; + } +}; +const addSubGraphs = function(db2) { + const parentLookupDb = { parentById: {}, childrenById: {} }; + const subgraphs = db2.getSubGraphs(); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("Subgraphs - ", subgraphs); + subgraphs.forEach(function(subgraph) { + subgraph.nodes.forEach(function(node) { + parentLookupDb.parentById[node] = subgraph.id; + if (parentLookupDb.childrenById[subgraph.id] === void 0) { + parentLookupDb.childrenById[subgraph.id] = []; + } + parentLookupDb.childrenById[subgraph.id].push(node); + }); + }); + subgraphs.forEach(function(subgraph) { + ({ id: subgraph.id }); + if (parentLookupDb.parentById[subgraph.id] !== void 0) { + parentLookupDb.parentById[subgraph.id]; + } + }); + return parentLookupDb; +}; +const calcOffset = function(src, dest, parentLookupDb) { + const ancestor = findCommonAncestor(src, dest, parentLookupDb); + if (ancestor === void 0 || ancestor === "root") { + return { x: 0, y: 0 }; + } + const ancestorOffset = nodeDb[ancestor].offset; + return { x: ancestorOffset.posX, y: ancestorOffset.posY }; +}; +const insertEdge = function(edgesEl, edge, edgeData, diagObj, parentLookupDb) { + const offset = calcOffset(edge.sources[0], edge.targets[0], parentLookupDb); + const src = edge.sections[0].startPoint; + const dest = edge.sections[0].endPoint; + const segments = edge.sections[0].bendPoints ? edge.sections[0].bendPoints : []; + const segPoints = segments.map((segment) => [segment.x + offset.x, segment.y + offset.y]); + const points = [ + [src.x + offset.x, src.y + offset.y], + ...segPoints, + [dest.x + offset.x, dest.y + offset.y] + ]; + const curve = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .line */ .jvg)().curve(d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + const edgePath = edgesEl.insert("path").attr("d", curve(points)).attr("class", "path").attr("fill", "none"); + const edgeG = edgesEl.insert("g").attr("class", "edgeLabel"); + const edgeWithLabel = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(edgeG.node().appendChild(edge.labelEl)); + const box = edgeWithLabel.node().firstChild.getBoundingClientRect(); + edgeWithLabel.attr("width", box.width); + edgeWithLabel.attr("height", box.height); + edgeG.attr( + "transform", + `translate(${edge.labels[0].x + offset.x}, ${edge.labels[0].y + offset.y})` + ); + addMarkersToEdge(edgePath, edgeData, diagObj.type, diagObj.arrowMarkerAbsolute); +}; +const insertChildren = (nodeArray, parentLookupDb) => { + nodeArray.forEach((node) => { + if (!node.children) { + node.children = []; + } + const childIds = parentLookupDb.childrenById[node.id]; + if (childIds) { + childIds.forEach((childId) => { + node.children.push(nodeDb[childId]); + }); + } + insertChildren(node.children, parentLookupDb); + }); +}; +const draw = async function(text, id, _version, diagObj) { + var _a; + diagObj.db.clear(); + nodeDb = {}; + diagObj.db.setGen("gen-2"); + diagObj.parser.parse(text); + const renderEl = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body").append("div").attr("style", "height:400px").attr("id", "cy"); + let graph = { + id: "root", + layoutOptions: { + "elk.hierarchyHandling": "INCLUDE_CHILDREN", + "org.eclipse.elk.padding": "[top=100, left=100, bottom=110, right=110]", + "elk.layered.spacing.edgeNodeBetweenLayers": "30", + "elk.direction": "DOWN" + }, + children: [], + edges: [] + }; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("Drawing flowchart using v3 renderer", elk); + let dir = diagObj.db.getDirection(); + switch (dir) { + case "BT": + graph.layoutOptions["elk.direction"] = "UP"; + break; + case "TB": + graph.layoutOptions["elk.direction"] = "DOWN"; + break; + case "LR": + graph.layoutOptions["elk.direction"] = "RIGHT"; + break; + case "RL": + graph.layoutOptions["elk.direction"] = "LEFT"; + break; + } + const { securityLevel, flowchart: conf2 } = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.g)(); + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("#i" + id); + } + const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body"); + const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document; + const svg = root.select(`[id="${id}"]`); + const markers = ["point", "circle", "cross"]; + (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.i)(svg, markers, diagObj.type, diagObj.arrowMarkerAbsolute); + const vert = diagObj.db.getVertices(); + let subG; + const subGraphs = diagObj.db.getSubGraphs(); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("Subgraphs - ", subGraphs); + for (let i = subGraphs.length - 1; i >= 0; i--) { + subG = subGraphs[i]; + diagObj.db.addVertex(subG.id, subG.title, "group", void 0, subG.classes, subG.dir); + } + const subGraphsEl = svg.insert("g").attr("class", "subgraphs"); + const parentLookupDb = addSubGraphs(diagObj.db); + graph = addVertices(vert, id, root, doc, diagObj, parentLookupDb, graph); + const edgesEl = svg.insert("g").attr("class", "edges edgePath"); + const edges = diagObj.db.getEdges(); + graph = addEdges(edges, diagObj, graph, svg); + const nodes = Object.keys(nodeDb); + nodes.forEach((nodeId) => { + const node = nodeDb[nodeId]; + if (!node.parent) { + graph.children.push(node); + } + if (parentLookupDb.childrenById[nodeId] !== void 0) { + node.labels = [ + { + text: node.labelText, + layoutOptions: { + "nodeLabels.placement": "[H_CENTER, V_TOP, INSIDE]" + }, + width: node.labelData.width, + height: node.labelData.height + } + ]; + delete node.x; + delete node.y; + delete node.width; + delete node.height; + } + }); + insertChildren(graph.children, parentLookupDb); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("after layout", JSON.stringify(graph, null, 2)); + const g = await elk.layout(graph); + drawNodes(0, 0, g.children, svg, subGraphsEl, diagObj, 0); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("after layout", g); + (_a = g.edges) == null ? void 0 : _a.map((edge) => { + insertEdge(edgesEl, edge, edge.edgeData, diagObj, parentLookupDb); + }); + (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.s)({}, svg, conf2.diagramPadding, conf2.useMaxWidth); + renderEl.remove(); +}; +const drawNodes = (relX, relY, nodeArray, svg, subgraphsEl, diagObj, depth) => { + nodeArray.forEach(function(node) { + if (node) { + nodeDb[node.id].offset = { + posX: node.x + relX, + posY: node.y + relY, + x: relX, + y: relY, + depth, + width: node.width, + height: node.height + }; + if (node.type === "group") { + const subgraphEl = subgraphsEl.insert("g").attr("class", "subgraph"); + subgraphEl.insert("rect").attr("class", "subgraph subgraph-lvl-" + depth % 5 + " node").attr("x", node.x + relX).attr("y", node.y + relY).attr("width", node.width).attr("height", node.height); + const label = subgraphEl.insert("g").attr("class", "label"); + label.attr( + "transform", + `translate(${node.labels[0].x + relX + node.x}, ${node.labels[0].y + relY + node.y})` + ); + label.node().appendChild(node.labelData.labelNode); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("Id (UGH)= ", node.type, node.labels); + } else { + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.l.info("Id (UGH)= ", node.id); + node.el.attr( + "transform", + `translate(${node.x + relX + node.width / 2}, ${node.y + relY + node.height / 2})` + ); + } + } + }); + nodeArray.forEach(function(node) { + if (node && node.type === "group") { + drawNodes(relX + node.x, relY + node.y, node.children, svg, subgraphsEl, diagObj, depth + 1); + } + }); +}; +const renderer = { + getClasses, + draw +}; +const genSections = (options) => { + let sections = ""; + for (let i = 0; i < 5; i++) { + sections += ` + .subgraph-lvl-${i} { + fill: ${options[`surface${i}`]}; + stroke: ${options[`surfacePeer${i}`]}; + } + `; + } + return sections; +}; +const getStyles = (options) => `.label { + font-family: ${options.fontFamily}; + color: ${options.nodeTextColor || options.textColor}; + } + .cluster-label text { + fill: ${options.titleColor}; + } + .cluster-label span { + color: ${options.titleColor}; + } + + .label text,span { + fill: ${options.nodeTextColor || options.textColor}; + color: ${options.nodeTextColor || options.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${options.mainBkg}; + stroke: ${options.nodeBorder}; + stroke-width: 1px; + } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${options.arrowheadColor}; + } + + .edgePath .path { + stroke: ${options.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${options.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${options.edgeLabelBackground}; + rect { + opacity: 0.5; + background-color: ${options.edgeLabelBackground}; + fill: ${options.edgeLabelBackground}; + } + text-align: center; + } + + .cluster rect { + fill: ${options.clusterBkg}; + stroke: ${options.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${options.titleColor}; + } + + .cluster span { + color: ${options.titleColor}; + } + /* .cluster div { + color: ${options.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${options.fontFamily}; + font-size: 12px; + background: ${options.tertiaryColor}; + border: 1px solid ${options.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${options.textColor}; + } + .subgraph { + stroke-width:2; + rx:3; + } + // .subgraph-lvl-1 { + // fill:#ccc; + // // stroke:black; + // } + ${genSections(options)} +`; +const styles = getStyles; +const diagram = { + db: _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.h, + renderer, + parser: _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_9__.p, + styles +}; + +//# sourceMappingURL=diagram-definition.e55ec334.js.map + + +/***/ }) + +}; +; \ No newline at end of file diff --git a/docs/assets/js/20f44f94.f9274e66.js b/docs/assets/js/20f44f94.f9274e66.js new file mode 100644 index 000000000..1f36b63b0 --- /dev/null +++ b/docs/assets/js/20f44f94.f9274e66.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[81079],{3905:(e,r,n)=>{n.d(r,{Zo:()=>p,kt:()=>m});var t=n(67294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=o,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?t.createElement(f,s(s({ref:r},p),{},{components:n})):t.createElement(f,s({ref:r},p))}));function m(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=n(87462),o=(n(67294),n(3905));const a={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.4.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.4.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.4.0/basics/errors",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.4.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.4.0/basics/events"}},l={},c=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:r,...n}=e;return(0,o.kt)("wrapper",(0,t.Z)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"errors"},"Errors"),(0,o.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"use odra::{execution_error, Variable, UnwrapOrRevert};\nuse odra::types::Address;\n\n#[odra::module]\npub struct OwnedContract {\n name: Variable,\n owner: Variable
,\n}\n\nexecution_error! {\n pub enum Error {\n OwnerNotSet => 1,\n NotAnOwner => 2,\n }\n}\n\n\n#[odra::module]\nimpl OwnedContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = odra::contract_env::caller();\n if caller != self.owner() {\n odra::contract_env::revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,o.kt)("p",null,"Firstly, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,o.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,o.kt)("p",null,"You and the users of your contract will be thankful for a meaningful error message!"),(0,o.kt)("p",null,"You can also throw the error directly, by using ",(0,o.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"odra::contract_env::revert(Error::NotAnOwner)\n")),(0,o.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,o.kt)("p",null,"Okay, but how about testing it? We've already mentioned a function - ",(0,o.kt)("inlineCode",{parentName:"p"},"assert_exception"),". This is how you will\nuse it:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},'use super::{OwnedContractDeployer, OwnedContractRef};\nuse super::Error;\n\n#[test]\nfn test_owner_error() {\n let owner = odra::test_env::get_account(0);\n let not_an_owner = odra::test_env::get_account(1);\n\n odra::test_env::set_caller(owner);\n let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());\n\n odra::test_env::set_caller(not_an_owner);\n odra::test_env::assert_exception(Error::NotAnOwner, || {\n owned_contract.change_name("NewName".to_string());\n })\n}\n')),(0,o.kt)("p",null,"In the example above, because we are calling the ",(0,o.kt)("inlineCode",{parentName:"p"},"change_name"),' method as an address which is not an "owner",\nwe are expecting that "NotAnOwner" error will be thrown.'),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Here we are creating another reference to the already deployed contract using ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractRef::at()")," and passing to it\nits Address. Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractDeployer::init()")," returns the same type.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will learn how to emit and test events using Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/2131dc9d.6cd5a464.js b/docs/assets/js/2131dc9d.6cd5a464.js new file mode 100644 index 000000000..c8c267504 --- /dev/null +++ b/docs/assets/js/2131dc9d.6cd5a464.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95310],{31582:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.5.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.5.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.5.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/21d4362d.9aa7b094.js b/docs/assets/js/21d4362d.9aa7b094.js new file mode 100644 index 000000000..5daca4216 --- /dev/null +++ b/docs/assets/js/21d4362d.9aa7b094.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[47646],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),i=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=i(e.components);return a.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=i(n),m=r,f=c["".concat(u,".").concat(m)]||c[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=c;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var i=2;i{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>i});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5},o="Pausable",l={unversionedId:"tutorials/pauseable",id:"version-1.0.0/tutorials/pauseable",title:"Pausable",description:"The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.",source:"@site/versioned_docs/version-1.0.0/tutorials/pauseable.md",sourceDirName:"tutorials",slug:"/tutorials/pauseable",permalink:"/docs/tutorials/pauseable",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Access Control",permalink:"/docs/tutorials/access-control"},next:{title:"Ticketing System",permalink:"/docs/tutorials/nft"}},u={},i=[{value:"Code",id:"code",level:2},{value:"Events and Error",id:"events-and-error",level:3},{value:"Module definition",id:"module-definition",level:3},{value:"Checks and guards",id:"checks-and-guards",level:3},{value:"Actions",id:"actions",level:3},{value:"Pausable counter",id:"pausable-counter",level:2}],d={toc:i};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently."),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"As always, we will start with defining functionalities of our module."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Check the state - is it paused or not."),(0,r.kt)("li",{parentName:"ol"},"State guards - a contract should stop execution if is in a state we don't expect."),(0,r.kt)("li",{parentName:"ol"},"Switch the state.")),(0,r.kt)("h3",{id:"events-and-error"},"Events and Error"),(0,r.kt)("p",null,"There just two errors that may occur: ",(0,r.kt)("inlineCode",{parentName:"p"},"PausedRequired"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"UnpausedRequired"),". We define them in a standard Odra way."),(0,r.kt)("p",null,"Events definition is highly uncomplicated: ",(0,r.kt)("inlineCode",{parentName:"p"},"Paused")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused")," events holds only the address of the pauser."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::odra_error]\npub enum Error {\n PausedRequired = 1_000,\n UnpausedRequired = 1_001,\n}\n\n#[odra::event]\npub struct Paused {\n pub account: Address\n}\n\n#[odra::event]\npub struct Unpaused {\n pub account: Address\n}\n")),(0,r.kt)("h3",{id:"module-definition"},"Module definition"),(0,r.kt)("p",null,"The module storage is extremely simple - has a single ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," of type bool, that indicates if a contract is paused."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::Var;\n...\n\n#[odra::module(events = [Paused, Unpaused])]\npub struct Pausable {\n is_paused: Var\n}\n")),(0,r.kt)("h3",{id:"checks-and-guards"},"Checks and guards"),(0,r.kt)("p",null,"Now, let's move to state checks and guards."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn is_paused(&self) -> bool {\n self.is_paused.get_or_default()\n }\n\n pub fn require_not_paused(&self) {\n if self.is_paused() {\n self.env().revert(Error::UnpausedRequired);\n }\n }\n\n pub fn require_paused(&self) {\n if !self.is_paused() {\n self.env().revert(Error::PausedRequired);\n }\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - as mentioned in the intro, the module is not intended to be a standalone contract, so the only ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block is not annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::module")," and hence does not expose any entrypoint."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L2")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused()")," checks the contract state, if the Var ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused")," has not been initialized, the default value (false) is returned."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - to guarantee the code is executed when the contract is not paused, ",(0,r.kt)("inlineCode",{parentName:"li"},"require_not_paused()")," function reads the state and reverts if the contract is paused. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"require_paused()")," is a mirror function - stops the contract execution if the contract is not paused.")),(0,r.kt)("h3",{id:"actions"},"Actions"),(0,r.kt)("p",null,"Finally, we will add the ability to switch the module state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn pause(&mut self) {\n self.require_not_paused();\n self.is_paused.set(true);\n\n self.env().emit_event(Paused {\n account: self.env().caller()\n });\n }\n\n pub fn unpause(&mut self) {\n self.require_paused();\n self.is_paused.set(false);\n\n self.env().emit_event(Unpaused {\n account: self.env().caller()\n });\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"pause()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()")," functions do three things: ensure the contract is the right state (unpaused for ",(0,r.kt)("inlineCode",{parentName:"p"},"pause()"),", not paused for ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()"),"), updates the state, and finally emits events (",(0,r.kt)("inlineCode",{parentName:"p"},"Paused"),"/",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused"),")."),(0,r.kt)("h2",{id:"pausable-counter"},"Pausable counter"),(0,r.kt)("p",null,"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called ",(0,r.kt)("inlineCode",{parentName:"p"},"PausableCounter"),". The contract consists of a Var ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module. The counter can only be incremented if the contract is in a normal state (is not paused)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"...\nuse odra::SubModule;\n...\n\n#[odra::module]\npub struct PausableCounter {\n value: Var,\n pauseable: SubModule\n}\n\n#[odra::module]\nimpl PausableCounter {\n pub fn increment(&mut self) {\n self.pauseable.require_not_paused();\n\n let new_value = self.value.get_or_default() + 1;\n self.value.set(new_value);\n }\n\n pub fn pause(&mut self) {\n self.pauseable.pause();\n }\n\n pub fn unpause(&mut self) {\n self.pauseable.unpause();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn increment_only_if_unpaused() {\n let test_env = odra_test::env();\n let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);\n contract.increment();\n contract.pause();\n\n assert_eq!(\n contract.try_increment().unwrap_err(),\n Error::UnpausedRequired.into()\n );\n assert_eq!(contract.get_value(), 1);\n }\n}\n")),(0,r.kt)("p",null,"As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/21fc20bd.3d44a9ed.js b/docs/assets/js/21fc20bd.3d44a9ed.js new file mode 100644 index 000000000..a42308907 --- /dev/null +++ b/docs/assets/js/21fc20bd.3d44a9ed.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[5724],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var r=o.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return o.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},u=o.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?o.createElement(f,l(l({ref:r},c),{},{components:t})):o.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.3.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.",source:"@site/versioned_docs/version-0.3.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.3.0/examples/odra-examples",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Examples",permalink:"/docs/0.3.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.3.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,a.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,a.kt)("inlineCode",{parentName:"p"},"examples")," in the Odra main repository."),(0,a.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,a.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,a.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/237cf9c7.da0e30cd.js b/docs/assets/js/237cf9c7.da0e30cd.js new file mode 100644 index 000000000..b33c539a3 --- /dev/null +++ b/docs/assets/js/237cf9c7.da0e30cd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[32806],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.2.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.2.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.2.0/basics/events",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"defaultSidebar",previous:{title:"Errors",permalink:"/docs/0.2.0/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.2.0/basics/cross-calls"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Different blockchains implement events in different ways. Odra lets you forget about it by introducing\nOdra Events. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{Event, contract_env};\nuse odra::types::{Address, BlockTime, event::OdraEvent};\n\n#[odra::module]\npub struct PartyContract {\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n\n#[odra::module]\nimpl PartyContract {\n #[odra(init)]\n pub fn init(&self) {\n PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n }.emit();\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, we derive an ",(0,a.kt)("inlineCode",{parentName:"p"},"Event")," macro like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n")),(0,a.kt)("p",null,"Among other things, it adds an ",(0,a.kt)("inlineCode",{parentName:"p"},"emit()")," function to the struct, which allows you to emit the event simply\nas that:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n}.emit();\n")),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a handy macro ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{assert_events, test_env};\nuse crate::docs::events::PartyStarted;\nuse super::PartyContractDeployer;\n\n#[test]\nfn test_party() {\n let party_contract = PartyContractDeployer::init();\n assert_events!(\n party_contract,\n PartyStarted {\n caller: test_env::get_account(0),\n block_time: 0,\n }\n );\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/24942c38.c6eb3e72.js b/docs/assets/js/24942c38.c6eb3e72.js new file mode 100644 index 000000000..b74b4e922 --- /dev/null +++ b/docs/assets/js/24942c38.c6eb3e72.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[28511],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||l;return t?a.createElement(f,o(o({ref:n},c),{},{components:t})):a.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,o=new Array(l);o[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const l={},o="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.8.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.8.0/advanced/01-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.8.0/advanced/delegate",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.8.0/category/advanced"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.8.0/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::{\n Address, casper_types::U256,\n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n fn approve(&mut self, spender: Address, amount: U256);\n fn name(&self) -> String;\n fn symbol(&self) -> String;\n fn decimals(&self) -> u8;\n fn total_supply(&self) -> U256;\n fn balance_of(&self, owner: Address) -> U256;\n fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\nuse odra::{\n Address, casper_types::U256, \n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: SubModule,\n erc20: SubModule,\n exchange: SubModule\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n fn swap(&mut self, sender: Address, recipient: Address);\n fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/24bf3011.896e175e.js b/docs/assets/js/24bf3011.896e175e.js new file mode 100644 index 000000000..9e3cc2d65 --- /dev/null +++ b/docs/assets/js/24bf3011.896e175e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[36882],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);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 l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),u=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=u(a),m=r,h=p["".concat(i,".").concat(m)]||p[m]||c[m]||o;return a?n.createElement(h,l(l({ref:t},d),{},{components:a})):n.createElement(h,l({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var u=2;u{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var n=a(87462),r=(a(67294),a(3905));const o={},l="Module Composer",s={unversionedId:"advanced/composer",id:"version-0.3.1/advanced/composer",title:"Module Composer",description:"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.",source:"@site/versioned_docs/version-0.3.1/advanced/01-composer.md",sourceDirName:"advanced",slug:"/advanced/composer",permalink:"/docs/0.3.1/advanced/composer",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.3.1/category/advanced"},next:{title:"Delegate",permalink:"/docs/0.3.1/advanced/delegate"}},i={},u=[{value:"Conceptual Overview",id:"conceptual-overview",level:2},{value:"Usage",id:"usage",level:2},{value:"Conclusion",id:"conclusion",level:2}],d={toc:u};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"module-composer"},"Module Composer"),(0,r.kt)("p",null,"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples."),(0,r.kt)("h2",{id:"conceptual-overview"},"Conceptual Overview"),(0,r.kt)("p",null,"By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n value: Variable, // the default namespace would be "contract_value"\n module: Module\n}\n\n#[odra::module]\nstruct Module {\n secret: Variable // the default namespace would be "contract_module_secret"\n}\n')),(0,r.kt)("p",null,"While this isolation often proves useful, there are scenarios where shared storage is beneficial. Here, the Module Composer comes in."),(0,r.kt)("p",null,"Additionally, the Module Composer shortens the storage key - a handy side effect of shared storage. "),(0,r.kt)("p",null,"For each module, Odra generates a corresponding Composer struct (e.g., ",(0,r.kt)("inlineCode",{parentName:"p"},"MyContractComposer")," for ",(0,r.kt)("inlineCode",{parentName:"p"},"MyContract")," module), which aids in manual module composition."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"By default, the #","[odra::module]"," macro generates an implementation of the odra::Instance trait, prefixing the storage key of child modules with the parent namespace. To disable this behavior, pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"skip_instance")," argument to the #","[odra::module]"," macro."),(0,r.kt)("p",null,"Let's write a simple code example. The example provided below introduces some additional complexity by featuring deeper module nesting."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::{Instance, Variable, Composer};\n\n#[odra::module]\npub struct SharedStorage {\n pub value: Variable\n}\n\n#[odra::module]\npub struct MyStorage {\n pub shared: SharedStorage,\n pub version: Variable\n}\n\n#[odra::module]\npub struct MoreStorage {\n pub my_storage: MyStorage,\n pub extra: Variable\n}\n\n#[odra::module(skip_instance)]\npub struct ComplexContract {\n pub shared: SharedStorage,\n pub more_storage: MoreStorage\n}\n\n#[odra::module]\nimpl ComplexContract {\n #[odra(init)]\n pub fn init(&mut self, version: u8, value: String, extra: u32) {\n self.more_storage.my_storage.version.set(version);\n self.shared.value.set(value);\n self.more_storage.extra.set(extra);\n }\n\n pub fn get_value(&self) -> String {\n self.shared.value.get_or_default()\n }\n\n pub fn get_value_via_storage(&self) -> String {\n self.more_storage.my_storage.shared.value.get_or_default()\n }\n\n pub fn get_extra_value(&self) -> u32 {\n self.more_storage.extra.get_or_default()\n }\n}\n\nimpl Instance for ComplexContract {\n fn instance(namespace: &str) -> Self {\n let value = Composer::new(namespace, "v").compose();\n let shared = SharedStorageComposer::new(namespace, "shared")\n .with_value(&value)\n .compose();\n let my_storage = MyStorageComposer::new(namespace, "my_storage")\n .with_shared(&shared)\n .compose();\n let more_storage = MoreStorageComposer::new(namespace, "more_storage")\n .with_my_storage(&my_storage)\n .compose();\n Self { shared, more_storage }\n }\n}\n\n#[cfg(test)]\nmod test {\n use crate::composer::ComplexContractDeployer;\n\n #[test]\n fn t() {\n let shared_value = "shared_value".to_string();\n let extra_value: u32 = 314;\n let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);\n\n assert_eq!(token.get_value(), shared_value);\n assert_eq!(token.get_value_via_storage(), shared_value);\n assert_eq!(token.get_extra_value(), extra_value);\n }\n}\n')),(0,r.kt)("p",null,"In this example, we've introduced a new module, ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", which nests ",(0,r.kt)("inlineCode",{parentName:"p"},"MyStorage")," and includes an extra value. The ",(0,r.kt)("inlineCode",{parentName:"p"},"ComplexContract")," contains ",(0,r.kt)("inlineCode",{parentName:"p"},"SharedStorage")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels."),(0,r.kt)("p",null,"If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"On the contract level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_shared_value"),"."),(0,r.kt)("li",{parentName:"ol"},"On the ",(0,r.kt)("inlineCode",{parentName:"li"},"MyStorage")," module level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_more_storage_shared_value"),".")),(0,r.kt)("p",null,"This example showcases how you can effectively use the Module Composer feature to build intricate and efficient smart contracts."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"To customize the storage building block, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"Composer")," which API matches to modules composers API.")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"The Module Composer in Odra provides developers with a high level of flexibility and control over module behavior in their smart contracts. This guide, complete with a practical example, should give you a good understanding of the feature. Embrace the power of the Module Composer and unleash the full potential of your smart contracts!"))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/252d6971.b2640c03.js b/docs/assets/js/252d6971.b2640c03.js new file mode 100644 index 000000000..852c32c55 --- /dev/null +++ b/docs/assets/js/252d6971.b2640c03.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59543],{5582:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.9.1/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.9.1/"},"next":{"title":"Installation","permalink":"/docs/0.9.1/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/25684.b0063456.js b/docs/assets/js/25684.b0063456.js new file mode 100644 index 000000000..358df7c84 --- /dev/null +++ b/docs/assets/js/25684.b0063456.js @@ -0,0 +1 @@ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25684],{29039:(e,s,a)=>{"use strict";a.d(s,{Z:()=>b});var t=a(31336);const b=t},15525:()=>{}}]); \ No newline at end of file diff --git a/docs/assets/js/26441f8e.07ba3604.js b/docs/assets/js/26441f8e.07ba3604.js new file mode 100644 index 000000000..70e45d738 --- /dev/null +++ b/docs/assets/js/26441f8e.07ba3604.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[7742],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>g});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=l(n),g=a,f=d["".concat(c,".").concat(g)]||d[g]||p[g]||s;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,i=new Array(s);i[0]=d;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={},i="Signatures",o={unversionedId:"advanced/signatures",id:"version-0.6.0/advanced/signatures",title:"Signatures",description:"As each backend can use a different scheme for generating key pairs,",source:"@site/versioned_docs/version-0.6.0/advanced/05-signatures.md",sourceDirName:"advanced",slug:"/advanced/signatures",permalink:"/docs/0.6.0/advanced/signatures",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/0.6.0/advanced/attributes"},next:{title:"Backends",permalink:"/docs/0.6.0/category/backends"}},c={},l=[{value:"Signature verification",id:"signature-verification",level:2},{value:"Testing",id:"testing",level:2},{value:"ECRecover",id:"ecrecover",level:2}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"signatures"},"Signatures"),(0,a.kt)("p",null,"As each backend can use a different scheme for generating key pairs,\nOdra Framework provides a generic function for signature verification inside the contract context.\nThanks to this, you can write your code once, without worrying about underlying cryptography."),(0,a.kt)("h2",{id:"signature-verification"},"Signature verification"),(0,a.kt)("p",null,"Signature verification is conducted by a function in ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"pub fn verify_signature(message: &Bytes, signature: &Bytes, public_key: &PublicKey) -> bool;\n")),(0,a.kt)("p",null,"Here's the simplest example of this function used in a contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},"#[odra::module]\nimpl SignatureVerifier {\n pub fn verify_signature(\n &self,\n message: &Bytes,\n signature: &Bytes,\n public_key: &PublicKey\n ) -> bool {\n contract_env::verify_signature(message, signature, public_key)\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Besides the above function in the contract context, Odra provides corresponding functions in the ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"pub fn sign_message(message: &Bytes, address: &Address) -> Bytes;\n\npub fn public_key(address: &Address) -> PublicKey;\n")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"sign_message")," will return a signed message. The signing itself will be performed using a private key\nof an account behind the ",(0,a.kt)("inlineCode",{parentName:"p"},"address"),"."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"public_key")," returns the PublicKey of an ",(0,a.kt)("inlineCode",{parentName:"p"},"address")," account."),(0,a.kt)("p",null,"Thanks to those, you can write generic tests, that will work with all backends, despite differences\nin signature schemes they use."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},'#[test]\nfn signature_verification_works() {\n let message = "Message to be signed";\n let message_bytes = &Bytes::from(message.as_bytes().to_vec());\n let account = test_env::get_account(0);\n\n let signature = test_env::sign_message(message_bytes, &account);\n\n let public_key = test_env::public_key(&account);\n\n let signature_verifier = SignatureVerifierDeployer::default();\n assert!(signature_verifier.verify_signature(message_bytes, &signature, &public_key));\n}\n')),(0,a.kt)("p",null,"If you want, you can also test signatures that were created outside Odra.\nHowever, you will need to prepare separate tests for each backend:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},'/// The following test checks that the signature verification works with the signature produced\n/// by the casper wallet.\n#[test]\n#[cfg(feature = "casper")]\nfn verify_signature_casper_wallet() {\n use odra::casper::casper_types::bytesrepr::FromBytes;\n // Casper Wallet for the message "Ahoj przygodo!" signed using SECP256K1 key\n // produces the following signature:\n // 1e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa\n // Casper Wallet adds "Casper Message:\\n" prefix to the message:\n let message = "Casper Message:\\nAhoj przygodo!";\n let message_bytes = &Bytes::from(message.as_bytes().to_vec());\n\n // Depending on the type of the key, we need to prefix the signature with a tag:\n // 0x01 for ED25519\n // 0x02 for SECP256K1\n let signature_hex = "021e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa";\n let signature: [u8; 65] = hex::decode(signature_hex).unwrap().try_into().unwrap();\n let signature_bytes = &Bytes::from(signature.to_vec());\n\n // Similar to the above, the public key is tagged:\n let public_key_hex = "02036d9b880e44254afaf34330e57703a63aec53b5918d4470059b67a4a906350105";\n let public_key_decoded = hex::decode(public_key_hex).unwrap();\n let (public_key, _) = odra::casper::casper_types::crypto::PublicKey::from_bytes(\n public_key_decoded.as_slice()\n )\n .unwrap();\n\n let signature_verifier = SignatureVerifierDeployer::default();\n assert!(signature_verifier.verify_signature(message_bytes, signature_bytes, &public_key));\n}\n')),(0,a.kt)("h2",{id:"ecrecover"},"ECRecover"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra-proposal#odra-standard-library"},"Odra Standard Library"),"\npart of the original Odra Proposal mentioned ECRecover as one of the functions that will be\nimplemented by the Odra Framework. We decided to add signatures verification instead."),(0,a.kt)("p",null,"The reasoning behind this decision is that the ECRecover works only with one type of signature.\nOdra tries to be backend-agnostic, which implies that it should also be signature-type-agnostic.\nThis was possible to achieve when implementing generic signature verification, but not with ECRecover."),(0,a.kt)("p",null,"In short, the implementation of ECRecover would not depend on the backend, pushing it into some kind of\nutils library, and those already exist, for example in\n",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/solana-program/latest/solana_program/secp256k1_recover/index.html#"},"solana_program"),"\ncrate."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/26ab3a9c.da36b1ce.js b/docs/assets/js/26ab3a9c.da36b1ce.js new file mode 100644 index 000000000..e3cf99ddb --- /dev/null +++ b/docs/assets/js/26ab3a9c.da36b1ce.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[79106],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,o=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return r?a.createElement(f,l(l({ref:t},c),{},{components:r})):a.createElement(f,l({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var n=r.length,l=new Array(n);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var a=r(87462),o=(r(67294),r(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-1.0.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].",source:"@site/versioned_docs/version-1.0.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/examples/odra-examples",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,o.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"examples")," in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra main repository"),"."),(0,o.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,o.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,o.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,o.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/274ccf11.4e6ac37f.js b/docs/assets/js/274ccf11.4e6ac37f.js new file mode 100644 index 000000000..2985e2ad5 --- /dev/null +++ b/docs/assets/js/274ccf11.4e6ac37f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37057],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(n),d=o,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.2.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.2.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.2.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"defaultSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.2.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.2.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],p={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/host.rs"',title:'"examples/src/docs/host.rs"'},"use odra::Variable;\nuse odra::types::{BlockTime, Address};\n\n#[odra::module]\npub struct HostContract {\n name: Variable,\n created_at: Variable,\n created_by: Variable
,\n}\n\n#[odra::module]\nimpl HostContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(odra::contract_env::get_block_time());\n self.created_by.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are calling functions from ",(0,o.kt)("inlineCode",{parentName:"p"},"odra::contract_env"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"get_block_time()")," will return\nthe current block time wrapped in Odra type ",(0,o.kt)("inlineCode",{parentName:"p"},"Blocktime"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"caller()")," will return an Odra ",(0,o.kt)("inlineCode",{parentName:"p"},"Address")," of\na caller (this can be an external caller or another contract)."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/28efbf3f.b6ef9373.js b/docs/assets/js/28efbf3f.b6ef9373.js new file mode 100644 index 000000000..948a4a8fb --- /dev/null +++ b/docs/assets/js/28efbf3f.b6ef9373.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[42240],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(h,s(s({ref:t},d),{},{components:n})):r.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.2.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.2.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.2.0/basics/testing",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"defaultSidebar",previous:{title:"Host Communication",permalink:"/docs/0.2.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.2.0/basics/errors"}},l={},c=[{value:"Test env",id:"test-env",level:2},{value:"Deployer",id:"deployer",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'use odra::{Variable, List};\n\n#[cfg(test)]\nmod tests {\n use super::DogContract3Deployer;\n\n #[test]\n fn init_test() {\n let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(module)]")," macro created a Deployer code for us, which will deploy the contract on the\nVM:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n')),(0,a.kt)("p",null,"From now on, we can use ",(0,a.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with a macro are available to us:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,a.kt)("h2",{id:"test-env"},"Test env"),(0,a.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/testing.rs"',title:'"examples/src/docs/testing.rs"'},'#[cfg(test)]\nmod tests {\n use super::TestingContractDeployer;\n\n #[test]\n fn test_env() {\n let testing_contract = TestingContractDeployer::init("MyContract".to_string());\n let creator = testing_contract.created_by();\n odra::test_env::set_caller(odra::test_env::get_account(1));\n let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());\n let creator2 = testing_contract2.created_by();\n assert!(creator != creator2);\n }\n}\n')),(0,a.kt)("p",null,"In the code above, we are deploying two instances of the same contract, but we're using ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::test_env::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::contract_env::caller()"),"\nthe function we are calling inside the contract."),(0,a.kt)("p",null,"Each test env comes with a set of functions that will let you write better tests:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_caller(address: Address)")," - you've seen it in action just now"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn token_balance(address: Address) -> Balance")," - it returns the balance of the account associated with the given address"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn advance_block_time_by(seconds: BlockTime)")," - it increases the current value of block_time"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_account(n: usize) -> Address")," - it returns an nth address that was prepared for you by Odra in advance;\nby default, you start with the 0th account"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn assert_exception(err: E, block: F)")," - it executes the ",(0,a.kt)("inlineCode",{parentName:"li"},"block")," code and expects ",(0,a.kt)("inlineCode",{parentName:"li"},"err")," to happen"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_event(address: Address, index: i32) -> Result")," - returns\nthe event emitted by the contract")),(0,a.kt)("p",null,"Again, we'll see those used in the next articles."),(0,a.kt)("h2",{id:"deployer"},"Deployer"),(0,a.kt)("p",null,"You may be wondering what is the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractDeployer")," and where did it come from.\nIt is a piece of code generated automatically for you, thanks to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nIf you used the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," on one of the methods, it will be the constructor of your contract.\nOdra will make sure that it is called only once, so you can use it to initialize your data structures etc."),(0,a.kt)("p",null,"If you do not provide the init method, you can deploy the contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"::default()")," method.\nIn the end, you will get a ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," instance (in our case the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractRef"),") which reimplements all\nthe methods you defined in the contract, but executes them on a blockchain!"),(0,a.kt)("p",null,"To learn more about the ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," contract, visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.2.0/basics/cross-calls"},"Cross calls")," article."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We take a look at how Odra handles errors!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/2937371c.dad2af32.js b/docs/assets/js/2937371c.dad2af32.js new file mode 100644 index 000000000..e09402a53 --- /dev/null +++ b/docs/assets/js/2937371c.dad2af32.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[91457],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-1.0.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-1.0.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/basics/odra-toml",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the building tools to locate and build the contract.\nThe last segment of the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," will be used as the name for your contract - the generated wasm file will\nbe in the above case named ",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n\n[[contracts]]\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/29c8e325.69c046be.js b/docs/assets/js/29c8e325.69c046be.js new file mode 100644 index 000000000..ee0557e4d --- /dev/null +++ b/docs/assets/js/29c8e325.69c046be.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97447],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},d),{},{components:r})):n.createElement(f,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.4.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.4.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.4.0/basics/directory-structure",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.4.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.4.0/basics/odra-toml"}},s={},c=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:".builder_* folders",id:"builder_-folders",level:2},{value:"src/",id:"src",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 .builder_casper/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. We are using two features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/mock-vm")," - it is responsible for running tests on Odra's MockVM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/casper")," - backend implementation of Casper blockchain\nMore backends will be released as features that will be possible to enable here.")),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"builder_-folders"},".builder_* folders"),(0,a.kt)("p",null,"Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary\nfor building wasm files and running them against blockchain VMs. As it is not necessary to modify\nfiles in those folders in any way, by default they are hidden (hence the ",(0,a.kt)("inlineCode",{parentName:"p"},".")," at the beginning of the\nfolder name)."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain of your choosing."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/2b7acc9d.f7a4bee4.js b/docs/assets/js/2b7acc9d.f7a4bee4.js new file mode 100644 index 000000000..56ff26872 --- /dev/null +++ b/docs/assets/js/2b7acc9d.f7a4bee4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[34923],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.3.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.3.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.3.0/basics/odra-toml",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"defaultSidebar",previous:{title:"Directory structure",permalink:"/docs/0.3.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.3.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," will be used as a name for the contract - the generated wasm file will be in the above case named\n",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the builder to locate the exact struct where\nthe contract is defined."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n\n[[contracts]]\nname = "counter"\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/2bf460c7.170ca46e.js b/docs/assets/js/2bf460c7.170ca46e.js new file mode 100644 index 000000000..0a4af4122 --- /dev/null +++ b/docs/assets/js/2bf460c7.170ca46e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[16286],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"version-0.3.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.3.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.3.0/basics/cargo-odra",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"defaultSidebar",previous:{title:"Basics",permalink:"/docs/0.3.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.3.0/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Updating dependencies",id:"updating-dependencies",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them on multiple backends (blockchains)."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands will help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This will create a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it will create a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This will create a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It will run your tests against Odra's MockVM. It is substantially faster than virtual machines\nprovided by blockchains developers and implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files,\nspin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat.\nKeep in mind that this is a lot slower than MockVM and you cannot use the debugger.\nThis is why MockVM was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("p",null,"Where ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," is the name of the backend we are using in this example. If the build process\nfinishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder."),(0,r.kt)("h2",{id:"updating-dependencies"},"Updating dependencies"),(0,r.kt)("p",null,"You will learn later, that the project using Odra contains more than one Rust project - your own and\none or more builders. To run ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo update")," on all of them at once instead of traversing all the folders\nyou can use this command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra update\n")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/2c824dec.00faeb2d.js b/docs/assets/js/2c824dec.00faeb2d.js new file mode 100644 index 000000000..f9aca4f44 --- /dev/null +++ b/docs/assets/js/2c824dec.00faeb2d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[88367],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),p=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=r,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(f,s(s({ref:n},c),{},{components:t})):a.createElement(f,s({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,s=new Array(o);s[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:3},s="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.5.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.5.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.5.0/tutorials/erc20",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.5.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.5.0/tutorials/owned-token"}},i={},p=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"erc-20"},"ERC-20"),(0,r.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,r.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value. "),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"advanced storage - key-value pairs, "),(0,r.kt)("li",{parentName:"ul"},"Odra types like ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),", "),(0,r.kt)("li",{parentName:"ul"},"advanced events assertion.")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Our module has a pretty complex storage layout in comparison to the previous example."),(0,r.kt)("p",null,"We need to store the following data:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol and decimals."),(0,r.kt)("li",{parentName:"ol"},"Total supply."),(0,r.kt)("li",{parentName:"ol"},"Users' balances."),(0,r.kt)("li",{parentName:"ol"},"Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.")),(0,r.kt)("h2",{id:"module-definition"},"Module definition"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,r.kt)("inlineCode",{parentName:"li"},"mapping"),". You may notice the ",(0,r.kt)("inlineCode",{parentName:"li"},"balances")," property maps ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," to ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),". If you deal with addresses or you operate on tokens, you should always choose ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," over ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Odra allows nested ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),"s, what we utilize to store allowances.")),(0,r.kt)("h3",{id:"metadata"},"Metadata"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.balances.add(address, *amount);\n self.total_supply.add(amount);\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: Balance\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3-L10")," - A constructor sets the token metadata and mints the initial supply."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12-L14")," - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," example, we used the ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returning an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function and the contract does not fail even if the value is not initialized."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29")," - The second ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," is not an odra module, in other words these function will not be a part of contract's ABI."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30-L39")," - Mint function is public, so like in a regular rust code will be accessible from the outside. ",(0,r.kt)("inlineCode",{parentName:"li"},"mint()")," use notation ",(0,r.kt)("inlineCode",{parentName:"li"},"self.balances.add(&address, amount);"),", which it is syntactic sugar for:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let current_balance = self.balances.get(&address).unwrap_or_default();\nlet new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();\nself.balances.set(&address, new_balance);\n")),(0,r.kt)("h3",{id:"core"},"Core"),(0,r.kt)("p",null,"For the sake of completeness, let's implement the remaining functionalities like ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_from"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"approve"),". They are not introducing any new concepts, so we leave them without additional remarks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs",title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let spender = contract_env::caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n let owner = contract_env::caller();\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n contract_env::revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .get_instance(owner)\n .set(spender, new_allowance);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,r.kt)("p",null,"Now, compare the code we have written, with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};\n use odra::{assert_events, test_env, types::U256};\n\n pub const NAME: &str = "Plascoin";\n pub const SYMBOL: &str = "PLS";\n pub const DECIMALS: u8 = 10;\n pub const INITIAL_SUPPLY: u32 = 10_000;\n\n pub fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n String::from(NAME),\n String::from(SYMBOL),\n DECIMALS,\n INITIAL_SUPPLY.into()\n )\n }\n\n #[test]\n fn initialization() {\n let erc20 = setup();\n\n assert_eq!(&erc20.symbol(), SYMBOL);\n assert_eq!(&erc20.name(), NAME);\n assert_eq!(erc20.decimals(), DECIMALS);\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n let mut erc20 = setup();\n let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n erc20.transfer(&recipient, &amount);\n\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n assert_eq!(erc20.balance_of(&recipient), amount);\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n let mut erc20 = setup();\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);\n\n test_env::assert_exception(Error::InsufficientBalance, || {\n erc20.transfer(&recipient, &amount)\n });\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let mut erc20 = setup();\n let (owner, recipient, spender) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount\n }\n );\n\n // Spender transfers tokens from Owner to Recipient.\n test_env::set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n );\n \n assert_events!(erc20, Approval, Transfer);\n }\n\n #[test]\n fn transfer_from_error() {\n let mut erc20 = setup();\n let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n test_env::set_caller(spender);\n test_env::assert_exception(Error::InsufficientAllowance, || {\n erc20.transfer_from(&owner, &spender, &amount)\n });\n }\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L111-123")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events!()")," macro accepts multiple events. You must pass them in the order they were emitted. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L125")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"You can not mix both approaches, you pass full events or types only.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"Having two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/2fe15297.2add7442.js b/docs/assets/js/2fe15297.2add7442.js new file mode 100644 index 000000000..ee9a35536 --- /dev/null +++ b/docs/assets/js/2fe15297.2add7442.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52111],{21388:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.7.0","label":"0.7.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.7.0","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.7.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.7.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.7.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.7.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.7.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.7.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.7.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.7.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.7.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.7.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.7.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.7.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.7.0/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.7.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.7.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.7.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.7.0/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Module reusing","href":"/docs/0.7.0/advanced/using","docId":"advanced/using"},{"type":"link","label":"Delegate","href":"/docs/0.7.0/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.7.0/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.7.0/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Signatures","href":"/docs/0.7.0/advanced/signatures","docId":"advanced/signatures"}],"href":"/docs/0.7.0/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.7.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"MockVM","href":"/docs/0.7.0/backends/mock-vm","docId":"backends/mock-vm"},{"type":"link","label":"Casper","href":"/docs/0.7.0/backends/casper","docId":"backends/casper"}],"href":"/docs/0.7.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.7.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.7.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.7.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.7.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.7.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.7.0/tutorials/owned-token","docId":"tutorials/owned-token"},{"type":"link","label":"Access Control","href":"/docs/0.7.0/tutorials/access-control","docId":"tutorials/access-control"},{"type":"link","label":"Pausable","href":"/docs/0.7.0/tutorials/pauseable","docId":"tutorials/pauseable"}],"href":"/docs/0.7.0/category/tutorials"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/signatures":{"id":"advanced/signatures","title":"Signatures","description":"As each backend can use a different scheme for generating key pairs,","sidebar":"tutorialSidebar"},"advanced/using":{"id":"advanced/using","title":"Module reusing","description":"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/mock-vm":{"id":"backends/mock-vm","title":"MockVM","description":"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"tutorials/access-control":{"id":"tutorials/access-control","title":"Access Control","description":"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"},"tutorials/pauseable":{"id":"tutorials/pauseable","title":"Pausable","description":"The Pausable module is like your smart contract\'s safety switch. It lets authorized users temporarily pause certain features if needed. It\'s a great way to boost security, but it\'s not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/3129ff44.72d42a77.js b/docs/assets/js/3129ff44.72d42a77.js new file mode 100644 index 000000000..f27adff8a --- /dev/null +++ b/docs/assets/js/3129ff44.72d42a77.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[6367],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,m=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.3.1/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.3.1/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.3.1/backends/what-is-a-backend",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.3.1/category/backends"},next:{title:"MockVM",permalink:"/docs/0.3.1/backends/mock-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Test Env",id:"test-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/backends/mock-vm"},"MockVM"),",\nor a complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/backends/casper"},"CasperVM"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/31372b4d.9f500a79.js b/docs/assets/js/31372b4d.9f500a79.js new file mode 100644 index 000000000..342a407a6 --- /dev/null +++ b/docs/assets/js/31372b4d.9f500a79.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52675],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>c});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(a),c=r,f=m["".concat(l,".").concat(c)]||m[c]||d[c]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.9.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.9.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.9.0/basics/storage-interaction",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.9.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.9.0/basics/communicating-with-host"}},l={},p=[{value:"Var",id:"var",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"var"},"Var"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Var,\n weight: Var,\n name: Var,\n walks: Var>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::Var;\n\n#[odra::module]\nimpl DogContract {\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is used to store and access data as key-value pairs. To define a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{Mapping, Var};\n\n#[odra::module]\npub struct DogContract2 {\n name: Var,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," we use a similar approach\nto the one shown in the Vars section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Var working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{List, Var};\n\npub struct List {\n values: Mapping,\n index: Var\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Var,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the Odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/features/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must add ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. Let's see how to implement a ",(0,r.kt)("inlineCode",{parentName:"p"},"Dog")," type: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each custom typed field of your struct must be marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute .")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3152febb.c41e5ef3.js b/docs/assets/js/3152febb.c41e5ef3.js new file mode 100644 index 000000000..2505a59fa --- /dev/null +++ b/docs/assets/js/3152febb.c41e5ef3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[60225],{43492:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/"},"next":{"title":"Installation","permalink":"/docs/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/31959af2.7b5be119.js b/docs/assets/js/31959af2.7b5be119.js new file mode 100644 index 000000000..4ab3ee830 --- /dev/null +++ b/docs/assets/js/31959af2.7b5be119.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53911],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,h=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(h,i(i({ref:t},d),{},{components:n})):a.createElement(h,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.9.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.9.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.9.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.9.0/category/backends"},next:{title:"OdraVM",permalink:"/docs/0.9.0/backends/odra-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Host Env",id:"host-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/odra-vm"},"OdraVM"),",\na complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/casper"},"CasperVM"),",\nor even a real blockchain - when using ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/casper"},"Livenet backend"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"host-env"},"Host Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/32572.8d89fc67.js b/docs/assets/js/32572.8d89fc67.js new file mode 100644 index 000000000..9a6389937 --- /dev/null +++ b/docs/assets/js/32572.8d89fc67.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[32572],{32572:(e,s,a)=>{a.r(s)}}]); \ No newline at end of file diff --git a/docs/assets/js/32993410.56acc780.js b/docs/assets/js/32993410.56acc780.js new file mode 100644 index 000000000..c9815c26b --- /dev/null +++ b/docs/assets/js/32993410.56acc780.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[75510],{65216:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.5.0/category/examples","navigation":{"previous":{"title":"Casper","permalink":"/docs/0.5.0/backends/casper"},"next":{"title":"odra-examples","permalink":"/docs/0.5.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/32e511f4.78ddb0b4.js b/docs/assets/js/32e511f4.78ddb0b4.js new file mode 100644 index 000000000..89eb7a4cf --- /dev/null +++ b/docs/assets/js/32e511f4.78ddb0b4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[20248],{86365:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.9.1/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.9.1/basics/native-token"},"next":{"title":"Delegate","permalink":"/docs/0.9.1/advanced/delegate"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/33762072.6a8f15e1.js b/docs/assets/js/33762072.6a8f15e1.js new file mode 100644 index 000000000..440b67074 --- /dev/null +++ b/docs/assets/js/33762072.6a8f15e1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[27669],{82154:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.3.1","label":"0.3.1","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.3.1","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.3.1/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.3.1/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.3.1/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.3.1/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.3.1/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.3.1/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.3.1/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.3.1/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.3.1/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.3.1/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.3.1/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.3.1/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.3.1/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.3.1/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.3.1/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.3.1/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.3.1/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Module Composer","href":"/docs/0.3.1/advanced/composer","docId":"advanced/composer"},{"type":"link","label":"Delegate","href":"/docs/0.3.1/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.3.1/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.3.1/advanced/attributes","docId":"advanced/attributes"}],"href":"/docs/0.3.1/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.3.1/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"MockVM","href":"/docs/0.3.1/backends/mock-vm","docId":"backends/mock-vm"},{"type":"link","label":"Casper","href":"/docs/0.3.1/backends/casper","docId":"backends/casper"}],"href":"/docs/0.3.1/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.3.1/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.3.1/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.3.1/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.3.1/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.3.1/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.3.1/tutorials/owned-token","docId":"tutorials/owned-token"}],"href":"/docs/0.3.1/category/tutorials"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.","sidebar":"tutorialSidebar"},"advanced/composer":{"id":"advanced/composer","title":"Module Composer","description":"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/mock-vm":{"id":"backends/mock-vm","title":"MockVM","description":"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/33e7c3de.c7ec380c.js b/docs/assets/js/33e7c3de.c7ec380c.js new file mode 100644 index 000000000..05eb8aabd --- /dev/null +++ b/docs/assets/js/33e7c3de.c7ec380c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[23914],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.7.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.7.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.7.0/backends/casper",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"MockVM",permalink:"/docs/0.7.0/backends/mock-vm"},next:{title:"Examples",permalink:"/docs/0.7.0/category/examples"}},l={},p=[{value:"Types",id:"types",level:2},{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Constructors",id:"constructors",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Contract Deploys",id:"contract-deploys",level:2},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"types"},"Types"),(0,r.kt)("p",null,"A struct to be written into the storage must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait OdraType: \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("p",null,"The other exposed types are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CallArgs")," - wraps around casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"RuntimeArgs")),";"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," - U512 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"BlockTime")," - u64 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Address")," - an enum that encapsulates casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/account/struct.AccountHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"AccountHash"))," and ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/struct.ContractPackageHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractPackageHash")))),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"SerializableEvent")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait SerializableEvent: \n odra_types::event::OdraEvent + \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance, you call ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_balance"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("p",null,"Let's define a basic Odra module that includes a constructor:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\nstruct Counter {\n value: Variable\n}\n\n#[odra::module]\nimpl Counter {\n #[odra(init)]\n pub initialize(&mut self, value: u32) {\n self.value.set(value);\n }\n}\n")),(0,r.kt)("p",null,"Read more about constructors ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/advanced/attributes#init"},"here"),"."),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you have to specify following arguments."),(0,r.kt)("p",null,"Required arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Optional arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. If the contract has the constructor entry point marked with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]"),", this should be set to the constructor name."),(0,r.kt)("li",{parentName:"ul"},"constructor arguments that match entry point set in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor"),".")),(0,r.kt)("h2",{id:"contract-deploys"},"Contract Deploys"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "odra_cfg_constructor:string:\'initialize\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.5.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.5.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.4.0/odra-casper/livenet/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"Option")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/backends/mock-vm"},"MockVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/34731735.3ab0e6a8.js b/docs/assets/js/34731735.3ab0e6a8.js new file mode 100644 index 000000000..b2ce406fa --- /dev/null +++ b/docs/assets/js/34731735.3ab0e6a8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[15604],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),i=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=i(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,c=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=i(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var i=2;i{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>i});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:11,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/docs/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/next/basics/cross-calls",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Casper Contract Schema",permalink:"/docs/next/basics/casper-contract-schema"},next:{title:"Modules",permalink:"/docs/next/basics/modules"}},c={},i=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Loading the contract",id:"loading-the-contract",level:3},{value:"Testing",id:"testing",level:2}],d={toc:i};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::prelude::*;\nuse odra::{Address, UnwrapOrRevert, Var};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Var
\n}\n\n#[odra::module]\nimpl CrossContract {\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());\n MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine;\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To perform a cross-contact call, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"HostRef")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/testing"},"Testing")," article - a host side reference to already deployed contract."),(0,r.kt)("p",null,"In the module context we use a ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractRef")," instead, to call other contracts."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," is generated automatically,\nby the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("p",null,"To obtain an instance of a contract reference, we simply call the constructor - ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env: Rc, address: Address)"),", as shown above."),(0,r.kt)("p",null,"The reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), and the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::address()")," function, which returns the address of the contract."),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderContractRef")," struct (and ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderHostRef")," to be used in tests, but do not implement the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer")," trait). Having an address, in the module context we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"AdderContractRef::new(self.env(), address).add(3, 5)\n")),(0,r.kt)("h3",{id:"loading-the-contract"},"Loading the contract"),(0,r.kt)("p",null,"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test\nour contracts in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/livenet"},"Livenet")," backend. We can load the contract using ",(0,r.kt)("inlineCode",{parentName:"p"},"load")," method on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/bin/erc20_on_livenet.rs"',title:'"examples/bin/erc20_on_livenet.rs"'},'fn _load(env: &HostEnv) -> Erc20HostRef {\n let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n let address = Address::from_str(address).unwrap();\n ::load(env, address)\n}\n')),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};\n use odra::host::{Deployer, HostRef, NoArgs};\n\n #[test]\n fn test_cross_calls() {\n let test_env = odra_test::env();\n let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);\n let cross_contract = CrossContractHostRef::deploy(\n &test_env,\n CrossContractInitArgs {\n math_engine_address: *math_engine_contract.address()\n }\n );\n assert_eq!(cross_contract.add_using_another(), 8);\n }\n}\n")),(0,r.kt)("p",null,"Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that we intend to utilize."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{Address, host::{Deployer, HostRef, NoArgs}};\n \n #[test]\n fn test_ext() {\n let test_env = odra_test::env();\n let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address(test_env: &HostEnv) -> Address {\n let contract = MathEngineHostRef::deploy(test_env, NoArgs);\n *contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3593900a.4e34e084.js b/docs/assets/js/3593900a.4e34e084.js new file mode 100644 index 000000000..7959d616a --- /dev/null +++ b/docs/assets/js/3593900a.4e34e084.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[15376],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),h=c(n),u=o,m=h["".concat(s,".").concat(u)]||h[u]||p[u]||r;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:3},i="Livenet",l={unversionedId:"backends/livenet",id:"version-0.9.1/backends/livenet",title:"Livenet",description:"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local",source:"@site/versioned_docs/version-0.9.1/backends/04-livenet.md",sourceDirName:"backends",slug:"/backends/livenet",permalink:"/docs/0.9.1/backends/livenet",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Casper",permalink:"/docs/0.9.1/backends/casper"},next:{title:"Examples",permalink:"/docs/0.9.1/category/examples"}},s={},c=[{value:"Setup",id:"setup",level:2},{value:"Usage",id:"usage",level:2},{value:"How Livenet backend works",id:"how-livenet-backend-works",level:2},{value:"Multiple environments",id:"multiple-environments",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"livenet"},"Livenet"),(0,o.kt)("p",null,"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local\ntest node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend\nto handle the deployment of your contracts to the real blockchain."),(0,o.kt)("p",null,"Furthermore, it is implemented in a similarly to Casper or OdraVM,\nhowever, it uses a real blockchain to deploy contracts and store the state.\nThis lets us use Odra to deploy and test contracts on a real blockchain, but\non the other hand, it comes with some limitations on what can be done in the tests."),(0,o.kt)("p",null,"The main differences between Livenet and e.g. CasperVM backend are:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Real CSPR tokens are used to deploy and call contracts. This also means that we need to\npay for each contract deployment and each contract call. Of course, we can use the ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/tools/faucet"},"faucet"),"\nto get some tokens for testing purposes, but we still need to specify the amount needed\nfor each action."),(0,o.kt)("li",{parentName:"ul"},"The contract state is stored on the real blockchain, so we can't just reset the state -\nwe can redeploy the contract, but we can't remove the old one."),(0,o.kt)("li",{parentName:"ul"},"Because of the above, we can load the existing contracts and use them in the tests."),(0,o.kt)("li",{parentName:"ul"},"We have no control over the block time. This means that for example, ",(0,o.kt)("inlineCode",{parentName:"li"},"advance_block_time")," function\nis implemented by waiting for the real time to pass.")),(0,o.kt)("p",null,"This is also a cause for the fact that the Livenet backend cannot be (yet) used for running\nthe regular Odra tests. Instead, we can create integration tests or binaries which will\nuse a slightly different workflow to test the contracts."),(0,o.kt)("h2",{id:"setup"},"Setup"),(0,o.kt)("p",null,"To use Livenet backend, we need to provide Odra with some information - the network address, our private\nkey and the name of the chain we want to use. Optionally, we can add multiple private keys to use\nmore than one account in our tests. Those values are passed using environment variables. We can use .env\nfile to store them - let's take a look at an example .env file, created from the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/examples/.env.sample"},".env.sample")," file from\nexamples folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env"},"# Path to the secret key of the account that will be used\n# to deploy the contracts.\n# We're using .keys folder so we don't accidentally commit\n# the secret key to the repository.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777\n\n# Chain name of the network. Known values:\n# - integration-test\nODRA_CASPER_LIVENET_CHAIN_NAME=integration-test\n\n# Paths to the secret keys of the additional accounts.\n# Main secret key will be 0th account.\nODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem\nODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem\n")),(0,o.kt)("p",null,"With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find\na simple binary that deploys a contract and calls it. The test is located in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/examples/bin/erc20_on_livenet.rs"},"erc20_on_livenet.rs")," file.\nLet's go through the code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // Similar to the OdraVM backend, we need to initialize\n // the environment:\n let env = odra_casper_livenet_env::env();\n\n // Most of the for the host env works the same as in the\n // OdraVM backend.\n let owner = env.caller();\n // Addresses are the real addresses on the blockchain,\n // so we need to provide them\n // if we did not import their secret keys.\n let recipient = \n "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Arguments for the contract init method.\n let name = String::from("Plascoin");\n let symbol = String::from("PLS");\n let decimals = 10u8;\n let initial_supply: U256 = U256::from(10_000);\n \n // The main difference between other backends - we need to specify\n // the gas limit for each action.\n // The limit will be used for every consecutive action\n // until we change it.\n env.set_gas(100_000_000_000u64);\n \n // Deploy the contract. The API is the same as in the OdraVM backend.\n let init_args = Erc20InitArgs {\n name,\n symbol,\n decimals,\n initial_supply: Some(initial_supply)\n };\n let mut token = Erc20HostRef::deploy(env, init_args);\n \n // We can now use the contract as we would in the OdraVM backend.\n println!("Token address: {}", token.address().to_string());\n\n // Uncomment to load existing contract.\n // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n // let address = Address::from_str(address).unwrap();\n // We use the Livenet-specific `load` method to load the contract\n // that is already deployed.\n // let mut token = Erc20Deployer::load(env, address);\n\n // Non-mutable calls are free! Neat, huh? More on that later.\n println!("Token name: {}", token.name());\n\n // The next call is mutable, but the cost is lower that the deployment,\n // so we change the amount of gas\n env.set_gas(3_000_000_000u64);\n token.transfer(recipient, U256::from(1000));\n\n println!("Owner\'s balance: {:?}", token.balance_of(owner));\n println!("Recipient\'s balance: {:?}", token.balance_of(recipient));\n}\n')),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The above example is a rust binary, not a test. Note that it is also added as a section of the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[bin]\nname = "erc20_on_livenet"\npath = "src/bin/erc20_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n'))),(0,o.kt)("h2",{id:"usage"},"Usage"),(0,o.kt)("p",null,"To run the above code, we simply need to run the binary with the ",(0,o.kt)("inlineCode",{parentName:"p"},"livenet")," feature enabled:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Before executing the binary, make sure you built a wasm file.")),(0,o.kt)("p",null,"A part of a sample output should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'...\n\ud83d\udc81 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\udc81 INFO : Deploy "65b1a5d21..." successfully executed.\nOwner\'s balance: 4004\nRecipient\'s balance: 4000\n')),(0,o.kt)("p",null,"Those logs are a result of the last 4 lines of the above listing.\nEach deployment or a call to the blockchain will be noted and will take some time to execute.\nWe can see that the ",(0,o.kt)("inlineCode",{parentName:"p"},"transfer")," call took over 15 seconds to execute. But calling ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," was nearly instant\nand cost us nothing. How it is possible?"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You can see the deployment on ",(0,o.kt)("a",{parentName:"p",href:"http://cspr.live/"},"http://cspr.live/")," - the transfer from the example\ncan be seen ",(0,o.kt)("a",{parentName:"p",href:"https://integration.cspr.live/deploy/65b1a5d21174a62c675f89683aba995c453b942c705b404a1f8bbf6f0f6de32a"},"here"),".")),(0,o.kt)("h2",{id:"how-livenet-backend-works"},"How Livenet backend works"),(0,o.kt)("p",null,"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state.\nIt is possible however to query the state of the blockchain for free."),(0,o.kt)("p",null,"This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the\nnode is the current state. This is why the ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," call was almost instant and free."),(0,o.kt)("p",null,"Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract\n(see ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/cross-calls"},"Cross Calls"),"), it is executed offline and\nnode is used for the state query only. However, the Livenet needs to know the connection between the contracts\nand the code, so make sure to deploy or load already deployed contracts"),(0,o.kt)("h2",{id:"multiple-environments"},"Multiple environments"),(0,o.kt)("p",null,"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts,\nmultiple nodes or even multiple chains."),(0,o.kt)("p",null,"To do this, simply create a new ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with a different prefix - for example, ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet.env"),".\nThen, pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"ODRA_CASPER_LIVENET_ENV")," variable with value either ",(0,o.kt)("inlineCode",{parentName:"p"},"integration")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet")," to select which file\nhas to be used first. If your ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file has a value that IS present in the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file, it will\noverride the value from the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene\n")),(0,o.kt)("p",null,"To sum up - this command will firstly load the ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file and then load the missing values from ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/35d161a3.f591f5a6.js b/docs/assets/js/35d161a3.f591f5a6.js new file mode 100644 index 000000000..78864ddaa --- /dev/null +++ b/docs/assets/js/35d161a3.f591f5a6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[57464],{3905:(e,r,n)=>{n.d(r,{Zo:()=>u,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},u=function(e){var r=p(e.components);return t.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||o;return n?t.createElement(f,s(s({ref:r},u),{},{components:n})):t.createElement(f,s({ref:r},u))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var p=2;p{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.8.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.8.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.8.0/basics/errors",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.8.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.8.0/basics/events"}},l={},p=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},u,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::prelude::*;\nuse odra::{Address, OdraError, Var};\n\n#[odra::module]\npub struct OwnedContract {\n name: Var,\n owner: Var
\n}\n\n#[derive(OdraError)]\npub enum Error {\n OwnerNotSet = 1,\n NotAnOwner = 2\n}\n\n#[odra::module]\nimpl OwnedContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = self.env().caller();\n if caller != self.owner() {\n self.env().revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n\n")),(0,a.kt)("p",null,"Firstly, we are using the ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive attribute to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.env().revert(Error::NotAnOwner)\n")),(0,a.kt)("p",null,"Defining an error in Odra, you must keep in mind a few rules:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"An error should be a field-less enum. "),(0,a.kt)("li",{parentName:"ol"},"The enum must derive from ",(0,a.kt)("inlineCode",{parentName:"li"},"OdraError"),"."),(0,a.kt)("li",{parentName:"ol"},"Avoid implicit discriminants.")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'#[cfg(test)]\nmod tests {\n use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};\n use odra::host::Deployer;\n use odra::prelude::*;\n\n #[test]\n fn test_owner_error() {\n let test_env = odra_test::env();\n let owner = test_env.get_account(0);\n let not_an_owner = test_env.get_account(1);\n\n test_env.set_caller(owner);\n let init_args = OwnedContractInitArgs {\n name: "OwnedContract".to_string()\n };\n let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);\n\n test_env.set_caller(not_an_owner);\n assert_eq!(\n owned_contract.try_change_name("NewName".to_string()),\n Err(Error::NotAnOwner.into())\n );\n }\n}\n')),(0,a.kt)("p",null,"Each ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," has ",(0,a.kt)("inlineCode",{parentName:"p"},"try_{{entry_point_name}}")," functions that return an ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult")),".\n",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractHostRef")," implements regular entrypoints: ",(0,a.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),", and\nand safe its safe version: ",(0,a.kt)("inlineCode",{parentName:"p"},"try_name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name"),"."),(0,a.kt)("p",null,"In our example, we are calling ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name")," and expecting an error to be thrown.\nFor assertions, we are using a standard ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro. As the contract call returns an ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError"),",\nwe need to convert our custom error to ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," using ",(0,a.kt)("inlineCode",{parentName:"p"},"Into::into()"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/366.c9035d12.js b/docs/assets/js/366.c9035d12.js new file mode 100644 index 000000000..8bdddd3c3 --- /dev/null +++ b/docs/assets/js/366.c9035d12.js @@ -0,0 +1,42106 @@ +exports.id = 366; +exports.ids = [366]; +exports.modules = { + +/***/ 84182: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(__webpack_require__(82241)); + else {} +})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __nested_webpack_require_643__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_643__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_643__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __nested_webpack_require_643__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __nested_webpack_require_643__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __nested_webpack_require_643__.d = function(exports, name, getter) { +/******/ if(!__nested_webpack_require_643__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __nested_webpack_require_643__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __nested_webpack_require_643__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __nested_webpack_require_643__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_643__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_643__(__nested_webpack_require_643__.s = 7); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_0__; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __nested_webpack_require_3185__) { + +"use strict"; + + +var FDLayoutConstants = __nested_webpack_require_3185__(0).FDLayoutConstants; + +function CoSEConstants() {} + +//CoSEConstants inherits static props in FDLayoutConstants +for (var prop in FDLayoutConstants) { + CoSEConstants[prop] = FDLayoutConstants[prop]; +} + +CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false; +CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH; +CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60; +CoSEConstants.TILE = true; +CoSEConstants.TILING_PADDING_VERTICAL = 10; +CoSEConstants.TILING_PADDING_HORIZONTAL = 10; +CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false; // make this true when cose is used incrementally as a part of other non-incremental layout + +module.exports = CoSEConstants; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __nested_webpack_require_4002__) { + +"use strict"; + + +var FDLayoutEdge = __nested_webpack_require_4002__(0).FDLayoutEdge; + +function CoSEEdge(source, target, vEdge) { + FDLayoutEdge.call(this, source, target, vEdge); +} + +CoSEEdge.prototype = Object.create(FDLayoutEdge.prototype); +for (var prop in FDLayoutEdge) { + CoSEEdge[prop] = FDLayoutEdge[prop]; +} + +module.exports = CoSEEdge; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __nested_webpack_require_4409__) { + +"use strict"; + + +var LGraph = __nested_webpack_require_4409__(0).LGraph; + +function CoSEGraph(parent, graphMgr, vGraph) { + LGraph.call(this, parent, graphMgr, vGraph); +} + +CoSEGraph.prototype = Object.create(LGraph.prototype); +for (var prop in LGraph) { + CoSEGraph[prop] = LGraph[prop]; +} + +module.exports = CoSEGraph; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __nested_webpack_require_4790__) { + +"use strict"; + + +var LGraphManager = __nested_webpack_require_4790__(0).LGraphManager; + +function CoSEGraphManager(layout) { + LGraphManager.call(this, layout); +} + +CoSEGraphManager.prototype = Object.create(LGraphManager.prototype); +for (var prop in LGraphManager) { + CoSEGraphManager[prop] = LGraphManager[prop]; +} + +module.exports = CoSEGraphManager; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __nested_webpack_require_5205__) { + +"use strict"; + + +var FDLayoutNode = __nested_webpack_require_5205__(0).FDLayoutNode; +var IMath = __nested_webpack_require_5205__(0).IMath; + +function CoSENode(gm, loc, size, vNode) { + FDLayoutNode.call(this, gm, loc, size, vNode); +} + +CoSENode.prototype = Object.create(FDLayoutNode.prototype); +for (var prop in FDLayoutNode) { + CoSENode[prop] = FDLayoutNode[prop]; +} + +CoSENode.prototype.move = function () { + var layout = this.graphManager.getLayout(); + this.displacementX = layout.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren; + this.displacementY = layout.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren; + + if (Math.abs(this.displacementX) > layout.coolingFactor * layout.maxNodeDisplacement) { + this.displacementX = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementX); + } + + if (Math.abs(this.displacementY) > layout.coolingFactor * layout.maxNodeDisplacement) { + this.displacementY = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementY); + } + + // a simple node, just move it + if (this.child == null) { + this.moveBy(this.displacementX, this.displacementY); + } + // an empty compound node, again just move it + else if (this.child.getNodes().length == 0) { + this.moveBy(this.displacementX, this.displacementY); + } + // non-empty compound node, propogate movement to children as well + else { + this.propogateDisplacementToChildren(this.displacementX, this.displacementY); + } + + layout.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY); + + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + this.displacementX = 0; + this.displacementY = 0; +}; + +CoSENode.prototype.propogateDisplacementToChildren = function (dX, dY) { + var nodes = this.getChild().getNodes(); + var node; + for (var i = 0; i < nodes.length; i++) { + node = nodes[i]; + if (node.getChild() == null) { + node.moveBy(dX, dY); + node.displacementX += dX; + node.displacementY += dY; + } else { + node.propogateDisplacementToChildren(dX, dY); + } + } +}; + +CoSENode.prototype.setPred1 = function (pred1) { + this.pred1 = pred1; +}; + +CoSENode.prototype.getPred1 = function () { + return pred1; +}; + +CoSENode.prototype.getPred2 = function () { + return pred2; +}; + +CoSENode.prototype.setNext = function (next) { + this.next = next; +}; + +CoSENode.prototype.getNext = function () { + return next; +}; + +CoSENode.prototype.setProcessed = function (processed) { + this.processed = processed; +}; + +CoSENode.prototype.isProcessed = function () { + return processed; +}; + +module.exports = CoSENode; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __nested_webpack_require_8085__) { + +"use strict"; + + +var FDLayout = __nested_webpack_require_8085__(0).FDLayout; +var CoSEGraphManager = __nested_webpack_require_8085__(4); +var CoSEGraph = __nested_webpack_require_8085__(3); +var CoSENode = __nested_webpack_require_8085__(5); +var CoSEEdge = __nested_webpack_require_8085__(2); +var CoSEConstants = __nested_webpack_require_8085__(1); +var FDLayoutConstants = __nested_webpack_require_8085__(0).FDLayoutConstants; +var LayoutConstants = __nested_webpack_require_8085__(0).LayoutConstants; +var Point = __nested_webpack_require_8085__(0).Point; +var PointD = __nested_webpack_require_8085__(0).PointD; +var Layout = __nested_webpack_require_8085__(0).Layout; +var Integer = __nested_webpack_require_8085__(0).Integer; +var IGeometry = __nested_webpack_require_8085__(0).IGeometry; +var LGraph = __nested_webpack_require_8085__(0).LGraph; +var Transform = __nested_webpack_require_8085__(0).Transform; + +function CoSELayout() { + FDLayout.call(this); + + this.toBeTiled = {}; // Memorize if a node is to be tiled or is tiled +} + +CoSELayout.prototype = Object.create(FDLayout.prototype); + +for (var prop in FDLayout) { + CoSELayout[prop] = FDLayout[prop]; +} + +CoSELayout.prototype.newGraphManager = function () { + var gm = new CoSEGraphManager(this); + this.graphManager = gm; + return gm; +}; + +CoSELayout.prototype.newGraph = function (vGraph) { + return new CoSEGraph(null, this.graphManager, vGraph); +}; + +CoSELayout.prototype.newNode = function (vNode) { + return new CoSENode(this.graphManager, vNode); +}; + +CoSELayout.prototype.newEdge = function (vEdge) { + return new CoSEEdge(null, null, vEdge); +}; + +CoSELayout.prototype.initParameters = function () { + FDLayout.prototype.initParameters.call(this, arguments); + if (!this.isSubLayout) { + if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) { + this.idealEdgeLength = 10; + } else { + this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH; + } + + this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH; + this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + + // variables for tree reduction support + this.prunedNodesAll = []; + this.growTreeIterations = 0; + this.afterGrowthIterations = 0; + this.isTreeGrowing = false; + this.isGrowthFinished = false; + + // variables for cooling + this.coolingCycle = 0; + this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD; + this.finalTemperature = FDLayoutConstants.CONVERGENCE_CHECK_PERIOD / this.maxIterations; + this.coolingAdjuster = 1; + } +}; + +CoSELayout.prototype.layout = function () { + var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + if (createBendsAsNeeded) { + this.createBendpoints(); + this.graphManager.resetAllEdges(); + } + + this.level = 0; + return this.classicLayout(); +}; + +CoSELayout.prototype.classicLayout = function () { + this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(); + this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity); + this.calcNoOfChildrenForAllNodes(); + this.graphManager.calcLowestCommonAncestors(); + this.graphManager.calcInclusionTreeDepths(); + this.graphManager.getRoot().calcEstimatedSize(); + this.calcIdealEdgeLengths(); + + if (!this.incremental) { + var forest = this.getFlatForest(); + + // The graph associated with this layout is flat and a forest + if (forest.length > 0) { + this.positionNodesRadially(forest); + } + // The graph associated with this layout is not flat or a forest + else { + // Reduce the trees when incremental mode is not enabled and graph is not a forest + this.reduceTrees(); + // Update nodes that gravity will be applied + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection = this.nodesWithGravity.filter(function (x) { + return allNodes.has(x); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection); + + this.positionNodesRandomly(); + } + } else { + if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) { + // Reduce the trees in incremental mode if only this constant is set to true + this.reduceTrees(); + // Update nodes that gravity will be applied + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection = this.nodesWithGravity.filter(function (x) { + return allNodes.has(x); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection); + } + } + + this.initSpringEmbedder(); + this.runSpringEmbedder(); + + return true; +}; + +CoSELayout.prototype.tick = function () { + this.totalIterations++; + + if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + + if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.isConverged()) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + + this.coolingCycle++; + + if (this.layoutQuality == 0) { + // quality - "draft" + this.coolingAdjuster = this.coolingCycle; + } else if (this.layoutQuality == 1) { + // quality - "default" + this.coolingAdjuster = this.coolingCycle / 3; + } + + // cooling schedule is based on http://www.btluke.com/simanf1.html -> cooling schedule 3 + this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature); + this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor)); + } + // Operations while tree is growing again + if (this.isTreeGrowing) { + if (this.growTreeIterations % 10 == 0) { + if (this.prunedNodesAll.length > 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + this.growTree(this.prunedNodesAll); + // Update nodes that gravity will be applied + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection = this.nodesWithGravity.filter(function (x) { + return allNodes.has(x); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection); + + this.graphManager.updateBounds(); + this.updateGrid(); + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + } else { + this.isTreeGrowing = false; + this.isGrowthFinished = true; + } + } + this.growTreeIterations++; + } + // Operations after growth is finished + if (this.isGrowthFinished) { + if (this.isConverged()) { + return true; + } + if (this.afterGrowthIterations % 10 == 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + } + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100); + this.afterGrowthIterations++; + } + + var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished; + var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished; + + this.totalDisplacement = 0; + this.graphManager.updateBounds(); + this.calcSpringForces(); + this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate); + this.calcGravitationalForces(); + this.moveNodes(); + this.animate(); + + return false; // Layout is not ended yet return false +}; + +CoSELayout.prototype.getPositionsData = function () { + var allNodes = this.graphManager.getAllNodes(); + var pData = {}; + for (var i = 0; i < allNodes.length; i++) { + var rect = allNodes[i].rect; + var id = allNodes[i].id; + pData[id] = { + id: id, + x: rect.getCenterX(), + y: rect.getCenterY(), + w: rect.width, + h: rect.height + }; + } + + return pData; +}; + +CoSELayout.prototype.runSpringEmbedder = function () { + this.initialAnimationPeriod = 25; + this.animationPeriod = this.initialAnimationPeriod; + var layoutEnded = false; + + // If aminate option is 'during' signal that layout is supposed to start iterating + if (FDLayoutConstants.ANIMATE === 'during') { + this.emit('layoutstarted'); + } else { + // If aminate option is 'during' tick() function will be called on index.js + while (!layoutEnded) { + layoutEnded = this.tick(); + } + + this.graphManager.updateBounds(); + } +}; + +CoSELayout.prototype.calculateNodesToApplyGravitationTo = function () { + var nodeList = []; + var graph; + + var graphs = this.graphManager.getGraphs(); + var size = graphs.length; + var i; + for (i = 0; i < size; i++) { + graph = graphs[i]; + + graph.updateConnected(); + + if (!graph.isConnected) { + nodeList = nodeList.concat(graph.getNodes()); + } + } + + return nodeList; +}; + +CoSELayout.prototype.createBendpoints = function () { + var edges = []; + edges = edges.concat(this.graphManager.getAllEdges()); + var visited = new Set(); + var i; + for (i = 0; i < edges.length; i++) { + var edge = edges[i]; + + if (!visited.has(edge)) { + var source = edge.getSource(); + var target = edge.getTarget(); + + if (source == target) { + edge.getBendpoints().push(new PointD()); + edge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(edge); + visited.add(edge); + } else { + var edgeList = []; + + edgeList = edgeList.concat(source.getEdgeListToNode(target)); + edgeList = edgeList.concat(target.getEdgeListToNode(source)); + + if (!visited.has(edgeList[0])) { + if (edgeList.length > 1) { + var k; + for (k = 0; k < edgeList.length; k++) { + var multiEdge = edgeList[k]; + multiEdge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(multiEdge); + } + } + edgeList.forEach(function (edge) { + visited.add(edge); + }); + } + } + } + + if (visited.size == edges.length) { + break; + } + } +}; + +CoSELayout.prototype.positionNodesRadially = function (forest) { + // We tile the trees to a grid row by row; first tree starts at (0,0) + var currentStartingPoint = new Point(0, 0); + var numberOfColumns = Math.ceil(Math.sqrt(forest.length)); + var height = 0; + var currentY = 0; + var currentX = 0; + var point = new PointD(0, 0); + + for (var i = 0; i < forest.length; i++) { + if (i % numberOfColumns == 0) { + // Start of a new row, make the x coordinate 0, increment the + // y coordinate with the max height of the previous row + currentX = 0; + currentY = height; + + if (i != 0) { + currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION; + } + + height = 0; + } + + var tree = forest[i]; + + // Find the center of the tree + var centerNode = Layout.findCenterOfTree(tree); + + // Set the staring point of the next tree + currentStartingPoint.x = currentX; + currentStartingPoint.y = currentY; + + // Do a radial layout starting with the center + point = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint); + + if (point.y > height) { + height = Math.floor(point.y); + } + + currentX = Math.floor(point.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION); + } + + this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point.x / 2, LayoutConstants.WORLD_CENTER_Y - point.y / 2)); +}; + +CoSELayout.radialLayout = function (tree, centerNode, startingPoint) { + var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION); + CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep); + var bounds = LGraph.calculateBounds(tree); + + var transform = new Transform(); + transform.setDeviceOrgX(bounds.getMinX()); + transform.setDeviceOrgY(bounds.getMinY()); + transform.setWorldOrgX(startingPoint.x); + transform.setWorldOrgY(startingPoint.y); + + for (var i = 0; i < tree.length; i++) { + var node = tree[i]; + node.transform(transform); + } + + var bottomRight = new PointD(bounds.getMaxX(), bounds.getMaxY()); + + return transform.inverseTransformPoint(bottomRight); +}; + +CoSELayout.branchRadialLayout = function (node, parentOfNode, startAngle, endAngle, distance, radialSeparation) { + // First, position this node by finding its angle. + var halfInterval = (endAngle - startAngle + 1) / 2; + + if (halfInterval < 0) { + halfInterval += 180; + } + + var nodeAngle = (halfInterval + startAngle) % 360; + var teta = nodeAngle * IGeometry.TWO_PI / 360; + + // Make polar to java cordinate conversion. + var cos_teta = Math.cos(teta); + var x_ = distance * Math.cos(teta); + var y_ = distance * Math.sin(teta); + + node.setCenter(x_, y_); + + // Traverse all neighbors of this node and recursively call this + // function. + var neighborEdges = []; + neighborEdges = neighborEdges.concat(node.getEdges()); + var childCount = neighborEdges.length; + + if (parentOfNode != null) { + childCount--; + } + + var branchCount = 0; + + var incEdgesCount = neighborEdges.length; + var startIndex; + + var edges = node.getEdgesBetween(parentOfNode); + + // If there are multiple edges, prune them until there remains only one + // edge. + while (edges.length > 1) { + //neighborEdges.remove(edges.remove(0)); + var temp = edges[0]; + edges.splice(0, 1); + var index = neighborEdges.indexOf(temp); + if (index >= 0) { + neighborEdges.splice(index, 1); + } + incEdgesCount--; + childCount--; + } + + if (parentOfNode != null) { + //assert edges.length == 1; + startIndex = (neighborEdges.indexOf(edges[0]) + 1) % incEdgesCount; + } else { + startIndex = 0; + } + + var stepAngle = Math.abs(endAngle - startAngle) / childCount; + + for (var i = startIndex; branchCount != childCount; i = ++i % incEdgesCount) { + var currentNeighbor = neighborEdges[i].getOtherEnd(node); + + // Don't back traverse to root node in current tree. + if (currentNeighbor == parentOfNode) { + continue; + } + + var childStartAngle = (startAngle + branchCount * stepAngle) % 360; + var childEndAngle = (childStartAngle + stepAngle) % 360; + + CoSELayout.branchRadialLayout(currentNeighbor, node, childStartAngle, childEndAngle, distance + radialSeparation, radialSeparation); + + branchCount++; + } +}; + +CoSELayout.maxDiagonalInTree = function (tree) { + var maxDiagonal = Integer.MIN_VALUE; + + for (var i = 0; i < tree.length; i++) { + var node = tree[i]; + var diagonal = node.getDiagonal(); + + if (diagonal > maxDiagonal) { + maxDiagonal = diagonal; + } + } + + return maxDiagonal; +}; + +CoSELayout.prototype.calcRepulsionRange = function () { + // formula is 2 x (level + 1) x idealEdgeLength + return 2 * (this.level + 1) * this.idealEdgeLength; +}; + +// Tiling methods + +// Group zero degree members whose parents are not to be tiled, create dummy parents where needed and fill memberGroups by their dummp parent id's +CoSELayout.prototype.groupZeroDegreeMembers = function () { + var self = this; + // array of [parent_id x oneDegreeNode_id] + var tempMemberGroups = {}; // A temporary map of parent node and its zero degree members + this.memberGroups = {}; // A map of dummy parent node and its zero degree members whose parents are not to be tiled + this.idToDummyNode = {}; // A map of id to dummy node + + var zeroDegree = []; // List of zero degree nodes whose parents are not to be tiled + var allNodes = this.graphManager.getAllNodes(); + + // Fill zero degree list + for (var i = 0; i < allNodes.length; i++) { + var node = allNodes[i]; + var parent = node.getParent(); + // If a node has zero degree and its parent is not to be tiled if exists add that node to zeroDegres list + if (this.getNodeDegreeWithChildren(node) === 0 && (parent.id == undefined || !this.getToBeTiled(parent))) { + zeroDegree.push(node); + } + } + + // Create a map of parent node and its zero degree members + for (var i = 0; i < zeroDegree.length; i++) { + var node = zeroDegree[i]; // Zero degree node itself + var p_id = node.getParent().id; // Parent id + + if (typeof tempMemberGroups[p_id] === "undefined") tempMemberGroups[p_id] = []; + + tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node); // Push node to the list belongs to its parent in tempMemberGroups + } + + // If there are at least two nodes at a level, create a dummy compound for them + Object.keys(tempMemberGroups).forEach(function (p_id) { + if (tempMemberGroups[p_id].length > 1) { + var dummyCompoundId = "DummyCompound_" + p_id; // The id of dummy compound which will be created soon + self.memberGroups[dummyCompoundId] = tempMemberGroups[p_id]; // Add dummy compound to memberGroups + + var parent = tempMemberGroups[p_id][0].getParent(); // The parent of zero degree nodes will be the parent of new dummy compound + + // Create a dummy compound with calculated id + var dummyCompound = new CoSENode(self.graphManager); + dummyCompound.id = dummyCompoundId; + dummyCompound.paddingLeft = parent.paddingLeft || 0; + dummyCompound.paddingRight = parent.paddingRight || 0; + dummyCompound.paddingBottom = parent.paddingBottom || 0; + dummyCompound.paddingTop = parent.paddingTop || 0; + + self.idToDummyNode[dummyCompoundId] = dummyCompound; + + var dummyParentGraph = self.getGraphManager().add(self.newGraph(), dummyCompound); + var parentGraph = parent.getChild(); + + // Add dummy compound to parent the graph + parentGraph.add(dummyCompound); + + // For each zero degree node in this level remove it from its parent graph and add it to the graph of dummy parent + for (var i = 0; i < tempMemberGroups[p_id].length; i++) { + var node = tempMemberGroups[p_id][i]; + + parentGraph.remove(node); + dummyParentGraph.add(node); + } + } + }); +}; + +CoSELayout.prototype.clearCompounds = function () { + var childGraphMap = {}; + var idToNode = {}; + + // Get compound ordering by finding the inner one first + this.performDFSOnCompounds(); + + for (var i = 0; i < this.compoundOrder.length; i++) { + + idToNode[this.compoundOrder[i].id] = this.compoundOrder[i]; + childGraphMap[this.compoundOrder[i].id] = [].concat(this.compoundOrder[i].getChild().getNodes()); + + // Remove children of compounds + this.graphManager.remove(this.compoundOrder[i].getChild()); + this.compoundOrder[i].child = null; + } + + this.graphManager.resetAllNodes(); + + // Tile the removed children + this.tileCompoundMembers(childGraphMap, idToNode); +}; + +CoSELayout.prototype.clearZeroDegreeMembers = function () { + var self = this; + var tiledZeroDegreePack = this.tiledZeroDegreePack = []; + + Object.keys(this.memberGroups).forEach(function (id) { + var compoundNode = self.idToDummyNode[id]; // Get the dummy compound + + tiledZeroDegreePack[id] = self.tileNodes(self.memberGroups[id], compoundNode.paddingLeft + compoundNode.paddingRight); + + // Set the width and height of the dummy compound as calculated + compoundNode.rect.width = tiledZeroDegreePack[id].width; + compoundNode.rect.height = tiledZeroDegreePack[id].height; + }); +}; + +CoSELayout.prototype.repopulateCompounds = function () { + for (var i = this.compoundOrder.length - 1; i >= 0; i--) { + var lCompoundNode = this.compoundOrder[i]; + var id = lCompoundNode.id; + var horizontalMargin = lCompoundNode.paddingLeft; + var verticalMargin = lCompoundNode.paddingTop; + + this.adjustLocations(this.tiledMemberPack[id], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin); + } +}; + +CoSELayout.prototype.repopulateZeroDegreeMembers = function () { + var self = this; + var tiledPack = this.tiledZeroDegreePack; + + Object.keys(tiledPack).forEach(function (id) { + var compoundNode = self.idToDummyNode[id]; // Get the dummy compound by its id + var horizontalMargin = compoundNode.paddingLeft; + var verticalMargin = compoundNode.paddingTop; + + // Adjust the positions of nodes wrt its compound + self.adjustLocations(tiledPack[id], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin); + }); +}; + +CoSELayout.prototype.getToBeTiled = function (node) { + var id = node.id; + //firstly check the previous results + if (this.toBeTiled[id] != null) { + return this.toBeTiled[id]; + } + + //only compound nodes are to be tiled + var childGraph = node.getChild(); + if (childGraph == null) { + this.toBeTiled[id] = false; + return false; + } + + var children = childGraph.getNodes(); // Get the children nodes + + //a compound node is not to be tiled if all of its compound children are not to be tiled + for (var i = 0; i < children.length; i++) { + var theChild = children[i]; + + if (this.getNodeDegree(theChild) > 0) { + this.toBeTiled[id] = false; + return false; + } + + //pass the children not having the compound structure + if (theChild.getChild() == null) { + this.toBeTiled[theChild.id] = false; + continue; + } + + if (!this.getToBeTiled(theChild)) { + this.toBeTiled[id] = false; + return false; + } + } + this.toBeTiled[id] = true; + return true; +}; + +// Get degree of a node depending of its edges and independent of its children +CoSELayout.prototype.getNodeDegree = function (node) { + var id = node.id; + var edges = node.getEdges(); + var degree = 0; + + // For the edges connected + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + if (edge.getSource().id !== edge.getTarget().id) { + degree = degree + 1; + } + } + return degree; +}; + +// Get degree of a node with its children +CoSELayout.prototype.getNodeDegreeWithChildren = function (node) { + var degree = this.getNodeDegree(node); + if (node.getChild() == null) { + return degree; + } + var children = node.getChild().getNodes(); + for (var i = 0; i < children.length; i++) { + var child = children[i]; + degree += this.getNodeDegreeWithChildren(child); + } + return degree; +}; + +CoSELayout.prototype.performDFSOnCompounds = function () { + this.compoundOrder = []; + this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes()); +}; + +CoSELayout.prototype.fillCompexOrderByDFS = function (children) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.getChild() != null) { + this.fillCompexOrderByDFS(child.getChild().getNodes()); + } + if (this.getToBeTiled(child)) { + this.compoundOrder.push(child); + } + } +}; + +/** +* This method places each zero degree member wrt given (x,y) coordinates (top left). +*/ +CoSELayout.prototype.adjustLocations = function (organization, x, y, compoundHorizontalMargin, compoundVerticalMargin) { + x += compoundHorizontalMargin; + y += compoundVerticalMargin; + + var left = x; + + for (var i = 0; i < organization.rows.length; i++) { + var row = organization.rows[i]; + x = left; + var maxHeight = 0; + + for (var j = 0; j < row.length; j++) { + var lnode = row[j]; + + lnode.rect.x = x; // + lnode.rect.width / 2; + lnode.rect.y = y; // + lnode.rect.height / 2; + + x += lnode.rect.width + organization.horizontalPadding; + + if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height; + } + + y += maxHeight + organization.verticalPadding; + } +}; + +CoSELayout.prototype.tileCompoundMembers = function (childGraphMap, idToNode) { + var self = this; + this.tiledMemberPack = []; + + Object.keys(childGraphMap).forEach(function (id) { + // Get the compound node + var compoundNode = idToNode[id]; + + self.tiledMemberPack[id] = self.tileNodes(childGraphMap[id], compoundNode.paddingLeft + compoundNode.paddingRight); + + compoundNode.rect.width = self.tiledMemberPack[id].width; + compoundNode.rect.height = self.tiledMemberPack[id].height; + }); +}; + +CoSELayout.prototype.tileNodes = function (nodes, minWidth) { + var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL; + var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL; + var organization = { + rows: [], + rowWidth: [], + rowHeight: [], + width: 0, + height: minWidth, // assume minHeight equals to minWidth + verticalPadding: verticalPadding, + horizontalPadding: horizontalPadding + }; + + // Sort the nodes in ascending order of their areas + nodes.sort(function (n1, n2) { + if (n1.rect.width * n1.rect.height > n2.rect.width * n2.rect.height) return -1; + if (n1.rect.width * n1.rect.height < n2.rect.width * n2.rect.height) return 1; + return 0; + }); + + // Create the organization -> tile members + for (var i = 0; i < nodes.length; i++) { + var lNode = nodes[i]; + + if (organization.rows.length == 0) { + this.insertNodeToRow(organization, lNode, 0, minWidth); + } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) { + this.insertNodeToRow(organization, lNode, this.getShortestRowIndex(organization), minWidth); + } else { + this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth); + } + + this.shiftToLastRow(organization); + } + + return organization; +}; + +CoSELayout.prototype.insertNodeToRow = function (organization, node, rowIndex, minWidth) { + var minCompoundSize = minWidth; + + // Add new row if needed + if (rowIndex == organization.rows.length) { + var secondDimension = []; + + organization.rows.push(secondDimension); + organization.rowWidth.push(minCompoundSize); + organization.rowHeight.push(0); + } + + // Update row width + var w = organization.rowWidth[rowIndex] + node.rect.width; + + if (organization.rows[rowIndex].length > 0) { + w += organization.horizontalPadding; + } + + organization.rowWidth[rowIndex] = w; + // Update compound width + if (organization.width < w) { + organization.width = w; + } + + // Update height + var h = node.rect.height; + if (rowIndex > 0) h += organization.verticalPadding; + + var extraHeight = 0; + if (h > organization.rowHeight[rowIndex]) { + extraHeight = organization.rowHeight[rowIndex]; + organization.rowHeight[rowIndex] = h; + extraHeight = organization.rowHeight[rowIndex] - extraHeight; + } + + organization.height += extraHeight; + + // Insert node + organization.rows[rowIndex].push(node); +}; + +//Scans the rows of an organization and returns the one with the min width +CoSELayout.prototype.getShortestRowIndex = function (organization) { + var r = -1; + var min = Number.MAX_VALUE; + + for (var i = 0; i < organization.rows.length; i++) { + if (organization.rowWidth[i] < min) { + r = i; + min = organization.rowWidth[i]; + } + } + return r; +}; + +//Scans the rows of an organization and returns the one with the max width +CoSELayout.prototype.getLongestRowIndex = function (organization) { + var r = -1; + var max = Number.MIN_VALUE; + + for (var i = 0; i < organization.rows.length; i++) { + + if (organization.rowWidth[i] > max) { + r = i; + max = organization.rowWidth[i]; + } + } + + return r; +}; + +/** +* This method checks whether adding extra width to the organization violates +* the aspect ratio(1) or not. +*/ +CoSELayout.prototype.canAddHorizontal = function (organization, extraWidth, extraHeight) { + + var sri = this.getShortestRowIndex(organization); + + if (sri < 0) { + return true; + } + + var min = organization.rowWidth[sri]; + + if (min + organization.horizontalPadding + extraWidth <= organization.width) return true; + + var hDiff = 0; + + // Adding to an existing row + if (organization.rowHeight[sri] < extraHeight) { + if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri]; + } + + var add_to_row_ratio; + if (organization.width - min >= extraWidth + organization.horizontalPadding) { + add_to_row_ratio = (organization.height + hDiff) / (min + extraWidth + organization.horizontalPadding); + } else { + add_to_row_ratio = (organization.height + hDiff) / organization.width; + } + + // Adding a new row for this node + hDiff = extraHeight + organization.verticalPadding; + var add_new_row_ratio; + if (organization.width < extraWidth) { + add_new_row_ratio = (organization.height + hDiff) / extraWidth; + } else { + add_new_row_ratio = (organization.height + hDiff) / organization.width; + } + + if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio; + + if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio; + + return add_to_row_ratio < add_new_row_ratio; +}; + +//If moving the last node from the longest row and adding it to the last +//row makes the bounding box smaller, do it. +CoSELayout.prototype.shiftToLastRow = function (organization) { + var longest = this.getLongestRowIndex(organization); + var last = organization.rowWidth.length - 1; + var row = organization.rows[longest]; + var node = row[row.length - 1]; + + var diff = node.width + organization.horizontalPadding; + + // Check if there is enough space on the last row + if (organization.width - organization.rowWidth[last] > diff && longest != last) { + // Remove the last element of the longest row + row.splice(-1, 1); + + // Push it to the last row + organization.rows[last].push(node); + + organization.rowWidth[longest] = organization.rowWidth[longest] - diff; + organization.rowWidth[last] = organization.rowWidth[last] + diff; + organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)]; + + // Update heights of the organization + var maxHeight = Number.MIN_VALUE; + for (var i = 0; i < row.length; i++) { + if (row[i].height > maxHeight) maxHeight = row[i].height; + } + if (longest > 0) maxHeight += organization.verticalPadding; + + var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last]; + + organization.rowHeight[longest] = maxHeight; + if (organization.rowHeight[last] < node.height + organization.verticalPadding) organization.rowHeight[last] = node.height + organization.verticalPadding; + + var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last]; + organization.height += finalTotal - prevTotal; + + this.shiftToLastRow(organization); + } +}; + +CoSELayout.prototype.tilingPreLayout = function () { + if (CoSEConstants.TILE) { + // Find zero degree nodes and create a compound for each level + this.groupZeroDegreeMembers(); + // Tile and clear children of each compound + this.clearCompounds(); + // Separately tile and clear zero degree nodes for each level + this.clearZeroDegreeMembers(); + } +}; + +CoSELayout.prototype.tilingPostLayout = function () { + if (CoSEConstants.TILE) { + this.repopulateZeroDegreeMembers(); + this.repopulateCompounds(); + } +}; + +// ----------------------------------------------------------------------------- +// Section: Tree Reduction methods +// ----------------------------------------------------------------------------- +// Reduce trees +CoSELayout.prototype.reduceTrees = function () { + var prunedNodesAll = []; + var containsLeaf = true; + var node; + + while (containsLeaf) { + var allNodes = this.graphManager.getAllNodes(); + var prunedNodesInStepTemp = []; + containsLeaf = false; + + for (var i = 0; i < allNodes.length; i++) { + node = allNodes[i]; + if (node.getEdges().length == 1 && !node.getEdges()[0].isInterGraph && node.getChild() == null) { + prunedNodesInStepTemp.push([node, node.getEdges()[0], node.getOwner()]); + containsLeaf = true; + } + } + if (containsLeaf == true) { + var prunedNodesInStep = []; + for (var j = 0; j < prunedNodesInStepTemp.length; j++) { + if (prunedNodesInStepTemp[j][0].getEdges().length == 1) { + prunedNodesInStep.push(prunedNodesInStepTemp[j]); + prunedNodesInStepTemp[j][0].getOwner().remove(prunedNodesInStepTemp[j][0]); + } + } + prunedNodesAll.push(prunedNodesInStep); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); + } + } + this.prunedNodesAll = prunedNodesAll; +}; + +// Grow tree one step +CoSELayout.prototype.growTree = function (prunedNodesAll) { + var lengthOfPrunedNodesInStep = prunedNodesAll.length; + var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1]; + + var nodeData; + for (var i = 0; i < prunedNodesInStep.length; i++) { + nodeData = prunedNodesInStep[i]; + + this.findPlaceforPrunedNode(nodeData); + + nodeData[2].add(nodeData[0]); + nodeData[2].add(nodeData[1], nodeData[1].source, nodeData[1].target); + } + + prunedNodesAll.splice(prunedNodesAll.length - 1, 1); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); +}; + +// Find an appropriate position to replace pruned node, this method can be improved +CoSELayout.prototype.findPlaceforPrunedNode = function (nodeData) { + + var gridForPrunedNode; + var nodeToConnect; + var prunedNode = nodeData[0]; + if (prunedNode == nodeData[1].source) { + nodeToConnect = nodeData[1].target; + } else { + nodeToConnect = nodeData[1].source; + } + var startGridX = nodeToConnect.startX; + var finishGridX = nodeToConnect.finishX; + var startGridY = nodeToConnect.startY; + var finishGridY = nodeToConnect.finishY; + + var upNodeCount = 0; + var downNodeCount = 0; + var rightNodeCount = 0; + var leftNodeCount = 0; + var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount]; + + if (startGridY > 0) { + for (var i = startGridX; i <= finishGridX; i++) { + controlRegions[0] += this.grid[i][startGridY - 1].length + this.grid[i][startGridY].length - 1; + } + } + if (finishGridX < this.grid.length - 1) { + for (var i = startGridY; i <= finishGridY; i++) { + controlRegions[1] += this.grid[finishGridX + 1][i].length + this.grid[finishGridX][i].length - 1; + } + } + if (finishGridY < this.grid[0].length - 1) { + for (var i = startGridX; i <= finishGridX; i++) { + controlRegions[2] += this.grid[i][finishGridY + 1].length + this.grid[i][finishGridY].length - 1; + } + } + if (startGridX > 0) { + for (var i = startGridY; i <= finishGridY; i++) { + controlRegions[3] += this.grid[startGridX - 1][i].length + this.grid[startGridX][i].length - 1; + } + } + var min = Integer.MAX_VALUE; + var minCount; + var minIndex; + for (var j = 0; j < controlRegions.length; j++) { + if (controlRegions[j] < min) { + min = controlRegions[j]; + minCount = 1; + minIndex = j; + } else if (controlRegions[j] == min) { + minCount++; + } + } + + if (minCount == 3 && min == 0) { + if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) { + gridForPrunedNode = 1; + } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 0; + } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 3; + } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 2; + } + } else if (minCount == 2 && min == 0) { + var random = Math.floor(Math.random() * 2); + if (controlRegions[0] == 0 && controlRegions[1] == 0) { + ; + if (random == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 1; + } + } else if (controlRegions[0] == 0 && controlRegions[2] == 0) { + if (random == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[0] == 0 && controlRegions[3] == 0) { + if (random == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 3; + } + } else if (controlRegions[1] == 0 && controlRegions[2] == 0) { + if (random == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[1] == 0 && controlRegions[3] == 0) { + if (random == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 3; + } + } else { + if (random == 0) { + gridForPrunedNode = 2; + } else { + gridForPrunedNode = 3; + } + } + } else if (minCount == 4 && min == 0) { + var random = Math.floor(Math.random() * 4); + gridForPrunedNode = random; + } else { + gridForPrunedNode = minIndex; + } + + if (gridForPrunedNode == 0) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2); + } else if (gridForPrunedNode == 1) { + prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } else if (gridForPrunedNode == 2) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2); + } else { + prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } +}; + +module.exports = CoSELayout; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __nested_webpack_require_45620__) { + +"use strict"; + + +var coseBase = {}; + +coseBase.layoutBase = __nested_webpack_require_45620__(0); +coseBase.CoSEConstants = __nested_webpack_require_45620__(1); +coseBase.CoSEEdge = __nested_webpack_require_45620__(2); +coseBase.CoSEGraph = __nested_webpack_require_45620__(3); +coseBase.CoSEGraphManager = __nested_webpack_require_45620__(4); +coseBase.CoSELayout = __nested_webpack_require_45620__(6); +coseBase.CoSENode = __nested_webpack_require_45620__(5); + +module.exports = coseBase; + +/***/ }) +/******/ ]); +}); + +/***/ }), + +/***/ 14607: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(__webpack_require__(84182)); + else {} +})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __nested_webpack_require_659__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_659__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_659__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __nested_webpack_require_659__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __nested_webpack_require_659__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __nested_webpack_require_659__.d = function(exports, name, getter) { +/******/ if(!__nested_webpack_require_659__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __nested_webpack_require_659__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __nested_webpack_require_659__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __nested_webpack_require_659__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_659__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_659__(__nested_webpack_require_659__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_0__; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __nested_webpack_require_3201__) { + +"use strict"; + + +var LayoutConstants = __nested_webpack_require_3201__(0).layoutBase.LayoutConstants; +var FDLayoutConstants = __nested_webpack_require_3201__(0).layoutBase.FDLayoutConstants; +var CoSEConstants = __nested_webpack_require_3201__(0).CoSEConstants; +var CoSELayout = __nested_webpack_require_3201__(0).CoSELayout; +var CoSENode = __nested_webpack_require_3201__(0).CoSENode; +var PointD = __nested_webpack_require_3201__(0).layoutBase.PointD; +var DimensionD = __nested_webpack_require_3201__(0).layoutBase.DimensionD; + +var defaults = { + // Called on `layoutready` + ready: function ready() {}, + // Called on `layoutstop` + stop: function stop() {}, + // 'draft', 'default' or 'proof" + // - 'draft' fast cooling rate + // - 'default' moderate cooling rate + // - "proof" slow cooling rate + quality: 'default', + // include labels in node dimensions + nodeDimensionsIncludeLabels: false, + // number of ticks per frame; higher is faster but more jerky + refresh: 30, + // Whether to fit the network view after when done + fit: true, + // Padding on fit + padding: 10, + // Whether to enable incremental mode + randomize: true, + // Node repulsion (non overlapping) multiplier + nodeRepulsion: 4500, + // Ideal edge (non nested) length + idealEdgeLength: 50, + // Divisor to compute edge forces + edgeElasticity: 0.45, + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 0.1, + // Gravity force (constant) + gravity: 0.25, + // Maximum number of iterations to perform + numIter: 2500, + // For enabling tiling + tile: true, + // Type of layout animation. The option set is {'during', 'end', false} + animate: 'end', + // Duration for animate:end + animationDuration: 500, + // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingVertical: 10, + // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingHorizontal: 10, + // Gravity range (constant) for compounds + gravityRangeCompound: 1.5, + // Gravity force (constant) for compounds + gravityCompound: 1.0, + // Gravity range (constant) + gravityRange: 3.8, + // Initial cooling factor for incremental layout + initialEnergyOnIncremental: 0.5 +}; + +function extend(defaults, options) { + var obj = {}; + + for (var i in defaults) { + obj[i] = defaults[i]; + } + + for (var i in options) { + obj[i] = options[i]; + } + + return obj; +}; + +function _CoSELayout(_options) { + this.options = extend(defaults, _options); + getUserOptions(this.options); +} + +var getUserOptions = function getUserOptions(options) { + if (options.nodeRepulsion != null) CoSEConstants.DEFAULT_REPULSION_STRENGTH = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = options.nodeRepulsion; + if (options.idealEdgeLength != null) CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = options.idealEdgeLength; + if (options.edgeElasticity != null) CoSEConstants.DEFAULT_SPRING_STRENGTH = FDLayoutConstants.DEFAULT_SPRING_STRENGTH = options.edgeElasticity; + if (options.nestingFactor != null) CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = options.nestingFactor; + if (options.gravity != null) CoSEConstants.DEFAULT_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = options.gravity; + if (options.numIter != null) CoSEConstants.MAX_ITERATIONS = FDLayoutConstants.MAX_ITERATIONS = options.numIter; + if (options.gravityRange != null) CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = options.gravityRange; + if (options.gravityCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = options.gravityCompound; + if (options.gravityRangeCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = options.gravityRangeCompound; + if (options.initialEnergyOnIncremental != null) CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = options.initialEnergyOnIncremental; + + if (options.quality == 'draft') LayoutConstants.QUALITY = 0;else if (options.quality == 'proof') LayoutConstants.QUALITY = 2;else LayoutConstants.QUALITY = 1; + + CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS = FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = options.nodeDimensionsIncludeLabels; + CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = !options.randomize; + CoSEConstants.ANIMATE = FDLayoutConstants.ANIMATE = LayoutConstants.ANIMATE = options.animate; + CoSEConstants.TILE = options.tile; + CoSEConstants.TILING_PADDING_VERTICAL = typeof options.tilingPaddingVertical === 'function' ? options.tilingPaddingVertical.call() : options.tilingPaddingVertical; + CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options.tilingPaddingHorizontal === 'function' ? options.tilingPaddingHorizontal.call() : options.tilingPaddingHorizontal; +}; + +_CoSELayout.prototype.run = function () { + var ready; + var frameId; + var options = this.options; + var idToLNode = this.idToLNode = {}; + var layout = this.layout = new CoSELayout(); + var self = this; + + self.stopped = false; + + this.cy = this.options.cy; + + this.cy.trigger({ type: 'layoutstart', layout: this }); + + var gm = layout.newGraphManager(); + this.gm = gm; + + var nodes = this.options.eles.nodes(); + var edges = this.options.eles.edges(); + + this.root = gm.addRoot(); + this.processChildrenList(this.root, this.getTopMostNodes(nodes), layout); + + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var sourceNode = this.idToLNode[edge.data("source")]; + var targetNode = this.idToLNode[edge.data("target")]; + if (sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length == 0) { + var e1 = gm.add(layout.newEdge(), sourceNode, targetNode); + e1.id = edge.id(); + } + } + + var getPositions = function getPositions(ele, i) { + if (typeof ele === "number") { + ele = i; + } + var theId = ele.data('id'); + var lNode = self.idToLNode[theId]; + + return { + x: lNode.getRect().getCenterX(), + y: lNode.getRect().getCenterY() + }; + }; + + /* + * Reposition nodes in iterations animatedly + */ + var iterateAnimated = function iterateAnimated() { + // Thigs to perform after nodes are repositioned on screen + var afterReposition = function afterReposition() { + if (options.fit) { + options.cy.fit(options.eles, options.padding); + } + + if (!ready) { + ready = true; + self.cy.one('layoutready', options.ready); + self.cy.trigger({ type: 'layoutready', layout: self }); + } + }; + + var ticksPerFrame = self.options.refresh; + var isDone; + + for (var i = 0; i < ticksPerFrame && !isDone; i++) { + isDone = self.stopped || self.layout.tick(); + } + + // If layout is done + if (isDone) { + // If the layout is not a sublayout and it is successful perform post layout. + if (layout.checkLayoutSuccess() && !layout.isSubLayout) { + layout.doPostLayout(); + } + + // If layout has a tilingPostLayout function property call it. + if (layout.tilingPostLayout) { + layout.tilingPostLayout(); + } + + layout.isLayoutFinished = true; + + self.options.eles.nodes().positions(getPositions); + + afterReposition(); + + // trigger layoutstop when the layout stops (e.g. finishes) + self.cy.one('layoutstop', self.options.stop); + self.cy.trigger({ type: 'layoutstop', layout: self }); + + if (frameId) { + cancelAnimationFrame(frameId); + } + + ready = false; + return; + } + + var animationData = self.layout.getPositionsData(); // Get positions of layout nodes note that all nodes may not be layout nodes because of tiling + + // Position nodes, for the nodes whose id does not included in data (because they are removed from their parents and included in dummy compounds) + // use position of their ancestors or dummy ancestors + options.eles.nodes().positions(function (ele, i) { + if (typeof ele === "number") { + ele = i; + } + // If ele is a compound node, then its position will be defined by its children + if (!ele.isParent()) { + var theId = ele.id(); + var pNode = animationData[theId]; + var temp = ele; + // If pNode is undefined search until finding position data of its first ancestor (It may be dummy as well) + while (pNode == null) { + pNode = animationData[temp.data('parent')] || animationData['DummyCompound_' + temp.data('parent')]; + animationData[theId] = pNode; + temp = temp.parent()[0]; + if (temp == undefined) { + break; + } + } + if (pNode != null) { + return { + x: pNode.x, + y: pNode.y + }; + } else { + return { + x: ele.position('x'), + y: ele.position('y') + }; + } + } + }); + + afterReposition(); + + frameId = requestAnimationFrame(iterateAnimated); + }; + + /* + * Listen 'layoutstarted' event and start animated iteration if animate option is 'during' + */ + layout.addListener('layoutstarted', function () { + if (self.options.animate === 'during') { + frameId = requestAnimationFrame(iterateAnimated); + } + }); + + layout.runLayout(); // Run cose layout + + /* + * If animate option is not 'during' ('end' or false) perform these here (If it is 'during' similar things are already performed) + */ + if (this.options.animate !== "during") { + self.options.eles.nodes().not(":parent").layoutPositions(self, self.options, getPositions); // Use layout positions to reposition the nodes it considers the options parameter + ready = false; + } + + return this; // chaining +}; + +//Get the top most ones of a list of nodes +_CoSELayout.prototype.getTopMostNodes = function (nodes) { + var nodesMap = {}; + for (var i = 0; i < nodes.length; i++) { + nodesMap[nodes[i].id()] = true; + } + var roots = nodes.filter(function (ele, i) { + if (typeof ele === "number") { + ele = i; + } + var parent = ele.parent()[0]; + while (parent != null) { + if (nodesMap[parent.id()]) { + return false; + } + parent = parent.parent()[0]; + } + return true; + }); + + return roots; +}; + +_CoSELayout.prototype.processChildrenList = function (parent, children, layout) { + var size = children.length; + for (var i = 0; i < size; i++) { + var theChild = children[i]; + var children_of_children = theChild.children(); + var theNode; + + var dimensions = theChild.layoutDimensions({ + nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels + }); + + if (theChild.outerWidth() != null && theChild.outerHeight() != null) { + theNode = parent.add(new CoSENode(layout.graphManager, new PointD(theChild.position('x') - dimensions.w / 2, theChild.position('y') - dimensions.h / 2), new DimensionD(parseFloat(dimensions.w), parseFloat(dimensions.h)))); + } else { + theNode = parent.add(new CoSENode(this.graphManager)); + } + // Attach id to the layout node + theNode.id = theChild.data("id"); + // Attach the paddings of cy node to layout node + theNode.paddingLeft = parseInt(theChild.css('padding')); + theNode.paddingTop = parseInt(theChild.css('padding')); + theNode.paddingRight = parseInt(theChild.css('padding')); + theNode.paddingBottom = parseInt(theChild.css('padding')); + + //Attach the label properties to compound if labels will be included in node dimensions + if (this.options.nodeDimensionsIncludeLabels) { + if (theChild.isParent()) { + var labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false }).w; + var labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false }).h; + var labelPos = theChild.css("text-halign"); + theNode.labelWidth = labelWidth; + theNode.labelHeight = labelHeight; + theNode.labelPos = labelPos; + } + } + + // Map the layout node + this.idToLNode[theChild.data("id")] = theNode; + + if (isNaN(theNode.rect.x)) { + theNode.rect.x = 0; + } + + if (isNaN(theNode.rect.y)) { + theNode.rect.y = 0; + } + + if (children_of_children != null && children_of_children.length > 0) { + var theNewGraph; + theNewGraph = layout.getGraphManager().add(layout.newGraph(), theNode); + this.processChildrenList(theNewGraph, children_of_children, layout); + } + } +}; + +/** + * @brief : called on continuous layouts to stop them before they finish + */ +_CoSELayout.prototype.stop = function () { + this.stopped = true; + + return this; // chaining +}; + +var register = function register(cytoscape) { + // var Layout = getLayout( cytoscape ); + + cytoscape('layout', 'cose-bilkent', _CoSELayout); +}; + +// auto reg for globals +if (typeof cytoscape !== 'undefined') { + register(cytoscape); +} + +module.exports = register; + +/***/ }) +/******/ ]); +}); + +/***/ }), + +/***/ 59058: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * Copyright (c) 2016-2022, The Cytoscape Consortium. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the “Software”), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + + +var debounce = __webpack_require__(23279); +var Heap = __webpack_require__(54485); +var get = __webpack_require__(27361); +var set = __webpack_require__(36968); +var toPath = __webpack_require__(30084); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce); +var Heap__default = /*#__PURE__*/_interopDefaultLegacy(Heap); +var get__default = /*#__PURE__*/_interopDefaultLegacy(get); +var set__default = /*#__PURE__*/_interopDefaultLegacy(set); +var toPath__default = /*#__PURE__*/_interopDefaultLegacy(toPath); + +function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +function _iterableToArrayLimit(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + + var _s, _e; + + try { + for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +var window$1 = typeof window === 'undefined' ? null : window; // eslint-disable-line no-undef + +var navigator = window$1 ? window$1.navigator : null; +window$1 ? window$1.document : null; + +var typeofstr = _typeof(''); + +var typeofobj = _typeof({}); + +var typeoffn = _typeof(function () {}); + +var typeofhtmlele = typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement); + +var instanceStr = function instanceStr(obj) { + return obj && obj.instanceString && fn$6(obj.instanceString) ? obj.instanceString() : null; +}; + +var string = function string(obj) { + return obj != null && _typeof(obj) == typeofstr; +}; +var fn$6 = function fn(obj) { + return obj != null && _typeof(obj) === typeoffn; +}; +var array = function array(obj) { + return !elementOrCollection(obj) && (Array.isArray ? Array.isArray(obj) : obj != null && obj instanceof Array); +}; +var plainObject = function plainObject(obj) { + return obj != null && _typeof(obj) === typeofobj && !array(obj) && obj.constructor === Object; +}; +var object = function object(obj) { + return obj != null && _typeof(obj) === typeofobj; +}; +var number$1 = function number(obj) { + return obj != null && _typeof(obj) === _typeof(1) && !isNaN(obj); +}; +var integer = function integer(obj) { + return number$1(obj) && Math.floor(obj) === obj; +}; +var htmlElement = function htmlElement(obj) { + if ('undefined' === typeofhtmlele) { + return undefined; + } else { + return null != obj && obj instanceof HTMLElement; + } +}; +var elementOrCollection = function elementOrCollection(obj) { + return element(obj) || collection(obj); +}; +var element = function element(obj) { + return instanceStr(obj) === 'collection' && obj._private.single; +}; +var collection = function collection(obj) { + return instanceStr(obj) === 'collection' && !obj._private.single; +}; +var core = function core(obj) { + return instanceStr(obj) === 'core'; +}; +var stylesheet = function stylesheet(obj) { + return instanceStr(obj) === 'stylesheet'; +}; +var event = function event(obj) { + return instanceStr(obj) === 'event'; +}; +var emptyString = function emptyString(obj) { + if (obj === undefined || obj === null) { + // null is empty + return true; + } else if (obj === '' || obj.match(/^\s+$/)) { + return true; // empty string is empty + } + + return false; // otherwise, we don't know what we've got +}; +var domElement = function domElement(obj) { + if (typeof HTMLElement === 'undefined') { + return false; // we're not in a browser so it doesn't matter + } else { + return obj instanceof HTMLElement; + } +}; +var boundingBox = function boundingBox(obj) { + return plainObject(obj) && number$1(obj.x1) && number$1(obj.x2) && number$1(obj.y1) && number$1(obj.y2); +}; +var promise = function promise(obj) { + return object(obj) && fn$6(obj.then); +}; +var ms = function ms() { + return navigator && navigator.userAgent.match(/msie|trident|edge/i); +}; // probably a better way to detect this... + +var memoize = function memoize(fn, keyFn) { + if (!keyFn) { + keyFn = function keyFn() { + if (arguments.length === 1) { + return arguments[0]; + } else if (arguments.length === 0) { + return 'undefined'; + } + + var args = []; + + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + + return args.join('$'); + }; + } + + var memoizedFn = function memoizedFn() { + var self = this; + var args = arguments; + var ret; + var k = keyFn.apply(self, args); + var cache = memoizedFn.cache; + + if (!(ret = cache[k])) { + ret = cache[k] = fn.apply(self, args); + } + + return ret; + }; + + memoizedFn.cache = {}; + return memoizedFn; +}; + +var camel2dash = memoize(function (str) { + return str.replace(/([A-Z])/g, function (v) { + return '-' + v.toLowerCase(); + }); +}); +var dash2camel = memoize(function (str) { + return str.replace(/(-\w)/g, function (v) { + return v[1].toUpperCase(); + }); +}); +var prependCamel = memoize(function (prefix, str) { + return prefix + str[0].toUpperCase() + str.substring(1); +}, function (prefix, str) { + return prefix + '$' + str; +}); +var capitalize = function capitalize(str) { + if (emptyString(str)) { + return str; + } + + return str.charAt(0).toUpperCase() + str.substring(1); +}; + +var number = '(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))'; +var rgba = 'rgb[a]?\\((' + number + '[%]?)\\s*,\\s*(' + number + '[%]?)\\s*,\\s*(' + number + '[%]?)(?:\\s*,\\s*(' + number + '))?\\)'; +var rgbaNoBackRefs = 'rgb[a]?\\((?:' + number + '[%]?)\\s*,\\s*(?:' + number + '[%]?)\\s*,\\s*(?:' + number + '[%]?)(?:\\s*,\\s*(?:' + number + '))?\\)'; +var hsla = 'hsl[a]?\\((' + number + ')\\s*,\\s*(' + number + '[%])\\s*,\\s*(' + number + '[%])(?:\\s*,\\s*(' + number + '))?\\)'; +var hslaNoBackRefs = 'hsl[a]?\\((?:' + number + ')\\s*,\\s*(?:' + number + '[%])\\s*,\\s*(?:' + number + '[%])(?:\\s*,\\s*(?:' + number + '))?\\)'; +var hex3 = '\\#[0-9a-fA-F]{3}'; +var hex6 = '\\#[0-9a-fA-F]{6}'; + +var ascending = function ascending(a, b) { + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else { + return 0; + } +}; +var descending = function descending(a, b) { + return -1 * ascending(a, b); +}; + +var extend = Object.assign != null ? Object.assign.bind(Object) : function (tgt) { + var args = arguments; + + for (var i = 1; i < args.length; i++) { + var obj = args[i]; + + if (obj == null) { + continue; + } + + var keys = Object.keys(obj); + + for (var j = 0; j < keys.length; j++) { + var k = keys[j]; + tgt[k] = obj[k]; + } + } + + return tgt; +}; + +var hex2tuple = function hex2tuple(hex) { + if (!(hex.length === 4 || hex.length === 7) || hex[0] !== '#') { + return; + } + + var shortHex = hex.length === 4; + var r, g, b; + var base = 16; + + if (shortHex) { + r = parseInt(hex[1] + hex[1], base); + g = parseInt(hex[2] + hex[2], base); + b = parseInt(hex[3] + hex[3], base); + } else { + r = parseInt(hex[1] + hex[2], base); + g = parseInt(hex[3] + hex[4], base); + b = parseInt(hex[5] + hex[6], base); + } + + return [r, g, b]; +}; // get [r, g, b, a] from hsl(0, 0, 0) or hsla(0, 0, 0, 0) + +var hsl2tuple = function hsl2tuple(hsl) { + var ret; + var h, s, l, a, r, g, b; + + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + + var m = new RegExp('^' + hsla + '$').exec(hsl); + + if (m) { + // get hue + h = parseInt(m[1]); + + if (h < 0) { + h = (360 - -1 * h % 360) % 360; + } else if (h > 360) { + h = h % 360; + } + + h /= 360; // normalise on [0, 1] + + s = parseFloat(m[2]); + + if (s < 0 || s > 100) { + return; + } // saturation is [0, 100] + + + s = s / 100; // normalise on [0, 1] + + l = parseFloat(m[3]); + + if (l < 0 || l > 100) { + return; + } // lightness is [0, 100] + + + l = l / 100; // normalise on [0, 1] + + a = m[4]; + + if (a !== undefined) { + a = parseFloat(a); + + if (a < 0 || a > 1) { + return; + } // alpha is [0, 1] + + } // now, convert to rgb + // code from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + + + if (s === 0) { + r = g = b = Math.round(l * 255); // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = Math.round(255 * hue2rgb(p, q, h + 1 / 3)); + g = Math.round(255 * hue2rgb(p, q, h)); + b = Math.round(255 * hue2rgb(p, q, h - 1 / 3)); + } + + ret = [r, g, b, a]; + } + + return ret; +}; // get [r, g, b, a] from rgb(0, 0, 0) or rgba(0, 0, 0, 0) + +var rgb2tuple = function rgb2tuple(rgb) { + var ret; + var m = new RegExp('^' + rgba + '$').exec(rgb); + + if (m) { + ret = []; + var isPct = []; + + for (var i = 1; i <= 3; i++) { + var channel = m[i]; + + if (channel[channel.length - 1] === '%') { + isPct[i] = true; + } + + channel = parseFloat(channel); + + if (isPct[i]) { + channel = channel / 100 * 255; // normalise to [0, 255] + } + + if (channel < 0 || channel > 255) { + return; + } // invalid channel value + + + ret.push(Math.floor(channel)); + } + + var atLeastOneIsPct = isPct[1] || isPct[2] || isPct[3]; + var allArePct = isPct[1] && isPct[2] && isPct[3]; + + if (atLeastOneIsPct && !allArePct) { + return; + } // must all be percent values if one is + + + var alpha = m[4]; + + if (alpha !== undefined) { + alpha = parseFloat(alpha); + + if (alpha < 0 || alpha > 1) { + return; + } // invalid alpha value + + + ret.push(alpha); + } + } + + return ret; +}; +var colorname2tuple = function colorname2tuple(color) { + return colors[color.toLowerCase()]; +}; +var color2tuple = function color2tuple(color) { + return (array(color) ? color : null) || colorname2tuple(color) || hex2tuple(color) || rgb2tuple(color) || hsl2tuple(color); +}; +var colors = { + // special colour names + transparent: [0, 0, 0, 0], + // NB alpha === 0 + // regular colours + aliceblue: [240, 248, 255], + antiquewhite: [250, 235, 215], + aqua: [0, 255, 255], + aquamarine: [127, 255, 212], + azure: [240, 255, 255], + beige: [245, 245, 220], + bisque: [255, 228, 196], + black: [0, 0, 0], + blanchedalmond: [255, 235, 205], + blue: [0, 0, 255], + blueviolet: [138, 43, 226], + brown: [165, 42, 42], + burlywood: [222, 184, 135], + cadetblue: [95, 158, 160], + chartreuse: [127, 255, 0], + chocolate: [210, 105, 30], + coral: [255, 127, 80], + cornflowerblue: [100, 149, 237], + cornsilk: [255, 248, 220], + crimson: [220, 20, 60], + cyan: [0, 255, 255], + darkblue: [0, 0, 139], + darkcyan: [0, 139, 139], + darkgoldenrod: [184, 134, 11], + darkgray: [169, 169, 169], + darkgreen: [0, 100, 0], + darkgrey: [169, 169, 169], + darkkhaki: [189, 183, 107], + darkmagenta: [139, 0, 139], + darkolivegreen: [85, 107, 47], + darkorange: [255, 140, 0], + darkorchid: [153, 50, 204], + darkred: [139, 0, 0], + darksalmon: [233, 150, 122], + darkseagreen: [143, 188, 143], + darkslateblue: [72, 61, 139], + darkslategray: [47, 79, 79], + darkslategrey: [47, 79, 79], + darkturquoise: [0, 206, 209], + darkviolet: [148, 0, 211], + deeppink: [255, 20, 147], + deepskyblue: [0, 191, 255], + dimgray: [105, 105, 105], + dimgrey: [105, 105, 105], + dodgerblue: [30, 144, 255], + firebrick: [178, 34, 34], + floralwhite: [255, 250, 240], + forestgreen: [34, 139, 34], + fuchsia: [255, 0, 255], + gainsboro: [220, 220, 220], + ghostwhite: [248, 248, 255], + gold: [255, 215, 0], + goldenrod: [218, 165, 32], + gray: [128, 128, 128], + grey: [128, 128, 128], + green: [0, 128, 0], + greenyellow: [173, 255, 47], + honeydew: [240, 255, 240], + hotpink: [255, 105, 180], + indianred: [205, 92, 92], + indigo: [75, 0, 130], + ivory: [255, 255, 240], + khaki: [240, 230, 140], + lavender: [230, 230, 250], + lavenderblush: [255, 240, 245], + lawngreen: [124, 252, 0], + lemonchiffon: [255, 250, 205], + lightblue: [173, 216, 230], + lightcoral: [240, 128, 128], + lightcyan: [224, 255, 255], + lightgoldenrodyellow: [250, 250, 210], + lightgray: [211, 211, 211], + lightgreen: [144, 238, 144], + lightgrey: [211, 211, 211], + lightpink: [255, 182, 193], + lightsalmon: [255, 160, 122], + lightseagreen: [32, 178, 170], + lightskyblue: [135, 206, 250], + lightslategray: [119, 136, 153], + lightslategrey: [119, 136, 153], + lightsteelblue: [176, 196, 222], + lightyellow: [255, 255, 224], + lime: [0, 255, 0], + limegreen: [50, 205, 50], + linen: [250, 240, 230], + magenta: [255, 0, 255], + maroon: [128, 0, 0], + mediumaquamarine: [102, 205, 170], + mediumblue: [0, 0, 205], + mediumorchid: [186, 85, 211], + mediumpurple: [147, 112, 219], + mediumseagreen: [60, 179, 113], + mediumslateblue: [123, 104, 238], + mediumspringgreen: [0, 250, 154], + mediumturquoise: [72, 209, 204], + mediumvioletred: [199, 21, 133], + midnightblue: [25, 25, 112], + mintcream: [245, 255, 250], + mistyrose: [255, 228, 225], + moccasin: [255, 228, 181], + navajowhite: [255, 222, 173], + navy: [0, 0, 128], + oldlace: [253, 245, 230], + olive: [128, 128, 0], + olivedrab: [107, 142, 35], + orange: [255, 165, 0], + orangered: [255, 69, 0], + orchid: [218, 112, 214], + palegoldenrod: [238, 232, 170], + palegreen: [152, 251, 152], + paleturquoise: [175, 238, 238], + palevioletred: [219, 112, 147], + papayawhip: [255, 239, 213], + peachpuff: [255, 218, 185], + peru: [205, 133, 63], + pink: [255, 192, 203], + plum: [221, 160, 221], + powderblue: [176, 224, 230], + purple: [128, 0, 128], + red: [255, 0, 0], + rosybrown: [188, 143, 143], + royalblue: [65, 105, 225], + saddlebrown: [139, 69, 19], + salmon: [250, 128, 114], + sandybrown: [244, 164, 96], + seagreen: [46, 139, 87], + seashell: [255, 245, 238], + sienna: [160, 82, 45], + silver: [192, 192, 192], + skyblue: [135, 206, 235], + slateblue: [106, 90, 205], + slategray: [112, 128, 144], + slategrey: [112, 128, 144], + snow: [255, 250, 250], + springgreen: [0, 255, 127], + steelblue: [70, 130, 180], + tan: [210, 180, 140], + teal: [0, 128, 128], + thistle: [216, 191, 216], + tomato: [255, 99, 71], + turquoise: [64, 224, 208], + violet: [238, 130, 238], + wheat: [245, 222, 179], + white: [255, 255, 255], + whitesmoke: [245, 245, 245], + yellow: [255, 255, 0], + yellowgreen: [154, 205, 50] +}; + +var setMap = function setMap(options) { + var obj = options.map; + var keys = options.keys; + var l = keys.length; + + for (var i = 0; i < l; i++) { + var key = keys[i]; + + if (plainObject(key)) { + throw Error('Tried to set map with object key'); + } + + if (i < keys.length - 1) { + // extend the map if necessary + if (obj[key] == null) { + obj[key] = {}; + } + + obj = obj[key]; + } else { + // set the value + obj[key] = options.value; + } + } +}; // gets the value in a map even if it's not built in places + +var getMap = function getMap(options) { + var obj = options.map; + var keys = options.keys; + var l = keys.length; + + for (var i = 0; i < l; i++) { + var key = keys[i]; + + if (plainObject(key)) { + throw Error('Tried to get map with object key'); + } + + obj = obj[key]; + + if (obj == null) { + return obj; + } + } + + return obj; +}; // deletes the entry in the map + +var performance = window$1 ? window$1.performance : null; +var pnow = performance && performance.now ? function () { + return performance.now(); +} : function () { + return Date.now(); +}; + +var raf = function () { + if (window$1) { + if (window$1.requestAnimationFrame) { + return function (fn) { + window$1.requestAnimationFrame(fn); + }; + } else if (window$1.mozRequestAnimationFrame) { + return function (fn) { + window$1.mozRequestAnimationFrame(fn); + }; + } else if (window$1.webkitRequestAnimationFrame) { + return function (fn) { + window$1.webkitRequestAnimationFrame(fn); + }; + } else if (window$1.msRequestAnimationFrame) { + return function (fn) { + window$1.msRequestAnimationFrame(fn); + }; + } + } + + return function (fn) { + if (fn) { + setTimeout(function () { + fn(pnow()); + }, 1000 / 60); + } + }; +}(); + +var requestAnimationFrame = function requestAnimationFrame(fn) { + return raf(fn); +}; +var performanceNow = pnow; + +var DEFAULT_HASH_SEED = 9261; +var K = 65599; // 37 also works pretty well + +var DEFAULT_HASH_SEED_ALT = 5381; +var hashIterableInts = function hashIterableInts(iterator) { + var seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HASH_SEED; + // sdbm/string-hash + var hash = seed; + var entry; + + for (;;) { + entry = iterator.next(); + + if (entry.done) { + break; + } + + hash = hash * K + entry.value | 0; + } + + return hash; +}; +var hashInt = function hashInt(num) { + var seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HASH_SEED; + // sdbm/string-hash + return seed * K + num | 0; +}; +var hashIntAlt = function hashIntAlt(num) { + var seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HASH_SEED_ALT; + // djb2/string-hash + return (seed << 5) + seed + num | 0; +}; +var combineHashes = function combineHashes(hash1, hash2) { + return hash1 * 0x200000 + hash2; +}; +var combineHashesArray = function combineHashesArray(hashes) { + return hashes[0] * 0x200000 + hashes[1]; +}; +var hashArrays = function hashArrays(hashes1, hashes2) { + return [hashInt(hashes1[0], hashes2[0]), hashIntAlt(hashes1[1], hashes2[1])]; +}; +var hashIntsArray = function hashIntsArray(ints, seed) { + var entry = { + value: 0, + done: false + }; + var i = 0; + var length = ints.length; + var iterator = { + next: function next() { + if (i < length) { + entry.value = ints[i++]; + } else { + entry.done = true; + } + + return entry; + } + }; + return hashIterableInts(iterator, seed); +}; +var hashString = function hashString(str, seed) { + var entry = { + value: 0, + done: false + }; + var i = 0; + var length = str.length; + var iterator = { + next: function next() { + if (i < length) { + entry.value = str.charCodeAt(i++); + } else { + entry.done = true; + } + + return entry; + } + }; + return hashIterableInts(iterator, seed); +}; +var hashStrings = function hashStrings() { + return hashStringsArray(arguments); +}; +var hashStringsArray = function hashStringsArray(strs) { + var hash; + + for (var i = 0; i < strs.length; i++) { + var str = strs[i]; + + if (i === 0) { + hash = hashString(str); + } else { + hash = hashString(str, hash); + } + } + + return hash; +}; + +/*global console */ +var warningsEnabled = true; +var warnSupported = console.warn != null; // eslint-disable-line no-console + +var traceSupported = console.trace != null; // eslint-disable-line no-console + +var MAX_INT$1 = Number.MAX_SAFE_INTEGER || 9007199254740991; +var trueify = function trueify() { + return true; +}; +var falsify = function falsify() { + return false; +}; +var zeroify = function zeroify() { + return 0; +}; +var noop$1 = function noop() {}; +var error = function error(msg) { + throw new Error(msg); +}; +var warnings = function warnings(enabled) { + if (enabled !== undefined) { + warningsEnabled = !!enabled; + } else { + return warningsEnabled; + } +}; +var warn = function warn(msg) { + /* eslint-disable no-console */ + if (!warnings()) { + return; + } + + if (warnSupported) { + console.warn(msg); + } else { + console.log(msg); + + if (traceSupported) { + console.trace(); + } + } +}; +/* eslint-enable */ + +var clone = function clone(obj) { + return extend({}, obj); +}; // gets a shallow copy of the argument + +var copy = function copy(obj) { + if (obj == null) { + return obj; + } + + if (array(obj)) { + return obj.slice(); + } else if (plainObject(obj)) { + return clone(obj); + } else { + return obj; + } +}; +var copyArray = function copyArray(arr) { + return arr.slice(); +}; +var uuid = function uuid(a, b +/* placeholders */ +) { + for ( // loop :) + b = a = ''; // b - result , a - numeric letiable + a++ < 36; // + b += a * 51 & 52 // if "a" is not 9 or 14 or 19 or 24 + ? // return a random number or 4 + (a ^ 15 // if "a" is not 15 + ? // generate a random number from 0 to 15 + 8 ^ Math.random() * (a ^ 20 ? 16 : 4) // unless "a" is 20, in which case a random number from 8 to 11 + : 4 // otherwise 4 + ).toString(16) : '-' // in other cases (if "a" is 9,14,19,24) insert "-" + ) { + } + + return b; +}; +var _staticEmptyObject = {}; +var staticEmptyObject = function staticEmptyObject() { + return _staticEmptyObject; +}; +var defaults$g = function defaults(_defaults) { + var keys = Object.keys(_defaults); + return function (opts) { + var filledOpts = {}; + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var optVal = opts == null ? undefined : opts[key]; + filledOpts[key] = optVal === undefined ? _defaults[key] : optVal; + } + + return filledOpts; + }; +}; +var removeFromArray = function removeFromArray(arr, ele, oneCopy) { + for (var i = arr.length - 1; i >= 0; i--) { + if (arr[i] === ele) { + arr.splice(i, 1); + + if (oneCopy) { + break; + } + } + } +}; +var clearArray = function clearArray(arr) { + arr.splice(0, arr.length); +}; +var push = function push(arr, otherArr) { + for (var i = 0; i < otherArr.length; i++) { + var el = otherArr[i]; + arr.push(el); + } +}; +var getPrefixedProperty = function getPrefixedProperty(obj, propName, prefix) { + if (prefix) { + propName = prependCamel(prefix, propName); // e.g. (labelWidth, source) => sourceLabelWidth + } + + return obj[propName]; +}; +var setPrefixedProperty = function setPrefixedProperty(obj, propName, prefix, value) { + if (prefix) { + propName = prependCamel(prefix, propName); // e.g. (labelWidth, source) => sourceLabelWidth + } + + obj[propName] = value; +}; + +/* global Map */ +var ObjectMap = /*#__PURE__*/function () { + function ObjectMap() { + _classCallCheck(this, ObjectMap); + + this._obj = {}; + } + + _createClass(ObjectMap, [{ + key: "set", + value: function set(key, val) { + this._obj[key] = val; + return this; + } + }, { + key: "delete", + value: function _delete(key) { + this._obj[key] = undefined; + return this; + } + }, { + key: "clear", + value: function clear() { + this._obj = {}; + } + }, { + key: "has", + value: function has(key) { + return this._obj[key] !== undefined; + } + }, { + key: "get", + value: function get(key) { + return this._obj[key]; + } + }]); + + return ObjectMap; +}(); + +var Map$1 = typeof Map !== 'undefined' ? Map : ObjectMap; + +/* global Set */ +var undef = "undefined" ; + +var ObjectSet = /*#__PURE__*/function () { + function ObjectSet(arrayOrObjectSet) { + _classCallCheck(this, ObjectSet); + + this._obj = Object.create(null); + this.size = 0; + + if (arrayOrObjectSet != null) { + var arr; + + if (arrayOrObjectSet.instanceString != null && arrayOrObjectSet.instanceString() === this.instanceString()) { + arr = arrayOrObjectSet.toArray(); + } else { + arr = arrayOrObjectSet; + } + + for (var i = 0; i < arr.length; i++) { + this.add(arr[i]); + } + } + } + + _createClass(ObjectSet, [{ + key: "instanceString", + value: function instanceString() { + return 'set'; + } + }, { + key: "add", + value: function add(val) { + var o = this._obj; + + if (o[val] !== 1) { + o[val] = 1; + this.size++; + } + } + }, { + key: "delete", + value: function _delete(val) { + var o = this._obj; + + if (o[val] === 1) { + o[val] = 0; + this.size--; + } + } + }, { + key: "clear", + value: function clear() { + this._obj = Object.create(null); + } + }, { + key: "has", + value: function has(val) { + return this._obj[val] === 1; + } + }, { + key: "toArray", + value: function toArray() { + var _this = this; + + return Object.keys(this._obj).filter(function (key) { + return _this.has(key); + }); + } + }, { + key: "forEach", + value: function forEach(callback, thisArg) { + return this.toArray().forEach(callback, thisArg); + } + }]); + + return ObjectSet; +}(); + +var Set$1 = (typeof Set === "undefined" ? "undefined" : _typeof(Set)) !== undef ? Set : ObjectSet; + +var Element = function Element(cy, params) { + var restore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + + if (cy === undefined || params === undefined || !core(cy)) { + error('An element must have a core reference and parameters set'); + return; + } + + var group = params.group; // try to automatically infer the group if unspecified + + if (group == null) { + if (params.data && params.data.source != null && params.data.target != null) { + group = 'edges'; + } else { + group = 'nodes'; + } + } // validate group + + + if (group !== 'nodes' && group !== 'edges') { + error('An element must be of type `nodes` or `edges`; you specified `' + group + '`'); + return; + } // make the element array-like, just like a collection + + + this.length = 1; + this[0] = this; // NOTE: when something is added here, add also to ele.json() + + var _p = this._private = { + cy: cy, + single: true, + // indicates this is an element + data: params.data || {}, + // data object + position: params.position || { + x: 0, + y: 0 + }, + // (x, y) position pair + autoWidth: undefined, + // width and height of nodes calculated by the renderer when set to special 'auto' value + autoHeight: undefined, + autoPadding: undefined, + compoundBoundsClean: false, + // whether the compound dimensions need to be recalculated the next time dimensions are read + listeners: [], + // array of bound listeners + group: group, + // string; 'nodes' or 'edges' + style: {}, + // properties as set by the style + rstyle: {}, + // properties for style sent from the renderer to the core + styleCxts: [], + // applied style contexts from the styler + styleKeys: {}, + // per-group keys of style property values + removed: true, + // whether it's inside the vis; true if removed (set true here since we call restore) + selected: params.selected ? true : false, + // whether it's selected + selectable: params.selectable === undefined ? true : params.selectable ? true : false, + // whether it's selectable + locked: params.locked ? true : false, + // whether the element is locked (cannot be moved) + grabbed: false, + // whether the element is grabbed by the mouse; renderer sets this privately + grabbable: params.grabbable === undefined ? true : params.grabbable ? true : false, + // whether the element can be grabbed + pannable: params.pannable === undefined ? group === 'edges' ? true : false : params.pannable ? true : false, + // whether the element has passthrough panning enabled + active: false, + // whether the element is active from user interaction + classes: new Set$1(), + // map ( className => true ) + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + rscratch: {}, + // object in which the renderer can store information + scratch: params.scratch || {}, + // scratch objects + edges: [], + // array of connected edges + children: [], + // array of children + parent: params.parent && params.parent.isNode() ? params.parent : null, + // parent ref + traversalCache: {}, + // cache of output of traversal functions + backgrounding: false, + // whether background images are loading + bbCache: null, + // cache of the current bounding box + bbCacheShift: { + x: 0, + y: 0 + }, + // shift applied to cached bb to be applied on next get + bodyBounds: null, + // bounds cache of element body, w/o overlay + overlayBounds: null, + // bounds cache of element body, including overlay + labelBounds: { + // bounds cache of labels + all: null, + source: null, + target: null, + main: null + }, + arrowBounds: { + // bounds cache of edge arrows + source: null, + target: null, + 'mid-source': null, + 'mid-target': null + } + }; + + if (_p.position.x == null) { + _p.position.x = 0; + } + + if (_p.position.y == null) { + _p.position.y = 0; + } // renderedPosition overrides if specified + + + if (params.renderedPosition) { + var rpos = params.renderedPosition; + var pan = cy.pan(); + var zoom = cy.zoom(); + _p.position = { + x: (rpos.x - pan.x) / zoom, + y: (rpos.y - pan.y) / zoom + }; + } + + var classes = []; + + if (array(params.classes)) { + classes = params.classes; + } else if (string(params.classes)) { + classes = params.classes.split(/\s+/); + } + + for (var i = 0, l = classes.length; i < l; i++) { + var cls = classes[i]; + + if (!cls || cls === '') { + continue; + } + + _p.classes.add(cls); + } + + this.createEmitter(); + var bypass = params.style || params.css; + + if (bypass) { + warn('Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead.'); + this.style(bypass); + } + + if (restore === undefined || restore) { + this.restore(); + } +}; + +var defineSearch = function defineSearch(params) { + params = { + bfs: params.bfs || !params.dfs, + dfs: params.dfs || !params.bfs + }; // from pseudocode on wikipedia + + return function searchFn(roots, fn, directed) { + var options; + + if (plainObject(roots) && !elementOrCollection(roots)) { + options = roots; + roots = options.roots || options.root; + fn = options.visit; + directed = options.directed; + } + + directed = arguments.length === 2 && !fn$6(fn) ? fn : directed; + fn = fn$6(fn) ? fn : function () {}; + var cy = this._private.cy; + var v = roots = string(roots) ? this.filter(roots) : roots; + var Q = []; + var connectedNodes = []; + var connectedBy = {}; + var id2depth = {}; + var V = {}; + var j = 0; + var found; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; // enqueue v + + + for (var i = 0; i < v.length; i++) { + var vi = v[i]; + var viId = vi.id(); + + if (vi.isNode()) { + Q.unshift(vi); + + if (params.bfs) { + V[viId] = true; + connectedNodes.push(vi); + } + + id2depth[viId] = 0; + } + } + + var _loop = function _loop() { + var v = params.bfs ? Q.shift() : Q.pop(); + var vId = v.id(); + + if (params.dfs) { + if (V[vId]) { + return "continue"; + } + + V[vId] = true; + connectedNodes.push(v); + } + + var depth = id2depth[vId]; + var prevEdge = connectedBy[vId]; + var src = prevEdge != null ? prevEdge.source() : null; + var tgt = prevEdge != null ? prevEdge.target() : null; + var prevNode = prevEdge == null ? undefined : v.same(src) ? tgt[0] : src[0]; + var ret = void 0; + ret = fn(v, prevEdge, prevNode, j++, depth); + + if (ret === true) { + found = v; + return "break"; + } + + if (ret === false) { + return "break"; + } + + var vwEdges = v.connectedEdges().filter(function (e) { + return (!directed || e.source().same(v)) && edges.has(e); + }); + + for (var _i2 = 0; _i2 < vwEdges.length; _i2++) { + var e = vwEdges[_i2]; + var w = e.connectedNodes().filter(function (n) { + return !n.same(v) && nodes.has(n); + }); + var wId = w.id(); + + if (w.length !== 0 && !V[wId]) { + w = w[0]; + Q.push(w); + + if (params.bfs) { + V[wId] = true; + connectedNodes.push(w); + } + + connectedBy[wId] = e; + id2depth[wId] = id2depth[vId] + 1; + } + } + }; + + while (Q.length !== 0) { + var _ret = _loop(); + + if (_ret === "continue") continue; + if (_ret === "break") break; + } + + var connectedEles = cy.collection(); + + for (var _i = 0; _i < connectedNodes.length; _i++) { + var node = connectedNodes[_i]; + var edge = connectedBy[node.id()]; + + if (edge != null) { + connectedEles.push(edge); + } + + connectedEles.push(node); + } + + return { + path: cy.collection(connectedEles), + found: cy.collection(found) + }; + }; +}; // search, spanning trees, etc + + +var elesfn$v = { + breadthFirstSearch: defineSearch({ + bfs: true + }), + depthFirstSearch: defineSearch({ + dfs: true + }) +}; // nice, short mathematical alias + +elesfn$v.bfs = elesfn$v.breadthFirstSearch; +elesfn$v.dfs = elesfn$v.depthFirstSearch; + +var dijkstraDefaults = defaults$g({ + root: null, + weight: function weight(edge) { + return 1; + }, + directed: false +}); +var elesfn$u = { + dijkstra: function dijkstra(options) { + if (!plainObject(options)) { + var args = arguments; + options = { + root: args[0], + weight: args[1], + directed: args[2] + }; + } + + var _dijkstraDefaults = dijkstraDefaults(options), + root = _dijkstraDefaults.root, + weight = _dijkstraDefaults.weight, + directed = _dijkstraDefaults.directed; + + var eles = this; + var weightFn = weight; + var source = string(root) ? this.filter(root)[0] : root[0]; + var dist = {}; + var prev = {}; + var knownDist = {}; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + edges.unmergeBy(function (ele) { + return ele.isLoop(); + }); + + var getDist = function getDist(node) { + return dist[node.id()]; + }; + + var setDist = function setDist(node, d) { + dist[node.id()] = d; + Q.updateItem(node); + }; + + var Q = new Heap__default["default"](function (a, b) { + return getDist(a) - getDist(b); + }); + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + dist[node.id()] = node.same(source) ? 0 : Infinity; + Q.push(node); + } + + var distBetween = function distBetween(u, v) { + var uvs = (directed ? u.edgesTo(v) : u.edgesWith(v)).intersect(edges); + var smallestDistance = Infinity; + var smallestEdge; + + for (var _i = 0; _i < uvs.length; _i++) { + var edge = uvs[_i]; + + var _weight = weightFn(edge); + + if (_weight < smallestDistance || !smallestEdge) { + smallestDistance = _weight; + smallestEdge = edge; + } + } + + return { + edge: smallestEdge, + dist: smallestDistance + }; + }; + + while (Q.size() > 0) { + var u = Q.pop(); + var smalletsDist = getDist(u); + var uid = u.id(); + knownDist[uid] = smalletsDist; + + if (smalletsDist === Infinity) { + continue; + } + + var neighbors = u.neighborhood().intersect(nodes); + + for (var _i2 = 0; _i2 < neighbors.length; _i2++) { + var v = neighbors[_i2]; + var vid = v.id(); + var vDist = distBetween(u, v); + var alt = smalletsDist + vDist.dist; + + if (alt < getDist(v)) { + setDist(v, alt); + prev[vid] = { + node: u, + edge: vDist.edge + }; + } + } // for + + } // while + + + return { + distanceTo: function distanceTo(node) { + var target = string(node) ? nodes.filter(node)[0] : node[0]; + return knownDist[target.id()]; + }, + pathTo: function pathTo(node) { + var target = string(node) ? nodes.filter(node)[0] : node[0]; + var S = []; + var u = target; + var uid = u.id(); + + if (target.length > 0) { + S.unshift(target); + + while (prev[uid]) { + var p = prev[uid]; + S.unshift(p.edge); + S.unshift(p.node); + u = p.node; + uid = u.id(); + } + } + + return eles.spawn(S); + } + }; + } +}; + +var elesfn$t = { + // kruskal's algorithm (finds min spanning tree, assuming undirected graph) + // implemented from pseudocode from wikipedia + kruskal: function kruskal(weightFn) { + weightFn = weightFn || function (edge) { + return 1; + }; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + var numNodes = nodes.length; + var forest = new Array(numNodes); + var A = nodes; // assumes byGroup() creates new collections that can be safely mutated + + var findSetIndex = function findSetIndex(ele) { + for (var i = 0; i < forest.length; i++) { + var eles = forest[i]; + + if (eles.has(ele)) { + return i; + } + } + }; // start with one forest per node + + + for (var i = 0; i < numNodes; i++) { + forest[i] = this.spawn(nodes[i]); + } + + var S = edges.sort(function (a, b) { + return weightFn(a) - weightFn(b); + }); + + for (var _i = 0; _i < S.length; _i++) { + var edge = S[_i]; + var u = edge.source()[0]; + var v = edge.target()[0]; + var setUIndex = findSetIndex(u); + var setVIndex = findSetIndex(v); + var setU = forest[setUIndex]; + var setV = forest[setVIndex]; + + if (setUIndex !== setVIndex) { + A.merge(edge); // combine forests for u and v + + setU.merge(setV); + forest.splice(setVIndex, 1); + } + } + + return A; + } +}; + +var aStarDefaults = defaults$g({ + root: null, + goal: null, + weight: function weight(edge) { + return 1; + }, + heuristic: function heuristic(edge) { + return 0; + }, + directed: false +}); +var elesfn$s = { + // Implemented from pseudocode from wikipedia + aStar: function aStar(options) { + var cy = this.cy(); + + var _aStarDefaults = aStarDefaults(options), + root = _aStarDefaults.root, + goal = _aStarDefaults.goal, + heuristic = _aStarDefaults.heuristic, + directed = _aStarDefaults.directed, + weight = _aStarDefaults.weight; + + root = cy.collection(root)[0]; + goal = cy.collection(goal)[0]; + var sid = root.id(); + var tid = goal.id(); + var gScore = {}; + var fScore = {}; + var closedSetIds = {}; + var openSet = new Heap__default["default"](function (a, b) { + return fScore[a.id()] - fScore[b.id()]; + }); + var openSetIds = new Set$1(); + var cameFrom = {}; + var cameFromEdge = {}; + + var addToOpenSet = function addToOpenSet(ele, id) { + openSet.push(ele); + openSetIds.add(id); + }; + + var cMin, cMinId; + + var popFromOpenSet = function popFromOpenSet() { + cMin = openSet.pop(); + cMinId = cMin.id(); + openSetIds["delete"](cMinId); + }; + + var isInOpenSet = function isInOpenSet(id) { + return openSetIds.has(id); + }; + + addToOpenSet(root, sid); + gScore[sid] = 0; + fScore[sid] = heuristic(root); // Counter + + var steps = 0; // Main loop + + while (openSet.size() > 0) { + popFromOpenSet(); + steps++; // If we've found our goal, then we are done + + if (cMinId === tid) { + var path = []; + var pathNode = goal; + var pathNodeId = tid; + var pathEdge = cameFromEdge[pathNodeId]; + + for (;;) { + path.unshift(pathNode); + + if (pathEdge != null) { + path.unshift(pathEdge); + } + + pathNode = cameFrom[pathNodeId]; + + if (pathNode == null) { + break; + } + + pathNodeId = pathNode.id(); + pathEdge = cameFromEdge[pathNodeId]; + } + + return { + found: true, + distance: gScore[cMinId], + path: this.spawn(path), + steps: steps + }; + } // Add cMin to processed nodes + + + closedSetIds[cMinId] = true; // Update scores for neighbors of cMin + // Take into account if graph is directed or not + + var vwEdges = cMin._private.edges; + + for (var i = 0; i < vwEdges.length; i++) { + var e = vwEdges[i]; // edge must be in set of calling eles + + if (!this.hasElementWithId(e.id())) { + continue; + } // cMin must be the source of edge if directed + + + if (directed && e.data('source') !== cMinId) { + continue; + } + + var wSrc = e.source(); + var wTgt = e.target(); + var w = wSrc.id() !== cMinId ? wSrc : wTgt; + var wid = w.id(); // node must be in set of calling eles + + if (!this.hasElementWithId(wid)) { + continue; + } // if node is in closedSet, ignore it + + + if (closedSetIds[wid]) { + continue; + } // New tentative score for node w + + + var tempScore = gScore[cMinId] + weight(e); // Update gScore for node w if: + // w not present in openSet + // OR + // tentative gScore is less than previous value + // w not in openSet + + if (!isInOpenSet(wid)) { + gScore[wid] = tempScore; + fScore[wid] = tempScore + heuristic(w); + addToOpenSet(w, wid); + cameFrom[wid] = cMin; + cameFromEdge[wid] = e; + continue; + } // w already in openSet, but with greater gScore + + + if (tempScore < gScore[wid]) { + gScore[wid] = tempScore; + fScore[wid] = tempScore + heuristic(w); + cameFrom[wid] = cMin; + cameFromEdge[wid] = e; + } + } // End of neighbors update + + } // End of main loop + // If we've reached here, then we've not reached our goal + + + return { + found: false, + distance: undefined, + path: undefined, + steps: steps + }; + } +}; // elesfn + +var floydWarshallDefaults = defaults$g({ + weight: function weight(edge) { + return 1; + }, + directed: false +}); +var elesfn$r = { + // Implemented from pseudocode from wikipedia + floydWarshall: function floydWarshall(options) { + var cy = this.cy(); + + var _floydWarshallDefault = floydWarshallDefaults(options), + weight = _floydWarshallDefault.weight, + directed = _floydWarshallDefault.directed; + + var weightFn = weight; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + var N = nodes.length; + var Nsq = N * N; + + var indexOf = function indexOf(node) { + return nodes.indexOf(node); + }; + + var atIndex = function atIndex(i) { + return nodes[i]; + }; // Initialize distance matrix + + + var dist = new Array(Nsq); + + for (var n = 0; n < Nsq; n++) { + var j = n % N; + var i = (n - j) / N; + + if (i === j) { + dist[n] = 0; + } else { + dist[n] = Infinity; + } + } // Initialize matrix used for path reconstruction + // Initialize distance matrix + + + var next = new Array(Nsq); + var edgeNext = new Array(Nsq); // Process edges + + for (var _i = 0; _i < edges.length; _i++) { + var edge = edges[_i]; + var src = edge.source()[0]; + var tgt = edge.target()[0]; + + if (src === tgt) { + continue; + } // exclude loops + + + var s = indexOf(src); + var t = indexOf(tgt); + var st = s * N + t; // source to target index + + var _weight = weightFn(edge); // Check if already process another edge between same 2 nodes + + + if (dist[st] > _weight) { + dist[st] = _weight; + next[st] = t; + edgeNext[st] = edge; + } // If undirected graph, process 'reversed' edge + + + if (!directed) { + var ts = t * N + s; // target to source index + + if (!directed && dist[ts] > _weight) { + dist[ts] = _weight; + next[ts] = s; + edgeNext[ts] = edge; + } + } + } // Main loop + + + for (var k = 0; k < N; k++) { + for (var _i2 = 0; _i2 < N; _i2++) { + var ik = _i2 * N + k; + + for (var _j = 0; _j < N; _j++) { + var ij = _i2 * N + _j; + var kj = k * N + _j; + + if (dist[ik] + dist[kj] < dist[ij]) { + dist[ij] = dist[ik] + dist[kj]; + next[ij] = next[ik]; + } + } + } + } + + var getArgEle = function getArgEle(ele) { + return (string(ele) ? cy.filter(ele) : ele)[0]; + }; + + var indexOfArgEle = function indexOfArgEle(ele) { + return indexOf(getArgEle(ele)); + }; + + var res = { + distance: function distance(from, to) { + var i = indexOfArgEle(from); + var j = indexOfArgEle(to); + return dist[i * N + j]; + }, + path: function path(from, to) { + var i = indexOfArgEle(from); + var j = indexOfArgEle(to); + var fromNode = atIndex(i); + + if (i === j) { + return fromNode.collection(); + } + + if (next[i * N + j] == null) { + return cy.collection(); + } + + var path = cy.collection(); + var prev = i; + var edge; + path.merge(fromNode); + + while (i !== j) { + prev = i; + i = next[i * N + j]; + edge = edgeNext[prev * N + i]; + path.merge(edge); + path.merge(atIndex(i)); + } + + return path; + } + }; + return res; + } // floydWarshall + +}; // elesfn + +var bellmanFordDefaults = defaults$g({ + weight: function weight(edge) { + return 1; + }, + directed: false, + root: null +}); +var elesfn$q = { + // Implemented from pseudocode from wikipedia + bellmanFord: function bellmanFord(options) { + var _this = this; + + var _bellmanFordDefaults = bellmanFordDefaults(options), + weight = _bellmanFordDefaults.weight, + directed = _bellmanFordDefaults.directed, + root = _bellmanFordDefaults.root; + + var weightFn = weight; + var eles = this; + var cy = this.cy(); + + var _this$byGroup = this.byGroup(), + edges = _this$byGroup.edges, + nodes = _this$byGroup.nodes; + + var numNodes = nodes.length; + var infoMap = new Map$1(); + var hasNegativeWeightCycle = false; + var negativeWeightCycles = []; + root = cy.collection(root)[0]; // in case selector passed + + edges.unmergeBy(function (edge) { + return edge.isLoop(); + }); + var numEdges = edges.length; + + var getInfo = function getInfo(node) { + var obj = infoMap.get(node.id()); + + if (!obj) { + obj = {}; + infoMap.set(node.id(), obj); + } + + return obj; + }; + + var getNodeFromTo = function getNodeFromTo(to) { + return (string(to) ? cy.$(to) : to)[0]; + }; + + var distanceTo = function distanceTo(to) { + return getInfo(getNodeFromTo(to)).dist; + }; + + var pathTo = function pathTo(to) { + var thisStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : root; + var end = getNodeFromTo(to); + var path = []; + var node = end; + + for (;;) { + if (node == null) { + return _this.spawn(); + } + + var _getInfo = getInfo(node), + edge = _getInfo.edge, + pred = _getInfo.pred; + + path.unshift(node[0]); + + if (node.same(thisStart) && path.length > 0) { + break; + } + + if (edge != null) { + path.unshift(edge); + } + + node = pred; + } + + return eles.spawn(path); + }; // Initializations { dist, pred, edge } + + + for (var i = 0; i < numNodes; i++) { + var node = nodes[i]; + var info = getInfo(node); + + if (node.same(root)) { + info.dist = 0; + } else { + info.dist = Infinity; + } + + info.pred = null; + info.edge = null; + } // Edges relaxation + + + var replacedEdge = false; + + var checkForEdgeReplacement = function checkForEdgeReplacement(node1, node2, edge, info1, info2, weight) { + var dist = info1.dist + weight; + + if (dist < info2.dist && !edge.same(info1.edge)) { + info2.dist = dist; + info2.pred = node1; + info2.edge = edge; + replacedEdge = true; + } + }; + + for (var _i = 1; _i < numNodes; _i++) { + replacedEdge = false; + + for (var e = 0; e < numEdges; e++) { + var edge = edges[e]; + var src = edge.source(); + var tgt = edge.target(); + + var _weight = weightFn(edge); + + var srcInfo = getInfo(src); + var tgtInfo = getInfo(tgt); + checkForEdgeReplacement(src, tgt, edge, srcInfo, tgtInfo, _weight); // If undirected graph, we need to take into account the 'reverse' edge + + if (!directed) { + checkForEdgeReplacement(tgt, src, edge, tgtInfo, srcInfo, _weight); + } + } + + if (!replacedEdge) { + break; + } + } + + if (replacedEdge) { + // Check for negative weight cycles + var negativeWeightCycleIds = []; + + for (var _e = 0; _e < numEdges; _e++) { + var _edge = edges[_e]; + + var _src = _edge.source(); + + var _tgt = _edge.target(); + + var _weight2 = weightFn(_edge); + + var srcDist = getInfo(_src).dist; + var tgtDist = getInfo(_tgt).dist; + + if (srcDist + _weight2 < tgtDist || !directed && tgtDist + _weight2 < srcDist) { + if (!hasNegativeWeightCycle) { + warn('Graph contains a negative weight cycle for Bellman-Ford'); + hasNegativeWeightCycle = true; + } + + if (options.findNegativeWeightCycles !== false) { + var negativeNodes = []; + + if (srcDist + _weight2 < tgtDist) { + negativeNodes.push(_src); + } + + if (!directed && tgtDist + _weight2 < srcDist) { + negativeNodes.push(_tgt); + } + + var numNegativeNodes = negativeNodes.length; + + for (var n = 0; n < numNegativeNodes; n++) { + var start = negativeNodes[n]; + var cycle = [start]; + cycle.push(getInfo(start).edge); + var _node = getInfo(start).pred; + + while (cycle.indexOf(_node) === -1) { + cycle.push(_node); + cycle.push(getInfo(_node).edge); + _node = getInfo(_node).pred; + } + + cycle = cycle.slice(cycle.indexOf(_node)); + var smallestId = cycle[0].id(); + var smallestIndex = 0; + + for (var c = 2; c < cycle.length; c += 2) { + if (cycle[c].id() < smallestId) { + smallestId = cycle[c].id(); + smallestIndex = c; + } + } + + cycle = cycle.slice(smallestIndex).concat(cycle.slice(0, smallestIndex)); + cycle.push(cycle[0]); + var cycleId = cycle.map(function (el) { + return el.id(); + }).join(","); + + if (negativeWeightCycleIds.indexOf(cycleId) === -1) { + negativeWeightCycles.push(eles.spawn(cycle)); + negativeWeightCycleIds.push(cycleId); + } + } + } else { + break; + } + } + } + } + + return { + distanceTo: distanceTo, + pathTo: pathTo, + hasNegativeWeightCycle: hasNegativeWeightCycle, + negativeWeightCycles: negativeWeightCycles + }; + } // bellmanFord + +}; // elesfn + +var sqrt2 = Math.sqrt(2); // Function which colapses 2 (meta) nodes into one +// Updates the remaining edge lists +// Receives as a paramater the edge which causes the collapse + +var collapse = function collapse(edgeIndex, nodeMap, remainingEdges) { + if (remainingEdges.length === 0) { + error("Karger-Stein must be run on a connected (sub)graph"); + } + + var edgeInfo = remainingEdges[edgeIndex]; + var sourceIn = edgeInfo[1]; + var targetIn = edgeInfo[2]; + var partition1 = nodeMap[sourceIn]; + var partition2 = nodeMap[targetIn]; + var newEdges = remainingEdges; // re-use array + // Delete all edges between partition1 and partition2 + + for (var i = newEdges.length - 1; i >= 0; i--) { + var edge = newEdges[i]; + var src = edge[1]; + var tgt = edge[2]; + + if (nodeMap[src] === partition1 && nodeMap[tgt] === partition2 || nodeMap[src] === partition2 && nodeMap[tgt] === partition1) { + newEdges.splice(i, 1); + } + } // All edges pointing to partition2 should now point to partition1 + + + for (var _i = 0; _i < newEdges.length; _i++) { + var _edge = newEdges[_i]; + + if (_edge[1] === partition2) { + // Check source + newEdges[_i] = _edge.slice(); // copy + + newEdges[_i][1] = partition1; + } else if (_edge[2] === partition2) { + // Check target + newEdges[_i] = _edge.slice(); // copy + + newEdges[_i][2] = partition1; + } + } // Move all nodes from partition2 to partition1 + + + for (var _i2 = 0; _i2 < nodeMap.length; _i2++) { + if (nodeMap[_i2] === partition2) { + nodeMap[_i2] = partition1; + } + } + + return newEdges; +}; // Contracts a graph until we reach a certain number of meta nodes + + +var contractUntil = function contractUntil(metaNodeMap, remainingEdges, size, sizeLimit) { + while (size > sizeLimit) { + // Choose an edge randomly + var edgeIndex = Math.floor(Math.random() * remainingEdges.length); // Collapse graph based on edge + + remainingEdges = collapse(edgeIndex, metaNodeMap, remainingEdges); + size--; + } + + return remainingEdges; +}; + +var elesfn$p = { + // Computes the minimum cut of an undirected graph + // Returns the correct answer with high probability + kargerStein: function kargerStein() { + var _this = this; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + edges.unmergeBy(function (edge) { + return edge.isLoop(); + }); + var numNodes = nodes.length; + var numEdges = edges.length; + var numIter = Math.ceil(Math.pow(Math.log(numNodes) / Math.LN2, 2)); + var stopSize = Math.floor(numNodes / sqrt2); + + if (numNodes < 2) { + error('At least 2 nodes are required for Karger-Stein algorithm'); + return undefined; + } // Now store edge destination as indexes + // Format for each edge (edge index, source node index, target node index) + + + var edgeIndexes = []; + + for (var i = 0; i < numEdges; i++) { + var e = edges[i]; + edgeIndexes.push([i, nodes.indexOf(e.source()), nodes.indexOf(e.target())]); + } // We will store the best cut found here + + + var minCutSize = Infinity; + var minCutEdgeIndexes = []; + var minCutNodeMap = new Array(numNodes); // Initial meta node partition + + var metaNodeMap = new Array(numNodes); + var metaNodeMap2 = new Array(numNodes); + + var copyNodesMap = function copyNodesMap(from, to) { + for (var _i3 = 0; _i3 < numNodes; _i3++) { + to[_i3] = from[_i3]; + } + }; // Main loop + + + for (var iter = 0; iter <= numIter; iter++) { + // Reset meta node partition + for (var _i4 = 0; _i4 < numNodes; _i4++) { + metaNodeMap[_i4] = _i4; + } // Contract until stop point (stopSize nodes) + + + var edgesState = contractUntil(metaNodeMap, edgeIndexes.slice(), numNodes, stopSize); + var edgesState2 = edgesState.slice(); // copy + // Create a copy of the colapsed nodes state + + copyNodesMap(metaNodeMap, metaNodeMap2); // Run 2 iterations starting in the stop state + + var res1 = contractUntil(metaNodeMap, edgesState, stopSize, 2); + var res2 = contractUntil(metaNodeMap2, edgesState2, stopSize, 2); // Is any of the 2 results the best cut so far? + + if (res1.length <= res2.length && res1.length < minCutSize) { + minCutSize = res1.length; + minCutEdgeIndexes = res1; + copyNodesMap(metaNodeMap, minCutNodeMap); + } else if (res2.length <= res1.length && res2.length < minCutSize) { + minCutSize = res2.length; + minCutEdgeIndexes = res2; + copyNodesMap(metaNodeMap2, minCutNodeMap); + } + } // end of main loop + // Construct result + + + var cut = this.spawn(minCutEdgeIndexes.map(function (e) { + return edges[e[0]]; + })); + var partition1 = this.spawn(); + var partition2 = this.spawn(); // traverse metaNodeMap for best cut + + var witnessNodePartition = minCutNodeMap[0]; + + for (var _i5 = 0; _i5 < minCutNodeMap.length; _i5++) { + var partitionId = minCutNodeMap[_i5]; + var node = nodes[_i5]; + + if (partitionId === witnessNodePartition) { + partition1.merge(node); + } else { + partition2.merge(node); + } + } // construct components corresponding to each disjoint subset of nodes + + + var constructComponent = function constructComponent(subset) { + var component = _this.spawn(); + + subset.forEach(function (node) { + component.merge(node); + node.connectedEdges().forEach(function (edge) { + // ensure edge is within calling collection and edge is not in cut + if (_this.contains(edge) && !cut.contains(edge)) { + component.merge(edge); + } + }); + }); + return component; + }; + + var components = [constructComponent(partition1), constructComponent(partition2)]; + var ret = { + cut: cut, + components: components, + // n.b. partitions are included to be compatible with the old api spec + // (could be removed in a future major version) + partition1: partition1, + partition2: partition2 + }; + return ret; + } +}; // elesfn + +var copyPosition = function copyPosition(p) { + return { + x: p.x, + y: p.y + }; +}; +var modelToRenderedPosition = function modelToRenderedPosition(p, zoom, pan) { + return { + x: p.x * zoom + pan.x, + y: p.y * zoom + pan.y + }; +}; +var renderedToModelPosition = function renderedToModelPosition(p, zoom, pan) { + return { + x: (p.x - pan.x) / zoom, + y: (p.y - pan.y) / zoom + }; +}; +var array2point = function array2point(arr) { + return { + x: arr[0], + y: arr[1] + }; +}; +var min = function min(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var min = Infinity; + + for (var i = begin; i < end; i++) { + var val = arr[i]; + + if (isFinite(val)) { + min = Math.min(val, min); + } + } + + return min; +}; +var max = function max(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var max = -Infinity; + + for (var i = begin; i < end; i++) { + var val = arr[i]; + + if (isFinite(val)) { + max = Math.max(val, max); + } + } + + return max; +}; +var mean = function mean(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var total = 0; + var n = 0; + + for (var i = begin; i < end; i++) { + var val = arr[i]; + + if (isFinite(val)) { + total += val; + n++; + } + } + + return total / n; +}; +var median = function median(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var copy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var sort = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var includeHoles = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + + if (copy) { + arr = arr.slice(begin, end); + } else { + if (end < arr.length) { + arr.splice(end, arr.length - end); + } + + if (begin > 0) { + arr.splice(0, begin); + } + } // all non finite (e.g. Infinity, NaN) elements must be -Infinity so they go to the start + + + var off = 0; // offset from non-finite values + + for (var i = arr.length - 1; i >= 0; i--) { + var v = arr[i]; + + if (includeHoles) { + if (!isFinite(v)) { + arr[i] = -Infinity; + off++; + } + } else { + // just remove it if we don't want to consider holes + arr.splice(i, 1); + } + } + + if (sort) { + arr.sort(function (a, b) { + return a - b; + }); // requires copy = true if you don't want to change the orig + } + + var len = arr.length; + var mid = Math.floor(len / 2); + + if (len % 2 !== 0) { + return arr[mid + 1 + off]; + } else { + return (arr[mid - 1 + off] + arr[mid + off]) / 2; + } +}; +var deg2rad = function deg2rad(deg) { + return Math.PI * deg / 180; +}; +var getAngleFromDisp = function getAngleFromDisp(dispX, dispY) { + return Math.atan2(dispY, dispX) - Math.PI / 2; +}; +var log2 = Math.log2 || function (n) { + return Math.log(n) / Math.log(2); +}; +var signum = function signum(x) { + if (x > 0) { + return 1; + } else if (x < 0) { + return -1; + } else { + return 0; + } +}; +var dist = function dist(p1, p2) { + return Math.sqrt(sqdist(p1, p2)); +}; +var sqdist = function sqdist(p1, p2) { + var dx = p2.x - p1.x; + var dy = p2.y - p1.y; + return dx * dx + dy * dy; +}; +var inPlaceSumNormalize = function inPlaceSumNormalize(v) { + var length = v.length; // First, get sum of all elements + + var total = 0; + + for (var i = 0; i < length; i++) { + total += v[i]; + } // Now, divide each by the sum of all elements + + + for (var _i = 0; _i < length; _i++) { + v[_i] = v[_i] / total; + } + + return v; +}; + +var qbezierAt = function qbezierAt(p0, p1, p2, t) { + return (1 - t) * (1 - t) * p0 + 2 * (1 - t) * t * p1 + t * t * p2; +}; +var qbezierPtAt = function qbezierPtAt(p0, p1, p2, t) { + return { + x: qbezierAt(p0.x, p1.x, p2.x, t), + y: qbezierAt(p0.y, p1.y, p2.y, t) + }; +}; +var lineAt = function lineAt(p0, p1, t, d) { + var vec = { + x: p1.x - p0.x, + y: p1.y - p0.y + }; + var vecDist = dist(p0, p1); + var normVec = { + x: vec.x / vecDist, + y: vec.y / vecDist + }; + t = t == null ? 0 : t; + d = d != null ? d : t * vecDist; + return { + x: p0.x + normVec.x * d, + y: p0.y + normVec.y * d + }; +}; +var bound = function bound(min, val, max) { + return Math.max(min, Math.min(max, val)); +}; // makes a full bb (x1, y1, x2, y2, w, h) from implicit params + +var makeBoundingBox = function makeBoundingBox(bb) { + if (bb == null) { + return { + x1: Infinity, + y1: Infinity, + x2: -Infinity, + y2: -Infinity, + w: 0, + h: 0 + }; + } else if (bb.x1 != null && bb.y1 != null) { + if (bb.x2 != null && bb.y2 != null && bb.x2 >= bb.x1 && bb.y2 >= bb.y1) { + return { + x1: bb.x1, + y1: bb.y1, + x2: bb.x2, + y2: bb.y2, + w: bb.x2 - bb.x1, + h: bb.y2 - bb.y1 + }; + } else if (bb.w != null && bb.h != null && bb.w >= 0 && bb.h >= 0) { + return { + x1: bb.x1, + y1: bb.y1, + x2: bb.x1 + bb.w, + y2: bb.y1 + bb.h, + w: bb.w, + h: bb.h + }; + } + } +}; +var copyBoundingBox = function copyBoundingBox(bb) { + return { + x1: bb.x1, + x2: bb.x2, + w: bb.w, + y1: bb.y1, + y2: bb.y2, + h: bb.h + }; +}; +var clearBoundingBox = function clearBoundingBox(bb) { + bb.x1 = Infinity; + bb.y1 = Infinity; + bb.x2 = -Infinity; + bb.y2 = -Infinity; + bb.w = 0; + bb.h = 0; +}; +var updateBoundingBox = function updateBoundingBox(bb1, bb2) { + // update bb1 with bb2 bounds + bb1.x1 = Math.min(bb1.x1, bb2.x1); + bb1.x2 = Math.max(bb1.x2, bb2.x2); + bb1.w = bb1.x2 - bb1.x1; + bb1.y1 = Math.min(bb1.y1, bb2.y1); + bb1.y2 = Math.max(bb1.y2, bb2.y2); + bb1.h = bb1.y2 - bb1.y1; +}; +var expandBoundingBoxByPoint = function expandBoundingBoxByPoint(bb, x, y) { + bb.x1 = Math.min(bb.x1, x); + bb.x2 = Math.max(bb.x2, x); + bb.w = bb.x2 - bb.x1; + bb.y1 = Math.min(bb.y1, y); + bb.y2 = Math.max(bb.y2, y); + bb.h = bb.y2 - bb.y1; +}; +var expandBoundingBox = function expandBoundingBox(bb) { + var padding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + bb.x1 -= padding; + bb.x2 += padding; + bb.y1 -= padding; + bb.y2 += padding; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + return bb; +}; +var expandBoundingBoxSides = function expandBoundingBoxSides(bb) { + var padding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0]; + var top, right, bottom, left; + + if (padding.length === 1) { + top = right = bottom = left = padding[0]; + } else if (padding.length === 2) { + top = bottom = padding[0]; + left = right = padding[1]; + } else if (padding.length === 4) { + var _padding = _slicedToArray(padding, 4); + + top = _padding[0]; + right = _padding[1]; + bottom = _padding[2]; + left = _padding[3]; + } + + bb.x1 -= left; + bb.x2 += right; + bb.y1 -= top; + bb.y2 += bottom; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + return bb; +}; + +var assignBoundingBox = function assignBoundingBox(bb1, bb2) { + bb1.x1 = bb2.x1; + bb1.y1 = bb2.y1; + bb1.x2 = bb2.x2; + bb1.y2 = bb2.y2; + bb1.w = bb1.x2 - bb1.x1; + bb1.h = bb1.y2 - bb1.y1; +}; +var boundingBoxesIntersect = function boundingBoxesIntersect(bb1, bb2) { + // case: one bb to right of other + if (bb1.x1 > bb2.x2) { + return false; + } + + if (bb2.x1 > bb1.x2) { + return false; + } // case: one bb to left of other + + + if (bb1.x2 < bb2.x1) { + return false; + } + + if (bb2.x2 < bb1.x1) { + return false; + } // case: one bb above other + + + if (bb1.y2 < bb2.y1) { + return false; + } + + if (bb2.y2 < bb1.y1) { + return false; + } // case: one bb below other + + + if (bb1.y1 > bb2.y2) { + return false; + } + + if (bb2.y1 > bb1.y2) { + return false; + } // otherwise, must have some overlap + + + return true; +}; +var inBoundingBox = function inBoundingBox(bb, x, y) { + return bb.x1 <= x && x <= bb.x2 && bb.y1 <= y && y <= bb.y2; +}; +var pointInBoundingBox = function pointInBoundingBox(bb, pt) { + return inBoundingBox(bb, pt.x, pt.y); +}; +var boundingBoxInBoundingBox = function boundingBoxInBoundingBox(bb1, bb2) { + return inBoundingBox(bb1, bb2.x1, bb2.y1) && inBoundingBox(bb1, bb2.x2, bb2.y2); +}; +var roundRectangleIntersectLine = function roundRectangleIntersectLine(x, y, nodeX, nodeY, width, height, padding) { + var cornerRadius = getRoundRectangleRadius(width, height); + var halfWidth = width / 2; + var halfHeight = height / 2; // Check intersections with straight line segments + + var straightLineIntersections; // Top segment, left to right + + { + var topStartX = nodeX - halfWidth + cornerRadius - padding; + var topStartY = nodeY - halfHeight - padding; + var topEndX = nodeX + halfWidth - cornerRadius + padding; + var topEndY = topStartY; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Right segment, top to bottom + + { + var rightStartX = nodeX + halfWidth + padding; + var rightStartY = nodeY - halfHeight + cornerRadius - padding; + var rightEndX = rightStartX; + var rightEndY = nodeY + halfHeight - cornerRadius + padding; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, rightStartX, rightStartY, rightEndX, rightEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Bottom segment, left to right + + { + var bottomStartX = nodeX - halfWidth + cornerRadius - padding; + var bottomStartY = nodeY + halfHeight + padding; + var bottomEndX = nodeX + halfWidth - cornerRadius + padding; + var bottomEndY = bottomStartY; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, bottomStartX, bottomStartY, bottomEndX, bottomEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Left segment, top to bottom + + { + var leftStartX = nodeX - halfWidth - padding; + var leftStartY = nodeY - halfHeight + cornerRadius - padding; + var leftEndX = leftStartX; + var leftEndY = nodeY + halfHeight - cornerRadius + padding; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, leftStartX, leftStartY, leftEndX, leftEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Check intersections with arc segments + + var arcIntersections; // Top Left + + { + var topLeftCenterX = nodeX - halfWidth + cornerRadius; + var topLeftCenterY = nodeY - halfHeight + cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, topLeftCenterX, topLeftCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] <= topLeftCenterX && arcIntersections[1] <= topLeftCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } // Top Right + + { + var topRightCenterX = nodeX + halfWidth - cornerRadius; + var topRightCenterY = nodeY - halfHeight + cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, topRightCenterX, topRightCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] >= topRightCenterX && arcIntersections[1] <= topRightCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } // Bottom Right + + { + var bottomRightCenterX = nodeX + halfWidth - cornerRadius; + var bottomRightCenterY = nodeY + halfHeight - cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, bottomRightCenterX, bottomRightCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] >= bottomRightCenterX && arcIntersections[1] >= bottomRightCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } // Bottom Left + + { + var bottomLeftCenterX = nodeX - halfWidth + cornerRadius; + var bottomLeftCenterY = nodeY + halfHeight - cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, bottomLeftCenterX, bottomLeftCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] <= bottomLeftCenterX && arcIntersections[1] >= bottomLeftCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } + return []; // if nothing +}; +var inLineVicinity = function inLineVicinity(x, y, lx1, ly1, lx2, ly2, tolerance) { + var t = tolerance; + var x1 = Math.min(lx1, lx2); + var x2 = Math.max(lx1, lx2); + var y1 = Math.min(ly1, ly2); + var y2 = Math.max(ly1, ly2); + return x1 - t <= x && x <= x2 + t && y1 - t <= y && y <= y2 + t; +}; +var inBezierVicinity = function inBezierVicinity(x, y, x1, y1, x2, y2, x3, y3, tolerance) { + var bb = { + x1: Math.min(x1, x3, x2) - tolerance, + x2: Math.max(x1, x3, x2) + tolerance, + y1: Math.min(y1, y3, y2) - tolerance, + y2: Math.max(y1, y3, y2) + tolerance + }; // if outside the rough bounding box for the bezier, then it can't be a hit + + if (x < bb.x1 || x > bb.x2 || y < bb.y1 || y > bb.y2) { + // console.log('bezier out of rough bb') + return false; + } else { + // console.log('do more expensive check'); + return true; + } +}; +var solveQuadratic = function solveQuadratic(a, b, c, val) { + c -= val; + var r = b * b - 4 * a * c; + + if (r < 0) { + return []; + } + + var sqrtR = Math.sqrt(r); + var denom = 2 * a; + var root1 = (-b + sqrtR) / denom; + var root2 = (-b - sqrtR) / denom; + return [root1, root2]; +}; +var solveCubic = function solveCubic(a, b, c, d, result) { + // Solves a cubic function, returns root in form [r1, i1, r2, i2, r3, i3], where + // r is the real component, i is the imaginary component + // An implementation of the Cardano method from the year 1545 + // http://en.wikipedia.org/wiki/Cubic_function#The_nature_of_the_roots + var epsilon = 0.00001; // avoid division by zero while keeping the overall expression close in value + + if (a === 0) { + a = epsilon; + } + + b /= a; + c /= a; + d /= a; + var discriminant, q, r, dum1, s, t, term1, r13; + q = (3.0 * c - b * b) / 9.0; + r = -(27.0 * d) + b * (9.0 * c - 2.0 * (b * b)); + r /= 54.0; + discriminant = q * q * q + r * r; + result[1] = 0; + term1 = b / 3.0; + + if (discriminant > 0) { + s = r + Math.sqrt(discriminant); + s = s < 0 ? -Math.pow(-s, 1.0 / 3.0) : Math.pow(s, 1.0 / 3.0); + t = r - Math.sqrt(discriminant); + t = t < 0 ? -Math.pow(-t, 1.0 / 3.0) : Math.pow(t, 1.0 / 3.0); + result[0] = -term1 + s + t; + term1 += (s + t) / 2.0; + result[4] = result[2] = -term1; + term1 = Math.sqrt(3.0) * (-t + s) / 2; + result[3] = term1; + result[5] = -term1; + return; + } + + result[5] = result[3] = 0; + + if (discriminant === 0) { + r13 = r < 0 ? -Math.pow(-r, 1.0 / 3.0) : Math.pow(r, 1.0 / 3.0); + result[0] = -term1 + 2.0 * r13; + result[4] = result[2] = -(r13 + term1); + return; + } + + q = -q; + dum1 = q * q * q; + dum1 = Math.acos(r / Math.sqrt(dum1)); + r13 = 2.0 * Math.sqrt(q); + result[0] = -term1 + r13 * Math.cos(dum1 / 3.0); + result[2] = -term1 + r13 * Math.cos((dum1 + 2.0 * Math.PI) / 3.0); + result[4] = -term1 + r13 * Math.cos((dum1 + 4.0 * Math.PI) / 3.0); + return; +}; +var sqdistToQuadraticBezier = function sqdistToQuadraticBezier(x, y, x1, y1, x2, y2, x3, y3) { + // Find minimum distance by using the minimum of the distance + // function between the given point and the curve + // This gives the coefficients of the resulting cubic equation + // whose roots tell us where a possible minimum is + // (Coefficients are divided by 4) + var a = 1.0 * x1 * x1 - 4 * x1 * x2 + 2 * x1 * x3 + 4 * x2 * x2 - 4 * x2 * x3 + x3 * x3 + y1 * y1 - 4 * y1 * y2 + 2 * y1 * y3 + 4 * y2 * y2 - 4 * y2 * y3 + y3 * y3; + var b = 1.0 * 9 * x1 * x2 - 3 * x1 * x1 - 3 * x1 * x3 - 6 * x2 * x2 + 3 * x2 * x3 + 9 * y1 * y2 - 3 * y1 * y1 - 3 * y1 * y3 - 6 * y2 * y2 + 3 * y2 * y3; + var c = 1.0 * 3 * x1 * x1 - 6 * x1 * x2 + x1 * x3 - x1 * x + 2 * x2 * x2 + 2 * x2 * x - x3 * x + 3 * y1 * y1 - 6 * y1 * y2 + y1 * y3 - y1 * y + 2 * y2 * y2 + 2 * y2 * y - y3 * y; + var d = 1.0 * x1 * x2 - x1 * x1 + x1 * x - x2 * x + y1 * y2 - y1 * y1 + y1 * y - y2 * y; // debug("coefficients: " + a / a + ", " + b / a + ", " + c / a + ", " + d / a); + + var roots = []; // Use the cubic solving algorithm + + solveCubic(a, b, c, d, roots); + var zeroThreshold = 0.0000001; + var params = []; + + for (var index = 0; index < 6; index += 2) { + if (Math.abs(roots[index + 1]) < zeroThreshold && roots[index] >= 0 && roots[index] <= 1.0) { + params.push(roots[index]); + } + } + + params.push(1.0); + params.push(0.0); + var minDistanceSquared = -1; + var curX, curY, distSquared; + + for (var i = 0; i < params.length; i++) { + curX = Math.pow(1.0 - params[i], 2.0) * x1 + 2.0 * (1 - params[i]) * params[i] * x2 + params[i] * params[i] * x3; + curY = Math.pow(1 - params[i], 2.0) * y1 + 2 * (1.0 - params[i]) * params[i] * y2 + params[i] * params[i] * y3; + distSquared = Math.pow(curX - x, 2) + Math.pow(curY - y, 2); // debug('distance for param ' + params[i] + ": " + Math.sqrt(distSquared)); + + if (minDistanceSquared >= 0) { + if (distSquared < minDistanceSquared) { + minDistanceSquared = distSquared; + } + } else { + minDistanceSquared = distSquared; + } + } + + return minDistanceSquared; +}; +var sqdistToFiniteLine = function sqdistToFiniteLine(x, y, x1, y1, x2, y2) { + var offset = [x - x1, y - y1]; + var line = [x2 - x1, y2 - y1]; + var lineSq = line[0] * line[0] + line[1] * line[1]; + var hypSq = offset[0] * offset[0] + offset[1] * offset[1]; + var dotProduct = offset[0] * line[0] + offset[1] * line[1]; + var adjSq = dotProduct * dotProduct / lineSq; + + if (dotProduct < 0) { + return hypSq; + } + + if (adjSq > lineSq) { + return (x - x2) * (x - x2) + (y - y2) * (y - y2); + } + + return hypSq - adjSq; +}; +var pointInsidePolygonPoints = function pointInsidePolygonPoints(x, y, points) { + var x1, y1, x2, y2; + var y3; // Intersect with vertical line through (x, y) + + var up = 0; // let down = 0; + + for (var i = 0; i < points.length / 2; i++) { + x1 = points[i * 2]; + y1 = points[i * 2 + 1]; + + if (i + 1 < points.length / 2) { + x2 = points[(i + 1) * 2]; + y2 = points[(i + 1) * 2 + 1]; + } else { + x2 = points[(i + 1 - points.length / 2) * 2]; + y2 = points[(i + 1 - points.length / 2) * 2 + 1]; + } + + if (x1 == x && x2 == x) ; else if (x1 >= x && x >= x2 || x1 <= x && x <= x2) { + y3 = (x - x1) / (x2 - x1) * (y2 - y1) + y1; + + if (y3 > y) { + up++; + } // if( y3 < y ){ + // down++; + // } + + } else { + continue; + } + } + + if (up % 2 === 0) { + return false; + } else { + return true; + } +}; +var pointInsidePolygon = function pointInsidePolygon(x, y, basePoints, centerX, centerY, width, height, direction, padding) { + var transformedPoints = new Array(basePoints.length); // Gives negative angle + + var angle; + + if (direction[0] != null) { + angle = Math.atan(direction[1] / direction[0]); + + if (direction[0] < 0) { + angle = angle + Math.PI / 2; + } else { + angle = -angle - Math.PI / 2; + } + } else { + angle = direction; + } + + var cos = Math.cos(-angle); + var sin = Math.sin(-angle); // console.log("base: " + basePoints); + + for (var i = 0; i < transformedPoints.length / 2; i++) { + transformedPoints[i * 2] = width / 2 * (basePoints[i * 2] * cos - basePoints[i * 2 + 1] * sin); + transformedPoints[i * 2 + 1] = height / 2 * (basePoints[i * 2 + 1] * cos + basePoints[i * 2] * sin); + transformedPoints[i * 2] += centerX; + transformedPoints[i * 2 + 1] += centerY; + } + + var points; + + if (padding > 0) { + var expandedLineSet = expandPolygon(transformedPoints, -padding); + points = joinLines(expandedLineSet); + } else { + points = transformedPoints; + } + + return pointInsidePolygonPoints(x, y, points); +}; +var pointInsideRoundPolygon = function pointInsideRoundPolygon(x, y, basePoints, centerX, centerY, width, height) { + var cutPolygonPoints = new Array(basePoints.length); + var halfW = width / 2; + var halfH = height / 2; + var cornerRadius = getRoundPolygonRadius(width, height); + var squaredCornerRadius = cornerRadius * cornerRadius; + + for (var i = 0; i < basePoints.length / 4; i++) { + var sourceUv = void 0, + destUv = void 0; + + if (i === 0) { + sourceUv = basePoints.length - 2; + } else { + sourceUv = i * 4 - 2; + } + + destUv = i * 4 + 2; + var px = centerX + halfW * basePoints[i * 4]; + var py = centerY + halfH * basePoints[i * 4 + 1]; + var cosTheta = -basePoints[sourceUv] * basePoints[destUv] - basePoints[sourceUv + 1] * basePoints[destUv + 1]; + var offset = cornerRadius / Math.tan(Math.acos(cosTheta) / 2); + var cp0x = px - offset * basePoints[sourceUv]; + var cp0y = py - offset * basePoints[sourceUv + 1]; + var cp1x = px + offset * basePoints[destUv]; + var cp1y = py + offset * basePoints[destUv + 1]; + cutPolygonPoints[i * 4] = cp0x; + cutPolygonPoints[i * 4 + 1] = cp0y; + cutPolygonPoints[i * 4 + 2] = cp1x; + cutPolygonPoints[i * 4 + 3] = cp1y; + var orthx = basePoints[sourceUv + 1]; + var orthy = -basePoints[sourceUv]; + var cosAlpha = orthx * basePoints[destUv] + orthy * basePoints[destUv + 1]; + + if (cosAlpha < 0) { + orthx *= -1; + orthy *= -1; + } + + var cx = cp0x + orthx * cornerRadius; + var cy = cp0y + orthy * cornerRadius; + var squaredDistance = Math.pow(cx - x, 2) + Math.pow(cy - y, 2); + + if (squaredDistance <= squaredCornerRadius) { + return true; + } + } + + return pointInsidePolygonPoints(x, y, cutPolygonPoints); +}; +var joinLines = function joinLines(lineSet) { + var vertices = new Array(lineSet.length / 2); + var currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY; + var nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY; + + for (var i = 0; i < lineSet.length / 4; i++) { + currentLineStartX = lineSet[i * 4]; + currentLineStartY = lineSet[i * 4 + 1]; + currentLineEndX = lineSet[i * 4 + 2]; + currentLineEndY = lineSet[i * 4 + 3]; + + if (i < lineSet.length / 4 - 1) { + nextLineStartX = lineSet[(i + 1) * 4]; + nextLineStartY = lineSet[(i + 1) * 4 + 1]; + nextLineEndX = lineSet[(i + 1) * 4 + 2]; + nextLineEndY = lineSet[(i + 1) * 4 + 3]; + } else { + nextLineStartX = lineSet[0]; + nextLineStartY = lineSet[1]; + nextLineEndX = lineSet[2]; + nextLineEndY = lineSet[3]; + } + + var intersection = finiteLinesIntersect(currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY, nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY, true); + vertices[i * 2] = intersection[0]; + vertices[i * 2 + 1] = intersection[1]; + } + + return vertices; +}; +var expandPolygon = function expandPolygon(points, pad) { + var expandedLineSet = new Array(points.length * 2); + var currentPointX, currentPointY, nextPointX, nextPointY; + + for (var i = 0; i < points.length / 2; i++) { + currentPointX = points[i * 2]; + currentPointY = points[i * 2 + 1]; + + if (i < points.length / 2 - 1) { + nextPointX = points[(i + 1) * 2]; + nextPointY = points[(i + 1) * 2 + 1]; + } else { + nextPointX = points[0]; + nextPointY = points[1]; + } // Current line: [currentPointX, currentPointY] to [nextPointX, nextPointY] + // Assume CCW polygon winding + + + var offsetX = nextPointY - currentPointY; + var offsetY = -(nextPointX - currentPointX); // Normalize + + var offsetLength = Math.sqrt(offsetX * offsetX + offsetY * offsetY); + var normalizedOffsetX = offsetX / offsetLength; + var normalizedOffsetY = offsetY / offsetLength; + expandedLineSet[i * 4] = currentPointX + normalizedOffsetX * pad; + expandedLineSet[i * 4 + 1] = currentPointY + normalizedOffsetY * pad; + expandedLineSet[i * 4 + 2] = nextPointX + normalizedOffsetX * pad; + expandedLineSet[i * 4 + 3] = nextPointY + normalizedOffsetY * pad; + } + + return expandedLineSet; +}; +var intersectLineEllipse = function intersectLineEllipse(x, y, centerX, centerY, ellipseWradius, ellipseHradius) { + var dispX = centerX - x; + var dispY = centerY - y; + dispX /= ellipseWradius; + dispY /= ellipseHradius; + var len = Math.sqrt(dispX * dispX + dispY * dispY); + var newLength = len - 1; + + if (newLength < 0) { + return []; + } + + var lenProportion = newLength / len; + return [(centerX - x) * lenProportion + x, (centerY - y) * lenProportion + y]; +}; +var checkInEllipse = function checkInEllipse(x, y, width, height, centerX, centerY, padding) { + x -= centerX; + y -= centerY; + x /= width / 2 + padding; + y /= height / 2 + padding; + return x * x + y * y <= 1; +}; // Returns intersections of increasing distance from line's start point + +var intersectLineCircle = function intersectLineCircle(x1, y1, x2, y2, centerX, centerY, radius) { + // Calculate d, direction vector of line + var d = [x2 - x1, y2 - y1]; // Direction vector of line + + var f = [x1 - centerX, y1 - centerY]; + var a = d[0] * d[0] + d[1] * d[1]; + var b = 2 * (f[0] * d[0] + f[1] * d[1]); + var c = f[0] * f[0] + f[1] * f[1] - radius * radius; + var discriminant = b * b - 4 * a * c; + + if (discriminant < 0) { + return []; + } + + var t1 = (-b + Math.sqrt(discriminant)) / (2 * a); + var t2 = (-b - Math.sqrt(discriminant)) / (2 * a); + var tMin = Math.min(t1, t2); + var tMax = Math.max(t1, t2); + var inRangeParams = []; + + if (tMin >= 0 && tMin <= 1) { + inRangeParams.push(tMin); + } + + if (tMax >= 0 && tMax <= 1) { + inRangeParams.push(tMax); + } + + if (inRangeParams.length === 0) { + return []; + } + + var nearIntersectionX = inRangeParams[0] * d[0] + x1; + var nearIntersectionY = inRangeParams[0] * d[1] + y1; + + if (inRangeParams.length > 1) { + if (inRangeParams[0] == inRangeParams[1]) { + return [nearIntersectionX, nearIntersectionY]; + } else { + var farIntersectionX = inRangeParams[1] * d[0] + x1; + var farIntersectionY = inRangeParams[1] * d[1] + y1; + return [nearIntersectionX, nearIntersectionY, farIntersectionX, farIntersectionY]; + } + } else { + return [nearIntersectionX, nearIntersectionY]; + } +}; +var midOfThree = function midOfThree(a, b, c) { + if (b <= a && a <= c || c <= a && a <= b) { + return a; + } else if (a <= b && b <= c || c <= b && b <= a) { + return b; + } else { + return c; + } +}; // (x1,y1)=>(x2,y2) intersect with (x3,y3)=>(x4,y4) + +var finiteLinesIntersect = function finiteLinesIntersect(x1, y1, x2, y2, x3, y3, x4, y4, infiniteLines) { + var dx13 = x1 - x3; + var dx21 = x2 - x1; + var dx43 = x4 - x3; + var dy13 = y1 - y3; + var dy21 = y2 - y1; + var dy43 = y4 - y3; + var ua_t = dx43 * dy13 - dy43 * dx13; + var ub_t = dx21 * dy13 - dy21 * dx13; + var u_b = dy43 * dx21 - dx43 * dy21; + + if (u_b !== 0) { + var ua = ua_t / u_b; + var ub = ub_t / u_b; + var flptThreshold = 0.001; + + var _min = 0 - flptThreshold; + + var _max = 1 + flptThreshold; + + if (_min <= ua && ua <= _max && _min <= ub && ub <= _max) { + return [x1 + ua * dx21, y1 + ua * dy21]; + } else { + if (!infiniteLines) { + return []; + } else { + return [x1 + ua * dx21, y1 + ua * dy21]; + } + } + } else { + if (ua_t === 0 || ub_t === 0) { + // Parallel, coincident lines. Check if overlap + // Check endpoint of second line + if (midOfThree(x1, x2, x4) === x4) { + return [x4, y4]; + } // Check start point of second line + + + if (midOfThree(x1, x2, x3) === x3) { + return [x3, y3]; + } // Endpoint of first line + + + if (midOfThree(x3, x4, x2) === x2) { + return [x2, y2]; + } + + return []; + } else { + // Parallel, non-coincident + return []; + } + } +}; // math.polygonIntersectLine( x, y, basePoints, centerX, centerY, width, height, padding ) +// intersect a node polygon (pts transformed) +// +// math.polygonIntersectLine( x, y, basePoints, centerX, centerY ) +// intersect the points (no transform) + +var polygonIntersectLine = function polygonIntersectLine(x, y, basePoints, centerX, centerY, width, height, padding) { + var intersections = []; + var intersection; + var transformedPoints = new Array(basePoints.length); + var doTransform = true; + + if (width == null) { + doTransform = false; + } + + var points; + + if (doTransform) { + for (var i = 0; i < transformedPoints.length / 2; i++) { + transformedPoints[i * 2] = basePoints[i * 2] * width + centerX; + transformedPoints[i * 2 + 1] = basePoints[i * 2 + 1] * height + centerY; + } + + if (padding > 0) { + var expandedLineSet = expandPolygon(transformedPoints, -padding); + points = joinLines(expandedLineSet); + } else { + points = transformedPoints; + } + } else { + points = basePoints; + } + + var currentX, currentY, nextX, nextY; + + for (var _i2 = 0; _i2 < points.length / 2; _i2++) { + currentX = points[_i2 * 2]; + currentY = points[_i2 * 2 + 1]; + + if (_i2 < points.length / 2 - 1) { + nextX = points[(_i2 + 1) * 2]; + nextY = points[(_i2 + 1) * 2 + 1]; + } else { + nextX = points[0]; + nextY = points[1]; + } + + intersection = finiteLinesIntersect(x, y, centerX, centerY, currentX, currentY, nextX, nextY); + + if (intersection.length !== 0) { + intersections.push(intersection[0], intersection[1]); + } + } + + return intersections; +}; +var roundPolygonIntersectLine = function roundPolygonIntersectLine(x, y, basePoints, centerX, centerY, width, height, padding) { + var intersections = []; + var intersection; + var lines = new Array(basePoints.length); + var halfW = width / 2; + var halfH = height / 2; + var cornerRadius = getRoundPolygonRadius(width, height); + + for (var i = 0; i < basePoints.length / 4; i++) { + var sourceUv = void 0, + destUv = void 0; + + if (i === 0) { + sourceUv = basePoints.length - 2; + } else { + sourceUv = i * 4 - 2; + } + + destUv = i * 4 + 2; + var px = centerX + halfW * basePoints[i * 4]; + var py = centerY + halfH * basePoints[i * 4 + 1]; + var cosTheta = -basePoints[sourceUv] * basePoints[destUv] - basePoints[sourceUv + 1] * basePoints[destUv + 1]; + var offset = cornerRadius / Math.tan(Math.acos(cosTheta) / 2); + var cp0x = px - offset * basePoints[sourceUv]; + var cp0y = py - offset * basePoints[sourceUv + 1]; + var cp1x = px + offset * basePoints[destUv]; + var cp1y = py + offset * basePoints[destUv + 1]; + + if (i === 0) { + lines[basePoints.length - 2] = cp0x; + lines[basePoints.length - 1] = cp0y; + } else { + lines[i * 4 - 2] = cp0x; + lines[i * 4 - 1] = cp0y; + } + + lines[i * 4] = cp1x; + lines[i * 4 + 1] = cp1y; + var orthx = basePoints[sourceUv + 1]; + var orthy = -basePoints[sourceUv]; + var cosAlpha = orthx * basePoints[destUv] + orthy * basePoints[destUv + 1]; + + if (cosAlpha < 0) { + orthx *= -1; + orthy *= -1; + } + + var cx = cp0x + orthx * cornerRadius; + var cy = cp0y + orthy * cornerRadius; + intersection = intersectLineCircle(x, y, centerX, centerY, cx, cy, cornerRadius); + + if (intersection.length !== 0) { + intersections.push(intersection[0], intersection[1]); + } + } + + for (var _i3 = 0; _i3 < lines.length / 4; _i3++) { + intersection = finiteLinesIntersect(x, y, centerX, centerY, lines[_i3 * 4], lines[_i3 * 4 + 1], lines[_i3 * 4 + 2], lines[_i3 * 4 + 3], false); + + if (intersection.length !== 0) { + intersections.push(intersection[0], intersection[1]); + } + } + + if (intersections.length > 2) { + var lowestIntersection = [intersections[0], intersections[1]]; + var lowestSquaredDistance = Math.pow(lowestIntersection[0] - x, 2) + Math.pow(lowestIntersection[1] - y, 2); + + for (var _i4 = 1; _i4 < intersections.length / 2; _i4++) { + var squaredDistance = Math.pow(intersections[_i4 * 2] - x, 2) + Math.pow(intersections[_i4 * 2 + 1] - y, 2); + + if (squaredDistance <= lowestSquaredDistance) { + lowestIntersection[0] = intersections[_i4 * 2]; + lowestIntersection[1] = intersections[_i4 * 2 + 1]; + lowestSquaredDistance = squaredDistance; + } + } + + return lowestIntersection; + } + + return intersections; +}; +var shortenIntersection = function shortenIntersection(intersection, offset, amount) { + var disp = [intersection[0] - offset[0], intersection[1] - offset[1]]; + var length = Math.sqrt(disp[0] * disp[0] + disp[1] * disp[1]); + var lenRatio = (length - amount) / length; + + if (lenRatio < 0) { + lenRatio = 0.00001; + } + + return [offset[0] + lenRatio * disp[0], offset[1] + lenRatio * disp[1]]; +}; +var generateUnitNgonPointsFitToSquare = function generateUnitNgonPointsFitToSquare(sides, rotationRadians) { + var points = generateUnitNgonPoints(sides, rotationRadians); + points = fitPolygonToSquare(points); + return points; +}; +var fitPolygonToSquare = function fitPolygonToSquare(points) { + var x, y; + var sides = points.length / 2; + var minX = Infinity, + minY = Infinity, + maxX = -Infinity, + maxY = -Infinity; + + for (var i = 0; i < sides; i++) { + x = points[2 * i]; + y = points[2 * i + 1]; + minX = Math.min(minX, x); + maxX = Math.max(maxX, x); + minY = Math.min(minY, y); + maxY = Math.max(maxY, y); + } // stretch factors + + + var sx = 2 / (maxX - minX); + var sy = 2 / (maxY - minY); + + for (var _i5 = 0; _i5 < sides; _i5++) { + x = points[2 * _i5] = points[2 * _i5] * sx; + y = points[2 * _i5 + 1] = points[2 * _i5 + 1] * sy; + minX = Math.min(minX, x); + maxX = Math.max(maxX, x); + minY = Math.min(minY, y); + maxY = Math.max(maxY, y); + } + + if (minY < -1) { + for (var _i6 = 0; _i6 < sides; _i6++) { + y = points[2 * _i6 + 1] = points[2 * _i6 + 1] + (-1 - minY); + } + } + + return points; +}; +var generateUnitNgonPoints = function generateUnitNgonPoints(sides, rotationRadians) { + var increment = 1.0 / sides * 2 * Math.PI; + var startAngle = sides % 2 === 0 ? Math.PI / 2.0 + increment / 2.0 : Math.PI / 2.0; + startAngle += rotationRadians; + var points = new Array(sides * 2); + var currentAngle; + + for (var i = 0; i < sides; i++) { + currentAngle = i * increment + startAngle; + points[2 * i] = Math.cos(currentAngle); // x + + points[2 * i + 1] = Math.sin(-currentAngle); // y + } + + return points; +}; // Set the default radius, unless half of width or height is smaller than default + +var getRoundRectangleRadius = function getRoundRectangleRadius(width, height) { + return Math.min(width / 4, height / 4, 8); +}; // Set the default radius + +var getRoundPolygonRadius = function getRoundPolygonRadius(width, height) { + return Math.min(width / 10, height / 10, 8); +}; +var getCutRectangleCornerLength = function getCutRectangleCornerLength() { + return 8; +}; +var bezierPtsToQuadCoeff = function bezierPtsToQuadCoeff(p0, p1, p2) { + return [p0 - 2 * p1 + p2, 2 * (p1 - p0), p0]; +}; // get curve width, height, and control point position offsets as a percentage of node height / width + +var getBarrelCurveConstants = function getBarrelCurveConstants(width, height) { + return { + heightOffset: Math.min(15, 0.05 * height), + widthOffset: Math.min(100, 0.25 * width), + ctrlPtOffsetPct: 0.05 + }; +}; + +var pageRankDefaults = defaults$g({ + dampingFactor: 0.8, + precision: 0.000001, + iterations: 200, + weight: function weight(edge) { + return 1; + } +}); +var elesfn$o = { + pageRank: function pageRank(options) { + var _pageRankDefaults = pageRankDefaults(options), + dampingFactor = _pageRankDefaults.dampingFactor, + precision = _pageRankDefaults.precision, + iterations = _pageRankDefaults.iterations, + weight = _pageRankDefaults.weight; + + var cy = this._private.cy; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + var numNodes = nodes.length; + var numNodesSqd = numNodes * numNodes; + var numEdges = edges.length; // Construct transposed adjacency matrix + // First lets have a zeroed matrix of the right size + // We'll also keep track of the sum of each column + + var matrix = new Array(numNodesSqd); + var columnSum = new Array(numNodes); + var additionalProb = (1 - dampingFactor) / numNodes; // Create null matrix + + for (var i = 0; i < numNodes; i++) { + for (var j = 0; j < numNodes; j++) { + var n = i * numNodes + j; + matrix[n] = 0; + } + + columnSum[i] = 0; + } // Now, process edges + + + for (var _i = 0; _i < numEdges; _i++) { + var edge = edges[_i]; + var srcId = edge.data('source'); + var tgtId = edge.data('target'); // Don't include loops in the matrix + + if (srcId === tgtId) { + continue; + } + + var s = nodes.indexOfId(srcId); + var t = nodes.indexOfId(tgtId); + var w = weight(edge); + + var _n = t * numNodes + s; // Update matrix + + + matrix[_n] += w; // Update column sum + + columnSum[s] += w; + } // Add additional probability based on damping factor + // Also, take into account columns that have sum = 0 + + + var p = 1.0 / numNodes + additionalProb; // Shorthand + // Traverse matrix, column by column + + for (var _j = 0; _j < numNodes; _j++) { + if (columnSum[_j] === 0) { + // No 'links' out from node jth, assume equal probability for each possible node + for (var _i2 = 0; _i2 < numNodes; _i2++) { + var _n2 = _i2 * numNodes + _j; + + matrix[_n2] = p; + } + } else { + // Node jth has outgoing link, compute normalized probabilities + for (var _i3 = 0; _i3 < numNodes; _i3++) { + var _n3 = _i3 * numNodes + _j; + + matrix[_n3] = matrix[_n3] / columnSum[_j] + additionalProb; + } + } + } // Compute dominant eigenvector using power method + + + var eigenvector = new Array(numNodes); + var temp = new Array(numNodes); + var previous; // Start with a vector of all 1's + // Also, initialize a null vector which will be used as shorthand + + for (var _i4 = 0; _i4 < numNodes; _i4++) { + eigenvector[_i4] = 1; + } + + for (var iter = 0; iter < iterations; iter++) { + // Temp array with all 0's + for (var _i5 = 0; _i5 < numNodes; _i5++) { + temp[_i5] = 0; + } // Multiply matrix with previous result + + + for (var _i6 = 0; _i6 < numNodes; _i6++) { + for (var _j2 = 0; _j2 < numNodes; _j2++) { + var _n4 = _i6 * numNodes + _j2; + + temp[_i6] += matrix[_n4] * eigenvector[_j2]; + } + } + + inPlaceSumNormalize(temp); + previous = eigenvector; + eigenvector = temp; + temp = previous; + var diff = 0; // Compute difference (squared module) of both vectors + + for (var _i7 = 0; _i7 < numNodes; _i7++) { + var delta = previous[_i7] - eigenvector[_i7]; + diff += delta * delta; + } // If difference is less than the desired threshold, stop iterating + + + if (diff < precision) { + break; + } + } // Construct result + + + var res = { + rank: function rank(node) { + node = cy.collection(node)[0]; + return eigenvector[nodes.indexOf(node)]; + } + }; + return res; + } // pageRank + +}; // elesfn + +var defaults$f = defaults$g({ + root: null, + weight: function weight(edge) { + return 1; + }, + directed: false, + alpha: 0 +}); +var elesfn$n = { + degreeCentralityNormalized: function degreeCentralityNormalized(options) { + options = defaults$f(options); + var cy = this.cy(); + var nodes = this.nodes(); + var numNodes = nodes.length; + + if (!options.directed) { + var degrees = {}; + var maxDegree = 0; + + for (var i = 0; i < numNodes; i++) { + var node = nodes[i]; // add current node to the current options object and call degreeCentrality + + options.root = node; + var currDegree = this.degreeCentrality(options); + + if (maxDegree < currDegree.degree) { + maxDegree = currDegree.degree; + } + + degrees[node.id()] = currDegree.degree; + } + + return { + degree: function degree(node) { + if (maxDegree === 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node); + } + + return degrees[node.id()] / maxDegree; + } + }; + } else { + var indegrees = {}; + var outdegrees = {}; + var maxIndegree = 0; + var maxOutdegree = 0; + + for (var _i = 0; _i < numNodes; _i++) { + var _node = nodes[_i]; + + var id = _node.id(); // add current node to the current options object and call degreeCentrality + + + options.root = _node; + + var _currDegree = this.degreeCentrality(options); + + if (maxIndegree < _currDegree.indegree) maxIndegree = _currDegree.indegree; + if (maxOutdegree < _currDegree.outdegree) maxOutdegree = _currDegree.outdegree; + indegrees[id] = _currDegree.indegree; + outdegrees[id] = _currDegree.outdegree; + } + + return { + indegree: function indegree(node) { + if (maxIndegree == 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node); + } + + return indegrees[node.id()] / maxIndegree; + }, + outdegree: function outdegree(node) { + if (maxOutdegree === 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node); + } + + return outdegrees[node.id()] / maxOutdegree; + } + }; + } + }, + // degreeCentralityNormalized + // Implemented from the algorithm in Opsahl's paper + // "Node centrality in weighted networks: Generalizing degree and shortest paths" + // check the heading 2 "Degree" + degreeCentrality: function degreeCentrality(options) { + options = defaults$f(options); + var cy = this.cy(); + var callingEles = this; + var _options = options, + root = _options.root, + weight = _options.weight, + directed = _options.directed, + alpha = _options.alpha; + root = cy.collection(root)[0]; + + if (!directed) { + var connEdges = root.connectedEdges().intersection(callingEles); + var k = connEdges.length; + var s = 0; // Now, sum edge weights + + for (var i = 0; i < connEdges.length; i++) { + s += weight(connEdges[i]); + } + + return { + degree: Math.pow(k, 1 - alpha) * Math.pow(s, alpha) + }; + } else { + var edges = root.connectedEdges(); + var incoming = edges.filter(function (edge) { + return edge.target().same(root) && callingEles.has(edge); + }); + var outgoing = edges.filter(function (edge) { + return edge.source().same(root) && callingEles.has(edge); + }); + var k_in = incoming.length; + var k_out = outgoing.length; + var s_in = 0; + var s_out = 0; // Now, sum incoming edge weights + + for (var _i2 = 0; _i2 < incoming.length; _i2++) { + s_in += weight(incoming[_i2]); + } // Now, sum outgoing edge weights + + + for (var _i3 = 0; _i3 < outgoing.length; _i3++) { + s_out += weight(outgoing[_i3]); + } + + return { + indegree: Math.pow(k_in, 1 - alpha) * Math.pow(s_in, alpha), + outdegree: Math.pow(k_out, 1 - alpha) * Math.pow(s_out, alpha) + }; + } + } // degreeCentrality + +}; // elesfn +// nice, short mathematical alias + +elesfn$n.dc = elesfn$n.degreeCentrality; +elesfn$n.dcn = elesfn$n.degreeCentralityNormalised = elesfn$n.degreeCentralityNormalized; + +var defaults$e = defaults$g({ + harmonic: true, + weight: function weight() { + return 1; + }, + directed: false, + root: null +}); +var elesfn$m = { + closenessCentralityNormalized: function closenessCentralityNormalized(options) { + var _defaults = defaults$e(options), + harmonic = _defaults.harmonic, + weight = _defaults.weight, + directed = _defaults.directed; + + var cy = this.cy(); + var closenesses = {}; + var maxCloseness = 0; + var nodes = this.nodes(); + var fw = this.floydWarshall({ + weight: weight, + directed: directed + }); // Compute closeness for every node and find the maximum closeness + + for (var i = 0; i < nodes.length; i++) { + var currCloseness = 0; + var node_i = nodes[i]; + + for (var j = 0; j < nodes.length; j++) { + if (i !== j) { + var d = fw.distance(node_i, nodes[j]); + + if (harmonic) { + currCloseness += 1 / d; + } else { + currCloseness += d; + } + } + } + + if (!harmonic) { + currCloseness = 1 / currCloseness; + } + + if (maxCloseness < currCloseness) { + maxCloseness = currCloseness; + } + + closenesses[node_i.id()] = currCloseness; + } + + return { + closeness: function closeness(node) { + if (maxCloseness == 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node)[0].id(); + } else { + // from is a node + node = node.id(); + } + + return closenesses[node] / maxCloseness; + } + }; + }, + // Implemented from pseudocode from wikipedia + closenessCentrality: function closenessCentrality(options) { + var _defaults2 = defaults$e(options), + root = _defaults2.root, + weight = _defaults2.weight, + directed = _defaults2.directed, + harmonic = _defaults2.harmonic; + + root = this.filter(root)[0]; // we need distance from this node to every other node + + var dijkstra = this.dijkstra({ + root: root, + weight: weight, + directed: directed + }); + var totalDistance = 0; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + var n = nodes[i]; + + if (!n.same(root)) { + var d = dijkstra.distanceTo(n); + + if (harmonic) { + totalDistance += 1 / d; + } else { + totalDistance += d; + } + } + } + + return harmonic ? totalDistance : 1 / totalDistance; + } // closenessCentrality + +}; // elesfn +// nice, short mathematical alias + +elesfn$m.cc = elesfn$m.closenessCentrality; +elesfn$m.ccn = elesfn$m.closenessCentralityNormalised = elesfn$m.closenessCentralityNormalized; + +var defaults$d = defaults$g({ + weight: null, + directed: false +}); +var elesfn$l = { + // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes + betweennessCentrality: function betweennessCentrality(options) { + var _defaults = defaults$d(options), + directed = _defaults.directed, + weight = _defaults.weight; + + var weighted = weight != null; + var cy = this.cy(); // starting + + var V = this.nodes(); + var A = {}; + var _C = {}; + var max = 0; + var C = { + set: function set(key, val) { + _C[key] = val; + + if (val > max) { + max = val; + } + }, + get: function get(key) { + return _C[key]; + } + }; // A contains the neighborhoods of every node + + for (var i = 0; i < V.length; i++) { + var v = V[i]; + var vid = v.id(); + + if (directed) { + A[vid] = v.outgoers().nodes(); // get outgoers of every node + } else { + A[vid] = v.openNeighborhood().nodes(); // get neighbors of every node + } + + C.set(vid, 0); + } + + var _loop = function _loop(s) { + var sid = V[s].id(); + var S = []; // stack + + var P = {}; + var g = {}; + var d = {}; + var Q = new Heap__default["default"](function (a, b) { + return d[a] - d[b]; + }); // queue + // init dictionaries + + for (var _i = 0; _i < V.length; _i++) { + var _vid = V[_i].id(); + + P[_vid] = []; + g[_vid] = 0; + d[_vid] = Infinity; + } + + g[sid] = 1; // sigma + + d[sid] = 0; // distance to s + + Q.push(sid); + + while (!Q.empty()) { + var _v = Q.pop(); + + S.push(_v); + + if (weighted) { + for (var j = 0; j < A[_v].length; j++) { + var w = A[_v][j]; + var vEle = cy.getElementById(_v); + var edge = void 0; + + if (vEle.edgesTo(w).length > 0) { + edge = vEle.edgesTo(w)[0]; + } else { + edge = w.edgesTo(vEle)[0]; + } + + var edgeWeight = weight(edge); + w = w.id(); + + if (d[w] > d[_v] + edgeWeight) { + d[w] = d[_v] + edgeWeight; + + if (Q.nodes.indexOf(w) < 0) { + //if w is not in Q + Q.push(w); + } else { + // update position if w is in Q + Q.updateItem(w); + } + + g[w] = 0; + P[w] = []; + } + + if (d[w] == d[_v] + edgeWeight) { + g[w] = g[w] + g[_v]; + P[w].push(_v); + } + } + } else { + for (var _j = 0; _j < A[_v].length; _j++) { + var _w = A[_v][_j].id(); + + if (d[_w] == Infinity) { + Q.push(_w); + d[_w] = d[_v] + 1; + } + + if (d[_w] == d[_v] + 1) { + g[_w] = g[_w] + g[_v]; + + P[_w].push(_v); + } + } + } + } + + var e = {}; + + for (var _i2 = 0; _i2 < V.length; _i2++) { + e[V[_i2].id()] = 0; + } + + while (S.length > 0) { + var _w2 = S.pop(); + + for (var _j2 = 0; _j2 < P[_w2].length; _j2++) { + var _v2 = P[_w2][_j2]; + e[_v2] = e[_v2] + g[_v2] / g[_w2] * (1 + e[_w2]); + } + + if (_w2 != V[s].id()) { + C.set(_w2, C.get(_w2) + e[_w2]); + } + } + }; + + for (var s = 0; s < V.length; s++) { + _loop(s); + } + + var ret = { + betweenness: function betweenness(node) { + var id = cy.collection(node).id(); + return C.get(id); + }, + betweennessNormalized: function betweennessNormalized(node) { + if (max == 0) { + return 0; + } + + var id = cy.collection(node).id(); + return C.get(id) / max; + } + }; // alias + + ret.betweennessNormalised = ret.betweennessNormalized; + return ret; + } // betweennessCentrality + +}; // elesfn +// nice, short mathematical alias + +elesfn$l.bc = elesfn$l.betweennessCentrality; + +// Implemented by Zoe Xi @zoexi for GSOC 2016 +/* eslint-disable no-unused-vars */ + +var defaults$c = defaults$g({ + expandFactor: 2, + // affects time of computation and cluster granularity to some extent: M * M + inflateFactor: 2, + // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j) + multFactor: 1, + // optional self loops for each node. Use a neutral value to improve cluster computations. + maxIterations: 20, + // maximum number of iterations of the MCL algorithm in a single run + attributes: [// attributes/features used to group nodes, ie. similarity values between nodes + function (edge) { + return 1; + }] +}); +/* eslint-enable */ + +var setOptions$3 = function setOptions(options) { + return defaults$c(options); +}; +/* eslint-enable */ + + +var getSimilarity$1 = function getSimilarity(edge, attributes) { + var total = 0; + + for (var i = 0; i < attributes.length; i++) { + total += attributes[i](edge); + } + + return total; +}; + +var addLoops = function addLoops(M, n, val) { + for (var i = 0; i < n; i++) { + M[i * n + i] = val; + } +}; + +var normalize = function normalize(M, n) { + var sum; + + for (var col = 0; col < n; col++) { + sum = 0; + + for (var row = 0; row < n; row++) { + sum += M[row * n + col]; + } + + for (var _row = 0; _row < n; _row++) { + M[_row * n + col] = M[_row * n + col] / sum; + } + } +}; // TODO: blocked matrix multiplication? + + +var mmult = function mmult(A, B, n) { + var C = new Array(n * n); + + for (var i = 0; i < n; i++) { + for (var j = 0; j < n; j++) { + C[i * n + j] = 0; + } + + for (var k = 0; k < n; k++) { + for (var _j = 0; _j < n; _j++) { + C[i * n + _j] += A[i * n + k] * B[k * n + _j]; + } + } + } + + return C; +}; + +var expand = function expand(M, n, expandFactor +/** power **/ +) { + var _M = M.slice(0); + + for (var p = 1; p < expandFactor; p++) { + M = mmult(M, _M, n); + } + + return M; +}; + +var inflate = function inflate(M, n, inflateFactor +/** r **/ +) { + var _M = new Array(n * n); // M(i,j) ^ inflatePower + + + for (var i = 0; i < n * n; i++) { + _M[i] = Math.pow(M[i], inflateFactor); + } + + normalize(_M, n); + return _M; +}; + +var hasConverged = function hasConverged(M, _M, n2, roundFactor) { + // Check that both matrices have the same elements (i,j) + for (var i = 0; i < n2; i++) { + var v1 = Math.round(M[i] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor); // truncate to 'roundFactor' decimal places + + var v2 = Math.round(_M[i] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor); + + if (v1 !== v2) { + return false; + } + } + + return true; +}; + +var assign$2 = function assign(M, n, nodes, cy) { + var clusters = []; + + for (var i = 0; i < n; i++) { + var cluster = []; + + for (var j = 0; j < n; j++) { + // Row-wise attractors and elements that they attract belong in same cluster + if (Math.round(M[i * n + j] * 1000) / 1000 > 0) { + cluster.push(nodes[j]); + } + } + + if (cluster.length !== 0) { + clusters.push(cy.collection(cluster)); + } + } + + return clusters; +}; + +var isDuplicate = function isDuplicate(c1, c2) { + for (var i = 0; i < c1.length; i++) { + if (!c2[i] || c1[i].id() !== c2[i].id()) { + return false; + } + } + + return true; +}; + +var removeDuplicates = function removeDuplicates(clusters) { + for (var i = 0; i < clusters.length; i++) { + for (var j = 0; j < clusters.length; j++) { + if (i != j && isDuplicate(clusters[i], clusters[j])) { + clusters.splice(j, 1); + } + } + } + + return clusters; +}; + +var markovClustering = function markovClustering(options) { + var nodes = this.nodes(); + var edges = this.edges(); + var cy = this.cy(); // Set parameters of algorithm: + + var opts = setOptions$3(options); // Map each node to its position in node array + + var id2position = {}; + + for (var i = 0; i < nodes.length; i++) { + id2position[nodes[i].id()] = i; + } // Generate stochastic matrix M from input graph G (should be symmetric/undirected) + + + var n = nodes.length, + n2 = n * n; + + var M = new Array(n2), + _M; + + for (var _i = 0; _i < n2; _i++) { + M[_i] = 0; + } + + for (var e = 0; e < edges.length; e++) { + var edge = edges[e]; + var _i2 = id2position[edge.source().id()]; + var j = id2position[edge.target().id()]; + var sim = getSimilarity$1(edge, opts.attributes); + M[_i2 * n + j] += sim; // G should be symmetric and undirected + + M[j * n + _i2] += sim; + } // Begin Markov cluster algorithm + // Step 1: Add self loops to each node, ie. add multFactor to matrix diagonal + + + addLoops(M, n, opts.multFactor); // Step 2: M = normalize( M ); + + normalize(M, n); + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + isStillMoving = false; // Step 3: + + _M = expand(M, n, opts.expandFactor); // Step 4: + + M = inflate(_M, n, opts.inflateFactor); // Step 5: check to see if ~steady state has been reached + + if (!hasConverged(M, _M, n2, 4)) { + isStillMoving = true; + } + + iterations++; + } // Build clusters from matrix + + + var clusters = assign$2(M, n, nodes, cy); // Remove duplicate clusters due to symmetry of graph and M matrix + + clusters = removeDuplicates(clusters); + return clusters; +}; + +var markovClustering$1 = { + markovClustering: markovClustering, + mcl: markovClustering +}; + +// Common distance metrics for clustering algorithms + +var identity = function identity(x) { + return x; +}; + +var absDiff = function absDiff(p, q) { + return Math.abs(q - p); +}; + +var addAbsDiff = function addAbsDiff(total, p, q) { + return total + absDiff(p, q); +}; + +var addSquaredDiff = function addSquaredDiff(total, p, q) { + return total + Math.pow(q - p, 2); +}; + +var sqrt = function sqrt(x) { + return Math.sqrt(x); +}; + +var maxAbsDiff = function maxAbsDiff(currentMax, p, q) { + return Math.max(currentMax, absDiff(p, q)); +}; + +var getDistance = function getDistance(length, getP, getQ, init, visit) { + var post = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : identity; + var ret = init; + var p, q; + + for (var dim = 0; dim < length; dim++) { + p = getP(dim); + q = getQ(dim); + ret = visit(ret, p, q); + } + + return post(ret); +}; + +var distances = { + euclidean: function euclidean(length, getP, getQ) { + if (length >= 2) { + return getDistance(length, getP, getQ, 0, addSquaredDiff, sqrt); + } else { + // for single attr case, more efficient to avoid sqrt + return getDistance(length, getP, getQ, 0, addAbsDiff); + } + }, + squaredEuclidean: function squaredEuclidean(length, getP, getQ) { + return getDistance(length, getP, getQ, 0, addSquaredDiff); + }, + manhattan: function manhattan(length, getP, getQ) { + return getDistance(length, getP, getQ, 0, addAbsDiff); + }, + max: function max(length, getP, getQ) { + return getDistance(length, getP, getQ, -Infinity, maxAbsDiff); + } +}; // in case the user accidentally doesn't use camel case + +distances['squared-euclidean'] = distances['squaredEuclidean']; +distances['squaredeuclidean'] = distances['squaredEuclidean']; +function clusteringDistance (method, length, getP, getQ, nodeP, nodeQ) { + var impl; + + if (fn$6(method)) { + impl = method; + } else { + impl = distances[method] || distances.euclidean; + } + + if (length === 0 && fn$6(method)) { + return impl(nodeP, nodeQ); + } else { + return impl(length, getP, getQ, nodeP, nodeQ); + } +} + +var defaults$b = defaults$g({ + k: 2, + m: 2, + sensitivityThreshold: 0.0001, + distance: 'euclidean', + maxIterations: 10, + attributes: [], + testMode: false, + testCentroids: null +}); + +var setOptions$2 = function setOptions(options) { + return defaults$b(options); +}; +/* eslint-enable */ + + +var getDist = function getDist(type, node, centroid, attributes, mode) { + var noNodeP = mode !== 'kMedoids'; + var getP = noNodeP ? function (i) { + return centroid[i]; + } : function (i) { + return attributes[i](centroid); + }; + + var getQ = function getQ(i) { + return attributes[i](node); + }; + + var nodeP = centroid; + var nodeQ = node; + return clusteringDistance(type, attributes.length, getP, getQ, nodeP, nodeQ); +}; + +var randomCentroids = function randomCentroids(nodes, k, attributes) { + var ndim = attributes.length; + var min = new Array(ndim); + var max = new Array(ndim); + var centroids = new Array(k); + var centroid = null; // Find min, max values for each attribute dimension + + for (var i = 0; i < ndim; i++) { + min[i] = nodes.min(attributes[i]).value; + max[i] = nodes.max(attributes[i]).value; + } // Build k centroids, each represented as an n-dim feature vector + + + for (var c = 0; c < k; c++) { + centroid = []; + + for (var _i = 0; _i < ndim; _i++) { + centroid[_i] = Math.random() * (max[_i] - min[_i]) + min[_i]; // random initial value + } + + centroids[c] = centroid; + } + + return centroids; +}; + +var classify = function classify(node, centroids, distance, attributes, type) { + var min = Infinity; + var index = 0; + + for (var i = 0; i < centroids.length; i++) { + var dist = getDist(distance, node, centroids[i], attributes, type); + + if (dist < min) { + min = dist; + index = i; + } + } + + return index; +}; + +var buildCluster = function buildCluster(centroid, nodes, assignment) { + var cluster = []; + var node = null; + + for (var n = 0; n < nodes.length; n++) { + node = nodes[n]; + + if (assignment[node.id()] === centroid) { + //console.log("Node " + node.id() + " is associated with medoid #: " + m); + cluster.push(node); + } + } + + return cluster; +}; + +var haveValuesConverged = function haveValuesConverged(v1, v2, sensitivityThreshold) { + return Math.abs(v2 - v1) <= sensitivityThreshold; +}; + +var haveMatricesConverged = function haveMatricesConverged(v1, v2, sensitivityThreshold) { + for (var i = 0; i < v1.length; i++) { + for (var j = 0; j < v1[i].length; j++) { + var diff = Math.abs(v1[i][j] - v2[i][j]); + + if (diff > sensitivityThreshold) { + return false; + } + } + } + + return true; +}; + +var seenBefore = function seenBefore(node, medoids, n) { + for (var i = 0; i < n; i++) { + if (node === medoids[i]) return true; + } + + return false; +}; + +var randomMedoids = function randomMedoids(nodes, k) { + var medoids = new Array(k); // For small data sets, the probability of medoid conflict is greater, + // so we need to check to see if we've already seen or chose this node before. + + if (nodes.length < 50) { + // Randomly select k medoids from the n nodes + for (var i = 0; i < k; i++) { + var node = nodes[Math.floor(Math.random() * nodes.length)]; // If we've already chosen this node to be a medoid, don't choose it again (for small data sets). + // Instead choose a different random node. + + while (seenBefore(node, medoids, i)) { + node = nodes[Math.floor(Math.random() * nodes.length)]; + } + + medoids[i] = node; + } + } else { + // Relatively large data set, so pretty safe to not check and just select random nodes + for (var _i2 = 0; _i2 < k; _i2++) { + medoids[_i2] = nodes[Math.floor(Math.random() * nodes.length)]; + } + } + + return medoids; +}; + +var findCost = function findCost(potentialNewMedoid, cluster, attributes) { + var cost = 0; + + for (var n = 0; n < cluster.length; n++) { + cost += getDist('manhattan', cluster[n], potentialNewMedoid, attributes, 'kMedoids'); + } + + return cost; +}; + +var kMeans = function kMeans(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var node = null; // Set parameters of algorithm: # of clusters, distance metric, etc. + + var opts = setOptions$2(options); // Begin k-means algorithm + + var clusters = new Array(opts.k); + var assignment = {}; + var centroids; // Step 1: Initialize centroid positions + + if (opts.testMode) { + if (typeof opts.testCentroids === 'number') { + // TODO: implement a seeded random number generator. + opts.testCentroids; + centroids = randomCentroids(nodes, opts.k, opts.attributes); + } else if (_typeof(opts.testCentroids) === 'object') { + centroids = opts.testCentroids; + } else { + centroids = randomCentroids(nodes, opts.k, opts.attributes); + } + } else { + centroids = randomCentroids(nodes, opts.k, opts.attributes); + } + + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + // Step 2: Assign nodes to the nearest centroid + for (var n = 0; n < nodes.length; n++) { + node = nodes[n]; // Determine which cluster this node belongs to: node id => cluster # + + assignment[node.id()] = classify(node, centroids, opts.distance, opts.attributes, 'kMeans'); + } // Step 3: For each of the k clusters, update its centroid + + + isStillMoving = false; + + for (var c = 0; c < opts.k; c++) { + // Get all nodes that belong to this cluster + var cluster = buildCluster(c, nodes, assignment); + + if (cluster.length === 0) { + // If cluster is empty, break out early & move to next cluster + continue; + } // Update centroids by calculating avg of all nodes within the cluster. + + + var ndim = opts.attributes.length; + var centroid = centroids[c]; // [ dim_1, dim_2, dim_3, ... , dim_n ] + + var newCentroid = new Array(ndim); + var sum = new Array(ndim); + + for (var d = 0; d < ndim; d++) { + sum[d] = 0.0; + + for (var i = 0; i < cluster.length; i++) { + node = cluster[i]; + sum[d] += opts.attributes[d](node); + } + + newCentroid[d] = sum[d] / cluster.length; // Check to see if algorithm has converged, i.e. when centroids no longer change + + if (!haveValuesConverged(newCentroid[d], centroid[d], opts.sensitivityThreshold)) { + isStillMoving = true; + } + } + + centroids[c] = newCentroid; + clusters[c] = cy.collection(cluster); + } + + iterations++; + } + + return clusters; +}; + +var kMedoids = function kMedoids(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var node = null; + var opts = setOptions$2(options); // Begin k-medoids algorithm + + var clusters = new Array(opts.k); + var medoids; + var assignment = {}; + var curCost; + var minCosts = new Array(opts.k); // minimum cost configuration for each cluster + // Step 1: Initialize k medoids + + if (opts.testMode) { + if (typeof opts.testCentroids === 'number') ; else if (_typeof(opts.testCentroids) === 'object') { + medoids = opts.testCentroids; + } else { + medoids = randomMedoids(nodes, opts.k); + } + } else { + medoids = randomMedoids(nodes, opts.k); + } + + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + // Step 2: Assign nodes to the nearest medoid + for (var n = 0; n < nodes.length; n++) { + node = nodes[n]; // Determine which cluster this node belongs to: node id => cluster # + + assignment[node.id()] = classify(node, medoids, opts.distance, opts.attributes, 'kMedoids'); + } + + isStillMoving = false; // Step 3: For each medoid m, and for each node assciated with mediod m, + // select the node with the lowest configuration cost as new medoid. + + for (var m = 0; m < medoids.length; m++) { + // Get all nodes that belong to this medoid + var cluster = buildCluster(m, nodes, assignment); + + if (cluster.length === 0) { + // If cluster is empty, break out early & move to next cluster + continue; + } + + minCosts[m] = findCost(medoids[m], cluster, opts.attributes); // original cost + // Select different medoid if its configuration has the lowest cost + + for (var _n = 0; _n < cluster.length; _n++) { + curCost = findCost(cluster[_n], cluster, opts.attributes); + + if (curCost < minCosts[m]) { + minCosts[m] = curCost; + medoids[m] = cluster[_n]; + isStillMoving = true; + } + } + + clusters[m] = cy.collection(cluster); + } + + iterations++; + } + + return clusters; +}; + +var updateCentroids = function updateCentroids(centroids, nodes, U, weight, opts) { + var numerator, denominator; + + for (var n = 0; n < nodes.length; n++) { + for (var c = 0; c < centroids.length; c++) { + weight[n][c] = Math.pow(U[n][c], opts.m); + } + } + + for (var _c = 0; _c < centroids.length; _c++) { + for (var dim = 0; dim < opts.attributes.length; dim++) { + numerator = 0; + denominator = 0; + + for (var _n2 = 0; _n2 < nodes.length; _n2++) { + numerator += weight[_n2][_c] * opts.attributes[dim](nodes[_n2]); + denominator += weight[_n2][_c]; + } + + centroids[_c][dim] = numerator / denominator; + } + } +}; + +var updateMembership = function updateMembership(U, _U, centroids, nodes, opts) { + // Save previous step + for (var i = 0; i < U.length; i++) { + _U[i] = U[i].slice(); + } + + var sum, numerator, denominator; + var pow = 2 / (opts.m - 1); + + for (var c = 0; c < centroids.length; c++) { + for (var n = 0; n < nodes.length; n++) { + sum = 0; + + for (var k = 0; k < centroids.length; k++) { + // against all other centroids + numerator = getDist(opts.distance, nodes[n], centroids[c], opts.attributes, 'cmeans'); + denominator = getDist(opts.distance, nodes[n], centroids[k], opts.attributes, 'cmeans'); + sum += Math.pow(numerator / denominator, pow); + } + + U[n][c] = 1 / sum; + } + } +}; + +var assign$1 = function assign(nodes, U, opts, cy) { + var clusters = new Array(opts.k); + + for (var c = 0; c < clusters.length; c++) { + clusters[c] = []; + } + + var max; + var index; + + for (var n = 0; n < U.length; n++) { + // for each node (U is N x C matrix) + max = -Infinity; + index = -1; // Determine which cluster the node is most likely to belong in + + for (var _c2 = 0; _c2 < U[0].length; _c2++) { + if (U[n][_c2] > max) { + max = U[n][_c2]; + index = _c2; + } + } + + clusters[index].push(nodes[n]); + } // Turn every array into a collection of nodes + + + for (var _c3 = 0; _c3 < clusters.length; _c3++) { + clusters[_c3] = cy.collection(clusters[_c3]); + } + + return clusters; +}; + +var fuzzyCMeans = function fuzzyCMeans(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var opts = setOptions$2(options); // Begin fuzzy c-means algorithm + + var clusters; + var centroids; + var U; + + var _U; + + var weight; // Step 1: Initialize letiables. + + _U = new Array(nodes.length); + + for (var i = 0; i < nodes.length; i++) { + // N x C matrix + _U[i] = new Array(opts.k); + } + + U = new Array(nodes.length); + + for (var _i3 = 0; _i3 < nodes.length; _i3++) { + // N x C matrix + U[_i3] = new Array(opts.k); + } + + for (var _i4 = 0; _i4 < nodes.length; _i4++) { + var total = 0; + + for (var j = 0; j < opts.k; j++) { + U[_i4][j] = Math.random(); + total += U[_i4][j]; + } + + for (var _j = 0; _j < opts.k; _j++) { + U[_i4][_j] = U[_i4][_j] / total; + } + } + + centroids = new Array(opts.k); + + for (var _i5 = 0; _i5 < opts.k; _i5++) { + centroids[_i5] = new Array(opts.attributes.length); + } + + weight = new Array(nodes.length); + + for (var _i6 = 0; _i6 < nodes.length; _i6++) { + // N x C matrix + weight[_i6] = new Array(opts.k); + } // end init FCM + + + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + isStillMoving = false; // Step 2: Calculate the centroids for each step. + + updateCentroids(centroids, nodes, U, weight, opts); // Step 3: Update the partition matrix U. + + updateMembership(U, _U, centroids, nodes, opts); // Step 4: Check for convergence. + + if (!haveMatricesConverged(U, _U, opts.sensitivityThreshold)) { + isStillMoving = true; + } + + iterations++; + } // Assign nodes to clusters with highest probability. + + + clusters = assign$1(nodes, U, opts, cy); + return { + clusters: clusters, + degreeOfMembership: U + }; +}; + +var kClustering = { + kMeans: kMeans, + kMedoids: kMedoids, + fuzzyCMeans: fuzzyCMeans, + fcm: fuzzyCMeans +}; + +// Implemented by Zoe Xi @zoexi for GSOC 2016 +var defaults$a = defaults$g({ + distance: 'euclidean', + // distance metric to compare nodes + linkage: 'min', + // linkage criterion : how to determine the distance between clusters of nodes + mode: 'threshold', + // mode:'threshold' => clusters must be threshold distance apart + threshold: Infinity, + // the distance threshold + // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters + addDendrogram: false, + // whether to add the dendrogram to the graph for viz + dendrogramDepth: 0, + // depth at which dendrogram branches are merged into the returned clusters + attributes: [] // array of attr functions + +}); +var linkageAliases = { + 'single': 'min', + 'complete': 'max' +}; + +var setOptions$1 = function setOptions(options) { + var opts = defaults$a(options); + var preferredAlias = linkageAliases[opts.linkage]; + + if (preferredAlias != null) { + opts.linkage = preferredAlias; + } + + return opts; +}; + +var mergeClosest = function mergeClosest(clusters, index, dists, mins, opts) { + // Find two closest clusters from cached mins + var minKey = 0; + var min = Infinity; + var dist; + var attrs = opts.attributes; + + var getDist = function getDist(n1, n2) { + return clusteringDistance(opts.distance, attrs.length, function (i) { + return attrs[i](n1); + }, function (i) { + return attrs[i](n2); + }, n1, n2); + }; + + for (var i = 0; i < clusters.length; i++) { + var key = clusters[i].key; + var _dist = dists[key][mins[key]]; + + if (_dist < min) { + minKey = key; + min = _dist; + } + } + + if (opts.mode === 'threshold' && min >= opts.threshold || opts.mode === 'dendrogram' && clusters.length === 1) { + return false; + } + + var c1 = index[minKey]; + var c2 = index[mins[minKey]]; + var merged; // Merge two closest clusters + + if (opts.mode === 'dendrogram') { + merged = { + left: c1, + right: c2, + key: c1.key + }; + } else { + merged = { + value: c1.value.concat(c2.value), + key: c1.key + }; + } + + clusters[c1.index] = merged; + clusters.splice(c2.index, 1); + index[c1.key] = merged; // Update distances with new merged cluster + + for (var _i = 0; _i < clusters.length; _i++) { + var cur = clusters[_i]; + + if (c1.key === cur.key) { + dist = Infinity; + } else if (opts.linkage === 'min') { + dist = dists[c1.key][cur.key]; + + if (dists[c1.key][cur.key] > dists[c2.key][cur.key]) { + dist = dists[c2.key][cur.key]; + } + } else if (opts.linkage === 'max') { + dist = dists[c1.key][cur.key]; + + if (dists[c1.key][cur.key] < dists[c2.key][cur.key]) { + dist = dists[c2.key][cur.key]; + } + } else if (opts.linkage === 'mean') { + dist = (dists[c1.key][cur.key] * c1.size + dists[c2.key][cur.key] * c2.size) / (c1.size + c2.size); + } else { + if (opts.mode === 'dendrogram') dist = getDist(cur.value, c1.value);else dist = getDist(cur.value[0], c1.value[0]); + } + + dists[c1.key][cur.key] = dists[cur.key][c1.key] = dist; // distance matrix is symmetric + } // Update cached mins + + + for (var _i2 = 0; _i2 < clusters.length; _i2++) { + var key1 = clusters[_i2].key; + + if (mins[key1] === c1.key || mins[key1] === c2.key) { + var _min = key1; + + for (var j = 0; j < clusters.length; j++) { + var key2 = clusters[j].key; + + if (dists[key1][key2] < dists[key1][_min]) { + _min = key2; + } + } + + mins[key1] = _min; + } + + clusters[_i2].index = _i2; + } // Clean up meta data used for clustering + + + c1.key = c2.key = c1.index = c2.index = null; + return true; +}; + +var getAllChildren = function getAllChildren(root, arr, cy) { + if (!root) return; + + if (root.value) { + arr.push(root.value); + } else { + if (root.left) getAllChildren(root.left, arr); + if (root.right) getAllChildren(root.right, arr); + } +}; + +var buildDendrogram = function buildDendrogram(root, cy) { + if (!root) return ''; + + if (root.left && root.right) { + var leftStr = buildDendrogram(root.left, cy); + var rightStr = buildDendrogram(root.right, cy); + var node = cy.add({ + group: 'nodes', + data: { + id: leftStr + ',' + rightStr + } + }); + cy.add({ + group: 'edges', + data: { + source: leftStr, + target: node.id() + } + }); + cy.add({ + group: 'edges', + data: { + source: rightStr, + target: node.id() + } + }); + return node.id(); + } else if (root.value) { + return root.value.id(); + } +}; + +var buildClustersFromTree = function buildClustersFromTree(root, k, cy) { + if (!root) return []; + var left = [], + right = [], + leaves = []; + + if (k === 0) { + // don't cut tree, simply return all nodes as 1 single cluster + if (root.left) getAllChildren(root.left, left); + if (root.right) getAllChildren(root.right, right); + leaves = left.concat(right); + return [cy.collection(leaves)]; + } else if (k === 1) { + // cut at root + if (root.value) { + // leaf node + return [cy.collection(root.value)]; + } else { + if (root.left) getAllChildren(root.left, left); + if (root.right) getAllChildren(root.right, right); + return [cy.collection(left), cy.collection(right)]; + } + } else { + if (root.value) { + return [cy.collection(root.value)]; + } else { + if (root.left) left = buildClustersFromTree(root.left, k - 1, cy); + if (root.right) right = buildClustersFromTree(root.right, k - 1, cy); + return left.concat(right); + } + } +}; +/* eslint-enable */ + + +var hierarchicalClustering = function hierarchicalClustering(options) { + var cy = this.cy(); + var nodes = this.nodes(); // Set parameters of algorithm: linkage type, distance metric, etc. + + var opts = setOptions$1(options); + var attrs = opts.attributes; + + var getDist = function getDist(n1, n2) { + return clusteringDistance(opts.distance, attrs.length, function (i) { + return attrs[i](n1); + }, function (i) { + return attrs[i](n2); + }, n1, n2); + }; // Begin hierarchical algorithm + + + var clusters = []; + var dists = []; // distances between each pair of clusters + + var mins = []; // closest cluster for each cluster + + var index = []; // hash of all clusters by key + // In agglomerative (bottom-up) clustering, each node starts as its own cluster + + for (var n = 0; n < nodes.length; n++) { + var cluster = { + value: opts.mode === 'dendrogram' ? nodes[n] : [nodes[n]], + key: n, + index: n + }; + clusters[n] = cluster; + index[n] = cluster; + dists[n] = []; + mins[n] = 0; + } // Calculate the distance between each pair of clusters + + + for (var i = 0; i < clusters.length; i++) { + for (var j = 0; j <= i; j++) { + var dist = void 0; + + if (opts.mode === 'dendrogram') { + // modes store cluster values differently + dist = i === j ? Infinity : getDist(clusters[i].value, clusters[j].value); + } else { + dist = i === j ? Infinity : getDist(clusters[i].value[0], clusters[j].value[0]); + } + + dists[i][j] = dist; + dists[j][i] = dist; + + if (dist < dists[i][mins[i]]) { + mins[i] = j; // Cache mins: closest cluster to cluster i is cluster j + } + } + } // Find the closest pair of clusters and merge them into a single cluster. + // Update distances between new cluster and each of the old clusters, and loop until threshold reached. + + + var merged = mergeClosest(clusters, index, dists, mins, opts); + + while (merged) { + merged = mergeClosest(clusters, index, dists, mins, opts); + } + + var retClusters; // Dendrogram mode builds the hierarchy and adds intermediary nodes + edges + // in addition to returning the clusters. + + if (opts.mode === 'dendrogram') { + retClusters = buildClustersFromTree(clusters[0], opts.dendrogramDepth, cy); + if (opts.addDendrogram) buildDendrogram(clusters[0], cy); + } else { + // Regular mode simply returns the clusters + retClusters = new Array(clusters.length); + clusters.forEach(function (cluster, i) { + // Clean up meta data used for clustering + cluster.key = cluster.index = null; + retClusters[i] = cy.collection(cluster.value); + }); + } + + return retClusters; +}; + +var hierarchicalClustering$1 = { + hierarchicalClustering: hierarchicalClustering, + hca: hierarchicalClustering +}; + +// Implemented by Zoe Xi @zoexi for GSOC 2016 +var defaults$9 = defaults$g({ + distance: 'euclidean', + // distance metric to compare attributes between two nodes + preference: 'median', + // suitability of a data point to serve as an exemplar + damping: 0.8, + // damping factor between [0.5, 1) + maxIterations: 1000, + // max number of iterations to run + minIterations: 100, + // min number of iterations to run in order for clustering to stop + attributes: [// functions to quantify the similarity between any two points + // e.g. node => node.data('weight') + ] +}); + +var setOptions = function setOptions(options) { + var dmp = options.damping; + var pref = options.preference; + + if (!(0.5 <= dmp && dmp < 1)) { + error("Damping must range on [0.5, 1). Got: ".concat(dmp)); + } + + var validPrefs = ['median', 'mean', 'min', 'max']; + + if (!(validPrefs.some(function (v) { + return v === pref; + }) || number$1(pref))) { + error("Preference must be one of [".concat(validPrefs.map(function (p) { + return "'".concat(p, "'"); + }).join(', '), "] or a number. Got: ").concat(pref)); + } + + return defaults$9(options); +}; +/* eslint-enable */ + + +var getSimilarity = function getSimilarity(type, n1, n2, attributes) { + var attr = function attr(n, i) { + return attributes[i](n); + }; // nb negative because similarity should have an inverse relationship to distance + + + return -clusteringDistance(type, attributes.length, function (i) { + return attr(n1, i); + }, function (i) { + return attr(n2, i); + }, n1, n2); +}; + +var getPreference = function getPreference(S, preference) { + // larger preference = greater # of clusters + var p = null; + + if (preference === 'median') { + p = median(S); + } else if (preference === 'mean') { + p = mean(S); + } else if (preference === 'min') { + p = min(S); + } else if (preference === 'max') { + p = max(S); + } else { + // Custom preference number, as set by user + p = preference; + } + + return p; +}; + +var findExemplars = function findExemplars(n, R, A) { + var indices = []; + + for (var i = 0; i < n; i++) { + if (R[i * n + i] + A[i * n + i] > 0) { + indices.push(i); + } + } + + return indices; +}; + +var assignClusters = function assignClusters(n, S, exemplars) { + var clusters = []; + + for (var i = 0; i < n; i++) { + var index = -1; + var max = -Infinity; + + for (var ei = 0; ei < exemplars.length; ei++) { + var e = exemplars[ei]; + + if (S[i * n + e] > max) { + index = e; + max = S[i * n + e]; + } + } + + if (index > 0) { + clusters.push(index); + } + } + + for (var _ei = 0; _ei < exemplars.length; _ei++) { + clusters[exemplars[_ei]] = exemplars[_ei]; + } + + return clusters; +}; + +var assign = function assign(n, S, exemplars) { + var clusters = assignClusters(n, S, exemplars); + + for (var ei = 0; ei < exemplars.length; ei++) { + var ii = []; + + for (var c = 0; c < clusters.length; c++) { + if (clusters[c] === exemplars[ei]) { + ii.push(c); + } + } + + var maxI = -1; + var maxSum = -Infinity; + + for (var i = 0; i < ii.length; i++) { + var sum = 0; + + for (var j = 0; j < ii.length; j++) { + sum += S[ii[j] * n + ii[i]]; + } + + if (sum > maxSum) { + maxI = i; + maxSum = sum; + } + } + + exemplars[ei] = ii[maxI]; + } + + clusters = assignClusters(n, S, exemplars); + return clusters; +}; + +var affinityPropagation = function affinityPropagation(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var opts = setOptions(options); // Map each node to its position in node array + + var id2position = {}; + + for (var i = 0; i < nodes.length; i++) { + id2position[nodes[i].id()] = i; + } // Begin affinity propagation algorithm + + + var n; // number of data points + + var n2; // size of matrices + + var S; // similarity matrix (1D array) + + var p; // preference/suitability of a data point to serve as an exemplar + + var R; // responsibility matrix (1D array) + + var A; // availability matrix (1D array) + + n = nodes.length; + n2 = n * n; // Initialize and build S similarity matrix + + S = new Array(n2); + + for (var _i = 0; _i < n2; _i++) { + S[_i] = -Infinity; // for cases where two data points shouldn't be linked together + } + + for (var _i2 = 0; _i2 < n; _i2++) { + for (var j = 0; j < n; j++) { + if (_i2 !== j) { + S[_i2 * n + j] = getSimilarity(opts.distance, nodes[_i2], nodes[j], opts.attributes); + } + } + } // Place preferences on the diagonal of S + + + p = getPreference(S, opts.preference); + + for (var _i3 = 0; _i3 < n; _i3++) { + S[_i3 * n + _i3] = p; + } // Initialize R responsibility matrix + + + R = new Array(n2); + + for (var _i4 = 0; _i4 < n2; _i4++) { + R[_i4] = 0.0; + } // Initialize A availability matrix + + + A = new Array(n2); + + for (var _i5 = 0; _i5 < n2; _i5++) { + A[_i5] = 0.0; + } + + var old = new Array(n); + var Rp = new Array(n); + var se = new Array(n); + + for (var _i6 = 0; _i6 < n; _i6++) { + old[_i6] = 0.0; + Rp[_i6] = 0.0; + se[_i6] = 0; + } + + var e = new Array(n * opts.minIterations); + + for (var _i7 = 0; _i7 < e.length; _i7++) { + e[_i7] = 0; + } + + var iter; + + for (iter = 0; iter < opts.maxIterations; iter++) { + // main algorithmic loop + // Update R responsibility matrix + for (var _i8 = 0; _i8 < n; _i8++) { + var max = -Infinity, + max2 = -Infinity, + maxI = -1, + AS = 0.0; + + for (var _j = 0; _j < n; _j++) { + old[_j] = R[_i8 * n + _j]; + AS = A[_i8 * n + _j] + S[_i8 * n + _j]; + + if (AS >= max) { + max2 = max; + max = AS; + maxI = _j; + } else if (AS > max2) { + max2 = AS; + } + } + + for (var _j2 = 0; _j2 < n; _j2++) { + R[_i8 * n + _j2] = (1 - opts.damping) * (S[_i8 * n + _j2] - max) + opts.damping * old[_j2]; + } + + R[_i8 * n + maxI] = (1 - opts.damping) * (S[_i8 * n + maxI] - max2) + opts.damping * old[maxI]; + } // Update A availability matrix + + + for (var _i9 = 0; _i9 < n; _i9++) { + var sum = 0; + + for (var _j3 = 0; _j3 < n; _j3++) { + old[_j3] = A[_j3 * n + _i9]; + Rp[_j3] = Math.max(0, R[_j3 * n + _i9]); + sum += Rp[_j3]; + } + + sum -= Rp[_i9]; + Rp[_i9] = R[_i9 * n + _i9]; + sum += Rp[_i9]; + + for (var _j4 = 0; _j4 < n; _j4++) { + A[_j4 * n + _i9] = (1 - opts.damping) * Math.min(0, sum - Rp[_j4]) + opts.damping * old[_j4]; + } + + A[_i9 * n + _i9] = (1 - opts.damping) * (sum - Rp[_i9]) + opts.damping * old[_i9]; + } // Check for convergence + + + var K = 0; + + for (var _i10 = 0; _i10 < n; _i10++) { + var E = A[_i10 * n + _i10] + R[_i10 * n + _i10] > 0 ? 1 : 0; + e[iter % opts.minIterations * n + _i10] = E; + K += E; + } + + if (K > 0 && (iter >= opts.minIterations - 1 || iter == opts.maxIterations - 1)) { + var _sum = 0; + + for (var _i11 = 0; _i11 < n; _i11++) { + se[_i11] = 0; + + for (var _j5 = 0; _j5 < opts.minIterations; _j5++) { + se[_i11] += e[_j5 * n + _i11]; + } + + if (se[_i11] === 0 || se[_i11] === opts.minIterations) { + _sum++; + } + } + + if (_sum === n) { + // then we have convergence + break; + } + } + } // Identify exemplars (cluster centers) + + + var exemplarsIndices = findExemplars(n, R, A); // Assign nodes to clusters + + var clusterIndices = assign(n, S, exemplarsIndices); + var clusters = {}; + + for (var c = 0; c < exemplarsIndices.length; c++) { + clusters[exemplarsIndices[c]] = []; + } + + for (var _i12 = 0; _i12 < nodes.length; _i12++) { + var pos = id2position[nodes[_i12].id()]; + + var clusterIndex = clusterIndices[pos]; + + if (clusterIndex != null) { + // the node may have not been assigned a cluster if no valid attributes were specified + clusters[clusterIndex].push(nodes[_i12]); + } + } + + var retClusters = new Array(exemplarsIndices.length); + + for (var _c = 0; _c < exemplarsIndices.length; _c++) { + retClusters[_c] = cy.collection(clusters[exemplarsIndices[_c]]); + } + + return retClusters; +}; + +var affinityPropagation$1 = { + affinityPropagation: affinityPropagation, + ap: affinityPropagation +}; + +var hierholzerDefaults = defaults$g({ + root: undefined, + directed: false +}); +var elesfn$k = { + hierholzer: function hierholzer(options) { + if (!plainObject(options)) { + var args = arguments; + options = { + root: args[0], + directed: args[1] + }; + } + + var _hierholzerDefaults = hierholzerDefaults(options), + root = _hierholzerDefaults.root, + directed = _hierholzerDefaults.directed; + + var eles = this; + var dflag = false; + var oddIn; + var oddOut; + var startVertex; + if (root) startVertex = string(root) ? this.filter(root)[0].id() : root[0].id(); + var nodes = {}; + var edges = {}; + + if (directed) { + eles.forEach(function (ele) { + var id = ele.id(); + + if (ele.isNode()) { + var ind = ele.indegree(true); + var outd = ele.outdegree(true); + var d1 = ind - outd; + var d2 = outd - ind; + + if (d1 == 1) { + if (oddIn) dflag = true;else oddIn = id; + } else if (d2 == 1) { + if (oddOut) dflag = true;else oddOut = id; + } else if (d2 > 1 || d1 > 1) { + dflag = true; + } + + nodes[id] = []; + ele.outgoers().forEach(function (e) { + if (e.isEdge()) nodes[id].push(e.id()); + }); + } else { + edges[id] = [undefined, ele.target().id()]; + } + }); + } else { + eles.forEach(function (ele) { + var id = ele.id(); + + if (ele.isNode()) { + var d = ele.degree(true); + + if (d % 2) { + if (!oddIn) oddIn = id;else if (!oddOut) oddOut = id;else dflag = true; + } + + nodes[id] = []; + ele.connectedEdges().forEach(function (e) { + return nodes[id].push(e.id()); + }); + } else { + edges[id] = [ele.source().id(), ele.target().id()]; + } + }); + } + + var result = { + found: false, + trail: undefined + }; + if (dflag) return result;else if (oddOut && oddIn) { + if (directed) { + if (startVertex && oddOut != startVertex) { + return result; + } + + startVertex = oddOut; + } else { + if (startVertex && oddOut != startVertex && oddIn != startVertex) { + return result; + } else if (!startVertex) { + startVertex = oddOut; + } + } + } else { + if (!startVertex) startVertex = eles[0].id(); + } + + var walk = function walk(v) { + var currentNode = v; + var subtour = [v]; + var adj, adjTail, adjHead; + + while (nodes[currentNode].length) { + adj = nodes[currentNode].shift(); + adjTail = edges[adj][0]; + adjHead = edges[adj][1]; + + if (currentNode != adjHead) { + nodes[adjHead] = nodes[adjHead].filter(function (e) { + return e != adj; + }); + currentNode = adjHead; + } else if (!directed && currentNode != adjTail) { + nodes[adjTail] = nodes[adjTail].filter(function (e) { + return e != adj; + }); + currentNode = adjTail; + } + + subtour.unshift(adj); + subtour.unshift(currentNode); + } + + return subtour; + }; + + var trail = []; + var subtour = []; + subtour = walk(startVertex); + + while (subtour.length != 1) { + if (nodes[subtour[0]].length == 0) { + trail.unshift(eles.getElementById(subtour.shift())); + trail.unshift(eles.getElementById(subtour.shift())); + } else { + subtour = walk(subtour.shift()).concat(subtour); + } + } + + trail.unshift(eles.getElementById(subtour.shift())); // final node + + for (var d in nodes) { + if (nodes[d].length) { + return result; + } + } + + result.found = true; + result.trail = this.spawn(trail, true); + return result; + } +}; + +var hopcroftTarjanBiconnected = function hopcroftTarjanBiconnected() { + var eles = this; + var nodes = {}; + var id = 0; + var edgeCount = 0; + var components = []; + var stack = []; + var visitedEdges = {}; + + var buildComponent = function buildComponent(x, y) { + var i = stack.length - 1; + var cutset = []; + var component = eles.spawn(); + + while (stack[i].x != x || stack[i].y != y) { + cutset.push(stack.pop().edge); + i--; + } + + cutset.push(stack.pop().edge); + cutset.forEach(function (edge) { + var connectedNodes = edge.connectedNodes().intersection(eles); + component.merge(edge); + connectedNodes.forEach(function (node) { + var nodeId = node.id(); + var connectedEdges = node.connectedEdges().intersection(eles); + component.merge(node); + + if (!nodes[nodeId].cutVertex) { + component.merge(connectedEdges); + } else { + component.merge(connectedEdges.filter(function (edge) { + return edge.isLoop(); + })); + } + }); + }); + components.push(component); + }; + + var biconnectedSearch = function biconnectedSearch(root, currentNode, parent) { + if (root === parent) edgeCount += 1; + nodes[currentNode] = { + id: id, + low: id++, + cutVertex: false + }; + var edges = eles.getElementById(currentNode).connectedEdges().intersection(eles); + + if (edges.size() === 0) { + components.push(eles.spawn(eles.getElementById(currentNode))); + } else { + var sourceId, targetId, otherNodeId, edgeId; + edges.forEach(function (edge) { + sourceId = edge.source().id(); + targetId = edge.target().id(); + otherNodeId = sourceId === currentNode ? targetId : sourceId; + + if (otherNodeId !== parent) { + edgeId = edge.id(); + + if (!visitedEdges[edgeId]) { + visitedEdges[edgeId] = true; + stack.push({ + x: currentNode, + y: otherNodeId, + edge: edge + }); + } + + if (!(otherNodeId in nodes)) { + biconnectedSearch(root, otherNodeId, currentNode); + nodes[currentNode].low = Math.min(nodes[currentNode].low, nodes[otherNodeId].low); + + if (nodes[currentNode].id <= nodes[otherNodeId].low) { + nodes[currentNode].cutVertex = true; + buildComponent(currentNode, otherNodeId); + } + } else { + nodes[currentNode].low = Math.min(nodes[currentNode].low, nodes[otherNodeId].id); + } + } + }); + } + }; + + eles.forEach(function (ele) { + if (ele.isNode()) { + var nodeId = ele.id(); + + if (!(nodeId in nodes)) { + edgeCount = 0; + biconnectedSearch(nodeId, nodeId); + nodes[nodeId].cutVertex = edgeCount > 1; + } + } + }); + var cutVertices = Object.keys(nodes).filter(function (id) { + return nodes[id].cutVertex; + }).map(function (id) { + return eles.getElementById(id); + }); + return { + cut: eles.spawn(cutVertices), + components: components + }; +}; + +var hopcroftTarjanBiconnected$1 = { + hopcroftTarjanBiconnected: hopcroftTarjanBiconnected, + htbc: hopcroftTarjanBiconnected, + htb: hopcroftTarjanBiconnected, + hopcroftTarjanBiconnectedComponents: hopcroftTarjanBiconnected +}; + +var tarjanStronglyConnected = function tarjanStronglyConnected() { + var eles = this; + var nodes = {}; + var index = 0; + var components = []; + var stack = []; + var cut = eles.spawn(eles); + + var stronglyConnectedSearch = function stronglyConnectedSearch(sourceNodeId) { + stack.push(sourceNodeId); + nodes[sourceNodeId] = { + index: index, + low: index++, + explored: false + }; + var connectedEdges = eles.getElementById(sourceNodeId).connectedEdges().intersection(eles); + connectedEdges.forEach(function (edge) { + var targetNodeId = edge.target().id(); + + if (targetNodeId !== sourceNodeId) { + if (!(targetNodeId in nodes)) { + stronglyConnectedSearch(targetNodeId); + } + + if (!nodes[targetNodeId].explored) { + nodes[sourceNodeId].low = Math.min(nodes[sourceNodeId].low, nodes[targetNodeId].low); + } + } + }); + + if (nodes[sourceNodeId].index === nodes[sourceNodeId].low) { + var componentNodes = eles.spawn(); + + for (;;) { + var nodeId = stack.pop(); + componentNodes.merge(eles.getElementById(nodeId)); + nodes[nodeId].low = nodes[sourceNodeId].index; + nodes[nodeId].explored = true; + + if (nodeId === sourceNodeId) { + break; + } + } + + var componentEdges = componentNodes.edgesWith(componentNodes); + var component = componentNodes.merge(componentEdges); + components.push(component); + cut = cut.difference(component); + } + }; + + eles.forEach(function (ele) { + if (ele.isNode()) { + var nodeId = ele.id(); + + if (!(nodeId in nodes)) { + stronglyConnectedSearch(nodeId); + } + } + }); + return { + cut: cut, + components: components + }; +}; + +var tarjanStronglyConnected$1 = { + tarjanStronglyConnected: tarjanStronglyConnected, + tsc: tarjanStronglyConnected, + tscc: tarjanStronglyConnected, + tarjanStronglyConnectedComponents: tarjanStronglyConnected +}; + +var elesfn$j = {}; +[elesfn$v, elesfn$u, elesfn$t, elesfn$s, elesfn$r, elesfn$q, elesfn$p, elesfn$o, elesfn$n, elesfn$m, elesfn$l, markovClustering$1, kClustering, hierarchicalClustering$1, affinityPropagation$1, elesfn$k, hopcroftTarjanBiconnected$1, tarjanStronglyConnected$1].forEach(function (props) { + extend(elesfn$j, props); +}); + +/*! +Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable +Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) +Licensed under The MIT License (http://opensource.org/licenses/MIT) +*/ + +/* promise states [Promises/A+ 2.1] */ +var STATE_PENDING = 0; +/* [Promises/A+ 2.1.1] */ + +var STATE_FULFILLED = 1; +/* [Promises/A+ 2.1.2] */ + +var STATE_REJECTED = 2; +/* [Promises/A+ 2.1.3] */ + +/* promise object constructor */ + +var api = function api(executor) { + /* optionally support non-constructor/plain-function call */ + if (!(this instanceof api)) return new api(executor); + /* initialize object */ + + this.id = 'Thenable/1.0.7'; + this.state = STATE_PENDING; + /* initial state */ + + this.fulfillValue = undefined; + /* initial value */ + + /* [Promises/A+ 1.3, 2.1.2.2] */ + + this.rejectReason = undefined; + /* initial reason */ + + /* [Promises/A+ 1.5, 2.1.3.2] */ + + this.onFulfilled = []; + /* initial handlers */ + + this.onRejected = []; + /* initial handlers */ + + /* provide optional information-hiding proxy */ + + this.proxy = { + then: this.then.bind(this) + }; + /* support optional executor function */ + + if (typeof executor === 'function') executor.call(this, this.fulfill.bind(this), this.reject.bind(this)); +}; +/* promise API methods */ + + +api.prototype = { + /* promise resolving methods */ + fulfill: function fulfill(value) { + return deliver(this, STATE_FULFILLED, 'fulfillValue', value); + }, + reject: function reject(value) { + return deliver(this, STATE_REJECTED, 'rejectReason', value); + }, + + /* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */ + then: function then(onFulfilled, onRejected) { + var curr = this; + var next = new api(); + /* [Promises/A+ 2.2.7] */ + + curr.onFulfilled.push(resolver(onFulfilled, next, 'fulfill')); + /* [Promises/A+ 2.2.2/2.2.6] */ + + curr.onRejected.push(resolver(onRejected, next, 'reject')); + /* [Promises/A+ 2.2.3/2.2.6] */ + + execute(curr); + return next.proxy; + /* [Promises/A+ 2.2.7, 3.3] */ + } +}; +/* deliver an action */ + +var deliver = function deliver(curr, state, name, value) { + if (curr.state === STATE_PENDING) { + curr.state = state; + /* [Promises/A+ 2.1.2.1, 2.1.3.1] */ + + curr[name] = value; + /* [Promises/A+ 2.1.2.2, 2.1.3.2] */ + + execute(curr); + } + + return curr; +}; +/* execute all handlers */ + + +var execute = function execute(curr) { + if (curr.state === STATE_FULFILLED) execute_handlers(curr, 'onFulfilled', curr.fulfillValue);else if (curr.state === STATE_REJECTED) execute_handlers(curr, 'onRejected', curr.rejectReason); +}; +/* execute particular set of handlers */ + + +var execute_handlers = function execute_handlers(curr, name, value) { + /* global setImmediate: true */ + + /* global setTimeout: true */ + + /* short-circuit processing */ + if (curr[name].length === 0) return; + /* iterate over all handlers, exactly once */ + + var handlers = curr[name]; + curr[name] = []; + /* [Promises/A+ 2.2.2.3, 2.2.3.3] */ + + var func = function func() { + for (var i = 0; i < handlers.length; i++) { + handlers[i](value); + } + /* [Promises/A+ 2.2.5] */ + + }; + /* execute procedure asynchronously */ + + /* [Promises/A+ 2.2.4, 3.1] */ + + + if (typeof setImmediate === 'function') setImmediate(func);else setTimeout(func, 0); +}; +/* generate a resolver function */ + + +var resolver = function resolver(cb, next, method) { + return function (value) { + if (typeof cb !== 'function') + /* [Promises/A+ 2.2.1, 2.2.7.3, 2.2.7.4] */ + next[method].call(next, value); + /* [Promises/A+ 2.2.7.3, 2.2.7.4] */ + else { + var result; + + try { + result = cb(value); + } + /* [Promises/A+ 2.2.2.1, 2.2.3.1, 2.2.5, 3.2] */ + catch (e) { + next.reject(e); + /* [Promises/A+ 2.2.7.2] */ + + return; + } + + resolve(next, result); + /* [Promises/A+ 2.2.7.1] */ + } + }; +}; +/* "Promise Resolution Procedure" */ + +/* [Promises/A+ 2.3] */ + + +var resolve = function resolve(promise, x) { + /* sanity check arguments */ + + /* [Promises/A+ 2.3.1] */ + if (promise === x || promise.proxy === x) { + promise.reject(new TypeError('cannot resolve promise with itself')); + return; + } + /* surgically check for a "then" method + (mainly to just call the "getter" of "then" only once) */ + + + var then; + + if (_typeof(x) === 'object' && x !== null || typeof x === 'function') { + try { + then = x.then; + } + /* [Promises/A+ 2.3.3.1, 3.5] */ + catch (e) { + promise.reject(e); + /* [Promises/A+ 2.3.3.2] */ + + return; + } + } + /* handle own Thenables [Promises/A+ 2.3.2] + and similar "thenables" [Promises/A+ 2.3.3] */ + + + if (typeof then === 'function') { + var resolved = false; + + try { + /* call retrieved "then" method */ + + /* [Promises/A+ 2.3.3.3] */ + then.call(x, + /* resolvePromise */ + + /* [Promises/A+ 2.3.3.3.1] */ + function (y) { + if (resolved) return; + resolved = true; + /* [Promises/A+ 2.3.3.3.3] */ + + if (y === x) + /* [Promises/A+ 3.6] */ + promise.reject(new TypeError('circular thenable chain'));else resolve(promise, y); + }, + /* rejectPromise */ + + /* [Promises/A+ 2.3.3.3.2] */ + function (r) { + if (resolved) return; + resolved = true; + /* [Promises/A+ 2.3.3.3.3] */ + + promise.reject(r); + }); + } catch (e) { + if (!resolved) + /* [Promises/A+ 2.3.3.3.3] */ + promise.reject(e); + /* [Promises/A+ 2.3.3.3.4] */ + } + + return; + } + /* handle other values */ + + + promise.fulfill(x); + /* [Promises/A+ 2.3.4, 2.3.3.4] */ +}; // so we always have Promise.all() + + +api.all = function (ps) { + return new api(function (resolveAll, rejectAll) { + var vals = new Array(ps.length); + var doneCount = 0; + + var fulfill = function fulfill(i, val) { + vals[i] = val; + doneCount++; + + if (doneCount === ps.length) { + resolveAll(vals); + } + }; + + for (var i = 0; i < ps.length; i++) { + (function (i) { + var p = ps[i]; + var isPromise = p != null && p.then != null; + + if (isPromise) { + p.then(function (val) { + fulfill(i, val); + }, function (err) { + rejectAll(err); + }); + } else { + var val = p; + fulfill(i, val); + } + })(i); + } + }); +}; + +api.resolve = function (val) { + return new api(function (resolve, reject) { + resolve(val); + }); +}; + +api.reject = function (val) { + return new api(function (resolve, reject) { + reject(val); + }); +}; + +var Promise$1 = typeof Promise !== 'undefined' ? Promise : api; // eslint-disable-line no-undef + +var Animation = function Animation(target, opts, opts2) { + var isCore = core(target); + var isEle = !isCore; + + var _p = this._private = extend({ + duration: 1000 + }, opts, opts2); + + _p.target = target; + _p.style = _p.style || _p.css; + _p.started = false; + _p.playing = false; + _p.hooked = false; + _p.applying = false; + _p.progress = 0; + _p.completes = []; + _p.frames = []; + + if (_p.complete && fn$6(_p.complete)) { + _p.completes.push(_p.complete); + } + + if (isEle) { + var pos = target.position(); + _p.startPosition = _p.startPosition || { + x: pos.x, + y: pos.y + }; + _p.startStyle = _p.startStyle || target.cy().style().getAnimationStartStyle(target, _p.style); + } + + if (isCore) { + var pan = target.pan(); + _p.startPan = { + x: pan.x, + y: pan.y + }; + _p.startZoom = target.zoom(); + } // for future timeline/animations impl + + + this.length = 1; + this[0] = this; +}; + +var anifn = Animation.prototype; +extend(anifn, { + instanceString: function instanceString() { + return 'animation'; + }, + hook: function hook() { + var _p = this._private; + + if (!_p.hooked) { + // add to target's animation queue + var q; + var tAni = _p.target._private.animation; + + if (_p.queue) { + q = tAni.queue; + } else { + q = tAni.current; + } + + q.push(this); // add to the animation loop pool + + if (elementOrCollection(_p.target)) { + _p.target.cy().addToAnimationPool(_p.target); + } + + _p.hooked = true; + } + + return this; + }, + play: function play() { + var _p = this._private; // autorewind + + if (_p.progress === 1) { + _p.progress = 0; + } + + _p.playing = true; + _p.started = false; // needs to be started by animation loop + + _p.stopped = false; + this.hook(); // the animation loop will start the animation... + + return this; + }, + playing: function playing() { + return this._private.playing; + }, + apply: function apply() { + var _p = this._private; + _p.applying = true; + _p.started = false; // needs to be started by animation loop + + _p.stopped = false; + this.hook(); // the animation loop will apply the animation at this progress + + return this; + }, + applying: function applying() { + return this._private.applying; + }, + pause: function pause() { + var _p = this._private; + _p.playing = false; + _p.started = false; + return this; + }, + stop: function stop() { + var _p = this._private; + _p.playing = false; + _p.started = false; + _p.stopped = true; // to be removed from animation queues + + return this; + }, + rewind: function rewind() { + return this.progress(0); + }, + fastforward: function fastforward() { + return this.progress(1); + }, + time: function time(t) { + var _p = this._private; + + if (t === undefined) { + return _p.progress * _p.duration; + } else { + return this.progress(t / _p.duration); + } + }, + progress: function progress(p) { + var _p = this._private; + var wasPlaying = _p.playing; + + if (p === undefined) { + return _p.progress; + } else { + if (wasPlaying) { + this.pause(); + } + + _p.progress = p; + _p.started = false; + + if (wasPlaying) { + this.play(); + } + } + + return this; + }, + completed: function completed() { + return this._private.progress === 1; + }, + reverse: function reverse() { + var _p = this._private; + var wasPlaying = _p.playing; + + if (wasPlaying) { + this.pause(); + } + + _p.progress = 1 - _p.progress; + _p.started = false; + + var swap = function swap(a, b) { + var _pa = _p[a]; + + if (_pa == null) { + return; + } + + _p[a] = _p[b]; + _p[b] = _pa; + }; + + swap('zoom', 'startZoom'); + swap('pan', 'startPan'); + swap('position', 'startPosition'); // swap styles + + if (_p.style) { + for (var i = 0; i < _p.style.length; i++) { + var prop = _p.style[i]; + var name = prop.name; + var startStyleProp = _p.startStyle[name]; + _p.startStyle[name] = prop; + _p.style[i] = startStyleProp; + } + } + + if (wasPlaying) { + this.play(); + } + + return this; + }, + promise: function promise(type) { + var _p = this._private; + var arr; + + switch (type) { + case 'frame': + arr = _p.frames; + break; + + default: + case 'complete': + case 'completed': + arr = _p.completes; + } + + return new Promise$1(function (resolve, reject) { + arr.push(function () { + resolve(); + }); + }); + } +}); +anifn.complete = anifn.completed; +anifn.run = anifn.play; +anifn.running = anifn.playing; + +var define$3 = { + animated: function animated() { + return function animatedImpl() { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return false; + } + + var ele = all[0]; + + if (ele) { + return ele._private.animation.current.length > 0; + } + }; + }, + // animated + clearQueue: function clearQueue() { + return function clearQueueImpl() { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + for (var i = 0; i < all.length; i++) { + var ele = all[i]; + ele._private.animation.queue = []; + } + + return this; + }; + }, + // clearQueue + delay: function delay() { + return function delayImpl(time, complete) { + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + return this.animate({ + delay: time, + duration: time, + complete: complete + }); + }; + }, + // delay + delayAnimation: function delayAnimation() { + return function delayAnimationImpl(time, complete) { + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + return this.animation({ + delay: time, + duration: time, + complete: complete + }); + }; + }, + // delay + animation: function animation() { + return function animationImpl(properties, params) { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + var isCore = !selfIsArrayLike; + var isEles = !isCore; + + if (!cy.styleEnabled()) { + return this; + } + + var style = cy.style(); + properties = extend({}, properties, params); + var propertiesEmpty = Object.keys(properties).length === 0; + + if (propertiesEmpty) { + return new Animation(all[0], properties); // nothing to animate + } + + if (properties.duration === undefined) { + properties.duration = 400; + } + + switch (properties.duration) { + case 'slow': + properties.duration = 600; + break; + + case 'fast': + properties.duration = 200; + break; + } + + if (isEles) { + properties.style = style.getPropsList(properties.style || properties.css); + properties.css = undefined; + } + + if (isEles && properties.renderedPosition != null) { + var rpos = properties.renderedPosition; + var pan = cy.pan(); + var zoom = cy.zoom(); + properties.position = renderedToModelPosition(rpos, zoom, pan); + } // override pan w/ panBy if set + + + if (isCore && properties.panBy != null) { + var panBy = properties.panBy; + var cyPan = cy.pan(); + properties.pan = { + x: cyPan.x + panBy.x, + y: cyPan.y + panBy.y + }; + } // override pan w/ center if set + + + var center = properties.center || properties.centre; + + if (isCore && center != null) { + var centerPan = cy.getCenterPan(center.eles, properties.zoom); + + if (centerPan != null) { + properties.pan = centerPan; + } + } // override pan & zoom w/ fit if set + + + if (isCore && properties.fit != null) { + var fit = properties.fit; + var fitVp = cy.getFitViewport(fit.eles || fit.boundingBox, fit.padding); + + if (fitVp != null) { + properties.pan = fitVp.pan; + properties.zoom = fitVp.zoom; + } + } // override zoom (& potentially pan) w/ zoom obj if set + + + if (isCore && plainObject(properties.zoom)) { + var vp = cy.getZoomedViewport(properties.zoom); + + if (vp != null) { + if (vp.zoomed) { + properties.zoom = vp.zoom; + } + + if (vp.panned) { + properties.pan = vp.pan; + } + } else { + properties.zoom = null; // an inavalid zoom (e.g. no delta) gets automatically destroyed + } + } + + return new Animation(all[0], properties); + }; + }, + // animate + animate: function animate() { + return function animateImpl(properties, params) { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + if (params) { + properties = extend({}, properties, params); + } // manually hook and run the animation + + + for (var i = 0; i < all.length; i++) { + var ele = all[i]; + var queue = ele.animated() && (properties.queue === undefined || properties.queue); + var ani = ele.animation(properties, queue ? { + queue: true + } : undefined); + ani.play(); + } + + return this; // chaining + }; + }, + // animate + stop: function stop() { + return function stopImpl(clearQueue, jumpToEnd) { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + for (var i = 0; i < all.length; i++) { + var ele = all[i]; + var _p = ele._private; + var anis = _p.animation.current; + + for (var j = 0; j < anis.length; j++) { + var ani = anis[j]; + var ani_p = ani._private; + + if (jumpToEnd) { + // next iteration of the animation loop, the animation + // will go straight to the end and be removed + ani_p.duration = 0; + } + } // clear the queue of future animations + + + if (clearQueue) { + _p.animation.queue = []; + } + + if (!jumpToEnd) { + _p.animation.current = []; + } + } // we have to notify (the animation loop doesn't do it for us on `stop`) + + + cy.notify('draw'); + return this; + }; + } // stop + +}; // define + +var define$2 = { + // access data field + data: function data(params) { + var defaults = { + field: 'data', + bindingEvent: 'data', + allowBinding: false, + allowSetting: false, + allowGetting: false, + settingEvent: 'data', + settingTriggersEvent: false, + triggerFnName: 'trigger', + immutableKeys: {}, + // key => true if immutable + updateStyle: false, + beforeGet: function beforeGet(self) {}, + beforeSet: function beforeSet(self, obj) {}, + onSet: function onSet(self) {}, + canSet: function canSet(self) { + return true; + } + }; + params = extend({}, defaults, params); + return function dataImpl(name, value) { + var p = params; + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var single = selfIsArrayLike ? self[0] : self; // .data('foo', ...) + + if (string(name)) { + // set or get property + var isPathLike = name.indexOf('.') !== -1; // there might be a normal field with a dot + + var path = isPathLike && toPath__default["default"](name); // .data('foo') + + if (p.allowGetting && value === undefined) { + // get + var ret; + + if (single) { + p.beforeGet(single); // check if it's path and a field with the same name doesn't exist + + if (path && single._private[p.field][name] === undefined) { + ret = get__default["default"](single._private[p.field], path); + } else { + ret = single._private[p.field][name]; + } + } + + return ret; // .data('foo', 'bar') + } else if (p.allowSetting && value !== undefined) { + // set + var valid = !p.immutableKeys[name]; + + if (valid) { + var change = _defineProperty({}, name, value); + + p.beforeSet(self, change); + + for (var i = 0, l = all.length; i < l; i++) { + var ele = all[i]; + + if (p.canSet(ele)) { + if (path && single._private[p.field][name] === undefined) { + set__default["default"](ele._private[p.field], path, value); + } else { + ele._private[p.field][name] = value; + } + } + } // update mappers if asked + + + if (p.updateStyle) { + self.updateStyle(); + } // call onSet callback + + + p.onSet(self); + + if (p.settingTriggersEvent) { + self[p.triggerFnName](p.settingEvent); + } + } + } // .data({ 'foo': 'bar' }) + + } else if (p.allowSetting && plainObject(name)) { + // extend + var obj = name; + var k, v; + var keys = Object.keys(obj); + p.beforeSet(self, obj); + + for (var _i = 0; _i < keys.length; _i++) { + k = keys[_i]; + v = obj[k]; + + var _valid = !p.immutableKeys[k]; + + if (_valid) { + for (var j = 0; j < all.length; j++) { + var _ele = all[j]; + + if (p.canSet(_ele)) { + _ele._private[p.field][k] = v; + } + } + } + } // update mappers if asked + + + if (p.updateStyle) { + self.updateStyle(); + } // call onSet callback + + + p.onSet(self); + + if (p.settingTriggersEvent) { + self[p.triggerFnName](p.settingEvent); + } // .data(function(){ ... }) + + } else if (p.allowBinding && fn$6(name)) { + // bind to event + var fn = name; + self.on(p.bindingEvent, fn); // .data() + } else if (p.allowGetting && name === undefined) { + // get whole object + var _ret; + + if (single) { + p.beforeGet(single); + _ret = single._private[p.field]; + } + + return _ret; + } + + return self; // maintain chainability + }; // function + }, + // data + // remove data field + removeData: function removeData(params) { + var defaults = { + field: 'data', + event: 'data', + triggerFnName: 'trigger', + triggerEvent: false, + immutableKeys: {} // key => true if immutable + + }; + params = extend({}, defaults, params); + return function removeDataImpl(names) { + var p = params; + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + // .removeData('foo bar') + + if (string(names)) { + // then get the list of keys, and delete them + var keys = names.split(/\s+/); + var l = keys.length; + + for (var i = 0; i < l; i++) { + // delete each non-empty key + var key = keys[i]; + + if (emptyString(key)) { + continue; + } + + var valid = !p.immutableKeys[key]; // not valid if immutable + + if (valid) { + for (var i_a = 0, l_a = all.length; i_a < l_a; i_a++) { + all[i_a]._private[p.field][key] = undefined; + } + } + } + + if (p.triggerEvent) { + self[p.triggerFnName](p.event); + } // .removeData() + + } else if (names === undefined) { + // then delete all keys + for (var _i_a = 0, _l_a = all.length; _i_a < _l_a; _i_a++) { + var _privateFields = all[_i_a]._private[p.field]; + + var _keys = Object.keys(_privateFields); + + for (var _i2 = 0; _i2 < _keys.length; _i2++) { + var _key = _keys[_i2]; + var validKeyToDelete = !p.immutableKeys[_key]; + + if (validKeyToDelete) { + _privateFields[_key] = undefined; + } + } + } + + if (p.triggerEvent) { + self[p.triggerFnName](p.event); + } + } + + return self; // maintain chaining + }; // function + } // removeData + +}; // define + +var define$1 = { + eventAliasesOn: function eventAliasesOn(proto) { + var p = proto; + p.addListener = p.listen = p.bind = p.on; + p.unlisten = p.unbind = p.off = p.removeListener; + p.trigger = p.emit; // this is just a wrapper alias of .on() + + p.pon = p.promiseOn = function (events, selector) { + var self = this; + var args = Array.prototype.slice.call(arguments, 0); + return new Promise$1(function (resolve, reject) { + var callback = function callback(e) { + self.off.apply(self, offArgs); + resolve(e); + }; + + var onArgs = args.concat([callback]); + var offArgs = onArgs.concat([]); + self.on.apply(self, onArgs); + }); + }; + } +}; // define + +// use this module to cherry pick functions into your prototype +var define = {}; +[define$3, define$2, define$1].forEach(function (m) { + extend(define, m); +}); + +var elesfn$i = { + animate: define.animate(), + animation: define.animation(), + animated: define.animated(), + clearQueue: define.clearQueue(), + delay: define.delay(), + delayAnimation: define.delayAnimation(), + stop: define.stop() +}; + +var elesfn$h = { + classes: function classes(_classes) { + var self = this; + + if (_classes === undefined) { + var ret = []; + + self[0]._private.classes.forEach(function (cls) { + return ret.push(cls); + }); + + return ret; + } else if (!array(_classes)) { + // extract classes from string + _classes = (_classes || '').match(/\S+/g) || []; + } + + var changed = []; + var classesSet = new Set$1(_classes); // check and update each ele + + for (var j = 0; j < self.length; j++) { + var ele = self[j]; + var _p = ele._private; + var eleClasses = _p.classes; + var changedEle = false; // check if ele has all of the passed classes + + for (var i = 0; i < _classes.length; i++) { + var cls = _classes[i]; + var eleHasClass = eleClasses.has(cls); + + if (!eleHasClass) { + changedEle = true; + break; + } + } // check if ele has classes outside of those passed + + + if (!changedEle) { + changedEle = eleClasses.size !== _classes.length; + } + + if (changedEle) { + _p.classes = classesSet; + changed.push(ele); + } + } // trigger update style on those eles that had class changes + + + if (changed.length > 0) { + this.spawn(changed).updateStyle().emit('class'); + } + + return self; + }, + addClass: function addClass(classes) { + return this.toggleClass(classes, true); + }, + hasClass: function hasClass(className) { + var ele = this[0]; + return ele != null && ele._private.classes.has(className); + }, + toggleClass: function toggleClass(classes, toggle) { + if (!array(classes)) { + // extract classes from string + classes = classes.match(/\S+/g) || []; + } + + var self = this; + var toggleUndefd = toggle === undefined; + var changed = []; // eles who had classes changed + + for (var i = 0, il = self.length; i < il; i++) { + var ele = self[i]; + var eleClasses = ele._private.classes; + var changedEle = false; + + for (var j = 0; j < classes.length; j++) { + var cls = classes[j]; + var hasClass = eleClasses.has(cls); + var changedNow = false; + + if (toggle || toggleUndefd && !hasClass) { + eleClasses.add(cls); + changedNow = true; + } else if (!toggle || toggleUndefd && hasClass) { + eleClasses["delete"](cls); + changedNow = true; + } + + if (!changedEle && changedNow) { + changed.push(ele); + changedEle = true; + } + } // for j classes + + } // for i eles + // trigger update style on those eles that had class changes + + + if (changed.length > 0) { + this.spawn(changed).updateStyle().emit('class'); + } + + return self; + }, + removeClass: function removeClass(classes) { + return this.toggleClass(classes, false); + }, + flashClass: function flashClass(classes, duration) { + var self = this; + + if (duration == null) { + duration = 250; + } else if (duration === 0) { + return self; // nothing to do really + } + + self.addClass(classes); + setTimeout(function () { + self.removeClass(classes); + }, duration); + return self; + } +}; +elesfn$h.className = elesfn$h.classNames = elesfn$h.classes; + +var tokens = { + metaChar: '[\\!\\"\\#\\$\\%\\&\\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]', + // chars we need to escape in let names, etc + comparatorOp: '=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=', + // binary comparison op (used in data selectors) + boolOp: '\\?|\\!|\\^', + // boolean (unary) operators (used in data selectors) + string: '"(?:\\\\"|[^"])*"' + '|' + "'(?:\\\\'|[^'])*'", + // string literals (used in data selectors) -- doublequotes | singlequotes + number: number, + // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123 + meta: 'degree|indegree|outdegree', + // allowed metadata fields (i.e. allowed functions to use from Collection) + separator: '\\s*,\\s*', + // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass + descendant: '\\s+', + child: '\\s+>\\s+', + subject: '\\$', + group: 'node|edge|\\*', + directedEdge: '\\s+->\\s+', + undirectedEdge: '\\s+<->\\s+' +}; +tokens.variable = '(?:[\\w-.]|(?:\\\\' + tokens.metaChar + '))+'; // a variable name can have letters, numbers, dashes, and periods + +tokens.className = '(?:[\\w-]|(?:\\\\' + tokens.metaChar + '))+'; // a class name has the same rules as a variable except it can't have a '.' in the name + +tokens.value = tokens.string + '|' + tokens.number; // a value literal, either a string or number + +tokens.id = tokens.variable; // an element id (follows variable conventions) + +(function () { + var ops, op, i; // add @ variants to comparatorOp + + ops = tokens.comparatorOp.split('|'); + + for (i = 0; i < ops.length; i++) { + op = ops[i]; + tokens.comparatorOp += '|@' + op; + } // add ! variants to comparatorOp + + + ops = tokens.comparatorOp.split('|'); + + for (i = 0; i < ops.length; i++) { + op = ops[i]; + + if (op.indexOf('!') >= 0) { + continue; + } // skip ops that explicitly contain ! + + + if (op === '=') { + continue; + } // skip = b/c != is explicitly defined + + + tokens.comparatorOp += '|\\!' + op; + } +})(); + +/** + * Make a new query object + * + * @prop type {Type} The type enum (int) of the query + * @prop checks List of checks to make against an ele to test for a match + */ +var newQuery = function newQuery() { + return { + checks: [] + }; +}; + +/** + * A check type enum-like object. Uses integer values for fast match() lookup. + * The ordering does not matter as long as the ints are unique. + */ +var Type = { + /** E.g. node */ + GROUP: 0, + + /** A collection of elements */ + COLLECTION: 1, + + /** A filter(ele) function */ + FILTER: 2, + + /** E.g. [foo > 1] */ + DATA_COMPARE: 3, + + /** E.g. [foo] */ + DATA_EXIST: 4, + + /** E.g. [?foo] */ + DATA_BOOL: 5, + + /** E.g. [[degree > 2]] */ + META_COMPARE: 6, + + /** E.g. :selected */ + STATE: 7, + + /** E.g. #foo */ + ID: 8, + + /** E.g. .foo */ + CLASS: 9, + + /** E.g. #foo <-> #bar */ + UNDIRECTED_EDGE: 10, + + /** E.g. #foo -> #bar */ + DIRECTED_EDGE: 11, + + /** E.g. $#foo -> #bar */ + NODE_SOURCE: 12, + + /** E.g. #foo -> $#bar */ + NODE_TARGET: 13, + + /** E.g. $#foo <-> #bar */ + NODE_NEIGHBOR: 14, + + /** E.g. #foo > #bar */ + CHILD: 15, + + /** E.g. #foo #bar */ + DESCENDANT: 16, + + /** E.g. $#foo > #bar */ + PARENT: 17, + + /** E.g. $#foo #bar */ + ANCESTOR: 18, + + /** E.g. #foo > $bar > #baz */ + COMPOUND_SPLIT: 19, + + /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */ + TRUE: 20 +}; + +var stateSelectors = [{ + selector: ':selected', + matches: function matches(ele) { + return ele.selected(); + } +}, { + selector: ':unselected', + matches: function matches(ele) { + return !ele.selected(); + } +}, { + selector: ':selectable', + matches: function matches(ele) { + return ele.selectable(); + } +}, { + selector: ':unselectable', + matches: function matches(ele) { + return !ele.selectable(); + } +}, { + selector: ':locked', + matches: function matches(ele) { + return ele.locked(); + } +}, { + selector: ':unlocked', + matches: function matches(ele) { + return !ele.locked(); + } +}, { + selector: ':visible', + matches: function matches(ele) { + return ele.visible(); + } +}, { + selector: ':hidden', + matches: function matches(ele) { + return !ele.visible(); + } +}, { + selector: ':transparent', + matches: function matches(ele) { + return ele.transparent(); + } +}, { + selector: ':grabbed', + matches: function matches(ele) { + return ele.grabbed(); + } +}, { + selector: ':free', + matches: function matches(ele) { + return !ele.grabbed(); + } +}, { + selector: ':removed', + matches: function matches(ele) { + return ele.removed(); + } +}, { + selector: ':inside', + matches: function matches(ele) { + return !ele.removed(); + } +}, { + selector: ':grabbable', + matches: function matches(ele) { + return ele.grabbable(); + } +}, { + selector: ':ungrabbable', + matches: function matches(ele) { + return !ele.grabbable(); + } +}, { + selector: ':animated', + matches: function matches(ele) { + return ele.animated(); + } +}, { + selector: ':unanimated', + matches: function matches(ele) { + return !ele.animated(); + } +}, { + selector: ':parent', + matches: function matches(ele) { + return ele.isParent(); + } +}, { + selector: ':childless', + matches: function matches(ele) { + return ele.isChildless(); + } +}, { + selector: ':child', + matches: function matches(ele) { + return ele.isChild(); + } +}, { + selector: ':orphan', + matches: function matches(ele) { + return ele.isOrphan(); + } +}, { + selector: ':nonorphan', + matches: function matches(ele) { + return ele.isChild(); + } +}, { + selector: ':compound', + matches: function matches(ele) { + if (ele.isNode()) { + return ele.isParent(); + } else { + return ele.source().isParent() || ele.target().isParent(); + } + } +}, { + selector: ':loop', + matches: function matches(ele) { + return ele.isLoop(); + } +}, { + selector: ':simple', + matches: function matches(ele) { + return ele.isSimple(); + } +}, { + selector: ':active', + matches: function matches(ele) { + return ele.active(); + } +}, { + selector: ':inactive', + matches: function matches(ele) { + return !ele.active(); + } +}, { + selector: ':backgrounding', + matches: function matches(ele) { + return ele.backgrounding(); + } +}, { + selector: ':nonbackgrounding', + matches: function matches(ele) { + return !ele.backgrounding(); + } +}].sort(function (a, b) { + // n.b. selectors that are starting substrings of others must have the longer ones first + return descending(a.selector, b.selector); +}); + +var lookup = function () { + var selToFn = {}; + var s; + + for (var i = 0; i < stateSelectors.length; i++) { + s = stateSelectors[i]; + selToFn[s.selector] = s.matches; + } + + return selToFn; +}(); + +var stateSelectorMatches = function stateSelectorMatches(sel, ele) { + return lookup[sel](ele); +}; +var stateSelectorRegex = '(' + stateSelectors.map(function (s) { + return s.selector; +}).join('|') + ')'; + +// so that values get compared properly in Selector.filter() + +var cleanMetaChars = function cleanMetaChars(str) { + return str.replace(new RegExp('\\\\(' + tokens.metaChar + ')', 'g'), function (match, $1) { + return $1; + }); +}; + +var replaceLastQuery = function replaceLastQuery(selector, examiningQuery, replacementQuery) { + selector[selector.length - 1] = replacementQuery; +}; // NOTE: add new expression syntax here to have it recognised by the parser; +// - a query contains all adjacent (i.e. no separator in between) expressions; +// - the current query is stored in selector[i] +// - you need to check the query objects in match() for it actually filter properly, but that's pretty straight forward + + +var exprs = [{ + name: 'group', + // just used for identifying when debugging + query: true, + regex: '(' + tokens.group + ')', + populate: function populate(selector, query, _ref) { + var _ref2 = _slicedToArray(_ref, 1), + group = _ref2[0]; + + query.checks.push({ + type: Type.GROUP, + value: group === '*' ? group : group + 's' + }); + } +}, { + name: 'state', + query: true, + regex: stateSelectorRegex, + populate: function populate(selector, query, _ref3) { + var _ref4 = _slicedToArray(_ref3, 1), + state = _ref4[0]; + + query.checks.push({ + type: Type.STATE, + value: state + }); + } +}, { + name: 'id', + query: true, + regex: '\\#(' + tokens.id + ')', + populate: function populate(selector, query, _ref5) { + var _ref6 = _slicedToArray(_ref5, 1), + id = _ref6[0]; + + query.checks.push({ + type: Type.ID, + value: cleanMetaChars(id) + }); + } +}, { + name: 'className', + query: true, + regex: '\\.(' + tokens.className + ')', + populate: function populate(selector, query, _ref7) { + var _ref8 = _slicedToArray(_ref7, 1), + className = _ref8[0]; + + query.checks.push({ + type: Type.CLASS, + value: cleanMetaChars(className) + }); + } +}, { + name: 'dataExists', + query: true, + regex: '\\[\\s*(' + tokens.variable + ')\\s*\\]', + populate: function populate(selector, query, _ref9) { + var _ref10 = _slicedToArray(_ref9, 1), + variable = _ref10[0]; + + query.checks.push({ + type: Type.DATA_EXIST, + field: cleanMetaChars(variable) + }); + } +}, { + name: 'dataCompare', + query: true, + regex: '\\[\\s*(' + tokens.variable + ')\\s*(' + tokens.comparatorOp + ')\\s*(' + tokens.value + ')\\s*\\]', + populate: function populate(selector, query, _ref11) { + var _ref12 = _slicedToArray(_ref11, 3), + variable = _ref12[0], + comparatorOp = _ref12[1], + value = _ref12[2]; + + var valueIsString = new RegExp('^' + tokens.string + '$').exec(value) != null; + + if (valueIsString) { + value = value.substring(1, value.length - 1); + } else { + value = parseFloat(value); + } + + query.checks.push({ + type: Type.DATA_COMPARE, + field: cleanMetaChars(variable), + operator: comparatorOp, + value: value + }); + } +}, { + name: 'dataBool', + query: true, + regex: '\\[\\s*(' + tokens.boolOp + ')\\s*(' + tokens.variable + ')\\s*\\]', + populate: function populate(selector, query, _ref13) { + var _ref14 = _slicedToArray(_ref13, 2), + boolOp = _ref14[0], + variable = _ref14[1]; + + query.checks.push({ + type: Type.DATA_BOOL, + field: cleanMetaChars(variable), + operator: boolOp + }); + } +}, { + name: 'metaCompare', + query: true, + regex: '\\[\\[\\s*(' + tokens.meta + ')\\s*(' + tokens.comparatorOp + ')\\s*(' + tokens.number + ')\\s*\\]\\]', + populate: function populate(selector, query, _ref15) { + var _ref16 = _slicedToArray(_ref15, 3), + meta = _ref16[0], + comparatorOp = _ref16[1], + number = _ref16[2]; + + query.checks.push({ + type: Type.META_COMPARE, + field: cleanMetaChars(meta), + operator: comparatorOp, + value: parseFloat(number) + }); + } +}, { + name: 'nextQuery', + separator: true, + regex: tokens.separator, + populate: function populate(selector, query) { + var currentSubject = selector.currentSubject; + var edgeCount = selector.edgeCount; + var compoundCount = selector.compoundCount; + var lastQ = selector[selector.length - 1]; + + if (currentSubject != null) { + lastQ.subject = currentSubject; + selector.currentSubject = null; + } + + lastQ.edgeCount = edgeCount; + lastQ.compoundCount = compoundCount; + selector.edgeCount = 0; + selector.compoundCount = 0; // go on to next query + + var nextQuery = selector[selector.length++] = newQuery(); + return nextQuery; // this is the new query to be filled by the following exprs + } +}, { + name: 'directedEdge', + separator: true, + regex: tokens.directedEdge, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // undirected edge + var edgeQuery = newQuery(); + var source = query; + var target = newQuery(); + edgeQuery.checks.push({ + type: Type.DIRECTED_EDGE, + source: source, + target: target + }); // the query in the selector should be the edge rather than the source + + replaceLastQuery(selector, query, edgeQuery); + selector.edgeCount++; // we're now populating the target query with expressions that follow + + return target; + } else { + // source/target + var srcTgtQ = newQuery(); + var _source = query; + + var _target = newQuery(); + + srcTgtQ.checks.push({ + type: Type.NODE_SOURCE, + source: _source, + target: _target + }); // the query in the selector should be the neighbourhood rather than the node + + replaceLastQuery(selector, query, srcTgtQ); + selector.edgeCount++; + return _target; // now populating the target with the following expressions + } + } +}, { + name: 'undirectedEdge', + separator: true, + regex: tokens.undirectedEdge, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // undirected edge + var edgeQuery = newQuery(); + var source = query; + var target = newQuery(); + edgeQuery.checks.push({ + type: Type.UNDIRECTED_EDGE, + nodes: [source, target] + }); // the query in the selector should be the edge rather than the source + + replaceLastQuery(selector, query, edgeQuery); + selector.edgeCount++; // we're now populating the target query with expressions that follow + + return target; + } else { + // neighbourhood + var nhoodQ = newQuery(); + var node = query; + var neighbor = newQuery(); + nhoodQ.checks.push({ + type: Type.NODE_NEIGHBOR, + node: node, + neighbor: neighbor + }); // the query in the selector should be the neighbourhood rather than the node + + replaceLastQuery(selector, query, nhoodQ); + return neighbor; // now populating the neighbor with following expressions + } + } +}, { + name: 'child', + separator: true, + regex: tokens.child, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // default: child query + var parentChildQuery = newQuery(); + var child = newQuery(); + var parent = selector[selector.length - 1]; + parentChildQuery.checks.push({ + type: Type.CHILD, + parent: parent, + child: child + }); // the query in the selector should be the '>' itself + + replaceLastQuery(selector, query, parentChildQuery); + selector.compoundCount++; // we're now populating the child query with expressions that follow + + return child; + } else if (selector.currentSubject === query) { + // compound split query + var compound = newQuery(); + var left = selector[selector.length - 1]; + var right = newQuery(); + var subject = newQuery(); + + var _child = newQuery(); + + var _parent = newQuery(); // set up the root compound q + + + compound.checks.push({ + type: Type.COMPOUND_SPLIT, + left: left, + right: right, + subject: subject + }); // populate the subject and replace the q at the old spot (within left) with TRUE + + subject.checks = query.checks; // take the checks from the left + + query.checks = [{ + type: Type.TRUE + }]; // checks under left refs the subject implicitly + // set up the right q + + _parent.checks.push({ + type: Type.TRUE + }); // parent implicitly refs the subject + + + right.checks.push({ + type: Type.PARENT, + // type is swapped on right side queries + parent: _parent, + child: _child // empty for now + + }); + replaceLastQuery(selector, left, compound); // update the ref since we moved things around for `query` + + selector.currentSubject = subject; + selector.compoundCount++; + return _child; // now populating the right side's child + } else { + // parent query + // info for parent query + var _parent2 = newQuery(); + + var _child2 = newQuery(); + + var pcQChecks = [{ + type: Type.PARENT, + parent: _parent2, + child: _child2 + }]; // the parent-child query takes the place of the query previously being populated + + _parent2.checks = query.checks; // the previous query contains the checks for the parent + + query.checks = pcQChecks; // pc query takes over + + selector.compoundCount++; + return _child2; // we're now populating the child + } + } +}, { + name: 'descendant', + separator: true, + regex: tokens.descendant, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // default: descendant query + var ancChQuery = newQuery(); + var descendant = newQuery(); + var ancestor = selector[selector.length - 1]; + ancChQuery.checks.push({ + type: Type.DESCENDANT, + ancestor: ancestor, + descendant: descendant + }); // the query in the selector should be the '>' itself + + replaceLastQuery(selector, query, ancChQuery); + selector.compoundCount++; // we're now populating the descendant query with expressions that follow + + return descendant; + } else if (selector.currentSubject === query) { + // compound split query + var compound = newQuery(); + var left = selector[selector.length - 1]; + var right = newQuery(); + var subject = newQuery(); + + var _descendant = newQuery(); + + var _ancestor = newQuery(); // set up the root compound q + + + compound.checks.push({ + type: Type.COMPOUND_SPLIT, + left: left, + right: right, + subject: subject + }); // populate the subject and replace the q at the old spot (within left) with TRUE + + subject.checks = query.checks; // take the checks from the left + + query.checks = [{ + type: Type.TRUE + }]; // checks under left refs the subject implicitly + // set up the right q + + _ancestor.checks.push({ + type: Type.TRUE + }); // ancestor implicitly refs the subject + + + right.checks.push({ + type: Type.ANCESTOR, + // type is swapped on right side queries + ancestor: _ancestor, + descendant: _descendant // empty for now + + }); + replaceLastQuery(selector, left, compound); // update the ref since we moved things around for `query` + + selector.currentSubject = subject; + selector.compoundCount++; + return _descendant; // now populating the right side's descendant + } else { + // ancestor query + // info for parent query + var _ancestor2 = newQuery(); + + var _descendant2 = newQuery(); + + var adQChecks = [{ + type: Type.ANCESTOR, + ancestor: _ancestor2, + descendant: _descendant2 + }]; // the parent-child query takes the place of the query previously being populated + + _ancestor2.checks = query.checks; // the previous query contains the checks for the parent + + query.checks = adQChecks; // pc query takes over + + selector.compoundCount++; + return _descendant2; // we're now populating the child + } + } +}, { + name: 'subject', + modifier: true, + regex: tokens.subject, + populate: function populate(selector, query) { + if (selector.currentSubject != null && selector.currentSubject !== query) { + warn('Redefinition of subject in selector `' + selector.toString() + '`'); + return false; + } + + selector.currentSubject = query; + var topQ = selector[selector.length - 1]; + var topChk = topQ.checks[0]; + var topType = topChk == null ? null : topChk.type; + + if (topType === Type.DIRECTED_EDGE) { + // directed edge with subject on the target + // change to target node check + topChk.type = Type.NODE_TARGET; + } else if (topType === Type.UNDIRECTED_EDGE) { + // undirected edge with subject on the second node + // change to neighbor check + topChk.type = Type.NODE_NEIGHBOR; + topChk.node = topChk.nodes[1]; // second node is subject + + topChk.neighbor = topChk.nodes[0]; // clean up unused fields for new type + + topChk.nodes = null; + } + } +}]; +exprs.forEach(function (e) { + return e.regexObj = new RegExp('^' + e.regex); +}); + +/** + * Of all the expressions, find the first match in the remaining text. + * @param {string} remaining The remaining text to parse + * @returns The matched expression and the newly remaining text `{ expr, match, name, remaining }` + */ + +var consumeExpr = function consumeExpr(remaining) { + var expr; + var match; + var name; + + for (var j = 0; j < exprs.length; j++) { + var e = exprs[j]; + var n = e.name; + var m = remaining.match(e.regexObj); + + if (m != null) { + match = m; + expr = e; + name = n; + var consumed = m[0]; + remaining = remaining.substring(consumed.length); + break; // we've consumed one expr, so we can return now + } + } + + return { + expr: expr, + match: match, + name: name, + remaining: remaining + }; +}; +/** + * Consume all the leading whitespace + * @param {string} remaining The text to consume + * @returns The text with the leading whitespace removed + */ + + +var consumeWhitespace = function consumeWhitespace(remaining) { + var match = remaining.match(/^\s+/); + + if (match) { + var consumed = match[0]; + remaining = remaining.substring(consumed.length); + } + + return remaining; +}; +/** + * Parse the string and store the parsed representation in the Selector. + * @param {string} selector The selector string + * @returns `true` if the selector was successfully parsed, `false` otherwise + */ + + +var parse = function parse(selector) { + var self = this; + var remaining = self.inputText = selector; + var currentQuery = self[0] = newQuery(); + self.length = 1; + remaining = consumeWhitespace(remaining); // get rid of leading whitespace + + for (;;) { + var exprInfo = consumeExpr(remaining); + + if (exprInfo.expr == null) { + warn('The selector `' + selector + '`is invalid'); + return false; + } else { + var args = exprInfo.match.slice(1); // let the token populate the selector object in currentQuery + + var ret = exprInfo.expr.populate(self, currentQuery, args); + + if (ret === false) { + return false; // exit if population failed + } else if (ret != null) { + currentQuery = ret; // change the current query to be filled if the expr specifies + } + } + + remaining = exprInfo.remaining; // we're done when there's nothing left to parse + + if (remaining.match(/^\s*$/)) { + break; + } + } + + var lastQ = self[self.length - 1]; + + if (self.currentSubject != null) { + lastQ.subject = self.currentSubject; + } + + lastQ.edgeCount = self.edgeCount; + lastQ.compoundCount = self.compoundCount; + + for (var i = 0; i < self.length; i++) { + var q = self[i]; // in future, this could potentially be allowed if there were operator precedence and detection of invalid combinations + + if (q.compoundCount > 0 && q.edgeCount > 0) { + warn('The selector `' + selector + '` is invalid because it uses both a compound selector and an edge selector'); + return false; + } + + if (q.edgeCount > 1) { + warn('The selector `' + selector + '` is invalid because it uses multiple edge selectors'); + return false; + } else if (q.edgeCount === 1) { + warn('The selector `' + selector + '` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.'); + } + } + + return true; // success +}; +/** + * Get the selector represented as a string. This value uses default formatting, + * so things like spacing may differ from the input text passed to the constructor. + * @returns {string} The selector string + */ + + +var toString = function toString() { + if (this.toStringCache != null) { + return this.toStringCache; + } + + var clean = function clean(obj) { + if (obj == null) { + return ''; + } else { + return obj; + } + }; + + var cleanVal = function cleanVal(val) { + if (string(val)) { + return '"' + val + '"'; + } else { + return clean(val); + } + }; + + var space = function space(val) { + return ' ' + val + ' '; + }; + + var checkToString = function checkToString(check, subject) { + var type = check.type, + value = check.value; + + switch (type) { + case Type.GROUP: + { + var group = clean(value); + return group.substring(0, group.length - 1); + } + + case Type.DATA_COMPARE: + { + var field = check.field, + operator = check.operator; + return '[' + field + space(clean(operator)) + cleanVal(value) + ']'; + } + + case Type.DATA_BOOL: + { + var _operator = check.operator, + _field = check.field; + return '[' + clean(_operator) + _field + ']'; + } + + case Type.DATA_EXIST: + { + var _field2 = check.field; + return '[' + _field2 + ']'; + } + + case Type.META_COMPARE: + { + var _operator2 = check.operator, + _field3 = check.field; + return '[[' + _field3 + space(clean(_operator2)) + cleanVal(value) + ']]'; + } + + case Type.STATE: + { + return value; + } + + case Type.ID: + { + return '#' + value; + } + + case Type.CLASS: + { + return '.' + value; + } + + case Type.PARENT: + case Type.CHILD: + { + return queryToString(check.parent, subject) + space('>') + queryToString(check.child, subject); + } + + case Type.ANCESTOR: + case Type.DESCENDANT: + { + return queryToString(check.ancestor, subject) + ' ' + queryToString(check.descendant, subject); + } + + case Type.COMPOUND_SPLIT: + { + var lhs = queryToString(check.left, subject); + var sub = queryToString(check.subject, subject); + var rhs = queryToString(check.right, subject); + return lhs + (lhs.length > 0 ? ' ' : '') + sub + rhs; + } + + case Type.TRUE: + { + return ''; + } + } + }; + + var queryToString = function queryToString(query, subject) { + return query.checks.reduce(function (str, chk, i) { + return str + (subject === query && i === 0 ? '$' : '') + checkToString(chk, subject); + }, ''); + }; + + var str = ''; + + for (var i = 0; i < this.length; i++) { + var query = this[i]; + str += queryToString(query, query.subject); + + if (this.length > 1 && i < this.length - 1) { + str += ', '; + } + } + + this.toStringCache = str; + return str; +}; +var parse$1 = { + parse: parse, + toString: toString +}; + +var valCmp = function valCmp(fieldVal, operator, value) { + var matches; + var isFieldStr = string(fieldVal); + var isFieldNum = number$1(fieldVal); + var isValStr = string(value); + var fieldStr, valStr; + var caseInsensitive = false; + var notExpr = false; + var isIneqCmp = false; + + if (operator.indexOf('!') >= 0) { + operator = operator.replace('!', ''); + notExpr = true; + } + + if (operator.indexOf('@') >= 0) { + operator = operator.replace('@', ''); + caseInsensitive = true; + } + + if (isFieldStr || isValStr || caseInsensitive) { + fieldStr = !isFieldStr && !isFieldNum ? '' : '' + fieldVal; + valStr = '' + value; + } // if we're doing a case insensitive comparison, then we're using a STRING comparison + // even if we're comparing numbers + + + if (caseInsensitive) { + fieldVal = fieldStr = fieldStr.toLowerCase(); + value = valStr = valStr.toLowerCase(); + } + + switch (operator) { + case '*=': + matches = fieldStr.indexOf(valStr) >= 0; + break; + + case '$=': + matches = fieldStr.indexOf(valStr, fieldStr.length - valStr.length) >= 0; + break; + + case '^=': + matches = fieldStr.indexOf(valStr) === 0; + break; + + case '=': + matches = fieldVal === value; + break; + + case '>': + isIneqCmp = true; + matches = fieldVal > value; + break; + + case '>=': + isIneqCmp = true; + matches = fieldVal >= value; + break; + + case '<': + isIneqCmp = true; + matches = fieldVal < value; + break; + + case '<=': + isIneqCmp = true; + matches = fieldVal <= value; + break; + + default: + matches = false; + break; + } // apply the not op, but null vals for inequalities should always stay non-matching + + + if (notExpr && (fieldVal != null || !isIneqCmp)) { + matches = !matches; + } + + return matches; +}; +var boolCmp = function boolCmp(fieldVal, operator) { + switch (operator) { + case '?': + return fieldVal ? true : false; + + case '!': + return fieldVal ? false : true; + + case '^': + return fieldVal === undefined; + } +}; +var existCmp = function existCmp(fieldVal) { + return fieldVal !== undefined; +}; +var data$1 = function data(ele, field) { + return ele.data(field); +}; +var meta = function meta(ele, field) { + return ele[field](); +}; + +/** A lookup of `match(check, ele)` functions by `Type` int */ + +var match = []; +/** + * Returns whether the query matches for the element + * @param query The `{ type, value, ... }` query object + * @param ele The element to compare against +*/ + +var matches$1 = function matches(query, ele) { + return query.checks.every(function (chk) { + return match[chk.type](chk, ele); + }); +}; + +match[Type.GROUP] = function (check, ele) { + var group = check.value; + return group === '*' || group === ele.group(); +}; + +match[Type.STATE] = function (check, ele) { + var stateSelector = check.value; + return stateSelectorMatches(stateSelector, ele); +}; + +match[Type.ID] = function (check, ele) { + var id = check.value; + return ele.id() === id; +}; + +match[Type.CLASS] = function (check, ele) { + var cls = check.value; + return ele.hasClass(cls); +}; + +match[Type.META_COMPARE] = function (check, ele) { + var field = check.field, + operator = check.operator, + value = check.value; + return valCmp(meta(ele, field), operator, value); +}; + +match[Type.DATA_COMPARE] = function (check, ele) { + var field = check.field, + operator = check.operator, + value = check.value; + return valCmp(data$1(ele, field), operator, value); +}; + +match[Type.DATA_BOOL] = function (check, ele) { + var field = check.field, + operator = check.operator; + return boolCmp(data$1(ele, field), operator); +}; + +match[Type.DATA_EXIST] = function (check, ele) { + var field = check.field; + check.operator; + return existCmp(data$1(ele, field)); +}; + +match[Type.UNDIRECTED_EDGE] = function (check, ele) { + var qA = check.nodes[0]; + var qB = check.nodes[1]; + var src = ele.source(); + var tgt = ele.target(); + return matches$1(qA, src) && matches$1(qB, tgt) || matches$1(qB, src) && matches$1(qA, tgt); +}; + +match[Type.NODE_NEIGHBOR] = function (check, ele) { + return matches$1(check.node, ele) && ele.neighborhood().some(function (n) { + return n.isNode() && matches$1(check.neighbor, n); + }); +}; + +match[Type.DIRECTED_EDGE] = function (check, ele) { + return matches$1(check.source, ele.source()) && matches$1(check.target, ele.target()); +}; + +match[Type.NODE_SOURCE] = function (check, ele) { + return matches$1(check.source, ele) && ele.outgoers().some(function (n) { + return n.isNode() && matches$1(check.target, n); + }); +}; + +match[Type.NODE_TARGET] = function (check, ele) { + return matches$1(check.target, ele) && ele.incomers().some(function (n) { + return n.isNode() && matches$1(check.source, n); + }); +}; + +match[Type.CHILD] = function (check, ele) { + return matches$1(check.child, ele) && matches$1(check.parent, ele.parent()); +}; + +match[Type.PARENT] = function (check, ele) { + return matches$1(check.parent, ele) && ele.children().some(function (c) { + return matches$1(check.child, c); + }); +}; + +match[Type.DESCENDANT] = function (check, ele) { + return matches$1(check.descendant, ele) && ele.ancestors().some(function (a) { + return matches$1(check.ancestor, a); + }); +}; + +match[Type.ANCESTOR] = function (check, ele) { + return matches$1(check.ancestor, ele) && ele.descendants().some(function (d) { + return matches$1(check.descendant, d); + }); +}; + +match[Type.COMPOUND_SPLIT] = function (check, ele) { + return matches$1(check.subject, ele) && matches$1(check.left, ele) && matches$1(check.right, ele); +}; + +match[Type.TRUE] = function () { + return true; +}; + +match[Type.COLLECTION] = function (check, ele) { + var collection = check.value; + return collection.has(ele); +}; + +match[Type.FILTER] = function (check, ele) { + var filter = check.value; + return filter(ele); +}; + +var filter = function filter(collection) { + var self = this; // for 1 id #foo queries, just get the element + + if (self.length === 1 && self[0].checks.length === 1 && self[0].checks[0].type === Type.ID) { + return collection.getElementById(self[0].checks[0].value).collection(); + } + + var selectorFunction = function selectorFunction(element) { + for (var j = 0; j < self.length; j++) { + var query = self[j]; + + if (matches$1(query, element)) { + return true; + } + } + + return false; + }; + + if (self.text() == null) { + selectorFunction = function selectorFunction() { + return true; + }; + } + + return collection.filter(selectorFunction); +}; // filter +// does selector match a single element? + + +var matches = function matches(ele) { + var self = this; + + for (var j = 0; j < self.length; j++) { + var query = self[j]; + + if (matches$1(query, ele)) { + return true; + } + } + + return false; +}; // matches + + +var matching = { + matches: matches, + filter: filter +}; + +var Selector = function Selector(selector) { + this.inputText = selector; + this.currentSubject = null; + this.compoundCount = 0; + this.edgeCount = 0; + this.length = 0; + + if (selector == null || string(selector) && selector.match(/^\s*$/)) ; else if (elementOrCollection(selector)) { + this.addQuery({ + checks: [{ + type: Type.COLLECTION, + value: selector.collection() + }] + }); + } else if (fn$6(selector)) { + this.addQuery({ + checks: [{ + type: Type.FILTER, + value: selector + }] + }); + } else if (string(selector)) { + if (!this.parse(selector)) { + this.invalid = true; + } + } else { + error('A selector must be created from a string; found '); + } +}; + +var selfn = Selector.prototype; +[parse$1, matching].forEach(function (p) { + return extend(selfn, p); +}); + +selfn.text = function () { + return this.inputText; +}; + +selfn.size = function () { + return this.length; +}; + +selfn.eq = function (i) { + return this[i]; +}; + +selfn.sameText = function (otherSel) { + return !this.invalid && !otherSel.invalid && this.text() === otherSel.text(); +}; + +selfn.addQuery = function (q) { + this[this.length++] = q; +}; + +selfn.selector = selfn.toString; + +var elesfn$g = { + allAre: function allAre(selector) { + var selObj = new Selector(selector); + return this.every(function (ele) { + return selObj.matches(ele); + }); + }, + is: function is(selector) { + var selObj = new Selector(selector); + return this.some(function (ele) { + return selObj.matches(ele); + }); + }, + some: function some(fn, thisArg) { + for (var i = 0; i < this.length; i++) { + var ret = !thisArg ? fn(this[i], i, this) : fn.apply(thisArg, [this[i], i, this]); + + if (ret) { + return true; + } + } + + return false; + }, + every: function every(fn, thisArg) { + for (var i = 0; i < this.length; i++) { + var ret = !thisArg ? fn(this[i], i, this) : fn.apply(thisArg, [this[i], i, this]); + + if (!ret) { + return false; + } + } + + return true; + }, + same: function same(collection) { + // cheap collection ref check + if (this === collection) { + return true; + } + + collection = this.cy().collection(collection); + var thisLength = this.length; + var collectionLength = collection.length; // cheap length check + + if (thisLength !== collectionLength) { + return false; + } // cheap element ref check + + + if (thisLength === 1) { + return this[0] === collection[0]; + } + + return this.every(function (ele) { + return collection.hasElementWithId(ele.id()); + }); + }, + anySame: function anySame(collection) { + collection = this.cy().collection(collection); + return this.some(function (ele) { + return collection.hasElementWithId(ele.id()); + }); + }, + allAreNeighbors: function allAreNeighbors(collection) { + collection = this.cy().collection(collection); + var nhood = this.neighborhood(); + return collection.every(function (ele) { + return nhood.hasElementWithId(ele.id()); + }); + }, + contains: function contains(collection) { + collection = this.cy().collection(collection); + var self = this; + return collection.every(function (ele) { + return self.hasElementWithId(ele.id()); + }); + } +}; +elesfn$g.allAreNeighbours = elesfn$g.allAreNeighbors; +elesfn$g.has = elesfn$g.contains; +elesfn$g.equal = elesfn$g.equals = elesfn$g.same; + +var cache = function cache(fn, name) { + return function traversalCache(arg1, arg2, arg3, arg4) { + var selectorOrEles = arg1; + var eles = this; + var key; + + if (selectorOrEles == null) { + key = ''; + } else if (elementOrCollection(selectorOrEles) && selectorOrEles.length === 1) { + key = selectorOrEles.id(); + } + + if (eles.length === 1 && key) { + var _p = eles[0]._private; + var tch = _p.traversalCache = _p.traversalCache || {}; + var ch = tch[name] = tch[name] || []; + var hash = hashString(key); + var cacheHit = ch[hash]; + + if (cacheHit) { + return cacheHit; + } else { + return ch[hash] = fn.call(eles, arg1, arg2, arg3, arg4); + } + } else { + return fn.call(eles, arg1, arg2, arg3, arg4); + } + }; +}; + +var elesfn$f = { + parent: function parent(selector) { + var parents = []; // optimisation for single ele call + + if (this.length === 1) { + var parent = this[0]._private.parent; + + if (parent) { + return parent; + } + } + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var _parent = ele._private.parent; + + if (_parent) { + parents.push(_parent); + } + } + + return this.spawn(parents, true).filter(selector); + }, + parents: function parents(selector) { + var parents = []; + var eles = this.parent(); + + while (eles.nonempty()) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + parents.push(ele); + } + + eles = eles.parent(); + } + + return this.spawn(parents, true).filter(selector); + }, + commonAncestors: function commonAncestors(selector) { + var ancestors; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var parents = ele.parents(); + ancestors = ancestors || parents; + ancestors = ancestors.intersect(parents); // current list must be common with current ele parents set + } + + return ancestors.filter(selector); + }, + orphans: function orphans(selector) { + return this.stdFilter(function (ele) { + return ele.isOrphan(); + }).filter(selector); + }, + nonorphans: function nonorphans(selector) { + return this.stdFilter(function (ele) { + return ele.isChild(); + }).filter(selector); + }, + children: cache(function (selector) { + var children = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var eleChildren = ele._private.children; + + for (var j = 0; j < eleChildren.length; j++) { + children.push(eleChildren[j]); + } + } + + return this.spawn(children, true).filter(selector); + }, 'children'), + siblings: function siblings(selector) { + return this.parent().children().not(this).filter(selector); + }, + isParent: function isParent() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.children.length !== 0; + } + }, + isChildless: function isChildless() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.children.length === 0; + } + }, + isChild: function isChild() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.parent != null; + } + }, + isOrphan: function isOrphan() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.parent == null; + } + }, + descendants: function descendants(selector) { + var elements = []; + + function add(eles) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + elements.push(ele); + + if (ele.children().nonempty()) { + add(ele.children()); + } + } + } + + add(this.children()); + return this.spawn(elements, true).filter(selector); + } +}; + +function forEachCompound(eles, fn, includeSelf, recursiveStep) { + var q = []; + var did = new Set$1(); + var cy = eles.cy(); + var hasCompounds = cy.hasCompoundNodes(); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (includeSelf) { + q.push(ele); + } else if (hasCompounds) { + recursiveStep(q, did, ele); + } + } + + while (q.length > 0) { + var _ele = q.shift(); + + fn(_ele); + did.add(_ele.id()); + + if (hasCompounds) { + recursiveStep(q, did, _ele); + } + } + + return eles; +} + +function addChildren(q, did, ele) { + if (ele.isParent()) { + var children = ele._private.children; + + for (var i = 0; i < children.length; i++) { + var child = children[i]; + + if (!did.has(child.id())) { + q.push(child); + } + } + } +} // very efficient version of eles.add( eles.descendants() ).forEach() +// for internal use + + +elesfn$f.forEachDown = function (fn) { + var includeSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return forEachCompound(this, fn, includeSelf, addChildren); +}; + +function addParent(q, did, ele) { + if (ele.isChild()) { + var parent = ele._private.parent; + + if (!did.has(parent.id())) { + q.push(parent); + } + } +} + +elesfn$f.forEachUp = function (fn) { + var includeSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return forEachCompound(this, fn, includeSelf, addParent); +}; + +function addParentAndChildren(q, did, ele) { + addParent(q, did, ele); + addChildren(q, did, ele); +} + +elesfn$f.forEachUpAndDown = function (fn) { + var includeSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return forEachCompound(this, fn, includeSelf, addParentAndChildren); +}; // aliases + + +elesfn$f.ancestors = elesfn$f.parents; + +var fn$5, elesfn$e; +fn$5 = elesfn$e = { + data: define.data({ + field: 'data', + bindingEvent: 'data', + allowBinding: true, + allowSetting: true, + settingEvent: 'data', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + immutableKeys: { + 'id': true, + 'source': true, + 'target': true, + 'parent': true + }, + updateStyle: true + }), + removeData: define.removeData({ + field: 'data', + event: 'data', + triggerFnName: 'trigger', + triggerEvent: true, + immutableKeys: { + 'id': true, + 'source': true, + 'target': true, + 'parent': true + }, + updateStyle: true + }), + scratch: define.data({ + field: 'scratch', + bindingEvent: 'scratch', + allowBinding: true, + allowSetting: true, + settingEvent: 'scratch', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + updateStyle: true + }), + removeScratch: define.removeData({ + field: 'scratch', + event: 'scratch', + triggerFnName: 'trigger', + triggerEvent: true, + updateStyle: true + }), + rscratch: define.data({ + field: 'rscratch', + allowBinding: false, + allowSetting: true, + settingTriggersEvent: false, + allowGetting: true + }), + removeRscratch: define.removeData({ + field: 'rscratch', + triggerEvent: false + }), + id: function id() { + var ele = this[0]; + + if (ele) { + return ele._private.data.id; + } + } +}; // aliases + +fn$5.attr = fn$5.data; +fn$5.removeAttr = fn$5.removeData; +var data = elesfn$e; + +var elesfn$d = {}; + +function defineDegreeFunction(callback) { + return function (includeLoops) { + var self = this; + + if (includeLoops === undefined) { + includeLoops = true; + } + + if (self.length === 0) { + return; + } + + if (self.isNode() && !self.removed()) { + var degree = 0; + var node = self[0]; + var connectedEdges = node._private.edges; + + for (var i = 0; i < connectedEdges.length; i++) { + var edge = connectedEdges[i]; + + if (!includeLoops && edge.isLoop()) { + continue; + } + + degree += callback(node, edge); + } + + return degree; + } else { + return; + } + }; +} + +extend(elesfn$d, { + degree: defineDegreeFunction(function (node, edge) { + if (edge.source().same(edge.target())) { + return 2; + } else { + return 1; + } + }), + indegree: defineDegreeFunction(function (node, edge) { + if (edge.target().same(node)) { + return 1; + } else { + return 0; + } + }), + outdegree: defineDegreeFunction(function (node, edge) { + if (edge.source().same(node)) { + return 1; + } else { + return 0; + } + }) +}); + +function defineDegreeBoundsFunction(degreeFn, callback) { + return function (includeLoops) { + var ret; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + var ele = nodes[i]; + var degree = ele[degreeFn](includeLoops); + + if (degree !== undefined && (ret === undefined || callback(degree, ret))) { + ret = degree; + } + } + + return ret; + }; +} + +extend(elesfn$d, { + minDegree: defineDegreeBoundsFunction('degree', function (degree, min) { + return degree < min; + }), + maxDegree: defineDegreeBoundsFunction('degree', function (degree, max) { + return degree > max; + }), + minIndegree: defineDegreeBoundsFunction('indegree', function (degree, min) { + return degree < min; + }), + maxIndegree: defineDegreeBoundsFunction('indegree', function (degree, max) { + return degree > max; + }), + minOutdegree: defineDegreeBoundsFunction('outdegree', function (degree, min) { + return degree < min; + }), + maxOutdegree: defineDegreeBoundsFunction('outdegree', function (degree, max) { + return degree > max; + }) +}); +extend(elesfn$d, { + totalDegree: function totalDegree(includeLoops) { + var total = 0; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + total += nodes[i].degree(includeLoops); + } + + return total; + } +}); + +var fn$4, elesfn$c; + +var beforePositionSet = function beforePositionSet(eles, newPos, silent) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.locked()) { + var oldPos = ele._private.position; + var delta = { + x: newPos.x != null ? newPos.x - oldPos.x : 0, + y: newPos.y != null ? newPos.y - oldPos.y : 0 + }; + + if (ele.isParent() && !(delta.x === 0 && delta.y === 0)) { + ele.children().shift(delta, silent); + } + + ele.dirtyBoundingBoxCache(); + } + } +}; + +var positionDef = { + field: 'position', + bindingEvent: 'position', + allowBinding: true, + allowSetting: true, + settingEvent: 'position', + settingTriggersEvent: true, + triggerFnName: 'emitAndNotify', + allowGetting: true, + validKeys: ['x', 'y'], + beforeGet: function beforeGet(ele) { + ele.updateCompoundBounds(); + }, + beforeSet: function beforeSet(eles, newPos) { + beforePositionSet(eles, newPos, false); + }, + onSet: function onSet(eles) { + eles.dirtyCompoundBoundsCache(); + }, + canSet: function canSet(ele) { + return !ele.locked(); + } +}; +fn$4 = elesfn$c = { + position: define.data(positionDef), + // position but no notification to renderer + silentPosition: define.data(extend({}, positionDef, { + allowBinding: false, + allowSetting: true, + settingTriggersEvent: false, + allowGetting: false, + beforeSet: function beforeSet(eles, newPos) { + beforePositionSet(eles, newPos, true); + }, + onSet: function onSet(eles) { + eles.dirtyCompoundBoundsCache(); + } + })), + positions: function positions(pos, silent) { + if (plainObject(pos)) { + if (silent) { + this.silentPosition(pos); + } else { + this.position(pos); + } + } else if (fn$6(pos)) { + var _fn = pos; + var cy = this.cy(); + cy.startBatch(); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + + var _pos = void 0; + + if (_pos = _fn(ele, i)) { + if (silent) { + ele.silentPosition(_pos); + } else { + ele.position(_pos); + } + } + } + + cy.endBatch(); + } + + return this; // chaining + }, + silentPositions: function silentPositions(pos) { + return this.positions(pos, true); + }, + shift: function shift(dim, val, silent) { + var delta; + + if (plainObject(dim)) { + delta = { + x: number$1(dim.x) ? dim.x : 0, + y: number$1(dim.y) ? dim.y : 0 + }; + silent = val; + } else if (string(dim) && number$1(val)) { + delta = { + x: 0, + y: 0 + }; + delta[dim] = val; + } + + if (delta != null) { + var cy = this.cy(); + cy.startBatch(); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; // exclude any node that is a descendant of the calling collection + + if (cy.hasCompoundNodes() && ele.isChild() && ele.ancestors().anySame(this)) { + continue; + } + + var pos = ele.position(); + var newPos = { + x: pos.x + delta.x, + y: pos.y + delta.y + }; + + if (silent) { + ele.silentPosition(newPos); + } else { + ele.position(newPos); + } + } + + cy.endBatch(); + } + + return this; + }, + silentShift: function silentShift(dim, val) { + if (plainObject(dim)) { + this.shift(dim, true); + } else if (string(dim) && number$1(val)) { + this.shift(dim, val, true); + } + + return this; + }, + // get/set the rendered (i.e. on screen) positon of the element + renderedPosition: function renderedPosition(dim, val) { + var ele = this[0]; + var cy = this.cy(); + var zoom = cy.zoom(); + var pan = cy.pan(); + var rpos = plainObject(dim) ? dim : undefined; + var setting = rpos !== undefined || val !== undefined && string(dim); + + if (ele && ele.isNode()) { + // must have an element and must be a node to return position + if (setting) { + for (var i = 0; i < this.length; i++) { + var _ele = this[i]; + + if (val !== undefined) { + // set one dimension + _ele.position(dim, (val - pan[dim]) / zoom); + } else if (rpos !== undefined) { + // set whole position + _ele.position(renderedToModelPosition(rpos, zoom, pan)); + } + } + } else { + // getting + var pos = ele.position(); + rpos = modelToRenderedPosition(pos, zoom, pan); + + if (dim === undefined) { + // then return the whole rendered position + return rpos; + } else { + // then return the specified dimension + return rpos[dim]; + } + } + } else if (!setting) { + return undefined; // for empty collection case + } + + return this; // chaining + }, + // get/set the position relative to the parent + relativePosition: function relativePosition(dim, val) { + var ele = this[0]; + var cy = this.cy(); + var ppos = plainObject(dim) ? dim : undefined; + var setting = ppos !== undefined || val !== undefined && string(dim); + var hasCompoundNodes = cy.hasCompoundNodes(); + + if (ele && ele.isNode()) { + // must have an element and must be a node to return position + if (setting) { + for (var i = 0; i < this.length; i++) { + var _ele2 = this[i]; + var parent = hasCompoundNodes ? _ele2.parent() : null; + var hasParent = parent && parent.length > 0; + var relativeToParent = hasParent; + + if (hasParent) { + parent = parent[0]; + } + + var origin = relativeToParent ? parent.position() : { + x: 0, + y: 0 + }; + + if (val !== undefined) { + // set one dimension + _ele2.position(dim, val + origin[dim]); + } else if (ppos !== undefined) { + // set whole position + _ele2.position({ + x: ppos.x + origin.x, + y: ppos.y + origin.y + }); + } + } + } else { + // getting + var pos = ele.position(); + + var _parent = hasCompoundNodes ? ele.parent() : null; + + var _hasParent = _parent && _parent.length > 0; + + var _relativeToParent = _hasParent; + + if (_hasParent) { + _parent = _parent[0]; + } + + var _origin = _relativeToParent ? _parent.position() : { + x: 0, + y: 0 + }; + + ppos = { + x: pos.x - _origin.x, + y: pos.y - _origin.y + }; + + if (dim === undefined) { + // then return the whole rendered position + return ppos; + } else { + // then return the specified dimension + return ppos[dim]; + } + } + } else if (!setting) { + return undefined; // for empty collection case + } + + return this; // chaining + } +}; // aliases + +fn$4.modelPosition = fn$4.point = fn$4.position; +fn$4.modelPositions = fn$4.points = fn$4.positions; +fn$4.renderedPoint = fn$4.renderedPosition; +fn$4.relativePoint = fn$4.relativePosition; +var position = elesfn$c; + +var fn$3, elesfn$b; +fn$3 = elesfn$b = {}; + +elesfn$b.renderedBoundingBox = function (options) { + var bb = this.boundingBox(options); + var cy = this.cy(); + var zoom = cy.zoom(); + var pan = cy.pan(); + var x1 = bb.x1 * zoom + pan.x; + var x2 = bb.x2 * zoom + pan.x; + var y1 = bb.y1 * zoom + pan.y; + var y2 = bb.y2 * zoom + pan.y; + return { + x1: x1, + x2: x2, + y1: y1, + y2: y2, + w: x2 - x1, + h: y2 - y1 + }; +}; + +elesfn$b.dirtyCompoundBoundsCache = function () { + var silent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var cy = this.cy(); + + if (!cy.styleEnabled() || !cy.hasCompoundNodes()) { + return this; + } + + this.forEachUp(function (ele) { + if (ele.isParent()) { + var _p = ele._private; + _p.compoundBoundsClean = false; + _p.bbCache = null; + + if (!silent) { + ele.emitAndNotify('bounds'); + } + } + }); + return this; +}; + +elesfn$b.updateCompoundBounds = function () { + var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var cy = this.cy(); // not possible to do on non-compound graphs or with the style disabled + + if (!cy.styleEnabled() || !cy.hasCompoundNodes()) { + return this; + } // save cycles when batching -- but bounds will be stale (or not exist yet) + + + if (!force && cy.batching()) { + return this; + } + + function update(parent) { + if (!parent.isParent()) { + return; + } + + var _p = parent._private; + var children = parent.children(); + var includeLabels = parent.pstyle('compound-sizing-wrt-labels').value === 'include'; + var min = { + width: { + val: parent.pstyle('min-width').pfValue, + left: parent.pstyle('min-width-bias-left'), + right: parent.pstyle('min-width-bias-right') + }, + height: { + val: parent.pstyle('min-height').pfValue, + top: parent.pstyle('min-height-bias-top'), + bottom: parent.pstyle('min-height-bias-bottom') + } + }; + var bb = children.boundingBox({ + includeLabels: includeLabels, + includeOverlays: false, + // updating the compound bounds happens outside of the regular + // cache cycle (i.e. before fired events) + useCache: false + }); + var pos = _p.position; // if children take up zero area then keep position and fall back on stylesheet w/h + + if (bb.w === 0 || bb.h === 0) { + bb = { + w: parent.pstyle('width').pfValue, + h: parent.pstyle('height').pfValue + }; + bb.x1 = pos.x - bb.w / 2; + bb.x2 = pos.x + bb.w / 2; + bb.y1 = pos.y - bb.h / 2; + bb.y2 = pos.y + bb.h / 2; + } + + function computeBiasValues(propDiff, propBias, propBiasComplement) { + var biasDiff = 0; + var biasComplementDiff = 0; + var biasTotal = propBias + propBiasComplement; + + if (propDiff > 0 && biasTotal > 0) { + biasDiff = propBias / biasTotal * propDiff; + biasComplementDiff = propBiasComplement / biasTotal * propDiff; + } + + return { + biasDiff: biasDiff, + biasComplementDiff: biasComplementDiff + }; + } + + function computePaddingValues(width, height, paddingObject, relativeTo) { + // Assuming percentage is number from 0 to 1 + if (paddingObject.units === '%') { + switch (relativeTo) { + case 'width': + return width > 0 ? paddingObject.pfValue * width : 0; + + case 'height': + return height > 0 ? paddingObject.pfValue * height : 0; + + case 'average': + return width > 0 && height > 0 ? paddingObject.pfValue * (width + height) / 2 : 0; + + case 'min': + return width > 0 && height > 0 ? width > height ? paddingObject.pfValue * height : paddingObject.pfValue * width : 0; + + case 'max': + return width > 0 && height > 0 ? width > height ? paddingObject.pfValue * width : paddingObject.pfValue * height : 0; + + default: + return 0; + } + } else if (paddingObject.units === 'px') { + return paddingObject.pfValue; + } else { + return 0; + } + } + + var leftVal = min.width.left.value; + + if (min.width.left.units === 'px' && min.width.val > 0) { + leftVal = leftVal * 100 / min.width.val; + } + + var rightVal = min.width.right.value; + + if (min.width.right.units === 'px' && min.width.val > 0) { + rightVal = rightVal * 100 / min.width.val; + } + + var topVal = min.height.top.value; + + if (min.height.top.units === 'px' && min.height.val > 0) { + topVal = topVal * 100 / min.height.val; + } + + var bottomVal = min.height.bottom.value; + + if (min.height.bottom.units === 'px' && min.height.val > 0) { + bottomVal = bottomVal * 100 / min.height.val; + } + + var widthBiasDiffs = computeBiasValues(min.width.val - bb.w, leftVal, rightVal); + var diffLeft = widthBiasDiffs.biasDiff; + var diffRight = widthBiasDiffs.biasComplementDiff; + var heightBiasDiffs = computeBiasValues(min.height.val - bb.h, topVal, bottomVal); + var diffTop = heightBiasDiffs.biasDiff; + var diffBottom = heightBiasDiffs.biasComplementDiff; + _p.autoPadding = computePaddingValues(bb.w, bb.h, parent.pstyle('padding'), parent.pstyle('padding-relative-to').value); + _p.autoWidth = Math.max(bb.w, min.width.val); + pos.x = (-diffLeft + bb.x1 + bb.x2 + diffRight) / 2; + _p.autoHeight = Math.max(bb.h, min.height.val); + pos.y = (-diffTop + bb.y1 + bb.y2 + diffBottom) / 2; + } + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var _p = ele._private; + + if (!_p.compoundBoundsClean || force) { + update(ele); + + if (!cy.batching()) { + _p.compoundBoundsClean = true; + } + } + } + + return this; +}; + +var noninf = function noninf(x) { + if (x === Infinity || x === -Infinity) { + return 0; + } + + return x; +}; + +var updateBounds = function updateBounds(b, x1, y1, x2, y2) { + // don't update with zero area boxes + if (x2 - x1 === 0 || y2 - y1 === 0) { + return; + } // don't update with null dim + + + if (x1 == null || y1 == null || x2 == null || y2 == null) { + return; + } + + b.x1 = x1 < b.x1 ? x1 : b.x1; + b.x2 = x2 > b.x2 ? x2 : b.x2; + b.y1 = y1 < b.y1 ? y1 : b.y1; + b.y2 = y2 > b.y2 ? y2 : b.y2; + b.w = b.x2 - b.x1; + b.h = b.y2 - b.y1; +}; + +var updateBoundsFromBox = function updateBoundsFromBox(b, b2) { + if (b2 == null) { + return b; + } + + return updateBounds(b, b2.x1, b2.y1, b2.x2, b2.y2); +}; + +var prefixedProperty = function prefixedProperty(obj, field, prefix) { + return getPrefixedProperty(obj, field, prefix); +}; + +var updateBoundsFromArrow = function updateBoundsFromArrow(bounds, ele, prefix) { + if (ele.cy().headless()) { + return; + } + + var _p = ele._private; + var rstyle = _p.rstyle; + var halfArW = rstyle.arrowWidth / 2; + var arrowType = ele.pstyle(prefix + '-arrow-shape').value; + var x; + var y; + + if (arrowType !== 'none') { + if (prefix === 'source') { + x = rstyle.srcX; + y = rstyle.srcY; + } else if (prefix === 'target') { + x = rstyle.tgtX; + y = rstyle.tgtY; + } else { + x = rstyle.midX; + y = rstyle.midY; + } // always store the individual arrow bounds + + + var bbs = _p.arrowBounds = _p.arrowBounds || {}; + var bb = bbs[prefix] = bbs[prefix] || {}; + bb.x1 = x - halfArW; + bb.y1 = y - halfArW; + bb.x2 = x + halfArW; + bb.y2 = y + halfArW; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + expandBoundingBox(bb, 1); + updateBounds(bounds, bb.x1, bb.y1, bb.x2, bb.y2); + } +}; + +var updateBoundsFromLabel = function updateBoundsFromLabel(bounds, ele, prefix) { + if (ele.cy().headless()) { + return; + } + + var prefixDash; + + if (prefix) { + prefixDash = prefix + '-'; + } else { + prefixDash = ''; + } + + var _p = ele._private; + var rstyle = _p.rstyle; + var label = ele.pstyle(prefixDash + 'label').strValue; + + if (label) { + var halign = ele.pstyle('text-halign'); + var valign = ele.pstyle('text-valign'); + var labelWidth = prefixedProperty(rstyle, 'labelWidth', prefix); + var labelHeight = prefixedProperty(rstyle, 'labelHeight', prefix); + var labelX = prefixedProperty(rstyle, 'labelX', prefix); + var labelY = prefixedProperty(rstyle, 'labelY', prefix); + var marginX = ele.pstyle(prefixDash + 'text-margin-x').pfValue; + var marginY = ele.pstyle(prefixDash + 'text-margin-y').pfValue; + var isEdge = ele.isEdge(); + var rotation = ele.pstyle(prefixDash + 'text-rotation'); + var outlineWidth = ele.pstyle('text-outline-width').pfValue; + var borderWidth = ele.pstyle('text-border-width').pfValue; + var halfBorderWidth = borderWidth / 2; + var padding = ele.pstyle('text-background-padding').pfValue; + var marginOfError = 2; // expand to work around browser dimension inaccuracies + + var lh = labelHeight; + var lw = labelWidth; + var lw_2 = lw / 2; + var lh_2 = lh / 2; + var lx1, lx2, ly1, ly2; + + if (isEdge) { + lx1 = labelX - lw_2; + lx2 = labelX + lw_2; + ly1 = labelY - lh_2; + ly2 = labelY + lh_2; + } else { + switch (halign.value) { + case 'left': + lx1 = labelX - lw; + lx2 = labelX; + break; + + case 'center': + lx1 = labelX - lw_2; + lx2 = labelX + lw_2; + break; + + case 'right': + lx1 = labelX; + lx2 = labelX + lw; + break; + } + + switch (valign.value) { + case 'top': + ly1 = labelY - lh; + ly2 = labelY; + break; + + case 'center': + ly1 = labelY - lh_2; + ly2 = labelY + lh_2; + break; + + case 'bottom': + ly1 = labelY; + ly2 = labelY + lh; + break; + } + } // shift by margin and expand by outline and border + + + lx1 += marginX - Math.max(outlineWidth, halfBorderWidth) - padding - marginOfError; + lx2 += marginX + Math.max(outlineWidth, halfBorderWidth) + padding + marginOfError; + ly1 += marginY - Math.max(outlineWidth, halfBorderWidth) - padding - marginOfError; + ly2 += marginY + Math.max(outlineWidth, halfBorderWidth) + padding + marginOfError; // always store the unrotated label bounds separately + + var bbPrefix = prefix || 'main'; + var bbs = _p.labelBounds; + var bb = bbs[bbPrefix] = bbs[bbPrefix] || {}; + bb.x1 = lx1; + bb.y1 = ly1; + bb.x2 = lx2; + bb.y2 = ly2; + bb.w = lx2 - lx1; + bb.h = ly2 - ly1; + var isAutorotate = isEdge && rotation.strValue === 'autorotate'; + var isPfValue = rotation.pfValue != null && rotation.pfValue !== 0; + + if (isAutorotate || isPfValue) { + var theta = isAutorotate ? prefixedProperty(_p.rstyle, 'labelAngle', prefix) : rotation.pfValue; + var cos = Math.cos(theta); + var sin = Math.sin(theta); // rotation point (default value for center-center) + + var xo = (lx1 + lx2) / 2; + var yo = (ly1 + ly2) / 2; + + if (!isEdge) { + switch (halign.value) { + case 'left': + xo = lx2; + break; + + case 'right': + xo = lx1; + break; + } + + switch (valign.value) { + case 'top': + yo = ly2; + break; + + case 'bottom': + yo = ly1; + break; + } + } + + var rotate = function rotate(x, y) { + x = x - xo; + y = y - yo; + return { + x: x * cos - y * sin + xo, + y: x * sin + y * cos + yo + }; + }; + + var px1y1 = rotate(lx1, ly1); + var px1y2 = rotate(lx1, ly2); + var px2y1 = rotate(lx2, ly1); + var px2y2 = rotate(lx2, ly2); + lx1 = Math.min(px1y1.x, px1y2.x, px2y1.x, px2y2.x); + lx2 = Math.max(px1y1.x, px1y2.x, px2y1.x, px2y2.x); + ly1 = Math.min(px1y1.y, px1y2.y, px2y1.y, px2y2.y); + ly2 = Math.max(px1y1.y, px1y2.y, px2y1.y, px2y2.y); + } + + var bbPrefixRot = bbPrefix + 'Rot'; + var bbRot = bbs[bbPrefixRot] = bbs[bbPrefixRot] || {}; + bbRot.x1 = lx1; + bbRot.y1 = ly1; + bbRot.x2 = lx2; + bbRot.y2 = ly2; + bbRot.w = lx2 - lx1; + bbRot.h = ly2 - ly1; + updateBounds(bounds, lx1, ly1, lx2, ly2); + updateBounds(_p.labelBounds.all, lx1, ly1, lx2, ly2); + } + + return bounds; +}; // get the bounding box of the elements (in raw model position) + + +var boundingBoxImpl = function boundingBoxImpl(ele, options) { + var cy = ele._private.cy; + var styleEnabled = cy.styleEnabled(); + var headless = cy.headless(); + var bounds = makeBoundingBox(); + var _p = ele._private; + var isNode = ele.isNode(); + var isEdge = ele.isEdge(); + var ex1, ex2, ey1, ey2; // extrema of body / lines + + var x, y; // node pos + + var rstyle = _p.rstyle; + var manualExpansion = isNode && styleEnabled ? ele.pstyle('bounds-expansion').pfValue : [0]; // must use `display` prop only, as reading `compound.width()` causes recursion + // (other factors like width values will be considered later in this function anyway) + + var isDisplayed = function isDisplayed(ele) { + return ele.pstyle('display').value !== 'none'; + }; + + var displayed = !styleEnabled || isDisplayed(ele) // must take into account connected nodes b/c of implicit edge hiding on display:none node + && (!isEdge || isDisplayed(ele.source()) && isDisplayed(ele.target())); + + if (displayed) { + // displayed suffices, since we will find zero area eles anyway + var overlayOpacity = 0; + var overlayPadding = 0; + + if (styleEnabled && options.includeOverlays) { + overlayOpacity = ele.pstyle('overlay-opacity').value; + + if (overlayOpacity !== 0) { + overlayPadding = ele.pstyle('overlay-padding').value; + } + } + + var underlayOpacity = 0; + var underlayPadding = 0; + + if (styleEnabled && options.includeUnderlays) { + underlayOpacity = ele.pstyle('underlay-opacity').value; + + if (underlayOpacity !== 0) { + underlayPadding = ele.pstyle('underlay-padding').value; + } + } + + var padding = Math.max(overlayPadding, underlayPadding); + var w = 0; + var wHalf = 0; + + if (styleEnabled) { + w = ele.pstyle('width').pfValue; + wHalf = w / 2; + } + + if (isNode && options.includeNodes) { + var pos = ele.position(); + x = pos.x; + y = pos.y; + + var _w = ele.outerWidth(); + + var halfW = _w / 2; + var h = ele.outerHeight(); + var halfH = h / 2; // handle node dimensions + ///////////////////////// + + ex1 = x - halfW; + ex2 = x + halfW; + ey1 = y - halfH; + ey2 = y + halfH; + updateBounds(bounds, ex1, ey1, ex2, ey2); + } else if (isEdge && options.includeEdges) { + if (styleEnabled && !headless) { + var curveStyle = ele.pstyle('curve-style').strValue; // handle edge dimensions (rough box estimate) + ////////////////////////////////////////////// + + ex1 = Math.min(rstyle.srcX, rstyle.midX, rstyle.tgtX); + ex2 = Math.max(rstyle.srcX, rstyle.midX, rstyle.tgtX); + ey1 = Math.min(rstyle.srcY, rstyle.midY, rstyle.tgtY); + ey2 = Math.max(rstyle.srcY, rstyle.midY, rstyle.tgtY); // take into account edge width + + ex1 -= wHalf; + ex2 += wHalf; + ey1 -= wHalf; + ey2 += wHalf; + updateBounds(bounds, ex1, ey1, ex2, ey2); // precise edges + //////////////// + + if (curveStyle === 'haystack') { + var hpts = rstyle.haystackPts; + + if (hpts && hpts.length === 2) { + ex1 = hpts[0].x; + ey1 = hpts[0].y; + ex2 = hpts[1].x; + ey2 = hpts[1].y; + + if (ex1 > ex2) { + var temp = ex1; + ex1 = ex2; + ex2 = temp; + } + + if (ey1 > ey2) { + var _temp = ey1; + ey1 = ey2; + ey2 = _temp; + } + + updateBounds(bounds, ex1 - wHalf, ey1 - wHalf, ex2 + wHalf, ey2 + wHalf); + } + } else if (curveStyle === 'bezier' || curveStyle === 'unbundled-bezier' || curveStyle === 'segments' || curveStyle === 'taxi') { + var pts; + + switch (curveStyle) { + case 'bezier': + case 'unbundled-bezier': + pts = rstyle.bezierPts; + break; + + case 'segments': + case 'taxi': + pts = rstyle.linePts; + break; + } + + if (pts != null) { + for (var j = 0; j < pts.length; j++) { + var pt = pts[j]; + ex1 = pt.x - wHalf; + ex2 = pt.x + wHalf; + ey1 = pt.y - wHalf; + ey2 = pt.y + wHalf; + updateBounds(bounds, ex1, ey1, ex2, ey2); + } + } + } // bezier-like or segment-like edge + + } else { + // headless or style disabled + // fallback on source and target positions + ////////////////////////////////////////// + var n1 = ele.source(); + var n1pos = n1.position(); + var n2 = ele.target(); + var n2pos = n2.position(); + ex1 = n1pos.x; + ex2 = n2pos.x; + ey1 = n1pos.y; + ey2 = n2pos.y; + + if (ex1 > ex2) { + var _temp2 = ex1; + ex1 = ex2; + ex2 = _temp2; + } + + if (ey1 > ey2) { + var _temp3 = ey1; + ey1 = ey2; + ey2 = _temp3; + } // take into account edge width + + + ex1 -= wHalf; + ex2 += wHalf; + ey1 -= wHalf; + ey2 += wHalf; + updateBounds(bounds, ex1, ey1, ex2, ey2); + } // headless or style disabled + + } // edges + // handle edge arrow size + ///////////////////////// + + + if (styleEnabled && options.includeEdges && isEdge) { + updateBoundsFromArrow(bounds, ele, 'mid-source'); + updateBoundsFromArrow(bounds, ele, 'mid-target'); + updateBoundsFromArrow(bounds, ele, 'source'); + updateBoundsFromArrow(bounds, ele, 'target'); + } // ghost + //////// + + + if (styleEnabled) { + var ghost = ele.pstyle('ghost').value === 'yes'; + + if (ghost) { + var gx = ele.pstyle('ghost-offset-x').pfValue; + var gy = ele.pstyle('ghost-offset-y').pfValue; + updateBounds(bounds, bounds.x1 + gx, bounds.y1 + gy, bounds.x2 + gx, bounds.y2 + gy); + } + } // always store the body bounds separately from the labels + + + var bbBody = _p.bodyBounds = _p.bodyBounds || {}; + assignBoundingBox(bbBody, bounds); + expandBoundingBoxSides(bbBody, manualExpansion); + expandBoundingBox(bbBody, 1); // expand to work around browser dimension inaccuracies + // overlay + ////////// + + if (styleEnabled) { + ex1 = bounds.x1; + ex2 = bounds.x2; + ey1 = bounds.y1; + ey2 = bounds.y2; + updateBounds(bounds, ex1 - padding, ey1 - padding, ex2 + padding, ey2 + padding); + } // always store the body bounds separately from the labels + + + var bbOverlay = _p.overlayBounds = _p.overlayBounds || {}; + assignBoundingBox(bbOverlay, bounds); + expandBoundingBoxSides(bbOverlay, manualExpansion); + expandBoundingBox(bbOverlay, 1); // expand to work around browser dimension inaccuracies + // handle label dimensions + ////////////////////////// + + var bbLabels = _p.labelBounds = _p.labelBounds || {}; + + if (bbLabels.all != null) { + clearBoundingBox(bbLabels.all); + } else { + bbLabels.all = makeBoundingBox(); + } + + if (styleEnabled && options.includeLabels) { + if (options.includeMainLabels) { + updateBoundsFromLabel(bounds, ele, null); + } + + if (isEdge) { + if (options.includeSourceLabels) { + updateBoundsFromLabel(bounds, ele, 'source'); + } + + if (options.includeTargetLabels) { + updateBoundsFromLabel(bounds, ele, 'target'); + } + } + } // style enabled for labels + + } // if displayed + + + bounds.x1 = noninf(bounds.x1); + bounds.y1 = noninf(bounds.y1); + bounds.x2 = noninf(bounds.x2); + bounds.y2 = noninf(bounds.y2); + bounds.w = noninf(bounds.x2 - bounds.x1); + bounds.h = noninf(bounds.y2 - bounds.y1); + + if (bounds.w > 0 && bounds.h > 0 && displayed) { + expandBoundingBoxSides(bounds, manualExpansion); // expand bounds by 1 because antialiasing can increase the visual/effective size by 1 on all sides + + expandBoundingBox(bounds, 1); + } + + return bounds; +}; + +var getKey = function getKey(opts) { + var i = 0; + + var tf = function tf(val) { + return (val ? 1 : 0) << i++; + }; + + var key = 0; + key += tf(opts.incudeNodes); + key += tf(opts.includeEdges); + key += tf(opts.includeLabels); + key += tf(opts.includeMainLabels); + key += tf(opts.includeSourceLabels); + key += tf(opts.includeTargetLabels); + key += tf(opts.includeOverlays); + return key; +}; + +var getBoundingBoxPosKey = function getBoundingBoxPosKey(ele) { + if (ele.isEdge()) { + var p1 = ele.source().position(); + var p2 = ele.target().position(); + + var r = function r(x) { + return Math.round(x); + }; + + return hashIntsArray([r(p1.x), r(p1.y), r(p2.x), r(p2.y)]); + } else { + return 0; + } +}; + +var cachedBoundingBoxImpl = function cachedBoundingBoxImpl(ele, opts) { + var _p = ele._private; + var bb; + var isEdge = ele.isEdge(); + var key = opts == null ? defBbOptsKey : getKey(opts); + var usingDefOpts = key === defBbOptsKey; + var currPosKey = getBoundingBoxPosKey(ele); + var isPosKeySame = _p.bbCachePosKey === currPosKey; + var useCache = opts.useCache && isPosKeySame; + + var isDirty = function isDirty(ele) { + return ele._private.bbCache == null || ele._private.styleDirty; + }; + + var needRecalc = !useCache || isDirty(ele) || isEdge && isDirty(ele.source()) || isDirty(ele.target()); + + if (needRecalc) { + if (!isPosKeySame) { + ele.recalculateRenderedStyle(useCache); + } + + bb = boundingBoxImpl(ele, defBbOpts); + _p.bbCache = bb; + _p.bbCachePosKey = currPosKey; + } else { + bb = _p.bbCache; + } // not using def opts => need to build up bb from combination of sub bbs + + + if (!usingDefOpts) { + var isNode = ele.isNode(); + bb = makeBoundingBox(); + + if (opts.includeNodes && isNode || opts.includeEdges && !isNode) { + if (opts.includeOverlays) { + updateBoundsFromBox(bb, _p.overlayBounds); + } else { + updateBoundsFromBox(bb, _p.bodyBounds); + } + } + + if (opts.includeLabels) { + if (opts.includeMainLabels && (!isEdge || opts.includeSourceLabels && opts.includeTargetLabels)) { + updateBoundsFromBox(bb, _p.labelBounds.all); + } else { + if (opts.includeMainLabels) { + updateBoundsFromBox(bb, _p.labelBounds.mainRot); + } + + if (opts.includeSourceLabels) { + updateBoundsFromBox(bb, _p.labelBounds.sourceRot); + } + + if (opts.includeTargetLabels) { + updateBoundsFromBox(bb, _p.labelBounds.targetRot); + } + } + } + + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + } + + return bb; +}; + +var defBbOpts = { + includeNodes: true, + includeEdges: true, + includeLabels: true, + includeMainLabels: true, + includeSourceLabels: true, + includeTargetLabels: true, + includeOverlays: true, + includeUnderlays: true, + useCache: true +}; +var defBbOptsKey = getKey(defBbOpts); +var filledBbOpts = defaults$g(defBbOpts); + +elesfn$b.boundingBox = function (options) { + var bounds; // the main usecase is ele.boundingBox() for a single element with no/def options + // specified s.t. the cache is used, so check for this case to make it faster by + // avoiding the overhead of the rest of the function + + if (this.length === 1 && this[0]._private.bbCache != null && !this[0]._private.styleDirty && (options === undefined || options.useCache === undefined || options.useCache === true)) { + if (options === undefined) { + options = defBbOpts; + } else { + options = filledBbOpts(options); + } + + bounds = cachedBoundingBoxImpl(this[0], options); + } else { + bounds = makeBoundingBox(); + options = options || defBbOpts; + var opts = filledBbOpts(options); + var eles = this; + var cy = eles.cy(); + var styleEnabled = cy.styleEnabled(); + + if (styleEnabled) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _p = ele._private; + var currPosKey = getBoundingBoxPosKey(ele); + var isPosKeySame = _p.bbCachePosKey === currPosKey; + var useCache = opts.useCache && isPosKeySame && !_p.styleDirty; + ele.recalculateRenderedStyle(useCache); + } + } + + this.updateCompoundBounds(!options.useCache); + + for (var _i = 0; _i < eles.length; _i++) { + var _ele = eles[_i]; + updateBoundsFromBox(bounds, cachedBoundingBoxImpl(_ele, opts)); + } + } + + bounds.x1 = noninf(bounds.x1); + bounds.y1 = noninf(bounds.y1); + bounds.x2 = noninf(bounds.x2); + bounds.y2 = noninf(bounds.y2); + bounds.w = noninf(bounds.x2 - bounds.x1); + bounds.h = noninf(bounds.y2 - bounds.y1); + return bounds; +}; + +elesfn$b.dirtyBoundingBoxCache = function () { + for (var i = 0; i < this.length; i++) { + var _p = this[i]._private; + _p.bbCache = null; + _p.bbCachePosKey = null; + _p.bodyBounds = null; + _p.overlayBounds = null; + _p.labelBounds.all = null; + _p.labelBounds.source = null; + _p.labelBounds.target = null; + _p.labelBounds.main = null; + _p.labelBounds.sourceRot = null; + _p.labelBounds.targetRot = null; + _p.labelBounds.mainRot = null; + _p.arrowBounds.source = null; + _p.arrowBounds.target = null; + _p.arrowBounds['mid-source'] = null; + _p.arrowBounds['mid-target'] = null; + } + + this.emitAndNotify('bounds'); + return this; +}; // private helper to get bounding box for custom node positions +// - good for perf in certain cases but currently requires dirtying the rendered style +// - would be better to not modify the nodes but the nodes are read directly everywhere in the renderer... +// - try to use for only things like discrete layouts where the node position would change anyway + + +elesfn$b.boundingBoxAt = function (fn) { + var nodes = this.nodes(); + var cy = this.cy(); + var hasCompoundNodes = cy.hasCompoundNodes(); + var parents = cy.collection(); + + if (hasCompoundNodes) { + parents = nodes.filter(function (node) { + return node.isParent(); + }); + nodes = nodes.not(parents); + } + + if (plainObject(fn)) { + var obj = fn; + + fn = function fn() { + return obj; + }; + } + + var storeOldPos = function storeOldPos(node, i) { + return node._private.bbAtOldPos = fn(node, i); + }; + + var getOldPos = function getOldPos(node) { + return node._private.bbAtOldPos; + }; + + cy.startBatch(); + nodes.forEach(storeOldPos).silentPositions(fn); + + if (hasCompoundNodes) { + parents.dirtyCompoundBoundsCache(); + parents.dirtyBoundingBoxCache(); + parents.updateCompoundBounds(true); // force update b/c we're inside a batch cycle + } + + var bb = copyBoundingBox(this.boundingBox({ + useCache: false + })); + nodes.silentPositions(getOldPos); + + if (hasCompoundNodes) { + parents.dirtyCompoundBoundsCache(); + parents.dirtyBoundingBoxCache(); + parents.updateCompoundBounds(true); // force update b/c we're inside a batch cycle + } + + cy.endBatch(); + return bb; +}; + +fn$3.boundingbox = fn$3.bb = fn$3.boundingBox; +fn$3.renderedBoundingbox = fn$3.renderedBoundingBox; +var bounds = elesfn$b; + +var fn$2, elesfn$a; +fn$2 = elesfn$a = {}; + +var defineDimFns = function defineDimFns(opts) { + opts.uppercaseName = capitalize(opts.name); + opts.autoName = 'auto' + opts.uppercaseName; + opts.labelName = 'label' + opts.uppercaseName; + opts.outerName = 'outer' + opts.uppercaseName; + opts.uppercaseOuterName = capitalize(opts.outerName); + + fn$2[opts.name] = function dimImpl() { + var ele = this[0]; + var _p = ele._private; + var cy = _p.cy; + var styleEnabled = cy._private.styleEnabled; + + if (ele) { + if (styleEnabled) { + if (ele.isParent()) { + ele.updateCompoundBounds(); + return _p[opts.autoName] || 0; + } + + var d = ele.pstyle(opts.name); + + switch (d.strValue) { + case 'label': + ele.recalculateRenderedStyle(); + return _p.rstyle[opts.labelName] || 0; + + default: + return d.pfValue; + } + } else { + return 1; + } + } + }; + + fn$2['outer' + opts.uppercaseName] = function outerDimImpl() { + var ele = this[0]; + var _p = ele._private; + var cy = _p.cy; + var styleEnabled = cy._private.styleEnabled; + + if (ele) { + if (styleEnabled) { + var dim = ele[opts.name](); + var border = ele.pstyle('border-width').pfValue; // n.b. 1/2 each side + + var padding = 2 * ele.padding(); + return dim + border + padding; + } else { + return 1; + } + } + }; + + fn$2['rendered' + opts.uppercaseName] = function renderedDimImpl() { + var ele = this[0]; + + if (ele) { + var d = ele[opts.name](); + return d * this.cy().zoom(); + } + }; + + fn$2['rendered' + opts.uppercaseOuterName] = function renderedOuterDimImpl() { + var ele = this[0]; + + if (ele) { + var od = ele[opts.outerName](); + return od * this.cy().zoom(); + } + }; +}; + +defineDimFns({ + name: 'width' +}); +defineDimFns({ + name: 'height' +}); + +elesfn$a.padding = function () { + var ele = this[0]; + var _p = ele._private; + + if (ele.isParent()) { + ele.updateCompoundBounds(); + + if (_p.autoPadding !== undefined) { + return _p.autoPadding; + } else { + return ele.pstyle('padding').pfValue; + } + } else { + return ele.pstyle('padding').pfValue; + } +}; + +elesfn$a.paddedHeight = function () { + var ele = this[0]; + return ele.height() + 2 * ele.padding(); +}; + +elesfn$a.paddedWidth = function () { + var ele = this[0]; + return ele.width() + 2 * ele.padding(); +}; + +var widthHeight = elesfn$a; + +var ifEdge = function ifEdge(ele, getValue) { + if (ele.isEdge()) { + return getValue(ele); + } +}; + +var ifEdgeRenderedPosition = function ifEdgeRenderedPosition(ele, getPoint) { + if (ele.isEdge()) { + var cy = ele.cy(); + return modelToRenderedPosition(getPoint(ele), cy.zoom(), cy.pan()); + } +}; + +var ifEdgeRenderedPositions = function ifEdgeRenderedPositions(ele, getPoints) { + if (ele.isEdge()) { + var cy = ele.cy(); + var pan = cy.pan(); + var zoom = cy.zoom(); + return getPoints(ele).map(function (p) { + return modelToRenderedPosition(p, zoom, pan); + }); + } +}; + +var controlPoints = function controlPoints(ele) { + return ele.renderer().getControlPoints(ele); +}; + +var segmentPoints = function segmentPoints(ele) { + return ele.renderer().getSegmentPoints(ele); +}; + +var sourceEndpoint = function sourceEndpoint(ele) { + return ele.renderer().getSourceEndpoint(ele); +}; + +var targetEndpoint = function targetEndpoint(ele) { + return ele.renderer().getTargetEndpoint(ele); +}; + +var midpoint = function midpoint(ele) { + return ele.renderer().getEdgeMidpoint(ele); +}; + +var pts = { + controlPoints: { + get: controlPoints, + mult: true + }, + segmentPoints: { + get: segmentPoints, + mult: true + }, + sourceEndpoint: { + get: sourceEndpoint + }, + targetEndpoint: { + get: targetEndpoint + }, + midpoint: { + get: midpoint + } +}; + +var renderedName = function renderedName(name) { + return 'rendered' + name[0].toUpperCase() + name.substr(1); +}; + +var edgePoints = Object.keys(pts).reduce(function (obj, name) { + var spec = pts[name]; + var rName = renderedName(name); + + obj[name] = function () { + return ifEdge(this, spec.get); + }; + + if (spec.mult) { + obj[rName] = function () { + return ifEdgeRenderedPositions(this, spec.get); + }; + } else { + obj[rName] = function () { + return ifEdgeRenderedPosition(this, spec.get); + }; + } + + return obj; +}, {}); + +var dimensions = extend({}, position, bounds, widthHeight, edgePoints); + +/*! +Event object based on jQuery events, MIT license + +https://jquery.org/license/ +https://tldrlegal.com/license/mit-license +https://github.com/jquery/jquery/blob/master/src/event.js +*/ +var Event = function Event(src, props) { + this.recycle(src, props); +}; + +function returnFalse() { + return false; +} + +function returnTrue() { + return true; +} // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html + + +Event.prototype = { + instanceString: function instanceString() { + return 'event'; + }, + recycle: function recycle(src, props) { + this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = returnFalse; + + if (src != null && src.preventDefault) { + // Browser Event object + this.type = src.type; // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + + this.isDefaultPrevented = src.defaultPrevented ? returnTrue : returnFalse; + } else if (src != null && src.type) { + // Plain object containing all event details + props = src; + } else { + // Event string + this.type = src; + } // Put explicitly provided properties onto the event object + + + if (props != null) { + // more efficient to manually copy fields we use + this.originalEvent = props.originalEvent; + this.type = props.type != null ? props.type : this.type; + this.cy = props.cy; + this.target = props.target; + this.position = props.position; + this.renderedPosition = props.renderedPosition; + this.namespace = props.namespace; + this.layout = props.layout; + } + + if (this.cy != null && this.position != null && this.renderedPosition == null) { + // create a rendered position based on the passed position + var pos = this.position; + var zoom = this.cy.zoom(); + var pan = this.cy.pan(); + this.renderedPosition = { + x: pos.x * zoom + pan.x, + y: pos.y * zoom + pan.y + }; + } // Create a timestamp if incoming event doesn't have one + + + this.timeStamp = src && src.timeStamp || Date.now(); + }, + preventDefault: function preventDefault() { + this.isDefaultPrevented = returnTrue; + var e = this.originalEvent; + + if (!e) { + return; + } // if preventDefault exists run it on the original event + + + if (e.preventDefault) { + e.preventDefault(); + } + }, + stopPropagation: function stopPropagation() { + this.isPropagationStopped = returnTrue; + var e = this.originalEvent; + + if (!e) { + return; + } // if stopPropagation exists run it on the original event + + + if (e.stopPropagation) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function stopImmediatePropagation() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +var eventRegex = /^([^.]+)(\.(?:[^.]+))?$/; // regex for matching event strings (e.g. "click.namespace") + +var universalNamespace = '.*'; // matches as if no namespace specified and prevents users from unbinding accidentally + +var defaults$8 = { + qualifierCompare: function qualifierCompare(q1, q2) { + return q1 === q2; + }, + eventMatches: function + /*context, listener, eventObj*/ + eventMatches() { + return true; + }, + addEventFields: function + /*context, evt*/ + addEventFields() {}, + callbackContext: function callbackContext(context + /*, listener, eventObj*/ + ) { + return context; + }, + beforeEmit: function + /* context, listener, eventObj */ + beforeEmit() {}, + afterEmit: function + /* context, listener, eventObj */ + afterEmit() {}, + bubble: function + /*context*/ + bubble() { + return false; + }, + parent: function + /*context*/ + parent() { + return null; + }, + context: null +}; +var defaultsKeys = Object.keys(defaults$8); +var emptyOpts = {}; + +function Emitter() { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : emptyOpts; + var context = arguments.length > 1 ? arguments[1] : undefined; + + // micro-optimisation vs Object.assign() -- reduces Element instantiation time + for (var i = 0; i < defaultsKeys.length; i++) { + var key = defaultsKeys[i]; + this[key] = opts[key] || defaults$8[key]; + } + + this.context = context || this.context; + this.listeners = []; + this.emitting = 0; +} + +var p = Emitter.prototype; + +var forEachEvent = function forEachEvent(self, handler, events, qualifier, callback, conf, confOverrides) { + if (fn$6(qualifier)) { + callback = qualifier; + qualifier = null; + } + + if (confOverrides) { + if (conf == null) { + conf = confOverrides; + } else { + conf = extend({}, conf, confOverrides); + } + } + + var eventList = array(events) ? events : events.split(/\s+/); + + for (var i = 0; i < eventList.length; i++) { + var evt = eventList[i]; + + if (emptyString(evt)) { + continue; + } + + var match = evt.match(eventRegex); // type[.namespace] + + if (match) { + var type = match[1]; + var namespace = match[2] ? match[2] : null; + var ret = handler(self, evt, type, namespace, qualifier, callback, conf); + + if (ret === false) { + break; + } // allow exiting early + + } + } +}; + +var makeEventObj = function makeEventObj(self, obj) { + self.addEventFields(self.context, obj); + return new Event(obj.type, obj); +}; + +var forEachEventObj = function forEachEventObj(self, handler, events) { + if (event(events)) { + handler(self, events); + return; + } else if (plainObject(events)) { + handler(self, makeEventObj(self, events)); + return; + } + + var eventList = array(events) ? events : events.split(/\s+/); + + for (var i = 0; i < eventList.length; i++) { + var evt = eventList[i]; + + if (emptyString(evt)) { + continue; + } + + var match = evt.match(eventRegex); // type[.namespace] + + if (match) { + var type = match[1]; + var namespace = match[2] ? match[2] : null; + var eventObj = makeEventObj(self, { + type: type, + namespace: namespace, + target: self.context + }); + handler(self, eventObj); + } + } +}; + +p.on = p.addListener = function (events, qualifier, callback, conf, confOverrides) { + forEachEvent(this, function (self, event, type, namespace, qualifier, callback, conf) { + if (fn$6(callback)) { + self.listeners.push({ + event: event, + // full event string + callback: callback, + // callback to run + type: type, + // the event type (e.g. 'click') + namespace: namespace, + // the event namespace (e.g. ".foo") + qualifier: qualifier, + // a restriction on whether to match this emitter + conf: conf // additional configuration + + }); + } + }, events, qualifier, callback, conf, confOverrides); + return this; +}; + +p.one = function (events, qualifier, callback, conf) { + return this.on(events, qualifier, callback, conf, { + one: true + }); +}; + +p.removeListener = p.off = function (events, qualifier, callback, conf) { + var _this = this; + + if (this.emitting !== 0) { + this.listeners = copyArray(this.listeners); + } + + var listeners = this.listeners; + + var _loop = function _loop(i) { + var listener = listeners[i]; + forEachEvent(_this, function (self, event, type, namespace, qualifier, callback + /*, conf*/ + ) { + if ((listener.type === type || events === '*') && (!namespace && listener.namespace !== '.*' || listener.namespace === namespace) && (!qualifier || self.qualifierCompare(listener.qualifier, qualifier)) && (!callback || listener.callback === callback)) { + listeners.splice(i, 1); + return false; + } + }, events, qualifier, callback, conf); + }; + + for (var i = listeners.length - 1; i >= 0; i--) { + _loop(i); + } + + return this; +}; + +p.removeAllListeners = function () { + return this.removeListener('*'); +}; + +p.emit = p.trigger = function (events, extraParams, manualCallback) { + var listeners = this.listeners; + var numListenersBeforeEmit = listeners.length; + this.emitting++; + + if (!array(extraParams)) { + extraParams = [extraParams]; + } + + forEachEventObj(this, function (self, eventObj) { + if (manualCallback != null) { + listeners = [{ + event: eventObj.event, + type: eventObj.type, + namespace: eventObj.namespace, + callback: manualCallback + }]; + numListenersBeforeEmit = listeners.length; + } + + var _loop2 = function _loop2(i) { + var listener = listeners[i]; + + if (listener.type === eventObj.type && (!listener.namespace || listener.namespace === eventObj.namespace || listener.namespace === universalNamespace) && self.eventMatches(self.context, listener, eventObj)) { + var args = [eventObj]; + + if (extraParams != null) { + push(args, extraParams); + } + + self.beforeEmit(self.context, listener, eventObj); + + if (listener.conf && listener.conf.one) { + self.listeners = self.listeners.filter(function (l) { + return l !== listener; + }); + } + + var context = self.callbackContext(self.context, listener, eventObj); + var ret = listener.callback.apply(context, args); + self.afterEmit(self.context, listener, eventObj); + + if (ret === false) { + eventObj.stopPropagation(); + eventObj.preventDefault(); + } + } // if listener matches + + }; + + for (var i = 0; i < numListenersBeforeEmit; i++) { + _loop2(i); + } // for listener + + + if (self.bubble(self.context) && !eventObj.isPropagationStopped()) { + self.parent(self.context).emit(eventObj, extraParams); + } + }, events); + this.emitting--; + return this; +}; + +var emitterOptions$1 = { + qualifierCompare: function qualifierCompare(selector1, selector2) { + if (selector1 == null || selector2 == null) { + return selector1 == null && selector2 == null; + } else { + return selector1.sameText(selector2); + } + }, + eventMatches: function eventMatches(ele, listener, eventObj) { + var selector = listener.qualifier; + + if (selector != null) { + return ele !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target); + } + + return true; + }, + addEventFields: function addEventFields(ele, evt) { + evt.cy = ele.cy(); + evt.target = ele; + }, + callbackContext: function callbackContext(ele, listener, eventObj) { + return listener.qualifier != null ? eventObj.target : ele; + }, + beforeEmit: function beforeEmit(context, listener + /*, eventObj*/ + ) { + if (listener.conf && listener.conf.once) { + listener.conf.onceCollection.removeListener(listener.event, listener.qualifier, listener.callback); + } + }, + bubble: function bubble() { + return true; + }, + parent: function parent(ele) { + return ele.isChild() ? ele.parent() : ele.cy(); + } +}; + +var argSelector$1 = function argSelector(arg) { + if (string(arg)) { + return new Selector(arg); + } else { + return arg; + } +}; + +var elesfn$9 = { + createEmitter: function createEmitter() { + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var _p = ele._private; + + if (!_p.emitter) { + _p.emitter = new Emitter(emitterOptions$1, ele); + } + } + + return this; + }, + emitter: function emitter() { + return this._private.emitter; + }, + on: function on(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().on(events, argSel, callback); + } + + return this; + }, + removeListener: function removeListener(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().removeListener(events, argSel, callback); + } + + return this; + }, + removeAllListeners: function removeAllListeners() { + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().removeAllListeners(); + } + + return this; + }, + one: function one(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().one(events, argSel, callback); + } + + return this; + }, + once: function once(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().on(events, argSel, callback, { + once: true, + onceCollection: this + }); + } + }, + emit: function emit(events, extraParams) { + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().emit(events, extraParams); + } + + return this; + }, + emitAndNotify: function emitAndNotify(event, extraParams) { + // for internal use only + if (this.length === 0) { + return; + } // empty collections don't need to notify anything + // notify renderer + + + this.cy().notify(event, this); + this.emit(event, extraParams); + return this; + } +}; +define.eventAliasesOn(elesfn$9); + +var elesfn$8 = { + nodes: function nodes(selector) { + return this.filter(function (ele) { + return ele.isNode(); + }).filter(selector); + }, + edges: function edges(selector) { + return this.filter(function (ele) { + return ele.isEdge(); + }).filter(selector); + }, + // internal helper to get nodes and edges as separate collections with single iteration over elements + byGroup: function byGroup() { + var nodes = this.spawn(); + var edges = this.spawn(); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + + if (ele.isNode()) { + nodes.push(ele); + } else { + edges.push(ele); + } + } + + return { + nodes: nodes, + edges: edges + }; + }, + filter: function filter(_filter, thisArg) { + if (_filter === undefined) { + // check this first b/c it's the most common/performant case + return this; + } else if (string(_filter) || elementOrCollection(_filter)) { + return new Selector(_filter).filter(this); + } else if (fn$6(_filter)) { + var filterEles = this.spawn(); + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var include = thisArg ? _filter.apply(thisArg, [ele, i, eles]) : _filter(ele, i, eles); + + if (include) { + filterEles.push(ele); + } + } + + return filterEles; + } + + return this.spawn(); // if not handled by above, give 'em an empty collection + }, + not: function not(toRemove) { + if (!toRemove) { + return this; + } else { + if (string(toRemove)) { + toRemove = this.filter(toRemove); + } + + var elements = this.spawn(); + + for (var i = 0; i < this.length; i++) { + var element = this[i]; + var remove = toRemove.has(element); + + if (!remove) { + elements.push(element); + } + } + + return elements; + } + }, + absoluteComplement: function absoluteComplement() { + var cy = this.cy(); + return cy.mutableElements().not(this); + }, + intersect: function intersect(other) { + // if a selector is specified, then filter by it instead + if (string(other)) { + var selector = other; + return this.filter(selector); + } + + var elements = this.spawn(); + var col1 = this; + var col2 = other; + var col1Smaller = this.length < other.length; + var colS = col1Smaller ? col1 : col2; + var colL = col1Smaller ? col2 : col1; + + for (var i = 0; i < colS.length; i++) { + var ele = colS[i]; + + if (colL.has(ele)) { + elements.push(ele); + } + } + + return elements; + }, + xor: function xor(other) { + var cy = this._private.cy; + + if (string(other)) { + other = cy.$(other); + } + + var elements = this.spawn(); + var col1 = this; + var col2 = other; + + var add = function add(col, other) { + for (var i = 0; i < col.length; i++) { + var ele = col[i]; + var id = ele._private.data.id; + var inOther = other.hasElementWithId(id); + + if (!inOther) { + elements.push(ele); + } + } + }; + + add(col1, col2); + add(col2, col1); + return elements; + }, + diff: function diff(other) { + var cy = this._private.cy; + + if (string(other)) { + other = cy.$(other); + } + + var left = this.spawn(); + var right = this.spawn(); + var both = this.spawn(); + var col1 = this; + var col2 = other; + + var add = function add(col, other, retEles) { + for (var i = 0; i < col.length; i++) { + var ele = col[i]; + var id = ele._private.data.id; + var inOther = other.hasElementWithId(id); + + if (inOther) { + both.merge(ele); + } else { + retEles.push(ele); + } + } + }; + + add(col1, col2, left); + add(col2, col1, right); + return { + left: left, + right: right, + both: both + }; + }, + add: function add(toAdd) { + var cy = this._private.cy; + + if (!toAdd) { + return this; + } + + if (string(toAdd)) { + var selector = toAdd; + toAdd = cy.mutableElements().filter(selector); + } + + var elements = this.spawnSelf(); + + for (var i = 0; i < toAdd.length; i++) { + var ele = toAdd[i]; + var add = !this.has(ele); + + if (add) { + elements.push(ele); + } + } + + return elements; + }, + // in place merge on calling collection + merge: function merge(toAdd) { + var _p = this._private; + var cy = _p.cy; + + if (!toAdd) { + return this; + } + + if (toAdd && string(toAdd)) { + var selector = toAdd; + toAdd = cy.mutableElements().filter(selector); + } + + var map = _p.map; + + for (var i = 0; i < toAdd.length; i++) { + var toAddEle = toAdd[i]; + var id = toAddEle._private.data.id; + var add = !map.has(id); + + if (add) { + var index = this.length++; + this[index] = toAddEle; + map.set(id, { + ele: toAddEle, + index: index + }); + } + } + + return this; // chaining + }, + unmergeAt: function unmergeAt(i) { + var ele = this[i]; + var id = ele.id(); + var _p = this._private; + var map = _p.map; // remove ele + + this[i] = undefined; + map["delete"](id); + var unmergedLastEle = i === this.length - 1; // replace empty spot with last ele in collection + + if (this.length > 1 && !unmergedLastEle) { + var lastEleI = this.length - 1; + var lastEle = this[lastEleI]; + var lastEleId = lastEle._private.data.id; + this[lastEleI] = undefined; + this[i] = lastEle; + map.set(lastEleId, { + ele: lastEle, + index: i + }); + } // the collection is now 1 ele smaller + + + this.length--; + return this; + }, + // remove single ele in place in calling collection + unmergeOne: function unmergeOne(ele) { + ele = ele[0]; + var _p = this._private; + var id = ele._private.data.id; + var map = _p.map; + var entry = map.get(id); + + if (!entry) { + return this; // no need to remove + } + + var i = entry.index; + this.unmergeAt(i); + return this; + }, + // remove eles in place on calling collection + unmerge: function unmerge(toRemove) { + var cy = this._private.cy; + + if (!toRemove) { + return this; + } + + if (toRemove && string(toRemove)) { + var selector = toRemove; + toRemove = cy.mutableElements().filter(selector); + } + + for (var i = 0; i < toRemove.length; i++) { + this.unmergeOne(toRemove[i]); + } + + return this; // chaining + }, + unmergeBy: function unmergeBy(toRmFn) { + for (var i = this.length - 1; i >= 0; i--) { + var ele = this[i]; + + if (toRmFn(ele)) { + this.unmergeAt(i); + } + } + + return this; + }, + map: function map(mapFn, thisArg) { + var arr = []; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var ret = thisArg ? mapFn.apply(thisArg, [ele, i, eles]) : mapFn(ele, i, eles); + arr.push(ret); + } + + return arr; + }, + reduce: function reduce(fn, initialValue) { + var val = initialValue; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + val = fn(val, eles[i], i, eles); + } + + return val; + }, + max: function max(valFn, thisArg) { + var max = -Infinity; + var maxEle; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var val = thisArg ? valFn.apply(thisArg, [ele, i, eles]) : valFn(ele, i, eles); + + if (val > max) { + max = val; + maxEle = ele; + } + } + + return { + value: max, + ele: maxEle + }; + }, + min: function min(valFn, thisArg) { + var min = Infinity; + var minEle; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var val = thisArg ? valFn.apply(thisArg, [ele, i, eles]) : valFn(ele, i, eles); + + if (val < min) { + min = val; + minEle = ele; + } + } + + return { + value: min, + ele: minEle + }; + } +}; // aliases + +var fn$1 = elesfn$8; +fn$1['u'] = fn$1['|'] = fn$1['+'] = fn$1.union = fn$1.or = fn$1.add; +fn$1['\\'] = fn$1['!'] = fn$1['-'] = fn$1.difference = fn$1.relativeComplement = fn$1.subtract = fn$1.not; +fn$1['n'] = fn$1['&'] = fn$1['.'] = fn$1.and = fn$1.intersection = fn$1.intersect; +fn$1['^'] = fn$1['(+)'] = fn$1['(-)'] = fn$1.symmetricDifference = fn$1.symdiff = fn$1.xor; +fn$1.fnFilter = fn$1.filterFn = fn$1.stdFilter = fn$1.filter; +fn$1.complement = fn$1.abscomp = fn$1.absoluteComplement; + +var elesfn$7 = { + isNode: function isNode() { + return this.group() === 'nodes'; + }, + isEdge: function isEdge() { + return this.group() === 'edges'; + }, + isLoop: function isLoop() { + return this.isEdge() && this.source()[0] === this.target()[0]; + }, + isSimple: function isSimple() { + return this.isEdge() && this.source()[0] !== this.target()[0]; + }, + group: function group() { + var ele = this[0]; + + if (ele) { + return ele._private.group; + } + } +}; + +/** + * Elements are drawn in a specific order based on compound depth (low to high), the element type (nodes above edges), + * and z-index (low to high). These styles affect how this applies: + * + * z-compound-depth: May be `bottom | orphan | auto | top`. The first drawn is `bottom`, then `orphan` which is the + * same depth as the root of the compound graph, followed by the default value `auto` which draws in order from + * root to leaves of the compound graph. The last drawn is `top`. + * z-index-compare: May be `auto | manual`. The default value is `auto` which always draws edges under nodes. + * `manual` ignores this convention and draws based on the `z-index` value setting. + * z-index: An integer value that affects the relative draw order of elements. In general, an element with a higher + * `z-index` will be drawn on top of an element with a lower `z-index`. + */ + +var zIndexSort = function zIndexSort(a, b) { + var cy = a.cy(); + var hasCompoundNodes = cy.hasCompoundNodes(); + + function getDepth(ele) { + var style = ele.pstyle('z-compound-depth'); + + if (style.value === 'auto') { + return hasCompoundNodes ? ele.zDepth() : 0; + } else if (style.value === 'bottom') { + return -1; + } else if (style.value === 'top') { + return MAX_INT$1; + } // 'orphan' + + + return 0; + } + + var depthDiff = getDepth(a) - getDepth(b); + + if (depthDiff !== 0) { + return depthDiff; + } + + function getEleDepth(ele) { + var style = ele.pstyle('z-index-compare'); + + if (style.value === 'auto') { + return ele.isNode() ? 1 : 0; + } // 'manual' + + + return 0; + } + + var eleDiff = getEleDepth(a) - getEleDepth(b); + + if (eleDiff !== 0) { + return eleDiff; + } + + var zDiff = a.pstyle('z-index').value - b.pstyle('z-index').value; + + if (zDiff !== 0) { + return zDiff; + } // compare indices in the core (order added to graph w/ last on top) + + + return a.poolIndex() - b.poolIndex(); +}; + +var elesfn$6 = { + forEach: function forEach(fn, thisArg) { + if (fn$6(fn)) { + var N = this.length; + + for (var i = 0; i < N; i++) { + var ele = this[i]; + var ret = thisArg ? fn.apply(thisArg, [ele, i, this]) : fn(ele, i, this); + + if (ret === false) { + break; + } // exit each early on return false + + } + } + + return this; + }, + toArray: function toArray() { + var array = []; + + for (var i = 0; i < this.length; i++) { + array.push(this[i]); + } + + return array; + }, + slice: function slice(start, end) { + var array = []; + var thisSize = this.length; + + if (end == null) { + end = thisSize; + } + + if (start == null) { + start = 0; + } + + if (start < 0) { + start = thisSize + start; + } + + if (end < 0) { + end = thisSize + end; + } + + for (var i = start; i >= 0 && i < end && i < thisSize; i++) { + array.push(this[i]); + } + + return this.spawn(array); + }, + size: function size() { + return this.length; + }, + eq: function eq(i) { + return this[i] || this.spawn(); + }, + first: function first() { + return this[0] || this.spawn(); + }, + last: function last() { + return this[this.length - 1] || this.spawn(); + }, + empty: function empty() { + return this.length === 0; + }, + nonempty: function nonempty() { + return !this.empty(); + }, + sort: function sort(sortFn) { + if (!fn$6(sortFn)) { + return this; + } + + var sorted = this.toArray().sort(sortFn); + return this.spawn(sorted); + }, + sortByZIndex: function sortByZIndex() { + return this.sort(zIndexSort); + }, + zDepth: function zDepth() { + var ele = this[0]; + + if (!ele) { + return undefined; + } // let cy = ele.cy(); + + + var _p = ele._private; + var group = _p.group; + + if (group === 'nodes') { + var depth = _p.data.parent ? ele.parents().size() : 0; + + if (!ele.isParent()) { + return MAX_INT$1 - 1; // childless nodes always on top + } + + return depth; + } else { + var src = _p.source; + var tgt = _p.target; + var srcDepth = src.zDepth(); + var tgtDepth = tgt.zDepth(); + return Math.max(srcDepth, tgtDepth, 0); // depth of deepest parent + } + } +}; +elesfn$6.each = elesfn$6.forEach; + +var defineSymbolIterator = function defineSymbolIterator() { + var typeofUndef = "undefined" ; + var isIteratorSupported = (typeof Symbol === "undefined" ? "undefined" : _typeof(Symbol)) != typeofUndef && _typeof(Symbol.iterator) != typeofUndef; // eslint-disable-line no-undef + + if (isIteratorSupported) { + elesfn$6[Symbol.iterator] = function () { + var _this = this; + + // eslint-disable-line no-undef + var entry = { + value: undefined, + done: false + }; + var i = 0; + var length = this.length; + return _defineProperty({ + next: function next() { + if (i < length) { + entry.value = _this[i++]; + } else { + entry.value = undefined; + entry.done = true; + } + + return entry; + } + }, Symbol.iterator, function () { + // eslint-disable-line no-undef + return this; + }); + }; + } +}; + +defineSymbolIterator(); + +var getLayoutDimensionOptions = defaults$g({ + nodeDimensionsIncludeLabels: false +}); +var elesfn$5 = { + // Calculates and returns node dimensions { x, y } based on options given + layoutDimensions: function layoutDimensions(options) { + options = getLayoutDimensionOptions(options); + var dims; + + if (!this.takesUpSpace()) { + dims = { + w: 0, + h: 0 + }; + } else if (options.nodeDimensionsIncludeLabels) { + var bbDim = this.boundingBox(); + dims = { + w: bbDim.w, + h: bbDim.h + }; + } else { + dims = { + w: this.outerWidth(), + h: this.outerHeight() + }; + } // sanitise the dimensions for external layouts (avoid division by zero) + + + if (dims.w === 0 || dims.h === 0) { + dims.w = dims.h = 1; + } + + return dims; + }, + // using standard layout options, apply position function (w/ or w/o animation) + layoutPositions: function layoutPositions(layout, options, fn) { + var nodes = this.nodes().filter(function (n) { + return !n.isParent(); + }); + var cy = this.cy(); + var layoutEles = options.eles; // nodes & edges + + var getMemoizeKey = function getMemoizeKey(node) { + return node.id(); + }; + + var fnMem = memoize(fn, getMemoizeKey); // memoized version of position function + + layout.emit({ + type: 'layoutstart', + layout: layout + }); + layout.animations = []; + + var calculateSpacing = function calculateSpacing(spacing, nodesBb, pos) { + var center = { + x: nodesBb.x1 + nodesBb.w / 2, + y: nodesBb.y1 + nodesBb.h / 2 + }; + var spacingVector = { + // scale from center of bounding box (not necessarily 0,0) + x: (pos.x - center.x) * spacing, + y: (pos.y - center.y) * spacing + }; + return { + x: center.x + spacingVector.x, + y: center.y + spacingVector.y + }; + }; + + var useSpacingFactor = options.spacingFactor && options.spacingFactor !== 1; + + var spacingBb = function spacingBb() { + if (!useSpacingFactor) { + return null; + } + + var bb = makeBoundingBox(); + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var pos = fnMem(node, i); + expandBoundingBoxByPoint(bb, pos.x, pos.y); + } + + return bb; + }; + + var bb = spacingBb(); + var getFinalPos = memoize(function (node, i) { + var newPos = fnMem(node, i); + + if (useSpacingFactor) { + var spacing = Math.abs(options.spacingFactor); + newPos = calculateSpacing(spacing, bb, newPos); + } + + if (options.transform != null) { + newPos = options.transform(node, newPos); + } + + return newPos; + }, getMemoizeKey); + + if (options.animate) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var newPos = getFinalPos(node, i); + var animateNode = options.animateFilter == null || options.animateFilter(node, i); + + if (animateNode) { + var ani = node.animation({ + position: newPos, + duration: options.animationDuration, + easing: options.animationEasing + }); + layout.animations.push(ani); + } else { + node.position(newPos); + } + } + + if (options.fit) { + var fitAni = cy.animation({ + fit: { + boundingBox: layoutEles.boundingBoxAt(getFinalPos), + padding: options.padding + }, + duration: options.animationDuration, + easing: options.animationEasing + }); + layout.animations.push(fitAni); + } else if (options.zoom !== undefined && options.pan !== undefined) { + var zoomPanAni = cy.animation({ + zoom: options.zoom, + pan: options.pan, + duration: options.animationDuration, + easing: options.animationEasing + }); + layout.animations.push(zoomPanAni); + } + + layout.animations.forEach(function (ani) { + return ani.play(); + }); + layout.one('layoutready', options.ready); + layout.emit({ + type: 'layoutready', + layout: layout + }); + Promise$1.all(layout.animations.map(function (ani) { + return ani.promise(); + })).then(function () { + layout.one('layoutstop', options.stop); + layout.emit({ + type: 'layoutstop', + layout: layout + }); + }); + } else { + nodes.positions(getFinalPos); + + if (options.fit) { + cy.fit(options.eles, options.padding); + } + + if (options.zoom != null) { + cy.zoom(options.zoom); + } + + if (options.pan) { + cy.pan(options.pan); + } + + layout.one('layoutready', options.ready); + layout.emit({ + type: 'layoutready', + layout: layout + }); + layout.one('layoutstop', options.stop); + layout.emit({ + type: 'layoutstop', + layout: layout + }); + } + + return this; // chaining + }, + layout: function layout(options) { + var cy = this.cy(); + return cy.makeLayout(extend({}, options, { + eles: this + })); + } +}; // aliases: + +elesfn$5.createLayout = elesfn$5.makeLayout = elesfn$5.layout; + +function styleCache(key, fn, ele) { + var _p = ele._private; + var cache = _p.styleCache = _p.styleCache || []; + var val; + + if ((val = cache[key]) != null) { + return val; + } else { + val = cache[key] = fn(ele); + return val; + } +} + +function cacheStyleFunction(key, fn) { + key = hashString(key); + return function cachedStyleFunction(ele) { + return styleCache(key, fn, ele); + }; +} + +function cachePrototypeStyleFunction(key, fn) { + key = hashString(key); + + var selfFn = function selfFn(ele) { + return fn.call(ele); + }; + + return function cachedPrototypeStyleFunction() { + var ele = this[0]; + + if (ele) { + return styleCache(key, selfFn, ele); + } + }; +} + +var elesfn$4 = { + recalculateRenderedStyle: function recalculateRenderedStyle(useCache) { + var cy = this.cy(); + var renderer = cy.renderer(); + var styleEnabled = cy.styleEnabled(); + + if (renderer && styleEnabled) { + renderer.recalculateRenderedStyle(this, useCache); + } + + return this; + }, + dirtyStyleCache: function dirtyStyleCache() { + var cy = this.cy(); + + var dirty = function dirty(ele) { + return ele._private.styleCache = null; + }; + + if (cy.hasCompoundNodes()) { + var eles; + eles = this.spawnSelf().merge(this.descendants()).merge(this.parents()); + eles.merge(eles.connectedEdges()); + eles.forEach(dirty); + } else { + this.forEach(function (ele) { + dirty(ele); + ele.connectedEdges().forEach(dirty); + }); + } + + return this; + }, + // fully updates (recalculates) the style for the elements + updateStyle: function updateStyle(notifyRenderer) { + var cy = this._private.cy; + + if (!cy.styleEnabled()) { + return this; + } + + if (cy.batching()) { + var bEles = cy._private.batchStyleEles; + bEles.merge(this); + return this; // chaining and exit early when batching + } + + var hasCompounds = cy.hasCompoundNodes(); + var updatedEles = this; + notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false; + + if (hasCompounds) { + // then add everything up and down for compound selector checks + updatedEles = this.spawnSelf().merge(this.descendants()).merge(this.parents()); + } // let changedEles = style.apply( updatedEles ); + + + var changedEles = updatedEles; + + if (notifyRenderer) { + changedEles.emitAndNotify('style'); // let renderer know we changed style + } else { + changedEles.emit('style'); // just fire the event + } + + updatedEles.forEach(function (ele) { + return ele._private.styleDirty = true; + }); + return this; // chaining + }, + // private: clears dirty flag and recalculates style + cleanStyle: function cleanStyle() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return; + } + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + + if (ele._private.styleDirty) { + // n.b. this flag should be set before apply() to avoid potential infinite recursion + ele._private.styleDirty = false; + cy.style().apply(ele); + } + } + }, + // get the internal parsed style object for the specified property + parsedStyle: function parsedStyle(property) { + var includeNonDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var ele = this[0]; + var cy = ele.cy(); + + if (!cy.styleEnabled()) { + return; + } + + if (ele) { + this.cleanStyle(); + var overriddenStyle = ele._private.style[property]; + + if (overriddenStyle != null) { + return overriddenStyle; + } else if (includeNonDefault) { + return cy.style().getDefaultProperty(property); + } else { + return null; + } + } + }, + numericStyle: function numericStyle(property) { + var ele = this[0]; + + if (!ele.cy().styleEnabled()) { + return; + } + + if (ele) { + var pstyle = ele.pstyle(property); + return pstyle.pfValue !== undefined ? pstyle.pfValue : pstyle.value; + } + }, + numericStyleUnits: function numericStyleUnits(property) { + var ele = this[0]; + + if (!ele.cy().styleEnabled()) { + return; + } + + if (ele) { + return ele.pstyle(property).units; + } + }, + // get the specified css property as a rendered value (i.e. on-screen value) + // or get the whole rendered style if no property specified (NB doesn't allow setting) + renderedStyle: function renderedStyle(property) { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return this; + } + + var ele = this[0]; + + if (ele) { + return cy.style().getRenderedStyle(ele, property); + } + }, + // read the calculated css style of the element or override the style (via a bypass) + style: function style(name, value) { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return this; + } + + var updateTransitions = false; + var style = cy.style(); + + if (plainObject(name)) { + // then extend the bypass + var props = name; + style.applyBypass(this, props, updateTransitions); + this.emitAndNotify('style'); // let the renderer know we've updated style + } else if (string(name)) { + if (value === undefined) { + // then get the property from the style + var ele = this[0]; + + if (ele) { + return style.getStylePropertyValue(ele, name); + } else { + // empty collection => can't get any value + return; + } + } else { + // then set the bypass with the property value + style.applyBypass(this, name, value, updateTransitions); + this.emitAndNotify('style'); // let the renderer know we've updated style + } + } else if (name === undefined) { + var _ele = this[0]; + + if (_ele) { + return style.getRawStyle(_ele); + } else { + // empty collection => can't get any value + return; + } + } + + return this; // chaining + }, + removeStyle: function removeStyle(names) { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return this; + } + + var updateTransitions = false; + var style = cy.style(); + var eles = this; + + if (names === undefined) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + style.removeAllBypasses(ele, updateTransitions); + } + } else { + names = names.split(/\s+/); + + for (var _i = 0; _i < eles.length; _i++) { + var _ele2 = eles[_i]; + style.removeBypasses(_ele2, names, updateTransitions); + } + } + + this.emitAndNotify('style'); // let the renderer know we've updated style + + return this; // chaining + }, + show: function show() { + this.css('display', 'element'); + return this; // chaining + }, + hide: function hide() { + this.css('display', 'none'); + return this; // chaining + }, + effectiveOpacity: function effectiveOpacity() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return 1; + } + + var hasCompoundNodes = cy.hasCompoundNodes(); + var ele = this[0]; + + if (ele) { + var _p = ele._private; + var parentOpacity = ele.pstyle('opacity').value; + + if (!hasCompoundNodes) { + return parentOpacity; + } + + var parents = !_p.data.parent ? null : ele.parents(); + + if (parents) { + for (var i = 0; i < parents.length; i++) { + var parent = parents[i]; + var opacity = parent.pstyle('opacity').value; + parentOpacity = opacity * parentOpacity; + } + } + + return parentOpacity; + } + }, + transparent: function transparent() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return false; + } + + var ele = this[0]; + var hasCompoundNodes = ele.cy().hasCompoundNodes(); + + if (ele) { + if (!hasCompoundNodes) { + return ele.pstyle('opacity').value === 0; + } else { + return ele.effectiveOpacity() === 0; + } + } + }, + backgrounding: function backgrounding() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return false; + } + + var ele = this[0]; + return ele._private.backgrounding ? true : false; + } +}; + +function checkCompound(ele, parentOk) { + var _p = ele._private; + var parents = _p.data.parent ? ele.parents() : null; + + if (parents) { + for (var i = 0; i < parents.length; i++) { + var parent = parents[i]; + + if (!parentOk(parent)) { + return false; + } + } + } + + return true; +} + +function defineDerivedStateFunction(specs) { + var ok = specs.ok; + var edgeOkViaNode = specs.edgeOkViaNode || specs.ok; + var parentOk = specs.parentOk || specs.ok; + return function () { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return true; + } + + var ele = this[0]; + var hasCompoundNodes = cy.hasCompoundNodes(); + + if (ele) { + var _p = ele._private; + + if (!ok(ele)) { + return false; + } + + if (ele.isNode()) { + return !hasCompoundNodes || checkCompound(ele, parentOk); + } else { + var src = _p.source; + var tgt = _p.target; + return edgeOkViaNode(src) && (!hasCompoundNodes || checkCompound(src, edgeOkViaNode)) && (src === tgt || edgeOkViaNode(tgt) && (!hasCompoundNodes || checkCompound(tgt, edgeOkViaNode))); + } + } + }; +} + +var eleTakesUpSpace = cacheStyleFunction('eleTakesUpSpace', function (ele) { + return ele.pstyle('display').value === 'element' && ele.width() !== 0 && (ele.isNode() ? ele.height() !== 0 : true); +}); +elesfn$4.takesUpSpace = cachePrototypeStyleFunction('takesUpSpace', defineDerivedStateFunction({ + ok: eleTakesUpSpace +})); +var eleInteractive = cacheStyleFunction('eleInteractive', function (ele) { + return ele.pstyle('events').value === 'yes' && ele.pstyle('visibility').value === 'visible' && eleTakesUpSpace(ele); +}); +var parentInteractive = cacheStyleFunction('parentInteractive', function (parent) { + return parent.pstyle('visibility').value === 'visible' && eleTakesUpSpace(parent); +}); +elesfn$4.interactive = cachePrototypeStyleFunction('interactive', defineDerivedStateFunction({ + ok: eleInteractive, + parentOk: parentInteractive, + edgeOkViaNode: eleTakesUpSpace +})); + +elesfn$4.noninteractive = function () { + var ele = this[0]; + + if (ele) { + return !ele.interactive(); + } +}; + +var eleVisible = cacheStyleFunction('eleVisible', function (ele) { + return ele.pstyle('visibility').value === 'visible' && ele.pstyle('opacity').pfValue !== 0 && eleTakesUpSpace(ele); +}); +var edgeVisibleViaNode = eleTakesUpSpace; +elesfn$4.visible = cachePrototypeStyleFunction('visible', defineDerivedStateFunction({ + ok: eleVisible, + edgeOkViaNode: edgeVisibleViaNode +})); + +elesfn$4.hidden = function () { + var ele = this[0]; + + if (ele) { + return !ele.visible(); + } +}; + +elesfn$4.isBundledBezier = cachePrototypeStyleFunction('isBundledBezier', function () { + if (!this.cy().styleEnabled()) { + return false; + } + + return !this.removed() && this.pstyle('curve-style').value === 'bezier' && this.takesUpSpace(); +}); +elesfn$4.bypass = elesfn$4.css = elesfn$4.style; +elesfn$4.renderedCss = elesfn$4.renderedStyle; +elesfn$4.removeBypass = elesfn$4.removeCss = elesfn$4.removeStyle; +elesfn$4.pstyle = elesfn$4.parsedStyle; + +var elesfn$3 = {}; + +function defineSwitchFunction(params) { + return function () { + var args = arguments; + var changedEles = []; // e.g. cy.nodes().select( data, handler ) + + if (args.length === 2) { + var data = args[0]; + var handler = args[1]; + this.on(params.event, data, handler); + } // e.g. cy.nodes().select( handler ) + else if (args.length === 1 && fn$6(args[0])) { + var _handler = args[0]; + this.on(params.event, _handler); + } // e.g. cy.nodes().select() + // e.g. (private) cy.nodes().select(['tapselect']) + else if (args.length === 0 || args.length === 1 && array(args[0])) { + var addlEvents = args.length === 1 ? args[0] : null; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var able = !params.ableField || ele._private[params.ableField]; + var changed = ele._private[params.field] != params.value; + + if (params.overrideAble) { + var overrideAble = params.overrideAble(ele); + + if (overrideAble !== undefined) { + able = overrideAble; + + if (!overrideAble) { + return this; + } // to save cycles assume not able for all on override + + } + } + + if (able) { + ele._private[params.field] = params.value; + + if (changed) { + changedEles.push(ele); + } + } + } + + var changedColl = this.spawn(changedEles); + changedColl.updateStyle(); // change of state => possible change of style + + changedColl.emit(params.event); + + if (addlEvents) { + changedColl.emit(addlEvents); + } + } + + return this; + }; +} + +function defineSwitchSet(params) { + elesfn$3[params.field] = function () { + var ele = this[0]; + + if (ele) { + if (params.overrideField) { + var val = params.overrideField(ele); + + if (val !== undefined) { + return val; + } + } + + return ele._private[params.field]; + } + }; + + elesfn$3[params.on] = defineSwitchFunction({ + event: params.on, + field: params.field, + ableField: params.ableField, + overrideAble: params.overrideAble, + value: true + }); + elesfn$3[params.off] = defineSwitchFunction({ + event: params.off, + field: params.field, + ableField: params.ableField, + overrideAble: params.overrideAble, + value: false + }); +} + +defineSwitchSet({ + field: 'locked', + overrideField: function overrideField(ele) { + return ele.cy().autolock() ? true : undefined; + }, + on: 'lock', + off: 'unlock' +}); +defineSwitchSet({ + field: 'grabbable', + overrideField: function overrideField(ele) { + return ele.cy().autoungrabify() || ele.pannable() ? false : undefined; + }, + on: 'grabify', + off: 'ungrabify' +}); +defineSwitchSet({ + field: 'selected', + ableField: 'selectable', + overrideAble: function overrideAble(ele) { + return ele.cy().autounselectify() ? false : undefined; + }, + on: 'select', + off: 'unselect' +}); +defineSwitchSet({ + field: 'selectable', + overrideField: function overrideField(ele) { + return ele.cy().autounselectify() ? false : undefined; + }, + on: 'selectify', + off: 'unselectify' +}); +elesfn$3.deselect = elesfn$3.unselect; + +elesfn$3.grabbed = function () { + var ele = this[0]; + + if (ele) { + return ele._private.grabbed; + } +}; + +defineSwitchSet({ + field: 'active', + on: 'activate', + off: 'unactivate' +}); +defineSwitchSet({ + field: 'pannable', + on: 'panify', + off: 'unpanify' +}); + +elesfn$3.inactive = function () { + var ele = this[0]; + + if (ele) { + return !ele._private.active; + } +}; + +var elesfn$2 = {}; // DAG functions +//////////////// + +var defineDagExtremity = function defineDagExtremity(params) { + return function dagExtremityImpl(selector) { + var eles = this; + var ret = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.isNode()) { + continue; + } + + var disqualified = false; + var edges = ele.connectedEdges(); + + for (var j = 0; j < edges.length; j++) { + var edge = edges[j]; + var src = edge.source(); + var tgt = edge.target(); + + if (params.noIncomingEdges && tgt === ele && src !== ele || params.noOutgoingEdges && src === ele && tgt !== ele) { + disqualified = true; + break; + } + } + + if (!disqualified) { + ret.push(ele); + } + } + + return this.spawn(ret, true).filter(selector); + }; +}; + +var defineDagOneHop = function defineDagOneHop(params) { + return function (selector) { + var eles = this; + var oEles = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.isNode()) { + continue; + } + + var edges = ele.connectedEdges(); + + for (var j = 0; j < edges.length; j++) { + var edge = edges[j]; + var src = edge.source(); + var tgt = edge.target(); + + if (params.outgoing && src === ele) { + oEles.push(edge); + oEles.push(tgt); + } else if (params.incoming && tgt === ele) { + oEles.push(edge); + oEles.push(src); + } + } + } + + return this.spawn(oEles, true).filter(selector); + }; +}; + +var defineDagAllHops = function defineDagAllHops(params) { + return function (selector) { + var eles = this; + var sEles = []; + var sElesIds = {}; + + for (;;) { + var next = params.outgoing ? eles.outgoers() : eles.incomers(); + + if (next.length === 0) { + break; + } // done if none left + + + var newNext = false; + + for (var i = 0; i < next.length; i++) { + var n = next[i]; + var nid = n.id(); + + if (!sElesIds[nid]) { + sElesIds[nid] = true; + sEles.push(n); + newNext = true; + } + } + + if (!newNext) { + break; + } // done if touched all outgoers already + + + eles = next; + } + + return this.spawn(sEles, true).filter(selector); + }; +}; + +elesfn$2.clearTraversalCache = function () { + for (var i = 0; i < this.length; i++) { + this[i]._private.traversalCache = null; + } +}; + +extend(elesfn$2, { + // get the root nodes in the DAG + roots: defineDagExtremity({ + noIncomingEdges: true + }), + // get the leaf nodes in the DAG + leaves: defineDagExtremity({ + noOutgoingEdges: true + }), + // normally called children in graph theory + // these nodes =edges=> outgoing nodes + outgoers: cache(defineDagOneHop({ + outgoing: true + }), 'outgoers'), + // aka DAG descendants + successors: defineDagAllHops({ + outgoing: true + }), + // normally called parents in graph theory + // these nodes <=edges= incoming nodes + incomers: cache(defineDagOneHop({ + incoming: true + }), 'incomers'), + // aka DAG ancestors + predecessors: defineDagAllHops({ + incoming: true + }) +}); // Neighbourhood functions +////////////////////////// + +extend(elesfn$2, { + neighborhood: cache(function (selector) { + var elements = []; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + // for all nodes + var node = nodes[i]; + var connectedEdges = node.connectedEdges(); // for each connected edge, add the edge and the other node + + for (var j = 0; j < connectedEdges.length; j++) { + var edge = connectedEdges[j]; + var src = edge.source(); + var tgt = edge.target(); + var otherNode = node === src ? tgt : src; // need check in case of loop + + if (otherNode.length > 0) { + elements.push(otherNode[0]); // add node 1 hop away + } // add connected edge + + + elements.push(edge[0]); + } + } + + return this.spawn(elements, true).filter(selector); + }, 'neighborhood'), + closedNeighborhood: function closedNeighborhood(selector) { + return this.neighborhood().add(this).filter(selector); + }, + openNeighborhood: function openNeighborhood(selector) { + return this.neighborhood(selector); + } +}); // aliases + +elesfn$2.neighbourhood = elesfn$2.neighborhood; +elesfn$2.closedNeighbourhood = elesfn$2.closedNeighborhood; +elesfn$2.openNeighbourhood = elesfn$2.openNeighborhood; // Edge functions +///////////////// + +extend(elesfn$2, { + source: cache(function sourceImpl(selector) { + var ele = this[0]; + var src; + + if (ele) { + src = ele._private.source || ele.cy().collection(); + } + + return src && selector ? src.filter(selector) : src; + }, 'source'), + target: cache(function targetImpl(selector) { + var ele = this[0]; + var tgt; + + if (ele) { + tgt = ele._private.target || ele.cy().collection(); + } + + return tgt && selector ? tgt.filter(selector) : tgt; + }, 'target'), + sources: defineSourceFunction({ + attr: 'source' + }), + targets: defineSourceFunction({ + attr: 'target' + }) +}); + +function defineSourceFunction(params) { + return function sourceImpl(selector) { + var sources = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var src = ele._private[params.attr]; + + if (src) { + sources.push(src); + } + } + + return this.spawn(sources, true).filter(selector); + }; +} + +extend(elesfn$2, { + edgesWith: cache(defineEdgesWithFunction(), 'edgesWith'), + edgesTo: cache(defineEdgesWithFunction({ + thisIsSrc: true + }), 'edgesTo') +}); + +function defineEdgesWithFunction(params) { + return function edgesWithImpl(otherNodes) { + var elements = []; + var cy = this._private.cy; + var p = params || {}; // get elements if a selector is specified + + if (string(otherNodes)) { + otherNodes = cy.$(otherNodes); + } + + for (var h = 0; h < otherNodes.length; h++) { + var edges = otherNodes[h]._private.edges; + + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var edgeData = edge._private.data; + var thisToOther = this.hasElementWithId(edgeData.source) && otherNodes.hasElementWithId(edgeData.target); + var otherToThis = otherNodes.hasElementWithId(edgeData.source) && this.hasElementWithId(edgeData.target); + var edgeConnectsThisAndOther = thisToOther || otherToThis; + + if (!edgeConnectsThisAndOther) { + continue; + } + + if (p.thisIsSrc || p.thisIsTgt) { + if (p.thisIsSrc && !thisToOther) { + continue; + } + + if (p.thisIsTgt && !otherToThis) { + continue; + } + } + + elements.push(edge); + } + } + + return this.spawn(elements, true); + }; +} + +extend(elesfn$2, { + connectedEdges: cache(function (selector) { + var retEles = []; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var node = eles[i]; + + if (!node.isNode()) { + continue; + } + + var edges = node._private.edges; + + for (var j = 0; j < edges.length; j++) { + var edge = edges[j]; + retEles.push(edge); + } + } + + return this.spawn(retEles, true).filter(selector); + }, 'connectedEdges'), + connectedNodes: cache(function (selector) { + var retEles = []; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var edge = eles[i]; + + if (!edge.isEdge()) { + continue; + } + + retEles.push(edge.source()[0]); + retEles.push(edge.target()[0]); + } + + return this.spawn(retEles, true).filter(selector); + }, 'connectedNodes'), + parallelEdges: cache(defineParallelEdgesFunction(), 'parallelEdges'), + codirectedEdges: cache(defineParallelEdgesFunction({ + codirected: true + }), 'codirectedEdges') +}); + +function defineParallelEdgesFunction(params) { + var defaults = { + codirected: false + }; + params = extend({}, defaults, params); + return function parallelEdgesImpl(selector) { + // micro-optimised for renderer + var elements = []; + var edges = this.edges(); + var p = params; // look at all the edges in the collection + + for (var i = 0; i < edges.length; i++) { + var edge1 = edges[i]; + var edge1_p = edge1._private; + var src1 = edge1_p.source; + var srcid1 = src1._private.data.id; + var tgtid1 = edge1_p.data.target; + var srcEdges1 = src1._private.edges; // look at edges connected to the src node of this edge + + for (var j = 0; j < srcEdges1.length; j++) { + var edge2 = srcEdges1[j]; + var edge2data = edge2._private.data; + var tgtid2 = edge2data.target; + var srcid2 = edge2data.source; + var codirected = tgtid2 === tgtid1 && srcid2 === srcid1; + var oppdirected = srcid1 === tgtid2 && tgtid1 === srcid2; + + if (p.codirected && codirected || !p.codirected && (codirected || oppdirected)) { + elements.push(edge2); + } + } + } + + return this.spawn(elements, true).filter(selector); + }; +} // Misc functions +///////////////// + + +extend(elesfn$2, { + components: function components(root) { + var self = this; + var cy = self.cy(); + var visited = cy.collection(); + var unvisited = root == null ? self.nodes() : root.nodes(); + var components = []; + + if (root != null && unvisited.empty()) { + // root may contain only edges + unvisited = root.sources(); // doesn't matter which node to use (undirected), so just use the source sides + } + + var visitInComponent = function visitInComponent(node, component) { + visited.merge(node); + unvisited.unmerge(node); + component.merge(node); + }; + + if (unvisited.empty()) { + return self.spawn(); + } + + var _loop = function _loop() { + // each iteration yields a component + var cmpt = cy.collection(); + components.push(cmpt); + var root = unvisited[0]; + visitInComponent(root, cmpt); + self.bfs({ + directed: false, + roots: root, + visit: function visit(v) { + return visitInComponent(v, cmpt); + } + }); + cmpt.forEach(function (node) { + node.connectedEdges().forEach(function (e) { + // connectedEdges() usually cached + if (self.has(e) && cmpt.has(e.source()) && cmpt.has(e.target())) { + // has() is cheap + cmpt.merge(e); // forEach() only considers nodes -- sets N at call time + } + }); + }); + }; + + do { + _loop(); + } while (unvisited.length > 0); + + return components; + }, + component: function component() { + var ele = this[0]; + return ele.cy().mutableElements().components(ele)[0]; + } +}); +elesfn$2.componentsOf = elesfn$2.components; + +var Collection = function Collection(cy, elements) { + var unique = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var removed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + if (cy === undefined) { + error('A collection must have a reference to the core'); + return; + } + + var map = new Map$1(); + var createdElements = false; + + if (!elements) { + elements = []; + } else if (elements.length > 0 && plainObject(elements[0]) && !element(elements[0])) { + createdElements = true; // make elements from json and restore all at once later + + var eles = []; + var elesIds = new Set$1(); + + for (var i = 0, l = elements.length; i < l; i++) { + var json = elements[i]; + + if (json.data == null) { + json.data = {}; + } + + var _data = json.data; // make sure newly created elements have valid ids + + if (_data.id == null) { + _data.id = uuid(); + } else if (cy.hasElementWithId(_data.id) || elesIds.has(_data.id)) { + continue; // can't create element if prior id already exists + } + + var ele = new Element(cy, json, false); + eles.push(ele); + elesIds.add(_data.id); + } + + elements = eles; + } + + this.length = 0; + + for (var _i = 0, _l = elements.length; _i < _l; _i++) { + var element$1 = elements[_i][0]; // [0] in case elements is an array of collections, rather than array of elements + + if (element$1 == null) { + continue; + } + + var id = element$1._private.data.id; + + if (!unique || !map.has(id)) { + if (unique) { + map.set(id, { + index: this.length, + ele: element$1 + }); + } + + this[this.length] = element$1; + this.length++; + } + } + + this._private = { + eles: this, + cy: cy, + + get map() { + if (this.lazyMap == null) { + this.rebuildMap(); + } + + return this.lazyMap; + }, + + set map(m) { + this.lazyMap = m; + }, + + rebuildMap: function rebuildMap() { + var m = this.lazyMap = new Map$1(); + var eles = this.eles; + + for (var _i2 = 0; _i2 < eles.length; _i2++) { + var _ele = eles[_i2]; + m.set(_ele.id(), { + index: _i2, + ele: _ele + }); + } + } + }; + + if (unique) { + this._private.map = map; + } // restore the elements if we created them from json + + + if (createdElements && !removed) { + this.restore(); + } +}; // Functions +//////////////////////////////////////////////////////////////////////////////////////////////////// +// keep the prototypes in sync (an element has the same functions as a collection) +// and use elefn and elesfn as shorthands to the prototypes + + +var elesfn$1 = Element.prototype = Collection.prototype = Object.create(Array.prototype); + +elesfn$1.instanceString = function () { + return 'collection'; +}; + +elesfn$1.spawn = function (eles, unique) { + return new Collection(this.cy(), eles, unique); +}; + +elesfn$1.spawnSelf = function () { + return this.spawn(this); +}; + +elesfn$1.cy = function () { + return this._private.cy; +}; + +elesfn$1.renderer = function () { + return this._private.cy.renderer(); +}; + +elesfn$1.element = function () { + return this[0]; +}; + +elesfn$1.collection = function () { + if (collection(this)) { + return this; + } else { + // an element + return new Collection(this._private.cy, [this]); + } +}; + +elesfn$1.unique = function () { + return new Collection(this._private.cy, this, true); +}; + +elesfn$1.hasElementWithId = function (id) { + id = '' + id; // id must be string + + return this._private.map.has(id); +}; + +elesfn$1.getElementById = function (id) { + id = '' + id; // id must be string + + var cy = this._private.cy; + + var entry = this._private.map.get(id); + + return entry ? entry.ele : new Collection(cy); // get ele or empty collection +}; + +elesfn$1.$id = elesfn$1.getElementById; + +elesfn$1.poolIndex = function () { + var cy = this._private.cy; + var eles = cy._private.elements; + var id = this[0]._private.data.id; + return eles._private.map.get(id).index; +}; + +elesfn$1.indexOf = function (ele) { + var id = ele[0]._private.data.id; + return this._private.map.get(id).index; +}; + +elesfn$1.indexOfId = function (id) { + id = '' + id; // id must be string + + return this._private.map.get(id).index; +}; + +elesfn$1.json = function (obj) { + var ele = this.element(); + var cy = this.cy(); + + if (ele == null && obj) { + return this; + } // can't set to no eles + + + if (ele == null) { + return undefined; + } // can't get from no eles + + + var p = ele._private; + + if (plainObject(obj)) { + // set + cy.startBatch(); + + if (obj.data) { + ele.data(obj.data); + var _data2 = p.data; + + if (ele.isEdge()) { + // source and target are immutable via data() + var move = false; + var spec = {}; + var src = obj.data.source; + var tgt = obj.data.target; + + if (src != null && src != _data2.source) { + spec.source = '' + src; // id must be string + + move = true; + } + + if (tgt != null && tgt != _data2.target) { + spec.target = '' + tgt; // id must be string + + move = true; + } + + if (move) { + ele = ele.move(spec); + } + } else { + // parent is immutable via data() + var newParentValSpecd = ('parent' in obj.data); + var parent = obj.data.parent; + + if (newParentValSpecd && (parent != null || _data2.parent != null) && parent != _data2.parent) { + if (parent === undefined) { + // can't set undefined imperatively, so use null + parent = null; + } + + if (parent != null) { + parent = '' + parent; // id must be string + } + + ele = ele.move({ + parent: parent + }); + } + } + } + + if (obj.position) { + ele.position(obj.position); + } // ignore group -- immutable + + + var checkSwitch = function checkSwitch(k, trueFnName, falseFnName) { + var obj_k = obj[k]; + + if (obj_k != null && obj_k !== p[k]) { + if (obj_k) { + ele[trueFnName](); + } else { + ele[falseFnName](); + } + } + }; + + checkSwitch('removed', 'remove', 'restore'); + checkSwitch('selected', 'select', 'unselect'); + checkSwitch('selectable', 'selectify', 'unselectify'); + checkSwitch('locked', 'lock', 'unlock'); + checkSwitch('grabbable', 'grabify', 'ungrabify'); + checkSwitch('pannable', 'panify', 'unpanify'); + + if (obj.classes != null) { + ele.classes(obj.classes); + } + + cy.endBatch(); + return this; + } else if (obj === undefined) { + // get + var json = { + data: copy(p.data), + position: copy(p.position), + group: p.group, + removed: p.removed, + selected: p.selected, + selectable: p.selectable, + locked: p.locked, + grabbable: p.grabbable, + pannable: p.pannable, + classes: null + }; + json.classes = ''; + var i = 0; + p.classes.forEach(function (cls) { + return json.classes += i++ === 0 ? cls : ' ' + cls; + }); + return json; + } +}; + +elesfn$1.jsons = function () { + var jsons = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var json = ele.json(); + jsons.push(json); + } + + return jsons; +}; + +elesfn$1.clone = function () { + var cy = this.cy(); + var elesArr = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var json = ele.json(); + var clone = new Element(cy, json, false); // NB no restore + + elesArr.push(clone); + } + + return new Collection(cy, elesArr); +}; + +elesfn$1.copy = elesfn$1.clone; + +elesfn$1.restore = function () { + var notifyRenderer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var addToPool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var self = this; + var cy = self.cy(); + var cy_p = cy._private; // create arrays of nodes and edges, since we need to + // restore the nodes first + + var nodes = []; + var edges = []; + var elements; + + for (var _i3 = 0, l = self.length; _i3 < l; _i3++) { + var ele = self[_i3]; + + if (addToPool && !ele.removed()) { + // don't need to handle this ele + continue; + } // keep nodes first in the array and edges after + + + if (ele.isNode()) { + // put to front of array if node + nodes.push(ele); + } else { + // put to end of array if edge + edges.push(ele); + } + } + + elements = nodes.concat(edges); + var i; + + var removeFromElements = function removeFromElements() { + elements.splice(i, 1); + i--; + }; // now, restore each element + + + for (i = 0; i < elements.length; i++) { + var _ele2 = elements[i]; + var _private = _ele2._private; + var _data3 = _private.data; // the traversal cache should start fresh when ele is added + + _ele2.clearTraversalCache(); // set id and validate + + + if (!addToPool && !_private.removed) ; else if (_data3.id === undefined) { + _data3.id = uuid(); + } else if (number$1(_data3.id)) { + _data3.id = '' + _data3.id; // now it's a string + } else if (emptyString(_data3.id) || !string(_data3.id)) { + error('Can not create element with invalid string ID `' + _data3.id + '`'); // can't create element if it has empty string as id or non-string id + + removeFromElements(); + continue; + } else if (cy.hasElementWithId(_data3.id)) { + error('Can not create second element with ID `' + _data3.id + '`'); // can't create element if one already has that id + + removeFromElements(); + continue; + } + + var id = _data3.id; // id is finalised, now let's keep a ref + + if (_ele2.isNode()) { + // extra checks for nodes + var pos = _private.position; // make sure the nodes have a defined position + + if (pos.x == null) { + pos.x = 0; + } + + if (pos.y == null) { + pos.y = 0; + } + } + + if (_ele2.isEdge()) { + // extra checks for edges + var edge = _ele2; + var fields = ['source', 'target']; + var fieldsLength = fields.length; + var badSourceOrTarget = false; + + for (var j = 0; j < fieldsLength; j++) { + var field = fields[j]; + var val = _data3[field]; + + if (number$1(val)) { + val = _data3[field] = '' + _data3[field]; // now string + } + + if (val == null || val === '') { + // can't create if source or target is not defined properly + error('Can not create edge `' + id + '` with unspecified ' + field); + badSourceOrTarget = true; + } else if (!cy.hasElementWithId(val)) { + // can't create edge if one of its nodes doesn't exist + error('Can not create edge `' + id + '` with nonexistant ' + field + ' `' + val + '`'); + badSourceOrTarget = true; + } + } + + if (badSourceOrTarget) { + removeFromElements(); + continue; + } // can't create this + + + var src = cy.getElementById(_data3.source); + var tgt = cy.getElementById(_data3.target); // only one edge in node if loop + + if (src.same(tgt)) { + src._private.edges.push(edge); + } else { + src._private.edges.push(edge); + + tgt._private.edges.push(edge); + } + + edge._private.source = src; + edge._private.target = tgt; + } // if is edge + // create mock ids / indexes maps for element so it can be used like collections + + + _private.map = new Map$1(); + + _private.map.set(id, { + ele: _ele2, + index: 0 + }); + + _private.removed = false; + + if (addToPool) { + cy.addToPool(_ele2); + } + } // for each element + // do compound node sanity checks + + + for (var _i4 = 0; _i4 < nodes.length; _i4++) { + // each node + var node = nodes[_i4]; + var _data4 = node._private.data; + + if (number$1(_data4.parent)) { + // then automake string + _data4.parent = '' + _data4.parent; + } + + var parentId = _data4.parent; + var specifiedParent = parentId != null; + + if (specifiedParent || node._private.parent) { + var parent = node._private.parent ? cy.collection().merge(node._private.parent) : cy.getElementById(parentId); + + if (parent.empty()) { + // non-existant parent; just remove it + _data4.parent = undefined; + } else if (parent[0].removed()) { + warn('Node added with missing parent, reference to parent removed'); + _data4.parent = undefined; + node._private.parent = null; + } else { + var selfAsParent = false; + var ancestor = parent; + + while (!ancestor.empty()) { + if (node.same(ancestor)) { + // mark self as parent and remove from data + selfAsParent = true; + _data4.parent = undefined; // remove parent reference + // exit or we loop forever + + break; + } + + ancestor = ancestor.parent(); + } + + if (!selfAsParent) { + // connect with children + parent[0]._private.children.push(node); + + node._private.parent = parent[0]; // let the core know we have a compound graph + + cy_p.hasCompoundNodes = true; + } + } // else + + } // if specified parent + + } // for each node + + + if (elements.length > 0) { + var restored = elements.length === self.length ? self : new Collection(cy, elements); + + for (var _i5 = 0; _i5 < restored.length; _i5++) { + var _ele3 = restored[_i5]; + + if (_ele3.isNode()) { + continue; + } // adding an edge invalidates the traversal caches for the parallel edges + + + _ele3.parallelEdges().clearTraversalCache(); // adding an edge invalidates the traversal cache for the connected nodes + + + _ele3.source().clearTraversalCache(); + + _ele3.target().clearTraversalCache(); + } + + var toUpdateStyle; + + if (cy_p.hasCompoundNodes) { + toUpdateStyle = cy.collection().merge(restored).merge(restored.connectedNodes()).merge(restored.parent()); + } else { + toUpdateStyle = restored; + } + + toUpdateStyle.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(notifyRenderer); + + if (notifyRenderer) { + restored.emitAndNotify('add'); + } else if (addToPool) { + restored.emit('add'); + } + } + + return self; // chainability +}; + +elesfn$1.removed = function () { + var ele = this[0]; + return ele && ele._private.removed; +}; + +elesfn$1.inside = function () { + var ele = this[0]; + return ele && !ele._private.removed; +}; + +elesfn$1.remove = function () { + var notifyRenderer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var removeFromPool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var self = this; + var elesToRemove = []; + var elesToRemoveIds = {}; + var cy = self._private.cy; // add connected edges + + function addConnectedEdges(node) { + var edges = node._private.edges; + + for (var i = 0; i < edges.length; i++) { + add(edges[i]); + } + } // add descendant nodes + + + function addChildren(node) { + var children = node._private.children; + + for (var i = 0; i < children.length; i++) { + add(children[i]); + } + } + + function add(ele) { + var alreadyAdded = elesToRemoveIds[ele.id()]; + + if (removeFromPool && ele.removed() || alreadyAdded) { + return; + } else { + elesToRemoveIds[ele.id()] = true; + } + + if (ele.isNode()) { + elesToRemove.push(ele); // nodes are removed last + + addConnectedEdges(ele); + addChildren(ele); + } else { + elesToRemove.unshift(ele); // edges are removed first + } + } // make the list of elements to remove + // (may be removing more than specified due to connected edges etc) + + + for (var i = 0, l = self.length; i < l; i++) { + var ele = self[i]; + add(ele); + } + + function removeEdgeRef(node, edge) { + var connectedEdges = node._private.edges; + removeFromArray(connectedEdges, edge); // removing an edges invalidates the traversal cache for its nodes + + node.clearTraversalCache(); + } + + function removeParallelRef(pllEdge) { + // removing an edge invalidates the traversal caches for the parallel edges + pllEdge.clearTraversalCache(); + } + + var alteredParents = []; + alteredParents.ids = {}; + + function removeChildRef(parent, ele) { + ele = ele[0]; + parent = parent[0]; + var children = parent._private.children; + var pid = parent.id(); + removeFromArray(children, ele); // remove parent => child ref + + ele._private.parent = null; // remove child => parent ref + + if (!alteredParents.ids[pid]) { + alteredParents.ids[pid] = true; + alteredParents.push(parent); + } + } + + self.dirtyCompoundBoundsCache(); + + if (removeFromPool) { + cy.removeFromPool(elesToRemove); // remove from core pool + } + + for (var _i6 = 0; _i6 < elesToRemove.length; _i6++) { + var _ele4 = elesToRemove[_i6]; + + if (_ele4.isEdge()) { + // remove references to this edge in its connected nodes + var src = _ele4.source()[0]; + + var tgt = _ele4.target()[0]; + + removeEdgeRef(src, _ele4); + removeEdgeRef(tgt, _ele4); + + var pllEdges = _ele4.parallelEdges(); + + for (var j = 0; j < pllEdges.length; j++) { + var pllEdge = pllEdges[j]; + removeParallelRef(pllEdge); + + if (pllEdge.isBundledBezier()) { + pllEdge.dirtyBoundingBoxCache(); + } + } + } else { + // remove reference to parent + var parent = _ele4.parent(); + + if (parent.length !== 0) { + removeChildRef(parent, _ele4); + } + } + + if (removeFromPool) { + // mark as removed + _ele4._private.removed = true; + } + } // check to see if we have a compound graph or not + + + var elesStillInside = cy._private.elements; + cy._private.hasCompoundNodes = false; + + for (var _i7 = 0; _i7 < elesStillInside.length; _i7++) { + var _ele5 = elesStillInside[_i7]; + + if (_ele5.isParent()) { + cy._private.hasCompoundNodes = true; + break; + } + } + + var removedElements = new Collection(this.cy(), elesToRemove); + + if (removedElements.size() > 0) { + // must manually notify since trigger won't do this automatically once removed + if (notifyRenderer) { + removedElements.emitAndNotify('remove'); + } else if (removeFromPool) { + removedElements.emit('remove'); + } + } // the parents who were modified by the removal need their style updated + + + for (var _i8 = 0; _i8 < alteredParents.length; _i8++) { + var _ele6 = alteredParents[_i8]; + + if (!removeFromPool || !_ele6.removed()) { + _ele6.updateStyle(); + } + } + + return removedElements; +}; + +elesfn$1.move = function (struct) { + var cy = this._private.cy; + var eles = this; // just clean up refs, caches, etc. in the same way as when removing and then restoring + // (our calls to remove/restore do not remove from the graph or make events) + + var notifyRenderer = false; + var modifyPool = false; + + var toString = function toString(id) { + return id == null ? id : '' + id; + }; // id must be string + + + if (struct.source !== undefined || struct.target !== undefined) { + var srcId = toString(struct.source); + var tgtId = toString(struct.target); + var srcExists = srcId != null && cy.hasElementWithId(srcId); + var tgtExists = tgtId != null && cy.hasElementWithId(tgtId); + + if (srcExists || tgtExists) { + cy.batch(function () { + // avoid duplicate style updates + eles.remove(notifyRenderer, modifyPool); // clean up refs etc. + + eles.emitAndNotify('moveout'); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _data5 = ele._private.data; + + if (ele.isEdge()) { + if (srcExists) { + _data5.source = srcId; + } + + if (tgtExists) { + _data5.target = tgtId; + } + } + } + + eles.restore(notifyRenderer, modifyPool); // make new refs, style, etc. + }); + eles.emitAndNotify('move'); + } + } else if (struct.parent !== undefined) { + // move node to new parent + var parentId = toString(struct.parent); + var parentExists = parentId === null || cy.hasElementWithId(parentId); + + if (parentExists) { + var pidToAssign = parentId === null ? undefined : parentId; + cy.batch(function () { + // avoid duplicate style updates + var updated = eles.remove(notifyRenderer, modifyPool); // clean up refs etc. + + updated.emitAndNotify('moveout'); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _data6 = ele._private.data; + + if (ele.isNode()) { + _data6.parent = pidToAssign; + } + } + + updated.restore(notifyRenderer, modifyPool); // make new refs, style, etc. + }); + eles.emitAndNotify('move'); + } + } + + return this; +}; + +[elesfn$j, elesfn$i, elesfn$h, elesfn$g, elesfn$f, data, elesfn$d, dimensions, elesfn$9, elesfn$8, elesfn$7, elesfn$6, elesfn$5, elesfn$4, elesfn$3, elesfn$2].forEach(function (props) { + extend(elesfn$1, props); +}); + +var corefn$9 = { + add: function add(opts) { + var elements; + var cy = this; // add the elements + + if (elementOrCollection(opts)) { + var eles = opts; + + if (eles._private.cy === cy) { + // same instance => just restore + elements = eles.restore(); + } else { + // otherwise, copy from json + var jsons = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + jsons.push(ele.json()); + } + + elements = new Collection(cy, jsons); + } + } // specify an array of options + else if (array(opts)) { + var _jsons = opts; + elements = new Collection(cy, _jsons); + } // specify via opts.nodes and opts.edges + else if (plainObject(opts) && (array(opts.nodes) || array(opts.edges))) { + var elesByGroup = opts; + var _jsons2 = []; + var grs = ['nodes', 'edges']; + + for (var _i = 0, il = grs.length; _i < il; _i++) { + var group = grs[_i]; + var elesArray = elesByGroup[group]; + + if (array(elesArray)) { + for (var j = 0, jl = elesArray.length; j < jl; j++) { + var json = extend({ + group: group + }, elesArray[j]); + + _jsons2.push(json); + } + } + } + + elements = new Collection(cy, _jsons2); + } // specify options for one element + else { + var _json = opts; + elements = new Element(cy, _json).collection(); + } + + return elements; + }, + remove: function remove(collection) { + if (elementOrCollection(collection)) ; else if (string(collection)) { + var selector = collection; + collection = this.$(selector); + } + + return collection.remove(); + } +}; + +/* global Float32Array */ + +/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ +function generateCubicBezier(mX1, mY1, mX2, mY2) { + var NEWTON_ITERATIONS = 4, + NEWTON_MIN_SLOPE = 0.001, + SUBDIVISION_PRECISION = 0.0000001, + SUBDIVISION_MAX_ITERATIONS = 10, + kSplineTableSize = 11, + kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), + float32ArraySupported = typeof Float32Array !== 'undefined'; + /* Must contain four arguments. */ + + if (arguments.length !== 4) { + return false; + } + /* Arguments must be numbers. */ + + + for (var i = 0; i < 4; ++i) { + if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { + return false; + } + } + /* X values must be in the [0, 1] range. */ + + + mX1 = Math.min(mX1, 1); + mX2 = Math.min(mX2, 1); + mX1 = Math.max(mX1, 0); + mX2 = Math.max(mX2, 0); + var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); + + function A(aA1, aA2) { + return 1.0 - 3.0 * aA2 + 3.0 * aA1; + } + + function B(aA1, aA2) { + return 3.0 * aA2 - 6.0 * aA1; + } + + function C(aA1) { + return 3.0 * aA1; + } + + function calcBezier(aT, aA1, aA2) { + return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; + } + + function getSlope(aT, aA1, aA2) { + return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); + } + + function newtonRaphsonIterate(aX, aGuessT) { + for (var _i = 0; _i < NEWTON_ITERATIONS; ++_i) { + var currentSlope = getSlope(aGuessT, mX1, mX2); + + if (currentSlope === 0.0) { + return aGuessT; + } + + var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + aGuessT -= currentX / currentSlope; + } + + return aGuessT; + } + + function calcSampleValues() { + for (var _i2 = 0; _i2 < kSplineTableSize; ++_i2) { + mSampleValues[_i2] = calcBezier(_i2 * kSampleStepSize, mX1, mX2); + } + } + + function binarySubdivide(aX, aA, aB) { + var currentX, + currentT, + i = 0; + + do { + currentT = aA + (aB - aA) / 2.0; + currentX = calcBezier(currentT, mX1, mX2) - aX; + + if (currentX > 0.0) { + aB = currentT; + } else { + aA = currentT; + } + } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); + + return currentT; + } + + function getTForX(aX) { + var intervalStart = 0.0, + currentSample = 1, + lastSample = kSplineTableSize - 1; + + for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { + intervalStart += kSampleStepSize; + } + + --currentSample; + var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), + guessForT = intervalStart + dist * kSampleStepSize, + initialSlope = getSlope(guessForT, mX1, mX2); + + if (initialSlope >= NEWTON_MIN_SLOPE) { + return newtonRaphsonIterate(aX, guessForT); + } else if (initialSlope === 0.0) { + return guessForT; + } else { + return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); + } + } + + var _precomputed = false; + + function precompute() { + _precomputed = true; + + if (mX1 !== mY1 || mX2 !== mY2) { + calcSampleValues(); + } + } + + var f = function f(aX) { + if (!_precomputed) { + precompute(); + } + + if (mX1 === mY1 && mX2 === mY2) { + return aX; + } + + if (aX === 0) { + return 0; + } + + if (aX === 1) { + return 1; + } + + return calcBezier(getTForX(aX), mY1, mY2); + }; + + f.getControlPoints = function () { + return [{ + x: mX1, + y: mY1 + }, { + x: mX2, + y: mY2 + }]; + }; + + var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; + + f.toString = function () { + return str; + }; + + return f; +} + +/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ + +/* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass + then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ +var generateSpringRK4 = function () { + function springAccelerationForState(state) { + return -state.tension * state.x - state.friction * state.v; + } + + function springEvaluateStateWithDerivative(initialState, dt, derivative) { + var state = { + x: initialState.x + derivative.dx * dt, + v: initialState.v + derivative.dv * dt, + tension: initialState.tension, + friction: initialState.friction + }; + return { + dx: state.v, + dv: springAccelerationForState(state) + }; + } + + function springIntegrateState(state, dt) { + var a = { + dx: state.v, + dv: springAccelerationForState(state) + }, + b = springEvaluateStateWithDerivative(state, dt * 0.5, a), + c = springEvaluateStateWithDerivative(state, dt * 0.5, b), + d = springEvaluateStateWithDerivative(state, dt, c), + dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), + dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); + state.x = state.x + dxdt * dt; + state.v = state.v + dvdt * dt; + return state; + } + + return function springRK4Factory(tension, friction, duration) { + var initState = { + x: -1, + v: 0, + tension: null, + friction: null + }, + path = [0], + time_lapsed = 0, + tolerance = 1 / 10000, + DT = 16 / 1000, + have_duration, + dt, + last_state; + tension = parseFloat(tension) || 500; + friction = parseFloat(friction) || 20; + duration = duration || null; + initState.tension = tension; + initState.friction = friction; + have_duration = duration !== null; + /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ + + if (have_duration) { + /* Run the simulation without a duration. */ + time_lapsed = springRK4Factory(tension, friction); + /* Compute the adjusted time delta. */ + + dt = time_lapsed / duration * DT; + } else { + dt = DT; + } + + for (;;) { + /* Next/step function .*/ + last_state = springIntegrateState(last_state || initState, dt); + /* Store the position. */ + + path.push(1 + last_state.x); + time_lapsed += 16; + /* If the change threshold is reached, break. */ + + if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { + break; + } + } + /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the + computed path and returns a snapshot of the position according to a given percentComplete. */ + + + return !have_duration ? time_lapsed : function (percentComplete) { + return path[percentComplete * (path.length - 1) | 0]; + }; + }; +}(); + +var cubicBezier = function cubicBezier(t1, p1, t2, p2) { + var bezier = generateCubicBezier(t1, p1, t2, p2); + return function (start, end, percent) { + return start + (end - start) * bezier(percent); + }; +}; + +var easings = { + 'linear': function linear(start, end, percent) { + return start + (end - start) * percent; + }, + // default easings + 'ease': cubicBezier(0.25, 0.1, 0.25, 1), + 'ease-in': cubicBezier(0.42, 0, 1, 1), + 'ease-out': cubicBezier(0, 0, 0.58, 1), + 'ease-in-out': cubicBezier(0.42, 0, 0.58, 1), + // sine + 'ease-in-sine': cubicBezier(0.47, 0, 0.745, 0.715), + 'ease-out-sine': cubicBezier(0.39, 0.575, 0.565, 1), + 'ease-in-out-sine': cubicBezier(0.445, 0.05, 0.55, 0.95), + // quad + 'ease-in-quad': cubicBezier(0.55, 0.085, 0.68, 0.53), + 'ease-out-quad': cubicBezier(0.25, 0.46, 0.45, 0.94), + 'ease-in-out-quad': cubicBezier(0.455, 0.03, 0.515, 0.955), + // cubic + 'ease-in-cubic': cubicBezier(0.55, 0.055, 0.675, 0.19), + 'ease-out-cubic': cubicBezier(0.215, 0.61, 0.355, 1), + 'ease-in-out-cubic': cubicBezier(0.645, 0.045, 0.355, 1), + // quart + 'ease-in-quart': cubicBezier(0.895, 0.03, 0.685, 0.22), + 'ease-out-quart': cubicBezier(0.165, 0.84, 0.44, 1), + 'ease-in-out-quart': cubicBezier(0.77, 0, 0.175, 1), + // quint + 'ease-in-quint': cubicBezier(0.755, 0.05, 0.855, 0.06), + 'ease-out-quint': cubicBezier(0.23, 1, 0.32, 1), + 'ease-in-out-quint': cubicBezier(0.86, 0, 0.07, 1), + // expo + 'ease-in-expo': cubicBezier(0.95, 0.05, 0.795, 0.035), + 'ease-out-expo': cubicBezier(0.19, 1, 0.22, 1), + 'ease-in-out-expo': cubicBezier(1, 0, 0, 1), + // circ + 'ease-in-circ': cubicBezier(0.6, 0.04, 0.98, 0.335), + 'ease-out-circ': cubicBezier(0.075, 0.82, 0.165, 1), + 'ease-in-out-circ': cubicBezier(0.785, 0.135, 0.15, 0.86), + // user param easings... + 'spring': function spring(tension, friction, duration) { + if (duration === 0) { + // can't get a spring w/ duration 0 + return easings.linear; // duration 0 => jump to end so impl doesn't matter + } + + var spring = generateSpringRK4(tension, friction, duration); + return function (start, end, percent) { + return start + (end - start) * spring(percent); + }; + }, + 'cubic-bezier': cubicBezier +}; + +function getEasedValue(type, start, end, percent, easingFn) { + if (percent === 1) { + return end; + } + + if (start === end) { + return end; + } + + var val = easingFn(start, end, percent); + + if (type == null) { + return val; + } + + if (type.roundValue || type.color) { + val = Math.round(val); + } + + if (type.min !== undefined) { + val = Math.max(val, type.min); + } + + if (type.max !== undefined) { + val = Math.min(val, type.max); + } + + return val; +} + +function getValue(prop, spec) { + if (prop.pfValue != null || prop.value != null) { + if (prop.pfValue != null && (spec == null || spec.type.units !== '%')) { + return prop.pfValue; + } else { + return prop.value; + } + } else { + return prop; + } +} + +function ease(startProp, endProp, percent, easingFn, propSpec) { + var type = propSpec != null ? propSpec.type : null; + + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + + var start = getValue(startProp, propSpec); + var end = getValue(endProp, propSpec); + + if (number$1(start) && number$1(end)) { + return getEasedValue(type, start, end, percent, easingFn); + } else if (array(start) && array(end)) { + var easedArr = []; + + for (var i = 0; i < end.length; i++) { + var si = start[i]; + var ei = end[i]; + + if (si != null && ei != null) { + var val = getEasedValue(type, si, ei, percent, easingFn); + easedArr.push(val); + } else { + easedArr.push(ei); + } + } + + return easedArr; + } + + return undefined; +} + +function step$1(self, ani, now, isCore) { + var isEles = !isCore; + var _p = self._private; + var ani_p = ani._private; + var pEasing = ani_p.easing; + var startTime = ani_p.startTime; + var cy = isCore ? self : self.cy(); + var style = cy.style(); + + if (!ani_p.easingImpl) { + if (pEasing == null) { + // use default + ani_p.easingImpl = easings['linear']; + } else { + // then define w/ name + var easingVals; + + if (string(pEasing)) { + var easingProp = style.parse('transition-timing-function', pEasing); + easingVals = easingProp.value; + } else { + // then assume preparsed array + easingVals = pEasing; + } + + var name, args; + + if (string(easingVals)) { + name = easingVals; + args = []; + } else { + name = easingVals[1]; + args = easingVals.slice(2).map(function (n) { + return +n; + }); + } + + if (args.length > 0) { + // create with args + if (name === 'spring') { + args.push(ani_p.duration); // need duration to generate spring + } + + ani_p.easingImpl = easings[name].apply(null, args); + } else { + // static impl by name + ani_p.easingImpl = easings[name]; + } + } + } + + var easing = ani_p.easingImpl; + var percent; + + if (ani_p.duration === 0) { + percent = 1; + } else { + percent = (now - startTime) / ani_p.duration; + } + + if (ani_p.applying) { + percent = ani_p.progress; + } + + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + + if (ani_p.delay == null) { + // then update + var startPos = ani_p.startPosition; + var endPos = ani_p.position; + + if (endPos && isEles && !self.locked()) { + var newPos = {}; + + if (valid(startPos.x, endPos.x)) { + newPos.x = ease(startPos.x, endPos.x, percent, easing); + } + + if (valid(startPos.y, endPos.y)) { + newPos.y = ease(startPos.y, endPos.y, percent, easing); + } + + self.position(newPos); + } + + var startPan = ani_p.startPan; + var endPan = ani_p.pan; + var pan = _p.pan; + var animatingPan = endPan != null && isCore; + + if (animatingPan) { + if (valid(startPan.x, endPan.x)) { + pan.x = ease(startPan.x, endPan.x, percent, easing); + } + + if (valid(startPan.y, endPan.y)) { + pan.y = ease(startPan.y, endPan.y, percent, easing); + } + + self.emit('pan'); + } + + var startZoom = ani_p.startZoom; + var endZoom = ani_p.zoom; + var animatingZoom = endZoom != null && isCore; + + if (animatingZoom) { + if (valid(startZoom, endZoom)) { + _p.zoom = bound(_p.minZoom, ease(startZoom, endZoom, percent, easing), _p.maxZoom); + } + + self.emit('zoom'); + } + + if (animatingPan || animatingZoom) { + self.emit('viewport'); + } + + var props = ani_p.style; + + if (props && props.length > 0 && isEles) { + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + var _name = prop.name; + var end = prop; + var start = ani_p.startStyle[_name]; + var propSpec = style.properties[start.name]; + var easedVal = ease(start, end, percent, easing, propSpec); + style.overrideBypass(self, _name, easedVal); + } // for props + + + self.emit('style'); + } // if + + } + + ani_p.progress = percent; + return percent; +} + +function valid(start, end) { + if (start == null || end == null) { + return false; + } + + if (number$1(start) && number$1(end)) { + return true; + } else if (start && end) { + return true; + } + + return false; +} + +function startAnimation(self, ani, now, isCore) { + var ani_p = ani._private; + ani_p.started = true; + ani_p.startTime = now - ani_p.progress * ani_p.duration; +} + +function stepAll(now, cy) { + var eles = cy._private.aniEles; + var doneEles = []; + + function stepOne(ele, isCore) { + var _p = ele._private; + var current = _p.animation.current; + var queue = _p.animation.queue; + var ranAnis = false; // if nothing currently animating, get something from the queue + + if (current.length === 0) { + var next = queue.shift(); + + if (next) { + current.push(next); + } + } + + var callbacks = function callbacks(_callbacks) { + for (var j = _callbacks.length - 1; j >= 0; j--) { + var cb = _callbacks[j]; + cb(); + } + + _callbacks.splice(0, _callbacks.length); + }; // step and remove if done + + + for (var i = current.length - 1; i >= 0; i--) { + var ani = current[i]; + var ani_p = ani._private; + + if (ani_p.stopped) { + current.splice(i, 1); + ani_p.hooked = false; + ani_p.playing = false; + ani_p.started = false; + callbacks(ani_p.frames); + continue; + } + + if (!ani_p.playing && !ani_p.applying) { + continue; + } // an apply() while playing shouldn't do anything + + + if (ani_p.playing && ani_p.applying) { + ani_p.applying = false; + } + + if (!ani_p.started) { + startAnimation(ele, ani, now); + } + + step$1(ele, ani, now, isCore); + + if (ani_p.applying) { + ani_p.applying = false; + } + + callbacks(ani_p.frames); + + if (ani_p.step != null) { + ani_p.step(now); + } + + if (ani.completed()) { + current.splice(i, 1); + ani_p.hooked = false; + ani_p.playing = false; + ani_p.started = false; + callbacks(ani_p.completes); + } + + ranAnis = true; + } + + if (!isCore && current.length === 0 && queue.length === 0) { + doneEles.push(ele); + } + + return ranAnis; + } // stepElement + // handle all eles + + + var ranEleAni = false; + + for (var e = 0; e < eles.length; e++) { + var ele = eles[e]; + var handledThisEle = stepOne(ele); + ranEleAni = ranEleAni || handledThisEle; + } // each element + + + var ranCoreAni = stepOne(cy, true); // notify renderer + + if (ranEleAni || ranCoreAni) { + if (eles.length > 0) { + cy.notify('draw', eles); + } else { + cy.notify('draw'); + } + } // remove elements from list of currently animating if its queues are empty + + + eles.unmerge(doneEles); + cy.emit('step'); +} // stepAll + +var corefn$8 = { + // pull in animation functions + animate: define.animate(), + animation: define.animation(), + animated: define.animated(), + clearQueue: define.clearQueue(), + delay: define.delay(), + delayAnimation: define.delayAnimation(), + stop: define.stop(), + addToAnimationPool: function addToAnimationPool(eles) { + var cy = this; + + if (!cy.styleEnabled()) { + return; + } // save cycles when no style used + + + cy._private.aniEles.merge(eles); + }, + stopAnimationLoop: function stopAnimationLoop() { + this._private.animationsRunning = false; + }, + startAnimationLoop: function startAnimationLoop() { + var cy = this; + cy._private.animationsRunning = true; + + if (!cy.styleEnabled()) { + return; + } // save cycles when no style used + // NB the animation loop will exec in headless environments if style enabled + // and explicit cy.destroy() is necessary to stop the loop + + + function headlessStep() { + if (!cy._private.animationsRunning) { + return; + } + + requestAnimationFrame(function animationStep(now) { + stepAll(now, cy); + headlessStep(); + }); + } + + var renderer = cy.renderer(); + + if (renderer && renderer.beforeRender) { + // let the renderer schedule animations + renderer.beforeRender(function rendererAnimationStep(willDraw, now) { + stepAll(now, cy); + }, renderer.beforeRenderPriorities.animations); + } else { + // manage the animation loop ourselves + headlessStep(); // first call + } + } +}; + +var emitterOptions = { + qualifierCompare: function qualifierCompare(selector1, selector2) { + if (selector1 == null || selector2 == null) { + return selector1 == null && selector2 == null; + } else { + return selector1.sameText(selector2); + } + }, + eventMatches: function eventMatches(cy, listener, eventObj) { + var selector = listener.qualifier; + + if (selector != null) { + return cy !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target); + } + + return true; + }, + addEventFields: function addEventFields(cy, evt) { + evt.cy = cy; + evt.target = cy; + }, + callbackContext: function callbackContext(cy, listener, eventObj) { + return listener.qualifier != null ? eventObj.target : cy; + } +}; + +var argSelector = function argSelector(arg) { + if (string(arg)) { + return new Selector(arg); + } else { + return arg; + } +}; + +var elesfn = { + createEmitter: function createEmitter() { + var _p = this._private; + + if (!_p.emitter) { + _p.emitter = new Emitter(emitterOptions, this); + } + + return this; + }, + emitter: function emitter() { + return this._private.emitter; + }, + on: function on(events, selector, callback) { + this.emitter().on(events, argSelector(selector), callback); + return this; + }, + removeListener: function removeListener(events, selector, callback) { + this.emitter().removeListener(events, argSelector(selector), callback); + return this; + }, + removeAllListeners: function removeAllListeners() { + this.emitter().removeAllListeners(); + return this; + }, + one: function one(events, selector, callback) { + this.emitter().one(events, argSelector(selector), callback); + return this; + }, + once: function once(events, selector, callback) { + this.emitter().one(events, argSelector(selector), callback); + return this; + }, + emit: function emit(events, extraParams) { + this.emitter().emit(events, extraParams); + return this; + }, + emitAndNotify: function emitAndNotify(event, eles) { + this.emit(event); + this.notify(event, eles); + return this; + } +}; +define.eventAliasesOn(elesfn); + +var corefn$7 = { + png: function png(options) { + var renderer = this._private.renderer; + options = options || {}; + return renderer.png(options); + }, + jpg: function jpg(options) { + var renderer = this._private.renderer; + options = options || {}; + options.bg = options.bg || '#fff'; + return renderer.jpg(options); + } +}; +corefn$7.jpeg = corefn$7.jpg; + +var corefn$6 = { + layout: function layout(options) { + var cy = this; + + if (options == null) { + error('Layout options must be specified to make a layout'); + return; + } + + if (options.name == null) { + error('A `name` must be specified to make a layout'); + return; + } + + var name = options.name; + var Layout = cy.extension('layout', name); + + if (Layout == null) { + error('No such layout `' + name + '` found. Did you forget to import it and `cytoscape.use()` it?'); + return; + } + + var eles; + + if (string(options.eles)) { + eles = cy.$(options.eles); + } else { + eles = options.eles != null ? options.eles : cy.$(); + } + + var layout = new Layout(extend({}, options, { + cy: cy, + eles: eles + })); + return layout; + } +}; +corefn$6.createLayout = corefn$6.makeLayout = corefn$6.layout; + +var corefn$5 = { + notify: function notify(eventName, eventEles) { + var _p = this._private; + + if (this.batching()) { + _p.batchNotifications = _p.batchNotifications || {}; + var eles = _p.batchNotifications[eventName] = _p.batchNotifications[eventName] || this.collection(); + + if (eventEles != null) { + eles.merge(eventEles); + } + + return; // notifications are disabled during batching + } + + if (!_p.notificationsEnabled) { + return; + } // exit on disabled + + + var renderer = this.renderer(); // exit if destroy() called on core or renderer in between frames #1499 #1528 + + if (this.destroyed() || !renderer) { + return; + } + + renderer.notify(eventName, eventEles); + }, + notifications: function notifications(bool) { + var p = this._private; + + if (bool === undefined) { + return p.notificationsEnabled; + } else { + p.notificationsEnabled = bool ? true : false; + } + + return this; + }, + noNotifications: function noNotifications(callback) { + this.notifications(false); + callback(); + this.notifications(true); + }, + batching: function batching() { + return this._private.batchCount > 0; + }, + startBatch: function startBatch() { + var _p = this._private; + + if (_p.batchCount == null) { + _p.batchCount = 0; + } + + if (_p.batchCount === 0) { + _p.batchStyleEles = this.collection(); + _p.batchNotifications = {}; + } + + _p.batchCount++; + return this; + }, + endBatch: function endBatch() { + var _p = this._private; + + if (_p.batchCount === 0) { + return this; + } + + _p.batchCount--; + + if (_p.batchCount === 0) { + // update style for dirty eles + _p.batchStyleEles.updateStyle(); + + var renderer = this.renderer(); // notify the renderer of queued eles and event types + + Object.keys(_p.batchNotifications).forEach(function (eventName) { + var eles = _p.batchNotifications[eventName]; + + if (eles.empty()) { + renderer.notify(eventName); + } else { + renderer.notify(eventName, eles); + } + }); + } + + return this; + }, + batch: function batch(callback) { + this.startBatch(); + callback(); + this.endBatch(); + return this; + }, + // for backwards compatibility + batchData: function batchData(map) { + var cy = this; + return this.batch(function () { + var ids = Object.keys(map); + + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + var data = map[id]; + var ele = cy.getElementById(id); + ele.data(data); + } + }); + } +}; + +var rendererDefaults = defaults$g({ + hideEdgesOnViewport: false, + textureOnViewport: false, + motionBlur: false, + motionBlurOpacity: 0.05, + pixelRatio: undefined, + desktopTapThreshold: 4, + touchTapThreshold: 8, + wheelSensitivity: 1, + debug: false, + showFps: false +}); +var corefn$4 = { + renderTo: function renderTo(context, zoom, pan, pxRatio) { + var r = this._private.renderer; + r.renderTo(context, zoom, pan, pxRatio); + return this; + }, + renderer: function renderer() { + return this._private.renderer; + }, + forceRender: function forceRender() { + this.notify('draw'); + return this; + }, + resize: function resize() { + this.invalidateSize(); + this.emitAndNotify('resize'); + return this; + }, + initRenderer: function initRenderer(options) { + var cy = this; + var RendererProto = cy.extension('renderer', options.name); + + if (RendererProto == null) { + error("Can not initialise: No such renderer `".concat(options.name, "` found. Did you forget to import it and `cytoscape.use()` it?")); + return; + } + + if (options.wheelSensitivity !== undefined) { + warn("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine."); + } + + var rOpts = rendererDefaults(options); + rOpts.cy = cy; + cy._private.renderer = new RendererProto(rOpts); + this.notify('init'); + }, + destroyRenderer: function destroyRenderer() { + var cy = this; + cy.notify('destroy'); // destroy the renderer + + var domEle = cy.container(); + + if (domEle) { + domEle._cyreg = null; + + while (domEle.childNodes.length > 0) { + domEle.removeChild(domEle.childNodes[0]); + } + } + + cy._private.renderer = null; // to be extra safe, remove the ref + + cy.mutableElements().forEach(function (ele) { + var _p = ele._private; + _p.rscratch = {}; + _p.rstyle = {}; + _p.animation.current = []; + _p.animation.queue = []; + }); + }, + onRender: function onRender(fn) { + return this.on('render', fn); + }, + offRender: function offRender(fn) { + return this.off('render', fn); + } +}; +corefn$4.invalidateDimensions = corefn$4.resize; + +var corefn$3 = { + // get a collection + // - empty collection on no args + // - collection of elements in the graph on selector arg + // - guarantee a returned collection when elements or collection specified + collection: function collection(eles, opts) { + if (string(eles)) { + return this.$(eles); + } else if (elementOrCollection(eles)) { + return eles.collection(); + } else if (array(eles)) { + if (!opts) { + opts = {}; + } + + return new Collection(this, eles, opts.unique, opts.removed); + } + + return new Collection(this); + }, + nodes: function nodes(selector) { + var nodes = this.$(function (ele) { + return ele.isNode(); + }); + + if (selector) { + return nodes.filter(selector); + } + + return nodes; + }, + edges: function edges(selector) { + var edges = this.$(function (ele) { + return ele.isEdge(); + }); + + if (selector) { + return edges.filter(selector); + } + + return edges; + }, + // search the graph like jQuery + $: function $(selector) { + var eles = this._private.elements; + + if (selector) { + return eles.filter(selector); + } else { + return eles.spawnSelf(); + } + }, + mutableElements: function mutableElements() { + return this._private.elements; + } +}; // aliases + +corefn$3.elements = corefn$3.filter = corefn$3.$; + +var styfn$8 = {}; // keys for style blocks, e.g. ttfftt + +var TRUE = 't'; +var FALSE = 'f'; // (potentially expensive calculation) +// apply the style to the element based on +// - its bypass +// - what selectors match it + +styfn$8.apply = function (eles) { + var self = this; + var _p = self._private; + var cy = _p.cy; + var updatedEles = cy.collection(); + + for (var ie = 0; ie < eles.length; ie++) { + var ele = eles[ie]; + var cxtMeta = self.getContextMeta(ele); + + if (cxtMeta.empty) { + continue; + } + + var cxtStyle = self.getContextStyle(cxtMeta); + var app = self.applyContextStyle(cxtMeta, cxtStyle, ele); + + if (ele._private.appliedInitStyle) { + self.updateTransitions(ele, app.diffProps); + } else { + ele._private.appliedInitStyle = true; + } + + var hintsDiff = self.updateStyleHints(ele); + + if (hintsDiff) { + updatedEles.push(ele); + } + } // for elements + + + return updatedEles; +}; + +styfn$8.getPropertiesDiff = function (oldCxtKey, newCxtKey) { + var self = this; + var cache = self._private.propDiffs = self._private.propDiffs || {}; + var dualCxtKey = oldCxtKey + '-' + newCxtKey; + var cachedVal = cache[dualCxtKey]; + + if (cachedVal) { + return cachedVal; + } + + var diffProps = []; + var addedProp = {}; + + for (var i = 0; i < self.length; i++) { + var cxt = self[i]; + var oldHasCxt = oldCxtKey[i] === TRUE; + var newHasCxt = newCxtKey[i] === TRUE; + var cxtHasDiffed = oldHasCxt !== newHasCxt; + var cxtHasMappedProps = cxt.mappedProperties.length > 0; + + if (cxtHasDiffed || newHasCxt && cxtHasMappedProps) { + var props = void 0; + + if (cxtHasDiffed && cxtHasMappedProps) { + props = cxt.properties; // suffices b/c mappedProperties is a subset of properties + } else if (cxtHasDiffed) { + props = cxt.properties; // need to check them all + } else if (cxtHasMappedProps) { + props = cxt.mappedProperties; // only need to check mapped + } + + for (var j = 0; j < props.length; j++) { + var prop = props[j]; + var name = prop.name; // if a later context overrides this property, then the fact that this context has switched/diffed doesn't matter + // (semi expensive check since it makes this function O(n^2) on context length, but worth it since overall result + // is cached) + + var laterCxtOverrides = false; + + for (var k = i + 1; k < self.length; k++) { + var laterCxt = self[k]; + var hasLaterCxt = newCxtKey[k] === TRUE; + + if (!hasLaterCxt) { + continue; + } // can't override unless the context is active + + + laterCxtOverrides = laterCxt.properties[prop.name] != null; + + if (laterCxtOverrides) { + break; + } // exit early as long as one later context overrides + + } + + if (!addedProp[name] && !laterCxtOverrides) { + addedProp[name] = true; + diffProps.push(name); + } + } // for props + + } // if + + } // for contexts + + + cache[dualCxtKey] = diffProps; + return diffProps; +}; + +styfn$8.getContextMeta = function (ele) { + var self = this; + var cxtKey = ''; + var diffProps; + var prevKey = ele._private.styleCxtKey || ''; // get the cxt key + + for (var i = 0; i < self.length; i++) { + var context = self[i]; + var contextSelectorMatches = context.selector && context.selector.matches(ele); // NB: context.selector may be null for 'core' + + if (contextSelectorMatches) { + cxtKey += TRUE; + } else { + cxtKey += FALSE; + } + } // for context + + + diffProps = self.getPropertiesDiff(prevKey, cxtKey); + ele._private.styleCxtKey = cxtKey; + return { + key: cxtKey, + diffPropNames: diffProps, + empty: diffProps.length === 0 + }; +}; // gets a computed ele style object based on matched contexts + + +styfn$8.getContextStyle = function (cxtMeta) { + var cxtKey = cxtMeta.key; + var self = this; + var cxtStyles = this._private.contextStyles = this._private.contextStyles || {}; // if already computed style, returned cached copy + + if (cxtStyles[cxtKey]) { + return cxtStyles[cxtKey]; + } + + var style = { + _private: { + key: cxtKey + } + }; + + for (var i = 0; i < self.length; i++) { + var cxt = self[i]; + var hasCxt = cxtKey[i] === TRUE; + + if (!hasCxt) { + continue; + } + + for (var j = 0; j < cxt.properties.length; j++) { + var prop = cxt.properties[j]; + style[prop.name] = prop; + } + } + + cxtStyles[cxtKey] = style; + return style; +}; + +styfn$8.applyContextStyle = function (cxtMeta, cxtStyle, ele) { + var self = this; + var diffProps = cxtMeta.diffPropNames; + var retDiffProps = {}; + var types = self.types; + + for (var i = 0; i < diffProps.length; i++) { + var diffPropName = diffProps[i]; + var cxtProp = cxtStyle[diffPropName]; + var eleProp = ele.pstyle(diffPropName); + + if (!cxtProp) { + // no context prop means delete + if (!eleProp) { + continue; // no existing prop means nothing needs to be removed + // nb affects initial application on mapped values like control-point-distances + } else if (eleProp.bypass) { + cxtProp = { + name: diffPropName, + deleteBypassed: true + }; + } else { + cxtProp = { + name: diffPropName, + "delete": true + }; + } + } // save cycles when the context prop doesn't need to be applied + + + if (eleProp === cxtProp) { + continue; + } // save cycles when a mapped context prop doesn't need to be applied + + + if (cxtProp.mapped === types.fn // context prop is function mapper + && eleProp != null // some props can be null even by default (e.g. a prop that overrides another one) + && eleProp.mapping != null // ele prop is a concrete value from from a mapper + && eleProp.mapping.value === cxtProp.value // the current prop on the ele is a flat prop value for the function mapper + ) { + // NB don't write to cxtProp, as it's shared among eles (stored in stylesheet) + var mapping = eleProp.mapping; // can write to mapping, as it's a per-ele copy + + var fnValue = mapping.fnValue = cxtProp.value(ele); // temporarily cache the value in case of a miss + + if (fnValue === mapping.prevFnValue) { + continue; + } + } + + var retDiffProp = retDiffProps[diffPropName] = { + prev: eleProp + }; + self.applyParsedProperty(ele, cxtProp); + retDiffProp.next = ele.pstyle(diffPropName); + + if (retDiffProp.next && retDiffProp.next.bypass) { + retDiffProp.next = retDiffProp.next.bypassed; + } + } + + return { + diffProps: retDiffProps + }; +}; + +styfn$8.updateStyleHints = function (ele) { + var _p = ele._private; + var self = this; + var propNames = self.propertyGroupNames; + var propGrKeys = self.propertyGroupKeys; + + var propHash = function propHash(ele, propNames, seedKey) { + return self.getPropertiesHash(ele, propNames, seedKey); + }; + + var oldStyleKey = _p.styleKey; + + if (ele.removed()) { + return false; + } + + var isNode = _p.group === 'nodes'; // get the style key hashes per prop group + // but lazily -- only use non-default prop values to reduce the number of hashes + // + + var overriddenStyles = ele._private.style; + propNames = Object.keys(overriddenStyles); + + for (var i = 0; i < propGrKeys.length; i++) { + var grKey = propGrKeys[i]; + _p.styleKeys[grKey] = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]; + } + + var updateGrKey1 = function updateGrKey1(val, grKey) { + return _p.styleKeys[grKey][0] = hashInt(val, _p.styleKeys[grKey][0]); + }; + + var updateGrKey2 = function updateGrKey2(val, grKey) { + return _p.styleKeys[grKey][1] = hashIntAlt(val, _p.styleKeys[grKey][1]); + }; + + var updateGrKey = function updateGrKey(val, grKey) { + updateGrKey1(val, grKey); + updateGrKey2(val, grKey); + }; + + var updateGrKeyWStr = function updateGrKeyWStr(strVal, grKey) { + for (var j = 0; j < strVal.length; j++) { + var ch = strVal.charCodeAt(j); + updateGrKey1(ch, grKey); + updateGrKey2(ch, grKey); + } + }; // - hashing works on 32 bit ints b/c we use bitwise ops + // - small numbers get cut off (e.g. 0.123 is seen as 0 by the hashing function) + // - raise up small numbers so more significant digits are seen by hashing + // - make small numbers larger than a normal value to avoid collisions + // - works in practice and it's relatively cheap + + + var N = 2000000000; + + var cleanNum = function cleanNum(val) { + return -128 < val && val < 128 && Math.floor(val) !== val ? N - (val * 1024 | 0) : val; + }; + + for (var _i = 0; _i < propNames.length; _i++) { + var name = propNames[_i]; + var parsedProp = overriddenStyles[name]; + + if (parsedProp == null) { + continue; + } + + var propInfo = this.properties[name]; + var type = propInfo.type; + var _grKey = propInfo.groupKey; + var normalizedNumberVal = void 0; + + if (propInfo.hashOverride != null) { + normalizedNumberVal = propInfo.hashOverride(ele, parsedProp); + } else if (parsedProp.pfValue != null) { + normalizedNumberVal = parsedProp.pfValue; + } // might not be a number if it allows enums + + + var numberVal = propInfo.enums == null ? parsedProp.value : null; + var haveNormNum = normalizedNumberVal != null; + var haveUnitedNum = numberVal != null; + var haveNum = haveNormNum || haveUnitedNum; + var units = parsedProp.units; // numbers are cheaper to hash than strings + // 1 hash op vs n hash ops (for length n string) + + if (type.number && haveNum && !type.multiple) { + var v = haveNormNum ? normalizedNumberVal : numberVal; + updateGrKey(cleanNum(v), _grKey); + + if (!haveNormNum && units != null) { + updateGrKeyWStr(units, _grKey); + } + } else { + updateGrKeyWStr(parsedProp.strValue, _grKey); + } + } // overall style key + // + + + var hash = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]; + + for (var _i2 = 0; _i2 < propGrKeys.length; _i2++) { + var _grKey2 = propGrKeys[_i2]; + var grHash = _p.styleKeys[_grKey2]; + hash[0] = hashInt(grHash[0], hash[0]); + hash[1] = hashIntAlt(grHash[1], hash[1]); + } + + _p.styleKey = combineHashes(hash[0], hash[1]); // label dims + // + + var sk = _p.styleKeys; + _p.labelDimsKey = combineHashesArray(sk.labelDimensions); + var labelKeys = propHash(ele, ['label'], sk.labelDimensions); + _p.labelKey = combineHashesArray(labelKeys); + _p.labelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, labelKeys)); + + if (!isNode) { + var sourceLabelKeys = propHash(ele, ['source-label'], sk.labelDimensions); + _p.sourceLabelKey = combineHashesArray(sourceLabelKeys); + _p.sourceLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, sourceLabelKeys)); + var targetLabelKeys = propHash(ele, ['target-label'], sk.labelDimensions); + _p.targetLabelKey = combineHashesArray(targetLabelKeys); + _p.targetLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, targetLabelKeys)); + } // node + // + + + if (isNode) { + var _p$styleKeys = _p.styleKeys, + nodeBody = _p$styleKeys.nodeBody, + nodeBorder = _p$styleKeys.nodeBorder, + backgroundImage = _p$styleKeys.backgroundImage, + compound = _p$styleKeys.compound, + pie = _p$styleKeys.pie; + var nodeKeys = [nodeBody, nodeBorder, backgroundImage, compound, pie].filter(function (k) { + return k != null; + }).reduce(hashArrays, [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]); + _p.nodeKey = combineHashesArray(nodeKeys); + _p.hasPie = pie != null && pie[0] !== DEFAULT_HASH_SEED && pie[1] !== DEFAULT_HASH_SEED_ALT; + } + + return oldStyleKey !== _p.styleKey; +}; + +styfn$8.clearStyleHints = function (ele) { + var _p = ele._private; + _p.styleCxtKey = ''; + _p.styleKeys = {}; + _p.styleKey = null; + _p.labelKey = null; + _p.labelStyleKey = null; + _p.sourceLabelKey = null; + _p.sourceLabelStyleKey = null; + _p.targetLabelKey = null; + _p.targetLabelStyleKey = null; + _p.nodeKey = null; + _p.hasPie = null; +}; // apply a property to the style (for internal use) +// returns whether application was successful +// +// now, this function flattens the property, and here's how: +// +// for parsedProp:{ bypass: true, deleteBypass: true } +// no property is generated, instead the bypass property in the +// element's style is replaced by what's pointed to by the `bypassed` +// field in the bypass property (i.e. restoring the property the +// bypass was overriding) +// +// for parsedProp:{ mapped: truthy } +// the generated flattenedProp:{ mapping: prop } +// +// for parsedProp:{ bypass: true } +// the generated flattenedProp:{ bypassed: parsedProp } + + +styfn$8.applyParsedProperty = function (ele, parsedProp) { + var self = this; + var prop = parsedProp; + var style = ele._private.style; + var flatProp; + var types = self.types; + var type = self.properties[prop.name].type; + var propIsBypass = prop.bypass; + var origProp = style[prop.name]; + var origPropIsBypass = origProp && origProp.bypass; + var _p = ele._private; + var flatPropMapping = 'mapping'; + + var getVal = function getVal(p) { + if (p == null) { + return null; + } else if (p.pfValue != null) { + return p.pfValue; + } else { + return p.value; + } + }; + + var checkTriggers = function checkTriggers() { + var fromVal = getVal(origProp); + var toVal = getVal(prop); + self.checkTriggers(ele, prop.name, fromVal, toVal); + }; + + if (prop && prop.name.substr(0, 3) === 'pie') { + warn('The pie style properties are deprecated. Create charts using background images instead.'); + } // edge sanity checks to prevent the client from making serious mistakes + + + if (parsedProp.name === 'curve-style' && ele.isEdge() && ( // loops must be bundled beziers + parsedProp.value !== 'bezier' && ele.isLoop() || // edges connected to compound nodes can not be haystacks + parsedProp.value === 'haystack' && (ele.source().isParent() || ele.target().isParent()))) { + prop = parsedProp = this.parse(parsedProp.name, 'bezier', propIsBypass); + } + + if (prop["delete"]) { + // delete the property and use the default value on falsey value + style[prop.name] = undefined; + checkTriggers(); + return true; + } + + if (prop.deleteBypassed) { + // delete the property that the + if (!origProp) { + checkTriggers(); + return true; // can't delete if no prop + } else if (origProp.bypass) { + // delete bypassed + origProp.bypassed = undefined; + checkTriggers(); + return true; + } else { + return false; // we're unsuccessful deleting the bypassed + } + } // check if we need to delete the current bypass + + + if (prop.deleteBypass) { + // then this property is just here to indicate we need to delete + if (!origProp) { + checkTriggers(); + return true; // property is already not defined + } else if (origProp.bypass) { + // then replace the bypass property with the original + // because the bypassed property was already applied (and therefore parsed), we can just replace it (no reapplying necessary) + style[prop.name] = origProp.bypassed; + checkTriggers(); + return true; + } else { + return false; // we're unsuccessful deleting the bypass + } + } + + var printMappingErr = function printMappingErr() { + warn('Do not assign mappings to elements without corresponding data (i.e. ele `' + ele.id() + '` has no mapping for property `' + prop.name + '` with data field `' + prop.field + '`); try a `[' + prop.field + ']` selector to limit scope to elements with `' + prop.field + '` defined'); + }; // put the property in the style objects + + + switch (prop.mapped) { + // flatten the property if mapped + case types.mapData: + { + // flatten the field (e.g. data.foo.bar) + var fields = prop.field.split('.'); + var fieldVal = _p.data; + + for (var i = 0; i < fields.length && fieldVal; i++) { + var field = fields[i]; + fieldVal = fieldVal[field]; + } + + if (fieldVal == null) { + printMappingErr(); + return false; + } + + var percent; + + if (!number$1(fieldVal)) { + // then don't apply and fall back on the existing style + warn('Do not use continuous mappers without specifying numeric data (i.e. `' + prop.field + ': ' + fieldVal + '` for `' + ele.id() + '` is non-numeric)'); + return false; + } else { + var fieldWidth = prop.fieldMax - prop.fieldMin; + + if (fieldWidth === 0) { + // safety check -- not strictly necessary as no props of zero range should be passed here + percent = 0; + } else { + percent = (fieldVal - prop.fieldMin) / fieldWidth; + } + } // make sure to bound percent value + + + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + + if (type.color) { + var r1 = prop.valueMin[0]; + var r2 = prop.valueMax[0]; + var g1 = prop.valueMin[1]; + var g2 = prop.valueMax[1]; + var b1 = prop.valueMin[2]; + var b2 = prop.valueMax[2]; + var a1 = prop.valueMin[3] == null ? 1 : prop.valueMin[3]; + var a2 = prop.valueMax[3] == null ? 1 : prop.valueMax[3]; + var clr = [Math.round(r1 + (r2 - r1) * percent), Math.round(g1 + (g2 - g1) * percent), Math.round(b1 + (b2 - b1) * percent), Math.round(a1 + (a2 - a1) * percent)]; + flatProp = { + // colours are simple, so just create the flat property instead of expensive string parsing + bypass: prop.bypass, + // we're a bypass if the mapping property is a bypass + name: prop.name, + value: clr, + strValue: 'rgb(' + clr[0] + ', ' + clr[1] + ', ' + clr[2] + ')' + }; + } else if (type.number) { + var calcValue = prop.valueMin + (prop.valueMax - prop.valueMin) * percent; + flatProp = this.parse(prop.name, calcValue, prop.bypass, flatPropMapping); + } else { + return false; // can only map to colours and numbers + } + + if (!flatProp) { + // if we can't flatten the property, then don't apply the property and fall back on the existing style + printMappingErr(); + return false; + } + + flatProp.mapping = prop; // keep a reference to the mapping + + prop = flatProp; // the flattened (mapped) property is the one we want + + break; + } + // direct mapping + + case types.data: + { + // flatten the field (e.g. data.foo.bar) + var _fields = prop.field.split('.'); + + var _fieldVal = _p.data; + + for (var _i3 = 0; _i3 < _fields.length && _fieldVal; _i3++) { + var _field = _fields[_i3]; + _fieldVal = _fieldVal[_field]; + } + + if (_fieldVal != null) { + flatProp = this.parse(prop.name, _fieldVal, prop.bypass, flatPropMapping); + } + + if (!flatProp) { + // if we can't flatten the property, then don't apply and fall back on the existing style + printMappingErr(); + return false; + } + + flatProp.mapping = prop; // keep a reference to the mapping + + prop = flatProp; // the flattened (mapped) property is the one we want + + break; + } + + case types.fn: + { + var fn = prop.value; + var fnRetVal = prop.fnValue != null ? prop.fnValue : fn(ele); // check for cached value before calling function + + prop.prevFnValue = fnRetVal; + + if (fnRetVal == null) { + warn('Custom function mappers may not return null (i.e. `' + prop.name + '` for ele `' + ele.id() + '` is null)'); + return false; + } + + flatProp = this.parse(prop.name, fnRetVal, prop.bypass, flatPropMapping); + + if (!flatProp) { + warn('Custom function mappers may not return invalid values for the property type (i.e. `' + prop.name + '` for ele `' + ele.id() + '` is invalid)'); + return false; + } + + flatProp.mapping = copy(prop); // keep a reference to the mapping + + prop = flatProp; // the flattened (mapped) property is the one we want + + break; + } + + case undefined: + break; + // just set the property + + default: + return false; + // not a valid mapping + } // if the property is a bypass property, then link the resultant property to the original one + + + if (propIsBypass) { + if (origPropIsBypass) { + // then this bypass overrides the existing one + prop.bypassed = origProp.bypassed; // steal bypassed prop from old bypass + } else { + // then link the orig prop to the new bypass + prop.bypassed = origProp; + } + + style[prop.name] = prop; // and set + } else { + // prop is not bypass + if (origPropIsBypass) { + // then keep the orig prop (since it's a bypass) and link to the new prop + origProp.bypassed = prop; + } else { + // then just replace the old prop with the new one + style[prop.name] = prop; + } + } + + checkTriggers(); + return true; +}; + +styfn$8.cleanElements = function (eles, keepBypasses) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + this.clearStyleHints(ele); + ele.dirtyCompoundBoundsCache(); + ele.dirtyBoundingBoxCache(); + + if (!keepBypasses) { + ele._private.style = {}; + } else { + var style = ele._private.style; + var propNames = Object.keys(style); + + for (var j = 0; j < propNames.length; j++) { + var propName = propNames[j]; + var eleProp = style[propName]; + + if (eleProp != null) { + if (eleProp.bypass) { + eleProp.bypassed = null; + } else { + style[propName] = null; + } + } + } + } + } +}; // updates the visual style for all elements (useful for manual style modification after init) + + +styfn$8.update = function () { + var cy = this._private.cy; + var eles = cy.mutableElements(); + eles.updateStyle(); +}; // diffProps : { name => { prev, next } } + + +styfn$8.updateTransitions = function (ele, diffProps) { + var self = this; + var _p = ele._private; + var props = ele.pstyle('transition-property').value; + var duration = ele.pstyle('transition-duration').pfValue; + var delay = ele.pstyle('transition-delay').pfValue; + + if (props.length > 0 && duration > 0) { + var style = {}; // build up the style to animate towards + + var anyPrev = false; + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + var styProp = ele.pstyle(prop); + var diffProp = diffProps[prop]; + + if (!diffProp) { + continue; + } + + var prevProp = diffProp.prev; + var fromProp = prevProp; + var toProp = diffProp.next != null ? diffProp.next : styProp; + var diff = false; + var initVal = void 0; + var initDt = 0.000001; // delta time % value for initVal (allows animating out of init zero opacity) + + if (!fromProp) { + continue; + } // consider px values + + + if (number$1(fromProp.pfValue) && number$1(toProp.pfValue)) { + diff = toProp.pfValue - fromProp.pfValue; // nonzero is truthy + + initVal = fromProp.pfValue + initDt * diff; // consider numerical values + } else if (number$1(fromProp.value) && number$1(toProp.value)) { + diff = toProp.value - fromProp.value; // nonzero is truthy + + initVal = fromProp.value + initDt * diff; // consider colour values + } else if (array(fromProp.value) && array(toProp.value)) { + diff = fromProp.value[0] !== toProp.value[0] || fromProp.value[1] !== toProp.value[1] || fromProp.value[2] !== toProp.value[2]; + initVal = fromProp.strValue; + } // the previous value is good for an animation only if it's different + + + if (diff) { + style[prop] = toProp.strValue; // to val + + this.applyBypass(ele, prop, initVal); // from val + + anyPrev = true; + } + } // end if props allow ani + // can't transition if there's nothing previous to transition from + + + if (!anyPrev) { + return; + } + + _p.transitioning = true; + new Promise$1(function (resolve) { + if (delay > 0) { + ele.delayAnimation(delay).play().promise().then(resolve); + } else { + resolve(); + } + }).then(function () { + return ele.animation({ + style: style, + duration: duration, + easing: ele.pstyle('transition-timing-function').value, + queue: false + }).play().promise(); + }).then(function () { + // if( !isBypass ){ + self.removeBypasses(ele, props); + ele.emitAndNotify('style'); // } + + _p.transitioning = false; + }); + } else if (_p.transitioning) { + this.removeBypasses(ele, props); + ele.emitAndNotify('style'); + _p.transitioning = false; + } +}; + +styfn$8.checkTrigger = function (ele, name, fromValue, toValue, getTrigger, onTrigger) { + var prop = this.properties[name]; + var triggerCheck = getTrigger(prop); + + if (triggerCheck != null && triggerCheck(fromValue, toValue)) { + onTrigger(prop); + } +}; + +styfn$8.checkZOrderTrigger = function (ele, name, fromValue, toValue) { + var _this = this; + + this.checkTrigger(ele, name, fromValue, toValue, function (prop) { + return prop.triggersZOrder; + }, function () { + _this._private.cy.notify('zorder', ele); + }); +}; + +styfn$8.checkBoundsTrigger = function (ele, name, fromValue, toValue) { + this.checkTrigger(ele, name, fromValue, toValue, function (prop) { + return prop.triggersBounds; + }, function (prop) { + ele.dirtyCompoundBoundsCache(); + ele.dirtyBoundingBoxCache(); // if the prop change makes the bb of pll bezier edges invalid, + // then dirty the pll edge bb cache as well + + if ( // only for beziers -- so performance of other edges isn't affected + prop.triggersBoundsOfParallelBeziers && (name === 'curve-style' && (fromValue === 'bezier' || toValue === 'bezier') || name === 'display' && (fromValue === 'none' || toValue === 'none'))) { + ele.parallelEdges().forEach(function (pllEdge) { + if (pllEdge.isBundledBezier()) { + pllEdge.dirtyBoundingBoxCache(); + } + }); + } + }); +}; + +styfn$8.checkTriggers = function (ele, name, fromValue, toValue) { + ele.dirtyStyleCache(); + this.checkZOrderTrigger(ele, name, fromValue, toValue); + this.checkBoundsTrigger(ele, name, fromValue, toValue); +}; + +var styfn$7 = {}; // bypasses are applied to an existing style on an element, and just tacked on temporarily +// returns true iff application was successful for at least 1 specified property + +styfn$7.applyBypass = function (eles, name, value, updateTransitions) { + var self = this; + var props = []; + var isBypass = true; // put all the properties (can specify one or many) in an array after parsing them + + if (name === '*' || name === '**') { + // apply to all property names + if (value !== undefined) { + for (var i = 0; i < self.properties.length; i++) { + var prop = self.properties[i]; + var _name = prop.name; + var parsedProp = this.parse(_name, value, true); + + if (parsedProp) { + props.push(parsedProp); + } + } + } + } else if (string(name)) { + // then parse the single property + var _parsedProp = this.parse(name, value, true); + + if (_parsedProp) { + props.push(_parsedProp); + } + } else if (plainObject(name)) { + // then parse each property + var specifiedProps = name; + updateTransitions = value; + var names = Object.keys(specifiedProps); + + for (var _i = 0; _i < names.length; _i++) { + var _name2 = names[_i]; + var _value = specifiedProps[_name2]; + + if (_value === undefined) { + // try camel case name too + _value = specifiedProps[dash2camel(_name2)]; + } + + if (_value !== undefined) { + var _parsedProp2 = this.parse(_name2, _value, true); + + if (_parsedProp2) { + props.push(_parsedProp2); + } + } + } + } else { + // can't do anything without well defined properties + return false; + } // we've failed if there are no valid properties + + + if (props.length === 0) { + return false; + } // now, apply the bypass properties on the elements + + + var ret = false; // return true if at least one succesful bypass applied + + for (var _i2 = 0; _i2 < eles.length; _i2++) { + // for each ele + var ele = eles[_i2]; + var diffProps = {}; + var diffProp = void 0; + + for (var j = 0; j < props.length; j++) { + // for each prop + var _prop = props[j]; + + if (updateTransitions) { + var prevProp = ele.pstyle(_prop.name); + diffProp = diffProps[_prop.name] = { + prev: prevProp + }; + } + + ret = this.applyParsedProperty(ele, copy(_prop)) || ret; + + if (updateTransitions) { + diffProp.next = ele.pstyle(_prop.name); + } + } // for props + + + if (ret) { + this.updateStyleHints(ele); + } + + if (updateTransitions) { + this.updateTransitions(ele, diffProps, isBypass); + } + } // for eles + + + return ret; +}; // only useful in specific cases like animation + + +styfn$7.overrideBypass = function (eles, name, value) { + name = camel2dash(name); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var prop = ele._private.style[name]; + var type = this.properties[name].type; + var isColor = type.color; + var isMulti = type.mutiple; + var oldValue = !prop ? null : prop.pfValue != null ? prop.pfValue : prop.value; + + if (!prop || !prop.bypass) { + // need a bypass if one doesn't exist + this.applyBypass(ele, name, value); + } else { + prop.value = value; + + if (prop.pfValue != null) { + prop.pfValue = value; + } + + if (isColor) { + prop.strValue = 'rgb(' + value.join(',') + ')'; + } else if (isMulti) { + prop.strValue = value.join(' '); + } else { + prop.strValue = '' + value; + } + + this.updateStyleHints(ele); + } + + this.checkTriggers(ele, name, oldValue, value); + } +}; + +styfn$7.removeAllBypasses = function (eles, updateTransitions) { + return this.removeBypasses(eles, this.propertyNames, updateTransitions); +}; + +styfn$7.removeBypasses = function (eles, props, updateTransitions) { + var isBypass = true; + + for (var j = 0; j < eles.length; j++) { + var ele = eles[j]; + var diffProps = {}; + + for (var i = 0; i < props.length; i++) { + var name = props[i]; + var prop = this.properties[name]; + var prevProp = ele.pstyle(prop.name); + + if (!prevProp || !prevProp.bypass) { + // if a bypass doesn't exist for the prop, nothing needs to be removed + continue; + } + + var value = ''; // empty => remove bypass + + var parsedProp = this.parse(name, value, true); + var diffProp = diffProps[prop.name] = { + prev: prevProp + }; + this.applyParsedProperty(ele, parsedProp); + diffProp.next = ele.pstyle(prop.name); + } // for props + + + this.updateStyleHints(ele); + + if (updateTransitions) { + this.updateTransitions(ele, diffProps, isBypass); + } + } // for eles + +}; + +var styfn$6 = {}; // gets what an em size corresponds to in pixels relative to a dom element + +styfn$6.getEmSizeInPixels = function () { + var px = this.containerCss('font-size'); + + if (px != null) { + return parseFloat(px); + } else { + return 1; // for headless + } +}; // gets css property from the core container + + +styfn$6.containerCss = function (propName) { + var cy = this._private.cy; + var domElement = cy.container(); + + if (window$1 && domElement && window$1.getComputedStyle) { + return window$1.getComputedStyle(domElement).getPropertyValue(propName); + } +}; + +var styfn$5 = {}; // gets the rendered style for an element + +styfn$5.getRenderedStyle = function (ele, prop) { + if (prop) { + return this.getStylePropertyValue(ele, prop, true); + } else { + return this.getRawStyle(ele, true); + } +}; // gets the raw style for an element + + +styfn$5.getRawStyle = function (ele, isRenderedVal) { + var self = this; + ele = ele[0]; // insure it's an element + + if (ele) { + var rstyle = {}; + + for (var i = 0; i < self.properties.length; i++) { + var prop = self.properties[i]; + var val = self.getStylePropertyValue(ele, prop.name, isRenderedVal); + + if (val != null) { + rstyle[prop.name] = val; + rstyle[dash2camel(prop.name)] = val; + } + } + + return rstyle; + } +}; + +styfn$5.getIndexedStyle = function (ele, property, subproperty, index) { + var pstyle = ele.pstyle(property)[subproperty][index]; + return pstyle != null ? pstyle : ele.cy().style().getDefaultProperty(property)[subproperty][0]; +}; + +styfn$5.getStylePropertyValue = function (ele, propName, isRenderedVal) { + var self = this; + ele = ele[0]; // insure it's an element + + if (ele) { + var prop = self.properties[propName]; + + if (prop.alias) { + prop = prop.pointsTo; + } + + var type = prop.type; + var styleProp = ele.pstyle(prop.name); + + if (styleProp) { + var value = styleProp.value, + units = styleProp.units, + strValue = styleProp.strValue; + + if (isRenderedVal && type.number && value != null && number$1(value)) { + var zoom = ele.cy().zoom(); + + var getRenderedValue = function getRenderedValue(val) { + return val * zoom; + }; + + var getValueStringWithUnits = function getValueStringWithUnits(val, units) { + return getRenderedValue(val) + units; + }; + + var isArrayValue = array(value); + var haveUnits = isArrayValue ? units.every(function (u) { + return u != null; + }) : units != null; + + if (haveUnits) { + if (isArrayValue) { + return value.map(function (v, i) { + return getValueStringWithUnits(v, units[i]); + }).join(' '); + } else { + return getValueStringWithUnits(value, units); + } + } else { + if (isArrayValue) { + return value.map(function (v) { + return string(v) ? v : '' + getRenderedValue(v); + }).join(' '); + } else { + return '' + getRenderedValue(value); + } + } + } else if (strValue != null) { + return strValue; + } + } + + return null; + } +}; + +styfn$5.getAnimationStartStyle = function (ele, aniProps) { + var rstyle = {}; + + for (var i = 0; i < aniProps.length; i++) { + var aniProp = aniProps[i]; + var name = aniProp.name; + var styleProp = ele.pstyle(name); + + if (styleProp !== undefined) { + // then make a prop of it + if (plainObject(styleProp)) { + styleProp = this.parse(name, styleProp.strValue); + } else { + styleProp = this.parse(name, styleProp); + } + } + + if (styleProp) { + rstyle[name] = styleProp; + } + } + + return rstyle; +}; + +styfn$5.getPropsList = function (propsObj) { + var self = this; + var rstyle = []; + var style = propsObj; + var props = self.properties; + + if (style) { + var names = Object.keys(style); + + for (var i = 0; i < names.length; i++) { + var name = names[i]; + var val = style[name]; + var prop = props[name] || props[camel2dash(name)]; + var styleProp = this.parse(prop.name, val); + + if (styleProp) { + rstyle.push(styleProp); + } + } + } + + return rstyle; +}; + +styfn$5.getNonDefaultPropertiesHash = function (ele, propNames, seed) { + var hash = seed.slice(); + var name, val, strVal, chVal; + var i, j; + + for (i = 0; i < propNames.length; i++) { + name = propNames[i]; + val = ele.pstyle(name, false); + + if (val == null) { + continue; + } else if (val.pfValue != null) { + hash[0] = hashInt(chVal, hash[0]); + hash[1] = hashIntAlt(chVal, hash[1]); + } else { + strVal = val.strValue; + + for (j = 0; j < strVal.length; j++) { + chVal = strVal.charCodeAt(j); + hash[0] = hashInt(chVal, hash[0]); + hash[1] = hashIntAlt(chVal, hash[1]); + } + } + } + + return hash; +}; + +styfn$5.getPropertiesHash = styfn$5.getNonDefaultPropertiesHash; + +var styfn$4 = {}; + +styfn$4.appendFromJson = function (json) { + var style = this; + + for (var i = 0; i < json.length; i++) { + var context = json[i]; + var selector = context.selector; + var props = context.style || context.css; + var names = Object.keys(props); + style.selector(selector); // apply selector + + for (var j = 0; j < names.length; j++) { + var name = names[j]; + var value = props[name]; + style.css(name, value); // apply property + } + } + + return style; +}; // accessible cy.style() function + + +styfn$4.fromJson = function (json) { + var style = this; + style.resetToDefault(); + style.appendFromJson(json); + return style; +}; // get json from cy.style() api + + +styfn$4.json = function () { + var json = []; + + for (var i = this.defaultLength; i < this.length; i++) { + var cxt = this[i]; + var selector = cxt.selector; + var props = cxt.properties; + var css = {}; + + for (var j = 0; j < props.length; j++) { + var prop = props[j]; + css[prop.name] = prop.strValue; + } + + json.push({ + selector: !selector ? 'core' : selector.toString(), + style: css + }); + } + + return json; +}; + +var styfn$3 = {}; + +styfn$3.appendFromString = function (string) { + var self = this; + var style = this; + var remaining = '' + string; + var selAndBlockStr; + var blockRem; + var propAndValStr; // remove comments from the style string + + remaining = remaining.replace(/[/][*](\s|.)+?[*][/]/g, ''); + + function removeSelAndBlockFromRemaining() { + // remove the parsed selector and block from the remaining text to parse + if (remaining.length > selAndBlockStr.length) { + remaining = remaining.substr(selAndBlockStr.length); + } else { + remaining = ''; + } + } + + function removePropAndValFromRem() { + // remove the parsed property and value from the remaining block text to parse + if (blockRem.length > propAndValStr.length) { + blockRem = blockRem.substr(propAndValStr.length); + } else { + blockRem = ''; + } + } + + for (;;) { + var nothingLeftToParse = remaining.match(/^\s*$/); + + if (nothingLeftToParse) { + break; + } + + var selAndBlock = remaining.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/); + + if (!selAndBlock) { + warn('Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: ' + remaining); + break; + } + + selAndBlockStr = selAndBlock[0]; // parse the selector + + var selectorStr = selAndBlock[1]; + + if (selectorStr !== 'core') { + var selector = new Selector(selectorStr); + + if (selector.invalid) { + warn('Skipping parsing of block: Invalid selector found in string stylesheet: ' + selectorStr); // skip this selector and block + + removeSelAndBlockFromRemaining(); + continue; + } + } // parse the block of properties and values + + + var blockStr = selAndBlock[2]; + var invalidBlock = false; + blockRem = blockStr; + var props = []; + + for (;;) { + var _nothingLeftToParse = blockRem.match(/^\s*$/); + + if (_nothingLeftToParse) { + break; + } + + var propAndVal = blockRem.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/); + + if (!propAndVal) { + warn('Skipping parsing of block: Invalid formatting of style property and value definitions found in:' + blockStr); + invalidBlock = true; + break; + } + + propAndValStr = propAndVal[0]; + var propStr = propAndVal[1]; + var valStr = propAndVal[2]; + var prop = self.properties[propStr]; + + if (!prop) { + warn('Skipping property: Invalid property name in: ' + propAndValStr); // skip this property in the block + + removePropAndValFromRem(); + continue; + } + + var parsedProp = style.parse(propStr, valStr); + + if (!parsedProp) { + warn('Skipping property: Invalid property definition in: ' + propAndValStr); // skip this property in the block + + removePropAndValFromRem(); + continue; + } + + props.push({ + name: propStr, + val: valStr + }); + removePropAndValFromRem(); + } + + if (invalidBlock) { + removeSelAndBlockFromRemaining(); + break; + } // put the parsed block in the style + + + style.selector(selectorStr); + + for (var i = 0; i < props.length; i++) { + var _prop = props[i]; + style.css(_prop.name, _prop.val); + } + + removeSelAndBlockFromRemaining(); + } + + return style; +}; + +styfn$3.fromString = function (string) { + var style = this; + style.resetToDefault(); + style.appendFromString(string); + return style; +}; + +var styfn$2 = {}; + +(function () { + var number$1 = number; + var rgba = rgbaNoBackRefs; + var hsla = hslaNoBackRefs; + var hex3$1 = hex3; + var hex6$1 = hex6; + + var data = function data(prefix) { + return '^' + prefix + '\\s*\\(\\s*([\\w\\.]+)\\s*\\)$'; + }; + + var mapData = function mapData(prefix) { + var mapArg = number$1 + '|\\w+|' + rgba + '|' + hsla + '|' + hex3$1 + '|' + hex6$1; + return '^' + prefix + '\\s*\\(([\\w\\.]+)\\s*\\,\\s*(' + number$1 + ')\\s*\\,\\s*(' + number$1 + ')\\s*,\\s*(' + mapArg + ')\\s*\\,\\s*(' + mapArg + ')\\)$'; + }; + + var urlRegexes = ['^url\\s*\\(\\s*[\'"]?(.+?)[\'"]?\\s*\\)$', '^(none)$', '^(.+)$']; // each visual style property has a type and needs to be validated according to it + + styfn$2.types = { + time: { + number: true, + min: 0, + units: 's|ms', + implicitUnits: 'ms' + }, + percent: { + number: true, + min: 0, + max: 100, + units: '%', + implicitUnits: '%' + }, + percentages: { + number: true, + min: 0, + max: 100, + units: '%', + implicitUnits: '%', + multiple: true + }, + zeroOneNumber: { + number: true, + min: 0, + max: 1, + unitless: true + }, + zeroOneNumbers: { + number: true, + min: 0, + max: 1, + unitless: true, + multiple: true + }, + nOneOneNumber: { + number: true, + min: -1, + max: 1, + unitless: true + }, + nonNegativeInt: { + number: true, + min: 0, + integer: true, + unitless: true + }, + position: { + enums: ['parent', 'origin'] + }, + nodeSize: { + number: true, + min: 0, + enums: ['label'] + }, + number: { + number: true, + unitless: true + }, + numbers: { + number: true, + unitless: true, + multiple: true + }, + positiveNumber: { + number: true, + unitless: true, + min: 0, + strictMin: true + }, + size: { + number: true, + min: 0 + }, + bidirectionalSize: { + number: true + }, + // allows negative + bidirectionalSizeMaybePercent: { + number: true, + allowPercent: true + }, + // allows negative + bidirectionalSizes: { + number: true, + multiple: true + }, + // allows negative + sizeMaybePercent: { + number: true, + min: 0, + allowPercent: true + }, + axisDirection: { + enums: ['horizontal', 'leftward', 'rightward', 'vertical', 'upward', 'downward', 'auto'] + }, + paddingRelativeTo: { + enums: ['width', 'height', 'average', 'min', 'max'] + }, + bgWH: { + number: true, + min: 0, + allowPercent: true, + enums: ['auto'], + multiple: true + }, + bgPos: { + number: true, + allowPercent: true, + multiple: true + }, + bgRelativeTo: { + enums: ['inner', 'include-padding'], + multiple: true + }, + bgRepeat: { + enums: ['repeat', 'repeat-x', 'repeat-y', 'no-repeat'], + multiple: true + }, + bgFit: { + enums: ['none', 'contain', 'cover'], + multiple: true + }, + bgCrossOrigin: { + enums: ['anonymous', 'use-credentials'], + multiple: true + }, + bgClip: { + enums: ['none', 'node'], + multiple: true + }, + bgContainment: { + enums: ['inside', 'over'], + multiple: true + }, + color: { + color: true + }, + colors: { + color: true, + multiple: true + }, + fill: { + enums: ['solid', 'linear-gradient', 'radial-gradient'] + }, + bool: { + enums: ['yes', 'no'] + }, + bools: { + enums: ['yes', 'no'], + multiple: true + }, + lineStyle: { + enums: ['solid', 'dotted', 'dashed'] + }, + lineCap: { + enums: ['butt', 'round', 'square'] + }, + borderStyle: { + enums: ['solid', 'dotted', 'dashed', 'double'] + }, + curveStyle: { + enums: ['bezier', 'unbundled-bezier', 'haystack', 'segments', 'straight', 'straight-triangle', 'taxi'] + }, + fontFamily: { + regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$' + }, + fontStyle: { + enums: ['italic', 'normal', 'oblique'] + }, + fontWeight: { + enums: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '800', '900', 100, 200, 300, 400, 500, 600, 700, 800, 900] + }, + textDecoration: { + enums: ['none', 'underline', 'overline', 'line-through'] + }, + textTransform: { + enums: ['none', 'uppercase', 'lowercase'] + }, + textWrap: { + enums: ['none', 'wrap', 'ellipsis'] + }, + textOverflowWrap: { + enums: ['whitespace', 'anywhere'] + }, + textBackgroundShape: { + enums: ['rectangle', 'roundrectangle', 'round-rectangle'] + }, + nodeShape: { + enums: ['rectangle', 'roundrectangle', 'round-rectangle', 'cutrectangle', 'cut-rectangle', 'bottomroundrectangle', 'bottom-round-rectangle', 'barrel', 'ellipse', 'triangle', 'round-triangle', 'square', 'pentagon', 'round-pentagon', 'hexagon', 'round-hexagon', 'concavehexagon', 'concave-hexagon', 'heptagon', 'round-heptagon', 'octagon', 'round-octagon', 'tag', 'round-tag', 'star', 'diamond', 'round-diamond', 'vee', 'rhomboid', 'polygon'] + }, + overlayShape: { + enums: ['roundrectangle', 'round-rectangle', 'ellipse'] + }, + compoundIncludeLabels: { + enums: ['include', 'exclude'] + }, + arrowShape: { + enums: ['tee', 'triangle', 'triangle-tee', 'circle-triangle', 'triangle-cross', 'triangle-backcurve', 'vee', 'square', 'circle', 'diamond', 'chevron', 'none'] + }, + arrowFill: { + enums: ['filled', 'hollow'] + }, + display: { + enums: ['element', 'none'] + }, + visibility: { + enums: ['hidden', 'visible'] + }, + zCompoundDepth: { + enums: ['bottom', 'orphan', 'auto', 'top'] + }, + zIndexCompare: { + enums: ['auto', 'manual'] + }, + valign: { + enums: ['top', 'center', 'bottom'] + }, + halign: { + enums: ['left', 'center', 'right'] + }, + justification: { + enums: ['left', 'center', 'right', 'auto'] + }, + text: { + string: true + }, + data: { + mapping: true, + regex: data('data') + }, + layoutData: { + mapping: true, + regex: data('layoutData') + }, + scratch: { + mapping: true, + regex: data('scratch') + }, + mapData: { + mapping: true, + regex: mapData('mapData') + }, + mapLayoutData: { + mapping: true, + regex: mapData('mapLayoutData') + }, + mapScratch: { + mapping: true, + regex: mapData('mapScratch') + }, + fn: { + mapping: true, + fn: true + }, + url: { + regexes: urlRegexes, + singleRegexMatchValue: true + }, + urls: { + regexes: urlRegexes, + singleRegexMatchValue: true, + multiple: true + }, + propList: { + propList: true + }, + angle: { + number: true, + units: 'deg|rad', + implicitUnits: 'rad' + }, + textRotation: { + number: true, + units: 'deg|rad', + implicitUnits: 'rad', + enums: ['none', 'autorotate'] + }, + polygonPointList: { + number: true, + multiple: true, + evenMultiple: true, + min: -1, + max: 1, + unitless: true + }, + edgeDistances: { + enums: ['intersection', 'node-position'] + }, + edgeEndpoint: { + number: true, + multiple: true, + units: '%|px|em|deg|rad', + implicitUnits: 'px', + enums: ['inside-to-node', 'outside-to-node', 'outside-to-node-or-label', 'outside-to-line', 'outside-to-line-or-label'], + singleEnum: true, + validate: function validate(valArr, unitsArr) { + switch (valArr.length) { + case 2: + // can be % or px only + return unitsArr[0] !== 'deg' && unitsArr[0] !== 'rad' && unitsArr[1] !== 'deg' && unitsArr[1] !== 'rad'; + + case 1: + // can be enum, deg, or rad only + return string(valArr[0]) || unitsArr[0] === 'deg' || unitsArr[0] === 'rad'; + + default: + return false; + } + } + }, + easing: { + regexes: ['^(spring)\\s*\\(\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*\\)$', '^(cubic-bezier)\\s*\\(\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*\\)$'], + enums: ['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'ease-in-sine', 'ease-out-sine', 'ease-in-out-sine', 'ease-in-quad', 'ease-out-quad', 'ease-in-out-quad', 'ease-in-cubic', 'ease-out-cubic', 'ease-in-out-cubic', 'ease-in-quart', 'ease-out-quart', 'ease-in-out-quart', 'ease-in-quint', 'ease-out-quint', 'ease-in-out-quint', 'ease-in-expo', 'ease-out-expo', 'ease-in-out-expo', 'ease-in-circ', 'ease-out-circ', 'ease-in-out-circ'] + }, + gradientDirection: { + enums: ['to-bottom', 'to-top', 'to-left', 'to-right', 'to-bottom-right', 'to-bottom-left', 'to-top-right', 'to-top-left', 'to-right-bottom', 'to-left-bottom', 'to-right-top', 'to-left-top' // different order + ] + }, + boundsExpansion: { + number: true, + multiple: true, + min: 0, + validate: function validate(valArr) { + var length = valArr.length; + return length === 1 || length === 2 || length === 4; + } + } + }; + var diff = { + zeroNonZero: function zeroNonZero(val1, val2) { + if ((val1 == null || val2 == null) && val1 !== val2) { + return true; // null cases could represent any value + } + + if (val1 == 0 && val2 != 0) { + return true; + } else if (val1 != 0 && val2 == 0) { + return true; + } else { + return false; + } + }, + any: function any(val1, val2) { + return val1 != val2; + }, + emptyNonEmpty: function emptyNonEmpty(str1, str2) { + var empty1 = emptyString(str1); + var empty2 = emptyString(str2); + return empty1 && !empty2 || !empty1 && empty2; + } + }; // define visual style properties + // + // - n.b. adding a new group of props may require updates to updateStyleHints() + // - adding new props to an existing group gets handled automatically + + var t = styfn$2.types; + var mainLabel = [{ + name: 'label', + type: t.text, + triggersBounds: diff.any, + triggersZOrder: diff.emptyNonEmpty + }, { + name: 'text-rotation', + type: t.textRotation, + triggersBounds: diff.any + }, { + name: 'text-margin-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'text-margin-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }]; + var sourceLabel = [{ + name: 'source-label', + type: t.text, + triggersBounds: diff.any + }, { + name: 'source-text-rotation', + type: t.textRotation, + triggersBounds: diff.any + }, { + name: 'source-text-margin-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'source-text-margin-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'source-text-offset', + type: t.size, + triggersBounds: diff.any + }]; + var targetLabel = [{ + name: 'target-label', + type: t.text, + triggersBounds: diff.any + }, { + name: 'target-text-rotation', + type: t.textRotation, + triggersBounds: diff.any + }, { + name: 'target-text-margin-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'target-text-margin-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'target-text-offset', + type: t.size, + triggersBounds: diff.any + }]; + var labelDimensions = [{ + name: 'font-family', + type: t.fontFamily, + triggersBounds: diff.any + }, { + name: 'font-style', + type: t.fontStyle, + triggersBounds: diff.any + }, { + name: 'font-weight', + type: t.fontWeight, + triggersBounds: diff.any + }, { + name: 'font-size', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-transform', + type: t.textTransform, + triggersBounds: diff.any + }, { + name: 'text-wrap', + type: t.textWrap, + triggersBounds: diff.any + }, { + name: 'text-overflow-wrap', + type: t.textOverflowWrap, + triggersBounds: diff.any + }, { + name: 'text-max-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-outline-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'line-height', + type: t.positiveNumber, + triggersBounds: diff.any + }]; + var commonLabel = [{ + name: 'text-valign', + type: t.valign, + triggersBounds: diff.any + }, { + name: 'text-halign', + type: t.halign, + triggersBounds: diff.any + }, { + name: 'color', + type: t.color + }, { + name: 'text-outline-color', + type: t.color + }, { + name: 'text-outline-opacity', + type: t.zeroOneNumber + }, { + name: 'text-background-color', + type: t.color + }, { + name: 'text-background-opacity', + type: t.zeroOneNumber + }, { + name: 'text-background-padding', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-border-opacity', + type: t.zeroOneNumber + }, { + name: 'text-border-color', + type: t.color + }, { + name: 'text-border-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-border-style', + type: t.borderStyle, + triggersBounds: diff.any + }, { + name: 'text-background-shape', + type: t.textBackgroundShape, + triggersBounds: diff.any + }, { + name: 'text-justification', + type: t.justification + }]; + var behavior = [{ + name: 'events', + type: t.bool + }, { + name: 'text-events', + type: t.bool + }]; + var visibility = [{ + name: 'display', + type: t.display, + triggersZOrder: diff.any, + triggersBounds: diff.any, + triggersBoundsOfParallelBeziers: true + }, { + name: 'visibility', + type: t.visibility, + triggersZOrder: diff.any + }, { + name: 'opacity', + type: t.zeroOneNumber, + triggersZOrder: diff.zeroNonZero + }, { + name: 'text-opacity', + type: t.zeroOneNumber + }, { + name: 'min-zoomed-font-size', + type: t.size + }, { + name: 'z-compound-depth', + type: t.zCompoundDepth, + triggersZOrder: diff.any + }, { + name: 'z-index-compare', + type: t.zIndexCompare, + triggersZOrder: diff.any + }, { + name: 'z-index', + type: t.nonNegativeInt, + triggersZOrder: diff.any + }]; + var overlay = [{ + name: 'overlay-padding', + type: t.size, + triggersBounds: diff.any + }, { + name: 'overlay-color', + type: t.color + }, { + name: 'overlay-opacity', + type: t.zeroOneNumber, + triggersBounds: diff.zeroNonZero + }, { + name: 'overlay-shape', + type: t.overlayShape, + triggersBounds: diff.any + }]; + var underlay = [{ + name: 'underlay-padding', + type: t.size, + triggersBounds: diff.any + }, { + name: 'underlay-color', + type: t.color + }, { + name: 'underlay-opacity', + type: t.zeroOneNumber, + triggersBounds: diff.zeroNonZero + }, { + name: 'underlay-shape', + type: t.overlayShape, + triggersBounds: diff.any + }]; + var transition = [{ + name: 'transition-property', + type: t.propList + }, { + name: 'transition-duration', + type: t.time + }, { + name: 'transition-delay', + type: t.time + }, { + name: 'transition-timing-function', + type: t.easing + }]; + + var nodeSizeHashOverride = function nodeSizeHashOverride(ele, parsedProp) { + if (parsedProp.value === 'label') { + return -ele.poolIndex(); // no hash key hits is using label size (hitrate for perf probably low anyway) + } else { + return parsedProp.pfValue; + } + }; + + var nodeBody = [{ + name: 'height', + type: t.nodeSize, + triggersBounds: diff.any, + hashOverride: nodeSizeHashOverride + }, { + name: 'width', + type: t.nodeSize, + triggersBounds: diff.any, + hashOverride: nodeSizeHashOverride + }, { + name: 'shape', + type: t.nodeShape, + triggersBounds: diff.any + }, { + name: 'shape-polygon-points', + type: t.polygonPointList, + triggersBounds: diff.any + }, { + name: 'background-color', + type: t.color + }, { + name: 'background-fill', + type: t.fill + }, { + name: 'background-opacity', + type: t.zeroOneNumber + }, { + name: 'background-blacken', + type: t.nOneOneNumber + }, { + name: 'background-gradient-stop-colors', + type: t.colors + }, { + name: 'background-gradient-stop-positions', + type: t.percentages + }, { + name: 'background-gradient-direction', + type: t.gradientDirection + }, { + name: 'padding', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'padding-relative-to', + type: t.paddingRelativeTo, + triggersBounds: diff.any + }, { + name: 'bounds-expansion', + type: t.boundsExpansion, + triggersBounds: diff.any + }]; + var nodeBorder = [{ + name: 'border-color', + type: t.color + }, { + name: 'border-opacity', + type: t.zeroOneNumber + }, { + name: 'border-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'border-style', + type: t.borderStyle + }]; + var backgroundImage = [{ + name: 'background-image', + type: t.urls + }, { + name: 'background-image-crossorigin', + type: t.bgCrossOrigin + }, { + name: 'background-image-opacity', + type: t.zeroOneNumbers + }, { + name: 'background-image-containment', + type: t.bgContainment + }, { + name: 'background-image-smoothing', + type: t.bools + }, { + name: 'background-position-x', + type: t.bgPos + }, { + name: 'background-position-y', + type: t.bgPos + }, { + name: 'background-width-relative-to', + type: t.bgRelativeTo + }, { + name: 'background-height-relative-to', + type: t.bgRelativeTo + }, { + name: 'background-repeat', + type: t.bgRepeat + }, { + name: 'background-fit', + type: t.bgFit + }, { + name: 'background-clip', + type: t.bgClip + }, { + name: 'background-width', + type: t.bgWH + }, { + name: 'background-height', + type: t.bgWH + }, { + name: 'background-offset-x', + type: t.bgPos + }, { + name: 'background-offset-y', + type: t.bgPos + }]; + var compound = [{ + name: 'position', + type: t.position, + triggersBounds: diff.any + }, { + name: 'compound-sizing-wrt-labels', + type: t.compoundIncludeLabels, + triggersBounds: diff.any + }, { + name: 'min-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'min-width-bias-left', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'min-width-bias-right', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'min-height', + type: t.size, + triggersBounds: diff.any + }, { + name: 'min-height-bias-top', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'min-height-bias-bottom', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }]; + var edgeLine = [{ + name: 'line-style', + type: t.lineStyle + }, { + name: 'line-color', + type: t.color + }, { + name: 'line-fill', + type: t.fill + }, { + name: 'line-cap', + type: t.lineCap + }, { + name: 'line-opacity', + type: t.zeroOneNumber + }, { + name: 'line-dash-pattern', + type: t.numbers + }, { + name: 'line-dash-offset', + type: t.number + }, { + name: 'line-gradient-stop-colors', + type: t.colors + }, { + name: 'line-gradient-stop-positions', + type: t.percentages + }, { + name: 'curve-style', + type: t.curveStyle, + triggersBounds: diff.any, + triggersBoundsOfParallelBeziers: true + }, { + name: 'haystack-radius', + type: t.zeroOneNumber, + triggersBounds: diff.any + }, { + name: 'source-endpoint', + type: t.edgeEndpoint, + triggersBounds: diff.any + }, { + name: 'target-endpoint', + type: t.edgeEndpoint, + triggersBounds: diff.any + }, { + name: 'control-point-step-size', + type: t.size, + triggersBounds: diff.any + }, { + name: 'control-point-distances', + type: t.bidirectionalSizes, + triggersBounds: diff.any + }, { + name: 'control-point-weights', + type: t.numbers, + triggersBounds: diff.any + }, { + name: 'segment-distances', + type: t.bidirectionalSizes, + triggersBounds: diff.any + }, { + name: 'segment-weights', + type: t.numbers, + triggersBounds: diff.any + }, { + name: 'taxi-turn', + type: t.bidirectionalSizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'taxi-turn-min-distance', + type: t.size, + triggersBounds: diff.any + }, { + name: 'taxi-direction', + type: t.axisDirection, + triggersBounds: diff.any + }, { + name: 'edge-distances', + type: t.edgeDistances, + triggersBounds: diff.any + }, { + name: 'arrow-scale', + type: t.positiveNumber, + triggersBounds: diff.any + }, { + name: 'loop-direction', + type: t.angle, + triggersBounds: diff.any + }, { + name: 'loop-sweep', + type: t.angle, + triggersBounds: diff.any + }, { + name: 'source-distance-from-node', + type: t.size, + triggersBounds: diff.any + }, { + name: 'target-distance-from-node', + type: t.size, + triggersBounds: diff.any + }]; + var ghost = [{ + name: 'ghost', + type: t.bool, + triggersBounds: diff.any + }, { + name: 'ghost-offset-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'ghost-offset-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'ghost-opacity', + type: t.zeroOneNumber + }]; + var core = [{ + name: 'selection-box-color', + type: t.color + }, { + name: 'selection-box-opacity', + type: t.zeroOneNumber + }, { + name: 'selection-box-border-color', + type: t.color + }, { + name: 'selection-box-border-width', + type: t.size + }, { + name: 'active-bg-color', + type: t.color + }, { + name: 'active-bg-opacity', + type: t.zeroOneNumber + }, { + name: 'active-bg-size', + type: t.size + }, { + name: 'outside-texture-bg-color', + type: t.color + }, { + name: 'outside-texture-bg-opacity', + type: t.zeroOneNumber + }]; // pie backgrounds for nodes + + var pie = []; + styfn$2.pieBackgroundN = 16; // because the pie properties are numbered, give access to a constant N (for renderer use) + + pie.push({ + name: 'pie-size', + type: t.sizeMaybePercent + }); + + for (var i = 1; i <= styfn$2.pieBackgroundN; i++) { + pie.push({ + name: 'pie-' + i + '-background-color', + type: t.color + }); + pie.push({ + name: 'pie-' + i + '-background-size', + type: t.percent + }); + pie.push({ + name: 'pie-' + i + '-background-opacity', + type: t.zeroOneNumber + }); + } // edge arrows + + + var edgeArrow = []; + var arrowPrefixes = styfn$2.arrowPrefixes = ['source', 'mid-source', 'target', 'mid-target']; + [{ + name: 'arrow-shape', + type: t.arrowShape, + triggersBounds: diff.any + }, { + name: 'arrow-color', + type: t.color + }, { + name: 'arrow-fill', + type: t.arrowFill + }].forEach(function (prop) { + arrowPrefixes.forEach(function (prefix) { + var name = prefix + '-' + prop.name; + var type = prop.type, + triggersBounds = prop.triggersBounds; + edgeArrow.push({ + name: name, + type: type, + triggersBounds: triggersBounds + }); + }); + }, {}); + var props = styfn$2.properties = [].concat(behavior, transition, visibility, overlay, underlay, ghost, commonLabel, labelDimensions, mainLabel, sourceLabel, targetLabel, nodeBody, nodeBorder, backgroundImage, pie, compound, edgeLine, edgeArrow, core); + var propGroups = styfn$2.propertyGroups = { + // common to all eles + behavior: behavior, + transition: transition, + visibility: visibility, + overlay: overlay, + underlay: underlay, + ghost: ghost, + // labels + commonLabel: commonLabel, + labelDimensions: labelDimensions, + mainLabel: mainLabel, + sourceLabel: sourceLabel, + targetLabel: targetLabel, + // node props + nodeBody: nodeBody, + nodeBorder: nodeBorder, + backgroundImage: backgroundImage, + pie: pie, + compound: compound, + // edge props + edgeLine: edgeLine, + edgeArrow: edgeArrow, + core: core + }; + var propGroupNames = styfn$2.propertyGroupNames = {}; + var propGroupKeys = styfn$2.propertyGroupKeys = Object.keys(propGroups); + propGroupKeys.forEach(function (key) { + propGroupNames[key] = propGroups[key].map(function (prop) { + return prop.name; + }); + propGroups[key].forEach(function (prop) { + return prop.groupKey = key; + }); + }); // define aliases + + var aliases = styfn$2.aliases = [{ + name: 'content', + pointsTo: 'label' + }, { + name: 'control-point-distance', + pointsTo: 'control-point-distances' + }, { + name: 'control-point-weight', + pointsTo: 'control-point-weights' + }, { + name: 'edge-text-rotation', + pointsTo: 'text-rotation' + }, { + name: 'padding-left', + pointsTo: 'padding' + }, { + name: 'padding-right', + pointsTo: 'padding' + }, { + name: 'padding-top', + pointsTo: 'padding' + }, { + name: 'padding-bottom', + pointsTo: 'padding' + }]; // list of property names + + styfn$2.propertyNames = props.map(function (p) { + return p.name; + }); // allow access of properties by name ( e.g. style.properties.height ) + + for (var _i = 0; _i < props.length; _i++) { + var prop = props[_i]; + props[prop.name] = prop; // allow lookup by name + } // map aliases + + + for (var _i2 = 0; _i2 < aliases.length; _i2++) { + var alias = aliases[_i2]; + var pointsToProp = props[alias.pointsTo]; + var aliasProp = { + name: alias.name, + alias: true, + pointsTo: pointsToProp + }; // add alias prop for parsing + + props.push(aliasProp); + props[alias.name] = aliasProp; // allow lookup by name + } +})(); + +styfn$2.getDefaultProperty = function (name) { + return this.getDefaultProperties()[name]; +}; + +styfn$2.getDefaultProperties = function () { + var _p = this._private; + + if (_p.defaultProperties != null) { + return _p.defaultProperties; + } + + var rawProps = extend({ + // core props + 'selection-box-color': '#ddd', + 'selection-box-opacity': 0.65, + 'selection-box-border-color': '#aaa', + 'selection-box-border-width': 1, + 'active-bg-color': 'black', + 'active-bg-opacity': 0.15, + 'active-bg-size': 30, + 'outside-texture-bg-color': '#000', + 'outside-texture-bg-opacity': 0.125, + // common node/edge props + 'events': 'yes', + 'text-events': 'no', + 'text-valign': 'top', + 'text-halign': 'center', + 'text-justification': 'auto', + 'line-height': 1, + 'color': '#000', + 'text-outline-color': '#000', + 'text-outline-width': 0, + 'text-outline-opacity': 1, + 'text-opacity': 1, + 'text-decoration': 'none', + 'text-transform': 'none', + 'text-wrap': 'none', + 'text-overflow-wrap': 'whitespace', + 'text-max-width': 9999, + 'text-background-color': '#000', + 'text-background-opacity': 0, + 'text-background-shape': 'rectangle', + 'text-background-padding': 0, + 'text-border-opacity': 0, + 'text-border-width': 0, + 'text-border-style': 'solid', + 'text-border-color': '#000', + 'font-family': 'Helvetica Neue, Helvetica, sans-serif', + 'font-style': 'normal', + 'font-weight': 'normal', + 'font-size': 16, + 'min-zoomed-font-size': 0, + 'text-rotation': 'none', + 'source-text-rotation': 'none', + 'target-text-rotation': 'none', + 'visibility': 'visible', + 'display': 'element', + 'opacity': 1, + 'z-compound-depth': 'auto', + 'z-index-compare': 'auto', + 'z-index': 0, + 'label': '', + 'text-margin-x': 0, + 'text-margin-y': 0, + 'source-label': '', + 'source-text-offset': 0, + 'source-text-margin-x': 0, + 'source-text-margin-y': 0, + 'target-label': '', + 'target-text-offset': 0, + 'target-text-margin-x': 0, + 'target-text-margin-y': 0, + 'overlay-opacity': 0, + 'overlay-color': '#000', + 'overlay-padding': 10, + 'overlay-shape': 'round-rectangle', + 'underlay-opacity': 0, + 'underlay-color': '#000', + 'underlay-padding': 10, + 'underlay-shape': 'round-rectangle', + 'transition-property': 'none', + 'transition-duration': 0, + 'transition-delay': 0, + 'transition-timing-function': 'linear', + // node props + 'background-blacken': 0, + 'background-color': '#999', + 'background-fill': 'solid', + 'background-opacity': 1, + 'background-image': 'none', + 'background-image-crossorigin': 'anonymous', + 'background-image-opacity': 1, + 'background-image-containment': 'inside', + 'background-image-smoothing': 'yes', + 'background-position-x': '50%', + 'background-position-y': '50%', + 'background-offset-x': 0, + 'background-offset-y': 0, + 'background-width-relative-to': 'include-padding', + 'background-height-relative-to': 'include-padding', + 'background-repeat': 'no-repeat', + 'background-fit': 'none', + 'background-clip': 'node', + 'background-width': 'auto', + 'background-height': 'auto', + 'border-color': '#000', + 'border-opacity': 1, + 'border-width': 0, + 'border-style': 'solid', + 'height': 30, + 'width': 30, + 'shape': 'ellipse', + 'shape-polygon-points': '-1, -1, 1, -1, 1, 1, -1, 1', + 'bounds-expansion': 0, + // node gradient + 'background-gradient-direction': 'to-bottom', + 'background-gradient-stop-colors': '#999', + 'background-gradient-stop-positions': '0%', + // ghost props + 'ghost': 'no', + 'ghost-offset-y': 0, + 'ghost-offset-x': 0, + 'ghost-opacity': 0, + // compound props + 'padding': 0, + 'padding-relative-to': 'width', + 'position': 'origin', + 'compound-sizing-wrt-labels': 'include', + 'min-width': 0, + 'min-width-bias-left': 0, + 'min-width-bias-right': 0, + 'min-height': 0, + 'min-height-bias-top': 0, + 'min-height-bias-bottom': 0 + }, { + // node pie bg + 'pie-size': '100%' + }, [{ + name: 'pie-{{i}}-background-color', + value: 'black' + }, { + name: 'pie-{{i}}-background-size', + value: '0%' + }, { + name: 'pie-{{i}}-background-opacity', + value: 1 + }].reduce(function (css, prop) { + for (var i = 1; i <= styfn$2.pieBackgroundN; i++) { + var name = prop.name.replace('{{i}}', i); + var val = prop.value; + css[name] = val; + } + + return css; + }, {}), { + // edge props + 'line-style': 'solid', + 'line-color': '#999', + 'line-fill': 'solid', + 'line-cap': 'butt', + 'line-opacity': 1, + 'line-gradient-stop-colors': '#999', + 'line-gradient-stop-positions': '0%', + 'control-point-step-size': 40, + 'control-point-weights': 0.5, + 'segment-weights': 0.5, + 'segment-distances': 20, + 'taxi-turn': '50%', + 'taxi-turn-min-distance': 10, + 'taxi-direction': 'auto', + 'edge-distances': 'intersection', + 'curve-style': 'haystack', + 'haystack-radius': 0, + 'arrow-scale': 1, + 'loop-direction': '-45deg', + 'loop-sweep': '-90deg', + 'source-distance-from-node': 0, + 'target-distance-from-node': 0, + 'source-endpoint': 'outside-to-node', + 'target-endpoint': 'outside-to-node', + 'line-dash-pattern': [6, 3], + 'line-dash-offset': 0 + }, [{ + name: 'arrow-shape', + value: 'none' + }, { + name: 'arrow-color', + value: '#999' + }, { + name: 'arrow-fill', + value: 'filled' + }].reduce(function (css, prop) { + styfn$2.arrowPrefixes.forEach(function (prefix) { + var name = prefix + '-' + prop.name; + var val = prop.value; + css[name] = val; + }); + return css; + }, {})); + var parsedProps = {}; + + for (var i = 0; i < this.properties.length; i++) { + var prop = this.properties[i]; + + if (prop.pointsTo) { + continue; + } + + var name = prop.name; + var val = rawProps[name]; + var parsedProp = this.parse(name, val); + parsedProps[name] = parsedProp; + } + + _p.defaultProperties = parsedProps; + return _p.defaultProperties; +}; + +styfn$2.addDefaultStylesheet = function () { + this.selector(':parent').css({ + 'shape': 'rectangle', + 'padding': 10, + 'background-color': '#eee', + 'border-color': '#ccc', + 'border-width': 1 + }).selector('edge').css({ + 'width': 3 + }).selector(':loop').css({ + 'curve-style': 'bezier' + }).selector('edge:compound').css({ + 'curve-style': 'bezier', + 'source-endpoint': 'outside-to-line', + 'target-endpoint': 'outside-to-line' + }).selector(':selected').css({ + 'background-color': '#0169D9', + 'line-color': '#0169D9', + 'source-arrow-color': '#0169D9', + 'target-arrow-color': '#0169D9', + 'mid-source-arrow-color': '#0169D9', + 'mid-target-arrow-color': '#0169D9' + }).selector(':parent:selected').css({ + 'background-color': '#CCE1F9', + 'border-color': '#aec8e5' + }).selector(':active').css({ + 'overlay-color': 'black', + 'overlay-padding': 10, + 'overlay-opacity': 0.25 + }); + this.defaultLength = this.length; +}; + +var styfn$1 = {}; // a caching layer for property parsing + +styfn$1.parse = function (name, value, propIsBypass, propIsFlat) { + var self = this; // function values can't be cached in all cases, and there isn't much benefit of caching them anyway + + if (fn$6(value)) { + return self.parseImplWarn(name, value, propIsBypass, propIsFlat); + } + + var flatKey = propIsFlat === 'mapping' || propIsFlat === true || propIsFlat === false || propIsFlat == null ? 'dontcare' : propIsFlat; + var bypassKey = propIsBypass ? 't' : 'f'; + var valueKey = '' + value; + var argHash = hashStrings(name, valueKey, bypassKey, flatKey); + var propCache = self.propCache = self.propCache || []; + var ret; + + if (!(ret = propCache[argHash])) { + ret = propCache[argHash] = self.parseImplWarn(name, value, propIsBypass, propIsFlat); + } // - bypasses can't be shared b/c the value can be changed by animations or otherwise overridden + // - mappings can't be shared b/c mappings are per-element + + + if (propIsBypass || propIsFlat === 'mapping') { + // need a copy since props are mutated later in their lifecycles + ret = copy(ret); + + if (ret) { + ret.value = copy(ret.value); // because it could be an array, e.g. colour + } + } + + return ret; +}; + +styfn$1.parseImplWarn = function (name, value, propIsBypass, propIsFlat) { + var prop = this.parseImpl(name, value, propIsBypass, propIsFlat); + + if (!prop && value != null) { + warn("The style property `".concat(name, ": ").concat(value, "` is invalid")); + } + + if (prop && (prop.name === 'width' || prop.name === 'height') && value === 'label') { + warn('The style value of `label` is deprecated for `' + prop.name + '`'); + } + + return prop; +}; // parse a property; return null on invalid; return parsed property otherwise +// fields : +// - name : the name of the property +// - value : the parsed, native-typed value of the property +// - strValue : a string value that represents the property value in valid css +// - bypass : true iff the property is a bypass property + + +styfn$1.parseImpl = function (name, value, propIsBypass, propIsFlat) { + var self = this; + name = camel2dash(name); // make sure the property name is in dash form (e.g. 'property-name' not 'propertyName') + + var property = self.properties[name]; + var passedValue = value; + var types = self.types; + + if (!property) { + return null; + } // return null on property of unknown name + + + if (value === undefined) { + return null; + } // can't assign undefined + // the property may be an alias + + + if (property.alias) { + property = property.pointsTo; + name = property.name; + } + + var valueIsString = string(value); + + if (valueIsString) { + // trim the value to make parsing easier + value = value.trim(); + } + + var type = property.type; + + if (!type) { + return null; + } // no type, no luck + // check if bypass is null or empty string (i.e. indication to delete bypass property) + + + if (propIsBypass && (value === '' || value === null)) { + return { + name: name, + value: value, + bypass: true, + deleteBypass: true + }; + } // check if value is a function used as a mapper + + + if (fn$6(value)) { + return { + name: name, + value: value, + strValue: 'fn', + mapped: types.fn, + bypass: propIsBypass + }; + } // check if value is mapped + + + var data, mapData; + + if (!valueIsString || propIsFlat || value.length < 7 || value[1] !== 'a') ; else if (value.length >= 7 && value[0] === 'd' && (data = new RegExp(types.data.regex).exec(value))) { + if (propIsBypass) { + return false; + } // mappers not allowed in bypass + + + var mapped = types.data; + return { + name: name, + value: data, + strValue: '' + value, + mapped: mapped, + field: data[1], + bypass: propIsBypass + }; + } else if (value.length >= 10 && value[0] === 'm' && (mapData = new RegExp(types.mapData.regex).exec(value))) { + if (propIsBypass) { + return false; + } // mappers not allowed in bypass + + + if (type.multiple) { + return false; + } // impossible to map to num + + + var _mapped = types.mapData; // we can map only if the type is a colour or a number + + if (!(type.color || type.number)) { + return false; + } + + var valueMin = this.parse(name, mapData[4]); // parse to validate + + if (!valueMin || valueMin.mapped) { + return false; + } // can't be invalid or mapped + + + var valueMax = this.parse(name, mapData[5]); // parse to validate + + if (!valueMax || valueMax.mapped) { + return false; + } // can't be invalid or mapped + // check if valueMin and valueMax are the same + + + if (valueMin.pfValue === valueMax.pfValue || valueMin.strValue === valueMax.strValue) { + warn('`' + name + ': ' + value + '` is not a valid mapper because the output range is zero; converting to `' + name + ': ' + valueMin.strValue + '`'); + return this.parse(name, valueMin.strValue); // can't make much of a mapper without a range + } else if (type.color) { + var c1 = valueMin.value; + var c2 = valueMax.value; + var same = c1[0] === c2[0] // red + && c1[1] === c2[1] // green + && c1[2] === c2[2] // blue + && ( // optional alpha + c1[3] === c2[3] // same alpha outright + || (c1[3] == null || c1[3] === 1 // full opacity for colour 1? + ) && (c2[3] == null || c2[3] === 1) // full opacity for colour 2? + ); + + if (same) { + return false; + } // can't make a mapper without a range + + } + + return { + name: name, + value: mapData, + strValue: '' + value, + mapped: _mapped, + field: mapData[1], + fieldMin: parseFloat(mapData[2]), + // min & max are numeric + fieldMax: parseFloat(mapData[3]), + valueMin: valueMin.value, + valueMax: valueMax.value, + bypass: propIsBypass + }; + } + + if (type.multiple && propIsFlat !== 'multiple') { + var vals; + + if (valueIsString) { + vals = value.split(/\s+/); + } else if (array(value)) { + vals = value; + } else { + vals = [value]; + } + + if (type.evenMultiple && vals.length % 2 !== 0) { + return null; + } + + var valArr = []; + var unitsArr = []; + var pfValArr = []; + var strVal = ''; + var hasEnum = false; + + for (var i = 0; i < vals.length; i++) { + var p = self.parse(name, vals[i], propIsBypass, 'multiple'); + hasEnum = hasEnum || string(p.value); + valArr.push(p.value); + pfValArr.push(p.pfValue != null ? p.pfValue : p.value); + unitsArr.push(p.units); + strVal += (i > 0 ? ' ' : '') + p.strValue; + } + + if (type.validate && !type.validate(valArr, unitsArr)) { + return null; + } + + if (type.singleEnum && hasEnum) { + if (valArr.length === 1 && string(valArr[0])) { + return { + name: name, + value: valArr[0], + strValue: valArr[0], + bypass: propIsBypass + }; + } else { + return null; + } + } + + return { + name: name, + value: valArr, + pfValue: pfValArr, + strValue: strVal, + bypass: propIsBypass, + units: unitsArr + }; + } // several types also allow enums + + + var checkEnums = function checkEnums() { + for (var _i = 0; _i < type.enums.length; _i++) { + var en = type.enums[_i]; + + if (en === value) { + return { + name: name, + value: value, + strValue: '' + value, + bypass: propIsBypass + }; + } + } + + return null; + }; // check the type and return the appropriate object + + + if (type.number) { + var units; + var implicitUnits = 'px'; // not set => px + + if (type.units) { + // use specified units if set + units = type.units; + } + + if (type.implicitUnits) { + implicitUnits = type.implicitUnits; + } + + if (!type.unitless) { + if (valueIsString) { + var unitsRegex = 'px|em' + (type.allowPercent ? '|\\%' : ''); + + if (units) { + unitsRegex = units; + } // only allow explicit units if so set + + + var match = value.match('^(' + number + ')(' + unitsRegex + ')?' + '$'); + + if (match) { + value = match[1]; + units = match[2] || implicitUnits; + } + } else if (!units || type.implicitUnits) { + units = implicitUnits; // implicitly px if unspecified + } + } + + value = parseFloat(value); // if not a number and enums not allowed, then the value is invalid + + if (isNaN(value) && type.enums === undefined) { + return null; + } // check if this number type also accepts special keywords in place of numbers + // (i.e. `left`, `auto`, etc) + + + if (isNaN(value) && type.enums !== undefined) { + value = passedValue; + return checkEnums(); + } // check if value must be an integer + + + if (type.integer && !integer(value)) { + return null; + } // check value is within range + + + if (type.min !== undefined && (value < type.min || type.strictMin && value === type.min) || type.max !== undefined && (value > type.max || type.strictMax && value === type.max)) { + return null; + } + + var ret = { + name: name, + value: value, + strValue: '' + value + (units ? units : ''), + units: units, + bypass: propIsBypass + }; // normalise value in pixels + + if (type.unitless || units !== 'px' && units !== 'em') { + ret.pfValue = value; + } else { + ret.pfValue = units === 'px' || !units ? value : this.getEmSizeInPixels() * value; + } // normalise value in ms + + + if (units === 'ms' || units === 's') { + ret.pfValue = units === 'ms' ? value : 1000 * value; + } // normalise value in rad + + + if (units === 'deg' || units === 'rad') { + ret.pfValue = units === 'rad' ? value : deg2rad(value); + } // normalize value in % + + + if (units === '%') { + ret.pfValue = value / 100; + } + + return ret; + } else if (type.propList) { + var props = []; + var propsStr = '' + value; + + if (propsStr === 'none') ; else { + // go over each prop + var propsSplit = propsStr.split(/\s*,\s*|\s+/); + + for (var _i2 = 0; _i2 < propsSplit.length; _i2++) { + var propName = propsSplit[_i2].trim(); + + if (self.properties[propName]) { + props.push(propName); + } else { + warn('`' + propName + '` is not a valid property name'); + } + } + + if (props.length === 0) { + return null; + } + } + + return { + name: name, + value: props, + strValue: props.length === 0 ? 'none' : props.join(' '), + bypass: propIsBypass + }; + } else if (type.color) { + var tuple = color2tuple(value); + + if (!tuple) { + return null; + } + + return { + name: name, + value: tuple, + pfValue: tuple, + strValue: 'rgb(' + tuple[0] + ',' + tuple[1] + ',' + tuple[2] + ')', + // n.b. no spaces b/c of multiple support + bypass: propIsBypass + }; + } else if (type.regex || type.regexes) { + // first check enums + if (type.enums) { + var enumProp = checkEnums(); + + if (enumProp) { + return enumProp; + } + } + + var regexes = type.regexes ? type.regexes : [type.regex]; + + for (var _i3 = 0; _i3 < regexes.length; _i3++) { + var regex = new RegExp(regexes[_i3]); // make a regex from the type string + + var m = regex.exec(value); + + if (m) { + // regex matches + return { + name: name, + value: type.singleRegexMatchValue ? m[1] : m, + strValue: '' + value, + bypass: propIsBypass + }; + } + } + + return null; // didn't match any + } else if (type.string) { + // just return + return { + name: name, + value: '' + value, + strValue: '' + value, + bypass: propIsBypass + }; + } else if (type.enums) { + // check enums last because it's a combo type in others + return checkEnums(); + } else { + return null; // not a type we can handle + } +}; + +var Style = function Style(cy) { + if (!(this instanceof Style)) { + return new Style(cy); + } + + if (!core(cy)) { + error('A style must have a core reference'); + return; + } + + this._private = { + cy: cy, + coreStyle: {} + }; + this.length = 0; + this.resetToDefault(); +}; + +var styfn = Style.prototype; + +styfn.instanceString = function () { + return 'style'; +}; // remove all contexts + + +styfn.clear = function () { + var _p = this._private; + var cy = _p.cy; + var eles = cy.elements(); + + for (var i = 0; i < this.length; i++) { + this[i] = undefined; + } + + this.length = 0; + _p.contextStyles = {}; + _p.propDiffs = {}; + this.cleanElements(eles, true); + eles.forEach(function (ele) { + var ele_p = ele[0]._private; + ele_p.styleDirty = true; + ele_p.appliedInitStyle = false; + }); + return this; // chaining +}; + +styfn.resetToDefault = function () { + this.clear(); + this.addDefaultStylesheet(); + return this; +}; // builds a style object for the 'core' selector + + +styfn.core = function (propName) { + return this._private.coreStyle[propName] || this.getDefaultProperty(propName); +}; // create a new context from the specified selector string and switch to that context + + +styfn.selector = function (selectorStr) { + // 'core' is a special case and does not need a selector + var selector = selectorStr === 'core' ? null : new Selector(selectorStr); + var i = this.length++; // new context means new index + + this[i] = { + selector: selector, + properties: [], + mappedProperties: [], + index: i + }; + return this; // chaining +}; // add one or many css rules to the current context + + +styfn.css = function () { + var self = this; + var args = arguments; + + if (args.length === 1) { + var map = args[0]; + + for (var i = 0; i < self.properties.length; i++) { + var prop = self.properties[i]; + var mapVal = map[prop.name]; + + if (mapVal === undefined) { + mapVal = map[dash2camel(prop.name)]; + } + + if (mapVal !== undefined) { + this.cssRule(prop.name, mapVal); + } + } + } else if (args.length === 2) { + this.cssRule(args[0], args[1]); + } // do nothing if args are invalid + + + return this; // chaining +}; + +styfn.style = styfn.css; // add a single css rule to the current context + +styfn.cssRule = function (name, value) { + // name-value pair + var property = this.parse(name, value); // add property to current context if valid + + if (property) { + var i = this.length - 1; + this[i].properties.push(property); + this[i].properties[property.name] = property; // allow access by name as well + + if (property.name.match(/pie-(\d+)-background-size/) && property.value) { + this._private.hasPie = true; + } + + if (property.mapped) { + this[i].mappedProperties.push(property); + } // add to core style if necessary + + + var currentSelectorIsCore = !this[i].selector; + + if (currentSelectorIsCore) { + this._private.coreStyle[property.name] = property; + } + } + + return this; // chaining +}; + +styfn.append = function (style) { + if (stylesheet(style)) { + style.appendToStyle(this); + } else if (array(style)) { + this.appendFromJson(style); + } else if (string(style)) { + this.appendFromString(style); + } // you probably wouldn't want to append a Style, since you'd duplicate the default parts + + + return this; +}; // static function + + +Style.fromJson = function (cy, json) { + var style = new Style(cy); + style.fromJson(json); + return style; +}; + +Style.fromString = function (cy, string) { + return new Style(cy).fromString(string); +}; + +[styfn$8, styfn$7, styfn$6, styfn$5, styfn$4, styfn$3, styfn$2, styfn$1].forEach(function (props) { + extend(styfn, props); +}); +Style.types = styfn.types; +Style.properties = styfn.properties; +Style.propertyGroups = styfn.propertyGroups; +Style.propertyGroupNames = styfn.propertyGroupNames; +Style.propertyGroupKeys = styfn.propertyGroupKeys; + +var corefn$2 = { + style: function style(newStyle) { + if (newStyle) { + var s = this.setStyle(newStyle); + s.update(); + } + + return this._private.style; + }, + setStyle: function setStyle(style) { + var _p = this._private; + + if (stylesheet(style)) { + _p.style = style.generateStyle(this); + } else if (array(style)) { + _p.style = Style.fromJson(this, style); + } else if (string(style)) { + _p.style = Style.fromString(this, style); + } else { + _p.style = Style(this); + } + + return _p.style; + }, + // e.g. cy.data() changed => recalc ele mappers + updateStyle: function updateStyle() { + this.mutableElements().updateStyle(); // just send to all eles + } +}; + +var defaultSelectionType = 'single'; +var corefn$1 = { + autolock: function autolock(bool) { + if (bool !== undefined) { + this._private.autolock = bool ? true : false; + } else { + return this._private.autolock; + } + + return this; // chaining + }, + autoungrabify: function autoungrabify(bool) { + if (bool !== undefined) { + this._private.autoungrabify = bool ? true : false; + } else { + return this._private.autoungrabify; + } + + return this; // chaining + }, + autounselectify: function autounselectify(bool) { + if (bool !== undefined) { + this._private.autounselectify = bool ? true : false; + } else { + return this._private.autounselectify; + } + + return this; // chaining + }, + selectionType: function selectionType(selType) { + var _p = this._private; + + if (_p.selectionType == null) { + _p.selectionType = defaultSelectionType; + } + + if (selType !== undefined) { + if (selType === 'additive' || selType === 'single') { + _p.selectionType = selType; + } + } else { + return _p.selectionType; + } + + return this; + }, + panningEnabled: function panningEnabled(bool) { + if (bool !== undefined) { + this._private.panningEnabled = bool ? true : false; + } else { + return this._private.panningEnabled; + } + + return this; // chaining + }, + userPanningEnabled: function userPanningEnabled(bool) { + if (bool !== undefined) { + this._private.userPanningEnabled = bool ? true : false; + } else { + return this._private.userPanningEnabled; + } + + return this; // chaining + }, + zoomingEnabled: function zoomingEnabled(bool) { + if (bool !== undefined) { + this._private.zoomingEnabled = bool ? true : false; + } else { + return this._private.zoomingEnabled; + } + + return this; // chaining + }, + userZoomingEnabled: function userZoomingEnabled(bool) { + if (bool !== undefined) { + this._private.userZoomingEnabled = bool ? true : false; + } else { + return this._private.userZoomingEnabled; + } + + return this; // chaining + }, + boxSelectionEnabled: function boxSelectionEnabled(bool) { + if (bool !== undefined) { + this._private.boxSelectionEnabled = bool ? true : false; + } else { + return this._private.boxSelectionEnabled; + } + + return this; // chaining + }, + pan: function pan() { + var args = arguments; + var pan = this._private.pan; + var dim, val, dims, x, y; + + switch (args.length) { + case 0: + // .pan() + return pan; + + case 1: + if (string(args[0])) { + // .pan('x') + dim = args[0]; + return pan[dim]; + } else if (plainObject(args[0])) { + // .pan({ x: 0, y: 100 }) + if (!this._private.panningEnabled) { + return this; + } + + dims = args[0]; + x = dims.x; + y = dims.y; + + if (number$1(x)) { + pan.x = x; + } + + if (number$1(y)) { + pan.y = y; + } + + this.emit('pan viewport'); + } + + break; + + case 2: + // .pan('x', 100) + if (!this._private.panningEnabled) { + return this; + } + + dim = args[0]; + val = args[1]; + + if ((dim === 'x' || dim === 'y') && number$1(val)) { + pan[dim] = val; + } + + this.emit('pan viewport'); + break; + // invalid + } + + this.notify('viewport'); + return this; // chaining + }, + panBy: function panBy(arg0, arg1) { + var args = arguments; + var pan = this._private.pan; + var dim, val, dims, x, y; + + if (!this._private.panningEnabled) { + return this; + } + + switch (args.length) { + case 1: + if (plainObject(arg0)) { + // .panBy({ x: 0, y: 100 }) + dims = args[0]; + x = dims.x; + y = dims.y; + + if (number$1(x)) { + pan.x += x; + } + + if (number$1(y)) { + pan.y += y; + } + + this.emit('pan viewport'); + } + + break; + + case 2: + // .panBy('x', 100) + dim = arg0; + val = arg1; + + if ((dim === 'x' || dim === 'y') && number$1(val)) { + pan[dim] += val; + } + + this.emit('pan viewport'); + break; + // invalid + } + + this.notify('viewport'); + return this; // chaining + }, + fit: function fit(elements, padding) { + var viewportState = this.getFitViewport(elements, padding); + + if (viewportState) { + var _p = this._private; + _p.zoom = viewportState.zoom; + _p.pan = viewportState.pan; + this.emit('pan zoom viewport'); + this.notify('viewport'); + } + + return this; // chaining + }, + getFitViewport: function getFitViewport(elements, padding) { + if (number$1(elements) && padding === undefined) { + // elements is optional + padding = elements; + elements = undefined; + } + + if (!this._private.panningEnabled || !this._private.zoomingEnabled) { + return; + } + + var bb; + + if (string(elements)) { + var sel = elements; + elements = this.$(sel); + } else if (boundingBox(elements)) { + // assume bb + var bbe = elements; + bb = { + x1: bbe.x1, + y1: bbe.y1, + x2: bbe.x2, + y2: bbe.y2 + }; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + } else if (!elementOrCollection(elements)) { + elements = this.mutableElements(); + } + + if (elementOrCollection(elements) && elements.empty()) { + return; + } // can't fit to nothing + + + bb = bb || elements.boundingBox(); + var w = this.width(); + var h = this.height(); + var zoom; + padding = number$1(padding) ? padding : 0; + + if (!isNaN(w) && !isNaN(h) && w > 0 && h > 0 && !isNaN(bb.w) && !isNaN(bb.h) && bb.w > 0 && bb.h > 0) { + zoom = Math.min((w - 2 * padding) / bb.w, (h - 2 * padding) / bb.h); // crop zoom + + zoom = zoom > this._private.maxZoom ? this._private.maxZoom : zoom; + zoom = zoom < this._private.minZoom ? this._private.minZoom : zoom; + var pan = { + // now pan to middle + x: (w - zoom * (bb.x1 + bb.x2)) / 2, + y: (h - zoom * (bb.y1 + bb.y2)) / 2 + }; + return { + zoom: zoom, + pan: pan + }; + } + + return; + }, + zoomRange: function zoomRange(min, max) { + var _p = this._private; + + if (max == null) { + var opts = min; + min = opts.min; + max = opts.max; + } + + if (number$1(min) && number$1(max) && min <= max) { + _p.minZoom = min; + _p.maxZoom = max; + } else if (number$1(min) && max === undefined && min <= _p.maxZoom) { + _p.minZoom = min; + } else if (number$1(max) && min === undefined && max >= _p.minZoom) { + _p.maxZoom = max; + } + + return this; + }, + minZoom: function minZoom(zoom) { + if (zoom === undefined) { + return this._private.minZoom; + } else { + return this.zoomRange({ + min: zoom + }); + } + }, + maxZoom: function maxZoom(zoom) { + if (zoom === undefined) { + return this._private.maxZoom; + } else { + return this.zoomRange({ + max: zoom + }); + } + }, + getZoomedViewport: function getZoomedViewport(params) { + var _p = this._private; + var currentPan = _p.pan; + var currentZoom = _p.zoom; + var pos; // in rendered px + + var zoom; + var bail = false; + + if (!_p.zoomingEnabled) { + // zooming disabled + bail = true; + } + + if (number$1(params)) { + // then set the zoom + zoom = params; + } else if (plainObject(params)) { + // then zoom about a point + zoom = params.level; + + if (params.position != null) { + pos = modelToRenderedPosition(params.position, currentZoom, currentPan); + } else if (params.renderedPosition != null) { + pos = params.renderedPosition; + } + + if (pos != null && !_p.panningEnabled) { + // panning disabled + bail = true; + } + } // crop zoom + + + zoom = zoom > _p.maxZoom ? _p.maxZoom : zoom; + zoom = zoom < _p.minZoom ? _p.minZoom : zoom; // can't zoom with invalid params + + if (bail || !number$1(zoom) || zoom === currentZoom || pos != null && (!number$1(pos.x) || !number$1(pos.y))) { + return null; + } + + if (pos != null) { + // set zoom about position + var pan1 = currentPan; + var zoom1 = currentZoom; + var zoom2 = zoom; + var pan2 = { + x: -zoom2 / zoom1 * (pos.x - pan1.x) + pos.x, + y: -zoom2 / zoom1 * (pos.y - pan1.y) + pos.y + }; + return { + zoomed: true, + panned: true, + zoom: zoom2, + pan: pan2 + }; + } else { + // just set the zoom + return { + zoomed: true, + panned: false, + zoom: zoom, + pan: currentPan + }; + } + }, + zoom: function zoom(params) { + if (params === undefined) { + // get + return this._private.zoom; + } else { + // set + var vp = this.getZoomedViewport(params); + var _p = this._private; + + if (vp == null || !vp.zoomed) { + return this; + } + + _p.zoom = vp.zoom; + + if (vp.panned) { + _p.pan.x = vp.pan.x; + _p.pan.y = vp.pan.y; + } + + this.emit('zoom' + (vp.panned ? ' pan' : '') + ' viewport'); + this.notify('viewport'); + return this; // chaining + } + }, + viewport: function viewport(opts) { + var _p = this._private; + var zoomDefd = true; + var panDefd = true; + var events = []; // to trigger + + var zoomFailed = false; + var panFailed = false; + + if (!opts) { + return this; + } + + if (!number$1(opts.zoom)) { + zoomDefd = false; + } + + if (!plainObject(opts.pan)) { + panDefd = false; + } + + if (!zoomDefd && !panDefd) { + return this; + } + + if (zoomDefd) { + var z = opts.zoom; + + if (z < _p.minZoom || z > _p.maxZoom || !_p.zoomingEnabled) { + zoomFailed = true; + } else { + _p.zoom = z; + events.push('zoom'); + } + } + + if (panDefd && (!zoomFailed || !opts.cancelOnFailedZoom) && _p.panningEnabled) { + var p = opts.pan; + + if (number$1(p.x)) { + _p.pan.x = p.x; + panFailed = false; + } + + if (number$1(p.y)) { + _p.pan.y = p.y; + panFailed = false; + } + + if (!panFailed) { + events.push('pan'); + } + } + + if (events.length > 0) { + events.push('viewport'); + this.emit(events.join(' ')); + this.notify('viewport'); + } + + return this; // chaining + }, + center: function center(elements) { + var pan = this.getCenterPan(elements); + + if (pan) { + this._private.pan = pan; + this.emit('pan viewport'); + this.notify('viewport'); + } + + return this; // chaining + }, + getCenterPan: function getCenterPan(elements, zoom) { + if (!this._private.panningEnabled) { + return; + } + + if (string(elements)) { + var selector = elements; + elements = this.mutableElements().filter(selector); + } else if (!elementOrCollection(elements)) { + elements = this.mutableElements(); + } + + if (elements.length === 0) { + return; + } // can't centre pan to nothing + + + var bb = elements.boundingBox(); + var w = this.width(); + var h = this.height(); + zoom = zoom === undefined ? this._private.zoom : zoom; + var pan = { + // middle + x: (w - zoom * (bb.x1 + bb.x2)) / 2, + y: (h - zoom * (bb.y1 + bb.y2)) / 2 + }; + return pan; + }, + reset: function reset() { + if (!this._private.panningEnabled || !this._private.zoomingEnabled) { + return this; + } + + this.viewport({ + pan: { + x: 0, + y: 0 + }, + zoom: 1 + }); + return this; // chaining + }, + invalidateSize: function invalidateSize() { + this._private.sizeCache = null; + }, + size: function size() { + var _p = this._private; + var container = _p.container; + return _p.sizeCache = _p.sizeCache || (container ? function () { + var style = window$1.getComputedStyle(container); + + var val = function val(name) { + return parseFloat(style.getPropertyValue(name)); + }; + + return { + width: container.clientWidth - val('padding-left') - val('padding-right'), + height: container.clientHeight - val('padding-top') - val('padding-bottom') + }; + }() : { + // fallback if no container (not 0 b/c can be used for dividing etc) + width: 1, + height: 1 + }); + }, + width: function width() { + return this.size().width; + }, + height: function height() { + return this.size().height; + }, + extent: function extent() { + var pan = this._private.pan; + var zoom = this._private.zoom; + var rb = this.renderedExtent(); + var b = { + x1: (rb.x1 - pan.x) / zoom, + x2: (rb.x2 - pan.x) / zoom, + y1: (rb.y1 - pan.y) / zoom, + y2: (rb.y2 - pan.y) / zoom + }; + b.w = b.x2 - b.x1; + b.h = b.y2 - b.y1; + return b; + }, + renderedExtent: function renderedExtent() { + var width = this.width(); + var height = this.height(); + return { + x1: 0, + y1: 0, + x2: width, + y2: height, + w: width, + h: height + }; + }, + multiClickDebounceTime: function multiClickDebounceTime(_int) { + if (_int) this._private.multiClickDebounceTime = _int;else return this._private.multiClickDebounceTime; + return this; // chaining + } +}; // aliases + +corefn$1.centre = corefn$1.center; // backwards compatibility + +corefn$1.autolockNodes = corefn$1.autolock; +corefn$1.autoungrabifyNodes = corefn$1.autoungrabify; + +var fn = { + data: define.data({ + field: 'data', + bindingEvent: 'data', + allowBinding: true, + allowSetting: true, + settingEvent: 'data', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + updateStyle: true + }), + removeData: define.removeData({ + field: 'data', + event: 'data', + triggerFnName: 'trigger', + triggerEvent: true, + updateStyle: true + }), + scratch: define.data({ + field: 'scratch', + bindingEvent: 'scratch', + allowBinding: true, + allowSetting: true, + settingEvent: 'scratch', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + updateStyle: true + }), + removeScratch: define.removeData({ + field: 'scratch', + event: 'scratch', + triggerFnName: 'trigger', + triggerEvent: true, + updateStyle: true + }) +}; // aliases + +fn.attr = fn.data; +fn.removeAttr = fn.removeData; + +var Core = function Core(opts) { + var cy = this; + opts = extend({}, opts); + var container = opts.container; // allow for passing a wrapped jquery object + // e.g. cytoscape({ container: $('#cy') }) + + if (container && !htmlElement(container) && htmlElement(container[0])) { + container = container[0]; + } + + var reg = container ? container._cyreg : null; // e.g. already registered some info (e.g. readies) via jquery + + reg = reg || {}; + + if (reg && reg.cy) { + reg.cy.destroy(); + reg = {}; // old instance => replace reg completely + } + + var readies = reg.readies = reg.readies || []; + + if (container) { + container._cyreg = reg; + } // make sure container assoc'd reg points to this cy + + + reg.cy = cy; + var head = window$1 !== undefined && container !== undefined && !opts.headless; + var options = opts; + options.layout = extend({ + name: head ? 'grid' : 'null' + }, options.layout); + options.renderer = extend({ + name: head ? 'canvas' : 'null' + }, options.renderer); + + var defVal = function defVal(def, val, altVal) { + if (val !== undefined) { + return val; + } else if (altVal !== undefined) { + return altVal; + } else { + return def; + } + }; + + var _p = this._private = { + container: container, + // html dom ele container + ready: false, + // whether ready has been triggered + options: options, + // cached options + elements: new Collection(this), + // elements in the graph + listeners: [], + // list of listeners + aniEles: new Collection(this), + // elements being animated + data: options.data || {}, + // data for the core + scratch: {}, + // scratch object for core + layout: null, + renderer: null, + destroyed: false, + // whether destroy was called + notificationsEnabled: true, + // whether notifications are sent to the renderer + minZoom: 1e-50, + maxZoom: 1e50, + zoomingEnabled: defVal(true, options.zoomingEnabled), + userZoomingEnabled: defVal(true, options.userZoomingEnabled), + panningEnabled: defVal(true, options.panningEnabled), + userPanningEnabled: defVal(true, options.userPanningEnabled), + boxSelectionEnabled: defVal(true, options.boxSelectionEnabled), + autolock: defVal(false, options.autolock, options.autolockNodes), + autoungrabify: defVal(false, options.autoungrabify, options.autoungrabifyNodes), + autounselectify: defVal(false, options.autounselectify), + styleEnabled: options.styleEnabled === undefined ? head : options.styleEnabled, + zoom: number$1(options.zoom) ? options.zoom : 1, + pan: { + x: plainObject(options.pan) && number$1(options.pan.x) ? options.pan.x : 0, + y: plainObject(options.pan) && number$1(options.pan.y) ? options.pan.y : 0 + }, + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + hasCompoundNodes: false, + multiClickDebounceTime: defVal(250, options.multiClickDebounceTime) + }; + + this.createEmitter(); // set selection type + + this.selectionType(options.selectionType); // init zoom bounds + + this.zoomRange({ + min: options.minZoom, + max: options.maxZoom + }); + + var loadExtData = function loadExtData(extData, next) { + var anyIsPromise = extData.some(promise); + + if (anyIsPromise) { + return Promise$1.all(extData).then(next); // load all data asynchronously, then exec rest of init + } else { + next(extData); // exec synchronously for convenience + } + }; // start with the default stylesheet so we have something before loading an external stylesheet + + + if (_p.styleEnabled) { + cy.setStyle([]); + } // create the renderer + + + var rendererOptions = extend({}, options, options.renderer); // allow rendering hints in top level options + + cy.initRenderer(rendererOptions); + + var setElesAndLayout = function setElesAndLayout(elements, onload, ondone) { + cy.notifications(false); // remove old elements + + var oldEles = cy.mutableElements(); + + if (oldEles.length > 0) { + oldEles.remove(); + } + + if (elements != null) { + if (plainObject(elements) || array(elements)) { + cy.add(elements); + } + } + + cy.one('layoutready', function (e) { + cy.notifications(true); + cy.emit(e); // we missed this event by turning notifications off, so pass it on + + cy.one('load', onload); + cy.emitAndNotify('load'); + }).one('layoutstop', function () { + cy.one('done', ondone); + cy.emit('done'); + }); + var layoutOpts = extend({}, cy._private.options.layout); + layoutOpts.eles = cy.elements(); + cy.layout(layoutOpts).run(); + }; + + loadExtData([options.style, options.elements], function (thens) { + var initStyle = thens[0]; + var initEles = thens[1]; // init style + + if (_p.styleEnabled) { + cy.style().append(initStyle); + } // initial load + + + setElesAndLayout(initEles, function () { + // onready + cy.startAnimationLoop(); + _p.ready = true; // if a ready callback is specified as an option, the bind it + + if (fn$6(options.ready)) { + cy.on('ready', options.ready); + } // bind all the ready handlers registered before creating this instance + + + for (var i = 0; i < readies.length; i++) { + var fn = readies[i]; + cy.on('ready', fn); + } + + if (reg) { + reg.readies = []; + } // clear b/c we've bound them all and don't want to keep it around in case a new core uses the same div etc + + + cy.emit('ready'); + }, options.done); + }); +}; + +var corefn = Core.prototype; // short alias + +extend(corefn, { + instanceString: function instanceString() { + return 'core'; + }, + isReady: function isReady() { + return this._private.ready; + }, + destroyed: function destroyed() { + return this._private.destroyed; + }, + ready: function ready(fn) { + if (this.isReady()) { + this.emitter().emit('ready', [], fn); // just calls fn as though triggered via ready event + } else { + this.on('ready', fn); + } + + return this; + }, + destroy: function destroy() { + var cy = this; + if (cy.destroyed()) return; + cy.stopAnimationLoop(); + cy.destroyRenderer(); + this.emit('destroy'); + cy._private.destroyed = true; + return cy; + }, + hasElementWithId: function hasElementWithId(id) { + return this._private.elements.hasElementWithId(id); + }, + getElementById: function getElementById(id) { + return this._private.elements.getElementById(id); + }, + hasCompoundNodes: function hasCompoundNodes() { + return this._private.hasCompoundNodes; + }, + headless: function headless() { + return this._private.renderer.isHeadless(); + }, + styleEnabled: function styleEnabled() { + return this._private.styleEnabled; + }, + addToPool: function addToPool(eles) { + this._private.elements.merge(eles); + + return this; // chaining + }, + removeFromPool: function removeFromPool(eles) { + this._private.elements.unmerge(eles); + + return this; + }, + container: function container() { + return this._private.container || null; + }, + mount: function mount(container) { + if (container == null) { + return; + } + + var cy = this; + var _p = cy._private; + var options = _p.options; + + if (!htmlElement(container) && htmlElement(container[0])) { + container = container[0]; + } + + cy.stopAnimationLoop(); + cy.destroyRenderer(); + _p.container = container; + _p.styleEnabled = true; + cy.invalidateSize(); + cy.initRenderer(extend({}, options, options.renderer, { + // allow custom renderer name to be re-used, otherwise use canvas + name: options.renderer.name === 'null' ? 'canvas' : options.renderer.name + })); + cy.startAnimationLoop(); + cy.style(options.style); + cy.emit('mount'); + return cy; + }, + unmount: function unmount() { + var cy = this; + cy.stopAnimationLoop(); + cy.destroyRenderer(); + cy.initRenderer({ + name: 'null' + }); + cy.emit('unmount'); + return cy; + }, + options: function options() { + return copy(this._private.options); + }, + json: function json(obj) { + var cy = this; + var _p = cy._private; + var eles = cy.mutableElements(); + + var getFreshRef = function getFreshRef(ele) { + return cy.getElementById(ele.id()); + }; + + if (plainObject(obj)) { + // set + cy.startBatch(); + + if (obj.elements) { + var idInJson = {}; + + var updateEles = function updateEles(jsons, gr) { + var toAdd = []; + var toMod = []; + + for (var i = 0; i < jsons.length; i++) { + var json = jsons[i]; + + if (!json.data.id) { + warn('cy.json() cannot handle elements without an ID attribute'); + continue; + } + + var id = '' + json.data.id; // id must be string + + var ele = cy.getElementById(id); + idInJson[id] = true; + + if (ele.length !== 0) { + // existing element should be updated + toMod.push({ + ele: ele, + json: json + }); + } else { + // otherwise should be added + if (gr) { + json.group = gr; + toAdd.push(json); + } else { + toAdd.push(json); + } + } + } + + cy.add(toAdd); + + for (var _i = 0; _i < toMod.length; _i++) { + var _toMod$_i = toMod[_i], + _ele = _toMod$_i.ele, + _json = _toMod$_i.json; + + _ele.json(_json); + } + }; + + if (array(obj.elements)) { + // elements: [] + updateEles(obj.elements); + } else { + // elements: { nodes: [], edges: [] } + var grs = ['nodes', 'edges']; + + for (var i = 0; i < grs.length; i++) { + var gr = grs[i]; + var elements = obj.elements[gr]; + + if (array(elements)) { + updateEles(elements, gr); + } + } + } + + var parentsToRemove = cy.collection(); + eles.filter(function (ele) { + return !idInJson[ele.id()]; + }).forEach(function (ele) { + if (ele.isParent()) { + parentsToRemove.merge(ele); + } else { + ele.remove(); + } + }); // so that children are not removed w/parent + + parentsToRemove.forEach(function (ele) { + return ele.children().move({ + parent: null + }); + }); // intermediate parents may be moved by prior line, so make sure we remove by fresh refs + + parentsToRemove.forEach(function (ele) { + return getFreshRef(ele).remove(); + }); + } + + if (obj.style) { + cy.style(obj.style); + } + + if (obj.zoom != null && obj.zoom !== _p.zoom) { + cy.zoom(obj.zoom); + } + + if (obj.pan) { + if (obj.pan.x !== _p.pan.x || obj.pan.y !== _p.pan.y) { + cy.pan(obj.pan); + } + } + + if (obj.data) { + cy.data(obj.data); + } + + var fields = ['minZoom', 'maxZoom', 'zoomingEnabled', 'userZoomingEnabled', 'panningEnabled', 'userPanningEnabled', 'boxSelectionEnabled', 'autolock', 'autoungrabify', 'autounselectify', 'multiClickDebounceTime']; + + for (var _i2 = 0; _i2 < fields.length; _i2++) { + var f = fields[_i2]; + + if (obj[f] != null) { + cy[f](obj[f]); + } + } + + cy.endBatch(); + return this; // chaining + } else { + // get + var flat = !!obj; + var json = {}; + + if (flat) { + json.elements = this.elements().map(function (ele) { + return ele.json(); + }); + } else { + json.elements = {}; + eles.forEach(function (ele) { + var group = ele.group(); + + if (!json.elements[group]) { + json.elements[group] = []; + } + + json.elements[group].push(ele.json()); + }); + } + + if (this._private.styleEnabled) { + json.style = cy.style().json(); + } + + json.data = copy(cy.data()); + var options = _p.options; + json.zoomingEnabled = _p.zoomingEnabled; + json.userZoomingEnabled = _p.userZoomingEnabled; + json.zoom = _p.zoom; + json.minZoom = _p.minZoom; + json.maxZoom = _p.maxZoom; + json.panningEnabled = _p.panningEnabled; + json.userPanningEnabled = _p.userPanningEnabled; + json.pan = copy(_p.pan); + json.boxSelectionEnabled = _p.boxSelectionEnabled; + json.renderer = copy(options.renderer); + json.hideEdgesOnViewport = options.hideEdgesOnViewport; + json.textureOnViewport = options.textureOnViewport; + json.wheelSensitivity = options.wheelSensitivity; + json.motionBlur = options.motionBlur; + json.multiClickDebounceTime = options.multiClickDebounceTime; + return json; + } + } +}); +corefn.$id = corefn.getElementById; +[corefn$9, corefn$8, elesfn, corefn$7, corefn$6, corefn$5, corefn$4, corefn$3, corefn$2, corefn$1, fn].forEach(function (props) { + extend(corefn, props); +}); + +/* eslint-disable no-unused-vars */ + +var defaults$7 = { + fit: true, + // whether to fit the viewport to the graph + directed: false, + // whether the tree is directed downwards (or edges can point in any direction if false) + padding: 30, + // padding on fit + circle: false, + // put depths in concentric circles if true, put depths top down if false + grid: false, + // whether to create an even grid into which the DAG is placed (circle:false only) + spacingFactor: 1.75, + // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap) + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + roots: undefined, + // the roots of the trees + maximal: false, + // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only) + depthSort: undefined, + // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled, + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + +}; +/* eslint-enable */ + +var getInfo = function getInfo(ele) { + return ele.scratch('breadthfirst'); +}; + +var setInfo = function setInfo(ele, obj) { + return ele.scratch('breadthfirst', obj); +}; + +function BreadthFirstLayout(options) { + this.options = extend({}, defaults$7, options); +} + +BreadthFirstLayout.prototype.run = function () { + var params = this.options; + var options = params; + var cy = params.cy; + var eles = options.eles; + var nodes = eles.nodes().filter(function (n) { + return !n.isParent(); + }); + var graph = eles; + var directed = options.directed; + var maximal = options.maximal || options.maximalAdjustments > 0; // maximalAdjustments for compat. w/ old code + + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var roots; + + if (elementOrCollection(options.roots)) { + roots = options.roots; + } else if (array(options.roots)) { + var rootsArray = []; + + for (var i = 0; i < options.roots.length; i++) { + var id = options.roots[i]; + var ele = cy.getElementById(id); + rootsArray.push(ele); + } + + roots = cy.collection(rootsArray); + } else if (string(options.roots)) { + roots = cy.$(options.roots); + } else { + if (directed) { + roots = nodes.roots(); + } else { + var components = eles.components(); + roots = cy.collection(); + + var _loop = function _loop(_i) { + var comp = components[_i]; + var maxDegree = comp.maxDegree(false); + var compRoots = comp.filter(function (ele) { + return ele.degree(false) === maxDegree; + }); + roots = roots.add(compRoots); + }; + + for (var _i = 0; _i < components.length; _i++) { + _loop(_i); + } + } + } + + var depths = []; + var foundByBfs = {}; + + var addToDepth = function addToDepth(ele, d) { + if (depths[d] == null) { + depths[d] = []; + } + + var i = depths[d].length; + depths[d].push(ele); + setInfo(ele, { + index: i, + depth: d + }); + }; + + var changeDepth = function changeDepth(ele, newDepth) { + var _getInfo = getInfo(ele), + depth = _getInfo.depth, + index = _getInfo.index; + + depths[depth][index] = null; + addToDepth(ele, newDepth); + }; // find the depths of the nodes + + + graph.bfs({ + roots: roots, + directed: options.directed, + visit: function visit(node, edge, pNode, i, depth) { + var ele = node[0]; + var id = ele.id(); + addToDepth(ele, depth); + foundByBfs[id] = true; + } + }); // check for nodes not found by bfs + + var orphanNodes = []; + + for (var _i2 = 0; _i2 < nodes.length; _i2++) { + var _ele = nodes[_i2]; + + if (foundByBfs[_ele.id()]) { + continue; + } else { + orphanNodes.push(_ele); + } + } // assign the nodes a depth and index + + + var assignDepthsAt = function assignDepthsAt(i) { + var eles = depths[i]; + + for (var j = 0; j < eles.length; j++) { + var _ele2 = eles[j]; + + if (_ele2 == null) { + eles.splice(j, 1); + j--; + continue; + } + + setInfo(_ele2, { + depth: i, + index: j + }); + } + }; + + var assignDepths = function assignDepths() { + for (var _i3 = 0; _i3 < depths.length; _i3++) { + assignDepthsAt(_i3); + } + }; + + var adjustMaximally = function adjustMaximally(ele, shifted) { + var eInfo = getInfo(ele); + var incomers = ele.incomers().filter(function (el) { + return el.isNode() && eles.has(el); + }); + var maxDepth = -1; + var id = ele.id(); + + for (var k = 0; k < incomers.length; k++) { + var incmr = incomers[k]; + var iInfo = getInfo(incmr); + maxDepth = Math.max(maxDepth, iInfo.depth); + } + + if (eInfo.depth <= maxDepth) { + if (shifted[id]) { + return null; + } + + changeDepth(ele, maxDepth + 1); + shifted[id] = true; + return true; + } + + return false; + }; // for the directed case, try to make the edges all go down (i.e. depth i => depth i + 1) + + + if (directed && maximal) { + var Q = []; + var shifted = {}; + + var enqueue = function enqueue(n) { + return Q.push(n); + }; + + var dequeue = function dequeue() { + return Q.shift(); + }; + + nodes.forEach(function (n) { + return Q.push(n); + }); + + while (Q.length > 0) { + var _ele3 = dequeue(); + + var didShift = adjustMaximally(_ele3, shifted); + + if (didShift) { + _ele3.outgoers().filter(function (el) { + return el.isNode() && eles.has(el); + }).forEach(enqueue); + } else if (didShift === null) { + warn('Detected double maximal shift for node `' + _ele3.id() + '`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.'); + break; // exit on failure + } + } + } + + assignDepths(); // clear holes + // find min distance we need to leave between nodes + + var minDistance = 0; + + if (options.avoidOverlap) { + for (var _i4 = 0; _i4 < nodes.length; _i4++) { + var n = nodes[_i4]; + var nbb = n.layoutDimensions(options); + var w = nbb.w; + var h = nbb.h; + minDistance = Math.max(minDistance, w, h); + } + } // get the weighted percent for an element based on its connectivity to other levels + + + var cachedWeightedPercent = {}; + + var getWeightedPercent = function getWeightedPercent(ele) { + if (cachedWeightedPercent[ele.id()]) { + return cachedWeightedPercent[ele.id()]; + } + + var eleDepth = getInfo(ele).depth; + var neighbors = ele.neighborhood(); + var percent = 0; + var samples = 0; + + for (var _i5 = 0; _i5 < neighbors.length; _i5++) { + var neighbor = neighbors[_i5]; + + if (neighbor.isEdge() || neighbor.isParent() || !nodes.has(neighbor)) { + continue; + } + + var bf = getInfo(neighbor); + + if (bf == null) { + continue; + } + + var index = bf.index; + var depth = bf.depth; // unassigned neighbours shouldn't affect the ordering + + if (index == null || depth == null) { + continue; + } + + var nDepth = depths[depth].length; + + if (depth < eleDepth) { + // only get influenced by elements above + percent += index / nDepth; + samples++; + } + } + + samples = Math.max(1, samples); + percent = percent / samples; + + if (samples === 0) { + // put lone nodes at the start + percent = 0; + } + + cachedWeightedPercent[ele.id()] = percent; + return percent; + }; // rearrange the indices in each depth level based on connectivity + + + var sortFn = function sortFn(a, b) { + var apct = getWeightedPercent(a); + var bpct = getWeightedPercent(b); + var diff = apct - bpct; + + if (diff === 0) { + return ascending(a.id(), b.id()); // make sure sort doesn't have don't-care comparisons + } else { + return diff; + } + }; + + if (options.depthSort !== undefined) { + sortFn = options.depthSort; + } // sort each level to make connected nodes closer + + + for (var _i6 = 0; _i6 < depths.length; _i6++) { + depths[_i6].sort(sortFn); + + assignDepthsAt(_i6); + } // assign orphan nodes to a new top-level depth + + + var orphanDepth = []; + + for (var _i7 = 0; _i7 < orphanNodes.length; _i7++) { + orphanDepth.push(orphanNodes[_i7]); + } + + depths.unshift(orphanDepth); + assignDepths(); + var biggestDepthSize = 0; + + for (var _i8 = 0; _i8 < depths.length; _i8++) { + biggestDepthSize = Math.max(depths[_i8].length, biggestDepthSize); + } + + var center = { + x: bb.x1 + bb.w / 2, + y: bb.x1 + bb.h / 2 + }; + var maxDepthSize = depths.reduce(function (max, eles) { + return Math.max(max, eles.length); + }, 0); + + var getPosition = function getPosition(ele) { + var _getInfo2 = getInfo(ele), + depth = _getInfo2.depth, + index = _getInfo2.index; + + var depthSize = depths[depth].length; + var distanceX = Math.max(bb.w / ((options.grid ? maxDepthSize : depthSize) + 1), minDistance); + var distanceY = Math.max(bb.h / (depths.length + 1), minDistance); + var radiusStepSize = Math.min(bb.w / 2 / depths.length, bb.h / 2 / depths.length); + radiusStepSize = Math.max(radiusStepSize, minDistance); + + if (!options.circle) { + var epos = { + x: center.x + (index + 1 - (depthSize + 1) / 2) * distanceX, + y: (depth + 1) * distanceY + }; + return epos; + } else { + var radius = radiusStepSize * depth + radiusStepSize - (depths.length > 0 && depths[0].length <= 3 ? radiusStepSize / 2 : 0); + var theta = 2 * Math.PI / depths[depth].length * index; + + if (depth === 0 && depths[0].length === 1) { + radius = 1; + } + + return { + x: center.x + radius * Math.cos(theta), + y: center.y + radius * Math.sin(theta) + }; + } + }; + + eles.nodes().layoutPositions(this, options, getPosition); + return this; // chaining +}; + +var defaults$6 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox and radius if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: undefined, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + radius: undefined, + // the radius of the circle + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: undefined, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: true, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + sort: undefined, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + +}; + +function CircleLayout(options) { + this.options = extend({}, defaults$6, options); +} + +CircleLayout.prototype.run = function () { + var params = this.options; + var options = params; + var cy = params.cy; + var eles = options.eles; + var clockwise = options.counterclockwise !== undefined ? !options.counterclockwise : options.clockwise; + var nodes = eles.nodes().not(':parent'); + + if (options.sort) { + nodes = nodes.sort(options.sort); + } + + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var center = { + x: bb.x1 + bb.w / 2, + y: bb.y1 + bb.h / 2 + }; + var sweep = options.sweep === undefined ? 2 * Math.PI - 2 * Math.PI / nodes.length : options.sweep; + var dTheta = sweep / Math.max(1, nodes.length - 1); + var r; + var minDistance = 0; + + for (var i = 0; i < nodes.length; i++) { + var n = nodes[i]; + var nbb = n.layoutDimensions(options); + var w = nbb.w; + var h = nbb.h; + minDistance = Math.max(minDistance, w, h); + } + + if (number$1(options.radius)) { + r = options.radius; + } else if (nodes.length <= 1) { + r = 0; + } else { + r = Math.min(bb.h, bb.w) / 2 - minDistance; + } // calculate the radius + + + if (nodes.length > 1 && options.avoidOverlap) { + // but only if more than one node (can't overlap) + minDistance *= 1.75; // just to have some nice spacing + + var dcos = Math.cos(dTheta) - Math.cos(0); + var dsin = Math.sin(dTheta) - Math.sin(0); + var rMin = Math.sqrt(minDistance * minDistance / (dcos * dcos + dsin * dsin)); // s.t. no nodes overlapping + + r = Math.max(rMin, r); + } + + var getPos = function getPos(ele, i) { + var theta = options.startAngle + i * dTheta * (clockwise ? 1 : -1); + var rx = r * Math.cos(theta); + var ry = r * Math.sin(theta); + var pos = { + x: center.x + rx, + y: center.y + ry + }; + return pos; + }; + + eles.nodes().layoutPositions(this, options, getPos); + return this; // chaining +}; + +var defaults$5 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: undefined, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: true, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + equidistant: false, + // whether levels have an equal radial distance betwen them, may cause bounding box overflow + minNodeSpacing: 10, + // min spacing between outside of nodes (used for radius adjustment) + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + height: undefined, + // height of layout area (overrides container height) + width: undefined, + // width of layout area (overrides container width) + spacingFactor: undefined, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + concentric: function concentric(node) { + // returns numeric value for each node, placing higher nodes in levels towards the centre + return node.degree(); + }, + levelWidth: function levelWidth(nodes) { + // the variation of concentric values in each level + return nodes.maxDegree() / 4; + }, + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + +}; + +function ConcentricLayout(options) { + this.options = extend({}, defaults$5, options); +} + +ConcentricLayout.prototype.run = function () { + var params = this.options; + var options = params; + var clockwise = options.counterclockwise !== undefined ? !options.counterclockwise : options.clockwise; + var cy = params.cy; + var eles = options.eles; + var nodes = eles.nodes().not(':parent'); + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var center = { + x: bb.x1 + bb.w / 2, + y: bb.y1 + bb.h / 2 + }; + var nodeValues = []; // { node, value } + + var maxNodeSize = 0; + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var value = void 0; // calculate the node value + + value = options.concentric(node); + nodeValues.push({ + value: value, + node: node + }); // for style mapping + + node._private.scratch.concentric = value; + } // in case we used the `concentric` in style + + + nodes.updateStyle(); // calculate max size now based on potentially updated mappers + + for (var _i = 0; _i < nodes.length; _i++) { + var _node = nodes[_i]; + + var nbb = _node.layoutDimensions(options); + + maxNodeSize = Math.max(maxNodeSize, nbb.w, nbb.h); + } // sort node values in descreasing order + + + nodeValues.sort(function (a, b) { + return b.value - a.value; + }); + var levelWidth = options.levelWidth(nodes); // put the values into levels + + var levels = [[]]; + var currentLevel = levels[0]; + + for (var _i2 = 0; _i2 < nodeValues.length; _i2++) { + var val = nodeValues[_i2]; + + if (currentLevel.length > 0) { + var diff = Math.abs(currentLevel[0].value - val.value); + + if (diff >= levelWidth) { + currentLevel = []; + levels.push(currentLevel); + } + } + + currentLevel.push(val); + } // create positions from levels + + + var minDist = maxNodeSize + options.minNodeSpacing; // min dist between nodes + + if (!options.avoidOverlap) { + // then strictly constrain to bb + var firstLvlHasMulti = levels.length > 0 && levels[0].length > 1; + var maxR = Math.min(bb.w, bb.h) / 2 - minDist; + var rStep = maxR / (levels.length + firstLvlHasMulti ? 1 : 0); + minDist = Math.min(minDist, rStep); + } // find the metrics for each level + + + var r = 0; + + for (var _i3 = 0; _i3 < levels.length; _i3++) { + var level = levels[_i3]; + var sweep = options.sweep === undefined ? 2 * Math.PI - 2 * Math.PI / level.length : options.sweep; + var dTheta = level.dTheta = sweep / Math.max(1, level.length - 1); // calculate the radius + + if (level.length > 1 && options.avoidOverlap) { + // but only if more than one node (can't overlap) + var dcos = Math.cos(dTheta) - Math.cos(0); + var dsin = Math.sin(dTheta) - Math.sin(0); + var rMin = Math.sqrt(minDist * minDist / (dcos * dcos + dsin * dsin)); // s.t. no nodes overlapping + + r = Math.max(rMin, r); + } + + level.r = r; + r += minDist; + } + + if (options.equidistant) { + var rDeltaMax = 0; + var _r = 0; + + for (var _i4 = 0; _i4 < levels.length; _i4++) { + var _level = levels[_i4]; + var rDelta = _level.r - _r; + rDeltaMax = Math.max(rDeltaMax, rDelta); + } + + _r = 0; + + for (var _i5 = 0; _i5 < levels.length; _i5++) { + var _level2 = levels[_i5]; + + if (_i5 === 0) { + _r = _level2.r; + } + + _level2.r = _r; + _r += rDeltaMax; + } + } // calculate the node positions + + + var pos = {}; // id => position + + for (var _i6 = 0; _i6 < levels.length; _i6++) { + var _level3 = levels[_i6]; + var _dTheta = _level3.dTheta; + var _r2 = _level3.r; + + for (var j = 0; j < _level3.length; j++) { + var _val = _level3[j]; + var theta = options.startAngle + (clockwise ? 1 : -1) * _dTheta * j; + var p = { + x: center.x + _r2 * Math.cos(theta), + y: center.y + _r2 * Math.sin(theta) + }; + pos[_val.node.id()] = p; + } + } // position the nodes + + + eles.nodes().layoutPositions(this, options, function (ele) { + var id = ele.id(); + return pos[id]; + }); + return this; // chaining +}; + +/* +The CoSE layout was written by Gerardo Huck. +https://www.linkedin.com/in/gerardohuck/ + +Based on the following article: +http://dl.acm.org/citation.cfm?id=1498047 + +Modifications tracked on Github. +*/ +var DEBUG; +/** + * @brief : default layout options + */ + +var defaults$4 = { + // Called on `layoutready` + ready: function ready() {}, + // Called on `layoutstop` + stop: function stop() {}, + // Whether to animate while running the layout + // true : Animate continuously as the layout is running + // false : Just show the end result + // 'end' : Animate with the end result, from the initial positions to the end positions + animate: true, + // Easing of the animation for animate:'end' + animationEasing: undefined, + // The duration of the animation for animate:'end' + animationDuration: undefined, + // A function that determines whether the node should be animated + // All nodes animated by default on animate enabled + // Non-animated nodes are positioned immediately when the layout starts + animateFilter: function animateFilter(node, i) { + return true; + }, + // The layout animates only after this many milliseconds for animate:true + // (prevents flashing on fast runs) + animationThreshold: 250, + // Number of iterations between consecutive screen positions update + refresh: 20, + // Whether to fit the network view after when done + fit: true, + // Padding on fit + padding: 30, + // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + boundingBox: undefined, + // Excludes the label when calculating node bounding boxes for the layout algorithm + nodeDimensionsIncludeLabels: false, + // Randomize the initial positions of the nodes (true) or use existing positions (false) + randomize: false, + // Extra spacing between components in non-compound graphs + componentSpacing: 40, + // Node repulsion (non overlapping) multiplier + nodeRepulsion: function nodeRepulsion(node) { + return 2048; + }, + // Node repulsion (overlapping) multiplier + nodeOverlap: 4, + // Ideal edge (non nested) length + idealEdgeLength: function idealEdgeLength(edge) { + return 32; + }, + // Divisor to compute edge forces + edgeElasticity: function edgeElasticity(edge) { + return 32; + }, + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 1.2, + // Gravity force (constant) + gravity: 1, + // Maximum number of iterations to perform + numIter: 1000, + // Initial temperature (maximum node displacement) + initialTemp: 1000, + // Cooling factor (how the temperature is reduced between consecutive iterations + coolingFactor: 0.99, + // Lower temperature threshold (below this point the layout will end) + minTemp: 1.0 +}; +/** + * @brief : constructor + * @arg options : object containing layout options + */ + +function CoseLayout(options) { + this.options = extend({}, defaults$4, options); + this.options.layout = this; +} +/** + * @brief : runs the layout + */ + + +CoseLayout.prototype.run = function () { + var options = this.options; + var cy = options.cy; + var layout = this; + layout.stopped = false; + + if (options.animate === true || options.animate === false) { + layout.emit({ + type: 'layoutstart', + layout: layout + }); + } // Set DEBUG - Global variable + + + if (true === options.debug) { + DEBUG = true; + } else { + DEBUG = false; + } // Initialize layout info + + + var layoutInfo = createLayoutInfo(cy, layout, options); // Show LayoutInfo contents if debugging + + if (DEBUG) { + printLayoutInfo(layoutInfo); + } // If required, randomize node positions + + + if (options.randomize) { + randomizePositions(layoutInfo); + } + + var startTime = performanceNow(); + + var refresh = function refresh() { + refreshPositions(layoutInfo, cy, options); // Fit the graph if necessary + + if (true === options.fit) { + cy.fit(options.padding); + } + }; + + var mainLoop = function mainLoop(i) { + if (layout.stopped || i >= options.numIter) { + // logDebug("Layout manually stopped. Stopping computation in step " + i); + return false; + } // Do one step in the phisical simulation + + + step(layoutInfo, options); // Update temperature + + layoutInfo.temperature = layoutInfo.temperature * options.coolingFactor; // logDebug("New temperature: " + layoutInfo.temperature); + + if (layoutInfo.temperature < options.minTemp) { + // logDebug("Temperature drop below minimum threshold. Stopping computation in step " + i); + return false; + } + + return true; + }; + + var done = function done() { + if (options.animate === true || options.animate === false) { + refresh(); // Layout has finished + + layout.one('layoutstop', options.stop); + layout.emit({ + type: 'layoutstop', + layout: layout + }); + } else { + var nodes = options.eles.nodes(); + var getScaledPos = getScaleInBoundsFn(layoutInfo, options, nodes); + nodes.layoutPositions(layout, options, getScaledPos); + } + }; + + var i = 0; + var loopRet = true; + + if (options.animate === true) { + var frame = function frame() { + var f = 0; + + while (loopRet && f < options.refresh) { + loopRet = mainLoop(i); + i++; + f++; + } + + if (!loopRet) { + // it's done + separateComponents(layoutInfo, options); + done(); + } else { + var now = performanceNow(); + + if (now - startTime >= options.animationThreshold) { + refresh(); + } + + requestAnimationFrame(frame); + } + }; + + frame(); + } else { + while (loopRet) { + loopRet = mainLoop(i); + i++; + } + + separateComponents(layoutInfo, options); + done(); + } + + return this; // chaining +}; +/** + * @brief : called on continuous layouts to stop them before they finish + */ + + +CoseLayout.prototype.stop = function () { + this.stopped = true; + + if (this.thread) { + this.thread.stop(); + } + + this.emit('layoutstop'); + return this; // chaining +}; + +CoseLayout.prototype.destroy = function () { + if (this.thread) { + this.thread.stop(); + } + + return this; // chaining +}; +/** + * @brief : Creates an object which is contains all the data + * used in the layout process + * @arg cy : cytoscape.js object + * @return : layoutInfo object initialized + */ + + +var createLayoutInfo = function createLayoutInfo(cy, layout, options) { + // Shortcut + var edges = options.eles.edges(); + var nodes = options.eles.nodes(); + var layoutInfo = { + isCompound: cy.hasCompoundNodes(), + layoutNodes: [], + idToIndex: {}, + nodeSize: nodes.size(), + graphSet: [], + indexToGraph: [], + layoutEdges: [], + edgeSize: edges.size(), + temperature: options.initialTemp, + clientWidth: cy.width(), + clientHeight: cy.width(), + boundingBox: makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }) + }; + var components = options.eles.components(); + var id2cmptId = {}; + + for (var i = 0; i < components.length; i++) { + var component = components[i]; + + for (var j = 0; j < component.length; j++) { + var node = component[j]; + id2cmptId[node.id()] = i; + } + } // Iterate over all nodes, creating layout nodes + + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = nodes[i]; + var nbb = n.layoutDimensions(options); + var tempNode = {}; + tempNode.isLocked = n.locked(); + tempNode.id = n.data('id'); + tempNode.parentId = n.data('parent'); + tempNode.cmptId = id2cmptId[n.id()]; + tempNode.children = []; + tempNode.positionX = n.position('x'); + tempNode.positionY = n.position('y'); + tempNode.offsetX = 0; + tempNode.offsetY = 0; + tempNode.height = nbb.w; + tempNode.width = nbb.h; + tempNode.maxX = tempNode.positionX + tempNode.width / 2; + tempNode.minX = tempNode.positionX - tempNode.width / 2; + tempNode.maxY = tempNode.positionY + tempNode.height / 2; + tempNode.minY = tempNode.positionY - tempNode.height / 2; + tempNode.padLeft = parseFloat(n.style('padding')); + tempNode.padRight = parseFloat(n.style('padding')); + tempNode.padTop = parseFloat(n.style('padding')); + tempNode.padBottom = parseFloat(n.style('padding')); // forces + + tempNode.nodeRepulsion = fn$6(options.nodeRepulsion) ? options.nodeRepulsion(n) : options.nodeRepulsion; // Add new node + + layoutInfo.layoutNodes.push(tempNode); // Add entry to id-index map + + layoutInfo.idToIndex[tempNode.id] = i; + } // Inline implementation of a queue, used for traversing the graph in BFS order + + + var queue = []; + var start = 0; // Points to the start the queue + + var end = -1; // Points to the end of the queue + + var tempGraph = []; // Second pass to add child information and + // initialize queue for hierarchical traversal + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + var p_id = n.parentId; // Check if node n has a parent node + + if (null != p_id) { + // Add node Id to parent's list of children + layoutInfo.layoutNodes[layoutInfo.idToIndex[p_id]].children.push(n.id); + } else { + // If a node doesn't have a parent, then it's in the root graph + queue[++end] = n.id; + tempGraph.push(n.id); + } + } // Add root graph to graphSet + + + layoutInfo.graphSet.push(tempGraph); // Traverse the graph, level by level, + + while (start <= end) { + // Get the node to visit and remove it from queue + var node_id = queue[start++]; + var node_ix = layoutInfo.idToIndex[node_id]; + var node = layoutInfo.layoutNodes[node_ix]; + var children = node.children; + + if (children.length > 0) { + // Add children nodes as a new graph to graph set + layoutInfo.graphSet.push(children); // Add children to que queue to be visited + + for (var i = 0; i < children.length; i++) { + queue[++end] = children[i]; + } + } + } // Create indexToGraph map + + + for (var i = 0; i < layoutInfo.graphSet.length; i++) { + var graph = layoutInfo.graphSet[i]; + + for (var j = 0; j < graph.length; j++) { + var index = layoutInfo.idToIndex[graph[j]]; + layoutInfo.indexToGraph[index] = i; + } + } // Iterate over all edges, creating Layout Edges + + + for (var i = 0; i < layoutInfo.edgeSize; i++) { + var e = edges[i]; + var tempEdge = {}; + tempEdge.id = e.data('id'); + tempEdge.sourceId = e.data('source'); + tempEdge.targetId = e.data('target'); // Compute ideal length + + var idealLength = fn$6(options.idealEdgeLength) ? options.idealEdgeLength(e) : options.idealEdgeLength; + var elasticity = fn$6(options.edgeElasticity) ? options.edgeElasticity(e) : options.edgeElasticity; // Check if it's an inter graph edge + + var sourceIx = layoutInfo.idToIndex[tempEdge.sourceId]; + var targetIx = layoutInfo.idToIndex[tempEdge.targetId]; + var sourceGraph = layoutInfo.indexToGraph[sourceIx]; + var targetGraph = layoutInfo.indexToGraph[targetIx]; + + if (sourceGraph != targetGraph) { + // Find lowest common graph ancestor + var lca = findLCA(tempEdge.sourceId, tempEdge.targetId, layoutInfo); // Compute sum of node depths, relative to lca graph + + var lcaGraph = layoutInfo.graphSet[lca]; + var depth = 0; // Source depth + + var tempNode = layoutInfo.layoutNodes[sourceIx]; + + while (-1 === lcaGraph.indexOf(tempNode.id)) { + tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]]; + depth++; + } // Target depth + + + tempNode = layoutInfo.layoutNodes[targetIx]; + + while (-1 === lcaGraph.indexOf(tempNode.id)) { + tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]]; + depth++; + } // logDebug('LCA of nodes ' + tempEdge.sourceId + ' and ' + tempEdge.targetId + + // ". Index: " + lca + " Contents: " + lcaGraph.toString() + + // ". Depth: " + depth); + // Update idealLength + + + idealLength *= depth * options.nestingFactor; + } + + tempEdge.idealLength = idealLength; + tempEdge.elasticity = elasticity; + layoutInfo.layoutEdges.push(tempEdge); + } // Finally, return layoutInfo object + + + return layoutInfo; +}; +/** + * @brief : This function finds the index of the lowest common + * graph ancestor between 2 nodes in the subtree + * (from the graph hierarchy induced tree) whose + * root is graphIx + * + * @arg node1: node1's ID + * @arg node2: node2's ID + * @arg layoutInfo: layoutInfo object + * + */ + + +var findLCA = function findLCA(node1, node2, layoutInfo) { + // Find their common ancester, starting from the root graph + var res = findLCA_aux(node1, node2, 0, layoutInfo); + + if (2 > res.count) { + // If aux function couldn't find the common ancester, + // then it is the root graph + return 0; + } else { + return res.graph; + } +}; +/** + * @brief : Auxiliary function used for LCA computation + * + * @arg node1 : node1's ID + * @arg node2 : node2's ID + * @arg graphIx : subgraph index + * @arg layoutInfo : layoutInfo object + * + * @return : object of the form {count: X, graph: Y}, where: + * X is the number of ancesters (max: 2) found in + * graphIx (and it's subgraphs), + * Y is the graph index of the lowest graph containing + * all X nodes + */ + + +var findLCA_aux = function findLCA_aux(node1, node2, graphIx, layoutInfo) { + var graph = layoutInfo.graphSet[graphIx]; // If both nodes belongs to graphIx + + if (-1 < graph.indexOf(node1) && -1 < graph.indexOf(node2)) { + return { + count: 2, + graph: graphIx + }; + } // Make recursive calls for all subgraphs + + + var c = 0; + + for (var i = 0; i < graph.length; i++) { + var nodeId = graph[i]; + var nodeIx = layoutInfo.idToIndex[nodeId]; + var children = layoutInfo.layoutNodes[nodeIx].children; // If the node has no child, skip it + + if (0 === children.length) { + continue; + } + + var childGraphIx = layoutInfo.indexToGraph[layoutInfo.idToIndex[children[0]]]; + var result = findLCA_aux(node1, node2, childGraphIx, layoutInfo); + + if (0 === result.count) { + // Neither node1 nor node2 are present in this subgraph + continue; + } else if (1 === result.count) { + // One of (node1, node2) is present in this subgraph + c++; + + if (2 === c) { + // We've already found both nodes, no need to keep searching + break; + } + } else { + // Both nodes are present in this subgraph + return result; + } + } + + return { + count: c, + graph: graphIx + }; +}; +/** + * @brief: printsLayoutInfo into js console + * Only used for debbuging + */ + + +var printLayoutInfo; +/** + * @brief : Randomizes the position of all nodes + */ + + +var randomizePositions = function randomizePositions(layoutInfo, cy) { + var width = layoutInfo.clientWidth; + var height = layoutInfo.clientHeight; + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; // No need to randomize compound nodes or locked nodes + + if (0 === n.children.length && !n.isLocked) { + n.positionX = Math.random() * width; + n.positionY = Math.random() * height; + } + } +}; + +var getScaleInBoundsFn = function getScaleInBoundsFn(layoutInfo, options, nodes) { + var bb = layoutInfo.boundingBox; + var coseBB = { + x1: Infinity, + x2: -Infinity, + y1: Infinity, + y2: -Infinity + }; + + if (options.boundingBox) { + nodes.forEach(function (node) { + var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[node.data('id')]]; + coseBB.x1 = Math.min(coseBB.x1, lnode.positionX); + coseBB.x2 = Math.max(coseBB.x2, lnode.positionX); + coseBB.y1 = Math.min(coseBB.y1, lnode.positionY); + coseBB.y2 = Math.max(coseBB.y2, lnode.positionY); + }); + coseBB.w = coseBB.x2 - coseBB.x1; + coseBB.h = coseBB.y2 - coseBB.y1; + } + + return function (ele, i) { + var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[ele.data('id')]]; + + if (options.boundingBox) { + // then add extra bounding box constraint + var pctX = (lnode.positionX - coseBB.x1) / coseBB.w; + var pctY = (lnode.positionY - coseBB.y1) / coseBB.h; + return { + x: bb.x1 + pctX * bb.w, + y: bb.y1 + pctY * bb.h + }; + } else { + return { + x: lnode.positionX, + y: lnode.positionY + }; + } + }; +}; +/** + * @brief : Updates the positions of nodes in the network + * @arg layoutInfo : LayoutInfo object + * @arg cy : Cytoscape object + * @arg options : Layout options + */ + + +var refreshPositions = function refreshPositions(layoutInfo, cy, options) { + // var s = 'Refreshing positions'; + // logDebug(s); + var layout = options.layout; + var nodes = options.eles.nodes(); + var getScaledPos = getScaleInBoundsFn(layoutInfo, options, nodes); + nodes.positions(getScaledPos); // Trigger layoutReady only on first call + + if (true !== layoutInfo.ready) { + // s = 'Triggering layoutready'; + // logDebug(s); + layoutInfo.ready = true; + layout.one('layoutready', options.ready); + layout.emit({ + type: 'layoutready', + layout: this + }); + } +}; +/** + * @brief : Logs a debug message in JS console, if DEBUG is ON + */ +// var logDebug = function(text) { +// if (DEBUG) { +// console.debug(text); +// } +// }; + +/** + * @brief : Performs one iteration of the physical simulation + * @arg layoutInfo : LayoutInfo object already initialized + * @arg cy : Cytoscape object + * @arg options : Layout options + */ + + +var step = function step(layoutInfo, options, _step) { + // var s = "\n\n###############################"; + // s += "\nSTEP: " + step; + // s += "\n###############################\n"; + // logDebug(s); + // Calculate node repulsions + calculateNodeForces(layoutInfo, options); // Calculate edge forces + + calculateEdgeForces(layoutInfo); // Calculate gravity forces + + calculateGravityForces(layoutInfo, options); // Propagate forces from parent to child + + propagateForces(layoutInfo); // Update positions based on calculated forces + + updatePositions(layoutInfo); +}; +/** + * @brief : Computes the node repulsion forces + */ + + +var calculateNodeForces = function calculateNodeForces(layoutInfo, options) { + // Go through each of the graphs in graphSet + // Nodes only repel each other if they belong to the same graph + // var s = 'calculateNodeForces'; + // logDebug(s); + for (var i = 0; i < layoutInfo.graphSet.length; i++) { + var graph = layoutInfo.graphSet[i]; + var numNodes = graph.length; // s = "Set: " + graph.toString(); + // logDebug(s); + // Now get all the pairs of nodes + // Only get each pair once, (A, B) = (B, A) + + for (var j = 0; j < numNodes; j++) { + var node1 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j]]]; + + for (var k = j + 1; k < numNodes; k++) { + var node2 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[k]]]; + nodeRepulsion(node1, node2, layoutInfo, options); + } + } + } +}; + +var randomDistance = function randomDistance(max) { + return -max + 2 * max * Math.random(); +}; +/** + * @brief : Compute the node repulsion forces between a pair of nodes + */ + + +var nodeRepulsion = function nodeRepulsion(node1, node2, layoutInfo, options) { + // var s = "Node repulsion. Node1: " + node1.id + " Node2: " + node2.id; + var cmptId1 = node1.cmptId; + var cmptId2 = node2.cmptId; + + if (cmptId1 !== cmptId2 && !layoutInfo.isCompound) { + return; + } // Get direction of line connecting both node centers + + + var directionX = node2.positionX - node1.positionX; + var directionY = node2.positionY - node1.positionY; + var maxRandDist = 1; // s += "\ndirectionX: " + directionX + ", directionY: " + directionY; + // If both centers are the same, apply a random force + + if (0 === directionX && 0 === directionY) { + directionX = randomDistance(maxRandDist); + directionY = randomDistance(maxRandDist); + } + + var overlap = nodesOverlap(node1, node2, directionX, directionY); + + if (overlap > 0) { + // s += "\nNodes DO overlap."; + // s += "\nOverlap: " + overlap; + // If nodes overlap, repulsion force is proportional + // to the overlap + var force = options.nodeOverlap * overlap; // Compute the module and components of the force vector + + var distance = Math.sqrt(directionX * directionX + directionY * directionY); // s += "\nDistance: " + distance; + + var forceX = force * directionX / distance; + var forceY = force * directionY / distance; + } else { + // s += "\nNodes do NOT overlap."; + // If there's no overlap, force is inversely proportional + // to squared distance + // Get clipping points for both nodes + var point1 = findClippingPoint(node1, directionX, directionY); + var point2 = findClippingPoint(node2, -1 * directionX, -1 * directionY); // Use clipping points to compute distance + + var distanceX = point2.x - point1.x; + var distanceY = point2.y - point1.y; + var distanceSqr = distanceX * distanceX + distanceY * distanceY; + var distance = Math.sqrt(distanceSqr); // s += "\nDistance: " + distance; + // Compute the module and components of the force vector + + var force = (node1.nodeRepulsion + node2.nodeRepulsion) / distanceSqr; + var forceX = force * distanceX / distance; + var forceY = force * distanceY / distance; + } // Apply force + + + if (!node1.isLocked) { + node1.offsetX -= forceX; + node1.offsetY -= forceY; + } + + if (!node2.isLocked) { + node2.offsetX += forceX; + node2.offsetY += forceY; + } // s += "\nForceX: " + forceX + " ForceY: " + forceY; + // logDebug(s); + + + return; +}; +/** + * @brief : Determines whether two nodes overlap or not + * @return : Amount of overlapping (0 => no overlap) + */ + + +var nodesOverlap = function nodesOverlap(node1, node2, dX, dY) { + if (dX > 0) { + var overlapX = node1.maxX - node2.minX; + } else { + var overlapX = node2.maxX - node1.minX; + } + + if (dY > 0) { + var overlapY = node1.maxY - node2.minY; + } else { + var overlapY = node2.maxY - node1.minY; + } + + if (overlapX >= 0 && overlapY >= 0) { + return Math.sqrt(overlapX * overlapX + overlapY * overlapY); + } else { + return 0; + } +}; +/** + * @brief : Finds the point in which an edge (direction dX, dY) intersects + * the rectangular bounding box of it's source/target node + */ + + +var findClippingPoint = function findClippingPoint(node, dX, dY) { + // Shorcuts + var X = node.positionX; + var Y = node.positionY; + var H = node.height || 1; + var W = node.width || 1; + var dirSlope = dY / dX; + var nodeSlope = H / W; // var s = 'Computing clipping point of node ' + node.id + + // " . Height: " + H + ", Width: " + W + + // "\nDirection " + dX + ", " + dY; + // + // Compute intersection + + var res = {}; // Case: Vertical direction (up) + + if (0 === dX && 0 < dY) { + res.x = X; // s += "\nUp direction"; + + res.y = Y + H / 2; + return res; + } // Case: Vertical direction (down) + + + if (0 === dX && 0 > dY) { + res.x = X; + res.y = Y + H / 2; // s += "\nDown direction"; + + return res; + } // Case: Intersects the right border + + + if (0 < dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) { + res.x = X + W / 2; + res.y = Y + W * dY / 2 / dX; // s += "\nRightborder"; + + return res; + } // Case: Intersects the left border + + + if (0 > dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) { + res.x = X - W / 2; + res.y = Y - W * dY / 2 / dX; // s += "\nLeftborder"; + + return res; + } // Case: Intersects the top border + + + if (0 < dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) { + res.x = X + H * dX / 2 / dY; + res.y = Y + H / 2; // s += "\nTop border"; + + return res; + } // Case: Intersects the bottom border + + + if (0 > dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) { + res.x = X - H * dX / 2 / dY; + res.y = Y - H / 2; // s += "\nBottom border"; + + return res; + } // s += "\nClipping point found at " + res.x + ", " + res.y; + // logDebug(s); + + + return res; +}; +/** + * @brief : Calculates all edge forces + */ + + +var calculateEdgeForces = function calculateEdgeForces(layoutInfo, options) { + // Iterate over all edges + for (var i = 0; i < layoutInfo.edgeSize; i++) { + // Get edge, source & target nodes + var edge = layoutInfo.layoutEdges[i]; + var sourceIx = layoutInfo.idToIndex[edge.sourceId]; + var source = layoutInfo.layoutNodes[sourceIx]; + var targetIx = layoutInfo.idToIndex[edge.targetId]; + var target = layoutInfo.layoutNodes[targetIx]; // Get direction of line connecting both node centers + + var directionX = target.positionX - source.positionX; + var directionY = target.positionY - source.positionY; // If both centers are the same, do nothing. + // A random force has already been applied as node repulsion + + if (0 === directionX && 0 === directionY) { + continue; + } // Get clipping points for both nodes + + + var point1 = findClippingPoint(source, directionX, directionY); + var point2 = findClippingPoint(target, -1 * directionX, -1 * directionY); + var lx = point2.x - point1.x; + var ly = point2.y - point1.y; + var l = Math.sqrt(lx * lx + ly * ly); + var force = Math.pow(edge.idealLength - l, 2) / edge.elasticity; + + if (0 !== l) { + var forceX = force * lx / l; + var forceY = force * ly / l; + } else { + var forceX = 0; + var forceY = 0; + } // Add this force to target and source nodes + + + if (!source.isLocked) { + source.offsetX += forceX; + source.offsetY += forceY; + } + + if (!target.isLocked) { + target.offsetX -= forceX; + target.offsetY -= forceY; + } // var s = 'Edge force between nodes ' + source.id + ' and ' + target.id; + // s += "\nDistance: " + l + " Force: (" + forceX + ", " + forceY + ")"; + // logDebug(s); + + } +}; +/** + * @brief : Computes gravity forces for all nodes + */ + + +var calculateGravityForces = function calculateGravityForces(layoutInfo, options) { + if (options.gravity === 0) { + return; + } + + var distThreshold = 1; // var s = 'calculateGravityForces'; + // logDebug(s); + + for (var i = 0; i < layoutInfo.graphSet.length; i++) { + var graph = layoutInfo.graphSet[i]; + var numNodes = graph.length; // s = "Set: " + graph.toString(); + // logDebug(s); + // Compute graph center + + if (0 === i) { + var centerX = layoutInfo.clientHeight / 2; + var centerY = layoutInfo.clientWidth / 2; + } else { + // Get Parent node for this graph, and use its position as center + var temp = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[0]]]; + var parent = layoutInfo.layoutNodes[layoutInfo.idToIndex[temp.parentId]]; + var centerX = parent.positionX; + var centerY = parent.positionY; + } // s = "Center found at: " + centerX + ", " + centerY; + // logDebug(s); + // Apply force to all nodes in graph + + + for (var j = 0; j < numNodes; j++) { + var node = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j]]]; // s = "Node: " + node.id; + + if (node.isLocked) { + continue; + } + + var dx = centerX - node.positionX; + var dy = centerY - node.positionY; + var d = Math.sqrt(dx * dx + dy * dy); + + if (d > distThreshold) { + var fx = options.gravity * dx / d; + var fy = options.gravity * dy / d; + node.offsetX += fx; + node.offsetY += fy; // s += ": Applied force: " + fx + ", " + fy; + } // logDebug(s); + + } + } +}; +/** + * @brief : This function propagates the existing offsets from + * parent nodes to its descendents. + * @arg layoutInfo : layoutInfo Object + * @arg cy : cytoscape Object + * @arg options : Layout options + */ + + +var propagateForces = function propagateForces(layoutInfo, options) { + // Inline implementation of a queue, used for traversing the graph in BFS order + var queue = []; + var start = 0; // Points to the start the queue + + var end = -1; // Points to the end of the queue + // logDebug('propagateForces'); + // Start by visiting the nodes in the root graph + + queue.push.apply(queue, layoutInfo.graphSet[0]); + end += layoutInfo.graphSet[0].length; // Traverse the graph, level by level, + + while (start <= end) { + // Get the node to visit and remove it from queue + var nodeId = queue[start++]; + var nodeIndex = layoutInfo.idToIndex[nodeId]; + var node = layoutInfo.layoutNodes[nodeIndex]; + var children = node.children; // We only need to process the node if it's compound + + if (0 < children.length && !node.isLocked) { + var offX = node.offsetX; + var offY = node.offsetY; // var s = "Propagating offset from parent node : " + node.id + + // ". OffsetX: " + offX + ". OffsetY: " + offY; + // s += "\n Children: " + children.toString(); + // logDebug(s); + + for (var i = 0; i < children.length; i++) { + var childNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[children[i]]]; // Propagate offset + + childNode.offsetX += offX; + childNode.offsetY += offY; // Add children to queue to be visited + + queue[++end] = children[i]; + } // Reset parent offsets + + + node.offsetX = 0; + node.offsetY = 0; + } + } +}; +/** + * @brief : Updates the layout model positions, based on + * the accumulated forces + */ + + +var updatePositions = function updatePositions(layoutInfo, options) { + // var s = 'Updating positions'; + // logDebug(s); + // Reset boundaries for compound nodes + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + + if (0 < n.children.length) { + // logDebug("Resetting boundaries of compound node: " + n.id); + n.maxX = undefined; + n.minX = undefined; + n.maxY = undefined; + n.minY = undefined; + } + } + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + + if (0 < n.children.length || n.isLocked) { + // No need to set compound or locked node position + // logDebug("Skipping position update of node: " + n.id); + continue; + } // s = "Node: " + n.id + " Previous position: (" + + // n.positionX + ", " + n.positionY + ")."; + // Limit displacement in order to improve stability + + + var tempForce = limitForce(n.offsetX, n.offsetY, layoutInfo.temperature); + n.positionX += tempForce.x; + n.positionY += tempForce.y; + n.offsetX = 0; + n.offsetY = 0; + n.minX = n.positionX - n.width; + n.maxX = n.positionX + n.width; + n.minY = n.positionY - n.height; + n.maxY = n.positionY + n.height; // s += " New Position: (" + n.positionX + ", " + n.positionY + ")."; + // logDebug(s); + // Update ancestry boudaries + + updateAncestryBoundaries(n, layoutInfo); + } // Update size, position of compund nodes + + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + + if (0 < n.children.length && !n.isLocked) { + n.positionX = (n.maxX + n.minX) / 2; + n.positionY = (n.maxY + n.minY) / 2; + n.width = n.maxX - n.minX; + n.height = n.maxY - n.minY; // s = "Updating position, size of compound node " + n.id; + // s += "\nPositionX: " + n.positionX + ", PositionY: " + n.positionY; + // s += "\nWidth: " + n.width + ", Height: " + n.height; + // logDebug(s); + } + } +}; +/** + * @brief : Limits a force (forceX, forceY) to be not + * greater (in modulo) than max. + 8 Preserves force direction. + */ + + +var limitForce = function limitForce(forceX, forceY, max) { + // var s = "Limiting force: (" + forceX + ", " + forceY + "). Max: " + max; + var force = Math.sqrt(forceX * forceX + forceY * forceY); + + if (force > max) { + var res = { + x: max * forceX / force, + y: max * forceY / force + }; + } else { + var res = { + x: forceX, + y: forceY + }; + } // s += ".\nResult: (" + res.x + ", " + res.y + ")"; + // logDebug(s); + + + return res; +}; +/** + * @brief : Function used for keeping track of compound node + * sizes, since they should bound all their subnodes. + */ + + +var updateAncestryBoundaries = function updateAncestryBoundaries(node, layoutInfo) { + // var s = "Propagating new position/size of node " + node.id; + var parentId = node.parentId; + + if (null == parentId) { + // If there's no parent, we are done + // s += ". No parent node."; + // logDebug(s); + return; + } // Get Parent Node + + + var p = layoutInfo.layoutNodes[layoutInfo.idToIndex[parentId]]; + var flag = false; // MaxX + + if (null == p.maxX || node.maxX + p.padRight > p.maxX) { + p.maxX = node.maxX + p.padRight; + flag = true; // s += "\nNew maxX for parent node " + p.id + ": " + p.maxX; + } // MinX + + + if (null == p.minX || node.minX - p.padLeft < p.minX) { + p.minX = node.minX - p.padLeft; + flag = true; // s += "\nNew minX for parent node " + p.id + ": " + p.minX; + } // MaxY + + + if (null == p.maxY || node.maxY + p.padBottom > p.maxY) { + p.maxY = node.maxY + p.padBottom; + flag = true; // s += "\nNew maxY for parent node " + p.id + ": " + p.maxY; + } // MinY + + + if (null == p.minY || node.minY - p.padTop < p.minY) { + p.minY = node.minY - p.padTop; + flag = true; // s += "\nNew minY for parent node " + p.id + ": " + p.minY; + } // If updated boundaries, propagate changes upward + + + if (flag) { + // logDebug(s); + return updateAncestryBoundaries(p, layoutInfo); + } // s += ". No changes in boundaries/position of parent node " + p.id; + // logDebug(s); + + + return; +}; + +var separateComponents = function separateComponents(layoutInfo, options) { + var nodes = layoutInfo.layoutNodes; + var components = []; + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var cid = node.cmptId; + var component = components[cid] = components[cid] || []; + component.push(node); + } + + var totalA = 0; + + for (var i = 0; i < components.length; i++) { + var c = components[i]; + + if (!c) { + continue; + } + + c.x1 = Infinity; + c.x2 = -Infinity; + c.y1 = Infinity; + c.y2 = -Infinity; + + for (var j = 0; j < c.length; j++) { + var n = c[j]; + c.x1 = Math.min(c.x1, n.positionX - n.width / 2); + c.x2 = Math.max(c.x2, n.positionX + n.width / 2); + c.y1 = Math.min(c.y1, n.positionY - n.height / 2); + c.y2 = Math.max(c.y2, n.positionY + n.height / 2); + } + + c.w = c.x2 - c.x1; + c.h = c.y2 - c.y1; + totalA += c.w * c.h; + } + + components.sort(function (c1, c2) { + return c2.w * c2.h - c1.w * c1.h; + }); + var x = 0; + var y = 0; + var usedW = 0; + var rowH = 0; + var maxRowW = Math.sqrt(totalA) * layoutInfo.clientWidth / layoutInfo.clientHeight; + + for (var i = 0; i < components.length; i++) { + var c = components[i]; + + if (!c) { + continue; + } + + for (var j = 0; j < c.length; j++) { + var n = c[j]; + + if (!n.isLocked) { + n.positionX += x - c.x1; + n.positionY += y - c.y1; + } + } + + x += c.w + options.componentSpacing; + usedW += c.w + options.componentSpacing; + rowH = Math.max(rowH, c.h); + + if (usedW > maxRowW) { + y += rowH + options.componentSpacing; + x = 0; + usedW = 0; + rowH = 0; + } + } +}; + +var defaults$3 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // padding used on fit + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + avoidOverlapPadding: 10, + // extra spacing around nodes when avoidOverlap: true + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: undefined, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + condense: false, + // uses all available space on false, uses minimal space on true + rows: undefined, + // force num of rows in the grid + cols: undefined, + // force num of columns in the grid + position: function position(node) {}, + // returns { row, col } for element + sort: undefined, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + +}; + +function GridLayout(options) { + this.options = extend({}, defaults$3, options); +} + +GridLayout.prototype.run = function () { + var params = this.options; + var options = params; + var cy = params.cy; + var eles = options.eles; + var nodes = eles.nodes().not(':parent'); + + if (options.sort) { + nodes = nodes.sort(options.sort); + } + + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + + if (bb.h === 0 || bb.w === 0) { + eles.nodes().layoutPositions(this, options, function (ele) { + return { + x: bb.x1, + y: bb.y1 + }; + }); + } else { + // width/height * splits^2 = cells where splits is number of times to split width + var cells = nodes.size(); + var splits = Math.sqrt(cells * bb.h / bb.w); + var rows = Math.round(splits); + var cols = Math.round(bb.w / bb.h * splits); + + var small = function small(val) { + if (val == null) { + return Math.min(rows, cols); + } else { + var min = Math.min(rows, cols); + + if (min == rows) { + rows = val; + } else { + cols = val; + } + } + }; + + var large = function large(val) { + if (val == null) { + return Math.max(rows, cols); + } else { + var max = Math.max(rows, cols); + + if (max == rows) { + rows = val; + } else { + cols = val; + } + } + }; + + var oRows = options.rows; + var oCols = options.cols != null ? options.cols : options.columns; // if rows or columns were set in options, use those values + + if (oRows != null && oCols != null) { + rows = oRows; + cols = oCols; + } else if (oRows != null && oCols == null) { + rows = oRows; + cols = Math.ceil(cells / rows); + } else if (oRows == null && oCols != null) { + cols = oCols; + rows = Math.ceil(cells / cols); + } // otherwise use the automatic values and adjust accordingly + // if rounding was up, see if we can reduce rows or columns + else if (cols * rows > cells) { + var sm = small(); + var lg = large(); // reducing the small side takes away the most cells, so try it first + + if ((sm - 1) * lg >= cells) { + small(sm - 1); + } else if ((lg - 1) * sm >= cells) { + large(lg - 1); + } + } else { + // if rounding was too low, add rows or columns + while (cols * rows < cells) { + var _sm = small(); + + var _lg = large(); // try to add to larger side first (adds less in multiplication) + + + if ((_lg + 1) * _sm >= cells) { + large(_lg + 1); + } else { + small(_sm + 1); + } + } + } + + var cellWidth = bb.w / cols; + var cellHeight = bb.h / rows; + + if (options.condense) { + cellWidth = 0; + cellHeight = 0; + } + + if (options.avoidOverlap) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var pos = node._private.position; + + if (pos.x == null || pos.y == null) { + // for bb + pos.x = 0; + pos.y = 0; + } + + var nbb = node.layoutDimensions(options); + var p = options.avoidOverlapPadding; + var w = nbb.w + p; + var h = nbb.h + p; + cellWidth = Math.max(cellWidth, w); + cellHeight = Math.max(cellHeight, h); + } + } + + var cellUsed = {}; // e.g. 'c-0-2' => true + + var used = function used(row, col) { + return cellUsed['c-' + row + '-' + col] ? true : false; + }; + + var use = function use(row, col) { + cellUsed['c-' + row + '-' + col] = true; + }; // to keep track of current cell position + + + var row = 0; + var col = 0; + + var moveToNextCell = function moveToNextCell() { + col++; + + if (col >= cols) { + col = 0; + row++; + } + }; // get a cache of all the manual positions + + + var id2manPos = {}; + + for (var _i = 0; _i < nodes.length; _i++) { + var _node = nodes[_i]; + var rcPos = options.position(_node); + + if (rcPos && (rcPos.row !== undefined || rcPos.col !== undefined)) { + // must have at least row or col def'd + var _pos = { + row: rcPos.row, + col: rcPos.col + }; + + if (_pos.col === undefined) { + // find unused col + _pos.col = 0; + + while (used(_pos.row, _pos.col)) { + _pos.col++; + } + } else if (_pos.row === undefined) { + // find unused row + _pos.row = 0; + + while (used(_pos.row, _pos.col)) { + _pos.row++; + } + } + + id2manPos[_node.id()] = _pos; + use(_pos.row, _pos.col); + } + } + + var getPos = function getPos(element, i) { + var x, y; + + if (element.locked() || element.isParent()) { + return false; + } // see if we have a manual position set + + + var rcPos = id2manPos[element.id()]; + + if (rcPos) { + x = rcPos.col * cellWidth + cellWidth / 2 + bb.x1; + y = rcPos.row * cellHeight + cellHeight / 2 + bb.y1; + } else { + // otherwise set automatically + while (used(row, col)) { + moveToNextCell(); + } + + x = col * cellWidth + cellWidth / 2 + bb.x1; + y = row * cellHeight + cellHeight / 2 + bb.y1; + use(row, col); + moveToNextCell(); + } + + return { + x: x, + y: y + }; + }; + + nodes.layoutPositions(this, options, getPos); + } + + return this; // chaining +}; + +var defaults$2 = { + ready: function ready() {}, + // on layoutready + stop: function stop() {} // on layoutstop + +}; // constructor +// options : object containing layout options + +function NullLayout(options) { + this.options = extend({}, defaults$2, options); +} // runs the layout + + +NullLayout.prototype.run = function () { + var options = this.options; + var eles = options.eles; // elements to consider in the layout + + var layout = this; // cy is automatically populated for us in the constructor + // (disable eslint for next line as this serves as example layout code to external developers) + // eslint-disable-next-line no-unused-vars + + options.cy; + layout.emit('layoutstart'); // puts all nodes at (0, 0) + // n.b. most layouts would use layoutPositions(), instead of positions() and manual events + + eles.nodes().positions(function () { + return { + x: 0, + y: 0 + }; + }); // trigger layoutready when each node has had its position set at least once + + layout.one('layoutready', options.ready); + layout.emit('layoutready'); // trigger layoutstop when the layout stops (e.g. finishes) + + layout.one('layoutstop', options.stop); + layout.emit('layoutstop'); + return this; // chaining +}; // called on continuous layouts to stop them before they finish + + +NullLayout.prototype.stop = function () { + return this; // chaining +}; + +var defaults$1 = { + positions: undefined, + // map of (node id) => (position obj); or function(node){ return somPos; } + zoom: undefined, + // the zoom level to set (prob want fit = false if set) + pan: undefined, + // the pan level to set (prob want fit = false if set) + fit: true, + // whether to fit to viewport + padding: 30, + // padding on fit + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + +}; + +function PresetLayout(options) { + this.options = extend({}, defaults$1, options); +} + +PresetLayout.prototype.run = function () { + var options = this.options; + var eles = options.eles; + var nodes = eles.nodes(); + var posIsFn = fn$6(options.positions); + + function getPosition(node) { + if (options.positions == null) { + return copyPosition(node.position()); + } + + if (posIsFn) { + return options.positions(node); + } + + var pos = options.positions[node._private.data.id]; + + if (pos == null) { + return null; + } + + return pos; + } + + nodes.layoutPositions(this, options, function (node, i) { + var position = getPosition(node); + + if (node.locked() || position == null) { + return false; + } + + return position; + }); + return this; // chaining +}; + +var defaults = { + fit: true, + // whether to fit to viewport + padding: 30, + // fit padding + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + +}; + +function RandomLayout(options) { + this.options = extend({}, defaults, options); +} + +RandomLayout.prototype.run = function () { + var options = this.options; + var cy = options.cy; + var eles = options.eles; + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + + var getPos = function getPos(node, i) { + return { + x: bb.x1 + Math.round(Math.random() * bb.w), + y: bb.y1 + Math.round(Math.random() * bb.h) + }; + }; + + eles.nodes().layoutPositions(this, options, getPos); + return this; // chaining +}; + +var layout = [{ + name: 'breadthfirst', + impl: BreadthFirstLayout +}, { + name: 'circle', + impl: CircleLayout +}, { + name: 'concentric', + impl: ConcentricLayout +}, { + name: 'cose', + impl: CoseLayout +}, { + name: 'grid', + impl: GridLayout +}, { + name: 'null', + impl: NullLayout +}, { + name: 'preset', + impl: PresetLayout +}, { + name: 'random', + impl: RandomLayout +}]; + +function NullRenderer(options) { + this.options = options; + this.notifications = 0; // for testing +} + +var noop = function noop() {}; + +var throwImgErr = function throwImgErr() { + throw new Error('A headless instance can not render images'); +}; + +NullRenderer.prototype = { + recalculateRenderedStyle: noop, + notify: function notify() { + this.notifications++; + }, + init: noop, + isHeadless: function isHeadless() { + return true; + }, + png: throwImgErr, + jpg: throwImgErr +}; + +var BRp$f = {}; +BRp$f.arrowShapeWidth = 0.3; + +BRp$f.registerArrowShapes = function () { + var arrowShapes = this.arrowShapes = {}; + var renderer = this; // Contract for arrow shapes: + // 0, 0 is arrow tip + // (0, 1) is direction towards node + // (1, 0) is right + // + // functional api: + // collide: check x, y in shape + // roughCollide: called before collide, no false negatives + // draw: draw + // spacing: dist(arrowTip, nodeBoundary) + // gap: dist(edgeTip, nodeBoundary), edgeTip may != arrowTip + + var bbCollide = function bbCollide(x, y, size, angle, translation, edgeWidth, padding) { + var x1 = translation.x - size / 2 - padding; + var x2 = translation.x + size / 2 + padding; + var y1 = translation.y - size / 2 - padding; + var y2 = translation.y + size / 2 + padding; + var inside = x1 <= x && x <= x2 && y1 <= y && y <= y2; + return inside; + }; + + var transform = function transform(x, y, size, angle, translation) { + var xRotated = x * Math.cos(angle) - y * Math.sin(angle); + var yRotated = x * Math.sin(angle) + y * Math.cos(angle); + var xScaled = xRotated * size; + var yScaled = yRotated * size; + var xTranslated = xScaled + translation.x; + var yTranslated = yScaled + translation.y; + return { + x: xTranslated, + y: yTranslated + }; + }; + + var transformPoints = function transformPoints(pts, size, angle, translation) { + var retPts = []; + + for (var i = 0; i < pts.length; i += 2) { + var x = pts[i]; + var y = pts[i + 1]; + retPts.push(transform(x, y, size, angle, translation)); + } + + return retPts; + }; + + var pointsToArr = function pointsToArr(pts) { + var ret = []; + + for (var i = 0; i < pts.length; i++) { + var p = pts[i]; + ret.push(p.x, p.y); + } + + return ret; + }; + + var standardGap = function standardGap(edge) { + return edge.pstyle('width').pfValue * edge.pstyle('arrow-scale').pfValue * 2; + }; + + var defineArrowShape = function defineArrowShape(name, defn) { + if (string(defn)) { + defn = arrowShapes[defn]; + } + + arrowShapes[name] = extend({ + name: name, + points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3], + collide: function collide(x, y, size, angle, translation, padding) { + var points = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + var inside = pointInsidePolygonPoints(x, y, points); + return inside; + }, + roughCollide: bbCollide, + draw: function draw(context, size, angle, translation) { + var points = transformPoints(this.points, size, angle, translation); + renderer.arrowShapeImpl('polygon')(context, points); + }, + spacing: function spacing(edge) { + return 0; + }, + gap: standardGap + }, defn); + }; + + defineArrowShape('none', { + collide: falsify, + roughCollide: falsify, + draw: noop$1, + spacing: zeroify, + gap: zeroify + }); + defineArrowShape('triangle', { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3] + }); + defineArrowShape('arrow', 'triangle'); + defineArrowShape('triangle-backcurve', { + points: arrowShapes['triangle'].points, + controlPoint: [0, -0.15], + roughCollide: bbCollide, + draw: function draw(context, size, angle, translation, edgeWidth) { + var ptsTrans = transformPoints(this.points, size, angle, translation); + var ctrlPt = this.controlPoint; + var ctrlPtTrans = transform(ctrlPt[0], ctrlPt[1], size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, ptsTrans, ctrlPtTrans); + }, + gap: function gap(edge) { + return standardGap(edge) * 0.8; + } + }); + defineArrowShape('triangle-tee', { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4], + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var triPts = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + var teePts = pointsToArr(transformPoints(this.pointsTee, size + 2 * padding, angle, translation)); + var inside = pointInsidePolygonPoints(x, y, triPts) || pointInsidePolygonPoints(x, y, teePts); + return inside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + var triPts = transformPoints(this.points, size, angle, translation); + var teePts = transformPoints(this.pointsTee, size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, triPts, teePts); + } + }); + defineArrowShape('circle-triangle', { + radius: 0.15, + pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15], + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var t = translation; + var circleInside = Math.pow(t.x - x, 2) + Math.pow(t.y - y, 2) <= Math.pow((size + 2 * padding) * this.radius, 2); + var triPts = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + return pointInsidePolygonPoints(x, y, triPts) || circleInside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + var triPts = transformPoints(this.pointsTr, size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, triPts, translation.x, translation.y, this.radius * size); + }, + spacing: function spacing(edge) { + return renderer.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.radius; + } + }); + defineArrowShape('triangle-cross', { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + baseCrossLinePts: [-0.15, -0.4, // first half of the rectangle + -0.15, -0.4, 0.15, -0.4, // second half of the rectangle + 0.15, -0.4], + crossLinePts: function crossLinePts(size, edgeWidth) { + // shift points so that the distance between the cross points matches edge width + var p = this.baseCrossLinePts.slice(); + var shiftFactor = edgeWidth / size; + var y0 = 3; + var y1 = 5; + p[y0] = p[y0] - shiftFactor; + p[y1] = p[y1] - shiftFactor; + return p; + }, + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var triPts = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + var teePts = pointsToArr(transformPoints(this.crossLinePts(size, edgeWidth), size + 2 * padding, angle, translation)); + var inside = pointInsidePolygonPoints(x, y, triPts) || pointInsidePolygonPoints(x, y, teePts); + return inside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + var triPts = transformPoints(this.points, size, angle, translation); + var crossLinePts = transformPoints(this.crossLinePts(size, edgeWidth), size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, triPts, crossLinePts); + } + }); + defineArrowShape('vee', { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15], + gap: function gap(edge) { + return standardGap(edge) * 0.525; + } + }); + defineArrowShape('circle', { + radius: 0.15, + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var t = translation; + var inside = Math.pow(t.x - x, 2) + Math.pow(t.y - y, 2) <= Math.pow((size + 2 * padding) * this.radius, 2); + return inside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + renderer.arrowShapeImpl(this.name)(context, translation.x, translation.y, this.radius * size); + }, + spacing: function spacing(edge) { + return renderer.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.radius; + } + }); + defineArrowShape('tee', { + points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0], + spacing: function spacing(edge) { + return 1; + }, + gap: function gap(edge) { + return 1; + } + }); + defineArrowShape('square', { + points: [-0.15, 0.00, 0.15, 0.00, 0.15, -0.3, -0.15, -0.3] + }); + defineArrowShape('diamond', { + points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0], + gap: function gap(edge) { + return edge.pstyle('width').pfValue * edge.pstyle('arrow-scale').value; + } + }); + defineArrowShape('chevron', { + points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15], + gap: function gap(edge) { + return 0.95 * edge.pstyle('width').pfValue * edge.pstyle('arrow-scale').value; + } + }); +}; + +var BRp$e = {}; // Project mouse + +BRp$e.projectIntoViewport = function (clientX, clientY) { + var cy = this.cy; + var offsets = this.findContainerClientCoords(); + var offsetLeft = offsets[0]; + var offsetTop = offsets[1]; + var scale = offsets[4]; + var pan = cy.pan(); + var zoom = cy.zoom(); + var x = ((clientX - offsetLeft) / scale - pan.x) / zoom; + var y = ((clientY - offsetTop) / scale - pan.y) / zoom; + return [x, y]; +}; + +BRp$e.findContainerClientCoords = function () { + if (this.containerBB) { + return this.containerBB; + } + + var container = this.container; + var rect = container.getBoundingClientRect(); + var style = window$1.getComputedStyle(container); + + var styleValue = function styleValue(name) { + return parseFloat(style.getPropertyValue(name)); + }; + + var padding = { + left: styleValue('padding-left'), + right: styleValue('padding-right'), + top: styleValue('padding-top'), + bottom: styleValue('padding-bottom') + }; + var border = { + left: styleValue('border-left-width'), + right: styleValue('border-right-width'), + top: styleValue('border-top-width'), + bottom: styleValue('border-bottom-width') + }; + var clientWidth = container.clientWidth; + var clientHeight = container.clientHeight; + var paddingHor = padding.left + padding.right; + var paddingVer = padding.top + padding.bottom; + var borderHor = border.left + border.right; + var scale = rect.width / (clientWidth + borderHor); + var unscaledW = clientWidth - paddingHor; + var unscaledH = clientHeight - paddingVer; + var left = rect.left + padding.left + border.left; + var top = rect.top + padding.top + border.top; + return this.containerBB = [left, top, unscaledW, unscaledH, scale]; +}; + +BRp$e.invalidateContainerClientCoordsCache = function () { + this.containerBB = null; +}; + +BRp$e.findNearestElement = function (x, y, interactiveElementsOnly, isTouch) { + return this.findNearestElements(x, y, interactiveElementsOnly, isTouch)[0]; +}; + +BRp$e.findNearestElements = function (x, y, interactiveElementsOnly, isTouch) { + var self = this; + var r = this; + var eles = r.getCachedZSortedEles(); + var near = []; // 1 node max, 1 edge max + + var zoom = r.cy.zoom(); + var hasCompounds = r.cy.hasCompoundNodes(); + var edgeThreshold = (isTouch ? 24 : 8) / zoom; + var nodeThreshold = (isTouch ? 8 : 2) / zoom; + var labelThreshold = (isTouch ? 8 : 2) / zoom; + var minSqDist = Infinity; + var nearEdge; + var nearNode; + + if (interactiveElementsOnly) { + eles = eles.interactive; + } + + function addEle(ele, sqDist) { + if (ele.isNode()) { + if (nearNode) { + return; // can't replace node + } else { + nearNode = ele; + near.push(ele); + } + } + + if (ele.isEdge() && (sqDist == null || sqDist < minSqDist)) { + if (nearEdge) { + // then replace existing edge + // can replace only if same z-index + if (nearEdge.pstyle('z-compound-depth').value === ele.pstyle('z-compound-depth').value && nearEdge.pstyle('z-compound-depth').value === ele.pstyle('z-compound-depth').value) { + for (var i = 0; i < near.length; i++) { + if (near[i].isEdge()) { + near[i] = ele; + nearEdge = ele; + minSqDist = sqDist != null ? sqDist : minSqDist; + break; + } + } + } + } else { + near.push(ele); + nearEdge = ele; + minSqDist = sqDist != null ? sqDist : minSqDist; + } + } + } + + function checkNode(node) { + var width = node.outerWidth() + 2 * nodeThreshold; + var height = node.outerHeight() + 2 * nodeThreshold; + var hw = width / 2; + var hh = height / 2; + var pos = node.position(); + + if (pos.x - hw <= x && x <= pos.x + hw // bb check x + && pos.y - hh <= y && y <= pos.y + hh // bb check y + ) { + var shape = r.nodeShapes[self.getNodeShape(node)]; + + if (shape.checkPoint(x, y, 0, width, height, pos.x, pos.y)) { + addEle(node, 0); + return true; + } + } + } + + function checkEdge(edge) { + var _p = edge._private; + var rs = _p.rscratch; + var styleWidth = edge.pstyle('width').pfValue; + var scale = edge.pstyle('arrow-scale').value; + var width = styleWidth / 2 + edgeThreshold; // more like a distance radius from centre + + var widthSq = width * width; + var width2 = width * 2; + var src = _p.source; + var tgt = _p.target; + var sqDist; + + if (rs.edgeType === 'segments' || rs.edgeType === 'straight' || rs.edgeType === 'haystack') { + var pts = rs.allpts; + + for (var i = 0; i + 3 < pts.length; i += 2) { + if (inLineVicinity(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3], width2) && widthSq > (sqDist = sqdistToFiniteLine(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3]))) { + addEle(edge, sqDist); + return true; + } + } + } else if (rs.edgeType === 'bezier' || rs.edgeType === 'multibezier' || rs.edgeType === 'self' || rs.edgeType === 'compound') { + var pts = rs.allpts; + + for (var i = 0; i + 5 < rs.allpts.length; i += 4) { + if (inBezierVicinity(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3], pts[i + 4], pts[i + 5], width2) && widthSq > (sqDist = sqdistToQuadraticBezier(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3], pts[i + 4], pts[i + 5]))) { + addEle(edge, sqDist); + return true; + } + } + } // if we're close to the edge but didn't hit it, maybe we hit its arrows + + + var src = src || _p.source; + var tgt = tgt || _p.target; + var arSize = self.getArrowWidth(styleWidth, scale); + var arrows = [{ + name: 'source', + x: rs.arrowStartX, + y: rs.arrowStartY, + angle: rs.srcArrowAngle + }, { + name: 'target', + x: rs.arrowEndX, + y: rs.arrowEndY, + angle: rs.tgtArrowAngle + }, { + name: 'mid-source', + x: rs.midX, + y: rs.midY, + angle: rs.midsrcArrowAngle + }, { + name: 'mid-target', + x: rs.midX, + y: rs.midY, + angle: rs.midtgtArrowAngle + }]; + + for (var i = 0; i < arrows.length; i++) { + var ar = arrows[i]; + var shape = r.arrowShapes[edge.pstyle(ar.name + '-arrow-shape').value]; + var edgeWidth = edge.pstyle('width').pfValue; + + if (shape.roughCollide(x, y, arSize, ar.angle, { + x: ar.x, + y: ar.y + }, edgeWidth, edgeThreshold) && shape.collide(x, y, arSize, ar.angle, { + x: ar.x, + y: ar.y + }, edgeWidth, edgeThreshold)) { + addEle(edge); + return true; + } + } // for compound graphs, hitting edge may actually want a connected node instead (b/c edge may have greater z-index precedence) + + + if (hasCompounds && near.length > 0) { + checkNode(src); + checkNode(tgt); + } + } + + function preprop(obj, name, pre) { + return getPrefixedProperty(obj, name, pre); + } + + function checkLabel(ele, prefix) { + var _p = ele._private; + var th = labelThreshold; + var prefixDash; + + if (prefix) { + prefixDash = prefix + '-'; + } else { + prefixDash = ''; + } + + ele.boundingBox(); + var bb = _p.labelBounds[prefix || 'main']; + var text = ele.pstyle(prefixDash + 'label').value; + var eventsEnabled = ele.pstyle('text-events').strValue === 'yes'; + + if (!eventsEnabled || !text) { + return; + } + + var lx = preprop(_p.rscratch, 'labelX', prefix); + var ly = preprop(_p.rscratch, 'labelY', prefix); + var theta = preprop(_p.rscratch, 'labelAngle', prefix); + var ox = ele.pstyle(prefixDash + 'text-margin-x').pfValue; + var oy = ele.pstyle(prefixDash + 'text-margin-y').pfValue; + var lx1 = bb.x1 - th - ox; // (-ox, -oy) as bb already includes margin + + var lx2 = bb.x2 + th - ox; // and rotation is about (lx, ly) + + var ly1 = bb.y1 - th - oy; + var ly2 = bb.y2 + th - oy; + + if (theta) { + var cos = Math.cos(theta); + var sin = Math.sin(theta); + + var rotate = function rotate(x, y) { + x = x - lx; + y = y - ly; + return { + x: x * cos - y * sin + lx, + y: x * sin + y * cos + ly + }; + }; + + var px1y1 = rotate(lx1, ly1); + var px1y2 = rotate(lx1, ly2); + var px2y1 = rotate(lx2, ly1); + var px2y2 = rotate(lx2, ly2); + var points = [// with the margin added after the rotation is applied + px1y1.x + ox, px1y1.y + oy, px2y1.x + ox, px2y1.y + oy, px2y2.x + ox, px2y2.y + oy, px1y2.x + ox, px1y2.y + oy]; + + if (pointInsidePolygonPoints(x, y, points)) { + addEle(ele); + return true; + } + } else { + // do a cheaper bb check + if (inBoundingBox(bb, x, y)) { + addEle(ele); + return true; + } + } + } + + for (var i = eles.length - 1; i >= 0; i--) { + // reverse order for precedence + var ele = eles[i]; + + if (ele.isNode()) { + checkNode(ele) || checkLabel(ele); + } else { + // then edge + checkEdge(ele) || checkLabel(ele) || checkLabel(ele, 'source') || checkLabel(ele, 'target'); + } + } + + return near; +}; // 'Give me everything from this box' + + +BRp$e.getAllInBox = function (x1, y1, x2, y2) { + var eles = this.getCachedZSortedEles().interactive; + var box = []; + var x1c = Math.min(x1, x2); + var x2c = Math.max(x1, x2); + var y1c = Math.min(y1, y2); + var y2c = Math.max(y1, y2); + x1 = x1c; + x2 = x2c; + y1 = y1c; + y2 = y2c; + var boxBb = makeBoundingBox({ + x1: x1, + y1: y1, + x2: x2, + y2: y2 + }); + + for (var e = 0; e < eles.length; e++) { + var ele = eles[e]; + + if (ele.isNode()) { + var node = ele; + var nodeBb = node.boundingBox({ + includeNodes: true, + includeEdges: false, + includeLabels: false + }); + + if (boundingBoxesIntersect(boxBb, nodeBb) && !boundingBoxInBoundingBox(nodeBb, boxBb)) { + box.push(node); + } + } else { + var edge = ele; + var _p = edge._private; + var rs = _p.rscratch; + + if (rs.startX != null && rs.startY != null && !inBoundingBox(boxBb, rs.startX, rs.startY)) { + continue; + } + + if (rs.endX != null && rs.endY != null && !inBoundingBox(boxBb, rs.endX, rs.endY)) { + continue; + } + + if (rs.edgeType === 'bezier' || rs.edgeType === 'multibezier' || rs.edgeType === 'self' || rs.edgeType === 'compound' || rs.edgeType === 'segments' || rs.edgeType === 'haystack') { + var pts = _p.rstyle.bezierPts || _p.rstyle.linePts || _p.rstyle.haystackPts; + var allInside = true; + + for (var i = 0; i < pts.length; i++) { + if (!pointInBoundingBox(boxBb, pts[i])) { + allInside = false; + break; + } + } + + if (allInside) { + box.push(edge); + } + } else if (rs.edgeType === 'haystack' || rs.edgeType === 'straight') { + box.push(edge); + } + } + } + + return box; +}; + +var BRp$d = {}; + +BRp$d.calculateArrowAngles = function (edge) { + var rs = edge._private.rscratch; + var isHaystack = rs.edgeType === 'haystack'; + var isBezier = rs.edgeType === 'bezier'; + var isMultibezier = rs.edgeType === 'multibezier'; + var isSegments = rs.edgeType === 'segments'; + var isCompound = rs.edgeType === 'compound'; + var isSelf = rs.edgeType === 'self'; // Displacement gives direction for arrowhead orientation + + var dispX, dispY; + var startX, startY, endX, endY, midX, midY; + + if (isHaystack) { + startX = rs.haystackPts[0]; + startY = rs.haystackPts[1]; + endX = rs.haystackPts[2]; + endY = rs.haystackPts[3]; + } else { + startX = rs.arrowStartX; + startY = rs.arrowStartY; + endX = rs.arrowEndX; + endY = rs.arrowEndY; + } + + midX = rs.midX; + midY = rs.midY; // source + // + + if (isSegments) { + dispX = startX - rs.segpts[0]; + dispY = startY - rs.segpts[1]; + } else if (isMultibezier || isCompound || isSelf || isBezier) { + var pts = rs.allpts; + var bX = qbezierAt(pts[0], pts[2], pts[4], 0.1); + var bY = qbezierAt(pts[1], pts[3], pts[5], 0.1); + dispX = startX - bX; + dispY = startY - bY; + } else { + dispX = startX - midX; + dispY = startY - midY; + } + + rs.srcArrowAngle = getAngleFromDisp(dispX, dispY); // mid target + // + + var midX = rs.midX; + var midY = rs.midY; + + if (isHaystack) { + midX = (startX + endX) / 2; + midY = (startY + endY) / 2; + } + + dispX = endX - startX; + dispY = endY - startY; + + if (isSegments) { + var pts = rs.allpts; + + if (pts.length / 2 % 2 === 0) { + var i2 = pts.length / 2; + var i1 = i2 - 2; + dispX = pts[i2] - pts[i1]; + dispY = pts[i2 + 1] - pts[i1 + 1]; + } else { + var i2 = pts.length / 2 - 1; + var i1 = i2 - 2; + var i3 = i2 + 2; + dispX = pts[i2] - pts[i1]; + dispY = pts[i2 + 1] - pts[i1 + 1]; + } + } else if (isMultibezier || isCompound || isSelf) { + var pts = rs.allpts; + var cpts = rs.ctrlpts; + var bp0x, bp0y; + var bp1x, bp1y; + + if (cpts.length / 2 % 2 === 0) { + var p0 = pts.length / 2 - 1; // startpt + + var ic = p0 + 2; + var p1 = ic + 2; + bp0x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.0); + bp0y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.0); + bp1x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.0001); + bp1y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.0001); + } else { + var ic = pts.length / 2 - 1; // ctrpt + + var p0 = ic - 2; // startpt + + var p1 = ic + 2; // endpt + + bp0x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.4999); + bp0y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.4999); + bp1x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.5); + bp1y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.5); + } + + dispX = bp1x - bp0x; + dispY = bp1y - bp0y; + } + + rs.midtgtArrowAngle = getAngleFromDisp(dispX, dispY); + rs.midDispX = dispX; + rs.midDispY = dispY; // mid source + // + + dispX *= -1; + dispY *= -1; + + if (isSegments) { + var pts = rs.allpts; + + if (pts.length / 2 % 2 === 0) ; else { + var i2 = pts.length / 2 - 1; + var i3 = i2 + 2; + dispX = -(pts[i3] - pts[i2]); + dispY = -(pts[i3 + 1] - pts[i2 + 1]); + } + } + + rs.midsrcArrowAngle = getAngleFromDisp(dispX, dispY); // target + // + + if (isSegments) { + dispX = endX - rs.segpts[rs.segpts.length - 2]; + dispY = endY - rs.segpts[rs.segpts.length - 1]; + } else if (isMultibezier || isCompound || isSelf || isBezier) { + var pts = rs.allpts; + var l = pts.length; + var bX = qbezierAt(pts[l - 6], pts[l - 4], pts[l - 2], 0.9); + var bY = qbezierAt(pts[l - 5], pts[l - 3], pts[l - 1], 0.9); + dispX = endX - bX; + dispY = endY - bY; + } else { + dispX = endX - midX; + dispY = endY - midY; + } + + rs.tgtArrowAngle = getAngleFromDisp(dispX, dispY); +}; + +BRp$d.getArrowWidth = BRp$d.getArrowHeight = function (edgeWidth, scale) { + var cache = this.arrowWidthCache = this.arrowWidthCache || {}; + var cachedVal = cache[edgeWidth + ', ' + scale]; + + if (cachedVal) { + return cachedVal; + } + + cachedVal = Math.max(Math.pow(edgeWidth * 13.37, 0.9), 29) * scale; + cache[edgeWidth + ', ' + scale] = cachedVal; + return cachedVal; +}; + +var BRp$c = {}; + +BRp$c.findHaystackPoints = function (edges) { + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var _p = edge._private; + var rs = _p.rscratch; + + if (!rs.haystack) { + var angle = Math.random() * 2 * Math.PI; + rs.source = { + x: Math.cos(angle), + y: Math.sin(angle) + }; + angle = Math.random() * 2 * Math.PI; + rs.target = { + x: Math.cos(angle), + y: Math.sin(angle) + }; + } + + var src = _p.source; + var tgt = _p.target; + var srcPos = src.position(); + var tgtPos = tgt.position(); + var srcW = src.width(); + var tgtW = tgt.width(); + var srcH = src.height(); + var tgtH = tgt.height(); + var radius = edge.pstyle('haystack-radius').value; + var halfRadius = radius / 2; // b/c have to half width/height + + rs.haystackPts = rs.allpts = [rs.source.x * srcW * halfRadius + srcPos.x, rs.source.y * srcH * halfRadius + srcPos.y, rs.target.x * tgtW * halfRadius + tgtPos.x, rs.target.y * tgtH * halfRadius + tgtPos.y]; + rs.midX = (rs.allpts[0] + rs.allpts[2]) / 2; + rs.midY = (rs.allpts[1] + rs.allpts[3]) / 2; // always override as haystack in case set to different type previously + + rs.edgeType = 'haystack'; + rs.haystack = true; + this.storeEdgeProjections(edge); + this.calculateArrowAngles(edge); + this.recalculateEdgeLabelProjections(edge); + this.calculateLabelAngles(edge); + } +}; + +BRp$c.findSegmentsPoints = function (edge, pairInfo) { + // Segments (multiple straight lines) + var rs = edge._private.rscratch; + var posPts = pairInfo.posPts, + intersectionPts = pairInfo.intersectionPts, + vectorNormInverse = pairInfo.vectorNormInverse; + var edgeDistances = edge.pstyle('edge-distances').value; + var segmentWs = edge.pstyle('segment-weights'); + var segmentDs = edge.pstyle('segment-distances'); + var segmentsN = Math.min(segmentWs.pfValue.length, segmentDs.pfValue.length); + rs.edgeType = 'segments'; + rs.segpts = []; + + for (var s = 0; s < segmentsN; s++) { + var w = segmentWs.pfValue[s]; + var d = segmentDs.pfValue[s]; + var w1 = 1 - w; + var w2 = w; + var midptPts = edgeDistances === 'node-position' ? posPts : intersectionPts; + var adjustedMidpt = { + x: midptPts.x1 * w1 + midptPts.x2 * w2, + y: midptPts.y1 * w1 + midptPts.y2 * w2 + }; + rs.segpts.push(adjustedMidpt.x + vectorNormInverse.x * d, adjustedMidpt.y + vectorNormInverse.y * d); + } +}; + +BRp$c.findLoopPoints = function (edge, pairInfo, i, edgeIsUnbundled) { + // Self-edge + var rs = edge._private.rscratch; + var dirCounts = pairInfo.dirCounts, + srcPos = pairInfo.srcPos; + var ctrlptDists = edge.pstyle('control-point-distances'); + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : undefined; + var loopDir = edge.pstyle('loop-direction').pfValue; + var loopSwp = edge.pstyle('loop-sweep').pfValue; + var stepSize = edge.pstyle('control-point-step-size').pfValue; + rs.edgeType = 'self'; + var j = i; + var loopDist = stepSize; + + if (edgeIsUnbundled) { + j = 0; + loopDist = ctrlptDist; + } + + var loopAngle = loopDir - Math.PI / 2; + var outAngle = loopAngle - loopSwp / 2; + var inAngle = loopAngle + loopSwp / 2; // increase by step size for overlapping loops, keyed on direction and sweep values + + var dc = String(loopDir + '_' + loopSwp); + j = dirCounts[dc] === undefined ? dirCounts[dc] = 0 : ++dirCounts[dc]; + rs.ctrlpts = [srcPos.x + Math.cos(outAngle) * 1.4 * loopDist * (j / 3 + 1), srcPos.y + Math.sin(outAngle) * 1.4 * loopDist * (j / 3 + 1), srcPos.x + Math.cos(inAngle) * 1.4 * loopDist * (j / 3 + 1), srcPos.y + Math.sin(inAngle) * 1.4 * loopDist * (j / 3 + 1)]; +}; + +BRp$c.findCompoundLoopPoints = function (edge, pairInfo, i, edgeIsUnbundled) { + // Compound edge + var rs = edge._private.rscratch; + rs.edgeType = 'compound'; + var srcPos = pairInfo.srcPos, + tgtPos = pairInfo.tgtPos, + srcW = pairInfo.srcW, + srcH = pairInfo.srcH, + tgtW = pairInfo.tgtW, + tgtH = pairInfo.tgtH; + var stepSize = edge.pstyle('control-point-step-size').pfValue; + var ctrlptDists = edge.pstyle('control-point-distances'); + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : undefined; + var j = i; + var loopDist = stepSize; + + if (edgeIsUnbundled) { + j = 0; + loopDist = ctrlptDist; + } + + var loopW = 50; + var loopaPos = { + x: srcPos.x - srcW / 2, + y: srcPos.y - srcH / 2 + }; + var loopbPos = { + x: tgtPos.x - tgtW / 2, + y: tgtPos.y - tgtH / 2 + }; + var loopPos = { + x: Math.min(loopaPos.x, loopbPos.x), + y: Math.min(loopaPos.y, loopbPos.y) + }; // avoids cases with impossible beziers + + var minCompoundStretch = 0.5; + var compoundStretchA = Math.max(minCompoundStretch, Math.log(srcW * 0.01)); + var compoundStretchB = Math.max(minCompoundStretch, Math.log(tgtW * 0.01)); + rs.ctrlpts = [loopPos.x, loopPos.y - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j / 3 + 1) * compoundStretchA, loopPos.x - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j / 3 + 1) * compoundStretchB, loopPos.y]; +}; + +BRp$c.findStraightEdgePoints = function (edge) { + // Straight edge within bundle + edge._private.rscratch.edgeType = 'straight'; +}; + +BRp$c.findBezierPoints = function (edge, pairInfo, i, edgeIsUnbundled, edgeIsSwapped) { + var rs = edge._private.rscratch; + var vectorNormInverse = pairInfo.vectorNormInverse, + posPts = pairInfo.posPts, + intersectionPts = pairInfo.intersectionPts; + var edgeDistances = edge.pstyle('edge-distances').value; + var stepSize = edge.pstyle('control-point-step-size').pfValue; + var ctrlptDists = edge.pstyle('control-point-distances'); + var ctrlptWs = edge.pstyle('control-point-weights'); + var bezierN = ctrlptDists && ctrlptWs ? Math.min(ctrlptDists.value.length, ctrlptWs.value.length) : 1; + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : undefined; + var ctrlptWeight = ctrlptWs.value[0]; // (Multi)bezier + + var multi = edgeIsUnbundled; + rs.edgeType = multi ? 'multibezier' : 'bezier'; + rs.ctrlpts = []; + + for (var b = 0; b < bezierN; b++) { + var normctrlptDist = (0.5 - pairInfo.eles.length / 2 + i) * stepSize * (edgeIsSwapped ? -1 : 1); + var manctrlptDist = void 0; + var sign = signum(normctrlptDist); + + if (multi) { + ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[b] : stepSize; // fall back on step size + + ctrlptWeight = ctrlptWs.value[b]; + } + + if (edgeIsUnbundled) { + // multi or single unbundled + manctrlptDist = ctrlptDist; + } else { + manctrlptDist = ctrlptDist !== undefined ? sign * ctrlptDist : undefined; + } + + var distanceFromMidpoint = manctrlptDist !== undefined ? manctrlptDist : normctrlptDist; + var w1 = 1 - ctrlptWeight; + var w2 = ctrlptWeight; + var midptPts = edgeDistances === 'node-position' ? posPts : intersectionPts; + var adjustedMidpt = { + x: midptPts.x1 * w1 + midptPts.x2 * w2, + y: midptPts.y1 * w1 + midptPts.y2 * w2 + }; + rs.ctrlpts.push(adjustedMidpt.x + vectorNormInverse.x * distanceFromMidpoint, adjustedMidpt.y + vectorNormInverse.y * distanceFromMidpoint); + } +}; + +BRp$c.findTaxiPoints = function (edge, pairInfo) { + // Taxicab geometry with two turns maximum + var rs = edge._private.rscratch; + rs.edgeType = 'segments'; + var VERTICAL = 'vertical'; + var HORIZONTAL = 'horizontal'; + var LEFTWARD = 'leftward'; + var RIGHTWARD = 'rightward'; + var DOWNWARD = 'downward'; + var UPWARD = 'upward'; + var AUTO = 'auto'; + var posPts = pairInfo.posPts, + srcW = pairInfo.srcW, + srcH = pairInfo.srcH, + tgtW = pairInfo.tgtW, + tgtH = pairInfo.tgtH; + var edgeDistances = edge.pstyle('edge-distances').value; + var dIncludesNodeBody = edgeDistances !== 'node-position'; + var taxiDir = edge.pstyle('taxi-direction').value; + var rawTaxiDir = taxiDir; // unprocessed value + + var taxiTurn = edge.pstyle('taxi-turn'); + var turnIsPercent = taxiTurn.units === '%'; + var taxiTurnPfVal = taxiTurn.pfValue; + var turnIsNegative = taxiTurnPfVal < 0; // i.e. from target side + + var minD = edge.pstyle('taxi-turn-min-distance').pfValue; + var dw = dIncludesNodeBody ? (srcW + tgtW) / 2 : 0; + var dh = dIncludesNodeBody ? (srcH + tgtH) / 2 : 0; + var pdx = posPts.x2 - posPts.x1; + var pdy = posPts.y2 - posPts.y1; // take away the effective w/h from the magnitude of the delta value + + var subDWH = function subDWH(dxy, dwh) { + if (dxy > 0) { + return Math.max(dxy - dwh, 0); + } else { + return Math.min(dxy + dwh, 0); + } + }; + + var dx = subDWH(pdx, dw); + var dy = subDWH(pdy, dh); + var isExplicitDir = false; + + if (rawTaxiDir === AUTO) { + taxiDir = Math.abs(dx) > Math.abs(dy) ? HORIZONTAL : VERTICAL; + } else if (rawTaxiDir === UPWARD || rawTaxiDir === DOWNWARD) { + taxiDir = VERTICAL; + isExplicitDir = true; + } else if (rawTaxiDir === LEFTWARD || rawTaxiDir === RIGHTWARD) { + taxiDir = HORIZONTAL; + isExplicitDir = true; + } + + var isVert = taxiDir === VERTICAL; + var l = isVert ? dy : dx; + var pl = isVert ? pdy : pdx; + var sgnL = signum(pl); + var forcedDir = false; + + if (!(isExplicitDir && (turnIsPercent || turnIsNegative)) // forcing in this case would cause weird growing in the opposite direction + && (rawTaxiDir === DOWNWARD && pl < 0 || rawTaxiDir === UPWARD && pl > 0 || rawTaxiDir === LEFTWARD && pl > 0 || rawTaxiDir === RIGHTWARD && pl < 0)) { + sgnL *= -1; + l = sgnL * Math.abs(l); + forcedDir = true; + } + + var d; + + if (turnIsPercent) { + var p = taxiTurnPfVal < 0 ? 1 + taxiTurnPfVal : taxiTurnPfVal; + d = p * l; + } else { + var k = taxiTurnPfVal < 0 ? l : 0; + d = k + taxiTurnPfVal * sgnL; + } + + var getIsTooClose = function getIsTooClose(d) { + return Math.abs(d) < minD || Math.abs(d) >= Math.abs(l); + }; + + var isTooCloseSrc = getIsTooClose(d); + var isTooCloseTgt = getIsTooClose(Math.abs(l) - Math.abs(d)); + var isTooClose = isTooCloseSrc || isTooCloseTgt; + + if (isTooClose && !forcedDir) { + // non-ideal routing + if (isVert) { + // vertical fallbacks + var lShapeInsideSrc = Math.abs(pl) <= srcH / 2; + var lShapeInsideTgt = Math.abs(pdx) <= tgtW / 2; + + if (lShapeInsideSrc) { + // horizontal Z-shape (direction not respected) + var x = (posPts.x1 + posPts.x2) / 2; + var y1 = posPts.y1, + y2 = posPts.y2; + rs.segpts = [x, y1, x, y2]; + } else if (lShapeInsideTgt) { + // vertical Z-shape (distance not respected) + var y = (posPts.y1 + posPts.y2) / 2; + var x1 = posPts.x1, + x2 = posPts.x2; + rs.segpts = [x1, y, x2, y]; + } else { + // L-shape fallback (turn distance not respected, but works well with tree siblings) + rs.segpts = [posPts.x1, posPts.y2]; + } + } else { + // horizontal fallbacks + var _lShapeInsideSrc = Math.abs(pl) <= srcW / 2; + + var _lShapeInsideTgt = Math.abs(pdy) <= tgtH / 2; + + if (_lShapeInsideSrc) { + // vertical Z-shape (direction not respected) + var _y = (posPts.y1 + posPts.y2) / 2; + + var _x = posPts.x1, + _x2 = posPts.x2; + rs.segpts = [_x, _y, _x2, _y]; + } else if (_lShapeInsideTgt) { + // horizontal Z-shape (turn distance not respected) + var _x3 = (posPts.x1 + posPts.x2) / 2; + + var _y2 = posPts.y1, + _y3 = posPts.y2; + rs.segpts = [_x3, _y2, _x3, _y3]; + } else { + // L-shape (turn distance not respected, but works well for tree siblings) + rs.segpts = [posPts.x2, posPts.y1]; + } + } + } else { + // ideal routing + if (isVert) { + var _y4 = posPts.y1 + d + (dIncludesNodeBody ? srcH / 2 * sgnL : 0); + + var _x4 = posPts.x1, + _x5 = posPts.x2; + rs.segpts = [_x4, _y4, _x5, _y4]; + } else { + // horizontal + var _x6 = posPts.x1 + d + (dIncludesNodeBody ? srcW / 2 * sgnL : 0); + + var _y5 = posPts.y1, + _y6 = posPts.y2; + rs.segpts = [_x6, _y5, _x6, _y6]; + } + } +}; + +BRp$c.tryToCorrectInvalidPoints = function (edge, pairInfo) { + var rs = edge._private.rscratch; // can only correct beziers for now... + + if (rs.edgeType === 'bezier') { + var srcPos = pairInfo.srcPos, + tgtPos = pairInfo.tgtPos, + srcW = pairInfo.srcW, + srcH = pairInfo.srcH, + tgtW = pairInfo.tgtW, + tgtH = pairInfo.tgtH, + srcShape = pairInfo.srcShape, + tgtShape = pairInfo.tgtShape; + var badStart = !number$1(rs.startX) || !number$1(rs.startY); + var badAStart = !number$1(rs.arrowStartX) || !number$1(rs.arrowStartY); + var badEnd = !number$1(rs.endX) || !number$1(rs.endY); + var badAEnd = !number$1(rs.arrowEndX) || !number$1(rs.arrowEndY); + var minCpADistFactor = 3; + var arrowW = this.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.arrowShapeWidth; + var minCpADist = minCpADistFactor * arrowW; + var startACpDist = dist({ + x: rs.ctrlpts[0], + y: rs.ctrlpts[1] + }, { + x: rs.startX, + y: rs.startY + }); + var closeStartACp = startACpDist < minCpADist; + var endACpDist = dist({ + x: rs.ctrlpts[0], + y: rs.ctrlpts[1] + }, { + x: rs.endX, + y: rs.endY + }); + var closeEndACp = endACpDist < minCpADist; + var overlapping = false; + + if (badStart || badAStart || closeStartACp) { + overlapping = true; // project control point along line from src centre to outside the src shape + // (otherwise intersection will yield nothing) + + var cpD = { + // delta + x: rs.ctrlpts[0] - srcPos.x, + y: rs.ctrlpts[1] - srcPos.y + }; + var cpL = Math.sqrt(cpD.x * cpD.x + cpD.y * cpD.y); // length of line + + var cpM = { + // normalised delta + x: cpD.x / cpL, + y: cpD.y / cpL + }; + var radius = Math.max(srcW, srcH); + var cpProj = { + // *2 radius guarantees outside shape + x: rs.ctrlpts[0] + cpM.x * 2 * radius, + y: rs.ctrlpts[1] + cpM.y * 2 * radius + }; + var srcCtrlPtIntn = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, cpProj.x, cpProj.y, 0); + + if (closeStartACp) { + rs.ctrlpts[0] = rs.ctrlpts[0] + cpM.x * (minCpADist - startACpDist); + rs.ctrlpts[1] = rs.ctrlpts[1] + cpM.y * (minCpADist - startACpDist); + } else { + rs.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x * minCpADist; + rs.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y * minCpADist; + } + } + + if (badEnd || badAEnd || closeEndACp) { + overlapping = true; // project control point along line from tgt centre to outside the tgt shape + // (otherwise intersection will yield nothing) + + var _cpD = { + // delta + x: rs.ctrlpts[0] - tgtPos.x, + y: rs.ctrlpts[1] - tgtPos.y + }; + + var _cpL = Math.sqrt(_cpD.x * _cpD.x + _cpD.y * _cpD.y); // length of line + + + var _cpM = { + // normalised delta + x: _cpD.x / _cpL, + y: _cpD.y / _cpL + }; + + var _radius = Math.max(srcW, srcH); + + var _cpProj = { + // *2 radius guarantees outside shape + x: rs.ctrlpts[0] + _cpM.x * 2 * _radius, + y: rs.ctrlpts[1] + _cpM.y * 2 * _radius + }; + var tgtCtrlPtIntn = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, _cpProj.x, _cpProj.y, 0); + + if (closeEndACp) { + rs.ctrlpts[0] = rs.ctrlpts[0] + _cpM.x * (minCpADist - endACpDist); + rs.ctrlpts[1] = rs.ctrlpts[1] + _cpM.y * (minCpADist - endACpDist); + } else { + rs.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x * minCpADist; + rs.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y * minCpADist; + } + } + + if (overlapping) { + // recalc endpts + this.findEndpoints(edge); + } + } +}; + +BRp$c.storeAllpts = function (edge) { + var rs = edge._private.rscratch; + + if (rs.edgeType === 'multibezier' || rs.edgeType === 'bezier' || rs.edgeType === 'self' || rs.edgeType === 'compound') { + rs.allpts = []; + rs.allpts.push(rs.startX, rs.startY); + + for (var b = 0; b + 1 < rs.ctrlpts.length; b += 2) { + // ctrl pt itself + rs.allpts.push(rs.ctrlpts[b], rs.ctrlpts[b + 1]); // the midpt between ctrlpts as intermediate destination pts + + if (b + 3 < rs.ctrlpts.length) { + rs.allpts.push((rs.ctrlpts[b] + rs.ctrlpts[b + 2]) / 2, (rs.ctrlpts[b + 1] + rs.ctrlpts[b + 3]) / 2); + } + } + + rs.allpts.push(rs.endX, rs.endY); + var m, mt; + + if (rs.ctrlpts.length / 2 % 2 === 0) { + m = rs.allpts.length / 2 - 1; + rs.midX = rs.allpts[m]; + rs.midY = rs.allpts[m + 1]; + } else { + m = rs.allpts.length / 2 - 3; + mt = 0.5; + rs.midX = qbezierAt(rs.allpts[m], rs.allpts[m + 2], rs.allpts[m + 4], mt); + rs.midY = qbezierAt(rs.allpts[m + 1], rs.allpts[m + 3], rs.allpts[m + 5], mt); + } + } else if (rs.edgeType === 'straight') { + // need to calc these after endpts + rs.allpts = [rs.startX, rs.startY, rs.endX, rs.endY]; // default midpt for labels etc + + rs.midX = (rs.startX + rs.endX + rs.arrowStartX + rs.arrowEndX) / 4; + rs.midY = (rs.startY + rs.endY + rs.arrowStartY + rs.arrowEndY) / 4; + } else if (rs.edgeType === 'segments') { + rs.allpts = []; + rs.allpts.push(rs.startX, rs.startY); + rs.allpts.push.apply(rs.allpts, rs.segpts); + rs.allpts.push(rs.endX, rs.endY); + + if (rs.segpts.length % 4 === 0) { + var i2 = rs.segpts.length / 2; + var i1 = i2 - 2; + rs.midX = (rs.segpts[i1] + rs.segpts[i2]) / 2; + rs.midY = (rs.segpts[i1 + 1] + rs.segpts[i2 + 1]) / 2; + } else { + var _i = rs.segpts.length / 2 - 1; + + rs.midX = rs.segpts[_i]; + rs.midY = rs.segpts[_i + 1]; + } + } +}; + +BRp$c.checkForInvalidEdgeWarning = function (edge) { + var rs = edge[0]._private.rscratch; + + if (rs.nodesOverlap || number$1(rs.startX) && number$1(rs.startY) && number$1(rs.endX) && number$1(rs.endY)) { + rs.loggedErr = false; + } else { + if (!rs.loggedErr) { + rs.loggedErr = true; + warn('Edge `' + edge.id() + '` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap.'); + } + } +}; + +BRp$c.findEdgeControlPoints = function (edges) { + var _this = this; + + if (!edges || edges.length === 0) { + return; + } + + var r = this; + var cy = r.cy; + var hasCompounds = cy.hasCompoundNodes(); + var hashTable = { + map: new Map$1(), + get: function get(pairId) { + var map2 = this.map.get(pairId[0]); + + if (map2 != null) { + return map2.get(pairId[1]); + } else { + return null; + } + }, + set: function set(pairId, val) { + var map2 = this.map.get(pairId[0]); + + if (map2 == null) { + map2 = new Map$1(); + this.map.set(pairId[0], map2); + } + + map2.set(pairId[1], val); + } + }; + var pairIds = []; + var haystackEdges = []; // create a table of edge (src, tgt) => list of edges between them + + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var _p = edge._private; + var curveStyle = edge.pstyle('curve-style').value; // ignore edges who are not to be displayed + // they shouldn't take up space + + if (edge.removed() || !edge.takesUpSpace()) { + continue; + } + + if (curveStyle === 'haystack') { + haystackEdges.push(edge); + continue; + } + + var edgeIsUnbundled = curveStyle === 'unbundled-bezier' || curveStyle === 'segments' || curveStyle === 'straight' || curveStyle === 'straight-triangle' || curveStyle === 'taxi'; + var edgeIsBezier = curveStyle === 'unbundled-bezier' || curveStyle === 'bezier'; + var src = _p.source; + var tgt = _p.target; + var srcIndex = src.poolIndex(); + var tgtIndex = tgt.poolIndex(); + var pairId = [srcIndex, tgtIndex].sort(); + var tableEntry = hashTable.get(pairId); + + if (tableEntry == null) { + tableEntry = { + eles: [] + }; + hashTable.set(pairId, tableEntry); + pairIds.push(pairId); + } + + tableEntry.eles.push(edge); + + if (edgeIsUnbundled) { + tableEntry.hasUnbundled = true; + } + + if (edgeIsBezier) { + tableEntry.hasBezier = true; + } + } // for each pair (src, tgt), create the ctrl pts + // Nested for loop is OK; total number of iterations for both loops = edgeCount + + + var _loop = function _loop(p) { + var pairId = pairIds[p]; + var pairInfo = hashTable.get(pairId); + var swappedpairInfo = void 0; + + if (!pairInfo.hasUnbundled) { + var pllEdges = pairInfo.eles[0].parallelEdges().filter(function (e) { + return e.isBundledBezier(); + }); + clearArray(pairInfo.eles); + pllEdges.forEach(function (edge) { + return pairInfo.eles.push(edge); + }); // for each pair id, the edges should be sorted by index + + pairInfo.eles.sort(function (edge1, edge2) { + return edge1.poolIndex() - edge2.poolIndex(); + }); + } + + var firstEdge = pairInfo.eles[0]; + var src = firstEdge.source(); + var tgt = firstEdge.target(); // make sure src/tgt distinction is consistent w.r.t. pairId + + if (src.poolIndex() > tgt.poolIndex()) { + var temp = src; + src = tgt; + tgt = temp; + } + + var srcPos = pairInfo.srcPos = src.position(); + var tgtPos = pairInfo.tgtPos = tgt.position(); + var srcW = pairInfo.srcW = src.outerWidth(); + var srcH = pairInfo.srcH = src.outerHeight(); + var tgtW = pairInfo.tgtW = tgt.outerWidth(); + var tgtH = pairInfo.tgtH = tgt.outerHeight(); + + var srcShape = pairInfo.srcShape = r.nodeShapes[_this.getNodeShape(src)]; + + var tgtShape = pairInfo.tgtShape = r.nodeShapes[_this.getNodeShape(tgt)]; + + pairInfo.dirCounts = { + 'north': 0, + 'west': 0, + 'south': 0, + 'east': 0, + 'northwest': 0, + 'southwest': 0, + 'northeast': 0, + 'southeast': 0 + }; + + for (var _i2 = 0; _i2 < pairInfo.eles.length; _i2++) { + var _edge = pairInfo.eles[_i2]; + var rs = _edge[0]._private.rscratch; + + var _curveStyle = _edge.pstyle('curve-style').value; + + var _edgeIsUnbundled = _curveStyle === 'unbundled-bezier' || _curveStyle === 'segments' || _curveStyle === 'taxi'; // whether the normalised pair order is the reverse of the edge's src-tgt order + + + var edgeIsSwapped = !src.same(_edge.source()); + + if (!pairInfo.calculatedIntersection && src !== tgt && (pairInfo.hasBezier || pairInfo.hasUnbundled)) { + pairInfo.calculatedIntersection = true; // pt outside src shape to calc distance/displacement from src to tgt + + var srcOutside = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, tgtPos.x, tgtPos.y, 0); + var srcIntn = pairInfo.srcIntn = srcOutside; // pt outside tgt shape to calc distance/displacement from src to tgt + + var tgtOutside = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, srcPos.x, srcPos.y, 0); + var tgtIntn = pairInfo.tgtIntn = tgtOutside; + var intersectionPts = pairInfo.intersectionPts = { + x1: srcOutside[0], + x2: tgtOutside[0], + y1: srcOutside[1], + y2: tgtOutside[1] + }; + var posPts = pairInfo.posPts = { + x1: srcPos.x, + x2: tgtPos.x, + y1: srcPos.y, + y2: tgtPos.y + }; + var dy = tgtOutside[1] - srcOutside[1]; + var dx = tgtOutside[0] - srcOutside[0]; + var l = Math.sqrt(dx * dx + dy * dy); + var vector = pairInfo.vector = { + x: dx, + y: dy + }; + var vectorNorm = pairInfo.vectorNorm = { + x: vector.x / l, + y: vector.y / l + }; + var vectorNormInverse = { + x: -vectorNorm.y, + y: vectorNorm.x + }; // if node shapes overlap, then no ctrl pts to draw + + pairInfo.nodesOverlap = !number$1(l) || tgtShape.checkPoint(srcOutside[0], srcOutside[1], 0, tgtW, tgtH, tgtPos.x, tgtPos.y) || srcShape.checkPoint(tgtOutside[0], tgtOutside[1], 0, srcW, srcH, srcPos.x, srcPos.y); + pairInfo.vectorNormInverse = vectorNormInverse; + swappedpairInfo = { + nodesOverlap: pairInfo.nodesOverlap, + dirCounts: pairInfo.dirCounts, + calculatedIntersection: true, + hasBezier: pairInfo.hasBezier, + hasUnbundled: pairInfo.hasUnbundled, + eles: pairInfo.eles, + srcPos: tgtPos, + tgtPos: srcPos, + srcW: tgtW, + srcH: tgtH, + tgtW: srcW, + tgtH: srcH, + srcIntn: tgtIntn, + tgtIntn: srcIntn, + srcShape: tgtShape, + tgtShape: srcShape, + posPts: { + x1: posPts.x2, + y1: posPts.y2, + x2: posPts.x1, + y2: posPts.y1 + }, + intersectionPts: { + x1: intersectionPts.x2, + y1: intersectionPts.y2, + x2: intersectionPts.x1, + y2: intersectionPts.y1 + }, + vector: { + x: -vector.x, + y: -vector.y + }, + vectorNorm: { + x: -vectorNorm.x, + y: -vectorNorm.y + }, + vectorNormInverse: { + x: -vectorNormInverse.x, + y: -vectorNormInverse.y + } + }; + } + + var passedPairInfo = edgeIsSwapped ? swappedpairInfo : pairInfo; + rs.nodesOverlap = passedPairInfo.nodesOverlap; + rs.srcIntn = passedPairInfo.srcIntn; + rs.tgtIntn = passedPairInfo.tgtIntn; + + if (hasCompounds && (src.isParent() || src.isChild() || tgt.isParent() || tgt.isChild()) && (src.parents().anySame(tgt) || tgt.parents().anySame(src) || src.same(tgt) && src.isParent())) { + _this.findCompoundLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled); + } else if (src === tgt) { + _this.findLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled); + } else if (_curveStyle === 'segments') { + _this.findSegmentsPoints(_edge, passedPairInfo); + } else if (_curveStyle === 'taxi') { + _this.findTaxiPoints(_edge, passedPairInfo); + } else if (_curveStyle === 'straight' || !_edgeIsUnbundled && pairInfo.eles.length % 2 === 1 && _i2 === Math.floor(pairInfo.eles.length / 2)) { + _this.findStraightEdgePoints(_edge); + } else { + _this.findBezierPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled, edgeIsSwapped); + } + + _this.findEndpoints(_edge); + + _this.tryToCorrectInvalidPoints(_edge, passedPairInfo); + + _this.checkForInvalidEdgeWarning(_edge); + + _this.storeAllpts(_edge); + + _this.storeEdgeProjections(_edge); + + _this.calculateArrowAngles(_edge); + + _this.recalculateEdgeLabelProjections(_edge); + + _this.calculateLabelAngles(_edge); + } // for pair edges + + }; + + for (var p = 0; p < pairIds.length; p++) { + _loop(p); + } // for pair ids + // haystacks avoid the expense of pairInfo stuff (intersections etc.) + + + this.findHaystackPoints(haystackEdges); +}; + +function getPts(pts) { + var retPts = []; + + if (pts == null) { + return; + } + + for (var i = 0; i < pts.length; i += 2) { + var x = pts[i]; + var y = pts[i + 1]; + retPts.push({ + x: x, + y: y + }); + } + + return retPts; +} + +BRp$c.getSegmentPoints = function (edge) { + var rs = edge[0]._private.rscratch; + var type = rs.edgeType; + + if (type === 'segments') { + this.recalculateRenderedStyle(edge); + return getPts(rs.segpts); + } +}; + +BRp$c.getControlPoints = function (edge) { + var rs = edge[0]._private.rscratch; + var type = rs.edgeType; + + if (type === 'bezier' || type === 'multibezier' || type === 'self' || type === 'compound') { + this.recalculateRenderedStyle(edge); + return getPts(rs.ctrlpts); + } +}; + +BRp$c.getEdgeMidpoint = function (edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + return { + x: rs.midX, + y: rs.midY + }; +}; + +var BRp$b = {}; + +BRp$b.manualEndptToPx = function (node, prop) { + var r = this; + var npos = node.position(); + var w = node.outerWidth(); + var h = node.outerHeight(); + + if (prop.value.length === 2) { + var p = [prop.pfValue[0], prop.pfValue[1]]; + + if (prop.units[0] === '%') { + p[0] = p[0] * w; + } + + if (prop.units[1] === '%') { + p[1] = p[1] * h; + } + + p[0] += npos.x; + p[1] += npos.y; + return p; + } else { + var angle = prop.pfValue[0]; + angle = -Math.PI / 2 + angle; // start at 12 o'clock + + var l = 2 * Math.max(w, h); + var _p = [npos.x + Math.cos(angle) * l, npos.y + Math.sin(angle) * l]; + return r.nodeShapes[this.getNodeShape(node)].intersectLine(npos.x, npos.y, w, h, _p[0], _p[1], 0); + } +}; + +BRp$b.findEndpoints = function (edge) { + var r = this; + var intersect; + var source = edge.source()[0]; + var target = edge.target()[0]; + var srcPos = source.position(); + var tgtPos = target.position(); + var tgtArShape = edge.pstyle('target-arrow-shape').value; + var srcArShape = edge.pstyle('source-arrow-shape').value; + var tgtDist = edge.pstyle('target-distance-from-node').pfValue; + var srcDist = edge.pstyle('source-distance-from-node').pfValue; + var curveStyle = edge.pstyle('curve-style').value; + var rs = edge._private.rscratch; + var et = rs.edgeType; + var taxi = curveStyle === 'taxi'; + var self = et === 'self' || et === 'compound'; + var bezier = et === 'bezier' || et === 'multibezier' || self; + var multi = et !== 'bezier'; + var lines = et === 'straight' || et === 'segments'; + var segments = et === 'segments'; + var hasEndpts = bezier || multi || lines; + var overrideEndpts = self || taxi; + var srcManEndpt = edge.pstyle('source-endpoint'); + var srcManEndptVal = overrideEndpts ? 'outside-to-node' : srcManEndpt.value; + var tgtManEndpt = edge.pstyle('target-endpoint'); + var tgtManEndptVal = overrideEndpts ? 'outside-to-node' : tgtManEndpt.value; + rs.srcManEndpt = srcManEndpt; + rs.tgtManEndpt = tgtManEndpt; + var p1; // last known point of edge on target side + + var p2; // last known point of edge on source side + + var p1_i; // point to intersect with target shape + + var p2_i; // point to intersect with source shape + + if (bezier) { + var cpStart = [rs.ctrlpts[0], rs.ctrlpts[1]]; + var cpEnd = multi ? [rs.ctrlpts[rs.ctrlpts.length - 2], rs.ctrlpts[rs.ctrlpts.length - 1]] : cpStart; + p1 = cpEnd; + p2 = cpStart; + } else if (lines) { + var srcArrowFromPt = !segments ? [tgtPos.x, tgtPos.y] : rs.segpts.slice(0, 2); + var tgtArrowFromPt = !segments ? [srcPos.x, srcPos.y] : rs.segpts.slice(rs.segpts.length - 2); + p1 = tgtArrowFromPt; + p2 = srcArrowFromPt; + } + + if (tgtManEndptVal === 'inside-to-node') { + intersect = [tgtPos.x, tgtPos.y]; + } else if (tgtManEndpt.units) { + intersect = this.manualEndptToPx(target, tgtManEndpt); + } else if (tgtManEndptVal === 'outside-to-line') { + intersect = rs.tgtIntn; // use cached value from ctrlpt calc + } else { + if (tgtManEndptVal === 'outside-to-node' || tgtManEndptVal === 'outside-to-node-or-label') { + p1_i = p1; + } else if (tgtManEndptVal === 'outside-to-line' || tgtManEndptVal === 'outside-to-line-or-label') { + p1_i = [srcPos.x, srcPos.y]; + } + + intersect = r.nodeShapes[this.getNodeShape(target)].intersectLine(tgtPos.x, tgtPos.y, target.outerWidth(), target.outerHeight(), p1_i[0], p1_i[1], 0); + + if (tgtManEndptVal === 'outside-to-node-or-label' || tgtManEndptVal === 'outside-to-line-or-label') { + var trs = target._private.rscratch; + var lw = trs.labelWidth; + var lh = trs.labelHeight; + var lx = trs.labelX; + var ly = trs.labelY; + var lw2 = lw / 2; + var lh2 = lh / 2; + var va = target.pstyle('text-valign').value; + + if (va === 'top') { + ly -= lh2; + } else if (va === 'bottom') { + ly += lh2; + } + + var ha = target.pstyle('text-halign').value; + + if (ha === 'left') { + lx -= lw2; + } else if (ha === 'right') { + lx += lw2; + } + + var labelIntersect = polygonIntersectLine(p1_i[0], p1_i[1], [lx - lw2, ly - lh2, lx + lw2, ly - lh2, lx + lw2, ly + lh2, lx - lw2, ly + lh2], tgtPos.x, tgtPos.y); + + if (labelIntersect.length > 0) { + var refPt = srcPos; + var intSqdist = sqdist(refPt, array2point(intersect)); + var labIntSqdist = sqdist(refPt, array2point(labelIntersect)); + var minSqDist = intSqdist; + + if (labIntSqdist < intSqdist) { + intersect = labelIntersect; + minSqDist = labIntSqdist; + } + + if (labelIntersect.length > 2) { + var labInt2SqDist = sqdist(refPt, { + x: labelIntersect[2], + y: labelIntersect[3] + }); + + if (labInt2SqDist < minSqDist) { + intersect = [labelIntersect[2], labelIntersect[3]]; + } + } + } + } + } + + var arrowEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].spacing(edge) + tgtDist); + var edgeEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].gap(edge) + tgtDist); + rs.endX = edgeEnd[0]; + rs.endY = edgeEnd[1]; + rs.arrowEndX = arrowEnd[0]; + rs.arrowEndY = arrowEnd[1]; + + if (srcManEndptVal === 'inside-to-node') { + intersect = [srcPos.x, srcPos.y]; + } else if (srcManEndpt.units) { + intersect = this.manualEndptToPx(source, srcManEndpt); + } else if (srcManEndptVal === 'outside-to-line') { + intersect = rs.srcIntn; // use cached value from ctrlpt calc + } else { + if (srcManEndptVal === 'outside-to-node' || srcManEndptVal === 'outside-to-node-or-label') { + p2_i = p2; + } else if (srcManEndptVal === 'outside-to-line' || srcManEndptVal === 'outside-to-line-or-label') { + p2_i = [tgtPos.x, tgtPos.y]; + } + + intersect = r.nodeShapes[this.getNodeShape(source)].intersectLine(srcPos.x, srcPos.y, source.outerWidth(), source.outerHeight(), p2_i[0], p2_i[1], 0); + + if (srcManEndptVal === 'outside-to-node-or-label' || srcManEndptVal === 'outside-to-line-or-label') { + var srs = source._private.rscratch; + var _lw = srs.labelWidth; + var _lh = srs.labelHeight; + var _lx = srs.labelX; + var _ly = srs.labelY; + + var _lw2 = _lw / 2; + + var _lh2 = _lh / 2; + + var _va = source.pstyle('text-valign').value; + + if (_va === 'top') { + _ly -= _lh2; + } else if (_va === 'bottom') { + _ly += _lh2; + } + + var _ha = source.pstyle('text-halign').value; + + if (_ha === 'left') { + _lx -= _lw2; + } else if (_ha === 'right') { + _lx += _lw2; + } + + var _labelIntersect = polygonIntersectLine(p2_i[0], p2_i[1], [_lx - _lw2, _ly - _lh2, _lx + _lw2, _ly - _lh2, _lx + _lw2, _ly + _lh2, _lx - _lw2, _ly + _lh2], srcPos.x, srcPos.y); + + if (_labelIntersect.length > 0) { + var _refPt = tgtPos; + + var _intSqdist = sqdist(_refPt, array2point(intersect)); + + var _labIntSqdist = sqdist(_refPt, array2point(_labelIntersect)); + + var _minSqDist = _intSqdist; + + if (_labIntSqdist < _intSqdist) { + intersect = [_labelIntersect[0], _labelIntersect[1]]; + _minSqDist = _labIntSqdist; + } + + if (_labelIntersect.length > 2) { + var _labInt2SqDist = sqdist(_refPt, { + x: _labelIntersect[2], + y: _labelIntersect[3] + }); + + if (_labInt2SqDist < _minSqDist) { + intersect = [_labelIntersect[2], _labelIntersect[3]]; + } + } + } + } + } + + var arrowStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].spacing(edge) + srcDist); + var edgeStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].gap(edge) + srcDist); + rs.startX = edgeStart[0]; + rs.startY = edgeStart[1]; + rs.arrowStartX = arrowStart[0]; + rs.arrowStartY = arrowStart[1]; + + if (hasEndpts) { + if (!number$1(rs.startX) || !number$1(rs.startY) || !number$1(rs.endX) || !number$1(rs.endY)) { + rs.badLine = true; + } else { + rs.badLine = false; + } + } +}; + +BRp$b.getSourceEndpoint = function (edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + + switch (rs.edgeType) { + case 'haystack': + return { + x: rs.haystackPts[0], + y: rs.haystackPts[1] + }; + + default: + return { + x: rs.arrowStartX, + y: rs.arrowStartY + }; + } +}; + +BRp$b.getTargetEndpoint = function (edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + + switch (rs.edgeType) { + case 'haystack': + return { + x: rs.haystackPts[2], + y: rs.haystackPts[3] + }; + + default: + return { + x: rs.arrowEndX, + y: rs.arrowEndY + }; + } +}; + +var BRp$a = {}; + +function pushBezierPts(r, edge, pts) { + var qbezierAt$1 = function qbezierAt$1(p1, p2, p3, t) { + return qbezierAt(p1, p2, p3, t); + }; + + var _p = edge._private; + var bpts = _p.rstyle.bezierPts; + + for (var i = 0; i < r.bezierProjPcts.length; i++) { + var p = r.bezierProjPcts[i]; + bpts.push({ + x: qbezierAt$1(pts[0], pts[2], pts[4], p), + y: qbezierAt$1(pts[1], pts[3], pts[5], p) + }); + } +} + +BRp$a.storeEdgeProjections = function (edge) { + var _p = edge._private; + var rs = _p.rscratch; + var et = rs.edgeType; // clear the cached points state + + _p.rstyle.bezierPts = null; + _p.rstyle.linePts = null; + _p.rstyle.haystackPts = null; + + if (et === 'multibezier' || et === 'bezier' || et === 'self' || et === 'compound') { + _p.rstyle.bezierPts = []; + + for (var i = 0; i + 5 < rs.allpts.length; i += 4) { + pushBezierPts(this, edge, rs.allpts.slice(i, i + 6)); + } + } else if (et === 'segments') { + var lpts = _p.rstyle.linePts = []; + + for (var i = 0; i + 1 < rs.allpts.length; i += 2) { + lpts.push({ + x: rs.allpts[i], + y: rs.allpts[i + 1] + }); + } + } else if (et === 'haystack') { + var hpts = rs.haystackPts; + _p.rstyle.haystackPts = [{ + x: hpts[0], + y: hpts[1] + }, { + x: hpts[2], + y: hpts[3] + }]; + } + + _p.rstyle.arrowWidth = this.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.arrowShapeWidth; +}; + +BRp$a.recalculateEdgeProjections = function (edges) { + this.findEdgeControlPoints(edges); +}; + +/* global document */ + +var BRp$9 = {}; + +BRp$9.recalculateNodeLabelProjection = function (node) { + var content = node.pstyle('label').strValue; + + if (emptyString(content)) { + return; + } + + var textX, textY; + var _p = node._private; + var nodeWidth = node.width(); + var nodeHeight = node.height(); + var padding = node.padding(); + var nodePos = node.position(); + var textHalign = node.pstyle('text-halign').strValue; + var textValign = node.pstyle('text-valign').strValue; + var rs = _p.rscratch; + var rstyle = _p.rstyle; + + switch (textHalign) { + case 'left': + textX = nodePos.x - nodeWidth / 2 - padding; + break; + + case 'right': + textX = nodePos.x + nodeWidth / 2 + padding; + break; + + default: + // e.g. center + textX = nodePos.x; + } + + switch (textValign) { + case 'top': + textY = nodePos.y - nodeHeight / 2 - padding; + break; + + case 'bottom': + textY = nodePos.y + nodeHeight / 2 + padding; + break; + + default: + // e.g. middle + textY = nodePos.y; + } + + rs.labelX = textX; + rs.labelY = textY; + rstyle.labelX = textX; + rstyle.labelY = textY; + this.calculateLabelAngles(node); + this.applyLabelDimensions(node); +}; + +var lineAngleFromDelta = function lineAngleFromDelta(dx, dy) { + var angle = Math.atan(dy / dx); + + if (dx === 0 && angle < 0) { + angle = angle * -1; + } + + return angle; +}; + +var lineAngle = function lineAngle(p0, p1) { + var dx = p1.x - p0.x; + var dy = p1.y - p0.y; + return lineAngleFromDelta(dx, dy); +}; + +var bezierAngle = function bezierAngle(p0, p1, p2, t) { + var t0 = bound(0, t - 0.001, 1); + var t1 = bound(0, t + 0.001, 1); + var lp0 = qbezierPtAt(p0, p1, p2, t0); + var lp1 = qbezierPtAt(p0, p1, p2, t1); + return lineAngle(lp0, lp1); +}; + +BRp$9.recalculateEdgeLabelProjections = function (edge) { + var p; + var _p = edge._private; + var rs = _p.rscratch; + var r = this; + var content = { + mid: edge.pstyle('label').strValue, + source: edge.pstyle('source-label').strValue, + target: edge.pstyle('target-label').strValue + }; + + if (content.mid || content.source || content.target) ; else { + return; // no labels => no calcs + } // add center point to style so bounding box calculations can use it + // + + + p = { + x: rs.midX, + y: rs.midY + }; + + var setRs = function setRs(propName, prefix, value) { + setPrefixedProperty(_p.rscratch, propName, prefix, value); + setPrefixedProperty(_p.rstyle, propName, prefix, value); + }; + + setRs('labelX', null, p.x); + setRs('labelY', null, p.y); + var midAngle = lineAngleFromDelta(rs.midDispX, rs.midDispY); + setRs('labelAutoAngle', null, midAngle); + + var createControlPointInfo = function createControlPointInfo() { + if (createControlPointInfo.cache) { + return createControlPointInfo.cache; + } // use cache so only 1x per edge + + + var ctrlpts = []; // store each ctrlpt info init + + for (var i = 0; i + 5 < rs.allpts.length; i += 4) { + var p0 = { + x: rs.allpts[i], + y: rs.allpts[i + 1] + }; + var p1 = { + x: rs.allpts[i + 2], + y: rs.allpts[i + 3] + }; // ctrlpt + + var p2 = { + x: rs.allpts[i + 4], + y: rs.allpts[i + 5] + }; + ctrlpts.push({ + p0: p0, + p1: p1, + p2: p2, + startDist: 0, + length: 0, + segments: [] + }); + } + + var bpts = _p.rstyle.bezierPts; + var nProjs = r.bezierProjPcts.length; + + function addSegment(cp, p0, p1, t0, t1) { + var length = dist(p0, p1); + var prevSegment = cp.segments[cp.segments.length - 1]; + var segment = { + p0: p0, + p1: p1, + t0: t0, + t1: t1, + startDist: prevSegment ? prevSegment.startDist + prevSegment.length : 0, + length: length + }; + cp.segments.push(segment); + cp.length += length; + } // update each ctrlpt with segment info + + + for (var _i = 0; _i < ctrlpts.length; _i++) { + var cp = ctrlpts[_i]; + var prevCp = ctrlpts[_i - 1]; + + if (prevCp) { + cp.startDist = prevCp.startDist + prevCp.length; + } + + addSegment(cp, cp.p0, bpts[_i * nProjs], 0, r.bezierProjPcts[0]); // first + + for (var j = 0; j < nProjs - 1; j++) { + addSegment(cp, bpts[_i * nProjs + j], bpts[_i * nProjs + j + 1], r.bezierProjPcts[j], r.bezierProjPcts[j + 1]); + } + + addSegment(cp, bpts[_i * nProjs + nProjs - 1], cp.p2, r.bezierProjPcts[nProjs - 1], 1); // last + } + + return createControlPointInfo.cache = ctrlpts; + }; + + var calculateEndProjection = function calculateEndProjection(prefix) { + var angle; + var isSrc = prefix === 'source'; + + if (!content[prefix]) { + return; + } + + var offset = edge.pstyle(prefix + '-text-offset').pfValue; + + switch (rs.edgeType) { + case 'self': + case 'compound': + case 'bezier': + case 'multibezier': + { + var cps = createControlPointInfo(); + var selected; + var startDist = 0; + var totalDist = 0; // find the segment we're on + + for (var i = 0; i < cps.length; i++) { + var _cp = cps[isSrc ? i : cps.length - 1 - i]; + + for (var j = 0; j < _cp.segments.length; j++) { + var _seg = _cp.segments[isSrc ? j : _cp.segments.length - 1 - j]; + var lastSeg = i === cps.length - 1 && j === _cp.segments.length - 1; + startDist = totalDist; + totalDist += _seg.length; + + if (totalDist >= offset || lastSeg) { + selected = { + cp: _cp, + segment: _seg + }; + break; + } + } + + if (selected) { + break; + } + } + + var cp = selected.cp; + var seg = selected.segment; + var tSegment = (offset - startDist) / seg.length; + var segDt = seg.t1 - seg.t0; + var t = isSrc ? seg.t0 + segDt * tSegment : seg.t1 - segDt * tSegment; + t = bound(0, t, 1); + p = qbezierPtAt(cp.p0, cp.p1, cp.p2, t); + angle = bezierAngle(cp.p0, cp.p1, cp.p2, t); + break; + } + + case 'straight': + case 'segments': + case 'haystack': + { + var d = 0, + di, + d0; + var p0, p1; + var l = rs.allpts.length; + + for (var _i2 = 0; _i2 + 3 < l; _i2 += 2) { + if (isSrc) { + p0 = { + x: rs.allpts[_i2], + y: rs.allpts[_i2 + 1] + }; + p1 = { + x: rs.allpts[_i2 + 2], + y: rs.allpts[_i2 + 3] + }; + } else { + p0 = { + x: rs.allpts[l - 2 - _i2], + y: rs.allpts[l - 1 - _i2] + }; + p1 = { + x: rs.allpts[l - 4 - _i2], + y: rs.allpts[l - 3 - _i2] + }; + } + + di = dist(p0, p1); + d0 = d; + d += di; + + if (d >= offset) { + break; + } + } + + var pD = offset - d0; + + var _t = pD / di; + + _t = bound(0, _t, 1); + p = lineAt(p0, p1, _t); + angle = lineAngle(p0, p1); + break; + } + } + + setRs('labelX', prefix, p.x); + setRs('labelY', prefix, p.y); + setRs('labelAutoAngle', prefix, angle); + }; + + calculateEndProjection('source'); + calculateEndProjection('target'); + this.applyLabelDimensions(edge); +}; + +BRp$9.applyLabelDimensions = function (ele) { + this.applyPrefixedLabelDimensions(ele); + + if (ele.isEdge()) { + this.applyPrefixedLabelDimensions(ele, 'source'); + this.applyPrefixedLabelDimensions(ele, 'target'); + } +}; + +BRp$9.applyPrefixedLabelDimensions = function (ele, prefix) { + var _p = ele._private; + var text = this.getLabelText(ele, prefix); + var labelDims = this.calculateLabelDimensions(ele, text); + var lineHeight = ele.pstyle('line-height').pfValue; + var textWrap = ele.pstyle('text-wrap').strValue; + var lines = getPrefixedProperty(_p.rscratch, 'labelWrapCachedLines', prefix) || []; + var numLines = textWrap !== 'wrap' ? 1 : Math.max(lines.length, 1); + var normPerLineHeight = labelDims.height / numLines; + var labelLineHeight = normPerLineHeight * lineHeight; + var width = labelDims.width; + var height = labelDims.height + (numLines - 1) * (lineHeight - 1) * normPerLineHeight; + setPrefixedProperty(_p.rstyle, 'labelWidth', prefix, width); + setPrefixedProperty(_p.rscratch, 'labelWidth', prefix, width); + setPrefixedProperty(_p.rstyle, 'labelHeight', prefix, height); + setPrefixedProperty(_p.rscratch, 'labelHeight', prefix, height); + setPrefixedProperty(_p.rscratch, 'labelLineHeight', prefix, labelLineHeight); +}; + +BRp$9.getLabelText = function (ele, prefix) { + var _p = ele._private; + var pfd = prefix ? prefix + '-' : ''; + var text = ele.pstyle(pfd + 'label').strValue; + var textTransform = ele.pstyle('text-transform').value; + + var rscratch = function rscratch(propName, value) { + if (value) { + setPrefixedProperty(_p.rscratch, propName, prefix, value); + return value; + } else { + return getPrefixedProperty(_p.rscratch, propName, prefix); + } + }; // for empty text, skip all processing + + + if (!text) { + return ''; + } + + if (textTransform == 'none') ; else if (textTransform == 'uppercase') { + text = text.toUpperCase(); + } else if (textTransform == 'lowercase') { + text = text.toLowerCase(); + } + + var wrapStyle = ele.pstyle('text-wrap').value; + + if (wrapStyle === 'wrap') { + var labelKey = rscratch('labelKey'); // save recalc if the label is the same as before + + if (labelKey != null && rscratch('labelWrapKey') === labelKey) { + return rscratch('labelWrapCachedText'); + } + + var zwsp = "\u200B"; + var lines = text.split('\n'); + var maxW = ele.pstyle('text-max-width').pfValue; + var overflow = ele.pstyle('text-overflow-wrap').value; + var overflowAny = overflow === 'anywhere'; + var wrappedLines = []; + var wordsRegex = /[\s\u200b]+/; + var wordSeparator = overflowAny ? '' : ' '; + + for (var l = 0; l < lines.length; l++) { + var line = lines[l]; + var lineDims = this.calculateLabelDimensions(ele, line); + var lineW = lineDims.width; + + if (overflowAny) { + var processedLine = line.split('').join(zwsp); + line = processedLine; + } + + if (lineW > maxW) { + // line is too long + var words = line.split(wordsRegex); + var subline = ''; + + for (var w = 0; w < words.length; w++) { + var word = words[w]; + var testLine = subline.length === 0 ? word : subline + wordSeparator + word; + var testDims = this.calculateLabelDimensions(ele, testLine); + var testW = testDims.width; + + if (testW <= maxW) { + // word fits on current line + subline += word + wordSeparator; + } else { + // word starts new line + if (subline) { + wrappedLines.push(subline); + } + + subline = word + wordSeparator; + } + } // if there's remaining text, put it in a wrapped line + + + if (!subline.match(/^[\s\u200b]+$/)) { + wrappedLines.push(subline); + } + } else { + // line is already short enough + wrappedLines.push(line); + } + } // for + + + rscratch('labelWrapCachedLines', wrappedLines); + text = rscratch('labelWrapCachedText', wrappedLines.join('\n')); + rscratch('labelWrapKey', labelKey); + } else if (wrapStyle === 'ellipsis') { + var _maxW = ele.pstyle('text-max-width').pfValue; + var ellipsized = ''; + var ellipsis = "\u2026"; + var incLastCh = false; + + if (this.calculateLabelDimensions(ele, text).width < _maxW) { + // the label already fits + return text; + } + + for (var i = 0; i < text.length; i++) { + var widthWithNextCh = this.calculateLabelDimensions(ele, ellipsized + text[i] + ellipsis).width; + + if (widthWithNextCh > _maxW) { + break; + } + + ellipsized += text[i]; + + if (i === text.length - 1) { + incLastCh = true; + } + } + + if (!incLastCh) { + ellipsized += ellipsis; + } + + return ellipsized; + } // if ellipsize + + + return text; +}; + +BRp$9.getLabelJustification = function (ele) { + var justification = ele.pstyle('text-justification').strValue; + var textHalign = ele.pstyle('text-halign').strValue; + + if (justification === 'auto') { + if (ele.isNode()) { + switch (textHalign) { + case 'left': + return 'right'; + + case 'right': + return 'left'; + + default: + return 'center'; + } + } else { + return 'center'; + } + } else { + return justification; + } +}; + +BRp$9.calculateLabelDimensions = function (ele, text) { + var r = this; + var cacheKey = hashString(text, ele._private.labelDimsKey); + var cache = r.labelDimCache || (r.labelDimCache = []); + var existingVal = cache[cacheKey]; + + if (existingVal != null) { + return existingVal; + } + + var padding = 0; // add padding around text dims, as the measurement isn't that accurate + + var fStyle = ele.pstyle('font-style').strValue; + var size = ele.pstyle('font-size').pfValue; + var family = ele.pstyle('font-family').strValue; + var weight = ele.pstyle('font-weight').strValue; + var canvas = this.labelCalcCanvas; + var c2d = this.labelCalcCanvasContext; + + if (!canvas) { + canvas = this.labelCalcCanvas = document.createElement('canvas'); + c2d = this.labelCalcCanvasContext = canvas.getContext('2d'); + var ds = canvas.style; + ds.position = 'absolute'; + ds.left = '-9999px'; + ds.top = '-9999px'; + ds.zIndex = '-1'; + ds.visibility = 'hidden'; + ds.pointerEvents = 'none'; + } + + c2d.font = "".concat(fStyle, " ").concat(weight, " ").concat(size, "px ").concat(family); + var width = 0; + var height = 0; + var lines = text.split('\n'); + + for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + var metrics = c2d.measureText(line); + var w = Math.ceil(metrics.width); + var h = size; + width = Math.max(w, width); + height += h; + } + + width += padding; + height += padding; + return cache[cacheKey] = { + width: width, + height: height + }; +}; + +BRp$9.calculateLabelAngle = function (ele, prefix) { + var _p = ele._private; + var rs = _p.rscratch; + var isEdge = ele.isEdge(); + var prefixDash = prefix ? prefix + '-' : ''; + var rot = ele.pstyle(prefixDash + 'text-rotation'); + var rotStr = rot.strValue; + + if (rotStr === 'none') { + return 0; + } else if (isEdge && rotStr === 'autorotate') { + return rs.labelAutoAngle; + } else if (rotStr === 'autorotate') { + return 0; + } else { + return rot.pfValue; + } +}; + +BRp$9.calculateLabelAngles = function (ele) { + var r = this; + var isEdge = ele.isEdge(); + var _p = ele._private; + var rs = _p.rscratch; + rs.labelAngle = r.calculateLabelAngle(ele); + + if (isEdge) { + rs.sourceLabelAngle = r.calculateLabelAngle(ele, 'source'); + rs.targetLabelAngle = r.calculateLabelAngle(ele, 'target'); + } +}; + +var BRp$8 = {}; +var TOO_SMALL_CUT_RECT = 28; +var warnedCutRect = false; + +BRp$8.getNodeShape = function (node) { + var r = this; + var shape = node.pstyle('shape').value; + + if (shape === 'cutrectangle' && (node.width() < TOO_SMALL_CUT_RECT || node.height() < TOO_SMALL_CUT_RECT)) { + if (!warnedCutRect) { + warn('The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead'); + warnedCutRect = true; + } + + return 'rectangle'; + } + + if (node.isParent()) { + if (shape === 'rectangle' || shape === 'roundrectangle' || shape === 'round-rectangle' || shape === 'cutrectangle' || shape === 'cut-rectangle' || shape === 'barrel') { + return shape; + } else { + return 'rectangle'; + } + } + + if (shape === 'polygon') { + var points = node.pstyle('shape-polygon-points').value; + return r.nodeShapes.makePolygon(points).name; + } + + return shape; +}; + +var BRp$7 = {}; + +BRp$7.registerCalculationListeners = function () { + var cy = this.cy; + var elesToUpdate = cy.collection(); + var r = this; + + var enqueue = function enqueue(eles) { + var dirtyStyleCaches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + elesToUpdate.merge(eles); + + if (dirtyStyleCaches) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _p = ele._private; + var rstyle = _p.rstyle; + rstyle.clean = false; + rstyle.cleanConnected = false; + } + } + }; + + r.binder(cy).on('bounds.* dirty.*', function onDirtyBounds(e) { + var ele = e.target; + enqueue(ele); + }).on('style.* background.*', function onDirtyStyle(e) { + var ele = e.target; + enqueue(ele, false); + }); + + var updateEleCalcs = function updateEleCalcs(willDraw) { + if (willDraw) { + var fns = r.onUpdateEleCalcsFns; // because we need to have up-to-date style (e.g. stylesheet mappers) + // before calculating rendered style (and pstyle might not be called yet) + + elesToUpdate.cleanStyle(); + + for (var i = 0; i < elesToUpdate.length; i++) { + var ele = elesToUpdate[i]; + var rstyle = ele._private.rstyle; + + if (ele.isNode() && !rstyle.cleanConnected) { + enqueue(ele.connectedEdges()); + rstyle.cleanConnected = true; + } + } + + if (fns) { + for (var _i = 0; _i < fns.length; _i++) { + var fn = fns[_i]; + fn(willDraw, elesToUpdate); + } + } + + r.recalculateRenderedStyle(elesToUpdate); + elesToUpdate = cy.collection(); + } + }; + + r.flushRenderedStyleQueue = function () { + updateEleCalcs(true); + }; + + r.beforeRender(updateEleCalcs, r.beforeRenderPriorities.eleCalcs); +}; + +BRp$7.onUpdateEleCalcs = function (fn) { + var fns = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || []; + fns.push(fn); +}; + +BRp$7.recalculateRenderedStyle = function (eles, useCache) { + var isCleanConnected = function isCleanConnected(ele) { + return ele._private.rstyle.cleanConnected; + }; + + var edges = []; + var nodes = []; // the renderer can't be used for calcs when destroyed, e.g. ele.boundingBox() + + if (this.destroyed) { + return; + } // use cache by default for perf + + + if (useCache === undefined) { + useCache = true; + } + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _p = ele._private; + var rstyle = _p.rstyle; // an edge may be implicitly dirty b/c of one of its connected nodes + // (and a request for recalc may come in between frames) + + if (ele.isEdge() && (!isCleanConnected(ele.source()) || !isCleanConnected(ele.target()))) { + rstyle.clean = false; + } // only update if dirty and in graph + + + if (useCache && rstyle.clean || ele.removed()) { + continue; + } // only update if not display: none + + + if (ele.pstyle('display').value === 'none') { + continue; + } + + if (_p.group === 'nodes') { + nodes.push(ele); + } else { + // edges + edges.push(ele); + } + + rstyle.clean = true; + } // update node data from projections + + + for (var _i2 = 0; _i2 < nodes.length; _i2++) { + var _ele = nodes[_i2]; + var _p2 = _ele._private; + var _rstyle = _p2.rstyle; + + var pos = _ele.position(); + + this.recalculateNodeLabelProjection(_ele); + _rstyle.nodeX = pos.x; + _rstyle.nodeY = pos.y; + _rstyle.nodeW = _ele.pstyle('width').pfValue; + _rstyle.nodeH = _ele.pstyle('height').pfValue; + } + + this.recalculateEdgeProjections(edges); // update edge data from projections + + for (var _i3 = 0; _i3 < edges.length; _i3++) { + var _ele2 = edges[_i3]; + var _p3 = _ele2._private; + var _rstyle2 = _p3.rstyle; + var rs = _p3.rscratch; // update rstyle positions + + _rstyle2.srcX = rs.arrowStartX; + _rstyle2.srcY = rs.arrowStartY; + _rstyle2.tgtX = rs.arrowEndX; + _rstyle2.tgtY = rs.arrowEndY; + _rstyle2.midX = rs.midX; + _rstyle2.midY = rs.midY; + _rstyle2.labelAngle = rs.labelAngle; + _rstyle2.sourceLabelAngle = rs.sourceLabelAngle; + _rstyle2.targetLabelAngle = rs.targetLabelAngle; + } +}; + +var BRp$6 = {}; + +BRp$6.updateCachedGrabbedEles = function () { + var eles = this.cachedZSortedEles; + + if (!eles) { + // just let this be recalculated on the next z sort tick + return; + } + + eles.drag = []; + eles.nondrag = []; + var grabTargets = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var rs = ele._private.rscratch; + + if (ele.grabbed() && !ele.isParent()) { + grabTargets.push(ele); + } else if (rs.inDragLayer) { + eles.drag.push(ele); + } else { + eles.nondrag.push(ele); + } + } // put the grab target nodes last so it's on top of its neighbourhood + + + for (var i = 0; i < grabTargets.length; i++) { + var ele = grabTargets[i]; + eles.drag.push(ele); + } +}; + +BRp$6.invalidateCachedZSortedEles = function () { + this.cachedZSortedEles = null; +}; + +BRp$6.getCachedZSortedEles = function (forceRecalc) { + if (forceRecalc || !this.cachedZSortedEles) { + var eles = this.cy.mutableElements().toArray(); + eles.sort(zIndexSort); + eles.interactive = eles.filter(function (ele) { + return ele.interactive(); + }); + this.cachedZSortedEles = eles; + this.updateCachedGrabbedEles(); + } else { + eles = this.cachedZSortedEles; + } + + return eles; +}; + +var BRp$5 = {}; +[BRp$e, BRp$d, BRp$c, BRp$b, BRp$a, BRp$9, BRp$8, BRp$7, BRp$6].forEach(function (props) { + extend(BRp$5, props); +}); + +var BRp$4 = {}; + +BRp$4.getCachedImage = function (url, crossOrigin, onLoad) { + var r = this; + var imageCache = r.imageCache = r.imageCache || {}; + var cache = imageCache[url]; + + if (cache) { + if (!cache.image.complete) { + cache.image.addEventListener('load', onLoad); + } + + return cache.image; + } else { + cache = imageCache[url] = imageCache[url] || {}; + var image = cache.image = new Image(); // eslint-disable-line no-undef + + image.addEventListener('load', onLoad); + image.addEventListener('error', function () { + image.error = true; + }); // #1582 safari doesn't load data uris with crossOrigin properly + // https://bugs.webkit.org/show_bug.cgi?id=123978 + + var dataUriPrefix = 'data:'; + var isDataUri = url.substring(0, dataUriPrefix.length).toLowerCase() === dataUriPrefix; + + if (!isDataUri) { + image.crossOrigin = crossOrigin; // prevent tainted canvas + } + + image.src = url; + return image; + } +}; + +var BRp$3 = {}; +/* global document, window, ResizeObserver, MutationObserver */ + +BRp$3.registerBinding = function (target, event, handler, useCapture) { + // eslint-disable-line no-unused-vars + var args = Array.prototype.slice.apply(arguments, [1]); // copy + + var b = this.binder(target); + return b.on.apply(b, args); +}; + +BRp$3.binder = function (tgt) { + var r = this; + var tgtIsDom = tgt === window || tgt === document || tgt === document.body || domElement(tgt); + + if (r.supportsPassiveEvents == null) { + // from https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection + var supportsPassive = false; + + try { + var opts = Object.defineProperty({}, 'passive', { + get: function get() { + supportsPassive = true; + return true; + } + }); + window.addEventListener('test', null, opts); + } catch (err) {// not supported + } + + r.supportsPassiveEvents = supportsPassive; + } + + var on = function on(event, handler, useCapture) { + var args = Array.prototype.slice.call(arguments); + + if (tgtIsDom && r.supportsPassiveEvents) { + // replace useCapture w/ opts obj + args[2] = { + capture: useCapture != null ? useCapture : false, + passive: false, + once: false + }; + } + + r.bindings.push({ + target: tgt, + args: args + }); + (tgt.addEventListener || tgt.on).apply(tgt, args); + return this; + }; + + return { + on: on, + addEventListener: on, + addListener: on, + bind: on + }; +}; + +BRp$3.nodeIsDraggable = function (node) { + return node && node.isNode() && !node.locked() && node.grabbable(); +}; + +BRp$3.nodeIsGrabbable = function (node) { + return this.nodeIsDraggable(node) && node.interactive(); +}; + +BRp$3.load = function () { + var r = this; + + var isSelected = function isSelected(ele) { + return ele.selected(); + }; + + var triggerEvents = function triggerEvents(target, names, e, position) { + if (target == null) { + target = r.cy; + } + + for (var i = 0; i < names.length; i++) { + var name = names[i]; + target.emit({ + originalEvent: e, + type: name, + position: position + }); + } + }; + + var isMultSelKeyDown = function isMultSelKeyDown(e) { + return e.shiftKey || e.metaKey || e.ctrlKey; // maybe e.altKey + }; + + var allowPanningPassthrough = function allowPanningPassthrough(down, downs) { + var allowPassthrough = true; + + if (r.cy.hasCompoundNodes() && down && down.pannable()) { + // a grabbable compound node below the ele => no passthrough panning + for (var i = 0; downs && i < downs.length; i++) { + var down = downs[i]; //if any parent node in event hierarchy isn't pannable, reject passthrough + + if (down.isNode() && down.isParent() && !down.pannable()) { + allowPassthrough = false; + break; + } + } + } else { + allowPassthrough = true; + } + + return allowPassthrough; + }; + + var setGrabbed = function setGrabbed(ele) { + ele[0]._private.grabbed = true; + }; + + var setFreed = function setFreed(ele) { + ele[0]._private.grabbed = false; + }; + + var setInDragLayer = function setInDragLayer(ele) { + ele[0]._private.rscratch.inDragLayer = true; + }; + + var setOutDragLayer = function setOutDragLayer(ele) { + ele[0]._private.rscratch.inDragLayer = false; + }; + + var setGrabTarget = function setGrabTarget(ele) { + ele[0]._private.rscratch.isGrabTarget = true; + }; + + var removeGrabTarget = function removeGrabTarget(ele) { + ele[0]._private.rscratch.isGrabTarget = false; + }; + + var addToDragList = function addToDragList(ele, opts) { + var list = opts.addToList; + var listHasEle = list.has(ele); + + if (!listHasEle && ele.grabbable() && !ele.locked()) { + list.merge(ele); + setGrabbed(ele); + } + }; // helper function to determine which child nodes and inner edges + // of a compound node to be dragged as well as the grabbed and selected nodes + + + var addDescendantsToDrag = function addDescendantsToDrag(node, opts) { + if (!node.cy().hasCompoundNodes()) { + return; + } + + if (opts.inDragLayer == null && opts.addToList == null) { + return; + } // nothing to do + + + var innerNodes = node.descendants(); + + if (opts.inDragLayer) { + innerNodes.forEach(setInDragLayer); + innerNodes.connectedEdges().forEach(setInDragLayer); + } + + if (opts.addToList) { + addToDragList(innerNodes, opts); + } + }; // adds the given nodes and its neighbourhood to the drag layer + + + var addNodesToDrag = function addNodesToDrag(nodes, opts) { + opts = opts || {}; + var hasCompoundNodes = nodes.cy().hasCompoundNodes(); + + if (opts.inDragLayer) { + nodes.forEach(setInDragLayer); + nodes.neighborhood().stdFilter(function (ele) { + return !hasCompoundNodes || ele.isEdge(); + }).forEach(setInDragLayer); + } + + if (opts.addToList) { + nodes.forEach(function (ele) { + addToDragList(ele, opts); + }); + } + + addDescendantsToDrag(nodes, opts); // always add to drag + // also add nodes and edges related to the topmost ancestor + + updateAncestorsInDragLayer(nodes, { + inDragLayer: opts.inDragLayer + }); + r.updateCachedGrabbedEles(); + }; + + var addNodeToDrag = addNodesToDrag; + + var freeDraggedElements = function freeDraggedElements(grabbedEles) { + if (!grabbedEles) { + return; + } // just go over all elements rather than doing a bunch of (possibly expensive) traversals + + + r.getCachedZSortedEles().forEach(function (ele) { + setFreed(ele); + setOutDragLayer(ele); + removeGrabTarget(ele); + }); + r.updateCachedGrabbedEles(); + }; // helper function to determine which ancestor nodes and edges should go + // to the drag layer (or should be removed from drag layer). + + + var updateAncestorsInDragLayer = function updateAncestorsInDragLayer(node, opts) { + if (opts.inDragLayer == null && opts.addToList == null) { + return; + } // nothing to do + + + if (!node.cy().hasCompoundNodes()) { + return; + } // find top-level parent + + + var parent = node.ancestors().orphans(); // no parent node: no nodes to add to the drag layer + + if (parent.same(node)) { + return; + } + + var nodes = parent.descendants().spawnSelf().merge(parent).unmerge(node).unmerge(node.descendants()); + var edges = nodes.connectedEdges(); + + if (opts.inDragLayer) { + edges.forEach(setInDragLayer); + nodes.forEach(setInDragLayer); + } + + if (opts.addToList) { + nodes.forEach(function (ele) { + addToDragList(ele, opts); + }); + } + }; + + var blurActiveDomElement = function blurActiveDomElement() { + if (document.activeElement != null && document.activeElement.blur != null) { + document.activeElement.blur(); + } + }; + + var haveMutationsApi = typeof MutationObserver !== 'undefined'; + var haveResizeObserverApi = typeof ResizeObserver !== 'undefined'; // watch for when the cy container is removed from the dom + + if (haveMutationsApi) { + r.removeObserver = new MutationObserver(function (mutns) { + // eslint-disable-line no-undef + for (var i = 0; i < mutns.length; i++) { + var mutn = mutns[i]; + var rNodes = mutn.removedNodes; + + if (rNodes) { + for (var j = 0; j < rNodes.length; j++) { + var rNode = rNodes[j]; + + if (rNode === r.container) { + r.destroy(); + break; + } + } + } + } + }); + + if (r.container.parentNode) { + r.removeObserver.observe(r.container.parentNode, { + childList: true + }); + } + } else { + r.registerBinding(r.container, 'DOMNodeRemoved', function (e) { + // eslint-disable-line no-unused-vars + r.destroy(); + }); + } + + var onResize = debounce__default["default"](function () { + r.cy.resize(); + }, 100); + + if (haveMutationsApi) { + r.styleObserver = new MutationObserver(onResize); // eslint-disable-line no-undef + + r.styleObserver.observe(r.container, { + attributes: true + }); + } // auto resize + + + r.registerBinding(window, 'resize', onResize); // eslint-disable-line no-undef + + if (haveResizeObserverApi) { + r.resizeObserver = new ResizeObserver(onResize); // eslint-disable-line no-undef + + r.resizeObserver.observe(r.container); + } + + var forEachUp = function forEachUp(domEle, fn) { + while (domEle != null) { + fn(domEle); + domEle = domEle.parentNode; + } + }; + + var invalidateCoords = function invalidateCoords() { + r.invalidateContainerClientCoordsCache(); + }; + + forEachUp(r.container, function (domEle) { + r.registerBinding(domEle, 'transitionend', invalidateCoords); + r.registerBinding(domEle, 'animationend', invalidateCoords); + r.registerBinding(domEle, 'scroll', invalidateCoords); + }); // stop right click menu from appearing on cy + + r.registerBinding(r.container, 'contextmenu', function (e) { + e.preventDefault(); + }); + + var inBoxSelection = function inBoxSelection() { + return r.selection[4] !== 0; + }; + + var eventInContainer = function eventInContainer(e) { + // save cycles if mouse events aren't to be captured + var containerPageCoords = r.findContainerClientCoords(); + var x = containerPageCoords[0]; + var y = containerPageCoords[1]; + var width = containerPageCoords[2]; + var height = containerPageCoords[3]; + var positions = e.touches ? e.touches : [e]; + var atLeastOnePosInside = false; + + for (var i = 0; i < positions.length; i++) { + var p = positions[i]; + + if (x <= p.clientX && p.clientX <= x + width && y <= p.clientY && p.clientY <= y + height) { + atLeastOnePosInside = true; + break; + } + } + + if (!atLeastOnePosInside) { + return false; + } + + var container = r.container; + var target = e.target; + var tParent = target.parentNode; + var containerIsTarget = false; + + while (tParent) { + if (tParent === container) { + containerIsTarget = true; + break; + } + + tParent = tParent.parentNode; + } + + if (!containerIsTarget) { + return false; + } // if target is outisde cy container, then this event is not for us + + + return true; + }; // Primary key + + + r.registerBinding(r.container, 'mousedown', function mousedownHandler(e) { + if (!eventInContainer(e)) { + return; + } + + e.preventDefault(); + blurActiveDomElement(); + r.hoverData.capture = true; + r.hoverData.which = e.which; + var cy = r.cy; + var gpos = [e.clientX, e.clientY]; + var pos = r.projectIntoViewport(gpos[0], gpos[1]); + var select = r.selection; + var nears = r.findNearestElements(pos[0], pos[1], true, false); + var near = nears[0]; + var draggedElements = r.dragData.possibleDragElements; + r.hoverData.mdownPos = pos; + r.hoverData.mdownGPos = gpos; + + var checkForTaphold = function checkForTaphold() { + r.hoverData.tapholdCancelled = false; + clearTimeout(r.hoverData.tapholdTimeout); + r.hoverData.tapholdTimeout = setTimeout(function () { + if (r.hoverData.tapholdCancelled) { + return; + } else { + var ele = r.hoverData.down; + + if (ele) { + ele.emit({ + originalEvent: e, + type: 'taphold', + position: { + x: pos[0], + y: pos[1] + } + }); + } else { + cy.emit({ + originalEvent: e, + type: 'taphold', + position: { + x: pos[0], + y: pos[1] + } + }); + } + } + }, r.tapholdDuration); + }; // Right click button + + + if (e.which == 3) { + r.hoverData.cxtStarted = true; + var cxtEvt = { + originalEvent: e, + type: 'cxttapstart', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (near) { + near.activate(); + near.emit(cxtEvt); + r.hoverData.down = near; + } else { + cy.emit(cxtEvt); + } + + r.hoverData.downTime = new Date().getTime(); + r.hoverData.cxtDragged = false; // Primary button + } else if (e.which == 1) { + if (near) { + near.activate(); + } // Element dragging + + + { + // If something is under the cursor and it is draggable, prepare to grab it + if (near != null) { + if (r.nodeIsGrabbable(near)) { + var makeEvent = function makeEvent(type) { + return { + originalEvent: e, + type: type, + position: { + x: pos[0], + y: pos[1] + } + }; + }; + + var triggerGrab = function triggerGrab(ele) { + ele.emit(makeEvent('grab')); + }; + + setGrabTarget(near); + + if (!near.selected()) { + draggedElements = r.dragData.possibleDragElements = cy.collection(); + addNodeToDrag(near, { + addToList: draggedElements + }); + near.emit(makeEvent('grabon')).emit(makeEvent('grab')); + } else { + draggedElements = r.dragData.possibleDragElements = cy.collection(); + var selectedNodes = cy.$(function (ele) { + return ele.isNode() && ele.selected() && r.nodeIsGrabbable(ele); + }); + addNodesToDrag(selectedNodes, { + addToList: draggedElements + }); + near.emit(makeEvent('grabon')); + selectedNodes.forEach(triggerGrab); + } + + r.redrawHint('eles', true); + r.redrawHint('drag', true); + } + } + + r.hoverData.down = near; + r.hoverData.downs = nears; + r.hoverData.downTime = new Date().getTime(); + } + triggerEvents(near, ['mousedown', 'tapstart', 'vmousedown'], e, { + x: pos[0], + y: pos[1] + }); + + if (near == null) { + select[4] = 1; + r.data.bgActivePosistion = { + x: pos[0], + y: pos[1] + }; + r.redrawHint('select', true); + r.redraw(); + } else if (near.pannable()) { + select[4] = 1; // for future pan + } + + checkForTaphold(); + } // Initialize selection box coordinates + + + select[0] = select[2] = pos[0]; + select[1] = select[3] = pos[1]; + }, false); + r.registerBinding(window, 'mousemove', function mousemoveHandler(e) { + // eslint-disable-line no-undef + var capture = r.hoverData.capture; + + if (!capture && !eventInContainer(e)) { + return; + } + + var preventDefault = false; + var cy = r.cy; + var zoom = cy.zoom(); + var gpos = [e.clientX, e.clientY]; + var pos = r.projectIntoViewport(gpos[0], gpos[1]); + var mdownPos = r.hoverData.mdownPos; + var mdownGPos = r.hoverData.mdownGPos; + var select = r.selection; + var near = null; + + if (!r.hoverData.draggingEles && !r.hoverData.dragging && !r.hoverData.selecting) { + near = r.findNearestElement(pos[0], pos[1], true, false); + } + + var last = r.hoverData.last; + var down = r.hoverData.down; + var disp = [pos[0] - select[2], pos[1] - select[3]]; + var draggedElements = r.dragData.possibleDragElements; + var isOverThresholdDrag; + + if (mdownGPos) { + var dx = gpos[0] - mdownGPos[0]; + var dx2 = dx * dx; + var dy = gpos[1] - mdownGPos[1]; + var dy2 = dy * dy; + var dist2 = dx2 + dy2; + r.hoverData.isOverThresholdDrag = isOverThresholdDrag = dist2 >= r.desktopTapThreshold2; + } + + var multSelKeyDown = isMultSelKeyDown(e); + + if (isOverThresholdDrag) { + r.hoverData.tapholdCancelled = true; + } + + var updateDragDelta = function updateDragDelta() { + var dragDelta = r.hoverData.dragDelta = r.hoverData.dragDelta || []; + + if (dragDelta.length === 0) { + dragDelta.push(disp[0]); + dragDelta.push(disp[1]); + } else { + dragDelta[0] += disp[0]; + dragDelta[1] += disp[1]; + } + }; + + preventDefault = true; + triggerEvents(near, ['mousemove', 'vmousemove', 'tapdrag'], e, { + x: pos[0], + y: pos[1] + }); + + var goIntoBoxMode = function goIntoBoxMode() { + r.data.bgActivePosistion = undefined; + + if (!r.hoverData.selecting) { + cy.emit({ + originalEvent: e, + type: 'boxstart', + position: { + x: pos[0], + y: pos[1] + } + }); + } + + select[4] = 1; + r.hoverData.selecting = true; + r.redrawHint('select', true); + r.redraw(); + }; // trigger context drag if rmouse down + + + if (r.hoverData.which === 3) { + // but only if over threshold + if (isOverThresholdDrag) { + var cxtEvt = { + originalEvent: e, + type: 'cxtdrag', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (down) { + down.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + + r.hoverData.cxtDragged = true; + + if (!r.hoverData.cxtOver || near !== r.hoverData.cxtOver) { + if (r.hoverData.cxtOver) { + r.hoverData.cxtOver.emit({ + originalEvent: e, + type: 'cxtdragout', + position: { + x: pos[0], + y: pos[1] + } + }); + } + + r.hoverData.cxtOver = near; + + if (near) { + near.emit({ + originalEvent: e, + type: 'cxtdragover', + position: { + x: pos[0], + y: pos[1] + } + }); + } + } + } // Check if we are drag panning the entire graph + + } else if (r.hoverData.dragging) { + preventDefault = true; + + if (cy.panningEnabled() && cy.userPanningEnabled()) { + var deltaP; + + if (r.hoverData.justStartedPan) { + var mdPos = r.hoverData.mdownPos; + deltaP = { + x: (pos[0] - mdPos[0]) * zoom, + y: (pos[1] - mdPos[1]) * zoom + }; + r.hoverData.justStartedPan = false; + } else { + deltaP = { + x: disp[0] * zoom, + y: disp[1] * zoom + }; + } + + cy.panBy(deltaP); + cy.emit('dragpan'); + r.hoverData.dragged = true; + } // Needs reproject due to pan changing viewport + + + pos = r.projectIntoViewport(e.clientX, e.clientY); // Checks primary button down & out of time & mouse not moved much + } else if (select[4] == 1 && (down == null || down.pannable())) { + if (isOverThresholdDrag) { + if (!r.hoverData.dragging && cy.boxSelectionEnabled() && (multSelKeyDown || !cy.panningEnabled() || !cy.userPanningEnabled())) { + goIntoBoxMode(); + } else if (!r.hoverData.selecting && cy.panningEnabled() && cy.userPanningEnabled()) { + var allowPassthrough = allowPanningPassthrough(down, r.hoverData.downs); + + if (allowPassthrough) { + r.hoverData.dragging = true; + r.hoverData.justStartedPan = true; + select[4] = 0; + r.data.bgActivePosistion = array2point(mdownPos); + r.redrawHint('select', true); + r.redraw(); + } + } + + if (down && down.pannable() && down.active()) { + down.unactivate(); + } + } + } else { + if (down && down.pannable() && down.active()) { + down.unactivate(); + } + + if ((!down || !down.grabbed()) && near != last) { + if (last) { + triggerEvents(last, ['mouseout', 'tapdragout'], e, { + x: pos[0], + y: pos[1] + }); + } + + if (near) { + triggerEvents(near, ['mouseover', 'tapdragover'], e, { + x: pos[0], + y: pos[1] + }); + } + + r.hoverData.last = near; + } + + if (down) { + if (isOverThresholdDrag) { + // then we can take action + if (cy.boxSelectionEnabled() && multSelKeyDown) { + // then selection overrides + if (down && down.grabbed()) { + freeDraggedElements(draggedElements); + down.emit('freeon'); + draggedElements.emit('free'); + + if (r.dragData.didDrag) { + down.emit('dragfreeon'); + draggedElements.emit('dragfree'); + } + } + + goIntoBoxMode(); + } else if (down && down.grabbed() && r.nodeIsDraggable(down)) { + // drag node + var justStartedDrag = !r.dragData.didDrag; + + if (justStartedDrag) { + r.redrawHint('eles', true); + } + + r.dragData.didDrag = true; // indicate that we actually did drag the node + // now, add the elements to the drag layer if not done already + + if (!r.hoverData.draggingEles) { + addNodesToDrag(draggedElements, { + inDragLayer: true + }); + } + + var totalShift = { + x: 0, + y: 0 + }; + + if (number$1(disp[0]) && number$1(disp[1])) { + totalShift.x += disp[0]; + totalShift.y += disp[1]; + + if (justStartedDrag) { + var dragDelta = r.hoverData.dragDelta; + + if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) { + totalShift.x += dragDelta[0]; + totalShift.y += dragDelta[1]; + } + } + } + + r.hoverData.draggingEles = true; + draggedElements.silentShift(totalShift).emit('position drag'); + r.redrawHint('drag', true); + r.redraw(); + } + } else { + // otherwise save drag delta for when we actually start dragging so the relative grab pos is constant + updateDragDelta(); + } + } // prevent the dragging from triggering text selection on the page + + + preventDefault = true; + } + + select[2] = pos[0]; + select[3] = pos[1]; + + if (preventDefault) { + if (e.stopPropagation) e.stopPropagation(); + if (e.preventDefault) e.preventDefault(); + return false; + } + }, false); + var clickTimeout, didDoubleClick, prevClickTimeStamp; + r.registerBinding(window, 'mouseup', function mouseupHandler(e) { + // eslint-disable-line no-undef + var capture = r.hoverData.capture; + + if (!capture) { + return; + } + + r.hoverData.capture = false; + var cy = r.cy; + var pos = r.projectIntoViewport(e.clientX, e.clientY); + var select = r.selection; + var near = r.findNearestElement(pos[0], pos[1], true, false); + var draggedElements = r.dragData.possibleDragElements; + var down = r.hoverData.down; + var multSelKeyDown = isMultSelKeyDown(e); + + if (r.data.bgActivePosistion) { + r.redrawHint('select', true); + r.redraw(); + } + + r.hoverData.tapholdCancelled = true; + r.data.bgActivePosistion = undefined; // not active bg now + + if (down) { + down.unactivate(); + } + + if (r.hoverData.which === 3) { + var cxtEvt = { + originalEvent: e, + type: 'cxttapend', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (down) { + down.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + + if (!r.hoverData.cxtDragged) { + var cxtTap = { + originalEvent: e, + type: 'cxttap', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (down) { + down.emit(cxtTap); + } else { + cy.emit(cxtTap); + } + } + + r.hoverData.cxtDragged = false; + r.hoverData.which = null; + } else if (r.hoverData.which === 1) { + triggerEvents(near, ['mouseup', 'tapend', 'vmouseup'], e, { + x: pos[0], + y: pos[1] + }); + + if (!r.dragData.didDrag && // didn't move a node around + !r.hoverData.dragged && // didn't pan + !r.hoverData.selecting && // not box selection + !r.hoverData.isOverThresholdDrag // didn't move too much + ) { + triggerEvents(down, ["click", "tap", "vclick"], e, { + x: pos[0], + y: pos[1] + }); + didDoubleClick = false; + + if (e.timeStamp - prevClickTimeStamp <= cy.multiClickDebounceTime()) { + clickTimeout && clearTimeout(clickTimeout); + didDoubleClick = true; + prevClickTimeStamp = null; + triggerEvents(down, ["dblclick", "dbltap", "vdblclick"], e, { + x: pos[0], + y: pos[1] + }); + } else { + clickTimeout = setTimeout(function () { + if (didDoubleClick) return; + triggerEvents(down, ["oneclick", "onetap", "voneclick"], e, { + x: pos[0], + y: pos[1] + }); + }, cy.multiClickDebounceTime()); + prevClickTimeStamp = e.timeStamp; + } + } // Deselect all elements if nothing is currently under the mouse cursor and we aren't dragging something + + + if (down == null // not mousedown on node + && !r.dragData.didDrag // didn't move the node around + && !r.hoverData.selecting // not box selection + && !r.hoverData.dragged // didn't pan + && !isMultSelKeyDown(e)) { + cy.$(isSelected).unselect(['tapunselect']); + + if (draggedElements.length > 0) { + r.redrawHint('eles', true); + } + + r.dragData.possibleDragElements = draggedElements = cy.collection(); + } // Single selection + + + if (near == down && !r.dragData.didDrag && !r.hoverData.selecting) { + if (near != null && near._private.selectable) { + if (r.hoverData.dragging) ; else if (cy.selectionType() === 'additive' || multSelKeyDown) { + if (near.selected()) { + near.unselect(['tapunselect']); + } else { + near.select(['tapselect']); + } + } else { + if (!multSelKeyDown) { + cy.$(isSelected).unmerge(near).unselect(['tapunselect']); + near.select(['tapselect']); + } + } + + r.redrawHint('eles', true); + } + } + + if (r.hoverData.selecting) { + var box = cy.collection(r.getAllInBox(select[0], select[1], select[2], select[3])); + r.redrawHint('select', true); + + if (box.length > 0) { + r.redrawHint('eles', true); + } + + cy.emit({ + type: 'boxend', + originalEvent: e, + position: { + x: pos[0], + y: pos[1] + } + }); + + var eleWouldBeSelected = function eleWouldBeSelected(ele) { + return ele.selectable() && !ele.selected(); + }; + + if (cy.selectionType() === 'additive') { + box.emit('box').stdFilter(eleWouldBeSelected).select().emit('boxselect'); + } else { + if (!multSelKeyDown) { + cy.$(isSelected).unmerge(box).unselect(); + } + + box.emit('box').stdFilter(eleWouldBeSelected).select().emit('boxselect'); + } // always need redraw in case eles unselectable + + + r.redraw(); + } // Cancel drag pan + + + if (r.hoverData.dragging) { + r.hoverData.dragging = false; + r.redrawHint('select', true); + r.redrawHint('eles', true); + r.redraw(); + } + + if (!select[4]) { + r.redrawHint('drag', true); + r.redrawHint('eles', true); + var downWasGrabbed = down && down.grabbed(); + freeDraggedElements(draggedElements); + + if (downWasGrabbed) { + down.emit('freeon'); + draggedElements.emit('free'); + + if (r.dragData.didDrag) { + down.emit('dragfreeon'); + draggedElements.emit('dragfree'); + } + } + } + } // else not right mouse + + + select[4] = 0; + r.hoverData.down = null; + r.hoverData.cxtStarted = false; + r.hoverData.draggingEles = false; + r.hoverData.selecting = false; + r.hoverData.isOverThresholdDrag = false; + r.dragData.didDrag = false; + r.hoverData.dragged = false; + r.hoverData.dragDelta = []; + r.hoverData.mdownPos = null; + r.hoverData.mdownGPos = null; + }, false); + + var wheelHandler = function wheelHandler(e) { + if (r.scrollingPage) { + return; + } // while scrolling, ignore wheel-to-zoom + + + var cy = r.cy; + var zoom = cy.zoom(); + var pan = cy.pan(); + var pos = r.projectIntoViewport(e.clientX, e.clientY); + var rpos = [pos[0] * zoom + pan.x, pos[1] * zoom + pan.y]; + + if (r.hoverData.draggingEles || r.hoverData.dragging || r.hoverData.cxtStarted || inBoxSelection()) { + // if pan dragging or cxt dragging, wheel movements make no zoom + e.preventDefault(); + return; + } + + if (cy.panningEnabled() && cy.userPanningEnabled() && cy.zoomingEnabled() && cy.userZoomingEnabled()) { + e.preventDefault(); + r.data.wheelZooming = true; + clearTimeout(r.data.wheelTimeout); + r.data.wheelTimeout = setTimeout(function () { + r.data.wheelZooming = false; + r.redrawHint('eles', true); + r.redraw(); + }, 150); + var diff; + + if (e.deltaY != null) { + diff = e.deltaY / -250; + } else if (e.wheelDeltaY != null) { + diff = e.wheelDeltaY / 1000; + } else { + diff = e.wheelDelta / 1000; + } + + diff = diff * r.wheelSensitivity; + var needsWheelFix = e.deltaMode === 1; + + if (needsWheelFix) { + // fixes slow wheel events on ff/linux and ff/windows + diff *= 33; + } + + var newZoom = cy.zoom() * Math.pow(10, diff); + + if (e.type === 'gesturechange') { + newZoom = r.gestureStartZoom * e.scale; + } + + cy.zoom({ + level: newZoom, + renderedPosition: { + x: rpos[0], + y: rpos[1] + } + }); + cy.emit(e.type === 'gesturechange' ? 'pinchzoom' : 'scrollzoom'); + } + }; // Functions to help with whether mouse wheel should trigger zooming + // -- + + + r.registerBinding(r.container, 'wheel', wheelHandler, true); // disable nonstandard wheel events + // r.registerBinding(r.container, 'mousewheel', wheelHandler, true); + // r.registerBinding(r.container, 'DOMMouseScroll', wheelHandler, true); + // r.registerBinding(r.container, 'MozMousePixelScroll', wheelHandler, true); // older firefox + + r.registerBinding(window, 'scroll', function scrollHandler(e) { + // eslint-disable-line no-unused-vars + r.scrollingPage = true; + clearTimeout(r.scrollingPageTimeout); + r.scrollingPageTimeout = setTimeout(function () { + r.scrollingPage = false; + }, 250); + }, true); // desktop safari pinch to zoom start + + r.registerBinding(r.container, 'gesturestart', function gestureStartHandler(e) { + r.gestureStartZoom = r.cy.zoom(); + + if (!r.hasTouchStarted) { + // don't affect touch devices like iphone + e.preventDefault(); + } + }, true); + r.registerBinding(r.container, 'gesturechange', function (e) { + if (!r.hasTouchStarted) { + // don't affect touch devices like iphone + wheelHandler(e); + } + }, true); // Functions to help with handling mouseout/mouseover on the Cytoscape container + // Handle mouseout on Cytoscape container + + r.registerBinding(r.container, 'mouseout', function mouseOutHandler(e) { + var pos = r.projectIntoViewport(e.clientX, e.clientY); + r.cy.emit({ + originalEvent: e, + type: 'mouseout', + position: { + x: pos[0], + y: pos[1] + } + }); + }, false); + r.registerBinding(r.container, 'mouseover', function mouseOverHandler(e) { + var pos = r.projectIntoViewport(e.clientX, e.clientY); + r.cy.emit({ + originalEvent: e, + type: 'mouseover', + position: { + x: pos[0], + y: pos[1] + } + }); + }, false); + var f1x1, f1y1, f2x1, f2y1; // starting points for pinch-to-zoom + + var distance1, distance1Sq; // initial distance between finger 1 and finger 2 for pinch-to-zoom + + var center1, modelCenter1; // center point on start pinch to zoom + + var offsetLeft, offsetTop; + var containerWidth, containerHeight; + var twoFingersStartInside; + + var distance = function distance(x1, y1, x2, y2) { + return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); + }; + + var distanceSq = function distanceSq(x1, y1, x2, y2) { + return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); + }; + + var touchstartHandler; + r.registerBinding(r.container, 'touchstart', touchstartHandler = function touchstartHandler(e) { + r.hasTouchStarted = true; + + if (!eventInContainer(e)) { + return; + } + + blurActiveDomElement(); + r.touchData.capture = true; + r.data.bgActivePosistion = undefined; + var cy = r.cy; + var now = r.touchData.now; + var earlier = r.touchData.earlier; + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } // record starting points for pinch-to-zoom + + + if (e.touches[1]) { + r.touchData.singleTouchMoved = true; + freeDraggedElements(r.dragData.touchDragEles); + var offsets = r.findContainerClientCoords(); + offsetLeft = offsets[0]; + offsetTop = offsets[1]; + containerWidth = offsets[2]; + containerHeight = offsets[3]; + f1x1 = e.touches[0].clientX - offsetLeft; + f1y1 = e.touches[0].clientY - offsetTop; + f2x1 = e.touches[1].clientX - offsetLeft; + f2y1 = e.touches[1].clientY - offsetTop; + twoFingersStartInside = 0 <= f1x1 && f1x1 <= containerWidth && 0 <= f2x1 && f2x1 <= containerWidth && 0 <= f1y1 && f1y1 <= containerHeight && 0 <= f2y1 && f2y1 <= containerHeight; + var pan = cy.pan(); + var zoom = cy.zoom(); + distance1 = distance(f1x1, f1y1, f2x1, f2y1); + distance1Sq = distanceSq(f1x1, f1y1, f2x1, f2y1); + center1 = [(f1x1 + f2x1) / 2, (f1y1 + f2y1) / 2]; + modelCenter1 = [(center1[0] - pan.x) / zoom, (center1[1] - pan.y) / zoom]; // consider context tap + + var cxtDistThreshold = 200; + var cxtDistThresholdSq = cxtDistThreshold * cxtDistThreshold; + + if (distance1Sq < cxtDistThresholdSq && !e.touches[2]) { + var near1 = r.findNearestElement(now[0], now[1], true, true); + var near2 = r.findNearestElement(now[2], now[3], true, true); + + if (near1 && near1.isNode()) { + near1.activate().emit({ + originalEvent: e, + type: 'cxttapstart', + position: { + x: now[0], + y: now[1] + } + }); + r.touchData.start = near1; + } else if (near2 && near2.isNode()) { + near2.activate().emit({ + originalEvent: e, + type: 'cxttapstart', + position: { + x: now[0], + y: now[1] + } + }); + r.touchData.start = near2; + } else { + cy.emit({ + originalEvent: e, + type: 'cxttapstart', + position: { + x: now[0], + y: now[1] + } + }); + } + + if (r.touchData.start) { + r.touchData.start._private.grabbed = false; + } + + r.touchData.cxt = true; + r.touchData.cxtDragged = false; + r.data.bgActivePosistion = undefined; + r.redraw(); + return; + } + } + + if (e.touches[2]) { + // ignore + // safari on ios pans the page otherwise (normally you should be able to preventdefault on touchmove...) + if (cy.boxSelectionEnabled()) { + e.preventDefault(); + } + } else if (e.touches[1]) ; else if (e.touches[0]) { + var nears = r.findNearestElements(now[0], now[1], true, true); + var near = nears[0]; + + if (near != null) { + near.activate(); + r.touchData.start = near; + r.touchData.starts = nears; + + if (r.nodeIsGrabbable(near)) { + var draggedEles = r.dragData.touchDragEles = cy.collection(); + var selectedNodes = null; + r.redrawHint('eles', true); + r.redrawHint('drag', true); + + if (near.selected()) { + // reset drag elements, since near will be added again + selectedNodes = cy.$(function (ele) { + return ele.selected() && r.nodeIsGrabbable(ele); + }); + addNodesToDrag(selectedNodes, { + addToList: draggedEles + }); + } else { + addNodeToDrag(near, { + addToList: draggedEles + }); + } + + setGrabTarget(near); + + var makeEvent = function makeEvent(type) { + return { + originalEvent: e, + type: type, + position: { + x: now[0], + y: now[1] + } + }; + }; + + near.emit(makeEvent('grabon')); + + if (selectedNodes) { + selectedNodes.forEach(function (n) { + n.emit(makeEvent('grab')); + }); + } else { + near.emit(makeEvent('grab')); + } + } + } + + triggerEvents(near, ['touchstart', 'tapstart', 'vmousedown'], e, { + x: now[0], + y: now[1] + }); + + if (near == null) { + r.data.bgActivePosistion = { + x: pos[0], + y: pos[1] + }; + r.redrawHint('select', true); + r.redraw(); + } // Tap, taphold + // ----- + + + r.touchData.singleTouchMoved = false; + r.touchData.singleTouchStartTime = +new Date(); + clearTimeout(r.touchData.tapholdTimeout); + r.touchData.tapholdTimeout = setTimeout(function () { + if (r.touchData.singleTouchMoved === false && !r.pinching // if pinching, then taphold unselect shouldn't take effect + && !r.touchData.selecting // box selection shouldn't allow taphold through + ) { + triggerEvents(r.touchData.start, ['taphold'], e, { + x: now[0], + y: now[1] + }); + } + }, r.tapholdDuration); + } + + if (e.touches.length >= 1) { + var sPos = r.touchData.startPosition = []; + + for (var i = 0; i < now.length; i++) { + sPos[i] = earlier[i] = now[i]; + } + + var touch0 = e.touches[0]; + r.touchData.startGPosition = [touch0.clientX, touch0.clientY]; + } + }, false); + var touchmoveHandler; + r.registerBinding(window, 'touchmove', touchmoveHandler = function touchmoveHandler(e) { + // eslint-disable-line no-undef + var capture = r.touchData.capture; + + if (!capture && !eventInContainer(e)) { + return; + } + + var select = r.selection; + var cy = r.cy; + var now = r.touchData.now; + var earlier = r.touchData.earlier; + var zoom = cy.zoom(); + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } + + var startGPos = r.touchData.startGPosition; + var isOverThresholdDrag; + + if (capture && e.touches[0] && startGPos) { + var disp = []; + + for (var j = 0; j < now.length; j++) { + disp[j] = now[j] - earlier[j]; + } + + var dx = e.touches[0].clientX - startGPos[0]; + var dx2 = dx * dx; + var dy = e.touches[0].clientY - startGPos[1]; + var dy2 = dy * dy; + var dist2 = dx2 + dy2; + isOverThresholdDrag = dist2 >= r.touchTapThreshold2; + } // context swipe cancelling + + + if (capture && r.touchData.cxt) { + e.preventDefault(); + var f1x2 = e.touches[0].clientX - offsetLeft, + f1y2 = e.touches[0].clientY - offsetTop; + var f2x2 = e.touches[1].clientX - offsetLeft, + f2y2 = e.touches[1].clientY - offsetTop; // var distance2 = distance( f1x2, f1y2, f2x2, f2y2 ); + + var distance2Sq = distanceSq(f1x2, f1y2, f2x2, f2y2); + var factorSq = distance2Sq / distance1Sq; + var distThreshold = 150; + var distThresholdSq = distThreshold * distThreshold; + var factorThreshold = 1.5; + var factorThresholdSq = factorThreshold * factorThreshold; // cancel ctx gestures if the distance b/t the fingers increases + + if (factorSq >= factorThresholdSq || distance2Sq >= distThresholdSq) { + r.touchData.cxt = false; + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + var cxtEvt = { + originalEvent: e, + type: 'cxttapend', + position: { + x: now[0], + y: now[1] + } + }; + + if (r.touchData.start) { + r.touchData.start.unactivate().emit(cxtEvt); + r.touchData.start = null; + } else { + cy.emit(cxtEvt); + } + } + } // context swipe + + + if (capture && r.touchData.cxt) { + var cxtEvt = { + originalEvent: e, + type: 'cxtdrag', + position: { + x: now[0], + y: now[1] + } + }; + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + + if (r.touchData.start) { + r.touchData.start.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + + if (r.touchData.start) { + r.touchData.start._private.grabbed = false; + } + + r.touchData.cxtDragged = true; + var near = r.findNearestElement(now[0], now[1], true, true); + + if (!r.touchData.cxtOver || near !== r.touchData.cxtOver) { + if (r.touchData.cxtOver) { + r.touchData.cxtOver.emit({ + originalEvent: e, + type: 'cxtdragout', + position: { + x: now[0], + y: now[1] + } + }); + } + + r.touchData.cxtOver = near; + + if (near) { + near.emit({ + originalEvent: e, + type: 'cxtdragover', + position: { + x: now[0], + y: now[1] + } + }); + } + } // box selection + + } else if (capture && e.touches[2] && cy.boxSelectionEnabled()) { + e.preventDefault(); + r.data.bgActivePosistion = undefined; + this.lastThreeTouch = +new Date(); + + if (!r.touchData.selecting) { + cy.emit({ + originalEvent: e, + type: 'boxstart', + position: { + x: now[0], + y: now[1] + } + }); + } + + r.touchData.selecting = true; + r.touchData.didSelect = true; + select[4] = 1; + + if (!select || select.length === 0 || select[0] === undefined) { + select[0] = (now[0] + now[2] + now[4]) / 3; + select[1] = (now[1] + now[3] + now[5]) / 3; + select[2] = (now[0] + now[2] + now[4]) / 3 + 1; + select[3] = (now[1] + now[3] + now[5]) / 3 + 1; + } else { + select[2] = (now[0] + now[2] + now[4]) / 3; + select[3] = (now[1] + now[3] + now[5]) / 3; + } + + r.redrawHint('select', true); + r.redraw(); // pinch to zoom + } else if (capture && e.touches[1] && !r.touchData.didSelect // don't allow box selection to degrade to pinch-to-zoom + && cy.zoomingEnabled() && cy.panningEnabled() && cy.userZoomingEnabled() && cy.userPanningEnabled()) { + // two fingers => pinch to zoom + e.preventDefault(); + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + var draggedEles = r.dragData.touchDragEles; + + if (draggedEles) { + r.redrawHint('drag', true); + + for (var i = 0; i < draggedEles.length; i++) { + var de_p = draggedEles[i]._private; + de_p.grabbed = false; + de_p.rscratch.inDragLayer = false; + } + } + + var _start = r.touchData.start; // (x2, y2) for fingers 1 and 2 + + var f1x2 = e.touches[0].clientX - offsetLeft, + f1y2 = e.touches[0].clientY - offsetTop; + var f2x2 = e.touches[1].clientX - offsetLeft, + f2y2 = e.touches[1].clientY - offsetTop; + var distance2 = distance(f1x2, f1y2, f2x2, f2y2); // var distance2Sq = distanceSq( f1x2, f1y2, f2x2, f2y2 ); + // var factor = Math.sqrt( distance2Sq ) / Math.sqrt( distance1Sq ); + + var factor = distance2 / distance1; + + if (twoFingersStartInside) { + // delta finger1 + var df1x = f1x2 - f1x1; + var df1y = f1y2 - f1y1; // delta finger 2 + + var df2x = f2x2 - f2x1; + var df2y = f2y2 - f2y1; // translation is the normalised vector of the two fingers movement + // i.e. so pinching cancels out and moving together pans + + var tx = (df1x + df2x) / 2; + var ty = (df1y + df2y) / 2; // now calculate the zoom + + var zoom1 = cy.zoom(); + var zoom2 = zoom1 * factor; + var pan1 = cy.pan(); // the model center point converted to the current rendered pos + + var ctrx = modelCenter1[0] * zoom1 + pan1.x; + var ctry = modelCenter1[1] * zoom1 + pan1.y; + var pan2 = { + x: -zoom2 / zoom1 * (ctrx - pan1.x - tx) + ctrx, + y: -zoom2 / zoom1 * (ctry - pan1.y - ty) + ctry + }; // remove dragged eles + + if (_start && _start.active()) { + var draggedEles = r.dragData.touchDragEles; + freeDraggedElements(draggedEles); + r.redrawHint('drag', true); + r.redrawHint('eles', true); + + _start.unactivate().emit('freeon'); + + draggedEles.emit('free'); + + if (r.dragData.didDrag) { + _start.emit('dragfreeon'); + + draggedEles.emit('dragfree'); + } + } + + cy.viewport({ + zoom: zoom2, + pan: pan2, + cancelOnFailedZoom: true + }); + cy.emit('pinchzoom'); + distance1 = distance2; + f1x1 = f1x2; + f1y1 = f1y2; + f2x1 = f2x2; + f2y1 = f2y2; + r.pinching = true; + } // Re-project + + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } + } else if (e.touches[0] && !r.touchData.didSelect // don't allow box selection to degrade to single finger events like panning + ) { + var start = r.touchData.start; + var last = r.touchData.last; + var near; + + if (!r.hoverData.draggingEles && !r.swipePanning) { + near = r.findNearestElement(now[0], now[1], true, true); + } + + if (capture && start != null) { + e.preventDefault(); + } // dragging nodes + + + if (capture && start != null && r.nodeIsDraggable(start)) { + if (isOverThresholdDrag) { + // then dragging can happen + var draggedEles = r.dragData.touchDragEles; + var justStartedDrag = !r.dragData.didDrag; + + if (justStartedDrag) { + addNodesToDrag(draggedEles, { + inDragLayer: true + }); + } + + r.dragData.didDrag = true; + var totalShift = { + x: 0, + y: 0 + }; + + if (number$1(disp[0]) && number$1(disp[1])) { + totalShift.x += disp[0]; + totalShift.y += disp[1]; + + if (justStartedDrag) { + r.redrawHint('eles', true); + var dragDelta = r.touchData.dragDelta; + + if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) { + totalShift.x += dragDelta[0]; + totalShift.y += dragDelta[1]; + } + } + } + + r.hoverData.draggingEles = true; + draggedEles.silentShift(totalShift).emit('position drag'); + r.redrawHint('drag', true); + + if (r.touchData.startPosition[0] == earlier[0] && r.touchData.startPosition[1] == earlier[1]) { + r.redrawHint('eles', true); + } + + r.redraw(); + } else { + // otherise keep track of drag delta for later + var dragDelta = r.touchData.dragDelta = r.touchData.dragDelta || []; + + if (dragDelta.length === 0) { + dragDelta.push(disp[0]); + dragDelta.push(disp[1]); + } else { + dragDelta[0] += disp[0]; + dragDelta[1] += disp[1]; + } + } + } // touchmove + + + { + triggerEvents(start || near, ['touchmove', 'tapdrag', 'vmousemove'], e, { + x: now[0], + y: now[1] + }); + + if ((!start || !start.grabbed()) && near != last) { + if (last) { + last.emit({ + originalEvent: e, + type: 'tapdragout', + position: { + x: now[0], + y: now[1] + } + }); + } + + if (near) { + near.emit({ + originalEvent: e, + type: 'tapdragover', + position: { + x: now[0], + y: now[1] + } + }); + } + } + + r.touchData.last = near; + } // check to cancel taphold + + if (capture) { + for (var i = 0; i < now.length; i++) { + if (now[i] && r.touchData.startPosition[i] && isOverThresholdDrag) { + r.touchData.singleTouchMoved = true; + } + } + } // panning + + + if (capture && (start == null || start.pannable()) && cy.panningEnabled() && cy.userPanningEnabled()) { + var allowPassthrough = allowPanningPassthrough(start, r.touchData.starts); + + if (allowPassthrough) { + e.preventDefault(); + + if (!r.data.bgActivePosistion) { + r.data.bgActivePosistion = array2point(r.touchData.startPosition); + } + + if (r.swipePanning) { + cy.panBy({ + x: disp[0] * zoom, + y: disp[1] * zoom + }); + cy.emit('dragpan'); + } else if (isOverThresholdDrag) { + r.swipePanning = true; + cy.panBy({ + x: dx * zoom, + y: dy * zoom + }); + cy.emit('dragpan'); + + if (start) { + start.unactivate(); + r.redrawHint('select', true); + r.touchData.start = null; + } + } + } // Re-project + + + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + } + + for (var j = 0; j < now.length; j++) { + earlier[j] = now[j]; + } // the active bg indicator should be removed when making a swipe that is neither for dragging nodes or panning + + + if (capture && e.touches.length > 0 && !r.hoverData.draggingEles && !r.swipePanning && r.data.bgActivePosistion != null) { + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + r.redraw(); + } + }, false); + var touchcancelHandler; + r.registerBinding(window, 'touchcancel', touchcancelHandler = function touchcancelHandler(e) { + // eslint-disable-line no-unused-vars + var start = r.touchData.start; + r.touchData.capture = false; + + if (start) { + start.unactivate(); + } + }); + var touchendHandler, didDoubleTouch, touchTimeout, prevTouchTimeStamp; + r.registerBinding(window, 'touchend', touchendHandler = function touchendHandler(e) { + // eslint-disable-line no-unused-vars + var start = r.touchData.start; + var capture = r.touchData.capture; + + if (capture) { + if (e.touches.length === 0) { + r.touchData.capture = false; + } + + e.preventDefault(); + } else { + return; + } + + var select = r.selection; + r.swipePanning = false; + r.hoverData.draggingEles = false; + var cy = r.cy; + var zoom = cy.zoom(); + var now = r.touchData.now; + var earlier = r.touchData.earlier; + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } + + if (start) { + start.unactivate(); + } + + var ctxTapend; + + if (r.touchData.cxt) { + ctxTapend = { + originalEvent: e, + type: 'cxttapend', + position: { + x: now[0], + y: now[1] + } + }; + + if (start) { + start.emit(ctxTapend); + } else { + cy.emit(ctxTapend); + } + + if (!r.touchData.cxtDragged) { + var ctxTap = { + originalEvent: e, + type: 'cxttap', + position: { + x: now[0], + y: now[1] + } + }; + + if (start) { + start.emit(ctxTap); + } else { + cy.emit(ctxTap); + } + } + + if (r.touchData.start) { + r.touchData.start._private.grabbed = false; + } + + r.touchData.cxt = false; + r.touchData.start = null; + r.redraw(); + return; + } // no more box selection if we don't have three fingers + + + if (!e.touches[2] && cy.boxSelectionEnabled() && r.touchData.selecting) { + r.touchData.selecting = false; + var box = cy.collection(r.getAllInBox(select[0], select[1], select[2], select[3])); + select[0] = undefined; + select[1] = undefined; + select[2] = undefined; + select[3] = undefined; + select[4] = 0; + r.redrawHint('select', true); + cy.emit({ + type: 'boxend', + originalEvent: e, + position: { + x: now[0], + y: now[1] + } + }); + + var eleWouldBeSelected = function eleWouldBeSelected(ele) { + return ele.selectable() && !ele.selected(); + }; + + box.emit('box').stdFilter(eleWouldBeSelected).select().emit('boxselect'); + + if (box.nonempty()) { + r.redrawHint('eles', true); + } + + r.redraw(); + } + + if (start != null) { + start.unactivate(); + } + + if (e.touches[2]) { + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + } else if (e.touches[1]) ; else if (e.touches[0]) ; else if (!e.touches[0]) { + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + var draggedEles = r.dragData.touchDragEles; + + if (start != null) { + var startWasGrabbed = start._private.grabbed; + freeDraggedElements(draggedEles); + r.redrawHint('drag', true); + r.redrawHint('eles', true); + + if (startWasGrabbed) { + start.emit('freeon'); + draggedEles.emit('free'); + + if (r.dragData.didDrag) { + start.emit('dragfreeon'); + draggedEles.emit('dragfree'); + } + } + + triggerEvents(start, ['touchend', 'tapend', 'vmouseup', 'tapdragout'], e, { + x: now[0], + y: now[1] + }); + start.unactivate(); + r.touchData.start = null; + } else { + var near = r.findNearestElement(now[0], now[1], true, true); + triggerEvents(near, ['touchend', 'tapend', 'vmouseup', 'tapdragout'], e, { + x: now[0], + y: now[1] + }); + } + + var dx = r.touchData.startPosition[0] - now[0]; + var dx2 = dx * dx; + var dy = r.touchData.startPosition[1] - now[1]; + var dy2 = dy * dy; + var dist2 = dx2 + dy2; + var rdist2 = dist2 * zoom * zoom; // Tap event, roughly same as mouse click event for touch + + if (!r.touchData.singleTouchMoved) { + if (!start) { + cy.$(':selected').unselect(['tapunselect']); + } + + triggerEvents(start, ['tap', 'vclick'], e, { + x: now[0], + y: now[1] + }); + didDoubleTouch = false; + + if (e.timeStamp - prevTouchTimeStamp <= cy.multiClickDebounceTime()) { + touchTimeout && clearTimeout(touchTimeout); + didDoubleTouch = true; + prevTouchTimeStamp = null; + triggerEvents(start, ['dbltap', 'vdblclick'], e, { + x: now[0], + y: now[1] + }); + } else { + touchTimeout = setTimeout(function () { + if (didDoubleTouch) return; + triggerEvents(start, ['onetap', 'voneclick'], e, { + x: now[0], + y: now[1] + }); + }, cy.multiClickDebounceTime()); + prevTouchTimeStamp = e.timeStamp; + } + } // Prepare to select the currently touched node, only if it hasn't been dragged past a certain distance + + + if (start != null && !r.dragData.didDrag // didn't drag nodes around + && start._private.selectable && rdist2 < r.touchTapThreshold2 && !r.pinching // pinch to zoom should not affect selection + ) { + if (cy.selectionType() === 'single') { + cy.$(isSelected).unmerge(start).unselect(['tapunselect']); + start.select(['tapselect']); + } else { + if (start.selected()) { + start.unselect(['tapunselect']); + } else { + start.select(['tapselect']); + } + } + + r.redrawHint('eles', true); + } + + r.touchData.singleTouchMoved = true; + } + + for (var j = 0; j < now.length; j++) { + earlier[j] = now[j]; + } + + r.dragData.didDrag = false; // reset for next touchstart + + if (e.touches.length === 0) { + r.touchData.dragDelta = []; + r.touchData.startPosition = null; + r.touchData.startGPosition = null; + r.touchData.didSelect = false; + } + + if (e.touches.length < 2) { + if (e.touches.length === 1) { + // the old start global pos'n may not be the same finger that remains + r.touchData.startGPosition = [e.touches[0].clientX, e.touches[0].clientY]; + } + + r.pinching = false; + r.redrawHint('eles', true); + r.redraw(); + } //r.redraw(); + + }, false); // fallback compatibility layer for ms pointer events + + if (typeof TouchEvent === 'undefined') { + var pointers = []; + + var makeTouch = function makeTouch(e) { + return { + clientX: e.clientX, + clientY: e.clientY, + force: 1, + identifier: e.pointerId, + pageX: e.pageX, + pageY: e.pageY, + radiusX: e.width / 2, + radiusY: e.height / 2, + screenX: e.screenX, + screenY: e.screenY, + target: e.target + }; + }; + + var makePointer = function makePointer(e) { + return { + event: e, + touch: makeTouch(e) + }; + }; + + var addPointer = function addPointer(e) { + pointers.push(makePointer(e)); + }; + + var removePointer = function removePointer(e) { + for (var i = 0; i < pointers.length; i++) { + var p = pointers[i]; + + if (p.event.pointerId === e.pointerId) { + pointers.splice(i, 1); + return; + } + } + }; + + var updatePointer = function updatePointer(e) { + var p = pointers.filter(function (p) { + return p.event.pointerId === e.pointerId; + })[0]; + p.event = e; + p.touch = makeTouch(e); + }; + + var addTouchesToEvent = function addTouchesToEvent(e) { + e.touches = pointers.map(function (p) { + return p.touch; + }); + }; + + var pointerIsMouse = function pointerIsMouse(e) { + return e.pointerType === 'mouse' || e.pointerType === 4; + }; + + r.registerBinding(r.container, 'pointerdown', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + e.preventDefault(); + addPointer(e); + addTouchesToEvent(e); + touchstartHandler(e); + }); + r.registerBinding(r.container, 'pointerup', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + removePointer(e); + addTouchesToEvent(e); + touchendHandler(e); + }); + r.registerBinding(r.container, 'pointercancel', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + removePointer(e); + addTouchesToEvent(e); + touchcancelHandler(e); + }); + r.registerBinding(r.container, 'pointermove', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + e.preventDefault(); + updatePointer(e); + addTouchesToEvent(e); + touchmoveHandler(e); + }); + } +}; + +var BRp$2 = {}; + +BRp$2.generatePolygon = function (name, points) { + return this.nodeShapes[name] = { + renderer: this, + name: name, + points: points, + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl('polygon', context, centerX, centerY, width, height, this.points); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return polygonIntersectLine(x, y, this.points, nodeX, nodeY, width / 2, height / 2, padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + return pointInsidePolygon(x, y, this.points, centerX, centerY, width, height, [0, -1], padding); + } + }; +}; + +BRp$2.generateEllipse = function () { + return this.nodeShapes['ellipse'] = { + renderer: this, + name: 'ellipse', + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return intersectLineEllipse(x, y, nodeX, nodeY, width / 2 + padding, height / 2 + padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + return checkInEllipse(x, y, width, height, centerX, centerY, padding); + } + }; +}; + +BRp$2.generateRoundPolygon = function (name, points) { + // Pre-compute control points + // Since these points depend on the radius length (which in turns depend on the width/height of the node) we will only pre-compute + // the unit vectors. + // For simplicity the layout will be: + // [ p0, UnitVectorP0P1, p1, UniVectorP1P2, ..., pn, UnitVectorPnP0 ] + var allPoints = new Array(points.length * 2); + + for (var i = 0; i < points.length / 2; i++) { + var sourceIndex = i * 2; + var destIndex = void 0; + + if (i < points.length / 2 - 1) { + destIndex = (i + 1) * 2; + } else { + destIndex = 0; + } + + allPoints[i * 4] = points[sourceIndex]; + allPoints[i * 4 + 1] = points[sourceIndex + 1]; + var xDest = points[destIndex] - points[sourceIndex]; + var yDest = points[destIndex + 1] - points[sourceIndex + 1]; + var norm = Math.sqrt(xDest * xDest + yDest * yDest); + allPoints[i * 4 + 2] = xDest / norm; + allPoints[i * 4 + 3] = yDest / norm; + } + + return this.nodeShapes[name] = { + renderer: this, + name: name, + points: allPoints, + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl('round-polygon', context, centerX, centerY, width, height, this.points); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return roundPolygonIntersectLine(x, y, this.points, nodeX, nodeY, width, height); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + return pointInsideRoundPolygon(x, y, this.points, centerX, centerY, width, height); + } + }; +}; + +BRp$2.generateRoundRectangle = function () { + return this.nodeShapes['round-rectangle'] = this.nodeShapes['roundrectangle'] = { + renderer: this, + name: 'round-rectangle', + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return roundRectangleIntersectLine(x, y, nodeX, nodeY, width, height, padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + var cornerRadius = getRoundRectangleRadius(width, height); + var diam = cornerRadius * 2; // Check hBox + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - diam, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - diam, height, [0, -1], padding)) { + return true; + } // Check top left quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX - width / 2 + cornerRadius, centerY - height / 2 + cornerRadius, padding)) { + return true; + } // Check top right quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX + width / 2 - cornerRadius, centerY - height / 2 + cornerRadius, padding)) { + return true; + } // Check bottom right quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX + width / 2 - cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } // Check bottom left quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX - width / 2 + cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } + + return false; + } + }; +}; + +BRp$2.generateCutRectangle = function () { + return this.nodeShapes['cut-rectangle'] = this.nodeShapes['cutrectangle'] = { + renderer: this, + name: 'cut-rectangle', + cornerLength: getCutRectangleCornerLength(), + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + generateCutTrianglePts: function generateCutTrianglePts(width, height, centerX, centerY) { + var cl = this.cornerLength; + var hh = height / 2; + var hw = width / 2; + var xBegin = centerX - hw; + var xEnd = centerX + hw; + var yBegin = centerY - hh; + var yEnd = centerY + hh; // points are in clockwise order, inner (imaginary) triangle pt on [4, 5] + + return { + topLeft: [xBegin, yBegin + cl, xBegin + cl, yBegin, xBegin + cl, yBegin + cl], + topRight: [xEnd - cl, yBegin, xEnd, yBegin + cl, xEnd - cl, yBegin + cl], + bottomRight: [xEnd, yEnd - cl, xEnd - cl, yEnd, xEnd - cl, yEnd - cl], + bottomLeft: [xBegin + cl, yEnd, xBegin, yEnd - cl, xBegin + cl, yEnd - cl] + }; + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + var cPts = this.generateCutTrianglePts(width + 2 * padding, height + 2 * padding, nodeX, nodeY); + var pts = [].concat.apply([], [cPts.topLeft.splice(0, 4), cPts.topRight.splice(0, 4), cPts.bottomRight.splice(0, 4), cPts.bottomLeft.splice(0, 4)]); + return polygonIntersectLine(x, y, pts, nodeX, nodeY); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + // Check hBox + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - 2 * this.cornerLength, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - 2 * this.cornerLength, height, [0, -1], padding)) { + return true; + } + + var cutTrianglePts = this.generateCutTrianglePts(width, height, centerX, centerY); + return pointInsidePolygonPoints(x, y, cutTrianglePts.topLeft) || pointInsidePolygonPoints(x, y, cutTrianglePts.topRight) || pointInsidePolygonPoints(x, y, cutTrianglePts.bottomRight) || pointInsidePolygonPoints(x, y, cutTrianglePts.bottomLeft); + } + }; +}; + +BRp$2.generateBarrel = function () { + return this.nodeShapes['barrel'] = { + renderer: this, + name: 'barrel', + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + // use two fixed t values for the bezier curve approximation + var t0 = 0.15; + var t1 = 0.5; + var t2 = 0.85; + var bPts = this.generateBarrelBezierPts(width + 2 * padding, height + 2 * padding, nodeX, nodeY); + + var approximateBarrelCurvePts = function approximateBarrelCurvePts(pts) { + // approximate curve pts based on the two t values + var m0 = qbezierPtAt({ + x: pts[0], + y: pts[1] + }, { + x: pts[2], + y: pts[3] + }, { + x: pts[4], + y: pts[5] + }, t0); + var m1 = qbezierPtAt({ + x: pts[0], + y: pts[1] + }, { + x: pts[2], + y: pts[3] + }, { + x: pts[4], + y: pts[5] + }, t1); + var m2 = qbezierPtAt({ + x: pts[0], + y: pts[1] + }, { + x: pts[2], + y: pts[3] + }, { + x: pts[4], + y: pts[5] + }, t2); + return [pts[0], pts[1], m0.x, m0.y, m1.x, m1.y, m2.x, m2.y, pts[4], pts[5]]; + }; + + var pts = [].concat(approximateBarrelCurvePts(bPts.topLeft), approximateBarrelCurvePts(bPts.topRight), approximateBarrelCurvePts(bPts.bottomRight), approximateBarrelCurvePts(bPts.bottomLeft)); + return polygonIntersectLine(x, y, pts, nodeX, nodeY); + }, + generateBarrelBezierPts: function generateBarrelBezierPts(width, height, centerX, centerY) { + var hh = height / 2; + var hw = width / 2; + var xBegin = centerX - hw; + var xEnd = centerX + hw; + var yBegin = centerY - hh; + var yEnd = centerY + hh; + var curveConstants = getBarrelCurveConstants(width, height); + var hOffset = curveConstants.heightOffset; + var wOffset = curveConstants.widthOffset; + var ctrlPtXOffset = curveConstants.ctrlPtOffsetPct * width; // points are in clockwise order, inner (imaginary) control pt on [4, 5] + + var pts = { + topLeft: [xBegin, yBegin + hOffset, xBegin + ctrlPtXOffset, yBegin, xBegin + wOffset, yBegin], + topRight: [xEnd - wOffset, yBegin, xEnd - ctrlPtXOffset, yBegin, xEnd, yBegin + hOffset], + bottomRight: [xEnd, yEnd - hOffset, xEnd - ctrlPtXOffset, yEnd, xEnd - wOffset, yEnd], + bottomLeft: [xBegin + wOffset, yEnd, xBegin + ctrlPtXOffset, yEnd, xBegin, yEnd - hOffset] + }; + pts.topLeft.isTop = true; + pts.topRight.isTop = true; + pts.bottomLeft.isBottom = true; + pts.bottomRight.isBottom = true; + return pts; + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + var curveConstants = getBarrelCurveConstants(width, height); + var hOffset = curveConstants.heightOffset; + var wOffset = curveConstants.widthOffset; // Check hBox + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - 2 * hOffset, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - 2 * wOffset, height, [0, -1], padding)) { + return true; + } + + var barrelCurvePts = this.generateBarrelBezierPts(width, height, centerX, centerY); + + var getCurveT = function getCurveT(x, y, curvePts) { + var x0 = curvePts[4]; + var x1 = curvePts[2]; + var x2 = curvePts[0]; + var y0 = curvePts[5]; // var y1 = curvePts[ 3 ]; + + var y2 = curvePts[1]; + var xMin = Math.min(x0, x2); + var xMax = Math.max(x0, x2); + var yMin = Math.min(y0, y2); + var yMax = Math.max(y0, y2); + + if (xMin <= x && x <= xMax && yMin <= y && y <= yMax) { + var coeff = bezierPtsToQuadCoeff(x0, x1, x2); + var roots = solveQuadratic(coeff[0], coeff[1], coeff[2], x); + var validRoots = roots.filter(function (r) { + return 0 <= r && r <= 1; + }); + + if (validRoots.length > 0) { + return validRoots[0]; + } + } + + return null; + }; + + var curveRegions = Object.keys(barrelCurvePts); + + for (var i = 0; i < curveRegions.length; i++) { + var corner = curveRegions[i]; + var cornerPts = barrelCurvePts[corner]; + var t = getCurveT(x, y, cornerPts); + + if (t == null) { + continue; + } + + var y0 = cornerPts[5]; + var y1 = cornerPts[3]; + var y2 = cornerPts[1]; + var bezY = qbezierAt(y0, y1, y2, t); + + if (cornerPts.isTop && bezY <= y) { + return true; + } + + if (cornerPts.isBottom && y <= bezY) { + return true; + } + } + + return false; + } + }; +}; + +BRp$2.generateBottomRoundrectangle = function () { + return this.nodeShapes['bottom-round-rectangle'] = this.nodeShapes['bottomroundrectangle'] = { + renderer: this, + name: 'bottom-round-rectangle', + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + var topStartX = nodeX - (width / 2 + padding); + var topStartY = nodeY - (height / 2 + padding); + var topEndY = topStartY; + var topEndX = nodeX + (width / 2 + padding); + var topIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false); + + if (topIntersections.length > 0) { + return topIntersections; + } + + return roundRectangleIntersectLine(x, y, nodeX, nodeY, width, height, padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + var cornerRadius = getRoundRectangleRadius(width, height); + var diam = 2 * cornerRadius; // Check hBox + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - diam, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - diam, height, [0, -1], padding)) { + return true; + } // check non-rounded top side + + + var outerWidth = width / 2 + 2 * padding; + var outerHeight = height / 2 + 2 * padding; + var points = [centerX - outerWidth, centerY - outerHeight, centerX - outerWidth, centerY, centerX + outerWidth, centerY, centerX + outerWidth, centerY - outerHeight]; + + if (pointInsidePolygonPoints(x, y, points)) { + return true; + } // Check bottom right quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX + width / 2 - cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } // Check bottom left quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX - width / 2 + cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } + + return false; + } + }; +}; + +BRp$2.registerNodeShapes = function () { + var nodeShapes = this.nodeShapes = {}; + var renderer = this; + this.generateEllipse(); + this.generatePolygon('triangle', generateUnitNgonPointsFitToSquare(3, 0)); + this.generateRoundPolygon('round-triangle', generateUnitNgonPointsFitToSquare(3, 0)); + this.generatePolygon('rectangle', generateUnitNgonPointsFitToSquare(4, 0)); + nodeShapes['square'] = nodeShapes['rectangle']; + this.generateRoundRectangle(); + this.generateCutRectangle(); + this.generateBarrel(); + this.generateBottomRoundrectangle(); + { + var diamondPoints = [0, 1, 1, 0, 0, -1, -1, 0]; + this.generatePolygon('diamond', diamondPoints); + this.generateRoundPolygon('round-diamond', diamondPoints); + } + this.generatePolygon('pentagon', generateUnitNgonPointsFitToSquare(5, 0)); + this.generateRoundPolygon('round-pentagon', generateUnitNgonPointsFitToSquare(5, 0)); + this.generatePolygon('hexagon', generateUnitNgonPointsFitToSquare(6, 0)); + this.generateRoundPolygon('round-hexagon', generateUnitNgonPointsFitToSquare(6, 0)); + this.generatePolygon('heptagon', generateUnitNgonPointsFitToSquare(7, 0)); + this.generateRoundPolygon('round-heptagon', generateUnitNgonPointsFitToSquare(7, 0)); + this.generatePolygon('octagon', generateUnitNgonPointsFitToSquare(8, 0)); + this.generateRoundPolygon('round-octagon', generateUnitNgonPointsFitToSquare(8, 0)); + var star5Points = new Array(20); + { + var outerPoints = generateUnitNgonPoints(5, 0); + var innerPoints = generateUnitNgonPoints(5, Math.PI / 5); // Outer radius is 1; inner radius of star is smaller + + var innerRadius = 0.5 * (3 - Math.sqrt(5)); + innerRadius *= 1.57; + + for (var i = 0; i < innerPoints.length / 2; i++) { + innerPoints[i * 2] *= innerRadius; + innerPoints[i * 2 + 1] *= innerRadius; + } + + for (var i = 0; i < 20 / 4; i++) { + star5Points[i * 4] = outerPoints[i * 2]; + star5Points[i * 4 + 1] = outerPoints[i * 2 + 1]; + star5Points[i * 4 + 2] = innerPoints[i * 2]; + star5Points[i * 4 + 3] = innerPoints[i * 2 + 1]; + } + } + star5Points = fitPolygonToSquare(star5Points); + this.generatePolygon('star', star5Points); + this.generatePolygon('vee', [-1, -1, 0, -0.333, 1, -1, 0, 1]); + this.generatePolygon('rhomboid', [-1, -1, 0.333, -1, 1, 1, -0.333, 1]); + this.nodeShapes['concavehexagon'] = this.generatePolygon('concave-hexagon', [-1, -0.95, -0.75, 0, -1, 0.95, 1, 0.95, 0.75, 0, 1, -0.95]); + { + var tagPoints = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1]; + this.generatePolygon('tag', tagPoints); + this.generateRoundPolygon('round-tag', tagPoints); + } + + nodeShapes.makePolygon = function (points) { + // use caching on user-specified polygons so they are as fast as native shapes + var key = points.join('$'); + var name = 'polygon-' + key; + var shape; + + if (shape = this[name]) { + // got cached shape + return shape; + } // create and cache new shape + + + return renderer.generatePolygon(name, points); + }; +}; + +var BRp$1 = {}; + +BRp$1.timeToRender = function () { + return this.redrawTotalTime / this.redrawCount; +}; + +BRp$1.redraw = function (options) { + options = options || staticEmptyObject(); + var r = this; + + if (r.averageRedrawTime === undefined) { + r.averageRedrawTime = 0; + } + + if (r.lastRedrawTime === undefined) { + r.lastRedrawTime = 0; + } + + if (r.lastDrawTime === undefined) { + r.lastDrawTime = 0; + } + + r.requestedFrame = true; + r.renderOptions = options; +}; + +BRp$1.beforeRender = function (fn, priority) { + // the renderer can't add tick callbacks when destroyed + if (this.destroyed) { + return; + } + + if (priority == null) { + error('Priority is not optional for beforeRender'); + } + + var cbs = this.beforeRenderCallbacks; + cbs.push({ + fn: fn, + priority: priority + }); // higher priority callbacks executed first + + cbs.sort(function (a, b) { + return b.priority - a.priority; + }); +}; + +var beforeRenderCallbacks = function beforeRenderCallbacks(r, willDraw, startTime) { + var cbs = r.beforeRenderCallbacks; + + for (var i = 0; i < cbs.length; i++) { + cbs[i].fn(willDraw, startTime); + } +}; + +BRp$1.startRenderLoop = function () { + var r = this; + var cy = r.cy; + + if (r.renderLoopStarted) { + return; + } else { + r.renderLoopStarted = true; + } + + var renderFn = function renderFn(requestTime) { + if (r.destroyed) { + return; + } + + if (cy.batching()) ; else if (r.requestedFrame && !r.skipFrame) { + beforeRenderCallbacks(r, true, requestTime); + var startTime = performanceNow(); + r.render(r.renderOptions); + var endTime = r.lastDrawTime = performanceNow(); + + if (r.averageRedrawTime === undefined) { + r.averageRedrawTime = endTime - startTime; + } + + if (r.redrawCount === undefined) { + r.redrawCount = 0; + } + + r.redrawCount++; + + if (r.redrawTotalTime === undefined) { + r.redrawTotalTime = 0; + } + + var duration = endTime - startTime; + r.redrawTotalTime += duration; + r.lastRedrawTime = duration; // use a weighted average with a bias from the previous average so we don't spike so easily + + r.averageRedrawTime = r.averageRedrawTime / 2 + duration / 2; + r.requestedFrame = false; + } else { + beforeRenderCallbacks(r, false, requestTime); + } + + r.skipFrame = false; + requestAnimationFrame(renderFn); + }; + + requestAnimationFrame(renderFn); +}; + +var BaseRenderer = function BaseRenderer(options) { + this.init(options); +}; + +var BR = BaseRenderer; +var BRp = BR.prototype; +BRp.clientFunctions = ['redrawHint', 'render', 'renderTo', 'matchCanvasSize', 'nodeShapeImpl', 'arrowShapeImpl']; + +BRp.init = function (options) { + var r = this; + r.options = options; + r.cy = options.cy; + var ctr = r.container = options.cy.container(); // prepend a stylesheet in the head such that + + if (window$1) { + var document = window$1.document; + var head = document.head; + var stylesheetId = '__________cytoscape_stylesheet'; + var className = '__________cytoscape_container'; + var stylesheetAlreadyExists = document.getElementById(stylesheetId) != null; + + if (ctr.className.indexOf(className) < 0) { + ctr.className = (ctr.className || '') + ' ' + className; + } + + if (!stylesheetAlreadyExists) { + var stylesheet = document.createElement('style'); + stylesheet.id = stylesheetId; + stylesheet.innerHTML = '.' + className + ' { position: relative; }'; + head.insertBefore(stylesheet, head.children[0]); // first so lowest priority + } + + var computedStyle = window$1.getComputedStyle(ctr); + var position = computedStyle.getPropertyValue('position'); + + if (position === 'static') { + warn('A Cytoscape container has style position:static and so can not use UI extensions properly'); + } + } + + r.selection = [undefined, undefined, undefined, undefined, 0]; // Coordinates for selection box, plus enabled flag + + r.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95]; //--Pointer-related data + + r.hoverData = { + down: null, + last: null, + downTime: null, + triggerMode: null, + dragging: false, + initialPan: [null, null], + capture: false + }; + r.dragData = { + possibleDragElements: [] + }; + r.touchData = { + start: null, + capture: false, + // These 3 fields related to tap, taphold events + startPosition: [null, null, null, null, null, null], + singleTouchStartTime: null, + singleTouchMoved: true, + now: [null, null, null, null, null, null], + earlier: [null, null, null, null, null, null] + }; + r.redraws = 0; + r.showFps = options.showFps; + r.debug = options.debug; + r.hideEdgesOnViewport = options.hideEdgesOnViewport; + r.textureOnViewport = options.textureOnViewport; + r.wheelSensitivity = options.wheelSensitivity; + r.motionBlurEnabled = options.motionBlur; // on by default + + r.forcedPixelRatio = number$1(options.pixelRatio) ? options.pixelRatio : null; + r.motionBlur = options.motionBlur; // for initial kick off + + r.motionBlurOpacity = options.motionBlurOpacity; + r.motionBlurTransparency = 1 - r.motionBlurOpacity; + r.motionBlurPxRatio = 1; + r.mbPxRBlurry = 1; //0.8; + + r.minMbLowQualFrames = 4; + r.fullQualityMb = false; + r.clearedForMotionBlur = []; + r.desktopTapThreshold = options.desktopTapThreshold; + r.desktopTapThreshold2 = options.desktopTapThreshold * options.desktopTapThreshold; + r.touchTapThreshold = options.touchTapThreshold; + r.touchTapThreshold2 = options.touchTapThreshold * options.touchTapThreshold; + r.tapholdDuration = 500; + r.bindings = []; + r.beforeRenderCallbacks = []; + r.beforeRenderPriorities = { + // higher priority execs before lower one + animations: 400, + eleCalcs: 300, + eleTxrDeq: 200, + lyrTxrDeq: 150, + lyrTxrSkip: 100 + }; + r.registerNodeShapes(); + r.registerArrowShapes(); + r.registerCalculationListeners(); +}; + +BRp.notify = function (eventName, eles) { + var r = this; + var cy = r.cy; // the renderer can't be notified after it's destroyed + + if (this.destroyed) { + return; + } + + if (eventName === 'init') { + r.load(); + return; + } + + if (eventName === 'destroy') { + r.destroy(); + return; + } + + if (eventName === 'add' || eventName === 'remove' || eventName === 'move' && cy.hasCompoundNodes() || eventName === 'load' || eventName === 'zorder' || eventName === 'mount') { + r.invalidateCachedZSortedEles(); + } + + if (eventName === 'viewport') { + r.redrawHint('select', true); + } + + if (eventName === 'load' || eventName === 'resize' || eventName === 'mount') { + r.invalidateContainerClientCoordsCache(); + r.matchCanvasSize(r.container); + } + + r.redrawHint('eles', true); + r.redrawHint('drag', true); + this.startRenderLoop(); + this.redraw(); +}; + +BRp.destroy = function () { + var r = this; + r.destroyed = true; + r.cy.stopAnimationLoop(); + + for (var i = 0; i < r.bindings.length; i++) { + var binding = r.bindings[i]; + var b = binding; + var tgt = b.target; + (tgt.off || tgt.removeEventListener).apply(tgt, b.args); + } + + r.bindings = []; + r.beforeRenderCallbacks = []; + r.onUpdateEleCalcsFns = []; + + if (r.removeObserver) { + r.removeObserver.disconnect(); + } + + if (r.styleObserver) { + r.styleObserver.disconnect(); + } + + if (r.resizeObserver) { + r.resizeObserver.disconnect(); + } + + if (r.labelCalcDiv) { + try { + document.body.removeChild(r.labelCalcDiv); // eslint-disable-line no-undef + } catch (e) {// ie10 issue #1014 + } + } +}; + +BRp.isHeadless = function () { + return false; +}; + +[BRp$f, BRp$5, BRp$4, BRp$3, BRp$2, BRp$1].forEach(function (props) { + extend(BRp, props); +}); + +var fullFpsTime = 1000 / 60; // assume 60 frames per second + +var defs = { + setupDequeueing: function setupDequeueing(opts) { + return function setupDequeueingImpl() { + var self = this; + var r = this.renderer; + + if (self.dequeueingSetup) { + return; + } else { + self.dequeueingSetup = true; + } + + var queueRedraw = debounce__default["default"](function () { + r.redrawHint('eles', true); + r.redrawHint('drag', true); + r.redraw(); + }, opts.deqRedrawThreshold); + + var dequeue = function dequeue(willDraw, frameStartTime) { + var startTime = performanceNow(); + var avgRenderTime = r.averageRedrawTime; + var renderTime = r.lastRedrawTime; + var deqd = []; + var extent = r.cy.extent(); + var pixelRatio = r.getPixelRatio(); // if we aren't in a tick that causes a draw, then the rendered style + // queue won't automatically be flushed before dequeueing starts + + if (!willDraw) { + r.flushRenderedStyleQueue(); + } + + while (true) { + // eslint-disable-line no-constant-condition + var now = performanceNow(); + var duration = now - startTime; + var frameDuration = now - frameStartTime; + + if (renderTime < fullFpsTime) { + // if we're rendering faster than the ideal fps, then do dequeueing + // during all of the remaining frame time + var timeAvailable = fullFpsTime - (willDraw ? avgRenderTime : 0); + + if (frameDuration >= opts.deqFastCost * timeAvailable) { + break; + } + } else { + if (willDraw) { + if (duration >= opts.deqCost * renderTime || duration >= opts.deqAvgCost * avgRenderTime) { + break; + } + } else if (frameDuration >= opts.deqNoDrawCost * fullFpsTime) { + break; + } + } + + var thisDeqd = opts.deq(self, pixelRatio, extent); + + if (thisDeqd.length > 0) { + for (var i = 0; i < thisDeqd.length; i++) { + deqd.push(thisDeqd[i]); + } + } else { + break; + } + } // callbacks on dequeue + + + if (deqd.length > 0) { + opts.onDeqd(self, deqd); + + if (!willDraw && opts.shouldRedraw(self, deqd, pixelRatio, extent)) { + queueRedraw(); + } + } + }; + + var priority = opts.priority || noop$1; + r.beforeRender(dequeue, priority(self)); + }; + } +}; + +// Uses keys so elements may share the same cache. + +var ElementTextureCacheLookup = /*#__PURE__*/function () { + function ElementTextureCacheLookup(getKey) { + var doesEleInvalidateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : falsify; + + _classCallCheck(this, ElementTextureCacheLookup); + + this.idsByKey = new Map$1(); + this.keyForId = new Map$1(); + this.cachesByLvl = new Map$1(); + this.lvls = []; + this.getKey = getKey; + this.doesEleInvalidateKey = doesEleInvalidateKey; + } + + _createClass(ElementTextureCacheLookup, [{ + key: "getIdsFor", + value: function getIdsFor(key) { + if (key == null) { + error("Can not get id list for null key"); + } + + var idsByKey = this.idsByKey; + var ids = this.idsByKey.get(key); + + if (!ids) { + ids = new Set$1(); + idsByKey.set(key, ids); + } + + return ids; + } + }, { + key: "addIdForKey", + value: function addIdForKey(key, id) { + if (key != null) { + this.getIdsFor(key).add(id); + } + } + }, { + key: "deleteIdForKey", + value: function deleteIdForKey(key, id) { + if (key != null) { + this.getIdsFor(key)["delete"](id); + } + } + }, { + key: "getNumberOfIdsForKey", + value: function getNumberOfIdsForKey(key) { + if (key == null) { + return 0; + } else { + return this.getIdsFor(key).size; + } + } + }, { + key: "updateKeyMappingFor", + value: function updateKeyMappingFor(ele) { + var id = ele.id(); + var prevKey = this.keyForId.get(id); + var currKey = this.getKey(ele); + this.deleteIdForKey(prevKey, id); + this.addIdForKey(currKey, id); + this.keyForId.set(id, currKey); + } + }, { + key: "deleteKeyMappingFor", + value: function deleteKeyMappingFor(ele) { + var id = ele.id(); + var prevKey = this.keyForId.get(id); + this.deleteIdForKey(prevKey, id); + this.keyForId["delete"](id); + } + }, { + key: "keyHasChangedFor", + value: function keyHasChangedFor(ele) { + var id = ele.id(); + var prevKey = this.keyForId.get(id); + var newKey = this.getKey(ele); + return prevKey !== newKey; + } + }, { + key: "isInvalid", + value: function isInvalid(ele) { + return this.keyHasChangedFor(ele) || this.doesEleInvalidateKey(ele); + } + }, { + key: "getCachesAt", + value: function getCachesAt(lvl) { + var cachesByLvl = this.cachesByLvl, + lvls = this.lvls; + var caches = cachesByLvl.get(lvl); + + if (!caches) { + caches = new Map$1(); + cachesByLvl.set(lvl, caches); + lvls.push(lvl); + } + + return caches; + } + }, { + key: "getCache", + value: function getCache(key, lvl) { + return this.getCachesAt(lvl).get(key); + } + }, { + key: "get", + value: function get(ele, lvl) { + var key = this.getKey(ele); + var cache = this.getCache(key, lvl); // getting for an element may need to add to the id list b/c eles can share keys + + if (cache != null) { + this.updateKeyMappingFor(ele); + } + + return cache; + } + }, { + key: "getForCachedKey", + value: function getForCachedKey(ele, lvl) { + var key = this.keyForId.get(ele.id()); // n.b. use cached key, not newly computed key + + var cache = this.getCache(key, lvl); + return cache; + } + }, { + key: "hasCache", + value: function hasCache(key, lvl) { + return this.getCachesAt(lvl).has(key); + } + }, { + key: "has", + value: function has(ele, lvl) { + var key = this.getKey(ele); + return this.hasCache(key, lvl); + } + }, { + key: "setCache", + value: function setCache(key, lvl, cache) { + cache.key = key; + this.getCachesAt(lvl).set(key, cache); + } + }, { + key: "set", + value: function set(ele, lvl, cache) { + var key = this.getKey(ele); + this.setCache(key, lvl, cache); + this.updateKeyMappingFor(ele); + } + }, { + key: "deleteCache", + value: function deleteCache(key, lvl) { + this.getCachesAt(lvl)["delete"](key); + } + }, { + key: "delete", + value: function _delete(ele, lvl) { + var key = this.getKey(ele); + this.deleteCache(key, lvl); + } + }, { + key: "invalidateKey", + value: function invalidateKey(key) { + var _this = this; + + this.lvls.forEach(function (lvl) { + return _this.deleteCache(key, lvl); + }); + } // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key) + + }, { + key: "invalidate", + value: function invalidate(ele) { + var id = ele.id(); + var key = this.keyForId.get(id); // n.b. use stored key rather than current (potential key) + + this.deleteKeyMappingFor(ele); + var entireKeyInvalidated = this.doesEleInvalidateKey(ele); + + if (entireKeyInvalidated) { + // clear mapping for current key + this.invalidateKey(key); + } + + return entireKeyInvalidated || this.getNumberOfIdsForKey(key) === 0; + } + }]); + + return ElementTextureCacheLookup; +}(); + +var minTxrH = 25; // the size of the texture cache for small height eles (special case) + +var txrStepH = 50; // the min size of the regular cache, and the size it increases with each step up + +var minLvl$1 = -4; // when scaling smaller than that we don't need to re-render + +var maxLvl$1 = 3; // when larger than this scale just render directly (caching is not helpful) + +var maxZoom$1 = 7.99; // beyond this zoom level, layered textures are not used + +var eleTxrSpacing = 8; // spacing between elements on textures to avoid blitting overlaps + +var defTxrWidth = 1024; // default/minimum texture width + +var maxTxrW = 1024; // the maximum width of a texture + +var maxTxrH = 1024; // the maximum height of a texture + +var minUtility = 0.2; // if usage of texture is less than this, it is retired + +var maxFullness = 0.8; // fullness of texture after which queue removal is checked + +var maxFullnessChecks = 10; // dequeued after this many checks + +var deqCost$1 = 0.15; // % of add'l rendering cost allowed for dequeuing ele caches each frame + +var deqAvgCost$1 = 0.1; // % of add'l rendering cost compared to average overall redraw time + +var deqNoDrawCost$1 = 0.9; // % of avg frame time that can be used for dequeueing when not drawing + +var deqFastCost$1 = 0.9; // % of frame time to be used when >60fps + +var deqRedrawThreshold$1 = 100; // time to batch redraws together from dequeueing to allow more dequeueing calcs to happen in the meanwhile + +var maxDeqSize$1 = 1; // number of eles to dequeue and render at higher texture in each batch + +var getTxrReasons = { + dequeue: 'dequeue', + downscale: 'downscale', + highQuality: 'highQuality' +}; +var initDefaults = defaults$g({ + getKey: null, + doesEleInvalidateKey: falsify, + drawElement: null, + getBoundingBox: null, + getRotationPoint: null, + getRotationOffset: null, + isVisible: trueify, + allowEdgeTxrCaching: true, + allowParentTxrCaching: true +}); + +var ElementTextureCache = function ElementTextureCache(renderer, initOptions) { + var self = this; + self.renderer = renderer; + self.onDequeues = []; + var opts = initDefaults(initOptions); + extend(self, opts); + self.lookup = new ElementTextureCacheLookup(opts.getKey, opts.doesEleInvalidateKey); + self.setupDequeueing(); +}; + +var ETCp = ElementTextureCache.prototype; +ETCp.reasons = getTxrReasons; // the list of textures in which new subtextures for elements can be placed + +ETCp.getTextureQueue = function (txrH) { + var self = this; + self.eleImgCaches = self.eleImgCaches || {}; + return self.eleImgCaches[txrH] = self.eleImgCaches[txrH] || []; +}; // the list of usused textures which can be recycled (in use in texture queue) + + +ETCp.getRetiredTextureQueue = function (txrH) { + var self = this; + var rtxtrQs = self.eleImgCaches.retired = self.eleImgCaches.retired || {}; + var rtxtrQ = rtxtrQs[txrH] = rtxtrQs[txrH] || []; + return rtxtrQ; +}; // queue of element draw requests at different scale levels + + +ETCp.getElementQueue = function () { + var self = this; + var q = self.eleCacheQueue = self.eleCacheQueue || new Heap__default["default"](function (a, b) { + return b.reqs - a.reqs; + }); + return q; +}; // queue of element draw requests at different scale levels (element id lookup) + + +ETCp.getElementKeyToQueue = function () { + var self = this; + var k2q = self.eleKeyToCacheQueue = self.eleKeyToCacheQueue || {}; + return k2q; +}; + +ETCp.getElement = function (ele, bb, pxRatio, lvl, reason) { + var self = this; + var r = this.renderer; + var zoom = r.cy.zoom(); + var lookup = this.lookup; + + if (!bb || bb.w === 0 || bb.h === 0 || isNaN(bb.w) || isNaN(bb.h) || !ele.visible() || ele.removed()) { + return null; + } + + if (!self.allowEdgeTxrCaching && ele.isEdge() || !self.allowParentTxrCaching && ele.isParent()) { + return null; + } + + if (lvl == null) { + lvl = Math.ceil(log2(zoom * pxRatio)); + } + + if (lvl < minLvl$1) { + lvl = minLvl$1; + } else if (zoom >= maxZoom$1 || lvl > maxLvl$1) { + return null; + } + + var scale = Math.pow(2, lvl); + var eleScaledH = bb.h * scale; + var eleScaledW = bb.w * scale; + var scaledLabelShown = r.eleTextBiggerThanMin(ele, scale); + + if (!this.isVisible(ele, scaledLabelShown)) { + return null; + } + + var eleCache = lookup.get(ele, lvl); // if this get was on an unused/invalidated cache, then restore the texture usage metric + + if (eleCache && eleCache.invalidated) { + eleCache.invalidated = false; + eleCache.texture.invalidatedWidth -= eleCache.width; + } + + if (eleCache) { + return eleCache; + } + + var txrH; // which texture height this ele belongs to + + if (eleScaledH <= minTxrH) { + txrH = minTxrH; + } else if (eleScaledH <= txrStepH) { + txrH = txrStepH; + } else { + txrH = Math.ceil(eleScaledH / txrStepH) * txrStepH; + } + + if (eleScaledH > maxTxrH || eleScaledW > maxTxrW) { + return null; // caching large elements is not efficient + } + + var txrQ = self.getTextureQueue(txrH); // first try the second last one in case it has space at the end + + var txr = txrQ[txrQ.length - 2]; + + var addNewTxr = function addNewTxr() { + return self.recycleTexture(txrH, eleScaledW) || self.addTexture(txrH, eleScaledW); + }; // try the last one if there is no second last one + + + if (!txr) { + txr = txrQ[txrQ.length - 1]; + } // if the last one doesn't exist, we need a first one + + + if (!txr) { + txr = addNewTxr(); + } // if there's no room in the current texture, we need a new one + + + if (txr.width - txr.usedWidth < eleScaledW) { + txr = addNewTxr(); + } + + var scalableFrom = function scalableFrom(otherCache) { + return otherCache && otherCache.scaledLabelShown === scaledLabelShown; + }; + + var deqing = reason && reason === getTxrReasons.dequeue; + var highQualityReq = reason && reason === getTxrReasons.highQuality; + var downscaleReq = reason && reason === getTxrReasons.downscale; + var higherCache; // the nearest cache with a higher level + + for (var l = lvl + 1; l <= maxLvl$1; l++) { + var c = lookup.get(ele, l); + + if (c) { + higherCache = c; + break; + } + } + + var oneUpCache = higherCache && higherCache.level === lvl + 1 ? higherCache : null; + + var downscale = function downscale() { + txr.context.drawImage(oneUpCache.texture.canvas, oneUpCache.x, 0, oneUpCache.width, oneUpCache.height, txr.usedWidth, 0, eleScaledW, eleScaledH); + }; // reset ele area in texture + + + txr.context.setTransform(1, 0, 0, 1, 0, 0); + txr.context.clearRect(txr.usedWidth, 0, eleScaledW, txrH); + + if (scalableFrom(oneUpCache)) { + // then we can relatively cheaply rescale the existing image w/o rerendering + downscale(); + } else if (scalableFrom(higherCache)) { + // then use the higher cache for now and queue the next level down + // to cheaply scale towards the smaller level + if (highQualityReq) { + for (var _l = higherCache.level; _l > lvl; _l--) { + oneUpCache = self.getElement(ele, bb, pxRatio, _l, getTxrReasons.downscale); + } + + downscale(); + } else { + self.queueElement(ele, higherCache.level - 1); + return higherCache; + } + } else { + var lowerCache; // the nearest cache with a lower level + + if (!deqing && !highQualityReq && !downscaleReq) { + for (var _l2 = lvl - 1; _l2 >= minLvl$1; _l2--) { + var _c = lookup.get(ele, _l2); + + if (_c) { + lowerCache = _c; + break; + } + } + } + + if (scalableFrom(lowerCache)) { + // then use the lower quality cache for now and queue the better one for later + self.queueElement(ele, lvl); + return lowerCache; + } + + txr.context.translate(txr.usedWidth, 0); + txr.context.scale(scale, scale); + this.drawElement(txr.context, ele, bb, scaledLabelShown, false); + txr.context.scale(1 / scale, 1 / scale); + txr.context.translate(-txr.usedWidth, 0); + } + + eleCache = { + x: txr.usedWidth, + texture: txr, + level: lvl, + scale: scale, + width: eleScaledW, + height: eleScaledH, + scaledLabelShown: scaledLabelShown + }; + txr.usedWidth += Math.ceil(eleScaledW + eleTxrSpacing); + txr.eleCaches.push(eleCache); + lookup.set(ele, lvl, eleCache); + self.checkTextureFullness(txr); + return eleCache; +}; + +ETCp.invalidateElements = function (eles) { + for (var i = 0; i < eles.length; i++) { + this.invalidateElement(eles[i]); + } +}; + +ETCp.invalidateElement = function (ele) { + var self = this; + var lookup = self.lookup; + var caches = []; + var invalid = lookup.isInvalid(ele); + + if (!invalid) { + return; // override the invalidation request if the element key has not changed + } + + for (var lvl = minLvl$1; lvl <= maxLvl$1; lvl++) { + var cache = lookup.getForCachedKey(ele, lvl); + + if (cache) { + caches.push(cache); + } + } + + var noOtherElesUseCache = lookup.invalidate(ele); + + if (noOtherElesUseCache) { + for (var i = 0; i < caches.length; i++) { + var _cache = caches[i]; + var txr = _cache.texture; // remove space from the texture it belongs to + + txr.invalidatedWidth += _cache.width; // mark the cache as invalidated + + _cache.invalidated = true; // retire the texture if its utility is low + + self.checkTextureUtility(txr); + } + } // remove from queue since the old req was for the old state + + + self.removeFromQueue(ele); +}; + +ETCp.checkTextureUtility = function (txr) { + // invalidate all entries in the cache if the cache size is small + if (txr.invalidatedWidth >= minUtility * txr.width) { + this.retireTexture(txr); + } +}; + +ETCp.checkTextureFullness = function (txr) { + // if texture has been mostly filled and passed over several times, remove + // it from the queue so we don't need to waste time looking at it to put new things + var self = this; + var txrQ = self.getTextureQueue(txr.height); + + if (txr.usedWidth / txr.width > maxFullness && txr.fullnessChecks >= maxFullnessChecks) { + removeFromArray(txrQ, txr); + } else { + txr.fullnessChecks++; + } +}; + +ETCp.retireTexture = function (txr) { + var self = this; + var txrH = txr.height; + var txrQ = self.getTextureQueue(txrH); + var lookup = this.lookup; // retire the texture from the active / searchable queue: + + removeFromArray(txrQ, txr); + txr.retired = true; // remove the refs from the eles to the caches: + + var eleCaches = txr.eleCaches; + + for (var i = 0; i < eleCaches.length; i++) { + var eleCache = eleCaches[i]; + lookup.deleteCache(eleCache.key, eleCache.level); + } + + clearArray(eleCaches); // add the texture to a retired queue so it can be recycled in future: + + var rtxtrQ = self.getRetiredTextureQueue(txrH); + rtxtrQ.push(txr); +}; + +ETCp.addTexture = function (txrH, minW) { + var self = this; + var txrQ = self.getTextureQueue(txrH); + var txr = {}; + txrQ.push(txr); + txr.eleCaches = []; + txr.height = txrH; + txr.width = Math.max(defTxrWidth, minW); + txr.usedWidth = 0; + txr.invalidatedWidth = 0; + txr.fullnessChecks = 0; + txr.canvas = self.renderer.makeOffscreenCanvas(txr.width, txr.height); + txr.context = txr.canvas.getContext('2d'); + return txr; +}; + +ETCp.recycleTexture = function (txrH, minW) { + var self = this; + var txrQ = self.getTextureQueue(txrH); + var rtxtrQ = self.getRetiredTextureQueue(txrH); + + for (var i = 0; i < rtxtrQ.length; i++) { + var txr = rtxtrQ[i]; + + if (txr.width >= minW) { + txr.retired = false; + txr.usedWidth = 0; + txr.invalidatedWidth = 0; + txr.fullnessChecks = 0; + clearArray(txr.eleCaches); + txr.context.setTransform(1, 0, 0, 1, 0, 0); + txr.context.clearRect(0, 0, txr.width, txr.height); + removeFromArray(rtxtrQ, txr); + txrQ.push(txr); + return txr; + } + } +}; + +ETCp.queueElement = function (ele, lvl) { + var self = this; + var q = self.getElementQueue(); + var k2q = self.getElementKeyToQueue(); + var key = this.getKey(ele); + var existingReq = k2q[key]; + + if (existingReq) { + // use the max lvl b/c in between lvls are cheap to make + existingReq.level = Math.max(existingReq.level, lvl); + existingReq.eles.merge(ele); + existingReq.reqs++; + q.updateItem(existingReq); + } else { + var req = { + eles: ele.spawn().merge(ele), + level: lvl, + reqs: 1, + key: key + }; + q.push(req); + k2q[key] = req; + } +}; + +ETCp.dequeue = function (pxRatio +/*, extent*/ +) { + var self = this; + var q = self.getElementQueue(); + var k2q = self.getElementKeyToQueue(); + var dequeued = []; + var lookup = self.lookup; + + for (var i = 0; i < maxDeqSize$1; i++) { + if (q.size() > 0) { + var req = q.pop(); + var key = req.key; + var ele = req.eles[0]; // all eles have the same key + + var cacheExists = lookup.hasCache(ele, req.level); // clear out the key to req lookup + + k2q[key] = null; // dequeueing isn't necessary with an existing cache + + if (cacheExists) { + continue; + } + + dequeued.push(req); + var bb = self.getBoundingBox(ele); + self.getElement(ele, bb, pxRatio, req.level, getTxrReasons.dequeue); + } else { + break; + } + } + + return dequeued; +}; + +ETCp.removeFromQueue = function (ele) { + var self = this; + var q = self.getElementQueue(); + var k2q = self.getElementKeyToQueue(); + var key = this.getKey(ele); + var req = k2q[key]; + + if (req != null) { + if (req.eles.length === 1) { + // remove if last ele in the req + // bring to front of queue + req.reqs = MAX_INT$1; + q.updateItem(req); + q.pop(); // remove from queue + + k2q[key] = null; // remove from lookup map + } else { + // otherwise just remove ele from req + req.eles.unmerge(ele); + } + } +}; + +ETCp.onDequeue = function (fn) { + this.onDequeues.push(fn); +}; + +ETCp.offDequeue = function (fn) { + removeFromArray(this.onDequeues, fn); +}; + +ETCp.setupDequeueing = defs.setupDequeueing({ + deqRedrawThreshold: deqRedrawThreshold$1, + deqCost: deqCost$1, + deqAvgCost: deqAvgCost$1, + deqNoDrawCost: deqNoDrawCost$1, + deqFastCost: deqFastCost$1, + deq: function deq(self, pxRatio, extent) { + return self.dequeue(pxRatio, extent); + }, + onDeqd: function onDeqd(self, deqd) { + for (var i = 0; i < self.onDequeues.length; i++) { + var fn = self.onDequeues[i]; + fn(deqd); + } + }, + shouldRedraw: function shouldRedraw(self, deqd, pxRatio, extent) { + for (var i = 0; i < deqd.length; i++) { + var eles = deqd[i].eles; + + for (var j = 0; j < eles.length; j++) { + var bb = eles[j].boundingBox(); + + if (boundingBoxesIntersect(bb, extent)) { + return true; + } + } + } + + return false; + }, + priority: function priority(self) { + return self.renderer.beforeRenderPriorities.eleTxrDeq; + } +}); + +var defNumLayers = 1; // default number of layers to use + +var minLvl = -4; // when scaling smaller than that we don't need to re-render + +var maxLvl = 2; // when larger than this scale just render directly (caching is not helpful) + +var maxZoom = 3.99; // beyond this zoom level, layered textures are not used + +var deqRedrawThreshold = 50; // time to batch redraws together from dequeueing to allow more dequeueing calcs to happen in the meanwhile + +var refineEleDebounceTime = 50; // time to debounce sharper ele texture updates + +var deqCost = 0.15; // % of add'l rendering cost allowed for dequeuing ele caches each frame + +var deqAvgCost = 0.1; // % of add'l rendering cost compared to average overall redraw time + +var deqNoDrawCost = 0.9; // % of avg frame time that can be used for dequeueing when not drawing + +var deqFastCost = 0.9; // % of frame time to be used when >60fps + +var maxDeqSize = 1; // number of eles to dequeue and render at higher texture in each batch + +var invalidThreshold = 250; // time threshold for disabling b/c of invalidations + +var maxLayerArea = 4000 * 4000; // layers can't be bigger than this + +var useHighQualityEleTxrReqs = true; // whether to use high quality ele txr requests (generally faster and cheaper in the longterm) +// var log = function(){ console.log.apply( console, arguments ); }; + +var LayeredTextureCache = function LayeredTextureCache(renderer) { + var self = this; + var r = self.renderer = renderer; + var cy = r.cy; + self.layersByLevel = {}; // e.g. 2 => [ layer1, layer2, ..., layerN ] + + self.firstGet = true; + self.lastInvalidationTime = performanceNow() - 2 * invalidThreshold; + self.skipping = false; + self.eleTxrDeqs = cy.collection(); + self.scheduleElementRefinement = debounce__default["default"](function () { + self.refineElementTextures(self.eleTxrDeqs); + self.eleTxrDeqs.unmerge(self.eleTxrDeqs); + }, refineEleDebounceTime); + r.beforeRender(function (willDraw, now) { + if (now - self.lastInvalidationTime <= invalidThreshold) { + self.skipping = true; + } else { + self.skipping = false; + } + }, r.beforeRenderPriorities.lyrTxrSkip); + + var qSort = function qSort(a, b) { + return b.reqs - a.reqs; + }; + + self.layersQueue = new Heap__default["default"](qSort); + self.setupDequeueing(); +}; + +var LTCp = LayeredTextureCache.prototype; +var layerIdPool = 0; +var MAX_INT = Math.pow(2, 53) - 1; + +LTCp.makeLayer = function (bb, lvl) { + var scale = Math.pow(2, lvl); + var w = Math.ceil(bb.w * scale); + var h = Math.ceil(bb.h * scale); + var canvas = this.renderer.makeOffscreenCanvas(w, h); + var layer = { + id: layerIdPool = ++layerIdPool % MAX_INT, + bb: bb, + level: lvl, + width: w, + height: h, + canvas: canvas, + context: canvas.getContext('2d'), + eles: [], + elesQueue: [], + reqs: 0 + }; // log('make layer %s with w %s and h %s and lvl %s', layer.id, layer.width, layer.height, layer.level); + + var cxt = layer.context; + var dx = -layer.bb.x1; + var dy = -layer.bb.y1; // do the transform on creation to save cycles (it's the same for all eles) + + cxt.scale(scale, scale); + cxt.translate(dx, dy); + return layer; +}; + +LTCp.getLayers = function (eles, pxRatio, lvl) { + var self = this; + var r = self.renderer; + var cy = r.cy; + var zoom = cy.zoom(); + var firstGet = self.firstGet; + self.firstGet = false; // log('--\nget layers with %s eles', eles.length); + //log eles.map(function(ele){ return ele.id() }) ); + + if (lvl == null) { + lvl = Math.ceil(log2(zoom * pxRatio)); + + if (lvl < minLvl) { + lvl = minLvl; + } else if (zoom >= maxZoom || lvl > maxLvl) { + return null; + } + } + + self.validateLayersElesOrdering(lvl, eles); + var layersByLvl = self.layersByLevel; + var scale = Math.pow(2, lvl); + var layers = layersByLvl[lvl] = layersByLvl[lvl] || []; + var bb; + var lvlComplete = self.levelIsComplete(lvl, eles); + var tmpLayers; + + var checkTempLevels = function checkTempLevels() { + var canUseAsTmpLvl = function canUseAsTmpLvl(l) { + self.validateLayersElesOrdering(l, eles); + + if (self.levelIsComplete(l, eles)) { + tmpLayers = layersByLvl[l]; + return true; + } + }; + + var checkLvls = function checkLvls(dir) { + if (tmpLayers) { + return; + } + + for (var l = lvl + dir; minLvl <= l && l <= maxLvl; l += dir) { + if (canUseAsTmpLvl(l)) { + break; + } + } + }; + + checkLvls(+1); + checkLvls(-1); // remove the invalid layers; they will be replaced as needed later in this function + + for (var i = layers.length - 1; i >= 0; i--) { + var layer = layers[i]; + + if (layer.invalid) { + removeFromArray(layers, layer); + } + } + }; + + if (!lvlComplete) { + // if the current level is incomplete, then use the closest, best quality layerset temporarily + // and later queue the current layerset so we can get the proper quality level soon + checkTempLevels(); + } else { + // log('level complete, using existing layers\n--'); + return layers; + } + + var getBb = function getBb() { + if (!bb) { + bb = makeBoundingBox(); + + for (var i = 0; i < eles.length; i++) { + updateBoundingBox(bb, eles[i].boundingBox()); + } + } + + return bb; + }; + + var makeLayer = function makeLayer(opts) { + opts = opts || {}; + var after = opts.after; + getBb(); + var area = bb.w * scale * (bb.h * scale); + + if (area > maxLayerArea) { + return null; + } + + var layer = self.makeLayer(bb, lvl); + + if (after != null) { + var index = layers.indexOf(after) + 1; + layers.splice(index, 0, layer); + } else if (opts.insert === undefined || opts.insert) { + // no after specified => first layer made so put at start + layers.unshift(layer); + } // if( tmpLayers ){ + //self.queueLayer( layer ); + // } + + + return layer; + }; + + if (self.skipping && !firstGet) { + // log('skip layers'); + return null; + } // log('do layers'); + + + var layer = null; + var maxElesPerLayer = eles.length / defNumLayers; + var allowLazyQueueing = !firstGet; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var rs = ele._private.rscratch; + var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; // log('look at ele', ele.id()); + + var existingLayer = caches[lvl]; + + if (existingLayer) { + // reuse layer for later eles + // log('reuse layer for', ele.id()); + layer = existingLayer; + continue; + } + + if (!layer || layer.eles.length >= maxElesPerLayer || !boundingBoxInBoundingBox(layer.bb, ele.boundingBox())) { + // log('make new layer for ele %s', ele.id()); + layer = makeLayer({ + insert: true, + after: layer + }); // if now layer can be built then we can't use layers at this level + + if (!layer) { + return null; + } // log('new layer with id %s', layer.id); + + } + + if (tmpLayers || allowLazyQueueing) { + // log('queue ele %s in layer %s', ele.id(), layer.id); + self.queueLayer(layer, ele); + } else { + // log('draw ele %s in layer %s', ele.id(), layer.id); + self.drawEleInLayer(layer, ele, lvl, pxRatio); + } + + layer.eles.push(ele); + caches[lvl] = layer; + } // log('--'); + + + if (tmpLayers) { + // then we only queued the current layerset and can't draw it yet + return tmpLayers; + } + + if (allowLazyQueueing) { + // log('lazy queue level', lvl); + return null; + } + + return layers; +}; // a layer may want to use an ele cache of a higher level to avoid blurriness +// so the layer level might not equal the ele level + + +LTCp.getEleLevelForLayerLevel = function (lvl, pxRatio) { + return lvl; +}; + +LTCp.drawEleInLayer = function (layer, ele, lvl, pxRatio) { + var self = this; + var r = this.renderer; + var context = layer.context; + var bb = ele.boundingBox(); + + if (bb.w === 0 || bb.h === 0 || !ele.visible()) { + return; + } + + lvl = self.getEleLevelForLayerLevel(lvl, pxRatio); + + { + r.setImgSmoothing(context, false); + } + + { + r.drawCachedElement(context, ele, null, null, lvl, useHighQualityEleTxrReqs); + } + + { + r.setImgSmoothing(context, true); + } +}; + +LTCp.levelIsComplete = function (lvl, eles) { + var self = this; + var layers = self.layersByLevel[lvl]; + + if (!layers || layers.length === 0) { + return false; + } + + var numElesInLayers = 0; + + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; // if there are any eles needed to be drawn yet, the level is not complete + + if (layer.reqs > 0) { + return false; + } // if the layer is invalid, the level is not complete + + + if (layer.invalid) { + return false; + } + + numElesInLayers += layer.eles.length; + } // we should have exactly the number of eles passed in to be complete + + + if (numElesInLayers !== eles.length) { + return false; + } + + return true; +}; + +LTCp.validateLayersElesOrdering = function (lvl, eles) { + var layers = this.layersByLevel[lvl]; + + if (!layers) { + return; + } // if in a layer the eles are not in the same order, then the layer is invalid + // (i.e. there is an ele in between the eles in the layer) + + + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; + var offset = -1; // find the offset + + for (var j = 0; j < eles.length; j++) { + if (layer.eles[0] === eles[j]) { + offset = j; + break; + } + } + + if (offset < 0) { + // then the layer has nonexistant elements and is invalid + this.invalidateLayer(layer); + continue; + } // the eles in the layer must be in the same continuous order, else the layer is invalid + + + var o = offset; + + for (var j = 0; j < layer.eles.length; j++) { + if (layer.eles[j] !== eles[o + j]) { + // log('invalidate based on ordering', layer.id); + this.invalidateLayer(layer); + break; + } + } + } +}; + +LTCp.updateElementsInLayers = function (eles, update) { + var self = this; + var isEles = element(eles[0]); // collect udpated elements (cascaded from the layers) and update each + // layer itself along the way + + for (var i = 0; i < eles.length; i++) { + var req = isEles ? null : eles[i]; + var ele = isEles ? eles[i] : eles[i].ele; + var rs = ele._private.rscratch; + var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; + + for (var l = minLvl; l <= maxLvl; l++) { + var layer = caches[l]; + + if (!layer) { + continue; + } // if update is a request from the ele cache, then it affects only + // the matching level + + + if (req && self.getEleLevelForLayerLevel(layer.level) !== req.level) { + continue; + } + + update(layer, ele, req); + } + } +}; + +LTCp.haveLayers = function () { + var self = this; + var haveLayers = false; + + for (var l = minLvl; l <= maxLvl; l++) { + var layers = self.layersByLevel[l]; + + if (layers && layers.length > 0) { + haveLayers = true; + break; + } + } + + return haveLayers; +}; + +LTCp.invalidateElements = function (eles) { + var self = this; + + if (eles.length === 0) { + return; + } + + self.lastInvalidationTime = performanceNow(); // log('update invalidate layer time from eles'); + + if (eles.length === 0 || !self.haveLayers()) { + return; + } + + self.updateElementsInLayers(eles, function invalAssocLayers(layer, ele, req) { + self.invalidateLayer(layer); + }); +}; + +LTCp.invalidateLayer = function (layer) { + // log('update invalidate layer time'); + this.lastInvalidationTime = performanceNow(); + + if (layer.invalid) { + return; + } // save cycles + + + var lvl = layer.level; + var eles = layer.eles; + var layers = this.layersByLevel[lvl]; // log('invalidate layer', layer.id ); + + removeFromArray(layers, layer); // layer.eles = []; + + layer.elesQueue = []; + layer.invalid = true; + + if (layer.replacement) { + layer.replacement.invalid = true; + } + + for (var i = 0; i < eles.length; i++) { + var caches = eles[i]._private.rscratch.imgLayerCaches; + + if (caches) { + caches[lvl] = null; + } + } +}; + +LTCp.refineElementTextures = function (eles) { + var self = this; // log('refine', eles.length); + + self.updateElementsInLayers(eles, function refineEachEle(layer, ele, req) { + var rLyr = layer.replacement; + + if (!rLyr) { + rLyr = layer.replacement = self.makeLayer(layer.bb, layer.level); + rLyr.replaces = layer; + rLyr.eles = layer.eles; // log('make replacement layer %s for %s with level %s', rLyr.id, layer.id, rLyr.level); + } + + if (!rLyr.reqs) { + for (var i = 0; i < rLyr.eles.length; i++) { + self.queueLayer(rLyr, rLyr.eles[i]); + } // log('queue replacement layer refinement', rLyr.id); + + } + }); +}; + +LTCp.enqueueElementRefinement = function (ele) { + + this.eleTxrDeqs.merge(ele); + this.scheduleElementRefinement(); +}; + +LTCp.queueLayer = function (layer, ele) { + var self = this; + var q = self.layersQueue; + var elesQ = layer.elesQueue; + var hasId = elesQ.hasId = elesQ.hasId || {}; // if a layer is going to be replaced, queuing is a waste of time + + if (layer.replacement) { + return; + } + + if (ele) { + if (hasId[ele.id()]) { + return; + } + + elesQ.push(ele); + hasId[ele.id()] = true; + } + + if (layer.reqs) { + layer.reqs++; + q.updateItem(layer); + } else { + layer.reqs = 1; + q.push(layer); + } +}; + +LTCp.dequeue = function (pxRatio) { + var self = this; + var q = self.layersQueue; + var deqd = []; + var eleDeqs = 0; + + while (eleDeqs < maxDeqSize) { + if (q.size() === 0) { + break; + } + + var layer = q.peek(); // if a layer has been or will be replaced, then don't waste time with it + + if (layer.replacement) { + // log('layer %s in queue skipped b/c it already has a replacement', layer.id); + q.pop(); + continue; + } // if this is a replacement layer that has been superceded, then forget it + + + if (layer.replaces && layer !== layer.replaces.replacement) { + // log('layer is no longer the most uptodate replacement; dequeued', layer.id) + q.pop(); + continue; + } + + if (layer.invalid) { + // log('replacement layer %s is invalid; dequeued', layer.id); + q.pop(); + continue; + } + + var ele = layer.elesQueue.shift(); + + if (ele) { + // log('dequeue layer %s', layer.id); + self.drawEleInLayer(layer, ele, layer.level, pxRatio); + eleDeqs++; + } + + if (deqd.length === 0) { + // we need only one entry in deqd to queue redrawing etc + deqd.push(true); + } // if the layer has all its eles done, then remove from the queue + + + if (layer.elesQueue.length === 0) { + q.pop(); + layer.reqs = 0; // log('dequeue of layer %s complete', layer.id); + // when a replacement layer is dequeued, it replaces the old layer in the level + + if (layer.replaces) { + self.applyLayerReplacement(layer); + } + + self.requestRedraw(); + } + } + + return deqd; +}; + +LTCp.applyLayerReplacement = function (layer) { + var self = this; + var layersInLevel = self.layersByLevel[layer.level]; + var replaced = layer.replaces; + var index = layersInLevel.indexOf(replaced); // if the replaced layer is not in the active list for the level, then replacing + // refs would be a mistake (i.e. overwriting the true active layer) + + if (index < 0 || replaced.invalid) { + // log('replacement layer would have no effect', layer.id); + return; + } + + layersInLevel[index] = layer; // replace level ref + // replace refs in eles + + for (var i = 0; i < layer.eles.length; i++) { + var _p = layer.eles[i]._private; + var cache = _p.imgLayerCaches = _p.imgLayerCaches || {}; + + if (cache) { + cache[layer.level] = layer; + } + } // log('apply replacement layer %s over %s', layer.id, replaced.id); + + + self.requestRedraw(); +}; + +LTCp.requestRedraw = debounce__default["default"](function () { + var r = this.renderer; + r.redrawHint('eles', true); + r.redrawHint('drag', true); + r.redraw(); +}, 100); +LTCp.setupDequeueing = defs.setupDequeueing({ + deqRedrawThreshold: deqRedrawThreshold, + deqCost: deqCost, + deqAvgCost: deqAvgCost, + deqNoDrawCost: deqNoDrawCost, + deqFastCost: deqFastCost, + deq: function deq(self, pxRatio) { + return self.dequeue(pxRatio); + }, + onDeqd: noop$1, + shouldRedraw: trueify, + priority: function priority(self) { + return self.renderer.beforeRenderPriorities.lyrTxrDeq; + } +}); + +var CRp$a = {}; +var impl; + +function polygon(context, points) { + for (var i = 0; i < points.length; i++) { + var pt = points[i]; + context.lineTo(pt.x, pt.y); + } +} + +function triangleBackcurve(context, points, controlPoint) { + var firstPt; + + for (var i = 0; i < points.length; i++) { + var pt = points[i]; + + if (i === 0) { + firstPt = pt; + } + + context.lineTo(pt.x, pt.y); + } + + context.quadraticCurveTo(controlPoint.x, controlPoint.y, firstPt.x, firstPt.y); +} + +function triangleTee(context, trianglePoints, teePoints) { + if (context.beginPath) { + context.beginPath(); + } + + var triPts = trianglePoints; + + for (var i = 0; i < triPts.length; i++) { + var pt = triPts[i]; + context.lineTo(pt.x, pt.y); + } + + var teePts = teePoints; + var firstTeePt = teePoints[0]; + context.moveTo(firstTeePt.x, firstTeePt.y); + + for (var i = 1; i < teePts.length; i++) { + var pt = teePts[i]; + context.lineTo(pt.x, pt.y); + } + + if (context.closePath) { + context.closePath(); + } +} + +function circleTriangle(context, trianglePoints, rx, ry, r) { + if (context.beginPath) { + context.beginPath(); + } + + context.arc(rx, ry, r, 0, Math.PI * 2, false); + var triPts = trianglePoints; + var firstTrPt = triPts[0]; + context.moveTo(firstTrPt.x, firstTrPt.y); + + for (var i = 0; i < triPts.length; i++) { + var pt = triPts[i]; + context.lineTo(pt.x, pt.y); + } + + if (context.closePath) { + context.closePath(); + } +} + +function circle(context, rx, ry, r) { + context.arc(rx, ry, r, 0, Math.PI * 2, false); +} + +CRp$a.arrowShapeImpl = function (name) { + return (impl || (impl = { + 'polygon': polygon, + 'triangle-backcurve': triangleBackcurve, + 'triangle-tee': triangleTee, + 'circle-triangle': circleTriangle, + 'triangle-cross': triangleTee, + 'circle': circle + }))[name]; +}; + +var CRp$9 = {}; + +CRp$9.drawElement = function (context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity) { + var r = this; + + if (ele.isNode()) { + r.drawNode(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity); + } else { + r.drawEdge(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity); + } +}; + +CRp$9.drawElementOverlay = function (context, ele) { + var r = this; + + if (ele.isNode()) { + r.drawNodeOverlay(context, ele); + } else { + r.drawEdgeOverlay(context, ele); + } +}; + +CRp$9.drawElementUnderlay = function (context, ele) { + var r = this; + + if (ele.isNode()) { + r.drawNodeUnderlay(context, ele); + } else { + r.drawEdgeUnderlay(context, ele); + } +}; + +CRp$9.drawCachedElementPortion = function (context, ele, eleTxrCache, pxRatio, lvl, reason, getRotation, getOpacity) { + var r = this; + var bb = eleTxrCache.getBoundingBox(ele); + + if (bb.w === 0 || bb.h === 0) { + return; + } // ignore zero size case + + + var eleCache = eleTxrCache.getElement(ele, bb, pxRatio, lvl, reason); + + if (eleCache != null) { + var opacity = getOpacity(r, ele); + + if (opacity === 0) { + return; + } + + var theta = getRotation(r, ele); + var x1 = bb.x1, + y1 = bb.y1, + w = bb.w, + h = bb.h; + var x, y, sx, sy, smooth; + + if (theta !== 0) { + var rotPt = eleTxrCache.getRotationPoint(ele); + sx = rotPt.x; + sy = rotPt.y; + context.translate(sx, sy); + context.rotate(theta); + smooth = r.getImgSmoothing(context); + + if (!smooth) { + r.setImgSmoothing(context, true); + } + + var off = eleTxrCache.getRotationOffset(ele); + x = off.x; + y = off.y; + } else { + x = x1; + y = y1; + } + + var oldGlobalAlpha; + + if (opacity !== 1) { + oldGlobalAlpha = context.globalAlpha; + context.globalAlpha = oldGlobalAlpha * opacity; + } + + context.drawImage(eleCache.texture.canvas, eleCache.x, 0, eleCache.width, eleCache.height, x, y, w, h); + + if (opacity !== 1) { + context.globalAlpha = oldGlobalAlpha; + } + + if (theta !== 0) { + context.rotate(-theta); + context.translate(-sx, -sy); + + if (!smooth) { + r.setImgSmoothing(context, false); + } + } + } else { + eleTxrCache.drawElement(context, ele); // direct draw fallback + } +}; + +var getZeroRotation = function getZeroRotation() { + return 0; +}; + +var getLabelRotation = function getLabelRotation(r, ele) { + return r.getTextAngle(ele, null); +}; + +var getSourceLabelRotation = function getSourceLabelRotation(r, ele) { + return r.getTextAngle(ele, 'source'); +}; + +var getTargetLabelRotation = function getTargetLabelRotation(r, ele) { + return r.getTextAngle(ele, 'target'); +}; + +var getOpacity = function getOpacity(r, ele) { + return ele.effectiveOpacity(); +}; + +var getTextOpacity = function getTextOpacity(e, ele) { + return ele.pstyle('text-opacity').pfValue * ele.effectiveOpacity(); +}; + +CRp$9.drawCachedElement = function (context, ele, pxRatio, extent, lvl, requestHighQuality) { + var r = this; + var _r$data = r.data, + eleTxrCache = _r$data.eleTxrCache, + lblTxrCache = _r$data.lblTxrCache, + slbTxrCache = _r$data.slbTxrCache, + tlbTxrCache = _r$data.tlbTxrCache; + var bb = ele.boundingBox(); + var reason = requestHighQuality === true ? eleTxrCache.reasons.highQuality : null; + + if (bb.w === 0 || bb.h === 0 || !ele.visible()) { + return; + } + + if (!extent || boundingBoxesIntersect(bb, extent)) { + var isEdge = ele.isEdge(); + + var badLine = ele.element()._private.rscratch.badLine; + + r.drawElementUnderlay(context, ele); + r.drawCachedElementPortion(context, ele, eleTxrCache, pxRatio, lvl, reason, getZeroRotation, getOpacity); + + if (!isEdge || !badLine) { + r.drawCachedElementPortion(context, ele, lblTxrCache, pxRatio, lvl, reason, getLabelRotation, getTextOpacity); + } + + if (isEdge && !badLine) { + r.drawCachedElementPortion(context, ele, slbTxrCache, pxRatio, lvl, reason, getSourceLabelRotation, getTextOpacity); + r.drawCachedElementPortion(context, ele, tlbTxrCache, pxRatio, lvl, reason, getTargetLabelRotation, getTextOpacity); + } + + r.drawElementOverlay(context, ele); + } +}; + +CRp$9.drawElements = function (context, eles) { + var r = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + r.drawElement(context, ele); + } +}; + +CRp$9.drawCachedElements = function (context, eles, pxRatio, extent) { + var r = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + r.drawCachedElement(context, ele, pxRatio, extent); + } +}; + +CRp$9.drawCachedNodes = function (context, eles, pxRatio, extent) { + var r = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.isNode()) { + continue; + } + + r.drawCachedElement(context, ele, pxRatio, extent); + } +}; + +CRp$9.drawLayeredElements = function (context, eles, pxRatio, extent) { + var r = this; + var layers = r.data.lyrTxrCache.getLayers(eles, pxRatio); + + if (layers) { + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; + var bb = layer.bb; + + if (bb.w === 0 || bb.h === 0) { + continue; + } + + context.drawImage(layer.canvas, bb.x1, bb.y1, bb.w, bb.h); + } + } else { + // fall back on plain caching if no layers + r.drawCachedElements(context, eles, pxRatio, extent); + } +}; + +/* global Path2D */ +var CRp$8 = {}; + +CRp$8.drawEdge = function (context, edge, shiftToOriginWithBb) { + var drawLabel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + var r = this; + var rs = edge._private.rscratch; + + if (shouldDrawOpacity && !edge.visible()) { + return; + } // if bezier ctrl pts can not be calculated, then die + + + if (rs.badLine || rs.allpts == null || isNaN(rs.allpts[0])) { + // isNaN in case edge is impossible and browser bugs (e.g. safari) + return; + } + + var bb; + + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } + + var opacity = shouldDrawOpacity ? edge.pstyle('opacity').value : 1; + var lineOpacity = shouldDrawOpacity ? edge.pstyle('line-opacity').value : 1; + var curveStyle = edge.pstyle('curve-style').value; + var lineStyle = edge.pstyle('line-style').value; + var edgeWidth = edge.pstyle('width').pfValue; + var lineCap = edge.pstyle('line-cap').value; + var effectiveLineOpacity = opacity * lineOpacity; // separate arrow opacity would require arrow-opacity property + + var effectiveArrowOpacity = opacity * lineOpacity; + + var drawLine = function drawLine() { + var strokeOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : effectiveLineOpacity; + + if (curveStyle === 'straight-triangle') { + r.eleStrokeStyle(context, edge, strokeOpacity); + r.drawEdgeTrianglePath(edge, context, rs.allpts); + } else { + context.lineWidth = edgeWidth; + context.lineCap = lineCap; + r.eleStrokeStyle(context, edge, strokeOpacity); + r.drawEdgePath(edge, context, rs.allpts, lineStyle); + context.lineCap = 'butt'; // reset for other drawing functions + } + }; + + var drawOverlay = function drawOverlay() { + if (!shouldDrawOverlay) { + return; + } + + r.drawEdgeOverlay(context, edge); + }; + + var drawUnderlay = function drawUnderlay() { + if (!shouldDrawOverlay) { + return; + } + + r.drawEdgeUnderlay(context, edge); + }; + + var drawArrows = function drawArrows() { + var arrowOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : effectiveArrowOpacity; + r.drawArrowheads(context, edge, arrowOpacity); + }; + + var drawText = function drawText() { + r.drawElementText(context, edge, null, drawLabel); + }; + + context.lineJoin = 'round'; + var ghost = edge.pstyle('ghost').value === 'yes'; + + if (ghost) { + var gx = edge.pstyle('ghost-offset-x').pfValue; + var gy = edge.pstyle('ghost-offset-y').pfValue; + var ghostOpacity = edge.pstyle('ghost-opacity').value; + var effectiveGhostOpacity = effectiveLineOpacity * ghostOpacity; + context.translate(gx, gy); + drawLine(effectiveGhostOpacity); + drawArrows(effectiveGhostOpacity); + context.translate(-gx, -gy); + } + + drawUnderlay(); + drawLine(); + drawArrows(); + drawOverlay(); + drawText(); + + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } +}; + +var drawEdgeOverlayUnderlay = function drawEdgeOverlayUnderlay(overlayOrUnderlay) { + if (!['overlay', 'underlay'].includes(overlayOrUnderlay)) { + throw new Error('Invalid state'); + } + + return function (context, edge) { + if (!edge.visible()) { + return; + } + + var opacity = edge.pstyle("".concat(overlayOrUnderlay, "-opacity")).value; + + if (opacity === 0) { + return; + } + + var r = this; + var usePaths = r.usePaths(); + var rs = edge._private.rscratch; + var padding = edge.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue; + var width = 2 * padding; + var color = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value; + context.lineWidth = width; + + if (rs.edgeType === 'self' && !usePaths) { + context.lineCap = 'butt'; + } else { + context.lineCap = 'round'; + } + + r.colorStrokeStyle(context, color[0], color[1], color[2], opacity); + r.drawEdgePath(edge, context, rs.allpts, 'solid'); + }; +}; + +CRp$8.drawEdgeOverlay = drawEdgeOverlayUnderlay('overlay'); +CRp$8.drawEdgeUnderlay = drawEdgeOverlayUnderlay('underlay'); + +CRp$8.drawEdgePath = function (edge, context, pts, type) { + var rs = edge._private.rscratch; + var canvasCxt = context; + var path; + var pathCacheHit = false; + var usePaths = this.usePaths(); + var lineDashPattern = edge.pstyle('line-dash-pattern').pfValue; + var lineDashOffset = edge.pstyle('line-dash-offset').pfValue; + + if (usePaths) { + var pathCacheKey = pts.join('$'); + var keyMatches = rs.pathCacheKey && rs.pathCacheKey === pathCacheKey; + + if (keyMatches) { + path = context = rs.pathCache; + pathCacheHit = true; + } else { + path = context = new Path2D(); + rs.pathCacheKey = pathCacheKey; + rs.pathCache = path; + } + } + + if (canvasCxt.setLineDash) { + // for very outofdate browsers + switch (type) { + case 'dotted': + canvasCxt.setLineDash([1, 1]); + break; + + case 'dashed': + canvasCxt.setLineDash(lineDashPattern); + canvasCxt.lineDashOffset = lineDashOffset; + break; + + case 'solid': + canvasCxt.setLineDash([]); + break; + } + } + + if (!pathCacheHit && !rs.badLine) { + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(pts[0], pts[1]); + + switch (rs.edgeType) { + case 'bezier': + case 'self': + case 'compound': + case 'multibezier': + for (var i = 2; i + 3 < pts.length; i += 4) { + context.quadraticCurveTo(pts[i], pts[i + 1], pts[i + 2], pts[i + 3]); + } + + break; + + case 'straight': + case 'segments': + case 'haystack': + for (var _i = 2; _i + 1 < pts.length; _i += 2) { + context.lineTo(pts[_i], pts[_i + 1]); + } + + break; + } + } + + context = canvasCxt; + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } // reset any line dashes + + + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } +}; + +CRp$8.drawEdgeTrianglePath = function (edge, context, pts) { + // use line stroke style for triangle fill style + context.fillStyle = context.strokeStyle; + var edgeWidth = edge.pstyle('width').pfValue; + + for (var i = 0; i + 1 < pts.length; i += 2) { + var vector = [pts[i + 2] - pts[i], pts[i + 3] - pts[i + 1]]; + var length = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]); + var normal = [vector[1] / length, -vector[0] / length]; + var triangleHead = [normal[0] * edgeWidth / 2, normal[1] * edgeWidth / 2]; + context.beginPath(); + context.moveTo(pts[i] - triangleHead[0], pts[i + 1] - triangleHead[1]); + context.lineTo(pts[i] + triangleHead[0], pts[i + 1] + triangleHead[1]); + context.lineTo(pts[i + 2], pts[i + 3]); + context.closePath(); + context.fill(); + } +}; + +CRp$8.drawArrowheads = function (context, edge, opacity) { + var rs = edge._private.rscratch; + var isHaystack = rs.edgeType === 'haystack'; + + if (!isHaystack) { + this.drawArrowhead(context, edge, 'source', rs.arrowStartX, rs.arrowStartY, rs.srcArrowAngle, opacity); + } + + this.drawArrowhead(context, edge, 'mid-target', rs.midX, rs.midY, rs.midtgtArrowAngle, opacity); + this.drawArrowhead(context, edge, 'mid-source', rs.midX, rs.midY, rs.midsrcArrowAngle, opacity); + + if (!isHaystack) { + this.drawArrowhead(context, edge, 'target', rs.arrowEndX, rs.arrowEndY, rs.tgtArrowAngle, opacity); + } +}; + +CRp$8.drawArrowhead = function (context, edge, prefix, x, y, angle, opacity) { + if (isNaN(x) || x == null || isNaN(y) || y == null || isNaN(angle) || angle == null) { + return; + } + + var self = this; + var arrowShape = edge.pstyle(prefix + '-arrow-shape').value; + + if (arrowShape === 'none') { + return; + } + + var arrowClearFill = edge.pstyle(prefix + '-arrow-fill').value === 'hollow' ? 'both' : 'filled'; + var arrowFill = edge.pstyle(prefix + '-arrow-fill').value; + var edgeWidth = edge.pstyle('width').pfValue; + var edgeOpacity = edge.pstyle('opacity').value; + + if (opacity === undefined) { + opacity = edgeOpacity; + } + + var gco = context.globalCompositeOperation; + + if (opacity !== 1 || arrowFill === 'hollow') { + // then extra clear is needed + context.globalCompositeOperation = 'destination-out'; + self.colorFillStyle(context, 255, 255, 255, 1); + self.colorStrokeStyle(context, 255, 255, 255, 1); + self.drawArrowShape(edge, context, arrowClearFill, edgeWidth, arrowShape, x, y, angle); + context.globalCompositeOperation = gco; + } // otherwise, the opaque arrow clears it for free :) + + + var color = edge.pstyle(prefix + '-arrow-color').value; + self.colorFillStyle(context, color[0], color[1], color[2], opacity); + self.colorStrokeStyle(context, color[0], color[1], color[2], opacity); + self.drawArrowShape(edge, context, arrowFill, edgeWidth, arrowShape, x, y, angle); +}; + +CRp$8.drawArrowShape = function (edge, context, fill, edgeWidth, shape, x, y, angle) { + var r = this; + var usePaths = this.usePaths() && shape !== 'triangle-cross'; + var pathCacheHit = false; + var path; + var canvasContext = context; + var translation = { + x: x, + y: y + }; + var scale = edge.pstyle('arrow-scale').value; + var size = this.getArrowWidth(edgeWidth, scale); + var shapeImpl = r.arrowShapes[shape]; + + if (usePaths) { + var cache = r.arrowPathCache = r.arrowPathCache || []; + var key = hashString(shape); + var cachedPath = cache[key]; + + if (cachedPath != null) { + path = context = cachedPath; + pathCacheHit = true; + } else { + path = context = new Path2D(); + cache[key] = path; + } + } + + if (!pathCacheHit) { + if (context.beginPath) { + context.beginPath(); + } + + if (usePaths) { + // store in the path cache with values easily manipulated later + shapeImpl.draw(context, 1, 0, { + x: 0, + y: 0 + }, 1); + } else { + shapeImpl.draw(context, size, angle, translation, edgeWidth); + } + + if (context.closePath) { + context.closePath(); + } + } + + context = canvasContext; + + if (usePaths) { + // set transform to arrow position/orientation + context.translate(x, y); + context.rotate(angle); + context.scale(size, size); + } + + if (fill === 'filled' || fill === 'both') { + if (usePaths) { + context.fill(path); + } else { + context.fill(); + } + } + + if (fill === 'hollow' || fill === 'both') { + context.lineWidth = (shapeImpl.matchEdgeWidth ? edgeWidth : 1) / (usePaths ? size : 1); + context.lineJoin = 'miter'; + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } + } + + if (usePaths) { + // reset transform by applying inverse + context.scale(1 / size, 1 / size); + context.rotate(-angle); + context.translate(-x, -y); + } +}; + +var CRp$7 = {}; + +CRp$7.safeDrawImage = function (context, img, ix, iy, iw, ih, x, y, w, h) { + // detect problematic cases for old browsers with bad images (cheaper than try-catch) + if (iw <= 0 || ih <= 0 || w <= 0 || h <= 0) { + return; + } + + try { + context.drawImage(img, ix, iy, iw, ih, x, y, w, h); + } catch (e) { + warn(e); + } +}; + +CRp$7.drawInscribedImage = function (context, img, node, index, nodeOpacity) { + var r = this; + var pos = node.position(); + var nodeX = pos.x; + var nodeY = pos.y; + var styleObj = node.cy().style(); + var getIndexedStyle = styleObj.getIndexedStyle.bind(styleObj); + var fit = getIndexedStyle(node, 'background-fit', 'value', index); + var repeat = getIndexedStyle(node, 'background-repeat', 'value', index); + var nodeW = node.width(); + var nodeH = node.height(); + var paddingX2 = node.padding() * 2; + var nodeTW = nodeW + (getIndexedStyle(node, 'background-width-relative-to', 'value', index) === 'inner' ? 0 : paddingX2); + var nodeTH = nodeH + (getIndexedStyle(node, 'background-height-relative-to', 'value', index) === 'inner' ? 0 : paddingX2); + var rs = node._private.rscratch; + var clip = getIndexedStyle(node, 'background-clip', 'value', index); + var shouldClip = clip === 'node'; + var imgOpacity = getIndexedStyle(node, 'background-image-opacity', 'value', index) * nodeOpacity; + var smooth = getIndexedStyle(node, 'background-image-smoothing', 'value', index); + var imgW = img.width || img.cachedW; + var imgH = img.height || img.cachedH; // workaround for broken browsers like ie + + if (null == imgW || null == imgH) { + document.body.appendChild(img); // eslint-disable-line no-undef + + imgW = img.cachedW = img.width || img.offsetWidth; + imgH = img.cachedH = img.height || img.offsetHeight; + document.body.removeChild(img); // eslint-disable-line no-undef + } + + var w = imgW; + var h = imgH; + + if (getIndexedStyle(node, 'background-width', 'value', index) !== 'auto') { + if (getIndexedStyle(node, 'background-width', 'units', index) === '%') { + w = getIndexedStyle(node, 'background-width', 'pfValue', index) * nodeTW; + } else { + w = getIndexedStyle(node, 'background-width', 'pfValue', index); + } + } + + if (getIndexedStyle(node, 'background-height', 'value', index) !== 'auto') { + if (getIndexedStyle(node, 'background-height', 'units', index) === '%') { + h = getIndexedStyle(node, 'background-height', 'pfValue', index) * nodeTH; + } else { + h = getIndexedStyle(node, 'background-height', 'pfValue', index); + } + } + + if (w === 0 || h === 0) { + return; // no point in drawing empty image (and chrome is broken in this case) + } + + if (fit === 'contain') { + var scale = Math.min(nodeTW / w, nodeTH / h); + w *= scale; + h *= scale; + } else if (fit === 'cover') { + var scale = Math.max(nodeTW / w, nodeTH / h); + w *= scale; + h *= scale; + } + + var x = nodeX - nodeTW / 2; // left + + var posXUnits = getIndexedStyle(node, 'background-position-x', 'units', index); + var posXPfVal = getIndexedStyle(node, 'background-position-x', 'pfValue', index); + + if (posXUnits === '%') { + x += (nodeTW - w) * posXPfVal; + } else { + x += posXPfVal; + } + + var offXUnits = getIndexedStyle(node, 'background-offset-x', 'units', index); + var offXPfVal = getIndexedStyle(node, 'background-offset-x', 'pfValue', index); + + if (offXUnits === '%') { + x += (nodeTW - w) * offXPfVal; + } else { + x += offXPfVal; + } + + var y = nodeY - nodeTH / 2; // top + + var posYUnits = getIndexedStyle(node, 'background-position-y', 'units', index); + var posYPfVal = getIndexedStyle(node, 'background-position-y', 'pfValue', index); + + if (posYUnits === '%') { + y += (nodeTH - h) * posYPfVal; + } else { + y += posYPfVal; + } + + var offYUnits = getIndexedStyle(node, 'background-offset-y', 'units', index); + var offYPfVal = getIndexedStyle(node, 'background-offset-y', 'pfValue', index); + + if (offYUnits === '%') { + y += (nodeTH - h) * offYPfVal; + } else { + y += offYPfVal; + } + + if (rs.pathCache) { + x -= nodeX; + y -= nodeY; + nodeX = 0; + nodeY = 0; + } + + var gAlpha = context.globalAlpha; + context.globalAlpha = imgOpacity; + var smoothingEnabled = r.getImgSmoothing(context); + var isSmoothingSwitched = false; + + if (smooth === 'no' && smoothingEnabled) { + r.setImgSmoothing(context, false); + isSmoothingSwitched = true; + } else if (smooth === 'yes' && !smoothingEnabled) { + r.setImgSmoothing(context, true); + isSmoothingSwitched = true; + } + + if (repeat === 'no-repeat') { + if (shouldClip) { + context.save(); + + if (rs.pathCache) { + context.clip(rs.pathCache); + } else { + r.nodeShapes[r.getNodeShape(node)].draw(context, nodeX, nodeY, nodeTW, nodeTH); + context.clip(); + } + } + + r.safeDrawImage(context, img, 0, 0, imgW, imgH, x, y, w, h); + + if (shouldClip) { + context.restore(); + } + } else { + var pattern = context.createPattern(img, repeat); + context.fillStyle = pattern; + r.nodeShapes[r.getNodeShape(node)].draw(context, nodeX, nodeY, nodeTW, nodeTH); + context.translate(x, y); + context.fill(); + context.translate(-x, -y); + } + + context.globalAlpha = gAlpha; + + if (isSmoothingSwitched) { + r.setImgSmoothing(context, smoothingEnabled); + } +}; + +var CRp$6 = {}; + +CRp$6.eleTextBiggerThanMin = function (ele, scale) { + if (!scale) { + var zoom = ele.cy().zoom(); + var pxRatio = this.getPixelRatio(); + var lvl = Math.ceil(log2(zoom * pxRatio)); // the effective texture level + + scale = Math.pow(2, lvl); + } + + var computedSize = ele.pstyle('font-size').pfValue * scale; + var minSize = ele.pstyle('min-zoomed-font-size').pfValue; + + if (computedSize < minSize) { + return false; + } + + return true; +}; + +CRp$6.drawElementText = function (context, ele, shiftToOriginWithBb, force, prefix) { + var useEleOpacity = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + var r = this; + + if (force == null) { + if (useEleOpacity && !r.eleTextBiggerThanMin(ele)) { + return; + } + } else if (force === false) { + return; + } + + if (ele.isNode()) { + var label = ele.pstyle('label'); + + if (!label || !label.value) { + return; + } + + var justification = r.getLabelJustification(ele); + context.textAlign = justification; + context.textBaseline = 'bottom'; + } else { + var badLine = ele.element()._private.rscratch.badLine; + + var _label = ele.pstyle('label'); + + var srcLabel = ele.pstyle('source-label'); + var tgtLabel = ele.pstyle('target-label'); + + if (badLine || (!_label || !_label.value) && (!srcLabel || !srcLabel.value) && (!tgtLabel || !tgtLabel.value)) { + return; + } + + context.textAlign = 'center'; + context.textBaseline = 'bottom'; + } + + var applyRotation = !shiftToOriginWithBb; + var bb; + + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } + + if (prefix == null) { + r.drawText(context, ele, null, applyRotation, useEleOpacity); + + if (ele.isEdge()) { + r.drawText(context, ele, 'source', applyRotation, useEleOpacity); + r.drawText(context, ele, 'target', applyRotation, useEleOpacity); + } + } else { + r.drawText(context, ele, prefix, applyRotation, useEleOpacity); + } + + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } +}; + +CRp$6.getFontCache = function (context) { + var cache; + this.fontCaches = this.fontCaches || []; + + for (var i = 0; i < this.fontCaches.length; i++) { + cache = this.fontCaches[i]; + + if (cache.context === context) { + return cache; + } + } + + cache = { + context: context + }; + this.fontCaches.push(cache); + return cache; +}; // set up canvas context with font +// returns transformed text string + + +CRp$6.setupTextStyle = function (context, ele) { + var useEleOpacity = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + // Font style + var labelStyle = ele.pstyle('font-style').strValue; + var labelSize = ele.pstyle('font-size').pfValue + 'px'; + var labelFamily = ele.pstyle('font-family').strValue; + var labelWeight = ele.pstyle('font-weight').strValue; + var opacity = useEleOpacity ? ele.effectiveOpacity() * ele.pstyle('text-opacity').value : 1; + var outlineOpacity = ele.pstyle('text-outline-opacity').value * opacity; + var color = ele.pstyle('color').value; + var outlineColor = ele.pstyle('text-outline-color').value; + context.font = labelStyle + ' ' + labelWeight + ' ' + labelSize + ' ' + labelFamily; + context.lineJoin = 'round'; // so text outlines aren't jagged + + this.colorFillStyle(context, color[0], color[1], color[2], opacity); + this.colorStrokeStyle(context, outlineColor[0], outlineColor[1], outlineColor[2], outlineOpacity); +}; // TODO ensure re-used + + +function roundRect(ctx, x, y, width, height) { + var radius = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 5; + ctx.beginPath(); + ctx.moveTo(x + radius, y); + ctx.lineTo(x + width - radius, y); + ctx.quadraticCurveTo(x + width, y, x + width, y + radius); + ctx.lineTo(x + width, y + height - radius); + ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); + ctx.lineTo(x + radius, y + height); + ctx.quadraticCurveTo(x, y + height, x, y + height - radius); + ctx.lineTo(x, y + radius); + ctx.quadraticCurveTo(x, y, x + radius, y); + ctx.closePath(); + ctx.fill(); +} + +CRp$6.getTextAngle = function (ele, prefix) { + var theta; + var _p = ele._private; + var rscratch = _p.rscratch; + var pdash = prefix ? prefix + '-' : ''; + var rotation = ele.pstyle(pdash + 'text-rotation'); + var textAngle = getPrefixedProperty(rscratch, 'labelAngle', prefix); + + if (rotation.strValue === 'autorotate') { + theta = ele.isEdge() ? textAngle : 0; + } else if (rotation.strValue === 'none') { + theta = 0; + } else { + theta = rotation.pfValue; + } + + return theta; +}; + +CRp$6.drawText = function (context, ele, prefix) { + var applyRotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var useEleOpacity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var _p = ele._private; + var rscratch = _p.rscratch; + var parentOpacity = useEleOpacity ? ele.effectiveOpacity() : 1; + + if (useEleOpacity && (parentOpacity === 0 || ele.pstyle('text-opacity').value === 0)) { + return; + } // use 'main' as an alias for the main label (i.e. null prefix) + + + if (prefix === 'main') { + prefix = null; + } + + var textX = getPrefixedProperty(rscratch, 'labelX', prefix); + var textY = getPrefixedProperty(rscratch, 'labelY', prefix); + var orgTextX, orgTextY; // used for rotation + + var text = this.getLabelText(ele, prefix); + + if (text != null && text !== '' && !isNaN(textX) && !isNaN(textY)) { + this.setupTextStyle(context, ele, useEleOpacity); + var pdash = prefix ? prefix + '-' : ''; + var textW = getPrefixedProperty(rscratch, 'labelWidth', prefix); + var textH = getPrefixedProperty(rscratch, 'labelHeight', prefix); + var marginX = ele.pstyle(pdash + 'text-margin-x').pfValue; + var marginY = ele.pstyle(pdash + 'text-margin-y').pfValue; + var isEdge = ele.isEdge(); + var halign = ele.pstyle('text-halign').value; + var valign = ele.pstyle('text-valign').value; + + if (isEdge) { + halign = 'center'; + valign = 'center'; + } + + textX += marginX; + textY += marginY; + var theta; + + if (!applyRotation) { + theta = 0; + } else { + theta = this.getTextAngle(ele, prefix); + } + + if (theta !== 0) { + orgTextX = textX; + orgTextY = textY; + context.translate(orgTextX, orgTextY); + context.rotate(theta); + textX = 0; + textY = 0; + } + + switch (valign) { + case 'top': + break; + + case 'center': + textY += textH / 2; + break; + + case 'bottom': + textY += textH; + break; + } + + var backgroundOpacity = ele.pstyle('text-background-opacity').value; + var borderOpacity = ele.pstyle('text-border-opacity').value; + var textBorderWidth = ele.pstyle('text-border-width').pfValue; + var backgroundPadding = ele.pstyle('text-background-padding').pfValue; + + if (backgroundOpacity > 0 || textBorderWidth > 0 && borderOpacity > 0) { + var bgX = textX - backgroundPadding; + + switch (halign) { + case 'left': + bgX -= textW; + break; + + case 'center': + bgX -= textW / 2; + break; + } + + var bgY = textY - textH - backgroundPadding; + var bgW = textW + 2 * backgroundPadding; + var bgH = textH + 2 * backgroundPadding; + + if (backgroundOpacity > 0) { + var textFill = context.fillStyle; + var textBackgroundColor = ele.pstyle('text-background-color').value; + context.fillStyle = 'rgba(' + textBackgroundColor[0] + ',' + textBackgroundColor[1] + ',' + textBackgroundColor[2] + ',' + backgroundOpacity * parentOpacity + ')'; + var styleShape = ele.pstyle('text-background-shape').strValue; + + if (styleShape.indexOf('round') === 0) { + roundRect(context, bgX, bgY, bgW, bgH, 2); + } else { + context.fillRect(bgX, bgY, bgW, bgH); + } + + context.fillStyle = textFill; + } + + if (textBorderWidth > 0 && borderOpacity > 0) { + var textStroke = context.strokeStyle; + var textLineWidth = context.lineWidth; + var textBorderColor = ele.pstyle('text-border-color').value; + var textBorderStyle = ele.pstyle('text-border-style').value; + context.strokeStyle = 'rgba(' + textBorderColor[0] + ',' + textBorderColor[1] + ',' + textBorderColor[2] + ',' + borderOpacity * parentOpacity + ')'; + context.lineWidth = textBorderWidth; + + if (context.setLineDash) { + // for very outofdate browsers + switch (textBorderStyle) { + case 'dotted': + context.setLineDash([1, 1]); + break; + + case 'dashed': + context.setLineDash([4, 2]); + break; + + case 'double': + context.lineWidth = textBorderWidth / 4; // 50% reserved for white between the two borders + + context.setLineDash([]); + break; + + case 'solid': + context.setLineDash([]); + break; + } + } + + context.strokeRect(bgX, bgY, bgW, bgH); + + if (textBorderStyle === 'double') { + var whiteWidth = textBorderWidth / 2; + context.strokeRect(bgX + whiteWidth, bgY + whiteWidth, bgW - whiteWidth * 2, bgH - whiteWidth * 2); + } + + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } + + context.lineWidth = textLineWidth; + context.strokeStyle = textStroke; + } + } + + var lineWidth = 2 * ele.pstyle('text-outline-width').pfValue; // *2 b/c the stroke is drawn centred on the middle + + if (lineWidth > 0) { + context.lineWidth = lineWidth; + } + + if (ele.pstyle('text-wrap').value === 'wrap') { + var lines = getPrefixedProperty(rscratch, 'labelWrapCachedLines', prefix); + var lineHeight = getPrefixedProperty(rscratch, 'labelLineHeight', prefix); + var halfTextW = textW / 2; + var justification = this.getLabelJustification(ele); + + if (justification === 'auto') ; else if (halign === 'left') { + // auto justification : right + if (justification === 'left') { + textX += -textW; + } else if (justification === 'center') { + textX += -halfTextW; + } // else same as auto + + } else if (halign === 'center') { + // auto justfication : center + if (justification === 'left') { + textX += -halfTextW; + } else if (justification === 'right') { + textX += halfTextW; + } // else same as auto + + } else if (halign === 'right') { + // auto justification : left + if (justification === 'center') { + textX += halfTextW; + } else if (justification === 'right') { + textX += textW; + } // else same as auto + + } + + switch (valign) { + case 'top': + textY -= (lines.length - 1) * lineHeight; + break; + + case 'center': + case 'bottom': + textY -= (lines.length - 1) * lineHeight; + break; + } + + for (var l = 0; l < lines.length; l++) { + if (lineWidth > 0) { + context.strokeText(lines[l], textX, textY); + } + + context.fillText(lines[l], textX, textY); + textY += lineHeight; + } + } else { + if (lineWidth > 0) { + context.strokeText(text, textX, textY); + } + + context.fillText(text, textX, textY); + } + + if (theta !== 0) { + context.rotate(-theta); + context.translate(-orgTextX, -orgTextY); + } + } +}; + +/* global Path2D */ +var CRp$5 = {}; + +CRp$5.drawNode = function (context, node, shiftToOriginWithBb) { + var drawLabel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + var r = this; + var nodeWidth, nodeHeight; + var _p = node._private; + var rs = _p.rscratch; + var pos = node.position(); + + if (!number$1(pos.x) || !number$1(pos.y)) { + return; // can't draw node with undefined position + } + + if (shouldDrawOpacity && !node.visible()) { + return; + } + + var eleOpacity = shouldDrawOpacity ? node.effectiveOpacity() : 1; + var usePaths = r.usePaths(); + var path; + var pathCacheHit = false; + var padding = node.padding(); + nodeWidth = node.width() + 2 * padding; + nodeHeight = node.height() + 2 * padding; // + // setup shift + + var bb; + + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } // + // load bg image + + + var bgImgProp = node.pstyle('background-image'); + var urls = bgImgProp.value; + var urlDefined = new Array(urls.length); + var image = new Array(urls.length); + var numImages = 0; + + for (var i = 0; i < urls.length; i++) { + var url = urls[i]; + var defd = urlDefined[i] = url != null && url !== 'none'; + + if (defd) { + var bgImgCrossOrigin = node.cy().style().getIndexedStyle(node, 'background-image-crossorigin', 'value', i); + numImages++; // get image, and if not loaded then ask to redraw when later loaded + + image[i] = r.getCachedImage(url, bgImgCrossOrigin, function () { + _p.backgroundTimestamp = Date.now(); + node.emitAndNotify('background'); + }); + } + } // + // setup styles + + + var darkness = node.pstyle('background-blacken').value; + var borderWidth = node.pstyle('border-width').pfValue; + var bgOpacity = node.pstyle('background-opacity').value * eleOpacity; + var borderColor = node.pstyle('border-color').value; + var borderStyle = node.pstyle('border-style').value; + var borderOpacity = node.pstyle('border-opacity').value * eleOpacity; + context.lineJoin = 'miter'; // so borders are square with the node shape + + var setupShapeColor = function setupShapeColor() { + var bgOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : bgOpacity; + r.eleFillStyle(context, node, bgOpy); + }; + + var setupBorderColor = function setupBorderColor() { + var bdrOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : borderOpacity; + r.colorStrokeStyle(context, borderColor[0], borderColor[1], borderColor[2], bdrOpy); + }; // + // setup shape + + + var styleShape = node.pstyle('shape').strValue; + var shapePts = node.pstyle('shape-polygon-points').pfValue; + + if (usePaths) { + context.translate(pos.x, pos.y); + var pathCache = r.nodePathCache = r.nodePathCache || []; + var key = hashStrings(styleShape === 'polygon' ? styleShape + ',' + shapePts.join(',') : styleShape, '' + nodeHeight, '' + nodeWidth); + var cachedPath = pathCache[key]; + + if (cachedPath != null) { + path = cachedPath; + pathCacheHit = true; + rs.pathCache = path; + } else { + path = new Path2D(); + pathCache[key] = rs.pathCache = path; + } + } + + var drawShape = function drawShape() { + if (!pathCacheHit) { + var npos = pos; + + if (usePaths) { + npos = { + x: 0, + y: 0 + }; + } + + r.nodeShapes[r.getNodeShape(node)].draw(path || context, npos.x, npos.y, nodeWidth, nodeHeight); + } + + if (usePaths) { + context.fill(path); + } else { + context.fill(); + } + }; + + var drawImages = function drawImages() { + var nodeOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : eleOpacity; + var inside = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var prevBging = _p.backgrounding; + var totalCompleted = 0; + + for (var _i = 0; _i < image.length; _i++) { + var bgContainment = node.cy().style().getIndexedStyle(node, 'background-image-containment', 'value', _i); + + if (inside && bgContainment === 'over' || !inside && bgContainment === 'inside') { + totalCompleted++; + continue; + } + + if (urlDefined[_i] && image[_i].complete && !image[_i].error) { + totalCompleted++; + r.drawInscribedImage(context, image[_i], node, _i, nodeOpacity); + } + } + + _p.backgrounding = !(totalCompleted === numImages); + + if (prevBging !== _p.backgrounding) { + // update style b/c :backgrounding state changed + node.updateStyle(false); + } + }; + + var drawPie = function drawPie() { + var redrawShape = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var pieOpacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : eleOpacity; + + if (r.hasPie(node)) { + r.drawPie(context, node, pieOpacity); // redraw/restore path if steps after pie need it + + if (redrawShape) { + if (!usePaths) { + r.nodeShapes[r.getNodeShape(node)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight); + } + } + } + }; + + var darken = function darken() { + var darkenOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : eleOpacity; + var opacity = (darkness > 0 ? darkness : -darkness) * darkenOpacity; + var c = darkness > 0 ? 0 : 255; + + if (darkness !== 0) { + r.colorFillStyle(context, c, c, c, opacity); + + if (usePaths) { + context.fill(path); + } else { + context.fill(); + } + } + }; + + var drawBorder = function drawBorder() { + if (borderWidth > 0) { + context.lineWidth = borderWidth; + context.lineCap = 'butt'; + + if (context.setLineDash) { + // for very outofdate browsers + switch (borderStyle) { + case 'dotted': + context.setLineDash([1, 1]); + break; + + case 'dashed': + context.setLineDash([4, 2]); + break; + + case 'solid': + case 'double': + context.setLineDash([]); + break; + } + } + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } + + if (borderStyle === 'double') { + context.lineWidth = borderWidth / 3; + var gco = context.globalCompositeOperation; + context.globalCompositeOperation = 'destination-out'; + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } + + context.globalCompositeOperation = gco; + } // reset in case we changed the border style + + + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } + } + }; + + var drawOverlay = function drawOverlay() { + if (shouldDrawOverlay) { + r.drawNodeOverlay(context, node, pos, nodeWidth, nodeHeight); + } + }; + + var drawUnderlay = function drawUnderlay() { + if (shouldDrawOverlay) { + r.drawNodeUnderlay(context, node, pos, nodeWidth, nodeHeight); + } + }; + + var drawText = function drawText() { + r.drawElementText(context, node, null, drawLabel); + }; + + var ghost = node.pstyle('ghost').value === 'yes'; + + if (ghost) { + var gx = node.pstyle('ghost-offset-x').pfValue; + var gy = node.pstyle('ghost-offset-y').pfValue; + var ghostOpacity = node.pstyle('ghost-opacity').value; + var effGhostOpacity = ghostOpacity * eleOpacity; + context.translate(gx, gy); + setupShapeColor(ghostOpacity * bgOpacity); + drawShape(); + drawImages(effGhostOpacity, true); + setupBorderColor(ghostOpacity * borderOpacity); + drawBorder(); + drawPie(darkness !== 0 || borderWidth !== 0); + drawImages(effGhostOpacity, false); + darken(effGhostOpacity); + context.translate(-gx, -gy); + } + + if (usePaths) { + context.translate(-pos.x, -pos.y); + } + + drawUnderlay(); + + if (usePaths) { + context.translate(pos.x, pos.y); + } + + setupShapeColor(); + drawShape(); + drawImages(eleOpacity, true); + setupBorderColor(); + drawBorder(); + drawPie(darkness !== 0 || borderWidth !== 0); + drawImages(eleOpacity, false); + darken(); + + if (usePaths) { + context.translate(-pos.x, -pos.y); + } + + drawText(); + drawOverlay(); // + // clean up shift + + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } +}; + +var drawNodeOverlayUnderlay = function drawNodeOverlayUnderlay(overlayOrUnderlay) { + if (!['overlay', 'underlay'].includes(overlayOrUnderlay)) { + throw new Error('Invalid state'); + } + + return function (context, node, pos, nodeWidth, nodeHeight) { + var r = this; + + if (!node.visible()) { + return; + } + + var padding = node.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue; + var opacity = node.pstyle("".concat(overlayOrUnderlay, "-opacity")).value; + var color = node.pstyle("".concat(overlayOrUnderlay, "-color")).value; + var shape = node.pstyle("".concat(overlayOrUnderlay, "-shape")).value; + + if (opacity > 0) { + pos = pos || node.position(); + + if (nodeWidth == null || nodeHeight == null) { + var _padding = node.padding(); + + nodeWidth = node.width() + 2 * _padding; + nodeHeight = node.height() + 2 * _padding; + } + + r.colorFillStyle(context, color[0], color[1], color[2], opacity); + r.nodeShapes[shape].draw(context, pos.x, pos.y, nodeWidth + padding * 2, nodeHeight + padding * 2); + context.fill(); + } + }; +}; + +CRp$5.drawNodeOverlay = drawNodeOverlayUnderlay('overlay'); +CRp$5.drawNodeUnderlay = drawNodeOverlayUnderlay('underlay'); // does the node have at least one pie piece? + +CRp$5.hasPie = function (node) { + node = node[0]; // ensure ele ref + + return node._private.hasPie; +}; + +CRp$5.drawPie = function (context, node, nodeOpacity, pos) { + node = node[0]; // ensure ele ref + + pos = pos || node.position(); + var cyStyle = node.cy().style(); + var pieSize = node.pstyle('pie-size'); + var x = pos.x; + var y = pos.y; + var nodeW = node.width(); + var nodeH = node.height(); + var radius = Math.min(nodeW, nodeH) / 2; // must fit in node + + var lastPercent = 0; // what % to continue drawing pie slices from on [0, 1] + + var usePaths = this.usePaths(); + + if (usePaths) { + x = 0; + y = 0; + } + + if (pieSize.units === '%') { + radius = radius * pieSize.pfValue; + } else if (pieSize.pfValue !== undefined) { + radius = pieSize.pfValue / 2; + } + + for (var i = 1; i <= cyStyle.pieBackgroundN; i++) { + // 1..N + var size = node.pstyle('pie-' + i + '-background-size').value; + var color = node.pstyle('pie-' + i + '-background-color').value; + var opacity = node.pstyle('pie-' + i + '-background-opacity').value * nodeOpacity; + var percent = size / 100; // map integer range [0, 100] to [0, 1] + // percent can't push beyond 1 + + if (percent + lastPercent > 1) { + percent = 1 - lastPercent; + } + + var angleStart = 1.5 * Math.PI + 2 * Math.PI * lastPercent; // start at 12 o'clock and go clockwise + + var angleDelta = 2 * Math.PI * percent; + var angleEnd = angleStart + angleDelta; // ignore if + // - zero size + // - we're already beyond the full circle + // - adding the current slice would go beyond the full circle + + if (size === 0 || lastPercent >= 1 || lastPercent + percent > 1) { + continue; + } + + context.beginPath(); + context.moveTo(x, y); + context.arc(x, y, radius, angleStart, angleEnd); + context.closePath(); + this.colorFillStyle(context, color[0], color[1], color[2], opacity); + context.fill(); + lastPercent += percent; + } +}; + +var CRp$4 = {}; +var motionBlurDelay = 100; // var isFirefox = typeof InstallTrigger !== 'undefined'; + +CRp$4.getPixelRatio = function () { + var context = this.data.contexts[0]; + + if (this.forcedPixelRatio != null) { + return this.forcedPixelRatio; + } + + var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; + return (window.devicePixelRatio || 1) / backingStore; // eslint-disable-line no-undef +}; + +CRp$4.paintCache = function (context) { + var caches = this.paintCaches = this.paintCaches || []; + var needToCreateCache = true; + var cache; + + for (var i = 0; i < caches.length; i++) { + cache = caches[i]; + + if (cache.context === context) { + needToCreateCache = false; + break; + } + } + + if (needToCreateCache) { + cache = { + context: context + }; + caches.push(cache); + } + + return cache; +}; + +CRp$4.createGradientStyleFor = function (context, shapeStyleName, ele, fill, opacity) { + var gradientStyle; + var usePaths = this.usePaths(); + var colors = ele.pstyle(shapeStyleName + '-gradient-stop-colors').value, + positions = ele.pstyle(shapeStyleName + '-gradient-stop-positions').pfValue; + + if (fill === 'radial-gradient') { + if (ele.isEdge()) { + var start = ele.sourceEndpoint(), + end = ele.targetEndpoint(), + mid = ele.midpoint(); + var d1 = dist(start, mid); + var d2 = dist(end, mid); + gradientStyle = context.createRadialGradient(mid.x, mid.y, 0, mid.x, mid.y, Math.max(d1, d2)); + } else { + var pos = usePaths ? { + x: 0, + y: 0 + } : ele.position(), + width = ele.paddedWidth(), + height = ele.paddedHeight(); + gradientStyle = context.createRadialGradient(pos.x, pos.y, 0, pos.x, pos.y, Math.max(width, height)); + } + } else { + if (ele.isEdge()) { + var _start = ele.sourceEndpoint(), + _end = ele.targetEndpoint(); + + gradientStyle = context.createLinearGradient(_start.x, _start.y, _end.x, _end.y); + } else { + var _pos = usePaths ? { + x: 0, + y: 0 + } : ele.position(), + _width = ele.paddedWidth(), + _height = ele.paddedHeight(), + halfWidth = _width / 2, + halfHeight = _height / 2; + + var direction = ele.pstyle('background-gradient-direction').value; + + switch (direction) { + case 'to-bottom': + gradientStyle = context.createLinearGradient(_pos.x, _pos.y - halfHeight, _pos.x, _pos.y + halfHeight); + break; + + case 'to-top': + gradientStyle = context.createLinearGradient(_pos.x, _pos.y + halfHeight, _pos.x, _pos.y - halfHeight); + break; + + case 'to-left': + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y, _pos.x - halfWidth, _pos.y); + break; + + case 'to-right': + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y, _pos.x + halfWidth, _pos.y); + break; + + case 'to-bottom-right': + case 'to-right-bottom': + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y - halfHeight, _pos.x + halfWidth, _pos.y + halfHeight); + break; + + case 'to-top-right': + case 'to-right-top': + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y + halfHeight, _pos.x + halfWidth, _pos.y - halfHeight); + break; + + case 'to-bottom-left': + case 'to-left-bottom': + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y - halfHeight, _pos.x - halfWidth, _pos.y + halfHeight); + break; + + case 'to-top-left': + case 'to-left-top': + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y + halfHeight, _pos.x - halfWidth, _pos.y - halfHeight); + break; + } + } + } + + if (!gradientStyle) return null; // invalid gradient style + + var hasPositions = positions.length === colors.length; + var length = colors.length; + + for (var i = 0; i < length; i++) { + gradientStyle.addColorStop(hasPositions ? positions[i] : i / (length - 1), 'rgba(' + colors[i][0] + ',' + colors[i][1] + ',' + colors[i][2] + ',' + opacity + ')'); + } + + return gradientStyle; +}; + +CRp$4.gradientFillStyle = function (context, ele, fill, opacity) { + var gradientStyle = this.createGradientStyleFor(context, 'background', ele, fill, opacity); + if (!gradientStyle) return null; // error + + context.fillStyle = gradientStyle; +}; + +CRp$4.colorFillStyle = function (context, r, g, b, a) { + context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; // turn off for now, seems context does its own caching + // var cache = this.paintCache(context); + // var fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; + // if( cache.fillStyle !== fillStyle ){ + // context.fillStyle = cache.fillStyle = fillStyle; + // } +}; + +CRp$4.eleFillStyle = function (context, ele, opacity) { + var backgroundFill = ele.pstyle('background-fill').value; + + if (backgroundFill === 'linear-gradient' || backgroundFill === 'radial-gradient') { + this.gradientFillStyle(context, ele, backgroundFill, opacity); + } else { + var backgroundColor = ele.pstyle('background-color').value; + this.colorFillStyle(context, backgroundColor[0], backgroundColor[1], backgroundColor[2], opacity); + } +}; + +CRp$4.gradientStrokeStyle = function (context, ele, fill, opacity) { + var gradientStyle = this.createGradientStyleFor(context, 'line', ele, fill, opacity); + if (!gradientStyle) return null; // error + + context.strokeStyle = gradientStyle; +}; + +CRp$4.colorStrokeStyle = function (context, r, g, b, a) { + context.strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; // turn off for now, seems context does its own caching + // var cache = this.paintCache(context); + // var strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; + // if( cache.strokeStyle !== strokeStyle ){ + // context.strokeStyle = cache.strokeStyle = strokeStyle; + // } +}; + +CRp$4.eleStrokeStyle = function (context, ele, opacity) { + var lineFill = ele.pstyle('line-fill').value; + + if (lineFill === 'linear-gradient' || lineFill === 'radial-gradient') { + this.gradientStrokeStyle(context, ele, lineFill, opacity); + } else { + var lineColor = ele.pstyle('line-color').value; + this.colorStrokeStyle(context, lineColor[0], lineColor[1], lineColor[2], opacity); + } +}; // Resize canvas + + +CRp$4.matchCanvasSize = function (container) { + var r = this; + var data = r.data; + var bb = r.findContainerClientCoords(); + var width = bb[2]; + var height = bb[3]; + var pixelRatio = r.getPixelRatio(); + var mbPxRatio = r.motionBlurPxRatio; + + if (container === r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE] || container === r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG]) { + pixelRatio = mbPxRatio; + } + + var canvasWidth = width * pixelRatio; + var canvasHeight = height * pixelRatio; + var canvas; + + if (canvasWidth === r.canvasWidth && canvasHeight === r.canvasHeight) { + return; // save cycles if same + } + + r.fontCaches = null; // resizing resets the style + + var canvasContainer = data.canvasContainer; + canvasContainer.style.width = width + 'px'; + canvasContainer.style.height = height + 'px'; + + for (var i = 0; i < r.CANVAS_LAYERS; i++) { + canvas = data.canvases[i]; + canvas.width = canvasWidth; + canvas.height = canvasHeight; + canvas.style.width = width + 'px'; + canvas.style.height = height + 'px'; + } + + for (var i = 0; i < r.BUFFER_COUNT; i++) { + canvas = data.bufferCanvases[i]; + canvas.width = canvasWidth; + canvas.height = canvasHeight; + canvas.style.width = width + 'px'; + canvas.style.height = height + 'px'; + } + + r.textureMult = 1; + + if (pixelRatio <= 1) { + canvas = data.bufferCanvases[r.TEXTURE_BUFFER]; + r.textureMult = 2; + canvas.width = canvasWidth * r.textureMult; + canvas.height = canvasHeight * r.textureMult; + } + + r.canvasWidth = canvasWidth; + r.canvasHeight = canvasHeight; +}; + +CRp$4.renderTo = function (cxt, zoom, pan, pxRatio) { + this.render({ + forcedContext: cxt, + forcedZoom: zoom, + forcedPan: pan, + drawAllLayers: true, + forcedPxRatio: pxRatio + }); +}; + +CRp$4.render = function (options) { + options = options || staticEmptyObject(); + var forcedContext = options.forcedContext; + var drawAllLayers = options.drawAllLayers; + var drawOnlyNodeLayer = options.drawOnlyNodeLayer; + var forcedZoom = options.forcedZoom; + var forcedPan = options.forcedPan; + var r = this; + var pixelRatio = options.forcedPxRatio === undefined ? this.getPixelRatio() : options.forcedPxRatio; + var cy = r.cy; + var data = r.data; + var needDraw = data.canvasNeedsRedraw; + var textureDraw = r.textureOnViewport && !forcedContext && (r.pinching || r.hoverData.dragging || r.swipePanning || r.data.wheelZooming); + var motionBlur = options.motionBlur !== undefined ? options.motionBlur : r.motionBlur; + var mbPxRatio = r.motionBlurPxRatio; + var hasCompoundNodes = cy.hasCompoundNodes(); + var inNodeDragGesture = r.hoverData.draggingEles; + var inBoxSelection = r.hoverData.selecting || r.touchData.selecting ? true : false; + motionBlur = motionBlur && !forcedContext && r.motionBlurEnabled && !inBoxSelection; + var motionBlurFadeEffect = motionBlur; + + if (!forcedContext) { + if (r.prevPxRatio !== pixelRatio) { + r.invalidateContainerClientCoordsCache(); + r.matchCanvasSize(r.container); + r.redrawHint('eles', true); + r.redrawHint('drag', true); + } + + r.prevPxRatio = pixelRatio; + } + + if (!forcedContext && r.motionBlurTimeout) { + clearTimeout(r.motionBlurTimeout); + } + + if (motionBlur) { + if (r.mbFrames == null) { + r.mbFrames = 0; + } + + r.mbFrames++; + + if (r.mbFrames < 3) { + // need several frames before even high quality motionblur + motionBlurFadeEffect = false; + } // go to lower quality blurry frames when several m/b frames have been rendered (avoids flashing) + + + if (r.mbFrames > r.minMbLowQualFrames) { + //r.fullQualityMb = false; + r.motionBlurPxRatio = r.mbPxRBlurry; + } + } + + if (r.clearingMotionBlur) { + r.motionBlurPxRatio = 1; + } // b/c drawToContext() may be async w.r.t. redraw(), keep track of last texture frame + // because a rogue async texture frame would clear needDraw + + + if (r.textureDrawLastFrame && !textureDraw) { + needDraw[r.NODE] = true; + needDraw[r.SELECT_BOX] = true; + } + + var style = cy.style(); + var zoom = cy.zoom(); + var effectiveZoom = forcedZoom !== undefined ? forcedZoom : zoom; + var pan = cy.pan(); + var effectivePan = { + x: pan.x, + y: pan.y + }; + var vp = { + zoom: zoom, + pan: { + x: pan.x, + y: pan.y + } + }; + var prevVp = r.prevViewport; + var viewportIsDiff = prevVp === undefined || vp.zoom !== prevVp.zoom || vp.pan.x !== prevVp.pan.x || vp.pan.y !== prevVp.pan.y; // we want the low quality motionblur only when the viewport is being manipulated etc (where it's not noticed) + + if (!viewportIsDiff && !(inNodeDragGesture && !hasCompoundNodes)) { + r.motionBlurPxRatio = 1; + } + + if (forcedPan) { + effectivePan = forcedPan; + } // apply pixel ratio + + + effectiveZoom *= pixelRatio; + effectivePan.x *= pixelRatio; + effectivePan.y *= pixelRatio; + var eles = r.getCachedZSortedEles(); + + function mbclear(context, x, y, w, h) { + var gco = context.globalCompositeOperation; + context.globalCompositeOperation = 'destination-out'; + r.colorFillStyle(context, 255, 255, 255, r.motionBlurTransparency); + context.fillRect(x, y, w, h); + context.globalCompositeOperation = gco; + } + + function setContextTransform(context, clear) { + var ePan, eZoom, w, h; + + if (!r.clearingMotionBlur && (context === data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE] || context === data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG])) { + ePan = { + x: pan.x * mbPxRatio, + y: pan.y * mbPxRatio + }; + eZoom = zoom * mbPxRatio; + w = r.canvasWidth * mbPxRatio; + h = r.canvasHeight * mbPxRatio; + } else { + ePan = effectivePan; + eZoom = effectiveZoom; + w = r.canvasWidth; + h = r.canvasHeight; + } + + context.setTransform(1, 0, 0, 1, 0, 0); + + if (clear === 'motionBlur') { + mbclear(context, 0, 0, w, h); + } else if (!forcedContext && (clear === undefined || clear)) { + context.clearRect(0, 0, w, h); + } + + if (!drawAllLayers) { + context.translate(ePan.x, ePan.y); + context.scale(eZoom, eZoom); + } + + if (forcedPan) { + context.translate(forcedPan.x, forcedPan.y); + } + + if (forcedZoom) { + context.scale(forcedZoom, forcedZoom); + } + } + + if (!textureDraw) { + r.textureDrawLastFrame = false; + } + + if (textureDraw) { + r.textureDrawLastFrame = true; + + if (!r.textureCache) { + r.textureCache = {}; + r.textureCache.bb = cy.mutableElements().boundingBox(); + r.textureCache.texture = r.data.bufferCanvases[r.TEXTURE_BUFFER]; + var cxt = r.data.bufferContexts[r.TEXTURE_BUFFER]; + cxt.setTransform(1, 0, 0, 1, 0, 0); + cxt.clearRect(0, 0, r.canvasWidth * r.textureMult, r.canvasHeight * r.textureMult); + r.render({ + forcedContext: cxt, + drawOnlyNodeLayer: true, + forcedPxRatio: pixelRatio * r.textureMult + }); + var vp = r.textureCache.viewport = { + zoom: cy.zoom(), + pan: cy.pan(), + width: r.canvasWidth, + height: r.canvasHeight + }; + vp.mpan = { + x: (0 - vp.pan.x) / vp.zoom, + y: (0 - vp.pan.y) / vp.zoom + }; + } + + needDraw[r.DRAG] = false; + needDraw[r.NODE] = false; + var context = data.contexts[r.NODE]; + var texture = r.textureCache.texture; + var vp = r.textureCache.viewport; + context.setTransform(1, 0, 0, 1, 0, 0); + + if (motionBlur) { + mbclear(context, 0, 0, vp.width, vp.height); + } else { + context.clearRect(0, 0, vp.width, vp.height); + } + + var outsideBgColor = style.core('outside-texture-bg-color').value; + var outsideBgOpacity = style.core('outside-texture-bg-opacity').value; + r.colorFillStyle(context, outsideBgColor[0], outsideBgColor[1], outsideBgColor[2], outsideBgOpacity); + context.fillRect(0, 0, vp.width, vp.height); + var zoom = cy.zoom(); + setContextTransform(context, false); + context.clearRect(vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio); + context.drawImage(texture, vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio); + } else if (r.textureOnViewport && !forcedContext) { + // clear the cache since we don't need it + r.textureCache = null; + } + + var extent = cy.extent(); + var vpManip = r.pinching || r.hoverData.dragging || r.swipePanning || r.data.wheelZooming || r.hoverData.draggingEles || r.cy.animated(); + var hideEdges = r.hideEdgesOnViewport && vpManip; + var needMbClear = []; + needMbClear[r.NODE] = !needDraw[r.NODE] && motionBlur && !r.clearedForMotionBlur[r.NODE] || r.clearingMotionBlur; + + if (needMbClear[r.NODE]) { + r.clearedForMotionBlur[r.NODE] = true; + } + + needMbClear[r.DRAG] = !needDraw[r.DRAG] && motionBlur && !r.clearedForMotionBlur[r.DRAG] || r.clearingMotionBlur; + + if (needMbClear[r.DRAG]) { + r.clearedForMotionBlur[r.DRAG] = true; + } + + if (needDraw[r.NODE] || drawAllLayers || drawOnlyNodeLayer || needMbClear[r.NODE]) { + var useBuffer = motionBlur && !needMbClear[r.NODE] && mbPxRatio !== 1; + var context = forcedContext || (useBuffer ? r.data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE] : data.contexts[r.NODE]); + var clear = motionBlur && !useBuffer ? 'motionBlur' : undefined; + setContextTransform(context, clear); + + if (hideEdges) { + r.drawCachedNodes(context, eles.nondrag, pixelRatio, extent); + } else { + r.drawLayeredElements(context, eles.nondrag, pixelRatio, extent); + } + + if (r.debug) { + r.drawDebugPoints(context, eles.nondrag); + } + + if (!drawAllLayers && !motionBlur) { + needDraw[r.NODE] = false; + } + } + + if (!drawOnlyNodeLayer && (needDraw[r.DRAG] || drawAllLayers || needMbClear[r.DRAG])) { + var useBuffer = motionBlur && !needMbClear[r.DRAG] && mbPxRatio !== 1; + var context = forcedContext || (useBuffer ? r.data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG] : data.contexts[r.DRAG]); + setContextTransform(context, motionBlur && !useBuffer ? 'motionBlur' : undefined); + + if (hideEdges) { + r.drawCachedNodes(context, eles.drag, pixelRatio, extent); + } else { + r.drawCachedElements(context, eles.drag, pixelRatio, extent); + } + + if (r.debug) { + r.drawDebugPoints(context, eles.drag); + } + + if (!drawAllLayers && !motionBlur) { + needDraw[r.DRAG] = false; + } + } + + if (r.showFps || !drawOnlyNodeLayer && needDraw[r.SELECT_BOX] && !drawAllLayers) { + var context = forcedContext || data.contexts[r.SELECT_BOX]; + setContextTransform(context); + + if (r.selection[4] == 1 && (r.hoverData.selecting || r.touchData.selecting)) { + var zoom = r.cy.zoom(); + var borderWidth = style.core('selection-box-border-width').value / zoom; + context.lineWidth = borderWidth; + context.fillStyle = 'rgba(' + style.core('selection-box-color').value[0] + ',' + style.core('selection-box-color').value[1] + ',' + style.core('selection-box-color').value[2] + ',' + style.core('selection-box-opacity').value + ')'; + context.fillRect(r.selection[0], r.selection[1], r.selection[2] - r.selection[0], r.selection[3] - r.selection[1]); + + if (borderWidth > 0) { + context.strokeStyle = 'rgba(' + style.core('selection-box-border-color').value[0] + ',' + style.core('selection-box-border-color').value[1] + ',' + style.core('selection-box-border-color').value[2] + ',' + style.core('selection-box-opacity').value + ')'; + context.strokeRect(r.selection[0], r.selection[1], r.selection[2] - r.selection[0], r.selection[3] - r.selection[1]); + } + } + + if (data.bgActivePosistion && !r.hoverData.selecting) { + var zoom = r.cy.zoom(); + var pos = data.bgActivePosistion; + context.fillStyle = 'rgba(' + style.core('active-bg-color').value[0] + ',' + style.core('active-bg-color').value[1] + ',' + style.core('active-bg-color').value[2] + ',' + style.core('active-bg-opacity').value + ')'; + context.beginPath(); + context.arc(pos.x, pos.y, style.core('active-bg-size').pfValue / zoom, 0, 2 * Math.PI); + context.fill(); + } + + var timeToRender = r.lastRedrawTime; + + if (r.showFps && timeToRender) { + timeToRender = Math.round(timeToRender); + var fps = Math.round(1000 / timeToRender); + context.setTransform(1, 0, 0, 1, 0, 0); + context.fillStyle = 'rgba(255, 0, 0, 0.75)'; + context.strokeStyle = 'rgba(255, 0, 0, 0.75)'; + context.lineWidth = 1; + context.fillText('1 frame = ' + timeToRender + ' ms = ' + fps + ' fps', 0, 20); + var maxFps = 60; + context.strokeRect(0, 30, 250, 20); + context.fillRect(0, 30, 250 * Math.min(fps / maxFps, 1), 20); + } + + if (!drawAllLayers) { + needDraw[r.SELECT_BOX] = false; + } + } // motionblur: blit rendered blurry frames + + + if (motionBlur && mbPxRatio !== 1) { + var cxtNode = data.contexts[r.NODE]; + var txtNode = r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE]; + var cxtDrag = data.contexts[r.DRAG]; + var txtDrag = r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG]; + + var drawMotionBlur = function drawMotionBlur(cxt, txt, needClear) { + cxt.setTransform(1, 0, 0, 1, 0, 0); + + if (needClear || !motionBlurFadeEffect) { + cxt.clearRect(0, 0, r.canvasWidth, r.canvasHeight); + } else { + mbclear(cxt, 0, 0, r.canvasWidth, r.canvasHeight); + } + + var pxr = mbPxRatio; + cxt.drawImage(txt, // img + 0, 0, // sx, sy + r.canvasWidth * pxr, r.canvasHeight * pxr, // sw, sh + 0, 0, // x, y + r.canvasWidth, r.canvasHeight // w, h + ); + }; + + if (needDraw[r.NODE] || needMbClear[r.NODE]) { + drawMotionBlur(cxtNode, txtNode, needMbClear[r.NODE]); + needDraw[r.NODE] = false; + } + + if (needDraw[r.DRAG] || needMbClear[r.DRAG]) { + drawMotionBlur(cxtDrag, txtDrag, needMbClear[r.DRAG]); + needDraw[r.DRAG] = false; + } + } + + r.prevViewport = vp; + + if (r.clearingMotionBlur) { + r.clearingMotionBlur = false; + r.motionBlurCleared = true; + r.motionBlur = true; + } + + if (motionBlur) { + r.motionBlurTimeout = setTimeout(function () { + r.motionBlurTimeout = null; + r.clearedForMotionBlur[r.NODE] = false; + r.clearedForMotionBlur[r.DRAG] = false; + r.motionBlur = false; + r.clearingMotionBlur = !textureDraw; + r.mbFrames = 0; + needDraw[r.NODE] = true; + needDraw[r.DRAG] = true; + r.redraw(); + }, motionBlurDelay); + } + + if (!forcedContext) { + cy.emit('render'); + } +}; + +var CRp$3 = {}; // @O Polygon drawing + +CRp$3.drawPolygonPath = function (context, x, y, width, height, points) { + var halfW = width / 2; + var halfH = height / 2; + + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(x + halfW * points[0], y + halfH * points[1]); + + for (var i = 1; i < points.length / 2; i++) { + context.lineTo(x + halfW * points[i * 2], y + halfH * points[i * 2 + 1]); + } + + context.closePath(); +}; + +CRp$3.drawRoundPolygonPath = function (context, x, y, width, height, points) { + var halfW = width / 2; + var halfH = height / 2; + var cornerRadius = getRoundPolygonRadius(width, height); + + if (context.beginPath) { + context.beginPath(); + } + + for (var _i = 0; _i < points.length / 4; _i++) { + var sourceUv = void 0, + destUv = void 0; + + if (_i === 0) { + sourceUv = points.length - 2; + } else { + sourceUv = _i * 4 - 2; + } + + destUv = _i * 4 + 2; + var px = x + halfW * points[_i * 4]; + var py = y + halfH * points[_i * 4 + 1]; + var cosTheta = -points[sourceUv] * points[destUv] - points[sourceUv + 1] * points[destUv + 1]; + var offset = cornerRadius / Math.tan(Math.acos(cosTheta) / 2); + var cp0x = px - offset * points[sourceUv]; + var cp0y = py - offset * points[sourceUv + 1]; + var cp1x = px + offset * points[destUv]; + var cp1y = py + offset * points[destUv + 1]; + + if (_i === 0) { + context.moveTo(cp0x, cp0y); + } else { + context.lineTo(cp0x, cp0y); + } + + context.arcTo(px, py, cp1x, cp1y, cornerRadius); + } + + context.closePath(); +}; // Round rectangle drawing + + +CRp$3.drawRoundRectanglePath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var cornerRadius = getRoundRectangleRadius(width, height); + + if (context.beginPath) { + context.beginPath(); + } // Start at top middle + + + context.moveTo(x, y - halfHeight); // Arc from middle top to right side + + context.arcTo(x + halfWidth, y - halfHeight, x + halfWidth, y, cornerRadius); // Arc from right side to bottom + + context.arcTo(x + halfWidth, y + halfHeight, x, y + halfHeight, cornerRadius); // Arc from bottom to left side + + context.arcTo(x - halfWidth, y + halfHeight, x - halfWidth, y, cornerRadius); // Arc from left side to topBorder + + context.arcTo(x - halfWidth, y - halfHeight, x, y - halfHeight, cornerRadius); // Join line + + context.lineTo(x, y - halfHeight); + context.closePath(); +}; + +CRp$3.drawBottomRoundRectanglePath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var cornerRadius = getRoundRectangleRadius(width, height); + + if (context.beginPath) { + context.beginPath(); + } // Start at top middle + + + context.moveTo(x, y - halfHeight); + context.lineTo(x + halfWidth, y - halfHeight); + context.lineTo(x + halfWidth, y); + context.arcTo(x + halfWidth, y + halfHeight, x, y + halfHeight, cornerRadius); + context.arcTo(x - halfWidth, y + halfHeight, x - halfWidth, y, cornerRadius); + context.lineTo(x - halfWidth, y - halfHeight); + context.lineTo(x, y - halfHeight); + context.closePath(); +}; + +CRp$3.drawCutRectanglePath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var cornerLength = getCutRectangleCornerLength(); + + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(x - halfWidth + cornerLength, y - halfHeight); + context.lineTo(x + halfWidth - cornerLength, y - halfHeight); + context.lineTo(x + halfWidth, y - halfHeight + cornerLength); + context.lineTo(x + halfWidth, y + halfHeight - cornerLength); + context.lineTo(x + halfWidth - cornerLength, y + halfHeight); + context.lineTo(x - halfWidth + cornerLength, y + halfHeight); + context.lineTo(x - halfWidth, y + halfHeight - cornerLength); + context.lineTo(x - halfWidth, y - halfHeight + cornerLength); + context.closePath(); +}; + +CRp$3.drawBarrelPath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var xBegin = x - halfWidth; + var xEnd = x + halfWidth; + var yBegin = y - halfHeight; + var yEnd = y + halfHeight; + var barrelCurveConstants = getBarrelCurveConstants(width, height); + var wOffset = barrelCurveConstants.widthOffset; + var hOffset = barrelCurveConstants.heightOffset; + var ctrlPtXOffset = barrelCurveConstants.ctrlPtOffsetPct * wOffset; + + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(xBegin, yBegin + hOffset); + context.lineTo(xBegin, yEnd - hOffset); + context.quadraticCurveTo(xBegin + ctrlPtXOffset, yEnd, xBegin + wOffset, yEnd); + context.lineTo(xEnd - wOffset, yEnd); + context.quadraticCurveTo(xEnd - ctrlPtXOffset, yEnd, xEnd, yEnd - hOffset); + context.lineTo(xEnd, yBegin + hOffset); + context.quadraticCurveTo(xEnd - ctrlPtXOffset, yBegin, xEnd - wOffset, yBegin); + context.lineTo(xBegin + wOffset, yBegin); + context.quadraticCurveTo(xBegin + ctrlPtXOffset, yBegin, xBegin, yBegin + hOffset); + context.closePath(); +}; + +var sin0 = Math.sin(0); +var cos0 = Math.cos(0); +var sin = {}; +var cos = {}; +var ellipseStepSize = Math.PI / 40; + +for (var i = 0 * Math.PI; i < 2 * Math.PI; i += ellipseStepSize) { + sin[i] = Math.sin(i); + cos[i] = Math.cos(i); +} + +CRp$3.drawEllipsePath = function (context, centerX, centerY, width, height) { + if (context.beginPath) { + context.beginPath(); + } + + if (context.ellipse) { + context.ellipse(centerX, centerY, width / 2, height / 2, 0, 0, 2 * Math.PI); + } else { + var xPos, yPos; + var rw = width / 2; + var rh = height / 2; + + for (var i = 0 * Math.PI; i < 2 * Math.PI; i += ellipseStepSize) { + xPos = centerX - rw * sin[i] * sin0 + rw * cos[i] * cos0; + yPos = centerY + rh * cos[i] * sin0 + rh * sin[i] * cos0; + + if (i === 0) { + context.moveTo(xPos, yPos); + } else { + context.lineTo(xPos, yPos); + } + } + } + + context.closePath(); +}; + +/* global atob, ArrayBuffer, Uint8Array, Blob */ +var CRp$2 = {}; + +CRp$2.createBuffer = function (w, h) { + var buffer = document.createElement('canvas'); // eslint-disable-line no-undef + + buffer.width = w; + buffer.height = h; + return [buffer, buffer.getContext('2d')]; +}; + +CRp$2.bufferCanvasImage = function (options) { + var cy = this.cy; + var eles = cy.mutableElements(); + var bb = eles.boundingBox(); + var ctrRect = this.findContainerClientCoords(); + var width = options.full ? Math.ceil(bb.w) : ctrRect[2]; + var height = options.full ? Math.ceil(bb.h) : ctrRect[3]; + var specdMaxDims = number$1(options.maxWidth) || number$1(options.maxHeight); + var pxRatio = this.getPixelRatio(); + var scale = 1; + + if (options.scale !== undefined) { + width *= options.scale; + height *= options.scale; + scale = options.scale; + } else if (specdMaxDims) { + var maxScaleW = Infinity; + var maxScaleH = Infinity; + + if (number$1(options.maxWidth)) { + maxScaleW = scale * options.maxWidth / width; + } + + if (number$1(options.maxHeight)) { + maxScaleH = scale * options.maxHeight / height; + } + + scale = Math.min(maxScaleW, maxScaleH); + width *= scale; + height *= scale; + } + + if (!specdMaxDims) { + width *= pxRatio; + height *= pxRatio; + scale *= pxRatio; + } + + var buffCanvas = document.createElement('canvas'); // eslint-disable-line no-undef + + buffCanvas.width = width; + buffCanvas.height = height; + buffCanvas.style.width = width + 'px'; + buffCanvas.style.height = height + 'px'; + var buffCxt = buffCanvas.getContext('2d'); // Rasterize the layers, but only if container has nonzero size + + if (width > 0 && height > 0) { + buffCxt.clearRect(0, 0, width, height); + buffCxt.globalCompositeOperation = 'source-over'; + var zsortedEles = this.getCachedZSortedEles(); + + if (options.full) { + // draw the full bounds of the graph + buffCxt.translate(-bb.x1 * scale, -bb.y1 * scale); + buffCxt.scale(scale, scale); + this.drawElements(buffCxt, zsortedEles); + buffCxt.scale(1 / scale, 1 / scale); + buffCxt.translate(bb.x1 * scale, bb.y1 * scale); + } else { + // draw the current view + var pan = cy.pan(); + var translation = { + x: pan.x * scale, + y: pan.y * scale + }; + scale *= cy.zoom(); + buffCxt.translate(translation.x, translation.y); + buffCxt.scale(scale, scale); + this.drawElements(buffCxt, zsortedEles); + buffCxt.scale(1 / scale, 1 / scale); + buffCxt.translate(-translation.x, -translation.y); + } // need to fill bg at end like this in order to fill cleared transparent pixels in jpgs + + + if (options.bg) { + buffCxt.globalCompositeOperation = 'destination-over'; + buffCxt.fillStyle = options.bg; + buffCxt.rect(0, 0, width, height); + buffCxt.fill(); + } + } + + return buffCanvas; +}; + +function b64ToBlob(b64, mimeType) { + var bytes = atob(b64); + var buff = new ArrayBuffer(bytes.length); + var buffUint8 = new Uint8Array(buff); + + for (var i = 0; i < bytes.length; i++) { + buffUint8[i] = bytes.charCodeAt(i); + } + + return new Blob([buff], { + type: mimeType + }); +} + +function b64UriToB64(b64uri) { + var i = b64uri.indexOf(','); + return b64uri.substr(i + 1); +} + +function output(options, canvas, mimeType) { + var getB64Uri = function getB64Uri() { + return canvas.toDataURL(mimeType, options.quality); + }; + + switch (options.output) { + case 'blob-promise': + return new Promise$1(function (resolve, reject) { + try { + canvas.toBlob(function (blob) { + if (blob != null) { + resolve(blob); + } else { + reject(new Error('`canvas.toBlob()` sent a null value in its callback')); + } + }, mimeType, options.quality); + } catch (err) { + reject(err); + } + }); + + case 'blob': + return b64ToBlob(b64UriToB64(getB64Uri()), mimeType); + + case 'base64': + return b64UriToB64(getB64Uri()); + + case 'base64uri': + default: + return getB64Uri(); + } +} + +CRp$2.png = function (options) { + return output(options, this.bufferCanvasImage(options), 'image/png'); +}; + +CRp$2.jpg = function (options) { + return output(options, this.bufferCanvasImage(options), 'image/jpeg'); +}; + +var CRp$1 = {}; + +CRp$1.nodeShapeImpl = function (name, context, centerX, centerY, width, height, points) { + switch (name) { + case 'ellipse': + return this.drawEllipsePath(context, centerX, centerY, width, height); + + case 'polygon': + return this.drawPolygonPath(context, centerX, centerY, width, height, points); + + case 'round-polygon': + return this.drawRoundPolygonPath(context, centerX, centerY, width, height, points); + + case 'roundrectangle': + case 'round-rectangle': + return this.drawRoundRectanglePath(context, centerX, centerY, width, height); + + case 'cutrectangle': + case 'cut-rectangle': + return this.drawCutRectanglePath(context, centerX, centerY, width, height); + + case 'bottomroundrectangle': + case 'bottom-round-rectangle': + return this.drawBottomRoundRectanglePath(context, centerX, centerY, width, height); + + case 'barrel': + return this.drawBarrelPath(context, centerX, centerY, width, height); + } +}; + +var CR = CanvasRenderer; +var CRp = CanvasRenderer.prototype; +CRp.CANVAS_LAYERS = 3; // + +CRp.SELECT_BOX = 0; +CRp.DRAG = 1; +CRp.NODE = 2; +CRp.BUFFER_COUNT = 3; // + +CRp.TEXTURE_BUFFER = 0; +CRp.MOTIONBLUR_BUFFER_NODE = 1; +CRp.MOTIONBLUR_BUFFER_DRAG = 2; + +function CanvasRenderer(options) { + var r = this; + r.data = { + canvases: new Array(CRp.CANVAS_LAYERS), + contexts: new Array(CRp.CANVAS_LAYERS), + canvasNeedsRedraw: new Array(CRp.CANVAS_LAYERS), + bufferCanvases: new Array(CRp.BUFFER_COUNT), + bufferContexts: new Array(CRp.CANVAS_LAYERS) + }; + var tapHlOffAttr = '-webkit-tap-highlight-color'; + var tapHlOffStyle = 'rgba(0,0,0,0)'; + r.data.canvasContainer = document.createElement('div'); // eslint-disable-line no-undef + + var containerStyle = r.data.canvasContainer.style; + r.data.canvasContainer.style[tapHlOffAttr] = tapHlOffStyle; + containerStyle.position = 'relative'; + containerStyle.zIndex = '0'; + containerStyle.overflow = 'hidden'; + var container = options.cy.container(); + container.appendChild(r.data.canvasContainer); + container.style[tapHlOffAttr] = tapHlOffStyle; + var styleMap = { + '-webkit-user-select': 'none', + '-moz-user-select': '-moz-none', + 'user-select': 'none', + '-webkit-tap-highlight-color': 'rgba(0,0,0,0)', + 'outline-style': 'none' + }; + + if (ms()) { + styleMap['-ms-touch-action'] = 'none'; + styleMap['touch-action'] = 'none'; + } + + for (var i = 0; i < CRp.CANVAS_LAYERS; i++) { + var canvas = r.data.canvases[i] = document.createElement('canvas'); // eslint-disable-line no-undef + + r.data.contexts[i] = canvas.getContext('2d'); + Object.keys(styleMap).forEach(function (k) { + canvas.style[k] = styleMap[k]; + }); + canvas.style.position = 'absolute'; + canvas.setAttribute('data-id', 'layer' + i); + canvas.style.zIndex = String(CRp.CANVAS_LAYERS - i); + r.data.canvasContainer.appendChild(canvas); + r.data.canvasNeedsRedraw[i] = false; + } + + r.data.topCanvas = r.data.canvases[0]; + r.data.canvases[CRp.NODE].setAttribute('data-id', 'layer' + CRp.NODE + '-node'); + r.data.canvases[CRp.SELECT_BOX].setAttribute('data-id', 'layer' + CRp.SELECT_BOX + '-selectbox'); + r.data.canvases[CRp.DRAG].setAttribute('data-id', 'layer' + CRp.DRAG + '-drag'); + + for (var i = 0; i < CRp.BUFFER_COUNT; i++) { + r.data.bufferCanvases[i] = document.createElement('canvas'); // eslint-disable-line no-undef + + r.data.bufferContexts[i] = r.data.bufferCanvases[i].getContext('2d'); + r.data.bufferCanvases[i].style.position = 'absolute'; + r.data.bufferCanvases[i].setAttribute('data-id', 'buffer' + i); + r.data.bufferCanvases[i].style.zIndex = String(-i - 1); + r.data.bufferCanvases[i].style.visibility = 'hidden'; //r.data.canvasContainer.appendChild(r.data.bufferCanvases[i]); + } + + r.pathsEnabled = true; + var emptyBb = makeBoundingBox(); + + var getBoxCenter = function getBoxCenter(bb) { + return { + x: (bb.x1 + bb.x2) / 2, + y: (bb.y1 + bb.y2) / 2 + }; + }; + + var getCenterOffset = function getCenterOffset(bb) { + return { + x: -bb.w / 2, + y: -bb.h / 2 + }; + }; + + var backgroundTimestampHasChanged = function backgroundTimestampHasChanged(ele) { + var _p = ele[0]._private; + var same = _p.oldBackgroundTimestamp === _p.backgroundTimestamp; + return !same; + }; + + var getStyleKey = function getStyleKey(ele) { + return ele[0]._private.nodeKey; + }; + + var getLabelKey = function getLabelKey(ele) { + return ele[0]._private.labelStyleKey; + }; + + var getSourceLabelKey = function getSourceLabelKey(ele) { + return ele[0]._private.sourceLabelStyleKey; + }; + + var getTargetLabelKey = function getTargetLabelKey(ele) { + return ele[0]._private.targetLabelStyleKey; + }; + + var drawElement = function drawElement(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElement(context, ele, bb, false, false, useEleOpacity); + }; + + var drawLabel = function drawLabel(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElementText(context, ele, bb, scaledLabelShown, 'main', useEleOpacity); + }; + + var drawSourceLabel = function drawSourceLabel(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElementText(context, ele, bb, scaledLabelShown, 'source', useEleOpacity); + }; + + var drawTargetLabel = function drawTargetLabel(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElementText(context, ele, bb, scaledLabelShown, 'target', useEleOpacity); + }; + + var getElementBox = function getElementBox(ele) { + ele.boundingBox(); + return ele[0]._private.bodyBounds; + }; + + var getLabelBox = function getLabelBox(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.main || emptyBb; + }; + + var getSourceLabelBox = function getSourceLabelBox(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.source || emptyBb; + }; + + var getTargetLabelBox = function getTargetLabelBox(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.target || emptyBb; + }; + + var isLabelVisibleAtScale = function isLabelVisibleAtScale(ele, scaledLabelShown) { + return scaledLabelShown; + }; + + var getElementRotationPoint = function getElementRotationPoint(ele) { + return getBoxCenter(getElementBox(ele)); + }; + + var addTextMargin = function addTextMargin(prefix, pt, ele) { + var pre = prefix ? prefix + '-' : ''; + return { + x: pt.x + ele.pstyle(pre + 'text-margin-x').pfValue, + y: pt.y + ele.pstyle(pre + 'text-margin-y').pfValue + }; + }; + + var getRsPt = function getRsPt(ele, x, y) { + var rs = ele[0]._private.rscratch; + return { + x: rs[x], + y: rs[y] + }; + }; + + var getLabelRotationPoint = function getLabelRotationPoint(ele) { + return addTextMargin('', getRsPt(ele, 'labelX', 'labelY'), ele); + }; + + var getSourceLabelRotationPoint = function getSourceLabelRotationPoint(ele) { + return addTextMargin('source', getRsPt(ele, 'sourceLabelX', 'sourceLabelY'), ele); + }; + + var getTargetLabelRotationPoint = function getTargetLabelRotationPoint(ele) { + return addTextMargin('target', getRsPt(ele, 'targetLabelX', 'targetLabelY'), ele); + }; + + var getElementRotationOffset = function getElementRotationOffset(ele) { + return getCenterOffset(getElementBox(ele)); + }; + + var getSourceLabelRotationOffset = function getSourceLabelRotationOffset(ele) { + return getCenterOffset(getSourceLabelBox(ele)); + }; + + var getTargetLabelRotationOffset = function getTargetLabelRotationOffset(ele) { + return getCenterOffset(getTargetLabelBox(ele)); + }; + + var getLabelRotationOffset = function getLabelRotationOffset(ele) { + var bb = getLabelBox(ele); + var p = getCenterOffset(getLabelBox(ele)); + + if (ele.isNode()) { + switch (ele.pstyle('text-halign').value) { + case 'left': + p.x = -bb.w; + break; + + case 'right': + p.x = 0; + break; + } + + switch (ele.pstyle('text-valign').value) { + case 'top': + p.y = -bb.h; + break; + + case 'bottom': + p.y = 0; + break; + } + } + + return p; + }; + + var eleTxrCache = r.data.eleTxrCache = new ElementTextureCache(r, { + getKey: getStyleKey, + doesEleInvalidateKey: backgroundTimestampHasChanged, + drawElement: drawElement, + getBoundingBox: getElementBox, + getRotationPoint: getElementRotationPoint, + getRotationOffset: getElementRotationOffset, + allowEdgeTxrCaching: false, + allowParentTxrCaching: false + }); + var lblTxrCache = r.data.lblTxrCache = new ElementTextureCache(r, { + getKey: getLabelKey, + drawElement: drawLabel, + getBoundingBox: getLabelBox, + getRotationPoint: getLabelRotationPoint, + getRotationOffset: getLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var slbTxrCache = r.data.slbTxrCache = new ElementTextureCache(r, { + getKey: getSourceLabelKey, + drawElement: drawSourceLabel, + getBoundingBox: getSourceLabelBox, + getRotationPoint: getSourceLabelRotationPoint, + getRotationOffset: getSourceLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var tlbTxrCache = r.data.tlbTxrCache = new ElementTextureCache(r, { + getKey: getTargetLabelKey, + drawElement: drawTargetLabel, + getBoundingBox: getTargetLabelBox, + getRotationPoint: getTargetLabelRotationPoint, + getRotationOffset: getTargetLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var lyrTxrCache = r.data.lyrTxrCache = new LayeredTextureCache(r); + r.onUpdateEleCalcs(function invalidateTextureCaches(willDraw, eles) { + // each cache should check for sub-key diff to see that the update affects that cache particularly + eleTxrCache.invalidateElements(eles); + lblTxrCache.invalidateElements(eles); + slbTxrCache.invalidateElements(eles); + tlbTxrCache.invalidateElements(eles); // any change invalidates the layers + + lyrTxrCache.invalidateElements(eles); // update the old bg timestamp so diffs can be done in the ele txr caches + + for (var _i = 0; _i < eles.length; _i++) { + var _p = eles[_i]._private; + _p.oldBackgroundTimestamp = _p.backgroundTimestamp; + } + }); + + var refineInLayers = function refineInLayers(reqs) { + for (var i = 0; i < reqs.length; i++) { + lyrTxrCache.enqueueElementRefinement(reqs[i].ele); + } + }; + + eleTxrCache.onDequeue(refineInLayers); + lblTxrCache.onDequeue(refineInLayers); + slbTxrCache.onDequeue(refineInLayers); + tlbTxrCache.onDequeue(refineInLayers); +} + +CRp.redrawHint = function (group, bool) { + var r = this; + + switch (group) { + case 'eles': + r.data.canvasNeedsRedraw[CRp.NODE] = bool; + break; + + case 'drag': + r.data.canvasNeedsRedraw[CRp.DRAG] = bool; + break; + + case 'select': + r.data.canvasNeedsRedraw[CRp.SELECT_BOX] = bool; + break; + } +}; // whether to use Path2D caching for drawing + + +var pathsImpld = typeof Path2D !== 'undefined'; + +CRp.path2dEnabled = function (on) { + if (on === undefined) { + return this.pathsEnabled; + } + + this.pathsEnabled = on ? true : false; +}; + +CRp.usePaths = function () { + return pathsImpld && this.pathsEnabled; +}; + +CRp.setImgSmoothing = function (context, bool) { + if (context.imageSmoothingEnabled != null) { + context.imageSmoothingEnabled = bool; + } else { + context.webkitImageSmoothingEnabled = bool; + context.mozImageSmoothingEnabled = bool; + context.msImageSmoothingEnabled = bool; + } +}; + +CRp.getImgSmoothing = function (context) { + if (context.imageSmoothingEnabled != null) { + return context.imageSmoothingEnabled; + } else { + return context.webkitImageSmoothingEnabled || context.mozImageSmoothingEnabled || context.msImageSmoothingEnabled; + } +}; + +CRp.makeOffscreenCanvas = function (width, height) { + var canvas; + + if ((typeof OffscreenCanvas === "undefined" ? "undefined" : _typeof(OffscreenCanvas)) !== ("undefined" )) { + canvas = new OffscreenCanvas(width, height); + } else { + canvas = document.createElement('canvas'); // eslint-disable-line no-undef + + canvas.width = width; + canvas.height = height; + } + + return canvas; +}; + +[CRp$a, CRp$9, CRp$8, CRp$7, CRp$6, CRp$5, CRp$4, CRp$3, CRp$2, CRp$1].forEach(function (props) { + extend(CRp, props); +}); + +var renderer = [{ + name: 'null', + impl: NullRenderer +}, { + name: 'base', + impl: BR +}, { + name: 'canvas', + impl: CR +}]; + +var incExts = [{ + type: 'layout', + extensions: layout +}, { + type: 'renderer', + extensions: renderer +}]; + +var extensions = {}; // registered modules for extensions, indexed by name + +var modules = {}; + +function setExtension(type, name, registrant) { + var ext = registrant; + + var overrideErr = function overrideErr(field) { + warn('Can not register `' + name + '` for `' + type + '` since `' + field + '` already exists in the prototype and can not be overridden'); + }; + + if (type === 'core') { + if (Core.prototype[name]) { + return overrideErr(name); + } else { + Core.prototype[name] = registrant; + } + } else if (type === 'collection') { + if (Collection.prototype[name]) { + return overrideErr(name); + } else { + Collection.prototype[name] = registrant; + } + } else if (type === 'layout') { + // fill in missing layout functions in the prototype + var Layout = function Layout(options) { + this.options = options; + registrant.call(this, options); // make sure layout has _private for use w/ std apis like .on() + + if (!plainObject(this._private)) { + this._private = {}; + } + + this._private.cy = options.cy; + this._private.listeners = []; + this.createEmitter(); + }; + + var layoutProto = Layout.prototype = Object.create(registrant.prototype); + var optLayoutFns = []; + + for (var i = 0; i < optLayoutFns.length; i++) { + var fnName = optLayoutFns[i]; + + layoutProto[fnName] = layoutProto[fnName] || function () { + return this; + }; + } // either .start() or .run() is defined, so autogen the other + + + if (layoutProto.start && !layoutProto.run) { + layoutProto.run = function () { + this.start(); + return this; + }; + } else if (!layoutProto.start && layoutProto.run) { + layoutProto.start = function () { + this.run(); + return this; + }; + } + + var regStop = registrant.prototype.stop; + + layoutProto.stop = function () { + var opts = this.options; + + if (opts && opts.animate) { + var anis = this.animations; + + if (anis) { + for (var _i = 0; _i < anis.length; _i++) { + anis[_i].stop(); + } + } + } + + if (regStop) { + regStop.call(this); + } else { + this.emit('layoutstop'); + } + + return this; + }; + + if (!layoutProto.destroy) { + layoutProto.destroy = function () { + return this; + }; + } + + layoutProto.cy = function () { + return this._private.cy; + }; + + var getCy = function getCy(layout) { + return layout._private.cy; + }; + + var emitterOpts = { + addEventFields: function addEventFields(layout, evt) { + evt.layout = layout; + evt.cy = getCy(layout); + evt.target = layout; + }, + bubble: function bubble() { + return true; + }, + parent: function parent(layout) { + return getCy(layout); + } + }; + extend(layoutProto, { + createEmitter: function createEmitter() { + this._private.emitter = new Emitter(emitterOpts, this); + return this; + }, + emitter: function emitter() { + return this._private.emitter; + }, + on: function on(evt, cb) { + this.emitter().on(evt, cb); + return this; + }, + one: function one(evt, cb) { + this.emitter().one(evt, cb); + return this; + }, + once: function once(evt, cb) { + this.emitter().one(evt, cb); + return this; + }, + removeListener: function removeListener(evt, cb) { + this.emitter().removeListener(evt, cb); + return this; + }, + removeAllListeners: function removeAllListeners() { + this.emitter().removeAllListeners(); + return this; + }, + emit: function emit(evt, params) { + this.emitter().emit(evt, params); + return this; + } + }); + define.eventAliasesOn(layoutProto); + ext = Layout; // replace with our wrapped layout + } else if (type === 'renderer' && name !== 'null' && name !== 'base') { + // user registered renderers inherit from base + var BaseRenderer = getExtension('renderer', 'base'); + var bProto = BaseRenderer.prototype; + var RegistrantRenderer = registrant; + var rProto = registrant.prototype; + + var Renderer = function Renderer() { + BaseRenderer.apply(this, arguments); + RegistrantRenderer.apply(this, arguments); + }; + + var proto = Renderer.prototype; + + for (var pName in bProto) { + var pVal = bProto[pName]; + var existsInR = rProto[pName] != null; + + if (existsInR) { + return overrideErr(pName); + } + + proto[pName] = pVal; // take impl from base + } + + for (var _pName in rProto) { + proto[_pName] = rProto[_pName]; // take impl from registrant + } + + bProto.clientFunctions.forEach(function (name) { + proto[name] = proto[name] || function () { + error('Renderer does not implement `renderer.' + name + '()` on its prototype'); + }; + }); + ext = Renderer; + } else if (type === '__proto__' || type === 'constructor' || type === 'prototype') { + // to avoid potential prototype pollution + return error(type + ' is an illegal type to be registered, possibly lead to prototype pollutions'); + } + + return setMap({ + map: extensions, + keys: [type, name], + value: ext + }); +} + +function getExtension(type, name) { + return getMap({ + map: extensions, + keys: [type, name] + }); +} + +function setModule(type, name, moduleType, moduleName, registrant) { + return setMap({ + map: modules, + keys: [type, name, moduleType, moduleName], + value: registrant + }); +} + +function getModule(type, name, moduleType, moduleName) { + return getMap({ + map: modules, + keys: [type, name, moduleType, moduleName] + }); +} + +var extension = function extension() { + // e.g. extension('renderer', 'svg') + if (arguments.length === 2) { + return getExtension.apply(null, arguments); + } // e.g. extension('renderer', 'svg', { ... }) + else if (arguments.length === 3) { + return setExtension.apply(null, arguments); + } // e.g. extension('renderer', 'svg', 'nodeShape', 'ellipse') + else if (arguments.length === 4) { + return getModule.apply(null, arguments); + } // e.g. extension('renderer', 'svg', 'nodeShape', 'ellipse', { ... }) + else if (arguments.length === 5) { + return setModule.apply(null, arguments); + } else { + error('Invalid extension access syntax'); + } +}; // allows a core instance to access extensions internally + + +Core.prototype.extension = extension; // included extensions + +incExts.forEach(function (group) { + group.extensions.forEach(function (ext) { + setExtension(group.type, ext.name, ext.impl); + }); +}); + +// (useful for init) + +var Stylesheet = function Stylesheet() { + if (!(this instanceof Stylesheet)) { + return new Stylesheet(); + } + + this.length = 0; +}; + +var sheetfn = Stylesheet.prototype; + +sheetfn.instanceString = function () { + return 'stylesheet'; +}; // just store the selector to be parsed later + + +sheetfn.selector = function (selector) { + var i = this.length++; + this[i] = { + selector: selector, + properties: [] + }; + return this; // chaining +}; // just store the property to be parsed later + + +sheetfn.css = function (name, value) { + var i = this.length - 1; + + if (string(name)) { + this[i].properties.push({ + name: name, + value: value + }); + } else if (plainObject(name)) { + var map = name; + var propNames = Object.keys(map); + + for (var j = 0; j < propNames.length; j++) { + var key = propNames[j]; + var mapVal = map[key]; + + if (mapVal == null) { + continue; + } + + var prop = Style.properties[key] || Style.properties[dash2camel(key)]; + + if (prop == null) { + continue; + } + + var _name = prop.name; + var _value = mapVal; + this[i].properties.push({ + name: _name, + value: _value + }); + } + } + + return this; // chaining +}; + +sheetfn.style = sheetfn.css; // generate a real style object from the dummy stylesheet + +sheetfn.generateStyle = function (cy) { + var style = new Style(cy); + return this.appendToStyle(style); +}; // append a dummy stylesheet object on a real style object + + +sheetfn.appendToStyle = function (style) { + for (var i = 0; i < this.length; i++) { + var context = this[i]; + var selector = context.selector; + var props = context.properties; + style.selector(selector); // apply selector + + for (var j = 0; j < props.length; j++) { + var prop = props[j]; + style.css(prop.name, prop.value); // apply property + } + } + + return style; +}; + +var version = "3.23.0"; + +var cytoscape = function cytoscape(options) { + // if no options specified, use default + if (options === undefined) { + options = {}; + } // create instance + + + if (plainObject(options)) { + return new Core(options); + } // allow for registration of extensions + else if (string(options)) { + return extension.apply(extension, arguments); + } +}; // e.g. cytoscape.use( require('cytoscape-foo'), bar ) + + +cytoscape.use = function (ext) { + var args = Array.prototype.slice.call(arguments, 1); // args to pass to ext + + args.unshift(cytoscape); // cytoscape is first arg to ext + + ext.apply(null, args); + return this; +}; + +cytoscape.warnings = function (bool) { + return warnings(bool); +}; // replaced by build system + + +cytoscape.version = version; // expose public apis (mostly for extensions) + +cytoscape.stylesheet = cytoscape.Stylesheet = Stylesheet; + +module.exports = cytoscape; + + +/***/ }), + +/***/ 54485: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = __webpack_require__(22894); + + +/***/ }), + +/***/ 22894: +/***/ (function(module, exports) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Generated by CoffeeScript 1.8.0 +(function() { + var Heap, defaultCmp, floor, heapify, heappop, heappush, heappushpop, heapreplace, insort, min, nlargest, nsmallest, updateItem, _siftdown, _siftup; + + floor = Math.floor, min = Math.min; + + + /* + Default comparison function to be used + */ + + defaultCmp = function(x, y) { + if (x < y) { + return -1; + } + if (x > y) { + return 1; + } + return 0; + }; + + + /* + Insert item x in list a, and keep it sorted assuming a is sorted. + + If x is already in a, insert it to the right of the rightmost x. + + Optional args lo (default 0) and hi (default a.length) bound the slice + of a to be searched. + */ + + insort = function(a, x, lo, hi, cmp) { + var mid; + if (lo == null) { + lo = 0; + } + if (cmp == null) { + cmp = defaultCmp; + } + if (lo < 0) { + throw new Error('lo must be non-negative'); + } + if (hi == null) { + hi = a.length; + } + while (lo < hi) { + mid = floor((lo + hi) / 2); + if (cmp(x, a[mid]) < 0) { + hi = mid; + } else { + lo = mid + 1; + } + } + return ([].splice.apply(a, [lo, lo - lo].concat(x)), x); + }; + + + /* + Push item onto heap, maintaining the heap invariant. + */ + + heappush = function(array, item, cmp) { + if (cmp == null) { + cmp = defaultCmp; + } + array.push(item); + return _siftdown(array, 0, array.length - 1, cmp); + }; + + + /* + Pop the smallest item off the heap, maintaining the heap invariant. + */ + + heappop = function(array, cmp) { + var lastelt, returnitem; + if (cmp == null) { + cmp = defaultCmp; + } + lastelt = array.pop(); + if (array.length) { + returnitem = array[0]; + array[0] = lastelt; + _siftup(array, 0, cmp); + } else { + returnitem = lastelt; + } + return returnitem; + }; + + + /* + Pop and return the current smallest value, and add the new item. + + This is more efficient than heappop() followed by heappush(), and can be + more appropriate when using a fixed size heap. Note that the value + returned may be larger than item! That constrains reasonable use of + this routine unless written as part of a conditional replacement: + if item > array[0] + item = heapreplace(array, item) + */ + + heapreplace = function(array, item, cmp) { + var returnitem; + if (cmp == null) { + cmp = defaultCmp; + } + returnitem = array[0]; + array[0] = item; + _siftup(array, 0, cmp); + return returnitem; + }; + + + /* + Fast version of a heappush followed by a heappop. + */ + + heappushpop = function(array, item, cmp) { + var _ref; + if (cmp == null) { + cmp = defaultCmp; + } + if (array.length && cmp(array[0], item) < 0) { + _ref = [array[0], item], item = _ref[0], array[0] = _ref[1]; + _siftup(array, 0, cmp); + } + return item; + }; + + + /* + Transform list into a heap, in-place, in O(array.length) time. + */ + + heapify = function(array, cmp) { + var i, _i, _j, _len, _ref, _ref1, _results, _results1; + if (cmp == null) { + cmp = defaultCmp; + } + _ref1 = (function() { + _results1 = []; + for (var _j = 0, _ref = floor(array.length / 2); 0 <= _ref ? _j < _ref : _j > _ref; 0 <= _ref ? _j++ : _j--){ _results1.push(_j); } + return _results1; + }).apply(this).reverse(); + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + i = _ref1[_i]; + _results.push(_siftup(array, i, cmp)); + } + return _results; + }; + + + /* + Update the position of the given item in the heap. + This function should be called every time the item is being modified. + */ + + updateItem = function(array, item, cmp) { + var pos; + if (cmp == null) { + cmp = defaultCmp; + } + pos = array.indexOf(item); + if (pos === -1) { + return; + } + _siftdown(array, 0, pos, cmp); + return _siftup(array, pos, cmp); + }; + + + /* + Find the n largest elements in a dataset. + */ + + nlargest = function(array, n, cmp) { + var elem, result, _i, _len, _ref; + if (cmp == null) { + cmp = defaultCmp; + } + result = array.slice(0, n); + if (!result.length) { + return result; + } + heapify(result, cmp); + _ref = array.slice(n); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elem = _ref[_i]; + heappushpop(result, elem, cmp); + } + return result.sort(cmp).reverse(); + }; + + + /* + Find the n smallest elements in a dataset. + */ + + nsmallest = function(array, n, cmp) { + var elem, i, los, result, _i, _j, _len, _ref, _ref1, _results; + if (cmp == null) { + cmp = defaultCmp; + } + if (n * 10 <= array.length) { + result = array.slice(0, n).sort(cmp); + if (!result.length) { + return result; + } + los = result[result.length - 1]; + _ref = array.slice(n); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elem = _ref[_i]; + if (cmp(elem, los) < 0) { + insort(result, elem, 0, null, cmp); + result.pop(); + los = result[result.length - 1]; + } + } + return result; + } + heapify(array, cmp); + _results = []; + for (i = _j = 0, _ref1 = min(n, array.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) { + _results.push(heappop(array, cmp)); + } + return _results; + }; + + _siftdown = function(array, startpos, pos, cmp) { + var newitem, parent, parentpos; + if (cmp == null) { + cmp = defaultCmp; + } + newitem = array[pos]; + while (pos > startpos) { + parentpos = (pos - 1) >> 1; + parent = array[parentpos]; + if (cmp(newitem, parent) < 0) { + array[pos] = parent; + pos = parentpos; + continue; + } + break; + } + return array[pos] = newitem; + }; + + _siftup = function(array, pos, cmp) { + var childpos, endpos, newitem, rightpos, startpos; + if (cmp == null) { + cmp = defaultCmp; + } + endpos = array.length; + startpos = pos; + newitem = array[pos]; + childpos = 2 * pos + 1; + while (childpos < endpos) { + rightpos = childpos + 1; + if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) { + childpos = rightpos; + } + array[pos] = array[childpos]; + pos = childpos; + childpos = 2 * pos + 1; + } + array[pos] = newitem; + return _siftdown(array, startpos, pos, cmp); + }; + + Heap = (function() { + Heap.push = heappush; + + Heap.pop = heappop; + + Heap.replace = heapreplace; + + Heap.pushpop = heappushpop; + + Heap.heapify = heapify; + + Heap.updateItem = updateItem; + + Heap.nlargest = nlargest; + + Heap.nsmallest = nsmallest; + + function Heap(cmp) { + this.cmp = cmp != null ? cmp : defaultCmp; + this.nodes = []; + } + + Heap.prototype.push = function(x) { + return heappush(this.nodes, x, this.cmp); + }; + + Heap.prototype.pop = function() { + return heappop(this.nodes, this.cmp); + }; + + Heap.prototype.peek = function() { + return this.nodes[0]; + }; + + Heap.prototype.contains = function(x) { + return this.nodes.indexOf(x) !== -1; + }; + + Heap.prototype.replace = function(x) { + return heapreplace(this.nodes, x, this.cmp); + }; + + Heap.prototype.pushpop = function(x) { + return heappushpop(this.nodes, x, this.cmp); + }; + + Heap.prototype.heapify = function() { + return heapify(this.nodes, this.cmp); + }; + + Heap.prototype.updateItem = function(x) { + return updateItem(this.nodes, x, this.cmp); + }; + + Heap.prototype.clear = function() { + return this.nodes = []; + }; + + Heap.prototype.empty = function() { + return this.nodes.length === 0; + }; + + Heap.prototype.size = function() { + return this.nodes.length; + }; + + Heap.prototype.clone = function() { + var heap; + heap = new Heap(); + heap.nodes = this.nodes.slice(0); + return heap; + }; + + Heap.prototype.toArray = function() { + return this.nodes.slice(0); + }; + + Heap.prototype.insert = Heap.prototype.push; + + Heap.prototype.top = Heap.prototype.peek; + + Heap.prototype.front = Heap.prototype.peek; + + Heap.prototype.has = Heap.prototype.contains; + + Heap.prototype.copy = Heap.prototype.clone; + + return Heap; + + })(); + + (function(root, factory) { + if (true) { + return !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} + })(this, function() { + return Heap; + }); + +}).call(this); + + +/***/ }), + +/***/ 82241: +/***/ (function(module) { + +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(); + else {} +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __nested_webpack_require_543__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_543__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_543__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __nested_webpack_require_543__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __nested_webpack_require_543__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __nested_webpack_require_543__.d = function(exports, name, getter) { +/******/ if(!__nested_webpack_require_543__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __nested_webpack_require_543__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __nested_webpack_require_543__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __nested_webpack_require_543__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_543__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_543__(__nested_webpack_require_543__.s = 26); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function LayoutConstants() {} + +/** + * Layout Quality: 0:draft, 1:default, 2:proof + */ +LayoutConstants.QUALITY = 1; + +/** + * Default parameters + */ +LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED = false; +LayoutConstants.DEFAULT_INCREMENTAL = false; +LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT = true; +LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT = false; +LayoutConstants.DEFAULT_ANIMATION_PERIOD = 50; +LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = false; + +// ----------------------------------------------------------------------------- +// Section: General other constants +// ----------------------------------------------------------------------------- +/* + * Margins of a graph to be applied on bouding rectangle of its contents. We + * assume margins on all four sides to be uniform. + */ +LayoutConstants.DEFAULT_GRAPH_MARGIN = 15; + +/* + * Whether to consider labels in node dimensions or not + */ +LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = false; + +/* + * Default dimension of a non-compound node. + */ +LayoutConstants.SIMPLE_NODE_SIZE = 40; + +/* + * Default dimension of a non-compound node. + */ +LayoutConstants.SIMPLE_NODE_HALF_SIZE = LayoutConstants.SIMPLE_NODE_SIZE / 2; + +/* + * Empty compound node size. When a compound node is empty, its both + * dimensions should be of this value. + */ +LayoutConstants.EMPTY_COMPOUND_NODE_SIZE = 40; + +/* + * Minimum length that an edge should take during layout + */ +LayoutConstants.MIN_EDGE_LENGTH = 1; + +/* + * World boundaries that layout operates on + */ +LayoutConstants.WORLD_BOUNDARY = 1000000; + +/* + * World boundaries that random positioning can be performed with + */ +LayoutConstants.INITIAL_WORLD_BOUNDARY = LayoutConstants.WORLD_BOUNDARY / 1000; + +/* + * Coordinates of the world center + */ +LayoutConstants.WORLD_CENTER_X = 1200; +LayoutConstants.WORLD_CENTER_Y = 900; + +module.exports = LayoutConstants; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __nested_webpack_require_4947__) { + +"use strict"; + + +var LGraphObject = __nested_webpack_require_4947__(2); +var IGeometry = __nested_webpack_require_4947__(8); +var IMath = __nested_webpack_require_4947__(9); + +function LEdge(source, target, vEdge) { + LGraphObject.call(this, vEdge); + + this.isOverlapingSourceAndTarget = false; + this.vGraphObject = vEdge; + this.bendpoints = []; + this.source = source; + this.target = target; +} + +LEdge.prototype = Object.create(LGraphObject.prototype); + +for (var prop in LGraphObject) { + LEdge[prop] = LGraphObject[prop]; +} + +LEdge.prototype.getSource = function () { + return this.source; +}; + +LEdge.prototype.getTarget = function () { + return this.target; +}; + +LEdge.prototype.isInterGraph = function () { + return this.isInterGraph; +}; + +LEdge.prototype.getLength = function () { + return this.length; +}; + +LEdge.prototype.isOverlapingSourceAndTarget = function () { + return this.isOverlapingSourceAndTarget; +}; + +LEdge.prototype.getBendpoints = function () { + return this.bendpoints; +}; + +LEdge.prototype.getLca = function () { + return this.lca; +}; + +LEdge.prototype.getSourceInLca = function () { + return this.sourceInLca; +}; + +LEdge.prototype.getTargetInLca = function () { + return this.targetInLca; +}; + +LEdge.prototype.getOtherEnd = function (node) { + if (this.source === node) { + return this.target; + } else if (this.target === node) { + return this.source; + } else { + throw "Node is not incident with this edge"; + } +}; + +LEdge.prototype.getOtherEndInGraph = function (node, graph) { + var otherEnd = this.getOtherEnd(node); + var root = graph.getGraphManager().getRoot(); + + while (true) { + if (otherEnd.getOwner() == graph) { + return otherEnd; + } + + if (otherEnd.getOwner() == root) { + break; + } + + otherEnd = otherEnd.getOwner().getParent(); + } + + return null; +}; + +LEdge.prototype.updateLength = function () { + var clipPointCoordinates = new Array(4); + + this.isOverlapingSourceAndTarget = IGeometry.getIntersection(this.target.getRect(), this.source.getRect(), clipPointCoordinates); + + if (!this.isOverlapingSourceAndTarget) { + this.lengthX = clipPointCoordinates[0] - clipPointCoordinates[2]; + this.lengthY = clipPointCoordinates[1] - clipPointCoordinates[3]; + + if (Math.abs(this.lengthX) < 1.0) { + this.lengthX = IMath.sign(this.lengthX); + } + + if (Math.abs(this.lengthY) < 1.0) { + this.lengthY = IMath.sign(this.lengthY); + } + + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); + } +}; + +LEdge.prototype.updateLengthSimple = function () { + this.lengthX = this.target.getCenterX() - this.source.getCenterX(); + this.lengthY = this.target.getCenterY() - this.source.getCenterY(); + + if (Math.abs(this.lengthX) < 1.0) { + this.lengthX = IMath.sign(this.lengthX); + } + + if (Math.abs(this.lengthY) < 1.0) { + this.lengthY = IMath.sign(this.lengthY); + } + + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); +}; + +module.exports = LEdge; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function LGraphObject(vGraphObject) { + this.vGraphObject = vGraphObject; +} + +module.exports = LGraphObject; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __nested_webpack_require_8167__) { + +"use strict"; + + +var LGraphObject = __nested_webpack_require_8167__(2); +var Integer = __nested_webpack_require_8167__(10); +var RectangleD = __nested_webpack_require_8167__(13); +var LayoutConstants = __nested_webpack_require_8167__(0); +var RandomSeed = __nested_webpack_require_8167__(16); +var PointD = __nested_webpack_require_8167__(4); + +function LNode(gm, loc, size, vNode) { + //Alternative constructor 1 : LNode(LGraphManager gm, Point loc, Dimension size, Object vNode) + if (size == null && vNode == null) { + vNode = loc; + } + + LGraphObject.call(this, vNode); + + //Alternative constructor 2 : LNode(Layout layout, Object vNode) + if (gm.graphManager != null) gm = gm.graphManager; + + this.estimatedSize = Integer.MIN_VALUE; + this.inclusionTreeDepth = Integer.MAX_VALUE; + this.vGraphObject = vNode; + this.edges = []; + this.graphManager = gm; + + if (size != null && loc != null) this.rect = new RectangleD(loc.x, loc.y, size.width, size.height);else this.rect = new RectangleD(); +} + +LNode.prototype = Object.create(LGraphObject.prototype); +for (var prop in LGraphObject) { + LNode[prop] = LGraphObject[prop]; +} + +LNode.prototype.getEdges = function () { + return this.edges; +}; + +LNode.prototype.getChild = function () { + return this.child; +}; + +LNode.prototype.getOwner = function () { + // if (this.owner != null) { + // if (!(this.owner == null || this.owner.getNodes().indexOf(this) > -1)) { + // throw "assert failed"; + // } + // } + + return this.owner; +}; + +LNode.prototype.getWidth = function () { + return this.rect.width; +}; + +LNode.prototype.setWidth = function (width) { + this.rect.width = width; +}; + +LNode.prototype.getHeight = function () { + return this.rect.height; +}; + +LNode.prototype.setHeight = function (height) { + this.rect.height = height; +}; + +LNode.prototype.getCenterX = function () { + return this.rect.x + this.rect.width / 2; +}; + +LNode.prototype.getCenterY = function () { + return this.rect.y + this.rect.height / 2; +}; + +LNode.prototype.getCenter = function () { + return new PointD(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2); +}; + +LNode.prototype.getLocation = function () { + return new PointD(this.rect.x, this.rect.y); +}; + +LNode.prototype.getRect = function () { + return this.rect; +}; + +LNode.prototype.getDiagonal = function () { + return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height); +}; + +/** + * This method returns half the diagonal length of this node. + */ +LNode.prototype.getHalfTheDiagonal = function () { + return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2; +}; + +LNode.prototype.setRect = function (upperLeft, dimension) { + this.rect.x = upperLeft.x; + this.rect.y = upperLeft.y; + this.rect.width = dimension.width; + this.rect.height = dimension.height; +}; + +LNode.prototype.setCenter = function (cx, cy) { + this.rect.x = cx - this.rect.width / 2; + this.rect.y = cy - this.rect.height / 2; +}; + +LNode.prototype.setLocation = function (x, y) { + this.rect.x = x; + this.rect.y = y; +}; + +LNode.prototype.moveBy = function (dx, dy) { + this.rect.x += dx; + this.rect.y += dy; +}; + +LNode.prototype.getEdgeListToNode = function (to) { + var edgeList = []; + var edge; + var self = this; + + self.edges.forEach(function (edge) { + + if (edge.target == to) { + if (edge.source != self) throw "Incorrect edge source!"; + + edgeList.push(edge); + } + }); + + return edgeList; +}; + +LNode.prototype.getEdgesBetween = function (other) { + var edgeList = []; + var edge; + + var self = this; + self.edges.forEach(function (edge) { + + if (!(edge.source == self || edge.target == self)) throw "Incorrect edge source and/or target"; + + if (edge.target == other || edge.source == other) { + edgeList.push(edge); + } + }); + + return edgeList; +}; + +LNode.prototype.getNeighborsList = function () { + var neighbors = new Set(); + + var self = this; + self.edges.forEach(function (edge) { + + if (edge.source == self) { + neighbors.add(edge.target); + } else { + if (edge.target != self) { + throw "Incorrect incidency!"; + } + + neighbors.add(edge.source); + } + }); + + return neighbors; +}; + +LNode.prototype.withChildren = function () { + var withNeighborsList = new Set(); + var childNode; + var children; + + withNeighborsList.add(this); + + if (this.child != null) { + var nodes = this.child.getNodes(); + for (var i = 0; i < nodes.length; i++) { + childNode = nodes[i]; + children = childNode.withChildren(); + children.forEach(function (node) { + withNeighborsList.add(node); + }); + } + } + + return withNeighborsList; +}; + +LNode.prototype.getNoOfChildren = function () { + var noOfChildren = 0; + var childNode; + + if (this.child == null) { + noOfChildren = 1; + } else { + var nodes = this.child.getNodes(); + for (var i = 0; i < nodes.length; i++) { + childNode = nodes[i]; + + noOfChildren += childNode.getNoOfChildren(); + } + } + + if (noOfChildren == 0) { + noOfChildren = 1; + } + return noOfChildren; +}; + +LNode.prototype.getEstimatedSize = function () { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; +}; + +LNode.prototype.calcEstimatedSize = function () { + if (this.child == null) { + return this.estimatedSize = (this.rect.width + this.rect.height) / 2; + } else { + this.estimatedSize = this.child.calcEstimatedSize(); + this.rect.width = this.estimatedSize; + this.rect.height = this.estimatedSize; + + return this.estimatedSize; + } +}; + +LNode.prototype.scatter = function () { + var randomCenterX; + var randomCenterY; + + var minX = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxX = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterX = LayoutConstants.WORLD_CENTER_X + RandomSeed.nextDouble() * (maxX - minX) + minX; + + var minY = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxY = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterY = LayoutConstants.WORLD_CENTER_Y + RandomSeed.nextDouble() * (maxY - minY) + minY; + + this.rect.x = randomCenterX; + this.rect.y = randomCenterY; +}; + +LNode.prototype.updateBounds = function () { + if (this.getChild() == null) { + throw "assert failed"; + } + if (this.getChild().getNodes().length != 0) { + // wrap the children nodes by re-arranging the boundaries + var childGraph = this.getChild(); + childGraph.updateBounds(true); + + this.rect.x = childGraph.getLeft(); + this.rect.y = childGraph.getTop(); + + this.setWidth(childGraph.getRight() - childGraph.getLeft()); + this.setHeight(childGraph.getBottom() - childGraph.getTop()); + + // Update compound bounds considering its label properties + if (LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS) { + + var width = childGraph.getRight() - childGraph.getLeft(); + var height = childGraph.getBottom() - childGraph.getTop(); + + if (this.labelWidth > width) { + this.rect.x -= (this.labelWidth - width) / 2; + this.setWidth(this.labelWidth); + } + + if (this.labelHeight > height) { + if (this.labelPos == "center") { + this.rect.y -= (this.labelHeight - height) / 2; + } else if (this.labelPos == "top") { + this.rect.y -= this.labelHeight - height; + } + this.setHeight(this.labelHeight); + } + } + } +}; + +LNode.prototype.getInclusionTreeDepth = function () { + if (this.inclusionTreeDepth == Integer.MAX_VALUE) { + throw "assert failed"; + } + return this.inclusionTreeDepth; +}; + +LNode.prototype.transform = function (trans) { + var left = this.rect.x; + + if (left > LayoutConstants.WORLD_BOUNDARY) { + left = LayoutConstants.WORLD_BOUNDARY; + } else if (left < -LayoutConstants.WORLD_BOUNDARY) { + left = -LayoutConstants.WORLD_BOUNDARY; + } + + var top = this.rect.y; + + if (top > LayoutConstants.WORLD_BOUNDARY) { + top = LayoutConstants.WORLD_BOUNDARY; + } else if (top < -LayoutConstants.WORLD_BOUNDARY) { + top = -LayoutConstants.WORLD_BOUNDARY; + } + + var leftTop = new PointD(left, top); + var vLeftTop = trans.inverseTransformPoint(leftTop); + + this.setLocation(vLeftTop.x, vLeftTop.y); +}; + +LNode.prototype.getLeft = function () { + return this.rect.x; +}; + +LNode.prototype.getRight = function () { + return this.rect.x + this.rect.width; +}; + +LNode.prototype.getTop = function () { + return this.rect.y; +}; + +LNode.prototype.getBottom = function () { + return this.rect.y + this.rect.height; +}; + +LNode.prototype.getParent = function () { + if (this.owner == null) { + return null; + } + + return this.owner.getParent(); +}; + +module.exports = LNode; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function PointD(x, y) { + if (x == null && y == null) { + this.x = 0; + this.y = 0; + } else { + this.x = x; + this.y = y; + } +} + +PointD.prototype.getX = function () { + return this.x; +}; + +PointD.prototype.getY = function () { + return this.y; +}; + +PointD.prototype.setX = function (x) { + this.x = x; +}; + +PointD.prototype.setY = function (y) { + this.y = y; +}; + +PointD.prototype.getDifference = function (pt) { + return new DimensionD(this.x - pt.x, this.y - pt.y); +}; + +PointD.prototype.getCopy = function () { + return new PointD(this.x, this.y); +}; + +PointD.prototype.translate = function (dim) { + this.x += dim.width; + this.y += dim.height; + return this; +}; + +module.exports = PointD; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __nested_webpack_require_17549__) { + +"use strict"; + + +var LGraphObject = __nested_webpack_require_17549__(2); +var Integer = __nested_webpack_require_17549__(10); +var LayoutConstants = __nested_webpack_require_17549__(0); +var LGraphManager = __nested_webpack_require_17549__(6); +var LNode = __nested_webpack_require_17549__(3); +var LEdge = __nested_webpack_require_17549__(1); +var RectangleD = __nested_webpack_require_17549__(13); +var Point = __nested_webpack_require_17549__(12); +var LinkedList = __nested_webpack_require_17549__(11); + +function LGraph(parent, obj2, vGraph) { + LGraphObject.call(this, vGraph); + this.estimatedSize = Integer.MIN_VALUE; + this.margin = LayoutConstants.DEFAULT_GRAPH_MARGIN; + this.edges = []; + this.nodes = []; + this.isConnected = false; + this.parent = parent; + + if (obj2 != null && obj2 instanceof LGraphManager) { + this.graphManager = obj2; + } else if (obj2 != null && obj2 instanceof Layout) { + this.graphManager = obj2.graphManager; + } +} + +LGraph.prototype = Object.create(LGraphObject.prototype); +for (var prop in LGraphObject) { + LGraph[prop] = LGraphObject[prop]; +} + +LGraph.prototype.getNodes = function () { + return this.nodes; +}; + +LGraph.prototype.getEdges = function () { + return this.edges; +}; + +LGraph.prototype.getGraphManager = function () { + return this.graphManager; +}; + +LGraph.prototype.getParent = function () { + return this.parent; +}; + +LGraph.prototype.getLeft = function () { + return this.left; +}; + +LGraph.prototype.getRight = function () { + return this.right; +}; + +LGraph.prototype.getTop = function () { + return this.top; +}; + +LGraph.prototype.getBottom = function () { + return this.bottom; +}; + +LGraph.prototype.isConnected = function () { + return this.isConnected; +}; + +LGraph.prototype.add = function (obj1, sourceNode, targetNode) { + if (sourceNode == null && targetNode == null) { + var newNode = obj1; + if (this.graphManager == null) { + throw "Graph has no graph mgr!"; + } + if (this.getNodes().indexOf(newNode) > -1) { + throw "Node already in graph!"; + } + newNode.owner = this; + this.getNodes().push(newNode); + + return newNode; + } else { + var newEdge = obj1; + if (!(this.getNodes().indexOf(sourceNode) > -1 && this.getNodes().indexOf(targetNode) > -1)) { + throw "Source or target not in graph!"; + } + + if (!(sourceNode.owner == targetNode.owner && sourceNode.owner == this)) { + throw "Both owners must be this graph!"; + } + + if (sourceNode.owner != targetNode.owner) { + return null; + } + + // set source and target + newEdge.source = sourceNode; + newEdge.target = targetNode; + + // set as intra-graph edge + newEdge.isInterGraph = false; + + // add to graph edge list + this.getEdges().push(newEdge); + + // add to incidency lists + sourceNode.edges.push(newEdge); + + if (targetNode != sourceNode) { + targetNode.edges.push(newEdge); + } + + return newEdge; + } +}; + +LGraph.prototype.remove = function (obj) { + var node = obj; + if (obj instanceof LNode) { + if (node == null) { + throw "Node is null!"; + } + if (!(node.owner != null && node.owner == this)) { + throw "Owner graph is invalid!"; + } + if (this.graphManager == null) { + throw "Owner graph manager is invalid!"; + } + // remove incident edges first (make a copy to do it safely) + var edgesToBeRemoved = node.edges.slice(); + var edge; + var s = edgesToBeRemoved.length; + for (var i = 0; i < s; i++) { + edge = edgesToBeRemoved[i]; + + if (edge.isInterGraph) { + this.graphManager.remove(edge); + } else { + edge.source.owner.remove(edge); + } + } + + // now the node itself + var index = this.nodes.indexOf(node); + if (index == -1) { + throw "Node not in owner node list!"; + } + + this.nodes.splice(index, 1); + } else if (obj instanceof LEdge) { + var edge = obj; + if (edge == null) { + throw "Edge is null!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + if (!(edge.source.owner != null && edge.target.owner != null && edge.source.owner == this && edge.target.owner == this)) { + throw "Source and/or target owner is invalid!"; + } + + var sourceIndex = edge.source.edges.indexOf(edge); + var targetIndex = edge.target.edges.indexOf(edge); + if (!(sourceIndex > -1 && targetIndex > -1)) { + throw "Source and/or target doesn't know this edge!"; + } + + edge.source.edges.splice(sourceIndex, 1); + + if (edge.target != edge.source) { + edge.target.edges.splice(targetIndex, 1); + } + + var index = edge.source.owner.getEdges().indexOf(edge); + if (index == -1) { + throw "Not in owner's edge list!"; + } + + edge.source.owner.getEdges().splice(index, 1); + } +}; + +LGraph.prototype.updateLeftTop = function () { + var top = Integer.MAX_VALUE; + var left = Integer.MAX_VALUE; + var nodeTop; + var nodeLeft; + var margin; + + var nodes = this.getNodes(); + var s = nodes.length; + + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + nodeTop = lNode.getTop(); + nodeLeft = lNode.getLeft(); + + if (top > nodeTop) { + top = nodeTop; + } + + if (left > nodeLeft) { + left = nodeLeft; + } + } + + // Do we have any nodes in this graph? + if (top == Integer.MAX_VALUE) { + return null; + } + + if (nodes[0].getParent().paddingLeft != undefined) { + margin = nodes[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + + this.left = left - margin; + this.top = top - margin; + + // Apply the margins and return the result + return new Point(this.left, this.top); +}; + +LGraph.prototype.updateBounds = function (recursive) { + // calculate bounds + var left = Integer.MAX_VALUE; + var right = -Integer.MAX_VALUE; + var top = Integer.MAX_VALUE; + var bottom = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + var margin; + + var nodes = this.nodes; + var s = nodes.length; + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + + if (recursive && lNode.child != null) { + lNode.updateBounds(); + } + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + + if (left > nodeLeft) { + left = nodeLeft; + } + + if (right < nodeRight) { + right = nodeRight; + } + + if (top > nodeTop) { + top = nodeTop; + } + + if (bottom < nodeBottom) { + bottom = nodeBottom; + } + } + + var boundingRect = new RectangleD(left, top, right - left, bottom - top); + if (left == Integer.MAX_VALUE) { + this.left = this.parent.getLeft(); + this.right = this.parent.getRight(); + this.top = this.parent.getTop(); + this.bottom = this.parent.getBottom(); + } + + if (nodes[0].getParent().paddingLeft != undefined) { + margin = nodes[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + + this.left = boundingRect.x - margin; + this.right = boundingRect.x + boundingRect.width + margin; + this.top = boundingRect.y - margin; + this.bottom = boundingRect.y + boundingRect.height + margin; +}; + +LGraph.calculateBounds = function (nodes) { + var left = Integer.MAX_VALUE; + var right = -Integer.MAX_VALUE; + var top = Integer.MAX_VALUE; + var bottom = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + + var s = nodes.length; + + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + + if (left > nodeLeft) { + left = nodeLeft; + } + + if (right < nodeRight) { + right = nodeRight; + } + + if (top > nodeTop) { + top = nodeTop; + } + + if (bottom < nodeBottom) { + bottom = nodeBottom; + } + } + + var boundingRect = new RectangleD(left, top, right - left, bottom - top); + + return boundingRect; +}; + +LGraph.prototype.getInclusionTreeDepth = function () { + if (this == this.graphManager.getRoot()) { + return 1; + } else { + return this.parent.getInclusionTreeDepth(); + } +}; + +LGraph.prototype.getEstimatedSize = function () { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; +}; + +LGraph.prototype.calcEstimatedSize = function () { + var size = 0; + var nodes = this.nodes; + var s = nodes.length; + + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + size += lNode.calcEstimatedSize(); + } + + if (size == 0) { + this.estimatedSize = LayoutConstants.EMPTY_COMPOUND_NODE_SIZE; + } else { + this.estimatedSize = size / Math.sqrt(this.nodes.length); + } + + return this.estimatedSize; +}; + +LGraph.prototype.updateConnected = function () { + var self = this; + if (this.nodes.length == 0) { + this.isConnected = true; + return; + } + + var queue = new LinkedList(); + var visited = new Set(); + var currentNode = this.nodes[0]; + var neighborEdges; + var currentNeighbor; + var childrenOfNode = currentNode.withChildren(); + childrenOfNode.forEach(function (node) { + queue.push(node); + visited.add(node); + }); + + while (queue.length !== 0) { + currentNode = queue.shift(); + + // Traverse all neighbors of this node + neighborEdges = currentNode.getEdges(); + var size = neighborEdges.length; + for (var i = 0; i < size; i++) { + var neighborEdge = neighborEdges[i]; + currentNeighbor = neighborEdge.getOtherEndInGraph(currentNode, this); + + // Add unvisited neighbors to the list to visit + if (currentNeighbor != null && !visited.has(currentNeighbor)) { + var childrenOfNeighbor = currentNeighbor.withChildren(); + + childrenOfNeighbor.forEach(function (node) { + queue.push(node); + visited.add(node); + }); + } + } + } + + this.isConnected = false; + + if (visited.size >= this.nodes.length) { + var noOfVisitedInThisGraph = 0; + + visited.forEach(function (visitedNode) { + if (visitedNode.owner == self) { + noOfVisitedInThisGraph++; + } + }); + + if (noOfVisitedInThisGraph == this.nodes.length) { + this.isConnected = true; + } + } +}; + +module.exports = LGraph; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __nested_webpack_require_27617__) { + +"use strict"; + + +var LGraph; +var LEdge = __nested_webpack_require_27617__(1); + +function LGraphManager(layout) { + LGraph = __nested_webpack_require_27617__(5); // It may be better to initilize this out of this function but it gives an error (Right-hand side of 'instanceof' is not callable) now. + this.layout = layout; + + this.graphs = []; + this.edges = []; +} + +LGraphManager.prototype.addRoot = function () { + var ngraph = this.layout.newGraph(); + var nnode = this.layout.newNode(null); + var root = this.add(ngraph, nnode); + this.setRootGraph(root); + return this.rootGraph; +}; + +LGraphManager.prototype.add = function (newGraph, parentNode, newEdge, sourceNode, targetNode) { + //there are just 2 parameters are passed then it adds an LGraph else it adds an LEdge + if (newEdge == null && sourceNode == null && targetNode == null) { + if (newGraph == null) { + throw "Graph is null!"; + } + if (parentNode == null) { + throw "Parent node is null!"; + } + if (this.graphs.indexOf(newGraph) > -1) { + throw "Graph already in this graph mgr!"; + } + + this.graphs.push(newGraph); + + if (newGraph.parent != null) { + throw "Already has a parent!"; + } + if (parentNode.child != null) { + throw "Already has a child!"; + } + + newGraph.parent = parentNode; + parentNode.child = newGraph; + + return newGraph; + } else { + //change the order of the parameters + targetNode = newEdge; + sourceNode = parentNode; + newEdge = newGraph; + var sourceGraph = sourceNode.getOwner(); + var targetGraph = targetNode.getOwner(); + + if (!(sourceGraph != null && sourceGraph.getGraphManager() == this)) { + throw "Source not in this graph mgr!"; + } + if (!(targetGraph != null && targetGraph.getGraphManager() == this)) { + throw "Target not in this graph mgr!"; + } + + if (sourceGraph == targetGraph) { + newEdge.isInterGraph = false; + return sourceGraph.add(newEdge, sourceNode, targetNode); + } else { + newEdge.isInterGraph = true; + + // set source and target + newEdge.source = sourceNode; + newEdge.target = targetNode; + + // add edge to inter-graph edge list + if (this.edges.indexOf(newEdge) > -1) { + throw "Edge already in inter-graph edge list!"; + } + + this.edges.push(newEdge); + + // add edge to source and target incidency lists + if (!(newEdge.source != null && newEdge.target != null)) { + throw "Edge source and/or target is null!"; + } + + if (!(newEdge.source.edges.indexOf(newEdge) == -1 && newEdge.target.edges.indexOf(newEdge) == -1)) { + throw "Edge already in source and/or target incidency list!"; + } + + newEdge.source.edges.push(newEdge); + newEdge.target.edges.push(newEdge); + + return newEdge; + } + } +}; + +LGraphManager.prototype.remove = function (lObj) { + if (lObj instanceof LGraph) { + var graph = lObj; + if (graph.getGraphManager() != this) { + throw "Graph not in this graph mgr"; + } + if (!(graph == this.rootGraph || graph.parent != null && graph.parent.graphManager == this)) { + throw "Invalid parent node!"; + } + + // first the edges (make a copy to do it safely) + var edgesToBeRemoved = []; + + edgesToBeRemoved = edgesToBeRemoved.concat(graph.getEdges()); + + var edge; + var s = edgesToBeRemoved.length; + for (var i = 0; i < s; i++) { + edge = edgesToBeRemoved[i]; + graph.remove(edge); + } + + // then the nodes (make a copy to do it safely) + var nodesToBeRemoved = []; + + nodesToBeRemoved = nodesToBeRemoved.concat(graph.getNodes()); + + var node; + s = nodesToBeRemoved.length; + for (var i = 0; i < s; i++) { + node = nodesToBeRemoved[i]; + graph.remove(node); + } + + // check if graph is the root + if (graph == this.rootGraph) { + this.setRootGraph(null); + } + + // now remove the graph itself + var index = this.graphs.indexOf(graph); + this.graphs.splice(index, 1); + + // also reset the parent of the graph + graph.parent = null; + } else if (lObj instanceof LEdge) { + edge = lObj; + if (edge == null) { + throw "Edge is null!"; + } + if (!edge.isInterGraph) { + throw "Not an inter-graph edge!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + + // remove edge from source and target nodes' incidency lists + + if (!(edge.source.edges.indexOf(edge) != -1 && edge.target.edges.indexOf(edge) != -1)) { + throw "Source and/or target doesn't know this edge!"; + } + + var index = edge.source.edges.indexOf(edge); + edge.source.edges.splice(index, 1); + index = edge.target.edges.indexOf(edge); + edge.target.edges.splice(index, 1); + + // remove edge from owner graph manager's inter-graph edge list + + if (!(edge.source.owner != null && edge.source.owner.getGraphManager() != null)) { + throw "Edge owner graph or owner graph manager is null!"; + } + if (edge.source.owner.getGraphManager().edges.indexOf(edge) == -1) { + throw "Not in owner graph manager's edge list!"; + } + + var index = edge.source.owner.getGraphManager().edges.indexOf(edge); + edge.source.owner.getGraphManager().edges.splice(index, 1); + } +}; + +LGraphManager.prototype.updateBounds = function () { + this.rootGraph.updateBounds(true); +}; + +LGraphManager.prototype.getGraphs = function () { + return this.graphs; +}; + +LGraphManager.prototype.getAllNodes = function () { + if (this.allNodes == null) { + var nodeList = []; + var graphs = this.getGraphs(); + var s = graphs.length; + for (var i = 0; i < s; i++) { + nodeList = nodeList.concat(graphs[i].getNodes()); + } + this.allNodes = nodeList; + } + return this.allNodes; +}; + +LGraphManager.prototype.resetAllNodes = function () { + this.allNodes = null; +}; + +LGraphManager.prototype.resetAllEdges = function () { + this.allEdges = null; +}; + +LGraphManager.prototype.resetAllNodesToApplyGravitation = function () { + this.allNodesToApplyGravitation = null; +}; + +LGraphManager.prototype.getAllEdges = function () { + if (this.allEdges == null) { + var edgeList = []; + var graphs = this.getGraphs(); + var s = graphs.length; + for (var i = 0; i < graphs.length; i++) { + edgeList = edgeList.concat(graphs[i].getEdges()); + } + + edgeList = edgeList.concat(this.edges); + + this.allEdges = edgeList; + } + return this.allEdges; +}; + +LGraphManager.prototype.getAllNodesToApplyGravitation = function () { + return this.allNodesToApplyGravitation; +}; + +LGraphManager.prototype.setAllNodesToApplyGravitation = function (nodeList) { + if (this.allNodesToApplyGravitation != null) { + throw "assert failed"; + } + + this.allNodesToApplyGravitation = nodeList; +}; + +LGraphManager.prototype.getRoot = function () { + return this.rootGraph; +}; + +LGraphManager.prototype.setRootGraph = function (graph) { + if (graph.getGraphManager() != this) { + throw "Root not in this graph mgr!"; + } + + this.rootGraph = graph; + // root graph must have a root node associated with it for convenience + if (graph.parent == null) { + graph.parent = this.layout.newNode("Root node"); + } +}; + +LGraphManager.prototype.getLayout = function () { + return this.layout; +}; + +LGraphManager.prototype.isOneAncestorOfOther = function (firstNode, secondNode) { + if (!(firstNode != null && secondNode != null)) { + throw "assert failed"; + } + + if (firstNode == secondNode) { + return true; + } + // Is second node an ancestor of the first one? + var ownerGraph = firstNode.getOwner(); + var parentNode; + + do { + parentNode = ownerGraph.getParent(); + + if (parentNode == null) { + break; + } + + if (parentNode == secondNode) { + return true; + } + + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + // Is first node an ancestor of the second one? + ownerGraph = secondNode.getOwner(); + + do { + parentNode = ownerGraph.getParent(); + + if (parentNode == null) { + break; + } + + if (parentNode == firstNode) { + return true; + } + + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + + return false; +}; + +LGraphManager.prototype.calcLowestCommonAncestors = function () { + var edge; + var sourceNode; + var targetNode; + var sourceAncestorGraph; + var targetAncestorGraph; + + var edges = this.getAllEdges(); + var s = edges.length; + for (var i = 0; i < s; i++) { + edge = edges[i]; + + sourceNode = edge.source; + targetNode = edge.target; + edge.lca = null; + edge.sourceInLca = sourceNode; + edge.targetInLca = targetNode; + + if (sourceNode == targetNode) { + edge.lca = sourceNode.getOwner(); + continue; + } + + sourceAncestorGraph = sourceNode.getOwner(); + + while (edge.lca == null) { + edge.targetInLca = targetNode; + targetAncestorGraph = targetNode.getOwner(); + + while (edge.lca == null) { + if (targetAncestorGraph == sourceAncestorGraph) { + edge.lca = targetAncestorGraph; + break; + } + + if (targetAncestorGraph == this.rootGraph) { + break; + } + + if (edge.lca != null) { + throw "assert failed"; + } + edge.targetInLca = targetAncestorGraph.getParent(); + targetAncestorGraph = edge.targetInLca.getOwner(); + } + + if (sourceAncestorGraph == this.rootGraph) { + break; + } + + if (edge.lca == null) { + edge.sourceInLca = sourceAncestorGraph.getParent(); + sourceAncestorGraph = edge.sourceInLca.getOwner(); + } + } + + if (edge.lca == null) { + throw "assert failed"; + } + } +}; + +LGraphManager.prototype.calcLowestCommonAncestor = function (firstNode, secondNode) { + if (firstNode == secondNode) { + return firstNode.getOwner(); + } + var firstOwnerGraph = firstNode.getOwner(); + + do { + if (firstOwnerGraph == null) { + break; + } + var secondOwnerGraph = secondNode.getOwner(); + + do { + if (secondOwnerGraph == null) { + break; + } + + if (secondOwnerGraph == firstOwnerGraph) { + return secondOwnerGraph; + } + secondOwnerGraph = secondOwnerGraph.getParent().getOwner(); + } while (true); + + firstOwnerGraph = firstOwnerGraph.getParent().getOwner(); + } while (true); + + return firstOwnerGraph; +}; + +LGraphManager.prototype.calcInclusionTreeDepths = function (graph, depth) { + if (graph == null && depth == null) { + graph = this.rootGraph; + depth = 1; + } + var node; + + var nodes = graph.getNodes(); + var s = nodes.length; + for (var i = 0; i < s; i++) { + node = nodes[i]; + node.inclusionTreeDepth = depth; + + if (node.child != null) { + this.calcInclusionTreeDepths(node.child, depth + 1); + } + } +}; + +LGraphManager.prototype.includesInvalidEdge = function () { + var edge; + + var s = this.edges.length; + for (var i = 0; i < s; i++) { + edge = this.edges[i]; + + if (this.isOneAncestorOfOther(edge.source, edge.target)) { + return true; + } + } + return false; +}; + +module.exports = LGraphManager; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __nested_webpack_require_38707__) { + +"use strict"; + + +var LayoutConstants = __nested_webpack_require_38707__(0); + +function FDLayoutConstants() {} + +//FDLayoutConstants inherits static props in LayoutConstants +for (var prop in LayoutConstants) { + FDLayoutConstants[prop] = LayoutConstants[prop]; +} + +FDLayoutConstants.MAX_ITERATIONS = 2500; + +FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50; +FDLayoutConstants.DEFAULT_SPRING_STRENGTH = 0.45; +FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = 4500.0; +FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = 0.4; +FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1.0; +FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8; +FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5; +FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true; +FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = true; +FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3; +FDLayoutConstants.COOLING_ADAPTATION_FACTOR = 0.33; +FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT = 1000; +FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT = 5000; +FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100.0; +FDLayoutConstants.MAX_NODE_DISPLACEMENT = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3; +FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10.0; +FDLayoutConstants.CONVERGENCE_CHECK_PERIOD = 100; +FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1; +FDLayoutConstants.MIN_EDGE_LENGTH = 1; +FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD = 10; + +module.exports = FDLayoutConstants; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __nested_webpack_require_40298__) { + +"use strict"; + + +/** + * This class maintains a list of static geometry related utility methods. + * + * + * Copyright: i-Vis Research Group, Bilkent University, 2007 - present + */ + +var Point = __nested_webpack_require_40298__(12); + +function IGeometry() {} + +/** + * This method calculates *half* the amount in x and y directions of the two + * input rectangles needed to separate them keeping their respective + * positioning, and returns the result in the input array. An input + * separation buffer added to the amount in both directions. We assume that + * the two rectangles do intersect. + */ +IGeometry.calcSeparationAmount = function (rectA, rectB, overlapAmount, separationBuffer) { + if (!rectA.intersects(rectB)) { + throw "assert failed"; + } + + var directions = new Array(2); + + this.decideDirectionsForOverlappingNodes(rectA, rectB, directions); + + overlapAmount[0] = Math.min(rectA.getRight(), rectB.getRight()) - Math.max(rectA.x, rectB.x); + overlapAmount[1] = Math.min(rectA.getBottom(), rectB.getBottom()) - Math.max(rectA.y, rectB.y); + + // update the overlapping amounts for the following cases: + if (rectA.getX() <= rectB.getX() && rectA.getRight() >= rectB.getRight()) { + /* Case x.1: + * + * rectA + * | | + * | _________ | + * | | | | + * |________|_______|______| + * | | + * | | + * rectB + */ + overlapAmount[0] += Math.min(rectB.getX() - rectA.getX(), rectA.getRight() - rectB.getRight()); + } else if (rectB.getX() <= rectA.getX() && rectB.getRight() >= rectA.getRight()) { + /* Case x.2: + * + * rectB + * | | + * | _________ | + * | | | | + * |________|_______|______| + * | | + * | | + * rectA + */ + overlapAmount[0] += Math.min(rectA.getX() - rectB.getX(), rectB.getRight() - rectA.getRight()); + } + if (rectA.getY() <= rectB.getY() && rectA.getBottom() >= rectB.getBottom()) { + /* Case y.1: + * ________ rectA + * | + * | + * ______|____ rectB + * | | + * | | + * ______|____| + * | + * | + * |________ + * + */ + overlapAmount[1] += Math.min(rectB.getY() - rectA.getY(), rectA.getBottom() - rectB.getBottom()); + } else if (rectB.getY() <= rectA.getY() && rectB.getBottom() >= rectA.getBottom()) { + /* Case y.2: + * ________ rectB + * | + * | + * ______|____ rectA + * | | + * | | + * ______|____| + * | + * | + * |________ + * + */ + overlapAmount[1] += Math.min(rectA.getY() - rectB.getY(), rectB.getBottom() - rectA.getBottom()); + } + + // find slope of the line passes two centers + var slope = Math.abs((rectB.getCenterY() - rectA.getCenterY()) / (rectB.getCenterX() - rectA.getCenterX())); + // if centers are overlapped + if (rectB.getCenterY() === rectA.getCenterY() && rectB.getCenterX() === rectA.getCenterX()) { + // assume the slope is 1 (45 degree) + slope = 1.0; + } + + var moveByY = slope * overlapAmount[0]; + var moveByX = overlapAmount[1] / slope; + if (overlapAmount[0] < moveByX) { + moveByX = overlapAmount[0]; + } else { + moveByY = overlapAmount[1]; + } + // return half the amount so that if each rectangle is moved by these + // amounts in opposite directions, overlap will be resolved + overlapAmount[0] = -1 * directions[0] * (moveByX / 2 + separationBuffer); + overlapAmount[1] = -1 * directions[1] * (moveByY / 2 + separationBuffer); +}; + +/** + * This method decides the separation direction of overlapping nodes + * + * if directions[0] = -1, then rectA goes left + * if directions[0] = 1, then rectA goes right + * if directions[1] = -1, then rectA goes up + * if directions[1] = 1, then rectA goes down + */ +IGeometry.decideDirectionsForOverlappingNodes = function (rectA, rectB, directions) { + if (rectA.getCenterX() < rectB.getCenterX()) { + directions[0] = -1; + } else { + directions[0] = 1; + } + + if (rectA.getCenterY() < rectB.getCenterY()) { + directions[1] = -1; + } else { + directions[1] = 1; + } +}; + +/** + * This method calculates the intersection (clipping) points of the two + * input rectangles with line segment defined by the centers of these two + * rectangles. The clipping points are saved in the input double array and + * whether or not the two rectangles overlap is returned. + */ +IGeometry.getIntersection2 = function (rectA, rectB, result) { + //result[0-1] will contain clipPoint of rectA, result[2-3] will contain clipPoint of rectB + var p1x = rectA.getCenterX(); + var p1y = rectA.getCenterY(); + var p2x = rectB.getCenterX(); + var p2y = rectB.getCenterY(); + + //if two rectangles intersect, then clipping points are centers + if (rectA.intersects(rectB)) { + result[0] = p1x; + result[1] = p1y; + result[2] = p2x; + result[3] = p2y; + return true; + } + //variables for rectA + var topLeftAx = rectA.getX(); + var topLeftAy = rectA.getY(); + var topRightAx = rectA.getRight(); + var bottomLeftAx = rectA.getX(); + var bottomLeftAy = rectA.getBottom(); + var bottomRightAx = rectA.getRight(); + var halfWidthA = rectA.getWidthHalf(); + var halfHeightA = rectA.getHeightHalf(); + //variables for rectB + var topLeftBx = rectB.getX(); + var topLeftBy = rectB.getY(); + var topRightBx = rectB.getRight(); + var bottomLeftBx = rectB.getX(); + var bottomLeftBy = rectB.getBottom(); + var bottomRightBx = rectB.getRight(); + var halfWidthB = rectB.getWidthHalf(); + var halfHeightB = rectB.getHeightHalf(); + + //flag whether clipping points are found + var clipPointAFound = false; + var clipPointBFound = false; + + // line is vertical + if (p1x === p2x) { + if (p1y > p2y) { + result[0] = p1x; + result[1] = topLeftAy; + result[2] = p2x; + result[3] = bottomLeftBy; + return false; + } else if (p1y < p2y) { + result[0] = p1x; + result[1] = bottomLeftAy; + result[2] = p2x; + result[3] = topLeftBy; + return false; + } else { + //not line, return null; + } + } + // line is horizontal + else if (p1y === p2y) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = p1y; + result[2] = topRightBx; + result[3] = p2y; + return false; + } else if (p1x < p2x) { + result[0] = topRightAx; + result[1] = p1y; + result[2] = topLeftBx; + result[3] = p2y; + return false; + } else { + //not valid line, return null; + } + } else { + //slopes of rectA's and rectB's diagonals + var slopeA = rectA.height / rectA.width; + var slopeB = rectB.height / rectB.width; + + //slope of line between center of rectA and center of rectB + var slopePrime = (p2y - p1y) / (p2x - p1x); + var cardinalDirectionA = void 0; + var cardinalDirectionB = void 0; + var tempPointAx = void 0; + var tempPointAy = void 0; + var tempPointBx = void 0; + var tempPointBy = void 0; + + //determine whether clipping point is the corner of nodeA + if (-slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = bottomLeftAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } else { + result[0] = topRightAx; + result[1] = topLeftAy; + clipPointAFound = true; + } + } else if (slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = topLeftAy; + clipPointAFound = true; + } else { + result[0] = bottomRightAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } + } + + //determine whether clipping point is the corner of nodeB + if (-slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = bottomLeftBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } else { + result[2] = topRightBx; + result[3] = topLeftBy; + clipPointBFound = true; + } + } else if (slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = topLeftBx; + result[3] = topLeftBy; + clipPointBFound = true; + } else { + result[2] = bottomRightBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } + } + + //if both clipping points are corners + if (clipPointAFound && clipPointBFound) { + return false; + } + + //determine Cardinal Direction of rectangles + if (p1x > p2x) { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 4); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 2); + } else { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 3); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 1); + } + } else { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 1); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 3); + } else { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 2); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 4); + } + } + //calculate clipping Point if it is not found before + if (!clipPointAFound) { + switch (cardinalDirectionA) { + case 1: + tempPointAy = topLeftAy; + tempPointAx = p1x + -halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 2: + tempPointAx = bottomRightAx; + tempPointAy = p1y + halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 3: + tempPointAy = bottomLeftAy; + tempPointAx = p1x + halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 4: + tempPointAx = bottomLeftAx; + tempPointAy = p1y + -halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + } + } + if (!clipPointBFound) { + switch (cardinalDirectionB) { + case 1: + tempPointBy = topLeftBy; + tempPointBx = p2x + -halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 2: + tempPointBx = bottomRightBx; + tempPointBy = p2y + halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 3: + tempPointBy = bottomLeftBy; + tempPointBx = p2x + halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 4: + tempPointBx = bottomLeftBx; + tempPointBy = p2y + -halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + } + } + } + return false; +}; + +/** + * This method returns in which cardinal direction does input point stays + * 1: North + * 2: East + * 3: South + * 4: West + */ +IGeometry.getCardinalDirection = function (slope, slopePrime, line) { + if (slope > slopePrime) { + return line; + } else { + return 1 + line % 4; + } +}; + +/** + * This method calculates the intersection of the two lines defined by + * point pairs (s1,s2) and (f1,f2). + */ +IGeometry.getIntersection = function (s1, s2, f1, f2) { + if (f2 == null) { + return this.getIntersection2(s1, s2, f1); + } + + var x1 = s1.x; + var y1 = s1.y; + var x2 = s2.x; + var y2 = s2.y; + var x3 = f1.x; + var y3 = f1.y; + var x4 = f2.x; + var y4 = f2.y; + var x = void 0, + y = void 0; // intersection point + var a1 = void 0, + a2 = void 0, + b1 = void 0, + b2 = void 0, + c1 = void 0, + c2 = void 0; // coefficients of line eqns. + var denom = void 0; + + a1 = y2 - y1; + b1 = x1 - x2; + c1 = x2 * y1 - x1 * y2; // { a1*x + b1*y + c1 = 0 is line 1 } + + a2 = y4 - y3; + b2 = x3 - x4; + c2 = x4 * y3 - x3 * y4; // { a2*x + b2*y + c2 = 0 is line 2 } + + denom = a1 * b2 - a2 * b1; + + if (denom === 0) { + return null; + } + + x = (b1 * c2 - b2 * c1) / denom; + y = (a2 * c1 - a1 * c2) / denom; + + return new Point(x, y); +}; + +/** + * This method finds and returns the angle of the vector from the + x-axis + * in clockwise direction (compatible w/ Java coordinate system!). + */ +IGeometry.angleOfVector = function (Cx, Cy, Nx, Ny) { + var C_angle = void 0; + + if (Cx !== Nx) { + C_angle = Math.atan((Ny - Cy) / (Nx - Cx)); + + if (Nx < Cx) { + C_angle += Math.PI; + } else if (Ny < Cy) { + C_angle += this.TWO_PI; + } + } else if (Ny < Cy) { + C_angle = this.ONE_AND_HALF_PI; // 270 degrees + } else { + C_angle = this.HALF_PI; // 90 degrees + } + + return C_angle; +}; + +/** + * This method checks whether the given two line segments (one with point + * p1 and p2, the other with point p3 and p4) intersect at a point other + * than these points. + */ +IGeometry.doIntersect = function (p1, p2, p3, p4) { + var a = p1.x; + var b = p1.y; + var c = p2.x; + var d = p2.y; + var p = p3.x; + var q = p3.y; + var r = p4.x; + var s = p4.y; + var det = (c - a) * (s - q) - (r - p) * (d - b); + + if (det === 0) { + return false; + } else { + var lambda = ((s - q) * (r - a) + (p - r) * (s - b)) / det; + var gamma = ((b - d) * (r - a) + (c - a) * (s - b)) / det; + return 0 < lambda && lambda < 1 && 0 < gamma && gamma < 1; + } +}; + +// ----------------------------------------------------------------------------- +// Section: Class Constants +// ----------------------------------------------------------------------------- +/** + * Some useful pre-calculated constants + */ +IGeometry.HALF_PI = 0.5 * Math.PI; +IGeometry.ONE_AND_HALF_PI = 1.5 * Math.PI; +IGeometry.TWO_PI = 2.0 * Math.PI; +IGeometry.THREE_PI = 3.0 * Math.PI; + +module.exports = IGeometry; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function IMath() {} + +/** + * This method returns the sign of the input value. + */ +IMath.sign = function (value) { + if (value > 0) { + return 1; + } else if (value < 0) { + return -1; + } else { + return 0; + } +}; + +IMath.floor = function (value) { + return value < 0 ? Math.ceil(value) : Math.floor(value); +}; + +IMath.ceil = function (value) { + return value < 0 ? Math.floor(value) : Math.ceil(value); +}; + +module.exports = IMath; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function Integer() {} + +Integer.MAX_VALUE = 2147483647; +Integer.MIN_VALUE = -2147483648; + +module.exports = Integer; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var nodeFrom = function nodeFrom(value) { + return { value: value, next: null, prev: null }; +}; + +var add = function add(prev, node, next, list) { + if (prev !== null) { + prev.next = node; + } else { + list.head = node; + } + + if (next !== null) { + next.prev = node; + } else { + list.tail = node; + } + + node.prev = prev; + node.next = next; + + list.length++; + + return node; +}; + +var _remove = function _remove(node, list) { + var prev = node.prev, + next = node.next; + + + if (prev !== null) { + prev.next = next; + } else { + list.head = next; + } + + if (next !== null) { + next.prev = prev; + } else { + list.tail = prev; + } + + node.prev = node.next = null; + + list.length--; + + return node; +}; + +var LinkedList = function () { + function LinkedList(vals) { + var _this = this; + + _classCallCheck(this, LinkedList); + + this.length = 0; + this.head = null; + this.tail = null; + + if (vals != null) { + vals.forEach(function (v) { + return _this.push(v); + }); + } + } + + _createClass(LinkedList, [{ + key: "size", + value: function size() { + return this.length; + } + }, { + key: "insertBefore", + value: function insertBefore(val, otherNode) { + return add(otherNode.prev, nodeFrom(val), otherNode, this); + } + }, { + key: "insertAfter", + value: function insertAfter(val, otherNode) { + return add(otherNode, nodeFrom(val), otherNode.next, this); + } + }, { + key: "insertNodeBefore", + value: function insertNodeBefore(newNode, otherNode) { + return add(otherNode.prev, newNode, otherNode, this); + } + }, { + key: "insertNodeAfter", + value: function insertNodeAfter(newNode, otherNode) { + return add(otherNode, newNode, otherNode.next, this); + } + }, { + key: "push", + value: function push(val) { + return add(this.tail, nodeFrom(val), null, this); + } + }, { + key: "unshift", + value: function unshift(val) { + return add(null, nodeFrom(val), this.head, this); + } + }, { + key: "remove", + value: function remove(node) { + return _remove(node, this); + } + }, { + key: "pop", + value: function pop() { + return _remove(this.tail, this).value; + } + }, { + key: "popNode", + value: function popNode() { + return _remove(this.tail, this); + } + }, { + key: "shift", + value: function shift() { + return _remove(this.head, this).value; + } + }, { + key: "shiftNode", + value: function shiftNode() { + return _remove(this.head, this); + } + }, { + key: "get_object_at", + value: function get_object_at(index) { + if (index <= this.length()) { + var i = 1; + var current = this.head; + while (i < index) { + current = current.next; + i++; + } + return current.value; + } + } + }, { + key: "set_object_at", + value: function set_object_at(index, value) { + if (index <= this.length()) { + var i = 1; + var current = this.head; + while (i < index) { + current = current.next; + i++; + } + current.value = value; + } + } + }]); + + return LinkedList; +}(); + +module.exports = LinkedList; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* + *This class is the javascript implementation of the Point.java class in jdk + */ +function Point(x, y, p) { + this.x = null; + this.y = null; + if (x == null && y == null && p == null) { + this.x = 0; + this.y = 0; + } else if (typeof x == 'number' && typeof y == 'number' && p == null) { + this.x = x; + this.y = y; + } else if (x.constructor.name == 'Point' && y == null && p == null) { + p = x; + this.x = p.x; + this.y = p.y; + } +} + +Point.prototype.getX = function () { + return this.x; +}; + +Point.prototype.getY = function () { + return this.y; +}; + +Point.prototype.getLocation = function () { + return new Point(this.x, this.y); +}; + +Point.prototype.setLocation = function (x, y, p) { + if (x.constructor.name == 'Point' && y == null && p == null) { + p = x; + this.setLocation(p.x, p.y); + } else if (typeof x == 'number' && typeof y == 'number' && p == null) { + //if both parameters are integer just move (x,y) location + if (parseInt(x) == x && parseInt(y) == y) { + this.move(x, y); + } else { + this.x = Math.floor(x + 0.5); + this.y = Math.floor(y + 0.5); + } + } +}; + +Point.prototype.move = function (x, y) { + this.x = x; + this.y = y; +}; + +Point.prototype.translate = function (dx, dy) { + this.x += dx; + this.y += dy; +}; + +Point.prototype.equals = function (obj) { + if (obj.constructor.name == "Point") { + var pt = obj; + return this.x == pt.x && this.y == pt.y; + } + return this == obj; +}; + +Point.prototype.toString = function () { + return new Point().constructor.name + "[x=" + this.x + ",y=" + this.y + "]"; +}; + +module.exports = Point; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function RectangleD(x, y, width, height) { + this.x = 0; + this.y = 0; + this.width = 0; + this.height = 0; + + if (x != null && y != null && width != null && height != null) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } +} + +RectangleD.prototype.getX = function () { + return this.x; +}; + +RectangleD.prototype.setX = function (x) { + this.x = x; +}; + +RectangleD.prototype.getY = function () { + return this.y; +}; + +RectangleD.prototype.setY = function (y) { + this.y = y; +}; + +RectangleD.prototype.getWidth = function () { + return this.width; +}; + +RectangleD.prototype.setWidth = function (width) { + this.width = width; +}; + +RectangleD.prototype.getHeight = function () { + return this.height; +}; + +RectangleD.prototype.setHeight = function (height) { + this.height = height; +}; + +RectangleD.prototype.getRight = function () { + return this.x + this.width; +}; + +RectangleD.prototype.getBottom = function () { + return this.y + this.height; +}; + +RectangleD.prototype.intersects = function (a) { + if (this.getRight() < a.x) { + return false; + } + + if (this.getBottom() < a.y) { + return false; + } + + if (a.getRight() < this.x) { + return false; + } + + if (a.getBottom() < this.y) { + return false; + } + + return true; +}; + +RectangleD.prototype.getCenterX = function () { + return this.x + this.width / 2; +}; + +RectangleD.prototype.getMinX = function () { + return this.getX(); +}; + +RectangleD.prototype.getMaxX = function () { + return this.getX() + this.width; +}; + +RectangleD.prototype.getCenterY = function () { + return this.y + this.height / 2; +}; + +RectangleD.prototype.getMinY = function () { + return this.getY(); +}; + +RectangleD.prototype.getMaxY = function () { + return this.getY() + this.height; +}; + +RectangleD.prototype.getWidthHalf = function () { + return this.width / 2; +}; + +RectangleD.prototype.getHeightHalf = function () { + return this.height / 2; +}; + +module.exports = RectangleD; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +function UniqueIDGeneretor() {} + +UniqueIDGeneretor.lastID = 0; + +UniqueIDGeneretor.createID = function (obj) { + if (UniqueIDGeneretor.isPrimitive(obj)) { + return obj; + } + if (obj.uniqueID != null) { + return obj.uniqueID; + } + obj.uniqueID = UniqueIDGeneretor.getString(); + UniqueIDGeneretor.lastID++; + return obj.uniqueID; +}; + +UniqueIDGeneretor.getString = function (id) { + if (id == null) id = UniqueIDGeneretor.lastID; + return "Object#" + id + ""; +}; + +UniqueIDGeneretor.isPrimitive = function (arg) { + var type = typeof arg === "undefined" ? "undefined" : _typeof(arg); + return arg == null || type != "object" && type != "function"; +}; + +module.exports = UniqueIDGeneretor; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __nested_webpack_require_64072__) { + +"use strict"; + + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var LayoutConstants = __nested_webpack_require_64072__(0); +var LGraphManager = __nested_webpack_require_64072__(6); +var LNode = __nested_webpack_require_64072__(3); +var LEdge = __nested_webpack_require_64072__(1); +var LGraph = __nested_webpack_require_64072__(5); +var PointD = __nested_webpack_require_64072__(4); +var Transform = __nested_webpack_require_64072__(17); +var Emitter = __nested_webpack_require_64072__(27); + +function Layout(isRemoteUse) { + Emitter.call(this); + + //Layout Quality: 0:draft, 1:default, 2:proof + this.layoutQuality = LayoutConstants.QUALITY; + //Whether layout should create bendpoints as needed or not + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + //Whether layout should be incremental or not + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + //Whether we animate from before to after layout node positions + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + //Whether we animate the layout process or not + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + //Number iterations that should be done between two successive animations + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + /** + * Whether or not leaf nodes (non-compound nodes) are of uniform sizes. When + * they are, both spring and repulsion forces between two leaf nodes can be + * calculated without the expensive clipping point calculations, resulting + * in major speed-up. + */ + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + /** + * This is used for creation of bendpoints by using dummy nodes and edges. + * Maps an LEdge to its dummy bendpoint path. + */ + this.edgeToDummyNodes = new Map(); + this.graphManager = new LGraphManager(this); + this.isLayoutFinished = false; + this.isSubLayout = false; + this.isRemoteUse = false; + + if (isRemoteUse != null) { + this.isRemoteUse = isRemoteUse; + } +} + +Layout.RANDOM_SEED = 1; + +Layout.prototype = Object.create(Emitter.prototype); + +Layout.prototype.getGraphManager = function () { + return this.graphManager; +}; + +Layout.prototype.getAllNodes = function () { + return this.graphManager.getAllNodes(); +}; + +Layout.prototype.getAllEdges = function () { + return this.graphManager.getAllEdges(); +}; + +Layout.prototype.getAllNodesToApplyGravitation = function () { + return this.graphManager.getAllNodesToApplyGravitation(); +}; + +Layout.prototype.newGraphManager = function () { + var gm = new LGraphManager(this); + this.graphManager = gm; + return gm; +}; + +Layout.prototype.newGraph = function (vGraph) { + return new LGraph(null, this.graphManager, vGraph); +}; + +Layout.prototype.newNode = function (vNode) { + return new LNode(this.graphManager, vNode); +}; + +Layout.prototype.newEdge = function (vEdge) { + return new LEdge(null, null, vEdge); +}; + +Layout.prototype.checkLayoutSuccess = function () { + return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge(); +}; + +Layout.prototype.runLayout = function () { + this.isLayoutFinished = false; + + if (this.tilingPreLayout) { + this.tilingPreLayout(); + } + + this.initParameters(); + var isLayoutSuccessfull; + + if (this.checkLayoutSuccess()) { + isLayoutSuccessfull = false; + } else { + isLayoutSuccessfull = this.layout(); + } + + if (LayoutConstants.ANIMATE === 'during') { + // If this is a 'during' layout animation. Layout is not finished yet. + // We need to perform these in index.js when layout is really finished. + return false; + } + + if (isLayoutSuccessfull) { + if (!this.isSubLayout) { + this.doPostLayout(); + } + } + + if (this.tilingPostLayout) { + this.tilingPostLayout(); + } + + this.isLayoutFinished = true; + + return isLayoutSuccessfull; +}; + +/** + * This method performs the operations required after layout. + */ +Layout.prototype.doPostLayout = function () { + //assert !isSubLayout : "Should not be called on sub-layout!"; + // Propagate geometric changes to v-level objects + if (!this.incremental) { + this.transform(); + } + this.update(); +}; + +/** + * This method updates the geometry of the target graph according to + * calculated layout. + */ +Layout.prototype.update2 = function () { + // update bend points + if (this.createBendsAsNeeded) { + this.createBendpointsFromDummyNodes(); + + // reset all edges, since the topology has changed + this.graphManager.resetAllEdges(); + } + + // perform edge, node and root updates if layout is not called + // remotely + if (!this.isRemoteUse) { + // update all edges + var edge; + var allEdges = this.graphManager.getAllEdges(); + for (var i = 0; i < allEdges.length; i++) { + edge = allEdges[i]; + // this.update(edge); + } + + // recursively update nodes + var node; + var nodes = this.graphManager.getRoot().getNodes(); + for (var i = 0; i < nodes.length; i++) { + node = nodes[i]; + // this.update(node); + } + + // update root graph + this.update(this.graphManager.getRoot()); + } +}; + +Layout.prototype.update = function (obj) { + if (obj == null) { + this.update2(); + } else if (obj instanceof LNode) { + var node = obj; + if (node.getChild() != null) { + // since node is compound, recursively update child nodes + var nodes = node.getChild().getNodes(); + for (var i = 0; i < nodes.length; i++) { + update(nodes[i]); + } + } + + // if the l-level node is associated with a v-level graph object, + // then it is assumed that the v-level node implements the + // interface Updatable. + if (node.vGraphObject != null) { + // cast to Updatable without any type check + var vNode = node.vGraphObject; + + // call the update method of the interface + vNode.update(node); + } + } else if (obj instanceof LEdge) { + var edge = obj; + // if the l-level edge is associated with a v-level graph object, + // then it is assumed that the v-level edge implements the + // interface Updatable. + + if (edge.vGraphObject != null) { + // cast to Updatable without any type check + var vEdge = edge.vGraphObject; + + // call the update method of the interface + vEdge.update(edge); + } + } else if (obj instanceof LGraph) { + var graph = obj; + // if the l-level graph is associated with a v-level graph object, + // then it is assumed that the v-level object implements the + // interface Updatable. + + if (graph.vGraphObject != null) { + // cast to Updatable without any type check + var vGraph = graph.vGraphObject; + + // call the update method of the interface + vGraph.update(graph); + } + } +}; + +/** + * This method is used to set all layout parameters to default values + * determined at compile time. + */ +Layout.prototype.initParameters = function () { + if (!this.isSubLayout) { + this.layoutQuality = LayoutConstants.QUALITY; + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + } + + if (this.animationDuringLayout) { + this.animationOnLayout = false; + } +}; + +Layout.prototype.transform = function (newLeftTop) { + if (newLeftTop == undefined) { + this.transform(new PointD(0, 0)); + } else { + // create a transformation object (from Eclipse to layout). When an + // inverse transform is applied, we get upper-left coordinate of the + // drawing or the root graph at given input coordinate (some margins + // already included in calculation of left-top). + + var trans = new Transform(); + var leftTop = this.graphManager.getRoot().updateLeftTop(); + + if (leftTop != null) { + trans.setWorldOrgX(newLeftTop.x); + trans.setWorldOrgY(newLeftTop.y); + + trans.setDeviceOrgX(leftTop.x); + trans.setDeviceOrgY(leftTop.y); + + var nodes = this.getAllNodes(); + var node; + + for (var i = 0; i < nodes.length; i++) { + node = nodes[i]; + node.transform(trans); + } + } + } +}; + +Layout.prototype.positionNodesRandomly = function (graph) { + + if (graph == undefined) { + //assert !this.incremental; + this.positionNodesRandomly(this.getGraphManager().getRoot()); + this.getGraphManager().getRoot().updateBounds(true); + } else { + var lNode; + var childGraph; + + var nodes = graph.getNodes(); + for (var i = 0; i < nodes.length; i++) { + lNode = nodes[i]; + childGraph = lNode.getChild(); + + if (childGraph == null) { + lNode.scatter(); + } else if (childGraph.getNodes().length == 0) { + lNode.scatter(); + } else { + this.positionNodesRandomly(childGraph); + lNode.updateBounds(); + } + } + } +}; + +/** + * This method returns a list of trees where each tree is represented as a + * list of l-nodes. The method returns a list of size 0 when: + * - The graph is not flat or + * - One of the component(s) of the graph is not a tree. + */ +Layout.prototype.getFlatForest = function () { + var flatForest = []; + var isForest = true; + + // Quick reference for all nodes in the graph manager associated with + // this layout. The list should not be changed. + var allNodes = this.graphManager.getRoot().getNodes(); + + // First be sure that the graph is flat + var isFlat = true; + + for (var i = 0; i < allNodes.length; i++) { + if (allNodes[i].getChild() != null) { + isFlat = false; + } + } + + // Return empty forest if the graph is not flat. + if (!isFlat) { + return flatForest; + } + + // Run BFS for each component of the graph. + + var visited = new Set(); + var toBeVisited = []; + var parents = new Map(); + var unProcessedNodes = []; + + unProcessedNodes = unProcessedNodes.concat(allNodes); + + // Each iteration of this loop finds a component of the graph and + // decides whether it is a tree or not. If it is a tree, adds it to the + // forest and continued with the next component. + + while (unProcessedNodes.length > 0 && isForest) { + toBeVisited.push(unProcessedNodes[0]); + + // Start the BFS. Each iteration of this loop visits a node in a + // BFS manner. + while (toBeVisited.length > 0 && isForest) { + //pool operation + var currentNode = toBeVisited[0]; + toBeVisited.splice(0, 1); + visited.add(currentNode); + + // Traverse all neighbors of this node + var neighborEdges = currentNode.getEdges(); + + for (var i = 0; i < neighborEdges.length; i++) { + var currentNeighbor = neighborEdges[i].getOtherEnd(currentNode); + + // If BFS is not growing from this neighbor. + if (parents.get(currentNode) != currentNeighbor) { + // We haven't previously visited this neighbor. + if (!visited.has(currentNeighbor)) { + toBeVisited.push(currentNeighbor); + parents.set(currentNeighbor, currentNode); + } + // Since we have previously visited this neighbor and + // this neighbor is not parent of currentNode, given + // graph contains a component that is not tree, hence + // it is not a forest. + else { + isForest = false; + break; + } + } + } + } + + // The graph contains a component that is not a tree. Empty + // previously found trees. The method will end. + if (!isForest) { + flatForest = []; + } + // Save currently visited nodes as a tree in our forest. Reset + // visited and parents lists. Continue with the next component of + // the graph, if any. + else { + var temp = [].concat(_toConsumableArray(visited)); + flatForest.push(temp); + //flatForest = flatForest.concat(temp); + //unProcessedNodes.removeAll(visited); + for (var i = 0; i < temp.length; i++) { + var value = temp[i]; + var index = unProcessedNodes.indexOf(value); + if (index > -1) { + unProcessedNodes.splice(index, 1); + } + } + visited = new Set(); + parents = new Map(); + } + } + + return flatForest; +}; + +/** + * This method creates dummy nodes (an l-level node with minimal dimensions) + * for the given edge (one per bendpoint). The existing l-level structure + * is updated accordingly. + */ +Layout.prototype.createDummyNodesForBendpoints = function (edge) { + var dummyNodes = []; + var prev = edge.source; + + var graph = this.graphManager.calcLowestCommonAncestor(edge.source, edge.target); + + for (var i = 0; i < edge.bendpoints.length; i++) { + // create new dummy node + var dummyNode = this.newNode(null); + dummyNode.setRect(new Point(0, 0), new Dimension(1, 1)); + + graph.add(dummyNode); + + // create new dummy edge between prev and dummy node + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev, dummyNode); + + dummyNodes.add(dummyNode); + prev = dummyNode; + } + + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev, edge.target); + + this.edgeToDummyNodes.set(edge, dummyNodes); + + // remove real edge from graph manager if it is inter-graph + if (edge.isInterGraph()) { + this.graphManager.remove(edge); + } + // else, remove the edge from the current graph + else { + graph.remove(edge); + } + + return dummyNodes; +}; + +/** + * This method creates bendpoints for edges from the dummy nodes + * at l-level. + */ +Layout.prototype.createBendpointsFromDummyNodes = function () { + var edges = []; + edges = edges.concat(this.graphManager.getAllEdges()); + edges = [].concat(_toConsumableArray(this.edgeToDummyNodes.keys())).concat(edges); + + for (var k = 0; k < edges.length; k++) { + var lEdge = edges[k]; + + if (lEdge.bendpoints.length > 0) { + var path = this.edgeToDummyNodes.get(lEdge); + + for (var i = 0; i < path.length; i++) { + var dummyNode = path[i]; + var p = new PointD(dummyNode.getCenterX(), dummyNode.getCenterY()); + + // update bendpoint's location according to dummy node + var ebp = lEdge.bendpoints.get(i); + ebp.x = p.x; + ebp.y = p.y; + + // remove the dummy node, dummy edges incident with this + // dummy node is also removed (within the remove method) + dummyNode.getOwner().remove(dummyNode); + } + + // add the real edge to graph + this.graphManager.add(lEdge, lEdge.source, lEdge.target); + } + } +}; + +Layout.transform = function (sliderValue, defaultValue, minDiv, maxMul) { + if (minDiv != undefined && maxMul != undefined) { + var value = defaultValue; + + if (sliderValue <= 50) { + var minValue = defaultValue / minDiv; + value -= (defaultValue - minValue) / 50 * (50 - sliderValue); + } else { + var maxValue = defaultValue * maxMul; + value += (maxValue - defaultValue) / 50 * (sliderValue - 50); + } + + return value; + } else { + var a, b; + + if (sliderValue <= 50) { + a = 9.0 * defaultValue / 500.0; + b = defaultValue / 10.0; + } else { + a = 9.0 * defaultValue / 50.0; + b = -8 * defaultValue; + } + + return a * sliderValue + b; + } +}; + +/** + * This method finds and returns the center of the given nodes, assuming + * that the given nodes form a tree in themselves. + */ +Layout.findCenterOfTree = function (nodes) { + var list = []; + list = list.concat(nodes); + + var removedNodes = []; + var remainingDegrees = new Map(); + var foundCenter = false; + var centerNode = null; + + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + + for (var i = 0; i < list.length; i++) { + var node = list[i]; + var degree = node.getNeighborsList().size; + remainingDegrees.set(node, node.getNeighborsList().size); + + if (degree == 1) { + removedNodes.push(node); + } + } + + var tempList = []; + tempList = tempList.concat(removedNodes); + + while (!foundCenter) { + var tempList2 = []; + tempList2 = tempList2.concat(tempList); + tempList = []; + + for (var i = 0; i < list.length; i++) { + var node = list[i]; + + var index = list.indexOf(node); + if (index >= 0) { + list.splice(index, 1); + } + + var neighbours = node.getNeighborsList(); + + neighbours.forEach(function (neighbour) { + if (removedNodes.indexOf(neighbour) < 0) { + var otherDegree = remainingDegrees.get(neighbour); + var newDegree = otherDegree - 1; + + if (newDegree == 1) { + tempList.push(neighbour); + } + + remainingDegrees.set(neighbour, newDegree); + } + }); + } + + removedNodes = removedNodes.concat(tempList); + + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + } + + return centerNode; +}; + +/** + * During the coarsening process, this layout may be referenced by two graph managers + * this setter function grants access to change the currently being used graph manager + */ +Layout.prototype.setGraphManager = function (gm) { + this.graphManager = gm; +}; + +module.exports = Layout; + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function RandomSeed() {} +// adapted from: https://stackoverflow.com/a/19303725 +RandomSeed.seed = 1; +RandomSeed.x = 0; + +RandomSeed.nextDouble = function () { + RandomSeed.x = Math.sin(RandomSeed.seed++) * 10000; + return RandomSeed.x - Math.floor(RandomSeed.x); +}; + +module.exports = RandomSeed; + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __nested_webpack_require_81860__) { + +"use strict"; + + +var PointD = __nested_webpack_require_81860__(4); + +function Transform(x, y) { + this.lworldOrgX = 0.0; + this.lworldOrgY = 0.0; + this.ldeviceOrgX = 0.0; + this.ldeviceOrgY = 0.0; + this.lworldExtX = 1.0; + this.lworldExtY = 1.0; + this.ldeviceExtX = 1.0; + this.ldeviceExtY = 1.0; +} + +Transform.prototype.getWorldOrgX = function () { + return this.lworldOrgX; +}; + +Transform.prototype.setWorldOrgX = function (wox) { + this.lworldOrgX = wox; +}; + +Transform.prototype.getWorldOrgY = function () { + return this.lworldOrgY; +}; + +Transform.prototype.setWorldOrgY = function (woy) { + this.lworldOrgY = woy; +}; + +Transform.prototype.getWorldExtX = function () { + return this.lworldExtX; +}; + +Transform.prototype.setWorldExtX = function (wex) { + this.lworldExtX = wex; +}; + +Transform.prototype.getWorldExtY = function () { + return this.lworldExtY; +}; + +Transform.prototype.setWorldExtY = function (wey) { + this.lworldExtY = wey; +}; + +/* Device related */ + +Transform.prototype.getDeviceOrgX = function () { + return this.ldeviceOrgX; +}; + +Transform.prototype.setDeviceOrgX = function (dox) { + this.ldeviceOrgX = dox; +}; + +Transform.prototype.getDeviceOrgY = function () { + return this.ldeviceOrgY; +}; + +Transform.prototype.setDeviceOrgY = function (doy) { + this.ldeviceOrgY = doy; +}; + +Transform.prototype.getDeviceExtX = function () { + return this.ldeviceExtX; +}; + +Transform.prototype.setDeviceExtX = function (dex) { + this.ldeviceExtX = dex; +}; + +Transform.prototype.getDeviceExtY = function () { + return this.ldeviceExtY; +}; + +Transform.prototype.setDeviceExtY = function (dey) { + this.ldeviceExtY = dey; +}; + +Transform.prototype.transformX = function (x) { + var xDevice = 0.0; + var worldExtX = this.lworldExtX; + if (worldExtX != 0.0) { + xDevice = this.ldeviceOrgX + (x - this.lworldOrgX) * this.ldeviceExtX / worldExtX; + } + + return xDevice; +}; + +Transform.prototype.transformY = function (y) { + var yDevice = 0.0; + var worldExtY = this.lworldExtY; + if (worldExtY != 0.0) { + yDevice = this.ldeviceOrgY + (y - this.lworldOrgY) * this.ldeviceExtY / worldExtY; + } + + return yDevice; +}; + +Transform.prototype.inverseTransformX = function (x) { + var xWorld = 0.0; + var deviceExtX = this.ldeviceExtX; + if (deviceExtX != 0.0) { + xWorld = this.lworldOrgX + (x - this.ldeviceOrgX) * this.lworldExtX / deviceExtX; + } + + return xWorld; +}; + +Transform.prototype.inverseTransformY = function (y) { + var yWorld = 0.0; + var deviceExtY = this.ldeviceExtY; + if (deviceExtY != 0.0) { + yWorld = this.lworldOrgY + (y - this.ldeviceOrgY) * this.lworldExtY / deviceExtY; + } + return yWorld; +}; + +Transform.prototype.inverseTransformPoint = function (inPoint) { + var outPoint = new PointD(this.inverseTransformX(inPoint.x), this.inverseTransformY(inPoint.y)); + return outPoint; +}; + +module.exports = Transform; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __nested_webpack_require_84747__) { + +"use strict"; + + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var Layout = __nested_webpack_require_84747__(15); +var FDLayoutConstants = __nested_webpack_require_84747__(7); +var LayoutConstants = __nested_webpack_require_84747__(0); +var IGeometry = __nested_webpack_require_84747__(8); +var IMath = __nested_webpack_require_84747__(9); + +function FDLayout() { + Layout.call(this); + + this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.idealEdgeLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH; + this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + this.displacementThresholdPerNode = 3.0 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100; + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.initialCoolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.totalDisplacement = 0.0; + this.oldTotalDisplacement = 0.0; + this.maxIterations = FDLayoutConstants.MAX_ITERATIONS; +} + +FDLayout.prototype = Object.create(Layout.prototype); + +for (var prop in Layout) { + FDLayout[prop] = Layout[prop]; +} + +FDLayout.prototype.initParameters = function () { + Layout.prototype.initParameters.call(this, arguments); + + this.totalIterations = 0; + this.notAnimatedIterations = 0; + + this.useFRGridVariant = FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION; + + this.grid = []; +}; + +FDLayout.prototype.calcIdealEdgeLengths = function () { + var edge; + var lcaDepth; + var source; + var target; + var sizeOfSourceInLca; + var sizeOfTargetInLca; + + var allEdges = this.getGraphManager().getAllEdges(); + for (var i = 0; i < allEdges.length; i++) { + edge = allEdges[i]; + + edge.idealLength = this.idealEdgeLength; + + if (edge.isInterGraph) { + source = edge.getSource(); + target = edge.getTarget(); + + sizeOfSourceInLca = edge.getSourceInLca().getEstimatedSize(); + sizeOfTargetInLca = edge.getTargetInLca().getEstimatedSize(); + + if (this.useSmartIdealEdgeLengthCalculation) { + edge.idealLength += sizeOfSourceInLca + sizeOfTargetInLca - 2 * LayoutConstants.SIMPLE_NODE_SIZE; + } + + lcaDepth = edge.getLca().getInclusionTreeDepth(); + + edge.idealLength += FDLayoutConstants.DEFAULT_EDGE_LENGTH * FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (source.getInclusionTreeDepth() + target.getInclusionTreeDepth() - 2 * lcaDepth); + } + } +}; + +FDLayout.prototype.initSpringEmbedder = function () { + + var s = this.getAllNodes().length; + if (this.incremental) { + if (s > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(this.coolingFactor * FDLayoutConstants.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (s - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL; + } else { + if (s > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR, 1.0 - (s - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } else { + this.coolingFactor = 1.0; + } + this.initialCoolingFactor = this.coolingFactor; + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT; + } + + this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations); + + this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length; + + this.repulsionRange = this.calcRepulsionRange(); +}; + +FDLayout.prototype.calcSpringForces = function () { + var lEdges = this.getAllEdges(); + var edge; + + for (var i = 0; i < lEdges.length; i++) { + edge = lEdges[i]; + + this.calcSpringForce(edge, edge.idealLength); + } +}; + +FDLayout.prototype.calcRepulsionForces = function () { + var gridUpdateAllowed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var forceToNodeSurroundingUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + var i, j; + var nodeA, nodeB; + var lNodes = this.getAllNodes(); + var processedNodeSet; + + if (this.useFRGridVariant) { + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed) { + this.updateGrid(); + } + + processedNodeSet = new Set(); + + // calculate repulsion forces between each nodes and its surrounding + for (i = 0; i < lNodes.length; i++) { + nodeA = lNodes[i]; + this.calculateRepulsionForceOfANode(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate); + processedNodeSet.add(nodeA); + } + } else { + for (i = 0; i < lNodes.length; i++) { + nodeA = lNodes[i]; + + for (j = i + 1; j < lNodes.length; j++) { + nodeB = lNodes[j]; + + // If both nodes are not members of the same graph, skip. + if (nodeA.getOwner() != nodeB.getOwner()) { + continue; + } + + this.calcRepulsionForce(nodeA, nodeB); + } + } + } +}; + +FDLayout.prototype.calcGravitationalForces = function () { + var node; + var lNodes = this.getAllNodesToApplyGravitation(); + + for (var i = 0; i < lNodes.length; i++) { + node = lNodes[i]; + this.calcGravitationalForce(node); + } +}; + +FDLayout.prototype.moveNodes = function () { + var lNodes = this.getAllNodes(); + var node; + + for (var i = 0; i < lNodes.length; i++) { + node = lNodes[i]; + node.move(); + } +}; + +FDLayout.prototype.calcSpringForce = function (edge, idealLength) { + var sourceNode = edge.getSource(); + var targetNode = edge.getTarget(); + + var length; + var springForce; + var springForceX; + var springForceY; + + // Update edge length + if (this.uniformLeafNodeSizes && sourceNode.getChild() == null && targetNode.getChild() == null) { + edge.updateLengthSimple(); + } else { + edge.updateLength(); + + if (edge.isOverlapingSourceAndTarget) { + return; + } + } + + length = edge.getLength(); + + if (length == 0) return; + + // Calculate spring forces + springForce = this.springConstant * (length - idealLength); + + // Project force onto x and y axes + springForceX = springForce * (edge.lengthX / length); + springForceY = springForce * (edge.lengthY / length); + + // Apply forces on the end nodes + sourceNode.springForceX += springForceX; + sourceNode.springForceY += springForceY; + targetNode.springForceX -= springForceX; + targetNode.springForceY -= springForceY; +}; + +FDLayout.prototype.calcRepulsionForce = function (nodeA, nodeB) { + var rectA = nodeA.getRect(); + var rectB = nodeB.getRect(); + var overlapAmount = new Array(2); + var clipPoints = new Array(4); + var distanceX; + var distanceY; + var distanceSquared; + var distance; + var repulsionForce; + var repulsionForceX; + var repulsionForceY; + + if (rectA.intersects(rectB)) // two nodes overlap + { + // calculate separation amount in x and y directions + IGeometry.calcSeparationAmount(rectA, rectB, overlapAmount, FDLayoutConstants.DEFAULT_EDGE_LENGTH / 2.0); + + repulsionForceX = 2 * overlapAmount[0]; + repulsionForceY = 2 * overlapAmount[1]; + + var childrenConstant = nodeA.noOfChildren * nodeB.noOfChildren / (nodeA.noOfChildren + nodeB.noOfChildren); + + // Apply forces on the two nodes + nodeA.repulsionForceX -= childrenConstant * repulsionForceX; + nodeA.repulsionForceY -= childrenConstant * repulsionForceY; + nodeB.repulsionForceX += childrenConstant * repulsionForceX; + nodeB.repulsionForceY += childrenConstant * repulsionForceY; + } else // no overlap + { + // calculate distance + + if (this.uniformLeafNodeSizes && nodeA.getChild() == null && nodeB.getChild() == null) // simply base repulsion on distance of node centers + { + distanceX = rectB.getCenterX() - rectA.getCenterX(); + distanceY = rectB.getCenterY() - rectA.getCenterY(); + } else // use clipping points + { + IGeometry.getIntersection(rectA, rectB, clipPoints); + + distanceX = clipPoints[2] - clipPoints[0]; + distanceY = clipPoints[3] - clipPoints[1]; + } + + // No repulsion range. FR grid variant should take care of this. + if (Math.abs(distanceX) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceX = IMath.sign(distanceX) * FDLayoutConstants.MIN_REPULSION_DIST; + } + + if (Math.abs(distanceY) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceY = IMath.sign(distanceY) * FDLayoutConstants.MIN_REPULSION_DIST; + } + + distanceSquared = distanceX * distanceX + distanceY * distanceY; + distance = Math.sqrt(distanceSquared); + + repulsionForce = this.repulsionConstant * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared; + + // Project force onto x and y axes + repulsionForceX = repulsionForce * distanceX / distance; + repulsionForceY = repulsionForce * distanceY / distance; + + // Apply forces on the two nodes + nodeA.repulsionForceX -= repulsionForceX; + nodeA.repulsionForceY -= repulsionForceY; + nodeB.repulsionForceX += repulsionForceX; + nodeB.repulsionForceY += repulsionForceY; + } +}; + +FDLayout.prototype.calcGravitationalForce = function (node) { + var ownerGraph; + var ownerCenterX; + var ownerCenterY; + var distanceX; + var distanceY; + var absDistanceX; + var absDistanceY; + var estimatedSize; + ownerGraph = node.getOwner(); + + ownerCenterX = (ownerGraph.getRight() + ownerGraph.getLeft()) / 2; + ownerCenterY = (ownerGraph.getTop() + ownerGraph.getBottom()) / 2; + distanceX = node.getCenterX() - ownerCenterX; + distanceY = node.getCenterY() - ownerCenterY; + absDistanceX = Math.abs(distanceX) + node.getWidth() / 2; + absDistanceY = Math.abs(distanceY) + node.getHeight() / 2; + + if (node.getOwner() == this.graphManager.getRoot()) // in the root graph + { + estimatedSize = ownerGraph.getEstimatedSize() * this.gravityRangeFactor; + + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node.gravitationForceX = -this.gravityConstant * distanceX; + node.gravitationForceY = -this.gravityConstant * distanceY; + } + } else // inside a compound + { + estimatedSize = ownerGraph.getEstimatedSize() * this.compoundGravityRangeFactor; + + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node.gravitationForceX = -this.gravityConstant * distanceX * this.compoundGravityConstant; + node.gravitationForceY = -this.gravityConstant * distanceY * this.compoundGravityConstant; + } + } +}; + +FDLayout.prototype.isConverged = function () { + var converged; + var oscilating = false; + + if (this.totalIterations > this.maxIterations / 3) { + oscilating = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2; + } + + converged = this.totalDisplacement < this.totalDisplacementThreshold; + + this.oldTotalDisplacement = this.totalDisplacement; + + return converged || oscilating; +}; + +FDLayout.prototype.animate = function () { + if (this.animationDuringLayout && !this.isSubLayout) { + if (this.notAnimatedIterations == this.animationPeriod) { + this.update(); + this.notAnimatedIterations = 0; + } else { + this.notAnimatedIterations++; + } + } +}; + +//This method calculates the number of children (weight) for all nodes +FDLayout.prototype.calcNoOfChildrenForAllNodes = function () { + var node; + var allNodes = this.graphManager.getAllNodes(); + + for (var i = 0; i < allNodes.length; i++) { + node = allNodes[i]; + node.noOfChildren = node.getNoOfChildren(); + } +}; + +// ----------------------------------------------------------------------------- +// Section: FR-Grid Variant Repulsion Force Calculation +// ----------------------------------------------------------------------------- + +FDLayout.prototype.calcGrid = function (graph) { + + var sizeX = 0; + var sizeY = 0; + + sizeX = parseInt(Math.ceil((graph.getRight() - graph.getLeft()) / this.repulsionRange)); + sizeY = parseInt(Math.ceil((graph.getBottom() - graph.getTop()) / this.repulsionRange)); + + var grid = new Array(sizeX); + + for (var i = 0; i < sizeX; i++) { + grid[i] = new Array(sizeY); + } + + for (var i = 0; i < sizeX; i++) { + for (var j = 0; j < sizeY; j++) { + grid[i][j] = new Array(); + } + } + + return grid; +}; + +FDLayout.prototype.addNodeToGrid = function (v, left, top) { + + var startX = 0; + var finishX = 0; + var startY = 0; + var finishY = 0; + + startX = parseInt(Math.floor((v.getRect().x - left) / this.repulsionRange)); + finishX = parseInt(Math.floor((v.getRect().width + v.getRect().x - left) / this.repulsionRange)); + startY = parseInt(Math.floor((v.getRect().y - top) / this.repulsionRange)); + finishY = parseInt(Math.floor((v.getRect().height + v.getRect().y - top) / this.repulsionRange)); + + for (var i = startX; i <= finishX; i++) { + for (var j = startY; j <= finishY; j++) { + this.grid[i][j].push(v); + v.setGridCoordinates(startX, finishX, startY, finishY); + } + } +}; + +FDLayout.prototype.updateGrid = function () { + var i; + var nodeA; + var lNodes = this.getAllNodes(); + + this.grid = this.calcGrid(this.graphManager.getRoot()); + + // put all nodes to proper grid cells + for (i = 0; i < lNodes.length; i++) { + nodeA = lNodes[i]; + this.addNodeToGrid(nodeA, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop()); + } +}; + +FDLayout.prototype.calculateRepulsionForceOfANode = function (nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate) { + + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed || forceToNodeSurroundingUpdate) { + var surrounding = new Set(); + nodeA.surrounding = new Array(); + var nodeB; + var grid = this.grid; + + for (var i = nodeA.startX - 1; i < nodeA.finishX + 2; i++) { + for (var j = nodeA.startY - 1; j < nodeA.finishY + 2; j++) { + if (!(i < 0 || j < 0 || i >= grid.length || j >= grid[0].length)) { + for (var k = 0; k < grid[i][j].length; k++) { + nodeB = grid[i][j][k]; + + // If both nodes are not members of the same graph, + // or both nodes are the same, skip. + if (nodeA.getOwner() != nodeB.getOwner() || nodeA == nodeB) { + continue; + } + + // check if the repulsion force between + // nodeA and nodeB has already been calculated + if (!processedNodeSet.has(nodeB) && !surrounding.has(nodeB)) { + var distanceX = Math.abs(nodeA.getCenterX() - nodeB.getCenterX()) - (nodeA.getWidth() / 2 + nodeB.getWidth() / 2); + var distanceY = Math.abs(nodeA.getCenterY() - nodeB.getCenterY()) - (nodeA.getHeight() / 2 + nodeB.getHeight() / 2); + + // if the distance between nodeA and nodeB + // is less then calculation range + if (distanceX <= this.repulsionRange && distanceY <= this.repulsionRange) { + //then add nodeB to surrounding of nodeA + surrounding.add(nodeB); + } + } + } + } + } + } + + nodeA.surrounding = [].concat(_toConsumableArray(surrounding)); + } + for (i = 0; i < nodeA.surrounding.length; i++) { + this.calcRepulsionForce(nodeA, nodeA.surrounding[i]); + } +}; + +FDLayout.prototype.calcRepulsionRange = function () { + return 0.0; +}; + +module.exports = FDLayout; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __nested_webpack_require_100902__) { + +"use strict"; + + +var LEdge = __nested_webpack_require_100902__(1); +var FDLayoutConstants = __nested_webpack_require_100902__(7); + +function FDLayoutEdge(source, target, vEdge) { + LEdge.call(this, source, target, vEdge); + this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH; +} + +FDLayoutEdge.prototype = Object.create(LEdge.prototype); + +for (var prop in LEdge) { + FDLayoutEdge[prop] = LEdge[prop]; +} + +module.exports = FDLayoutEdge; + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __nested_webpack_require_101387__) { + +"use strict"; + + +var LNode = __nested_webpack_require_101387__(3); + +function FDLayoutNode(gm, loc, size, vNode) { + // alternative constructor is handled inside LNode + LNode.call(this, gm, loc, size, vNode); + //Spring, repulsion and gravitational forces acting on this node + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + //Amount by which this node is to be moved in this iteration + this.displacementX = 0; + this.displacementY = 0; + + //Start and finish grid coordinates that this node is fallen into + this.startX = 0; + this.finishX = 0; + this.startY = 0; + this.finishY = 0; + + //Geometric neighbors of this node + this.surrounding = []; +} + +FDLayoutNode.prototype = Object.create(LNode.prototype); + +for (var prop in LNode) { + FDLayoutNode[prop] = LNode[prop]; +} + +FDLayoutNode.prototype.setGridCoordinates = function (_startX, _finishX, _startY, _finishY) { + this.startX = _startX; + this.finishX = _finishX; + this.startY = _startY; + this.finishY = _finishY; +}; + +module.exports = FDLayoutNode; + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function DimensionD(width, height) { + this.width = 0; + this.height = 0; + if (width !== null && height !== null) { + this.height = height; + this.width = width; + } +} + +DimensionD.prototype.getWidth = function () { + return this.width; +}; + +DimensionD.prototype.setWidth = function (width) { + this.width = width; +}; + +DimensionD.prototype.getHeight = function () { + return this.height; +}; + +DimensionD.prototype.setHeight = function (height) { + this.height = height; +}; + +module.exports = DimensionD; + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __nested_webpack_require_103173__) { + +"use strict"; + + +var UniqueIDGeneretor = __nested_webpack_require_103173__(14); + +function HashMap() { + this.map = {}; + this.keys = []; +} + +HashMap.prototype.put = function (key, value) { + var theId = UniqueIDGeneretor.createID(key); + if (!this.contains(theId)) { + this.map[theId] = value; + this.keys.push(key); + } +}; + +HashMap.prototype.contains = function (key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[key] != null; +}; + +HashMap.prototype.get = function (key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[theId]; +}; + +HashMap.prototype.keySet = function () { + return this.keys; +}; + +module.exports = HashMap; + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __nested_webpack_require_103901__) { + +"use strict"; + + +var UniqueIDGeneretor = __nested_webpack_require_103901__(14); + +function HashSet() { + this.set = {}; +} +; + +HashSet.prototype.add = function (obj) { + var theId = UniqueIDGeneretor.createID(obj); + if (!this.contains(theId)) this.set[theId] = obj; +}; + +HashSet.prototype.remove = function (obj) { + delete this.set[UniqueIDGeneretor.createID(obj)]; +}; + +HashSet.prototype.clear = function () { + this.set = {}; +}; + +HashSet.prototype.contains = function (obj) { + return this.set[UniqueIDGeneretor.createID(obj)] == obj; +}; + +HashSet.prototype.isEmpty = function () { + return this.size() === 0; +}; + +HashSet.prototype.size = function () { + return Object.keys(this.set).length; +}; + +//concats this.set to the given list +HashSet.prototype.addAllTo = function (list) { + var keys = Object.keys(this.set); + var length = keys.length; + for (var i = 0; i < length; i++) { + list.push(this.set[keys[i]]); + } +}; + +HashSet.prototype.size = function () { + return Object.keys(this.set).length; +}; + +HashSet.prototype.addAll = function (list) { + var s = list.length; + for (var i = 0; i < s; i++) { + var v = list[i]; + this.add(v); + } +}; + +module.exports = HashSet; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __nested_webpack_require_105138__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * A classic Quicksort algorithm with Hoare's partition + * - Works also on LinkedList objects + * + * Copyright: i-Vis Research Group, Bilkent University, 2007 - present + */ + +var LinkedList = __nested_webpack_require_105138__(11); + +var Quicksort = function () { + function Quicksort(A, compareFunction) { + _classCallCheck(this, Quicksort); + + if (compareFunction !== null || compareFunction !== undefined) this.compareFunction = this._defaultCompareFunction; + + var length = void 0; + if (A instanceof LinkedList) length = A.size();else length = A.length; + + this._quicksort(A, 0, length - 1); + } + + _createClass(Quicksort, [{ + key: '_quicksort', + value: function _quicksort(A, p, r) { + if (p < r) { + var q = this._partition(A, p, r); + this._quicksort(A, p, q); + this._quicksort(A, q + 1, r); + } + } + }, { + key: '_partition', + value: function _partition(A, p, r) { + var x = this._get(A, p); + var i = p; + var j = r; + while (true) { + while (this.compareFunction(x, this._get(A, j))) { + j--; + }while (this.compareFunction(this._get(A, i), x)) { + i++; + }if (i < j) { + this._swap(A, i, j); + i++; + j--; + } else return j; + } + } + }, { + key: '_get', + value: function _get(object, index) { + if (object instanceof LinkedList) return object.get_object_at(index);else return object[index]; + } + }, { + key: '_set', + value: function _set(object, index, value) { + if (object instanceof LinkedList) object.set_object_at(index, value);else object[index] = value; + } + }, { + key: '_swap', + value: function _swap(A, i, j) { + var temp = this._get(A, i); + this._set(A, i, this._get(A, j)); + this._set(A, j, temp); + } + }, { + key: '_defaultCompareFunction', + value: function _defaultCompareFunction(a, b) { + return b > a; + } + }]); + + return Quicksort; +}(); + +module.exports = Quicksort; + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Needleman-Wunsch algorithm is an procedure to compute the optimal global alignment of two string + * sequences by S.B.Needleman and C.D.Wunsch (1970). + * + * Aside from the inputs, you can assign the scores for, + * - Match: The two characters at the current index are same. + * - Mismatch: The two characters at the current index are different. + * - Insertion/Deletion(gaps): The best alignment involves one letter aligning to a gap in the other string. + */ + +var NeedlemanWunsch = function () { + function NeedlemanWunsch(sequence1, sequence2) { + var match_score = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + var mismatch_penalty = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1; + var gap_penalty = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1; + + _classCallCheck(this, NeedlemanWunsch); + + this.sequence1 = sequence1; + this.sequence2 = sequence2; + this.match_score = match_score; + this.mismatch_penalty = mismatch_penalty; + this.gap_penalty = gap_penalty; + + // Just the remove redundancy + this.iMax = sequence1.length + 1; + this.jMax = sequence2.length + 1; + + // Grid matrix of scores + this.grid = new Array(this.iMax); + for (var i = 0; i < this.iMax; i++) { + this.grid[i] = new Array(this.jMax); + + for (var j = 0; j < this.jMax; j++) { + this.grid[i][j] = 0; + } + } + + // Traceback matrix (2D array, each cell is an array of boolean values for [`Diag`, `Up`, `Left`] positions) + this.tracebackGrid = new Array(this.iMax); + for (var _i = 0; _i < this.iMax; _i++) { + this.tracebackGrid[_i] = new Array(this.jMax); + + for (var _j = 0; _j < this.jMax; _j++) { + this.tracebackGrid[_i][_j] = [null, null, null]; + } + } + + // The aligned sequences (return multiple possibilities) + this.alignments = []; + + // Final alignment score + this.score = -1; + + // Calculate scores and tracebacks + this.computeGrids(); + } + + _createClass(NeedlemanWunsch, [{ + key: "getScore", + value: function getScore() { + return this.score; + } + }, { + key: "getAlignments", + value: function getAlignments() { + return this.alignments; + } + + // Main dynamic programming procedure + + }, { + key: "computeGrids", + value: function computeGrids() { + // Fill in the first row + for (var j = 1; j < this.jMax; j++) { + this.grid[0][j] = this.grid[0][j - 1] + this.gap_penalty; + this.tracebackGrid[0][j] = [false, false, true]; + } + + // Fill in the first column + for (var i = 1; i < this.iMax; i++) { + this.grid[i][0] = this.grid[i - 1][0] + this.gap_penalty; + this.tracebackGrid[i][0] = [false, true, false]; + } + + // Fill the rest of the grid + for (var _i2 = 1; _i2 < this.iMax; _i2++) { + for (var _j2 = 1; _j2 < this.jMax; _j2++) { + // Find the max score(s) among [`Diag`, `Up`, `Left`] + var diag = void 0; + if (this.sequence1[_i2 - 1] === this.sequence2[_j2 - 1]) diag = this.grid[_i2 - 1][_j2 - 1] + this.match_score;else diag = this.grid[_i2 - 1][_j2 - 1] + this.mismatch_penalty; + + var up = this.grid[_i2 - 1][_j2] + this.gap_penalty; + var left = this.grid[_i2][_j2 - 1] + this.gap_penalty; + + // If there exists multiple max values, capture them for multiple paths + var maxOf = [diag, up, left]; + var indices = this.arrayAllMaxIndexes(maxOf); + + // Update Grids + this.grid[_i2][_j2] = maxOf[indices[0]]; + this.tracebackGrid[_i2][_j2] = [indices.includes(0), indices.includes(1), indices.includes(2)]; + } + } + + // Update alignment score + this.score = this.grid[this.iMax - 1][this.jMax - 1]; + } + + // Gets all possible valid sequence combinations + + }, { + key: "alignmentTraceback", + value: function alignmentTraceback() { + var inProcessAlignments = []; + + inProcessAlignments.push({ pos: [this.sequence1.length, this.sequence2.length], + seq1: "", + seq2: "" + }); + + while (inProcessAlignments[0]) { + var current = inProcessAlignments[0]; + var directions = this.tracebackGrid[current.pos[0]][current.pos[1]]; + + if (directions[0]) { + inProcessAlignments.push({ pos: [current.pos[0] - 1, current.pos[1] - 1], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + if (directions[1]) { + inProcessAlignments.push({ pos: [current.pos[0] - 1, current.pos[1]], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: '-' + current.seq2 + }); + } + if (directions[2]) { + inProcessAlignments.push({ pos: [current.pos[0], current.pos[1] - 1], + seq1: '-' + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + + if (current.pos[0] === 0 && current.pos[1] === 0) this.alignments.push({ sequence1: current.seq1, + sequence2: current.seq2 + }); + + inProcessAlignments.shift(); + } + + return this.alignments; + } + + // Helper Functions + + }, { + key: "getAllIndexes", + value: function getAllIndexes(arr, val) { + var indexes = [], + i = -1; + while ((i = arr.indexOf(val, i + 1)) !== -1) { + indexes.push(i); + } + return indexes; + } + }, { + key: "arrayAllMaxIndexes", + value: function arrayAllMaxIndexes(array) { + return this.getAllIndexes(array, Math.max.apply(null, array)); + } + }]); + + return NeedlemanWunsch; +}(); + +module.exports = NeedlemanWunsch; + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __nested_webpack_require_115611__) { + +"use strict"; + + +var layoutBase = function layoutBase() { + return; +}; + +layoutBase.FDLayout = __nested_webpack_require_115611__(18); +layoutBase.FDLayoutConstants = __nested_webpack_require_115611__(7); +layoutBase.FDLayoutEdge = __nested_webpack_require_115611__(19); +layoutBase.FDLayoutNode = __nested_webpack_require_115611__(20); +layoutBase.DimensionD = __nested_webpack_require_115611__(21); +layoutBase.HashMap = __nested_webpack_require_115611__(22); +layoutBase.HashSet = __nested_webpack_require_115611__(23); +layoutBase.IGeometry = __nested_webpack_require_115611__(8); +layoutBase.IMath = __nested_webpack_require_115611__(9); +layoutBase.Integer = __nested_webpack_require_115611__(10); +layoutBase.Point = __nested_webpack_require_115611__(12); +layoutBase.PointD = __nested_webpack_require_115611__(4); +layoutBase.RandomSeed = __nested_webpack_require_115611__(16); +layoutBase.RectangleD = __nested_webpack_require_115611__(13); +layoutBase.Transform = __nested_webpack_require_115611__(17); +layoutBase.UniqueIDGeneretor = __nested_webpack_require_115611__(14); +layoutBase.Quicksort = __nested_webpack_require_115611__(24); +layoutBase.LinkedList = __nested_webpack_require_115611__(11); +layoutBase.LGraphObject = __nested_webpack_require_115611__(2); +layoutBase.LGraph = __nested_webpack_require_115611__(5); +layoutBase.LEdge = __nested_webpack_require_115611__(1); +layoutBase.LGraphManager = __nested_webpack_require_115611__(6); +layoutBase.LNode = __nested_webpack_require_115611__(3); +layoutBase.Layout = __nested_webpack_require_115611__(15); +layoutBase.LayoutConstants = __nested_webpack_require_115611__(0); +layoutBase.NeedlemanWunsch = __nested_webpack_require_115611__(25); + +module.exports = layoutBase; + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function Emitter() { + this.listeners = []; +} + +var p = Emitter.prototype; + +p.addListener = function (event, callback) { + this.listeners.push({ + event: event, + callback: callback + }); +}; + +p.removeListener = function (event, callback) { + for (var i = this.listeners.length; i >= 0; i--) { + var l = this.listeners[i]; + + if (l.event === event && l.callback === callback) { + this.listeners.splice(i, 1); + } + } +}; + +p.emit = function (event, data) { + for (var i = 0; i < this.listeners.length; i++) { + var l = this.listeners[i]; + + if (event === l.event) { + l.callback(data); + } + } +}; + +module.exports = Emitter; + +/***/ }) +/******/ ]); +}); + +/***/ }), + +/***/ 1989: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var hashClear = __webpack_require__(51789), + hashDelete = __webpack_require__(80401), + hashGet = __webpack_require__(57667), + hashHas = __webpack_require__(21327), + hashSet = __webpack_require__(81866); + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +module.exports = Hash; + + +/***/ }), + +/***/ 38407: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var listCacheClear = __webpack_require__(27040), + listCacheDelete = __webpack_require__(14125), + listCacheGet = __webpack_require__(82117), + listCacheHas = __webpack_require__(67518), + listCacheSet = __webpack_require__(54705); + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +module.exports = ListCache; + + +/***/ }), + +/***/ 57071: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var getNative = __webpack_require__(10852), + root = __webpack_require__(55639); + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'); + +module.exports = Map; + + +/***/ }), + +/***/ 83369: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var mapCacheClear = __webpack_require__(24785), + mapCacheDelete = __webpack_require__(11285), + mapCacheGet = __webpack_require__(96000), + mapCacheHas = __webpack_require__(49916), + mapCacheSet = __webpack_require__(95265); + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +module.exports = MapCache; + + +/***/ }), + +/***/ 62705: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var root = __webpack_require__(55639); + +/** Built-in value references. */ +var Symbol = root.Symbol; + +module.exports = Symbol; + + +/***/ }), + +/***/ 29932: +/***/ ((module) => { + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +module.exports = arrayMap; + + +/***/ }), + +/***/ 34865: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseAssignValue = __webpack_require__(89465), + eq = __webpack_require__(77813); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +module.exports = assignValue; + + +/***/ }), + +/***/ 18470: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var eq = __webpack_require__(77813); + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +module.exports = assocIndexOf; + + +/***/ }), + +/***/ 89465: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var defineProperty = __webpack_require__(38777); + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +module.exports = baseAssignValue; + + +/***/ }), + +/***/ 97786: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var castPath = __webpack_require__(71811), + toKey = __webpack_require__(40327); + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; +} + +module.exports = baseGet; + + +/***/ }), + +/***/ 44239: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Symbol = __webpack_require__(62705), + getRawTag = __webpack_require__(89607), + objectToString = __webpack_require__(2333); + +/** `Object#toString` result references. */ +var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; + +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +module.exports = baseGetTag; + + +/***/ }), + +/***/ 28458: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isFunction = __webpack_require__(23560), + isMasked = __webpack_require__(15346), + isObject = __webpack_require__(13218), + toSource = __webpack_require__(80346); + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used for built-in method references. */ +var funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +module.exports = baseIsNative; + + +/***/ }), + +/***/ 10611: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var assignValue = __webpack_require__(34865), + castPath = __webpack_require__(71811), + isIndex = __webpack_require__(65776), + isObject = __webpack_require__(13218), + toKey = __webpack_require__(40327); + +/** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ +function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; +} + +module.exports = baseSet; + + +/***/ }), + +/***/ 80531: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Symbol = __webpack_require__(62705), + arrayMap = __webpack_require__(29932), + isArray = __webpack_require__(1469), + isSymbol = __webpack_require__(33448); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +module.exports = baseToString; + + +/***/ }), + +/***/ 27561: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var trimmedEndIndex = __webpack_require__(67990); + +/** Used to match leading whitespace. */ +var reTrimStart = /^\s+/; + +/** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ +function baseTrim(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; +} + +module.exports = baseTrim; + + +/***/ }), + +/***/ 71811: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isArray = __webpack_require__(1469), + isKey = __webpack_require__(15403), + stringToPath = __webpack_require__(55514), + toString = __webpack_require__(79833); + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ +function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); +} + +module.exports = castPath; + + +/***/ }), + +/***/ 278: +/***/ ((module) => { + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +module.exports = copyArray; + + +/***/ }), + +/***/ 14429: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var root = __webpack_require__(55639); + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +module.exports = coreJsData; + + +/***/ }), + +/***/ 38777: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var getNative = __webpack_require__(10852); + +var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); + +module.exports = defineProperty; + + +/***/ }), + +/***/ 31957: +/***/ ((module) => { + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +module.exports = freeGlobal; + + +/***/ }), + +/***/ 45050: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isKeyable = __webpack_require__(37019); + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +module.exports = getMapData; + + +/***/ }), + +/***/ 10852: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseIsNative = __webpack_require__(28458), + getValue = __webpack_require__(47801); + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +module.exports = getNative; + + +/***/ }), + +/***/ 89607: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Symbol = __webpack_require__(62705); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} + +module.exports = getRawTag; + + +/***/ }), + +/***/ 47801: +/***/ ((module) => { + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +module.exports = getValue; + + +/***/ }), + +/***/ 51789: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var nativeCreate = __webpack_require__(94536); + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} + +module.exports = hashClear; + + +/***/ }), + +/***/ 80401: +/***/ ((module) => { + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} + +module.exports = hashDelete; + + +/***/ }), + +/***/ 57667: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var nativeCreate = __webpack_require__(94536); + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +module.exports = hashGet; + + +/***/ }), + +/***/ 21327: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var nativeCreate = __webpack_require__(94536); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); +} + +module.exports = hashHas; + + +/***/ }), + +/***/ 81866: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var nativeCreate = __webpack_require__(94536); + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +module.exports = hashSet; + + +/***/ }), + +/***/ 65776: +/***/ ((module) => { + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} + +module.exports = isIndex; + + +/***/ }), + +/***/ 15403: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isArray = __webpack_require__(1469), + isSymbol = __webpack_require__(33448); + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +module.exports = isKey; + + +/***/ }), + +/***/ 37019: +/***/ ((module) => { + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +module.exports = isKeyable; + + +/***/ }), + +/***/ 15346: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var coreJsData = __webpack_require__(14429); + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +module.exports = isMasked; + + +/***/ }), + +/***/ 27040: +/***/ ((module) => { + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} + +module.exports = listCacheClear; + + +/***/ }), + +/***/ 14125: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var assocIndexOf = __webpack_require__(18470); + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; +} + +module.exports = listCacheDelete; + + +/***/ }), + +/***/ 82117: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var assocIndexOf = __webpack_require__(18470); + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +module.exports = listCacheGet; + + +/***/ }), + +/***/ 67518: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var assocIndexOf = __webpack_require__(18470); + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +module.exports = listCacheHas; + + +/***/ }), + +/***/ 54705: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var assocIndexOf = __webpack_require__(18470); + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +module.exports = listCacheSet; + + +/***/ }), + +/***/ 24785: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Hash = __webpack_require__(1989), + ListCache = __webpack_require__(38407), + Map = __webpack_require__(57071); + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +module.exports = mapCacheClear; + + +/***/ }), + +/***/ 11285: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var getMapData = __webpack_require__(45050); + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} + +module.exports = mapCacheDelete; + + +/***/ }), + +/***/ 96000: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var getMapData = __webpack_require__(45050); + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +module.exports = mapCacheGet; + + +/***/ }), + +/***/ 49916: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var getMapData = __webpack_require__(45050); + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +module.exports = mapCacheHas; + + +/***/ }), + +/***/ 95265: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var getMapData = __webpack_require__(45050); + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} + +module.exports = mapCacheSet; + + +/***/ }), + +/***/ 24523: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var memoize = __webpack_require__(88306); + +/** Used as the maximum memoize cache size. */ +var MAX_MEMOIZE_SIZE = 500; + +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ +function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; +} + +module.exports = memoizeCapped; + + +/***/ }), + +/***/ 94536: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var getNative = __webpack_require__(10852); + +/* Built-in method references that are verified to be native. */ +var nativeCreate = getNative(Object, 'create'); + +module.exports = nativeCreate; + + +/***/ }), + +/***/ 2333: +/***/ ((module) => { + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); +} + +module.exports = objectToString; + + +/***/ }), + +/***/ 55639: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var freeGlobal = __webpack_require__(31957); + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +module.exports = root; + + +/***/ }), + +/***/ 55514: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var memoizeCapped = __webpack_require__(24523); + +/** Used to match property names within property paths. */ +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +}); + +module.exports = stringToPath; + + +/***/ }), + +/***/ 40327: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isSymbol = __webpack_require__(33448); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +module.exports = toKey; + + +/***/ }), + +/***/ 80346: +/***/ ((module) => { + +/** Used for built-in method references. */ +var funcProto = Function.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +module.exports = toSource; + + +/***/ }), + +/***/ 67990: +/***/ ((module) => { + +/** Used to match a single whitespace character. */ +var reWhitespace = /\s/; + +/** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ +function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; +} + +module.exports = trimmedEndIndex; + + +/***/ }), + +/***/ 23279: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isObject = __webpack_require__(13218), + now = __webpack_require__(7771), + toNumber = __webpack_require__(14841); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ +function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; +} + +module.exports = debounce; + + +/***/ }), + +/***/ 77813: +/***/ ((module) => { + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +module.exports = eq; + + +/***/ }), + +/***/ 27361: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseGet = __webpack_require__(97786); + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +module.exports = get; + + +/***/ }), + +/***/ 1469: +/***/ ((module) => { + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +module.exports = isArray; + + +/***/ }), + +/***/ 23560: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseGetTag = __webpack_require__(44239), + isObject = __webpack_require__(13218); + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +module.exports = isFunction; + + +/***/ }), + +/***/ 13218: +/***/ ((module) => { + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +module.exports = isObject; + + +/***/ }), + +/***/ 37005: +/***/ ((module) => { + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} + +module.exports = isObjectLike; + + +/***/ }), + +/***/ 33448: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseGetTag = __webpack_require__(44239), + isObjectLike = __webpack_require__(37005); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +module.exports = isSymbol; + + +/***/ }), + +/***/ 88306: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var MapCache = __webpack_require__(83369); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ +function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; +} + +// Expose `MapCache`. +memoize.Cache = MapCache; + +module.exports = memoize; + + +/***/ }), + +/***/ 7771: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var root = __webpack_require__(55639); + +/** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ +var now = function() { + return root.Date.now(); +}; + +module.exports = now; + + +/***/ }), + +/***/ 36968: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseSet = __webpack_require__(10611); + +/** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ +function set(object, path, value) { + return object == null ? object : baseSet(object, path, value); +} + +module.exports = set; + + +/***/ }), + +/***/ 14841: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseTrim = __webpack_require__(27561), + isObject = __webpack_require__(13218), + isSymbol = __webpack_require__(33448); + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +module.exports = toNumber; + + +/***/ }), + +/***/ 30084: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arrayMap = __webpack_require__(29932), + copyArray = __webpack_require__(278), + isArray = __webpack_require__(1469), + isSymbol = __webpack_require__(33448), + stringToPath = __webpack_require__(55514), + toKey = __webpack_require__(40327), + toString = __webpack_require__(79833); + +/** + * Converts `value` to a property path array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Util + * @param {*} value The value to convert. + * @returns {Array} Returns the new property path array. + * @example + * + * _.toPath('a.b.c'); + * // => ['a', 'b', 'c'] + * + * _.toPath('a[0].b.c'); + * // => ['a', '0', 'b', 'c'] + */ +function toPath(value) { + if (isArray(value)) { + return arrayMap(value, toKey); + } + return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); +} + +module.exports = toPath; + + +/***/ }), + +/***/ 79833: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseToString = __webpack_require__(80531); + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +module.exports = toString; + + +/***/ }), + +/***/ 12366: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "diagram": () => (/* binding */ diagram) +/* harmony export */ }); +/* harmony import */ var _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(99794); +/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59373); +/* harmony import */ var cytoscape__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59058); +/* harmony import */ var cytoscape__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cytoscape__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14607); +/* harmony import */ var cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(91619); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(12281); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(7201); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(30381); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(17967); +/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(20683); +/* harmony import */ var dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(70277); +/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(45625); +/* harmony import */ var dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(39354); +/* harmony import */ var dagre_d3_es__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(91518); + + + + + + + + + + + + + + + + + + + + + +var parser = function() { + var o = function(k, v, o2, l) { + for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) + ; + return o2; + }, $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 6, 13, 15, 16, 19, 22], $Vd = [1, 33], $Ve = [1, 34], $Vf = [1, 6, 7, 11, 13, 15, 16, 19, 22]; + var parser2 = { + trace: function trace() { + }, + yy: {}, + symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "MINDMAP": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "ICON": 15, "CLASS": 16, "nodeWithId": 17, "nodeWithoutId": 18, "NODE_DSTART": 19, "NODE_DESCR": 20, "NODE_DEND": 21, "NODE_ID": 22, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" }, + productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 6: + case 7: + return yy; + case 8: + yy.getLogger().trace("Stop NL "); + break; + case 9: + yy.getLogger().trace("Stop EOF "); + break; + case 11: + yy.getLogger().trace("Stop NL2 "); + break; + case 12: + yy.getLogger().trace("Stop EOF2 "); + break; + case 15: + yy.getLogger().info("Node: ", $$[$0].id); + yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 16: + yy.getLogger().trace("Icon: ", $$[$0]); + yy.decorateNode({ icon: $$[$0] }); + break; + case 17: + case 21: + yy.decorateNode({ class: $$[$0] }); + break; + case 18: + yy.getLogger().trace("SPACELIST"); + break; + case 19: + yy.getLogger().trace("Node: ", $$[$0].id); + yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 20: + yy.decorateNode({ icon: $$[$0] }); + break; + case 25: + yy.getLogger().trace("node found ..", $$[$0 - 2]); + this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + case 26: + this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT }; + break; + case 27: + yy.getLogger().trace("node found ..", $$[$0 - 3]); + this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + } + }, + table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($V7, [2, 3]), { 1: [2, 2] }, o($V7, [2, 4]), o($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o($Vb, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: $V5, 22: $V6 }), o($Vb, [2, 18]), o($Vb, [2, 19]), o($Vb, [2, 20]), o($Vb, [2, 21]), o($Vb, [2, 23]), o($Vb, [2, 24]), o($Vb, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: $V8, 7: $V9, 10: 32, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($Vc, [2, 14], { 7: $Vd, 11: $Ve }), o($Vf, [2, 8]), o($Vf, [2, 9]), o($Vf, [2, 10]), o($Vb, [2, 15]), o($Vb, [2, 16]), o($Vb, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, o($Vc, [2, 13], { 7: $Vd, 11: $Ve }), o($Vf, [2, 11]), o($Vf, [2, 12]), { 21: [1, 37] }, o($Vb, [2, 25]), o($Vb, [2, 27])], + defaultActions: { 2: [2, 1], 6: [2, 2] }, + parseError: function parseError2(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } + }, + parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function lex() { + var token; + token = tstack.pop() || lexer2.lex() || EOF; + if (typeof token !== "number") { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, state, action, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + var lexer = function() { + var lexer2 = { + EOF: 1, + parseError: function parseError2(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput: function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + input: function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + unput: function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + more: function() { + this._more = true; + return this; + }, + reject: function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + less: function(n) { + this.unput(this.match.slice(n)); + }, + pastInput: function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput: function() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + showPosition: function() { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + test_match: function(match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + for (var k in backup) { + this[k] = backup[k]; + } + return false; + } + return false; + }, + next: function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + pushState: function pushState(condition) { + this.begin(condition); + }, + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { "case-insensitive": true }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + switch ($avoiding_name_collisions) { + case 0: + yy.getLogger().trace("Found comment", yy_.yytext); + break; + case 1: + return 8; + case 2: + this.begin("CLASS"); + break; + case 3: + this.popState(); + return 16; + case 4: + this.popState(); + break; + case 5: + yy.getLogger().trace("Begin icon"); + this.begin("ICON"); + break; + case 6: + yy.getLogger().trace("SPACELINE"); + return 6; + case 7: + return 7; + case 8: + return 15; + case 9: + yy.getLogger().trace("end icon"); + this.popState(); + break; + case 10: + yy.getLogger().trace("Exploding node"); + this.begin("NODE"); + return 19; + case 11: + yy.getLogger().trace("Cloud"); + this.begin("NODE"); + return 19; + case 12: + yy.getLogger().trace("Explosion Bang"); + this.begin("NODE"); + return 19; + case 13: + yy.getLogger().trace("Cloud Bang"); + this.begin("NODE"); + return 19; + case 14: + this.begin("NODE"); + return 19; + case 15: + this.begin("NODE"); + return 19; + case 16: + this.begin("NODE"); + return 19; + case 17: + this.begin("NODE"); + return 19; + case 18: + return 13; + case 19: + return 22; + case 20: + return 11; + case 21: + yy.getLogger().trace("Starting NSTR"); + this.begin("NSTR"); + break; + case 22: + yy.getLogger().trace("description:", yy_.yytext); + return "NODE_DESCR"; + case 23: + this.popState(); + break; + case 24: + this.popState(); + yy.getLogger().trace("node end ))"); + return "NODE_DEND"; + case 25: + this.popState(); + yy.getLogger().trace("node end )"); + return "NODE_DEND"; + case 26: + this.popState(); + yy.getLogger().trace("node end ...", yy_.yytext); + return "NODE_DEND"; + case 27: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + case 28: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + case 29: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + case 30: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + case 31: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + case 32: + yy.getLogger().trace("Long description:", yy_.yytext); + return 20; + case 33: + yy.getLogger().trace("Long description:", yy_.yytext); + return 20; + } + }, + rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\-\)\{\}]+)/i, /^(?:$)/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i], + conditions: { "CLASS": { "rules": [3, 4], "inclusive": false }, "ICON": { "rules": [8, 9], "inclusive": false }, "NSTR": { "rules": [22, 23], "inclusive": false }, "NODE": { "rules": [21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "inclusive": true } } + }; + return lexer2; + }(); + parser2.lexer = lexer; + function Parser() { + this.yy = {}; + } + Parser.prototype = parser2; + parser2.Parser = Parser; + return new Parser(); +}(); +parser.parser = parser; +const mindmapParser = parser; +const sanitizeText = (text) => (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.n)(text, (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.g)()); +let nodes = []; +let cnt = 0; +let elements = {}; +const clear = () => { + nodes = []; + cnt = 0; + elements = {}; +}; +const getParent = function(level) { + for (let i = nodes.length - 1; i >= 0; i--) { + if (nodes[i].level < level) { + return nodes[i]; + } + } + return null; +}; +const getMindmap = () => { + return nodes.length > 0 ? nodes[0] : null; +}; +const addNode = (level, id, descr, type) => { + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.l.info("addNode", level, id, descr, type); + const conf = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.g)(); + const node = { + id: cnt++, + nodeId: sanitizeText(id), + level, + descr: sanitizeText(descr), + type, + children: [], + width: (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.g)().mindmap.maxNodeWidth + }; + switch (node.type) { + case nodeType.ROUNDED_RECT: + node.padding = 2 * conf.mindmap.padding; + break; + case nodeType.RECT: + node.padding = 2 * conf.mindmap.padding; + break; + case nodeType.HEXAGON: + node.padding = 2 * conf.mindmap.padding; + break; + default: + node.padding = conf.mindmap.padding; + } + const parent = getParent(level); + if (parent) { + parent.children.push(node); + nodes.push(node); + } else { + if (nodes.length === 0) { + nodes.push(node); + } else { + let error = new Error( + 'There can be only one root. No parent could be found for ("' + node.descr + '")' + ); + error.hash = { + text: "branch " + name, + token: "branch " + name, + line: "1", + loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 }, + expected: ['"checkout ' + name + '"'] + }; + throw error; + } + } +}; +const nodeType = { + DEFAULT: 0, + NO_BORDER: 0, + ROUNDED_RECT: 1, + RECT: 2, + CIRCLE: 3, + CLOUD: 4, + BANG: 5, + HEXAGON: 6 +}; +const getType = (startStr, endStr) => { + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.l.debug("In get type", startStr, endStr); + switch (startStr) { + case "[": + return nodeType.RECT; + case "(": + return endStr === ")" ? nodeType.ROUNDED_RECT : nodeType.CLOUD; + case "((": + return nodeType.CIRCLE; + case ")": + return nodeType.CLOUD; + case "))": + return nodeType.BANG; + case "{{": + return nodeType.HEXAGON; + default: + return nodeType.DEFAULT; + } +}; +const setElementForId = (id, element) => { + elements[id] = element; +}; +const decorateNode = (decoration) => { + const node = nodes[nodes.length - 1]; + if (decoration && decoration.icon) { + node.icon = sanitizeText(decoration.icon); + } + if (decoration && decoration.class) { + node.class = sanitizeText(decoration.class); + } +}; +const type2Str = (type) => { + switch (type) { + case nodeType.DEFAULT: + return "no-border"; + case nodeType.RECT: + return "rect"; + case nodeType.ROUNDED_RECT: + return "rounded-rect"; + case nodeType.CIRCLE: + return "circle"; + case nodeType.CLOUD: + return "cloud"; + case nodeType.BANG: + return "bang"; + case nodeType.HEXAGON: + return "hexgon"; + default: + return "no-border"; + } +}; +let parseError; +const setErrorHandler = (handler) => { + parseError = handler; +}; +const getLogger = () => _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.l; +const getNodeById = (id) => nodes[id]; +const getElementById = (id) => elements[id]; +const mindmapDb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + sanitizeText, + clear, + getMindmap, + addNode, + nodeType, + getType, + setElementForId, + decorateNode, + type2Str, + get parseError() { + return parseError; + }, + setErrorHandler, + getLogger, + getNodeById, + getElementById +}, Symbol.toStringTag, { value: "Module" })); +const MAX_SECTIONS = 12; +function wrap(text, width) { + text.each(function() { + var text2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(this), words = text2.text().split(/(\s+|
)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em"); + for (let j = 0; j < words.length; j++) { + word = words[words.length - 1 - j]; + line.push(word); + tspan.text(line.join(" ").trim()); + if (tspan.node().getComputedTextLength() > width || word === "
") { + line.pop(); + tspan.text(line.join(" ").trim()); + if (word === "
") { + line = [""]; + } else { + line = [word]; + } + tspan = text2.append("tspan").attr("x", 0).attr("y", y).attr("dy", lineHeight + "em").text(word); + } + } + }); +} +const defaultBkg = function(elem, node, section) { + const rd = 5; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr( + "d", + `M0 ${node.height - rd} v${-node.height + 2 * rd} q0,-5 5,-5 h${node.width - 2 * rd} q5,0 5,5 v${node.height - rd} H0 Z` + ); + elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node.height).attr("x2", node.width).attr("y2", node.height); +}; +const rectBkg = function(elem, node) { + elem.append("rect").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr("height", node.height).attr("width", node.width); +}; +const cloudBkg = function(elem, node) { + const w = node.width; + const h = node.height; + const r1 = 0.15 * w; + const r2 = 0.25 * w; + const r3 = 0.35 * w; + const r4 = 0.2 * w; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr( + "d", + `M0 0 a${r1},${r1} 0 0,1 ${w * 0.25},${-1 * w * 0.1} + a${r3},${r3} 1 0,1 ${w * 0.4},${-1 * w * 0.1} + a${r2},${r2} 1 0,1 ${w * 0.35},${1 * w * 0.2} + + a${r1},${r1} 1 0,1 ${w * 0.15},${1 * h * 0.35} + a${r4},${r4} 1 0,1 ${-1 * w * 0.15},${1 * h * 0.65} + + a${r2},${r1} 1 0,1 ${-1 * w * 0.25},${w * 0.15} + a${r3},${r3} 1 0,1 ${-1 * w * 0.5},${0} + a${r1},${r1} 1 0,1 ${-1 * w * 0.25},${-1 * w * 0.15} + + a${r1},${r1} 1 0,1 ${-1 * w * 0.1},${-1 * h * 0.35} + a${r4},${r4} 1 0,1 ${w * 0.1},${-1 * h * 0.65} + + H0 V0 Z` + ); +}; +const bangBkg = function(elem, node) { + const w = node.width; + const h = node.height; + const r = 0.15 * w; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr( + "d", + `M0 0 a${r},${r} 1 0,0 ${w * 0.25},${-1 * h * 0.1} + a${r},${r} 1 0,0 ${w * 0.25},${0} + a${r},${r} 1 0,0 ${w * 0.25},${0} + a${r},${r} 1 0,0 ${w * 0.25},${1 * h * 0.1} + + a${r},${r} 1 0,0 ${w * 0.15},${1 * h * 0.33} + a${r * 0.8},${r * 0.8} 1 0,0 ${0},${1 * h * 0.34} + a${r},${r} 1 0,0 ${-1 * w * 0.15},${1 * h * 0.33} + + a${r},${r} 1 0,0 ${-1 * w * 0.25},${h * 0.15} + a${r},${r} 1 0,0 ${-1 * w * 0.25},${0} + a${r},${r} 1 0,0 ${-1 * w * 0.25},${0} + a${r},${r} 1 0,0 ${-1 * w * 0.25},${-1 * h * 0.15} + + a${r},${r} 1 0,0 ${-1 * w * 0.1},${-1 * h * 0.33} + a${r * 0.8},${r * 0.8} 1 0,0 ${0},${-1 * h * 0.34} + a${r},${r} 1 0,0 ${w * 0.1},${-1 * h * 0.33} + + H0 V0 Z` + ); +}; +const circleBkg = function(elem, node) { + elem.append("circle").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr("r", node.width / 2); +}; +function insertPolygonShape(parent, w, h, points, node) { + return parent.insert("polygon", ":first-child").attr( + "points", + points.map(function(d) { + return d.x + "," + d.y; + }).join(" ") + ).attr("transform", "translate(" + (node.width - w) / 2 + ", " + h + ")"); +} +const hexagonBkg = function(elem, node) { + const h = node.height; + const f = 4; + const m = h / f; + const w = node.width - node.padding + 2 * m; + const points = [ + { x: m, y: 0 }, + { x: w - m, y: 0 }, + { x: w, y: -h / 2 }, + { x: w - m, y: -h }, + { x: m, y: -h }, + { x: 0, y: -h / 2 } + ]; + insertPolygonShape(elem, w, h, points, node); +}; +const roundedRectBkg = function(elem, node) { + elem.append("rect").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr("height", node.height).attr("rx", node.padding).attr("ry", node.padding).attr("width", node.width); +}; +const drawNode = function(elem, node, fullSection, conf) { + const section = fullSection % (MAX_SECTIONS - 1); + const nodeElem = elem.append("g"); + node.section = section; + let sectionClass = "section-" + section; + if (section < 0) { + sectionClass += " section-root"; + } + nodeElem.attr("class", (node.class ? node.class + " " : "") + "mindmap-node " + sectionClass); + const bkgElem = nodeElem.append("g"); + const textElem = nodeElem.append("g"); + const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width); + const bbox = txt.node().getBBox(); + const fontSize = conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize; + node.height = bbox.height + fontSize * 1.1 * 0.5 + node.padding; + node.width = bbox.width + 2 * node.padding; + if (node.icon) { + if (node.type === nodeType.CIRCLE) { + node.height += 50; + node.width += 50; + const icon = nodeElem.append("foreignObject").attr("height", "50px").attr("width", node.width).attr("style", "text-align: center;"); + icon.append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + section + " " + node.icon); + textElem.attr( + "transform", + "translate(" + node.width / 2 + ", " + (node.height / 2 - 1.5 * node.padding) + ")" + ); + } else { + node.width += 50; + const orgHeight = node.height; + node.height = Math.max(orgHeight, 60); + const heightDiff = Math.abs(node.height - orgHeight); + const icon = nodeElem.append("foreignObject").attr("width", "60px").attr("height", node.height).attr("style", "text-align: center;margin-top:" + heightDiff / 2 + "px;"); + icon.append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + section + " " + node.icon); + textElem.attr( + "transform", + "translate(" + (25 + node.width / 2) + ", " + (heightDiff / 2 + node.padding / 2) + ")" + ); + } + } else { + textElem.attr("transform", "translate(" + node.width / 2 + ", " + node.padding / 2 + ")"); + } + switch (node.type) { + case nodeType.DEFAULT: + defaultBkg(bkgElem, node, section); + break; + case nodeType.ROUNDED_RECT: + roundedRectBkg(bkgElem, node); + break; + case nodeType.RECT: + rectBkg(bkgElem, node); + break; + case nodeType.CIRCLE: + bkgElem.attr("transform", "translate(" + node.width / 2 + ", " + +node.height / 2 + ")"); + circleBkg(bkgElem, node); + break; + case nodeType.CLOUD: + cloudBkg(bkgElem, node); + break; + case nodeType.BANG: + bangBkg(bkgElem, node); + break; + case nodeType.HEXAGON: + hexagonBkg(bkgElem, node); + break; + } + setElementForId(node.id, nodeElem); + return node.height; +}; +const drawEdge = function drawEdge2(edgesElem, mindmap, parent, depth, fullSection) { + const section = fullSection % (MAX_SECTIONS - 1); + const sx = parent.x + parent.width / 2; + const sy = parent.y + parent.height / 2; + const ex = mindmap.x + mindmap.width / 2; + const ey = mindmap.y + mindmap.height / 2; + const mx = ex > sx ? sx + Math.abs(sx - ex) / 2 : sx - Math.abs(sx - ex) / 2; + const my = ey > sy ? sy + Math.abs(sy - ey) / 2 : sy - Math.abs(sy - ey) / 2; + const qx = ex > sx ? Math.abs(sx - mx) / 2 + sx : -Math.abs(sx - mx) / 2 + sx; + const qy = ey > sy ? Math.abs(sy - my) / 2 + sy : -Math.abs(sy - my) / 2 + sy; + edgesElem.append("path").attr( + "d", + parent.direction === "TB" || parent.direction === "BT" ? `M${sx},${sy} Q${sx},${qy} ${mx},${my} T${ex},${ey}` : `M${sx},${sy} Q${qx},${sy} ${mx},${my} T${ex},${ey}` + ).attr("class", "edge section-edge-" + section + " edge-depth-" + depth); +}; +const positionNode = function(node) { + const nodeElem = getElementById(node.id); + const x = node.x || 0; + const y = node.y || 0; + nodeElem.attr("transform", "translate(" + x + "," + y + ")"); +}; +const svgDraw = { drawNode, positionNode, drawEdge }; +cytoscape__WEBPACK_IMPORTED_MODULE_1___default().use((cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2___default())); +function drawNodes(svg, mindmap, section, conf) { + svgDraw.drawNode(svg, mindmap, section, conf); + if (mindmap.children) { + mindmap.children.forEach((child, index) => { + drawNodes(svg, child, section < 0 ? index : section, conf); + }); + } +} +function drawEdges(edgesEl, cy) { + cy.edges().map((edge, id) => { + const data = edge.data(); + if (edge[0]._private.bodyBounds) { + const bounds = edge[0]._private.rscratch; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.l.trace("Edge: ", id, data); + edgesEl.insert("path").attr( + "d", + `M ${bounds.startX},${bounds.startY} L ${bounds.midX},${bounds.midY} L${bounds.endX},${bounds.endY} ` + ).attr("class", "edge section-edge-" + data.section + " edge-depth-" + data.depth); + } + }); +} +function addNodes(mindmap, cy, conf, level) { + cy.add({ + group: "nodes", + data: { + id: mindmap.id, + labelText: mindmap.descr, + height: mindmap.height, + width: mindmap.width, + level, + nodeId: mindmap.id, + padding: mindmap.padding, + type: mindmap.type + }, + position: { + x: mindmap.x, + y: mindmap.y + } + }); + if (mindmap.children) { + mindmap.children.forEach((child) => { + addNodes(child, cy, conf, level + 1); + cy.add({ + group: "edges", + data: { + id: `${mindmap.id}_${child.id}`, + source: mindmap.id, + target: child.id, + depth: level, + section: child.section + } + }); + }); + } +} +function layoutMindmap(node, conf) { + return new Promise((resolve) => { + const renderEl = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body").append("div").attr("id", "cy").attr("style", "display:none"); + const cy = cytoscape__WEBPACK_IMPORTED_MODULE_1___default()({ + container: document.getElementById("cy"), + style: [ + { + selector: "edge", + style: { + "curve-style": "bezier" + } + } + ] + }); + renderEl.remove(); + addNodes(node, cy, conf, 0); + cy.nodes().forEach(function(n) { + n.layoutDimensions = () => { + const data = n.data(); + return { w: data.width, h: data.height }; + }; + }); + cy.layout({ + name: "cose-bilkent", + quality: "proof", + styleEnabled: false, + animate: false + }).run(); + cy.ready((e) => { + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.l.info("Ready", e); + resolve(cy); + }); + }); +} +function positionNodes(cy) { + cy.nodes().map((node, id) => { + const data = node.data(); + data.x = node.position().x; + data.y = node.position().y; + svgDraw.positionNode(data); + const el = getElementById(data.nodeId); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.l.info("Id:", id, "Position: (", node.position().x, ", ", node.position().y, ")", data); + el.attr( + "transform", + `translate(${node.position().x - data.width / 2}, ${node.position().y - data.height / 2})` + ); + el.attr("attr", `apa-${id})`); + }); +} +const draw = async (text, id, version, diagObj) => { + const conf = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.g)(); + diagObj.db.clear(); + diagObj.parser.parse(text); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.l.debug("Renering info diagram\n" + text); + const securityLevel = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.g)().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("#i" + id); + } + const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body"); + const svg = root.select("#" + id); + svg.append("g"); + const mm = diagObj.db.getMindmap(); + const edgesElem = svg.append("g"); + edgesElem.attr("class", "mindmap-edges"); + const nodesElem = svg.append("g"); + nodesElem.attr("class", "mindmap-nodes"); + drawNodes(nodesElem, mm, -1, conf); + const cy = await layoutMindmap(mm, conf); + drawEdges(edgesElem, cy); + positionNodes(cy); + (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_10__.s)(void 0, svg, conf.mindmap.padding, conf.mindmap.useMaxWidth); +}; +const mindmapRenderer = { + draw +}; +const genSections = (options) => { + let sections = ""; + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i]; + if ((0,khroma__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)(options["lineColor" + i])) { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } else { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } + } + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + const sw = "" + (17 - 3 * i); + sections += ` + .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} polygon, .section-${i - 1} path { + fill: ${options["cScale" + i]}; + } + .section-${i - 1} text { + fill: ${options["cScaleLabel" + i]}; + } + .node-icon-${i - 1} { + font-size: 40px; + color: ${options["cScaleLabel" + i]}; + } + .section-edge-${i - 1}{ + stroke: ${options["cScale" + i]}; + } + .edge-depth-${i - 1}{ + stroke-width: ${sw}; + } + .section-${i - 1} line { + stroke: ${options["cScaleInv" + i]} ; + stroke-width: 3; + } + + .disabled, .disabled circle, .disabled text { + fill: lightgray; + } + .disabled text { + fill: #efefef; + } + `; + } + return sections; +}; +const getStyles = (options) => ` + .edge { + stroke-width: 3; + } + ${genSections(options)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${options.git0}; + } + .section-root text { + fill: ${options.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } +`; +const mindmapStyles = getStyles; +const diagram = { + db: mindmapDb, + renderer: mindmapRenderer, + parser: mindmapParser, + styles: mindmapStyles +}; + +//# sourceMappingURL=diagram-definition.2c0ce47b.js.map + + +/***/ }), + +/***/ 91619: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "Z": () => (/* binding */ is_dark) +}); + +// EXTERNAL MODULE: ./node_modules/khroma/dist/utils/index.js + 3 modules +var utils = __webpack_require__(61691); +// EXTERNAL MODULE: ./node_modules/khroma/dist/color/index.js + 4 modules +var dist_color = __webpack_require__(71610); +;// CONCATENATED MODULE: ./node_modules/khroma/dist/methods/luminance.js +/* IMPORT */ + + +/* MAIN */ +//SOURCE: https://planetcalc.com/7779 +const luminance = (color) => { + const { r, g, b } = dist_color/* default.parse */.Z.parse(color); + const luminance = .2126 * utils/* default.channel.toLinear */.Z.channel.toLinear(r) + .7152 * utils/* default.channel.toLinear */.Z.channel.toLinear(g) + .0722 * utils/* default.channel.toLinear */.Z.channel.toLinear(b); + return utils/* default.lang.round */.Z.lang.round(luminance); +}; +/* EXPORT */ +/* harmony default export */ const methods_luminance = (luminance); + +;// CONCATENATED MODULE: ./node_modules/khroma/dist/methods/is_light.js +/* IMPORT */ + +/* MAIN */ +const isLight = (color) => { + return methods_luminance(color) >= .5; +}; +/* EXPORT */ +/* harmony default export */ const is_light = (isLight); + +;// CONCATENATED MODULE: ./node_modules/khroma/dist/methods/is_dark.js +/* IMPORT */ + +/* MAIN */ +const isDark = (color) => { + return !is_light(color); +}; +/* EXPORT */ +/* harmony default export */ const is_dark = (isDark); + + +/***/ }) + +}; +; \ No newline at end of file diff --git a/docs/assets/js/367de8e8.2223341e.js b/docs/assets/js/367de8e8.2223341e.js new file mode 100644 index 000000000..16e30eeb8 --- /dev/null +++ b/docs/assets/js/367de8e8.2223341e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[56527],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=p(n),d=a,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",i={unversionedId:"getting-started/flipper",id:"version-0.6.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.6.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.6.0/getting-started/flipper",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.6.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.6.0/category/basics"}},s={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.6.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Variable;\n\n/// A module definition. Each module struct consists Variables and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Variable,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let mut contract1 = FlipperDeployer::initial_settings();\n let contract2 = FlipperDeployer::initial_settings();\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3701fb97.be0d6388.js b/docs/assets/js/3701fb97.be0d6388.js new file mode 100644 index 000000000..0f72f4d13 --- /dev/null +++ b/docs/assets/js/3701fb97.be0d6388.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62253],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.3.1/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.3.1/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.3.1/basics/cross-calls",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.3.1/basics/events"},next:{title:"Modules",permalink:"/docs/0.3.1/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use odra::Variable;\nuse odra::types::{Address};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Variable
,\n}\n\n#[odra::module]\nimpl CrossContract {\n #[odra(init)]\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap();\n MathEngineRef::at(math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine {\n}\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To call the external contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"MathEngineRef::at(math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/testing"},"Testing")," article.\nIt is a reference to already deployed - running contract.\nHere we are going to take a deeper look at it."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," is generated automatically, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nTo get an instance of a reference, we can either deploy a contract (using ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),") or by building it\ndirectly, using ",(0,r.kt)("inlineCode",{parentName:"p"},"::at(address: Address)")," method, as shown above.\nThe reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), alongside couple methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"at(Address) -> Self")," - points the reference to an Address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"address() -> Address")," - returns the Address the reference is currently pointing at"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"with_tokens(Amount) -> Self")," - attaches Amount of native tokens to the next call")),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderRef")," struct (but do not create the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderDeployer"),"). Having an address we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"AdderRef::at(address).add(3, 5)\n")),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use super::{CrossContractDeployer, MathEngineDeployer};\n\n#[test]\nfn test_cross_calls() {\n let math_engine_contract = MathEngineDeployer::default();\n let cross_contract = CrossContractDeployer::init(math_engine_contract.address());\n\n assert_eq!(cross_contract.add_using_another(), 8);\n}\n")),(0,r.kt)("p",null,"Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function we want to use."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use odra::types::Address;\n use crate::docs::cross_calls::{Adder, AdderRef};\n \n #[test]\n fn test_ext() {\n let adder = AdderRef::at(get_adder_address());\n\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address() -> Address {\n let contract = MathEngineDeployer::default();\n contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3721b008.43d60be0.js b/docs/assets/js/3721b008.43d60be0.js new file mode 100644 index 000000000..0901b03a4 --- /dev/null +++ b/docs/assets/js/3721b008.43d60be0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25151],{3905:(e,r,n)=>{n.d(r,{Zo:()=>u,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},u=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},p={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return n?t.createElement(f,s(s({ref:r},u),{},{components:n})):t.createElement(f,s({ref:r},u))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.5.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.5.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.5.0/basics/errors",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.5.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.5.0/basics/events"}},l={},c=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function p(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},u,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::{execution_error, Variable, UnwrapOrRevert};\nuse odra::types::Address;\n\n#[odra::module]\npub struct OwnedContract {\n name: Variable,\n owner: Variable
,\n}\n\nexecution_error! {\n pub enum Error {\n OwnerNotSet => 1,\n NotAnOwner => 2,\n }\n}\n\n\n#[odra::module]\nimpl OwnedContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = odra::contract_env::caller();\n if caller != self.owner() {\n odra::contract_env::revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,a.kt)("p",null,"Firstly, we are using ",(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You and the users of your contract will be thankful for a meaningful error message!"),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"odra::contract_env::revert(Error::NotAnOwner)\n")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? We've already mentioned a function - ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_exception"),". This is how you will\nuse it:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'use super::{OwnedContractDeployer, OwnedContractRef};\nuse super::Error;\n\n#[test]\nfn test_owner_error() {\n let owner = odra::test_env::get_account(0);\n let not_an_owner = odra::test_env::get_account(1);\n\n odra::test_env::set_caller(owner);\n let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());\n\n odra::test_env::set_caller(not_an_owner);\n odra::test_env::assert_exception(Error::NotAnOwner, || {\n owned_contract.change_name("NewName".to_string());\n })\n}\n')),(0,a.kt)("p",null,"In the example above, because we are calling the ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),' method as an address which is not an "owner",\nwe are expecting that "NotAnOwner" error will be thrown.'),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"Here we are creating another reference to the already deployed contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractRef::at()")," and passing to it\nits Address. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractDeployer::init()")," returns the same type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/372918e4.75d6668d.js b/docs/assets/js/372918e4.75d6668d.js new file mode 100644 index 000000000..14186e8dd --- /dev/null +++ b/docs/assets/js/372918e4.75d6668d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59132],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),h=c(n),u=o,m=h["".concat(s,".").concat(u)]||h[u]||p[u]||r;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:3},i="Livenet",l={unversionedId:"backends/livenet",id:"version-0.9.0/backends/livenet",title:"Livenet",description:"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local",source:"@site/versioned_docs/version-0.9.0/backends/04-livenet.md",sourceDirName:"backends",slug:"/backends/livenet",permalink:"/docs/0.9.0/backends/livenet",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Casper",permalink:"/docs/0.9.0/backends/casper"},next:{title:"Examples",permalink:"/docs/0.9.0/category/examples"}},s={},c=[{value:"Setup",id:"setup",level:2},{value:"Usage",id:"usage",level:2},{value:"How Livenet backend works",id:"how-livenet-backend-works",level:2},{value:"Multiple environments",id:"multiple-environments",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"livenet"},"Livenet"),(0,o.kt)("p",null,"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local\ntest node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend\nto handle the deployment of your contracts to the real blockchain."),(0,o.kt)("p",null,"Furthermore, it is implemented in a similarly to Casper or OdraVM,\nhowever, it uses a real blockchain to deploy contracts and store the state.\nThis lets us use Odra to deploy and test contracts on a real blockchain, but\non the other hand, it comes with some limitations on what can be done in the tests."),(0,o.kt)("p",null,"The main differences between Livenet and e.g. CasperVM backend are:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Real CSPR tokens are used to deploy and call contracts. This also means that we need to\npay for each contract deployment and each contract call. Of course, we can use the ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/tools/faucet"},"faucet"),"\nto get some tokens for testing purposes, but we still need to specify the amount needed\nfor each action."),(0,o.kt)("li",{parentName:"ul"},"The contract state is stored on the real blockchain, so we can't just reset the state -\nwe can redeploy the contract, but we can't remove the old one."),(0,o.kt)("li",{parentName:"ul"},"Because of the above, we can load the existing contracts and use them in the tests."),(0,o.kt)("li",{parentName:"ul"},"We have no control over the block time. This means that for example, ",(0,o.kt)("inlineCode",{parentName:"li"},"advance_block_time")," function\nis implemented by waiting for the real time to pass.")),(0,o.kt)("p",null,"This is also a cause for the fact that the Livenet backend cannot be (yet) used for running\nthe regular Odra tests. Instead, we can create integration tests or binaries which will\nuse a slightly different workflow to test the contracts."),(0,o.kt)("h2",{id:"setup"},"Setup"),(0,o.kt)("p",null,"To use Livenet backend, we need to provide Odra with some information - the network address, our private\nkey and the name of the chain we want to use. Optionally, we can add multiple private keys to use\nmore than one account in our tests. Those values are passed using environment variables. We can use .env\nfile to store them - let's take a look at an example .env file, created from the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/examples/.env.sample"},".env.sample")," file from\nexamples folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env"},"# Path to the secret key of the account that will be used\n# to deploy the contracts.\n# We're using .keys folder so we don't accidentally commit\n# the secret key to the repository.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777\n\n# Chain name of the network. Known values:\n# - integration-test\nODRA_CASPER_LIVENET_CHAIN_NAME=integration-test\n\n# Paths to the secret keys of the additional accounts.\n# Main secret key will be 0th account.\nODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem\nODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem\n")),(0,o.kt)("p",null,"With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find\na simple binary that deploys a contract and calls it. The test is located in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/examples/bin/erc20_on_livenet.rs"},"erc20_on_livenet.rs")," file.\nLet's go through the code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // Similar to the OdraVM backend, we need to initialize\n // the environment:\n let env = odra_casper_livenet_env::env();\n\n // Most of the for the host env works the same as in the\n // OdraVM backend.\n let owner = env.caller();\n // Addresses are the real addresses on the blockchain,\n // so we need to provide them\n // if we did not import their secret keys.\n let recipient = \n "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Arguments for the contract init method.\n let name = String::from("Plascoin");\n let symbol = String::from("PLS");\n let decimals = 10u8;\n let initial_supply: U256 = U256::from(10_000);\n \n // The main difference between other backends - we need to specify\n // the gas limit for each action.\n // The limit will be used for every consecutive action\n // until we change it.\n env.set_gas(100_000_000_000u64);\n \n // Deploy the contract. The API is the same as in the OdraVM backend.\n let init_args = Erc20InitArgs {\n name,\n symbol,\n decimals,\n initial_supply: Some(initial_supply)\n };\n let mut token = Erc20HostRef::deploy(env, init_args);\n \n // We can now use the contract as we would in the OdraVM backend.\n println!("Token address: {}", token.address().to_string());\n\n // Uncomment to load existing contract.\n // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n // let address = Address::from_str(address).unwrap();\n // We use the Livenet-specific `load` method to load the contract\n // that is already deployed.\n // let mut token = Erc20Deployer::load(env, address);\n\n // Non-mutable calls are free! Neat, huh? More on that later.\n println!("Token name: {}", token.name());\n\n // The next call is mutable, but the cost is lower that the deployment,\n // so we change the amount of gas\n env.set_gas(3_000_000_000u64);\n token.transfer(recipient, U256::from(1000));\n\n println!("Owner\'s balance: {:?}", token.balance_of(owner));\n println!("Recipient\'s balance: {:?}", token.balance_of(recipient));\n}\n')),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The above example is a rust binary, not a test. Note that it is also added as a section of the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[bin]\nname = "erc20_on_livenet"\npath = "src/bin/erc20_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n'))),(0,o.kt)("h2",{id:"usage"},"Usage"),(0,o.kt)("p",null,"To run the above code, we simply need to run the binary with the ",(0,o.kt)("inlineCode",{parentName:"p"},"livenet")," feature enabled:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Before executing the binary, make sure you built a wasm file.")),(0,o.kt)("p",null,"A part of a sample output should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'...\n\ud83d\udc81 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\udc81 INFO : Deploy "65b1a5d21..." successfully executed.\nOwner\'s balance: 4004\nRecipient\'s balance: 4000\n')),(0,o.kt)("p",null,"Those logs are a result of the last 4 lines of the above listing.\nEach deployment or a call to the blockchain will be noted and will take some time to execute.\nWe can see that the ",(0,o.kt)("inlineCode",{parentName:"p"},"transfer")," call took over 15 seconds to execute. But calling ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," was nearly instant\nand cost us nothing. How it is possible?"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You can see the deployment on ",(0,o.kt)("a",{parentName:"p",href:"http://cspr.live/"},"http://cspr.live/")," - the transfer from the example\ncan be seen ",(0,o.kt)("a",{parentName:"p",href:"https://integration.cspr.live/deploy/65b1a5d21174a62c675f89683aba995c453b942c705b404a1f8bbf6f0f6de32a"},"here"),".")),(0,o.kt)("h2",{id:"how-livenet-backend-works"},"How Livenet backend works"),(0,o.kt)("p",null,"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state.\nIt is possible however to query the state of the blockchain for free."),(0,o.kt)("p",null,"This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the\nnode is the current state. This is why the ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," call was almost instant and free."),(0,o.kt)("p",null,"Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract\n(see ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/cross-calls"},"Cross Calls"),"), it is executed offline and\nnode is used for the state query only. However, the Livenet needs to know the connection between the contracts\nand the code, so make sure to deploy or load already deployed contracts"),(0,o.kt)("h2",{id:"multiple-environments"},"Multiple environments"),(0,o.kt)("p",null,"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts,\nmultiple nodes or even multiple chains."),(0,o.kt)("p",null,"To do this, simply create a new ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with a different prefix - for example, ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet.env"),".\nThen, pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"ODRA_CASPER_LIVENET_ENV")," variable with value either ",(0,o.kt)("inlineCode",{parentName:"p"},"integration")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet")," to select which file\nhas to be used first. If your ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file has a value that IS present in the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file, it will\noverride the value from the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene\n")),(0,o.kt)("p",null,"To sum up - this command will firstly load the ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file and then load the missing values from ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/377695c3.014b13fe.js b/docs/assets/js/377695c3.014b13fe.js new file mode 100644 index 000000000..cf7217e83 --- /dev/null +++ b/docs/assets/js/377695c3.014b13fe.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[60915],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=d(n),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return n?a.createElement(w,o(o({ref:t},u),{},{components:n})):a.createElement(w,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.9.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.9.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.9.0/tutorials/ownable",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.9.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.9.0/tutorials/erc20"}},s={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining a constructor,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(events = [OwnershipChanged])]\npub struct Ownable {\n owner: Var>\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basics before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4")," - Firstly, we need to create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module(events = [OwnershipChanged])]")," attribute to it. The ",(0,r.kt)("inlineCode",{parentName:"li"},"events")," attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," is a type that will be defined later."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n pub fn init(&mut self, owner: Address) {\n if self.owner.get_or_default().is_some() {\n self.env().revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(Some(owner));\n \n self.env().emit_event(OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n });\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerIsAlreadyInitialized = 1,\n}\n\n#[odra::event]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an Odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is a constructor. This matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-L20")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]")," attribute is applied to the enum. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4-L6")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::revert()")," function with an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsAlreadyInitialized")," argument. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Then we write the owner passed as an argument to the storage. To do so, we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22-L26")," - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::event]")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L10")," - Finally, call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::emit_event()")," passing the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," instance to the function. Hence, we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),". ")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get_or_default().as_ref() {\n self.env().revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&self.env().caller());\n let current_owner = self.get_owner();\n self.owner.set(Some(*new_owner));\n self.env().emit_event(OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n });\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get_or_default() {\n Some(owner) => owner,\n None => self.env().revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n NotOwner = 1,\n OwnerIsAlreadyInitialized = 2,\n OwnerIsNotInitialized = 3,\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7,L31")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," reads the current owner and reverts if it does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also, we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum by adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in the ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::caller()")," function. Then we update the state and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L21,L33")," - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),". There is one worth-mentioning subtlety: ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," function returns ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements the ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call the ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function, and the contract does not fail even if the value is not initialized. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"owner")," is of type ",(0,r.kt)("inlineCode",{parentName:"li"},"Option
")," the ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," would return ",(0,r.kt)("inlineCode",{parentName:"li"},"Option>"),", we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get_or_default()")," instead.")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::{Deployer, HostEnv, HostRef};\n\n fn setup() -> (OwnableHostRef, HostEnv, Address) {\n let env: HostEnv = odra_test::env();\n let init_args = OwnableInitArgs {\n owner: env.get_account(0)\n };\n (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))\n }\n\n #[test]\n fn initialization_works() {\n let (ownable, env, owner) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (mut ownable, env, owner) = setup();\n let new_owner = env.get_account(1);\n \n env.set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n\n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (mut ownable, env, _) = setup();\n let new_owner = env.get_account(1);\n ownable.change_ownership(&new_owner);\n \n assert_eq!(\n ownable.try_change_ownership(&new_owner), \n Err(Error::NotOwner.into())\n );\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we have defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, which we call in the first statement of each test. Take a look at the signature: ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (OwnableHostRef, HostEnv, Address)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef")," is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7-L11")," - The starting point of every test is getting an instance of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," by calling ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),". Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," attribute implements a ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer")," for ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableInitArgs")," that we pass as the second argument of the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function. Lastly, the module needs an owner. The easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". We choose the address of first account (which is the default one). "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - It is time to define the first test. As you see, it is a regular Rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16-17")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L19-25")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event to have been emitted. To assert that, let's use ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". To get the env, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"env()")," on the contract, then call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::emitted_event"),". As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L31")," - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L33")," - As mentioned, the default is the 0th account, if you want to change the executor, call the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L46-55")," - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::try_change_ownership()")," instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::change_ownership()"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," provides try_ functions for each contract's entrypoint. The ",(0,r.kt)("inlineCode",{parentName:"li"},"try")," functions return ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraResult")," (an alias for ",(0,r.kt)("inlineCode",{parentName:"li"},"Result"),") instead of panicking and halting the execution. In our case, we expect the contract to revert with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::NotOwner")," error. To compare the error, we use the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::into()")," function, which converts the error into the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," type.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/383c9ad7.444afe3d.js b/docs/assets/js/383c9ad7.444afe3d.js new file mode 100644 index 000000000..1be38d998 --- /dev/null +++ b/docs/assets/js/383c9ad7.444afe3d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46491],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||l;return t?a.createElement(f,o(o({ref:n},c),{},{components:t})):a.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,o=new Array(l);o[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const l={},o="Delegate",i={unversionedId:"advanced/delegate",id:"advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/docs/advanced/01-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/next/advanced/delegate",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/next/category/advanced"},next:{title:"Advanced Storage Concepts",permalink:"/docs/next/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::{\n Address, casper_types::U256,\n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n fn approve(&mut self, spender: Address, amount: U256);\n fn name(&self) -> String;\n fn symbol(&self) -> String;\n fn decimals(&self) -> u8;\n fn total_supply(&self) -> U256;\n fn balance_of(&self, owner: Address) -> U256;\n fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\nuse odra::{\n Address, casper_types::U256, \n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: SubModule,\n erc20: SubModule,\n exchange: SubModule\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n fn swap(&mut self, sender: Address, recipient: Address);\n fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3849c38e.c5398bdb.js b/docs/assets/js/3849c38e.c5398bdb.js new file mode 100644 index 000000000..84d9647d8 --- /dev/null +++ b/docs/assets/js/3849c38e.c5398bdb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[58050],{3905:(e,r,n)=>{n.d(r,{Zo:()=>u,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},u=function(e){var r=p(e.components);return t.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||o;return n?t.createElement(f,s(s({ref:r},u),{},{components:n})):t.createElement(f,s({ref:r},u))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var p=2;p{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.8.1/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.8.1/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.8.1/basics/errors",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.8.1/basics/testing"},next:{title:"Events",permalink:"/docs/0.8.1/basics/events"}},l={},p=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},u,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::prelude::*;\nuse odra::{Address, OdraError, Var};\n\n#[odra::module]\npub struct OwnedContract {\n name: Var,\n owner: Var
\n}\n\n#[derive(OdraError)]\npub enum Error {\n OwnerNotSet = 1,\n NotAnOwner = 2\n}\n\n#[odra::module]\nimpl OwnedContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = self.env().caller();\n if caller != self.owner() {\n self.env().revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n\n")),(0,a.kt)("p",null,"Firstly, we are using the ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive attribute to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.env().revert(Error::NotAnOwner)\n")),(0,a.kt)("p",null,"Defining an error in Odra, you must keep in mind a few rules:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"An error should be a field-less enum. "),(0,a.kt)("li",{parentName:"ol"},"The enum must derive from ",(0,a.kt)("inlineCode",{parentName:"li"},"OdraError"),"."),(0,a.kt)("li",{parentName:"ol"},"Avoid implicit discriminants.")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'#[cfg(test)]\nmod tests {\n use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};\n use odra::host::Deployer;\n use odra::prelude::*;\n\n #[test]\n fn test_owner_error() {\n let test_env = odra_test::env();\n let owner = test_env.get_account(0);\n let not_an_owner = test_env.get_account(1);\n\n test_env.set_caller(owner);\n let init_args = OwnedContractInitArgs {\n name: "OwnedContract".to_string()\n };\n let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);\n\n test_env.set_caller(not_an_owner);\n assert_eq!(\n owned_contract.try_change_name("NewName".to_string()),\n Err(Error::NotAnOwner.into())\n );\n }\n}\n')),(0,a.kt)("p",null,"Each ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," has ",(0,a.kt)("inlineCode",{parentName:"p"},"try_{{entry_point_name}}")," functions that return an ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult")),".\n",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractHostRef")," implements regular entrypoints: ",(0,a.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),", and\nand safe its safe version: ",(0,a.kt)("inlineCode",{parentName:"p"},"try_name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name"),"."),(0,a.kt)("p",null,"In our example, we are calling ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name")," and expecting an error to be thrown.\nFor assertions, we are using a standard ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro. As the contract call returns an ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError"),",\nwe need to convert our custom error to ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," using ",(0,a.kt)("inlineCode",{parentName:"p"},"Into::into()"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/386627d1.9f970544.js b/docs/assets/js/386627d1.9f970544.js new file mode 100644 index 000000000..ad28d403e --- /dev/null +++ b/docs/assets/js/386627d1.9f970544.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25633],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=a.createContext({}),u=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=u(t),m=r,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||i;return t?a.createElement(f,o(o({ref:n},d),{},{components:t})):a.createElement(f,o({ref:n},d))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=p;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var u=2;u{t.d(n,{Z:()=>o});var a=t(67294),r=t(86010);const i="tabItem_Ymn6";function o(e){let{children:n,hidden:t,className:o}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(i,o),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>x});var a=t(87462),r=t(67294),i=t(86010),o=t(12466),s=t(16550),l=t(91980),u=t(67392),d=t(50012);function c(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:a,default:r}}=e;return{value:n,label:t,attributes:a,default:r}}))}function p(e){const{values:n,children:t}=e;return(0,r.useMemo)((()=>{const e=n??c(t);return function(e){const n=(0,u.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const a=(0,s.k6)(),i=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l._X)(i),(0,r.useCallback)((e=>{if(!i)return;const n=new URLSearchParams(a.location.search);n.set(i,e),a.replace({...a.location,search:n.toString()})}),[i,a])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:a}=e,i=p(e),[o,s]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const a=t.find((e=>e.default))??t[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:n,tabValues:i}))),[l,u]=f({queryString:t,groupId:a}),[c,h]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[a,i]=(0,d.Nk)(t);return[a,(0,r.useCallback)((e=>{t&&i.set(e)}),[t,i])]}({groupId:a}),b=(()=>{const e=l??c;return m({value:e,tabValues:i})?e:null})();(0,r.useLayoutEffect)((()=>{b&&s(b)}),[b]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:i}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),h(e)}),[u,h,i]),tabValues:i}}var b=t(72389);const y="tabList__CuJ",g="tabItem_LNqP";function v(e){let{className:n,block:t,selectedValue:s,selectValue:l,tabValues:u}=e;const d=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.o5)(),p=e=>{const n=e.currentTarget,t=d.indexOf(n),a=u[t].value;a!==s&&(c(n),l(a))},m=e=>{let n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;n=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;n=d[t]??d[d.length-1];break}}n?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,i.Z)("tabs",{"tabs--block":t},n)},u.map((e=>{let{value:n,label:t,attributes:o}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,key:n,ref:e=>d.push(e),onKeyDown:m,onClick:p},o,{className:(0,i.Z)("tabs__item",g,o?.className,{"tabs__item--active":s===n})}),t??n)})))}function k(e){let{lazy:n,children:t,selectedValue:a}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==a}))))}function w(e){const n=h(e);return r.createElement("div",{className:(0,i.Z)("tabs-container",y)},r.createElement(v,(0,a.Z)({},e,n)),r.createElement(k,(0,a.Z)({},e,n)))}function x(e){const n=(0,b.Z)();return r.createElement(w,(0,a.Z)({key:String(n)},e))}},86865:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>c});var a=t(87462),r=(t(67294),t(3905)),i=t(74866),o=t(85162);const s={sidebar_position:9,slug:"odra-solidity",image:"/img/odra-sol.png",description:"Learn how to transition from Solidity to Odra."},l="Odra for Solidity developers",u={unversionedId:"tutorials/odra-sol",id:"tutorials/odra-sol",title:"Odra for Solidity developers",description:"Learn how to transition from Solidity to Odra.",source:"@site/docs/tutorials/odra-sol.md",sourceDirName:"tutorials",slug:"/tutorials/odra-solidity",permalink:"/docs/next/tutorials/odra-solidity",draft:!1,tags:[],version:"current",lastUpdatedAt:1718109783,formattedLastUpdatedAt:"Jun 11, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,slug:"odra-solidity",image:"/img/odra-sol.png",description:"Learn how to transition from Solidity to Odra."},sidebar:"tutorialSidebar",previous:{title:"CEP-18",permalink:"/docs/next/tutorials/cep18"},next:{title:"Deploying a Token on Casper Livenet",permalink:"/docs/next/tutorials/deploying-on-casper"}},d={},c=[{value:"Introduction",id:"introduction",level:2},{value:"Prerequisites",id:"prerequisites",level:2},{value:"Hello World",id:"hello-world",level:2},{value:"Variable Storage and State Management",id:"variable-storage-and-state-management",level:2},{value:"Data Types",id:"data-types",level:3},{value:"Constants and Immutability",id:"constants-and-immutability",level:3},{value:"Variables",id:"variables",level:3},{value:"Arrays and Mappings",id:"arrays-and-mappings",level:3},{value:"Custom types",id:"custom-types",level:3},{value:"Data Location",id:"data-location",level:3},{value:"Functions",id:"functions",level:2},{value:"View and Pure",id:"view-and-pure",level:3},{value:"Modifiers",id:"modifiers",level:3},{value:"Visibility",id:"visibility",level:3},{value:"Payable",id:"payable",level:3},{value:"Selectors",id:"selectors",level:3},{value:"Events and Logging",id:"events-and-logging",level:2},{value:"Error Handling",id:"error-handling",level:2},{value:"Composition vs. Inheritance",id:"composition-vs-inheritance",level:2},{value:"Libraries and Utility",id:"libraries-and-utility",level:2},{value:"Fallback and Receive Functions",id:"fallback-and-receive-functions",level:2},{value:"Miscellaneous",id:"miscellaneous",level:2},{value:"Hashing",id:"hashing",level:3},{value:"Try-catch",id:"try-catch",level:3},{value:"Conclusion",id:"conclusion",level:2}],p={toc:c};function m(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"odra-for-solidity-developers"},"Odra for Solidity developers"),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To follow this guide, you should have:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Knowledge of Solidity."),(0,r.kt)("li",{parentName:"ul"},"Familiarity with Ethereum and smart contract concepts."),(0,r.kt)("li",{parentName:"ul"},"Basic understanding of Rust, as Odra is based on it.")),(0,r.kt)("h2",{id:"hello-world"},"Hello World"),(0,r.kt)("p",null,'Let\'s start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message.'),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, Var};\n\n#[odra::module]\npub struct HelloWorld {\n greet: Var,\n}\n\n#[odra::module]\nimpl HelloWorld {\n pub fn init(&mut self, message: String) {\n self.greet.set(message);\n }\n\n pub fn get(&self) -> String {\n self.greet.get_or_default()\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract HelloWorld {\n string public greet = "Hello World!";\n}\n')))),(0,r.kt)("p",null,"As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the ",(0,r.kt)("inlineCode",{parentName:"p"},"HelloWorld")," struct has a single state variable greet, which stores the greeting message. The module contains two functions: ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the greeting message and get to retrieve it.\nTwo key differences are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra does not generate getters for public state variables automatically, so you need to define them explicitly."),(0,r.kt)("li",{parentName:"ol"},"To initialize values, you must do it in the ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function, which is the contract constructor. You can't assign defaults outside the constructor.")),(0,r.kt)("h2",{id:"variable-storage-and-state-management"},"Variable Storage and State Management"),(0,r.kt)("h3",{id:"data-types"},"Data Types"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use core::str::FromStr;\nuse odra::{\n casper_types::{bytesrepr::Bytes, U256},\n module::Module,\n prelude::*,\n Address, UnwrapOrRevert, Var,\n};\n\n#[odra::module]\npub struct Primitives {\n boo: Var,\n u: Var, // u8 is the smallest unsigned integer type\n u2: Var, // U256 is the biggest unsigned integer type\n i: Var, // i32 is the smallest signed integer type\n i2: Var, // i64 is the biggest signed integer type\n address: Var
,\n bytes: Var,\n default_boo: Var,\n default_uint: Var,\n default_int: Var,\n default_addr: Var
,\n}\n\n#[odra::module]\nimpl Primitives {\n pub fn init(&mut self) {\n self.boo.set(true);\n self.u.set(1);\n self.u2.set(U256::from(456));\n self.i.set(-1);\n self.i2.set(456);\n self.address.set(\n Address::from_str(\n "hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb",\n )\n .unwrap_or_revert(&self.env()),\n );\n self.bytes.set(Bytes::from(vec![0xb5]));\n\n let _min_int = U256::zero();\n let _max_int = U256::MAX;\n }\n\n // For the types that have default values, we can use the get_or_default method\n pub fn get_default_boo(&self) -> bool {\n self.default_boo.get_or_default()\n }\n\n pub fn get_default_uint(&self) -> U256 {\n self.default_uint.get_or_default()\n }\n\n pub fn get_default_int(&self) -> i64 {\n self.default_int.get_or_default()\n }\n\n // Does not compile - Address does not have the default value\n pub fn get_default_addr(&self) -> Address {\n self.default_addr.get_or_default()\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/primitives/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/primitives/"'},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Primitives {\n bool public boo = true;\n\n uint8 public u8 = 1;\n uint256 public u256 = 456;\n\n int8 public i8 = -1;\n int256 public i256 = 456;\n\n int256 public minInt = type(int256).min;\n int256 public maxInt = type(int256).max;\n\n address public addr = 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c;\n bytes1 a = 0xb5; // [10110101]\n\n // Default values\n // Unassigned variables have a default value\n bool public defaultBoo; // false\n uint256 public defaultUint; // 0\n int256 public defaultInt; // 0\n address public defaultAddr; // 0x0000000000000000000000000000000000000000\n}\n")))),(0,r.kt)("p",null,"The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"u32"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"u64"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"U128"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," for unsigned integers, and ",(0,r.kt)("inlineCode",{parentName:"p"},"i32")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"i64")," for signed integers."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," type; the workaround is to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Option
"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," type is used to store byte arrays."),(0,r.kt)("p",null,"Values are stored in units called ",(0,r.kt)("inlineCode",{parentName:"p"},"Named Keys")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Dictionaries"),". Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point."),(0,r.kt)("h3",{id:"constants-and-immutability"},"Constants and Immutability"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::{account::AccountHash, U256}, Address};\n\n#[odra::module]\npub struct Constants;\n\n#[odra::module]\nimpl Constants {\n pub const MY_UINT: U256 = U256([123, 0, 0, 0]);\n pub const MY_ADDRESS: Address = Address::Account(\n AccountHash([0u8; 32])\n );\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/constants/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/constants/"'},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Constants {\n // coding convention to uppercase constant variables\n address public constant MY_ADDRESS =\n 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc;\n uint256 public constant MY_UINT = 123;\n}\n")))),(0,r.kt)("p",null,"In Odra, you can define constants using the ",(0,r.kt)("inlineCode",{parentName:"p"},"const")," keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the ",(0,r.kt)("inlineCode",{parentName:"p"},"immutable")," keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's ",(0,r.kt)("inlineCode",{parentName:"p"},"immutable")," keyword."),(0,r.kt)("h3",{id:"variables"},"Variables"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::{casper_types::U256, prelude::*, Var};\n\n#[odra::module]\npub struct Variables {\n text: Var,\n my_uint: Var,\n}\n\n#[odra::module]\nimpl Variables {\n pub fn init(&mut self) {\n self.text.set("Hello".to_string());\n self.my_uint.set(U256::from(123));\n }\n\n pub fn do_something(&self) {\n // Local variables\n let i = 456;\n // Env variables\n let timestamp = self.env().get_block_time();\n let sender = self.env().caller();\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/variables/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/variables/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Variables {\n // State variables are stored on the blockchain.\n string public text = "Hello";\n uint256 public num = 123;\n\n function doSomething() public {\n // Local variables are not saved to the blockchain.\n uint256 i = 456;\n\n // Here are some global variables\n uint256 timestamp = block.timestamp; // Current block timestamp\n address sender = msg.sender; // address of the caller\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractEnv")," retrieved using the ",(0,r.kt)("inlineCode",{parentName:"p"},"env()")," function."),(0,r.kt)("h3",{id:"arrays-and-mappings"},"Arrays and Mappings"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::U256, Address, Mapping};\n\n#[odra::module]\npub struct MappingContract {\n my_map: Mapping> \n}\n\n#[odra::module]\nimpl MappingContract {\n pub fn get(&self, addr: Address) -> U256 {\n // self.my_map.get(&addr) would return Option>\n // so we use get_or_default instead and unwrap the inner Option\n self.my_map.get_or_default(&addr).unwrap_or_default()\n }\n\n pub fn set(&mut self, addr: Address, i: U256) {\n self.my_map.set(&addr, Some(i));\n }\n\n pub fn remove(&mut self, addr: Address) {\n self.my_map.set(&addr, None);\n }\n}\n\n#[odra::module]\npub struct NestedMapping {\n my_map: Mapping<(Address, U256), Option> \n}\n\n#[odra::module]\nimpl NestedMapping {\n pub fn get(&self, addr: Address, i: U256) -> bool {\n self.my_map.get_or_default(&(addr, i)).unwrap_or_default()\n }\n\n pub fn set(&mut self, addr: Address, i: U256, boo: bool) {\n self.my_map.set(&(addr, i), Some(boo));\n }\n\n pub fn remove(&mut self, addr: Address, i: U256) {\n self.my_map.set(&(addr, i), None);\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Mapping {\n mapping(address => uint256) public myMap;\n\n function get(address _addr) public view returns (uint256) {\n return myMap[_addr];\n }\n\n function set(address _addr, uint256 _i) public {\n myMap[_addr] = _i;\n }\n\n function remove(address _addr) public {\n delete myMap[_addr];\n }\n}\n\ncontract NestedMapping {\n mapping(address => mapping(uint256 => bool)) public nested;\n\n function get(address _addr1, uint256 _i) public view returns (bool) {\n return nested[_addr1][_i];\n }\n\n function set(address _addr1, uint256 _i, bool _boo) public {\n nested[_addr1][_i] = _boo;\n }\n\n function remove(address _addr1, uint256 _i) public {\n delete nested[_addr1][_i];\n }\n}\n")))),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, Var};\n\n#[odra::module]\npub struct Array {\n // the size of the array must be known at compile time\n arr: Var<[u8; 10]>,\n vec: Var>,\n}\n\n#[odra::module]\nimpl Array {\n pub fn init(&mut self) {\n self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n self.vec.set(vec![1, 2, 3, 4, 5]);\n }\n\n pub fn get_arr(&self) -> [u8; 10] {\n self.arr.get_or_default()\n }\n\n pub fn push_vec(&mut self, value: u32) {\n let mut vec = self.vec.get_or_default();\n vec.push(value);\n self.vec.set(vec);\n }\n\n pub fn pop_vec(&mut self) {\n let mut vec = self.vec.get_or_default();\n vec.pop();\n self.vec.set(vec);\n }\n\n pub fn update_arr(&mut self, index: u8, value: u8) {\n let mut arr = self.arr.get_or_default();\n arr[index as usize] = value;\n self.arr.set(arr);\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Array {\n // Several ways to initialize an array\n uint256[] public arr;\n uint256[] public arr2 = [1, 2, 3];\n // Fixed sized array, all elements initialize to 0\n uint256[10] public myFixedSizeArr;\n\n function get(uint256 i) public view returns (uint256) {\n return arr[i];\n }\n\n // Solidity can return the entire array.\n // But this function should be avoided for\n // arrays that can grow indefinitely in length.\n function getArr() public view returns (uint256[] memory) {\n return arr;\n }\n\n function push(uint256 i) public {\n // Append to array\n // This will increase the array length by 1.\n arr.push(i);\n }\n\n function pop() public {\n // Remove last element from array\n // This will decrease the array length by 1\n arr.pop();\n }\n\n function getLength() public view returns (uint256) {\n return arr.length;\n }\n\n function remove(uint256 index) public {\n // Delete does not change the array length.\n // It resets the value at index to it's default value,\n // in this case 0\n delete arr[index];\n }\n\n function examples() external {\n // create array in memory, only fixed size can be created\n uint256[] memory a = new uint256[](5);\n }\n}\n")))),(0,r.kt)("p",null,"For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," instead of an array or vector to store data."),(0,r.kt)("h3",{id:"custom-types"},"Custom types"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, Var};\n\n#[odra::odra_type]\n#[derive(Default)]\npub enum Status {\n #[default]\n Pending,\n Shipped,\n Accepted,\n Rejected,\n Canceled,\n}\n\n#[odra::module]\npub struct Enum {\n status: Var,\n}\n\n#[odra::module]\nimpl Enum {\n pub fn get(&self) -> Status {\n self.status.get_or_default()\n }\n\n pub fn set(&mut self, status: Status) {\n self.status.set(status);\n }\n\n pub fn cancel(&mut self) {\n self.status.set(Status::Canceled);\n }\n\n pub fn reset(&mut self) {\n self.status.set(Default::default());\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/enum/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/enum/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Enum {\n // Enum representing shipping status\n enum Status {\n Pending,\n Shipped,\n Accepted,\n Rejected,\n Canceled\n }\n\n // Default value is the first element listed in\n // definition of the type, in this case "Pending"\n Status public status;\n\n // Returns uint\n // Pending - 0\n // Shipped - 1\n // Accepted - 2\n // Rejected - 3\n // Canceled - 4\n function get() public view returns (Status) {\n return status;\n }\n\n function set(Status _status) public {\n status = _status;\n }\n\n function cancel() public {\n status = Status.Canceled;\n }\n\n // delete resets the enum to its first value, 0\n function reset() public {\n delete status;\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, custom types are defined using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. The enum can have a default value specified using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[default]")," attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Default::default()")," function."),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, List};\n\n#[odra::odra_type]\npub struct Todo {\n text: String,\n completed: bool,\n}\n\n#[odra::module]\npub struct Enum {\n // You could also use Var> instead of List,\n // but List is more efficient for large arrays,\n // it loads items lazily.\n todos: List,\n}\n\n#[odra::module]\nimpl Enum {\n pub fn create(&mut self, text: String) {\n self.todos.push(Todo {\n text,\n completed: false,\n });\n }\n\n pub fn update_text(&mut self, index: u32, text: String) {\n if let Some(mut todo) = self.todos.get(index) {\n todo.text = text;\n self.todos.replace(index, todo);\n }\n }\n\n pub fn toggle_complete(&mut self, index: u32) {\n if let Some(mut todo) = self.todos.get(index) {\n todo.completed = !todo.completed;\n self.todos.replace(index, todo);\n }\n }\n\n // Odra does not create getters by default\n pub fn get(&self, index: u32) -> Option {\n self.todos.get(index)\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/structs/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/structs/"'},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Todos {\n struct Todo {\n string text;\n bool completed;\n }\n\n Todo[] public todos;\n\n function create(string calldata _text) public {\n todos.push(Todo(_text, false));\n }\n\n // Solidity automatically created a getter for 'todos' so\n // you don't actually need this function.\n function get(uint256 _index)\n public\n view\n returns (string memory text, bool completed)\n {\n Todo storage todo = todos[_index];\n return (todo.text, todo.completed);\n }\n\n function updateText(uint256 _index, string calldata _text) public {\n Todo storage todo = todos[_index];\n todo.text = _text;\n }\n\n function toggleCompleted(uint256 _index) public {\n Todo storage todo = todos[_index];\n todo.completed = !todo.completed;\n }\n}\n\n")))),(0,r.kt)("p",null,"Similarly to enums, custom structs are defined using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. The struct can be used to define a list of items in a contract. The list can be created using the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type, which is more efficient for large arrays as it loads items lazily."),(0,r.kt)("h3",{id:"data-location"},"Data Location"),(0,r.kt)("p",null,"In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be ",(0,r.kt)("inlineCode",{parentName:"p"},"memory"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"calldata"),". In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),"), the data is stored in the contract's storage."),(0,r.kt)("h2",{id:"functions"},"Functions"),(0,r.kt)("p",null,"Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"impl Erc20 {\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.internal_transfer(&self.env().caller(), recipient, amount);\n // Transfer logic goes here\n }\n\n fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) {\n // Internal transfer logic goes here\n }\n}\n")),(0,r.kt)("p",null,"Functions can modify contract state and emit events using the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/communicating-with-host"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," function."),(0,r.kt)("h3",{id:"view-and-pure"},"View and Pure"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::Var;\n\n#[odra::module]\npub struct ViewAndPure {\n x: Var \n}\n\n#[odra::module]\nimpl ViewAndPure {\n pub fn add_to_x(&self, y: u32) -> u32 {\n self.x.get_or_default() + y\n }\n}\n\npub fn add(i: u32, j: u32) -> u32 {\n i + j\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract ViewAndPure {\n uint256 public x = 1;\n\n // Promise not to modify the state.\n function addToX(uint256 y) public view returns (uint256) {\n return x + y;\n }\n\n // Promise not to modify or read from the state.\n function add(uint256 i, uint256 j) public pure returns (uint256) {\n return i + j;\n }\n}\n")))),(0,r.kt)("p",null,"In Odra, you don't need to specify ",(0,r.kt)("inlineCode",{parentName:"p"},"view")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"pure")," functions explicitly. All functions are considered ",(0,r.kt)("inlineCode",{parentName:"p"},"view")," functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut self"),". If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects."),(0,r.kt)("h3",{id:"modifiers"},"Modifiers"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::Var;\n\n#[odra::module]\npub struct FunctionModifier {\n x: Var,\n locked: Var, \n}\n\n#[odra::module]\nimpl FunctionModifier {\n pub fn decrement(&mut self, i: u32) -> u32 {\n self.lock();\n self.x.set(self.x.get_or_default() - i);\n\n if i > 1 {\n self.decrement(i - 1);\n }\n self.unlock();\n }\n\n #[inline]\n fn lock(&mut self) {\n if self.locked.get_or_default() {\n self.env().revert("No reentrancy");\n }\n\n self.locked.set(true);\n }\n\n #[inline]\n fn unlock(&mut self) {\n self.locked.set(false);\n }\n}\n\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract FunctionModifier {\n uint256 public x = 10;\n bool public locked;\n\n modifier noReentrancy() {\n require(!locked, "No reentrancy");\n\n locked = true;\n _;\n locked = false;\n }\n\n function decrement(uint256 i) public noReentrancy {\n x -= i;\n\n if (i > 1) {\n decrement(i - 1);\n }\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the ",(0,r.kt)("inlineCode",{parentName:"p"},"lock")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unlock")," functions are called before and after the decrement function, respectively, but they must be called explicitly."),(0,r.kt)("p",null,"As often as practicable, developers should inline functions by including the body of the function within their code using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[inline]")," attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances."),(0,r.kt)("h3",{id:"visibility"},"Visibility"),(0,r.kt)("p",null,"Functions and state variables have to declare whether they are accessible by other contracts."),(0,r.kt)("p",null,"Functions can be declared as:"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"`pub` inside `#[odra::module]` impl block - any contract/submodule and account can call.\n`pub` inside a regular impl block - any submodule can call.\n`default/no modifier/private` - only inside the contract that defines the function.\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"`public` - any contract and account can call.\n`private` - only inside the contract that defines the function.\n`internal` - only inside contract that inherits an internal function.\n`external` - only other contracts and accounts can call\n\nState variables can be declared as public, private, or internal but not external.\n")))),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var};\n\n#[odra::module]\npub struct Payable {\n owner: Var
,\n}\n\n#[odra::module]\nimpl Payable {\n pub fn init(&mut self) {\n self.owner.set(self.env().caller());\n }\n\n #[odra(payable)]\n pub fn deposit(&self) {\n }\n\n pub fn not_payable(&self) {\n }\n\n pub fn withdraw(&self) {\n let amount = self.env().self_balance();\n self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount);\n }\n\n pub fn transfer(&self, to: Address, amount: U512) {\n self.env().transfer_tokens(&to, &amount);\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Payable {\n // Payable address can send Ether via transfer or send\n address payable public owner;\n\n // Payable constructor can receive Ether\n constructor() payable {\n owner = payable(msg.sender);\n }\n\n // Function to deposit Ether into this contract.\n // Call this function along with some Ether.\n // The balance of this contract will be automatically updated.\n function deposit() public payable {}\n\n // Call this function along with some Ether.\n // The function will throw an error since this function is not payable.\n function notPayable() public {}\n\n // Function to withdraw all Ether from this contract.\n function withdraw() public {\n // get the amount of Ether stored in this contract\n uint256 amount = address(this).balance;\n\n // send all Ether to owner\n (bool success,) = owner.call{value: amount}("");\n require(success, "Failed to send Ether");\n }\n\n // Function to transfer Ether from this contract to address from input\n function transfer(address payable _to, uint256 _amount) public {\n // Note that "to" is declared as payable\n (bool success,) = _to.call{value: _amount}("");\n require(success, "Failed to send Ether");\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, you can define a function with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether."),(0,r.kt)("h3",{id:"selectors"},"Selectors"),(0,r.kt)("p",null,"In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'contract_addr.call(\n abi.encodeWithSignature("transfer(address,uint256)", address, 1234)\n)\n')),(0,r.kt)("p",null,"Odra does not support such a mechanism. You must have access to the contract interface to call a function."),(0,r.kt)("h2",{id:"events-and-logging"},"Events and Logging"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::{prelude::*, Address};\n\n#[odra::event]\npub struct Log {\n sender: Address,\n message: String,\n}\n\n#[odra::event]\npub struct AnotherLog {}\n\n#[odra::module]\nstruct Event;\n\n#[odra::module]\nimpl Event {\n pub fn test(&self) {\n let env = self.env();\n env.emit_event(Log {\n sender: env.caller(),\n message: "Hello World!".to_string(),\n });\n env.emit_event(Log {\n sender: env.caller(),\n message: "Hello Casper!".to_string(),\n });\n env.emit_event(AnotherLog {});\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/events/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/events/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Event {\n // Event declaration\n // Up to 3 parameters can be indexed.\n // Indexed parameters helps you filter the logs by the indexed parameter\n event Log(address indexed sender, string message);\n event AnotherLog();\n\n function test() public {\n emit Log(msg.sender, "Hello World!");\n emit Log(msg.sender, "Hello EVM!");\n emit AnotherLog();\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, events are regular structs defined using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's ",(0,r.kt)("inlineCode",{parentName:"p"},"emit_event()")," function, passing the event struct as an argument."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/events"},"Basics")," section.")),(0,r.kt)("h2",{id:"error-handling"},"Error Handling"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, casper_types::{U256, U512}};\n\n#[odra::odra_error]\npub enum CustomError {\n InsufficientBalance = 1,\n InputLowerThanTen = 2,\n}\n\n#[odra::module]\npub struct Error;\n\n#[odra::module]\nimpl Error {\n pub fn test_require(&mut self, i: U256) {\n if i <= 10.into() {\n self.env().revert(CustomError::InputLowerThanTen);\n }\n }\n\n pub fn execute_external_call(&self, withdraw_amount: U512) {\n let balance = self.env().self_balance();\n if balance < withdraw_amount {\n self.env().revert(CustomError::InsufficientBalance);\n }\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/error/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/error/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Error {\n function testRequire(uint256 _i) public pure {\n // Require should be used to validate conditions such as:\n // - inputs\n // - conditions before execution\n // - return values from calls to other functions\n require(_i > 10, "Input must be greater than 10");\n }\n\n function testRevert(uint256 _i) public pure {\n // Revert is useful when the condition to check is complex.\n // This code does the exact same thing as the example above\n if (_i <= 10) {\n revert("Input must be greater than 10");\n }\n }\n\n uint256 public num;\n\n function testAssert() public view {\n // Assert should only be used to test for internal errors,\n // and to check invariants.\n\n // Here we assert that num is always equal to 0\n // since it is impossible to update the value of num\n assert(num == 0);\n }\n\n // custom error\n error InsufficientBalance(uint256 balance, uint256 withdrawAmount);\n\n function testCustomError(uint256 _withdrawAmount) public view {\n uint256 bal = address(this).balance;\n if (bal < _withdrawAmount) {\n revert InsufficientBalance({\n balance: bal,\n withdrawAmount: _withdrawAmount\n });\n }\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity, there are four ways to handle errors: ",(0,r.kt)("inlineCode",{parentName:"p"},"require"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"revert"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"assert"),", and custom errors. In Odra, there is only one way to revert the execution of a function - by using the ",(0,r.kt)("inlineCode",{parentName:"p"},"env().revert()")," function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute. On Casper, an error is only a number, so you can't pass a message with the error."),(0,r.kt)("h2",{id:"composition-vs-inheritance"},"Composition vs. Inheritance"),(0,r.kt)("p",null,"In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another."),(0,r.kt)("p",null,"Let's take a look at the difference between inheritance in Solidity and composition in Odra."),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::{prelude::*, SubModule};\n\n#[odra::module]\npub struct A;\n\n#[odra::module]\nimpl A {\n pub fn foo(&self) -> String {\n "A".to_string()\n }\n}\n\n#[odra::module]\npub struct B {\n a: SubModule\n}\n\n#[odra::module]\nimpl B {\n pub fn foo(&self) -> String {\n "B".to_string()\n }\n}\n\n#[odra::module]\npub struct C {\n a: SubModule\n}\n\n#[odra::module]\nimpl C {\n pub fn foo(&self) -> String {\n "C".to_string()\n }\n}\n\n#[odra::module]\npub struct D {\n b: SubModule,\n c: SubModule\n}\n\n#[odra::module]\nimpl D {\n pub fn foo(&self) -> String {\n self.c.foo()\n }\n}\n\n#[odra::module]\npub struct E {\n b: SubModule,\n c: SubModule\n}\n\n#[odra::module]\nimpl E {\n pub fn foo(&self) -> String {\n self.b.foo()\n }\n}\n\n#[odra::module]\npub struct F {\n a: SubModule,\n b: SubModule,\n}\n\n#[odra::module]\nimpl F {\n pub fn foo(&self) -> String {\n self.a.foo()\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/inheritance/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/inheritance/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\n/* Graph of inheritance\n A\n / \\\n B C\n / \\ /\nF D,E\n*/\n\ncontract A {\n function foo() public pure virtual returns (string memory) {\n return "A";\n }\n}\n\n// Contracts inherit other contracts by using the keyword \'is\'.\ncontract B is A {\n // Override A.foo()\n function foo() public pure virtual override returns (string memory) {\n return "B";\n }\n}\n\ncontract C is A {\n // Override A.foo()\n function foo() public pure virtual override returns (string memory) {\n return "C";\n }\n}\n\n// Contracts can inherit from multiple parent contracts.\n// When a function is called that is defined multiple times in\n// different contracts, parent contracts are searched from\n// right to left, and in depth-first manner.\ncontract D is B, C {\n // D.foo() returns "C"\n // since C is the right most parent contract with function foo()\n function foo() public pure override(B, C) returns (string memory) {\n return super.foo();\n }\n}\n\ncontract E is C, B {\n // E.foo() returns "B"\n // since B is the right most parent contract with function foo()\n function foo() public pure override(C, B) returns (string memory) {\n return super.foo();\n }\n}\n\n// Inheritance must be ordered from \u201cmost base-like\u201d to \u201cmost derived\u201d.\n// Swapping the order of A and B will throw a compilation error.\ncontract F is A, B {\n function foo() public pure override(A, B) returns (string memory) {\n return super.foo();\n }\n}\n')))),(0,r.kt)("p",null,'Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers.'),(0,r.kt)("p",null,"In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts."),(0,r.kt)("h2",{id:"libraries-and-utility"},"Libraries and Utility"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var};\n\nmod math {\n use odra::casper_types::U256;\n\n pub fn sqrt(y: U256) -> U256 {\n let mut z = y;\n if y > 3.into() {\n let mut x = y / 2 + 1;\n while x < z {\n z = x;\n x = (y / x + x) / 2;\n }\n } else if y != U256::zero() {\n z = U256::one();\n }\n z\n }\n}\n\n#[odra::module]\nstruct TestMath;\n\n#[odra::module]\nimpl TestMath {\n pub fn test_square_root(&self, x: U256) -> U256 {\n math::sqrt(x)\n }\n}\n\n#[odra::odra_error]\nenum Error {\n EmptyArray = 100,\n}\n\ntrait Removable {\n fn remove(&mut self, index: usize);\n}\n\nimpl Removable for Var> {\n fn remove(&mut self, index: usize) {\n let env = self.env();\n let mut vec = self.get_or_default();\n if vec.is_empty() {\n env.revert(Error::EmptyArray);\n }\n vec[index] = vec.pop().unwrap_or_revert(&env);\n self.set(vec);\n }\n}\n\n#[odra::module]\nstruct TestArray {\n arr: Var>,\n}\n\n#[odra::module]\nimpl TestArray {\n pub fn test_array_remove(&mut self) {\n let mut arr = self.arr.get_or_default();\n for i in 0..3 {\n arr.push(i.into());\n }\n self.arr.set(arr);\n\n self.arr.remove(1);\n\n let arr = self.arr.get_or_default();\n assert_eq!(arr.len(), 2);\n assert_eq!(arr[0], 0.into());\n assert_eq!(arr[1], 2.into());\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/library/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/library/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nlibrary Math {\n function sqrt(uint256 y) internal pure returns (uint256 z) {\n if (y > 3) {\n z = y;\n uint256 x = y / 2 + 1;\n while (x < z) {\n z = x;\n x = (y / x + x) / 2;\n }\n } else if (y != 0) {\n z = 1;\n }\n // else z = 0 (default value)\n }\n}\n\ncontract TestMath {\n function testSquareRoot(uint256 x) public pure returns (uint256) {\n return Math.sqrt(x);\n }\n}\n\nlibrary Array {\n function remove(uint256[] storage arr, uint256 index) public {\n require(arr.length > 0, "Can\'t remove from empty array");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n\ncontract TestArray {\n using Array for uint256[];\n\n uint256[] public arr;\n\n function testArrayRemove() public {\n for (uint256 i = 0; i < 3; i++) {\n arr.push(i);\n }\n\n arr.remove(1);\n\n assert(arr.length == 2);\n assert(arr[0] == 0);\n assert(arr[1] == 2);\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the ",(0,r.kt)("inlineCode",{parentName:"p"},"Math")," library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the ",(0,r.kt)("inlineCode",{parentName:"p"},"TestMath")," contract calls the ",(0,r.kt)("inlineCode",{parentName:"p"},"sqrt")," function directly, while the ",(0,r.kt)("inlineCode",{parentName:"p"},"TestArray")," contract uses the using keyword, which extends the type ",(0,r.kt)("inlineCode",{parentName:"p"},"uint256[]")," by adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"remove")," function."),(0,r.kt)("p",null,"In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Removable")," trait for the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var>")," type allows the ",(0,r.kt)("inlineCode",{parentName:"p"},"remove")," function to be called on a variable that stores a vector of ",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," values."),(0,r.kt)("h2",{id:"fallback-and-receive-functions"},"Fallback and Receive Functions"),(0,r.kt)("p",null,"In Solidity, a contract receiving Ether must implement a ",(0,r.kt)("inlineCode",{parentName:"p"},"receive()")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"fallback()")," function. The ",(0,r.kt)("inlineCode",{parentName:"p"},"receive()")," function is called when Ether is sent to the contract with no data, while the ",(0,r.kt)("inlineCode",{parentName:"p"},"fallback()")," function is called when the contract receives Ether with data or when a function that does not exist is called."),(0,r.kt)("p",null,"Odra does not have a direct equivalent to the ",(0,r.kt)("inlineCode",{parentName:"p"},"receive()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"fallback()")," functions. Instead, you can define a function with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute to indicate that the function can receive CSPRs."),(0,r.kt)("h2",{id:"miscellaneous"},"Miscellaneous"),(0,r.kt)("h3",{id:"hashing"},"Hashing"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n casper_types::{bytesrepr::ToBytes, U256},\n prelude::*,\n Address, UnwrapOrRevert, Var,\n};\n\n#[odra::module]\npub struct HashFunction;\n\n#[odra::module]\nimpl HashFunction {\n pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] {\n let env = self.env();\n let mut data = Vec::new();\n data.extend(text.to_bytes().unwrap_or_revert(&env));\n data.extend(num.to_bytes().unwrap_or_revert(&env));\n data.extend(addr.to_bytes().unwrap_or_revert(&env));\n env.hash(data)\n }\n}\n\n#[odra::module]\npub struct GuessTheMagicWord {\n answer: Var<[u8; 32]>,\n}\n\n#[odra::module]\nimpl GuessTheMagicWord {\n /// Initializes the contract with the magic word hash.\n pub fn init(&mut self) {\n self.answer.set([\n 0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84,\n 0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55,\n 0xbe, 0xd7, 0x56, 0x08,\n ]);\n }\n\n /// Checks if the `word` is the magic word.\n pub fn guess(&self, word: String) -> bool {\n let env = self.env();\n let hash = env.hash(word.to_bytes().unwrap_or_revert(&env));\n hash == self.answer.get_or_default()\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/hashing/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/hashing/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract HashFunction {\n function hash(string memory _text, uint256 _num, address _addr)\n public\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(_text, _num, _addr));\n }\n}\n\ncontract GuessTheMagicWord {\n bytes32 public answer =\n 0x60298f78cc0b47170ba79c10aa3851d7648bd96f2f8e46a19dbc777c36fb0c00;\n\n // Magic word is "Solidity"\n function guess(string memory _word) public view returns (bool) {\n return keccak256(abi.encodePacked(_word)) == answer;\n }\n}\n')))),(0,r.kt)("p",null,"The key difference between the two is that in Solidity, the ",(0,r.kt)("inlineCode",{parentName:"p"},"keccak256")," function is used to hash data, while in Odra, the ",(0,r.kt)("inlineCode",{parentName:"p"},"env.hash()")," function is used, which implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"blake2b")," algorithm. Both functions take a byte array as input and return a 32-byte hash."),(0,r.kt)("h3",{id:"try-catch"},"Try-catch"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{module::Module, Address, ContractRef, Var};\n\n#[odra::module]\npub struct Example {\n other_contract: Var
,\n}\n\n#[odra::module]\nimpl Example {\n pub fn init(&mut self, other_contract: Address) {\n self.other_contract.set(other_contract);\n }\n\n pub fn execute_external_call(&self) {\n if let Some(addr) = self.other_contract.get() {\n let result = OtherContractContractRef::new(self.env(), addr).some_function();\n match result {\n Ok(success) => {\n // Code to execute if the external call was successful\n }\n Err(reason) => {\n // Code to execute if the external call failed\n }\n }\n }\n }\n}\n\n#[odra::module]\npub struct OtherContract;\n\n#[odra::module]\nimpl OtherContract {\n pub fn some_function(&self) -> Result {\n Ok(true)\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/hashing/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/hashing/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Example {\n OtherContract otherContract;\n\n constructor(address _otherContractAddress) public {\n otherContract = OtherContract(_otherContractAddress);\n }\n\n function executeExternalCall() public {\n try otherContract.someFunction() returns (bool success) {\n // Code to execute if the external call was successful\n require(success, "Call failed");\n } catch Error(string memory reason) {\n // Code to execute if the external call failed with a revert reason\n // Optionally handle specific revert reasons\n emit LogErrorString(reason);\n } catch (bytes memory lowLevelData) {\n // Code to execute if the external call failed without a revert reason\n emit LogErrorBytes(lowLevelData);\n }\n }\n\n event LogErrorString(string reason);\n event LogErrorBytes(bytes lowLevelData);\n}\n\ncontract OtherContract {\n function someFunction() public returns (bool) {\n // Function logic\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity, ",(0,r.kt)("inlineCode",{parentName:"p"},"try/catch")," is a feature that allows developers to handle exceptions and errors more gracefully. The ",(0,r.kt)("inlineCode",{parentName:"p"},"try/catch")," statement allows developers to catch and handle exceptions that occur during external function calls and contract creation."),(0,r.kt)("p",null,"In Odra, there is no direct equivalent to the ",(0,r.kt)("inlineCode",{parentName:"p"},"try/catch")," statement in Solidity. However, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Result")," type to handle errors in a similar way. The ",(0,r.kt)("inlineCode",{parentName:"p"},"Result")," type is an enum that represents either success (",(0,r.kt)("inlineCode",{parentName:"p"},"Ok"),") or failure (",(0,r.kt)("inlineCode",{parentName:"p"},"Err"),"). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts."),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development."),(0,r.kt)("p",null,"Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework."),(0,r.kt)("p",null,"Read more about the Odra Framework in the ",(0,r.kt)("a",{parentName:"p",href:"../category/basics"},"Basics")," and ",(0,r.kt)("a",{parentName:"p",href:"../category/advanced/"},"Advanced")," sections."),(0,r.kt)("p",null,"Learn by example with our ",(0,r.kt)("a",{parentName:"p",href:"../category/tutorials"},"Tutorial")," series, you will find there a contract you likely familiar with - the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/tutorials/erc20"},"Erc20")," standard implementation."),(0,r.kt)("p",null,"If you have any further questions or need clarification on specific topics, feel free to join our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3879932b.fed9f072.js b/docs/assets/js/3879932b.fed9f072.js new file mode 100644 index 000000000..3718b5fd2 --- /dev/null +++ b/docs/assets/js/3879932b.fed9f072.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[36578],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.9.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.9.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.9.0/",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.9.0/category/getting-started"}},c={image:r(57938).Z},p=[{value:"What's next",id:"whats-next",level:2}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a Rust-based smart contract framework for ",(0,o.kt)("a",{parentName:"p",href:"https://casper.network"},"Casper Network"),". Odra encourages rapid development and clean,\npragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. "),(0,o.kt)("p",null,"It's free and open source!"),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.0/getting-started/flipper"},"Flipper example")," to find out how to start your new project with Odra."))}d.isMDXComponent=!0},57938:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/39d2189a.571d697d.js b/docs/assets/js/39d2189a.571d697d.js new file mode 100644 index 000000000..16f252f80 --- /dev/null +++ b/docs/assets/js/39d2189a.571d697d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76262],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},o="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.4.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.4.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.4.0/basics/flipper-internals",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.4.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.4.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.4.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Variable;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Variables and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Variable,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Variable")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," macro marks the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperDeployer")," - a piece of code generated automatically thanks to the macros.\nThe contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3ac77d2e.890d3613.js b/docs/assets/js/3ac77d2e.890d3613.js new file mode 100644 index 000000000..d11a7daa2 --- /dev/null +++ b/docs/assets/js/3ac77d2e.890d3613.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[34627],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.4.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.4.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.4.0/basics/odra-toml",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.4.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.4.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," will be used as a name for the contract - the generated wasm file will be in the above case named\n",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the builder to locate the exact struct where\nthe contract is defined."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n\n[[contracts]]\nname = "counter"\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3b67cac2.a2ccd153.js b/docs/assets/js/3b67cac2.a2ccd153.js new file mode 100644 index 000000000..81450162e --- /dev/null +++ b/docs/assets/js/3b67cac2.a2ccd153.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[68800],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),u=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=u(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=u(n),m=r,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>u});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5},o="Pausable",l={unversionedId:"tutorials/pauseable",id:"version-0.8.1/tutorials/pauseable",title:"Pausable",description:"The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.",source:"@site/versioned_docs/version-0.8.1/tutorials/pauseable.md",sourceDirName:"tutorials",slug:"/tutorials/pauseable",permalink:"/docs/0.8.1/tutorials/pauseable",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Access Control",permalink:"/docs/0.8.1/tutorials/access-control"},next:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/0.8.1/tutorials/build-deploy-read"}},i={},u=[{value:"Code",id:"code",level:2},{value:"Events and Error",id:"events-and-error",level:3},{value:"Module definition",id:"module-definition",level:3},{value:"Checks and guards",id:"checks-and-guards",level:3},{value:"Actions",id:"actions",level:3},{value:"Pausable counter",id:"pausable-counter",level:2}],d={toc:u};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently."),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"As always, we will start with defining functionalities of our module."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Check the state - is it paused or not."),(0,r.kt)("li",{parentName:"ol"},"State guards - a contract should stop execution if is in a state we don't expect."),(0,r.kt)("li",{parentName:"ol"},"Switch the state.")),(0,r.kt)("h3",{id:"events-and-error"},"Events and Error"),(0,r.kt)("p",null,"There just two errors that may occur: ",(0,r.kt)("inlineCode",{parentName:"p"},"PausedRequired"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"UnpausedRequired"),". We define them in a standard Odra way."),(0,r.kt)("p",null,"Events definition is highly uncomplicated: ",(0,r.kt)("inlineCode",{parentName:"p"},"Paused")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused")," events holds only the address of the pauser."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Event, OdraError};\n\n#[derive(OdraError)]\npub enum Error {\n PausedRequired = 1_000,\n UnpausedRequired = 1_001,\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Paused {\n pub account: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Unpaused {\n pub account: Address\n}\n")),(0,r.kt)("h3",{id:"module-definition"},"Module definition"),(0,r.kt)("p",null,"The module storage is extremely simple - has a single ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," of type bool, that indicates if a contract is paused."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::Var;\n...\n\n#[odra::module(events = [Paused, Unpaused])]\npub struct Pausable {\n is_paused: Var\n}\n")),(0,r.kt)("h3",{id:"checks-and-guards"},"Checks and guards"),(0,r.kt)("p",null,"Now, let's move to state checks and guards."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn is_paused(&self) -> bool {\n self.is_paused.get_or_default()\n }\n\n pub fn require_not_paused(&self) {\n if self.is_paused() {\n self.env().revert(Error::UnpausedRequired);\n }\n }\n\n pub fn require_paused(&self) {\n if !self.is_paused() {\n self.env().revert(Error::PausedRequired);\n }\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - as mentioned in the intro, the module is not intended to be a standalone contract, so the only ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block is not annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::module")," and hence does not expose any entrypoint."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L2")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused()")," checks the contract state, if the Var ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused")," has not been initialized, the default value (false) is returned."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - to guarantee the code is executed when the contract is not paused, ",(0,r.kt)("inlineCode",{parentName:"li"},"require_not_paused()")," function reads the state and reverts if the contract is paused. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"require_paused()")," is a mirror function - stops the contract execution if the contract is not paused.")),(0,r.kt)("h3",{id:"actions"},"Actions"),(0,r.kt)("p",null,"Finally, we will add the ability to switch the module state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn pause(&mut self) {\n self.require_not_paused();\n self.is_paused.set(true);\n\n self.env().emit_event(Paused {\n account: self.env().caller()\n });\n }\n\n pub fn unpause(&mut self) {\n self.require_paused();\n self.is_paused.set(false);\n\n self.env().emit_event(Unpaused {\n account: self.env().caller()\n });\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"pause()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()")," functions do three things: ensure the contract is the right state (unpaused for ",(0,r.kt)("inlineCode",{parentName:"p"},"pause()"),", not paused for ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()"),"), updates the state, and finally emits events (",(0,r.kt)("inlineCode",{parentName:"p"},"Paused"),"/",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused"),")."),(0,r.kt)("h2",{id:"pausable-counter"},"Pausable counter"),(0,r.kt)("p",null,"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called ",(0,r.kt)("inlineCode",{parentName:"p"},"PausableCounter"),". The contract consists of a Var ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module. The counter can only be incremented if the contract is in a normal state (is not paused)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"...\nuse odra::SubModule;\n...\n\n#[odra::module]\npub struct PausableCounter {\n value: Var,\n pauseable: SubModule\n}\n\n#[odra::module]\nimpl PausableCounter {\n pub fn increment(&mut self) {\n self.pauseable.require_not_paused();\n\n let new_value = self.value.get_or_default() + 1;\n self.value.set(new_value);\n }\n\n pub fn pause(&mut self) {\n self.pauseable.pause();\n }\n\n pub fn unpause(&mut self) {\n self.pauseable.unpause();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn increment_only_if_unpaused() {\n let test_env = odra_test::env();\n let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);\n contract.increment();\n contract.pause();\n\n assert_eq!(\n contract.try_increment().unwrap_err(),\n Error::UnpausedRequired.into()\n );\n assert_eq!(contract.get_value(), 1);\n }\n}\n")),(0,r.kt)("p",null,"As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3bb5653d.b216ea79.js b/docs/assets/js/3bb5653d.b216ea79.js new file mode 100644 index 000000000..c3b83b766 --- /dev/null +++ b/docs/assets/js/3bb5653d.b216ea79.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[89167],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.5.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.5.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.5.0/basics/storage-interaction",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.5.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.5.0/basics/communicating-with-host"}},l={},p=[{value:"Variable",id:"variable",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"variable"},"Variable"),(0,r.kt)("p",null,"The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Variable,\n weight: Variable,\n name: Variable,\n walks: Variable>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::Variable;\n\n#[odra::module]\nimpl DogContract {\n #[odra(init)]\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A Variable is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses Mapping to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{Mapping, Variable};\n\n#[odra::module]\npub struct DogContract2 {\n name: Variable,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a Mapping we use a similar approach\nto the one shown in the Variables section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Variable working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{Variable, List};\n\npub struct List {\n values: Mapping,\n index: Variable\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Variable,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/docs/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3c817d4f.360b4190.js b/docs/assets/js/3c817d4f.360b4190.js new file mode 100644 index 000000000..524f7f86a --- /dev/null +++ b/docs/assets/js/3c817d4f.360b4190.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62801],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(r),f=o,d=u["".concat(p,".").concat(f)]||u[f]||m[f]||a;return r?n.createElement(d,i(i({ref:t},l),{},{components:r})):n.createElement(d,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={slug:"odra-cosmwasm",title:"Odra + CosmWasm",authors:["kpob"],image:"https://github.com/odradev.png"},i=void 0,s={permalink:"/blog/odra-cosmwasm",source:"@site/blog/2023-02-15-odra-cosmos.md",title:"Odra + CosmWasm",description:"In November 2022 we released the first version of the Odra Framework. It's time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm.",date:"2023-02-15T00:00:00.000Z",formattedDate:"February 15, 2023",tags:[],readingTime:5.96,hasTruncateMarker:!0,authors:[{name:"Krzysztof Pobiar\u017cyn",title:"Lead Developer",url:"https://github.com/kpob",key:"kpob"}],frontMatter:{slug:"odra-cosmwasm",title:"Odra + CosmWasm",authors:["kpob"],image:"https://github.com/odradev.png"},prevItem:{title:"OpenAI writes ERC20 in Odra",permalink:"/blog/2023-02-27-openai-writes-erc20-in-odra"},nextItem:{title:"EVM at Risc0",permalink:"/blog/evm-at-risc0"}},p={authorsImageUrls:[void 0]},c=[],l={toc:c};function m(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"In November 2022 we released ",(0,o.kt)("a",{parentName:"p",href:"/blog/release-020"},"the first version")," of the Odra Framework. It's time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3cb0761e.2fe3a3df.js b/docs/assets/js/3cb0761e.2fe3a3df.js new file mode 100644 index 000000000..f83dbde95 --- /dev/null +++ b/docs/assets/js/3cb0761e.2fe3a3df.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95108],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(r),m=a,b=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(b,i(i({ref:t},c),{},{components:r})):n.createElement(b,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/docs/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/next/basics/directory-structure",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/next/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/next/basics/odra-toml"}},s={},d=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:"src/",id:"src",level:2},{value:"bin/",id:"bin",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],c={toc:d};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 bin/\n| |\u2500\u2500 build_contract.rs\n| \u2514\u2500\u2500 build_schema.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "1.1.0"\n\n[dev-dependencies]\nodra-test = "1.1.0"\n\n[build-dependencies]\nodra-build = "1.1.0"\n\n[[bin]]\nname = "sample_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "sample_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. For testing purposes, ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-test")," is also\nadded as a dev dependency."),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"bin"},"bin/"),(0,a.kt)("p",null,"This is the folder where scripts that will be used to generate code or schemas live.\nYou don't need to modify those files, they are generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command and\nare used by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra schema")," commands."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3cbbe945.33998820.js b/docs/assets/js/3cbbe945.33998820.js new file mode 100644 index 000000000..3525429a2 --- /dev/null +++ b/docs/assets/js/3cbbe945.33998820.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11961],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="OdraVM",c={unversionedId:"backends/odra-vm",id:"version-0.9.1/backends/odra-vm",title:"OdraVM",description:"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.9.1/backends/02-odra-vm.md",sourceDirName:"backends",slug:"/backends/odra-vm",permalink:"/docs/0.9.1/backends/odra-vm",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.9.1/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.9.1/backends/casper"}},s={},d=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],l={toc:d};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odravm"},"OdraVM"),(0,a.kt)("p",null,"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time -\nsimply use your IDE's debug functionality."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The OdraVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"OdraVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is a list of contracts deployed onto the OdraVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the OdraVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe OdraVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the OdraVM.\nThanks to this and the fact that we do not need the blockchain itself,\nOdraVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the OdraVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Container"),".\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, OdraVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(OdraVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3cdf4a35.cbdd8579.js b/docs/assets/js/3cdf4a35.cbdd8579.js new file mode 100644 index 000000000..a7f10596f --- /dev/null +++ b/docs/assets/js/3cdf4a35.cbdd8579.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63050],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=p;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var u=2;u{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>w});var a=n(87462),r=n(67294),s=n(86010),i=n(12466),o=n(16550),l=n(91980),u=n(67392),c=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,o.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function y(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[i,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[l,u]=h({queryString:n,groupId:a}),[d,y]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=l??d;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{b&&o(b)}),[b]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);o(e),u(e),y(e)}),[u,y,s]),tabValues:s}}var b=n(72389);const g="tabList__CuJ",f="tabItem_LNqP";function _(e){let{className:t,block:n,selectedValue:o,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),p=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==o&&(d(t),l(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:p},i,{className:(0,s.Z)("tabs__item",f,i?.className,{"tabs__item--active":o===t})}),n??t)})))}function k(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=y(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",g)},r.createElement(_,(0,a.Z)({},e,t)),r.createElement(k,(0,a.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},30127:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),i=n(85162);const o={sidebar_position:7},l="Build, Deploy and Read the State of a Contract",u={unversionedId:"tutorials/build-deploy-read",id:"version-1.0.0/tutorials/build-deploy-read",title:"Build, Deploy and Read the State of a Contract",description:"In this guide, we will show the full path from creating a contract, deploying it and reading the state.",source:"@site/versioned_docs/version-1.0.0/tutorials/build-deploy-read.md",sourceDirName:"tutorials",slug:"/tutorials/build-deploy-read",permalink:"/docs/tutorials/build-deploy-read",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7},sidebar:"tutorialSidebar",previous:{title:"Ticketing System",permalink:"/docs/tutorials/nft"},next:{title:"Using Proxy Caller",permalink:"/docs/tutorials/using-proxy-caller"}},c={},d=[{value:"Contract",id:"contract",level:3},{value:"Deploying the contract",id:"deploying-the-contract",level:3},{value:"Storage Layout",id:"storage-layout",level:3},{value:"Reading the state",id:"reading-the-state",level:3}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"build-deploy-and-read-the-state-of-a-contract"},"Build, Deploy and Read the State of a Contract"),(0,r.kt)("p",null,"In this guide, we will show the full path from creating a contract, deploying it and reading the state."),(0,r.kt)("p",null,"We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript."),(0,r.kt)("p",null,"Before you start, make sure you completed the following steps:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Read the ",(0,r.kt)("a",{parentName:"li",href:"../category/getting-started"},"Getting Started")," guide"),(0,r.kt)("li",{parentName:"ul"},"Get familiar with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.casper.network/developers/dapps/setup-nctl/"},"NCTL tutorial")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/make-software/casper-nctl-docker"},"NCTL docker")," image"),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/casper-ecosystem/casper-client-rs"},"casper-client"))),(0,r.kt)("h3",{id:"contract"},"Contract"),(0,r.kt)("p",null,"Let's write a contract with complex storage layout."),(0,r.kt)("p",null,"The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"."),(0,r.kt)("p",null,"We will expose two methods:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The constructor ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," which sets the metadata and the version of the contract."),(0,r.kt)("li",{parentName:"ol"},"The method ",(0,r.kt)("inlineCode",{parentName:"li"},"set_data")," which sets the value of the numeric field and the values of the mapping.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=custom_item.rs showLineNumbers",title:"custom_item.rs",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};\n\n// A custom type with a vector of another custom type\n#[odra::odra_type]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[odra::odra_type]\npub struct Price {\n value: U256,\n}\n\n// The main contract with a version, metadata and a submodule\n#[odra::module]\npub struct CustomItem {\n version: Var,\n meta: Var,\n data: SubModule\n}\n\n#[odra::module]\nimpl CustomItem {\n pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {\n let meta = Metadata {\n name,\n description,\n prices: vec![\n Price { value: price_1 },\n Price { value: price_2 }\n ]\n };\n self.meta.set(meta);\n self.version.set(self.version.get_or_default() + 1);\n }\n\n pub fn set_data(&mut self, value: u32, name: String, name2: String) {\n self.data.value.set(value);\n self.data.inner.named_values.set(&name, 10);\n self.data.inner.named_values.set(&name2, 20);\n }\n}\n\n// A submodule with a numeric value and another submodule\n#[odra::module]\nstruct Data {\n value: Var,\n inner: SubModule,\n}\n\n// A submodule with a mapping\n#[odra::module]\nstruct InnerData {\n named_values: Mapping,\n}\n\n")),(0,r.kt)("h3",{id:"deploying-the-contract"},"Deploying the contract"),(0,r.kt)("p",null,"First, we need to setup the chain. We will use the NCTL docker image to run a local network."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Next, we need to compile the contract to a Wasm file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra build -c custom_item \n")),(0,r.kt)("p",null,"Then, we can deploy the contract using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"casper-client put-deploy \\\n --node-address http://localhost:11101 \\\n --chain-name casper-net-1 \\\n --secret-key path/to/your/secret_key.pem \\ \n --session-path [PATH_TO_WASM] \\\n --payment-amount 100000000000 \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'test_contract_package_hash'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'true'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string='My Name'\" \\\n --session-arg \"description:string='My Description'\" \\ \n --session-arg \"price_1:u256='101'\" \\\n --session-arg \"price_2:u256='202'\"\n")),(0,r.kt)("p",null,"Finally, we can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"set_data")," method to set the values of the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'casper-client put-deploy \\\n --node-address http://localhost:11101 \\ \n --chain-name casper-net-1 \\\n --secret-key ./keys/secret_key.pem \\ \n --payment-amount 2000000000 \\\n --session-hash [DEPLOYED_CONTRACT_HASH] \\\n --session-entry-point "set_data" \\\n --session-arg "value:u32:\'666\'" \\\n --session-arg "name:string=\'alice\'" \\ \n --session-arg "name2:string=\'bob\'"\n')),(0,r.kt)("h3",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"To read the state of the contract, we need to understand the storage layout."),(0,r.kt)("p",null,"The first step is to calculate the index of the keys. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Storage Layout\n\nCustomItem: prefix: 0x0..._0000_0000_0000 0\n version: u32, 0x0..._0000_0000_0001 1\n meta: Metadata, 0x0..._0000_0000_0010 2\n data: Data: prefix: 0x0..._0000_0000_0011 3\n value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1\n inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2\n named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1\n")),(0,r.kt)("p",null,"The actual key is obtained as follows:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Convert the index to a big-endian byte array."),(0,r.kt)("li",{parentName:"ol"},"Concatenate the index with the mapping data."),(0,r.kt)("li",{parentName:"ol"},"Hash the concatenated bytes using blake2b."),(0,r.kt)("li",{parentName:"ol"},"Return the hex representation of the hash (the stored key must be utf-8 encoded).")),(0,r.kt)("p",null,"In more detail, the storage layout is described in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/advanced/storage-layout"},"Storage Layout article"),"."),(0,r.kt)("h3",{id:"reading-the-state"},"Reading the state"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=main.rs showLineNumbers",title:"main.rs",showLineNumbers:!0},'use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};\nuse casper_types::{\n bytesrepr::{FromBytes, ToBytes},\n U256,\n};\n\n// replace with your contract hash\nconst CONTRACT_HASH: &str = "hash-...";\nconst NODE_ADDRESS: &str = "http://localhost:11101/rpc";\nconst RPC_ID: &str = "casper-net-1";\nconst DICTIONARY_NAME: &str = "state";\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\nasync fn read_state_key(key: String) -> Vec {\n let state_root_hash = casper_client::get_state_root_hash(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n None,\n )\n .await\n .unwrap()\n .result\n .state_root_hash\n .unwrap();\n\n // Read the value from the `state` dictionary.\n let result = casper_client::get_dictionary_item(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n state_root_hash,\n DictionaryItemIdentifier::ContractNamedKey {\n key: CONTRACT_HASH.to_string(),\n dictionary_name: DICTIONARY_NAME.to_string(),\n dictionary_item_key: key,\n },\n )\n .await\n .unwrap()\n .result\n .stored_value;\n\n // We expect the value to be a CLValue\n if let StoredValue::CLValue(cl_value) = result {\n // Ignore the first 4 bytes, which are the length of the CLType.\n cl_value.inner_bytes()[4..].to_vec()\n } else {\n vec![]\n }\n}\n\nasync fn metadata() -> Metadata {\n // The key for the metadata is 2, and it has no mapping data\n let key = key(2, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the name and store the remaining bytes\n let (name, bytes) = String::from_bytes(&bytes).unwrap();\n // Read the description and store the remaining bytes\n let (description, bytes) = String::from_bytes(&bytes).unwrap();\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();\n\n let mut prices = vec![];\n // As we know the size of the vector, we can loop over it\n for _ in 0..size {\n // Read the value and store the remaining bytes\n let (value, rem) = U256::from_bytes(&bytes).unwrap();\n bytes = rem;\n prices.push(Price { value });\n }\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n Metadata {\n name,\n description,\n prices\n }\n}\n\nasync fn value() -> u32 {\n // The key for the value is (3 << 4) + 1, and it has no mapping data\n let key = key((3 << 4) + 1, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nasync fn named_value(name: &str) -> u32 {\n // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes\n let mapping_data = name.to_bytes().unwrap();\n let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nfn main() {\n let runtime = tokio::runtime::Runtime::new().unwrap();\n dbg!(runtime.block_on(metadata()));\n dbg!(runtime.block_on(value()));\n dbg!(runtime.block_on(named_value("alice")));\n dbg!(runtime.block_on(named_value("bob")));\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfn key(idx: u32, mapping_data: &[u8]) -> String {\n let mut key = Vec::new();\n key.extend_from_slice(idx.to_be_bytes().as_ref());\n key.extend_from_slice(mapping_data);\n let hashed_key = blake2b(&key);\n\n hex::encode(&hashed_key)\n}\n\nfn blake2b(bytes: &[u8]) -> [u8; 32] {\n let mut result = [0u8; 32];\n let mut hasher = ::new(32)\n .expect("should create hasher");\n let _ = std::io::Write::write(&mut hasher, bytes);\n blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)\n .expect("should copy hash to the result array");\n result\n}\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'cargo run\n[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {\n name: "My Contract",\n description: "My Description",\n prices: [\n Price {\n value: 123,\n },\n Price {\n value: 321,\n },\n ],\n}\n[src/main.rs:117:5] runtime.block_on(value()) = 666\n[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20\n[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10\n'))),(0,r.kt)(i.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'\nimport { blake2bHex } from "blakejs";\nimport {\n CLList,\n CLListBytesParser,\n CLStringBytesParser,\n CLU256BytesParser,\n CLU32BytesParser,\n CLU8,\n CLValueBuilder,\n CasperClient,\n CasperServiceByJsonRPC,\n Contracts,\n ToBytes,\n} from "casper-js-sdk";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\n// replace with your contract hash\nconst CONTRACT_HASH = "hash-...";\nconst STATE_DICTIONARY_NAME = "state";\nconst U32_SIZE = 4;\n\nclass Price {\n value: bigint;\n\n constructor(value: bigint) {\n this.value = value;\n }\n}\n\nclass Metadata {\n name: string;\n description: string;\n prices: Price[];\n\n constructor(name: string, description: string, prices: Price[]) {\n this.name = name;\n this.description = description;\n this.prices = prices;\n }\n}\n\nexport class Contract {\n client: CasperClient;\n service: CasperServiceByJsonRPC;\n contract: Contracts.Contract;\n\n private constructor() {\n this.client = new CasperClient(LOCAL_NODE_URL);\n this.service = new CasperServiceByJsonRPC(LOCAL_NODE_URL);\n this.contract = new Contracts.Contract(this.client);\n this.contract.setContractHash(CONTRACT_HASH);\n }\n\n static async load() {\n return new Contract();\n }\n\n async read_state(key: string) {\n const response = await this.contract.queryContractDictionary(STATE_DICTIONARY_NAME, key);\n let data: CLList = CLValueBuilder.list(response.value());\n let bytes = new CLListBytesParser().toBytes(data).unwrap();\n // Ignore the first 4 bytes, which are the length of the CLType\n return bytes.slice(4);\n }\n\n async metadata() {\n // The key for the metadata is 2, and it has no mapping data\n let bytes: Uint8Array = await this.read_state(key(2));\n\n // Read the name and store the remaining bytes\n let name = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = name.remainder as Uint8Array;\n\n // Read the description and store the remaining bytes\n let description = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = description.remainder as Uint8Array;\n\n let prices: Price[] = [];\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let size = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n bytes = size.remainder as Uint8Array;\n\n // As we know the size of the vector, we can loop over it\n for (let i = 0; i < size.result.unwrap().data.toNumber(); i++) {\n let price = new CLU256BytesParser().fromBytesWithRemainder(bytes);\n bytes = price.remainder as Uint8Array;\n prices.push(new Price(price.result.unwrap().data.toBigInt()));\n }\n\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n return new Metadata(\n name.result.unwrap().data,\n description.result.unwrap().data,\n prices\n );\n }\n \n async value() {\n // The key for the value is (3 << 4) + 1, and it has no mapping data\n const bytes = await this.read_state(key((3 << 4) + 1));\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n\n async named_value(name: string) {\n // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes\n let mapping_data = new CLStringBytesParser()\n .toBytes(CLValueBuilder.string(name))\n .unwrap();\n let bytes: Uint8Array = await this.read_state(\n key((((3 << 4) + 2) << 4) + 1, mapping_data)\n );\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfunction key(idx: number, mapping_data: Uint8Array = new Uint8Array([])) {\n let key = new Uint8Array(U32_SIZE + mapping_data.length);\n new DataView(key.buffer).setUint32(0, idx, false); // false for big-endian\n key.set(mapping_data, U32_SIZE);\n\n return blake2bHex(key, undefined, 32);\n}\n\nconst contract = Contract.load();\ncontract.then(async (c) => {\n console.log(await c.value());\n console.log(await c.metadata());\n console.log(await c.named_value("alice"));\n console.log(await c.named_value("bob"));\n});\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \nMetadata {\n name: 'My Contract',\n description: 'My Description',\n prices: [ Price { value: 123n }, Price { value: 321n } ]\n}\n666n\n20n\n10n\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3ce92bbb.dc5e4bfc.js b/docs/assets/js/3ce92bbb.dc5e4bfc.js new file mode 100644 index 000000000..b09944e89 --- /dev/null +++ b/docs/assets/js/3ce92bbb.dc5e4bfc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[36323],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),f=a,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||o;return n?r.createElement(m,s(s({ref:t},d),{},{components:n})):r.createElement(m,s({ref:t},d))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:13,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.9.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.9.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.9.0/basics/native-token",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:13,frontMatter:{sidebar_position:13,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.9.0/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.9.0/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"native-token"},"Native token"),(0,a.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::prelude::*;\nuse odra::{casper_types::U512, module::Module};\n\n#[odra::module]\npub struct PublicWallet;\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {}\n\n pub fn withdraw(&mut self, amount: &U512) {\n self.env().transfer_tokens(&self.env().caller(), amount);\n }\n}\n")),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,a.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,a.kt)("inlineCode",{parentName:"p"},"examples/src/contracts/tlw.rs")," in the odra main repository.")),(0,a.kt)("p",null,"You can see a new attribute used here: ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv::transfer_tokens()"),".\nIt does exactly what you are expecting it to do - it transfers native tokens from the contract to the\nspecified address."),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a function -\n",(0,a.kt)("inlineCode",{parentName:"p"},"balance_of"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"#[cfg(test)]\nmod tests {\n use super::PublicWalletHostRef;\n use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);\n assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());\n\n my_contract.with_tokens(U512::from(100)).deposit();\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));\n\n my_contract.withdraw(U512::from(25));\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3e0ea7e3.f809c5a5.js b/docs/assets/js/3e0ea7e3.f809c5a5.js new file mode 100644 index 000000000..6e9a998de --- /dev/null +++ b/docs/assets/js/3e0ea7e3.f809c5a5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[58406],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,g=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return t?a.createElement(g,i(i({ref:n},p),{},{components:t})):a.createElement(g,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const o={},i="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.8.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.8.0/advanced/02-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.8.0/advanced/advanced-storage",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1711379330,formattedLastUpdatedAt:"Mar 25, 2024",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.8.0/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.8.0/advanced/attributes"}},c={},l=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:l};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Var"),": A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + OdraType\n{\n value: Var\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is a key-value storage system where the key is associated with a value.\nIn previous examples, the value of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," typically comprised a standard serializable type (such as number, string, or bool) or a custom type derived from ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::OdraType"),"."),(0,r.kt)("p",null,"However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{casper_types::U256, Mapping, UnwrapOrRevert};\nuse odra::prelude::*;\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct Mappings {\n strings: Mapping<(String, u32, String), String>,\n tokens: Mapping\n}\n\n#[odra::module]\nimpl Mappings {\n\n ...\n\n pub fn total_supply(&mut self, token_name: String) -> U256 {\n self.tokens.module(&token_name).total_supply()\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let opt_string = self.strings.get(&(key1, key2, key3));\n opt_string.unwrap_or_revert(&self.env())\n }\n}\n")),(0,r.kt)("p",null,"As you can see, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," key can consist of a tuple of values, not limited to a single value."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra modules differs from accessing regular values such as strings or numbers."),(0,r.kt)("p",{parentName:"admonition"},"Firstly, within a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you don't encapsulate the module with ",(0,r.kt)("inlineCode",{parentName:"p"},"Submodule"),"."),(0,r.kt)("p",{parentName:"admonition"},"Secondly, rather than utilizing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::module()"),", which returns ",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule")," and sets the appropriate namespace for nested modules.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, casper_types::U512, Sequence, Mapping};\nuse odra::prelude::*;\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n counter: Sequence,\n tokens: Mapping<(String, String), Token>,\n}\n\nimpl AdvancedStorage {\n pub fn current_value(&self) -> u32 {\n self.counter.get_current_value()\n }\n\n pub fn increment_and_get(&mut self) -> u32 {\n self.counter.next_value()\n }\n\n pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {\n let token = self.tokens.module(&(token_name, creator));\n token.balance_of(&address)\n }\n\n pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {\n let mut token = self.tokens.module(&(token_name, creator));\n token.mint(amount, to);\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra offers a Sequence module, enabling contracts to store and increment a single value."),(0,r.kt)("li",{parentName:"ol"},"Mappings support composite keys expressed as tuples and can store modules as values.")),(0,r.kt)("p",null,"Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3e663e98.6b0cdb10.js b/docs/assets/js/3e663e98.6b0cdb10.js new file mode 100644 index 000000000..b2057e7cd --- /dev/null +++ b/docs/assets/js/3e663e98.6b0cdb10.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29831],{3905:(t,e,n)=>{n.d(e,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function s(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var l=a.createContext({}),c=function(t){var e=a.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},p=function(t){var e=c(t.components);return a.createElement(l.Provider,{value:e},t.children)},d={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,l=t.parentName,p=i(t,["components","mdxType","originalType","parentName"]),u=c(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?a.createElement(h,s(s({ref:e},p),{},{components:n})):a.createElement(h,s({ref:e},p))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in e)hasOwnProperty.call(e,l)&&(i[l]=e[l]);i.originalType=t,i.mdxType="string"==typeof t?t:r,s[1]=i;for(var c=2;c{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.9.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.9.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.9.0/basics/testing",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.9.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.9.0/basics/errors"}},l={},c=[{value:"HostEnv",id:"hostenv",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(t){let{components:e,...n}=t;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{List, Var};\n\n#[cfg(test)]\nmod tests {\n use super::{DogContract3HostRef, DogContract3InitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn init_test() {\n let test_env = odra_test::env();\n let init_args = DogContract3InitArgs {\n name: "DogContract".to_string()\n };\n let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,r.kt)("p",null,"The first interesting thing you may notice is placed the import section."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use super::{DogContract3HostRef, DogContract3InitArgs};\nuse odra::{host::Deployer, prelude::*};\n")),(0,r.kt)("p",null,"We are using ",(0,r.kt)("inlineCode",{parentName:"p"},"super")," to import the ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," from the parent module.\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}InitArgs")," are types that was generated for us by Odra."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," is a reference to the contract that we can use to interact with it (call entrypoints)\nand implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.HostRef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostRef"))," trait. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," is a struct that we use to initialize the contract and implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.InitArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait.\nConsidering the contract initialization, there three possible scenarios:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with arguments, then Odra creates a struct named ",(0,r.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with no arguments, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract does not have a constructor, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),".\nAll of those structs implement the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::InitArgs")," trait, required to conform to the\n",(0,r.kt)("inlineCode",{parentName:"li"},"Deployer::deploy")," method signature. ")),(0,r.kt)("p",null,"The other import is ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::host::Deployer"),". This is a trait is used to deploy the contract and give us a reference to it."),(0,r.kt)("p",null,"Let's take a look at the test itself. How to obtain a reference to the contract?\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," implements the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.Deployer.html"},(0,r.kt)("inlineCode",{parentName:"a"},"Deployer"))," trait, which provides the ",(0,r.kt)("inlineCode",{parentName:"p"},"deploy")," method:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n")),(0,r.kt)("p",null,"From now on, we can use ",(0,r.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute are available to us:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,r.kt)("h2",{id:"hostenv"},"HostEnv"),(0,r.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};\n use odra::{host::{Deployer, HostEnv}, prelude::*};\n\n #[test]\n fn env() {\n let test_env: HostEnv = odra_test::env();\n test_env.set_caller(test_env.get_account(0));\n let init_args = TestingContractInitArgs {\n name: "MyContract".to_string()\n };\n let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);\n let creator = testing_contract.created_by();\n test_env.set_caller(test_env.get_account(1));\n let init_args = TestingContractInitArgs {\n name: "MyContract2".to_string()\n };\n let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);\n let creator2 = testing_contract2.created_by();\n assert_ne!(creator, creator2);\n }\n}\n')),(0,r.kt)("p",null,"In the code above, at the beginning of the test, we are obtaining a ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," instance using ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_test::env()"),".\nNext, we are deploying two instances of the same contract, but we're using ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::ContractEnv::caller()"),"\nthe function we are calling inside the contract."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a set of functions that will let you write better tests:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn set_caller(&self, address: Address)")," - you've seen it in action just now"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn balance_of(&self, address: &Address) -> U512")," - returns the balance of the account associated with the given address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn advance_block_time(&self, time_diff: u64)")," - increases the current value of ",(0,r.kt)("inlineCode",{parentName:"li"},"block_time")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn get_account(&self, n: usize) -> Address")," - returns an n-th address that was prepared for you by Odra in advance;\nby default, you start with the 0-th account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn emitted_event(&self, contract_address: &Address, event: &T) -> bool")," - verifies if the event was emitted by the contract")),(0,r.kt)("p",null,"Full list of functions can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/struct.HostEnv.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We take a look at how Odra handles errors!"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3e885f31.1bfb0a3a.js b/docs/assets/js/3e885f31.1bfb0a3a.js new file mode 100644 index 000000000..c2a44ddab --- /dev/null +++ b/docs/assets/js/3e885f31.1bfb0a3a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[50568],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.9.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.9.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.9.0/basics/events",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.9.0/basics/errors"},next:{title:"Casper Contract Schema",permalink:"/docs/0.9.0/basics/casper-contract-schema"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract;\n\n#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64\n}\n\n#[odra::module]\nimpl PartyContract {\n pub fn init(&self) {\n self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n });\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64,\n}\n")),(0,a.kt)("p",null,"To emit an event, we use the ",(0,a.kt)("inlineCode",{parentName:"p"},"emit_event")," function from the ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),", passing the event as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n});\n")),(0,a.kt)("p",null,"To determine all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The registered events will also be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a few functions which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},'use super::{PartyContractHostRef, PartyStarted};\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\n#[test]\nfn test_party() {\n let test_env: HostEnv = odra_test::env();\n let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);\n test_env.emitted_event(\n party_contract.address(),\n &PartyStarted {\n caller: test_env.get_account(0),\n block_time: 0\n }\n );\n // If you do not want to check the exact event, you can use `emitted` function\n test_env.emitted(party_contract.address(), "PartyStarted");\n // You can also check how many events were emitted.\n assert_eq!(test_env.events_count(party_contract.address()), 1);\n}\n')),(0,a.kt)("p",null,"To explore more event testing functions, check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3e9ef03c.f1c84d37.js b/docs/assets/js/3e9ef03c.f1c84d37.js new file mode 100644 index 000000000..6850da4cb --- /dev/null +++ b/docs/assets/js/3e9ef03c.f1c84d37.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[32717],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,m=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.2.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.2.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.2.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Backends",permalink:"/docs/0.2.0/category/backends"},next:{title:"MockVM",permalink:"/docs/0.2.0/backends/mock-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Test Env",id:"test-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/backends/mock-vm"},"MockVM"),",\nor a complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/backends/casper"},"CasperVM"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3ec01721.3d462533.js b/docs/assets/js/3ec01721.3d462533.js new file mode 100644 index 000000000..c534c7147 --- /dev/null +++ b/docs/assets/js/3ec01721.3d462533.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[54938],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:12,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-1.0.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-1.0.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/basics/modules",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to the ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),' attribute. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\nuse odra::module::SubModule;\nuse odra::prelude::*;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: SubModule\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("admonition",{type:"important"},(0,o.kt)("p",{parentName:"admonition"},"To use a module as a component of another module, you need to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"SubModule")," type. This is a special type\nthat crates a keyspace (read more in ",(0,o.kt)("a",{parentName:"p",href:"/docs/advanced/storage-layout"},"Storage Layout"),") and provide access to its public methods.")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the ",(0,o.kt)("inlineCode",{parentName:"p"},"MathEngine")," - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/examples/src/contracts/owned_token.rs"},"OwnedToken example")," in the main Odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"#[cfg(test)]\nmod tests {\n use super::ModulesContractHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);\n assert_eq!(modules_contract.add_using_module(), 8);\n }\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3edee900.6fc3a2e1.js b/docs/assets/js/3edee900.6fc3a2e1.js new file mode 100644 index 000000000..576813f4c --- /dev/null +++ b/docs/assets/js/3edee900.6fc3a2e1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[56010],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||s;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.3.1/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.3.1/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.3.1/basics/storage-interaction",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.3.1/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.3.1/basics/communicating-with-host"}},l={},p=[{value:"Variable",id:"variable",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"variable"},"Variable"),(0,r.kt)("p",null,"The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Variable,\n weight: Variable,\n name: Variable,\n walks: Variable>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"use odra::Variable;\n\n#[odra::module]\nimpl DogContract {\n #[odra(init)]\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A Variable is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses Mapping to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"use odra::{Mapping, Variable};\n\n#[odra::module]\npub struct DogContract2 {\n name: Variable,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a Mapping we use a similar approach\nto the one shown in the Variables section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Variable working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{Variable, List};\n\npub struct List {\n values: Mapping,\n index: Variable\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Variable,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/docs/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3eed3f1a.756bd337.js b/docs/assets/js/3eed3f1a.756bd337.js new file mode 100644 index 000000000..d4b896252 --- /dev/null +++ b/docs/assets/js/3eed3f1a.756bd337.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73362],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(h,s(s({ref:t},d),{},{components:n})):r.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.7.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.7.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.7.0/basics/testing",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.7.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.7.0/basics/errors"}},l={},c=[{value:"Test env",id:"test-env",level:2},{value:"Deployer",id:"deployer",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{Variable, List};\n\n#[cfg(test)]\nmod tests {\n use super::DogContract3Deployer;\n\n #[test]\n fn init_test() {\n let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(module)]")," macro created a Deployer code for us, which will deploy the contract on the\nVM:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n')),(0,a.kt)("p",null,"From now on, we can use ",(0,a.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with a macro are available to us:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,a.kt)("h2",{id:"test-env"},"Test env"),(0,a.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use super::TestingContractDeployer;\n\n #[test]\n fn test_env() {\n let testing_contract = TestingContractDeployer::init("MyContract".to_string());\n let creator = testing_contract.created_by();\n odra::test_env::set_caller(odra::test_env::get_account(1));\n let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());\n let creator2 = testing_contract2.created_by();\n assert!(creator != creator2);\n }\n}\n')),(0,a.kt)("p",null,"In the code above, we are deploying two instances of the same contract, but we're using ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::test_env::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::contract_env::caller()"),"\nthe function we are calling inside the contract."),(0,a.kt)("p",null,"Each test env comes with a set of functions that will let you write better tests:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_caller(address: Address)")," - you've seen it in action just now"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn token_balance(address: Address) -> Balance")," - it returns the balance of the account associated with the given address"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn advance_block_time_by(seconds: BlockTime)")," - it increases the current value of block_time"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_account(n: usize) -> Address")," - it returns an nth address that was prepared for you by Odra in advance;\nby default, you start with the 0th account"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn assert_exception(err: E, block: F)")," - it executes the ",(0,a.kt)("inlineCode",{parentName:"li"},"block")," code and expects ",(0,a.kt)("inlineCode",{parentName:"li"},"err")," to happen"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_event(address: Address, index: i32) -> Result")," - returns\nthe event emitted by the contract")),(0,a.kt)("p",null,"Again, we'll see those used in the next articles."),(0,a.kt)("h2",{id:"deployer"},"Deployer"),(0,a.kt)("p",null,"You may be wondering what is the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractDeployer")," and where did it come from.\nIt is a piece of code generated automatically for you, thanks to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nIf you used the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," on one of the methods, it will be the constructor of your contract.\nOdra will make sure that it is called only once, so you can use it to initialize your data structures etc."),(0,a.kt)("p",null,"If you do not provide the init method, you can deploy the contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"::default()")," method.\nIn the end, you will get a ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," instance (in our case the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractRef"),") which reimplements all\nthe methods you defined in the contract, but executes them on a blockchain!"),(0,a.kt)("p",null,"To learn more about the ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," contract, visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/cross-calls"},"Cross calls")," article."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We take a look at how Odra handles errors!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/3f00e816.4afdd87b.js b/docs/assets/js/3f00e816.4afdd87b.js new file mode 100644 index 000000000..657c24d20 --- /dev/null +++ b/docs/assets/js/3f00e816.4afdd87b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53227],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),d=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=o,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||a;return t?r.createElement(f,l(l({ref:n},u),{},{components:t})):r.createElement(f,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>d});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.6.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.6.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.6.0/tutorials/owned-token",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.6.0/tutorials/erc20"}},s={},d=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],u={toc:d};function c(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow minting tokens but only the module owner."),(0,o.kt)("li",{parentName:"ol"},"The current owner should be able to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use odra::types::{Address, Balance}\n\n...\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.ownable.ensure_ownership(&contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L11")," - A constructor is a great place to init both modules at once. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L14-L16")," - Most of the entrypoints do not need any modification, so we simply delegates them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L52")," - The same we do with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L58-L61")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/40692c03.21673b4f.js b/docs/assets/js/40692c03.21673b4f.js new file mode 100644 index 000000000..74974b637 --- /dev/null +++ b/docs/assets/js/40692c03.21673b4f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[86116],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:12,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-0.9.1/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.9.1/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.9.1/basics/modules",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.9.1/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.9.1/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to the ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),' attribute. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\nuse odra::module::SubModule;\nuse odra::prelude::*;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: SubModule\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("admonition",{type:"important"},(0,o.kt)("p",{parentName:"admonition"},"To use a module as a component of another module, you need to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"SubModule")," type. This is a special type\nthat crates a keyspace (read more in ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.1/advanced/storage-layout"},"Storage Layout"),") and provide access to its public methods.")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the ",(0,o.kt)("inlineCode",{parentName:"p"},"MathEngine")," - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/examples/src/contracts/owned_token.rs"},"OwnedToken example")," in the main Odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"#[cfg(test)]\nmod tests {\n use super::ModulesContractHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);\n assert_eq!(modules_contract.add_using_module(), 8);\n }\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/40b2cc78.3e3097c4.js b/docs/assets/js/40b2cc78.3e3097c4.js new file mode 100644 index 000000000..a050ac17c --- /dev/null +++ b/docs/assets/js/40b2cc78.3e3097c4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99706],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return a?n.createElement(g,l(l({ref:t},c),{},{components:a})):n.createElement(g,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.9.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.9.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.9.0/getting-started/installation",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.9.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.9.0/getting-started/flipper"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-unknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --locked\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,r.kt)("p",null,"This will create a new folder called ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," and initialize Odra there. Cargo Odra\nwill create a sample contract for you in ",(0,r.kt)("inlineCode",{parentName:"p"},"src")," directory. You can run the tests of this contract\nby executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/41445f6c.a2ba707a.js b/docs/assets/js/41445f6c.a2ba707a.js new file mode 100644 index 000000000..1aff09f63 --- /dev/null +++ b/docs/assets/js/41445f6c.a2ba707a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[78784],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.6.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.6.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.6.0/basics/cross-calls",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.6.0/basics/events"},next:{title:"Modules",permalink:"/docs/0.6.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::Variable;\nuse odra::types::{Address};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Variable
,\n}\n\n#[odra::module]\nimpl CrossContract {\n #[odra(init)]\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap();\n MathEngineRef::at(math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine {\n}\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To call the external contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineRef::at(math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/testing"},"Testing")," article.\nIt is a reference to already deployed - running contract.\nHere we are going to take a deeper look at it."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," is generated automatically, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nTo get an instance of a reference, we can either deploy a contract (using ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),") or by building it\ndirectly, using ",(0,r.kt)("inlineCode",{parentName:"p"},"::at(address: Address)")," method, as shown above.\nThe reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), alongside couple methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"at(Address) -> Self")," - points the reference to an Address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"address() -> Address")," - returns the Address the reference is currently pointing at"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"with_tokens(Amount) -> Self")," - attaches Amount of native tokens to the next call")),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderRef")," struct (but do not create the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderDeployer"),"). Having an address we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"AdderRef::at(address).add(3, 5)\n")),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use super::{CrossContractDeployer, MathEngineDeployer};\n\n#[test]\nfn test_cross_calls() {\n let math_engine_contract = MathEngineDeployer::default();\n let cross_contract = CrossContractDeployer::init(math_engine_contract.address());\n\n assert_eq!(cross_contract.add_using_another(), 8);\n}\n")),(0,r.kt)("p",null,"Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function we want to use."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use odra::types::Address;\n use crate::features::cross_calls::{Adder, AdderRef};\n \n #[test]\n fn test_ext() {\n let adder = AdderRef::at(get_adder_address());\n\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address() -> Address {\n let contract = MathEngineDeployer::default();\n contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/419e5fad.11f62120.js b/docs/assets/js/419e5fad.11f62120.js new file mode 100644 index 000000000..b43833abe --- /dev/null +++ b/docs/assets/js/419e5fad.11f62120.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41220],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=a.createContext({}),u=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=u(t),m=r,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||i;return t?a.createElement(f,o(o({ref:n},d),{},{components:t})):a.createElement(f,o({ref:n},d))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=p;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var u=2;u{t.d(n,{Z:()=>o});var a=t(67294),r=t(86010);const i="tabItem_Ymn6";function o(e){let{children:n,hidden:t,className:o}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(i,o),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>x});var a=t(87462),r=t(67294),i=t(86010),o=t(12466),s=t(16550),l=t(91980),u=t(67392),d=t(50012);function c(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:a,default:r}}=e;return{value:n,label:t,attributes:a,default:r}}))}function p(e){const{values:n,children:t}=e;return(0,r.useMemo)((()=>{const e=n??c(t);return function(e){const n=(0,u.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const a=(0,s.k6)(),i=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l._X)(i),(0,r.useCallback)((e=>{if(!i)return;const n=new URLSearchParams(a.location.search);n.set(i,e),a.replace({...a.location,search:n.toString()})}),[i,a])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:a}=e,i=p(e),[o,s]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const a=t.find((e=>e.default))??t[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:n,tabValues:i}))),[l,u]=f({queryString:t,groupId:a}),[c,h]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[a,i]=(0,d.Nk)(t);return[a,(0,r.useCallback)((e=>{t&&i.set(e)}),[t,i])]}({groupId:a}),b=(()=>{const e=l??c;return m({value:e,tabValues:i})?e:null})();(0,r.useLayoutEffect)((()=>{b&&s(b)}),[b]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:i}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),h(e)}),[u,h,i]),tabValues:i}}var b=t(72389);const y="tabList__CuJ",g="tabItem_LNqP";function v(e){let{className:n,block:t,selectedValue:s,selectValue:l,tabValues:u}=e;const d=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.o5)(),p=e=>{const n=e.currentTarget,t=d.indexOf(n),a=u[t].value;a!==s&&(c(n),l(a))},m=e=>{let n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;n=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;n=d[t]??d[d.length-1];break}}n?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,i.Z)("tabs",{"tabs--block":t},n)},u.map((e=>{let{value:n,label:t,attributes:o}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,key:n,ref:e=>d.push(e),onKeyDown:m,onClick:p},o,{className:(0,i.Z)("tabs__item",g,o?.className,{"tabs__item--active":s===n})}),t??n)})))}function k(e){let{lazy:n,children:t,selectedValue:a}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==a}))))}function w(e){const n=h(e);return r.createElement("div",{className:(0,i.Z)("tabs-container",y)},r.createElement(v,(0,a.Z)({},e,n)),r.createElement(k,(0,a.Z)({},e,n)))}function x(e){const n=(0,b.Z)();return r.createElement(w,(0,a.Z)({key:String(n)},e))}},7447:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>c});var a=t(87462),r=(t(67294),t(3905)),i=t(74866),o=t(85162);const s={sidebar_position:9,slug:"odra-solidity",image:"/img/odra-sol.png",description:"Odra for Solidity developers"},l="Odra for Solidity developers",u={unversionedId:"tutorials/odra-sol",id:"version-1.0.0/tutorials/odra-sol",title:"Odra for Solidity developers",description:"Odra for Solidity developers",source:"@site/versioned_docs/version-1.0.0/tutorials/odra-sol.md",sourceDirName:"tutorials",slug:"/tutorials/odra-solidity",permalink:"/docs/tutorials/odra-solidity",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1718109783,formattedLastUpdatedAt:"Jun 11, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,slug:"odra-solidity",image:"/img/odra-sol.png",description:"Odra for Solidity developers"},sidebar:"tutorialSidebar",previous:{title:"CEP-18",permalink:"/docs/tutorials/cep18"},next:{title:"Deploying a Token on Casper Livenet",permalink:"/docs/tutorials/deploying-on-casper"}},d={},c=[{value:"Introduction",id:"introduction",level:2},{value:"Prerequisites",id:"prerequisites",level:2},{value:"Hello World",id:"hello-world",level:2},{value:"Variable Storage and State Management",id:"variable-storage-and-state-management",level:2},{value:"Data Types",id:"data-types",level:3},{value:"Constants and Immutability",id:"constants-and-immutability",level:3},{value:"Variables",id:"variables",level:3},{value:"Arrays and Mappings",id:"arrays-and-mappings",level:3},{value:"Custom types",id:"custom-types",level:3},{value:"Data Location",id:"data-location",level:3},{value:"Functions",id:"functions",level:2},{value:"View and Pure",id:"view-and-pure",level:3},{value:"Modifiers",id:"modifiers",level:3},{value:"Visibility",id:"visibility",level:3},{value:"Payable",id:"payable",level:3},{value:"Selectors",id:"selectors",level:3},{value:"Events and Logging",id:"events-and-logging",level:2},{value:"Error Handling",id:"error-handling",level:2},{value:"Composition vs. Inheritance",id:"composition-vs-inheritance",level:2},{value:"Libraries and Utility",id:"libraries-and-utility",level:2},{value:"Fallback and Receive Functions",id:"fallback-and-receive-functions",level:2},{value:"Miscellaneous",id:"miscellaneous",level:2},{value:"Hashing",id:"hashing",level:3},{value:"Try-catch",id:"try-catch",level:3},{value:"Conclusion",id:"conclusion",level:2}],p={toc:c};function m(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"odra-for-solidity-developers"},"Odra for Solidity developers"),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To follow this guide, you should have:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Knowledge of Solidity."),(0,r.kt)("li",{parentName:"ul"},"Familiarity with Ethereum and smart contract concepts."),(0,r.kt)("li",{parentName:"ul"},"Basic understanding of Rust, as Odra is based on it.")),(0,r.kt)("h2",{id:"hello-world"},"Hello World"),(0,r.kt)("p",null,'Let\'s start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message.'),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, Var};\n\n#[odra::module]\npub struct HelloWorld {\n greet: Var,\n}\n\n#[odra::module]\nimpl HelloWorld {\n pub fn init(&mut self, message: String) {\n self.greet.set(message);\n }\n\n pub fn get(&self) -> String {\n self.greet.get_or_default()\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract HelloWorld {\n string public greet = "Hello World!";\n}\n')))),(0,r.kt)("p",null,"As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the ",(0,r.kt)("inlineCode",{parentName:"p"},"HelloWorld")," struct has a single state variable greet, which stores the greeting message. The module contains two functions: ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the greeting message and get to retrieve it.\nTwo key differences are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra does not generate getters for public state variables automatically, so you need to define them explicitly."),(0,r.kt)("li",{parentName:"ol"},"To initialize values, you must do it in the ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function, which is the contract constructor. You can't assign defaults outside the constructor.")),(0,r.kt)("h2",{id:"variable-storage-and-state-management"},"Variable Storage and State Management"),(0,r.kt)("h3",{id:"data-types"},"Data Types"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use core::str::FromStr;\nuse odra::{\n casper_types::{bytesrepr::Bytes, U256},\n module::Module,\n prelude::*,\n Address, UnwrapOrRevert, Var,\n};\n\n#[odra::module]\npub struct Primitives {\n boo: Var,\n u: Var, // u8 is the smallest unsigned integer type\n u2: Var, // U256 is the biggest unsigned integer type\n i: Var, // i32 is the smallest signed integer type\n i2: Var, // i64 is the biggest signed integer type\n address: Var
,\n bytes: Var,\n default_boo: Var,\n default_uint: Var,\n default_int: Var,\n default_addr: Var
,\n}\n\n#[odra::module]\nimpl Primitives {\n pub fn init(&mut self) {\n self.boo.set(true);\n self.u.set(1);\n self.u2.set(U256::from(456));\n self.i.set(-1);\n self.i2.set(456);\n self.address.set(\n Address::from_str(\n "hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb",\n )\n .unwrap_or_revert(&self.env()),\n );\n self.bytes.set(Bytes::from(vec![0xb5]));\n\n let _min_int = U256::zero();\n let _max_int = U256::MAX;\n }\n\n // For the types that have default values, we can use the get_or_default method\n pub fn get_default_boo(&self) -> bool {\n self.default_boo.get_or_default()\n }\n\n pub fn get_default_uint(&self) -> U256 {\n self.default_uint.get_or_default()\n }\n\n pub fn get_default_int(&self) -> i64 {\n self.default_int.get_or_default()\n }\n\n // Does not compile - Address does not have the default value\n pub fn get_default_addr(&self) -> Address {\n self.default_addr.get_or_default()\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/primitives/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/primitives/"'},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Primitives {\n bool public boo = true;\n\n uint8 public u8 = 1;\n uint256 public u256 = 456;\n\n int8 public i8 = -1;\n int256 public i256 = 456;\n\n int256 public minInt = type(int256).min;\n int256 public maxInt = type(int256).max;\n\n address public addr = 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c;\n bytes1 a = 0xb5; // [10110101]\n\n // Default values\n // Unassigned variables have a default value\n bool public defaultBoo; // false\n uint256 public defaultUint; // 0\n int256 public defaultInt; // 0\n address public defaultAddr; // 0x0000000000000000000000000000000000000000\n}\n")))),(0,r.kt)("p",null,"The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"u32"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"u64"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"U128"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," for unsigned integers, and ",(0,r.kt)("inlineCode",{parentName:"p"},"i32")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"i64")," for signed integers."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," type; the workaround is to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Option
"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," type is used to store byte arrays."),(0,r.kt)("p",null,"Values are stored in units called ",(0,r.kt)("inlineCode",{parentName:"p"},"Named Keys")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Dictionaries"),". Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point."),(0,r.kt)("h3",{id:"constants-and-immutability"},"Constants and Immutability"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::{account::AccountHash, U256}, Address};\n\n#[odra::module]\npub struct Constants;\n\n#[odra::module]\nimpl Constants {\n pub const MY_UINT: U256 = U256([123, 0, 0, 0]);\n pub const MY_ADDRESS: Address = Address::Account(\n AccountHash([0u8; 32])\n );\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/constants/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/constants/"'},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Constants {\n // coding convention to uppercase constant variables\n address public constant MY_ADDRESS =\n 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc;\n uint256 public constant MY_UINT = 123;\n}\n")))),(0,r.kt)("p",null,"In Odra, you can define constants using the ",(0,r.kt)("inlineCode",{parentName:"p"},"const")," keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the ",(0,r.kt)("inlineCode",{parentName:"p"},"immutable")," keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's ",(0,r.kt)("inlineCode",{parentName:"p"},"immutable")," keyword."),(0,r.kt)("h3",{id:"variables"},"Variables"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::{casper_types::U256, prelude::*, Var};\n\n#[odra::module]\npub struct Variables {\n text: Var,\n my_uint: Var,\n}\n\n#[odra::module]\nimpl Variables {\n pub fn init(&mut self) {\n self.text.set("Hello".to_string());\n self.my_uint.set(U256::from(123));\n }\n\n pub fn do_something(&self) {\n // Local variables\n let i = 456;\n // Env variables\n let timestamp = self.env().get_block_time();\n let sender = self.env().caller();\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/variables/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/variables/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Variables {\n // State variables are stored on the blockchain.\n string public text = "Hello";\n uint256 public num = 123;\n\n function doSomething() public {\n // Local variables are not saved to the blockchain.\n uint256 i = 456;\n\n // Here are some global variables\n uint256 timestamp = block.timestamp; // Current block timestamp\n address sender = msg.sender; // address of the caller\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractEnv")," retrieved using the ",(0,r.kt)("inlineCode",{parentName:"p"},"env()")," function."),(0,r.kt)("h3",{id:"arrays-and-mappings"},"Arrays and Mappings"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::U256, Address, Mapping};\n\n#[odra::module]\npub struct MappingContract {\n my_map: Mapping> \n}\n\n#[odra::module]\nimpl MappingContract {\n pub fn get(&self, addr: Address) -> U256 {\n // self.my_map.get(&addr) would return Option>\n // so we use get_or_default instead and unwrap the inner Option\n self.my_map.get_or_default(&addr).unwrap_or_default()\n }\n\n pub fn set(&mut self, addr: Address, i: U256) {\n self.my_map.set(&addr, Some(i));\n }\n\n pub fn remove(&mut self, addr: Address) {\n self.my_map.set(&addr, None);\n }\n}\n\n#[odra::module]\npub struct NestedMapping {\n my_map: Mapping<(Address, U256), Option> \n}\n\n#[odra::module]\nimpl NestedMapping {\n pub fn get(&self, addr: Address, i: U256) -> bool {\n self.my_map.get_or_default(&(addr, i)).unwrap_or_default()\n }\n\n pub fn set(&mut self, addr: Address, i: U256, boo: bool) {\n self.my_map.set(&(addr, i), Some(boo));\n }\n\n pub fn remove(&mut self, addr: Address, i: U256) {\n self.my_map.set(&(addr, i), None);\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Mapping {\n mapping(address => uint256) public myMap;\n\n function get(address _addr) public view returns (uint256) {\n return myMap[_addr];\n }\n\n function set(address _addr, uint256 _i) public {\n myMap[_addr] = _i;\n }\n\n function remove(address _addr) public {\n delete myMap[_addr];\n }\n}\n\ncontract NestedMapping {\n mapping(address => mapping(uint256 => bool)) public nested;\n\n function get(address _addr1, uint256 _i) public view returns (bool) {\n return nested[_addr1][_i];\n }\n\n function set(address _addr1, uint256 _i, bool _boo) public {\n nested[_addr1][_i] = _boo;\n }\n\n function remove(address _addr1, uint256 _i) public {\n delete nested[_addr1][_i];\n }\n}\n")))),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, Var};\n\n#[odra::module]\npub struct Array {\n // the size of the array must be known at compile time\n arr: Var<[u8; 10]>,\n vec: Var>,\n}\n\n#[odra::module]\nimpl Array {\n pub fn init(&mut self) {\n self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n self.vec.set(vec![1, 2, 3, 4, 5]);\n }\n\n pub fn get_arr(&self) -> [u8; 10] {\n self.arr.get_or_default()\n }\n\n pub fn push_vec(&mut self, value: u32) {\n let mut vec = self.vec.get_or_default();\n vec.push(value);\n self.vec.set(vec);\n }\n\n pub fn pop_vec(&mut self) {\n let mut vec = self.vec.get_or_default();\n vec.pop();\n self.vec.set(vec);\n }\n\n pub fn update_arr(&mut self, index: u8, value: u8) {\n let mut arr = self.arr.get_or_default();\n arr[index as usize] = value;\n self.arr.set(arr);\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Array {\n // Several ways to initialize an array\n uint256[] public arr;\n uint256[] public arr2 = [1, 2, 3];\n // Fixed sized array, all elements initialize to 0\n uint256[10] public myFixedSizeArr;\n\n function get(uint256 i) public view returns (uint256) {\n return arr[i];\n }\n\n // Solidity can return the entire array.\n // But this function should be avoided for\n // arrays that can grow indefinitely in length.\n function getArr() public view returns (uint256[] memory) {\n return arr;\n }\n\n function push(uint256 i) public {\n // Append to array\n // This will increase the array length by 1.\n arr.push(i);\n }\n\n function pop() public {\n // Remove last element from array\n // This will decrease the array length by 1\n arr.pop();\n }\n\n function getLength() public view returns (uint256) {\n return arr.length;\n }\n\n function remove(uint256 index) public {\n // Delete does not change the array length.\n // It resets the value at index to it's default value,\n // in this case 0\n delete arr[index];\n }\n\n function examples() external {\n // create array in memory, only fixed size can be created\n uint256[] memory a = new uint256[](5);\n }\n}\n")))),(0,r.kt)("p",null,"For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," instead of an array or vector to store data."),(0,r.kt)("h3",{id:"custom-types"},"Custom types"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, Var};\n\n#[odra::odra_type]\n#[derive(Default)]\npub enum Status {\n #[default]\n Pending,\n Shipped,\n Accepted,\n Rejected,\n Canceled,\n}\n\n#[odra::module]\npub struct Enum {\n status: Var,\n}\n\n#[odra::module]\nimpl Enum {\n pub fn get(&self) -> Status {\n self.status.get_or_default()\n }\n\n pub fn set(&mut self, status: Status) {\n self.status.set(status);\n }\n\n pub fn cancel(&mut self) {\n self.status.set(Status::Canceled);\n }\n\n pub fn reset(&mut self) {\n self.status.set(Default::default());\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/enum/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/enum/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Enum {\n // Enum representing shipping status\n enum Status {\n Pending,\n Shipped,\n Accepted,\n Rejected,\n Canceled\n }\n\n // Default value is the first element listed in\n // definition of the type, in this case "Pending"\n Status public status;\n\n // Returns uint\n // Pending - 0\n // Shipped - 1\n // Accepted - 2\n // Rejected - 3\n // Canceled - 4\n function get() public view returns (Status) {\n return status;\n }\n\n function set(Status _status) public {\n status = _status;\n }\n\n function cancel() public {\n status = Status.Canceled;\n }\n\n // delete resets the enum to its first value, 0\n function reset() public {\n delete status;\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, custom types are defined using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. The enum can have a default value specified using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[default]")," attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Default::default()")," function."),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, List};\n\n#[odra::odra_type]\npub struct Todo {\n text: String,\n completed: bool,\n}\n\n#[odra::module]\npub struct Enum {\n // You could also use Var> instead of List,\n // but List is more efficient for large arrays,\n // it loads items lazily.\n todos: List,\n}\n\n#[odra::module]\nimpl Enum {\n pub fn create(&mut self, text: String) {\n self.todos.push(Todo {\n text,\n completed: false,\n });\n }\n\n pub fn update_text(&mut self, index: u32, text: String) {\n if let Some(mut todo) = self.todos.get(index) {\n todo.text = text;\n self.todos.replace(index, todo);\n }\n }\n\n pub fn toggle_complete(&mut self, index: u32) {\n if let Some(mut todo) = self.todos.get(index) {\n todo.completed = !todo.completed;\n self.todos.replace(index, todo);\n }\n }\n\n // Odra does not create getters by default\n pub fn get(&self, index: u32) -> Option {\n self.todos.get(index)\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/structs/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/structs/"'},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Todos {\n struct Todo {\n string text;\n bool completed;\n }\n\n Todo[] public todos;\n\n function create(string calldata _text) public {\n todos.push(Todo(_text, false));\n }\n\n // Solidity automatically created a getter for 'todos' so\n // you don't actually need this function.\n function get(uint256 _index)\n public\n view\n returns (string memory text, bool completed)\n {\n Todo storage todo = todos[_index];\n return (todo.text, todo.completed);\n }\n\n function updateText(uint256 _index, string calldata _text) public {\n Todo storage todo = todos[_index];\n todo.text = _text;\n }\n\n function toggleCompleted(uint256 _index) public {\n Todo storage todo = todos[_index];\n todo.completed = !todo.completed;\n }\n}\n\n")))),(0,r.kt)("p",null,"Similarly to enums, custom structs are defined using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. The struct can be used to define a list of items in a contract. The list can be created using the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type, which is more efficient for large arrays as it loads items lazily."),(0,r.kt)("h3",{id:"data-location"},"Data Location"),(0,r.kt)("p",null,"In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be ",(0,r.kt)("inlineCode",{parentName:"p"},"memory"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"calldata"),". In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),"), the data is stored in the contract's storage."),(0,r.kt)("h2",{id:"functions"},"Functions"),(0,r.kt)("p",null,"Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"impl Erc20 {\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.internal_transfer(&self.env().caller(), recipient, amount);\n // Transfer logic goes here\n }\n\n fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) {\n // Internal transfer logic goes here\n }\n}\n")),(0,r.kt)("p",null,"Functions can modify contract state and emit events using the ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/communicating-with-host"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," function."),(0,r.kt)("h3",{id:"view-and-pure"},"View and Pure"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::Var;\n\n#[odra::module]\npub struct ViewAndPure {\n x: Var \n}\n\n#[odra::module]\nimpl ViewAndPure {\n pub fn add_to_x(&self, y: u32) -> u32 {\n self.x.get_or_default() + y\n }\n}\n\npub fn add(i: u32, j: u32) -> u32 {\n i + j\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract ViewAndPure {\n uint256 public x = 1;\n\n // Promise not to modify the state.\n function addToX(uint256 y) public view returns (uint256) {\n return x + y;\n }\n\n // Promise not to modify or read from the state.\n function add(uint256 i, uint256 j) public pure returns (uint256) {\n return i + j;\n }\n}\n")))),(0,r.kt)("p",null,"In Odra, you don't need to specify ",(0,r.kt)("inlineCode",{parentName:"p"},"view")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"pure")," functions explicitly. All functions are considered ",(0,r.kt)("inlineCode",{parentName:"p"},"view")," functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be ",(0,r.kt)("inlineCode",{parentName:"p"},"&mut self"),". If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects."),(0,r.kt)("h3",{id:"modifiers"},"Modifiers"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::Var;\n\n#[odra::module]\npub struct FunctionModifier {\n x: Var,\n locked: Var, \n}\n\n#[odra::module]\nimpl FunctionModifier {\n pub fn decrement(&mut self, i: u32) -> u32 {\n self.lock();\n self.x.set(self.x.get_or_default() - i);\n\n if i > 1 {\n self.decrement(i - 1);\n }\n self.unlock();\n }\n\n #[inline]\n fn lock(&mut self) {\n if self.locked.get_or_default() {\n self.env().revert("No reentrancy");\n }\n\n self.locked.set(true);\n }\n\n #[inline]\n fn unlock(&mut self) {\n self.locked.set(false);\n }\n}\n\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract FunctionModifier {\n uint256 public x = 10;\n bool public locked;\n\n modifier noReentrancy() {\n require(!locked, "No reentrancy");\n\n locked = true;\n _;\n locked = false;\n }\n\n function decrement(uint256 i) public noReentrancy {\n x -= i;\n\n if (i > 1) {\n decrement(i - 1);\n }\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the ",(0,r.kt)("inlineCode",{parentName:"p"},"lock")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unlock")," functions are called before and after the decrement function, respectively, but they must be called explicitly."),(0,r.kt)("p",null,"As often as practicable, developers should inline functions by including the body of the function within their code using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[inline]")," attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances."),(0,r.kt)("h3",{id:"visibility"},"Visibility"),(0,r.kt)("p",null,"Functions and state variables have to declare whether they are accessible by other contracts."),(0,r.kt)("p",null,"Functions can be declared as:"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"`pub` inside `#[odra::module]` impl block - any contract/submodule and account can call.\n`pub` inside a regular impl block - any submodule can call.\n`default/no modifier/private` - only inside the contract that defines the function.\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"`public` - any contract and account can call.\n`private` - only inside the contract that defines the function.\n`internal` - only inside contract that inherits an internal function.\n`external` - only other contracts and accounts can call\n\nState variables can be declared as public, private, or internal but not external.\n")))),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var};\n\n#[odra::module]\npub struct Payable {\n owner: Var
,\n}\n\n#[odra::module]\nimpl Payable {\n pub fn init(&mut self) {\n self.owner.set(self.env().caller());\n }\n\n #[odra(payable)]\n pub fn deposit(&self) {\n }\n\n pub fn not_payable(&self) {\n }\n\n pub fn withdraw(&self) {\n let amount = self.env().self_balance();\n self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount);\n }\n\n pub fn transfer(&self, to: Address, amount: U512) {\n self.env().transfer_tokens(&to, &amount);\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Payable {\n // Payable address can send Ether via transfer or send\n address payable public owner;\n\n // Payable constructor can receive Ether\n constructor() payable {\n owner = payable(msg.sender);\n }\n\n // Function to deposit Ether into this contract.\n // Call this function along with some Ether.\n // The balance of this contract will be automatically updated.\n function deposit() public payable {}\n\n // Call this function along with some Ether.\n // The function will throw an error since this function is not payable.\n function notPayable() public {}\n\n // Function to withdraw all Ether from this contract.\n function withdraw() public {\n // get the amount of Ether stored in this contract\n uint256 amount = address(this).balance;\n\n // send all Ether to owner\n (bool success,) = owner.call{value: amount}("");\n require(success, "Failed to send Ether");\n }\n\n // Function to transfer Ether from this contract to address from input\n function transfer(address payable _to, uint256 _amount) public {\n // Note that "to" is declared as payable\n (bool success,) = _to.call{value: _amount}("");\n require(success, "Failed to send Ether");\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, you can define a function with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether."),(0,r.kt)("h3",{id:"selectors"},"Selectors"),(0,r.kt)("p",null,"In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:"showLineNumbers",showLineNumbers:!0},'contract_addr.call(\n abi.encodeWithSignature("transfer(address,uint256)", address, 1234)\n)\n')),(0,r.kt)("p",null,"Odra does not support such a mechanism. You must have access to the contract interface to call a function."),(0,r.kt)("h2",{id:"events-and-logging"},"Events and Logging"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::{prelude::*, Address};\n\n#[odra::event]\npub struct Log {\n sender: Address,\n message: String,\n}\n\n#[odra::event]\npub struct AnotherLog {}\n\n#[odra::module]\nstruct Event;\n\n#[odra::module]\nimpl Event {\n pub fn test(&self) {\n let env = self.env();\n env.emit_event(Log {\n sender: env.caller(),\n message: "Hello World!".to_string(),\n });\n env.emit_event(Log {\n sender: env.caller(),\n message: "Hello Casper!".to_string(),\n });\n env.emit_event(AnotherLog {});\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/events/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/events/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Event {\n // Event declaration\n // Up to 3 parameters can be indexed.\n // Indexed parameters helps you filter the logs by the indexed parameter\n event Log(address indexed sender, string message);\n event AnotherLog();\n\n function test() public {\n emit Log(msg.sender, "Hello World!");\n emit Log(msg.sender, "Hello EVM!");\n emit AnotherLog();\n }\n}\n')))),(0,r.kt)("p",null,"In Odra, events are regular structs defined using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's ",(0,r.kt)("inlineCode",{parentName:"p"},"emit_event()")," function, passing the event struct as an argument."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/events"},"Basics")," section.")),(0,r.kt)("h2",{id:"error-handling"},"Error Handling"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{prelude::*, casper_types::{U256, U512}};\n\n#[odra::odra_error]\npub enum CustomError {\n InsufficientBalance = 1,\n InputLowerThanTen = 2,\n}\n\n#[odra::module]\npub struct Error;\n\n#[odra::module]\nimpl Error {\n pub fn test_require(&mut self, i: U256) {\n if i <= 10.into() {\n self.env().revert(CustomError::InputLowerThanTen);\n }\n }\n\n pub fn execute_external_call(&self, withdraw_amount: U512) {\n let balance = self.env().self_balance();\n if balance < withdraw_amount {\n self.env().revert(CustomError::InsufficientBalance);\n }\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/error/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/error/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Error {\n function testRequire(uint256 _i) public pure {\n // Require should be used to validate conditions such as:\n // - inputs\n // - conditions before execution\n // - return values from calls to other functions\n require(_i > 10, "Input must be greater than 10");\n }\n\n function testRevert(uint256 _i) public pure {\n // Revert is useful when the condition to check is complex.\n // This code does the exact same thing as the example above\n if (_i <= 10) {\n revert("Input must be greater than 10");\n }\n }\n\n uint256 public num;\n\n function testAssert() public view {\n // Assert should only be used to test for internal errors,\n // and to check invariants.\n\n // Here we assert that num is always equal to 0\n // since it is impossible to update the value of num\n assert(num == 0);\n }\n\n // custom error\n error InsufficientBalance(uint256 balance, uint256 withdrawAmount);\n\n function testCustomError(uint256 _withdrawAmount) public view {\n uint256 bal = address(this).balance;\n if (bal < _withdrawAmount) {\n revert InsufficientBalance({\n balance: bal,\n withdrawAmount: _withdrawAmount\n });\n }\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity, there are four ways to handle errors: ",(0,r.kt)("inlineCode",{parentName:"p"},"require"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"revert"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"assert"),", and custom errors. In Odra, there is only one way to revert the execution of a function - by using the ",(0,r.kt)("inlineCode",{parentName:"p"},"env().revert()")," function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute. On Casper, an error is only a number, so you can't pass a message with the error."),(0,r.kt)("h2",{id:"composition-vs-inheritance"},"Composition vs. Inheritance"),(0,r.kt)("p",null,"In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another."),(0,r.kt)("p",null,"Let's take a look at the difference between inheritance in Solidity and composition in Odra."),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},'use odra::{prelude::*, SubModule};\n\n#[odra::module]\npub struct A;\n\n#[odra::module]\nimpl A {\n pub fn foo(&self) -> String {\n "A".to_string()\n }\n}\n\n#[odra::module]\npub struct B {\n a: SubModule\n}\n\n#[odra::module]\nimpl B {\n pub fn foo(&self) -> String {\n "B".to_string()\n }\n}\n\n#[odra::module]\npub struct C {\n a: SubModule\n}\n\n#[odra::module]\nimpl C {\n pub fn foo(&self) -> String {\n "C".to_string()\n }\n}\n\n#[odra::module]\npub struct D {\n b: SubModule,\n c: SubModule\n}\n\n#[odra::module]\nimpl D {\n pub fn foo(&self) -> String {\n self.c.foo()\n }\n}\n\n#[odra::module]\npub struct E {\n b: SubModule,\n c: SubModule\n}\n\n#[odra::module]\nimpl E {\n pub fn foo(&self) -> String {\n self.b.foo()\n }\n}\n\n#[odra::module]\npub struct F {\n a: SubModule,\n b: SubModule,\n}\n\n#[odra::module]\nimpl F {\n pub fn foo(&self) -> String {\n self.a.foo()\n }\n}\n'))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/inheritance/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/inheritance/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\n/* Graph of inheritance\n A\n / \\\n B C\n / \\ /\nF D,E\n*/\n\ncontract A {\n function foo() public pure virtual returns (string memory) {\n return "A";\n }\n}\n\n// Contracts inherit other contracts by using the keyword \'is\'.\ncontract B is A {\n // Override A.foo()\n function foo() public pure virtual override returns (string memory) {\n return "B";\n }\n}\n\ncontract C is A {\n // Override A.foo()\n function foo() public pure virtual override returns (string memory) {\n return "C";\n }\n}\n\n// Contracts can inherit from multiple parent contracts.\n// When a function is called that is defined multiple times in\n// different contracts, parent contracts are searched from\n// right to left, and in depth-first manner.\ncontract D is B, C {\n // D.foo() returns "C"\n // since C is the right most parent contract with function foo()\n function foo() public pure override(B, C) returns (string memory) {\n return super.foo();\n }\n}\n\ncontract E is C, B {\n // E.foo() returns "B"\n // since B is the right most parent contract with function foo()\n function foo() public pure override(C, B) returns (string memory) {\n return super.foo();\n }\n}\n\n// Inheritance must be ordered from \u201cmost base-like\u201d to \u201cmost derived\u201d.\n// Swapping the order of A and B will throw a compilation error.\ncontract F is A, B {\n function foo() public pure override(A, B) returns (string memory) {\n return super.foo();\n }\n}\n')))),(0,r.kt)("p",null,'Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers.'),(0,r.kt)("p",null,"In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts."),(0,r.kt)("h2",{id:"libraries-and-utility"},"Libraries and Utility"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var};\n\nmod math {\n use odra::casper_types::U256;\n\n pub fn sqrt(y: U256) -> U256 {\n let mut z = y;\n if y > 3.into() {\n let mut x = y / 2 + 1;\n while x < z {\n z = x;\n x = (y / x + x) / 2;\n }\n } else if y != U256::zero() {\n z = U256::one();\n }\n z\n }\n}\n\n#[odra::module]\nstruct TestMath;\n\n#[odra::module]\nimpl TestMath {\n pub fn test_square_root(&self, x: U256) -> U256 {\n math::sqrt(x)\n }\n}\n\n#[odra::odra_error]\nenum Error {\n EmptyArray = 100,\n}\n\ntrait Removable {\n fn remove(&mut self, index: usize);\n}\n\nimpl Removable for Var> {\n fn remove(&mut self, index: usize) {\n let env = self.env();\n let mut vec = self.get_or_default();\n if vec.is_empty() {\n env.revert(Error::EmptyArray);\n }\n vec[index] = vec.pop().unwrap_or_revert(&env);\n self.set(vec);\n }\n}\n\n#[odra::module]\nstruct TestArray {\n arr: Var>,\n}\n\n#[odra::module]\nimpl TestArray {\n pub fn test_array_remove(&mut self) {\n let mut arr = self.arr.get_or_default();\n for i in 0..3 {\n arr.push(i.into());\n }\n self.arr.set(arr);\n\n self.arr.remove(1);\n\n let arr = self.arr.get_or_default();\n assert_eq!(arr.len(), 2);\n assert_eq!(arr[0], 0.into());\n assert_eq!(arr[1], 2.into());\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/library/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/library/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nlibrary Math {\n function sqrt(uint256 y) internal pure returns (uint256 z) {\n if (y > 3) {\n z = y;\n uint256 x = y / 2 + 1;\n while (x < z) {\n z = x;\n x = (y / x + x) / 2;\n }\n } else if (y != 0) {\n z = 1;\n }\n // else z = 0 (default value)\n }\n}\n\ncontract TestMath {\n function testSquareRoot(uint256 x) public pure returns (uint256) {\n return Math.sqrt(x);\n }\n}\n\nlibrary Array {\n function remove(uint256[] storage arr, uint256 index) public {\n require(arr.length > 0, "Can\'t remove from empty array");\n arr[index] = arr[arr.length - 1];\n arr.pop();\n }\n}\n\ncontract TestArray {\n using Array for uint256[];\n\n uint256[] public arr;\n\n function testArrayRemove() public {\n for (uint256 i = 0; i < 3; i++) {\n arr.push(i);\n }\n\n arr.remove(1);\n\n assert(arr.length == 2);\n assert(arr[0] == 0);\n assert(arr[1] == 2);\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the ",(0,r.kt)("inlineCode",{parentName:"p"},"Math")," library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the ",(0,r.kt)("inlineCode",{parentName:"p"},"TestMath")," contract calls the ",(0,r.kt)("inlineCode",{parentName:"p"},"sqrt")," function directly, while the ",(0,r.kt)("inlineCode",{parentName:"p"},"TestArray")," contract uses the using keyword, which extends the type ",(0,r.kt)("inlineCode",{parentName:"p"},"uint256[]")," by adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"remove")," function."),(0,r.kt)("p",null,"In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Removable")," trait for the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var>")," type allows the ",(0,r.kt)("inlineCode",{parentName:"p"},"remove")," function to be called on a variable that stores a vector of ",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," values."),(0,r.kt)("h2",{id:"fallback-and-receive-functions"},"Fallback and Receive Functions"),(0,r.kt)("p",null,"In Solidity, a contract receiving Ether must implement a ",(0,r.kt)("inlineCode",{parentName:"p"},"receive()")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"fallback()")," function. The ",(0,r.kt)("inlineCode",{parentName:"p"},"receive()")," function is called when Ether is sent to the contract with no data, while the ",(0,r.kt)("inlineCode",{parentName:"p"},"fallback()")," function is called when the contract receives Ether with data or when a function that does not exist is called."),(0,r.kt)("p",null,"Odra does not have a direct equivalent to the ",(0,r.kt)("inlineCode",{parentName:"p"},"receive()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"fallback()")," functions. Instead, you can define a function with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute to indicate that the function can receive CSPRs."),(0,r.kt)("h2",{id:"miscellaneous"},"Miscellaneous"),(0,r.kt)("h3",{id:"hashing"},"Hashing"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n casper_types::{bytesrepr::ToBytes, U256},\n prelude::*,\n Address, UnwrapOrRevert, Var,\n};\n\n#[odra::module]\npub struct HashFunction;\n\n#[odra::module]\nimpl HashFunction {\n pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] {\n let env = self.env();\n let mut data = Vec::new();\n data.extend(text.to_bytes().unwrap_or_revert(&env));\n data.extend(num.to_bytes().unwrap_or_revert(&env));\n data.extend(addr.to_bytes().unwrap_or_revert(&env));\n env.hash(data)\n }\n}\n\n#[odra::module]\npub struct GuessTheMagicWord {\n answer: Var<[u8; 32]>,\n}\n\n#[odra::module]\nimpl GuessTheMagicWord {\n /// Initializes the contract with the magic word hash.\n pub fn init(&mut self) {\n self.answer.set([\n 0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84,\n 0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55,\n 0xbe, 0xd7, 0x56, 0x08,\n ]);\n }\n\n /// Checks if the `word` is the magic word.\n pub fn guess(&self, word: String) -> bool {\n let env = self.env();\n let hash = env.hash(word.to_bytes().unwrap_or_revert(&env));\n hash == self.answer.get_or_default()\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/hashing/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/hashing/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract HashFunction {\n function hash(string memory _text, uint256 _num, address _addr)\n public\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(_text, _num, _addr));\n }\n}\n\ncontract GuessTheMagicWord {\n bytes32 public answer =\n 0x60298f78cc0b47170ba79c10aa3851d7648bd96f2f8e46a19dbc777c36fb0c00;\n\n // Magic word is "Solidity"\n function guess(string memory _word) public view returns (bool) {\n return keccak256(abi.encodePacked(_word)) == answer;\n }\n}\n')))),(0,r.kt)("p",null,"The key difference between the two is that in Solidity, the ",(0,r.kt)("inlineCode",{parentName:"p"},"keccak256")," function is used to hash data, while in Odra, the ",(0,r.kt)("inlineCode",{parentName:"p"},"env.hash()")," function is used, which implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"blake2b")," algorithm. Both functions take a byte array as input and return a 32-byte hash."),(0,r.kt)("h3",{id:"try-catch"},"Try-catch"),(0,r.kt)(i.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"rust",label:"Odra",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{module::Module, Address, ContractRef, Var};\n\n#[odra::module]\npub struct Example {\n other_contract: Var
,\n}\n\n#[odra::module]\nimpl Example {\n pub fn init(&mut self, other_contract: Address) {\n self.other_contract.set(other_contract);\n }\n\n pub fn execute_external_call(&self) {\n if let Some(addr) = self.other_contract.get() {\n let result = OtherContractContractRef::new(self.env(), addr).some_function();\n match result {\n Ok(success) => {\n // Code to execute if the external call was successful\n }\n Err(reason) => {\n // Code to execute if the external call failed\n }\n }\n }\n }\n}\n\n#[odra::module]\npub struct OtherContract;\n\n#[odra::module]\nimpl OtherContract {\n pub fn some_function(&self) -> Result {\n Ok(true)\n }\n}\n"))),(0,r.kt)(o.Z,{value:"sol",label:"Solidity",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sol",metastring:'showLineNumbers title="https://solidity-by-example.org/hashing/"',showLineNumbers:!0,title:'"https://solidity-by-example.org/hashing/"'},'// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract Example {\n OtherContract otherContract;\n\n constructor(address _otherContractAddress) public {\n otherContract = OtherContract(_otherContractAddress);\n }\n\n function executeExternalCall() public {\n try otherContract.someFunction() returns (bool success) {\n // Code to execute if the external call was successful\n require(success, "Call failed");\n } catch Error(string memory reason) {\n // Code to execute if the external call failed with a revert reason\n // Optionally handle specific revert reasons\n emit LogErrorString(reason);\n } catch (bytes memory lowLevelData) {\n // Code to execute if the external call failed without a revert reason\n emit LogErrorBytes(lowLevelData);\n }\n }\n\n event LogErrorString(string reason);\n event LogErrorBytes(bytes lowLevelData);\n}\n\ncontract OtherContract {\n function someFunction() public returns (bool) {\n // Function logic\n }\n}\n')))),(0,r.kt)("p",null,"In Solidity, ",(0,r.kt)("inlineCode",{parentName:"p"},"try/catch")," is a feature that allows developers to handle exceptions and errors more gracefully. The ",(0,r.kt)("inlineCode",{parentName:"p"},"try/catch")," statement allows developers to catch and handle exceptions that occur during external function calls and contract creation."),(0,r.kt)("p",null,"In Odra, there is no direct equivalent to the ",(0,r.kt)("inlineCode",{parentName:"p"},"try/catch")," statement in Solidity. However, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Result")," type to handle errors in a similar way. The ",(0,r.kt)("inlineCode",{parentName:"p"},"Result")," type is an enum that represents either success (",(0,r.kt)("inlineCode",{parentName:"p"},"Ok"),") or failure (",(0,r.kt)("inlineCode",{parentName:"p"},"Err"),"). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts."),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development."),(0,r.kt)("p",null,"Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework."),(0,r.kt)("p",null,"Read more about the Odra Framework in the ",(0,r.kt)("a",{parentName:"p",href:"../category/basics"},"Basics")," and ",(0,r.kt)("a",{parentName:"p",href:"../category/advanced/"},"Advanced")," sections."),(0,r.kt)("p",null,"Learn by example with our ",(0,r.kt)("a",{parentName:"p",href:"../category/tutorials"},"Tutorial")," series, you will find there a contract you likely familiar with - the ",(0,r.kt)("a",{parentName:"p",href:"/docs/tutorials/erc20"},"Erc20")," standard implementation."),(0,r.kt)("p",null,"If you have any further questions or need clarification on specific topics, feel free to join our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/42407bf6.db5ee144.js b/docs/assets/js/42407bf6.db5ee144.js new file mode 100644 index 000000000..2af83ed58 --- /dev/null +++ b/docs/assets/js/42407bf6.db5ee144.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[65185],{46064:a=>{a.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.9.0/category/backends","navigation":{"previous":{"title":"Building contracts manually","permalink":"/docs/0.9.0/advanced/building-manually"},"next":{"title":"What is a backend?","permalink":"/docs/0.9.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/4279e616.278554fc.js b/docs/assets/js/4279e616.278554fc.js new file mode 100644 index 000000000..81246a8e1 --- /dev/null +++ b/docs/assets/js/4279e616.278554fc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12890],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.5.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.5.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.5.0/",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.5.0/category/getting-started"}},c={image:r(76054).Z},l=[{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean,\npragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open\nsource."),(0,o.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains."),(0,o.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems. We can do it\nby abstracting over core concepts that all the above systems are built around. These are type system,\nstorage, entry points, execution context, and testing environment. We believe it will bring standardization\nto the development of Rust-based smart contracts and enable code reusability we have not yet seen in this\necosystem."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.5.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.5.0/getting-started/flipper"},"Flipper example"),"\nto find out how to start your new project with Odra."))}p.isMDXComponent=!0},76054:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/42eeae87.4940915b.js b/docs/assets/js/42eeae87.4940915b.js new file mode 100644 index 000000000..5d98101e8 --- /dev/null +++ b/docs/assets/js/42eeae87.4940915b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95866],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),u=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(r),m=o,f=p["".concat(l,".").concat(m)]||p[m]||d[m]||a;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:11,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-0.7.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.7.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.7.0/basics/modules",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.7.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.7.0/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:u};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to a macro ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),'. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: MathEngine,\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use super::ModulesContractDeployer;\n\n#[test]\nfn test_modules() {\n let modules_contract = ModulesContractDeployer::default();\n assert_eq!(modules_contract.add_using_module(), 8);\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/42fe661b.d2261711.js b/docs/assets/js/42fe661b.d2261711.js new file mode 100644 index 000000000..259b15379 --- /dev/null +++ b/docs/assets/js/42fe661b.d2261711.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[30800],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.5.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.5.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.5.0/basics/odra-toml",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.5.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.5.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," will be used as a name for the contract - the generated wasm file will be in the above case named\n",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the builder to locate the exact struct where\nthe contract is defined."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n\n[[contracts]]\nname = "counter"\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/43e47b8e.4d3a14c0.js b/docs/assets/js/43e47b8e.4d3a14c0.js new file mode 100644 index 000000000..3055b835a --- /dev/null +++ b/docs/assets/js/43e47b8e.4d3a14c0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29108],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="MockVM",c={unversionedId:"backends/mock-vm",id:"version-0.4.0/backends/mock-vm",title:"MockVM",description:"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.4.0/backends/02-mock-vm.md",sourceDirName:"backends",slug:"/backends/mock-vm",permalink:"/docs/0.4.0/backends/mock-vm",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.4.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.4.0/backends/casper"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mockvm"},"MockVM"),(0,a.kt)("p",null,"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The MockVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"MockVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is just a list of contracts deployed onto the MockVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),".\nEach time we call the contract, we call its instance stored in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the MockVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe MockVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the MockVM.\nThanks to this and the fact that we do not need the blockchain itself,\nMockVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the MockVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a Contract Container.\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, MockVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(MockVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/443d45d4.a66dbfe2.js b/docs/assets/js/443d45d4.a66dbfe2.js new file mode 100644 index 000000000..325773ff0 --- /dev/null +++ b/docs/assets/js/443d45d4.a66dbfe2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[88932],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),i=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=i(e.components);return a.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=i(n),m=r,f=c["".concat(u,".").concat(m)]||c[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=c;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var i=2;i{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>i});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5},o="Pausable",l={unversionedId:"tutorials/pauseable",id:"version-0.9.1/tutorials/pauseable",title:"Pausable",description:"The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.",source:"@site/versioned_docs/version-0.9.1/tutorials/pauseable.md",sourceDirName:"tutorials",slug:"/tutorials/pauseable",permalink:"/docs/0.9.1/tutorials/pauseable",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Access Control",permalink:"/docs/0.9.1/tutorials/access-control"},next:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/0.9.1/tutorials/build-deploy-read"}},u={},i=[{value:"Code",id:"code",level:2},{value:"Events and Error",id:"events-and-error",level:3},{value:"Module definition",id:"module-definition",level:3},{value:"Checks and guards",id:"checks-and-guards",level:3},{value:"Actions",id:"actions",level:3},{value:"Pausable counter",id:"pausable-counter",level:2}],d={toc:i};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently."),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"As always, we will start with defining functionalities of our module."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Check the state - is it paused or not."),(0,r.kt)("li",{parentName:"ol"},"State guards - a contract should stop execution if is in a state we don't expect."),(0,r.kt)("li",{parentName:"ol"},"Switch the state.")),(0,r.kt)("h3",{id:"events-and-error"},"Events and Error"),(0,r.kt)("p",null,"There just two errors that may occur: ",(0,r.kt)("inlineCode",{parentName:"p"},"PausedRequired"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"UnpausedRequired"),". We define them in a standard Odra way."),(0,r.kt)("p",null,"Events definition is highly uncomplicated: ",(0,r.kt)("inlineCode",{parentName:"p"},"Paused")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused")," events holds only the address of the pauser."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::odra_error]\npub enum Error {\n PausedRequired = 1_000,\n UnpausedRequired = 1_001,\n}\n\n#[odra::event]\npub struct Paused {\n pub account: Address\n}\n\n#[odra::event]\npub struct Unpaused {\n pub account: Address\n}\n")),(0,r.kt)("h3",{id:"module-definition"},"Module definition"),(0,r.kt)("p",null,"The module storage is extremely simple - has a single ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," of type bool, that indicates if a contract is paused."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::Var;\n...\n\n#[odra::module(events = [Paused, Unpaused])]\npub struct Pausable {\n is_paused: Var\n}\n")),(0,r.kt)("h3",{id:"checks-and-guards"},"Checks and guards"),(0,r.kt)("p",null,"Now, let's move to state checks and guards."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn is_paused(&self) -> bool {\n self.is_paused.get_or_default()\n }\n\n pub fn require_not_paused(&self) {\n if self.is_paused() {\n self.env().revert(Error::UnpausedRequired);\n }\n }\n\n pub fn require_paused(&self) {\n if !self.is_paused() {\n self.env().revert(Error::PausedRequired);\n }\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - as mentioned in the intro, the module is not intended to be a standalone contract, so the only ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block is not annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::module")," and hence does not expose any entrypoint."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L2")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused()")," checks the contract state, if the Var ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused")," has not been initialized, the default value (false) is returned."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - to guarantee the code is executed when the contract is not paused, ",(0,r.kt)("inlineCode",{parentName:"li"},"require_not_paused()")," function reads the state and reverts if the contract is paused. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"require_paused()")," is a mirror function - stops the contract execution if the contract is not paused.")),(0,r.kt)("h3",{id:"actions"},"Actions"),(0,r.kt)("p",null,"Finally, we will add the ability to switch the module state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn pause(&mut self) {\n self.require_not_paused();\n self.is_paused.set(true);\n\n self.env().emit_event(Paused {\n account: self.env().caller()\n });\n }\n\n pub fn unpause(&mut self) {\n self.require_paused();\n self.is_paused.set(false);\n\n self.env().emit_event(Unpaused {\n account: self.env().caller()\n });\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"pause()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()")," functions do three things: ensure the contract is the right state (unpaused for ",(0,r.kt)("inlineCode",{parentName:"p"},"pause()"),", not paused for ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()"),"), updates the state, and finally emits events (",(0,r.kt)("inlineCode",{parentName:"p"},"Paused"),"/",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused"),")."),(0,r.kt)("h2",{id:"pausable-counter"},"Pausable counter"),(0,r.kt)("p",null,"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called ",(0,r.kt)("inlineCode",{parentName:"p"},"PausableCounter"),". The contract consists of a Var ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module. The counter can only be incremented if the contract is in a normal state (is not paused)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"...\nuse odra::SubModule;\n...\n\n#[odra::module]\npub struct PausableCounter {\n value: Var,\n pauseable: SubModule\n}\n\n#[odra::module]\nimpl PausableCounter {\n pub fn increment(&mut self) {\n self.pauseable.require_not_paused();\n\n let new_value = self.value.get_or_default() + 1;\n self.value.set(new_value);\n }\n\n pub fn pause(&mut self) {\n self.pauseable.pause();\n }\n\n pub fn unpause(&mut self) {\n self.pauseable.unpause();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn increment_only_if_unpaused() {\n let test_env = odra_test::env();\n let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);\n contract.increment();\n contract.pause();\n\n assert_eq!(\n contract.try_increment().unwrap_err(),\n Error::UnpausedRequired.into()\n );\n assert_eq!(contract.get_value(), 1);\n }\n}\n")),(0,r.kt)("p",null,"As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/448060b1.f426f77e.js b/docs/assets/js/448060b1.f426f77e.js new file mode 100644 index 000000000..60230371d --- /dev/null +++ b/docs/assets/js/448060b1.f426f77e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62081],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=p(n),d=a,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",i={unversionedId:"getting-started/flipper",id:"version-0.4.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.4.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.4.0/getting-started/flipper",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.4.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.4.0/category/basics"}},s={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.4.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Variable;\n\n/// A module definition. Each module struct consists Variables and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Variable,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let mut contract1 = FlipperDeployer::initial_settings();\n let contract2 = FlipperDeployer::initial_settings();\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/452b335c.ec234700.js b/docs/assets/js/452b335c.ec234700.js new file mode 100644 index 000000000..e035cfcf8 --- /dev/null +++ b/docs/assets/js/452b335c.ec234700.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[91802],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=l(n),d=o,f=p["".concat(c,".").concat(d)]||p[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-1.0.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-1.0.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/basics/communicating-with-host",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],u={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module]\npub struct HostContract {\n name: Var,\n created_at: Var,\n created_by: Var
\n}\n\n#[odra::module]\nimpl HostContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(self.env().get_block_time());\n self.created_by.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"self.env()"),". It is an implementation of ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/module/trait.Module.html#tymehtod.env"},(0,o.kt)("inlineCode",{parentName:"a"},"Module::env()")),", autogenerated\nby ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The function returns a reference to the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/struct.ContractEnv.html"},(0,o.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," (you can read more in\nthe ",(0,o.kt)("a",{parentName:"p",href:"/docs/backends/what-is-a-backend#contract-env"},(0,o.kt)("inlineCode",{parentName:"a"},"Backend section")),"). This is a structure that provides access to the host functions and variables. "),(0,o.kt)("p",null,"In this example, we use two of them:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"get_block_time()")," - returns the current block time as u64. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"caller()")," - returns an Odra ",(0,o.kt)("inlineCode",{parentName:"li"},"Address")," of the caller (this can be an external caller or another contract).")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/45990ab7.bc27b658.js b/docs/assets/js/45990ab7.bc27b658.js new file mode 100644 index 000000000..b7cf60ae4 --- /dev/null +++ b/docs/assets/js/45990ab7.bc27b658.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[18088],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s(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 o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return a?n.createElement(h,o(o({ref:t},p),{},{components:a})):n.createElement(h,o({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var c=2;c{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:3},o="Casper",i={unversionedId:"backends/casper",id:"version-0.3.1/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.3.1/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.3.1/backends/casper",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"MockVM",permalink:"/docs/0.3.1/backends/mock-vm"},next:{title:"Examples",permalink:"/docs/0.3.1/category/examples"}},l={},c=[{value:"Types",id:"types",level:2},{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Constructors",id:"constructors",level:2},{value:"Execution",id:"execution",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"types"},"Types"),(0,r.kt)("p",null,"A struct to be written into the storage must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait OdraType: \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("p",null,"The other exposed types are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CallArgs")," - wraps around casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"RuntimeArgs")),";"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," - U512 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"BlockTime")," - u64 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Address")," - an enum that encapsulates casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/account/struct.AccountHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"AccountHash"))," and ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/struct.ContractPackageHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractPackageHash")))),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"SerializableEvent")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait SerializableEvent: \n odra_types::event::OdraEvent + \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance, you call ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_balance"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("p",null,"Let's define a basic Odra module that includes a constructor:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\nstruct Counter {\n value: Variable\n}\n\n#[odra::module]\nimpl Counter {\n #[odra(init)]\n pub initialize(&mut self, value: u32) {\n self.value.set(value);\n }\n}\n")),(0,r.kt)("p",null,"Read more about constructors ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/advanced/attributes#init"},"here"),"."),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"constructor")," argument with a value of ",(0,r.kt)("inlineCode",{parentName:"p"},"initialize")," - this represents the name of the constructor function. Additionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "constructor:string:\'initialize\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/backends/mock-vm"},"MockVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/46da96af.e337d27c.js b/docs/assets/js/46da96af.e337d27c.js new file mode 100644 index 000000000..1f4d9741d --- /dev/null +++ b/docs/assets/js/46da96af.e337d27c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41563],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.9.1/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.9.1/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.9.1/basics/odra-toml",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.9.1/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.9.1/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the building tools to locate and build the contract.\nThe last segment of the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," will be used as the name for your contract - the generated wasm file will\nbe in the above case named ",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n\n[[contracts]]\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/46ef55c5.cd37fe24.js b/docs/assets/js/46ef55c5.cd37fe24.js new file mode 100644 index 000000000..7990fdb3f --- /dev/null +++ b/docs/assets/js/46ef55c5.cd37fe24.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[89561],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.9.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.9.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.9.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.9.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.9.0/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.9.0"\n\n[dev-dependencies]\nodra-test = "0.9.0"\n\n[build-dependencies]\nodra-build = "0.9.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = "0.9.0"\nodra-modules = "0.9.0"\n')),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::prelude::*;\nuse odra::{Address, casper_types::U256, module::SubModule};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra repository"),".")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/473b33d6.586ce226.js b/docs/assets/js/473b33d6.586ce226.js new file mode 100644 index 000000000..d587c29ef --- /dev/null +++ b/docs/assets/js/473b33d6.586ce226.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[34050],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="MockVM",c={unversionedId:"backends/mock-vm",id:"version-0.6.0/backends/mock-vm",title:"MockVM",description:"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.6.0/backends/02-mock-vm.md",sourceDirName:"backends",slug:"/backends/mock-vm",permalink:"/docs/0.6.0/backends/mock-vm",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.6.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.6.0/backends/casper"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mockvm"},"MockVM"),(0,a.kt)("p",null,"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The MockVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"MockVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is just a list of contracts deployed onto the MockVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),".\nEach time we call the contract, we call its instance stored in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the MockVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe MockVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the MockVM.\nThanks to this and the fact that we do not need the blockchain itself,\nMockVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the MockVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a Contract Container.\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, MockVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(MockVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4760a525.da688a97.js b/docs/assets/js/4760a525.da688a97.js new file mode 100644 index 000000000..d8477b267 --- /dev/null +++ b/docs/assets/js/4760a525.da688a97.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[84062],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.8.1/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.8.1/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.8.1/basics/cross-calls",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.8.1/basics/events"},next:{title:"Modules",permalink:"/docs/0.8.1/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Loading the contract",id:"loading-the-contract",level:3},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::prelude::*;\nuse odra::{Address, UnwrapOrRevert, Var};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Var
\n}\n\n#[odra::module]\nimpl CrossContract {\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());\n MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine;\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To perform a cross-contact call, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"HostRef")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/testing"},"Testing")," article - a host side reference to already deployed contract."),(0,r.kt)("p",null,"In the module context we use a ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractRef")," instead, to call other contracts."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," is generated automatically,\nby the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("p",null,"To obtain an instance of a contract reference, we simply call the constructor - ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env: Rc, address: Address)"),", as shown above."),(0,r.kt)("p",null,"The reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), and the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::address()")," function, which returns the address of the contract."),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderContractRef")," struct (and ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderHostRef")," to be used in tests, but do not implement the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer")," trait). Having an address, in the module context we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"AdderContractRef::new(self.env(), address).add(3, 5)\n")),(0,r.kt)("h3",{id:"loading-the-contract"},"Loading the contract"),(0,r.kt)("p",null,"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test\nour contracts in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/livenet"},"Livenet")," backend. We can load the contract using ",(0,r.kt)("inlineCode",{parentName:"p"},"load")," method on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/bin/erc20_on_livenet.rs"',title:'"examples/bin/erc20_on_livenet.rs"'},'fn _load(env: &HostEnv) -> Erc20HostRef {\n let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n let address = Address::from_str(address).unwrap();\n ::load(env, address)\n}\n')),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};\n use odra::host::{Deployer, HostRef, NoArgs};\n\n #[test]\n fn test_cross_calls() {\n let test_env = odra_test::env();\n let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);\n\n let init_args = CrossContractInitArgs {\n math_engine_address: *math_engine_contract.address()\n };\n let cross_contract = CrossContractHostRef::deploy(&test_env, init_args);\n\n assert_eq!(cross_contract.add_using_another(), 8);\n }\n}\n")),(0,r.kt)("p",null,"Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that we intend to utilize."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{Address, host::{Deployer, HostRef, NoArgs}};\n \n #[test]\n fn test_ext() {\n let test_env = odra_test::env();\n let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address(test_env: &HostEnv) -> Address {\n let contract = MathEngineHostRef::deploy(test_env, NoArgs);\n *contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/481896f1.fda457f3.js b/docs/assets/js/481896f1.fda457f3.js new file mode 100644 index 000000000..db06f167b --- /dev/null +++ b/docs/assets/js/481896f1.fda457f3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40906],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:11,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-0.8.1/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.8.1/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.8.1/basics/modules",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.8.1/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.8.1/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to the ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),' attribute. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\nuse odra::module::SubModule;\nuse odra::prelude::*;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: SubModule\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("admonition",{type:"important"},(0,o.kt)("p",{parentName:"admonition"},"To use a module as a component of another module, you need to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"SubModule")," type. This is a special type\nthat crates a keyspace (read more in ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.1/advanced/storage-layout"},"Storage Layout"),") and provide access to its public methods.")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the ",(0,o.kt)("inlineCode",{parentName:"p"},"MathEngine")," - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.1/examples/src/contracts/owned_token.rs"},"OwnedToken example")," in the main Odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"#[cfg(test)]\nmod tests {\n use super::ModulesContractHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);\n assert_eq!(modules_contract.add_using_module(), 8);\n }\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/48d43fc1.7508dbb8.js b/docs/assets/js/48d43fc1.7508dbb8.js new file mode 100644 index 000000000..fd52f4673 --- /dev/null +++ b/docs/assets/js/48d43fc1.7508dbb8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[96611],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},i="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/docs/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/next/basics/flipper-internals",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/next/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/next/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/next/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Var;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Var,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Var")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/next/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the attribute - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The function named ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," is the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," function is optional,\nif your contract does not need any initialization, you can skip it."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/host/trait.Deployer.html#tymethod.deploy"},(0,a.kt)("inlineCode",{parentName:"a"},"Deployer::deploy"))," function called on ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperHostRef")," - a piece of code generated\nby the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),". Because the module implements the constructor but does not accept any arguments,\nas the second argument of the deploy function, we pass ",(0,a.kt)("inlineCode",{parentName:"p"},"NoArgs")," - one of the implementations of\nthe ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/host/trait.InitArgs.html"},(0,a.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait provided with the framework. "),(0,a.kt)("p",null,"The contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4913a3b5.3ce4fa7d.js b/docs/assets/js/4913a3b5.3ce4fa7d.js new file mode 100644 index 000000000..9da8dfe0e --- /dev/null +++ b/docs/assets/js/4913a3b5.3ce4fa7d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[36653],{11837:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.9.1","label":"0.9.1","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.9.1","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.9.1/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.9.1/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.9.1/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.9.1/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.9.1/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.9.1/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.9.1/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.9.1/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.9.1/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.9.1/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.9.1/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.9.1/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.9.1/basics/events","docId":"basics/events"},{"type":"link","label":"Casper Contract Schema","href":"/docs/0.9.1/basics/casper-contract-schema","docId":"basics/casper-contract-schema"},{"type":"link","label":"Cross calls","href":"/docs/0.9.1/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.9.1/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.9.1/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.9.1/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Delegate","href":"/docs/0.9.1/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.9.1/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.9.1/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Storage Layout","href":"/docs/0.9.1/advanced/storage-layout","docId":"advanced/storage-layout"},{"type":"link","label":"Memory allocators","href":"/docs/0.9.1/advanced/using-different-allocator","docId":"advanced/using-different-allocator"},{"type":"link","label":"Building contracts manually","href":"/docs/0.9.1/advanced/building-manually","docId":"advanced/building-manually"}],"href":"/docs/0.9.1/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.9.1/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"OdraVM","href":"/docs/0.9.1/backends/odra-vm","docId":"backends/odra-vm"},{"type":"link","label":"Casper","href":"/docs/0.9.1/backends/casper","docId":"backends/casper"},{"type":"link","label":"Livenet","href":"/docs/0.9.1/backends/livenet","docId":"backends/livenet"}],"href":"/docs/0.9.1/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.9.1/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.9.1/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.9.1/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.9.1/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.9.1/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.9.1/tutorials/owned-token","docId":"tutorials/owned-token"},{"type":"link","label":"Access Control","href":"/docs/0.9.1/tutorials/access-control","docId":"tutorials/access-control"},{"type":"link","label":"Pausable","href":"/docs/0.9.1/tutorials/pauseable","docId":"tutorials/pauseable"},{"type":"link","label":"Build, Deploy and Read the State of a Contract","href":"/docs/0.9.1/tutorials/build-deploy-read","docId":"tutorials/build-deploy-read"},{"type":"link","label":"Using Proxy Caller","href":"/docs/0.9.1/tutorials/using-proxy-caller","docId":"tutorials/using-proxy-caller"}],"href":"/docs/0.9.1/category/tutorials"},{"type":"category","label":"Migrations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Migration guide to v0.8.0","href":"/docs/0.9.1/migrations/to-0.8.0","docId":"migrations/to-0.8.0"},{"type":"link","label":"Migration guide to v0.9.0","href":"/docs/0.9.1/migrations/to-0.9.0","docId":"migrations/to-0.9.0"}],"href":"/docs/0.9.1/category/migrations"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that","sidebar":"tutorialSidebar"},"advanced/building-manually":{"id":"advanced/building-manually","title":"Building contracts manually","description":"cargo odra is a great tool to build and test your contracts, but sometimes","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/storage-layout":{"id":"advanced/storage-layout","title":"Storage Layout","description":"Odra\'s innovative modular design necessitates a unique storage layout. This","sidebar":"tutorialSidebar"},"advanced/using-different-allocator":{"id":"advanced/using-different-allocator","title":"Memory allocators","description":"When compiling contracts to wasm, your code needs to be no-std.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/livenet":{"id":"backends/livenet","title":"Livenet","description":"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local","sidebar":"tutorialSidebar"},"backends/odra-vm":{"id":"backends/odra-vm","title":"OdraVM","description":"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/casper-contract-schema":{"id":"basics/casper-contract-schema","title":"Casper Contract Schema","description":"Casper Contract Schema","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"migrations/to-0.8.0":{"id":"migrations/to-0.8.0","title":"Migration guide to v0.8.0","description":"Migration guide to v0.8.0","sidebar":"tutorialSidebar"},"migrations/to-0.9.0":{"id":"migrations/to-0.9.0","title":"Migration guide to v0.9.0","description":"Migration guide to v0.9.0","sidebar":"tutorialSidebar"},"tutorials/access-control":{"id":"tutorials/access-control","title":"Access Control","description":"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,","sidebar":"tutorialSidebar"},"tutorials/build-deploy-read":{"id":"tutorials/build-deploy-read","title":"Build, Deploy and Read the State of a Contract","description":"In this guide, we will show the full path from creating a contract, deploying it and reading the state.","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"},"tutorials/pauseable":{"id":"tutorials/pauseable","title":"Pausable","description":"The Pausable module is like your smart contract\'s safety switch. It lets authorized users temporarily pause certain features if needed. It\'s a great way to boost security, but it\'s not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.","sidebar":"tutorialSidebar"},"tutorials/using-proxy-caller":{"id":"tutorials/using-proxy-caller","title":"Using Proxy Caller","description":"In this tutorial, we will learn how to use the proxycaller wasm to call an Odra payable function. The proxycaller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/496b44fb.57bc7548.js b/docs/assets/js/496b44fb.57bc7548.js new file mode 100644 index 000000000..9b1460b21 --- /dev/null +++ b/docs/assets/js/496b44fb.57bc7548.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[4266],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(t),m=o,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.4.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.4.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.4.0/tutorials/owned-token",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.4.0/tutorials/erc20"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function c(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow minting tokens but only the module owner."),(0,o.kt)("li",{parentName:"ol"},"The current owner should be able to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use odra::types::{Address, Balance}\n\n...\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.ownable.ensure_ownership(&contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L11")," - A constructor is a great place to init both modules at once. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L14-L16")," - Most of the entrypoints do not need any modification, so we simply delegates them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L52")," - The same we do with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L58-L61")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4972.4e40c906.js b/docs/assets/js/4972.4e40c906.js new file mode 100644 index 000000000..d3fbbc77a --- /dev/null +++ b/docs/assets/js/4972.4e40c906.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[4972],{4972:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});var n=a(67294),l=a(95999),o=a(1944),r=a(12684);function i(){return n.createElement(n.Fragment,null,n.createElement(o.d,{title:(0,l.I)({id:"theme.NotFound.title",message:"Page Not Found"})}),n.createElement(r.Z,null,n.createElement("main",{className:"container margin-vert--xl"},n.createElement("div",{className:"row"},n.createElement("div",{className:"col col--6 col--offset-3"},n.createElement("h1",{className:"hero__title"},n.createElement(l.Z,{id:"theme.NotFound.title",description:"The title of the 404 page"},"Page Not Found")),n.createElement("p",null,n.createElement(l.Z,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page"},"We could not find what you were looking for.")),n.createElement("p",null,n.createElement(l.Z,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page"},"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))))}}}]); \ No newline at end of file diff --git a/docs/assets/js/4a017cdd.aae1cda4.js b/docs/assets/js/4a017cdd.aae1cda4.js new file mode 100644 index 000000000..395053d46 --- /dev/null +++ b/docs/assets/js/4a017cdd.aae1cda4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52827],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="OdraVM",c={unversionedId:"backends/odra-vm",id:"version-0.9.0/backends/odra-vm",title:"OdraVM",description:"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.9.0/backends/02-odra-vm.md",sourceDirName:"backends",slug:"/backends/odra-vm",permalink:"/docs/0.9.0/backends/odra-vm",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.9.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.9.0/backends/casper"}},s={},d=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],l={toc:d};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odravm"},"OdraVM"),(0,a.kt)("p",null,"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time -\nsimply use your IDE's debug functionality."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The OdraVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"OdraVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is a list of contracts deployed onto the OdraVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the OdraVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe OdraVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the OdraVM.\nThanks to this and the fact that we do not need the blockchain itself,\nOdraVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the OdraVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Container"),".\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, OdraVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(OdraVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4a070847.d2e30f72.js b/docs/assets/js/4a070847.d2e30f72.js new file mode 100644 index 000000000..233130c9e --- /dev/null +++ b/docs/assets/js/4a070847.d2e30f72.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90357],{36834:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/category/examples","navigation":{"previous":{"title":"Livenet","permalink":"/docs/backends/livenet"},"next":{"title":"odra-examples","permalink":"/docs/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/4ba42032.7cba8fbc.js b/docs/assets/js/4ba42032.7cba8fbc.js new file mode 100644 index 000000000..c64f418fd --- /dev/null +++ b/docs/assets/js/4ba42032.7cba8fbc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[51096],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="OdraVM",c={unversionedId:"backends/odra-vm",id:"version-1.0.0/backends/odra-vm",title:"OdraVM",description:"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-1.0.0/backends/02-odra-vm.md",sourceDirName:"backends",slug:"/backends/odra-vm",permalink:"/docs/backends/odra-vm",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/backends/casper"}},s={},d=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],l={toc:d};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odravm"},"OdraVM"),(0,a.kt)("p",null,"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time -\nsimply use your IDE's debug functionality."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The OdraVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"OdraVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is a list of contracts deployed onto the OdraVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the OdraVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe OdraVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the OdraVM.\nThanks to this and the fact that we do not need the blockchain itself,\nOdraVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the OdraVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Container"),".\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, OdraVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(OdraVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4c38ccb3.351ab798.js b/docs/assets/js/4c38ccb3.351ab798.js new file mode 100644 index 000000000..624971fc6 --- /dev/null +++ b/docs/assets/js/4c38ccb3.351ab798.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[58552],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:12,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-0.9.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.9.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.9.0/basics/modules",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.9.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.9.0/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to the ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),' attribute. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\nuse odra::module::SubModule;\nuse odra::prelude::*;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: SubModule\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("admonition",{type:"important"},(0,o.kt)("p",{parentName:"admonition"},"To use a module as a component of another module, you need to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"SubModule")," type. This is a special type\nthat crates a keyspace (read more in ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.0/advanced/storage-layout"},"Storage Layout"),") and provide access to its public methods.")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the ",(0,o.kt)("inlineCode",{parentName:"p"},"MathEngine")," - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/examples/src/contracts/owned_token.rs"},"OwnedToken example")," in the main Odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"#[cfg(test)]\nmod tests {\n use super::ModulesContractHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);\n assert_eq!(modules_contract.add_using_module(), 8);\n }\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4cd738bd.ccbc4af1.js b/docs/assets/js/4cd738bd.ccbc4af1.js new file mode 100644 index 000000000..d32015174 --- /dev/null +++ b/docs/assets/js/4cd738bd.ccbc4af1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[78322],{84876:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/4d5b435f.f4706a13.js b/docs/assets/js/4d5b435f.f4706a13.js new file mode 100644 index 000000000..4e2798c7b --- /dev/null +++ b/docs/assets/js/4d5b435f.f4706a13.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67530],{13555:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.8.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.8.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.8.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/4da81bc4.a67502da.js b/docs/assets/js/4da81bc4.a67502da.js new file mode 100644 index 000000000..ef394e5a8 --- /dev/null +++ b/docs/assets/js/4da81bc4.a67502da.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[30663],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),u=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=u(t),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return t?a.createElement(w,o(o({ref:n},d),{},{components:t})):a.createElement(w,o({ref:n},d))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.6.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.6.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.6.0/tutorials/ownable",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.6.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.6.0/tutorials/erc20"}},s={},u=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining constructors,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{types::Address, Variable};\n\n#[odra::module]\npub struct Ownable {\n owner: Variable
\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basic before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - Firstly, we need create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," to it above."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n execution_error, contract_env, Event, types::{Address, event::OdraEvent}\n};\n...\n\n#[odra::module]\nimpl Ownable {\n #[odra(init)]\n pub fn init(&mut self, owner: &Address) {\n if self.owner.get().is_some() {\n contract_env::revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(*owner);\n \n OwnershipChanged {\n prev_owner: None,\n new_owner: *owner\n }\n .emit();\n }\n}\n\nexecution_error! {\n pub enum Error {\n OwnerIsNotInitialized => 1,\n }\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is marked as ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]")," making it a constructor. It matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum is defined inside the ",(0,r.kt)("inlineCode",{parentName:"li"},"execution_error")," macro. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9-L11")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::revert()")," function. As an argument we pass ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsNotInitialized"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L13")," - Then we write the owner passed as an argument to the storage. To do so we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29-L33")," - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Finally, we create the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," struct and call ",(0,r.kt)("inlineCode",{parentName:"li"},"emit()")," function on it (import ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent")," trait). Hence we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get().as_ref() {\n contract_env::revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&contract_env::caller());\n let current_owner = self.get_owner();\n self.owner.set(*new_owner);\n OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n }\n .emit();\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get() {\n Some(owner) => owner,\n None => contract_env::revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\nexecution_error! {\n pub enum Error {\n NotOwner => 1,\n OwnerIsAlreadyInitialized => 2,\n OwnerIsNotInitialized => 3,\n }\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5,L32")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," is reads the current owner, and reverts if is does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::caller()")," function. The we update the state, and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22,L34")," - Lastly, a getter function. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable")," ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returns an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),", we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),".")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{assert_events, test_env};\n\n fn setup() -> (Address, OwnableRef) {\n let owner = test_env::get_account(0);\n let ownable = OwnableDeployer::init(owner);\n (owner, ownable)\n }\n\n #[test]\n fn initialization_works() {\n let (owner, ownable) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (owner, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n \n test_env::set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (_, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n ownable.change_ownership(&new_owner);\n \n test_env::assert_exception(Error::NotOwner, || {\n ownable.change_ownership(&new_owner);\n });\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we call as the first statement in each test. Take a look at the signature ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (Address, OwnableRef)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableRef")," is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Now, the module needs an owner, the easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env"),". We choose the address of first account (which is the default one)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Odra created for us ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableDeployer")," struct which implements all constructor functions. In this case there is just one function - ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which corresponds the function we have implemented in the module."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - It is time to define the first test. As you see, it is a regular rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14-15")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-23")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events"),". As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30")," - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"test env")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L32")," - As mentioned, the default is the 0-th account, if you want to change the executor call the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L49-55")," - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::assert_exception()")," with the error you expect and a failing block of code.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4da873a0.a57433e3.js b/docs/assets/js/4da873a0.a57433e3.js new file mode 100644 index 000000000..9eafc0f7d --- /dev/null +++ b/docs/assets/js/4da873a0.a57433e3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[19431],{3905:(t,e,n)=>{n.d(e,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function s(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var l=a.createContext({}),c=function(t){var e=a.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},p=function(t){var e=c(t.components);return a.createElement(l.Provider,{value:e},t.children)},d={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,l=t.parentName,p=i(t,["components","mdxType","originalType","parentName"]),u=c(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?a.createElement(h,s(s({ref:e},p),{},{components:n})):a.createElement(h,s({ref:e},p))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in e)hasOwnProperty.call(e,l)&&(i[l]=e[l]);i.originalType=t,i.mdxType="string"==typeof t?t:r,s[1]=i;for(var c=2;c{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.9.1/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.9.1/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.9.1/basics/testing",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.9.1/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.9.1/basics/errors"}},l={},c=[{value:"HostEnv",id:"hostenv",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(t){let{components:e,...n}=t;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{List, Var};\n\n#[cfg(test)]\nmod tests {\n use super::{DogContract3HostRef, DogContract3InitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn init_test() {\n let test_env = odra_test::env();\n let init_args = DogContract3InitArgs {\n name: "DogContract".to_string()\n };\n let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,r.kt)("p",null,"The first interesting thing you may notice is placed the import section."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use super::{DogContract3HostRef, DogContract3InitArgs};\nuse odra::{host::Deployer, prelude::*};\n")),(0,r.kt)("p",null,"We are using ",(0,r.kt)("inlineCode",{parentName:"p"},"super")," to import the ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," from the parent module.\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}InitArgs")," are types that was generated for us by Odra."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," is a reference to the contract that we can use to interact with it (call entrypoints)\nand implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.HostRef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostRef"))," trait. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," is a struct that we use to initialize the contract and implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.InitArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait.\nConsidering the contract initialization, there three possible scenarios:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with arguments, then Odra creates a struct named ",(0,r.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with no arguments, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract does not have a constructor, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),".\nAll of those structs implement the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::InitArgs")," trait, required to conform to the\n",(0,r.kt)("inlineCode",{parentName:"li"},"Deployer::deploy")," method signature. ")),(0,r.kt)("p",null,"The other import is ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::host::Deployer"),". This is a trait is used to deploy the contract and give us a reference to it."),(0,r.kt)("p",null,"Let's take a look at the test itself. How to obtain a reference to the contract?\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," implements the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.Deployer.html"},(0,r.kt)("inlineCode",{parentName:"a"},"Deployer"))," trait, which provides the ",(0,r.kt)("inlineCode",{parentName:"p"},"deploy")," method:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n")),(0,r.kt)("p",null,"From now on, we can use ",(0,r.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute are available to us:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,r.kt)("h2",{id:"hostenv"},"HostEnv"),(0,r.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};\n use odra::{host::{Deployer, HostEnv}, prelude::*};\n\n #[test]\n fn env() {\n let test_env: HostEnv = odra_test::env();\n test_env.set_caller(test_env.get_account(0));\n let init_args = TestingContractInitArgs {\n name: "MyContract".to_string()\n };\n let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);\n let creator = testing_contract.created_by();\n test_env.set_caller(test_env.get_account(1));\n let init_args = TestingContractInitArgs {\n name: "MyContract2".to_string()\n };\n let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);\n let creator2 = testing_contract2.created_by();\n assert_ne!(creator, creator2);\n }\n}\n')),(0,r.kt)("p",null,"In the code above, at the beginning of the test, we are obtaining a ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," instance using ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_test::env()"),".\nNext, we are deploying two instances of the same contract, but we're using ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::ContractEnv::caller()"),"\nthe function we are calling inside the contract."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a set of functions that will let you write better tests:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn set_caller(&self, address: Address)")," - you've seen it in action just now"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn balance_of(&self, address: &Address) -> U512")," - returns the balance of the account associated with the given address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn advance_block_time(&self, time_diff: u64)")," - increases the current value of ",(0,r.kt)("inlineCode",{parentName:"li"},"block_time")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn get_account(&self, n: usize) -> Address")," - returns an n-th address that was prepared for you by Odra in advance;\nby default, you start with the 0-th account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn emitted_event(&self, contract_address: &Address, event: &T) -> bool")," - verifies if the event was emitted by the contract")),(0,r.kt)("p",null,"Full list of functions can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/struct.HostEnv.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We take a look at how Odra handles errors!"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4dd99f24.d76438ac.js b/docs/assets/js/4dd99f24.d76438ac.js new file mode 100644 index 000000000..241db58cc --- /dev/null +++ b/docs/assets/js/4dd99f24.d76438ac.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62082],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=p;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var u=2;u{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>w});var a=n(87462),r=n(67294),s=n(86010),i=n(12466),o=n(16550),l=n(91980),u=n(67392),c=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,o.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function y(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[i,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[l,u]=h({queryString:n,groupId:a}),[d,y]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=l??d;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{b&&o(b)}),[b]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);o(e),u(e),y(e)}),[u,y,s]),tabValues:s}}var b=n(72389);const g="tabList__CuJ",f="tabItem_LNqP";function _(e){let{className:t,block:n,selectedValue:o,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),p=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==o&&(d(t),l(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:p},i,{className:(0,s.Z)("tabs__item",f,i?.className,{"tabs__item--active":o===t})}),n??t)})))}function k(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=y(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",g)},r.createElement(_,(0,a.Z)({},e,t)),r.createElement(k,(0,a.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},16997:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),i=n(85162);const o={sidebar_position:6},l="Build, Deploy and Read the State of a Contract",u={unversionedId:"tutorials/build-deploy-read",id:"version-0.8.1/tutorials/build-deploy-read",title:"Build, Deploy and Read the State of a Contract",description:"In this guide, we will show the full path from creating a contract, deploying it and reading the state.",source:"@site/versioned_docs/version-0.8.1/tutorials/build-deploy-read.md",sourceDirName:"tutorials",slug:"/tutorials/build-deploy-read",permalink:"/docs/0.8.1/tutorials/build-deploy-read",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"tutorialSidebar",previous:{title:"Pausable",permalink:"/docs/0.8.1/tutorials/pauseable"},next:{title:"Migrations",permalink:"/docs/0.8.1/category/migrations"}},c={},d=[{value:"Contract",id:"contract",level:3},{value:"Deploying the contract",id:"deploying-the-contract",level:3},{value:"Storage Layout",id:"storage-layout",level:3},{value:"Reading the state",id:"reading-the-state",level:3}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"build-deploy-and-read-the-state-of-a-contract"},"Build, Deploy and Read the State of a Contract"),(0,r.kt)("p",null,"In this guide, we will show the full path from creating a contract, deploying it and reading the state."),(0,r.kt)("p",null,"We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript."),(0,r.kt)("p",null,"Before you start, make sure you completed the following steps:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Read the ",(0,r.kt)("a",{parentName:"li",href:"../category/getting-started"},"Getting Started")," guide"),(0,r.kt)("li",{parentName:"ul"},"Get familiar with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.casper.network/developers/dapps/setup-nctl/"},"NCTL tutorial")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/make-software/casper-nctl-docker"},"NCTL docker")," image"),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/casper-ecosystem/casper-client-rs"},"casper-client"))),(0,r.kt)("h3",{id:"contract"},"Contract"),(0,r.kt)("p",null,"Let's write a contract with complex storage layout."),(0,r.kt)("p",null,"The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"."),(0,r.kt)("p",null,"We will expose two methods:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The constructor ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," which sets the metadata and the version of the contract."),(0,r.kt)("li",{parentName:"ol"},"The method ",(0,r.kt)("inlineCode",{parentName:"li"},"set_data")," which sets the value of the numeric field and the values of the mapping.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=custom_item.rs showLineNumbers",title:"custom_item.rs",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, Mapping, OdraType, SubModule, Var};\n\n// A custom type with a vector of another custom type\n#[derive(OdraType, Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[derive(OdraType, Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\n// The main contract with a version, metadata and a submodule\n#[odra::module]\npub struct CustomItem {\n version: Var,\n meta: Var,\n data: SubModule\n}\n\n#[odra::module]\nimpl CustomItem {\n pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {\n let meta = Metadata {\n name,\n description,\n prices: vec![\n Price { value: price_1 },\n Price { value: price_2 }\n ]\n };\n self.meta.set(meta);\n self.version.set(self.version.get_or_default() + 1);\n }\n\n pub fn set_data(&mut self, value: u32, name: String, name2: String) {\n self.data.value.set(value);\n self.data.inner.named_values.set(&name, 10);\n self.data.inner.named_values.set(&name2, 20);\n }\n}\n\n// A submodule with a numeric value and another submodule\n#[odra::module]\nstruct Data {\n value: Var,\n inner: SubModule,\n}\n\n// A submodule with a mapping\n#[odra::module]\nstruct InnerData {\n named_values: Mapping,\n}\n\n")),(0,r.kt)("h3",{id:"deploying-the-contract"},"Deploying the contract"),(0,r.kt)("p",null,"First, we need to setup the chain. We will use the NCTL docker image to run a local network."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Next, we need to compile the contract to a Wasm file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra build -c custom_item \n")),(0,r.kt)("p",null,"Then, we can deploy the contract using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"casper-client put-deploy \\\n --node-address http://localhost:11101 \\\n --chain-name casper-net-1 \\\n --secret-key path/to/your/secret_key.pem \\ \n --session-path [PATH_TO_WASM] \\\n --payment-amount 100000000000 \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'test_contract_package_hash'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'true'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n --session-arg \"name:string='My Name'\" \\\n --session-arg \"description:string='My Description'\" \\ \n --session-arg \"price_1:u256='101'\" \\\n --session-arg \"price_2:u256='202'\"\n")),(0,r.kt)("p",null,"Finally, we can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"set_data")," method to set the values of the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'casper-client put-deploy \\\n --node-address http://localhost:11101 \\ \n --chain-name casper-net-1 \\\n --secret-key ./keys/secret_key.pem \\ \n --payment-amount 2000000000 \\\n --session-hash [DEPLOYED_CONTRACT_HASH] \\\n --session-entry-point "set_data" \\\n --session-arg "value:u32:\'666\'" \\\n --session-arg "name:string=\'alice\'" \\ \n --session-arg "name2:string=\'bob\'"\n')),(0,r.kt)("h3",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"To read the state of the contract, we need to understand the storage layout."),(0,r.kt)("p",null,"The first step is to calculate the index of the keys. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Storage Layout\n\nCustomItem: prefix: 0x0..._0000_0000_0000 0\n version: u32, 0x0..._0000_0000_0000 0\n meta: Metadata, 0x0..._0000_0000_0001 1\n data: Data: prefix: 0x0..._0000_0010_0000 (2 << 4)\n value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0\n inner: InnerData: prefix: 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4\n named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0\n")),(0,r.kt)("p",null,"The actual key is obtained as follows:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Convert the index to a big-endian byte array."),(0,r.kt)("li",{parentName:"ol"},"Concatenate the index with the mapping data."),(0,r.kt)("li",{parentName:"ol"},"Hash the concatenated bytes using blake2b."),(0,r.kt)("li",{parentName:"ol"},"Return the hex representation of the hash (the stored key must be utf-8 encoded).")),(0,r.kt)("p",null,"In more detail, the storage layout is described in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/advanced/storage-layout"},"Storage Layout article"),"."),(0,r.kt)("h3",{id:"reading-the-state"},"Reading the state"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=main.rs showLineNumbers",title:"main.rs",showLineNumbers:!0},'use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};\nuse casper_types::{\n bytesrepr::{FromBytes, ToBytes},\n U256,\n};\n\n// replace with your contract hash\nconst CONTRACT_HASH: &str = "hash-...";\nconst NODE_ADDRESS: &str = "http://localhost:11101/rpc";\nconst RPC_ID: &str = "casper-net-1";\nconst DICTIONARY_NAME: &str = "state";\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\nasync fn read_state_key(key: String) -> Vec {\n let state_root_hash = casper_client::get_state_root_hash(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n None,\n )\n .await\n .unwrap()\n .result\n .state_root_hash\n .unwrap();\n\n // Read the value from the `state` dictionary.\n let result = casper_client::get_dictionary_item(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n state_root_hash,\n DictionaryItemIdentifier::ContractNamedKey {\n key: CONTRACT_HASH.to_string(),\n dictionary_name: DICTIONARY_NAME.to_string(),\n dictionary_item_key: key,\n },\n )\n .await\n .unwrap()\n .result\n .stored_value;\n\n // We expect the value to be a CLValue\n if let StoredValue::CLValue(cl_value) = result {\n // Ignore the first 4 bytes, which are the length of the CLType.\n cl_value.inner_bytes()[4..].to_vec()\n } else {\n vec![]\n }\n}\n\nasync fn metadata() -> Metadata {\n // The key for the metadata is 1, and it has no mapping data\n let key = key(1, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the name and store the remaining bytes\n let (name, bytes) = String::from_bytes(&bytes).unwrap();\n // Read the description and store the remaining bytes\n let (description, bytes) = String::from_bytes(&bytes).unwrap();\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();\n\n let mut prices = vec![];\n // As we know the size of the vector, we can loop over it\n for _ in 0..size {\n // Read the value and store the remaining bytes\n let (value, rem) = U256::from_bytes(&bytes).unwrap();\n bytes = rem;\n prices.push(Price { value });\n }\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n Metadata {\n name,\n description,\n prices\n }\n}\n\nasync fn value() -> u32 {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n let key = key(2 << 4, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nasync fn named_value(name: &str) -> u32 {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = name.to_bytes().unwrap();\n let key = key(((2 << 4) + 1) << 4, &mapping_data);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nfn main() {\n let runtime = tokio::runtime::Runtime::new().unwrap();\n dbg!(runtime.block_on(metadata()));\n dbg!(runtime.block_on(value()));\n dbg!(runtime.block_on(named_value("alice")));\n dbg!(runtime.block_on(named_value("bob")));\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfn key(idx: u32, mapping_data: &[u8]) -> String {\n let mut key = Vec::new();\n key.extend_from_slice(idx.to_be_bytes().as_ref());\n key.extend_from_slice(mapping_data);\n let hashed_key = blake2b(&key);\n\n hex::encode(&hashed_key)\n}\n\nfn blake2b(bytes: &[u8]) -> [u8; 32] {\n let mut result = [0u8; 32];\n let mut hasher = ::new(32)\n .expect("should create hasher");\n let _ = std::io::Write::write(&mut hasher, bytes);\n blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)\n .expect("should copy hash to the result array");\n result\n}\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'cargo run\n[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {\n name: "My Contract",\n description: "My Description",\n prices: [\n Price {\n value: 123,\n },\n Price {\n value: 321,\n },\n ],\n}\n[src/main.rs:117:5] runtime.block_on(value()) = 666\n[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20\n[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10\n'))),(0,r.kt)(i.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'\nimport { blake2bHex } from "blakejs";\nimport {\n CLList,\n CLListBytesParser,\n CLStringBytesParser,\n CLU256BytesParser,\n CLU32BytesParser,\n CLU8,\n CLValueBuilder,\n CasperClient,\n CasperServiceByJsonRPC,\n Contracts,\n ToBytes,\n} from "casper-js-sdk";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\n// replace with your contract hash\nconst CONTRACT_HASH = "hash-...";\nconst STATE_DICTIONARY_NAME = "state";\nconst U32_SIZE = 4;\n\nclass Price {\n value: bigint;\n\n constructor(value: bigint) {\n this.value = value;\n }\n}\n\nclass Metadata {\n name: string;\n description: string;\n prices: Price[];\n\n constructor(name: string, description: string, prices: Price[]) {\n this.name = name;\n this.description = description;\n this.prices = prices;\n }\n}\n\nexport class Contract {\n client: CasperClient;\n service: CasperServiceByJsonRPC;\n contract: Contracts.Contract;\n\n private constructor() {\n this.client = new CasperClient(LOCAL_NODE_URL);\n this.service = new CasperServiceByJsonRPC(LOCAL_NODE_URL);\n this.contract = new Contracts.Contract(this.client);\n this.contract.setContractHash(CONTRACT_HASH);\n }\n\n static async load() {\n return new Contract();\n }\n\n async read_state(key: string) {\n const response = await this.contract.queryContractDictionary(STATE_DICTIONARY_NAME, key);\n let data: CLList = CLValueBuilder.list(response.value());\n let bytes = new CLListBytesParser().toBytes(data).unwrap();\n // Ignore the first 4 bytes, which are the length of the CLType\n return bytes.slice(4);\n }\n\n async metadata() {\n // The key for the metadata is 1, and it has no mapping data\n let bytes: Uint8Array = await this.read_state(key(1));\n\n // Read the name and store the remaining bytes\n let name = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = name.remainder as Uint8Array;\n\n // Read the description and store the remaining bytes\n let description = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = description.remainder as Uint8Array;\n\n let prices: Price[] = [];\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let size = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n bytes = size.remainder as Uint8Array;\n\n // As we know the size of the vector, we can loop over it\n for (let i = 0; i < size.result.unwrap().data.toNumber(); i++) {\n let price = new CLU256BytesParser().fromBytesWithRemainder(bytes);\n bytes = price.remainder as Uint8Array;\n prices.push(new Price(price.result.unwrap().data.toBigInt()));\n }\n\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n return new Metadata(\n name.result.unwrap().data,\n description.result.unwrap().data,\n prices\n );\n }\n \n async value() {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n const bytes = await this.read_state(key((2 << 4) + 0));\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n\n async named_value(name: string) {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = new CLStringBytesParser()\n .toBytes(CLValueBuilder.string(name))\n .unwrap();\n let bytes: Uint8Array = await this.read_state(\n key(((2 << 4) + 1) << 4, mapping_data)\n );\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfunction key(idx: number, mapping_data: Uint8Array = new Uint8Array([])) {\n let key = new Uint8Array(U32_SIZE + mapping_data.length);\n new DataView(key.buffer).setUint32(0, idx, false); // false for big-endian\n key.set(mapping_data, U32_SIZE);\n\n return blake2bHex(key, undefined, 32);\n}\n\nconst contract = Contract.load();\ncontract.then(async (c) => {\n console.log(await c.value());\n console.log(await c.metadata());\n console.log(await c.named_value("alice"));\n console.log(await c.named_value("bob"));\n});\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \nMetadata {\n name: 'My Contract',\n description: 'My Description',\n prices: [ Price { value: 123n }, Price { value: 321n } ]\n}\n666n\n20n\n10n\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4e50b37d.caab9145.js b/docs/assets/js/4e50b37d.caab9145.js new file mode 100644 index 000000000..603be1a85 --- /dev/null +++ b/docs/assets/js/4e50b37d.caab9145.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[71588],{64570:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.4.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.4.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.4.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/4e69c95d.6f130810.js b/docs/assets/js/4e69c95d.6f130810.js new file mode 100644 index 000000000..6c6e7cedb --- /dev/null +++ b/docs/assets/js/4e69c95d.6f130810.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[60],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=l(n),d=o,f=p["".concat(c,".").concat(d)]||p[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.8.1/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.8.1/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.8.1/basics/communicating-with-host",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.8.1/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.8.1/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],u={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::prelude::*;\nuse odra::{Address, module::Module, Var};\n\n#[odra::module]\npub struct HostContract {\n name: Var,\n created_at: Var,\n created_by: Var
\n}\n\n#[odra::module]\nimpl HostContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(self.env().get_block_time());\n self.created_by.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"self.env()"),". It is an implementation of ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/module/trait.Module.html#tymehtod.env"},(0,o.kt)("inlineCode",{parentName:"a"},"Module::env()")),", autogenerated\nby ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. The function returns a reference to the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/struct.ContractEnv.html"},(0,o.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," (you can read more in\nthe ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/what-is-a-backend#contract-env"},(0,o.kt)("inlineCode",{parentName:"a"},"Backend section")),"). This is a structure that provides access to the host functions and variables. "),(0,o.kt)("p",null,"In this example, we use two of them:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"get_block_time()")," - returns the current block time as u64. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"caller()")," - returns an Odra ",(0,o.kt)("inlineCode",{parentName:"li"},"Address")," of the caller (this can be an external caller or another contract).")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/4f40819b.7895a349.js b/docs/assets/js/4f40819b.7895a349.js new file mode 100644 index 000000000..01e1aa7b5 --- /dev/null +++ b/docs/assets/js/4f40819b.7895a349.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[20874],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,v=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.5.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.5.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.5.0/basics/events",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.5.0/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.5.0/basics/cross-calls"}},l={},c=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Different blockchains implement events in different ways. Odra lets you forget about it by introducing\nOdra Events. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::{Event, contract_env};\nuse odra::types::{Address, BlockTime, event::OdraEvent};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract {\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n\n#[odra::module]\nimpl PartyContract {\n #[odra(init)]\n pub fn init(&self) {\n PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n }.emit();\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, we derive an ",(0,a.kt)("inlineCode",{parentName:"p"},"Event")," macro like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n")),(0,a.kt)("p",null,"Among other things, it adds an ",(0,a.kt)("inlineCode",{parentName:"p"},"emit()")," function to the struct, which allows you to emit the event simply\nas that:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n}.emit();\n")),(0,a.kt)("p",null,"Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. "),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a handy macro ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::{assert_events, test_env};\nuse crate::features::events::PartyStarted;\nuse super::PartyContractDeployer;\n\n#[test]\nfn test_party() {\n let party_contract = PartyContractDeployer::init();\n assert_events!(\n party_contract,\n PartyStarted {\n caller: test_env::get_account(0),\n block_time: 0,\n }\n );\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/509c4227.d8458b40.js b/docs/assets/js/509c4227.d8458b40.js new file mode 100644 index 000000000..4758eeb60 --- /dev/null +++ b/docs/assets/js/509c4227.d8458b40.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[50723],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(n),d=o,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.3.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.3.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.3.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"defaultSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.3.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.3.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],p={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/host.rs"',title:'"examples/src/docs/host.rs"'},"use odra::Variable;\nuse odra::types::{BlockTime, Address};\n\n#[odra::module]\npub struct HostContract {\n name: Variable,\n created_at: Variable,\n created_by: Variable
,\n}\n\n#[odra::module]\nimpl HostContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(odra::contract_env::get_block_time());\n self.created_by.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are calling functions from ",(0,o.kt)("inlineCode",{parentName:"p"},"odra::contract_env"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"get_block_time()")," will return\nthe current block time wrapped in Odra type ",(0,o.kt)("inlineCode",{parentName:"p"},"BlockTime"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"caller()")," will return an Odra ",(0,o.kt)("inlineCode",{parentName:"p"},"Address")," of\na caller (this can be an external caller or another contract)."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/51652154.1dd53f3b.js b/docs/assets/js/51652154.1dd53f3b.js new file mode 100644 index 000000000..c673d96b2 --- /dev/null +++ b/docs/assets/js/51652154.1dd53f3b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[16952],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,f=c["".concat(s,".").concat(m)]||c[m]||p[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-1.0.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-1.0.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/tutorials/owned-token",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/tutorials/erc20"},next:{title:"Access Control",permalink:"/docs/tutorials/access-control"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow only the module owner to mint tokens."),(0,o.kt)("li",{parentName:"ol"},"Enable the current owner to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::prelude::*;\nuse odra::module::SubModule;\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"...\nuse odra::{Address, casper_types::U256};\n...\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.ownable.ensure_ownership(&self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L9-L10")," - A constructor is an excellent place to initialize both modules at once."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L13-L15")," - Most of the entrypoints do not need any modification, so we simply delegate them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49-L51")," - The same is done with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L57-L60")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is indeed the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/51bf83ad.a7f729c4.js b/docs/assets/js/51bf83ad.a7f729c4.js new file mode 100644 index 000000000..e2231511e --- /dev/null +++ b/docs/assets/js/51bf83ad.a7f729c4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[87127],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),u=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=u(t),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return t?a.createElement(w,o(o({ref:n},d),{},{components:t})):a.createElement(w,o({ref:n},d))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.4.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.4.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.4.0/tutorials/ownable",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.4.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.4.0/tutorials/erc20"}},s={},u=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining constructors,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{types::Address, Variable};\n\n#[odra::module]\npub struct Ownable {\n owner: Variable
\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basic before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - Firstly, we need create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," to it above."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n execution_error, contract_env, Event, types::{Address, event::OdraEvent}\n};\n...\n\n#[odra::module]\nimpl Ownable {\n #[odra(init)]\n pub fn init(&mut self, owner: &Address) {\n if self.owner.get().is_some() {\n contract_env::revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(*owner);\n \n OwnershipChanged {\n prev_owner: None,\n new_owner: *owner\n }\n .emit();\n }\n}\n\nexecution_error! {\n pub enum Error {\n OwnerIsNotInitialized => 1,\n }\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is marked as ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]")," making it a constructor. It matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum is defined inside the ",(0,r.kt)("inlineCode",{parentName:"li"},"execution_error")," macro. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9-L11")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::revert()")," function. As an argument we pass ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsNotInitialized"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L13")," - Then we write the owner passed as an argument to the storage. To do so we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29-L33")," - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Finally, we create the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," struct and call ",(0,r.kt)("inlineCode",{parentName:"li"},"emit()")," function on it (import ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent")," trait). Hence we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get().as_ref() {\n contract_env::revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&contract_env::caller());\n let current_owner = self.get_owner();\n self.owner.set(*new_owner);\n OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n }\n .emit();\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get() {\n Some(owner) => owner,\n None => contract_env::revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\nexecution_error! {\n pub enum Error {\n NotOwner => 1,\n OwnerIsAlreadyInitialized => 2,\n OwnerIsNotInitialized => 3,\n }\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5,L32")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," is reads the current owner, and reverts if is does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::caller()")," function. The we update the state, and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22,L34")," - Lastly, a getter function. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable")," ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returns an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),", we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),".")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{assert_events, test_env};\n\n fn setup() -> (Address, OwnableRef) {\n let owner = test_env::get_account(0);\n let ownable = OwnableDeployer::init(owner);\n (owner, ownable)\n }\n\n #[test]\n fn initialization_works() {\n let (owner, ownable) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (owner, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n \n test_env::set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (_, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n ownable.change_ownership(&new_owner);\n \n test_env::assert_exception(Error::NotOwner, || {\n ownable.change_ownership(&new_owner);\n });\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we call as the first statement in each test. Take a look at the signature ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (Address, OwnableRef)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableRef")," is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Now, the module needs an owner, the easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env"),". We choose the address of first account (which is the default one)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Odra created for us ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableDeployer")," struct which implements all constructor functions. In this case there is just one function - ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which corresponds the function we have implemented in the module."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - It is time to define the first test. As you see, it is a regular rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14-15")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-23")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events"),". As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30")," - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"test env")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L32")," - As mentioned, the default is the 0-th account, if you want to change the executor call the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L49-55")," - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::assert_exception()")," with the error you expect and a failing block of code.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5326f0ca.9b6d5c53.js b/docs/assets/js/5326f0ca.9b6d5c53.js new file mode 100644 index 000000000..5c1e3a8ff --- /dev/null +++ b/docs/assets/js/5326f0ca.9b6d5c53.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[1378],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.9.1/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.9.1/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.9.1/examples/using-odra-modules",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.9.1/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.9.1/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.9.0"\n\n[dev-dependencies]\nodra-test = "0.9.0"\n\n[build-dependencies]\nodra-build = "0.9.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = "0.9.0"\nodra-modules = "0.9.0"\n')),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::prelude::*;\nuse odra::{Address, casper_types::U256, module::SubModule};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra repository"),".")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/53726ad7.78d3fcb6.js b/docs/assets/js/53726ad7.78d3fcb6.js new file mode 100644 index 000000000..c56735b7c --- /dev/null +++ b/docs/assets/js/53726ad7.78d3fcb6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[82288],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),c=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=c(n),m=o,f=p["".concat(i,".").concat(m)]||p[m]||d[m]||s;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,a=new Array(s);a[0]=p;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const s={sidebar_position:11,description:"Divide your code into modules"},a="Modules",l={unversionedId:"basics/modules",id:"version-0.3.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.3.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.3.0/basics/modules",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"defaultSidebar",previous:{title:"Cross calls",permalink:"/docs/0.3.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.3.0/basics/native-token"}},i={},c=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to a macro ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),'. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use crate::docs::cross_calls::MathEngine;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: MathEngine,\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use super::ModulesContractDeployer;\n\n#[test]\nfn test_modules() {\n let modules_contract = ModulesContractDeployer::default();\n assert_eq!(modules_contract.add_using_module(), 8);\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/54d8e0e1.12ac30d3.js b/docs/assets/js/54d8e0e1.12ac30d3.js new file mode 100644 index 000000000..5a67d4908 --- /dev/null +++ b/docs/assets/js/54d8e0e1.12ac30d3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[18914],{3905:(e,r,n)=>{n.d(r,{Zo:()=>c,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},c=function(e){var r=p(e.components);return t.createElement(l.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},u=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?t.createElement(f,s(s({ref:r},c),{},{components:n})):t.createElement(f,s({ref:r},c))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var p=2;p{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.9.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.9.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.9.0/basics/errors",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.9.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.9.0/basics/events"}},l={},p=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},c,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(errors = Error)]\npub struct OwnedContract {\n name: Var,\n owner: Var
\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerNotSet = 1,\n NotAnOwner = 2\n}\n\n#[odra::module]\nimpl OwnedContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = self.env().caller();\n if caller != self.owner() {\n self.env().revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,a.kt)("p",null,"Firstly, we are using the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.env().revert(Error::NotAnOwner)\n")),(0,a.kt)("p",null,"To register errors, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"errors")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute and pass the error type as the value. The registered errors will be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"Defining an error in Odra, you must keep in mind a few rules:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"An error should be a field-less enum. "),(0,a.kt)("li",{parentName:"ol"},"The enum must be annotated with ",(0,a.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]"),"."),(0,a.kt)("li",{parentName:"ol"},"Avoid implicit discriminants.")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'#[cfg(test)]\nmod tests {\n use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};\n use odra::host::Deployer;\n use odra::prelude::*;\n\n #[test]\n fn test_owner_error() {\n let test_env = odra_test::env();\n let owner = test_env.get_account(0);\n let not_an_owner = test_env.get_account(1);\n\n test_env.set_caller(owner);\n let init_args = OwnedContractInitArgs {\n name: "OwnedContract".to_string()\n };\n let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);\n\n test_env.set_caller(not_an_owner);\n assert_eq!(\n owned_contract.try_change_name("NewName".to_string()),\n Err(Error::NotAnOwner.into())\n );\n }\n}\n')),(0,a.kt)("p",null,"Each ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," has ",(0,a.kt)("inlineCode",{parentName:"p"},"try_{{entry_point_name}}")," functions that return an ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult")),".\n",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractHostRef")," implements regular entrypoints: ",(0,a.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),", and\nand safe its safe version: ",(0,a.kt)("inlineCode",{parentName:"p"},"try_name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name"),"."),(0,a.kt)("p",null,"In our example, we are calling ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name")," and expecting an error to be thrown.\nFor assertions, we are using a standard ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro. As the contract call returns an ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError"),",\nwe need to convert our custom error to ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," using ",(0,a.kt)("inlineCode",{parentName:"p"},"Into::into()"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/54dbc4b0.35d4cae9.js b/docs/assets/js/54dbc4b0.35d4cae9.js new file mode 100644 index 000000000..865b52f7d --- /dev/null +++ b/docs/assets/js/54dbc4b0.35d4cae9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99186],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.6.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.6.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.6.0/",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.6.0/category/getting-started"}},c={image:r(20764).Z},l=[{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean,\npragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open\nsource."),(0,o.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains."),(0,o.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems. We can do it\nby abstracting over core concepts that all the above systems are built around. These are type system,\nstorage, entry points, execution context, and testing environment. We believe it will bring standardization\nto the development of Rust-based smart contracts and enable code reusability we have not yet seen in this\necosystem."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.6.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.6.0/getting-started/flipper"},"Flipper example"),"\nto find out how to start your new project with Odra."))}p.isMDXComponent=!0},20764:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/54f44165.222c4c99.js b/docs/assets/js/54f44165.222c4c99.js new file mode 100644 index 000000000..7dcc33263 --- /dev/null +++ b/docs/assets/js/54f44165.222c4c99.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40152],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return a?n.createElement(g,l(l({ref:t},c),{},{components:a})):n.createElement(g,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/docs/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/next/getting-started/installation",draft:!1,tags:[],version:"current",lastUpdatedAt:1707130258,formattedLastUpdatedAt:"Feb 5, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/next/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/next/getting-started/flipper"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-unknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --locked\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,r.kt)("p",null,"This will create a new folder called ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," and initialize Odra there. Cargo Odra\nwill create a sample contract for you in ",(0,r.kt)("inlineCode",{parentName:"p"},"src")," directory. You can run the tests of this contract\nby executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/55362a87.b8f3b75c.js b/docs/assets/js/55362a87.b8f3b75c.js new file mode 100644 index 000000000..0d1b8c93f --- /dev/null +++ b/docs/assets/js/55362a87.b8f3b75c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59616],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),u=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=u(t),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return t?a.createElement(w,o(o({ref:n},d),{},{components:t})):a.createElement(w,o({ref:n},d))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.3.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.3.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.3.0/tutorials/ownable",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Tutorials",permalink:"/docs/0.3.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.3.0/tutorials/erc20"}},s={},u=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining constructors,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{types::Address, Variable};\n\n#[odra::module]\npub struct Ownable {\n owner: Variable
\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basic before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - Firstly, we need create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," to it above."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n execution_error, contract_env, Event, types::{Address, event::OdraEvent}\n};\n...\n\n#[odra::module]\nimpl Ownable {\n #[odra(init)]\n pub fn init(&mut self, owner: &Address) {\n if self.owner.get().is_some() {\n contract_env::revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(*owner);\n \n OwnershipChanged {\n prev_owner: None,\n new_owner: *owner\n }\n .emit();\n }\n}\n\nexecution_error! {\n pub enum Error {\n OwnerIsNotInitialized => 1,\n }\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is marked as ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]")," making it a constructor. It matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum is defined inside the ",(0,r.kt)("inlineCode",{parentName:"li"},"execution_error")," macro. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9-L11")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::revert()")," function. As an argument we pass ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsNotInitialized"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L13")," - Then we write the owner passed as an argument to the storage. To do so we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29-L33")," - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Finally, we create the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," struct and call ",(0,r.kt)("inlineCode",{parentName:"li"},"emit()")," function on it (import ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent")," trait). Hence we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get().as_ref() {\n contract_env::revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&contract_env::caller());\n let current_owner = self.get_owner();\n self.owner.set(*new_owner);\n OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n }\n .emit();\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get() {\n Some(owner) => owner,\n None => contract_env::revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\nexecution_error! {\n pub enum Error {\n NotOwner => 1,\n OwnerIsAlreadyInitialized => 2,\n OwnerIsNotInitialized => 3,\n }\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5,L32")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," is reads the current owner, and reverts if is does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::caller()")," function. The we update the state, and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22,L34")," - Lastly, a getter function. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable")," ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returns an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),", we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),".")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{assert_events, test_env};\n\n fn setup() -> (Address, OwnableRef) {\n let owner = test_env::get_account(0);\n let ownable = OwnableDeployer::init(owner);\n (owner, ownable)\n }\n\n #[test]\n fn initialization_works() {\n let (owner, ownable) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (owner, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n \n test_env::set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (_, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n ownable.change_ownership(&new_owner);\n \n test_env::assert_exception(Error::NotOwner, || {\n ownable.change_ownership(&new_owner);\n });\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we call as the first statement in each test. Take a look at the signature ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (Address, OwnableRef)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableRef")," is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Now, the module needs an owner, the easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env"),". We choose the address of first account (which is the default one)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Odra created for us ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableDeployer")," struct which implements all constructor functions. In this case there is just one function - ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which corresponds the function we have implemented in the module."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - It is time to define the first test. As you see, it is a regular rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14-15")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-23")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events"),". As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30")," - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"test env")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L32")," - As mentioned, the default is the 0-th account, if you want to change the executor call the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L49-55")," - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::assert_exception()")," with the error you expect and a failing block of code.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/558ac3fc.f85ab1c2.js b/docs/assets/js/558ac3fc.f85ab1c2.js new file mode 100644 index 000000000..cbcff0e3a --- /dev/null +++ b/docs/assets/js/558ac3fc.f85ab1c2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59654],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>g});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=l(n),g=a,f=d["".concat(c,".").concat(g)]||d[g]||p[g]||s;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,i=new Array(s);i[0]=d;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={},i="Signatures",o={unversionedId:"advanced/signatures",id:"version-0.5.0/advanced/signatures",title:"Signatures",description:"As each backend can use a different scheme for generating key pairs,",source:"@site/versioned_docs/version-0.5.0/advanced/05-signatures.md",sourceDirName:"advanced",slug:"/advanced/signatures",permalink:"/docs/0.5.0/advanced/signatures",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/0.5.0/advanced/attributes"},next:{title:"Backends",permalink:"/docs/0.5.0/category/backends"}},c={},l=[{value:"Signature verification",id:"signature-verification",level:2},{value:"Testing",id:"testing",level:2},{value:"ECRecover",id:"ecrecover",level:2}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"signatures"},"Signatures"),(0,a.kt)("p",null,"As each backend can use a different scheme for generating key pairs,\nOdra Framework provides a generic function for signature verification inside the contract context.\nThanks to this, you can write your code once, without worrying about underlying cryptography."),(0,a.kt)("h2",{id:"signature-verification"},"Signature verification"),(0,a.kt)("p",null,"Signature verification is conducted by a function in ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"pub fn verify_signature(message: &Bytes, signature: &Bytes, public_key: &PublicKey) -> bool;\n")),(0,a.kt)("p",null,"Here's the simplest example of this function used in a contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},"#[odra::module]\nimpl SignatureVerifier {\n pub fn verify_signature(\n &self,\n message: &Bytes,\n signature: &Bytes,\n public_key: &PublicKey\n ) -> bool {\n contract_env::verify_signature(message, signature, public_key)\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Besides the above function in the contract context, Odra provides corresponding functions in the ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"pub fn sign_message(message: &Bytes, address: &Address) -> Bytes;\n\npub fn public_key(address: &Address) -> PublicKey;\n")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"sign_message")," will return a signed message. The signing itself will be performed using a private key\nof an account behind the ",(0,a.kt)("inlineCode",{parentName:"p"},"address"),"."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"public_key")," returns the PublicKey of an ",(0,a.kt)("inlineCode",{parentName:"p"},"address")," account."),(0,a.kt)("p",null,"Thanks to those, you can write generic tests, that will work with all backends, despite differences\nin signature schemes they use."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},'#[test]\nfn signature_verification_works() {\n let message = "Message to be signed";\n let message_bytes = &Bytes::from(message.as_bytes().to_vec());\n let account = test_env::get_account(0);\n\n let signature = test_env::sign_message(message_bytes, &account);\n\n let public_key = test_env::public_key(&account);\n\n let signature_verifier = SignatureVerifierDeployer::default();\n assert!(signature_verifier.verify_signature(message_bytes, &signature, &public_key));\n}\n')),(0,a.kt)("p",null,"If you want, you can also test signatures that were created outside Odra.\nHowever, you will need to prepare separate tests for each backend:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},'/// The following test checks that the signature verification works with the signature produced\n/// by the casper wallet.\n#[test]\n#[cfg(feature = "casper")]\nfn verify_signature_casper_wallet() {\n use odra::casper::casper_types::bytesrepr::FromBytes;\n // Casper Wallet for the message "Ahoj przygodo!" signed using SECP256K1 key\n // produces the following signature:\n // 1e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa\n // Casper Wallet adds "Casper Message:\\n" prefix to the message:\n let message = "Casper Message:\\nAhoj przygodo!";\n let message_bytes = &Bytes::from(message.as_bytes().to_vec());\n\n // Depending on the type of the key, we need to prefix the signature with a tag:\n // 0x01 for ED25519\n // 0x02 for SECP256K1\n let signature_hex = "021e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa";\n let signature: [u8; 65] = hex::decode(signature_hex).unwrap().try_into().unwrap();\n let signature_bytes = &Bytes::from(signature.to_vec());\n\n // Similar to the above, the public key is tagged:\n let public_key_hex = "02036d9b880e44254afaf34330e57703a63aec53b5918d4470059b67a4a906350105";\n let public_key_decoded = hex::decode(public_key_hex).unwrap();\n let (public_key, _) = odra::casper::casper_types::crypto::PublicKey::from_bytes(\n public_key_decoded.as_slice()\n )\n .unwrap();\n\n let signature_verifier = SignatureVerifierDeployer::default();\n assert!(signature_verifier.verify_signature(message_bytes, signature_bytes, &public_key));\n}\n')),(0,a.kt)("h2",{id:"ecrecover"},"ECRecover"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra-proposal#odra-standard-library"},"Odra Standard Library"),"\npart of the original Odra Proposal mentioned ECRecover as one of the functions that will be\nimplemented by the Odra Framework. We decided to add signatures verification instead."),(0,a.kt)("p",null,"The reasoning behind this decision is that the ECRecover works only with one type of signature.\nOdra tries to be backend-agnostic, which implies that it should also be signature-type-agnostic.\nThis was possible to achieve when implementing generic signature verification, but not with ECRecover."),(0,a.kt)("p",null,"In short, the implementation of ECRecover would not depend on the backend, pushing it into some kind of\nutils library, and those already exist, for example in\n",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/solana-program/latest/solana_program/secp256k1_recover/index.html#"},"solana_program"),"\ncrate."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/56296f23.be1c8e52.js b/docs/assets/js/56296f23.be1c8e52.js new file mode 100644 index 000000000..c15a7e6ba --- /dev/null +++ b/docs/assets/js/56296f23.be1c8e52.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41577],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);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 l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),u=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=u(a),m=r,h=p["".concat(i,".").concat(m)]||p[m]||c[m]||o;return a?n.createElement(h,l(l({ref:t},d),{},{components:a})):n.createElement(h,l({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var u=2;u{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var n=a(87462),r=(a(67294),a(3905));const o={},l="Module Composer",s={unversionedId:"advanced/composer",id:"version-0.4.0/advanced/composer",title:"Module Composer",description:"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.",source:"@site/versioned_docs/version-0.4.0/advanced/01-composer.md",sourceDirName:"advanced",slug:"/advanced/composer",permalink:"/docs/0.4.0/advanced/composer",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.4.0/category/advanced"},next:{title:"Delegate",permalink:"/docs/0.4.0/advanced/delegate"}},i={},u=[{value:"Conceptual Overview",id:"conceptual-overview",level:2},{value:"Usage",id:"usage",level:2},{value:"Conclusion",id:"conclusion",level:2}],d={toc:u};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"module-composer"},"Module Composer"),(0,r.kt)("p",null,"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples."),(0,r.kt)("h2",{id:"conceptual-overview"},"Conceptual Overview"),(0,r.kt)("p",null,"By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n value: Variable, // the default namespace would be "contract_value"\n module: Module\n}\n\n#[odra::module]\nstruct Module {\n secret: Variable // the default namespace would be "contract_module_secret"\n}\n')),(0,r.kt)("p",null,"While this isolation often proves useful, there are scenarios where shared storage is beneficial. Here, the Module Composer comes in."),(0,r.kt)("p",null,"Additionally, the Module Composer shortens the storage key - a handy side effect of shared storage. "),(0,r.kt)("p",null,"For each module, Odra generates a corresponding Composer struct (e.g., ",(0,r.kt)("inlineCode",{parentName:"p"},"MyContractComposer")," for ",(0,r.kt)("inlineCode",{parentName:"p"},"MyContract")," module), which aids in manual module composition."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"By default, the #","[odra::module]"," macro generates an implementation of the odra::Instance trait, prefixing the storage key of child modules with the parent namespace. To disable this behavior, pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"skip_instance")," argument to the #","[odra::module]"," macro."),(0,r.kt)("p",null,"Let's write a simple code example. The example provided below introduces some additional complexity by featuring deeper module nesting."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::{Instance, Variable, Composer};\n\n#[odra::module]\npub struct SharedStorage {\n pub value: Variable\n}\n\n#[odra::module]\npub struct MyStorage {\n pub shared: SharedStorage,\n pub version: Variable\n}\n\n#[odra::module]\npub struct MoreStorage {\n pub my_storage: MyStorage,\n pub extra: Variable\n}\n\n#[odra::module(skip_instance)]\npub struct ComplexContract {\n pub shared: SharedStorage,\n pub more_storage: MoreStorage\n}\n\n#[odra::module]\nimpl ComplexContract {\n #[odra(init)]\n pub fn init(&mut self, version: u8, value: String, extra: u32) {\n self.more_storage.my_storage.version.set(version);\n self.shared.value.set(value);\n self.more_storage.extra.set(extra);\n }\n\n pub fn get_value(&self) -> String {\n self.shared.value.get_or_default()\n }\n\n pub fn get_value_via_storage(&self) -> String {\n self.more_storage.my_storage.shared.value.get_or_default()\n }\n\n pub fn get_extra_value(&self) -> u32 {\n self.more_storage.extra.get_or_default()\n }\n}\n\nimpl Instance for ComplexContract {\n fn instance(namespace: &str) -> Self {\n let value = Composer::new(namespace, "v").compose();\n let shared = SharedStorageComposer::new(namespace, "shared")\n .with_value(&value)\n .compose();\n let my_storage = MyStorageComposer::new(namespace, "my_storage")\n .with_shared(&shared)\n .compose();\n let more_storage = MoreStorageComposer::new(namespace, "more_storage")\n .with_my_storage(&my_storage)\n .compose();\n Self { shared, more_storage }\n }\n}\n\n#[cfg(test)]\nmod test {\n use crate::composer::ComplexContractDeployer;\n\n #[test]\n fn t() {\n let shared_value = "shared_value".to_string();\n let extra_value: u32 = 314;\n let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);\n\n assert_eq!(token.get_value(), shared_value);\n assert_eq!(token.get_value_via_storage(), shared_value);\n assert_eq!(token.get_extra_value(), extra_value);\n }\n}\n')),(0,r.kt)("p",null,"In this example, we've introduced a new module, ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", which nests ",(0,r.kt)("inlineCode",{parentName:"p"},"MyStorage")," and includes an extra value. The ",(0,r.kt)("inlineCode",{parentName:"p"},"ComplexContract")," contains ",(0,r.kt)("inlineCode",{parentName:"p"},"SharedStorage")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels."),(0,r.kt)("p",null,"If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"On the contract level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_shared_value"),"."),(0,r.kt)("li",{parentName:"ol"},"On the ",(0,r.kt)("inlineCode",{parentName:"li"},"MyStorage")," module level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_more_storage_shared_value"),".")),(0,r.kt)("p",null,"This example showcases how you can effectively use the Module Composer feature to build intricate and efficient smart contracts."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"To customize the storage building block, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"Composer")," which API matches to modules composers API.")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"The Module Composer in Odra provides developers with a high level of flexibility and control over module behavior in their smart contracts. This guide, complete with a practical example, should give you a good understanding of the feature. Embrace the power of the Module Composer and unleash the full potential of your smart contracts!"))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/575b7125.5a145ab1.js b/docs/assets/js/575b7125.5a145ab1.js new file mode 100644 index 000000000..a03f448ad --- /dev/null +++ b/docs/assets/js/575b7125.5a145ab1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90992],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>g});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),c=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=c(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(t),g=r,m=u["".concat(p,".").concat(g)]||u[g]||d[g]||i;return t?a.createElement(m,o(o({ref:n},l),{},{components:t})):a.createElement(m,o({ref:n},l))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const i={},o="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.7.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.7.0/advanced/03-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.7.0/advanced/advanced-storage",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.7.0/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.7.0/advanced/attributes"}},p={},c=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],l={toc:c};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Variable"),": A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The Sequence in Odra is a basic module that holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + OdraType\n{\n value: Variable\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{map, types::U256, Mapping, UnwrapOrRevert};\n\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct NestedMapping {\n strings: Mapping>>,\n tokens: Mapping>>\n}\n\n#[odra::module]\nimpl NestedMapping {\n\n ...\n\n pub fn set_token(\n &mut self,\n key1: String,\n key2: u32,\n key3: String,\n token_name: String,\n decimals: u8,\n symbol: String,\n initial_supply: &U256\n ) {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .init(token_name, symbol, decimals, initial_supply);\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let mapping = self.strings.get_instance(&key1).get_instance(&key2);\n mapping.get(&key3).unwrap_or_revert()\n }\n\n pub fn total_supply(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> U256 {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .total_supply()\n }\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers. "),(0,r.kt)("p",{parentName:"admonition"},"Instead of using the ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()"),", which sets the correct namespace for nested modules.")),(0,r.kt)("p",null,"If the terminal value is deeply nested, a long chain of ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()")," calls is required."),(0,r.kt)("p",null,"To keep the codebase consistent, a ",(0,r.kt)("inlineCode",{parentName:"p"},"map!")," macro can be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"...\n\npub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {\n map!(self.strings[key1][key2][key3] = value);\n}\n\npub fn get_string_macro(\n &self, \n key1: String, \n key2: u32, \n key3: String\n) -> String {\n map!(self.strings[key1][key2][key3])\n}\n\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The terminal value must not be an Odra Module.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Sequence, Mapping};\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n my_sequence: Sequence,\n my_mapping: Mapping>,\n}\n\nimpl AdvancedStorage {\n pub fn get_sequence_current_value(&self) -> u32 {\n self.my_sequence.get_current_value()\n }\n\n pub fn next_sequence_value(&mut self) -> u32 {\n self.my_sequence.next_value()\n }\n\n pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.set(&inner_key, value);\n }\n\n pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.get(&inner_key)\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/57648d1e.e14bc56b.js b/docs/assets/js/57648d1e.e14bc56b.js new file mode 100644 index 000000000..4bf4e5cfd --- /dev/null +++ b/docs/assets/js/57648d1e.e14bc56b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[88181],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(c,".").concat(m)]||d[m]||p[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Attributes",l={unversionedId:"advanced/attributes",id:"version-0.3.1/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.",source:"@site/versioned_docs/version-0.3.1/advanced/04-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.3.1/advanced/attributes",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.3.1/advanced/advanced-storage"},next:{title:"Backends",permalink:"/docs/0.3.1/category/backends"}},c={},s=[{value:"Init",id:"init",level:2},{value:"Example",id:"example",level:3},{value:"Payable",id:"payable",level:2},{value:"Example",id:"example-1",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:s};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attributes"},"Attributes"),(0,r.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution."),(0,r.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,r.kt)("h2",{id:"init"},"Init"),(0,r.kt)("p",null,"If your contract needs initial setup, adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed."),(0,r.kt)("p",null,"It's important to note that a constructor function should not be invoked in any other context."),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/erc20.rs",title:"examples/erc20.rs"},"#[odra(init)]\npub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n}\n")),(0,r.kt)("h2",{id:"payable"},"Payable"),(0,r.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/tlw.rs",title:"examples/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = contract_env::caller();\n let amount: Balance = contract_env::attached_value();\n let current_block_time: BlockTime = contract_env::get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n contract_env::revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n Deposit {\n address: caller,\n amount\n }\n .emit();\n}\n")),(0,r.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,r.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,r.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,r.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,r.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,r.kt)("p",null,"In Odra you can just apply the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,r.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,r.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"or "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"In both cases attributes order does not matter."),(0,r.kt)("p",null,"However, a constructor cannot be payable, so the below code would not compile."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(init)]\nfn initialize() {\n // your logic...\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/57bc1a35.d17a2440.js b/docs/assets/js/57bc1a35.d17a2440.js new file mode 100644 index 000000000..291e27099 --- /dev/null +++ b/docs/assets/js/57bc1a35.d17a2440.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33394],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||o;return t?r.createElement(f,s(s({ref:n},u),{},{components:t})):r.createElement(f,s({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var d=2;d{t.d(n,{Z:()=>s});var r=t(67294),a=t(86010);const o="tabItem_Ymn6";function s(e){let{children:n,hidden:t,className:s}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(o,s),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>y});var r=t(87462),a=t(67294),o=t(86010),s=t(12466),l=t(16550),i=t(91980),d=t(67392),u=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(o),(0,a.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function v(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=c(e),[s,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[i,d]=f({queryString:t,groupId:r}),[p,v]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,u.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:o})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:s,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),v(e)}),[d,v,o]),tabValues:o}}var g=t(72389);const h="tabList__CuJ",k="tabItem_LNqP";function b(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:d}=e;const u=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),c=e=>{const n=e.currentTarget,t=u.indexOf(n),r=d[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;n=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;n=u[t]??u[u.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},n)},d.map((e=>{let{value:n,label:t,attributes:s}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>u.push(e),onKeyDown:m,onClick:c},s,{className:(0,o.Z)("tabs__item",k,s?.className,{"tabs__item--active":l===n})}),t??n)})))}function _(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function N(e){const n=v(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",h)},a.createElement(b,(0,r.Z)({},e,n)),a.createElement(_,(0,r.Z)({},e,n)))}function y(e){const n=(0,g.Z)();return a.createElement(N,(0,r.Z)({key:String(n)},e))}},10349:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),o=t(74866),s=t(85162);const l={sidebar_position:1,description:"Migration guide to v0.8.0"},i="Migration guide to v0.8.0",d={unversionedId:"migrations/to-0.8.0",id:"migrations/to-0.8.0",title:"Migration guide to v0.8.0",description:"Migration guide to v0.8.0",source:"@site/docs/migrations/to-0.8.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.8.0",permalink:"/docs/next/migrations/to-0.8.0",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Migration guide to v0.8.0"},sidebar:"tutorialSidebar",previous:{title:"Migrations",permalink:"/docs/next/category/migrations"},next:{title:"Migration guide to v0.9.0",permalink:"/docs/next/migrations/to-0.9.0"}},u={},p=[{value:"1. Prerequisites",id:"1-prerequisites",level:2},{value:"1.1. Update cargo-odra",id:"11-update-cargo-odra",level:3},{value:"1.2. Review the Changelog",id:"12-review-the-changelog",level:3},{value:"2. Migration Steps",id:"2-migration-steps",level:2},{value:"2.1 Add bin directory",id:"21-add-bin-directory",level:3},{value:"2.2. Update Cargo.toml",id:"22-update-cargotoml",level:3},{value:"2.2. Update Odra.toml",id:"22-update-odratoml",level:3},{value:"2.3. Update Smart Contracts",id:"23-update-smart-contracts",level:3},{value:"2.3.1. Update the use statements to reflect the new module structure.",id:"231-update-the-use-statements-to-reflect-the-new-module-structure",level:4},{value:"2.3.2. Some type aliases are no longer in use.",id:"232-some-type-aliases-are-no-longer-in-use",level:4},{value:"2.3.3. Consider import odra::prelude::* in your module files.",id:"233-consider-import-odraprelude-in-your-module-files",level:4},{value:"2.3.4. Flatten nested Mappings.",id:"234-flatten-nested-mappings",level:4},{value:"2.3.5. Update errors definitions.",id:"235-update-errors-definitions",level:4},{value:"2.3.6. Update events definitions.",id:"236-update-events-definitions",level:4},{value:"2.3.7. Replace contract_env with self.env() in your modules.",id:"237-replace-contract_env-with-selfenv-in-your-modules",level:4},{value:"2.3.8. Wrap submodules of your module with odra::SubModule<T>.",id:"238-wrap-submodules-of-your-module-with-odrasubmodulet",level:4},{value:"2.3.9. Update external contract calls.",id:"239-update-external-contract-calls",level:4},{value:"2.3.10. Update constructors.",id:"2310-update-constructors",level:4},{value:"2.3.11. Update UnwrapOrRevert calls.",id:"2311-update-unwraporrevert-calls",level:4},{value:"2.3.12. Remove #[odra(using)] attribute from your module definition.",id:"2312-remove-odrausing-attribute-from-your-module-definition",level:4},{value:"2.4. Update Tests",id:"24-update-tests",level:3},{value:"2.4.1. Contract deployment.",id:"241-contract-deployment",level:4},{value:"2.4.2. Host interactions.",id:"242-host-interactions",level:4},{value:"2.4.3. Testing failing scenarios.",id:"243-testing-failing-scenarios",level:4},{value:"2.4.4. Testing events.",id:"244-testing-events",level:4},{value:"3. Code Examples",id:"3-code-examples",level:2},{value:"4. Troubleshooting",id:"4-troubleshooting",level:2},{value:"5. References",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v080"},"Migration guide to v0.8.0"),(0,a.kt)("p",null,"Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version."),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant changes in v0.8.0 include:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only."),(0,a.kt)("li",{parentName:"ul"},"Framework internals redesign.")),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.8.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-add-bin-directory"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Add bin directory")),(0,a.kt)("p",null,"Odra 0.8.0 introduces a new way to build smart contracts. The ",(0,a.kt)("inlineCode",{parentName:"p"},".builder_casper")," directory is no longer used. Instead, you should create a new directory called ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," in the root of your project and add the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files to the ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," directory."),(0,a.kt)("p",null,"You can find the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-cargotoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Cargo.toml")),(0,a.kt)("p",null,"There a bunch of changes in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"You don't have to specify the features anymore - remove the ",(0,a.kt)("inlineCode",{parentName:"li"},"features")," section and ",(0,a.kt)("inlineCode",{parentName:"li"},"default-features")," flag from the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra")," dependency."),(0,a.kt)("li",{parentName:"ul"},"Register bins you added in the previous step."),(0,a.kt)("li",{parentName:"ul"},"Add ",(0,a.kt)("inlineCode",{parentName:"li"},"dev-dependencies")," section with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra-test")," crate."),(0,a.kt)("li",{parentName:"ul"},"Add recommended profiles for ",(0,a.kt)("inlineCode",{parentName:"li"},"release")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," to optimize the build process.")),(0,a.kt)("p",null,"Below you can compare the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file after and before the migration to v0.8.0:"),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.7.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')))),(0,a.kt)("h3",{id:"22-update-odratoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Odra.toml")),(0,a.kt)("p",null,"Due to the changes in cargo-odra, the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file has been simplified. The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," property is no longer required."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "my_project::Flipper"\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "my_project::Flipper"\n')))),(0,a.kt)("h3",{id:"23-update-smart-contracts"},"2.3. ",(0,a.kt)("strong",{parentName:"h3"},"Update Smart Contracts")),(0,a.kt)("p",null,"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"231-update-the-use-statements-to-reflect-the-new-module-structure"},"2.3.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update the ",(0,a.kt)("inlineCode",{parentName:"strong"},"use")," statements to reflect the new module structure.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Big integer types are now located in the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types")," module."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::Address")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::Address"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Variable")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::contract_env"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::OdraType")," as it is no longer required."),(0,a.kt)("li",{parentName:"ul"},"Change ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::casper_types::*;")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::*;"),".")),(0,a.kt)("h4",{id:"232-some-type-aliases-are-no-longer-in-use"},"2.3.2. ",(0,a.kt)("strong",{parentName:"h4"},"Some type aliases are no longer in use.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Balance")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::U512"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BlockTime")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"EventData")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::bytesrepr::Bytes"),".")),(0,a.kt)("h4",{id:"233-consider-import-odraprelude-in-your-module-files"},"2.3.3. ",(0,a.kt)("strong",{parentName:"h4"},"Consider import ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::prelude::*")," in your module files.")),(0,a.kt)("h4",{id:"234-flatten-nested-mappings"},"2.3.4. ",(0,a.kt)("strong",{parentName:"h4"},"Flatten nested ",(0,a.kt)("inlineCode",{parentName:"strong"},"Mapping"),"s.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// Before\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping>\n}\n// After\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("h4",{id:"235-update-errors-definitions"},"2.3.5. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::execution_error;\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n}\n")))),(0,a.kt)("h4",{id:"236-update-events-definitions"},"2.3.6. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nself.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n});\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nuse odra::types::event::OdraEvent;\n\nTransfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n}.emit();\n")))),(0,a.kt)("h4",{id:"237-replace-contract_env-with-selfenv-in-your-modules"},"2.3.7. ",(0,a.kt)("strong",{parentName:"h4"},"Replace ",(0,a.kt)("inlineCode",{parentName:"strong"},"contract_env")," with ",(0,a.kt)("inlineCode",{parentName:"strong"},"self.env()")," in your modules.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"self.env()")," is a new way to access the contract environment, returns a reference to ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),". The API is similar to the previous ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env")," but with some changes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_var(key: &[u8]) -> Option")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn get_value(&self, key: &[u8]) -> Option"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_var(key: &[u8], value: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn set_value(&self, key: &[u8], value: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"set_dict_value()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_dict_value()")," has been removed. All the dictionary operations should be performed using ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," type, internally using ",(0,a.kt)("inlineCode",{parentName:"li"},"set_var()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_var()")," functions. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn hash>(input: T) -> Vec")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn hash(&self, value: T) -> [u8; 32]"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(error: E) -> !")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(&self, error: E) -> !"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(event: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(&self, event: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option) -> T")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(&self, address: Address, call: CallDef) -> T"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"native_token_metadata()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"one_token()")," have been removed.")),(0,a.kt)("h4",{id:"238-wrap-submodules-of-your-module-with-odrasubmodulet"},"2.3.8. ",(0,a.kt)("strong",{parentName:"h4"},"Wrap submodules of your module with ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::SubModule"),".")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: SubModule,\n metadata: SubModule,\n ownable: SubModule\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: Erc721Base,\n metadata: Erc721MetadataExtension,\n ownable: Ownable\n}\n")))),(0,a.kt)("h4",{id:"239-update-external-contract-calls"},"2.3.9. ",(0,a.kt)("strong",{parentName:"h4"},"Update external contract calls.")),(0,a.kt)("p",null,"However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref"),") and you can call it using ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env, address)")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref::at()"),")."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenContractRef::new(env, token).balance_of(account)\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenRef::at(token).balance_of(account)\n")))),(0,a.kt)("h4",{id:"2310-update-constructors"},"2.3.10. ",(0,a.kt)("strong",{parentName:"h4"},"Update constructors.")),(0,a.kt)("p",null,"Remove the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::init]")," attribute from the constructor and ensure that the constructor function is named ",(0,a.kt)("inlineCode",{parentName:"p"},"init"),"."),(0,a.kt)("h4",{id:"2311-update-unwraporrevert-calls"},"2.3.11. ",(0,a.kt)("strong",{parentName:"h4"},"Update ",(0,a.kt)("inlineCode",{parentName:"strong"},"UnwrapOrRevert")," calls.")),(0,a.kt)("p",null,"The functions ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," now require ",(0,a.kt)("inlineCode",{parentName:"p"},"&HostEnv")," as the first parameter."),(0,a.kt)("h4",{id:"2312-remove-odrausing-attribute-from-your-module-definition"},"2.3.12. ",(0,a.kt)("strong",{parentName:"h4"},"Remove ",(0,a.kt)("inlineCode",{parentName:"strong"},"#[odra(using)]")," attribute from your module definition.")),(0,a.kt)("p",null,"Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required."),(0,a.kt)("h3",{id:"24-update-tests"},"2.4. ",(0,a.kt)("strong",{parentName:"h3"},"Update Tests")),(0,a.kt)("p",null,"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"241-contract-deployment"},"2.4.1. ",(0,a.kt)("strong",{parentName:"h4"},"Contract deployment.")),(0,a.kt)("p",null,"The way you deploy a contract has changed:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef::deploy(&env, args)")," instead of ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}Deployer::init()"),". The ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef")," implements ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer"),"."),(0,a.kt)("li",{parentName:"ol"},"Instantiate the ",(0,a.kt)("inlineCode",{parentName:"li"},"HostEnv")," using ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),", required by the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract doesn't have init args, you should use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract has init args, you should pass the autogenerated ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableHostRef;\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\nlet env: HostEnv = odra_test::env();\nlet ownable = OwnableHostRef::deploy(&env, NoArgs)\n\n// A contract with init args\nuse super::{Erc20HostRef, Erc20InitArgs};\nuse odra::host::{Deployer, HostEnv};\n\nlet env: HostEnv = odra_test::env();\nlet init_args = Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n};\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableDeployer;\n\nlet ownable = OwnableDeployer::init();\n\n// A contract with init args\nlet erc20 = Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n);\n")))),(0,a.kt)("h4",{id:"242-host-interactions"},"2.4.2. ",(0,a.kt)("strong",{parentName:"h4"},"Host interactions.")),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Replace ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),"."),(0,a.kt)("li",{parentName:"ol"},"The API of ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()")," are similar, but there are some differences:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::advance_block_time_by(BlockTime)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.advance_block_time(u64)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::token_balance(Address)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.balance_of(&Address)"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_cost()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_used()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::total_gas_used(Address)"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::gas_report()")," have been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef::last_call()")," and extract the data from a ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::ContractCallResult")," instance. ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef")," is a trait implemented by ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef"),".")))),(0,a.kt)("h4",{id:"243-testing-failing-scenarios"},"2.4.3. ",(0,a.kt)("strong",{parentName:"h4"},"Testing failing scenarios.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"test_env::assert_exception()")," has been removed. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix to call the function and then assert the result.\n",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix is a new way to call a function that might fail. It returns a ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult"))," type, which you can then assert using the standard Rust ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n let (env, mut erc20) = setup();\n\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n assert_eq!(\n erc20.try_transfer_from(owner, recipient, amount),\n Err(Error::InsufficientAllowance.into())\n );\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n test_env::assert_exception(Error::InsufficientAllowance, || {\n let mut erc20 = setup();\n\n let (owner, spender, recipient) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let amount = 1_000.into();\n test_env::set_caller(spender);\n\n erc20.transfer_from(&owner, &recipient, &amount)\n });\n}\n")))),(0,a.kt)("h4",{id:"244-testing-events"},"2.4.4. ",(0,a.kt)("strong",{parentName:"h4"},"Testing events.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," macro has been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv::emitted_event()")," to assert the emitted events.\nThe new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation to explore the available options."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let env: HostEnv = odra_test::env();\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n\n...\n\nassert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n));\nassert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n));\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let erc20 = Erc20HostDeployer::init(&env, ...);\n\n...\n\nassert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n);\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.8.0."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20HostRef, Erc20InitArgs\n };\n use odra::{\n casper_types::U256,\n host::{Deployer, HostEnv, HostRef},\n prelude::*\n };\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n // Other tests...\n}\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use odra::prelude::string::String;\nuse odra::{\n contract_env,\n types::{event::OdraEvent, Address, U256},\n Mapping, UnwrapOrRevert, Variable\n};\n\nuse self::{\n errors::Error,\n events::{Approval, Transfer}\n};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n\n#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: &Option\n ) {\n let caller = contract_env::caller();\n\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = *initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n }\n .emit();\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = contract_env::caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = contract_env::caller();\n\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn name(&self) -> String {\n self.name.get().unwrap_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n contract_env::revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n }\n .emit();\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n contract_env::revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n self.allowances\n .get_instance(owner)\n .subtract(spender, *amount);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\npub mod events {\n use odra::types::{casper_types::U256, Address};\n use odra::Event;\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::execution_error;\n\n execution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20Deployer, Erc20Ref\n };\n use odra::prelude::string::ToString;\n use odra::{assert_events, test_env, types::casper_types::U256};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let erc20 = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When transfer tokens to a recipient.\n let sender = test_env::get_account(0);\n let recipient = test_env::get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n test_env::assert_exception(Error::InsufficientBalance, || {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n erc20.transfer(&recipient, &amount)\n });\n }\n\n // Other tests...\n}\n')))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5825ca57.c8a72c36.js b/docs/assets/js/5825ca57.c8a72c36.js new file mode 100644 index 000000000..24ec5811b --- /dev/null +++ b/docs/assets/js/5825ca57.c8a72c36.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37199],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),p=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=r,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(f,s(s({ref:n},c),{},{components:t})):a.createElement(f,s({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,s=new Array(o);s[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:3},s="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.3.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.3.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.3.0/tutorials/erc20",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"defaultSidebar",previous:{title:"Ownable",permalink:"/docs/0.3.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.3.0/tutorials/owned-token"}},i={},p=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"erc-20"},"ERC-20"),(0,r.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,r.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value. "),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"advanced storage - key-value pairs, "),(0,r.kt)("li",{parentName:"ul"},"Odra types like ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),", "),(0,r.kt)("li",{parentName:"ul"},"advanced events assertion.")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Our module has a pretty complex storage layout in comparison to the previous example."),(0,r.kt)("p",null,"We need to store the following data:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol and decimals."),(0,r.kt)("li",{parentName:"ol"},"Total supply."),(0,r.kt)("li",{parentName:"ol"},"Users' balances."),(0,r.kt)("li",{parentName:"ol"},"Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.")),(0,r.kt)("h2",{id:"module-definition"},"Module definition"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,r.kt)("inlineCode",{parentName:"li"},"mapping"),". You may notice the ",(0,r.kt)("inlineCode",{parentName:"li"},"balances")," property maps ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," to ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),". If you deal with addresses or you operate on tokens, you should always choose ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," over ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Odra allows nested ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),"s, what we utilize to store allowances.")),(0,r.kt)("h3",{id:"metadata"},"Metadata"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.balances.add(address, *amount);\n self.total_supply.add(amount);\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: Balance\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3-L10")," - A constructor sets the token metadata and mints the initial supply."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12-L14")," - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," example, we used the ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returning an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function and the contract does not fail even if the value is not initialized."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29")," - The second ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," is not an odra module, in other words these function will not be a part of contract's ABI."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30-L39")," - Mint function is public, so like in a regular rust code will be accessible from the outside. ",(0,r.kt)("inlineCode",{parentName:"li"},"mint()")," use notation ",(0,r.kt)("inlineCode",{parentName:"li"},"self.balances.add(&address, amount);"),", which it is syntactic sugar for:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let current_balance = self.balances.get(&address).unwrap_or_default();\nlet new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();\nself.balances.set(&address, new_balance);\n")),(0,r.kt)("h3",{id:"core"},"Core"),(0,r.kt)("p",null,"For the sake of completeness, let's implement the remaining functionalities like ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_from"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"approve"),". They are not introducing any new concepts, so we leave them without additional remarks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs",title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let spender = contract_env::caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n let owner = contract_env::caller();\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n contract_env::revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .get_instance(owner)\n .set(spender, new_allowance);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,r.kt)("p",null,"Now, compare the code we have written, with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};\n use odra::{assert_events, test_env, types::U256};\n\n pub const NAME: &str = "Plascoin";\n pub const SYMBOL: &str = "PLS";\n pub const DECIMALS: u8 = 10;\n pub const INITIAL_SUPPLY: u32 = 10_000;\n\n pub fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n String::from(NAME),\n String::from(SYMBOL),\n DECIMALS,\n INITIAL_SUPPLY.into()\n )\n }\n\n #[test]\n fn initialization() {\n let erc20 = setup();\n\n assert_eq!(&erc20.symbol(), SYMBOL);\n assert_eq!(&erc20.name(), NAME);\n assert_eq!(erc20.decimals(), DECIMALS);\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n let mut erc20 = setup();\n let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n erc20.transfer(&recipient, &amount);\n\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n assert_eq!(erc20.balance_of(&recipient), amount);\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n let mut erc20 = setup();\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);\n\n test_env::assert_exception(Error::InsufficientBalance, || {\n erc20.transfer(&recipient, &amount)\n });\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let mut erc20 = setup();\n let (owner, recipient, spender) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount\n }\n );\n\n // Spender transfers tokens from Owner to Recipient.\n test_env::set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n );\n \n assert_events!(erc20, Approval, Transfer);\n }\n\n #[test]\n fn transfer_from_error() {\n let mut erc20 = setup();\n let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n test_env::set_caller(spender);\n test_env::assert_exception(Error::InsufficientAllowance, || {\n erc20.transfer_from(&owner, &spender, &amount)\n });\n }\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L111-123")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events!()")," macro accepts multiple events. You must pass them in the order they were emitted. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L125")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"You can not mix both approaches, you pass full events or types only.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"Having two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/585204f8.91f66114.js b/docs/assets/js/585204f8.91f66114.js new file mode 100644 index 000000000..24ef52126 --- /dev/null +++ b/docs/assets/js/585204f8.91f66114.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[26077],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,f=c["".concat(s,".").concat(m)]||c[m]||p[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.9.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.9.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.9.0/tutorials/owned-token",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.9.0/tutorials/erc20"},next:{title:"Access Control",permalink:"/docs/0.9.0/tutorials/access-control"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow only the module owner to mint tokens."),(0,o.kt)("li",{parentName:"ol"},"Enable the current owner to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::prelude::*;\nuse odra::module::SubModule;\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"...\nuse odra::{Address, casper_types::U256};\n...\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.ownable.ensure_ownership(&self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L9-L10")," - A constructor is an excellent place to initialize both modules at once."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L13-L15")," - Most of the entrypoints do not need any modification, so we simply delegate them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49-L51")," - The same is done with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L57-L60")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is indeed the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/58abd590.87399871.js b/docs/assets/js/58abd590.87399871.js new file mode 100644 index 000000000..b29b2c03a --- /dev/null +++ b/docs/assets/js/58abd590.87399871.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97457],{76045:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/58f10d9f.ae141d4d.js b/docs/assets/js/58f10d9f.ae141d4d.js new file mode 100644 index 000000000..aa4ab3b3f --- /dev/null +++ b/docs/assets/js/58f10d9f.ae141d4d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12493],{99005:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.6.0","label":"0.6.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.6.0","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.6.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.6.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.6.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.6.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.6.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.6.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.6.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.6.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.6.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.6.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.6.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.6.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.6.0/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.6.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.6.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.6.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.6.0/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Module reusing","href":"/docs/0.6.0/advanced/using","docId":"advanced/using"},{"type":"link","label":"Delegate","href":"/docs/0.6.0/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.6.0/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.6.0/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Signatures","href":"/docs/0.6.0/advanced/signatures","docId":"advanced/signatures"}],"href":"/docs/0.6.0/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.6.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"MockVM","href":"/docs/0.6.0/backends/mock-vm","docId":"backends/mock-vm"},{"type":"link","label":"Casper","href":"/docs/0.6.0/backends/casper","docId":"backends/casper"}],"href":"/docs/0.6.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.6.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.6.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.6.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.6.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.6.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.6.0/tutorials/owned-token","docId":"tutorials/owned-token"}],"href":"/docs/0.6.0/category/tutorials"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/signatures":{"id":"advanced/signatures","title":"Signatures","description":"As each backend can use a different scheme for generating key pairs,","sidebar":"tutorialSidebar"},"advanced/using":{"id":"advanced/using","title":"Module reusing","description":"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/mock-vm":{"id":"backends/mock-vm","title":"MockVM","description":"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/5905dfac.abbc96a6.js b/docs/assets/js/5905dfac.abbc96a6.js new file mode 100644 index 000000000..6c78b9744 --- /dev/null +++ b/docs/assets/js/5905dfac.abbc96a6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52579],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=a.createContext({}),p=function(e){var r=a.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return a.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return a.createElement(a.Fragment,{},r)}},u=a.forwardRef((function(e,r){var t=e.components,o=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?a.createElement(f,l(l({ref:r},c),{},{components:t})):a.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var a=t(87462),o=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.8.1/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].",source:"@site/versioned_docs/version-0.8.1/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.8.1/examples/odra-examples",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.8.1/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.8.1/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,o.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"examples")," in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra main repository"),"."),(0,o.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,o.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,o.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,o.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/599e53c2.0940a6ec.js b/docs/assets/js/599e53c2.0940a6ec.js new file mode 100644 index 000000000..f11bd897a --- /dev/null +++ b/docs/assets/js/599e53c2.0940a6ec.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52411],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=l(r),f=o,d=m["".concat(s,".").concat(f)]||m[f]||u[f]||a;return r?n.createElement(d,i(i({ref:t},p),{},{components:r})):n.createElement(d,i({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={slug:"evm-at-risc0",title:"EVM at Risc0",authors:["zie1ony"],image:"https://github.com/odradev.png"},i=void 0,c={permalink:"/blog/evm-at-risc0",source:"@site/blog/2023-02-13-evm-at-risc0.md",title:"EVM at Risc0",description:"Let's run Solidity code inside SputnikVM inside Risc0.",date:"2023-02-13T00:00:00.000Z",formattedDate:"February 13, 2023",tags:[],readingTime:3.97,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"evm-at-risc0",title:"EVM at Risc0",authors:["zie1ony"],image:"https://github.com/odradev.png"},prevItem:{title:"Odra + CosmWasm",permalink:"/blog/odra-cosmwasm"},nextItem:{title:"Zero Knowledge on Casper",permalink:"/blog/casper-zk-risc0"}},s={authorsImageUrls:[void 0]},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Let's run Solidity code inside ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/rust-blockchain/evm/"},"SputnikVM")," inside ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/risc0/risc0"},"Risc0"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5a816386.66df1b60.js b/docs/assets/js/5a816386.66df1b60.js new file mode 100644 index 000000000..78f9c51d8 --- /dev/null +++ b/docs/assets/js/5a816386.66df1b60.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[91390],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,a=new Array(s);a[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const s={sidebar_position:11,description:"Divide your code into modules"},a="Modules",i={unversionedId:"basics/modules",id:"version-0.3.1/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.3.1/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.3.1/basics/modules",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.3.1/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.3.1/basics/native-token"}},l={},c=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to a macro ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),'. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use crate::docs::cross_calls::MathEngine;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: MathEngine,\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use super::ModulesContractDeployer;\n\n#[test]\nfn test_modules() {\n let modules_contract = ModulesContractDeployer::default();\n assert_eq!(modules_contract.add_using_module(), 8);\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5aa50e24.0d2baac1.js b/docs/assets/js/5aa50e24.0d2baac1.js new file mode 100644 index 000000000..7cc012012 --- /dev/null +++ b/docs/assets/js/5aa50e24.0d2baac1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[2944],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,y=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={},o="Storage Layout",s={unversionedId:"advanced/storage-layout",id:"advanced/storage-layout",title:"Storage Layout",description:"Odra's innovative modular design necessitates a unique storage layout. This",source:"@site/docs/advanced/04-storage-layout.md",sourceDirName:"advanced",slug:"/advanced/storage-layout",permalink:"/docs/next/advanced/storage-layout",draft:!1,tags:[],version:"current",lastUpdatedAt:1716209688,formattedLastUpdatedAt:"May 20, 2024",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/next/advanced/attributes"},next:{title:"Memory allocators",permalink:"/docs/next/advanced/using-different-allocator"}},l={},d=[{value:"Casper VM Perspective",id:"casper-vm-perspective",level:2},{value:"Odra Perspective",id:"odra-perspective",level:2},{value:"Key generation.",id:"key-generation",level:2},{value:"Value serialization",id:"value-serialization",level:2}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"Odra's innovative modular design necessitates a unique storage layout. This\narticle explains step-by-step Odra's storage layout."),(0,r.kt)("h2",{id:"casper-vm-perspective"},"Casper VM Perspective"),(0,r.kt)("p",null,"The Casper Execution Engine (VM) enables the storage of data in named keys or\ndictionaries. However, a smart contract has a limited number of named keys,\nmaking it unsuitable for storing substantial data volumes. Odra resolves this\nissue by storing all user-generated data in a dictionary called ",(0,r.kt)("inlineCode",{parentName:"p"},"state"),". This\ndictionary operates as a key-value store, where keys are strings with a maximum\nlength of 64 characters, and values are arbitrary byte arrays."),(0,r.kt)("p",null,"Here is an example of what the interface for reading and writing data could look\nlike:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait CasperStorage {\n fn read(key: &str) -> Option>;\n fn write(key: &str, value: Vec);\n}\n")),(0,r.kt)("h2",{id:"odra-perspective"},"Odra Perspective"),(0,r.kt)("p",null,"Odra was conceived with modularity and code reusability in mind. Additionally,\nwe aimed to streamline storage definition through the struct object. Consider\nthis straightforward storage definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Token {\n name: Var,\n balances: Mapping\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," structure contains two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"name")," of type ",(0,r.kt)("inlineCode",{parentName:"p"},"String")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"balances"),", which functions as a key-value store with ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," as keys and\n",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," as values."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module can be reused in another module, as demonstrated in a more\ncomplex example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Loans {\n lenders: SubModule,\n borrowers: SubModule,\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," module has two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers"),", both of which have\nthe same storage layout as defined by the ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module. Odra guarantees that\n",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers")," are stored under distinct keys within the storage\ndictionary."),(0,r.kt)("p",null,"Both ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," serve as examples to show how Odra's storage layout\noperates."),(0,r.kt)("h2",{id:"key-generation"},"Key generation."),(0,r.kt)("p",null,"Every element of a module (",(0,r.kt)("inlineCode",{parentName:"p"},"struct"),") with N elements is associated with an index\nranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an\nelement of a module is another module (",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<...>"),"), the associated index\nserves as a prefix for the indexes of the inner module."),(0,r.kt)("p",null,"While this may initially appear complex, it is easily understood through an\nexample. In the example, indexes are presented as bytes, reflecting the actual\nimplementation."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Loans {\n lenders: Token { // prefix: 0x0001\n name: 1, // key: 0x0001_0001\n balances: 2 // key: 0x0001_0010\n },\n borrowers: Token { // prefix: 0x0010\n name: 1, // key: 0x0010_0001\n balances: 2 // key: 0x0010_0010\n }\n}\n")),(0,r.kt)("p",null,"Additionally, it's worth mentioning how ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"'s keys are used in the\n",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),". They are simply concatenated with the index of the module, as\ndemonstrated in the example."),(0,r.kt)("p",null,"For instance, triggering ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers.balances.get(0x1234abcd)")," would result in a\nkey:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"0x0001_0001_1234_abcd\n")),(0,r.kt)("p",null,"Finally, the key must be hashed to fit within the 64-character limit and then\nencoded in hexadecimal format."),(0,r.kt)("h2",{id:"value-serialization"},"Value serialization"),(0,r.kt)("p",null,"Before being stored in the storage, each value is serialized into bytes using\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," serialization method and subsequently encapsulated with Casper's\n",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," types."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5ad2f7ef.f3cf482f.js b/docs/assets/js/5ad2f7ef.f3cf482f.js new file mode 100644 index 000000000..c4429f9ba --- /dev/null +++ b/docs/assets/js/5ad2f7ef.f3cf482f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73814],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.6.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.6.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.6.0/backends/casper",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"MockVM",permalink:"/docs/0.6.0/backends/mock-vm"},next:{title:"Examples",permalink:"/docs/0.6.0/category/examples"}},l={},p=[{value:"Types",id:"types",level:2},{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Constructors",id:"constructors",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Contract Deploys",id:"contract-deploys",level:2},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"types"},"Types"),(0,r.kt)("p",null,"A struct to be written into the storage must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait OdraType: \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("p",null,"The other exposed types are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CallArgs")," - wraps around casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"RuntimeArgs")),";"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," - U512 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"BlockTime")," - u64 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Address")," - an enum that encapsulates casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/account/struct.AccountHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"AccountHash"))," and ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/struct.ContractPackageHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractPackageHash")))),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"SerializableEvent")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait SerializableEvent: \n odra_types::event::OdraEvent + \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance, you call ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_balance"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("p",null,"Let's define a basic Odra module that includes a constructor:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\nstruct Counter {\n value: Variable\n}\n\n#[odra::module]\nimpl Counter {\n #[odra(init)]\n pub initialize(&mut self, value: u32) {\n self.value.set(value);\n }\n}\n")),(0,r.kt)("p",null,"Read more about constructors ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/advanced/attributes#init"},"here"),"."),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you have to specify following arguments."),(0,r.kt)("p",null,"Required arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Optional arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. If the contract has the constructor entry point marked with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]"),", this should be set to the constructor name."),(0,r.kt)("li",{parentName:"ul"},"constructor arguments that match entry point set in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor"),".")),(0,r.kt)("h2",{id:"contract-deploys"},"Contract Deploys"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "odra_cfg_constructor:string:\'initialize\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.5.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.5.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.4.0/odra-casper/livenet/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"Option")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/backends/mock-vm"},"MockVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5b4d97e3.a5ad39a8.js b/docs/assets/js/5b4d97e3.a5ad39a8.js new file mode 100644 index 000000000..c68f1d8fa --- /dev/null +++ b/docs/assets/js/5b4d97e3.a5ad39a8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95057],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),u=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=u(t),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return t?a.createElement(w,o(o({ref:n},d),{},{components:t})):a.createElement(w,o({ref:n},d))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.7.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.7.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.7.0/tutorials/ownable",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.7.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.7.0/tutorials/erc20"}},s={},u=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining constructors,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{types::Address, Variable};\n\n#[odra::module]\npub struct Ownable {\n owner: Variable
\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basic before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - Firstly, we need create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," to it above."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n execution_error, contract_env, Event, types::{Address, event::OdraEvent}\n};\n...\n\n#[odra::module]\nimpl Ownable {\n #[odra(init)]\n pub fn init(&mut self, owner: &Address) {\n if self.owner.get().is_some() {\n contract_env::revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(*owner);\n \n OwnershipChanged {\n prev_owner: None,\n new_owner: *owner\n }\n .emit();\n }\n}\n\nexecution_error! {\n pub enum Error {\n OwnerIsNotInitialized => 1,\n }\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is marked as ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]")," making it a constructor. It matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum is defined inside the ",(0,r.kt)("inlineCode",{parentName:"li"},"execution_error")," macro. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9-L11")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::revert()")," function. As an argument we pass ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsNotInitialized"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L13")," - Then we write the owner passed as an argument to the storage. To do so we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29-L33")," - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Finally, we create the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," struct and call ",(0,r.kt)("inlineCode",{parentName:"li"},"emit()")," function on it (import ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent")," trait). Hence we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get().as_ref() {\n contract_env::revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&contract_env::caller());\n let current_owner = self.get_owner();\n self.owner.set(*new_owner);\n OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n }\n .emit();\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get() {\n Some(owner) => owner,\n None => contract_env::revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\nexecution_error! {\n pub enum Error {\n NotOwner => 1,\n OwnerIsAlreadyInitialized => 2,\n OwnerIsNotInitialized => 3,\n }\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5,L32")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," is reads the current owner, and reverts if is does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::caller()")," function. The we update the state, and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22,L34")," - Lastly, a getter function. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable")," ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returns an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),", we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),".")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{assert_events, test_env};\n\n fn setup() -> (Address, OwnableRef) {\n let owner = test_env::get_account(0);\n let ownable = OwnableDeployer::init(owner);\n (owner, ownable)\n }\n\n #[test]\n fn initialization_works() {\n let (owner, ownable) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (owner, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n \n test_env::set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (_, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n ownable.change_ownership(&new_owner);\n \n test_env::assert_exception(Error::NotOwner, || {\n ownable.change_ownership(&new_owner);\n });\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we call as the first statement in each test. Take a look at the signature ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (Address, OwnableRef)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableRef")," is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Now, the module needs an owner, the easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env"),". We choose the address of first account (which is the default one)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Odra created for us ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableDeployer")," struct which implements all constructor functions. In this case there is just one function - ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which corresponds the function we have implemented in the module."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - It is time to define the first test. As you see, it is a regular rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14-15")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-23")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events"),". As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30")," - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"test env")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L32")," - As mentioned, the default is the 0-th account, if you want to change the executor call the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L49-55")," - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::assert_exception()")," with the error you expect and a failing block of code.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5bcb7a16.6cfe9cb2.js b/docs/assets/js/5bcb7a16.6cfe9cb2.js new file mode 100644 index 000000000..030362146 --- /dev/null +++ b/docs/assets/js/5bcb7a16.6cfe9cb2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52098],{66904:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.3.0/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.3.0/basics/native-token"},"next":{"title":"Module Composer","permalink":"/docs/0.3.0/advanced/composer"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/5be2abc9.7b3cb4c9.js b/docs/assets/js/5be2abc9.7b3cb4c9.js new file mode 100644 index 000000000..4f0f6343d --- /dev/null +++ b/docs/assets/js/5be2abc9.7b3cb4c9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[39737],{95650:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.2.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.2.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.2.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/5bf6529c.d41932c4.js b/docs/assets/js/5bf6529c.d41932c4.js new file mode 100644 index 000000000..f992dde22 --- /dev/null +++ b/docs/assets/js/5bf6529c.d41932c4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[15113],{50520:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.4.0/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.4.0/basics/native-token"},"next":{"title":"Module Composer","permalink":"/docs/0.4.0/advanced/composer"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/5bff39d6.9d0d4f1d.js b/docs/assets/js/5bff39d6.9d0d4f1d.js new file mode 100644 index 000000000..e2893fadd --- /dev/null +++ b/docs/assets/js/5bff39d6.9d0d4f1d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[15753],{86871:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.3.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.3.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.3.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/5c4991bb.d9e32a53.js b/docs/assets/js/5c4991bb.d9e32a53.js new file mode 100644 index 000000000..81092ae0e --- /dev/null +++ b/docs/assets/js/5c4991bb.d9e32a53.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[64189],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"version-0.3.1/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.3.1/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.3.1/basics/cargo-odra",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.3.1/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.3.1/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Updating dependencies",id:"updating-dependencies",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them on multiple backends (blockchains)."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands will help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This will create a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it will create a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This will create a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It will run your tests against Odra's MockVM. It is substantially faster than virtual machines\nprovided by blockchains developers and implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files,\nspin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat.\nKeep in mind that this is a lot slower than MockVM and you cannot use the debugger.\nThis is why MockVM was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("p",null,"Where ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," is the name of the backend we are using in this example. If the build process\nfinishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder."),(0,r.kt)("h2",{id:"updating-dependencies"},"Updating dependencies"),(0,r.kt)("p",null,"You will learn later, that the project using Odra contains more than one Rust project - your own and\none or more builders. To run ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo update")," on all of them at once instead of traversing all the folders\nyou can use this command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra update\n")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5c77c5fd.7df91293.js b/docs/assets/js/5c77c5fd.7df91293.js new file mode 100644 index 000000000..9ffffd61f --- /dev/null +++ b/docs/assets/js/5c77c5fd.7df91293.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62007],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var r=o.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return o.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},u=o.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?o.createElement(f,l(l({ref:r},c),{},{components:t})):o.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.4.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.",source:"@site/versioned_docs/version-0.4.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.4.0/examples/odra-examples",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.4.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.4.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,a.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,a.kt)("inlineCode",{parentName:"p"},"examples")," in the Odra main repository."),(0,a.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,a.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,a.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5c7e9aff.fb41ea76.js b/docs/assets/js/5c7e9aff.fb41ea76.js new file mode 100644 index 000000000..7a6d4c7c3 --- /dev/null +++ b/docs/assets/js/5c7e9aff.fb41ea76.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11777],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=p;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var u=2;u{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>w});var a=n(87462),r=n(67294),s=n(86010),i=n(12466),o=n(16550),l=n(91980),u=n(67392),c=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,o.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function y(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[i,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[l,u]=h({queryString:n,groupId:a}),[d,y]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=l??d;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{b&&o(b)}),[b]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);o(e),u(e),y(e)}),[u,y,s]),tabValues:s}}var b=n(72389);const g="tabList__CuJ",f="tabItem_LNqP";function _(e){let{className:t,block:n,selectedValue:o,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),p=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==o&&(d(t),l(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:p},i,{className:(0,s.Z)("tabs__item",f,i?.className,{"tabs__item--active":o===t})}),n??t)})))}function k(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=y(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",g)},r.createElement(_,(0,a.Z)({},e,t)),r.createElement(k,(0,a.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},61919:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),i=n(85162);const o={sidebar_position:6},l="Build, Deploy and Read the State of a Contract",u={unversionedId:"tutorials/build-deploy-read",id:"version-0.8.0/tutorials/build-deploy-read",title:"Build, Deploy and Read the State of a Contract",description:"In this guide, we will show the full path from creating a contract, deploying it and reading the state.",source:"@site/versioned_docs/version-0.8.0/tutorials/build-deploy-read.md",sourceDirName:"tutorials",slug:"/tutorials/build-deploy-read",permalink:"/docs/0.8.0/tutorials/build-deploy-read",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1710342468,formattedLastUpdatedAt:"Mar 13, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"tutorialSidebar",previous:{title:"Pausable",permalink:"/docs/0.8.0/tutorials/pauseable"},next:{title:"Migrations",permalink:"/docs/0.8.0/category/migrations"}},c={},d=[{value:"Contract",id:"contract",level:3},{value:"Deploying the contract",id:"deploying-the-contract",level:3},{value:"Storage Layout",id:"storage-layout",level:3},{value:"Reading the state",id:"reading-the-state",level:3}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"build-deploy-and-read-the-state-of-a-contract"},"Build, Deploy and Read the State of a Contract"),(0,r.kt)("p",null,"In this guide, we will show the full path from creating a contract, deploying it and reading the state."),(0,r.kt)("p",null,"We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript."),(0,r.kt)("p",null,"Before you start, make sure you completed the following steps:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Read the ",(0,r.kt)("a",{parentName:"li",href:"../category/getting-started"},"Getting Started")," guide"),(0,r.kt)("li",{parentName:"ul"},"Get familiar with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.casper.network/developers/dapps/setup-nctl/"},"NCTL tutorial")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/make-software/casper-nctl-docker"},"NCTL docker")," image"),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/casper-ecosystem/casper-client-rs"},"casper-client"))),(0,r.kt)("h3",{id:"contract"},"Contract"),(0,r.kt)("p",null,"Let's write a contract with complex storage layout."),(0,r.kt)("p",null,"The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"."),(0,r.kt)("p",null,"We will expose two methods:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The constructor ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," which sets the metadata and the version of the contract."),(0,r.kt)("li",{parentName:"ol"},"The method ",(0,r.kt)("inlineCode",{parentName:"li"},"set_data")," which sets the value of the numeric field and the values of the mapping.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=custom_item.rs showLineNumbers",title:"custom_item.rs",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, Mapping, OdraType, SubModule, Var};\n\n// A custom type with a vector of another custom type\n#[derive(OdraType, Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[derive(OdraType, Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\n// The main contract with a version, metadata and a submodule\n#[odra::module]\npub struct CustomItem {\n version: Var,\n meta: Var,\n data: SubModule\n}\n\n#[odra::module]\nimpl CustomItem {\n pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {\n let meta = Metadata {\n name,\n description,\n prices: vec![\n Price { value: price_1 },\n Price { value: price_2 }\n ]\n };\n self.meta.set(meta);\n self.version.set(self.version.get_or_default() + 1);\n }\n\n pub fn set_data(&mut self, value: u32, name: String, name2: String) {\n self.data.value.set(value);\n self.data.inner.named_values.set(&name, 10);\n self.data.inner.named_values.set(&name2, 20);\n }\n}\n\n// A submodule with a numeric value and another submodule\n#[odra::module]\nstruct Data {\n value: Var,\n inner: SubModule,\n}\n\n// A submodule with a mapping\n#[odra::module]\nstruct InnerData {\n named_values: Mapping,\n}\n\n")),(0,r.kt)("h3",{id:"deploying-the-contract"},"Deploying the contract"),(0,r.kt)("p",null,"First, we need to setup the chain. We will use the NCTL docker image to run a local network."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Next, we need to compile the contract to a Wasm file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra build -c custom_item \n")),(0,r.kt)("p",null,"Then, we can deploy the contract using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"casper-client put-deploy \\\n --node-address http://localhost:11101 \\\n --chain-name casper-net-1 \\\n --secret-key path/to/your/secret_key.pem \\ \n --session-path [PATH_TO_WASM] \\\n --payment-amount 100000000000 \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'test_contract_package_hash'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'true'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n --session-arg \"name:string='My Name'\" \\\n --session-arg \"description:string='My Description'\" \\ \n --session-arg \"price_1:u256='101'\" \\\n --session-arg \"price_2:u256='202'\"\n")),(0,r.kt)("p",null,"Finally, we can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"set_data")," method to set the values of the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'casper-client put-deploy \\\n --node-address http://localhost:11101 \\ \n --chain-name casper-net-1 \\\n --secret-key ./keys/secret_key.pem \\ \n --payment-amount 2000000000 \\\n --session-hash [DEPLOYED_CONTRACT_HASH] \\\n --session-entry-point "set_data" \\\n --session-arg "value:u32:\'666\'" \\\n --session-arg "name:string=\'alice\'" \\ \n --session-arg "name2:string=\'bob\'"\n')),(0,r.kt)("h3",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"To read the state of the contract, we need to understand the storage layout."),(0,r.kt)("p",null,"The first step is to calculate the index of the keys. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Storage Layout\n\nCustomItem: prefix: 0x0..._0000_0000_0000 0\n version: u32, 0x0..._0000_0000_0000 0\n meta: Metadata, 0x0..._0000_0000_0001 1\n data: Data: prefix: 0x0..._0000_0010_0000 (2 << 4)\n value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0\n inner: InnerData: prefix: 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4\n named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0\n")),(0,r.kt)("p",null,"The actual key is obtained as follows:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Convert the index to a big-endian byte array."),(0,r.kt)("li",{parentName:"ol"},"Concatenate the index with the mapping data."),(0,r.kt)("li",{parentName:"ol"},"Hash the concatenated bytes using blake2b."),(0,r.kt)("li",{parentName:"ol"},"Return the hex representation of the hash (the stored key must be utf-8 encoded).")),(0,r.kt)("p",null,"In more detail, the storage layout is described in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/advanced/storage-layout"},"Storage Layout article"),"."),(0,r.kt)("h3",{id:"reading-the-state"},"Reading the state"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=main.rs showLineNumbers",title:"main.rs",showLineNumbers:!0},'use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};\nuse casper_types::{\n bytesrepr::{FromBytes, ToBytes},\n U256,\n};\n\n// replace with your contract hash\nconst CONTRACT_HASH: &str = "hash-...";\nconst NODE_ADDRESS: &str = "http://localhost:11101/rpc";\nconst RPC_ID: &str = "casper-net-1";\nconst DICTIONARY_NAME: &str = "state";\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\nasync fn read_state_key(key: String) -> Vec {\n let state_root_hash = casper_client::get_state_root_hash(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n None,\n )\n .await\n .unwrap()\n .result\n .state_root_hash\n .unwrap();\n\n // Read the value from the `state` dictionary.\n let result = casper_client::get_dictionary_item(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n state_root_hash,\n DictionaryItemIdentifier::ContractNamedKey {\n key: CONTRACT_HASH.to_string(),\n dictionary_name: DICTIONARY_NAME.to_string(),\n dictionary_item_key: key,\n },\n )\n .await\n .unwrap()\n .result\n .stored_value;\n\n // We expect the value to be a CLValue\n if let StoredValue::CLValue(cl_value) = result {\n // Ignore the first 4 bytes, which are the length of the CLType.\n cl_value.inner_bytes()[4..].to_vec()\n } else {\n vec![]\n }\n}\n\nasync fn metadata() -> Metadata {\n // The key for the metadata is 1, and it has no mapping data\n let key = key(1, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the name and store the remaining bytes\n let (name, bytes) = String::from_bytes(&bytes).unwrap();\n // Read the description and store the remaining bytes\n let (description, bytes) = String::from_bytes(&bytes).unwrap();\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();\n\n let mut prices = vec![];\n // As we know the size of the vector, we can loop over it\n for _ in 0..size {\n // Read the value and store the remaining bytes\n let (value, rem) = U256::from_bytes(&bytes).unwrap();\n bytes = rem;\n prices.push(Price { value });\n }\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n Metadata {\n name,\n description,\n prices\n }\n}\n\nasync fn value() -> u32 {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n let key = key(2 << 4, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nasync fn named_value(name: &str) -> u32 {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = name.to_bytes().unwrap();\n let key = key(((2 << 4) + 1) << 4, &mapping_data);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nfn main() {\n let runtime = tokio::runtime::Runtime::new().unwrap();\n dbg!(runtime.block_on(metadata()));\n dbg!(runtime.block_on(value()));\n dbg!(runtime.block_on(named_value("alice")));\n dbg!(runtime.block_on(named_value("bob")));\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfn key(idx: u32, mapping_data: &[u8]) -> String {\n let mut key = Vec::new();\n key.extend_from_slice(idx.to_be_bytes().as_ref());\n key.extend_from_slice(mapping_data);\n let hashed_key = blake2b(&key);\n\n hex::encode(&hashed_key)\n}\n\nfn blake2b(bytes: &[u8]) -> [u8; 32] {\n let mut result = [0u8; 32];\n let mut hasher = ::new(32)\n .expect("should create hasher");\n let _ = std::io::Write::write(&mut hasher, bytes);\n blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)\n .expect("should copy hash to the result array");\n result\n}\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'cargo run\n[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {\n name: "My Contract",\n description: "My Description",\n prices: [\n Price {\n value: 123,\n },\n Price {\n value: 321,\n },\n ],\n}\n[src/main.rs:117:5] runtime.block_on(value()) = 666\n[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20\n[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10\n'))),(0,r.kt)(i.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'\nimport { blake2bHex } from "blakejs";\nimport {\n CLList,\n CLListBytesParser,\n CLStringBytesParser,\n CLU256BytesParser,\n CLU32BytesParser,\n CLU8,\n CLValueBuilder,\n CasperClient,\n CasperServiceByJsonRPC,\n Contracts,\n ToBytes,\n} from "casper-js-sdk";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\n// replace with your contract hash\nconst CONTRACT_HASH = "hash-...";\nconst STATE_DICTIONARY_NAME = "state";\nconst U32_SIZE = 4;\n\nclass Price {\n value: bigint;\n\n constructor(value: bigint) {\n this.value = value;\n }\n}\n\nclass Metadata {\n name: string;\n description: string;\n prices: Price[];\n\n constructor(name: string, description: string, prices: Price[]) {\n this.name = name;\n this.description = description;\n this.prices = prices;\n }\n}\n\nexport class Contract {\n client: CasperClient;\n service: CasperServiceByJsonRPC;\n contract: Contracts.Contract;\n\n private constructor() {\n this.client = new CasperClient(LOCAL_NODE_URL);\n this.service = new CasperServiceByJsonRPC(LOCAL_NODE_URL);\n this.contract = new Contracts.Contract(this.client);\n this.contract.setContractHash(CONTRACT_HASH);\n }\n\n static async load() {\n return new Contract();\n }\n\n async read_state(key: string) {\n const response = await this.contract.queryContractDictionary(STATE_DICTIONARY_NAME, key);\n let data: CLList = CLValueBuilder.list(response.value());\n let bytes = new CLListBytesParser().toBytes(data).unwrap();\n // Ignore the first 4 bytes, which are the length of the CLType\n return bytes.slice(4);\n }\n\n async metadata() {\n // The key for the metadata is 1, and it has no mapping data\n let bytes: Uint8Array = await this.read_state(key(1));\n\n // Read the name and store the remaining bytes\n let name = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = name.remainder as Uint8Array;\n\n // Read the description and store the remaining bytes\n let description = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = description.remainder as Uint8Array;\n\n let prices: Price[] = [];\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let size = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n bytes = size.remainder as Uint8Array;\n\n // As we know the size of the vector, we can loop over it\n for (let i = 0; i < size.result.unwrap().data.toNumber(); i++) {\n let price = new CLU256BytesParser().fromBytesWithRemainder(bytes);\n bytes = price.remainder as Uint8Array;\n prices.push(new Price(price.result.unwrap().data.toBigInt()));\n }\n\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n return new Metadata(\n name.result.unwrap().data,\n description.result.unwrap().data,\n prices\n );\n }\n \n async value() {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n const bytes = await this.read_state(key((2 << 4) + 0));\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n\n async named_value(name: string) {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = new CLStringBytesParser()\n .toBytes(CLValueBuilder.string(name))\n .unwrap();\n let bytes: Uint8Array = await this.read_state(\n key(((2 << 4) + 1) << 4, mapping_data)\n );\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfunction key(idx: number, mapping_data: Uint8Array = new Uint8Array([])) {\n let key = new Uint8Array(U32_SIZE + mapping_data.length);\n new DataView(key.buffer).setUint32(0, idx, false); // false for big-endian\n key.set(mapping_data, U32_SIZE);\n\n return blake2bHex(key, undefined, 32);\n}\n\nconst contract = Contract.load();\ncontract.then(async (c) => {\n console.log(await c.value());\n console.log(await c.metadata());\n console.log(await c.named_value("alice"));\n console.log(await c.named_value("bob"));\n});\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \nMetadata {\n name: 'My Contract',\n description: 'My Description',\n prices: [ Price { value: 123n }, Price { value: 321n } ]\n}\n666n\n20n\n10n\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5c8f3a1c.9a73c0f8.js b/docs/assets/js/5c8f3a1c.9a73c0f8.js new file mode 100644 index 000000000..929431c01 --- /dev/null +++ b/docs/assets/js/5c8f3a1c.9a73c0f8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[54097],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>c});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(a),c=r,f=m["".concat(l,".").concat(c)]||m[c]||d[c]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-1.0.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-1.0.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/basics/storage-interaction",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/basics/communicating-with-host"}},l={},p=[{value:"Var",id:"var",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"var"},"Var"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::prelude::*;\nuse odra::Var;\n\n#[odra::module]\npub struct DogContract {\n barks: Var,\n weight: Var,\n name: Var,\n walks: Var>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\nimpl DogContract {\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is used to store and access data as key-value pairs. To define a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::prelude::*;\nuse odra::{Mapping, Var};\n\n#[odra::module]\npub struct DogContract2 {\n name: Var,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," we use a similar approach\nto the one shown in the Vars section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Var working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{List, Var};\n\npub struct List {\n values: Mapping,\n index: Var\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"use odra::{prelude::*, List, Var};\n\n#[odra::module]\npub struct DogContract3 {\n name: Var,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the Odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/features/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must add ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. Let's see how to implement a ",(0,r.kt)("inlineCode",{parentName:"p"},"Dog")," type: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"#[odra_type]")," is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type.\n",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," of a custom type is ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType::Any"),", except for an unit-only enum, which is ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType::U8"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="unit_only_enum.rs"',title:'"unit_only_enum.rs"'},"enum Enum {\n Foo = 3,\n Bar = 2,\n Baz = 1,\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each custom typed field of your struct must be marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute .")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5ca766f6.cd60df16.js b/docs/assets/js/5ca766f6.cd60df16.js new file mode 100644 index 000000000..d99515cfc --- /dev/null +++ b/docs/assets/js/5ca766f6.cd60df16.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73538],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.6.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.6.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.6.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.6.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.6.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::Variable;\nuse odra::types::{BlockTime, Address};\n\n#[odra::module]\npub struct HostContract {\n name: Variable,\n created_at: Variable,\n created_by: Variable
,\n}\n\n#[odra::module]\nimpl HostContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(odra::contract_env::get_block_time());\n self.created_by.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are calling functions from ",(0,o.kt)("inlineCode",{parentName:"p"},"odra::contract_env"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"get_block_time()")," will return\nthe current block time wrapped in Odra type ",(0,o.kt)("inlineCode",{parentName:"p"},"BlockTime"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"caller()")," will return an Odra ",(0,o.kt)("inlineCode",{parentName:"p"},"Address")," of\na caller (this can be an external caller or another contract)."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5d94dea0.d74be659.js b/docs/assets/js/5d94dea0.d74be659.js new file mode 100644 index 000000000..e0246dae3 --- /dev/null +++ b/docs/assets/js/5d94dea0.d74be659.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[79486],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-1.0.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-1.0.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/category/getting-started"}},c={image:r(93415).Z},p=[{value:"What's next",id:"whats-next",level:2}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a Rust-based smart contract framework for ",(0,o.kt)("a",{parentName:"p",href:"https://casper.network"},"Casper Network"),". Odra encourages rapid development and clean,\npragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. "),(0,o.kt)("p",null,"It's free and open source!"),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/getting-started/flipper"},"Flipper example")," to find out how to start your new project with Odra."))}d.isMDXComponent=!0},93415:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/5f012ce0.a1138b74.js b/docs/assets/js/5f012ce0.a1138b74.js new file mode 100644 index 000000000..9bccaaae5 --- /dev/null +++ b/docs/assets/js/5f012ce0.a1138b74.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[72945],{47805:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.3.0","label":"0.3.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.3.0","isLast":false,"docsSidebars":{"defaultSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.3.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.3.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.3.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.3.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.3.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.3.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.3.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.3.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.3.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.3.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.3.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.3.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.3.0/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.3.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.3.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.3.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.3.0/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Module Composer","href":"/docs/0.3.0/advanced/composer","docId":"advanced/composer"},{"type":"link","label":"Delegate","href":"/docs/0.3.0/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.3.0/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.3.0/advanced/attributes","docId":"advanced/attributes"}],"href":"/docs/0.3.0/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.3.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"MockVM","href":"/docs/0.3.0/backends/mock-vm","docId":"backends/mock-vm"},{"type":"link","label":"Casper","href":"/docs/0.3.0/backends/casper","docId":"backends/casper"}],"href":"/docs/0.3.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.3.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.3.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.3.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.3.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.3.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.3.0/tutorials/owned-token","docId":"tutorials/owned-token"}],"href":"/docs/0.3.0/category/tutorials"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"defaultSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.","sidebar":"defaultSidebar"},"advanced/composer":{"id":"advanced/composer","title":"Module Composer","description":"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.","sidebar":"defaultSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"defaultSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"defaultSidebar"},"backends/mock-vm":{"id":"backends/mock-vm","title":"MockVM","description":"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"defaultSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"defaultSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"defaultSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"defaultSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"defaultSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"defaultSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"defaultSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"defaultSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"defaultSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"defaultSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"defaultSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"defaultSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"defaultSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"defaultSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.","sidebar":"defaultSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"defaultSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"defaultSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"defaultSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"defaultSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"defaultSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"defaultSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"defaultSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/5f13c361.a3855261.js b/docs/assets/js/5f13c361.a3855261.js new file mode 100644 index 000000000..95de7ab86 --- /dev/null +++ b/docs/assets/js/5f13c361.a3855261.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99820],{77715:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.4.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.4.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.4.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/5f2971ba.56be8820.js b/docs/assets/js/5f2971ba.56be8820.js new file mode 100644 index 000000000..c78ca0a6c --- /dev/null +++ b/docs/assets/js/5f2971ba.56be8820.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[23633],{3905:(e,r,n)=>{n.d(r,{Zo:()=>p,kt:()=>m});var t=n(67294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},u=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=o,w=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return n?t.createElement(w,s(s({ref:r},p),{},{components:n})):t.createElement(w,s({ref:r},p))}));function m(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=u;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=n(87462),o=(n(67294),n(3905));const a={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.2.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.2.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.2.0/basics/errors",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"defaultSidebar",previous:{title:"Testing",permalink:"/docs/0.2.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.2.0/basics/events"}},l={},c=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:r,...n}=e;return(0,o.kt)("wrapper",(0,t.Z)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"errors"},"Errors"),(0,o.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"use odra::{execution_error, Variable, UnwrapOrRevert};\nuse odra::types::Address;\n\n#[odra::module]\npub struct OwnedContract {\n name: Variable,\n owner: Variable
,\n}\n\nexecution_error! {\n pub enum Error {\n OwnerNotSet => 1,\n NotAnOwner => 2,\n }\n}\n\n\n#[odra::module]\nimpl OwnedContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = odra::contract_env::caller();\n if caller != self.owner() {\n odra::contract_env::revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,o.kt)("p",null,"Firstly, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,o.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,o.kt)("p",null,"You and the users of your contract will be thankful for a meaningful error message!"),(0,o.kt)("p",null,"You can also throw the error directly, by using ",(0,o.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"odra::contract_env::revert(Error::NotAnOwner)\n")),(0,o.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,o.kt)("p",null,"Okay, but how about testing it? We've already mentioned a function - ",(0,o.kt)("inlineCode",{parentName:"p"},"assert_exception"),". This is how you will\nuse it:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},'use super::{OwnedContractDeployer, OwnedContractRef};\nuse super::Error;\n\n#[test]\nfn test_owner_error() {\n let owner = odra::test_env::get_account(0);\n let not_an_owner = odra::test_env::get_account(1);\n\n odra::test_env::set_caller(owner);\n let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());\n\n odra::test_env::set_caller(not_an_owner);\n odra::test_env::assert_exception(Error::NotAnOwner, || {\n let mut owned_contract = OwnedContractRef::at(owned_contract.address());\n owned_contract.change_name("NewName".to_string());\n })\n}\n')),(0,o.kt)("p",null,"In the example above, because we are calling the ",(0,o.kt)("inlineCode",{parentName:"p"},"change_name"),' method as an address which is not an "owner",\nwe are expecting that "NotAnOwner" error will be thrown.'),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Here we are creating another reference to the already deployed contract using ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractRef::at()")," and passing to it\nits Address. Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractDeployer::init()")," returns the same type.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will learn how to emit and test events using Odra."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5fd0213e.7610abf6.js b/docs/assets/js/5fd0213e.7610abf6.js new file mode 100644 index 000000000..926518701 --- /dev/null +++ b/docs/assets/js/5fd0213e.7610abf6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[87974],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",s={unversionedId:"getting-started/flipper",id:"version-0.8.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.8.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.8.0/getting-started/flipper",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.8.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.8.0/category/basics"}},i={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Var;\n\n/// A module definition. Each module struct consists Vars and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Var,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor, must be named `init`.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let env = odra_test::env();\n let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);\n let contract2 = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To run the tests, execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test # or add the `-b casper` flag to run tests on the CasperVM\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/5ffb61b1.3a343e40.js b/docs/assets/js/5ffb61b1.3a343e40.js new file mode 100644 index 000000000..7b6c30e2d --- /dev/null +++ b/docs/assets/js/5ffb61b1.3a343e40.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[98632],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,v=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.8.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.8.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.8.0/basics/events",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.8.0/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.8.0/basics/cross-calls"}},l={},c=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::prelude::*;\nuse odra::{Address, Event};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract;\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64\n}\n\n#[odra::module]\nimpl PartyContract {\n pub fn init(&self) {\n self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n });\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]")," attribute like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64,\n}\n")),(0,a.kt)("p",null,"To emit an event, we use the ",(0,a.kt)("inlineCode",{parentName:"p"},"emit_event")," function from the ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),", passing the event as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n});\n")),(0,a.kt)("p",null,"To determine all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. "),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a few functions which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},'use super::{PartyContractHostRef, PartyStarted};\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\n#[test]\nfn test_party() {\n let test_env: HostEnv = odra_test::env();\n let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);\n test_env.emitted_event(\n party_contract.address(),\n &PartyStarted {\n caller: test_env.get_account(0),\n block_time: 0\n }\n );\n // If you do not want to check the exact event, you can use `emitted` function\n test_env.emitted(party_contract.address(), "PartyStarted");\n // You can also check how many events were emitted.\n assert_eq!(test_env.events_count(party_contract.address()), 1);\n}\n')),(0,a.kt)("p",null,"To explore more event testing functions, check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/60d35280.74286aaf.js b/docs/assets/js/60d35280.74286aaf.js new file mode 100644 index 000000000..d53c3b5b9 --- /dev/null +++ b/docs/assets/js/60d35280.74286aaf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[48733],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/docs/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/next/basics/odra-toml",draft:!1,tags:[],version:"current",lastUpdatedAt:1707130258,formattedLastUpdatedAt:"Feb 5, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/next/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/next/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the building tools to locate and build the contract.\nThe last segment of the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," will be used as the name for your contract - the generated wasm file will\nbe in the above case named ",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n\n[[contracts]]\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/60dd6115.f5b81372.js b/docs/assets/js/60dd6115.f5b81372.js new file mode 100644 index 000000000..0652be062 --- /dev/null +++ b/docs/assets/js/60dd6115.f5b81372.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73069],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.5.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.5.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.5.0/basics/cross-calls",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.5.0/basics/events"},next:{title:"Modules",permalink:"/docs/0.5.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::Variable;\nuse odra::types::{Address};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Variable
,\n}\n\n#[odra::module]\nimpl CrossContract {\n #[odra(init)]\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap();\n MathEngineRef::at(math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine {\n}\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To call the external contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineRef::at(math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/testing"},"Testing")," article.\nIt is a reference to already deployed - running contract.\nHere we are going to take a deeper look at it."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," is generated automatically, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nTo get an instance of a reference, we can either deploy a contract (using ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),") or by building it\ndirectly, using ",(0,r.kt)("inlineCode",{parentName:"p"},"::at(address: Address)")," method, as shown above.\nThe reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), alongside couple methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"at(Address) -> Self")," - points the reference to an Address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"address() -> Address")," - returns the Address the reference is currently pointing at"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"with_tokens(Amount) -> Self")," - attaches Amount of native tokens to the next call")),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderRef")," struct (but do not create the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderDeployer"),"). Having an address we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"AdderRef::at(address).add(3, 5)\n")),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use super::{CrossContractDeployer, MathEngineDeployer};\n\n#[test]\nfn test_cross_calls() {\n let math_engine_contract = MathEngineDeployer::default();\n let cross_contract = CrossContractDeployer::init(math_engine_contract.address());\n\n assert_eq!(cross_contract.add_using_another(), 8);\n}\n")),(0,r.kt)("p",null,"Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function we want to use."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use odra::types::Address;\n use crate::features::cross_calls::{Adder, AdderRef};\n \n #[test]\n fn test_ext() {\n let adder = AdderRef::at(get_adder_address());\n\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address() -> Address {\n let contract = MathEngineDeployer::default();\n contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/61047f5a.5d5f642f.js b/docs/assets/js/61047f5a.5d5f642f.js new file mode 100644 index 000000000..16e123b60 --- /dev/null +++ b/docs/assets/js/61047f5a.5d5f642f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25377],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},u=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||l;return t?a.createElement(f,o(o({ref:n},u),{},{components:t})):a.createElement(f,o({ref:n},u))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,o=new Array(l);o[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const l={},o="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.8.1/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.8.1/advanced/01-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.8.1/advanced/delegate",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.8.1/category/advanced"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.8.1/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],u={toc:d};function c(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::{\n Address, casper_types::U256,\n module::{Module, SubModule},\n prelude::*\n};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n pub fn approve(&mut self, spender: Address, amount: U256);\n pub fn name(&self) -> String;\n pub fn symbol(&self) -> String;\n pub fn decimals(&self) -> u8;\n pub fn total_supply(&self) -> U256;\n pub fn balance_of(&self, owner: Address) -> U256;\n pub fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n pub fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\nuse odra::{\n Address, casper_types::U256, \n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: SubModule,\n erc20: SubModule,\n exchange: SubModule\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n pub fn swap(&mut self, sender: Address, recipient: Address);\n pub fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/615e12e7.364dd08a.js b/docs/assets/js/615e12e7.364dd08a.js new file mode 100644 index 000000000..2d6150080 --- /dev/null +++ b/docs/assets/js/615e12e7.364dd08a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[93472],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,g=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return t?a.createElement(g,i(i({ref:n},p),{},{components:t})):a.createElement(g,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const o={},i="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/docs/advanced/02-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/next/advanced/advanced-storage",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/next/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/next/advanced/attributes"}},c={},l=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:l};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Var"),": A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + ToBytes + FromBytes + CLTyped\n{\n value: Var\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is a key-value storage system where the key is associated with a value.\nIn previous examples, the value of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,r.kt)("p",null,"However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{casper_types::U256, Mapping, UnwrapOrRevert};\nuse odra::prelude::*;\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct Mappings {\n strings: Mapping<(String, u32, String), String>,\n tokens: Mapping\n}\n\n#[odra::module]\nimpl Mappings {\n\n ...\n\n pub fn total_supply(&mut self, token_name: String) -> U256 {\n self.tokens.module(&token_name).total_supply()\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let opt_string = self.strings.get(&(key1, key2, key3));\n opt_string.unwrap_or_revert(&self.env())\n }\n}\n")),(0,r.kt)("p",null,"As you can see, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," key can consist of a tuple of values, not limited to a single value."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra modules differs from accessing regular values such as strings or numbers."),(0,r.kt)("p",{parentName:"admonition"},"Firstly, within a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you don't encapsulate the module with ",(0,r.kt)("inlineCode",{parentName:"p"},"Submodule"),"."),(0,r.kt)("p",{parentName:"admonition"},"Secondly, rather than utilizing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::module()"),", which returns ",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule")," and sets the appropriate namespace for nested modules.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, casper_types::U512, Sequence, Mapping};\nuse odra::prelude::*;\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n counter: Sequence,\n tokens: Mapping<(String, String), Token>,\n}\n\nimpl AdvancedStorage {\n pub fn current_value(&self) -> u32 {\n self.counter.get_current_value()\n }\n\n pub fn increment_and_get(&mut self) -> u32 {\n self.counter.next_value()\n }\n\n pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {\n let token = self.tokens.module(&(token_name, creator));\n token.balance_of(&address)\n }\n\n pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {\n let mut token = self.tokens.module(&(token_name, creator));\n token.mint(amount, to);\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra offers a Sequence module, enabling contracts to store and increment a single value."),(0,r.kt)("li",{parentName:"ol"},"Mappings support composite keys expressed as tuples and can store modules as values.")),(0,r.kt)("p",null,"Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/615fce32.d648bf7a.js b/docs/assets/js/615fce32.d648bf7a.js new file mode 100644 index 000000000..91a3d4f5c --- /dev/null +++ b/docs/assets/js/615fce32.d648bf7a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[5527],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.8.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.8.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.8.0/backends/casper",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"OdraVM",permalink:"/docs/0.8.0/backends/odra-vm"},next:{title:"Livenet",permalink:"/docs/0.8.0/backends/livenet"}},l={},p=[{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Deploying a contract to Casper network",id:"deploying-a-contract-to-casper-network",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement traits defined by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard"),", thankfully you can derive them using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance,\nyou call ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_balance()"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"deploying-a-contract-to-casper-network"},"Deploying a contract to Casper network"),(0,r.kt)("p",null,"There would be no point in writing a contract if you couldn't deploy it to the blockchain.\nYou can do it in two ways: provided by the Casper itself: using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool\nor using the Odra's Livenet integration."),(0,r.kt)("p",null,"Let's explore the first option to better understand the process."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you wish, you can skip the following section and jump to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/livenet"},"Livenet integration"),".")),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you can pass some arguments to it.\nEvery contract written in Odra expects those arguments to be set:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Additionally, if required by the contract, you can pass constructor arguments."),(0,r.kt)("p",null,"When working with the test env via ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," or when using\n",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/livenet"},"Livenet integration")," this is handled automatically. However, if you rather use\n",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," directly, you have to pass them manually:"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/odra-casper/test-vm/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/odra-vm"},"OdraVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6171926c.124c5590.js b/docs/assets/js/6171926c.124c5590.js new file mode 100644 index 000000000..c798ce577 --- /dev/null +++ b/docs/assets/js/6171926c.124c5590.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33860],{18365:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.7.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.7.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.7.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/626c8e99.79affc12.js b/docs/assets/js/626c8e99.79affc12.js new file mode 100644 index 000000000..172731ccd --- /dev/null +++ b/docs/assets/js/626c8e99.79affc12.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[35114],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",s={unversionedId:"getting-started/flipper",id:"version-0.8.1/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.8.1/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.8.1/getting-started/flipper",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.8.1/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.8.1/category/basics"}},i={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.1/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Var;\n\n/// A module definition. Each module struct consists Vars and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Var,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor, must be named `init`.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let env = odra_test::env();\n let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);\n let contract2 = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To run the tests, execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test # or add the `-b casper` flag to run tests on the CasperVM\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6289863c.64636b87.js b/docs/assets/js/6289863c.64636b87.js new file mode 100644 index 000000000..a77809a6a --- /dev/null +++ b/docs/assets/js/6289863c.64636b87.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[54733],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},o="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.3.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.3.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.3.0/basics/flipper-internals",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"defaultSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.3.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.3.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Variable;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Variables and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Variable,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Variable")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," macro marks the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperDeployer")," - a piece of code generated automatically thanks to the macros.\nThe contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/62e81aa6.16ba0842.js b/docs/assets/js/62e81aa6.16ba0842.js new file mode 100644 index 000000000..c3b267adb --- /dev/null +++ b/docs/assets/js/62e81aa6.16ba0842.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25329],{74421:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"1.0.0","label":"1.0.0","banner":null,"badge":true,"noIndex":false,"className":"docs-version-1.0.0","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/basics/events","docId":"basics/events"},{"type":"link","label":"Casper Contract Schema","href":"/docs/basics/casper-contract-schema","docId":"basics/casper-contract-schema"},{"type":"link","label":"Cross calls","href":"/docs/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/basics/native-token","docId":"basics/native-token"}],"href":"/docs/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Delegate","href":"/docs/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Storage Layout","href":"/docs/advanced/storage-layout","docId":"advanced/storage-layout"},{"type":"link","label":"Memory allocators","href":"/docs/advanced/using-different-allocator","docId":"advanced/using-different-allocator"},{"type":"link","label":"Building contracts manually","href":"/docs/advanced/building-manually","docId":"advanced/building-manually"}],"href":"/docs/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"OdraVM","href":"/docs/backends/odra-vm","docId":"backends/odra-vm"},{"type":"link","label":"Casper","href":"/docs/backends/casper","docId":"backends/casper"},{"type":"link","label":"Livenet","href":"/docs/backends/livenet","docId":"backends/livenet"}],"href":"/docs/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/tutorials/owned-token","docId":"tutorials/owned-token"},{"type":"link","label":"Access Control","href":"/docs/tutorials/access-control","docId":"tutorials/access-control"},{"type":"link","label":"Pausable","href":"/docs/tutorials/pauseable","docId":"tutorials/pauseable"},{"type":"link","label":"Ticketing System","href":"/docs/tutorials/nft","docId":"tutorials/nft"},{"type":"link","label":"Build, Deploy and Read the State of a Contract","href":"/docs/tutorials/build-deploy-read","docId":"tutorials/build-deploy-read"},{"type":"link","label":"Using Proxy Caller","href":"/docs/tutorials/using-proxy-caller","docId":"tutorials/using-proxy-caller"},{"type":"link","label":"CEP-18","href":"/docs/tutorials/cep18","docId":"tutorials/cep18"},{"type":"link","label":"Odra for Solidity developers","href":"/docs/tutorials/odra-solidity","docId":"tutorials/odra-sol"},{"type":"link","label":"Deploying a Token on Casper Livenet","href":"/docs/tutorials/deploying-on-casper","docId":"tutorials/deploying-on-casper"}],"href":"/docs/category/tutorials"},{"type":"category","label":"Migrations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Migration guide to v0.8.0","href":"/docs/migrations/to-0.8.0","docId":"migrations/to-0.8.0"},{"type":"link","label":"Migration guide to v0.9.0","href":"/docs/migrations/to-0.9.0","docId":"migrations/to-0.9.0"}],"href":"/docs/category/migrations"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that","sidebar":"tutorialSidebar"},"advanced/building-manually":{"id":"advanced/building-manually","title":"Building contracts manually","description":"cargo odra is a great tool to build and test your contracts, but sometimes","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/storage-layout":{"id":"advanced/storage-layout","title":"Storage Layout","description":"Odra\'s innovative modular design necessitates a unique storage layout. This","sidebar":"tutorialSidebar"},"advanced/using-different-allocator":{"id":"advanced/using-different-allocator","title":"Memory allocators","description":"When compiling contracts to wasm, your code needs to be no-std.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/livenet":{"id":"backends/livenet","title":"Livenet","description":"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local","sidebar":"tutorialSidebar"},"backends/odra-vm":{"id":"backends/odra-vm","title":"OdraVM","description":"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/casper-contract-schema":{"id":"basics/casper-contract-schema","title":"Casper Contract Schema","description":"Casper Contract Schema","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"migrations/to-0.8.0":{"id":"migrations/to-0.8.0","title":"Migration guide to v0.8.0","description":"Migration guide to v0.8.0","sidebar":"tutorialSidebar"},"migrations/to-0.9.0":{"id":"migrations/to-0.9.0","title":"Migration guide to v0.9.0","description":"Migration guide to v0.9.0","sidebar":"tutorialSidebar"},"tutorials/access-control":{"id":"tutorials/access-control","title":"Access Control","description":"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,","sidebar":"tutorialSidebar"},"tutorials/build-deploy-read":{"id":"tutorials/build-deploy-read","title":"Build, Deploy and Read the State of a Contract","description":"In this guide, we will show the full path from creating a contract, deploying it and reading the state.","sidebar":"tutorialSidebar"},"tutorials/cep18":{"id":"tutorials/cep18","title":"CEP-18","description":"Not so different from ERC-20, the CEP-18 standard describes a fungible","sidebar":"tutorialSidebar"},"tutorials/deploying-on-casper":{"id":"tutorials/deploying-on-casper","title":"Deploying a Token on Casper Livenet","description":"In this tutorial, we will take the token we created in","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/nft":{"id":"tutorials/nft","title":"Ticketing System","description":"Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens.","sidebar":"tutorialSidebar"},"tutorials/odra-sol":{"id":"tutorials/odra-sol","title":"Odra for Solidity developers","description":"Odra for Solidity developers","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"},"tutorials/pauseable":{"id":"tutorials/pauseable","title":"Pausable","description":"The Pausable module is like your smart contract\'s safety switch. It lets authorized users temporarily pause certain features if needed. It\'s a great way to boost security, but it\'s not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.","sidebar":"tutorialSidebar"},"tutorials/using-proxy-caller":{"id":"tutorials/using-proxy-caller","title":"Using Proxy Caller","description":"In this tutorial, we will learn how to use the proxycaller wasm to call an Odra payable function. The proxycaller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/632b087e.269d4b86.js b/docs/assets/js/632b087e.269d4b86.js new file mode 100644 index 000000000..d90798eb8 --- /dev/null +++ b/docs/assets/js/632b087e.269d4b86.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46499],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},d),{},{components:r})):n.createElement(f,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.5.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.5.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.5.0/basics/directory-structure",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.5.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.5.0/basics/odra-toml"}},s={},c=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:".builder_* folders",id:"builder_-folders",level:2},{value:"src/",id:"src",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 .builder_casper/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. We are using two features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/mock-vm")," - it is responsible for running tests on Odra's MockVM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/casper")," - backend implementation of Casper blockchain\nMore backends will be released as features that will be possible to enable here.")),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"builder_-folders"},".builder_* folders"),(0,a.kt)("p",null,"Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary\nfor building wasm files and running them against blockchain VMs. As it is not necessary to modify\nfiles in those folders in any way, by default they are hidden (hence the ",(0,a.kt)("inlineCode",{parentName:"p"},".")," at the beginning of the\nfolder name)."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain of your choosing."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/636decee.454ca7aa.js b/docs/assets/js/636decee.454ca7aa.js new file mode 100644 index 000000000..8d4f6c2c4 --- /dev/null +++ b/docs/assets/js/636decee.454ca7aa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[84051],{89933:a=>{a.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.8.1/category/backends","navigation":{"previous":{"title":"Building contracts manually","permalink":"/docs/0.8.1/advanced/building-manually"},"next":{"title":"What is a backend?","permalink":"/docs/0.8.1/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/641fd09d.89ed3898.js b/docs/assets/js/641fd09d.89ed3898.js new file mode 100644 index 000000000..ac3d1dcdc --- /dev/null +++ b/docs/assets/js/641fd09d.89ed3898.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[28748],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function l(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=t.createContext({}),d=function(e){var n=t.useContext(i),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},p=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=d(r),m=o,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||a;return r?t.createElement(f,l(l({ref:n},c),{},{components:r})):t.createElement(f,l({ref:n},c))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=p;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var d=2;d{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var t=r(87462),o=(r(67294),r(3905));const a={sidebar_position:4},l="Access Control",s={unversionedId:"tutorials/access-control",id:"version-0.8.1/tutorials/access-control",title:"Access Control",description:"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,",source:"@site/versioned_docs/version-0.8.1/tutorials/access-control.md",sourceDirName:"tutorials",slug:"/tutorials/access-control",permalink:"/docs/0.8.1/tutorials/access-control",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"OwnedToken",permalink:"/docs/0.8.1/tutorials/owned-token"},next:{title:"Pausable",permalink:"/docs/0.8.1/tutorials/pauseable"}},i={},d=[{value:"Code",id:"code",level:2},{value:"Project Structure",id:"project-structure",level:3},{value:"Events and Errors",id:"events-and-errors",level:3},{value:"Module",id:"module",level:3}],c={toc:d};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"access-control"},"Access Control"),(0,o.kt)("p",null,"In a previous tutorial, we introduced the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.1/tutorials/ownable"},(0,o.kt)("inlineCode",{parentName:"a"},"Ownable"))," module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient, "),(0,o.kt)("p",null,"In this article we design and implement a more fine-grained access control layer."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"Before we start writing code, we list the functionalities of our access control layer."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type is used across the module."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be assigned to many ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es."),(0,o.kt)("li",{parentName:"ol"},"Each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," may have a corresponding admin role."),(0,o.kt)("li",{parentName:"ol"},"Only an admin can grant/revoke a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),"."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be renounced."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," cannot be renounced on someone's behalf."),(0,o.kt)("li",{parentName:"ol"},"Each action triggers an event."),(0,o.kt)("li",{parentName:"ol"},"Unauthorized access stops contract execution.")),(0,o.kt)("h3",{id:"project-structure"},"Project Structure"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-plaintext"},"access-control\n\u251c\u2500\u2500 src\n\u2502 \u251c\u2500\u2500 access\n\u2502 \u2502 \u251c\u2500\u2500 access_control.rs\n\u2502 \u2502 \u251c\u2500\u2500 events.rs\n\u2502 \u2502 \u2514\u2500\u2500 errors.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n|\u2500\u2500 build.rs\n|\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 Odra.toml\n")),(0,o.kt)("h3",{id:"events-and-errors"},"Events and Errors"),(0,o.kt)("p",null,"There are three actions that can be performed concerning a ",(0,o.kt)("inlineCode",{parentName:"p"},"Role"),": granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=events.rs showLineNumbers",title:"events.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Event};\nuse super::access_control::Role;\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleGranted {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleRevoked {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleAdminChanged {\n pub role: Role,\n pub previous_admin_role: Role,\n pub new_admin_role: Role\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L5-L17")," - to describe the grant or revoke actions, our events specify the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", and ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es indicating who receives or loses access and who provides or withdraws it."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L19-L24")," - the event describing the admin role change, requires the subject ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", the previous and the current admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=errors.rs",title:"errors.rs"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n MissingRole = 20_000,\n RoleRenounceForAnotherAddress = 20_001,\n}\n")),(0,o.kt)("p",null,"Errors definition is straightforward - there are only two invalid states: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"An action is triggered by an unauthorized actor."),(0,o.kt)("li",{parentName:"ol"},"The caller is attempting to resign the Role on someone's behalf. ")),(0,o.kt)("h3",{id:"module"},"Module"),(0,o.kt)("p",null,"Now, we are stepping into the most interesting part: the module definition and implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=access_control.rs showLineNumbers",title:"access_control.rs",showLineNumbers:!0},"use super::events::*;\nuse super::errors::Error;\nuse odra::prelude::*;\nuse odra::{module::Module, Address, Mapping};\n\npub type Role = [u8; 32];\n\npub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];\n\n#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]\npub struct AccessControl {\n roles: Mapping<(Role, Address), bool>,\n role_admin: Mapping\n}\n\n#[odra::module]\nimpl AccessControl {\n pub fn has_role(&self, role: &Role, address: &Address) -> bool {\n self.roles.get_or_default(&(*role, *address))\n }\n\n pub fn get_role_admin(&self, role: &Role) -> Role {\n let admin_role = self.role_admin.get(role);\n if let Some(admin) = admin_role {\n admin\n } else {\n DEFAULT_ADMIN_ROLE\n }\n }\n\n pub fn grant_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_grant_role(role, address);\n }\n\n pub fn revoke_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_revoke_role(role, address);\n }\n\n pub fn renounce_role(&mut self, role: &Role, address: &Address) {\n if address != &self.env().caller() {\n self.env().revert(Error::RoleRenounceForAnotherAddress);\n }\n self.unchecked_revoke_role(role, address);\n }\n}\n\nimpl AccessControl {\n pub fn check_role(&self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.env().revert(Error::MissingRole);\n }\n }\n\n pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {\n let previous_admin_role = self.get_role_admin(role);\n self.role_admin.set(role, *admin_role);\n self.env().emit_event(RoleAdminChanged {\n role: *role,\n previous_admin_role,\n new_admin_role: *admin_role\n });\n }\n\n pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.roles.set(&(*role, *address), true);\n self.env().emit_event(RoleGranted {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n\n pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {\n if self.has_role(role, address) {\n self.roles.set(&(*role, *address), false);\n self.env().emit_event(RoleRevoked {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L6")," - Firstly, we need the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type. It is simply an alias for a 32-byte array."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L8")," - The default role is an array filled with zeros."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L13")," - The storage consists of two mappings:")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"roles")," - a nested mapping that stores information about whether a certain Role is granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"role_admin")," - each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can have a single admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L18-L20")," - This is a simple check to determine if a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," has been granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),". It is an exposed entry point and an important building block widely used throughout the entire module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49")," - This is a non-exported block containing helper functions."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L54")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," function serves as a guard function. Before a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with ",(0,o.kt)("inlineCode",{parentName:"li"},"Error::MissingRole"),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L56-L64")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"set_admin_role()")," function simply updates the role_admin mapping and emits the ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleAdminChanged")," event."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L66-L86")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_revoke_role()")," functions are mirror functions that update the roles mapping and post ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleGranted")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleRevoked")," events. If the role is already granted, ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," has no effect (the opposite check is made in the case of revoking a role)."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L22-L29")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"get_role_admin()")," entry point reads the role_admin. If there is no admin role for a given role, it returns the default role."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L31-L46")," - This is a combination of ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_*_role()"),". Entry points fail on unauthorized access.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6428a729.5d1e8c04.js b/docs/assets/js/6428a729.5d1e8c04.js new file mode 100644 index 000000000..9c8cd711a --- /dev/null +++ b/docs/assets/js/6428a729.5d1e8c04.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[14220],{11106:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.7.0/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.7.0/basics/native-token"},"next":{"title":"Module reusing","permalink":"/docs/0.7.0/advanced/using"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/64fba0bc.19332a20.js b/docs/assets/js/64fba0bc.19332a20.js new file mode 100644 index 000000000..8fc75df93 --- /dev/null +++ b/docs/assets/js/64fba0bc.19332a20.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74500],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),c=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=c(t),m=a,f=d["".concat(i,".").concat(m)]||d[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},u),{},{components:t})):r.createElement(f,o({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var c=2;c{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var r=t(87462),a=(t(67294),t(3905));const s={sidebar_position:3},o="ERC-20",l={unversionedId:"tutorials/erc20",id:"tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/docs/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/next/tutorials/erc20",draft:!1,tags:[],version:"current",lastUpdatedAt:1718616680,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/next/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/next/tutorials/owned-token"}},i={},c=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function p(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"erc-20"},"ERC-20"),(0,a.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,a.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,a.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value."),(0,a.kt)("h2",{id:"framework-features"},"Framework features"),(0,a.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Advanced storage using key-value pairs,"),(0,a.kt)("li",{parentName:"ul"},"Odra types such as ",(0,a.kt)("inlineCode",{parentName:"li"},"Address"),","),(0,a.kt)("li",{parentName:"ul"},"Advanced event assertion.")),(0,a.kt)("h2",{id:"code"},"Code"),(0,a.kt)("p",null,"Our module features a considerably more complex storage layout compared to the previous example. "),(0,a.kt)("p",null,"It is designed to store the following data:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol, and decimals."),(0,a.kt)("li",{parentName:"ol"},"Total supply."),(0,a.kt)("li",{parentName:"ol"},"Balances of individual users."),(0,a.kt)("li",{parentName:"ol"},"Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.")),(0,a.kt)("h2",{id:"module-definition"},"Module definition"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Mapping, Var};\n\n#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,a.kt)("inlineCode",{parentName:"li"},"mapping"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L11")," - Odra does not allows nested ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),"s as Solidity does. Instead, you can create a compound key using a tuple of keys.")),(0,a.kt)("h3",{id:"metadata"},"Metadata"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let caller = self.env().caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, &initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.balances.add(address, *amount);\n self.total_supply.add(*amount);\n \n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n}\n\n#[odra::event]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L3-L9")," - A constructor sets the token metadata and mints the initial supply."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L28")," - The second ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," is not an Odra module; in other words, these functions will not be part of the contract's public interface."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L29-L38")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"mint")," function is public, so, like in regular Rust code, it will be accessible from the outside. ",(0,a.kt)("inlineCode",{parentName:"li"},"mint()")," uses the notation ",(0,a.kt)("inlineCode",{parentName:"li"},"self.balances.add(address, *amount);"),", which is syntactic sugar for:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::UnwrapOrRevert;\n\nlet current_balance = self.balances.get(address).unwrap_or_default();\nlet new_balance = ::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());\nself.balances.set(address, new_balance);\n")),(0,a.kt)("h3",{id:"core"},"Core"),(0,a.kt)("p",null,"To ensure comprehensive functionality, let's implement the remaining features such as ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer_from"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"approve"),". Since they do not introduce any new concepts, we will present them without additional remarks."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers title=erc20.rs",showLineNumbers:!0,title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n self.env().revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowance(owner, spender);\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .set(&(*owner, *spender), new_allowance);\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\n#[odra::event]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 1,\n InsufficientAllowance = 2,\n}\n")),(0,a.kt)("p",null,"Now, compare the code we have written, with ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,a.kt)("h3",{id:"test"},"Test"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::*;\n use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: INITIAL_SUPPLY.into()\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n &erc20,\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n &erc20,\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let (env, mut erc20) = setup();\n\n let (owner, recipient, spender) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert!(env.emitted_event(\n &erc20,\n &Approval {\n owner,\n spender,\n value: approved_amount\n }\n ));\n\n // Spender transfers tokens from Owner to Recipient.\n env.set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert!(env.emitted_event(\n &erc20,\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n ));\n assert!(env.emitted_event(\n &erc20,\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n ));\n // assert!(env.emitted(erc20.address(), "Transfer"));\n }\n\n #[test]\n fn transfer_from_error() {\n // Given a new instance.\n let (env, mut erc20) = setup();\n\n // When the spender\'s allowance is zero.\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n // Then transfer fails.\n assert_eq!(\n erc20.try_transfer_from(&owner, &recipient, &amount),\n Err(Error::InsufficientAllowance.into())\n );\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L146")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Having two modules: ",(0,a.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/657d5854.9d29b7b8.js b/docs/assets/js/657d5854.9d29b7b8.js new file mode 100644 index 000000000..2fc3e234e --- /dev/null +++ b/docs/assets/js/657d5854.9d29b7b8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25085],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||l;return t?a.createElement(f,o(o({ref:n},c),{},{components:t})):a.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,o=new Array(l);o[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const l={},o="Delegate",i={unversionedId:"advanced/delegate",id:"version-1.0.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-1.0.0/advanced/01-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/advanced/delegate",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/category/advanced"},next:{title:"Advanced Storage Concepts",permalink:"/docs/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::{\n Address, casper_types::U256,\n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n fn approve(&mut self, spender: Address, amount: U256);\n fn name(&self) -> String;\n fn symbol(&self) -> String;\n fn decimals(&self) -> u8;\n fn total_supply(&self) -> U256;\n fn balance_of(&self, owner: Address) -> U256;\n fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\nuse odra::{\n Address, casper_types::U256, \n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: SubModule,\n erc20: SubModule,\n exchange: SubModule\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n fn swap(&mut self, sender: Address, recipient: Address);\n fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/659ab8cb.bb6c2d9a.js b/docs/assets/js/659ab8cb.bb6c2d9a.js new file mode 100644 index 000000000..400ebea2e --- /dev/null +++ b/docs/assets/js/659ab8cb.bb6c2d9a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[87922],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,o=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return r?a.createElement(f,l(l({ref:t},c),{},{components:r})):a.createElement(f,l({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var n=r.length,l=new Array(n);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var a=r(87462),o=(r(67294),r(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].",source:"@site/docs/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/next/examples/odra-examples",draft:!1,tags:[],version:"current",lastUpdatedAt:1707130258,formattedLastUpdatedAt:"Feb 5, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/next/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/next/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,o.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"examples")," in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra main repository"),"."),(0,o.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,o.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,o.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,o.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/65ab6b77.097f5870.js b/docs/assets/js/65ab6b77.097f5870.js new file mode 100644 index 000000000..d25062bb1 --- /dev/null +++ b/docs/assets/js/65ab6b77.097f5870.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62540],{47143:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.3.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.3.0/"},"next":{"title":"Installation","permalink":"/docs/0.3.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/6617ee69.befbed80.js b/docs/assets/js/6617ee69.befbed80.js new file mode 100644 index 000000000..1f2259f90 --- /dev/null +++ b/docs/assets/js/6617ee69.befbed80.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90366],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>g});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=l(n),g=a,f=d["".concat(c,".").concat(g)]||d[g]||p[g]||s;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,i=new Array(s);i[0]=d;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={},i="Signatures",o={unversionedId:"advanced/signatures",id:"version-0.7.0/advanced/signatures",title:"Signatures",description:"As each backend can use a different scheme for generating key pairs,",source:"@site/versioned_docs/version-0.7.0/advanced/05-signatures.md",sourceDirName:"advanced",slug:"/advanced/signatures",permalink:"/docs/0.7.0/advanced/signatures",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/0.7.0/advanced/attributes"},next:{title:"Backends",permalink:"/docs/0.7.0/category/backends"}},c={},l=[{value:"Signature verification",id:"signature-verification",level:2},{value:"Testing",id:"testing",level:2},{value:"ECRecover",id:"ecrecover",level:2}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"signatures"},"Signatures"),(0,a.kt)("p",null,"As each backend can use a different scheme for generating key pairs,\nOdra Framework provides a generic function for signature verification inside the contract context.\nThanks to this, you can write your code once, without worrying about underlying cryptography."),(0,a.kt)("h2",{id:"signature-verification"},"Signature verification"),(0,a.kt)("p",null,"Signature verification is conducted by a function in ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"pub fn verify_signature(message: &Bytes, signature: &Bytes, public_key: &PublicKey) -> bool;\n")),(0,a.kt)("p",null,"Here's the simplest example of this function used in a contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},"#[odra::module]\nimpl SignatureVerifier {\n pub fn verify_signature(\n &self,\n message: &Bytes,\n signature: &Bytes,\n public_key: &PublicKey\n ) -> bool {\n contract_env::verify_signature(message, signature, public_key)\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Besides the above function in the contract context, Odra provides corresponding functions in the ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"pub fn sign_message(message: &Bytes, address: &Address) -> Bytes;\n\npub fn public_key(address: &Address) -> PublicKey;\n")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"sign_message")," will return a signed message. The signing itself will be performed using a private key\nof an account behind the ",(0,a.kt)("inlineCode",{parentName:"p"},"address"),"."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"public_key")," returns the PublicKey of an ",(0,a.kt)("inlineCode",{parentName:"p"},"address")," account."),(0,a.kt)("p",null,"Thanks to those, you can write generic tests, that will work with all backends, despite differences\nin signature schemes they use."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},'#[test]\nfn signature_verification_works() {\n let message = "Message to be signed";\n let message_bytes = &Bytes::from(message.as_bytes().to_vec());\n let account = test_env::get_account(0);\n\n let signature = test_env::sign_message(message_bytes, &account);\n\n let public_key = test_env::public_key(&account);\n\n let signature_verifier = SignatureVerifierDeployer::default();\n assert!(signature_verifier.verify_signature(message_bytes, &signature, &public_key));\n}\n')),(0,a.kt)("p",null,"If you want, you can also test signatures that were created outside Odra.\nHowever, you will need to prepare separate tests for each backend:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/features/signature_verifier.rs",title:"examples/src/features/signature_verifier.rs"},'/// The following test checks that the signature verification works with the signature produced\n/// by the casper wallet.\n#[test]\n#[cfg(feature = "casper")]\nfn verify_signature_casper_wallet() {\n use odra::casper::casper_types::bytesrepr::FromBytes;\n // Casper Wallet for the message "Ahoj przygodo!" signed using SECP256K1 key\n // produces the following signature:\n // 1e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa\n // Casper Wallet adds "Casper Message:\\n" prefix to the message:\n let message = "Casper Message:\\nAhoj przygodo!";\n let message_bytes = &Bytes::from(message.as_bytes().to_vec());\n\n // Depending on the type of the key, we need to prefix the signature with a tag:\n // 0x01 for ED25519\n // 0x02 for SECP256K1\n let signature_hex = "021e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa";\n let signature: [u8; 65] = hex::decode(signature_hex).unwrap().try_into().unwrap();\n let signature_bytes = &Bytes::from(signature.to_vec());\n\n // Similar to the above, the public key is tagged:\n let public_key_hex = "02036d9b880e44254afaf34330e57703a63aec53b5918d4470059b67a4a906350105";\n let public_key_decoded = hex::decode(public_key_hex).unwrap();\n let (public_key, _) = odra::casper::casper_types::crypto::PublicKey::from_bytes(\n public_key_decoded.as_slice()\n )\n .unwrap();\n\n let signature_verifier = SignatureVerifierDeployer::default();\n assert!(signature_verifier.verify_signature(message_bytes, signature_bytes, &public_key));\n}\n')),(0,a.kt)("h2",{id:"ecrecover"},"ECRecover"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra-proposal#odra-standard-library"},"Odra Standard Library"),"\npart of the original Odra Proposal mentioned ECRecover as one of the functions that will be\nimplemented by the Odra Framework. We decided to add signatures verification instead."),(0,a.kt)("p",null,"The reasoning behind this decision is that the ECRecover works only with one type of signature.\nOdra tries to be backend-agnostic, which implies that it should also be signature-type-agnostic.\nThis was possible to achieve when implementing generic signature verification, but not with ECRecover."),(0,a.kt)("p",null,"In short, the implementation of ECRecover would not depend on the backend, pushing it into some kind of\nutils library, and those already exist, for example in\n",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/solana-program/latest/solana_program/secp256k1_recover/index.html#"},"solana_program"),"\ncrate."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6640477e.216c2b69.js b/docs/assets/js/6640477e.216c2b69.js new file mode 100644 index 000000000..1874138fe --- /dev/null +++ b/docs/assets/js/6640477e.216c2b69.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[77552],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),h=c(n),u=o,m=h["".concat(s,".").concat(u)]||h[u]||p[u]||r;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:3},i="Livenet",l={unversionedId:"backends/livenet",id:"backends/livenet",title:"Livenet",description:"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local",source:"@site/docs/backends/04-livenet.md",sourceDirName:"backends",slug:"/backends/livenet",permalink:"/docs/next/backends/livenet",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Casper",permalink:"/docs/next/backends/casper"},next:{title:"Examples",permalink:"/docs/next/category/examples"}},s={},c=[{value:"Setup",id:"setup",level:2},{value:"Usage",id:"usage",level:2},{value:"How Livenet backend works",id:"how-livenet-backend-works",level:2},{value:"Multiple environments",id:"multiple-environments",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"livenet"},"Livenet"),(0,o.kt)("p",null,"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local\ntest node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend\nto handle the deployment of your contracts to the real blockchain."),(0,o.kt)("p",null,"Furthermore, it is implemented in a similarly to Casper or OdraVM,\nhowever, it uses a real blockchain to deploy contracts and store the state.\nThis lets us use Odra to deploy and test contracts on a real blockchain, but\non the other hand, it comes with some limitations on what can be done in the tests."),(0,o.kt)("p",null,"The main differences between Livenet and e.g. CasperVM backend are:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Real CSPR tokens are used to deploy and call contracts. This also means that we need to\npay for each contract deployment and each contract call. Of course, we can use the ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/tools/faucet"},"faucet"),"\nto get some tokens for testing purposes, but we still need to specify the amount needed\nfor each action."),(0,o.kt)("li",{parentName:"ul"},"The contract state is stored on the real blockchain, so we can't just reset the state -\nwe can redeploy the contract, but we can't remove the old one."),(0,o.kt)("li",{parentName:"ul"},"Because of the above, we can load the existing contracts and use them in the tests."),(0,o.kt)("li",{parentName:"ul"},"We have no control over the block time. This means that for example, ",(0,o.kt)("inlineCode",{parentName:"li"},"advance_block_time")," function\nis implemented by waiting for the real time to pass.")),(0,o.kt)("p",null,"This is also a cause for the fact that the Livenet backend cannot be (yet) used for running\nthe regular Odra tests. Instead, we can create integration tests or binaries which will\nuse a slightly different workflow to test the contracts."),(0,o.kt)("h2",{id:"setup"},"Setup"),(0,o.kt)("p",null,"To use Livenet backend, we need to provide Odra with some information - the network address, our private\nkey and the name of the chain we want to use. Optionally, we can add multiple private keys to use\nmore than one account in our tests. Those values are passed using environment variables. We can use .env\nfile to store them - let's take a look at an example .env file, created from the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.1.0/examples/.env.sample"},".env.sample")," file from\nexamples folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env"},"# Path to the secret key of the account that will be used\n# to deploy the contracts.\n# We're using .keys folder so we don't accidentally commit\n# the secret key to the repository.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777\n\n# Chain name of the network. Known values:\n# - integration-test\nODRA_CASPER_LIVENET_CHAIN_NAME=integration-test\n\n# Paths to the secret keys of the additional accounts.\n# Main secret key will be 0th account.\nODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem\nODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem\n\n# If using CSPR.cloud, you can set the auth token here.\n# CSPR_CLOUD_AUTH_TOKEN=\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"CSPR.cloud is a service that provides mainnet and testnet Casper nodes on demand.")),(0,o.kt)("p",null,"With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find\na simple binary that deploys a contract and calls it. The test is located in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.1.0/examples/bin/erc20_on_livenet.rs"},"erc20_on_livenet.rs")," file.\nLet's go through the code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // Similar to the OdraVM backend, we need to initialize\n // the environment:\n let env = odra_casper_livenet_env::env();\n\n // Most of the for the host env works the same as in the\n // OdraVM backend.\n let owner = env.caller();\n // Addresses are the real addresses on the blockchain,\n // so we need to provide them\n // if we did not import their secret keys.\n let recipient = \n "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Arguments for the contract init method.\n let name = String::from("Plascoin");\n let symbol = String::from("PLS");\n let decimals = 10u8;\n let initial_supply: U256 = U256::from(10_000);\n \n // The main difference between other backends - we need to specify\n // the gas limit for each action.\n // The limit will be used for every consecutive action\n // until we change it.\n env.set_gas(100_000_000_000u64);\n \n // Deploy the contract. The API is the same as in the OdraVM backend.\n let init_args = Erc20InitArgs {\n name,\n symbol,\n decimals,\n initial_supply: Some(initial_supply)\n };\n let mut token = Erc20HostRef::deploy(env, init_args);\n \n // We can now use the contract as we would in the OdraVM backend.\n println!("Token address: {}", token.address().to_string());\n\n // Uncomment to load existing contract.\n // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n // let address = Address::from_str(address).unwrap();\n // We use the Livenet-specific `load` method to load the contract\n // that is already deployed.\n // let mut token = Erc20Deployer::load(env, address);\n\n // Non-mutable calls are free! Neat, huh? More on that later.\n println!("Token name: {}", token.name());\n\n // The next call is mutable, but the cost is lower that the deployment,\n // so we change the amount of gas\n env.set_gas(3_000_000_000u64);\n token.transfer(recipient, U256::from(1000));\n\n println!("Owner\'s balance: {:?}", token.balance_of(owner));\n println!("Recipient\'s balance: {:?}", token.balance_of(recipient));\n}\n')),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The above example is a rust binary, not a test. Note that it is also added as a section of the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[bin]\nname = "erc20_on_livenet"\npath = "src/bin/erc20_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n'))),(0,o.kt)("h2",{id:"usage"},"Usage"),(0,o.kt)("p",null,"To run the above code, we simply need to run the binary with the ",(0,o.kt)("inlineCode",{parentName:"p"},"livenet")," feature enabled:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Before executing the binary, make sure you built a wasm file.")),(0,o.kt)("p",null,"A part of a sample output should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'...\n\ud83d\udc81 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\udc81 INFO : Deploy "65b1a5d21..." successfully executed.\nOwner\'s balance: 4004\nRecipient\'s balance: 4000\n')),(0,o.kt)("p",null,"Those logs are a result of the last 4 lines of the above listing.\nEach deployment or a call to the blockchain will be noted and will take some time to execute.\nWe can see that the ",(0,o.kt)("inlineCode",{parentName:"p"},"transfer")," call took over 15 seconds to execute. But calling ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," was nearly instant\nand cost us nothing. How it is possible?"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You can see the deployment on ",(0,o.kt)("a",{parentName:"p",href:"http://cspr.live/"},"http://cspr.live/")," - the transfer from the example\ncan be seen ",(0,o.kt)("a",{parentName:"p",href:"https://integration.cspr.live/deploy/65b1a5d21174a62c675f89683aba995c453b942c705b404a1f8bbf6f0f6de32a"},"here"),".")),(0,o.kt)("h2",{id:"how-livenet-backend-works"},"How Livenet backend works"),(0,o.kt)("p",null,"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state.\nIt is possible however to query the state of the blockchain for free."),(0,o.kt)("p",null,"This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the\nnode is the current state. This is why the ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," call was almost instant and free."),(0,o.kt)("p",null,"Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract\n(see ",(0,o.kt)("a",{parentName:"p",href:"/docs/next/basics/cross-calls"},"Cross Calls"),"), it is executed offline and\nnode is used for the state query only. However, the Livenet needs to know the connection between the contracts\nand the code, so make sure to deploy or load already deployed contracts"),(0,o.kt)("h2",{id:"multiple-environments"},"Multiple environments"),(0,o.kt)("p",null,"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts,\nmultiple nodes or even multiple chains."),(0,o.kt)("p",null,"To do this, simply create a new ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with a different prefix - for example, ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet.env"),".\nThen, pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"ODRA_CASPER_LIVENET_ENV")," variable with value either ",(0,o.kt)("inlineCode",{parentName:"p"},"integration")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet")," to select which file\nhas to be used first. If your ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file has a value that IS present in the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file, it will\noverride the value from the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("p",null,"To sum up - this command will firstly load the ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file and then load the missing values from ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/666726ac.41e21f2e.js b/docs/assets/js/666726ac.41e21f2e.js new file mode 100644 index 000000000..7a8ef929c --- /dev/null +++ b/docs/assets/js/666726ac.41e21f2e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[20355],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),f=o,h=p["".concat(l,".").concat(f)]||p[f]||u[f]||r;return n?a.createElement(h,s(s({ref:t},d),{},{components:n})):a.createElement(h,s({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,s=new Array(r);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:10},s="Deploying a Token on Casper Livenet",i={unversionedId:"tutorials/deploying-on-casper",id:"version-1.0.0/tutorials/deploying-on-casper",title:"Deploying a Token on Casper Livenet",description:"In this tutorial, we will take the token we created in",source:"@site/versioned_docs/version-1.0.0/tutorials/deploying-on-casper.md",sourceDirName:"tutorials",slug:"/tutorials/deploying-on-casper",permalink:"/docs/tutorials/deploying-on-casper",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10},sidebar:"tutorialSidebar",previous:{title:"Odra for Solidity developers",permalink:"/docs/tutorials/odra-solidity"},next:{title:"Migrations",permalink:"/docs/category/migrations"}},l={},c=[{value:"Casper Wallet",id:"casper-wallet",level:2},{value:"Getting tokens",id:"getting-tokens",level:2},{value:"Odra Livenet",id:"odra-livenet",level:2},{value:"Cspr.live",id:"csprlive",level:2},{value:"Transferring Tokens using Casper Wallet",id:"transferring-tokens-using-casper-wallet",level:2},{value:"Conclusion",id:"conclusion",level:2}],d={toc:c};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"deploying-a-token-on-casper-livenet"},"Deploying a Token on Casper Livenet"),(0,o.kt)("p",null,"In this tutorial, we will take the token we created in\nthe previous one and deploy it on the Livenet Casper network,\nusing the Odra Livenet backend."),(0,o.kt)("p",null,"We will also take a look at the tools that Casper Ecosystem\nprovides to interact with our newly deployed token."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"Most of this tutorial will work with any Casper contract.")),(0,o.kt)("h2",{id:"casper-wallet"},"Casper Wallet"),(0,o.kt)("p",null,"We will be using Casper Wallet to do some tasks in this tutorial.\nTo install it, please follow the instructions on the\n",(0,o.kt)("a",{parentName:"p",href:"https://www.casperwallet.io/"},"official website"),"."),(0,o.kt)("p",null,"After setting up the wallet, extract the private key of the account\nyou want to use for our testing.\nYou can do this by clicking on the Menu > Download account keys."),(0,o.kt)("admonition",{type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"You are solely responsible for the security of your private keys.\nWe recommend creating a new account for the testing purposes.")),(0,o.kt)("p",null,"Why do we need the private key? We will use it in Odra to deploy\nour contract to the Casper network using Livenet backend."),(0,o.kt)("h2",{id:"getting-tokens"},"Getting tokens"),(0,o.kt)("p",null,"To deploy the contract on the Livenet, we need to have some CSPR.\nThe easiest way to get them is to use the faucet, which will send\nus 1000 CSPR for free. Unfortunately, only on the Testnet."),(0,o.kt)("p",null,"To use the faucet, go to the ",(0,o.kt)("a",{parentName:"p",href:"https://testnet.cspr.live/tools/faucet"},"Casper Testnet Faucet"),'.\nLog in using your Casper Wallet account and click on the "Request Tokens" button.'),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"One account can request tokens only once. If you run out of tokens, you can\neither ask someone in the Casper community to send you some, or simply create a new account\nin the wallet.")),(0,o.kt)("p",null,"Now, when we have the tokens, we can deploy the contract. Let's do it using Odra!"),(0,o.kt)("h2",{id:"odra-livenet"},"Odra Livenet"),(0,o.kt)("p",null,"Odra Livenet is described in detail in the\n",(0,o.kt)("a",{parentName:"p",href:"../backends/livenet"},"backends section")," of this documentation.\nWe will then briefly describe how to use set it up in this tutorial."),(0,o.kt)("p",null,"In your contract code, create a new file in the bin folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="bin/our_token_livenet.rs"',title:'"bin/our_token_livenet.rs"'},'//! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial\n//! creator.\nuse std::str::FromStr;\n\nuse odra::casper_types::U256;\nuse odra::host::{Deployer, HostEnv, HostRef, HostRefLoader};\nuse odra::Address;\nuse ourcoin::token::{OurTokenHostRef, OurTokenInitArgs};\n\nfn main() {\n // Load the Casper livenet environment.\n let env = odra_casper_livenet_env::env();\n\n // Caller is the deployer and the owner of the private key.\n let owner = env.caller();\n // Just some random address...\n let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Deploy new contract.\n let mut token = deploy_our_token(&env);\n println!("Token address: {}", token.address().to_string());\n\n // Propose minting new tokens.\n env.set_gas(1_000_000_000u64);\n token.propose_new_mint(recipient, U256::from(1_000));\n\n // Vote, we are the only voter.\n env.set_gas(1_000_000_000u64);\n token.vote(true, U256::from(1_000));\n\n // Let\'s advance the block time by 11 minutes, as\n // we set the voting time to 10 minutes.\n // OH NO! It is the Livenet, so we need to wait real time...\n // Hopefully you are not in a hurry.\n env.advance_block_time(11 * 60 * 1000);\n\n // Tally the votes.\n env.set_gas(1_500_000_000u64);\n token.tally();\n\n // Check the balances.\n println!("Owner\'s balance: {:?}", token.balance_of(&owner));\n println!(\n "Tutorial creator\'s balance: {:?}",\n token.balance_of(&recipient)\n );\n}\n\n/// Deploys a contract.\npub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef {\n let name = String::from("OurToken");\n let symbol = String::from("OT");\n let decimals = 0;\n let initial_supply = U256::from(1_000);\n\n let init_args = OurTokenInitArgs {\n name,\n symbol,\n decimals,\n initial_supply,\n };\n\n env.set_gas(300_000_000_000u64);\n OurTokenHostRef::deploy(env, init_args)\n}\n\n/// Loads a contract. Just in case you need to load an existing contract later...\nfn _load_cep18(env: &HostEnv) -> OurTokenHostRef {\n let address = "hash-XXXXX";\n let address = Address::from_str(address).unwrap();\n OurTokenHostRef::load(env, address)\n}\n')),(0,o.kt)("p",null,"In your ",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file, we need to add a new dependency, a feature and\nregister the new binary. In the end, it should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "ourcoin"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "1.0.0", features = [], default-features = false }\nodra-modules = { version = "1.0.0", features = [], default-features = false }\nodra-casper-livenet-env = { version = "1.0.0", optional = true }\n\n[dev-dependencies]\nodra-test = { version = "1.0.0", features = [], default-features = false }\n\n[build-dependencies]\nodra-build = { version = "1.0.0", features = [], default-features = false }\n\n[features]\ndefault = []\nlivenet = ["odra-casper-livenet-env"]\n\n[[bin]]\nname = "ourcoin_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "ourcoin_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[[bin]]\nname = "our_token_livenet"\npath = "bin/our_token_livenet.rs"\nrequired-features = ["livenet"]\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,o.kt)("p",null,"Finally, add the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with the following content:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env",metastring:'title=".env"',title:'".env"'},"# Path to the secret key of the account that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777\n\n# Chain name of the network.\nODRA_CASPER_LIVENET_CHAIN_NAME=casper-test\n")),(0,o.kt)("p",null,"Of course, you need to replace the secret key's path\nwith the path to the secret key file you downloaded from the Casper Wallet."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"One of the problems you may encounter is that the node you are using\nwill be down or will not accept your calls. In this case, you will\nhave to find and use another node IP address.")),(0,o.kt)("p",null,"Now, we will run our code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin our_token_livenet --features livenet\n")),(0,o.kt)("p",null,"If everything is set up correctly, you should see the output similar to this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' Running `target/debug/our_token_livenet`\n\ud83d\udc81 INFO : Deploying "OurToken".\n\ud83d\udc81 INFO : Found wasm under "wasm/OurToken.wasm".\n\ud83d\ude44 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".\n\ud83d\ude44 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".\n\ud83d\udc81 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed.\n\ud83d\udc81 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed.\n\nToken address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857\n\n\ud83d\udc81 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint".\n\ud83d\ude44 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".\n\ud83d\ude44 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".\n\ud83d\udc81 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed.\n\ud83d\udc81 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote".\n\ud83d\ude44 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".\n\ud83d\ude44 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".\n\ud83d\udc81 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed.\n\ud83d\udc81 INFO : advance_block_time called - Waiting for 660000 ms\n\ud83d\udc81 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally".\n\ud83d\ude44 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".\n\ud83d\ude44 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".\n\ud83d\udc81 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed.\n\nOwner\'s balance: 1000\nTutorial creator\'s balance: 1000\n')),(0,o.kt)("p",null,"Congratulations, your contract is now deployed on the Casper network!\nBefore we move on, note the address of the token!"),(0,o.kt)("p",null,"We will use it in the next section to interact with the token. In our case it is\n",(0,o.kt)("inlineCode",{parentName:"p"},"hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857"),"."),(0,o.kt)("h2",{id:"csprlive"},"Cspr.live"),(0,o.kt)("p",null,"The first thing we will do is to explore Casper's network block explorer,\n",(0,o.kt)("a",{parentName:"p",href:"https://cspr.live/"},"cspr.live"),". We can put the address of our token in the search bar\nto find it."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"If you deployed your contract on the Testnet, remember to make sure that the Testnet\nnetwork is selected in the dropdown menu in the top right corner.")),(0,o.kt)("p",null,"If everything is set up correctly, you should see the contract package's details.\nBesides the owner, keys etc., you can also see the contract's metdata, if it\nwas developed using a standard that cspr.live supports."),(0,o.kt)("p",null,"Indeed, we can see that it detected that our contract is a CEP-18 token!\nWe see the name, symbol and total supply.\nAll the mentions of the contract on the website will use the token name instead\nof the contract address."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"contract.png",src:n(16566).Z,width:"444",height:"417"})),(0,o.kt)("p",null,"Additionally, on the Token Txs tab, we can see the transactions that happened\nwith the token. We can see the minting transaction we did in the previous section\nand transfers done during the voting process."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"transactions.png",src:n(11087).Z,width:"605",height:"343"})),(0,o.kt)("p",null,"If we click on one of the accounts that recieved the tokens, we will go to the\naccount page. Here, on the Tokens tab, we can see all the tokens that the account\nhas - and OurToken is one of them!"),(0,o.kt)("p",null,"If you wish, you can check the status of the contract deployed during the development\nof this tutorial ",(0,o.kt)("a",{parentName:"p",href:"https://testnet.cspr.live/contract-package/565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857"},"here"),"."),(0,o.kt)("h2",{id:"transferring-tokens-using-casper-wallet"},"Transferring Tokens using Casper Wallet"),(0,o.kt)("p",null,"Casper wallet can do much more than just logging in to the faucet, exporting\nthe private keys and transferring CSPR. It can also interact with the contracts\ndeployed on the network."),(0,o.kt)("p",null,"If you deployed the contract and left some OT tokens to yourself, you should see\nthem in the Casper Wallet window."),(0,o.kt)("p",null,"You should also be able to transfer them to another account!"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"wallet.png",src:n(17626).Z,width:"351",height:"591"})),(0,o.kt)("h2",{id:"conclusion"},"Conclusion"),(0,o.kt)("p",null,"We've successfully deployed a token on the Casper network and interacted with it\nusing the Odra backend and Casper Wallet. We've also learned how to use the\ncspr.live block explorer to check the status of your contract."),(0,o.kt)("p",null,"Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem\nprovides. Feel free to explore them on ",(0,o.kt)("a",{parentName:"p",href:"https://casperecosystem.io/"},"casperecosystem.io"),"."))}u.isMDXComponent=!0},16566:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/contract-4a6ad767dffcbb5b1b7e793447a41680.png"},11087:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/transactions-3d96ebac6e49c7b9bee5ef5bc14a4ef4.png"},17626:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wallet-d80c30c75d661377a4d31b1c8fb24664.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/67a34253.4f55f823.js b/docs/assets/js/67a34253.4f55f823.js new file mode 100644 index 000000000..a13b4daf0 --- /dev/null +++ b/docs/assets/js/67a34253.4f55f823.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[42691],{75821:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.5.0/category/backends","navigation":{"previous":{"title":"Signatures","permalink":"/docs/0.5.0/advanced/signatures"},"next":{"title":"What is a backend?","permalink":"/docs/0.5.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/67cb2d26.9e2cf7d9.js b/docs/assets/js/67cb2d26.9e2cf7d9.js new file mode 100644 index 000000000..98496c423 --- /dev/null +++ b/docs/assets/js/67cb2d26.9e2cf7d9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[72522],{21861:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.3.1/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.3.1/basics/native-token"},"next":{"title":"Module Composer","permalink":"/docs/0.3.1/advanced/composer"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/67cf10af.11106de3.js b/docs/assets/js/67cf10af.11106de3.js new file mode 100644 index 000000000..1b0e225d8 --- /dev/null +++ b/docs/assets/js/67cf10af.11106de3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[49168],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,f=c["".concat(s,".").concat(m)]||c[m]||p[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/docs/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/next/tutorials/owned-token",draft:!1,tags:[],version:"current",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/next/tutorials/erc20"},next:{title:"Access Control",permalink:"/docs/next/tutorials/access-control"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow only the module owner to mint tokens."),(0,o.kt)("li",{parentName:"ol"},"Enable the current owner to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::prelude::*;\nuse odra::module::SubModule;\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"...\nuse odra::{Address, casper_types::U256};\n...\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.ownable.ensure_ownership(&self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L9-L10")," - A constructor is an excellent place to initialize both modules at once."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L13-L15")," - Most of the entrypoints do not need any modification, so we simply delegate them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49-L51")," - The same is done with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L57-L60")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is indeed the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/67d74c2d.9f25edcc.js b/docs/assets/js/67d74c2d.9f25edcc.js new file mode 100644 index 000000000..3d64c6167 --- /dev/null +++ b/docs/assets/js/67d74c2d.9f25edcc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63556],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.6.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.6.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.6.0/basics/storage-interaction",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.6.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.6.0/basics/communicating-with-host"}},l={},p=[{value:"Variable",id:"variable",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"variable"},"Variable"),(0,r.kt)("p",null,"The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Variable,\n weight: Variable,\n name: Variable,\n walks: Variable>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::Variable;\n\n#[odra::module]\nimpl DogContract {\n #[odra(init)]\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A Variable is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses Mapping to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{Mapping, Variable};\n\n#[odra::module]\npub struct DogContract2 {\n name: Variable,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a Mapping we use a similar approach\nto the one shown in the Variables section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Variable working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{Variable, List};\n\npub struct List {\n values: Mapping,\n index: Variable\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Variable,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/docs/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/68495fce.d141d5bc.js b/docs/assets/js/68495fce.d141d5bc.js new file mode 100644 index 000000000..e502fee97 --- /dev/null +++ b/docs/assets/js/68495fce.d141d5bc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[17552],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),u=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=u(t),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return t?a.createElement(w,o(o({ref:n},d),{},{components:t})):a.createElement(w,o({ref:n},d))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.5.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.5.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.5.0/tutorials/ownable",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.5.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.5.0/tutorials/erc20"}},s={},u=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining constructors,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{types::Address, Variable};\n\n#[odra::module]\npub struct Ownable {\n owner: Variable
\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basic before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - Firstly, we need create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," to it above."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n execution_error, contract_env, Event, types::{Address, event::OdraEvent}\n};\n...\n\n#[odra::module]\nimpl Ownable {\n #[odra(init)]\n pub fn init(&mut self, owner: &Address) {\n if self.owner.get().is_some() {\n contract_env::revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(*owner);\n \n OwnershipChanged {\n prev_owner: None,\n new_owner: *owner\n }\n .emit();\n }\n}\n\nexecution_error! {\n pub enum Error {\n OwnerIsNotInitialized => 1,\n }\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is marked as ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]")," making it a constructor. It matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum is defined inside the ",(0,r.kt)("inlineCode",{parentName:"li"},"execution_error")," macro. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9-L11")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::revert()")," function. As an argument we pass ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsNotInitialized"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L13")," - Then we write the owner passed as an argument to the storage. To do so we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29-L33")," - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Finally, we create the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," struct and call ",(0,r.kt)("inlineCode",{parentName:"li"},"emit()")," function on it (import ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent")," trait). Hence we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get().as_ref() {\n contract_env::revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&contract_env::caller());\n let current_owner = self.get_owner();\n self.owner.set(*new_owner);\n OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n }\n .emit();\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get() {\n Some(owner) => owner,\n None => contract_env::revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\nexecution_error! {\n pub enum Error {\n NotOwner => 1,\n OwnerIsAlreadyInitialized => 2,\n OwnerIsNotInitialized => 3,\n }\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5,L32")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," is reads the current owner, and reverts if is does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::caller()")," function. The we update the state, and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22,L34")," - Lastly, a getter function. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable")," ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returns an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),", we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),".")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{assert_events, test_env};\n\n fn setup() -> (Address, OwnableRef) {\n let owner = test_env::get_account(0);\n let ownable = OwnableDeployer::init(owner);\n (owner, ownable)\n }\n\n #[test]\n fn initialization_works() {\n let (owner, ownable) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (owner, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n \n test_env::set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (_, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n ownable.change_ownership(&new_owner);\n \n test_env::assert_exception(Error::NotOwner, || {\n ownable.change_ownership(&new_owner);\n });\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we call as the first statement in each test. Take a look at the signature ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (Address, OwnableRef)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableRef")," is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Now, the module needs an owner, the easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env"),". We choose the address of first account (which is the default one)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Odra created for us ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableDeployer")," struct which implements all constructor functions. In this case there is just one function - ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which corresponds the function we have implemented in the module."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - It is time to define the first test. As you see, it is a regular rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14-15")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-23")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events"),". As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30")," - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"test env")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L32")," - As mentioned, the default is the 0-th account, if you want to change the executor call the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L49-55")," - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::assert_exception()")," with the error you expect and a failing block of code.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/68deafd0.21dfeb75.js b/docs/assets/js/68deafd0.21dfeb75.js new file mode 100644 index 000000000..6ba4b10cb --- /dev/null +++ b/docs/assets/js/68deafd0.21dfeb75.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97779],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=s(n),m=r,b=p["".concat(c,".").concat(m)]||p[m]||d[m]||o;return n?a.createElement(b,l(l({ref:t},u),{},{components:n})):a.createElement(b,l({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-0.6.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.",source:"@site/versioned_docs/version-0.6.0/advanced/04-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.6.0/advanced/attributes",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.6.0/advanced/advanced-storage"},next:{title:"Signatures",permalink:"/docs/0.6.0/advanced/signatures"}},c={},s=[{value:"Init",id:"init",level:2},{value:"Example",id:"example",level:3},{value:"Using",id:"using",level:2},{value:"Example",id:"example-1",level:3},{value:"Payable",id:"payable",level:2},{value:"Example",id:"example-2",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:s};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attributes"},"Attributes"),(0,r.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution."),(0,r.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,r.kt)("h2",{id:"init"},"Init"),(0,r.kt)("p",null,"If your contract needs initial setup, adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed."),(0,r.kt)("p",null,"It's important to note that a constructor function should not be invoked in any other context."),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/erc20.rs",title:"examples/src/contracts/erc20.rs"},"#[odra(init)]\npub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n}\n")),(0,r.kt)("h2",{id:"using"},"Using"),(0,r.kt)("p",null,"An attribute applicable to struct fields. The ",(0,r.kt)("inlineCode",{parentName:"p"},"using")," attribute accepts multiple values, separated by ",(0,r.kt)("inlineCode",{parentName:"p"},","),".\nEach value attribute must point at an existing field."),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n access_control: AccessControl,\n meta: Metadata,\n #[odra(using = "access_control, meta")]\n // #[odra(using = "access_control, metadata")] - would not compile - `metadata` field does not exist\n storage: Storage\n}\n\n#[odra::module]\nstruct AccessControl {\n owner: Variable
\n}\n\n#[odra::module]\nstruct Metadata {\n version: Variable\n}\n\n#[odra::module]\nstruct Storage {\n value: Variable,\n access_control: AccessControl,\n meta: Metadata\n}\n')),(0,r.kt)("h2",{id:"payable"},"Payable"),(0,r.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,r.kt)("h3",{id:"example-2"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = contract_env::caller();\n let amount: Balance = contract_env::attached_value();\n let current_block_time: BlockTime = contract_env::get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n contract_env::revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n Deposit {\n address: caller,\n amount\n }\n .emit();\n}\n")),(0,r.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,r.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,r.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,r.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,r.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,r.kt)("p",null,"In Odra you can just apply the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,r.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,r.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"or "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"In both cases attributes order does not matter."),(0,r.kt)("p",null,"However, a constructor cannot be payable, so the below code would not compile."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(init)]\nfn initialize() {\n // your logic...\n}\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/695d43df.7dd8f767.js b/docs/assets/js/695d43df.7dd8f767.js new file mode 100644 index 000000000..3b1483b51 --- /dev/null +++ b/docs/assets/js/695d43df.7dd8f767.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[43751],{3905:(t,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function s(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var l=a.createContext({}),c=function(t){var e=a.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},d=function(t){var e=c(t.components);return a.createElement(l.Provider,{value:e},t.children)},p={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,l=t.parentName,d=i(t,["components","mdxType","originalType","parentName"]),u=c(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(h,s(s({ref:e},d),{},{components:n})):a.createElement(h,s({ref:e},d))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in e)hasOwnProperty.call(e,l)&&(i[l]=e[l]);i.originalType=t,i.mdxType="string"==typeof t?t:r,s[1]=i;for(var c=2;c{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.8.1/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.8.1/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.8.1/basics/testing",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.8.1/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.8.1/basics/errors"}},l={},c=[{value:"HostEnv",id:"hostenv",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function p(t){let{components:e,...n}=t;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{List, Var};\n\n#[cfg(test)]\nmod tests {\n use super::{DogContract3HostRef, DogContract3InitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn init_test() {\n let test_env = odra_test::env();\n let init_args = DogContract3InitArgs {\n name: "DogContract".to_string()\n };\n let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,r.kt)("p",null,"The first interesting thing you may notice is placed the import section."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use super::{DogContract3HostRef, DogContract3InitArgs};\nuse odra::{host::Deployer, prelude::*};\n")),(0,r.kt)("p",null,"We are using ",(0,r.kt)("inlineCode",{parentName:"p"},"super")," to import the ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," from the parent module.\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}InitArgs")," are types that was generated for us by Odra."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," is a reference to the contract that we can use to interact with it (call entrypoints)\nand implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/host/trait.HostRef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostRef"))," trait. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," is a struct that we use to initialize the contract and implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/host/trait.InitArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait.\nConsidering the contract initialization, there three possible scenarios:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with arguments, then Odra creates a struct named ",(0,r.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with no arguments, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract does not have a constructor, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),".\nAll of those structs implement the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::InitArgs")," trait, required to conform to the\n",(0,r.kt)("inlineCode",{parentName:"li"},"Deployer::deploy")," method signature. ")),(0,r.kt)("p",null,"The other import is ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::host::Deployer"),". This is a trait is used to deploy the contract and give us a reference to it."),(0,r.kt)("p",null,"Let's take a look at the test itself. How to obtain a reference to the contract?\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," implements the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/host/trait.Deployer.html"},(0,r.kt)("inlineCode",{parentName:"a"},"Deployer"))," trait, which provides the ",(0,r.kt)("inlineCode",{parentName:"p"},"deploy")," method:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n")),(0,r.kt)("p",null,"From now on, we can use ",(0,r.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute are available to us:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,r.kt)("h2",{id:"hostenv"},"HostEnv"),(0,r.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};\n use odra::{host::{Deployer, HostEnv}, prelude::*};\n\n #[test]\n fn env() {\n let test_env: HostEnv = odra_test::env();\n test_env.set_caller(test_env.get_account(0));\n let init_args = TestingContractInitArgs {\n name: "MyContract".to_string()\n };\n let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);\n let creator = testing_contract.created_by();\n test_env.set_caller(test_env.get_account(1));\n let init_args = TestingContractInitArgs {\n name: "MyContract2".to_string()\n };\n let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);\n let creator2 = testing_contract2.created_by();\n assert_ne!(creator, creator2);\n }\n}\n')),(0,r.kt)("p",null,"In the code above, at the beginning of the test, we are obtaining a ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," instance using ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_test::env()"),".\nNext, we are deploying two instances of the same contract, but we're using ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::ContractEnv::caller()"),"\nthe function we are calling inside the contract."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a set of functions that will let you write better tests:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn set_caller(&self, address: Address)")," - you've seen it in action just now"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn balance_of(&self, address: &Address) -> U512")," - returns the balance of the account associated with the given address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn advance_block_time(&self, time_diff: u64)")," - increases the current value of ",(0,r.kt)("inlineCode",{parentName:"li"},"block_time")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn get_account(&self, n: usize) -> Address")," - returns an n-th address that was prepared for you by Odra in advance;\nby default, you start with the 0-th account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn emitted_event(&self, contract_address: &Address, event: &T) -> bool")," - verifies if the event was emitted by the contract")),(0,r.kt)("p",null,"Full list of functions can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/host/struct.HostEnv.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We take a look at how Odra handles errors!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/69fd3230.4359bf34.js b/docs/assets/js/69fd3230.4359bf34.js new file mode 100644 index 000000000..b51f57653 --- /dev/null +++ b/docs/assets/js/69fd3230.4359bf34.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[24371],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),d=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(i,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var d=2;d{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",s={unversionedId:"examples/using-odra-modules",id:"examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/docs/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/next/examples/using-odra-modules",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/next/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/next/category/tutorials"}},i={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"CEP-18",id:"cep-18",level:4},{value:"CEP-78",id:"cep-78",level:4},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "1.1.0"\n\n[dev-dependencies]\nodra-test = "1.1.0"\n\n[build-dependencies]\nodra-build = "1.1.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = "1.1.0"\nodra-modules = "1.1.0"\n')),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::prelude::*;\nuse odra::{Address, casper_types::U256, module::SubModule};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra repository"),".")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"cep-18"},"CEP-18"),(0,r.kt)("p",null,"Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casper-network/ceps/blob/master/text/0018-token-standard.md"},"here"),"."),(0,r.kt)("h4",{id:"cep-78"},"CEP-78"),(0,r.kt)("p",null,"Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casper-network/ceps/blob/master/text/0078-enhanced-nft-standard.md"},"here"),"."),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6a9553ca.a415a1c0.js b/docs/assets/js/6a9553ca.a415a1c0.js new file mode 100644 index 000000000..cab284346 --- /dev/null +++ b/docs/assets/js/6a9553ca.a415a1c0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73774],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=a.createContext({}),p=function(e){var r=a.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return a.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return a.createElement(a.Fragment,{},r)}},u=a.forwardRef((function(e,r){var t=e.components,o=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?a.createElement(f,l(l({ref:r},c),{},{components:t})):a.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var a=t(87462),o=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.9.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].",source:"@site/versioned_docs/version-0.9.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.9.0/examples/odra-examples",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.9.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.9.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,o.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"examples")," in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra main repository"),"."),(0,o.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,o.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,o.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,o.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6acba536.e5151411.js b/docs/assets/js/6acba536.e5151411.js new file mode 100644 index 000000000..f40ab66ba --- /dev/null +++ b/docs/assets/js/6acba536.e5151411.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[23408],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.8.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.8.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.8.0/",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.8.0/category/getting-started"}},c={image:r(18680).Z},p=[{value:"What's next",id:"whats-next",level:2}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a Rust-based smart contract framework for ",(0,o.kt)("a",{parentName:"p",href:"https://casper.network"},"Casper Network"),". Odra encourages rapid development and clean,\npragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. "),(0,o.kt)("p",null,"It's free and open source!"),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.0/getting-started/flipper"},"Flipper example")," to find out how to start your new project with Odra."))}d.isMDXComponent=!0},18680:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/6add768b.b3f603cd.js b/docs/assets/js/6add768b.b3f603cd.js new file mode 100644 index 000000000..3c3afba11 --- /dev/null +++ b/docs/assets/js/6add768b.b3f603cd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40656],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.3.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.3.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.3.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"odra-examples",permalink:"/docs/0.3.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.3.0/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.0", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = { path = "../core", default-features = false }\nodra-modules = { path = "../modules", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]\ncasper = ["odra/casper", "odra-modules/casper"]\n')),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules")," defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," feature in your project, add ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules/casper"),"specifically (it applies to each backend).")),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::types::{Address, U256};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main Odra repository.")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6b1ad888.0fb0a010.js b/docs/assets/js/6b1ad888.0fb0a010.js new file mode 100644 index 000000000..bca19a0e5 --- /dev/null +++ b/docs/assets/js/6b1ad888.0fb0a010.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[60132],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.9.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.9.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.9.0/backends/casper",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"OdraVM",permalink:"/docs/0.9.0/backends/odra-vm"},next:{title:"Livenet",permalink:"/docs/0.9.0/backends/livenet"}},l={},p=[{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Deploying a contract to Casper network",id:"deploying-a-contract-to-casper-network",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement traits defined by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard"),", thankfully you can derive them using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::event]"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance,\nyou call ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_balance()"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"deploying-a-contract-to-casper-network"},"Deploying a contract to Casper network"),(0,r.kt)("p",null,"There would be no point in writing a contract if you couldn't deploy it to the blockchain.\nYou can do it in two ways: provided by the Casper itself: using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool\nor using the Odra's Livenet integration."),(0,r.kt)("p",null,"Let's explore the first option to better understand the process."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you wish, you can skip the following section and jump to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/livenet"},"Livenet integration"),".")),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you can pass some arguments to it.\nEvery contract written in Odra expects those arguments to be set:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Additionally, if required by the contract, you can pass constructor arguments."),(0,r.kt)("p",null,"When working with the test env via ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," or when using\n",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/livenet"},"Livenet integration")," this is handled automatically. However, if you rather use\n",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," directly, you have to pass them manually:"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/odra-casper/test-vm/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/odra-vm"},"OdraVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6be2997d.cc92ff66.js b/docs/assets/js/6be2997d.cc92ff66.js new file mode 100644 index 000000000..7944a838e --- /dev/null +++ b/docs/assets/js/6be2997d.cc92ff66.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41783],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=o.createContext({}),m=function(e){var n=o.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},d=function(e){var n=m(e.components);return o.createElement(i.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},p=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=m(t),u=r,h=p["".concat(i,".").concat(u)]||p[u]||c[u]||s;return t?o.createElement(h,a(a({ref:n},d),{},{components:t})):o.createElement(h,a({ref:n},d))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var s=t.length,a=new Array(s);a[0]=p;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var m=2;m{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>a,default:()=>c,frontMatter:()=>s,metadata:()=>l,toc:()=>m});var o=t(87462),r=(t(67294),t(3905));const s={sidebar_position:9},a="CEP-18",l={unversionedId:"tutorials/cep18",id:"tutorials/cep18",title:"CEP-18",description:"Not so different from ERC-20, the CEP-18 standard describes a fungible",source:"@site/docs/tutorials/cep18.md",sourceDirName:"tutorials",slug:"/tutorials/cep18",permalink:"/docs/next/tutorials/cep18",draft:!1,tags:[],version:"current",lastUpdatedAt:1716209688,formattedLastUpdatedAt:"May 20, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9},sidebar:"tutorialSidebar",previous:{title:"Using Proxy Caller",permalink:"/docs/next/tutorials/using-proxy-caller"},next:{title:"Odra for Solidity developers",permalink:"/docs/next/tutorials/odra-solidity"}},i={},m=[{value:"Self-governing token",id:"self-governing-token",level:2},{value:"Token implementation",id:"token-implementation",level:2},{value:"Governance implementation",id:"governance-implementation",level:2},{value:"Voting mechanism",id:"voting-mechanism",level:3},{value:"Storage",id:"storage",level:4},{value:"Proposing a new mint",id:"proposing-a-new-mint",level:4},{value:"Voting for the mint",id:"voting-for-the-mint",level:4},{value:"Tallying the votes",id:"tallying-the-votes",level:4},{value:"Testing",id:"testing",level:3},{value:"What's next",id:"whats-next",level:2},{value:"Complete code",id:"complete-code",level:2}],d={toc:m};function c(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cep-18"},"CEP-18"),(0,r.kt)("p",null,"Not so different from ERC-20, the CEP-18 standard describes a fungible\ntoken interface, but for the Casper network.\nThere are some differences, which will be shown in this tutorial.\nThe most visible one however, is the compatibility with the Casper Ecosystem."),(0,r.kt)("p",null,"In our example, we will implement a CEP-18 token with a simple self-governance mechanism.\nWe will also deploy our token on the Casper network, and interact with it."),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"This implementation of the governance in this tutorial is by no means\na complete one, and should not be used in production.")),(0,r.kt)("h2",{id:"self-governing-token"},"Self-governing token"),(0,r.kt)("p",null,"There are many ways to implement a governance mechanism for a token,\neach more complex than the other. In our example, we will use a simple\none, where the community of token holders can vote to mint new tokens."),(0,r.kt)("h2",{id:"token-implementation"},"Token implementation"),(0,r.kt)("p",null,"Let's start by creating a new project, choosing a clever name and using\ncep18 as our starting template:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name ourcoin --template cep18\n")),(0,r.kt)("p",null,"Let's glance at our token code:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"#[odra::module]\npub struct MyToken {\n token: SubModule,\n}\n\nimpl MyToken {\n // Delegate all Cep18 functions to the token sub-module.\n delegate! {\n to self.token {\n ...\n fn name(&self) -> String;\n fn symbol(&self) -> String;\n ...\n")),(0,r.kt)("p",null,"As we can see, it indeed uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Cep18")," module and delegates\nall the methods to it."),(0,r.kt)("p",null,"The only thing to do is to change the name of the struct to more\nappropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"OurToken"),", run the provided tests using ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra test"),",\nand continue with the implementation of the governance."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Remember to change the name of the struct and its usages as well as\nthe struct name in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file!")),(0,r.kt)("h2",{id:"governance-implementation"},"Governance implementation"),(0,r.kt)("p",null,"Let's go through the process of implementing the governance mechanism.\nIf we don't want to, we don't have to hide entrypoints from the public responsible\nfor minting new tokens. By default, minting ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casper-ecosystem/cep18/tree/dev/cep18#modalities"},"Modality"),"\nis turned off, so any attempt of direct minting will result in an error."),(0,r.kt)("p",null,"We will however implement a voting mechanism, where the token holders can vote\nto mint new tokens."),(0,r.kt)("h3",{id:"voting-mechanism"},"Voting mechanism"),(0,r.kt)("p",null,"Our voting system will be straightforward:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Anyone with the tokens can propose a new mint."),(0,r.kt)("li",{parentName:"ol"},"Anyone with the tokens can vote for the new mint by staking their tokens."),(0,r.kt)("li",{parentName:"ol"},"If the majority of the token holders vote for the mint, it is executed.")),(0,r.kt)("h4",{id:"storage"},"Storage"),(0,r.kt)("p",null,"We will need to store some additional information about the votes, so let's\nadd some fields to our token struct:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"#[odra::module]\npub struct OurToken {\n /// A sub-module that implements the CEP-18 token standard.\n token: SubModule,\n /// The proposed mint.\n proposed_mint: Var<(Address, U256)>,\n /// The list of votes cast in the current vote.\n votes: List,\n /// Whether a vote is open.\n is_vote_open: Var,\n /// The time when the vote ends.\n vote_end_time: Var,\n}\n\n/// A ballot cast by a voter.\n#[odra::odra_type]\nstruct Ballot {\n voter: Address,\n choice: bool,\n amount: U256,\n}\n")),(0,r.kt)("p",null,"Notice that ",(0,r.kt)("inlineCode",{parentName:"p"},"proposed_mint")," contains a tuple containing the address of\nthe proposer and the amount of tokens to mint. Moreover, we need to keep track if\nthe vote time has ended, but also if it was already tallied, that's why\nwe need both ",(0,r.kt)("inlineCode",{parentName:"p"},"is_vote_open")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"vote_end_time"),"."),(0,r.kt)("p",null,"We will also use the power of the ",(0,r.kt)("a",{parentName:"p",href:"../basics/storage-interaction#list"},"List"),"\ntype to store the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ballots"),"."),(0,r.kt)("h4",{id:"proposing-a-new-mint"},"Proposing a new mint"),(0,r.kt)("p",null,"To implement the endpoint that allows token holders to propose a new mint,\nwe need to add a new function to our token module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"/// Proposes a new mint for the contract.\npub fn propose_new_mint(&mut self, account: Address, amount: U256) {\n // Only allow proposing a new mint if there is no vote in progress.\n if self.is_vote_open().get_or_default() {\n self.env().revert(GovernanceError::VoteAlreadyOpen);\n }\n\n // Only the token holders can propose a new mint.\n if self.balance_of(&self.env().caller()) == U256::zero() {\n self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose);\n }\n\n // Set the proposed mint.\n self.proposed_mint.set((account, amount));\n // Open a vote.\n self.is_vote_open.set(true);\n // Set the vote end time to 10 minutes from now.\n self.vote_end_time\n .set(self.env().get_block_time() + 60 * 10 * 1000);\n}\n")),(0,r.kt)("p",null,"As a parameters to the function, we pass the address of the account that should be the receiver of\nthe minted tokens, and the amount."),(0,r.kt)("p",null,"After some validation, we open the vote by setting the ",(0,r.kt)("inlineCode",{parentName:"p"},"is_vote_open")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),",\nand setting the ",(0,r.kt)("inlineCode",{parentName:"p"},"vote_end_time")," to 10 minutes. In real-world scenarios,\nthe time could be configurable, but for the sake of simplicity, we hardcoded it.\nAlso, it should be quite longer than 10 minutes, but it will come in handy\nwhen we test it on Livenet."),(0,r.kt)("h4",{id:"voting-for-the-mint"},"Voting for the mint"),(0,r.kt)("p",null,"Next, we need an endpoint that will allow us to cast a ballot:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"/// Votes on the proposed mint.\npub fn vote(&mut self, choice: bool, amount: U256) {\n // Only allow voting if there is a vote in progress.\n self.assert_vote_in_progress();\n\n let voter = self.env().caller();\n let contract = self.env().self_address();\n\n // Transfer the voting tokens from the voter to the contract.\n self.token\n .transfer(&contract, &amount);\n\n // Add the vote to the list.\n self.votes.push(Ballot {\n voter,\n choice,\n amount,\n });\n}\n")),(0,r.kt)("p",null,"The most interesting thing here is that we are using a mechanism of staking,\nwhere we transfer our tokens to the contract, to show that we really mean it."),(0,r.kt)("p",null,"The tokens will be locked until the vote is over, and tallied."),(0,r.kt)("p",null,"Speaking of tallying..."),(0,r.kt)("h4",{id:"tallying-the-votes"},"Tallying the votes"),(0,r.kt)("p",null,"The last step is to tally the votes and mint the tokens if the majority\nof voters agreed to do so:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"/// Count the votes and perform the action\npub fn tally(&mut self) {\n // Only allow tallying the votes once.\n if !self.is_vote_open.get_or_default()\n {\n self.env().revert(GovernanceError::NoVoteInProgress);\n }\n\n // Only allow tallying the votes after the vote has ended.\n let finish_time = self\n .vote_end_time\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n if self.env().get_block_time() < finish_time {\n self.env().revert(GovernanceError::VoteNotYetEnded);\n }\n\n // Count the votes\n let mut yes_votes = U256::zero();\n let mut no_votes = U256::zero();\n\n let contract = self.env().self_address();\n\n while let Some(vote) = self.votes.pop() {\n if vote.choice {\n yes_votes += vote.amount;\n } else {\n no_votes += vote.amount;\n }\n\n // Transfer back the voting tokens to the voter.\n self.token.raw_transfer(&contract, &vote.voter, &vote.amount);\n }\n\n // Perform the action if the vote has passed.\n if yes_votes > no_votes {\n let (account, amount) = self\n .proposed_mint\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n self.token.raw_mint(&account, &amount);\n }\n\n // Close the vote.\n self.is_vote_open.set(false);\n}\n")),(0,r.kt)("p",null,"Notice how we used ",(0,r.kt)("inlineCode",{parentName:"p"},"raw_transfer")," from the ",(0,r.kt)("inlineCode",{parentName:"p"},"Cep18")," module. We used it\nto set the sender, so the contract's balance will be used, instead of\nthe caller's."),(0,r.kt)("p",null,"Additonally, we used ",(0,r.kt)("inlineCode",{parentName:"p"},"raw_mint")," to mint the tokens, skipping the security\nchecks. We have no modality for minting, but even if we had, we don't\nhave anyone with permissions! The Contract needs to mint the tokens itself."),(0,r.kt)("h3",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Now, we will put our implementation to the test. One unit test, that we can\nrun both on OdraVM and on the CasperVM."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},'#[test]\nfn it_works() {\n let env = odra_test::env();\n let init_args = OurTokenInitArgs {\n name: "OurToken".to_string(),\n symbol: "OT".to_string(),\n decimals: 0,\n initial_supply: U256::from(1_000u64),\n };\n\n let mut token = OurTokenHostRef::deploy(&env, init_args);\n\n // The deployer, as the only token holder,\n // starts a new voting to mint 1000 tokens to account 1.\n // There is only 1 token holder, so there is one Ballot cast.\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(1000));\n\n // The tokens should now be staked.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());\n\n // Wait for the vote to end.\n env.advance_block_time(60 * 11 * 1000);\n\n // Finish the vote.\n token.tally();\n\n // The tokens should now be minted.\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));\n assert_eq!(token.total_supply(), 3000.into());\n\n // The stake should be returned.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));\n\n // Now account 1 can mint new tokens with their voting power...\n env.set_caller(env.get_account(1));\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(2000));\n\n // ...Even if the deployer votes against it.\n env.set_caller(env.get_account(0));\n token.vote(false, U256::from(1000));\n\n env.advance_block_time(60 * 11 * 1000);\n\n token.tally();\n\n // The power of community governance!\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));\n}\n')),(0,r.kt)("p",null,"We can run the test using both methods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\ncargo odra test -b casper\n")),(0,r.kt)("p",null,"It is all nice and green, but it would be really nice to see it in action."),(0,r.kt)("p",null,"How about deploying it on the Casper network?"),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will se our token in action, by ",(0,r.kt)("a",{parentName:"p",href:"deploying-on-casper"},"deploying it on the Casper network"),",\nand using tools from the Casper Ecosystem to interact with it."),(0,r.kt)("h2",{id:"complete-code"},"Complete code"),(0,r.kt)("p",null,"Here is the complete code of the ",(0,r.kt)("inlineCode",{parentName:"p"},"OurToken")," module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},'use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var};\nuse odra_modules::cep18_token::Cep18;\n\n/// A ballot cast by a voter.\n#[odra::odra_type]\nstruct Ballot {\n voter: Address,\n choice: bool,\n amount: U256,\n}\n\n/// Errors for the governed token.\n#[odra::odra_error]\npub enum GovernanceError {\n /// The vote is already in progress.\n VoteAlreadyOpen = 0,\n /// No vote is in progress.\n NoVoteInProgress = 1,\n /// Cannot tally votes yet.\n VoteNotYetEnded = 2,\n /// Vote ended\n VoteEnded = 3,\n /// Only the token holders can propose a new mint.\n OnlyTokenHoldersCanPropose = 4,\n}\n\n/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct OurToken {\n /// A submodule that implements the CEP-18 token standard.\n token: SubModule,\n /// The proposed mint.\n proposed_mint: Var<(Address, U256)>,\n /// The list of votes cast in the current vote.\n votes: List,\n /// Whether a vote is open.\n is_vote_open: Var,\n /// The time when the vote ends.\n vote_end_time: Var,\n}\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl OurToken {\n /// Initializes the contract with the given metadata and initial supply.\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n // We put the token address as an admin, so it can govern itself. Self-governing token!\n self.token\n .init(symbol, name, decimals, initial_supply, vec![], vec![], None);\n }\n\n // Delegate all Cep18 functions to the token submodule.\n delegate! {\n to self.token {\n /// Admin EntryPoint to manipulate the security access granted to users.\n /// One user can only possess one access group badge.\n /// Change strength: None > Admin > Minter\n /// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an\n /// Admin, also if a user is added to Admin and None then they will be removed from having rights.\n /// Beware: do not remove the last Admin because that will lock out all admin functionality.\n fn change_security(\n &mut self,\n admin_list: Vec
,\n minter_list: Vec
,\n none_list: Vec
\n );\n\n /// Returns the name of the token.\n fn name(&self) -> String;\n\n /// Returns the symbol of the token.\n fn symbol(&self) -> String;\n\n /// Returns the number of decimals the token uses.\n fn decimals(&self) -> u8;\n\n /// Returns the total supply of the token.\n fn total_supply(&self) -> U256;\n\n /// Returns the balance of the given address.\n fn balance_of(&self, address: &Address) -> U256;\n\n /// Returns the amount of tokens the owner has allowed the spender to spend.\n fn allowance(&self, owner: &Address, spender: &Address) -> U256;\n\n /// Approves the spender to spend the given amount of tokens on behalf of the caller.\n fn approve(&mut self, spender: &Address, amount: &U256);\n\n /// Decreases the allowance of the spender by the given amount.\n fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256);\n\n /// Increases the allowance of the spender by the given amount.\n fn increase_allowance(&mut self, spender: &Address, inc_by: &U256);\n\n /// Transfers tokens from the caller to the recipient.\n fn transfer(&mut self, recipient: &Address, amount: &U256);\n\n /// Transfers tokens from the owner to the recipient using the spender\'s allowance.\n fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256);\n\n /// Mints new tokens and assigns them to the given address.\n fn mint(&mut self, owner: &Address, amount: &U256);\n\n /// Burns the given amount of tokens from the given address.\n fn burn(&mut self, owner: &Address, amount: &U256);\n }\n }\n\n /// Proposes a new mint for the contract.\n pub fn propose_new_mint(&mut self, account: Address, amount: U256) {\n // Only allow proposing a new mint if there is no vote in progress.\n if self.is_vote_open.get_or_default() {\n self.env().revert(GovernanceError::VoteAlreadyOpen);\n }\n\n // Only the token holders can propose a new mint.\n if self.balance_of(&self.env().caller()) == U256::zero() {\n self.env()\n .revert(GovernanceError::OnlyTokenHoldersCanPropose);\n }\n\n // Set the proposed mint.\n self.proposed_mint.set((account, amount));\n // Open a vote.\n self.is_vote_open.set(true);\n // Set the vote end time to 10 minutes from now.\n self.vote_end_time\n .set(self.env().get_block_time() + 10 * 60 * 1000);\n }\n\n /// Votes on the proposed mint.\n pub fn vote(&mut self, choice: bool, amount: U256) {\n // Only allow voting if there is a vote in progress.\n self.assert_vote_in_progress();\n\n let voter = self.env().caller();\n let contract = self.env().self_address();\n\n // Transfer the voting tokens from the voter to the contract.\n self.token.transfer(&contract, &amount);\n\n // Add the vote to the list.\n self.votes.push(Ballot {\n voter,\n choice,\n amount,\n });\n }\n\n /// Count the votes and perform the action\n pub fn tally(&mut self) {\n // Only allow tallying the votes once.\n if !self.is_vote_open.get_or_default() {\n self.env().revert(GovernanceError::NoVoteInProgress);\n }\n\n // Only allow tallying the votes after the vote has ended.\n let finish_time = self\n .vote_end_time\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n if self.env().get_block_time() < finish_time {\n self.env().revert(GovernanceError::VoteNotYetEnded);\n }\n\n // Count the votes\n let mut yes_votes = U256::zero();\n let mut no_votes = U256::zero();\n\n let contract = self.env().self_address();\n\n while let Some(vote) = self.votes.pop() {\n if vote.choice {\n yes_votes += vote.amount;\n } else {\n no_votes += vote.amount;\n }\n\n // Transfer back the voting tokens to the voter.\n self.token\n .raw_transfer(&contract, &vote.voter, &vote.amount);\n }\n\n // Perform the action if the vote has passed.\n if yes_votes > no_votes {\n let (account, amount) = self\n .proposed_mint\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n self.token.raw_mint(&account, &amount);\n }\n\n // Close the vote.\n self.is_vote_open.set(false);\n }\n\n fn assert_vote_in_progress(&self) {\n if !self.is_vote_open.get_or_default() {\n self.env().revert(GovernanceError::NoVoteInProgress);\n }\n\n let finish_time = self\n .vote_end_time\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n\n if self.env().get_block_time() > finish_time {\n self.env().revert(GovernanceError::VoteEnded);\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::Deployer;\n\n #[test]\n fn it_works() {\n let env = odra_test::env();\n let init_args = OurTokenInitArgs {\n name: "OurToken".to_string(),\n symbol: "OT".to_string(),\n decimals: 0,\n initial_supply: U256::from(1_000u64),\n };\n\n let mut token = OurTokenHostRef::deploy(&env, init_args);\n\n // The deployer, as the only token holder,\n // starts a new voting to mint 1000 tokens to account 1.\n // There is only 1 token holder, so there is one Ballot cast.\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(1000));\n\n // The tokens should now be staked.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());\n\n // Wait for the vote to end.\n env.advance_block_time(60 * 11 * 1000);\n\n // Finish the vote.\n token.tally();\n\n // The tokens should now be minted.\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));\n assert_eq!(token.total_supply(), 3000.into());\n\n // The stake should be returned.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));\n\n // Now account 1 can mint new tokens with their voting power...\n env.set_caller(env.get_account(1));\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(2000));\n\n // ...Even if the deployer votes against it.\n env.set_caller(env.get_account(0));\n token.vote(false, U256::from(1000));\n\n env.advance_block_time(60 * 11 * 1000);\n\n token.tally();\n\n // The power of community governance!\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6c16b7b1.9da40895.js b/docs/assets/js/6c16b7b1.9da40895.js new file mode 100644 index 000000000..f29427e72 --- /dev/null +++ b/docs/assets/js/6c16b7b1.9da40895.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[47593],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||o;return t?r.createElement(f,s(s({ref:n},u),{},{components:t})):r.createElement(f,s({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var d=2;d{t.d(n,{Z:()=>s});var r=t(67294),a=t(86010);const o="tabItem_Ymn6";function s(e){let{children:n,hidden:t,className:s}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(o,s),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>y});var r=t(87462),a=t(67294),o=t(86010),s=t(12466),l=t(16550),i=t(91980),d=t(67392),u=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(o),(0,a.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function v(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=c(e),[s,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[i,d]=f({queryString:t,groupId:r}),[p,v]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,u.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:o})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:s,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),v(e)}),[d,v,o]),tabValues:o}}var g=t(72389);const h="tabList__CuJ",k="tabItem_LNqP";function b(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:d}=e;const u=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),c=e=>{const n=e.currentTarget,t=u.indexOf(n),r=d[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;n=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;n=u[t]??u[u.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},n)},d.map((e=>{let{value:n,label:t,attributes:s}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>u.push(e),onKeyDown:m,onClick:c},s,{className:(0,o.Z)("tabs__item",k,s?.className,{"tabs__item--active":l===n})}),t??n)})))}function _(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function N(e){const n=v(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",h)},a.createElement(b,(0,r.Z)({},e,n)),a.createElement(_,(0,r.Z)({},e,n)))}function y(e){const n=(0,g.Z)();return a.createElement(N,(0,r.Z)({key:String(n)},e))}},31742:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),o=t(74866),s=t(85162);const l={sidebar_position:1,description:"Migration guide to v0.8.0"},i="Migration guide to v0.8.0",d={unversionedId:"migrations/to-0.8.0",id:"version-0.9.0/migrations/to-0.8.0",title:"Migration guide to v0.8.0",description:"Migration guide to v0.8.0",source:"@site/versioned_docs/version-0.9.0/migrations/to-0.8.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.8.0",permalink:"/docs/0.9.0/migrations/to-0.8.0",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Migration guide to v0.8.0"},sidebar:"tutorialSidebar",previous:{title:"Migrations",permalink:"/docs/0.9.0/category/migrations"},next:{title:"Migration guide to v0.9.0",permalink:"/docs/0.9.0/migrations/to-0.9.0"}},u={},p=[{value:"1. Prerequisites",id:"1-prerequisites",level:2},{value:"1.1. Update cargo-odra",id:"11-update-cargo-odra",level:3},{value:"1.2. Review the Changelog",id:"12-review-the-changelog",level:3},{value:"2. Migration Steps",id:"2-migration-steps",level:2},{value:"2.1 Add bin directory",id:"21-add-bin-directory",level:3},{value:"2.2. Update Cargo.toml",id:"22-update-cargotoml",level:3},{value:"2.2. Update Odra.toml",id:"22-update-odratoml",level:3},{value:"2.3. Update Smart Contracts",id:"23-update-smart-contracts",level:3},{value:"2.3.1. Update the use statements to reflect the new module structure.",id:"231-update-the-use-statements-to-reflect-the-new-module-structure",level:4},{value:"2.3.2. Some type aliases are no longer in use.",id:"232-some-type-aliases-are-no-longer-in-use",level:4},{value:"2.3.3. Consider import odra::prelude::* in your module files.",id:"233-consider-import-odraprelude-in-your-module-files",level:4},{value:"2.3.4. Flatten nested Mappings.",id:"234-flatten-nested-mappings",level:4},{value:"2.3.5. Update errors definitions.",id:"235-update-errors-definitions",level:4},{value:"2.3.6. Update events definitions.",id:"236-update-events-definitions",level:4},{value:"2.3.7. Replace contract_env with self.env() in your modules.",id:"237-replace-contract_env-with-selfenv-in-your-modules",level:4},{value:"2.3.8. Wrap submodules of your module with odra::SubModule<T>.",id:"238-wrap-submodules-of-your-module-with-odrasubmodulet",level:4},{value:"2.3.9. Update external contract calls.",id:"239-update-external-contract-calls",level:4},{value:"2.3.10. Update constructors.",id:"2310-update-constructors",level:4},{value:"2.3.11. Update UnwrapOrRevert calls.",id:"2311-update-unwraporrevert-calls",level:4},{value:"2.3.12. Remove #[odra(using)] attribute from your module definition.",id:"2312-remove-odrausing-attribute-from-your-module-definition",level:4},{value:"2.4. Update Tests",id:"24-update-tests",level:3},{value:"2.4.1. Contract deployment.",id:"241-contract-deployment",level:4},{value:"2.4.2. Host interactions.",id:"242-host-interactions",level:4},{value:"2.4.3. Testing failing scenarios.",id:"243-testing-failing-scenarios",level:4},{value:"2.4.4. Testing events.",id:"244-testing-events",level:4},{value:"3. Code Examples",id:"3-code-examples",level:2},{value:"4. Troubleshooting",id:"4-troubleshooting",level:2},{value:"5. References",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v080"},"Migration guide to v0.8.0"),(0,a.kt)("p",null,"Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version."),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant changes in v0.8.0 include:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only."),(0,a.kt)("li",{parentName:"ul"},"Framework internals redesign.")),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.8.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-add-bin-directory"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Add bin directory")),(0,a.kt)("p",null,"Odra 0.8.0 introduces a new way to build smart contracts. The ",(0,a.kt)("inlineCode",{parentName:"p"},".builder_casper")," directory is no longer used. Instead, you should create a new directory called ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," in the root of your project and add the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files to the ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," directory."),(0,a.kt)("p",null,"You can find the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-cargotoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Cargo.toml")),(0,a.kt)("p",null,"There a bunch of changes in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"You don't have to specify the features anymore - remove the ",(0,a.kt)("inlineCode",{parentName:"li"},"features")," section and ",(0,a.kt)("inlineCode",{parentName:"li"},"default-features")," flag from the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra")," dependency."),(0,a.kt)("li",{parentName:"ul"},"Register bins you added in the previous step."),(0,a.kt)("li",{parentName:"ul"},"Add ",(0,a.kt)("inlineCode",{parentName:"li"},"dev-dependencies")," section with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra-test")," crate."),(0,a.kt)("li",{parentName:"ul"},"Add recommended profiles for ",(0,a.kt)("inlineCode",{parentName:"li"},"release")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," to optimize the build process.")),(0,a.kt)("p",null,"Below you can compare the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file after and before the migration to v0.8.0:"),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.7.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')))),(0,a.kt)("h3",{id:"22-update-odratoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Odra.toml")),(0,a.kt)("p",null,"Due to the changes in cargo-odra, the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file has been simplified. The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," property is no longer required."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "my_project::Flipper"\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "my_project::Flipper"\n')))),(0,a.kt)("h3",{id:"23-update-smart-contracts"},"2.3. ",(0,a.kt)("strong",{parentName:"h3"},"Update Smart Contracts")),(0,a.kt)("p",null,"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"231-update-the-use-statements-to-reflect-the-new-module-structure"},"2.3.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update the ",(0,a.kt)("inlineCode",{parentName:"strong"},"use")," statements to reflect the new module structure.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Big integer types are now located in the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types")," module."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::Address")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::Address"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Variable")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::contract_env"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::OdraType")," as it is no longer required."),(0,a.kt)("li",{parentName:"ul"},"Change ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::casper_types::*;")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::*;"),".")),(0,a.kt)("h4",{id:"232-some-type-aliases-are-no-longer-in-use"},"2.3.2. ",(0,a.kt)("strong",{parentName:"h4"},"Some type aliases are no longer in use.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Balance")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::U512"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BlockTime")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"EventData")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::bytesrepr::Bytes"),".")),(0,a.kt)("h4",{id:"233-consider-import-odraprelude-in-your-module-files"},"2.3.3. ",(0,a.kt)("strong",{parentName:"h4"},"Consider import ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::prelude::*")," in your module files.")),(0,a.kt)("h4",{id:"234-flatten-nested-mappings"},"2.3.4. ",(0,a.kt)("strong",{parentName:"h4"},"Flatten nested ",(0,a.kt)("inlineCode",{parentName:"strong"},"Mapping"),"s.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// Before\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping>\n}\n// After\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("h4",{id:"235-update-errors-definitions"},"2.3.5. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::execution_error;\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n}\n")))),(0,a.kt)("h4",{id:"236-update-events-definitions"},"2.3.6. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nself.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n});\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nuse odra::types::event::OdraEvent;\n\nTransfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n}.emit();\n")))),(0,a.kt)("h4",{id:"237-replace-contract_env-with-selfenv-in-your-modules"},"2.3.7. ",(0,a.kt)("strong",{parentName:"h4"},"Replace ",(0,a.kt)("inlineCode",{parentName:"strong"},"contract_env")," with ",(0,a.kt)("inlineCode",{parentName:"strong"},"self.env()")," in your modules.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"self.env()")," is a new way to access the contract environment, returns a reference to ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),". The API is similar to the previous ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env")," but with some changes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_var(key: &[u8]) -> Option")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn get_value(&self, key: &[u8]) -> Option"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_var(key: &[u8], value: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn set_value(&self, key: &[u8], value: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"set_dict_value()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_dict_value()")," has been removed. All the dictionary operations should be performed using ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," type, internally using ",(0,a.kt)("inlineCode",{parentName:"li"},"set_var()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_var()")," functions. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn hash>(input: T) -> Vec")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn hash(&self, value: T) -> [u8; 32]"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(error: E) -> !")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(&self, error: E) -> !"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(event: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(&self, event: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option) -> T")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(&self, address: Address, call: CallDef) -> T"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"native_token_metadata()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"one_token()")," have been removed.")),(0,a.kt)("h4",{id:"238-wrap-submodules-of-your-module-with-odrasubmodulet"},"2.3.8. ",(0,a.kt)("strong",{parentName:"h4"},"Wrap submodules of your module with ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::SubModule"),".")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: SubModule,\n metadata: SubModule,\n ownable: SubModule\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: Erc721Base,\n metadata: Erc721MetadataExtension,\n ownable: Ownable\n}\n")))),(0,a.kt)("h4",{id:"239-update-external-contract-calls"},"2.3.9. ",(0,a.kt)("strong",{parentName:"h4"},"Update external contract calls.")),(0,a.kt)("p",null,"However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref"),") and you can call it using ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env, address)")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref::at()"),")."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenContractRef::new(env, token).balance_of(account)\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenRef::at(token).balance_of(account)\n")))),(0,a.kt)("h4",{id:"2310-update-constructors"},"2.3.10. ",(0,a.kt)("strong",{parentName:"h4"},"Update constructors.")),(0,a.kt)("p",null,"Remove the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::init]")," attribute from the constructor and ensure that the constructor function is named ",(0,a.kt)("inlineCode",{parentName:"p"},"init"),"."),(0,a.kt)("h4",{id:"2311-update-unwraporrevert-calls"},"2.3.11. ",(0,a.kt)("strong",{parentName:"h4"},"Update ",(0,a.kt)("inlineCode",{parentName:"strong"},"UnwrapOrRevert")," calls.")),(0,a.kt)("p",null,"The functions ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," now require ",(0,a.kt)("inlineCode",{parentName:"p"},"&HostEnv")," as the first parameter."),(0,a.kt)("h4",{id:"2312-remove-odrausing-attribute-from-your-module-definition"},"2.3.12. ",(0,a.kt)("strong",{parentName:"h4"},"Remove ",(0,a.kt)("inlineCode",{parentName:"strong"},"#[odra(using)]")," attribute from your module definition.")),(0,a.kt)("p",null,"Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required."),(0,a.kt)("h3",{id:"24-update-tests"},"2.4. ",(0,a.kt)("strong",{parentName:"h3"},"Update Tests")),(0,a.kt)("p",null,"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"241-contract-deployment"},"2.4.1. ",(0,a.kt)("strong",{parentName:"h4"},"Contract deployment.")),(0,a.kt)("p",null,"The way you deploy a contract has changed:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef::deploy(&env, args)")," instead of ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}Deployer::init()"),". The ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef")," implements ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer"),"."),(0,a.kt)("li",{parentName:"ol"},"Instantiate the ",(0,a.kt)("inlineCode",{parentName:"li"},"HostEnv")," using ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),", required by the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract doesn't have init args, you should use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract has init args, you should pass the autogenerated ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableHostRef;\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\nlet env: HostEnv = odra_test::env();\nlet ownable = OwnableHostRef::deploy(&env, NoArgs)\n\n// A contract with init args\nuse super::{Erc20HostRef, Erc20InitArgs};\nuse odra::host::{Deployer, HostEnv};\n\nlet env: HostEnv = odra_test::env();\nlet init_args = Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n};\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableDeployer;\n\nlet ownable = OwnableDeployer::init();\n\n// A contract with init args\nlet erc20 = Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n);\n")))),(0,a.kt)("h4",{id:"242-host-interactions"},"2.4.2. ",(0,a.kt)("strong",{parentName:"h4"},"Host interactions.")),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Replace ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),"."),(0,a.kt)("li",{parentName:"ol"},"The API of ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()")," are similar, but there are some differences:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::advance_block_time_by(BlockTime)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.advance_block_time(u64)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::token_balance(Address)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.balance_of(&Address)"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_cost()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_used()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::total_gas_used(Address)"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::gas_report()")," have been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef::last_call()")," and extract the data from a ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::ContractCallResult")," instance. ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef")," is a trait implemented by ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef"),".")))),(0,a.kt)("h4",{id:"243-testing-failing-scenarios"},"2.4.3. ",(0,a.kt)("strong",{parentName:"h4"},"Testing failing scenarios.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"test_env::assert_exception()")," has been removed. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix to call the function and then assert the result.\n",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix is a new way to call a function that might fail. It returns a ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult"))," type, which you can then assert using the standard Rust ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n let (env, mut erc20) = setup();\n\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n assert_eq!(\n erc20.try_transfer_from(owner, recipient, amount),\n Err(Error::InsufficientAllowance.into())\n );\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n test_env::assert_exception(Error::InsufficientAllowance, || {\n let mut erc20 = setup();\n\n let (owner, spender, recipient) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let amount = 1_000.into();\n test_env::set_caller(spender);\n\n erc20.transfer_from(&owner, &recipient, &amount)\n });\n}\n")))),(0,a.kt)("h4",{id:"244-testing-events"},"2.4.4. ",(0,a.kt)("strong",{parentName:"h4"},"Testing events.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," macro has been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv::emitted_event()")," to assert the emitted events.\nThe new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation to explore the available options."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let env: HostEnv = odra_test::env();\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n\n...\n\nassert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n));\nassert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n));\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let erc20 = Erc20HostDeployer::init(&env, ...);\n\n...\n\nassert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n);\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.8.0."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20HostRef, Erc20InitArgs\n };\n use odra::{\n casper_types::U256,\n host::{Deployer, HostEnv, HostRef},\n prelude::*\n };\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n // Other tests...\n}\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use odra::prelude::string::String;\nuse odra::{\n contract_env,\n types::{event::OdraEvent, Address, U256},\n Mapping, UnwrapOrRevert, Variable\n};\n\nuse self::{\n errors::Error,\n events::{Approval, Transfer}\n};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n\n#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: &Option\n ) {\n let caller = contract_env::caller();\n\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = *initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n }\n .emit();\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = contract_env::caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = contract_env::caller();\n\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn name(&self) -> String {\n self.name.get().unwrap_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n contract_env::revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n }\n .emit();\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n contract_env::revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n self.allowances\n .get_instance(owner)\n .subtract(spender, *amount);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\npub mod events {\n use odra::types::{casper_types::U256, Address};\n use odra::Event;\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::execution_error;\n\n execution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20Deployer, Erc20Ref\n };\n use odra::prelude::string::ToString;\n use odra::{assert_events, test_env, types::casper_types::U256};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let erc20 = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When transfer tokens to a recipient.\n let sender = test_env::get_account(0);\n let recipient = test_env::get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n test_env::assert_exception(Error::InsufficientBalance, || {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n erc20.transfer(&recipient, &amount)\n });\n }\n\n // Other tests...\n}\n')))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6d263cfa.aa630ecb.js b/docs/assets/js/6d263cfa.aa630ecb.js new file mode 100644 index 000000000..ad4fa0832 --- /dev/null +++ b/docs/assets/js/6d263cfa.aa630ecb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52498],{75210:e=>{e.exports=JSON.parse('{"title":"Migrations","description":"How to keep your code in sync with the latest version of the Odra Framework.","slug":"/category/migrations","permalink":"/docs/category/migrations","navigation":{"previous":{"title":"Deploying a Token on Casper Livenet","permalink":"/docs/tutorials/deploying-on-casper"},"next":{"title":"Migration guide to v0.8.0","permalink":"/docs/migrations/to-0.8.0"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/6d494689.242b10e3.js b/docs/assets/js/6d494689.242b10e3.js new file mode 100644 index 000000000..164bc4daa --- /dev/null +++ b/docs/assets/js/6d494689.242b10e3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[61034],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=d(n),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return n?a.createElement(w,o(o({ref:t},u),{},{components:n})):a.createElement(w,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.8.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.8.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.8.0/tutorials/ownable",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.8.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.8.0/tutorials/erc20"}},s={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining a constructor,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(events = [OwnershipChanged])]\npub struct Ownable {\n owner: Var>\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basics before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4")," - Firstly, we need to create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module(events = [OwnershipChanged])]")," attribute to it. The ",(0,r.kt)("inlineCode",{parentName:"li"},"events")," attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," is a type that will be defined later."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"...\nuse odra::{Event, OdraError};\n\n...\n\n#[odra::module]\nimpl Ownable {\n pub fn init(&mut self, owner: Address) {\n if self.owner.get_or_default().is_some() {\n self.env().revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(Some(owner));\n \n self.env().emit_event(OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n });\n }\n}\n\n#[derive(OdraError)]\npub enum Error {\n OwnerIsAlreadyInitialized = 1,\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an Odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is a constructor. This matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23-26")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," derive macro is applied to the enum. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L10-L12")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::revert()")," function with an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsAlreadyInitialized")," argument. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - Then we write the owner passed as an argument to the storage. To do so, we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L28-L32")," - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16")," - Finally, call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::emit_event()")," passing the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," instance to the function. Hence, we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),". ")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get_or_default().as_ref() {\n self.env().revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&self.env().caller());\n let current_owner = self.get_owner();\n self.owner.set(Some(*new_owner));\n self.env().emit_event(OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n });\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get_or_default() {\n Some(owner) => owner,\n None => self.env().revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\n#[derive(OdraError)]\npub enum Error {\n NotOwner = 1,\n OwnerIsAlreadyInitialized = 2,\n OwnerIsNotInitialized = 3,\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7,L31")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," reads the current owner and reverts if it does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also, we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum by adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in the ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::caller()")," function. Then we update the state and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L21,L33")," - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),". There is one worth-mentioning subtlety: ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," function returns ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements the ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call the ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function, and the contract does not fail even if the value is not initialized. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"owner")," is of type ",(0,r.kt)("inlineCode",{parentName:"li"},"Option
")," the ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," would return ",(0,r.kt)("inlineCode",{parentName:"li"},"Option>"),", we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get_or_default()")," instead.")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::{Deployer, HostEnv, HostRef};\n\n fn setup() -> (OwnableHostRef, HostEnv, Address) {\n let env: HostEnv = odra_test::env();\n let init_args = OwnableInitArgs {\n owner: env.get_account(0)\n };\n (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))\n }\n\n #[test]\n fn initialization_works() {\n let (ownable, env, owner) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (mut ownable, env, owner) = setup();\n let new_owner = env.get_account(1);\n \n env.set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n\n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (mut ownable, env, _) = setup();\n let new_owner = env.get_account(1);\n ownable.change_ownership(&new_owner);\n \n assert_eq!(\n ownable.try_change_ownership(&new_owner), \n Err(Error::NotOwner.into())\n );\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we have defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, which we call in the first statement of each test. Take a look at the signature: ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (OwnableHostRef, HostEnv, Address)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef")," is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7-L11")," - The starting point of every test is getting an instance of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," by calling ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),". Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," attribute implements a ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer")," for ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableInitArgs")," that we pass as the second argument of the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function. Lastly, the module needs an owner. The easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". We choose the address of first account (which is the default one). "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - It is time to define the first test. As you see, it is a regular Rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16-17")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L19-25")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event to have been emitted. To assert that, let's use ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". To get the env, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"env()")," on the contract, then call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::emitted_event"),". As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L31")," - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L33")," - As mentioned, the default is the 0th account, if you want to change the executor, call the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L46-55")," - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::try_change_ownership()")," instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::change_ownership()"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," provides try_ functions for each contract's entrypoint. The ",(0,r.kt)("inlineCode",{parentName:"li"},"try")," functions return ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraResult")," (an alias for ",(0,r.kt)("inlineCode",{parentName:"li"},"Result"),") instead of panicking and halting the execution. In our case, we expect the contract to revert with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::NotOwner")," error. To compare the error, we use the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::into()")," function, which converts the error into the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," type.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6e2102f2.32e24cdc.js b/docs/assets/js/6e2102f2.32e24cdc.js new file mode 100644 index 000000000..0d54b1028 --- /dev/null +++ b/docs/assets/js/6e2102f2.32e24cdc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[7064],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,h=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(h,i(i({ref:t},d),{},{components:n})):a.createElement(h,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/docs/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/next/backends/what-is-a-backend",draft:!1,tags:[],version:"current",lastUpdatedAt:1707133556,formattedLastUpdatedAt:"Feb 5, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/next/category/backends"},next:{title:"OdraVM",permalink:"/docs/next/backends/odra-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Host Env",id:"host-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/odra-vm"},"OdraVM"),",\na complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/casper"},"CasperVM"),",\nor even a real blockchain - when using ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/backends/casper"},"Livenet backend"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"host-env"},"Host Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6e5ab397.4d21bab4.js b/docs/assets/js/6e5ab397.4d21bab4.js new file mode 100644 index 000000000..145884ad4 --- /dev/null +++ b/docs/assets/js/6e5ab397.4d21bab4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[9954],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},o="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.7.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.7.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.7.0/basics/flipper-internals",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.7.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.7.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.7.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Variable;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Variables and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Variable,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Variable")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," macro marks the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperDeployer")," - a piece of code generated automatically thanks to the macros.\nThe contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/6f7f3f28.d907fa0c.js b/docs/assets/js/6f7f3f28.d907fa0c.js new file mode 100644 index 000000000..acbc71fd1 --- /dev/null +++ b/docs/assets/js/6f7f3f28.d907fa0c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37591],{19732:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.5.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.5.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.5.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/705c2b64.92032e23.js b/docs/assets/js/705c2b64.92032e23.js new file mode 100644 index 000000000..eb9ebda71 --- /dev/null +++ b/docs/assets/js/705c2b64.92032e23.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[91178],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.5.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.5.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.5.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.5.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.5.0/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = { path = "../core", default-features = false }\nodra-modules = { path = "../modules", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]\ncasper = ["odra/casper", "odra-modules/casper"]\n')),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules")," defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," feature in your project, add ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules/casper"),"specifically (it applies to each backend).")),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::types::{Address, U256};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main Odra repository.")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/70c316d8.760602b6.js b/docs/assets/js/70c316d8.760602b6.js new file mode 100644 index 000000000..a4474b7bc --- /dev/null +++ b/docs/assets/js/70c316d8.760602b6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[28550],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,o=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return r?a.createElement(f,l(l({ref:t},c),{},{components:r})):a.createElement(f,l({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var n=r.length,l=new Array(n);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var a=r(87462),o=(r(67294),r(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.8.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].",source:"@site/versioned_docs/version-0.8.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.8.0/examples/odra-examples",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.8.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.8.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,o.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"examples")," in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra main repository"),"."),(0,o.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,o.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,o.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,o.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/70d9d1e8.d4709a4b.js b/docs/assets/js/70d9d1e8.d4709a4b.js new file mode 100644 index 000000000..3649aeec8 --- /dev/null +++ b/docs/assets/js/70d9d1e8.d4709a4b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[64709],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),d=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=o,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||a;return t?r.createElement(f,l(l({ref:n},u),{},{components:t})):r.createElement(f,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>d});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.2.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.2.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.2.0/tutorials/owned-token",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"defaultSidebar",previous:{title:"ERC-20",permalink:"/docs/0.2.0/tutorials/erc20"}},s={},d=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],u={toc:d};function c(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow minting tokens but only the module owner."),(0,o.kt)("li",{parentName:"ol"},"The current owner should be able to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use odra::types::{Address, Balance}\n\n...\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: Balance) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> Balance {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> Balance {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: Balance) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: Balance) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: Balance) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: Address, amount: Balance) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L11")," - A constructor is a great place to init both modules at once. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L14-L16")," - Most of the entrypoints do not need any modification, so we simply delegates them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L52")," - The same we do with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L58-L61")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/71.05f6d099.js b/docs/assets/js/71.05f6d099.js new file mode 100644 index 000000000..9bb0add8a --- /dev/null +++ b/docs/assets/js/71.05f6d099.js @@ -0,0 +1,1327 @@ +"use strict"; +exports.id = 71; +exports.ids = [71]; +exports.modules = { + +/***/ 11071: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "diagram": () => (/* binding */ diagram) +/* harmony export */ }); +/* harmony import */ var _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(99794); +/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59373); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(91619); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(12281); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(7201); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30381); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17967); +/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20683); +/* harmony import */ var dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(70277); +/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(45625); +/* harmony import */ var dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(39354); +/* harmony import */ var dagre_d3_es__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91518); + + + + + + + + + + + + + + + + + + + +var parser = function() { + var o = function(k, v, o2, l) { + for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) + ; + return o2; + }, $V0 = [1, 2], $V1 = [1, 5], $V2 = [6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 17], $V6 = [1, 18], $V7 = [1, 19], $V8 = [1, 23], $V9 = [1, 24], $Va = [1, 27], $Vb = [4, 6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28]; + var parser2 = { + trace: function trace() { + }, + yy: {}, + symbols_: { "error": 2, "start": 3, "timeline": 4, "document": 5, "EOF": 6, "directive": 7, "line": 8, "SPACE": 9, "statement": 10, "NEWLINE": 11, "openDirective": 12, "typeDirective": 13, "closeDirective": 14, ":": 15, "argDirective": 16, "title": 17, "acc_title": 18, "acc_title_value": 19, "acc_descr": 20, "acc_descr_value": 21, "acc_descr_multiline_value": 22, "section": 23, "period_statement": 24, "event_statement": 25, "period": 26, "event": 27, "open_directive": 28, "type_directive": 29, "arg_directive": 30, "close_directive": 31, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "timeline", 6: "EOF", 9: "SPACE", 11: "NEWLINE", 15: ":", 17: "title", 18: "acc_title", 19: "acc_title_value", 20: "acc_descr", 21: "acc_descr_value", 22: "acc_descr_multiline_value", 23: "section", 26: "period", 27: "event", 28: "open_directive", 29: "type_directive", 30: "arg_directive", 31: "close_directive" }, + productions_: [0, [3, 3], [3, 2], [5, 0], [5, 2], [8, 2], [8, 1], [8, 1], [8, 1], [7, 4], [7, 6], [10, 1], [10, 2], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [24, 1], [25, 1], [12, 1], [13, 1], [16, 1], [14, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + case 3: + this.$ = []; + break; + case 4: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 5: + case 6: + this.$ = $$[$0]; + break; + case 7: + case 8: + this.$ = []; + break; + case 11: + yy.getCommonDb().setDiagramTitle($$[$0].substr(6)); + this.$ = $$[$0].substr(6); + break; + case 12: + this.$ = $$[$0].trim(); + yy.getCommonDb().setAccTitle(this.$); + break; + case 13: + case 14: + this.$ = $$[$0].trim(); + yy.getCommonDb().setAccDescription(this.$); + break; + case 15: + yy.addSection($$[$0].substr(8)); + this.$ = $$[$0].substr(8); + break; + case 19: + yy.addTask($$[$0], 0, ""); + this.$ = $$[$0]; + break; + case 20: + yy.addEvent($$[$0].substr(2)); + this.$ = $$[$0]; + break; + case 21: + yy.parseDirective("%%{", "open_directive"); + break; + case 22: + yy.parseDirective($$[$0], "type_directive"); + break; + case 23: + $$[$0] = $$[$0].trim().replace(/'/g, '"'); + yy.parseDirective($$[$0], "arg_directive"); + break; + case 24: + yy.parseDirective("}%%", "close_directive", "timeline"); + break; + } + }, + table: [{ 3: 1, 4: $V0, 7: 3, 12: 4, 28: $V1 }, { 1: [3] }, o($V2, [2, 3], { 5: 6 }), { 3: 7, 4: $V0, 7: 3, 12: 4, 28: $V1 }, { 13: 8, 29: [1, 9] }, { 29: [2, 21] }, { 6: [1, 10], 7: 22, 8: 11, 9: [1, 12], 10: 13, 11: [1, 14], 12: 4, 17: $V3, 18: $V4, 20: $V5, 22: $V6, 23: $V7, 24: 20, 25: 21, 26: $V8, 27: $V9, 28: $V1 }, { 1: [2, 2] }, { 14: 25, 15: [1, 26], 31: $Va }, o([15, 31], [2, 22]), o($V2, [2, 8], { 1: [2, 1] }), o($V2, [2, 4]), { 7: 22, 10: 28, 12: 4, 17: $V3, 18: $V4, 20: $V5, 22: $V6, 23: $V7, 24: 20, 25: 21, 26: $V8, 27: $V9, 28: $V1 }, o($V2, [2, 6]), o($V2, [2, 7]), o($V2, [2, 11]), { 19: [1, 29] }, { 21: [1, 30] }, o($V2, [2, 14]), o($V2, [2, 15]), o($V2, [2, 16]), o($V2, [2, 17]), o($V2, [2, 18]), o($V2, [2, 19]), o($V2, [2, 20]), { 11: [1, 31] }, { 16: 32, 30: [1, 33] }, { 11: [2, 24] }, o($V2, [2, 5]), o($V2, [2, 12]), o($V2, [2, 13]), o($Vb, [2, 9]), { 14: 34, 31: $Va }, { 31: [2, 23] }, { 11: [1, 35] }, o($Vb, [2, 10])], + defaultActions: { 5: [2, 21], 7: [2, 2], 27: [2, 24], 33: [2, 23] }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } + }, + parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function lex() { + var token; + token = tstack.pop() || lexer2.lex() || EOF; + if (typeof token !== "number") { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, state, action, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + var lexer = function() { + var lexer2 = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput: function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + input: function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + unput: function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + more: function() { + this._more = true; + return this; + }, + reject: function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + less: function(n) { + this.unput(this.match.slice(n)); + }, + pastInput: function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput: function() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + showPosition: function() { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + test_match: function(match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + for (var k in backup) { + this[k] = backup[k]; + } + return false; + } + return false; + }, + next: function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + pushState: function pushState(condition) { + this.begin(condition); + }, + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { "case-insensitive": true }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + switch ($avoiding_name_collisions) { + case 0: + this.begin("open_directive"); + return 28; + case 1: + this.begin("type_directive"); + return 29; + case 2: + this.popState(); + this.begin("arg_directive"); + return 15; + case 3: + this.popState(); + this.popState(); + return 31; + case 4: + return 30; + case 5: + break; + case 6: + break; + case 7: + return 11; + case 8: + break; + case 9: + break; + case 10: + return 4; + case 11: + return 17; + case 12: + this.begin("acc_title"); + return 18; + case 13: + this.popState(); + return "acc_title_value"; + case 14: + this.begin("acc_descr"); + return 20; + case 15: + this.popState(); + return "acc_descr_value"; + case 16: + this.begin("acc_descr_multiline"); + break; + case 17: + this.popState(); + break; + case 18: + return "acc_descr_multiline_value"; + case 19: + return 23; + case 20: + return 27; + case 21: + return 26; + case 22: + return 6; + case 23: + return "INVALID"; + } + }, + rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?::\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { "open_directive": { "rules": [1], "inclusive": false }, "type_directive": { "rules": [2, 3], "inclusive": false }, "arg_directive": { "rules": [3, 4], "inclusive": false }, "acc_descr_multiline": { "rules": [17, 18], "inclusive": false }, "acc_descr": { "rules": [15], "inclusive": false }, "acc_title": { "rules": [13], "inclusive": false }, "INITIAL": { "rules": [0, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 19, 20, 21, 22, 23], "inclusive": true } } + }; + return lexer2; + }(); + parser2.lexer = lexer; + function Parser() { + this.yy = {}; + } + Parser.prototype = parser2; + parser2.Parser = Parser; + return new Parser(); +}(); +parser.parser = parser; +const parser$1 = parser; +let currentSection = ""; +let currentTaskId = 0; +const sections = []; +const tasks = []; +const rawTasks = []; +const getCommonDb = () => _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.j; +const parseDirective = (statement, context, type) => { + (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.k)(globalThis, statement, context, type); +}; +const clear = function() { + sections.length = 0; + tasks.length = 0; + currentSection = ""; + rawTasks.length = 0; + (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.m)(); +}; +const addSection = function(txt) { + currentSection = txt; + sections.push(txt); +}; +const getSections = function() { + return sections; +}; +const getTasks = function() { + let allItemsProcessed = compileTasks(); + const maxDepth = 100; + let iterationCount = 0; + while (!allItemsProcessed && iterationCount < maxDepth) { + allItemsProcessed = compileTasks(); + iterationCount++; + } + tasks.push(...rawTasks); + return tasks; +}; +const addTask = function(period, length, event) { + const rawTask = { + id: currentTaskId++, + section: currentSection, + type: currentSection, + task: period, + score: length ? length : 0, + events: event ? [event] : [] + }; + rawTasks.push(rawTask); +}; +const addEvent = function(event) { + const currentTask = rawTasks.find((task) => task.id === currentTaskId - 1); + currentTask.events.push(event); +}; +const addTaskOrg = function(descr) { + const newTask = { + section: currentSection, + type: currentSection, + description: descr, + task: descr, + classes: [] + }; + tasks.push(newTask); +}; +const compileTasks = function() { + const compileTask = function(pos) { + return rawTasks[pos].processed; + }; + let allProcessed = true; + for (const [i, rawTask] of rawTasks.entries()) { + compileTask(i); + allProcessed = allProcessed && rawTask.processed; + } + return allProcessed; +}; +const timelineDb = { + clear, + getCommonDb, + addSection, + getSections, + getTasks, + addTask, + addTaskOrg, + addEvent, + parseDirective +}; +const db = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + getCommonDb, + parseDirective, + clear, + addSection, + getSections, + getTasks, + addTask, + addEvent, + addTaskOrg, + default: timelineDb +}, Symbol.toStringTag, { value: "Module" })); +const MAX_SECTIONS = 12; +const drawRect = function(elem, rectData) { + const rectElem = elem.append("rect"); + rectElem.attr("x", rectData.x); + rectElem.attr("y", rectData.y); + rectElem.attr("fill", rectData.fill); + rectElem.attr("stroke", rectData.stroke); + rectElem.attr("width", rectData.width); + rectElem.attr("height", rectData.height); + rectElem.attr("rx", rectData.rx); + rectElem.attr("ry", rectData.ry); + if (rectData.class !== void 0) { + rectElem.attr("class", rectData.class); + } + return rectElem; +}; +const drawFace = function(element, faceData) { + const radius = 15; + const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible"); + const face = element.append("g"); + face.append("circle").attr("cx", faceData.cx - radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + face.append("circle").attr("cx", faceData.cx + radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + function smile(face2) { + const arc$1 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .arc */ .Nb1)().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")"); + } + function sad(face2) { + const arc$1 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .arc */ .Nb1)().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")"); + } + function ambivalent(face2) { + face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666"); + } + if (faceData.score > 3) { + smile(face); + } else if (faceData.score < 3) { + sad(face); + } else { + ambivalent(face); + } + return circleElement; +}; +const drawCircle = function(element, circleData) { + const circleElement = element.append("circle"); + circleElement.attr("cx", circleData.cx); + circleElement.attr("cy", circleData.cy); + circleElement.attr("class", "actor-" + circleData.pos); + circleElement.attr("fill", circleData.fill); + circleElement.attr("stroke", circleData.stroke); + circleElement.attr("r", circleData.r); + if (circleElement.class !== void 0) { + circleElement.attr("class", circleElement.class); + } + if (circleData.title !== void 0) { + circleElement.append("title").text(circleData.title); + } + return circleElement; +}; +const drawText = function(elem, textData) { + const nText = textData.text.replace(//gi, " "); + const textElem = elem.append("text"); + textElem.attr("x", textData.x); + textElem.attr("y", textData.y); + textElem.attr("class", "legend"); + textElem.style("text-anchor", textData.anchor); + if (textData.class !== void 0) { + textElem.attr("class", textData.class); + } + const span = textElem.append("tspan"); + span.attr("x", textData.x + textData.textMargin * 2); + span.text(nText); + return textElem; +}; +const drawLabel = function(elem, txtObject) { + function genPoints(x, y, width, height, cut) { + return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height); + } + const polygon = elem.append("polygon"); + polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7)); + polygon.attr("class", "labelBox"); + txtObject.y = txtObject.y + txtObject.labelMargin; + txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin; + drawText(elem, txtObject); +}; +const drawSection = function(elem, section, conf2) { + const g = elem.append("g"); + const rect = getNoteRect(); + rect.x = section.x; + rect.y = section.y; + rect.fill = section.fill; + rect.width = conf2.width; + rect.height = conf2.height; + rect.class = "journey-section section-type-" + section.num; + rect.rx = 3; + rect.ry = 3; + drawRect(g, rect); + _drawTextCandidateFunc(conf2)( + section.text, + g, + rect.x, + rect.y, + rect.width, + rect.height, + { class: "journey-section section-type-" + section.num }, + conf2, + section.colour + ); +}; +let taskCount = -1; +const drawTask = function(elem, task, conf2) { + const center = task.x + conf2.width / 2; + const g = elem.append("g"); + taskCount++; + const maxHeight = 300 + 5 * 30; + g.append("line").attr("id", "task" + taskCount).attr("x1", center).attr("y1", task.y).attr("x2", center).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"); + drawFace(g, { + cx: center, + cy: 300 + (5 - task.score) * 30, + score: task.score + }); + const rect = getNoteRect(); + rect.x = task.x; + rect.y = task.y; + rect.fill = task.fill; + rect.width = conf2.width; + rect.height = conf2.height; + rect.class = "task task-type-" + task.num; + rect.rx = 3; + rect.ry = 3; + drawRect(g, rect); + task.x + 14; + _drawTextCandidateFunc(conf2)( + task.task, + g, + rect.x, + rect.y, + rect.width, + rect.height, + { class: "task" }, + conf2, + task.colour + ); +}; +const drawBackgroundRect = function(elem, bounds) { + const rectElem = drawRect(elem, { + x: bounds.startx, + y: bounds.starty, + width: bounds.stopx - bounds.startx, + height: bounds.stopy - bounds.starty, + fill: bounds.fill, + class: "rect" + }); + rectElem.lower(); +}; +const getTextObj = function() { + return { + x: 0, + y: 0, + fill: void 0, + "text-anchor": "start", + width: 100, + height: 100, + textMargin: 0, + rx: 0, + ry: 0 + }; +}; +const getNoteRect = function() { + return { + x: 0, + y: 0, + width: 100, + anchor: "start", + height: 100, + rx: 0, + ry: 0 + }; +}; +const _drawTextCandidateFunc = function() { + function byText(content, g, x, y, width, height, textAttrs, colour) { + const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content); + _setTextAttrs(text, textAttrs); + } + function byTspan(content, g, x, y, width, height, textAttrs, conf2, colour) { + const { taskFontSize, taskFontFamily } = conf2; + const lines = content.split(//gi); + for (let i = 0; i < lines.length; i++) { + const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2; + const text = g.append("text").attr("x", x + width / 2).attr("y", y).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily); + text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]); + text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"); + _setTextAttrs(text, textAttrs); + } + } + function byFo(content, g, x, y, width, height, textAttrs, conf2) { + const body = g.append("switch"); + const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed"); + const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, body, x, y, width, height, textAttrs, conf2); + _setTextAttrs(text, textAttrs); + } + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (key in fromTextAttrsDict) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + return function(conf2) { + return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan; + }; +}(); +const initGraphics = function(graphics) { + graphics.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z"); +}; +function wrap(text, width) { + text.each(function() { + var text2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(this), words = text2.text().split(/(\s+|
)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em"); + for (let j = 0; j < words.length; j++) { + word = words[words.length - 1 - j]; + line.push(word); + tspan.text(line.join(" ").trim()); + if (tspan.node().getComputedTextLength() > width || word === "
") { + line.pop(); + tspan.text(line.join(" ").trim()); + if (word === "
") { + line = [""]; + } else { + line = [word]; + } + tspan = text2.append("tspan").attr("x", 0).attr("y", y).attr("dy", lineHeight + "em").text(word); + } + } + }); +} +const drawNode = function(elem, node, fullSection, conf2) { + const section = fullSection % MAX_SECTIONS - 1; + const nodeElem = elem.append("g"); + node.section = section; + nodeElem.attr( + "class", + (node.class ? node.class + " " : "") + "timeline-node " + ("section-" + section) + ); + const bkgElem = nodeElem.append("g"); + const textElem = nodeElem.append("g"); + const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width); + const bbox = txt.node().getBBox(); + const fontSize = conf2.fontSize && conf2.fontSize.replace ? conf2.fontSize.replace("px", "") : conf2.fontSize; + node.height = bbox.height + fontSize * 1.1 * 0.5 + node.padding; + node.height = Math.max(node.height, node.maxHeight); + node.width = node.width + 2 * node.padding; + textElem.attr("transform", "translate(" + node.width / 2 + ", " + node.padding / 2 + ")"); + defaultBkg(bkgElem, node, section); + return node; +}; +const getVirtualNodeHeight = function(elem, node, conf2) { + const textElem = elem.append("g"); + const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width); + const bbox = txt.node().getBBox(); + const fontSize = conf2.fontSize && conf2.fontSize.replace ? conf2.fontSize.replace("px", "") : conf2.fontSize; + textElem.remove(); + return bbox.height + fontSize * 1.1 * 0.5 + node.padding; +}; +const defaultBkg = function(elem, node, section) { + const rd = 5; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + node.type).attr( + "d", + `M0 ${node.height - rd} v${-node.height + 2 * rd} q0,-5 5,-5 h${node.width - 2 * rd} q5,0 5,5 v${node.height - rd} H0 Z` + ); + elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node.height).attr("x2", node.width).attr("y2", node.height); +}; +const svgDraw = { + drawRect, + drawCircle, + drawSection, + drawText, + drawLabel, + drawTask, + drawBackgroundRect, + getTextObj, + getNoteRect, + initGraphics, + drawNode, + getVirtualNodeHeight +}; +const setConf = function(cnf) { + const keys = Object.keys(cnf); + keys.forEach(function(key) { + conf[key] = cnf[key]; + }); +}; +const draw = function(text, id, version, diagObj) { + const conf2 = (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.g)(); + const LEFT_MARGIN = conf2.leftMargin ? conf2.leftMargin : 50; + diagObj.db.clear(); + diagObj.parser.parse(text + "\n"); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("timeline", diagObj.db); + const securityLevel = conf2.securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("#i" + id); + } + const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body"); + const svg = root.select("#" + id); + svg.append("g"); + const tasks2 = diagObj.db.getTasks(); + const title = diagObj.db.getCommonDb().getDiagramTitle(); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("task", tasks2); + svgDraw.initGraphics(svg); + const sections2 = diagObj.db.getSections(); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("sections", sections2); + let maxSectionHeight = 0; + let maxTaskHeight = 0; + let depthY = 0; + let sectionBeginY = 0; + let masterX = 50 + LEFT_MARGIN; + let masterY = 50; + sectionBeginY = 50; + let sectionNumber = 0; + let hasSections = true; + sections2.forEach(function(section) { + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: 150, + padding: 20, + maxHeight: maxSectionHeight + }; + const sectionHeight = svgDraw.getVirtualNodeHeight(svg, sectionNode, conf2); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("sectionHeight before draw", sectionHeight); + maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20); + }); + let maxEventCount = 0; + let maxEventLineLength = 0; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("tasks.length", tasks2.length); + for (const [i, task] of tasks2.entries()) { + const taskNode = { + number: i, + descr: task, + section: task.section, + width: 150, + padding: 20, + maxHeight: maxTaskHeight + }; + const taskHeight = svgDraw.getVirtualNodeHeight(svg, taskNode, conf2); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("taskHeight before draw", taskHeight); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20); + maxEventCount = Math.max(maxEventCount, task.events.length); + let maxEventLineLengthTemp = 0; + for (let j = 0; j < task.events.length; j++) { + const event = task.events[j]; + const eventNode = { + descr: event, + section: task.section, + number: task.section, + width: 150, + padding: 20, + maxHeight: 50 + }; + maxEventLineLengthTemp += svgDraw.getVirtualNodeHeight(svg, eventNode, conf2); + } + maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp); + } + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("maxSectionHeight before draw", maxSectionHeight); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("maxTaskHeight before draw", maxTaskHeight); + if (sections2 && sections2.length > 0) { + sections2.forEach((section) => { + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: 150, + padding: 20, + maxHeight: maxSectionHeight + }; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("sectionNode", sectionNode); + const sectionNodeWrapper = svg.append("g"); + const node = svgDraw.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf2); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("sectionNode output", node); + sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`); + masterY += maxSectionHeight + 50; + const tasksForSection = tasks2.filter((task) => task.section === section); + if (tasksForSection.length > 0) { + drawTasks( + svg, + tasksForSection, + sectionNumber, + masterX, + masterY, + maxTaskHeight, + conf2, + maxEventCount, + maxEventLineLength, + maxSectionHeight, + false + ); + } + masterX += 200 * Math.max(tasksForSection.length, 1); + masterY = sectionBeginY; + sectionNumber++; + }); + } else { + hasSections = false; + drawTasks( + svg, + tasks2, + sectionNumber, + masterX, + masterY, + maxTaskHeight, + conf2, + maxEventCount, + maxEventLineLength, + maxSectionHeight, + true + ); + } + const box = svg.node().getBBox(); + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("bounds", box); + if (title) { + svg.append("text").text(title).attr("x", box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20); + } + depthY = hasSections ? maxSectionHeight + maxTaskHeight + 150 : maxTaskHeight + 100; + const lineWrapper = svg.append("g").attr("class", "lineWrapper"); + lineWrapper.append("line").attr("x1", LEFT_MARGIN).attr("y1", depthY).attr("x2", box.width + 3 * LEFT_MARGIN).attr("y2", depthY).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"); + (0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.s)( + void 0, + svg, + conf2.timeline.padding ? conf2.timeline.padding : 50, + conf2.timeline.useMaxWidth ? conf2.timeline.useMaxWidth : false + ); +}; +const drawTasks = function(diagram2, tasks2, sectionColor, masterX, masterY, maxTaskHeight, conf2, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections) { + for (const task of tasks2) { + const taskNode = { + descr: task.task, + section: sectionColor, + number: sectionColor, + width: 150, + padding: 20, + maxHeight: maxTaskHeight + }; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("taskNode", taskNode); + const taskWrapper = diagram2.append("g").attr("class", "taskWrapper"); + const node = svgDraw.drawNode(taskWrapper, taskNode, sectionColor, conf2); + const taskHeight = node.height; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("taskHeight after draw", taskHeight); + taskWrapper.attr("transform", `translate(${masterX}, ${masterY})`); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight); + if (task.events) { + const lineWrapper = diagram2.append("g").attr("class", "lineWrapper"); + let linelength = maxTaskHeight; + masterY += 100; + linelength = linelength + drawEvents(diagram2, task.events, sectionColor, masterX, masterY, conf2); + masterY -= 100; + lineWrapper.append("line").attr("x1", masterX + 190 / 2).attr("y1", masterY + maxTaskHeight).attr("x2", masterX + 190 / 2).attr( + "y2", + masterY + maxTaskHeight + (isWithoutSections ? maxTaskHeight : maxSectionHeight) + maxEventLineLength + 120 + ).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5"); + } + masterX = masterX + 200; + if (isWithoutSections && !(0,_mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.g)().timeline.disableMulticolor) { + sectionColor++; + } + } + masterY = masterY - 10; +}; +const drawEvents = function(diagram2, events, sectionColor, masterX, masterY, conf2) { + let maxEventHeight = 0; + const eventBeginY = masterY; + masterY = masterY + 100; + for (const event of events) { + const eventNode = { + descr: event, + section: sectionColor, + number: sectionColor, + width: 150, + padding: 20, + maxHeight: 50 + }; + _mermaid_95cd9c8e_js__WEBPACK_IMPORTED_MODULE_8__.l.debug("eventNode", eventNode); + const eventWrapper = diagram2.append("g").attr("class", "eventWrapper"); + const node = svgDraw.drawNode(eventWrapper, eventNode, sectionColor, conf2); + const eventHeight = node.height; + maxEventHeight = maxEventHeight + eventHeight; + eventWrapper.attr("transform", `translate(${masterX}, ${masterY})`); + masterY = masterY + 10 + eventHeight; + } + masterY = eventBeginY; + return maxEventHeight; +}; +const renderer = { + setConf, + draw +}; +const genSections = (options) => { + let sections2 = ""; + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i]; + if ((0,khroma__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)(options["lineColor" + i])) { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } else { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } + } + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + const sw = "" + (17 - 3 * i); + sections2 += ` + .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} path { + fill: ${options["cScale" + i]}; + } + .section-${i - 1} text { + fill: ${options["cScaleLabel" + i]}; + } + .node-icon-${i - 1} { + font-size: 40px; + color: ${options["cScaleLabel" + i]}; + } + .section-edge-${i - 1}{ + stroke: ${options["cScale" + i]}; + } + .edge-depth-${i - 1}{ + stroke-width: ${sw}; + } + .section-${i - 1} line { + stroke: ${options["cScaleInv" + i]} ; + stroke-width: 3; + } + + .lineWrapper line{ + stroke: ${options["cScaleLabel" + i]} ; + } + + .disabled, .disabled circle, .disabled text { + fill: lightgray; + } + .disabled text { + fill: #efefef; + } + `; + } + return sections2; +}; +const getStyles = (options) => ` + .edge { + stroke-width: 3; + } + ${genSections(options)} + .section-root rect, .section-root path, .section-root circle { + fill: ${options.git0}; + } + .section-root text { + fill: ${options.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .eventWrapper { + filter: brightness(120%); + } +`; +const styles = getStyles; +const diagram = { + db, + renderer, + parser: parser$1, + styles +}; + +//# sourceMappingURL=diagram-definition.444bacb8.js.map + + +/***/ }), + +/***/ 91619: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "Z": () => (/* binding */ is_dark) +}); + +// EXTERNAL MODULE: ./node_modules/khroma/dist/utils/index.js + 3 modules +var utils = __webpack_require__(61691); +// EXTERNAL MODULE: ./node_modules/khroma/dist/color/index.js + 4 modules +var dist_color = __webpack_require__(71610); +;// CONCATENATED MODULE: ./node_modules/khroma/dist/methods/luminance.js +/* IMPORT */ + + +/* MAIN */ +//SOURCE: https://planetcalc.com/7779 +const luminance = (color) => { + const { r, g, b } = dist_color/* default.parse */.Z.parse(color); + const luminance = .2126 * utils/* default.channel.toLinear */.Z.channel.toLinear(r) + .7152 * utils/* default.channel.toLinear */.Z.channel.toLinear(g) + .0722 * utils/* default.channel.toLinear */.Z.channel.toLinear(b); + return utils/* default.lang.round */.Z.lang.round(luminance); +}; +/* EXPORT */ +/* harmony default export */ const methods_luminance = (luminance); + +;// CONCATENATED MODULE: ./node_modules/khroma/dist/methods/is_light.js +/* IMPORT */ + +/* MAIN */ +const isLight = (color) => { + return methods_luminance(color) >= .5; +}; +/* EXPORT */ +/* harmony default export */ const is_light = (isLight); + +;// CONCATENATED MODULE: ./node_modules/khroma/dist/methods/is_dark.js +/* IMPORT */ + +/* MAIN */ +const isDark = (color) => { + return !is_light(color); +}; +/* EXPORT */ +/* harmony default export */ const is_dark = (isDark); + + +/***/ }) + +}; +; \ No newline at end of file diff --git a/docs/assets/js/716fdc54.08318d9e.js b/docs/assets/js/716fdc54.08318d9e.js new file mode 100644 index 000000000..58063c99b --- /dev/null +++ b/docs/assets/js/716fdc54.08318d9e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[50703],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,v=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.7.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.7.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.7.0/basics/events",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.7.0/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.7.0/basics/cross-calls"}},l={},c=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Different blockchains implement events in different ways. Odra lets you forget about it by introducing\nOdra Events. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::{Event, contract_env};\nuse odra::types::{Address, BlockTime, event::OdraEvent};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract {\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n\n#[odra::module]\nimpl PartyContract {\n #[odra(init)]\n pub fn init(&self) {\n PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n }.emit();\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, we derive an ",(0,a.kt)("inlineCode",{parentName:"p"},"Event")," macro like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n")),(0,a.kt)("p",null,"Among other things, it adds an ",(0,a.kt)("inlineCode",{parentName:"p"},"emit()")," function to the struct, which allows you to emit the event simply\nas that:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n}.emit();\n")),(0,a.kt)("p",null,"Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. "),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a handy macro ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::{assert_events, test_env};\nuse crate::features::events::PartyStarted;\nuse super::PartyContractDeployer;\n\n#[test]\nfn test_party() {\n let party_contract = PartyContractDeployer::init();\n assert_events!(\n party_contract,\n PartyStarted {\n caller: test_env::get_account(0),\n block_time: 0,\n }\n );\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/71735968.d6559de6.js b/docs/assets/js/71735968.d6559de6.js new file mode 100644 index 000000000..d5d9733c8 --- /dev/null +++ b/docs/assets/js/71735968.d6559de6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[79345],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,h=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return r?n.createElement(h,i(i({ref:t},u),{},{components:r})):n.createElement(h,i({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={slug:"casper-zk-risc0",title:"Zero Knowledge on Casper",authors:["zie1ony"],image:"https://github.com/odradev.png"},i=void 0,s={permalink:"/blog/casper-zk-risc0",source:"@site/blog/2022-12-12-casper-zk-risc0.md",title:"Zero Knowledge on Casper",description:"In this post, I present how to verify a zero knowledge proof on Casper.",date:"2022-12-12T00:00:00.000Z",formattedDate:"December 12, 2022",tags:[],readingTime:4.215,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"casper-zk-risc0",title:"Zero Knowledge on Casper",authors:["zie1ony"],image:"https://github.com/odradev.png"},prevItem:{title:"EVM at Risc0",permalink:"/blog/evm-at-risc0"},nextItem:{title:"Odra 0.2.0 Released",permalink:"/blog/release-020"}},l={authorsImageUrls:[void 0]},p=[{value:"Zero Knowledge",id:"zero-knowledge",level:2},{value:"Risc Zero",id:"risc-zero",level:2},{value:"Example",id:"example",level:2},{value:"Guest",id:"guest",level:3},{value:"Prover",id:"prover",level:3},{value:"Verifier",id:"verifier",level:3},{value:"Livenet results",id:"livenet-results",level:3},{value:"What next",id:"what-next",level:2},{value:"Join us",id:"join-us",level:2}],u={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"In this post, I present how to verify a zero knowledge proof on Casper."),(0,o.kt)("h2",{id:"zero-knowledge"},"Zero Knowledge"),(0,o.kt)("p",null,"In my opinion, the ",(0,o.kt)("strong",{parentName:"p"},"zero knowledge")," (ZK) is the largest revolution in\nblockchains, since Ethereum introduced Turing-complete, account-based\nsmart contracts.\nTo put it in simple words, ZK enables two use cases not possible before:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Computation scaling - I can perform expensive computation off-chain\nand put the result on a chain with the proof."),(0,o.kt)("li",{parentName:"ol"},"Anonymity - I can prove to you, I know something without revealing it. ")),(0,o.kt)("h2",{id:"risc-zero"},"Risc Zero"),(0,o.kt)("p",null,"I'd like to introduce you to ",(0,o.kt)("a",{parentName:"p",href:"https://www.risczero.com/"},"Risc Zero"),".\nIt is the general purpose zero-knowledge virtual machine.\nGo ahead and spend time reading their website!\nFor us, the key component is the proof verifier that can be compiled into WASM.\nSooo... we can run it on Casper :)\nYes! We can prove any program, produce proof, and send it to Casper's\nsmart contract for verification."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,"Let's dive into the example to see how it works.\n",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-zk-with-risc0"},"The full example code"),"\nyou can find on our GitHub.\nIt is based on Risc Zero's ",(0,o.kt)("a",{parentName:"p",href:"https://www.risczero.com/docs/examples/hello_multiply"},"Hello, Multiply!"),"\nexample. So make sure you understand it first.\n",(0,o.kt)("a",{parentName:"p",href:"#guest"},"Guest")," and ",(0,o.kt)("a",{parentName:"p",href:"#prover"},"Prover")," sections are taken from this example."),(0,o.kt)("h3",{id:"guest"},"Guest"),(0,o.kt)("p",null,"The program we are proving is called a ",(0,o.kt)("strong",{parentName:"p"},"guest")," in Risc Zero.\nOur goal is to prove we know the factors of an arbitrary number.\nGiven ",(0,o.kt)("inlineCode",{parentName:"p"},"a")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"b")," below guest program computes ",(0,o.kt)("inlineCode",{parentName:"p"},"a * b")," and produces\na proof of computation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="methods/guest/src/multiply.rs"',title:'"methods/guest/src/multiply.rs"'},'pub fn main() {\n // Load the first number from the host\n let a: u64 = env::read();\n // Load the second number from the host\n let b: u64 = env::read();\n // Verify that neither of them are 1 (i.e. nontrivial factors)\n if a == 1 || b == 1 {\n panic!("Trivial factors")\n }\n // Compute the product while being careful with integer overflow\n let product = a.checked_mul(b).expect("Integer overflow");\n env::commit(&product);\n}\n')),(0,o.kt)("h3",{id:"prover"},"Prover"),(0,o.kt)("p",null,"It's time to run the guest program and build the proof for\na specific ",(0,o.kt)("inlineCode",{parentName:"p"},"a")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"b")," values."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="prover/src/main.rs"',title:'"prover/src/main.rs"'},'fn main() {\n // Pick two numbers.\n let a: u64 = 17;\n let b: u64 = 23;\n\n // First, we make the prover, loading the \'multiply\' method.\n let multiply_src = std::fs::read(MULTIPLY_PATH)\n .expect("Method code should be present at the specified path.");\n let mut prover = Prover::new(&multiply_src, MULTIPLY_ID)\n .expect("Prover should be constructed.",);\n\n // Next we send a & b to the guest.\n prover.add_input_u32_slice(to_vec(&a).unwrap().as_slice());\n prover.add_input_u32_slice(to_vec(&b).unwrap().as_slice());\n \n // Run prover & generate receipt\n let receipt = prover.run()\n .expect("Valid code should be provable.");\n\n // Extract journal of receipt (i.e. output c, where c = a * b)\n let c: u64 = from_slice(&receipt.journal)\n .expect("Journal output should deserialize.");\n\n // Print an assertion\n println!("I know the factors of {}, and I can prove it!", c);\n\n // Verify receipt, panic if it\'s wrong.\n receipt.verify(MULTIPLY_ID).expect(\n "Code you have proven should successfully verify.",\n );\n\n // Convert journal to string and store on disk.\n let journal = serde_json::to_string(&receipt.journal).unwrap();\n write_to_file("../data/journal", &journal);\n\n // Convert seal to string and store on disk.\n let seal = serde_json::to_string(&receipt.seal).unwrap();\n write_to_file("../data/seal", &seal);\n\n // Convert method_id to string and store on disk.\n let result = serde_json::to_string(MULTIPLY_ID).unwrap();\n write_to_file("../data/method", &result);\n}\n')),(0,o.kt)("h3",{id:"verifier"},"Verifier"),(0,o.kt)("p",null,"Now the verification step.\nGiven the proof (journal + seal) and the guest program definition (method),\nCasper's smart contract checks its correctness. This one is written\njust for the demonstration, but in general you want ",(0,o.kt)("inlineCode",{parentName:"p"},"METHOD_ID")," to be\nstored in your contract and both ",(0,o.kt)("inlineCode",{parentName:"p"},"SEAL")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"JOURNAL")," to be passed to\nthe contract via arguments from the outside."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="verifier/src/verifier_contract.rs"',title:'"verifier/src/verifier_contract.rs"'},'// Import the proof and the method.\nconst METHOD_ID: &[u8] = &include!("../../data/method");\nconst SEAL: &[u32] = &include!("../../data/seal");\nconst JOURNAL: &[u32] = &include!("../../data/journal");\n\n// Verifier contract holds a result of the zk verification. \n#[odra::module]\npub struct Verifier {\n result: Variable,\n}\n\n#[odra::module]\nimpl Verifier {\n // Calling this entry point triggers the zk proof verification.\n pub fn verify(&mut self) {\n let result = verify(JOURNAL, SEAL, METHOD_ID);\n self.result.set(result);\n }\n\n // Result getter.\n pub fn result(&self) -> String {\n self.result.get().unwrap_or(String::from("Not processed"))\n }\n}\n\n// The verification method. It constructs new Receipt and verifies it.\nfn verify(journal: &[u32], seal: &[u32], method_id: &[u8]) -> String {\n let result = Receipt::new(&journal, &seal).verify(method_id);\n\n match result {\n Ok(()) => String::from("Ok"),\n Err(err) => format!("Error: {}", err.to_string())\n }\n}\n')),(0,o.kt)("h3",{id:"livenet-results"},"Livenet results"),(0,o.kt)("p",null,"I have deployed it to the testnet and called the ",(0,o.kt)("inlineCode",{parentName:"p"},"verify")," method.\nThe ",(0,o.kt)("inlineCode",{parentName:"p"},"result")," was ",(0,o.kt)("inlineCode",{parentName:"p"},"Ok"),". Wow, first-ever ZK proof verification on Casper.\nTrustless bridging, layer 2 here we come :)"),(0,o.kt)("p",null,"The cost of running the ",(0,o.kt)("inlineCode",{parentName:"p"},"verify")," method is ",(0,o.kt)("inlineCode",{parentName:"p"},"2324 CSPR"),". That's a lot, but\nwe have to start somewhere."),(0,o.kt)("h2",{id:"what-next"},"What next"),(0,o.kt)("p",null,"I think it is a good place to outline possible Casper ZK goals for moving\nthis forward. The community should discuss: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Building more examples. Risc Zero has a nice battleship game to port over\nto Casper."),(0,o.kt)("li",{parentName:"ol"},"Adding Risc Zero verification method to Casper's FFI."),(0,o.kt)("li",{parentName:"ol"},"Supporting Risc Zero team. We should help develop this awesome\nopen-source project and gain the ZK expertise.")),(0,o.kt)("h2",{id:"join-us"},"Join us"),(0,o.kt)("p",null,"Interested in zero knowledge on Casper?"),(0,o.kt)("p",null,"Join ",(0,o.kt)("a",{parentName:"p",href:"https://discord.gg/Mm5ABc9P8k"},"our Discord"),", ",(0,o.kt)("a",{parentName:"p",href:"https://twitter.com/odradev"},"our Twitter")," or write us\nat ",(0,o.kt)("a",{parentName:"p",href:"mailto:contact@odra.dev"},"contact@odra.dev"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/71958ad0.3cb1ee08.js b/docs/assets/js/71958ad0.3cb1ee08.js new file mode 100644 index 000000000..08d748687 --- /dev/null +++ b/docs/assets/js/71958ad0.3cb1ee08.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67556],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.6.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.6.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.6.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.6.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.6.0/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = { path = "../core", default-features = false }\nodra-modules = { path = "../modules", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]\ncasper = ["odra/casper", "odra-modules/casper"]\n')),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules")," defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," feature in your project, add ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules/casper"),"specifically (it applies to each backend).")),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::types::{Address, U256};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main Odra repository.")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/71994587.73f3f62c.js b/docs/assets/js/71994587.73f3f62c.js new file mode 100644 index 000000000..a4c0f7242 --- /dev/null +++ b/docs/assets/js/71994587.73f3f62c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74398],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.8.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.8.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.8.0/basics/cross-calls",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.8.0/basics/events"},next:{title:"Modules",permalink:"/docs/0.8.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Loading the contract",id:"loading-the-contract",level:3},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::prelude::*;\nuse odra::{Address, UnwrapOrRevert, Var};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Var
\n}\n\n#[odra::module]\nimpl CrossContract {\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());\n MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine;\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To perform a cross-contact call, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"HostRef")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/testing"},"Testing")," article - a host side reference to already deployed contract."),(0,r.kt)("p",null,"In the module context we use a ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractRef")," instead, to call other contracts."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," is generated automatically,\nby the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("p",null,"To obtain an instance of a contract reference, we simply call the constructor - ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env: Rc, address: Address)"),", as shown above."),(0,r.kt)("p",null,"The reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), and the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::address()")," function, which returns the address of the contract."),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderContractRef")," struct (and ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderHostRef")," to be used in tests, but do not implement the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer")," trait). Having an address, in the module context we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"AdderContractRef::new(self.env(), address).add(3, 5)\n")),(0,r.kt)("h3",{id:"loading-the-contract"},"Loading the contract"),(0,r.kt)("p",null,"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test\nour contracts in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/livenet"},"Livenet")," backend. We can load the contract using ",(0,r.kt)("inlineCode",{parentName:"p"},"load")," method on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/bin/erc20_on_livenet.rs"',title:'"examples/bin/erc20_on_livenet.rs"'},'fn _load(env: &HostEnv) -> Erc20HostRef {\n let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n let address = Address::from_str(address).unwrap();\n ::load(env, address)\n}\n')),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};\n use odra::host::{Deployer, HostRef, NoArgs};\n\n #[test]\n fn test_cross_calls() {\n let test_env = odra_test::env();\n let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);\n\n let init_args = CrossContractInitArgs {\n math_engine_address: *math_engine_contract.address()\n };\n let cross_contract = CrossContractHostRef::deploy(&test_env, init_args);\n\n assert_eq!(cross_contract.add_using_another(), 8);\n }\n}\n")),(0,r.kt)("p",null,"Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that we intend to utilize."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{Address, host::{Deployer, HostRef, NoArgs}};\n \n #[test]\n fn test_ext() {\n let test_env = odra_test::env();\n let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address(test_env: &HostEnv) -> Address {\n let contract = MathEngineHostRef::deploy(test_env, NoArgs);\n *contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/71b12fda.7fb73702.js b/docs/assets/js/71b12fda.7fb73702.js new file mode 100644 index 000000000..d7925f279 --- /dev/null +++ b/docs/assets/js/71b12fda.7fb73702.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[42986],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},i="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-1.0.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-1.0.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/basics/flipper-internals",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Var;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Var,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Var")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the attribute - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The function named ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," is the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," function is optional,\nif your contract does not need any initialization, you can skip it."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/host/trait.Deployer.html#tymethod.deploy"},(0,a.kt)("inlineCode",{parentName:"a"},"Deployer::deploy"))," function called on ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperHostRef")," - a piece of code generated\nby the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),". Because the module implements the constructor but does not accept any arguments,\nas the second argument of the deploy function, we pass ",(0,a.kt)("inlineCode",{parentName:"p"},"NoArgs")," - one of the implementations of\nthe ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/host/trait.InitArgs.html"},(0,a.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait provided with the framework. "),(0,a.kt)("p",null,"The contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/71b691b7.d90ad4d0.js b/docs/assets/js/71b691b7.d90ad4d0.js new file mode 100644 index 000000000..9a9477c0a --- /dev/null +++ b/docs/assets/js/71b691b7.d90ad4d0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53095],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(s,".").concat(m)]||d[m]||p[m]||i;return n?r.createElement(f,o(o({ref:t},u),{},{components:n})):r.createElement(f,o({ref:t},u))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const i={slug:"evm-at-risc0",title:"EVM at Risc0",authors:["zie1ony"],image:"https://github.com/odradev.png"},o=void 0,l={permalink:"/blog/evm-at-risc0",source:"@site/blog/2023-02-13-evm-at-risc0.md",title:"EVM at Risc0",description:"Let's run Solidity code inside SputnikVM inside Risc0.",date:"2023-02-13T00:00:00.000Z",formattedDate:"February 13, 2023",tags:[],readingTime:3.97,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"evm-at-risc0",title:"EVM at Risc0",authors:["zie1ony"],image:"https://github.com/odradev.png"},prevItem:{title:"Odra + CosmWasm",permalink:"/blog/odra-cosmwasm"},nextItem:{title:"Zero Knowledge on Casper",permalink:"/blog/casper-zk-risc0"}},s={authorsImageUrls:[void 0]},c=[{value:"Solidity",id:"solidity",level:2},{value:"EVM",id:"evm",level:2},{value:"Risc0",id:"risc0",level:2},{value:"Conclusion",id:"conclusion",level:2},{value:"Join us",id:"join-us",level:2}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Let's run Solidity code inside ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/rust-blockchain/evm/"},"SputnikVM")," inside ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/risc0/risc0"},"Risc0"),"."),(0,a.kt)("p",null,"First make sure you know how Risc0 works.\nMy ",(0,a.kt)("a",{parentName:"p",href:"/blog/casper-zk-risc0"},"previous post")," explains it."),(0,a.kt)("p",null,"If you want to jump directly to the full code example, it's in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/evm-at-risc0"},"repo"),"."),(0,a.kt)("h2",{id:"solidity"},"Solidity"),(0,a.kt)("p",null,"As an example, I have this simple Solidity code.\nIt is a calculator with two functions.\nOne for addition and one for the nth Fibonacci number."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-solidity",metastring:'title="bytecode/Calculator.sol"',title:'"bytecode/Calculator.sol"'},"contract Calculator {\n function add(uint256 a, uint256 b) public pure returns (uint256) {\n return a + b;\n }\n\n function fibonacci(uint256 n) public returns (uint256) {\n if (n <= 1) {\n return n;\n } else {\n return fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\n")),(0,a.kt)("p",null,"It needs to be compiled into the byte code. ",(0,a.kt)("inlineCode",{parentName:"p"},"solc")," can do this."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"$ solc \\\n --bin-runtime \\\n --optimize \\\n --overwrite \\\n --evm-version istanbul \\\n --output-dir bytecode \\\n bytecode/Calculator.sol \n")),(0,a.kt)("p",null,"It produces an EVM bytecode in the ",(0,a.kt)("inlineCode",{parentName:"p"},"bytecode")," directory."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"$ ls bytecode/\nCalculator.bin-runtime Calculator.sol\n")),(0,a.kt)("h2",{id:"evm"},"EVM"),(0,a.kt)("p",null,"The EVM I used is ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/rust-blockchain/evm/"},"SputnikVM"),".\nMost important it is written in pure Rust and even with ",(0,a.kt)("inlineCode",{parentName:"p"},"no_std")," mode.\nThis way I can start an in-memory instance of EVM.\nThen take the bytecode of a contract and install it.\nFinally, call the contract with arguments and obtain the result value.\nFor now, it's just a Rust code. Risc0 comes later."),(0,a.kt)("p",null,"The code is based on Sputnik's ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/rust-blockchain/evm/blob/master/benches/loop.rs"},"benchmark test"),".\nHuge thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/birchmd"},"Michael Birch")," for helping with Sputnik.\nAlso make sure how EVM's ",(0,a.kt)("a",{parentName:"p",href:"https://solidity-by-example.org/function-selector"},"function selectors")," work."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="evm-runner/src/lib.rs"',title:'"evm-runner/src/lib.rs"'},'\n// Load previously compiled Calculator contract.\npub const CALCULATOR_EVM_PROGRAM: &str = include_str!(\n "../../bytecode/Calculator.bin-runtime"\n);\n\n// Run Calculator for a given input.\npub fn run_calc_contract(input: &str) -> String {\n run_evm(CALCULATOR_EVM_PROGRAM, input)\n}\n\n// Run a program (contract) for a given input. \nfn run_evm(program: &str, input: &str) -> String {\n\n // Define EVM configuration.\n let config = Config::istanbul();\n let vicinity = MemoryVicinity {\n gas_price: U256::zero(),\n origin: H160::default(),\n block_hashes: Vec::new(),\n block_number: Default::default(),\n block_coinbase: Default::default(),\n block_timestamp: Default::default(),\n block_difficulty: Default::default(),\n block_gas_limit: Default::default(),\n chain_id: U256::one(),\n block_base_fee_per_gas: U256::zero(),\n };\n\n // Initialized the state of EVM\'s memory.\n let mut state = BTreeMap::new();\n\n // Add our contract under the 0x10 address.\n state.insert(\n H160::from_str("0x1000000000000000000000000000000000000000")\n .unwrap(),\n MemoryAccount {\n nonce: U256::one(),\n balance: U256::from(10000000),\n storage: BTreeMap::new(),\n code: hex::decode(program).unwrap(),\n }\n );\n\n // Add new user 0xf0 that will be used as the contract caller.\n state.insert(\n H160::from_str("0xf000000000000000000000000000000000000000")\n .unwrap(),\n MemoryAccount {\n nonce: U256::one(),\n balance: U256::from(10000000),\n storage: BTreeMap::new(),\n code: Vec::new(),\n },\n );\n\n // Prepare the executor.\n let backend = MemoryBackend::new(&vicinity, state);\n let metadata = StackSubstateMetadata::new(u64::MAX, &config);\n let state = MemoryStackState::new(metadata, &backend);\n let precompiles = BTreeMap::new();\n let mut executor \n = StackExecutor::new_with_precompiles(state, &config, &precompiles);\n\n // Call the 0x10 contract using the 0xf0 user.\n // Use the input variable. \n let (exit_reason, result) = executor.transact_call(\n H160::from_str("0xf000000000000000000000000000000000000000")\n .unwrap(),\n H160::from_str("0x1000000000000000000000000000000000000000")\n .unwrap(),\n U256::zero(),\n hex::decode(input).unwrap(),\n u64::MAX,\n Vec::new(),\n );\n\n // Make sure the execution succeeded.\n assert!(exit_reason == ExitReason::Succeed(ExitSucceed::Returned));\n \n // Return hex encoded string.\n hex::encode(result)\n}\n')),(0,a.kt)("p",null,"Let's execute it. In below tests the ",(0,a.kt)("inlineCode",{parentName:"p"},"data")," variable hold two things:\nfunction selector and arguments."),(0,a.kt)("p",null,"For example ",(0,a.kt)("inlineCode",{parentName:"p"},"61047ff4000000000000000000000000000000000000000000000000000000000000000a"),"\nis concatination of the function selector (first 8 chars) and 256-bit long argument.\nIt is just ",(0,a.kt)("inlineCode",{parentName:"p"},"fibonacci(10)"),". ",(0,a.kt)("inlineCode",{parentName:"p"},"a")," is hex of ",(0,a.kt)("inlineCode",{parentName:"p"},"10")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"37")," is hex of ",(0,a.kt)("inlineCode",{parentName:"p"},"52"),". "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="evm-runner/src/lib.rs"',title:'"evm-runner/src/lib.rs"'},'#[test]\nfn fibonacci_works() {\n let data = "61047ff4000000000000000000000000000000000000000000000000000000000000000a";\n let result = run_calc_contract(data);\n assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000037"); \n}\n\n#[test]\nfn addition_works() {\n let data = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";\n let result = run_calc_contract(data);\n assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000009");\n}\n')),(0,a.kt)("h2",{id:"risc0"},"Risc0"),(0,a.kt)("p",null,"It's time for ",(0,a.kt)("inlineCode",{parentName:"p"},"risc0"),"."),(0,a.kt)("p",null,"First the guest program.\nIt is super simple.\nIt takes a string as an argument,\npasses it to the ",(0,a.kt)("inlineCode",{parentName:"p"},"run_calc_contract"),"\nand returns the result."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=methods/guest/src/bin/evm_calc.rs",title:"methods/guest/src/bin/evm_calc.rs"},"#![no_main]\n#![no_std]\n\nextern crate alloc;\n\nuse alloc::{string::String};\nuse risc0_zkvm::guest::{env};\nuse evm_runner::run_calc_contract;\n\nrisc0_zkvm::guest::entry!(main);\n\npub fn main() {\n let input: String = env::read();\n let result = run_calc_contract(&input);\n env::commit(&result);\n}\n")),(0,a.kt)("p",null,"The final step is calling it under ZK."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=host/src/main.rs",title:"host/src/main.rs"},'fn main() {\n println!("Proving Calculator.add(7, 2)");\n let input = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";\n let result = run_prover(input);\n println!("Proof generated. 7 + 2 = {result}");\n \n println!("Proving Calculator.fibonacci(4)");\n let input = "61047ff40000000000000000000000000000000000000000000000000000000000000004";\n let result = run_prover(input);\n println!("Proof generated. fibonacci(4) = {result}");\n}\n\nfn run_prover(input: &str) -> u32 {\n // Make the prover.\n let method_code = std::fs::read(EVM_CALC_PATH).unwrap();\n let mut prover = Prover::new(&method_code, EVM_CALC_ID).unwrap();\n\n // Push the input as an argument.\n prover.add_input_u32_slice(to_vec(input).unwrap().as_slice());\n \n // Execute the prover.\n let receipt = prover.run().unwrap();\n \n // Verify the proof.\n assert!(receipt.verify(EVM_CALC_ID).is_ok());\n \n // Return result as an u32 value.\n let result: String = from_slice(receipt.journal.as_slice()).unwrap();\n u32::from_str_radix(&result, 16).unwrap()\n}\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"$ cargo run --release -p host\nProving Calculator.add(7, 2)\nProof generated. 7 + 2 = 9\nProving Calculator.fibonacci(4)\nProof generated. fibonacci(4) = 3\n")),(0,a.kt)("h2",{id:"conclusion"},"Conclusion"),(0,a.kt)("p",null,"How amazing and mindblowing it is!\nOf course, it's just a proof of concept.\nYet with further development of Risc0 improving its proving time and\nwith more flexible SputnikVM this approach is more than promising."),(0,a.kt)("h2",{id:"join-us"},"Join us"),(0,a.kt)("p",null,"Interested?"),(0,a.kt)("p",null,"Join ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/Mm5ABc9P8k"},"our Discord"),", ",(0,a.kt)("a",{parentName:"p",href:"https://twitter.com/odradev"},"our Twitter")," or write us\nat ",(0,a.kt)("a",{parentName:"p",href:"mailto:contact@odra.dev"},"contact@odra.dev"),"."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/728e71a1.bb5e2a21.js b/docs/assets/js/728e71a1.bb5e2a21.js new file mode 100644 index 000000000..711162c7d --- /dev/null +++ b/docs/assets/js/728e71a1.bb5e2a21.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[54301],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},c),{},{components:t})):a.createElement(f,l({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={},l="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.5.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.5.0/advanced/02-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.5.0/advanced/delegate",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Module reusing",permalink:"/docs/0.5.0/advanced/using"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.5.0/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n pub fn approve(&mut self, spender: Address, amount: U256);\n pub fn name(&self) -> String;\n pub fn symbol(&self) -> String;\n pub fn decimals(&self) -> u8;\n pub fn total_supply(&self) -> U256;\n pub fn balance_of(&self, owner: Address) -> U256;\n pub fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n pub fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: Ownable,\n erc20: Erc20,\n exchange: Exchange\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n pub fn swap(&mut self, sender: Address, recipient: Address);\n pub fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/73285975.138f6b7b.js b/docs/assets/js/73285975.138f6b7b.js new file mode 100644 index 000000000..91b636252 --- /dev/null +++ b/docs/assets/js/73285975.138f6b7b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[82869],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(c,".").concat(m)]||d[m]||p[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Attributes",l={unversionedId:"advanced/attributes",id:"version-0.3.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.",source:"@site/versioned_docs/version-0.3.0/advanced/04-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.3.0/advanced/attributes",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:4,frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.3.0/advanced/advanced-storage"},next:{title:"Backends",permalink:"/docs/0.3.0/category/backends"}},c={},s=[{value:"Init",id:"init",level:2},{value:"Example",id:"example",level:3},{value:"Payable",id:"payable",level:2},{value:"Example",id:"example-1",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:s};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attributes"},"Attributes"),(0,r.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution."),(0,r.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,r.kt)("h2",{id:"init"},"Init"),(0,r.kt)("p",null,"If your contract needs initial setup, adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed."),(0,r.kt)("p",null,"It's important to note that a constructor function should not be invoked in any other context."),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/erc20.rs",title:"examples/erc20.rs"},"#[odra(init)]\npub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n}\n")),(0,r.kt)("h2",{id:"payable"},"Payable"),(0,r.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #","[odra(payable)]"," attribute can send and take money in the form of native tokens. "),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/tlw.rs",title:"examples/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = contract_env::caller();\n let amount: Balance = contract_env::attached_value();\n let current_block_time: BlockTime = contract_env::get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n contract_env::revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n Deposit {\n address: caller,\n amount\n }\n .emit();\n}\n")),(0,r.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,r.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,r.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,r.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,r.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,r.kt)("p",null,"In Odra you can just apply the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,r.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,r.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"or "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"In both cases attributes order does not matter."),(0,r.kt)("p",null,"However, a constructor cannot be payable, so the below code would not compile."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(init)]\nfn initialize() {\n // your logic...\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/733ac994.d2f8f864.js b/docs/assets/js/733ac994.d2f8f864.js new file mode 100644 index 000000000..5d6c2fdbb --- /dev/null +++ b/docs/assets/js/733ac994.d2f8f864.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[77952],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>g});var r=a(67294);function n(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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),c=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(a),g=n,m=d["".concat(s,".").concat(g)]||d[g]||u[g]||o;return a?r.createElement(m,l(l({ref:t},p),{},{components:a})):r.createElement(m,l({ref:t},p))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:n,l[1]=i;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=a(87462),n=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.3.1/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.3.1/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.3.1/getting-started/installation",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.3.1/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.3.1/getting-started/flipper"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"installation"},"Installation"),(0,n.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,n.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,n.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,n.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,n.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,n.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-uknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,n.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,n.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,n.kt)("p",null,"To install it, simply execute the following command:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra\n")),(0,n.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,n.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,n.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,n.kt)("p",null,"To create a new project, simply execute:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,n.kt)("p",null,'This will create a new folder called "my_project" and initialize Odra there. Cargo Odra\nwill create a sample contract for you in src directory. You can run the tests of this contract\nby executing:'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,n.kt)("p",null,"This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,n.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,n.kt)("h2",{id:"whats-next"},"What's next?"),(0,n.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,n.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/739a70a9.1d02e4d3.js b/docs/assets/js/739a70a9.1d02e4d3.js new file mode 100644 index 000000000..2df3d4e32 --- /dev/null +++ b/docs/assets/js/739a70a9.1d02e4d3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[69986],{3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),f=l(r),m=o,y=f["".concat(p,".").concat(m)]||f[m]||u[m]||a;return r?n.createElement(y,i(i({ref:t},s),{},{components:r})):n.createElement(y,i({ref:t},s))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={slug:"casper-zk-risc0",title:"Zero Knowledge on Casper",authors:["zie1ony"],image:"https://github.com/odradev.png"},i=void 0,c={permalink:"/blog/casper-zk-risc0",source:"@site/blog/2022-12-12-casper-zk-risc0.md",title:"Zero Knowledge on Casper",description:"In this post, I present how to verify a zero knowledge proof on Casper.",date:"2022-12-12T00:00:00.000Z",formattedDate:"December 12, 2022",tags:[],readingTime:4.215,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"casper-zk-risc0",title:"Zero Knowledge on Casper",authors:["zie1ony"],image:"https://github.com/odradev.png"},prevItem:{title:"EVM at Risc0",permalink:"/blog/evm-at-risc0"},nextItem:{title:"Odra 0.2.0 Released",permalink:"/blog/release-020"}},p={authorsImageUrls:[void 0]},l=[],s={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"In this post, I present how to verify a zero knowledge proof on Casper."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/73b9c18c.22209469.js b/docs/assets/js/73b9c18c.22209469.js new file mode 100644 index 000000000..b601cbb81 --- /dev/null +++ b/docs/assets/js/73b9c18c.22209469.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[16027],{92396:e=>{e.exports=JSON.parse('{"title":"Migrations","description":"How to keep your code in sync with the latest version of the Odra Framework.","slug":"/category/migrations","permalink":"/docs/0.9.1/category/migrations","navigation":{"previous":{"title":"Using Proxy Caller","permalink":"/docs/0.9.1/tutorials/using-proxy-caller"},"next":{"title":"Migration guide to v0.8.0","permalink":"/docs/0.9.1/migrations/to-0.8.0"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/74137f62.bda66425.js b/docs/assets/js/74137f62.bda66425.js new file mode 100644 index 000000000..885a4212a --- /dev/null +++ b/docs/assets/js/74137f62.bda66425.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12921],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||l;return t?a.createElement(f,o(o({ref:n},c),{},{components:t})):a.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,o=new Array(l);o[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const l={},o="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.9.1/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.9.1/advanced/01-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.9.1/advanced/delegate",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.9.1/category/advanced"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.9.1/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::{\n Address, casper_types::U256,\n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule,\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n fn approve(&mut self, spender: Address, amount: U256);\n fn name(&self) -> String;\n fn symbol(&self) -> String;\n fn decimals(&self) -> u8;\n fn total_supply(&self) -> U256;\n fn balance_of(&self, owner: Address) -> U256;\n fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\nuse odra::{\n Address, casper_types::U256, \n module::SubModule,\n prelude::*\n};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: SubModule,\n erc20: SubModule,\n exchange: SubModule\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n fn transfer(&mut self, recipient: Address, amount: U256);\n fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n fn swap(&mut self, sender: Address, recipient: Address);\n fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7414f7c1.de1f8981.js b/docs/assets/js/7414f7c1.de1f8981.js new file mode 100644 index 000000000..a011dbbbb --- /dev/null +++ b/docs/assets/js/7414f7c1.de1f8981.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[42858],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>g});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),c=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=c(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(t),g=r,m=u["".concat(p,".").concat(g)]||u[g]||d[g]||i;return t?a.createElement(m,o(o({ref:n},l),{},{components:t})):a.createElement(m,o({ref:n},l))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const i={},o="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.3.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.3.0/advanced/03-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.3.0/advanced/advanced-storage",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Delegate",permalink:"/docs/0.3.0/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.3.0/advanced/attributes"}},p={},c=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],l={toc:c};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Variable"),": A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The Sequence in Odra is a basic module that holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + OdraType\n{\n value: Variable\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/mapping.rs"',title:'"examples/mapping.rs"'},"use odra::{map, types::U256, Mapping, UnwrapOrRevert};\n\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct NestedMapping {\n strings: Mapping>>,\n tokens: Mapping>>\n}\n\n#[odra::module]\nimpl NestedMapping {\n\n ...\n\n pub fn set_token(\n &mut self,\n key1: String,\n key2: u32,\n key3: String,\n token_name: String,\n decimals: u8,\n symbol: String,\n initial_supply: &U256\n ) {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .init(token_name, symbol, decimals, initial_supply);\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let mapping = self.strings.get_instance(&key1).get_instance(&key2);\n mapping.get(&key3).unwrap_or_revert()\n }\n\n pub fn total_supply(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> U256 {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .total_supply()\n }\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers. "),(0,r.kt)("p",{parentName:"admonition"},"Instead of using the ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()"),", which sets the correct namespace for nested modules.")),(0,r.kt)("p",null,"If the terminal value is deeply nested, a long chain of get_instance() calls is required."),(0,r.kt)("p",null,"To keep the codebase consistent, a ",(0,r.kt)("inlineCode",{parentName:"p"},"map!")," macro can be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/mapping.rs"',title:'"examples/mapping.rs"'},"...\n\npub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {\n map!(self.strings[key1][key2][key3] = value);\n}\n\npub fn get_string_macro(\n &self, \n key1: String, \n key2: u32, \n key3: String\n) -> String {\n map!(self.strings[key1][key2][key3])\n}\n\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The terminal value must not be an Odra Module.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Sequence, Mapping};\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n my_sequence: Sequence,\n my_mapping: Mapping>,\n}\n\nimpl AdvancedStorage {\n pub fn get_sequence_current_value(&self) -> u32 {\n self.my_sequence.get_current_value()\n }\n\n pub fn next_sequence_value(&mut self) -> u32 {\n self.my_sequence.next_value()\n }\n\n pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.set(&inner_key, value);\n }\n\n pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.get(&inner_key)\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/74376d79.b8f4f9bf.js b/docs/assets/js/74376d79.b8f4f9bf.js new file mode 100644 index 000000000..0b27f35a3 --- /dev/null +++ b/docs/assets/js/74376d79.b8f4f9bf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29413],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},c),{},{components:t})):a.createElement(f,l({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={},l="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.3.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.3.0/advanced/02-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.3.0/advanced/delegate",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Module Composer",permalink:"/docs/0.3.0/advanced/composer"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.3.0/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n pub fn approve(&mut self, spender: Address, amount: U256);\n pub fn name(&self) -> String;\n pub fn symbol(&self) -> String;\n pub fn decimals(&self) -> u8;\n pub fn total_supply(&self) -> U256;\n pub fn balance_of(&self, owner: Address) -> U256;\n pub fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n pub fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: Ownable,\n erc20: Erc20,\n exchange: Exchange\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n pub fn swap(&mut self, sender: Address, recipient: Address);\n pub fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/74442e8e.a86d067e.js b/docs/assets/js/74442e8e.a86d067e.js new file mode 100644 index 000000000..68f1529a4 --- /dev/null +++ b/docs/assets/js/74442e8e.a86d067e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[82761],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.3.1/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.3.1/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.3.1/examples/using-odra-modules",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.3.1/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.3.1/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.1/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = { path = "../core", default-features = false }\nodra-modules = { path = "../modules", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]\ncasper = ["odra/casper", "odra-modules/casper"]\n')),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules")," defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," feature in your project, add ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules/casper"),"specifically (it applies to each backend).")),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::types::{Address, U256};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main Odra repository.")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7457cffc.2c0275c2.js b/docs/assets/js/7457cffc.2c0275c2.js new file mode 100644 index 000000000..d11c1747e --- /dev/null +++ b/docs/assets/js/7457cffc.2c0275c2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[3675],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),p=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=r,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(f,s(s({ref:n},c),{},{components:t})):a.createElement(f,s({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,s=new Array(o);s[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:3},s="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.7.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.7.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.7.0/tutorials/erc20",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.7.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.7.0/tutorials/owned-token"}},i={},p=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"erc-20"},"ERC-20"),(0,r.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,r.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value. "),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"advanced storage - key-value pairs, "),(0,r.kt)("li",{parentName:"ul"},"Odra types like ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),", "),(0,r.kt)("li",{parentName:"ul"},"advanced events assertion.")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Our module has a pretty complex storage layout in comparison to the previous example."),(0,r.kt)("p",null,"We need to store the following data:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol and decimals."),(0,r.kt)("li",{parentName:"ol"},"Total supply."),(0,r.kt)("li",{parentName:"ol"},"Users' balances."),(0,r.kt)("li",{parentName:"ol"},"Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.")),(0,r.kt)("h2",{id:"module-definition"},"Module definition"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,r.kt)("inlineCode",{parentName:"li"},"mapping"),". You may notice the ",(0,r.kt)("inlineCode",{parentName:"li"},"balances")," property maps ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," to ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),". If you deal with addresses or you operate on tokens, you should always choose ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," over ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Odra allows nested ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),"s, what we utilize to store allowances.")),(0,r.kt)("h3",{id:"metadata"},"Metadata"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.balances.add(address, *amount);\n self.total_supply.add(amount);\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: Balance\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3-L10")," - A constructor sets the token metadata and mints the initial supply."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12-L14")," - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," example, we used the ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returning an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function and the contract does not fail even if the value is not initialized."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29")," - The second ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," is not an odra module, in other words these function will not be a part of contract's ABI."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30-L39")," - Mint function is public, so like in a regular rust code will be accessible from the outside. ",(0,r.kt)("inlineCode",{parentName:"li"},"mint()")," use notation ",(0,r.kt)("inlineCode",{parentName:"li"},"self.balances.add(&address, amount);"),", which it is syntactic sugar for:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let current_balance = self.balances.get(&address).unwrap_or_default();\nlet new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();\nself.balances.set(&address, new_balance);\n")),(0,r.kt)("h3",{id:"core"},"Core"),(0,r.kt)("p",null,"For the sake of completeness, let's implement the remaining functionalities like ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_from"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"approve"),". They are not introducing any new concepts, so we leave them without additional remarks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs",title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let spender = contract_env::caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n let owner = contract_env::caller();\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n contract_env::revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .get_instance(owner)\n .set(spender, new_allowance);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,r.kt)("p",null,"Now, compare the code we have written, with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};\n use odra::{assert_events, test_env, types::U256};\n\n pub const NAME: &str = "Plascoin";\n pub const SYMBOL: &str = "PLS";\n pub const DECIMALS: u8 = 10;\n pub const INITIAL_SUPPLY: u32 = 10_000;\n\n pub fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n String::from(NAME),\n String::from(SYMBOL),\n DECIMALS,\n INITIAL_SUPPLY.into()\n )\n }\n\n #[test]\n fn initialization() {\n let erc20 = setup();\n\n assert_eq!(&erc20.symbol(), SYMBOL);\n assert_eq!(&erc20.name(), NAME);\n assert_eq!(erc20.decimals(), DECIMALS);\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n let mut erc20 = setup();\n let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n erc20.transfer(&recipient, &amount);\n\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n assert_eq!(erc20.balance_of(&recipient), amount);\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n let mut erc20 = setup();\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);\n\n test_env::assert_exception(Error::InsufficientBalance, || {\n erc20.transfer(&recipient, &amount)\n });\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let mut erc20 = setup();\n let (owner, recipient, spender) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount\n }\n );\n\n // Spender transfers tokens from Owner to Recipient.\n test_env::set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n );\n \n assert_events!(erc20, Approval, Transfer);\n }\n\n #[test]\n fn transfer_from_error() {\n let mut erc20 = setup();\n let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n test_env::set_caller(spender);\n test_env::assert_exception(Error::InsufficientAllowance, || {\n erc20.transfer_from(&owner, &spender, &amount)\n });\n }\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L111-123")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events!()")," macro accepts multiple events. You must pass them in the order they were emitted. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L125")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"You can not mix both approaches, you pass full events or types only.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"Having two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/748fd4ff.70dfb286.js b/docs/assets/js/748fd4ff.70dfb286.js new file mode 100644 index 000000000..ced13a564 --- /dev/null +++ b/docs/assets/js/748fd4ff.70dfb286.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[78743],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,y=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={},o="Storage Layout",s={unversionedId:"advanced/storage-layout",id:"version-0.9.0/advanced/storage-layout",title:"Storage Layout",description:"Odra's innovative modular design necessitates a unique storage layout. This",source:"@site/versioned_docs/version-0.9.0/advanced/04-storage-layout.md",sourceDirName:"advanced",slug:"/advanced/storage-layout",permalink:"/docs/0.9.0/advanced/storage-layout",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/0.9.0/advanced/attributes"},next:{title:"Memory allocators",permalink:"/docs/0.9.0/advanced/using-different-allocator"}},l={},d=[{value:"Casper VM Perspective",id:"casper-vm-perspective",level:2},{value:"Odra Perspective",id:"odra-perspective",level:2},{value:"Key generation.",id:"key-generation",level:2},{value:"Value serialization",id:"value-serialization",level:2}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"Odra's innovative modular design necessitates a unique storage layout. This\narticle explains step-by-step Odra's storage layout."),(0,r.kt)("h2",{id:"casper-vm-perspective"},"Casper VM Perspective"),(0,r.kt)("p",null,"The Casper Execution Engine (VM) enables the storage of data in named keys or\ndictionaries. However, a smart contract has a limited number of named keys,\nmaking it unsuitable for storing substantial data volumes. Odra resolves this\nissue by storing all user-generated data in a dictionary called ",(0,r.kt)("inlineCode",{parentName:"p"},"state"),". This\ndictionary operates as a key-value store, where keys are strings with a maximum\nlength of 64 characters, and values are arbitrary byte arrays."),(0,r.kt)("p",null,"Here is an example of what the interface for reading and writing data could look\nlike:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait CasperStorage {\n fn read(key: &str) -> Option>;\n fn write(key: &str, value: Vec);\n}\n")),(0,r.kt)("h2",{id:"odra-perspective"},"Odra Perspective"),(0,r.kt)("p",null,"Odra was conceived with modularity and code reusability in mind. Additionally,\nwe aimed to streamline storage definition through the struct object. Consider\nthis straightforward storage definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Token {\n name: Var,\n balances: Mapping\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," structure contains two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"name")," of type ",(0,r.kt)("inlineCode",{parentName:"p"},"String")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"balances"),", which functions as a key-value store with ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," as keys and\n",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," as values."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module can be reused in another module, as demonstrated in a more\ncomplex example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Loans {\n lenders: SubModule,\n borrowers: SubModule,\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," module has two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers"),", both of which have\nthe same storage layout as defined by the ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module. Odra guarantees that\n",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers")," are stored under distinct keys within the storage\ndictionary."),(0,r.kt)("p",null,"Both ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," serve as examples to show how Odra's storage layout\noperates."),(0,r.kt)("h2",{id:"key-generation"},"Key generation."),(0,r.kt)("p",null,"Every element of a module (",(0,r.kt)("inlineCode",{parentName:"p"},"struct"),") with N elements is associated with an index\nranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an\nelement of a module is another module (",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<...>"),"), the associated index\nserves as a prefix for the indexes of the inner module."),(0,r.kt)("p",null,"While this may initially appear complex, it is easily understood through an\nexample. In the example, indexes are presented as bytes, reflecting the actual\nimplementation."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Loans {\n lenders: Token { // prefix: 0x0000\n name: 0, // key: 0x0000_0000\n balances: 1 // key: 0x0000_0001\n },\n borrowers: Token { // prefix: 0x0001\n name: 0, // key: 0x0001_0000\n balances: 1 // key: 0x0001_0001\n }\n}\n")),(0,r.kt)("p",null,"Additionally, it's worth mentioning how ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"'s keys are used in the\n",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),". They are simply concatenated with the index of the module, as\ndemonstrated in the example."),(0,r.kt)("p",null,"For instance, triggering ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers.balances.get(0x1234abcd)")," would result in a\nkey:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"0x0001_0001_1234_abcd\n")),(0,r.kt)("p",null,"Finally, the key must be hashed to fit within the 64-character limit and then\nencoded in hexadecimal format."),(0,r.kt)("h2",{id:"value-serialization"},"Value serialization"),(0,r.kt)("p",null,"Before being stored in the storage, each value is serialized into bytes using\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," serialization method and subsequently encapsulated with Casper's\n",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," types."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/74ec7413.cc73bf48.js b/docs/assets/js/74ec7413.cc73bf48.js new file mode 100644 index 000000000..3332f1b33 --- /dev/null +++ b/docs/assets/js/74ec7413.cc73bf48.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[66746],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),d=r,g=u["".concat(c,".").concat(d)]||u[d]||m[d]||o;return n?a.createElement(g,i(i({ref:t},p),{},{components:n})):a.createElement(g,i({ref:t},p))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Building contracts manually",l={unversionedId:"advanced/building-manually",id:"version-0.9.0/advanced/building-manually",title:"Building contracts manually",description:"cargo odra is a great tool to build and test your contracts, but sometimes",source:"@site/versioned_docs/version-0.9.0/advanced/06-building-manually.md",sourceDirName:"advanced",slug:"/advanced/building-manually",permalink:"/docs/0.9.0/advanced/building-manually",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:6,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Memory allocators",permalink:"/docs/0.9.0/advanced/using-different-allocator"},next:{title:"Backends",permalink:"/docs/0.9.0/category/backends"}},c={},s=[{value:"Building the contract manually",id:"building-the-contract-manually",level:2},{value:"Optimizing the contract",id:"optimizing-the-contract",level:2},{value:"Running the tests manually",id:"running-the-tests-manually",level:2},{value:"Wrapping up",id:"wrapping-up",level:2}],p={toc:s};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"building-contracts-manually"},"Building contracts manually"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a great tool to build and test your contracts, but sometimes\na better control over the parameters that are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),"\nor the compiler is needed. "),(0,r.kt)("p",null,"This is especially useful when the project has multiple features, and there is a need\nto switch between them during the building and testing."),(0,r.kt)("p",null,"Knowing that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a simple wrapper around ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),", it is easy to replicate\nthe same behavior by using ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo")," directly."),(0,r.kt)("h2",{id:"building-the-contract-manually"},"Building the contract manually"),(0,r.kt)("p",null,"To build the contract manually, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Odra uses the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"ODRA_MODULE")," to determine which contract to build.")),(0,r.kt)("p",null,"Assuming that project's crate is named ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),", this command will build\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," contract in release mode and generate the wasm file.\nThe file will be put into the ",(0,r.kt)("inlineCode",{parentName:"p"},"target/wasm32-unknown-unknown/release")," directory under\nthe name ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project_build_contract.wasm"),"."),(0,r.kt)("p",null,"The Odra Framework expects the contracts to be placed in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory, and\nto be named correctly, so the next step would be to move the file:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm\n")),(0,r.kt)("h2",{id:"optimizing-the-contract"},"Optimizing the contract"),(0,r.kt)("p",null,"To lower the size of the wasm file, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-strip")," tool:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-strip wasm/my_contract.wasm\n")),(0,r.kt)("p",null,"To further optimize the wasm file, the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-opt")," tool is also used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"This step is required, as the wasm file generated by the Rust compiler is not\nfully compatible with the Casper execution engine.")),(0,r.kt)("h2",{id:"running-the-tests-manually"},"Running the tests manually"),(0,r.kt)("p",null,"To run the tests manually, Odra needs to know which backend to use.\nTo run tests agains Casper backend, the following command needs to be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_BACKEND=casper cargo test\n")),(0,r.kt)("h2",{id:"wrapping-up"},"Wrapping up"),(0,r.kt)("p",null,"Let's say we want to build the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," in debug mode, run the tests against the\ncasper backend and use the ",(0,r.kt)("inlineCode",{parentName:"p"},"my-own-allocator")," feature from our ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," project."),(0,r.kt)("p",null,"To do that, we can use the following set of commands:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract\nmv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm\nwasm-strip wasm/my_contract.wasm\nwasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\nODRA_BACKEND=casper cargo test --features my-own-allocator\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7546c635.e8e5f267.js b/docs/assets/js/7546c635.e8e5f267.js new file mode 100644 index 000000000..58178c84c --- /dev/null +++ b/docs/assets/js/7546c635.e8e5f267.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[64733],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),d=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=d(n),f=a,m=p["".concat(c,".").concat(f)]||p[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={},l="Memory allocators",i={unversionedId:"advanced/using-different-allocator",id:"version-0.9.1/advanced/using-different-allocator",title:"Memory allocators",description:"When compiling contracts to wasm, your code needs to be no-std.",source:"@site/versioned_docs/version-0.9.1/advanced/05-using-different-allocator.md",sourceDirName:"advanced",slug:"/advanced/using-different-allocator",permalink:"/docs/0.9.1/advanced/using-different-allocator",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Storage Layout",permalink:"/docs/0.9.1/advanced/storage-layout"},next:{title:"Building contracts manually",permalink:"/docs/0.9.1/advanced/building-manually"}},c={},d=[{value:"Using a different allocator",id:"using-a-different-allocator",level:2}],s={toc:d};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"memory-allocators"},"Memory allocators"),(0,a.kt)("p",null,"When compiling contracts to wasm, your code needs to be ",(0,a.kt)("inlineCode",{parentName:"p"},"no-std"),".\nThis means that instead of using the standard library, the ",(0,a.kt)("inlineCode",{parentName:"p"},"core"),"\ncrate will be linked to your code. This crate does not contain\na memory allocator."),(0,a.kt)("p",null,"Happily, Odra automatically enables allocator - from our tests\nthe one developed by ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/ink_allocator/latest/ink_allocator/"},"ink!"),"\nseems to be the best."),(0,a.kt)("h2",{id:"using-a-different-allocator"},"Using a different allocator"),(0,a.kt)("p",null,"If the default allocator does not suit your needs, or you use a crate that\nalready provides an allocator, you can disable the default allocator by enabling\nthe ",(0,a.kt)("inlineCode",{parentName:"p"},"disable-allocator")," feature in the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra")," dependency in your project:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[dependencies]\nodra = { path = "../odra", features = ["disable-allocator"] }\n')),(0,a.kt)("p",null,"If you want to have a better control over the features that are enabled\nduring the building and tests, see the next article on ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.1/advanced/building-manually"},"building manually"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/754937b2.8f524e65.js b/docs/assets/js/754937b2.8f524e65.js new file mode 100644 index 000000000..5533737a4 --- /dev/null +++ b/docs/assets/js/754937b2.8f524e65.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[23308],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,a=new Array(s);a[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const s={sidebar_position:11,description:"Divide your code into modules"},a="Modules",i={unversionedId:"basics/modules",id:"version-0.4.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.4.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.4.0/basics/modules",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.4.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.4.0/basics/native-token"}},l={},c=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to a macro ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),'. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use crate::docs::cross_calls::MathEngine;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: MathEngine,\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use super::ModulesContractDeployer;\n\n#[test]\nfn test_modules() {\n let modules_contract = ModulesContractDeployer::default();\n assert_eq!(modules_contract.add_using_module(), 8);\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/75ab3d8c.b31148ea.js b/docs/assets/js/75ab3d8c.b31148ea.js new file mode 100644 index 000000000..125788686 --- /dev/null +++ b/docs/assets/js/75ab3d8c.b31148ea.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[89854],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),d=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=d(n),f=a,m=p["".concat(c,".").concat(f)]||p[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={},l="Memory allocators",i={unversionedId:"advanced/using-different-allocator",id:"version-0.8.1/advanced/using-different-allocator",title:"Memory allocators",description:"When compiling contracts to wasm, your code needs to be no-std.",source:"@site/versioned_docs/version-0.8.1/advanced/05-using-different-allocator.md",sourceDirName:"advanced",slug:"/advanced/using-different-allocator",permalink:"/docs/0.8.1/advanced/using-different-allocator",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Storage Layout",permalink:"/docs/0.8.1/advanced/storage-layout"},next:{title:"Building contracts manually",permalink:"/docs/0.8.1/advanced/building-manually"}},c={},d=[{value:"Using a different allocator",id:"using-a-different-allocator",level:2}],s={toc:d};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"memory-allocators"},"Memory allocators"),(0,a.kt)("p",null,"When compiling contracts to wasm, your code needs to be ",(0,a.kt)("inlineCode",{parentName:"p"},"no-std"),".\nThis means that instead of using the standard library, the ",(0,a.kt)("inlineCode",{parentName:"p"},"core"),"\ncrate will be linked to your code. This crate does not contain\na memory allocator."),(0,a.kt)("p",null,"Happily, Odra automatically enables allocator - from our tests\nthe one developed by ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/ink_allocator/latest/ink_allocator/"},"ink!"),"\nseems to be the best."),(0,a.kt)("h2",{id:"using-a-different-allocator"},"Using a different allocator"),(0,a.kt)("p",null,"If the default allocator does not suit your needs, or you use a crate that\nalready provides an allocator, you can disable the default allocator by enabling\nthe ",(0,a.kt)("inlineCode",{parentName:"p"},"disable-allocator")," feature in the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra")," dependency in your project:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[dependencies]\nodra = { path = "../odra", features = ["disable-allocator"] }\n')),(0,a.kt)("p",null,"If you want to have a better control over the features that are enabled\nduring the building and tests, see the next article on ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.1/advanced/building-manually"},"building manually"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/76b68520.50e92bed.js b/docs/assets/js/76b68520.50e92bed.js new file mode 100644 index 000000000..c0547bad0 --- /dev/null +++ b/docs/assets/js/76b68520.50e92bed.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99122],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,y=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={},o="Storage Layout",s={unversionedId:"advanced/storage-layout",id:"version-0.9.1/advanced/storage-layout",title:"Storage Layout",description:"Odra's innovative modular design necessitates a unique storage layout. This",source:"@site/versioned_docs/version-0.9.1/advanced/04-storage-layout.md",sourceDirName:"advanced",slug:"/advanced/storage-layout",permalink:"/docs/0.9.1/advanced/storage-layout",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/0.9.1/advanced/attributes"},next:{title:"Memory allocators",permalink:"/docs/0.9.1/advanced/using-different-allocator"}},l={},d=[{value:"Casper VM Perspective",id:"casper-vm-perspective",level:2},{value:"Odra Perspective",id:"odra-perspective",level:2},{value:"Key generation.",id:"key-generation",level:2},{value:"Value serialization",id:"value-serialization",level:2}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"Odra's innovative modular design necessitates a unique storage layout. This\narticle explains step-by-step Odra's storage layout."),(0,r.kt)("h2",{id:"casper-vm-perspective"},"Casper VM Perspective"),(0,r.kt)("p",null,"The Casper Execution Engine (VM) enables the storage of data in named keys or\ndictionaries. However, a smart contract has a limited number of named keys,\nmaking it unsuitable for storing substantial data volumes. Odra resolves this\nissue by storing all user-generated data in a dictionary called ",(0,r.kt)("inlineCode",{parentName:"p"},"state"),". This\ndictionary operates as a key-value store, where keys are strings with a maximum\nlength of 64 characters, and values are arbitrary byte arrays."),(0,r.kt)("p",null,"Here is an example of what the interface for reading and writing data could look\nlike:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait CasperStorage {\n fn read(key: &str) -> Option>;\n fn write(key: &str, value: Vec);\n}\n")),(0,r.kt)("h2",{id:"odra-perspective"},"Odra Perspective"),(0,r.kt)("p",null,"Odra was conceived with modularity and code reusability in mind. Additionally,\nwe aimed to streamline storage definition through the struct object. Consider\nthis straightforward storage definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Token {\n name: Var,\n balances: Mapping\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," structure contains two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"name")," of type ",(0,r.kt)("inlineCode",{parentName:"p"},"String")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"balances"),", which functions as a key-value store with ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," as keys and\n",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," as values."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module can be reused in another module, as demonstrated in a more\ncomplex example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Loans {\n lenders: SubModule,\n borrowers: SubModule,\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," module has two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers"),", both of which have\nthe same storage layout as defined by the ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module. Odra guarantees that\n",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers")," are stored under distinct keys within the storage\ndictionary."),(0,r.kt)("p",null,"Both ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," serve as examples to show how Odra's storage layout\noperates."),(0,r.kt)("h2",{id:"key-generation"},"Key generation."),(0,r.kt)("p",null,"Every element of a module (",(0,r.kt)("inlineCode",{parentName:"p"},"struct"),") with N elements is associated with an index\nranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an\nelement of a module is another module (",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<...>"),"), the associated index\nserves as a prefix for the indexes of the inner module."),(0,r.kt)("p",null,"While this may initially appear complex, it is easily understood through an\nexample. In the example, indexes are presented as bytes, reflecting the actual\nimplementation."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Loans {\n lenders: Token { // prefix: 0x0000\n name: 0, // key: 0x0000_0000\n balances: 1 // key: 0x0000_0001\n },\n borrowers: Token { // prefix: 0x0001\n name: 0, // key: 0x0001_0000\n balances: 1 // key: 0x0001_0001\n }\n}\n")),(0,r.kt)("p",null,"Additionally, it's worth mentioning how ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"'s keys are used in the\n",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),". They are simply concatenated with the index of the module, as\ndemonstrated in the example."),(0,r.kt)("p",null,"For instance, triggering ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers.balances.get(0x1234abcd)")," would result in a\nkey:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"0x0001_0001_1234_abcd\n")),(0,r.kt)("p",null,"Finally, the key must be hashed to fit within the 64-character limit and then\nencoded in hexadecimal format."),(0,r.kt)("h2",{id:"value-serialization"},"Value serialization"),(0,r.kt)("p",null,"Before being stored in the storage, each value is serialized into bytes using\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," serialization method and subsequently encapsulated with Casper's\n",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," types."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/77193147.177b697d.js b/docs/assets/js/77193147.177b697d.js new file mode 100644 index 000000000..e394509a3 --- /dev/null +++ b/docs/assets/js/77193147.177b697d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[50327],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.8.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.8.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.8.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.8.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.8.0/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = "0.8.0"\nodra-modules = "0.8.0"\n')),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::prelude::*;\nuse odra::{Address, casper_types::U256, module::SubModule};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra repository"),".")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/78452797.61fa9cf5.js b/docs/assets/js/78452797.61fa9cf5.js new file mode 100644 index 000000000..fd571b3c5 --- /dev/null +++ b/docs/assets/js/78452797.61fa9cf5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46100],{89199:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.3.1/category/examples","navigation":{"previous":{"title":"Casper","permalink":"/docs/0.3.1/backends/casper"},"next":{"title":"odra-examples","permalink":"/docs/0.3.1/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/786408bf.28769d3b.js b/docs/assets/js/786408bf.28769d3b.js new file mode 100644 index 000000000..8d2a5b35d --- /dev/null +++ b/docs/assets/js/786408bf.28769d3b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83441],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:11,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.9.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.9.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.9.0/basics/cross-calls",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Casper Contract Schema",permalink:"/docs/0.9.0/basics/casper-contract-schema"},next:{title:"Modules",permalink:"/docs/0.9.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Loading the contract",id:"loading-the-contract",level:3},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::prelude::*;\nuse odra::{Address, UnwrapOrRevert, Var};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Var
\n}\n\n#[odra::module]\nimpl CrossContract {\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());\n MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine;\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To perform a cross-contact call, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"HostRef")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/testing"},"Testing")," article - a host side reference to already deployed contract."),(0,r.kt)("p",null,"In the module context we use a ",(0,r.kt)("inlineCode",{parentName:"p"},"ContractRef")," instead, to call other contracts."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," is generated automatically,\nby the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("p",null,"To obtain an instance of a contract reference, we simply call the constructor - ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env: Rc, address: Address)"),", as shown above."),(0,r.kt)("p",null,"The reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), and the ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::address()")," function, which returns the address of the contract."),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderContractRef")," struct (and ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderHostRef")," to be used in tests, but do not implement the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer")," trait). Having an address, in the module context we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"AdderContractRef::new(self.env(), address).add(3, 5)\n")),(0,r.kt)("h3",{id:"loading-the-contract"},"Loading the contract"),(0,r.kt)("p",null,"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test\nour contracts in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/backends/livenet"},"Livenet")," backend. We can load the contract using ",(0,r.kt)("inlineCode",{parentName:"p"},"load")," method on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/bin/erc20_on_livenet.rs"',title:'"examples/bin/erc20_on_livenet.rs"'},'fn _load(env: &HostEnv) -> Erc20HostRef {\n let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n let address = Address::from_str(address).unwrap();\n ::load(env, address)\n}\n')),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};\n use odra::host::{Deployer, HostRef, NoArgs};\n\n #[test]\n fn test_cross_calls() {\n let test_env = odra_test::env();\n let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);\n let cross_contract = CrossContractHostRef::deploy(\n &test_env,\n CrossContractInitArgs {\n math_engine_address: *math_engine_contract.address()\n }\n );\n assert_eq!(cross_contract.add_using_another(), 8);\n }\n}\n")),(0,r.kt)("p",null,"Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that we intend to utilize."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{Address, host::{Deployer, HostRef, NoArgs}};\n \n #[test]\n fn test_ext() {\n let test_env = odra_test::env();\n let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address(test_env: &HostEnv) -> Address {\n let contract = MathEngineHostRef::deploy(test_env, NoArgs);\n *contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/79253424.035754eb.js b/docs/assets/js/79253424.035754eb.js new file mode 100644 index 000000000..7e088915c --- /dev/null +++ b/docs/assets/js/79253424.035754eb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[36571],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>c});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(a),c=r,f=m["".concat(l,".").concat(c)]||m[c]||d[c]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/docs/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/next/basics/storage-interaction",draft:!1,tags:[],version:"current",lastUpdatedAt:1716209688,formattedLastUpdatedAt:"May 20, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/next/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/next/basics/communicating-with-host"}},l={},p=[{value:"Var",id:"var",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"var"},"Var"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::prelude::*;\nuse odra::Var;\n\n#[odra::module]\npub struct DogContract {\n barks: Var,\n weight: Var,\n name: Var,\n walks: Var>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\nimpl DogContract {\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is used to store and access data as key-value pairs. To define a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::prelude::*;\nuse odra::{Mapping, Var};\n\n#[odra::module]\npub struct DogContract2 {\n name: Var,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," we use a similar approach\nto the one shown in the Vars section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Var working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{List, Var};\n\npub struct List {\n values: Mapping,\n index: Var\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"use odra::{prelude::*, List, Var};\n\n#[odra::module]\npub struct DogContract3 {\n name: Var,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the Odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/features/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must add ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. Let's see how to implement a ",(0,r.kt)("inlineCode",{parentName:"p"},"Dog")," type: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"#[odra_type]")," is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type.\n",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," of a custom type is ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType::Any"),", except for an unit-only enum, which is ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType::U8"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="unit_only_enum.rs"',title:'"unit_only_enum.rs"'},"enum Enum {\n Foo = 3,\n Bar = 2,\n Baz = 1,\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each custom typed field of your struct must be marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute .")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7933b4e2.e06c6ca6.js b/docs/assets/js/7933b4e2.e06c6ca6.js new file mode 100644 index 000000000..b3641d17b --- /dev/null +++ b/docs/assets/js/7933b4e2.e06c6ca6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99604],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),d=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=d(n),f=a,m=p["".concat(c,".").concat(f)]||p[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={},l="Memory allocators",i={unversionedId:"advanced/using-different-allocator",id:"version-0.9.0/advanced/using-different-allocator",title:"Memory allocators",description:"When compiling contracts to wasm, your code needs to be no-std.",source:"@site/versioned_docs/version-0.9.0/advanced/05-using-different-allocator.md",sourceDirName:"advanced",slug:"/advanced/using-different-allocator",permalink:"/docs/0.9.0/advanced/using-different-allocator",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Storage Layout",permalink:"/docs/0.9.0/advanced/storage-layout"},next:{title:"Building contracts manually",permalink:"/docs/0.9.0/advanced/building-manually"}},c={},d=[{value:"Using a different allocator",id:"using-a-different-allocator",level:2}],s={toc:d};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"memory-allocators"},"Memory allocators"),(0,a.kt)("p",null,"When compiling contracts to wasm, your code needs to be ",(0,a.kt)("inlineCode",{parentName:"p"},"no-std"),".\nThis means that instead of using the standard library, the ",(0,a.kt)("inlineCode",{parentName:"p"},"core"),"\ncrate will be linked to your code. This crate does not contain\na memory allocator."),(0,a.kt)("p",null,"Happily, Odra automatically enables allocator - from our tests\nthe one developed by ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/ink_allocator/latest/ink_allocator/"},"ink!"),"\nseems to be the best."),(0,a.kt)("h2",{id:"using-a-different-allocator"},"Using a different allocator"),(0,a.kt)("p",null,"If the default allocator does not suit your needs, or you use a crate that\nalready provides an allocator, you can disable the default allocator by enabling\nthe ",(0,a.kt)("inlineCode",{parentName:"p"},"disable-allocator")," feature in the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra")," dependency in your project:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[dependencies]\nodra = { path = "../odra", features = ["disable-allocator"] }\n')),(0,a.kt)("p",null,"If you want to have a better control over the features that are enabled\nduring the building and tests, see the next article on ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.0/advanced/building-manually"},"building manually"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/794d4fad.5dc128ca.js b/docs/assets/js/794d4fad.5dc128ca.js new file mode 100644 index 000000000..876865953 --- /dev/null +++ b/docs/assets/js/794d4fad.5dc128ca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95555],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},i="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.8.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.8.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.8.0/basics/flipper-internals",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1711379330,formattedLastUpdatedAt:"Mar 25, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.8.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.8.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Var;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Var,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Var")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the attribute - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The function named ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," is the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," function is optional,\nif your contract does not need any initialization, you can skip it."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/trait.Deployer.html#tymethod.deploy"},(0,a.kt)("inlineCode",{parentName:"a"},"Deployer::deploy"))," function called on ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperHostRef")," - a piece of code generated\nby the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),". Because the module implements the constructor but does not accept any arguments,\nas the second argument of the deploy function, we pass ",(0,a.kt)("inlineCode",{parentName:"p"},"NoArgs")," - one of the implementations of\nthe ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/trait.InitArgs.html"},(0,a.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait provided with the framework. "),(0,a.kt)("p",null,"The contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/799b1c68.774a06c2.js b/docs/assets/js/799b1c68.774a06c2.js new file mode 100644 index 000000000..f8cc9952a --- /dev/null +++ b/docs/assets/js/799b1c68.774a06c2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[65657],{47790:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.2.0","label":"0.2.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.2.0","isLast":false,"docsSidebars":{"defaultSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.2.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.2.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.2.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.2.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.2.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.2.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.2.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.2.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.2.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.2.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.2.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.2.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.2.0/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.2.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.2.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.2.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.2.0/category/basics"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.2.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"MockVM","href":"/docs/0.2.0/backends/mock-vm","docId":"backends/mock-vm"},{"type":"link","label":"Casper","href":"/docs/0.2.0/backends/casper","docId":"backends/casper"}],"href":"/docs/0.2.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.2.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.2.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.2.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.2.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.2.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.2.0/tutorials/owned-token","docId":"tutorials/owned-token"}],"href":"/docs/0.2.0/category/tutorials"}]},"docs":{"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"defaultSidebar"},"backends/mock-vm":{"id":"backends/mock-vm","title":"MockVM","description":"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"defaultSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"defaultSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"defaultSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"defaultSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"defaultSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"defaultSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"defaultSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"defaultSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"defaultSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"defaultSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"defaultSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"defaultSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"defaultSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"defaultSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.","sidebar":"defaultSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"defaultSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"defaultSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"defaultSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"defaultSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"defaultSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"defaultSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"defaultSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/79b67993.487f8cc3.js b/docs/assets/js/79b67993.487f8cc3.js new file mode 100644 index 000000000..480370891 --- /dev/null +++ b/docs/assets/js/79b67993.487f8cc3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37798],{19217:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/next/category/examples","navigation":{"previous":{"title":"Livenet","permalink":"/docs/next/backends/livenet"},"next":{"title":"odra-examples","permalink":"/docs/next/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/79d3180c.3bc62d83.js b/docs/assets/js/79d3180c.3bc62d83.js new file mode 100644 index 000000000..a2cf8a7bb --- /dev/null +++ b/docs/assets/js/79d3180c.3bc62d83.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[9375],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=p(n),d=a,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",i={unversionedId:"getting-started/flipper",id:"version-0.7.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.7.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.7.0/getting-started/flipper",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.7.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.7.0/category/basics"}},s={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.7.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Variable;\n\n/// A module definition. Each module struct consists Variables and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Variable,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let mut contract1 = FlipperDeployer::initial_settings();\n let contract2 = FlipperDeployer::initial_settings();\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7acce579.86722aa3.js b/docs/assets/js/7acce579.86722aa3.js new file mode 100644 index 000000000..6cc14a65f --- /dev/null +++ b/docs/assets/js/7acce579.86722aa3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33158],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"version-0.4.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.4.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.4.0/basics/cargo-odra",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.4.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.4.0/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Updating dependencies",id:"updating-dependencies",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them on multiple backends (blockchains)."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands will help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This will create a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it will create a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This will create a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It will run your tests against Odra's MockVM. It is substantially faster than virtual machines\nprovided by blockchains developers and implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files,\nspin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat.\nKeep in mind that this is a lot slower than MockVM and you cannot use the debugger.\nThis is why MockVM was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("p",null,"Where ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," is the name of the backend we are using in this example. If the build process\nfinishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder."),(0,r.kt)("h2",{id:"updating-dependencies"},"Updating dependencies"),(0,r.kt)("p",null,"You will learn later, that the project using Odra contains more than one Rust project - your own and\none or more builders. To run ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo update")," on all of them at once instead of traversing all the folders\nyou can use this command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra update\n")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7c233f44.b837d5ab.js b/docs/assets/js/7c233f44.b837d5ab.js new file mode 100644 index 000000000..ac0b2a330 --- /dev/null +++ b/docs/assets/js/7c233f44.b837d5ab.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[7011],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),u=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=u(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},d),{},{components:t})):r.createElement(f,o({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var u=2;u{t.d(n,{Z:()=>o});var r=t(67294),a=t(86010);const s="tabItem_Ymn6";function o(e){let{children:n,hidden:t,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(s,o),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>_});var r=t(87462),a=t(67294),s=t(86010),o=t(12466),l=t(16550),i=t(91980),u=t(67392),d=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,u.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),s=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(s),(0,a.useCallback)((e=>{if(!s)return;const n=new URLSearchParams(r.location.search);n.set(s,e),r.replace({...r.location,search:n.toString()})}),[s,r])]}function b(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,s=c(e),[o,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:s}))),[i,u]=f({queryString:t,groupId:r}),[p,b]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,s]=(0,d.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&s.set(e)}),[t,s])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:s})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),b(e)}),[u,b,s]),tabValues:s}}var g=t(72389);const v="tabList__CuJ",h="tabItem_LNqP";function y(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:u}=e;const d=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),c=e=>{const n=e.currentTarget,t=d.indexOf(n),r=u[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;n=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;n=d[t]??d[d.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":t},n)},u.map((e=>{let{value:n,label:t,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>d.push(e),onKeyDown:m,onClick:c},o,{className:(0,s.Z)("tabs__item",h,o?.className,{"tabs__item--active":l===n})}),t??n)})))}function w(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function k(e){const n=b(e);return a.createElement("div",{className:(0,s.Z)("tabs-container",v)},a.createElement(y,(0,r.Z)({},e,n)),a.createElement(w,(0,r.Z)({},e,n)))}function _(e){const n=(0,g.Z)();return a.createElement(k,(0,r.Z)({key:String(n)},e))}},87736:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),s=t(74866),o=t(85162);const l={sidebar_position:2,description:"Migration guide to v0.9.0"},i="Migration guide to v0.9.0",u={unversionedId:"migrations/to-0.9.0",id:"version-1.0.0/migrations/to-0.9.0",title:"Migration guide to v0.9.0",description:"Migration guide to v0.9.0",source:"@site/versioned_docs/version-1.0.0/migrations/to-0.9.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.9.0",permalink:"/docs/migrations/to-0.9.0",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Migration guide to v0.9.0"},sidebar:"tutorialSidebar",previous:{title:"Migration guide to v0.8.0",permalink:"/docs/migrations/to-0.8.0"}},d={},p=[{value:"1. Prerequisites",id:"1-prerequisites",level:2},{value:"1.1. Update cargo-odra",id:"11-update-cargo-odra",level:3},{value:"1.2. Review the Changelog",id:"12-review-the-changelog",level:3},{value:"2. Migration Steps",id:"2-migration-steps",level:2},{value:"2.1 Update build_schema.rs bin",id:"21-update-build_schemars-bin",level:3},{value:"2.2 Update smart contract code",id:"22-update-smart-contract-code",level:3},{value:"2.2.1. Update custom types definitions.",id:"221-update-custom-types-definitions",level:4},{value:"2.2.2. Update errors definitions.",id:"222-update-errors-definitions",level:4},{value:"2.2.3. Update events definitions.",id:"223-update-events-definitions",level:4},{value:"3. Code Examples",id:"3-code-examples",level:2},{value:"4. Troubleshooting",id:"4-troubleshooting",level:2},{value:"5. References",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v090"},"Migration guide to v0.9.0"),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.7.1")," and below, start with the ",(0,a.kt)("a",{parentName:"p",href:"./to-0.8.0"},"previous guide"),". It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant change in ",(0,a.kt)("inlineCode",{parentName:"p"},"0.9.0")," is the way of defining custom elements namely type, events and errors."),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.9.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-update-build_schemars-bin"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Update build_schema.rs bin")),(0,a.kt)("p",null,"Odra 0.9.0 adds a new standardized way of generating contract schema - ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema"),". You can find the updated ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," file in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-smart-contract-code"},"2.2 ",(0,a.kt)("strong",{parentName:"h3"},"Update smart contract code")),(0,a.kt)("p",null,"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes."),(0,a.kt)("h4",{id:"221-update-custom-types-definitions"},"2.2.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update custom types definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraType)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")))),(0,a.kt)("h4",{id:"222-update-errors-definitions"},"2.2.2. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraError)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute.\nError enum should be passed as a parameter to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */], errors = Error)]\npub struct Erc20 {\n // fields\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */])]\npub struct Erc20 {\n // fields\n}\n\nuse odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n")))),(0,a.kt)("h4",{id:"223-update-events-definitions"},"2.2.3. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256};\n\n#[odra::event]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Event};\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.9.0."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer], errors = Error)]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address};\n\n #[odra::event]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[odra::event]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n #[odra::odra_error]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n")))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P9k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7c29795c.f16b488f.js b/docs/assets/js/7c29795c.f16b488f.js new file mode 100644 index 000000000..19305bdb1 --- /dev/null +++ b/docs/assets/js/7c29795c.f16b488f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46867],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>d});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),u=s(n),d=r,g=u["".concat(c,".").concat(d)]||u[d]||p[d]||o;return n?a.createElement(g,i(i({ref:t},m),{},{components:n})):a.createElement(g,i({ref:t},m))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Building contracts manually",l={unversionedId:"advanced/building-manually",id:"advanced/building-manually",title:"Building contracts manually",description:"cargo odra is a great tool to build and test your contracts, but sometimes",source:"@site/docs/advanced/06-building-manually.md",sourceDirName:"advanced",slug:"/advanced/building-manually",permalink:"/docs/next/advanced/building-manually",draft:!1,tags:[],version:"current",lastUpdatedAt:1716209688,formattedLastUpdatedAt:"May 20, 2024",sidebarPosition:6,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Memory allocators",permalink:"/docs/next/advanced/using-different-allocator"},next:{title:"Backends",permalink:"/docs/next/category/backends"}},c={},s=[{value:"Building the contract manually",id:"building-the-contract-manually",level:2},{value:"Optimizing the contract",id:"optimizing-the-contract",level:2},{value:"Running the tests manually",id:"running-the-tests-manually",level:2},{value:"Wrapping up",id:"wrapping-up",level:2}],m={toc:s};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"building-contracts-manually"},"Building contracts manually"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a great tool to build and test your contracts, but sometimes\na better control over the parameters that are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),"\nor the compiler is needed. "),(0,r.kt)("p",null,"This is especially useful when the project has multiple features, and there is a need\nto switch between them during the building and testing."),(0,r.kt)("p",null,"Knowing that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a simple wrapper around ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),", it is easy to replicate\nthe same behavior by using ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo")," directly."),(0,r.kt)("h2",{id:"building-the-contract-manually"},"Building the contract manually"),(0,r.kt)("p",null,"To build the contract manually, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Odra uses the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"ODRA_MODULE")," to determine which contract to build.")),(0,r.kt)("p",null,"Assuming that project's crate is named ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),", this command will build\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," contract in release mode and generate the wasm file.\nThe file will be put into the ",(0,r.kt)("inlineCode",{parentName:"p"},"target/wasm32-unknown-unknown/release")," directory under\nthe name ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project_build_contract.wasm"),"."),(0,r.kt)("p",null,"The Odra Framework expects the contracts to be placed in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory, and\nto be named correctly, so the next step would be to move the file:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm\n")),(0,r.kt)("h2",{id:"optimizing-the-contract"},"Optimizing the contract"),(0,r.kt)("p",null,"To lower the size of the wasm file, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-strip")," tool:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-strip wasm/my_contract.wasm\n")),(0,r.kt)("p",null,"To further optimize the wasm file, the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-opt")," tool is also used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"This step is required, as the wasm file generated by the Rust compiler is not\nfully compatible with the Casper execution engine.")),(0,r.kt)("h2",{id:"running-the-tests-manually"},"Running the tests manually"),(0,r.kt)("p",null,"To run the tests manually, Odra needs to know which backend to use.\nTo run tests against Casper backend, the following command needs to be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_BACKEND=casper cargo test\n")),(0,r.kt)("h2",{id:"wrapping-up"},"Wrapping up"),(0,r.kt)("p",null,"Let's say we want to build the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," in debug mode, run the tests against the\ncasper backend and use the ",(0,r.kt)("inlineCode",{parentName:"p"},"my-own-allocator")," feature from our ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," project."),(0,r.kt)("p",null,"To do that, we can use the following set of commands:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract\nmv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm\nwasm-strip wasm/my_contract.wasm\nwasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\nODRA_BACKEND=casper cargo test --features my-own-allocator\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7cc7edf9.41260fae.js b/docs/assets/js/7cc7edf9.41260fae.js new file mode 100644 index 000000000..d53a0cfec --- /dev/null +++ b/docs/assets/js/7cc7edf9.41260fae.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[78212],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>c});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(a),c=r,f=d["".concat(l,".").concat(c)]||d[c]||m[c]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.9.1/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.9.1/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.9.1/basics/storage-interaction",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.9.1/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.9.1/basics/communicating-with-host"}},l={},p=[{value:"Var",id:"var",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"var"},"Var"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Var,\n weight: Var,\n name: Var,\n walks: Var>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::Var;\n\n#[odra::module]\nimpl DogContract {\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is used to store and access data as key-value pairs. To define a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{Mapping, Var};\n\n#[odra::module]\npub struct DogContract2 {\n name: Var,\n friends: Mapping,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," we use a similar approach\nto the one shown in the Vars section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Var working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{List, Var};\n\npub struct List {\n values: Mapping,\n index: Var\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Var,\n walks: List,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the Odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/features/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must add ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute. Let's see how to implement a ",(0,r.kt)("inlineCode",{parentName:"p"},"Dog")," type: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option
\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"#[odra_type]")," is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type.\n",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," of a custom type is ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType::Any"),", except for an unit-only enum, which is ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType::U8"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="unit_only_enum.rs"',title:'"unit_only_enum.rs"'},"enum Enum {\n Foo = 3,\n Bar = 2,\n Baz = 1,\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each custom typed field of your struct must be marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute .")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7cf5f48a.f0cb80d8.js b/docs/assets/js/7cf5f48a.f0cb80d8.js new file mode 100644 index 000000000..5ac1c23d6 --- /dev/null +++ b/docs/assets/js/7cf5f48a.f0cb80d8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[8068],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,y=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={},o="Storage Layout",s={unversionedId:"advanced/storage-layout",id:"version-0.8.1/advanced/storage-layout",title:"Storage Layout",description:"Odra's innovative modular design necessitates a unique storage layout. This",source:"@site/versioned_docs/version-0.8.1/advanced/04-storage-layout.md",sourceDirName:"advanced",slug:"/advanced/storage-layout",permalink:"/docs/0.8.1/advanced/storage-layout",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/0.8.1/advanced/attributes"},next:{title:"Memory allocators",permalink:"/docs/0.8.1/advanced/using-different-allocator"}},l={},d=[{value:"Casper VM Perspective",id:"casper-vm-perspective",level:2},{value:"Odra Perspective",id:"odra-perspective",level:2},{value:"Key generation.",id:"key-generation",level:2},{value:"Value serialization",id:"value-serialization",level:2}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"Odra's innovative modular design necessitates a unique storage layout. This\narticle explains step-by-step Odra's storage layout."),(0,r.kt)("h2",{id:"casper-vm-perspective"},"Casper VM Perspective"),(0,r.kt)("p",null,"The Casper Execution Engine (VM) enables the storage of data in named keys or\ndictionaries. However, a smart contract has a limited number of named keys,\nmaking it unsuitable for storing substantial data volumes. Odra resolves this\nissue by storing all user-generated data in a dictionary called ",(0,r.kt)("inlineCode",{parentName:"p"},"state"),". This\ndictionary operates as a key-value store, where keys are strings with a maximum\nlength of 64 characters, and values are arbitrary byte arrays."),(0,r.kt)("p",null,"Here is an example of what the interface for reading and writing data could look\nlike:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait CasperStorage {\n fn read(key: &str) -> Option>;\n fn write(key: &str, value: Vec);\n}\n")),(0,r.kt)("h2",{id:"odra-perspective"},"Odra Perspective"),(0,r.kt)("p",null,"Odra was conceived with modularity and code reusability in mind. Additionally,\nwe aimed to streamline storage definition through the struct object. Consider\nthis straightforward storage definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Token {\n name: Var,\n balances: Mapping\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," structure contains two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"name")," of type ",(0,r.kt)("inlineCode",{parentName:"p"},"String")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"balances"),", which functions as a key-value store with ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," as keys and\n",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," as values."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module can be reused in another module, as demonstrated in a more\ncomplex example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Loans {\n lenders: SubModule,\n borrowers: SubModule,\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," module has two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers"),", both of which have\nthe same storage layout as defined by the ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module. Odra guarantees that\n",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers")," are stored under distinct keys within the storage\ndictionary."),(0,r.kt)("p",null,"Both ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," serve as examples to show how Odra's storage layout\noperates."),(0,r.kt)("h2",{id:"key-generation"},"Key generation."),(0,r.kt)("p",null,"Every element of a module (",(0,r.kt)("inlineCode",{parentName:"p"},"struct"),") with N elements is associated with an index\nranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an\nelement of a module is another module (",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<...>"),"), the associated index\nserves as a prefix for the indexes of the inner module."),(0,r.kt)("p",null,"While this may initially appear complex, it is easily understood through an\nexample. In the example, indexes are presented as bytes, reflecting the actual\nimplementation."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Loans {\n lenders: Token { // prefix: 0x0000\n name: 0, // key: 0x0000_0000\n balances: 1 // key: 0x0000_0001\n },\n borrowers: Token { // prefix: 0x0001\n name: 0, // key: 0x0001_0000\n balances: 1 // key: 0x0001_0001\n }\n}\n")),(0,r.kt)("p",null,"Additionally, it's worth mentioning how ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"'s keys are used in the\n",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),". They are simply concatenated with the index of the module, as\ndemonstrated in the example."),(0,r.kt)("p",null,"For instance, triggering ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers.balances.get(0x1234abcd)")," would result in a\nkey:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"0x0001_0001_1234_abcd\n")),(0,r.kt)("p",null,"Finally, the key must be hashed to fit within the 64-character limit and then\nencoded in hexadecimal format."),(0,r.kt)("h2",{id:"value-serialization"},"Value serialization"),(0,r.kt)("p",null,"Before being stored in the storage, each value is serialized into bytes using\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," serialization method and subsequently encapsulated with Casper's\n",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," types."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7d8962a6.3648a759.js b/docs/assets/js/7d8962a6.3648a759.js new file mode 100644 index 000000000..05afa609e --- /dev/null +++ b/docs/assets/js/7d8962a6.3648a759.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46671],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return a?n.createElement(g,i(i({ref:t},c),{},{components:a})):n.createElement(g,i({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=u;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={slug:"Nysa",title:"Nysa",authors:["kpob"],image:"./twitter-card.png"},i=void 0,o={permalink:"/blog/Nysa",source:"@site/blog/2023-08-18-nysa/index.md",title:"Nysa",description:'The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wroc\u0142aw, Szczecin, and Gda\u0144sk, to international waterways. The Oder also plays a significant role in the region\'s ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.',date:"2023-08-18T00:00:00.000Z",formattedDate:"August 18, 2023",tags:[],readingTime:8.47,hasTruncateMarker:!0,authors:[{name:"Krzysztof Pobiar\u017cyn",title:"Lead Developer",url:"https://github.com/kpob",key:"kpob"}],frontMatter:{slug:"Nysa",title:"Nysa",authors:["kpob"],image:"./twitter-card.png"},nextItem:{title:"It's all about the community!",permalink:"/blog/its-all-about-the-community"}},l={image:a(46180).Z,authorsImageUrls:[void 0]},p=[{value:"Odra",id:"odra",level:2},{value:"Nysa",id:"nysa",level:2},{value:"Nysa + Odra",id:"nysa--odra",level:3},{value:"Examples",id:"examples",level:2},{value:"Status message",id:"status-message",level:3},{value:"CappedErc20",id:"cappederc20",level:3},{value:"Conclusion",id:"conclusion",level:2}],c={toc:p};function d(e){let{components:t,...s}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,s,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,'The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wroc\u0142aw, Szczecin, and Gda\u0144sk, to international waterways. The Oder also plays a significant role in the region\'s ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.'),(0,r.kt)("p",null,"The Nysa K\u0142odzka is a significant river in Poland, flowing through the country's southwestern part. It travels approximately 188 kilometers, originating in the Czech Republic and merging with the Oder River in Poland. The river passes through picturesque landscapes, including the K\u0142odzko Valley, and plays a crucial role in local ecosystems. Its waters are harnessed for various purposes, such as hydroelectric power generation and irrigation."),(0,r.kt)("p",null,"Oh, wait, shouldn't it be a tech blog?"),(0,r.kt)("p",null,"This is a valid question, we will get back to it in a moment."),(0,r.kt)("h2",{id:"odra"},"Odra"),(0,r.kt)("p",null,"A short reminder:"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design ...\nit takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. "),(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("a",{parentName:"p",href:"https://odra.dev/docs/"},"Odra"))),(0,r.kt)("p",null,"Understanding that people generally dislike learning new things, we've kept this in mind throughout development. Since day one, we have focused on creating Odra with the largest group of smart contract developers in mind - those familiar with Solidity. The Odra Framework is designed to flatten the learning curve for this group."),(0,r.kt)("p",null,"A Solidity developer will encounter familiar concepts such as:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Constructors"),(0,r.kt)("li",{parentName:"ul"},"Payable functions"),(0,r.kt)("li",{parentName:"ul"},"Mappings"),(0,r.kt)("li",{parentName:"ul"},"Reverts"),(0,r.kt)("li",{parentName:"ul"},"Current caller"),(0,r.kt)("li",{parentName:"ul"},"Current block time"),(0,r.kt)("li",{parentName:"ul"},"A standard module library (similar to OpenZeppelin)"),(0,r.kt)("li",{parentName:"ul"},"And more")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"It's important to note that the Odra Framework is intentionally blockchain-agnostic. Its design does not target any particular blockchain. "),(0,r.kt)("p",{parentName:"admonition"},"Ultimately, Odra is built to support multiple blockchains, allowing the writing of smart contracts in Rust.")),(0,r.kt)("p",null,"Having so many similarities, why not take the next step and transpile Solidity code into Odra code?"),(0,r.kt)("p",null,"This is where Nysa comes into play."),(0,r.kt)("h2",{id:"nysa"},"Nysa"),(0,r.kt)("p",null,"Solidity and Rust share some syntax similarities despite being designed for different purposes. Both languages emphasize strong typing, pattern matching, and immutability by default."),(0,r.kt)("p",null,"Nysa performs Solidity-to-Rust transpilation through four simple steps."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"nysa-gen",src:a(12112).Z,width:"661",height:"591"})),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("strong",{parentName:"li"},"Solidity Parser"))),(0,r.kt)("p",null,"Firstly, we need a well-structured Rust representation of Solidity code. Nysa utilizes ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/lalrpop/lalrpop"},"LALRPOP")," - a Rust parser generator framework. In the further steps, this enables us to conduct static analysis of the Solidity code, ranging from contract context down to individual expressions."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=solidity-parser/src/pt.rs",title:"solidity-parser/src/pt.rs"},"// The representation of a Solidity contract\n#[derive(Debug, PartialEq)]\npub struct ContractDefinition {\n pub doc: Vec,\n pub loc: Loc,\n pub ty: ContractTy,\n pub name: Identifier,\n pub base: Vec,\n pub parts: Vec,\n}\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("strong",{parentName:"li"},"C3 Linearization"))),(0,r.kt)("p",null,"One of the most notable distinctions between Rust and Solidity is their approach to inheritance. Rust says ",(0,r.kt)("inlineCode",{parentName:"p"},"No, thx"),", whereas Solidity opts for ",(0,r.kt)("inlineCode",{parentName:"p"},"The more, the better"),". Speaking more technically, Solidity supports multiple inheritance with ",(0,r.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/C3_linearization"},"C3 linearization"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The primary purpose of the C3 Linearization Algorithm is to establish a consistent and unambiguous order of method resolution in cases where there might be ambiguity or conflicts due to multiple inheritance. It ensures that the inherited methods are called in a predictable and well-defined sequence based on the class hierarchy and the order in which classes are defined.")),(0,r.kt)("p",null,"For simulating C3 linearization, Nysa utilizes an ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/c3-lang"},"implementation")," of the C3 linearization in Rust written by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/zie1ony"},"Maciej Zieli\u0144ski"),", so everything stays in the Odra family."),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("strong",{parentName:"li"},"Nysa Parser"))),(0,r.kt)("p",null,"After that, we step to the essential part, converting Solidity code into Rust code."),(0,r.kt)("p",null,"For example, a Solidity event."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-solidity"},"event Transfer(address indexed from, address indexed to, uint256 value);\n")),(0,r.kt)("p",null,"can easily be represented as an plain Rust struct - the same name, the same fields, similar types. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[derive(PartialEq, Eq, Debug)]\npub struct Transfer {\n from: Option
,\n to: Option
,\n value: U256,\n}\n")),(0,r.kt)("p",null,"The same we do with contracts, interfaces, libraries, errors, variables, functions, statements, etc."),(0,r.kt)("p",null,"Here is a snippet of the expression parser:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=nysa/src/parser/odra/expr/mod.rs",title:"nysa/src/parser/odra/expr/mod.rs"},"pub fn parse(expression: &Expression, ctx: &mut T) -> Result\nwhere\n T: StorageInfo + TypeInfo + EventsRegister + ExternalCallsRegister + ContractInfo + FnContext,\n{\n match expression {\n Expression::Require { condition, error } => error::revert(Some(condition), error, ctx),\n Expression::ZeroAddress => Ok(parse_quote!(None)),\n Expression::Add { left, right } => math::add(left, right, ctx),\n Expression::Subtract { left, right } => math::sub(left, right, ctx),\n Expression::Increment { expr } => {\n let expr = parse(expr, ctx)?;\n Ok(parse_quote!(#expr += 1))\n }\n Expression::ExternalCall {\n variable,\n fn_name,\n args,\n } => parse_ext_call(variable, fn_name, args, ctx),\n Expression::Type { ty } => {\n let ty = ty::parse_plain_type_from_ty(ty, ctx)?;\n Ok(parse_quote!(#ty))\n }\n Expression::BoolLiteral(b) => Ok(parse_quote!(#b)),\n ...\n }\n}\n\n")),(0,r.kt)("ol",{start:4},(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("strong",{parentName:"li"},"Printing the code"))),(0,r.kt)("p",null,"The last step is just consuming the resulting C3 AST. Nysa produces a token stream from the AST. Most likely you would write it to a file."),(0,r.kt)("p",null,"And there you are: a Rust smart contract is ready to be compiled!"),(0,r.kt)("h3",{id:"nysa--odra"},"Nysa + Odra"),(0,r.kt)("p",null,"By design, Nysa is a universal tool, so the third step from the pipeline is replaceable. In other words, a Solidity input can be converted to Rust code supporting a framework/SDK of your choice unless you provide a parser implementation."),(0,r.kt)("p",null,"However, the default implementation is ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraParser"),", which takes a contract written in Solidity and splits out an Odra module."),(0,r.kt)("p",null,"I hope you see an analogy to the first two paragraphs at this point. Nysa the river and Nysa the transpiler ",(0,r.kt)("inlineCode",{parentName:"p"},"flow into")," Odra."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"nysa-odra",src:a(42719).Z,width:"661",height:"591"})),(0,r.kt)("h2",{id:"examples"},"Examples"),(0,r.kt)("h3",{id:"status-message"},"Status message"),(0,r.kt)("p",null,"Let's get our hands dirty and create a very simple project. We will write a contract that stores a single mapping of records - an address to a string message."),(0,r.kt)("p",null,"To set up the project, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n status -t blank\ncd status\n")),(0,r.kt)("p",null,"The first thing is to add Nysa to the project and create a rudimentary ",(0,r.kt)("inlineCode",{parentName:"p"},"build.rs")," where we define the input - a solidity contract and the output - an Odra module generated by Nysa."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[build-dependencies]\nnysa = { version = "0.1.0", features = ["builder"] }\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=build.rs",title:"build.rs"},'const DEST_FILE_PATH: &str = "src/status_message.rs";\nconst SOURCE_FILE_PATH: &str = "src/status_message.sol";\n\nfn main() {\n nysa::builder::generate_file::<&str, nysa::OdraParser>(SOURCE_FILE_PATH, DEST_FILE_PATH);\n}\n')),(0,r.kt)("p",null,"Next, implement the contract. Naturally, a Solidity one."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-solidity",metastring:"title=src/status_message.sol",title:"src/status_message.sol"},"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ncontract StatusMessage {\n mapping(address => string) records;\n\n function setStatus(string memory status) public payable {\n address accountId = msg.sender;\n records[accountId] = status;\n }\n\n function getStatus(address accountId) public view returns (string memory) {\n return records[accountId];\n }\n}\n")),(0,r.kt)("p",null,"The contract has a single mapping ",(0,r.kt)("inlineCode",{parentName:"p"},"records")," that stores a message and its owner. Additionally, exposes two entry points: ",(0,r.kt)("inlineCode",{parentName:"p"},"setStatus")," (sets current's sender message) and ",(0,r.kt)("inlineCode",{parentName:"p"},"getStatus"),"."),(0,r.kt)("p",null,"Following, let's define a ",(0,r.kt)("inlineCode",{parentName:"p"},"lib.rs")," file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=src/lib.rs",title:"src/lib.rs"},"mod status_message;\npub use status_message::{StatusMessage, StatusMessageDeployer, StatusMessageRef};\n\n#[cfg(test)]\nmod test;\n")),(0,r.kt)("p",null,"The file is straightforward: registers a ",(0,r.kt)("inlineCode",{parentName:"p"},"status_message")," rust module, reexports some Odra abstractions, and adds a test module."),(0,r.kt)("p",null,"Lastly, we can test our contract.\nLike the original solidity contract, our Odra contract exposes two entry points: ",(0,r.kt)("inlineCode",{parentName:"p"},"set_message()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"get_message()"),".\nThe test code looks like ",(0,r.kt)("a",{parentName:"p",href:"https://odra.dev/docs/basics/testing"},"any other")," Odra test: we use ",(0,r.kt)("inlineCode",{parentName:"p"},"StatusMessageDeployer")," to instantiate a contract, which gets us a reference to interact with the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=src/test.rs",title:"src/test.rs"},'use odra::{test_env, types::Address};\nuse super::*;\n\nconst ACCOUNT: fn() -> Address = || odra::test_env::get_account(1);\n\n#[test]\nfn set_get_message() {\n let mut contract = StatusMessageDeployer::default();\n\n test_env::set_caller(ACCOUNT());\n contract.set_status("hello".to_string());\n assert_eq!("hello".to_string(), contract.get_status(Some(ACCOUNT())));\n}\n\n#[test]\nfn get_nonexistent_message() {\n let contract = StatusMessageDeployer::default();\n\n assert_eq!(\n String::new(),\n contract.get_status(Some(ACCOUNT()))\n );\n}\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test # test against MockVM\n# or\ncargo odra test -b casper # build a wasm file and test against CasperVM\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"status-message\n\u251c\u2500\u2500 src\n\u2502 \u251c\u2500\u2500 lib.rs\n\u2502 \u251c\u2500\u2500 status_message.sol\n\u2502 \u2514\u2500\u2500 test.rs\n\u251c\u2500\u2500 build.rs\n\u251c\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 Odra.toml\n")),(0,r.kt)("p",null,"Full example available ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/nysa/tree/feature/odra/examples/status-message/nysa"},"here"),"."),(0,r.kt)("h3",{id:"cappederc20"},"CappedErc20"),(0,r.kt)("p",null,"A more complex, real-world example is a ",(0,r.kt)("inlineCode",{parentName:"p"},"CappedErc20")," contract. It is a ERC20 ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"},"Ownable"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol"},"Burnable")," and ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Capped.sol"},"Capped")," token contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-solidity",metastring:"title=plascoin.sol",title:"plascoin.sol"},"// ...\n// rest of the code\n\ncontract Plascoin is ERC20Capped, ERC20Burnable, Ownable {\n constructor(string memory name_, string memory symbol_, uint256 cap_, address initialOwner) ERC20(name_, symbol_) ERC20Capped(cap_) Ownable(initialOwner) {\n }\n\n function mint(address account, uint256 amount) public onlyOwner {\n _mint(account, amount);\n }\n\n function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Capped) {\n super._update(from, to, value);\n }\n}\n")),(0,r.kt)("p",null,"You can check out the full source code ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/nysa/blob/feature/odra/examples/capped-erc20/src/plascoin.sol"},"here"),"."),(0,r.kt)("p",null,"Deployment of such a contract onto the Casper testnet is straightforward. We are just two steps from it. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"# to make sure the contract works as expected \n# we execute cargo odra test command to build and run tests\ncargo odra test -b casper\n\n# deploy onto the testnet\ncasper-client put-deploy\n --node-address {{NODE_ADDRESS}}\n --chain-name casper-test\n --secret-key {{SECRET_KEY}} \\\n --session-path {{CONTRACT_WASM}} \\\n --payment-amount 130000000000 \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'{{CONTRACT_PACKAGE_HASH_NAMED_KEY}}'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'true'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n --session-arg \"name:string='{{name}}'\" \\\n --session-arg \"symbol:string='{{symbol}}'\" \\\n --session-arg \"cap:u256='{{cap}}'\" \\\n --session-arg \"initial_owner:opt_key='{{owner}}'\"\n")),(0,r.kt)("p",null,"Literally in 5 minutes I was able to:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Build a wasm file from Solidity source code"),(0,r.kt)("li",{parentName:"ol"},"Successfully ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/deploy/b1dd9628f8a36b7ed24949f88ea97ebb21d0c213e9cc87fc5ee4076074de0c88"},"deploy")," the contract onto Testnet,"),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/deploy/1def539f806fd39ec1b75687c46946c7510fe3bb15860fcc3420c7bea7e7f10f"},"Mint")," some tokens,"),(0,r.kt)("li",{parentName:"ol"},"And ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/deploy/0e2e0fa490f00783ddaecd06aaf2b43d8c5f6d3224a28a31ad66bfef48ce26e6"},"transfer")," them.")),(0,r.kt)("p",null,"Finally, we compare the costs of Solidity-to-Odra contract and a native CEP-18 implementation. Despite the contracts being different in terms of the internal logic and exposed entry points, such comparison gives us some insight into Nysa's efficiency."),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"action"),(0,r.kt)("th",{parentName:"tr",align:null},"CEP-18"),(0,r.kt)("th",{parentName:"tr",align:null},"Nysa"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"deploy"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"https://testnet.cspr.live/deploy/2b5d17ea5d9c093c4252705285f7aeabe58cff37fb48b5837567908e2d91329a"},"143.87")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"https://testnet.cspr.live/deploy/b1dd9628f8a36b7ed24949f88ea97ebb21d0c213e9cc87fc5ee4076074de0c88"},"93.37"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"transfer"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"https://testnet.cspr.live/deploy/3ab866e7cf7b59e081f12aea4103f9552b261b601d91b072ea10ab5be6cf0e45"},"1.29")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"https://testnet.cspr.live/deploy/0e2e0fa490f00783ddaecd06aaf2b43d8c5f6d3224a28a31ad66bfef48ce26e6"},"1.36"))))),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Nysa is at early stage of development, but already has shown a huge potential. In a few simple steps, you can take advantage of an existing smart contract and convert it into an Odra module. The module can be a standalone contract, or a building block of a bigger contract."))}d.isMDXComponent=!0},12112:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/nysa_generic.drawio-9478454b52585f4bd5c3a825f50917f2.svg"},42719:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/nysa_odra.drawio-e8d8d662f0a2e5e364005985245721fd.svg"},46180:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/twitter-card-941b7cfa84d4da7dd4848d3556845b53.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/7df6186d.f9bca2cb.js b/docs/assets/js/7df6186d.f9bca2cb.js new file mode 100644 index 000000000..82aefc917 --- /dev/null +++ b/docs/assets/js/7df6186d.f9bca2cb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[13968],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=p(n),d=a,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",i={unversionedId:"getting-started/flipper",id:"version-0.2.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.2.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.2.0/getting-started/flipper",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"Installation",permalink:"/docs/0.2.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.2.0/category/basics"}},s={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.2.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.2.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Variable;\n\n/// A module definition. Each module struct consists Variables and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Variable,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let mut contract1 = FlipperDeployer::initial_settings();\n let contract2 = FlipperDeployer::initial_settings();\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7e706e45.74b9b103.js b/docs/assets/js/7e706e45.74b9b103.js new file mode 100644 index 000000000..7a7e42df9 --- /dev/null +++ b/docs/assets/js/7e706e45.74b9b103.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[79032],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),u=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=u(t),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return t?a.createElement(w,o(o({ref:n},d),{},{components:t})):a.createElement(w,o({ref:n},d))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.3.1/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.3.1/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.3.1/tutorials/ownable",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/0.3.1/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.3.1/tutorials/erc20"}},s={},u=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining constructors,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{types::Address, Variable};\n\n#[odra::module]\npub struct Ownable {\n owner: Variable
\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basic before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - Firstly, we need create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," to it above."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{\n execution_error, contract_env, Event, types::{Address, event::OdraEvent}\n};\n...\n\n#[odra::module]\nimpl Ownable {\n #[odra(init)]\n pub fn init(&mut self, owner: &Address) {\n if self.owner.get().is_some() {\n contract_env::revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(*owner);\n \n OwnershipChanged {\n prev_owner: None,\n new_owner: *owner\n }\n .emit();\n }\n}\n\nexecution_error! {\n pub enum Error {\n OwnerIsNotInitialized => 1,\n }\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option
,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is marked as ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]")," making it a constructor. It matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum is defined inside the ",(0,r.kt)("inlineCode",{parentName:"li"},"execution_error")," macro. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9-L11")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::revert()")," function. As an argument we pass ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsNotInitialized"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L13")," - Then we write the owner passed as an argument to the storage. To do so we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29-L33")," - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Finally, we create the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," struct and call ",(0,r.kt)("inlineCode",{parentName:"li"},"emit()")," function on it (import ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent")," trait). Hence we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get().as_ref() {\n contract_env::revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&contract_env::caller());\n let current_owner = self.get_owner();\n self.owner.set(*new_owner);\n OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n }\n .emit();\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get() {\n Some(owner) => owner,\n None => contract_env::revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\nexecution_error! {\n pub enum Error {\n NotOwner => 1,\n OwnerIsAlreadyInitialized => 2,\n OwnerIsNotInitialized => 3,\n }\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5,L32")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," is reads the current owner, and reverts if is does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::caller()")," function. The we update the state, and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22,L34")," - Lastly, a getter function. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable")," ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returns an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),", we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),".")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{assert_events, test_env};\n\n fn setup() -> (Address, OwnableRef) {\n let owner = test_env::get_account(0);\n let ownable = OwnableDeployer::init(owner);\n (owner, ownable)\n }\n\n #[test]\n fn initialization_works() {\n let (owner, ownable) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (owner, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n \n test_env::set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (_, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n ownable.change_ownership(&new_owner);\n \n test_env::assert_exception(Error::NotOwner, || {\n ownable.change_ownership(&new_owner);\n });\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we call as the first statement in each test. Take a look at the signature ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (Address, OwnableRef)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableRef")," is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Now, the module needs an owner, the easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env"),". We choose the address of first account (which is the default one)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Odra created for us ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableDeployer")," struct which implements all constructor functions. In this case there is just one function - ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which corresponds the function we have implemented in the module."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - It is time to define the first test. As you see, it is a regular rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14-15")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-23")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events"),". As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30")," - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"test env")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L32")," - As mentioned, the default is the 0-th account, if you want to change the executor call the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L49-55")," - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::assert_exception()")," with the error you expect and a failing block of code.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/7f9a1b7a.d809c29f.js b/docs/assets/js/7f9a1b7a.d809c29f.js new file mode 100644 index 000000000..527f20cbd --- /dev/null +++ b/docs/assets/js/7f9a1b7a.d809c29f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[54133],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.7.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.7.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.7.0/basics/cross-calls",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.7.0/basics/events"},next:{title:"Modules",permalink:"/docs/0.7.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use odra::Variable;\nuse odra::types::{Address};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Variable
,\n}\n\n#[odra::module]\nimpl CrossContract {\n #[odra(init)]\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap();\n MathEngineRef::at(math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine {\n}\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To call the external contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"MathEngineRef::at(math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/testing"},"Testing")," article.\nIt is a reference to already deployed - running contract.\nHere we are going to take a deeper look at it."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," is generated automatically, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nTo get an instance of a reference, we can either deploy a contract (using ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),") or by building it\ndirectly, using ",(0,r.kt)("inlineCode",{parentName:"p"},"::at(address: Address)")," method, as shown above.\nThe reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), alongside couple methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"at(Address) -> Self")," - points the reference to an Address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"address() -> Address")," - returns the Address the reference is currently pointing at"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"with_tokens(Amount) -> Self")," - attaches Amount of native tokens to the next call")),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderRef")," struct (but do not create the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderDeployer"),"). Having an address we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"AdderRef::at(address).add(3, 5)\n")),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"use super::{CrossContractDeployer, MathEngineDeployer};\n\n#[test]\nfn test_cross_calls() {\n let math_engine_contract = MathEngineDeployer::default();\n let cross_contract = CrossContractDeployer::init(math_engine_contract.address());\n\n assert_eq!(cross_contract.add_using_another(), 8);\n}\n")),(0,r.kt)("p",null,"Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function we want to use."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/cross_calls.rs"',title:'"examples/src/features/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use odra::types::Address;\n use crate::features::cross_calls::{Adder, AdderRef};\n \n #[test]\n fn test_ext() {\n let adder = AdderRef::at(get_adder_address());\n\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address() -> Address {\n let contract = MathEngineDeployer::default();\n contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/800dfaa2.c83d6029.js b/docs/assets/js/800dfaa2.c83d6029.js new file mode 100644 index 000000000..b3ee331e3 --- /dev/null +++ b/docs/assets/js/800dfaa2.c83d6029.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[84928],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,m=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.7.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.7.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.7.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.7.0/category/backends"},next:{title:"MockVM",permalink:"/docs/0.7.0/backends/mock-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Test Env",id:"test-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/backends/mock-vm"},"MockVM"),",\nor a complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/backends/casper"},"CasperVM"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/8010fede.3156057a.js b/docs/assets/js/8010fede.3156057a.js new file mode 100644 index 000000000..7d90f59dd --- /dev/null +++ b/docs/assets/js/8010fede.3156057a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12628],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.7.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.7.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.7.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.7.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.7.0/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = { path = "../core", default-features = false }\nodra-modules = { path = "../modules", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]\ncasper = ["odra/casper", "odra-modules/casper"]\n')),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules")," defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," feature in your project, add ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules/casper"),"specifically (it applies to each backend).")),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::types::{Address, U256};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main Odra repository.")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/80b62ebf.8179cf95.js b/docs/assets/js/80b62ebf.8179cf95.js new file mode 100644 index 000000000..b24088889 --- /dev/null +++ b/docs/assets/js/80b62ebf.8179cf95.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[81229],{27926:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.9.1/category/examples","navigation":{"previous":{"title":"Livenet","permalink":"/docs/0.9.1/backends/livenet"},"next":{"title":"odra-examples","permalink":"/docs/0.9.1/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/80b82873.0e48c302.js b/docs/assets/js/80b82873.0e48c302.js new file mode 100644 index 000000000..0e7675968 --- /dev/null +++ b/docs/assets/js/80b82873.0e48c302.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[45299],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=l(t),u=r,h=p["".concat(c,".").concat(u)]||p[u]||m[u]||i;return t?a.createElement(h,o(o({ref:n},d),{},{components:t})):a.createElement(h,o({ref:n},d))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=p;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:10,description:"Casper Contract Schema"},o="Casper Contract Schema",s={unversionedId:"basics/casper-contract-schema",id:"basics/casper-contract-schema",title:"Casper Contract Schema",description:"Casper Contract Schema",source:"@site/docs/basics/13-casper-contract-schema.md",sourceDirName:"basics",slug:"/basics/casper-contract-schema",permalink:"/docs/next/basics/casper-contract-schema",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Casper Contract Schema"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/next/basics/events"},next:{title:"Cross calls",permalink:"/docs/next/basics/cross-calls"}},c={},l=[{value:"Odra and CCS",id:"odra-and-ccs",level:2},{value:"Generating the Schema",id:"generating-the-schema",level:2},{value:"Schema Output",id:"schema-output",level:2},{value:"Schema Fields",id:"schema-fields",level:2}],d={toc:l};function m(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper-contract-schema"},"Casper Contract Schema"),(0,r.kt)("p",null," Working in collaboration with the Casper Association we designed the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema")," (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability."),(0,r.kt)("h2",{id:"odra-and-ccs"},"Odra and CCS"),(0,r.kt)("p",null,"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: ",(0,r.kt)("inlineCode",{parentName:"p"},"module"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"event"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_type"),". The schema will be generated for you and available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/contract.rs"',showLineNumbers:!0,title:'"src/contract.rs"'},'use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(\n // the name of the contract, default is the module name\n name = "MyContract",\n // the version of the contract, default is the version of the crate\n version = "0.1.0", \n // events that the contract can emit, collected recursively if submodules are used\n events = [ \n Created,\n Updated\n ],\n // the error enum the contract can revert with, collected recursively if submodules are used\n errors = MyErrors \n)]\npub struct MyContract {\n name: Var,\n owner: Var
,\n}\n\n#[odra::module]\nimpl MyContract {\n /// Initializes the contract, sets the name and owner and emits an event\n pub fn init(&mut self, name: String, owner: Address) {\n self.name.set(name.clone());\n self.owner.set(owner.clone());\n self.env().emit_event(Created { name });\n }\n\n /// Updates the name of the contract and emits an event\n pub fn update(&mut self, name: String) {\n self.name.set(name.clone());\n self.env().emit_event(Updated { name });\n }\n\n /// Returns the data of the contract\n pub fn get_data(&self) -> Data {\n Data {\n name: self.name.get_or_default(),\n owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),\n }\n }\n}\n\n// The struct will we visible in the schema in the types section\n#[odra::odra_type]\npub struct Data {\n name: String,\n owner: Address,\n}\n\n// The enum variants will we visible in the schema in the errors section\n#[odra::odra_error]\npub enum MyErrors {\n /// The owner is invalid\n InvalidOwner,\n /// The name is invalid\n InvalidName,\n}\n\n// The struct will we visible in the schema in the types and events section\n#[odra::event]\npub struct Updated {\n name: String,\n}\n\n// The struct will we visible in the schema in the types section and events section\n#[odra::event]\npub struct Created {\n name: String,\n}\n')),(0,r.kt)("h2",{id:"generating-the-schema"},"Generating the Schema"),(0,r.kt)("p",null,"To generate the schema run the following ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo-odra")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema # or pass -c flag to generate the schema for a specific contract\n")),(0,r.kt)("h2",{id:"schema-output"},"Schema Output"),(0,r.kt)("p",null,"The generated schema will be available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'showLineNumbers title="resources/my_contract_schema.json"',showLineNumbers:!0,title:'"resources/my_contract_schema.json"'},'{\n "casper_contract_schema_version": 1,\n "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",\n "authors": [],\n "repository": null,\n "homepage": null,\n "contract_name": "MyContract",\n "contract_version": "0.1.0",\n "types": [\n {\n "struct": {\n "name": "Created",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Data",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Updated",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n }\n ],\n "errors": [\n {\n "name": "InvalidName",\n "description": "The name is invalid",\n "discriminant": 1\n },\n {\n "name": "InvalidOwner",\n "description": "The owner is invalid",\n "discriminant": 0\n }\n ],\n "entry_points": [\n {\n "name": "update",\n "description": "Updates the name of the contract and emits an event",\n "is_mutable": true,\n "arguments": [\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n }\n ],\n "return_ty": "Unit",\n "is_contract_context": true,\n "access": "public"\n },\n {\n "name": "get_data",\n "description": "Returns the data of the contract",\n "is_mutable": false,\n "arguments": [],\n "return_ty": "Data",\n "is_contract_context": true,\n "access": "public"\n }\n ],\n "events": [\n {\n "name": "Created",\n "ty": "Created"\n },\n {\n "name": "Updated",\n "ty": "Updated"\n }\n ],\n "call": {\n "wasm_file_name": "MyContract.wasm",\n "description": "Initializes the contract, sets the name and owner and emits an event",\n "arguments": [\n {\n "name": "odra_cfg_package_hash_key_name",\n "description": "The arg name for the package hash key name.",\n "ty": "String",\n "optional": false\n },\n {\n "name": "odra_cfg_allow_key_override",\n "description": "The arg name for the allow key override.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "odra_cfg_is_upgradable",\n "description": "The arg name for the contract upgradeability setting.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key",\n "optional": false\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"schema-fields"},"Schema Fields"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"casper_contract_schema_version")," is the version of the schema.\n",(0,r.kt)("inlineCode",{parentName:"li"},"toolchain")," is the version of the Rust compiler used to compile the contract."),(0,r.kt)("li",{parentName:"ul"},"Fields ",(0,r.kt)("inlineCode",{parentName:"li"},"authors"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"repository"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"homepage")," are optional and can be set in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_name")," is the name of the contract - by default is the module name, may be overriden by the module attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_version")," denotes the version of the contract, defaulting to the version specified in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file, but can be overridden by the ",(0,r.kt)("inlineCode",{parentName:"li"},"module")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"types")," comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), and a list of members."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"errors")," is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_points")," is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"events")," is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in ",(0,r.kt)("inlineCode",{parentName:"li"},"types"),") of the event."),(0,r.kt)("li",{parentName:"ul"},"The ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," section provides details regarding the contract's ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/814f3328.f224db02.js b/docs/assets/js/814f3328.f224db02.js new file mode 100644 index 000000000..297a51c4a --- /dev/null +++ b/docs/assets/js/814f3328.f224db02.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52535],{45641:e=>{e.exports=JSON.parse('{"title":"Recent posts","items":[]}')}}]); \ No newline at end of file diff --git a/docs/assets/js/815ad8c9.3053e87b.js b/docs/assets/js/815ad8c9.3053e87b.js new file mode 100644 index 000000000..29efee461 --- /dev/null +++ b/docs/assets/js/815ad8c9.3053e87b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29145],{3905:(e,r,n)=>{n.d(r,{Zo:()=>p,kt:()=>m});var t=n(67294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=o,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?t.createElement(f,s(s({ref:r},p),{},{components:n})):t.createElement(f,s({ref:r},p))}));function m(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=n(87462),o=(n(67294),n(3905));const a={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.3.1/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.3.1/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.3.1/basics/errors",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.3.1/basics/testing"},next:{title:"Events",permalink:"/docs/0.3.1/basics/events"}},l={},c=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:r,...n}=e;return(0,o.kt)("wrapper",(0,t.Z)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"errors"},"Errors"),(0,o.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"use odra::{execution_error, Variable, UnwrapOrRevert};\nuse odra::types::Address;\n\n#[odra::module]\npub struct OwnedContract {\n name: Variable,\n owner: Variable
,\n}\n\nexecution_error! {\n pub enum Error {\n OwnerNotSet => 1,\n NotAnOwner => 2,\n }\n}\n\n\n#[odra::module]\nimpl OwnedContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = odra::contract_env::caller();\n if caller != self.owner() {\n odra::contract_env::revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,o.kt)("p",null,"Firstly, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,o.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,o.kt)("p",null,"You and the users of your contract will be thankful for a meaningful error message!"),(0,o.kt)("p",null,"You can also throw the error directly, by using ",(0,o.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"odra::contract_env::revert(Error::NotAnOwner)\n")),(0,o.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,o.kt)("p",null,"Okay, but how about testing it? We've already mentioned a function - ",(0,o.kt)("inlineCode",{parentName:"p"},"assert_exception"),". This is how you will\nuse it:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},'use super::{OwnedContractDeployer, OwnedContractRef};\nuse super::Error;\n\n#[test]\nfn test_owner_error() {\n let owner = odra::test_env::get_account(0);\n let not_an_owner = odra::test_env::get_account(1);\n\n odra::test_env::set_caller(owner);\n let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());\n\n odra::test_env::set_caller(not_an_owner);\n odra::test_env::assert_exception(Error::NotAnOwner, || {\n owned_contract.change_name("NewName".to_string());\n })\n}\n')),(0,o.kt)("p",null,"In the example above, because we are calling the ",(0,o.kt)("inlineCode",{parentName:"p"},"change_name"),' method as an address which is not an "owner",\nwe are expecting that "NotAnOwner" error will be thrown.'),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Here we are creating another reference to the already deployed contract using ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractRef::at()")," and passing to it\nits Address. Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractDeployer::init()")," returns the same type.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will learn how to emit and test events using Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/82287515.5c83760d.js b/docs/assets/js/82287515.5c83760d.js new file mode 100644 index 000000000..1b72cd4e4 --- /dev/null +++ b/docs/assets/js/82287515.5c83760d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[32164],{84196:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.7.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.7.0/"},"next":{"title":"Installation","permalink":"/docs/0.7.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/83209.932ca8b0.js b/docs/assets/js/83209.932ca8b0.js new file mode 100644 index 000000000..13142a1cc --- /dev/null +++ b/docs/assets/js/83209.932ca8b0.js @@ -0,0 +1 @@ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83209],{17295:(n,t,e)=>{n.exports=function(){function n(t,e,i){function r(a,u){if(!e[a]){if(!t[a]){if(c)return c(a,!0);var o=new Error("Cannot find module '"+a+"'");throw o.code="MODULE_NOT_FOUND",o}var s=e[a]={exports:{}};t[a][0].call(s.exports,(function(n){return r(t[a][1][n]||n)}),s,s.exports,n,t,e,i)}return e[a].exports}for(var c=void 0,a=0;a0&&void 0!==arguments[0]?arguments[0]:{},i=e.defaultLayoutOptions,c=void 0===i?{}:i,u=e.algorithms,o=void 0===u?["layered","stress","mrtree","radial","force","disco","sporeOverlap","sporeCompaction","rectpacking"]:u,s=e.workerFactory,h=e.workerUrl;if(r(this,n),this.defaultLayoutOptions=c,this.initialized=!1,void 0===h&&void 0===s)throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.");var f=s;void 0!==h&&void 0===s&&(f=function(n){return new Worker(n)});var l=f(h);if("function"!=typeof l.postMessage)throw new TypeError("Created worker does not provide the required 'postMessage' function.");this.worker=new a(l),this.worker.postMessage({cmd:"register",algorithms:o}).then((function(n){return t.initialized=!0})).catch(console.err)}return i(n,[{key:"layout",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.layoutOptions,i=void 0===e?this.defaultLayoutOptions:e,r=t.logging,c=void 0!==r&&r,a=t.measureExecutionTime,u=void 0!==a&&a;return n?this.worker.postMessage({cmd:"layout",graph:n,layoutOptions:i,options:{logging:c,measureExecutionTime:u}}):Promise.reject(new Error("Missing mandatory parameter 'graph'."))}},{key:"knownLayoutAlgorithms",value:function(){return this.worker.postMessage({cmd:"algorithms"})}},{key:"knownLayoutOptions",value:function(){return this.worker.postMessage({cmd:"options"})}},{key:"knownLayoutCategories",value:function(){return this.worker.postMessage({cmd:"categories"})}},{key:"terminateWorker",value:function(){this.worker.terminate()}}]),n}();e.default=c;var a=function(){function n(t){var e=this;if(r(this,n),void 0===t)throw new Error("Missing mandatory parameter 'worker'.");this.resolvers={},this.worker=t,this.worker.onmessage=function(n){setTimeout((function(){e.receive(e,n)}),0)}}return i(n,[{key:"postMessage",value:function(n){var t=this.id||0;this.id=t+1,n.id=t;var e=this;return new Promise((function(i,r){e.resolvers[t]=function(n,t){n?(e.convertGwtStyleError(n),r(n)):i(t)},e.worker.postMessage(n)}))}},{key:"receive",value:function(n,t){var e=t.data,i=n.resolvers[e.id];i&&(delete n.resolvers[e.id],e.error?i(e.error):i(null,e.data))}},{key:"terminate",value:function(){this.worker.terminate&&this.worker.terminate()}},{key:"convertGwtStyleError",value:function(n){if(n){var t=n.__java$exception;t&&(t.cause&&t.cause.backingJsObject&&(n.cause=t.cause.backingJsObject,this.convertGwtStyleError(n.cause)),delete n.__java$exception)}}}]),n}()},{}],2:[function(n,t,i){(function(n){(function(){"use strict";var e;function r(){}function c(){}function a(){}function u(){}function o(){}function s(){}function h(){}function f(){}function l(){}function b(){}function w(){}function d(){}function g(){}function p(){}function v(){}function m(){}function y(){}function k(){}function j(){}function E(){}function T(){}function M(){}function S(){}function P(){}function C(){}function I(){}function O(){}function A(){}function $(){}function L(){}function N(){}function x(){}function D(){}function R(){}function K(){}function _(){}function F(){}function B(){}function H(){}function q(){}function G(){}function z(){}function U(){}function X(){}function W(){}function V(){}function Q(){}function Y(){}function J(){}function Z(){}function nn(){}function tn(){}function en(){}function rn(){}function cn(){}function an(){}function un(){}function on(){}function sn(){}function hn(){}function fn(){}function ln(){}function bn(){}function wn(){}function dn(){}function gn(){}function pn(){}function vn(){}function mn(){}function yn(){}function kn(){}function jn(){}function En(){}function Tn(){}function Mn(){}function Sn(){}function Pn(){}function Cn(){}function In(){}function On(){}function An(){}function $n(){}function Ln(){}function Nn(){}function xn(){}function Dn(){}function Rn(){}function Kn(){}function _n(){}function Fn(){}function Bn(){}function Hn(){}function qn(){}function Gn(){}function zn(){}function Un(){}function Xn(){}function Wn(){}function Vn(){}function Qn(){}function Yn(){}function Jn(){}function Zn(){}function nt(){}function tt(){}function et(){}function it(){}function rt(){}function ct(){}function at(){}function ut(){}function ot(){}function st(){}function ht(){}function ft(){}function lt(){}function bt(){}function wt(){}function dt(){}function gt(){}function pt(){}function vt(){}function mt(){}function yt(){}function kt(){}function jt(){}function Et(){}function Tt(){}function Mt(){}function St(){}function Pt(){}function Ct(){}function It(){}function Ot(){}function At(){}function $t(){}function Lt(){}function Nt(){}function xt(){}function Dt(){}function Rt(){}function Kt(){}function _t(){}function Ft(){}function Bt(){}function Ht(){}function qt(){}function Gt(){}function zt(){}function Ut(){}function Xt(){}function Wt(){}function Vt(){}function Qt(){}function Yt(){}function Jt(){}function Zt(){}function ne(){}function te(){}function ee(){}function ie(){}function re(){}function ce(){}function ae(){}function ue(){}function oe(){}function se(){}function he(){}function fe(){}function le(){}function be(){}function we(){}function de(){}function ge(){}function pe(){}function ve(){}function me(){}function ye(){}function ke(){}function je(){}function Ee(){}function Te(){}function Me(){}function Se(){}function Pe(){}function Ce(){}function Ie(){}function Oe(){}function Ae(){}function $e(){}function Le(){}function Ne(){}function xe(){}function De(){}function Re(){}function Ke(){}function _e(){}function Fe(){}function Be(){}function He(){}function qe(){}function Ge(){}function ze(){}function Ue(){}function Xe(){}function We(){}function Ve(){}function Qe(){}function Ye(){}function Je(){}function Ze(){}function ni(){}function ti(){}function ei(){}function ii(){}function ri(){}function ci(){}function ai(){}function ui(){}function oi(){}function si(){}function hi(){}function fi(){}function li(){}function bi(){}function wi(){}function di(){}function gi(){}function pi(){}function vi(){}function mi(){}function yi(){}function ki(){}function ji(){}function Ei(){}function Ti(){}function Mi(){}function Si(){}function Pi(){}function Ci(){}function Ii(){}function Oi(){}function Ai(){}function $i(){}function Li(){}function Ni(){}function xi(){}function Di(){}function Ri(){}function Ki(){}function _i(){}function Fi(){}function Bi(){}function Hi(){}function qi(){}function Gi(){}function zi(){}function Ui(){}function Xi(){}function Wi(){}function Vi(){}function Qi(){}function Yi(){}function Ji(){}function Zi(){}function nr(){}function tr(){}function er(){}function ir(){}function rr(){}function cr(){}function ar(){}function ur(){}function or(){}function sr(){}function hr(){}function fr(){}function lr(){}function br(){}function wr(){}function dr(){}function gr(){}function pr(){}function vr(){}function mr(){}function yr(){}function kr(){}function jr(){}function Er(){}function Tr(){}function Mr(){}function Sr(){}function Pr(){}function Cr(){}function Ir(){}function Or(){}function Ar(){}function $r(){}function Lr(){}function Nr(){}function xr(){}function Dr(){}function Rr(){}function Kr(){}function _r(){}function Fr(){}function Br(){}function Hr(){}function qr(){}function Gr(){}function zr(){}function Ur(){}function Xr(){}function Wr(){}function Vr(){}function Qr(){}function Yr(){}function Jr(){}function Zr(){}function nc(){}function tc(){}function ec(){}function ic(){}function rc(){}function cc(){}function ac(){}function uc(){}function oc(){}function sc(){}function hc(){}function fc(){}function lc(){}function bc(){}function wc(){}function dc(){}function gc(){}function pc(){}function vc(){}function mc(){}function yc(){}function kc(){}function jc(){}function Ec(){}function Tc(){}function Mc(){}function Sc(){}function Pc(){}function Cc(){}function Ic(){}function Oc(){}function Ac(){}function $c(){}function Lc(){}function Nc(){}function xc(){}function Dc(){}function Rc(){}function Kc(){}function _c(){}function Fc(){}function Bc(){}function Hc(){}function qc(){}function Gc(){}function zc(){}function Uc(){}function Xc(){}function Wc(){}function Vc(){}function Qc(){}function Yc(){}function Jc(){}function Zc(){}function na(){}function ta(){}function ea(){}function ia(){}function ra(){}function ca(){}function aa(){}function ua(){}function oa(){}function sa(){}function ha(){}function fa(){}function la(){}function ba(){}function wa(){}function da(){}function ga(){}function pa(){}function va(){}function ma(){}function ya(){}function ka(){}function ja(){}function Ea(){}function Ta(){}function Ma(){}function Sa(){}function Pa(){}function Ca(){}function Ia(){}function Oa(){}function Aa(){}function $a(){}function La(){}function Na(){}function xa(){}function Da(){}function Ra(){}function Ka(){}function _a(){}function Fa(){}function Ba(){}function Ha(){}function qa(){}function Ga(){}function za(){}function Ua(){}function Xa(){}function Wa(){}function Va(){}function Qa(){}function Ya(){}function Ja(){}function Za(){}function nu(){}function tu(){}function eu(){}function iu(){}function ru(){}function cu(){}function au(){}function uu(){}function ou(){}function su(){}function hu(){}function fu(){}function lu(){}function bu(){}function wu(){}function du(){}function gu(){}function pu(){}function vu(){}function mu(){}function yu(){}function ku(){}function ju(){}function Eu(){}function Tu(){}function Mu(){}function Su(){}function Pu(){}function Cu(){}function Iu(){}function Ou(){}function Au(){}function $u(){}function Lu(){}function Nu(){}function xu(){}function Du(){}function Ru(){}function Ku(){}function _u(){}function Fu(){}function Bu(){}function Hu(){}function qu(){}function Gu(){}function zu(){}function Uu(){}function Xu(){}function Wu(){}function Vu(){}function Qu(){}function Yu(){}function Ju(){}function Zu(){}function no(){}function to(){}function eo(){}function io(){}function ro(){}function co(){}function ao(){}function uo(){}function oo(){}function so(){}function ho(){}function fo(){}function lo(){}function bo(){}function wo(){}function go(){}function po(){}function vo(){}function mo(){}function yo(){}function ko(){}function jo(){}function Eo(){}function To(){}function Mo(){}function So(){}function Po(){}function Co(){}function Io(){}function Oo(){}function Ao(){}function $o(){}function Lo(){}function No(){}function xo(){}function Do(){}function Ro(){}function Ko(){}function _o(){}function Fo(){}function Bo(){}function Ho(){}function qo(){}function Go(){}function zo(){}function Uo(){}function Xo(){}function Wo(){}function Vo(){}function Qo(){}function Yo(){}function Jo(){}function Zo(){}function ns(){}function ts(){}function es(){}function is(){}function rs(){}function cs(){}function as(){}function us(){}function os(){}function ss(){}function hs(){}function fs(){}function ls(){}function bs(){}function ws(){}function ds(){}function gs(){}function ps(){}function vs(){}function ms(){}function ys(){}function ks(){}function js(){}function Es(){}function Ts(){}function Ms(){}function Ss(){}function Ps(){}function Cs(){}function Is(){}function Os(){}function As(){}function $s(){}function Ls(){}function Ns(){}function xs(){}function Ds(){}function Rs(){}function Ks(){}function _s(){}function Fs(){}function Bs(){}function Hs(){}function qs(){}function Gs(){}function zs(){}function Us(){}function Xs(){}function Ws(){}function Vs(){}function Qs(){}function Ys(){}function Js(){}function Zs(){}function nh(){}function th(){}function eh(){}function ih(){}function rh(){}function ch(){}function ah(){}function uh(){}function oh(){}function sh(){}function hh(){}function fh(){}function lh(){}function bh(){}function wh(){}function dh(){}function gh(){}function ph(){}function vh(){}function mh(){}function yh(){}function kh(){}function jh(){}function Eh(){}function Th(){}function Mh(){}function Sh(){}function Ph(){}function Ch(){}function Ih(){}function Oh(){}function Ah(){}function $h(){}function Lh(){}function Nh(){}function xh(){}function Dh(){}function Rh(){}function Kh(){}function _h(n){}function Fh(n){}function Bh(){iy()}function Hh(){Gsn()}function qh(){Epn()}function Gh(){_kn()}function zh(){jSn()}function Uh(){fRn()}function Xh(){Kyn()}function Wh(){rkn()}function Vh(){EM()}function Qh(){mM()}function Yh(){q_()}function Jh(){TM()}function Zh(){Irn()}function nf(){SM()}function tf(){I6()}function ef(){Pin()}function rf(){Q8()}function cf(){_Z()}function af(){zsn()}function uf(){_Mn()}function of(){Cin()}function sf(){U2()}function hf(){fWn()}function ff(){Gyn()}function lf(){FZ()}function bf(){HXn()}function wf(){RZ()}function df(){Iin()}function gf(){Yun()}function pf(){GZ()}function vf(){C9()}function mf(){PM()}function yf(){KAn()}function kf(){Uyn()}function jf(){Fcn()}function Ef(){MMn()}function Tf(){bRn()}function Mf(){Bvn()}function Sf(){CAn()}function Pf(){Ran()}function Cf(){HZ()}function If(){s_n()}function Of(){$An()}function Af(){W$n()}function $f(){x9()}function Lf(){SMn()}function Nf(){sWn()}function xf(){Xsn()}function Df(){vdn()}function Rf(){qBn()}function Kf(){u_()}function _f(){wcn()}function Ff(){fFn()}function Bf(n){kW(n)}function Hf(n){this.a=n}function qf(n){this.a=n}function Gf(n){this.a=n}function zf(n){this.a=n}function Uf(n){this.a=n}function Xf(n){this.a=n}function Wf(n){this.a=n}function Vf(n){this.a=n}function Qf(n){this.a=n}function Yf(n){this.a=n}function Jf(n){this.a=n}function Zf(n){this.a=n}function nl(n){this.a=n}function tl(n){this.a=n}function el(n){this.a=n}function il(n){this.a=n}function rl(n){this.a=n}function cl(n){this.a=n}function al(n){this.a=n}function ul(n){this.a=n}function ol(n){this.a=n}function sl(n){this.b=n}function hl(n){this.c=n}function fl(n){this.a=n}function ll(n){this.a=n}function bl(n){this.a=n}function wl(n){this.a=n}function dl(n){this.a=n}function gl(n){this.a=n}function pl(n){this.a=n}function vl(n){this.a=n}function ml(n){this.a=n}function yl(n){this.a=n}function kl(n){this.a=n}function jl(n){this.a=n}function El(n){this.a=n}function Tl(n){this.a=n}function Ml(n){this.a=n}function Sl(n){this.a=n}function Pl(n){this.a=n}function Cl(){this.a=[]}function Il(n,t){n.a=t}function Ol(n,t){n.a=t}function Al(n,t){n.b=t}function $l(n,t){n.b=t}function Ll(n,t){n.b=t}function Nl(n,t){n.j=t}function xl(n,t){n.g=t}function Dl(n,t){n.i=t}function Rl(n,t){n.c=t}function Kl(n,t){n.d=t}function _l(n,t){n.d=t}function Fl(n,t){n.c=t}function Bl(n,t){n.k=t}function Hl(n,t){n.c=t}function ql(n,t){n.c=t}function Gl(n,t){n.a=t}function zl(n,t){n.a=t}function Ul(n,t){n.f=t}function Xl(n,t){n.a=t}function Wl(n,t){n.b=t}function Vl(n,t){n.d=t}function Ql(n,t){n.i=t}function Yl(n,t){n.o=t}function Jl(n,t){n.r=t}function Zl(n,t){n.a=t}function nb(n,t){n.b=t}function tb(n,t){n.e=t}function eb(n,t){n.f=t}function ib(n,t){n.g=t}function rb(n,t){n.e=t}function cb(n,t){n.f=t}function ab(n,t){n.f=t}function ub(n,t){n.n=t}function ob(n,t){n.a=t}function sb(n,t){n.a=t}function hb(n,t){n.c=t}function fb(n,t){n.c=t}function lb(n,t){n.d=t}function bb(n,t){n.e=t}function wb(n,t){n.g=t}function db(n,t){n.a=t}function gb(n,t){n.c=t}function pb(n,t){n.d=t}function vb(n,t){n.e=t}function mb(n,t){n.f=t}function yb(n,t){n.j=t}function kb(n,t){n.a=t}function jb(n,t){n.b=t}function Eb(n,t){n.a=t}function Tb(n){n.b=n.a}function Mb(n){n.c=n.d.d}function Sb(n){this.d=n}function Pb(n){this.a=n}function Cb(n){this.a=n}function Ib(n){this.a=n}function Ob(n){this.a=n}function Ab(n){this.a=n}function $b(n){this.a=n}function Lb(n){this.a=n}function Nb(n){this.a=n}function xb(n){this.a=n}function Db(n){this.a=n}function Rb(n){this.a=n}function Kb(n){this.a=n}function _b(n){this.a=n}function Fb(n){this.a=n}function Bb(n){this.b=n}function Hb(n){this.b=n}function qb(n){this.b=n}function Gb(n){this.a=n}function zb(n){this.a=n}function Ub(n){this.a=n}function Xb(n){this.c=n}function Wb(n){this.c=n}function Vb(n){this.c=n}function Qb(n){this.a=n}function Yb(n){this.a=n}function Jb(n){this.a=n}function Zb(n){this.a=n}function nw(n){this.a=n}function tw(n){this.a=n}function ew(n){this.a=n}function iw(n){this.a=n}function rw(n){this.a=n}function cw(n){this.a=n}function aw(n){this.a=n}function uw(n){this.a=n}function ow(n){this.a=n}function sw(n){this.a=n}function hw(n){this.a=n}function fw(n){this.a=n}function lw(n){this.a=n}function bw(n){this.a=n}function ww(n){this.a=n}function dw(n){this.a=n}function gw(n){this.a=n}function pw(n){this.a=n}function vw(n){this.a=n}function mw(n){this.a=n}function yw(n){this.a=n}function kw(n){this.a=n}function jw(n){this.a=n}function Ew(n){this.a=n}function Tw(n){this.a=n}function Mw(n){this.a=n}function Sw(n){this.a=n}function Pw(n){this.a=n}function Cw(n){this.a=n}function Iw(n){this.a=n}function Ow(n){this.a=n}function Aw(n){this.a=n}function $w(n){this.a=n}function Lw(n){this.a=n}function Nw(n){this.a=n}function xw(n){this.a=n}function Dw(n){this.a=n}function Rw(n){this.a=n}function Kw(n){this.a=n}function _w(n){this.a=n}function Fw(n){this.a=n}function Bw(n){this.e=n}function Hw(n){this.a=n}function qw(n){this.a=n}function Gw(n){this.a=n}function zw(n){this.a=n}function Uw(n){this.a=n}function Xw(n){this.a=n}function Ww(n){this.a=n}function Vw(n){this.a=n}function Qw(n){this.a=n}function Yw(n){this.a=n}function Jw(n){this.a=n}function Zw(n){this.a=n}function nd(n){this.a=n}function td(n){this.a=n}function ed(n){this.a=n}function id(n){this.a=n}function rd(n){this.a=n}function cd(n){this.a=n}function ad(n){this.a=n}function ud(n){this.a=n}function od(n){this.a=n}function sd(n){this.a=n}function hd(n){this.a=n}function fd(n){this.a=n}function ld(n){this.a=n}function bd(n){this.a=n}function wd(n){this.a=n}function dd(n){this.a=n}function gd(n){this.a=n}function pd(n){this.a=n}function vd(n){this.a=n}function md(n){this.a=n}function yd(n){this.a=n}function kd(n){this.a=n}function jd(n){this.a=n}function Ed(n){this.a=n}function Td(n){this.a=n}function Md(n){this.a=n}function Sd(n){this.a=n}function Pd(n){this.a=n}function Cd(n){this.a=n}function Id(n){this.a=n}function Od(n){this.a=n}function Ad(n){this.a=n}function $d(n){this.a=n}function Ld(n){this.a=n}function Nd(n){this.a=n}function xd(n){this.a=n}function Dd(n){this.a=n}function Rd(n){this.a=n}function Kd(n){this.a=n}function _d(n){this.a=n}function Fd(n){this.a=n}function Bd(n){this.c=n}function Hd(n){this.b=n}function qd(n){this.a=n}function Gd(n){this.a=n}function zd(n){this.a=n}function Ud(n){this.a=n}function Xd(n){this.a=n}function Wd(n){this.a=n}function Vd(n){this.a=n}function Qd(n){this.a=n}function Yd(n){this.a=n}function Jd(n){this.a=n}function Zd(n){this.a=n}function ng(n){this.a=n}function tg(n){this.a=n}function eg(n){this.a=n}function ig(n){this.a=n}function rg(n){this.a=n}function cg(n){this.a=n}function ag(n){this.a=n}function ug(n){this.a=n}function og(n){this.a=n}function sg(n){this.a=n}function hg(n){this.a=n}function fg(n){this.a=n}function lg(n){this.a=n}function bg(n){this.a=n}function wg(n){this.a=n}function dg(n){this.a=n}function gg(n){this.a=n}function pg(n){this.a=n}function vg(n){this.a=n}function mg(n){this.a=n}function yg(n){this.a=n}function kg(n){this.a=n}function jg(n){this.a=n}function Eg(n){this.a=n}function Tg(n){this.a=n}function Mg(n){this.a=n}function Sg(n){this.a=n}function Pg(n){this.a=n}function Cg(n){this.a=n}function Ig(n){this.a=n}function Og(n){this.a=n}function Ag(n){this.a=n}function $g(n){this.a=n}function Lg(n){this.a=n}function Ng(n){this.a=n}function xg(n){this.a=n}function Dg(n){this.a=n}function Rg(n){this.a=n}function Kg(n){this.a=n}function _g(n){this.a=n}function Fg(n){this.a=n}function Bg(n){this.a=n}function Hg(n){this.a=n}function qg(n){this.a=n}function Gg(n){this.a=n}function zg(n){this.a=n}function Ug(n){this.a=n}function Xg(n){this.a=n}function Wg(n){this.a=n}function Vg(n){this.a=n}function Qg(n){this.a=n}function Yg(n){this.a=n}function Jg(n){this.a=n}function Zg(n){this.a=n}function np(n){this.a=n}function tp(n){this.a=n}function ep(n){this.a=n}function ip(n){this.a=n}function rp(n){this.a=n}function cp(n){this.a=n}function ap(n){this.a=n}function up(n){this.b=n}function op(n){this.f=n}function sp(n){this.a=n}function hp(n){this.a=n}function fp(n){this.a=n}function lp(n){this.a=n}function bp(n){this.a=n}function wp(n){this.a=n}function dp(n){this.a=n}function gp(n){this.a=n}function pp(n){this.a=n}function vp(n){this.a=n}function mp(n){this.a=n}function yp(n){this.b=n}function kp(n){this.c=n}function jp(n){this.e=n}function Ep(n){this.a=n}function Tp(n){this.a=n}function Mp(n){this.a=n}function Sp(n){this.a=n}function Pp(n){this.a=n}function Cp(n){this.d=n}function Ip(n){this.a=n}function Op(n){this.a=n}function Ap(n){this.e=n}function $p(){this.a=0}function Lp(){DA(this)}function Np(){xA(this)}function xp(){$U(this)}function Dp(){wV(this)}function Rp(){_h(this)}function Kp(){this.c=L$t}function _p(n,t){t.Wb(n)}function Fp(n,t){n.b+=t}function Bp(n){n.b=new ok}function Hp(n){return n.e}function qp(n){return n.a}function Gp(n){return n.a}function zp(n){return n.a}function Up(n){return n.a}function Xp(n){return n.a}function Wp(){return null}function Vp(){return null}function Qp(){aE(),dXn()}function Yp(n){n.b.tf(n.e)}function Jp(n,t){n.b=t-n.b}function Zp(n,t){n.a=t-n.a}function nv(n,t){t.ad(n.a)}function tv(n,t){qCn(t,n)}function ev(n,t,e){n.Od(e,t)}function iv(n,t){n.e=t,t.b=n}function rv(n){s_(),this.a=n}function cv(n){s_(),this.a=n}function av(n){s_(),this.a=n}function uv(n){WX(),this.a=n}function ov(n){PY(),ett.be(n)}function sv(){gN.call(this)}function hv(){gN.call(this)}function fv(){sv.call(this)}function lv(){sv.call(this)}function bv(){sv.call(this)}function wv(){sv.call(this)}function dv(){sv.call(this)}function gv(){sv.call(this)}function pv(){sv.call(this)}function vv(){sv.call(this)}function mv(){sv.call(this)}function yv(){sv.call(this)}function kv(){sv.call(this)}function jv(){this.a=this}function Ev(){this.Bb|=256}function Tv(){this.b=new PO}function Mv(){Mv=O,new xp}function Sv(){fv.call(this)}function Pv(n,t){n.length=t}function Cv(n,t){WB(n.a,t)}function Iv(n,t){USn(n.c,t)}function Ov(n,t){TU(n.b,t)}function Av(n,t){Ivn(n.a,t)}function $v(n,t){Oln(n.a,t)}function Lv(n,t){ban(n.e,t)}function Nv(n){AOn(n.c,n.b)}function xv(n,t){n.kc().Nb(t)}function Dv(n){this.a=gbn(n)}function Rv(){this.a=new xp}function Kv(){this.a=new xp}function _v(){this.a=new Np}function Fv(){this.a=new Np}function Bv(){this.a=new Np}function Hv(){this.a=new kn}function qv(){this.a=new k6}function Gv(){this.a=new bt}function zv(){this.a=new WT}function Uv(){this.a=new D0}function Xv(){this.a=new cZ}function Wv(){this.a=new AR}function Vv(){this.a=new Np}function Qv(){this.a=new Np}function Yv(){this.a=new Np}function Jv(){this.a=new Np}function Zv(){this.d=new Np}function nm(){this.a=new Rv}function tm(){this.a=new xp}function em(){this.b=new xp}function im(){this.b=new Np}function rm(){this.e=new Np}function cm(){this.d=new Np}function am(){this.a=new uf}function um(){Np.call(this)}function om(){_v.call(this)}function sm(){NR.call(this)}function hm(){Qv.call(this)}function fm(){lm.call(this)}function lm(){Rp.call(this)}function bm(){Rp.call(this)}function wm(){bm.call(this)}function dm(){dY.call(this)}function gm(){dY.call(this)}function pm(){Wm.call(this)}function vm(){Wm.call(this)}function mm(){Wm.call(this)}function ym(){Vm.call(this)}function km(){YT.call(this)}function jm(){eo.call(this)}function Em(){eo.call(this)}function Tm(){ny.call(this)}function Mm(){ny.call(this)}function Sm(){xp.call(this)}function Pm(){xp.call(this)}function Cm(){xp.call(this)}function Im(){Rv.call(this)}function Om(){jin.call(this)}function Am(){Ev.call(this)}function $m(){OL.call(this)}function Lm(){OL.call(this)}function Nm(){xp.call(this)}function xm(){xp.call(this)}function Dm(){xp.call(this)}function Rm(){yo.call(this)}function Km(){yo.call(this)}function _m(){Rm.call(this)}function Fm(){Dh.call(this)}function Bm(n){dtn.call(this,n)}function Hm(n){dtn.call(this,n)}function qm(n){Qf.call(this,n)}function Gm(n){MT.call(this,n)}function zm(n){Gm.call(this,n)}function Um(n){MT.call(this,n)}function Xm(){this.a=new YT}function Wm(){this.a=new Rv}function Vm(){this.a=new xp}function Qm(){this.a=new Np}function Ym(){this.j=new Np}function Jm(){this.a=new Xa}function Zm(){this.a=new LE}function ny(){this.a=new mo}function ty(){ty=O,_nt=new xk}function ey(){ey=O,Knt=new Nk}function iy(){iy=O,Ont=new c}function ry(){ry=O,znt=new cN}function cy(n){Gm.call(this,n)}function ay(n){Gm.call(this,n)}function uy(n){d4.call(this,n)}function oy(n){d4.call(this,n)}function sy(n){VK.call(this,n)}function hy(n){ySn.call(this,n)}function fy(n){CT.call(this,n)}function ly(n){OT.call(this,n)}function by(n){OT.call(this,n)}function wy(n){OT.call(this,n)}function dy(n){fz.call(this,n)}function gy(n){dy.call(this,n)}function py(){Pl.call(this,{})}function vy(n){CL(),this.a=n}function my(n){n.b=null,n.c=0}function yy(n,t){n.e=t,Cxn(n,t)}function ky(n,t){n.a=t,aCn(n)}function jy(n,t,e){n.a[t.g]=e}function Ey(n,t,e){wjn(e,n,t)}function Ty(n,t){ZR(t.i,n.n)}function My(n,t){ssn(n).td(t)}function Sy(n,t){return n*n/t}function Py(n,t){return n.g-t.g}function Cy(n){return new Sl(n)}function Iy(n){return new GX(n)}function Oy(n){dy.call(this,n)}function Ay(n){dy.call(this,n)}function $y(n){dy.call(this,n)}function Ly(n){fz.call(this,n)}function Ny(n){_cn(),this.a=n}function xy(n){a_(),this.a=n}function Dy(n){FG(),this.f=n}function Ry(n){FG(),this.f=n}function Ky(n){dy.call(this,n)}function _y(n){dy.call(this,n)}function Fy(n){dy.call(this,n)}function By(n){dy.call(this,n)}function Hy(n){dy.call(this,n)}function qy(n){return kW(n),n}function Gy(n){return kW(n),n}function zy(n){return kW(n),n}function Uy(n){return kW(n),n}function Xy(n){return kW(n),n}function Wy(n){return n.b==n.c}function Vy(n){return!!n&&n.b}function Qy(n){return!!n&&n.k}function Yy(n){return!!n&&n.j}function Jy(n){kW(n),this.a=n}function Zy(n){return Zon(n),n}function nk(n){vU(n,n.length)}function tk(n){dy.call(this,n)}function ek(n){dy.call(this,n)}function ik(n){dy.call(this,n)}function rk(n){dy.call(this,n)}function ck(n){dy.call(this,n)}function ak(n){dy.call(this,n)}function uk(n){ZN.call(this,n,0)}function ok(){o1.call(this,12,3)}function sk(){sk=O,ttt=new j}function hk(){hk=O,Ynt=new r}function fk(){fk=O,rtt=new g}function lk(){lk=O,htt=new v}function bk(){throw Hp(new pv)}function wk(){throw Hp(new pv)}function dk(){throw Hp(new pv)}function gk(){throw Hp(new pv)}function pk(){throw Hp(new pv)}function vk(){throw Hp(new pv)}function mk(){this.a=SD(yX(FWn))}function yk(n){s_(),this.a=yX(n)}function kk(n,t){n.Td(t),t.Sd(n)}function jk(n,t){n.a.ec().Mc(t)}function Ek(n,t,e){n.c.lf(t,e)}function Tk(n){Ay.call(this,n)}function Mk(n){_y.call(this,n)}function Sk(){Ab.call(this,"")}function Pk(){Ab.call(this,"")}function Ck(){Ab.call(this,"")}function Ik(){Ab.call(this,"")}function Ok(n){Ay.call(this,n)}function Ak(n){Hb.call(this,n)}function $k(n){bN.call(this,n)}function Lk(n){Ak.call(this,n)}function Nk(){tl.call(this,null)}function xk(){tl.call(this,null)}function Dk(){Dk=O,PY()}function Rk(){Rk=O,ket=mEn()}function Kk(n){return n.a?n.b:0}function _k(n){return n.a?n.b:0}function Fk(n,t){return n.a-t.a}function Bk(n,t){return n.a-t.a}function Hk(n,t){return n.a-t.a}function qk(n,t){return m7(n,t)}function Gk(n,t){return gZ(n,t)}function zk(n,t){return t in n.a}function Uk(n,t){return n.f=t,n}function Xk(n,t){return n.b=t,n}function Wk(n,t){return n.c=t,n}function Vk(n,t){return n.g=t,n}function Qk(n,t){return n.a=t,n}function Yk(n,t){return n.f=t,n}function Jk(n,t){return n.k=t,n}function Zk(n,t){return n.a=t,n}function nj(n,t){return n.e=t,n}function tj(n,t){return n.e=t,n}function ej(n,t){return n.f=t,n}function ij(n,t){n.b=!0,n.d=t}function rj(n,t){n.b=new wA(t)}function cj(n,t,e){t.td(n.a[e])}function aj(n,t,e){t.we(n.a[e])}function uj(n,t){return n.b-t.b}function oj(n,t){return n.g-t.g}function sj(n,t){return n.s-t.s}function hj(n,t){return n?0:t-1}function fj(n,t){return n?0:t-1}function lj(n,t){return n?t-1:0}function bj(n,t){return t.Yf(n)}function wj(n,t){return n.b=t,n}function dj(n,t){return n.a=t,n}function gj(n,t){return n.c=t,n}function pj(n,t){return n.d=t,n}function vj(n,t){return n.e=t,n}function mj(n,t){return n.f=t,n}function yj(n,t){return n.a=t,n}function kj(n,t){return n.b=t,n}function jj(n,t){return n.c=t,n}function Ej(n,t){return n.c=t,n}function Tj(n,t){return n.b=t,n}function Mj(n,t){return n.d=t,n}function Sj(n,t){return n.e=t,n}function Pj(n,t){return n.f=t,n}function Cj(n,t){return n.g=t,n}function Ij(n,t){return n.a=t,n}function Oj(n,t){return n.i=t,n}function Aj(n,t){return n.j=t,n}function $j(n,t){return n.k=t,n}function Lj(n,t){return n.j=t,n}function Nj(n,t){_Mn(),CZ(t,n)}function xj(n,t,e){GG(n.a,t,e)}function Dj(n){BV.call(this,n)}function Rj(n){BV.call(this,n)}function Kj(n){n_.call(this,n)}function _j(n){qbn.call(this,n)}function Fj(n){gtn.call(this,n)}function Bj(n){pQ.call(this,n)}function Hj(n){pQ.call(this,n)}function qj(){O$.call(this,"")}function Gj(){this.a=0,this.b=0}function zj(){this.b=0,this.a=0}function Uj(n,t){n.b=0,Nen(n,t)}function Xj(n,t){n.c=t,n.b=!0}function Wj(n,t){return n.c._b(t)}function Vj(n){return n.e&&n.e()}function Qj(n){return n?n.d:null}function Yj(n,t){return gfn(n.b,t)}function Jj(n){return n?n.g:null}function Zj(n){return n?n.i:null}function nE(n){return ED(n),n.o}function tE(){tE=O,dOt=Xkn()}function eE(){eE=O,gOt=oTn()}function iE(){iE=O,n$t=Vkn()}function rE(){rE=O,dLt=Wkn()}function cE(){cE=O,gLt=iCn()}function aE(){aE=O,lAt=cin()}function uE(){throw Hp(new pv)}function oE(){throw Hp(new pv)}function sE(){throw Hp(new pv)}function hE(){throw Hp(new pv)}function fE(){throw Hp(new pv)}function lE(){throw Hp(new pv)}function bE(n){this.a=new XT(n)}function wE(n){lUn(),DXn(this,n)}function dE(n){this.a=new Wz(n)}function gE(n,t){for(;n.ye(t););}function pE(n,t){for(;n.sd(t););}function vE(n,t){return n.a+=t,n}function mE(n,t){return n.a+=t,n}function yE(n,t){return n.a+=t,n}function kE(n,t){return n.a+=t,n}function jE(n){return EW(n),n.a}function EE(n){return n.b!=n.d.c}function TE(n){return n.l|n.m<<22}function ME(n,t){return n.d[t.p]}function SE(n,t){return Sxn(n,t)}function PE(n,t,e){n.splice(t,e)}function CE(n){n.c?NDn(n):xDn(n)}function IE(n){this.a=0,this.b=n}function OE(){this.a=new CNn(ijt)}function AE(){this.b=new CNn(qyt)}function $E(){this.b=new CNn(WEt)}function LE(){this.b=new CNn(WEt)}function NE(){throw Hp(new pv)}function xE(){throw Hp(new pv)}function DE(){throw Hp(new pv)}function RE(){throw Hp(new pv)}function KE(){throw Hp(new pv)}function _E(){throw Hp(new pv)}function FE(){throw Hp(new pv)}function BE(){throw Hp(new pv)}function HE(){throw Hp(new pv)}function qE(){throw Hp(new pv)}function GE(){throw Hp(new yv)}function zE(){throw Hp(new yv)}function UE(n){this.a=new XE(n)}function XE(n){Gin(this,n,OEn())}function WE(n){return!n||pW(n)}function VE(n){return-1!=WLt[n]}function QE(){0!=ctt&&(ctt=0),utt=-1}function YE(){null==PWn&&(PWn=[])}function JE(n,t){tAn(QQ(n.a),t)}function ZE(n,t){tAn(QQ(n.a),t)}function nT(n,t){HL.call(this,n,t)}function tT(n,t){nT.call(this,n,t)}function eT(n,t){this.b=n,this.c=t}function iT(n,t){this.b=n,this.a=t}function rT(n,t){this.a=n,this.b=t}function cT(n,t){this.a=n,this.b=t}function aT(n,t){this.a=n,this.b=t}function uT(n,t){this.a=n,this.b=t}function oT(n,t){this.a=n,this.b=t}function sT(n,t){this.a=n,this.b=t}function hT(n,t){this.a=n,this.b=t}function fT(n,t){this.a=n,this.b=t}function lT(n,t){this.b=n,this.a=t}function bT(n,t){this.b=n,this.a=t}function wT(n,t){this.b=n,this.a=t}function dT(n,t){this.b=n,this.a=t}function gT(n,t){this.f=n,this.g=t}function pT(n,t){this.e=n,this.d=t}function vT(n,t){this.g=n,this.i=t}function mT(n,t){this.a=n,this.b=t}function yT(n,t){this.a=n,this.f=t}function kT(n,t){this.b=n,this.c=t}function jT(n,t){this.a=n,this.b=t}function ET(n,t){this.a=n,this.b=t}function TT(n,t){this.a=n,this.b=t}function MT(n){aN(n.dc()),this.c=n}function ST(n){this.b=BB(yX(n),83)}function PT(n){this.a=BB(yX(n),83)}function CT(n){this.a=BB(yX(n),15)}function IT(n){this.a=BB(yX(n),15)}function OT(n){this.b=BB(yX(n),47)}function AT(){this.q=new e.Date}function $T(){$T=O,Btt=new A}function LT(){LT=O,bet=new P}function NT(n){return n.f.c+n.g.c}function xT(n,t){return n.b.Hc(t)}function DT(n,t){return n.b.Ic(t)}function RT(n,t){return n.b.Qc(t)}function KT(n,t){return n.b.Hc(t)}function _T(n,t){return n.c.uc(t)}function FT(n,t){return n.a._b(t)}function BT(n,t){return Nfn(n.c,t)}function HT(n,t){return hU(n.b,t)}function qT(n,t){return n>t&&t0}function sS(n,t){return Vhn(n,t)<0}function hS(n,t){return n.a.get(t)}function fS(n,t){return t.split(n)}function lS(n,t){return hU(n.e,t)}function bS(n){return kW(n),!1}function wS(n){w1.call(this,n,21)}function dS(n,t){_J.call(this,n,t)}function gS(n,t){gT.call(this,n,t)}function pS(n,t){gT.call(this,n,t)}function vS(n){VX(),VK.call(this,n)}function mS(n,t){jG(n,n.length,t)}function yS(n,t){QU(n,n.length,t)}function kS(n,t,e){t.ud(n.a.Ge(e))}function jS(n,t,e){t.we(n.a.Fe(e))}function ES(n,t,e){t.td(n.a.Kb(e))}function TS(n,t,e){n.Mb(e)&&t.td(e)}function MS(n,t,e){n.splice(t,0,e)}function SS(n,t){return SN(n.e,t)}function PS(n,t){this.d=n,this.e=t}function CS(n,t){this.b=n,this.a=t}function IS(n,t){this.b=n,this.a=t}function OS(n,t){this.b=n,this.a=t}function AS(n,t){this.a=n,this.b=t}function $S(n,t){this.a=n,this.b=t}function LS(n,t){this.a=n,this.b=t}function NS(n,t){this.a=n,this.b=t}function xS(n,t){this.a=n,this.b=t}function DS(n,t){this.b=n,this.a=t}function RS(n,t){this.b=n,this.a=t}function KS(n,t){gT.call(this,n,t)}function _S(n,t){gT.call(this,n,t)}function FS(n,t){gT.call(this,n,t)}function BS(n,t){gT.call(this,n,t)}function HS(n,t){gT.call(this,n,t)}function qS(n,t){gT.call(this,n,t)}function GS(n,t){gT.call(this,n,t)}function zS(n,t){gT.call(this,n,t)}function US(n,t){gT.call(this,n,t)}function XS(n,t){gT.call(this,n,t)}function WS(n,t){gT.call(this,n,t)}function VS(n,t){gT.call(this,n,t)}function QS(n,t){gT.call(this,n,t)}function YS(n,t){gT.call(this,n,t)}function JS(n,t){gT.call(this,n,t)}function ZS(n,t){gT.call(this,n,t)}function nP(n,t){gT.call(this,n,t)}function tP(n,t){gT.call(this,n,t)}function eP(n,t){this.a=n,this.b=t}function iP(n,t){this.a=n,this.b=t}function rP(n,t){this.a=n,this.b=t}function cP(n,t){this.a=n,this.b=t}function aP(n,t){this.a=n,this.b=t}function uP(n,t){this.a=n,this.b=t}function oP(n,t){this.a=n,this.b=t}function sP(n,t){this.a=n,this.b=t}function hP(n,t){this.a=n,this.b=t}function fP(n,t){this.b=n,this.a=t}function lP(n,t){this.b=n,this.a=t}function bP(n,t){this.b=n,this.a=t}function wP(n,t){this.b=n,this.a=t}function dP(n,t){this.c=n,this.d=t}function gP(n,t){this.e=n,this.d=t}function pP(n,t){this.a=n,this.b=t}function vP(n,t){this.b=t,this.c=n}function mP(n,t){gT.call(this,n,t)}function yP(n,t){gT.call(this,n,t)}function kP(n,t){gT.call(this,n,t)}function jP(n,t){gT.call(this,n,t)}function EP(n,t){gT.call(this,n,t)}function TP(n,t){gT.call(this,n,t)}function MP(n,t){gT.call(this,n,t)}function SP(n,t){gT.call(this,n,t)}function PP(n,t){gT.call(this,n,t)}function CP(n,t){gT.call(this,n,t)}function IP(n,t){gT.call(this,n,t)}function OP(n,t){gT.call(this,n,t)}function AP(n,t){gT.call(this,n,t)}function $P(n,t){gT.call(this,n,t)}function LP(n,t){gT.call(this,n,t)}function NP(n,t){gT.call(this,n,t)}function xP(n,t){gT.call(this,n,t)}function DP(n,t){gT.call(this,n,t)}function RP(n,t){gT.call(this,n,t)}function KP(n,t){gT.call(this,n,t)}function _P(n,t){gT.call(this,n,t)}function FP(n,t){gT.call(this,n,t)}function BP(n,t){gT.call(this,n,t)}function HP(n,t){gT.call(this,n,t)}function qP(n,t){gT.call(this,n,t)}function GP(n,t){gT.call(this,n,t)}function zP(n,t){gT.call(this,n,t)}function UP(n,t){gT.call(this,n,t)}function XP(n,t){gT.call(this,n,t)}function WP(n,t){gT.call(this,n,t)}function VP(n,t){gT.call(this,n,t)}function QP(n,t){gT.call(this,n,t)}function YP(n,t){gT.call(this,n,t)}function JP(n,t){gT.call(this,n,t)}function ZP(n,t){this.b=n,this.a=t}function nC(n,t){this.a=n,this.b=t}function tC(n,t){this.a=n,this.b=t}function eC(n,t){this.a=n,this.b=t}function iC(n,t){this.a=n,this.b=t}function rC(n,t){gT.call(this,n,t)}function cC(n,t){gT.call(this,n,t)}function aC(n,t){this.b=n,this.d=t}function uC(n,t){gT.call(this,n,t)}function oC(n,t){gT.call(this,n,t)}function sC(n,t){this.a=n,this.b=t}function hC(n,t){this.a=n,this.b=t}function fC(n,t){gT.call(this,n,t)}function lC(n,t){gT.call(this,n,t)}function bC(n,t){gT.call(this,n,t)}function wC(n,t){gT.call(this,n,t)}function dC(n,t){gT.call(this,n,t)}function gC(n,t){gT.call(this,n,t)}function pC(n,t){gT.call(this,n,t)}function vC(n,t){gT.call(this,n,t)}function mC(n,t){gT.call(this,n,t)}function yC(n,t){gT.call(this,n,t)}function kC(n,t){gT.call(this,n,t)}function jC(n,t){gT.call(this,n,t)}function EC(n,t){gT.call(this,n,t)}function TC(n,t){gT.call(this,n,t)}function MC(n,t){gT.call(this,n,t)}function SC(n,t){gT.call(this,n,t)}function PC(n,t){return SN(n.c,t)}function CC(n,t){return SN(t.b,n)}function IC(n,t){return-n.b.Je(t)}function OC(n,t){return SN(n.g,t)}function AC(n,t){gT.call(this,n,t)}function $C(n,t){gT.call(this,n,t)}function LC(n,t){this.a=n,this.b=t}function NC(n,t){this.a=n,this.b=t}function xC(n,t){this.a=n,this.b=t}function DC(n,t){gT.call(this,n,t)}function RC(n,t){gT.call(this,n,t)}function KC(n,t){gT.call(this,n,t)}function _C(n,t){gT.call(this,n,t)}function FC(n,t){gT.call(this,n,t)}function BC(n,t){gT.call(this,n,t)}function HC(n,t){gT.call(this,n,t)}function qC(n,t){gT.call(this,n,t)}function GC(n,t){gT.call(this,n,t)}function zC(n,t){gT.call(this,n,t)}function UC(n,t){gT.call(this,n,t)}function XC(n,t){gT.call(this,n,t)}function WC(n,t){gT.call(this,n,t)}function VC(n,t){gT.call(this,n,t)}function QC(n,t){gT.call(this,n,t)}function YC(n,t){gT.call(this,n,t)}function JC(n,t){this.a=n,this.b=t}function ZC(n,t){this.a=n,this.b=t}function nI(n,t){this.a=n,this.b=t}function tI(n,t){this.a=n,this.b=t}function eI(n,t){this.a=n,this.b=t}function iI(n,t){this.a=n,this.b=t}function rI(n,t){this.a=n,this.b=t}function cI(n,t){gT.call(this,n,t)}function aI(n,t){this.a=n,this.b=t}function uI(n,t){this.a=n,this.b=t}function oI(n,t){this.a=n,this.b=t}function sI(n,t){this.a=n,this.b=t}function hI(n,t){this.a=n,this.b=t}function fI(n,t){this.a=n,this.b=t}function lI(n,t){this.b=n,this.a=t}function bI(n,t){this.b=n,this.a=t}function wI(n,t){this.b=n,this.a=t}function dI(n,t){this.b=n,this.a=t}function gI(n,t){this.a=n,this.b=t}function pI(n,t){this.a=n,this.b=t}function vI(n,t){JLn(n.a,BB(t,56))}function mI(n,t){v7(n.a,BB(t,11))}function yI(n,t){return hH(),t!=n}function kI(){return Rk(),new ket}function jI(){qZ(),this.b=new Rv}function EI(){dxn(),this.a=new Rv}function TI(){KZ(),KG.call(this)}function MI(n,t){gT.call(this,n,t)}function SI(n,t){this.a=n,this.b=t}function PI(n,t){this.a=n,this.b=t}function CI(n,t){this.a=n,this.b=t}function II(n,t){this.a=n,this.b=t}function OI(n,t){this.a=n,this.b=t}function AI(n,t){this.a=n,this.b=t}function $I(n,t){this.d=n,this.b=t}function LI(n,t){this.d=n,this.e=t}function NI(n,t){this.f=n,this.c=t}function xI(n,t){this.b=n,this.c=t}function DI(n,t){this.i=n,this.g=t}function RI(n,t){this.e=n,this.a=t}function KI(n,t){this.a=n,this.b=t}function _I(n,t){n.i=null,arn(n,t)}function FI(n,t){n&&VW(hAt,n,t)}function BI(n,t){return rdn(n.a,t)}function HI(n){return adn(n.c,n.b)}function qI(n){return n?n.dd():null}function GI(n){return null==n?null:n}function zI(n){return typeof n===$Wn}function UI(n){return typeof n===LWn}function XI(n){return typeof n===NWn}function WI(n,t){return n.Hd().Xb(t)}function VI(n,t){return Qcn(n.Kc(),t)}function QI(n,t){return 0==Vhn(n,t)}function YI(n,t){return Vhn(n,t)>=0}function JI(n,t){return 0!=Vhn(n,t)}function ZI(n){return""+(kW(n),n)}function nO(n,t){return n.substr(t)}function tO(n){return zbn(n),n.d.gc()}function eO(n){return zOn(n,n.c),n}function iO(n){return JH(null==n),n}function rO(n,t){return n.a+=""+t,n}function cO(n,t){return n.a+=""+t,n}function aO(n,t){return n.a+=""+t,n}function uO(n,t){return n.a+=""+t,n}function oO(n,t){return n.a+=""+t,n}function sO(n,t){return n.a+=""+t,n}function hO(n,t){r5(n,t,n.a,n.a.a)}function fO(n,t){r5(n,t,n.c.b,n.c)}function lO(n,t,e){Kjn(t,RPn(n,e))}function bO(n,t,e){Kjn(t,RPn(n,e))}function wO(n,t){Tnn(new AL(n),t)}function dO(n,t){n.q.setTime(j2(t))}function gO(n,t){zz.call(this,n,t)}function pO(n,t){zz.call(this,n,t)}function vO(n,t){zz.call(this,n,t)}function mO(n){$U(this),Tcn(this,n)}function yO(n){return l1(n,0),null}function kO(n){return n.a=0,n.b=0,n}function jO(n,t){return n.a=t.g+1,n}function EO(n,t){return 2==n.j[t.p]}function TO(n){return sX(BB(n,79))}function MO(){MO=O,Art=lhn(tpn())}function SO(){SO=O,Zot=lhn(ENn())}function PO(){this.b=new XT(etn(12))}function CO(){this.b=0,this.a=!1}function IO(){this.b=0,this.a=!1}function OO(n){this.a=n,Bh.call(this)}function AO(n){this.a=n,Bh.call(this)}function $O(n,t){iR.call(this,n,t)}function LO(n,t){tK.call(this,n,t)}function NO(n,t){DI.call(this,n,t)}function xO(n,t){Aan.call(this,n,t)}function DO(n,t){QN.call(this,n,t)}function RO(n,t){nS(),VW(mAt,n,t)}function KO(n,t){return fx(n.a,0,t)}function _O(n,t){return n.a.a.a.cc(t)}function FO(n,t){return GI(n)===GI(t)}function BO(n,t){return Pln(n.a,t.a)}function HO(n,t){return E$(n.a,t.a)}function qO(n,t){return FU(n.a,t.a)}function GO(n,t){return n.indexOf(t)}function zO(n,t){return n==t?0:n?1:-1}function UO(n){return n<10?"0"+n:""+n}function XO(n){return yX(n),new OO(n)}function WO(n){return M$(n.l,n.m,n.h)}function VO(n){return CJ((kW(n),n))}function QO(n){return CJ((kW(n),n))}function YO(n,t){return E$(n.g,t.g)}function JO(n){return typeof n===LWn}function ZO(n){return n==Zat||n==eut}function nA(n){return n==Zat||n==nut}function tA(n){return E7(n.b.b,n,0)}function eA(n){this.a=kI(),this.b=n}function iA(n){this.a=kI(),this.b=n}function rA(n,t){return WB(n.a,t),t}function cA(n,t){return WB(n.c,t),n}function aA(n,t){return Jcn(n.a,t),n}function uA(n,t){return G_(),t.a+=n}function oA(n,t){return G_(),t.a+=n}function sA(n,t){return G_(),t.c+=n}function hA(n,t){z9(n,0,n.length,t)}function fA(){ew.call(this,new v4)}function lA(){uG.call(this,0,0,0,0)}function bA(){UV.call(this,0,0,0,0)}function wA(n){this.a=n.a,this.b=n.b}function dA(n){return n==_Pt||n==FPt}function gA(n){return n==HPt||n==KPt}function pA(n){return n==fvt||n==hvt}function vA(n){return n!=QCt&&n!=YCt}function mA(n){return n.Lg()&&n.Mg()}function yA(n){return mV(BB(n,118))}function kA(n){return Jcn(new B2,n)}function jA(n,t){return new Aan(t,n)}function EA(n,t){return new Aan(t,n)}function TA(n,t,e){jen(n,t),Een(n,e)}function MA(n,t,e){Sen(n,t),Men(n,e)}function SA(n,t,e){Pen(n,t),Cen(n,e)}function PA(n,t,e){Ten(n,t),Oen(n,e)}function CA(n,t,e){Ien(n,t),Aen(n,e)}function IA(n,t){Dsn(n,t),xen(n,n.D)}function OA(n){NI.call(this,n,!0)}function AA(n,t,e){ND.call(this,n,t,e)}function $A(n){ODn(),san.call(this,n)}function LA(){gS.call(this,"Head",1)}function NA(){gS.call(this,"Tail",3)}function xA(n){n.c=x8(Ant,HWn,1,0,5,1)}function DA(n){n.a=x8(Ant,HWn,1,8,5,1)}function RA(n){Otn(n.xf(),new Sw(n))}function KA(n){return null!=n?nsn(n):0}function _A(n,t){return Ctn(t,WJ(n))}function FA(n,t){return Ctn(t,WJ(n))}function BA(n,t){return n[n.length]=t}function HA(n,t){return n[n.length]=t}function qA(n){return FB(n.b.Kc(),n.a)}function GA(n,t){return Uin(PX(n.d),t)}function zA(n,t){return Uin(PX(n.g),t)}function UA(n,t){return Uin(PX(n.j),t)}function XA(n,t){iR.call(this,n.b,t)}function WA(n){uG.call(this,n,n,n,n)}function VA(n){return n.b&&VBn(n),n.a}function QA(n){return n.b&&VBn(n),n.c}function YA(n,t){Qet||(n.b=t)}function JA(n,t,e){return $X(n,t,e),e}function ZA(n,t,e){$X(n.c[t.g],t.g,e)}function n$(n,t,e){BB(n.c,69).Xh(t,e)}function t$(n,t,e){SA(e,e.i+n,e.j+t)}function e$(n,t){f9(a4(n.a),e1(t))}function i$(n,t){f9(H7(n.a),i1(t))}function r$(n){wWn(),Ap.call(this,n)}function c$(n){return null==n?0:nsn(n)}function a$(){a$=O,syt=new Hbn(oCt)}function u$(){u$=O,new o$,new Np}function o$(){new xp,new xp,new xp}function s$(){s$=O,Mv(),itt=new xp}function h$(){h$=O,e.Math.log(2)}function f$(){f$=O,zM(),R$t=COt}function l$(){throw Hp(new tk(Tnt))}function b$(){throw Hp(new tk(Tnt))}function w$(){throw Hp(new tk(Mnt))}function d$(){throw Hp(new tk(Mnt))}function g$(n){this.a=n,QB.call(this,n)}function p$(n){this.a=n,ST.call(this,n)}function v$(n){this.a=n,ST.call(this,n)}function m$(n,t){yG(n.c,n.c.length,t)}function y$(n){return n.at?1:0}function T$(n,t){return Vhn(n,t)>0?n:t}function M$(n,t,e){return{l:n,m:t,h:e}}function S$(n,t){null!=n.a&&mI(t,n.a)}function P$(n){n.a=new $,n.c=new $}function C$(n){this.b=n,this.a=new Np}function I$(n){this.b=new et,this.a=n}function O$(n){LR.call(this),this.a=n}function A$(){gS.call(this,"Range",2)}function $$(){tjn(),this.a=new CNn(Uat)}function L$(n,t){yX(t),EV(n).Jc(new b)}function N$(n,t){return BZ(),t.n.b+=n}function x$(n,t,e){return VW(n.g,e,t)}function D$(n,t,e){return VW(n.k,e,t)}function R$(n,t){return VW(n.a,t.a,t)}function K$(n,t,e){return Idn(t,e,n.c)}function _$(n){return new xC(n.c,n.d)}function F$(n){return new xC(n.c,n.d)}function B$(n){return new xC(n.a,n.b)}function H$(n,t){return tzn(n.a,t,null)}function q$(n){SZ(n,null),MZ(n,null)}function G$(n){WZ(n,null),VZ(n,null)}function z$(){QN.call(this,null,null)}function U$(){YN.call(this,null,null)}function X$(n){this.a=n,xp.call(this)}function W$(n){this.b=(SQ(),new Xb(n))}function V$(n){n.j=x8(Ftt,sVn,310,0,0,1)}function Q$(n,t,e){n.c.Vc(t,BB(e,133))}function Y$(n,t,e){n.c.ji(t,BB(e,133))}function J$(n,t){sqn(n),n.Gc(BB(t,15))}function Z$(n,t){return Bqn(n.c,n.b,t)}function nL(n,t){return new pN(n.Kc(),t)}function tL(n,t){return-1!=Fun(n.Kc(),t)}function eL(n,t){return null!=n.a.Bc(t)}function iL(n){return n.Ob()?n.Pb():null}function rL(n){return Bdn(n,0,n.length)}function cL(n,t){return null!=n&&Qpn(n,t)}function aL(n,t){n.q.setHours(t),lBn(n,t)}function uL(n,t){n.c&&(RH(t),kJ(t))}function oL(n,t,e){BB(n.Kb(e),164).Nb(t)}function sL(n,t,e){return HGn(n,t,e),e}function hL(n,t,e){n.a=1502^t,n.b=e^aYn}function fL(n,t,e){return n.a[t.g][e.g]}function lL(n,t){return n.a[t.c.p][t.p]}function bL(n,t){return n.e[t.c.p][t.p]}function wL(n,t){return n.c[t.c.p][t.p]}function dL(n,t){return n.j[t.p]=pLn(t)}function gL(n,t){return f6(n.f,t.tg())}function pL(n,t){return f6(n.b,t.tg())}function vL(n,t){return n.a0?t*t/n:t*t*100}function xx(n,t){return n>0?t/(n*n):100*t}function Dx(n,t,e){return WB(t,own(n,e))}function Rx(n,t,e){x9(),n.Xe(t)&&e.td(n)}function Kx(n,t,e){n.Zc(t).Rb(e)}function _x(n,t,e){return n.a+=t,n.b+=e,n}function Fx(n,t,e){return n.a*=t,n.b*=e,n}function Bx(n,t,e){return n.a-=t,n.b-=e,n}function Hx(n,t){return n.a=t.a,n.b=t.b,n}function qx(n){return n.a=-n.a,n.b=-n.b,n}function Gx(n){this.c=n,this.a=1,this.b=1}function zx(n){this.c=n,Pen(n,0),Cen(n,0)}function Ux(n){YT.call(this),nin(this,n)}function Xx(n){RXn(),Bp(this),this.mf(n)}function Wx(n,t){QM(),QN.call(this,n,t)}function Vx(n,t){YM(),YN.call(this,n,t)}function Qx(n,t){YM(),YN.call(this,n,t)}function Yx(n,t){YM(),Vx.call(this,n,t)}function Jx(n,t,e){y9.call(this,n,t,e,2)}function Zx(n,t){f$(),cG.call(this,n,t)}function nD(n,t){f$(),Zx.call(this,n,t)}function tD(n,t){f$(),Zx.call(this,n,t)}function eD(n,t){f$(),tD.call(this,n,t)}function iD(n,t){f$(),cG.call(this,n,t)}function rD(n,t){f$(),iD.call(this,n,t)}function cD(n,t){f$(),cG.call(this,n,t)}function aD(n,t){return n.c.Fc(BB(t,133))}function uD(n,t,e){return NHn(F7(n,t),e)}function oD(n,t,e){return t.Qk(n.e,n.c,e)}function sD(n,t,e){return t.Rk(n.e,n.c,e)}function hD(n,t){return tfn(n.e,BB(t,49))}function fD(n,t,e){sln(H7(n.a),t,i1(e))}function lD(n,t,e){sln(a4(n.a),t,e1(e))}function bD(n,t){t.$modCount=n.$modCount}function wD(){wD=O,Vkt=new up("root")}function dD(){dD=O,pAt=new Tm,new Mm}function gD(){this.a=new pJ,this.b=new pJ}function pD(){jin.call(this),this.Bb|=BQn}function vD(){gT.call(this,"GROW_TREE",0)}function mD(n){return null==n?null:wUn(n)}function yD(n){return null==n?null:LSn(n)}function kD(n){return null==n?null:Bbn(n)}function jD(n){return null==n?null:Bbn(n)}function ED(n){null==n.o&&g$n(n)}function TD(n){return JH(null==n||zI(n)),n}function MD(n){return JH(null==n||UI(n)),n}function SD(n){return JH(null==n||XI(n)),n}function PD(n){this.q=new e.Date(j2(n))}function CD(n,t){this.c=n,pT.call(this,n,t)}function ID(n,t){this.a=n,CD.call(this,n,t)}function OD(n,t){this.d=n,Mb(this),this.b=t}function AD(n,t){B8.call(this,n),this.a=t}function $D(n,t){B8.call(this,n),this.a=t}function LD(n){qwn.call(this,0,0),this.f=n}function ND(n,t,e){W6.call(this,n,t,e,null)}function xD(n,t,e){W6.call(this,n,t,e,null)}function DD(n,t,e){return n.ue(t,e)<=0?e:t}function RD(n,t,e){return n.ue(t,e)<=0?t:e}function KD(n,t){return BB(lnn(n.b,t),149)}function _D(n,t){return BB(lnn(n.c,t),229)}function FD(n){return BB(xq(n.a,n.b),287)}function BD(n){return new xC(n.c,n.d+n.a)}function HD(n){return BZ(),pA(BB(n,197))}function qD(){qD=O,$rt=nbn((mdn(),_It))}function GD(n,t){t.a?Fxn(n,t):MN(n.a,t.b)}function zD(n,t){Qet||WB(n.a,t)}function UD(n,t){return mM(),wan(t.d.i,n)}function XD(n,t){return Irn(),new cKn(t,n)}function WD(n,t){return OY(t,uJn),n.f=t,n}function VD(n,t,e){return e=T_n(n,t,3,e)}function QD(n,t,e){return e=T_n(n,t,6,e)}function YD(n,t,e){return e=T_n(n,t,9,e)}function JD(n,t,e){++n.j,n.Ki(),L8(n,t,e)}function ZD(n,t,e){++n.j,n.Hi(t,n.oi(t,e))}function nR(n,t,e){n.Zc(t).Rb(e)}function tR(n,t,e){return ZBn(n.c,n.b,t,e)}function eR(n,t){return(t&DWn)%n.d.length}function iR(n,t){up.call(this,n),this.a=t}function rR(n,t){kp.call(this,n),this.a=t}function cR(n,t){kp.call(this,n),this.a=t}function aR(n,t){this.c=n,gtn.call(this,t)}function uR(n,t){this.a=n,yp.call(this,t)}function oR(n,t){this.a=n,yp.call(this,t)}function sR(n){this.a=(lin(n,AVn),new J6(n))}function hR(n){this.a=(lin(n,AVn),new J6(n))}function fR(n){return!n.a&&(n.a=new w),n.a}function lR(n){return n>8?0:n+1}function bR(n,t){return hN(),n==t?0:n?1:-1}function wR(n,t,e){return mG(n,BB(t,22),e)}function dR(n,t,e){return n.apply(t,e)}function gR(n,t,e){return n.a+=Bdn(t,0,e),n}function pR(n,t){var e;return e=n.e,n.e=t,e}function vR(n,t){n[iYn].call(n,t)}function mR(n,t){n[iYn].call(n,t)}function yR(n,t){n.a.Vc(n.b,t),++n.b,n.c=-1}function kR(n){$U(n.e),n.d.b=n.d,n.d.a=n.d}function jR(n){n.b?jR(n.b):n.f.c.zc(n.e,n.d)}function ER(n,t,e){dM(),Il(n,t.Ce(n.a,e))}function TR(n,t){return Qj(Mdn(n.a,t,!0))}function MR(n,t){return Qj(Sdn(n.a,t,!0))}function SR(n,t){return qk(new Array(t),n)}function PR(n){return String.fromCharCode(n)}function CR(n){return null==n?null:n.message}function IR(){this.a=new Np,this.b=new Np}function OR(){this.a=new bt,this.b=new Tv}function AR(){this.b=new Gj,this.c=new Np}function $R(){this.d=new Gj,this.e=new Gj}function LR(){this.n=new Gj,this.o=new Gj}function NR(){this.n=new bm,this.i=new bA}function xR(){this.a=new nf,this.b=new uc}function DR(){this.a=new Np,this.d=new Np}function RR(){this.b=new Rv,this.a=new Rv}function KR(){this.b=new xp,this.a=new xp}function _R(){this.b=new AE,this.a=new da}function FR(){NR.call(this),this.a=new Gj}function BR(n){Oan.call(this,n,(Z9(),Net))}function HR(n,t,e,i){uG.call(this,n,t,e,i)}function qR(n,t,e){null!=e&&Lin(t,Amn(n,e))}function GR(n,t,e){null!=e&&Nin(t,Amn(n,e))}function zR(n,t,e){return e=T_n(n,t,11,e)}function UR(n,t){return n.a+=t.a,n.b+=t.b,n}function XR(n,t){return n.a-=t.a,n.b-=t.b,n}function WR(n,t){return n.n.a=(kW(t),t+10)}function VR(n,t){return n.n.a=(kW(t),t+10)}function QR(n,t){return t==n||Sjn(CLn(t),n)}function YR(n,t){return null==VW(n.a,t,"")}function JR(n,t){return mM(),!wan(t.d.i,n)}function ZR(n,t){dA(n.f)?c$n(n,t):ITn(n,t)}function nK(n,t){return t.Hh(n.a)}function tK(n,t){Ay.call(this,e9n+n+o8n+t)}function eK(n,t,e,i){eU.call(this,n,t,e,i)}function iK(n,t,e,i){eU.call(this,n,t,e,i)}function rK(n,t,e,i){iK.call(this,n,t,e,i)}function cK(n,t,e,i){iU.call(this,n,t,e,i)}function aK(n,t,e,i){iU.call(this,n,t,e,i)}function uK(n,t,e,i){iU.call(this,n,t,e,i)}function oK(n,t,e,i){aK.call(this,n,t,e,i)}function sK(n,t,e,i){aK.call(this,n,t,e,i)}function hK(n,t,e,i){uK.call(this,n,t,e,i)}function fK(n,t,e,i){sK.call(this,n,t,e,i)}function lK(n,t,e,i){Zz.call(this,n,t,e,i)}function bK(n,t,e){this.a=n,ZN.call(this,t,e)}function wK(n,t,e){this.c=t,this.b=e,this.a=n}function dK(n,t,e){return n.d=BB(t.Kb(e),164)}function gK(n,t){return n.Aj().Nh().Kh(n,t)}function pK(n,t){return n.Aj().Nh().Ih(n,t)}function vK(n,t){return kW(n),GI(n)===GI(t)}function mK(n,t){return kW(n),GI(n)===GI(t)}function yK(n,t){return Qj(Mdn(n.a,t,!1))}function kK(n,t){return Qj(Sdn(n.a,t,!1))}function jK(n,t){return n.b.sd(new $S(n,t))}function EK(n,t){return n.b.sd(new LS(n,t))}function TK(n,t){return n.b.sd(new NS(n,t))}function MK(n,t,e){return n.lastIndexOf(t,e)}function SK(n,t,e){return Pln(n[t.b],n[e.b])}function PK(n,t){return hon(t,(HXn(),Rdt),n)}function CK(n,t){return E$(t.a.d.p,n.a.d.p)}function IK(n,t){return E$(n.a.d.p,t.a.d.p)}function OK(n,t){return Pln(n.c-n.s,t.c-t.s)}function AK(n){return n.c?E7(n.c.a,n,0):-1}function $K(n){return n<100?null:new Fj(n)}function LK(n){return n==UCt||n==WCt||n==XCt}function NK(n,t){return cL(t,15)&&QDn(n.c,t)}function xK(n,t){Qet||t&&(n.d=t)}function DK(n,t){return!!lsn(n,t)}function RK(n,t){this.c=n,GU.call(this,n,t)}function KK(n){this.c=n,vO.call(this,bVn,0)}function _K(n,t){JB.call(this,n,n.length,t)}function FK(n,t,e){return BB(n.c,69).lk(t,e)}function BK(n,t,e){return BB(n.c,69).mk(t,e)}function HK(n,t,e){return oD(n,BB(t,332),e)}function qK(n,t,e){return sD(n,BB(t,332),e)}function GK(n,t,e){return IEn(n,BB(t,332),e)}function zK(n,t,e){return QTn(n,BB(t,332),e)}function UK(n,t){return null==t?null:lfn(n.b,t)}function XK(n){return UI(n)?(kW(n),n):n.ke()}function WK(n){return!isNaN(n)&&!isFinite(n)}function VK(n){s_(),this.a=(SQ(),new Ak(n))}function QK(n){hH(),this.d=n,this.a=new Lp}function YK(n,t,e){this.a=n,this.b=t,this.c=e}function JK(n,t,e){this.a=n,this.b=t,this.c=e}function ZK(n,t,e){this.d=n,this.b=e,this.a=t}function n_(n){P$(this),yQ(this),Frn(this,n)}function t_(n){xA(this),tH(this.c,0,n.Pc())}function e_(n){fW(n.a),z8(n.c,n.b),n.b=null}function i_(n){this.a=n,$T(),fan(Date.now())}function r_(){r_=O,iit=new r,rit=new r}function c_(){c_=O,Tet=new L,Met=new N}function a_(){a_=O,wAt=x8(Ant,HWn,1,0,5,1)}function u_(){u_=O,M$t=x8(Ant,HWn,1,0,5,1)}function o_(){o_=O,S$t=x8(Ant,HWn,1,0,5,1)}function s_(){s_=O,new rv((SQ(),SQ(),set))}function h_(n){return Z9(),Cnn((n7(),_et),n)}function f_(n){return qsn(),Cnn((e8(),Zet),n)}function l_(n){return hpn(),Cnn((I4(),pit),n)}function b_(n){return Rnn(),Cnn((O4(),kit),n)}function w_(n){return tRn(),Cnn((xan(),Fit),n)}function d_(n){return Dtn(),Cnn((Z6(),Wit),n)}function g_(n){return J9(),Cnn((n8(),trt),n)}function p_(n){return G7(),Cnn((t8(),urt),n)}function v_(n){return dWn(),Cnn((MO(),Art),n)}function m_(n){return Dan(),Cnn((e7(),_rt),n)}function y_(n){return Hpn(),Cnn((i7(),zrt),n)}function k_(n){return qpn(),Cnn((r7(),ict),n)}function j_(n){return wM(),Cnn((Q2(),act),n)}function E_(n){return Knn(),Cnn((A4(),_ct),n)}function T_(n){return q7(),Cnn((i8(),Lat),n)}function M_(n){return yMn(),Cnn((Xnn(),qat),n)}function S_(n){return Aun(),Cnn((t7(),rut),n)}function P_(n){return Bfn(),Cnn((r8(),gut),n)}function C_(n,t){if(!n)throw Hp(new _y(t))}function I_(n){return uSn(),Cnn((hen(),Aut),n)}function O_(n){uG.call(this,n.d,n.c,n.a,n.b)}function A_(n){uG.call(this,n.d,n.c,n.a,n.b)}function $_(n,t,e){this.b=n,this.c=t,this.a=e}function L_(n,t,e){this.b=n,this.a=t,this.c=e}function N_(n,t,e){this.a=n,this.b=t,this.c=e}function x_(n,t,e){this.a=n,this.b=t,this.c=e}function D_(n,t,e){this.a=n,this.b=t,this.c=e}function R_(n,t,e){this.a=n,this.b=t,this.c=e}function K_(n,t,e){this.b=n,this.a=t,this.c=e}function __(n,t,e){this.e=t,this.b=n,this.d=e}function F_(n,t,e){return dM(),n.a.Od(t,e),t}function B_(n){var t;return(t=new jn).e=n,t}function H_(n){var t;return(t=new Zv).b=n,t}function q_(){q_=O,Uut=new Ne,Xut=new xe}function G_(){G_=O,dst=new vr,gst=new mr}function z_(n){return Iun(),Cnn((a7(),ost),n)}function U_(n){return Oun(),Cnn((o7(),Est),n)}function X_(n){return kDn(),Cnn((Gcn(),Vst),n)}function W_(n){return $Pn(),Cnn((ben(),rht),n)}function V_(n){return V8(),Cnn((R4(),oht),n)}function Q_(n){return Oin(),Cnn((c8(),bht),n)}function Y_(n){return LEn(),Cnn((Hnn(),Ost),n)}function J_(n){return Crn(),Cnn((o8(),_st),n)}function Z_(n){return uin(),Cnn((a8(),vht),n)}function nF(n){return Vvn(),Cnn((Fnn(),Mht),n)}function tF(n){return _nn(),Cnn((L4(),Iht),n)}function eF(n){return Jun(),Cnn((u8(),Nht),n)}function iF(n){return gSn(),Cnn((pen(),Hht),n)}function rF(n){return g7(),Cnn((N4(),Uht),n)}function cF(n){return Bjn(),Cnn((den(),nft),n)}function aF(n){return JMn(),Cnn((wen(),oft),n)}function uF(n){return bDn(),Cnn((Vun(),yft),n)}function oF(n){return Kan(),Cnn((h8(),Mft),n)}function sF(n){return z7(),Cnn((s8(),Oft),n)}function hF(n){return z2(),Cnn((K4(),Nft),n)}function fF(n){return Tbn(),Cnn((qnn(),zlt),n)}function lF(n){return TTn(),Cnn((gen(),rvt),n)}function bF(n){return Mhn(),Cnn((f8(),svt),n)}function wF(n){return bvn(),Cnn((s7(),dvt),n)}function dF(n){return ain(),Cnn((w8(),Uvt),n)}function gF(n){return sNn(),Cnn((qcn(),$vt),n)}function pF(n){return mon(),Cnn((b8(),Rvt),n)}function vF(n){return U7(),Cnn((D4(),Bvt),n)}function mF(n){return Hcn(),Cnn((l8(),Yvt),n)}function yF(n){return Nvn(),Cnn((Bnn(),jvt),n)}function kF(n){return A6(),Cnn((x4(),tmt),n)}function jF(n){return Usn(),Cnn((g8(),amt),n)}function EF(n){return dcn(),Cnn((p8(),fmt),n)}function TF(n){return $un(),Cnn((d8(),gmt),n)}function MF(n){return oin(),Cnn((v8(),Nmt),n)}function SF(n){return Q4(),Cnn((F4(),Gmt),n)}function PF(n){return gJ(),Cnn((B4(),iyt),n)}function CF(n){return oZ(),Cnn((H4(),uyt),n)}function IF(n){return O6(),Cnn((_4(),Pyt),n)}function OF(n){return dJ(),Cnn((q4(),Dyt),n)}function AF(n){return zyn(),Cnn((c7(),Hyt),n)}function $F(n){return DPn(),Cnn((ven(),Jyt),n)}function LF(n){return sZ(),Cnn((U4(),Fkt),n)}function NF(n){return Prn(),Cnn((z4(),Zkt),n)}function xF(n){return B0(),Cnn((G4(),Gkt),n)}function DF(n){return Cbn(),Cnn((m8(),rjt),n)}function RF(n){return D9(),Cnn((X4(),ojt),n)}function KF(n){return Hsn(),Cnn((y8(),bjt),n)}function _F(n){return Omn(),Cnn((u7(),zjt),n)}function FF(n){return Bcn(),Cnn((j8(),Qjt),n)}function BF(n){return Sbn(),Cnn((k8(),eEt),n)}function HF(n){return YLn(),Cnn((Unn(),BEt),n)}function qF(n){return Pbn(),Cnn((E8(),UEt),n)}function GF(n){return CM(),Cnn((W2(),VEt),n)}function zF(n){return IM(),Cnn((X2(),JEt),n)}function UF(n){return $6(),Cnn((V4(),eTt),n)}function XF(n){return $Sn(),Cnn((Gnn(),sTt),n)}function WF(n){return OM(),Cnn((V2(),UTt),n)}function VF(n){return Lun(),Cnn((W4(),QTt),n)}function QF(n){return rpn(),Cnn((znn(),bMt),n)}function YF(n){return PPn(),Cnn((zcn(),EMt),n)}function JF(n){return wvn(),Cnn((len(),xMt),n)}function ZF(n){return wEn(),Cnn((fen(),tSt),n)}function nB(n){return lWn(),Cnn((SO(),Zot),n)}function tB(n){return Srn(),Cnn(($4(),zut),n)}function eB(n){return Ffn(),Cnn((Wnn(),GPt),n)}function iB(n){return Rtn(),Cnn((M8(),VPt),n)}function rB(n){return Mbn(),Cnn((l7(),tCt),n)}function cB(n){return nMn(),Cnn((yen(),sCt),n)}function aB(n){return ufn(),Cnn((T8(),kCt),n)}function uB(n){return Xyn(),Cnn((f7(),PCt),n)}function oB(n){return n$n(),Cnn((Nan(),KCt),n)}function sB(n){return cpn(),Cnn((Vnn(),zCt),n)}function hB(n){return QEn(),Cnn((Htn(),ZCt),n)}function fB(n){return lIn(),Cnn((men(),uIt),n)}function lB(n){return mdn(),Cnn((w7(),BIt),n)}function bB(n){return n_n(),Cnn((Qun(),JIt),n)}function wB(n){return kUn(),Cnn((Qnn(),OIt),n)}function dB(n){return Fwn(),Cnn((b7(),rOt),n)}function gB(n){return Bsn(),Cnn((h7(),fOt),n)}function pB(n){return hAn(),Cnn((Ucn(),cAt),n)}function vB(n,t){return kW(n),n+(kW(t),t)}function mB(n,t){return $T(),f9(QQ(n.a),t)}function yB(n,t){return $T(),f9(QQ(n.a),t)}function kB(n,t){this.c=n,this.a=t,this.b=t-n}function jB(n,t,e){this.a=n,this.b=t,this.c=e}function EB(n,t,e){this.a=n,this.b=t,this.c=e}function TB(n,t,e){this.a=n,this.b=t,this.c=e}function MB(n,t,e){this.a=n,this.b=t,this.c=e}function SB(n,t,e){this.a=n,this.b=t,this.c=e}function PB(n,t,e){this.e=n,this.a=t,this.c=e}function CB(n,t,e){f$(),mJ.call(this,n,t,e)}function IB(n,t,e){f$(),rW.call(this,n,t,e)}function OB(n,t,e){f$(),rW.call(this,n,t,e)}function AB(n,t,e){f$(),rW.call(this,n,t,e)}function $B(n,t,e){f$(),IB.call(this,n,t,e)}function LB(n,t,e){f$(),IB.call(this,n,t,e)}function NB(n,t,e){f$(),LB.call(this,n,t,e)}function xB(n,t,e){f$(),OB.call(this,n,t,e)}function DB(n,t,e){f$(),AB.call(this,n,t,e)}function RB(n,t){return yX(n),yX(t),new hT(n,t)}function KB(n,t){return yX(n),yX(t),new _H(n,t)}function _B(n,t){return yX(n),yX(t),new FH(n,t)}function FB(n,t){return yX(n),yX(t),new lT(n,t)}function BB(n,t){return JH(null==n||Qpn(n,t)),n}function HB(n){var t;return fnn(t=new Np,n),t}function qB(n){var t;return fnn(t=new Rv,n),t}function GB(n){var t;return qrn(t=new zv,n),t}function zB(n){var t;return qrn(t=new YT,n),t}function UB(n){return!n.e&&(n.e=new Np),n.e}function XB(n){return!n.c&&(n.c=new Bo),n.c}function WB(n,t){return n.c[n.c.length]=t,!0}function VB(n,t){this.c=n,this.b=t,this.a=!1}function QB(n){this.d=n,Mb(this),this.b=rz(n.d)}function YB(){this.a=";,;",this.b="",this.c=""}function JB(n,t,e){Uz.call(this,t,e),this.a=n}function ZB(n,t,e){this.b=n,gO.call(this,t,e)}function nH(n,t,e){this.c=n,PS.call(this,t,e)}function tH(n,t,e){_Cn(e,0,n,t,e.length,!1)}function eH(n,t,e,i,r){n.b=t,n.c=e,n.d=i,n.a=r}function iH(n,t){t&&(n.b=t,n.a=(EW(t),t.a))}function rH(n,t,e,i,r){n.d=t,n.c=e,n.a=i,n.b=r}function cH(n){var t,e;t=n.b,e=n.c,n.b=e,n.c=t}function aH(n){var t,e;e=n.d,t=n.a,n.d=t,n.a=e}function uH(n){return uan(xU(JO(n)?Pan(n):n))}function oH(n,t){return E$(oq(n.d),oq(t.d))}function sH(n,t){return t==(kUn(),CIt)?n.c:n.d}function hH(){hH=O,kUn(),Rmt=CIt,Kmt=oIt}function fH(){this.b=Gy(MD(mpn((fRn(),aat))))}function lH(n){return dM(),x8(Ant,HWn,1,n,5,1)}function bH(n){return new xC(n.c+n.b,n.d+n.a)}function wH(n,t){return SM(),E$(n.d.p,t.d.p)}function dH(n){return Px(0!=n.b),Atn(n,n.a.a)}function gH(n){return Px(0!=n.b),Atn(n,n.c.b)}function pH(n,t){if(!n)throw Hp(new $y(t))}function vH(n,t){if(!n)throw Hp(new _y(t))}function mH(n,t,e){dP.call(this,n,t),this.b=e}function yH(n,t,e){LI.call(this,n,t),this.c=e}function kH(n,t,e){btn.call(this,t,e),this.d=n}function jH(n){o_(),yo.call(this),this.th(n)}function EH(n,t,e){this.a=n,NO.call(this,t,e)}function TH(n,t,e){this.a=n,NO.call(this,t,e)}function MH(n,t,e){LI.call(this,n,t),this.c=e}function SH(){R5(),oW.call(this,(WM(),zAt))}function PH(n){return null!=n&&!Xbn(n,LAt,NAt)}function CH(n,t){return(Wfn(n)<<4|Wfn(t))&QVn}function IH(n,t){return nV(),zvn(n,t),new GW(n,t)}function OH(n,t){var e;n.n&&(e=t,WB(n.f,e))}function AH(n,t,e){rtn(n,t,new GX(e))}function $H(n,t){var e;return e=n.c,Kin(n,t),e}function LH(n,t){return n.g=t<0?-1:t,n}function NH(n,t){return ztn(n),n.a*=t,n.b*=t,n}function xH(n,t,e,i,r){n.c=t,n.d=e,n.b=i,n.a=r}function DH(n,t){return r5(n,t,n.c.b,n.c),!0}function RH(n){n.a.b=n.b,n.b.a=n.a,n.a=n.b=null}function KH(n){this.b=n,this.a=lz(this.b.a).Ed()}function _H(n,t){this.b=n,this.a=t,Bh.call(this)}function FH(n,t){this.a=n,this.b=t,Bh.call(this)}function BH(n,t){Uz.call(this,t,1040),this.a=n}function HH(n){return 0==n||isNaN(n)?n:n<0?-1:1}function qH(n){return MQ(),PMn(n)==JJ(OMn(n))}function GH(n){return MQ(),OMn(n)==JJ(PMn(n))}function zH(n,t){return Yjn(n,new dP(t.a,t.b))}function UH(n){return!b5(n)&&n.c.i.c==n.d.i.c}function XH(n){var t;return t=n.n,n.a.b+t.d+t.a}function WH(n){var t;return t=n.n,n.e.b+t.d+t.a}function VH(n){var t;return t=n.n,n.e.a+t.b+t.c}function QH(n){return wWn(),new oG(0,n)}function YH(n){return n.a?n.a:eQ(n)}function JH(n){if(!n)throw Hp(new Ky(null))}function ZH(){ZH=O,SQ(),uLt=new Gb(P7n)}function nq(){nq=O,new svn((ty(),_nt),(ey(),Knt))}function tq(){tq=O,Itt=x8(Att,sVn,19,256,0,1)}function eq(n,t,e,i){awn.call(this,n,t,e,i,0,0)}function iq(n,t,e){return VW(n.b,BB(e.b,17),t)}function rq(n,t,e){return VW(n.b,BB(e.b,17),t)}function cq(n,t){return WB(n,new xC(t.a,t.b))}function aq(n,t){return n.c=t)throw Hp(new Sv)}function _z(n,t,e){return $X(t,0,Hq(t[0],e[0])),t}function Fz(n,t,e){t.Ye(e,Gy(MD(RX(n.b,e)))*n.a)}function Bz(n,t,e){return jDn(),Dcn(n,t)&&Dcn(n,e)}function Hz(n){return lIn(),!n.Hc(eIt)&&!n.Hc(rIt)}function qz(n){return new xC(n.c+n.b/2,n.d+n.a/2)}function Gz(n,t){return t.kh()?tfn(n.b,BB(t,49)):t}function zz(n,t){this.e=n,this.d=0!=(64&t)?t|hVn:t}function Uz(n,t){this.c=0,this.d=n,this.b=64|t|hVn}function Xz(n){this.b=new J6(11),this.a=(PQ(),n)}function Wz(n){this.b=null,this.a=(PQ(),n||wet)}function Vz(n){this.a=rvn(n.a),this.b=new t_(n.b)}function Qz(n){this.b=n,cx.call(this,n),ML(this)}function Yz(n){this.b=n,ux.call(this,n),SL(this)}function Jz(n,t,e){this.a=n,eK.call(this,t,e,5,6)}function Zz(n,t,e,i){this.b=n,$L.call(this,t,e,i)}function nU(n,t,e,i,r){k9.call(this,n,t,e,i,r,-1)}function tU(n,t,e,i,r){j9.call(this,n,t,e,i,r,-1)}function eU(n,t,e,i){$L.call(this,n,t,e),this.b=i}function iU(n,t,e,i){yH.call(this,n,t,e),this.b=i}function rU(n){NI.call(this,n,!1),this.a=!1}function cU(n,t){this.b=n,hl.call(this,n.b),this.a=t}function aU(n,t){WX(),jT.call(this,n,sfn(new Jy(t)))}function uU(n,t){return wWn(),new cW(n,t,0)}function oU(n,t){return wWn(),new cW(6,n,t)}function sU(n,t){return mK(n.substr(0,t.length),t)}function hU(n,t){return XI(t)?eY(n,t):!!AY(n.f,t)}function fU(n,t){for(kW(t);n.Ob();)t.td(n.Pb())}function lU(n,t,e){ODn(),this.e=n,this.d=t,this.a=e}function bU(n,t,e,i){var r;(r=n.i).i=t,r.a=e,r.b=i}function wU(n){var t;for(t=n;t.f;)t=t.f;return t}function dU(n){var t;return Px(null!=(t=Eon(n))),t}function gU(n){var t;return Px(null!=(t=mln(n))),t}function pU(n,t){var e;return w6(t,e=n.a.gc()),e-t}function vU(n,t){var e;for(e=0;e0?e.Math.log(n/t):-100}function FU(n,t){return Vhn(n,t)<0?-1:Vhn(n,t)>0?1:0}function BU(n,t,e){return SHn(n,BB(t,46),BB(e,167))}function HU(n,t){return BB(wz(lz(n.a)).Xb(t),42).cd()}function qU(n,t){return ptn(t,n.length),new BH(n,t)}function GU(n,t){this.d=n,AL.call(this,n),this.e=t}function zU(n){this.d=(kW(n),n),this.a=0,this.c=bVn}function UU(n,t){Ap.call(this,1),this.a=n,this.b=t}function XU(n,t){return n.c?XU(n.c,t):WB(n.b,t),n}function WU(n,t,e){var i;return i=dnn(n,t),r4(n,t,e),i}function VU(n,t){return m7(n.slice(0,t),n)}function QU(n,t,e){var i;for(i=0;i=n.g}function ZX(n,t,e){return NRn(n,yrn(n,t,e))}function nW(n,t){var e;dnn(n,e=n.a.length),r4(n,e,t)}function tW(n,t){console[n].call(console,t)}function eW(n,t){var e;++n.j,e=n.Vi(),n.Ii(n.oi(e,t))}function iW(n,t,e){BB(t.b,65),Otn(t.a,new EB(n,e,t))}function rW(n,t,e){jp.call(this,t),this.a=n,this.b=e}function cW(n,t,e){Ap.call(this,n),this.a=t,this.b=e}function aW(n,t,e){this.a=n,kp.call(this,t),this.b=e}function uW(n,t,e){this.a=n,H2.call(this,8,t,null,e)}function oW(n){this.a=(kW(_9n),_9n),this.b=n,new Nm}function sW(n){this.c=n,this.b=this.c.a,this.a=this.c.e}function hW(n){this.c=n,this.b=n.a.d.a,bD(n.a.e,this)}function fW(n){Mx(-1!=n.c),n.d.$c(n.c),n.b=n.c,n.c=-1}function lW(n){return e.Math.sqrt(n.a*n.a+n.b*n.b)}function bW(n,t){return Kz(t,n.a.c.length),xq(n.a,t)}function wW(n,t){return GI(n)===GI(t)||null!=n&&Nfn(n,t)}function dW(n){return 0>=n?new VT:Win(n-1)}function gW(n){return!!SNt&&eY(SNt,n)}function pW(n){return n?n.dc():!n.Kc().Ob()}function vW(n){return!n.a&&n.c?n.c.b:n.a}function mW(n){return!n.a&&(n.a=new $L(LOt,n,4)),n.a}function yW(n){return!n.d&&(n.d=new $L(VAt,n,1)),n.d}function kW(n){if(null==n)throw Hp(new gv);return n}function jW(n){n.c?n.c.He():(n.d=!0,QNn(n))}function EW(n){n.c?EW(n.c):(Qln(n),n.d=!0)}function TW(n){TV(n.a),n.b=x8(Ant,HWn,1,n.b.length,5,1)}function MW(n,t){return E$(t.j.c.length,n.j.c.length)}function SW(n,t){n.c<0||n.b.b=0?n.Bh(e):cIn(n,t)}function CW(n){return n.c.i.c==n.d.i.c}function IW(n){if(4!=n.p)throw Hp(new dv);return n.e}function OW(n){if(3!=n.p)throw Hp(new dv);return n.e}function AW(n){if(6!=n.p)throw Hp(new dv);return n.f}function $W(n){if(6!=n.p)throw Hp(new dv);return n.k}function LW(n){if(3!=n.p)throw Hp(new dv);return n.j}function NW(n){if(4!=n.p)throw Hp(new dv);return n.j}function xW(n){return!n.b&&(n.b=new Tp(new xm)),n.b}function DW(n){return-2==n.c&&gb(n,uMn(n.g,n.b)),n.c}function RW(n,t){var e;return(e=mX("",n)).n=t,e.i=1,e}function KW(n,t){LG(BB(t.b,65),n),Otn(t.a,new Aw(n))}function _W(n,t){f9((!n.a&&(n.a=new oR(n,n)),n.a),t)}function FW(n,t){this.b=n,GU.call(this,n,t),ML(this)}function BW(n,t){this.b=n,RK.call(this,n,t),SL(this)}function HW(n,t,e,i){vT.call(this,n,t),this.d=e,this.a=i}function qW(n,t,e,i){vT.call(this,n,e),this.a=t,this.f=i}function GW(n,t){W$.call(this,Vin(yX(n),yX(t))),this.a=t}function zW(){dMn.call(this,S7n,(rE(),dLt)),Wqn(this)}function UW(){dMn.call(this,V9n,(iE(),n$t)),OHn(this)}function XW(){gT.call(this,"DELAUNAY_TRIANGULATION",0)}function WW(n){return String.fromCharCode.apply(null,n)}function VW(n,t,e){return XI(t)?mZ(n,t,e):jCn(n.f,t,e)}function QW(n){return SQ(),n?n.ve():(PQ(),PQ(),get)}function YW(n,t,e){return Nun(),e.pg(n,BB(t.cd(),146))}function JW(n,t){return nq(),new svn(new rN(n),new iN(t))}function ZW(n){return lin(n,NVn),ttn(rbn(rbn(5,n),n/10|0))}function nV(){nV=O,Bnt=new hy(Pun(Gk(Hnt,1),kVn,42,0,[]))}function tV(n){return!n.d&&(n.d=new Hb(n.c.Cc())),n.d}function eV(n){return!n.a&&(n.a=new Lk(n.c.vc())),n.a}function iV(n){return!n.b&&(n.b=new Ak(n.c.ec())),n.b}function rV(n,t){for(;t-- >0;)n=n<<1|(n<0?1:0);return n}function cV(n,t){return GI(n)===GI(t)||null!=n&&Nfn(n,t)}function aV(n,t){return hN(),BB(t.b,19).a(i=CJ(e))&&++i,i}function ZV(n){var t;return cen(t=new Kp,n),t}function nQ(n){var t;return DMn(t=new Kp,n),t}function tQ(n,t){return Kcn(t,RX(n.f,t)),null}function eQ(n){return Yin(n)||null}function iQ(n){return!n.b&&(n.b=new eU(_Ot,n,12,3)),n.b}function rQ(n){return null!=n&&xT(jAt,n.toLowerCase())}function cQ(n,t){return Pln(iG(n)*eG(n),iG(t)*eG(t))}function aQ(n,t){return Pln(iG(n)*eG(n),iG(t)*eG(t))}function uQ(n,t){return Pln(n.d.c+n.d.b/2,t.d.c+t.d.b/2)}function oQ(n,t){return Pln(n.g.c+n.g.b/2,t.g.c+t.g.b/2)}function sQ(n,t,e){e.a?Cen(n,t.b-n.f/2):Pen(n,t.a-n.g/2)}function hQ(n,t,e,i){this.a=n,this.b=t,this.c=e,this.d=i}function fQ(n,t,e,i){this.a=n,this.b=t,this.c=e,this.d=i}function lQ(n,t,e,i){this.e=n,this.a=t,this.c=e,this.d=i}function bQ(n,t,e,i){this.a=n,this.c=t,this.d=e,this.b=i}function wQ(n,t,e,i){f$(),e6.call(this,t,e,i),this.a=n}function dQ(n,t,e,i){f$(),e6.call(this,t,e,i),this.a=n}function gQ(n,t){this.a=n,OD.call(this,n,BB(n.d,15).Zc(t))}function pQ(n){this.f=n,this.c=this.f.e,n.f>0&&ujn(this)}function vQ(n,t,e,i){this.b=n,this.c=i,vO.call(this,t,e)}function mQ(n){return Px(n.b=0&&mK(n.substr(e,t.length),t)}function LY(n,t,e,i,r,c,a){return new b4(n.e,t,e,i,r,c,a)}function NY(n,t,e,i,r,c){this.a=n,kin.call(this,t,e,i,r,c)}function xY(n,t,e,i,r,c){this.a=n,kin.call(this,t,e,i,r,c)}function DY(n,t){this.g=n,this.d=Pun(Gk(Out,1),a1n,10,0,[t])}function RY(n,t){this.e=n,this.a=Ant,this.b=ARn(t),this.c=t}function KY(n,t){NR.call(this),xtn(this),this.a=n,this.c=t}function _Y(n,t,e,i){$X(n.c[t.g],e.g,i),$X(n.c[e.g],t.g,i)}function FY(n,t,e,i){$X(n.c[t.g],t.g,e),$X(n.b[t.g],t.g,i)}function BY(){return A6(),Pun(Gk(cmt,1),$Vn,376,0,[Zvt,Jvt])}function HY(){return g7(),Pun(Gk(Zht,1),$Vn,479,0,[Ght,qht])}function qY(){return _nn(),Pun(Gk(Lht,1),$Vn,419,0,[Sht,Pht])}function GY(){return V8(),Pun(Gk(lht,1),$Vn,422,0,[cht,aht])}function zY(){return z2(),Pun(Gk(Glt,1),$Vn,420,0,[Aft,$ft])}function UY(){return U7(),Pun(Gk(zvt,1),$Vn,421,0,[Kvt,_vt])}function XY(){return Q4(),Pun(Gk(Vmt,1),$Vn,523,0,[Hmt,Bmt])}function WY(){return O6(),Pun(Gk(xyt,1),$Vn,520,0,[Myt,Tyt])}function VY(){return gJ(),Pun(Gk(ayt,1),$Vn,516,0,[tyt,nyt])}function QY(){return oZ(),Pun(Gk(Syt,1),$Vn,515,0,[ryt,cyt])}function YY(){return dJ(),Pun(Gk(Byt,1),$Vn,455,0,[Lyt,Nyt])}function JY(){return B0(),Pun(Gk(Jkt,1),$Vn,425,0,[Hkt,Bkt])}function ZY(){return sZ(),Pun(Gk(qkt,1),$Vn,480,0,[Rkt,Kkt])}function nJ(){return Prn(),Pun(Gk(ijt,1),$Vn,495,0,[Qkt,Ykt])}function tJ(){return D9(),Pun(Gk(ljt,1),$Vn,426,0,[cjt,ajt])}function eJ(){return Lun(),Pun(Gk(YTt,1),$Vn,429,0,[WTt,XTt])}function iJ(){return $6(),Pun(Gk(oTt,1),$Vn,430,0,[nTt,ZEt])}function rJ(){return hpn(),Pun(Gk(yit,1),$Vn,428,0,[dit,wit])}function cJ(){return Rnn(),Pun(Gk(Kit,1),$Vn,427,0,[vit,mit])}function aJ(){return Knn(),Pun(Gk($at,1),$Vn,424,0,[Dct,Rct])}function uJ(){return Srn(),Pun(Gk(Wut,1),$Vn,511,0,[qut,Hut])}function oJ(n,t,e,i){return e>=0?n.jh(t,e,i):n.Sg(null,e,i)}function sJ(n){return 0==n.b.b?n.a.$e():dH(n.b)}function hJ(n){if(5!=n.p)throw Hp(new dv);return dG(n.f)}function fJ(n){if(5!=n.p)throw Hp(new dv);return dG(n.k)}function lJ(n){return GI(n.a)===GI((wcn(),I$t))&&Rqn(n),n.a}function bJ(n){this.a=BB(yX(n),271),this.b=(SQ(),new dN(n))}function wJ(n,t){Zl(this,new xC(n.a,n.b)),nb(this,zB(t))}function dJ(){dJ=O,Lyt=new oC(cJn,0),Nyt=new oC(aJn,1)}function gJ(){gJ=O,tyt=new cC(aJn,0),nyt=new cC(cJn,1)}function pJ(){ay.call(this,new XT(etn(12))),aN(!0),this.a=2}function vJ(n,t,e){wWn(),Ap.call(this,n),this.b=t,this.a=e}function mJ(n,t,e){f$(),jp.call(this,t),this.a=n,this.b=e}function yJ(n){NR.call(this),xtn(this),this.a=n,this.c=!0}function kJ(n){var t;t=n.c.d.b,n.b=t,n.a=n.c.d,t.a=n.c.d.b=n}function jJ(n){pin(n.a),RA(n.a),twn(new Pw(n.a))}function EJ(n,t){oRn(n,!0),Otn(n.e.wf(),new $_(n,!0,t))}function TJ(n,t){return c4(t),Yen(n,x8(ANt,hQn,25,t,15,1),t)}function MJ(n,t){return MQ(),n==JJ(PMn(t))||n==JJ(OMn(t))}function SJ(n,t){return null==t?qI(AY(n.f,null)):hS(n.g,t)}function PJ(n){return 0==n.b?null:(Px(0!=n.b),Atn(n,n.a.a))}function CJ(n){return 0|Math.max(Math.min(n,DWn),-2147483648)}function IJ(n,t){var e=Znt[n.charCodeAt(0)];return null==e?n:e}function OJ(n,t){return WQ(n,"set1"),WQ(t,"set2"),new ET(n,t)}function AJ(n,t){return UR(qx(nen(n.f,t)),n.f.d)}function $J(n,t){var e;return YGn(n,t,e=new q),e.d}function LJ(n,t,e,i){var r;r=new FR,t.a[e.g]=r,mG(n.b,i,r)}function NJ(n,t,e){var i;(i=n.Yg(t))>=0?n.sh(i,e):TLn(n,t,e)}function xJ(n,t,e){hZ(),n&&VW(fAt,n,t),n&&VW(hAt,n,e)}function DJ(n,t,e){this.i=new Np,this.b=n,this.g=t,this.a=e}function RJ(n,t,e){this.c=new Np,this.e=n,this.f=t,this.b=e}function KJ(n,t,e){this.a=new Np,this.e=n,this.f=t,this.c=e}function _J(n,t){V$(this),this.f=t,this.g=n,jQ(this),this._d()}function FJ(n,t){var e;e=n.q.getHours(),n.q.setDate(t),lBn(n,e)}function BJ(n,t){var e;for(yX(t),e=n.a;e;e=e.c)t.Od(e.g,e.i)}function HJ(n){var t;return $on(t=new bE(etn(n.length)),n),t}function qJ(n){function t(){}return t.prototype=n||{},new t}function GJ(n,t){return!!wun(n,t)&&(ein(n),!0)}function zJ(n,t){if(null==t)throw Hp(new gv);return ugn(n,t)}function UJ(n){if(n.qe())return null;var t=n.n;return SWn[t]}function XJ(n){return n.Db>>16!=3?null:BB(n.Cb,33)}function WJ(n){return n.Db>>16!=9?null:BB(n.Cb,33)}function VJ(n){return n.Db>>16!=6?null:BB(n.Cb,79)}function QJ(n){return n.Db>>16!=7?null:BB(n.Cb,235)}function YJ(n){return n.Db>>16!=7?null:BB(n.Cb,160)}function JJ(n){return n.Db>>16!=11?null:BB(n.Cb,33)}function ZJ(n,t){var e;return(e=n.Yg(t))>=0?n.lh(e):qIn(n,t)}function nZ(n,t){var e;return oMn(e=new Lq(t),n),new t_(e)}function tZ(n){var t;return t=n.d,t=n.si(n.f),f9(n,t),t.Ob()}function eZ(n,t){return n.b+=t.b,n.c+=t.c,n.d+=t.d,n.a+=t.a,n}function iZ(n,t){return e.Math.abs(n)0}function cZ(){this.a=new fA,this.e=new Rv,this.g=0,this.i=0}function aZ(n){this.a=n,this.b=x8(_mt,sVn,1944,n.e.length,0,2)}function uZ(n,t,e){var i;i=Non(n,t,e),n.b=new mrn(i.c.length)}function oZ(){oZ=O,ryt=new rC(pJn,0),cyt=new rC("UP",1)}function sZ(){sZ=O,Rkt=new bC(U3n,0),Kkt=new bC("FAN",1)}function hZ(){hZ=O,fAt=new xp,hAt=new xp,FI(yet,new wo)}function fZ(n){if(0!=n.p)throw Hp(new dv);return JI(n.f,0)}function lZ(n){if(0!=n.p)throw Hp(new dv);return JI(n.k,0)}function bZ(n){return n.Db>>16!=3?null:BB(n.Cb,147)}function wZ(n){return n.Db>>16!=6?null:BB(n.Cb,235)}function dZ(n){return n.Db>>16!=17?null:BB(n.Cb,26)}function gZ(n,t){var e=n.a=n.a||[];return e[t]||(e[t]=n.le(t))}function pZ(n,t){var e;return null==(e=n.a.get(t))?new Array:e}function vZ(n,t){var e;e=n.q.getHours(),n.q.setMonth(t),lBn(n,e)}function mZ(n,t,e){return null==t?jCn(n.f,null,e):ubn(n.g,t,e)}function yZ(n,t,e,i,r,c){return new N7(n.e,t,n.aj(),e,i,r,c)}function kZ(n,t,e){return n.a=fx(n.a,0,t)+""+e+nO(n.a,t),n}function jZ(n,t,e){return WB(n.a,(nV(),zvn(t,e),new vT(t,e))),n}function EZ(n){return oN(n.c),n.e=n.a=n.c,n.c=n.c.c,++n.d,n.a.f}function TZ(n){return oN(n.e),n.c=n.a=n.e,n.e=n.e.e,--n.d,n.a.f}function MZ(n,t){n.d&&y7(n.d.e,n),n.d=t,n.d&&WB(n.d.e,n)}function SZ(n,t){n.c&&y7(n.c.g,n),n.c=t,n.c&&WB(n.c.g,n)}function PZ(n,t){n.c&&y7(n.c.a,n),n.c=t,n.c&&WB(n.c.a,n)}function CZ(n,t){n.i&&y7(n.i.j,n),n.i=t,n.i&&WB(n.i.j,n)}function IZ(n,t,e){this.a=t,this.c=n,this.b=(yX(e),new t_(e))}function OZ(n,t,e){this.a=t,this.c=n,this.b=(yX(e),new t_(e))}function AZ(n,t){this.a=n,this.c=B$(this.a),this.b=new gY(t)}function $Z(n){return Qln(n),AV(n,new vw(new Rv))}function LZ(n,t){if(n<0||n>t)throw Hp(new Ay(jYn+n+EYn+t))}function NZ(n,t){return IG(n.a,t)?EU(n,BB(t,22).g,null):null}function xZ(n){return Shn(),hN(),0!=BB(n.a,81).d.e}function DZ(){DZ=O,Xnt=lhn((ry(),Pun(Gk(Wnt,1),$Vn,538,0,[znt])))}function RZ(){RZ=O,pmt=WG(new B2,(yMn(),Bat),(lWn(),qot))}function KZ(){KZ=O,vmt=WG(new B2,(yMn(),Bat),(lWn(),qot))}function _Z(){_Z=O,ymt=WG(new B2,(yMn(),Bat),(lWn(),qot))}function FZ(){FZ=O,zmt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function BZ(){BZ=O,Qmt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function HZ(){HZ=O,Zmt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function qZ(){qZ=O,oyt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function GZ(){GZ=O,zkt=WG(new B2,(zyn(),Fyt),(DPn(),zyt))}function zZ(n,t,e,i){this.c=n,this.d=i,WZ(this,t),VZ(this,e)}function UZ(n){this.c=new YT,this.b=n.b,this.d=n.c,this.a=n.a}function XZ(n){this.a=e.Math.cos(n),this.b=e.Math.sin(n)}function WZ(n,t){n.a&&y7(n.a.k,n),n.a=t,n.a&&WB(n.a.k,n)}function VZ(n,t){n.b&&y7(n.b.f,n),n.b=t,n.b&&WB(n.b.f,n)}function QZ(n,t){iW(n,n.b,n.c),BB(n.b.b,65),t&&BB(t.b,65).b}function YZ(n,t){zln(n,t),cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),2)}function JZ(n,t){cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),4),Nrn(n,t)}function ZZ(n,t){cL(n.Cb,179)&&(BB(n.Cb,179).tb=null),Nrn(n,t)}function n1(n,t){return ZM(),hnn(t)?new lq(t,n):new xI(t,n)}function t1(n,t){null!=t.c&&nW(n,new GX(t.c))}function e1(n){var t;return iE(),cen(t=new Kp,n),t}function i1(n){var t;return iE(),cen(t=new Kp,n),t}function r1(n,t){var e;return e=new HX(n),t.c[t.c.length]=e,e}function c1(n,t){var e;return(e=BB(lfn(OQ(n.a),t),14))?e.gc():0}function a1(n){return Qln(n),PQ(),PQ(),ytn(n,det)}function u1(n){for(var t;;)if(t=n.Pb(),!n.Ob())return t}function o1(n,t){Um.call(this,new XT(etn(n))),lin(t,oVn),this.a=t}function s1(n,t,e){Hfn(t,e,n.gc()),this.c=n,this.a=t,this.b=e-t}function h1(n,t,e){var i;Hfn(t,e,n.c.length),i=e-t,PE(n.c,t,i)}function f1(n,t){hL(n,dG(e0(kz(t,24),sYn)),dG(e0(t,sYn)))}function l1(n,t){if(n<0||n>=t)throw Hp(new Ay(jYn+n+EYn+t))}function b1(n,t){if(n<0||n>=t)throw Hp(new Ok(jYn+n+EYn+t))}function w1(n,t){this.b=(kW(n),n),this.a=0==(t&_Qn)?64|t|hVn:t}function d1(n){DA(this),Pv(this.a,kon(e.Math.max(8,n))<<1)}function g1(n){return Aon(Pun(Gk(PMt,1),sVn,8,0,[n.i.n,n.n,n.a]))}function p1(){return qsn(),Pun(Gk(nit,1),$Vn,132,0,[zet,Uet,Xet])}function v1(){return Dtn(),Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])}function m1(){return J9(),Pun(Gk(ert,1),$Vn,461,0,[Yit,Qit,Jit])}function y1(){return G7(),Pun(Gk(Ort,1),$Vn,462,0,[crt,rrt,irt])}function k1(){return Bfn(),Pun(Gk(mut,1),$Vn,423,0,[wut,but,lut])}function j1(){return q7(),Pun(Gk(Hat,1),$Vn,379,0,[Oat,Iat,Aat])}function E1(){return Mhn(),Pun(Gk(wvt,1),$Vn,378,0,[cvt,avt,uvt])}function T1(){return Oin(),Pun(Gk(pht,1),$Vn,314,0,[hht,sht,fht])}function M1(){return uin(),Pun(Gk(Tht,1),$Vn,337,0,[wht,ght,dht])}function S1(){return Jun(),Pun(Gk(Bht,1),$Vn,450,0,[Aht,Oht,$ht])}function P1(){return Crn(),Pun(Gk(Wst,1),$Vn,361,0,[Rst,Dst,xst])}function C1(){return z7(),Pun(Gk(Lft,1),$Vn,303,0,[Pft,Cft,Sft])}function I1(){return Kan(),Pun(Gk(Ift,1),$Vn,292,0,[jft,Eft,kft])}function O1(){return ain(),Pun(Gk(Qvt,1),$Vn,452,0,[Gvt,Hvt,qvt])}function A1(){return mon(),Pun(Gk(Fvt,1),$Vn,339,0,[Nvt,Lvt,xvt])}function $1(){return Hcn(),Pun(Gk(nmt,1),$Vn,375,0,[Xvt,Wvt,Vvt])}function L1(){return $un(),Pun(Gk(Smt,1),$Vn,377,0,[bmt,wmt,lmt])}function N1(){return Usn(),Pun(Gk(hmt,1),$Vn,336,0,[emt,imt,rmt])}function x1(){return dcn(),Pun(Gk(dmt,1),$Vn,338,0,[smt,umt,omt])}function D1(){return oin(),Pun(Gk(xmt,1),$Vn,454,0,[Omt,Amt,$mt])}function R1(){return Cbn(),Pun(Gk(ujt,1),$Vn,442,0,[ejt,njt,tjt])}function K1(){return Hsn(),Pun(Gk(Gjt,1),$Vn,380,0,[sjt,hjt,fjt])}function _1(){return Sbn(),Pun(Gk(NEt,1),$Vn,381,0,[Zjt,nEt,Jjt])}function F1(){return Bcn(),Pun(Gk(Yjt,1),$Vn,293,0,[Xjt,Wjt,Ujt])}function B1(){return Pbn(),Pun(Gk(WEt,1),$Vn,437,0,[HEt,qEt,GEt])}function H1(){return ufn(),Pun(Gk(SCt,1),$Vn,334,0,[vCt,pCt,mCt])}function q1(){return Rtn(),Pun(Gk(nCt,1),$Vn,272,0,[zPt,UPt,XPt])}function G1(n,t){return k$n(n,t,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function z1(n,t,e){var i;return(i=cHn(n,t,!1)).b<=t&&i.a<=e}function U1(n,t,e){var i;(i=new ca).b=t,i.a=e,++t.b,WB(n.d,i)}function X1(n,t){var e;return Tx(!!(e=(kW(n),n).g)),kW(t),e(t)}function W1(n,t){var e,i;return i=pU(n,t),e=n.a.Zc(i),new kT(n,e)}function V1(n){return n.Db>>16!=6?null:BB(cAn(n),235)}function Q1(n){if(2!=n.p)throw Hp(new dv);return dG(n.f)&QVn}function Y1(n){if(2!=n.p)throw Hp(new dv);return dG(n.k)&QVn}function J1(n){return n.a==(R5(),eLt)&&db(n,eLn(n.g,n.b)),n.a}function Z1(n){return n.d==(R5(),eLt)&&pb(n,NKn(n.g,n.b)),n.d}function n0(n){return Px(n.ai?1:0}function w0(n,t){var e;return e=S7(t),BB(RX(n.c,e),19).a}function d0(n,t){var e;for(e=n+"";e.length0&&0==n.a[--n.d];);0==n.a[n.d++]&&(n.e=0)}function W0(n){return n.a?0==n.e.length?n.a.a:n.a.a+""+n.e:n.c}function V0(n){return!(!n.a||0==H7(n.a.a).i||n.b&&Kvn(n.b))}function Q0(n){return!(!n.u||0==a4(n.u.a).i||n.n&&Rvn(n.n))}function Y0(n){return yq(n.e.Hd().gc()*n.c.Hd().gc(),16,new zf(n))}function J0(n,t){return FU(fan(n.q.getTime()),fan(t.q.getTime()))}function Z0(n){return BB(Qgn(n,x8(yut,c1n,17,n.c.length,0,1)),474)}function n2(n){return BB(Qgn(n,x8(Out,a1n,10,n.c.length,0,1)),193)}function t2(n){return BZ(),!(b5(n)||!b5(n)&&n.c.i.c==n.d.i.c)}function e2(n,t,e){yX(n),xyn(new IZ(new t_(n),t,e))}function i2(n,t,e){yX(n),Dyn(new OZ(new t_(n),t,e))}function r2(n,t){var e;return e=1-t,n.a[e]=wrn(n.a[e],e),wrn(n,t)}function c2(n,t){var e;n.e=new Jm,m$(e=wDn(t),n.c),IDn(n,e,0)}function a2(n,t,e,i){var r;(r=new vu).a=t,r.b=e,r.c=i,DH(n.a,r)}function u2(n,t,e,i){var r;(r=new vu).a=t,r.b=e,r.c=i,DH(n.b,r)}function o2(n){var t,e;return e=t_n(t=new lX,n),yzn(t),e}function s2(){var n,t;return n=new Kp,WB(V$t,t=n),t}function h2(n){return n.j.c=x8(Ant,HWn,1,0,5,1),TV(n.c),gV(n.a),n}function f2(n){return MM(),cL(n.g,10)?BB(n.g,10):null}function l2(n){return!EV(n).dc()&&(L$(n,new m),!0)}function b2(n){if(!("stack"in n))try{throw n}catch(t){}return n}function w2(n,t){if(n<0||n>=t)throw Hp(new Ay(LCn(n,t)));return n}function d2(n,t,e){if(n<0||te)throw Hp(new Ay(oPn(n,t,e)))}function g2(n,t){if(TU(n.a,t),t.d)throw Hp(new dy(IYn));t.d=n}function p2(n,t){if(t.$modCount!=n.$modCount)throw Hp(new vv)}function v2(n,t){return!!cL(t,42)&&Mmn(n.a,BB(t,42))}function m2(n,t){return!!cL(t,42)&&Mmn(n.a,BB(t,42))}function y2(n,t){return!!cL(t,42)&&Mmn(n.a,BB(t,42))}function k2(n,t){return n.a<=n.b&&(t.ud(n.a++),!0)}function j2(n){var t;return JO(n)?-0==(t=n)?0:t:pnn(n)}function E2(n){var t;return EW(n),t=new F,gE(n.a,new gw(t)),t}function T2(n){var t;return EW(n),t=new _,gE(n.a,new dw(t)),t}function M2(n,t){this.a=n,Sb.call(this,n),LZ(t,n.gc()),this.b=t}function S2(n){this.e=n,this.b=this.e.a.entries(),this.a=new Array}function P2(n){return yq(n.e.Hd().gc()*n.c.Hd().gc(),273,new Gf(n))}function C2(n){return new J6((lin(n,NVn),ttn(rbn(rbn(5,n),n/10|0))))}function I2(n){return BB(Qgn(n,x8(Gut,u1n,11,n.c.length,0,1)),1943)}function O2(n,t,e){return e.f.c.length>0?BU(n.a,t,e):BU(n.b,t,e)}function A2(n,t,e){n.d&&y7(n.d.e,n),n.d=t,n.d&&kG(n.d.e,e,n)}function $2(n,t){vXn(t,n),aH(n.d),aH(BB(mMn(n,(HXn(),Agt)),207))}function L2(n,t){pXn(t,n),cH(n.d),cH(BB(mMn(n,(HXn(),Agt)),207))}function N2(n,t){var e,i;return i=null,(e=zJ(n,t))&&(i=e.fe()),i}function x2(n,t){var e,i;return i=null,(e=dnn(n,t))&&(i=e.ie()),i}function D2(n,t){var e,i;return i=null,(e=zJ(n,t))&&(i=e.ie()),i}function R2(n,t){var e,i;return i=null,(e=zJ(n,t))&&(i=yPn(e)),i}function K2(n,t,e){var i;return i=Qdn(e),wKn(n.g,i,t),wKn(n.i,t,e),t}function _2(n,t,e){var i;i=Ldn();try{return dR(n,t,e)}finally{y3(i)}}function F2(n){var t;t=n.Wg(),this.a=cL(t,69)?BB(t,69).Zh():t.Kc()}function B2(){Ym.call(this),this.j.c=x8(Ant,HWn,1,0,5,1),this.a=-1}function H2(n,t,e,i){this.d=n,this.n=t,this.g=e,this.o=i,this.p=-1}function q2(n,t,e,i){this.e=i,this.d=null,this.c=n,this.a=t,this.b=e}function G2(n,t,e){this.d=new Fd(this),this.e=n,this.i=t,this.f=e}function z2(){z2=O,Aft=new DP(eJn,0),$ft=new DP("TOP_LEFT",1)}function U2(){U2=O,Tmt=JW(iln(1),iln(4)),Emt=JW(iln(1),iln(2))}function X2(){X2=O,JEt=lhn((IM(),Pun(Gk(tTt,1),$Vn,551,0,[QEt])))}function W2(){W2=O,VEt=lhn((CM(),Pun(Gk(YEt,1),$Vn,482,0,[XEt])))}function V2(){V2=O,UTt=lhn((OM(),Pun(Gk(VTt,1),$Vn,530,0,[GTt])))}function Q2(){Q2=O,act=lhn((wM(),Pun(Gk(Pct,1),$Vn,481,0,[rct])))}function Y2(){return Dan(),Pun(Gk(Grt,1),$Vn,406,0,[Rrt,Nrt,xrt,Drt])}function J2(){return Z9(),Pun(Gk(Fet,1),$Vn,297,0,[Net,xet,Det,Ret])}function Z2(){return qpn(),Pun(Gk(cct,1),$Vn,394,0,[Zrt,Jrt,nct,tct])}function n3(){return Hpn(),Pun(Gk(Urt,1),$Vn,323,0,[Brt,Frt,Hrt,qrt])}function t3(){return Aun(),Pun(Gk(dut,1),$Vn,405,0,[Zat,eut,nut,tut])}function e3(){return Iun(),Pun(Gk(pst,1),$Vn,360,0,[ast,rst,cst,ist])}function i3(n,t,e,i){return cL(e,54)?new Ox(n,t,e,i):new sz(n,t,e,i)}function r3(){return Oun(),Pun(Gk(Ist,1),$Vn,411,0,[vst,mst,yst,kst])}function c3(n){return n.j==(kUn(),SIt)&&SN(UOn(n),oIt)}function a3(n,t){var e;SZ(e=t.a,t.c.d),MZ(e,t.d.d),Ztn(e.a,n.n)}function u3(n,t){return BB($N(Iz(BB(h6(n.k,t),15).Oc(),Qst)),113)}function o3(n,t){return BB($N(Oz(BB(h6(n.k,t),15).Oc(),Qst)),113)}function s3(n){return new w1(tcn(BB(n.a.dd(),14).gc(),n.a.cd()),16)}function h3(n){return cL(n,14)?BB(n,14).dc():!n.Kc().Ob()}function f3(n){return MM(),cL(n.g,145)?BB(n.g,145):null}function l3(n){if(n.e.g!=n.b)throw Hp(new vv);return!!n.c&&n.d>0}function b3(n){return Px(n.b!=n.d.c),n.c=n.b,n.b=n.b.a,++n.a,n.c.c}function w3(n,t){kW(t),$X(n.a,n.c,t),n.c=n.c+1&n.a.length-1,wyn(n)}function d3(n,t){kW(t),n.b=n.b-1&n.a.length-1,$X(n.a,n.b,t),wyn(n)}function g3(n,t){var e;for(e=n.j.c.length;e0&&aHn(n.g,0,t,0,n.i),t}function x3(n,t){var e;return nS(),!(e=BB(RX(mAt,n),55))||e.wj(t)}function D3(n){if(1!=n.p)throw Hp(new dv);return dG(n.f)<<24>>24}function R3(n){if(1!=n.p)throw Hp(new dv);return dG(n.k)<<24>>24}function K3(n){if(7!=n.p)throw Hp(new dv);return dG(n.k)<<16>>16}function _3(n){if(7!=n.p)throw Hp(new dv);return dG(n.f)<<16>>16}function F3(n){var t;for(t=0;n.Ob();)n.Pb(),t=rbn(t,1);return ttn(t)}function B3(n,t){var e;return e=new Ik,n.xd(e),e.a+="..",t.yd(e),e.a}function H3(n,t,e){var i;i=BB(RX(n.g,e),57),WB(n.a.c,new rI(t,i))}function q3(n,t,e){return Tz(MD(qI(AY(n.f,t))),MD(qI(AY(n.f,e))))}function G3(n,t,e){return UFn(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function z3(n,t,e){return pBn(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function U3(n,t,e){return x$n(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function X3(n,t){return n==(uSn(),Cut)&&t==Cut?4:n==Cut||t==Cut?8:32}function W3(n,t){return GI(t)===GI(n)?"(this Map)":null==t?zWn:Bbn(t)}function V3(n,t){return BB(null==t?qI(AY(n.f,null)):hS(n.g,t),281)}function Q3(n,t,e){var i;return i=Qdn(e),VW(n.b,i,t),VW(n.c,t,e),t}function Y3(n,t){var e;for(e=t;e;)_x(n,e.i,e.j),e=JJ(e);return n}function J3(n,t){var e;return e=rY(HB(new C7(n,t))),Cq(new C7(n,t)),e}function Z3(n,t){var e;return ZM(),TSn(e=BB(n,66).Mj(),t),e.Ok(t)}function n4(n,t,e,i,r){WB(t,mCn(r,X$n(r,e,i))),UMn(n,r,t)}function t4(n,t,e){n.i=0,n.e=0,t!=e&&(Won(n,t,e),Xon(n,t,e))}function e4(n,t){var e;e=n.q.getHours(),n.q.setFullYear(t+sQn),lBn(n,e)}function i4(n,t,e){if(e){var i=e.ee();n.a[t]=i(e)}else delete n.a[t]}function r4(n,t,e){if(e){var i=e.ee();e=i(e)}else e=void 0;n.a[t]=e}function c4(n){if(n<0)throw Hp(new By("Negative array size: "+n))}function a4(n){return n.n||(P5(n),n.n=new YG(n,VAt,n),kY(n)),n.n}function u4(n){return Px(n.a=0&&n.a[e]===t[e];e--);return e<0}function T4(n,t){var e;return zsn(),0!=(e=n.j.g-t.j.g)?e:0}function M4(n,t){return kW(t),null!=n.a?PG(t.Kb(n.a)):Set}function S4(n){var t;return n?new Lq(n):(qrn(t=new fA,n),t)}function P4(n,t){return t.b.Kb(T7(n,t.c.Ee(),new yw(t)))}function C4(n){yTn(),hL(this,dG(e0(kz(n,24),sYn)),dG(e0(n,sYn)))}function I4(){I4=O,pit=lhn((hpn(),Pun(Gk(yit,1),$Vn,428,0,[dit,wit])))}function O4(){O4=O,kit=lhn((Rnn(),Pun(Gk(Kit,1),$Vn,427,0,[vit,mit])))}function A4(){A4=O,_ct=lhn((Knn(),Pun(Gk($at,1),$Vn,424,0,[Dct,Rct])))}function $4(){$4=O,zut=lhn((Srn(),Pun(Gk(Wut,1),$Vn,511,0,[qut,Hut])))}function L4(){L4=O,Iht=lhn((_nn(),Pun(Gk(Lht,1),$Vn,419,0,[Sht,Pht])))}function N4(){N4=O,Uht=lhn((g7(),Pun(Gk(Zht,1),$Vn,479,0,[Ght,qht])))}function x4(){x4=O,tmt=lhn((A6(),Pun(Gk(cmt,1),$Vn,376,0,[Zvt,Jvt])))}function D4(){D4=O,Bvt=lhn((U7(),Pun(Gk(zvt,1),$Vn,421,0,[Kvt,_vt])))}function R4(){R4=O,oht=lhn((V8(),Pun(Gk(lht,1),$Vn,422,0,[cht,aht])))}function K4(){K4=O,Nft=lhn((z2(),Pun(Gk(Glt,1),$Vn,420,0,[Aft,$ft])))}function _4(){_4=O,Pyt=lhn((O6(),Pun(Gk(xyt,1),$Vn,520,0,[Myt,Tyt])))}function F4(){F4=O,Gmt=lhn((Q4(),Pun(Gk(Vmt,1),$Vn,523,0,[Hmt,Bmt])))}function B4(){B4=O,iyt=lhn((gJ(),Pun(Gk(ayt,1),$Vn,516,0,[tyt,nyt])))}function H4(){H4=O,uyt=lhn((oZ(),Pun(Gk(Syt,1),$Vn,515,0,[ryt,cyt])))}function q4(){q4=O,Dyt=lhn((dJ(),Pun(Gk(Byt,1),$Vn,455,0,[Lyt,Nyt])))}function G4(){G4=O,Gkt=lhn((B0(),Pun(Gk(Jkt,1),$Vn,425,0,[Hkt,Bkt])))}function z4(){z4=O,Zkt=lhn((Prn(),Pun(Gk(ijt,1),$Vn,495,0,[Qkt,Ykt])))}function U4(){U4=O,Fkt=lhn((sZ(),Pun(Gk(qkt,1),$Vn,480,0,[Rkt,Kkt])))}function X4(){X4=O,ojt=lhn((D9(),Pun(Gk(ljt,1),$Vn,426,0,[cjt,ajt])))}function W4(){W4=O,QTt=lhn((Lun(),Pun(Gk(YTt,1),$Vn,429,0,[WTt,XTt])))}function V4(){V4=O,eTt=lhn(($6(),Pun(Gk(oTt,1),$Vn,430,0,[nTt,ZEt])))}function Q4(){Q4=O,Hmt=new JP("UPPER",0),Bmt=new JP("LOWER",1)}function Y4(n,t){var e;qQ(e=new py,"x",t.a),qQ(e,"y",t.b),nW(n,e)}function J4(n,t){var e;qQ(e=new py,"x",t.a),qQ(e,"y",t.b),nW(n,e)}function Z4(n,t){var e,i;i=!1;do{i|=e=bon(n,t)}while(e);return i}function n5(n,t){var e,i;for(e=t,i=0;e>0;)i+=n.a[e],e-=e&-e;return i}function t5(n,t){var e;for(e=t;e;)_x(n,-e.i,-e.j),e=JJ(e);return n}function e5(n,t){var e,i;for(kW(t),i=n.Kc();i.Ob();)e=i.Pb(),t.td(e)}function i5(n,t){var e;return new vT(e=t.cd(),n.e.pc(e,BB(t.dd(),14)))}function r5(n,t,e,i){var r;(r=new $).c=t,r.b=e,r.a=i,i.b=e.a=r,++n.b}function c5(n,t,e){var i;return l1(t,n.c.length),i=n.c[t],n.c[t]=e,i}function a5(n,t,e){return BB(null==t?jCn(n.f,null,e):ubn(n.g,t,e),281)}function u5(n){return n.c&&n.d?p0(n.c)+"->"+p0(n.d):"e_"+PN(n)}function o5(n,t){return(Qln(n),jE(new Rq(n,new Q9(t,n.a)))).sd(tit)}function s5(){return yMn(),Pun(Gk(Uat,1),$Vn,356,0,[Rat,Kat,_at,Fat,Bat])}function h5(){return kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])}function f5(n){return Dk(),function(){return _2(n,this,arguments)}}function l5(){return Date.now?Date.now():(new Date).getTime()}function b5(n){return!(!n.c||!n.d||!n.c.i||n.c.i!=n.d.i)}function w5(n){if(!n.c.Sb())throw Hp(new yv);return n.a=!0,n.c.Ub()}function d5(n){n.i=0,yS(n.b,null),yS(n.c,null),n.a=null,n.e=null,++n.g}function g5(n){dS.call(this,null==n?zWn:Bbn(n),cL(n,78)?BB(n,78):null)}function p5(n){eWn(),Bp(this),this.a=new YT,dsn(this,n),DH(this.a,n)}function v5(){xA(this),this.b=new xC(RQn,RQn),this.a=new xC(KQn,KQn)}function m5(n,t){this.c=0,this.b=t,pO.call(this,n,17493),this.a=this.c}function y5(n){k5(),Qet||(this.c=n,this.e=!0,this.a=new Np)}function k5(){k5=O,Qet=!0,Wet=!1,Vet=!1,Jet=!1,Yet=!1}function j5(n,t){return!!cL(t,149)&&mK(n.c,BB(t,149).c)}function E5(n,t){var e;return e=0,n&&(e+=n.f.a/2),t&&(e+=t.f.a/2),e}function T5(n,t){return BB(lnn(n.d,t),23)||BB(lnn(n.e,t),23)}function M5(n){this.b=n,AL.call(this,n),this.a=BB(yan(this.b.a,4),126)}function S5(n){this.b=n,ax.call(this,n),this.a=BB(yan(this.b.a,4),126)}function P5(n){return n.t||(n.t=new dp(n),sln(new xy(n),0,n.t)),n.t}function C5(){return Ffn(),Pun(Gk(WPt,1),$Vn,103,0,[BPt,FPt,_Pt,KPt,HPt])}function I5(){return cpn(),Pun(Gk(JCt,1),$Vn,249,0,[BCt,qCt,_Ct,FCt,HCt])}function O5(){return rpn(),Pun(Gk(jMt,1),$Vn,175,0,[hMt,sMt,uMt,fMt,oMt])}function A5(){return $Sn(),Pun(Gk(zTt,1),$Vn,316,0,[iTt,rTt,uTt,cTt,aTt])}function $5(){return Nvn(),Pun(Gk(Avt,1),$Vn,315,0,[yvt,pvt,vvt,gvt,mvt])}function L5(){return Vvn(),Pun(Gk(Cht,1),$Vn,335,0,[yht,mht,jht,Eht,kht])}function N5(){return YLn(),Pun(Gk(zEt,1),$Vn,355,0,[DEt,xEt,KEt,REt,_Et])}function x5(){return LEn(),Pun(Gk(Kst,1),$Vn,363,0,[Mst,Pst,Cst,Sst,Tst])}function D5(){return Tbn(),Pun(Gk(ivt,1),$Vn,163,0,[qlt,_lt,Flt,Blt,Hlt])}function R5(){var n,t;R5=O,iE(),t=new Ev,tLt=t,n=new Om,eLt=n}function K5(n){var t;return n.c||cL(t=n.r,88)&&(n.c=BB(t,26)),n.c}function _5(n){return n.e=3,n.d=n.Yb(),2!=n.e&&(n.e=0,!0)}function F5(n){return M$(n&SQn,n>>22&SQn,n<0?PQn:0)}function B5(n){var t,e,i;for(e=0,i=(t=n).length;e0?Edn(n,t):Ixn(n,-t)}function z5(n,t){return 0==t||0==n.e?n:t>0?Ixn(n,t):Edn(n,-t)}function U5(n){if(dAn(n))return n.c=n.a,n.a.Pb();throw Hp(new yv)}function X5(n){var t,e;return t=n.c.i,e=n.d.i,t.k==(uSn(),Mut)&&e.k==Mut}function W5(n){var t;return qan(t=new wY,n),hon(t,(HXn(),vgt),null),t}function V5(n,t,e){var i;return(i=n.Yg(t))>=0?n._g(i,e,!0):cOn(n,t,e)}function Q5(n,t,e,i){var r;for(r=0;rt)throw Hp(new Ay(dCn(n,t,"index")));return n}function d6(n,t,e,i){var r;return vTn(r=x8(ANt,hQn,25,t,15,1),n,t,e,i),r}function g6(n,t){var e;e=n.q.getHours()+(t/60|0),n.q.setMinutes(t),lBn(n,e)}function p6(n,t){return e.Math.min(W8(t.a,n.d.d.c),W8(t.b,n.d.d.c))}function v6(n,t){return XI(t)?null==t?gAn(n.f,null):Gan(n.g,t):gAn(n.f,t)}function m6(n){this.c=n,this.a=new Wb(this.c.a),this.b=new Wb(this.c.b)}function y6(){this.e=new Np,this.c=new Np,this.d=new Np,this.b=new Np}function k6(){this.g=new Bv,this.b=new Bv,this.a=new Np,this.k=new Np}function j6(n,t,e){this.a=n,this.c=t,this.d=e,WB(t.e,this),WB(e.b,this)}function E6(n,t){gO.call(this,t.rd(),-6&t.qd()),kW(n),this.a=n,this.b=t}function T6(n,t){pO.call(this,t.rd(),-6&t.qd()),kW(n),this.a=n,this.b=t}function M6(n,t){vO.call(this,t.rd(),-6&t.qd()),kW(n),this.a=n,this.b=t}function S6(n,t,e){this.a=n,this.b=t,this.c=e,WB(n.t,this),WB(t.i,this)}function P6(){this.b=new YT,this.a=new YT,this.b=new YT,this.a=new YT}function C6(){C6=O,TMt=new up("org.eclipse.elk.labels.labelManager")}function I6(){I6=O,est=new iR("separateLayerConnections",(Iun(),ast))}function O6(){O6=O,Myt=new uC("REGULAR",0),Tyt=new uC("CRITICAL",1)}function A6(){A6=O,Zvt=new XP("STACKED",0),Jvt=new XP("SEQUENCED",1)}function $6(){$6=O,nTt=new TC("FIXED",0),ZEt=new TC("CENTER_NODE",1)}function L6(n,t){var e;return e=xGn(n,t),n.b=new mrn(e.c.length),yqn(n,e)}function N6(n,t,e){return++n.e,--n.f,BB(n.d[t].$c(e),133).dd()}function x6(n){var t;return n.a||cL(t=n.r,148)&&(n.a=BB(t,148)),n.a}function D6(n){return n.a?n.e?D6(n.e):null:n}function R6(n,t){return n.pt.p?-1:0}function K6(n,t){return kW(t),n.c=0,"Initial capacity must not be negative")}function Z6(){Z6=O,Wit=lhn((Dtn(),Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])))}function n8(){n8=O,trt=lhn((J9(),Pun(Gk(ert,1),$Vn,461,0,[Yit,Qit,Jit])))}function t8(){t8=O,urt=lhn((G7(),Pun(Gk(Ort,1),$Vn,462,0,[crt,rrt,irt])))}function e8(){e8=O,Zet=lhn((qsn(),Pun(Gk(nit,1),$Vn,132,0,[zet,Uet,Xet])))}function i8(){i8=O,Lat=lhn((q7(),Pun(Gk(Hat,1),$Vn,379,0,[Oat,Iat,Aat])))}function r8(){r8=O,gut=lhn((Bfn(),Pun(Gk(mut,1),$Vn,423,0,[wut,but,lut])))}function c8(){c8=O,bht=lhn((Oin(),Pun(Gk(pht,1),$Vn,314,0,[hht,sht,fht])))}function a8(){a8=O,vht=lhn((uin(),Pun(Gk(Tht,1),$Vn,337,0,[wht,ght,dht])))}function u8(){u8=O,Nht=lhn((Jun(),Pun(Gk(Bht,1),$Vn,450,0,[Aht,Oht,$ht])))}function o8(){o8=O,_st=lhn((Crn(),Pun(Gk(Wst,1),$Vn,361,0,[Rst,Dst,xst])))}function s8(){s8=O,Oft=lhn((z7(),Pun(Gk(Lft,1),$Vn,303,0,[Pft,Cft,Sft])))}function h8(){h8=O,Mft=lhn((Kan(),Pun(Gk(Ift,1),$Vn,292,0,[jft,Eft,kft])))}function f8(){f8=O,svt=lhn((Mhn(),Pun(Gk(wvt,1),$Vn,378,0,[cvt,avt,uvt])))}function l8(){l8=O,Yvt=lhn((Hcn(),Pun(Gk(nmt,1),$Vn,375,0,[Xvt,Wvt,Vvt])))}function b8(){b8=O,Rvt=lhn((mon(),Pun(Gk(Fvt,1),$Vn,339,0,[Nvt,Lvt,xvt])))}function w8(){w8=O,Uvt=lhn((ain(),Pun(Gk(Qvt,1),$Vn,452,0,[Gvt,Hvt,qvt])))}function d8(){d8=O,gmt=lhn(($un(),Pun(Gk(Smt,1),$Vn,377,0,[bmt,wmt,lmt])))}function g8(){g8=O,amt=lhn((Usn(),Pun(Gk(hmt,1),$Vn,336,0,[emt,imt,rmt])))}function p8(){p8=O,fmt=lhn((dcn(),Pun(Gk(dmt,1),$Vn,338,0,[smt,umt,omt])))}function v8(){v8=O,Nmt=lhn((oin(),Pun(Gk(xmt,1),$Vn,454,0,[Omt,Amt,$mt])))}function m8(){m8=O,rjt=lhn((Cbn(),Pun(Gk(ujt,1),$Vn,442,0,[ejt,njt,tjt])))}function y8(){y8=O,bjt=lhn((Hsn(),Pun(Gk(Gjt,1),$Vn,380,0,[sjt,hjt,fjt])))}function k8(){k8=O,eEt=lhn((Sbn(),Pun(Gk(NEt,1),$Vn,381,0,[Zjt,nEt,Jjt])))}function j8(){j8=O,Qjt=lhn((Bcn(),Pun(Gk(Yjt,1),$Vn,293,0,[Xjt,Wjt,Ujt])))}function E8(){E8=O,UEt=lhn((Pbn(),Pun(Gk(WEt,1),$Vn,437,0,[HEt,qEt,GEt])))}function T8(){T8=O,kCt=lhn((ufn(),Pun(Gk(SCt,1),$Vn,334,0,[vCt,pCt,mCt])))}function M8(){M8=O,VPt=lhn((Rtn(),Pun(Gk(nCt,1),$Vn,272,0,[zPt,UPt,XPt])))}function S8(){return QEn(),Pun(Gk(aIt,1),$Vn,98,0,[YCt,QCt,VCt,UCt,WCt,XCt])}function P8(n,t){return!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),rdn(n.o,t)}function C8(n){return!n.g&&(n.g=new oo),!n.g.d&&(n.g.d=new lp(n)),n.g.d}function I8(n){return!n.g&&(n.g=new oo),!n.g.a&&(n.g.a=new bp(n)),n.g.a}function O8(n){return!n.g&&(n.g=new oo),!n.g.b&&(n.g.b=new fp(n)),n.g.b}function A8(n){return!n.g&&(n.g=new oo),!n.g.c&&(n.g.c=new wp(n)),n.g.c}function $8(n,t,e){var i,r;for(r=new Aan(t,n),i=0;ie||t=0?n._g(e,!0,!0):cOn(n,t,!0)}function P9(n,t){return Pln(Gy(MD(mMn(n,(hWn(),Tlt)))),Gy(MD(mMn(t,Tlt))))}function C9(){C9=O,Ukt=ogn(ogn(FM(new B2,(zyn(),Kyt)),(DPn(),Qyt)),Uyt)}function I9(n,t,e){var i;return i=Non(n,t,e),n.b=new mrn(i.c.length),sDn(n,i)}function O9(n){if(n.b<=0)throw Hp(new yv);return--n.b,n.a-=n.c.c,iln(n.a)}function A9(n){var t;if(!n.a)throw Hp(new lV);return t=n.a,n.a=JJ(n.a),t}function $9(n){for(;!n.a;)if(!TK(n.c,new pw(n)))return!1;return!0}function L9(n){return yX(n),cL(n,198)?BB(n,198):new ol(n)}function N9(n){x9(),BB(n.We((sWn(),fPt)),174).Fc((lIn(),iIt)),n.Ye(hPt,null)}function x9(){x9=O,tMt=new bu,iMt=new wu,eMt=vsn((sWn(),hPt),tMt,qSt,iMt)}function D9(){D9=O,cjt=new pC("LEAF_NUMBER",0),ajt=new pC("NODE_SIZE",1)}function R9(n,t,e){n.a=t,n.c=e,n.b.a.$b(),yQ(n.d),n.e.a.c=x8(Ant,HWn,1,0,5,1)}function K9(n){n.a=x8(ANt,hQn,25,n.b+1,15,1),n.c=x8(ANt,hQn,25,n.b,15,1),n.d=0}function _9(n,t){n.a.ue(t.d,n.b)>0&&(WB(n.c,new mH(t.c,t.d,n.d)),n.b=t.d)}function F9(n,t){if(null==n.g||t>=n.i)throw Hp(new LO(t,n.i));return n.g[t]}function B9(n,t,e){if(xsn(n,e),null!=e&&!n.wj(e))throw Hp(new lv);return e}function H9(n){var t;if(n.Ek())for(t=n.i-1;t>=0;--t)Wtn(n,t);return N3(n)}function q9(n){var t,e;if(!n.b)return null;for(e=n.b;t=e.a[0];)e=t;return e}function G9(n,t){var e;return c4(t),(e=m7(n.slice(0,t),n)).length=t,e}function z9(n,t,e,i){PQ(),i=i||wet,gCn(n.slice(t,e),n,t,e,-t,i)}function U9(n,t,e,i,r){return t<0?cOn(n,e,i):BB(e,66).Nj().Pj(n,n.yh(),t,i,r)}function X9(n){return cL(n,172)?""+BB(n,172).a:null==n?null:Bbn(n)}function W9(n){return cL(n,172)?""+BB(n,172).a:null==n?null:Bbn(n)}function V9(n,t){if(t.a)throw Hp(new dy(IYn));TU(n.a,t),t.a=n,!n.j&&(n.j=t)}function Q9(n,t){vO.call(this,t.rd(),-16449&t.qd()),kW(n),this.a=n,this.c=t}function Y9(n,t){var e,i;return i=t/n.c.Hd().gc()|0,e=t%n.c.Hd().gc(),U6(n,i,e)}function J9(){J9=O,Yit=new GS(cJn,0),Qit=new GS(eJn,1),Jit=new GS(aJn,2)}function Z9(){Z9=O,Net=new gS("All",0),xet=new LA,Det=new A$,Ret=new NA}function n7(){n7=O,_et=lhn((Z9(),Pun(Gk(Fet,1),$Vn,297,0,[Net,xet,Det,Ret])))}function t7(){t7=O,rut=lhn((Aun(),Pun(Gk(dut,1),$Vn,405,0,[Zat,eut,nut,tut])))}function e7(){e7=O,_rt=lhn((Dan(),Pun(Gk(Grt,1),$Vn,406,0,[Rrt,Nrt,xrt,Drt])))}function i7(){i7=O,zrt=lhn((Hpn(),Pun(Gk(Urt,1),$Vn,323,0,[Brt,Frt,Hrt,qrt])))}function r7(){r7=O,ict=lhn((qpn(),Pun(Gk(cct,1),$Vn,394,0,[Zrt,Jrt,nct,tct])))}function c7(){c7=O,Hyt=lhn((zyn(),Pun(Gk(qyt,1),$Vn,393,0,[Ryt,Kyt,_yt,Fyt])))}function a7(){a7=O,ost=lhn((Iun(),Pun(Gk(pst,1),$Vn,360,0,[ast,rst,cst,ist])))}function u7(){u7=O,zjt=lhn((Omn(),Pun(Gk(Vjt,1),$Vn,340,0,[qjt,Bjt,Hjt,Fjt])))}function o7(){o7=O,Est=lhn((Oun(),Pun(Gk(Ist,1),$Vn,411,0,[vst,mst,yst,kst])))}function s7(){s7=O,dvt=lhn((bvn(),Pun(Gk(kvt,1),$Vn,197,0,[lvt,bvt,fvt,hvt])))}function h7(){h7=O,fOt=lhn((Bsn(),Pun(Gk(wOt,1),$Vn,396,0,[uOt,oOt,aOt,sOt])))}function f7(){f7=O,PCt=lhn((Xyn(),Pun(Gk(RCt,1),$Vn,285,0,[MCt,jCt,ECt,TCt])))}function l7(){l7=O,tCt=lhn((Mbn(),Pun(Gk(oCt,1),$Vn,218,0,[ZPt,YPt,QPt,JPt])))}function b7(){b7=O,rOt=lhn((Fwn(),Pun(Gk(cOt,1),$Vn,311,0,[eOt,ZIt,tOt,nOt])))}function w7(){w7=O,BIt=lhn((mdn(),Pun(Gk(YIt,1),$Vn,374,0,[KIt,_It,RIt,DIt])))}function d7(){d7=O,qBn(),HLt=RQn,BLt=KQn,GLt=new Nb(RQn),qLt=new Nb(KQn)}function g7(){g7=O,Ght=new OP(QZn,0),qht=new OP("IMPROVE_STRAIGHTNESS",1)}function p7(n,t){return hH(),WB(n,new rI(t,iln(t.e.c.length+t.g.c.length)))}function v7(n,t){return hH(),WB(n,new rI(t,iln(t.e.c.length+t.g.c.length)))}function m7(n,t){return 10!=vnn(t)&&Pun(tsn(t),t.hm,t.__elementTypeId$,vnn(t),n),n}function y7(n,t){var e;return-1!=(e=E7(n,t,0))&&(s6(n,e),!0)}function k7(n,t){var e;return(e=BB(v6(n.e,t),387))?(RH(e),e.e):null}function j7(n){var t;return JO(n)&&(t=0-n,!isNaN(t))?t:uan(aon(n))}function E7(n,t,e){for(;e=0?Zpn(n,e,!0,!0):cOn(n,t,!0)}function Z7(n,t){var e,i;return MM(),e=f3(n),i=f3(t),!!e&&!!i&&!Kpn(e.k,i.k)}function nnn(n,t){Pen(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function tnn(n,t){Cen(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function enn(n,t){Sen(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function inn(n,t){Men(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function rnn(n){(this.q?this.q:(SQ(),SQ(),het)).Ac(n.q?n.q:(SQ(),SQ(),het))}function cnn(n,t){return cL(t,99)&&0!=(BB(t,18).Bb&BQn)?new xO(t,n):new Aan(t,n)}function ann(n,t){return cL(t,99)&&0!=(BB(t,18).Bb&BQn)?new xO(t,n):new Aan(t,n)}function unn(n,t){Vrt=new it,ect=t,BB((Wrt=n).b,65),K8(Wrt,Vrt,null),uqn(Wrt)}function onn(n,t,e){var i;return i=n.g[t],jL(n,t,n.oi(t,e)),n.gi(t,e,i),n.ci(),i}function snn(n,t){var e;return(e=n.Xc(t))>=0&&(n.$c(e),!0)}function hnn(n){var t;return n.d!=n.r&&(t=Ikn(n),n.e=!!t&&t.Cj()==E9n,n.d=t),n.e}function fnn(n,t){var e;for(yX(n),yX(t),e=!1;t.Ob();)e|=n.Fc(t.Pb());return e}function lnn(n,t){var e;return(e=BB(RX(n.e,t),387))?(uL(n,e),e.e):null}function bnn(n){var t,e;return t=n/60|0,0==(e=n%60)?""+t:t+":"+e}function wnn(n,t){return Qln(n),new Rq(n,new KK(new M6(t,n.a)))}function dnn(n,t){var e=n.a[t],i=(Zun(),ftt)[typeof e];return i?i(e):khn(typeof e)}function gnn(n){switch(n.g){case 0:return DWn;case 1:return-1;default:return 0}}function pnn(n){return Kkn(n,(X7(),gtt))<0?-CN(aon(n)):n.l+n.m*IQn+n.h*OQn}function vnn(n){return null==n.__elementTypeCategory$?10:n.__elementTypeCategory$}function mnn(n){var t;return null!=(t=0==n.b.c.length?null:xq(n.b,0))&&hrn(n,0),t}function ynn(n,t){for(;t[0]=0;)++t[0]}function knn(n,t){this.e=t,this.a=Van(n),this.a<54?this.f=j2(n):this.c=npn(n)}function jnn(n,t,e,i){wWn(),Ap.call(this,26),this.c=n,this.a=t,this.d=e,this.b=i}function Enn(n,t,e){var i,r;for(i=10,r=0;rn.a[i]&&(i=e);return i}function Lnn(n,t){var e;return 0==(e=Ibn(n.e.c,t.e.c))?Pln(n.e.d,t.e.d):e}function Nnn(n,t){return 0==t.e||0==n.e?eet:($On(),ANn(n,t))}function xnn(n,t){if(!n)throw Hp(new _y(YNn("Enum constant undefined: %s",t)))}function Dnn(){Dnn=O,uut=new St,out=new Tt,cut=new At,aut=new $t,sut=new Lt}function Rnn(){Rnn=O,vit=new BS("BY_SIZE",0),mit=new BS("BY_SIZE_AND_SHAPE",1)}function Knn(){Knn=O,Dct=new XS("EADES",0),Rct=new XS("FRUCHTERMAN_REINGOLD",1)}function _nn(){_nn=O,Sht=new PP("READING_DIRECTION",0),Pht=new PP("ROTATION",1)}function Fnn(){Fnn=O,Mht=lhn((Vvn(),Pun(Gk(Cht,1),$Vn,335,0,[yht,mht,jht,Eht,kht])))}function Bnn(){Bnn=O,jvt=lhn((Nvn(),Pun(Gk(Avt,1),$Vn,315,0,[yvt,pvt,vvt,gvt,mvt])))}function Hnn(){Hnn=O,Ost=lhn((LEn(),Pun(Gk(Kst,1),$Vn,363,0,[Mst,Pst,Cst,Sst,Tst])))}function qnn(){qnn=O,zlt=lhn((Tbn(),Pun(Gk(ivt,1),$Vn,163,0,[qlt,_lt,Flt,Blt,Hlt])))}function Gnn(){Gnn=O,sTt=lhn(($Sn(),Pun(Gk(zTt,1),$Vn,316,0,[iTt,rTt,uTt,cTt,aTt])))}function znn(){znn=O,bMt=lhn((rpn(),Pun(Gk(jMt,1),$Vn,175,0,[hMt,sMt,uMt,fMt,oMt])))}function Unn(){Unn=O,BEt=lhn((YLn(),Pun(Gk(zEt,1),$Vn,355,0,[DEt,xEt,KEt,REt,_Et])))}function Xnn(){Xnn=O,qat=lhn((yMn(),Pun(Gk(Uat,1),$Vn,356,0,[Rat,Kat,_at,Fat,Bat])))}function Wnn(){Wnn=O,GPt=lhn((Ffn(),Pun(Gk(WPt,1),$Vn,103,0,[BPt,FPt,_Pt,KPt,HPt])))}function Vnn(){Vnn=O,zCt=lhn((cpn(),Pun(Gk(JCt,1),$Vn,249,0,[BCt,qCt,_Ct,FCt,HCt])))}function Qnn(){Qnn=O,OIt=lhn((kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])))}function Ynn(n,t){var e;return(e=BB(RX(n.a,t),134))||(e=new Zn,VW(n.a,t,e)),e}function Jnn(n){var t;return!!(t=BB(mMn(n,(hWn(),Rft)),305))&&t.a==n}function Znn(n){var t;return!!(t=BB(mMn(n,(hWn(),Rft)),305))&&t.i==n}function ntn(n,t){return kW(t),Dz(n),!!n.d.Ob()&&(t.td(n.d.Pb()),!0)}function ttn(n){return Vhn(n,DWn)>0?DWn:Vhn(n,_Vn)<0?_Vn:dG(n)}function etn(n){return n<3?(lin(n,IVn),n+1):n=0&&t=-.01&&n.a<=fJn&&(n.a=0),n.b>=-.01&&n.b<=fJn&&(n.b=0),n}function atn(n,t){return t==(c_(),c_(),Met)?n.toLocaleLowerCase():n.toLowerCase()}function utn(n){return(0!=(2&n.i)?"interface ":0!=(1&n.i)?"":"class ")+(ED(n),n.o)}function otn(n){var t;t=new $m,f9((!n.q&&(n.q=new eU(QAt,n,11,10)),n.q),t)}function stn(n,t){var e;return e=t>0?t-1:t,$j(Lj(Fen(LH(new Xm,e),n.n),n.j),n.k)}function htn(n,t,e,i){n.j=-1,qOn(n,EPn(n,t,e),(ZM(),BB(t,66).Mj().Ok(i)))}function ftn(n){this.g=n,this.f=new Np,this.a=e.Math.min(this.g.c.c,this.g.d.c)}function ltn(n){this.b=new Np,this.a=new Np,this.c=new Np,this.d=new Np,this.e=n}function btn(n,t){this.a=new xp,this.e=new xp,this.b=(Mhn(),uvt),this.c=n,this.b=t}function wtn(n,t,e){NR.call(this),xtn(this),this.a=n,this.c=e,this.b=t.d,this.f=t.e}function dtn(n){this.d=n,this.c=n.c.vc().Kc(),this.b=null,this.a=null,this.e=(ry(),znt)}function gtn(n){if(n<0)throw Hp(new _y("Illegal Capacity: "+n));this.g=this.ri(n)}function ptn(n,t){if(0>n||n>t)throw Hp(new Tk("fromIndex: 0, toIndex: "+n+hYn+t))}function vtn(n){var t;if(n.a==n.b.a)throw Hp(new yv);return t=n.a,n.c=t,n.a=n.a.e,t}function mtn(n){var t;Mx(!!n.c),t=n.c.a,Atn(n.d,n.c),n.b==n.c?n.b=t:--n.a,n.c=null}function ytn(n,t){var e;return Qln(n),e=new vQ(n,n.a.rd(),4|n.a.qd(),t),new Rq(n,e)}function ktn(n,t){var e,i;return(e=BB(lfn(n.d,t),14))?(i=t,n.e.pc(i,e)):null}function jtn(n,t){var e;for(e=n.Kc();e.Ob();)hon(BB(e.Pb(),70),(hWn(),ult),t)}function Etn(n){var t;return(t=Gy(MD(mMn(n,(HXn(),agt)))))<0&&hon(n,agt,t=0),t}function Ttn(n,t,i){var r;Fkn(i,r=e.Math.max(0,n.b/2-.5),1),WB(t,new iP(i,r))}function Mtn(n,t,e){return CJ(HH(n.a.e[BB(t.a,10).p]-n.a.e[BB(e.a,10).p]))}function Stn(n,t,e,i,r,c){var a;SZ(a=W5(i),r),MZ(a,c),JIn(n.a,i,new L_(a,t,e.f))}function Ptn(n,t){var e;if(!(e=NNn(n.Tg(),t)))throw Hp(new _y(r6n+t+u6n));return e}function Ctn(n,t){var e;for(e=n;JJ(e);)if((e=JJ(e))==t)return!0;return!1}function Itn(n,t){var e,i,r;for(i=t.a.cd(),e=BB(t.a.dd(),14).gc(),r=0;r0&&(n.a/=t,n.b/=t),n}function Utn(n){var t;return n.w?n.w:((t=V1(n))&&!t.kh()&&(n.w=t),t)}function Xtn(n){var t;return null==n?null:VTn(t=BB(n,190),t.length)}function Wtn(n,t){if(null==n.g||t>=n.i)throw Hp(new LO(t,n.i));return n.li(t,n.g[t])}function Vtn(n){var t,e;for(t=n.a.d.j,e=n.c.d.j;t!=e;)orn(n.b,t),t=Mln(t);orn(n.b,t)}function Qtn(n){var t;for(t=0;t=14&&t<=16)),n}function ien(n,t,e){var i=function(){return n.apply(i,arguments)};return t.apply(i,e),i}function ren(n,t,e){var i,r;i=t;do{r=Gy(n.p[i.p])+e,n.p[i.p]=r,i=n.a[i.p]}while(i!=t)}function cen(n,t){var e,i;i=n.a,e=Qfn(n,t,null),i!=t&&!n.e&&(e=azn(n,t,e)),e&&e.Fi()}function aen(n,t){return h$(),rin(KVn),e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)}function uen(n,t){return h$(),rin(KVn),e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)}function oen(n,t){return _Mn(),E$(n.b.c.length-n.e.c.length,t.b.c.length-t.e.c.length)}function sen(n,t){return Zj(Jrn(n,t,dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15)))))}function hen(){hen=O,Aut=lhn((uSn(),Pun(Gk($ut,1),$Vn,267,0,[Cut,Put,Mut,Iut,Sut,Tut])))}function fen(){fen=O,tSt=lhn((wEn(),Pun(Gk(qPt,1),$Vn,291,0,[ZMt,JMt,YMt,VMt,WMt,QMt])))}function len(){len=O,xMt=lhn((wvn(),Pun(Gk(nSt,1),$Vn,248,0,[CMt,AMt,$Mt,LMt,IMt,OMt])))}function ben(){ben=O,rht=lhn(($Pn(),Pun(Gk(uht,1),$Vn,227,0,[Zst,tht,Jst,nht,eht,Yst])))}function wen(){wen=O,oft=lhn((JMn(),Pun(Gk(mft,1),$Vn,275,0,[cft,eft,aft,rft,ift,tft])))}function den(){den=O,nft=lhn((Bjn(),Pun(Gk(uft,1),$Vn,274,0,[Qht,Vht,Jht,Wht,Yht,Xht])))}function gen(){gen=O,rvt=lhn((TTn(),Pun(Gk(ovt,1),$Vn,313,0,[tvt,Zpt,Ypt,Jpt,evt,nvt])))}function pen(){pen=O,Hht=lhn((gSn(),Pun(Gk(zht,1),$Vn,276,0,[Dht,xht,Kht,Rht,Fht,_ht])))}function ven(){ven=O,Jyt=lhn((DPn(),Pun(Gk(_kt,1),$Vn,327,0,[Qyt,Uyt,Wyt,Xyt,Vyt,zyt])))}function men(){men=O,uIt=lhn((lIn(),Pun(Gk(IIt,1),$Vn,273,0,[rIt,eIt,iIt,tIt,nIt,cIt])))}function yen(){yen=O,sCt=lhn((nMn(),Pun(Gk(yCt,1),$Vn,312,0,[aCt,rCt,uCt,eCt,cCt,iCt])))}function ken(){return n$n(),Pun(Gk(GCt,1),$Vn,93,0,[ICt,CCt,ACt,DCt,xCt,NCt,$Ct,LCt,OCt])}function jen(n,t){var e;e=n.a,n.a=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,0,e,n.a))}function Een(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,1,e,n.b))}function Ten(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,3,e,n.b))}function Men(n,t){var e;e=n.f,n.f=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,3,e,n.f))}function Sen(n,t){var e;e=n.g,n.g=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,4,e,n.g))}function Pen(n,t){var e;e=n.i,n.i=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,5,e,n.i))}function Cen(n,t){var e;e=n.j,n.j=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,6,e,n.j))}function Ien(n,t){var e;e=n.j,n.j=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,1,e,n.j))}function Oen(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,4,e,n.c))}function Aen(n,t){var e;e=n.k,n.k=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,2,e,n.k))}function $en(n,t){var e;e=n.d,n.d=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new l4(n,2,e,n.d))}function Len(n,t){var e;e=n.s,n.s=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new l4(n,4,e,n.s))}function Nen(n,t){var e;e=n.t,n.t=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new l4(n,5,e,n.t))}function xen(n,t){var e;e=n.F,n.F=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,5,e,t))}function Den(n,t){var e;return(e=BB(RX((nS(),mAt),n),55))?e.xj(t):x8(Ant,HWn,1,t,5,1)}function Ren(n,t){var e;return t in n.a&&(e=zJ(n,t).he())?e.a:null}function Ken(n,t){var e,i;return tE(),i=new uo,!!t&&INn(i,t),xin(e=i,n),e}function _en(n,t,e){if(xsn(n,e),!n.Bk()&&null!=e&&!n.wj(e))throw Hp(new lv);return e}function Fen(n,t){return n.n=t,n.n?(n.f=new Np,n.e=new Np):(n.f=null,n.e=null),n}function Ben(n,t,e,i,r,c){var a;return Qen(e,a=mX(n,t)),a.i=r?8:0,a.f=i,a.e=r,a.g=c,a}function Hen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=1,this.c=n,this.a=e}function qen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=2,this.c=n,this.a=e}function Gen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=6,this.c=n,this.a=e}function zen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=7,this.c=n,this.a=e}function Uen(n,t,e,i,r){this.d=t,this.j=i,this.e=r,this.o=-1,this.p=4,this.c=n,this.a=e}function Xen(n,t){var e,i,r,c;for(r=0,c=(i=t).length;r=0),rgn(n.d,n.c)<0&&(n.a=n.a-1&n.d.a.length-1,n.b=n.d.c),n.c=-1}function iin(n){return n.a<54?n.f<0?-1:n.f>0?1:0:(!n.c&&(n.c=yhn(n.f)),n.c).e}function rin(n){if(!(n>=0))throw Hp(new _y("tolerance ("+n+") must be >= 0"));return n}function cin(){return cMt||ksn(cMt=new ORn,Pun(Gk(_it,1),HWn,130,0,[new Nf])),cMt}function ain(){ain=O,Gvt=new zP(hJn,0),Hvt=new zP("INPUT",1),qvt=new zP("OUTPUT",2)}function uin(){uin=O,wht=new MP("ARD",0),ght=new MP("MSD",1),dht=new MP("MANUAL",2)}function oin(){oin=O,Omt=new YP("BARYCENTER",0),Amt=new YP(E1n,1),$mt=new YP(T1n,2)}function sin(n,t){var e;if(e=n.gc(),t<0||t>e)throw Hp(new tK(t,e));return new RK(n,t)}function hin(n,t){var e;return cL(t,42)?n.c.Mc(t):(e=rdn(n,t),Wdn(n,t),e)}function fin(n,t,e){return Ihn(n,t),Nrn(n,e),Len(n,0),Nen(n,1),nln(n,!0),Yfn(n,!0),n}function lin(n,t){if(n<0)throw Hp(new _y(t+" cannot be negative but was: "+n));return n}function bin(n,t){var e,i;for(e=0,i=n.gc();e0?BB(xq(e.a,i-1),10):null}function $in(n,t){var e;e=n.k,n.k=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,2,e,n.k))}function Lin(n,t){var e;e=n.f,n.f=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,8,e,n.f))}function Nin(n,t){var e;e=n.i,n.i=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,7,e,n.i))}function xin(n,t){var e;e=n.a,n.a=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,8,e,n.a))}function Din(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,0,e,n.b))}function Rin(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,0,e,n.b))}function Kin(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,e,n.c))}function _in(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,e,n.c))}function Fin(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,4,e,n.c))}function Bin(n,t){var e;e=n.d,n.d=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,e,n.d))}function Hin(n,t){var e;e=n.D,n.D=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,2,e,n.D))}function qin(n,t){n.r>0&&n.c0&&0!=n.g&&qin(n.i,t/n.r*n.i.d))}function Gin(n,t,e){var i;n.b=t,n.a=e,i=512==(512&n.a)?new Fm:new Dh,n.c=MDn(i,n.b,n.a)}function zin(n,t){return $xn(n.e,t)?(ZM(),hnn(t)?new lq(t,n):new xI(t,n)):new KI(t,n)}function Uin(n,t){return Jj(Zrn(n.a,t,dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15)))))}function Xin(n,t,e){return x7(n,new fw(t),new un,new lw(e),Pun(Gk(nit,1),$Vn,132,0,[]))}function Win(n){return 0>n?new VT:new $D(null,new m5(n+1,n))}function Vin(n,t){var e;return SQ(),e=new XT(1),XI(n)?mZ(e,n,t):jCn(e.f,n,t),new Xb(e)}function Qin(n,t){var e,i;return(e=n.o+n.p)<(i=t.o+t.p)?-1:e==i?0:1}function Yin(n){var t;return cL(t=mMn(n,(hWn(),dlt)),160)?mwn(BB(t,160)):null}function Jin(n){var t;return(n=e.Math.max(n,2))>(t=kon(n))?(t<<=1)>0?t:OVn:t}function Zin(n){switch(uN(3!=n.e),n.e){case 2:return!1;case 0:return!0}return _5(n)}function nrn(n,t){var e;return!!cL(t,8)&&(e=BB(t,8),n.a==e.a&&n.b==e.b)}function trn(n,t,e){var i,r;return r=t>>5,i=31&t,e0(jz(n.n[e][r],dG(yz(i,1))),3)}function ern(n,t){var e,i;for(i=t.vc().Kc();i.Ob();)vjn(n,(e=BB(i.Pb(),42)).cd(),e.dd())}function irn(n,t){var e;e=new it,BB(t.b,65),BB(t.b,65),BB(t.b,65),Otn(t.a,new TB(n,e,t))}function rrn(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,21,e,n.b))}function crn(n,t){var e;e=n.d,n.d=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,11,e,n.d))}function arn(n,t){var e;e=n.j,n.j=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,13,e,n.j))}function urn(n,t,e){var i,r,c;for(c=n.a.length-1,r=n.b,i=0;i>>31;0!=i&&(n[e]=i)}function tcn(n,t){var e,i;for(SQ(),i=new Np,e=0;e0&&(this.g=this.ri(this.i+(this.i/8|0)+1),n.Qc(this.g))}function Ecn(n,t){MH.call(this,W$t,n,t),this.b=this,this.a=axn(n.Tg(),itn(this.e.Tg(),this.c))}function Tcn(n,t){var e,i;for(kW(t),i=t.vc().Kc();i.Ob();)e=BB(i.Pb(),42),n.zc(e.cd(),e.dd())}function Mcn(n,t,e){var i;for(i=e.Kc();i.Ob();)if(!G3(n,t,i.Pb()))return!1;return!0}function Scn(n,t,e,i,r){var c;return e&&(c=Awn(t.Tg(),n.c),r=e.gh(t,-1-(-1==c?i:c),null,r)),r}function Pcn(n,t,e,i,r){var c;return e&&(c=Awn(t.Tg(),n.c),r=e.ih(t,-1-(-1==c?i:c),null,r)),r}function Ccn(n){var t;if(-2==n.b){if(0==n.e)t=-1;else for(t=0;0==n.a[t];t++);n.b=t}return n.b}function Icn(n){switch(n.g){case 2:return kUn(),CIt;case 4:return kUn(),oIt;default:return n}}function Ocn(n){switch(n.g){case 1:return kUn(),SIt;case 3:return kUn(),sIt;default:return n}}function Acn(n){var t,e,i;return n.j==(kUn(),sIt)&&(e=SN(t=UOn(n),oIt),(i=SN(t,CIt))||i&&e)}function $cn(n){var t;return new YK(t=BB(n.e&&n.e(),9),BB(VU(t,t.length),9),t.length)}function Lcn(n,t){OTn(t,k1n,1),twn(sM(new Pw((gM(),new HV(n,!1,!1,new Ft))))),HSn(t)}function Ncn(n,t){return hN(),XI(n)?f6(n,SD(t)):UI(n)?Tz(n,MD(t)):zI(n)?Ez(n,TD(t)):n.wd(t)}function xcn(n,t){t.q=n,n.d=e.Math.max(n.d,t.r),n.b+=t.d+(0==n.a.c.length?0:n.c),WB(n.a,t)}function Dcn(n,t){var e,i,r,c;return r=n.c,e=n.c+n.b,c=n.d,i=n.d+n.a,t.a>r&&t.ac&&t.b1||n.Ob())return++n.a,n.g=0,t=n.i,n.Ob(),t;throw Hp(new yv)}function San(n){var t;return a$(),uS(syt,n)||((t=new ua).a=n,wR(syt,n,t)),BB(oV(syt,n),635)}function Pan(n){var t,e,i;return e=0,(i=n)<0&&(i+=OQn,e=PQn),t=CJ(i/IQn),M$(CJ(i-t*IQn),t,e)}function Can(n){var t,e,i;for(i=0,e=new QT(n.a);e.a>22),r=n.h+t.h+(i>>22),M$(e&SQn,i&SQn,r&PQn)}function hun(n,t){var e,i,r;return e=n.l-t.l,i=n.m-t.m+(e>>22),r=n.h-t.h+(i>>22),M$(e&SQn,i&SQn,r&PQn)}function fun(n){var t;return n<128?(!(t=(Mq(),Mtt)[n])&&(t=Mtt[n]=new Lb(n)),t):new Lb(n)}function lun(n){var t;return cL(n,78)?n:((t=n&&n.__java$exception)||ov(t=new jhn(n)),t)}function bun(n){if(cL(n,186))return BB(n,118);if(n)return null;throw Hp(new Hy(e8n))}function wun(n,t){if(null==t)return!1;for(;n.a!=n.b;)if(Nfn(t,_hn(n)))return!0;return!1}function dun(n){return!!n.a.Ob()||n.a==n.d&&(n.a=new S2(n.e.f),n.a.Ob())}function gun(n,t){var e;return 0!=(e=t.Pc()).length&&(tH(n.c,n.c.length,e),!0)}function pun(n,t,e){var i,r;for(r=t.vc().Kc();r.Ob();)i=BB(r.Pb(),42),n.yc(i.cd(),i.dd(),e);return n}function vun(n,t){var e;for(e=new Wb(n.b);e.a=0,"Negative initial capacity"),vH(t>=0,"Non-positive load factor"),$U(this)}function ton(n,t,e){return!(n>=128)&&JI(n<64?e0(yz(1,n),e):e0(yz(1,n-64),t),0)}function eon(n,t){return!(!n||!t||n==t)&&Ibn(n.b.c,t.b.c+t.b.b)<0&&Ibn(t.b.c,n.b.c+n.b.b)<0}function ion(n){var t,e,i;return e=n.n,i=n.o,t=n.d,new UV(e.a-t.b,e.b-t.d,i.a+(t.b+t.c),i.b+(t.d+t.a))}function ron(n){var t,e,i,r;for(i=0,r=(e=n.a).length;i(i=n.gc()))throw Hp(new tK(t,i));return n.hi()&&(e=nZ(n,e)),n.Vh(t,e)}function son(n,t,e){return null==e?(!n.q&&(n.q=new xp),v6(n.q,t)):(!n.q&&(n.q=new xp),VW(n.q,t,e)),n}function hon(n,t,e){return null==e?(!n.q&&(n.q=new xp),v6(n.q,t)):(!n.q&&(n.q=new xp),VW(n.q,t,e)),n}function fon(n){var t,e;return qan(e=new y6,n),hon(e,(Mrn(),sat),n),eBn(n,e,t=new xp),Szn(n,e,t),e}function lon(n){var t,e,i;for(jDn(),e=x8(PMt,sVn,8,2,0,1),i=0,t=0;t<2;t++)i+=.5,e[t]=lmn(i,n);return e}function bon(n,t){var e,i,r;for(e=!1,i=n.a[t].length,r=0;r>=1);return t}function jon(n){var t,e;return 32==(e=ZIn(n.h))?32==(t=ZIn(n.m))?ZIn(n.l)+32:t+20-10:e-12}function Eon(n){var t;return null==(t=n.a[n.b])?null:($X(n.a,n.b,null),n.b=n.b+1&n.a.length-1,t)}function Ton(n){var t,e;return t=n.t-n.k[n.o.p]*n.d+n.j[n.o.p]>n.f,e=n.u+n.e[n.o.p]*n.d>n.f*n.s*n.d,t||e}function Mon(n,t,e){var i,r;return i=new H8(t,e),r=new q,n.b=Wxn(n,n.b,i,r),r.b||++n.c,n.b.b=!1,r.d}function Son(n,t,e){var i,r,c;for(c=0,r=Lfn(t,e).Kc();r.Ob();)i=BB(r.Pb(),11),VW(n.c,i,iln(c++))}function Pon(n){var t,e;for(e=new Wb(n.a.b);e.ae&&(e=n[t]);return e}function Non(n,t,e){var i;return jxn(n,t,i=new Np,(kUn(),oIt),!0,!1),jxn(n,e,i,CIt,!1,!1),i}function xon(n,t,e){var i,r;return r=N2(t,"labels"),XAn((i=new gI(n,e)).a,i.b,r),r}function Don(n,t,e,i){var r;return(r=m$n(n,t,e,i))||!(r=aln(n,e,i))||Fqn(n,t,r)?r:null}function Ron(n,t,e,i){var r;return(r=y$n(n,t,e,i))||!(r=uln(n,e,i))||Fqn(n,t,r)?r:null}function Kon(n,t){var e;for(e=0;e1||t>=0&&n.b<3)}function Jon(n){var t,e;for(t=new km,e=spn(n,0);e.b!=e.d.c;)Kx(t,0,new wA(BB(b3(e),8)));return t}function Zon(n){var t;for(t=new Wb(n.a.b);t.ai?1:0}function dsn(n,t){return!!bNn(n,t)&&(JIn(n.b,BB(mMn(t,(hWn(),Xft)),21),t),DH(n.a,t),!0)}function gsn(n){var t,e;(t=BB(mMn(n,(hWn(),Elt)),10))&&(y7((e=t.c).a,t),0==e.a.c.length&&y7(vW(t).b,e))}function psn(n){return Qet?x8(Get,dYn,572,0,0,1):BB(Qgn(n.a,x8(Get,dYn,572,n.a.c.length,0,1)),842)}function vsn(n,t,e,i){return nV(),new hy(Pun(Gk(Hnt,1),kVn,42,0,[(zvn(n,t),new vT(n,t)),(zvn(e,i),new vT(e,i))]))}function msn(n,t,e){var i;return fin(i=new $m,t,e),f9((!n.q&&(n.q=new eU(QAt,n,11,10)),n.q),i),i}function ysn(n){var t,e,i,r;for(e=(r=fS(AOt,n)).length,i=x8(Qtt,sVn,2,e,6,1),t=0;t=n.b.c.length||(Esn(n,2*t+1),(e=2*t+2)=0&&n[i]===t[i];i--);return i<0?0:sS(e0(n[i],UQn),e0(t[i],UQn))?-1:1}function Ssn(n,t){var e,i;for(i=spn(n,0);i.b!=i.d.c;)(e=BB(b3(i),214)).e.length>0&&(t.td(e),e.i&&pln(e))}function Psn(n,t){var e,i;return i=BB(yan(n.a,4),126),e=x8(dAt,i9n,415,t,0,1),null!=i&&aHn(i,0,e,0,i.length),e}function Csn(n,t){var e;return e=new rRn(0!=(256&n.f),n.i,n.a,n.d,0!=(16&n.f),n.j,n.g,t),null!=n.e||(e.c=n),e}function Isn(n,t){var e;for(e=n.Zb().Cc().Kc();e.Ob();)if(BB(e.Pb(),14).Hc(t))return!0;return!1}function Osn(n,t,e,i,r){var c,a;for(a=e;a<=r;a++)for(c=t;c<=i;c++)if(vmn(n,c,a))return!0;return!1}function Asn(n,t,e){var i,r,c,a;for(kW(e),a=!1,c=n.Zc(t),r=e.Kc();r.Ob();)i=r.Pb(),c.Rb(i),a=!0;return a}function $sn(n,t){var e;return n===t||!!cL(t,83)&&(e=BB(t,83),zSn(lz(n),e.vc()))}function Lsn(n,t,e){var i,r;for(r=e.Kc();r.Ob();)if(i=BB(r.Pb(),42),n.re(t,i.dd()))return!0;return!1}function Nsn(n,t,e){return n.d[t.p][e.p]||(ivn(n,t,e),n.d[t.p][e.p]=!0,n.d[e.p][t.p]=!0),n.a[t.p][e.p]}function xsn(n,t){if(!n.ai()&&null==t)throw Hp(new _y("The 'no null' constraint is violated"));return t}function Dsn(n,t){null==n.D&&null!=n.B&&(n.D=n.B,n.B=null),Hin(n,null==t?null:(kW(t),t)),n.C&&n.yk(null)}function Rsn(n,t){return!(!n||n==t||!Lx(t,(hWn(),rlt)))&&BB(mMn(t,(hWn(),rlt)),10)!=n}function Ksn(n){switch(n.i){case 2:return!0;case 1:return!1;case-1:++n.c;default:return n.pl()}}function _sn(n){switch(n.i){case-2:return!0;case-1:return!1;case 1:--n.c;default:return n.ql()}}function Fsn(n){_J.call(this,"The given string does not match the expected format for individual spacings.",n)}function Bsn(){Bsn=O,uOt=new cI("ELK",0),oOt=new cI("JSON",1),aOt=new cI("DOT",2),sOt=new cI("SVG",3)}function Hsn(){Hsn=O,sjt=new vC(QZn,0),hjt=new vC("RADIAL_COMPACTION",1),fjt=new vC("WEDGE_COMPACTION",2)}function qsn(){qsn=O,zet=new pS("CONCURRENT",0),Uet=new pS("IDENTITY_FINISH",1),Xet=new pS("UNORDERED",2)}function Gsn(){Gsn=O,wM(),oct=new $O(BJn,sct=rct),uct=new up(HJn),hct=new up(qJn),fct=new up(GJn)}function zsn(){zsn=O,lst=new ji,bst=new Ei,fst=new Ti,hst=new Mi,kW(new Si),sst=new D}function Usn(){Usn=O,emt=new WP("CONSERVATIVE",0),imt=new WP("CONSERVATIVE_SOFT",1),rmt=new WP("SLOPPY",2)}function Xsn(){Xsn=O,dCt=new WA(15),wCt=new XA((sWn(),XSt),dCt),gCt=gPt,hCt=aSt,fCt=KSt,bCt=BSt,lCt=FSt}function Wsn(n,t,e){var i,r;for(i=new YT,r=spn(e,0);r.b!=r.d.c;)DH(i,new wA(BB(b3(r),8)));Asn(n,t,i)}function Vsn(n){var t,e,i;for(t=0,i=x8(PMt,sVn,8,n.b,0,1),e=spn(n,0);e.b!=e.d.c;)i[t++]=BB(b3(e),8);return i}function Qsn(n){var t;return!n.a&&(n.a=new eU(WAt,n,9,5)),0!=(t=n.a).i?HM(BB(Wtn(t,0),678)):null}function Ysn(n,t){var e;return e=rbn(n,t),sS(r0(n,t),0)|YI(r0(n,e),0)?e:rbn(bVn,r0(jz(e,63),1))}function Jsn(n,t){var e;e=null!=mpn((Rwn(),Vpt))&&null!=t.wg()?Gy(MD(t.wg()))/Gy(MD(mpn(Vpt))):1,VW(n.b,t,e)}function Zsn(n,t){var e,i;return(e=BB(n.d.Bc(t),14))?((i=n.e.hc()).Gc(e),n.e.d-=e.gc(),e.$b(),i):null}function nhn(n,t){var e,i;if(0!=(i=n.c[t]))for(n.c[t]=0,n.d-=i,e=t+1;e0)return Kz(t-1,n.a.c.length),s6(n.a,t-1);throw Hp(new mv)}function ehn(n,t,e){if(t<0)throw Hp(new Ay(n5n+t));tt)throw Hp(new _y(mYn+n+yYn+t));if(n<0||t>e)throw Hp(new Tk(mYn+n+kYn+t+hYn+e))}function rhn(n){if(!n.a||0==(8&n.a.i))throw Hp(new Fy("Enumeration class expected for layout option "+n.f))}function chn(n){var t;++n.j,0==n.i?n.g=null:n.i_3n?n-i>_3n:i-n>_3n)}function vhn(n,t){return n?t&&!n.j||cL(n,124)&&0==BB(n,124).a.b?0:n.Re():0}function mhn(n,t){return n?t&&!n.k||cL(n,124)&&0==BB(n,124).a.a?0:n.Se():0}function yhn(n){return ODn(),n<0?-1!=n?new Rpn(-1,-n):Ytt:n<=10?Ztt[CJ(n)]:new Rpn(1,n)}function khn(n){throw Zun(),Hp(new gy("Unexpected typeof result '"+n+"'; please report this bug to the GWT team"))}function jhn(n){hk(),V$(this),jQ(this),this.e=n,Cxn(this,n),this.g=null==n?zWn:Bbn(n),this.a="",this.b=n,this.a=""}function Ehn(){this.a=new nu,this.f=new dg(this),this.b=new gg(this),this.i=new pg(this),this.e=new vg(this)}function Thn(){cy.call(this,new q8(etn(16))),lin(2,oVn),this.b=2,this.a=new HW(null,null,0,null),iv(this.a,this.a)}function Mhn(){Mhn=O,cvt=new KP("DUMMY_NODE_OVER",0),avt=new KP("DUMMY_NODE_UNDER",1),uvt=new KP("EQUAL",2)}function Shn(){Shn=O,Xat=HJ(Pun(Gk(WPt,1),$Vn,103,0,[(Ffn(),_Pt),FPt])),Wat=HJ(Pun(Gk(WPt,1),$Vn,103,0,[HPt,KPt]))}function Phn(n){return(kUn(),yIt).Hc(n.j)?Gy(MD(mMn(n,(hWn(),Llt)))):Aon(Pun(Gk(PMt,1),sVn,8,0,[n.i.n,n.n,n.a])).b}function Chn(n){var t,e;for(t=n.b.a.a.ec().Kc();t.Ob();)e=new Q$n(BB(t.Pb(),561),n.e,n.f),WB(n.g,e)}function Ihn(n,t){var e,i;e=n.nk(t,null),i=null,t&&(iE(),cen(i=new Kp,n.r)),(e=HTn(n,i,e))&&e.Fi()}function Ohn(n,t){var e,i;for(i=0!=H$n(n.d,1),e=!0;e;)e=!1,e=t.c.Tf(t.e,i),e|=DNn(n,t,i,!1),i=!i;$rn(n)}function Ahn(n,t){var e,i,r;return i=!1,e=t.q.d,t.dr&&(aEn(t.q,r),i=e!=t.q.d)),i}function $hn(n,t){var i,r,c,a,u;return a=t.i,u=t.j,r=a-(i=n.f).i,c=u-i.j,e.Math.sqrt(r*r+c*c)}function Lhn(n,t){var e;return(e=Ydn(n))||(!$Ot&&($Ot=new Oo),RHn(),f9((e=new Cp(YPn(t))).Vk(),n)),e}function Nhn(n,t){var e,i;return(e=BB(n.c.Bc(t),14))?((i=n.hc()).Gc(e),n.d-=e.gc(),e.$b(),n.mc(i)):n.jc()}function xhn(n,t){var e;for(e=0;e=n.c.b:n.a<=n.c.b))throw Hp(new yv);return t=n.a,n.a+=n.c.c,++n.b,iln(t)}function Bhn(n){var t;return t=new ftn(n),i2(n.a,sut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[t]))),t.d&&WB(t.f,t.d),t.f}function Hhn(n){var t;return qan(t=new O$(n.a),n),hon(t,(hWn(),dlt),n),t.o.a=n.g,t.o.b=n.f,t.n.a=n.i,t.n.b=n.j,t}function qhn(n,t,e,i){var r,c;for(c=n.Kc();c.Ob();)(r=BB(c.Pb(),70)).n.a=t.a+(i.a-r.o.a)/2,r.n.b=t.b,t.b+=r.o.b+e}function Ghn(n,t,e){var i;for(i=t.a.a.ec().Kc();i.Ob();)if(cY(n,BB(i.Pb(),57),e))return!0;return!1}function zhn(n){var t,e;for(e=new Wb(n.r);e.a=0?t:-t;i>0;)i%2==0?(e*=e,i=i/2|0):(r*=e,i-=1);return t<0?1/r:r}function ifn(n,t){var e,i,r;for(r=1,e=n,i=t>=0?t:-t;i>0;)i%2==0?(e*=e,i=i/2|0):(r*=e,i-=1);return t<0?1/r:r}function rfn(n){var t,e,i,r;if(null!=n)for(e=0;e0&&dsn(BB(xq(n.a,n.a.c.length-1),570),t)||WB(n.a,new p5(t))}function vfn(n){var t,e;G_(),t=n.d.c-n.e.c,Otn((e=BB(n.g,145)).b,new jd(t)),Otn(e.c,new Ed(t)),e5(e.i,new Td(t))}function mfn(n){var t;return(t=new Ck).a+="VerticalSegment ",uO(t,n.e),t.a+=" ",oO(t,JL(new mk,new Wb(n.k))),t.a}function yfn(n){var t;return(t=BB(lnn(n.c.c,""),229))||(t=new UZ(jj(kj(new pu,""),"Other")),Jgn(n.c.c,"",t)),t}function kfn(n){var t;return 0!=(64&n.Db)?P$n(n):((t=new fN(P$n(n))).a+=" (name: ",cO(t,n.zb),t.a+=")",t.a)}function jfn(n,t,e){var i,r;return r=n.sb,n.sb=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,4,r,t),e?e.Ei(i):e=i),e}function Efn(n,t){var e,i;for(e=0,i=abn(n,t).Kc();i.Ob();)e+=null!=mMn(BB(i.Pb(),11),(hWn(),Elt))?1:0;return e}function Tfn(n,t,e){var i,r,c;for(i=0,c=spn(n,0);c.b!=c.d.c&&!((r=Gy(MD(b3(c))))>e);)r>=t&&++i;return i}function Mfn(n,t,e){var i;return i=new N7(n.e,3,13,null,t.c||(gWn(),l$t),uvn(n,t),!1),e?e.Ei(i):e=i,e}function Sfn(n,t,e){var i;return i=new N7(n.e,4,13,t.c||(gWn(),l$t),null,uvn(n,t),!1),e?e.Ei(i):e=i,e}function Pfn(n,t,e){var i,r;return r=n.r,n.r=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,8,r,n.r),e?e.Ei(i):e=i),e}function Cfn(n,t){var e,i;return!(i=(e=BB(t,676)).vk())&&e.wk(i=cL(t,88)?new $I(n,BB(t,26)):new _0(n,BB(t,148))),i}function Ifn(n,t,e){var i;n.qi(n.i+1),i=n.oi(t,e),t!=n.i&&aHn(n.g,t,n.g,t+1,n.i-t),$X(n.g,t,i),++n.i,n.bi(t,e),n.ci()}function Ofn(n,t){var e;return t.a&&(e=t.a.a.length,n.a?oO(n.a,n.b):n.a=new lN(n.d),G0(n.a,t.a,t.d.length,e)),n}function Afn(n,t){var e,i,r;if(t.vi(n.a),null!=(r=BB(yan(n.a,8),1936)))for(e=0,i=r.length;ee)throw Hp(new Ay(mYn+n+kYn+t+", size: "+e));if(n>t)throw Hp(new _y(mYn+n+yYn+t))}function qfn(n,t,e){if(t<0)cIn(n,e);else{if(!e.Ij())throw Hp(new _y(r6n+e.ne()+c6n));BB(e,66).Nj().Vj(n,n.yh(),t)}}function Gfn(n,t,e,i,r,c,a,u){var o;for(o=e;c=i||t=65&&n<=70?n-65+10:n>=97&&n<=102?n-97+10:n>=48&&n<=57?n-48:0}function Vfn(n){var t;return 0!=(64&n.Db)?P$n(n):((t=new fN(P$n(n))).a+=" (source: ",cO(t,n.d),t.a+=")",t.a)}function Qfn(n,t,e){var i,r;return r=n.a,n.a=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,5,r,n.a),e?KEn(e,i):e=i),e}function Yfn(n,t){var e;e=0!=(256&n.Bb),t?n.Bb|=256:n.Bb&=-257,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,2,e,t))}function Jfn(n,t){var e;e=0!=(256&n.Bb),t?n.Bb|=256:n.Bb&=-257,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,8,e,t))}function Zfn(n,t){var e;e=0!=(256&n.Bb),t?n.Bb|=256:n.Bb&=-257,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,8,e,t))}function nln(n,t){var e;e=0!=(512&n.Bb),t?n.Bb|=512:n.Bb&=-513,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,3,e,t))}function tln(n,t){var e;e=0!=(512&n.Bb),t?n.Bb|=512:n.Bb&=-513,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,9,e,t))}function eln(n,t){var e;return-1==n.b&&n.a&&(e=n.a.Gj(),n.b=e?n.c.Xg(n.a.aj(),e):Awn(n.c.Tg(),n.a)),n.c.Og(n.b,t)}function iln(n){var t,e;return n>-129&&n<128?(t=n+128,!(e=(tq(),Itt)[t])&&(e=Itt[t]=new xb(n)),e):new xb(n)}function rln(n){var t,e;return n>-129&&n<128?(t=n+128,!(e=(Tq(),Ktt)[t])&&(e=Ktt[t]=new Rb(n)),e):new Rb(n)}function cln(n){var t;return n.k==(uSn(),Mut)&&((t=BB(mMn(n,(hWn(),Qft)),61))==(kUn(),sIt)||t==SIt)}function aln(n,t,e){var i,r;return(r=$$n(n.b,t))&&(i=BB(NHn(F7(n,r),""),26))?m$n(n,i,t,e):null}function uln(n,t,e){var i,r;return(r=$$n(n.b,t))&&(i=BB(NHn(F7(n,r),""),26))?y$n(n,i,t,e):null}function oln(n,t){var e,i;for(i=new AL(n);i.e!=i.i.gc();)if(e=BB(kpn(i),138),GI(t)===GI(e))return!0;return!1}function sln(n,t,e){var i;if(t>(i=n.gc()))throw Hp(new tK(t,i));if(n.hi()&&n.Hc(e))throw Hp(new _y(a8n));n.Xh(t,e)}function hln(n,t){var e;if(null==(e=sen(n.i,t)))throw Hp(new ek("Node did not exist in input."));return Kcn(t,e),null}function fln(n,t){var e;if(cL(e=NNn(n,t),322))return BB(e,34);throw Hp(new _y(r6n+t+"' is not a valid attribute"))}function lln(n,t,e){var i,r;for(r=cL(t,99)&&0!=(BB(t,18).Bb&BQn)?new xO(t,n):new Aan(t,n),i=0;it?1:n==t?0==n?Pln(1/n,1/t):0:isNaN(n)?isNaN(t)?0:1:-1}function Cln(n,t){OTn(t,"Sort end labels",1),JT(AV(wnn(new Rq(null,new w1(n.b,16)),new we),new de),new ge),HSn(t)}function Iln(n,t,e){var i,r;return n.ej()?(r=n.fj(),i=YIn(n,t,e),n.$i(n.Zi(7,iln(e),i,t,r)),i):YIn(n,t,e)}function Oln(n,t){var e,i,r;null==n.d?(++n.e,--n.f):(r=t.cd(),N6(n,i=((e=t.Sh())&DWn)%n.d.length,A$n(n,i,e,r)))}function Aln(n,t){var e;e=0!=(n.Bb&k6n),t?n.Bb|=k6n:n.Bb&=-1025,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,10,e,t))}function $ln(n,t){var e;e=0!=(n.Bb&_Qn),t?n.Bb|=_Qn:n.Bb&=-4097,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,12,e,t))}function Lln(n,t){var e;e=0!=(n.Bb&T9n),t?n.Bb|=T9n:n.Bb&=-8193,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,15,e,t))}function Nln(n,t){var e;e=0!=(n.Bb&M9n),t?n.Bb|=M9n:n.Bb&=-2049,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,11,e,t))}function xln(n,t){var e;return 0!=(e=Pln(n.b.c,t.b.c))||0!=(e=Pln(n.a.a,t.a.a))?e:Pln(n.a.b,t.a.b)}function Dln(n,t){var e;if(null==(e=RX(n.k,t)))throw Hp(new ek("Port did not exist in input."));return Kcn(t,e),null}function Rln(n){var t,e;for(e=G$n(Utn(n)).Kc();e.Ob();)if(N_n(n,t=SD(e.Pb())))return y4((UM(),RAt),t);return null}function Kln(n,t){var e,i,r,c,a;for(a=axn(n.e.Tg(),t),c=0,e=BB(n.g,119),r=0;r>10)+HQn&QVn,t[1]=56320+(1023&n)&QVn,Bdn(t,0,t.length)}function Wln(n){var t;return(t=BB(mMn(n,(HXn(),Udt)),103))==(Ffn(),BPt)?Gy(MD(mMn(n,Edt)))>=1?FPt:KPt:t}function Vln(n){switch(BB(mMn(n,(HXn(),Zdt)),218).g){case 1:return new ic;case 3:return new oc;default:return new ec}}function Qln(n){if(n.c)Qln(n.c);else if(n.d)throw Hp(new Fy("Stream already terminated, can't be modified or used"))}function Yln(n){var t;return 0!=(64&n.Db)?P$n(n):((t=new fN(P$n(n))).a+=" (identifier: ",cO(t,n.k),t.a+=")",t.a)}function Jln(n,t,e){var i;return tE(),jen(i=new ro,t),Een(i,e),n&&f9((!n.a&&(n.a=new $L(xOt,n,5)),n.a),i),i}function Zln(n,t,e,i){var r,c;return kW(i),kW(e),null==(c=null==(r=n.xc(t))?e:ZT(BB(r,15),BB(e,14)))?n.Bc(t):n.zc(t,c),c}function nbn(n){var t,e,i,r;return orn(e=new YK(t=BB(Vj((r=(i=n.gm).f)==Unt?i:r),9),BB(SR(t,t.length),9),0),n),e}function tbn(n,t,e){var i,r;for(r=n.a.ec().Kc();r.Ob();)if(i=BB(r.Pb(),10),oun(e,BB(xq(t,i.p),14)))return i;return null}function ebn(n,t,e){try{_on(n,t,e)}catch(i){throw cL(i=lun(i),597)?Hp(new g5(i)):Hp(i)}return t}function ibn(n,t){var e;return JO(n)&&JO(t)&&$Qn<(e=n-t)&&e>1,n.k=i-1>>1}function sbn(){var n,t,i;yTn(),i=Let+++Date.now(),n=CJ(e.Math.floor(i*uYn))&sYn,t=CJ(i-n*oYn),this.a=1502^n,this.b=t^aYn}function hbn(n){var t,e;for(t=new Np,e=new Wb(n.j);e.a34028234663852886e22?RQn:t<-34028234663852886e22?KQn:t}function pbn(n){return n=((n=((n-=n>>1&1431655765)>>2&858993459)+(858993459&n))>>4)+n&252645135,n+=n>>8,63&(n+=n>>16)}function vbn(n){var t,e,i;for(t=new hR(n.Hd().gc()),i=0,e=L9(n.Hd().Kc());e.Ob();)jZ(t,e.Pb(),iln(i++));return NSn(t.a)}function mbn(n,t){var e,i,r;for(r=new xp,i=t.vc().Kc();i.Ob();)VW(r,(e=BB(i.Pb(),42)).cd(),lan(n,BB(e.dd(),15)));return r}function ybn(n,t){0==n.n.c.length&&WB(n.n,new RJ(n.s,n.t,n.i)),WB(n.b,t),smn(BB(xq(n.n,n.n.c.length-1),211),t),BFn(n,t)}function kbn(n){return n.c==n.b.b&&n.i==n.g.b||(n.a.c=x8(Ant,HWn,1,0,5,1),gun(n.a,n.b),gun(n.a,n.g),n.c=n.b.b,n.i=n.g.b),n.a}function jbn(n,t){var e,i;for(i=0,e=BB(t.Kb(n),20).Kc();e.Ob();)qy(TD(mMn(BB(e.Pb(),17),(hWn(),Clt))))||++i;return i}function Ebn(n,t){var i,r;r=Gy(MD(edn(f2(t),(HXn(),ypt)))),Fkn(t,i=e.Math.max(0,r/2-.5),1),WB(n,new lP(t,i))}function Tbn(){Tbn=O,qlt=new BP(QZn,0),_lt=new BP("FIRST",1),Flt=new BP(C1n,2),Blt=new BP("LAST",3),Hlt=new BP(I1n,4)}function Mbn(){Mbn=O,ZPt=new FC(hJn,0),YPt=new FC("POLYLINE",1),QPt=new FC("ORTHOGONAL",2),JPt=new FC("SPLINES",3)}function Sbn(){Sbn=O,Zjt=new kC("ASPECT_RATIO_DRIVEN",0),nEt=new kC("MAX_SCALE_DRIVEN",1),Jjt=new kC("AREA_DRIVEN",2)}function Pbn(){Pbn=O,HEt=new EC("P1_STRUCTURE",0),qEt=new EC("P2_PROCESSING_ORDER",1),GEt=new EC("P3_EXECUTION",2)}function Cbn(){Cbn=O,ejt=new gC("OVERLAP_REMOVAL",0),njt=new gC("COMPACTION",1),tjt=new gC("GRAPH_SIZE_CALCULATION",2)}function Ibn(n,t){return h$(),rin(KVn),e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:nt?1:zO(isNaN(n),isNaN(t))}function Obn(n,t){var e,i;for(e=spn(n,0);e.b!=e.d.c;){if((i=zy(MD(b3(e))))==t)return;if(i>t){U0(e);break}}nX(e,t)}function Abn(n,t){var e,i,r,c,a;if(e=t.f,Jgn(n.c.d,e,t),null!=t.g)for(c=0,a=(r=t.g).length;ct&&i.ue(n[c-1],n[c])>0;--c)a=n[c],$X(n,c,n[c-1]),$X(n,c-1,a)}function Lbn(n,t,e,i){if(t<0)TLn(n,e,i);else{if(!e.Ij())throw Hp(new _y(r6n+e.ne()+c6n));BB(e,66).Nj().Tj(n,n.yh(),t,i)}}function Nbn(n,t){if(t==n.d)return n.e;if(t==n.e)return n.d;throw Hp(new _y("Node "+t+" not part of edge "+n))}function xbn(n,t){switch(t.g){case 2:return n.b;case 1:return n.c;case 4:return n.d;case 3:return n.a;default:return!1}}function Dbn(n,t){switch(t.g){case 2:return n.b;case 1:return n.c;case 4:return n.d;case 3:return n.a;default:return!1}}function Rbn(n,t,e,i){switch(t){case 3:return n.f;case 4:return n.g;case 5:return n.i;case 6:return n.j}return _fn(n,t,e,i)}function Kbn(n){return n.k==(uSn(),Cut)&&o5(new Rq(null,new zU(new oz(ZL(lbn(n).a.Kc(),new h)))),new qr)}function _bn(n){return null==n.e?n:(!n.c&&(n.c=new rRn(0!=(256&n.f),n.i,n.a,n.d,0!=(16&n.f),n.j,n.g,null)),n.c)}function Fbn(n,t){return n.h==CQn&&0==n.m&&0==n.l?(t&&(ltt=M$(0,0,0)),WO((X7(),dtt))):(t&&(ltt=M$(n.l,n.m,n.h)),M$(0,0,0))}function Bbn(n){return Array.isArray(n)&&n.im===I?nE(tsn(n))+"@"+(nsn(n)>>>0).toString(16):n.toString()}function Hbn(n){var t;this.a=new YK(t=BB(n.e&&n.e(),9),BB(SR(t,t.length),9),0),this.b=x8(Ant,HWn,1,this.a.a.length,5,1)}function qbn(n){var t,e,i;for(this.a=new fA,i=new Wb(n);i.a0&&(b1(t-1,n.length),58==n.charCodeAt(t-1))&&!Xbn(n,LAt,NAt)}function Xbn(n,t,e){var i,r;for(i=0,r=n.length;i=r)return t.c+e;return t.c+t.b.gc()}function Qbn(n,t){var e,i,r,c;for(dD(),r=t,z9(i=H9(n),0,i.length,r),e=0;e0&&(i+=r,++e);return e>1&&(i+=n.d*(e-1)),i}function Jbn(n){var t,e,i;for((i=new Sk).a+="[",t=0,e=n.gc();t0&&this.b>0&&Yq(this.c,this.b,this.a)}function uwn(n){Rwn(),this.c=u6(Pun(Gk(rMt,1),HWn,831,0,[Wpt])),this.b=new xp,this.a=n,VW(this.b,Vpt,1),Otn(Qpt,new Pg(this))}function own(n,t){var e;return n.d?hU(n.b,t)?BB(RX(n.b,t),51):(e=t.Kf(),VW(n.b,t,e),e):t.Kf()}function swn(n,t){var e;return GI(n)===GI(t)||!!cL(t,91)&&(e=BB(t,91),n.e==e.e&&n.d==e.d&&E4(n,e.a))}function hwn(n){switch(kUn(),n.g){case 4:return sIt;case 1:return oIt;case 3:return SIt;case 2:return CIt;default:return PIt}}function fwn(n,t){switch(t){case 3:return 0!=n.f;case 4:return 0!=n.g;case 5:return 0!=n.i;case 6:return 0!=n.j}return Ean(n,t)}function lwn(n){switch(n.g){case 0:return new Ga;case 1:return new za;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function bwn(n){switch(n.g){case 0:return new qa;case 1:return new Ua;default:throw Hp(new _y(M1n+(null!=n.f?n.f:""+n.g)))}}function wwn(n){switch(n.g){case 0:return new Vm;case 1:return new ym;default:throw Hp(new _y(N4n+(null!=n.f?n.f:""+n.g)))}}function dwn(n){switch(n.g){case 1:return new Ra;case 2:return new gD;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function gwn(n){var t,e;if(n.b)return n.b;for(e=Qet?null:n.d;e;){if(t=Qet?null:e.b)return t;e=Qet?null:e.d}return lM(),Het}function pwn(n){var t,e;return 0==n.e?0:(t=n.d<<5,e=n.a[n.d-1],n.e<0&&Ccn(n)==n.d-1&&(--e,e|=0),t-=ZIn(e))}function vwn(n){var t,e,i;return n>5),15,1))[e]=1<3;)r*=10,--c;n=(n+(r>>1))/r|0}return i.i=n,!0}function Ewn(n){return Shn(),hN(),!!(Dbn(BB(n.a,81).j,BB(n.b,103))||0!=BB(n.a,81).d.e&&Dbn(BB(n.a,81).j,BB(n.b,103)))}function Twn(n){x9(),BB(n.We((sWn(),qSt)),174).Hc((n_n(),VIt))&&(BB(n.We(fPt),174).Fc((lIn(),cIt)),BB(n.We(qSt),174).Mc(VIt))}function Mwn(n,t){var e;if(t){for(e=0;e=0;--i)for(t=e[i],r=0;r>1,this.k=t-1>>1}function Gwn(n,t){OTn(t,"End label post-processing",1),JT(AV(wnn(new Rq(null,new w1(n.b,16)),new ae),new ue),new oe),HSn(t)}function zwn(n,t,e){var i;return i=Gy(n.p[t.i.p])+Gy(n.d[t.i.p])+t.n.b+t.a.b,Gy(n.p[e.i.p])+Gy(n.d[e.i.p])+e.n.b+e.a.b-i}function Uwn(n,t,e){var i,r;for(i=e0(e,UQn),r=0;0!=Vhn(i,0)&&r0&&(b1(0,t.length),43==t.charCodeAt(0))?t.substr(1):t)}function Vwn(n){var t;return null==n?null:new $A((t=FBn(n,!0)).length>0&&(b1(0,t.length),43==t.charCodeAt(0))?t.substr(1):t)}function Qwn(n,t){return n.i>0&&(t.lengthn.i&&$X(t,n.i,null),t}function Ywn(n,t,e){var i,r,c;return n.ej()?(i=n.i,c=n.fj(),Ifn(n,i,t),r=n.Zi(3,null,t,i,c),e?e.Ei(r):e=r):Ifn(n,n.i,t),e}function Jwn(n,t,e){var i,r;return i=new N7(n.e,4,10,cL(r=t.c,88)?BB(r,26):(gWn(),d$t),null,uvn(n,t),!1),e?e.Ei(i):e=i,e}function Zwn(n,t,e){var i,r;return i=new N7(n.e,3,10,null,cL(r=t.c,88)?BB(r,26):(gWn(),d$t),uvn(n,t),!1),e?e.Ei(i):e=i,e}function ndn(n){var t;return qD(),t=new wA(BB(n.e.We((sWn(),BSt)),8)),n.B.Hc((n_n(),GIt))&&(t.a<=0&&(t.a=20),t.b<=0&&(t.b=20)),t}function tdn(n){return bvn(),(n.q?n.q:(SQ(),SQ(),het))._b((HXn(),Rgt))?BB(mMn(n,Rgt),197):BB(mMn(vW(n),Kgt),197)}function edn(n,t){var e,i;return i=null,Lx(n,(HXn(),Mpt))&&(e=BB(mMn(n,Mpt),94)).Xe(t)&&(i=e.We(t)),null==i&&(i=mMn(vW(n),t)),i}function idn(n,t){var e,i,r;return!!cL(t,42)&&(i=(e=BB(t,42)).cd(),wW(r=lfn(n.Rc(),i),e.dd())&&(null!=r||n.Rc()._b(i)))}function rdn(n,t){var e;return n.f>0&&(n.qj(),-1!=A$n(n,((e=null==t?0:nsn(t))&DWn)%n.d.length,e,t))}function cdn(n,t){var e,i;return n.f>0&&(n.qj(),e=aOn(n,((i=null==t?0:nsn(t))&DWn)%n.d.length,i,t))?e.dd():null}function adn(n,t){var e,i,r,c;for(c=axn(n.e.Tg(),t),e=BB(n.g,119),r=0;r1?i0(yz(t.a[1],32),e0(t.a[0],UQn)):e0(t.a[0],UQn),j2(cbn(t.e,e))))}function ldn(n,t){var e;return JO(n)&&JO(t)&&$Qn<(e=n%t)&&e>5,t&=31,r=n.d+e+(0==t?0:1),xTn(i=x8(ANt,hQn,25,r,15,1),n.a,e,t),X0(c=new lU(n.e,r,i)),c}function Tdn(n,t,e){var i,r;i=BB(SJ(iNt,t),117),r=BB(SJ(rNt,t),117),e?(mZ(iNt,n,i),mZ(rNt,n,r)):(mZ(rNt,n,i),mZ(iNt,n,r))}function Mdn(n,t,e){var i,r,c;for(r=null,c=n.b;c;){if(i=n.a.ue(t,c.d),e&&0==i)return c;i>=0?c=c.a[1]:(r=c,c=c.a[0])}return r}function Sdn(n,t,e){var i,r,c;for(r=null,c=n.b;c;){if(i=n.a.ue(t,c.d),e&&0==i)return c;i<=0?c=c.a[0]:(r=c,c=c.a[1])}return r}function Pdn(n,t,e,i){var r,c,a;return r=!1,LGn(n.f,e,i)&&(xgn(n.f,n.a[t][e],n.a[t][i]),a=(c=n.a[t])[i],c[i]=c[e],c[e]=a,r=!0),r}function Cdn(n,t,e,i,r){var c,a,u;for(a=r;t.b!=t.c;)c=BB(dU(t),10),u=BB(abn(c,i).Xb(0),11),n.d[u.p]=a++,e.c[e.c.length]=u;return a}function Idn(n,t,i){var r,c,a,u,o;return u=n.k,o=t.k,c=MD(edn(n,r=i[u.g][o.g])),a=MD(edn(t,r)),e.Math.max((kW(c),c),(kW(a),a))}function Odn(n,t,e){var i,r,c,a;for(i=e/n.c.length,r=0,a=new Wb(n);a.a2e3&&(att=n,utt=e.setTimeout(QE,10)),0==ctt++&&(Onn((sk(),ttt)),!0)}function Ndn(n,t){var e;for(e=new oz(ZL(lbn(n).a.Kc(),new h));dAn(e);)if(BB(U5(e),17).d.i.c==t)return!1;return!0}function xdn(n,t){var e;if(cL(t,245)){e=BB(t,245);try{return 0==n.vd(e)}catch(i){if(!cL(i=lun(i),205))throw Hp(i)}}return!1}function Ddn(){return Error.stackTraceLimit>0?(e.Error.stackTraceLimit=Error.stackTraceLimit=64,!0):"stack"in new Error}function Rdn(n,t){return h$(),h$(),rin(KVn),(e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:nt?1:zO(isNaN(n),isNaN(t)))>0}function Kdn(n,t){return h$(),h$(),rin(KVn),(e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:nt?1:zO(isNaN(n),isNaN(t)))<0}function _dn(n,t){return h$(),h$(),rin(KVn),(e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:nt?1:zO(isNaN(n),isNaN(t)))<=0}function Fdn(n,t){for(var e=0;!t[e]||""==t[e];)e++;for(var i=t[e++];eGQn)return e.fh();if((i=e.Zg())||e==n)break}return i}function Jdn(n){return hZ(),cL(n,156)?BB(RX(hAt,yet),288).vg(n):hU(hAt,tsn(n))?BB(RX(hAt,tsn(n)),288).vg(n):null}function Zdn(n){if(mgn(a5n,n))return hN(),vtt;if(mgn(u5n,n))return hN(),ptt;throw Hp(new _y("Expecting true or false"))}function ngn(n,t){if(t.c==n)return t.d;if(t.d==n)return t.c;throw Hp(new _y("Input edge is not connected to the input port."))}function tgn(n,t){return n.e>t.e?1:n.et.d?n.e:n.d=48&&n<48+e.Math.min(10,10)?n-48:n>=97&&n<97?n-97+10:n>=65&&n<65?n-65+10:-1}function ign(n,t){var e;return GI(t)===GI(n)||!!cL(t,21)&&(e=BB(t,21)).gc()==n.gc()&&n.Ic(e)}function rgn(n,t){var e,i,r;return i=n.a.length-1,e=t-n.b&i,r=n.c-t&i,Ex(e<(n.c-n.b&i)),e>=r?(ahn(n,t),-1):(uhn(n,t),1)}function cgn(n,t){var e,i;for(b1(t,n.length),e=n.charCodeAt(t),i=t+1;it.e?1:n.ft.f?1:nsn(n)-nsn(t)}function mgn(n,t){return kW(n),null!=t&&(!!mK(n,t)||n.length==t.length&&mK(n.toLowerCase(),t.toLowerCase()))}function ygn(n,t){var e,i,r,c;for(i=0,r=t.gc();i0&&Vhn(n,128)<0?(t=dG(n)+128,!(e=(Eq(),$tt)[t])&&(e=$tt[t]=new Db(n)),e):new Db(n)}function Egn(n,t){var e,i;return(e=t.Hh(n.a))&&null!=(i=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),t8n)))?i:t.ne()}function Tgn(n,t){var e,i;return(e=t.Hh(n.a))&&null!=(i=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),t8n)))?i:t.ne()}function Mgn(n,t){var e,i;for(qZ(),i=new oz(ZL(hbn(n).a.Kc(),new h));dAn(i);)if((e=BB(U5(i),17)).d.i==t||e.c.i==t)return e;return null}function Sgn(n,t,e){this.c=n,this.f=new Np,this.e=new Gj,this.j=new Sq,this.n=new Sq,this.b=t,this.g=new UV(t.c,t.d,t.b,t.a),this.a=e}function Pgn(n){var t,e,i,r;for(this.a=new fA,this.d=new Rv,this.e=0,i=0,r=(e=n).length;i0)}function Ngn(n){var t;GI(ZAn(n,(sWn(),ESt)))===GI((ufn(),vCt))&&(JJ(n)?(t=BB(ZAn(JJ(n),ESt),334),Ypn(n,ESt,t)):Ypn(n,ESt,mCt))}function xgn(n,t,e){var i,r;fMn(n.e,t,e,(kUn(),CIt)),fMn(n.i,t,e,oIt),n.a&&(r=BB(mMn(t,(hWn(),dlt)),11),i=BB(mMn(e,dlt),11),k0(n.g,r,i))}function Dgn(n,t,e){var i,r,c;i=t.c.p,c=t.p,n.b[i][c]=new DY(n,t),e&&(n.a[i][c]=new Bd(t),(r=BB(mMn(t,(hWn(),rlt)),10))&&JIn(n.d,r,t))}function Rgn(n,t){var e,i,r;if(WB(Sct,n),t.Fc(n),e=BB(RX(Mct,n),21))for(r=e.Kc();r.Ob();)i=BB(r.Pb(),33),-1!=E7(Sct,i,0)||Rgn(i,t)}function Kgn(n,t,e){var i;(Wet?(gwn(n),1):Vet||Jet?(lM(),1):Yet&&(lM(),0))&&((i=new i_(t)).b=e,aSn(n,i))}function _gn(n,t){var e;e=!n.A.Hc((mdn(),_It))||n.q==(QEn(),XCt),n.u.Hc((lIn(),eIt))?e?NUn(n,t):aUn(n,t):n.u.Hc(rIt)&&(e?Azn(n,t):JUn(n,t))}function Fgn(n,t){var e,i;++n.j,null!=t&&oOn(t,e=cL(i=n.a.Cb,97)?BB(i,97).Jg():null)?hgn(n.a,4,e):hgn(n.a,4,BB(t,126))}function Bgn(n,t,i){return new UV(e.Math.min(n.a,t.a)-i/2,e.Math.min(n.b,t.b)-i/2,e.Math.abs(n.a-t.a)+i,e.Math.abs(n.b-t.b)+i)}function Hgn(n,t){var e,i;return 0!=(e=E$(n.a.c.p,t.a.c.p))?e:0!=(i=E$(n.a.d.i.p,t.a.d.i.p))?i:E$(t.a.d.p,n.a.d.p)}function qgn(n,t,e){var i,r,c,a;return(c=t.j)!=(a=e.j)?c.g-a.g:(i=n.f[t.p],r=n.f[e.p],0==i&&0==r?0:0==i?-1:0==r?1:Pln(i,r))}function Ggn(n,t,e){var i;if(!e[t.d])for(e[t.d]=!0,i=new Wb(kbn(t));i.a=(r=n.length))return r;for(t=t>0?t:0;ti&&$X(t,i,null),t}function Ygn(n,t){var e,i;for(i=n.a.length,t.lengthi&&$X(t,i,null),t}function Jgn(n,t,e){var i,r,c;return(r=BB(RX(n.e,t),387))?(c=pR(r,e),uL(n,r),c):(i=new nH(n,t,e),VW(n.e,t,i),kJ(i),null)}function Zgn(n){var t;if(null==n)return null;if(null==(t=L$n(FBn(n,!0))))throw Hp(new ik("Invalid hexBinary value: '"+n+"'"));return t}function npn(n){return ODn(),Vhn(n,0)<0?0!=Vhn(n,-1)?new vEn(-1,j7(n)):Ytt:Vhn(n,10)<=0?Ztt[dG(n)]:new vEn(1,n)}function tpn(){return dWn(),Pun(Gk(Krt,1),$Vn,159,0,[Prt,Srt,Crt,vrt,prt,mrt,jrt,krt,yrt,Mrt,Trt,Ert,drt,wrt,grt,lrt,frt,brt,srt,ort,hrt,Irt])}function epn(n){var t;this.d=new Np,this.j=new Gj,this.g=new Gj,t=n.g.b,this.f=BB(mMn(vW(t),(HXn(),Udt)),103),this.e=Gy(MD(gpn(t,Spt)))}function ipn(n){this.b=new Np,this.e=new Np,this.d=n,this.a=!jE(AV(new Rq(null,new zU(new m6(n.b))),new aw(new Gr))).sd((dM(),tit))}function rpn(){rpn=O,hMt=new AC("PARENTS",0),sMt=new AC("NODES",1),uMt=new AC("EDGES",2),fMt=new AC("PORTS",3),oMt=new AC("LABELS",4)}function cpn(){cpn=O,BCt=new zC("DISTRIBUTED",0),qCt=new zC("JUSTIFIED",1),_Ct=new zC("BEGIN",2),FCt=new zC(eJn,3),HCt=new zC("END",4)}function apn(n){switch(n.yi(null)){case 10:return 0;case 15:return 1;case 14:return 2;case 11:return 3;case 21:return 4}return-1}function upn(n){switch(n.g){case 1:return Ffn(),HPt;case 4:return Ffn(),_Pt;case 2:return Ffn(),FPt;case 3:return Ffn(),KPt}return Ffn(),BPt}function opn(n,t,e){var i;switch((i=e.q.getFullYear()-sQn+sQn)<0&&(i=-i),t){case 1:n.a+=i;break;case 2:Enn(n,i%100,2);break;default:Enn(n,i,t)}}function spn(n,t){var e,i;if(LZ(t,n.b),t>=n.b>>1)for(i=n.c,e=n.b;e>t;--e)i=i.b;else for(i=n.a.a,e=0;e=64&&t<128&&(r=i0(r,yz(1,t-64)));return r}function gpn(n,t){var e,i;return i=null,Lx(n,(sWn(),CPt))&&(e=BB(mMn(n,CPt),94)).Xe(t)&&(i=e.We(t)),null==i&&vW(n)&&(i=mMn(vW(n),t)),i}function ppn(n,t){var e,i,r;(i=(r=t.d.i).k)!=(uSn(),Cut)&&i!=Tut&&dAn(e=new oz(ZL(lbn(r).a.Kc(),new h)))&&VW(n.k,t,BB(U5(e),17))}function vpn(n,t){var e,i,r;return i=itn(n.Tg(),t),(e=t-n.Ah())<0?(r=n.Yg(i))>=0?n.lh(r):qIn(n,i):e<0?qIn(n,i):BB(i,66).Nj().Sj(n,n.yh(),e)}function mpn(n){var t;if(cL(n.a,4)){if(null==(t=Jdn(n.a)))throw Hp(new Fy(o5n+n.b+"'. "+r5n+(ED(bAt),bAt.k)+c5n));return t}return n.a}function ypn(n){var t;if(null==n)return null;if(null==(t=UUn(FBn(n,!0))))throw Hp(new ik("Invalid base64Binary value: '"+n+"'"));return t}function kpn(n){var t;try{return t=n.i.Xb(n.e),n.mj(),n.g=n.e++,t}catch(e){throw cL(e=lun(e),73)?(n.mj(),Hp(new yv)):Hp(e)}}function jpn(n){var t;try{return t=n.c.ki(n.e),n.mj(),n.g=n.e++,t}catch(e){throw cL(e=lun(e),73)?(n.mj(),Hp(new yv)):Hp(e)}}function Epn(){Epn=O,sWn(),Ect=TPt,pct=ySt,lct=cSt,vct=XSt,_kn(),kct=Mit,yct=Eit,jct=Pit,mct=jit,Gsn(),wct=oct,bct=uct,dct=hct,gct=fct}function Tpn(n){switch(jM(),this.c=new Np,this.d=n,n.g){case 0:case 2:this.a=QW(hut),this.b=RQn;break;case 3:case 1:this.a=hut,this.b=KQn}}function Mpn(n,t,e){var i;if(n.c)Pen(n.c,n.c.i+t),Cen(n.c,n.c.j+e);else for(i=new Wb(n.b);i.a0&&(WB(n.b,new VB(t.a,e)),0<(i=t.a.length)?t.a=t.a.substr(0,0):0>i&&(t.a+=rL(x8(ONt,WVn,25,-i,15,1))))}function Cpn(n,t){var e,i,r;for(e=n.o,r=BB(BB(h6(n.r,t),21),84).Kc();r.Ob();)(i=BB(r.Pb(),111)).e.a=dyn(i,e.a),i.e.b=e.b*Gy(MD(i.b.We(Lrt)))}function Ipn(n,t){var e,i,r,c;return r=n.k,e=Gy(MD(mMn(n,(hWn(),Tlt)))),c=t.k,i=Gy(MD(mMn(t,Tlt))),c!=(uSn(),Mut)?-1:r!=Mut?1:e==i?0:e=0?n.hh(t,e,i):(n.eh()&&(i=(r=n.Vg())>=0?n.Qg(i):n.eh().ih(n,-1-r,null,i)),n.Sg(t,e,i))}function xpn(n,t){switch(t){case 7:return!n.e&&(n.e=new hK(_Ot,n,7,4)),void sqn(n.e);case 8:return!n.d&&(n.d=new hK(_Ot,n,8,5)),void sqn(n.d)}Dwn(n,t)}function Dpn(n,t){var e;e=n.Zc(t);try{return e.Pb()}catch(i){throw cL(i=lun(i),109)?Hp(new Ay("Can't get element "+t)):Hp(i)}}function Rpn(n,t){this.e=n,t=0&&(e.d=n.t);break;case 3:n.t>=0&&(e.a=n.t)}n.C&&(e.b=n.C.b,e.c=n.C.c)}function Hpn(){Hpn=O,Brt=new _S(mJn,0),Frt=new _S(yJn,1),Hrt=new _S(kJn,2),qrt=new _S(jJn,3),Brt.a=!1,Frt.a=!0,Hrt.a=!1,qrt.a=!0}function qpn(){qpn=O,Zrt=new KS(mJn,0),Jrt=new KS(yJn,1),nct=new KS(kJn,2),tct=new KS(jJn,3),Zrt.a=!1,Jrt.a=!0,nct.a=!1,tct.a=!0}function Gpn(n){var t;t=n.a;do{(t=BB(U5(new oz(ZL(fbn(t).a.Kc(),new h))),17).c.i).k==(uSn(),Put)&&n.b.Fc(t)}while(t.k==(uSn(),Put));n.b=ean(n.b)}function zpn(n){var t,e,i;for(i=n.c.a,n.p=(yX(i),new t_(i)),e=new Wb(i);e.ae.b)return!0}return!1}function Qpn(n,t){return XI(n)?!!OWn[t]:n.hm?!!n.hm[t]:UI(n)?!!IWn[t]:!!zI(n)&&!!CWn[t]}function Ypn(n,t,e){return null==e?(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),Wdn(n.o,t)):(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),vjn(n.o,t,e)),n}function Jpn(n,t,e,i){var r;(r=Xfn(t.Xe((sWn(),DSt))?BB(t.We(DSt),21):n.j))!=(dWn(),Irt)&&(e&&!agn(r)||USn(N$n(n,r,i),t))}function Zpn(n,t,e,i){var r,c,a;return c=itn(n.Tg(),t),(r=t-n.Ah())<0?(a=n.Yg(c))>=0?n._g(a,e,!0):cOn(n,c,e):BB(c,66).Nj().Pj(n,n.yh(),r,e,i)}function nvn(n,t,e,i){var r,c;e.mh(t)&&(ZM(),hnn(t)?ygn(n,BB(e.ah(t),153)):(r=(c=t)?BB(i,49).xh(c):null)&&_p(e.ah(t),r))}function tvn(n){switch(n.g){case 1:return Dan(),Rrt;case 3:return Dan(),Nrt;case 2:return Dan(),Drt;case 4:return Dan(),xrt;default:return null}}function evn(n){switch(typeof n){case NWn:return vvn(n);case LWn:return CJ(n);case $Wn:return hN(),n?1231:1237;default:return null==n?0:PN(n)}}function ivn(n,t,e){if(n.e)switch(n.b){case 1:BQ(n.c,t,e);break;case 0:HQ(n.c,t,e)}else t4(n.c,t,e);n.a[t.p][e.p]=n.c.i,n.a[e.p][t.p]=n.c.e}function rvn(n){var t,e;if(null==n)return null;for(e=x8(Out,sVn,193,n.length,0,2),t=0;t=0)return i;if(n.Fk())for(e=0;e=(r=n.gc()))throw Hp(new tK(t,r));if(n.hi()&&(i=n.Xc(e))>=0&&i!=t)throw Hp(new _y(a8n));return n.mi(t,e)}function svn(n,t){if(this.a=BB(yX(n),245),this.b=BB(yX(t),245),n.vd(t)>0||n==(ey(),Knt)||t==(ty(),_nt))throw Hp(new _y("Invalid range: "+B3(n,t)))}function hvn(n){var t,e;for(this.b=new Np,this.c=n,this.a=!1,e=new Wb(n.a);e.a0),(t&-t)==t)return CJ(t*H$n(n,31)*4.656612873077393e-10);do{i=(e=H$n(n,31))%t}while(e-i+(t-1)<0);return CJ(i)}function vvn(n){var t,e,i;return r_(),null!=(i=rit[e=":"+n])?CJ((kW(i),i)):(t=null==(i=iit[e])?JNn(n):CJ((kW(i),i)),IQ(),rit[e]=t,t)}function mvn(n,t,e){OTn(e,"Compound graph preprocessor",1),n.a=new pJ,Nzn(n,t,null),GHn(n,t),tNn(n),hon(t,(hWn(),Hft),n.a),n.a=null,$U(n.b),HSn(e)}function yvn(n,t,e){switch(e.g){case 1:n.a=t.a/2,n.b=0;break;case 2:n.a=t.a,n.b=t.b/2;break;case 3:n.a=t.a/2,n.b=t.b;break;case 4:n.a=0,n.b=t.b/2}}function kvn(n){var t,e,i;for(i=BB(h6(n.a,(LEn(),Pst)),15).Kc();i.Ob();)iX(n,e=BB(i.Pb(),101),(t=Hyn(e))[0],(Crn(),xst),0),iX(n,e,t[1],Rst,1)}function jvn(n){var t,e,i;for(i=BB(h6(n.a,(LEn(),Cst)),15).Kc();i.Ob();)iX(n,e=BB(i.Pb(),101),(t=Hyn(e))[0],(Crn(),xst),0),iX(n,e,t[1],Rst,1)}function Evn(n){switch(n.g){case 0:return null;case 1:return new Arn;case 2:return new Jm;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function Tvn(n,t,e){var i,r;for(mun(n,t-n.s,e-n.t),r=new Wb(n.n);r.a1&&(r=fvn(n,t)),r}function Svn(n){var t;return n.f&&n.f.kh()&&(t=BB(n.f,49),n.f=BB(tfn(n,t),82),n.f!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,8,t,n.f))),n.f}function Pvn(n){var t;return n.i&&n.i.kh()&&(t=BB(n.i,49),n.i=BB(tfn(n,t),82),n.i!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,7,t,n.i))),n.i}function Cvn(n){var t;return n.b&&0!=(64&n.b.Db)&&(t=n.b,n.b=BB(tfn(n,t),18),n.b!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,21,t,n.b))),n.b}function Ivn(n,t){var e,i,r;null==n.d?(++n.e,++n.f):(i=t.Sh(),fNn(n,n.f+1),r=(i&DWn)%n.d.length,!(e=n.d[r])&&(e=n.d[r]=n.uj()),e.Fc(t),++n.f)}function Ovn(n,t,e){var i;return!t.Kj()&&(-2!=t.Zj()?null==(i=t.zj())?null==e:Nfn(i,e):t.Hj()==n.e.Tg()&&null==e)}function Avn(){var n;lin(16,IVn),n=Jin(16),this.b=x8(Gnt,CVn,317,n,0,1),this.c=x8(Gnt,CVn,317,n,0,1),this.a=null,this.e=null,this.i=0,this.f=n-1,this.g=0}function $vn(n){LR.call(this),this.k=(uSn(),Cut),this.j=(lin(6,AVn),new J6(6)),this.b=(lin(2,AVn),new J6(2)),this.d=new fm,this.f=new wm,this.a=n}function Lvn(n){var t,e;n.c.length<=1||(dPn(n,BB((t=EDn(n,(kUn(),SIt))).a,19).a,BB(t.b,19).a),dPn(n,BB((e=EDn(n,CIt)).a,19).a,BB(e.b,19).a))}function Nvn(){Nvn=O,yvt=new FP("SIMPLE",0),pvt=new FP(B1n,1),vvt=new FP("LINEAR_SEGMENTS",2),gvt=new FP("BRANDES_KOEPF",3),mvt=new FP(j3n,4)}function xvn(n,t,e){LK(BB(mMn(t,(HXn(),ept)),98))||(W7(n,t,DSn(t,e)),W7(n,t,DSn(t,(kUn(),SIt))),W7(n,t,DSn(t,sIt)),SQ(),m$(t.j,new _d(n)))}function Dvn(n,t,e,i){var r;for(r=BB(h6(i?n.a:n.b,t),21).Kc();r.Ob();)if(_Dn(n,e,BB(r.Pb(),33)))return!0;return!1}function Rvn(n){var t,e;for(e=new AL(n);e.e!=e.i.gc();)if((t=BB(kpn(e),87)).e||0!=(!t.d&&(t.d=new $L(VAt,t,1)),t.d).i)return!0;return!1}function Kvn(n){var t,e;for(e=new AL(n);e.e!=e.i.gc();)if((t=BB(kpn(e),87)).e||0!=(!t.d&&(t.d=new $L(VAt,t,1)),t.d).i)return!0;return!1}function _vn(n){var t,e;for(t=0,e=new Wb(n.c.a);e.a102?-1:n<=57?n-48:n<65?-1:n<=70?n-65+10:n<97?-1:n-97+10}function zvn(n,t){if(null==n)throw Hp(new Hy("null key in entry: null="+t));if(null==t)throw Hp(new Hy("null value in entry: "+n+"=null"))}function Uvn(n,t){for(var e,i;n.Ob();){if(!t.Ob())return!1;if(e=n.Pb(),i=t.Pb(),!(GI(e)===GI(i)||null!=e&&Nfn(e,i)))return!1}return!t.Ob()}function Xvn(n,t){var i;return i=Pun(Gk(xNt,1),qQn,25,15,[vhn(n.a[0],t),vhn(n.a[1],t),vhn(n.a[2],t)]),n.d&&(i[0]=e.Math.max(i[0],i[2]),i[2]=i[0]),i}function Wvn(n,t){var i;return i=Pun(Gk(xNt,1),qQn,25,15,[mhn(n.a[0],t),mhn(n.a[1],t),mhn(n.a[2],t)]),n.d&&(i[0]=e.Math.max(i[0],i[2]),i[2]=i[0]),i}function Vvn(){Vvn=O,yht=new SP("GREEDY",0),mht=new SP(H1n,1),jht=new SP(B1n,2),Eht=new SP("MODEL_ORDER",3),kht=new SP("GREEDY_MODEL_ORDER",4)}function Qvn(n,t){var e,i,r;for(n.b[t.g]=1,i=spn(t.d,0);i.b!=i.d.c;)r=(e=BB(b3(i),188)).c,1==n.b[r.g]?DH(n.a,e):2==n.b[r.g]?n.b[r.g]=1:Qvn(n,r)}function Yvn(n,t){var e,i,r;for(r=new J6(t.gc()),i=t.Kc();i.Ob();)(e=BB(i.Pb(),286)).c==e.f?hPn(n,e,e.c):rPn(n,e)||(r.c[r.c.length]=e);return r}function Jvn(n,t,e){var i,r,c,a;for(a=n.r+t,n.r+=t,n.d+=e,i=e/n.n.c.length,r=0,c=new Wb(n.n);c.ac&&$X(t,c,null),t}function Tmn(n,t){var e,i;if(i=n.gc(),null==t){for(e=0;e0&&(o+=r),s[h]=a,a+=u*(o+i)}function Dmn(n){var t,e,i;for(i=n.f,n.n=x8(xNt,qQn,25,i,15,1),n.d=x8(xNt,qQn,25,i,15,1),t=0;t0?n.c:0),++c;n.b=r,n.d=a}function zmn(n,t){var i,r,c,a,u;for(r=0,c=0,i=0,u=new Wb(t);u.a0?n.g:0),++i;n.c=c,n.d=r}function Umn(n,t){var i;return i=Pun(Gk(xNt,1),qQn,25,15,[gvn(n,(Dtn(),Git),t),gvn(n,zit,t),gvn(n,Uit,t)]),n.f&&(i[0]=e.Math.max(i[0],i[2]),i[2]=i[0]),i}function Xmn(n,t,e){try{FRn(n,t+n.j,e+n.k,!1,!0)}catch(i){throw cL(i=lun(i),73)?Hp(new Ay(i.g+CJn+t+FWn+e+").")):Hp(i)}}function Wmn(n,t,e){try{FRn(n,t+n.j,e+n.k,!0,!1)}catch(i){throw cL(i=lun(i),73)?Hp(new Ay(i.g+CJn+t+FWn+e+").")):Hp(i)}}function Vmn(n){var t;Lx(n,(HXn(),$gt))&&((t=BB(mMn(n,$gt),21)).Hc((n$n(),ICt))?(t.Mc(ICt),t.Fc(ACt)):t.Hc(ACt)&&(t.Mc(ACt),t.Fc(ICt)))}function Qmn(n){var t;Lx(n,(HXn(),$gt))&&((t=BB(mMn(n,$gt),21)).Hc((n$n(),DCt))?(t.Mc(DCt),t.Fc(NCt)):t.Hc(NCt)&&(t.Mc(NCt),t.Fc(DCt)))}function Ymn(n,t,e){OTn(e,"Self-Loop ordering",1),JT($V(AV(AV(wnn(new Rq(null,new w1(t.b,16)),new Ii),new Oi),new Ai),new $i),new bd(n)),HSn(e)}function Jmn(n,t,e,i){var r,c;for(r=t;r0&&(c.b+=t),c}function uyn(n,t){var i,r,c;for(c=new Gj,r=n.Kc();r.Ob();)ZRn(i=BB(r.Pb(),37),0,c.b),c.b+=i.f.b+t,c.a=e.Math.max(c.a,i.f.a);return c.a>0&&(c.a+=t),c}function oyn(n){var t,i,r;for(r=DWn,i=new Wb(n.a);i.a>16==6?n.Cb.ih(n,5,GOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||n.zh(),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function lyn(n){PY();var t=n.e;if(t&&t.stack){var e=t.stack,i=t+"\n";return e.substring(0,i.length)==i&&(e=e.substring(i.length)),e.split("\n")}return[]}function byn(n){var t;return Min(),(t=Ott)[n>>>28]|t[n>>24&15]<<4|t[n>>20&15]<<8|t[n>>16&15]<<12|t[n>>12&15]<<16|t[n>>8&15]<<20|t[n>>4&15]<<24|t[15&n]<<28}function wyn(n){var t,i,r;n.b==n.c&&(r=n.a.length,i=kon(e.Math.max(8,r))<<1,0!=n.b?(urn(n,t=SR(n.a,i),r),n.a=t,n.b=0):Pv(n.a,i),n.c=r)}function dyn(n,t){var e;return(e=n.b).Xe((sWn(),aPt))?e.Hf()==(kUn(),CIt)?-e.rf().a-Gy(MD(e.We(aPt))):t+Gy(MD(e.We(aPt))):e.Hf()==(kUn(),CIt)?-e.rf().a:t}function gyn(n){var t;return 0!=n.b.c.length&&BB(xq(n.b,0),70).a?BB(xq(n.b,0),70).a:null!=(t=eQ(n))?t:""+(n.c?E7(n.c.a,n,0):-1)}function pyn(n){var t;return 0!=n.f.c.length&&BB(xq(n.f,0),70).a?BB(xq(n.f,0),70).a:null!=(t=eQ(n))?t:""+(n.i?E7(n.i.j,n,0):-1)}function vyn(n,t){var e,i;if(t<0||t>=n.gc())return null;for(e=t;e0?n.c:0),c=e.Math.max(c,t.d),++r;n.e=a,n.b=c}function kyn(n){var t,e;if(!n.b)for(n.b=C2(BB(n.f,118).Ag().i),e=new AL(BB(n.f,118).Ag());e.e!=e.i.gc();)t=BB(kpn(e),137),WB(n.b,new Ry(t));return n.b}function jyn(n,t){var e,i,r;if(t.dc())return dD(),dD(),pAt;for(e=new aR(n,t.gc()),r=new AL(n);r.e!=r.i.gc();)i=kpn(r),t.Hc(i)&&f9(e,i);return e}function Eyn(n,t,e,i){return 0==t?i?(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),n.o):(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),A8(n.o)):Zpn(n,t,e,i)}function Tyn(n){var t,e;if(n.rb)for(t=0,e=n.rb.i;t>22))>>22)<0||(n.l=e&SQn,n.m=i&SQn,n.h=r&PQn,0)))}function Iyn(n,t,e,i,r,c,a){var u,o;return!(t.Ae()&&(o=n.a.ue(e,i),o<0||!r&&0==o)||t.Be()&&(u=n.a.ue(e,c),u>0||!a&&0==u))}function Oyn(n,t){if(zsn(),0!=n.j.g-t.j.g)return 0;switch(n.j.g){case 2:return jbn(t,bst)-jbn(n,bst);case 4:return jbn(n,lst)-jbn(t,lst)}return 0}function Ayn(n){switch(n.g){case 0:return xht;case 1:return Dht;case 2:return Rht;case 3:return Kht;case 4:return _ht;case 5:return Fht;default:return null}}function $yn(n,t,e){var i,r;return Ihn(r=new Lm,t),Nrn(r,e),f9((!n.c&&(n.c=new eU(YAt,n,12,10)),n.c),r),Len(i=r,0),Nen(i,1),nln(i,!0),Yfn(i,!0),i}function Lyn(n,t){var e,i;if(t>=n.i)throw Hp(new LO(t,n.i));return++n.j,e=n.g[t],(i=n.i-t-1)>0&&aHn(n.g,t+1,n.g,t,i),$X(n.g,--n.i,null),n.fi(t,e),n.ci(),e}function Nyn(n,t){var e;return n.Db>>16==17?n.Cb.ih(n,21,qAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||n.zh(),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function xyn(n){var t,e,i;for(SQ(),m$(n.c,n.a),i=new Wb(n.c);i.ae.a.c.length))throw Hp(new _y("index must be >= 0 and <= layer node count"));n.c&&y7(n.c.a,n),n.c=e,e&&kG(e.a,t,n)}function Yyn(n,t){var e,i,r;for(i=new oz(ZL(hbn(n).a.Kc(),new h));dAn(i);)return e=BB(U5(i),17),new qf(yX((r=BB(t.Kb(e),10)).n.b+r.o.b/2));return iy(),iy(),Ont}function Jyn(n,t){this.c=new xp,this.a=n,this.b=t,this.d=BB(mMn(n,(hWn(),Alt)),304),GI(mMn(n,(HXn(),Lgt)))===GI((g7(),qht))?this.e=new gm:this.e=new dm}function Zyn(n,t){var i,r,c;for(c=0,r=new Wb(n);r.a>16==6?n.Cb.ih(n,6,_Ot,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),yOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function hkn(n,t){var e;return n.Db>>16==7?n.Cb.ih(n,1,DOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),jOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function fkn(n,t){var e;return n.Db>>16==9?n.Cb.ih(n,9,UOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),TOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function lkn(n,t){var e;return n.Db>>16==5?n.Cb.ih(n,9,XAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),s$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function bkn(n,t){var e;return n.Db>>16==3?n.Cb.ih(n,0,BOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),e$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function wkn(n,t){var e;return n.Db>>16==7?n.Cb.ih(n,6,GOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),v$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function dkn(){this.a=new lo,this.g=new Avn,this.j=new Avn,this.b=new xp,this.d=new Avn,this.i=new Avn,this.k=new xp,this.c=new xp,this.e=new xp,this.f=new xp}function gkn(n,t,e){var i,r,c;for(e<0&&(e=0),c=n.i,r=e;rGQn)return vkn(n,i);if(i==n)return!0}}return!1}function mkn(n){switch(DN(),n.q.g){case 5:vIn(n,(kUn(),sIt)),vIn(n,SIt);break;case 4:z$n(n,(kUn(),sIt)),z$n(n,SIt);break;default:vUn(n,(kUn(),sIt)),vUn(n,SIt)}}function ykn(n){switch(DN(),n.q.g){case 5:SOn(n,(kUn(),oIt)),SOn(n,CIt);break;case 4:Cpn(n,(kUn(),oIt)),Cpn(n,CIt);break;default:mUn(n,(kUn(),oIt)),mUn(n,CIt)}}function kkn(n){var t,e;(t=BB(mMn(n,(fRn(),nat)),19))?(e=t.a,hon(n,(Mrn(),hat),0==e?new sbn:new C4(e))):hon(n,(Mrn(),hat),new C4(1))}function jkn(n,t){var e;switch(e=n.i,t.g){case 1:return-(n.n.b+n.o.b);case 2:return n.n.a-e.o.a;case 3:return n.n.b-e.o.b;case 4:return-(n.n.a+n.o.a)}return 0}function Ekn(n,t){switch(n.g){case 0:return t==(Tbn(),Flt)?rst:cst;case 1:return t==(Tbn(),Flt)?rst:ist;case 2:return t==(Tbn(),Flt)?ist:cst;default:return ist}}function Tkn(n,t){var i,r,c;for(y7(n.a,t),n.e-=t.r+(0==n.a.c.length?0:n.c),c=n4n,r=new Wb(n.a);r.a>16==3?n.Cb.ih(n,12,UOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),mOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Skn(n,t){var e;return n.Db>>16==11?n.Cb.ih(n,10,UOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),EOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Pkn(n,t){var e;return n.Db>>16==10?n.Cb.ih(n,11,qAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),g$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Ckn(n,t){var e;return n.Db>>16==10?n.Cb.ih(n,12,QAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),m$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Ikn(n){var t;return 0==(1&n.Bb)&&n.r&&n.r.kh()&&(t=BB(n.r,49),n.r=BB(tfn(n,t),138),n.r!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,8,t,n.r))),n.r}function Okn(n,t,i){var r;return r=Pun(Gk(xNt,1),qQn,25,15,[iMn(n,(Dtn(),Git),t,i),iMn(n,zit,t,i),iMn(n,Uit,t,i)]),n.f&&(r[0]=e.Math.max(r[0],r[2]),r[2]=r[0]),r}function Akn(n,t){var e,i,r;if(0!=(r=Yvn(n,t)).c.length)for(m$(r,new ti),e=r.c.length,i=0;i>19)!=(u=t.h>>19)?u-a:(i=n.h)!=(c=t.h)?i-c:(e=n.m)!=(r=t.m)?e-r:n.l-t.l}function _kn(){_kn=O,tRn(),Pit=new $O(UYn,Cit=xit),Rnn(),Mit=new $O(XYn,Sit=mit),hpn(),Eit=new $O(WYn,Tit=dit),jit=new $O(VYn,(hN(),!0))}function Fkn(n,t,e){var i,r;i=t*e,cL(n.g,145)?(r=f3(n)).f.d?r.f.a||(n.d.a+=i+fJn):(n.d.d-=i+fJn,n.d.a+=i+fJn):cL(n.g,10)&&(n.d.d-=i,n.d.a+=2*i)}function Bkn(n,t,i){var r,c,a,u,o;for(c=n[i.g],o=new Wb(t.d);o.a0?n.g:0),++i;t.b=r,t.e=c}function qkn(n){var t,e,i;if(i=n.b,qT(n.i,i.length)){for(e=2*i.length,n.b=x8(Gnt,CVn,317,e,0,1),n.c=x8(Gnt,CVn,317,e,0,1),n.f=e-1,n.i=0,t=n.a;t;t=t.c)YCn(n,t,t);++n.g}}function Gkn(n,t,e,i){var r,c,a,u;for(r=0;ru&&(o=u/r),(c=e.Math.abs(n.b))>a&&(s=a/c),kL(n,e.Math.min(o,s)),n}function Xkn(){var n,t;qBn();try{if(t=BB(Xjn((WM(),zAt),y6n),2014))return t}catch(e){if(!cL(e=lun(e),102))throw Hp(e);n=e,uz((u$(),n))}return new ao}function Wkn(){var n,t;d7();try{if(t=BB(Xjn((WM(),zAt),S7n),2024))return t}catch(e){if(!cL(e=lun(e),102))throw Hp(e);n=e,uz((u$(),n))}return new Ds}function Vkn(){var n,t;qBn();try{if(t=BB(Xjn((WM(),zAt),V9n),1941))return t}catch(e){if(!cL(e=lun(e),102))throw Hp(e);n=e,uz((u$(),n))}return new qo}function Qkn(n,t,e){var i,r;return r=n.e,n.e=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,4,r,t),e?e.Ei(i):e=i),r!=t&&(e=azn(n,t?kLn(n,t):n.a,e)),e}function Ykn(){AT.call(this),this.e=-1,this.a=!1,this.p=_Vn,this.k=-1,this.c=-1,this.b=-1,this.g=!1,this.f=-1,this.j=-1,this.n=-1,this.i=-1,this.d=-1,this.o=_Vn}function Jkn(n,t){var e,i,r;if(i=n.b.d.d,n.a||(i+=n.b.d.a),r=t.b.d.d,t.a||(r+=t.b.d.a),0==(e=Pln(i,r))){if(!n.a&&t.a)return-1;if(!t.a&&n.a)return 1}return e}function Zkn(n,t){var e,i,r;if(i=n.b.b.d,n.a||(i+=n.b.b.a),r=t.b.b.d,t.a||(r+=t.b.b.a),0==(e=Pln(i,r))){if(!n.a&&t.a)return-1;if(!t.a&&n.a)return 1}return e}function njn(n,t){var e,i,r;if(i=n.b.g.d,n.a||(i+=n.b.g.a),r=t.b.g.d,t.a||(r+=t.b.g.a),0==(e=Pln(i,r))){if(!n.a&&t.a)return-1;if(!t.a&&n.a)return 1}return e}function tjn(){tjn=O,Nat=WG(dq(dq(dq(new B2,(yMn(),Fat),(lWn(),yot)),Fat,Tot),Bat,Aot),Bat,oot),Dat=dq(dq(new B2,Fat,Jut),Fat,sot),xat=WG(new B2,Bat,fot)}function ejn(n){var t,e,i,r,c;for(t=BB(mMn(n,(hWn(),zft)),83),c=n.n,i=t.Cc().Kc();i.Ob();)(r=(e=BB(i.Pb(),306)).i).c+=c.a,r.d+=c.b,e.c?NDn(e):xDn(e);hon(n,zft,null)}function ijn(n,t,e){var i,r;switch(i=(r=n.b).d,t.g){case 1:return-i.d-e;case 2:return r.o.a+i.c+e;case 3:return r.o.b+i.a+e;case 4:return-i.b-e;default:return-1}}function rjn(n){var t,e,i,r,c;if(i=0,r=ZJn,n.b)for(t=0;t<360;t++)e=.017453292519943295*t,UKn(n,n.d,0,0,Z3n,e),(c=n.b.ig(n.d))0&&(r=aOn(n,(c&DWn)%n.d.length,c,t))?r.ed(e):(i=n.tj(c,t,e),n.c.Fc(i),null)}function mjn(n,t){var e,i,r,c;switch(Cfn(n,t)._k()){case 3:case 2:for(r=0,c=(e=YBn(t)).i;r=0;r--)if(mK(n[r].d,t)||mK(n[r].d,i)){n.length>=r+1&&n.splice(0,r+1);break}return n}function Ojn(n,t){var i;return JO(n)&&JO(t)&&$Qn<(i=n/t)&&i0&&(n.b+=2,n.a+=r):(n.b+=1,n.a+=e.Math.min(r,c))}function Kjn(n,t){var e;if(e=!1,XI(t)&&(e=!0,nW(n,new GX(SD(t)))),e||cL(t,236)&&(e=!0,nW(n,new Sl(XK(BB(t,236))))),!e)throw Hp(new Ly(H6n))}function _jn(n,t,e,i){var r,c,a;return r=new N7(n.e,1,10,cL(a=t.c,88)?BB(a,26):(gWn(),d$t),cL(c=e.c,88)?BB(c,26):(gWn(),d$t),uvn(n,t),!1),i?i.Ei(r):i=r,i}function Fjn(n){var t,e;switch(BB(mMn(vW(n),(HXn(),pgt)),420).g){case 0:return t=n.n,e=n.o,new xC(t.a+e.a/2,t.b+e.b/2);case 1:return new wA(n.n);default:return null}}function Bjn(){Bjn=O,Qht=new AP(QZn,0),Vht=new AP("LEFTUP",1),Jht=new AP("RIGHTUP",2),Wht=new AP("LEFTDOWN",3),Yht=new AP("RIGHTDOWN",4),Xht=new AP("BALANCED",5)}function Hjn(n,t,e){var i,r,c;if(0==(i=Pln(n.a[t.p],n.a[e.p]))){if(r=BB(mMn(t,(hWn(),clt)),15),c=BB(mMn(e,clt),15),r.Hc(e))return-1;if(c.Hc(t))return 1}return i}function qjn(n){switch(n.g){case 1:return new _a;case 2:return new Fa;case 3:return new Ka;case 0:return null;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function Gjn(n,t,e){switch(t){case 1:return!n.n&&(n.n=new eU(zOt,n,1,7)),sqn(n.n),!n.n&&(n.n=new eU(zOt,n,1,7)),void pX(n.n,BB(e,14));case 2:return void $in(n,SD(e))}rsn(n,t,e)}function zjn(n,t,e){switch(t){case 3:return void Men(n,Gy(MD(e)));case 4:return void Sen(n,Gy(MD(e)));case 5:return void Pen(n,Gy(MD(e)));case 6:return void Cen(n,Gy(MD(e)))}Gjn(n,t,e)}function Ujn(n,t,e){var i,r;(i=HTn(r=new Lm,t,null))&&i.Fi(),Nrn(r,e),f9((!n.c&&(n.c=new eU(YAt,n,12,10)),n.c),r),Len(r,0),Nen(r,1),nln(r,!0),Yfn(r,!0)}function Xjn(n,t){var e,i;return cL(e=hS(n.g,t),235)?((i=BB(e,235)).Qh(),i.Nh()):cL(e,498)?i=BB(e,1938).b:null}function Wjn(n,t,e,i){var r,c;return yX(t),yX(e),R7(!!(c=BB(UK(n.d,t),19)),"Row %s not in %s",t,n.e),R7(!!(r=BB(UK(n.b,e),19)),"Column %s not in %s",e,n.c),Sun(n,c.a,r.a,i)}function Vjn(n,t,e,i,r,c,a){var u,o,s,h,f;if(f=Bmn(u=(s=c==a-1)?i:0,h=r[c]),10!=i&&Pun(Gk(n,a-c),t[c],e[c],u,f),!s)for(++c,o=0;o1||-1==u?(c=BB(o,15),r.Wb(Xdn(n,c))):r.Wb(t_n(n,BB(o,56))))}function hEn(n,t,e,i){YE();var r=PWn;function c(){for(var n=0;nD3n)return e;i>-1e-6&&++e}return e}function kEn(n,t){var e;t!=n.b?(e=null,n.b&&(e=oJ(n.b,n,-4,e)),t&&(e=Npn(t,n,-4,e)),(e=Zhn(n,t,e))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,t,t))}function jEn(n,t){var e;t!=n.f?(e=null,n.f&&(e=oJ(n.f,n,-1,e)),t&&(e=Npn(t,n,-1,e)),(e=nfn(n,t,e))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,0,t,t))}function EEn(n){var t,e,i;if(null==n)return null;if((e=BB(n,15)).dc())return"";for(i=new Sk,t=e.Kc();t.Ob();)cO(i,(Uqn(),SD(t.Pb()))),i.a+=" ";return KO(i,i.a.length-1)}function TEn(n){var t,e,i;if(null==n)return null;if((e=BB(n,15)).dc())return"";for(i=new Sk,t=e.Kc();t.Ob();)cO(i,(Uqn(),SD(t.Pb()))),i.a+=" ";return KO(i,i.a.length-1)}function MEn(n,t,e){var i,r;return i=n.c[t.c.p][t.p],r=n.c[e.c.p][e.p],null!=i.a&&null!=r.a?Tz(i.a,r.a):null!=i.a?-1:null!=r.a?1:0}function SEn(n,t){var e,i,r;if(t)for(r=((e=new hz(t.a.length)).b-e.a)*e.c<0?(eS(),MNt):new XL(e);r.Ob();)i=x2(t,BB(r.Pb(),19).a),OV(new Bg(n).a,i)}function PEn(n,t){var e,i,r;if(t)for(r=((e=new hz(t.a.length)).b-e.a)*e.c<0?(eS(),MNt):new XL(e);r.Ob();)i=x2(t,BB(r.Pb(),19).a),IV(new $g(n).a,i)}function CEn(n){if(null!=n&&n.length>0&&33==fV(n,n.length-1))try{return null==YPn(fx(n,0,n.length-1)).e}catch(t){if(!cL(t=lun(t),32))throw Hp(t)}return!1}function IEn(n,t,e){var i,r,c;return i=t.ak(),c=t.dd(),r=i.$j()?LY(n,3,i,null,c,pBn(n,i,c,cL(i,99)&&0!=(BB(i,18).Bb&BQn)),!0):LY(n,1,i,i.zj(),c,-1,!0),e?e.Ei(r):e=r,e}function OEn(){var n,t,e;for(t=0,n=0;n<"X".length;n++){if(0==(e=QOn((b1(n,"X".length),"X".charCodeAt(n)))))throw Hp(new ak("Unknown Option: "+"X".substr(n)));t|=e}return t}function AEn(n,t,e){var i,r;switch(i=Wln(vW(t)),CZ(r=new CSn,t),e.g){case 1:qCn(r,Tln(hwn(i)));break;case 2:qCn(r,hwn(i))}return hon(r,(HXn(),tpt),MD(mMn(n,tpt))),r}function $En(n){var t,e;return t=BB(U5(new oz(ZL(fbn(n.a).a.Kc(),new h))),17),e=BB(U5(new oz(ZL(lbn(n.a).a.Kc(),new h))),17),qy(TD(mMn(t,(hWn(),Clt))))||qy(TD(mMn(e,Clt)))}function LEn(){LEn=O,Mst=new yP("ONE_SIDE",0),Pst=new yP("TWO_SIDES_CORNER",1),Cst=new yP("TWO_SIDES_OPPOSING",2),Sst=new yP("THREE_SIDES",3),Tst=new yP("FOUR_SIDES",4)}function NEn(n,t,e,i,r){var c,a;c=BB(P4(AV(t.Oc(),new Zr),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),a=BB(gan(n.b,e,i),15),0==r?a.Wc(0,c):a.Gc(c)}function xEn(n,t){var e,i,r;for(i=new Wb(t.a);i.a0&&_yn(this,this.c-1,(kUn(),oIt)),this.c0&&n[0].length>0&&(this.c=qy(TD(mMn(vW(n[0][0]),(hWn(),alt))))),this.a=x8(Pmt,sVn,2018,n.length,0,2),this.b=x8(Lmt,sVn,2019,n.length,0,2),this.d=new Thn}function XEn(n){return 0!=n.c.length&&((l1(0,n.c.length),BB(n.c[0],17)).c.i.k==(uSn(),Put)||o5($V(new Rq(null,new w1(n,16)),new Kc),new _c))}function WEn(n,t,e){return OTn(e,"Tree layout",1),h2(n.b),CU(n.b,(zyn(),Ryt),Ryt),CU(n.b,Kyt,Kyt),CU(n.b,_yt,_yt),CU(n.b,Fyt,Fyt),n.a=$qn(n.b,t),lxn(n,t,mcn(e,1)),HSn(e),t}function VEn(n,t){var i,r,c,a,u,o;for(u=wDn(t),c=t.f,o=t.g,a=e.Math.sqrt(c*c+o*o),r=0,i=new Wb(u);i.a=0?(e=Ojn(n,AQn),i=ldn(n,AQn)):(e=Ojn(t=jz(n,1),5e8),i=rbn(yz(i=ldn(t,5e8),1),e0(n,1))),i0(yz(i,32),e0(e,UQn))}function lTn(n,t,e){var i;switch(Px(0!=t.b),i=BB(Atn(t,t.a.a),8),e.g){case 0:i.b=0;break;case 2:i.b=n.f;break;case 3:i.a=0;break;default:i.a=n.g}return nX(spn(t,0),i),t}function bTn(n,t,e,i){var r,c,a,u,o;switch(o=n.b,u=zgn(a=(c=t.d).j,o.d[a.g],e),r=UR(B$(c.n),c.a),c.j.g){case 1:case 3:u.a+=r.a;break;case 2:case 4:u.b+=r.b}r5(i,u,i.c.b,i.c)}function wTn(n,t,e){var i,r,c,a;for(a=E7(n.e,t,0),(c=new rm).b=e,i=new M2(n.e,a);i.b1;t>>=1)0!=(1&t)&&(i=Nnn(i,e)),e=1==e.d?Nnn(e,e):new Cgn(I_n(e.a,e.d,x8(ANt,hQn,25,e.d<<1,15,1)));return i=Nnn(i,e)}function yTn(){var n,t,e,i;for(yTn=O,Oet=x8(xNt,qQn,25,25,15,1),Aet=x8(xNt,qQn,25,33,15,1),i=152587890625e-16,t=32;t>=0;t--)Aet[t]=i,i*=.5;for(e=1,n=24;n>=0;n--)Oet[n]=e,e*=.5}function kTn(n){var t,e;if(qy(TD(ZAn(n,(HXn(),wgt)))))for(e=new oz(ZL(dLn(n).a.Kc(),new h));dAn(e);)if(QIn(t=BB(U5(e),79))&&qy(TD(ZAn(t,dgt))))return!0;return!1}function jTn(n,t){var e,i,r;TU(n.f,t)&&(t.b=n,i=t.c,-1!=E7(n.j,i,0)||WB(n.j,i),r=t.d,-1!=E7(n.j,r,0)||WB(n.j,r),0!=(e=t.a.b).c.length&&(!n.i&&(n.i=new epn(n)),van(n.i,e)))}function ETn(n){var t,e,i,r;return(e=(t=n.c.d).j)==(r=(i=n.d.d).j)?t.p=0&&mK(n.substr(t,"GMT".length),"GMT")||t>=0&&mK(n.substr(t,"UTC".length),"UTC")?(e[0]=t+3,y_n(n,e,i)):y_n(n,e,i)}function ITn(n,t){var e,i,r,c,a;for(c=n.g.a,a=n.g.b,i=new Wb(n.d);i.ae;c--)n[c]|=t[c-e-1]>>>a,n[c-1]=t[c-e-1]<=n.f)break;c.c[c.c.length]=e}return c}function _Tn(n){var t,e,i,r;for(t=null,r=new Wb(n.wf());r.a0&&aHn(n.g,t,n.g,t+i,u),a=e.Kc(),n.i+=i,r=0;rc&&sU(s,atn(e[u],Tet))&&(r=u,c=o);return r>=0&&(i[0]=t+c),r}function UTn(n,t){var e;if(0!=(e=YO(n.b.Hf(),t.b.Hf())))return e;switch(n.b.Hf().g){case 1:case 2:return E$(n.b.sf(),t.b.sf());case 3:case 4:return E$(t.b.sf(),n.b.sf())}return 0}function XTn(n){var t,e,i;for(i=n.e.c.length,n.a=kq(ANt,[sVn,hQn],[48,25],15,[i,i],2),e=new Wb(n.c);e.a>4&15,c=15&n[i],a[r++]=OOt[e],a[r++]=OOt[c];return Bdn(a,0,a.length)}function QTn(n,t,e){var i,r,c;return i=t.ak(),c=t.dd(),r=i.$j()?LY(n,4,i,c,null,pBn(n,i,c,cL(i,99)&&0!=(BB(i,18).Bb&BQn)),!0):LY(n,i.Kj()?2:1,i,c,i.zj(),-1,!0),e?e.Ei(r):e=r,e}function YTn(n){var t,e;return n>=BQn?(t=HQn+(n-BQn>>10&1023)&QVn,e=56320+(n-BQn&1023)&QVn,String.fromCharCode(t)+""+String.fromCharCode(e)):String.fromCharCode(n&QVn)}function JTn(n,t){var e,i,r,c;return qD(),(r=BB(BB(h6(n.r,t),21),84)).gc()>=2&&(i=BB(r.Kc().Pb(),111),e=n.u.Hc((lIn(),tIt)),c=n.u.Hc(cIt),!i.a&&!e&&(2==r.gc()||c))}function ZTn(n,t,e,i,r){var c,a,u;for(c=eDn(n,t,e,i,r),u=!1;!c;)E$n(n,r,!0),u=!0,c=eDn(n,t,e,i,r);u&&E$n(n,r,!1),0!=(a=Dun(r)).c.length&&(n.d&&n.d.lg(a),ZTn(n,r,e,i,a))}function nMn(){nMn=O,aCt=new BC(QZn,0),rCt=new BC("DIRECTED",1),uCt=new BC("UNDIRECTED",2),eCt=new BC("ASSOCIATION",3),cCt=new BC("GENERALIZATION",4),iCt=new BC("DEPENDENCY",5)}function tMn(n,t){var e;if(!WJ(n))throw Hp(new Fy(F5n));switch(e=WJ(n),t.g){case 1:return-(n.j+n.f);case 2:return n.i-e.g;case 3:return n.j-e.f;case 4:return-(n.i+n.g)}return 0}function eMn(n,t){var e,i;for(kW(t),i=n.b.c.length,WB(n.b,t);i>0;){if(e=i,i=(i-1)/2|0,n.a.ue(xq(n.b,i),t)<=0)return c5(n.b,e,t),!0;c5(n.b,e,xq(n.b,i))}return c5(n.b,i,t),!0}function iMn(n,t,i,r){var c,a;if(c=0,i)c=mhn(n.a[i.g][t.g],r);else for(a=0;a=a)}function cMn(n,t,e,i){var r;if(r=!1,XI(i)&&(r=!0,AH(t,e,SD(i))),r||zI(i)&&(r=!0,cMn(n,t,e,i)),r||cL(i,236)&&(r=!0,qQ(t,e,BB(i,236))),!r)throw Hp(new Ly(H6n))}function aMn(n,t){var e,i,r;if((e=t.Hh(n.a))&&null!=(r=cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),F9n)))for(i=1;i<(IPn(),Y$t).length;++i)if(mK(Y$t[i],r))return i;return 0}function uMn(n,t){var e,i,r;if((e=t.Hh(n.a))&&null!=(r=cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),F9n)))for(i=1;i<(IPn(),J$t).length;++i)if(mK(J$t[i],r))return i;return 0}function oMn(n,t){var e,i,r,c;if(kW(t),(c=n.a.gc())0?1:0;c.a[r]!=e;)c=c.a[r],r=n.a.ue(e.d,c.d)>0?1:0;c.a[r]=i,i.b=e.b,i.a[0]=e.a[0],i.a[1]=e.a[1],e.a[0]=null,e.a[1]=null}function wMn(n){return lIn(),!(Can(OJ(EG(eIt,Pun(Gk(IIt,1),$Vn,273,0,[rIt])),n))>1||Can(OJ(EG(tIt,Pun(Gk(IIt,1),$Vn,273,0,[nIt,cIt])),n))>1)}function dMn(n,t){cL(SJ((WM(),zAt),n),498)?mZ(zAt,n,new OI(this,t)):mZ(zAt,n,this),iSn(this,t),t==(iE(),n$t)?(this.wb=BB(this,1939),BB(t,1941)):this.wb=(QX(),t$t)}function gMn(n){var t,e;if(null==n)return null;for(t=null,e=0;e=VVn?"error":i>=900?"warn":i>=800?"info":"log",n.a),n.b&&xNn(t,e,n.b,"Exception: ",!0))}function mMn(n,t){var e,i;return!n.q&&(n.q=new xp),null!=(i=RX(n.q,t))?i:(cL(e=t.wg(),4)&&(null==e?(!n.q&&(n.q=new xp),v6(n.q,t)):(!n.q&&(n.q=new xp),VW(n.q,t,e))),e)}function yMn(){yMn=O,Rat=new VS("P1_CYCLE_BREAKING",0),Kat=new VS("P2_LAYERING",1),_at=new VS("P3_NODE_ORDERING",2),Fat=new VS("P4_NODE_PLACEMENT",3),Bat=new VS("P5_EDGE_ROUTING",4)}function kMn(n,t){var e,i,r,c;for(i=(1==t?Wat:Xat).a.ec().Kc();i.Ob();)for(e=BB(i.Pb(),103),c=BB(h6(n.f.c,e),21).Kc();c.Ob();)r=BB(c.Pb(),46),y7(n.b.b,r.b),y7(n.b.a,BB(r.b,81).d)}function jMn(n,t){var e;if(Dnn(),n.c==t.c){if(n.b==t.b||hcn(n.b,t.b)){if(e=ZO(n.b)?1:-1,n.a&&!t.a)return e;if(!n.a&&t.a)return-e}return E$(n.b.g,t.b.g)}return Pln(n.c,t.c)}function EMn(n,t){var e;OTn(t,"Hierarchical port position processing",1),(e=n.b).c.length>0&&i_n((l1(0,e.c.length),BB(e.c[0],29)),n),e.c.length>1&&i_n(BB(xq(e,e.c.length-1),29),n),HSn(t)}function TMn(n,t){var e,i;if(NMn(n,t))return!0;for(i=new Wb(t);i.a=(r=n.Vi())||t<0)throw Hp(new Ay(u8n+t+o8n+r));if(e>=r||e<0)throw Hp(new Ay(s8n+e+o8n+r));return t!=e?(c=n.Ti(e),n.Hi(t,c),i=c):i=n.Oi(e),i}function $Mn(n){var t,e,i;if(i=n,n)for(t=0,e=n.Ug();e;e=e.Ug()){if(++t>GQn)return $Mn(e);if(i=e,e==n)throw Hp(new Fy("There is a cycle in the containment hierarchy of "+n))}return i}function LMn(n){var t,e,i;for(i=new $an(FWn,"[","]"),e=n.Kc();e.Ob();)b6(i,GI(t=e.Pb())===GI(n)?"(this Collection)":null==t?zWn:Bbn(t));return i.a?0==i.e.length?i.a.a:i.a.a+""+i.e:i.c}function NMn(n,t){var e,i;if(i=!1,t.gc()<2)return!1;for(e=0;ei&&(b1(t-1,n.length),n.charCodeAt(t-1)<=32);)--t;return i>0||t1&&(n.j.b+=n.e)):(n.j.a+=i.a,n.j.b=e.Math.max(n.j.b,i.b),n.d.c.length>1&&(n.j.a+=n.e))}function _Mn(){_Mn=O,$st=Pun(Gk(FIt,1),YZn,61,0,[(kUn(),sIt),oIt,SIt]),Ast=Pun(Gk(FIt,1),YZn,61,0,[oIt,SIt,CIt]),Lst=Pun(Gk(FIt,1),YZn,61,0,[SIt,CIt,sIt]),Nst=Pun(Gk(FIt,1),YZn,61,0,[CIt,sIt,oIt])}function FMn(n,t,e,i){var r,c,a,u,o;if(c=n.c.d,a=n.d.d,c.j!=a.j)for(o=n.b,r=c.j,u=null;r!=a.j;)u=0==t?Mln(r):Eln(r),DH(i,UR(zgn(r,o.d[r.g],e),zgn(u,o.d[u.g],e))),r=u}function BMn(n,t,e,i){var r,c,a,u,o;return u=BB((a=qyn(n.a,t,e)).a,19).a,c=BB(a.b,19).a,i&&(o=BB(mMn(t,(hWn(),Elt)),10),r=BB(mMn(e,Elt),10),o&&r&&(t4(n.b,o,r),u+=n.b.i,c+=n.b.e)),u>c}function HMn(n){var t,e,i,r,c,a,u,o;for(this.a=rvn(n),this.b=new Np,i=0,r=(e=n).length;iFD(n.d).c?(n.i+=n.g.c,gdn(n.d)):FD(n.d).c>FD(n.g).c?(n.e+=n.d.c,gdn(n.g)):(n.i+=qq(n.g),n.e+=qq(n.d),gdn(n.g),gdn(n.d))}function UMn(n,t,e){var i,r,c,a;for(c=t.q,a=t.r,new zZ((O6(),Tyt),t,c,1),new zZ(Tyt,c,a,1),r=new Wb(e);r.ao&&(s=o/r),(c=e.Math.abs(t.b-n.b))>a&&(h=a/c),u=e.Math.min(s,h),n.a+=u*(t.a-n.a),n.b+=u*(t.b-n.b)}function nSn(n,t,e,i,r){var c,a;for(a=!1,c=BB(xq(e.b,0),33);hBn(n,t,c,i,r)&&(a=!0,cEn(e,c),0!=e.b.c.length);)c=BB(xq(e.b,0),33);return 0==e.b.c.length&&Tkn(e.j,e),a&&Gmn(t.q),a}function tSn(n,t){var e,i,r,c;if(jDn(),t.b<2)return!1;for(i=e=BB(b3(c=spn(t,0)),8);c.b!=c.d.c;){if(cNn(n,i,r=BB(b3(c),8)))return!0;i=r}return!!cNn(n,i,e)}function eSn(n,t,e,i){return 0==e?(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),BK(n.o,t,i)):BB(itn(BB(yan(n,16),26)||n.zh(),e),66).Nj().Rj(n,fgn(n),e-bX(n.zh()),t,i)}function iSn(n,t){var e;t!=n.sb?(e=null,n.sb&&(e=BB(n.sb,49).ih(n,1,HOt,e)),t&&(e=BB(t,49).gh(n,1,HOt,e)),(e=jfn(n,t,e))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,4,t,t))}function rSn(n,t){var e,i;if(!t)throw Hp(new ek("All edge sections need an end point."));e=Ren(t,"x"),Ten(new Kg(n).a,(kW(e),e)),i=Ren(t,"y"),Oen(new _g(n).a,(kW(i),i))}function cSn(n,t){var e,i;if(!t)throw Hp(new ek("All edge sections need a start point."));e=Ren(t,"x"),Ien(new xg(n).a,(kW(e),e)),i=Ren(t,"y"),Aen(new Dg(n).a,(kW(i),i))}function aSn(n,t){var e,i,r,c,a;for(i=0,c=psn(n).length;i>22-t,r=n.h<>22-t):t<44?(e=0,i=n.l<>44-t):(e=0,i=0,r=n.l<n)throw Hp(new _y("k must be smaller than n"));return 0==t||t==n?1:0==n?0:Mjn(n)/(Mjn(t)*Mjn(n-t))}function vSn(n,t){var e,i,r,c;for(e=new OA(n);null!=e.g||e.c?null==e.g||0!=e.i&&BB(e.g[e.i-1],47).Ob():tZ(e);)if(cL(c=BB(aLn(e),56),160))for(i=BB(c,160),r=0;r>4],t[2*e+1]=YLt[15&r];return Bdn(t,0,t.length)}function NSn(n){var t;switch(nV(),n.c.length){case 0:return Bnt;case 1:return IH((t=BB(JCn(new Wb(n)),42)).cd(),t.dd());default:return new hy(BB(Qgn(n,x8(Hnt,kVn,42,n.c.length,0,1)),165))}}function xSn(n){var t,e,i,r,c;for(t=new Lp,e=new Lp,d3(t,n),d3(e,n);e.b!=e.c;)for(c=new Wb(BB(dU(e),37).a);c.a0&&uKn(n,e,t),r):IOn(n,t,e)}function _Sn(n,t,e){var i,r,c,a;if(0!=t.b){for(i=new YT,a=spn(t,0);a.b!=a.d.c;)Frn(i,xun(c=BB(b3(a),86))),(r=c.e).a=BB(mMn(c,(qqn(),gkt)),19).a,r.b=BB(mMn(c,pkt),19).a;_Sn(n,i,mcn(e,i.b/n.a|0))}}function FSn(n,t){var e,i,r,c,a;if(n.e<=t)return n.g;if(z1(n,n.g,t))return n.g;for(c=n.r,i=n.g,a=n.r,r=(c-i)/2+i;i+11&&(n.e.b+=n.a)):(n.e.a+=i.a,n.e.b=e.Math.max(n.e.b,i.b),n.d.c.length>1&&(n.e.a+=n.a))}function XSn(n){var t,e,i,r;switch(t=(r=n.i).b,i=r.j,e=r.g,r.a.g){case 0:e.a=(n.g.b.o.a-i.a)/2;break;case 1:e.a=t.d.n.a+t.d.a.a;break;case 2:e.a=t.d.n.a+t.d.a.a-i.a;break;case 3:e.b=t.d.n.b+t.d.a.b}}function WSn(n,t,e,i,r){if(ii&&(n.a=i),n.br&&(n.b=r),n}function VSn(n){if(cL(n,149))return MNn(BB(n,149));if(cL(n,229))return Zbn(BB(n,229));if(cL(n,23))return hSn(BB(n,23));throw Hp(new _y(z6n+LMn(new Jy(Pun(Gk(Ant,1),HWn,1,5,[n])))))}function QSn(n,t,e,i,r){var c,a,u;for(c=!0,a=0;a>>r|e[a+i+1]<>>r,++a}return c}function YSn(n,t,e,i){var r,c;if(t.k==(uSn(),Put))for(c=new oz(ZL(fbn(t).a.Kc(),new h));dAn(c);)if((r=BB(U5(c),17)).c.i.k==Put&&n.c.a[r.c.i.c.p]==i&&n.c.a[t.c.p]==e)return!0;return!1}function JSn(n,t){var e,i,r,c;return t&=63,e=n.h&PQn,t<22?(c=e>>>t,r=n.m>>t|e<<22-t,i=n.l>>t|n.m<<22-t):t<44?(c=0,r=e>>>t-22,i=n.m>>t-22|n.h<<44-t):(c=0,r=0,i=e>>>t-44),M$(i&SQn,r&SQn,c&PQn)}function ZSn(n,t,e,i){var r;this.b=i,this.e=n==(oin(),Amt),r=t[e],this.d=kq($Nt,[sVn,ZYn],[177,25],16,[r.length,r.length],2),this.a=kq(ANt,[sVn,hQn],[48,25],15,[r.length,r.length],2),this.c=new zEn(t,e)}function nPn(n){var t,e,i;for(n.k=new o1((kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length,n.j.c.length),i=new Wb(n.j);i.a=e)return hPn(n,t,i.p),!0;return!1}function cPn(n){var t;return 0!=(64&n.Db)?mSn(n):(t=new lN(Z5n),!n.a||oO(oO((t.a+=' "',t),n.a),'"'),oO(kE(oO(kE(oO(kE(oO(kE((t.a+=" (",t),n.i),","),n.j)," | "),n.g),","),n.f),")"),t.a)}function aPn(n,t,e){var i,r,c,a,u;for(u=axn(n.e.Tg(),t),r=BB(n.g,119),i=0,a=0;ae?dCn(n,e,"start index"):t<0||t>e?dCn(t,e,"end index"):$Rn("end index (%s) must not be less than start index (%s)",Pun(Gk(Ant,1),HWn,1,5,[iln(t),iln(n)]))}function sPn(n,t){var e,i,r,c;for(i=0,r=n.length;i0&&lPn(n,c,e));t.p=0}function bPn(n){var t;this.c=new YT,this.f=n.e,this.e=n.d,this.i=n.g,this.d=n.c,this.b=n.b,this.k=n.j,this.a=n.a,n.i?this.j=n.i:this.j=new YK(t=BB(Vj(jMt),9),BB(SR(t,t.length),9),0),this.g=n.f}function wPn(n){var t,e,i,r;for(t=xX(oO(new lN("Predicates."),"and"),40),e=!0,r=new Sb(n);r.b0?u[a-1]:x8(Out,a1n,10,0,0,1),r=u[a],s=a=0?n.Bh(r):cIn(n,i)}else qfn(n,e,i)}function yPn(n){var t,e;if(e=null,t=!1,cL(n,204)&&(t=!0,e=BB(n,204).a),t||cL(n,258)&&(t=!0,e=""+BB(n,258).a),t||cL(n,483)&&(t=!0,e=""+BB(n,483).a),!t)throw Hp(new Ly(H6n));return e}function kPn(n,t){var e,i;if(n.f){for(;t.Ob();)if(cL(i=(e=BB(t.Pb(),72)).ak(),99)&&0!=(BB(i,18).Bb&h6n)&&(!n.e||i.Gj()!=NOt||0!=i.aj())&&null!=e.dd())return t.Ub(),!0;return!1}return t.Ob()}function jPn(n,t){var e,i;if(n.f){for(;t.Sb();)if(cL(i=(e=BB(t.Ub(),72)).ak(),99)&&0!=(BB(i,18).Bb&h6n)&&(!n.e||i.Gj()!=NOt||0!=i.aj())&&null!=e.dd())return t.Pb(),!0;return!1}return t.Sb()}function EPn(n,t,e){var i,r,c,a,u,o;for(o=axn(n.e.Tg(),t),i=0,u=n.i,r=BB(n.g,119),a=0;a1&&(t.c[t.c.length]=c)}function SPn(n){var t,e,i;for(Frn(e=new YT,n.o),i=new om;0!=e.b;)WUn(n,t=BB(0==e.b?null:(Px(0!=e.b),Atn(e,e.a.a)),508),!0)&&WB(i.a,t);for(;0!=i.a.c.length;)WUn(n,t=BB(thn(i),508),!1)}function PPn(){PPn=O,kMt=new $C(hJn,0),wMt=new $C("BOOLEAN",1),vMt=new $C("INT",2),yMt=new $C("STRING",3),dMt=new $C("DOUBLE",4),gMt=new $C("ENUM",5),pMt=new $C("ENUMSET",6),mMt=new $C("OBJECT",7)}function CPn(n,t){var i,r,c,a,u;r=e.Math.min(n.c,t.c),a=e.Math.min(n.d,t.d),(c=e.Math.max(n.c+n.b,t.c+t.b))=(r/2|0))for(this.e=i?i.c:null,this.d=r;e++0;)EZ(this);this.b=t,this.a=null}function _Pn(n,t){var e,i;t.a?zNn(n,t):(!!(e=BB(kK(n.b,t.b),57))&&e==n.a[t.b.f]&&!!e.a&&e.a!=t.b.a&&e.c.Fc(t.b),!!(i=BB(yK(n.b,t.b),57))&&n.a[i.f]==t.b&&!!i.a&&i.a!=t.b.a&&t.b.c.Fc(i),MN(n.b,t.b))}function FPn(n,t){var e,i;if(e=BB(oV(n.b,t),124),BB(BB(h6(n.r,t),21),84).dc())return e.n.b=0,void(e.n.c=0);e.n.b=n.C.b,e.n.c=n.C.c,n.A.Hc((mdn(),_It))&&yRn(n,t),i=Xpn(n,t),PDn(n,t)==(cpn(),BCt)&&(i+=2*n.w),e.a.a=i}function BPn(n,t){var e,i;if(e=BB(oV(n.b,t),124),BB(BB(h6(n.r,t),21),84).dc())return e.n.d=0,void(e.n.a=0);e.n.d=n.C.d,e.n.a=n.C.a,n.A.Hc((mdn(),_It))&&kRn(n,t),i=Wpn(n,t),PDn(n,t)==(cpn(),BCt)&&(i+=2*n.w),e.a.b=i}function HPn(n,t){var e,i,r,c;for(c=new Np,i=new Wb(t);i.ae.a&&(i.Hc((wEn(),WMt))?r=(t.a-e.a)/2:i.Hc(QMt)&&(r=t.a-e.a)),t.b>e.b&&(i.Hc((wEn(),JMt))?c=(t.b-e.b)/2:i.Hc(YMt)&&(c=t.b-e.b)),lMn(n,r,c)}function bCn(n,t,e,i,r,c,a,u,o,s,h,f,l){cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),4),Nrn(n,e),n.f=a,$ln(n,u),Nln(n,o),Aln(n,s),Lln(n,h),nln(n,f),qln(n,l),Yfn(n,!0),Len(n,r),n.ok(c),Ihn(n,t),null!=i&&(n.i=null,arn(n,i))}function wCn(n){var t,e;if(n.f){for(;n.n>0;){if(cL(e=(t=BB(n.k.Xb(n.n-1),72)).ak(),99)&&0!=(BB(e,18).Bb&h6n)&&(!n.e||e.Gj()!=NOt||0!=e.aj())&&null!=t.dd())return!0;--n.n}return!1}return n.n>0}function dCn(n,t,e){if(n<0)return $Rn(BWn,Pun(Gk(Ant,1),HWn,1,5,[e,iln(n)]));if(t<0)throw Hp(new _y(qWn+t));return $Rn("%s (%s) must not be greater than size (%s)",Pun(Gk(Ant,1),HWn,1,5,[e,iln(n),iln(t)]))}function gCn(n,t,e,i,r,c){var a,u,o;if(i-e<7)$bn(t,e,i,c);else if(gCn(t,n,u=e+r,o=u+((a=i+r)-u>>1),-r,c),gCn(t,n,o,a,-r,c),c.ue(n[o-1],n[o])<=0)for(;e=0?n.sh(c,e):TLn(n,r,e)}else Lbn(n,i,r,e)}function kCn(n){var t,e,i,r;if(e=BB(n,49).qh())try{if(i=null,(t=$$n((WM(),zAt),M_n(_bn(e))))&&(r=t.rh())&&(i=r.Wk(Xy(e.e))),i&&i!=n)return kCn(i)}catch(c){if(!cL(c=lun(c),60))throw Hp(c)}return n}function jCn(n,t,e){var i,r,c,a;if(a=null==t?0:n.b.se(t),0==(r=null==(i=n.a.get(a))?new Array:i).length)n.a.set(a,r);else if(c=hhn(n,t,r))return c.ed(e);return $X(r,r.length,new PS(t,e)),++n.c,oY(n.b),null}function ECn(n,t){var e;return h2(n.a),CU(n.a,(Prn(),Qkt),Qkt),CU(n.a,Ykt,Ykt),dq(e=new B2,Ykt,(Cbn(),ejt)),GI(ZAn(t,(Uyn(),Sjt)))!==GI((Hsn(),sjt))&&dq(e,Ykt,njt),dq(e,Ykt,tjt),aA(n.a,e),$qn(n.a,t)}function TCn(n){if(!n)return lk(),htt;var t=n.valueOf?n.valueOf():n;if(t!==n){var i=ftt[typeof t];return i?i(t):khn(typeof t)}return n instanceof Array||n instanceof e.Array?new Tl(n):new Pl(n)}function MCn(n,t,i){var r,c,a;switch(a=n.o,(c=(r=BB(oV(n.p,i),244)).i).b=SIn(r),c.a=MIn(r),c.b=e.Math.max(c.b,a.a),c.b>a.a&&!t&&(c.b=a.a),c.c=-(c.b-a.a)/2,i.g){case 1:c.d=-c.a;break;case 3:c.d=a.b}_Fn(r),GFn(r)}function SCn(n,t,i){var r,c,a;switch(a=n.o,(c=(r=BB(oV(n.p,i),244)).i).b=SIn(r),c.a=MIn(r),c.a=e.Math.max(c.a,a.b),c.a>a.b&&!t&&(c.a=a.b),c.d=-(c.a-a.b)/2,i.g){case 4:c.c=-c.b;break;case 2:c.c=a.a}_Fn(r),GFn(r)}function PCn(n,t){var e,i,r,c,a;if(!t.dc())if(r=BB(t.Xb(0),128),1!=t.gc())for(e=1;e0)try{i=l_n(t,_Vn,DWn)}catch(r){throw cL(r=lun(r),127)?Hp(new L7(r)):Hp(r)}return!n.a&&(n.a=new Sp(n)),i<(e=n.a).i&&i>=0?BB(Wtn(e,i),56):null}function LCn(n,t){if(n<0)return $Rn(BWn,Pun(Gk(Ant,1),HWn,1,5,["index",iln(n)]));if(t<0)throw Hp(new _y(qWn+t));return $Rn("%s (%s) must be less than size (%s)",Pun(Gk(Ant,1),HWn,1,5,["index",iln(n),iln(t)]))}function NCn(n){var t,e,i,r,c;if(null==n)return zWn;for(c=new $an(FWn,"[","]"),i=0,r=(e=n).length;i0)for(a=n.c.d,r=kL(XR(new xC((u=n.d.d).a,u.b),a),1/(i+1)),c=new xC(a.a,a.b),e=new Wb(n.a);e.a=0?n._g(e,!0,!0):cOn(n,r,!0),153),BB(i,215).ol(t)}function aIn(n){var t,i;return n>-0x800000000000&&n<0x800000000000?0==n?0:((t=n<0)&&(n=-n),i=CJ(e.Math.floor(e.Math.log(n)/.6931471805599453)),(!t||n!=e.Math.pow(2,i))&&++i,i):Van(fan(n))}function uIn(n){var t,e,i,r,c,a,u;for(c=new fA,e=new Wb(n);e.a2&&u.e.b+u.j.b<=2&&(r=u,i=a),c.a.zc(r,c),r.q=i);return c}function oIn(n,t){var e,i,r;return qan(i=new $vn(n),t),hon(i,(hWn(),Vft),t),hon(i,(HXn(),ept),(QEn(),XCt)),hon(i,kdt,(wvn(),OMt)),Bl(i,(uSn(),Mut)),CZ(e=new CSn,i),qCn(e,(kUn(),CIt)),CZ(r=new CSn,i),qCn(r,oIt),i}function sIn(n){switch(n.g){case 0:return new Ny((oin(),Omt));case 1:return new df;case 2:return new jf;default:throw Hp(new _y("No implementation is available for the crossing minimizer "+(null!=n.f?n.f:""+n.g)))}}function hIn(n,t){var e,i,r,c;for(n.c[t.p]=!0,WB(n.a,t),c=new Wb(t.j);c.a=(c=a.gc()))a.$b();else for(r=a.Kc(),i=0;i0?wk():c<0&&EIn(n,t,-c),!0)}function MIn(n){var t,e,i,r,c,a;if(a=0,0==n.b){for(t=0,r=0,c=(i=Xvn(n,!0)).length;r0&&(a+=e,++t);t>1&&(a+=n.c*(t-1))}else a=Kk(ecn(LV(AV(LU(n.a),new Mn),new Sn)));return a>0?a+n.n.d+n.n.a:0}function SIn(n){var t,e,i,r,c,a;if(a=0,0==n.b)a=Kk(ecn(LV(AV(LU(n.a),new En),new Tn)));else{for(t=0,r=0,c=(i=Wvn(n,!0)).length;r0&&(a+=e,++t);t>1&&(a+=n.c*(t-1))}return a>0?a+n.n.b+n.n.c:0}function PIn(n,t){var i,r,c,a;for(i=(a=BB(oV(n.b,t),124)).a,c=BB(BB(h6(n.r,t),21),84).Kc();c.Ob();)(r=BB(c.Pb(),111)).c&&(i.a=e.Math.max(i.a,VH(r.c)));if(i.a>0)switch(t.g){case 2:a.n.c=n.s;break;case 4:a.n.b=n.s}}function CIn(n,t){var e,i,r;return 0==(e=BB(mMn(t,(fRn(),Zct)),19).a-BB(mMn(n,Zct),19).a)?(i=XR(B$(BB(mMn(n,(Mrn(),uat)),8)),BB(mMn(n,oat),8)),r=XR(B$(BB(mMn(t,uat),8)),BB(mMn(t,oat),8)),Pln(i.a*i.b,r.a*r.b)):e}function IIn(n,t){var e,i,r;return 0==(e=BB(mMn(t,(CAn(),$kt)),19).a-BB(mMn(n,$kt),19).a)?(i=XR(B$(BB(mMn(n,(qqn(),Zyt)),8)),BB(mMn(n,nkt),8)),r=XR(B$(BB(mMn(t,Zyt),8)),BB(mMn(t,nkt),8)),Pln(i.a*i.b,r.a*r.b)):e}function OIn(n){var t,e;return(e=new Ck).a+="e_",null!=(t=Xan(n))&&(e.a+=""+t),n.c&&n.d&&(oO((e.a+=" ",e),pyn(n.c)),oO(uO((e.a+="[",e),n.c.i),"]"),oO((e.a+=e1n,e),pyn(n.d)),oO(uO((e.a+="[",e),n.d.i),"]")),e.a}function AIn(n){switch(n.g){case 0:return new pf;case 1:return new vf;case 2:return new gf;case 3:return new mf;default:throw Hp(new _y("No implementation is available for the layout phase "+(null!=n.f?n.f:""+n.g)))}}function $In(n,t,i,r,c){var a;switch(a=0,c.g){case 1:a=e.Math.max(0,t.b+n.b-(i.b+r));break;case 3:a=e.Math.max(0,-n.b-r);break;case 2:a=e.Math.max(0,-n.a-r);break;case 4:a=e.Math.max(0,t.a+n.a-(i.a+r))}return a}function LIn(n,t,e){var i,r,c;if(e)for(c=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);c.Ob();)r=x2(e,BB(c.Pb(),19).a),L6n in r.a||N6n in r.a?sKn(n,r,t):EXn(n,r,t),PL(BB(RX(n.b,Qdn(r)),79))}function NIn(n){var t,e;switch(n.b){case-1:return!0;case 0:return(e=n.t)>1||-1==e||(t=Ikn(n))&&(ZM(),t.Cj()==E9n)?(n.b=-1,!0):(n.b=1,!1);default:return!1}}function xIn(n,t){var e,i,r,c,a;for(!t.s&&(t.s=new eU(FAt,t,21,17)),c=null,r=0,a=(i=t.s).i;r=0&&i=0?n._g(e,!0,!0):cOn(n,r,!0),153),BB(i,215).ll(t);throw Hp(new _y(r6n+t.ne()+u6n))}function GIn(){var n;return tS(),Q$t?BB($$n((WM(),zAt),V9n),1939):(RO(Hnt,new Cs),nzn(),n=BB(cL(SJ((WM(),zAt),V9n),547)?SJ(zAt,V9n):new UW,547),Q$t=!0,oWn(n),TWn(n),VW((VM(),ZAt),n,new Go),mZ(zAt,V9n,n),n)}function zIn(n,t){var e,i,r,c;n.j=-1,mA(n.e)?(e=n.i,c=0!=n.i,c6(n,t),i=new N7(n.e,3,n.c,null,t,e,c),r=t.Qk(n.e,n.c,null),(r=IEn(n,t,r))?(r.Ei(i),r.Fi()):ban(n.e,i)):(c6(n,t),(r=t.Qk(n.e,n.c,null))&&r.Fi())}function UIn(n,t){var e,i,r;if(r=0,(i=t[0])>=n.length)return-1;for(b1(i,n.length),e=n.charCodeAt(i);e>=48&&e<=57&&(r=10*r+(e-48),!(++i>=n.length));)b1(i,n.length),e=n.charCodeAt(i);return i>t[0]?t[0]=i:r=-1,r}function XIn(n){var t,i,r,c,a;return i=c=BB(n.a,19).a,r=a=BB(n.b,19).a,t=e.Math.max(e.Math.abs(c),e.Math.abs(a)),c<=0&&c==a?(i=0,r=a-1):c==-t&&a!=t?(i=a,r=c,a>=0&&++i):(i=-a,r=c),new rI(iln(i),iln(r))}function WIn(n,t,e,i){var r,c,a,u,o,s;for(r=0;r=0&&s>=0&&o=n.i)throw Hp(new Ay(u8n+t+o8n+n.i));if(e>=n.i)throw Hp(new Ay(s8n+e+o8n+n.i));return i=n.g[e],t!=e&&(t>16))>>16&16),e+=t=(i=(n>>=t)-256)>>16&8,e+=t=(i=(n<<=t)-_Qn)>>16&4,(e+=t=(i=(n<<=t)-hVn)>>16&2)+2-(t=(i=(n<<=t)>>14)&~(i>>1)))}function nOn(n){var t,e,i,r;for(MQ(),Sct=new Np,Mct=new xp,Tct=new Np,!n.a&&(n.a=new eU(UOt,n,10,11)),xUn(t=n.a),r=new AL(t);r.e!=r.i.gc();)i=BB(kpn(r),33),-1==E7(Sct,i,0)&&(e=new Np,WB(Tct,e),Rgn(i,e));return Tct}function tOn(n,t,e){var i,r,c,a;n.a=e.b.d,cL(t,352)?(e5(c=qSn(r=cDn(BB(t,79),!1,!1)),i=new Nw(n)),VFn(c,r),null!=t.We((sWn(),OSt))&&e5(BB(t.We(OSt),74),i)):((a=BB(t,470)).Hg(a.Dg()+n.a.a),a.Ig(a.Eg()+n.a.b))}function eOn(n,t){var i,r,c,a,u,o,s,h;for(h=Gy(MD(mMn(t,(HXn(),Npt)))),s=n[0].n.a+n[0].o.a+n[0].d.c+h,o=1;o=0?e:(u=lW(XR(new xC(a.c+a.b/2,a.d+a.a/2),new xC(c.c+c.b/2,c.d+c.a/2))),-(Y_n(c,a)-1)*u)}function rOn(n,t,e){var i;JT(new Rq(null,(!e.a&&(e.a=new eU(FOt,e,6,6)),new w1(e.a,16))),new eI(n,t)),JT(new Rq(null,(!e.n&&(e.n=new eU(zOt,e,1,7)),new w1(e.n,16))),new iI(n,t)),(i=BB(ZAn(e,(sWn(),OSt)),74))&&Yrn(i,n,t)}function cOn(n,t,e){var i,r,c;if(c=Fqn((IPn(),Z$t),n.Tg(),t))return ZM(),BB(c,66).Oj()||(c=Z1(B7(Z$t,c))),r=BB((i=n.Yg(c))>=0?n._g(i,!0,!0):cOn(n,c,!0),153),BB(r,215).hl(t,e);throw Hp(new _y(r6n+t.ne()+u6n))}function aOn(n,t,e,i){var r,c,a,u,o;if(r=n.d[t])if(c=r.g,o=r.i,null!=i){for(u=0;u=e&&(i=t,c=(o=(u.c+u.a)/2)-e,u.c<=o-e&&kG(n,i++,new kB(u.c,c)),(a=o+e)<=u.a&&(r=new kB(a,u.a),LZ(i,n.c.length),MS(n.c,i,r)))}function bOn(n){var t;if(n.c||null!=n.g){if(null==n.g)return!0;if(0==n.i)return!1;t=BB(n.g[n.i-1],47)}else n.d=n.si(n.f),f9(n,n.d),t=n.d;return t==n.b&&null.km>=null.jm()?(aLn(n),bOn(n)):t.Ob()}function wOn(n,t,e){var i,r,c,a;if(!(a=e)&&(a=LH(new Xm,0)),OTn(a,qZn,1),$Gn(n.c,t),1==(c=RGn(n.a,t)).gc())VHn(BB(c.Xb(0),37),a);else for(r=1/c.gc(),i=c.Kc();i.Ob();)VHn(BB(i.Pb(),37),mcn(a,r));Ek(n.a,c,t),FDn(t),HSn(a)}function dOn(n){if(this.a=n,n.c.i.k==(uSn(),Mut))this.c=n.c,this.d=BB(mMn(n.c.i,(hWn(),Qft)),61);else{if(n.d.i.k!=Mut)throw Hp(new _y("Edge "+n+" is not an external edge."));this.c=n.d,this.d=BB(mMn(n.d.i,(hWn(),Qft)),61)}}function gOn(n,t){var e,i,r;r=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,r,n.b)),t?t!=n&&(Nrn(n,t.zb),$en(n,t.d),Fin(n,null==(e=null==(i=t.c)?t.zb:i)||mK(e,t.zb)?null:e)):(Nrn(n,null),$en(n,0),Fin(n,null))}function pOn(n){var t,e;if(n.f){for(;n.n=(a=null==(e=BB(yan(n.a,4),126))?0:e.length))throw Hp(new tK(t,a));return r=e[t],1==a?i=null:(aHn(e,0,i=x8(dAt,i9n,415,a-1,0,1),0,t),(c=a-t-1)>0&&aHn(e,t+1,i,t,c)),Fgn(n,i),eCn(n,t,r),r}function TOn(){TOn=O,lLt=BB(Wtn(QQ((cE(),gLt).qb),6),34),sLt=BB(Wtn(QQ(gLt.qb),3),34),hLt=BB(Wtn(QQ(gLt.qb),4),34),fLt=BB(Wtn(QQ(gLt.qb),5),18),oEn(lLt),oEn(sLt),oEn(hLt),oEn(fLt),bLt=new Jy(Pun(Gk(FAt,1),N9n,170,0,[lLt,sLt]))}function MOn(n,t){var e;this.d=new lm,this.b=t,this.e=new wA(t.qf()),e=n.u.Hc((lIn(),iIt)),n.u.Hc(eIt)?n.D?this.a=e&&!t.If():this.a=!0:n.u.Hc(rIt)?this.a=!!e&&!(t.zf().Kc().Ob()||t.Bf().Kc().Ob()):this.a=!1}function SOn(n,t){var e,i,r,c;for(e=n.o.a,c=BB(BB(h6(n.r,t),21),84).Kc();c.Ob();)(r=BB(c.Pb(),111)).e.a=(i=r.b).Xe((sWn(),aPt))?i.Hf()==(kUn(),CIt)?-i.rf().a-Gy(MD(i.We(aPt))):e+Gy(MD(i.We(aPt))):i.Hf()==(kUn(),CIt)?-i.rf().a:e}function POn(n,t){var e,i,r;e=BB(mMn(n,(HXn(),Udt)),103),r=BB(ZAn(t,upt),61),(i=BB(mMn(n,ept),98))!=(QEn(),QCt)&&i!=YCt?r==(kUn(),PIt)&&(r=OFn(t,e))==PIt&&(r=hwn(e)):r=XHn(t)>0?hwn(e):Tln(hwn(e)),Ypn(t,upt,r)}function COn(n,t){var e,i,r,c,a;for(a=n.j,t.a!=t.b&&m$(a,new Ur),r=a.c.length/2|0,i=0;i0&&uKn(n,e,t),c):null!=i.a?(uKn(n,t,e),-1):null!=r.a?(uKn(n,e,t),1):0}function OOn(n,t){var e,i,r,c;n.ej()?(e=n.Vi(),c=n.fj(),++n.j,n.Hi(e,n.oi(e,t)),i=n.Zi(3,null,t,e,c),n.bj()&&(r=n.cj(t,null))?(r.Ei(i),r.Fi()):n.$i(i)):(eW(n,t),n.bj()&&(r=n.cj(t,null))&&r.Fi())}function AOn(n,t){var e,i,r,c,a;for(a=axn(n.e.Tg(),t),r=new go,e=BB(n.g,119),c=n.i;--c>=0;)i=e[c],a.rl(i.ak())&&f9(r,i);!aXn(n,r)&&mA(n.e)&&Lv(n,t.$j()?LY(n,6,t,(SQ(),set),null,-1,!1):LY(n,t.Kj()?2:1,t,null,null,-1,!1))}function $On(){var n,t;for($On=O,aet=x8(oet,sVn,91,32,0,1),uet=x8(oet,sVn,91,32,0,1),n=1,t=0;t<=18;t++)aet[t]=npn(n),uet[t]=npn(yz(n,t)),n=cbn(n,5);for(;tc)||t.q&&(c=(i=t.C).c.c.a-i.o.a/2,i.n.a-e>c)))}function NOn(n,t){OTn(t,"Partition preprocessing",1),JT(BB(P4(AV(wnn(AV(new Rq(null,new w1(n.a,16)),new vi),new mi),new yi),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15).Oc(),new ki),HSn(t)}function xOn(n){var t,e,i,r,c,a;for(qZ(),e=new v4,i=new Wb(n.e.b);i.a1?n.e*=Gy(n.a):n.f/=Gy(n.a),Chn(n),ggn(n),TRn(n),hon(n.b,(Epn(),gct),n.g)}function HOn(n,t,e){var i,r,c,a,u;for(i=0,u=e,t||(i=e*(n.c.length-1),u*=-1),c=new Wb(n);c.a=0?(t||(t=new Pk,i>0&&cO(t,n.substr(0,i))),t.a+="\\",NX(t,e&QVn)):t&&NX(t,e&QVn);return t?t.a:n}function rAn(n){var t;if(!n.a)throw Hp(new Fy("IDataType class expected for layout option "+n.f));if(null==(t=I3(n.a)))throw Hp(new Fy("Couldn't create new instance of property '"+n.f+"'. "+r5n+(ED(bAt),bAt.k)+c5n));return BB(t,414)}function cAn(n){var t,e,i,r,c;return(c=n.eh())&&c.kh()&&(r=tfn(n,c))!=c?(e=n.Vg(),i=(t=n.Vg())>=0?n.Qg(null):n.eh().ih(n,-1-t,null,null),n.Rg(BB(r,49),e),i&&i.Fi(),n.Lg()&&n.Mg()&&e>-1&&ban(n,new nU(n,9,e,c,r)),r):c}function aAn(n){var t,e,i,r,c,a,u;for(c=0,r=n.f.e,e=0;e>5)>=n.d)return n.e<0;if(e=n.a[r],t=1<<(31&t),n.e<0){if(r<(i=Ccn(n)))return!1;e=i==r?-e:~e}return 0!=(e&t)}function lAn(n,t,e,i){var r;BB(e.b,65),BB(e.b,65),BB(i.b,65),BB(i.b,65),NH(r=XR(B$(BB(e.b,65).c),BB(i.b,65).c),HCn(BB(e.b,65),BB(i.b,65),r)),BB(i.b,65),BB(i.b,65),BB(i.b,65).c.a,r.a,BB(i.b,65).c.b,r.b,BB(i.b,65),Otn(i.a,new TB(n,t,i))}function bAn(n,t){var e,i,r,c,a,u,o;if(c=t.e)for(e=cAn(c),i=BB(n.g,674),a=0;a>16)),15).Xc(c))0&&((!dA(n.a.c)||!t.n.d)&&(!gA(n.a.c)||!t.n.b)&&(t.g.d+=e.Math.max(0,r/2-.5)),(!dA(n.a.c)||!t.n.a)&&(!gA(n.a.c)||!t.n.c)&&(t.g.a-=r-1))}function mAn(n){var t,i,r,c,a;if(a=K_n(n,c=new Np),t=BB(mMn(n,(hWn(),Elt)),10))for(r=new Wb(t.j);r.a>t,c=n.m>>t|e<<22-t,r=n.l>>t|n.m<<22-t):t<44?(a=i?PQn:0,c=e>>t-22,r=n.m>>t-22|e<<44-t):(a=i?PQn:0,c=i?SQn:0,r=e>>t-44),M$(r&SQn,c&SQn,a&PQn)}function EAn(n){var t,i,r,c,a,u;for(this.c=new Np,this.d=n,r=RQn,c=RQn,t=KQn,i=KQn,u=spn(n,0);u.b!=u.d.c;)a=BB(b3(u),8),r=e.Math.min(r,a.a),c=e.Math.min(c,a.b),t=e.Math.max(t,a.a),i=e.Math.max(i,a.b);this.a=new UV(r,c,t-r,i-c)}function TAn(n,t){var e,i,r,c;for(i=new Wb(n.b);i.a0&&cL(t,42)&&(n.a.qj(),c=null==(o=(s=BB(t,42)).cd())?0:nsn(o),a=eR(n.a,c),e=n.a.d[a]))for(i=BB(e.g,367),h=e.i,u=0;u=2)for(t=MD((i=c.Kc()).Pb());i.Ob();)a=t,t=MD(i.Pb()),r=e.Math.min(r,(kW(t),t-(kW(a),a)));return r}function HAn(n,t){var e,i,r,c,a;r5(i=new YT,t,i.c.b,i.c);do{for(Px(0!=i.b),e=BB(Atn(i,i.a.a),86),n.b[e.g]=1,c=spn(e.d,0);c.b!=c.d.c;)a=(r=BB(b3(c),188)).c,1==n.b[a.g]?DH(n.a,r):2==n.b[a.g]?n.b[a.g]=1:r5(i,a,i.c.b,i.c)}while(0!=i.b)}function qAn(n,t){var e,i,r;if(GI(t)===GI(yX(n)))return!0;if(!cL(t,15))return!1;if(i=BB(t,15),(r=n.gc())!=i.gc())return!1;if(cL(i,54)){for(e=0;e0&&(r=e),a=new Wb(n.f.e);a.a0?(t-=1,e-=1):i>=0&&r<0?(t+=1,e+=1):i>0&&r>=0?(t-=1,e+=1):(t+=1,e-=1),new rI(iln(t),iln(e))}function l$n(n,t){return n.ct.c?1:n.bt.b?1:n.a!=t.a?nsn(n.a)-nsn(t.a):n.d==(Q4(),Hmt)&&t.d==Bmt?-1:n.d==Bmt&&t.d==Hmt?1:0}function b$n(n,t){var e,i,r,c,a;return a=(c=t.a).c.i==t.b?c.d:c.c,i=c.c.i==t.b?c.c:c.d,(r=zwn(n.a,a,i))>0&&r0):r<0&&-r0)}function w$n(n,t,e,i){var r,c,a,u,o,s;for(r=(t-n.d)/n.c.c.length,c=0,n.a+=e,n.d=t,s=new Wb(n.c);s.a>24;return a}function g$n(n){if(n.pe()){var t=n.c;return t.qe()?n.o="["+t.n:t.pe()?n.o="["+t.ne():n.o="[L"+t.ne()+";",n.b=t.me()+"[]",void(n.k=t.oe()+"[]")}var e=n.j,i=n.d;i=i.split("/"),n.o=Fdn(".",[e,Fdn("$",i)]),n.b=Fdn(".",[e,Fdn(".",i)]),n.k=i[i.length-1]}function p$n(n,t){var e,i,r,c,a;for(a=null,c=new Wb(n.e.a);c.a=0;t-=2)for(e=0;e<=t;e+=2)(n.b[e]>n.b[e+2]||n.b[e]===n.b[e+2]&&n.b[e+1]>n.b[e+3])&&(i=n.b[e+2],n.b[e+2]=n.b[e],n.b[e]=i,i=n.b[e+3],n.b[e+3]=n.b[e+1],n.b[e+1]=i);n.c=!0}}function M$n(n,t){var e,i,r,c,a,u;for(c=(1==t?Wat:Xat).a.ec().Kc();c.Ob();)for(r=BB(c.Pb(),103),u=BB(h6(n.f.c,r),21).Kc();u.Ob();)switch(a=BB(u.Pb(),46),i=BB(a.b,81),e=BB(a.a,189).c,r.g){case 2:case 1:i.g.d+=e;break;case 4:case 3:i.g.c+=e}}function S$n(n,t){var e,i,r,c,a,u,o,s,h;for(s=-1,h=0,u=0,o=(a=n).length;u0&&++h;++s}return h}function P$n(n){var t;return(t=new lN(nE(n.gm))).a+="@",oO(t,(nsn(n)>>>0).toString(16)),n.kh()?(t.a+=" (eProxyURI: ",uO(t,n.qh()),n.$g()&&(t.a+=" eClass: ",uO(t,n.$g())),t.a+=")"):n.$g()&&(t.a+=" (eClass: ",uO(t,n.$g()),t.a+=")"),t.a}function C$n(n){var t,e,i;if(n.e)throw Hp(new Fy((ED(git),AYn+git.k+$Yn)));for(n.d==(Ffn(),BPt)&&Tzn(n,_Pt),e=new Wb(n.a.a);e.a>24}return e}function N$n(n,t,e){var i,r,c;if(!(r=BB(oV(n.i,t),306)))if(r=new wtn(n.d,t,e),mG(n.i,t,r),agn(t))EL(n.a,t.c,t.b,r);else switch(c=LPn(t),i=BB(oV(n.p,c),244),c.g){case 1:case 3:r.j=!0,jy(i,t.b,r);break;case 4:case 2:r.k=!0,jy(i,t.c,r)}return r}function x$n(n,t,e,i){var r,c,a,u,o,s;if(u=new go,o=axn(n.e.Tg(),t),r=BB(n.g,119),ZM(),BB(t,66).Oj())for(a=0;a=0)return r;for(c=1,a=new Wb(t.j);a.a0&&t.ue((l1(r-1,n.c.length),BB(n.c[r-1],10)),c)>0;)c5(n,r,(l1(r-1,n.c.length),BB(n.c[r-1],10))),--r;l1(r,n.c.length),n.c[r]=c}e.a=new xp,e.b=new xp}function K$n(n,t,e){var i,r,c,a,u,o,s;for(s=new YK(i=BB(t.e&&t.e(),9),BB(SR(i,i.length),9),0),a=0,u=(c=kKn(e,"[\\[\\]\\s,]+")).length;a0&&((!dA(n.a.c)||!t.n.d)&&(!gA(n.a.c)||!t.n.b)&&(t.g.d-=e.Math.max(0,r/2-.5)),(!dA(n.a.c)||!t.n.a)&&(!gA(n.a.c)||!t.n.c)&&(t.g.a+=e.Math.max(0,r-1)))}function F$n(n,t,e){var i;if(2==(n.c-n.b&n.a.length-1))t==(kUn(),sIt)||t==oIt?(jtn(BB(Eon(n),15),(Xyn(),jCt)),jtn(BB(Eon(n),15),ECt)):(jtn(BB(Eon(n),15),(Xyn(),ECt)),jtn(BB(Eon(n),15),jCt));else for(i=new bV(n);i.a!=i.b;)jtn(BB(_hn(i),15),e)}function B$n(n,t){var e,i,r,c,a,u;for(a=new M2(i=HB(new sp(n)),i.c.length),u=new M2(r=HB(new sp(t)),r.c.length),c=null;a.b>0&&u.b>0&&(Px(a.b>0),e=BB(a.a.Xb(a.c=--a.b),33),Px(u.b>0),e==BB(u.a.Xb(u.c=--u.b),33));)c=e;return c}function H$n(n,t){var i,r,c,a;return c=n.a*aYn+1502*n.b,a=n.b*aYn+11,c+=i=e.Math.floor(a*uYn),a-=i*oYn,c%=oYn,n.a=c,n.b=a,t<=24?e.Math.floor(n.a*Oet[t]):((r=n.a*(1<=2147483648&&(r-=XQn),r)}function q$n(n,t,e){var i,r,c,a;w0(n,t)>w0(n,e)?(i=abn(e,(kUn(),oIt)),n.d=i.dc()?0:uq(BB(i.Xb(0),11)),a=abn(t,CIt),n.b=a.dc()?0:uq(BB(a.Xb(0),11))):(r=abn(e,(kUn(),CIt)),n.d=r.dc()?0:uq(BB(r.Xb(0),11)),c=abn(t,oIt),n.b=c.dc()?0:uq(BB(c.Xb(0),11)))}function G$n(n){var t,e,i,r,c,a,u;if(n&&(t=n.Hh(V9n))&&null!=(a=SD(cdn((!t.b&&(t.b=new Jx((gWn(),k$t),X$t,t)),t.b),"conversionDelegates")))){for(u=new Np,r=0,c=(i=kKn(a,"\\w+")).length;rn.c));a++)r.a>=n.s&&(c<0&&(c=a),u=a);return o=(n.s+n.c)/2,c>=0&&(o=qM((l1(i=YRn(n,t,c,u),t.c.length),BB(t.c[i],329))),lOn(t,i,e)),o}function W$n(){W$n=O,lEt=new XA((sWn(),cSt),1.3),gEt=jSt,IEt=new WA(15),CEt=new XA(XSt,IEt),$Et=new XA(LPt,15),bEt=hSt,jEt=KSt,EEt=BSt,TEt=qSt,kEt=DSt,MEt=USt,OEt=fPt,$An(),PEt=oEt,yEt=aEt,SEt=uEt,AEt=hEt,pEt=cEt,vEt=CSt,mEt=ISt,dEt=rEt,wEt=iEt,LEt=fEt}function V$n(n,t,e){var i,r,c,a,u;for(Bin(r=new jo,(kW(t),t)),!r.b&&(r.b=new Jx((gWn(),k$t),X$t,r)),u=r.b,a=1;a0&&xqn(this,r)}function Y$n(n,t,e,i,r,c){var a,u,o;if(!r[t.b]){for(r[t.b]=!0,!(a=i)&&(a=new y6),WB(a.e,t),o=c[t.b].Kc();o.Ob();)(u=BB(o.Pb(),282)).d!=e&&u.c!=e&&(u.c!=t&&Y$n(n,u.c,t,a,r,c),u.d!=t&&Y$n(n,u.d,t,a,r,c),WB(a.c,u),gun(a.d,u.b));return a}return null}function J$n(n){var t,e,i;for(t=0,e=new Wb(n.e);e.a=2}function Z$n(n,t){var e,i,r,c;for(OTn(t,"Self-Loop pre-processing",1),i=new Wb(n.a);i.a1||Can(OJ(EG(ICt,Pun(Gk(GCt,1),$Vn,93,0,[CCt,ACt])),n))>1||Can(OJ(EG(DCt,Pun(Gk(GCt,1),$Vn,93,0,[xCt,NCt])),n))>1)}function eLn(n,t){var e,i,r;return(e=t.Hh(n.a))&&null!=(r=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),"affiliation")))?-1==(i=mN(r,YTn(35)))?uln(n,az(n,Utn(t.Hj())),r):0==i?uln(n,null,r.substr(1)):uln(n,r.substr(0,i),r.substr(i+1)):null}function iLn(n){var t,e;try{return null==n?zWn:Bbn(n)}catch(i){if(cL(i=lun(i),102))return t=i,e=nE(tsn(n))+"@"+($T(),(evn(n)>>>0).toString(16)),Kgn(jun(),(lM(),"Exception during lenientFormat for "+e),t),"<"+e+" threw "+nE(t.gm)+">";throw Hp(i)}}function rLn(n){switch(n.g){case 0:return new of;case 1:return new ef;case 2:return new $M;case 3:return new Ic;case 4:return new RR;case 5:return new sf;default:throw Hp(new _y("No implementation is available for the layerer "+(null!=n.f?n.f:""+n.g)))}}function cLn(n,t,e){var i,r,c;for(c=new Wb(n.t);c.a0&&(i.b.n-=i.c,i.b.n<=0&&i.b.u>0&&DH(t,i.b));for(r=new Wb(n.i);r.a0&&(i.a.u-=i.c,i.a.u<=0&&i.a.n>0&&DH(e,i.a))}function aLn(n){var t,e,i;if(null==n.g&&(n.d=n.si(n.f),f9(n,n.d),n.c))return n.f;if(i=(t=BB(n.g[n.i-1],47)).Pb(),n.e=t,(e=n.si(i)).Ob())n.d=e,f9(n,e);else for(n.d=null;!t.Ob()&&($X(n.g,--n.i,null),0!=n.i);)t=BB(n.g[n.i-1],47);return i}function uLn(n,t){var e,i,r,c,a,u;if(r=(i=t).ak(),$xn(n.e,r)){if(r.hi()&&G3(n,r,i.dd()))return!1}else for(u=axn(n.e.Tg(),r),e=BB(n.g,119),c=0;c1||e>1)return 2;return t+e==1?2:0}function vLn(n,t,e){var i,r,c,a;for(OTn(e,"ELK Force",1),qy(TD(ZAn(t,(fRn(),Wct))))||jJ(new Tw((GM(),new Dy(t)))),kkn(a=fon(t)),zon(n,BB(mMn(a,Gct),424)),r=(c=HFn(n.a,a)).Kc();r.Ob();)i=BB(r.Pb(),231),PKn(n.b,i,mcn(e,1/c.gc()));SUn(a=GUn(c)),HSn(e)}function mLn(n,t){var e,i,r;if(OTn(t,"Breaking Point Processor",1),Ozn(n),qy(TD(mMn(n,(HXn(),Gpt))))){for(i=new Wb(n.b);i.a=0?n._g(i,!0,!0):cOn(n,c,!0),153),BB(r,215).ml(t,e)}function MLn(n,t){var e,i,r,c,a;for(e=new Np,r=wnn(new Rq(null,new w1(n,16)),new Ea),c=wnn(new Rq(null,new w1(n,16)),new Ta),a=M7(H6(LV(SNn(Pun(Gk(eit,1),HWn,833,0,[r,c])),new Ma))),i=1;i=2*t&&WB(e,new kB(a[i-1]+t,a[i]-t));return e}function SLn(n,t,e){OTn(e,"Eades radial",1),e.n&&t&&y0(e,o2(t),(Bsn(),uOt)),n.d=BB(ZAn(t,(wD(),Vkt)),33),n.c=Gy(MD(ZAn(t,(Uyn(),Djt)))),n.e=Evn(BB(ZAn(t,Rjt),293)),n.a=lwn(BB(ZAn(t,_jt),426)),n.b=qjn(BB(ZAn(t,$jt),340)),rjn(n),e.n&&t&&y0(e,o2(t),(Bsn(),uOt))}function PLn(n,t,e){var i,r,c,a,u;if(e)for(c=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);c.Ob();)(r=x2(e,BB(c.Pb(),19).a))&&($in(a=$3(n,(tE(),u=new Em,!!t&&BLn(u,t),u),r),R2(r,q6n)),STn(r,a),OCn(r,a),xon(n,r,a))}function CLn(n){var t,e,i,r;if(!n.j){if(r=new Io,null==(t=P$t).a.zc(n,t)){for(i=new AL(kY(n));i.e!=i.i.gc();)pX(r,CLn(e=BB(kpn(i),26))),f9(r,e);t.a.Bc(n)}chn(r),n.j=new NO((BB(Wtn(QQ((QX(),t$t).o),11),18),r.i),r.g),P5(n).b&=-33}return n.j}function ILn(n){var t,e,i,r;if(null==n)return null;if(i=FBn(n,!0),r=x7n.length,mK(i.substr(i.length-r,r),x7n))if(4==(e=i.length)){if(b1(0,i.length),43==(t=i.charCodeAt(0)))return GLt;if(45==t)return qLt}else if(3==e)return GLt;return new Dv(i)}function OLn(n){var t,e,i;return 0!=((e=n.l)&e-1)||0!=((i=n.m)&i-1)||0!=((t=n.h)&t-1)||0==t&&0==i&&0==e?-1:0==t&&0==i&&0!=e?gin(e):0==t&&0!=i&&0==e?gin(i)+22:0!=t&&0==i&&0==e?gin(t)+44:-1}function ALn(n,t){var e,i,r,c;for(OTn(t,"Edge joining",1),e=qy(TD(mMn(n,(HXn(),Dpt)))),i=new Wb(n.b);i.a1)for(i=new Wb(n.a);i.a0),c.a.Xb(c.c=--c.b),yR(c,r),Px(c.b3&&Enn(n,0,t-3))}function KLn(n){var t,e,i,r;return GI(mMn(n,(HXn(),sgt)))===GI((ufn(),pCt))?!n.e&&GI(mMn(n,Rdt))!==GI((Kan(),kft)):(i=BB(mMn(n,Kdt),292),r=qy(TD(mMn(n,Hdt)))||GI(mMn(n,qdt))===GI((Oin(),sht)),t=BB(mMn(n,Ddt),19).a,e=n.a.c.length,!r&&i!=(Kan(),kft)&&(0==t||t>e))}function _Ln(n){var t,e;for(e=0;e0);e++);if(e>0&&e0);t++);return t>0&&e>16!=6&&t){if(vkn(n,t))throw Hp(new _y(w6n+ROn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?skn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,6,i)),(i=QD(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,6,t,t))}function BLn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=9&&t){if(vkn(n,t))throw Hp(new _y(w6n+URn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?fkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,9,i)),(i=YD(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,9,t,t))}function HLn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=3&&t){if(vkn(n,t))throw Hp(new _y(w6n+lHn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?Mkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,12,i)),(i=VD(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,t,t))}function qLn(n){var t,e,i,r,c;if(i=Ikn(n),null==(c=n.j)&&i)return n.$j()?null:i.zj();if(cL(i,148)){if((e=i.Aj())&&(r=e.Nh())!=n.i){if((t=BB(i,148)).Ej())try{n.g=r.Kh(t,c)}catch(a){if(!cL(a=lun(a),78))throw Hp(a);n.g=null}n.i=r}return n.g}return null}function GLn(n){var t;return WB(t=new Np,new xS(new xC(n.c,n.d),new xC(n.c+n.b,n.d))),WB(t,new xS(new xC(n.c,n.d),new xC(n.c,n.d+n.a))),WB(t,new xS(new xC(n.c+n.b,n.d+n.a),new xC(n.c+n.b,n.d))),WB(t,new xS(new xC(n.c+n.b,n.d+n.a),new xC(n.c,n.d+n.a))),t}function zLn(n,t,e,i){var r,c,a;if(a=Ajn(t,e),i.c[i.c.length]=t,-1==n.j[a.p]||2==n.j[a.p]||n.a[t.p])return i;for(n.j[a.p]=-1,c=new oz(ZL(hbn(a).a.Kc(),new h));dAn(c);)if(!b5(r=BB(U5(c),17))&&(b5(r)||r.c.i.c!=r.d.i.c)&&r!=t)return zLn(n,r,a,i);return i}function ULn(n,t,e){var i,r;for(r=t.a.ec().Kc();r.Ob();)i=BB(r.Pb(),79),!BB(RX(n.b,i),266)&&(JJ(PMn(i))==JJ(OMn(i))?tDn(n,i,e):PMn(i)==JJ(OMn(i))?null==RX(n.c,i)&&null!=RX(n.b,OMn(i))&&rzn(n,i,e,!1):null==RX(n.d,i)&&null!=RX(n.b,PMn(i))&&rzn(n,i,e,!0))}function XLn(n,t){var e,i,r,c,a,u,o;for(r=n.Kc();r.Ob();)for(i=BB(r.Pb(),10),CZ(u=new CSn,i),qCn(u,(kUn(),oIt)),hon(u,(hWn(),jlt),(hN(),!0)),a=t.Kc();a.Ob();)c=BB(a.Pb(),10),CZ(o=new CSn,c),qCn(o,CIt),hon(o,jlt,!0),hon(e=new wY,jlt,!0),SZ(e,u),MZ(e,o)}function WLn(n,t,e,i){var r,c,a,u;r=Adn(n,t,e),c=Adn(n,e,t),a=BB(RX(n.c,t),112),u=BB(RX(n.c,e),112),ri.b.g&&(c.c[c.c.length]=i);return c}function YLn(){YLn=O,DEt=new jC("CANDIDATE_POSITION_LAST_PLACED_RIGHT",0),xEt=new jC("CANDIDATE_POSITION_LAST_PLACED_BELOW",1),KEt=new jC("CANDIDATE_POSITION_WHOLE_DRAWING_RIGHT",2),REt=new jC("CANDIDATE_POSITION_WHOLE_DRAWING_BELOW",3),_Et=new jC("WHOLE_DRAWING",4)}function JLn(n,t){if(cL(t,239))return hln(n,BB(t,33));if(cL(t,186))return Dln(n,BB(t,118));if(cL(t,354))return tQ(n,BB(t,137));if(cL(t,352))return JFn(n,BB(t,79));if(t)return null;throw Hp(new _y(z6n+LMn(new Jy(Pun(Gk(Ant,1),HWn,1,5,[t])))))}function ZLn(n){var t,e,i,r,c,a,u;for(c=new YT,r=new Wb(n.d.a);r.a1)for(t=AN((e=new qv,++n.b,e),n.d),u=spn(c,0);u.b!=u.d.c;)a=BB(b3(u),121),UNn(aM(cM(uM(rM(new Hv,1),0),t),a))}function nNn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=11&&t){if(vkn(n,t))throw Hp(new _y(w6n+zRn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?Skn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,10,i)),(i=zR(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,11,t,t))}function tNn(n){var t,e,i,r;for(i=new usn(new Pb(n.b).a);i.b;)r=BB((e=ten(i)).cd(),11),hon(t=BB(e.dd(),10),(hWn(),dlt),r),hon(r,Elt,t),hon(r,elt,(hN(),!0)),qCn(r,BB(mMn(t,Qft),61)),mMn(t,Qft),hon(r.i,(HXn(),ept),(QEn(),VCt)),BB(mMn(vW(r.i),Zft),21).Fc((bDn(),dft))}function eNn(n,t,e){var i,r,c;if(i=0,r=0,n.c)for(c=new Wb(n.d.i.j);c.ac.a)return-1;if(r.a(o=null==n.d?0:n.d.length)){for(h=n.d,n.d=x8(oAt,c9n,63,2*o+4,0,1),c=0;c=0x8000000000000000?(X7(),btt):(i=!1,n<0&&(i=!0,n=-n),e=0,n>=OQn&&(n-=(e=CJ(n/OQn))*OQn),t=0,n>=IQn&&(n-=(t=CJ(n/IQn))*IQn),r=M$(CJ(n),t,e),i&&Oon(r),r)}function pNn(n,t){var e,i,r,c;for(e=!t||!n.u.Hc((lIn(),eIt)),c=0,r=new Wb(n.e.Cf());r.a=-t&&r==t?new rI(iln(i-1),iln(r)):new rI(iln(i),iln(r-1))}function ENn(){return lWn(),Pun(Gk(ust,1),$Vn,77,0,[rot,tot,cot,kot,Fot,Mot,Uot,Oot,Kot,got,Not,Iot,_ot,lot,Wot,Vut,Lot,Hot,jot,Bot,Qot,Dot,Qut,Rot,Yot,Got,Vot,Eot,sot,Tot,yot,Xot,Zut,uot,Pot,Jut,Cot,vot,bot,Aot,dot,eot,not,mot,wot,$ot,zot,Yut,xot,pot,Sot,hot,oot,qot,aot,fot,iot])}function TNn(n,t,e){n.d=0,n.b=0,t.k==(uSn(),Iut)&&e.k==Iut&&BB(mMn(t,(hWn(),dlt)),10)==BB(mMn(e,dlt),10)&&(S7(t).j==(kUn(),sIt)?q$n(n,t,e):q$n(n,e,t)),t.k==Iut&&e.k==Put?S7(t).j==(kUn(),sIt)?n.d=1:n.b=1:e.k==Iut&&t.k==Put&&(S7(e).j==(kUn(),sIt)?n.b=1:n.d=1),umn(n,t,e)}function MNn(n){var t,e,i,r,c;return c=ATn(n),null!=n.a&&AH(c,"category",n.a),!WE(new Cb(n.d))&&(rtn(c,"knownOptions",i=new Cl),t=new ep(i),e5(new Cb(n.d),t)),!WE(n.g)&&(rtn(c,"supportedFeatures",r=new Cl),e=new ip(r),e5(n.g,e)),c}function SNn(n){var t,e,i,r,c,a,u,o;for(t=336,e=0,r=new sR(n.length),u=0,o=(a=n).length;u>16!=7&&t){if(vkn(n,t))throw Hp(new _y(w6n+cPn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?hkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=BB(t,49).gh(n,1,DOt,i)),(i=VG(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,7,t,t))}function ONn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=3&&t){if(vkn(n,t))throw Hp(new _y(w6n+Vfn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?bkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=BB(t,49).gh(n,0,BOt,i)),(i=QG(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,t,t))}function ANn(n,t){var e,i,r,c,a,u,o,s,h;return $On(),t.d>n.d&&(u=n,n=t,t=u),t.d<63?Xxn(n,t):(s=z5(n,a=(-2&n.d)<<4),h=z5(t,a),i=uBn(n,G5(s,a)),r=uBn(t,G5(h,a)),o=ANn(s,h),e=ANn(i,r),c=G5(c=$Hn($Hn(c=ANn(uBn(s,i),uBn(r,h)),o),e),a),$Hn($Hn(o=G5(o,a<<1),c),e))}function $Nn(n,t,e){var i,r,c,a,u;for(a=Lfn(n,e),u=x8(Out,a1n,10,t.length,0,1),i=0,c=a.Kc();c.Ob();)qy(TD(mMn(r=BB(c.Pb(),11),(hWn(),elt))))&&(u[i++]=BB(mMn(r,Elt),10));if(i=0;r+=e?1:-1)c|=t.c.Sf(u,r,e,i&&!qy(TD(mMn(t.j,(hWn(),Jft))))&&!qy(TD(mMn(t.j,(hWn(),Ilt))))),c|=t.q._f(u,r,e),c|=gRn(n,u[r],e,i);return TU(n.c,t),c}function RNn(n,t,e){var i,r,c,a,u,o,s,h;for(s=0,h=(o=I2(n.j)).length;s1&&(n.a=!0),NG(BB(e.b,65),UR(B$(BB(t.b,65).c),kL(XR(B$(BB(e.b,65).a),BB(t.b,65).a),r))),QZ(n,t),FNn(n,e)}function BNn(n){var t,e,i,r,c,a;for(r=new Wb(n.a.a);r.a0&&c>0?t++:i>0?e++:c>0?r++:e++}SQ(),m$(n.j,new bi)}function qNn(n){var t,e;e=null,t=BB(xq(n.g,0),17);do{if(Lx(e=t.d.i,(hWn(),flt)))return BB(mMn(e,flt),11).i;if(e.k!=(uSn(),Cut)&&dAn(new oz(ZL(lbn(e).a.Kc(),new h))))t=BB(U5(new oz(ZL(lbn(e).a.Kc(),new h))),17);else if(e.k!=Cut)return null}while(e&&e.k!=(uSn(),Cut));return e}function GNn(n,t){var e,i,r,c,a,u,o,s,h;for(u=t.j,a=t.g,o=BB(xq(u,u.c.length-1),113),l1(0,u.c.length),s=Zmn(n,a,o,h=BB(u.c[0],113)),c=1;cs&&(o=e,h=r,s=i);t.a=h,t.c=o}function zNn(n,t){var e;if(!ZU(n.b,t.b))throw Hp(new Fy("Invalid hitboxes for scanline constraint calculation."));(kun(t.b,BB(MR(n.b,t.b),57))||kun(t.b,BB(TR(n.b,t.b),57)))&&($T(),t.b),n.a[t.b.f]=BB(kK(n.b,t.b),57),(e=BB(yK(n.b,t.b),57))&&(n.a[e.f]=t.b)}function UNn(n){if(!n.a.d||!n.a.e)throw Hp(new Fy((ED(Hit),Hit.k+" must have a source and target "+(ED(qit),qit.k+" specified."))));if(n.a.d==n.a.e)throw Hp(new Fy("Network simplex does not support self-loops: "+n.a+" "+n.a.d+" "+n.a.e));return RN(n.a.d.g,n.a),RN(n.a.e.b,n.a),n.a}function XNn(n,t,e){var i,r,c,a,u,o,s;for(s=new dE(new Jd(n)),u=0,o=(a=Pun(Gk(Gut,1),u1n,11,0,[t,e])).length;uo-n.b&&uo-n.a&&u0&&++l;++f}return l}function cxn(n,t){var e,i,r,c,a;for(a=BB(mMn(t,(CAn(),Lkt)),425),c=spn(t.b,0);c.b!=c.d.c;)if(r=BB(b3(c),86),0==n.b[r.g]){switch(a.g){case 0:Qvn(n,r);break;case 1:HAn(n,r)}n.b[r.g]=2}for(i=spn(n.a,0);i.b!=i.d.c;)ywn((e=BB(b3(i),188)).b.d,e,!0),ywn(e.c.b,e,!0);hon(t,(qqn(),lkt),n.a)}function axn(n,t){var e,i,r,c;return ZM(),t?t==(Uqn(),KLt)||(t==yLt||t==vLt||t==mLt)&&n!=pLt?new cUn(n,t):((e=(i=BB(t,677)).pk())||(kV(B7((IPn(),Z$t),t)),e=i.pk()),!e.i&&(e.i=new xp),!(r=BB(qI(AY((c=e.i).f,n)),1942))&&VW(c,n,r=new cUn(n,t)),r):aLt}function uxn(n,t){var e,i,r,c,a,u,o,s;for(u=BB(mMn(n,(hWn(),dlt)),11),o=Aon(Pun(Gk(PMt,1),sVn,8,0,[u.i.n,u.n,u.a])).a,s=n.i.n.b,r=0,c=(i=Z0(n.e)).length;r0?c.a?e>(u=c.b.rf().a)&&(r=(e-u)/2,c.d.b=r,c.d.c=r):c.d.c=n.s+e:Hz(n.u)&&((i=_Tn(c.b)).c<0&&(c.d.b=-i.c),i.c+i.b>c.b.rf().a&&(c.d.c=i.c+i.b-c.b.rf().a))}function fxn(n,t){var e,i;for(OTn(t,"Semi-Interactive Crossing Minimization Processor",1),e=!1,i=new Wb(n.b);i.a=0){if(t==i)return new rI(iln(-t-1),iln(-t-1));if(t==-i)return new rI(iln(-t),iln(i+1))}return e.Math.abs(t)>e.Math.abs(i)?new rI(iln(-t),iln(t<0?i:i+1)):new rI(iln(t+1),iln(i))}function wxn(n){var t,e;e=BB(mMn(n,(HXn(),kgt)),163),t=BB(mMn(n,(hWn(),ilt)),303),e==(Tbn(),Flt)?(hon(n,kgt,qlt),hon(n,ilt,(z7(),Cft))):e==Hlt?(hon(n,kgt,qlt),hon(n,ilt,(z7(),Sft))):t==(z7(),Cft)?(hon(n,kgt,Flt),hon(n,ilt,Pft)):t==Sft&&(hon(n,kgt,Hlt),hon(n,ilt,Pft))}function dxn(){dxn=O,jyt=new oa,vyt=dq(new B2,(yMn(),_at),(lWn(),jot)),kyt=WG(dq(new B2,_at,Dot),Bat,xot),Eyt=ogn(ogn(FM(WG(dq(new B2,Rat,Uot),Bat,zot),Fat),Got),Xot),myt=WG(dq(dq(dq(new B2,Kat,Mot),Fat,Pot),Fat,Cot),Bat,Sot),yyt=WG(dq(dq(new B2,Fat,Cot),Fat,uot),Bat,aot)}function gxn(){gxn=O,Cyt=dq(WG(new B2,(yMn(),Bat),(lWn(),hot)),_at,jot),$yt=ogn(ogn(FM(WG(dq(new B2,Rat,Uot),Bat,zot),Fat),Got),Xot),Iyt=WG(dq(dq(dq(new B2,Kat,Mot),Fat,Pot),Fat,Cot),Bat,Sot),Ayt=dq(dq(new B2,_at,Dot),Bat,xot),Oyt=WG(dq(dq(new B2,Fat,Cot),Fat,uot),Bat,aot)}function pxn(n,t,e,i,r){var c,a;(b5(t)||t.c.i.c!=t.d.i.c)&&nrn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])),e)||b5(t)||(t.c==r?Kx(t.a,0,new wA(e)):DH(t.a,new wA(e)),i&&!FT(n.a,e)&&((a=BB(mMn(t,(HXn(),vgt)),74))||(a=new km,hon(t,vgt,a)),r5(a,c=new wA(e),a.c.b,a.c),TU(n.a,c)))}function vxn(n){var t;for(t=new oz(ZL(fbn(n).a.Kc(),new h));dAn(t);)if(BB(U5(t),17).c.i.k!=(uSn(),Sut))throw Hp(new rk(P1n+gyn(n)+"' has its layer constraint set to FIRST, but has at least one incoming edge that does not come from a FIRST_SEPARATE node. That must not happen."))}function mxn(n,t,e){var i,r,c,a,u,o;if(0==(r=pbn(254&n.Db)))n.Eb=e;else{if(1==r)a=x8(Ant,HWn,1,2,5,1),0==Rmn(n,t)?(a[0]=e,a[1]=n.Eb):(a[0]=n.Eb,a[1]=e);else for(a=x8(Ant,HWn,1,r+1,5,1),c=een(n.Eb),i=2,u=0,o=0;i<=128;i<<=1)i==t?a[o++]=e:0!=(n.Db&i)&&(a[o++]=c[u++]);n.Eb=a}n.Db|=t}function yxn(n,t,i){var r,c,a,u;for(this.b=new Np,c=0,r=0,u=new Wb(n);u.a0&&(c+=(a=BB(xq(this.b,0),167)).o,r+=a.p),c*=2,r*=2,t>1?c=CJ(e.Math.ceil(c*t)):r=CJ(e.Math.ceil(r/t)),this.a=new qwn(c,r)}function kxn(n,t,i,r,c,a){var u,o,s,h,f,l,b,w,d,g;for(h=r,t.j&&t.o?(d=(b=BB(RX(n.f,t.A),57)).d.c+b.d.b,--h):d=t.a.c+t.a.b,f=c,i.q&&i.o?(s=(b=BB(RX(n.f,i.C),57)).d.c,++f):s=i.a.c,w=d+(o=(s-d)/e.Math.max(2,f-h)),l=h;l=0;a+=r?1:-1){for(u=t[a],o=i==(kUn(),oIt)?r?abn(u,i):ean(abn(u,i)):r?ean(abn(u,i)):abn(u,i),c&&(n.c[u.p]=o.gc()),f=o.Kc();f.Ob();)h=BB(f.Pb(),11),n.d[h.p]=s++;gun(e,o)}}function Exn(n,t,e){var i,r,c,a,u,o,s,h;for(c=Gy(MD(n.b.Kc().Pb())),s=Gy(MD(Wan(t.b))),i=kL(B$(n.a),s-e),r=kL(B$(t.a),e-c),kL(h=UR(i,r),1/(s-c)),this.a=h,this.b=new Np,u=!0,(a=n.b.Kc()).Pb();a.Ob();)o=Gy(MD(a.Pb())),u&&o-e>D3n&&(this.b.Fc(e),u=!1),this.b.Fc(o);u&&this.b.Fc(e)}function Txn(n){var t,e,i,r;if(hKn(n,n.n),n.d.c.length>0){for(nk(n.c);pAn(n,BB(n0(new Wb(n.e.a)),121))>5,t&=31,i>=n.d)return n.e<0?(ODn(),Ytt):(ODn(),eet);if(c=n.d-i,QSn(r=x8(ANt,hQn,25,c+1,15,1),c,n.a,i,t),n.e<0){for(e=0;e0&&n.a[e]<<32-t!=0){for(e=0;e=0)&&(!(e=Fqn((IPn(),Z$t),r,t))||((i=e.Zj())>1||-1==i)&&3!=DW(B7(Z$t,e))))}function Lxn(n,t,e,i){var r,c,a,u,o;return u=PTn(BB(Wtn((!t.b&&(t.b=new hK(KOt,t,4,7)),t.b),0),82)),o=PTn(BB(Wtn((!t.c&&(t.c=new hK(KOt,t,5,8)),t.c),0),82)),JJ(u)==JJ(o)||Ctn(o,u)?null:(a=XJ(t))==e?i:(c=BB(RX(n.a,a),10))&&(r=c.e)?r:null}function Nxn(n,t){var e;switch(OTn(t,"Label side selection ("+(e=BB(mMn(n,(HXn(),Jdt)),276))+")",1),e.g){case 0:TAn(n,(Xyn(),jCt));break;case 1:TAn(n,(Xyn(),ECt));break;case 2:sBn(n,(Xyn(),jCt));break;case 3:sBn(n,(Xyn(),ECt));break;case 4:uDn(n,(Xyn(),jCt));break;case 5:uDn(n,(Xyn(),ECt))}HSn(t)}function xxn(n,t,e){var i,r,c,a,u;if((c=n[lj(e,n.length)])[0].k==(uSn(),Mut))for(r=fj(e,c.length),u=t.j,i=0;i0&&(i[0]+=n.d,u-=i[0]),i[2]>0&&(i[2]+=n.d,u-=i[2]),a=e.Math.max(0,u),i[1]=e.Math.max(i[1],u),Y5(n,zit,c.c+r.b+i[0]-(i[1]-u)/2,i),t==zit&&(n.c.b=a,n.c.c=c.c+r.b+(a-u)/2)}function Qxn(){this.c=x8(xNt,qQn,25,(kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length,15,1),this.b=x8(xNt,qQn,25,Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt]).length,15,1),this.a=x8(xNt,qQn,25,Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt]).length,15,1),mS(this.c,RQn),mS(this.b,KQn),mS(this.a,KQn)}function Yxn(n,t,e){var i,r,c,a;if(t<=e?(r=t,c=e):(r=e,c=t),i=0,null==n.b)n.b=x8(ANt,hQn,25,2,15,1),n.b[0]=r,n.b[1]=c,n.c=!0;else{if(i=n.b.length,n.b[i-1]+1==r)return void(n.b[i-1]=c);a=x8(ANt,hQn,25,i+2,15,1),aHn(n.b,0,a,0,i),n.b=a,n.b[i-1]>=r&&(n.c=!1,n.a=!1),n.b[i++]=r,n.b[i]=c,n.c||T$n(n)}}function Jxn(n,t,e){var i,r,c,a,u,o,s;for(s=t.d,n.a=new J6(s.c.length),n.c=new xp,u=new Wb(s);u.a=0?n._g(s,!1,!0):cOn(n,e,!1),58).Kc();c.Ob();){for(r=BB(c.Pb(),56),h=0;h1;)fDn(r,r.i-1);return i}function aDn(n,t){var e,i,r,c,a,u,o;for(OTn(t,"Comment post-processing",1),c=new Wb(n.b);c.an.d[a.p]&&(e+=n5(n.b,c),d3(n.a,iln(c)));for(;!Wy(n.a);)Mnn(n.b,BB(dU(n.a),19).a)}return e}function hDn(n,t,e){var i,r,c,a;for(c=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i,r=new AL((!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));r.e!=r.i.gc();)0==(!(i=BB(kpn(r),33)).a&&(i.a=new eU(UOt,i,10,11)),i.a).i||(c+=hDn(n,i,!1));if(e)for(a=JJ(t);a;)c+=(!a.a&&(a.a=new eU(UOt,a,10,11)),a.a).i,a=JJ(a);return c}function fDn(n,t){var e,i,r,c;return n.ej()?(i=null,r=n.fj(),n.ij()&&(i=n.kj(n.pi(t),null)),e=n.Zi(4,c=Lyn(n,t),null,t,r),n.bj()&&null!=c?(i=n.dj(c,i))?(i.Ei(e),i.Fi()):n.$i(e):i?(i.Ei(e),i.Fi()):n.$i(e),c):(c=Lyn(n,t),n.bj()&&null!=c&&(i=n.dj(c,null))&&i.Fi(),c)}function lDn(n){var t,i,r,c,a,u,o,s,h,f;for(h=n.a,t=new Rv,s=0,r=new Wb(n.d);r.ao.d&&(f=o.d+o.a+h));i.c.d=f,t.a.zc(i,t),s=e.Math.max(s,i.c.d+i.c.a)}return s}function bDn(){bDn=O,hft=new LP("COMMENTS",0),lft=new LP("EXTERNAL_PORTS",1),bft=new LP("HYPEREDGES",2),wft=new LP("HYPERNODES",3),dft=new LP("NON_FREE_PORTS",4),gft=new LP("NORTH_SOUTH_PORTS",5),vft=new LP(G1n,6),sft=new LP("CENTER_LABELS",7),fft=new LP("END_LABELS",8),pft=new LP("PARTITIONS",9)}function wDn(n){var t,e,i,r,c;for(r=new Np,t=new $q((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a)),i=new oz(ZL(dLn(n).a.Kc(),new h));dAn(i);)cL(Wtn((!(e=BB(U5(i),79)).b&&(e.b=new hK(KOt,e,4,7)),e.b),0),186)||(c=PTn(BB(Wtn((!e.c&&(e.c=new hK(KOt,e,5,8)),e.c),0),82)),t.a._b(c)||(r.c[r.c.length]=c));return r}function dDn(n){var t,e,i,r,c;for(r=new Rv,t=new $q((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a)),i=new oz(ZL(dLn(n).a.Kc(),new h));dAn(i);)cL(Wtn((!(e=BB(U5(i),79)).b&&(e.b=new hK(KOt,e,4,7)),e.b),0),186)||(c=PTn(BB(Wtn((!e.c&&(e.c=new hK(KOt,e,5,8)),e.c),0),82)),t.a._b(c)||r.a.zc(c,r));return r}function gDn(n,t,e,i,r){return i<0?((i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,[YVn,JVn,ZVn,nQn,tQn,eQn,iQn,rQn,cQn,aQn,uQn,oQn]),t))<0&&(i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),t)),!(i<0||(e.k=i,0))):i>0&&(e.k=i-1,!0)}function pDn(n,t,e,i,r){return i<0?((i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,[YVn,JVn,ZVn,nQn,tQn,eQn,iQn,rQn,cQn,aQn,uQn,oQn]),t))<0&&(i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),t)),!(i<0||(e.k=i,0))):i>0&&(e.k=i-1,!0)}function vDn(n,t,e,i,r,c){var a,u,o;if(u=32,i<0){if(t[0]>=n.length)return!1;if(43!=(u=fV(n,t[0]))&&45!=u)return!1;if(++t[0],(i=UIn(n,t))<0)return!1;45==u&&(i=-i)}return 32==u&&t[0]-e==2&&2==r.b&&(a=(o=(new AT).q.getFullYear()-sQn+sQn-80)%100,c.a=i==a,i+=100*(o/100|0)+(i=h&&(s=r);s&&(f=e.Math.max(f,s.a.o.a)),f>b&&(l=h,b=f)}return l}function MDn(n,t,e){var i,r,c;if(n.e=e,n.d=0,n.b=0,n.f=1,n.i=t,16==(16&n.e)&&(n.i=pKn(n.i)),n.j=n.i.length,QXn(n),c=Vdn(n),n.d!=n.j)throw Hp(new ak(kWn((u$(),w8n))));if(n.g){for(i=0;ip4n?m$(s,n.b):r<=p4n&&r>v4n?m$(s,n.d):r<=v4n&&r>m4n?m$(s,n.c):r<=m4n&&m$(s,n.a),a=IDn(n,s,a);return c}function ODn(){var n;for(ODn=O,Jtt=new X6(1,1),net=new X6(1,10),eet=new X6(0,0),Ytt=new X6(-1,1),Ztt=Pun(Gk(oet,1),sVn,91,0,[eet,Jtt,new X6(1,2),new X6(1,3),new X6(1,4),new X6(1,5),new X6(1,6),new X6(1,7),new X6(1,8),new X6(1,9),net]),tet=x8(oet,sVn,91,32,0,1),n=0;n1&&(i=new xC(r,e.b),DH(t.a,i)),nin(t.a,Pun(Gk(PMt,1),sVn,8,0,[f,h]))}function RDn(n){NM(n,new MTn(vj(wj(pj(gj(new du,_5n),"ELK Randomizer"),'Distributes the nodes randomly on the plane, leading to very obfuscating layouts. Can be useful to demonstrate the power of "real" layout algorithms.'),new Qu))),u2(n,_5n,QJn,LIt),u2(n,_5n,vZn,15),u2(n,_5n,yZn,iln(0)),u2(n,_5n,VJn,dZn)}function KDn(){var n,t,e,i,r,c;for(KDn=O,QLt=x8(NNt,v6n,25,255,15,1),YLt=x8(ONt,WVn,25,16,15,1),t=0;t<255;t++)QLt[t]=-1;for(e=57;e>=48;e--)QLt[e]=e-48<<24>>24;for(i=70;i>=65;i--)QLt[i]=i-65+10<<24>>24;for(r=102;r>=97;r--)QLt[r]=r-97+10<<24>>24;for(c=0;c<10;c++)YLt[c]=48+c&QVn;for(n=10;n<=15;n++)YLt[n]=65+n-10&QVn}function _Dn(n,t,e){var i,r,c,a,u,o,s,h;return u=t.i-n.g/2,o=e.i-n.g/2,s=t.j-n.g/2,h=e.j-n.g/2,c=t.g+n.g/2,a=e.g+n.g/2,i=t.f+n.g/2,r=e.f+n.g/2,u>19!=0)return"-"+GDn(aon(n));for(e=n,i="";0!=e.l||0!=e.m||0!=e.h;){if(e=Aqn(e,F5(AQn),!0),t=""+TE(ltt),0!=e.l||0!=e.m||0!=e.h)for(r=9-t.length;r>0;r--)t="0"+t;i=t+i}return i}function zDn(){if(!Object.create||!Object.getOwnPropertyNames)return!1;var n="__proto__",t=Object.create(null);return void 0===t[n]&&0==Object.getOwnPropertyNames(t).length&&(t[n]=42,42===t[n]&&0!=Object.getOwnPropertyNames(t).length)}function UDn(n){var t,e,i,r,c,a,u;for(t=!1,e=0,r=new Wb(n.d.b);r.a=n.a)return-1;if(!eTn(t,i))return-1;if(h3(BB(r.Kb(t),20)))return 1;for(c=0,u=BB(r.Kb(t),20).Kc();u.Ob();){if(-1==(o=VDn(n,(a=BB(u.Pb(),17)).c.i==t?a.d.i:a.c.i,i,r)))return-1;if((c=e.Math.max(c,o))>n.c-1)return-1}return c+1}function QDn(n,t){var e,i,r,c,a,u;if(GI(t)===GI(n))return!0;if(!cL(t,15))return!1;if(i=BB(t,15),u=n.gc(),i.gc()!=u)return!1;if(a=i.Kc(),n.ni()){for(e=0;e0)if(n.qj(),null!=t){for(c=0;c>24;case 97:case 98:case 99:case 100:case 101:case 102:return n-97+10<<24>>24;case 65:case 66:case 67:case 68:case 69:case 70:return n-65+10<<24>>24;default:throw Hp(new Mk("Invalid hexadecimal"))}}function nRn(n,t,e){var i,r,c,a;for(OTn(e,"Processor order nodes",2),n.a=Gy(MD(mMn(t,(CAn(),xkt)))),r=new YT,a=spn(t.b,0);a.b!=a.d.c;)qy(TD(mMn(c=BB(b3(a),86),(qqn(),dkt))))&&r5(r,c,r.c.b,r.c);Px(0!=r.b),KHn(n,i=BB(r.a.a.c,86)),!e.b&&qin(e,1),BRn(n,i,0-Gy(MD(mMn(i,(qqn(),ukt))))/2,0),!e.b&&qin(e,1),HSn(e)}function tRn(){tRn=O,Rit=new HS("SPIRAL",0),$it=new HS("LINE_BY_LINE",1),Lit=new HS("MANHATTAN",2),Ait=new HS("JITTER",3),xit=new HS("QUADRANTS_LINE_BY_LINE",4),Dit=new HS("QUADRANTS_MANHATTAN",5),Nit=new HS("QUADRANTS_JITTER",6),Oit=new HS("COMBINE_LINE_BY_LINE_MANHATTAN",7),Iit=new HS("COMBINE_JITTER_MANHATTAN",8)}function eRn(n,t,e,i){var r,c,a,u,o,s;for(o=Njn(n,e),s=Njn(t,e),r=!1;o&&s&&(i||myn(o,s,e));)a=Njn(o,e),u=Njn(s,e),A7(t),A7(n),c=o.c,rGn(o,!1),rGn(s,!1),e?(Qyn(t,s.p,c),t.p=s.p,Qyn(n,o.p+1,c),n.p=o.p):(Qyn(n,o.p,c),n.p=o.p,Qyn(t,s.p+1,c),t.p=s.p),PZ(o,null),PZ(s,null),o=a,s=u,r=!0;return r}function iRn(n,t,e,i){var r,c,a,u,o;for(r=!1,c=!1,u=new Wb(i.j);u.a=t.length)throw Hp(new Ay("Greedy SwitchDecider: Free layer not in graph."));this.c=t[n],this.e=new QK(i),yrn(this.e,this.c,(kUn(),CIt)),this.i=new QK(i),yrn(this.i,this.c,oIt),this.f=new lG(this.c),this.a=!c&&r.i&&!r.s&&this.c[0].k==(uSn(),Mut),this.a&&gPn(this,n,t.length)}function oRn(n,t){var e,i,r,c,a,u;c=!n.B.Hc((n_n(),HIt)),a=n.B.Hc(zIt),n.a=new Hwn(a,c,n.c),n.n&&kQ(n.a.n,n.n),jy(n.g,(Dtn(),zit),n.a),t||((i=new Ign(1,c,n.c)).n.a=n.k,mG(n.p,(kUn(),sIt),i),(r=new Ign(1,c,n.c)).n.d=n.k,mG(n.p,SIt,r),(u=new Ign(0,c,n.c)).n.c=n.k,mG(n.p,CIt,u),(e=new Ign(0,c,n.c)).n.b=n.k,mG(n.p,oIt,e))}function sRn(n){var t,e,i;switch((t=BB(mMn(n.d,(HXn(),Zdt)),218)).g){case 2:e=MXn(n);break;case 3:i=new Np,JT(AV($V(wnn(wnn(new Rq(null,new w1(n.d.b,16)),new Or),new Ar),new $r),new pr),new Cd(i)),e=i;break;default:throw Hp(new Fy("Compaction not supported for "+t+" edges."))}gqn(n,e),e5(new Cb(n.g),new Sd(n))}function hRn(n,t){var e;return e=new Zn,t&&qan(e,BB(RX(n.a,DOt),94)),cL(t,470)&&qan(e,BB(RX(n.a,ROt),94)),cL(t,354)?(qan(e,BB(RX(n.a,zOt),94)),e):(cL(t,82)&&qan(e,BB(RX(n.a,KOt),94)),cL(t,239)?(qan(e,BB(RX(n.a,UOt),94)),e):cL(t,186)?(qan(e,BB(RX(n.a,XOt),94)),e):(cL(t,352)&&qan(e,BB(RX(n.a,_Ot),94)),e))}function fRn(){fRn=O,Zct=new XA((sWn(),pPt),iln(1)),cat=new XA(LPt,80),rat=new XA(SPt,5),Fct=new XA(cSt,dZn),nat=new XA(vPt,iln(1)),iat=new XA(kPt,(hN(),!0)),Qct=new WA(50),Vct=new XA(XSt,Qct),Hct=CSt,Yct=uPt,Bct=new XA(dSt,!1),Wct=USt,Xct=qSt,Uct=KSt,zct=DSt,Jct=fPt,jSn(),Gct=Ict,aat=Nct,qct=Cct,tat=Act,eat=Lct}function lRn(n){var t,e,i,r,c,a,u;for(u=new v5,a=new Wb(n.a);a.a0&&t=0)return!1;if(t.p=e.b,WB(e.e,t),i==(uSn(),Put)||i==Iut)for(r=new Wb(t.j);r.a1||-1==a)&&(c|=16),0!=(r.Bb&h6n)&&(c|=64)),0!=(e.Bb&BQn)&&(c|=M9n),c|=k6n):cL(t,457)?c|=512:(i=t.Bj())&&0!=(1&i.i)&&(c|=256),0!=(512&n.Bb)&&(c|=128),c}function $Rn(n,t){var e,i,r,c,a;for(n=null==n?zWn:(kW(n),n),r=0;rn.d[u.p]&&(e+=n5(n.b,c),d3(n.a,iln(c))):++a;for(e+=n.b.d*a;!Wy(n.a);)Mnn(n.b,BB(dU(n.a),19).a)}return e}function xRn(n,t){var e;return n.f==uLt?(e=DW(B7((IPn(),Z$t),t)),n.e?4==e&&t!=(TOn(),lLt)&&t!=(TOn(),sLt)&&t!=(TOn(),hLt)&&t!=(TOn(),fLt):2==e):!(!n.d||!(n.d.Hc(t)||n.d.Hc(Z1(B7((IPn(),Z$t),t)))||n.d.Hc(Fqn((IPn(),Z$t),n.b,t))))||!(!n.f||!aNn((IPn(),n.f),jV(B7(Z$t,t))))&&(e=DW(B7(Z$t,t)),n.e?4==e:2==e)}function DRn(n,t,i,r){var c,a,u,o,s,h,f,l;return s=(u=BB(ZAn(i,(sWn(),gPt)),8)).a,f=u.b+n,(c=e.Math.atan2(f,s))<0&&(c+=Z3n),(c+=t)>Z3n&&(c-=Z3n),h=(o=BB(ZAn(r,gPt),8)).a,l=o.b+n,(a=e.Math.atan2(l,h))<0&&(a+=Z3n),(a+=t)>Z3n&&(a-=Z3n),h$(),rin(1e-10),e.Math.abs(c-a)<=1e-10||c==a||isNaN(c)&&isNaN(a)?0:ca?1:zO(isNaN(c),isNaN(a))}function RRn(n){var t,e,i,r,c,a,u;for(u=new xp,i=new Wb(n.a.b);i.a=n.o)throw Hp(new Sv);a=t>>5,c=yz(1,dG(yz(31&t,1))),n.n[e][a]=r?i0(n.n[e][a],c):e0(n.n[e][a],uH(c)),c=yz(c,1),n.n[e][a]=i?i0(n.n[e][a],c):e0(n.n[e][a],uH(c))}catch(u){throw cL(u=lun(u),320)?Hp(new Ay(MJn+n.o+"*"+n.p+SJn+t+FWn+e+PJn)):Hp(u)}}function BRn(n,t,i,r){var c,a;t&&(c=Gy(MD(mMn(t,(qqn(),fkt))))+r,a=i+Gy(MD(mMn(t,ukt)))/2,hon(t,gkt,iln(dG(fan(e.Math.round(c))))),hon(t,pkt,iln(dG(fan(e.Math.round(a))))),0==t.d.b||BRn(n,BB(iL(new wg(spn(new bg(t).a.d,0))),86),i+Gy(MD(mMn(t,ukt)))+n.a,r+Gy(MD(mMn(t,okt)))),null!=mMn(t,wkt)&&BRn(n,BB(mMn(t,wkt),86),i,r))}function HRn(n,t){var i,r,c,a,u,o,s,h,f,l,b;for(c=2*Gy(MD(mMn(s=vW(t.a),(HXn(),Tpt)))),f=Gy(MD(mMn(s,Apt))),h=e.Math.max(c,f),a=x8(xNt,qQn,25,t.f-t.c+1,15,1),r=-h,i=0,o=t.b.Kc();o.Ob();)u=BB(o.Pb(),10),r+=n.a[u.c.p]+h,a[i++]=r;for(r+=n.a[t.a.c.p]+h,a[i++]=r,b=new Wb(t.e);b.a0&&(!(i=(!n.n&&(n.n=new eU(zOt,n,1,7)),BB(Wtn(n.n,0),137)).a)||oO(oO((t.a+=' "',t),i),'"'))),oO(kE(oO(kE(oO(kE(oO(kE((t.a+=" (",t),n.i),","),n.j)," | "),n.g),","),n.f),")"),t.a)}function URn(n){var t,e,i;return 0!=(64&n.Db)?mSn(n):(t=new lN(t6n),(e=n.k)?oO(oO((t.a+=' "',t),e),'"'):(!n.n&&(n.n=new eU(zOt,n,1,7)),n.n.i>0&&(!(i=(!n.n&&(n.n=new eU(zOt,n,1,7)),BB(Wtn(n.n,0),137)).a)||oO(oO((t.a+=' "',t),i),'"'))),oO(kE(oO(kE(oO(kE(oO(kE((t.a+=" (",t),n.i),","),n.j)," | "),n.g),","),n.f),")"),t.a)}function XRn(n,t){var e,i,r,c,a,u;if(null==t||0==t.length)return null;if(!(r=BB(SJ(n.a,t),149))){for(i=new Kb(new Ob(n.b).a.vc().Kc());i.a.Ob();)if(c=BB(i.a.Pb(),42),a=(e=BB(c.dd(),149)).c,u=t.length,mK(a.substr(a.length-u,u),t)&&(t.length==a.length||46==fV(a,a.length-t.length-1))){if(r)return null;r=e}r&&mZ(n.a,t,r)}return r}function WRn(n,t){var e,i,r;return e=new xn,(i=BB(P4($V(new Rq(null,new w1(n.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Xet),Uet]))),21).gc())<(r=BB(P4($V(new Rq(null,new w1(t.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[Xet,Uet]))),21).gc())?-1:i==r?0:1}function VRn(n){var t,e,i;Lx(n,(HXn(),$gt))&&((i=BB(mMn(n,$gt),21)).dc()||(e=new YK(t=BB(Vj(GCt),9),BB(SR(t,t.length),9),0),i.Hc((n$n(),$Ct))?orn(e,$Ct):orn(e,LCt),i.Hc(OCt)||orn(e,OCt),i.Hc(ICt)?orn(e,DCt):i.Hc(CCt)?orn(e,xCt):i.Hc(ACt)&&orn(e,NCt),i.Hc(DCt)?orn(e,ICt):i.Hc(xCt)?orn(e,CCt):i.Hc(NCt)&&orn(e,ACt),hon(n,$gt,e)))}function QRn(n){var t,e,i,r,c,a,u;for(r=BB(mMn(n,(hWn(),rlt)),10),l1(0,(i=n.j).c.length),e=BB(i.c[0],11),a=new Wb(r.j);a.ar.p?(qCn(c,SIt),c.d&&(u=c.o.b,t=c.a.b,c.a.b=u-t)):c.j==SIt&&r.p>n.p&&(qCn(c,sIt),c.d&&(u=c.o.b,t=c.a.b,c.a.b=-(u-t)));break}return r}function YRn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w;if(c=e,e1&&(i=new xC(r,e.b),DH(t.a,i)),nin(t.a,Pun(Gk(PMt,1),sVn,8,0,[f,h]))}function gKn(n,t,e){var i,r,c,a,u,o;if(t){if(e<=-1){if(cL(i=itn(t.Tg(),-1-e),99))return BB(i,18);for(u=0,o=(a=BB(t.ah(i),153)).gc();u0){for(r=o.length;r>0&&""==o[r-1];)--r;r=40)&&EFn(n),BHn(n),Txn(n),e=yln(n),i=0;e&&i0&&DH(n.f,c)):(n.c[a]-=s+1,n.c[a]<=0&&n.a[a]>0&&DH(n.e,c))))}function YKn(n){var t,e,i,r,c,a,u;for(c=new dE(BB(yX(new Rn),62)),u=KQn,e=new Wb(n.d);e.a=0&&oe?t:e;s<=f;++s)s==e?u=i++:(c=r[s],h=w.rl(c.ak()),s==t&&(o=s!=f||h?i:i-1),h&&++i);return l=BB(Iln(n,t,e),72),u!=o&&Lv(n,new j9(n.e,7,a,iln(u),b.dd(),o)),l}return BB(Iln(n,t,e),72)}function u_n(n,t){var e,i,r,c,a,u;for(OTn(t,"Port order processing",1),u=BB(mMn(n,(HXn(),opt)),421),e=new Wb(n.b);e.a=0&&(!Cyn(n,a)||(o<22?u.l|=1<>>1,a.m=s>>>1|(1&h)<<21,a.l=f>>>1|(1&s)<<21,--o;return e&&Oon(u),c&&(i?(ltt=aon(n),r&&(ltt=hun(ltt,(X7(),dtt)))):ltt=M$(n.l,n.m,n.h)),u}function f_n(n,t){var e,i,r,c,a,u,o,s,h,f;for(s=n.e[t.c.p][t.p]+1,o=t.c.a.c.length+1,u=new Wb(n.a);u.a0&&(b1(0,n.length),45==n.charCodeAt(0)||(b1(0,n.length),43==n.charCodeAt(0)))?1:0;ie)throw Hp(new Mk(DQn+n+'"'));return a}function b_n(n){var t,i,r,c,a,u;for(a=new YT,c=new Wb(n.a);c.a1)&&1==t&&BB(n.a[n.b],10).k==(uSn(),Sut)?hFn(BB(n.a[n.b],10),(Xyn(),jCt)):i&&(!e||(n.c-n.b&n.a.length-1)>1)&&1==t&&BB(n.a[n.c-1&n.a.length-1],10).k==(uSn(),Sut)?hFn(BB(n.a[n.c-1&n.a.length-1],10),(Xyn(),ECt)):2==(n.c-n.b&n.a.length-1)?(hFn(BB(Eon(n),10),(Xyn(),jCt)),hFn(BB(Eon(n),10),ECt)):sLn(n,r),o4(n)}function v_n(n,t,i){var r,c,a,u,o;for(a=0,c=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));c.e!=c.i.gc();)u="",0==(!(r=BB(kpn(c),33)).n&&(r.n=new eU(zOt,r,1,7)),r.n).i||(u=BB(Wtn((!r.n&&(r.n=new eU(zOt,r,1,7)),r.n),0),137).a),qan(o=new csn(a++,t,u),r),hon(o,(qqn(),skt),r),o.e.b=r.j+r.f/2,o.f.a=e.Math.max(r.g,1),o.e.a=r.i+r.g/2,o.f.b=e.Math.max(r.f,1),DH(t.b,o),jCn(i.f,r,o)}function m_n(n){var t,e,i,r,c;i=BB(mMn(n,(hWn(),dlt)),33),c=BB(ZAn(i,(HXn(),Fgt)),174).Hc((mdn(),_It)),n.e||(r=BB(mMn(n,Zft),21),t=new xC(n.f.a+n.d.b+n.d.c,n.f.b+n.d.d+n.d.a),r.Hc((bDn(),lft))?(Ypn(i,ept,(QEn(),XCt)),KUn(i,t.a,t.b,!1,!0)):qy(TD(ZAn(i,Bgt)))||KUn(i,t.a,t.b,!0,!0)),Ypn(i,Fgt,c?nbn(_It):new YK(e=BB(Vj(YIt),9),BB(SR(e,e.length),9),0))}function y_n(n,t,e){var i,r,c,a;if(t[0]>=n.length)return e.o=0,!0;switch(fV(n,t[0])){case 43:r=1;break;case 45:r=-1;break;default:return e.o=0,!0}if(++t[0],c=t[0],0==(a=UIn(n,t))&&t[0]==c)return!1;if(t[0]=0&&u!=e&&(c=new nU(n,1,u,a,null),i?i.Ei(c):i=c),e>=0&&(c=new nU(n,1,e,u==e?a:null,t),i?i.Ei(c):i=c)),i}function M_n(n){var t,e,i;if(null==n.b){if(i=new Sk,null!=n.i&&(cO(i,n.i),i.a+=":"),0!=(256&n.f)){for(0!=(256&n.f)&&null!=n.a&&(rQ(n.i)||(i.a+="//"),cO(i,n.a)),null!=n.d&&(i.a+="/",cO(i,n.d)),0!=(16&n.f)&&(i.a+="/"),t=0,e=n.j.length;ts)&&(o+u+cHn(i,s,!1).a<=t.b&&(p9(e,c-e.s),e.c=!0,p9(i,c-e.s),Tvn(i,e.s,e.t+e.d+u),i.k=!0,xcn(e.q,i),h=!0,r&&(tin(t,i),i.j=t,n.c.length>a&&(Tkn((l1(a,n.c.length),BB(n.c[a],200)),i),0==(l1(a,n.c.length),BB(n.c[a],200)).a.c.length&&s6(n,a)))),h)}function $_n(n,t){var e,i,r,c,a;if(OTn(t,"Partition midprocessing",1),r=new pJ,JT(AV(new Rq(null,new w1(n.a,16)),new di),new ld(r)),0!=r.d){for(a=BB(P4(a1(new Rq(null,(r.i||(r.i=new HL(r,r.c))).Nc())),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),e=BB((i=a.Kc()).Pb(),19);i.Ob();)c=BB(i.Pb(),19),XLn(BB(h6(r,e),21),BB(h6(r,c),21)),e=c;HSn(t)}}function L_n(n,t,e){var i,r,c,a,u;if(0==t.p){for(t.p=1,(r=e)||(r=new rI(new Np,new YK(i=BB(Vj(FIt),9),BB(SR(i,i.length),9),0))),BB(r.a,15).Fc(t),t.k==(uSn(),Mut)&&BB(r.b,21).Fc(BB(mMn(t,(hWn(),Qft)),61)),a=new Wb(t.j);a.a0)if(r=BB(n.Ab.g,1934),null==t){for(c=0;c1)for(i=new Wb(r);i.ai.s&&oa&&(a=r,s.c=x8(Ant,HWn,1,0,5,1)),r==a&&WB(s,new rI(e.c.i,e)));SQ(),m$(s,n.c),kG(n.b,u.p,s)}}function q_n(n,t){var e,i,r,c,a,u,o,s;for(c=new Wb(t.b);c.aa&&(a=r,s.c=x8(Ant,HWn,1,0,5,1)),r==a&&WB(s,new rI(e.d.i,e)));SQ(),m$(s,n.c),kG(n.f,u.p,s)}}function G_n(n){NM(n,new MTn(vj(wj(pj(gj(new du,l5n),"ELK Box"),"Algorithm for packing of unconnected boxes, i.e. graphs without edges."),new xu))),u2(n,l5n,QJn,zMt),u2(n,l5n,vZn,15),u2(n,l5n,pZn,iln(0)),u2(n,l5n,A4n,mpn(_Mt)),u2(n,l5n,PZn,mpn(BMt)),u2(n,l5n,SZn,mpn(qMt)),u2(n,l5n,VJn,f5n),u2(n,l5n,jZn,mpn(FMt)),u2(n,l5n,BZn,mpn(HMt)),u2(n,l5n,b5n,mpn(RMt)),u2(n,l5n,u3n,mpn(KMt))}function z_n(n,t){var e,i,r,c,a,u,o,s,h;if(a=(r=n.i).o.a,c=r.o.b,a<=0&&c<=0)return kUn(),PIt;switch(s=n.n.a,h=n.n.b,u=n.o.a,e=n.o.b,t.g){case 2:case 1:if(s<0)return kUn(),CIt;if(s+u>a)return kUn(),oIt;break;case 4:case 3:if(h<0)return kUn(),sIt;if(h+e>c)return kUn(),SIt}return(o=(s+u/2)/a)+(i=(h+e/2)/c)<=1&&o-i<=0?(kUn(),CIt):o+i>=1&&o-i>=0?(kUn(),oIt):i<.5?(kUn(),sIt):(kUn(),SIt)}function U_n(n,t){var e,i,r,c,a,u,o,s,h,f,l,b;for(e=!1,o=Gy(MD(mMn(t,(HXn(),Opt)))),l=KVn*o,r=new Wb(t.b);r.aa.n.b-a.d.d+h.a+l&&(b=s.g+h.g,h.a=(h.g*h.a+s.g*s.a)/b,h.g=b,s.f=h,e=!0)),c=a,s=h;return e}function X_n(n,t,e,i,r,c,a){var u,o,s,h,f;for(f=new bA,o=t.Kc();o.Ob();)for(h=new Wb(BB(o.Pb(),839).wf());h.a0?u.a?r>(s=u.b.rf().b)&&(n.v||1==u.c.d.c.length?(a=(r-s)/2,u.d.d=a,u.d.a=a):(i=(BB(xq(u.c.d,0),181).rf().b-s)/2,u.d.d=e.Math.max(0,i),u.d.a=r-i-s)):u.d.a=n.t+r:Hz(n.u)&&((c=_Tn(u.b)).d<0&&(u.d.d=-c.d),c.d+c.a>u.b.rf().b&&(u.d.a=c.d+c.a-u.b.rf().b))}function Q_n(n,t){var e;switch(vnn(n)){case 6:return XI(t);case 7:return UI(t);case 8:return zI(t);case 3:return Array.isArray(t)&&!((e=vnn(t))>=14&&e<=16);case 11:return null!=t&&typeof t===xWn;case 12:return null!=t&&(typeof t===AWn||typeof t==xWn);case 0:return Qpn(t,n.__elementTypeId$);case 2:return DU(t)&&!(t.im===I);case 1:return DU(t)&&!(t.im===I)||Qpn(t,n.__elementTypeId$);default:return!0}}function Y_n(n,t){var i,r,c,a;return r=e.Math.min(e.Math.abs(n.c-(t.c+t.b)),e.Math.abs(n.c+n.b-t.c)),a=e.Math.min(e.Math.abs(n.d-(t.d+t.a)),e.Math.abs(n.d+n.a-t.d)),(i=e.Math.abs(n.c+n.b/2-(t.c+t.b/2)))>n.b/2+t.b/2||(c=e.Math.abs(n.d+n.a/2-(t.d+t.a/2)))>n.a/2+t.a/2?1:0==i&&0==c?0:0==i?a/c+1:0==c?r/i+1:e.Math.min(r/i,a/c)+1}function J_n(n,t){var i,r,c,a,u,o;return(c=iin(n))==(o=iin(t))?n.e==t.e&&n.a<54&&t.a<54?n.ft.f?1:0:(r=n.e-t.e,(i=(n.d>0?n.d:e.Math.floor((n.a-1)*zQn)+1)-(t.d>0?t.d:e.Math.floor((t.a-1)*zQn)+1))>r+1?c:i0&&(u=Nnn(u,kBn(r))),tgn(a,u))):c0&&n.d!=(q7(),Aat)&&(u+=a*(i.d.a+n.a[t.b][i.b]*(t.d.a-i.d.a)/e)),e>0&&n.d!=(q7(),Iat)&&(o+=a*(i.d.b+n.a[t.b][i.b]*(t.d.b-i.d.b)/e)));switch(n.d.g){case 1:return new xC(u/c,t.d.b);case 2:return new xC(t.d.a,o/c);default:return new xC(u/c,o/c)}}function nFn(n,t){var e,i,r,c;if(zsn(),c=BB(mMn(n.i,(HXn(),ept)),98),0!=n.j.g-t.j.g||c!=(QEn(),UCt)&&c!=WCt&&c!=XCt)return 0;if(c==(QEn(),UCt)&&(e=BB(mMn(n,ipt),19),i=BB(mMn(t,ipt),19),e&&i&&0!=(r=e.a-i.a)))return r;switch(n.j.g){case 1:return Pln(n.n.a,t.n.a);case 2:return Pln(n.n.b,t.n.b);case 3:return Pln(t.n.a,n.n.a);case 4:return Pln(t.n.b,n.n.b);default:throw Hp(new Fy(r1n))}}function tFn(n){var t,e,i,r,c;for(WB(c=new J6((!n.a&&(n.a=new $L(xOt,n,5)),n.a).i+2),new xC(n.j,n.k)),JT(new Rq(null,(!n.a&&(n.a=new $L(xOt,n,5)),new w1(n.a,16))),new Ig(c)),WB(c,new xC(n.b,n.c)),t=1;t0&&(Uun(o,!1,(Ffn(),_Pt)),Uun(o,!0,FPt)),Otn(t.g,new sP(n,e)),VW(n.g,t,e)}function iFn(){var n;for(iFn=O,Ltt=Pun(Gk(ANt,1),hQn,25,15,[-1,-1,30,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5]),Ntt=x8(ANt,hQn,25,37,15,1),xtt=Pun(Gk(ANt,1),hQn,25,15,[-1,-1,63,40,32,28,25,23,21,20,19,19,18,18,17,17,16,16,16,15,15,15,15,14,14,14,14,14,14,13,13,13,13,13,13,13,13]),Dtt=x8(LNt,FQn,25,37,14,1),n=2;n<=36;n++)Ntt[n]=CJ(e.Math.pow(n,Ltt[n])),Dtt[n]=Ojn(bVn,Ntt[n])}function rFn(n){var t;if(1!=(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i)throw Hp(new _y(B5n+(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i));return t=new km,bun(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82))&&Frn(t,zXn(n,bun(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)),!1)),bun(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82))&&Frn(t,zXn(n,bun(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82)),!0)),t}function cFn(n,t){var e,i,r;for(r=!1,i=new oz(ZL((t.d?n.a.c==(gJ(),tyt)?fbn(t.b):lbn(t.b):n.a.c==(gJ(),nyt)?fbn(t.b):lbn(t.b)).a.Kc(),new h));dAn(i);)if(e=BB(U5(i),17),(qy(n.a.f[n.a.g[t.b.p].p])||b5(e)||e.c.i.c!=e.d.i.c)&&!qy(n.a.n[n.a.g[t.b.p].p])&&!qy(n.a.n[n.a.g[t.b.p].p])&&(r=!0,FT(n.b,n.a.g[Lmn(e,t.b).p])))return t.c=!0,t.a=e,t;return t.c=r,t.a=null,t}function aFn(n,t,e,i,r){var c,a,u,o,s,h,f;for(SQ(),m$(n,new Xu),u=new M2(n,0),f=new Np,c=0;u.b2*c?(h=new Gtn(f),s=iG(a)/eG(a),o=yXn(h,t,new bm,e,i,r,s),UR(kO(h.e),o),f.c=x8(Ant,HWn,1,0,5,1),c=0,f.c[f.c.length]=h,f.c[f.c.length]=a,c=iG(h)*eG(h)+iG(a)*eG(a)):(f.c[f.c.length]=a,c+=iG(a)*eG(a));return f}function uFn(n,t,e){var i,r,c,a,u,o,s;if(0==(i=e.gc()))return!1;if(n.ej())if(o=n.fj(),kwn(n,t,e),a=1==i?n.Zi(3,null,e.Kc().Pb(),t,o):n.Zi(5,null,e,t,o),n.bj()){for(u=i<100?null:new Fj(i),c=t+i,r=t;r0){for(u=0;u>16==-15&&n.Cb.nh()&&$7(new k9(n.Cb,9,13,e,n.c,uvn(H7(BB(n.Cb,59)),n))):cL(n.Cb,88)&&n.Db>>16==-23&&n.Cb.nh()&&(cL(t=n.c,88)||(gWn(),t=d$t),cL(e,88)||(gWn(),e=d$t),$7(new k9(n.Cb,9,10,e,t,uvn(a4(BB(n.Cb,26)),n)))))),n.c}function bFn(n,t){var e,i,r,c,a,u,o,s;for(OTn(t,"Hypernodes processing",1),i=new Wb(n.b);i.ae);return r}function pFn(n,t){var e,i,r;i=0!=H$n(n.d,1),!qy(TD(mMn(t.j,(hWn(),Jft))))&&!qy(TD(mMn(t.j,Ilt)))||GI(mMn(t.j,(HXn(),Ldt)))===GI((mon(),Nvt))?t.c.Tf(t.e,i):i=qy(TD(mMn(t.j,Jft))),DNn(n,t,i,!0),qy(TD(mMn(t.j,Ilt)))&&hon(t.j,Ilt,(hN(),!1)),qy(TD(mMn(t.j,Jft)))&&(hon(t.j,Jft,(hN(),!1)),hon(t.j,Ilt,!0)),e=nCn(n,t);do{if($rn(n),0==e)return 0;r=e,DNn(n,t,i=!i,!1),e=nCn(n,t)}while(r>e);return r}function vFn(n,t,e){var i,r,c,a,u,o,s;if(t==e)return!0;if(t=bAn(n,t),e=bAn(n,e),i=qvn(t)){if((o=qvn(e))!=i)return!!o&&(a=i.Dj())==o.Dj()&&null!=a;if(!t.d&&(t.d=new $L(VAt,t,1)),r=(c=t.d).i,!e.d&&(e.d=new $L(VAt,e,1)),r==(s=e.d).i)for(u=0;u0,u=Nbn(t,c),KN(e?u.b:u.g,t),1==kbn(u).c.length&&r5(i,u,i.c.b,i.c),r=new rI(c,t),d3(n.o,r),y7(n.e.a,c))}function TFn(n,t){var i,r,c,a;return r=e.Math.abs(qz(n.b).a-qz(t.b).a),a=e.Math.abs(qz(n.b).b-qz(t.b).b),i=1,c=1,r>n.b.b/2+t.b.b/2&&(i=1-e.Math.min(e.Math.abs(n.b.c-(t.b.c+t.b.b)),e.Math.abs(n.b.c+n.b.b-t.b.c))/r),a>n.b.a/2+t.b.a/2&&(c=1-e.Math.min(e.Math.abs(n.b.d-(t.b.d+t.b.a)),e.Math.abs(n.b.d+n.b.a-t.b.d))/a),(1-e.Math.min(i,c))*e.Math.sqrt(r*r+a*a)}function MFn(n){var t,e,i;for(nUn(n,n.e,n.f,(dJ(),Lyt),!0,n.c,n.i),nUn(n,n.e,n.f,Lyt,!1,n.c,n.i),nUn(n,n.e,n.f,Nyt,!0,n.c,n.i),nUn(n,n.e,n.f,Nyt,!1,n.c,n.i),IFn(n,n.c,n.e,n.f,n.i),e=new M2(n.i,0);e.b=65;e--)WLt[e]=e-65<<24>>24;for(i=122;i>=97;i--)WLt[i]=i-97+26<<24>>24;for(r=57;r>=48;r--)WLt[r]=r-48+52<<24>>24;for(WLt[43]=62,WLt[47]=63,c=0;c<=25;c++)VLt[c]=65+c&QVn;for(a=26,o=0;a<=51;++a,o++)VLt[a]=97+o&QVn;for(n=52,u=0;n<=61;++n,u++)VLt[n]=48+u&QVn;VLt[62]=43,VLt[63]=47}function CFn(n,t){var i,r,c,a,u,o,s,h,f,l,b;if(n.dc())return new Gj;for(s=0,f=0,r=n.Kc();r.Ob();)c=BB(r.Pb(),37).f,s=e.Math.max(s,c.a),f+=c.a*c.b;for(s=e.Math.max(s,e.Math.sqrt(f)*Gy(MD(mMn(BB(n.Kc().Pb(),37),(HXn(),Edt))))),l=0,b=0,o=0,i=t,u=n.Kc();u.Ob();)l+(h=(a=BB(u.Pb(),37)).f).a>s&&(l=0,b+=o+t,o=0),ZRn(a,l,b),i=e.Math.max(i,l+h.a),o=e.Math.max(o,h.b),l+=h.a+t;return new xC(i+t,b+o+t)}function IFn(n,t,e,i,r){var c,a,u,o,s,h,f;for(a=new Wb(t);a.ac)return kUn(),oIt;break;case 4:case 3:if(o<0)return kUn(),sIt;if(o+n.f>r)return kUn(),SIt}return(a=(u+n.g/2)/c)+(e=(o+n.f/2)/r)<=1&&a-e<=0?(kUn(),CIt):a+e>=1&&a-e>=0?(kUn(),oIt):e<.5?(kUn(),sIt):(kUn(),SIt)}function AFn(n,t,e,i,r){var c,a;if(c=rbn(e0(t[0],UQn),e0(i[0],UQn)),n[0]=dG(c),c=kz(c,32),e>=r){for(a=1;a0&&(r.b[a++]=0,r.b[a++]=c.b[0]-1),t=1;t0&&(Vl(o,o.d-r.d),r.c==(O6(),Tyt)&&Xl(o,o.a-r.d),o.d<=0&&o.i>0&&r5(t,o,t.c.b,t.c));for(c=new Wb(n.f);c.a0&&(Ql(u,u.i-r.d),r.c==(O6(),Tyt)&&Wl(u,u.b-r.d),u.i<=0&&u.d>0&&r5(e,u,e.c.b,e.c))}function xFn(n,t,e){var i,r,c,a,u,o,s,h;for(OTn(e,"Processor compute fanout",1),$U(n.b),$U(n.a),u=null,c=spn(t.b,0);!u&&c.b!=c.d.c;)qy(TD(mMn(s=BB(b3(c),86),(qqn(),dkt))))&&(u=s);for(r5(o=new YT,u,o.c.b,o.c),jUn(n,o),h=spn(t.b,0);h.b!=h.d.c;)a=SD(mMn(s=BB(b3(h),86),(qqn(),rkt))),r=null!=SJ(n.b,a)?BB(SJ(n.b,a),19).a:0,hon(s,ikt,iln(r)),i=1+(null!=SJ(n.a,a)?BB(SJ(n.a,a),19).a:0),hon(s,tkt,iln(i));HSn(e)}function DFn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b;for(f=yEn(n,e),u=0;u0),i.a.Xb(i.c=--i.b),h>f+u&&fW(i);for(c=new Wb(l);c.a0),i.a.Xb(i.c=--i.b)}}function RFn(){var n,t,e,i,r,c;if(wWn(),CNt)return CNt;for(sHn(n=new M0(4),ZUn(pnt,!0)),WGn(n,ZUn("M",!0)),WGn(n,ZUn("C",!0)),c=new M0(4),i=0;i<11;i++)Yxn(c,i,i);return sHn(t=new M0(4),ZUn("M",!0)),Yxn(t,4448,4607),Yxn(t,65438,65439),tqn(r=new r$(2),n),tqn(r,sNt),(e=new r$(2)).$l(gG(c,ZUn("L",!0))),e.$l(t),e=new h4(3,e),e=new UU(r,e),CNt=e}function KFn(n){var t,e;if(!Ycn(t=SD(ZAn(n,(sWn(),eSt))),n)&&!P8(n,mPt)&&(0!=(!n.a&&(n.a=new eU(UOt,n,10,11)),n.a).i||qy(TD(ZAn(n,SSt))))){if(null!=t&&0!=RMn(t).length)throw gzn(n,e=oO(oO(new lN("Layout algorithm '"),t),"' not found for ")),Hp(new rk(e.a));if(!Ycn(w1n,n))throw gzn(n,e=oO(oO(new lN("Unable to load default layout algorithm "),w1n)," for unconfigured node ")),Hp(new rk(e.a))}}function _Fn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w;if(i=n.i,t=n.n,0==n.b)for(w=i.c+t.b,b=i.b-t.b-t.c,s=0,f=(u=n.a).length;s0&&(l-=r[0]+n.c,r[0]+=n.c),r[2]>0&&(l-=r[2]+n.c),r[1]=e.Math.max(r[1],l),UG(n.a[1],i.c+t.b+r[0]-(r[1]-l)/2,r[1]);for(o=0,h=(a=n.a).length;o0?(n.n.c.length-1)*n.i:0,i=new Wb(n.n);i.a1)for(i=spn(r,0);i.b!=i.d.c;)for(c=0,u=new Wb((e=BB(b3(i),231)).e);u.a0&&(t[0]+=n.c,l-=t[0]),t[2]>0&&(l-=t[2]+n.c),t[1]=e.Math.max(t[1],l),XG(n.a[1],r.d+i.d+t[0]-(t[1]-l)/2,t[1]);else for(w=r.d+i.d,b=r.a-i.d-i.a,s=0,f=(u=n.a).length;s=0&&c!=e)throw Hp(new _y(a8n));for(r=0,o=0;o0||0==Ibn(c.b.d,n.b.d+n.b.a)&&r.b<0||0==Ibn(c.b.d+c.b.a,n.b.d)&&r.b>0){o=0;break}}else o=e.Math.min(o,HCn(n,c,r));o=e.Math.min(o,WFn(n,a,o,r))}return o}function VFn(n,t){var e,i,r,c,a,u;if(n.b<2)throw Hp(new _y("The vector chain must contain at least a source and a target point."));for(Px(0!=n.b),CA(t,(i=BB(n.a.a.c,8)).a,i.b),u=new cx((!t.a&&(t.a=new $L(xOt,t,5)),t.a)),c=spn(n,1);c.aGy(lL(a.g,a.d[0]).a)?(Px(o.b>0),o.a.Xb(o.c=--o.b),yR(o,a),r=!0):u.e&&u.e.gc()>0&&(c=(!u.e&&(u.e=new Np),u.e).Mc(t),s=(!u.e&&(u.e=new Np),u.e).Mc(e),(c||s)&&((!u.e&&(u.e=new Np),u.e).Fc(a),++a.c));r||(i.c[i.c.length]=a)}function cBn(n){var t,e,i;if(vA(BB(mMn(n,(HXn(),ept)),98)))for(e=new Wb(n.j);e.a>>0).toString(16),t.length-2,t.length):n>=BQn?"\\v"+fx(t="0"+(n>>>0).toString(16),t.length-6,t.length):""+String.fromCharCode(n&QVn)}return e}function uBn(n,t){var e,i,r,c,a,u,o,s,h,f;if(a=n.e,0==(o=t.e))return n;if(0==a)return 0==t.e?t:new lU(-t.e,t.d,t.a);if((c=n.d)+(u=t.d)==2)return e=e0(n.a[0],UQn),i=e0(t.a[0],UQn),a<0&&(e=j7(e)),o<0&&(i=j7(i)),npn(ibn(e,i));if(-1==(r=c!=u?c>u?1:-1:Msn(n.a,t.a,c)))f=-o,h=a==o?d6(t.a,u,n.a,c):N8(t.a,u,n.a,c);else if(f=a,a==o){if(0==r)return ODn(),eet;h=d6(n.a,c,t.a,u)}else h=N8(n.a,c,t.a,u);return X0(s=new lU(f,h.length,h)),s}function oBn(n){var t,e,i,r,c,a;for(this.e=new Np,this.a=new Np,e=n.b-1;e<3;e++)Kx(n,0,BB(Dpn(n,0),8));if(n.b<4)throw Hp(new _y("At (least dimension + 1) control points are necessary!"));for(this.b=3,this.d=!0,this.c=!1,I$n(this,n.b+this.b-1),a=new Np,c=new Wb(this.e),t=0;t=t.o&&e.f<=t.f||.5*t.a<=e.f&&1.5*t.a>=e.f){if((c=BB(xq(t.n,t.n.c.length-1),211)).e+c.d+e.g+r<=i&&(BB(xq(t.n,t.n.c.length-1),211).f-n.f+e.f<=n.b||1==n.a.c.length))return ybn(t,e),!0;if(t.s+e.g<=i&&(t.t+t.d+e.f+r<=n.b||1==n.a.c.length))return WB(t.b,e),a=BB(xq(t.n,t.n.c.length-1),211),WB(t.n,new RJ(t.s,a.f+a.a+t.i,t.i)),smn(BB(xq(t.n,t.n.c.length-1),211),e),BFn(t,e),!0}return!1}function fBn(n,t,e){var i,r,c,a;return n.ej()?(r=null,c=n.fj(),i=n.Zi(1,a=onn(n,t,e),e,t,c),n.bj()&&!(n.ni()&&null!=a?Nfn(a,e):GI(a)===GI(e))?(null!=a&&(r=n.dj(a,r)),r=n.cj(e,r),n.ij()&&(r=n.lj(a,e,r)),r?(r.Ei(i),r.Fi()):n.$i(i)):(n.ij()&&(r=n.lj(a,e,r)),r?(r.Ei(i),r.Fi()):n.$i(i)),a):(a=onn(n,t,e),n.bj()&&!(n.ni()&&null!=a?Nfn(a,e):GI(a)===GI(e))&&(r=null,null!=a&&(r=n.dj(a,null)),(r=n.cj(e,r))&&r.Fi()),a)}function lBn(n,t){var i,r,c,a,u,o,s;t%=24,n.q.getHours()!=t&&((i=new e.Date(n.q.getTime())).setDate(i.getDate()+1),(u=n.q.getTimezoneOffset()-i.getTimezoneOffset())>0&&(o=u/60|0,s=u%60,r=n.q.getDate(),n.q.getHours()+o>=24&&++r,c=new e.Date(n.q.getFullYear(),n.q.getMonth(),r,t+o,n.q.getMinutes()+s,n.q.getSeconds(),n.q.getMilliseconds()),n.q.setTime(c.getTime()))),a=n.q.getTime(),n.q.setTime(a+36e5),n.q.getHours()!=t&&n.q.setTime(a)}function bBn(n,t){var e,i,r,c;if(OTn(t,"Path-Like Graph Wrapping",1),0!=n.b.c.length)if(null==(r=new MAn(n)).i&&(r.i=Wrn(r,new kc)),e=Gy(r.i)*r.f/(null==r.i&&(r.i=Wrn(r,new kc)),Gy(r.i)),r.b>e)HSn(t);else{switch(BB(mMn(n,(HXn(),Bpt)),337).g){case 2:c=new Tc;break;case 0:c=new wc;break;default:c=new Mc}if(i=c.Vf(n,r),!c.Wf())switch(BB(mMn(n,Xpt),338).g){case 2:i=XCn(r,i);break;case 1:i=KTn(r,i)}iqn(n,r,i),HSn(t)}else HSn(t)}function wBn(n,t){var e,i,r,c;if(f1(n.d,n.e),n.c.a.$b(),0!=Gy(MD(mMn(t.j,(HXn(),Idt))))||0!=Gy(MD(mMn(t.j,Idt))))for(e=ZJn,GI(mMn(t.j,Ldt))!==GI((mon(),Nvt))&&hon(t.j,(hWn(),Jft),(hN(),!0)),c=BB(mMn(t.j,xpt),19).a,r=0;r(l1(c+1,t.c.length),BB(t.c[c+1],19)).a-i&&++u,WB(r,(l1(c+u,t.c.length),BB(t.c[c+u],19))),a+=(l1(c+u,t.c.length),BB(t.c[c+u],19)).a-i,++e;e1&&(o>iG(u)*eG(u)/2||0==a.b)&&(f=new Gtn(l),h=iG(u)/eG(u),s=yXn(f,t,new bm,e,i,r,h),UR(kO(f.e),s),u=f,b.c[b.c.length]=f,o=0,l.c=x8(Ant,HWn,1,0,5,1)));return gun(b,l),b}function mBn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d;if(e.mh(t)&&(h=(b=t)?BB(i,49).xh(b):null))if(d=e.bh(t,n.a),(w=t.t)>1||-1==w)if(f=BB(d,69),l=BB(h,69),f.dc())l.$b();else for(a=!!Cvn(t),c=0,u=n.a?f.Kc():f.Zh();u.Ob();)s=BB(u.Pb(),56),(r=BB(lnn(n,s),56))?(a?-1==(o=l.Xc(r))?l.Xh(c,r):c!=o&&l.ji(c,r):l.Xh(c,r),++c):n.b&&!a&&(l.Xh(c,s),++c);else null==d?h.Wb(null):null==(r=lnn(n,d))?n.b&&!Cvn(t)&&h.Wb(d):h.Wb(r)}function yBn(n,t){var i,r,c,a,u,o,s,f;for(i=new Le,c=new oz(ZL(fbn(t).a.Kc(),new h));dAn(c);)if(!b5(r=BB(U5(c),17))&&eTn(o=r.c.i,Xut)){if(-1==(f=VDn(n,o,Xut,Uut)))continue;i.b=e.Math.max(i.b,f),!i.a&&(i.a=new Np),WB(i.a,o)}for(u=new oz(ZL(lbn(t).a.Kc(),new h));dAn(u);)if(!b5(a=BB(U5(u),17))&&eTn(s=a.d.i,Uut)){if(-1==(f=VDn(n,s,Uut,Xut)))continue;i.d=e.Math.max(i.d,f),!i.c&&(i.c=new Np),WB(i.c,s)}return i}function kBn(n){var t,e,i,r;if($On(),t=CJ(n),n1e6)throw Hp(new Oy("power of ten too big"));if(n<=DWn)return G5(uOn(aet[1],t),t);for(r=i=uOn(aet[1],DWn),e=fan(n-DWn),t=CJ(n%DWn);Vhn(e,DWn)>0;)r=Nnn(r,i),e=ibn(e,DWn);for(r=G5(r=Nnn(r,uOn(aet[1],t)),DWn),e=fan(n-DWn);Vhn(e,DWn)>0;)r=G5(r,DWn),e=ibn(e,DWn);return r=G5(r,t)}function jBn(n,t){var e,i,r,c,a,u,o,s;for(OTn(t,"Hierarchical port dummy size processing",1),u=new Np,s=new Np,e=2*Gy(MD(mMn(n,(HXn(),kpt)))),r=new Wb(n.b);r.as&&i>s)){r=!1,e.n&&OH(e,"bk node placement breaks on "+u+" which should have been after "+h);break}h=u,s=Gy(t.p[u.p])+Gy(t.d[u.p])+u.o.b+u.d.a}if(!r)break}return e.n&&OH(e,t+" is feasible: "+r),r}function OBn(n,t,e,i){var r,c,a,u,o,s,h;for(u=-1,h=new Wb(n);h.a=g&&n.e[s.p]>w*n.b||m>=i*g)&&(l.c[l.c.length]=o,o=new Np,Frn(u,a),a.a.$b(),h-=f,b=e.Math.max(b,h*n.b+d),h+=m,v=m,m=0,f=0,d=0);return new rI(b,l)}function NBn(n){var t,e,i,r,c,a,u,o,s,h,f,l;for(e=new Kb(new Ob(n.c.b).a.vc().Kc());e.a.Ob();)u=BB(e.a.Pb(),42),null==(r=(t=BB(u.dd(),149)).a)&&(r=""),!(i=_D(n.c,r))&&0==r.length&&(i=yfn(n)),i&&!ywn(i.c,t,!1)&&DH(i.c,t);for(a=spn(n.a,0);a.b!=a.d.c;)c=BB(b3(a),478),s=T5(n.c,c.a),l=T5(n.c,c.b),s&&l&&DH(s.c,new rI(l,c.c));for(yQ(n.a),f=spn(n.b,0);f.b!=f.d.c;)h=BB(b3(f),478),t=KD(n.c,h.a),o=T5(n.c,h.b),t&&o&&DM(t,o,h.c);yQ(n.b)}function xBn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;c=new Pl(n),d5((a=new dkn).g),d5(a.j),$U(a.b),d5(a.d),d5(a.i),$U(a.k),$U(a.c),$U(a.e),b=bIn(a,c,null),O$n(a,c),r=b,t&&(u=eHn(s=new Pl(t)),vSn(r,Pun(Gk(nMt,1),HWn,527,0,[u]))),l=!1,f=!1,e&&(s=new Pl(e),l8n in s.a&&(l=zJ(s,l8n).ge().a),b8n in s.a&&(f=zJ(s,b8n).ge().a)),h=$j(Fen(new Xm,l),f),BSn(new su,r,h),l8n in c.a&&rtn(c,l8n,null),(l||f)&&(nBn(h,o=new py,l,f),rtn(c,l8n,o)),i=new Xg(a),Uon(new OA(r),i)}function DBn(n,t,e){var i,r,c,a,u,o,s,h,f;for(a=new Ykn,s=Pun(Gk(ANt,1),hQn,25,15,[0]),r=-1,c=0,i=0,o=0;o0)){if(r=-1,32==fV(h.c,0)){if(f=s[0],ynn(t,s),s[0]>f)continue}else if($Y(t,h.c,s[0])){s[0]+=h.c.length;continue}return 0}if(r<0&&h.a&&(r=o,c=s[0],i=0),r>=0){if(u=h.b,o==r&&0==(u-=i++))return 0;if(!LUn(t,s,h,u,a)){o=r-1,s[0]=c;continue}}else if(r=-1,!LUn(t,s,h,0,a))return 0}return dUn(a,e)?s[0]:0}function RBn(n){var t,e,i,r,c,a;if(!n.f){if(a=new Mo,c=new Mo,null==(t=P$t).a.zc(n,t)){for(r=new AL(kY(n));r.e!=r.i.gc();)pX(a,RBn(BB(kpn(r),26)));t.a.Bc(n),t.a.gc()}for(!n.s&&(n.s=new eU(FAt,n,21,17)),i=new AL(n.s);i.e!=i.i.gc();)cL(e=BB(kpn(i),170),99)&&f9(c,BB(e,18));chn(c),n.r=new TH(n,(BB(Wtn(QQ((QX(),t$t).o),6),18),c.i),c.g),pX(a,n.r),chn(a),n.f=new NO((BB(Wtn(QQ(t$t.o),5),18),a.i),a.g),P5(n).b&=-3}return n.f}function KBn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w;for(a=n.o,i=x8(ANt,hQn,25,a,15,1),r=x8(ANt,hQn,25,a,15,1),e=n.p,t=x8(ANt,hQn,25,e,15,1),c=x8(ANt,hQn,25,e,15,1),s=0;s=0&&!vmn(n,h,f);)--f;r[h]=f}for(b=0;b=0&&!vmn(n,u,w);)--u;c[w]=u}for(o=0;ot[l]&&li[o]&&FRn(n,o,l,!1,!0)}function _Bn(n){var t,e,i,r,c,a,u,o;e=qy(TD(mMn(n,(fRn(),Bct)))),c=n.a.c.d,u=n.a.d.d,e?(a=kL(XR(new xC(u.a,u.b),c),.5),o=kL(B$(n.e),.5),t=XR(UR(new xC(c.a,c.b),a),o),Hx(n.d,t)):(r=Gy(MD(mMn(n.a,rat))),i=n.d,c.a>=u.a?c.b>=u.b?(i.a=u.a+(c.a-u.a)/2+r,i.b=u.b+(c.b-u.b)/2-r-n.e.b):(i.a=u.a+(c.a-u.a)/2+r,i.b=c.b+(u.b-c.b)/2+r):c.b>=u.b?(i.a=c.a+(u.a-c.a)/2+r,i.b=u.b+(c.b-u.b)/2+r):(i.a=c.a+(u.a-c.a)/2+r,i.b=c.b+(u.b-c.b)/2-r-n.e.b))}function FBn(n,t){var e,i,r,c,a,u,o;if(null==n)return null;if(0==(c=n.length))return"";for(o=x8(ONt,WVn,25,c,15,1),_8(0,c,n.length),_8(0,c,o.length),YU(n,0,c,o,0),e=null,u=t,r=0,a=0;r0?fx(e.a,0,c-1):"":n.substr(0,c-1):e?e.a:n}function BBn(n){NM(n,new MTn(vj(wj(pj(gj(new du,UJn),"ELK DisCo"),"Layouter for arranging unconnected subgraphs. The subgraphs themselves are, by default, not laid out."),new at))),u2(n,UJn,XJn,mpn(Ect)),u2(n,UJn,WJn,mpn(pct)),u2(n,UJn,VJn,mpn(lct)),u2(n,UJn,QJn,mpn(vct)),u2(n,UJn,XYn,mpn(kct)),u2(n,UJn,WYn,mpn(yct)),u2(n,UJn,UYn,mpn(jct)),u2(n,UJn,VYn,mpn(mct)),u2(n,UJn,BJn,mpn(wct)),u2(n,UJn,HJn,mpn(bct)),u2(n,UJn,qJn,mpn(dct)),u2(n,UJn,GJn,mpn(gct))}function HBn(n,t,e,i){var r,c,a,u,o,s,h;if(Bl(c=new $vn(n),(uSn(),Iut)),hon(c,(HXn(),ept),(QEn(),XCt)),r=0,t){for(hon(a=new CSn,(hWn(),dlt),t),hon(c,dlt,t.i),qCn(a,(kUn(),CIt)),CZ(a,c),s=0,h=(o=Z0(t.e)).length;s0)if((i-=r.length-t)>=0){for(c.a+="0.";i>qtt.length;i-=qtt.length)Nq(c,qtt);gR(c,qtt,CJ(i)),oO(c,r.substr(t))}else oO(c,fx(r,t,CJ(i=t-i))),c.a+=".",oO(c,nO(r,CJ(i)));else{for(oO(c,r.substr(t));i<-qtt.length;i+=qtt.length)Nq(c,qtt);gR(c,qtt,CJ(-i))}return c.a}function zBn(n,t,i,r){var c,a,u,o,s,h,f,l,b;return h=(s=XR(new xC(i.a,i.b),n)).a*t.b-s.b*t.a,f=t.a*r.b-t.b*r.a,l=(s.a*r.b-s.b*r.a)/f,b=h/f,0==f?0==h?(a=W8(n,c=UR(new xC(i.a,i.b),kL(new xC(r.a,r.b),.5))),u=W8(UR(new xC(n.a,n.b),t),c),o=.5*e.Math.sqrt(r.a*r.a+r.b*r.b),a=0&&l<=1&&b>=0&&b<=1?UR(new xC(n.a,n.b),kL(new xC(t.a,t.b),l)):null}function UBn(n,t,e){var i,r,c,a,u;if(i=BB(mMn(n,(HXn(),Ndt)),21),e.a>t.a&&(i.Hc((wEn(),WMt))?n.c.a+=(e.a-t.a)/2:i.Hc(QMt)&&(n.c.a+=e.a-t.a)),e.b>t.b&&(i.Hc((wEn(),JMt))?n.c.b+=(e.b-t.b)/2:i.Hc(YMt)&&(n.c.b+=e.b-t.b)),BB(mMn(n,(hWn(),Zft)),21).Hc((bDn(),lft))&&(e.a>t.a||e.b>t.b))for(u=new Wb(n.a);u.at.a&&(i.Hc((wEn(),WMt))?n.c.a+=(e.a-t.a)/2:i.Hc(QMt)&&(n.c.a+=e.a-t.a)),e.b>t.b&&(i.Hc((wEn(),JMt))?n.c.b+=(e.b-t.b)/2:i.Hc(YMt)&&(n.c.b+=e.b-t.b)),BB(mMn(n,(hWn(),Zft)),21).Hc((bDn(),lft))&&(e.a>t.a||e.b>t.b))for(a=new Wb(n.a);a.at&&(r=0,c+=s.b+e,h.c[h.c.length]=s,tin(s=new x0(c,e),i=new asn(0,s.f,s,e)),r=0),0==i.b.c.length||u.f>=i.o&&u.f<=i.f||.5*i.a<=u.f&&1.5*i.a>=u.f?ybn(i,u):(tin(s,a=new asn(i.s+i.r+e,s.f,s,e)),ybn(a,u)),r=u.i+u.g;return h.c[h.c.length]=s,h}function YBn(n){var t,e,i,r,c,a;if(!n.a){if(n.o=null,a=new gp(n),t=new So,null==(e=P$t).a.zc(n,e)){for(c=new AL(kY(n));c.e!=c.i.gc();)pX(a,YBn(BB(kpn(c),26)));e.a.Bc(n),e.a.gc()}for(!n.s&&(n.s=new eU(FAt,n,21,17)),r=new AL(n.s);r.e!=r.i.gc();)cL(i=BB(kpn(r),170),322)&&f9(t,BB(i,34));chn(t),n.k=new EH(n,(BB(Wtn(QQ((QX(),t$t).o),7),18),t.i),t.g),pX(a,n.k),chn(a),n.a=new NO((BB(Wtn(QQ(t$t.o),4),18),a.i),a.g),P5(n).b&=-2}return n.a}function JBn(n,t,e,i,r,c,a){var u,o,s,h,f;return h=!1,u=dNn(e.q,t.f+t.b-e.q.f),!((f=r-(e.q.e+u-a))=(l1(c,n.c.length),BB(n.c[c],200)).e,!((s=cHn(i,f,!1).a)>t.b&&!o)&&((o||s<=t.b)&&(o&&s>t.b?(e.d=s,p9(e,FSn(e,s))):(aEn(e.q,u),e.c=!0),p9(i,r-(e.s+e.r)),Tvn(i,e.q.e+e.q.d,t.f),tin(t,i),n.c.length>c&&(Tkn((l1(c,n.c.length),BB(n.c[c],200)),i),0==(l1(c,n.c.length),BB(n.c[c],200)).a.c.length&&s6(n,c)),h=!0),h))}function ZBn(n,t,e,i){var r,c,a,u,o,s,h;if(h=axn(n.e.Tg(),t),r=0,c=BB(n.g,119),o=null,ZM(),BB(t,66).Oj()){for(u=0;un.o.a&&(f=(s-n.o.a)/2,o.b=e.Math.max(o.b,f),o.c=e.Math.max(o.c,f))}}function eHn(n){var t,e,i,r,c,a;for(cA(r=new R0,(Nun(),JTt)),i=new Sb(new Jy(new TT(n,jrn(n,x8(Qtt,sVn,2,0,6,1))).b));i.b0?n.i:0)>t&&s>0&&(a=0,u+=s+n.i,c=e.Math.max(c,b),r+=s+n.i,s=0,b=0,i&&(++l,WB(n.n,new RJ(n.s,u,n.i))),o=0),b+=h.g+(o>0?n.i:0),s=e.Math.max(s,h.f),i&&smn(BB(xq(n.n,l),211),h),a+=h.g+(o>0?n.i:0),++o;return c=e.Math.max(c,b),r+=s,i&&(n.r=c,n.d=r,yyn(n.j)),new UV(n.s,n.t,c,r)}function aHn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b;if($T(),SU(n,"src"),SU(e,"dest"),l=tsn(n),o=tsn(e),pH(0!=(4&l.i),"srcType is not an array"),pH(0!=(4&o.i),"destType is not an array"),f=l.c,a=o.c,pH(0!=(1&f.i)?f==a:0==(1&a.i),"Array types don't match"),b=n.length,s=e.length,t<0||i<0||r<0||t+r>b||i+r>s)throw Hp(new fv);if(0==(1&f.i)&&l!=o)if(h=een(n),c=een(e),GI(n)===GI(e)&&ti;)$X(c,u,h[--t]);else for(u=i+r;i0&&_Cn(n,t,e,i,r,!0)}function uHn(){uHn=O,ret=Pun(Gk(ANt,1),hQn,25,15,[_Vn,1162261467,OVn,1220703125,362797056,1977326743,OVn,387420489,AQn,214358881,429981696,815730721,1475789056,170859375,268435456,410338673,612220032,893871739,128e7,1801088541,113379904,148035889,191102976,244140625,308915776,387420489,481890304,594823321,729e6,887503681,OVn,1291467969,1544804416,1838265625,60466176]),cet=Pun(Gk(ANt,1),hQn,25,15,[-1,-1,31,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5])}function oHn(n){var t,e,i,r,c,a,u;for(i=new Wb(n.b);i.a=n.b.length?(c[r++]=a.b[i++],c[r++]=a.b[i++]):i>=a.b.length?(c[r++]=n.b[e++],c[r++]=n.b[e++]):a.b[i]0?n.i:0)),++t;for(nwn(n.n,s),n.d=i,n.r=r,n.g=0,n.f=0,n.e=0,n.o=RQn,n.p=RQn,a=new Wb(n.b);a.a0&&(!(r=(!n.n&&(n.n=new eU(zOt,n,1,7)),BB(Wtn(n.n,0),137)).a)||oO(oO((t.a+=' "',t),r),'"'))),!n.b&&(n.b=new hK(KOt,n,4,7)),e=!(n.b.i<=1&&(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c.i<=1)),t.a+=e?" [":" ",oO(t,JL(new mk,new AL(n.b))),e&&(t.a+="]"),t.a+=e1n,e&&(t.a+="["),oO(t,JL(new mk,new AL(n.c))),e&&(t.a+="]"),t.a)}function bHn(n,t){var e,i,r,c,a,u,o;if(n.a){if(o=null,null!=(u=n.a.ne())?t.a+=""+u:null!=(a=n.a.Dj())&&(-1!=(c=GO(a,YTn(91)))?(o=a.substr(c),t.a+=""+fx(null==a?zWn:(kW(a),a),0,c)):t.a+=""+a),n.d&&0!=n.d.i){for(r=!0,t.a+="<",i=new AL(n.d);i.e!=i.i.gc();)e=BB(kpn(i),87),r?r=!1:t.a+=FWn,bHn(e,t);t.a+=">"}null!=o&&(t.a+=""+o)}else n.e?null!=(u=n.e.zb)&&(t.a+=""+u):(t.a+="?",n.b?(t.a+=" super ",bHn(n.b,t)):n.f&&(t.a+=" extends ",bHn(n.f,t)))}function wHn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M;for(y=n.c,k=t.c,e=E7(y.a,n,0),i=E7(k.a,t,0),v=BB(xwn(n,(ain(),Hvt)).Kc().Pb(),11),T=BB(xwn(n,qvt).Kc().Pb(),11),m=BB(xwn(t,Hvt).Kc().Pb(),11),M=BB(xwn(t,qvt).Kc().Pb(),11),g=Z0(v.e),j=Z0(T.g),p=Z0(m.e),E=Z0(M.g),Qyn(n,i,k),s=0,b=(c=p).length;sh?new zZ((O6(),Myt),i,t,s-h):s>0&&h>0&&(new zZ((O6(),Myt),t,i,0),new zZ(Myt,i,t,0))),a)}function pHn(n,t){var i,r,c,a,u;for(u=new usn(new Pb(n.f.b).a);u.b;){if(c=BB((a=ten(u)).cd(),594),1==t){if(c.gf()!=(Ffn(),HPt)&&c.gf()!=KPt)continue}else if(c.gf()!=(Ffn(),_Pt)&&c.gf()!=FPt)continue;switch(r=BB(BB(a.dd(),46).b,81),i=BB(BB(a.dd(),46).a,189).c,c.gf().g){case 2:r.g.c=n.e.a,r.g.b=e.Math.max(1,r.g.b+i);break;case 1:r.g.c=r.g.c+i,r.g.b=e.Math.max(1,r.g.b-i);break;case 4:r.g.d=n.e.b,r.g.a=e.Math.max(1,r.g.a+i);break;case 3:r.g.d=r.g.d+i,r.g.a=e.Math.max(1,r.g.a-i)}}}function vHn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(o=x8(ANt,hQn,25,t.b.c.length,15,1),h=x8($ut,$Vn,267,t.b.c.length,0,1),s=x8(Out,a1n,10,t.b.c.length,0,1),b=0,w=(l=n.a).length;b0&&s[r]&&(d=K$(n.b,s[r],c)),g=e.Math.max(g,c.c.c.b+d);for(a=new Wb(f.e);a.a1)throw Hp(new _y(I7n));o||(c=Z3(t,i.Kc().Pb()),a.Fc(c))}return oon(n,EPn(n,t,e),a)}function EHn(n,t){var e,i,r,c;for(Qtn(t.b.j),JT($V(new Rq(null,new w1(t.d,16)),new cc),new ac),c=new Wb(t.d);c.an.o.b)return!1;if(e=abn(n,oIt),t.d+t.a+(e.gc()-1)*r>n.o.b)return!1}return!0}function $Hn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;if(a=n.e,o=t.e,0==a)return t;if(0==o)return n;if((c=n.d)+(u=t.d)==2)return e=e0(n.a[0],UQn),i=e0(t.a[0],UQn),a==o?(w=dG(h=rbn(e,i)),0==(b=dG(jz(h,32)))?new X6(a,w):new lU(a,2,Pun(Gk(ANt,1),hQn,25,15,[w,b]))):npn(a<0?ibn(i,e):ibn(e,i));if(a==o)l=a,f=c>=u?N8(n.a,c,t.a,u):N8(t.a,u,n.a,c);else{if(0==(r=c!=u?c>u?1:-1:Msn(n.a,t.a,c)))return ODn(),eet;1==r?(l=a,f=d6(n.a,c,t.a,u)):(l=o,f=d6(t.a,u,n.a,c))}return X0(s=new lU(l,f.length,f)),s}function LHn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w;return l=qy(TD(mMn(t,(HXn(),Ogt)))),b=null,a==(ain(),Hvt)&&r.c.i==i?b=r.c:a==qvt&&r.d.i==i&&(b=r.d),(h=u)&&l&&!b?(WB(h.e,r),w=e.Math.max(Gy(MD(mMn(h.d,agt))),Gy(MD(mMn(r,agt)))),hon(h.d,agt,w)):(kUn(),f=PIt,b?f=b.j:vA(BB(mMn(i,ept),98))&&(f=a==Hvt?CIt:oIt),s=xHn(n,t,i,a,f,r),o=W5((vW(i),r)),a==Hvt?(SZ(o,BB(xq(s.j,0),11)),MZ(o,c)):(SZ(o,c),MZ(o,BB(xq(s.j,0),11))),h=new zfn(r,o,s,BB(mMn(s,(hWn(),dlt)),11),a,!b)),JIn(n.a,r,new L_(h.d,t,a)),h}function NHn(n,t){var e,i,r,c,a,u,o,s,h,f;if(h=null,n.d&&(h=BB(SJ(n.d,t),138)),!h){if(f=(c=n.a.Mh()).i,!n.d||NT(n.d)!=f){for(o=new xp,n.d&&Tcn(o,n.d),u=s=o.f.c+o.g.c;u0?(b=(w-1)*e,u&&(b+=i),h&&(b+=i),b=n.b[r+1])r+=2;else{if(!(e0)for(i=new t_(BB(h6(n.a,c),21)),SQ(),m$(i,new _w(t)),r=new M2(c.b,0);r.bk)?(s=2,u=DWn):0==s?(s=1,u=E):(s=0,u=E):(b=E>=u||u-E0?1:zO(isNaN(r),isNaN(0)))>=0^(rin(A3n),(e.Math.abs(o)<=A3n||0==o||isNaN(o)&&isNaN(0)?0:o<0?-1:o>0?1:zO(isNaN(o),isNaN(0)))>=0)?e.Math.max(o,r):(rin(A3n),(e.Math.abs(r)<=A3n||0==r||isNaN(r)&&isNaN(0)?0:r<0?-1:r>0?1:zO(isNaN(r),isNaN(0)))>0?e.Math.sqrt(o*o+r*r):-e.Math.sqrt(o*o+r*r))}function tqn(n,t){var e,i,r,c,a;if(t)if(!n.a&&(n.a=new _v),2!=n.e)if(1!=t.e)0!=(a=n.a.a.c.length)?0!=(c=BB(bW(n.a,a-1),117)).e&&10!=c.e||0!=t.e&&10!=t.e?Cv(n.a,t):(0==t.e||t.bm().length,0==c.e?(e=new Pk,(i=c._l())>=BQn?cO(e,Xln(i)):NX(e,i&QVn),c=new vJ(10,null,0),kU(n.a,c,a-1)):(c.bm().length,cO(e=new Pk,c.bm())),0==t.e?(i=t._l())>=BQn?cO(e,Xln(i)):NX(e,i&QVn):cO(e,t.bm()),BB(c,521).b=e.a):Cv(n.a,t);else for(r=0;r0&&i>=-6?i>=0?kZ(c,e-CJ(n.e),String.fromCharCode(46)):(c.a=fx(c.a,0,t-1)+"0."+nO(c.a,t-1),kZ(c,t+1,Bdn(qtt,0,-CJ(i)-1))):(e-t>=1&&(kZ(c,t,String.fromCharCode(46)),++e),kZ(c,e,String.fromCharCode(69)),i>0&&kZ(c,++e,String.fromCharCode(43)),kZ(c,++e,""+vz(fan(i)))),n.g=c.a,n.g))}function iqn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;if(!e.dc()){for(a=0,h=0,l=BB((i=e.Kc()).Pb(),19).a;a1&&(o=s.mg(o,n.a,u));return 1==o.c.length?BB(xq(o,o.c.length-1),220):2==o.c.length?FHn((l1(0,o.c.length),BB(o.c[0],220)),(l1(1,o.c.length),BB(o.c[1],220)),a,c):null}function uqn(n){var t,i,r,c,a,u;for(Otn(n.a,new nt),i=new Wb(n.a);i.a=e.Math.abs(r.b)?(r.b=0,a.d+a.a>u.d&&a.du.c&&a.c0){if(t=new DI(n.i,n.g),c=(e=n.i)<100?null:new Fj(e),n.ij())for(i=0;i0){for(u=n.g,s=n.i,a6(n),c=s<100?null:new Fj(s),i=0;i>13|(15&n.m)<<9,r=n.m>>4&8191,c=n.m>>17|(255&n.h)<<5,a=(1048320&n.h)>>8,g=i*(u=8191&t.l),p=r*u,v=c*u,m=a*u,0!=(o=t.l>>13|(15&t.m)<<9)&&(g+=e*o,p+=i*o,v+=r*o,m+=c*o),0!=(s=t.m>>4&8191)&&(p+=e*s,v+=i*s,m+=r*s),0!=(h=t.m>>17|(255&t.h)<<5)&&(v+=e*h,m+=i*h),0!=(f=(1048320&t.h)>>8)&&(m+=e*f),b=((d=e*u)>>22)+(g>>9)+((262143&p)<<4)+((31&v)<<17),w=(p>>18)+(v>>5)+((4095&m)<<8),w+=(b+=(l=(d&SQn)+((511&g)<<13))>>22)>>22,M$(l&=SQn,b&=SQn,w&=PQn)}function lqn(n){var t,i,r,c,a,u,o;if(0!=(o=BB(xq(n.j,0),11)).g.c.length&&0!=o.e.c.length)throw Hp(new Fy("Interactive layout does not support NORTH/SOUTH ports with incoming _and_ outgoing edges."));if(0!=o.g.c.length){for(a=RQn,i=new Wb(o.g);i.a4){if(!n.wj(t))return!1;if(n.rk()){if(u=(e=(i=BB(t,49)).Ug())==n.e&&(n.Dk()?i.Og(i.Vg(),n.zk())==n.Ak():-1-i.Vg()==n.aj()),n.Ek()&&!u&&!e&&i.Zg())for(r=0;r0&&(s=n.n.a/c);break;case 2:case 4:(r=n.i.o.b)>0&&(s=n.n.b/r)}hon(n,(hWn(),Tlt),s)}if(o=n.o,a=n.a,i)a.a=i.a,a.b=i.b,n.d=!0;else if(t!=QCt&&t!=YCt&&u!=PIt)switch(u.g){case 1:a.a=o.a/2;break;case 2:a.a=o.a,a.b=o.b/2;break;case 3:a.a=o.a/2,a.b=o.b;break;case 4:a.b=o.b/2}else a.a=o.a/2,a.b=o.b/2}function vqn(n){var t,e,i,r,c,a,u,o,s,h;if(n.ej())if(h=n.Vi(),o=n.fj(),h>0)if(t=new jcn(n.Gi()),c=(e=h)<100?null:new Fj(e),JD(n,e,t.g),r=1==e?n.Zi(4,Wtn(t,0),null,0,o):n.Zi(6,t,null,-1,o),n.bj()){for(i=new AL(t);i.e!=i.i.gc();)c=n.dj(kpn(i),c);c?(c.Ei(r),c.Fi()):n.$i(r)}else c?(c.Ei(r),c.Fi()):n.$i(r);else JD(n,n.Vi(),n.Wi()),n.$i(n.Zi(6,(SQ(),set),null,-1,o));else if(n.bj())if((h=n.Vi())>0){for(u=n.Wi(),s=h,JD(n,h,u),c=s<100?null:new Fj(s),i=0;in.d[r.p]&&(e+=n5(n.b,i)*BB(a.b,19).a,d3(n.a,iln(i)));for(;!Wy(n.a);)Mnn(n.b,BB(dU(n.a),19).a)}return e}function kqn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w;for((f=new wA(BB(ZAn(n,(SMn(),HMt)),8))).a=e.Math.max(f.a-i.b-i.c,0),f.b=e.Math.max(f.b-i.d-i.a,0),(null==(c=MD(ZAn(n,DMt)))||(kW(c),c<=0))&&(c=1.3),u=new Np,l=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));l.e!=l.i.gc();)a=new zx(BB(kpn(l),33)),u.c[u.c.length]=a;switch(BB(ZAn(n,RMt),311).g){case 3:w=aFn(u,t,f.a,f.b,(s=r,kW(c),s));break;case 1:w=vBn(u,t,f.a,f.b,(h=r,kW(c),h));break;default:w=Mqn(u,t,f.a,f.b,(o=r,kW(c),o))}KUn(n,(b=yXn(new Gtn(w),t,i,f.a,f.b,r,(kW(c),c))).a,b.b,!1,!0)}function jqn(n,t){var e,i,r,c;c=new t_((e=t.b).j),r=0,(i=e.j).c=x8(Ant,HWn,1,0,5,1),eX(BB(gan(n.b,(kUn(),sIt),(Crn(),Rst)),15),e),r=Jmn(c,r,new xr,i),eX(BB(gan(n.b,sIt,Dst),15),e),r=Jmn(c,r,new Nr,i),eX(BB(gan(n.b,sIt,xst),15),e),eX(BB(gan(n.b,oIt,Rst),15),e),eX(BB(gan(n.b,oIt,Dst),15),e),r=Jmn(c,r,new Dr,i),eX(BB(gan(n.b,oIt,xst),15),e),eX(BB(gan(n.b,SIt,Rst),15),e),r=Jmn(c,r,new Rr,i),eX(BB(gan(n.b,SIt,Dst),15),e),r=Jmn(c,r,new Kr,i),eX(BB(gan(n.b,SIt,xst),15),e),eX(BB(gan(n.b,CIt,Rst),15),e),r=Jmn(c,r,new Qr,i),eX(BB(gan(n.b,CIt,Dst),15),e),eX(BB(gan(n.b,CIt,xst),15),e)}function Eqn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(OTn(t,"Layer size calculation",1),f=RQn,h=KQn,c=!1,o=new Wb(n.b);o.a.5?p-=2*a*(w-.5):w<.5&&(p+=2*c*(.5-w)),p<(r=u.d.b)&&(p=r),d=u.d.c,p>g.a-d-h&&(p=g.a-d-h),u.n.a=t+p}}function Mqn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b;for(u=x8(xNt,qQn,25,n.c.length,15,1),ikn(l=new Xz(new Uu),n),s=0,b=new Np;0!=l.b.c.length;)if(a=BB(0==l.b.c.length?null:xq(l.b,0),157),s>1&&iG(a)*eG(a)/2>u[0]){for(c=0;cu[c];)++c;f=new Gtn(new s1(b,0,c+1)),h=iG(a)/eG(a),o=yXn(f,t,new bm,e,i,r,h),UR(kO(f.e),o),F8(eMn(l,f)),ikn(l,new s1(b,c+1,b.c.length)),b.c=x8(Ant,HWn,1,0,5,1),s=0,jG(u,u.length,0)}else null!=(0==l.b.c.length?null:xq(l.b,0))&&hrn(l,0),s>0&&(u[s]=u[s-1]),u[s]+=iG(a)*eG(a),++s,b.c[b.c.length]=a;return b}function Sqn(n){var t,e,i;if((e=BB(mMn(n,(HXn(),kgt)),163))==(Tbn(),Flt)){for(t=new oz(ZL(fbn(n).a.Kc(),new h));dAn(t);)if(!X5(BB(U5(t),17)))throw Hp(new rk(P1n+gyn(n)+"' has its layer constraint set to FIRST_SEPARATE, but has at least one incoming edge. FIRST_SEPARATE nodes must not have incoming edges."))}else if(e==Hlt)for(i=new oz(ZL(lbn(n).a.Kc(),new h));dAn(i);)if(!X5(BB(U5(i),17)))throw Hp(new rk(P1n+gyn(n)+"' has its layer constraint set to LAST_SEPARATE, but has at least one outgoing edge. LAST_SEPARATE nodes must not have outgoing edges."))}function Pqn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b;for(OTn(t,"Label dummy removal",1),i=Gy(MD(mMn(n,(HXn(),jpt)))),r=Gy(MD(mMn(n,Spt))),o=BB(mMn(n,Udt),103),u=new Wb(n.b);u.a0&&lPn(n,u,h);for(r=new Wb(h);r.a>19!=0&&(t=aon(t),o=!o),a=OLn(t),c=!1,r=!1,i=!1,n.h==CQn&&0==n.m&&0==n.l){if(r=!0,c=!0,-1!=a)return u=jAn(n,a),o&&Oon(u),e&&(ltt=M$(0,0,0)),u;n=WO((X7(),btt)),i=!0,o=!o}else n.h>>19!=0&&(c=!0,n=aon(n),i=!0,o=!o);return-1!=a?Bon(n,a,o,c,e):Kkn(n,t)<0?(e&&(ltt=c?aon(n):M$(n.l,n.m,n.h)),M$(0,0,0)):h_n(i?n:M$(n.l,n.m,n.h),t,o,c,r,e)}function $qn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;if(n.e&&n.c.ct.f||t.g>n.f)){for(e=0,i=0,a=n.w.a.ec().Kc();a.Ob();)r=BB(a.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,t.g,t.f)&&++e;for(u=n.r.a.ec().Kc();u.Ob();)r=BB(u.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,t.g,t.f)&&--e;for(o=t.w.a.ec().Kc();o.Ob();)r=BB(o.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,n.g,n.f)&&++i;for(c=t.r.a.ec().Kc();c.Ob();)r=BB(c.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,n.g,n.f)&&--i;e=0)return r=dbn(n,t.substr(1,c-1)),YUn(n,t.substr(c+1,u-(c+1)),r)}else{if(e=-1,null==Ett&&(Ett=new RegExp("\\d")),Ett.test(String.fromCharCode(a))&&(e=MK(t,YTn(46),u-1))>=0){i=BB(V5(n,Ptn(n,t.substr(1,e-1)),!1),58),o=0;try{o=l_n(t.substr(e+1),_Vn,DWn)}catch(h){throw cL(h=lun(h),127)?Hp(new L7(h)):Hp(h)}if(o=0)return e;switch(DW(B7(n,e))){case 2:if(mK("",Cfn(n,e.Hj()).ne())){if(o=m$n(n,t,u=jV(B7(n,e)),kV(B7(n,e))))return o;for(a=0,s=(r=jKn(n,t)).gc();a1)throw Hp(new _y(I7n));for(h=axn(n.e.Tg(),t),i=BB(n.g,119),a=0;a1,h=new m6(b.b);y$(h.a)||y$(h.b);)l=(s=BB(y$(h.a)?n0(h.a):n0(h.b),17)).c==b?s.d:s.c,e.Math.abs(Aon(Pun(Gk(PMt,1),sVn,8,0,[l.i.n,l.n,l.a])).b-u.b)>1&&pxn(n,s,u,a,b)}}function zqn(n){var t,i,r,c,a,u;if(c=new M2(n.e,0),r=new M2(n.a,0),n.d)for(i=0;iD3n;){for(a=t,u=0;e.Math.abs(t-a)0),c.a.Xb(c.c=--c.b),DFn(n,n.b-u,a,r,c),Px(c.b0),r.a.Xb(r.c=--r.b)}if(!n.d)for(i=0;i0?(n.f[s.p]=l/(s.e.c.length+s.g.c.length),n.c=e.Math.min(n.c,n.f[s.p]),n.b=e.Math.max(n.b,n.f[s.p])):u&&(n.f[s.p]=l)}}function Wqn(n){n.b=null,n.bb=null,n.fb=null,n.qb=null,n.a=null,n.c=null,n.d=null,n.e=null,n.f=null,n.n=null,n.M=null,n.L=null,n.Q=null,n.R=null,n.K=null,n.db=null,n.eb=null,n.g=null,n.i=null,n.j=null,n.k=null,n.gb=null,n.o=null,n.p=null,n.q=null,n.r=null,n.$=null,n.ib=null,n.S=null,n.T=null,n.t=null,n.s=null,n.u=null,n.v=null,n.w=null,n.B=null,n.A=null,n.C=null,n.D=null,n.F=null,n.G=null,n.H=null,n.I=null,n.J=null,n.P=null,n.Z=null,n.U=null,n.V=null,n.W=null,n.X=null,n.Y=null,n._=null,n.ab=null,n.cb=null,n.hb=null,n.nb=null,n.lb=null,n.mb=null,n.ob=null,n.pb=null,n.jb=null,n.kb=null,n.N=!1,n.O=!1}function Vqn(n,t,e){var i,r;for(OTn(e,"Graph transformation ("+n.a+")",1),r=a0(t.a),i=new Wb(t.b);i.a0&&(n.a=u+(l-1)*r,t.c.b+=n.a,t.f.b+=n.a),0!=b.a.gc()&&(l=AGn(new fX(1,r),t,b,w,t.f.b+u-t.c.b))>0&&(t.f.b+=u+(l-1)*r)}function Yqn(n,t){var e,i,r,c;c=n.F,null==t?(n.F=null,Dsn(n,null)):(n.F=(kW(t),t),-1!=(i=GO(t,YTn(60)))?(r=t.substr(0,i),-1==GO(t,YTn(46))&&!mK(r,$Wn)&&!mK(r,S9n)&&!mK(r,P9n)&&!mK(r,C9n)&&!mK(r,I9n)&&!mK(r,O9n)&&!mK(r,A9n)&&!mK(r,$9n)&&(r=L9n),-1!=(e=mN(t,YTn(62)))&&(r+=""+t.substr(e+1)),Dsn(n,r)):(r=t,-1==GO(t,YTn(46))&&(-1!=(i=GO(t,YTn(91)))&&(r=t.substr(0,i)),mK(r,$Wn)||mK(r,S9n)||mK(r,P9n)||mK(r,C9n)||mK(r,I9n)||mK(r,O9n)||mK(r,A9n)||mK(r,$9n)?r=t:(r=L9n,-1!=i&&(r+=""+t.substr(i)))),Dsn(n,r),r==t&&(n.F=n.D))),0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,5,c,t))}function Jqn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;if(!((d=t.b.c.length)<3)){for(b=x8(ANt,hQn,25,d,15,1),f=0,h=new Wb(t.b);h.aa)&&TU(n.b,BB(g.b,17));++u}c=a}}}function Zqn(n,t){var e;if(null==t||mK(t,zWn))return null;if(0==t.length&&n.k!=(PPn(),pMt))return null;switch(n.k.g){case 1:return mgn(t,a5n)?(hN(),vtt):mgn(t,u5n)?(hN(),ptt):null;case 2:try{return iln(l_n(t,_Vn,DWn))}catch(i){if(cL(i=lun(i),127))return null;throw Hp(i)}case 4:try{return bSn(t)}catch(i){if(cL(i=lun(i),127))return null;throw Hp(i)}case 3:return t;case 5:return rhn(n),HIn(n,t);case 6:return rhn(n),K$n(n,n.a,t);case 7:try{return(e=rAn(n)).Jf(t),e}catch(i){if(cL(i=lun(i),32))return null;throw Hp(i)}default:throw Hp(new Fy("Invalid type set for this layout option."))}}function nGn(n){var t,e,i,r,c,a,u;for(Dnn(),u=new Vv,e=new Wb(n);e.a=u.b.c)&&(u.b=t),(!u.c||t.c<=u.c.c)&&(u.d=u.c,u.c=t),(!u.e||t.d>=u.e.d)&&(u.e=t),(!u.f||t.d<=u.f.d)&&(u.f=t);return i=new Tpn((Aun(),Zat)),i2(n,out,new Jy(Pun(Gk(Jat,1),HWn,369,0,[i]))),a=new Tpn(eut),i2(n,uut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[a]))),r=new Tpn(nut),i2(n,aut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[r]))),c=new Tpn(tut),i2(n,cut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[c]))),xLn(i.c,Zat),xLn(r.c,nut),xLn(c.c,tut),xLn(a.c,eut),u.a.c=x8(Ant,HWn,1,0,5,1),gun(u.a,i.c),gun(u.a,ean(r.c)),gun(u.a,c.c),gun(u.a,ean(a.c)),u}function tGn(n){var t;switch(n.d){case 1:if(n.hj())return-2!=n.o;break;case 2:if(n.hj())return-2==n.o;break;case 3:case 5:case 4:case 6:case 7:return n.o>-2;default:return!1}switch(t=n.gj(),n.p){case 0:return null!=t&&qy(TD(t))!=JI(n.k,0);case 1:return null!=t&&BB(t,217).a!=dG(n.k)<<24>>24;case 2:return null!=t&&BB(t,172).a!=(dG(n.k)&QVn);case 6:return null!=t&&JI(BB(t,162).a,n.k);case 5:return null!=t&&BB(t,19).a!=dG(n.k);case 7:return null!=t&&BB(t,184).a!=dG(n.k)<<16>>16;case 3:return null!=t&&Gy(MD(t))!=n.j;case 4:return null!=t&&BB(t,155).a!=n.j;default:return null==t?null!=n.n:!Nfn(t,n.n)}}function eGn(n,t,e){var i,r,c,a;return n.Fk()&&n.Ek()&&GI(a=Gz(n,BB(e,56)))!==GI(e)?(n.Oi(t),n.Ui(t,B9(n,t,a)),n.rk()&&(r=BB(e,49),c=n.Dk()?n.Bk()?r.ih(n.b,Cvn(BB(itn(jY(n.b),n.aj()),18)).n,BB(itn(jY(n.b),n.aj()).Yj(),26).Bj(),null):r.ih(n.b,Awn(r.Tg(),Cvn(BB(itn(jY(n.b),n.aj()),18))),null,null):r.ih(n.b,-1-n.aj(),null,null),!BB(a,49).eh()&&(i=BB(a,49),c=n.Dk()?n.Bk()?i.gh(n.b,Cvn(BB(itn(jY(n.b),n.aj()),18)).n,BB(itn(jY(n.b),n.aj()).Yj(),26).Bj(),c):i.gh(n.b,Awn(i.Tg(),Cvn(BB(itn(jY(n.b),n.aj()),18))),null,c):i.gh(n.b,-1-n.aj(),null,c)),c&&c.Fi()),mA(n.b)&&n.$i(n.Zi(9,e,a,t,!1)),a):e}function iGn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(f=Gy(MD(mMn(n,(HXn(),Ept)))),r=Gy(MD(mMn(n,Rpt))),hon(b=new Yu,Ept,f+r),v=(h=t).d,g=h.c.i,m=h.d.i,p=tA(g.c),y=tA(m.c),c=new Np,l=p;l<=y;l++)Bl(o=new $vn(n),(uSn(),Put)),hon(o,(hWn(),dlt),h),hon(o,ept,(QEn(),XCt)),hon(o,Mpt,b),w=BB(xq(n.b,l),29),l==p?Qyn(o,w.a.c.length-i,w):PZ(o,w),(k=Gy(MD(mMn(h,agt))))<0&&hon(h,agt,k=0),o.o.b=k,d=e.Math.floor(k/2),qCn(u=new CSn,(kUn(),CIt)),CZ(u,o),u.n.b=d,qCn(s=new CSn,oIt),CZ(s,o),s.n.b=d,MZ(h,u),qan(a=new wY,h),hon(a,vgt,null),SZ(a,s),MZ(a,v),zkn(o,h,a),c.c[c.c.length]=a,h=a;return c}function rGn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(u=BB(DSn(n,(kUn(),CIt)).Kc().Pb(),11).e,f=BB(DSn(n,oIt).Kc().Pb(),11).g,a=u.c.length,g=g1(BB(xq(n.j,0),11));a-- >0;){for(l1(0,u.c.length),b=BB(u.c[0],17),l1(0,f.c.length),r=E7((i=BB(f.c[0],17)).d.e,i,0),A2(b,i.d,r),SZ(i,null),MZ(i,null),l=b.a,t&&DH(l,new wA(g)),e=spn(i.a,0);e.b!=e.d.c;)DH(l,new wA(BB(b3(e),8)));for(d=b.b,h=new Wb(i.b);h.a0&&(u=e.Math.max(u,lcn(n.C.b+r.d.b,c))),f=r,l=c,b=a;n.C&&n.C.c>0&&(w=b+n.C.c,h&&(w+=f.d.c),u=e.Math.max(u,(h$(),rin(fJn),e.Math.abs(l-1)<=fJn||1==l||isNaN(l)&&isNaN(1)?0:w/(1-l)))),i.n.b=0,i.a.a=u}function aGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w;if(i=BB(oV(n.b,t),124),(s=BB(BB(h6(n.r,t),21),84)).dc())return i.n.d=0,void(i.n.a=0);for(h=n.u.Hc((lIn(),eIt)),u=0,n.A.Hc((mdn(),_It))&&kRn(n,t),o=s.Kc(),f=null,b=0,l=0;o.Ob();)a=Gy(MD((r=BB(o.Pb(),111)).b.We((DN(),Lrt)))),c=r.b.rf().b,f?(w=l+f.d.a+n.w+r.d.d,u=e.Math.max(u,(h$(),rin(fJn),e.Math.abs(b-a)<=fJn||b==a||isNaN(b)&&isNaN(a)?0:w/(a-b)))):n.C&&n.C.d>0&&(u=e.Math.max(u,lcn(n.C.d+r.d.d,a))),f=r,b=a,l=c;n.C&&n.C.a>0&&(w=l+n.C.a,h&&(w+=f.d.a),u=e.Math.max(u,(h$(),rin(fJn),e.Math.abs(b-1)<=fJn||1==b||isNaN(b)&&isNaN(1)?0:w/(1-b)))),i.n.d=0,i.a.b=u}function uGn(n,t,e){var i,r,c,a,u,o;for(this.g=n,u=t.d.length,o=e.d.length,this.d=x8(Out,a1n,10,u+o,0,1),a=0;a0?Jtn(this,this.f/this.a):null!=lL(t.g,t.d[0]).a&&null!=lL(e.g,e.d[0]).a?Jtn(this,(Gy(lL(t.g,t.d[0]).a)+Gy(lL(e.g,e.d[0]).a))/2):null!=lL(t.g,t.d[0]).a?Jtn(this,lL(t.g,t.d[0]).a):null!=lL(e.g,e.d[0]).a&&Jtn(this,lL(e.g,e.d[0]).a)}function oGn(n,t){var e,i,r,c,a,u,o,s,h;for(n.a=new BX($cn(WPt)),i=new Wb(t.a);i.a=1&&(g-a>0&&f>=0?(o.n.a+=d,o.n.b+=c*a):g-a<0&&h>=0&&(o.n.a+=d*g,o.n.b+=c));n.o.a=t.a,n.o.b=t.b,hon(n,(HXn(),Fgt),(mdn(),new YK(i=BB(Vj(YIt),9),BB(SR(i,i.length),9),0)))}function wGn(n,t,e,i,r,c){if(null!=t&&Xbn(t,AAt,$At))throw Hp(new _y("invalid scheme: "+t));if(!(n||null!=e&&-1==GO(e,YTn(35))&&e.length>0&&(b1(0,e.length),47!=e.charCodeAt(0))))throw Hp(new _y("invalid opaquePart: "+e));if(n&&(null==t||!xT(jAt,t.toLowerCase()))&&null!=e&&Xbn(e,LAt,NAt))throw Hp(new _y(o9n+e));if(n&&null!=t&&xT(jAt,t.toLowerCase())&&!CEn(e))throw Hp(new _y(o9n+e));if(!Ubn(i))throw Hp(new _y("invalid device: "+i));if(!Rhn(r))throw Hp(new _y(null==r?"invalid segments: null":"invalid segment: "+shn(r)));if(null!=c&&-1!=GO(c,YTn(35)))throw Hp(new _y("invalid query: "+c))}function dGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(OTn(t,"Calculate Graph Size",1),t.n&&n&&y0(t,o2(n),(Bsn(),uOt)),o=ZJn,s=ZJn,a=n4n,u=n4n,l=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));l.e!=l.i.gc();)d=(h=BB(kpn(l),33)).i,g=h.j,v=h.g,r=h.f,c=BB(ZAn(h,(sWn(),$St)),142),o=e.Math.min(o,d-c.b),s=e.Math.min(s,g-c.d),a=e.Math.max(a,d+v+c.c),u=e.Math.max(u,g+r+c.a);for(b=new xC(o-(w=BB(ZAn(n,(sWn(),XSt)),116)).b,s-w.d),f=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));f.e!=f.i.gc();)Pen(h=BB(kpn(f),33),h.i-b.a),Cen(h,h.j-b.b);p=a-o+(w.b+w.c),i=u-s+(w.d+w.a),Sen(n,p),Men(n,i),t.n&&n&&y0(t,o2(n),(Bsn(),uOt))}function gGn(n){var t,e,i,r,c,a,u,o,s,h;for(i=new Np,a=new Wb(n.e.a);a.a0?(Ppn(n,e,0),e.a+=String.fromCharCode(i),Ppn(n,e,r=cgn(t,c)),c+=r-1):39==i?c+11)for(d=x8(ANt,hQn,25,n.b.b.c.length,15,1),f=0,h=new Wb(n.b.b);h.a=u&&r<=o)u<=r&&c<=o?(e[h++]=r,e[h++]=c,i+=2):u<=r?(e[h++]=r,e[h++]=o,n.b[i]=o+1,a+=2):c<=o?(e[h++]=u,e[h++]=c,i+=2):(e[h++]=u,e[h++]=o,n.b[i]=o+1);else{if(!(oKVn)&&o<10);tj(n.c,new Et),yGn(n),IU(n.c),fGn(n.f)}function EGn(n,t,e){var i,r,c,a,u,o,s,h,f,l;if(qy(TD(mMn(e,(HXn(),wgt)))))for(r=new Wb(e.j);r.a=2){for(a=BB(b3(o=spn(e,0)),8),u=BB(b3(o),8);u.a0&&Uun(o,!0,(Ffn(),FPt)),a.k==(uSn(),Mut)&&wV(o),VW(n.f,a,t)):((s=(i=BB(iY(hbn(a)),17)).c.i)==a&&(s=i.d.i),f=new rI(s,XR(B$(a.n),s.n)),VW(n.b,a,f))}function PGn(n,t,i){var r,c,a,u,o,s,h,f;switch(OTn(i,"Node promotion heuristic",1),n.g=t,yUn(n),n.q=BB(mMn(t,(HXn(),Sgt)),260),f=BB(mMn(n.g,Mgt),19).a,a=new hi,n.q.g){case 2:case 1:default:_Hn(n,a);break;case 3:for(n.q=(sNn(),Ovt),_Hn(n,a),s=0,o=new Wb(n.a);o.an.j&&(n.q=Tvt,_Hn(n,a));break;case 4:for(n.q=(sNn(),Ovt),_Hn(n,a),h=0,c=new Wb(n.b);c.an.k&&(n.q=Pvt,_Hn(n,a));break;case 6:_Hn(n,new od(CJ(e.Math.ceil(n.f.length*f/100))));break;case 5:_Hn(n,new sd(CJ(e.Math.ceil(n.d*f/100))))}oDn(n,t),HSn(i)}function CGn(n,t,e){var i,r,c,a;this.j=n,this.e=qEn(n),this.o=this.j.e,this.i=!!this.o,this.p=this.i?BB(xq(e,vW(this.o).p),214):null,r=BB(mMn(n,(hWn(),Zft)),21),this.g=r.Hc((bDn(),lft)),this.b=new Np,this.d=new wdn(this.e),a=BB(mMn(this.j,Slt),230),this.q=Han(t,a,this.e),this.k=new aZ(this),c=u6(Pun(Gk(jst,1),HWn,225,0,[this,this.d,this.k,this.q])),t!=(oin(),Omt)||qy(TD(mMn(n,(HXn(),xdt))))?t==Omt&&qy(TD(mMn(n,(HXn(),xdt))))?(i=new UEn(this.e),c.c[c.c.length]=i,this.c=new prn(i,a,BB(this.q,402))):this.c=new vP(t,this):(i=new UEn(this.e),c.c[c.c.length]=i,this.c=new G2(i,a,BB(this.q,402))),WB(c,this.c),CHn(c,this.e),this.s=wXn(this.k)}function IGn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(l=(s=BB(iL(new wg(spn(new bg(t).a.d,0))),86))?BB(mMn(s,(qqn(),ckt)),86):null,r=1;s&&l;){for(a=0,v=0,e=s,i=l,c=0;c=n.i?(++n.i,WB(n.a,iln(1)),WB(n.b,s)):(i=n.c[t.p][1],c5(n.a,o,iln(BB(xq(n.a,o),19).a+1-i)),c5(n.b,o,Gy(MD(xq(n.b,o)))+s-i*n.e)),(n.q==(sNn(),Tvt)&&(BB(xq(n.a,o),19).a>n.j||BB(xq(n.a,o-1),19).a>n.j)||n.q==Pvt&&(Gy(MD(xq(n.b,o)))>n.k||Gy(MD(xq(n.b,o-1)))>n.k))&&(u=!1),c=new oz(ZL(fbn(t).a.Kc(),new h));dAn(c);)a=BB(U5(c),17).c.i,n.f[a.p]==o&&(r+=BB((f=OGn(n,a)).a,19).a,u=u&&qy(TD(f.b)));return n.f[t.p]=o,new rI(iln(r+=n.c[t.p][0]),(hN(),!!u))}function AGn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w,d,g,p,v;for(l=new xp,u=new Np,rIn(n,i,n.d.fg(),u,l),rIn(n,r,n.d.gg(),u,l),n.b=.2*(g=BAn(wnn(new Rq(null,new w1(u,16)),new Sa)),p=BAn(wnn(new Rq(null,new w1(u,16)),new Pa)),e.Math.min(g,p)),a=0,o=0;o=2&&(v=QLn(u,!0,b),!n.e&&(n.e=new lg(n)),sgn(n.e,v,u,n.b)),iTn(u,b),czn(u),w=-1,f=new Wb(u);f.au)}function NGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(i=BB(mMn(n,(HXn(),ept)),98),u=n.f,a=n.d,o=u.a+a.b+a.c,s=0-a.d-n.c.b,f=u.b+a.d+a.a-n.c.b,h=new Np,l=new Np,c=new Wb(t);c.a0),c=BB(s.a.Xb(s.c=--s.b),17);c!=i&&s.b>0;)n.a[c.p]=!0,n.a[i.p]=!0,Px(s.b>0),c=BB(s.a.Xb(s.c=--s.b),17);s.b>0&&fW(s)}}function qGn(n,t,e){var i,r,c,a,u,o,s,h,f;if(n.a!=t.Aj())throw Hp(new _y(d6n+t.ne()+g6n));if(i=Cfn((IPn(),Z$t),t).$k())return i.Aj().Nh().Ih(i,e);if(a=Cfn(Z$t,t).al()){if(null==e)return null;if((u=BB(e,15)).dc())return"";for(f=new Sk,c=u.Kc();c.Ob();)r=c.Pb(),cO(f,a.Aj().Nh().Ih(a,r)),f.a+=" ";return KO(f,f.a.length-1)}if(!(h=Cfn(Z$t,t).bl()).dc()){for(s=h.Kc();s.Ob();)if((o=BB(s.Pb(),148)).wj(e))try{if(null!=(f=o.Aj().Nh().Ih(o,e)))return f}catch(l){if(!cL(l=lun(l),102))throw Hp(l)}throw Hp(new _y("Invalid value: '"+e+"' for datatype :"+t.ne()))}return BB(t,834).Fj(),null==e?null:cL(e,172)?""+BB(e,172).a:tsn(e)==mtt?H$(IOt[0],BB(e,199)):Bbn(e)}function GGn(n){var t,i,r,c,a,u,o,s,h;for(s=new YT,u=new YT,c=new Wb(n);c.a-1){for(r=spn(u,0);r.b!=r.d.c;)(i=BB(b3(r),128)).v=a;for(;0!=u.b;)for(t=new Wb((i=BB(tkn(u,0),128)).i);t.a0&&(e+=o.n.a+o.o.a/2,++f),b=new Wb(o.j);b.a0&&(e/=f),g=x8(xNt,qQn,25,i.a.c.length,15,1),u=0,s=new Wb(i.a);s.a=u&&r<=o)u<=r&&c<=o?i+=2:u<=r?(n.b[i]=o+1,a+=2):c<=o?(e[h++]=r,e[h++]=u-1,i+=2):(e[h++]=r,e[h++]=u-1,n.b[i]=o+1,a+=2);else{if(!(o0?r-=864e5:r+=864e5,o=new PD(rbn(fan(t.q.getTime()),r))),h=new Ik,s=n.a.length,c=0;c=97&&i<=122||i>=65&&i<=90){for(a=c+1;a=s)throw Hp(new _y("Missing trailing '"));a+10&&0==e.c&&(!t&&(t=new Np),t.c[t.c.length]=e);if(t)for(;0!=t.c.length;){if((e=BB(s6(t,0),233)).b&&e.b.c.length>0)for(!e.b&&(e.b=new Np),c=new Wb(e.b);c.aE7(n,e,0))return new rI(r,e)}else if(Gy(lL(r.g,r.d[0]).a)>Gy(lL(e.g,e.d[0]).a))return new rI(r,e);for(u=(!e.e&&(e.e=new Np),e.e).Kc();u.Ob();)!(a=BB(u.Pb(),233)).b&&(a.b=new Np),LZ(0,(o=a.b).c.length),MS(o.c,0,e),a.c==o.c.length&&(t.c[t.c.length]=a)}return null}function izn(n,t){var e,i,r,c,a,u;if(null==n)return zWn;if(null!=t.a.zc(n,t))return"[...]";for(e=new $an(FWn,"[","]"),c=0,a=(r=n).length;c=14&&u<=16?cL(i,177)?b6(e,RCn(BB(i,177))):cL(i,190)?b6(e,JEn(BB(i,190))):cL(i,195)?b6(e,kSn(BB(i,195))):cL(i,2012)?b6(e,ZEn(BB(i,2012))):cL(i,48)?b6(e,DCn(BB(i,48))):cL(i,364)?b6(e,gIn(BB(i,364))):cL(i,832)?b6(e,xCn(BB(i,832))):cL(i,104)&&b6(e,NCn(BB(i,104))):t.a._b(i)?(e.a?oO(e.a,e.b):e.a=new lN(e.d),aO(e.a,"[...]")):b6(e,izn(een(i),new $q(t))):b6(e,null==i?zWn:Bbn(i));return e.a?0==e.e.length?e.a.a:e.a.a+""+e.e:e.c}function rzn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w,d,g;for(w=qSn(cDn(t,!1,!1)),r&&(w=Jon(w)),g=Gy(MD(ZAn(t,(Epn(),pct)))),Px(0!=w.b),b=BB(w.a.a.c,8),h=BB(Dpn(w,1),8),w.b>2?(gun(s=new Np,new s1(w,1,w.b)),qan(d=new EAn(XXn(s,g+n.a)),t),i.c[i.c.length]=d):d=BB(RX(n.b,r?PMn(t):OMn(t)),266),u=PMn(t),r&&(u=OMn(t)),a=iPn(b,u),o=g+n.a,a.a?(o+=e.Math.abs(b.b-h.b),l=new xC(h.a,(h.b+b.b)/2)):(o+=e.Math.abs(b.a-h.a),l=new xC((h.a+b.a)/2,h.b)),VW(r?n.d:n.c,t,new Imn(d,a,l,o)),VW(n.b,t,d),!t.n&&(t.n=new eU(zOt,t,1,7)),f=new AL(t.n);f.e!=f.i.gc();)c=JRn(n,BB(kpn(f),137),!0,0,0),i.c[i.c.length]=c}function czn(n){var t,i,r,c,a,u,o,s,h;for(s=new Np,u=new Np,a=new Wb(n);a.a-1){for(c=new Wb(u);c.a0||(Yl(o,e.Math.min(o.o,r.o-1)),Ql(o,o.i-1),0==o.i&&(u.c[u.c.length]=o))}}function azn(n,t,e){var i,r,c,a,u;if(u=n.c,!t&&(t=L$t),n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&(a=new nU(n,1,2,u,n.c),e?e.Ei(a):e=a),u!=t)if(cL(n.Cb,284))n.Db>>16==-10?e=BB(n.Cb,284).nk(t,e):n.Db>>16==-15&&(!t&&(gWn(),t=l$t),!u&&(gWn(),u=l$t),n.Cb.nh()&&(a=new N7(n.Cb,1,13,u,t,uvn(H7(BB(n.Cb,59)),n),!1),e?e.Ei(a):e=a));else if(cL(n.Cb,88))n.Db>>16==-23&&(cL(t,88)||(gWn(),t=d$t),cL(u,88)||(gWn(),u=d$t),n.Cb.nh()&&(a=new N7(n.Cb,1,10,u,t,uvn(a4(BB(n.Cb,26)),n),!1),e?e.Ei(a):e=a));else if(cL(n.Cb,444))for(!(c=BB(n.Cb,836)).b&&(c.b=new Tp(new xm)),r=new Mp(new usn(new Pb(c.b.a).a));r.a.b;)e=azn(i=BB(ten(r.a).cd(),87),kLn(i,c),e);return e}function uzn(n,t){var e,i,r,c,a,u,o,s,h,f,l;for(a=qy(TD(ZAn(n,(HXn(),wgt)))),l=BB(ZAn(n,cpt),21),o=!1,s=!1,f=new AL((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c));!(f.e==f.i.gc()||o&&s);){for(c=BB(kpn(f),118),u=0,r=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[(!c.d&&(c.d=new hK(_Ot,c,8,5)),c.d),(!c.e&&(c.e=new hK(_Ot,c,7,4)),c.e)])));dAn(r)&&(i=BB(U5(r),79),h=a&&QIn(i)&&qy(TD(ZAn(i,dgt))),e=bqn((!i.b&&(i.b=new hK(KOt,i,4,7)),i.b),c)?n==JJ(PTn(BB(Wtn((!i.c&&(i.c=new hK(KOt,i,5,8)),i.c),0),82))):n==JJ(PTn(BB(Wtn((!i.b&&(i.b=new hK(KOt,i,4,7)),i.b),0),82))),!((h||e)&&++u>1)););(u>0||l.Hc((lIn(),eIt))&&(!c.n&&(c.n=new eU(zOt,c,1,7)),c.n).i>0)&&(o=!0),u>1&&(s=!0)}o&&t.Fc((bDn(),lft)),s&&t.Fc((bDn(),bft))}function ozn(n){var t,i,r,c,a,u,o,s,h,f,l,b;if((b=BB(ZAn(n,(sWn(),KSt)),21)).dc())return null;if(o=0,u=0,b.Hc((mdn(),KIt))){for(f=BB(ZAn(n,uPt),98),r=2,i=2,c=2,a=2,t=JJ(n)?BB(ZAn(JJ(n),bSt),103):BB(ZAn(n,bSt),103),h=new AL((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c));h.e!=h.i.gc();)if(s=BB(kpn(h),118),(l=BB(ZAn(s,wPt),61))==(kUn(),PIt)&&(l=OFn(s,t),Ypn(s,wPt,l)),f==(QEn(),XCt))switch(l.g){case 1:r=e.Math.max(r,s.i+s.g);break;case 2:i=e.Math.max(i,s.j+s.f);break;case 3:c=e.Math.max(c,s.i+s.g);break;case 4:a=e.Math.max(a,s.j+s.f)}else switch(l.g){case 1:r+=s.g+2;break;case 2:i+=s.f+2;break;case 3:c+=s.g+2;break;case 4:a+=s.f+2}o=e.Math.max(r,c),u=e.Math.max(i,a)}return KUn(n,o,u,!0,!0)}function szn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(m=BB(P4(ytn(AV(new Rq(null,new w1(t.d,16)),new $d(i)),new Ld(i)),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),l=DWn,f=_Vn,s=new Wb(t.b.j);s.a0)?s&&(h=d.p,a?++h:--h,f=!(cNn(i=ion(BB(xq(d.c.a,h),10)),y,e[0])||Bz(i,y,e[0]))):f=!0),l=!1,(m=t.D.i)&&m.c&&u.e&&(a&&m.p>0||!a&&m.p0&&(t.a+=FWn),gzn(BB(kpn(a),160),t);for(t.a+=e1n,u=new cx((!i.c&&(i.c=new hK(KOt,i,5,8)),i.c));u.e!=u.i.gc();)u.e>0&&(t.a+=FWn),gzn(BB(kpn(u),160),t);t.a+=")"}}}function pzn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;if(c=BB(mMn(n,(hWn(),dlt)),79)){for(i=n.a,UR(r=new wA(e),$jn(n)),wan(n.d.i,n.c.i)?(l=n.c,XR(f=Aon(Pun(Gk(PMt,1),sVn,8,0,[l.n,l.a])),e)):f=g1(n.c),r5(i,f,i.a,i.a.a),b=g1(n.d),null!=mMn(n,Rlt)&&UR(b,BB(mMn(n,Rlt),8)),r5(i,b,i.c.b,i.c),Ztn(i,r),Lin(a=cDn(c,!0,!0),BB(Wtn((!c.b&&(c.b=new hK(KOt,c,4,7)),c.b),0),82)),Nin(a,BB(Wtn((!c.c&&(c.c=new hK(KOt,c,5,8)),c.c),0),82)),VFn(i,a),h=new Wb(n.b);h.a=0){for(o=null,u=new M2(h.a,s+1);u.ba?1:zO(isNaN(0),isNaN(a)))<0&&(rin(A3n),(e.Math.abs(a-1)<=A3n||1==a||isNaN(a)&&isNaN(1)?0:a<1?-1:a>1?1:zO(isNaN(a),isNaN(1)))<0)&&(rin(A3n),(e.Math.abs(0-u)<=A3n||0==u||isNaN(0)&&isNaN(u)?0:0u?1:zO(isNaN(0),isNaN(u)))<0)&&(rin(A3n),(e.Math.abs(u-1)<=A3n||1==u||isNaN(u)&&isNaN(1)?0:u<1?-1:u>1?1:zO(isNaN(u),isNaN(1)))<0))}function yzn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j;for(f=new hW(new iw(n));f.b!=f.c.a.d;)for(u=BB((h=s9(f)).d,56),t=BB(h.e,56),d=0,y=(null==(a=u.Tg()).i&&qFn(a),a.i).length;d=0&&d=s.c.c.length?X3((uSn(),Cut),Put):X3((uSn(),Put),Put),h*=2,c=i.a.g,i.a.g=e.Math.max(c,c+(h-c)),a=i.b.g,i.b.g=e.Math.max(a,a+(h-a)),r=t}else zAn(u),AHn((l1(0,u.c.length),BB(u.c[0],17)).d.i)||WB(n.o,u)}function Ezn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(m=GB(n),o=new Np,s=(c=n.c.length)-1,h=c+1;0!=m.a.c;){for(;0!=e.b;)Px(0!=e.b),p=BB(Atn(e,e.a.a),112),$J(m.a,p),p.g=s--,NFn(p,t,e,i);for(;0!=t.b;)Px(0!=t.b),v=BB(Atn(t,t.a.a),112),$J(m.a,v),v.g=h++,NFn(v,t,e,i);for(u=_Vn,d=new Fb(new BR(new xN(new _b(m.a).a).b));aS(d.a.a);){if(w=BB(mx(d.a).cd(),112),!i&&w.b>0&&w.a<=0){o.c=x8(Ant,HWn,1,0,5,1),o.c[o.c.length]=w;break}(b=w.i-w.d)>=u&&(b>u&&(o.c=x8(Ant,HWn,1,0,5,1),u=b),o.c[o.c.length]=w)}0!=o.c.length&&(a=BB(xq(o,pvn(r,o.c.length)),112),$J(m.a,a),a.g=h++,NFn(a,t,e,i),o.c=x8(Ant,HWn,1,0,5,1))}for(g=n.c.length+1,l=new Wb(n);l.a0&&(b.d+=f.n.d,b.d+=f.d),b.a>0&&(b.a+=f.n.a,b.a+=f.d),b.b>0&&(b.b+=f.n.b,b.b+=f.d),b.c>0&&(b.c+=f.n.c,b.c+=f.d),b}function Czn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d;for(b=i.d,l=i.c,u=(a=new xC(i.f.a+i.d.b+i.d.c,i.f.b+i.d.d+i.d.a)).b,h=new Wb(n.a);h.a0&&(n.c[t.c.p][t.p].d+=H$n(n.i,24)*uYn*.07000000029802322-.03500000014901161,n.c[t.c.p][t.p].a=n.c[t.c.p][t.p].d/n.c[t.c.p][t.p].b)}}function Dzn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w;for(l=new Wb(n);l.ar.d,r.d=e.Math.max(r.d,t),o&&i&&(r.d=e.Math.max(r.d,r.a),r.a=r.d+c);break;case 3:i=t>r.a,r.a=e.Math.max(r.a,t),o&&i&&(r.a=e.Math.max(r.a,r.d),r.d=r.a+c);break;case 2:i=t>r.c,r.c=e.Math.max(r.c,t),o&&i&&(r.c=e.Math.max(r.b,r.c),r.b=r.c+c);break;case 4:i=t>r.b,r.b=e.Math.max(r.b,t),o&&i&&(r.b=e.Math.max(r.b,r.c),r.c=r.b+c)}}}function Fzn(n){var t,e,i,r,c,a,u,o,s,h,f;for(s=new Wb(n);s.a0||h.j==CIt&&h.e.c.length-h.g.c.length<0)){t=!1;break}for(r=new Wb(h.g);r.a=h&&j>=p&&(b+=d.n.b+g.n.b+g.a.b-k,++o));if(i)for(u=new Wb(m.e);u.a=h&&j>=p&&(b+=d.n.b+g.n.b+g.a.b-k,++o))}o>0&&(E+=b/o,++w)}w>0?(t.a=c*E/w,t.g=w):(t.a=0,t.g=0)}function Hzn(n,t){var e,i,r,c,a,u,o,s,h,f;for(i=new Wb(n.a.b);i.aKQn||t.o==ryt&&s0&&Pen(p,y*j),k>0&&Cen(p,k*E);for(nan(n.b,new lt),t=new Np,u=new usn(new Pb(n.c).a);u.b;)i=BB((a=ten(u)).cd(),79),e=BB(a.dd(),395).a,r=cDn(i,!1,!1),VFn(f=lTn(PMn(i),qSn(r),e),r),(m=CMn(i))&&-1==E7(t,m,0)&&(t.c[t.c.length]=m,sQ(m,(Px(0!=f.b),BB(f.a.a.c,8)),e));for(g=new usn(new Pb(n.d).a);g.b;)i=BB((d=ten(g)).cd(),79),e=BB(d.dd(),395).a,r=cDn(i,!1,!1),f=lTn(OMn(i),Jon(qSn(r)),e),VFn(f=Jon(f),r),(m=IMn(i))&&-1==E7(t,m,0)&&(t.c[t.c.length]=m,sQ(m,(Px(0!=f.b),BB(f.c.b.c,8)),e))}function Xzn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;if(0!=i.c.length){for(w=new Np,b=new Wb(i);b.a1)for(e5(m,new sC(n,b=new hqn(w,m,r))),u.c[u.c.length]=b,f=m.a.ec().Kc();f.Ob();)y7(a,BB(f.Pb(),46).b);if(o.a.gc()>1)for(e5(o,new hC(n,b=new hqn(w,o,r))),u.c[u.c.length]=b,f=o.a.ec().Kc();f.Ob();)y7(a,BB(f.Pb(),46).b)}}function tUn(n){NM(n,new MTn(dj(vj(wj(pj(gj(new du,w4n),"ELK Radial"),'A radial layout provider which is based on the algorithm of Peter Eades published in "Drawing free trees.", published by International Institute for Advanced Study of Social Information Science, Fujitsu Limited in 1991. The radial layouter takes a tree and places the nodes in radial order around the root. The nodes of the same tree level are placed on the same radius.'),new Ha),w4n))),u2(n,w4n,g3n,mpn(xjt)),u2(n,w4n,vZn,mpn(Kjt)),u2(n,w4n,PZn,mpn(Cjt)),u2(n,w4n,BZn,mpn(Ijt)),u2(n,w4n,SZn,mpn(Ojt)),u2(n,w4n,CZn,mpn(Pjt)),u2(n,w4n,MZn,mpn(Ajt)),u2(n,w4n,IZn,mpn(Njt)),u2(n,w4n,h4n,mpn(Mjt)),u2(n,w4n,s4n,mpn(Sjt)),u2(n,w4n,b4n,mpn($jt)),u2(n,w4n,u4n,mpn(Ljt)),u2(n,w4n,o4n,mpn(Djt)),u2(n,w4n,f4n,mpn(Rjt)),u2(n,w4n,l4n,mpn(_jt))}function eUn(n){var t;if(this.r=xV(new Pn,new Cn),this.b=new Hbn(BB(yX(FIt),290)),this.p=new Hbn(BB(yX(FIt),290)),this.i=new Hbn(BB(yX(Krt),290)),this.e=n,this.o=new wA(n.rf()),this.D=n.Df()||qy(TD(n.We((sWn(),SSt)))),this.A=BB(n.We((sWn(),KSt)),21),this.B=BB(n.We(qSt),21),this.q=BB(n.We(uPt),98),this.u=BB(n.We(fPt),21),!wMn(this.u))throw Hp(new rk("Invalid port label placement: "+this.u));if(this.v=qy(TD(n.We(bPt))),this.j=BB(n.We(DSt),21),!tLn(this.j))throw Hp(new rk("Invalid node label placement: "+this.j));this.n=BB(nkn(n,NSt),116),this.k=Gy(MD(nkn(n,OPt))),this.d=Gy(MD(nkn(n,IPt))),this.w=Gy(MD(nkn(n,RPt))),this.s=Gy(MD(nkn(n,APt))),this.t=Gy(MD(nkn(n,$Pt))),this.C=BB(nkn(n,xPt),142),this.c=2*this.d,t=!this.B.Hc((n_n(),HIt)),this.f=new Ign(0,t,0),this.g=new Ign(1,t,0),jy(this.f,(Dtn(),zit),this.g)}function iUn(n,t,i,r,c){var a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S;for(y=0,g=0,d=0,w=1,m=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));m.e!=m.i.gc();)w+=F3(new oz(ZL(dLn(p=BB(kpn(m),33)).a.Kc(),new h))),T=p.g,g=e.Math.max(g,T),b=p.f,d=e.Math.max(d,b),y+=T*b;for(u=y+2*r*r*w*(!n.a&&(n.a=new eU(UOt,n,10,11)),n.a).i,a=e.Math.sqrt(u),s=e.Math.max(a*i,g),o=e.Math.max(a/i,d),v=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));v.e!=v.i.gc();)p=BB(kpn(v),33),M=c.b+(H$n(t,26)*rYn+H$n(t,27)*cYn)*(s-p.g),S=c.b+(H$n(t,26)*rYn+H$n(t,27)*cYn)*(o-p.f),Pen(p,M),Cen(p,S);for(E=s+(c.b+c.c),j=o+(c.d+c.a),k=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));k.e!=k.i.gc();)for(l=new oz(ZL(dLn(BB(kpn(k),33)).a.Kc(),new h));dAn(l);)nAn(f=BB(U5(l),79))||BXn(f,t,E,j);KUn(n,E+=c.b+c.c,j+=c.d+c.a,!1,!0)}function rUn(n){var t,e,i,r,c,a,u,o,s,h,f;if(null==n)throw Hp(new Mk(zWn));if(s=n,o=!1,(c=n.length)>0&&(b1(0,n.length),45!=(t=n.charCodeAt(0))&&43!=t||(n=n.substr(1),--c,o=45==t)),0==c)throw Hp(new Mk(DQn+s+'"'));for(;n.length>0&&(b1(0,n.length),48==n.charCodeAt(0));)n=n.substr(1),--c;if(c>(iFn(),xtt)[10])throw Hp(new Mk(DQn+s+'"'));for(r=0;r0&&(f=-parseInt(n.substr(0,i),10),n=n.substr(i),c-=i,e=!1);c>=a;){if(i=parseInt(n.substr(0,a),10),n=n.substr(a),c-=a,e)e=!1;else{if(Vhn(f,u)<0)throw Hp(new Mk(DQn+s+'"'));f=cbn(f,h)}f=ibn(f,i)}if(Vhn(f,0)>0)throw Hp(new Mk(DQn+s+'"'));if(!o&&Vhn(f=j7(f),0)<0)throw Hp(new Mk(DQn+s+'"'));return f}function cUn(n,t){var e,i,r,c,a,u,o;if(ZH(),this.a=new X$(this),this.b=n,this.c=t,this.f=OU(B7((IPn(),Z$t),t)),this.f.dc())if((u=mjn(Z$t,n))==t)for(this.e=!0,this.d=new Np,this.f=new fo,this.f.Fc(S7n),BB(NHn(F7(Z$t,Utn(n)),""),26)==n&&this.f.Fc(az(Z$t,Utn(n))),r=EKn(Z$t,n).Kc();r.Ob();)switch(i=BB(r.Pb(),170),DW(B7(Z$t,i))){case 4:this.d.Fc(i);break;case 5:this.f.Gc(OU(B7(Z$t,i)))}else if(ZM(),BB(t,66).Oj())for(this.e=!0,this.f=null,this.d=new Np,a=0,o=(null==n.i&&qFn(n),n.i).length;a=0&&a0&&(BB(oV(n.b,t),124).a.b=i)}function uUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(OTn(t,"Comment pre-processing",1),e=0,o=new Wb(n.a);o.a0&&(b1(0,t.length),64!=(u=t.charCodeAt(0)))){if(37==u&&(o=!1,0!=(h=t.lastIndexOf("%"))&&(h==f-1||(b1(h+1,t.length),o=46==t.charCodeAt(h+1))))){if(v=mK("%",a=t.substr(1,h-1))?null:$Un(a),i=0,o)try{i=l_n(t.substr(h+2),_Vn,DWn)}catch(m){throw cL(m=lun(m),127)?Hp(new L7(m)):Hp(m)}for(d=Ern(n.Wg());d.Ob();)if(cL(b=Man(d),510)&&(p=(r=BB(b,590)).d,(null==v?null==p:mK(v,p))&&0==i--))return r;return null}if(l=-1==(s=t.lastIndexOf("."))?t:t.substr(0,s),e=0,-1!=s)try{e=l_n(t.substr(s+1),_Vn,DWn)}catch(m){if(!cL(m=lun(m),127))throw Hp(m);l=t}for(l=mK("%",l)?null:$Un(l),w=Ern(n.Wg());w.Ob();)if(cL(b=Man(w),191)&&(g=(c=BB(b,191)).ne(),(null==l?null==g:mK(l,g))&&0==e--))return c;return null}return _qn(n,t)}function fUn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T;for(m=new Np,f=new Wb(n.b);f.a=n.length)return{done:!0};var i=n[e++];return{value:[i,t.get(i)],done:!1}}}},zDn()||(n.prototype.createObject=function(){return{}},n.prototype.get=function(n){return this.obj[":"+n]},n.prototype.set=function(n,t){this.obj[":"+n]=t},n.prototype[iYn]=function(n){delete this.obj[":"+n]},n.prototype.keys=function(){var n=[];for(var t in this.obj)58==t.charCodeAt(0)&&n.push(t.substring(1));return n}),n}function wUn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d;if(PFn(),null==n)return null;if(0==(f=8*n.length))return"";for(l=f/24|0,c=null,c=x8(ONt,WVn,25,4*(0!=(u=f%24)?l+1:l),15,1),s=0,h=0,t=0,e=0,i=0,a=0,r=0,o=0;o>24,s=(3&t)<<24>>24,b=0==(-128&t)?t>>2<<24>>24:(t>>2^192)<<24>>24,w=0==(-128&e)?e>>4<<24>>24:(e>>4^240)<<24>>24,d=0==(-128&(i=n[r++]))?i>>6<<24>>24:(i>>6^252)<<24>>24,c[a++]=VLt[b],c[a++]=VLt[w|s<<4],c[a++]=VLt[h<<2|d],c[a++]=VLt[63&i];return 8==u?(s=(3&(t=n[r]))<<24>>24,b=0==(-128&t)?t>>2<<24>>24:(t>>2^192)<<24>>24,c[a++]=VLt[b],c[a++]=VLt[s<<4],c[a++]=61,c[a++]=61):16==u&&(t=n[r],h=(15&(e=n[r+1]))<<24>>24,s=(3&t)<<24>>24,b=0==(-128&t)?t>>2<<24>>24:(t>>2^192)<<24>>24,w=0==(-128&e)?e>>4<<24>>24:(e>>4^240)<<24>>24,c[a++]=VLt[b],c[a++]=VLt[w|s<<4],c[a++]=VLt[h<<2],c[a++]=61),Bdn(c,0,c.length)}function dUn(n,t){var i,r,c,a,u,o;if(0==n.e&&n.p>0&&(n.p=-(n.p-1)),n.p>_Vn&&e4(t,n.p-sQn),u=t.q.getDate(),FJ(t,1),n.k>=0&&vZ(t,n.k),n.c>=0?FJ(t,n.c):n.k>=0?(r=35-new von(t.q.getFullYear()-sQn,t.q.getMonth(),35).q.getDate(),FJ(t,e.Math.min(r,u))):FJ(t,u),n.f<0&&(n.f=t.q.getHours()),n.b>0&&n.f<12&&(n.f+=12),aL(t,24==n.f&&n.g?0:n.f),n.j>=0&&g6(t,n.j),n.n>=0&&U8(t,n.n),n.i>=0&&dO(t,rbn(cbn(Ojn(fan(t.q.getTime()),VVn),VVn),n.i)),n.a&&(e4(c=new AT,c.q.getFullYear()-sQn-80),sS(fan(t.q.getTime()),fan(c.q.getTime()))&&e4(t,c.q.getFullYear()-sQn+100)),n.d>=0)if(-1==n.c)(i=(7+n.d-t.q.getDay())%7)>3&&(i-=7),o=t.q.getMonth(),FJ(t,t.q.getDate()+i),t.q.getMonth()!=o&&FJ(t,t.q.getDate()+(i>0?-7:7));else if(t.q.getDay()!=n.d)return!1;return n.o>_Vn&&(a=t.q.getTimezoneOffset(),dO(t,rbn(fan(t.q.getTime()),60*(n.o-a)*VVn))),!0}function gUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;if(cL(r=mMn(t,(hWn(),dlt)),239)){for(b=BB(r,33),w=t.e,f=new wA(t.c),c=t.d,f.a+=c.b,f.b+=c.d,SN(BB(ZAn(b,(HXn(),qgt)),174),(n_n(),qIt))&&(Ol(l=BB(ZAn(b,zgt),116),c.a),_l(l,c.d),Al(l,c.b),Fl(l,c.c)),e=new Np,s=new Wb(t.a);s.a0&&WB(n.p,l),WB(n.o,l);d=s+(t-=r),f+=t*n.e,c5(n.a,o,iln(d)),c5(n.b,o,f),n.j=e.Math.max(n.j,d),n.k=e.Math.max(n.k,f),n.d+=t,t+=p}}function kUn(){var n;kUn=O,PIt=new WC(hJn,0),sIt=new WC(mJn,1),oIt=new WC(yJn,2),SIt=new WC(kJn,3),CIt=new WC(jJn,4),SQ(),wIt=new Ak(new YK(n=BB(Vj(FIt),9),BB(SR(n,n.length),9),0)),dIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[]))),hIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[]))),EIt=ffn(EG(SIt,Pun(Gk(FIt,1),YZn,61,0,[]))),MIt=ffn(EG(CIt,Pun(Gk(FIt,1),YZn,61,0,[]))),yIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[SIt]))),bIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[CIt]))),jIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[CIt]))),gIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt]))),TIt=ffn(EG(SIt,Pun(Gk(FIt,1),YZn,61,0,[CIt]))),fIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[SIt]))),mIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt,CIt]))),lIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[SIt,CIt]))),kIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[SIt,CIt]))),pIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt,SIt]))),vIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt,SIt,CIt])))}function jUn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;if(0!=t.b){for(l=new YT,a=null,b=null,i=CJ(e.Math.floor(e.Math.log(t.b)*e.Math.LOG10E)+1),u=0,v=spn(t,0);v.b!=v.d.c;)for(g=BB(b3(v),86),GI(b)!==GI(mMn(g,(qqn(),rkt)))&&(b=SD(mMn(g,rkt)),u=0),a=null!=b?b+d0(u++,i):d0(u++,i),hon(g,rkt,a),d=new wg(spn(new bg(g).a.d,0));EE(d.a);)r5(l,w=BB(b3(d.a),188).c,l.c.b,l.c),hon(w,rkt,a);for(f=new xp,c=0;c=s){Px(v.b>0),v.a.Xb(v.c=--v.b);break}g.a>h&&(c?(gun(c.b,g.b),c.a=e.Math.max(c.a,g.a),fW(v)):(WB(g.b,l),g.c=e.Math.min(g.c,h),g.a=e.Math.max(g.a,s),c=g))}c||((c=new im).c=h,c.a=s,yR(v,c),WB(c.b,l))}for(o=t.b,f=0,p=new Wb(r);p.au?1:0:(n.b&&(n.b._b(c)&&(r=BB(n.b.xc(c),19).a),n.b._b(o)&&(u=BB(n.b.xc(o),19).a)),ru?1:0)):0!=t.e.c.length&&0!=e.g.c.length?1:-1}function MUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(OTn(t,O1n,1),w=new Np,y=new Np,s=new Wb(n.b);s.a0&&(k-=d),Tqn(u,k),l=0,w=new Wb(u.a);w.a0),o.a.Xb(o.c=--o.b)),s=.4*r*l,!a&&o.bt.d.c){if((b=n.c[t.a.d])==(g=n.c[f.a.d]))continue;UNn(aM(cM(uM(rM(new Hv,1),100),b),g))}}}function $Un(n){var t,e,i,r,c,a,u,o;if(RHn(),null==n)return null;if((r=GO(n,YTn(37)))<0)return n;for(o=new lN(n.substr(0,r)),t=x8(NNt,v6n,25,4,15,1),u=0,i=0,a=n.length;rr+2&&ton((b1(r+1,n.length),n.charCodeAt(r+1)),IAt,OAt)&&ton((b1(r+2,n.length),n.charCodeAt(r+2)),IAt,OAt))if(e=CH((b1(r+1,n.length),n.charCodeAt(r+1)),(b1(r+2,n.length),n.charCodeAt(r+2))),r+=2,i>0?128==(192&e)?t[u++]=e<<24>>24:i=0:e>=128&&(192==(224&e)?(t[u++]=e<<24>>24,i=2):224==(240&e)?(t[u++]=e<<24>>24,i=3):240==(248&e)&&(t[u++]=e<<24>>24,i=4)),i>0){if(u==i){switch(u){case 2:xX(o,((31&t[0])<<6|63&t[1])&QVn);break;case 3:xX(o,((15&t[0])<<12|(63&t[1])<<6|63&t[2])&QVn)}u=0,i=0}}else{for(c=0;c0){if(a+i>n.length)return!1;u=UIn(n.substr(0,a+i),t)}else u=UIn(n,t);switch(c){case 71:return u=zTn(n,a,Pun(Gk(Qtt,1),sVn,2,6,[fQn,lQn]),t),r.e=u,!0;case 77:return gDn(n,t,r,u,a);case 76:return pDn(n,t,r,u,a);case 69:return rCn(n,t,a,r);case 99:return cCn(n,t,a,r);case 97:return u=zTn(n,a,Pun(Gk(Qtt,1),sVn,2,6,["AM","PM"]),t),r.b=u,!0;case 121:return vDn(n,t,a,u,e,r);case 100:return!(u<=0||(r.c=u,0));case 83:return!(u<0)&&jwn(u,a,t[0],r);case 104:12==u&&(u=0);case 75:case 72:return!(u<0||(r.f=u,r.g=!1,0));case 107:return!(u<0||(r.f=u,r.g=!0,0));case 109:return!(u<0||(r.j=u,0));case 115:return!(u<0||(r.n=u,0));case 90:if(aE&&(d.c=E-d.b),WB(u.d,new xG(d,kln(u,d))),m=t==sIt?e.Math.max(m,g.b+h.b.rf().b):e.Math.min(m,g.b));for(m+=t==sIt?n.t:-n.t,(y=Pwn((u.e=m,u)))>0&&(BB(oV(n.b,t),124).a.b=y),f=b.Kc();f.Ob();)!(h=BB(f.Pb(),111)).c||h.c.d.c.length<=0||((d=h.c.i).c-=h.e.a,d.d-=h.e.b)}else aUn(n,t)}function xUn(n){var t,e,i,r,c,a,u,o,s,f;for(t=new xp,a=new AL(n);a.e!=a.i.gc();){for(c=BB(kpn(a),33),e=new Rv,VW(Mct,c,e),f=new ut,i=BB(P4(new Rq(null,new zU(new oz(ZL(wLn(c).a.Kc(),new h)))),SG(f,m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)])))),83),Jen(e,BB(i.xc((hN(),!0)),14),new ot),r=BB(P4(AV(BB(i.xc(!1),15).Lc(),new st),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[Uet]))),15).Kc();r.Ob();)(s=CMn(BB(r.Pb(),79)))&&((u=BB(qI(AY(t.f,s)),21))||(u=Oxn(s),jCn(t.f,s,u)),Frn(e,u));for(i=BB(P4(new Rq(null,new zU(new oz(ZL(dLn(c).a.Kc(),new h)))),SG(f,m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[Uet])))),83),Jen(e,BB(i.xc(!0),14),new ht),o=BB(P4(AV(BB(i.xc(!1),15).Lc(),new ft),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[Uet]))),15).Kc();o.Ob();)(s=IMn(BB(o.Pb(),79)))&&((u=BB(qI(AY(t.f,s)),21))||(u=Oxn(s),jCn(t.f,s,u)),Frn(e,u))}}function DUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d;if(uHn(),(o=Vhn(n,0)<0)&&(n=j7(n)),0==Vhn(n,0))switch(t){case 0:return"0";case 1:return WQn;case 2:return"0.00";case 3:return"0.000";case 4:return"0.0000";case 5:return"0.00000";case 6:return"0.000000";default:return(b=new Ck).a+=t<0?"0E+":"0E",b.a+=t==_Vn?"2147483648":""+-t,b.a}f=x8(ONt,WVn,25,1+(h=18),15,1),e=h,d=n;do{s=d,d=Ojn(d,10),f[--e]=dG(rbn(48,ibn(s,cbn(d,10))))&QVn}while(0!=Vhn(d,0));if(r=ibn(ibn(ibn(h,e),t),1),0==t)return o&&(f[--e]=45),Bdn(f,e,h-e);if(t>0&&Vhn(r,-6)>=0){if(Vhn(r,0)>=0){for(c=e+dG(r),u=h-1;u>=c;u--)f[u+1]=f[u];return f[++c]=46,o&&(f[--e]=45),Bdn(f,e,h-e+1)}for(a=2;sS(a,rbn(j7(r),1));a++)f[--e]=48;return f[--e]=46,f[--e]=48,o&&(f[--e]=45),Bdn(f,e,h-e)}return w=e+1,i=h,l=new Ik,o&&(l.a+="-"),i-w>=1?(xX(l,f[e]),l.a+=".",l.a+=Bdn(f,e+1,h-e-1)):l.a+=Bdn(f,e,h-e),l.a+="E",Vhn(r,0)>0&&(l.a+="+"),l.a+=""+vz(r),l.a}function RUn(n,t,e){var i,r,c,a,u,o,s,h,f,l;if(n.e.a.$b(),n.f.a.$b(),n.c.c=x8(Ant,HWn,1,0,5,1),n.i.c=x8(Ant,HWn,1,0,5,1),n.g.a.$b(),t)for(a=new Wb(t.a);a.a=1&&(j-h>0&&d>=0?(Pen(l,l.i+k),Cen(l,l.j+s*h)):j-h<0&&w>=0&&(Pen(l,l.i+k*j),Cen(l,l.j+s)));return Ypn(n,(sWn(),KSt),(mdn(),new YK(a=BB(Vj(YIt),9),BB(SR(a,a.length),9),0))),new xC(E,f)}function _Un(n){var t,i,r,c,a,u,o,s,h,f,l;if(f=JJ(PTn(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)))==JJ(PTn(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82))),u=new Gj,(t=BB(ZAn(n,(Xsn(),hCt)),74))&&t.b>=2){if(0==(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i)tE(),i=new co,f9((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),i);else if((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i>1)for(l=new cx((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a));l.e!=l.i.gc();)Qjn(l);VFn(t,BB(Wtn((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),0),202))}if(f)for(r=new AL((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a));r.e!=r.i.gc();)for(s=new AL((!(i=BB(kpn(r),202)).a&&(i.a=new $L(xOt,i,5)),i.a));s.e!=s.i.gc();)o=BB(kpn(s),469),u.a=e.Math.max(u.a,o.a),u.b=e.Math.max(u.b,o.b);for(a=new AL((!n.n&&(n.n=new eU(zOt,n,1,7)),n.n));a.e!=a.i.gc();)c=BB(kpn(a),137),(h=BB(ZAn(c,gCt),8))&&SA(c,h.a,h.b),f&&(u.a=e.Math.max(u.a,c.i+c.g),u.b=e.Math.max(u.b,c.j+c.f));return u}function FUn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;for(v=t.c.length,c=new qKn(n.a,i,null,null),E=x8(xNt,qQn,25,v,15,1),w=x8(xNt,qQn,25,v,15,1),b=x8(xNt,qQn,25,v,15,1),d=0,o=0;oE[s]&&(d=s),f=new Wb(n.a.b);f.aw&&(a&&(fO(j,b),fO(T,iln(h.b-1))),I=i.b,O+=b+t,b=0,f=e.Math.max(f,i.b+i.c+C)),Pen(o,I),Cen(o,O),f=e.Math.max(f,I+C+i.c),b=e.Math.max(b,l),I+=C+t;if(f=e.Math.max(f,r),(P=O+b+i.a)lZn,S=e.Math.abs(b.b-d.b)>lZn,(!i&&M&&S||i&&(M||S))&&DH(p.a,k)),Frn(p.a,r),0==r.b?b=k:(Px(0!=r.b),b=BB(r.c.b.c,8)),Yan(w,l,g),acn(c)==T&&(vW(T.i)!=c.a&&OPn(g=new Gj,vW(T.i),m),hon(p,Rlt,g)),MSn(w,p,m),f.a.zc(w,f);SZ(p,j),MZ(p,T)}for(h=f.a.ec().Kc();h.Ob();)SZ(s=BB(h.Pb(),17),null),MZ(s,null);HSn(t)}function GUn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;if(1==n.gc())return BB(n.Xb(0),231);if(n.gc()<=0)return new y6;for(c=n.Kc();c.Ob();){for(i=BB(c.Pb(),231),d=0,f=DWn,l=DWn,s=_Vn,h=_Vn,w=new Wb(i.e);w.ao&&(y=0,k+=u+v,u=0),VKn(g,i,y,k),t=e.Math.max(t,y+p.a),u=e.Math.max(u,p.b),y+=p.a+v;return g}function zUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;switch(h=new km,n.a.g){case 3:l=BB(mMn(t.e,(hWn(),Nlt)),15),b=BB(mMn(t.j,Nlt),15),w=BB(mMn(t.f,Nlt),15),e=BB(mMn(t.e,$lt),15),i=BB(mMn(t.j,$lt),15),r=BB(mMn(t.f,$lt),15),gun(a=new Np,l),b.Jc(new yc),gun(a,cL(b,152)?o6(BB(b,152)):cL(b,131)?BB(b,131).a:cL(b,54)?new fy(b):new CT(b)),gun(a,w),gun(c=new Np,e),gun(c,cL(i,152)?o6(BB(i,152)):cL(i,131)?BB(i,131).a:cL(i,54)?new fy(i):new CT(i)),gun(c,r),hon(t.f,Nlt,a),hon(t.f,$lt,c),hon(t.f,xlt,t.f),hon(t.e,Nlt,null),hon(t.e,$lt,null),hon(t.j,Nlt,null),hon(t.j,$lt,null);break;case 1:Frn(h,t.e.a),DH(h,t.i.n),Frn(h,ean(t.j.a)),DH(h,t.a.n),Frn(h,t.f.a);break;default:Frn(h,t.e.a),Frn(h,ean(t.j.a)),Frn(h,t.f.a)}yQ(t.f.a),Frn(t.f.a,h),SZ(t.f,t.e.c),u=BB(mMn(t.e,(HXn(),vgt)),74),s=BB(mMn(t.j,vgt),74),o=BB(mMn(t.f,vgt),74),(u||s||o)&&(PU(f=new km,o),PU(f,s),PU(f,u),hon(t.f,vgt,f)),SZ(t.j,null),MZ(t.j,null),SZ(t.e,null),MZ(t.e,null),PZ(t.a,null),PZ(t.i,null),t.g&&zUn(n,t.g)}function UUn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;if(PFn(),null==n)return null;if((w=bln(c=V7(n)))%4!=0)return null;if(0==(d=w/4|0))return x8(NNt,v6n,25,0,15,1);for(f=null,t=0,e=0,i=0,r=0,a=0,u=0,o=0,s=0,b=0,l=0,h=0,f=x8(NNt,v6n,25,3*d,15,1);b>4)<<24>>24,f[l++]=((15&e)<<4|i>>2&15)<<24>>24,f[l++]=(i<<6|r)<<24>>24}return VE(a=c[h++])&&VE(u=c[h++])?(t=WLt[a],e=WLt[u],o=c[h++],s=c[h++],-1==WLt[o]||-1==WLt[s]?61==o&&61==s?0!=(15&e)?null:(aHn(f,0,g=x8(NNt,v6n,25,3*b+1,15,1),0,3*b),g[l]=(t<<2|e>>4)<<24>>24,g):61!=o&&61==s?0!=(3&(i=WLt[o]))?null:(aHn(f,0,g=x8(NNt,v6n,25,3*b+2,15,1),0,3*b),g[l++]=(t<<2|e>>4)<<24>>24,g[l]=((15&e)<<4|i>>2&15)<<24>>24,g):null:(i=WLt[o],r=WLt[s],f[l++]=(t<<2|e>>4)<<24>>24,f[l++]=((15&e)<<4|i>>2&15)<<24>>24,f[l++]=(i<<6|r)<<24>>24,f)):null}function XUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(OTn(t,O1n,1),l=BB(mMn(n,(HXn(),Zdt)),218),i=new Wb(n.b);i.a=2){for(b=!0,e=BB(n0(h=new Wb(r.j)),11),f=null;h.a0&&(c=BB(xq(p.c.a,E-1),10),u=n.i[c.p],M=e.Math.ceil(K$(n.n,c,p)),a=j.a.e-p.d.d-(u.a.e+c.o.b+c.d.a)-M),h=RQn,E0&&T.a.e.e-T.a.a-(T.b.e.e-T.b.a)<0,d=y.a.e.e-y.a.a-(y.b.e.e-y.b.a)<0&&T.a.e.e-T.a.a-(T.b.e.e-T.b.a)>0,w=y.a.e.e+y.b.aT.b.e.e+T.a.a,k=0,!g&&!d&&(b?a+l>0?k=l:h-r>0&&(k=r):w&&(a+o>0?k=o:h-m>0&&(k=m))),j.a.e+=k,j.b&&(j.d.e+=k),1)))}function VUn(n,t,i){var r,c,a,u,o,s,h,f,l,b;if(r=new UV(t.qf().a,t.qf().b,t.rf().a,t.rf().b),c=new bA,n.c)for(u=new Wb(t.wf());u.as&&(i.a+=rL(x8(ONt,WVn,25,-s,15,1))),i.a+="Is",GO(o,YTn(32))>=0)for(r=0;r=i.o.b/2}p?(g=BB(mMn(i,(hWn(),Klt)),15))?l?c=g:(r=BB(mMn(i,Dft),15))?c=g.gc()<=r.gc()?g:r:(c=new Np,hon(i,Dft,c)):(c=new Np,hon(i,Klt,c)):(r=BB(mMn(i,(hWn(),Dft)),15))?f?c=r:(g=BB(mMn(i,Klt),15))?c=r.gc()<=g.gc()?r:g:(c=new Np,hon(i,Klt,c)):(c=new Np,hon(i,Dft,c)),c.Fc(n),hon(n,(hWn(),Kft),e),t.d==e?(MZ(t,null),e.e.c.length+e.g.c.length==0&&CZ(e,null),gsn(e)):(SZ(t,null),e.e.c.length+e.g.c.length==0&&CZ(e,null)),yQ(t.a)}function tXn(n,t){var e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I;for(v=new M2(n.b,0),d=0,s=BB((f=t.Kc()).Pb(),19).a,k=0,e=new Rv,E=new fA;v.b=n.a&&(r=yBn(n,v),l=e.Math.max(l,r.b),y=e.Math.max(y,r.d),WB(o,new rI(v,r)));for(E=new Np,f=0;f0),g.a.Xb(g.c=--g.b),yR(g,T=new HX(n.b)),Px(g.b0?(h=0,p&&(h+=o),h+=(M-1)*u,m&&(h+=o),T&&m&&(h=e.Math.max(h,nxn(m,u,v,E))),h0){for(l=h<100?null:new Fj(h),w=(s=new jcn(t)).g,g=x8(ANt,hQn,25,h,15,1),i=0,m=new gtn(h),r=0;r=0;)if(null!=b?Nfn(b,w[o]):GI(b)===GI(w[o])){g.length<=i&&aHn(g,0,g=x8(ANt,hQn,25,2*g.length,15,1),0,i),g[i++]=r,f9(m,w[o]);break n}if(GI(b)===GI(u))break}}if(s=m,w=m.g,h=i,i>g.length&&aHn(g,0,g=x8(ANt,hQn,25,i,15,1),0,i),i>0){for(v=!0,c=0;c=0;)Lyn(n,g[a]);if(i!=h){for(r=h;--r>=i;)Lyn(s,r);aHn(g,0,g=x8(ANt,hQn,25,i,15,1),0,i)}t=s}}}else for(t=jyn(n,t),r=n.i;--r>=0;)t.Hc(n.g[r])&&(Lyn(n,r),v=!0);if(v){if(null!=g){for(f=1==(e=t.gc())?yZ(n,4,t.Kc().Pb(),null,g[0],d):yZ(n,6,t,g,g[0],d),l=e<100?null:new Fj(e),r=t.Kc();r.Ob();)l=qK(n,BB(b=r.Pb(),72),l);l?(l.Ei(f),l.Fi()):ban(n.e,f)}else{for(l=$K(t.gc()),r=t.Kc();r.Ob();)l=qK(n,BB(b=r.Pb(),72),l);l&&l.Fi()}return!0}return!1}function uXn(n,t){var e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m;for((e=new hvn(t)).a||g_n(t),s=lRn(t),o=new pJ,g=new Qxn,d=new Wb(t.a);d.a0||i.o==cyt&&c0?(f=BB(xq(l.c.a,a-1),10),T=K$(n.b,l,f),g=l.n.b-l.d.d-(f.n.b+f.o.b+f.d.a+T)):g=l.n.b-l.d.d,s=e.Math.min(g,s),a(a=iEn(n,e))?aKn(n,t,e):aKn(n,e,t),ra?1:0}return(i=BB(mMn(t,(hWn(),wlt)),19).a)>(c=BB(mMn(e,wlt),19).a)?aKn(n,t,e):aKn(n,e,t),ic?1:0}function lXn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d;if(qy(TD(ZAn(t,(sWn(),zSt)))))return SQ(),SQ(),set;if(o=0!=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i,s=!(h=yIn(t)).dc(),o||s){if(!(r=BB(ZAn(t,mPt),149)))throw Hp(new rk("Resolved algorithm is not set; apply a LayoutAlgorithmResolver before computing layout."));if(d=OC(r,(hAn(),nAt)),Ngn(t),!o&&s&&!d)return SQ(),SQ(),set;if(u=new Np,GI(ZAn(t,ESt))===GI((ufn(),pCt))&&(OC(r,YOt)||OC(r,QOt)))for(l=pRn(n,t),Frn(b=new YT,(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));0!=b.b;)Ngn(f=BB(0==b.b?null:(Px(0!=b.b),Atn(b,b.a.a)),33)),GI(ZAn(f,ESt))===GI(mCt)||P8(f,eSt)&&!j5(r,ZAn(f,mPt))?(gun(u,lXn(n,f,e,i)),Ypn(f,ESt,mCt),KKn(f)):Frn(b,(!f.a&&(f.a=new eU(UOt,f,10,11)),f.a));else for(l=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i,a=new AL((!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));a.e!=a.i.gc();)gun(u,lXn(n,c=BB(kpn(a),33),e,i)),KKn(c);for(w=new Wb(u);w.a=0?hwn(u):Tln(hwn(u)),n.Ye(upt,b)),s=new Gj,l=!1,n.Xe(npt)?(Hx(s,BB(n.We(npt),8)),l=!0):yL(s,a.a/2,a.b/2),b.g){case 4:hon(h,kgt,(Tbn(),Flt)),hon(h,Gft,(Jun(),$ht)),h.o.b=a.b,d<0&&(h.o.a=-d),qCn(f,(kUn(),oIt)),l||(s.a=a.a),s.a-=a.a;break;case 2:hon(h,kgt,(Tbn(),Hlt)),hon(h,Gft,(Jun(),Oht)),h.o.b=a.b,d<0&&(h.o.a=-d),qCn(f,(kUn(),CIt)),l||(s.a=0);break;case 1:hon(h,ilt,(z7(),Cft)),h.o.a=a.a,d<0&&(h.o.b=-d),qCn(f,(kUn(),SIt)),l||(s.b=a.b),s.b-=a.b;break;case 3:hon(h,ilt,(z7(),Sft)),h.o.a=a.a,d<0&&(h.o.b=-d),qCn(f,(kUn(),sIt)),l||(s.b=0)}if(Hx(f.n,s),hon(h,npt,s),t==UCt||t==WCt||t==XCt){if(w=0,t==UCt&&n.Xe(ipt))switch(b.g){case 1:case 2:w=BB(n.We(ipt),19).a;break;case 3:case 4:w=-BB(n.We(ipt),19).a}else switch(b.g){case 4:case 2:w=c.b,t==WCt&&(w/=r.b);break;case 1:case 3:w=c.a,t==WCt&&(w/=r.a)}hon(h,Tlt,w)}return hon(h,Qft,b),h}function wXn(n){var t,e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E;if((e=Gy(MD(mMn(n.a.j,(HXn(),_dt)))))<-1||!n.a.i||LK(BB(mMn(n.a.o,ept),98))||abn(n.a.o,(kUn(),oIt)).gc()<2&&abn(n.a.o,CIt).gc()<2)return!0;if(n.a.c.Rf())return!1;for(y=0,m=0,v=new Np,o=0,s=(u=n.a.e).length;o=e}function dXn(){function n(n){var t=this;this.dispatch=function(t){var e=t.data;switch(e.cmd){case"algorithms":var i=Swn((SQ(),new Hb(new Ob(lAt.b))));n.postMessage({id:e.id,data:i});break;case"categories":var r=Swn((SQ(),new Hb(new Ob(lAt.c))));n.postMessage({id:e.id,data:r});break;case"options":var c=Swn((SQ(),new Hb(new Ob(lAt.d))));n.postMessage({id:e.id,data:c});break;case"register":lGn(e.algorithms),n.postMessage({id:e.id});break;case"layout":xBn(e.graph,e.layoutOptions||{},e.options||{}),n.postMessage({id:e.id,data:e.graph})}},this.saveDispatch=function(e){try{t.dispatch(e)}catch(i){n.postMessage({id:e.data.id,error:i})}}}function e(t){var e=this;this.dispatcher=new n({postMessage:function(n){e.onmessage({data:n})}}),this.postMessage=function(n){setTimeout((function(){e.dispatcher.saveDispatch({data:n})}),0)}}if(aE(),typeof document===gYn&&typeof self!==gYn){var r=new n(self);self.onmessage=r.saveDispatch}else typeof t!==gYn&&t.exports&&(Object.defineProperty(i,"__esModule",{value:!0}),t.exports={default:e,Worker:e})}function gXn(n){n.N||(n.N=!0,n.b=kan(n,0),Rrn(n.b,0),Rrn(n.b,1),Rrn(n.b,2),n.bb=kan(n,1),Rrn(n.bb,0),Rrn(n.bb,1),n.fb=kan(n,2),Rrn(n.fb,3),Rrn(n.fb,4),Krn(n.fb,5),n.qb=kan(n,3),Rrn(n.qb,0),Krn(n.qb,1),Krn(n.qb,2),Rrn(n.qb,3),Rrn(n.qb,4),Krn(n.qb,5),Rrn(n.qb,6),n.a=jan(n,4),n.c=jan(n,5),n.d=jan(n,6),n.e=jan(n,7),n.f=jan(n,8),n.g=jan(n,9),n.i=jan(n,10),n.j=jan(n,11),n.k=jan(n,12),n.n=jan(n,13),n.o=jan(n,14),n.p=jan(n,15),n.q=jan(n,16),n.s=jan(n,17),n.r=jan(n,18),n.t=jan(n,19),n.u=jan(n,20),n.v=jan(n,21),n.w=jan(n,22),n.B=jan(n,23),n.A=jan(n,24),n.C=jan(n,25),n.D=jan(n,26),n.F=jan(n,27),n.G=jan(n,28),n.H=jan(n,29),n.J=jan(n,30),n.I=jan(n,31),n.K=jan(n,32),n.M=jan(n,33),n.L=jan(n,34),n.P=jan(n,35),n.Q=jan(n,36),n.R=jan(n,37),n.S=jan(n,38),n.T=jan(n,39),n.U=jan(n,40),n.V=jan(n,41),n.X=jan(n,42),n.W=jan(n,43),n.Y=jan(n,44),n.Z=jan(n,45),n.$=jan(n,46),n._=jan(n,47),n.ab=jan(n,48),n.cb=jan(n,49),n.db=jan(n,50),n.eb=jan(n,51),n.gb=jan(n,52),n.hb=jan(n,53),n.ib=jan(n,54),n.jb=jan(n,55),n.kb=jan(n,56),n.lb=jan(n,57),n.mb=jan(n,58),n.nb=jan(n,59),n.ob=jan(n,60),n.pb=jan(n,61))}function pXn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;if(m=0,0==t.f.a)for(p=new Wb(n);p.as&&0==(l1(s,t.c.length),BB(t.c[s],200)).a.c.length;)y7(t,(l1(s,t.c.length),t.c[s]));if(!o){--c;continue}if(A_n(t,h,r,o,l,e,s,i)){f=!0;continue}if(l){if(JBn(t,h,r,o,e,s,i)){f=!0;continue}if(Ahn(h,r)){r.c=!0,f=!0;continue}}else if(Ahn(h,r)){r.c=!0,f=!0;continue}if(f)continue}Ahn(h,r)?(r.c=!0,f=!0,o&&(o.k=!1)):Gmn(r.q)}else $T(),Tkn(h,r),--c,f=!0;return f}function yXn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A;for(g=0,P=0,h=new Wb(n.b);h.ag&&(a&&(fO(E,w),fO(M,iln(f.b-1)),WB(n.d,d),o.c=x8(Ant,HWn,1,0,5,1)),O=i.b,A+=w+t,w=0,l=e.Math.max(l,i.b+i.c+I)),o.c[o.c.length]=s,Mpn(s,O,A),l=e.Math.max(l,O+I+i.c),w=e.Math.max(w,b),O+=I+t,d=s;if(gun(n.a,o),WB(n.d,BB(xq(o,o.c.length-1),157)),l=e.Math.max(l,r),(C=A+w+i.a)1&&(u=e.Math.min(u,e.Math.abs(BB(Dpn(o.a,1),8).b-f.b)))));else for(d=new Wb(t.j);d.ac&&(a=b.a-c,u=DWn,r.c=x8(Ant,HWn,1,0,5,1),c=b.a),b.a>=c&&(r.c[r.c.length]=o,o.a.b>1&&(u=e.Math.min(u,e.Math.abs(BB(Dpn(o.a,o.a.b-2),8).b-b.b)))));if(0!=r.c.length&&a>t.o.a/2&&u>t.o.b/2){for(CZ(w=new CSn,t),qCn(w,(kUn(),sIt)),w.n.a=t.o.a/2,CZ(g=new CSn,t),qCn(g,SIt),g.n.a=t.o.a/2,g.n.b=t.o.b,s=new Wb(r);s.a=h.b?SZ(o,g):SZ(o,w)):(h=BB(gH(o.a),8),(0==o.a.b?g1(o.c):BB(px(o.a),8)).b>=h.b?MZ(o,g):MZ(o,w)),(l=BB(mMn(o,(HXn(),vgt)),74))&&ywn(l,h,!0);t.n.a=c-t.o.a/2}}function EXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;if(s=t,$in(o=Q3(n,L3(e),s),R2(s,q6n)),h=BB(sen(n.g,kIn(zJ(s,T6n))),33),i=null,(a=zJ(s,"sourcePort"))&&(i=kIn(a)),f=BB(sen(n.j,i),118),!h)throw Hp(new ek("An edge must have a source node (edge id: '"+Qdn(s)+W6n));if(f&&!wW(WJ(f),h))throw Hp(new ek("The source port of an edge must be a port of the edge's source node (edge id: '"+R2(s,q6n)+W6n));if(!o.b&&(o.b=new hK(KOt,o,4,7)),f9(o.b,f||h),l=BB(sen(n.g,kIn(zJ(s,Y6n))),33),r=null,(u=zJ(s,"targetPort"))&&(r=kIn(u)),b=BB(sen(n.j,r),118),!l)throw Hp(new ek("An edge must have a target node (edge id: '"+Qdn(s)+W6n));if(b&&!wW(WJ(b),l))throw Hp(new ek("The target port of an edge must be a port of the edge's target node (edge id: '"+R2(s,q6n)+W6n));if(!o.c&&(o.c=new hK(KOt,o,5,8)),f9(o.c,b||l),0==(!o.b&&(o.b=new hK(KOt,o,4,7)),o.b).i||0==(!o.c&&(o.c=new hK(KOt,o,5,8)),o.c).i)throw c=R2(s,q6n),Hp(new ek(X6n+c+W6n));return STn(s,o),s$n(s,o),xon(n,s,o)}function TXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S;return f=CFn(HN(n,(kUn(),wIt)),t),w=ayn(HN(n,dIt),t),y=ayn(HN(n,EIt),t),T=uyn(HN(n,MIt),t),l=uyn(HN(n,hIt),t),v=ayn(HN(n,jIt),t),d=ayn(HN(n,gIt),t),j=ayn(HN(n,TIt),t),k=ayn(HN(n,fIt),t),M=uyn(HN(n,bIt),t),p=ayn(HN(n,yIt),t),m=ayn(HN(n,mIt),t),E=ayn(HN(n,lIt),t),S=uyn(HN(n,kIt),t),b=uyn(HN(n,pIt),t),g=ayn(HN(n,vIt),t),e=Lon(Pun(Gk(xNt,1),qQn,25,15,[v.a,T.a,j.a,S.a])),i=Lon(Pun(Gk(xNt,1),qQn,25,15,[w.a,f.a,y.a,g.a])),r=p.a,c=Lon(Pun(Gk(xNt,1),qQn,25,15,[d.a,l.a,k.a,b.a])),s=Lon(Pun(Gk(xNt,1),qQn,25,15,[v.b,w.b,d.b,m.b])),o=Lon(Pun(Gk(xNt,1),qQn,25,15,[T.b,f.b,l.b,g.b])),h=M.b,u=Lon(Pun(Gk(xNt,1),qQn,25,15,[j.b,y.b,k.b,E.b])),w9(HN(n,wIt),e+r,s+h),w9(HN(n,vIt),e+r,s+h),w9(HN(n,dIt),e+r,0),w9(HN(n,EIt),e+r,s+h+o),w9(HN(n,MIt),0,s+h),w9(HN(n,hIt),e+r+i,s+h),w9(HN(n,gIt),e+r+i,0),w9(HN(n,TIt),0,s+h+o),w9(HN(n,fIt),e+r+i,s+h+o),w9(HN(n,bIt),0,s),w9(HN(n,yIt),e,0),w9(HN(n,lIt),0,s+h+o),w9(HN(n,pIt),e+r+i,0),(a=new Gj).a=Lon(Pun(Gk(xNt,1),qQn,25,15,[e+i+r+c,M.a,m.a,E.a])),a.b=Lon(Pun(Gk(xNt,1),qQn,25,15,[s+o+h+u,p.b,S.b,b.b])),a}function MXn(n){var t,e,i,r,c,a,u,o,s,f,l,b,w,d,g;for(d=new Np,l=new Wb(n.d.b);l.ar.d.d+r.d.a?f.f.d=!0:(f.f.d=!0,f.f.a=!0))),i.b!=i.d.c&&(t=e);f&&(c=BB(RX(n.f,a.d.i),57),t.bc.d.d+c.d.a?f.f.d=!0:(f.f.d=!0,f.f.a=!0))}for(u=new oz(ZL(fbn(b).a.Kc(),new h));dAn(u);)0!=(a=BB(U5(u),17)).a.b&&(t=BB(px(a.a),8),a.d.j==(kUn(),sIt)&&((g=new PBn(t,new xC(t.a,r.d.d),r,a)).f.a=!0,g.a=a.d,d.c[d.c.length]=g),a.d.j==SIt&&((g=new PBn(t,new xC(t.a,r.d.d+r.d.a),r,a)).f.d=!0,g.a=a.d,d.c[d.c.length]=g))}return d}function SXn(n,t,e){var i,r,c,a,u,o,s;if(OTn(e,"Network simplex node placement",1),n.e=t,n.n=BB(mMn(t,(hWn(),Alt)),304),oqn(n),REn(n),JT(wnn(new Rq(null,new w1(n.e.b,16)),new Hc),new cg(n)),JT(AV(wnn(AV(wnn(new Rq(null,new w1(n.e.b,16)),new ta),new ea),new ia),new ra),new rg(n)),qy(TD(mMn(n.e,(HXn(),xgt))))&&(OTn(c=mcn(e,1),"Straight Edges Pre-Processing",1),jzn(n),HSn(c)),Mvn(n.f),r=BB(mMn(t,xpt),19).a*n.f.a.c.length,WKn(Qk(Yk(B_(n.f),r),!1),mcn(e,1)),0!=n.d.a.gc()){for(OTn(c=mcn(e,1),"Flexible Where Space Processing",1),a=BB($N(Oz($V(new Rq(null,new w1(n.f.a,16)),new qc),new Dc)),19).a,u=BB($N(Iz($V(new Rq(null,new w1(n.f.a,16)),new Gc),new Rc)),19).a-a,o=AN(new qv,n.f),s=AN(new qv,n.f),UNn(aM(cM(rM(uM(new Hv,2e4),u),o),s)),JT(AV(AV(LU(n.i),new zc),new Uc),new zV(a,o,u,s)),i=n.d.a.ec().Kc();i.Ob();)BB(i.Pb(),213).g=1;WKn(Qk(Yk(B_(n.f),r),!1),mcn(c,1)),HSn(c)}qy(TD(mMn(t,xgt)))&&(OTn(c=mcn(e,1),"Straight Edges Post-Processing",1),SPn(n),HSn(c)),QGn(n),n.e=null,n.f=null,n.i=null,n.c=null,$U(n.k),n.j=null,n.a=null,n.o=null,n.d.a.$b(),HSn(e)}function PXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(u=new Wb(n.a.b);u.a0)if(r=f.gc(),s=CJ(e.Math.floor((r+1)/2))-1,c=CJ(e.Math.ceil((r+1)/2))-1,t.o==cyt)for(h=c;h>=s;h--)t.a[y.p]==y&&(d=BB(f.Xb(h),46),w=BB(d.a,10),!FT(i,d.b)&&b>n.b.e[w.p]&&(t.a[w.p]=y,t.g[y.p]=t.g[w.p],t.a[y.p]=t.g[y.p],t.f[t.g[y.p].p]=(hN(),!!(qy(t.f[t.g[y.p].p])&y.k==(uSn(),Put))),b=n.b.e[w.p]));else for(h=s;h<=c;h++)t.a[y.p]==y&&(p=BB(f.Xb(h),46),g=BB(p.a,10),!FT(i,p.b)&&b=w&&(v>w&&(b.c=x8(Ant,HWn,1,0,5,1),w=v),b.c[b.c.length]=a);0!=b.c.length&&(l=BB(xq(b,pvn(t,b.c.length)),128),P.a.Bc(l),l.s=d++,cLn(l,M,j),b.c=x8(Ant,HWn,1,0,5,1))}for(y=n.c.length+1,u=new Wb(n);u.aS.s&&(fW(e),y7(S.i,i),i.c>0&&(i.a=S,WB(S.t,i),i.b=E,WB(E.i,i)))}function OXn(n){var t,e,i,r,c;switch(t=n.c){case 11:return n.Ml();case 12:return n.Ol();case 14:return n.Ql();case 15:return n.Tl();case 16:return n.Rl();case 17:return n.Ul();case 21:return QXn(n),wWn(),wWn(),sNt;case 10:switch(n.a){case 65:return n.yl();case 90:return n.Dl();case 122:return n.Kl();case 98:return n.El();case 66:return n.zl();case 60:return n.Jl();case 62:return n.Hl()}}switch(c=kXn(n),t=n.c){case 3:return n.Zl(c);case 4:return n.Xl(c);case 5:return n.Yl(c);case 0:if(123==n.a&&n.d=48&&t<=57))throw Hp(new ak(kWn((u$(),X8n))));for(i=t-48;r=48&&t<=57;)if((i=10*i+t-48)<0)throw Hp(new ak(kWn((u$(),Y8n))));if(e=i,44==t){if(r>=n.j)throw Hp(new ak(kWn((u$(),V8n))));if((t=fV(n.i,r++))>=48&&t<=57){for(e=t-48;r=48&&t<=57;)if((e=10*e+t-48)<0)throw Hp(new ak(kWn((u$(),Y8n))));if(i>e)throw Hp(new ak(kWn((u$(),Q8n))))}else e=-1}if(125!=t)throw Hp(new ak(kWn((u$(),W8n))));n.sl(r)?(wWn(),wWn(),c=new h4(9,c),n.d=r+1):(wWn(),wWn(),c=new h4(3,c),n.d=r),c.dm(i),c.cm(e),QXn(n)}}return c}function AXn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M;for(w=new J6(t.b),v=new J6(t.b),l=new J6(t.b),j=new J6(t.b),d=new J6(t.b),k=spn(t,0);k.b!=k.d.c;)for(u=new Wb((m=BB(b3(k),11)).g);u.a0,g=m.g.c.length>0,s&&g?l.c[l.c.length]=m:s?w.c[w.c.length]=m:g&&(v.c[v.c.length]=m);for(b=new Wb(w);b.a1)for(b=new cx((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a));b.e!=b.i.gc();)Qjn(b);for(d=C,C>y+m?d=y+m:Ck+w?g=k+w:Iy-m&&dk-w&&gC+P?E=C+P:yI+j?T=I+j:kC-P&&EI-j&&Ti&&(f=i-1),(l=L+H$n(t,24)*uYn*h-h/2)<0?l=1:l>r&&(l=r-1),tE(),jen(c=new ro,f),Een(c,l),f9((!u.a&&(u.a=new $L(xOt,u,5)),u.a),c)}function HXn(){HXn=O,sWn(),ppt=jPt,vpt=EPt,mpt=TPt,ypt=MPt,jpt=SPt,Ept=PPt,Spt=IPt,Cpt=APt,Ipt=$Pt,Ppt=OPt,Opt=LPt,$pt=NPt,Npt=RPt,Mpt=CPt,fWn(),gpt=_wt,kpt=Fwt,Tpt=Bwt,Apt=Hwt,hpt=new XA(pPt,iln(0)),fpt=Dwt,lpt=Rwt,bpt=Kwt,zpt=ldt,Rpt=zwt,Kpt=Wwt,Bpt=edt,_pt=Ywt,Fpt=Zwt,Xpt=pdt,Upt=wdt,qpt=odt,Hpt=adt,Gpt=hdt,Rgt=Pwt,Kgt=Cwt,rgt=Kbt,cgt=Bbt,Ugt=new WA(12),zgt=new XA(XSt,Ugt),Mbn(),Zdt=new XA(vSt,ngt=QPt),tpt=new XA(aPt,0),wpt=new XA(vPt,iln(1)),Edt=new XA(cSt,dZn),Ggt=zSt,ept=uPt,upt=wPt,zdt=lSt,kdt=iSt,sgt=ESt,dpt=new XA(kPt,(hN(),!0)),wgt=SSt,dgt=PSt,Fgt=KSt,qgt=qSt,Bgt=FSt,Ffn(),Udt=new XA(bSt,Wdt=BPt),$gt=DSt,Agt=NSt,cpt=fPt,rpt=hPt,apt=bPt,cpn(),new XA(ZSt,Vgt=qCt),Ygt=ePt,Jgt=iPt,Zgt=rPt,Qgt=tPt,Dpt=Gwt,Pgt=lwt,Sgt=hwt,xpt=qwt,kgt=ewt,Gdt=Tbt,qdt=jbt,xdt=ubt,Ddt=obt,Kdt=bbt,Rdt=sbt,Hdt=ybt,Igt=wwt,Ogt=dwt,pgt=Vbt,_gt=$wt,Ngt=mwt,ugt=Gbt,Dgt=Mwt,egt=Nbt,igt=Dbt,Ndt=hSt,Lgt=gwt,Pdt=Qlt,Sdt=Wlt,Mdt=Xlt,fgt=Xbt,hgt=Ubt,lgt=Wbt,Hgt=BSt,vgt=OSt,agt=ySt,Ydt=gSt,Qdt=dSt,_dt=gbt,ipt=sPt,Tdt=sSt,bgt=MSt,npt=cPt,Xgt=VSt,Wgt=YSt,Egt=cwt,Tgt=uwt,spt=gPt,jdt=Ult,Mgt=swt,Jdt=Obt,Vdt=Cbt,Cgt=$St,mgt=Zbt,xgt=jwt,Lpt=xPt,Xdt=Sbt,opt=Nwt,tgt=$bt,ygt=twt,Fdt=vbt,ggt=ISt,jgt=rwt,Bdt=mbt,Ldt=cbt,Adt=ebt,Idt=nbt,Odt=tbt,$dt=rbt,Cdt=Jlt,ogt=zbt}function qXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C;if(uHn(),T=n.e,w=n.d,r=n.a,0==T)switch(t){case 0:return"0";case 1:return WQn;case 2:return"0.00";case 3:return"0.000";case 4:return"0.0000";case 5:return"0.00000";case 6:return"0.000000";default:return(j=new Ck).a+=t<0?"0E+":"0E",j.a+=-t,j.a}if(y=x8(ONt,WVn,25,1+(m=10*w+1+7),15,1),e=m,1==w)if((u=r[0])<0){C=e0(u,UQn);do{d=C,C=Ojn(C,10),y[--e]=48+dG(ibn(d,cbn(C,10)))&QVn}while(0!=Vhn(C,0))}else{C=u;do{d=C,C=C/10|0,y[--e]=d-10*C+48&QVn}while(0!=C)}else{aHn(r,0,S=x8(ANt,hQn,25,w,15,1),0,P=w);n:for(;;){for(E=0,s=P-1;s>=0;s--)p=fTn(rbn(yz(E,32),e0(S[s],UQn))),S[s]=dG(p),E=dG(kz(p,32));v=dG(E),g=e;do{y[--e]=48+v%10&QVn}while(0!=(v=v/10|0)&&0!=e);for(i=9-g+e,o=0;o0;o++)y[--e]=48;for(f=P-1;0==S[f];f--)if(0==f)break n;P=f+1}for(;48==y[e];)++e}if(b=T<0,a=m-e-t-1,0==t)return b&&(y[--e]=45),Bdn(y,e,m-e);if(t>0&&a>=-6){if(a>=0){for(h=e+a,l=m-1;l>=h;l--)y[l+1]=y[l];return y[++h]=46,b&&(y[--e]=45),Bdn(y,e,m-e+1)}for(f=2;f<1-a;f++)y[--e]=48;return y[--e]=46,y[--e]=48,b&&(y[--e]=45),Bdn(y,e,m-e)}return M=e+1,c=m,k=new Ik,b&&(k.a+="-"),c-M>=1?(xX(k,y[e]),k.a+=".",k.a+=Bdn(y,e+1,m-e-1)):k.a+=Bdn(y,e,m-e),k.a+="E",a>0&&(k.a+="+"),k.a+=""+a,k.a}function GXn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;switch(n.c=t,n.g=new xp,GM(),twn(new Pw(new Dy(n.c))),v=SD(ZAn(n.c,(MMn(),dTt))),u=BB(ZAn(n.c,pTt),316),y=BB(ZAn(n.c,vTt),429),c=BB(ZAn(n.c,hTt),482),m=BB(ZAn(n.c,gTt),430),n.j=Gy(MD(ZAn(n.c,mTt))),a=n.a,u.g){case 0:a=n.a;break;case 1:a=n.b;break;case 2:a=n.i;break;case 3:a=n.e;break;case 4:a=n.f;break;default:throw Hp(new _y(N4n+(null!=u.f?u.f:""+u.g)))}if(n.d=new DJ(a,y,c),hon(n.d,(Xcn(),Qrt),TD(ZAn(n.c,lTt))),n.d.c=qy(TD(ZAn(n.c,fTt))),0==YQ(n.c).i)return n.d;for(h=new AL(YQ(n.c));h.e!=h.i.gc();){for(l=(s=BB(kpn(h),33)).g/2,f=s.f/2,k=new xC(s.i+l,s.j+f);hU(n.g,k);)_x(k,(e.Math.random()-.5)*lZn,(e.Math.random()-.5)*lZn);w=BB(ZAn(s,(sWn(),$St)),142),d=new AZ(k,new UV(k.a-l-n.j/2-w.b,k.b-f-n.j/2-w.d,s.g+n.j+(w.b+w.c),s.f+n.j+(w.d+w.a))),WB(n.d.i,d),VW(n.g,k,new rI(d,s))}switch(m.g){case 0:if(null==v)n.d.d=BB(xq(n.d.i,0),65);else for(p=new Wb(n.d.i);p.a1&&r5(f,v,f.c.b,f.c),mtn(c)));v=m}return f}function UXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A;for(OTn(e,"Greedy cycle removal",1),A=(m=t.a).c.length,n.a=x8(ANt,hQn,25,A,15,1),n.c=x8(ANt,hQn,25,A,15,1),n.b=x8(ANt,hQn,25,A,15,1),s=0,p=new Wb(m);p.a0?S+1:1);for(a=new Wb(k.g);a.a0?S+1:1)}0==n.c[s]?DH(n.e,d):0==n.a[s]&&DH(n.f,d),++s}for(w=-1,b=1,f=new Np,n.d=BB(mMn(t,(hWn(),Slt)),230);A>0;){for(;0!=n.e.b;)C=BB(dH(n.e),10),n.b[C.p]=w--,QKn(n,C),--A;for(;0!=n.f.b;)I=BB(dH(n.f),10),n.b[I.p]=b++,QKn(n,I),--A;if(A>0){for(l=_Vn,v=new Wb(m);v.a=l&&(y>l&&(f.c=x8(Ant,HWn,1,0,5,1),l=y),f.c[f.c.length]=d);h=n.Zf(f),n.b[h.p]=b++,QKn(n,h),--A}}for(P=m.c.length+1,s=0;sn.b[O]&&(tBn(i,!0),hon(t,qft,(hN(),!0)));n.a=null,n.c=null,n.b=null,yQ(n.f),yQ(n.e),HSn(e)}function XXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;for(i=new Np,u=new Np,g=t/2,b=n.gc(),r=BB(n.Xb(0),8),p=BB(n.Xb(1),8),WB(i,(l1(0,(w=QAn(r.a,r.b,p.a,p.b,g)).c.length),BB(w.c[0],8))),WB(u,(l1(1,w.c.length),BB(w.c[1],8))),s=2;s=0;o--)DH(e,(l1(o,a.c.length),BB(a.c[o],8)));return e}function WXn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b;if(a=!0,f=null,i=null,r=null,t=!1,b=kAt,s=null,c=null,(o=Vgn(n,u=0,AAt,$At))=0&&mK(n.substr(u,"//".length),"//")?(o=Vgn(n,u+=2,LAt,NAt),i=n.substr(u,o-u),u=o):null==f||u!=n.length&&(b1(u,n.length),47==n.charCodeAt(u))||(a=!1,-1==(o=yN(n,YTn(35),u))&&(o=n.length),i=n.substr(u,o-u),u=o);if(!e&&u0&&58==fV(h,h.length-1)&&(r=h,u=o)),u=n.j)return n.a=-1,void(n.c=1);if(t=fV(n.i,n.d++),n.a=t,1!=n.b){switch(t){case 124:i=2;break;case 42:i=3;break;case 43:i=4;break;case 63:i=5;break;case 41:i=7;break;case 46:i=8;break;case 91:i=9;break;case 94:i=11;break;case 36:i=12;break;case 40:if(i=6,n.d>=n.j)break;if(63!=fV(n.i,n.d))break;if(++n.d>=n.j)throw Hp(new ak(kWn((u$(),p8n))));switch(t=fV(n.i,n.d++)){case 58:i=13;break;case 61:i=14;break;case 33:i=15;break;case 91:i=19;break;case 62:i=18;break;case 60:if(n.d>=n.j)throw Hp(new ak(kWn((u$(),p8n))));if(61==(t=fV(n.i,n.d++)))i=16;else{if(33!=t)throw Hp(new ak(kWn((u$(),v8n))));i=17}break;case 35:for(;n.d=n.j)throw Hp(new ak(kWn((u$(),g8n))));n.a=fV(n.i,n.d++);break;default:i=0}n.c=i}else{switch(t){case 92:if(i=10,n.d>=n.j)throw Hp(new ak(kWn((u$(),g8n))));n.a=fV(n.i,n.d++);break;case 45:512==(512&n.e)&&n.d=j||!Ndn(v,i))&&(i=r1(t,f)),PZ(v,i),c=new oz(ZL(fbn(v).a.Kc(),new h));dAn(c);)r=BB(U5(c),17),n.a[r.p]||(g=r.c.i,--n.e[g.p],0==n.e[g.p]&&F8(eMn(w,g)));for(s=f.c.length-1;s>=0;--s)WB(t.b,(l1(s,f.c.length),BB(f.c[s],29)));t.a.c=x8(Ant,HWn,1,0,5,1),HSn(e)}else HSn(e)}function ZXn(n){var t,e,i,r,c,a,u,o;for(n.b=1,QXn(n),t=null,0==n.c&&94==n.a?(QXn(n),wWn(),wWn(),Yxn(t=new M0(4),0,unt),a=new M0(4)):(wWn(),wWn(),a=new M0(4)),r=!0;1!=(o=n.c);){if(0==o&&93==n.a&&!r){t&&(WGn(t,a),a=t);break}if(e=n.a,i=!1,10==o)switch(e){case 100:case 68:case 119:case 87:case 115:case 83:sHn(a,d_n(e)),i=!0;break;case 105:case 73:case 99:case 67:sHn(a,d_n(e)),(e=-1)<0&&(i=!0);break;case 112:case 80:if(!(u=DIn(n,e)))throw Hp(new ak(kWn((u$(),O8n))));sHn(a,u),i=!0;break;default:e=qDn(n)}else if(24==o&&!r){if(t&&(WGn(t,a),a=t),WGn(a,ZXn(n)),0!=n.c||93!=n.a)throw Hp(new ak(kWn((u$(),N8n))));break}if(QXn(n),!i){if(0==o){if(91==e)throw Hp(new ak(kWn((u$(),x8n))));if(93==e)throw Hp(new ak(kWn((u$(),D8n))));if(45==e&&!r&&93!=n.a)throw Hp(new ak(kWn((u$(),R8n))))}if(0!=n.c||45!=n.a||45==e&&r)Yxn(a,e,e);else{if(QXn(n),1==(o=n.c))throw Hp(new ak(kWn((u$(),$8n))));if(0==o&&93==n.a)Yxn(a,e,e),Yxn(a,45,45);else{if(0==o&&93==n.a||24==o)throw Hp(new ak(kWn((u$(),R8n))));if(c=n.a,0==o){if(91==c)throw Hp(new ak(kWn((u$(),x8n))));if(93==c)throw Hp(new ak(kWn((u$(),D8n))));if(45==c)throw Hp(new ak(kWn((u$(),R8n))))}else 10==o&&(c=qDn(n));if(QXn(n),e>c)throw Hp(new ak(kWn((u$(),F8n))));Yxn(a,e,c)}}}r=!1}if(1==n.c)throw Hp(new ak(kWn((u$(),$8n))));return T$n(a),qHn(a),n.b=0,QXn(n),a}function nWn(n){V$n(n.c,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#decimal"])),V$n(n.d,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#integer"])),V$n(n.e,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#boolean"])),V$n(n.f,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EBoolean",t8n,"EBoolean:Object"])),V$n(n.i,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#byte"])),V$n(n.g,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#hexBinary"])),V$n(n.j,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EByte",t8n,"EByte:Object"])),V$n(n.n,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EChar",t8n,"EChar:Object"])),V$n(n.t,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#double"])),V$n(n.u,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EDouble",t8n,"EDouble:Object"])),V$n(n.F,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#float"])),V$n(n.G,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EFloat",t8n,"EFloat:Object"])),V$n(n.I,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#int"])),V$n(n.J,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EInt",t8n,"EInt:Object"])),V$n(n.N,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#long"])),V$n(n.O,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"ELong",t8n,"ELong:Object"])),V$n(n.Z,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#short"])),V$n(n.$,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EShort",t8n,"EShort:Object"])),V$n(n._,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#string"]))}function tWn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C;if(1==n.c.length)return l1(0,n.c.length),BB(n.c[0],135);if(n.c.length<=0)return new P6;for(s=new Wb(n);s.al&&(P=0,C+=f+E,f=0),ELn(k,u,P,C),t=e.Math.max(t,P+j.a),f=e.Math.max(f,j.b),P+=j.a+E;for(y=new xp,i=new xp,M=new Wb(n);M.av$n(c))&&(f=c);for(!f&&(l1(0,d.c.length),f=BB(d.c[0],180)),w=new Wb(t.b);w.a=-1900?1:0,oO(n,e>=4?Pun(Gk(Qtt,1),sVn,2,6,[fQn,lQn])[a]:Pun(Gk(Qtt,1),sVn,2,6,["BC","AD"])[a]);break;case 121:opn(n,e,i);break;case 77:XKn(n,e,i);break;case 107:Enn(n,0==(u=r.q.getHours())?24:u,e);break;case 83:RLn(n,e,r);break;case 69:o=i.q.getDay(),oO(n,5==e?Pun(Gk(Qtt,1),sVn,2,6,["S","M","T","W","T","F","S"])[o]:4==e?Pun(Gk(Qtt,1),sVn,2,6,[bQn,wQn,dQn,gQn,pQn,vQn,mQn])[o]:Pun(Gk(Qtt,1),sVn,2,6,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"])[o]);break;case 97:r.q.getHours()>=12&&r.q.getHours()<24?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["AM","PM"])[1]):oO(n,Pun(Gk(Qtt,1),sVn,2,6,["AM","PM"])[0]);break;case 104:Enn(n,0==(s=r.q.getHours()%12)?12:s,e);break;case 75:Enn(n,r.q.getHours()%12,e);break;case 72:Enn(n,r.q.getHours(),e);break;case 99:h=i.q.getDay(),5==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["S","M","T","W","T","F","S"])[h]):4==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,[bQn,wQn,dQn,gQn,pQn,vQn,mQn])[h]):3==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"])[h]):Enn(n,h,1);break;case 76:f=i.q.getMonth(),5==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["J","F","M","A","M","J","J","A","S","O","N","D"])[f]):4==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,[YVn,JVn,ZVn,nQn,tQn,eQn,iQn,rQn,cQn,aQn,uQn,oQn])[f]):3==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"])[f]):Enn(n,f+1,e);break;case 81:l=i.q.getMonth()/3|0,oO(n,e<4?Pun(Gk(Qtt,1),sVn,2,6,["Q1","Q2","Q3","Q4"])[l]:Pun(Gk(Qtt,1),sVn,2,6,["1st quarter","2nd quarter","3rd quarter","4th quarter"])[l]);break;case 100:Enn(n,i.q.getDate(),e);break;case 109:Enn(n,r.q.getMinutes(),e);break;case 115:Enn(n,r.q.getSeconds(),e);break;case 122:oO(n,e<4?c.c[0]:c.c[1]);break;case 118:oO(n,c.b);break;case 90:oO(n,e<3?nIn(c):3==e?wIn(c):dIn(c.a));break;default:return!1}return!0}function uWn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C;if(tKn(t),o=BB(Wtn((!t.b&&(t.b=new hK(KOt,t,4,7)),t.b),0),82),h=BB(Wtn((!t.c&&(t.c=new hK(KOt,t,5,8)),t.c),0),82),u=PTn(o),s=PTn(h),a=0==(!t.a&&(t.a=new eU(FOt,t,6,6)),t.a).i?null:BB(Wtn((!t.a&&(t.a=new eU(FOt,t,6,6)),t.a),0),202),j=BB(RX(n.a,u),10),S=BB(RX(n.a,s),10),E=null,P=null,cL(o,186)&&(cL(k=BB(RX(n.a,o),299),11)?E=BB(k,11):cL(k,10)&&(j=BB(k,10),E=BB(xq(j.j,0),11))),cL(h,186)&&(cL(M=BB(RX(n.a,h),299),11)?P=BB(M,11):cL(M,10)&&(S=BB(M,10),P=BB(xq(S.j,0),11))),!j||!S)throw Hp(new ck("The source or the target of edge "+t+" could not be found. This usually happens when an edge connects a node laid out by ELK Layered to a node in another level of hierarchy laid out by either another instance of ELK Layered or another layout algorithm alltogether. The former can be solved by setting the hierarchyHandling option to INCLUDE_CHILDREN."));for(qan(d=new wY,t),hon(d,(hWn(),dlt),t),hon(d,(HXn(),vgt),null),b=BB(mMn(i,Zft),21),j==S&&b.Fc((bDn(),vft)),E||(ain(),y=qvt,T=null,a&&vA(BB(mMn(j,ept),98))&&(Y3(T=new xC(a.j,a.k),XJ(t)),t5(T,e),Ctn(s,u)&&(y=Hvt,UR(T,j.n))),E=dHn(j,T,y,i)),P||(ain(),y=Hvt,C=null,a&&vA(BB(mMn(S,ept),98))&&(Y3(C=new xC(a.b,a.c),XJ(t)),t5(C,e)),P=dHn(S,C,y,vW(S))),SZ(d,E),MZ(d,P),(E.e.c.length>1||E.g.c.length>1||P.e.c.length>1||P.g.c.length>1)&&b.Fc((bDn(),bft)),l=new AL((!t.n&&(t.n=new eU(zOt,t,1,7)),t.n));l.e!=l.i.gc();)if(!qy(TD(ZAn(f=BB(kpn(l),137),Ggt)))&&f.a)switch(g=Hhn(f),WB(d.b,g),BB(mMn(g,Ydt),272).g){case 1:case 2:b.Fc((bDn(),fft));break;case 0:b.Fc((bDn(),sft)),hon(g,Ydt,(Rtn(),zPt))}if(c=BB(mMn(i,qdt),314),p=BB(mMn(i,_gt),315),r=c==(Oin(),sht)||p==(Nvn(),pvt),a&&0!=(!a.a&&(a.a=new $L(xOt,a,5)),a.a).i&&r){for(v=qSn(a),w=new km,m=spn(v,0);m.b!=m.d.c;)DH(w,new wA(BB(b3(m),8)));hon(d,glt,w)}return d}function oWn(n){n.gb||(n.gb=!0,n.b=kan(n,0),Rrn(n.b,18),Krn(n.b,19),n.a=kan(n,1),Rrn(n.a,1),Krn(n.a,2),Krn(n.a,3),Krn(n.a,4),Krn(n.a,5),n.o=kan(n,2),Rrn(n.o,8),Rrn(n.o,9),Krn(n.o,10),Krn(n.o,11),Krn(n.o,12),Krn(n.o,13),Krn(n.o,14),Krn(n.o,15),Krn(n.o,16),Krn(n.o,17),Krn(n.o,18),Krn(n.o,19),Krn(n.o,20),Krn(n.o,21),Krn(n.o,22),Krn(n.o,23),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),n.p=kan(n,3),Rrn(n.p,2),Rrn(n.p,3),Rrn(n.p,4),Rrn(n.p,5),Krn(n.p,6),Krn(n.p,7),otn(n.p),otn(n.p),n.q=kan(n,4),Rrn(n.q,8),n.v=kan(n,5),Krn(n.v,9),otn(n.v),otn(n.v),otn(n.v),n.w=kan(n,6),Rrn(n.w,2),Rrn(n.w,3),Rrn(n.w,4),Krn(n.w,5),n.B=kan(n,7),Krn(n.B,1),otn(n.B),otn(n.B),otn(n.B),n.Q=kan(n,8),Krn(n.Q,0),otn(n.Q),n.R=kan(n,9),Rrn(n.R,1),n.S=kan(n,10),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),n.T=kan(n,11),Krn(n.T,10),Krn(n.T,11),Krn(n.T,12),Krn(n.T,13),Krn(n.T,14),otn(n.T),otn(n.T),n.U=kan(n,12),Rrn(n.U,2),Rrn(n.U,3),Krn(n.U,4),Krn(n.U,5),Krn(n.U,6),Krn(n.U,7),otn(n.U),n.V=kan(n,13),Krn(n.V,10),n.W=kan(n,14),Rrn(n.W,18),Rrn(n.W,19),Rrn(n.W,20),Krn(n.W,21),Krn(n.W,22),Krn(n.W,23),n.bb=kan(n,15),Rrn(n.bb,10),Rrn(n.bb,11),Rrn(n.bb,12),Rrn(n.bb,13),Rrn(n.bb,14),Rrn(n.bb,15),Rrn(n.bb,16),Krn(n.bb,17),otn(n.bb),otn(n.bb),n.eb=kan(n,16),Rrn(n.eb,2),Rrn(n.eb,3),Rrn(n.eb,4),Rrn(n.eb,5),Rrn(n.eb,6),Rrn(n.eb,7),Krn(n.eb,8),Krn(n.eb,9),n.ab=kan(n,17),Rrn(n.ab,0),Rrn(n.ab,1),n.H=kan(n,18),Krn(n.H,0),Krn(n.H,1),Krn(n.H,2),Krn(n.H,3),Krn(n.H,4),Krn(n.H,5),otn(n.H),n.db=kan(n,19),Krn(n.db,2),n.c=jan(n,20),n.d=jan(n,21),n.e=jan(n,22),n.f=jan(n,23),n.i=jan(n,24),n.g=jan(n,25),n.j=jan(n,26),n.k=jan(n,27),n.n=jan(n,28),n.r=jan(n,29),n.s=jan(n,30),n.t=jan(n,31),n.u=jan(n,32),n.fb=jan(n,33),n.A=jan(n,34),n.C=jan(n,35),n.D=jan(n,36),n.F=jan(n,37),n.G=jan(n,38),n.I=jan(n,39),n.J=jan(n,40),n.L=jan(n,41),n.M=jan(n,42),n.N=jan(n,43),n.O=jan(n,44),n.P=jan(n,45),n.X=jan(n,46),n.Y=jan(n,47),n.Z=jan(n,48),n.$=jan(n,49),n._=jan(n,50),n.cb=jan(n,51),n.K=jan(n,52))}function sWn(){var n,t;sWn=O,eSt=new up(w5n),mPt=new up(d5n),wvn(),iSt=new $O(W2n,rSt=CMt),new $p,cSt=new $O(VJn,null),aSt=new up(g5n),wEn(),fSt=EG(ZMt,Pun(Gk(qPt,1),$Vn,291,0,[VMt])),hSt=new $O(u3n,fSt),lSt=new $O(X2n,(hN(),!1)),Ffn(),bSt=new $O(J2n,wSt=BPt),Mbn(),vSt=new $O(y2n,mSt=ZPt),jSt=new $O(A4n,!1),ufn(),ESt=new $O(d2n,TSt=vCt),WSt=new WA(12),XSt=new $O(QJn,WSt),CSt=new $O(jZn,!1),ISt=new $O(m3n,!1),USt=new $O(MZn,!1),QEn(),uPt=new $O(EZn,oPt=YCt),gPt=new up(g3n),pPt=new up(pZn),vPt=new up(yZn),kPt=new up(kZn),ASt=new km,OSt=new $O(o3n,ASt),sSt=new $O(f3n,!1),MSt=new $O(l3n,!1),new up(p5n),LSt=new lm,$St=new $O(p3n,LSt),zSt=new $O(z2n,!1),new $p,yPt=new $O(v5n,1),new $O(m5n,!0),iln(0),new $O(y5n,iln(100)),new $O(k5n,!1),iln(0),new $O(j5n,iln(4e3)),iln(0),new $O(E5n,iln(400)),new $O(T5n,!1),new $O(M5n,!1),new $O(S5n,!0),new $O(P5n,!1),Fwn(),uSt=new $O(b5n,oSt=eOt),jPt=new $O(L2n,10),EPt=new $O(N2n,10),TPt=new $O(XJn,20),MPt=new $O(x2n,10),SPt=new $O(mZn,2),PPt=new $O(D2n,10),IPt=new $O(R2n,0),OPt=new $O(F2n,5),APt=new $O(K2n,1),$Pt=new $O(_2n,1),LPt=new $O(vZn,20),NPt=new $O(B2n,10),RPt=new $O(H2n,10),CPt=new up(q2n),DPt=new lA,xPt=new $O(v3n,DPt),YSt=new up(d3n),VSt=new $O(w3n,QSt=!1),xSt=new WA(5),NSt=new $O(Z2n,xSt),n$n(),t=BB(Vj(GCt),9),RSt=new YK(t,BB(SR(t,t.length),9),0),DSt=new $O(CZn,RSt),cpn(),ZSt=new $O(e3n,nPt=BCt),ePt=new up(i3n),iPt=new up(r3n),rPt=new up(c3n),tPt=new up(a3n),n=BB(Vj(YIt),9),_St=new YK(n,BB(SR(n,n.length),9),0),KSt=new $O(PZn,_St),GSt=nbn((n_n(),GIt)),qSt=new $O(SZn,GSt),HSt=new xC(0,0),BSt=new $O(BZn,HSt),FSt=new $O(Y2n,!1),Rtn(),gSt=new $O(s3n,pSt=zPt),dSt=new $O(TZn,!1),new up(C5n),iln(1),new $O(I5n,null),cPt=new up(b3n),sPt=new up(h3n),kUn(),wPt=new $O(U2n,dPt=PIt),aPt=new up(G2n),lIn(),lPt=nbn(rIt),fPt=new $O(IZn,lPt),hPt=new $O(n3n,!1),bPt=new $O(t3n,!0),SSt=new $O(V2n,!1),PSt=new $O(Q2n,!1),ySt=new $O(WJn,1),nMn(),new $O(O5n,kSt=aCt),JSt=!0}function hWn(){var n,t;hWn=O,dlt=new up(OZn),Fft=new up("coordinateOrigin"),Mlt=new up("processors"),_ft=new iR("compoundNode",(hN(),!1)),elt=new iR("insideConnections",!1),glt=new up("originalBendpoints"),plt=new up("originalDummyNodePosition"),vlt=new up("originalLabelEdge"),Plt=new up("representedLabels"),zft=new up("endLabels"),Uft=new up("endLabel.origin"),ult=new iR("labelSide",(Xyn(),MCt)),blt=new iR("maxEdgeThickness",0),Clt=new iR("reversed",!1),Slt=new up(AZn),hlt=new iR("longEdgeSource",null),flt=new iR("longEdgeTarget",null),slt=new iR("longEdgeHasLabelDummies",!1),olt=new iR("longEdgeBeforeLabelDummy",!1),Gft=new iR("edgeConstraint",(Jun(),Aht)),rlt=new up("inLayerLayoutUnit"),ilt=new iR("inLayerConstraint",(z7(),Pft)),clt=new iR("inLayerSuccessorConstraint",new Np),alt=new iR("inLayerSuccessorConstraintBetweenNonDummies",!1),Elt=new up("portDummy"),Bft=new iR("crossingHint",iln(0)),Zft=new iR("graphProperties",new YK(t=BB(Vj(Tft),9),BB(SR(t,t.length),9),0)),Qft=new iR("externalPortSide",(kUn(),PIt)),Yft=new iR("externalPortSize",new Gj),Wft=new up("externalPortReplacedDummies"),Vft=new up("externalPortReplacedDummy"),Xft=new iR("externalPortConnections",new YK(n=BB(Vj(FIt),9),BB(SR(n,n.length),9),0)),Tlt=new iR(dJn,0),xft=new up("barycenterAssociates"),Klt=new up("TopSideComments"),Dft=new up("BottomSideComments"),Kft=new up("CommentConnectionPort"),tlt=new iR("inputCollect",!1),klt=new iR("outputCollect",!1),qft=new iR("cyclic",!1),Hft=new up("crossHierarchyMap"),Rlt=new up("targetOffset"),new iR("splineLabelSize",new Gj),Alt=new up("spacings"),jlt=new iR("partitionConstraint",!1),Rft=new up("breakingPoint.info"),xlt=new up("splines.survivingEdge"),Nlt=new up("splines.route.start"),$lt=new up("splines.edgeChain"),ylt=new up("originalPortConstraints"),Olt=new up("selfLoopHolder"),Llt=new up("splines.nsPortY"),wlt=new up("modelOrder"),llt=new up("longEdgeTargetNode"),Jft=new iR(z1n,!1),Ilt=new iR(z1n,!1),nlt=new up("layerConstraints.hiddenNodes"),mlt=new up("layerConstraints.opposidePort"),Dlt=new up("targetNode.modelOrder")}function fWn(){fWn=O,_nn(),Sbt=new $O(U1n,Pbt=Sht),Gbt=new $O(X1n,(hN(),!1)),z2(),Vbt=new $O(W1n,Qbt=Aft),wwt=new $O(V1n,!1),dwt=new $O(Q1n,!0),Ult=new $O(Y1n,!1),U7(),Nwt=new $O(J1n,xwt=Kvt),iln(1),qwt=new $O(Z1n,iln(7)),Gwt=new $O(n0n,!1),zbt=new $O(t0n,!1),Vvn(),Tbt=new $O(e0n,Mbt=yht),TTn(),lwt=new $O(i0n,bwt=tvt),Tbn(),ewt=new $O(r0n,iwt=qlt),iln(-1),twt=new $O(c0n,iln(-1)),iln(-1),rwt=new $O(a0n,iln(-1)),iln(-1),cwt=new $O(u0n,iln(4)),iln(-1),uwt=new $O(o0n,iln(2)),sNn(),hwt=new $O(s0n,fwt=Ivt),iln(0),swt=new $O(h0n,iln(0)),Zbt=new $O(f0n,iln(DWn)),Oin(),jbt=new $O(l0n,Ebt=hht),ubt=new $O(b0n,!1),gbt=new $O(w0n,.1),ybt=new $O(d0n,!1),iln(-1),vbt=new $O(g0n,iln(-1)),iln(-1),mbt=new $O(p0n,iln(-1)),iln(0),obt=new $O(v0n,iln(40)),Kan(),bbt=new $O(m0n,wbt=Eft),sbt=new $O(y0n,hbt=kft),Nvn(),$wt=new $O(k0n,Lwt=gvt),jwt=new up(j0n),g7(),gwt=new $O(E0n,pwt=qht),Bjn(),mwt=new $O(T0n,ywt=Qht),new $p,Mwt=new $O(M0n,.3),Pwt=new up(S0n),bvn(),Cwt=new $O(P0n,Iwt=lvt),Hcn(),Nbt=new $O(C0n,xbt=Wvt),A6(),Dbt=new $O(I0n,Rbt=Zvt),Usn(),Kbt=new $O(O0n,_bt=rmt),Bbt=new $O(A0n,.2),$bt=new $O($0n,2),_wt=new $O(L0n,null),Bwt=new $O(N0n,10),Fwt=new $O(x0n,10),Hwt=new $O(D0n,20),iln(0),Dwt=new $O(R0n,iln(0)),iln(0),Rwt=new $O(K0n,iln(0)),iln(0),Kwt=new $O(_0n,iln(0)),Xlt=new $O(F0n,!1),JMn(),Qlt=new $O(B0n,Ylt=cft),V8(),Wlt=new $O(H0n,Vlt=aht),Xbt=new $O(q0n,!1),iln(0),Ubt=new $O(G0n,iln(16)),iln(0),Wbt=new $O(z0n,iln(5)),$un(),ldt=new $O(U0n,bdt=bmt),zwt=new $O(X0n,10),Wwt=new $O(W0n,1),uin(),edt=new $O(V0n,idt=ght),Ywt=new up(Q0n),ndt=iln(1),iln(0),Zwt=new $O(Y0n,ndt),dcn(),pdt=new $O(J0n,vdt=umt),wdt=new up(Z0n),odt=new $O(n2n,!0),adt=new $O(t2n,2),hdt=new $O(e2n,!0),gSn(),Obt=new $O(i2n,Abt=_ht),$Pn(),Cbt=new $O(r2n,Ibt=Zst),mon(),cbt=new $O(c2n,abt=Nvt),rbt=new $O(a2n,!1),Bfn(),Jlt=new $O(u2n,Zlt=wut),Mhn(),ebt=new $O(o2n,ibt=cvt),nbt=new $O(s2n,0),tbt=new $O(h2n,0),Jbt=jht,Ybt=sht,awt=nvt,owt=nvt,nwt=Ypt,ufn(),pbt=pCt,kbt=hht,dbt=hht,fbt=hht,lbt=pCt,Ewt=mvt,Twt=gvt,vwt=gvt,kwt=gvt,Swt=vvt,Awt=mvt,Owt=mvt,Mbn(),Fbt=JPt,Hbt=JPt,qbt=rmt,Lbt=YPt,Uwt=wmt,Xwt=lmt,Vwt=wmt,Qwt=lmt,rdt=wmt,cdt=lmt,Jwt=dht,tdt=ght,mdt=wmt,ydt=lmt,ddt=wmt,gdt=lmt,sdt=lmt,udt=lmt,fdt=lmt}function lWn(){lWn=O,rot=new nP("DIRECTION_PREPROCESSOR",0),tot=new nP("COMMENT_PREPROCESSOR",1),cot=new nP("EDGE_AND_LAYER_CONSTRAINT_EDGE_REVERSER",2),kot=new nP("INTERACTIVE_EXTERNAL_PORT_POSITIONER",3),Fot=new nP("PARTITION_PREPROCESSOR",4),Mot=new nP("LABEL_DUMMY_INSERTER",5),Uot=new nP("SELF_LOOP_PREPROCESSOR",6),Oot=new nP("LAYER_CONSTRAINT_PREPROCESSOR",7),Kot=new nP("PARTITION_MIDPROCESSOR",8),got=new nP("HIGH_DEGREE_NODE_LAYER_PROCESSOR",9),Not=new nP("NODE_PROMOTION",10),Iot=new nP("LAYER_CONSTRAINT_POSTPROCESSOR",11),_ot=new nP("PARTITION_POSTPROCESSOR",12),lot=new nP("HIERARCHICAL_PORT_CONSTRAINT_PROCESSOR",13),Wot=new nP("SEMI_INTERACTIVE_CROSSMIN_PROCESSOR",14),Vut=new nP("BREAKING_POINT_INSERTER",15),Lot=new nP("LONG_EDGE_SPLITTER",16),Hot=new nP("PORT_SIDE_PROCESSOR",17),jot=new nP("INVERTED_PORT_PROCESSOR",18),Bot=new nP("PORT_LIST_SORTER",19),Qot=new nP("SORT_BY_INPUT_ORDER_OF_MODEL",20),Dot=new nP("NORTH_SOUTH_PORT_PREPROCESSOR",21),Qut=new nP("BREAKING_POINT_PROCESSOR",22),Rot=new nP(E1n,23),Yot=new nP(T1n,24),Got=new nP("SELF_LOOP_PORT_RESTORER",25),Vot=new nP("SINGLE_EDGE_GRAPH_WRAPPER",26),Eot=new nP("IN_LAYER_CONSTRAINT_PROCESSOR",27),sot=new nP("END_NODE_PORT_LABEL_MANAGEMENT_PROCESSOR",28),Tot=new nP("LABEL_AND_NODE_SIZE_PROCESSOR",29),yot=new nP("INNERMOST_NODE_MARGIN_CALCULATOR",30),Xot=new nP("SELF_LOOP_ROUTER",31),Zut=new nP("COMMENT_NODE_MARGIN_CALCULATOR",32),uot=new nP("END_LABEL_PREPROCESSOR",33),Pot=new nP("LABEL_DUMMY_SWITCHER",34),Jut=new nP("CENTER_LABEL_MANAGEMENT_PROCESSOR",35),Cot=new nP("LABEL_SIDE_SELECTOR",36),vot=new nP("HYPEREDGE_DUMMY_MERGER",37),bot=new nP("HIERARCHICAL_PORT_DUMMY_SIZE_PROCESSOR",38),Aot=new nP("LAYER_SIZE_AND_GRAPH_HEIGHT_CALCULATOR",39),dot=new nP("HIERARCHICAL_PORT_POSITION_PROCESSOR",40),eot=new nP("CONSTRAINTS_POSTPROCESSOR",41),not=new nP("COMMENT_POSTPROCESSOR",42),mot=new nP("HYPERNODE_PROCESSOR",43),wot=new nP("HIERARCHICAL_PORT_ORTHOGONAL_EDGE_ROUTER",44),$ot=new nP("LONG_EDGE_JOINER",45),zot=new nP("SELF_LOOP_POSTPROCESSOR",46),Yut=new nP("BREAKING_POINT_REMOVER",47),xot=new nP("NORTH_SOUTH_PORT_POSTPROCESSOR",48),pot=new nP("HORIZONTAL_COMPACTOR",49),Sot=new nP("LABEL_DUMMY_REMOVER",50),hot=new nP("FINAL_SPLINE_BENDPOINTS_CALCULATOR",51),oot=new nP("END_LABEL_SORTER",52),qot=new nP("REVERSED_EDGE_RESTORER",53),aot=new nP("END_LABEL_POSTPROCESSOR",54),fot=new nP("HIERARCHICAL_NODE_RESIZER",55),iot=new nP("DIRECTION_POSTPROCESSOR",56)}function bWn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A,$,L,N,x,D,R,K,_,F,B,H,q,G,z,U,X,W,V,Q,Y,J,Z,nn,tn,en,rn,cn,an,un,on;for(J=0,L=0,D=(O=t).length;L0&&(n.a[q.p]=J++)}for(rn=0,N=0,R=(A=i).length;N0;){for(Px(X.b>0),U=0,o=new Wb((q=BB(X.a.Xb(X.c=--X.b),11)).e);o.a0&&(q.j==(kUn(),sIt)?(n.a[q.p]=rn,++rn):(n.a[q.p]=rn+K+F,++F))}rn+=F}for(z=new xp,d=new fA,$=0,x=(I=t).length;$h.b&&(h.b=W)):q.i.c==Y&&(Wh.c&&(h.c=W));for(z9(g,0,g.length,null),en=x8(ANt,hQn,25,g.length,15,1),r=x8(ANt,hQn,25,rn+1,15,1),v=0;v0;)T%2>0&&(c+=un[T+1]),++un[T=(T-1)/2|0];for(S=x8(qmt,HWn,362,2*g.length,0,1),k=0;k'?":mK(v8n,n)?"'(?<' or '(? toIndex: ",kYn=", toIndex: ",jYn="Index: ",EYn=", Size: ",TYn="org.eclipse.elk.alg.common",MYn={62:1},SYn="org.eclipse.elk.alg.common.compaction",PYn="Scanline/EventHandler",CYn="org.eclipse.elk.alg.common.compaction.oned",IYn="CNode belongs to another CGroup.",OYn="ISpacingsHandler/1",AYn="The ",$Yn=" instance has been finished already.",LYn="The direction ",NYn=" is not supported by the CGraph instance.",xYn="OneDimensionalCompactor",DYn="OneDimensionalCompactor/lambda$0$Type",RYn="Quadruplet",KYn="ScanlineConstraintCalculator",_Yn="ScanlineConstraintCalculator/ConstraintsScanlineHandler",FYn="ScanlineConstraintCalculator/ConstraintsScanlineHandler/lambda$0$Type",BYn="ScanlineConstraintCalculator/Timestamp",HYn="ScanlineConstraintCalculator/lambda$0$Type",qYn={169:1,45:1},GYn="org.eclipse.elk.alg.common.compaction.options",zYn="org.eclipse.elk.core.data",UYn="org.eclipse.elk.polyomino.traversalStrategy",XYn="org.eclipse.elk.polyomino.lowLevelSort",WYn="org.eclipse.elk.polyomino.highLevelSort",VYn="org.eclipse.elk.polyomino.fill",QYn={130:1},YYn="polyomino",JYn="org.eclipse.elk.alg.common.networksimplex",ZYn={177:1,3:1,4:1},nJn="org.eclipse.elk.alg.common.nodespacing",tJn="org.eclipse.elk.alg.common.nodespacing.cellsystem",eJn="CENTER",iJn={212:1,326:1},rJn={3:1,4:1,5:1,595:1},cJn="LEFT",aJn="RIGHT",uJn="Vertical alignment cannot be null",oJn="BOTTOM",sJn="org.eclipse.elk.alg.common.nodespacing.internal",hJn="UNDEFINED",fJn=.01,lJn="org.eclipse.elk.alg.common.nodespacing.internal.algorithm",bJn="LabelPlacer/lambda$0$Type",wJn="LabelPlacer/lambda$1$Type",dJn="portRatioOrPosition",gJn="org.eclipse.elk.alg.common.overlaps",pJn="DOWN",vJn="org.eclipse.elk.alg.common.polyomino",mJn="NORTH",yJn="EAST",kJn="SOUTH",jJn="WEST",EJn="org.eclipse.elk.alg.common.polyomino.structures",TJn="Direction",MJn="Grid is only of size ",SJn=". Requested point (",PJn=") is out of bounds.",CJn=" Given center based coordinates were (",IJn="org.eclipse.elk.graph.properties",OJn="IPropertyHolder",AJn={3:1,94:1,134:1},$Jn="org.eclipse.elk.alg.common.spore",LJn="org.eclipse.elk.alg.common.utils",NJn={209:1},xJn="org.eclipse.elk.core",DJn="Connected Components Compaction",RJn="org.eclipse.elk.alg.disco",KJn="org.eclipse.elk.alg.disco.graph",_Jn="org.eclipse.elk.alg.disco.options",FJn="CompactionStrategy",BJn="org.eclipse.elk.disco.componentCompaction.strategy",HJn="org.eclipse.elk.disco.componentCompaction.componentLayoutAlgorithm",qJn="org.eclipse.elk.disco.debug.discoGraph",GJn="org.eclipse.elk.disco.debug.discoPolys",zJn="componentCompaction",UJn="org.eclipse.elk.disco",XJn="org.eclipse.elk.spacing.componentComponent",WJn="org.eclipse.elk.edge.thickness",VJn="org.eclipse.elk.aspectRatio",QJn="org.eclipse.elk.padding",YJn="org.eclipse.elk.alg.disco.transform",JJn=1.5707963267948966,ZJn=17976931348623157e292,nZn={3:1,4:1,5:1,192:1},tZn={3:1,6:1,4:1,5:1,106:1,120:1},eZn="org.eclipse.elk.alg.force",iZn="ComponentsProcessor",rZn="ComponentsProcessor/1",cZn="org.eclipse.elk.alg.force.graph",aZn="Component Layout",uZn="org.eclipse.elk.alg.force.model",oZn="org.eclipse.elk.force.model",sZn="org.eclipse.elk.force.iterations",hZn="org.eclipse.elk.force.repulsivePower",fZn="org.eclipse.elk.force.temperature",lZn=.001,bZn="org.eclipse.elk.force.repulsion",wZn="org.eclipse.elk.alg.force.options",dZn=1.600000023841858,gZn="org.eclipse.elk.force",pZn="org.eclipse.elk.priority",vZn="org.eclipse.elk.spacing.nodeNode",mZn="org.eclipse.elk.spacing.edgeLabel",yZn="org.eclipse.elk.randomSeed",kZn="org.eclipse.elk.separateConnectedComponents",jZn="org.eclipse.elk.interactive",EZn="org.eclipse.elk.portConstraints",TZn="org.eclipse.elk.edgeLabels.inline",MZn="org.eclipse.elk.omitNodeMicroLayout",SZn="org.eclipse.elk.nodeSize.options",PZn="org.eclipse.elk.nodeSize.constraints",CZn="org.eclipse.elk.nodeLabels.placement",IZn="org.eclipse.elk.portLabels.placement",OZn="origin",AZn="random",$Zn="boundingBox.upLeft",LZn="boundingBox.lowRight",NZn="org.eclipse.elk.stress.fixed",xZn="org.eclipse.elk.stress.desiredEdgeLength",DZn="org.eclipse.elk.stress.dimension",RZn="org.eclipse.elk.stress.epsilon",KZn="org.eclipse.elk.stress.iterationLimit",_Zn="org.eclipse.elk.stress",FZn="ELK Stress",BZn="org.eclipse.elk.nodeSize.minimum",HZn="org.eclipse.elk.alg.force.stress",qZn="Layered layout",GZn="org.eclipse.elk.alg.layered",zZn="org.eclipse.elk.alg.layered.compaction.components",UZn="org.eclipse.elk.alg.layered.compaction.oned",XZn="org.eclipse.elk.alg.layered.compaction.oned.algs",WZn="org.eclipse.elk.alg.layered.compaction.recthull",VZn="org.eclipse.elk.alg.layered.components",QZn="NONE",YZn={3:1,6:1,4:1,9:1,5:1,122:1},JZn={3:1,6:1,4:1,5:1,141:1,106:1,120:1},ZZn="org.eclipse.elk.alg.layered.compound",n1n={51:1},t1n="org.eclipse.elk.alg.layered.graph",e1n=" -> ",i1n="Not supported by LGraph",r1n="Port side is undefined",c1n={3:1,6:1,4:1,5:1,474:1,141:1,106:1,120:1},a1n={3:1,6:1,4:1,5:1,141:1,193:1,203:1,106:1,120:1},u1n={3:1,6:1,4:1,5:1,141:1,1943:1,203:1,106:1,120:1},o1n="([{\"' \t\r\n",s1n=")]}\"' \t\r\n",h1n="The given string contains parts that cannot be parsed as numbers.",f1n="org.eclipse.elk.core.math",l1n={3:1,4:1,142:1,207:1,414:1},b1n={3:1,4:1,116:1,207:1,414:1},w1n="org.eclipse.elk.layered",d1n="org.eclipse.elk.alg.layered.graph.transform",g1n="ElkGraphImporter",p1n="ElkGraphImporter/lambda$0$Type",v1n="ElkGraphImporter/lambda$1$Type",m1n="ElkGraphImporter/lambda$2$Type",y1n="ElkGraphImporter/lambda$4$Type",k1n="Node margin calculation",j1n="org.eclipse.elk.alg.layered.intermediate",E1n="ONE_SIDED_GREEDY_SWITCH",T1n="TWO_SIDED_GREEDY_SWITCH",M1n="No implementation is available for the layout processor ",S1n="IntermediateProcessorStrategy",P1n="Node '",C1n="FIRST_SEPARATE",I1n="LAST_SEPARATE",O1n="Odd port side processing",A1n="org.eclipse.elk.alg.layered.intermediate.compaction",$1n="org.eclipse.elk.alg.layered.intermediate.greedyswitch",L1n="org.eclipse.elk.alg.layered.p3order.counting",N1n={225:1},x1n="org.eclipse.elk.alg.layered.intermediate.loops",D1n="org.eclipse.elk.alg.layered.intermediate.loops.ordering",R1n="org.eclipse.elk.alg.layered.intermediate.loops.routing",K1n="org.eclipse.elk.alg.layered.intermediate.preserveorder",_1n="org.eclipse.elk.alg.layered.intermediate.wrapping",F1n="org.eclipse.elk.alg.layered.options",B1n="INTERACTIVE",H1n="DEPTH_FIRST",q1n="EDGE_LENGTH",G1n="SELF_LOOPS",z1n="firstTryWithInitialOrder",U1n="org.eclipse.elk.layered.directionCongruency",X1n="org.eclipse.elk.layered.feedbackEdges",W1n="org.eclipse.elk.layered.interactiveReferencePoint",V1n="org.eclipse.elk.layered.mergeEdges",Q1n="org.eclipse.elk.layered.mergeHierarchyEdges",Y1n="org.eclipse.elk.layered.allowNonFlowPortsToSwitchSides",J1n="org.eclipse.elk.layered.portSortingStrategy",Z1n="org.eclipse.elk.layered.thoroughness",n0n="org.eclipse.elk.layered.unnecessaryBendpoints",t0n="org.eclipse.elk.layered.generatePositionAndLayerIds",e0n="org.eclipse.elk.layered.cycleBreaking.strategy",i0n="org.eclipse.elk.layered.layering.strategy",r0n="org.eclipse.elk.layered.layering.layerConstraint",c0n="org.eclipse.elk.layered.layering.layerChoiceConstraint",a0n="org.eclipse.elk.layered.layering.layerId",u0n="org.eclipse.elk.layered.layering.minWidth.upperBoundOnWidth",o0n="org.eclipse.elk.layered.layering.minWidth.upperLayerEstimationScalingFactor",s0n="org.eclipse.elk.layered.layering.nodePromotion.strategy",h0n="org.eclipse.elk.layered.layering.nodePromotion.maxIterations",f0n="org.eclipse.elk.layered.layering.coffmanGraham.layerBound",l0n="org.eclipse.elk.layered.crossingMinimization.strategy",b0n="org.eclipse.elk.layered.crossingMinimization.forceNodeModelOrder",w0n="org.eclipse.elk.layered.crossingMinimization.hierarchicalSweepiness",d0n="org.eclipse.elk.layered.crossingMinimization.semiInteractive",g0n="org.eclipse.elk.layered.crossingMinimization.positionChoiceConstraint",p0n="org.eclipse.elk.layered.crossingMinimization.positionId",v0n="org.eclipse.elk.layered.crossingMinimization.greedySwitch.activationThreshold",m0n="org.eclipse.elk.layered.crossingMinimization.greedySwitch.type",y0n="org.eclipse.elk.layered.crossingMinimization.greedySwitchHierarchical.type",k0n="org.eclipse.elk.layered.nodePlacement.strategy",j0n="org.eclipse.elk.layered.nodePlacement.favorStraightEdges",E0n="org.eclipse.elk.layered.nodePlacement.bk.edgeStraightening",T0n="org.eclipse.elk.layered.nodePlacement.bk.fixedAlignment",M0n="org.eclipse.elk.layered.nodePlacement.linearSegments.deflectionDampening",S0n="org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility",P0n="org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility.default",C0n="org.eclipse.elk.layered.edgeRouting.selfLoopDistribution",I0n="org.eclipse.elk.layered.edgeRouting.selfLoopOrdering",O0n="org.eclipse.elk.layered.edgeRouting.splines.mode",A0n="org.eclipse.elk.layered.edgeRouting.splines.sloppy.layerSpacingFactor",$0n="org.eclipse.elk.layered.edgeRouting.polyline.slopedEdgeZoneWidth",L0n="org.eclipse.elk.layered.spacing.baseValue",N0n="org.eclipse.elk.layered.spacing.edgeNodeBetweenLayers",x0n="org.eclipse.elk.layered.spacing.edgeEdgeBetweenLayers",D0n="org.eclipse.elk.layered.spacing.nodeNodeBetweenLayers",R0n="org.eclipse.elk.layered.priority.direction",K0n="org.eclipse.elk.layered.priority.shortness",_0n="org.eclipse.elk.layered.priority.straightness",F0n="org.eclipse.elk.layered.compaction.connectedComponents",B0n="org.eclipse.elk.layered.compaction.postCompaction.strategy",H0n="org.eclipse.elk.layered.compaction.postCompaction.constraints",q0n="org.eclipse.elk.layered.highDegreeNodes.treatment",G0n="org.eclipse.elk.layered.highDegreeNodes.threshold",z0n="org.eclipse.elk.layered.highDegreeNodes.treeHeight",U0n="org.eclipse.elk.layered.wrapping.strategy",X0n="org.eclipse.elk.layered.wrapping.additionalEdgeSpacing",W0n="org.eclipse.elk.layered.wrapping.correctionFactor",V0n="org.eclipse.elk.layered.wrapping.cutting.strategy",Q0n="org.eclipse.elk.layered.wrapping.cutting.cuts",Y0n="org.eclipse.elk.layered.wrapping.cutting.msd.freedom",J0n="org.eclipse.elk.layered.wrapping.validify.strategy",Z0n="org.eclipse.elk.layered.wrapping.validify.forbiddenIndices",n2n="org.eclipse.elk.layered.wrapping.multiEdge.improveCuts",t2n="org.eclipse.elk.layered.wrapping.multiEdge.distancePenalty",e2n="org.eclipse.elk.layered.wrapping.multiEdge.improveWrappedEdges",i2n="org.eclipse.elk.layered.edgeLabels.sideSelection",r2n="org.eclipse.elk.layered.edgeLabels.centerLabelPlacementStrategy",c2n="org.eclipse.elk.layered.considerModelOrder.strategy",a2n="org.eclipse.elk.layered.considerModelOrder.noModelOrder",u2n="org.eclipse.elk.layered.considerModelOrder.components",o2n="org.eclipse.elk.layered.considerModelOrder.longEdgeStrategy",s2n="org.eclipse.elk.layered.considerModelOrder.crossingCounterNodeInfluence",h2n="org.eclipse.elk.layered.considerModelOrder.crossingCounterPortInfluence",f2n="layering",l2n="layering.minWidth",b2n="layering.nodePromotion",w2n="crossingMinimization",d2n="org.eclipse.elk.hierarchyHandling",g2n="crossingMinimization.greedySwitch",p2n="nodePlacement",v2n="nodePlacement.bk",m2n="edgeRouting",y2n="org.eclipse.elk.edgeRouting",k2n="spacing",j2n="priority",E2n="compaction",T2n="compaction.postCompaction",M2n="Specifies whether and how post-process compaction is applied.",S2n="highDegreeNodes",P2n="wrapping",C2n="wrapping.cutting",I2n="wrapping.validify",O2n="wrapping.multiEdge",A2n="edgeLabels",$2n="considerModelOrder",L2n="org.eclipse.elk.spacing.commentComment",N2n="org.eclipse.elk.spacing.commentNode",x2n="org.eclipse.elk.spacing.edgeEdge",D2n="org.eclipse.elk.spacing.edgeNode",R2n="org.eclipse.elk.spacing.labelLabel",K2n="org.eclipse.elk.spacing.labelPortHorizontal",_2n="org.eclipse.elk.spacing.labelPortVertical",F2n="org.eclipse.elk.spacing.labelNode",B2n="org.eclipse.elk.spacing.nodeSelfLoop",H2n="org.eclipse.elk.spacing.portPort",q2n="org.eclipse.elk.spacing.individual",G2n="org.eclipse.elk.port.borderOffset",z2n="org.eclipse.elk.noLayout",U2n="org.eclipse.elk.port.side",X2n="org.eclipse.elk.debugMode",W2n="org.eclipse.elk.alignment",V2n="org.eclipse.elk.insideSelfLoops.activate",Q2n="org.eclipse.elk.insideSelfLoops.yo",Y2n="org.eclipse.elk.nodeSize.fixedGraphSize",J2n="org.eclipse.elk.direction",Z2n="org.eclipse.elk.nodeLabels.padding",n3n="org.eclipse.elk.portLabels.nextToPortIfPossible",t3n="org.eclipse.elk.portLabels.treatAsGroup",e3n="org.eclipse.elk.portAlignment.default",i3n="org.eclipse.elk.portAlignment.north",r3n="org.eclipse.elk.portAlignment.south",c3n="org.eclipse.elk.portAlignment.west",a3n="org.eclipse.elk.portAlignment.east",u3n="org.eclipse.elk.contentAlignment",o3n="org.eclipse.elk.junctionPoints",s3n="org.eclipse.elk.edgeLabels.placement",h3n="org.eclipse.elk.port.index",f3n="org.eclipse.elk.commentBox",l3n="org.eclipse.elk.hypernode",b3n="org.eclipse.elk.port.anchor",w3n="org.eclipse.elk.partitioning.activate",d3n="org.eclipse.elk.partitioning.partition",g3n="org.eclipse.elk.position",p3n="org.eclipse.elk.margins",v3n="org.eclipse.elk.spacing.portsSurrounding",m3n="org.eclipse.elk.interactiveLayout",y3n="org.eclipse.elk.core.util",k3n={3:1,4:1,5:1,593:1},j3n="NETWORK_SIMPLEX",E3n={123:1,51:1},T3n="org.eclipse.elk.alg.layered.p1cycles",M3n="org.eclipse.elk.alg.layered.p2layers",S3n={402:1,225:1},P3n={832:1,3:1,4:1},C3n="org.eclipse.elk.alg.layered.p3order",I3n="org.eclipse.elk.alg.layered.p4nodes",O3n={3:1,4:1,5:1,840:1},A3n=1e-5,$3n="org.eclipse.elk.alg.layered.p4nodes.bk",L3n="org.eclipse.elk.alg.layered.p5edges",N3n="org.eclipse.elk.alg.layered.p5edges.orthogonal",x3n="org.eclipse.elk.alg.layered.p5edges.orthogonal.direction",D3n=1e-6,R3n="org.eclipse.elk.alg.layered.p5edges.splines",K3n=.09999999999999998,_3n=1e-8,F3n=4.71238898038469,B3n=3.141592653589793,H3n="org.eclipse.elk.alg.mrtree",q3n="org.eclipse.elk.alg.mrtree.graph",G3n="org.eclipse.elk.alg.mrtree.intermediate",z3n="Set neighbors in level",U3n="DESCENDANTS",X3n="org.eclipse.elk.mrtree.weighting",W3n="org.eclipse.elk.mrtree.searchOrder",V3n="org.eclipse.elk.alg.mrtree.options",Q3n="org.eclipse.elk.mrtree",Y3n="org.eclipse.elk.tree",J3n="org.eclipse.elk.alg.radial",Z3n=6.283185307179586,n4n=5e-324,t4n="org.eclipse.elk.alg.radial.intermediate",e4n="org.eclipse.elk.alg.radial.intermediate.compaction",i4n={3:1,4:1,5:1,106:1},r4n="org.eclipse.elk.alg.radial.intermediate.optimization",c4n="No implementation is available for the layout option ",a4n="org.eclipse.elk.alg.radial.options",u4n="org.eclipse.elk.radial.orderId",o4n="org.eclipse.elk.radial.radius",s4n="org.eclipse.elk.radial.compactor",h4n="org.eclipse.elk.radial.compactionStepSize",f4n="org.eclipse.elk.radial.sorter",l4n="org.eclipse.elk.radial.wedgeCriteria",b4n="org.eclipse.elk.radial.optimizationCriteria",w4n="org.eclipse.elk.radial",d4n="org.eclipse.elk.alg.radial.p1position.wedge",g4n="org.eclipse.elk.alg.radial.sorting",p4n=5.497787143782138,v4n=3.9269908169872414,m4n=2.356194490192345,y4n="org.eclipse.elk.alg.rectpacking",k4n="org.eclipse.elk.alg.rectpacking.firstiteration",j4n="org.eclipse.elk.alg.rectpacking.options",E4n="org.eclipse.elk.rectpacking.optimizationGoal",T4n="org.eclipse.elk.rectpacking.lastPlaceShift",M4n="org.eclipse.elk.rectpacking.currentPosition",S4n="org.eclipse.elk.rectpacking.desiredPosition",P4n="org.eclipse.elk.rectpacking.onlyFirstIteration",C4n="org.eclipse.elk.rectpacking.rowCompaction",I4n="org.eclipse.elk.rectpacking.expandToAspectRatio",O4n="org.eclipse.elk.rectpacking.targetWidth",A4n="org.eclipse.elk.expandNodes",$4n="org.eclipse.elk.rectpacking",L4n="org.eclipse.elk.alg.rectpacking.util",N4n="No implementation available for ",x4n="org.eclipse.elk.alg.spore",D4n="org.eclipse.elk.alg.spore.options",R4n="org.eclipse.elk.sporeCompaction",K4n="org.eclipse.elk.underlyingLayoutAlgorithm",_4n="org.eclipse.elk.processingOrder.treeConstruction",F4n="org.eclipse.elk.processingOrder.spanningTreeCostFunction",B4n="org.eclipse.elk.processingOrder.preferredRoot",H4n="org.eclipse.elk.processingOrder.rootSelection",q4n="org.eclipse.elk.structure.structureExtractionStrategy",G4n="org.eclipse.elk.compaction.compactionStrategy",z4n="org.eclipse.elk.compaction.orthogonal",U4n="org.eclipse.elk.overlapRemoval.maxIterations",X4n="org.eclipse.elk.overlapRemoval.runScanline",W4n="processingOrder",V4n="overlapRemoval",Q4n="org.eclipse.elk.sporeOverlap",Y4n="org.eclipse.elk.alg.spore.p1structure",J4n="org.eclipse.elk.alg.spore.p2processingorder",Z4n="org.eclipse.elk.alg.spore.p3execution",n5n="Invalid index: ",t5n="org.eclipse.elk.core.alg",e5n={331:1},i5n={288:1},r5n="Make sure its type is registered with the ",c5n=" utility class.",a5n="true",u5n="false",o5n="Couldn't clone property '",s5n=.05,h5n="org.eclipse.elk.core.options",f5n=1.2999999523162842,l5n="org.eclipse.elk.box",b5n="org.eclipse.elk.box.packingMode",w5n="org.eclipse.elk.algorithm",d5n="org.eclipse.elk.resolvedAlgorithm",g5n="org.eclipse.elk.bendPoints",p5n="org.eclipse.elk.labelManager",v5n="org.eclipse.elk.scaleFactor",m5n="org.eclipse.elk.animate",y5n="org.eclipse.elk.animTimeFactor",k5n="org.eclipse.elk.layoutAncestors",j5n="org.eclipse.elk.maxAnimTime",E5n="org.eclipse.elk.minAnimTime",T5n="org.eclipse.elk.progressBar",M5n="org.eclipse.elk.validateGraph",S5n="org.eclipse.elk.validateOptions",P5n="org.eclipse.elk.zoomToFit",C5n="org.eclipse.elk.font.name",I5n="org.eclipse.elk.font.size",O5n="org.eclipse.elk.edge.type",A5n="partitioning",$5n="nodeLabels",L5n="portAlignment",N5n="nodeSize",x5n="port",D5n="portLabels",R5n="insideSelfLoops",K5n="org.eclipse.elk.fixed",_5n="org.eclipse.elk.random",F5n="port must have a parent node to calculate the port side",B5n="The edge needs to have exactly one edge section. Found: ",H5n="org.eclipse.elk.core.util.adapters",q5n="org.eclipse.emf.ecore",G5n="org.eclipse.elk.graph",z5n="EMapPropertyHolder",U5n="ElkBendPoint",X5n="ElkGraphElement",W5n="ElkConnectableShape",V5n="ElkEdge",Q5n="ElkEdgeSection",Y5n="EModelElement",J5n="ENamedElement",Z5n="ElkLabel",n6n="ElkNode",t6n="ElkPort",e6n={92:1,90:1},i6n="org.eclipse.emf.common.notify.impl",r6n="The feature '",c6n="' is not a valid changeable feature",a6n="Expecting null",u6n="' is not a valid feature",o6n="The feature ID",s6n=" is not a valid feature ID",h6n=32768,f6n={105:1,92:1,90:1,56:1,49:1,97:1},l6n="org.eclipse.emf.ecore.impl",b6n="org.eclipse.elk.graph.impl",w6n="Recursive containment not allowed for ",d6n="The datatype '",g6n="' is not a valid classifier",p6n="The value '",v6n={190:1,3:1,4:1},m6n="The class '",y6n="http://www.eclipse.org/elk/ElkGraph",k6n=1024,j6n="property",E6n="value",T6n="source",M6n="properties",S6n="identifier",P6n="height",C6n="width",I6n="parent",O6n="text",A6n="children",$6n="hierarchical",L6n="sources",N6n="targets",x6n="sections",D6n="bendPoints",R6n="outgoingShape",K6n="incomingShape",_6n="outgoingSections",F6n="incomingSections",B6n="org.eclipse.emf.common.util",H6n="Severe implementation error in the Json to ElkGraph importer.",q6n="id",G6n="org.eclipse.elk.graph.json",z6n="Unhandled parameter types: ",U6n="startPoint",X6n="An edge must have at least one source and one target (edge id: '",W6n="').",V6n="Referenced edge section does not exist: ",Q6n=" (edge id: '",Y6n="target",J6n="sourcePoint",Z6n="targetPoint",n8n="group",t8n="name",e8n="connectableShape cannot be null",i8n="edge cannot be null",r8n="Passed edge is not 'simple'.",c8n="org.eclipse.elk.graph.util",a8n="The 'no duplicates' constraint is violated",u8n="targetIndex=",o8n=", size=",s8n="sourceIndex=",h8n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1},f8n={3:1,4:1,20:1,28:1,52:1,14:1,47:1,15:1,54:1,67:1,63:1,58:1,588:1},l8n="logging",b8n="measureExecutionTime",w8n="parser.parse.1",d8n="parser.parse.2",g8n="parser.next.1",p8n="parser.next.2",v8n="parser.next.3",m8n="parser.next.4",y8n="parser.factor.1",k8n="parser.factor.2",j8n="parser.factor.3",E8n="parser.factor.4",T8n="parser.factor.5",M8n="parser.factor.6",S8n="parser.atom.1",P8n="parser.atom.2",C8n="parser.atom.3",I8n="parser.atom.4",O8n="parser.atom.5",A8n="parser.cc.1",$8n="parser.cc.2",L8n="parser.cc.3",N8n="parser.cc.5",x8n="parser.cc.6",D8n="parser.cc.7",R8n="parser.cc.8",K8n="parser.ope.1",_8n="parser.ope.2",F8n="parser.ope.3",B8n="parser.descape.1",H8n="parser.descape.2",q8n="parser.descape.3",G8n="parser.descape.4",z8n="parser.descape.5",U8n="parser.process.1",X8n="parser.quantifier.1",W8n="parser.quantifier.2",V8n="parser.quantifier.3",Q8n="parser.quantifier.4",Y8n="parser.quantifier.5",J8n="org.eclipse.emf.common.notify",Z8n={415:1,672:1},n9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1},t9n={366:1,143:1},e9n="index=",i9n={3:1,4:1,5:1,126:1},r9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,58:1},c9n={3:1,6:1,4:1,5:1,192:1},a9n={3:1,4:1,5:1,165:1,367:1},u9n=";/?:@&=+$,",o9n="invalid authority: ",s9n="EAnnotation",h9n="ETypedElement",f9n="EStructuralFeature",l9n="EAttribute",b9n="EClassifier",w9n="EEnumLiteral",d9n="EGenericType",g9n="EOperation",p9n="EParameter",v9n="EReference",m9n="ETypeParameter",y9n="org.eclipse.emf.ecore.util",k9n={76:1},j9n={3:1,20:1,14:1,15:1,58:1,589:1,76:1,69:1,95:1},E9n="org.eclipse.emf.ecore.util.FeatureMap$Entry",T9n=8192,M9n=2048,S9n="byte",P9n="char",C9n="double",I9n="float",O9n="int",A9n="long",$9n="short",L9n="java.lang.Object",N9n={3:1,4:1,5:1,247:1},x9n={3:1,4:1,5:1,673:1},D9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,69:1},R9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,69:1,95:1},K9n="mixed",_9n="http:///org/eclipse/emf/ecore/util/ExtendedMetaData",F9n="kind",B9n={3:1,4:1,5:1,674:1},H9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1,76:1,69:1,95:1},q9n={20:1,28:1,52:1,14:1,15:1,58:1,69:1},G9n={47:1,125:1,279:1},z9n={72:1,332:1},U9n="The value of type '",X9n="' must be of type '",W9n=1316,V9n="http://www.eclipse.org/emf/2002/Ecore",Q9n=-32768,Y9n="constraints",J9n="baseType",Z9n="getEStructuralFeature",n7n="getFeatureID",t7n="feature",e7n="getOperationID",i7n="operation",r7n="defaultValue",c7n="eTypeParameters",a7n="isInstance",u7n="getEEnumLiteral",o7n="eContainingClass",s7n={55:1},h7n={3:1,4:1,5:1,119:1},f7n="org.eclipse.emf.ecore.resource",l7n={92:1,90:1,591:1,1935:1},b7n="org.eclipse.emf.ecore.resource.impl",w7n="unspecified",d7n="simple",g7n="attribute",p7n="attributeWildcard",v7n="element",m7n="elementWildcard",y7n="collapse",k7n="itemType",j7n="namespace",E7n="##targetNamespace",T7n="whiteSpace",M7n="wildcards",S7n="http://www.eclipse.org/emf/2003/XMLType",P7n="##any",C7n="uninitialized",I7n="The multiplicity constraint is violated",O7n="org.eclipse.emf.ecore.xml.type",A7n="ProcessingInstruction",$7n="SimpleAnyType",L7n="XMLTypeDocumentRoot",N7n="org.eclipse.emf.ecore.xml.type.impl",x7n="INF",D7n="processing",R7n="ENTITIES_._base",K7n="minLength",_7n="ENTITY",F7n="NCName",B7n="IDREFS_._base",H7n="integer",q7n="token",G7n="pattern",z7n="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*",U7n="\\i\\c*",X7n="[\\i-[:]][\\c-[:]]*",W7n="nonPositiveInteger",V7n="maxInclusive",Q7n="NMTOKEN",Y7n="NMTOKENS_._base",J7n="nonNegativeInteger",Z7n="minInclusive",nnt="normalizedString",tnt="unsignedByte",ent="unsignedInt",int="18446744073709551615",rnt="unsignedShort",cnt="processingInstruction",ant="org.eclipse.emf.ecore.xml.type.internal",unt=1114111,ont="Internal Error: shorthands: \\u",snt="xml:isDigit",hnt="xml:isWord",fnt="xml:isSpace",lnt="xml:isNameChar",bnt="xml:isInitialNameChar",wnt="09\u0660\u0669\u06f0\u06f9\u0966\u096f\u09e6\u09ef\u0a66\u0a6f\u0ae6\u0aef\u0b66\u0b6f\u0be7\u0bef\u0c66\u0c6f\u0ce6\u0cef\u0d66\u0d6f\u0e50\u0e59\u0ed0\u0ed9\u0f20\u0f29",dnt="AZaz\xc0\xd6\xd8\xf6\xf8\u0131\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u0386\u0386\u0388\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da\u03dc\u03dc\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9\u0531\u0556\u0559\u0559\u0561\u0586\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0641\u064a\u0671\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06d5\u06e5\u06e6\u0905\u0939\u093d\u093d\u0958\u0961\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09dc\u09dd\u09df\u09e1\u09f0\u09f1\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59\u0a5c\u0a5e\u0a5e\u0a72\u0a74\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9\u0abd\u0abd\u0ae0\u0ae0\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39\u0b3d\u0b3d\u0b5c\u0b5d\u0b5f\u0b61\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c60\u0c61\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cde\u0cde\u0ce0\u0ce1\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d60\u0d61\u0e01\u0e2e\u0e30\u0e30\u0e32\u0e33\u0e40\u0e45\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb0\u0eb2\u0eb3\u0ebd\u0ebd\u0ec0\u0ec4\u0f40\u0f47\u0f49\u0f69\u10a0\u10c5\u10d0\u10f6\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c\u113e\u113e\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159\u115f\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173\u1175\u1175\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba\u11bc\u11c2\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u2126\u2126\u212a\u212b\u212e\u212e\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30a1\u30fa\u3105\u312c\u4e00\u9fa5\uac00\ud7a3",gnt="Private Use",pnt="ASSIGNED",vnt="\0\x7f\x80\xff\u0100\u017f\u0180\u024f\u0250\u02af\u02b0\u02ff\u0300\u036f\u0370\u03ff\u0400\u04ff\u0530\u058f\u0590\u05ff\u0600\u06ff\u0700\u074f\u0780\u07bf\u0900\u097f\u0980\u09ff\u0a00\u0a7f\u0a80\u0aff\u0b00\u0b7f\u0b80\u0bff\u0c00\u0c7f\u0c80\u0cff\u0d00\u0d7f\u0d80\u0dff\u0e00\u0e7f\u0e80\u0eff\u0f00\u0fff\u1000\u109f\u10a0\u10ff\u1100\u11ff\u1200\u137f\u13a0\u13ff\u1400\u167f\u1680\u169f\u16a0\u16ff\u1780\u17ff\u1800\u18af\u1e00\u1eff\u1f00\u1fff\u2000\u206f\u2070\u209f\u20a0\u20cf\u20d0\u20ff\u2100\u214f\u2150\u218f\u2190\u21ff\u2200\u22ff\u2300\u23ff\u2400\u243f\u2440\u245f\u2460\u24ff\u2500\u257f\u2580\u259f\u25a0\u25ff\u2600\u26ff\u2700\u27bf\u2800\u28ff\u2e80\u2eff\u2f00\u2fdf\u2ff0\u2fff\u3000\u303f\u3040\u309f\u30a0\u30ff\u3100\u312f\u3130\u318f\u3190\u319f\u31a0\u31bf\u3200\u32ff\u3300\u33ff\u3400\u4db5\u4e00\u9fff\ua000\ua48f\ua490\ua4cf\uac00\ud7a3\ue000\uf8ff\uf900\ufaff\ufb00\ufb4f\ufb50\ufdff\ufe20\ufe2f\ufe30\ufe4f\ufe50\ufe6f\ufe70\ufefe\ufeff\ufeff\uff00\uffef",mnt="UNASSIGNED",ynt={3:1,117:1},knt="org.eclipse.emf.ecore.xml.type.util",jnt={3:1,4:1,5:1,368:1},Ent="org.eclipse.xtext.xbase.lib",Tnt="Cannot add elements to a Range",Mnt="Cannot set elements in a Range",Snt="Cannot remove elements from a Range",Pnt="locale",Cnt="default",Int="user.agent";e.goog=e.goog||{},e.goog.global=e.goog.global||e,WMn(),wAn(1,null,{},r),MWn.Fb=function(n){return FO(this,n)},MWn.Gb=function(){return this.gm},MWn.Hb=function(){return PN(this)},MWn.Ib=function(){return nE(tsn(this))+"@"+(nsn(this)>>>0).toString(16)},MWn.equals=function(n){return this.Fb(n)},MWn.hashCode=function(){return this.Hb()},MWn.toString=function(){return this.Ib()},wAn(290,1,{290:1,2026:1},pon),MWn.le=function(n){var t;return(t=new pon).i=4,t.c=n>1?gZ(this,n-1):this,t},MWn.me=function(){return ED(this),this.b},MWn.ne=function(){return nE(this)},MWn.oe=function(){return ED(this),this.k},MWn.pe=function(){return 0!=(4&this.i)},MWn.qe=function(){return 0!=(1&this.i)},MWn.Ib=function(){return utn(this)},MWn.i=0;var Ont,Ant=vX(RWn,"Object",1),$nt=vX(RWn,"Class",290);wAn(1998,1,KWn),vX(_Wn,"Optional",1998),wAn(1170,1998,KWn,c),MWn.Fb=function(n){return n===this},MWn.Hb=function(){return 2040732332},MWn.Ib=function(){return"Optional.absent()"},MWn.Jb=function(n){return yX(n),iy(),Ont},vX(_Wn,"Absent",1170),wAn(628,1,{},mk),vX(_Wn,"Joiner",628);var Lnt=bq(_Wn,"Predicate");wAn(582,1,{169:1,582:1,3:1,45:1},Hf),MWn.Mb=function(n){return Kon(this,n)},MWn.Lb=function(n){return Kon(this,n)},MWn.Fb=function(n){var t;return!!cL(n,582)&&(t=BB(n,582),NAn(this.a,t.a))},MWn.Hb=function(){return Fon(this.a)+306654252},MWn.Ib=function(){return wPn(this.a)},vX(_Wn,"Predicates/AndPredicate",582),wAn(408,1998,{408:1,3:1},qf),MWn.Fb=function(n){var t;return!!cL(n,408)&&(t=BB(n,408),Nfn(this.a,t.a))},MWn.Hb=function(){return 1502476572+nsn(this.a)},MWn.Ib=function(){return GWn+this.a+")"},MWn.Jb=function(n){return new qf(WQ(n.Kb(this.a),"the Function passed to Optional.transform() must not return null."))},vX(_Wn,"Present",408),wAn(198,1,UWn),MWn.Nb=function(n){fU(this,n)},MWn.Qb=function(){bk()},vX(XWn,"UnmodifiableIterator",198),wAn(1978,198,WWn),MWn.Qb=function(){bk()},MWn.Rb=function(n){throw Hp(new pv)},MWn.Wb=function(n){throw Hp(new pv)},vX(XWn,"UnmodifiableListIterator",1978),wAn(386,1978,WWn),MWn.Ob=function(){return this.c0},MWn.Pb=function(){if(this.c>=this.d)throw Hp(new yv);return this.Xb(this.c++)},MWn.Tb=function(){return this.c},MWn.Ub=function(){if(this.c<=0)throw Hp(new yv);return this.Xb(--this.c)},MWn.Vb=function(){return this.c-1},MWn.c=0,MWn.d=0,vX(XWn,"AbstractIndexedListIterator",386),wAn(699,198,UWn),MWn.Ob=function(){return Zin(this)},MWn.Pb=function(){return P7(this)},MWn.e=1,vX(XWn,"AbstractIterator",699),wAn(1986,1,{224:1}),MWn.Zb=function(){return this.f||(this.f=this.ac())},MWn.Fb=function(n){return jsn(this,n)},MWn.Hb=function(){return nsn(this.Zb())},MWn.dc=function(){return 0==this.gc()},MWn.ec=function(){return gz(this)},MWn.Ib=function(){return Bbn(this.Zb())},vX(XWn,"AbstractMultimap",1986),wAn(726,1986,VWn),MWn.$b=function(){win(this)},MWn._b=function(n){return Wj(this,n)},MWn.ac=function(){return new pT(this,this.c)},MWn.ic=function(n){return this.hc()},MWn.bc=function(){return new HL(this,this.c)},MWn.jc=function(){return this.mc(this.hc())},MWn.kc=function(){return new Hm(this)},MWn.lc=function(){return qTn(this.c.vc().Nc(),new u,64,this.d)},MWn.cc=function(n){return h6(this,n)},MWn.fc=function(n){return Nhn(this,n)},MWn.gc=function(){return this.d},MWn.mc=function(n){return SQ(),new Hb(n)},MWn.nc=function(){return new Bm(this)},MWn.oc=function(){return qTn(this.c.Cc().Nc(),new a,64,this.d)},MWn.pc=function(n,t){return new W6(this,n,t,null)},MWn.d=0,vX(XWn,"AbstractMapBasedMultimap",726),wAn(1631,726,VWn),MWn.hc=function(){return new J6(this.a)},MWn.jc=function(){return SQ(),SQ(),set},MWn.cc=function(n){return BB(h6(this,n),15)},MWn.fc=function(n){return BB(Nhn(this,n),15)},MWn.Zb=function(){return OQ(this)},MWn.Fb=function(n){return jsn(this,n)},MWn.qc=function(n){return BB(h6(this,n),15)},MWn.rc=function(n){return BB(Nhn(this,n),15)},MWn.mc=function(n){return rY(BB(n,15))},MWn.pc=function(n,t){return i3(this,n,BB(t,15),null)},vX(XWn,"AbstractListMultimap",1631),wAn(732,1,QWn),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.c.Ob()||this.e.Ob()},MWn.Pb=function(){var n;return this.e.Ob()||(n=BB(this.c.Pb(),42),this.b=n.cd(),this.a=BB(n.dd(),14),this.e=this.a.Kc()),this.sc(this.b,this.e.Pb())},MWn.Qb=function(){this.e.Qb(),this.a.dc()&&this.c.Qb(),--this.d.d},vX(XWn,"AbstractMapBasedMultimap/Itr",732),wAn(1099,732,QWn,Bm),MWn.sc=function(n,t){return t},vX(XWn,"AbstractMapBasedMultimap/1",1099),wAn(1100,1,{},a),MWn.Kb=function(n){return BB(n,14).Nc()},vX(XWn,"AbstractMapBasedMultimap/1methodref$spliterator$Type",1100),wAn(1101,732,QWn,Hm),MWn.sc=function(n,t){return new vT(n,t)},vX(XWn,"AbstractMapBasedMultimap/2",1101);var Nnt=bq(YWn,"Map");wAn(1967,1,JWn),MWn.wc=function(n){nan(this,n)},MWn.yc=function(n,t,e){return Zln(this,n,t,e)},MWn.$b=function(){this.vc().$b()},MWn.tc=function(n){return Mmn(this,n)},MWn._b=function(n){return!!FEn(this,n,!1)},MWn.uc=function(n){var t,e;for(t=this.vc().Kc();t.Ob();)if(e=BB(t.Pb(),42).dd(),GI(n)===GI(e)||null!=n&&Nfn(n,e))return!0;return!1},MWn.Fb=function(n){var t,e,i;if(n===this)return!0;if(!cL(n,83))return!1;if(i=BB(n,83),this.gc()!=i.gc())return!1;for(e=i.vc().Kc();e.Ob();)if(t=BB(e.Pb(),42),!this.tc(t))return!1;return!0},MWn.xc=function(n){return qI(FEn(this,n,!1))},MWn.Hb=function(){return Hun(this.vc())},MWn.dc=function(){return 0==this.gc()},MWn.ec=function(){return new Cb(this)},MWn.zc=function(n,t){throw Hp(new tk("Put not supported on this map"))},MWn.Ac=function(n){Tcn(this,n)},MWn.Bc=function(n){return qI(FEn(this,n,!0))},MWn.gc=function(){return this.vc().gc()},MWn.Ib=function(){return nTn(this)},MWn.Cc=function(){return new Ob(this)},vX(YWn,"AbstractMap",1967),wAn(1987,1967,JWn),MWn.bc=function(){return new ST(this)},MWn.vc=function(){return dz(this)},MWn.ec=function(){return this.g||(this.g=this.bc())},MWn.Cc=function(){return this.i||(this.i=new PT(this))},vX(XWn,"Maps/ViewCachingAbstractMap",1987),wAn(389,1987,JWn,pT),MWn.xc=function(n){return ktn(this,n)},MWn.Bc=function(n){return Zsn(this,n)},MWn.$b=function(){this.d==this.e.c?this.e.$b():Cq(new Oq(this))},MWn._b=function(n){return gfn(this.d,n)},MWn.Ec=function(){return new Xf(this)},MWn.Dc=function(){return this.Ec()},MWn.Fb=function(n){return this===n||Nfn(this.d,n)},MWn.Hb=function(){return nsn(this.d)},MWn.ec=function(){return this.e.ec()},MWn.gc=function(){return this.d.gc()},MWn.Ib=function(){return Bbn(this.d)},vX(XWn,"AbstractMapBasedMultimap/AsMap",389);var xnt=bq(RWn,"Iterable");wAn(28,1,ZWn),MWn.Jc=function(n){e5(this,n)},MWn.Lc=function(){return this.Oc()},MWn.Nc=function(){return new w1(this,0)},MWn.Oc=function(){return new Rq(null,this.Nc())},MWn.Fc=function(n){throw Hp(new tk("Add not supported on this collection"))},MWn.Gc=function(n){return Frn(this,n)},MWn.$b=function(){TV(this)},MWn.Hc=function(n){return ywn(this,n,!1)},MWn.Ic=function(n){return oun(this,n)},MWn.dc=function(){return 0==this.gc()},MWn.Mc=function(n){return ywn(this,n,!0)},MWn.Pc=function(){return cz(this)},MWn.Qc=function(n){return Emn(this,n)},MWn.Ib=function(){return LMn(this)},vX(YWn,"AbstractCollection",28);var Dnt=bq(YWn,"Set");wAn(nVn,28,tVn),MWn.Nc=function(){return new w1(this,1)},MWn.Fb=function(n){return ign(this,n)},MWn.Hb=function(){return Hun(this)},vX(YWn,"AbstractSet",nVn),wAn(1970,nVn,tVn),vX(XWn,"Sets/ImprovedAbstractSet",1970),wAn(1971,1970,tVn),MWn.$b=function(){this.Rc().$b()},MWn.Hc=function(n){return idn(this,n)},MWn.dc=function(){return this.Rc().dc()},MWn.Mc=function(n){var t;return!!this.Hc(n)&&(t=BB(n,42),this.Rc().ec().Mc(t.cd()))},MWn.gc=function(){return this.Rc().gc()},vX(XWn,"Maps/EntrySet",1971),wAn(1097,1971,tVn,Xf),MWn.Hc=function(n){return wfn(this.a.d.vc(),n)},MWn.Kc=function(){return new Oq(this.a)},MWn.Rc=function(){return this.a},MWn.Mc=function(n){var t;return!!wfn(this.a.d.vc(),n)&&(t=BB(n,42),H5(this.a.e,t.cd()),!0)},MWn.Nc=function(){return RB(this.a.d.vc().Nc(),new Wf(this.a))},vX(XWn,"AbstractMapBasedMultimap/AsMap/AsMapEntries",1097),wAn(1098,1,{},Wf),MWn.Kb=function(n){return i5(this.a,BB(n,42))},vX(XWn,"AbstractMapBasedMultimap/AsMap/AsMapEntries/0methodref$wrapEntry$Type",1098),wAn(730,1,QWn,Oq),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){var n;return n=BB(this.b.Pb(),42),this.a=BB(n.dd(),14),i5(this.c,n)},MWn.Ob=function(){return this.b.Ob()},MWn.Qb=function(){han(!!this.a),this.b.Qb(),this.c.e.d-=this.a.gc(),this.a.$b(),this.a=null},vX(XWn,"AbstractMapBasedMultimap/AsMap/AsMapIterator",730),wAn(532,1970,tVn,ST),MWn.$b=function(){this.b.$b()},MWn.Hc=function(n){return this.b._b(n)},MWn.Jc=function(n){yX(n),this.b.wc(new vl(n))},MWn.dc=function(){return this.b.dc()},MWn.Kc=function(){return new ly(this.b.vc().Kc())},MWn.Mc=function(n){return!!this.b._b(n)&&(this.b.Bc(n),!0)},MWn.gc=function(){return this.b.gc()},vX(XWn,"Maps/KeySet",532),wAn(318,532,tVn,HL),MWn.$b=function(){Cq(new eT(this,this.b.vc().Kc()))},MWn.Ic=function(n){return this.b.ec().Ic(n)},MWn.Fb=function(n){return this===n||Nfn(this.b.ec(),n)},MWn.Hb=function(){return nsn(this.b.ec())},MWn.Kc=function(){return new eT(this,this.b.vc().Kc())},MWn.Mc=function(n){var t,e;return e=0,(t=BB(this.b.Bc(n),14))&&(e=t.gc(),t.$b(),this.a.d-=e),e>0},MWn.Nc=function(){return this.b.ec().Nc()},vX(XWn,"AbstractMapBasedMultimap/KeySet",318),wAn(731,1,QWn,eT),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.c.Ob()},MWn.Pb=function(){return this.a=BB(this.c.Pb(),42),this.a.cd()},MWn.Qb=function(){var n;han(!!this.a),n=BB(this.a.dd(),14),this.c.Qb(),this.b.a.d-=n.gc(),n.$b(),this.a=null},vX(XWn,"AbstractMapBasedMultimap/KeySet/1",731),wAn(491,389,{83:1,161:1},CD),MWn.bc=function(){return this.Sc()},MWn.ec=function(){return this.Tc()},MWn.Sc=function(){return new nT(this.c,this.Uc())},MWn.Tc=function(){return this.b||(this.b=this.Sc())},MWn.Uc=function(){return BB(this.d,161)},vX(XWn,"AbstractMapBasedMultimap/SortedAsMap",491),wAn(542,491,eVn,ID),MWn.bc=function(){return new tT(this.a,BB(BB(this.d,161),171))},MWn.Sc=function(){return new tT(this.a,BB(BB(this.d,161),171))},MWn.ec=function(){return BB(this.b||(this.b=new tT(this.a,BB(BB(this.d,161),171))),271)},MWn.Tc=function(){return BB(this.b||(this.b=new tT(this.a,BB(BB(this.d,161),171))),271)},MWn.Uc=function(){return BB(BB(this.d,161),171)},vX(XWn,"AbstractMapBasedMultimap/NavigableAsMap",542),wAn(490,318,iVn,nT),MWn.Nc=function(){return this.b.ec().Nc()},vX(XWn,"AbstractMapBasedMultimap/SortedKeySet",490),wAn(388,490,rVn,tT),vX(XWn,"AbstractMapBasedMultimap/NavigableKeySet",388),wAn(541,28,ZWn,W6),MWn.Fc=function(n){var t,e;return zbn(this),e=this.d.dc(),(t=this.d.Fc(n))&&(++this.f.d,e&&jR(this)),t},MWn.Gc=function(n){var t,e,i;return!n.dc()&&(zbn(this),i=this.d.gc(),(t=this.d.Gc(n))&&(e=this.d.gc(),this.f.d+=e-i,0==i&&jR(this)),t)},MWn.$b=function(){var n;zbn(this),0!=(n=this.d.gc())&&(this.d.$b(),this.f.d-=n,$G(this))},MWn.Hc=function(n){return zbn(this),this.d.Hc(n)},MWn.Ic=function(n){return zbn(this),this.d.Ic(n)},MWn.Fb=function(n){return n===this||(zbn(this),Nfn(this.d,n))},MWn.Hb=function(){return zbn(this),nsn(this.d)},MWn.Kc=function(){return zbn(this),new QB(this)},MWn.Mc=function(n){var t;return zbn(this),(t=this.d.Mc(n))&&(--this.f.d,$G(this)),t},MWn.gc=function(){return tO(this)},MWn.Nc=function(){return zbn(this),this.d.Nc()},MWn.Ib=function(){return zbn(this),Bbn(this.d)},vX(XWn,"AbstractMapBasedMultimap/WrappedCollection",541);var Rnt=bq(YWn,"List");wAn(728,541,{20:1,28:1,14:1,15:1},sz),MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return zbn(this),this.d.Nc()},MWn.Vc=function(n,t){var e;zbn(this),e=this.d.dc(),BB(this.d,15).Vc(n,t),++this.a.d,e&&jR(this)},MWn.Wc=function(n,t){var e,i,r;return!t.dc()&&(zbn(this),r=this.d.gc(),(e=BB(this.d,15).Wc(n,t))&&(i=this.d.gc(),this.a.d+=i-r,0==r&&jR(this)),e)},MWn.Xb=function(n){return zbn(this),BB(this.d,15).Xb(n)},MWn.Xc=function(n){return zbn(this),BB(this.d,15).Xc(n)},MWn.Yc=function(){return zbn(this),new g$(this)},MWn.Zc=function(n){return zbn(this),new gQ(this,n)},MWn.$c=function(n){var t;return zbn(this),t=BB(this.d,15).$c(n),--this.a.d,$G(this),t},MWn._c=function(n,t){return zbn(this),BB(this.d,15)._c(n,t)},MWn.bd=function(n,t){return zbn(this),i3(this.a,this.e,BB(this.d,15).bd(n,t),this.b?this.b:this)},vX(XWn,"AbstractMapBasedMultimap/WrappedList",728),wAn(1096,728,{20:1,28:1,14:1,15:1,54:1},Ox),vX(XWn,"AbstractMapBasedMultimap/RandomAccessWrappedList",1096),wAn(620,1,QWn,QB),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return MV(this),this.b.Ob()},MWn.Pb=function(){return MV(this),this.b.Pb()},MWn.Qb=function(){eN(this)},vX(XWn,"AbstractMapBasedMultimap/WrappedCollection/WrappedIterator",620),wAn(729,620,cVn,g$,gQ),MWn.Qb=function(){eN(this)},MWn.Rb=function(n){var t;t=0==tO(this.a),(MV(this),BB(this.b,125)).Rb(n),++this.a.a.d,t&&jR(this.a)},MWn.Sb=function(){return(MV(this),BB(this.b,125)).Sb()},MWn.Tb=function(){return(MV(this),BB(this.b,125)).Tb()},MWn.Ub=function(){return(MV(this),BB(this.b,125)).Ub()},MWn.Vb=function(){return(MV(this),BB(this.b,125)).Vb()},MWn.Wb=function(n){(MV(this),BB(this.b,125)).Wb(n)},vX(XWn,"AbstractMapBasedMultimap/WrappedList/WrappedListIterator",729),wAn(727,541,iVn,ND),MWn.Nc=function(){return zbn(this),this.d.Nc()},vX(XWn,"AbstractMapBasedMultimap/WrappedSortedSet",727),wAn(1095,727,rVn,AA),vX(XWn,"AbstractMapBasedMultimap/WrappedNavigableSet",1095),wAn(1094,541,tVn,xD),MWn.Nc=function(){return zbn(this),this.d.Nc()},vX(XWn,"AbstractMapBasedMultimap/WrappedSet",1094),wAn(1103,1,{},u),MWn.Kb=function(n){return F6(BB(n,42))},vX(XWn,"AbstractMapBasedMultimap/lambda$1$Type",1103),wAn(1102,1,{},Vf),MWn.Kb=function(n){return new vT(this.a,n)},vX(XWn,"AbstractMapBasedMultimap/lambda$2$Type",1102);var Knt,_nt,Fnt,Bnt,Hnt=bq(YWn,"Map/Entry");wAn(345,1,aVn),MWn.Fb=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),wW(this.cd(),t.cd())&&wW(this.dd(),t.dd()))},MWn.Hb=function(){var n,t;return n=this.cd(),t=this.dd(),(null==n?0:nsn(n))^(null==t?0:nsn(t))},MWn.ed=function(n){throw Hp(new pv)},MWn.Ib=function(){return this.cd()+"="+this.dd()},vX(XWn,uVn,345),wAn(1988,28,ZWn),MWn.$b=function(){this.fd().$b()},MWn.Hc=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),H0(this.fd(),t.cd(),t.dd()))},MWn.Mc=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),q0(this.fd(),t.cd(),t.dd()))},MWn.gc=function(){return this.fd().d},vX(XWn,"Multimaps/Entries",1988),wAn(733,1988,ZWn,Qf),MWn.Kc=function(){return this.a.kc()},MWn.fd=function(){return this.a},MWn.Nc=function(){return this.a.lc()},vX(XWn,"AbstractMultimap/Entries",733),wAn(734,733,tVn,qm),MWn.Nc=function(){return this.a.lc()},MWn.Fb=function(n){return zSn(this,n)},MWn.Hb=function(){return Brn(this)},vX(XWn,"AbstractMultimap/EntrySet",734),wAn(735,28,ZWn,Yf),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return Isn(this.a,n)},MWn.Kc=function(){return this.a.nc()},MWn.gc=function(){return this.a.d},MWn.Nc=function(){return this.a.oc()},vX(XWn,"AbstractMultimap/Values",735),wAn(1989,28,{835:1,20:1,28:1,14:1}),MWn.Jc=function(n){yX(n),EV(this).Jc(new pl(n))},MWn.Nc=function(){var n;return qTn(n=EV(this).Nc(),new y,64|1296&n.qd(),this.a.d)},MWn.Fc=function(n){return wk(),!0},MWn.Gc=function(n){return yX(this),yX(n),cL(n,543)?l2(BB(n,835)):!n.dc()&&fnn(this,n.Kc())},MWn.Hc=function(n){var t;return((t=BB(lfn(OQ(this.a),n),14))?t.gc():0)>0},MWn.Fb=function(n){return h$n(this,n)},MWn.Hb=function(){return nsn(EV(this))},MWn.dc=function(){return EV(this).dc()},MWn.Mc=function(n){return EIn(this,n,1)>0},MWn.Ib=function(){return Bbn(EV(this))},vX(XWn,"AbstractMultiset",1989),wAn(1991,1970,tVn),MWn.$b=function(){win(this.a.a)},MWn.Hc=function(n){var t;return!(!cL(n,492)||(t=BB(n,416),BB(t.a.dd(),14).gc()<=0||c1(this.a,t.a.cd())!=BB(t.a.dd(),14).gc()))},MWn.Mc=function(n){var t,e,i;return!(!cL(n,492)||(t=(e=BB(n,416)).a.cd(),0==(i=BB(e.a.dd(),14).gc())))&&TIn(this.a,t,i)},vX(XWn,"Multisets/EntrySet",1991),wAn(1109,1991,tVn,Jf),MWn.Kc=function(){return new wy(dz(OQ(this.a.a)).Kc())},MWn.gc=function(){return OQ(this.a.a).gc()},vX(XWn,"AbstractMultiset/EntrySet",1109),wAn(619,726,VWn),MWn.hc=function(){return this.gd()},MWn.jc=function(){return this.hd()},MWn.cc=function(n){return this.jd(n)},MWn.fc=function(n){return this.kd(n)},MWn.Zb=function(){return this.f||(this.f=this.ac())},MWn.hd=function(){return SQ(),SQ(),fet},MWn.Fb=function(n){return jsn(this,n)},MWn.jd=function(n){return BB(h6(this,n),21)},MWn.kd=function(n){return BB(Nhn(this,n),21)},MWn.mc=function(n){return SQ(),new Ak(BB(n,21))},MWn.pc=function(n,t){return new xD(this,n,BB(t,21))},vX(XWn,"AbstractSetMultimap",619),wAn(1657,619,VWn),MWn.hc=function(){return new dE(this.b)},MWn.gd=function(){return new dE(this.b)},MWn.jc=function(){return IX(new dE(this.b))},MWn.hd=function(){return IX(new dE(this.b))},MWn.cc=function(n){return BB(BB(h6(this,n),21),84)},MWn.jd=function(n){return BB(BB(h6(this,n),21),84)},MWn.fc=function(n){return BB(BB(Nhn(this,n),21),84)},MWn.kd=function(n){return BB(BB(Nhn(this,n),21),84)},MWn.mc=function(n){return cL(n,271)?IX(BB(n,271)):(SQ(),new dN(BB(n,84)))},MWn.Zb=function(){return this.f||(this.f=cL(this.c,171)?new ID(this,BB(this.c,171)):cL(this.c,161)?new CD(this,BB(this.c,161)):new pT(this,this.c))},MWn.pc=function(n,t){return cL(t,271)?new AA(this,n,BB(t,271)):new ND(this,n,BB(t,84))},vX(XWn,"AbstractSortedSetMultimap",1657),wAn(1658,1657,VWn),MWn.Zb=function(){return BB(BB(this.f||(this.f=cL(this.c,171)?new ID(this,BB(this.c,171)):cL(this.c,161)?new CD(this,BB(this.c,161)):new pT(this,this.c)),161),171)},MWn.ec=function(){return BB(BB(this.i||(this.i=cL(this.c,171)?new tT(this,BB(this.c,171)):cL(this.c,161)?new nT(this,BB(this.c,161)):new HL(this,this.c)),84),271)},MWn.bc=function(){return cL(this.c,171)?new tT(this,BB(this.c,171)):cL(this.c,161)?new nT(this,BB(this.c,161)):new HL(this,this.c)},vX(XWn,"AbstractSortedKeySortedSetMultimap",1658),wAn(2010,1,{1947:1}),MWn.Fb=function(n){return Cjn(this,n)},MWn.Hb=function(){return Hun(this.g||(this.g=new Zf(this)))},MWn.Ib=function(){return nTn(this.f||(this.f=new UL(this)))},vX(XWn,"AbstractTable",2010),wAn(665,nVn,tVn,Zf),MWn.$b=function(){dk()},MWn.Hc=function(n){var t,e;return!!cL(n,468)&&(t=BB(n,682),!!(e=BB(lfn(jX(this.a),WI(t.c.e,t.b)),83))&&wfn(e.vc(),new vT(WI(t.c.c,t.a),U6(t.c,t.b,t.a))))},MWn.Kc=function(){return ZQ(this.a)},MWn.Mc=function(n){var t,e;return!!cL(n,468)&&(t=BB(n,682),!!(e=BB(lfn(jX(this.a),WI(t.c.e,t.b)),83))&&dfn(e.vc(),new vT(WI(t.c.c,t.a),U6(t.c,t.b,t.a))))},MWn.gc=function(){return zq(this.a)},MWn.Nc=function(){return P2(this.a)},vX(XWn,"AbstractTable/CellSet",665),wAn(1928,28,ZWn,nl),MWn.$b=function(){dk()},MWn.Hc=function(n){return hTn(this.a,n)},MWn.Kc=function(){return nY(this.a)},MWn.gc=function(){return zq(this.a)},MWn.Nc=function(){return Y0(this.a)},vX(XWn,"AbstractTable/Values",1928),wAn(1632,1631,VWn),vX(XWn,"ArrayListMultimapGwtSerializationDependencies",1632),wAn(513,1632,VWn,ok,o1),MWn.hc=function(){return new J6(this.a)},MWn.a=0,vX(XWn,"ArrayListMultimap",513),wAn(664,2010,{664:1,1947:1,3:1},vOn),vX(XWn,"ArrayTable",664),wAn(1924,386,WWn,qL),MWn.Xb=function(n){return new gon(this.a,n)},vX(XWn,"ArrayTable/1",1924),wAn(1925,1,{},Gf),MWn.ld=function(n){return new gon(this.a,n)},vX(XWn,"ArrayTable/1methodref$getCell$Type",1925),wAn(2011,1,{682:1}),MWn.Fb=function(n){var t;return n===this||!!cL(n,468)&&(t=BB(n,682),wW(WI(this.c.e,this.b),WI(t.c.e,t.b))&&wW(WI(this.c.c,this.a),WI(t.c.c,t.a))&&wW(U6(this.c,this.b,this.a),U6(t.c,t.b,t.a)))},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[WI(this.c.e,this.b),WI(this.c.c,this.a),U6(this.c,this.b,this.a)]))},MWn.Ib=function(){return"("+WI(this.c.e,this.b)+","+WI(this.c.c,this.a)+")="+U6(this.c,this.b,this.a)},vX(XWn,"Tables/AbstractCell",2011),wAn(468,2011,{468:1,682:1},gon),MWn.a=0,MWn.b=0,MWn.d=0,vX(XWn,"ArrayTable/2",468),wAn(1927,1,{},zf),MWn.ld=function(n){return Y9(this.a,n)},vX(XWn,"ArrayTable/2methodref$getValue$Type",1927),wAn(1926,386,WWn,GL),MWn.Xb=function(n){return Y9(this.a,n)},vX(XWn,"ArrayTable/3",1926),wAn(1979,1967,JWn),MWn.$b=function(){Cq(this.kc())},MWn.vc=function(){return new ml(this)},MWn.lc=function(){return new CV(this.kc(),this.gc())},vX(XWn,"Maps/IteratorBasedAbstractMap",1979),wAn(828,1979,JWn),MWn.$b=function(){throw Hp(new pv)},MWn._b=function(n){return Yj(this.c,n)},MWn.kc=function(){return new zL(this,this.c.b.c.gc())},MWn.lc=function(){return yq(this.c.b.c.gc(),16,new Uf(this))},MWn.xc=function(n){var t;return(t=BB(UK(this.c,n),19))?this.nd(t.a):null},MWn.dc=function(){return this.c.b.c.dc()},MWn.ec=function(){return bz(this.c)},MWn.zc=function(n,t){var e;if(!(e=BB(UK(this.c,n),19)))throw Hp(new _y(this.md()+" "+n+" not in "+bz(this.c)));return this.od(e.a,t)},MWn.Bc=function(n){throw Hp(new pv)},MWn.gc=function(){return this.c.b.c.gc()},vX(XWn,"ArrayTable/ArrayMap",828),wAn(1923,1,{},Uf),MWn.ld=function(n){return OX(this.a,n)},vX(XWn,"ArrayTable/ArrayMap/0methodref$getEntry$Type",1923),wAn(1921,345,aVn,sT),MWn.cd=function(){return YL(this.a,this.b)},MWn.dd=function(){return this.a.nd(this.b)},MWn.ed=function(n){return this.a.od(this.b,n)},MWn.b=0,vX(XWn,"ArrayTable/ArrayMap/1",1921),wAn(1922,386,WWn,zL),MWn.Xb=function(n){return OX(this.a,n)},vX(XWn,"ArrayTable/ArrayMap/2",1922),wAn(1920,828,JWn,cU),MWn.md=function(){return"Column"},MWn.nd=function(n){return U6(this.b,this.a,n)},MWn.od=function(n,t){return Sun(this.b,this.a,n,t)},MWn.a=0,vX(XWn,"ArrayTable/Row",1920),wAn(829,828,JWn,UL),MWn.nd=function(n){return new cU(this.a,n)},MWn.zc=function(n,t){return BB(t,83),gk()},MWn.od=function(n,t){return BB(t,83),pk()},MWn.md=function(){return"Row"},vX(XWn,"ArrayTable/RowMap",829),wAn(1120,1,fVn,hT),MWn.qd=function(){return-262&this.a.qd()},MWn.rd=function(){return this.a.rd()},MWn.Nb=function(n){this.a.Nb(new cT(n,this.b))},MWn.sd=function(n){return this.a.sd(new rT(n,this.b))},vX(XWn,"CollectSpliterators/1",1120),wAn(1121,1,lVn,rT),MWn.td=function(n){this.a.td(this.b.Kb(n))},vX(XWn,"CollectSpliterators/1/lambda$0$Type",1121),wAn(1122,1,lVn,cT),MWn.td=function(n){this.a.td(this.b.Kb(n))},vX(XWn,"CollectSpliterators/1/lambda$1$Type",1122),wAn(1123,1,fVn,q2),MWn.qd=function(){return this.a},MWn.rd=function(){return this.d&&(this.b=T$(this.b,this.d.rd())),T$(this.b,0)},MWn.Nb=function(n){this.d&&(this.d.Nb(n),this.d=null),this.c.Nb(new iT(this.e,n)),this.b=0},MWn.sd=function(n){for(;;){if(this.d&&this.d.sd(n))return JI(this.b,bVn)&&(this.b=ibn(this.b,1)),!0;if(this.d=null,!this.c.sd(new aT(this,this.e)))return!1}},MWn.a=0,MWn.b=0,vX(XWn,"CollectSpliterators/1FlatMapSpliterator",1123),wAn(1124,1,lVn,aT),MWn.td=function(n){dK(this.a,this.b,n)},vX(XWn,"CollectSpliterators/1FlatMapSpliterator/lambda$0$Type",1124),wAn(1125,1,lVn,iT),MWn.td=function(n){oL(this.b,this.a,n)},vX(XWn,"CollectSpliterators/1FlatMapSpliterator/lambda$1$Type",1125),wAn(1117,1,fVn,wK),MWn.qd=function(){return 16464|this.b},MWn.rd=function(){return this.a.rd()},MWn.Nb=function(n){this.a.xe(new oT(n,this.c))},MWn.sd=function(n){return this.a.ye(new uT(n,this.c))},MWn.b=0,vX(XWn,"CollectSpliterators/1WithCharacteristics",1117),wAn(1118,1,wVn,uT),MWn.ud=function(n){this.a.td(this.b.ld(n))},vX(XWn,"CollectSpliterators/1WithCharacteristics/lambda$0$Type",1118),wAn(1119,1,wVn,oT),MWn.ud=function(n){this.a.td(this.b.ld(n))},vX(XWn,"CollectSpliterators/1WithCharacteristics/lambda$1$Type",1119),wAn(245,1,dVn),MWn.wd=function(n){return this.vd(BB(n,245))},MWn.vd=function(n){var t;return n==(ty(),_nt)?1:n==(ey(),Knt)?-1:(nq(),0!=(t=Ncn(this.a,n.a))?t:cL(this,519)==cL(n,519)?0:cL(this,519)?1:-1)},MWn.zd=function(){return this.a},MWn.Fb=function(n){return xdn(this,n)},vX(XWn,"Cut",245),wAn(1761,245,dVn,Nk),MWn.vd=function(n){return n==this?0:1},MWn.xd=function(n){throw Hp(new hv)},MWn.yd=function(n){n.a+="+\u221e)"},MWn.zd=function(){throw Hp(new Fy(gVn))},MWn.Hb=function(){return $T(),evn(this)},MWn.Ad=function(n){return!1},MWn.Ib=function(){return"+\u221e"},vX(XWn,"Cut/AboveAll",1761),wAn(519,245,{245:1,519:1,3:1,35:1},iN),MWn.xd=function(n){uO((n.a+="(",n),this.a)},MWn.yd=function(n){xX(uO(n,this.a),93)},MWn.Hb=function(){return~nsn(this.a)},MWn.Ad=function(n){return nq(),Ncn(this.a,n)<0},MWn.Ib=function(){return"/"+this.a+"\\"},vX(XWn,"Cut/AboveValue",519),wAn(1760,245,dVn,xk),MWn.vd=function(n){return n==this?0:-1},MWn.xd=function(n){n.a+="(-\u221e"},MWn.yd=function(n){throw Hp(new hv)},MWn.zd=function(){throw Hp(new Fy(gVn))},MWn.Hb=function(){return $T(),evn(this)},MWn.Ad=function(n){return!0},MWn.Ib=function(){return"-\u221e"},vX(XWn,"Cut/BelowAll",1760),wAn(1762,245,dVn,rN),MWn.xd=function(n){uO((n.a+="[",n),this.a)},MWn.yd=function(n){xX(uO(n,this.a),41)},MWn.Hb=function(){return nsn(this.a)},MWn.Ad=function(n){return nq(),Ncn(this.a,n)<=0},MWn.Ib=function(){return"\\"+this.a+"/"},vX(XWn,"Cut/BelowValue",1762),wAn(537,1,pVn),MWn.Jc=function(n){e5(this,n)},MWn.Ib=function(){return Hln(BB(WQ(this,"use Optional.orNull() instead of Optional.or(null)"),20).Kc())},vX(XWn,"FluentIterable",537),wAn(433,537,pVn,OO),MWn.Kc=function(){return new oz(ZL(this.a.Kc(),new h))},vX(XWn,"FluentIterable/2",433),wAn(1046,537,pVn,AO),MWn.Kc=function(){return NU(this)},vX(XWn,"FluentIterable/3",1046),wAn(708,386,WWn,WL),MWn.Xb=function(n){return this.a[n].Kc()},vX(XWn,"FluentIterable/3/1",708),wAn(1972,1,{}),MWn.Ib=function(){return Bbn(this.Bd().b)},vX(XWn,"ForwardingObject",1972),wAn(1973,1972,vVn),MWn.Bd=function(){return this.Cd()},MWn.Jc=function(n){e5(this,n)},MWn.Lc=function(){return this.Oc()},MWn.Nc=function(){return new w1(this,0)},MWn.Oc=function(){return new Rq(null,this.Nc())},MWn.Fc=function(n){return this.Cd(),oE()},MWn.Gc=function(n){return this.Cd(),sE()},MWn.$b=function(){this.Cd(),hE()},MWn.Hc=function(n){return this.Cd().Hc(n)},MWn.Ic=function(n){return this.Cd().Ic(n)},MWn.dc=function(){return this.Cd().b.dc()},MWn.Kc=function(){return this.Cd().Kc()},MWn.Mc=function(n){return this.Cd(),fE()},MWn.gc=function(){return this.Cd().b.gc()},MWn.Pc=function(){return this.Cd().Pc()},MWn.Qc=function(n){return this.Cd().Qc(n)},vX(XWn,"ForwardingCollection",1973),wAn(1980,28,mVn),MWn.Kc=function(){return this.Ed()},MWn.Fc=function(n){throw Hp(new pv)},MWn.Gc=function(n){throw Hp(new pv)},MWn.$b=function(){throw Hp(new pv)},MWn.Hc=function(n){return null!=n&&ywn(this,n,!1)},MWn.Dd=function(){switch(this.gc()){case 0:return WX(),WX(),Fnt;case 1:return WX(),new Pq(yX(this.Ed().Pb()));default:return new aU(this,this.Pc())}},MWn.Mc=function(n){throw Hp(new pv)},vX(XWn,"ImmutableCollection",1980),wAn(712,1980,mVn,rv),MWn.Kc=function(){return L9(this.a.Kc())},MWn.Hc=function(n){return null!=n&&this.a.Hc(n)},MWn.Ic=function(n){return this.a.Ic(n)},MWn.dc=function(){return this.a.dc()},MWn.Ed=function(){return L9(this.a.Kc())},MWn.gc=function(){return this.a.gc()},MWn.Pc=function(){return this.a.Pc()},MWn.Qc=function(n){return this.a.Qc(n)},MWn.Ib=function(){return Bbn(this.a)},vX(XWn,"ForwardingImmutableCollection",712),wAn(152,1980,yVn),MWn.Kc=function(){return this.Ed()},MWn.Yc=function(){return this.Fd(0)},MWn.Zc=function(n){return this.Fd(n)},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.bd=function(n,t){return this.Gd(n,t)},MWn.Vc=function(n,t){throw Hp(new pv)},MWn.Wc=function(n,t){throw Hp(new pv)},MWn.Fb=function(n){return qAn(this,n)},MWn.Hb=function(){return Ian(this)},MWn.Xc=function(n){return null==n?-1:Tmn(this,n)},MWn.Ed=function(){return this.Fd(0)},MWn.Fd=function(n){return ix(this,n)},MWn.$c=function(n){throw Hp(new pv)},MWn._c=function(n,t){throw Hp(new pv)},MWn.Gd=function(n,t){return sfn(new s1(new IT(this),n,t))},vX(XWn,"ImmutableList",152),wAn(2006,152,yVn),MWn.Kc=function(){return L9(this.Hd().Kc())},MWn.bd=function(n,t){return sfn(this.Hd().bd(n,t))},MWn.Hc=function(n){return null!=n&&this.Hd().Hc(n)},MWn.Ic=function(n){return this.Hd().Ic(n)},MWn.Fb=function(n){return Nfn(this.Hd(),n)},MWn.Xb=function(n){return WI(this,n)},MWn.Hb=function(){return nsn(this.Hd())},MWn.Xc=function(n){return this.Hd().Xc(n)},MWn.dc=function(){return this.Hd().dc()},MWn.Ed=function(){return L9(this.Hd().Kc())},MWn.gc=function(){return this.Hd().gc()},MWn.Gd=function(n,t){return sfn(this.Hd().bd(n,t))},MWn.Pc=function(){return this.Hd().Qc(x8(Ant,HWn,1,this.Hd().gc(),5,1))},MWn.Qc=function(n){return this.Hd().Qc(n)},MWn.Ib=function(){return Bbn(this.Hd())},vX(XWn,"ForwardingImmutableList",2006),wAn(714,1,jVn),MWn.vc=function(){return lz(this)},MWn.wc=function(n){nan(this,n)},MWn.ec=function(){return bz(this)},MWn.yc=function(n,t,e){return Zln(this,n,t,e)},MWn.Cc=function(){return this.Ld()},MWn.$b=function(){throw Hp(new pv)},MWn._b=function(n){return null!=this.xc(n)},MWn.uc=function(n){return this.Ld().Hc(n)},MWn.Jd=function(){return new cv(this)},MWn.Kd=function(){return new av(this)},MWn.Fb=function(n){return $sn(this,n)},MWn.Hb=function(){return lz(this).Hb()},MWn.dc=function(){return 0==this.gc()},MWn.zc=function(n,t){return vk()},MWn.Bc=function(n){throw Hp(new pv)},MWn.Ib=function(){return fSn(this)},MWn.Ld=function(){return this.e?this.e:this.e=this.Kd()},MWn.c=null,MWn.d=null,MWn.e=null,vX(XWn,"ImmutableMap",714),wAn(715,714,jVn),MWn._b=function(n){return Yj(this,n)},MWn.uc=function(n){return _T(this.b,n)},MWn.Id=function(){return hfn(new el(this))},MWn.Jd=function(){return hfn(iV(this.b))},MWn.Kd=function(){return s_(),new rv(tV(this.b))},MWn.Fb=function(n){return BT(this.b,n)},MWn.xc=function(n){return UK(this,n)},MWn.Hb=function(){return nsn(this.b.c)},MWn.dc=function(){return this.b.c.dc()},MWn.gc=function(){return this.b.c.gc()},MWn.Ib=function(){return Bbn(this.b.c)},vX(XWn,"ForwardingImmutableMap",715),wAn(1974,1973,EVn),MWn.Bd=function(){return this.Md()},MWn.Cd=function(){return this.Md()},MWn.Nc=function(){return new w1(this,1)},MWn.Fb=function(n){return n===this||this.Md().Fb(n)},MWn.Hb=function(){return this.Md().Hb()},vX(XWn,"ForwardingSet",1974),wAn(1069,1974,EVn,el),MWn.Bd=function(){return eV(this.a.b)},MWn.Cd=function(){return eV(this.a.b)},MWn.Hc=function(n){if(cL(n,42)&&null==BB(n,42).cd())return!1;try{return KT(eV(this.a.b),n)}catch(t){if(cL(t=lun(t),205))return!1;throw Hp(t)}},MWn.Md=function(){return eV(this.a.b)},MWn.Qc=function(n){var t;return t=IY(eV(this.a.b),n),eV(this.a.b).b.gc()=0?"+":"")+(i/60|0),t=UO(e.Math.abs(i)%60),(pMn(),pet)[this.q.getDay()]+" "+vet[this.q.getMonth()]+" "+UO(this.q.getDate())+" "+UO(this.q.getHours())+":"+UO(this.q.getMinutes())+":"+UO(this.q.getSeconds())+" GMT"+n+t+" "+this.q.getFullYear()};var ott,stt,htt,ftt,ltt,btt,wtt,dtt,gtt,ptt,vtt,mtt=vX(YWn,"Date",199);wAn(1915,199,TQn,Ykn),MWn.a=!1,MWn.b=0,MWn.c=0,MWn.d=0,MWn.e=0,MWn.f=0,MWn.g=!1,MWn.i=0,MWn.j=0,MWn.k=0,MWn.n=0,MWn.o=0,MWn.p=0,vX("com.google.gwt.i18n.shared.impl","DateRecord",1915),wAn(1966,1,{}),MWn.fe=function(){return null},MWn.ge=function(){return null},MWn.he=function(){return null},MWn.ie=function(){return null},MWn.je=function(){return null},vX(MQn,"JSONValue",1966),wAn(216,1966,{216:1},Cl,Tl),MWn.Fb=function(n){return!!cL(n,216)&&v0(this.a,BB(n,216).a)},MWn.ee=function(){return qp},MWn.Hb=function(){return tY(this.a)},MWn.fe=function(){return this},MWn.Ib=function(){var n,t,e;for(e=new lN("["),t=0,n=this.a.length;t0&&(e.a+=","),uO(e,dnn(this,t));return e.a+="]",e.a},vX(MQn,"JSONArray",216),wAn(483,1966,{483:1},Ml),MWn.ee=function(){return Gp},MWn.ge=function(){return this},MWn.Ib=function(){return hN(),""+this.a},MWn.a=!1,vX(MQn,"JSONBoolean",483),wAn(985,60,BVn,gy),vX(MQn,"JSONException",985),wAn(1023,1966,{},v),MWn.ee=function(){return Vp},MWn.Ib=function(){return zWn},vX(MQn,"JSONNull",1023),wAn(258,1966,{258:1},Sl),MWn.Fb=function(n){return!!cL(n,258)&&this.a==BB(n,258).a},MWn.ee=function(){return zp},MWn.Hb=function(){return VO(this.a)},MWn.he=function(){return this},MWn.Ib=function(){return this.a+""},MWn.a=0,vX(MQn,"JSONNumber",258),wAn(183,1966,{183:1},py,Pl),MWn.Fb=function(n){return!!cL(n,183)&&v0(this.a,BB(n,183).a)},MWn.ee=function(){return Up},MWn.Hb=function(){return tY(this.a)},MWn.ie=function(){return this},MWn.Ib=function(){var n,t,e,i,r,c;for(c=new lN("{"),n=!0,i=0,r=(e=jrn(this,x8(Qtt,sVn,2,0,6,1))).length;i=0?":"+this.c:"")+")"},MWn.c=0;var Ftt=vX(RWn,"StackTraceElement",310);OWn={3:1,475:1,35:1,2:1};var Btt,Htt,qtt,Gtt,ztt,Utt,Xtt,Wtt,Vtt,Qtt=vX(RWn,qVn,2);wAn(107,418,{475:1},Sk,Pk,fN),vX(RWn,"StringBuffer",107),wAn(100,418,{475:1},Ck,Ik,lN),vX(RWn,"StringBuilder",100),wAn(687,73,NQn,Ok),vX(RWn,"StringIndexOutOfBoundsException",687),wAn(2043,1,{}),wAn(844,1,{},x),MWn.Kb=function(n){return BB(n,78).e},vX(RWn,"Throwable/lambda$0$Type",844),wAn(41,60,{3:1,102:1,60:1,78:1,41:1},pv,tk),vX(RWn,"UnsupportedOperationException",41),wAn(240,236,{3:1,35:1,236:1,240:1},knn,wE),MWn.wd=function(n){return J_n(this,BB(n,240))},MWn.ke=function(){return bSn(eqn(this))},MWn.Fb=function(n){var t;return this===n||!!cL(n,240)&&(t=BB(n,240),this.e==t.e&&0==J_n(this,t))},MWn.Hb=function(){var n;return 0!=this.b?this.b:this.a<54?(n=fan(this.f),this.b=dG(e0(n,-1)),this.b=33*this.b+dG(e0(kz(n,32),-1)),this.b=17*this.b+CJ(this.e),this.b):(this.b=17*Khn(this.c)+CJ(this.e),this.b)},MWn.Ib=function(){return eqn(this)},MWn.a=0,MWn.b=0,MWn.d=0,MWn.e=0,MWn.f=0;var Ytt,Jtt,Ztt,net,tet,eet,iet=vX("java.math","BigDecimal",240);wAn(91,236,{3:1,35:1,236:1,91:1},Rpn,X6,lU,vEn,Cgn,$A),MWn.wd=function(n){return tgn(this,BB(n,91))},MWn.ke=function(){return bSn(qXn(this,0))},MWn.Fb=function(n){return swn(this,n)},MWn.Hb=function(){return Khn(this)},MWn.Ib=function(){return qXn(this,0)},MWn.b=-2,MWn.c=0,MWn.d=0,MWn.e=0;var ret,cet,aet,uet,oet=vX("java.math","BigInteger",91);wAn(488,1967,JWn),MWn.$b=function(){$U(this)},MWn._b=function(n){return hU(this,n)},MWn.uc=function(n){return Lsn(this,n,this.g)||Lsn(this,n,this.f)},MWn.vc=function(){return new Pb(this)},MWn.xc=function(n){return RX(this,n)},MWn.zc=function(n,t){return VW(this,n,t)},MWn.Bc=function(n){return v6(this,n)},MWn.gc=function(){return NT(this)},vX(YWn,"AbstractHashMap",488),wAn(261,nVn,tVn,Pb),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return m2(this,n)},MWn.Kc=function(){return new usn(this.a)},MWn.Mc=function(n){var t;return!!m2(this,n)&&(t=BB(n,42).cd(),this.a.Bc(t),!0)},MWn.gc=function(){return this.a.gc()},vX(YWn,"AbstractHashMap/EntrySet",261),wAn(262,1,QWn,usn),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return ten(this)},MWn.Ob=function(){return this.b},MWn.Qb=function(){o9(this)},MWn.b=!1,vX(YWn,"AbstractHashMap/EntrySetIterator",262),wAn(417,1,QWn,Sb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return aS(this)},MWn.Pb=function(){return mQ(this)},MWn.Qb=function(){fW(this)},MWn.b=0,MWn.c=-1,vX(YWn,"AbstractList/IteratorImpl",417),wAn(96,417,cVn,M2),MWn.Qb=function(){fW(this)},MWn.Rb=function(n){yR(this,n)},MWn.Sb=function(){return this.b>0},MWn.Tb=function(){return this.b},MWn.Ub=function(){return Px(this.b>0),this.a.Xb(this.c=--this.b)},MWn.Vb=function(){return this.b-1},MWn.Wb=function(n){Mx(-1!=this.c),this.a._c(this.c,n)},vX(YWn,"AbstractList/ListIteratorImpl",96),wAn(219,52,LVn,s1),MWn.Vc=function(n,t){LZ(n,this.b),this.c.Vc(this.a+n,t),++this.b},MWn.Xb=function(n){return l1(n,this.b),this.c.Xb(this.a+n)},MWn.$c=function(n){var t;return l1(n,this.b),t=this.c.$c(this.a+n),--this.b,t},MWn._c=function(n,t){return l1(n,this.b),this.c._c(this.a+n,t)},MWn.gc=function(){return this.b},MWn.a=0,MWn.b=0,vX(YWn,"AbstractList/SubList",219),wAn(384,nVn,tVn,Cb),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return this.a._b(n)},MWn.Kc=function(){return new Ib(this.a.vc().Kc())},MWn.Mc=function(n){return!!this.a._b(n)&&(this.a.Bc(n),!0)},MWn.gc=function(){return this.a.gc()},vX(YWn,"AbstractMap/1",384),wAn(691,1,QWn,Ib),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.a.Ob()},MWn.Pb=function(){return BB(this.a.Pb(),42).cd()},MWn.Qb=function(){this.a.Qb()},vX(YWn,"AbstractMap/1/1",691),wAn(226,28,ZWn,Ob),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return this.a.uc(n)},MWn.Kc=function(){return new Kb(this.a.vc().Kc())},MWn.gc=function(){return this.a.gc()},vX(YWn,"AbstractMap/2",226),wAn(294,1,QWn,Kb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.a.Ob()},MWn.Pb=function(){return BB(this.a.Pb(),42).dd()},MWn.Qb=function(){this.a.Qb()},vX(YWn,"AbstractMap/2/1",294),wAn(484,1,{484:1,42:1}),MWn.Fb=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),cV(this.d,t.cd())&&cV(this.e,t.dd()))},MWn.cd=function(){return this.d},MWn.dd=function(){return this.e},MWn.Hb=function(){return KA(this.d)^KA(this.e)},MWn.ed=function(n){return pR(this,n)},MWn.Ib=function(){return this.d+"="+this.e},vX(YWn,"AbstractMap/AbstractEntry",484),wAn(383,484,{484:1,383:1,42:1},PS),vX(YWn,"AbstractMap/SimpleEntry",383),wAn(1984,1,VQn),MWn.Fb=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),cV(this.cd(),t.cd())&&cV(this.dd(),t.dd()))},MWn.Hb=function(){return KA(this.cd())^KA(this.dd())},MWn.Ib=function(){return this.cd()+"="+this.dd()},vX(YWn,uVn,1984),wAn(1992,1967,eVn),MWn.tc=function(n){return q5(this,n)},MWn._b=function(n){return DK(this,n)},MWn.vc=function(){return new Bb(this)},MWn.xc=function(n){return qI(lsn(this,n))},MWn.ec=function(){return new _b(this)},vX(YWn,"AbstractNavigableMap",1992),wAn(739,nVn,tVn,Bb),MWn.Hc=function(n){return cL(n,42)&&q5(this.b,BB(n,42))},MWn.Kc=function(){return new BR(this.b)},MWn.Mc=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),z8(this.b,t))},MWn.gc=function(){return this.b.c},vX(YWn,"AbstractNavigableMap/EntrySet",739),wAn(493,nVn,rVn,_b),MWn.Nc=function(){return new wS(this)},MWn.$b=function(){my(this.a)},MWn.Hc=function(n){return DK(this.a,n)},MWn.Kc=function(){return new Fb(new BR(new xN(this.a).b))},MWn.Mc=function(n){return!!DK(this.a,n)&&($J(this.a,n),!0)},MWn.gc=function(){return this.a.c},vX(YWn,"AbstractNavigableMap/NavigableKeySet",493),wAn(494,1,QWn,Fb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return aS(this.a.a)},MWn.Pb=function(){return mx(this.a).cd()},MWn.Qb=function(){e_(this.a)},vX(YWn,"AbstractNavigableMap/NavigableKeySet/1",494),wAn(2004,28,ZWn),MWn.Fc=function(n){return F8(eMn(this,n)),!0},MWn.Gc=function(n){return kW(n),vH(n!=this,"Can't add a queue to itself"),Frn(this,n)},MWn.$b=function(){for(;null!=mnn(this););},vX(YWn,"AbstractQueue",2004),wAn(302,28,{4:1,20:1,28:1,14:1},Lp,d1),MWn.Fc=function(n){return w3(this,n),!0},MWn.$b=function(){o4(this)},MWn.Hc=function(n){return wun(new bV(this),n)},MWn.dc=function(){return Wy(this)},MWn.Kc=function(){return new bV(this)},MWn.Mc=function(n){return GJ(new bV(this),n)},MWn.gc=function(){return this.c-this.b&this.a.length-1},MWn.Nc=function(){return new w1(this,272)},MWn.Qc=function(n){var t;return t=this.c-this.b&this.a.length-1,n.lengtht&&$X(n,t,null),n},MWn.b=0,MWn.c=0,vX(YWn,"ArrayDeque",302),wAn(446,1,QWn,bV),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.a!=this.b},MWn.Pb=function(){return _hn(this)},MWn.Qb=function(){ein(this)},MWn.a=0,MWn.b=0,MWn.c=-1,vX(YWn,"ArrayDeque/IteratorImpl",446),wAn(12,52,QQn,Np,J6,t_),MWn.Vc=function(n,t){kG(this,n,t)},MWn.Fc=function(n){return WB(this,n)},MWn.Wc=function(n,t){return ohn(this,n,t)},MWn.Gc=function(n){return gun(this,n)},MWn.$b=function(){this.c=x8(Ant,HWn,1,0,5,1)},MWn.Hc=function(n){return-1!=E7(this,n,0)},MWn.Jc=function(n){Otn(this,n)},MWn.Xb=function(n){return xq(this,n)},MWn.Xc=function(n){return E7(this,n,0)},MWn.dc=function(){return 0==this.c.length},MWn.Kc=function(){return new Wb(this)},MWn.$c=function(n){return s6(this,n)},MWn.Mc=function(n){return y7(this,n)},MWn.Ud=function(n,t){h1(this,n,t)},MWn._c=function(n,t){return c5(this,n,t)},MWn.gc=function(){return this.c.length},MWn.ad=function(n){m$(this,n)},MWn.Pc=function(){return bx(this)},MWn.Qc=function(n){return Qgn(this,n)};var set,het,fet,bet,wet,det,get,pet,vet,met=vX(YWn,"ArrayList",12);wAn(7,1,QWn,Wb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return y$(this)},MWn.Pb=function(){return n0(this)},MWn.Qb=function(){AU(this)},MWn.a=0,MWn.b=-1,vX(YWn,"ArrayList/1",7),wAn(2013,e.Function,{},T),MWn.te=function(n,t){return Pln(n,t)},wAn(154,52,YQn,Jy),MWn.Hc=function(n){return-1!=bin(this,n)},MWn.Jc=function(n){var t,e,i,r;for(kW(n),i=0,r=(e=this.a).length;i>>0).toString(16))},MWn.f=0,MWn.i=KQn;var sit,hit,fit,lit,bit=vX(CYn,"CNode",57);wAn(814,1,{},Wv),vX(CYn,"CNode/CNodeBuilder",814),wAn(1525,1,{},dn),MWn.Oe=function(n,t){return 0},MWn.Pe=function(n,t){return 0},vX(CYn,OYn,1525),wAn(1790,1,{},gn),MWn.Le=function(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(h=RQn,r=new Wb(n.a.b);r.ae.d.c||e.d.c==r.d.c&&e.d.b0?n+this.n.d+this.n.a:0},MWn.Se=function(){var n,t,i,r,c;if(c=0,this.e)this.b?c=this.b.a:this.a[1][1]&&(c=this.a[1][1].Se());else if(this.g)c=Ybn(this,Okn(this,null,!0));else for(Dtn(),i=0,r=(t=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;i0?c+this.n.b+this.n.c:0},MWn.Te=function(){var n,t,e,i,r;if(this.g)for(n=Okn(this,null,!1),Dtn(),i=0,r=(e=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;i0&&(r[0]+=this.d,i-=r[0]),r[2]>0&&(r[2]+=this.d,i-=r[2]),this.c.a=e.Math.max(0,i),this.c.d=t.d+n.d+(this.c.a-i)/2,r[1]=e.Math.max(r[1],i),Q5(this,zit,t.d+n.d+r[0]-(r[1]-i)/2,r)},MWn.b=null,MWn.d=0,MWn.e=!1,MWn.f=!1,MWn.g=!1;var Qit,Yit,Jit,Zit=0,nrt=0;vX(tJn,"GridContainerCell",1473),wAn(461,22,{3:1,35:1,22:1,461:1},GS);var trt,ert=Ben(tJn,"HorizontalLabelAlignment",461,Unt,m1,g_);wAn(306,212,{212:1,306:1},yJ,wtn,KY),MWn.Re=function(){return WH(this)},MWn.Se=function(){return VH(this)},MWn.a=0,MWn.c=!1;var irt,rrt,crt,art=vX(tJn,"LabelCell",306);wAn(244,326,{212:1,326:1,244:1},Ign),MWn.Re=function(){return MIn(this)},MWn.Se=function(){return SIn(this)},MWn.Te=function(){_Fn(this)},MWn.Ue=function(){GFn(this)},MWn.b=0,MWn.c=0,MWn.d=!1,vX(tJn,"StripContainerCell",244),wAn(1626,1,DVn,En),MWn.Mb=function(n){return Qy(BB(n,212))},vX(tJn,"StripContainerCell/lambda$0$Type",1626),wAn(1627,1,{},Tn),MWn.Fe=function(n){return BB(n,212).Se()},vX(tJn,"StripContainerCell/lambda$1$Type",1627),wAn(1628,1,DVn,Mn),MWn.Mb=function(n){return Yy(BB(n,212))},vX(tJn,"StripContainerCell/lambda$2$Type",1628),wAn(1629,1,{},Sn),MWn.Fe=function(n){return BB(n,212).Re()},vX(tJn,"StripContainerCell/lambda$3$Type",1629),wAn(462,22,{3:1,35:1,22:1,462:1},zS);var urt,ort,srt,hrt,frt,lrt,brt,wrt,drt,grt,prt,vrt,mrt,yrt,krt,jrt,Ert,Trt,Mrt,Srt,Prt,Crt,Irt,Ort=Ben(tJn,"VerticalLabelAlignment",462,Unt,y1,p_);wAn(789,1,{},eUn),MWn.c=0,MWn.d=0,MWn.k=0,MWn.s=0,MWn.t=0,MWn.v=!1,MWn.w=0,MWn.D=!1,vX(sJn,"NodeContext",789),wAn(1471,1,MYn,Pn),MWn.ue=function(n,t){return YO(BB(n,61),BB(t,61))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(sJn,"NodeContext/0methodref$comparePortSides$Type",1471),wAn(1472,1,MYn,Cn),MWn.ue=function(n,t){return UTn(BB(n,111),BB(t,111))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(sJn,"NodeContext/1methodref$comparePortContexts$Type",1472),wAn(159,22,{3:1,35:1,22:1,159:1},ocn);var Art,$rt,Lrt,Nrt,xrt,Drt,Rrt,Krt=Ben(sJn,"NodeLabelLocation",159,Unt,tpn,v_);wAn(111,1,{111:1},MOn),MWn.a=!1,vX(sJn,"PortContext",111),wAn(1476,1,lVn,In),MWn.td=function(n){CE(BB(n,306))},vX(lJn,bJn,1476),wAn(1477,1,DVn,On),MWn.Mb=function(n){return!!BB(n,111).c},vX(lJn,wJn,1477),wAn(1478,1,lVn,An),MWn.td=function(n){CE(BB(n,111).c)},vX(lJn,"LabelPlacer/lambda$2$Type",1478),wAn(1475,1,lVn,Ln),MWn.td=function(n){qD(),Yp(BB(n,111))},vX(lJn,"NodeLabelAndSizeUtilities/lambda$0$Type",1475),wAn(790,1,lVn,$_),MWn.td=function(n){RM(this.b,this.c,this.a,BB(n,181))},MWn.a=!1,MWn.c=!1,vX(lJn,"NodeLabelCellCreator/lambda$0$Type",790),wAn(1474,1,lVn,Cw),MWn.td=function(n){Iv(this.a,BB(n,181))},vX(lJn,"PortContextCreator/lambda$0$Type",1474),wAn(1829,1,{},Nn),vX(gJn,"GreedyRectangleStripOverlapRemover",1829),wAn(1830,1,MYn,$n),MWn.ue=function(n,t){return FN(BB(n,222),BB(t,222))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(gJn,"GreedyRectangleStripOverlapRemover/0methodref$compareByYCoordinate$Type",1830),wAn(1786,1,{},Zv),MWn.a=5,MWn.e=0,vX(gJn,"RectangleStripOverlapRemover",1786),wAn(1787,1,MYn,Dn),MWn.ue=function(n,t){return BN(BB(n,222),BB(t,222))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(gJn,"RectangleStripOverlapRemover/0methodref$compareLeftRectangleBorders$Type",1787),wAn(1789,1,MYn,Rn),MWn.ue=function(n,t){return JU(BB(n,222),BB(t,222))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(gJn,"RectangleStripOverlapRemover/1methodref$compareRightRectangleBorders$Type",1789),wAn(406,22,{3:1,35:1,22:1,406:1},US);var _rt,Frt,Brt,Hrt,qrt,Grt=Ben(gJn,"RectangleStripOverlapRemover/OverlapRemovalDirection",406,Unt,Y2,m_);wAn(222,1,{222:1},xG),vX(gJn,"RectangleStripOverlapRemover/RectangleNode",222),wAn(1788,1,lVn,Iw),MWn.td=function(n){Cmn(this.a,BB(n,222))},vX(gJn,"RectangleStripOverlapRemover/lambda$1$Type",1788),wAn(1304,1,MYn,Kn),MWn.ue=function(n,t){return zHn(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator",1304),wAn(1307,1,{},_n),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$0$Type",1307),wAn(1308,1,DVn,Fn),MWn.Mb=function(n){return BB(n,323).a},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$1$Type",1308),wAn(1309,1,DVn,Bn),MWn.Mb=function(n){return BB(n,323).a},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$2$Type",1309),wAn(1302,1,MYn,Hn),MWn.ue=function(n,t){return WRn(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinNumOfExtensionDirectionsComparator",1302),wAn(1305,1,{},xn),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"PolyominoCompactor/MinNumOfExtensionDirectionsComparator/lambda$0$Type",1305),wAn(767,1,MYn,qn),MWn.ue=function(n,t){return Uan(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinNumOfExtensionsComparator",767),wAn(1300,1,MYn,Gn),MWn.ue=function(n,t){return Qin(BB(n,321),BB(t,321))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinPerimeterComparator",1300),wAn(1301,1,MYn,zn),MWn.ue=function(n,t){return avn(BB(n,321),BB(t,321))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinPerimeterComparatorWithShape",1301),wAn(1303,1,MYn,Un),MWn.ue=function(n,t){return BKn(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator",1303),wAn(1306,1,{},Xn),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator/lambda$0$Type",1306),wAn(777,1,{},DS),MWn.Ce=function(n,t){return O2(this,BB(n,46),BB(t,167))},vX(vJn,"SuccessorCombination",777),wAn(644,1,{},Wn),MWn.Ce=function(n,t){var e;return XIn((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorJitter",644),wAn(643,1,{},Vn),MWn.Ce=function(n,t){var e;return bxn((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorLineByLine",643),wAn(568,1,{},Qn),MWn.Ce=function(n,t){var e;return f$n((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorManhattan",568),wAn(1356,1,{},Yn),MWn.Ce=function(n,t){var e;return jNn((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorMaxNormWindingInMathPosSense",1356),wAn(400,1,{},Ow),MWn.Ce=function(n,t){return BU(this,n,t)},MWn.c=!1,MWn.d=!1,MWn.e=!1,MWn.f=!1,vX(vJn,"SuccessorQuadrantsGeneric",400),wAn(1357,1,{},Jn),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"SuccessorQuadrantsGeneric/lambda$0$Type",1357),wAn(323,22,{3:1,35:1,22:1,323:1},_S),MWn.a=!1;var zrt,Urt=Ben(EJn,TJn,323,Unt,n3,y_);wAn(1298,1,{}),MWn.Ib=function(){var n,t,e,i,r,c;for(e=" ",n=iln(0),r=0;r=0?"b"+n+"["+u5(this.a)+"]":"b["+u5(this.a)+"]":"b_"+PN(this)},vX(cZn,"FBendpoint",559),wAn(282,134,{3:1,282:1,94:1,134:1},IR),MWn.Ib=function(){return u5(this)},vX(cZn,"FEdge",282),wAn(231,134,{3:1,231:1,94:1,134:1},y6);var Cct,Ict,Oct,Act,$ct,Lct,Nct,xct,Dct,Rct,Kct=vX(cZn,"FGraph",231);wAn(447,357,{3:1,447:1,357:1,94:1,134:1},m4),MWn.Ib=function(){return null==this.b||0==this.b.length?"l["+u5(this.a)+"]":"l_"+this.b},vX(cZn,"FLabel",447),wAn(144,357,{3:1,144:1,357:1,94:1,134:1},qX),MWn.Ib=function(){return p0(this)},MWn.b=0,vX(cZn,"FNode",144),wAn(2003,1,{}),MWn.bf=function(n){sFn(this,n)},MWn.cf=function(){qmn(this)},MWn.d=0,vX(uZn,"AbstractForceModel",2003),wAn(631,2003,{631:1},Lan),MWn.af=function(n,t){var i,r,c,a;return tIn(this.f,n,t),c=XR(B$(t.d),n.d),a=e.Math.sqrt(c.a*c.a+c.b*c.b),r=e.Math.max(0,a-lW(n.e)/2-lW(t.e)/2),kL(c,((i=qon(this.e,n,t))>0?-_U(r,this.c)*i:xx(r,this.b)*BB(mMn(n,(fRn(),Zct)),19).a)/a),c},MWn.bf=function(n){sFn(this,n),this.a=BB(mMn(n,(fRn(),qct)),19).a,this.c=Gy(MD(mMn(n,cat))),this.b=Gy(MD(mMn(n,tat)))},MWn.df=function(n){return n0&&(a-=Sy(r,this.a)*i),kL(c,a*this.b/u),c},MWn.bf=function(n){var t,i,r,c,a,u,o;for(sFn(this,n),this.b=Gy(MD(mMn(n,(fRn(),aat)))),this.c=this.b/BB(mMn(n,qct),19).a,r=n.e.c.length,a=0,c=0,o=new Wb(n.e);o.a0},MWn.a=0,MWn.b=0,MWn.c=0,vX(uZn,"FruchtermanReingoldModel",632),wAn(849,1,QYn,zh),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,oZn),""),"Force Model"),"Determines the model for force calculation."),Oct),(PPn(),gMt)),$at),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,sZn),""),"Iterations"),"The number of iterations on the force model."),iln(300)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,hZn),""),"Repulsive Power"),"Determines how many bend points are added to the edge; such bend points are regarded as repelling particles in the force model"),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,fZn),""),"FR Temperature"),"The temperature is used as a scaling factor for particle displacements."),lZn),dMt),Ptt),nbn(hMt)))),a2(n,fZn,oZn,xct),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,bZn),""),"Eades Repulsion"),"Factor for repulsive forces in Eades' model."),5),dMt),Ptt),nbn(hMt)))),a2(n,bZn,oZn,$ct),pUn((new Uh,n))},vX(wZn,"ForceMetaDataProvider",849),wAn(424,22,{3:1,35:1,22:1,424:1},XS);var _ct,Fct,Bct,Hct,qct,Gct,zct,Uct,Xct,Wct,Vct,Qct,Yct,Jct,Zct,nat,tat,eat,iat,rat,cat,aat,uat,oat,sat,hat,fat,lat,bat,wat,dat,gat,pat,vat,mat,yat,kat,jat,Eat,Tat,Mat,Sat,Pat,Cat,Iat,Oat,Aat,$at=Ben(wZn,"ForceModelStrategy",424,Unt,aJ,E_);wAn(988,1,QYn,Uh),MWn.Qe=function(n){pUn(n)},vX(wZn,"ForceOptions",988),wAn(989,1,{},dt),MWn.$e=function(){return new Gv},MWn._e=function(n){},vX(wZn,"ForceOptions/ForceFactory",989),wAn(850,1,QYn,Xh),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,NZn),""),"Fixed Position"),"Prevent that the node is moved by the layout algorithm."),(hN(),!1)),(PPn(),wMt)),ktt),nbn((rpn(),sMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,xZn),""),"Desired Edge Length"),"Either specified for parent nodes or for individual edges, where the latter takes higher precedence."),100),dMt),Ptt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,DZn),""),"Layout Dimension"),"Dimensions that are permitted to be altered during layout."),bat),gMt),Hat),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,RZn),""),"Stress Epsilon"),"Termination criterion for the iterative process."),lZn),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,KZn),""),"Iteration Limit"),"Maximum number of performed iterations. Takes higher precedence than 'epsilon'."),iln(DWn)),vMt),Att),nbn(hMt)))),UGn((new Wh,n))},vX(wZn,"StressMetaDataProvider",850),wAn(992,1,QYn,Wh),MWn.Qe=function(n){UGn(n)},vX(wZn,"StressOptions",992),wAn(993,1,{},gt),MWn.$e=function(){return new OR},MWn._e=function(n){},vX(wZn,"StressOptions/StressFactory",993),wAn(1128,209,NJn,OR),MWn.Ze=function(n,t){var e,i,r,c;for(OTn(t,FZn,1),qy(TD(ZAn(n,(rkn(),kat))))?qy(TD(ZAn(n,Pat)))||jJ(new Tw((GM(),new Dy(n)))):vLn(new Gv,n,mcn(t,1)),i=fon(n),c=(e=HFn(this.a,i)).Kc();c.Ob();)(r=BB(c.Pb(),231)).e.c.length<=1||(HHn(this.b,r),i$n(this.b),Otn(r.d,new pt));SUn(i=GUn(e)),HSn(t)},vX(HZn,"StressLayoutProvider",1128),wAn(1129,1,lVn,pt),MWn.td=function(n){_Bn(BB(n,447))},vX(HZn,"StressLayoutProvider/lambda$0$Type",1129),wAn(990,1,{},Tv),MWn.c=0,MWn.e=0,MWn.g=0,vX(HZn,"StressMajorization",990),wAn(379,22,{3:1,35:1,22:1,379:1},WS);var Lat,Nat,xat,Dat,Rat,Kat,_at,Fat,Bat,Hat=Ben(HZn,"StressMajorization/Dimension",379,Unt,j1,T_);wAn(991,1,MYn,xw),MWn.ue=function(n,t){return SK(this.a,BB(n,144),BB(t,144))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(HZn,"StressMajorization/lambda$0$Type",991),wAn(1229,1,{},D0),vX(GZn,"ElkLayered",1229),wAn(1230,1,lVn,vt),MWn.td=function(n){RIn(BB(n,37))},vX(GZn,"ElkLayered/lambda$0$Type",1230),wAn(1231,1,lVn,Dw),MWn.td=function(n){PK(this.a,BB(n,37))},vX(GZn,"ElkLayered/lambda$1$Type",1231),wAn(1263,1,{},$$),vX(GZn,"GraphConfigurator",1263),wAn(759,1,lVn,Rw),MWn.td=function(n){VMn(this.a,BB(n,10))},vX(GZn,"GraphConfigurator/lambda$0$Type",759),wAn(760,1,{},mt),MWn.Kb=function(n){return tjn(),new Rq(null,new w1(BB(n,29).a,16))},vX(GZn,"GraphConfigurator/lambda$1$Type",760),wAn(761,1,lVn,Kw),MWn.td=function(n){VMn(this.a,BB(n,10))},vX(GZn,"GraphConfigurator/lambda$2$Type",761),wAn(1127,209,NJn,Uv),MWn.Ze=function(n,t){var e;e=SBn(new tm,n),GI(ZAn(n,(HXn(),sgt)))===GI((ufn(),pCt))?rwn(this.a,e,t):wOn(this.a,e,t),gUn(new Qh,e)},vX(GZn,"LayeredLayoutProvider",1127),wAn(356,22,{3:1,35:1,22:1,356:1},VS);var qat,Gat,zat,Uat=Ben(GZn,"LayeredPhases",356,Unt,s5,M_);wAn(1651,1,{},vin),MWn.i=0,vX(zZn,"ComponentsToCGraphTransformer",1651),wAn(1652,1,{},yt),MWn.ef=function(n,t){return e.Math.min(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},MWn.ff=function(n,t){return e.Math.min(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},vX(zZn,"ComponentsToCGraphTransformer/1",1652),wAn(81,1,{81:1}),MWn.i=0,MWn.k=!0,MWn.o=KQn;var Xat,Wat,Vat,Qat=vX(UZn,"CNode",81);wAn(460,81,{460:1,81:1},NN,Sgn),MWn.Ib=function(){return""},vX(zZn,"ComponentsToCGraphTransformer/CRectNode",460),wAn(1623,1,{},kt),vX(zZn,"OneDimensionalComponentsCompaction",1623),wAn(1624,1,{},jt),MWn.Kb=function(n){return xZ(BB(n,46))},MWn.Fb=function(n){return this===n},vX(zZn,"OneDimensionalComponentsCompaction/lambda$0$Type",1624),wAn(1625,1,{},Et),MWn.Kb=function(n){return Ewn(BB(n,46))},MWn.Fb=function(n){return this===n},vX(zZn,"OneDimensionalComponentsCompaction/lambda$1$Type",1625),wAn(1654,1,{},BX),vX(UZn,"CGraph",1654),wAn(189,1,{189:1},Pgn),MWn.b=0,MWn.c=0,MWn.e=0,MWn.g=!0,MWn.i=KQn,vX(UZn,"CGroup",189),wAn(1653,1,{},Pt),MWn.ef=function(n,t){return e.Math.max(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},MWn.ff=function(n,t){return e.Math.max(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},vX(UZn,OYn,1653),wAn(1655,1,{},sOn),MWn.d=!1;var Yat=vX(UZn,xYn,1655);wAn(1656,1,{},Ct),MWn.Kb=function(n){return kM(),hN(),0!=BB(BB(n,46).a,81).d.e},MWn.Fb=function(n){return this===n},vX(UZn,DYn,1656),wAn(823,1,{},Sq),MWn.a=!1,MWn.b=!1,MWn.c=!1,MWn.d=!1,vX(UZn,RYn,823),wAn(1825,1,{},DG),vX(XZn,KYn,1825);var Jat=bq(WZn,PYn);wAn(1826,1,{369:1},lY),MWn.Ke=function(n){Gxn(this,BB(n,466))},vX(XZn,_Yn,1826),wAn(1827,1,MYn,It),MWn.ue=function(n,t){return oQ(BB(n,81),BB(t,81))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(XZn,FYn,1827),wAn(466,1,{466:1},fP),MWn.a=!1,vX(XZn,BYn,466),wAn(1828,1,MYn,Ot),MWn.ue=function(n,t){return njn(BB(n,466),BB(t,466))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(XZn,HYn,1828),wAn(140,1,{140:1},dP,mH),MWn.Fb=function(n){var t;return null!=n&&iut==tsn(n)&&(t=BB(n,140),cV(this.c,t.c)&&cV(this.d,t.d))},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[this.c,this.d]))},MWn.Ib=function(){return"("+this.c+FWn+this.d+(this.a?"cx":"")+this.b+")"},MWn.a=!0,MWn.c=0,MWn.d=0;var Zat,nut,tut,eut,iut=vX(WZn,"Point",140);wAn(405,22,{3:1,35:1,22:1,405:1},QS);var rut,cut,aut,uut,out,sut,hut,fut,lut,but,wut,dut=Ben(WZn,"Point/Quadrant",405,Unt,t3,S_);wAn(1642,1,{},Vv),MWn.b=null,MWn.c=null,MWn.d=null,MWn.e=null,MWn.f=null,vX(WZn,"RectilinearConvexHull",1642),wAn(574,1,{369:1},Tpn),MWn.Ke=function(n){_9(this,BB(n,140))},MWn.b=0,vX(WZn,"RectilinearConvexHull/MaximalElementsEventHandler",574),wAn(1644,1,MYn,Mt),MWn.ue=function(n,t){return DV(MD(n),MD(t))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/MaximalElementsEventHandler/lambda$0$Type",1644),wAn(1643,1,{369:1},ftn),MWn.Ke=function(n){PNn(this,BB(n,140))},MWn.a=0,MWn.b=null,MWn.c=null,MWn.d=null,MWn.e=null,vX(WZn,"RectilinearConvexHull/RectangleEventHandler",1643),wAn(1645,1,MYn,St),MWn.ue=function(n,t){return u0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$0$Type",1645),wAn(1646,1,MYn,Tt),MWn.ue=function(n,t){return o0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$1$Type",1646),wAn(1647,1,MYn,At),MWn.ue=function(n,t){return h0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$2$Type",1647),wAn(1648,1,MYn,$t),MWn.ue=function(n,t){return s0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$3$Type",1648),wAn(1649,1,MYn,Lt),MWn.ue=function(n,t){return jMn(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$4$Type",1649),wAn(1650,1,{},OZ),vX(WZn,"Scanline",1650),wAn(2005,1,{}),vX(VZn,"AbstractGraphPlacer",2005),wAn(325,1,{325:1},Xx),MWn.mf=function(n){return!!this.nf(n)&&(JIn(this.b,BB(mMn(n,(hWn(),Xft)),21),n),!0)},MWn.nf=function(n){var t,e,i;for(t=BB(mMn(n,(hWn(),Xft)),21),i=BB(h6(fut,t),21).Kc();i.Ob();)if(e=BB(i.Pb(),21),!BB(h6(this.b,e),15).dc())return!1;return!0},vX(VZn,"ComponentGroup",325),wAn(765,2005,{},Qv),MWn.of=function(n){var t;for(t=new Wb(this.a);t.ab&&(k=0,j+=l+c,l=0),ZRn(u,k+(g=u.c).a,j+g.b),kO(g),i=e.Math.max(i,k+v.a),l=e.Math.max(l,v.b),k+=v.a+c;if(t.f.a=i,t.f.b=j+l,qy(TD(mMn(a,Mdt)))){for(KXn(r=new Nt,n,c),f=n.Kc();f.Ob();)UR(kO(BB(f.Pb(),37).c),r.e);UR(kO(t.f),r.a)}d9(t,n)}else(m=BB(n.Xb(0),37))!=t&&(t.a.c=x8(Ant,HWn,1,0,5,1),$Kn(t,m,0,0),qan(t,m),kQ(t.d,m.d),t.f.a=m.f.a,t.f.b=m.f.b)},vX(VZn,"SimpleRowGraphPlacer",1291),wAn(1292,1,MYn,Rt),MWn.ue=function(n,t){return zan(BB(n,37),BB(t,37))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(VZn,"SimpleRowGraphPlacer/1",1292),wAn(1262,1,qYn,Kt),MWn.Lb=function(n){var t;return!!(t=BB(mMn(BB(n,243).b,(HXn(),vgt)),74))&&0!=t.b},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){var t;return!!(t=BB(mMn(BB(n,243).b,(HXn(),vgt)),74))&&0!=t.b},vX(ZZn,"CompoundGraphPostprocessor/1",1262),wAn(1261,1,n1n,em),MWn.pf=function(n,t){mvn(this,BB(n,37),t)},vX(ZZn,"CompoundGraphPreprocessor",1261),wAn(441,1,{441:1},zfn),MWn.c=!1,vX(ZZn,"CompoundGraphPreprocessor/ExternalPort",441),wAn(243,1,{243:1},L_),MWn.Ib=function(){return dx(this.c)+":"+OIn(this.b)},vX(ZZn,"CrossHierarchyEdge",243),wAn(763,1,MYn,_w),MWn.ue=function(n,t){return Vyn(this,BB(n,243),BB(t,243))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(ZZn,"CrossHierarchyEdgeComparator",763),wAn(299,134,{3:1,299:1,94:1,134:1}),MWn.p=0,vX(t1n,"LGraphElement",299),wAn(17,299,{3:1,17:1,299:1,94:1,134:1},wY),MWn.Ib=function(){return OIn(this)};var yut=vX(t1n,"LEdge",17);wAn(37,299,{3:1,20:1,37:1,299:1,94:1,134:1},min),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new Wb(this.b)},MWn.Ib=function(){return 0==this.b.c.length?"G-unlayered"+LMn(this.a):0==this.a.c.length?"G-layered"+LMn(this.b):"G[layerless"+LMn(this.a)+", layers"+LMn(this.b)+"]"};var kut,jut=vX(t1n,"LGraph",37);wAn(657,1,{}),MWn.qf=function(){return this.e.n},MWn.We=function(n){return mMn(this.e,n)},MWn.rf=function(){return this.e.o},MWn.sf=function(){return this.e.p},MWn.Xe=function(n){return Lx(this.e,n)},MWn.tf=function(n){this.e.n.a=n.a,this.e.n.b=n.b},MWn.uf=function(n){this.e.o.a=n.a,this.e.o.b=n.b},MWn.vf=function(n){this.e.p=n},vX(t1n,"LGraphAdapters/AbstractLShapeAdapter",657),wAn(577,1,{839:1},Fw),MWn.wf=function(){var n,t;if(!this.b)for(this.b=sx(this.a.b.c.length),t=new Wb(this.a.b);t.a0&&Dhn((b1(t-1,n.length),n.charCodeAt(t-1)),s1n);)--t;if(r> ",n),pyn(e)),oO(uO((n.a+="[",n),e.i),"]")),n.a},MWn.c=!0,MWn.d=!1;var Fut,But,Hut,qut,Gut=vX(t1n,"LPort",11);wAn(397,1,pVn,Hw),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new qw(new Wb(this.a.e))},vX(t1n,"LPort/1",397),wAn(1290,1,QWn,qw),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(n0(this.a),17).c},MWn.Ob=function(){return y$(this.a)},MWn.Qb=function(){AU(this.a)},vX(t1n,"LPort/1/1",1290),wAn(359,1,pVn,Gw),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new zw(new Wb(this.a.g))},vX(t1n,"LPort/2",359),wAn(762,1,QWn,zw),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(n0(this.a),17).d},MWn.Ob=function(){return y$(this.a)},MWn.Qb=function(){AU(this.a)},vX(t1n,"LPort/2/1",762),wAn(1283,1,pVn,hP),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new m6(this)},vX(t1n,"LPort/CombineIter",1283),wAn(201,1,QWn,m6),MWn.Nb=function(n){fU(this,n)},MWn.Qb=function(){uE()},MWn.Ob=function(){return zN(this)},MWn.Pb=function(){return y$(this.a)?n0(this.a):n0(this.b)},vX(t1n,"LPort/CombineIter/1",201),wAn(1285,1,qYn,Bt),MWn.Lb=function(n){return Az(n)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),0!=BB(n,11).e.c.length},vX(t1n,"LPort/lambda$0$Type",1285),wAn(1284,1,qYn,Ht),MWn.Lb=function(n){return $z(n)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),0!=BB(n,11).g.c.length},vX(t1n,"LPort/lambda$1$Type",1284),wAn(1286,1,qYn,qt),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),sIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),sIt)},vX(t1n,"LPort/lambda$2$Type",1286),wAn(1287,1,qYn,Gt),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),oIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),oIt)},vX(t1n,"LPort/lambda$3$Type",1287),wAn(1288,1,qYn,zt),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),SIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),SIt)},vX(t1n,"LPort/lambda$4$Type",1288),wAn(1289,1,qYn,Ut),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),CIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),CIt)},vX(t1n,"LPort/lambda$5$Type",1289),wAn(29,299,{3:1,20:1,299:1,29:1,94:1,134:1},HX),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new Wb(this.a)},MWn.Ib=function(){return"L_"+E7(this.b.b,this,0)+LMn(this.a)},vX(t1n,"Layer",29),wAn(1342,1,{},tm),vX(d1n,g1n,1342),wAn(1346,1,{},Xt),MWn.Kb=function(n){return PTn(BB(n,82))},vX(d1n,"ElkGraphImporter/0methodref$connectableShapeToNode$Type",1346),wAn(1349,1,{},Wt),MWn.Kb=function(n){return PTn(BB(n,82))},vX(d1n,"ElkGraphImporter/1methodref$connectableShapeToNode$Type",1349),wAn(1343,1,lVn,Uw),MWn.td=function(n){POn(this.a,BB(n,118))},vX(d1n,p1n,1343),wAn(1344,1,lVn,Xw),MWn.td=function(n){POn(this.a,BB(n,118))},vX(d1n,v1n,1344),wAn(1345,1,{},Vt),MWn.Kb=function(n){return new Rq(null,new w1(pV(BB(n,79)),16))},vX(d1n,m1n,1345),wAn(1347,1,DVn,Ww),MWn.Mb=function(n){return _A(this.a,BB(n,33))},vX(d1n,y1n,1347),wAn(1348,1,{},Qt),MWn.Kb=function(n){return new Rq(null,new w1(vV(BB(n,79)),16))},vX(d1n,"ElkGraphImporter/lambda$5$Type",1348),wAn(1350,1,DVn,Vw),MWn.Mb=function(n){return FA(this.a,BB(n,33))},vX(d1n,"ElkGraphImporter/lambda$7$Type",1350),wAn(1351,1,DVn,Yt),MWn.Mb=function(n){return AQ(BB(n,79))},vX(d1n,"ElkGraphImporter/lambda$8$Type",1351),wAn(1278,1,{},Qh),vX(d1n,"ElkGraphLayoutTransferrer",1278),wAn(1279,1,DVn,Qw),MWn.Mb=function(n){return JR(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$0$Type",1279),wAn(1280,1,lVn,Yw),MWn.td=function(n){mM(),WB(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$1$Type",1280),wAn(1281,1,DVn,Jw),MWn.Mb=function(n){return UD(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$2$Type",1281),wAn(1282,1,lVn,Zw),MWn.td=function(n){mM(),WB(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$3$Type",1282),wAn(1485,1,n1n,Jt),MWn.pf=function(n,t){Vrn(BB(n,37),t)},vX(j1n,"CommentNodeMarginCalculator",1485),wAn(1486,1,{},Zt),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"CommentNodeMarginCalculator/lambda$0$Type",1486),wAn(1487,1,lVn,ne),MWn.td=function(n){tHn(BB(n,10))},vX(j1n,"CommentNodeMarginCalculator/lambda$1$Type",1487),wAn(1488,1,n1n,te),MWn.pf=function(n,t){aDn(BB(n,37),t)},vX(j1n,"CommentPostprocessor",1488),wAn(1489,1,n1n,ee),MWn.pf=function(n,t){uUn(BB(n,37),t)},vX(j1n,"CommentPreprocessor",1489),wAn(1490,1,n1n,ie),MWn.pf=function(n,t){jLn(BB(n,37),t)},vX(j1n,"ConstraintsPostprocessor",1490),wAn(1491,1,n1n,re),MWn.pf=function(n,t){can(BB(n,37),t)},vX(j1n,"EdgeAndLayerConstraintEdgeReverser",1491),wAn(1492,1,n1n,ce),MWn.pf=function(n,t){Gwn(BB(n,37),t)},vX(j1n,"EndLabelPostprocessor",1492),wAn(1493,1,{},ae),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"EndLabelPostprocessor/lambda$0$Type",1493),wAn(1494,1,DVn,ue),MWn.Mb=function(n){return MY(BB(n,10))},vX(j1n,"EndLabelPostprocessor/lambda$1$Type",1494),wAn(1495,1,lVn,oe),MWn.td=function(n){ejn(BB(n,10))},vX(j1n,"EndLabelPostprocessor/lambda$2$Type",1495),wAn(1496,1,n1n,se),MWn.pf=function(n,t){ZPn(BB(n,37),t)},vX(j1n,"EndLabelPreprocessor",1496),wAn(1497,1,{},he),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"EndLabelPreprocessor/lambda$0$Type",1497),wAn(1498,1,lVn,D_),MWn.td=function(n){KM(this.a,this.b,this.c,BB(n,10))},MWn.a=0,MWn.b=0,MWn.c=!1,vX(j1n,"EndLabelPreprocessor/lambda$1$Type",1498),wAn(1499,1,DVn,fe),MWn.Mb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),XPt))},vX(j1n,"EndLabelPreprocessor/lambda$2$Type",1499),wAn(1500,1,lVn,nd),MWn.td=function(n){DH(this.a,BB(n,70))},vX(j1n,"EndLabelPreprocessor/lambda$3$Type",1500),wAn(1501,1,DVn,le),MWn.Mb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),UPt))},vX(j1n,"EndLabelPreprocessor/lambda$4$Type",1501),wAn(1502,1,lVn,td),MWn.td=function(n){DH(this.a,BB(n,70))},vX(j1n,"EndLabelPreprocessor/lambda$5$Type",1502),wAn(1551,1,n1n,Vh),MWn.pf=function(n,t){Cln(BB(n,37),t)},vX(j1n,"EndLabelSorter",1551),wAn(1552,1,MYn,be),MWn.ue=function(n,t){return Hgn(BB(n,456),BB(t,456))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"EndLabelSorter/1",1552),wAn(456,1,{456:1},TQ),vX(j1n,"EndLabelSorter/LabelGroup",456),wAn(1553,1,{},we),MWn.Kb=function(n){return EM(),new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"EndLabelSorter/lambda$0$Type",1553),wAn(1554,1,DVn,de),MWn.Mb=function(n){return EM(),BB(n,10).k==(uSn(),Cut)},vX(j1n,"EndLabelSorter/lambda$1$Type",1554),wAn(1555,1,lVn,ge),MWn.td=function(n){oSn(BB(n,10))},vX(j1n,"EndLabelSorter/lambda$2$Type",1555),wAn(1556,1,DVn,pe),MWn.Mb=function(n){return EM(),GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),UPt))},vX(j1n,"EndLabelSorter/lambda$3$Type",1556),wAn(1557,1,DVn,ve),MWn.Mb=function(n){return EM(),GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),XPt))},vX(j1n,"EndLabelSorter/lambda$4$Type",1557),wAn(1503,1,n1n,me),MWn.pf=function(n,t){IHn(this,BB(n,37))},MWn.b=0,MWn.c=0,vX(j1n,"FinalSplineBendpointsCalculator",1503),wAn(1504,1,{},ye),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$0$Type",1504),wAn(1505,1,{},ke),MWn.Kb=function(n){return new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$1$Type",1505),wAn(1506,1,DVn,je),MWn.Mb=function(n){return!b5(BB(n,17))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$2$Type",1506),wAn(1507,1,DVn,Ee),MWn.Mb=function(n){return Lx(BB(n,17),(hWn(),Nlt))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$3$Type",1507),wAn(1508,1,lVn,ed),MWn.td=function(n){zKn(this.a,BB(n,128))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$4$Type",1508),wAn(1509,1,lVn,Te),MWn.td=function(n){JPn(BB(n,17).a)},vX(j1n,"FinalSplineBendpointsCalculator/lambda$5$Type",1509),wAn(792,1,n1n,id),MWn.pf=function(n,t){Vqn(this,BB(n,37),t)},vX(j1n,"GraphTransformer",792),wAn(511,22,{3:1,35:1,22:1,511:1},ZS);var zut,Uut,Xut,Wut=Ben(j1n,"GraphTransformer/Mode",511,Unt,uJ,tB);wAn(1510,1,n1n,Me),MWn.pf=function(n,t){exn(BB(n,37),t)},vX(j1n,"HierarchicalNodeResizingProcessor",1510),wAn(1511,1,n1n,Se),MWn.pf=function(n,t){lrn(BB(n,37),t)},vX(j1n,"HierarchicalPortConstraintProcessor",1511),wAn(1512,1,MYn,Pe),MWn.ue=function(n,t){return Ipn(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"HierarchicalPortConstraintProcessor/NodeComparator",1512),wAn(1513,1,n1n,Ce),MWn.pf=function(n,t){jBn(BB(n,37),t)},vX(j1n,"HierarchicalPortDummySizeProcessor",1513),wAn(1514,1,n1n,Ie),MWn.pf=function(n,t){JDn(this,BB(n,37),t)},MWn.a=0,vX(j1n,"HierarchicalPortOrthogonalEdgeRouter",1514),wAn(1515,1,MYn,Oe),MWn.ue=function(n,t){return _N(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"HierarchicalPortOrthogonalEdgeRouter/1",1515),wAn(1516,1,MYn,Ae),MWn.ue=function(n,t){return P9(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"HierarchicalPortOrthogonalEdgeRouter/2",1516),wAn(1517,1,n1n,$e),MWn.pf=function(n,t){EMn(BB(n,37),t)},vX(j1n,"HierarchicalPortPositionProcessor",1517),wAn(1518,1,n1n,Yh),MWn.pf=function(n,t){rXn(this,BB(n,37))},MWn.a=0,MWn.c=0,vX(j1n,"HighDegreeNodeLayeringProcessor",1518),wAn(571,1,{571:1},Le),MWn.b=-1,MWn.d=-1,vX(j1n,"HighDegreeNodeLayeringProcessor/HighDegreeNodeInformation",571),wAn(1519,1,{},Ne),MWn.Kb=function(n){return q_(),fbn(BB(n,10))},MWn.Fb=function(n){return this===n},vX(j1n,"HighDegreeNodeLayeringProcessor/lambda$0$Type",1519),wAn(1520,1,{},xe),MWn.Kb=function(n){return q_(),lbn(BB(n,10))},MWn.Fb=function(n){return this===n},vX(j1n,"HighDegreeNodeLayeringProcessor/lambda$1$Type",1520),wAn(1526,1,n1n,De),MWn.pf=function(n,t){dFn(this,BB(n,37),t)},vX(j1n,"HyperedgeDummyMerger",1526),wAn(793,1,{},R_),MWn.a=!1,MWn.b=!1,MWn.c=!1,vX(j1n,"HyperedgeDummyMerger/MergeState",793),wAn(1527,1,{},Re),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"HyperedgeDummyMerger/lambda$0$Type",1527),wAn(1528,1,{},Ke),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,10).j,16))},vX(j1n,"HyperedgeDummyMerger/lambda$1$Type",1528),wAn(1529,1,lVn,_e),MWn.td=function(n){BB(n,11).p=-1},vX(j1n,"HyperedgeDummyMerger/lambda$2$Type",1529),wAn(1530,1,n1n,Fe),MWn.pf=function(n,t){bFn(BB(n,37),t)},vX(j1n,"HypernodesProcessor",1530),wAn(1531,1,n1n,Be),MWn.pf=function(n,t){wFn(BB(n,37),t)},vX(j1n,"InLayerConstraintProcessor",1531),wAn(1532,1,n1n,He),MWn.pf=function(n,t){Lcn(BB(n,37),t)},vX(j1n,"InnermostNodeMarginCalculator",1532),wAn(1533,1,n1n,qe),MWn.pf=function(n,t){Vzn(this,BB(n,37))},MWn.a=KQn,MWn.b=KQn,MWn.c=RQn,MWn.d=RQn;var Vut,Qut,Yut,Jut,Zut,not,tot,eot,iot,rot,cot,aot,uot,oot,sot,hot,fot,lot,bot,wot,dot,got,pot,vot,mot,yot,kot,jot,Eot,Tot,Mot,Sot,Pot,Cot,Iot,Oot,Aot,$ot,Lot,Not,xot,Dot,Rot,Kot,_ot,Fot,Bot,Hot,qot,Got,zot,Uot,Xot,Wot,Vot,Qot,Yot,Jot=vX(j1n,"InteractiveExternalPortPositioner",1533);wAn(1534,1,{},Ge),MWn.Kb=function(n){return BB(n,17).d.i},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$0$Type",1534),wAn(1535,1,{},rd),MWn.Kb=function(n){return qN(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$1$Type",1535),wAn(1536,1,{},ze),MWn.Kb=function(n){return BB(n,17).c.i},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$2$Type",1536),wAn(1537,1,{},cd),MWn.Kb=function(n){return GN(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$3$Type",1537),wAn(1538,1,{},ad),MWn.Kb=function(n){return WR(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$4$Type",1538),wAn(1539,1,{},ud),MWn.Kb=function(n){return VR(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$5$Type",1539),wAn(77,22,{3:1,35:1,22:1,77:1,234:1},nP),MWn.Kf=function(){switch(this.g){case 15:return new dc;case 22:return new gc;case 47:return new mc;case 28:case 35:return new ei;case 32:return new Jt;case 42:return new te;case 1:return new ee;case 41:return new ie;case 56:return new id((Srn(),qut));case 0:return new id((Srn(),Hut));case 2:return new re;case 54:return new ce;case 33:return new se;case 51:return new me;case 55:return new Me;case 13:return new Se;case 38:return new Ce;case 44:return new Ie;case 40:return new $e;case 9:return new Yh;case 49:return new ox;case 37:return new De;case 43:return new Fe;case 27:return new Be;case 30:return new He;case 3:return new qe;case 18:return new Xe;case 29:return new We;case 5:return new Jh;case 50:return new Ue;case 34:return new Zh;case 36:return new ii;case 52:return new Vh;case 11:return new ci;case 7:return new tf;case 39:return new ai;case 45:return new ui;case 16:return new oi;case 10:return new si;case 48:return new fi;case 21:return new li;case 23:return new Ny((oin(),Amt));case 8:return new wi;case 12:return new gi;case 4:return new pi;case 19:return new af;case 17:return new Pi;case 53:return new Ci;case 6:return new Bi;case 25:return new am;case 46:return new Ni;case 31:return new xR;case 14:return new Vi;case 26:return new Sc;case 20:return new nr;case 24:return new Ny((oin(),$mt));default:throw Hp(new _y(M1n+(null!=this.f?this.f:""+this.g)))}};var Zot,nst,tst,est,ist,rst,cst,ast,ust=Ben(j1n,S1n,77,Unt,ENn,nB);wAn(1540,1,n1n,Xe),MWn.pf=function(n,t){Jzn(BB(n,37),t)},vX(j1n,"InvertedPortProcessor",1540),wAn(1541,1,n1n,We),MWn.pf=function(n,t){LKn(BB(n,37),t)},vX(j1n,"LabelAndNodeSizeProcessor",1541),wAn(1542,1,DVn,Ve),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"LabelAndNodeSizeProcessor/lambda$0$Type",1542),wAn(1543,1,DVn,Qe),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Mut)},vX(j1n,"LabelAndNodeSizeProcessor/lambda$1$Type",1543),wAn(1544,1,lVn,K_),MWn.td=function(n){_M(this.b,this.a,this.c,BB(n,10))},MWn.a=!1,MWn.c=!1,vX(j1n,"LabelAndNodeSizeProcessor/lambda$2$Type",1544),wAn(1545,1,n1n,Jh),MWn.pf=function(n,t){fzn(BB(n,37),t)},vX(j1n,"LabelDummyInserter",1545),wAn(1546,1,qYn,Ye),MWn.Lb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),zPt))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),zPt))},vX(j1n,"LabelDummyInserter/1",1546),wAn(1547,1,n1n,Ue),MWn.pf=function(n,t){Pqn(BB(n,37),t)},vX(j1n,"LabelDummyRemover",1547),wAn(1548,1,DVn,Je),MWn.Mb=function(n){return qy(TD(mMn(BB(n,70),(HXn(),Qdt))))},vX(j1n,"LabelDummyRemover/lambda$0$Type",1548),wAn(1359,1,n1n,Zh),MWn.pf=function(n,t){TGn(this,BB(n,37),t)},MWn.a=null,vX(j1n,"LabelDummySwitcher",1359),wAn(286,1,{286:1},cKn),MWn.c=0,MWn.d=null,MWn.f=0,vX(j1n,"LabelDummySwitcher/LabelDummyInfo",286),wAn(1360,1,{},Ze),MWn.Kb=function(n){return Irn(),new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"LabelDummySwitcher/lambda$0$Type",1360),wAn(1361,1,DVn,ni),MWn.Mb=function(n){return Irn(),BB(n,10).k==(uSn(),Sut)},vX(j1n,"LabelDummySwitcher/lambda$1$Type",1361),wAn(1362,1,{},hd),MWn.Kb=function(n){return XD(this.a,BB(n,10))},vX(j1n,"LabelDummySwitcher/lambda$2$Type",1362),wAn(1363,1,lVn,fd),MWn.td=function(n){YX(this.a,BB(n,286))},vX(j1n,"LabelDummySwitcher/lambda$3$Type",1363),wAn(1364,1,MYn,ti),MWn.ue=function(n,t){return Lz(BB(n,286),BB(t,286))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"LabelDummySwitcher/lambda$4$Type",1364),wAn(791,1,n1n,ei),MWn.pf=function(n,t){Y6(BB(n,37),t)},vX(j1n,"LabelManagementProcessor",791),wAn(1549,1,n1n,ii),MWn.pf=function(n,t){Nxn(BB(n,37),t)},vX(j1n,"LabelSideSelector",1549),wAn(1550,1,DVn,ri),MWn.Mb=function(n){return qy(TD(mMn(BB(n,70),(HXn(),Qdt))))},vX(j1n,"LabelSideSelector/lambda$0$Type",1550),wAn(1558,1,n1n,ci),MWn.pf=function(n,t){EBn(BB(n,37),t)},vX(j1n,"LayerConstraintPostprocessor",1558),wAn(1559,1,n1n,tf),MWn.pf=function(n,t){r$n(BB(n,37),t)},vX(j1n,"LayerConstraintPreprocessor",1559),wAn(360,22,{3:1,35:1,22:1,360:1},tP);var ost,sst,hst,fst,lst,bst,wst,dst,gst,pst=Ben(j1n,"LayerConstraintPreprocessor/HiddenNodeConnections",360,Unt,e3,z_);wAn(1560,1,n1n,ai),MWn.pf=function(n,t){Eqn(BB(n,37),t)},vX(j1n,"LayerSizeAndGraphHeightCalculator",1560),wAn(1561,1,n1n,ui),MWn.pf=function(n,t){ALn(BB(n,37),t)},vX(j1n,"LongEdgeJoiner",1561),wAn(1562,1,n1n,oi),MWn.pf=function(n,t){WHn(BB(n,37),t)},vX(j1n,"LongEdgeSplitter",1562),wAn(1563,1,n1n,si),MWn.pf=function(n,t){PGn(this,BB(n,37),t)},MWn.d=0,MWn.e=0,MWn.i=0,MWn.j=0,MWn.k=0,MWn.n=0,vX(j1n,"NodePromotion",1563),wAn(1564,1,{},hi),MWn.Kb=function(n){return BB(n,46),hN(),!0},MWn.Fb=function(n){return this===n},vX(j1n,"NodePromotion/lambda$0$Type",1564),wAn(1565,1,{},od),MWn.Kb=function(n){return aV(this.a,BB(n,46))},MWn.Fb=function(n){return this===n},MWn.a=0,vX(j1n,"NodePromotion/lambda$1$Type",1565),wAn(1566,1,{},sd),MWn.Kb=function(n){return uV(this.a,BB(n,46))},MWn.Fb=function(n){return this===n},MWn.a=0,vX(j1n,"NodePromotion/lambda$2$Type",1566),wAn(1567,1,n1n,fi),MWn.pf=function(n,t){XUn(BB(n,37),t)},vX(j1n,"NorthSouthPortPostprocessor",1567),wAn(1568,1,n1n,li),MWn.pf=function(n,t){MUn(BB(n,37),t)},vX(j1n,"NorthSouthPortPreprocessor",1568),wAn(1569,1,MYn,bi),MWn.ue=function(n,t){return Zan(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"NorthSouthPortPreprocessor/lambda$0$Type",1569),wAn(1570,1,n1n,wi),MWn.pf=function(n,t){$_n(BB(n,37),t)},vX(j1n,"PartitionMidprocessor",1570),wAn(1571,1,DVn,di),MWn.Mb=function(n){return Lx(BB(n,10),(HXn(),Wgt))},vX(j1n,"PartitionMidprocessor/lambda$0$Type",1571),wAn(1572,1,lVn,ld),MWn.td=function(n){$Q(this.a,BB(n,10))},vX(j1n,"PartitionMidprocessor/lambda$1$Type",1572),wAn(1573,1,n1n,gi),MWn.pf=function(n,t){wNn(BB(n,37),t)},vX(j1n,"PartitionPostprocessor",1573),wAn(1574,1,n1n,pi),MWn.pf=function(n,t){NOn(BB(n,37),t)},vX(j1n,"PartitionPreprocessor",1574),wAn(1575,1,DVn,vi),MWn.Mb=function(n){return Lx(BB(n,10),(HXn(),Wgt))},vX(j1n,"PartitionPreprocessor/lambda$0$Type",1575),wAn(1576,1,{},mi),MWn.Kb=function(n){return new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(j1n,"PartitionPreprocessor/lambda$1$Type",1576),wAn(1577,1,DVn,yi),MWn.Mb=function(n){return Lgn(BB(n,17))},vX(j1n,"PartitionPreprocessor/lambda$2$Type",1577),wAn(1578,1,lVn,ki),MWn.td=function(n){Run(BB(n,17))},vX(j1n,"PartitionPreprocessor/lambda$3$Type",1578),wAn(1579,1,n1n,af),MWn.pf=function(n,t){u_n(BB(n,37),t)},vX(j1n,"PortListSorter",1579),wAn(1580,1,{},ji),MWn.Kb=function(n){return zsn(),BB(n,11).e},vX(j1n,"PortListSorter/lambda$0$Type",1580),wAn(1581,1,{},Ei),MWn.Kb=function(n){return zsn(),BB(n,11).g},vX(j1n,"PortListSorter/lambda$1$Type",1581),wAn(1582,1,MYn,Ti),MWn.ue=function(n,t){return T4(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"PortListSorter/lambda$2$Type",1582),wAn(1583,1,MYn,Mi),MWn.ue=function(n,t){return Oyn(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"PortListSorter/lambda$3$Type",1583),wAn(1584,1,MYn,Si),MWn.ue=function(n,t){return nFn(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"PortListSorter/lambda$4$Type",1584),wAn(1585,1,n1n,Pi),MWn.pf=function(n,t){WAn(BB(n,37),t)},vX(j1n,"PortSideProcessor",1585),wAn(1586,1,n1n,Ci),MWn.pf=function(n,t){IRn(BB(n,37),t)},vX(j1n,"ReversedEdgeRestorer",1586),wAn(1591,1,n1n,am),MWn.pf=function(n,t){Ymn(this,BB(n,37),t)},vX(j1n,"SelfLoopPortRestorer",1591),wAn(1592,1,{},Ii),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"SelfLoopPortRestorer/lambda$0$Type",1592),wAn(1593,1,DVn,Oi),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SelfLoopPortRestorer/lambda$1$Type",1593),wAn(1594,1,DVn,Ai),MWn.Mb=function(n){return Lx(BB(n,10),(hWn(),Olt))},vX(j1n,"SelfLoopPortRestorer/lambda$2$Type",1594),wAn(1595,1,{},$i),MWn.Kb=function(n){return BB(mMn(BB(n,10),(hWn(),Olt)),403)},vX(j1n,"SelfLoopPortRestorer/lambda$3$Type",1595),wAn(1596,1,lVn,bd),MWn.td=function(n){SSn(this.a,BB(n,403))},vX(j1n,"SelfLoopPortRestorer/lambda$4$Type",1596),wAn(794,1,lVn,Li),MWn.td=function(n){nPn(BB(n,101))},vX(j1n,"SelfLoopPortRestorer/lambda$5$Type",794),wAn(1597,1,n1n,Ni),MWn.pf=function(n,t){Lpn(BB(n,37),t)},vX(j1n,"SelfLoopPostProcessor",1597),wAn(1598,1,{},xi),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"SelfLoopPostProcessor/lambda$0$Type",1598),wAn(1599,1,DVn,Di),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SelfLoopPostProcessor/lambda$1$Type",1599),wAn(1600,1,DVn,Ri),MWn.Mb=function(n){return Lx(BB(n,10),(hWn(),Olt))},vX(j1n,"SelfLoopPostProcessor/lambda$2$Type",1600),wAn(1601,1,lVn,Ki),MWn.td=function(n){Ljn(BB(n,10))},vX(j1n,"SelfLoopPostProcessor/lambda$3$Type",1601),wAn(1602,1,{},_i),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,101).f,1))},vX(j1n,"SelfLoopPostProcessor/lambda$4$Type",1602),wAn(1603,1,lVn,wd),MWn.td=function(n){a3(this.a,BB(n,409))},vX(j1n,"SelfLoopPostProcessor/lambda$5$Type",1603),wAn(1604,1,DVn,Fi),MWn.Mb=function(n){return!!BB(n,101).i},vX(j1n,"SelfLoopPostProcessor/lambda$6$Type",1604),wAn(1605,1,lVn,dd),MWn.td=function(n){Ty(this.a,BB(n,101))},vX(j1n,"SelfLoopPostProcessor/lambda$7$Type",1605),wAn(1587,1,n1n,Bi),MWn.pf=function(n,t){Z$n(BB(n,37),t)},vX(j1n,"SelfLoopPreProcessor",1587),wAn(1588,1,{},Hi),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,101).f,1))},vX(j1n,"SelfLoopPreProcessor/lambda$0$Type",1588),wAn(1589,1,{},qi),MWn.Kb=function(n){return BB(n,409).a},vX(j1n,"SelfLoopPreProcessor/lambda$1$Type",1589),wAn(1590,1,lVn,Gi),MWn.td=function(n){q$(BB(n,17))},vX(j1n,"SelfLoopPreProcessor/lambda$2$Type",1590),wAn(1606,1,n1n,xR),MWn.pf=function(n,t){sSn(this,BB(n,37),t)},vX(j1n,"SelfLoopRouter",1606),wAn(1607,1,{},zi),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"SelfLoopRouter/lambda$0$Type",1607),wAn(1608,1,DVn,Ui),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SelfLoopRouter/lambda$1$Type",1608),wAn(1609,1,DVn,Xi),MWn.Mb=function(n){return Lx(BB(n,10),(hWn(),Olt))},vX(j1n,"SelfLoopRouter/lambda$2$Type",1609),wAn(1610,1,{},Wi),MWn.Kb=function(n){return BB(mMn(BB(n,10),(hWn(),Olt)),403)},vX(j1n,"SelfLoopRouter/lambda$3$Type",1610),wAn(1611,1,lVn,eP),MWn.td=function(n){QV(this.a,this.b,BB(n,403))},vX(j1n,"SelfLoopRouter/lambda$4$Type",1611),wAn(1612,1,n1n,Vi),MWn.pf=function(n,t){fxn(BB(n,37),t)},vX(j1n,"SemiInteractiveCrossMinProcessor",1612),wAn(1613,1,DVn,Qi),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$0$Type",1613),wAn(1614,1,DVn,Yi),MWn.Mb=function(n){return Gq(BB(n,10))._b((HXn(),spt))},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$1$Type",1614),wAn(1615,1,MYn,Ji),MWn.ue=function(n,t){return drn(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$2$Type",1615),wAn(1616,1,{},Zi),MWn.Ce=function(n,t){return XQ(BB(n,10),BB(t,10))},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$3$Type",1616),wAn(1618,1,n1n,nr),MWn.pf=function(n,t){MBn(BB(n,37),t)},vX(j1n,"SortByInputModelProcessor",1618),wAn(1619,1,DVn,tr),MWn.Mb=function(n){return 0!=BB(n,11).g.c.length},vX(j1n,"SortByInputModelProcessor/lambda$0$Type",1619),wAn(1620,1,lVn,gd),MWn.td=function(n){fPn(this.a,BB(n,11))},vX(j1n,"SortByInputModelProcessor/lambda$1$Type",1620),wAn(1693,803,{},grn),MWn.Me=function(n){var t,e,i,r;switch(this.c=n,this.a.g){case 2:t=new Np,JT(AV(new Rq(null,new w1(this.c.a.b,16)),new dr),new uP(this,t)),pCn(this,new rr),Otn(t,new cr),t.c=x8(Ant,HWn,1,0,5,1),JT(AV(new Rq(null,new w1(this.c.a.b,16)),new ar),new vd(t)),pCn(this,new ur),Otn(t,new or),t.c=x8(Ant,HWn,1,0,5,1),e=j$(icn(LV(new Rq(null,new w1(this.c.a.b,16)),new md(this))),new sr),JT(new Rq(null,new w1(this.c.a.a,16)),new rP(e,t)),pCn(this,new fr),Otn(t,new er),t.c=x8(Ant,HWn,1,0,5,1);break;case 3:i=new Np,pCn(this,new ir),r=j$(icn(LV(new Rq(null,new w1(this.c.a.b,16)),new pd(this))),new hr),JT(AV(new Rq(null,new w1(this.c.a.b,16)),new lr),new aP(r,i)),pCn(this,new br),Otn(i,new wr),i.c=x8(Ant,HWn,1,0,5,1);break;default:throw Hp(new kv)}},MWn.b=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation",1693),wAn(1694,1,qYn,ir),MWn.Lb=function(n){return cL(BB(n,57).g,145)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return cL(BB(n,57).g,145)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$0$Type",1694),wAn(1695,1,{},pd),MWn.Fe=function(n){return GCn(this.a,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$1$Type",1695),wAn(1703,1,RVn,iP),MWn.Vd=function(){Fkn(this.a,this.b,-1)},MWn.b=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$10$Type",1703),wAn(1705,1,qYn,rr),MWn.Lb=function(n){return cL(BB(n,57).g,145)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return cL(BB(n,57).g,145)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$11$Type",1705),wAn(1706,1,lVn,cr),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$12$Type",1706),wAn(1707,1,DVn,ar),MWn.Mb=function(n){return cL(BB(n,57).g,10)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$13$Type",1707),wAn(1709,1,lVn,vd),MWn.td=function(n){Ebn(this.a,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$14$Type",1709),wAn(1708,1,RVn,lP),MWn.Vd=function(){Fkn(this.b,this.a,-1)},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$15$Type",1708),wAn(1710,1,qYn,ur),MWn.Lb=function(n){return cL(BB(n,57).g,10)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return cL(BB(n,57).g,10)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$16$Type",1710),wAn(1711,1,lVn,or),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$17$Type",1711),wAn(1712,1,{},md),MWn.Fe=function(n){return zCn(this.a,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$18$Type",1712),wAn(1713,1,{},sr),MWn.De=function(){return 0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$19$Type",1713),wAn(1696,1,{},hr),MWn.De=function(){return 0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$2$Type",1696),wAn(1715,1,lVn,rP),MWn.td=function(n){HG(this.a,this.b,BB(n,307))},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$20$Type",1715),wAn(1714,1,RVn,cP),MWn.Vd=function(){VAn(this.a,this.b,-1)},MWn.b=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$21$Type",1714),wAn(1716,1,qYn,fr),MWn.Lb=function(n){return BB(n,57),!0},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return BB(n,57),!0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$22$Type",1716),wAn(1717,1,lVn,er),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$23$Type",1717),wAn(1697,1,DVn,lr),MWn.Mb=function(n){return cL(BB(n,57).g,10)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$3$Type",1697),wAn(1699,1,lVn,aP),MWn.td=function(n){qG(this.a,this.b,BB(n,57))},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$4$Type",1699),wAn(1698,1,RVn,bP),MWn.Vd=function(){Fkn(this.b,this.a,-1)},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$5$Type",1698),wAn(1700,1,qYn,br),MWn.Lb=function(n){return BB(n,57),!0},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return BB(n,57),!0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$6$Type",1700),wAn(1701,1,lVn,wr),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$7$Type",1701),wAn(1702,1,DVn,dr),MWn.Mb=function(n){return cL(BB(n,57).g,145)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$8$Type",1702),wAn(1704,1,lVn,uP),MWn.td=function(n){Ttn(this.a,this.b,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$9$Type",1704),wAn(1521,1,n1n,ox),MWn.pf=function(n,t){cqn(this,BB(n,37),t)},vX(A1n,"HorizontalGraphCompactor",1521),wAn(1522,1,{},yd),MWn.Oe=function(n,t){var e,i;return Z7(n,t)?0:(e=f2(n),i=f2(t),e&&e.k==(uSn(),Mut)||i&&i.k==(uSn(),Mut)?0:UN(BB(mMn(this.a.a,(hWn(),Alt)),304),e?e.k:(uSn(),Put),i?i.k:(uSn(),Put)))},MWn.Pe=function(n,t){var e,i;return Z7(n,t)?1:(e=f2(n),i=f2(t),XN(BB(mMn(this.a.a,(hWn(),Alt)),304),e?e.k:(uSn(),Put),i?i.k:(uSn(),Put)))},vX(A1n,"HorizontalGraphCompactor/1",1522),wAn(1523,1,{},gr),MWn.Ne=function(n,t){return MM(),0==n.a.i},vX(A1n,"HorizontalGraphCompactor/lambda$0$Type",1523),wAn(1524,1,{},kd),MWn.Ne=function(n,t){return _Q(this.a,n,t)},vX(A1n,"HorizontalGraphCompactor/lambda$1$Type",1524),wAn(1664,1,{},I7),vX(A1n,"LGraphToCGraphTransformer",1664),wAn(1672,1,DVn,pr),MWn.Mb=function(n){return null!=n},vX(A1n,"LGraphToCGraphTransformer/0methodref$nonNull$Type",1672),wAn(1665,1,{},vr),MWn.Kb=function(n){return G_(),Bbn(mMn(BB(BB(n,57).g,10),(hWn(),dlt)))},vX(A1n,"LGraphToCGraphTransformer/lambda$0$Type",1665),wAn(1666,1,{},mr),MWn.Kb=function(n){return G_(),mfn(BB(BB(n,57).g,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$1$Type",1666),wAn(1675,1,DVn,yr),MWn.Mb=function(n){return G_(),cL(BB(n,57).g,10)},vX(A1n,"LGraphToCGraphTransformer/lambda$10$Type",1675),wAn(1676,1,lVn,kr),MWn.td=function(n){KQ(BB(n,57))},vX(A1n,"LGraphToCGraphTransformer/lambda$11$Type",1676),wAn(1677,1,DVn,jr),MWn.Mb=function(n){return G_(),cL(BB(n,57).g,145)},vX(A1n,"LGraphToCGraphTransformer/lambda$12$Type",1677),wAn(1681,1,lVn,Er),MWn.td=function(n){vfn(BB(n,57))},vX(A1n,"LGraphToCGraphTransformer/lambda$13$Type",1681),wAn(1678,1,lVn,jd),MWn.td=function(n){uA(this.a,BB(n,8))},MWn.a=0,vX(A1n,"LGraphToCGraphTransformer/lambda$14$Type",1678),wAn(1679,1,lVn,Ed),MWn.td=function(n){sA(this.a,BB(n,110))},MWn.a=0,vX(A1n,"LGraphToCGraphTransformer/lambda$15$Type",1679),wAn(1680,1,lVn,Td),MWn.td=function(n){oA(this.a,BB(n,8))},MWn.a=0,vX(A1n,"LGraphToCGraphTransformer/lambda$16$Type",1680),wAn(1682,1,{},Tr),MWn.Kb=function(n){return G_(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(A1n,"LGraphToCGraphTransformer/lambda$17$Type",1682),wAn(1683,1,DVn,Mr),MWn.Mb=function(n){return G_(),b5(BB(n,17))},vX(A1n,"LGraphToCGraphTransformer/lambda$18$Type",1683),wAn(1684,1,lVn,Md),MWn.td=function(n){Snn(this.a,BB(n,17))},vX(A1n,"LGraphToCGraphTransformer/lambda$19$Type",1684),wAn(1668,1,lVn,Sd),MWn.td=function(n){l0(this.a,BB(n,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$2$Type",1668),wAn(1685,1,{},Sr),MWn.Kb=function(n){return G_(),new Rq(null,new w1(BB(n,29).a,16))},vX(A1n,"LGraphToCGraphTransformer/lambda$20$Type",1685),wAn(1686,1,{},Pr),MWn.Kb=function(n){return G_(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(A1n,"LGraphToCGraphTransformer/lambda$21$Type",1686),wAn(1687,1,{},Cr),MWn.Kb=function(n){return G_(),BB(mMn(BB(n,17),(hWn(),Nlt)),15)},vX(A1n,"LGraphToCGraphTransformer/lambda$22$Type",1687),wAn(1688,1,DVn,Ir),MWn.Mb=function(n){return tx(BB(n,15))},vX(A1n,"LGraphToCGraphTransformer/lambda$23$Type",1688),wAn(1689,1,lVn,Pd),MWn.td=function(n){PCn(this.a,BB(n,15))},vX(A1n,"LGraphToCGraphTransformer/lambda$24$Type",1689),wAn(1667,1,lVn,oP),MWn.td=function(n){H3(this.a,this.b,BB(n,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$3$Type",1667),wAn(1669,1,{},Or),MWn.Kb=function(n){return G_(),new Rq(null,new w1(BB(n,29).a,16))},vX(A1n,"LGraphToCGraphTransformer/lambda$4$Type",1669),wAn(1670,1,{},Ar),MWn.Kb=function(n){return G_(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(A1n,"LGraphToCGraphTransformer/lambda$5$Type",1670),wAn(1671,1,{},$r),MWn.Kb=function(n){return G_(),BB(mMn(BB(n,17),(hWn(),Nlt)),15)},vX(A1n,"LGraphToCGraphTransformer/lambda$6$Type",1671),wAn(1673,1,lVn,Cd),MWn.td=function(n){KIn(this.a,BB(n,15))},vX(A1n,"LGraphToCGraphTransformer/lambda$8$Type",1673),wAn(1674,1,lVn,sP),MWn.td=function(n){x$(this.a,this.b,BB(n,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$9$Type",1674),wAn(1663,1,{},Lr),MWn.Le=function(n){var t,e,i,r,c;for(this.a=n,this.d=new Fv,this.c=x8(qit,HWn,121,this.a.a.a.c.length,0,1),this.b=0,e=new Wb(this.a.a.a);e.a=g&&(WB(a,iln(f)),m=e.Math.max(m,y[f-1]-l),o+=d,p+=y[f-1]-p,l=y[f-1],d=s[f]),d=e.Math.max(d,s[f]),++f;o+=d}(w=e.Math.min(1/m,1/t.b/o))>r&&(r=w,i=a)}return i},MWn.Wf=function(){return!1},vX(_1n,"MSDCutIndexHeuristic",802),wAn(1617,1,n1n,Sc),MWn.pf=function(n,t){bBn(BB(n,37),t)},vX(_1n,"SingleEdgeGraphWrapper",1617),wAn(227,22,{3:1,35:1,22:1,227:1},jP);var rht,cht,aht,uht=Ben(F1n,"CenterEdgeLabelPlacementStrategy",227,Unt,Z8,W_);wAn(422,22,{3:1,35:1,22:1,422:1},EP);var oht,sht,hht,fht,lht=Ben(F1n,"ConstraintCalculationStrategy",422,Unt,GY,V_);wAn(314,22,{3:1,35:1,22:1,314:1,246:1,234:1},TP),MWn.Kf=function(){return sIn(this)},MWn.Xf=function(){return sIn(this)};var bht,wht,dht,ght,pht=Ben(F1n,"CrossingMinimizationStrategy",314,Unt,T1,Q_);wAn(337,22,{3:1,35:1,22:1,337:1},MP);var vht,mht,yht,kht,jht,Eht,Tht=Ben(F1n,"CuttingStrategy",337,Unt,M1,Z_);wAn(335,22,{3:1,35:1,22:1,335:1,246:1,234:1},SP),MWn.Kf=function(){return RAn(this)},MWn.Xf=function(){return RAn(this)};var Mht,Sht,Pht,Cht=Ben(F1n,"CycleBreakingStrategy",335,Unt,L5,nF);wAn(419,22,{3:1,35:1,22:1,419:1},PP);var Iht,Oht,Aht,$ht,Lht=Ben(F1n,"DirectionCongruency",419,Unt,qY,tF);wAn(450,22,{3:1,35:1,22:1,450:1},CP);var Nht,xht,Dht,Rht,Kht,_ht,Fht,Bht=Ben(F1n,"EdgeConstraint",450,Unt,S1,eF);wAn(276,22,{3:1,35:1,22:1,276:1},IP);var Hht,qht,Ght,zht=Ben(F1n,"EdgeLabelSideSelection",276,Unt,i9,iF);wAn(479,22,{3:1,35:1,22:1,479:1},OP);var Uht,Xht,Wht,Vht,Qht,Yht,Jht,Zht=Ben(F1n,"EdgeStraighteningStrategy",479,Unt,HY,rF);wAn(274,22,{3:1,35:1,22:1,274:1},AP);var nft,tft,eft,ift,rft,cft,aft,uft=Ben(F1n,"FixedAlignment",274,Unt,t9,cF);wAn(275,22,{3:1,35:1,22:1,275:1},$P);var oft,sft,hft,fft,lft,bft,wft,dft,gft,pft,vft,mft=Ben(F1n,"GraphCompactionStrategy",275,Unt,n9,aF);wAn(256,22,{3:1,35:1,22:1,256:1},LP);var yft,kft,jft,Eft,Tft=Ben(F1n,"GraphProperties",256,Unt,bcn,uF);wAn(292,22,{3:1,35:1,22:1,292:1},NP);var Mft,Sft,Pft,Cft,Ift=Ben(F1n,"GreedySwitchType",292,Unt,I1,oF);wAn(303,22,{3:1,35:1,22:1,303:1},xP);var Oft,Aft,$ft,Lft=Ben(F1n,"InLayerConstraint",303,Unt,C1,sF);wAn(420,22,{3:1,35:1,22:1,420:1},DP);var Nft,xft,Dft,Rft,Kft,_ft,Fft,Bft,Hft,qft,Gft,zft,Uft,Xft,Wft,Vft,Qft,Yft,Jft,Zft,nlt,tlt,elt,ilt,rlt,clt,alt,ult,olt,slt,hlt,flt,llt,blt,wlt,dlt,glt,plt,vlt,mlt,ylt,klt,jlt,Elt,Tlt,Mlt,Slt,Plt,Clt,Ilt,Olt,Alt,$lt,Llt,Nlt,xlt,Dlt,Rlt,Klt,_lt,Flt,Blt,Hlt,qlt,Glt=Ben(F1n,"InteractiveReferencePoint",420,Unt,zY,hF);wAn(163,22,{3:1,35:1,22:1,163:1},BP);var zlt,Ult,Xlt,Wlt,Vlt,Qlt,Ylt,Jlt,Zlt,nbt,tbt,ebt,ibt,rbt,cbt,abt,ubt,obt,sbt,hbt,fbt,lbt,bbt,wbt,dbt,gbt,pbt,vbt,mbt,ybt,kbt,jbt,Ebt,Tbt,Mbt,Sbt,Pbt,Cbt,Ibt,Obt,Abt,$bt,Lbt,Nbt,xbt,Dbt,Rbt,Kbt,_bt,Fbt,Bbt,Hbt,qbt,Gbt,zbt,Ubt,Xbt,Wbt,Vbt,Qbt,Ybt,Jbt,Zbt,nwt,twt,ewt,iwt,rwt,cwt,awt,uwt,owt,swt,hwt,fwt,lwt,bwt,wwt,dwt,gwt,pwt,vwt,mwt,ywt,kwt,jwt,Ewt,Twt,Mwt,Swt,Pwt,Cwt,Iwt,Owt,Awt,$wt,Lwt,Nwt,xwt,Dwt,Rwt,Kwt,_wt,Fwt,Bwt,Hwt,qwt,Gwt,zwt,Uwt,Xwt,Wwt,Vwt,Qwt,Ywt,Jwt,Zwt,ndt,tdt,edt,idt,rdt,cdt,adt,udt,odt,sdt,hdt,fdt,ldt,bdt,wdt,ddt,gdt,pdt,vdt,mdt,ydt,kdt,jdt,Edt,Tdt,Mdt,Sdt,Pdt,Cdt,Idt,Odt,Adt,$dt,Ldt,Ndt,xdt,Ddt,Rdt,Kdt,_dt,Fdt,Bdt,Hdt,qdt,Gdt,zdt,Udt,Xdt,Wdt,Vdt,Qdt,Ydt,Jdt,Zdt,ngt,tgt,egt,igt,rgt,cgt,agt,ugt,ogt,sgt,hgt,fgt,lgt,bgt,wgt,dgt,ggt,pgt,vgt,mgt,ygt,kgt,jgt,Egt,Tgt,Mgt,Sgt,Pgt,Cgt,Igt,Ogt,Agt,$gt,Lgt,Ngt,xgt,Dgt,Rgt,Kgt,_gt,Fgt,Bgt,Hgt,qgt,Ggt,zgt,Ugt,Xgt,Wgt,Vgt,Qgt,Ygt,Jgt,Zgt,npt,tpt,ept,ipt,rpt,cpt,apt,upt,opt,spt,hpt,fpt,lpt,bpt,wpt,dpt,gpt,ppt,vpt,mpt,ypt,kpt,jpt,Ept,Tpt,Mpt,Spt,Ppt,Cpt,Ipt,Opt,Apt,$pt,Lpt,Npt,xpt,Dpt,Rpt,Kpt,_pt,Fpt,Bpt,Hpt,qpt,Gpt,zpt,Upt,Xpt,Wpt,Vpt,Qpt,Ypt,Jpt,Zpt,nvt,tvt,evt,ivt=Ben(F1n,"LayerConstraint",163,Unt,D5,fF);wAn(848,1,QYn,hf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,U1n),""),"Direction Congruency"),"Specifies how drawings of the same graph with different layout directions compare to each other: either a natural reading direction is preserved or the drawings are rotated versions of each other."),Pbt),(PPn(),gMt)),Lht),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X1n),""),"Feedback Edges"),"Whether feedback edges should be highlighted by routing around the nodes."),(hN(),!1)),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W1n),""),"Interactive Reference Point"),"Determines which point of a node is considered by interactive layout phases."),Qbt),gMt),Glt),nbn(hMt)))),a2(n,W1n,e0n,Jbt),a2(n,W1n,l0n,Ybt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,V1n),""),"Merge Edges"),"Edges that have no ports are merged so they touch the connected nodes at the same points. When this option is disabled, one port is created for each edge directly connected to a node. When it is enabled, all such incoming edges share an input port, and all outgoing edges share an output port."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Q1n),""),"Merge Hierarchy-Crossing Edges"),"If hierarchical layout is active, hierarchy-crossing edges use as few hierarchical ports as possible. They are broken by the algorithm, with hierarchical ports inserted as required. Usually, one such port is created for each edge at each hierarchy crossing point. With this option set to true, we try to create as few hierarchical ports as possible in the process. In particular, all edges that form a hyperedge can share a port."),!0),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Pj(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Y1n),""),"Allow Non-Flow Ports To Switch Sides"),"Specifies whether non-flow ports may switch sides if their node's port constraints are either FIXED_SIDE or FIXED_ORDER. A non-flow port is a port on a side that is not part of the currently configured layout flow. For instance, given a left-to-right layout direction, north and south ports would be considered non-flow ports. Further note that the underlying criterium whether to switch sides or not solely relies on the minimization of edge crossings. Hence, edge length and other aesthetics criteria are not addressed."),!1),wMt),ktt),nbn(fMt)),Pun(Gk(Qtt,1),sVn,2,6,["org.eclipse.elk.layered.northOrSouthPort"])))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,J1n),""),"Port Sorting Strategy"),"Only relevant for nodes with FIXED_SIDE port constraints. Determines the way a node's ports are distributed on the sides of a node if their order is not prescribed. The option is set on parent nodes."),xwt),gMt),zvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Z1n),""),"Thoroughness"),"How much effort should be spent to produce a nice layout."),iln(7)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,n0n),""),"Add Unnecessary Bendpoints"),"Adds bend points even if an edge does not change direction. If true, each long edge dummy will contribute a bend point to its edges and hierarchy-crossing edges will always get a bend point where they cross hierarchy boundaries. By default, bend points are only added where an edge changes direction."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,t0n),""),"Generate Position and Layer IDs"),"If enabled position id and layer id are generated, which are usually only used internally when setting the interactiveLayout option. This option should be specified on the root node."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,e0n),"cycleBreaking"),"Cycle Breaking Strategy"),"Strategy for cycle breaking. Cycle breaking looks for cycles in the graph and determines which edges to reverse to break the cycles. Reversed edges will end up pointing to the opposite direction of regular edges (that is, reversed edges will point left if edges usually point right)."),Mbt),gMt),Cht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,i0n),f2n),"Node Layering Strategy"),"Strategy for node layering."),bwt),gMt),ovt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,r0n),f2n),"Layer Constraint"),"Determines a constraint on the placement of the node regarding the layering."),iwt),gMt),ivt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,c0n),f2n),"Layer Choice Constraint"),"Allows to set a constraint regarding the layer placement of a node. Let i be the value of teh constraint. Assumed the drawing has n layers and i < n. If set to i, it expresses that the node should be placed in i-th layer. Should i>=n be true then the node is placed in the last layer of the drawing. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,a0n),f2n),"Layer ID"),"Layer identifier that was calculated by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,u0n),l2n),"Upper Bound On Width [MinWidth Layerer]"),"Defines a loose upper bound on the width of the MinWidth layerer. If set to '-1' multiple values are tested and the best result is selected."),iln(4)),vMt),Att),nbn(hMt)))),a2(n,u0n,i0n,awt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,o0n),l2n),"Upper Layer Estimation Scaling Factor [MinWidth Layerer]"),"Multiplied with Upper Bound On Width for defining an upper bound on the width of layers which haven't been determined yet, but whose maximum width had been (roughly) estimated by the MinWidth algorithm. Compensates for too high estimations. If set to '-1' multiple values are tested and the best result is selected."),iln(2)),vMt),Att),nbn(hMt)))),a2(n,o0n,i0n,owt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,s0n),b2n),"Node Promotion Strategy"),"Reduces number of dummy nodes after layering phase (if possible)."),fwt),gMt),Dvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,h0n),b2n),"Max Node Promotion Iterations"),"Limits the number of iterations for node promotion."),iln(0)),vMt),Att),nbn(hMt)))),a2(n,h0n,s0n,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,f0n),"layering.coffmanGraham"),"Layer Bound"),"The maximum number of nodes allowed per layer."),iln(DWn)),vMt),Att),nbn(hMt)))),a2(n,f0n,i0n,nwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,l0n),w2n),"Crossing Minimization Strategy"),"Strategy for crossing minimization."),Ebt),gMt),pht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,b0n),w2n),"Force Node Model Order"),"The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,w0n),w2n),"Hierarchical Sweepiness"),"How likely it is to use cross-hierarchy (1) vs bottom-up (-1)."),.1),dMt),Ptt),nbn(hMt)))),a2(n,w0n,d2n,pbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,d0n),w2n),"Semi-Interactive Crossing Minimization"),"Preserves the order of nodes within a layer but still minimizes crossings between edges connecting long edge dummies. Derives the desired order from positions specified by the 'org.eclipse.elk.position' layout option. Requires a crossing minimization strategy that is able to process 'in-layer' constraints."),!1),wMt),ktt),nbn(hMt)))),a2(n,d0n,l0n,kbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,g0n),w2n),"Position Choice Constraint"),"Allows to set a constraint regarding the position placement of a node in a layer. Assumed the layer in which the node placed includes n other nodes and i < n. If set to i, it expresses that the node should be placed at the i-th position. Should i>=n be true then the node is placed at the last position in the layer. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,p0n),w2n),"Position ID"),"Position within a layer that was determined by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,v0n),g2n),"Greedy Switch Activation Threshold"),"By default it is decided automatically if the greedy switch is activated or not. The decision is based on whether the size of the input graph (without dummy nodes) is smaller than the value of this option. A '0' enforces the activation."),iln(40)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,m0n),g2n),"Greedy Switch Crossing Minimization"),"Greedy Switch strategy for crossing minimization. The greedy switch heuristic is executed after the regular crossing minimization as a post-processor. Note that if 'hierarchyHandling' is set to 'INCLUDE_CHILDREN', the 'greedySwitchHierarchical.type' option must be used."),wbt),gMt),Ift),nbn(hMt)))),a2(n,m0n,l0n,dbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,y0n),"crossingMinimization.greedySwitchHierarchical"),"Greedy Switch Crossing Minimization (hierarchical)"),"Activates the greedy switch heuristic in case hierarchical layout is used. The differences to the non-hierarchical case (see 'greedySwitch.type') are: 1) greedy switch is inactive by default, 3) only the option value set on the node at which hierarchical layout starts is relevant, and 2) if it's activated by the user, it properly addresses hierarchy-crossing edges."),hbt),gMt),Ift),nbn(hMt)))),a2(n,y0n,l0n,fbt),a2(n,y0n,d2n,lbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,k0n),p2n),"Node Placement Strategy"),"Strategy for node placement."),Lwt),gMt),Avt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,j0n),p2n),"Favor Straight Edges Over Balancing"),"Favor straight edges over a balanced node placement. The default behavior is determined automatically based on the used 'edgeRouting'. For an orthogonal style it is set to true, for all other styles to false."),wMt),ktt),nbn(hMt)))),a2(n,j0n,k0n,Ewt),a2(n,j0n,k0n,Twt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,E0n),v2n),"BK Edge Straightening"),"Specifies whether the Brandes Koepf node placer tries to increase the number of straight edges at the expense of diagram size. There is a subtle difference to the 'favorStraightEdges' option, which decides whether a balanced placement of the nodes is desired, or not. In bk terms this means combining the four alignments into a single balanced one, or not. This option on the other hand tries to straighten additional edges during the creation of each of the four alignments."),pwt),gMt),Zht),nbn(hMt)))),a2(n,E0n,k0n,vwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,T0n),v2n),"BK Fixed Alignment"),"Tells the BK node placer to use a certain alignment (out of its four) instead of the one producing the smallest height, or the combination of all four."),ywt),gMt),uft),nbn(hMt)))),a2(n,T0n,k0n,kwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,M0n),"nodePlacement.linearSegments"),"Linear Segments Deflection Dampening"),"Dampens the movement of nodes to keep the diagram from getting too large."),.3),dMt),Ptt),nbn(hMt)))),a2(n,M0n,k0n,Swt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,S0n),"nodePlacement.networkSimplex"),"Node Flexibility"),"Aims at shorter and straighter edges. Two configurations are possible: (a) allow ports to move freely on the side they are assigned to (the order is always defined beforehand), (b) additionally allow to enlarge a node wherever it helps. If this option is not configured for a node, the 'nodeFlexibility.default' value is used, which is specified for the node's parent."),gMt),kvt),nbn(sMt)))),a2(n,S0n,k0n,Awt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,P0n),"nodePlacement.networkSimplex.nodeFlexibility"),"Node Flexibility Default"),"Default value of the 'nodeFlexibility' option for the children of a hierarchical node."),Iwt),gMt),kvt),nbn(hMt)))),a2(n,P0n,k0n,Owt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,C0n),m2n),"Self-Loop Distribution"),"Alter the distribution of the loops around the node. It only takes effect for PortConstraints.FREE."),xbt),gMt),nmt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,I0n),m2n),"Self-Loop Ordering"),"Alter the ordering of the loops they can either be stacked or sequenced. It only takes effect for PortConstraints.FREE."),Rbt),gMt),cmt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,O0n),"edgeRouting.splines"),"Spline Routing Mode"),"Specifies the way control points are assembled for each individual edge. CONSERVATIVE ensures that edges are properly routed around the nodes but feels rather orthogonal at times. SLOPPY uses fewer control points to obtain curvier edge routes but may result in edges overlapping nodes."),_bt),gMt),hmt),nbn(hMt)))),a2(n,O0n,y2n,Fbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,A0n),"edgeRouting.splines.sloppy"),"Sloppy Spline Layer Spacing Factor"),"Spacing factor for routing area between layers when using sloppy spline routing."),.2),dMt),Ptt),nbn(hMt)))),a2(n,A0n,y2n,Hbt),a2(n,A0n,O0n,qbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,$0n),"edgeRouting.polyline"),"Sloped Edge Zone Width"),"Width of the strip to the left and to the right of each layer where the polyline edge router is allowed to refrain from ensuring that edges are routed horizontally. This prevents awkward bend points for nodes that extent almost to the edge of their layer."),2),dMt),Ptt),nbn(hMt)))),a2(n,$0n,y2n,Lbt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,L0n),k2n),"Spacing Base Value"),"An optional base value for all other layout options of the 'spacing' group. It can be used to conveniently alter the overall 'spaciousness' of the drawing. Whenever an explicit value is set for the other layout options, this base value will have no effect. The base value is not inherited, i.e. it must be set for each hierarchical node."),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,N0n),k2n),"Edge Node Between Layers Spacing"),"The spacing to be preserved between nodes and edges that are routed next to the node's layer. For the spacing between nodes and edges that cross the node's layer 'spacing.edgeNode' is used."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,x0n),k2n),"Edge Edge Between Layer Spacing"),"Spacing to be preserved between pairs of edges that are routed between the same pair of layers. Note that 'spacing.edgeEdge' is used for the spacing between pairs of edges crossing the same layer."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,D0n),k2n),"Node Node Between Layers Spacing"),"The spacing to be preserved between any pair of nodes of two adjacent layers. Note that 'spacing.nodeNode' is used for the spacing between nodes within the layer itself."),20),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,R0n),j2n),"Direction Priority"),"Defines how important it is to have a certain edge point into the direction of the overall layout. This option is evaluated during the cycle breaking phase."),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,K0n),j2n),"Shortness Priority"),"Defines how important it is to keep an edge as short as possible. This option is evaluated during the layering phase."),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,_0n),j2n),"Straightness Priority"),"Defines how important it is to keep an edge straight, i.e. aligned with one of the two axes. This option is evaluated during node placement."),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,F0n),E2n),DJn),"Tries to further compact components (disconnected sub-graphs)."),!1),wMt),ktt),nbn(hMt)))),a2(n,F0n,kZn,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,B0n),T2n),"Post Compaction Strategy"),M2n),Ylt),gMt),mft),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,H0n),T2n),"Post Compaction Constraint Calculation"),M2n),Vlt),gMt),lht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,q0n),S2n),"High Degree Node Treatment"),"Makes room around high degree nodes to place leafs and trees."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,G0n),S2n),"High Degree Node Threshold"),"Whether a node is considered to have a high degree."),iln(16)),vMt),Att),nbn(hMt)))),a2(n,G0n,q0n,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,z0n),S2n),"High Degree Node Maximum Tree Height"),"Maximum height of a subtree connected to a high degree node to be moved to separate layers."),iln(5)),vMt),Att),nbn(hMt)))),a2(n,z0n,q0n,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,U0n),P2n),"Graph Wrapping Strategy"),"For certain graphs and certain prescribed drawing areas it may be desirable to split the laid out graph into chunks that are placed side by side. The edges that connect different chunks are 'wrapped' around from the end of one chunk to the start of the other chunk. The points between the chunks are referred to as 'cuts'."),bdt),gMt),Smt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X0n),P2n),"Additional Wrapped Edges Spacing"),"To visually separate edges that are wrapped from regularly routed edges an additional spacing value can be specified in form of this layout option. The spacing is added to the regular edgeNode spacing."),10),dMt),Ptt),nbn(hMt)))),a2(n,X0n,U0n,Uwt),a2(n,X0n,U0n,Xwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W0n),P2n),"Correction Factor for Wrapping"),"At times and for certain types of graphs the executed wrapping may produce results that are consistently biased in the same fashion: either wrapping to often or to rarely. This factor can be used to correct the bias. Internally, it is simply multiplied with the 'aspect ratio' layout option."),1),dMt),Ptt),nbn(hMt)))),a2(n,W0n,U0n,Vwt),a2(n,W0n,U0n,Qwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,V0n),C2n),"Cutting Strategy"),"The strategy by which the layer indexes are determined at which the layering crumbles into chunks."),idt),gMt),Tht),nbn(hMt)))),a2(n,V0n,U0n,rdt),a2(n,V0n,U0n,cdt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,Q0n),C2n),"Manually Specified Cuts"),"Allows the user to specify her own cuts for a certain graph."),mMt),Rnt),nbn(hMt)))),a2(n,Q0n,V0n,Jwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Y0n),"wrapping.cutting.msd"),"MSD Freedom"),"The MSD cutting strategy starts with an initial guess on the number of chunks the graph should be split into. The freedom specifies how much the strategy may deviate from this guess. E.g. if an initial number of 3 is computed, a freedom of 1 allows 2, 3, and 4 cuts."),ndt),vMt),Att),nbn(hMt)))),a2(n,Y0n,V0n,tdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,J0n),I2n),"Validification Strategy"),"When wrapping graphs, one can specify indices that are not allowed as split points. The validification strategy makes sure every computed split point is allowed."),vdt),gMt),dmt),nbn(hMt)))),a2(n,J0n,U0n,mdt),a2(n,J0n,U0n,ydt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,Z0n),I2n),"Valid Indices for Wrapping"),null),mMt),Rnt),nbn(hMt)))),a2(n,Z0n,U0n,ddt),a2(n,Z0n,U0n,gdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,n2n),O2n),"Improve Cuts"),"For general graphs it is important that not too many edges wrap backwards. Thus a compromise between evenly-distributed cuts and the total number of cut edges is sought."),!0),wMt),ktt),nbn(hMt)))),a2(n,n2n,U0n,sdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,t2n),O2n),"Distance Penalty When Improving Cuts"),null),2),dMt),Ptt),nbn(hMt)))),a2(n,t2n,U0n,udt),a2(n,t2n,n2n,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,e2n),O2n),"Improve Wrapped Edges"),"The initial wrapping is performed in a very simple way. As a consequence, edges that wrap from one chunk to another may be unnecessarily long. Activating this option tries to shorten such edges."),!0),wMt),ktt),nbn(hMt)))),a2(n,e2n,U0n,fdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,i2n),A2n),"Edge Label Side Selection"),"Method to decide on edge label sides."),Abt),gMt),zht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,r2n),A2n),"Edge Center Label Placement Strategy"),"Determines in which layer center labels of long edges should be placed."),Ibt),gMt),uht),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,c2n),$2n),"Consider Model Order"),"Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting."),abt),gMt),Fvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,a2n),$2n),"No Model Order"),"Set on a node to not set a model order for this node even though it is a real node."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,u2n),$2n),"Consider Model Order for Components"),"If set to NONE the usual ordering strategy (by cumulative node priority and size of nodes) is used. INSIDE_PORT_SIDES orders the components with external ports only inside the groups with the same port side. FORCE_MODEL_ORDER enforces the mode order on components. This option might produce bad alignments and sub optimal drawings in terms of used area since the ordering should be respected."),Zlt),gMt),mut),nbn(hMt)))),a2(n,u2n,kZn,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,o2n),$2n),"Long Edge Ordering Strategy"),"Indicates whether long edges are sorted under, over, or equal to nodes that have no connection to a previous layer in a left-to-right or right-to-left layout. Under and over changes to right and left in a vertical layout."),ibt),gMt),wvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,s2n),$2n),"Crossing Counter Node Order Influence"),"Indicates with what percentage (1 for 100%) violations of the node model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal node order. Defaults to no influence (0)."),0),dMt),Ptt),nbn(hMt)))),a2(n,s2n,c2n,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,h2n),$2n),"Crossing Counter Port Order Influence"),"Indicates with what percentage (1 for 100%) violations of the port model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal port order. Defaults to no influence (0)."),0),dMt),Ptt),nbn(hMt)))),a2(n,h2n,c2n,null),vWn((new bf,n))},vX(F1n,"LayeredMetaDataProvider",848),wAn(986,1,QYn,bf),MWn.Qe=function(n){vWn(n)},vX(F1n,"LayeredOptions",986),wAn(987,1,{},Cc),MWn.$e=function(){return new Uv},MWn._e=function(n){},vX(F1n,"LayeredOptions/LayeredFactory",987),wAn(1372,1,{}),MWn.a=0,vX(y3n,"ElkSpacings/AbstractSpacingsBuilder",1372),wAn(779,1372,{},uwn),vX(F1n,"LayeredSpacings/LayeredSpacingsBuilder",779),wAn(313,22,{3:1,35:1,22:1,313:1,246:1,234:1},RP),MWn.Kf=function(){return rLn(this)},MWn.Xf=function(){return rLn(this)};var rvt,cvt,avt,uvt,ovt=Ben(F1n,"LayeringStrategy",313,Unt,e9,lF);wAn(378,22,{3:1,35:1,22:1,378:1},KP);var svt,hvt,fvt,lvt,bvt,wvt=Ben(F1n,"LongEdgeOrderingStrategy",378,Unt,E1,bF);wAn(197,22,{3:1,35:1,22:1,197:1},_P);var dvt,gvt,pvt,vvt,mvt,yvt,kvt=Ben(F1n,"NodeFlexibility",197,Unt,k3,wF);wAn(315,22,{3:1,35:1,22:1,315:1,246:1,234:1},FP),MWn.Kf=function(){return DAn(this)},MWn.Xf=function(){return DAn(this)};var jvt,Evt,Tvt,Mvt,Svt,Pvt,Cvt,Ivt,Ovt,Avt=Ben(F1n,"NodePlacementStrategy",315,Unt,$5,yF);wAn(260,22,{3:1,35:1,22:1,260:1},HP);var $vt,Lvt,Nvt,xvt,Dvt=Ben(F1n,"NodePromotionStrategy",260,Unt,Btn,gF);wAn(339,22,{3:1,35:1,22:1,339:1},qP);var Rvt,Kvt,_vt,Fvt=Ben(F1n,"OrderingStrategy",339,Unt,A1,pF);wAn(421,22,{3:1,35:1,22:1,421:1},GP);var Bvt,Hvt,qvt,Gvt,zvt=Ben(F1n,"PortSortingStrategy",421,Unt,UY,vF);wAn(452,22,{3:1,35:1,22:1,452:1},zP);var Uvt,Xvt,Wvt,Vvt,Qvt=Ben(F1n,"PortType",452,Unt,O1,dF);wAn(375,22,{3:1,35:1,22:1,375:1},UP);var Yvt,Jvt,Zvt,nmt=Ben(F1n,"SelfLoopDistributionStrategy",375,Unt,$1,mF);wAn(376,22,{3:1,35:1,22:1,376:1},XP);var tmt,emt,imt,rmt,cmt=Ben(F1n,"SelfLoopOrderingStrategy",376,Unt,BY,kF);wAn(304,1,{304:1},sGn),vX(F1n,"Spacings",304),wAn(336,22,{3:1,35:1,22:1,336:1},WP);var amt,umt,omt,smt,hmt=Ben(F1n,"SplineRoutingMode",336,Unt,N1,jF);wAn(338,22,{3:1,35:1,22:1,338:1},VP);var fmt,lmt,bmt,wmt,dmt=Ben(F1n,"ValidifyStrategy",338,Unt,x1,EF);wAn(377,22,{3:1,35:1,22:1,377:1},QP);var gmt,pmt,vmt,mmt,ymt,kmt,jmt,Emt,Tmt,Mmt,Smt=Ben(F1n,"WrappingStrategy",377,Unt,L1,TF);wAn(1383,1,E3n,wf),MWn.Yf=function(n){return BB(n,37),pmt},MWn.pf=function(n,t){JHn(this,BB(n,37),t)},vX(T3n,"DepthFirstCycleBreaker",1383),wAn(782,1,E3n,KG),MWn.Yf=function(n){return BB(n,37),vmt},MWn.pf=function(n,t){UXn(this,BB(n,37),t)},MWn.Zf=function(n){return BB(xq(n,pvn(this.d,n.c.length)),10)},vX(T3n,"GreedyCycleBreaker",782),wAn(1386,782,E3n,TI),MWn.Zf=function(n){var t,e,i,r;for(r=null,t=DWn,i=new Wb(n);i.a1&&(qy(TD(mMn(vW((l1(0,n.c.length),BB(n.c[0],10))),(HXn(),xdt))))?R$n(n,this.d,BB(this,660)):(SQ(),m$(n,this.d)),Ban(this.e,n))},MWn.Sf=function(n,t,e,i){var r,c,a,u,o,s,h;for(t!=Jq(e,n.length)&&(c=n[t-(e?1:-1)],G6(this.f,c,e?(ain(),qvt):(ain(),Hvt))),r=n[t][0],h=!i||r.k==(uSn(),Mut),s=u6(n[t]),this.ag(s,h,!1,e),a=0,o=new Wb(s);o.a"),n0?uZ(this.a,n[t-1],n[t]):!e&&t1&&(qy(TD(mMn(vW((l1(0,n.c.length),BB(n.c[0],10))),(HXn(),xdt))))?R$n(n,this.d,this):(SQ(),m$(n,this.d)),qy(TD(mMn(vW((l1(0,n.c.length),BB(n.c[0],10))),xdt)))||Ban(this.e,n))},vX(C3n,"ModelOrderBarycenterHeuristic",660),wAn(1803,1,MYn,Wd),MWn.ue=function(n,t){return KSn(this.a,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(C3n,"ModelOrderBarycenterHeuristic/lambda$0$Type",1803),wAn(1403,1,E3n,jf),MWn.Yf=function(n){var t;return BB(n,37),dq(t=kA(Dmt),(yMn(),_at),(lWn(),Bot)),t},MWn.pf=function(n,t){mY((BB(n,37),t))},vX(C3n,"NoCrossingMinimizer",1403),wAn(796,402,S3n,Rj),MWn.$f=function(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;switch(f=this.g,e.g){case 1:for(r=0,c=0,h=new Wb(n.j);h.a1&&(r.j==(kUn(),oIt)?this.b[n]=!0:r.j==CIt&&n>0&&(this.b[n-1]=!0))},MWn.f=0,vX(L1n,"AllCrossingsCounter",1798),wAn(587,1,{},mrn),MWn.b=0,MWn.d=0,vX(L1n,"BinaryIndexedTree",587),wAn(524,1,{},QK),vX(L1n,"CrossingsCounter",524),wAn(1906,1,MYn,Vd),MWn.ue=function(n,t){return Xq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$0$Type",1906),wAn(1907,1,MYn,Qd),MWn.ue=function(n,t){return Wq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$1$Type",1907),wAn(1908,1,MYn,Yd),MWn.ue=function(n,t){return Vq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$2$Type",1908),wAn(1909,1,MYn,Jd),MWn.ue=function(n,t){return Qq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$3$Type",1909),wAn(1910,1,lVn,Zd),MWn.td=function(n){p7(this.a,BB(n,11))},vX(L1n,"CrossingsCounter/lambda$4$Type",1910),wAn(1911,1,DVn,ng),MWn.Mb=function(n){return yI(this.a,BB(n,11))},vX(L1n,"CrossingsCounter/lambda$5$Type",1911),wAn(1912,1,lVn,tg),MWn.td=function(n){mI(this,n)},vX(L1n,"CrossingsCounter/lambda$6$Type",1912),wAn(1913,1,lVn,ZP),MWn.td=function(n){var t;hH(),d3(this.b,(t=this.a,BB(n,11),t))},vX(L1n,"CrossingsCounter/lambda$7$Type",1913),wAn(826,1,qYn,xc),MWn.Lb=function(n){return hH(),Lx(BB(n,11),(hWn(),Elt))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return hH(),Lx(BB(n,11),(hWn(),Elt))},vX(L1n,"CrossingsCounter/lambda$8$Type",826),wAn(1905,1,{},eg),vX(L1n,"HyperedgeCrossingsCounter",1905),wAn(467,1,{35:1,467:1},DR),MWn.wd=function(n){return vgn(this,BB(n,467))},MWn.b=0,MWn.c=0,MWn.e=0,MWn.f=0;var Fmt=vX(L1n,"HyperedgeCrossingsCounter/Hyperedge",467);wAn(362,1,{35:1,362:1},qV),MWn.wd=function(n){return l$n(this,BB(n,362))},MWn.b=0,MWn.c=0;var Bmt,Hmt,qmt=vX(L1n,"HyperedgeCrossingsCounter/HyperedgeCorner",362);wAn(523,22,{3:1,35:1,22:1,523:1},JP);var Gmt,zmt,Umt,Xmt,Wmt,Vmt=Ben(L1n,"HyperedgeCrossingsCounter/HyperedgeCorner/Type",523,Unt,XY,SF);wAn(1405,1,E3n,lf),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?zmt:null},MWn.pf=function(n,t){ljn(this,BB(n,37),t)},vX(I3n,"InteractiveNodePlacer",1405),wAn(1406,1,E3n,ff),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?Umt:null},MWn.pf=function(n,t){jmn(this,BB(n,37),t)},vX(I3n,"LinearSegmentsNodePlacer",1406),wAn(257,1,{35:1,257:1},rm),MWn.wd=function(n){return uj(this,BB(n,257))},MWn.Fb=function(n){var t;return!!cL(n,257)&&(t=BB(n,257),this.b==t.b)},MWn.Hb=function(){return this.b},MWn.Ib=function(){return"ls"+LMn(this.e)},MWn.a=0,MWn.b=0,MWn.c=-1,MWn.d=-1,MWn.g=0;var Qmt,Ymt=vX(I3n,"LinearSegmentsNodePlacer/LinearSegment",257);wAn(1408,1,E3n,_G),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?Qmt:null},MWn.pf=function(n,t){SXn(this,BB(n,37),t)},MWn.b=0,MWn.g=0,vX(I3n,"NetworkSimplexPlacer",1408),wAn(1427,1,MYn,Dc),MWn.ue=function(n,t){return E$(BB(n,19).a,BB(t,19).a)},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(I3n,"NetworkSimplexPlacer/0methodref$compare$Type",1427),wAn(1429,1,MYn,Rc),MWn.ue=function(n,t){return E$(BB(n,19).a,BB(t,19).a)},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(I3n,"NetworkSimplexPlacer/1methodref$compare$Type",1429),wAn(649,1,{649:1},nC);var Jmt=vX(I3n,"NetworkSimplexPlacer/EdgeRep",649);wAn(401,1,{401:1},GV),MWn.b=!1;var Zmt,nyt,tyt,eyt=vX(I3n,"NetworkSimplexPlacer/NodeRep",401);wAn(508,12,{3:1,4:1,20:1,28:1,52:1,12:1,14:1,15:1,54:1,508:1},um),vX(I3n,"NetworkSimplexPlacer/Path",508),wAn(1409,1,{},Kc),MWn.Kb=function(n){return BB(n,17).d.i.k},vX(I3n,"NetworkSimplexPlacer/Path/lambda$0$Type",1409),wAn(1410,1,DVn,_c),MWn.Mb=function(n){return BB(n,267)==(uSn(),Put)},vX(I3n,"NetworkSimplexPlacer/Path/lambda$1$Type",1410),wAn(1411,1,{},Fc),MWn.Kb=function(n){return BB(n,17).d.i},vX(I3n,"NetworkSimplexPlacer/Path/lambda$2$Type",1411),wAn(1412,1,DVn,ig),MWn.Mb=function(n){return HD(tdn(BB(n,10)))},vX(I3n,"NetworkSimplexPlacer/Path/lambda$3$Type",1412),wAn(1413,1,DVn,Bc),MWn.Mb=function(n){return hq(BB(n,11))},vX(I3n,"NetworkSimplexPlacer/lambda$0$Type",1413),wAn(1414,1,lVn,tC),MWn.td=function(n){D$(this.a,this.b,BB(n,11))},vX(I3n,"NetworkSimplexPlacer/lambda$1$Type",1414),wAn(1423,1,lVn,rg),MWn.td=function(n){WCn(this.a,BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$10$Type",1423),wAn(1424,1,{},Hc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$11$Type",1424),wAn(1425,1,lVn,cg),MWn.td=function(n){BDn(this.a,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$12$Type",1425),wAn(1426,1,{},qc),MWn.Kb=function(n){return BZ(),iln(BB(n,121).e)},vX(I3n,"NetworkSimplexPlacer/lambda$13$Type",1426),wAn(1428,1,{},Gc),MWn.Kb=function(n){return BZ(),iln(BB(n,121).e)},vX(I3n,"NetworkSimplexPlacer/lambda$15$Type",1428),wAn(1430,1,DVn,zc),MWn.Mb=function(n){return BZ(),BB(n,401).c.k==(uSn(),Cut)},vX(I3n,"NetworkSimplexPlacer/lambda$17$Type",1430),wAn(1431,1,DVn,Uc),MWn.Mb=function(n){return BZ(),BB(n,401).c.j.c.length>1},vX(I3n,"NetworkSimplexPlacer/lambda$18$Type",1431),wAn(1432,1,lVn,zV),MWn.td=function(n){cwn(this.c,this.b,this.d,this.a,BB(n,401))},MWn.c=0,MWn.d=0,vX(I3n,"NetworkSimplexPlacer/lambda$19$Type",1432),wAn(1415,1,{},Xc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$2$Type",1415),wAn(1433,1,lVn,ag),MWn.td=function(n){N$(this.a,BB(n,11))},MWn.a=0,vX(I3n,"NetworkSimplexPlacer/lambda$20$Type",1433),wAn(1434,1,{},Wc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$21$Type",1434),wAn(1435,1,lVn,ug),MWn.td=function(n){dL(this.a,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$22$Type",1435),wAn(1436,1,DVn,Vc),MWn.Mb=function(n){return HD(n)},vX(I3n,"NetworkSimplexPlacer/lambda$23$Type",1436),wAn(1437,1,{},Qc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$24$Type",1437),wAn(1438,1,DVn,og),MWn.Mb=function(n){return EO(this.a,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$25$Type",1438),wAn(1439,1,lVn,eC),MWn.td=function(n){MPn(this.a,this.b,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$26$Type",1439),wAn(1440,1,DVn,Yc),MWn.Mb=function(n){return BZ(),!b5(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$27$Type",1440),wAn(1441,1,DVn,Jc),MWn.Mb=function(n){return BZ(),!b5(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$28$Type",1441),wAn(1442,1,{},sg),MWn.Ce=function(n,t){return sL(this.a,BB(n,29),BB(t,29))},vX(I3n,"NetworkSimplexPlacer/lambda$29$Type",1442),wAn(1416,1,{},Zc),MWn.Kb=function(n){return BZ(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(I3n,"NetworkSimplexPlacer/lambda$3$Type",1416),wAn(1417,1,DVn,na),MWn.Mb=function(n){return BZ(),t2(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$4$Type",1417),wAn(1418,1,lVn,hg),MWn.td=function(n){iBn(this.a,BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$5$Type",1418),wAn(1419,1,{},ta),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$6$Type",1419),wAn(1420,1,DVn,ea),MWn.Mb=function(n){return BZ(),BB(n,10).k==(uSn(),Cut)},vX(I3n,"NetworkSimplexPlacer/lambda$7$Type",1420),wAn(1421,1,{},ia),MWn.Kb=function(n){return BZ(),new Rq(null,new zU(new oz(ZL(hbn(BB(n,10)).a.Kc(),new h))))},vX(I3n,"NetworkSimplexPlacer/lambda$8$Type",1421),wAn(1422,1,DVn,ra),MWn.Mb=function(n){return BZ(),UH(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$9$Type",1422),wAn(1404,1,E3n,Cf),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?Zmt:null},MWn.pf=function(n,t){kHn(BB(n,37),t)},vX(I3n,"SimpleNodePlacer",1404),wAn(180,1,{180:1},qKn),MWn.Ib=function(){var n;return n="",this.c==(gJ(),tyt)?n+=aJn:this.c==nyt&&(n+=cJn),this.o==(oZ(),ryt)?n+=pJn:this.o==cyt?n+="UP":n+="BALANCED",n},vX($3n,"BKAlignedLayout",180),wAn(516,22,{3:1,35:1,22:1,516:1},cC);var iyt,ryt,cyt,ayt=Ben($3n,"BKAlignedLayout/HDirection",516,Unt,VY,PF);wAn(515,22,{3:1,35:1,22:1,515:1},rC);var uyt,oyt,syt,hyt,fyt,lyt,byt,wyt,dyt,gyt,pyt,vyt,myt,yyt,kyt,jyt,Eyt,Tyt,Myt,Syt=Ben($3n,"BKAlignedLayout/VDirection",515,Unt,QY,CF);wAn(1634,1,{},iC),vX($3n,"BKAligner",1634),wAn(1637,1,{},Jyn),vX($3n,"BKCompactor",1637),wAn(654,1,{654:1},ca),MWn.a=0,vX($3n,"BKCompactor/ClassEdge",654),wAn(458,1,{458:1},cm),MWn.a=null,MWn.b=0,vX($3n,"BKCompactor/ClassNode",458),wAn(1407,1,E3n,jI),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?oyt:null},MWn.pf=function(n,t){rWn(this,BB(n,37),t)},MWn.d=!1,vX($3n,"BKNodePlacer",1407),wAn(1635,1,{},aa),MWn.d=0,vX($3n,"NeighborhoodInformation",1635),wAn(1636,1,MYn,fg),MWn.ue=function(n,t){return Mtn(this,BB(n,46),BB(t,46))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX($3n,"NeighborhoodInformation/NeighborComparator",1636),wAn(808,1,{}),vX($3n,"ThresholdStrategy",808),wAn(1763,808,{},dm),MWn.bg=function(n,t,e){return this.a.o==(oZ(),cyt)?RQn:KQn},MWn.cg=function(){},vX($3n,"ThresholdStrategy/NullThresholdStrategy",1763),wAn(579,1,{579:1},aC),MWn.c=!1,MWn.d=!1,vX($3n,"ThresholdStrategy/Postprocessable",579),wAn(1764,808,{},gm),MWn.bg=function(n,t,e){var i,r,c;return r=t==e,i=this.a.a[e.p]==t,r||i?(c=n,this.a.c,gJ(),r&&(c=THn(this,t,!0)),!isNaN(c)&&!isFinite(c)&&i&&(c=THn(this,e,!1)),c):n},MWn.cg=function(){for(var n,t,e;0!=this.d.b;)(t=cFn(this,e=BB(PJ(this.d),579))).a&&(n=t.a,(qy(this.a.f[this.a.g[e.b.p].p])||b5(n)||n.c.i.c!=n.d.i.c)&&(b$n(this,e)||rA(this.e,e)));for(;0!=this.e.a.c.length;)b$n(this,BB(thn(this.e),579))},vX($3n,"ThresholdStrategy/SimpleThresholdStrategy",1764),wAn(635,1,{635:1,246:1,234:1},ua),MWn.Kf=function(){return Tan(this)},MWn.Xf=function(){return Tan(this)},vX(L3n,"EdgeRouterFactory",635),wAn(1458,1,E3n,If),MWn.Yf=function(n){return Uxn(BB(n,37))},MWn.pf=function(n,t){DHn(BB(n,37),t)},vX(L3n,"OrthogonalEdgeRouter",1458),wAn(1451,1,E3n,EI),MWn.Yf=function(n){return Ejn(BB(n,37))},MWn.pf=function(n,t){OUn(this,BB(n,37),t)},vX(L3n,"PolylineEdgeRouter",1451),wAn(1452,1,qYn,oa),MWn.Lb=function(n){return Qan(BB(n,10))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return Qan(BB(n,10))},vX(L3n,"PolylineEdgeRouter/1",1452),wAn(1809,1,DVn,sa),MWn.Mb=function(n){return BB(n,129).c==(O6(),Tyt)},vX(N3n,"HyperEdgeCycleDetector/lambda$0$Type",1809),wAn(1810,1,{},ha),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$1$Type",1810),wAn(1811,1,DVn,fa),MWn.Mb=function(n){return BB(n,129).c==(O6(),Tyt)},vX(N3n,"HyperEdgeCycleDetector/lambda$2$Type",1811),wAn(1812,1,{},la),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$3$Type",1812),wAn(1813,1,{},ba),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$4$Type",1813),wAn(1814,1,{},wa),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$5$Type",1814),wAn(112,1,{35:1,112:1},Fan),MWn.wd=function(n){return oj(this,BB(n,112))},MWn.Fb=function(n){var t;return!!cL(n,112)&&(t=BB(n,112),this.g==t.g)},MWn.Hb=function(){return this.g},MWn.Ib=function(){var n,t,e,i;for(n=new lN("{"),i=new Wb(this.n);i.a"+this.b+" ("+wx(this.c)+")"},MWn.d=0,vX(N3n,"HyperEdgeSegmentDependency",129),wAn(520,22,{3:1,35:1,22:1,520:1},uC);var Pyt,Cyt,Iyt,Oyt,Ayt,$yt,Lyt,Nyt,xyt=Ben(N3n,"HyperEdgeSegmentDependency/DependencyType",520,Unt,WY,IF);wAn(1815,1,{},lg),vX(N3n,"HyperEdgeSegmentSplitter",1815),wAn(1816,1,{},zj),MWn.a=0,MWn.b=0,vX(N3n,"HyperEdgeSegmentSplitter/AreaRating",1816),wAn(329,1,{329:1},kB),MWn.a=0,MWn.b=0,MWn.c=0,vX(N3n,"HyperEdgeSegmentSplitter/FreeArea",329),wAn(1817,1,MYn,ja),MWn.ue=function(n,t){return OK(BB(n,112),BB(t,112))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(N3n,"HyperEdgeSegmentSplitter/lambda$0$Type",1817),wAn(1818,1,lVn,XV),MWn.td=function(n){n4(this.a,this.d,this.c,this.b,BB(n,112))},MWn.b=0,vX(N3n,"HyperEdgeSegmentSplitter/lambda$1$Type",1818),wAn(1819,1,{},Ea),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).e,16))},vX(N3n,"HyperEdgeSegmentSplitter/lambda$2$Type",1819),wAn(1820,1,{},Ta),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).j,16))},vX(N3n,"HyperEdgeSegmentSplitter/lambda$3$Type",1820),wAn(1821,1,{},Ma),MWn.Fe=function(n){return Gy(MD(n))},vX(N3n,"HyperEdgeSegmentSplitter/lambda$4$Type",1821),wAn(655,1,{},fX),MWn.a=0,MWn.b=0,MWn.c=0,vX(N3n,"OrthogonalRoutingGenerator",655),wAn(1638,1,{},Sa),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).e,16))},vX(N3n,"OrthogonalRoutingGenerator/lambda$0$Type",1638),wAn(1639,1,{},Pa),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).j,16))},vX(N3n,"OrthogonalRoutingGenerator/lambda$1$Type",1639),wAn(661,1,{}),vX(x3n,"BaseRoutingDirectionStrategy",661),wAn(1807,661,{},pm),MWn.dg=function(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g;if(!n.r||n.q)for(f=t+n.o*i,h=new Wb(n.n);h.alZn&&(c=n,r=new xC(l,a=f),DH(u.a,r),F_n(this,u,c,r,!1),(b=n.r)&&(r=new xC(w=Gy(MD(Dpn(b.e,0))),a),DH(u.a,r),F_n(this,u,c,r,!1),c=b,r=new xC(w,a=t+b.o*i),DH(u.a,r),F_n(this,u,c,r,!1)),r=new xC(g,a),DH(u.a,r),F_n(this,u,c,r,!1)))},MWn.eg=function(n){return n.i.n.a+n.n.a+n.a.a},MWn.fg=function(){return kUn(),SIt},MWn.gg=function(){return kUn(),sIt},vX(x3n,"NorthToSouthRoutingStrategy",1807),wAn(1808,661,{},vm),MWn.dg=function(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g;if(!n.r||n.q)for(f=t-n.o*i,h=new Wb(n.n);h.alZn&&(c=n,r=new xC(l,a=f),DH(u.a,r),F_n(this,u,c,r,!1),(b=n.r)&&(r=new xC(w=Gy(MD(Dpn(b.e,0))),a),DH(u.a,r),F_n(this,u,c,r,!1),c=b,r=new xC(w,a=t-b.o*i),DH(u.a,r),F_n(this,u,c,r,!1)),r=new xC(g,a),DH(u.a,r),F_n(this,u,c,r,!1)))},MWn.eg=function(n){return n.i.n.a+n.n.a+n.a.a},MWn.fg=function(){return kUn(),sIt},MWn.gg=function(){return kUn(),SIt},vX(x3n,"SouthToNorthRoutingStrategy",1808),wAn(1806,661,{},mm),MWn.dg=function(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g;if(!n.r||n.q)for(f=t+n.o*i,h=new Wb(n.n);h.alZn&&(c=n,r=new xC(a=f,l),DH(u.a,r),F_n(this,u,c,r,!0),(b=n.r)&&(r=new xC(a,w=Gy(MD(Dpn(b.e,0)))),DH(u.a,r),F_n(this,u,c,r,!0),c=b,r=new xC(a=t+b.o*i,w),DH(u.a,r),F_n(this,u,c,r,!0)),r=new xC(a,g),DH(u.a,r),F_n(this,u,c,r,!0)))},MWn.eg=function(n){return n.i.n.b+n.n.b+n.a.b},MWn.fg=function(){return kUn(),oIt},MWn.gg=function(){return kUn(),CIt},vX(x3n,"WestToEastRoutingStrategy",1806),wAn(813,1,{},oBn),MWn.Ib=function(){return LMn(this.a)},MWn.b=0,MWn.c=!1,MWn.d=!1,MWn.f=0,vX(R3n,"NubSpline",813),wAn(407,1,{407:1},Exn,wJ),vX(R3n,"NubSpline/PolarCP",407),wAn(1453,1,E3n,hyn),MWn.Yf=function(n){return rTn(BB(n,37))},MWn.pf=function(n,t){cXn(this,BB(n,37),t)},vX(R3n,"SplineEdgeRouter",1453),wAn(268,1,{268:1},S6),MWn.Ib=function(){return this.a+" ->("+this.c+") "+this.b},MWn.c=0,vX(R3n,"SplineEdgeRouter/Dependency",268),wAn(455,22,{3:1,35:1,22:1,455:1},oC);var Dyt,Ryt,Kyt,_yt,Fyt,Byt=Ben(R3n,"SplineEdgeRouter/SideToProcess",455,Unt,YY,OF);wAn(1454,1,DVn,ya),MWn.Mb=function(n){return gxn(),!BB(n,128).o},vX(R3n,"SplineEdgeRouter/lambda$0$Type",1454),wAn(1455,1,{},ma),MWn.Ge=function(n){return gxn(),BB(n,128).v+1},vX(R3n,"SplineEdgeRouter/lambda$1$Type",1455),wAn(1456,1,lVn,sC),MWn.td=function(n){iq(this.a,this.b,BB(n,46))},vX(R3n,"SplineEdgeRouter/lambda$2$Type",1456),wAn(1457,1,lVn,hC),MWn.td=function(n){rq(this.a,this.b,BB(n,46))},vX(R3n,"SplineEdgeRouter/lambda$3$Type",1457),wAn(128,1,{35:1,128:1},tCn,hqn),MWn.wd=function(n){return sj(this,BB(n,128))},MWn.b=0,MWn.e=!1,MWn.f=0,MWn.g=0,MWn.j=!1,MWn.k=!1,MWn.n=0,MWn.o=!1,MWn.p=!1,MWn.q=!1,MWn.s=0,MWn.u=0,MWn.v=0,MWn.F=0,vX(R3n,"SplineSegment",128),wAn(459,1,{459:1},ka),MWn.a=0,MWn.b=!1,MWn.c=!1,MWn.d=!1,MWn.e=!1,MWn.f=0,vX(R3n,"SplineSegment/EdgeInformation",459),wAn(1234,1,{},da),vX(H3n,iZn,1234),wAn(1235,1,MYn,ga),MWn.ue=function(n,t){return IIn(BB(n,135),BB(t,135))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(H3n,rZn,1235),wAn(1233,1,{},AE),vX(H3n,"MrTree",1233),wAn(393,22,{3:1,35:1,22:1,393:1,246:1,234:1},fC),MWn.Kf=function(){return AIn(this)},MWn.Xf=function(){return AIn(this)};var Hyt,qyt=Ben(H3n,"TreeLayoutPhases",393,Unt,j3,AF);wAn(1130,209,NJn,_R),MWn.Ze=function(n,t){var e,i,r,c,a,u;for(qy(TD(ZAn(n,(CAn(),Ckt))))||jJ(new Tw((GM(),new Dy(n)))),qan(a=new P6,n),hon(a,(qqn(),skt),n),v_n(n,a,u=new xp),W_n(n,a,u),c=a,i=new Wb(r=x_n(this.a,c));i.a"+g0(this.c):"e_"+nsn(this)},vX(q3n,"TEdge",188),wAn(135,134,{3:1,135:1,94:1,134:1},P6),MWn.Ib=function(){var n,t,e,i,r;for(r=null,i=spn(this.b,0);i.b!=i.d.c;)r+=(null==(e=BB(b3(i),86)).c||0==e.c.length?"n_"+e.g:"n_"+e.c)+"\n";for(t=spn(this.a,0);t.b!=t.d.c;)r+=((n=BB(b3(t),188)).b&&n.c?g0(n.b)+"->"+g0(n.c):"e_"+nsn(n))+"\n";return r};var Gyt=vX(q3n,"TGraph",135);wAn(633,502,{3:1,502:1,633:1,94:1,134:1}),vX(q3n,"TShape",633),wAn(86,633,{3:1,502:1,86:1,633:1,94:1,134:1},csn),MWn.Ib=function(){return g0(this)};var zyt,Uyt,Xyt,Wyt,Vyt,Qyt,Yyt=vX(q3n,"TNode",86);wAn(255,1,pVn,bg),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new wg(spn(this.a.d,0))},vX(q3n,"TNode/2",255),wAn(358,1,QWn,wg),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(b3(this.a),188).c},MWn.Ob=function(){return EE(this.a)},MWn.Qb=function(){mtn(this.a)},vX(q3n,"TNode/2/1",358),wAn(1840,1,n1n,KR),MWn.pf=function(n,t){xFn(this,BB(n,135),t)},vX(G3n,"FanProcessor",1840),wAn(327,22,{3:1,35:1,22:1,327:1,234:1},lC),MWn.Kf=function(){switch(this.g){case 0:return new Qm;case 1:return new KR;case 2:return new Oa;case 3:return new Ca;case 4:return new $a;case 5:return new La;default:throw Hp(new _y(M1n+(null!=this.f?this.f:""+this.g)))}};var Jyt,Zyt,nkt,tkt,ekt,ikt,rkt,ckt,akt,ukt,okt,skt,hkt,fkt,lkt,bkt,wkt,dkt,gkt,pkt,vkt,mkt,ykt,kkt,jkt,Ekt,Tkt,Mkt,Skt,Pkt,Ckt,Ikt,Okt,Akt,$kt,Lkt,Nkt,xkt,Dkt,Rkt,Kkt,_kt=Ben(G3n,S1n,327,Unt,r9,$F);wAn(1843,1,n1n,Ca),MWn.pf=function(n,t){u$n(this,BB(n,135),t)},MWn.a=0,vX(G3n,"LevelHeightProcessor",1843),wAn(1844,1,pVn,Ia),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return SQ(),LT(),bet},vX(G3n,"LevelHeightProcessor/1",1844),wAn(1841,1,n1n,Oa),MWn.pf=function(n,t){QPn(this,BB(n,135),t)},MWn.a=0,vX(G3n,"NeighborsProcessor",1841),wAn(1842,1,pVn,Aa),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return SQ(),LT(),bet},vX(G3n,"NeighborsProcessor/1",1842),wAn(1845,1,n1n,$a),MWn.pf=function(n,t){a$n(this,BB(n,135),t)},MWn.a=0,vX(G3n,"NodePositionProcessor",1845),wAn(1839,1,n1n,Qm),MWn.pf=function(n,t){ZHn(this,BB(n,135))},vX(G3n,"RootProcessor",1839),wAn(1846,1,n1n,La),MWn.pf=function(n,t){dln(BB(n,135))},vX(G3n,"Untreeifyer",1846),wAn(851,1,QYn,Pf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X3n),""),"Weighting of Nodes"),"Which weighting to use when computing a node order."),kkt),(PPn(),gMt)),qkt),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W3n),""),"Search Order"),"Which search order to use when computing a spanning tree."),mkt),gMt),Jkt),nbn(hMt)))),KGn((new Sf,n))},vX(V3n,"MrTreeMetaDataProvider",851),wAn(994,1,QYn,Sf),MWn.Qe=function(n){KGn(n)},vX(V3n,"MrTreeOptions",994),wAn(995,1,{},Na),MWn.$e=function(){return new _R},MWn._e=function(n){},vX(V3n,"MrTreeOptions/MrtreeFactory",995),wAn(480,22,{3:1,35:1,22:1,480:1},bC);var Fkt,Bkt,Hkt,qkt=Ben(V3n,"OrderWeighting",480,Unt,ZY,LF);wAn(425,22,{3:1,35:1,22:1,425:1},wC);var Gkt,zkt,Ukt,Xkt,Wkt,Vkt,Qkt,Ykt,Jkt=Ben(V3n,"TreeifyingOrder",425,Unt,JY,xF);wAn(1459,1,E3n,pf),MWn.Yf=function(n){return BB(n,135),zkt},MWn.pf=function(n,t){ycn(this,BB(n,135),t)},vX("org.eclipse.elk.alg.mrtree.p1treeify","DFSTreeifyer",1459),wAn(1460,1,E3n,vf),MWn.Yf=function(n){return BB(n,135),Ukt},MWn.pf=function(n,t){fCn(this,BB(n,135),t)},vX("org.eclipse.elk.alg.mrtree.p2order","NodeOrderer",1460),wAn(1461,1,E3n,gf),MWn.Yf=function(n){return BB(n,135),Xkt},MWn.pf=function(n,t){nRn(this,BB(n,135),t)},MWn.a=0,vX("org.eclipse.elk.alg.mrtree.p3place","NodePlacer",1461),wAn(1462,1,E3n,mf),MWn.Yf=function(n){return BB(n,135),Wkt},MWn.pf=function(n,t){xkn(BB(n,135),t)},vX("org.eclipse.elk.alg.mrtree.p4route","EdgeRouter",1462),wAn(495,22,{3:1,35:1,22:1,495:1,246:1,234:1},dC),MWn.Kf=function(){return bwn(this)},MWn.Xf=function(){return bwn(this)};var Zkt,njt,tjt,ejt,ijt=Ben(J3n,"RadialLayoutPhases",495,Unt,nJ,NF);wAn(1131,209,NJn,OE),MWn.Ze=function(n,t){var e,i,r;if(OTn(t,"Radial layout",ECn(this,n).c.length),qy(TD(ZAn(n,(Uyn(),Ajt))))||jJ(new Tw((GM(),new Dy(n)))),r=uTn(n),Ypn(n,(wD(),Vkt),r),!r)throw Hp(new _y("The given graph is not a tree!"));for(0==(e=Gy(MD(ZAn(n,Djt))))&&(e=fIn(n)),Ypn(n,Djt,e),i=new Wb(ECn(this,n));i.a0&&xhn((b1(t-1,n.length),n.charCodeAt(t-1)),s1n);)--t;if(e>=t)throw Hp(new _y("The given string does not contain any numbers."));if(2!=(i=kKn(n.substr(e,t-e),",|;|\r|\n")).length)throw Hp(new _y("Exactly two numbers are expected, "+i.length+" were found."));try{this.a=bSn(RMn(i[0])),this.b=bSn(RMn(i[1]))}catch(r){throw cL(r=lun(r),127)?Hp(new _y(h1n+r)):Hp(r)}},MWn.Ib=function(){return"("+this.a+","+this.b+")"},MWn.a=0,MWn.b=0;var PMt=vX(f1n,"KVector",8);wAn(74,68,{3:1,4:1,20:1,28:1,52:1,14:1,68:1,15:1,74:1,414:1},km,Kj,Ux),MWn.Pc=function(){return Vsn(this)},MWn.Jf=function(n){var t,e,i,r,c;e=kKn(n,",|;|\\(|\\)|\\[|\\]|\\{|\\}| |\t|\n"),yQ(this);try{for(t=0,r=0,i=0,c=0;t0&&(r%2==0?i=bSn(e[t]):c=bSn(e[t]),r>0&&r%2!=0&&DH(this,new xC(i,c)),++r),++t}catch(a){throw cL(a=lun(a),127)?Hp(new _y("The given string does not match the expected format for vectors."+a)):Hp(a)}},MWn.Ib=function(){var n,t,e;for(n=new lN("("),t=spn(this,0);t.b!=t.d.c;)oO(n,(e=BB(b3(t),8)).a+","+e.b),t.b!=t.d.c&&(n.a+="; ");return(n.a+=")",n).a};var CMt,IMt,OMt,AMt,$Mt,LMt,NMt=vX(f1n,"KVectorChain",74);wAn(248,22,{3:1,35:1,22:1,248:1},DC);var xMt,DMt,RMt,KMt,_Mt,FMt,BMt,HMt,qMt,GMt,zMt,UMt,XMt,WMt,VMt,QMt,YMt,JMt,ZMt,nSt=Ben(h5n,"Alignment",248,Unt,J8,JF);wAn(979,1,QYn,Lf),MWn.Qe=function(n){G_n(n)},vX(h5n,"BoxLayouterOptions",979),wAn(980,1,{},xu),MWn.$e=function(){return new Gu},MWn._e=function(n){},vX(h5n,"BoxLayouterOptions/BoxFactory",980),wAn(291,22,{3:1,35:1,22:1,291:1},RC);var tSt,eSt,iSt,rSt,cSt,aSt,uSt,oSt,sSt,hSt,fSt,lSt,bSt,wSt,dSt,gSt,pSt,vSt,mSt,ySt,kSt,jSt,ESt,TSt,MSt,SSt,PSt,CSt,ISt,OSt,ASt,$St,LSt,NSt,xSt,DSt,RSt,KSt,_St,FSt,BSt,HSt,qSt,GSt,zSt,USt,XSt,WSt,VSt,QSt,YSt,JSt,ZSt,nPt,tPt,ePt,iPt,rPt,cPt,aPt,uPt,oPt,sPt,hPt,fPt,lPt,bPt,wPt,dPt,gPt,pPt,vPt,mPt,yPt,kPt,jPt,EPt,TPt,MPt,SPt,PPt,CPt,IPt,OPt,APt,$Pt,LPt,NPt,xPt,DPt,RPt,KPt,_Pt,FPt,BPt,HPt,qPt=Ben(h5n,"ContentAlignment",291,Unt,Y8,ZF);wAn(684,1,QYn,Nf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,w5n),""),"Layout Algorithm"),"Select a specific layout algorithm."),(PPn(),yMt)),Qtt),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,d5n),""),"Resolved Layout Algorithm"),"Meta data associated with the selected algorithm."),mMt),aMt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W2n),""),"Alignment"),"Alignment of the selected node relative to other nodes; the exact meaning depends on the used algorithm."),rSt),gMt),nSt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,VJn),""),"Aspect Ratio"),"The desired aspect ratio of the drawing, that is the quotient of width by height."),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,g5n),""),"Bend Points"),"A fixed list of bend points for the edge. This is used by the 'Fixed Layout' algorithm to specify a pre-defined routing for an edge. The vector chain must include the source point, any bend points, and the target point, so it must have at least two points."),mMt),NMt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,u3n),""),"Content Alignment"),"Specifies how the content of a node are aligned. Each node can individually control the alignment of its contents. I.e. if a node should be aligned top left in its parent node, the parent node should specify that option."),fSt),pMt),qPt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X2n),""),"Debug Mode"),"Whether additional debug information shall be generated."),(hN(),!1)),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,J2n),""),TJn),"Overall direction of edges: horizontal (right / left) or vertical (down / up)."),wSt),gMt),WPt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,y2n),""),"Edge Routing"),"What kind of edge routing style should be applied for the content of a parent node. Algorithms may also set this option to single edges in order to mark them as splines. The bend point list of edges with this option set to SPLINES must be interpreted as control points for a piecewise cubic spline."),mSt),gMt),oCt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,A4n),""),"Expand Nodes"),"If active, nodes are expanded to fill the area of their parent."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,d2n),""),"Hierarchy Handling"),"Determines whether separate layout runs are triggered for different compound nodes in a hierarchical graph. Setting a node's hierarchy handling to `INCLUDE_CHILDREN` will lay out that node and all of its descendants in a single layout run, until a descendant is encountered which has its hierarchy handling set to `SEPARATE_CHILDREN`. In general, `SEPARATE_CHILDREN` will ensure that a new layout run is triggered for a node with that setting. Including multiple levels of hierarchy in a single layout run may allow cross-hierarchical edges to be laid out properly. If the root node is set to `INHERIT` (or not set at all), the default behavior is `SEPARATE_CHILDREN`."),TSt),gMt),SCt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,QJn),""),"Padding"),"The padding to be left to a parent element's border when placing child elements. This can also serve as an output option of a layout algorithm if node size calculation is setup appropriately."),WSt),mMt),_ut),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,jZn),""),"Interactive"),"Whether the algorithm should be run in interactive mode for the content of a parent node. What this means exactly depends on how the specific algorithm interprets this option. Usually in the interactive mode algorithms try to modify the current layout as little as possible."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,m3n),""),"interactive Layout"),"Whether the graph should be changeable interactively and by setting constraints"),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,MZn),""),"Omit Node Micro Layout"),"Node micro layout comprises the computation of node dimensions (if requested), the placement of ports and their labels, and the placement of node labels. The functionality is implemented independent of any specific layout algorithm and shouldn't have any negative impact on the layout algorithm's performance itself. Yet, if any unforeseen behavior occurs, this option allows to deactivate the micro layout."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,EZn),""),"Port Constraints"),"Defines constraints of the position of the ports of a node."),oPt),gMt),aIt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,g3n),""),"Position"),"The position of a node, port, or label. This is used by the 'Fixed Layout' algorithm to specify a pre-defined position."),mMt),PMt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[fMt,oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,pZn),""),"Priority"),"Defines the priority of an object; its meaning depends on the specific layout algorithm and the context where it is used."),vMt),Att),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,yZn),""),"Randomization Seed"),"Seed used for pseudo-random number generators to control the layout algorithm. If the value is 0, the seed shall be determined pseudo-randomly (e.g. from the system time)."),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,kZn),""),"Separate Connected Components"),"Whether each connected component should be processed separately."),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,o3n),""),"Junction Points"),"This option is not used as option, but as output of the layout algorithms. It is attached to edges and determines the points where junction symbols should be drawn in order to represent hyperedges with orthogonal routing. Whether such points are computed depends on the chosen layout algorithm and edge routing style. The points are put into the vector chain with no specific order."),ASt),mMt),NMt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,f3n),""),"Comment Box"),"Whether the node should be regarded as a comment box instead of a regular node. In that case its placement should be similar to how labels are handled. Any edges incident to a comment box specify to which graph elements the comment is related."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,l3n),""),"Hypernode"),"Whether the node should be handled as a hypernode."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,p5n),""),"Label Manager"),"Label managers can shorten labels upon a layout algorithm's request."),mMt),KNt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,p3n),""),"Margins"),"Margins define additional space around the actual bounds of a graph element. For instance, ports or labels being placed on the outside of a node's border might introduce such a margin. The margin is used to guarantee non-overlap of other graph elements with those ports or labels."),LSt),mMt),Eut),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,z2n),""),"No Layout"),"No layout is done for the associated element. This is used to mark parts of a diagram to avoid their inclusion in the layout graph, or to mark parts of the layout graph to prevent layout engines from processing them. If you wish to exclude the contents of a compound node from automatic layout, while the node itself is still considered on its own layer, use the 'Fixed Layout' algorithm for that node."),!1),wMt),ktt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt,fMt,oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,v5n),""),"Scale Factor"),"The scaling factor to be applied to the corresponding node in recursive layout. It causes the corresponding node's size to be adjusted, and its ports and labels to be sized and placed accordingly after the layout of that node has been determined (and before the node itself and its siblings are arranged). The scaling is not reverted afterwards, so the resulting layout graph contains the adjusted size and position data. This option is currently not supported if 'Layout Hierarchy' is set."),1),dMt),Ptt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,m5n),""),"Animate"),"Whether the shift from the old layout to the new computed layout shall be animated."),!0),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,y5n),""),"Animation Time Factor"),"Factor for computation of animation time. The higher the value, the longer the animation time. If the value is 0, the resulting time is always equal to the minimum defined by 'Minimal Animation Time'."),iln(100)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,k5n),""),"Layout Ancestors"),"Whether the hierarchy levels on the path from the selected element to the root of the diagram shall be included in the layout process."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,j5n),""),"Maximal Animation Time"),"The maximal time for animations, in milliseconds."),iln(4e3)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,E5n),""),"Minimal Animation Time"),"The minimal time for animations, in milliseconds."),iln(400)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,T5n),""),"Progress Bar"),"Whether a progress bar shall be displayed during layout computations."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,M5n),""),"Validate Graph"),"Whether the graph shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,S5n),""),"Validate Options"),"Whether layout options shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user."),!0),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,P5n),""),"Zoom to Fit"),"Whether the zoom level shall be set to view the whole diagram after layout."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,b5n),"box"),"Box Layout Mode"),"Configures the packing mode used by the {@link BoxLayoutProvider}. If SIMPLE is not required (neither priorities are used nor the interactive mode), GROUP_DEC can improve the packing and decrease the area. GROUP_MIXED and GROUP_INC may, in very specific scenarios, work better."),oSt),gMt),cOt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,L2n),k2n),"Comment Comment Spacing"),"Spacing to be preserved between a comment box and other comment boxes connected to the same node. The space left between comment boxes of different nodes is controlled by the node-node spacing."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,N2n),k2n),"Comment Node Spacing"),"Spacing to be preserved between a node and its connected comment boxes. The space left between a node and the comments of another node is controlled by the node-node spacing."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,XJn),k2n),"Components Spacing"),"Spacing to be preserved between pairs of connected components. This option is only relevant if 'separateConnectedComponents' is activated."),20),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,x2n),k2n),"Edge Spacing"),"Spacing to be preserved between any two edges. Note that while this can somewhat easily be satisfied for the segments of orthogonally drawn edges, it is harder for general polylines or splines."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,mZn),k2n),"Edge Label Spacing"),"The minimal distance to be preserved between a label and the edge it is associated with. Note that the placement of a label is influenced by the 'edgelabels.placement' option."),2),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,D2n),k2n),"Edge Node Spacing"),"Spacing to be preserved between nodes and edges."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,R2n),k2n),"Label Spacing"),"Determines the amount of space to be left between two labels of the same graph element."),0),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,F2n),k2n),"Label Node Spacing"),"Spacing to be preserved between labels and the border of node they are associated with. Note that the placement of a label is influenced by the 'nodelabels.placement' option."),5),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,K2n),k2n),"Horizontal spacing between Label and Port"),"Horizontal spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,_2n),k2n),"Vertical spacing between Label and Port"),"Vertical spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,vZn),k2n),"Node Spacing"),"The minimal distance to be preserved between each two nodes."),20),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,B2n),k2n),"Node Self Loop Spacing"),"Spacing to be preserved between a node and its self loops."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,H2n),k2n),"Port Spacing"),"Spacing between pairs of ports of the same node."),10),dMt),Ptt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,q2n),k2n),"Individual Spacing"),"Allows to specify individual spacing values for graph elements that shall be different from the value specified for the element's parent."),mMt),hOt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt,fMt,oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,v3n),k2n),"Additional Port Space"),"Additional space around the sets of ports on each node side. For each side of a node, this option can reserve additional space before and after the ports on each side. For example, a top spacing of 20 makes sure that the first port on the western and eastern side is 20 units away from the northern border."),DPt),mMt),Eut),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,d3n),A5n),"Layout Partition"),"Partition to which the node belongs. This requires Layout Partitioning to be active. Nodes with lower partition IDs will appear to the left of nodes with higher partition IDs (assuming a left-to-right layout direction)."),vMt),Att),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),a2(n,d3n,w3n,JSt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,w3n),A5n),"Layout Partitioning"),"Whether to activate partitioned layout. This will allow to group nodes through the Layout Partition option. a pair of nodes with different partition indices is then placed such that the node with lower index is placed to the left of the other node (with left-to-right layout direction). Depending on the layout algorithm, this may only be guaranteed to work if all nodes have a layout partition configured, or at least if edges that cross partitions are not part of a partition-crossing cycle."),QSt),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Z2n),$5n),"Node Label Padding"),"Define padding for node labels that are placed inside of a node."),xSt),mMt),_ut),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,CZn),$5n),"Node Label Placement"),"Hints for where node labels are to be placed; if empty, the node label's position is not modified."),RSt),pMt),GCt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,e3n),L5n),"Port Alignment"),"Defines the default port distribution for a node. May be overridden for each side individually."),nPt),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,i3n),L5n),"Port Alignment (North)"),"Defines how ports on the northern side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,r3n),L5n),"Port Alignment (South)"),"Defines how ports on the southern side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,c3n),L5n),"Port Alignment (West)"),"Defines how ports on the western side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,a3n),L5n),"Port Alignment (East)"),"Defines how ports on the eastern side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,PZn),N5n),"Node Size Constraints"),"What should be taken into account when calculating a node's size. Empty size constraints specify that a node's size is already fixed and should not be changed."),_St),pMt),YIt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,SZn),N5n),"Node Size Options"),"Options modifying the behavior of the size constraints set on a node. Each member of the set specifies something that should be taken into account when calculating node sizes. The empty set corresponds to no further modifications."),GSt),pMt),iOt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,BZn),N5n),"Node Size Minimum"),"The minimal size to which a node can be reduced."),HSt),mMt),PMt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Y2n),N5n),"Fixed Graph Size"),"By default, the fixed layout provider will enlarge a graph until it is large enough to contain its children. If this option is set, it won't do so."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,s3n),A2n),"Edge Label Placement"),"Gives a hint on where to put edge labels."),pSt),gMt),nCt),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,TZn),A2n),"Inline Edge Labels"),"If true, an edge label is placed directly on its edge. May only apply to center edge labels. This kind of label placement is only advisable if the label's rendering is such that it is not crossed by its edge and thus stays legible."),!1),wMt),ktt),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,C5n),"font"),"Font Name"),"Font name used for a label."),yMt),Qtt),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,I5n),"font"),"Font Size"),"Font size used for a label."),vMt),Att),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,b3n),x5n),"Port Anchor Offset"),"The offset to the port position where connections shall be attached."),mMt),PMt),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,h3n),x5n),"Port Index"),"The index of a port in the fixed order around a node. The order is assumed as clockwise, starting with the leftmost port on the top side. This option must be set if 'Port Constraints' is set to FIXED_ORDER and no specific positions are given for the ports. Additionally, the option 'Port Side' must be defined in this case."),vMt),Att),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,U2n),x5n),"Port Side"),"The side of a node on which a port is situated. This option must be set if 'Port Constraints' is set to FIXED_SIDE or FIXED_ORDER and no specific positions are given for the ports."),dPt),gMt),FIt),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,G2n),x5n),"Port Border Offset"),"The offset of ports on the node border. With a positive offset the port is moved outside of the node, while with a negative offset the port is moved towards the inside. An offset of 0 means that the port is placed directly on the node border, i.e. if the port side is north, the port's south border touches the nodes's north border; if the port side is east, the port's west border touches the nodes's east border; if the port side is south, the port's north border touches the node's south border; if the port side is west, the port's east border touches the node's west border."),dMt),Ptt),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,IZn),D5n),"Port Label Placement"),"Decides on a placement method for port labels; if empty, the node label's position is not modified."),lPt),pMt),IIt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,n3n),D5n),"Port Labels Next to Port"),"Use 'portLabels.placement': NEXT_TO_PORT_OF_POSSIBLE."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,t3n),D5n),"Treat Port Labels as Group"),"If this option is true (default), the labels of a port will be treated as a group when it comes to centering them next to their port. If this option is false, only the first label will be centered next to the port, with the others being placed below. This only applies to labels of eastern and western ports and will have no effect if labels are not placed next to their port."),!0),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,V2n),R5n),"Activate Inside Self Loops"),"Whether this node allows to route self loops inside of it instead of around it. If set to true, this will make the node a compound node if it isn't already, and will require the layout algorithm to support compound nodes with hierarchical ports."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Q2n),R5n),"Inside Self Loop"),"Whether a self loop should be routed inside a node instead of around that node."),!1),wMt),ktt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,WJn),"edge"),"Edge Thickness"),"The thickness of an edge. This is a hint on the line width used to draw an edge, possibly requiring more space to be reserved for it."),1),dMt),Ptt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,O5n),"edge"),"Edge Type"),"The type of an edge. This is usually used for UML class diagrams, where associations must be handled differently from generalizations."),kSt),gMt),yCt),nbn(uMt)))),xM(n,new UZ(yj(jj(kj(new pu,w1n),"Layered"),'The layer-based method was introduced by Sugiyama, Tagawa and Toda in 1981. It emphasizes the direction of edges by pointing as many edges as possible into the same direction. The nodes are arranged in layers, which are sometimes called "hierarchies", and then reordered such that the number of edge crossings is minimized. Afterwards, concrete coordinates are computed for the nodes and edge bend points.'))),xM(n,new UZ(yj(jj(kj(new pu,"org.eclipse.elk.orthogonal"),"Orthogonal"),'Orthogonal methods that follow the "topology-shape-metrics" approach by Batini, Nardelli and Tamassia \'86. The first phase determines the topology of the drawing by applying a planarization technique, which results in a planar representation of the graph. The orthogonal shape is computed in the second phase, which aims at minimizing the number of edge bends, and is called orthogonalization. The third phase leads to concrete coordinates for nodes and edge bend points by applying a compaction method, thus defining the metrics.'))),xM(n,new UZ(yj(jj(kj(new pu,gZn),"Force"),"Layout algorithms that follow physical analogies by simulating a system of attractive and repulsive forces. The first successful method of this kind was proposed by Eades in 1984."))),xM(n,new UZ(yj(jj(kj(new pu,"org.eclipse.elk.circle"),"Circle"),"Circular layout algorithms emphasize cycles or biconnected components of a graph by arranging them in circles. This is useful if a drawing is desired where such components are clearly grouped, or where cycles are shown as prominent OPTIONS of the graph."))),xM(n,new UZ(yj(jj(kj(new pu,Y3n),"Tree"),"Specialized layout methods for trees, i.e. acyclic graphs. The regular structure of graphs that have no undirected cycles can be emphasized using an algorithm of this type."))),xM(n,new UZ(yj(jj(kj(new pu,"org.eclipse.elk.planar"),"Planar"),"Algorithms that require a planar or upward planar graph. Most of these algorithms are theoretically interesting, but not practically usable."))),xM(n,new UZ(yj(jj(kj(new pu,w4n),"Radial"),"Radial layout algorithms usually position the nodes of the graph on concentric circles."))),bKn((new xf,n)),G_n((new Lf,n)),RDn((new Df,n))},vX(h5n,"CoreOptions",684),wAn(103,22,{3:1,35:1,22:1,103:1},KC);var GPt,zPt,UPt,XPt,WPt=Ben(h5n,TJn,103,Unt,C5,eB);wAn(272,22,{3:1,35:1,22:1,272:1},_C);var VPt,QPt,YPt,JPt,ZPt,nCt=Ben(h5n,"EdgeLabelPlacement",272,Unt,q1,iB);wAn(218,22,{3:1,35:1,22:1,218:1},FC);var tCt,eCt,iCt,rCt,cCt,aCt,uCt,oCt=Ben(h5n,"EdgeRouting",218,Unt,S3,rB);wAn(312,22,{3:1,35:1,22:1,312:1},BC);var sCt,hCt,fCt,lCt,bCt,wCt,dCt,gCt,pCt,vCt,mCt,yCt=Ben(h5n,"EdgeType",312,Unt,a9,cB);wAn(977,1,QYn,xf),MWn.Qe=function(n){bKn(n)},vX(h5n,"FixedLayouterOptions",977),wAn(978,1,{},Vu),MWn.$e=function(){return new Hu},MWn._e=function(n){},vX(h5n,"FixedLayouterOptions/FixedFactory",978),wAn(334,22,{3:1,35:1,22:1,334:1},HC);var kCt,jCt,ECt,TCt,MCt,SCt=Ben(h5n,"HierarchyHandling",334,Unt,H1,aB);wAn(285,22,{3:1,35:1,22:1,285:1},qC);var PCt,CCt,ICt,OCt,ACt,$Ct,LCt,NCt,xCt,DCt,RCt=Ben(h5n,"LabelSide",285,Unt,M3,uB);wAn(93,22,{3:1,35:1,22:1,93:1},GC);var KCt,_Ct,FCt,BCt,HCt,qCt,GCt=Ben(h5n,"NodeLabelPlacement",93,Unt,ken,oB);wAn(249,22,{3:1,35:1,22:1,249:1},zC);var zCt,UCt,XCt,WCt,VCt,QCt,YCt,JCt=Ben(h5n,"PortAlignment",249,Unt,I5,sB);wAn(98,22,{3:1,35:1,22:1,98:1},UC);var ZCt,nIt,tIt,eIt,iIt,rIt,cIt,aIt=Ben(h5n,"PortConstraints",98,Unt,S8,hB);wAn(273,22,{3:1,35:1,22:1,273:1},XC);var uIt,oIt,sIt,hIt,fIt,lIt,bIt,wIt,dIt,gIt,pIt,vIt,mIt,yIt,kIt,jIt,EIt,TIt,MIt,SIt,PIt,CIt,IIt=Ben(h5n,"PortLabelPlacement",273,Unt,c9,fB);wAn(61,22,{3:1,35:1,22:1,61:1},WC);var OIt,AIt,$It,LIt,NIt,xIt,DIt,RIt,KIt,_It,FIt=Ben(h5n,"PortSide",61,Unt,h5,wB);wAn(981,1,QYn,Df),MWn.Qe=function(n){RDn(n)},vX(h5n,"RandomLayouterOptions",981),wAn(982,1,{},Qu),MWn.$e=function(){return new no},MWn._e=function(n){},vX(h5n,"RandomLayouterOptions/RandomFactory",982),wAn(374,22,{3:1,35:1,22:1,374:1},VC);var BIt,HIt,qIt,GIt,zIt,UIt,XIt,WIt,VIt,QIt,YIt=Ben(h5n,"SizeConstraint",374,Unt,T3,lB);wAn(259,22,{3:1,35:1,22:1,259:1},QC);var JIt,ZIt,nOt,tOt,eOt,iOt=Ben(h5n,"SizeOptions",259,Unt,Ein,bB);wAn(370,1,{1949:1},Xm),MWn.b=!1,MWn.c=0,MWn.d=-1,MWn.e=null,MWn.f=null,MWn.g=-1,MWn.j=!1,MWn.k=!1,MWn.n=!1,MWn.o=0,MWn.q=0,MWn.r=0,vX(y3n,"BasicProgressMonitor",370),wAn(972,209,NJn,Gu),MWn.Ze=function(n,t){var e,i,r,c,a,u,o,s,h;OTn(t,"Box layout",2),r=zy(MD(ZAn(n,(SMn(),XMt)))),c=BB(ZAn(n,GMt),116),e=qy(TD(ZAn(n,_Mt))),i=qy(TD(ZAn(n,FMt))),0===BB(ZAn(n,RMt),311).g?(u=new t_((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a)),SQ(),m$(u,new Sg(i)),a=u,o=XPn(n),(null==(s=MD(ZAn(n,DMt)))||(kW(s),s<=0))&&(s=1.3),KUn(n,(h=HUn(a,r,c,o.a,o.b,e,(kW(s),s))).a,h.b,!1,!0)):kqn(n,r,c,e),HSn(t)},vX(y3n,"BoxLayoutProvider",972),wAn(973,1,MYn,Sg),MWn.ue=function(n,t){return hNn(this,BB(n,33),BB(t,33))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},MWn.a=!1,vX(y3n,"BoxLayoutProvider/1",973),wAn(157,1,{157:1},Gtn,zx),MWn.Ib=function(){return this.c?zRn(this.c):LMn(this.b)},vX(y3n,"BoxLayoutProvider/Group",157),wAn(311,22,{3:1,35:1,22:1,311:1},YC);var rOt,cOt=Ben(y3n,"BoxLayoutProvider/PackingMode",311,Unt,P3,dB);wAn(974,1,MYn,zu),MWn.ue=function(n,t){return DQ(BB(n,157),BB(t,157))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(y3n,"BoxLayoutProvider/lambda$0$Type",974),wAn(975,1,MYn,Uu),MWn.ue=function(n,t){return cQ(BB(n,157),BB(t,157))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(y3n,"BoxLayoutProvider/lambda$1$Type",975),wAn(976,1,MYn,Xu),MWn.ue=function(n,t){return aQ(BB(n,157),BB(t,157))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(y3n,"BoxLayoutProvider/lambda$2$Type",976),wAn(1365,1,{831:1},Wu),MWn.qg=function(n,t){return AM(),!cL(t,160)||SE((Nun(),BB(n,160)),t)},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$0$Type",1365),wAn(1366,1,lVn,Pg),MWn.td=function(n){Jsn(this.a,BB(n,146))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$1$Type",1366),wAn(1367,1,lVn,qu),MWn.td=function(n){BB(n,94),AM()},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$2$Type",1367),wAn(1371,1,lVn,Cg),MWn.td=function(n){Orn(this.a,BB(n,94))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$3$Type",1371),wAn(1369,1,DVn,JC),MWn.Mb=function(n){return Von(this.a,this.b,BB(n,146))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$4$Type",1369),wAn(1368,1,DVn,ZC),MWn.Mb=function(n){return $x(this.a,this.b,BB(n,831))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$5$Type",1368),wAn(1370,1,lVn,nI),MWn.td=function(n){Fz(this.a,this.b,BB(n,146))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$6$Type",1370),wAn(935,1,{},Bu),MWn.Kb=function(n){return yA(n)},MWn.Fb=function(n){return this===n},vX(y3n,"ElkUtil/lambda$0$Type",935),wAn(936,1,lVn,tI),MWn.td=function(n){rOn(this.a,this.b,BB(n,79))},MWn.a=0,MWn.b=0,vX(y3n,"ElkUtil/lambda$1$Type",936),wAn(937,1,lVn,eI),MWn.td=function(n){Ey(this.a,this.b,BB(n,202))},MWn.a=0,MWn.b=0,vX(y3n,"ElkUtil/lambda$2$Type",937),wAn(938,1,lVn,iI),MWn.td=function(n){t$(this.a,this.b,BB(n,137))},MWn.a=0,MWn.b=0,vX(y3n,"ElkUtil/lambda$3$Type",938),wAn(939,1,lVn,Ig),MWn.td=function(n){cq(this.a,BB(n,469))},vX(y3n,"ElkUtil/lambda$4$Type",939),wAn(342,1,{35:1,342:1},$p),MWn.wd=function(n){return vL(this,BB(n,236))},MWn.Fb=function(n){var t;return!!cL(n,342)&&(t=BB(n,342),this.a==t.a)},MWn.Hb=function(){return CJ(this.a)},MWn.Ib=function(){return this.a+" (exclusive)"},MWn.a=0,vX(y3n,"ExclusiveBounds/ExclusiveLowerBound",342),wAn(1138,209,NJn,Hu),MWn.Ze=function(n,t){var i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T;for(OTn(t,"Fixed Layout",1),a=BB(ZAn(n,(sWn(),vSt)),218),b=0,w=0,v=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));v.e!=v.i.gc();){for(g=BB(kpn(v),33),(T=BB(ZAn(g,(Xsn(),gCt)),8))&&(SA(g,T.a,T.b),BB(ZAn(g,fCt),174).Hc((mdn(),DIt))&&(d=BB(ZAn(g,bCt),8)).a>0&&d.b>0&&KUn(g,d.a,d.b,!0,!0)),b=e.Math.max(b,g.i+g.g),w=e.Math.max(w,g.j+g.f),f=new AL((!g.n&&(g.n=new eU(zOt,g,1,7)),g.n));f.e!=f.i.gc();)o=BB(kpn(f),137),(T=BB(ZAn(o,gCt),8))&&SA(o,T.a,T.b),b=e.Math.max(b,g.i+o.i+o.g),w=e.Math.max(w,g.j+o.j+o.f);for(k=new AL((!g.c&&(g.c=new eU(XOt,g,9,9)),g.c));k.e!=k.i.gc();)for(y=BB(kpn(k),118),(T=BB(ZAn(y,gCt),8))&&SA(y,T.a,T.b),j=g.i+y.i,E=g.j+y.j,b=e.Math.max(b,j+y.g),w=e.Math.max(w,E+y.f),s=new AL((!y.n&&(y.n=new eU(zOt,y,1,7)),y.n));s.e!=s.i.gc();)o=BB(kpn(s),137),(T=BB(ZAn(o,gCt),8))&&SA(o,T.a,T.b),b=e.Math.max(b,j+o.i+o.g),w=e.Math.max(w,E+o.j+o.f);for(c=new oz(ZL(dLn(g).a.Kc(),new h));dAn(c);)l=_Un(i=BB(U5(c),79)),b=e.Math.max(b,l.a),w=e.Math.max(w,l.b);for(r=new oz(ZL(wLn(g).a.Kc(),new h));dAn(r);)JJ(PMn(i=BB(U5(r),79)))!=n&&(l=_Un(i),b=e.Math.max(b,l.a),w=e.Math.max(w,l.b))}if(a==(Mbn(),QPt))for(p=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));p.e!=p.i.gc();)for(r=new oz(ZL(dLn(g=BB(kpn(p),33)).a.Kc(),new h));dAn(r);)0==(u=rFn(i=BB(U5(r),79))).b?Ypn(i,OSt,null):Ypn(i,OSt,u);qy(TD(ZAn(n,(Xsn(),lCt))))||KUn(n,b+(m=BB(ZAn(n,wCt),116)).b+m.c,w+m.d+m.a,!0,!0),HSn(t)},vX(y3n,"FixedLayoutProvider",1138),wAn(373,134,{3:1,414:1,373:1,94:1,134:1},Yu,rnn),MWn.Jf=function(n){var t,e,i,r,c,a,u;if(n)try{for(a=kKn(n,";,;"),r=0,c=(i=a).length;r>16&QVn|n^(e&QVn)<<16},MWn.Kc=function(){return new Og(this)},MWn.Ib=function(){return null==this.a&&null==this.b?"pair(null,null)":null==this.a?"pair(null,"+Bbn(this.b)+")":null==this.b?"pair("+Bbn(this.a)+",null)":"pair("+Bbn(this.a)+","+Bbn(this.b)+")"},vX(y3n,"Pair",46),wAn(983,1,QWn,Og),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return!this.c&&(!this.b&&null!=this.a.a||null!=this.a.b)},MWn.Pb=function(){if(!this.c&&!this.b&&null!=this.a.a)return this.b=!0,this.a.a;if(!this.c&&null!=this.a.b)return this.c=!0,this.a.b;throw Hp(new yv)},MWn.Qb=function(){throw this.c&&null!=this.a.b?this.a.b=null:this.b&&null!=this.a.a&&(this.a.a=null),Hp(new dv)},MWn.b=!1,MWn.c=!1,vX(y3n,"Pair/1",983),wAn(448,1,{448:1},VV),MWn.Fb=function(n){return cV(this.a,BB(n,448).a)&&cV(this.c,BB(n,448).c)&&cV(this.d,BB(n,448).d)&&cV(this.b,BB(n,448).b)},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[this.a,this.c,this.d,this.b]))},MWn.Ib=function(){return"("+this.a+FWn+this.c+FWn+this.d+FWn+this.b+")"},vX(y3n,"Quadruple",448),wAn(1126,209,NJn,no),MWn.Ze=function(n,t){var e;OTn(t,"Random Layout",1),0!=(!n.a&&(n.a=new eU(UOt,n,10,11)),n.a).i?(iUn(n,(e=BB(ZAn(n,(vdn(),NIt)),19))&&0!=e.a?new C4(e.a):new sbn,zy(MD(ZAn(n,AIt))),zy(MD(ZAn(n,xIt))),BB(ZAn(n,$It),116)),HSn(t)):HSn(t)},vX(y3n,"RandomLayoutProvider",1126),wAn(553,1,{}),MWn.qf=function(){return new xC(this.f.i,this.f.j)},MWn.We=function(n){return EY(n,(sWn(),aPt))?ZAn(this.f,bOt):ZAn(this.f,n)},MWn.rf=function(){return new xC(this.f.g,this.f.f)},MWn.sf=function(){return this.g},MWn.Xe=function(n){return P8(this.f,n)},MWn.tf=function(n){Pen(this.f,n.a),Cen(this.f,n.b)},MWn.uf=function(n){Sen(this.f,n.a),Men(this.f,n.b)},MWn.vf=function(n){this.g=n},MWn.g=0,vX(H5n,"ElkGraphAdapters/AbstractElkGraphElementAdapter",553),wAn(554,1,{839:1},Ag),MWn.wf=function(){var n,t;if(!this.b)for(this.b=C2(mV(this.a).i),t=new AL(mV(this.a));t.e!=t.i.gc();)n=BB(kpn(t),137),WB(this.b,new Ry(n));return this.b},MWn.b=null,vX(H5n,"ElkGraphAdapters/ElkEdgeAdapter",554),wAn(301,553,{},Dy),MWn.xf=function(){return eyn(this)},MWn.a=null,vX(H5n,"ElkGraphAdapters/ElkGraphAdapter",301),wAn(630,553,{181:1},Ry),vX(H5n,"ElkGraphAdapters/ElkLabelAdapter",630),wAn(629,553,{680:1},JN),MWn.wf=function(){return nyn(this)},MWn.Af=function(){var n;return!(n=BB(ZAn(this.f,(sWn(),$St)),142))&&(n=new lm),n},MWn.Cf=function(){return tyn(this)},MWn.Ef=function(n){var t;t=new A_(n),Ypn(this.f,(sWn(),$St),t)},MWn.Ff=function(n){Ypn(this.f,(sWn(),XSt),new O_(n))},MWn.yf=function(){return this.d},MWn.zf=function(){var n,t;if(!this.a)for(this.a=new Np,t=new oz(ZL(wLn(BB(this.f,33)).a.Kc(),new h));dAn(t);)n=BB(U5(t),79),WB(this.a,new Ag(n));return this.a},MWn.Bf=function(){var n,t;if(!this.c)for(this.c=new Np,t=new oz(ZL(dLn(BB(this.f,33)).a.Kc(),new h));dAn(t);)n=BB(U5(t),79),WB(this.c,new Ag(n));return this.c},MWn.Df=function(){return 0!=YQ(BB(this.f,33)).i||qy(TD(BB(this.f,33).We((sWn(),SSt))))},MWn.Gf=function(){_7(this,(GM(),lOt))},MWn.a=null,MWn.b=null,MWn.c=null,MWn.d=null,MWn.e=null,vX(H5n,"ElkGraphAdapters/ElkNodeAdapter",629),wAn(1266,553,{838:1},op),MWn.wf=function(){return kyn(this)},MWn.zf=function(){var n,t;if(!this.a)for(this.a=sx(BB(this.f,118).xg().i),t=new AL(BB(this.f,118).xg());t.e!=t.i.gc();)n=BB(kpn(t),79),WB(this.a,new Ag(n));return this.a},MWn.Bf=function(){var n,t;if(!this.c)for(this.c=sx(BB(this.f,118).yg().i),t=new AL(BB(this.f,118).yg());t.e!=t.i.gc();)n=BB(kpn(t),79),WB(this.c,new Ag(n));return this.c},MWn.Hf=function(){return BB(BB(this.f,118).We((sWn(),wPt)),61)},MWn.If=function(){var n,t,e,i,r,c,a;for(i=WJ(BB(this.f,118)),e=new AL(BB(this.f,118).yg());e.e!=e.i.gc();)for(a=new AL((!(n=BB(kpn(e),79)).c&&(n.c=new hK(KOt,n,5,8)),n.c));a.e!=a.i.gc();){if(Ctn(PTn(c=BB(kpn(a),82)),i))return!0;if(PTn(c)==i&&qy(TD(ZAn(n,(sWn(),PSt)))))return!0}for(t=new AL(BB(this.f,118).xg());t.e!=t.i.gc();)for(r=new AL((!(n=BB(kpn(t),79)).b&&(n.b=new hK(KOt,n,4,7)),n.b));r.e!=r.i.gc();)if(Ctn(PTn(BB(kpn(r),82)),i))return!0;return!1},MWn.a=null,MWn.b=null,MWn.c=null,vX(H5n,"ElkGraphAdapters/ElkPortAdapter",1266),wAn(1267,1,MYn,to),MWn.ue=function(n,t){return GRn(BB(n,118),BB(t,118))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(H5n,"ElkGraphAdapters/PortComparator",1267);var dOt,gOt,pOt,vOt,mOt,yOt,kOt,jOt,EOt,TOt,MOt,SOt,POt,COt,IOt,OOt,AOt,$Ot,LOt=bq(q5n,"EObject"),NOt=bq(G5n,z5n),xOt=bq(G5n,U5n),DOt=bq(G5n,X5n),ROt=bq(G5n,"ElkShape"),KOt=bq(G5n,W5n),_Ot=bq(G5n,V5n),FOt=bq(G5n,Q5n),BOt=bq(q5n,Y5n),HOt=bq(q5n,"EFactory"),qOt=bq(q5n,J5n),GOt=bq(q5n,"EPackage"),zOt=bq(G5n,Z5n),UOt=bq(G5n,n6n),XOt=bq(G5n,t6n);wAn(90,1,e6n),MWn.Jg=function(){return this.Kg(),null},MWn.Kg=function(){return null},MWn.Lg=function(){return this.Kg(),!1},MWn.Mg=function(){return!1},MWn.Ng=function(n){ban(this,n)},vX(i6n,"BasicNotifierImpl",90),wAn(97,90,f6n),MWn.nh=function(){return mA(this)},MWn.Og=function(n,t){return n},MWn.Pg=function(){throw Hp(new pv)},MWn.Qg=function(n){var t;return t=Cvn(BB(itn(this.Tg(),this.Vg()),18)),this.eh().ih(this,t.n,t.f,n)},MWn.Rg=function(n,t){throw Hp(new pv)},MWn.Sg=function(n,t,e){return T_n(this,n,t,e)},MWn.Tg=function(){var n;return this.Pg()&&(n=this.Pg().ck())?n:this.zh()},MWn.Ug=function(){return cAn(this)},MWn.Vg=function(){throw Hp(new pv)},MWn.Wg=function(){var n,t;return!(t=this.ph().dk())&&this.Pg().ik((QM(),t=null==(n=lJ(qFn(this.Tg())))?N$t:new QN(this,n))),t},MWn.Xg=function(n,t){return n},MWn.Yg=function(n){return n.Gj()?n.aj():Awn(this.Tg(),n)},MWn.Zg=function(){var n;return(n=this.Pg())?n.fk():null},MWn.$g=function(){return this.Pg()?this.Pg().ck():null},MWn._g=function(n,t,e){return Zpn(this,n,t,e)},MWn.ah=function(n){return S9(this,n)},MWn.bh=function(n,t){return V5(this,n,t)},MWn.dh=function(){var n;return!!(n=this.Pg())&&n.gk()},MWn.eh=function(){throw Hp(new pv)},MWn.fh=function(){return Ydn(this)},MWn.gh=function(n,t,e,i){return Npn(this,n,t,i)},MWn.hh=function(n,t,e){return BB(itn(this.Tg(),t),66).Nj().Qj(this,this.yh(),t-this.Ah(),n,e)},MWn.ih=function(n,t,e,i){return oJ(this,n,t,i)},MWn.jh=function(n,t,e){return BB(itn(this.Tg(),t),66).Nj().Rj(this,this.yh(),t-this.Ah(),n,e)},MWn.kh=function(){return!!this.Pg()&&!!this.Pg().ek()},MWn.lh=function(n){return vpn(this,n)},MWn.mh=function(n){return ZJ(this,n)},MWn.oh=function(n){return _qn(this,n)},MWn.ph=function(){throw Hp(new pv)},MWn.qh=function(){return this.Pg()?this.Pg().ek():null},MWn.rh=function(){return Ydn(this)},MWn.sh=function(n,t){yCn(this,n,t)},MWn.th=function(n){this.ph().hk(n)},MWn.uh=function(n){this.ph().kk(n)},MWn.vh=function(n){this.ph().jk(n)},MWn.wh=function(n,t){var e,i,r,c;return(c=this.Zg())&&n&&(t=_pn(c.Vk(),this,t),c.Zk(this)),(i=this.eh())&&(0!=(gKn(this,this.eh(),this.Vg()).Bb&BQn)?(r=i.fh())&&(n?!c&&r.Zk(this):r.Yk(this)):(t=(e=this.Vg())>=0?this.Qg(t):this.eh().ih(this,-1-e,null,t),t=this.Sg(null,-1,t))),this.uh(n),t},MWn.xh=function(n){var t,e,i,r,c,a,u;if((c=Awn(e=this.Tg(),n))>=(t=this.Ah()))return BB(n,66).Nj().Uj(this,this.yh(),c-t);if(c<=-1){if(!(a=Fqn((IPn(),Z$t),e,n)))throw Hp(new _y(r6n+n.ne()+u6n));if(ZM(),BB(a,66).Oj()||(a=Z1(B7(Z$t,a))),r=BB((i=this.Yg(a))>=0?this._g(i,!0,!0):cOn(this,a,!0),153),(u=a.Zj())>1||-1==u)return BB(BB(r,215).hl(n,!1),76)}else if(n.$j())return BB((i=this.Yg(n))>=0?this._g(i,!1,!0):cOn(this,n,!1),76);return new II(this,n)},MWn.yh=function(){return Q7(this)},MWn.zh=function(){return(QX(),t$t).S},MWn.Ah=function(){return bX(this.zh())},MWn.Bh=function(n){mPn(this,n)},MWn.Ib=function(){return P$n(this)},vX(l6n,"BasicEObjectImpl",97),wAn(114,97,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1}),MWn.Ch=function(n){return Y7(this)[n]},MWn.Dh=function(n,t){$X(Y7(this),n,t)},MWn.Eh=function(n){$X(Y7(this),n,null)},MWn.Jg=function(){return BB(yan(this,4),126)},MWn.Kg=function(){throw Hp(new pv)},MWn.Lg=function(){return 0!=(4&this.Db)},MWn.Pg=function(){throw Hp(new pv)},MWn.Fh=function(n){hgn(this,2,n)},MWn.Rg=function(n,t){this.Db=t<<16|255&this.Db,this.Fh(n)},MWn.Tg=function(){return jY(this)},MWn.Vg=function(){return this.Db>>16},MWn.Wg=function(){var n;return QM(),null==(n=lJ(qFn(BB(yan(this,16),26)||this.zh())))?N$t:new QN(this,n)},MWn.Mg=function(){return 0==(1&this.Db)},MWn.Zg=function(){return BB(yan(this,128),1935)},MWn.$g=function(){return BB(yan(this,16),26)},MWn.dh=function(){return 0!=(32&this.Db)},MWn.eh=function(){return BB(yan(this,2),49)},MWn.kh=function(){return 0!=(64&this.Db)},MWn.ph=function(){throw Hp(new pv)},MWn.qh=function(){return BB(yan(this,64),281)},MWn.th=function(n){hgn(this,16,n)},MWn.uh=function(n){hgn(this,128,n)},MWn.vh=function(n){hgn(this,64,n)},MWn.yh=function(){return fgn(this)},MWn.Db=0,vX(l6n,"MinimalEObjectImpl",114),wAn(115,114,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn.Fh=function(n){this.Cb=n},MWn.eh=function(){return this.Cb},vX(l6n,"MinimalEObjectImpl/Container",115),wAn(1985,115,{105:1,413:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return Eyn(this,n,t,e)},MWn.jh=function(n,t,e){return eSn(this,n,t,e)},MWn.lh=function(n){return m0(this,n)},MWn.sh=function(n,t){rsn(this,n,t)},MWn.zh=function(){return CXn(),POt},MWn.Bh=function(n){zun(this,n)},MWn.Ve=function(){return lpn(this)},MWn.We=function(n){return ZAn(this,n)},MWn.Xe=function(n){return P8(this,n)},MWn.Ye=function(n,t){return Ypn(this,n,t)},vX(b6n,"EMapPropertyHolderImpl",1985),wAn(567,115,{105:1,469:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},ro),MWn._g=function(n,t,e){switch(n){case 0:return this.a;case 1:return this.b}return Zpn(this,n,t,e)},MWn.lh=function(n){switch(n){case 0:return 0!=this.a;case 1:return 0!=this.b}return vpn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return void jen(this,Gy(MD(t)));case 1:return void Een(this,Gy(MD(t)))}yCn(this,n,t)},MWn.zh=function(){return CXn(),pOt},MWn.Bh=function(n){switch(n){case 0:return void jen(this,0);case 1:return void Een(this,0)}mPn(this,n)},MWn.Ib=function(){var n;return 0!=(64&this.Db)?P$n(this):((n=new fN(P$n(this))).a+=" (x: ",vE(n,this.a),n.a+=", y: ",vE(n,this.b),n.a+=")",n.a)},MWn.a=0,MWn.b=0,vX(b6n,"ElkBendPointImpl",567),wAn(723,1985,{105:1,413:1,160:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return _fn(this,n,t,e)},MWn.hh=function(n,t,e){return FTn(this,n,t,e)},MWn.jh=function(n,t,e){return run(this,n,t,e)},MWn.lh=function(n){return Ean(this,n)},MWn.sh=function(n,t){Gjn(this,n,t)},MWn.zh=function(){return CXn(),kOt},MWn.Bh=function(n){ofn(this,n)},MWn.zg=function(){return this.k},MWn.Ag=function(){return mV(this)},MWn.Ib=function(){return Yln(this)},MWn.k=null,vX(b6n,"ElkGraphElementImpl",723),wAn(724,723,{105:1,413:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return Rbn(this,n,t,e)},MWn.lh=function(n){return fwn(this,n)},MWn.sh=function(n,t){zjn(this,n,t)},MWn.zh=function(){return CXn(),SOt},MWn.Bh=function(n){Dwn(this,n)},MWn.Bg=function(){return this.f},MWn.Cg=function(){return this.g},MWn.Dg=function(){return this.i},MWn.Eg=function(){return this.j},MWn.Fg=function(n,t){MA(this,n,t)},MWn.Gg=function(n,t){SA(this,n,t)},MWn.Hg=function(n){Pen(this,n)},MWn.Ig=function(n){Cen(this,n)},MWn.Ib=function(){return mSn(this)},MWn.f=0,MWn.g=0,MWn.i=0,MWn.j=0,vX(b6n,"ElkShapeImpl",724),wAn(725,724,{105:1,413:1,82:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return Hvn(this,n,t,e)},MWn.hh=function(n,t,e){return djn(this,n,t,e)},MWn.jh=function(n,t,e){return gjn(this,n,t,e)},MWn.lh=function(n){return Gon(this,n)},MWn.sh=function(n,t){LAn(this,n,t)},MWn.zh=function(){return CXn(),vOt},MWn.Bh=function(n){xpn(this,n)},MWn.xg=function(){return!this.d&&(this.d=new hK(_Ot,this,8,5)),this.d},MWn.yg=function(){return!this.e&&(this.e=new hK(_Ot,this,7,4)),this.e},vX(b6n,"ElkConnectableShapeImpl",725),wAn(352,723,{105:1,413:1,79:1,160:1,352:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},io),MWn.Qg=function(n){return Mkn(this,n)},MWn._g=function(n,t,e){switch(n){case 3:return XJ(this);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),this.b;case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),this.c;case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),this.a;case 7:return hN(),!this.b&&(this.b=new hK(KOt,this,4,7)),!(this.b.i<=1&&(!this.c&&(this.c=new hK(KOt,this,5,8)),this.c.i<=1));case 8:return hN(),!!nAn(this);case 9:return hN(),!!QIn(this);case 10:return hN(),!this.b&&(this.b=new hK(KOt,this,4,7)),0!=this.b.i&&(!this.c&&(this.c=new hK(KOt,this,5,8)),0!=this.c.i)}return _fn(this,n,t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 3:return this.Cb&&(e=(i=this.Db>>16)>=0?Mkn(this,e):this.Cb.ih(this,-1-i,null,e)),VD(this,BB(n,33),e);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),Ywn(this.b,n,e);case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),Ywn(this.c,n,e);case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),Ywn(this.a,n,e)}return FTn(this,n,t,e)},MWn.jh=function(n,t,e){switch(t){case 3:return VD(this,null,e);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),_pn(this.b,n,e);case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),_pn(this.c,n,e);case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),_pn(this.a,n,e)}return run(this,n,t,e)},MWn.lh=function(n){switch(n){case 3:return!!XJ(this);case 4:return!!this.b&&0!=this.b.i;case 5:return!!this.c&&0!=this.c.i;case 6:return!!this.a&&0!=this.a.i;case 7:return!this.b&&(this.b=new hK(KOt,this,4,7)),!(this.b.i<=1&&(!this.c&&(this.c=new hK(KOt,this,5,8)),this.c.i<=1));case 8:return nAn(this);case 9:return QIn(this);case 10:return!this.b&&(this.b=new hK(KOt,this,4,7)),0!=this.b.i&&(!this.c&&(this.c=new hK(KOt,this,5,8)),0!=this.c.i)}return Ean(this,n)},MWn.sh=function(n,t){switch(n){case 3:return void HLn(this,BB(t,33));case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),sqn(this.b),!this.b&&(this.b=new hK(KOt,this,4,7)),void pX(this.b,BB(t,14));case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),sqn(this.c),!this.c&&(this.c=new hK(KOt,this,5,8)),void pX(this.c,BB(t,14));case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),sqn(this.a),!this.a&&(this.a=new eU(FOt,this,6,6)),void pX(this.a,BB(t,14))}Gjn(this,n,t)},MWn.zh=function(){return CXn(),mOt},MWn.Bh=function(n){switch(n){case 3:return void HLn(this,null);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),void sqn(this.b);case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),void sqn(this.c);case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),void sqn(this.a)}ofn(this,n)},MWn.Ib=function(){return lHn(this)},vX(b6n,"ElkEdgeImpl",352),wAn(439,1985,{105:1,413:1,202:1,439:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},co),MWn.Qg=function(n){return skn(this,n)},MWn._g=function(n,t,e){switch(n){case 1:return this.j;case 2:return this.k;case 3:return this.b;case 4:return this.c;case 5:return!this.a&&(this.a=new $L(xOt,this,5)),this.a;case 6:return VJ(this);case 7:return t?Pvn(this):this.i;case 8:return t?Svn(this):this.f;case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),this.g;case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),this.e;case 11:return this.d}return Eyn(this,n,t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 6:return this.Cb&&(e=(i=this.Db>>16)>=0?skn(this,e):this.Cb.ih(this,-1-i,null,e)),QD(this,BB(n,79),e);case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),Ywn(this.g,n,e);case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),Ywn(this.e,n,e)}return BB(itn(BB(yan(this,16),26)||(CXn(),yOt),t),66).Nj().Qj(this,fgn(this),t-bX((CXn(),yOt)),n,e)},MWn.jh=function(n,t,e){switch(t){case 5:return!this.a&&(this.a=new $L(xOt,this,5)),_pn(this.a,n,e);case 6:return QD(this,null,e);case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),_pn(this.g,n,e);case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),_pn(this.e,n,e)}return eSn(this,n,t,e)},MWn.lh=function(n){switch(n){case 1:return 0!=this.j;case 2:return 0!=this.k;case 3:return 0!=this.b;case 4:return 0!=this.c;case 5:return!!this.a&&0!=this.a.i;case 6:return!!VJ(this);case 7:return!!this.i;case 8:return!!this.f;case 9:return!!this.g&&0!=this.g.i;case 10:return!!this.e&&0!=this.e.i;case 11:return null!=this.d}return m0(this,n)},MWn.sh=function(n,t){switch(n){case 1:return void Ien(this,Gy(MD(t)));case 2:return void Aen(this,Gy(MD(t)));case 3:return void Ten(this,Gy(MD(t)));case 4:return void Oen(this,Gy(MD(t)));case 5:return!this.a&&(this.a=new $L(xOt,this,5)),sqn(this.a),!this.a&&(this.a=new $L(xOt,this,5)),void pX(this.a,BB(t,14));case 6:return void FLn(this,BB(t,79));case 7:return void Nin(this,BB(t,82));case 8:return void Lin(this,BB(t,82));case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),sqn(this.g),!this.g&&(this.g=new hK(FOt,this,9,10)),void pX(this.g,BB(t,14));case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),sqn(this.e),!this.e&&(this.e=new hK(FOt,this,10,9)),void pX(this.e,BB(t,14));case 11:return void crn(this,SD(t))}rsn(this,n,t)},MWn.zh=function(){return CXn(),yOt},MWn.Bh=function(n){switch(n){case 1:return void Ien(this,0);case 2:return void Aen(this,0);case 3:return void Ten(this,0);case 4:return void Oen(this,0);case 5:return!this.a&&(this.a=new $L(xOt,this,5)),void sqn(this.a);case 6:return void FLn(this,null);case 7:return void Nin(this,null);case 8:return void Lin(this,null);case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),void sqn(this.g);case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),void sqn(this.e);case 11:return void crn(this,null)}zun(this,n)},MWn.Ib=function(){return ROn(this)},MWn.b=0,MWn.c=0,MWn.d=null,MWn.j=0,MWn.k=0,vX(b6n,"ElkEdgeSectionImpl",439),wAn(150,115,{105:1,92:1,90:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1}),MWn._g=function(n,t,e){return 0==n?(!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab):U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.hh=function(n,t,e){return 0==t?(!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e)):BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Qj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.jh=function(n,t,e){return 0==t?(!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e)):BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){return 0==n?!!this.Ab&&0!=this.Ab.i:O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.oh=function(n){return hUn(this,n)},MWn.sh=function(n,t){if(0===n)return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.uh=function(n){hgn(this,128,n)},MWn.zh=function(){return gWn(),b$t},MWn.Bh=function(n){if(0===n)return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.Gh=function(){this.Bb|=1},MWn.Hh=function(n){return N_n(this,n)},MWn.Bb=0,vX(l6n,"EModelElementImpl",150),wAn(704,150,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},Rf),MWn.Ih=function(n,t){return qGn(this,n,t)},MWn.Jh=function(n){var t,e,i,r;if(this.a!=Utn(n)||0!=(256&n.Bb))throw Hp(new _y(m6n+n.zb+g6n));for(e=kY(n);0!=a4(e.a).i;){if(iyn(t=BB(eGn(e,0,cL(r=BB(Wtn(a4(e.a),0),87).c,88)?BB(r,26):(gWn(),d$t)),26)))return BB(i=Utn(t).Nh().Jh(t),49).th(n),i;e=kY(t)}return"java.util.Map$Entry"==(null!=n.D?n.D:n.B)?new fq(n):new jH(n)},MWn.Kh=function(n,t){return xXn(this,n,t)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.a}return U9(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n),t,e)},MWn.hh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 1:return this.a&&(e=BB(this.a,49).ih(this,4,GOt,e)),Jhn(this,BB(n,235),e)}return BB(itn(BB(yan(this,16),26)||(gWn(),h$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),h$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 1:return Jhn(this,null,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),h$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),h$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return!!this.a}return O3(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void xMn(this,BB(t,235))}Lbn(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n),t)},MWn.zh=function(){return gWn(),h$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void xMn(this,null)}qfn(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n))},vX(l6n,"EFactoryImpl",704),wAn(k6n,704,{105:1,2014:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},ao),MWn.Ih=function(n,t){switch(n.yj()){case 12:return BB(t,146).tg();case 13:return Bbn(t);default:throw Hp(new _y(d6n+n.ne()+g6n))}},MWn.Jh=function(n){var t;switch(-1==n.G&&(n.G=(t=Utn(n))?uvn(t.Mh(),n):-1),n.G){case 4:return new uo;case 6:return new jm;case 7:return new Em;case 8:return new io;case 9:return new ro;case 10:return new co;case 11:return new so;default:throw Hp(new _y(m6n+n.zb+g6n))}},MWn.Kh=function(n,t){switch(n.yj()){case 13:case 12:return null;default:throw Hp(new _y(d6n+n.ne()+g6n))}},vX(b6n,"ElkGraphFactoryImpl",k6n),wAn(438,150,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1}),MWn.Wg=function(){var n;return null==(n=lJ(qFn(BB(yan(this,16),26)||this.zh())))?(QM(),QM(),N$t):new Wx(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.ne()}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void this.Lh(SD(t))}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),w$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void this.Lh(null)}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.ne=function(){return this.zb},MWn.Lh=function(n){Nrn(this,n)},MWn.Ib=function(){return kfn(this)},MWn.zb=null,vX(l6n,"ENamedElementImpl",438),wAn(179,438,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},vY),MWn.Qg=function(n){return wkn(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.yb;case 3:return this.xb;case 4:return this.sb;case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),this.rb;case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),this.vb;case 7:return t?this.Db>>16==7?BB(this.Cb,235):null:QJ(this)}return U9(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 4:return this.sb&&(e=BB(this.sb,49).ih(this,1,HOt,e)),jfn(this,BB(n,471),e);case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),Ywn(this.rb,n,e);case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),Ywn(this.vb,n,e);case 7:return this.Cb&&(e=(i=this.Db>>16)>=0?wkn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,7,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),v$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),v$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 4:return jfn(this,null,e);case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),_pn(this.rb,n,e);case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),_pn(this.vb,n,e);case 7:return T_n(this,null,7,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),v$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),v$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.yb;case 3:return null!=this.xb;case 4:return!!this.sb;case 5:return!!this.rb&&0!=this.rb.i;case 6:return!!this.vb&&0!=this.vb.i;case 7:return!!QJ(this)}return O3(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n))},MWn.oh=function(n){return LNn(this,n)||hUn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return void Drn(this,SD(t));case 3:return void xrn(this,SD(t));case 4:return void iSn(this,BB(t,471));case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),sqn(this.rb),!this.rb&&(this.rb=new Jz(this,HAt,this)),void pX(this.rb,BB(t,14));case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),sqn(this.vb),!this.vb&&(this.vb=new eK(GOt,this,6,7)),void pX(this.vb,BB(t,14))}Lbn(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n),t)},MWn.vh=function(n){var t,e;if(n&&this.rb)for(e=new AL(this.rb);e.e!=e.i.gc();)cL(t=kpn(e),351)&&(BB(t,351).w=null);hgn(this,64,n)},MWn.zh=function(){return gWn(),v$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return void Drn(this,null);case 3:return void xrn(this,null);case 4:return void iSn(this,null);case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),void sqn(this.rb);case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),void sqn(this.vb)}qfn(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n))},MWn.Gh=function(){Tyn(this)},MWn.Mh=function(){return!this.rb&&(this.rb=new Jz(this,HAt,this)),this.rb},MWn.Nh=function(){return this.sb},MWn.Oh=function(){return this.ub},MWn.Ph=function(){return this.xb},MWn.Qh=function(){return this.yb},MWn.Rh=function(n){this.ub=n},MWn.Ib=function(){var n;return 0!=(64&this.Db)?kfn(this):((n=new fN(kfn(this))).a+=" (nsURI: ",cO(n,this.yb),n.a+=", nsPrefix: ",cO(n,this.xb),n.a+=")",n.a)},MWn.xb=null,MWn.yb=null,vX(l6n,"EPackageImpl",179),wAn(555,179,{105:1,2016:1,555:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},sAn),MWn.q=!1,MWn.r=!1;var WOt=!1;vX(b6n,"ElkGraphPackageImpl",555),wAn(354,724,{105:1,413:1,160:1,137:1,470:1,354:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},uo),MWn.Qg=function(n){return hkn(this,n)},MWn._g=function(n,t,e){switch(n){case 7:return YJ(this);case 8:return this.a}return Rbn(this,n,t,e)},MWn.hh=function(n,t,e){var i;return 7===t?(this.Cb&&(e=(i=this.Db>>16)>=0?hkn(this,e):this.Cb.ih(this,-1-i,null,e)),VG(this,BB(n,160),e)):FTn(this,n,t,e)},MWn.jh=function(n,t,e){return 7==t?VG(this,null,e):run(this,n,t,e)},MWn.lh=function(n){switch(n){case 7:return!!YJ(this);case 8:return!mK("",this.a)}return fwn(this,n)},MWn.sh=function(n,t){switch(n){case 7:return void INn(this,BB(t,160));case 8:return void xin(this,SD(t))}zjn(this,n,t)},MWn.zh=function(){return CXn(),jOt},MWn.Bh=function(n){switch(n){case 7:return void INn(this,null);case 8:return void xin(this,"")}Dwn(this,n)},MWn.Ib=function(){return cPn(this)},MWn.a="",vX(b6n,"ElkLabelImpl",354),wAn(239,725,{105:1,413:1,82:1,160:1,33:1,470:1,239:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},jm),MWn.Qg=function(n){return Skn(this,n)},MWn._g=function(n,t,e){switch(n){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),this.c;case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),this.a;case 11:return JJ(this);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),this.b;case 13:return hN(),!this.a&&(this.a=new eU(UOt,this,10,11)),this.a.i>0}return Hvn(this,n,t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),Ywn(this.c,n,e);case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),Ywn(this.a,n,e);case 11:return this.Cb&&(e=(i=this.Db>>16)>=0?Skn(this,e):this.Cb.ih(this,-1-i,null,e)),zR(this,BB(n,33),e);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),Ywn(this.b,n,e)}return djn(this,n,t,e)},MWn.jh=function(n,t,e){switch(t){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),_pn(this.c,n,e);case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),_pn(this.a,n,e);case 11:return zR(this,null,e);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),_pn(this.b,n,e)}return gjn(this,n,t,e)},MWn.lh=function(n){switch(n){case 9:return!!this.c&&0!=this.c.i;case 10:return!!this.a&&0!=this.a.i;case 11:return!!JJ(this);case 12:return!!this.b&&0!=this.b.i;case 13:return!this.a&&(this.a=new eU(UOt,this,10,11)),this.a.i>0}return Gon(this,n)},MWn.sh=function(n,t){switch(n){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),sqn(this.c),!this.c&&(this.c=new eU(XOt,this,9,9)),void pX(this.c,BB(t,14));case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),sqn(this.a),!this.a&&(this.a=new eU(UOt,this,10,11)),void pX(this.a,BB(t,14));case 11:return void nNn(this,BB(t,33));case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),sqn(this.b),!this.b&&(this.b=new eU(_Ot,this,12,3)),void pX(this.b,BB(t,14))}LAn(this,n,t)},MWn.zh=function(){return CXn(),EOt},MWn.Bh=function(n){switch(n){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),void sqn(this.c);case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),void sqn(this.a);case 11:return void nNn(this,null);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),void sqn(this.b)}xpn(this,n)},MWn.Ib=function(){return zRn(this)},vX(b6n,"ElkNodeImpl",239),wAn(186,725,{105:1,413:1,82:1,160:1,118:1,470:1,186:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},Em),MWn.Qg=function(n){return fkn(this,n)},MWn._g=function(n,t,e){return 9==n?WJ(this):Hvn(this,n,t,e)},MWn.hh=function(n,t,e){var i;return 9===t?(this.Cb&&(e=(i=this.Db>>16)>=0?fkn(this,e):this.Cb.ih(this,-1-i,null,e)),YD(this,BB(n,33),e)):djn(this,n,t,e)},MWn.jh=function(n,t,e){return 9==t?YD(this,null,e):gjn(this,n,t,e)},MWn.lh=function(n){return 9==n?!!WJ(this):Gon(this,n)},MWn.sh=function(n,t){9!==n?LAn(this,n,t):BLn(this,BB(t,33))},MWn.zh=function(){return CXn(),TOt},MWn.Bh=function(n){9!==n?xpn(this,n):BLn(this,null)},MWn.Ib=function(){return URn(this)},vX(b6n,"ElkPortImpl",186);var VOt=bq(B6n,"BasicEMap/Entry");wAn(1092,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,114:1,115:1},so),MWn.Fb=function(n){return this===n},MWn.cd=function(){return this.b},MWn.Hb=function(){return PN(this)},MWn.Uh=function(n){Din(this,BB(n,146))},MWn._g=function(n,t,e){switch(n){case 0:return this.b;case 1:return this.c}return Zpn(this,n,t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.b;case 1:return null!=this.c}return vpn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return void Din(this,BB(t,146));case 1:return void _in(this,t)}yCn(this,n,t)},MWn.zh=function(){return CXn(),MOt},MWn.Bh=function(n){switch(n){case 0:return void Din(this,null);case 1:return void _in(this,null)}mPn(this,n)},MWn.Sh=function(){var n;return-1==this.a&&(n=this.b,this.a=n?nsn(n):0),this.a},MWn.dd=function(){return this.c},MWn.Th=function(n){this.a=n},MWn.ed=function(n){var t;return t=this.c,_in(this,n),t},MWn.Ib=function(){var n;return 0!=(64&this.Db)?P$n(this):(oO(oO(oO(n=new Ck,this.b?this.b.tg():zWn),e1n),kN(this.c)),n.a)},MWn.a=-1,MWn.c=null;var QOt,YOt,JOt,ZOt,nAt,tAt,eAt,iAt,rAt=vX(b6n,"ElkPropertyToValueMapEntryImpl",1092);wAn(984,1,{},lo),vX(G6n,"JsonAdapter",984),wAn(210,60,BVn,ek),vX(G6n,"JsonImportException",210),wAn(857,1,{},dkn),vX(G6n,"JsonImporter",857),wAn(891,1,{},aI),vX(G6n,"JsonImporter/lambda$0$Type",891),wAn(892,1,{},uI),vX(G6n,"JsonImporter/lambda$1$Type",892),wAn(900,1,{},$g),vX(G6n,"JsonImporter/lambda$10$Type",900),wAn(902,1,{},oI),vX(G6n,"JsonImporter/lambda$11$Type",902),wAn(903,1,{},sI),vX(G6n,"JsonImporter/lambda$12$Type",903),wAn(909,1,{},fQ),vX(G6n,"JsonImporter/lambda$13$Type",909),wAn(908,1,{},hQ),vX(G6n,"JsonImporter/lambda$14$Type",908),wAn(904,1,{},hI),vX(G6n,"JsonImporter/lambda$15$Type",904),wAn(905,1,{},fI),vX(G6n,"JsonImporter/lambda$16$Type",905),wAn(906,1,{},lI),vX(G6n,"JsonImporter/lambda$17$Type",906),wAn(907,1,{},bI),vX(G6n,"JsonImporter/lambda$18$Type",907),wAn(912,1,{},Lg),vX(G6n,"JsonImporter/lambda$19$Type",912),wAn(893,1,{},Ng),vX(G6n,"JsonImporter/lambda$2$Type",893),wAn(910,1,{},xg),vX(G6n,"JsonImporter/lambda$20$Type",910),wAn(911,1,{},Dg),vX(G6n,"JsonImporter/lambda$21$Type",911),wAn(915,1,{},Rg),vX(G6n,"JsonImporter/lambda$22$Type",915),wAn(913,1,{},Kg),vX(G6n,"JsonImporter/lambda$23$Type",913),wAn(914,1,{},_g),vX(G6n,"JsonImporter/lambda$24$Type",914),wAn(917,1,{},Fg),vX(G6n,"JsonImporter/lambda$25$Type",917),wAn(916,1,{},Bg),vX(G6n,"JsonImporter/lambda$26$Type",916),wAn(918,1,lVn,wI),MWn.td=function(n){E9(this.b,this.a,SD(n))},vX(G6n,"JsonImporter/lambda$27$Type",918),wAn(919,1,lVn,dI),MWn.td=function(n){T9(this.b,this.a,SD(n))},vX(G6n,"JsonImporter/lambda$28$Type",919),wAn(920,1,{},gI),vX(G6n,"JsonImporter/lambda$29$Type",920),wAn(896,1,{},Hg),vX(G6n,"JsonImporter/lambda$3$Type",896),wAn(921,1,{},pI),vX(G6n,"JsonImporter/lambda$30$Type",921),wAn(922,1,{},qg),vX(G6n,"JsonImporter/lambda$31$Type",922),wAn(923,1,{},Gg),vX(G6n,"JsonImporter/lambda$32$Type",923),wAn(924,1,{},zg),vX(G6n,"JsonImporter/lambda$33$Type",924),wAn(925,1,{},Ug),vX(G6n,"JsonImporter/lambda$34$Type",925),wAn(859,1,{},Xg),vX(G6n,"JsonImporter/lambda$35$Type",859),wAn(929,1,{},MB),vX(G6n,"JsonImporter/lambda$36$Type",929),wAn(926,1,lVn,Wg),MWn.td=function(n){Y4(this.a,BB(n,469))},vX(G6n,"JsonImporter/lambda$37$Type",926),wAn(927,1,lVn,SI),MWn.td=function(n){lO(this.a,this.b,BB(n,202))},vX(G6n,"JsonImporter/lambda$38$Type",927),wAn(928,1,lVn,PI),MWn.td=function(n){bO(this.a,this.b,BB(n,202))},vX(G6n,"JsonImporter/lambda$39$Type",928),wAn(894,1,{},Vg),vX(G6n,"JsonImporter/lambda$4$Type",894),wAn(930,1,lVn,Qg),MWn.td=function(n){J4(this.a,BB(n,8))},vX(G6n,"JsonImporter/lambda$40$Type",930),wAn(895,1,{},Yg),vX(G6n,"JsonImporter/lambda$5$Type",895),wAn(899,1,{},Jg),vX(G6n,"JsonImporter/lambda$6$Type",899),wAn(897,1,{},Zg),vX(G6n,"JsonImporter/lambda$7$Type",897),wAn(898,1,{},np),vX(G6n,"JsonImporter/lambda$8$Type",898),wAn(901,1,{},tp),vX(G6n,"JsonImporter/lambda$9$Type",901),wAn(948,1,lVn,ep),MWn.td=function(n){nW(this.a,new GX(SD(n)))},vX(G6n,"JsonMetaDataConverter/lambda$0$Type",948),wAn(949,1,lVn,ip),MWn.td=function(n){_X(this.a,BB(n,237))},vX(G6n,"JsonMetaDataConverter/lambda$1$Type",949),wAn(950,1,lVn,rp),MWn.td=function(n){t1(this.a,BB(n,149))},vX(G6n,"JsonMetaDataConverter/lambda$2$Type",950),wAn(951,1,lVn,cp),MWn.td=function(n){FX(this.a,BB(n,175))},vX(G6n,"JsonMetaDataConverter/lambda$3$Type",951),wAn(237,22,{3:1,35:1,22:1,237:1},MI);var cAt,aAt=Ben(IJn,"GraphFeature",237,Unt,Ktn,pB);wAn(13,1,{35:1,146:1},up,iR,$O,XA),MWn.wd=function(n){return pL(this,BB(n,146))},MWn.Fb=function(n){return EY(this,n)},MWn.wg=function(){return mpn(this)},MWn.tg=function(){return this.b},MWn.Hb=function(){return vvn(this.b)},MWn.Ib=function(){return this.b},vX(IJn,"Property",13),wAn(818,1,MYn,ap),MWn.ue=function(n,t){return _ln(this,BB(n,94),BB(t,94))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(IJn,"PropertyHolderComparator",818),wAn(695,1,QWn,sp),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return A9(this)},MWn.Qb=function(){uE()},MWn.Ob=function(){return!!this.a},vX(c8n,"ElkGraphUtil/AncestorIterator",695);var uAt=bq(B6n,"EList");wAn(67,52,{20:1,28:1,52:1,14:1,15:1,67:1,58:1}),MWn.Vc=function(n,t){sln(this,n,t)},MWn.Fc=function(n){return f9(this,n)},MWn.Wc=function(n,t){return oon(this,n,t)},MWn.Gc=function(n){return pX(this,n)},MWn.Zh=function(){return new ax(this)},MWn.$h=function(){return new ux(this)},MWn._h=function(n){return sin(this,n)},MWn.ai=function(){return!0},MWn.bi=function(n,t){},MWn.ci=function(){},MWn.di=function(n,t){L8(this,n,t)},MWn.ei=function(n,t,e){},MWn.fi=function(n,t){},MWn.gi=function(n,t,e){},MWn.Fb=function(n){return QDn(this,n)},MWn.Hb=function(){return Mun(this)},MWn.hi=function(){return!1},MWn.Kc=function(){return new AL(this)},MWn.Yc=function(){return new cx(this)},MWn.Zc=function(n){var t;if(t=this.gc(),n<0||n>t)throw Hp(new tK(n,t));return new GU(this,n)},MWn.ji=function(n,t){this.ii(n,this.Xc(t))},MWn.Mc=function(n){return snn(this,n)},MWn.li=function(n,t){return t},MWn._c=function(n,t){return ovn(this,n,t)},MWn.Ib=function(){return Jbn(this)},MWn.ni=function(){return!0},MWn.oi=function(n,t){return xsn(this,t)},vX(B6n,"AbstractEList",67),wAn(63,67,h8n,go,gtn,jcn),MWn.Vh=function(n,t){return BTn(this,n,t)},MWn.Wh=function(n){return bmn(this,n)},MWn.Xh=function(n,t){Ifn(this,n,t)},MWn.Yh=function(n){c6(this,n)},MWn.pi=function(n){return F9(this,n)},MWn.$b=function(){a6(this)},MWn.Hc=function(n){return Sjn(this,n)},MWn.Xb=function(n){return Wtn(this,n)},MWn.qi=function(n){var t,e,i;++this.j,n>(e=null==this.g?0:this.g.length)&&(i=this.g,(t=e+(e/2|0)+4)=0&&(this.$c(t),!0)},MWn.mi=function(n,t){return this.Ui(n,this.oi(n,t))},MWn.gc=function(){return this.Vi()},MWn.Pc=function(){return this.Wi()},MWn.Qc=function(n){return this.Xi(n)},MWn.Ib=function(){return this.Yi()},vX(B6n,"DelegatingEList",1995),wAn(1996,1995,n9n),MWn.Vh=function(n,t){return uFn(this,n,t)},MWn.Wh=function(n){return this.Vh(this.Vi(),n)},MWn.Xh=function(n,t){eAn(this,n,t)},MWn.Yh=function(n){OOn(this,n)},MWn.ai=function(){return!this.bj()},MWn.$b=function(){vqn(this)},MWn.Zi=function(n,t,e,i,r){return new NY(this,n,t,e,i,r)},MWn.$i=function(n){ban(this.Ai(),n)},MWn._i=function(){return null},MWn.aj=function(){return-1},MWn.Ai=function(){return null},MWn.bj=function(){return!1},MWn.cj=function(n,t){return t},MWn.dj=function(n,t){return t},MWn.ej=function(){return!1},MWn.fj=function(){return!this.Ri()},MWn.ii=function(n,t){var e,i;return this.ej()?(i=this.fj(),e=AMn(this,n,t),this.$i(this.Zi(7,iln(t),e,n,i)),e):AMn(this,n,t)},MWn.$c=function(n){var t,e,i,r;return this.ej()?(e=null,i=this.fj(),t=this.Zi(4,r=wq(this,n),null,n,i),this.bj()&&r?(e=this.dj(r,e))?(e.Ei(t),e.Fi()):this.$i(t):e?(e.Ei(t),e.Fi()):this.$i(t),r):(r=wq(this,n),this.bj()&&r&&(e=this.dj(r,null))&&e.Fi(),r)},MWn.mi=function(n,t){return oFn(this,n,t)},vX(i6n,"DelegatingNotifyingListImpl",1996),wAn(143,1,t9n),MWn.Ei=function(n){return KEn(this,n)},MWn.Fi=function(){$7(this)},MWn.xi=function(){return this.d},MWn._i=function(){return null},MWn.gj=function(){return null},MWn.yi=function(n){return-1},MWn.zi=function(){return Rxn(this)},MWn.Ai=function(){return null},MWn.Bi=function(){return Kxn(this)},MWn.Ci=function(){return this.o<0?this.o<-2?-2-this.o-1:-1:this.o},MWn.hj=function(){return!1},MWn.Di=function(n){var t,e,i,r,c,a,u,o;switch(this.d){case 1:case 2:switch(n.xi()){case 1:case 2:if(GI(n.Ai())===GI(this.Ai())&&this.yi(null)==n.yi(null))return this.g=n.zi(),1==n.xi()&&(this.d=1),!0}case 4:if(4===n.xi()&&GI(n.Ai())===GI(this.Ai())&&this.yi(null)==n.yi(null))return a=tGn(this),c=this.o<0?this.o<-2?-2-this.o-1:-1:this.o,i=n.Ci(),this.d=6,o=new gtn(2),c<=i?(f9(o,this.n),f9(o,n.Bi()),this.g=Pun(Gk(ANt,1),hQn,25,15,[this.o=c,i+1])):(f9(o,n.Bi()),f9(o,this.n),this.g=Pun(Gk(ANt,1),hQn,25,15,[this.o=i,c])),this.n=o,a||(this.o=-2-this.o-1),!0;break;case 6:if(4===n.xi()&&GI(n.Ai())===GI(this.Ai())&&this.yi(null)==n.yi(null)){for(a=tGn(this),i=n.Ci(),u=BB(this.g,48),e=x8(ANt,hQn,25,u.length+1,15,1),t=0;t>>0).toString(16))).a+=" (eventType: ",this.d){case 1:e.a+="SET";break;case 2:e.a+="UNSET";break;case 3:e.a+="ADD";break;case 5:e.a+="ADD_MANY";break;case 4:e.a+="REMOVE";break;case 6:e.a+="REMOVE_MANY";break;case 7:e.a+="MOVE";break;case 8:e.a+="REMOVING_ADAPTER";break;case 9:e.a+="RESOLVE";break;default:mE(e,this.d)}if(lKn(this)&&(e.a+=", touch: true"),e.a+=", position: ",mE(e,this.o<0?this.o<-2?-2-this.o-1:-1:this.o),e.a+=", notifier: ",rO(e,this.Ai()),e.a+=", feature: ",rO(e,this._i()),e.a+=", oldValue: ",rO(e,Kxn(this)),e.a+=", newValue: ",6==this.d&&cL(this.g,48)){for(t=BB(this.g,48),e.a+="[",n=0;n10?(this.b&&this.c.j==this.a||(this.b=new $q(this),this.a=this.j),FT(this.b,n)):Sjn(this,n)},MWn.ni=function(){return!0},MWn.a=0,vX(B6n,"AbstractEList/1",953),wAn(295,73,NQn,tK),vX(B6n,"AbstractEList/BasicIndexOutOfBoundsException",295),wAn(40,1,QWn,AL),MWn.Nb=function(n){fU(this,n)},MWn.mj=function(){if(this.i.j!=this.f)throw Hp(new vv)},MWn.nj=function(){return kpn(this)},MWn.Ob=function(){return this.e!=this.i.gc()},MWn.Pb=function(){return this.nj()},MWn.Qb=function(){Qjn(this)},MWn.e=0,MWn.f=0,MWn.g=-1,vX(B6n,"AbstractEList/EIterator",40),wAn(278,40,cVn,cx,GU),MWn.Qb=function(){Qjn(this)},MWn.Rb=function(n){odn(this,n)},MWn.oj=function(){var n;try{return n=this.d.Xb(--this.e),this.mj(),this.g=this.e,n}catch(t){throw cL(t=lun(t),73)?(this.mj(),Hp(new yv)):Hp(t)}},MWn.pj=function(n){kmn(this,n)},MWn.Sb=function(){return 0!=this.e},MWn.Tb=function(){return this.e},MWn.Ub=function(){return this.oj()},MWn.Vb=function(){return this.e-1},MWn.Wb=function(n){this.pj(n)},vX(B6n,"AbstractEList/EListIterator",278),wAn(341,40,QWn,ax),MWn.nj=function(){return jpn(this)},MWn.Qb=function(){throw Hp(new pv)},vX(B6n,"AbstractEList/NonResolvingEIterator",341),wAn(385,278,cVn,ux,RK),MWn.Rb=function(n){throw Hp(new pv)},MWn.nj=function(){var n;try{return n=this.c.ki(this.e),this.mj(),this.g=this.e++,n}catch(t){throw cL(t=lun(t),73)?(this.mj(),Hp(new yv)):Hp(t)}},MWn.oj=function(){var n;try{return n=this.c.ki(--this.e),this.mj(),this.g=this.e,n}catch(t){throw cL(t=lun(t),73)?(this.mj(),Hp(new yv)):Hp(t)}},MWn.Qb=function(){throw Hp(new pv)},MWn.Wb=function(n){throw Hp(new pv)},vX(B6n,"AbstractEList/NonResolvingEListIterator",385),wAn(1982,67,r9n),MWn.Vh=function(n,t){var e,i,r,c,a,u,o,s,h;if(0!=(i=t.gc())){for(e=Psn(this,(s=null==(o=BB(yan(this.a,4),126))?0:o.length)+i),(h=s-n)>0&&aHn(o,n,e,n+i,h),u=t.Kc(),c=0;ce)throw Hp(new tK(n,e));return new BW(this,n)},MWn.$b=function(){var n,t;++this.j,t=null==(n=BB(yan(this.a,4),126))?0:n.length,Fgn(this,null),L8(this,t,n)},MWn.Hc=function(n){var t,e,i,r;if(null!=(t=BB(yan(this.a,4),126)))if(null!=n){for(i=0,r=(e=t).length;i=(e=null==(t=BB(yan(this.a,4),126))?0:t.length))throw Hp(new tK(n,e));return t[n]},MWn.Xc=function(n){var t,e,i;if(null!=(t=BB(yan(this.a,4),126)))if(null!=n){for(e=0,i=t.length;ee)throw Hp(new tK(n,e));return new FW(this,n)},MWn.ii=function(n,t){var e,i,r;if(n>=(r=null==(e=$dn(this))?0:e.length))throw Hp(new Ay(u8n+n+o8n+r));if(t>=r)throw Hp(new Ay(s8n+t+o8n+r));return i=e[t],n!=t&&(n0&&aHn(n,0,t,0,e),t},MWn.Qc=function(n){var t,e;return(e=null==(t=BB(yan(this.a,4),126))?0:t.length)>0&&(n.lengthe&&$X(n,e,null),n},vX(B6n,"ArrayDelegatingEList",1982),wAn(1038,40,QWn,M5),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},MWn.Qb=function(){Qjn(this),this.a=BB(yan(this.b.a,4),126)},vX(B6n,"ArrayDelegatingEList/EIterator",1038),wAn(706,278,cVn,Qz,FW),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},MWn.pj=function(n){kmn(this,n),this.a=BB(yan(this.b.a,4),126)},MWn.Qb=function(){Qjn(this),this.a=BB(yan(this.b.a,4),126)},vX(B6n,"ArrayDelegatingEList/EListIterator",706),wAn(1039,341,QWn,S5),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},vX(B6n,"ArrayDelegatingEList/NonResolvingEIterator",1039),wAn(707,385,cVn,Yz,BW),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},vX(B6n,"ArrayDelegatingEList/NonResolvingEListIterator",707),wAn(606,295,NQn,LO),vX(B6n,"BasicEList/BasicIndexOutOfBoundsException",606),wAn(696,63,h8n,DI),MWn.Vc=function(n,t){throw Hp(new pv)},MWn.Fc=function(n){throw Hp(new pv)},MWn.Wc=function(n,t){throw Hp(new pv)},MWn.Gc=function(n){throw Hp(new pv)},MWn.$b=function(){throw Hp(new pv)},MWn.qi=function(n){throw Hp(new pv)},MWn.Kc=function(){return this.Zh()},MWn.Yc=function(){return this.$h()},MWn.Zc=function(n){return this._h(n)},MWn.ii=function(n,t){throw Hp(new pv)},MWn.ji=function(n,t){throw Hp(new pv)},MWn.$c=function(n){throw Hp(new pv)},MWn.Mc=function(n){throw Hp(new pv)},MWn._c=function(n,t){throw Hp(new pv)},vX(B6n,"BasicEList/UnmodifiableEList",696),wAn(705,1,{3:1,20:1,14:1,15:1,58:1,589:1}),MWn.Vc=function(n,t){Q$(this,n,BB(t,42))},MWn.Fc=function(n){return aD(this,BB(n,42))},MWn.Jc=function(n){e5(this,n)},MWn.Xb=function(n){return BB(Wtn(this.c,n),133)},MWn.ii=function(n,t){return BB(this.c.ii(n,t),42)},MWn.ji=function(n,t){Y$(this,n,BB(t,42))},MWn.Lc=function(){return new Rq(null,new w1(this,16))},MWn.$c=function(n){return BB(this.c.$c(n),42)},MWn._c=function(n,t){return uX(this,n,BB(t,42))},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Oc=function(){return new Rq(null,new w1(this,16))},MWn.Wc=function(n,t){return this.c.Wc(n,t)},MWn.Gc=function(n){return this.c.Gc(n)},MWn.$b=function(){this.c.$b()},MWn.Hc=function(n){return this.c.Hc(n)},MWn.Ic=function(n){return oun(this.c,n)},MWn.qj=function(){var n,t;if(null==this.d){for(this.d=x8(oAt,c9n,63,2*this.f+1,0,1),t=this.e,this.f=0,n=this.c.Kc();n.e!=n.i.gc();)Ivn(this,BB(n.nj(),133));this.e=t}},MWn.Fb=function(n){return NK(this,n)},MWn.Hb=function(){return Mun(this.c)},MWn.Xc=function(n){return this.c.Xc(n)},MWn.rj=function(){this.c=new hp(this)},MWn.dc=function(){return 0==this.f},MWn.Kc=function(){return this.c.Kc()},MWn.Yc=function(){return this.c.Yc()},MWn.Zc=function(n){return this.c.Zc(n)},MWn.sj=function(){return A8(this)},MWn.tj=function(n,t,e){return new SB(n,t,e)},MWn.uj=function(){return new vo},MWn.Mc=function(n){return hin(this,n)},MWn.gc=function(){return this.f},MWn.bd=function(n,t){return new s1(this.c,n,t)},MWn.Pc=function(){return this.c.Pc()},MWn.Qc=function(n){return this.c.Qc(n)},MWn.Ib=function(){return Jbn(this.c)},MWn.e=0,MWn.f=0,vX(B6n,"BasicEMap",705),wAn(1033,63,h8n,hp),MWn.bi=function(n,t){Av(this,BB(t,133))},MWn.ei=function(n,t,e){var i;++(i=this,BB(t,133),i).a.e},MWn.fi=function(n,t){$v(this,BB(t,133))},MWn.gi=function(n,t,e){VN(this,BB(t,133),BB(e,133))},MWn.di=function(n,t){aan(this.a)},vX(B6n,"BasicEMap/1",1033),wAn(1034,63,h8n,vo),MWn.ri=function(n){return x8(vAt,a9n,612,n,0,1)},vX(B6n,"BasicEMap/2",1034),wAn(1035,nVn,tVn,fp),MWn.$b=function(){this.a.c.$b()},MWn.Hc=function(n){return rdn(this.a,n)},MWn.Kc=function(){return 0==this.a.f?(dD(),pAt.a):new Bj(this.a)},MWn.Mc=function(n){var t;return t=this.a.f,Wdn(this.a,n),this.a.f!=t},MWn.gc=function(){return this.a.f},vX(B6n,"BasicEMap/3",1035),wAn(1036,28,ZWn,lp),MWn.$b=function(){this.a.c.$b()},MWn.Hc=function(n){return YDn(this.a,n)},MWn.Kc=function(){return 0==this.a.f?(dD(),pAt.a):new Hj(this.a)},MWn.gc=function(){return this.a.f},vX(B6n,"BasicEMap/4",1036),wAn(1037,nVn,tVn,bp),MWn.$b=function(){this.a.c.$b()},MWn.Hc=function(n){var t,e,i,r,c,a,u,o,s;if(this.a.f>0&&cL(n,42)&&(this.a.qj(),r=null==(u=(o=BB(n,42)).cd())?0:nsn(u),c=eR(this.a,r),t=this.a.d[c]))for(e=BB(t.g,367),s=t.i,a=0;a"+this.c},MWn.a=0;var pAt,vAt=vX(B6n,"BasicEMap/EntryImpl",612);wAn(536,1,{},oo),vX(B6n,"BasicEMap/View",536),wAn(768,1,{}),MWn.Fb=function(n){return NAn((SQ(),set),n)},MWn.Hb=function(){return Fon((SQ(),set))},MWn.Ib=function(){return LMn((SQ(),set))},vX(B6n,"ECollections/BasicEmptyUnmodifiableEList",768),wAn(1312,1,cVn,mo),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){throw Hp(new pv)},MWn.Ob=function(){return!1},MWn.Sb=function(){return!1},MWn.Pb=function(){throw Hp(new yv)},MWn.Tb=function(){return 0},MWn.Ub=function(){throw Hp(new yv)},MWn.Vb=function(){return-1},MWn.Qb=function(){throw Hp(new pv)},MWn.Wb=function(n){throw Hp(new pv)},vX(B6n,"ECollections/BasicEmptyUnmodifiableEList/1",1312),wAn(1310,768,{20:1,14:1,15:1,58:1},Tm),MWn.Vc=function(n,t){NE()},MWn.Fc=function(n){return xE()},MWn.Wc=function(n,t){return DE()},MWn.Gc=function(n){return RE()},MWn.$b=function(){KE()},MWn.Hc=function(n){return!1},MWn.Ic=function(n){return!1},MWn.Jc=function(n){e5(this,n)},MWn.Xb=function(n){return yO((SQ(),n)),null},MWn.Xc=function(n){return-1},MWn.dc=function(){return!0},MWn.Kc=function(){return this.a},MWn.Yc=function(){return this.a},MWn.Zc=function(n){return this.a},MWn.ii=function(n,t){return _E()},MWn.ji=function(n,t){FE()},MWn.Lc=function(){return new Rq(null,new w1(this,16))},MWn.$c=function(n){return BE()},MWn.Mc=function(n){return HE()},MWn._c=function(n,t){return qE()},MWn.gc=function(){return 0},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Oc=function(){return new Rq(null,new w1(this,16))},MWn.bd=function(n,t){return SQ(),new s1(set,n,t)},MWn.Pc=function(){return cz((SQ(),set))},MWn.Qc=function(n){return SQ(),Emn(set,n)},vX(B6n,"ECollections/EmptyUnmodifiableEList",1310),wAn(1311,768,{20:1,14:1,15:1,58:1,589:1},Mm),MWn.Vc=function(n,t){NE()},MWn.Fc=function(n){return xE()},MWn.Wc=function(n,t){return DE()},MWn.Gc=function(n){return RE()},MWn.$b=function(){KE()},MWn.Hc=function(n){return!1},MWn.Ic=function(n){return!1},MWn.Jc=function(n){e5(this,n)},MWn.Xb=function(n){return yO((SQ(),n)),null},MWn.Xc=function(n){return-1},MWn.dc=function(){return!0},MWn.Kc=function(){return this.a},MWn.Yc=function(){return this.a},MWn.Zc=function(n){return this.a},MWn.ii=function(n,t){return _E()},MWn.ji=function(n,t){FE()},MWn.Lc=function(){return new Rq(null,new w1(this,16))},MWn.$c=function(n){return BE()},MWn.Mc=function(n){return HE()},MWn._c=function(n,t){return qE()},MWn.gc=function(){return 0},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Oc=function(){return new Rq(null,new w1(this,16))},MWn.bd=function(n,t){return SQ(),new s1(set,n,t)},MWn.Pc=function(){return cz((SQ(),set))},MWn.Qc=function(n){return SQ(),Emn(set,n)},MWn.sj=function(){return SQ(),SQ(),het},vX(B6n,"ECollections/EmptyUnmodifiableEMap",1311);var mAt,yAt=bq(B6n,"Enumerator");wAn(281,1,{281:1},rRn),MWn.Fb=function(n){var t;return this===n||!!cL(n,281)&&(t=BB(n,281),this.f==t.f&&vG(this.i,t.i)&&pG(this.a,0!=(256&this.f)?0!=(256&t.f)?t.a:null:0!=(256&t.f)?null:t.a)&&pG(this.d,t.d)&&pG(this.g,t.g)&&pG(this.e,t.e)&&Spn(this,t))},MWn.Hb=function(){return this.f},MWn.Ib=function(){return M_n(this)},MWn.f=0;var kAt,jAt,EAt,TAt=0,MAt=0,SAt=0,PAt=0,CAt=0,IAt=0,OAt=0,AAt=0,$At=0,LAt=0,NAt=0,xAt=0,DAt=0;vX(B6n,"URI",281),wAn(1091,43,tYn,Sm),MWn.zc=function(n,t){return BB(mZ(this,SD(n),BB(t,281)),281)},vX(B6n,"URI/URICache",1091),wAn(497,63,h8n,fo,rG),MWn.hi=function(){return!0},vX(B6n,"UniqueEList",497),wAn(581,60,BVn,L7),vX(B6n,"WrappedException",581);var RAt,KAt=bq(q5n,s9n),_At=bq(q5n,h9n),FAt=bq(q5n,f9n),BAt=bq(q5n,l9n),HAt=bq(q5n,b9n),qAt=bq(q5n,"EClass"),GAt=bq(q5n,"EDataType");wAn(1183,43,tYn,Pm),MWn.xc=function(n){return XI(n)?SJ(this,n):qI(AY(this.f,n))},vX(q5n,"EDataType/Internal/ConversionDelegate/Factory/Registry/Impl",1183);var zAt,UAt,XAt=bq(q5n,"EEnum"),WAt=bq(q5n,w9n),VAt=bq(q5n,d9n),QAt=bq(q5n,g9n),YAt=bq(q5n,p9n),JAt=bq(q5n,v9n);wAn(1029,1,{},ho),MWn.Ib=function(){return"NIL"},vX(q5n,"EStructuralFeature/Internal/DynamicValueHolder/1",1029),wAn(1028,43,tYn,Cm),MWn.xc=function(n){return XI(n)?SJ(this,n):qI(AY(this.f,n))},vX(q5n,"EStructuralFeature/Internal/SettingDelegate/Factory/Registry/Impl",1028);var ZAt,n$t,t$t,e$t,i$t,r$t,c$t,a$t,u$t,o$t,s$t,h$t,f$t,l$t,b$t,w$t,d$t,g$t,p$t,v$t,m$t,y$t,k$t,j$t,E$t,T$t,M$t,S$t,P$t,C$t,I$t,O$t=bq(q5n,m9n),A$t=bq(q5n,"EValidator/PatternMatcher"),$$t=bq(y9n,"FeatureMap/Entry");wAn(535,1,{72:1},CI),MWn.ak=function(){return this.a},MWn.dd=function(){return this.b},vX(l6n,"BasicEObjectImpl/1",535),wAn(1027,1,k9n,II),MWn.Wj=function(n){return V5(this.a,this.b,n)},MWn.fj=function(){return ZJ(this.a,this.b)},MWn.Wb=function(n){NJ(this.a,this.b,n)},MWn.Xj=function(){PW(this.a,this.b)},vX(l6n,"BasicEObjectImpl/4",1027),wAn(1983,1,{108:1}),MWn.bk=function(n){this.e=0==n?M$t:x8(Ant,HWn,1,n,5,1)},MWn.Ch=function(n){return this.e[n]},MWn.Dh=function(n,t){this.e[n]=t},MWn.Eh=function(n){this.e[n]=null},MWn.ck=function(){return this.c},MWn.dk=function(){throw Hp(new pv)},MWn.ek=function(){throw Hp(new pv)},MWn.fk=function(){return this.d},MWn.gk=function(){return null!=this.e},MWn.hk=function(n){this.c=n},MWn.ik=function(n){throw Hp(new pv)},MWn.jk=function(n){throw Hp(new pv)},MWn.kk=function(n){this.d=n},vX(l6n,"BasicEObjectImpl/EPropertiesHolderBaseImpl",1983),wAn(185,1983,{108:1},Kf),MWn.dk=function(){return this.a},MWn.ek=function(){return this.b},MWn.ik=function(n){this.a=n},MWn.jk=function(n){this.b=n},vX(l6n,"BasicEObjectImpl/EPropertiesHolderImpl",185),wAn(506,97,f6n,yo),MWn.Kg=function(){return this.f},MWn.Pg=function(){return this.k},MWn.Rg=function(n,t){this.g=n,this.i=t},MWn.Tg=function(){return 0==(2&this.j)?this.zh():this.ph().ck()},MWn.Vg=function(){return this.i},MWn.Mg=function(){return 0!=(1&this.j)},MWn.eh=function(){return this.g},MWn.kh=function(){return 0!=(4&this.j)},MWn.ph=function(){return!this.k&&(this.k=new Kf),this.k},MWn.th=function(n){this.ph().hk(n),n?this.j|=2:this.j&=-3},MWn.vh=function(n){this.ph().jk(n),n?this.j|=4:this.j&=-5},MWn.zh=function(){return(QX(),t$t).S},MWn.i=0,MWn.j=1,vX(l6n,"EObjectImpl",506),wAn(780,506,{105:1,92:1,90:1,56:1,108:1,49:1,97:1},jH),MWn.Ch=function(n){return this.e[n]},MWn.Dh=function(n,t){this.e[n]=t},MWn.Eh=function(n){this.e[n]=null},MWn.Tg=function(){return this.d},MWn.Yg=function(n){return Awn(this.d,n)},MWn.$g=function(){return this.d},MWn.dh=function(){return null!=this.e},MWn.ph=function(){return!this.k&&(this.k=new ko),this.k},MWn.th=function(n){this.d=n},MWn.yh=function(){var n;return null==this.e&&(n=bX(this.d),this.e=0==n?S$t:x8(Ant,HWn,1,n,5,1)),this},MWn.Ah=function(){return 0},vX(l6n,"DynamicEObjectImpl",780),wAn(1376,780,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1},fq),MWn.Fb=function(n){return this===n},MWn.Hb=function(){return PN(this)},MWn.th=function(n){this.d=n,this.b=NNn(n,"key"),this.c=NNn(n,E6n)},MWn.Sh=function(){var n;return-1==this.a&&(n=J7(this,this.b),this.a=null==n?0:nsn(n)),this.a},MWn.cd=function(){return J7(this,this.b)},MWn.dd=function(){return J7(this,this.c)},MWn.Th=function(n){this.a=n},MWn.Uh=function(n){NJ(this,this.b,n)},MWn.ed=function(n){var t;return t=J7(this,this.c),NJ(this,this.c,n),t},MWn.a=0,vX(l6n,"DynamicEObjectImpl/BasicEMapEntry",1376),wAn(1377,1,{108:1},ko),MWn.bk=function(n){throw Hp(new pv)},MWn.Ch=function(n){throw Hp(new pv)},MWn.Dh=function(n,t){throw Hp(new pv)},MWn.Eh=function(n){throw Hp(new pv)},MWn.ck=function(){throw Hp(new pv)},MWn.dk=function(){return this.a},MWn.ek=function(){return this.b},MWn.fk=function(){return this.c},MWn.gk=function(){throw Hp(new pv)},MWn.hk=function(n){throw Hp(new pv)},MWn.ik=function(n){this.a=n},MWn.jk=function(n){this.b=n},MWn.kk=function(n){this.c=n},vX(l6n,"DynamicEObjectImpl/DynamicEPropertiesHolderImpl",1377),wAn(510,150,{105:1,92:1,90:1,590:1,147:1,56:1,108:1,49:1,97:1,510:1,150:1,114:1,115:1},jo),MWn.Qg=function(n){return bkn(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.d;case 2:return e?(!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),this.b):(!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),A8(this.b));case 3:return bZ(this);case 4:return!this.a&&(this.a=new $L(LOt,this,4)),this.a;case 5:return!this.c&&(this.c=new RL(LOt,this,5)),this.c}return U9(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 3:return this.Cb&&(e=(i=this.Db>>16)>=0?bkn(this,e):this.Cb.ih(this,-1-i,null,e)),QG(this,BB(n,147),e)}return BB(itn(BB(yan(this,16),26)||(gWn(),e$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),e$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 2:return!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),BK(this.b,n,e);case 3:return QG(this,null,e);case 4:return!this.a&&(this.a=new $L(LOt,this,4)),_pn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),e$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),e$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.d;case 2:return!!this.b&&0!=this.b.f;case 3:return!!bZ(this);case 4:return!!this.a&&0!=this.a.i;case 5:return!!this.c&&0!=this.c.i}return O3(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void pq(this,SD(t));case 2:return!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),void tan(this.b,t);case 3:return void ONn(this,BB(t,147));case 4:return!this.a&&(this.a=new $L(LOt,this,4)),sqn(this.a),!this.a&&(this.a=new $L(LOt,this,4)),void pX(this.a,BB(t,14));case 5:return!this.c&&(this.c=new RL(LOt,this,5)),sqn(this.c),!this.c&&(this.c=new RL(LOt,this,5)),void pX(this.c,BB(t,14))}Lbn(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n),t)},MWn.zh=function(){return gWn(),e$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Bin(this,null);case 2:return!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),void this.b.c.$b();case 3:return void ONn(this,null);case 4:return!this.a&&(this.a=new $L(LOt,this,4)),void sqn(this.a);case 5:return!this.c&&(this.c=new RL(LOt,this,5)),void sqn(this.c)}qfn(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n))},MWn.Ib=function(){return Vfn(this)},MWn.d=null,vX(l6n,"EAnnotationImpl",510),wAn(151,705,j9n,y9),MWn.Xh=function(n,t){n$(this,n,BB(t,42))},MWn.lk=function(n,t){return FK(this,BB(n,42),t)},MWn.pi=function(n){return BB(BB(this.c,69).pi(n),133)},MWn.Zh=function(){return BB(this.c,69).Zh()},MWn.$h=function(){return BB(this.c,69).$h()},MWn._h=function(n){return BB(this.c,69)._h(n)},MWn.mk=function(n,t){return BK(this,n,t)},MWn.Wj=function(n){return BB(this.c,76).Wj(n)},MWn.rj=function(){},MWn.fj=function(){return BB(this.c,76).fj()},MWn.tj=function(n,t,e){var i;return(i=BB(Utn(this.b).Nh().Jh(this.b),133)).Th(n),i.Uh(t),i.ed(e),i},MWn.uj=function(){return new Ip(this)},MWn.Wb=function(n){tan(this,n)},MWn.Xj=function(){BB(this.c,76).Xj()},vX(y9n,"EcoreEMap",151),wAn(158,151,j9n,Jx),MWn.qj=function(){var n,t,e,i,r;if(null==this.d){for(r=x8(oAt,c9n,63,2*this.f+1,0,1),e=this.c.Kc();e.e!=e.i.gc();)!(n=r[i=((t=BB(e.nj(),133)).Sh()&DWn)%r.length])&&(n=r[i]=new Ip(this)),n.Fc(t);this.d=r}},vX(l6n,"EAnnotationImpl/1",158),wAn(284,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,472:1,49:1,97:1,150:1,284:1,114:1,115:1}),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),!!this.$j();case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return this.$j();case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i)}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void this.Lh(SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void this.ok(BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi())}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),E$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void this.Lh(null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void this.ok(1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi())}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.Gh=function(){Ikn(this),this.Bb|=1},MWn.Yj=function(){return Ikn(this)},MWn.Zj=function(){return this.t},MWn.$j=function(){var n;return(n=this.t)>1||-1==n},MWn.hi=function(){return 0!=(512&this.Bb)},MWn.nk=function(n,t){return Pfn(this,n,t)},MWn.ok=function(n){Nen(this,n)},MWn.Ib=function(){return KOn(this)},MWn.s=0,MWn.t=1,vX(l6n,"ETypedElementImpl",284),wAn(449,284,{105:1,92:1,90:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,449:1,284:1,114:1,115:1,677:1}),MWn.Qg=function(n){return Nyn(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),!!this.$j();case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return hN(),0!=(this.Bb&k6n);case 11:return hN(),0!=(this.Bb&M9n);case 12:return hN(),0!=(this.Bb&_Qn);case 13:return this.j;case 14:return qLn(this);case 15:return hN(),0!=(this.Bb&T9n);case 16:return hN(),0!=(this.Bb&hVn);case 17:return dZ(this)}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 17:return this.Cb&&(e=(i=this.Db>>16)>=0?Nyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,17,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Qj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e);case 17:return T_n(this,null,17,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return this.$j();case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return 0==(this.Bb&k6n);case 11:return 0!=(this.Bb&M9n);case 12:return 0!=(this.Bb&_Qn);case 13:return null!=this.j;case 14:return null!=qLn(this);case 15:return 0!=(this.Bb&T9n);case 16:return 0!=(this.Bb&hVn);case 17:return!!dZ(this)}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void JZ(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void this.ok(BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 10:return void Aln(this,qy(TD(t)));case 11:return void Nln(this,qy(TD(t)));case 12:return void $ln(this,qy(TD(t)));case 13:return void _I(this,SD(t));case 15:return void Lln(this,qy(TD(t)));case 16:return void qln(this,qy(TD(t)))}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),j$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),4),void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void this.ok(1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 10:return void Aln(this,!0);case 11:return void Nln(this,!1);case 12:return void $ln(this,!1);case 13:return this.i=null,void arn(this,null);case 15:return void Lln(this,!1);case 16:return void qln(this,!1)}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.Gh=function(){kV(B7((IPn(),Z$t),this)),Ikn(this),this.Bb|=1},MWn.Gj=function(){return this.f},MWn.zj=function(){return qLn(this)},MWn.Hj=function(){return dZ(this)},MWn.Lj=function(){return null},MWn.pk=function(){return this.k},MWn.aj=function(){return this.n},MWn.Mj=function(){return oEn(this)},MWn.Nj=function(){var n,t,e,i,r,c,a,u,o;return this.p||((null==(e=dZ(this)).i&&qFn(e),e.i).length,(i=this.Lj())&&bX(dZ(i)),n=(a=(r=Ikn(this)).Bj())?0!=(1&a.i)?a==$Nt?ktt:a==ANt?Att:a==DNt?Ctt:a==xNt?Ptt:a==LNt?Rtt:a==RNt?_tt:a==NNt?Ttt:Stt:a:null,t=qLn(this),u=r.zj(),bbn(this),0!=(this.Bb&hVn)&&((c=mjn((IPn(),Z$t),e))&&c!=this||(c=Z1(B7(Z$t,this))))?this.p=new AI(this,c):this.$j()?this.rk()?i?0!=(this.Bb&T9n)?n?this.sk()?this.p=new lQ(47,n,this,i):this.p=new lQ(5,n,this,i):this.sk()?this.p=new w4(46,this,i):this.p=new w4(4,this,i):n?this.sk()?this.p=new lQ(49,n,this,i):this.p=new lQ(7,n,this,i):this.sk()?this.p=new w4(48,this,i):this.p=new w4(6,this,i):0!=(this.Bb&T9n)?n?n==Hnt?this.p=new PB(50,VOt,this):this.sk()?this.p=new PB(43,n,this):this.p=new PB(1,n,this):this.sk()?this.p=new RY(42,this):this.p=new RY(0,this):n?n==Hnt?this.p=new PB(41,VOt,this):this.sk()?this.p=new PB(45,n,this):this.p=new PB(3,n,this):this.sk()?this.p=new RY(44,this):this.p=new RY(2,this):cL(r,148)?n==$$t?this.p=new RY(40,this):0!=(512&this.Bb)?0!=(this.Bb&T9n)?this.p=n?new PB(9,n,this):new RY(8,this):this.p=n?new PB(11,n,this):new RY(10,this):0!=(this.Bb&T9n)?this.p=n?new PB(13,n,this):new RY(12,this):this.p=n?new PB(15,n,this):new RY(14,this):i?(o=i.t)>1||-1==o?this.sk()?0!=(this.Bb&T9n)?this.p=n?new lQ(25,n,this,i):new w4(24,this,i):this.p=n?new lQ(27,n,this,i):new w4(26,this,i):0!=(this.Bb&T9n)?this.p=n?new lQ(29,n,this,i):new w4(28,this,i):this.p=n?new lQ(31,n,this,i):new w4(30,this,i):this.sk()?0!=(this.Bb&T9n)?this.p=n?new lQ(33,n,this,i):new w4(32,this,i):this.p=n?new lQ(35,n,this,i):new w4(34,this,i):0!=(this.Bb&T9n)?this.p=n?new lQ(37,n,this,i):new w4(36,this,i):this.p=n?new lQ(39,n,this,i):new w4(38,this,i):this.sk()?0!=(this.Bb&T9n)?this.p=n?new PB(17,n,this):new RY(16,this):this.p=n?new PB(19,n,this):new RY(18,this):0!=(this.Bb&T9n)?this.p=n?new PB(21,n,this):new RY(20,this):this.p=n?new PB(23,n,this):new RY(22,this):this.qk()?this.sk()?this.p=new CB(BB(r,26),this,i):this.p=new mJ(BB(r,26),this,i):cL(r,148)?n==$$t?this.p=new RY(40,this):0!=(this.Bb&T9n)?this.p=n?new nz(t,u,this,(Bwn(),a==ANt?q$t:a==$Nt?K$t:a==LNt?G$t:a==DNt?H$t:a==xNt?B$t:a==RNt?U$t:a==NNt?_$t:a==ONt?F$t:z$t)):new dQ(BB(r,148),t,u,this):this.p=n?new ZG(t,u,this,(Bwn(),a==ANt?q$t:a==$Nt?K$t:a==LNt?G$t:a==DNt?H$t:a==xNt?B$t:a==RNt?U$t:a==NNt?_$t:a==ONt?F$t:z$t)):new wQ(BB(r,148),t,u,this):this.rk()?i?0!=(this.Bb&T9n)?this.sk()?this.p=new NB(BB(r,26),this,i):this.p=new LB(BB(r,26),this,i):this.sk()?this.p=new $B(BB(r,26),this,i):this.p=new IB(BB(r,26),this,i):0!=(this.Bb&T9n)?this.sk()?this.p=new eD(BB(r,26),this):this.p=new tD(BB(r,26),this):this.sk()?this.p=new nD(BB(r,26),this):this.p=new Zx(BB(r,26),this):this.sk()?i?0!=(this.Bb&T9n)?this.p=new xB(BB(r,26),this,i):this.p=new OB(BB(r,26),this,i):0!=(this.Bb&T9n)?this.p=new rD(BB(r,26),this):this.p=new iD(BB(r,26),this):i?0!=(this.Bb&T9n)?this.p=new DB(BB(r,26),this,i):this.p=new AB(BB(r,26),this,i):0!=(this.Bb&T9n)?this.p=new cD(BB(r,26),this):this.p=new cG(BB(r,26),this)),this.p},MWn.Ij=function(){return 0!=(this.Bb&k6n)},MWn.qk=function(){return!1},MWn.rk=function(){return!1},MWn.Jj=function(){return 0!=(this.Bb&hVn)},MWn.Oj=function(){return hnn(this)},MWn.sk=function(){return!1},MWn.Kj=function(){return 0!=(this.Bb&T9n)},MWn.tk=function(n){this.k=n},MWn.Lh=function(n){JZ(this,n)},MWn.Ib=function(){return ERn(this)},MWn.e=!1,MWn.n=0,vX(l6n,"EStructuralFeatureImpl",449),wAn(322,449,{105:1,92:1,90:1,34:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,322:1,150:1,449:1,284:1,114:1,115:1,677:1},Om),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),!!NIn(this);case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return hN(),0!=(this.Bb&k6n);case 11:return hN(),0!=(this.Bb&M9n);case 12:return hN(),0!=(this.Bb&_Qn);case 13:return this.j;case 14:return qLn(this);case 15:return hN(),0!=(this.Bb&T9n);case 16:return hN(),0!=(this.Bb&hVn);case 17:return dZ(this);case 18:return hN(),0!=(this.Bb&h6n);case 19:return t?uun(this):x6(this)}return U9(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n),t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return NIn(this);case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return 0==(this.Bb&k6n);case 11:return 0!=(this.Bb&M9n);case 12:return 0!=(this.Bb&_Qn);case 13:return null!=this.j;case 14:return null!=qLn(this);case 15:return 0!=(this.Bb&T9n);case 16:return 0!=(this.Bb&hVn);case 17:return!!dZ(this);case 18:return 0!=(this.Bb&h6n);case 19:return!!x6(this)}return O3(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void JZ(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void Uj(this,BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 10:return void Aln(this,qy(TD(t)));case 11:return void Nln(this,qy(TD(t)));case 12:return void $ln(this,qy(TD(t)));case 13:return void _I(this,SD(t));case 15:return void Lln(this,qy(TD(t)));case 16:return void qln(this,qy(TD(t)));case 18:return void Gln(this,qy(TD(t)))}Lbn(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n),t)},MWn.zh=function(){return gWn(),i$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),4),void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return this.b=0,void Nen(this,1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 10:return void Aln(this,!0);case 11:return void Nln(this,!1);case 12:return void $ln(this,!1);case 13:return this.i=null,void arn(this,null);case 15:return void Lln(this,!1);case 16:return void qln(this,!1);case 18:return void Gln(this,!1)}qfn(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n))},MWn.Gh=function(){uun(this),kV(B7((IPn(),Z$t),this)),Ikn(this),this.Bb|=1},MWn.$j=function(){return NIn(this)},MWn.nk=function(n,t){return this.b=0,this.a=null,Pfn(this,n,t)},MWn.ok=function(n){Uj(this,n)},MWn.Ib=function(){var n;return 0!=(64&this.Db)?ERn(this):((n=new fN(ERn(this))).a+=" (iD: ",yE(n,0!=(this.Bb&h6n)),n.a+=")",n.a)},MWn.b=0,vX(l6n,"EAttributeImpl",322),wAn(351,438,{105:1,92:1,90:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,351:1,150:1,114:1,115:1,676:1}),MWn.uk=function(n){return n.Tg()==this},MWn.Qg=function(n){return fyn(this,n)},MWn.Rg=function(n,t){this.w=null,this.Db=t<<16|255&this.Db,this.Cb=n},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return null!=this.D?this.D:this.B;case 3:return iyn(this);case 4:return this.zj();case 5:return this.F;case 6:return t?Utn(this):wZ(this);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),this.A}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 6:return this.Cb&&(e=(i=this.Db>>16)>=0?fyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,6,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Qj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 6:return T_n(this,null,6,e);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),_pn(this.A,n,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.D&&this.D==this.F;case 3:return!!iyn(this);case 4:return null!=this.zj();case 5:return null!=this.F&&this.F!=this.D&&this.F!=this.B;case 6:return!!wZ(this);case 7:return!!this.A&&0!=this.A.i}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void ZZ(this,SD(t));case 2:return void IA(this,SD(t));case 5:return void Yqn(this,SD(t));case 7:return!this.A&&(this.A=new NL(O$t,this,7)),sqn(this.A),!this.A&&(this.A=new NL(O$t,this,7)),void pX(this.A,BB(t,14))}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),c$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,179)&&(BB(this.Cb,179).tb=null),void Nrn(this,null);case 2:return Dsn(this,null),void xen(this,this.D);case 5:return void Yqn(this,null);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),void sqn(this.A)}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.yj=function(){var n;return-1==this.G&&(this.G=(n=Utn(this))?uvn(n.Mh(),this):-1),this.G},MWn.zj=function(){return null},MWn.Aj=function(){return Utn(this)},MWn.vk=function(){return this.v},MWn.Bj=function(){return iyn(this)},MWn.Cj=function(){return null!=this.D?this.D:this.B},MWn.Dj=function(){return this.F},MWn.wj=function(n){return SFn(this,n)},MWn.wk=function(n){this.v=n},MWn.xk=function(n){Urn(this,n)},MWn.yk=function(n){this.C=n},MWn.Lh=function(n){ZZ(this,n)},MWn.Ib=function(){return Cwn(this)},MWn.C=null,MWn.D=null,MWn.G=-1,vX(l6n,"EClassifierImpl",351),wAn(88,351,{105:1,92:1,90:1,26:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,88:1,351:1,150:1,473:1,114:1,115:1,676:1},_f),MWn.uk=function(n){return QR(this,n.Tg())},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return null!=this.D?this.D:this.B;case 3:return iyn(this);case 4:return null;case 5:return this.F;case 6:return t?Utn(this):wZ(this);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),this.A;case 8:return hN(),0!=(256&this.Bb);case 9:return hN(),0!=(512&this.Bb);case 10:return kY(this);case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),this.q;case 12:return YBn(this);case 13:return RBn(this);case 14:return RBn(this),this.r;case 15:return YBn(this),this.k;case 16:return WPn(this);case 17:return gBn(this);case 18:return qFn(this);case 19:return CLn(this);case 20:return YBn(this),this.o;case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),this.s;case 22:return a4(this);case 23:return HDn(this)}return U9(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 6:return this.Cb&&(e=(i=this.Db>>16)>=0?fyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,6,e);case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),Ywn(this.q,n,e);case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),Ywn(this.s,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),r$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),r$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 6:return T_n(this,null,6,e);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),_pn(this.A,n,e);case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),_pn(this.q,n,e);case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),_pn(this.s,n,e);case 22:return _pn(a4(this),n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),r$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),r$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.D&&this.D==this.F;case 3:return!!iyn(this);case 4:return!1;case 5:return null!=this.F&&this.F!=this.D&&this.F!=this.B;case 6:return!!wZ(this);case 7:return!!this.A&&0!=this.A.i;case 8:return 0!=(256&this.Bb);case 9:return 0!=(512&this.Bb);case 10:return!(!this.u||0==a4(this.u.a).i||this.n&&Rvn(this.n));case 11:return!!this.q&&0!=this.q.i;case 12:return 0!=YBn(this).i;case 13:return 0!=RBn(this).i;case 14:return RBn(this),0!=this.r.i;case 15:return YBn(this),0!=this.k.i;case 16:return 0!=WPn(this).i;case 17:return 0!=gBn(this).i;case 18:return 0!=qFn(this).i;case 19:return 0!=CLn(this).i;case 20:return YBn(this),!!this.o;case 21:return!!this.s&&0!=this.s.i;case 22:return!!this.n&&Rvn(this.n);case 23:return 0!=HDn(this).i}return O3(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n))},MWn.oh=function(n){return(null==this.i||this.q&&0!=this.q.i?null:NNn(this,n))||hUn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void ZZ(this,SD(t));case 2:return void IA(this,SD(t));case 5:return void Yqn(this,SD(t));case 7:return!this.A&&(this.A=new NL(O$t,this,7)),sqn(this.A),!this.A&&(this.A=new NL(O$t,this,7)),void pX(this.A,BB(t,14));case 8:return void Jfn(this,qy(TD(t)));case 9:return void tln(this,qy(TD(t)));case 10:return vqn(kY(this)),void pX(kY(this),BB(t,14));case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),sqn(this.q),!this.q&&(this.q=new eU(QAt,this,11,10)),void pX(this.q,BB(t,14));case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),sqn(this.s),!this.s&&(this.s=new eU(FAt,this,21,17)),void pX(this.s,BB(t,14));case 22:return sqn(a4(this)),void pX(a4(this),BB(t,14))}Lbn(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n),t)},MWn.zh=function(){return gWn(),r$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,179)&&(BB(this.Cb,179).tb=null),void Nrn(this,null);case 2:return Dsn(this,null),void xen(this,this.D);case 5:return void Yqn(this,null);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),void sqn(this.A);case 8:return void Jfn(this,!1);case 9:return void tln(this,!1);case 10:return void(this.u&&vqn(this.u));case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),void sqn(this.q);case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),void sqn(this.s);case 22:return void(this.n&&sqn(this.n))}qfn(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n))},MWn.Gh=function(){var n,t;if(YBn(this),RBn(this),WPn(this),gBn(this),qFn(this),CLn(this),HDn(this),a6(XB(P5(this))),this.s)for(n=0,t=this.s.i;n=0;--t)Wtn(this,t);return Qwn(this,n)},MWn.Xj=function(){sqn(this)},MWn.oi=function(n,t){return _en(this,n,t)},vX(y9n,"EcoreEList",622),wAn(496,622,R9n,yH),MWn.ai=function(){return!1},MWn.aj=function(){return this.c},MWn.bj=function(){return!1},MWn.Fk=function(){return!0},MWn.hi=function(){return!0},MWn.li=function(n,t){return t},MWn.ni=function(){return!1},MWn.c=0,vX(y9n,"EObjectEList",496),wAn(85,496,R9n,$L),MWn.bj=function(){return!0},MWn.Dk=function(){return!1},MWn.rk=function(){return!0},vX(y9n,"EObjectContainmentEList",85),wAn(545,85,R9n,LL),MWn.ci=function(){this.b=!0},MWn.fj=function(){return this.b},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.b,this.b=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.b=!1},MWn.b=!1,vX(y9n,"EObjectContainmentEList/Unsettable",545),wAn(1140,545,R9n,YG),MWn.ii=function(n,t){var e,i;return e=BB(Iln(this,n,t),87),mA(this.e)&&Lv(this,new j9(this.a,7,(gWn(),a$t),iln(t),cL(i=e.c,88)?BB(i,26):d$t,n)),e},MWn.jj=function(n,t){return Zwn(this,BB(n,87),t)},MWn.kj=function(n,t){return Jwn(this,BB(n,87),t)},MWn.lj=function(n,t,e){return _jn(this,BB(n,87),BB(t,87),e)},MWn.Zi=function(n,t,e,i,r){switch(n){case 3:return yZ(this,n,t,e,i,this.i>1);case 5:return yZ(this,n,t,e,i,this.i-BB(e,15).gc()>0);default:return new N7(this.e,n,this.c,t,e,i,!0)}},MWn.ij=function(){return!0},MWn.fj=function(){return Rvn(this)},MWn.Xj=function(){sqn(this)},vX(l6n,"EClassImpl/1",1140),wAn(1154,1153,Z8n),MWn.ui=function(n){var t,e,i,r,c,a,u;if(8!=(e=n.xi())){if(0==(i=apn(n)))switch(e){case 1:case 9:null!=(u=n.Bi())&&(!(t=P5(BB(u,473))).c&&(t.c=new Bo),snn(t.c,n.Ai())),null!=(a=n.zi())&&0==(1&(r=BB(a,473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),f9(t.c,BB(n.Ai(),26)));break;case 3:null!=(a=n.zi())&&0==(1&(r=BB(a,473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),f9(t.c,BB(n.Ai(),26)));break;case 5:if(null!=(a=n.zi()))for(c=BB(a,14).Kc();c.Ob();)0==(1&(r=BB(c.Pb(),473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),f9(t.c,BB(n.Ai(),26)));break;case 4:null!=(u=n.Bi())&&0==(1&(r=BB(u,473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),snn(t.c,n.Ai()));break;case 6:if(null!=(u=n.Bi()))for(c=BB(u,14).Kc();c.Ob();)0==(1&(r=BB(c.Pb(),473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),snn(t.c,n.Ai()))}this.Hk(i)}},MWn.Hk=function(n){dRn(this,n)},MWn.b=63,vX(l6n,"ESuperAdapter",1154),wAn(1155,1154,Z8n,dp),MWn.Hk=function(n){ACn(this,n)},vX(l6n,"EClassImpl/10",1155),wAn(1144,696,R9n),MWn.Vh=function(n,t){return BTn(this,n,t)},MWn.Wh=function(n){return bmn(this,n)},MWn.Xh=function(n,t){Ifn(this,n,t)},MWn.Yh=function(n){c6(this,n)},MWn.pi=function(n){return F9(this,n)},MWn.mi=function(n,t){return onn(this,n,t)},MWn.lk=function(n,t){throw Hp(new pv)},MWn.Zh=function(){return new ax(this)},MWn.$h=function(){return new ux(this)},MWn._h=function(n){return sin(this,n)},MWn.mk=function(n,t){throw Hp(new pv)},MWn.Wj=function(n){return this},MWn.fj=function(){return 0!=this.i},MWn.Wb=function(n){throw Hp(new pv)},MWn.Xj=function(){throw Hp(new pv)},vX(y9n,"EcoreEList/UnmodifiableEList",1144),wAn(319,1144,R9n,NO),MWn.ni=function(){return!1},vX(y9n,"EcoreEList/UnmodifiableEList/FastCompare",319),wAn(1147,319,R9n,don),MWn.Xc=function(n){var t,e;if(cL(n,170)&&-1!=(t=BB(n,170).aj()))for(e=this.i;t4){if(!this.wj(n))return!1;if(this.rk()){if(a=(t=(e=BB(n,49)).Ug())==this.b&&(this.Dk()?e.Og(e.Vg(),BB(itn(jY(this.b),this.aj()).Yj(),26).Bj())==Cvn(BB(itn(jY(this.b),this.aj()),18)).n:-1-e.Vg()==this.aj()),this.Ek()&&!a&&!t&&e.Zg())for(i=0;i1||-1==e)},MWn.Dk=function(){var n;return!!cL(n=itn(jY(this.b),this.aj()),99)&&!!Cvn(BB(n,18))},MWn.Ek=function(){var n;return!!cL(n=itn(jY(this.b),this.aj()),99)&&0!=(BB(n,18).Bb&BQn)},MWn.Xc=function(n){var t,e,i;if((e=this.Qi(n))>=0)return e;if(this.Fk())for(t=0,i=this.Vi();t=0;--n)eGn(this,n,this.Oi(n));return this.Wi()},MWn.Qc=function(n){var t;if(this.Ek())for(t=this.Vi()-1;t>=0;--t)eGn(this,t,this.Oi(t));return this.Xi(n)},MWn.Xj=function(){vqn(this)},MWn.oi=function(n,t){return B9(this,n,t)},vX(y9n,"DelegatingEcoreEList",742),wAn(1150,742,H9n,uR),MWn.Hi=function(n,t){lD(this,n,BB(t,26))},MWn.Ii=function(n){e$(this,BB(n,26))},MWn.Oi=function(n){var t;return cL(t=BB(Wtn(a4(this.a),n),87).c,88)?BB(t,26):(gWn(),d$t)},MWn.Ti=function(n){var t;return cL(t=BB(fDn(a4(this.a),n),87).c,88)?BB(t,26):(gWn(),d$t)},MWn.Ui=function(n,t){return dmn(this,n,BB(t,26))},MWn.ai=function(){return!1},MWn.Zi=function(n,t,e,i,r){return null},MWn.Ji=function(){return new pp(this)},MWn.Ki=function(){sqn(a4(this.a))},MWn.Li=function(n){return Ufn(this,n)},MWn.Mi=function(n){var t;for(t=n.Kc();t.Ob();)if(!Ufn(this,t.Pb()))return!1;return!0},MWn.Ni=function(n){var t,e,i;if(cL(n,15)&&(i=BB(n,15)).gc()==a4(this.a).i){for(t=i.Kc(),e=new AL(this);t.Ob();)if(GI(t.Pb())!==GI(kpn(e)))return!1;return!0}return!1},MWn.Pi=function(){var n,t,e,i;for(t=1,n=new AL(a4(this.a));n.e!=n.i.gc();)t=31*t+((e=cL(i=BB(kpn(n),87).c,88)?BB(i,26):(gWn(),d$t))?PN(e):0);return t},MWn.Qi=function(n){var t,e,i,r;for(i=0,e=new AL(a4(this.a));e.e!=e.i.gc();){if(t=BB(kpn(e),87),GI(n)===GI(cL(r=t.c,88)?BB(r,26):(gWn(),d$t)))return i;++i}return-1},MWn.Ri=function(){return 0==a4(this.a).i},MWn.Si=function(){return null},MWn.Vi=function(){return a4(this.a).i},MWn.Wi=function(){var n,t,e,i,r,c;for(c=a4(this.a).i,r=x8(Ant,HWn,1,c,5,1),e=0,t=new AL(a4(this.a));t.e!=t.i.gc();)n=BB(kpn(t),87),r[e++]=cL(i=n.c,88)?BB(i,26):(gWn(),d$t);return r},MWn.Xi=function(n){var t,e,i,r;for(r=a4(this.a).i,n.lengthr&&$X(n,r,null),e=0,t=new AL(a4(this.a));t.e!=t.i.gc();)$X(n,e++,cL(i=BB(kpn(t),87).c,88)?BB(i,26):(gWn(),d$t));return n},MWn.Yi=function(){var n,t,e,i,r;for((r=new Sk).a+="[",n=a4(this.a),t=0,i=a4(this.a).i;t>16)>=0?fyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,6,e);case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),Ywn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),o$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),o$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 6:return T_n(this,null,6,e);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),_pn(this.A,n,e);case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),_pn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),o$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),o$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.D&&this.D==this.F;case 3:return!!iyn(this);case 4:return!!Qsn(this);case 5:return null!=this.F&&this.F!=this.D&&this.F!=this.B;case 6:return!!wZ(this);case 7:return!!this.A&&0!=this.A.i;case 8:return 0==(256&this.Bb);case 9:return!!this.a&&0!=this.a.i}return O3(this,n-bX((gWn(),o$t)),itn(BB(yan(this,16),26)||o$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void ZZ(this,SD(t));case 2:return void IA(this,SD(t));case 5:return void Yqn(this,SD(t));case 7:return!this.A&&(this.A=new NL(O$t,this,7)),sqn(this.A),!this.A&&(this.A=new NL(O$t,this,7)),void pX(this.A,BB(t,14));case 8:return void Zfn(this,qy(TD(t)));case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),sqn(this.a),!this.a&&(this.a=new eU(WAt,this,9,5)),void pX(this.a,BB(t,14))}Lbn(this,n-bX((gWn(),o$t)),itn(BB(yan(this,16),26)||o$t,n),t)},MWn.zh=function(){return gWn(),o$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,179)&&(BB(this.Cb,179).tb=null),void Nrn(this,null);case 2:return Dsn(this,null),void xen(this,this.D);case 5:return void Yqn(this,null);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),void sqn(this.A);case 8:return void Zfn(this,!0);case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),void sqn(this.a)}qfn(this,n-bX((gWn(),o$t)),itn(BB(yan(this,16),26)||o$t,n))},MWn.Gh=function(){var n,t;if(this.a)for(n=0,t=this.a.i;n>16==5?BB(this.Cb,671):null}return U9(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 5:return this.Cb&&(e=(i=this.Db>>16)>=0?lkn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,5,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),s$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),s$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 5:return T_n(this,null,5,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),s$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),s$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0!=this.d;case 3:return!!this.b;case 4:return null!=this.c;case 5:return!(this.Db>>16!=5||!BB(this.Cb,671))}return O3(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return void $en(this,BB(t,19).a);case 3:return void gOn(this,BB(t,1940));case 4:return void Fin(this,SD(t))}Lbn(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n),t)},MWn.zh=function(){return gWn(),s$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return void $en(this,0);case 3:return void gOn(this,null);case 4:return void Fin(this,null)}qfn(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n))},MWn.Ib=function(){var n;return null==(n=this.c)?this.zb:n},MWn.b=null,MWn.c=null,MWn.d=0,vX(l6n,"EEnumLiteralImpl",573);var L$t,N$t,x$t,D$t=bq(l6n,"EFactoryImpl/InternalEDateTimeFormat");wAn(489,1,{2015:1},vp),vX(l6n,"EFactoryImpl/1ClientInternalEDateTimeFormat",489),wAn(241,115,{105:1,92:1,90:1,87:1,56:1,108:1,49:1,97:1,241:1,114:1,115:1},Kp),MWn.Sg=function(n,t,e){var i;return e=T_n(this,n,t,e),this.e&&cL(n,170)&&(i=kLn(this,this.e))!=this.c&&(e=azn(this,i,e)),e},MWn._g=function(n,t,e){switch(n){case 0:return this.f;case 1:return!this.d&&(this.d=new $L(VAt,this,1)),this.d;case 2:return t?lFn(this):this.c;case 3:return this.b;case 4:return this.e;case 5:return t?qvn(this):this.a}return U9(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return nfn(this,null,e);case 1:return!this.d&&(this.d=new $L(VAt,this,1)),_pn(this.d,n,e);case 3:return Zhn(this,null,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),f$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),f$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.f;case 1:return!!this.d&&0!=this.d.i;case 2:return!!this.c;case 3:return!!this.b;case 4:return!!this.e;case 5:return!!this.a}return O3(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n))},MWn.sh=function(n,t){switch(n){case 0:return void jEn(this,BB(t,87));case 1:return!this.d&&(this.d=new $L(VAt,this,1)),sqn(this.d),!this.d&&(this.d=new $L(VAt,this,1)),void pX(this.d,BB(t,14));case 3:return void kEn(this,BB(t,87));case 4:return void DMn(this,BB(t,836));case 5:return void cen(this,BB(t,138))}Lbn(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n),t)},MWn.zh=function(){return gWn(),f$t},MWn.Bh=function(n){switch(n){case 0:return void jEn(this,null);case 1:return!this.d&&(this.d=new $L(VAt,this,1)),void sqn(this.d);case 3:return void kEn(this,null);case 4:return void DMn(this,null);case 5:return void cen(this,null)}qfn(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n))},MWn.Ib=function(){var n;return(n=new lN(P$n(this))).a+=" (expression: ",bHn(this,n),n.a+=")",n.a},vX(l6n,"EGenericTypeImpl",241),wAn(1969,1964,q9n),MWn.Xh=function(n,t){nR(this,n,t)},MWn.lk=function(n,t){return nR(this,this.gc(),n),t},MWn.pi=function(n){return Dpn(this.Gi(),n)},MWn.Zh=function(){return this.$h()},MWn.Gi=function(){return new Pp(this)},MWn.$h=function(){return this._h(0)},MWn._h=function(n){return this.Gi().Zc(n)},MWn.mk=function(n,t){return ywn(this,n,!0),t},MWn.ii=function(n,t){var e;return e=tkn(this,t),this.Zc(n).Rb(e),e},MWn.ji=function(n,t){ywn(this,t,!0),this.Zc(n).Rb(t)},vX(y9n,"AbstractSequentialInternalEList",1969),wAn(486,1969,q9n,QN),MWn.pi=function(n){return Dpn(this.Gi(),n)},MWn.Zh=function(){return null==this.b?(YM(),YM(),x$t):this.Jk()},MWn.Gi=function(){return new DO(this.a,this.b)},MWn.$h=function(){return null==this.b?(YM(),YM(),x$t):this.Jk()},MWn._h=function(n){var t,e;if(null==this.b){if(n<0||n>1)throw Hp(new Ay(e9n+n+", size=0"));return YM(),YM(),x$t}for(e=this.Jk(),t=0;t0;)if(t=this.c[--this.d],(!this.e||t.Gj()!=NOt||0!=t.aj())&&(!this.Mk()||this.b.mh(t)))if(c=this.b.bh(t,this.Lk()),this.f=(ZM(),BB(t,66).Oj()),this.f||t.$j()){if(this.Lk()?(i=BB(c,15),this.k=i):(i=BB(c,69),this.k=this.j=i),cL(this.k,54)?(this.o=this.k.gc(),this.n=this.o):this.p=this.j?this.j._h(this.k.gc()):this.k.Zc(this.k.gc()),this.p?jPn(this,this.p):wCn(this))return r=this.p?this.p.Ub():this.j?this.j.pi(--this.n):this.k.Xb(--this.n),this.f?((n=BB(r,72)).ak(),e=n.dd(),this.i=e):(e=r,this.i=e),this.g=-3,!0}else if(null!=c)return this.k=null,this.p=null,e=c,this.i=e,this.g=-2,!0;return this.k=null,this.p=null,this.g=-1,!1}},MWn.Pb=function(){return Man(this)},MWn.Tb=function(){return this.a},MWn.Ub=function(){var n;if(this.g<-1||this.Sb())return--this.a,this.g=0,n=this.i,this.Sb(),n;throw Hp(new yv)},MWn.Vb=function(){return this.a-1},MWn.Qb=function(){throw Hp(new pv)},MWn.Lk=function(){return!1},MWn.Wb=function(n){throw Hp(new pv)},MWn.Mk=function(){return!0},MWn.a=0,MWn.d=0,MWn.f=!1,MWn.g=0,MWn.n=0,MWn.o=0,vX(y9n,"EContentsEList/FeatureIteratorImpl",279),wAn(697,279,G9n,Vx),MWn.Lk=function(){return!0},vX(y9n,"EContentsEList/ResolvingFeatureIteratorImpl",697),wAn(1157,697,G9n,Yx),MWn.Mk=function(){return!1},vX(l6n,"ENamedElementImpl/1/1",1157),wAn(1158,279,G9n,Qx),MWn.Mk=function(){return!1},vX(l6n,"ENamedElementImpl/1/2",1158),wAn(36,143,t9n,f4,l4,nU,k9,N7,t6,Hen,S0,qen,P0,J5,C0,Uen,I0,Z5,O0,Gen,A0,tU,j9,GQ,zen,$0,n6,L0),MWn._i=function(){return h9(this)},MWn.gj=function(){var n;return(n=h9(this))?n.zj():null},MWn.yi=function(n){return-1==this.b&&this.a&&(this.b=this.c.Xg(this.a.aj(),this.a.Gj())),this.c.Og(this.b,n)},MWn.Ai=function(){return this.c},MWn.hj=function(){var n;return!!(n=h9(this))&&n.Kj()},MWn.b=-1,vX(l6n,"ENotificationImpl",36),wAn(399,284,{105:1,92:1,90:1,147:1,191:1,56:1,59:1,108:1,472:1,49:1,97:1,150:1,399:1,284:1,114:1,115:1},$m),MWn.Qg=function(n){return Pkn(this,n)},MWn._g=function(n,t,e){var i;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),(i=this.t)>1||-1==i;case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return this.Db>>16==10?BB(this.Cb,26):null;case 11:return!this.d&&(this.d=new NL(O$t,this,11)),this.d;case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),this.c;case 13:return!this.a&&(this.a=new oR(this,this)),this.a;case 14:return H7(this)}return U9(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 10:return this.Cb&&(e=(i=this.Db>>16)>=0?Pkn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,10,e);case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),Ywn(this.c,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),g$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),g$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e);case 10:return T_n(this,null,10,e);case 11:return!this.d&&(this.d=new NL(O$t,this,11)),_pn(this.d,n,e);case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),_pn(this.c,n,e);case 14:return _pn(H7(this),n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),g$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),g$t)),n,e)},MWn.lh=function(n){var t;switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return(t=this.t)>1||-1==t;case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return!(this.Db>>16!=10||!BB(this.Cb,26));case 11:return!!this.d&&0!=this.d.i;case 12:return!!this.c&&0!=this.c.i;case 13:return!(!this.a||0==H7(this.a.a).i||this.b&&Kvn(this.b));case 14:return!!this.b&&Kvn(this.b)}return O3(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void Nen(this,BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 11:return!this.d&&(this.d=new NL(O$t,this,11)),sqn(this.d),!this.d&&(this.d=new NL(O$t,this,11)),void pX(this.d,BB(t,14));case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),sqn(this.c),!this.c&&(this.c=new eU(YAt,this,12,10)),void pX(this.c,BB(t,14));case 13:return!this.a&&(this.a=new oR(this,this)),vqn(this.a),!this.a&&(this.a=new oR(this,this)),void pX(this.a,BB(t,14));case 14:return sqn(H7(this)),void pX(H7(this),BB(t,14))}Lbn(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n),t)},MWn.zh=function(){return gWn(),g$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void Nen(this,1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 11:return!this.d&&(this.d=new NL(O$t,this,11)),void sqn(this.d);case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),void sqn(this.c);case 13:return void(this.a&&vqn(this.a));case 14:return void(this.b&&sqn(this.b))}qfn(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n))},MWn.Gh=function(){var n,t;if(this.c)for(n=0,t=this.c.i;ni&&$X(n,i,null),e=0,t=new AL(H7(this.a));t.e!=t.i.gc();)$X(n,e++,BB(kpn(t),87).c||(gWn(),l$t));return n},MWn.Yi=function(){var n,t,e,i;for((i=new Sk).a+="[",n=H7(this.a),t=0,e=H7(this.a).i;t1);case 5:return yZ(this,n,t,e,i,this.i-BB(e,15).gc()>0);default:return new N7(this.e,n,this.c,t,e,i,!0)}},MWn.ij=function(){return!0},MWn.fj=function(){return Kvn(this)},MWn.Xj=function(){sqn(this)},vX(l6n,"EOperationImpl/2",1341),wAn(498,1,{1938:1,498:1},OI),vX(l6n,"EPackageImpl/1",498),wAn(16,85,R9n,eU),MWn.zk=function(){return this.d},MWn.Ak=function(){return this.b},MWn.Dk=function(){return!0},MWn.b=0,vX(y9n,"EObjectContainmentWithInverseEList",16),wAn(353,16,R9n,eK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentWithInverseEList/Resolving",353),wAn(298,353,R9n,Jz),MWn.ci=function(){this.a.tb=null},vX(l6n,"EPackageImpl/2",298),wAn(1228,1,{},Oo),vX(l6n,"EPackageImpl/3",1228),wAn(718,43,tYn,Nm),MWn._b=function(n){return XI(n)?eY(this,n):!!AY(this.f,n)},vX(l6n,"EPackageRegistryImpl",718),wAn(509,284,{105:1,92:1,90:1,147:1,191:1,56:1,2017:1,108:1,472:1,49:1,97:1,150:1,509:1,284:1,114:1,115:1},Lm),MWn.Qg=function(n){return Ckn(this,n)},MWn._g=function(n,t,e){var i;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),(i=this.t)>1||-1==i;case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return this.Db>>16==10?BB(this.Cb,59):null}return U9(this,n-bX((gWn(),m$t)),itn(BB(yan(this,16),26)||m$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 10:return this.Cb&&(e=(i=this.Db>>16)>=0?Ckn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,10,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),m$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),m$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e);case 10:return T_n(this,null,10,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),m$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),m$t)),n,e)},MWn.lh=function(n){var t;switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return(t=this.t)>1||-1==t;case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return!(this.Db>>16!=10||!BB(this.Cb,59))}return O3(this,n-bX((gWn(),m$t)),itn(BB(yan(this,16),26)||m$t,n))},MWn.zh=function(){return gWn(),m$t},vX(l6n,"EParameterImpl",509),wAn(99,449,{105:1,92:1,90:1,147:1,191:1,56:1,18:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,99:1,449:1,284:1,114:1,115:1,677:1},pD),MWn._g=function(n,t,e){var i,r;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),(r=this.t)>1||-1==r;case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return hN(),0!=(this.Bb&k6n);case 11:return hN(),0!=(this.Bb&M9n);case 12:return hN(),0!=(this.Bb&_Qn);case 13:return this.j;case 14:return qLn(this);case 15:return hN(),0!=(this.Bb&T9n);case 16:return hN(),0!=(this.Bb&hVn);case 17:return dZ(this);case 18:return hN(),0!=(this.Bb&h6n);case 19:return hN(),!(!(i=Cvn(this))||0==(i.Bb&h6n));case 20:return hN(),0!=(this.Bb&BQn);case 21:return t?Cvn(this):this.b;case 22:return t?Ion(this):K5(this);case 23:return!this.a&&(this.a=new RL(BAt,this,23)),this.a}return U9(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n),t,e)},MWn.lh=function(n){var t,e;switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return(e=this.t)>1||-1==e;case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return 0==(this.Bb&k6n);case 11:return 0!=(this.Bb&M9n);case 12:return 0!=(this.Bb&_Qn);case 13:return null!=this.j;case 14:return null!=qLn(this);case 15:return 0!=(this.Bb&T9n);case 16:return 0!=(this.Bb&hVn);case 17:return!!dZ(this);case 18:return 0!=(this.Bb&h6n);case 19:return!!(t=Cvn(this))&&0!=(t.Bb&h6n);case 20:return 0==(this.Bb&BQn);case 21:return!!this.b;case 22:return!!K5(this);case 23:return!!this.a&&0!=this.a.i}return O3(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void JZ(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void Nen(this,BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 10:return void Aln(this,qy(TD(t)));case 11:return void Nln(this,qy(TD(t)));case 12:return void $ln(this,qy(TD(t)));case 13:return void _I(this,SD(t));case 15:return void Lln(this,qy(TD(t)));case 16:return void qln(this,qy(TD(t)));case 18:return void YZ(this,qy(TD(t)));case 20:return void Uln(this,qy(TD(t)));case 21:return void rrn(this,BB(t,18));case 23:return!this.a&&(this.a=new RL(BAt,this,23)),sqn(this.a),!this.a&&(this.a=new RL(BAt,this,23)),void pX(this.a,BB(t,14))}Lbn(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n),t)},MWn.zh=function(){return gWn(),y$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),4),void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void Nen(this,1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 10:return void Aln(this,!0);case 11:return void Nln(this,!1);case 12:return void $ln(this,!1);case 13:return this.i=null,void arn(this,null);case 15:return void Lln(this,!1);case 16:return void qln(this,!1);case 18:return zln(this,!1),void(cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),2));case 20:return void Uln(this,!0);case 21:return void rrn(this,null);case 23:return!this.a&&(this.a=new RL(BAt,this,23)),void sqn(this.a)}qfn(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n))},MWn.Gh=function(){Ion(this),kV(B7((IPn(),Z$t),this)),Ikn(this),this.Bb|=1},MWn.Lj=function(){return Cvn(this)},MWn.qk=function(){var n;return!!(n=Cvn(this))&&0!=(n.Bb&h6n)},MWn.rk=function(){return 0!=(this.Bb&h6n)},MWn.sk=function(){return 0!=(this.Bb&BQn)},MWn.nk=function(n,t){return this.c=null,Pfn(this,n,t)},MWn.Ib=function(){var n;return 0!=(64&this.Db)?ERn(this):((n=new fN(ERn(this))).a+=" (containment: ",yE(n,0!=(this.Bb&h6n)),n.a+=", resolveProxies: ",yE(n,0!=(this.Bb&BQn)),n.a+=")",n.a)},vX(l6n,"EReferenceImpl",99),wAn(548,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,548:1,114:1,115:1},Ao),MWn.Fb=function(n){return this===n},MWn.cd=function(){return this.b},MWn.dd=function(){return this.c},MWn.Hb=function(){return PN(this)},MWn.Uh=function(n){vq(this,SD(n))},MWn.ed=function(n){return $H(this,SD(n))},MWn._g=function(n,t,e){switch(n){case 0:return this.b;case 1:return this.c}return U9(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n),t,e)},MWn.lh=function(n){switch(n){case 0:return null!=this.b;case 1:return null!=this.c}return O3(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n))},MWn.sh=function(n,t){switch(n){case 0:return void mq(this,SD(t));case 1:return void Kin(this,SD(t))}Lbn(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n),t)},MWn.zh=function(){return gWn(),k$t},MWn.Bh=function(n){switch(n){case 0:return void Rin(this,null);case 1:return void Kin(this,null)}qfn(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n))},MWn.Sh=function(){var n;return-1==this.a&&(n=this.b,this.a=null==n?0:vvn(n)),this.a},MWn.Th=function(n){this.a=n},MWn.Ib=function(){var n;return 0!=(64&this.Db)?P$n(this):((n=new fN(P$n(this))).a+=" (key: ",cO(n,this.b),n.a+=", value: ",cO(n,this.c),n.a+=")",n.a)},MWn.a=-1,MWn.b=null,MWn.c=null;var R$t,K$t,_$t,F$t,B$t,H$t,q$t,G$t,z$t,U$t,X$t=vX(l6n,"EStringToStringMapEntryImpl",548),W$t=bq(y9n,"FeatureMap/Entry/Internal");wAn(565,1,z9n),MWn.Ok=function(n){return this.Pk(BB(n,49))},MWn.Pk=function(n){return this.Ok(n)},MWn.Fb=function(n){var t,e;return this===n||!!cL(n,72)&&(t=BB(n,72)).ak()==this.c&&(null==(e=this.dd())?null==t.dd():Nfn(e,t.dd()))},MWn.ak=function(){return this.c},MWn.Hb=function(){var n;return n=this.dd(),nsn(this.c)^(null==n?0:nsn(n))},MWn.Ib=function(){var n,t;return t=Utn((n=this.c).Hj()).Ph(),n.ne(),(null!=t&&0!=t.length?t+":"+n.ne():n.ne())+"="+this.dd()},vX(l6n,"EStructuralFeatureImpl/BasicFeatureMapEntry",565),wAn(776,565,z9n,rR),MWn.Pk=function(n){return new rR(this.c,n)},MWn.dd=function(){return this.a},MWn.Qk=function(n,t,e){return Scn(this,n,this.a,t,e)},MWn.Rk=function(n,t,e){return Pcn(this,n,this.a,t,e)},vX(l6n,"EStructuralFeatureImpl/ContainmentUpdatingFeatureMapEntry",776),wAn(1314,1,{},AI),MWn.Pj=function(n,t,e,i,r){return BB(S9(n,this.b),215).nl(this.a).Wj(i)},MWn.Qj=function(n,t,e,i,r){return BB(S9(n,this.b),215).el(this.a,i,r)},MWn.Rj=function(n,t,e,i,r){return BB(S9(n,this.b),215).fl(this.a,i,r)},MWn.Sj=function(n,t,e){return BB(S9(n,this.b),215).nl(this.a).fj()},MWn.Tj=function(n,t,e,i){BB(S9(n,this.b),215).nl(this.a).Wb(i)},MWn.Uj=function(n,t,e){return BB(S9(n,this.b),215).nl(this.a)},MWn.Vj=function(n,t,e){BB(S9(n,this.b),215).nl(this.a).Xj()},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateFeatureMapDelegator",1314),wAn(89,1,{},PB,lQ,RY,w4),MWn.Pj=function(n,t,e,i,r){var c;if(null==(c=t.Ch(e))&&t.Dh(e,c=iWn(this,n)),!r)switch(this.e){case 50:case 41:return BB(c,589).sj();case 40:return BB(c,215).kl()}return c},MWn.Qj=function(n,t,e,i,r){var c;return null==(c=t.Ch(e))&&t.Dh(e,c=iWn(this,n)),BB(c,69).lk(i,r)},MWn.Rj=function(n,t,e,i,r){var c;return null!=(c=t.Ch(e))&&(r=BB(c,69).mk(i,r)),r},MWn.Sj=function(n,t,e){var i;return null!=(i=t.Ch(e))&&BB(i,76).fj()},MWn.Tj=function(n,t,e,i){var r;!(r=BB(t.Ch(e),76))&&t.Dh(e,r=iWn(this,n)),r.Wb(i)},MWn.Uj=function(n,t,e){var i;return null==(i=t.Ch(e))&&t.Dh(e,i=iWn(this,n)),cL(i,76)?BB(i,76):new Ep(BB(t.Ch(e),15))},MWn.Vj=function(n,t,e){var i;!(i=BB(t.Ch(e),76))&&t.Dh(e,i=iWn(this,n)),i.Xj()},MWn.b=0,MWn.e=0,vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateMany",89),wAn(504,1,{}),MWn.Qj=function(n,t,e,i,r){throw Hp(new pv)},MWn.Rj=function(n,t,e,i,r){throw Hp(new pv)},MWn.Uj=function(n,t,e){return new bQ(this,n,t,e)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingle",504),wAn(1331,1,k9n,bQ),MWn.Wj=function(n){return this.a.Pj(this.c,this.d,this.b,n,!0)},MWn.fj=function(){return this.a.Sj(this.c,this.d,this.b)},MWn.Wb=function(n){this.a.Tj(this.c,this.d,this.b,n)},MWn.Xj=function(){this.a.Vj(this.c,this.d,this.b)},MWn.b=0,vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingle/1",1331),wAn(769,504,{},mJ),MWn.Pj=function(n,t,e,i,r){return gKn(n,n.eh(),n.Vg())==this.b?this.sk()&&i?cAn(n):n.eh():null},MWn.Qj=function(n,t,e,i,r){var c,a;return n.eh()&&(r=(c=n.Vg())>=0?n.Qg(r):n.eh().ih(n,-1-c,null,r)),a=Awn(n.Tg(),this.e),n.Sg(i,a,r)},MWn.Rj=function(n,t,e,i,r){var c;return c=Awn(n.Tg(),this.e),n.Sg(null,c,r)},MWn.Sj=function(n,t,e){var i;return i=Awn(n.Tg(),this.e),!!n.eh()&&n.Vg()==i},MWn.Tj=function(n,t,e,i){var r,c,a,u,o;if(null!=i&&!SFn(this.a,i))throw Hp(new Ky(U9n+(cL(i,56)?dEn(BB(i,56).Tg()):utn(tsn(i)))+X9n+this.a+"'"));if(r=n.eh(),a=Awn(n.Tg(),this.e),GI(i)!==GI(r)||n.Vg()!=a&&null!=i){if(vkn(n,BB(i,56)))throw Hp(new _y(w6n+n.Ib()));o=null,r&&(o=(c=n.Vg())>=0?n.Qg(o):n.eh().ih(n,-1-c,null,o)),(u=BB(i,49))&&(o=u.gh(n,Awn(u.Tg(),this.b),null,o)),(o=n.Sg(u,a,o))&&o.Fi()}else n.Lg()&&n.Mg()&&ban(n,new nU(n,1,a,i,i))},MWn.Vj=function(n,t,e){var i,r,c;n.eh()?(c=(i=n.Vg())>=0?n.Qg(null):n.eh().ih(n,-1-i,null,null),r=Awn(n.Tg(),this.e),(c=n.Sg(null,r,c))&&c.Fi()):n.Lg()&&n.Mg()&&ban(n,new tU(n,1,this.e,null,null))},MWn.sk=function(){return!1},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleContainer",769),wAn(1315,769,{},CB),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleContainerResolving",1315),wAn(563,504,{}),MWn.Pj=function(n,t,e,i,r){var c;return null==(c=t.Ch(e))?this.b:GI(c)===GI(R$t)?null:c},MWn.Sj=function(n,t,e){var i;return null!=(i=t.Ch(e))&&(GI(i)===GI(R$t)||!Nfn(i,this.b))},MWn.Tj=function(n,t,e,i){var r,c;n.Lg()&&n.Mg()?(r=null==(c=t.Ch(e))?this.b:GI(c)===GI(R$t)?null:c,null==i?null!=this.c?(t.Dh(e,null),i=this.b):null!=this.b?t.Dh(e,R$t):t.Dh(e,null):(this.Sk(i),t.Dh(e,i)),ban(n,this.d.Tk(n,1,this.e,r,i))):null==i?null!=this.c?t.Dh(e,null):null!=this.b?t.Dh(e,R$t):t.Dh(e,null):(this.Sk(i),t.Dh(e,i))},MWn.Vj=function(n,t,e){var i,r;n.Lg()&&n.Mg()?(i=null==(r=t.Ch(e))?this.b:GI(r)===GI(R$t)?null:r,t.Eh(e),ban(n,this.d.Tk(n,1,this.e,i,this.b))):t.Eh(e)},MWn.Sk=function(n){throw Hp(new bv)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData",563),wAn(W9n,1,{},$o),MWn.Tk=function(n,t,e,i,r){return new tU(n,t,e,i,r)},MWn.Uk=function(n,t,e,i,r,c){return new GQ(n,t,e,i,r,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator",W9n),wAn(1332,W9n,{},Lo),MWn.Tk=function(n,t,e,i,r){return new n6(n,t,e,qy(TD(i)),qy(TD(r)))},MWn.Uk=function(n,t,e,i,r,c){return new L0(n,t,e,qy(TD(i)),qy(TD(r)),c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/1",1332),wAn(1333,W9n,{},No),MWn.Tk=function(n,t,e,i,r){return new Hen(n,t,e,BB(i,217).a,BB(r,217).a)},MWn.Uk=function(n,t,e,i,r,c){return new S0(n,t,e,BB(i,217).a,BB(r,217).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/2",1333),wAn(1334,W9n,{},xo),MWn.Tk=function(n,t,e,i,r){return new qen(n,t,e,BB(i,172).a,BB(r,172).a)},MWn.Uk=function(n,t,e,i,r,c){return new P0(n,t,e,BB(i,172).a,BB(r,172).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/3",1334),wAn(1335,W9n,{},Do),MWn.Tk=function(n,t,e,i,r){return new J5(n,t,e,Gy(MD(i)),Gy(MD(r)))},MWn.Uk=function(n,t,e,i,r,c){return new C0(n,t,e,Gy(MD(i)),Gy(MD(r)),c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/4",1335),wAn(1336,W9n,{},Ro),MWn.Tk=function(n,t,e,i,r){return new Uen(n,t,e,BB(i,155).a,BB(r,155).a)},MWn.Uk=function(n,t,e,i,r,c){return new I0(n,t,e,BB(i,155).a,BB(r,155).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/5",1336),wAn(1337,W9n,{},Ko),MWn.Tk=function(n,t,e,i,r){return new Z5(n,t,e,BB(i,19).a,BB(r,19).a)},MWn.Uk=function(n,t,e,i,r,c){return new O0(n,t,e,BB(i,19).a,BB(r,19).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/6",1337),wAn(1338,W9n,{},_o),MWn.Tk=function(n,t,e,i,r){return new Gen(n,t,e,BB(i,162).a,BB(r,162).a)},MWn.Uk=function(n,t,e,i,r,c){return new A0(n,t,e,BB(i,162).a,BB(r,162).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/7",1338),wAn(1339,W9n,{},Fo),MWn.Tk=function(n,t,e,i,r){return new zen(n,t,e,BB(i,184).a,BB(r,184).a)},MWn.Uk=function(n,t,e,i,r,c){return new $0(n,t,e,BB(i,184).a,BB(r,184).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/8",1339),wAn(1317,563,{},wQ),MWn.Sk=function(n){if(!this.a.wj(n))throw Hp(new Ky(U9n+tsn(n)+X9n+this.a+"'"))},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataDynamic",1317),wAn(1318,563,{},ZG),MWn.Sk=function(n){},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataStatic",1318),wAn(770,563,{}),MWn.Sj=function(n,t,e){return null!=t.Ch(e)},MWn.Tj=function(n,t,e,i){var r,c;n.Lg()&&n.Mg()?(r=!0,null==(c=t.Ch(e))?(r=!1,c=this.b):GI(c)===GI(R$t)&&(c=null),null==i?null!=this.c?(t.Dh(e,null),i=this.b):t.Dh(e,R$t):(this.Sk(i),t.Dh(e,i)),ban(n,this.d.Uk(n,1,this.e,c,i,!r))):null==i?null!=this.c?t.Dh(e,null):t.Dh(e,R$t):(this.Sk(i),t.Dh(e,i))},MWn.Vj=function(n,t,e){var i,r;n.Lg()&&n.Mg()?(i=!0,null==(r=t.Ch(e))?(i=!1,r=this.b):GI(r)===GI(R$t)&&(r=null),t.Eh(e),ban(n,this.d.Uk(n,2,this.e,r,this.b,i))):t.Eh(e)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettable",770),wAn(1319,770,{},dQ),MWn.Sk=function(n){if(!this.a.wj(n))throw Hp(new Ky(U9n+tsn(n)+X9n+this.a+"'"))},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableDynamic",1319),wAn(1320,770,{},nz),MWn.Sk=function(n){},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableStatic",1320),wAn(398,504,{},cG),MWn.Pj=function(n,t,e,i,r){var c,a,u,o,s;if(s=t.Ch(e),this.Kj()&&GI(s)===GI(R$t))return null;if(this.sk()&&i&&null!=s){if((u=BB(s,49)).kh()&&u!=(o=tfn(n,u))){if(!SFn(this.a,o))throw Hp(new Ky(U9n+tsn(o)+X9n+this.a+"'"));t.Dh(e,s=o),this.rk()&&(c=BB(o,49),a=u.ih(n,this.b?Awn(u.Tg(),this.b):-1-Awn(n.Tg(),this.e),null,null),!c.eh()&&(a=c.gh(n,this.b?Awn(c.Tg(),this.b):-1-Awn(n.Tg(),this.e),null,a)),a&&a.Fi()),n.Lg()&&n.Mg()&&ban(n,new tU(n,9,this.e,u,o))}return s}return s},MWn.Qj=function(n,t,e,i,r){var c,a;return GI(a=t.Ch(e))===GI(R$t)&&(a=null),t.Dh(e,i),this.bj()?GI(a)!==GI(i)&&null!=a&&(r=(c=BB(a,49)).ih(n,Awn(c.Tg(),this.b),null,r)):this.rk()&&null!=a&&(r=BB(a,49).ih(n,-1-Awn(n.Tg(),this.e),null,r)),n.Lg()&&n.Mg()&&(!r&&(r=new Fj(4)),r.Ei(new tU(n,1,this.e,a,i))),r},MWn.Rj=function(n,t,e,i,r){var c;return GI(c=t.Ch(e))===GI(R$t)&&(c=null),t.Eh(e),n.Lg()&&n.Mg()&&(!r&&(r=new Fj(4)),this.Kj()?r.Ei(new tU(n,2,this.e,c,null)):r.Ei(new tU(n,1,this.e,c,null))),r},MWn.Sj=function(n,t,e){return null!=t.Ch(e)},MWn.Tj=function(n,t,e,i){var r,c,a,u,o;if(null!=i&&!SFn(this.a,i))throw Hp(new Ky(U9n+(cL(i,56)?dEn(BB(i,56).Tg()):utn(tsn(i)))+X9n+this.a+"'"));u=null!=(o=t.Ch(e)),this.Kj()&&GI(o)===GI(R$t)&&(o=null),a=null,this.bj()?GI(o)!==GI(i)&&(null!=o&&(a=(r=BB(o,49)).ih(n,Awn(r.Tg(),this.b),null,a)),null!=i&&(a=(r=BB(i,49)).gh(n,Awn(r.Tg(),this.b),null,a))):this.rk()&&GI(o)!==GI(i)&&(null!=o&&(a=BB(o,49).ih(n,-1-Awn(n.Tg(),this.e),null,a)),null!=i&&(a=BB(i,49).gh(n,-1-Awn(n.Tg(),this.e),null,a))),null==i&&this.Kj()?t.Dh(e,R$t):t.Dh(e,i),n.Lg()&&n.Mg()?(c=new GQ(n,1,this.e,o,i,this.Kj()&&!u),a?(a.Ei(c),a.Fi()):ban(n,c)):a&&a.Fi()},MWn.Vj=function(n,t,e){var i,r,c,a,u;a=null!=(u=t.Ch(e)),this.Kj()&&GI(u)===GI(R$t)&&(u=null),c=null,null!=u&&(this.bj()?c=(i=BB(u,49)).ih(n,Awn(i.Tg(),this.b),null,c):this.rk()&&(c=BB(u,49).ih(n,-1-Awn(n.Tg(),this.e),null,c))),t.Eh(e),n.Lg()&&n.Mg()?(r=new GQ(n,this.Kj()?2:1,this.e,u,null,a),c?(c.Ei(r),c.Fi()):ban(n,r)):c&&c.Fi()},MWn.bj=function(){return!1},MWn.rk=function(){return!1},MWn.sk=function(){return!1},MWn.Kj=function(){return!1},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObject",398),wAn(564,398,{},Zx),MWn.rk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainment",564),wAn(1323,564,{},nD),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentResolving",1323),wAn(772,564,{},tD),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettable",772),wAn(1325,772,{},eD),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettableResolving",1325),wAn(640,564,{},IB),MWn.bj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverse",640),wAn(1324,640,{},$B),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseResolving",1324),wAn(773,640,{},LB),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettable",773),wAn(1326,773,{},NB),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettableResolving",1326),wAn(641,398,{},iD),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolving",641),wAn(1327,641,{},rD),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingUnsettable",1327),wAn(774,641,{},OB),MWn.bj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverse",774),wAn(1328,774,{},xB),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverseUnsettable",1328),wAn(1321,398,{},cD),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectUnsettable",1321),wAn(771,398,{},AB),MWn.bj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverse",771),wAn(1322,771,{},DB),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverseUnsettable",1322),wAn(775,565,z9n,aW),MWn.Pk=function(n){return new aW(this.a,this.c,n)},MWn.dd=function(){return this.b},MWn.Qk=function(n,t,e){return D8(this,n,this.b,e)},MWn.Rk=function(n,t,e){return R8(this,n,this.b,e)},vX(l6n,"EStructuralFeatureImpl/InverseUpdatingFeatureMapEntry",775),wAn(1329,1,k9n,Ep),MWn.Wj=function(n){return this.a},MWn.fj=function(){return cL(this.a,95)?BB(this.a,95).fj():!this.a.dc()},MWn.Wb=function(n){this.a.$b(),this.a.Gc(BB(n,15))},MWn.Xj=function(){cL(this.a,95)?BB(this.a,95).Xj():this.a.$b()},vX(l6n,"EStructuralFeatureImpl/SettingMany",1329),wAn(1330,565,z9n,g4),MWn.Ok=function(n){return new cR((Uqn(),FLt),this.b.Ih(this.a,n))},MWn.dd=function(){return null},MWn.Qk=function(n,t,e){return e},MWn.Rk=function(n,t,e){return e},vX(l6n,"EStructuralFeatureImpl/SimpleContentFeatureMapEntry",1330),wAn(642,565,z9n,cR),MWn.Ok=function(n){return new cR(this.c,n)},MWn.dd=function(){return this.a},MWn.Qk=function(n,t,e){return e},MWn.Rk=function(n,t,e){return e},vX(l6n,"EStructuralFeatureImpl/SimpleFeatureMapEntry",642),wAn(391,497,h8n,Bo),MWn.ri=function(n){return x8(qAt,HWn,26,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"ESuperAdapter/1",391),wAn(444,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,836:1,49:1,97:1,150:1,444:1,114:1,115:1},Ho),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return!this.a&&(this.a=new aG(this,VAt,this)),this.a}return U9(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 2:return!this.a&&(this.a=new aG(this,VAt,this)),_pn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),T$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),T$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return!!this.a&&0!=this.a.i}return O3(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return!this.a&&(this.a=new aG(this,VAt,this)),sqn(this.a),!this.a&&(this.a=new aG(this,VAt,this)),void pX(this.a,BB(t,14))}Lbn(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n),t)},MWn.zh=function(){return gWn(),T$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return!this.a&&(this.a=new aG(this,VAt,this)),void sqn(this.a)}qfn(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n))},vX(l6n,"ETypeParameterImpl",444),wAn(445,85,R9n,aG),MWn.cj=function(n,t){return LTn(this,BB(n,87),t)},MWn.dj=function(n,t){return NTn(this,BB(n,87),t)},vX(l6n,"ETypeParameterImpl/1",445),wAn(634,43,tYn,xm),MWn.ec=function(){return new Tp(this)},vX(l6n,"ETypeParameterImpl/2",634),wAn(556,nVn,tVn,Tp),MWn.Fc=function(n){return YR(this,BB(n,87))},MWn.Gc=function(n){var t,e,i;for(i=!1,e=n.Kc();e.Ob();)t=BB(e.Pb(),87),null==VW(this.a,t,"")&&(i=!0);return i},MWn.$b=function(){$U(this.a)},MWn.Hc=function(n){return hU(this.a,n)},MWn.Kc=function(){return new Mp(new usn(new Pb(this.a).a))},MWn.Mc=function(n){return _6(this,n)},MWn.gc=function(){return NT(this.a)},vX(l6n,"ETypeParameterImpl/2/1",556),wAn(557,1,QWn,Mp),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(ten(this.a).cd(),87)},MWn.Ob=function(){return this.a.b},MWn.Qb=function(){o9(this.a)},vX(l6n,"ETypeParameterImpl/2/1/1",557),wAn(1276,43,tYn,Dm),MWn._b=function(n){return XI(n)?eY(this,n):!!AY(this.f,n)},MWn.xc=function(n){var t;return cL(t=XI(n)?SJ(this,n):qI(AY(this.f,n)),837)?(t=BB(t,837)._j(),VW(this,BB(n,235),t),t):null!=t?t:null==n?(JM(),rLt):null},vX(l6n,"EValidatorRegistryImpl",1276),wAn(1313,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,1941:1,49:1,97:1,150:1,114:1,115:1},qo),MWn.Ih=function(n,t){switch(n.yj()){case 21:case 22:case 23:case 24:case 26:case 31:case 32:case 37:case 38:case 39:case 40:case 43:case 44:case 48:case 49:case 20:return null==t?null:Bbn(t);case 25:return Xtn(t);case 27:return X9(t);case 28:return W9(t);case 29:return null==t?null:H$(IOt[0],BB(t,199));case 41:return null==t?"":nE(BB(t,290));case 42:return Bbn(t);case 50:return SD(t);default:throw Hp(new _y(d6n+n.ne()+g6n))}},MWn.Jh=function(n){var t;switch(-1==n.G&&(n.G=(t=Utn(n))?uvn(t.Mh(),n):-1),n.G){case 0:return new Om;case 1:return new jo;case 2:return new _f;case 4:return new Ev;case 5:return new Am;case 6:return new jv;case 7:return new Rf;case 10:return new yo;case 11:return new $m;case 12:return new vY;case 13:return new Lm;case 14:return new pD;case 17:return new Ao;case 18:return new Kp;case 19:return new Ho;default:throw Hp(new _y(m6n+n.zb+g6n))}},MWn.Kh=function(n,t){switch(n.yj()){case 20:return null==t?null:new wE(t);case 21:return null==t?null:new $A(t);case 23:case 22:return null==t?null:Zdn(t);case 26:case 24:return null==t?null:Pnn(l_n(t,-128,127)<<24>>24);case 25:return d$n(t);case 27:return Syn(t);case 28:return Pyn(t);case 29:return gMn(t);case 32:case 31:return null==t?null:bSn(t);case 38:case 37:return null==t?null:new Dv(t);case 40:case 39:return null==t?null:iln(l_n(t,_Vn,DWn));case 41:case 42:return null;case 44:case 43:return null==t?null:jgn(rUn(t));case 49:case 48:return null==t?null:rln(l_n(t,Q9n,32767)<<16>>16);case 50:return t;default:throw Hp(new _y(d6n+n.ne()+g6n))}},vX(l6n,"EcoreFactoryImpl",1313),wAn(547,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,1939:1,49:1,97:1,150:1,179:1,547:1,114:1,115:1,675:1},UW),MWn.gb=!1,MWn.hb=!1;var V$t,Q$t=!1;vX(l6n,"EcorePackageImpl",547),wAn(1184,1,{837:1},Go),MWn._j=function(){return sN(),cLt},vX(l6n,"EcorePackageImpl/1",1184),wAn(1193,1,s7n,zo),MWn.wj=function(n){return cL(n,147)},MWn.xj=function(n){return x8(BOt,HWn,147,n,0,1)},vX(l6n,"EcorePackageImpl/10",1193),wAn(1194,1,s7n,Uo),MWn.wj=function(n){return cL(n,191)},MWn.xj=function(n){return x8(qOt,HWn,191,n,0,1)},vX(l6n,"EcorePackageImpl/11",1194),wAn(1195,1,s7n,Xo),MWn.wj=function(n){return cL(n,56)},MWn.xj=function(n){return x8(LOt,HWn,56,n,0,1)},vX(l6n,"EcorePackageImpl/12",1195),wAn(1196,1,s7n,Wo),MWn.wj=function(n){return cL(n,399)},MWn.xj=function(n){return x8(QAt,x9n,59,n,0,1)},vX(l6n,"EcorePackageImpl/13",1196),wAn(1197,1,s7n,Vo),MWn.wj=function(n){return cL(n,235)},MWn.xj=function(n){return x8(GOt,HWn,235,n,0,1)},vX(l6n,"EcorePackageImpl/14",1197),wAn(1198,1,s7n,Qo),MWn.wj=function(n){return cL(n,509)},MWn.xj=function(n){return x8(YAt,HWn,2017,n,0,1)},vX(l6n,"EcorePackageImpl/15",1198),wAn(1199,1,s7n,Yo),MWn.wj=function(n){return cL(n,99)},MWn.xj=function(n){return x8(JAt,N9n,18,n,0,1)},vX(l6n,"EcorePackageImpl/16",1199),wAn(1200,1,s7n,Jo),MWn.wj=function(n){return cL(n,170)},MWn.xj=function(n){return x8(FAt,N9n,170,n,0,1)},vX(l6n,"EcorePackageImpl/17",1200),wAn(1201,1,s7n,Zo),MWn.wj=function(n){return cL(n,472)},MWn.xj=function(n){return x8(_At,HWn,472,n,0,1)},vX(l6n,"EcorePackageImpl/18",1201),wAn(1202,1,s7n,ns),MWn.wj=function(n){return cL(n,548)},MWn.xj=function(n){return x8(X$t,a9n,548,n,0,1)},vX(l6n,"EcorePackageImpl/19",1202),wAn(1185,1,s7n,ts),MWn.wj=function(n){return cL(n,322)},MWn.xj=function(n){return x8(BAt,N9n,34,n,0,1)},vX(l6n,"EcorePackageImpl/2",1185),wAn(1203,1,s7n,es),MWn.wj=function(n){return cL(n,241)},MWn.xj=function(n){return x8(VAt,B9n,87,n,0,1)},vX(l6n,"EcorePackageImpl/20",1203),wAn(1204,1,s7n,is),MWn.wj=function(n){return cL(n,444)},MWn.xj=function(n){return x8(O$t,HWn,836,n,0,1)},vX(l6n,"EcorePackageImpl/21",1204),wAn(1205,1,s7n,rs),MWn.wj=function(n){return zI(n)},MWn.xj=function(n){return x8(ktt,sVn,476,n,8,1)},vX(l6n,"EcorePackageImpl/22",1205),wAn(1206,1,s7n,cs),MWn.wj=function(n){return cL(n,190)},MWn.xj=function(n){return x8(NNt,sVn,190,n,0,2)},vX(l6n,"EcorePackageImpl/23",1206),wAn(1207,1,s7n,as),MWn.wj=function(n){return cL(n,217)},MWn.xj=function(n){return x8(Ttt,sVn,217,n,0,1)},vX(l6n,"EcorePackageImpl/24",1207),wAn(1208,1,s7n,us),MWn.wj=function(n){return cL(n,172)},MWn.xj=function(n){return x8(Stt,sVn,172,n,0,1)},vX(l6n,"EcorePackageImpl/25",1208),wAn(1209,1,s7n,os),MWn.wj=function(n){return cL(n,199)},MWn.xj=function(n){return x8(mtt,sVn,199,n,0,1)},vX(l6n,"EcorePackageImpl/26",1209),wAn(1210,1,s7n,ss),MWn.wj=function(n){return!1},MWn.xj=function(n){return x8(_Nt,HWn,2110,n,0,1)},vX(l6n,"EcorePackageImpl/27",1210),wAn(1211,1,s7n,hs),MWn.wj=function(n){return UI(n)},MWn.xj=function(n){return x8(Ptt,sVn,333,n,7,1)},vX(l6n,"EcorePackageImpl/28",1211),wAn(1212,1,s7n,fs),MWn.wj=function(n){return cL(n,58)},MWn.xj=function(n){return x8(uAt,nZn,58,n,0,1)},vX(l6n,"EcorePackageImpl/29",1212),wAn(1186,1,s7n,ls),MWn.wj=function(n){return cL(n,510)},MWn.xj=function(n){return x8(KAt,{3:1,4:1,5:1,1934:1},590,n,0,1)},vX(l6n,"EcorePackageImpl/3",1186),wAn(1213,1,s7n,bs),MWn.wj=function(n){return cL(n,573)},MWn.xj=function(n){return x8(yAt,HWn,1940,n,0,1)},vX(l6n,"EcorePackageImpl/30",1213),wAn(1214,1,s7n,ws),MWn.wj=function(n){return cL(n,153)},MWn.xj=function(n){return x8(oLt,nZn,153,n,0,1)},vX(l6n,"EcorePackageImpl/31",1214),wAn(1215,1,s7n,ds),MWn.wj=function(n){return cL(n,72)},MWn.xj=function(n){return x8($$t,h7n,72,n,0,1)},vX(l6n,"EcorePackageImpl/32",1215),wAn(1216,1,s7n,gs),MWn.wj=function(n){return cL(n,155)},MWn.xj=function(n){return x8(Ctt,sVn,155,n,0,1)},vX(l6n,"EcorePackageImpl/33",1216),wAn(1217,1,s7n,ps),MWn.wj=function(n){return cL(n,19)},MWn.xj=function(n){return x8(Att,sVn,19,n,0,1)},vX(l6n,"EcorePackageImpl/34",1217),wAn(1218,1,s7n,vs),MWn.wj=function(n){return cL(n,290)},MWn.xj=function(n){return x8($nt,HWn,290,n,0,1)},vX(l6n,"EcorePackageImpl/35",1218),wAn(1219,1,s7n,ms),MWn.wj=function(n){return cL(n,162)},MWn.xj=function(n){return x8(Rtt,sVn,162,n,0,1)},vX(l6n,"EcorePackageImpl/36",1219),wAn(1220,1,s7n,ys),MWn.wj=function(n){return cL(n,83)},MWn.xj=function(n){return x8(Nnt,HWn,83,n,0,1)},vX(l6n,"EcorePackageImpl/37",1220),wAn(1221,1,s7n,ks),MWn.wj=function(n){return cL(n,591)},MWn.xj=function(n){return x8(iLt,HWn,591,n,0,1)},vX(l6n,"EcorePackageImpl/38",1221),wAn(1222,1,s7n,js),MWn.wj=function(n){return!1},MWn.xj=function(n){return x8(FNt,HWn,2111,n,0,1)},vX(l6n,"EcorePackageImpl/39",1222),wAn(1187,1,s7n,Es),MWn.wj=function(n){return cL(n,88)},MWn.xj=function(n){return x8(qAt,HWn,26,n,0,1)},vX(l6n,"EcorePackageImpl/4",1187),wAn(1223,1,s7n,Ts),MWn.wj=function(n){return cL(n,184)},MWn.xj=function(n){return x8(_tt,sVn,184,n,0,1)},vX(l6n,"EcorePackageImpl/40",1223),wAn(1224,1,s7n,Ms),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(l6n,"EcorePackageImpl/41",1224),wAn(1225,1,s7n,Ss),MWn.wj=function(n){return cL(n,588)},MWn.xj=function(n){return x8(sAt,HWn,588,n,0,1)},vX(l6n,"EcorePackageImpl/42",1225),wAn(1226,1,s7n,Ps),MWn.wj=function(n){return!1},MWn.xj=function(n){return x8(BNt,sVn,2112,n,0,1)},vX(l6n,"EcorePackageImpl/43",1226),wAn(1227,1,s7n,Cs),MWn.wj=function(n){return cL(n,42)},MWn.xj=function(n){return x8(Hnt,kVn,42,n,0,1)},vX(l6n,"EcorePackageImpl/44",1227),wAn(1188,1,s7n,Is),MWn.wj=function(n){return cL(n,138)},MWn.xj=function(n){return x8(HAt,HWn,138,n,0,1)},vX(l6n,"EcorePackageImpl/5",1188),wAn(1189,1,s7n,Os),MWn.wj=function(n){return cL(n,148)},MWn.xj=function(n){return x8(GAt,HWn,148,n,0,1)},vX(l6n,"EcorePackageImpl/6",1189),wAn(1190,1,s7n,As),MWn.wj=function(n){return cL(n,457)},MWn.xj=function(n){return x8(XAt,HWn,671,n,0,1)},vX(l6n,"EcorePackageImpl/7",1190),wAn(1191,1,s7n,$s),MWn.wj=function(n){return cL(n,573)},MWn.xj=function(n){return x8(WAt,HWn,678,n,0,1)},vX(l6n,"EcorePackageImpl/8",1191),wAn(1192,1,s7n,Ls),MWn.wj=function(n){return cL(n,471)},MWn.xj=function(n){return x8(HOt,HWn,471,n,0,1)},vX(l6n,"EcorePackageImpl/9",1192),wAn(1025,1982,r9n,xy),MWn.bi=function(n,t){Afn(this,BB(t,415))},MWn.fi=function(n,t){eCn(this,n,BB(t,415))},vX(l6n,"MinimalEObjectImpl/1ArrayDelegatingAdapterList",1025),wAn(1026,143,t9n,uW),MWn.Ai=function(){return this.a.a},vX(l6n,"MinimalEObjectImpl/1ArrayDelegatingAdapterList/1",1026),wAn(1053,1052,{},o$),vX("org.eclipse.emf.ecore.plugin","EcorePlugin",1053);var Y$t,J$t,Z$t,nLt,tLt,eLt,iLt=bq(f7n,"Resource");wAn(781,1378,l7n),MWn.Yk=function(n){},MWn.Zk=function(n){},MWn.Vk=function(){return!this.a&&(this.a=new Sp(this)),this.a},MWn.Wk=function(n){var t,e,i,r,c;if((i=n.length)>0){if(b1(0,n.length),47==n.charCodeAt(0)){for(c=new J6(4),r=1,t=1;t0&&(n=n.substr(0,e))}return jIn(this,n)},MWn.Xk=function(){return this.c},MWn.Ib=function(){return nE(this.gm)+"@"+(nsn(this)>>>0).toString(16)+" uri='"+this.d+"'"},MWn.b=!1,vX(b7n,"ResourceImpl",781),wAn(1379,781,l7n,Cp),vX(b7n,"BinaryResourceImpl",1379),wAn(1169,694,f8n),MWn.si=function(n){return cL(n,56)?TY(this,BB(n,56)):cL(n,591)?new AL(BB(n,591).Vk()):GI(n)===GI(this.f)?BB(n,14).Kc():(dD(),pAt.a)},MWn.Ob=function(){return bOn(this)},MWn.a=!1,vX(y9n,"EcoreUtil/ContentTreeIterator",1169),wAn(1380,1169,f8n,rU),MWn.si=function(n){return GI(n)===GI(this.f)?BB(n,15).Kc():new F2(BB(n,56))},vX(b7n,"ResourceImpl/5",1380),wAn(648,1994,D9n,Sp),MWn.Hc=function(n){return this.i<=4?Sjn(this,n):cL(n,49)&&BB(n,49).Zg()==this.a},MWn.bi=function(n,t){n==this.i-1&&(this.a.b||(this.a.b=!0))},MWn.di=function(n,t){0==n?this.a.b||(this.a.b=!0):L8(this,n,t)},MWn.fi=function(n,t){},MWn.gi=function(n,t,e){},MWn.aj=function(){return 2},MWn.Ai=function(){return this.a},MWn.bj=function(){return!0},MWn.cj=function(n,t){return t=BB(n,49).wh(this.a,t)},MWn.dj=function(n,t){return BB(n,49).wh(null,t)},MWn.ej=function(){return!1},MWn.hi=function(){return!0},MWn.ri=function(n){return x8(LOt,HWn,56,n,0,1)},MWn.ni=function(){return!1},vX(b7n,"ResourceImpl/ContentsEList",648),wAn(957,1964,LVn,Pp),MWn.Zc=function(n){return this.a._h(n)},MWn.gc=function(){return this.a.gc()},vX(y9n,"AbstractSequentialInternalEList/1",957),wAn(624,1,{},SH),vX(y9n,"BasicExtendedMetaData",624),wAn(1160,1,{},$I),MWn.$k=function(){return null},MWn._k=function(){return-2==this.a&&ob(this,aMn(this.d,this.b)),this.a},MWn.al=function(){return null},MWn.bl=function(){return SQ(),SQ(),set},MWn.ne=function(){return this.c==C7n&&hb(this,Egn(this.d,this.b)),this.c},MWn.cl=function(){return 0},MWn.a=-2,MWn.c=C7n,vX(y9n,"BasicExtendedMetaData/EClassExtendedMetaDataImpl",1160),wAn(1161,1,{},_0),MWn.$k=function(){return this.a==(R5(),tLt)&&sb(this,vNn(this.f,this.b)),this.a},MWn._k=function(){return 0},MWn.al=function(){return this.c==(R5(),tLt)&&fb(this,mNn(this.f,this.b)),this.c},MWn.bl=function(){return!this.d&&lb(this,SKn(this.f,this.b)),this.d},MWn.ne=function(){return this.e==C7n&&bb(this,Egn(this.f,this.b)),this.e},MWn.cl=function(){return-2==this.g&&wb(this,YEn(this.f,this.b)),this.g},MWn.e=C7n,MWn.g=-2,vX(y9n,"BasicExtendedMetaData/EDataTypeExtendedMetaDataImpl",1161),wAn(1159,1,{},RI),MWn.b=!1,MWn.c=!1,vX(y9n,"BasicExtendedMetaData/EPackageExtendedMetaDataImpl",1159),wAn(1162,1,{},K0),MWn.c=-2,MWn.e=C7n,MWn.f=C7n,vX(y9n,"BasicExtendedMetaData/EStructuralFeatureExtendedMetaDataImpl",1162),wAn(585,622,R9n,MH),MWn.aj=function(){return this.c},MWn.Fk=function(){return!1},MWn.li=function(n,t){return t},MWn.c=0,vX(y9n,"EDataTypeEList",585);var rLt,cLt,aLt,uLt,oLt=bq(y9n,"FeatureMap");wAn(75,585,{3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},Ecn),MWn.Vc=function(n,t){lNn(this,n,BB(t,72))},MWn.Fc=function(n){return uLn(this,BB(n,72))},MWn.Yh=function(n){dX(this,BB(n,72))},MWn.cj=function(n,t){return HK(this,BB(n,72),t)},MWn.dj=function(n,t){return qK(this,BB(n,72),t)},MWn.ii=function(n,t){return a_n(this,n,t)},MWn.li=function(n,t){return hGn(this,n,BB(t,72))},MWn._c=function(n,t){return Pxn(this,n,BB(t,72))},MWn.jj=function(n,t){return GK(this,BB(n,72),t)},MWn.kj=function(n,t){return zK(this,BB(n,72),t)},MWn.lj=function(n,t,e){return gEn(this,BB(n,72),BB(t,72),e)},MWn.oi=function(n,t){return sTn(this,n,BB(t,72))},MWn.dl=function(n,t){return xKn(this,n,t)},MWn.Wc=function(n,t){var e,i,r,c,a,u,o,s,h;for(s=new gtn(t.gc()),r=t.Kc();r.Ob();)if(c=(i=BB(r.Pb(),72)).ak(),$xn(this.e,c))(!c.hi()||!G3(this,c,i.dd())&&!Sjn(s,i))&&f9(s,i);else{for(h=axn(this.e.Tg(),c),e=BB(this.g,119),a=!0,u=0;u=0;)if(t=n[this.c],this.k.rl(t.ak()))return this.j=this.f?t:t.dd(),this.i=-2,!0;return this.i=-1,this.g=-1,!1},vX(y9n,"BasicFeatureMap/FeatureEIterator",410),wAn(662,410,cVn,xO),MWn.Lk=function(){return!0},vX(y9n,"BasicFeatureMap/ResolvingFeatureEIterator",662),wAn(955,486,q9n,z$),MWn.Gi=function(){return this},vX(y9n,"EContentsEList/1",955),wAn(956,486,q9n,DO),MWn.Lk=function(){return!1},vX(y9n,"EContentsEList/2",956),wAn(954,279,G9n,U$),MWn.Nk=function(n){},MWn.Ob=function(){return!1},MWn.Sb=function(){return!1},vX(y9n,"EContentsEList/FeatureIteratorImpl/1",954),wAn(825,585,R9n,KL),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EDataTypeEList/Unsettable",825),wAn(1849,585,R9n,_L),MWn.hi=function(){return!0},vX(y9n,"EDataTypeUniqueEList",1849),wAn(1850,825,R9n,FL),MWn.hi=function(){return!0},vX(y9n,"EDataTypeUniqueEList/Unsettable",1850),wAn(139,85,R9n,NL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentEList/Resolving",139),wAn(1163,545,R9n,xL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentEList/Unsettable/Resolving",1163),wAn(748,16,R9n,iK),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EObjectContainmentWithInverseEList/Unsettable",748),wAn(1173,748,R9n,rK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentWithInverseEList/Unsettable/Resolving",1173),wAn(743,496,R9n,DL),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EObjectEList/Unsettable",743),wAn(328,496,R9n,RL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectResolvingEList",328),wAn(1641,743,R9n,BL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectResolvingEList/Unsettable",1641),wAn(1381,1,{},Ns),vX(y9n,"EObjectValidator",1381),wAn(546,496,R9n,iU),MWn.zk=function(){return this.d},MWn.Ak=function(){return this.b},MWn.bj=function(){return!0},MWn.Dk=function(){return!0},MWn.b=0,vX(y9n,"EObjectWithInverseEList",546),wAn(1176,546,R9n,cK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseEList/ManyInverse",1176),wAn(625,546,R9n,aK),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EObjectWithInverseEList/Unsettable",625),wAn(1175,625,R9n,oK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseEList/Unsettable/ManyInverse",1175),wAn(749,546,R9n,uK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectWithInverseResolvingEList",749),wAn(31,749,R9n,hK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseResolvingEList/ManyInverse",31),wAn(750,625,R9n,sK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectWithInverseResolvingEList/Unsettable",750),wAn(1174,750,R9n,fK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseResolvingEList/Unsettable/ManyInverse",1174),wAn(1164,622,R9n),MWn.ai=function(){return 0==(1792&this.b)},MWn.ci=function(){this.b|=1},MWn.Bk=function(){return 0!=(4&this.b)},MWn.bj=function(){return 0!=(40&this.b)},MWn.Ck=function(){return 0!=(16&this.b)},MWn.Dk=function(){return 0!=(8&this.b)},MWn.Ek=function(){return 0!=(this.b&M9n)},MWn.rk=function(){return 0!=(32&this.b)},MWn.Fk=function(){return 0!=(this.b&k6n)},MWn.wj=function(n){return this.d?x3(this.d,n):this.ak().Yj().wj(n)},MWn.fj=function(){return 0!=(2&this.b)?0!=(1&this.b):0!=this.i},MWn.hi=function(){return 0!=(128&this.b)},MWn.Xj=function(){var n;sqn(this),0!=(2&this.b)&&(mA(this.e)?(n=0!=(1&this.b),this.b&=-2,Lv(this,new t6(this.e,2,Awn(this.e.Tg(),this.ak()),n,!1))):this.b&=-2)},MWn.ni=function(){return 0==(1536&this.b)},MWn.b=0,vX(y9n,"EcoreEList/Generic",1164),wAn(1165,1164,R9n,zQ),MWn.ak=function(){return this.a},vX(y9n,"EcoreEList/Dynamic",1165),wAn(747,63,h8n,Ip),MWn.ri=function(n){return Den(this.a.a,n)},vX(y9n,"EcoreEMap/1",747),wAn(746,85,R9n,Zz),MWn.bi=function(n,t){Ivn(this.b,BB(t,133))},MWn.di=function(n,t){aan(this.b)},MWn.ei=function(n,t,e){var i;++(i=this.b,BB(t,133),i).e},MWn.fi=function(n,t){Oln(this.b,BB(t,133))},MWn.gi=function(n,t,e){Oln(this.b,BB(e,133)),GI(e)===GI(t)&&BB(e,133).Th(c$(BB(t,133).cd())),Ivn(this.b,BB(t,133))},vX(y9n,"EcoreEMap/DelegateEObjectContainmentEList",746),wAn(1171,151,j9n,yin),vX(y9n,"EcoreEMap/Unsettable",1171),wAn(1172,746,R9n,lK),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EcoreEMap/Unsettable/UnsettableDelegateEObjectContainmentEList",1172),wAn(1168,228,tYn,lX),MWn.a=!1,MWn.b=!1,vX(y9n,"EcoreUtil/Copier",1168),wAn(745,1,QWn,F2),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return udn(this)},MWn.Pb=function(){var n;return udn(this),n=this.b,this.b=null,n},MWn.Qb=function(){this.a.Qb()},vX(y9n,"EcoreUtil/ProperContentIterator",745),wAn(1382,1381,{},Ff),vX(y9n,"EcoreValidator",1382),bq(y9n,"FeatureMapUtil/Validator"),wAn(1260,1,{1942:1},xs),MWn.rl=function(n){return!0},vX(y9n,"FeatureMapUtil/1",1260),wAn(757,1,{1942:1},cUn),MWn.rl=function(n){var t;return this.c==n||(null==(t=TD(RX(this.a,n)))?xRn(this,n)?(r6(this.a,n,(hN(),vtt)),!0):(r6(this.a,n,(hN(),ptt)),!1):t==(hN(),vtt))},MWn.e=!1,vX(y9n,"FeatureMapUtil/BasicValidator",757),wAn(758,43,tYn,X$),vX(y9n,"FeatureMapUtil/BasicValidator/Cache",758),wAn(501,52,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,69:1,95:1},xI),MWn.Vc=function(n,t){Axn(this.c,this.b,n,t)},MWn.Fc=function(n){return xKn(this.c,this.b,n)},MWn.Wc=function(n,t){return jHn(this.c,this.b,n,t)},MWn.Gc=function(n){return Z$(this,n)},MWn.Xh=function(n,t){htn(this.c,this.b,n,t)},MWn.lk=function(n,t){return PRn(this.c,this.b,n,t)},MWn.pi=function(n){return iHn(this.c,this.b,n,!1)},MWn.Zh=function(){return jA(this.c,this.b)},MWn.$h=function(){return EA(this.c,this.b)},MWn._h=function(n){return $8(this.c,this.b,n)},MWn.mk=function(n,t){return tR(this,n,t)},MWn.$b=function(){Nv(this)},MWn.Hc=function(n){return G3(this.c,this.b,n)},MWn.Ic=function(n){return Mcn(this.c,this.b,n)},MWn.Xb=function(n){return iHn(this.c,this.b,n,!0)},MWn.Wj=function(n){return this},MWn.Xc=function(n){return z3(this.c,this.b,n)},MWn.dc=function(){return HI(this)},MWn.fj=function(){return!adn(this.c,this.b)},MWn.Kc=function(){return cnn(this.c,this.b)},MWn.Yc=function(){return ann(this.c,this.b)},MWn.Zc=function(n){return lln(this.c,this.b,n)},MWn.ii=function(n,t){return mFn(this.c,this.b,n,t)},MWn.ji=function(n,t){Q6(this.c,this.b,n,t)},MWn.$c=function(n){return aPn(this.c,this.b,n)},MWn.Mc=function(n){return CKn(this.c,this.b,n)},MWn._c=function(n,t){return XFn(this.c,this.b,n,t)},MWn.Wb=function(n){AOn(this.c,this.b),Z$(this,BB(n,15))},MWn.gc=function(){return Kln(this.c,this.b)},MWn.Pc=function(){return G1(this.c,this.b)},MWn.Qc=function(n){return U3(this.c,this.b,n)},MWn.Ib=function(){var n,t;for((t=new Sk).a+="[",n=jA(this.c,this.b);Ksn(n);)cO(t,kN(cvn(n))),Ksn(n)&&(t.a+=FWn);return t.a+="]",t.a},MWn.Xj=function(){AOn(this.c,this.b)},vX(y9n,"FeatureMapUtil/FeatureEList",501),wAn(627,36,t9n,b4),MWn.yi=function(n){return eln(this,n)},MWn.Di=function(n){var t,e,i,r;switch(this.d){case 1:case 2:if(GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.g=n.zi(),1==n.xi()&&(this.d=1),!0;break;case 3:if(3===n.xi()&&GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.d=5,f9(t=new gtn(2),this.g),f9(t,n.zi()),this.g=t,!0;break;case 5:if(3===n.xi()&&GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return BB(this.g,14).Fc(n.zi()),!0;break;case 4:switch(n.xi()){case 3:if(GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.d=1,this.g=n.zi(),!0;break;case 4:if(GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.d=6,f9(r=new gtn(2),this.n),f9(r,n.Bi()),this.n=r,i=Pun(Gk(ANt,1),hQn,25,15,[this.o,n.Ci()]),this.g=i,!0}break;case 6:if(4===n.xi()&&GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return BB(this.n,14).Fc(n.Bi()),aHn(i=BB(this.g,48),0,e=x8(ANt,hQn,25,i.length+1,15,1),0,i.length),e[i.length]=n.Ci(),this.g=e,!0}return!1},vX(y9n,"FeatureMapUtil/FeatureENotificationImpl",627),wAn(552,501,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},lq),MWn.dl=function(n,t){return xKn(this.c,n,t)},MWn.el=function(n,t,e){return PRn(this.c,n,t,e)},MWn.fl=function(n,t,e){return ZBn(this.c,n,t,e)},MWn.gl=function(){return this},MWn.hl=function(n,t){return rHn(this.c,n,t)},MWn.il=function(n){return BB(iHn(this.c,this.b,n,!1),72).ak()},MWn.jl=function(n){return BB(iHn(this.c,this.b,n,!1),72).dd()},MWn.kl=function(){return this.a},MWn.ll=function(n){return!adn(this.c,n)},MWn.ml=function(n,t){MHn(this.c,n,t)},MWn.nl=function(n){return zin(this.c,n)},MWn.ol=function(n){Kmn(this.c,n)},vX(y9n,"FeatureMapUtil/FeatureFeatureMap",552),wAn(1259,1,k9n,KI),MWn.Wj=function(n){return iHn(this.b,this.a,-1,n)},MWn.fj=function(){return!adn(this.b,this.a)},MWn.Wb=function(n){MHn(this.b,this.a,n)},MWn.Xj=function(){AOn(this.b,this.a)},vX(y9n,"FeatureMapUtil/FeatureValue",1259);var sLt,hLt,fLt,lLt,bLt,wLt=bq(O7n,"AnyType");wAn(666,60,BVn,ik),vX(O7n,"InvalidDatatypeValueException",666);var dLt,gLt,pLt,vLt,mLt,yLt,kLt,jLt,ELt,TLt,MLt,SLt,PLt,CLt,ILt,OLt,ALt,$Lt,LLt,NLt,xLt,DLt,RLt,KLt,_Lt,FLt,BLt,HLt,qLt,GLt,zLt=bq(O7n,A7n),ULt=bq(O7n,$7n),XLt=bq(O7n,L7n);wAn(830,506,{105:1,92:1,90:1,56:1,49:1,97:1,843:1},Rm),MWn._g=function(n,t,e){switch(n){case 0:return e?(!this.c&&(this.c=new Ecn(this,0)),this.c):(!this.c&&(this.c=new Ecn(this,0)),this.c.b);case 1:return e?(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)):(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).kl();case 2:return e?(!this.b&&(this.b=new Ecn(this,2)),this.b):(!this.b&&(this.b=new Ecn(this,2)),this.b.b)}return U9(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.c&&(this.c=new Ecn(this,0)),TKn(this.c,n,e);case 1:return(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),69)).mk(n,e);case 2:return!this.b&&(this.b=new Ecn(this,2)),TKn(this.b,n,e)}return BB(itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),t),66).Nj().Rj(this,Q7(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.c&&0!=this.c.i;case 1:return!(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).dc();case 2:return!!this.b&&0!=this.b.i}return O3(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void tX(this.c,t);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).Wb(t);case 2:return!this.b&&(this.b=new Ecn(this,2)),void tX(this.b,t)}Lbn(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),pLt},MWn.Bh=function(n){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void sqn(this.c);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).$b();case 2:return!this.b&&(this.b=new Ecn(this,2)),void sqn(this.b)}qfn(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.Ib=function(){var n;return 0!=(4&this.j)?P$n(this):((n=new fN(P$n(this))).a+=" (mixed: ",rO(n,this.c),n.a+=", anyAttribute: ",rO(n,this.b),n.a+=")",n.a)},vX(N7n,"AnyTypeImpl",830),wAn(667,506,{105:1,92:1,90:1,56:1,49:1,97:1,2021:1,667:1},Rs),MWn._g=function(n,t,e){switch(n){case 0:return this.a;case 1:return this.b}return U9(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.lh=function(n){switch(n){case 0:return null!=this.a;case 1:return null!=this.b}return O3(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return void kb(this,SD(t));case 1:return void jb(this,SD(t))}Lbn(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),OLt},MWn.Bh=function(n){switch(n){case 0:return void(this.a=null);case 1:return void(this.b=null)}qfn(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.Ib=function(){var n;return 0!=(4&this.j)?P$n(this):((n=new fN(P$n(this))).a+=" (data: ",cO(n,this.a),n.a+=", target: ",cO(n,this.b),n.a+=")",n.a)},MWn.a=null,MWn.b=null,vX(N7n,"ProcessingInstructionImpl",667),wAn(668,830,{105:1,92:1,90:1,56:1,49:1,97:1,843:1,2022:1,668:1},_m),MWn._g=function(n,t,e){switch(n){case 0:return e?(!this.c&&(this.c=new Ecn(this,0)),this.c):(!this.c&&(this.c=new Ecn(this,0)),this.c.b);case 1:return e?(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)):(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).kl();case 2:return e?(!this.b&&(this.b=new Ecn(this,2)),this.b):(!this.b&&(this.b=new Ecn(this,2)),this.b.b);case 3:return!this.c&&(this.c=new Ecn(this,0)),SD(rHn(this.c,(Uqn(),LLt),!0));case 4:return gK(this.a,(!this.c&&(this.c=new Ecn(this,0)),SD(rHn(this.c,(Uqn(),LLt),!0))));case 5:return this.a}return U9(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.c&&0!=this.c.i;case 1:return!(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).dc();case 2:return!!this.b&&0!=this.b.i;case 3:return!this.c&&(this.c=new Ecn(this,0)),null!=SD(rHn(this.c,(Uqn(),LLt),!0));case 4:return null!=gK(this.a,(!this.c&&(this.c=new Ecn(this,0)),SD(rHn(this.c,(Uqn(),LLt),!0))));case 5:return!!this.a}return O3(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void tX(this.c,t);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).Wb(t);case 2:return!this.b&&(this.b=new Ecn(this,2)),void tX(this.b,t);case 3:return void F0(this,SD(t));case 4:return void F0(this,pK(this.a,t));case 5:return void Eb(this,BB(t,148))}Lbn(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),$Lt},MWn.Bh=function(n){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void sqn(this.c);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).$b();case 2:return!this.b&&(this.b=new Ecn(this,2)),void sqn(this.b);case 3:return!this.c&&(this.c=new Ecn(this,0)),void MHn(this.c,(Uqn(),LLt),null);case 4:return void F0(this,pK(this.a,null));case 5:return void(this.a=null)}qfn(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},vX(N7n,"SimpleAnyTypeImpl",668),wAn(669,506,{105:1,92:1,90:1,56:1,49:1,97:1,2023:1,669:1},Km),MWn._g=function(n,t,e){switch(n){case 0:return e?(!this.a&&(this.a=new Ecn(this,0)),this.a):(!this.a&&(this.a=new Ecn(this,0)),this.a.b);case 1:return e?(!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),this.b):(!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),A8(this.b));case 2:return e?(!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),this.c):(!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),A8(this.c));case 3:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),DLt));case 4:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),RLt));case 5:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),_Lt));case 6:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),FLt))}return U9(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.a&&(this.a=new Ecn(this,0)),TKn(this.a,n,e);case 1:return!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),BK(this.b,n,e);case 2:return!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),BK(this.c,n,e);case 5:return!this.a&&(this.a=new Ecn(this,0)),tR(n1(this.a,(Uqn(),_Lt)),n,e)}return BB(itn(0==(2&this.j)?(Uqn(),xLt):(!this.k&&(this.k=new Kf),this.k).ck(),t),66).Nj().Rj(this,Q7(this),t-bX((Uqn(),xLt)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.a&&0!=this.a.i;case 1:return!!this.b&&0!=this.b.f;case 2:return!!this.c&&0!=this.c.f;case 3:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),DLt)));case 4:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),RLt)));case 5:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),_Lt)));case 6:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),FLt)))}return O3(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.a&&(this.a=new Ecn(this,0)),void tX(this.a,t);case 1:return!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),void tan(this.b,t);case 2:return!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),void tan(this.c,t);case 3:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),DLt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,DLt),BB(t,14));case 4:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),RLt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,RLt),BB(t,14));case 5:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),_Lt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,_Lt),BB(t,14));case 6:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),FLt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,FLt),BB(t,14))}Lbn(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),xLt},MWn.Bh=function(n){switch(n){case 0:return!this.a&&(this.a=new Ecn(this,0)),void sqn(this.a);case 1:return!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),void this.b.c.$b();case 2:return!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),void this.c.c.$b();case 3:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),DLt)));case 4:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),RLt)));case 5:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),_Lt)));case 6:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),FLt)))}qfn(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.Ib=function(){var n;return 0!=(4&this.j)?P$n(this):((n=new fN(P$n(this))).a+=" (mixed: ",rO(n,this.a),n.a+=")",n.a)},vX(N7n,"XMLTypeDocumentRootImpl",669),wAn(1919,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1,2024:1},Ds),MWn.Ih=function(n,t){switch(n.yj()){case 7:case 8:case 9:case 10:case 16:case 22:case 23:case 24:case 25:case 26:case 32:case 33:case 34:case 36:case 37:case 44:case 45:case 50:case 51:case 53:case 55:case 56:case 57:case 58:case 60:case 61:case 4:return null==t?null:Bbn(t);case 19:case 28:case 29:case 35:case 38:case 39:case 41:case 46:case 52:case 54:case 5:return SD(t);case 6:return mD(BB(t,190));case 12:case 47:case 49:case 11:return qGn(this,n,t);case 13:return null==t?null:GBn(BB(t,240));case 15:case 14:return null==t?null:RU(Gy(MD(t)));case 17:return EEn((Uqn(),t));case 18:return EEn(t);case 21:case 20:return null==t?null:KU(BB(t,155).a);case 27:return yD(BB(t,190));case 30:return _mn((Uqn(),BB(t,15)));case 31:return _mn(BB(t,15));case 40:return jD((Uqn(),t));case 42:return TEn((Uqn(),t));case 43:return TEn(t);case 59:case 48:return kD((Uqn(),t));default:throw Hp(new _y(d6n+n.ne()+g6n))}},MWn.Jh=function(n){var t;switch(-1==n.G&&(n.G=(t=Utn(n))?uvn(t.Mh(),n):-1),n.G){case 0:return new Rm;case 1:return new Rs;case 2:return new _m;case 3:return new Km;default:throw Hp(new _y(m6n+n.zb+g6n))}},MWn.Kh=function(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;switch(n.yj()){case 5:case 52:case 4:return t;case 6:return ypn(t);case 8:case 7:return null==t?null:_En(t);case 9:return null==t?null:Pnn(l_n((i=FBn(t,!0)).length>0&&(b1(0,i.length),43==i.charCodeAt(0))?i.substr(1):i,-128,127)<<24>>24);case 10:return null==t?null:Pnn(l_n((r=FBn(t,!0)).length>0&&(b1(0,r.length),43==r.charCodeAt(0))?r.substr(1):r,-128,127)<<24>>24);case 11:return SD(xXn(this,(Uqn(),kLt),t));case 12:return SD(xXn(this,(Uqn(),jLt),t));case 13:return null==t?null:new wE(FBn(t,!0));case 15:case 14:return gLn(t);case 16:return SD(xXn(this,(Uqn(),ELt),t));case 17:return Hdn((Uqn(),t));case 18:return Hdn(t);case 28:case 29:case 35:case 38:case 39:case 41:case 54:case 19:return FBn(t,!0);case 21:case 20:return ILn(t);case 22:return SD(xXn(this,(Uqn(),TLt),t));case 23:return SD(xXn(this,(Uqn(),MLt),t));case 24:return SD(xXn(this,(Uqn(),SLt),t));case 25:return SD(xXn(this,(Uqn(),PLt),t));case 26:return SD(xXn(this,(Uqn(),CLt),t));case 27:return Zgn(t);case 30:return qdn((Uqn(),t));case 31:return qdn(t);case 32:return null==t?null:iln(l_n((h=FBn(t,!0)).length>0&&(b1(0,h.length),43==h.charCodeAt(0))?h.substr(1):h,_Vn,DWn));case 33:return null==t?null:new $A((f=FBn(t,!0)).length>0&&(b1(0,f.length),43==f.charCodeAt(0))?f.substr(1):f);case 34:return null==t?null:iln(l_n((l=FBn(t,!0)).length>0&&(b1(0,l.length),43==l.charCodeAt(0))?l.substr(1):l,_Vn,DWn));case 36:return null==t?null:jgn(rUn((b=FBn(t,!0)).length>0&&(b1(0,b.length),43==b.charCodeAt(0))?b.substr(1):b));case 37:return null==t?null:jgn(rUn((w=FBn(t,!0)).length>0&&(b1(0,w.length),43==w.charCodeAt(0))?w.substr(1):w));case 40:return Vwn((Uqn(),t));case 42:return Gdn((Uqn(),t));case 43:return Gdn(t);case 44:return null==t?null:new $A((d=FBn(t,!0)).length>0&&(b1(0,d.length),43==d.charCodeAt(0))?d.substr(1):d);case 45:return null==t?null:new $A((g=FBn(t,!0)).length>0&&(b1(0,g.length),43==g.charCodeAt(0))?g.substr(1):g);case 46:return FBn(t,!1);case 47:return SD(xXn(this,(Uqn(),ILt),t));case 59:case 48:return Wwn((Uqn(),t));case 49:return SD(xXn(this,(Uqn(),ALt),t));case 50:return null==t?null:rln(l_n((p=FBn(t,!0)).length>0&&(b1(0,p.length),43==p.charCodeAt(0))?p.substr(1):p,Q9n,32767)<<16>>16);case 51:return null==t?null:rln(l_n((c=FBn(t,!0)).length>0&&(b1(0,c.length),43==c.charCodeAt(0))?c.substr(1):c,Q9n,32767)<<16>>16);case 53:return SD(xXn(this,(Uqn(),NLt),t));case 55:return null==t?null:rln(l_n((a=FBn(t,!0)).length>0&&(b1(0,a.length),43==a.charCodeAt(0))?a.substr(1):a,Q9n,32767)<<16>>16);case 56:return null==t?null:rln(l_n((u=FBn(t,!0)).length>0&&(b1(0,u.length),43==u.charCodeAt(0))?u.substr(1):u,Q9n,32767)<<16>>16);case 57:return null==t?null:jgn(rUn((o=FBn(t,!0)).length>0&&(b1(0,o.length),43==o.charCodeAt(0))?o.substr(1):o));case 58:return null==t?null:jgn(rUn((s=FBn(t,!0)).length>0&&(b1(0,s.length),43==s.charCodeAt(0))?s.substr(1):s));case 60:return null==t?null:iln(l_n((e=FBn(t,!0)).length>0&&(b1(0,e.length),43==e.charCodeAt(0))?e.substr(1):e,_Vn,DWn));case 61:return null==t?null:iln(l_n(FBn(t,!0),_Vn,DWn));default:throw Hp(new _y(d6n+n.ne()+g6n))}},vX(N7n,"XMLTypeFactoryImpl",1919),wAn(586,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1,1945:1,586:1},zW),MWn.N=!1,MWn.O=!1;var WLt,VLt,QLt,YLt,JLt,ZLt=!1;vX(N7n,"XMLTypePackageImpl",586),wAn(1852,1,{837:1},Ks),MWn._j=function(){return fFn(),TNt},vX(N7n,"XMLTypePackageImpl/1",1852),wAn(1861,1,s7n,_s),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/10",1861),wAn(1862,1,s7n,Fs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/11",1862),wAn(1863,1,s7n,Bs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/12",1863),wAn(1864,1,s7n,Hs),MWn.wj=function(n){return UI(n)},MWn.xj=function(n){return x8(Ptt,sVn,333,n,7,1)},vX(N7n,"XMLTypePackageImpl/13",1864),wAn(1865,1,s7n,qs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/14",1865),wAn(1866,1,s7n,Gs),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/15",1866),wAn(1867,1,s7n,zs),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/16",1867),wAn(1868,1,s7n,Us),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/17",1868),wAn(1869,1,s7n,Xs),MWn.wj=function(n){return cL(n,155)},MWn.xj=function(n){return x8(Ctt,sVn,155,n,0,1)},vX(N7n,"XMLTypePackageImpl/18",1869),wAn(1870,1,s7n,Ws),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/19",1870),wAn(1853,1,s7n,Vs),MWn.wj=function(n){return cL(n,843)},MWn.xj=function(n){return x8(wLt,HWn,843,n,0,1)},vX(N7n,"XMLTypePackageImpl/2",1853),wAn(1871,1,s7n,Qs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/20",1871),wAn(1872,1,s7n,Ys),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/21",1872),wAn(1873,1,s7n,Js),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/22",1873),wAn(1874,1,s7n,Zs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/23",1874),wAn(1875,1,s7n,nh),MWn.wj=function(n){return cL(n,190)},MWn.xj=function(n){return x8(NNt,sVn,190,n,0,2)},vX(N7n,"XMLTypePackageImpl/24",1875),wAn(1876,1,s7n,th),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/25",1876),wAn(1877,1,s7n,eh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/26",1877),wAn(1878,1,s7n,ih),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/27",1878),wAn(1879,1,s7n,rh),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/28",1879),wAn(1880,1,s7n,ch),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/29",1880),wAn(1854,1,s7n,ah),MWn.wj=function(n){return cL(n,667)},MWn.xj=function(n){return x8(zLt,HWn,2021,n,0,1)},vX(N7n,"XMLTypePackageImpl/3",1854),wAn(1881,1,s7n,uh),MWn.wj=function(n){return cL(n,19)},MWn.xj=function(n){return x8(Att,sVn,19,n,0,1)},vX(N7n,"XMLTypePackageImpl/30",1881),wAn(1882,1,s7n,oh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/31",1882),wAn(1883,1,s7n,sh),MWn.wj=function(n){return cL(n,162)},MWn.xj=function(n){return x8(Rtt,sVn,162,n,0,1)},vX(N7n,"XMLTypePackageImpl/32",1883),wAn(1884,1,s7n,hh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/33",1884),wAn(1885,1,s7n,fh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/34",1885),wAn(1886,1,s7n,lh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/35",1886),wAn(1887,1,s7n,bh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/36",1887),wAn(1888,1,s7n,wh),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/37",1888),wAn(1889,1,s7n,dh),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/38",1889),wAn(1890,1,s7n,gh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/39",1890),wAn(1855,1,s7n,ph),MWn.wj=function(n){return cL(n,668)},MWn.xj=function(n){return x8(ULt,HWn,2022,n,0,1)},vX(N7n,"XMLTypePackageImpl/4",1855),wAn(1891,1,s7n,vh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/40",1891),wAn(1892,1,s7n,mh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/41",1892),wAn(1893,1,s7n,yh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/42",1893),wAn(1894,1,s7n,kh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/43",1894),wAn(1895,1,s7n,jh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/44",1895),wAn(1896,1,s7n,Eh),MWn.wj=function(n){return cL(n,184)},MWn.xj=function(n){return x8(_tt,sVn,184,n,0,1)},vX(N7n,"XMLTypePackageImpl/45",1896),wAn(1897,1,s7n,Th),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/46",1897),wAn(1898,1,s7n,Mh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/47",1898),wAn(1899,1,s7n,Sh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/48",1899),wAn(sQn,1,s7n,Ph),MWn.wj=function(n){return cL(n,184)},MWn.xj=function(n){return x8(_tt,sVn,184,n,0,1)},vX(N7n,"XMLTypePackageImpl/49",sQn),wAn(1856,1,s7n,Ch),MWn.wj=function(n){return cL(n,669)},MWn.xj=function(n){return x8(XLt,HWn,2023,n,0,1)},vX(N7n,"XMLTypePackageImpl/5",1856),wAn(1901,1,s7n,Ih),MWn.wj=function(n){return cL(n,162)},MWn.xj=function(n){return x8(Rtt,sVn,162,n,0,1)},vX(N7n,"XMLTypePackageImpl/50",1901),wAn(1902,1,s7n,Oh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/51",1902),wAn(1903,1,s7n,Ah),MWn.wj=function(n){return cL(n,19)},MWn.xj=function(n){return x8(Att,sVn,19,n,0,1)},vX(N7n,"XMLTypePackageImpl/52",1903),wAn(1857,1,s7n,$h),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/6",1857),wAn(1858,1,s7n,Lh),MWn.wj=function(n){return cL(n,190)},MWn.xj=function(n){return x8(NNt,sVn,190,n,0,2)},vX(N7n,"XMLTypePackageImpl/7",1858),wAn(1859,1,s7n,Nh),MWn.wj=function(n){return zI(n)},MWn.xj=function(n){return x8(ktt,sVn,476,n,8,1)},vX(N7n,"XMLTypePackageImpl/8",1859),wAn(1860,1,s7n,xh),MWn.wj=function(n){return cL(n,217)},MWn.xj=function(n){return x8(Ttt,sVn,217,n,0,1)},vX(N7n,"XMLTypePackageImpl/9",1860),wAn(50,60,BVn,ak),vX(ant,"RegEx/ParseException",50),wAn(820,1,{},Dh),MWn.sl=function(n){return n16*e)throw Hp(new ak(kWn((u$(),H8n))));e=16*e+r}if(125!=this.a)throw Hp(new ak(kWn((u$(),q8n))));if(e>unt)throw Hp(new ak(kWn((u$(),G8n))));n=e}else{if(r=0,0!=this.c||(r=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(e=r,QXn(this),0!=this.c||(r=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));n=e=16*e+r}break;case 117:if(i=0,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));n=t=16*t+i;break;case 118:if(QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if((t=16*t+i)>unt)throw Hp(new ak(kWn((u$(),"parser.descappe.4"))));n=t;break;case 65:case 90:case 122:throw Hp(new ak(kWn((u$(),z8n))))}return n},MWn.ul=function(n){var t;switch(n){case 100:t=32==(32&this.e)?ZUn("Nd",!0):(wWn(),uNt);break;case 68:t=32==(32&this.e)?ZUn("Nd",!1):(wWn(),lNt);break;case 119:t=32==(32&this.e)?ZUn("IsWord",!0):(wWn(),kNt);break;case 87:t=32==(32&this.e)?ZUn("IsWord",!1):(wWn(),wNt);break;case 115:t=32==(32&this.e)?ZUn("IsSpace",!0):(wWn(),gNt);break;case 83:t=32==(32&this.e)?ZUn("IsSpace",!1):(wWn(),bNt);break;default:throw Hp(new dy(ont+n.toString(16)))}return t},MWn.vl=function(n){var t,e,i,r,c,a,u,o,s,h,f;for(this.b=1,QXn(this),t=null,0==this.c&&94==this.a?(QXn(this),n?(wWn(),wWn(),s=new M0(5)):(wWn(),wWn(),Yxn(t=new M0(4),0,unt),s=new M0(4))):(wWn(),wWn(),s=new M0(4)),r=!0;1!=(f=this.c)&&(0!=f||93!=this.a||r);){if(r=!1,e=this.a,i=!1,10==f)switch(e){case 100:case 68:case 119:case 87:case 115:case 83:sHn(s,this.ul(e)),i=!0;break;case 105:case 73:case 99:case 67:(e=this.Ll(s,e))<0&&(i=!0);break;case 112:case 80:if(!(h=DIn(this,e)))throw Hp(new ak(kWn((u$(),O8n))));sHn(s,h),i=!0;break;default:e=this.tl()}else if(20==f){if((c=lx(this.i,58,this.d))<0)throw Hp(new ak(kWn((u$(),A8n))));if(a=!0,94==fV(this.i,this.d)&&(++this.d,a=!1),!(u=b9(fx(this.i,this.d,c),a,512==(512&this.e))))throw Hp(new ak(kWn((u$(),L8n))));if(sHn(s,u),i=!0,c+1>=this.j||93!=fV(this.i,c+1))throw Hp(new ak(kWn((u$(),A8n))));this.d=c+2}if(QXn(this),!i)if(0!=this.c||45!=this.a)Yxn(s,e,e);else{if(QXn(this),1==(f=this.c))throw Hp(new ak(kWn((u$(),$8n))));0==f&&93==this.a?(Yxn(s,e,e),Yxn(s,45,45)):(o=this.a,10==f&&(o=this.tl()),QXn(this),Yxn(s,e,o))}(this.e&k6n)==k6n&&0==this.c&&44==this.a&&QXn(this)}if(1==this.c)throw Hp(new ak(kWn((u$(),$8n))));return t&&(WGn(t,s),s=t),T$n(s),qHn(s),this.b=0,QXn(this),s},MWn.wl=function(){var n,t,e,i;for(e=this.vl(!1);7!=(i=this.c);){if(n=this.a,(0!=i||45!=n&&38!=n)&&4!=i)throw Hp(new ak(kWn((u$(),_8n))));if(QXn(this),9!=this.c)throw Hp(new ak(kWn((u$(),K8n))));if(t=this.vl(!1),4==i)sHn(e,t);else if(45==n)WGn(e,t);else{if(38!=n)throw Hp(new dy("ASSERT"));kGn(e,t)}}return QXn(this),e},MWn.xl=function(){var n,t;return n=this.a-48,wWn(),wWn(),t=new vJ(12,null,n),!this.g&&(this.g=new _v),Cv(this.g,new Op(n)),QXn(this),t},MWn.yl=function(){return QXn(this),wWn(),pNt},MWn.zl=function(){return QXn(this),wWn(),dNt},MWn.Al=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Bl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Cl=function(){return QXn(this),fsn()},MWn.Dl=function(){return QXn(this),wWn(),mNt},MWn.El=function(){return QXn(this),wWn(),jNt},MWn.Fl=function(){var n;if(this.d>=this.j||64!=(65504&(n=fV(this.i,this.d++))))throw Hp(new ak(kWn((u$(),S8n))));return QXn(this),wWn(),wWn(),new oG(0,n-64)},MWn.Gl=function(){return QXn(this),RFn()},MWn.Hl=function(){return QXn(this),wWn(),ENt},MWn.Il=function(){var n;return wWn(),wWn(),n=new oG(0,105),QXn(this),n},MWn.Jl=function(){return QXn(this),wWn(),yNt},MWn.Kl=function(){return QXn(this),wWn(),vNt},MWn.Ll=function(n,t){return this.tl()},MWn.Ml=function(){return QXn(this),wWn(),hNt},MWn.Nl=function(){var n,t,e,i,r;if(this.d+1>=this.j)throw Hp(new ak(kWn((u$(),E8n))));if(i=-1,t=null,49<=(n=fV(this.i,this.d))&&n<=57){if(i=n-48,!this.g&&(this.g=new _v),Cv(this.g,new Op(i)),++this.d,41!=fV(this.i,this.d))throw Hp(new ak(kWn((u$(),y8n))));++this.d}else switch(63==n&&--this.d,QXn(this),(t=OXn(this)).e){case 20:case 21:case 22:case 23:break;case 8:if(7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));break;default:throw Hp(new ak(kWn((u$(),T8n))))}if(QXn(this),e=null,2==(r=Vdn(this)).e){if(2!=r.em())throw Hp(new ak(kWn((u$(),M8n))));e=r.am(1),r=r.am(0)}if(7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),wWn(),wWn(),new jnn(i,t,r,e)},MWn.Ol=function(){return QXn(this),wWn(),fNt},MWn.Pl=function(){var n;if(QXn(this),n=uU(24,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Ql=function(){var n;if(QXn(this),n=uU(20,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Rl=function(){var n;if(QXn(this),n=uU(22,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Sl=function(){var n,t,e,i,r;for(n=0,e=0,t=-1;this.d=this.j)throw Hp(new ak(kWn((u$(),k8n))));if(45==t){for(++this.d;this.d=this.j)throw Hp(new ak(kWn((u$(),k8n))))}if(58==t){if(++this.d,QXn(this),i=AX(Vdn(this),n,e),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));QXn(this)}else{if(41!=t)throw Hp(new ak(kWn((u$(),j8n))));++this.d,QXn(this),i=AX(Vdn(this),n,e)}return i},MWn.Tl=function(){var n;if(QXn(this),n=uU(21,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Ul=function(){var n;if(QXn(this),n=uU(23,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Vl=function(){var n,t;if(QXn(this),n=this.f++,t=oU(Vdn(this),n),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),t},MWn.Wl=function(){var n;if(QXn(this),n=oU(Vdn(this),0),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Xl=function(n){return QXn(this),5==this.c?(QXn(this),gG(n,(wWn(),wWn(),new h4(9,n)))):gG(n,(wWn(),wWn(),new h4(3,n)))},MWn.Yl=function(n){var t;return QXn(this),wWn(),wWn(),t=new r$(2),5==this.c?(QXn(this),tqn(t,sNt),tqn(t,n)):(tqn(t,n),tqn(t,sNt)),t},MWn.Zl=function(n){return QXn(this),5==this.c?(QXn(this),wWn(),wWn(),new h4(9,n)):(wWn(),wWn(),new h4(3,n))},MWn.a=0,MWn.b=0,MWn.c=0,MWn.d=0,MWn.e=0,MWn.f=1,MWn.g=null,MWn.j=0,vX(ant,"RegEx/RegexParser",820),wAn(1824,820,{},Fm),MWn.sl=function(n){return!1},MWn.tl=function(){return qDn(this)},MWn.ul=function(n){return d_n(n)},MWn.vl=function(n){return ZXn(this)},MWn.wl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.xl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.yl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.zl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Al=function(){return QXn(this),d_n(67)},MWn.Bl=function(){return QXn(this),d_n(73)},MWn.Cl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Dl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.El=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Fl=function(){return QXn(this),d_n(99)},MWn.Gl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Hl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Il=function(){return QXn(this),d_n(105)},MWn.Jl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Kl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ll=function(n,t){return sHn(n,d_n(t)),-1},MWn.Ml=function(){return QXn(this),wWn(),wWn(),new oG(0,94)},MWn.Nl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ol=function(){return QXn(this),wWn(),wWn(),new oG(0,36)},MWn.Pl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ql=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Rl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Sl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Tl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ul=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Vl=function(){var n;if(QXn(this),n=oU(Vdn(this),0),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Wl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Xl=function(n){return QXn(this),gG(n,(wWn(),wWn(),new h4(3,n)))},MWn.Yl=function(n){var t;return QXn(this),wWn(),wWn(),tqn(t=new r$(2),n),tqn(t,sNt),t},MWn.Zl=function(n){return QXn(this),wWn(),wWn(),new h4(3,n)};var nNt=null,tNt=null;vX(ant,"RegEx/ParserForXMLSchema",1824),wAn(117,1,ynt,Ap),MWn.$l=function(n){throw Hp(new dy("Not supported."))},MWn._l=function(){return-1},MWn.am=function(n){return null},MWn.bm=function(){return null},MWn.cm=function(n){},MWn.dm=function(n){},MWn.em=function(){return 0},MWn.Ib=function(){return this.fm(0)},MWn.fm=function(n){return 11==this.e?".":""},MWn.e=0;var eNt,iNt,rNt,cNt,aNt,uNt,oNt,sNt,hNt,fNt,lNt,bNt,wNt,dNt,gNt,pNt,vNt,mNt,yNt,kNt,jNt,ENt,TNt,MNt,SNt=null,PNt=null,CNt=null,INt=vX(ant,"RegEx/Token",117);wAn(136,117,{3:1,136:1,117:1},M0),MWn.fm=function(n){var t,e,i;if(4==this.e)if(this==oNt)e=".";else if(this==uNt)e="\\d";else if(this==kNt)e="\\w";else if(this==gNt)e="\\s";else{for((i=new Sk).a+="[",t=0;t0&&(i.a+=","),this.b[t]===this.b[t+1]?cO(i,aBn(this.b[t])):(cO(i,aBn(this.b[t])),i.a+="-",cO(i,aBn(this.b[t+1])));i.a+="]",e=i.a}else if(this==lNt)e="\\D";else if(this==wNt)e="\\W";else if(this==bNt)e="\\S";else{for((i=new Sk).a+="[^",t=0;t0&&(i.a+=","),this.b[t]===this.b[t+1]?cO(i,aBn(this.b[t])):(cO(i,aBn(this.b[t])),i.a+="-",cO(i,aBn(this.b[t+1])));i.a+="]",e=i.a}return e},MWn.a=!1,MWn.c=!1,vX(ant,"RegEx/RangeToken",136),wAn(584,1,{584:1},Op),MWn.a=0,vX(ant,"RegEx/RegexParser/ReferencePosition",584),wAn(583,1,{3:1,583:1},XE),MWn.Fb=function(n){var t;return null!=n&&!!cL(n,583)&&(t=BB(n,583),mK(this.b,t.b)&&this.a==t.a)},MWn.Hb=function(){return vvn(this.b+"/"+txn(this.a))},MWn.Ib=function(){return this.c.fm(this.a)},MWn.a=0,vX(ant,"RegEx/RegularExpression",583),wAn(223,117,ynt,oG),MWn._l=function(){return this.a},MWn.fm=function(n){var t,e;switch(this.e){case 0:switch(this.a){case 124:case 42:case 43:case 63:case 40:case 41:case 46:case 91:case 123:case 92:e="\\"+PR(this.a&QVn);break;case 12:e="\\f";break;case 10:e="\\n";break;case 13:e="\\r";break;case 9:e="\\t";break;case 27:e="\\e";break;default:e=this.a>=BQn?"\\v"+fx(t="0"+(this.a>>>0).toString(16),t.length-6,t.length):""+PR(this.a&QVn)}break;case 8:e=this==hNt||this==fNt?""+PR(this.a&QVn):"\\"+PR(this.a&QVn);break;default:e=null}return e},MWn.a=0,vX(ant,"RegEx/Token/CharToken",223),wAn(309,117,ynt,h4),MWn.am=function(n){return this.a},MWn.cm=function(n){this.b=n},MWn.dm=function(n){this.c=n},MWn.em=function(){return 1},MWn.fm=function(n){var t;if(3==this.e)if(this.c<0&&this.b<0)t=this.a.fm(n)+"*";else if(this.c==this.b)t=this.a.fm(n)+"{"+this.c+"}";else if(this.c>=0&&this.b>=0)t=this.a.fm(n)+"{"+this.c+","+this.b+"}";else{if(!(this.c>=0&&this.b<0))throw Hp(new dy("Token#toString(): CLOSURE "+this.c+FWn+this.b));t=this.a.fm(n)+"{"+this.c+",}"}else if(this.c<0&&this.b<0)t=this.a.fm(n)+"*?";else if(this.c==this.b)t=this.a.fm(n)+"{"+this.c+"}?";else if(this.c>=0&&this.b>=0)t=this.a.fm(n)+"{"+this.c+","+this.b+"}?";else{if(!(this.c>=0&&this.b<0))throw Hp(new dy("Token#toString(): NONGREEDYCLOSURE "+this.c+FWn+this.b));t=this.a.fm(n)+"{"+this.c+",}?"}return t},MWn.b=0,MWn.c=0,vX(ant,"RegEx/Token/ClosureToken",309),wAn(821,117,ynt,UU),MWn.am=function(n){return 0==n?this.a:this.b},MWn.em=function(){return 2},MWn.fm=function(n){return 3==this.b.e&&this.b.am(0)==this.a?this.a.fm(n)+"+":9==this.b.e&&this.b.am(0)==this.a?this.a.fm(n)+"+?":this.a.fm(n)+""+this.b.fm(n)},vX(ant,"RegEx/Token/ConcatToken",821),wAn(1822,117,ynt,jnn),MWn.am=function(n){if(0==n)return this.d;if(1==n)return this.b;throw Hp(new dy("Internal Error: "+n))},MWn.em=function(){return this.b?2:1},MWn.fm=function(n){var t;return t=this.c>0?"(?("+this.c+")":8==this.a.e?"(?("+this.a+")":"(?"+this.a,this.b?t+=this.d+"|"+this.b+")":t+=this.d+")",t},MWn.c=0,vX(ant,"RegEx/Token/ConditionToken",1822),wAn(1823,117,ynt,T0),MWn.am=function(n){return this.b},MWn.em=function(){return 1},MWn.fm=function(n){return"(?"+(0==this.a?"":txn(this.a))+(0==this.c?"":txn(this.c))+":"+this.b.fm(n)+")"},MWn.a=0,MWn.c=0,vX(ant,"RegEx/Token/ModifierToken",1823),wAn(822,117,ynt,cW),MWn.am=function(n){return this.a},MWn.em=function(){return 1},MWn.fm=function(n){var t;switch(t=null,this.e){case 6:t=0==this.b?"(?:"+this.a.fm(n)+")":"("+this.a.fm(n)+")";break;case 20:t="(?="+this.a.fm(n)+")";break;case 21:t="(?!"+this.a.fm(n)+")";break;case 22:t="(?<="+this.a.fm(n)+")";break;case 23:t="(?"+this.a.fm(n)+")"}return t},MWn.b=0,vX(ant,"RegEx/Token/ParenToken",822),wAn(521,117,{3:1,117:1,521:1},vJ),MWn.bm=function(){return this.b},MWn.fm=function(n){return 12==this.e?"\\"+this.a:iAn(this.b)},MWn.a=0,vX(ant,"RegEx/Token/StringToken",521),wAn(465,117,ynt,r$),MWn.$l=function(n){tqn(this,n)},MWn.am=function(n){return BB(bW(this.a,n),117)},MWn.em=function(){return this.a?this.a.a.c.length:0},MWn.fm=function(n){var t,e,i,r,c;if(1==this.e){if(2==this.a.a.c.length)t=BB(bW(this.a,0),117),r=3==(e=BB(bW(this.a,1),117)).e&&e.am(0)==t?t.fm(n)+"+":9==e.e&&e.am(0)==t?t.fm(n)+"+?":t.fm(n)+""+e.fm(n);else{for(c=new Sk,i=0;i=this.c.b:this.a<=this.c.b},MWn.Sb=function(){return this.b>0},MWn.Tb=function(){return this.b},MWn.Vb=function(){return this.b-1},MWn.Qb=function(){throw Hp(new tk(Snt))},MWn.a=0,MWn.b=0,vX(Ent,"ExclusiveRange/RangeIterator",254);var ONt=RW(P9n,"C"),ANt=RW(O9n,"I"),$Nt=RW($Wn,"Z"),LNt=RW(A9n,"J"),NNt=RW(S9n,"B"),xNt=RW(C9n,"D"),DNt=RW(I9n,"F"),RNt=RW($9n,"S"),KNt=bq("org.eclipse.elk.core.labels","ILabelManager"),_Nt=bq(B6n,"DiagnosticChain"),FNt=bq(f7n,"ResourceSet"),BNt=vX(B6n,"InvocationTargetException",null),HNt=(Dk(),f5),qNt=qNt=hEn;Zen(Qp),scn("permProps",[[[Pnt,Cnt],[Int,"gecko1_8"]],[[Pnt,Cnt],[Int,"ie10"]],[[Pnt,Cnt],[Int,"ie8"]],[[Pnt,Cnt],[Int,"ie9"]],[[Pnt,Cnt],[Int,"safari"]]]),qNt(null,"elk",null)}).call(this)}).call(this,void 0!==e.g?e.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(n,t,e){"use strict";function i(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function r(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?n:t}function c(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}var a=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var c=Object.assign({},t),a=!1;try{n.resolve("web-worker"),a=!0}catch(s){}if(t.workerUrl)if(a){var u=n("web-worker");c.workerFactory=function(n){return new u(n)}}else console.warn("Web worker requested but 'web-worker' package not installed. \nConsider installing the package or pass your own 'workerFactory' to ELK's constructor.\n... Falling back to non-web worker version.");if(!c.workerFactory){var o=n("./elk-worker.min.js").Worker;c.workerFactory=function(n){return new o(n)}}return r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,c))}return c(e,t),e}(n("./elk-api.js").default);Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports=a,a.default=a},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(n,t,e){t.exports=Worker},{}]},{},[3])(3)},83209:(n,t,e)=>{"use strict";e.r(t),e.d(t,{diagram:()=>k});var i=e(74737),r=e(59373),c=e(43349),a=e(17295),u=e.n(a);e(30381),e(17967),e(27856),e(70277),e(45625),e(39354),e(91518);const o=new(u()),s={},h={};let f={};const l=(n,t,e)=>{const r={TB:{in:{north:"north"},out:{south:"west",west:"east",east:"south"}},LR:{in:{west:"west"},out:{east:"south",south:"north",north:"east"}},RL:{in:{east:"east"},out:{west:"north",north:"south",south:"west"}},BT:{in:{south:"south"},out:{north:"east",east:"west",west:"north"}}};return r.TD=r.TB,i.l.info("abc88",e,t,n),r[e][t][n]},b=(n,t,e)=>{if(i.l.info("getNextPort abc88",{node:n,edgeDirection:t,graphDirection:e}),!s[n])switch(e){case"TB":case"TD":s[n]={inPosition:"north",outPosition:"south"};break;case"BT":s[n]={inPosition:"south",outPosition:"north"};break;case"RL":s[n]={inPosition:"east",outPosition:"west"};break;case"LR":s[n]={inPosition:"west",outPosition:"east"}}const r="in"===t?s[n].inPosition:s[n].outPosition;return"in"===t?s[n].inPosition=l(s[n].inPosition,t,e):s[n].outPosition=l(s[n].outPosition,t,e),r},w=function(n,t,e,c){i.l.info("abc78 edges = ",n);const a=c.insert("g").attr("class","edgeLabels");let u,o,s={},l=t.db.getDirection();if(void 0!==n.defaultStyle){const t=(0,i.a)(n.defaultStyle);u=t.style,o=t.labelStyle}return n.forEach((function(t){var c="L-"+t.start+"-"+t.end;void 0===s[c]?(s[c]=0,i.l.info("abc78 new entry",c,s[c])):(s[c]++,i.l.info("abc78 new entry",c,s[c]));let w=c+"-"+s[c];i.l.info("abc78 new link id to be used is",c,w,s[c]);var d="LS-"+t.start,g="LE-"+t.end;const p={style:"",labelStyle:""};switch(p.minlen=t.length||1,"arrow_open"===t.type?p.arrowhead="none":p.arrowhead="normal",p.arrowTypeStart="arrow_open",p.arrowTypeEnd="arrow_open",t.type){case"double_arrow_cross":p.arrowTypeStart="arrow_cross";case"arrow_cross":p.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":p.arrowTypeStart="arrow_point";case"arrow_point":p.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":p.arrowTypeStart="arrow_circle";case"arrow_circle":p.arrowTypeEnd="arrow_circle"}let v="",m="";switch(t.stroke){case"normal":v="fill:none;",void 0!==u&&(v=u),void 0!==o&&(m=o),p.thickness="normal",p.pattern="solid";break;case"dotted":p.thickness="normal",p.pattern="dotted",p.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":p.thickness="thick",p.pattern="solid",p.style="stroke-width: 3.5px;fill:none;"}if(void 0!==t.style){const n=(0,i.a)(t.style);v=n.style,m=n.labelStyle}p.style=p.style+=v,p.labelStyle=p.labelStyle+=m,void 0!==t.interpolate?p.curve=(0,i.d)(t.interpolate,r.c_6):void 0!==n.defaultInterpolate?p.curve=(0,i.d)(n.defaultInterpolate,r.c_6):p.curve=(0,i.d)(h.curve,r.c_6),void 0===t.text?void 0!==t.style&&(p.arrowheadStyle="fill: #333"):(p.arrowheadStyle="fill: #333",p.labelpos="c"),p.labelType="text",p.label=t.text.replace(i.c.lineBreakRegex,"\n"),void 0===t.style&&(p.style=p.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),p.labelStyle=p.labelStyle.replace("color:","fill:"),p.id=w,p.classes="flowchart-link "+d+" "+g;const y=(0,i.f)(a,p),{source:k,target:j}=((n,t)=>{let e=n.start,i=n.end;const r=f[e],c=f[i];return r&&c?("diamond"===r.type&&(e=`${e}-${b(e,"out",t)}`),"diamond"===c.type&&(i=`${i}-${b(i,"in",t)}`),{source:e,target:i}):{source:e,target:i}})(t,l);i.l.debug("abc78 source and target",k,j),e.edges.push({id:"e"+t.start+t.end,sources:[k],targets:[j],labelEl:y,labels:[{width:p.width,height:p.height,orgWidth:p.width,orgHeight:p.height,text:p.label,layoutOptions:{"edgeLabels.inline":"true","edgeLabels.placement":"CENTER"}}],edgeData:p})})),e},d=function(n,t,e){const i=((n,t,e)=>{const{parentById:i}=e,r=new Set;let c=n;for(;c;){if(r.add(c),c===t)return c;c=i[c]}for(c=t;c;){if(r.has(c))return c;c=i[c]}return"root"})(n,t,e);if(void 0===i||"root"===i)return{x:0,y:0};const r=f[i].offset;return{x:r.posX,y:r.posY}},g=function(n,t,e,i,c){const a=d(t.sources[0],t.targets[0],c),u=t.sections[0].startPoint,o=t.sections[0].endPoint,s=(t.sections[0].bendPoints?t.sections[0].bendPoints:[]).map((n=>[n.x+a.x,n.y+a.y])),h=[[u.x+a.x,u.y+a.y],...s,[o.x+a.x,o.y+a.y]],f=(0,r.jvg)().curve(r.c_6),l=n.insert("path").attr("d",f(h)).attr("class","path").attr("fill","none"),b=n.insert("g").attr("class","edgeLabel"),w=(0,r.Ys)(b.node().appendChild(t.labelEl)),g=w.node().firstChild.getBoundingClientRect();w.attr("width",g.width),w.attr("height",g.height),b.attr("transform",`translate(${t.labels[0].x+a.x}, ${t.labels[0].y+a.y})`),function(n,t,e,i){let r="";switch(i&&(r=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,r=r.replace(/\(/g,"\\("),r=r.replace(/\)/g,"\\)")),t.arrowTypeStart){case"arrow_cross":n.attr("marker-start","url("+r+"#"+e+"-crossStart)");break;case"arrow_point":n.attr("marker-start","url("+r+"#"+e+"-pointStart)");break;case"arrow_barb":n.attr("marker-start","url("+r+"#"+e+"-barbStart)");break;case"arrow_circle":n.attr("marker-start","url("+r+"#"+e+"-circleStart)");break;case"aggregation":n.attr("marker-start","url("+r+"#"+e+"-aggregationStart)");break;case"extension":n.attr("marker-start","url("+r+"#"+e+"-extensionStart)");break;case"composition":n.attr("marker-start","url("+r+"#"+e+"-compositionStart)");break;case"dependency":n.attr("marker-start","url("+r+"#"+e+"-dependencyStart)");break;case"lollipop":n.attr("marker-start","url("+r+"#"+e+"-lollipopStart)")}switch(t.arrowTypeEnd){case"arrow_cross":n.attr("marker-end","url("+r+"#"+e+"-crossEnd)");break;case"arrow_point":n.attr("marker-end","url("+r+"#"+e+"-pointEnd)");break;case"arrow_barb":n.attr("marker-end","url("+r+"#"+e+"-barbEnd)");break;case"arrow_circle":n.attr("marker-end","url("+r+"#"+e+"-circleEnd)");break;case"aggregation":n.attr("marker-end","url("+r+"#"+e+"-aggregationEnd)");break;case"extension":n.attr("marker-end","url("+r+"#"+e+"-extensionEnd)");break;case"composition":n.attr("marker-end","url("+r+"#"+e+"-compositionEnd)");break;case"dependency":n.attr("marker-end","url("+r+"#"+e+"-dependencyEnd)");break;case"lollipop":n.attr("marker-end","url("+r+"#"+e+"-lollipopEnd)")}}(l,e,i.type,i.arrowMarkerAbsolute)},p=(n,t)=>{n.forEach((n=>{n.children||(n.children=[]);const e=t.childrenById[n.id];e&&e.forEach((t=>{n.children.push(f[t])})),p(n.children,t)}))},v=(n,t,e,r,c,a,u)=>{e.forEach((function(e){if(e)if(f[e.id].offset={posX:e.x+n,posY:e.y+t,x:n,y:t,depth:u,width:e.width,height:e.height},"group"===e.type){const r=c.insert("g").attr("class","subgraph");r.insert("rect").attr("class","subgraph subgraph-lvl-"+u%5+" node").attr("x",e.x+n).attr("y",e.y+t).attr("width",e.width).attr("height",e.height);const a=r.insert("g").attr("class","label");a.attr("transform",`translate(${e.labels[0].x+n+e.x}, ${e.labels[0].y+t+e.y})`),a.node().appendChild(e.labelData.labelNode),i.l.info("Id (UGH)= ",e.type,e.labels)}else i.l.info("Id (UGH)= ",e.id),e.el.attr("transform",`translate(${e.x+n+e.width/2}, ${e.y+t+e.height/2})`)})),e.forEach((function(e){e&&"group"===e.type&&v(n+e.x,t+e.y,e.children,r,c,a,u+1)}))},m={getClasses:function(n,t){i.l.info("Extracting classes"),t.db.clear("ver-2");try{return t.parse(n),t.db.getClasses()}catch(e){return{}}},draw:async function(n,t,e,a){var u;a.db.clear(),f={},a.db.setGen("gen-2"),a.parser.parse(n);const s=(0,r.Ys)("body").append("div").attr("style","height:400px").attr("id","cy");let h={id:"root",layoutOptions:{"elk.hierarchyHandling":"INCLUDE_CHILDREN","org.eclipse.elk.padding":"[top=100, left=100, bottom=110, right=110]","elk.layered.spacing.edgeNodeBetweenLayers":"30","elk.direction":"DOWN"},children:[],edges:[]};switch(i.l.info("Drawing flowchart using v3 renderer",o),a.db.getDirection()){case"BT":h.layoutOptions["elk.direction"]="UP";break;case"TB":h.layoutOptions["elk.direction"]="DOWN";break;case"LR":h.layoutOptions["elk.direction"]="RIGHT";break;case"RL":h.layoutOptions["elk.direction"]="LEFT"}const{securityLevel:l,flowchart:b}=(0,i.g)();let d;"sandbox"===l&&(d=(0,r.Ys)("#i"+t));const m="sandbox"===l?(0,r.Ys)(d.nodes()[0].contentDocument.body):(0,r.Ys)("body"),y="sandbox"===l?d.nodes()[0].contentDocument:document,k=m.select(`[id="${t}"]`);(0,i.i)(k,["point","circle","cross"],a.type,a.arrowMarkerAbsolute);const j=a.db.getVertices();let E;const T=a.db.getSubGraphs();i.l.info("Subgraphs - ",T);for(let i=T.length-1;i>=0;i--)E=T[i],a.db.addVertex(E.id,E.title,"group",void 0,E.classes,E.dir);const M=k.insert("g").attr("class","subgraphs"),S=function(n){const t={parentById:{},childrenById:{}},e=n.getSubGraphs();return i.l.info("Subgraphs - ",e),e.forEach((function(n){n.nodes.forEach((function(e){t.parentById[e]=n.id,void 0===t.childrenById[n.id]&&(t.childrenById[n.id]=[]),t.childrenById[n.id].push(e)}))})),e.forEach((function(n){n.id,void 0!==t.parentById[n.id]&&t.parentById[n.id]})),t}(a.db);h=function(n,t,e,r,a,u,o){const s=e.select(`[id="${t}"]`),h=s.insert("g").attr("class","nodes");return Object.keys(n).forEach((function(t){const e=n[t];let o="default";e.classes.length>0&&(o=e.classes.join(" "));const l=(0,i.a)(e.styles);let b,w=void 0!==e.text?e.text:e.id;const d={width:0,height:0};if((0,i.e)((0,i.g)().flowchart.htmlLabels)){const n={label:w.replace(/fa[blrs]?:fa-[\w-]+/g,(n=>``))};b=(0,c.a)(s,n).node();const t=b.getBBox();d.width=t.width,d.height=t.height,d.labelNode=b,b.parentNode.removeChild(b)}else{const n=r.createElementNS("http://www.w3.org/2000/svg","text");n.setAttribute("style",l.labelStyle.replace("color:","fill:"));const t=w.split(i.c.lineBreakRegex);for(const i of t){const t=r.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),t.setAttribute("dy","1em"),t.setAttribute("x","1"),t.textContent=i,n.appendChild(t)}b=n;const e=b.getBBox();d.width=e.width,d.height=e.height,d.labelNode=b}const g=[{id:e.id+"-west",layoutOptions:{"port.side":"WEST"}},{id:e.id+"-east",layoutOptions:{"port.side":"EAST"}},{id:e.id+"-south",layoutOptions:{"port.side":"SOUTH"}},{id:e.id+"-north",layoutOptions:{"port.side":"NORTH"}}];let p=0,v="",m={};switch(e.type){case"round":p=5,v="rect";break;case"square":case"group":default:v="rect";break;case"diamond":v="question",m={portConstraints:"FIXED_SIDE"};break;case"hexagon":v="hexagon";break;case"odd":case"odd_right":v="rect_left_inv_arrow";break;case"lean_right":v="lean_right";break;case"lean_left":v="lean_left";break;case"trapezoid":v="trapezoid";break;case"inv_trapezoid":v="inv_trapezoid";break;case"circle":v="circle";break;case"ellipse":v="ellipse";break;case"stadium":v="stadium";break;case"subroutine":v="subroutine";break;case"cylinder":v="cylinder";break;case"doublecircle":v="doublecircle"}const y={labelStyle:l.labelStyle,shape:v,labelText:w,rx:p,ry:p,class:o,style:l.style,id:e.id,link:e.link,linkTarget:e.linkTarget,tooltip:a.db.getTooltip(e.id)||"",domId:a.db.lookUpDomId(e.id),haveCallback:e.haveCallback,width:"group"===e.type?500:void 0,dir:e.dir,type:e.type,props:e.props,padding:(0,i.g)().flowchart.padding};let k,j;"group"!==y.type&&(j=(0,i.b)(h,y,e.dir),k=j.node().getBBox());const E={id:e.id,ports:"diamond"===e.type?g:[],layoutOptions:m,labelText:w,labelData:d,domId:a.db.lookUpDomId(e.id),width:null==k?void 0:k.width,height:null==k?void 0:k.height,type:e.type,el:j,parent:u.parentById[e.id]};f[y.id]=E})),o}(j,t,m,y,a,S,h);const P=k.insert("g").attr("class","edges edgePath"),C=a.db.getEdges();h=w(C,a,h,k);Object.keys(f).forEach((n=>{const t=f[n];t.parent||h.children.push(t),void 0!==S.childrenById[n]&&(t.labels=[{text:t.labelText,layoutOptions:{"nodeLabels.placement":"[H_CENTER, V_TOP, INSIDE]"},width:t.labelData.width,height:t.labelData.height}],delete t.x,delete t.y,delete t.width,delete t.height)})),p(h.children,S),i.l.info("after layout",JSON.stringify(h,null,2));const I=await o.layout(h);v(0,0,I.children,k,M,a,0),i.l.info("after layout",I),null==(u=I.edges)||u.map((n=>{g(P,n,n.edgeData,a,S)})),(0,i.s)({},k,b.diagramPadding,b.useMaxWidth),s.remove()}},y=n=>`.label {\n font-family: ${n.fontFamily};\n color: ${n.nodeTextColor||n.textColor};\n }\n .cluster-label text {\n fill: ${n.titleColor};\n }\n .cluster-label span {\n color: ${n.titleColor};\n }\n\n .label text,span {\n fill: ${n.nodeTextColor||n.textColor};\n color: ${n.nodeTextColor||n.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${n.mainBkg};\n stroke: ${n.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${n.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${n.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${n.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${n.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${n.edgeLabelBackground};\n fill: ${n.edgeLabelBackground};\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ${n.clusterBkg};\n stroke: ${n.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${n.titleColor};\n }\n\n .cluster span {\n color: ${n.titleColor};\n }\n /* .cluster div {\n color: ${n.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${n.fontFamily};\n font-size: 12px;\n background: ${n.tertiaryColor};\n border: 1px solid ${n.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${n.textColor};\n }\n .subgraph {\n stroke-width:2;\n rx:3;\n }\n // .subgraph-lvl-1 {\n // fill:#ccc;\n // // stroke:black;\n // }\n ${(n=>{let t="";for(let e=0;e<5;e++)t+=`\n .subgraph-lvl-${e} {\n fill: ${n[`surface${e}`]};\n stroke: ${n[`surfacePeer${e}`]};\n }\n `;return t})(n)}\n`,k={db:i.h,renderer:m,parser:i.p,styles:y}}}]); \ No newline at end of file diff --git a/docs/assets/js/83697071.c02d7a68.js b/docs/assets/js/83697071.c02d7a68.js new file mode 100644 index 000000000..d3babd726 --- /dev/null +++ b/docs/assets/js/83697071.c02d7a68.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[75894],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||p[m]||s;return n?r.createElement(v,o(o({ref:t},d),{},{components:n})):r.createElement(v,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.3.1/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.3.1/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.3.1/basics/events",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.3.1/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.3.1/basics/cross-calls"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Different blockchains implement events in different ways. Odra lets you forget about it by introducing\nOdra Events. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{Event, contract_env};\nuse odra::types::{Address, BlockTime, event::OdraEvent};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract {\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n\n#[odra::module]\nimpl PartyContract {\n #[odra(init)]\n pub fn init(&self) {\n PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n }.emit();\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, we derive an ",(0,a.kt)("inlineCode",{parentName:"p"},"Event")," macro like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n")),(0,a.kt)("p",null,"Among other things, it adds an ",(0,a.kt)("inlineCode",{parentName:"p"},"emit()")," function to the struct, which allows you to emit the event simply\nas that:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n}.emit();\n")),(0,a.kt)("p",null,"Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. "),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a handy macro ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{assert_events, test_env};\nuse crate::docs::events::PartyStarted;\nuse super::PartyContractDeployer;\n\n#[test]\nfn test_party() {\n let party_contract = PartyContractDeployer::init();\n assert_events!(\n party_contract,\n PartyStarted {\n caller: test_env::get_account(0),\n block_time: 0,\n }\n );\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/84611.915c8d72.js b/docs/assets/js/84611.915c8d72.js new file mode 100644 index 000000000..9128c9ff1 --- /dev/null +++ b/docs/assets/js/84611.915c8d72.js @@ -0,0 +1,2 @@ +/*! For license information please see 84611.915c8d72.js.LICENSE.txt */ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[84611],{71639:(e,t,n)=>{"use strict";e.exports=n(29281)},47114:(e,t,n)=>{"use strict";var i=n(85670),r={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:"0"},defaultClasses:{root:"algolia-autocomplete",prefix:"aa",noPrefix:!1,dropdownMenu:"dropdown-menu",input:"input",hint:"hint",suggestions:"suggestions",suggestion:"suggestion",cursor:"cursor",dataset:"dataset",empty:"empty"},appendTo:{wrapper:{position:"absolute",zIndex:"100",display:"none"},input:{},inputWithNoHint:{},dropdown:{display:"block"}}};i.isMsie()&&i.mixin(r.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),i.isMsie()&&i.isMsie()<=7&&i.mixin(r.input,{marginTop:"-1px"}),e.exports=r},13312:(e,t,n)=>{"use strict";var i="aaDataset",r="aaValue",s="aaDatum",o=n(85670),a=n(33855),u=n(26619),c=n(47114),l=n(6823);function h(e){var t;(e=e||{}).templates=e.templates||{},e.source||o.error("missing source"),e.name&&(t=e.name,!/^[_a-zA-Z0-9-]+$/.test(t))&&o.error("invalid dataset name: "+e.name),this.query=null,this._isEmpty=!0,this.highlight=!!e.highlight,this.name=void 0===e.name||null===e.name?o.getUniqueId():e.name,this.source=e.source,this.displayFn=function(e){return e=e||"value",o.isFunction(e)?e:t;function t(t){return t[e]}}(e.display||e.displayKey),this.debounce=e.debounce,this.cache=!1!==e.cache,this.templates=function(e,t){return{empty:e.empty&&o.templatify(e.empty),header:e.header&&o.templatify(e.header),footer:e.footer&&o.templatify(e.footer),suggestion:e.suggestion||n};function n(e){return"

"+t(e)+"

"}}(e.templates,this.displayFn),this.css=o.mixin({},c,e.appendTo?c.appendTo:{}),this.cssClasses=e.cssClasses=o.mixin({},c.defaultClasses,e.cssClasses||{}),this.cssClasses.prefix=e.cssClasses.formattedPrefix||o.formatPrefix(this.cssClasses.prefix,this.cssClasses.noPrefix);var n=o.className(this.cssClasses.prefix,this.cssClasses.dataset);this.$el=e.$menu&&e.$menu.find(n+"-"+this.name).length>0?a.element(e.$menu.find(n+"-"+this.name)[0]):a.element(u.dataset.replace("%CLASS%",this.name).replace("%PREFIX%",this.cssClasses.prefix).replace("%DATASET%",this.cssClasses.dataset)),this.$menu=e.$menu,this.clearCachedSuggestions()}h.extractDatasetName=function(e){return a.element(e).data(i)},h.extractValue=function(e){return a.element(e).data(r)},h.extractDatum=function(e){var t=a.element(e).data(s);return"string"==typeof t&&(t=JSON.parse(t)),t},o.mixin(h.prototype,l,{_render:function(e,t){if(this.$el){var n,c=this,l=[].slice.call(arguments,2);if(this.$el.empty(),n=t&&t.length,this._isEmpty=!n,!n&&this.templates.empty)this.$el.html(h.apply(this,l)).prepend(c.templates.header?d.apply(this,l):null).append(c.templates.footer?f.apply(this,l):null);else if(n)this.$el.html(p.apply(this,l)).prepend(c.templates.header?d.apply(this,l):null).append(c.templates.footer?f.apply(this,l):null);else if(t&&!Array.isArray(t))throw new TypeError("suggestions must be an array");this.$menu&&this.$menu.addClass(this.cssClasses.prefix+(n?"with":"without")+"-"+this.name).removeClass(this.cssClasses.prefix+(n?"without":"with")+"-"+this.name),this.trigger("rendered",e)}function h(){var t=[].slice.call(arguments,0);return t=[{query:e,isEmpty:!0}].concat(t),c.templates.empty.apply(this,t)}function p(){var e,n,l=[].slice.call(arguments,0),h=this,p=u.suggestions.replace("%PREFIX%",this.cssClasses.prefix).replace("%SUGGESTIONS%",this.cssClasses.suggestions);return e=a.element(p).css(this.css.suggestions),n=o.map(t,d),e.append.apply(e,n),e;function d(e){var t,n=u.suggestion.replace("%PREFIX%",h.cssClasses.prefix).replace("%SUGGESTION%",h.cssClasses.suggestion);return(t=a.element(n).attr({role:"option",id:["option",Math.floor(1e8*Math.random())].join("-")}).append(c.templates.suggestion.apply(this,[e].concat(l)))).data(i,c.name),t.data(r,c.displayFn(e)||void 0),t.data(s,JSON.stringify(e)),t.children().each((function(){a.element(this).css(h.css.suggestionChild)})),t}}function d(){var t=[].slice.call(arguments,0);return t=[{query:e,isEmpty:!n}].concat(t),c.templates.header.apply(this,t)}function f(){var t=[].slice.call(arguments,0);return t=[{query:e,isEmpty:!n}].concat(t),c.templates.footer.apply(this,t)}},getRoot:function(){return this.$el},update:function(e){function t(t){if(!this.canceled&&e===this.query){var n=[].slice.call(arguments,1);this.cacheSuggestions(e,t,n),this._render.apply(this,[e,t].concat(n))}}if(this.query=e,this.canceled=!1,this.shouldFetchFromCache(e))t.apply(this,[this.cachedSuggestions].concat(this.cachedRenderExtraArgs));else{var n=this,i=function(){n.canceled||n.source(e,t.bind(n))};if(this.debounce){clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout((function(){n.debounceTimeout=null,i()}),this.debounce)}else i()}},cacheSuggestions:function(e,t,n){this.cachedQuery=e,this.cachedSuggestions=t,this.cachedRenderExtraArgs=n},shouldFetchFromCache:function(e){return this.cache&&this.cachedQuery===e&&this.cachedSuggestions&&this.cachedSuggestions.length},clearCachedSuggestions:function(){delete this.cachedQuery,delete this.cachedSuggestions,delete this.cachedRenderExtraArgs},cancel:function(){this.canceled=!0},clear:function(){this.$el&&(this.cancel(),this.$el.empty(),this.trigger("rendered",""))},isEmpty:function(){return this._isEmpty},destroy:function(){this.clearCachedSuggestions(),this.$el=null}}),e.exports=h},35445:(e,t,n)=>{"use strict";var i=n(85670),r=n(33855),s=n(6823),o=n(13312),a=n(47114);function u(e){var t,n,s,o=this;(e=e||{}).menu||i.error("menu is required"),i.isArray(e.datasets)||i.isObject(e.datasets)||i.error("1 or more datasets required"),e.datasets||i.error("datasets is required"),this.isOpen=!1,this.isEmpty=!0,this.minLength=e.minLength||0,this.templates={},this.appendTo=e.appendTo||!1,this.css=i.mixin({},a,e.appendTo?a.appendTo:{}),this.cssClasses=e.cssClasses=i.mixin({},a.defaultClasses,e.cssClasses||{}),this.cssClasses.prefix=e.cssClasses.formattedPrefix||i.formatPrefix(this.cssClasses.prefix,this.cssClasses.noPrefix),t=i.bind(this._onSuggestionClick,this),n=i.bind(this._onSuggestionMouseEnter,this),s=i.bind(this._onSuggestionMouseLeave,this);var c=i.className(this.cssClasses.prefix,this.cssClasses.suggestion);this.$menu=r.element(e.menu).on("mouseenter.aa",c,n).on("mouseleave.aa",c,s).on("click.aa",c,t),this.$container=e.appendTo?e.wrapper:this.$menu,e.templates&&e.templates.header&&(this.templates.header=i.templatify(e.templates.header),this.$menu.prepend(this.templates.header())),e.templates&&e.templates.empty&&(this.templates.empty=i.templatify(e.templates.empty),this.$empty=r.element('
'),this.$menu.append(this.$empty),this.$empty.hide()),this.datasets=i.map(e.datasets,(function(t){return function(e,t,n){return new u.Dataset(i.mixin({$menu:e,cssClasses:n},t))}(o.$menu,t,e.cssClasses)})),i.each(this.datasets,(function(e){var t=e.getRoot();t&&0===t.parent().length&&o.$menu.append(t),e.onSync("rendered",o._onRendered,o)})),e.templates&&e.templates.footer&&(this.templates.footer=i.templatify(e.templates.footer),this.$menu.append(this.templates.footer()));var l=this;r.element(window).resize((function(){l._redraw()}))}i.mixin(u.prototype,s,{_onSuggestionClick:function(e){this.trigger("suggestionClicked",r.element(e.currentTarget))},_onSuggestionMouseEnter:function(e){var t=r.element(e.currentTarget);if(!t.hasClass(i.className(this.cssClasses.prefix,this.cssClasses.cursor,!0))){this._removeCursor();var n=this;setTimeout((function(){n._setCursor(t,!1)}),0)}},_onSuggestionMouseLeave:function(e){if(e.relatedTarget&&r.element(e.relatedTarget).closest("."+i.className(this.cssClasses.prefix,this.cssClasses.cursor,!0)).length>0)return;this._removeCursor(),this.trigger("cursorRemoved")},_onRendered:function(e,t){if(this.isEmpty=i.every(this.datasets,(function(e){return e.isEmpty()})),this.isEmpty)if(t.length>=this.minLength&&this.trigger("empty"),this.$empty)if(t.length=this.minLength?this._show():this._hide());this.trigger("datasetRendered")},_hide:function(){this.$container.hide()},_show:function(){this.$container.css("display","block"),this._redraw(),this.trigger("shown")},_redraw:function(){this.isOpen&&this.appendTo&&this.trigger("redrawn")},_getSuggestions:function(){return this.$menu.find(i.className(this.cssClasses.prefix,this.cssClasses.suggestion))},_getCursor:function(){return this.$menu.find(i.className(this.cssClasses.prefix,this.cssClasses.cursor)).first()},_setCursor:function(e,t){e.first().addClass(i.className(this.cssClasses.prefix,this.cssClasses.cursor,!0)).attr("aria-selected","true"),this.trigger("cursorMoved",t)},_removeCursor:function(){this._getCursor().removeClass(i.className(this.cssClasses.prefix,this.cssClasses.cursor,!0)).removeAttr("aria-selected")},_moveCursor:function(e){var t,n,i,r;this.isOpen&&(n=this._getCursor(),t=this._getSuggestions(),this._removeCursor(),-1!==(i=((i=t.index(n)+e)+1)%(t.length+1)-1)?(i<-1&&(i=t.length-1),this._setCursor(r=t.eq(i),!0),this._ensureVisible(r)):this.trigger("cursorRemoved"))},_ensureVisible:function(e){var t,n,i,r;n=(t=e.position().top)+e.height()+parseInt(e.css("margin-top"),10)+parseInt(e.css("margin-bottom"),10),i=this.$menu.scrollTop(),r=this.$menu.height()+parseInt(this.$menu.css("padding-top"),10)+parseInt(this.$menu.css("padding-bottom"),10),t<0?this.$menu.scrollTop(i+t):r{"use strict";var i=n(85670),r=n(33855);function s(e){e&&e.el||i.error("EventBus initialized without el"),this.$el=r.element(e.el)}i.mixin(s.prototype,{trigger:function(e,t,n,r){var s=i.Event("autocomplete:"+e);return this.$el.trigger(s,[t,n,r]),s}}),e.exports=s},6823:(e,t,n)=>{"use strict";var i=n(70624),r=/\s+/;function s(e,t,n,i){var s;if(!n)return this;for(t=t.split(r),n=i?function(e,t){return e.bind?e.bind(t):function(){e.apply(t,[].slice.call(arguments,0))}}(n,i):n,this._callbacks=this._callbacks||{};s=t.shift();)this._callbacks[s]=this._callbacks[s]||{sync:[],async:[]},this._callbacks[s][e].push(n);return this}function o(e,t,n){return function(){for(var i,r=0,s=e.length;!i&&r{"use strict";e.exports={wrapper:'',dropdown:'',dataset:'
',suggestions:'',suggestion:'
'}},21286:(e,t,n)=>{"use strict";var i;i={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"};var r=n(85670),s=n(33855),o=n(6823);function a(e){var t,n,o,a,u,c=this;(e=e||{}).input||r.error("input is missing"),t=r.bind(this._onBlur,this),n=r.bind(this._onFocus,this),o=r.bind(this._onKeydown,this),a=r.bind(this._onInput,this),this.$hint=s.element(e.hint),this.$input=s.element(e.input).on("blur.aa",t).on("focus.aa",n).on("keydown.aa",o),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=r.noop),r.isMsie()?this.$input.on("keydown.aa keypress.aa cut.aa paste.aa",(function(e){i[e.which||e.keyCode]||r.defer(r.bind(c._onInput,c,e))})):this.$input.on("input.aa",a),this.query=this.$input.val(),this.$overflowHelper=(u=this.$input,s.element('').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:u.css("font-family"),fontSize:u.css("font-size"),fontStyle:u.css("font-style"),fontVariant:u.css("font-variant"),fontWeight:u.css("font-weight"),wordSpacing:u.css("word-spacing"),letterSpacing:u.css("letter-spacing"),textIndent:u.css("text-indent"),textRendering:u.css("text-rendering"),textTransform:u.css("text-transform")}).insertAfter(u))}function u(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}a.normalizeQuery=function(e){return(e||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},r.mixin(a.prototype,o,{_onBlur:function(){this.resetInputValue(),this.$input.removeAttr("aria-activedescendant"),this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(e){var t=i[e.which||e.keyCode];this._managePreventDefault(t,e),t&&this._shouldTrigger(t,e)&&this.trigger(t+"Keyed",e)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(e,t){var n,i,r;switch(e){case"tab":i=this.getHint(),r=this.getInputValue(),n=i&&i!==r&&!u(t);break;case"up":case"down":n=!u(t);break;default:n=!1}n&&t.preventDefault()},_shouldTrigger:function(e,t){var n;if("tab"===e)n=!u(t);else n=!0;return n},_checkInputValue:function(){var e,t,n,i,r;e=this.getInputValue(),i=e,r=this.query,n=!(!(t=a.normalizeQuery(i)===a.normalizeQuery(r))||!this.query)&&this.query.length!==e.length,this.query=e,t?n&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(e){this.query=e},getInputValue:function(){return this.$input.val()},setInputValue:function(e,t){void 0===e&&(e=this.query),this.$input.val(e),t?this.clearHint():this._checkInputValue()},expand:function(){this.$input.attr("aria-expanded","true")},collapse:function(){this.$input.attr("aria-expanded","false")},setActiveDescendant:function(e){this.$input.attr("aria-activedescendant",e)},removeActiveDescendant:function(){this.$input.removeAttr("aria-activedescendant")},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(e){this.$hint.val(e)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var e,t,n;n=(e=this.getInputValue())!==(t=this.getHint())&&0===t.indexOf(e),""!==e&&n&&!this.hasOverflow()||this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var e=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=e},isCursorAtEnd:function(){var e,t,n;return e=this.$input.val().length,t=this.$input[0].selectionStart,r.isNumber(t)?t===e:!document.selection||((n=document.selection.createRange()).moveStart("character",-e),e===n.text.length)},destroy:function(){this.$hint.off(".aa"),this.$input.off(".aa"),this.$hint=this.$input=this.$overflowHelper=null}}),e.exports=a},4520:(e,t,n)=>{"use strict";var i="aaAttrs",r=n(85670),s=n(33855),o=n(47368),a=n(21286),u=n(35445),c=n(26619),l=n(47114);function h(e){var t,n;if((e=e||{}).input||r.error("missing input"),this.isActivated=!1,this.debug=!!e.debug,this.autoselect=!!e.autoselect,this.autoselectOnBlur=!!e.autoselectOnBlur,this.openOnFocus=!!e.openOnFocus,this.minLength=r.isNumber(e.minLength)?e.minLength:1,this.autoWidth=void 0===e.autoWidth||!!e.autoWidth,this.clearOnSelected=!!e.clearOnSelected,this.tabAutocomplete=void 0===e.tabAutocomplete||!!e.tabAutocomplete,e.hint=!!e.hint,e.hint&&e.appendTo)throw new Error("[autocomplete.js] hint and appendTo options can't be used at the same time");this.css=e.css=r.mixin({},l,e.appendTo?l.appendTo:{}),this.cssClasses=e.cssClasses=r.mixin({},l.defaultClasses,e.cssClasses||{}),this.cssClasses.prefix=e.cssClasses.formattedPrefix=r.formatPrefix(this.cssClasses.prefix,this.cssClasses.noPrefix),this.listboxId=e.listboxId=[this.cssClasses.root,"listbox",r.getUniqueId()].join("-");var a=function(e){var t,n,o,a;t=s.element(e.input),n=s.element(c.wrapper.replace("%ROOT%",e.cssClasses.root)).css(e.css.wrapper),e.appendTo||"block"!==t.css("display")||"table"!==t.parent().css("display")||n.css("display","table-cell");var u=c.dropdown.replace("%PREFIX%",e.cssClasses.prefix).replace("%DROPDOWN_MENU%",e.cssClasses.dropdownMenu);o=s.element(u).css(e.css.dropdown).attr({role:"listbox",id:e.listboxId}),e.templates&&e.templates.dropdownMenu&&o.html(r.templatify(e.templates.dropdownMenu)());(a=t.clone().css(e.css.hint).css(function(e){return{backgroundAttachment:e.css("background-attachment"),backgroundClip:e.css("background-clip"),backgroundColor:e.css("background-color"),backgroundImage:e.css("background-image"),backgroundOrigin:e.css("background-origin"),backgroundPosition:e.css("background-position"),backgroundRepeat:e.css("background-repeat"),backgroundSize:e.css("background-size")}}(t))).val("").addClass(r.className(e.cssClasses.prefix,e.cssClasses.hint,!0)).removeAttr("id name placeholder required").prop("readonly",!0).attr({"aria-hidden":"true",autocomplete:"off",spellcheck:"false",tabindex:-1}),a.removeData&&a.removeData();t.data(i,{"aria-autocomplete":t.attr("aria-autocomplete"),"aria-expanded":t.attr("aria-expanded"),"aria-owns":t.attr("aria-owns"),autocomplete:t.attr("autocomplete"),dir:t.attr("dir"),role:t.attr("role"),spellcheck:t.attr("spellcheck"),style:t.attr("style"),type:t.attr("type")}),t.addClass(r.className(e.cssClasses.prefix,e.cssClasses.input,!0)).attr({autocomplete:"off",spellcheck:!1,role:"combobox","aria-autocomplete":e.datasets&&e.datasets[0]&&e.datasets[0].displayKey?"both":"list","aria-expanded":"false","aria-label":e.ariaLabel,"aria-owns":e.listboxId}).css(e.hint?e.css.input:e.css.inputWithNoHint);try{t.attr("dir")||t.attr("dir","auto")}catch(l){}return(n=e.appendTo?n.appendTo(s.element(e.appendTo).eq(0)).eq(0):t.wrap(n).parent()).prepend(e.hint?a:null).append(o),{wrapper:n,input:t,hint:a,menu:o}}(e);this.$node=a.wrapper;var u=this.$input=a.input;t=a.menu,n=a.hint,e.dropdownMenuContainer&&s.element(e.dropdownMenuContainer).css("position","relative").append(t.css("top","0")),u.on("blur.aa",(function(e){var n=document.activeElement;r.isMsie()&&(t[0]===n||t[0].contains(n))&&(e.preventDefault(),e.stopImmediatePropagation(),r.defer((function(){u.focus()})))})),t.on("mousedown.aa",(function(e){e.preventDefault()})),this.eventBus=e.eventBus||new o({el:u}),this.dropdown=new h.Dropdown({appendTo:e.appendTo,wrapper:this.$node,menu:t,datasets:e.datasets,templates:e.templates,cssClasses:e.cssClasses,minLength:this.minLength}).onSync("suggestionClicked",this._onSuggestionClicked,this).onSync("cursorMoved",this._onCursorMoved,this).onSync("cursorRemoved",this._onCursorRemoved,this).onSync("opened",this._onOpened,this).onSync("closed",this._onClosed,this).onSync("shown",this._onShown,this).onSync("empty",this._onEmpty,this).onSync("redrawn",this._onRedrawn,this).onAsync("datasetRendered",this._onDatasetRendered,this),this.input=new h.Input({input:u,hint:n}).onSync("focused",this._onFocused,this).onSync("blurred",this._onBlurred,this).onSync("enterKeyed",this._onEnterKeyed,this).onSync("tabKeyed",this._onTabKeyed,this).onSync("escKeyed",this._onEscKeyed,this).onSync("upKeyed",this._onUpKeyed,this).onSync("downKeyed",this._onDownKeyed,this).onSync("leftKeyed",this._onLeftKeyed,this).onSync("rightKeyed",this._onRightKeyed,this).onSync("queryChanged",this._onQueryChanged,this).onSync("whitespaceChanged",this._onWhitespaceChanged,this),this._bindKeyboardShortcuts(e),this._setLanguageDirection()}r.mixin(h.prototype,{_bindKeyboardShortcuts:function(e){if(e.keyboardShortcuts){var t=this.$input,n=[];r.each(e.keyboardShortcuts,(function(e){"string"==typeof e&&(e=e.toUpperCase().charCodeAt(0)),n.push(e)})),s.element(document).keydown((function(e){var i=e.target||e.srcElement,r=i.tagName;if(!i.isContentEditable&&"INPUT"!==r&&"SELECT"!==r&&"TEXTAREA"!==r){var s=e.which||e.keyCode;-1!==n.indexOf(s)&&(t.focus(),e.stopPropagation(),e.preventDefault())}}))}},_onSuggestionClicked:function(e,t){var n;(n=this.dropdown.getDatumForSuggestion(t))&&this._select(n,{selectionMethod:"click"})},_onCursorMoved:function(e,t){var n=this.dropdown.getDatumForCursor(),i=this.dropdown.getCurrentCursor().attr("id");this.input.setActiveDescendant(i),n&&(t&&this.input.setInputValue(n.value,!0),this.eventBus.trigger("cursorchanged",n.raw,n.datasetName))},_onCursorRemoved:function(){this.input.resetInputValue(),this._updateHint(),this.eventBus.trigger("cursorremoved")},_onDatasetRendered:function(){this._updateHint(),this.eventBus.trigger("updated")},_onOpened:function(){this._updateHint(),this.input.expand(),this.eventBus.trigger("opened")},_onEmpty:function(){this.eventBus.trigger("empty")},_onRedrawn:function(){this.$node.css("top","0px"),this.$node.css("left","0px");var e=this.$input[0].getBoundingClientRect();this.autoWidth&&this.$node.css("width",e.width+"px");var t=this.$node[0].getBoundingClientRect(),n=e.bottom-t.top;this.$node.css("top",n+"px");var i=e.left-t.left;this.$node.css("left",i+"px"),this.eventBus.trigger("redrawn")},_onShown:function(){this.eventBus.trigger("shown"),this.autoselect&&this.dropdown.cursorTopSuggestion()},_onClosed:function(){this.input.clearHint(),this.input.removeActiveDescendant(),this.input.collapse(),this.eventBus.trigger("closed")},_onFocused:function(){if(this.isActivated=!0,this.openOnFocus){var e=this.input.getQuery();e.length>=this.minLength?this.dropdown.update(e):this.dropdown.empty(),this.dropdown.open()}},_onBlurred:function(){var e,t;e=this.dropdown.getDatumForCursor(),t=this.dropdown.getDatumForTopSuggestion();var n={selectionMethod:"blur"};this.debug||(this.autoselectOnBlur&&e?this._select(e,n):this.autoselectOnBlur&&t?this._select(t,n):(this.isActivated=!1,this.dropdown.empty(),this.dropdown.close()))},_onEnterKeyed:function(e,t){var n,i;n=this.dropdown.getDatumForCursor(),i=this.dropdown.getDatumForTopSuggestion();var r={selectionMethod:"enterKey"};n?(this._select(n,r),t.preventDefault()):this.autoselect&&i&&(this._select(i,r),t.preventDefault())},_onTabKeyed:function(e,t){if(this.tabAutocomplete){var n;(n=this.dropdown.getDatumForCursor())?(this._select(n,{selectionMethod:"tabKey"}),t.preventDefault()):this._autocomplete(!0)}else this.dropdown.close()},_onEscKeyed:function(){this.dropdown.close(),this.input.resetInputValue()},_onUpKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorUp(),this.dropdown.open()},_onDownKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorDown(),this.dropdown.open()},_onLeftKeyed:function(){"rtl"===this.dir&&this._autocomplete()},_onRightKeyed:function(){"ltr"===this.dir&&this._autocomplete()},_onQueryChanged:function(e,t){this.input.clearHintIfInvalid(),t.length>=this.minLength?this.dropdown.update(t):this.dropdown.empty(),this.dropdown.open(),this._setLanguageDirection()},_onWhitespaceChanged:function(){this._updateHint(),this.dropdown.open()},_setLanguageDirection:function(){var e=this.input.getLanguageDirection();this.dir!==e&&(this.dir=e,this.$node.css("direction",e),this.dropdown.setLanguageDirection(e))},_updateHint:function(){var e,t,n,i,s;(e=this.dropdown.getDatumForTopSuggestion())&&this.dropdown.isVisible()&&!this.input.hasOverflow()?(t=this.input.getInputValue(),n=a.normalizeQuery(t),i=r.escapeRegExChars(n),(s=new RegExp("^(?:"+i+")(.+$)","i").exec(e.value))?this.input.setHint(t+s[1]):this.input.clearHint()):this.input.clearHint()},_autocomplete:function(e){var t,n,i,r;t=this.input.getHint(),n=this.input.getQuery(),i=e||this.input.isCursorAtEnd(),t&&n!==t&&i&&((r=this.dropdown.getDatumForTopSuggestion())&&this.input.setInputValue(r.value),this.eventBus.trigger("autocompleted",r.raw,r.datasetName))},_select:function(e,t){void 0!==e.value&&this.input.setQuery(e.value),this.clearOnSelected?this.setVal(""):this.input.setInputValue(e.value,!0),this._setLanguageDirection(),!1===this.eventBus.trigger("selected",e.raw,e.datasetName,t).isDefaultPrevented()&&(this.dropdown.close(),r.defer(r.bind(this.dropdown.empty,this.dropdown)))},open:function(){if(!this.isActivated){var e=this.input.getInputValue();e.length>=this.minLength?this.dropdown.update(e):this.dropdown.empty()}this.dropdown.open()},close:function(){this.dropdown.close()},setVal:function(e){e=r.toStr(e),this.isActivated?this.input.setInputValue(e):(this.input.setQuery(e),this.input.setInputValue(e,!0)),this._setLanguageDirection()},getVal:function(){return this.input.getQuery()},destroy:function(){this.input.destroy(),this.dropdown.destroy(),function(e,t){var n=e.find(r.className(t.prefix,t.input));r.each(n.data(i),(function(e,t){void 0===e?n.removeAttr(t):n.attr(t,e)})),n.detach().removeClass(r.className(t.prefix,t.input,!0)).insertAfter(e),n.removeData&&n.removeData(i);e.remove()}(this.$node,this.cssClasses),this.$node=null},getWrapper:function(){return this.dropdown.$container[0]}}),h.Dropdown=u,h.Input=a,h.sources=n(86331),e.exports=h},33855:e=>{"use strict";e.exports={element:null}},22926:e=>{"use strict";e.exports=function(e){var t=e.match(/Algolia for JavaScript \((\d+\.)(\d+\.)(\d+)\)/)||e.match(/Algolia for vanilla JavaScript (\d+\.)(\d+\.)(\d+)/);if(t)return[t[1],t[2],t[3]]}},85670:(e,t,n)=>{"use strict";var i,r=n(33855);function s(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}e.exports={isArray:null,isFunction:null,isObject:null,bind:null,each:null,map:null,mixin:null,isMsie:function(e){if(void 0===e&&(e=navigator.userAgent),/(msie|trident)/i.test(e)){var t=e.match(/(msie |rv:)(\d+(.\d+)?)/i);if(t)return t[2]}return!1},escapeRegExChars:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isNumber:function(e){return"number"==typeof e},toStr:function(e){return null==e?"":e+""},cloneDeep:function(e){var t=this.mixin({},e),n=this;return this.each(t,(function(e,i){e&&(n.isArray(e)?t[i]=[].concat(e):n.isObject(e)&&(t[i]=n.cloneDeep(e)))})),t},error:function(e){throw new Error(e)},every:function(e,t){var n=!0;return e?(this.each(e,(function(i,r){n&&(n=t.call(null,i,r,e)&&n)})),!!n):n},any:function(e,t){var n=!1;return e?(this.each(e,(function(i,r){if(t.call(null,i,r,e))return n=!0,!1})),n):n},getUniqueId:(i=0,function(){return i++}),templatify:function(e){if(this.isFunction(e))return e;var t=r.element(e);return"SCRIPT"===t.prop("tagName")?function(){return t.text()}:function(){return String(e)}},defer:function(e){setTimeout(e,0)},noop:function(){},formatPrefix:function(e,t){return t?"":e+"-"},className:function(e,t,n){return(n?"":".")+e+t},escapeHighlightedString:function(e,t,n){t=t||"";var i=document.createElement("div");i.appendChild(document.createTextNode(t)),n=n||"";var r=document.createElement("div");r.appendChild(document.createTextNode(n));var o=document.createElement("div");return o.appendChild(document.createTextNode(e)),o.innerHTML.replace(RegExp(s(i.innerHTML),"g"),t).replace(RegExp(s(r.innerHTML),"g"),n)}}},42683:(e,t,n)=>{"use strict";var i=n(85670),r=n(93489),s=n(22926);e.exports=function(e,t){var n=s(e.as._ua);return n&&n[0]>=3&&n[1]>20&&((t=t||{}).additionalUA="autocomplete.js "+r),function(n,r){e.search(n,t,(function(e,t){e?i.error(e.message):r(t.hits,t)}))}}},86331:(e,t,n)=>{"use strict";e.exports={hits:n(42683),popularIn:n(82226)}},82226:(e,t,n)=>{"use strict";var i=n(85670),r=n(93489),s=n(22926);e.exports=function(e,t,n,o){var a=s(e.as._ua);if(a&&a[0]>=3&&a[1]>20&&((t=t||{}).additionalUA="autocomplete.js "+r),!n.source)return i.error("Missing 'source' key");var u=i.isFunction(n.source)?n.source:function(e){return e[n.source]};if(!n.index)return i.error("Missing 'index' key");var c=n.index;return o=o||{},function(a,l){e.search(a,t,(function(e,a){if(e)i.error(e.message);else{if(a.hits.length>0){var h=a.hits[0],p=i.mixin({hitsPerPage:0},n);delete p.source,delete p.index;var d=s(c.as._ua);return d&&d[0]>=3&&d[1]>20&&(t.additionalUA="autocomplete.js "+r),void c.search(u(h),p,(function(e,t){if(e)i.error(e.message);else{var n=[];if(o.includeAll){var r=o.allTitle||"All departments";n.push(i.mixin({facet:{value:r,count:t.nbHits}},i.cloneDeep(h)))}i.each(t.facets,(function(e,t){i.each(e,(function(e,r){n.push(i.mixin({facet:{facet:t,value:r,count:e}},i.cloneDeep(h)))}))}));for(var s=1;s{"use strict";var i=n(7939);n(33855).element=i;var r=n(85670);r.isArray=i.isArray,r.isFunction=i.isFunction,r.isObject=i.isPlainObject,r.bind=i.proxy,r.each=function(e,t){i.each(e,(function(e,n){return t(n,e)}))},r.map=i.map,r.mixin=i.extend,r.Event=i.Event;var s="aaAutocomplete",o=n(4520),a=n(47368);function u(e,t,n,u){n=r.isArray(n)?n:[].slice.call(arguments,2);var c=i(e).each((function(e,r){var c=i(r),l=new a({el:c}),h=u||new o({input:c,eventBus:l,dropdownMenuContainer:t.dropdownMenuContainer,hint:void 0===t.hint||!!t.hint,minLength:t.minLength,autoselect:t.autoselect,autoselectOnBlur:t.autoselectOnBlur,tabAutocomplete:t.tabAutocomplete,openOnFocus:t.openOnFocus,templates:t.templates,debug:t.debug,clearOnSelected:t.clearOnSelected,cssClasses:t.cssClasses,datasets:n,keyboardShortcuts:t.keyboardShortcuts,appendTo:t.appendTo,autoWidth:t.autoWidth,ariaLabel:t.ariaLabel||r.getAttribute("aria-label")});c.data(s,h)}));return c.autocomplete={},r.each(["open","close","getVal","setVal","destroy","getWrapper"],(function(e){c.autocomplete[e]=function(){var t,n=arguments;return c.each((function(r,o){var a=i(o).data(s);t=a[e].apply(a,n)})),t}})),c}u.sources=o.sources,u.escapeHighlightedString=r.escapeHighlightedString;var c="autocomplete"in window,l=window.autocomplete;u.noConflict=function(){return c?window.autocomplete=l:delete window.autocomplete,u},e.exports=u},93489:e=>{e.exports="0.37.1"},7939:e=>{var t;t=window,e.exports=function(e){var t,n,i=function(){var t,n,i,r,s,o,a=[],u=a.concat,c=a.filter,l=a.slice,h=e.document,p={},d={},f={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},g=/^\s*<(\w+|!)[^>]*>/,m=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,v=/^(?:body|html)$/i,x=/([A-Z])/g,b=["val","css","html","text","data","width","height","offset"],w=["after","prepend","before","append"],S=h.createElement("table"),C=h.createElement("tr"),E={tr:h.createElement("tbody"),tbody:S,thead:S,tfoot:S,td:C,th:C,"*":h.createElement("div")},k=/complete|loaded|interactive/,_=/^[\w-]*$/,T={},L=T.toString,O={},A=h.createElement("div"),$={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},P=Array.isArray||function(e){return e instanceof Array};function I(e){return null==e?String(e):T[L.call(e)]||"object"}function Q(e){return"function"==I(e)}function R(e){return null!=e&&e==e.window}function N(e){return null!=e&&e.nodeType==e.DOCUMENT_NODE}function D(e){return"object"==I(e)}function F(e){return D(e)&&!R(e)&&Object.getPrototypeOf(e)==Object.prototype}function j(e){var t=!!e&&"length"in e&&e.length,n=i.type(e);return"function"!=n&&!R(e)&&("array"==n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function H(e){return c.call(e,(function(e){return null!=e}))}function V(e){return e.length>0?i.fn.concat.apply([],e):e}function B(e){return e.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function M(e){return e in d?d[e]:d[e]=new RegExp("(^|\\s)"+e+"(\\s|$)")}function q(e,t){return"number"!=typeof t||f[B(e)]?t:t+"px"}function z(e){var t,n;return p[e]||(t=h.createElement(e),h.body.appendChild(t),n=getComputedStyle(t,"").getPropertyValue("display"),t.parentNode.removeChild(t),"none"==n&&(n="block"),p[e]=n),p[e]}function K(e){return"children"in e?l.call(e.children):i.map(e.childNodes,(function(e){if(1==e.nodeType)return e}))}function W(e,t){var n,i=e?e.length:0;for(n=0;n")),n===t&&(n=g.test(e)&&RegExp.$1),n in E||(n="*"),(a=E[n]).innerHTML=""+e,s=i.each(l.call(a.childNodes),(function(){a.removeChild(this)}))),F(r)&&(o=i(s),i.each(r,(function(e,t){b.indexOf(e)>-1?o[e](t):o.attr(e,t)}))),s},O.Z=function(e,t){return new W(e,t)},O.isZ=function(e){return e instanceof O.Z},O.init=function(e,n){var r;if(!e)return O.Z();if("string"==typeof e)if("<"==(e=e.trim())[0]&&g.test(e))r=O.fragment(e,RegExp.$1,n),e=null;else{if(n!==t)return i(n).find(e);r=O.qsa(h,e)}else{if(Q(e))return i(h).ready(e);if(O.isZ(e))return e;if(P(e))r=H(e);else if(D(e))r=[e],e=null;else if(g.test(e))r=O.fragment(e.trim(),RegExp.$1,n),e=null;else{if(n!==t)return i(n).find(e);r=O.qsa(h,e)}}return O.Z(r,e)},(i=function(e,t){return O.init(e,t)}).extend=function(e){var t,n=l.call(arguments,1);return"boolean"==typeof e&&(t=e,e=n.shift()),n.forEach((function(n){U(e,n,t)})),e},O.qsa=function(e,t){var n,i="#"==t[0],r=!i&&"."==t[0],s=i||r?t.slice(1):t,o=_.test(s);return e.getElementById&&o&&i?(n=e.getElementById(s))?[n]:[]:1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType?[]:l.call(o&&!i&&e.getElementsByClassName?r?e.getElementsByClassName(s):e.getElementsByTagName(t):e.querySelectorAll(t))},i.contains=h.documentElement.contains?function(e,t){return e!==t&&e.contains(t)}:function(e,t){for(;t&&(t=t.parentNode);)if(t===e)return!0;return!1},i.type=I,i.isFunction=Q,i.isWindow=R,i.isArray=P,i.isPlainObject=F,i.isEmptyObject=function(e){var t;for(t in e)return!1;return!0},i.isNumeric=function(e){var t=Number(e),n=typeof e;return null!=e&&"boolean"!=n&&("string"!=n||e.length)&&!isNaN(t)&&isFinite(t)||!1},i.inArray=function(e,t,n){return a.indexOf.call(t,e,n)},i.camelCase=s,i.trim=function(e){return null==e?"":String.prototype.trim.call(e)},i.uuid=0,i.support={},i.expr={},i.noop=function(){},i.map=function(e,t){var n,i,r,s=[];if(j(e))for(i=0;i=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each((function(){null!=this.parentNode&&this.parentNode.removeChild(this)}))},each:function(e){return a.every.call(this,(function(t,n){return!1!==e.call(t,n,t)})),this},filter:function(e){return Q(e)?this.not(this.not(e)):i(c.call(this,(function(t){return O.matches(t,e)})))},add:function(e,t){return i(o(this.concat(i(e,t))))},is:function(e){return this.length>0&&O.matches(this[0],e)},not:function(e){var n=[];if(Q(e)&&e.call!==t)this.each((function(t){e.call(this,t)||n.push(this)}));else{var r="string"==typeof e?this.filter(e):j(e)&&Q(e.item)?l.call(e):i(e);this.forEach((function(e){r.indexOf(e)<0&&n.push(e)}))}return i(n)},has:function(e){return this.filter((function(){return D(e)?i.contains(this,e):i(this).find(e).size()}))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},first:function(){var e=this[0];return e&&!D(e)?e:i(e)},last:function(){var e=this[this.length-1];return e&&!D(e)?e:i(e)},find:function(e){var t=this;return e?"object"==typeof e?i(e).filter((function(){var e=this;return a.some.call(t,(function(t){return i.contains(t,e)}))})):1==this.length?i(O.qsa(this[0],e)):this.map((function(){return O.qsa(this,e)})):i()},closest:function(e,t){var n=[],r="object"==typeof e&&i(e);return this.each((function(i,s){for(;s&&!(r?r.indexOf(s)>=0:O.matches(s,e));)s=s!==t&&!N(s)&&s.parentNode;s&&n.indexOf(s)<0&&n.push(s)})),i(n)},parents:function(e){for(var t=[],n=this;n.length>0;)n=i.map(n,(function(e){if((e=e.parentNode)&&!N(e)&&t.indexOf(e)<0)return t.push(e),e}));return Z(t,e)},parent:function(e){return Z(o(this.pluck("parentNode")),e)},children:function(e){return Z(this.map((function(){return K(this)})),e)},contents:function(){return this.map((function(){return this.contentDocument||l.call(this.childNodes)}))},siblings:function(e){return Z(this.map((function(e,t){return c.call(K(t.parentNode),(function(e){return e!==t}))})),e)},empty:function(){return this.each((function(){this.innerHTML=""}))},pluck:function(e){return i.map(this,(function(t){return t[e]}))},show:function(){return this.each((function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=z(this.nodeName))}))},replaceWith:function(e){return this.before(e).remove()},wrap:function(e){var t=Q(e);if(this[0]&&!t)var n=i(e).get(0),r=n.parentNode||this.length>1;return this.each((function(s){i(this).wrapAll(t?e.call(this,s):r?n.cloneNode(!0):n)}))},wrapAll:function(e){if(this[0]){var t;for(i(this[0]).before(e=i(e));(t=e.children()).length;)e=t.first();i(e).append(this)}return this},wrapInner:function(e){var t=Q(e);return this.each((function(n){var r=i(this),s=r.contents(),o=t?e.call(this,n):e;s.length?s.wrapAll(o):r.append(o)}))},unwrap:function(){return this.parent().each((function(){i(this).replaceWith(i(this).children())})),this},clone:function(){return this.map((function(){return this.cloneNode(!0)}))},hide:function(){return this.css("display","none")},toggle:function(e){return this.each((function(){var n=i(this);(e===t?"none"==n.css("display"):e)?n.show():n.hide()}))},prev:function(e){return i(this.pluck("previousElementSibling")).filter(e||"*")},next:function(e){return i(this.pluck("nextElementSibling")).filter(e||"*")},html:function(e){return 0 in arguments?this.each((function(t){var n=this.innerHTML;i(this).empty().append(G(this,e,t,n))})):0 in this?this[0].innerHTML:null},text:function(e){return 0 in arguments?this.each((function(t){var n=G(this,e,t,this.textContent);this.textContent=null==n?"":""+n})):0 in this?this.pluck("textContent").join(""):null},attr:function(e,i){var r;return"string"!=typeof e||1 in arguments?this.each((function(t){if(1===this.nodeType)if(D(e))for(n in e)J(this,n,e[n]);else J(this,e,G(this,i,t,this.getAttribute(e)))})):0 in this&&1==this[0].nodeType&&null!=(r=this[0].getAttribute(e))?r:t},removeAttr:function(e){return this.each((function(){1===this.nodeType&&e.split(" ").forEach((function(e){J(this,e)}),this)}))},prop:function(e,t){return e=$[e]||e,1 in arguments?this.each((function(n){this[e]=G(this,t,n,this[e])})):this[0]&&this[0][e]},removeProp:function(e){return e=$[e]||e,this.each((function(){delete this[e]}))},data:function(e,n){var i="data-"+e.replace(x,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?Y(r):t},val:function(e){return 0 in arguments?(null==e&&(e=""),this.each((function(t){this.value=G(this,e,t,this.value)}))):this[0]&&(this[0].multiple?i(this[0]).find("option").filter((function(){return this.selected})).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each((function(e){var n=i(this),r=G(this,t,e,n.offset()),s=n.offsetParent().offset(),o={top:r.top-s.top,left:r.left-s.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)}));if(!this.length)return null;if(h.documentElement!==this[0]&&!i.contains(h.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+e.pageXOffset,top:n.top+e.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(e,t){if(arguments.length<2){var r=this[0];if("string"==typeof e){if(!r)return;return r.style[s(e)]||getComputedStyle(r,"").getPropertyValue(e)}if(P(e)){if(!r)return;var o={},a=getComputedStyle(r,"");return i.each(e,(function(e,t){o[t]=r.style[s(t)]||a.getPropertyValue(t)})),o}}var u="";if("string"==I(e))t||0===t?u=B(e)+":"+q(e,t):this.each((function(){this.style.removeProperty(B(e))}));else for(n in e)e[n]||0===e[n]?u+=B(n)+":"+q(n,e[n])+";":this.each((function(){this.style.removeProperty(B(n))}));return this.each((function(){this.style.cssText+=";"+u}))},index:function(e){return e?this.indexOf(i(e)[0]):this.parent().children().indexOf(this[0])},hasClass:function(e){return!!e&&a.some.call(this,(function(e){return this.test(X(e))}),M(e))},addClass:function(e){return e?this.each((function(t){if("className"in this){r=[];var n=X(this);G(this,e,t,n).split(/\s+/g).forEach((function(e){i(this).hasClass(e)||r.push(e)}),this),r.length&&X(this,n+(n?" ":"")+r.join(" "))}})):this},removeClass:function(e){return this.each((function(n){if("className"in this){if(e===t)return X(this,"");r=X(this),G(this,e,n,r).split(/\s+/g).forEach((function(e){r=r.replace(M(e)," ")})),X(this,r.trim())}}))},toggleClass:function(e,n){return e?this.each((function(r){var s=i(this);G(this,e,r,X(this)).split(/\s+/g).forEach((function(e){(n===t?!s.hasClass(e):n)?s.addClass(e):s.removeClass(e)}))})):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var e=this[0],t=this.offsetParent(),n=this.offset(),r=v.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(i(e).css("margin-top"))||0,n.left-=parseFloat(i(e).css("margin-left"))||0,r.top+=parseFloat(i(t[0]).css("border-top-width"))||0,r.left+=parseFloat(i(t[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||h.body;e&&!v.test(e.nodeName)&&"static"==i(e).css("position");)e=e.offsetParent;return e}))}},i.fn.detach=i.fn.remove,["width","height"].forEach((function(e){var n=e.replace(/./,(function(e){return e[0].toUpperCase()}));i.fn[e]=function(r){var s,o=this[0];return r===t?R(o)?o["inner"+n]:N(o)?o.documentElement["scroll"+n]:(s=this.offset())&&s[e]:this.each((function(t){(o=i(this)).css(e,G(this,r,t,o[e]()))}))}})),w.forEach((function(n,r){var s=r%2;i.fn[n]=function(){var n,o,a=i.map(arguments,(function(e){var r=[];return"array"==(n=I(e))?(e.forEach((function(e){return e.nodeType!==t?r.push(e):i.zepto.isZ(e)?r=r.concat(e.get()):void(r=r.concat(O.fragment(e)))})),r):"object"==n||null==e?e:O.fragment(e)})),u=this.length>1;return a.length<1?this:this.each((function(t,n){o=s?n:n.parentNode,n=0==r?n.nextSibling:1==r?n.firstChild:2==r?n:null;var c=i.contains(h.documentElement,o);a.forEach((function(t){if(u)t=t.cloneNode(!0);else if(!o)return i(t).remove();o.insertBefore(t,n),c&&ee(t,(function(t){if(!(null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src)){var n=t.ownerDocument?t.ownerDocument.defaultView:e;n.eval.call(n,t.innerHTML)}}))}))}))},i.fn[s?n+"To":"insert"+(r?"Before":"After")]=function(e){return i(e)[n](this),this}})),O.Z.prototype=W.prototype=i.fn,O.uniq=o,O.deserializeValue=Y,i.zepto=O,i}();return function(t){var n,i=1,r=Array.prototype.slice,s=t.isFunction,o=function(e){return"string"==typeof e},a={},u={},c="onfocusin"in e,l={focus:"focusin",blur:"focusout"},h={mouseenter:"mouseover",mouseleave:"mouseout"};function p(e){return e._zid||(e._zid=i++)}function d(e,t,n,i){if((t=f(t)).ns)var r=g(t.ns);return(a[p(e)]||[]).filter((function(e){return e&&(!t.e||e.e==t.e)&&(!t.ns||r.test(e.ns))&&(!n||p(e.fn)===p(n))&&(!i||e.sel==i)}))}function f(e){var t=(""+e).split(".");return{e:t[0],ns:t.slice(1).sort().join(" ")}}function g(e){return new RegExp("(?:^| )"+e.replace(" "," .* ?")+"(?: |$)")}function m(e,t){return e.del&&!c&&e.e in l||!!t}function y(e){return h[e]||c&&l[e]||e}function v(e,i,r,s,o,u,c){var l=p(e),d=a[l]||(a[l]=[]);i.split(/\s/).forEach((function(i){if("ready"==i)return t(document).ready(r);var a=f(i);a.fn=r,a.sel=o,a.e in h&&(r=function(e){var n=e.relatedTarget;if(!n||n!==this&&!t.contains(this,n))return a.fn.apply(this,arguments)}),a.del=u;var l=u||r;a.proxy=function(t){if(!(t=E(t)).isImmediatePropagationStopped()){try{var i=Object.getOwnPropertyDescriptor(t,"data");i&&!i.writable||(t.data=s)}catch(t){}var r=l.apply(e,t._args==n?[t]:[t].concat(t._args));return!1===r&&(t.preventDefault(),t.stopPropagation()),r}},a.i=d.length,d.push(a),"addEventListener"in e&&e.addEventListener(y(a.e),a.proxy,m(a,c))}))}function x(e,t,n,i,r){var s=p(e);(t||"").split(/\s/).forEach((function(t){d(e,t,n,i).forEach((function(t){delete a[s][t.i],"removeEventListener"in e&&e.removeEventListener(y(t.e),t.proxy,m(t,r))}))}))}u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents",t.event={add:v,remove:x},t.proxy=function(e,n){var i=2 in arguments&&r.call(arguments,2);if(s(e)){var a=function(){return e.apply(n,i?i.concat(r.call(arguments)):arguments)};return a._zid=p(e),a}if(o(n))return i?(i.unshift(e[n],e),t.proxy.apply(null,i)):t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(e,t,n){return this.on(e,t,n)},t.fn.unbind=function(e,t){return this.off(e,t)},t.fn.one=function(e,t,n,i){return this.on(e,t,n,i,1)};var b=function(){return!0},w=function(){return!1},S=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,C={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};function E(e,i){if(i||!e.isDefaultPrevented){i||(i=e),t.each(C,(function(t,n){var r=i[t];e[t]=function(){return this[n]=b,r&&r.apply(i,arguments)},e[n]=w}));try{e.timeStamp||(e.timeStamp=Date.now())}catch(r){}(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?!1===i.returnValue:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=b)}return e}function k(e){var t,i={originalEvent:e};for(t in e)S.test(t)||e[t]===n||(i[t]=e[t]);return E(i,e)}t.fn.delegate=function(e,t,n){return this.on(t,e,n)},t.fn.undelegate=function(e,t,n){return this.off(t,e,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,i,a,u,c){var l,h,p=this;return e&&!o(e)?(t.each(e,(function(e,t){p.on(e,i,a,t,c)})),p):(o(i)||s(u)||!1===u||(u=a,a=i,i=n),u!==n&&!1!==a||(u=a,a=n),!1===u&&(u=w),p.each((function(n,s){c&&(l=function(e){return x(s,e.type,u),u.apply(this,arguments)}),i&&(h=function(e){var n,o=t(e.target).closest(i,s).get(0);if(o&&o!==s)return n=t.extend(k(e),{currentTarget:o,liveFired:s}),(l||u).apply(o,[n].concat(r.call(arguments,1)))}),v(s,e,u,a,i,h||l)})))},t.fn.off=function(e,i,r){var a=this;return e&&!o(e)?(t.each(e,(function(e,t){a.off(e,i,t)})),a):(o(i)||s(r)||!1===r||(r=i,i=n),!1===r&&(r=w),a.each((function(){x(this,e,r,i)})))},t.fn.trigger=function(e,n){return(e=o(e)||t.isPlainObject(e)?t.Event(e):E(e))._args=n,this.each((function(){e.type in l&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)}))},t.fn.triggerHandler=function(e,n){var i,r;return this.each((function(s,a){(i=k(o(e)?t.Event(e):e))._args=n,i.target=a,t.each(d(a,e.type||e),(function(e,t){if(r=t.proxy(i),i.isImmediatePropagationStopped())return!1}))})),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach((function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}})),t.Event=function(e,t){o(e)||(e=(t=e).type);var n=document.createEvent(u[e]||"Events"),i=!0;if(t)for(var r in t)"bubbles"==r?i=!!t[r]:n[r]=t[r];return n.initEvent(e,i,!0),E(n)}}(i),n=[],i.fn.remove=function(){return this.each((function(){this.parentNode&&("IMG"===this.tagName&&(n.push(this),this.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",t&&clearTimeout(t),t=setTimeout((function(){n=[]}),6e4)),this.parentNode.removeChild(this))}))},function(e){var t={},n=e.fn.data,i=e.camelCase,r=e.expando="Zepto"+ +new Date,s=[];function o(s,o){var u=s[r],c=u&&t[u];if(void 0===o)return c||a(s);if(c){if(o in c)return c[o];var l=i(o);if(l in c)return c[l]}return n.call(e(s),o)}function a(n,s,o){var a=n[r]||(n[r]=++e.uuid),c=t[a]||(t[a]=u(n));return void 0!==s&&(c[i(s)]=o),c}function u(t){var n={};return e.each(t.attributes||s,(function(t,r){0==r.name.indexOf("data-")&&(n[i(r.name.replace("data-",""))]=e.zepto.deserializeValue(r.value))})),n}e.fn.data=function(t,n){return void 0===n?e.isPlainObject(t)?this.each((function(n,i){e.each(t,(function(e,t){a(i,e,t)}))})):0 in this?o(this[0],t):void 0:this.each((function(){a(this,t,n)}))},e.data=function(t,n,i){return e(t).data(n,i)},e.hasData=function(n){var i=n[r],s=i&&t[i];return!!s&&!e.isEmptyObject(s)},e.fn.removeData=function(n){return"string"==typeof n&&(n=n.split(/\s+/)),this.each((function(){var s=this[r],o=s&&t[s];o&&e.each(n||o,(function(e){delete o[n?i(this):e]}))}))},["remove","empty"].forEach((function(t){var n=e.fn[t];e.fn[t]=function(){var e=this.find("*");return"remove"===t&&(e=e.add(this)),e.removeData(),n.call(this)}}))}(i),i}(t)},4734:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>m});var i=n(5485),r=n.n(i),s=n(29039);s.Z.tokenizer.separator=/[\s\-/]+/;const o=class{constructor(e,t,n,i){void 0===n&&(n="/"),this.searchDocs=e,this.lunrIndex=s.Z.Index.load(t),this.baseUrl=n,this.maxHits=i}getLunrResult(e){return this.lunrIndex.query((function(t){const n=s.Z.tokenizer(e);t.term(n,{boost:10}),t.term(n,{wildcard:s.Z.Query.wildcard.TRAILING})}))}getHit(e,t,n){return{hierarchy:{lvl0:e.pageTitle||e.title,lvl1:0===e.type?null:e.title},url:e.url,version:e.version,_snippetResult:n?{content:{value:n,matchLevel:"full"}}:null,_highlightResult:{hierarchy:{lvl0:{value:0===e.type?t||e.title:e.pageTitle},lvl1:0===e.type?null:{value:t||e.title}}}}}getTitleHit(e,t,n){const i=t[0],r=t[0]+n;let s=e.title.substring(0,i)+''+e.title.substring(i,r)+""+e.title.substring(r,e.title.length);return this.getHit(e,s)}getKeywordHit(e,t,n){const i=t[0],r=t[0]+n;let s=e.title+"
Keywords: "+e.keywords.substring(0,i)+''+e.keywords.substring(i,r)+""+e.keywords.substring(r,e.keywords.length)+"";return this.getHit(e,s)}getContentHit(e,t){const n=t[0],i=t[0]+t[1];let r=n,s=i,o=!0,a=!0;for(let c=0;c<3;c++){const t=e.content.lastIndexOf(" ",r-2),n=e.content.lastIndexOf(".",r-2);if(n>0&&n>t){r=n+1,o=!1;break}if(t<0){r=0,o=!1;break}r=t+1}for(let c=0;c<10;c++){const t=e.content.indexOf(" ",s+1),n=e.content.indexOf(".",s+1);if(n>0&&n",u+=e.content.substring(i,s),a&&(u+=" ..."),this.getHit(e,null,u)}search(e){return new Promise(((t,n)=>{const i=this.getLunrResult(e),r=[];i.length>this.maxHits&&(i.length=this.maxHits),this.titleHitsRes=[],this.contentHitsRes=[],i.forEach((t=>{const n=this.searchDocs[t.ref],{metadata:i}=t.matchData;for(let s in i)if(i[s].title){if(!this.titleHitsRes.includes(t.ref)){const o=i[s].title.position[0];r.push(this.getTitleHit(n,o,e.length)),this.titleHitsRes.push(t.ref)}}else if(i[s].content){const e=i[s].content.position[0];r.push(this.getContentHit(n,e))}else if(i[s].keywords){const o=i[s].keywords.position[0];r.push(this.getKeywordHit(n,o,e.length)),this.titleHitsRes.push(t.ref)}})),r.length>this.maxHits&&(r.length=this.maxHits),t(r)}))}};var a=n(71639),u=n.n(a);const c="algolia-docsearch",l=`${c}-suggestion`,h={suggestion:`\n \n
\n {{{category}}}\n
\n
\n
\n {{{subcategory}}}\n
\n {{#isTextOrSubcategoryNonEmpty}}\n
\n
{{{subcategory}}}
\n
{{{title}}}
\n {{#text}}
{{{text}}}
{{/text}}\n {{#version}}
{{version}}
{{/version}}\n
\n {{/isTextOrSubcategoryNonEmpty}}\n
\n
\n `,suggestionSimple:`\n
\n
\n {{^isLvl0}}\n {{{category}}}\n {{^isLvl1}}\n {{^isLvl1EmptyOrDuplicate}}\n \n {{{subcategory}}}\n \n {{/isLvl1EmptyOrDuplicate}}\n {{/isLvl1}}\n {{/isLvl0}}\n
\n {{#isLvl2}}\n {{{title}}}\n {{/isLvl2}}\n {{#isLvl1}}\n {{{subcategory}}}\n {{/isLvl1}}\n {{#isLvl0}}\n {{{category}}}\n {{/isLvl0}}\n
\n
\n
\n {{#text}}\n
\n
{{{text}}}
\n
\n {{/text}}\n
\n
\n `,footer:`\n
\n
\n `,empty:`\n
\n
\n
\n
\n
\n No results found for query "{{query}}"\n
\n
\n
\n
\n
\n `,searchBox:'\n \n\n\n '};var p=n(7939),d=n.n(p);const f={mergeKeyWithParent(e,t){if(void 0===e[t])return e;if("object"!=typeof e[t])return e;const n=d().extend({},e,e[t]);return delete n[t],n},groupBy(e,t){const n={};return d().each(e,((e,i)=>{if(void 0===i[t])throw new Error(`[groupBy]: Object has no key ${t}`);let r=i[t];"string"==typeof r&&(r=r.toLowerCase()),Object.prototype.hasOwnProperty.call(n,r)||(n[r]=[]),n[r].push(i)})),n},values:e=>Object.keys(e).map((t=>e[t])),flatten(e){const t=[];return e.forEach((e=>{Array.isArray(e)?e.forEach((e=>{t.push(e)})):t.push(e)})),t},flattenAndFlagFirst(e,t){const n=this.values(e).map((e=>e.map(((e,n)=>(e[t]=0===n,e)))));return this.flatten(n)},compact(e){const t=[];return e.forEach((e=>{e&&t.push(e)})),t},getHighlightedValue:(e,t)=>e._highlightResult&&e._highlightResult.hierarchy_camel&&e._highlightResult.hierarchy_camel[t]&&e._highlightResult.hierarchy_camel[t].matchLevel&&"none"!==e._highlightResult.hierarchy_camel[t].matchLevel&&e._highlightResult.hierarchy_camel[t].value?e._highlightResult.hierarchy_camel[t].value:e._highlightResult&&e._highlightResult&&e._highlightResult[t]&&e._highlightResult[t].value?e._highlightResult[t].value:e[t],getSnippetedValue(e,t){if(!e._snippetResult||!e._snippetResult[t]||!e._snippetResult[t].value)return e[t];let n=e._snippetResult[t].value;return n[0]!==n[0].toUpperCase()&&(n=`\u2026${n}`),-1===[".","!","?"].indexOf(n[n.length-1])&&(n=`${n}\u2026`),n},deepClone:e=>JSON.parse(JSON.stringify(e))};class g{constructor(e){let{searchDocs:t,searchIndex:n,inputSelector:i,debug:r=!1,baseUrl:s="/",queryDataCallback:a=null,autocompleteOptions:c={debug:!1,hint:!1,autoselect:!0},transformData:l=!1,queryHook:p=!1,handleSelected:f=!1,enhancedSearchInput:m=!1,layout:y="column",maxHits:v=5}=e;this.input=g.getInputFromSelector(i),this.queryDataCallback=a||null;const x=!(!c||!c.debug)&&c.debug;c.debug=r||x,this.autocompleteOptions=c,this.autocompleteOptions.cssClasses=this.autocompleteOptions.cssClasses||{},this.autocompleteOptions.cssClasses.prefix=this.autocompleteOptions.cssClasses.prefix||"ds";const b=this.input&&"function"==typeof this.input.attr&&this.input.attr("aria-label");this.autocompleteOptions.ariaLabel=this.autocompleteOptions.ariaLabel||b||"search input",this.isSimpleLayout="simple"===y,this.client=new o(t,n,s,v),m&&(this.input=g.injectSearchBox(this.input)),this.autocomplete=u()(this.input,c,[{source:this.getAutocompleteSource(l,p),templates:{suggestion:g.getSuggestionTemplate(this.isSimpleLayout),footer:h.footer,empty:g.getEmptyTemplate()}}]);const w=f;this.handleSelected=w||this.handleSelected,w&&d()(".algolia-autocomplete").on("click",".ds-suggestions a",(e=>{e.preventDefault()})),this.autocomplete.on("autocomplete:selected",this.handleSelected.bind(null,this.autocomplete.autocomplete)),this.autocomplete.on("autocomplete:shown",this.handleShown.bind(null,this.input)),m&&g.bindSearchBoxEvent(),document.addEventListener("keydown",(e=>{(e.ctrlKey||e.metaKey)&&"k"==e.key&&(this.input.focus(),e.preventDefault())}))}static injectSearchBox(e){e.before(h.searchBox);const t=e.prev().prev().find("input");return e.remove(),t}static bindSearchBoxEvent(){d()('.searchbox [type="reset"]').on("click",(function(){d()("input#docsearch").focus(),d()(this).addClass("hide"),u().autocomplete.setVal("")})),d()("input#docsearch").on("keyup",(()=>{const e=document.querySelector("input#docsearch"),t=document.querySelector('.searchbox [type="reset"]');t.className="searchbox__reset",0===e.value.length&&(t.className+=" hide")}))}static getInputFromSelector(e){const t=d()(e).filter("input");return t.length?d()(t[0]):null}getAutocompleteSource(e,t){return(n,i)=>{t&&(n=t(n)||n),this.client.search(n).then((t=>{this.queryDataCallback&&"function"==typeof this.queryDataCallback&&this.queryDataCallback(t),e&&(t=e(t)||t),i(g.formatHits(t))}))}}static formatHits(e){const t=f.deepClone(e).map((e=>(e._highlightResult&&(e._highlightResult=f.mergeKeyWithParent(e._highlightResult,"hierarchy")),f.mergeKeyWithParent(e,"hierarchy"))));let n=f.groupBy(t,"lvl0");return d().each(n,((e,t)=>{const i=f.groupBy(t,"lvl1"),r=f.flattenAndFlagFirst(i,"isSubCategoryHeader");n[e]=r})),n=f.flattenAndFlagFirst(n,"isCategoryHeader"),n.map((e=>{const t=g.formatURL(e),n=f.getHighlightedValue(e,"lvl0"),i=f.getHighlightedValue(e,"lvl1")||n,r=f.compact([f.getHighlightedValue(e,"lvl2")||i,f.getHighlightedValue(e,"lvl3"),f.getHighlightedValue(e,"lvl4"),f.getHighlightedValue(e,"lvl5"),f.getHighlightedValue(e,"lvl6")]).join(''),s=f.getSnippetedValue(e,"content"),o=i&&""!==i||r&&""!==r,a=!i||""===i||i===n,u=r&&""!==r&&r!==i,c=!u&&i&&""!==i&&i!==n,l=!c&&!u,h=e.version;return{isLvl0:l,isLvl1:c,isLvl2:u,isLvl1EmptyOrDuplicate:a,isCategoryHeader:e.isCategoryHeader,isSubCategoryHeader:e.isSubCategoryHeader,isTextOrSubcategoryNonEmpty:o,category:n,subcategory:i,title:r,text:s,url:t,version:h}}))}static formatURL(e){const{url:t,anchor:n}=e;if(t){return-1!==t.indexOf("#")?t:n?`${e.url}#${e.anchor}`:t}return n?`#${e.anchor}`:(console.warn("no anchor nor url for : ",JSON.stringify(e)),null)}static getEmptyTemplate(){return e=>r().compile(h.empty).render(e)}static getSuggestionTemplate(e){const t=e?h.suggestionSimple:h.suggestion,n=r().compile(t);return e=>n.render(e)}handleSelected(e,t,n,i,r){void 0===r&&(r={}),"click"!==r.selectionMethod&&(e.setVal(""),window.location.assign(n.url))}handleShown(e){const t=e.offset().left+e.width()/2;let n=d()(document).width()/2;isNaN(n)&&(n=900);const i=t-n>=0?"algolia-autocomplete-right":"algolia-autocomplete-left",r=t-n<0?"algolia-autocomplete-right":"algolia-autocomplete-left",s=d()(".algolia-autocomplete");s.hasClass(i)||s.addClass(i),s.hasClass(r)&&s.removeClass(r)}}const m=g},49397:(e,t)=>{!function(e){var t=/\S/,n=/\"/g,i=/\n/g,r=/\r/g,s=/\\/g,o=/\u2028/,a=/\u2029/;function u(e){"}"===e.n.substr(e.n.length-1)&&(e.n=e.n.substring(0,e.n.length-1))}function c(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function l(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var i=1,r=e.length;i":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(n,i){var r=n.length,s=0,o=null,a=null,h="",p=[],d=!1,f=0,g=0,m="{{",y="}}";function v(){h.length>0&&(p.push({tag:"_t",text:new String(h)}),h="")}function x(n,i){if(v(),n&&function(){for(var n=!0,i=g;i"==r.tag&&(r.indent=p[s].text.toString()),p.splice(s,1));else i||p.push({tag:"\n"});d=!1,g=p.length}function b(e,t){var n="="+y,i=e.indexOf(n,t),r=c(e.substring(e.indexOf("=",t)+1,i)).split(" ");return m=r[0],y=r[r.length-1],i+n.length-1}for(i&&(i=i.split(" "),m=i[0],y=i[1]),f=0;f0;){if(u=t.shift(),s&&"<"==s.tag&&!(u.tag in h))throw new Error("Illegal content in < super tag.");if(e.tags[u.tag]<=e.tags.$||d(u,r))i.push(u),u.nodes=p(t,u.tag,i,r);else{if("/"==u.tag){if(0===i.length)throw new Error("Closing tag without opener: /"+u.n);if(a=i.pop(),u.n!=a.n&&!f(u.n,a.n,r))throw new Error("Nesting error: "+a.n+" vs. "+u.n);return a.end=u.i,o}"\n"==u.tag&&(u.last=0==t.length||"\n"==t[0].tag)}o.push(u)}if(i.length>0)throw new Error("missing closing tag: "+i.pop().n);return o}function d(e,t){for(var n=0,i=t.length;n":x,"<":function(t,n){var i={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,i);var r=n.partials[x(t,n)];r.subs=i.subs,r.partials=i.partials},$:function(t,n){var i={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,i),n.subs[t.n]=i.code,n.inPartial||(n.code+='t.sub("'+y(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=w('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+v(e.n)+'("'+y(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=w('"'+y(e.text)+'"')},"{":b,"&":b},e.walk=function(t,n){for(var i,r=0,s=t.length;r{var i=n(49397);i.Template=n(22882).Template,i.template=i.Template,e.exports=i},22882:(e,t)=>{!function(e){function t(e,t,n){var i;return t&&"object"==typeof t&&(void 0!==t[e]?i=t[e]:n&&t.get&&"function"==typeof t.get&&(i=t.get(e))),i}e.Template=function(e,t,n,i){e=e||{},this.r=e.code||this.r,this.c=n,this.options=i||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:function(e){return e=u(e),a.test(e)?e.replace(n,"&").replace(i,"<").replace(r,">").replace(s,"'").replace(o,"""):e},t:u,render:function(e,t,n){return this.ri([e],t||{},n)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var n=this.partials[e],i=t[n.name];if(n.instance&&n.base==i)return n.instance;if("string"==typeof i){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;if(this.partials[e].base=i,n.subs){for(key in t.stackText||(t.stackText={}),n.subs)t.stackText[key]||(t.stackText[key]=void 0!==this.activeSub&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=function(e,t,n,i,r,s){function o(){}function a(){}var u;o.prototype=e,a.prototype=e.subs;var c=new o;for(u in c.subs=new a,c.subsText={},c.buf="",i=i||{},c.stackSubs=i,c.subsText=s,t)i[u]||(i[u]=t[u]);for(u in i)c.subs[u]=i[u];for(u in r=r||{},c.stackPartials=r,n)r[u]||(r[u]=n[u]);for(u in r)c.partials[u]=r[u];return c}(i,n.subs,n.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,i){var r=this.ep(e,n);return r?r.ri(t,n,i):""},rs:function(e,t,n){var i=e[e.length-1];if(c(i))for(var r=0;r=0;u--)if(void 0!==(s=t(e,n[u],a))){o=!0;break}return o?(r||"function"!=typeof s||(s=this.mv(s,n,i)),s):!r&&""},ls:function(e,t,n,i,r){var s=this.options.delimiters;return this.options.delimiters=r,this.b(this.ct(u(e.call(t,i)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,i,r,s,o){var a,u=t[t.length-1],c=e.call(u);return"function"==typeof c?!!i||(a=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,u,n,a.substring(r,s),o)):c},mv:function(e,t,n){var i=t[t.length-1],r=e.call(i);return"function"==typeof r?this.ct(u(r.call(i)),i,n):r},sub:function(e,t,n,i){var r=this.subs[e];r&&(this.activeSub=e,r(t,n,this,i),this.activeSub=!1)}};var n=/&/g,i=//g,s=/\'/g,o=/\"/g,a=/[&<>\"\']/;function u(e){return String(null==e?"":e)}var c=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}}(t)},70624:(e,t,n)=>{"use strict";var i,r,s,o=[n(15525),n(64785),n(28291),n(2709),n(42506),n(12444)],a=-1,u=[],c=!1;function l(){i&&r&&(i=!1,r.length?u=r.concat(u):a=-1,u.length&&h())}function h(){if(!i){c=!1,i=!0;for(var e=u.length,t=setTimeout(l);e;){for(r=u,u=[];r&&++a1)for(var n=1;n{"use strict";t.test=function(){return!n.g.setImmediate&&void 0!==n.g.MessageChannel},t.install=function(e){var t=new n.g.MessageChannel;return t.port1.onmessage=e,function(){t.port2.postMessage(0)}}},28291:(e,t,n)=>{"use strict";var i=n.g.MutationObserver||n.g.WebKitMutationObserver;t.test=function(){return i},t.install=function(e){var t=0,r=new i(e),s=n.g.document.createTextNode("");return r.observe(s,{characterData:!0}),function(){s.data=t=++t%2}}},64785:(e,t,n)=>{"use strict";t.test=function(){return"function"==typeof n.g.queueMicrotask},t.install=function(e){return function(){n.g.queueMicrotask(e)}}},42506:(e,t,n)=>{"use strict";t.test=function(){return"document"in n.g&&"onreadystatechange"in n.g.document.createElement("script")},t.install=function(e){return function(){var t=n.g.document.createElement("script");return t.onreadystatechange=function(){e(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},n.g.document.documentElement.appendChild(t),e}}},12444:(e,t)=>{"use strict";t.test=function(){return!0},t.install=function(e){return function(){setTimeout(e,0)}}},31336:(e,t,n)=>{var i,r;!function(){var s,o,a,u,c,l,h,p,d,f,g,m,y,v,x,b,w,S,C,E,k,_,T,L,O,A,$=function(e){var t=new $.Builder;return t.pipeline.add($.trimmer,$.stopWordFilter,$.stemmer),t.searchPipeline.add($.stemmer),e.call(t,t),t.build()};$.version="2.3.9",$.utils={},$.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),$.utils.asString=function(e){return null==e?"":e.toString()},$.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),n=Object.keys(e),i=0;i0){var u=$.utils.clone(t)||{};u.position=[o,a],u.index=r.length,r.push(new $.Token(n.slice(o,s),u))}o=s+1}}return r},$.tokenizer.separator=/[\s\-]+/,$.Pipeline=function(){this._stack=[]},$.Pipeline.registeredFunctions=Object.create(null),$.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&$.utils.warn("Overwriting existing registered function: "+t),e.label=t,$.Pipeline.registeredFunctions[e.label]=e},$.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||$.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},$.Pipeline.load=function(e){var t=new $.Pipeline;return e.forEach((function(e){var n=$.Pipeline.registeredFunctions[e];if(!n)throw new Error("Cannot load unregistered function: "+e);t.add(n)})),t},$.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){$.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},$.Pipeline.prototype.after=function(e,t){$.Pipeline.warnIfFunctionNotRegistered(t);var n=this._stack.indexOf(e);if(-1==n)throw new Error("Cannot find existingFn");n+=1,this._stack.splice(n,0,t)},$.Pipeline.prototype.before=function(e,t){$.Pipeline.warnIfFunctionNotRegistered(t);var n=this._stack.indexOf(e);if(-1==n)throw new Error("Cannot find existingFn");this._stack.splice(n,0,t)},$.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},$.Pipeline.prototype.run=function(e){for(var t=this._stack.length,n=0;n1&&(se&&(n=r),s!=e);)i=n-t,r=t+Math.floor(i/2),s=this.elements[2*r];return s==e||s>e?2*r:sa?c+=2:o==a&&(t+=n[u+1]*i[c+1],u+=2,c+=2);return t},$.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},$.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,n=0;t0){var s,o=r.str.charAt(0);o in r.node.edges?s=r.node.edges[o]:(s=new $.TokenSet,r.node.edges[o]=s),1==r.str.length&&(s.final=!0),i.push({node:s,editsRemaining:r.editsRemaining,str:r.str.slice(1)})}if(0!=r.editsRemaining){if("*"in r.node.edges)var a=r.node.edges["*"];else{a=new $.TokenSet;r.node.edges["*"]=a}if(0==r.str.length&&(a.final=!0),i.push({node:a,editsRemaining:r.editsRemaining-1,str:r.str}),r.str.length>1&&i.push({node:r.node,editsRemaining:r.editsRemaining-1,str:r.str.slice(1)}),1==r.str.length&&(r.node.final=!0),r.str.length>=1){if("*"in r.node.edges)var u=r.node.edges["*"];else{u=new $.TokenSet;r.node.edges["*"]=u}1==r.str.length&&(u.final=!0),i.push({node:u,editsRemaining:r.editsRemaining-1,str:r.str.slice(1)})}if(r.str.length>1){var c,l=r.str.charAt(0),h=r.str.charAt(1);h in r.node.edges?c=r.node.edges[h]:(c=new $.TokenSet,r.node.edges[h]=c),1==r.str.length&&(c.final=!0),i.push({node:c,editsRemaining:r.editsRemaining-1,str:l+r.str.slice(2)})}}}return n},$.TokenSet.fromString=function(e){for(var t=new $.TokenSet,n=t,i=0,r=e.length;i=e;t--){var n=this.uncheckedNodes[t],i=n.child.toString();i in this.minimizedNodes?n.parent.edges[n.char]=this.minimizedNodes[i]:(n.child._str=i,this.minimizedNodes[i]=n.child),this.uncheckedNodes.pop()}},$.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},$.Index.prototype.search=function(e){return this.query((function(t){new $.QueryParser(e,t).parse()}))},$.Index.prototype.query=function(e){for(var t=new $.Query(this.fields),n=Object.create(null),i=Object.create(null),r=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a1?1:e},$.Builder.prototype.k1=function(e){this._k1=e},$.Builder.prototype.add=function(e,t){var n=e[this._ref],i=Object.keys(this._fields);this._documents[n]=t||{},this.documentCount+=1;for(var r=0;r=this.length)return $.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},$.QueryLexer.prototype.width=function(){return this.pos-this.start},$.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},$.QueryLexer.prototype.backup=function(){this.pos-=1},$.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=$.QueryLexer.EOS&&this.backup()},$.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit($.QueryLexer.TERM)),e.ignore(),e.more())return $.QueryLexer.lexText},$.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit($.QueryLexer.EDIT_DISTANCE),$.QueryLexer.lexText},$.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit($.QueryLexer.BOOST),$.QueryLexer.lexText},$.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit($.QueryLexer.TERM)},$.QueryLexer.termSeparator=$.tokenizer.separator,$.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==$.QueryLexer.EOS)return $.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return $.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit($.QueryLexer.TERM),$.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit($.QueryLexer.TERM),$.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit($.QueryLexer.PRESENCE),$.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit($.QueryLexer.PRESENCE),$.QueryLexer.lexText;if(t.match($.QueryLexer.termSeparator))return $.QueryLexer.lexTerm}else e.escapeCharacter()}},$.QueryParser=function(e,t){this.lexer=new $.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},$.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=$.QueryParser.parseClause;e;)e=e(this);return this.query},$.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},$.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},$.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},$.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case $.QueryLexer.PRESENCE:return $.QueryParser.parsePresence;case $.QueryLexer.FIELD:return $.QueryParser.parseField;case $.QueryLexer.TERM:return $.QueryParser.parseTerm;default:var n="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(n+=" with value '"+t.str+"'"),new $.QueryParseError(n,t.start,t.end)}},$.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=$.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=$.Query.presence.REQUIRED;break;default:var n="unrecognised presence operator'"+t.str+"'";throw new $.QueryParseError(n,t.start,t.end)}var i=e.peekLexeme();if(null==i){n="expecting term or field, found nothing";throw new $.QueryParseError(n,t.start,t.end)}switch(i.type){case $.QueryLexer.FIELD:return $.QueryParser.parseField;case $.QueryLexer.TERM:return $.QueryParser.parseTerm;default:n="expecting term or field, found '"+i.type+"'";throw new $.QueryParseError(n,i.start,i.end)}}},$.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var n=e.query.allFields.map((function(e){return"'"+e+"'"})).join(", "),i="unrecognised field '"+t.str+"', possible fields: "+n;throw new $.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var r=e.peekLexeme();if(null==r){i="expecting term, found nothing";throw new $.QueryParseError(i,t.start,t.end)}if(r.type===$.QueryLexer.TERM)return $.QueryParser.parseTerm;i="expecting term, found '"+r.type+"'";throw new $.QueryParseError(i,r.start,r.end)}},$.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var n=e.peekLexeme();if(null!=n)switch(n.type){case $.QueryLexer.TERM:return e.nextClause(),$.QueryParser.parseTerm;case $.QueryLexer.FIELD:return e.nextClause(),$.QueryParser.parseField;case $.QueryLexer.EDIT_DISTANCE:return $.QueryParser.parseEditDistance;case $.QueryLexer.BOOST:return $.QueryParser.parseBoost;case $.QueryLexer.PRESENCE:return e.nextClause(),$.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+n.type+"'";throw new $.QueryParseError(i,n.start,n.end)}else e.nextClause()}},$.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var n=parseInt(t.str,10);if(isNaN(n)){var i="edit distance must be numeric";throw new $.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=n;var r=e.peekLexeme();if(null!=r)switch(r.type){case $.QueryLexer.TERM:return e.nextClause(),$.QueryParser.parseTerm;case $.QueryLexer.FIELD:return e.nextClause(),$.QueryParser.parseField;case $.QueryLexer.EDIT_DISTANCE:return $.QueryParser.parseEditDistance;case $.QueryLexer.BOOST:return $.QueryParser.parseBoost;case $.QueryLexer.PRESENCE:return e.nextClause(),$.QueryParser.parsePresence;default:i="Unexpected lexeme type '"+r.type+"'";throw new $.QueryParseError(i,r.start,r.end)}else e.nextClause()}},$.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var n=parseInt(t.str,10);if(isNaN(n)){var i="boost must be numeric";throw new $.QueryParseError(i,t.start,t.end)}e.currentClause.boost=n;var r=e.peekLexeme();if(null!=r)switch(r.type){case $.QueryLexer.TERM:return e.nextClause(),$.QueryParser.parseTerm;case $.QueryLexer.FIELD:return e.nextClause(),$.QueryParser.parseField;case $.QueryLexer.EDIT_DISTANCE:return $.QueryParser.parseEditDistance;case $.QueryLexer.BOOST:return $.QueryParser.parseBoost;case $.QueryLexer.PRESENCE:return e.nextClause(),$.QueryParser.parsePresence;default:i="Unexpected lexeme type '"+r.type+"'";throw new $.QueryParseError(i,r.start,r.end)}else e.nextClause()}},void 0===(r="function"==typeof(i=function(){return $})?i.call(t,n,t,e):i)||(e.exports=r)}()}}]); \ No newline at end of file diff --git a/docs/assets/js/84611.915c8d72.js.LICENSE.txt b/docs/assets/js/84611.915c8d72.js.LICENSE.txt new file mode 100644 index 000000000..1cf473c23 --- /dev/null +++ b/docs/assets/js/84611.915c8d72.js.LICENSE.txt @@ -0,0 +1,61 @@ +/*! + * lunr.Builder + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.Index + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.Pipeline + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.Set + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.TokenSet + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.Vector + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.stemmer + * Copyright (C) 2020 Oliver Nightingale + * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt + */ + +/*! + * lunr.stopWordFilter + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.tokenizer + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.trimmer + * Copyright (C) 2020 Oliver Nightingale + */ + +/*! + * lunr.utils + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 + * Copyright (C) 2020 Oliver Nightingale + * @license MIT + */ diff --git a/docs/assets/js/8509f041.70243559.js b/docs/assets/js/8509f041.70243559.js new file mode 100644 index 000000000..af955a9d8 --- /dev/null +++ b/docs/assets/js/8509f041.70243559.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83633],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),d=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(i,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var d=2;d{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",s={unversionedId:"examples/using-odra-modules",id:"version-1.0.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-1.0.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/examples/using-odra-modules",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/category/tutorials"}},i={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"CEP-18",id:"cep-18",level:4},{value:"CEP-78",id:"cep-78",level:4},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "1.0.0"\n\n[dev-dependencies]\nodra-test = "1.0.0"\n\n[build-dependencies]\nodra-build = "1.0.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = "1.0.0"\nodra-modules = "1.0.0"\n')),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::prelude::*;\nuse odra::{Address, casper_types::U256, module::SubModule};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: SubModule\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra repository"),".")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"cep-18"},"CEP-18"),(0,r.kt)("p",null,"Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casper-network/ceps/blob/master/text/0018-token-standard.md"},"here"),"."),(0,r.kt)("h4",{id:"cep-78"},"CEP-78"),(0,r.kt)("p",null,"Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casper-network/ceps/blob/master/text/0078-enhanced-nft-standard.md"},"here"),"."),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/86127e86.2d2f8a5e.js b/docs/assets/js/86127e86.2d2f8a5e.js new file mode 100644 index 000000000..e4ee8cf8a --- /dev/null +++ b/docs/assets/js/86127e86.2d2f8a5e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[24608],{3905:(t,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function s(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var l=a.createContext({}),c=function(t){var e=a.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},d=function(t){var e=c(t.components);return a.createElement(l.Provider,{value:e},t.children)},p={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,l=t.parentName,d=i(t,["components","mdxType","originalType","parentName"]),u=c(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(h,s(s({ref:e},d),{},{components:n})):a.createElement(h,s({ref:e},d))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in e)hasOwnProperty.call(e,l)&&(i[l]=e[l]);i.originalType=t,i.mdxType="string"==typeof t?t:r,s[1]=i;for(var c=2;c{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-1.0.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-1.0.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/basics/testing",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/basics/errors"}},l={},c=[{value:"HostEnv",id:"hostenv",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function p(t){let{components:e,...n}=t;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{List, Var};\n\n#[cfg(test)]\nmod tests {\n use super::{DogContract3HostRef, DogContract3InitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn init_test() {\n let test_env = odra_test::env();\n let init_args = DogContract3InitArgs {\n name: "DogContract".to_string()\n };\n let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,r.kt)("p",null,"The first interesting thing you may notice is placed the import section."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use super::{DogContract3HostRef, DogContract3InitArgs};\nuse odra::{host::Deployer, prelude::*};\n")),(0,r.kt)("p",null,"We are using ",(0,r.kt)("inlineCode",{parentName:"p"},"super")," to import the ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," from the parent module.\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}InitArgs")," are types that was generated for us by Odra."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," is a reference to the contract that we can use to interact with it (call entrypoints)\nand implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/host/trait.HostRef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostRef"))," trait. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," is a struct that we use to initialize the contract and implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/host/trait.InitArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait.\nConsidering the contract initialization, there three possible scenarios:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with arguments, then Odra creates a struct named ",(0,r.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with no arguments, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract does not have a constructor, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),".\nAll of those structs implement the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::InitArgs")," trait, required to conform to the\n",(0,r.kt)("inlineCode",{parentName:"li"},"Deployer::deploy")," method signature. ")),(0,r.kt)("p",null,"The other import is ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::host::Deployer"),". This is a trait is used to deploy the contract and give us a reference to it."),(0,r.kt)("p",null,"Let's take a look at the test itself. How to obtain a reference to the contract?\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," implements the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/host/trait.Deployer.html"},(0,r.kt)("inlineCode",{parentName:"a"},"Deployer"))," trait, which provides the ",(0,r.kt)("inlineCode",{parentName:"p"},"deploy")," method:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n")),(0,r.kt)("p",null,"From now on, we can use ",(0,r.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute are available to us:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,r.kt)("h2",{id:"hostenv"},"HostEnv"),(0,r.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};\n use odra::{host::{Deployer, HostEnv}, prelude::*};\n\n #[test]\n fn env() {\n let test_env: HostEnv = odra_test::env();\n test_env.set_caller(test_env.get_account(0));\n let init_args = TestingContractInitArgs {\n name: "MyContract".to_string()\n };\n let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);\n let creator = testing_contract.created_by();\n test_env.set_caller(test_env.get_account(1));\n let init_args = TestingContractInitArgs {\n name: "MyContract2".to_string()\n };\n let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);\n let creator2 = testing_contract2.created_by();\n assert_ne!(creator, creator2);\n }\n}\n')),(0,r.kt)("p",null,"In the code above, at the beginning of the test, we are obtaining a ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," instance using ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_test::env()"),".\nNext, we are deploying two instances of the same contract, but we're using ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::ContractEnv::caller()"),"\nthe function we are calling inside the contract."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a set of functions that will let you write better tests:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn set_caller(&self, address: Address)")," - you've seen it in action just now"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn balance_of(&self, address: &Address) -> U512")," - returns the balance of the account associated with the given address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn advance_block_time(&self, time_diff: u64)")," - increases the current value of ",(0,r.kt)("inlineCode",{parentName:"li"},"block_time")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn get_account(&self, n: usize) -> Address")," - returns an n-th address that was prepared for you by Odra in advance;\nby default, you start with the 0-th account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn emitted_event(&self, contract_address: &Address, event: &T) -> bool")," - verifies if the event was emitted by the contract")),(0,r.kt)("p",null,"Full list of functions can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/host/struct.HostEnv.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We take a look at how Odra handles errors!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/86253fdc.00a64871.js b/docs/assets/js/86253fdc.00a64871.js new file mode 100644 index 000000000..3c6a9d674 --- /dev/null +++ b/docs/assets/js/86253fdc.00a64871.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76333],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",s={unversionedId:"basics/cargo-odra",id:"version-0.9.1/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.9.1/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.9.1/basics/cargo-odra",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.9.1/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.9.1/basics/directory-structure"}},l={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Generating contract schema",id:"generating-contract-schema",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them with various configurations."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This creates a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"The third available template is ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace"),", which creates a workspace with two projects, similar to the one created\nwith the ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template."),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.8.0 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it creates a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This creates a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"The most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It runs your tests against Odra's ",(0,r.kt)("inlineCode",{parentName:"p"},"MockVM"),". It is substantially faster than ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM"),"\nand implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra builds the project, generates the wasm files,\nspin up ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM")," instance, deploys the contracts onto it and runs the tests against it. Pretty neat."),(0,r.kt)("p",null,"Keep in mind that this is a lot slower than ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," and you cannot use the debugger.\nThis is why ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build\n")),(0,r.kt)("p",null,"If the build process finishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder.\nNotice, that this command does not require the ",(0,r.kt)("inlineCode",{parentName:"p"},"-b")," option."),(0,r.kt)("p",null,"If you want to build specific contract, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -c counter # you pass many comma separated contracts\n")),(0,r.kt)("h2",{id:"generating-contract-schema"},"Generating contract schema"),(0,r.kt)("p",null,"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"schema")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema \n")),(0,r.kt)("p",null,"This generates a schema file in JSON format for all your contracts and places them in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder.\nIf the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder does not exist, it creates the folder for you."),(0,r.kt)("p",null,"Like with the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," command, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option to generate a schema for a specific contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/86598a2c.31f7d9e6.js b/docs/assets/js/86598a2c.31f7d9e6.js new file mode 100644 index 000000000..375821f66 --- /dev/null +++ b/docs/assets/js/86598a2c.31f7d9e6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[10276],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=p;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var u=2;u{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>w});var a=n(87462),r=n(67294),s=n(86010),i=n(12466),o=n(16550),l=n(91980),u=n(67392),c=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,o.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function y(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[i,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[l,u]=h({queryString:n,groupId:a}),[d,y]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=l??d;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{b&&o(b)}),[b]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);o(e),u(e),y(e)}),[u,y,s]),tabValues:s}}var b=n(72389);const g="tabList__CuJ",f="tabItem_LNqP";function _(e){let{className:t,block:n,selectedValue:o,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),p=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==o&&(d(t),l(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:p},i,{className:(0,s.Z)("tabs__item",f,i?.className,{"tabs__item--active":o===t})}),n??t)})))}function k(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=y(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",g)},r.createElement(_,(0,a.Z)({},e,t)),r.createElement(k,(0,a.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},56645:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),i=n(85162);const o={sidebar_position:6},l="Build, Deploy and Read the State of a Contract",u={unversionedId:"tutorials/build-deploy-read",id:"version-0.9.0/tutorials/build-deploy-read",title:"Build, Deploy and Read the State of a Contract",description:"In this guide, we will show the full path from creating a contract, deploying it and reading the state.",source:"@site/versioned_docs/version-0.9.0/tutorials/build-deploy-read.md",sourceDirName:"tutorials",slug:"/tutorials/build-deploy-read",permalink:"/docs/0.9.0/tutorials/build-deploy-read",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"tutorialSidebar",previous:{title:"Pausable",permalink:"/docs/0.9.0/tutorials/pauseable"},next:{title:"Migrations",permalink:"/docs/0.9.0/category/migrations"}},c={},d=[{value:"Contract",id:"contract",level:3},{value:"Deploying the contract",id:"deploying-the-contract",level:3},{value:"Storage Layout",id:"storage-layout",level:3},{value:"Reading the state",id:"reading-the-state",level:3}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"build-deploy-and-read-the-state-of-a-contract"},"Build, Deploy and Read the State of a Contract"),(0,r.kt)("p",null,"In this guide, we will show the full path from creating a contract, deploying it and reading the state."),(0,r.kt)("p",null,"We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript."),(0,r.kt)("p",null,"Before you start, make sure you completed the following steps:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Read the ",(0,r.kt)("a",{parentName:"li",href:"../category/getting-started"},"Getting Started")," guide"),(0,r.kt)("li",{parentName:"ul"},"Get familiar with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.casper.network/developers/dapps/setup-nctl/"},"NCTL tutorial")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/make-software/casper-nctl-docker"},"NCTL docker")," image"),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/casper-ecosystem/casper-client-rs"},"casper-client"))),(0,r.kt)("h3",{id:"contract"},"Contract"),(0,r.kt)("p",null,"Let's write a contract with complex storage layout."),(0,r.kt)("p",null,"The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"."),(0,r.kt)("p",null,"We will expose two methods:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The constructor ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," which sets the metadata and the version of the contract."),(0,r.kt)("li",{parentName:"ol"},"The method ",(0,r.kt)("inlineCode",{parentName:"li"},"set_data")," which sets the value of the numeric field and the values of the mapping.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=custom_item.rs showLineNumbers",title:"custom_item.rs",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};\n\n// A custom type with a vector of another custom type\n#[odra::odra_type]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[odra::odra_type]\npub struct Price {\n value: U256,\n}\n\n// The main contract with a version, metadata and a submodule\n#[odra::module]\npub struct CustomItem {\n version: Var,\n meta: Var,\n data: SubModule\n}\n\n#[odra::module]\nimpl CustomItem {\n pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {\n let meta = Metadata {\n name,\n description,\n prices: vec![\n Price { value: price_1 },\n Price { value: price_2 }\n ]\n };\n self.meta.set(meta);\n self.version.set(self.version.get_or_default() + 1);\n }\n\n pub fn set_data(&mut self, value: u32, name: String, name2: String) {\n self.data.value.set(value);\n self.data.inner.named_values.set(&name, 10);\n self.data.inner.named_values.set(&name2, 20);\n }\n}\n\n// A submodule with a numeric value and another submodule\n#[odra::module]\nstruct Data {\n value: Var,\n inner: SubModule,\n}\n\n// A submodule with a mapping\n#[odra::module]\nstruct InnerData {\n named_values: Mapping,\n}\n\n")),(0,r.kt)("h3",{id:"deploying-the-contract"},"Deploying the contract"),(0,r.kt)("p",null,"First, we need to setup the chain. We will use the NCTL docker image to run a local network."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Next, we need to compile the contract to a Wasm file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra build -c custom_item \n")),(0,r.kt)("p",null,"Then, we can deploy the contract using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"casper-client put-deploy \\\n --node-address http://localhost:11101 \\\n --chain-name casper-net-1 \\\n --secret-key path/to/your/secret_key.pem \\ \n --session-path [PATH_TO_WASM] \\\n --payment-amount 100000000000 \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'test_contract_package_hash'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'true'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string='My Name'\" \\\n --session-arg \"description:string='My Description'\" \\ \n --session-arg \"price_1:u256='101'\" \\\n --session-arg \"price_2:u256='202'\"\n")),(0,r.kt)("p",null,"Finally, we can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"set_data")," method to set the values of the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'casper-client put-deploy \\\n --node-address http://localhost:11101 \\ \n --chain-name casper-net-1 \\\n --secret-key ./keys/secret_key.pem \\ \n --payment-amount 2000000000 \\\n --session-hash [DEPLOYED_CONTRACT_HASH] \\\n --session-entry-point "set_data" \\\n --session-arg "value:u32:\'666\'" \\\n --session-arg "name:string=\'alice\'" \\ \n --session-arg "name2:string=\'bob\'"\n')),(0,r.kt)("h3",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"To read the state of the contract, we need to understand the storage layout."),(0,r.kt)("p",null,"The first step is to calculate the index of the keys. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Storage Layout\n\nCustomItem: prefix: 0x0..._0000_0000_0000 0\n version: u32, 0x0..._0000_0000_0000 0\n meta: Metadata, 0x0..._0000_0000_0001 1\n data: Data: prefix: 0x0..._0000_0000_0010 2\n value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0\n inner: InnerData: prefix: 0x0..._0000_0010_0001 (2 << 4) + 1\n named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0\n")),(0,r.kt)("p",null,"The actual key is obtained as follows:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Convert the index to a big-endian byte array."),(0,r.kt)("li",{parentName:"ol"},"Concatenate the index with the mapping data."),(0,r.kt)("li",{parentName:"ol"},"Hash the concatenated bytes using blake2b."),(0,r.kt)("li",{parentName:"ol"},"Return the hex representation of the hash (the stored key must be utf-8 encoded).")),(0,r.kt)("p",null,"In more detail, the storage layout is described in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/advanced/storage-layout"},"Storage Layout article"),"."),(0,r.kt)("h3",{id:"reading-the-state"},"Reading the state"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=main.rs showLineNumbers",title:"main.rs",showLineNumbers:!0},'use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};\nuse casper_types::{\n bytesrepr::{FromBytes, ToBytes},\n U256,\n};\n\n// replace with your contract hash\nconst CONTRACT_HASH: &str = "hash-...";\nconst NODE_ADDRESS: &str = "http://localhost:11101/rpc";\nconst RPC_ID: &str = "casper-net-1";\nconst DICTIONARY_NAME: &str = "state";\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec,\n}\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\nasync fn read_state_key(key: String) -> Vec {\n let state_root_hash = casper_client::get_state_root_hash(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n None,\n )\n .await\n .unwrap()\n .result\n .state_root_hash\n .unwrap();\n\n // Read the value from the `state` dictionary.\n let result = casper_client::get_dictionary_item(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n state_root_hash,\n DictionaryItemIdentifier::ContractNamedKey {\n key: CONTRACT_HASH.to_string(),\n dictionary_name: DICTIONARY_NAME.to_string(),\n dictionary_item_key: key,\n },\n )\n .await\n .unwrap()\n .result\n .stored_value;\n\n // We expect the value to be a CLValue\n if let StoredValue::CLValue(cl_value) = result {\n // Ignore the first 4 bytes, which are the length of the CLType.\n cl_value.inner_bytes()[4..].to_vec()\n } else {\n vec![]\n }\n}\n\nasync fn metadata() -> Metadata {\n // The key for the metadata is 1, and it has no mapping data\n let key = key(1, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the name and store the remaining bytes\n let (name, bytes) = String::from_bytes(&bytes).unwrap();\n // Read the description and store the remaining bytes\n let (description, bytes) = String::from_bytes(&bytes).unwrap();\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();\n\n let mut prices = vec![];\n // As we know the size of the vector, we can loop over it\n for _ in 0..size {\n // Read the value and store the remaining bytes\n let (value, rem) = U256::from_bytes(&bytes).unwrap();\n bytes = rem;\n prices.push(Price { value });\n }\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n Metadata {\n name,\n description,\n prices\n }\n}\n\nasync fn value() -> u32 {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n let key = key(2 << 4, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nasync fn named_value(name: &str) -> u32 {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = name.to_bytes().unwrap();\n let key = key(((2 << 4) + 1) << 4, &mapping_data);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nfn main() {\n let runtime = tokio::runtime::Runtime::new().unwrap();\n dbg!(runtime.block_on(metadata()));\n dbg!(runtime.block_on(value()));\n dbg!(runtime.block_on(named_value("alice")));\n dbg!(runtime.block_on(named_value("bob")));\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfn key(idx: u32, mapping_data: &[u8]) -> String {\n let mut key = Vec::new();\n key.extend_from_slice(idx.to_be_bytes().as_ref());\n key.extend_from_slice(mapping_data);\n let hashed_key = blake2b(&key);\n\n hex::encode(&hashed_key)\n}\n\nfn blake2b(bytes: &[u8]) -> [u8; 32] {\n let mut result = [0u8; 32];\n let mut hasher = ::new(32)\n .expect("should create hasher");\n let _ = std::io::Write::write(&mut hasher, bytes);\n blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)\n .expect("should copy hash to the result array");\n result\n}\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'cargo run\n[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {\n name: "My Contract",\n description: "My Description",\n prices: [\n Price {\n value: 123,\n },\n Price {\n value: 321,\n },\n ],\n}\n[src/main.rs:117:5] runtime.block_on(value()) = 666\n[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20\n[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10\n'))),(0,r.kt)(i.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'\nimport { blake2bHex } from "blakejs";\nimport {\n CLList,\n CLListBytesParser,\n CLStringBytesParser,\n CLU256BytesParser,\n CLU32BytesParser,\n CLU8,\n CLValueBuilder,\n CasperClient,\n CasperServiceByJsonRPC,\n Contracts,\n ToBytes,\n} from "casper-js-sdk";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\n// replace with your contract hash\nconst CONTRACT_HASH = "hash-...";\nconst STATE_DICTIONARY_NAME = "state";\nconst U32_SIZE = 4;\n\nclass Price {\n value: bigint;\n\n constructor(value: bigint) {\n this.value = value;\n }\n}\n\nclass Metadata {\n name: string;\n description: string;\n prices: Price[];\n\n constructor(name: string, description: string, prices: Price[]) {\n this.name = name;\n this.description = description;\n this.prices = prices;\n }\n}\n\nexport class Contract {\n client: CasperClient;\n service: CasperServiceByJsonRPC;\n contract: Contracts.Contract;\n\n private constructor() {\n this.client = new CasperClient(LOCAL_NODE_URL);\n this.service = new CasperServiceByJsonRPC(LOCAL_NODE_URL);\n this.contract = new Contracts.Contract(this.client);\n this.contract.setContractHash(CONTRACT_HASH);\n }\n\n static async load() {\n return new Contract();\n }\n\n async read_state(key: string) {\n const response = await this.contract.queryContractDictionary(STATE_DICTIONARY_NAME, key);\n let data: CLList = CLValueBuilder.list(response.value());\n let bytes = new CLListBytesParser().toBytes(data).unwrap();\n // Ignore the first 4 bytes, which are the length of the CLType\n return bytes.slice(4);\n }\n\n async metadata() {\n // The key for the metadata is 1, and it has no mapping data\n let bytes: Uint8Array = await this.read_state(key(1));\n\n // Read the name and store the remaining bytes\n let name = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = name.remainder as Uint8Array;\n\n // Read the description and store the remaining bytes\n let description = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = description.remainder as Uint8Array;\n\n let prices: Price[] = [];\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let size = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n bytes = size.remainder as Uint8Array;\n\n // As we know the size of the vector, we can loop over it\n for (let i = 0; i < size.result.unwrap().data.toNumber(); i++) {\n let price = new CLU256BytesParser().fromBytesWithRemainder(bytes);\n bytes = price.remainder as Uint8Array;\n prices.push(new Price(price.result.unwrap().data.toBigInt()));\n }\n\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n return new Metadata(\n name.result.unwrap().data,\n description.result.unwrap().data,\n prices\n );\n }\n \n async value() {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n const bytes = await this.read_state(key((2 << 4) + 0));\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n\n async named_value(name: string) {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = new CLStringBytesParser()\n .toBytes(CLValueBuilder.string(name))\n .unwrap();\n let bytes: Uint8Array = await this.read_state(\n key(((2 << 4) + 1) << 4, mapping_data)\n );\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfunction key(idx: number, mapping_data: Uint8Array = new Uint8Array([])) {\n let key = new Uint8Array(U32_SIZE + mapping_data.length);\n new DataView(key.buffer).setUint32(0, idx, false); // false for big-endian\n key.set(mapping_data, U32_SIZE);\n\n return blake2bHex(key, undefined, 32);\n}\n\nconst contract = Contract.load();\ncontract.then(async (c) => {\n console.log(await c.value());\n console.log(await c.metadata());\n console.log(await c.named_value("alice"));\n console.log(await c.named_value("bob"));\n});\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \nMetadata {\n name: 'My Contract',\n description: 'My Description',\n prices: [ Price { value: 123n }, Price { value: 321n } ]\n}\n666n\n20n\n10n\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/874ec8b8.1685691c.js b/docs/assets/js/874ec8b8.1685691c.js new file mode 100644 index 000000000..235fda83d --- /dev/null +++ b/docs/assets/js/874ec8b8.1685691c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33e3],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",s={unversionedId:"getting-started/flipper",id:"version-1.0.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-1.0.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/getting-started/flipper",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/getting-started/installation"},next:{title:"Basics",permalink:"/docs/category/basics"}},i={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Var;\n\n/// A module definition. Each module struct consists Vars and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Var,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor, must be named `init`.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let env = odra_test::env();\n let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);\n let contract2 = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To run the tests, execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test # or add the `-b casper` flag to run tests on the CasperVM\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/87661fc3.59126e17.js b/docs/assets/js/87661fc3.59126e17.js new file mode 100644 index 000000000..e313985e8 --- /dev/null +++ b/docs/assets/js/87661fc3.59126e17.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[85100],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.8.1/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.8.1/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.8.1/",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.8.1/category/getting-started"}},c={image:r(3149).Z},p=[{value:"What's next",id:"whats-next",level:2}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a Rust-based smart contract framework for ",(0,o.kt)("a",{parentName:"p",href:"https://casper.network"},"Casper Network"),". Odra encourages rapid development and clean,\npragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. "),(0,o.kt)("p",null,"It's free and open source!"),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.1/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.1/getting-started/flipper"},"Flipper example")," to find out how to start your new project with Odra."))}d.isMDXComponent=!0},3149:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/87854661.edba6a17.js b/docs/assets/js/87854661.edba6a17.js new file mode 100644 index 000000000..6ec660f15 --- /dev/null +++ b/docs/assets/js/87854661.edba6a17.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[30819],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||p[f]||o;return n?r.createElement(m,l(l({ref:t},u),{},{components:n})):r.createElement(m,l({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-0.8.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that",source:"@site/versioned_docs/version-0.8.0/advanced/03-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.8.0/advanced/attributes",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.8.0/advanced/advanced-storage"},next:{title:"Storage Layout",permalink:"/docs/0.8.0/advanced/storage-layout"}},s={},c=[{value:"Payable",id:"payable",level:2},{value:"Example",id:"example",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Example",id:"example-1",level:3},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"attributes"},"Attributes"),(0,a.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that\nallows developers to embed common checks into function definitions in a readable and reusable manner.\nThese are essentially prerequisites for function execution."),(0,a.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,a.kt)("h2",{id:"payable"},"Payable"),(0,a.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,a.kt)("h3",{id:"example"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U256 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env.revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env()\n .emit_event(Deposit {\n address: caller,\n amount\n });\n}\n")),(0,a.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,a.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,a.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,a.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,a.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,a.kt)("p",null,"In Odra you can just apply the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,a.kt)("h3",{id:"example-1"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct NonReentrantCounter {\n counter: Var\n}\n\n#[odra::module]\nimpl NonReentrantCounter {\n #[odra(non_reentrant)]\n pub fn count_ref_recursive(&mut self, n: u32) {\n if n > 0 {\n self.count();\n ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);\n }\n }\n}\n\nimpl NonReentrantCounter {\n fn count(&mut self) {\n let c = self.counter.get_or_default();\n self.counter.set(c + 1);\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::{host::{Deployer, NoArgs}, ExecutionError};\n\n #[test]\n fn ref_recursion_not_allowed() {\n let test_env = odra_test::env();\n let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);\n\n let result = contract.count_ref_recursive(11);\n assert_eq!(result, ExecutionError::ReentrantCall.into());\n }\n}\n")),(0,a.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,a.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"or "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"In both cases attributes order does not matter."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/881a4843.9eaa4ee0.js b/docs/assets/js/881a4843.9eaa4ee0.js new file mode 100644 index 000000000..647d39de9 --- /dev/null +++ b/docs/assets/js/881a4843.9eaa4ee0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[81557],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),h=c(n),u=o,m=h["".concat(s,".").concat(u)]||h[u]||p[u]||r;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:3},i="Livenet",l={unversionedId:"backends/livenet",id:"version-0.8.0/backends/livenet",title:"Livenet",description:"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local",source:"@site/versioned_docs/version-0.8.0/backends/04-livenet.md",sourceDirName:"backends",slug:"/backends/livenet",permalink:"/docs/0.8.0/backends/livenet",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1711379330,formattedLastUpdatedAt:"Mar 25, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Casper",permalink:"/docs/0.8.0/backends/casper"},next:{title:"Examples",permalink:"/docs/0.8.0/category/examples"}},s={},c=[{value:"Setup",id:"setup",level:2},{value:"Usage",id:"usage",level:2},{value:"How Livenet backend works",id:"how-livenet-backend-works",level:2},{value:"Multiple enviroments",id:"multiple-enviroments",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"livenet"},"Livenet"),(0,o.kt)("p",null,"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local\ntest node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend\nto handle the deployment of your contracts to the real blockchain."),(0,o.kt)("p",null,"Furthermore, it is implemented in a similarly to Casper or OdraVM,\nhowever, it uses a real blockchain to deploy contracts and store the state.\nThis lets us use Odra to deploy and test contracts on a real blockchain, but\non the other hand, it comes with some limitations on what can be done in the tests."),(0,o.kt)("p",null,"The main differences between Livenet and e.g. CasperVM backend are:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Real CSPR tokens are used to deploy and call contracts. This also means that we need to\npay for each contract deployment and each contract call. Of course, we can use the ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/tools/faucet"},"faucet"),"\nto get some tokens for testing purposes, but we still need to specify the amount needed\nfor each action."),(0,o.kt)("li",{parentName:"ul"},"The contract state is stored on the real blockchain, so we can't just reset the state -\nwe can redeploy the contract, but we can't remove the old one."),(0,o.kt)("li",{parentName:"ul"},"Because of the above, we can load the existing contracts and use them in the tests."),(0,o.kt)("li",{parentName:"ul"},"We have no control over the block time. This means that for example, ",(0,o.kt)("inlineCode",{parentName:"li"},"advance_block_time")," function\nis implemented by waiting for the real time to pass.")),(0,o.kt)("p",null,"This is also a cause for the fact that the Livenet backend cannot be (yet) used for running\nthe regular Odra tests. Instead, we can create integration tests or binaries which will\nuse a slightly different workflow to test the contracts."),(0,o.kt)("h2",{id:"setup"},"Setup"),(0,o.kt)("p",null,"To use Livenet backend, we need to provide Odra with some information - the network address, our private\nkey and the name of the chain we want to use. Optionally, we can add multiple private keys to use\nmore than one account in our tests. Those values are passed using environment variables. We can use .env\nfile to store them - let's take a look at an example .env file, created from the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/examples/.env.sample"},".env.sample")," file from\nexamples folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env"},"# Path to the secret key of the account that will be used\n# to deploy the contracts.\n# We're using .keys folder so we don't accidentally commit\n# the secret key to the repository.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777\n\n# Chain name of the network. Known values:\n# - integration-test\nODRA_CASPER_LIVENET_CHAIN_NAME=integration-test\n\n# Paths to the secret keys of the additional accounts.\n# Main secret key will be 0th account.\nODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem\nODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem\n")),(0,o.kt)("p",null,"With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find\na simple binary that deploys a contract and calls it. The test is located in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/examples/bin/erc20_on_livenet.rs"},"erc20_on_livenet.rs")," file.\nLet's go through the code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // Similar to the OdraVM backend, we need to initialize\n // the environment:\n let env = odra_casper_livenet_env::env();\n\n // Most of the for the host env works the same as in the\n // OdraVM backend.\n let owner = env.caller();\n // Addresses are the real addresses on the blockchain,\n // so we need to provide them\n // if we did not import their secret keys.\n let recipient = \n "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Arguments for the contract init method.\n let name = String::from("Plascoin");\n let symbol = String::from("PLS");\n let decimals = 10u8;\n let initial_supply: U256 = U256::from(10_000);\n \n // The main difference between other backends - we need to specify\n // the gas limit for each action.\n // The limit will be used for every consecutive action\n // until we change it.\n env.set_gas(100_000_000_000u64);\n \n // Deploy the contract. The API is the same as in the OdraVM backend.\n let init_args = Erc20InitArgs {\n name,\n symbol,\n decimals,\n initial_supply: Some(initial_supply)\n };\n let mut token = Erc20HostRef::deploy(env, init_args);\n \n // We can now use the contract as we would in the OdraVM backend.\n println!("Token address: {}", token.address().to_string());\n\n // Uncomment to load existing contract.\n // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n // let address = Address::from_str(address).unwrap();\n // We use the Livenet-specific `load` method to load the contract\n // that is already deployed.\n // let mut token = Erc20Deployer::load(env, address);\n\n // Non-mutable calls are free! Neat, huh? More on that later.\n println!("Token name: {}", token.name());\n\n // The next call is mutable, but the cost is lower that the deployment,\n // so we change the amount of gas\n env.set_gas(3_000_000_000u64);\n token.transfer(recipient, U256::from(1000));\n\n println!("Owner\'s balance: {:?}", token.balance_of(owner));\n println!("Recipient\'s balance: {:?}", token.balance_of(recipient));\n}\n')),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The above example is a rust binary, not a test. Note that it is also added as a section of the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[bin]\nname = "erc20_on_livenet"\npath = "src/bin/erc20_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n'))),(0,o.kt)("h2",{id:"usage"},"Usage"),(0,o.kt)("p",null,"To run the above code, we simply need to run the binary with the ",(0,o.kt)("inlineCode",{parentName:"p"},"livenet")," feature enabled:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Before executing the binary, make sure you built a wasm file.")),(0,o.kt)("p",null,"A part of a sample output should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'...\n\ud83d\udc81 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\udc81 INFO : Deploy "65b1a5d21..." successfully executed.\nOwner\'s balance: 4004\nRecipient\'s balance: 4000\n')),(0,o.kt)("p",null,"Those logs are a result of the last 4 lines of the above listing.\nEach deployment or a call to the blockchain will be noted and will take some time to execute.\nWe can see that the ",(0,o.kt)("inlineCode",{parentName:"p"},"transfer")," call took over 15 seconds to execute. But calling ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," was nearly instant\nand cost us nothing. How it is possible?"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You can see the deployment on ",(0,o.kt)("a",{parentName:"p",href:"http://cspr.live/"},"http://cspr.live/")," - the transfer from the example\ncan be seen ",(0,o.kt)("a",{parentName:"p",href:"https://integration.cspr.live/deploy/65b1a5d21174a62c675f89683aba995c453b942c705b404a1f8bbf6f0f6de32a"},"here"),".")),(0,o.kt)("h2",{id:"how-livenet-backend-works"},"How Livenet backend works"),(0,o.kt)("p",null,"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state.\nIt is possible however to query the state of the blockchain for free."),(0,o.kt)("p",null,"This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the\nnode is the current state. This is why the ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," call was almost instant and free."),(0,o.kt)("p",null,"Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract\n(see ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/cross-calls"},"Cross Calls"),"), it is executed offline and\nnode is used for the state query only. However, the Livenet needs to know the connection between the contracts\nand the code, so make sure to deploy or load already deployed contracts"),(0,o.kt)("h2",{id:"multiple-enviroments"},"Multiple enviroments"),(0,o.kt)("p",null,"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts,\nmultiple nodes or even multiple chains."),(0,o.kt)("p",null,"To do this, simply create a new ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with a different prefix - for example, ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet.env"),".\nThen, pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"ODRA_CASPER_LIVENET_ENV")," variable with value either ",(0,o.kt)("inlineCode",{parentName:"p"},"integration")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet")," to select which file\nhas to be used first. If your ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file has a value that IS present in the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file, it will\noverride the value from the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene\n")),(0,o.kt)("p",null,"To sum up - this command will firstly load the ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file and then load the missing values from ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/8837ae20.6e051c8b.js b/docs/assets/js/8837ae20.6e051c8b.js new file mode 100644 index 000000000..0f04e43b9 --- /dev/null +++ b/docs/assets/js/8837ae20.6e051c8b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41817],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=a.createContext({}),p=function(e){var r=a.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return a.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return a.createElement(a.Fragment,{},r)}},u=a.forwardRef((function(e,r){var t=e.components,o=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?a.createElement(f,l(l({ref:r},c),{},{components:t})):a.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var a=t(87462),o=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.9.1/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].",source:"@site/versioned_docs/version-0.9.1/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.9.1/examples/odra-examples",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.9.1/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.9.1/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,o.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"examples")," in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra main repository"),"."),(0,o.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,o.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,o.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,o.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/88434b46.6ea04786.js b/docs/assets/js/88434b46.6ea04786.js new file mode 100644 index 000000000..4aa40f87d --- /dev/null +++ b/docs/assets/js/88434b46.6ea04786.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[27195],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,g=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return t?a.createElement(g,i(i({ref:n},p),{},{components:t})):a.createElement(g,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const o={},i="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.8.1/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.8.1/advanced/02-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.8.1/advanced/advanced-storage",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711379330,formattedLastUpdatedAt:"Mar 25, 2024",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.8.1/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.8.1/advanced/attributes"}},c={},l=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:l};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Var"),": A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence\nwhere\n T: Num + One + OdraType\n{\n value: Var\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is a key-value storage system where the key is associated with a value.\nIn previous examples, the value of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," typically comprised a standard serializable type (such as number, string, or bool) or a custom type derived from ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::OdraType"),"."),(0,r.kt)("p",null,"However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{casper_types::U256, Mapping, UnwrapOrRevert};\nuse odra::prelude::*;\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct Mappings {\n strings: Mapping<(String, u32, String), String>,\n tokens: Mapping\n}\n\n#[odra::module]\nimpl Mappings {\n\n ...\n\n pub fn total_supply(&mut self, token_name: String) -> U256 {\n self.tokens.module(&token_name).total_supply()\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let opt_string = self.strings.get(&(key1, key2, key3));\n opt_string.unwrap_or_revert(&self.env())\n }\n}\n")),(0,r.kt)("p",null,"As you can see, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," key can consist of a tuple of values, not limited to a single value."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra modules differs from accessing regular values such as strings or numbers."),(0,r.kt)("p",{parentName:"admonition"},"Firstly, within a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you don't encapsulate the module with ",(0,r.kt)("inlineCode",{parentName:"p"},"Submodule"),"."),(0,r.kt)("p",{parentName:"admonition"},"Secondly, rather than utilizing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::module()"),", which returns ",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule")," and sets the appropriate namespace for nested modules.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, casper_types::U512, Sequence, Mapping};\nuse odra::prelude::*;\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n counter: Sequence,\n tokens: Mapping<(String, String), Token>,\n}\n\nimpl AdvancedStorage {\n pub fn current_value(&self) -> u32 {\n self.counter.get_current_value()\n }\n\n pub fn increment_and_get(&mut self) -> u32 {\n self.counter.next_value()\n }\n\n pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {\n let token = self.tokens.module(&(token_name, creator));\n token.balance_of(&address)\n }\n\n pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {\n let mut token = self.tokens.module(&(token_name, creator));\n token.mint(amount, to);\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra offers a Sequence module, enabling contracts to store and increment a single value."),(0,r.kt)("li",{parentName:"ol"},"Mappings support composite keys expressed as tuples and can store modules as values.")),(0,r.kt)("p",null,"Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/88506cf5.bc7196b9.js b/docs/assets/js/88506cf5.bc7196b9.js new file mode 100644 index 000000000..3bcb16b9a --- /dev/null +++ b/docs/assets/js/88506cf5.bc7196b9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[86188],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),u=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=u(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=u(n),m=r,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>u});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5},o="Pausable",l={unversionedId:"tutorials/pauseable",id:"version-0.8.0/tutorials/pauseable",title:"Pausable",description:"The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.",source:"@site/versioned_docs/version-0.8.0/tutorials/pauseable.md",sourceDirName:"tutorials",slug:"/tutorials/pauseable",permalink:"/docs/0.8.0/tutorials/pauseable",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Access Control",permalink:"/docs/0.8.0/tutorials/access-control"},next:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/0.8.0/tutorials/build-deploy-read"}},i={},u=[{value:"Code",id:"code",level:2},{value:"Events and Error",id:"events-and-error",level:3},{value:"Module definition",id:"module-definition",level:3},{value:"Checks and guards",id:"checks-and-guards",level:3},{value:"Actions",id:"actions",level:3},{value:"Pausable counter",id:"pausable-counter",level:2}],d={toc:u};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently."),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"As always, we will start with defining functionalities of our module."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Check the state - is it paused or not."),(0,r.kt)("li",{parentName:"ol"},"State guards - a contract should stop execution if is in a state we don't expect."),(0,r.kt)("li",{parentName:"ol"},"Switch the state.")),(0,r.kt)("h3",{id:"events-and-error"},"Events and Error"),(0,r.kt)("p",null,"There just two errors that may occur: ",(0,r.kt)("inlineCode",{parentName:"p"},"PausedRequired"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"UnpausedRequired"),". We define them in a standard Odra way."),(0,r.kt)("p",null,"Events definition is highly uncomplicated: ",(0,r.kt)("inlineCode",{parentName:"p"},"Paused")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused")," events holds only the address of the pauser."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Event, OdraError};\n\n#[derive(OdraError)]\npub enum Error {\n PausedRequired = 1_000,\n UnpausedRequired = 1_001,\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Paused {\n pub account: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Unpaused {\n pub account: Address\n}\n")),(0,r.kt)("h3",{id:"module-definition"},"Module definition"),(0,r.kt)("p",null,"The module storage is extremely simple - has a single ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," of type bool, that indicates if a contract is paused."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::Var;\n...\n\n#[odra::module(events = [Paused, Unpaused])]\npub struct Pausable {\n is_paused: Var\n}\n")),(0,r.kt)("h3",{id:"checks-and-guards"},"Checks and guards"),(0,r.kt)("p",null,"Now, let's move to state checks and guards."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn is_paused(&self) -> bool {\n self.is_paused.get_or_default()\n }\n\n pub fn require_not_paused(&self) {\n if self.is_paused() {\n self.env().revert(Error::UnpausedRequired);\n }\n }\n\n pub fn require_paused(&self) {\n if !self.is_paused() {\n self.env().revert(Error::PausedRequired);\n }\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - as mentioned in the intro, the module is not intended to be a standalone contract, so the only ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block is not annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::module")," and hence does not expose any entrypoint."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L2")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused()")," checks the contract state, if the Var ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused")," has not been initialized, the default value (false) is returned."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - to guarantee the code is executed when the contract is not paused, ",(0,r.kt)("inlineCode",{parentName:"li"},"require_not_paused()")," function reads the state and reverts if the contract is paused. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"require_paused()")," is a mirror function - stops the contract execution if the contract is not paused.")),(0,r.kt)("h3",{id:"actions"},"Actions"),(0,r.kt)("p",null,"Finally, we will add the ability to switch the module state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn pause(&mut self) {\n self.require_not_paused();\n self.is_paused.set(true);\n\n self.env().emit_event(Paused {\n account: self.env().caller()\n });\n }\n\n pub fn unpause(&mut self) {\n self.require_paused();\n self.is_paused.set(false);\n\n self.env().emit_event(Unpaused {\n account: self.env().caller()\n });\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"pause()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()")," functions do three things: ensure the contract is the right state (unpaused for ",(0,r.kt)("inlineCode",{parentName:"p"},"pause()"),", not paused for ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()"),"), updates the state, and finally emits events (",(0,r.kt)("inlineCode",{parentName:"p"},"Paused"),"/",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused"),")."),(0,r.kt)("h2",{id:"pausable-counter"},"Pausable counter"),(0,r.kt)("p",null,"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called ",(0,r.kt)("inlineCode",{parentName:"p"},"PausableCounter"),". The contract consists of a Var ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module. The counter can only be incremented if the contract is in a normal state (is not paused)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"...\nuse odra::SubModule;\n...\n\n#[odra::module]\npub struct PausableCounter {\n value: Var,\n pauseable: SubModule\n}\n\n#[odra::module]\nimpl PausableCounter {\n pub fn increment(&mut self) {\n self.pauseable.require_not_paused();\n\n let new_value = self.value.get_or_default() + 1;\n self.value.set(new_value);\n }\n\n pub fn pause(&mut self) {\n self.pauseable.pause();\n }\n\n pub fn unpause(&mut self) {\n self.pauseable.unpause();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn increment_only_if_unpaused() {\n let test_env = odra_test::env();\n let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);\n contract.increment();\n contract.pause();\n\n assert_eq!(\n contract.try_increment().unwrap_err(),\n Error::UnpausedRequired.into()\n );\n assert_eq!(contract.get_value(), 1);\n }\n}\n")),(0,r.kt)("p",null,"As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/88b75f2c.31067f7a.js b/docs/assets/js/88b75f2c.31067f7a.js new file mode 100644 index 000000000..f4e25c11b --- /dev/null +++ b/docs/assets/js/88b75f2c.31067f7a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[96075],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},c),{},{components:t})):a.createElement(f,l({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={},l="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.7.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.7.0/advanced/02-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.7.0/advanced/delegate",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Module reusing",permalink:"/docs/0.7.0/advanced/using"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.7.0/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n pub fn approve(&mut self, spender: Address, amount: U256);\n pub fn name(&self) -> String;\n pub fn symbol(&self) -> String;\n pub fn decimals(&self) -> u8;\n pub fn total_supply(&self) -> U256;\n pub fn balance_of(&self, owner: Address) -> U256;\n pub fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n pub fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: Ownable,\n erc20: Erc20,\n exchange: Exchange\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n pub fn swap(&mut self, sender: Address, recipient: Address);\n pub fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/893f4b86.669333e9.js b/docs/assets/js/893f4b86.669333e9.js new file mode 100644 index 000000000..528ca437d --- /dev/null +++ b/docs/assets/js/893f4b86.669333e9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[36452],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var r=o.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return o.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},u=o.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?o.createElement(f,l(l({ref:r},c),{},{components:t})):o.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.7.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.",source:"@site/versioned_docs/version-0.7.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.7.0/examples/odra-examples",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.7.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.7.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,a.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,a.kt)("inlineCode",{parentName:"p"},"examples")," in the Odra main repository."),(0,a.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,a.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,a.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/8988b866.61fbde3e.js b/docs/assets/js/8988b866.61fbde3e.js new file mode 100644 index 000000000..0976992cd --- /dev/null +++ b/docs/assets/js/8988b866.61fbde3e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95598],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),p=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=r,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(f,s(s({ref:n},c),{},{components:t})):a.createElement(f,s({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,s=new Array(o);s[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:3},s="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.4.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.4.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.4.0/tutorials/erc20",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.4.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.4.0/tutorials/owned-token"}},i={},p=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"erc-20"},"ERC-20"),(0,r.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,r.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value. "),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"advanced storage - key-value pairs, "),(0,r.kt)("li",{parentName:"ul"},"Odra types like ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),", "),(0,r.kt)("li",{parentName:"ul"},"advanced events assertion.")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Our module has a pretty complex storage layout in comparison to the previous example."),(0,r.kt)("p",null,"We need to store the following data:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol and decimals."),(0,r.kt)("li",{parentName:"ol"},"Total supply."),(0,r.kt)("li",{parentName:"ol"},"Users' balances."),(0,r.kt)("li",{parentName:"ol"},"Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.")),(0,r.kt)("h2",{id:"module-definition"},"Module definition"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,r.kt)("inlineCode",{parentName:"li"},"mapping"),". You may notice the ",(0,r.kt)("inlineCode",{parentName:"li"},"balances")," property maps ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," to ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),". If you deal with addresses or you operate on tokens, you should always choose ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," over ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Odra allows nested ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),"s, what we utilize to store allowances.")),(0,r.kt)("h3",{id:"metadata"},"Metadata"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.balances.add(address, *amount);\n self.total_supply.add(amount);\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: Balance\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3-L10")," - A constructor sets the token metadata and mints the initial supply."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12-L14")," - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," example, we used the ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returning an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function and the contract does not fail even if the value is not initialized."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29")," - The second ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," is not an odra module, in other words these function will not be a part of contract's ABI."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30-L39")," - Mint function is public, so like in a regular rust code will be accessible from the outside. ",(0,r.kt)("inlineCode",{parentName:"li"},"mint()")," use notation ",(0,r.kt)("inlineCode",{parentName:"li"},"self.balances.add(&address, amount);"),", which it is syntactic sugar for:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let current_balance = self.balances.get(&address).unwrap_or_default();\nlet new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();\nself.balances.set(&address, new_balance);\n")),(0,r.kt)("h3",{id:"core"},"Core"),(0,r.kt)("p",null,"For the sake of completeness, let's implement the remaining functionalities like ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_from"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"approve"),". They are not introducing any new concepts, so we leave them without additional remarks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs",title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let spender = contract_env::caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n let owner = contract_env::caller();\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n contract_env::revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .get_instance(owner)\n .set(spender, new_allowance);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,r.kt)("p",null,"Now, compare the code we have written, with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};\n use odra::{assert_events, test_env, types::U256};\n\n pub const NAME: &str = "Plascoin";\n pub const SYMBOL: &str = "PLS";\n pub const DECIMALS: u8 = 10;\n pub const INITIAL_SUPPLY: u32 = 10_000;\n\n pub fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n String::from(NAME),\n String::from(SYMBOL),\n DECIMALS,\n INITIAL_SUPPLY.into()\n )\n }\n\n #[test]\n fn initialization() {\n let erc20 = setup();\n\n assert_eq!(&erc20.symbol(), SYMBOL);\n assert_eq!(&erc20.name(), NAME);\n assert_eq!(erc20.decimals(), DECIMALS);\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n let mut erc20 = setup();\n let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n erc20.transfer(&recipient, &amount);\n\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n assert_eq!(erc20.balance_of(&recipient), amount);\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n let mut erc20 = setup();\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);\n\n test_env::assert_exception(Error::InsufficientBalance, || {\n erc20.transfer(&recipient, &amount)\n });\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let mut erc20 = setup();\n let (owner, recipient, spender) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount\n }\n );\n\n // Spender transfers tokens from Owner to Recipient.\n test_env::set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n );\n \n assert_events!(erc20, Approval, Transfer);\n }\n\n #[test]\n fn transfer_from_error() {\n let mut erc20 = setup();\n let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n test_env::set_caller(spender);\n test_env::assert_exception(Error::InsufficientAllowance, || {\n erc20.transfer_from(&owner, &spender, &amount)\n });\n }\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L111-123")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events!()")," macro accepts multiple events. You must pass them in the order they were emitted. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L125")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"You can not mix both approaches, you pass full events or types only.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"Having two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/8a2be6b7.cde9757a.js b/docs/assets/js/8a2be6b7.cde9757a.js new file mode 100644 index 000000000..1913ce527 --- /dev/null +++ b/docs/assets/js/8a2be6b7.cde9757a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[3816],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||o;return t?r.createElement(f,s(s({ref:n},u),{},{components:t})):r.createElement(f,s({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var d=2;d{t.d(n,{Z:()=>s});var r=t(67294),a=t(86010);const o="tabItem_Ymn6";function s(e){let{children:n,hidden:t,className:s}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(o,s),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>y});var r=t(87462),a=t(67294),o=t(86010),s=t(12466),l=t(16550),i=t(91980),d=t(67392),u=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(o),(0,a.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function v(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=c(e),[s,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[i,d]=f({queryString:t,groupId:r}),[p,v]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,u.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:o})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:s,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),v(e)}),[d,v,o]),tabValues:o}}var g=t(72389);const h="tabList__CuJ",k="tabItem_LNqP";function b(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:d}=e;const u=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),c=e=>{const n=e.currentTarget,t=u.indexOf(n),r=d[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;n=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;n=u[t]??u[u.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},n)},d.map((e=>{let{value:n,label:t,attributes:s}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>u.push(e),onKeyDown:m,onClick:c},s,{className:(0,o.Z)("tabs__item",k,s?.className,{"tabs__item--active":l===n})}),t??n)})))}function _(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function N(e){const n=v(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",h)},a.createElement(b,(0,r.Z)({},e,n)),a.createElement(_,(0,r.Z)({},e,n)))}function y(e){const n=(0,g.Z)();return a.createElement(N,(0,r.Z)({key:String(n)},e))}},83214:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),o=t(74866),s=t(85162);const l={sidebar_position:1,description:"Migration guide to v0.8.0"},i="Migration guide to v0.8.0",d={unversionedId:"migrations/to-0.8.0",id:"version-0.8.0/migrations/to-0.8.0",title:"Migration guide to v0.8.0",description:"Migration guide to v0.8.0",source:"@site/versioned_docs/version-0.8.0/migrations/to-0.8.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.8.0",permalink:"/docs/0.8.0/migrations/to-0.8.0",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Migration guide to v0.8.0"},sidebar:"tutorialSidebar",previous:{title:"Migrations",permalink:"/docs/0.8.0/category/migrations"}},u={},p=[{value:"1. Prerequisites",id:"1-prerequisites",level:2},{value:"1.1. Update cargo-odra",id:"11-update-cargo-odra",level:3},{value:"1.2. Review the Changelog",id:"12-review-the-changelog",level:3},{value:"2. Migration Steps",id:"2-migration-steps",level:2},{value:"2.1 Add bin directory",id:"21-add-bin-directory",level:3},{value:"2.2. Update Cargo.toml",id:"22-update-cargotoml",level:3},{value:"2.2. Update Odra.toml",id:"22-update-odratoml",level:3},{value:"2.3. Update Smart Contracts",id:"23-update-smart-contracts",level:3},{value:"2.3.1. Update the use statements to reflect the new module structure.",id:"231-update-the-use-statements-to-reflect-the-new-module-structure",level:4},{value:"2.3.2. Some type aliases are no longer in use.",id:"232-some-type-aliases-are-no-longer-in-use",level:4},{value:"2.3.3. Consider import odra::prelude::* in your module files.",id:"233-consider-import-odraprelude-in-your-module-files",level:4},{value:"2.3.4. Flatten nested Mappings.",id:"234-flatten-nested-mappings",level:4},{value:"2.3.5. Update errors definitions.",id:"235-update-errors-definitions",level:4},{value:"2.3.6. Update events definitions.",id:"236-update-events-definitions",level:4},{value:"2.3.7. Replace contract_env with self.env() in your modules.",id:"237-replace-contract_env-with-selfenv-in-your-modules",level:4},{value:"2.3.8. Wrap submodules of your module with odra::SubModule<T>.",id:"238-wrap-submodules-of-your-module-with-odrasubmodulet",level:4},{value:"2.3.9. Update external contract calls.",id:"239-update-external-contract-calls",level:4},{value:"2.3.10. Update constructors.",id:"2310-update-constructors",level:4},{value:"2.3.11. Update UnwrapOrRevert calls.",id:"2311-update-unwraporrevert-calls",level:4},{value:"2.3.12. Remove #[odra(using)] attribute from your module definition.",id:"2312-remove-odrausing-attribute-from-your-module-definition",level:4},{value:"2.4. Update Tests",id:"24-update-tests",level:3},{value:"2.4.1. Contract deployment.",id:"241-contract-deployment",level:4},{value:"2.4.2. Host interactions.",id:"242-host-interactions",level:4},{value:"2.4.3. Testing failing scenarios.",id:"243-testing-failing-scenarios",level:4},{value:"2.4.4. Testing events.",id:"244-testing-events",level:4},{value:"3. Code Examples",id:"3-code-examples",level:2},{value:"4. Troubleshooting",id:"4-troubleshooting",level:2},{value:"5. References",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v080"},"Migration guide to v0.8.0"),(0,a.kt)("p",null,"Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version."),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant changes in v0.8.0 include:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only."),(0,a.kt)("li",{parentName:"ul"},"Framework internals redesign.")),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.8.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-add-bin-directory"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Add bin directory")),(0,a.kt)("p",null,"Odra 0.8.0 introduces a new way to build smart contracts. The ",(0,a.kt)("inlineCode",{parentName:"p"},".builder_casper")," directory is no longer used. Instead, you should create a new directory called ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," in the root of your project and add the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files to the ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," directory."),(0,a.kt)("p",null,"You can find the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-cargotoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Cargo.toml")),(0,a.kt)("p",null,"There a bunch of changes in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"You don't have to specify the features anymore - remove the ",(0,a.kt)("inlineCode",{parentName:"li"},"features")," section and ",(0,a.kt)("inlineCode",{parentName:"li"},"default-features")," flag from the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra")," dependency."),(0,a.kt)("li",{parentName:"ul"},"Register bins you added in the previous step."),(0,a.kt)("li",{parentName:"ul"},"Add ",(0,a.kt)("inlineCode",{parentName:"li"},"dev-dependencies")," section with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra-test")," crate."),(0,a.kt)("li",{parentName:"ul"},"Add recommended profiles for ",(0,a.kt)("inlineCode",{parentName:"li"},"release")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," to optimize the build process.")),(0,a.kt)("p",null,"Below you can compare the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file after and before the migration to v0.8.0:"),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.7.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')))),(0,a.kt)("h3",{id:"22-update-odratoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Odra.toml")),(0,a.kt)("p",null,"Due to the changes in cargo-odra, the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file has been simplified. The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," property is no longer required."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "my_project::Flipper"\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "my_project::Flipper"\n')))),(0,a.kt)("h3",{id:"23-update-smart-contracts"},"2.3. ",(0,a.kt)("strong",{parentName:"h3"},"Update Smart Contracts")),(0,a.kt)("p",null,"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"231-update-the-use-statements-to-reflect-the-new-module-structure"},"2.3.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update the ",(0,a.kt)("inlineCode",{parentName:"strong"},"use")," statements to reflect the new module structure.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Big integer types are now located in the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types")," module."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::Address")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::Address"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Variable")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::contract_env"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::OdraType")," as it is no longer required."),(0,a.kt)("li",{parentName:"ul"},"Change ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::casper_types::*;")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::*;"),".")),(0,a.kt)("h4",{id:"232-some-type-aliases-are-no-longer-in-use"},"2.3.2. ",(0,a.kt)("strong",{parentName:"h4"},"Some type aliases are no longer in use.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Balance")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::U512"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BlockTime")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"EventData")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::bytesrepr::Bytes"),".")),(0,a.kt)("h4",{id:"233-consider-import-odraprelude-in-your-module-files"},"2.3.3. ",(0,a.kt)("strong",{parentName:"h4"},"Consider import ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::prelude::*")," in your module files.")),(0,a.kt)("h4",{id:"234-flatten-nested-mappings"},"2.3.4. ",(0,a.kt)("strong",{parentName:"h4"},"Flatten nested ",(0,a.kt)("inlineCode",{parentName:"strong"},"Mapping"),"s.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// Before\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping>\n}\n// After\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("h4",{id:"235-update-errors-definitions"},"2.3.5. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::execution_error;\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n}\n")))),(0,a.kt)("h4",{id:"236-update-events-definitions"},"2.3.6. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nself.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n});\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n}\n\n// Emitting the event\nuse odra::types::event::OdraEvent;\n\nTransfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n}.emit();\n")))),(0,a.kt)("h4",{id:"237-replace-contract_env-with-selfenv-in-your-modules"},"2.3.7. ",(0,a.kt)("strong",{parentName:"h4"},"Replace ",(0,a.kt)("inlineCode",{parentName:"strong"},"contract_env")," with ",(0,a.kt)("inlineCode",{parentName:"strong"},"self.env()")," in your modules.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"self.env()")," is a new way to access the contract environment, returns a reference to ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),". The API is similar to the previous ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env")," but with some changes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_var(key: &[u8]) -> Option")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn get_value(&self, key: &[u8]) -> Option"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_var(key: &[u8], value: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn set_value(&self, key: &[u8], value: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"set_dict_value()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_dict_value()")," has been removed. All the dictionary operations should be performed using ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," type, internally using ",(0,a.kt)("inlineCode",{parentName:"li"},"set_var()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_var()")," functions. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn hash>(input: T) -> Vec")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn hash(&self, value: T) -> [u8; 32]"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(error: E) -> !")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn revert>(&self, error: E) -> !"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(event: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event(&self, event: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option) -> T")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract(&self, address: Address, call: CallDef) -> T"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"native_token_metadata()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"one_token()")," have been removed.")),(0,a.kt)("h4",{id:"238-wrap-submodules-of-your-module-with-odrasubmodulet"},"2.3.8. ",(0,a.kt)("strong",{parentName:"h4"},"Wrap submodules of your module with ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::SubModule"),".")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: SubModule,\n metadata: SubModule,\n ownable: SubModule\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: Erc721Base,\n metadata: Erc721MetadataExtension,\n ownable: Ownable\n}\n")))),(0,a.kt)("h4",{id:"239-update-external-contract-calls"},"2.3.9. ",(0,a.kt)("strong",{parentName:"h4"},"Update external contract calls.")),(0,a.kt)("p",null,"However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref"),") and you can call it using ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env, address)")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref::at()"),")."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenContractRef::new(env, token).balance_of(account)\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenRef::at(token).balance_of(account)\n")))),(0,a.kt)("h4",{id:"2310-update-constructors"},"2.3.10. ",(0,a.kt)("strong",{parentName:"h4"},"Update constructors.")),(0,a.kt)("p",null,"Remove the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::init]")," attribute from the constructor and ensure that the constructor function is named ",(0,a.kt)("inlineCode",{parentName:"p"},"init"),"."),(0,a.kt)("h4",{id:"2311-update-unwraporrevert-calls"},"2.3.11. ",(0,a.kt)("strong",{parentName:"h4"},"Update ",(0,a.kt)("inlineCode",{parentName:"strong"},"UnwrapOrRevert")," calls.")),(0,a.kt)("p",null,"The functions ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," now require ",(0,a.kt)("inlineCode",{parentName:"p"},"&HostEnv")," as the first parameter."),(0,a.kt)("h4",{id:"2312-remove-odrausing-attribute-from-your-module-definition"},"2.3.12. ",(0,a.kt)("strong",{parentName:"h4"},"Remove ",(0,a.kt)("inlineCode",{parentName:"strong"},"#[odra(using)]")," attribute from your module definition.")),(0,a.kt)("p",null,"Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required."),(0,a.kt)("h3",{id:"24-update-tests"},"2.4. ",(0,a.kt)("strong",{parentName:"h3"},"Update Tests")),(0,a.kt)("p",null,"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"241-contract-deployment"},"2.4.1. ",(0,a.kt)("strong",{parentName:"h4"},"Contract deployment.")),(0,a.kt)("p",null,"The way you deploy a contract has changed:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef::deploy(&env, args)")," instead of ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}Deployer::init()"),". The ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef")," implements ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer"),"."),(0,a.kt)("li",{parentName:"ol"},"Instantiate the ",(0,a.kt)("inlineCode",{parentName:"li"},"HostEnv")," using ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),", required by the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract doesn't have init args, you should use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract has init args, you should pass the autogenerated ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableHostRef;\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\nlet env: HostEnv = odra_test::env();\nlet ownable = OwnableHostRef::deploy(&env, NoArgs)\n\n// A contract with init args\nuse super::{Erc20HostRef, Erc20InitArgs};\nuse odra::host::{Deployer, HostEnv};\n\nlet env: HostEnv = odra_test::env();\nlet init_args = Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n};\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableDeployer;\n\nlet ownable = OwnableDeployer::init();\n\n// A contract with init args\nlet erc20 = Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n);\n")))),(0,a.kt)("h4",{id:"242-host-interactions"},"2.4.2. ",(0,a.kt)("strong",{parentName:"h4"},"Host interactions.")),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Replace ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),"."),(0,a.kt)("li",{parentName:"ol"},"The API of ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()")," are similar, but there are some differences:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::advance_block_time_by(BlockTime)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.advance_block_time(u64)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::token_balance(Address)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.balance_of(&Address)"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_cost()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_used()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::total_gas_used(Address)"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::gas_report()")," have been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef::last_call()")," and extract the data from a ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::ContractCallResult")," instance. ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef")," is a trait implemented by ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef"),".")))),(0,a.kt)("h4",{id:"243-testing-failing-scenarios"},"2.4.3. ",(0,a.kt)("strong",{parentName:"h4"},"Testing failing scenarios.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"test_env::assert_exception()")," has been removed. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix to call the function and then assert the result.\n",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix is a new way to call a function that might fail. It returns a ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult"))," type, which you can then assert using the standard Rust ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n let (env, mut erc20) = setup();\n\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n assert_eq!(\n erc20.try_transfer_from(owner, recipient, amount),\n Err(Error::InsufficientAllowance.into())\n );\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n test_env::assert_exception(Error::InsufficientAllowance, || {\n let mut erc20 = setup();\n\n let (owner, spender, recipient) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let amount = 1_000.into();\n test_env::set_caller(spender);\n\n erc20.transfer_from(&owner, &recipient, &amount)\n });\n}\n")))),(0,a.kt)("h4",{id:"244-testing-events"},"2.4.4. ",(0,a.kt)("strong",{parentName:"h4"},"Testing events.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," macro has been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv::emitted_event()")," to assert the emitted events.\nThe new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation to explore the available options."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let env: HostEnv = odra_test::env();\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n\n...\n\nassert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n));\nassert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n));\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let erc20 = Erc20HostDeployer::init(&env, ...);\n\n...\n\nassert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n);\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.8.0."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var,\n symbol: Var,\n name: Var,\n total_supply: Var,\n balances: Mapping,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20HostRef, Erc20InitArgs\n };\n use odra::{\n casper_types::U256,\n host::{Deployer, HostEnv, HostRef},\n prelude::*\n };\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n // Other tests...\n}\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use odra::prelude::string::String;\nuse odra::{\n contract_env,\n types::{event::OdraEvent, Address, U256},\n Mapping, UnwrapOrRevert, Variable\n};\n\nuse self::{\n errors::Error,\n events::{Approval, Transfer}\n};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n\n#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: &Option\n ) {\n let caller = contract_env::caller();\n\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = *initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n }\n .emit();\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = contract_env::caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = contract_env::caller();\n\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn name(&self) -> String {\n self.name.get().unwrap_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n contract_env::revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n }\n .emit();\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n contract_env::revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n self.allowances\n .get_instance(owner)\n .subtract(spender, *amount);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\npub mod events {\n use odra::types::{casper_types::U256, Address};\n use odra::Event;\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::execution_error;\n\n execution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20Deployer, Erc20Ref\n };\n use odra::prelude::string::ToString;\n use odra::{assert_events, test_env, types::casper_types::U256};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let erc20 = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When transfer tokens to a recipient.\n let sender = test_env::get_account(0);\n let recipient = test_env::get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n test_env::assert_exception(Error::InsufficientBalance, || {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n erc20.transfer(&recipient, &amount)\n });\n }\n\n // Other tests...\n}\n')))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/8b0ca31f.addba81e.js b/docs/assets/js/8b0ca31f.addba81e.js new file mode 100644 index 000000000..75078018f --- /dev/null +++ b/docs/assets/js/8b0ca31f.addba81e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[88071],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="MockVM",c={unversionedId:"backends/mock-vm",id:"version-0.5.0/backends/mock-vm",title:"MockVM",description:"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.5.0/backends/02-mock-vm.md",sourceDirName:"backends",slug:"/backends/mock-vm",permalink:"/docs/0.5.0/backends/mock-vm",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.5.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.5.0/backends/casper"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mockvm"},"MockVM"),(0,a.kt)("p",null,"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The MockVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"MockVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is just a list of contracts deployed onto the MockVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),".\nEach time we call the contract, we call its instance stored in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the MockVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe MockVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the MockVM.\nThanks to this and the fact that we do not need the blockchain itself,\nMockVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the MockVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a Contract Container.\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, MockVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(MockVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/8e991cde.9d41f266.js b/docs/assets/js/8e991cde.9d41f266.js new file mode 100644 index 000000000..4d4f498f8 --- /dev/null +++ b/docs/assets/js/8e991cde.9d41f266.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[47287],{14737:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.2.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.2.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.2.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/8f162cb9.73caf660.js b/docs/assets/js/8f162cb9.73caf660.js new file mode 100644 index 000000000..2b88c9531 --- /dev/null +++ b/docs/assets/js/8f162cb9.73caf660.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[86221],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.2.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.2.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.2.0/basics/native-token",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"defaultSidebar",previous:{title:"Modules",permalink:"/docs/0.2.0/basics/modules"},next:{title:"Backends",permalink:"/docs/0.2.0/category/backends"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"native-token"},"Native token"),(0,r.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::contract_env;\n\n#[odra::module]\npub struct PublicWallet {\n}\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {\n }\n\n pub fn withdraw(&mut self, amount: Balance) {\n contract_env::transfer_tokens(contract_env::caller(), amount);\n }\n}\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,r.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/tlw.rs")," in the odra main repository.")),(0,r.kt)("p",null,"You can see a new macro used here: ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from contract_env - ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_tokens"),".\nIt does exactly what you are expecting it to do - it will transfer native tokens from the contract to the\nspecified address."),(0,r.kt)("p",null,"We are also using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Balance")," - an Odra type that wraps around the type that the underlying blockchain uses\nfor counting tokens."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,r.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a function -\n",(0,r.kt)("inlineCode",{parentName:"p"},"token_balance"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::test_env;\nuse super::PublicWalletDeployer;\n\n#[test]\nfn test_modules() {\n let mut my_contract = PublicWalletDeployer::default();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());\n\n my_contract.with_tokens(Balance::from(100)).deposit();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));\n\n my_contract.withdraw(Balance::from(25));\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9005cef3.eab22a5a.js b/docs/assets/js/9005cef3.eab22a5a.js new file mode 100644 index 000000000..1e421619f --- /dev/null +++ b/docs/assets/js/9005cef3.eab22a5a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[35973],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),p=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=r,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(f,s(s({ref:n},c),{},{components:t})):a.createElement(f,s({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,s=new Array(o);s[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:3},s="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.6.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.6.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.6.0/tutorials/erc20",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.6.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.6.0/tutorials/owned-token"}},i={},p=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"erc-20"},"ERC-20"),(0,r.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,r.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value. "),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"advanced storage - key-value pairs, "),(0,r.kt)("li",{parentName:"ul"},"Odra types like ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),", "),(0,r.kt)("li",{parentName:"ul"},"advanced events assertion.")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Our module has a pretty complex storage layout in comparison to the previous example."),(0,r.kt)("p",null,"We need to store the following data:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol and decimals."),(0,r.kt)("li",{parentName:"ol"},"Total supply."),(0,r.kt)("li",{parentName:"ol"},"Users' balances."),(0,r.kt)("li",{parentName:"ol"},"Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.")),(0,r.kt)("h2",{id:"module-definition"},"Module definition"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Variable,\n symbol: Variable,\n name: Variable,\n total_supply: Variable,\n balances: Mapping,\n allowances: Mapping>\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,r.kt)("inlineCode",{parentName:"li"},"mapping"),". You may notice the ",(0,r.kt)("inlineCode",{parentName:"li"},"balances")," property maps ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," to ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),". If you deal with addresses or you operate on tokens, you should always choose ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," over ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Odra allows nested ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),"s, what we utilize to store allowances.")),(0,r.kt)("h3",{id:"metadata"},"Metadata"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.balances.add(address, *amount);\n self.total_supply.add(amount);\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option
,\n pub to: Option
,\n pub amount: Balance\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3-L10")," - A constructor sets the token metadata and mints the initial supply."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12-L14")," - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," example, we used the ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returning an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),". If the type implements ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function and the contract does not fail even if the value is not initialized."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29")," - The second ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," is not an odra module, in other words these function will not be a part of contract's ABI."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30-L39")," - Mint function is public, so like in a regular rust code will be accessible from the outside. ",(0,r.kt)("inlineCode",{parentName:"li"},"mint()")," use notation ",(0,r.kt)("inlineCode",{parentName:"li"},"self.balances.add(&address, amount);"),", which it is syntactic sugar for:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let current_balance = self.balances.get(&address).unwrap_or_default();\nlet new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();\nself.balances.set(&address, new_balance);\n")),(0,r.kt)("h3",{id:"core"},"Core"),(0,r.kt)("p",null,"For the sake of completeness, let's implement the remaining functionalities like ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_from"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"approve"),". They are not introducing any new concepts, so we leave them without additional remarks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs",title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let spender = contract_env::caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n let owner = contract_env::caller();\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n contract_env::revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .get_instance(owner)\n .set(spender, new_allowance);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,r.kt)("p",null,"Now, compare the code we have written, with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};\n use odra::{assert_events, test_env, types::U256};\n\n pub const NAME: &str = "Plascoin";\n pub const SYMBOL: &str = "PLS";\n pub const DECIMALS: u8 = 10;\n pub const INITIAL_SUPPLY: u32 = 10_000;\n\n pub fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n String::from(NAME),\n String::from(SYMBOL),\n DECIMALS,\n INITIAL_SUPPLY.into()\n )\n }\n\n #[test]\n fn initialization() {\n let erc20 = setup();\n\n assert_eq!(&erc20.symbol(), SYMBOL);\n assert_eq!(&erc20.name(), NAME);\n assert_eq!(erc20.decimals(), DECIMALS);\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n let mut erc20 = setup();\n let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n erc20.transfer(&recipient, &amount);\n\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n assert_eq!(erc20.balance_of(&recipient), amount);\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n let mut erc20 = setup();\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);\n\n test_env::assert_exception(Error::InsufficientBalance, || {\n erc20.transfer(&recipient, &amount)\n });\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let mut erc20 = setup();\n let (owner, recipient, spender) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount\n }\n );\n\n // Spender transfers tokens from Owner to Recipient.\n test_env::set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n );\n \n assert_events!(erc20, Approval, Transfer);\n }\n\n #[test]\n fn transfer_from_error() {\n let mut erc20 = setup();\n let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n test_env::set_caller(spender);\n test_env::assert_exception(Error::InsufficientAllowance, || {\n erc20.transfer_from(&owner, &spender, &amount)\n });\n }\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L111-123")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events!()")," macro accepts multiple events. You must pass them in the order they were emitted. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L125")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"You can not mix both approaches, you pass full events or types only.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"Having two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/90239.4728e4d9.js b/docs/assets/js/90239.4728e4d9.js new file mode 100644 index 000000000..b165b530d --- /dev/null +++ b/docs/assets/js/90239.4728e4d9.js @@ -0,0 +1,2 @@ +/*! For license information please see 90239.4728e4d9.js.LICENSE.txt */ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90239],{17967:(t,e)=>{"use strict";e.N=void 0;var n=/^([^\w]*)(javascript|data|vbscript)/im,r=/&#(\w+)(^\w|;)?/g,i=/&(newline|tab);/gi,a=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,s=/^.+(:|:)/gim,o=[".","/"];e.N=function(t){var e,l=(e=t||"",e.replace(r,(function(t,e){return String.fromCharCode(e)}))).replace(i,"").replace(a,"").trim();if(!l)return"about:blank";if(function(t){return o.indexOf(t[0])>-1}(l))return l;var c=l.match(s);if(!c)return l;var u=c[0];return n.test(u)?"about:blank":l}},3905:(t,e,n)=>{"use strict";n.d(e,{Zo:()=>u,kt:()=>m});var r=n(67294);function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function s(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var l=r.createContext({}),c=function(t){var e=r.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},u=function(t){var e=c(t.components);return r.createElement(l.Provider,{value:e},t.children)},d={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},h=r.forwardRef((function(t,e){var n=t.components,i=t.mdxType,a=t.originalType,l=t.parentName,u=o(t,["components","mdxType","originalType","parentName"]),h=c(n),m=i,_=h["".concat(l,".").concat(m)]||h[m]||d[m]||a;return n?r.createElement(_,s(s({ref:e},u),{},{components:n})):r.createElement(_,s({ref:e},u))}));function m(t,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var a=n.length,s=new Array(a);s[0]=h;var o={};for(var l in e)hasOwnProperty.call(e,l)&&(o[l]=e[l]);o.originalType=t,o.mdxType="string"==typeof t?t:i,s[1]=o;for(var c=2;c{"use strict";n.d(e,{Z:()=>u});var r=n(67294),i=n(95999),a=n(35281),s=n(87462),o=n(86010);const l="iconEdit_Z9Sw";function c(t){let{className:e,...n}=t;return r.createElement("svg",(0,s.Z)({fill:"currentColor",height:"20",width:"20",viewBox:"0 0 40 40",className:(0,o.Z)(l,e),"aria-hidden":"true"},n),r.createElement("g",null,r.createElement("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"})))}function u(t){let{editUrl:e}=t;return r.createElement("a",{href:e,target:"_blank",rel:"noreferrer noopener",className:a.k.common.editThisPage},r.createElement(c,null),r.createElement(i.Z,{id:"theme.common.editThisPage",description:"The link label to edit the current page"},"Edit this page"))}},92503:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(87462),i=n(67294),a=n(86010),s=n(95999),o=n(86668),l=n(39960);const c="anchorWithStickyNavbar_LWe7",u="anchorWithHideOnScrollNavbar_WYt5";function d(t){let{as:e,id:n,...d}=t;const{navbar:{hideOnScroll:h}}=(0,o.L)();if("h1"===e||!n)return i.createElement(e,(0,r.Z)({},d,{id:void 0}));const m=(0,s.I)({id:"theme.common.headingLinkTitle",message:"Direct link to {heading}",description:"Title for link to heading"},{heading:"string"==typeof d.children?d.children:n});return i.createElement(e,(0,r.Z)({},d,{className:(0,a.Z)("anchor",h?u:c,d.className),id:n}),d.children,i.createElement(l.Z,{className:"hash-link",to:`#${n}`,"aria-label":m,title:m},"\u200b"))}},88905:(t,e,n)=>{"use strict";n.d(e,{Z:()=>xt});var r=n(67294),i=n(3905),a=n(87462),s=n(35742);var o=n(72389),l=n(86010),c=n(92949),u=n(86668);function d(){const{prism:t}=(0,u.L)(),{colorMode:e}=(0,c.I)(),n=t.theme,r=t.darkTheme||n;return"dark"===e?r:n}var h=n(35281),m=n(87594),_=n.n(m);const p=/title=(?["'])(?.*?)\1/,f=/\{(?<range>[\d,-]+)\}/,y={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}};function g(t,e){const n=t.map((t=>{const{start:n,end:r}=y[t];return`(?:${n}\\s*(${e.flatMap((t=>[t.line,t.block?.start,t.block?.end].filter(Boolean))).join("|")})\\s*${r})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function b(t,e){let n=t.replace(/\n$/,"");const{language:r,magicComments:i,metastring:a}=e;if(a&&f.test(a)){const t=a.match(f).groups.range;if(0===i.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${a}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const e=i[0].className,r=_()(t).filter((t=>t>0)).map((t=>[t-1,[e]]));return{lineClassNames:Object.fromEntries(r),code:n}}if(void 0===r)return{lineClassNames:{},code:n};const s=function(t,e){switch(t){case"js":case"javascript":case"ts":case"typescript":return g(["js","jsBlock"],e);case"jsx":case"tsx":return g(["js","jsBlock","jsx"],e);case"html":return g(["js","jsBlock","html"],e);case"python":case"py":case"bash":return g(["bash"],e);case"markdown":case"md":return g(["html","jsx","bash"],e);default:return g(Object.keys(y),e)}}(r,i),o=n.split("\n"),l=Object.fromEntries(i.map((t=>[t.className,{start:0,range:""}]))),c=Object.fromEntries(i.filter((t=>t.line)).map((t=>{let{className:e,line:n}=t;return[n,e]}))),u=Object.fromEntries(i.filter((t=>t.block)).map((t=>{let{className:e,block:n}=t;return[n.start,e]}))),d=Object.fromEntries(i.filter((t=>t.block)).map((t=>{let{className:e,block:n}=t;return[n.end,e]})));for(let m=0;m<o.length;){const t=o[m].match(s);if(!t){m+=1;continue}const e=t.slice(1).find((t=>void 0!==t));c[e]?l[c[e]].range+=`${m},`:u[e]?l[u[e]].start=m:d[e]&&(l[d[e]].range+=`${l[d[e]].start}-${m-1},`),o.splice(m,1)}n=o.join("\n");const h={};return Object.entries(l).forEach((t=>{let[e,{range:n}]=t;_()(n).forEach((t=>{h[t]??=[],h[t].push(e)}))})),{lineClassNames:h,code:n}}const k="codeBlockContainer_Ckt0";function v(t){let{as:e,...n}=t;const i=function(t){const e={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(t.plain).forEach((t=>{let[r,i]=t;const a=e[r];a&&"string"==typeof i&&(n[a]=i)})),n}(d());return r.createElement(e,(0,a.Z)({},n,{style:i,className:(0,l.Z)(n.className,k,h.k.common.codeBlock)}))}const x={codeBlockContent:"codeBlockContent_biex",codeBlockTitle:"codeBlockTitle_Ktv7",codeBlock:"codeBlock_bY9V",codeBlockStandalone:"codeBlockStandalone_MEMb",codeBlockLines:"codeBlockLines_e6Vv",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_o6Pm",buttonGroup:"buttonGroup__atx"};function M(t){let{children:e,className:n}=t;return r.createElement(v,{as:"pre",tabIndex:0,className:(0,l.Z)(x.codeBlockStandalone,"thin-scrollbar",n)},r.createElement("code",{className:x.codeBlockLines},e))}var L=n(902);const w={attributes:!0,characterData:!0,childList:!0,subtree:!0};function T(t,e){const[n,i]=(0,r.useState)(),a=(0,r.useCallback)((()=>{i(t.current?.closest("[role=tabpanel][hidden]"))}),[t,i]);(0,r.useEffect)((()=>{a()}),[a]),function(t,e,n){void 0===n&&(n=w);const i=(0,L.zX)(e),a=(0,L.Ql)(n);(0,r.useEffect)((()=>{const e=new MutationObserver(i);return t&&e.observe(t,a),()=>e.disconnect()}),[t,i,a])}(n,(t=>{t.forEach((t=>{"attributes"===t.type&&"hidden"===t.attributeName&&(e(),a())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}const S={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]};var D={Prism:n(87410).Z,theme:S};function Y(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function E(){return E=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},E.apply(this,arguments)}var C=/\r\n|\r|\n/,A=function(t){0===t.length?t.push({types:["plain"],content:"\n",empty:!0}):1===t.length&&""===t[0].content&&(t[0].content="\n",t[0].empty=!0)},O=function(t,e){var n=t.length;return n>0&&t[n-1]===e?t:t.concat(e)},N=function(t,e){var n=t.plain,r=Object.create(null),i=t.styles.reduce((function(t,n){var r=n.languages,i=n.style;return r&&!r.includes(e)||n.types.forEach((function(e){var n=E({},t[e],i);t[e]=n})),t}),r);return i.root=n,i.plain=E({},n,{backgroundColor:null}),i};function B(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&-1===e.indexOf(r)&&(n[r]=t[r]);return n}const F=function(t){function e(){for(var e=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];t.apply(this,n),Y(this,"getThemeDict",(function(t){if(void 0!==e.themeDict&&t.theme===e.prevTheme&&t.language===e.prevLanguage)return e.themeDict;e.prevTheme=t.theme,e.prevLanguage=t.language;var n=t.theme?N(t.theme,t.language):void 0;return e.themeDict=n})),Y(this,"getLineProps",(function(t){var n=t.key,r=t.className,i=t.style,a=E({},B(t,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),s=e.getThemeDict(e.props);return void 0!==s&&(a.style=s.plain),void 0!==i&&(a.style=void 0!==a.style?E({},a.style,i):i),void 0!==n&&(a.key=n),r&&(a.className+=" "+r),a})),Y(this,"getStyleForToken",(function(t){var n=t.types,r=t.empty,i=n.length,a=e.getThemeDict(e.props);if(void 0!==a){if(1===i&&"plain"===n[0])return r?{display:"inline-block"}:void 0;if(1===i&&!r)return a[n[0]];var s=r?{display:"inline-block"}:{},o=n.map((function(t){return a[t]}));return Object.assign.apply(Object,[s].concat(o))}})),Y(this,"getTokenProps",(function(t){var n=t.key,r=t.className,i=t.style,a=t.token,s=E({},B(t,["key","className","style","token"]),{className:"token "+a.types.join(" "),children:a.content,style:e.getStyleForToken(a),key:void 0});return void 0!==i&&(s.style=void 0!==s.style?E({},s.style,i):i),void 0!==n&&(s.key=n),r&&(s.className+=" "+r),s})),Y(this,"tokenize",(function(t,e,n,r){var i={code:e,grammar:n,language:r,tokens:[]};t.hooks.run("before-tokenize",i);var a=i.tokens=t.tokenize(i.code,i.grammar,i.language);return t.hooks.run("after-tokenize",i),a}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.render=function(){var t=this.props,e=t.Prism,n=t.language,r=t.code,i=t.children,a=this.getThemeDict(this.props),s=e.languages[n];return i({tokens:function(t){for(var e=[[]],n=[t],r=[0],i=[t.length],a=0,s=0,o=[],l=[o];s>-1;){for(;(a=r[s]++)<i[s];){var c=void 0,u=e[s],d=n[s][a];if("string"==typeof d?(u=s>0?u:["plain"],c=d):(u=O(u,d.type),d.alias&&(u=O(u,d.alias)),c=d.content),"string"==typeof c){var h=c.split(C),m=h.length;o.push({types:u,content:h[0]});for(var _=1;_<m;_++)A(o),l.push(o=[]),o.push({types:u,content:h[_]})}else s++,e.push(u),n.push(c),r.push(0),i.push(c.length)}s--,e.pop(),n.pop(),r.pop(),i.pop()}return A(o),l}(void 0!==s?this.tokenize(e,r,s,n):[r]),className:"prism-code language-"+n,style:void 0!==a?a.root:{},getLineProps:this.getLineProps,getTokenProps:this.getTokenProps})},e}(r.Component),I="codeLine_lJS_",P="codeLineNumber_Tfdd",j="codeLineContent_feaV";function R(t){let{line:e,classNames:n,showLineNumbers:i,getLineProps:s,getTokenProps:o}=t;1===e.length&&"\n"===e[0].content&&(e[0].content="");const c=s({line:e,className:(0,l.Z)(n,i&&I)}),u=e.map(((t,e)=>r.createElement("span",(0,a.Z)({key:e},o({token:t,key:e})))));return r.createElement("span",c,i?r.createElement(r.Fragment,null,r.createElement("span",{className:P}),r.createElement("span",{className:j},u)):u,r.createElement("br",null))}var H=n(95999);const $={copyButtonCopied:"copyButtonCopied_obH4",copyButtonIcons:"copyButtonIcons_eSgA",copyButtonIcon:"copyButtonIcon_y97N",copyButtonSuccessIcon:"copyButtonSuccessIcon_LjdS"};function Z(t){let{code:e,className:n}=t;const[i,a]=(0,r.useState)(!1),s=(0,r.useRef)(void 0),o=(0,r.useCallback)((()=>{!function(t,e){let{target:n=document.body}=void 0===e?{}:e;const r=document.createElement("textarea"),i=document.activeElement;r.value=t,r.setAttribute("readonly",""),r.style.contain="strict",r.style.position="absolute",r.style.left="-9999px",r.style.fontSize="12pt";const a=document.getSelection();let s=!1;a.rangeCount>0&&(s=a.getRangeAt(0)),n.append(r),r.select(),r.selectionStart=0,r.selectionEnd=t.length;let o=!1;try{o=document.execCommand("copy")}catch{}r.remove(),s&&(a.removeAllRanges(),a.addRange(s)),i&&i.focus()}(e),a(!0),s.current=window.setTimeout((()=>{a(!1)}),1e3)}),[e]);return(0,r.useEffect)((()=>()=>window.clearTimeout(s.current)),[]),r.createElement("button",{type:"button","aria-label":i?(0,H.I)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,H.I)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,H.I)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,l.Z)("clean-btn",n,$.copyButton,i&&$.copyButtonCopied),onClick:o},r.createElement("span",{className:$.copyButtonIcons,"aria-hidden":"true"},r.createElement("svg",{className:$.copyButtonIcon,viewBox:"0 0 24 24"},r.createElement("path",{d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})),r.createElement("svg",{className:$.copyButtonSuccessIcon,viewBox:"0 0 24 24"},r.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))))}const W="wordWrapButtonIcon_Bwma",z="wordWrapButtonEnabled_EoeP";function U(t){let{className:e,onClick:n,isEnabled:i}=t;const a=(0,H.I)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return r.createElement("button",{type:"button",onClick:n,className:(0,l.Z)("clean-btn",e,i&&z),"aria-label":a,title:a},r.createElement("svg",{className:W,viewBox:"0 0 24 24","aria-hidden":"true"},r.createElement("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})))}function q(t){let{children:e,className:n="",metastring:i,title:s,showLineNumbers:o,language:c}=t;const{prism:{defaultLanguage:h,magicComments:m}}=(0,u.L)(),_=c??n.split(" ").find((t=>t.startsWith("language-")))?.replace(/language-/,"")??h;const f=d(),y=function(){const[t,e]=(0,r.useState)(!1),[n,i]=(0,r.useState)(!1),a=(0,r.useRef)(null),s=(0,r.useCallback)((()=>{const n=a.current.querySelector("code");t?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),e((t=>!t))}),[a,t]),o=(0,r.useCallback)((()=>{const{scrollWidth:t,clientWidth:e}=a.current,n=t>e||a.current.querySelector("code").hasAttribute("style");i(n)}),[a]);return T(a,o),(0,r.useEffect)((()=>{o()}),[t,o]),(0,r.useEffect)((()=>(window.addEventListener("resize",o,{passive:!0}),()=>{window.removeEventListener("resize",o)})),[o]),{codeBlockRef:a,isEnabled:t,isCodeScrollable:n,toggle:s}}(),g=function(t){return t?.match(p)?.groups.title??""}(i)||s,{lineClassNames:k,code:M}=b(e,{metastring:i,language:_,magicComments:m}),L=o??function(t){return Boolean(t?.includes("showLineNumbers"))}(i);return r.createElement(v,{as:"div",className:(0,l.Z)(n,_&&!n.includes(`language-${_}`)&&`language-${_}`)},g&&r.createElement("div",{className:x.codeBlockTitle},g),r.createElement("div",{className:x.codeBlockContent},r.createElement(F,(0,a.Z)({},D,{theme:f,code:M,language:_??"text"}),(t=>{let{className:e,tokens:n,getLineProps:i,getTokenProps:a}=t;return r.createElement("pre",{tabIndex:0,ref:y.codeBlockRef,className:(0,l.Z)(e,x.codeBlock,"thin-scrollbar")},r.createElement("code",{className:(0,l.Z)(x.codeBlockLines,L&&x.codeBlockLinesWithNumbering)},n.map(((t,e)=>r.createElement(R,{key:e,line:t,getLineProps:i,getTokenProps:a,classNames:k[e],showLineNumbers:L})))))})),r.createElement("div",{className:x.buttonGroup},(y.isEnabled||y.isCodeScrollable)&&r.createElement(U,{className:x.codeButton,onClick:()=>y.toggle(),isEnabled:y.isEnabled}),r.createElement(Z,{className:x.codeButton,code:M}))))}function V(t){let{children:e,...n}=t;const i=(0,o.Z)(),s=function(t){return r.Children.toArray(t).some((t=>(0,r.isValidElement)(t)))?t:Array.isArray(t)?t.join(""):t}(e),l="string"==typeof s?q:M;return r.createElement(l,(0,a.Z)({key:String(i)},n),s)}var G=n(39960);var J=n(86043);const X="details_lb9f",K="isBrowser_bmU9",Q="collapsibleContent_i85q";function tt(t){return!!t&&("SUMMARY"===t.tagName||tt(t.parentElement))}function et(t,e){return!!t&&(t===e||et(t.parentElement,e))}function nt(t){let{summary:e,children:n,...i}=t;const s=(0,o.Z)(),c=(0,r.useRef)(null),{collapsed:u,setCollapsed:d}=(0,J.u)({initialState:!i.open}),[h,m]=(0,r.useState)(i.open);return r.createElement("details",(0,a.Z)({},i,{ref:c,open:h,"data-collapsed":u,className:(0,l.Z)(X,s&&K,i.className),onMouseDown:t=>{tt(t.target)&&t.detail>1&&t.preventDefault()},onClick:t=>{t.stopPropagation();const e=t.target;tt(e)&&et(e,c.current)&&(t.preventDefault(),u?(d(!1),m(!0)):d(!0))}}),e??r.createElement("summary",null,"Details"),r.createElement(J.z,{lazy:!1,collapsed:u,disableSSRStyle:!0,onCollapseTransitionEnd:t=>{d(t),m(!t)}},r.createElement("div",{className:Q},n)))}const rt="details_b_Ee";function it(t){let{...e}=t;return r.createElement(nt,(0,a.Z)({},e,{className:(0,l.Z)("alert alert--info",rt,e.className)}))}var at=n(92503);function st(t){return r.createElement(at.Z,t)}const ot="containsTaskList_mC6p";const lt="img_ev3q";const ct="admonition_LlT9",ut="admonitionHeading_tbUL",dt="admonitionIcon_kALy",ht="admonitionContent_S0QG";const mt={note:{infimaClassName:"secondary",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"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"}))},label:r.createElement(H.Z,{id:"theme.admonition.note",description:"The default label used for the Note admonition (:::note)"},"note")},tip:{infimaClassName:"success",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))},label:r.createElement(H.Z,{id:"theme.admonition.tip",description:"The default label used for the Tip admonition (:::tip)"},"tip")},danger:{infimaClassName:"danger",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"}))},label:r.createElement(H.Z,{id:"theme.admonition.danger",description:"The default label used for the Danger admonition (:::danger)"},"danger")},info:{infimaClassName:"info",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))},label:r.createElement(H.Z,{id:"theme.admonition.info",description:"The default label used for the Info admonition (:::info)"},"info")},caution:{infimaClassName:"warning",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 16 16"},r.createElement("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))},label:r.createElement(H.Z,{id:"theme.admonition.caution",description:"The default label used for the Caution admonition (:::caution)"},"caution")}},_t={secondary:"note",important:"info",success:"tip",warning:"danger"};function pt(t){const{mdxAdmonitionTitle:e,rest:n}=function(t){const e=r.Children.toArray(t),n=e.find((t=>r.isValidElement(t)&&"mdxAdmonitionTitle"===t.props?.mdxType)),i=r.createElement(r.Fragment,null,e.filter((t=>t!==n)));return{mdxAdmonitionTitle:n,rest:i}}(t.children);return{...t,title:t.title??e,children:n}}function ft(t){let{children:e,fallback:n}=t;return(0,o.Z)()?r.createElement(r.Fragment,null,e?.()):n??null}var yt=n(74737);function gt(){const{colorMode:t}=(0,c.I)(),e=(0,u.L)().mermaid,n=e.theme[t],{options:i}=e;return(0,r.useMemo)((()=>({startOnLoad:!1,...i,theme:n})),[n,i])}const bt="container_lyt7";function kt(t){let{value:e}=t;const n=function(t,e){const n=gt(),i=e??n;return(0,r.useMemo)((()=>{yt.o.mermaidAPI.initialize(i);const e=`mermaid-svg-${Math.round(1e7*Math.random())}`;return yt.o.render(e,t)}),[t,i])}(e);return r.createElement("div",{className:`docusaurus-mermaid-container ${bt}`,dangerouslySetInnerHTML:{__html:n}})}const vt={head:function(t){const e=r.Children.map(t.children,(t=>r.isValidElement(t)?function(t){if(t.props?.mdxType&&t.props.originalType){const{mdxType:e,originalType:n,...i}=t.props;return r.createElement(t.props.originalType,i)}return t}(t):t));return r.createElement(s.Z,t,e)},code:function(t){const e=["a","abbr","b","br","button","cite","code","del","dfn","em","i","img","input","ins","kbd","label","object","output","q","ruby","s","small","span","strong","sub","sup","time","u","var","wbr"];return r.Children.toArray(t.children).every((t=>"string"==typeof t&&!t.includes("\n")||(0,r.isValidElement)(t)&&e.includes(t.props?.mdxType)))?r.createElement("code",t):r.createElement(V,t)},a:function(t){return r.createElement(G.Z,t)},pre:function(t){return r.createElement(V,(0,r.isValidElement)(t.children)&&"code"===t.children.props?.originalType?t.children.props:{...t})},details:function(t){const e=r.Children.toArray(t.children),n=e.find((t=>r.isValidElement(t)&&"summary"===t.props?.mdxType)),i=r.createElement(r.Fragment,null,e.filter((t=>t!==n)));return r.createElement(it,(0,a.Z)({},t,{summary:n}),i)},ul:function(t){return r.createElement("ul",(0,a.Z)({},t,{className:(e=t.className,(0,l.Z)(e,e?.includes("contains-task-list")&&ot))}));var e},img:function(t){return r.createElement("img",(0,a.Z)({loading:"lazy"},t,{className:(e=t.className,(0,l.Z)(e,lt))}));var e},h1:t=>r.createElement(st,(0,a.Z)({as:"h1"},t)),h2:t=>r.createElement(st,(0,a.Z)({as:"h2"},t)),h3:t=>r.createElement(st,(0,a.Z)({as:"h3"},t)),h4:t=>r.createElement(st,(0,a.Z)({as:"h4"},t)),h5:t=>r.createElement(st,(0,a.Z)({as:"h5"},t)),h6:t=>r.createElement(st,(0,a.Z)({as:"h6"},t)),admonition:function(t){const{children:e,type:n,title:i,icon:a}=pt(t),s=function(t){const e=_t[t]??t;return mt[e]||(console.warn(`No admonition config found for admonition type "${e}". Using Info as fallback.`),mt.info)}(n),o=i??s.label,{iconComponent:c}=s,u=a??r.createElement(c,null);return r.createElement("div",{className:(0,l.Z)(h.k.common.admonition,h.k.common.admonitionType(t.type),"alert",`alert--${s.infimaClassName}`,ct)},r.createElement("div",{className:ut},r.createElement("span",{className:dt},u),o),r.createElement("div",{className:ht},e))},mermaid:function(t){return r.createElement(ft,null,(()=>r.createElement(kt,t)))}};function xt(t){let{children:e}=t;return r.createElement(i.Zo,{components:vt},e)}},32244:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(67294),i=n(86010),a=n(39960);function s(t){const{permalink:e,title:n,subLabel:s,isNext:o}=t;return r.createElement(a.Z,{className:(0,i.Z)("pagination-nav__link",o?"pagination-nav__link--next":"pagination-nav__link--prev"),to:e},s&&r.createElement("div",{className:"pagination-nav__sublabel"},s),r.createElement("div",{className:"pagination-nav__label"},n))}},86233:(t,e,n)=>{"use strict";n.d(e,{Z:()=>m});var r=n(67294),i=n(86010),a=n(95999),s=n(39960);const o="tag_zVej",l="tagRegular_sFm0",c="tagWithCount_h2kH";function u(t){let{permalink:e,label:n,count:a}=t;return r.createElement(s.Z,{href:e,className:(0,i.Z)(o,a?c:l)},n,a&&r.createElement("span",null,a))}const d="tags_jXut",h="tag_QGVx";function m(t){let{tags:e}=t;return r.createElement(r.Fragment,null,r.createElement("b",null,r.createElement(a.Z,{id:"theme.tags.tagsListLabel",description:"The label alongside a tag list"},"Tags:")),r.createElement("ul",{className:(0,i.Z)(d,"padding--none","margin-left--sm")},e.map((t=>{let{label:e,permalink:n}=t;return r.createElement("li",{key:n,className:h},r.createElement(u,{label:e,permalink:n}))}))))}},27856:function(t){t.exports=function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,n){return e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(t,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function r(t,i,a){return r=n()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var a=new(Function.bind.apply(t,i));return r&&e(a,r.prototype),a},r.apply(null,arguments)}function i(t){return a(t)||s(t)||o(t)||c()}function a(t){if(Array.isArray(t))return l(t)}function s(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function o(t,e){if(t){if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u=Object.hasOwnProperty,d=Object.setPrototypeOf,h=Object.isFrozen,m=Object.getPrototypeOf,_=Object.getOwnPropertyDescriptor,p=Object.freeze,f=Object.seal,y=Object.create,g="undefined"!=typeof Reflect&&Reflect,b=g.apply,k=g.construct;b||(b=function(t,e,n){return t.apply(e,n)}),p||(p=function(t){return t}),f||(f=function(t){return t}),k||(k=function(t,e){return r(t,i(e))});var v=A(Array.prototype.forEach),x=A(Array.prototype.pop),M=A(Array.prototype.push),L=A(String.prototype.toLowerCase),w=A(String.prototype.toString),T=A(String.prototype.match),S=A(String.prototype.replace),D=A(String.prototype.indexOf),Y=A(String.prototype.trim),E=A(RegExp.prototype.test),C=O(TypeError);function A(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return b(t,e,r)}}function O(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return k(t,n)}}function N(t,e,n){n=n||L,d&&d(t,null);for(var r=e.length;r--;){var i=e[r];if("string"==typeof i){var a=n(i);a!==i&&(h(e)||(e[r]=a),i=a)}t[i]=!0}return t}function B(t){var e,n=y(null);for(e in t)!0===b(u,t,[e])&&(n[e]=t[e]);return n}function F(t,e){for(;null!==t;){var n=_(t,e);if(n){if(n.get)return A(n.get);if("function"==typeof n.value)return A(n.value)}t=m(t)}function r(t){return console.warn("fallback value for",t),null}return r}var I=p(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),P=p(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j=p(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),R=p(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),H=p(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),$=p(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Z=p(["#text"]),W=p(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),z=p(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),U=p(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=p(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V=f(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=f(/<%[\w\W]*|[\w\W]*%>/gm),J=f(/\${[\w\W]*}/gm),X=f(/^data-[\-\w.\u00B7-\uFFFF]/),K=f(/^aria-[\-\w]+$/),Q=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tt=f(/^(?:\w+script|data):/i),et=f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nt=f(/^html$/i),rt=function(){return"undefined"==typeof window?null:window},it=function(e,n){if("object"!==t(e)||"function"!=typeof e.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var a="dompurify"+(r?"#"+r:"");try{return e.createPolicy(a,{createHTML:function(t){return t},createScriptURL:function(t){return t}})}catch(s){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function at(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt(),n=function(t){return at(t)};if(n.version="2.4.3",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,a=e.document,s=e.DocumentFragment,o=e.HTMLTemplateElement,l=e.Node,c=e.Element,u=e.NodeFilter,d=e.NamedNodeMap,h=void 0===d?e.NamedNodeMap||e.MozNamedAttrMap:d,m=e.HTMLFormElement,_=e.DOMParser,f=e.trustedTypes,y=c.prototype,g=F(y,"cloneNode"),b=F(y,"nextSibling"),k=F(y,"childNodes"),A=F(y,"parentNode");if("function"==typeof o){var O=a.createElement("template");O.content&&O.content.ownerDocument&&(a=O.content.ownerDocument)}var st=it(f,r),ot=st?st.createHTML(""):"",lt=a,ct=lt.implementation,ut=lt.createNodeIterator,dt=lt.createDocumentFragment,ht=lt.getElementsByTagName,mt=r.importNode,_t={};try{_t=B(a).documentMode?a.documentMode:{}}catch(Ae){}var pt={};n.isSupported="function"==typeof A&&ct&&void 0!==ct.createHTMLDocument&&9!==_t;var ft,yt,gt=V,bt=G,kt=J,vt=X,xt=K,Mt=tt,Lt=et,wt=Q,Tt=null,St=N({},[].concat(i(I),i(P),i(j),i(H),i(Z))),Dt=null,Yt=N({},[].concat(i(W),i(z),i(U),i(q))),Et=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ct=null,At=null,Ot=!0,Nt=!0,Bt=!1,Ft=!1,It=!1,Pt=!1,jt=!1,Rt=!1,Ht=!1,$t=!1,Zt=!0,Wt=!1,zt="user-content-",Ut=!0,qt=!1,Vt={},Gt=null,Jt=N({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Xt=null,Kt=N({},["audio","video","img","source","image","track"]),Qt=null,te=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ee="http://www.w3.org/1998/Math/MathML",ne="http://www.w3.org/2000/svg",re="http://www.w3.org/1999/xhtml",ie=re,ae=!1,se=null,oe=N({},[ee,ne,re],w),le=["application/xhtml+xml","text/html"],ce="text/html",ue=null,de=a.createElement("form"),he=function(t){return t instanceof RegExp||t instanceof Function},me=function(e){ue&&ue===e||(e&&"object"===t(e)||(e={}),e=B(e),ft=ft=-1===le.indexOf(e.PARSER_MEDIA_TYPE)?ce:e.PARSER_MEDIA_TYPE,yt="application/xhtml+xml"===ft?w:L,Tt="ALLOWED_TAGS"in e?N({},e.ALLOWED_TAGS,yt):St,Dt="ALLOWED_ATTR"in e?N({},e.ALLOWED_ATTR,yt):Yt,se="ALLOWED_NAMESPACES"in e?N({},e.ALLOWED_NAMESPACES,w):oe,Qt="ADD_URI_SAFE_ATTR"in e?N(B(te),e.ADD_URI_SAFE_ATTR,yt):te,Xt="ADD_DATA_URI_TAGS"in e?N(B(Kt),e.ADD_DATA_URI_TAGS,yt):Kt,Gt="FORBID_CONTENTS"in e?N({},e.FORBID_CONTENTS,yt):Jt,Ct="FORBID_TAGS"in e?N({},e.FORBID_TAGS,yt):{},At="FORBID_ATTR"in e?N({},e.FORBID_ATTR,yt):{},Vt="USE_PROFILES"in e&&e.USE_PROFILES,Ot=!1!==e.ALLOW_ARIA_ATTR,Nt=!1!==e.ALLOW_DATA_ATTR,Bt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ft=e.SAFE_FOR_TEMPLATES||!1,It=e.WHOLE_DOCUMENT||!1,Rt=e.RETURN_DOM||!1,Ht=e.RETURN_DOM_FRAGMENT||!1,$t=e.RETURN_TRUSTED_TYPE||!1,jt=e.FORCE_BODY||!1,Zt=!1!==e.SANITIZE_DOM,Wt=e.SANITIZE_NAMED_PROPS||!1,Ut=!1!==e.KEEP_CONTENT,qt=e.IN_PLACE||!1,wt=e.ALLOWED_URI_REGEXP||wt,ie=e.NAMESPACE||re,e.CUSTOM_ELEMENT_HANDLING&&he(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Et.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&he(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Et.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Et.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ft&&(Nt=!1),Ht&&(Rt=!0),Vt&&(Tt=N({},i(Z)),Dt=[],!0===Vt.html&&(N(Tt,I),N(Dt,W)),!0===Vt.svg&&(N(Tt,P),N(Dt,z),N(Dt,q)),!0===Vt.svgFilters&&(N(Tt,j),N(Dt,z),N(Dt,q)),!0===Vt.mathMl&&(N(Tt,H),N(Dt,U),N(Dt,q))),e.ADD_TAGS&&(Tt===St&&(Tt=B(Tt)),N(Tt,e.ADD_TAGS,yt)),e.ADD_ATTR&&(Dt===Yt&&(Dt=B(Dt)),N(Dt,e.ADD_ATTR,yt)),e.ADD_URI_SAFE_ATTR&&N(Qt,e.ADD_URI_SAFE_ATTR,yt),e.FORBID_CONTENTS&&(Gt===Jt&&(Gt=B(Gt)),N(Gt,e.FORBID_CONTENTS,yt)),Ut&&(Tt["#text"]=!0),It&&N(Tt,["html","head","body"]),Tt.table&&(N(Tt,["tbody"]),delete Ct.tbody),p&&p(e),ue=e)},_e=N({},["mi","mo","mn","ms","mtext"]),pe=N({},["foreignobject","desc","title","annotation-xml"]),fe=N({},["title","style","font","a","script"]),ye=N({},P);N(ye,j),N(ye,R);var ge=N({},H);N(ge,$);var be=function(t){var e=A(t);e&&e.tagName||(e={namespaceURI:ie,tagName:"template"});var n=L(t.tagName),r=L(e.tagName);return!!se[t.namespaceURI]&&(t.namespaceURI===ne?e.namespaceURI===re?"svg"===n:e.namespaceURI===ee?"svg"===n&&("annotation-xml"===r||_e[r]):Boolean(ye[n]):t.namespaceURI===ee?e.namespaceURI===re?"math"===n:e.namespaceURI===ne?"math"===n&&pe[r]:Boolean(ge[n]):t.namespaceURI===re?!(e.namespaceURI===ne&&!pe[r])&&!(e.namespaceURI===ee&&!_e[r])&&!ge[n]&&(fe[n]||!ye[n]):!("application/xhtml+xml"!==ft||!se[t.namespaceURI]))},ke=function(t){M(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(Ae){try{t.outerHTML=ot}catch(Ae){t.remove()}}},ve=function(t,e){try{M(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(Ae){M(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!Dt[t])if(Rt||Ht)try{ke(e)}catch(Ae){}else try{e.setAttribute(t,"")}catch(Ae){}},xe=function(t){var e,n;if(jt)t="<remove></remove>"+t;else{var r=T(t,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ft&&ie===re&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");var i=st?st.createHTML(t):t;if(ie===re)try{e=(new _).parseFromString(i,ft)}catch(Ae){}if(!e||!e.documentElement){e=ct.createDocument(ie,"template",null);try{e.documentElement.innerHTML=ae?ot:i}catch(Ae){}}var s=e.body||e.documentElement;return t&&n&&s.insertBefore(a.createTextNode(n),s.childNodes[0]||null),ie===re?ht.call(e,It?"html":"body")[0]:It?e.documentElement:s},Me=function(t){return ut.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null,!1)},Le=function(t){return t instanceof m&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof h)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},we=function(e){return"object"===t(l)?e instanceof l:e&&"object"===t(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Te=function(t,e,r){pt[t]&&v(pt[t],(function(t){t.call(n,e,r,ue)}))},Se=function(t){var e;if(Te("beforeSanitizeElements",t,null),Le(t))return ke(t),!0;if(E(/[\u0080-\uFFFF]/,t.nodeName))return ke(t),!0;var r=yt(t.nodeName);if(Te("uponSanitizeElement",t,{tagName:r,allowedTags:Tt}),t.hasChildNodes()&&!we(t.firstElementChild)&&(!we(t.content)||!we(t.content.firstElementChild))&&E(/<[/\w]/g,t.innerHTML)&&E(/<[/\w]/g,t.textContent))return ke(t),!0;if("select"===r&&E(/<template/i,t.innerHTML))return ke(t),!0;if(!Tt[r]||Ct[r]){if(!Ct[r]&&Ye(r)){if(Et.tagNameCheck instanceof RegExp&&E(Et.tagNameCheck,r))return!1;if(Et.tagNameCheck instanceof Function&&Et.tagNameCheck(r))return!1}if(Ut&&!Gt[r]){var i=A(t)||t.parentNode,a=k(t)||t.childNodes;if(a&&i)for(var s=a.length-1;s>=0;--s)i.insertBefore(g(a[s],!0),b(t))}return ke(t),!0}return t instanceof c&&!be(t)?(ke(t),!0):"noscript"!==r&&"noembed"!==r||!E(/<\/no(script|embed)/i,t.innerHTML)?(Ft&&3===t.nodeType&&(e=t.textContent,e=S(e,gt," "),e=S(e,bt," "),e=S(e,kt," "),t.textContent!==e&&(M(n.removed,{element:t.cloneNode()}),t.textContent=e)),Te("afterSanitizeElements",t,null),!1):(ke(t),!0)},De=function(t,e,n){if(Zt&&("id"===e||"name"===e)&&(n in a||n in de))return!1;if(Nt&&!At[e]&&E(vt,e));else if(Ot&&E(xt,e));else if(!Dt[e]||At[e]){if(!(Ye(t)&&(Et.tagNameCheck instanceof RegExp&&E(Et.tagNameCheck,t)||Et.tagNameCheck instanceof Function&&Et.tagNameCheck(t))&&(Et.attributeNameCheck instanceof RegExp&&E(Et.attributeNameCheck,e)||Et.attributeNameCheck instanceof Function&&Et.attributeNameCheck(e))||"is"===e&&Et.allowCustomizedBuiltInElements&&(Et.tagNameCheck instanceof RegExp&&E(Et.tagNameCheck,n)||Et.tagNameCheck instanceof Function&&Et.tagNameCheck(n))))return!1}else if(Qt[e]);else if(E(wt,S(n,Lt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==D(n,"data:")||!Xt[t])if(Bt&&!E(Mt,S(n,Lt,"")));else if(n)return!1;return!0},Ye=function(t){return t.indexOf("-")>0},Ee=function(e){var r,i,a,s;Te("beforeSanitizeAttributes",e,null);var o=e.attributes;if(o){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Dt};for(s=o.length;s--;){var c=r=o[s],u=c.name,d=c.namespaceURI;if(i="value"===u?r.value:Y(r.value),a=yt(u),l.attrName=a,l.attrValue=i,l.keepAttr=!0,l.forceKeepAttr=void 0,Te("uponSanitizeAttribute",e,l),i=l.attrValue,!l.forceKeepAttr&&(ve(u,e),l.keepAttr))if(E(/\/>/i,i))ve(u,e);else{Ft&&(i=S(i,gt," "),i=S(i,bt," "),i=S(i,kt," "));var h=yt(e.nodeName);if(De(h,a,i)){if(!Wt||"id"!==a&&"name"!==a||(ve(u,e),i=zt+i),st&&"object"===t(f)&&"function"==typeof f.getAttributeType)if(d);else switch(f.getAttributeType(h,a)){case"TrustedHTML":i=st.createHTML(i);break;case"TrustedScriptURL":i=st.createScriptURL(i)}try{d?e.setAttributeNS(d,u,i):e.setAttribute(u,i),x(n.removed)}catch(Ae){}}}}Te("afterSanitizeAttributes",e,null)}},Ce=function t(e){var n,r=Me(e);for(Te("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Te("uponSanitizeShadowNode",n,null),Se(n)||(n.content instanceof s&&t(n.content),Ee(n));Te("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(i){var a,o,c,u,d,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((ae=!i)&&(i="\x3c!--\x3e"),"string"!=typeof i&&!we(i)){if("function"!=typeof i.toString)throw C("toString is not a function");if("string"!=typeof(i=i.toString()))throw C("dirty is not a string, aborting")}if(!n.isSupported){if("object"===t(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof i)return e.toStaticHTML(i);if(we(i))return e.toStaticHTML(i.outerHTML)}return i}if(Pt||me(h),n.removed=[],"string"==typeof i&&(qt=!1),qt){if(i.nodeName){var m=yt(i.nodeName);if(!Tt[m]||Ct[m])throw C("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof l)1===(o=(a=xe("\x3c!----\x3e")).ownerDocument.importNode(i,!0)).nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?a=o:a.appendChild(o);else{if(!Rt&&!Ft&&!It&&-1===i.indexOf("<"))return st&&$t?st.createHTML(i):i;if(!(a=xe(i)))return Rt?null:$t?ot:""}a&&jt&&ke(a.firstChild);for(var _=Me(qt?i:a);c=_.nextNode();)3===c.nodeType&&c===u||Se(c)||(c.content instanceof s&&Ce(c.content),Ee(c),u=c);if(u=null,qt)return i;if(Rt){if(Ht)for(d=dt.call(a.ownerDocument);a.firstChild;)d.appendChild(a.firstChild);else d=a;return Dt.shadowroot&&(d=mt.call(r,d,!0)),d}var p=It?a.outerHTML:a.innerHTML;return It&&Tt["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&E(nt,a.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+p),Ft&&(p=S(p,gt," "),p=S(p,bt," "),p=S(p,kt," ")),st&&$t?st.createHTML(p):p},n.setConfig=function(t){me(t),Pt=!0},n.clearConfig=function(){ue=null,Pt=!1},n.isValidAttribute=function(t,e,n){ue||me({});var r=yt(t),i=yt(e);return De(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(pt[t]=pt[t]||[],M(pt[t],e))},n.removeHook=function(t){if(pt[t])return x(pt[t])},n.removeHooks=function(t){pt[t]&&(pt[t]=[])},n.removeAllHooks=function(){pt={}},n}return at()}()},74737:(t,e,n)=>{"use strict";n.d(e,{a:()=>Nn,b:()=>Fs,c:()=>Pt,d:()=>An,e:()=>Ft,f:()=>$s,g:()=>ar,h:()=>yl,i:()=>us,j:()=>Rr,k:()=>$r,l:()=>St,m:()=>Ar,n:()=>At,o:()=>hm,p:()=>go,s:()=>mr});const r=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=Array.from("string"==typeof t?[t]:t);r[r.length-1]=r[r.length-1].replace(/\r?\n([\t ]*)$/,"");var i=r.reduce((function(t,e){var n=e.match(/\n([\t ]+|(?!\s).)/g);return n?t.concat(n.map((function(t){var e,n;return null!==(n=null===(e=t.match(/[\t ]/g))||void 0===e?void 0:e.length)&&void 0!==n?n:0}))):t}),[]);if(i.length){var a=new RegExp("\n[\t ]{"+Math.min.apply(Math,i)+"}","g");r=r.map((function(t){return t.replace(a,"\n")}))}r[0]=r[0].replace(/^\r?\n/,"");var s=r[0];return e.forEach((function(t,e){var n=s.match(/(?:^|\n)( *)$/),i=n?n[1]:"",a=t;"string"==typeof t&&t.includes("\n")&&(a=String(t).split("\n").map((function(t,e){return 0===e?t:""+i+t})).join("\n")),s+=a+r[e+1]})),s};var i=n(30381),a=n.n(i),s=n(17967),o=n(59373),l=n(27856),u=n.n(l),d=n(71610),h=n(61691);const m=(t,e)=>{const n=d.Z.parse(t);for(const r in e)n[r]=h.Z.channel.clamp[r](e[r]);return d.Z.stringify(n)},_=(t,e)=>{const n=d.Z.parse(t),r={};for(const i in e)e[i]&&(r[i]=n[i]+e[i]);return m(t,r)};var p=n(21883);const f=(t,e,n=0,r=1)=>{if("number"!=typeof t)return m(t,{a:e});const i=p.Z.set({r:h.Z.channel.clamp.r(t),g:h.Z.channel.clamp.g(e),b:h.Z.channel.clamp.b(n),a:h.Z.channel.clamp.a(r)});return d.Z.stringify(i)},y=(t,e,n=50)=>{const{r:r,g:i,b:a,a:s}=d.Z.parse(t),{r:o,g:l,b:c,a:u}=d.Z.parse(e),h=n/100,m=2*h-1,_=s-u,p=((m*_==-1?m:(m+_)/(1+m*_))+1)/2,y=1-p;return f(r*p+o*y,i*p+l*y,a*p+c*y,s*h+u*(1-h))},g=(t,e=100)=>{const n=d.Z.parse(t);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,y(n,t,e)};var b=n(7201),k=n(12281),v=n(42454),x="comm",M="rule",L="decl",w=Math.abs,T=String.fromCharCode;Object.assign;function S(t){return t.trim()}function D(t,e,n){return t.replace(e,n)}function Y(t,e){return t.indexOf(e)}function E(t,e){return 0|t.charCodeAt(e)}function C(t,e,n){return t.slice(e,n)}function A(t){return t.length}function O(t){return t.length}function N(t,e){return e.push(t),t}function B(t,e){for(var n="",r=O(t),i=0;i<r;i++)n+=e(t[i],i,t,e)||"";return n}function F(t,e,n,r){switch(t.type){case"@import":case L:return t.return=t.return||t.value;case x:return"";case"@keyframes":return t.return=t.value+"{"+B(t.children,r)+"}";case M:t.value=t.props.join(",")}return A(n=B(t.children,r))?t.return=t.value+"{"+n+"}":""}var I=1,P=1,j=0,R=0,H=0,$="";function Z(t,e,n,r,i,a,s){return{value:t,root:e,parent:n,type:r,props:i,children:a,line:I,column:P,length:s,return:""}}function W(){return H=R>0?E($,--R):0,P--,10===H&&(P=1,I--),H}function z(){return H=R<j?E($,R++):0,P++,10===H&&(P=1,I++),H}function U(){return E($,R)}function q(){return R}function V(t,e){return C($,t,e)}function G(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function J(t){return I=P=1,j=A($=t),R=0,[]}function X(t){return $="",t}function K(t){return S(V(R-1,et(91===t?t+2:40===t?t+1:t)))}function Q(t){for(;(H=U())&&H<33;)z();return G(t)>2||G(H)>3?"":" "}function tt(t,e){for(;--e&&z()&&!(H<48||H>102||H>57&&H<65||H>70&&H<97););return V(t,q()+(e<6&&32==U()&&32==z()))}function et(t){for(;z();)switch(H){case t:return R;case 34:case 39:34!==t&&39!==t&&et(H);break;case 40:41===t&&et(t);break;case 92:z()}return R}function nt(t,e){for(;z()&&t+H!==57&&(t+H!==84||47!==U()););return"/*"+V(e,R-1)+"*"+T(47===t?t:z())}function rt(t){for(;!G(U());)z();return V(t,R)}function it(t){return X(at("",null,null,null,[""],t=J(t),0,[0],t))}function at(t,e,n,r,i,a,s,o,l){for(var c=0,u=0,d=s,h=0,m=0,_=0,p=1,f=1,y=1,g=0,b="",k=i,v=a,x=r,M=b;f;)switch(_=g,g=z()){case 40:if(108!=_&&58==E(M,d-1)){-1!=Y(M+=D(K(g),"&","&\f"),"&\f")&&(y=-1);break}case 34:case 39:case 91:M+=K(g);break;case 9:case 10:case 13:case 32:M+=Q(_);break;case 92:M+=tt(q()-1,7);continue;case 47:switch(U()){case 42:case 47:N(ot(nt(z(),q()),e,n),l);break;default:M+="/"}break;case 123*p:o[c++]=A(M)*y;case 125*p:case 59:case 0:switch(g){case 0:case 125:f=0;case 59+u:m>0&&A(M)-d&&N(m>32?lt(M+";",r,n,d-1):lt(D(M," ","")+";",r,n,d-2),l);break;case 59:M+=";";default:if(N(x=st(M,e,n,c,u,i,o,b,k=[],v=[],d),a),123===g)if(0===u)at(M,e,x,x,k,a,d,o,v);else switch(99===h&&110===E(M,3)?100:h){case 100:case 109:case 115:at(t,x,x,r&&N(st(t,x,x,0,0,i,o,b,i,k=[],d),v),i,v,d,o,r?k:v);break;default:at(M,x,x,x,[""],v,0,o,v)}}c=u=m=0,p=y=1,b=M="",d=s;break;case 58:d=1+A(M),m=_;default:if(p<1)if(123==g)--p;else if(125==g&&0==p++&&125==W())continue;switch(M+=T(g),g*p){case 38:y=u>0?1:(M+="\f",-1);break;case 44:o[c++]=(A(M)-1)*y,y=1;break;case 64:45===U()&&(M+=K(z())),h=U(),u=d=A(b=M+=rt(q())),g++;break;case 45:45===_&&2==A(M)&&(p=0)}}return a}function st(t,e,n,r,i,a,s,o,l,c,u){for(var d=i-1,h=0===i?a:[""],m=O(h),_=0,p=0,f=0;_<r;++_)for(var y=0,g=C(t,d+1,d=w(p=s[_])),b=t;y<m;++y)(b=S(p>0?h[y]+" "+g:D(g,/&\f/g,h[y])))&&(l[f++]=b);return Z(t,e,n,0===i?M:o,l,c,u)}function ot(t,e,n){return Z(t,e,n,x,T(H),C(t,2,-2),0)}function lt(t,e,n,r){return Z(t,e,n,L,C(t,0,r),C(t,r+1,-1),r)}var ct=n(70277),ut=n(45625),dt=n(39354);const ht=[];for(let c=0;c<256;++c)ht.push((c+256).toString(16).slice(1));function mt(t,e=0){return(ht[t[e+0]]+ht[t[e+1]]+ht[t[e+2]]+ht[t[e+3]]+"-"+ht[t[e+4]]+ht[t[e+5]]+"-"+ht[t[e+6]]+ht[t[e+7]]+"-"+ht[t[e+8]]+ht[t[e+9]]+"-"+ht[t[e+10]]+ht[t[e+11]]+ht[t[e+12]]+ht[t[e+13]]+ht[t[e+14]]+ht[t[e+15]]).toLowerCase()}const _t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const pt=function(t){return"string"==typeof t&&_t.test(t)};const ft=function(t){if(!pt(t))throw TypeError("Invalid UUID");let e;const n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n};function yt(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function gt(t,e){return t<<e|t>>>32-e}const bt=function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const r=t.length/4+2,i=Math.ceil(r/16),a=new Array(i);for(let s=0;s<i;++s){const e=new Uint32Array(16);for(let n=0;n<16;++n)e[n]=t[64*s+4*n]<<24|t[64*s+4*n+1]<<16|t[64*s+4*n+2]<<8|t[64*s+4*n+3];a[s]=e}a[i-1][14]=8*(t.length-1)/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=8*(t.length-1)&4294967295;for(let s=0;s<i;++s){const t=new Uint32Array(80);for(let e=0;e<16;++e)t[e]=a[s][e];for(let e=16;e<80;++e)t[e]=gt(t[e-3]^t[e-8]^t[e-14]^t[e-16],1);let r=n[0],i=n[1],o=n[2],l=n[3],c=n[4];for(let n=0;n<80;++n){const a=Math.floor(n/20),s=gt(r,5)+yt(a,i,o,l)+c+e[a]+t[n]>>>0;c=l,l=o,o=gt(i,30)>>>0,i=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+o>>>0,n[3]=n[3]+l>>>0,n[4]=n[4]+c>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]},kt=function(t,e,n){function r(t,r,i,a){var s;if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=ft(r)),16!==(null===(s=r)||void 0===s?void 0:s.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let o=new Uint8Array(16+t.length);if(o.set(r),o.set(t,r.length),o=n(o),o[6]=15&o[6]|e,o[8]=63&o[8]|128,i){a=a||0;for(let t=0;t<16;++t)i[a+t]=o[t];return i}return mt(o)}try{r.name=t}catch(i){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}("v5",80,bt),vt=kt;n(91518),n(96225);var xt=n(43349),Mt=(n(23352),n(22930),n(79697)),Lt=Object.defineProperty,wt=(t,e,n)=>(((t,e,n)=>{e in t?Lt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);const Tt={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},St={trace:(...t)=>{},debug:(...t)=>{},info:(...t)=>{},warn:(...t)=>{},error:(...t)=>{},fatal:(...t)=>{}},Dt=function(t="fatal"){let e=Tt.fatal;"string"==typeof t?(t=t.toLowerCase())in Tt&&(e=Tt[t]):"number"==typeof t&&(e=t),St.trace=()=>{},St.debug=()=>{},St.info=()=>{},St.warn=()=>{},St.error=()=>{},St.fatal=()=>{},e<=Tt.fatal&&(St.fatal=console.error?console.error.bind(console,Yt("FATAL"),"color: orange"):console.log.bind(console,"\x1b[35m",Yt("FATAL"))),e<=Tt.error&&(St.error=console.error?console.error.bind(console,Yt("ERROR"),"color: orange"):console.log.bind(console,"\x1b[31m",Yt("ERROR"))),e<=Tt.warn&&(St.warn=console.warn?console.warn.bind(console,Yt("WARN"),"color: orange"):console.log.bind(console,"\x1b[33m",Yt("WARN"))),e<=Tt.info&&(St.info=console.info?console.info.bind(console,Yt("INFO"),"color: lightblue"):console.log.bind(console,"\x1b[34m",Yt("INFO"))),e<=Tt.debug&&(St.debug=console.debug?console.debug.bind(console,Yt("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1b[32m",Yt("DEBUG"))),e<=Tt.trace&&(St.trace=console.debug?console.debug.bind(console,Yt("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1b[32m",Yt("TRACE")))},Yt=t=>`%c${a()().format("ss.SSS")} : ${t} : `,Et=t=>u().sanitize(t),Ct=(t,e)=>{var n;if(!1!==(null==(n=e.flowchart)?void 0:n.htmlLabels)){const n=e.securityLevel;"antiscript"===n||"strict"===n?t=Et(t):"loose"!==n&&(t=(t=(t=Bt(t)).replace(/</g,"<").replace(/>/g,">")).replace(/=/g,"="),t=Nt(t))}return t},At=(t,e)=>t?t=e.dompurifyConfig?u().sanitize(Ct(t,e),e.dompurifyConfig).toString():u().sanitize(Ct(t,e),{FORBID_TAGS:["style"]}).toString():t,Ot=/<br\s*\/?>/gi,Nt=t=>t.replace(/#br#/g,"<br/>"),Bt=t=>t.replace(Ot,"#br#"),Ft=t=>!1!==t&&!["false","null","0"].includes(String(t).trim().toLowerCase()),It=function(t){let e=t;if(t.split("~").length-1>=2){let t=e;do{e=t,t=e.replace(/~([^\s,:;]+)~/,"<$1>")}while(t!=e);return It(t)}return e},Pt={getRows:t=>{if(!t)return[""];return Bt(t).replace(/\\n/g,"#br#").split("#br#")},sanitizeText:At,sanitizeTextOrArray:(t,e)=>"string"==typeof t?At(t,e):t.flat().map((t=>At(t,e))),hasBreaks:t=>Ot.test(t),splitBreaks:t=>t.split(Ot),lineBreakRegex:Ot,removeScript:Et,getUrl:t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=e.replaceAll(/\(/g,"\\("),e=e.replaceAll(/\)/g,"\\)")),e},evaluate:Ft},jt=(t,e)=>_(t,e?{s:-40,l:10}:{s:-40,l:-10}),Rt="#ffffff",Ht="#f2f2f2";class $t{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||_(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||_(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||g(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||g(this.tertiaryColor),this.lineColor=this.lineColor||g(this.background),this.textColor=this.textColor||this.primaryTextColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?(0,b.Z)(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||"grey",this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||(0,b.Z)(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||g(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||(0,k.Z)(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||_(this.primaryColor,{h:30}),this.cScale4=this.cScale4||_(this.primaryColor,{h:60}),this.cScale5=this.cScale5||_(this.primaryColor,{h:90}),this.cScale6=this.cScale6||_(this.primaryColor,{h:120}),this.cScale7=this.cScale7||_(this.primaryColor,{h:150}),this.cScale8=this.cScale8||_(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||_(this.primaryColor,{h:270}),this.cScale10=this.cScale10||_(this.primaryColor,{h:300}),this.cScale11=this.cScale11||_(this.primaryColor,{h:330}),this.darkMode)for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScale"+e]=(0,b.Z)(this["cScale"+e],75);else for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScale"+e]=(0,b.Z)(this["cScale"+e],25);for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScaleInv"+e]=this["cScaleInv"+e]||g(this["cScale"+e]);for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this.darkMode?this["cScalePeer"+e]=this["cScalePeer"+e]||(0,k.Z)(this["cScale"+e],10):this["cScalePeer"+e]=this["cScalePeer"+e]||(0,b.Z)(this["cScale"+e],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScaleLabel"+e]=this["cScaleLabel"+e]||this.scaleLabelColor;const t=this.darkMode?-4:-1;for(let e=0;e<5;e++)this["surface"+e]=this["surface"+e]||_(this.mainBkg,{h:180,s:-15,l:t*(5+3*e)}),this["surfacePeer"+e]=this["surfacePeer"+e]||_(this.mainBkg,{h:180,s:-15,l:t*(8+3*e)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||_(this.primaryColor,{h:64}),this.fillType3=this.fillType3||_(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||_(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||_(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||_(this.primaryColor,{h:128}),this.fillType7=this.fillType7||_(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||_(this.primaryColor,{l:-10}),this.pie5=this.pie5||_(this.secondaryColor,{l:-10}),this.pie6=this.pie6||_(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||_(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||_(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||_(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||_(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||_(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||_(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?(0,b.Z)(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||_(this.primaryColor,{h:-30}),this.git4=this.git4||_(this.primaryColor,{h:-60}),this.git5=this.git5||_(this.primaryColor,{h:-90}),this.git6=this.git6||_(this.primaryColor,{h:60}),this.git7=this.git7||_(this.primaryColor,{h:120}),this.darkMode?(this.git0=(0,k.Z)(this.git0,25),this.git1=(0,k.Z)(this.git1,25),this.git2=(0,k.Z)(this.git2,25),this.git3=(0,k.Z)(this.git3,25),this.git4=(0,k.Z)(this.git4,25),this.git5=(0,k.Z)(this.git5,25),this.git6=(0,k.Z)(this.git6,25),this.git7=(0,k.Z)(this.git7,25)):(this.git0=(0,b.Z)(this.git0,25),this.git1=(0,b.Z)(this.git1,25),this.git2=(0,b.Z)(this.git2,25),this.git3=(0,b.Z)(this.git3,25),this.git4=(0,b.Z)(this.git4,25),this.git5=(0,b.Z)(this.git5,25),this.git6=(0,b.Z)(this.git6,25),this.git7=(0,b.Z)(this.git7,25)),this.gitInv0=this.gitInv0||g(this.git0),this.gitInv1=this.gitInv1||g(this.git1),this.gitInv2=this.gitInv2||g(this.git2),this.gitInv3=this.gitInv3||g(this.git3),this.gitInv4=this.gitInv4||g(this.git4),this.gitInv5=this.gitInv5||g(this.git5),this.gitInv6=this.gitInv6||g(this.git6),this.gitInv7=this.gitInv7||g(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Rt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ht}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}}class Zt{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=(0,k.Z)(this.primaryColor,16),this.tertiaryColor=_(this.primaryColor,{h:-160}),this.primaryBorderColor=g(this.background),this.secondaryBorderColor=jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=g(this.primaryColor),this.secondaryTextColor=g(this.secondaryColor),this.tertiaryTextColor=g(this.tertiaryColor),this.lineColor=g(this.background),this.textColor=g(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=(0,k.Z)(g("#323D47"),10),this.lineColor="calculated",this.border1="#81B1DB",this.border2=f(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=(0,b.Z)("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.taskBorderColor=f(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=f(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){this.secondBkg=(0,k.Z)(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=(0,k.Z)(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.mainContrastColor,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=(0,k.Z)(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=_(this.primaryColor,{h:64}),this.fillType3=_(this.secondaryColor,{h:64}),this.fillType4=_(this.primaryColor,{h:-64}),this.fillType5=_(this.secondaryColor,{h:-64}),this.fillType6=_(this.primaryColor,{h:128}),this.fillType7=_(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||_(this.primaryColor,{h:30}),this.cScale4=this.cScale4||_(this.primaryColor,{h:60}),this.cScale5=this.cScale5||_(this.primaryColor,{h:90}),this.cScale6=this.cScale6||_(this.primaryColor,{h:120}),this.cScale7=this.cScale7||_(this.primaryColor,{h:150}),this.cScale8=this.cScale8||_(this.primaryColor,{h:210}),this.cScale9=this.cScale9||_(this.primaryColor,{h:270}),this.cScale10=this.cScale10||_(this.primaryColor,{h:300}),this.cScale11=this.cScale11||_(this.primaryColor,{h:330});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||g(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScalePeer"+t]=this["cScalePeer"+t]||(0,k.Z)(this["cScale"+t],10);for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||_(this.mainBkg,{h:30,s:-30,l:-(4*t-10)}),this["surfacePeer"+t]=this["surfacePeer"+t]||_(this.mainBkg,{h:30,s:-30,l:-(4*t-7)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?(0,b.Z)(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=(0,k.Z)(this.secondaryColor,20),this.git1=(0,k.Z)(this.pie2||this.secondaryColor,20),this.git2=(0,k.Z)(this.pie3||this.tertiaryColor,20),this.git3=(0,k.Z)(this.pie4||_(this.primaryColor,{h:-30}),20),this.git4=(0,k.Z)(this.pie5||_(this.primaryColor,{h:-60}),20),this.git5=(0,k.Z)(this.pie6||_(this.primaryColor,{h:-90}),10),this.git6=(0,k.Z)(this.pie7||_(this.primaryColor,{h:60}),10),this.git7=(0,k.Z)(this.pie8||_(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||g(this.git0),this.gitInv1=this.gitInv1||g(this.git1),this.gitInv2=this.gitInv2||g(this.git2),this.gitInv3=this.gitInv3||g(this.git3),this.gitInv4=this.gitInv4||g(this.git4),this.gitInv5=this.gitInv5||g(this.git5),this.gitInv6=this.gitInv6||g(this.git6),this.gitInv7=this.gitInv7||g(this.git7),this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||(0,k.Z)(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||(0,k.Z)(this.background,2)}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}}class Wt{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=_(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=_(this.primaryColor,{h:-160}),this.primaryBorderColor=jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=g(this.primaryColor),this.secondaryTextColor=g(this.secondaryColor),this.tertiaryTextColor=g(this.tertiaryColor),this.lineColor=g(this.background),this.textColor=g(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#e8e8e8",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="grey",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.sectionBkgColor=f(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||_(this.primaryColor,{h:30}),this.cScale4=this.cScale4||_(this.primaryColor,{h:60}),this.cScale5=this.cScale5||_(this.primaryColor,{h:90}),this.cScale6=this.cScale6||_(this.primaryColor,{h:120}),this.cScale7=this.cScale7||_(this.primaryColor,{h:150}),this.cScale8=this.cScale8||_(this.primaryColor,{h:210}),this.cScale9=this.cScale9||_(this.primaryColor,{h:270}),this.cScale10=this.cScale10||_(this.primaryColor,{h:300}),this.cScale11=this.cScale11||_(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||(0,b.Z)(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||(0,b.Z)(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=(0,b.Z)(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||(0,b.Z)(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||_(this["cScale"+t],{h:180});for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||_(this.mainBkg,{h:30,l:-(5+5*t)}),this["surfacePeer"+t]=this["surfacePeer"+t]||_(this.mainBkg,{h:30,l:-(7+5*t)});if(this.scaleLabelColor="calculated"!==this.scaleLabelColor&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,"calculated"!==this.labelTextColor){this.cScaleLabel0=this.cScaleLabel0||g(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||g(this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=(0,k.Z)(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=_(this.primaryColor,{h:64}),this.fillType3=_(this.secondaryColor,{h:64}),this.fillType4=_(this.primaryColor,{h:-64}),this.fillType5=_(this.secondaryColor,{h:-64}),this.fillType6=_(this.primaryColor,{h:128}),this.fillType7=_(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||_(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||_(this.primaryColor,{l:-10}),this.pie5=this.pie5||_(this.secondaryColor,{l:-30}),this.pie6=this.pie6||_(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||_(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||_(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||_(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||_(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||_(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||_(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||_(this.primaryColor,{h:-30}),this.git4=this.git4||_(this.primaryColor,{h:-60}),this.git5=this.git5||_(this.primaryColor,{h:-90}),this.git6=this.git6||_(this.primaryColor,{h:60}),this.git7=this.git7||_(this.primaryColor,{h:120}),this.darkMode?(this.git0=(0,k.Z)(this.git0,25),this.git1=(0,k.Z)(this.git1,25),this.git2=(0,k.Z)(this.git2,25),this.git3=(0,k.Z)(this.git3,25),this.git4=(0,k.Z)(this.git4,25),this.git5=(0,k.Z)(this.git5,25),this.git6=(0,k.Z)(this.git6,25),this.git7=(0,k.Z)(this.git7,25)):(this.git0=(0,b.Z)(this.git0,25),this.git1=(0,b.Z)(this.git1,25),this.git2=(0,b.Z)(this.git2,25),this.git3=(0,b.Z)(this.git3,25),this.git4=(0,b.Z)(this.git4,25),this.git5=(0,b.Z)(this.git5,25),this.git6=(0,b.Z)(this.git6,25),this.git7=(0,b.Z)(this.git7,25)),this.gitInv0=this.gitInv0||(0,b.Z)(g(this.git0),25),this.gitInv1=this.gitInv1||g(this.git1),this.gitInv2=this.gitInv2||g(this.git2),this.gitInv3=this.gitInv3||g(this.git3),this.gitInv4=this.gitInv4||g(this.git4),this.gitInv5=this.gitInv5||g(this.git5),this.gitInv6=this.gitInv6||g(this.git6),this.gitInv7=this.gitInv7||g(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||g(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||g(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Rt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ht}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}}class zt{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=(0,k.Z)("#cde498",10),this.primaryBorderColor=jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=g(this.primaryColor),this.secondaryTextColor=g(this.secondaryColor),this.tertiaryTextColor=g(this.primaryColor),this.lineColor=g(this.background),this.textColor=g(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="grey",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||_(this.primaryColor,{h:30}),this.cScale4=this.cScale4||_(this.primaryColor,{h:60}),this.cScale5=this.cScale5||_(this.primaryColor,{h:90}),this.cScale6=this.cScale6||_(this.primaryColor,{h:120}),this.cScale7=this.cScale7||_(this.primaryColor,{h:150}),this.cScale8=this.cScale8||_(this.primaryColor,{h:210}),this.cScale9=this.cScale9||_(this.primaryColor,{h:270}),this.cScale10=this.cScale10||_(this.primaryColor,{h:300}),this.cScale11=this.cScale11||_(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||(0,b.Z)(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||(0,b.Z)(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=(0,b.Z)(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||(0,b.Z)(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||_(this["cScale"+t],{h:180});this.scaleLabelColor="calculated"!==this.scaleLabelColor&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||_(this.mainBkg,{h:30,s:-30,l:-(5+5*t)}),this["surfacePeer"+t]=this["surfacePeer"+t]||_(this.mainBkg,{h:30,s:-30,l:-(8+5*t)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.actorBorder=(0,b.Z)(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=_(this.primaryColor,{h:64}),this.fillType3=_(this.secondaryColor,{h:64}),this.fillType4=_(this.primaryColor,{h:-64}),this.fillType5=_(this.secondaryColor,{h:-64}),this.fillType6=_(this.primaryColor,{h:128}),this.fillType7=_(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||_(this.primaryColor,{l:-30}),this.pie5=this.pie5||_(this.secondaryColor,{l:-30}),this.pie6=this.pie6||_(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||_(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||_(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||_(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||_(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||_(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||_(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||_(this.primaryColor,{h:-30}),this.git4=this.git4||_(this.primaryColor,{h:-60}),this.git5=this.git5||_(this.primaryColor,{h:-90}),this.git6=this.git6||_(this.primaryColor,{h:60}),this.git7=this.git7||_(this.primaryColor,{h:120}),this.darkMode?(this.git0=(0,k.Z)(this.git0,25),this.git1=(0,k.Z)(this.git1,25),this.git2=(0,k.Z)(this.git2,25),this.git3=(0,k.Z)(this.git3,25),this.git4=(0,k.Z)(this.git4,25),this.git5=(0,k.Z)(this.git5,25),this.git6=(0,k.Z)(this.git6,25),this.git7=(0,k.Z)(this.git7,25)):(this.git0=(0,b.Z)(this.git0,25),this.git1=(0,b.Z)(this.git1,25),this.git2=(0,b.Z)(this.git2,25),this.git3=(0,b.Z)(this.git3,25),this.git4=(0,b.Z)(this.git4,25),this.git5=(0,b.Z)(this.git5,25),this.git6=(0,b.Z)(this.git6,25),this.git7=(0,b.Z)(this.git7,25)),this.gitInv0=this.gitInv0||g(this.git0),this.gitInv1=this.gitInv1||g(this.git1),this.gitInv2=this.gitInv2||g(this.git2),this.gitInv3=this.gitInv3||g(this.git3),this.gitInv4=this.gitInv4||g(this.git4),this.gitInv5=this.gitInv5||g(this.git5),this.gitInv6=this.gitInv6||g(this.git6),this.gitInv7=this.gitInv7||g(this.git7),this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Rt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ht}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}}class Ut{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=(0,k.Z)(this.contrast,55),this.background="#ffffff",this.tertiaryColor=_(this.primaryColor,{h:-160}),this.primaryBorderColor=jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=g(this.primaryColor),this.secondaryTextColor=g(this.secondaryColor),this.tertiaryTextColor=g(this.tertiaryColor),this.lineColor=g(this.background),this.textColor=g(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.secondBkg=(0,k.Z)(this.contrast,55),this.border2=this.contrast,this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||g(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this.darkMode?this["cScalePeer"+t]=this["cScalePeer"+t]||(0,k.Z)(this["cScale"+t],10):this["cScalePeer"+t]=this["cScalePeer"+t]||(0,b.Z)(this["cScale"+t],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||_(this.mainBkg,{l:-(5+5*t)}),this["surfacePeer"+t]=this["surfacePeer"+t]||_(this.mainBkg,{l:-(8+5*t)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.actorBorder=(0,k.Z)(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.lineColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.sectionBkgColor=(0,k.Z)(this.contrast,30),this.sectionBkgColor2=(0,k.Z)(this.contrast,30),this.taskBorderColor=(0,b.Z)(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=(0,k.Z)(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=(0,b.Z)(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=_(this.primaryColor,{h:64}),this.fillType3=_(this.secondaryColor,{h:64}),this.fillType4=_(this.primaryColor,{h:-64}),this.fillType5=_(this.secondaryColor,{h:-64}),this.fillType6=_(this.primaryColor,{h:128}),this.fillType7=_(this.secondaryColor,{h:128});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=(0,b.Z)(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||_(this.primaryColor,{h:-30}),this.git4=this.pie5||_(this.primaryColor,{h:-60}),this.git5=this.pie6||_(this.primaryColor,{h:-90}),this.git6=this.pie7||_(this.primaryColor,{h:60}),this.git7=this.pie8||_(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||g(this.git0),this.gitInv1=this.gitInv1||g(this.git1),this.gitInv2=this.gitInv2||g(this.git2),this.gitInv3=this.gitInv3||g(this.git3),this.gitInv4=this.gitInv4||g(this.git4),this.gitInv5=this.gitInv5||g(this.git5),this.gitInv6=this.gitInv6||g(this.git6),this.gitInv7=this.gitInv7||g(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Rt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ht}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}}const qt={base:{getThemeVariables:t=>{const e=new $t;return e.calculate(t),e}},dark:{getThemeVariables:t=>{const e=new Zt;return e.calculate(t),e}},default:{getThemeVariables:t=>{const e=new Wt;return e.calculate(t),e}},forest:{getThemeVariables:t=>{const e=new zt;return e.calculate(t),e}},neutral:{getThemeVariables:t=>{const e=new Ut;return e.calculate(t),e}}},Vt={theme:"default",themeVariables:qt.default.getThemeVariables(),themeCSS:void 0,maxTextSize:5e4,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize"],deterministicIds:!1,deterministicIDSeed:void 0,flowchart:{titleTopMargin:25,diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,useMaxWidth:!0,defaultRenderer:"dagre-wrapper"},sequence:{hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,useMaxWidth:!0,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20,messageFont:function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},noteFont:function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},actorFont:function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}}},gantt:{titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",tickInterval:void 0,useMaxWidth:!0,topAxis:!1,useWidth:void 0},journey:{diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,useMaxWidth:!0,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"]},timeline:{diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,useMaxWidth:!0,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},class:{titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,useMaxWidth:!0,defaultRenderer:"dagre-wrapper"},state:{titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,useMaxWidth:!0,defaultRenderer:"dagre-wrapper"},er:{titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,stroke:"gray",fill:"honeydew",fontSize:12,useMaxWidth:!0},pie:{useWidth:void 0,useMaxWidth:!0},requirement:{useWidth:void 0,useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},gitGraph:{titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0},c4:{useWidth:void 0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,useMaxWidth:!0,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,personFont:function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},external_personFont:function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},systemFont:function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},external_systemFont:function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},system_dbFont:function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},external_system_dbFont:function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},system_queueFont:function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},external_system_queueFont:function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},containerFont:function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},external_containerFont:function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},container_dbFont:function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},external_container_dbFont:function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},container_queueFont:function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},external_container_queueFont:function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},componentFont:function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},external_componentFont:function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},component_dbFont:function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},external_component_dbFont:function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},component_queueFont:function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},external_component_queueFont:function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},boundaryFont:function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},messageFont:function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200},fontSize:16};Vt.class&&(Vt.class.arrowMarkerAbsolute=Vt.arrowMarkerAbsolute),Vt.gitGraph&&(Vt.gitGraph.arrowMarkerAbsolute=Vt.arrowMarkerAbsolute);const Gt=(t,e="")=>Object.keys(t).reduce(((n,r)=>Array.isArray(t[r])?n:"object"==typeof t[r]&&null!==t[r]?[...n,e+r,...Gt(t[r],"")]:[...n,e+r]),[]),Jt=Gt(Vt,""),Xt=Vt;function Kt(t){return null==t}var Qt={isNothing:Kt,isObject:function(t){return"object"==typeof t&&null!==t},toArray:function(t){return Array.isArray(t)?t:Kt(t)?[]:[t]},repeat:function(t,e){var n,r="";for(n=0;n<e;n+=1)r+=t;return r},isNegativeZero:function(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t},extend:function(t,e){var n,r,i,a;if(e)for(n=0,r=(a=Object.keys(e)).length;n<r;n+=1)t[i=a[n]]=e[i];return t}};function te(t,e){var n="",r=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(n+='in "'+t.mark.name+'" '),n+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(n+="\n\n"+t.mark.snippet),r+" "+n):r}function ee(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=te(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}ee.prototype=Object.create(Error.prototype),ee.prototype.constructor=ee,ee.prototype.toString=function(t){return this.name+": "+te(this,t)};var ne=ee;function re(t,e,n,r,i){var a="",s="",o=Math.floor(i/2)-1;return r-e>o&&(e=r-o+(a=" ... ").length),n-r>o&&(n=r+o-(s=" ...").length),{str:a+t.slice(e,n).replace(/\t/g,"\u2192")+s,pos:r-e+a.length}}function ie(t,e){return Qt.repeat(" ",e-t.length)+t}var ae=function(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),"number"!=typeof e.indent&&(e.indent=1),"number"!=typeof e.linesBefore&&(e.linesBefore=3),"number"!=typeof e.linesAfter&&(e.linesAfter=2);for(var n,r=/\r?\n|\r|\0/g,i=[0],a=[],s=-1;n=r.exec(t.buffer);)a.push(n.index),i.push(n.index+n[0].length),t.position<=n.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var o,l,c="",u=Math.min(t.line+e.linesAfter,a.length).toString().length,d=e.maxLength-(e.indent+u+3);for(o=1;o<=e.linesBefore&&!(s-o<0);o++)l=re(t.buffer,i[s-o],a[s-o],t.position-(i[s]-i[s-o]),d),c=Qt.repeat(" ",e.indent)+ie((t.line-o+1).toString(),u)+" | "+l.str+"\n"+c;for(l=re(t.buffer,i[s],a[s],t.position,d),c+=Qt.repeat(" ",e.indent)+ie((t.line+1).toString(),u)+" | "+l.str+"\n",c+=Qt.repeat("-",e.indent+u+3+l.pos)+"^\n",o=1;o<=e.linesAfter&&!(s+o>=a.length);o++)l=re(t.buffer,i[s+o],a[s+o],t.position-(i[s]-i[s+o]),d),c+=Qt.repeat(" ",e.indent)+ie((t.line+o+1).toString(),u)+" | "+l.str+"\n";return c.replace(/\n$/,"")},se=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],oe=["scalar","sequence","mapping"];var le=function(t,e){var n,r;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===se.indexOf(e))throw new ne('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=(n=e.styleAliases||null,r={},null!==n&&Object.keys(n).forEach((function(t){n[t].forEach((function(e){r[String(e)]=t}))})),r),-1===oe.indexOf(this.kind))throw new ne('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function ce(t,e){var n=[];return t[e].forEach((function(t){var e=n.length;n.forEach((function(n,r){n.tag===t.tag&&n.kind===t.kind&&n.multi===t.multi&&(e=r)})),n[e]=t})),n}function ue(t){return this.extend(t)}ue.prototype.extend=function(t){var e=[],n=[];if(t instanceof le)n.push(t);else if(Array.isArray(t))n=n.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new ne("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(e=e.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit))}e.forEach((function(t){if(!(t instanceof le))throw new ne("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new ne("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new ne("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(t){if(!(t instanceof le))throw new ne("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var r=Object.create(ue.prototype);return r.implicit=(this.implicit||[]).concat(e),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=ce(r,"implicit"),r.compiledExplicit=ce(r,"explicit"),r.compiledTypeMap=function(){var t,e,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function r(t){t.multi?(n.multi[t.kind].push(t),n.multi.fallback.push(t)):n[t.kind][t.tag]=n.fallback[t.tag]=t}for(t=0,e=arguments.length;t<e;t+=1)arguments[t].forEach(r);return n}(r.compiledImplicit,r.compiledExplicit),r};var de=new ue({explicit:[new le("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}}),new le("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}}),new le("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}})]});var he=new le("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)},construct:function(){return null},predicate:function(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var me=new le("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)},construct:function(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function _e(t){return 48<=t&&t<=55}function pe(t){return 48<=t&&t<=57}var fe=new le("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,r=t.length,i=0,a=!1;if(!r)return!1;if("-"!==(e=t[i])&&"+"!==e||(e=t[++i]),"0"===e){if(i+1===r)return!0;if("b"===(e=t[++i])){for(i++;i<r;i++)if("_"!==(e=t[i])){if("0"!==e&&"1"!==e)return!1;a=!0}return a&&"_"!==e}if("x"===e){for(i++;i<r;i++)if("_"!==(e=t[i])){if(!(48<=(n=t.charCodeAt(i))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1;a=!0}return a&&"_"!==e}if("o"===e){for(i++;i<r;i++)if("_"!==(e=t[i])){if(!_e(t.charCodeAt(i)))return!1;a=!0}return a&&"_"!==e}}if("_"===e)return!1;for(;i<r;i++)if("_"!==(e=t[i])){if(!pe(t.charCodeAt(i)))return!1;a=!0}return!(!a||"_"===e)},construct:function(t){var e,n=t,r=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(e=n[0])&&"+"!==e||("-"===e&&(r=-1),e=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===e){if("b"===n[1])return r*parseInt(n.slice(2),2);if("x"===n[1])return r*parseInt(n.slice(2),16);if("o"===n[1])return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!Qt.isNegativeZero(t)},represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),ye=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var ge=/^[-+]?[0-9]+e/;var be=new le("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!ye.test(t)||"_"===t[t.length-1])},construct:function(t){var e,n;return n="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:n*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||Qt.isNegativeZero(t))},represent:function(t,e){var n;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Qt.isNegativeZero(t))return"-0.0";return n=t.toString(10),ge.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),ke=de.extend({implicit:[he,me,fe,be]}),ve=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),xe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var Me=new le("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==ve.exec(t)||null!==xe.exec(t))},construct:function(t){var e,n,r,i,a,s,o,l,c=0,u=null;if(null===(e=ve.exec(t))&&(e=xe.exec(t)),null===e)throw new Error("Date resolve error");if(n=+e[1],r=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(n,r,i));if(a=+e[4],s=+e[5],o=+e[6],e[7]){for(c=e[7].slice(0,3);c.length<3;)c+="0";c=+c}return e[9]&&(u=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(u=-u)),l=new Date(Date.UTC(n,r,i,a,s,o,c)),u&&l.setTime(l.getTime()-u),l},instanceOf:Date,represent:function(t){return t.toISOString()}});var Le=new le("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Te=new le("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,r=0,i=t.length,a=we;for(n=0;n<i;n++)if(!((e=a.indexOf(t.charAt(n)))>64)){if(e<0)return!1;r+=6}return r%8==0},construct:function(t){var e,n,r=t.replace(/[\r\n=]/g,""),i=r.length,a=we,s=0,o=[];for(e=0;e<i;e++)e%4==0&&e&&(o.push(s>>16&255),o.push(s>>8&255),o.push(255&s)),s=s<<6|a.indexOf(r.charAt(e));return 0===(n=i%4*6)?(o.push(s>>16&255),o.push(s>>8&255),o.push(255&s)):18===n?(o.push(s>>10&255),o.push(s>>2&255)):12===n&&o.push(s>>4&255),new Uint8Array(o)},predicate:function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function(t){var e,n,r="",i=0,a=t.length,s=we;for(e=0;e<a;e++)e%3==0&&e&&(r+=s[i>>18&63],r+=s[i>>12&63],r+=s[i>>6&63],r+=s[63&i]),i=(i<<8)+t[e];return 0===(n=a%3)?(r+=s[i>>18&63],r+=s[i>>12&63],r+=s[i>>6&63],r+=s[63&i]):2===n?(r+=s[i>>10&63],r+=s[i>>4&63],r+=s[i<<2&63],r+=s[64]):1===n&&(r+=s[i>>2&63],r+=s[i<<4&63],r+=s[64],r+=s[64]),r}}),Se=Object.prototype.hasOwnProperty,De=Object.prototype.toString;var Ye=new le("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,r,i,a,s=[],o=t;for(e=0,n=o.length;e<n;e+=1){if(r=o[e],a=!1,"[object Object]"!==De.call(r))return!1;for(i in r)if(Se.call(r,i)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==s.indexOf(i))return!1;s.push(i)}return!0},construct:function(t){return null!==t?t:[]}}),Ee=Object.prototype.toString;var Ce=new le("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,r,i,a,s=t;for(a=new Array(s.length),e=0,n=s.length;e<n;e+=1){if(r=s[e],"[object Object]"!==Ee.call(r))return!1;if(1!==(i=Object.keys(r)).length)return!1;a[e]=[i[0],r[i[0]]]}return!0},construct:function(t){if(null===t)return[];var e,n,r,i,a,s=t;for(a=new Array(s.length),e=0,n=s.length;e<n;e+=1)r=s[e],i=Object.keys(r),a[e]=[i[0],r[i[0]]];return a}}),Ae=Object.prototype.hasOwnProperty;var Oe=new le("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(t){if(null===t)return!0;var e,n=t;for(e in n)if(Ae.call(n,e)&&null!==n[e])return!1;return!0},construct:function(t){return null!==t?t:{}}}),Ne=ke.extend({implicit:[Me,Le],explicit:[Te,Ye,Ce,Oe]}),Be=Object.prototype.hasOwnProperty,Fe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Ie=/[\x85\u2028\u2029]/,Pe=/[,\[\]\{\}]/,je=/^(?:!|!!|![a-z\-]+!)$/i,Re=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function He(t){return Object.prototype.toString.call(t)}function $e(t){return 10===t||13===t}function Ze(t){return 9===t||32===t}function We(t){return 9===t||32===t||10===t||13===t}function ze(t){return 44===t||91===t||93===t||123===t||125===t}function Ue(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function qe(t){return 48===t?"\0":97===t?"\x07":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"\x1b":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"\x85":95===t?"\xa0":76===t?"\u2028":80===t?"\u2029":""}function Ve(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var Ge=new Array(256),Je=new Array(256),Xe=0;Xe<256;Xe++)Ge[Xe]=qe(Xe)?1:0,Je[Xe]=qe(Xe);function Ke(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Ne,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Qe(t,e){var n={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return n.snippet=ae(n),new ne(e,n)}function tn(t,e){throw Qe(t,e)}function en(t,e){t.onWarning&&t.onWarning.call(null,Qe(t,e))}var nn={YAML:function(t,e,n){var r,i,a;null!==t.version&&tn(t,"duplication of %YAML directive"),1!==n.length&&tn(t,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&tn(t,"ill-formed argument of the YAML directive"),i=parseInt(r[1],10),a=parseInt(r[2],10),1!==i&&tn(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,1!==a&&2!==a&&en(t,"unsupported YAML version of the document")},TAG:function(t,e,n){var r,i;2!==n.length&&tn(t,"TAG directive accepts exactly two arguments"),r=n[0],i=n[1],je.test(r)||tn(t,"ill-formed tag handle (first argument) of the TAG directive"),Be.call(t.tagMap,r)&&tn(t,'there is a previously declared suffix for "'+r+'" tag handle'),Re.test(i)||tn(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(a){tn(t,"tag prefix is malformed: "+i)}t.tagMap[r]=i}};function rn(t,e,n,r){var i,a,s,o;if(e<n){if(o=t.input.slice(e,n),r)for(i=0,a=o.length;i<a;i+=1)9===(s=o.charCodeAt(i))||32<=s&&s<=1114111||tn(t,"expected valid JSON character");else Fe.test(o)&&tn(t,"the stream contains non-printable characters");t.result+=o}}function an(t,e,n,r){var i,a,s,o;for(Qt.isObject(n)||tn(t,"cannot merge mappings; the provided source object is unacceptable"),s=0,o=(i=Object.keys(n)).length;s<o;s+=1)a=i[s],Be.call(e,a)||(e[a]=n[a],r[a]=!0)}function sn(t,e,n,r,i,a,s,o,l){var c,u;if(Array.isArray(i))for(c=0,u=(i=Array.prototype.slice.call(i)).length;c<u;c+=1)Array.isArray(i[c])&&tn(t,"nested arrays are not supported inside keys"),"object"==typeof i&&"[object Object]"===He(i[c])&&(i[c]="[object Object]");if("object"==typeof i&&"[object Object]"===He(i)&&(i="[object Object]"),i=String(i),null===e&&(e={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(a))for(c=0,u=a.length;c<u;c+=1)an(t,e,a[c],n);else an(t,e,a,n);else t.json||Be.call(n,i)||!Be.call(e,i)||(t.line=s||t.line,t.lineStart=o||t.lineStart,t.position=l||t.position,tn(t,"duplicated mapping key")),"__proto__"===i?Object.defineProperty(e,i,{configurable:!0,enumerable:!0,writable:!0,value:a}):e[i]=a,delete n[i];return e}function on(t){var e;10===(e=t.input.charCodeAt(t.position))?t.position++:13===e?(t.position++,10===t.input.charCodeAt(t.position)&&t.position++):tn(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function ln(t,e,n){for(var r=0,i=t.input.charCodeAt(t.position);0!==i;){for(;Ze(i);)9===i&&-1===t.firstTabInLine&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&35===i)do{i=t.input.charCodeAt(++t.position)}while(10!==i&&13!==i&&0!==i);if(!$e(i))break;for(on(t),i=t.input.charCodeAt(t.position),r++,t.lineIndent=0;32===i;)t.lineIndent++,i=t.input.charCodeAt(++t.position)}return-1!==n&&0!==r&&t.lineIndent<n&&en(t,"deficient indentation"),r}function cn(t){var e,n=t.position;return!(45!==(e=t.input.charCodeAt(n))&&46!==e||e!==t.input.charCodeAt(n+1)||e!==t.input.charCodeAt(n+2)||(n+=3,0!==(e=t.input.charCodeAt(n))&&!We(e)))}function un(t,e){1===e?t.result+=" ":e>1&&(t.result+=Qt.repeat("\n",e-1))}function dn(t,e){var n,r,i=t.tag,a=t.anchor,s=[],o=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=s),r=t.input.charCodeAt(t.position);0!==r&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,tn(t,"tab characters must not be used in indentation")),45===r)&&We(t.input.charCodeAt(t.position+1));)if(o=!0,t.position++,ln(t,!0,-1)&&t.lineIndent<=e)s.push(null),r=t.input.charCodeAt(t.position);else if(n=t.line,_n(t,e,3,!1,!0),s.push(t.result),ln(t,!0,-1),r=t.input.charCodeAt(t.position),(t.line===n||t.lineIndent>e)&&0!==r)tn(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break;return!!o&&(t.tag=i,t.anchor=a,t.kind="sequence",t.result=s,!0)}function hn(t){var e,n,r,i,a=!1,s=!1;if(33!==(i=t.input.charCodeAt(t.position)))return!1;if(null!==t.tag&&tn(t,"duplication of a tag property"),60===(i=t.input.charCodeAt(++t.position))?(a=!0,i=t.input.charCodeAt(++t.position)):33===i?(s=!0,n="!!",i=t.input.charCodeAt(++t.position)):n="!",e=t.position,a){do{i=t.input.charCodeAt(++t.position)}while(0!==i&&62!==i);t.position<t.length?(r=t.input.slice(e,t.position),i=t.input.charCodeAt(++t.position)):tn(t,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!We(i);)33===i&&(s?tn(t,"tag suffix cannot contain exclamation marks"):(n=t.input.slice(e-1,t.position+1),je.test(n)||tn(t,"named tag handle cannot contain such characters"),s=!0,e=t.position+1)),i=t.input.charCodeAt(++t.position);r=t.input.slice(e,t.position),Pe.test(r)&&tn(t,"tag suffix cannot contain flow indicator characters")}r&&!Re.test(r)&&tn(t,"tag name cannot contain such characters: "+r);try{r=decodeURIComponent(r)}catch(o){tn(t,"tag name is malformed: "+r)}return a?t.tag=r:Be.call(t.tagMap,n)?t.tag=t.tagMap[n]+r:"!"===n?t.tag="!"+r:"!!"===n?t.tag="tag:yaml.org,2002:"+r:tn(t,'undeclared tag handle "'+n+'"'),!0}function mn(t){var e,n;if(38!==(n=t.input.charCodeAt(t.position)))return!1;for(null!==t.anchor&&tn(t,"duplication of an anchor property"),n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!We(n)&&!ze(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&tn(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function _n(t,e,n,r,i){var a,s,o,l,c,u,d,h,m,_=1,p=!1,f=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=s=o=4===n||3===n,r&&ln(t,!0,-1)&&(p=!0,t.lineIndent>e?_=1:t.lineIndent===e?_=0:t.lineIndent<e&&(_=-1)),1===_)for(;hn(t)||mn(t);)ln(t,!0,-1)?(p=!0,o=a,t.lineIndent>e?_=1:t.lineIndent===e?_=0:t.lineIndent<e&&(_=-1)):o=!1;if(o&&(o=p||i),1!==_&&4!==n||(h=1===n||2===n?e:e+1,m=t.position-t.lineStart,1===_?o&&(dn(t,m)||function(t,e,n){var r,i,a,s,o,l,c,u=t.tag,d=t.anchor,h={},m=Object.create(null),_=null,p=null,f=null,y=!1,g=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=h),c=t.input.charCodeAt(t.position);0!==c;){if(y||-1===t.firstTabInLine||(t.position=t.firstTabInLine,tn(t,"tab characters must not be used in indentation")),r=t.input.charCodeAt(t.position+1),a=t.line,63!==c&&58!==c||!We(r)){if(s=t.line,o=t.lineStart,l=t.position,!_n(t,n,2,!1,!0))break;if(t.line===a){for(c=t.input.charCodeAt(t.position);Ze(c);)c=t.input.charCodeAt(++t.position);if(58===c)We(c=t.input.charCodeAt(++t.position))||tn(t,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(sn(t,h,m,_,p,null,s,o,l),_=p=f=null),g=!0,y=!1,i=!1,_=t.tag,p=t.result;else{if(!g)return t.tag=u,t.anchor=d,!0;tn(t,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return t.tag=u,t.anchor=d,!0;tn(t,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===c?(y&&(sn(t,h,m,_,p,null,s,o,l),_=p=f=null),g=!0,y=!0,i=!0):y?(y=!1,i=!0):tn(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,c=r;if((t.line===a||t.lineIndent>e)&&(y&&(s=t.line,o=t.lineStart,l=t.position),_n(t,e,4,!0,i)&&(y?p=t.result:f=t.result),y||(sn(t,h,m,_,p,f,s,o,l),_=p=f=null),ln(t,!0,-1),c=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&0!==c)tn(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return y&&sn(t,h,m,_,p,null,s,o,l),g&&(t.tag=u,t.anchor=d,t.kind="mapping",t.result=h),g}(t,m,h))||function(t,e){var n,r,i,a,s,o,l,c,u,d,h,m,_=!0,p=t.tag,f=t.anchor,y=Object.create(null);if(91===(m=t.input.charCodeAt(t.position)))s=93,c=!1,a=[];else{if(123!==m)return!1;s=125,c=!0,a={}}for(null!==t.anchor&&(t.anchorMap[t.anchor]=a),m=t.input.charCodeAt(++t.position);0!==m;){if(ln(t,!0,e),(m=t.input.charCodeAt(t.position))===s)return t.position++,t.tag=p,t.anchor=f,t.kind=c?"mapping":"sequence",t.result=a,!0;_?44===m&&tn(t,"expected the node content, but found ','"):tn(t,"missed comma between flow collection entries"),h=null,o=l=!1,63===m&&We(t.input.charCodeAt(t.position+1))&&(o=l=!0,t.position++,ln(t,!0,e)),n=t.line,r=t.lineStart,i=t.position,_n(t,e,1,!1,!0),d=t.tag,u=t.result,ln(t,!0,e),m=t.input.charCodeAt(t.position),!l&&t.line!==n||58!==m||(o=!0,m=t.input.charCodeAt(++t.position),ln(t,!0,e),_n(t,e,1,!1,!0),h=t.result),c?sn(t,a,y,d,u,h,n,r,i):o?a.push(sn(t,null,y,d,u,h,n,r,i)):a.push(u),ln(t,!0,e),44===(m=t.input.charCodeAt(t.position))?(_=!0,m=t.input.charCodeAt(++t.position)):_=!1}tn(t,"unexpected end of the stream within a flow collection")}(t,h)?f=!0:(s&&function(t,e){var n,r,i,a,s,o=1,l=!1,c=!1,u=e,d=0,h=!1;if(124===(a=t.input.charCodeAt(t.position)))r=!1;else{if(62!==a)return!1;r=!0}for(t.kind="scalar",t.result="";0!==a;)if(43===(a=t.input.charCodeAt(++t.position))||45===a)1===o?o=43===a?3:2:tn(t,"repeat of a chomping mode identifier");else{if(!((i=48<=(s=a)&&s<=57?s-48:-1)>=0))break;0===i?tn(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?tn(t,"repeat of an indentation width identifier"):(u=e+i-1,c=!0)}if(Ze(a)){do{a=t.input.charCodeAt(++t.position)}while(Ze(a));if(35===a)do{a=t.input.charCodeAt(++t.position)}while(!$e(a)&&0!==a)}for(;0!==a;){for(on(t),t.lineIndent=0,a=t.input.charCodeAt(t.position);(!c||t.lineIndent<u)&&32===a;)t.lineIndent++,a=t.input.charCodeAt(++t.position);if(!c&&t.lineIndent>u&&(u=t.lineIndent),$e(a))d++;else{if(t.lineIndent<u){3===o?t.result+=Qt.repeat("\n",l?1+d:d):1===o&&l&&(t.result+="\n");break}for(r?Ze(a)?(h=!0,t.result+=Qt.repeat("\n",l?1+d:d)):h?(h=!1,t.result+=Qt.repeat("\n",d+1)):0===d?l&&(t.result+=" "):t.result+=Qt.repeat("\n",d):t.result+=Qt.repeat("\n",l?1+d:d),l=!0,c=!0,d=0,n=t.position;!$e(a)&&0!==a;)a=t.input.charCodeAt(++t.position);rn(t,n,t.position,!1)}}return!0}(t,h)||function(t,e){var n,r,i;if(39!==(n=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,r=i=t.position;0!==(n=t.input.charCodeAt(t.position));)if(39===n){if(rn(t,r,t.position,!0),39!==(n=t.input.charCodeAt(++t.position)))return!0;r=t.position,t.position++,i=t.position}else $e(n)?(rn(t,r,i,!0),un(t,ln(t,!1,e)),r=i=t.position):t.position===t.lineStart&&cn(t)?tn(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);tn(t,"unexpected end of the stream within a single quoted scalar")}(t,h)||function(t,e){var n,r,i,a,s,o,l;if(34!==(o=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,n=r=t.position;0!==(o=t.input.charCodeAt(t.position));){if(34===o)return rn(t,n,t.position,!0),t.position++,!0;if(92===o){if(rn(t,n,t.position,!0),$e(o=t.input.charCodeAt(++t.position)))ln(t,!1,e);else if(o<256&&Ge[o])t.result+=Je[o],t.position++;else if((s=120===(l=o)?2:117===l?4:85===l?8:0)>0){for(i=s,a=0;i>0;i--)(s=Ue(o=t.input.charCodeAt(++t.position)))>=0?a=(a<<4)+s:tn(t,"expected hexadecimal character");t.result+=Ve(a),t.position++}else tn(t,"unknown escape sequence");n=r=t.position}else $e(o)?(rn(t,n,r,!0),un(t,ln(t,!1,e)),n=r=t.position):t.position===t.lineStart&&cn(t)?tn(t,"unexpected end of the document within a double quoted scalar"):(t.position++,r=t.position)}tn(t,"unexpected end of the stream within a double quoted scalar")}(t,h)?f=!0:!function(t){var e,n,r;if(42!==(r=t.input.charCodeAt(t.position)))return!1;for(r=t.input.charCodeAt(++t.position),e=t.position;0!==r&&!We(r)&&!ze(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&tn(t,"name of an alias node must contain at least one character"),n=t.input.slice(e,t.position),Be.call(t.anchorMap,n)||tn(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],ln(t,!0,-1),!0}(t)?function(t,e,n){var r,i,a,s,o,l,c,u,d=t.kind,h=t.result;if(We(u=t.input.charCodeAt(t.position))||ze(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(We(r=t.input.charCodeAt(t.position+1))||n&&ze(r)))return!1;for(t.kind="scalar",t.result="",i=a=t.position,s=!1;0!==u;){if(58===u){if(We(r=t.input.charCodeAt(t.position+1))||n&&ze(r))break}else if(35===u){if(We(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&cn(t)||n&&ze(u))break;if($e(u)){if(o=t.line,l=t.lineStart,c=t.lineIndent,ln(t,!1,-1),t.lineIndent>=e){s=!0,u=t.input.charCodeAt(t.position);continue}t.position=a,t.line=o,t.lineStart=l,t.lineIndent=c;break}}s&&(rn(t,i,a,!1),un(t,t.line-o),i=a=t.position,s=!1),Ze(u)||(a=t.position+1),u=t.input.charCodeAt(++t.position)}return rn(t,i,a,!1),!!t.result||(t.kind=d,t.result=h,!1)}(t,h,1===n)&&(f=!0,null===t.tag&&(t.tag="?")):(f=!0,null===t.tag&&null===t.anchor||tn(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===_&&(f=o&&dn(t,m))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&tn(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),l=0,c=t.implicitTypes.length;l<c;l+=1)if((d=t.implicitTypes[l]).resolve(t.result)){t.result=d.construct(t.result),t.tag=d.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else if("!"!==t.tag){if(Be.call(t.typeMap[t.kind||"fallback"],t.tag))d=t.typeMap[t.kind||"fallback"][t.tag];else for(d=null,l=0,c=(u=t.typeMap.multi[t.kind||"fallback"]).length;l<c;l+=1)if(t.tag.slice(0,u[l].tag.length)===u[l].tag){d=u[l];break}d||tn(t,"unknown tag !<"+t.tag+">"),null!==t.result&&d.kind!==t.kind&&tn(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+d.kind+'", not "'+t.kind+'"'),d.resolve(t.result,t.tag)?(t.result=d.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):tn(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||f}function pn(t){var e,n,r,i,a=t.position,s=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(i=t.input.charCodeAt(t.position))&&(ln(t,!0,-1),i=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==i));){for(s=!0,i=t.input.charCodeAt(++t.position),e=t.position;0!==i&&!We(i);)i=t.input.charCodeAt(++t.position);for(r=[],(n=t.input.slice(e,t.position)).length<1&&tn(t,"directive name must not be less than one character in length");0!==i;){for(;Ze(i);)i=t.input.charCodeAt(++t.position);if(35===i){do{i=t.input.charCodeAt(++t.position)}while(0!==i&&!$e(i));break}if($e(i))break;for(e=t.position;0!==i&&!We(i);)i=t.input.charCodeAt(++t.position);r.push(t.input.slice(e,t.position))}0!==i&&on(t),Be.call(nn,n)?nn[n](t,n,r):en(t,'unknown document directive "'+n+'"')}ln(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,ln(t,!0,-1)):s&&tn(t,"directives end mark is expected"),_n(t,t.lineIndent-1,4,!1,!0),ln(t,!0,-1),t.checkLineBreaks&&Ie.test(t.input.slice(a,t.position))&&en(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&cn(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,ln(t,!0,-1)):t.position<t.length-1&&tn(t,"end of the stream or a document separator is expected")}function fn(t,e){e=e||{},0!==(t=String(t)).length&&(10!==t.charCodeAt(t.length-1)&&13!==t.charCodeAt(t.length-1)&&(t+="\n"),65279===t.charCodeAt(0)&&(t=t.slice(1)));var n=new Ke(t,e),r=t.indexOf("\0");for(-1!==r&&(n.position=r,tn(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)pn(n);return n.documents}var yn=de,gn={loadAll:function(t,e,n){null!==e&&"object"==typeof e&&void 0===n&&(n=e,e=null);var r=fn(t,n);if("function"!=typeof e)return r;for(var i=0,a=r.length;i<a;i+=1)e(r[i])},load:function(t,e){var n=fn(t,e);if(0!==n.length){if(1===n.length)return n[0];throw new ne("expected a single document in the stream, but found more")}}}.load;const bn=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;const kn=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,vn=/\s*%%.*\n/gm,xn={},Mn=function(t,e){t=t.replace(bn,"").replace(kn,"").replace(vn,"\n");for(const[n,{detector:r}]of Object.entries(xn)){if(r(t,e))return n}throw new Error(`No diagram type detected for text: ${t}`)},Ln=(...t)=>{for(const{id:e,detector:n,loader:r}of t)wn(e,n,r)},wn=(t,e,n)=>{xn[t]?St.error(`Detector with key ${t} already exists`):xn[t]={detector:e,loader:n},St.debug(`Detector with key ${t} added${n?" with loader":""}`)},Tn=function(t,e,n){const{depth:r,clobber:i}=Object.assign({depth:2,clobber:!1},n);return Array.isArray(e)&&!Array.isArray(t)?(e.forEach((e=>Tn(t,e,n))),t):Array.isArray(e)&&Array.isArray(t)?(e.forEach((e=>{t.includes(e)||t.push(e)})),t):void 0===t||r<=0?null!=t&&"object"==typeof t&&"object"==typeof e?Object.assign(t,e):e:(void 0!==e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).forEach((n=>{"object"!=typeof e[n]||void 0!==t[n]&&"object"!=typeof t[n]?(i||"object"!=typeof t[n]&&"object"!=typeof e[n])&&(t[n]=e[n]):(void 0===t[n]&&(t[n]=Array.isArray(e[n])?[]:{}),t[n]=Tn(t[n],e[n],{depth:r-1,clobber:i}))})),t)},Sn=Tn,Dn={curveBasis:o.$0Z,curveBasisClosed:o.Dts,curveBasisOpen:o.WQY,curveBumpX:o.qpX,curveBumpY:o.u93,curveBundle:o.tFB,curveCardinalClosed:o.OvA,curveCardinalOpen:o.dCK,curveCardinal:o.YY7,curveCatmullRomClosed:o.fGX,curveCatmullRomOpen:o.$m7,curveCatmullRom:o.zgE,curveLinear:o.c_6,curveLinearClosed:o.fxm,curveMonotoneX:o.FdL,curveMonotoneY:o.ak_,curveNatural:o.SxZ,curveStep:o.eA_,curveStepAfter:o.jsv,curveStepBefore:o.iJ},Yn=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,En=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Cn=function(t,e=null){try{const n=new RegExp(`[%]{2}(?![{]${En.source})(?=[}][%]{2}).*\n`,"ig");let r;t=t.trim().replace(n,"").replace(/'/gm,'"'),St.debug(`Detecting diagram directive${null!==e?" type:"+e:""} based on the text:${t}`);const i=[];for(;null!==(r=Yn.exec(t));)if(r.index===Yn.lastIndex&&Yn.lastIndex++,r&&!e||e&&r[1]&&r[1].match(e)||e&&r[2]&&r[2].match(e)){const t=r[1]?r[1]:r[2],e=r[3]?r[3].trim():r[4]?JSON.parse(r[4].trim()):null;i.push({type:t,args:e})}return 0===i.length&&i.push({type:t,args:null}),1===i.length?i[0]:i}catch(n){return St.error(`ERROR: ${n.message} - Unable to parse directive\n ${null!==e?" type:"+e:""} based on the text:${t}`),{type:null,args:null}}};function An(t,e){if(!t)return e;const n=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return Dn[n]||e}function On(t,e){return t&&e?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):0}function Nn(t){let e="",n="";for(const r of t)void 0!==r&&(r.startsWith("color:")||r.startsWith("text-align:")?n=n+r+";":e=e+r+";");return{style:e,labelStyle:n}}let Bn=0;const Fn=()=>(Bn++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Bn);const In=t=>function(t){let e="";const n="0123456789abcdef",r=n.length;for(let i=0;i<t;i++)e+=n.charAt(Math.floor(Math.random()*r));return e}(t.length),Pn=function(t,e){const n=e.text.replace(Pt.lineBreakRegex," "),[,r]=Vn(e.fontSize),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.style("text-anchor",e.anchor),i.style("font-family",e.fontFamily),i.style("font-size",r),i.style("font-weight",e.fontWeight),i.attr("fill",e.fill),void 0!==e.class&&i.attr("class",e.class);const a=i.append("tspan");return a.attr("x",e.x+2*e.textMargin),a.attr("fill",e.fill),a.text(n),i},jn=(0,v.Z)(((t,e,n)=>{if(!t)return t;if(n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},n),Pt.lineBreakRegex.test(t))return t;const r=t.split(" "),i=[];let a="";return r.forEach(((t,s)=>{const o=$n(`${t} `,n),l=$n(a,n);if(o>e){const{hyphenatedStrings:r,remainingWord:s}=Rn(t,e,"-",n);i.push(a,...r),a=s}else l+o>=e?(i.push(a),a=t):a=[a,t].filter(Boolean).join(" ");s+1===r.length&&i.push(a)})),i.filter((t=>""!==t)).join(n.joinWith)}),((t,e,n)=>`${t}${e}${n.fontSize}${n.fontWeight}${n.fontFamily}${n.joinWith}`)),Rn=(0,v.Z)(((t,e,n="-",r)=>{r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},r);const i=[...t],a=[];let s="";return i.forEach(((t,o)=>{const l=`${s}${t}`;if($n(l,r)>=e){const t=o+1,e=i.length===t,r=`${l}${n}`;a.push(e?l:r),s=""}else s=l})),{hyphenatedStrings:a,remainingWord:s}}),((t,e,n="-",r)=>`${t}${e}${n}${r.fontSize}${r.fontWeight}${r.fontFamily}`));function Hn(t,e){return e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:15},e),Zn(t,e).height}function $n(t,e){return e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial"},e),Zn(t,e).width}const Zn=(0,v.Z)(((t,e)=>{e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial"},e);const{fontSize:n,fontFamily:r,fontWeight:i}=e;if(!t)return{width:0,height:0};const[,a]=Vn(n),s=["sans-serif",r],l=t.split(Pt.lineBreakRegex),c=[],u=(0,o.Ys)("body");if(!u.remove)return{width:0,height:0,lineHeight:0};const d=u.append("svg");for(const o of s){let t=0;const e={width:0,height:0,lineHeight:0};for(const n of l){const r={x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0};r.text=n;const s=Pn(d,r).style("font-size",a).style("font-weight",i).style("font-family",o),l=(s._groups||s)[0][0].getBBox();e.width=Math.round(Math.max(e.width,l.width)),t=Math.round(l.height),e.height+=t,e.lineHeight=Math.round(Math.max(e.lineHeight,t))}c.push(e)}d.remove();return c[isNaN(c[1].height)||isNaN(c[1].width)||isNaN(c[1].lineHeight)||c[0].height>c[1].height&&c[0].width>c[1].width&&c[0].lineHeight>c[1].lineHeight?0:1]}),((t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`));let Wn;const zn=t=>{if(St.debug("directiveSanitizer called with",t),"object"==typeof t&&(t.length?t.forEach((t=>zn(t))):Object.keys(t).forEach((e=>{St.debug("Checking key",e),e.startsWith("__")&&(St.debug("sanitize deleting __ option",e),delete t[e]),e.includes("proto")&&(St.debug("sanitize deleting proto option",e),delete t[e]),e.includes("constr")&&(St.debug("sanitize deleting constr option",e),delete t[e]),e.includes("themeCSS")&&(St.debug("sanitizing themeCss option"),t[e]=Un(t[e])),e.includes("fontFamily")&&(St.debug("sanitizing fontFamily option"),t[e]=Un(t[e])),e.includes("altFontFamily")&&(St.debug("sanitizing altFontFamily option"),t[e]=Un(t[e])),Jt.includes(e)?"object"==typeof t[e]&&(St.debug("sanitize deleting object",e),zn(t[e])):(St.debug("sanitize deleting option",e),delete t[e])}))),t.themeVariables){const e=Object.keys(t.themeVariables);for(const n of e){const e=t.themeVariables[n];e&&e.match&&!e.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[n]="")}}St.debug("After sanitization",t)},Un=t=>{let e=0,n=0;for(const r of t){if(e<n)return"{ /* ERROR: Unbalanced CSS */ }";"{"===r?e++:"}"===r&&n++}return e!==n?"{ /* ERROR: Unbalanced CSS */ }":t};function qn(t){return"str"in t}const Vn=t=>{if("number"==typeof t)return[t,t+"px"];const e=parseInt(t,10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},Gn={assignWithDepth:Sn,wrapLabel:jn,calculateTextHeight:Hn,calculateTextWidth:$n,calculateTextDimensions:Zn,detectInit:function(t,e){const n=Cn(t,/(?:init\b)|(?:initialize\b)/);let r={};if(Array.isArray(n)){const t=n.map((t=>t.args));zn(t),r=Sn(r,[...t])}else r=n.args;if(r){let n=Mn(t,e);["config"].forEach((t=>{void 0!==r[t]&&("flowchart-v2"===n&&(n="flowchart"),r[n]=r[t],delete r[t])}))}return r},detectDirective:Cn,isSubstringInArray:function(t,e){for(const[n,r]of e.entries())if(r.match(t))return n;return-1},interpolateToCurve:An,calcLabelPosition:function(t){return 1===t.length?t[0]:function(t){let e,n=0;t.forEach((t=>{n+=On(t,e),e=t}));let r,i=n/2;return e=void 0,t.forEach((t=>{if(e&&!r){const n=On(t,e);if(n<i)i-=n;else{const a=i/n;a<=0&&(r=e),a>=1&&(r={x:t.x,y:t.y}),a>0&&a<1&&(r={x:(1-a)*e.x+a*t.x,y:(1-a)*e.y+a*t.y})}}e=t})),r}(t)},calcCardinalityPosition:(t,e,n)=>{let r;St.info(`our points ${JSON.stringify(e)}`),e[0]!==n&&(e=e.reverse());let i,a=25;r=void 0,e.forEach((t=>{if(r&&!i){const e=On(t,r);if(e<a)a-=e;else{const n=a/e;n<=0&&(i=r),n>=1&&(i={x:t.x,y:t.y}),n>0&&n<1&&(i={x:(1-n)*r.x+n*t.x,y:(1-n)*r.y+n*t.y})}}r=t}));const s=t?10:5,o=Math.atan2(e[0].y-i.y,e[0].x-i.x),l={x:0,y:0};return l.x=Math.sin(o)*s+(e[0].x+i.x)/2,l.y=-Math.cos(o)*s+(e[0].y+i.y)/2,l},calcTerminalLabelPosition:function(t,e,n){let r,i=JSON.parse(JSON.stringify(n));St.info("our points",i),"start_left"!==e&&"start_right"!==e&&(i=i.reverse()),i.forEach((t=>{r=t}));let a,s=25+t;r=void 0,i.forEach((t=>{if(r&&!a){const e=On(t,r);if(e<s)s-=e;else{const n=s/e;n<=0&&(a=r),n>=1&&(a={x:t.x,y:t.y}),n>0&&n<1&&(a={x:(1-n)*r.x+n*t.x,y:(1-n)*r.y+n*t.y})}}r=t}));const o=10+.5*t,l=Math.atan2(i[0].y-a.y,i[0].x-a.x),c={x:0,y:0};return c.x=Math.sin(l)*o+(i[0].x+a.x)/2,c.y=-Math.cos(l)*o+(i[0].y+a.y)/2,"start_left"===e&&(c.x=Math.sin(l+Math.PI)*o+(i[0].x+a.x)/2,c.y=-Math.cos(l+Math.PI)*o+(i[0].y+a.y)/2),"end_right"===e&&(c.x=Math.sin(l-Math.PI)*o+(i[0].x+a.x)/2-5,c.y=-Math.cos(l-Math.PI)*o+(i[0].y+a.y)/2-5),"end_left"===e&&(c.x=Math.sin(l)*o+(i[0].x+a.x)/2-5,c.y=-Math.cos(l)*o+(i[0].y+a.y)/2-5),c},formatUrl:function(t,e){const n=t.trim();if(n)return"loose"!==e.securityLevel?(0,s.N)(n):n},getStylesFromArray:Nn,generateId:Fn,random:In,runFunc:(t,...e)=>{const n=t.split("."),r=n.length-1,i=n[r];let a=window;for(let s=0;s<r;s++)if(a=a[n[s]],!a)return;a[i](...e)},entityDecode:function(t){return Wn=Wn||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Wn.innerHTML=t,unescape(Wn.textContent)},initIdGenerator:class{constructor(t,e){this.deterministic=t,this.seed=e,this.count=e?e.length:0}next(){return this.deterministic?this.count++:Date.now()}},directiveSanitizer:zn,sanitizeCss:Un,insertTitle:(t,e,n,r)=>{if(!r)return;const i=t.node().getBBox();t.append("text").text(r).attr("x",i.x+i.width/2).attr("y",-n).attr("class",e)},parseFontSize:Vn},Jn="9.4.0",Xn=Object.freeze(Xt);let Kn,Qn=Sn({},Xn),tr=[],er=Sn({},Xn);const nr=(t,e)=>{let n=Sn({},t),r={};for(const i of e)sr(i),r=Sn(r,i);if(n=Sn(n,r),r.theme&&r.theme in qt){const t=Sn({},Kn),e=Sn(t.themeVariables||{},r.themeVariables);n.theme&&n.theme in qt&&(n.themeVariables=qt[n.theme].getThemeVariables(e))}return er=n,dr(er),er},rr=()=>Sn({},Qn),ir=t=>(dr(t),Sn(er,t),ar()),ar=()=>Sn({},er),sr=t=>{var e;["secure",...null!=(e=Qn.secure)?e:[]].forEach((e=>{void 0!==t[e]&&(St.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])})),Object.keys(t).forEach((e=>{0===e.indexOf("__")&&delete t[e]})),Object.keys(t).forEach((e=>{"string"==typeof t[e]&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],"object"==typeof t[e]&&sr(t[e])}))},or=t=>{t.fontFamily&&(t.themeVariables&&t.themeVariables.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),tr.push(t),nr(Qn,tr)},lr=(t=Qn)=>{tr=[],nr(t,tr)};var cr=(t=>(t.LAZY_LOAD_DEPRECATED="The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",t))(cr||{});const ur={},dr=t=>{var e;t&&((t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&(ur[e="LAZY_LOAD_DEPRECATED"]||(St.warn(cr[e]),ur[e]=!0)))},hr=function(t,e,n,r){const i=function(t,e,n){let r=new Map;return n?(r.set("width","100%"),r.set("style",`max-width: ${e}px;`)):(r.set("height",t),r.set("width",e)),r}(e,n,r);!function(t,e){for(let n of e)t.attr(n[0],n[1])}(t,i)},mr=function(t,e,n,r){const i=e.node().getBBox(),a=i.width,s=i.height;St.info(`SVG bounds: ${a}x${s}`,i);let o=0,l=0;St.info(`Graph bounds: ${o}x${l}`,t),o=a+2*n,l=s+2*n,St.info(`Calculated bounds: ${o}x${l}`),hr(e,l,o,r);const c=`${i.x-n} ${i.y-n} ${i.width+2*n} ${i.height+2*n}`;e.attr("viewBox",c)},_r=t=>`g.classGroup text {\n fill: ${t.nodeBorder};\n fill: ${t.classText};\n stroke: none;\n font-family: ${t.fontFamily};\n font-size: 10px;\n\n .title {\n font-weight: bolder;\n }\n\n}\n\n.nodeLabel, .edgeLabel {\n color: ${t.classText};\n}\n.edgeLabel .label rect {\n fill: ${t.mainBkg};\n}\n.label text {\n fill: ${t.classText};\n}\n.edgeLabel .label span {\n background: ${t.mainBkg};\n}\n\n.classTitle {\n font-weight: bolder;\n}\n.node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n\n.divider {\n stroke: ${t.nodeBorder};\n stroke: 1;\n}\n\ng.clickable {\n cursor: pointer;\n}\n\ng.classGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.classGroup line {\n stroke: ${t.nodeBorder};\n stroke-width: 1;\n}\n\n.classLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.classLabel .label {\n fill: ${t.nodeBorder};\n font-size: 10px;\n}\n\n.relation {\n stroke: ${t.lineColor};\n stroke-width: 1;\n fill: none;\n}\n\n.dashed-line{\n stroke-dasharray: 3;\n}\n\n.dotted-line{\n stroke-dasharray: 1 2;\n}\n\n#compositionStart, .composition {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#compositionEnd, .composition {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#extensionStart, .extension {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#extensionEnd, .extension {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#aggregationStart, .aggregation {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#aggregationEnd, .aggregation {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#lollipopStart, .lollipop {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#lollipopEnd, .lollipop {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n.edgeTerminals {\n font-size: 11px;\n}\n\n.classTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n`,pr=t=>`\n .entityBox {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n }\n\n .attributeBoxOdd {\n fill: ${t.attributeBackgroundColorOdd};\n stroke: ${t.nodeBorder};\n }\n\n .attributeBoxEven {\n fill: ${t.attributeBackgroundColorEven};\n stroke: ${t.nodeBorder};\n }\n\n .relationshipLabelBox {\n fill: ${t.tertiaryColor};\n opacity: 0.7;\n background-color: ${t.tertiaryColor};\n rect {\n opacity: 0.5;\n }\n }\n\n .relationshipLine {\n stroke: ${t.lineColor};\n }\n\n .entityTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n } \n`,fr=()=>"",yr=t=>`.label {\n font-family: ${t.fontFamily};\n color: ${t.nodeTextColor||t.textColor};\n }\n .cluster-label text {\n fill: ${t.titleColor};\n }\n .cluster-label span {\n color: ${t.titleColor};\n }\n\n .label text,span {\n fill: ${t.nodeTextColor||t.textColor};\n color: ${t.nodeTextColor||t.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ${t.clusterBkg};\n stroke: ${t.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n .cluster span {\n color: ${t.titleColor};\n }\n /* .cluster div {\n color: ${t.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${t.fontFamily};\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n`,gr=t=>`\n .mermaid-main-font {\n font-family: "trebuchet ms", verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n .exclude-range {\n fill: ${t.excludeBkgColor};\n }\n\n .section {\n stroke: none;\n opacity: 0.2;\n }\n\n .section0 {\n fill: ${t.sectionBkgColor};\n }\n\n .section2 {\n fill: ${t.sectionBkgColor2};\n }\n\n .section1,\n .section3 {\n fill: ${t.altSectionBkgColor};\n opacity: 0.2;\n }\n\n .sectionTitle0 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle1 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle2 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle3 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle {\n text-anchor: start;\n // font-size: ${t.ganttFontSize};\n // text-height: 14px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n\n /* Grid and axis */\n\n .grid .tick {\n stroke: ${t.gridColor};\n opacity: 0.8;\n shape-rendering: crispEdges;\n text {\n font-family: ${t.fontFamily};\n fill: ${t.textColor};\n }\n }\n\n .grid path {\n stroke-width: 0;\n }\n\n\n /* Today line */\n\n .today {\n fill: none;\n stroke: ${t.todayLineColor};\n stroke-width: 2px;\n }\n\n\n /* Task styling */\n\n /* Default task */\n\n .task {\n stroke-width: 2;\n }\n\n .taskText {\n text-anchor: middle;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n\n // .taskText:not([font-size]) {\n // font-size: ${t.ganttFontSize};\n // }\n\n .taskTextOutsideRight {\n fill: ${t.taskTextDarkColor};\n text-anchor: start;\n // font-size: ${t.ganttFontSize};\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n .taskTextOutsideLeft {\n fill: ${t.taskTextDarkColor};\n text-anchor: end;\n // font-size: ${t.ganttFontSize};\n }\n\n /* Special case clickable */\n .task.clickable {\n cursor: pointer;\n }\n .taskText.clickable {\n cursor: pointer;\n fill: ${t.taskTextClickableColor} !important;\n font-weight: bold;\n }\n\n .taskTextOutsideLeft.clickable {\n cursor: pointer;\n fill: ${t.taskTextClickableColor} !important;\n font-weight: bold;\n }\n\n .taskTextOutsideRight.clickable {\n cursor: pointer;\n fill: ${t.taskTextClickableColor} !important;\n font-weight: bold;\n }\n\n /* Specific task settings for the sections*/\n\n .taskText0,\n .taskText1,\n .taskText2,\n .taskText3 {\n fill: ${t.taskTextColor};\n }\n\n .task0,\n .task1,\n .task2,\n .task3 {\n fill: ${t.taskBkgColor};\n stroke: ${t.taskBorderColor};\n }\n\n .taskTextOutside0,\n .taskTextOutside2\n {\n fill: ${t.taskTextOutsideColor};\n }\n\n .taskTextOutside1,\n .taskTextOutside3 {\n fill: ${t.taskTextOutsideColor};\n }\n\n\n /* Active task */\n\n .active0,\n .active1,\n .active2,\n .active3 {\n fill: ${t.activeTaskBkgColor};\n stroke: ${t.activeTaskBorderColor};\n }\n\n .activeText0,\n .activeText1,\n .activeText2,\n .activeText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n\n /* Completed task */\n\n .done0,\n .done1,\n .done2,\n .done3 {\n stroke: ${t.doneTaskBorderColor};\n fill: ${t.doneTaskBkgColor};\n stroke-width: 2;\n }\n\n .doneText0,\n .doneText1,\n .doneText2,\n .doneText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n\n /* Tasks on the critical line */\n\n .crit0,\n .crit1,\n .crit2,\n .crit3 {\n stroke: ${t.critBorderColor};\n fill: ${t.critBkgColor};\n stroke-width: 2;\n }\n\n .activeCrit0,\n .activeCrit1,\n .activeCrit2,\n .activeCrit3 {\n stroke: ${t.critBorderColor};\n fill: ${t.activeTaskBkgColor};\n stroke-width: 2;\n }\n\n .doneCrit0,\n .doneCrit1,\n .doneCrit2,\n .doneCrit3 {\n stroke: ${t.critBorderColor};\n fill: ${t.doneTaskBkgColor};\n stroke-width: 2;\n cursor: pointer;\n shape-rendering: crispEdges;\n }\n\n .milestone {\n transform: rotate(45deg) scale(0.8,0.8);\n }\n\n .milestoneText {\n font-style: italic;\n }\n .doneCritText0,\n .doneCritText1,\n .doneCritText2,\n .doneCritText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n .activeCritText0,\n .activeCritText1,\n .activeCritText2,\n .activeCritText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n .titleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor} ;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n`,br=()=>"",kr=t=>`\n .pieCircle{\n stroke: ${t.pieStrokeColor};\n stroke-width : ${t.pieStrokeWidth};\n opacity : ${t.pieOpacity};\n }\n .pieTitleText {\n text-anchor: middle;\n font-size: ${t.pieTitleTextSize};\n fill: ${t.pieTitleTextColor};\n font-family: ${t.fontFamily};\n }\n .slice {\n font-family: ${t.fontFamily};\n fill: ${t.pieSectionTextColor};\n font-size:${t.pieSectionTextSize};\n // fill: white;\n }\n .legend text {\n fill: ${t.pieLegendTextColor};\n font-family: ${t.fontFamily};\n font-size: ${t.pieLegendTextSize};\n }\n`,vr=t=>`\n\n marker {\n fill: ${t.relationColor};\n stroke: ${t.relationColor};\n }\n\n marker.cross {\n stroke: ${t.lineColor};\n }\n\n svg {\n font-family: ${t.fontFamily};\n font-size: ${t.fontSize};\n }\n\n .reqBox {\n fill: ${t.requirementBackground};\n fill-opacity: 100%;\n stroke: ${t.requirementBorderColor};\n stroke-width: ${t.requirementBorderSize};\n }\n \n .reqTitle, .reqLabel{\n fill: ${t.requirementTextColor};\n }\n .reqLabelBox {\n fill: ${t.relationLabelBackground};\n fill-opacity: 100%;\n }\n\n .req-title-line {\n stroke: ${t.requirementBorderColor};\n stroke-width: ${t.requirementBorderSize};\n }\n .relationshipLine {\n stroke: ${t.relationColor};\n stroke-width: 1;\n }\n .relationshipLabel {\n fill: ${t.relationLabelColor};\n }\n\n`,xr=t=>`.actor {\n stroke: ${t.actorBorder};\n fill: ${t.actorBkg};\n }\n\n text.actor > tspan {\n fill: ${t.actorTextColor};\n stroke: none;\n }\n\n .actor-line {\n stroke: ${t.actorLineColor};\n }\n\n .messageLine0 {\n stroke-width: 1.5;\n stroke-dasharray: none;\n stroke: ${t.signalColor};\n }\n\n .messageLine1 {\n stroke-width: 1.5;\n stroke-dasharray: 2, 2;\n stroke: ${t.signalColor};\n }\n\n #arrowhead path {\n fill: ${t.signalColor};\n stroke: ${t.signalColor};\n }\n\n .sequenceNumber {\n fill: ${t.sequenceNumberColor};\n }\n\n #sequencenumber {\n fill: ${t.signalColor};\n }\n\n #crosshead path {\n fill: ${t.signalColor};\n stroke: ${t.signalColor};\n }\n\n .messageText {\n fill: ${t.signalTextColor};\n stroke: none;\n }\n\n .labelBox {\n stroke: ${t.labelBoxBorderColor};\n fill: ${t.labelBoxBkgColor};\n }\n\n .labelText, .labelText > tspan {\n fill: ${t.labelTextColor};\n stroke: none;\n }\n\n .loopText, .loopText > tspan {\n fill: ${t.loopTextColor};\n stroke: none;\n }\n\n .loopLine {\n stroke-width: 2px;\n stroke-dasharray: 2, 2;\n stroke: ${t.labelBoxBorderColor};\n fill: ${t.labelBoxBorderColor};\n }\n\n .note {\n //stroke: #decc93;\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n }\n\n .noteText, .noteText > tspan {\n fill: ${t.noteTextColor};\n stroke: none;\n }\n\n .activation0 {\n fill: ${t.activationBkgColor};\n stroke: ${t.activationBorderColor};\n }\n\n .activation1 {\n fill: ${t.activationBkgColor};\n stroke: ${t.activationBorderColor};\n }\n\n .activation2 {\n fill: ${t.activationBkgColor};\n stroke: ${t.activationBorderColor};\n }\n\n .actorPopupMenu {\n position: absolute;\n }\n\n .actorPopupMenuPanel {\n position: absolute;\n fill: ${t.actorBkg};\n box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);\n filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));\n}\n .actor-man line {\n stroke: ${t.actorBorder};\n fill: ${t.actorBkg};\n }\n .actor-man circle, line {\n stroke: ${t.actorBorder};\n fill: ${t.actorBkg};\n stroke-width: 2px;\n }\n`,Mr=t=>`\ndefs #statediagram-barbEnd {\n fill: ${t.transitionColor};\n stroke: ${t.transitionColor};\n }\ng.stateGroup text {\n fill: ${t.nodeBorder};\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ${t.textColor};\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ${t.stateLabelColor};\n}\n\ng.stateGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.stateGroup line {\n stroke: ${t.lineColor};\n stroke-width: 1;\n}\n\n.transition {\n stroke: ${t.transitionColor};\n stroke-width: 1;\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ${t.background};\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n\n text {\n fill: ${t.noteTextColor};\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ${t.labelBackgroundColor};\n opacity: 0.5;\n}\n.edgeLabel .label text {\n fill: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n.label div .edgeLabel {\n color: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n\n.stateLabel text {\n fill: ${t.stateLabelColor};\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node .fork-join {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node circle.state-end {\n fill: ${t.innerEndBackground};\n stroke: ${t.background};\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ${t.compositeBackground||t.background};\n // stroke: ${t.background};\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ${t.stateBkg||t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: 1px;\n}\n.node polygon {\n fill: ${t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};;\n stroke-width: 1px;\n}\n#statediagram-barbEnd {\n fill: ${t.lineColor};\n}\n\n.statediagram-cluster rect {\n fill: ${t.compositeTitleBackground};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: 1px;\n}\n\n.cluster-label, .nodeLabel {\n color: ${t.stateLabelColor};\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ${t.stateBorder||t.nodeBorder};\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ${t.compositeBackground||t.background};\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ${t.noteTextColor};\n}\n\n.statediagram-note .nodeLabel {\n color: ${t.noteTextColor};\n}\n.statediagram .edgeLabel {\n color: red; // ${t.noteTextColor};\n}\n\n#dependencyStart, #dependencyEnd {\n fill: ${t.lineColor};\n stroke: ${t.lineColor};\n stroke-width: 1;\n}\n\n.statediagramTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n`,Lr=t=>`.label {\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n color: ${t.textColor};\n }\n .mouth {\n stroke: #666;\n }\n\n line {\n stroke: ${t.textColor}\n }\n\n .legend {\n fill: ${t.textColor};\n }\n\n .label text {\n fill: #333;\n }\n .label {\n color: ${t.textColor}\n }\n\n .face {\n ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"};\n stroke: #999;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n }\n text-align: center;\n }\n\n .cluster rect {\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .task-type-0, .section-type-0 {\n ${t.fillType0?`fill: ${t.fillType0}`:""};\n }\n .task-type-1, .section-type-1 {\n ${t.fillType0?`fill: ${t.fillType1}`:""};\n }\n .task-type-2, .section-type-2 {\n ${t.fillType0?`fill: ${t.fillType2}`:""};\n }\n .task-type-3, .section-type-3 {\n ${t.fillType0?`fill: ${t.fillType3}`:""};\n }\n .task-type-4, .section-type-4 {\n ${t.fillType0?`fill: ${t.fillType4}`:""};\n }\n .task-type-5, .section-type-5 {\n ${t.fillType0?`fill: ${t.fillType5}`:""};\n }\n .task-type-6, .section-type-6 {\n ${t.fillType0?`fill: ${t.fillType6}`:""};\n }\n .task-type-7, .section-type-7 {\n ${t.fillType0?`fill: ${t.fillType7}`:""};\n }\n\n .actor-0 {\n ${t.actor0?`fill: ${t.actor0}`:""};\n }\n .actor-1 {\n ${t.actor1?`fill: ${t.actor1}`:""};\n }\n .actor-2 {\n ${t.actor2?`fill: ${t.actor2}`:""};\n }\n .actor-3 {\n ${t.actor3?`fill: ${t.actor3}`:""};\n }\n .actor-4 {\n ${t.actor4?`fill: ${t.actor4}`:""};\n }\n .actor-5 {\n ${t.actor5?`fill: ${t.actor5}`:""};\n }\n`,wr=t=>`.person {\n stroke: ${t.personBorder};\n fill: ${t.personBkg};\n }\n`,Tr={flowchart:yr,"flowchart-v2":yr,sequence:xr,gantt:gr,classDiagram:_r,"classDiagram-v2":_r,class:_r,stateDiagram:Mr,state:Mr,info:br,pie:kr,er:pr,error:fr,journey:Lr,requirement:vr,c4:wr},Sr=(t,e,n)=>{let r="";return t in Tr&&Tr[t]?r=Tr[t](n):St.warn(`No theme found for ${t}`),` & {\n font-family: ${n.fontFamily};\n font-size: ${n.fontSize};\n fill: ${n.textColor}\n }\n\n /* Classes common for multiple diagrams */\n\n & .error-icon {\n fill: ${n.errorBkgColor};\n }\n & .error-text {\n fill: ${n.errorTextColor};\n stroke: ${n.errorTextColor};\n }\n\n & .edge-thickness-normal {\n stroke-width: 2px;\n }\n & .edge-thickness-thick {\n stroke-width: 3.5px\n }\n & .edge-pattern-solid {\n stroke-dasharray: 0;\n }\n\n & .edge-pattern-dashed{\n stroke-dasharray: 3;\n }\n .edge-pattern-dotted {\n stroke-dasharray: 2;\n }\n\n & .marker {\n fill: ${n.lineColor};\n stroke: ${n.lineColor};\n }\n & .marker.cross {\n stroke: ${n.lineColor};\n }\n\n & svg {\n font-family: ${n.fontFamily};\n font-size: ${n.fontSize};\n }\n\n ${r}\n\n ${e}\n`};let Dr="",Yr="",Er="";const Cr=t=>At(t,ar()),Ar=function(){Dr="",Er="",Yr=""},Or=function(t){Dr=Cr(t).replace(/^\s+/g,"")},Nr=function(){return Dr||Yr},Br=function(t){Er=Cr(t).replace(/\n\s+/g,"\n")},Fr=function(){return Er},Ir=function(t){Yr=Cr(t)},Pr=function(){return Yr},jr={setAccTitle:Or,getAccTitle:Nr,setDiagramTitle:Ir,getDiagramTitle:Pr,getAccDescription:Fr,setAccDescription:Br,clear:Ar},Rr=Object.freeze(Object.defineProperty({__proto__:null,clear:Ar,setAccTitle:Or,getAccTitle:Nr,setAccDescription:Br,getAccDescription:Fr,setDiagramTitle:Ir,getDiagramTitle:Pr,default:jr},Symbol.toStringTag,{value:"Module"}));let Hr={};const $r=function(t,e,n,r){St.debug("parseDirective is being called",e,n,r);try{if(void 0!==e)switch(e=e.trim(),n){case"open_directive":Hr={};break;case"type_directive":if(!Hr)throw new Error("currentDirective is undefined");Hr.type=e.toLowerCase();break;case"arg_directive":if(!Hr)throw new Error("currentDirective is undefined");Hr.args=JSON.parse(e);break;case"close_directive":Zr(t,Hr,r),Hr=void 0}}catch(i){St.error(`Error while rendering sequenceDiagram directive: ${e} jison context: ${n}`),St.error(i.message)}},Zr=function(t,e,n){switch(St.info(`Directive type=${e.type} with args:`,e.args),e.type){case"init":case"initialize":["config"].forEach((t=>{void 0!==e.args[t]&&("flowchart-v2"===n&&(n="flowchart"),e.args[n]=e.args[t],delete e.args[t])})),St.info("sanitize in handleDirective",e.args),zn(e.args),St.info("sanitize in handleDirective (done)",e.args),or(e.args);break;case"wrap":case"nowrap":t&&t.setWrap&&t.setWrap("wrap"===e.type);break;case"themeCss":St.warn("themeCss encountered");break;default:St.warn(`Unhandled directive: source: '%%{${e.type}: ${JSON.stringify(e.args?e.args:{})}}%%`,e)}},Wr=St,zr=Dt,Ur=ar,qr=t=>At(t,Ur()),Vr=mr,Gr=(t,e,n,r)=>$r(t,e,n,r),Jr={},Xr=(t,e,n)=>{if(Jr[t])throw new Error(`Diagram ${t} already registered.`);var r,i;Jr[t]=e,n&&wn(t,n),r=t,i=e.styles,Tr[r]=i,e.injectUtils&&e.injectUtils(Wr,zr,Ur,qr,Vr,Rr,Gr)},Kr=t=>{if(t in Jr)return Jr[t];throw new Error(`Diagram ${t} not found.`)};var Qr=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,4],r=[1,7],i=[1,5],a=[1,9],s=[1,6],o=[2,6],l=[1,16],c=[6,8,14,20,22,24,25,27,29,32,37,40,50,55],u=[8,14,20,22,24,25,27,29,32,37,40],d=[8,13,14,20,22,24,25,27,29,32,37,40],h=[1,26],m=[6,8,14,50,55],_=[8,14,55],p=[1,53],f=[1,52],y=[8,14,30,33,35,38,55],g=[1,67],b=[1,68],k=[1,69],v=[8,14,33,35,42,55],x={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,GG:6,document:7,EOF:8,":":9,DIR:10,options:11,body:12,OPT:13,NL:14,line:15,statement:16,commitStatement:17,mergeStatement:18,cherryPickStatement:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,branchStatement:26,CHECKOUT:27,ref:28,BRANCH:29,ORDER:30,NUM:31,CHERRY_PICK:32,COMMIT_ID:33,STR:34,COMMIT_TAG:35,EMPTYSTR:36,MERGE:37,COMMIT_TYPE:38,commitType:39,COMMIT:40,commit_arg:41,COMMIT_MSG:42,NORMAL:43,REVERSE:44,HIGHLIGHT:45,openDirective:46,typeDirective:47,closeDirective:48,argDirective:49,open_directive:50,type_directive:51,arg_directive:52,close_directive:53,ID:54,";":55,$accept:0,$end:1},terminals_:{2:"error",6:"GG",8:"EOF",9:":",10:"DIR",13:"OPT",14:"NL",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"CHECKOUT",29:"BRANCH",30:"ORDER",31:"NUM",32:"CHERRY_PICK",33:"COMMIT_ID",34:"STR",35:"COMMIT_TAG",36:"EMPTYSTR",37:"MERGE",38:"COMMIT_TYPE",40:"COMMIT",42:"COMMIT_MSG",43:"NORMAL",44:"REVERSE",45:"HIGHLIGHT",50:"open_directive",51:"type_directive",52:"arg_directive",53:"close_directive",54:"ID",55:";"},productions_:[0,[3,2],[3,2],[3,3],[3,4],[3,5],[7,0],[7,2],[11,2],[11,1],[12,0],[12,2],[15,2],[15,1],[16,1],[16,1],[16,1],[16,2],[16,2],[16,1],[16,1],[16,1],[16,2],[26,2],[26,4],[19,3],[19,5],[19,5],[19,5],[19,5],[18,2],[18,4],[18,4],[18,4],[18,6],[18,6],[18,6],[18,6],[18,6],[18,6],[18,8],[18,8],[18,8],[18,8],[18,8],[18,8],[17,2],[17,3],[17,3],[17,5],[17,5],[17,3],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,3],[17,5],[17,5],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[41,0],[41,1],[39,1],[39,1],[39,1],[5,3],[5,5],[46,1],[47,1],[49,1],[48,1],[28,1],[28,1],[4,1],[4,1],[4,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 3:return a[o];case 4:return a[o-1];case 5:return r.setDirection(a[o-3]),a[o-1];case 7:r.setOptions(a[o-1]),this.$=a[o];break;case 8:a[o-1]+=a[o],this.$=a[o-1];break;case 10:this.$=[];break;case 11:a[o-1].push(a[o]),this.$=a[o-1];break;case 12:this.$=a[o-1];break;case 17:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 22:r.checkout(a[o]);break;case 23:r.branch(a[o]);break;case 24:r.branch(a[o-2],a[o]);break;case 25:r.cherryPick(a[o],"",void 0);break;case 26:r.cherryPick(a[o-2],"",a[o]);break;case 27:case 29:r.cherryPick(a[o-2],"","");break;case 28:r.cherryPick(a[o],"",a[o-2]);break;case 30:r.merge(a[o],"","","");break;case 31:r.merge(a[o-2],a[o],"","");break;case 32:r.merge(a[o-2],"",a[o],"");break;case 33:r.merge(a[o-2],"","",a[o]);break;case 34:r.merge(a[o-4],a[o],"",a[o-2]);break;case 35:r.merge(a[o-4],"",a[o],a[o-2]);break;case 36:r.merge(a[o-4],"",a[o-2],a[o]);break;case 37:r.merge(a[o-4],a[o-2],a[o],"");break;case 38:r.merge(a[o-4],a[o-2],"",a[o]);break;case 39:r.merge(a[o-4],a[o],a[o-2],"");break;case 40:r.merge(a[o-6],a[o-4],a[o-2],a[o]);break;case 41:r.merge(a[o-6],a[o],a[o-4],a[o-2]);break;case 42:r.merge(a[o-6],a[o-4],a[o],a[o-2]);break;case 43:r.merge(a[o-6],a[o-2],a[o-4],a[o]);break;case 44:r.merge(a[o-6],a[o],a[o-2],a[o-4]);break;case 45:r.merge(a[o-6],a[o-2],a[o],a[o-4]);break;case 46:r.commit(a[o]);break;case 47:r.commit("","",r.commitType.NORMAL,a[o]);break;case 48:r.commit("","",a[o],"");break;case 49:r.commit("","",a[o],a[o-2]);break;case 50:r.commit("","",a[o-2],a[o]);break;case 51:r.commit("",a[o],r.commitType.NORMAL,"");break;case 52:r.commit("",a[o-2],r.commitType.NORMAL,a[o]);break;case 53:r.commit("",a[o],r.commitType.NORMAL,a[o-2]);break;case 54:r.commit("",a[o-2],a[o],"");break;case 55:r.commit("",a[o],a[o-2],"");break;case 56:r.commit("",a[o-4],a[o-2],a[o]);break;case 57:r.commit("",a[o-4],a[o],a[o-2]);break;case 58:r.commit("",a[o-2],a[o-4],a[o]);break;case 59:r.commit("",a[o],a[o-4],a[o-2]);break;case 60:r.commit("",a[o],a[o-2],a[o-4]);break;case 61:r.commit("",a[o-2],a[o],a[o-4]);break;case 62:r.commit(a[o],"",r.commitType.NORMAL,"");break;case 63:r.commit(a[o],"",r.commitType.NORMAL,a[o-2]);break;case 64:r.commit(a[o-2],"",r.commitType.NORMAL,a[o]);break;case 65:r.commit(a[o-2],"",a[o],"");break;case 66:r.commit(a[o],"",a[o-2],"");break;case 67:r.commit(a[o],a[o-2],r.commitType.NORMAL,"");break;case 68:r.commit(a[o-2],a[o],r.commitType.NORMAL,"");break;case 69:r.commit(a[o-4],"",a[o-2],a[o]);break;case 70:r.commit(a[o-4],"",a[o],a[o-2]);break;case 71:r.commit(a[o-2],"",a[o-4],a[o]);break;case 72:r.commit(a[o],"",a[o-4],a[o-2]);break;case 73:r.commit(a[o],"",a[o-2],a[o-4]);break;case 74:r.commit(a[o-2],"",a[o],a[o-4]);break;case 75:r.commit(a[o-4],a[o],a[o-2],"");break;case 76:r.commit(a[o-4],a[o-2],a[o],"");break;case 77:r.commit(a[o-2],a[o],a[o-4],"");break;case 78:r.commit(a[o],a[o-2],a[o-4],"");break;case 79:r.commit(a[o],a[o-4],a[o-2],"");break;case 80:r.commit(a[o-2],a[o-4],a[o],"");break;case 81:r.commit(a[o-4],a[o],r.commitType.NORMAL,a[o-2]);break;case 82:r.commit(a[o-4],a[o-2],r.commitType.NORMAL,a[o]);break;case 83:r.commit(a[o-2],a[o],r.commitType.NORMAL,a[o-4]);break;case 84:r.commit(a[o],a[o-2],r.commitType.NORMAL,a[o-4]);break;case 85:r.commit(a[o],a[o-4],r.commitType.NORMAL,a[o-2]);break;case 86:r.commit(a[o-2],a[o-4],r.commitType.NORMAL,a[o]);break;case 87:r.commit(a[o-6],a[o-4],a[o-2],a[o]);break;case 88:r.commit(a[o-6],a[o-4],a[o],a[o-2]);break;case 89:r.commit(a[o-6],a[o-2],a[o-4],a[o]);break;case 90:r.commit(a[o-6],a[o],a[o-4],a[o-2]);break;case 91:r.commit(a[o-6],a[o-2],a[o],a[o-4]);break;case 92:r.commit(a[o-6],a[o],a[o-2],a[o-4]);break;case 93:r.commit(a[o-4],a[o-6],a[o-2],a[o]);break;case 94:r.commit(a[o-4],a[o-6],a[o],a[o-2]);break;case 95:r.commit(a[o-2],a[o-6],a[o-4],a[o]);break;case 96:r.commit(a[o],a[o-6],a[o-4],a[o-2]);break;case 97:r.commit(a[o-2],a[o-6],a[o],a[o-4]);break;case 98:r.commit(a[o],a[o-6],a[o-2],a[o-4]);break;case 99:r.commit(a[o],a[o-4],a[o-2],a[o-6]);break;case 100:r.commit(a[o-2],a[o-4],a[o],a[o-6]);break;case 101:r.commit(a[o],a[o-2],a[o-4],a[o-6]);break;case 102:r.commit(a[o-2],a[o],a[o-4],a[o-6]);break;case 103:r.commit(a[o-4],a[o-2],a[o],a[o-6]);break;case 104:r.commit(a[o-4],a[o],a[o-2],a[o-6]);break;case 105:r.commit(a[o-2],a[o-4],a[o-6],a[o]);break;case 106:r.commit(a[o],a[o-4],a[o-6],a[o-2]);break;case 107:r.commit(a[o-2],a[o],a[o-6],a[o-4]);break;case 108:r.commit(a[o],a[o-2],a[o-6],a[o-4]);break;case 109:r.commit(a[o-4],a[o-2],a[o-6],a[o]);break;case 110:r.commit(a[o-4],a[o],a[o-6],a[o-2]);break;case 111:this.$="";break;case 112:this.$=a[o];break;case 113:this.$=r.commitType.NORMAL;break;case 114:this.$=r.commitType.REVERSE;break;case 115:this.$=r.commitType.HIGHLIGHT;break;case 118:r.parseDirective("%%{","open_directive");break;case 119:r.parseDirective(a[o],"type_directive");break;case 120:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 121:r.parseDirective("}%%","close_directive","gitGraph")}},table:[{3:1,4:2,5:3,6:n,8:r,14:i,46:8,50:a,55:s},{1:[3]},{3:10,4:2,5:3,6:n,8:r,14:i,46:8,50:a,55:s},{3:11,4:2,5:3,6:n,8:r,14:i,46:8,50:a,55:s},{7:12,8:o,9:[1,13],10:[1,14],11:15,14:l},e(c,[2,124]),e(c,[2,125]),e(c,[2,126]),{47:17,51:[1,18]},{51:[2,118]},{1:[2,1]},{1:[2,2]},{8:[1,19]},{7:20,8:o,11:15,14:l},{9:[1,21]},e(u,[2,10],{12:22,13:[1,23]}),e(d,[2,9]),{9:[1,25],48:24,53:h},e([9,53],[2,119]),{1:[2,3]},{8:[1,27]},{7:28,8:o,11:15,14:l},{8:[2,7],14:[1,31],15:29,16:30,17:32,18:33,19:34,20:[1,35],22:[1,36],24:[1,37],25:[1,38],26:39,27:[1,40],29:[1,44],32:[1,43],37:[1,42],40:[1,41]},e(d,[2,8]),e(m,[2,116]),{49:45,52:[1,46]},e(m,[2,121]),{1:[2,4]},{8:[1,47]},e(u,[2,11]),{4:48,8:r,14:i,55:s},e(u,[2,13]),e(_,[2,14]),e(_,[2,15]),e(_,[2,16]),{21:[1,49]},{23:[1,50]},e(_,[2,19]),e(_,[2,20]),e(_,[2,21]),{28:51,34:p,54:f},e(_,[2,111],{41:54,33:[1,57],34:[1,59],35:[1,55],38:[1,56],42:[1,58]}),{28:60,34:p,54:f},{33:[1,61],35:[1,62]},{28:63,34:p,54:f},{48:64,53:h},{53:[2,120]},{1:[2,5]},e(u,[2,12]),e(_,[2,17]),e(_,[2,18]),e(_,[2,22]),e(y,[2,122]),e(y,[2,123]),e(_,[2,46]),{34:[1,65]},{39:66,43:g,44:b,45:k},{34:[1,70]},{34:[1,71]},e(_,[2,112]),e(_,[2,30],{33:[1,72],35:[1,74],38:[1,73]}),{34:[1,75]},{34:[1,76],36:[1,77]},e(_,[2,23],{30:[1,78]}),e(m,[2,117]),e(_,[2,47],{33:[1,80],38:[1,79],42:[1,81]}),e(_,[2,48],{33:[1,83],35:[1,82],42:[1,84]}),e(v,[2,113]),e(v,[2,114]),e(v,[2,115]),e(_,[2,51],{35:[1,85],38:[1,86],42:[1,87]}),e(_,[2,62],{33:[1,90],35:[1,88],38:[1,89]}),{34:[1,91]},{39:92,43:g,44:b,45:k},{34:[1,93]},e(_,[2,25],{35:[1,94]}),{33:[1,95]},{33:[1,96]},{31:[1,97]},{39:98,43:g,44:b,45:k},{34:[1,99]},{34:[1,100]},{34:[1,101]},{34:[1,102]},{34:[1,103]},{34:[1,104]},{39:105,43:g,44:b,45:k},{34:[1,106]},{34:[1,107]},{39:108,43:g,44:b,45:k},{34:[1,109]},e(_,[2,31],{35:[1,111],38:[1,110]}),e(_,[2,32],{33:[1,113],35:[1,112]}),e(_,[2,33],{33:[1,114],38:[1,115]}),{34:[1,116],36:[1,117]},{34:[1,118]},{34:[1,119]},e(_,[2,24]),e(_,[2,49],{33:[1,120],42:[1,121]}),e(_,[2,53],{38:[1,122],42:[1,123]}),e(_,[2,63],{33:[1,125],38:[1,124]}),e(_,[2,50],{33:[1,126],42:[1,127]}),e(_,[2,55],{35:[1,128],42:[1,129]}),e(_,[2,66],{33:[1,131],35:[1,130]}),e(_,[2,52],{38:[1,132],42:[1,133]}),e(_,[2,54],{35:[1,134],42:[1,135]}),e(_,[2,67],{35:[1,137],38:[1,136]}),e(_,[2,64],{33:[1,139],38:[1,138]}),e(_,[2,65],{33:[1,141],35:[1,140]}),e(_,[2,68],{35:[1,143],38:[1,142]}),{39:144,43:g,44:b,45:k},{34:[1,145]},{34:[1,146]},{34:[1,147]},{34:[1,148]},{39:149,43:g,44:b,45:k},e(_,[2,26]),e(_,[2,27]),e(_,[2,28]),e(_,[2,29]),{34:[1,150]},{34:[1,151]},{39:152,43:g,44:b,45:k},{34:[1,153]},{39:154,43:g,44:b,45:k},{34:[1,155]},{34:[1,156]},{34:[1,157]},{34:[1,158]},{34:[1,159]},{34:[1,160]},{34:[1,161]},{39:162,43:g,44:b,45:k},{34:[1,163]},{34:[1,164]},{34:[1,165]},{39:166,43:g,44:b,45:k},{34:[1,167]},{39:168,43:g,44:b,45:k},{34:[1,169]},{34:[1,170]},{34:[1,171]},{39:172,43:g,44:b,45:k},{34:[1,173]},e(_,[2,37],{35:[1,174]}),e(_,[2,38],{38:[1,175]}),e(_,[2,36],{33:[1,176]}),e(_,[2,39],{35:[1,177]}),e(_,[2,34],{38:[1,178]}),e(_,[2,35],{33:[1,179]}),e(_,[2,60],{42:[1,180]}),e(_,[2,73],{33:[1,181]}),e(_,[2,61],{42:[1,182]}),e(_,[2,84],{38:[1,183]}),e(_,[2,74],{33:[1,184]}),e(_,[2,83],{38:[1,185]}),e(_,[2,59],{42:[1,186]}),e(_,[2,72],{33:[1,187]}),e(_,[2,58],{42:[1,188]}),e(_,[2,78],{35:[1,189]}),e(_,[2,71],{33:[1,190]}),e(_,[2,77],{35:[1,191]}),e(_,[2,57],{42:[1,192]}),e(_,[2,85],{38:[1,193]}),e(_,[2,56],{42:[1,194]}),e(_,[2,79],{35:[1,195]}),e(_,[2,80],{35:[1,196]}),e(_,[2,86],{38:[1,197]}),e(_,[2,70],{33:[1,198]}),e(_,[2,81],{38:[1,199]}),e(_,[2,69],{33:[1,200]}),e(_,[2,75],{35:[1,201]}),e(_,[2,76],{35:[1,202]}),e(_,[2,82],{38:[1,203]}),{34:[1,204]},{39:205,43:g,44:b,45:k},{34:[1,206]},{34:[1,207]},{39:208,43:g,44:b,45:k},{34:[1,209]},{34:[1,210]},{34:[1,211]},{34:[1,212]},{39:213,43:g,44:b,45:k},{34:[1,214]},{39:215,43:g,44:b,45:k},{34:[1,216]},{34:[1,217]},{34:[1,218]},{34:[1,219]},{34:[1,220]},{34:[1,221]},{34:[1,222]},{39:223,43:g,44:b,45:k},{34:[1,224]},{34:[1,225]},{34:[1,226]},{39:227,43:g,44:b,45:k},{34:[1,228]},{39:229,43:g,44:b,45:k},{34:[1,230]},{34:[1,231]},{34:[1,232]},{39:233,43:g,44:b,45:k},e(_,[2,40]),e(_,[2,42]),e(_,[2,41]),e(_,[2,43]),e(_,[2,45]),e(_,[2,44]),e(_,[2,101]),e(_,[2,102]),e(_,[2,99]),e(_,[2,100]),e(_,[2,104]),e(_,[2,103]),e(_,[2,108]),e(_,[2,107]),e(_,[2,106]),e(_,[2,105]),e(_,[2,110]),e(_,[2,109]),e(_,[2,98]),e(_,[2,97]),e(_,[2,96]),e(_,[2,95]),e(_,[2,93]),e(_,[2,94]),e(_,[2,92]),e(_,[2,91]),e(_,[2,90]),e(_,[2,89]),e(_,[2,87]),e(_,[2,88])],defaultActions:{9:[2,118],10:[2,1],11:[2,2],19:[2,3],27:[2,4],46:[2,120],47:[2,5]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},M=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),50;case 1:return this.begin("type_directive"),51;case 2:return this.popState(),this.begin("arg_directive"),9;case 3:return this.popState(),this.popState(),53;case 4:return 52;case 5:return this.begin("acc_title"),20;case 6:return this.popState(),"acc_title_value";case 7:return this.begin("acc_descr"),22;case 8:return this.popState(),"acc_descr_value";case 9:this.begin("acc_descr_multiline");break;case 10:case 34:case 38:this.popState();break;case 11:return"acc_descr_multiline_value";case 12:return 14;case 13:case 14:break;case 15:return 6;case 16:return 40;case 17:return 33;case 18:return 38;case 19:return 42;case 20:return 43;case 21:return 44;case 22:return 45;case 23:return 35;case 24:return 29;case 25:return 30;case 26:return 37;case 27:return 32;case 28:return 27;case 29:case 30:return 10;case 31:return 9;case 32:return"CARET";case 33:this.begin("options");break;case 35:return 13;case 36:return 36;case 37:this.begin("string");break;case 39:return 34;case 40:return 31;case 41:return 54;case 42:return 8}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit(?=\s|$))/i,/^(?:id:)/i,/^(?:type:)/i,/^(?:msg:)/i,/^(?:NORMAL\b)/i,/^(?:REVERSE\b)/i,/^(?:HIGHLIGHT\b)/i,/^(?:tag:)/i,/^(?:branch(?=\s|$))/i,/^(?:order:)/i,/^(?:merge(?=\s|$))/i,/^(?:cherry-pick(?=\s|$))/i,/^(?:checkout(?=\s|$))/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:[ \r\n\t]+end\b)/i,/^(?:[\s\S]+(?=[ \r\n\t]+end))/i,/^(?:["]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[0-9]+(?=\s|$))/i,/^(?:\w([-\./\w]*[-\w])?)/i,/^(?:$)/i,/^(?:\s+)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},options:{rules:[34,35],inclusive:!1},string:{rules:[38,39],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,36,37,40,41,42,43],inclusive:!0}}},t);function L(){this.yy={}}return x.lexer=M,L.prototype=x,x.Parser=L,new L}();Qr.parser=Qr;const ti=Qr,ei=t=>null!==t.match(/^\s*gitGraph/);let ni=ar().gitGraph.mainBranchName,ri=ar().gitGraph.mainBranchOrder,ii={},ai=null,si={};si[ni]={name:ni,order:ri};let oi={};oi[ni]=ai;let li=ni,ci="LR",ui=0;function di(){return In({length:7})}let hi={};const mi=function(t){if(t=Pt.sanitizeText(t,ar()),void 0===oi[t]){let e=new Error('Trying to checkout branch which is not yet created. (Help try using "branch '+t+'")');throw e.hash={text:"checkout "+t,token:"checkout "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"branch '+t+'"']},e}{li=t;const e=oi[li];ai=ii[e]}};function _i(t,e,n){const r=t.indexOf(e);-1===r?t.push(n):t.splice(r,1,n)}function pi(t){const e=t.reduce(((t,e)=>t.seq>e.seq?t:e),t[0]);let n="";t.forEach((function(t){n+=t===e?"\t*":"\t|"}));const r=[n,e.id,e.seq];for(let i in oi)oi[i]===e.id&&r.push(i);if(St.debug(r.join(" ")),e.parents&&2==e.parents.length){const n=ii[e.parents[0]];_i(t,e,n),t.push(ii[e.parents[1]])}else{if(0==e.parents.length)return;{const n=ii[e.parents];_i(t,e,n)}}pi(t=function(t,e){const n=Object.create(null);return t.reduce(((t,r)=>{const i=e(r);return n[i]||(n[i]=!0,t.push(r)),t}),[])}(t,(t=>t.id)))}const fi=function(){const t=Object.keys(ii).map((function(t){return ii[t]}));return t.forEach((function(t){St.debug(t.id)})),t.sort(((t,e)=>t.seq-e.seq)),t},yi={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},gi={parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().gitGraph,setDirection:function(t){ci=t},setOptions:function(t){St.debug("options str",t),t=(t=t&&t.trim())||"{}";try{hi=JSON.parse(t)}catch(e){St.error("error while parsing gitGraph options",e.message)}},getOptions:function(){return hi},commit:function(t,e,n,r){St.debug("Entering commit:",t,e,n,r),e=Pt.sanitizeText(e,ar()),t=Pt.sanitizeText(t,ar()),r=Pt.sanitizeText(r,ar());const i={id:e||ui+"-"+di(),message:t,seq:ui++,type:n||yi.NORMAL,tag:r||"",parents:null==ai?[]:[ai.id],branch:li};ai=i,ii[i.id]=i,oi[li]=i.id,St.debug("in pushCommit "+i.id)},branch:function(t,e){if(t=Pt.sanitizeText(t,ar()),void 0!==oi[t]){let e=new Error('Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout '+t+'")');throw e.hash={text:"branch "+t,token:"branch "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+t+'"']},e}oi[t]=null!=ai?ai.id:null,si[t]={name:t,order:e?parseInt(e,10):null},mi(t),St.debug("in createBranch")},merge:function(t,e,n,r){t=Pt.sanitizeText(t,ar()),e=Pt.sanitizeText(e,ar());const i=ii[oi[li]],a=ii[oi[t]];if(li===t){let e=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["branch abc"]},e}if(void 0===i||!i){let e=new Error('Incorrect usage of "merge". Current branch ('+li+")has no commits");throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["commit"]},e}if(void 0===oi[t]){let e=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") does not exist");throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["branch "+t]},e}if(void 0===a||!a){let e=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") has no commits");throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"commit"']},e}if(i===a){let e=new Error('Incorrect usage of "merge". Both branches have same head');throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["branch abc"]},e}if(e&&void 0!==ii[e]){let i=new Error('Incorrect usage of "merge". Commit with id:'+e+" already exists, use different custom Id");throw i.hash={text:"merge "+t+e+n+r,token:"merge "+t+e+n+r,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["merge "+t+" "+e+"_UNIQUE "+n+" "+r]},i}const s={id:e||ui+"-"+di(),message:"merged branch "+t+" into "+li,seq:ui++,parents:[null==ai?null:ai.id,oi[t]],branch:li,type:yi.MERGE,customType:n,customId:!!e,tag:r||""};ai=s,ii[s.id]=s,oi[li]=s.id,St.debug(oi),St.debug("in mergeBranch")},cherryPick:function(t,e,n){if(St.debug("Entering cherryPick:",t,e,n),t=Pt.sanitizeText(t,ar()),e=Pt.sanitizeText(e,ar()),n=Pt.sanitizeText(n,ar()),!t||void 0===ii[t]){let n=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}let r=ii[t],i=r.branch;if(r.type===yi.MERGE){let n=new Error('Incorrect usage of "cherryPick". Source commit should not be a merge commit');throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}if(!e||void 0===ii[e]){if(i===li){let n=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}const a=ii[oi[li]];if(void 0===a||!a){let n=new Error('Incorrect usage of "cherry-pick". Current branch ('+li+")has no commits");throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}const s={id:ui+"-"+di(),message:"cherry-picked "+r+" into "+li,seq:ui++,parents:[null==ai?null:ai.id,r.id],branch:li,type:yi.CHERRY_PICK,tag:null!=n?n:"cherry-pick:"+r.id};ai=s,ii[s.id]=s,oi[li]=s.id,St.debug(oi),St.debug("in cherryPick")}},checkout:mi,prettyPrint:function(){St.debug(ii);pi([fi()[0]])},clear:function(){ii={},ai=null;let t=ar().gitGraph.mainBranchName,e=ar().gitGraph.mainBranchOrder;oi={},oi[t]=null,si={},si[t]={name:t,order:e},li=t,ui=0,Ar()},getBranchesAsObjArray:function(){const t=Object.values(si).map(((t,e)=>null!==t.order?t:{...t,order:parseFloat(`0.${e}`,10)})).sort(((t,e)=>t.order-e.order)).map((({name:t})=>({name:t})));return t},getBranches:function(){return oi},getCommits:function(){return ii},getCommitsArray:fi,getCurrentBranch:function(){return li},getDirection:function(){return ci},getHead:function(){return ai},setAccTitle:Or,getAccTitle:Nr,getAccDescription:Fr,setAccDescription:Br,setDiagramTitle:Ir,getDiagramTitle:Pr,commitType:yi};let bi={};const ki=0,vi=1,xi=2,Mi=3,Li=4;let wi={},Ti={},Si=[],Di=0;const Yi=(t,e,n)=>{const r=Ur().gitGraph,i=t.append("g").attr("class","commit-bullets"),a=t.append("g").attr("class","commit-labels");let s=0;Object.keys(e).sort(((t,n)=>e[t].seq-e[n].seq)).forEach((t=>{const o=e[t],l=wi[o.branch].pos,c=s+10;if(n){let t,e=void 0!==o.customType&&""!==o.customType?o.customType:o.type;switch(e){case ki:t="commit-normal";break;case vi:t="commit-reverse";break;case xi:t="commit-highlight";break;case Mi:t="commit-merge";break;case Li:t="commit-cherry-pick";break;default:t="commit-normal"}if(e===xi){const e=i.append("rect");e.attr("x",c-10),e.attr("y",l-10),e.attr("height",20),e.attr("width",20),e.attr("class",`commit ${o.id} commit-highlight${wi[o.branch].index%8} ${t}-outer`),i.append("rect").attr("x",c-6).attr("y",l-6).attr("height",12).attr("width",12).attr("class",`commit ${o.id} commit${wi[o.branch].index%8} ${t}-inner`)}else if(e===Li)i.append("circle").attr("cx",c).attr("cy",l).attr("r",10).attr("class",`commit ${o.id} ${t}`),i.append("circle").attr("cx",c-3).attr("cy",l+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${o.id} ${t}`),i.append("circle").attr("cx",c+3).attr("cy",l+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${o.id} ${t}`),i.append("line").attr("x1",c+3).attr("y1",l+1).attr("x2",c).attr("y2",l-5).attr("stroke","#fff").attr("class",`commit ${o.id} ${t}`),i.append("line").attr("x1",c-3).attr("y1",l+1).attr("x2",c).attr("y2",l-5).attr("stroke","#fff").attr("class",`commit ${o.id} ${t}`);else{const n=i.append("circle");if(n.attr("cx",c),n.attr("cy",l),n.attr("r",o.type===Mi?9:10),n.attr("class",`commit ${o.id} commit${wi[o.branch].index%8}`),e===Mi){const e=i.append("circle");e.attr("cx",c),e.attr("cy",l),e.attr("r",6),e.attr("class",`commit ${t} ${o.id} commit${wi[o.branch].index%8}`)}if(e===vi){i.append("path").attr("d",`M ${c-5},${l-5}L${c+5},${l+5}M${c-5},${l+5}L${c+5},${l-5}`).attr("class",`commit ${t} ${o.id} commit${wi[o.branch].index%8}`)}}}if(Ti[o.id]={x:s+10,y:l},n){const t=4,e=2;if(o.type!==Li&&(o.customId&&o.type===Mi||o.type!==Mi)&&r.showCommitLabel){const t=a.append("g"),n=t.insert("rect").attr("class","commit-label-bkg"),i=t.append("text").attr("x",s).attr("y",l+25).attr("class","commit-label").text(o.id);let c=i.node().getBBox();if(n.attr("x",s+10-c.width/2-e).attr("y",l+13.5).attr("width",c.width+2*e).attr("height",c.height+2*e),i.attr("x",s+10-c.width/2),r.rotateCommitLabel){let e=-7.5-(c.width+10)/25*9.5,n=10+c.width/25*8.5;t.attr("transform","translate("+e+", "+n+") rotate("+"-45, "+s+", "+l+")")}}if(o.tag){const n=a.insert("polygon"),r=a.append("circle"),i=a.append("text").attr("y",l-16).attr("class","tag-label").text(o.tag);let c=i.node().getBBox();i.attr("x",s+10-c.width/2);const u=c.height/2,d=l-19.2;n.attr("class","tag-label-bkg").attr("points",`\n ${s-c.width/2-t/2},${d+e}\n ${s-c.width/2-t/2},${d-e}\n ${s+10-c.width/2-t},${d-u-e}\n ${s+10+c.width/2+t},${d-u-e}\n ${s+10+c.width/2+t},${d+u+e}\n ${s+10-c.width/2-t},${d+u+e}`),r.attr("cx",s-c.width/2+t/2).attr("cy",d).attr("r",1.5).attr("class","tag-hole")}}s+=50,s>Di&&(Di=s)}))},Ei=(t,e,n=0)=>{const r=t+Math.abs(t-e)/2;if(n>5)return r;if(Si.every((t=>Math.abs(t-r)>=10)))return Si.push(r),r;const i=Math.abs(t-e);return Ei(t,e-i/5,n+1)},Ci=(t,e,n,r)=>{const i=Ti[e.id],a=Ti[n.id],s=((t,e,n)=>Object.keys(n).filter((r=>n[r].branch===e.branch&&n[r].seq>t.seq&&n[r].seq<e.seq)).length>0)(e,n,r);let o,l="",c="",u=0,d=0,h=wi[n.branch].index;if(s){l="A 10 10, 0, 0, 0,",c="A 10 10, 0, 0, 1,",u=10,d=10,h=wi[n.branch].index;const t=i.y<a.y?Ei(i.y,a.y):Ei(a.y,i.y);o=i.y<a.y?`M ${i.x} ${i.y} L ${i.x} ${t-u} ${l} ${i.x+d} ${t} L ${a.x-u} ${t} ${c} ${a.x} ${t+d} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${i.x} ${t+u} ${c} ${i.x+d} ${t} L ${a.x-u} ${t} ${l} ${a.x} ${t-d} L ${a.x} ${a.y}`}else i.y<a.y&&(l="A 20 20, 0, 0, 0,",u=20,d=20,h=wi[n.branch].index,o=`M ${i.x} ${i.y} L ${i.x} ${a.y-u} ${l} ${i.x+d} ${a.y} L ${a.x} ${a.y}`),i.y>a.y&&(l="A 20 20, 0, 0, 0,",u=20,d=20,h=wi[e.branch].index,o=`M ${i.x} ${i.y} L ${a.x-u} ${i.y} ${l} ${a.x} ${i.y-d} L ${a.x} ${a.y}`),i.y===a.y&&(h=wi[e.branch].index,o=`M ${i.x} ${i.y} L ${i.x} ${a.y-u} ${l} ${i.x+d} ${a.y} L ${a.x} ${a.y}`);t.append("path").attr("d",o).attr("class","arrow arrow"+h%8)},Ai=(t,e)=>{const n=Ur().gitGraph,r=t.append("g");e.forEach(((t,e)=>{const i=e%8,a=wi[t.name].pos,s=r.append("line");s.attr("x1",0),s.attr("y1",a),s.attr("x2",Di),s.attr("y2",a),s.attr("class","branch branch"+i),Si.push(a);const o=(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","text");let n=[];n="string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(t)?t:[];for(const r of n){const t=document.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),t.setAttribute("dy","1em"),t.setAttribute("x","0"),t.setAttribute("class","row"),t.textContent=r.trim(),e.appendChild(t)}return e})(t.name),l=r.insert("rect"),c=r.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+i);c.node().appendChild(o);let u=o.getBBox();l.attr("class","branchLabelBkg label"+i).attr("rx",4).attr("ry",4).attr("x",-u.width-4-(!0===n.rotateCommitLabel?30:0)).attr("y",-u.height/2+8).attr("width",u.width+18).attr("height",u.height+4),c.attr("transform","translate("+(-u.width-14-(!0===n.rotateCommitLabel?30:0))+", "+(a-u.height/2-1)+")"),l.attr("transform","translate(-19, "+(a-u.height/2)+")")}))},Oi={draw:function(t,e,n,r){var i;wi={},Ti={},bi={},Di=0,Si=[];const a=Ur(),s=a.gitGraph;St.debug("in gitgraph renderer",t+"\n","id:",e,n),bi=r.db.getCommits();const l=r.db.getBranchesAsObjArray();let c=0;l.forEach(((t,e)=>{wi[t.name]={pos:c,index:e},c+=50+(s.rotateCommitLabel?40:0)}));const u=(0,o.Ys)(`[id="${e}"]`);Yi(u,bi,!1),s.showBranches&&Ai(u,l),((t,e)=>{const n=t.append("g").attr("class","commit-arrows");Object.keys(e).forEach((t=>{const r=e[t];r.parents&&r.parents.length>0&&r.parents.forEach((t=>{Ci(n,e[t],r,e)}))}))})(u,bi),Yi(u,bi,!0),Gn.insertTitle(u,"gitTitleText",s.titleTopMargin,r.db.getDiagramTitle()),Vr(void 0,u,s.diagramPadding,null!=(i=s.useMaxWidth)?i:a.useMaxWidth)}},Ni=t=>`\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n ${[0,1,2,3,4,5,6,7].map((e=>`\n .branch-label${e} { fill: ${t["gitBranchLabel"+e]}; }\n .commit${e} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }\n .commit-highlight${e} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }\n .label${e} { fill: ${t["git"+e]}; }\n .arrow${e} { stroke: ${t["git"+e]}; }\n `)).join("\n")}\n\n .branch {\n stroke-width: 1;\n stroke: ${t.lineColor};\n stroke-dasharray: 2;\n }\n .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}\n .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }\n .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}\n .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }\n .tag-hole { fill: ${t.textColor}; }\n\n .commit-merge {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n .commit-reverse {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n stroke-width: 3;\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n\n .arrow { stroke-width: 8; stroke-linecap: round; fill: none}\n .gitTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n }\n`;var Bi=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,6],r=[1,7],i=[1,8],a=[1,9],s=[1,16],o=[1,11],l=[1,12],u=[1,13],d=[1,14],h=[1,15],m=[1,27],_=[1,33],p=[1,34],f=[1,35],y=[1,36],g=[1,37],b=[1,72],k=[1,73],v=[1,74],x=[1,75],M=[1,76],L=[1,77],w=[1,78],T=[1,38],S=[1,39],D=[1,40],Y=[1,41],E=[1,42],C=[1,43],A=[1,44],O=[1,45],N=[1,46],B=[1,47],F=[1,48],I=[1,49],P=[1,50],j=[1,51],R=[1,52],H=[1,53],$=[1,54],Z=[1,55],W=[1,56],z=[1,57],U=[1,59],q=[1,60],V=[1,61],G=[1,62],J=[1,63],X=[1,64],K=[1,65],Q=[1,66],tt=[1,67],et=[1,68],nt=[1,69],rt=[24,52],it=[24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],at=[15,24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],st=[1,94],ot=[1,95],lt=[1,96],ct=[1,97],ut=[15,24,52],dt=[7,8,9,10,18,22,25,26,27,28],ht=[15,24,43,52],mt=[15,24,43,52,86,87,89,90],_t=[15,43],pt=[44,46,47,48,49,50,51,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],ft={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,directive:6,direction_tb:7,direction_bt:8,direction_rl:9,direction_lr:10,graphConfig:11,openDirective:12,typeDirective:13,closeDirective:14,NEWLINE:15,":":16,argDirective:17,open_directive:18,type_directive:19,arg_directive:20,close_directive:21,C4_CONTEXT:22,statements:23,EOF:24,C4_CONTAINER:25,C4_COMPONENT:26,C4_DYNAMIC:27,C4_DEPLOYMENT:28,otherStatements:29,diagramStatements:30,otherStatement:31,title:32,accDescription:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,boundaryStatement:39,boundaryStartStatement:40,boundaryStopStatement:41,boundaryStart:42,LBRACE:43,ENTERPRISE_BOUNDARY:44,attributes:45,SYSTEM_BOUNDARY:46,BOUNDARY:47,CONTAINER_BOUNDARY:48,NODE:49,NODE_L:50,NODE_R:51,RBRACE:52,diagramStatement:53,PERSON:54,PERSON_EXT:55,SYSTEM:56,SYSTEM_DB:57,SYSTEM_QUEUE:58,SYSTEM_EXT:59,SYSTEM_EXT_DB:60,SYSTEM_EXT_QUEUE:61,CONTAINER:62,CONTAINER_DB:63,CONTAINER_QUEUE:64,CONTAINER_EXT:65,CONTAINER_EXT_DB:66,CONTAINER_EXT_QUEUE:67,COMPONENT:68,COMPONENT_DB:69,COMPONENT_QUEUE:70,COMPONENT_EXT:71,COMPONENT_EXT_DB:72,COMPONENT_EXT_QUEUE:73,REL:74,BIREL:75,REL_U:76,REL_D:77,REL_L:78,REL_R:79,REL_B:80,REL_INDEX:81,UPDATE_EL_STYLE:82,UPDATE_REL_STYLE:83,UPDATE_LAYOUT_CONFIG:84,attribute:85,STR:86,STR_KEY:87,STR_VALUE:88,ATTRIBUTE:89,ATTRIBUTE_EMPTY:90,$accept:0,$end:1},terminals_:{2:"error",7:"direction_tb",8:"direction_bt",9:"direction_rl",10:"direction_lr",15:"NEWLINE",16:":",18:"open_directive",19:"type_directive",20:"arg_directive",21:"close_directive",22:"C4_CONTEXT",24:"EOF",25:"C4_CONTAINER",26:"C4_COMPONENT",27:"C4_DYNAMIC",28:"C4_DEPLOYMENT",32:"title",33:"accDescription",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",43:"LBRACE",44:"ENTERPRISE_BOUNDARY",46:"SYSTEM_BOUNDARY",47:"BOUNDARY",48:"CONTAINER_BOUNDARY",49:"NODE",50:"NODE_L",51:"NODE_R",52:"RBRACE",54:"PERSON",55:"PERSON_EXT",56:"SYSTEM",57:"SYSTEM_DB",58:"SYSTEM_QUEUE",59:"SYSTEM_EXT",60:"SYSTEM_EXT_DB",61:"SYSTEM_EXT_QUEUE",62:"CONTAINER",63:"CONTAINER_DB",64:"CONTAINER_QUEUE",65:"CONTAINER_EXT",66:"CONTAINER_EXT_DB",67:"CONTAINER_EXT_QUEUE",68:"COMPONENT",69:"COMPONENT_DB",70:"COMPONENT_QUEUE",71:"COMPONENT_EXT",72:"COMPONENT_EXT_DB",73:"COMPONENT_EXT_QUEUE",74:"REL",75:"BIREL",76:"REL_U",77:"REL_D",78:"REL_L",79:"REL_R",80:"REL_B",81:"REL_INDEX",82:"UPDATE_EL_STYLE",83:"UPDATE_REL_STYLE",84:"UPDATE_LAYOUT_CONFIG",86:"STR",87:"STR_KEY",88:"STR_VALUE",89:"ATTRIBUTE",90:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[11,4],[11,4],[11,4],[11,4],[23,1],[23,1],[23,2],[29,1],[29,2],[29,3],[31,1],[31,1],[31,2],[31,2],[31,1],[39,3],[40,3],[40,3],[40,4],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[41,1],[30,1],[30,2],[30,3],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,1],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[45,1],[45,2],[85,1],[85,2],[85,1],[85,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:r.setDirection("TB");break;case 5:r.setDirection("BT");break;case 6:r.setDirection("RL");break;case 7:r.setDirection("LR");break;case 11:r.parseDirective("%%{","open_directive");break;case 12:break;case 13:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 14:r.parseDirective("}%%","close_directive","c4Context");break;case 15:case 16:case 17:case 18:case 19:r.setC4Type(a[o-3]);break;case 26:r.setTitle(a[o].substring(6)),this.$=a[o].substring(6);break;case 27:r.setAccDescription(a[o].substring(15)),this.$=a[o].substring(15);break;case 28:this.$=a[o].trim(),r.setTitle(this.$);break;case 29:case 30:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 35:case 36:a[o].splice(2,0,"ENTERPRISE"),r.addPersonOrSystemBoundary(...a[o]),this.$=a[o];break;case 37:r.addPersonOrSystemBoundary(...a[o]),this.$=a[o];break;case 38:a[o].splice(2,0,"CONTAINER"),r.addContainerBoundary(...a[o]),this.$=a[o];break;case 39:r.addDeploymentNode("node",...a[o]),this.$=a[o];break;case 40:r.addDeploymentNode("nodeL",...a[o]),this.$=a[o];break;case 41:r.addDeploymentNode("nodeR",...a[o]),this.$=a[o];break;case 42:r.popBoundaryParseStack();break;case 46:r.addPersonOrSystem("person",...a[o]),this.$=a[o];break;case 47:r.addPersonOrSystem("external_person",...a[o]),this.$=a[o];break;case 48:r.addPersonOrSystem("system",...a[o]),this.$=a[o];break;case 49:r.addPersonOrSystem("system_db",...a[o]),this.$=a[o];break;case 50:r.addPersonOrSystem("system_queue",...a[o]),this.$=a[o];break;case 51:r.addPersonOrSystem("external_system",...a[o]),this.$=a[o];break;case 52:r.addPersonOrSystem("external_system_db",...a[o]),this.$=a[o];break;case 53:r.addPersonOrSystem("external_system_queue",...a[o]),this.$=a[o];break;case 54:r.addContainer("container",...a[o]),this.$=a[o];break;case 55:r.addContainer("container_db",...a[o]),this.$=a[o];break;case 56:r.addContainer("container_queue",...a[o]),this.$=a[o];break;case 57:r.addContainer("external_container",...a[o]),this.$=a[o];break;case 58:r.addContainer("external_container_db",...a[o]),this.$=a[o];break;case 59:r.addContainer("external_container_queue",...a[o]),this.$=a[o];break;case 60:r.addComponent("component",...a[o]),this.$=a[o];break;case 61:r.addComponent("component_db",...a[o]),this.$=a[o];break;case 62:r.addComponent("component_queue",...a[o]),this.$=a[o];break;case 63:r.addComponent("external_component",...a[o]),this.$=a[o];break;case 64:r.addComponent("external_component_db",...a[o]),this.$=a[o];break;case 65:r.addComponent("external_component_queue",...a[o]),this.$=a[o];break;case 67:r.addRel("rel",...a[o]),this.$=a[o];break;case 68:r.addRel("birel",...a[o]),this.$=a[o];break;case 69:r.addRel("rel_u",...a[o]),this.$=a[o];break;case 70:r.addRel("rel_d",...a[o]),this.$=a[o];break;case 71:r.addRel("rel_l",...a[o]),this.$=a[o];break;case 72:r.addRel("rel_r",...a[o]),this.$=a[o];break;case 73:r.addRel("rel_b",...a[o]),this.$=a[o];break;case 74:a[o].splice(0,1),r.addRel("rel",...a[o]),this.$=a[o];break;case 75:r.updateElStyle("update_el_style",...a[o]),this.$=a[o];break;case 76:r.updateRelStyle("update_rel_style",...a[o]),this.$=a[o];break;case 77:r.updateLayoutConfig("update_layout_config",...a[o]),this.$=a[o];break;case 78:this.$=[a[o]];break;case 79:a[o].unshift(a[o-1]),this.$=a[o];break;case 80:case 82:this.$=a[o].trim();break;case 81:let t={};t[a[o-1].trim()]=a[o].trim(),this.$=t;break;case 83:this.$=""}},table:[{3:1,4:2,5:3,6:4,7:n,8:r,9:i,10:a,11:5,12:10,18:s,22:o,25:l,26:u,27:d,28:h},{1:[3]},{1:[2,1]},{1:[2,2]},{3:17,4:2,5:3,6:4,7:n,8:r,9:i,10:a,11:5,12:10,18:s,22:o,25:l,26:u,27:d,28:h},{1:[2,8]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{13:18,19:[1,19]},{15:[1,20]},{15:[1,21]},{15:[1,22]},{15:[1,23]},{15:[1,24]},{19:[2,11]},{1:[2,3]},{14:25,16:[1,26],21:m},e([16,21],[2,12]),{23:28,29:29,30:30,31:31,32:_,33:p,34:f,36:y,38:g,39:58,40:70,42:71,44:b,46:k,47:v,48:x,49:M,50:L,51:w,53:32,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt},{23:79,29:29,30:30,31:31,32:_,33:p,34:f,36:y,38:g,39:58,40:70,42:71,44:b,46:k,47:v,48:x,49:M,50:L,51:w,53:32,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt},{23:80,29:29,30:30,31:31,32:_,33:p,34:f,36:y,38:g,39:58,40:70,42:71,44:b,46:k,47:v,48:x,49:M,50:L,51:w,53:32,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt},{23:81,29:29,30:30,31:31,32:_,33:p,34:f,36:y,38:g,39:58,40:70,42:71,44:b,46:k,47:v,48:x,49:M,50:L,51:w,53:32,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt},{23:82,29:29,30:30,31:31,32:_,33:p,34:f,36:y,38:g,39:58,40:70,42:71,44:b,46:k,47:v,48:x,49:M,50:L,51:w,53:32,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt},{15:[1,83]},{17:84,20:[1,85]},{15:[2,14]},{24:[1,86]},e(rt,[2,20],{53:32,39:58,40:70,42:71,30:87,44:b,46:k,47:v,48:x,49:M,50:L,51:w,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt}),e(rt,[2,21]),e(it,[2,23],{15:[1,88]}),e(rt,[2,43],{15:[1,89]}),e(at,[2,26]),e(at,[2,27]),{35:[1,90]},{37:[1,91]},e(at,[2,30]),{45:92,85:93,86:st,87:ot,89:lt,90:ct},{45:98,85:93,86:st,87:ot,89:lt,90:ct},{45:99,85:93,86:st,87:ot,89:lt,90:ct},{45:100,85:93,86:st,87:ot,89:lt,90:ct},{45:101,85:93,86:st,87:ot,89:lt,90:ct},{45:102,85:93,86:st,87:ot,89:lt,90:ct},{45:103,85:93,86:st,87:ot,89:lt,90:ct},{45:104,85:93,86:st,87:ot,89:lt,90:ct},{45:105,85:93,86:st,87:ot,89:lt,90:ct},{45:106,85:93,86:st,87:ot,89:lt,90:ct},{45:107,85:93,86:st,87:ot,89:lt,90:ct},{45:108,85:93,86:st,87:ot,89:lt,90:ct},{45:109,85:93,86:st,87:ot,89:lt,90:ct},{45:110,85:93,86:st,87:ot,89:lt,90:ct},{45:111,85:93,86:st,87:ot,89:lt,90:ct},{45:112,85:93,86:st,87:ot,89:lt,90:ct},{45:113,85:93,86:st,87:ot,89:lt,90:ct},{45:114,85:93,86:st,87:ot,89:lt,90:ct},{45:115,85:93,86:st,87:ot,89:lt,90:ct},{45:116,85:93,86:st,87:ot,89:lt,90:ct},e(ut,[2,66]),{45:117,85:93,86:st,87:ot,89:lt,90:ct},{45:118,85:93,86:st,87:ot,89:lt,90:ct},{45:119,85:93,86:st,87:ot,89:lt,90:ct},{45:120,85:93,86:st,87:ot,89:lt,90:ct},{45:121,85:93,86:st,87:ot,89:lt,90:ct},{45:122,85:93,86:st,87:ot,89:lt,90:ct},{45:123,85:93,86:st,87:ot,89:lt,90:ct},{45:124,85:93,86:st,87:ot,89:lt,90:ct},{45:125,85:93,86:st,87:ot,89:lt,90:ct},{45:126,85:93,86:st,87:ot,89:lt,90:ct},{45:127,85:93,86:st,87:ot,89:lt,90:ct},{30:128,39:58,40:70,42:71,44:b,46:k,47:v,48:x,49:M,50:L,51:w,53:32,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt},{15:[1,130],43:[1,129]},{45:131,85:93,86:st,87:ot,89:lt,90:ct},{45:132,85:93,86:st,87:ot,89:lt,90:ct},{45:133,85:93,86:st,87:ot,89:lt,90:ct},{45:134,85:93,86:st,87:ot,89:lt,90:ct},{45:135,85:93,86:st,87:ot,89:lt,90:ct},{45:136,85:93,86:st,87:ot,89:lt,90:ct},{45:137,85:93,86:st,87:ot,89:lt,90:ct},{24:[1,138]},{24:[1,139]},{24:[1,140]},{24:[1,141]},e(dt,[2,9]),{14:142,21:m},{21:[2,13]},{1:[2,15]},e(rt,[2,22]),e(it,[2,24],{31:31,29:143,32:_,33:p,34:f,36:y,38:g}),e(rt,[2,44],{29:29,30:30,31:31,53:32,39:58,40:70,42:71,23:144,32:_,33:p,34:f,36:y,38:g,44:b,46:k,47:v,48:x,49:M,50:L,51:w,54:T,55:S,56:D,57:Y,58:E,59:C,60:A,61:O,62:N,63:B,64:F,65:I,66:P,67:j,68:R,69:H,70:$,71:Z,72:W,73:z,74:U,75:q,76:V,77:G,78:J,79:X,80:K,81:Q,82:tt,83:et,84:nt}),e(at,[2,28]),e(at,[2,29]),e(ut,[2,46]),e(ht,[2,78],{85:93,45:145,86:st,87:ot,89:lt,90:ct}),e(mt,[2,80]),{88:[1,146]},e(mt,[2,82]),e(mt,[2,83]),e(ut,[2,47]),e(ut,[2,48]),e(ut,[2,49]),e(ut,[2,50]),e(ut,[2,51]),e(ut,[2,52]),e(ut,[2,53]),e(ut,[2,54]),e(ut,[2,55]),e(ut,[2,56]),e(ut,[2,57]),e(ut,[2,58]),e(ut,[2,59]),e(ut,[2,60]),e(ut,[2,61]),e(ut,[2,62]),e(ut,[2,63]),e(ut,[2,64]),e(ut,[2,65]),e(ut,[2,67]),e(ut,[2,68]),e(ut,[2,69]),e(ut,[2,70]),e(ut,[2,71]),e(ut,[2,72]),e(ut,[2,73]),e(ut,[2,74]),e(ut,[2,75]),e(ut,[2,76]),e(ut,[2,77]),{41:147,52:[1,148]},{15:[1,149]},{43:[1,150]},e(_t,[2,35]),e(_t,[2,36]),e(_t,[2,37]),e(_t,[2,38]),e(_t,[2,39]),e(_t,[2,40]),e(_t,[2,41]),{1:[2,16]},{1:[2,17]},{1:[2,18]},{1:[2,19]},{15:[1,151]},e(it,[2,25]),e(rt,[2,45]),e(ht,[2,79]),e(mt,[2,81]),e(ut,[2,31]),e(ut,[2,42]),e(pt,[2,32]),e(pt,[2,33],{15:[1,152]}),e(dt,[2,10]),e(pt,[2,34])],defaultActions:{2:[2,1],3:[2,2],5:[2,8],6:[2,4],7:[2,5],8:[2,6],9:[2,7],16:[2,11],17:[2,3],27:[2,14],85:[2,13],86:[2,15],138:[2,16],139:[2,17],140:[2,18],141:[2,19]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},yt=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),18;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 10;case 5:return this.begin("type_directive"),19;case 6:return this.popState(),this.begin("arg_directive"),16;case 7:return this.popState(),this.popState(),21;case 8:return 20;case 9:return 32;case 10:return 33;case 11:return this.begin("acc_title"),34;case 12:return this.popState(),"acc_title_value";case 13:return this.begin("acc_descr"),36;case 14:return this.popState(),"acc_descr_value";case 15:this.begin("acc_descr_multiline");break;case 16:case 78:this.popState();break;case 17:return"acc_descr_multiline_value";case 18:case 21:case 75:break;case 19:c;break;case 20:return 15;case 22:return 22;case 23:return 25;case 24:return 26;case 25:return 27;case 26:return 28;case 27:return this.begin("person_ext"),55;case 28:return this.begin("person"),54;case 29:return this.begin("system_ext_queue"),61;case 30:return this.begin("system_ext_db"),60;case 31:return this.begin("system_ext"),59;case 32:return this.begin("system_queue"),58;case 33:return this.begin("system_db"),57;case 34:return this.begin("system"),56;case 35:return this.begin("boundary"),47;case 36:return this.begin("enterprise_boundary"),44;case 37:return this.begin("system_boundary"),46;case 38:return this.begin("container_ext_queue"),67;case 39:return this.begin("container_ext_db"),66;case 40:return this.begin("container_ext"),65;case 41:return this.begin("container_queue"),64;case 42:return this.begin("container_db"),63;case 43:return this.begin("container"),62;case 44:return this.begin("container_boundary"),48;case 45:return this.begin("component_ext_queue"),73;case 46:return this.begin("component_ext_db"),72;case 47:return this.begin("component_ext"),71;case 48:return this.begin("component_queue"),70;case 49:return this.begin("component_db"),69;case 50:return this.begin("component"),68;case 51:case 52:return this.begin("node"),49;case 53:return this.begin("node_l"),50;case 54:return this.begin("node_r"),51;case 55:return this.begin("rel"),74;case 56:return this.begin("birel"),75;case 57:case 58:return this.begin("rel_u"),76;case 59:case 60:return this.begin("rel_d"),77;case 61:case 62:return this.begin("rel_l"),78;case 63:case 64:return this.begin("rel_r"),79;case 65:return this.begin("rel_b"),80;case 66:return this.begin("rel_index"),81;case 67:return this.begin("update_el_style"),82;case 68:return this.begin("update_rel_style"),83;case 69:return this.begin("update_layout_config"),84;case 70:return"EOF_IN_STRUCT";case 71:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 72:this.begin("attribute");break;case 73:case 84:this.popState(),this.popState();break;case 74:case 76:return 90;case 77:this.begin("string");break;case 79:case 85:return"STR";case 80:this.begin("string_kv");break;case 81:return this.begin("string_kv_key"),"STR_KEY";case 82:this.popState(),this.begin("string_kv_value");break;case 83:return"STR_VALUE";case 86:return"LBRACE";case 87:return"RBRACE";case 88:return"SPACE";case 89:return"EOL";case 90:return 24}},rules:[/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},string_kv_value:{rules:[83,84],inclusive:!1},string_kv_key:{rules:[82],inclusive:!1},string_kv:{rules:[81],inclusive:!1},string:{rules:[78,79],inclusive:!1},attribute:{rules:[73,74,75,76,77,80,85],inclusive:!1},update_layout_config:{rules:[70,71,72,73],inclusive:!1},update_rel_style:{rules:[70,71,72,73],inclusive:!1},update_el_style:{rules:[70,71,72,73],inclusive:!1},rel_b:{rules:[70,71,72,73],inclusive:!1},rel_r:{rules:[70,71,72,73],inclusive:!1},rel_l:{rules:[70,71,72,73],inclusive:!1},rel_d:{rules:[70,71,72,73],inclusive:!1},rel_u:{rules:[70,71,72,73],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[70,71,72,73],inclusive:!1},node_r:{rules:[70,71,72,73],inclusive:!1},node_l:{rules:[70,71,72,73],inclusive:!1},node:{rules:[70,71,72,73],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[70,71,72,73],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[70,71,72,73],inclusive:!1},component_ext:{rules:[70,71,72,73],inclusive:!1},component_queue:{rules:[70,71,72,73],inclusive:!1},component_db:{rules:[70,71,72,73],inclusive:!1},component:{rules:[70,71,72,73],inclusive:!1},container_boundary:{rules:[70,71,72,73],inclusive:!1},container_ext_queue:{rules:[],inclusive:!1},container_ext_db:{rules:[70,71,72,73],inclusive:!1},container_ext:{rules:[70,71,72,73],inclusive:!1},container_queue:{rules:[70,71,72,73],inclusive:!1},container_db:{rules:[70,71,72,73],inclusive:!1},container:{rules:[70,71,72,73],inclusive:!1},birel:{rules:[70,71,72,73],inclusive:!1},system_boundary:{rules:[70,71,72,73],inclusive:!1},enterprise_boundary:{rules:[70,71,72,73],inclusive:!1},boundary:{rules:[70,71,72,73],inclusive:!1},system_ext_queue:{rules:[70,71,72,73],inclusive:!1},system_ext_db:{rules:[70,71,72,73],inclusive:!1},system_ext:{rules:[70,71,72,73],inclusive:!1},system_queue:{rules:[70,71,72,73],inclusive:!1},system_db:{rules:[70,71,72,73],inclusive:!1},system:{rules:[70,71,72,73],inclusive:!1},person_ext:{rules:[70,71,72,73],inclusive:!1},person:{rules:[70,71,72,73],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,86,87,88,89,90],inclusive:!0}}},t);function gt(){this.yy={}}return ft.lexer=yt,gt.prototype=ft,ft.Parser=gt,new gt}();Bi.parser=Bi;const Fi=Bi,Ii=t=>null!==t.match(/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/);let Pi=[],ji=[""],Ri="global",Hi="",$i=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Zi=[],Wi="",zi=!1,Ui=4,qi=2;var Vi;const Gi=function(t){return null==t?Pi:Pi.filter((e=>e.parentBoundary===t))},Ji=function(){return zi},Xi={addPersonOrSystem:function(t,e,n,r,i,a,s){if(null===e||null===n)return;let o={};const l=Pi.find((t=>t.alias===e));if(l&&e===l.alias?o=l:(o.alias=e,Pi.push(o)),o.label=null==n?{text:""}:{text:n},null==r)o.descr={text:""};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];o[t]={text:e}}else o.descr={text:r};if("object"==typeof i){let[t,e]=Object.entries(i)[0];o[t]=e}else o.sprite=i;if("object"==typeof a){let[t,e]=Object.entries(a)[0];o[t]=e}else o.tags=a;if("object"==typeof s){let[t,e]=Object.entries(s)[0];o[t]=e}else o.link=s;o.typeC4Shape={text:t},o.parentBoundary=Ri,o.wrap=Ji()},addPersonOrSystemBoundary:function(t,e,n,r,i){if(null===t||null===e)return;let a={};const s=$i.find((e=>e.alias===t));if(s&&t===s.alias?a=s:(a.alias=t,$i.push(a)),a.label=null==e?{text:""}:{text:e},null==n)a.type={text:"system"};else if("object"==typeof n){let[t,e]=Object.entries(n)[0];a[t]={text:e}}else a.type={text:n};if("object"==typeof r){let[t,e]=Object.entries(r)[0];a[t]=e}else a.tags=r;if("object"==typeof i){let[t,e]=Object.entries(i)[0];a[t]=e}else a.link=i;a.parentBoundary=Ri,a.wrap=Ji(),Hi=Ri,Ri=t,ji.push(Hi)},addContainer:function(t,e,n,r,i,a,s,o){if(null===e||null===n)return;let l={};const c=Pi.find((t=>t.alias===e));if(c&&e===c.alias?l=c:(l.alias=e,Pi.push(l)),l.label=null==n?{text:""}:{text:n},null==r)l.techn={text:""};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];l[t]={text:e}}else l.techn={text:r};if(null==i)l.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];l[t]={text:e}}else l.descr={text:i};if("object"==typeof a){let[t,e]=Object.entries(a)[0];l[t]=e}else l.sprite=a;if("object"==typeof s){let[t,e]=Object.entries(s)[0];l[t]=e}else l.tags=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];l[t]=e}else l.link=o;l.wrap=Ji(),l.typeC4Shape={text:t},l.parentBoundary=Ri},addContainerBoundary:function(t,e,n,r,i){if(null===t||null===e)return;let a={};const s=$i.find((e=>e.alias===t));if(s&&t===s.alias?a=s:(a.alias=t,$i.push(a)),a.label=null==e?{text:""}:{text:e},null==n)a.type={text:"container"};else if("object"==typeof n){let[t,e]=Object.entries(n)[0];a[t]={text:e}}else a.type={text:n};if("object"==typeof r){let[t,e]=Object.entries(r)[0];a[t]=e}else a.tags=r;if("object"==typeof i){let[t,e]=Object.entries(i)[0];a[t]=e}else a.link=i;a.parentBoundary=Ri,a.wrap=Ji(),Hi=Ri,Ri=t,ji.push(Hi)},addComponent:function(t,e,n,r,i,a,s,o){if(null===e||null===n)return;let l={};const c=Pi.find((t=>t.alias===e));if(c&&e===c.alias?l=c:(l.alias=e,Pi.push(l)),l.label=null==n?{text:""}:{text:n},null==r)l.techn={text:""};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];l[t]={text:e}}else l.techn={text:r};if(null==i)l.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];l[t]={text:e}}else l.descr={text:i};if("object"==typeof a){let[t,e]=Object.entries(a)[0];l[t]=e}else l.sprite=a;if("object"==typeof s){let[t,e]=Object.entries(s)[0];l[t]=e}else l.tags=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];l[t]=e}else l.link=o;l.wrap=Ji(),l.typeC4Shape={text:t},l.parentBoundary=Ri},addDeploymentNode:function(t,e,n,r,i,a,s,o){if(null===e||null===n)return;let l={};const c=$i.find((t=>t.alias===e));if(c&&e===c.alias?l=c:(l.alias=e,$i.push(l)),l.label=null==n?{text:""}:{text:n},null==r)l.type={text:"node"};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];l[t]={text:e}}else l.type={text:r};if(null==i)l.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];l[t]={text:e}}else l.descr={text:i};if("object"==typeof s){let[t,e]=Object.entries(s)[0];l[t]=e}else l.tags=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];l[t]=e}else l.link=o;l.nodeType=t,l.parentBoundary=Ri,l.wrap=Ji(),Hi=Ri,Ri=e,ji.push(Hi)},popBoundaryParseStack:function(){Ri=Hi,ji.pop(),Hi=ji.pop(),ji.push(Hi)},addRel:function(t,e,n,r,i,a,s,o,l){if(null==t||null==e||null==n||null==r)return;let c={};const u=Zi.find((t=>t.from===e&&t.to===n));if(u?c=u:Zi.push(c),c.type=t,c.from=e,c.to=n,c.label={text:r},null==i)c.techn={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];c[t]={text:e}}else c.techn={text:i};if(null==a)c.descr={text:""};else if("object"==typeof a){let[t,e]=Object.entries(a)[0];c[t]={text:e}}else c.descr={text:a};if("object"==typeof s){let[t,e]=Object.entries(s)[0];c[t]=e}else c.sprite=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];c[t]=e}else c.tags=o;if("object"==typeof l){let[t,e]=Object.entries(l)[0];c[t]=e}else c.link=l;c.wrap=Ji()},updateElStyle:function(t,e,n,r,i,a,s,o,l,c,u){let d=Pi.find((t=>t.alias===e));if(void 0!==d||(d=$i.find((t=>t.alias===e)),void 0!==d)){if(null!=n)if("object"==typeof n){let[t,e]=Object.entries(n)[0];d[t]=e}else d.bgColor=n;if(null!=r)if("object"==typeof r){let[t,e]=Object.entries(r)[0];d[t]=e}else d.fontColor=r;if(null!=i)if("object"==typeof i){let[t,e]=Object.entries(i)[0];d[t]=e}else d.borderColor=i;if(null!=a)if("object"==typeof a){let[t,e]=Object.entries(a)[0];d[t]=e}else d.shadowing=a;if(null!=s)if("object"==typeof s){let[t,e]=Object.entries(s)[0];d[t]=e}else d.shape=s;if(null!=o)if("object"==typeof o){let[t,e]=Object.entries(o)[0];d[t]=e}else d.sprite=o;if(null!=l)if("object"==typeof l){let[t,e]=Object.entries(l)[0];d[t]=e}else d.techn=l;if(null!=c)if("object"==typeof c){let[t,e]=Object.entries(c)[0];d[t]=e}else d.legendText=c;if(null!=u)if("object"==typeof u){let[t,e]=Object.entries(u)[0];d[t]=e}else d.legendSprite=u}},updateRelStyle:function(t,e,n,r,i,a,s){const o=Zi.find((t=>t.from===e&&t.to===n));if(void 0!==o){if(null!=r)if("object"==typeof r){let[t,e]=Object.entries(r)[0];o[t]=e}else o.textColor=r;if(null!=i)if("object"==typeof i){let[t,e]=Object.entries(i)[0];o[t]=e}else o.lineColor=i;if(null!=a)if("object"==typeof a){let[t,e]=Object.entries(a)[0];o[t]=parseInt(e)}else o.offsetX=parseInt(a);if(null!=s)if("object"==typeof s){let[t,e]=Object.entries(s)[0];o[t]=parseInt(e)}else o.offsetY=parseInt(s)}},updateLayoutConfig:function(t,e,n){let r=Ui,i=qi;if("object"==typeof e){const t=Object.values(e)[0];r=parseInt(t)}else r=parseInt(e);if("object"==typeof n){const t=Object.values(n)[0];i=parseInt(t)}else i=parseInt(n);r>=1&&(Ui=r),i>=1&&(qi=i)},autoWrap:Ji,setWrap:function(t){zi=t},getC4ShapeArray:Gi,getC4Shape:function(t){return Pi.find((e=>e.alias===t))},getC4ShapeKeys:function(t){return Object.keys(Gi(t))},getBoundarys:function(t){return null==t?$i:$i.filter((e=>e.parentBoundary===t))},getCurrentBoundaryParse:function(){return Ri},getParentBoundaryParse:function(){return Hi},getRels:function(){return Zi},getTitle:function(){return Wi},getC4Type:function(){return Vi},getC4ShapeInRow:function(){return Ui},getC4BoundaryInRow:function(){return qi},setAccTitle:Or,getAccTitle:Nr,getAccDescription:Fr,setAccDescription:Br,parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().c4,clear:function(){Pi=[],$i=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Hi="",Ri="global",ji=[""],Zi=[],ji=[""],Wi="",zi=!1,Ui=4,qi=2},LINETYPE:{SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},setTitle:function(t){let e=At(t,ar());Wi=e},setC4Type:function(t){let e=At(t,ar());Vi=e}},Ki=function(t,e){const n=t.append("rect");if(n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),"undefined"!==e.attrs&&null!==e.attrs)for(let r in e.attrs)n.attr(r,e.attrs[r]);return"undefined"!==e.class&&n.attr("class",e.class),n},Qi=function(t,e,n,r,i,a){const o=t.append("image");o.attr("width",e),o.attr("height",n),o.attr("x",r),o.attr("y",i);let l=a.startsWith("data:image/png;base64")?a:(0,s.N)(a);o.attr("xlink:href",l)},ta=function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},ea=(t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),na=function(){function t(t,e,n,i,a,s,o){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("text-anchor","middle").text(t),o)}function e(t,e,n,i,a,s,o,l){const{fontSize:c,fontFamily:u,fontWeight:d}=l,h=t.split(Pt.lineBreakRegex);for(let m=0;m<h.length;m++){const t=m*c-c*(h.length-1)/2,s=e.append("text").attr("x",n+a/2).attr("y",i).style("text-anchor","middle").attr("dominant-baseline","middle").style("font-size",c).style("font-weight",d).style("font-family",u);s.append("tspan").attr("dy",t).text(h[m]).attr("alignment-baseline","mathematical"),r(s,o)}}function n(t,n,i,a,s,o,l,c){const u=n.append("switch"),d=u.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,u,i,a,s,0,l,c),r(d,l)}function r(t,e){for(const n in e)e.hasOwnProperty(n)&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),ra=function(t,e,n){const r=t.append("g");let i=e.bgColor?e.bgColor:"none",a=e.borderColor?e.borderColor:"#444444",s=e.fontColor?e.fontColor:"black",o={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};e.nodeType&&(o={"stroke-width":1});let l={x:e.x,y:e.y,fill:i,stroke:a,width:e.width,height:e.height,rx:2.5,ry:2.5,attrs:o};Ki(r,l);let c=n.boundaryFont();c.fontWeight="bold",c.fontSize=c.fontSize+2,c.fontColor=s,na(n)(e.label.text,r,e.x,e.y+e.label.Y,e.width,e.height,{fill:"#444444"},c),e.type&&""!==e.type.text&&(c=n.boundaryFont(),c.fontColor=s,na(n)(e.type.text,r,e.x,e.y+e.type.Y,e.width,e.height,{fill:"#444444"},c)),e.descr&&""!==e.descr.text&&(c=n.boundaryFont(),c.fontSize=c.fontSize-2,c.fontColor=s,na(n)(e.descr.text,r,e.x,e.y+e.descr.Y,e.width,e.height,{fill:"#444444"},c))},ia=function(t,e,n){var r;let i=e.bgColor?e.bgColor:n[e.typeC4Shape.text+"_bg_color"],a=e.borderColor?e.borderColor:n[e.typeC4Shape.text+"_border_color"],s=e.fontColor?e.fontColor:"#FFFFFF",o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(e.typeC4Shape.text){case"person":o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII="}const l=t.append("g");l.attr("class","person-man");const c=ta();switch(e.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":c.x=e.x,c.y=e.y,c.fill=i,c.width=e.width,c.height=e.height,c.stroke=a,c.rx=2.5,c.ry=2.5,c.attrs={"stroke-width":.5},Ki(l,c);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":l.append("path").attr("fill",i).attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2).replaceAll("height",e.height)),l.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":l.append("path").attr("fill",i).attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("width",e.width).replaceAll("half",e.height/2)),l.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",e.x+e.width).replaceAll("starty",e.y).replaceAll("half",e.height/2))}let u=ea(n,e.typeC4Shape.text);switch(l.append("text").attr("fill",s).attr("font-family",u.fontFamily).attr("font-size",u.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",e.typeC4Shape.width).attr("x",e.x+e.width/2-e.typeC4Shape.width/2).attr("y",e.y+e.typeC4Shape.Y).text("<<"+e.typeC4Shape.text+">>"),e.typeC4Shape.text){case"person":case"external_person":Qi(l,48,48,e.x+e.width/2-24,e.y+e.image.Y,o)}let d=n[e.typeC4Shape.text+"Font"]();return d.fontWeight="bold",d.fontSize=d.fontSize+2,d.fontColor=s,na(n)(e.label.text,l,e.x,e.y+e.label.Y,e.width,e.height,{fill:s},d),d=n[e.typeC4Shape.text+"Font"](),d.fontColor=s,e.techn&&""!==(null==(r=e.techn)?void 0:r.text)?na(n)(e.techn.text,l,e.x,e.y+e.techn.Y,e.width,e.height,{fill:s,"font-style":"italic"},d):e.type&&""!==e.type.text&&na(n)(e.type.text,l,e.x,e.y+e.type.Y,e.width,e.height,{fill:s,"font-style":"italic"},d),e.descr&&""!==e.descr.text&&(d=n.personFont(),d.fontColor=s,na(n)(e.descr.text,l,e.x,e.y+e.descr.Y,e.width,e.height,{fill:s},d)),e.height},aa=(t,e,n)=>{const r=t.append("g");let i=0;for(let a of e){let t=a.textColor?a.textColor:"#444444",e=a.lineColor?a.lineColor:"#444444",s=a.offsetX?parseInt(a.offsetX):0,o=a.offsetY?parseInt(a.offsetY):0,l="";if(0===i){let t=r.append("line");t.attr("x1",a.startPoint.x),t.attr("y1",a.startPoint.y),t.attr("x2",a.endPoint.x),t.attr("y2",a.endPoint.y),t.attr("stroke-width","1"),t.attr("stroke",e),t.style("fill","none"),"rel_b"!==a.type&&t.attr("marker-end","url("+l+"#arrowhead)"),"birel"!==a.type&&"rel_b"!==a.type||t.attr("marker-start","url("+l+"#arrowend)"),i=-1}else{let t=r.append("path");t.attr("fill","none").attr("stroke-width","1").attr("stroke",e).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",a.startPoint.x).replaceAll("starty",a.startPoint.y).replaceAll("controlx",a.startPoint.x+(a.endPoint.x-a.startPoint.x)/2-(a.endPoint.x-a.startPoint.x)/4).replaceAll("controly",a.startPoint.y+(a.endPoint.y-a.startPoint.y)/2).replaceAll("stopx",a.endPoint.x).replaceAll("stopy",a.endPoint.y)),"rel_b"!==a.type&&t.attr("marker-end","url("+l+"#arrowhead)"),"birel"!==a.type&&"rel_b"!==a.type||t.attr("marker-start","url("+l+"#arrowend)")}let c=n.messageFont();na(n)(a.label.text,r,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+s,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+o,a.label.width,a.label.height,{fill:t},c),a.techn&&""!==a.techn.text&&(c=n.messageFont(),na(n)("["+a.techn.text+"]",r,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+s,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+n.messageFontSize+5+o,Math.max(a.label.width,a.techn.width),a.techn.height,{fill:t,"font-style":"italic"},c))}},sa=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},oa=function(t){t.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},la=function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},ca=function(t){const e=t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);e.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),e.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},ua=function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},da=function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},ha=function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")};s.N;let ma=0,_a=0,pa=4,fa=2;Bi.yy=Xi;let ya={};class ga{constructor(t){this.name="",this.data={},this.data.startx=void 0,this.data.stopx=void 0,this.data.starty=void 0,this.data.stopy=void 0,this.data.widthLimit=void 0,this.nextData={},this.nextData.startx=void 0,this.nextData.stopx=void 0,this.nextData.starty=void 0,this.nextData.stopy=void 0,this.nextData.cnt=0,ba(t.db.getConfig())}setData(t,e,n,r){this.nextData.startx=this.data.startx=t,this.nextData.stopx=this.data.stopx=e,this.nextData.starty=this.data.starty=n,this.nextData.stopy=this.data.stopy=r}updateVal(t,e,n,r){void 0===t[e]?t[e]=n:t[e]=r(n,t[e])}insert(t){this.nextData.cnt=this.nextData.cnt+1;let e=this.nextData.startx===this.nextData.stopx?this.nextData.stopx+t.margin:this.nextData.stopx+2*t.margin,n=e+t.width,r=this.nextData.starty+2*t.margin,i=r+t.height;(e>=this.data.widthLimit||n>=this.data.widthLimit||this.nextData.cnt>pa)&&(e=this.nextData.startx+t.margin+ya.nextLinePaddingX,r=this.nextData.stopy+2*t.margin,this.nextData.stopx=n=e+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=i=r+t.height,this.nextData.cnt=1),t.x=e,t.y=r,this.updateVal(this.data,"startx",e,Math.min),this.updateVal(this.data,"starty",r,Math.min),this.updateVal(this.data,"stopx",n,Math.max),this.updateVal(this.data,"stopy",i,Math.max),this.updateVal(this.nextData,"startx",e,Math.min),this.updateVal(this.nextData,"starty",r,Math.min),this.updateVal(this.nextData,"stopx",n,Math.max),this.updateVal(this.nextData,"stopy",i,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},ba(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}}const ba=function(t){Sn(ya,t),t.fontFamily&&(ya.personFontFamily=ya.systemFontFamily=ya.messageFontFamily=t.fontFamily),t.fontSize&&(ya.personFontSize=ya.systemFontSize=ya.messageFontSize=t.fontSize),t.fontWeight&&(ya.personFontWeight=ya.systemFontWeight=ya.messageFontWeight=t.fontWeight)},ka=(t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),va=t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight});function xa(t,e,n,r,i){if(!e[t].width)if(n)e[t].text=jn(e[t].text,i,r),e[t].textLines=e[t].text.split(Pt.lineBreakRegex).length,e[t].width=i,e[t].height=Hn(e[t].text,r);else{let n=e[t].text.split(Pt.lineBreakRegex);e[t].textLines=n.length;let i=0;e[t].height=0,e[t].width=0;for(const a of n)e[t].width=Math.max($n(a,r),e[t].width),i=Hn(a,r),e[t].height=e[t].height+i}}const Ma=function(t,e,n){e.x=n.data.startx,e.y=n.data.starty,e.width=n.data.stopx-n.data.startx,e.height=n.data.stopy-n.data.starty,e.label.y=ya.c4ShapeMargin-35;let r=e.wrap&&ya.wrap,i=va(ya);i.fontSize=i.fontSize+2,i.fontWeight="bold",xa("label",e,r,i,$n(e.label.text,i)),ra(t,e,ya)},La=function(t,e,n,r){let i=0;for(const a of r){i=0;const r=n[a];let s=ka(ya,r.typeC4Shape.text);switch(s.fontSize=s.fontSize-2,r.typeC4Shape.width=$n("<<"+r.typeC4Shape.text+">>",s),r.typeC4Shape.height=s.fontSize+2,r.typeC4Shape.Y=ya.c4ShapePadding,i=r.typeC4Shape.Y+r.typeC4Shape.height-4,r.image={width:0,height:0,Y:0},r.typeC4Shape.text){case"person":case"external_person":r.image.width=48,r.image.height=48,r.image.Y=i,i=r.image.Y+r.image.height}r.sprite&&(r.image.width=48,r.image.height=48,r.image.Y=i,i=r.image.Y+r.image.height);let o=r.wrap&&ya.wrap,l=ya.width-2*ya.c4ShapePadding,c=ka(ya,r.typeC4Shape.text);if(c.fontSize=c.fontSize+2,c.fontWeight="bold",xa("label",r,o,c,l),r.label.Y=i+8,i=r.label.Y+r.label.height,r.type&&""!==r.type.text){r.type.text="["+r.type.text+"]",xa("type",r,o,ka(ya,r.typeC4Shape.text),l),r.type.Y=i+5,i=r.type.Y+r.type.height}else if(r.techn&&""!==r.techn.text){r.techn.text="["+r.techn.text+"]",xa("techn",r,o,ka(ya,r.techn.text),l),r.techn.Y=i+5,i=r.techn.Y+r.techn.height}let u=i,d=r.label.width;if(r.descr&&""!==r.descr.text){xa("descr",r,o,ka(ya,r.typeC4Shape.text),l),r.descr.Y=i+20,i=r.descr.Y+r.descr.height,d=Math.max(r.label.width,r.descr.width),u=i-5*r.descr.textLines}d+=ya.c4ShapePadding,r.width=Math.max(r.width||ya.width,d,ya.width),r.height=Math.max(r.height||ya.height,u,ya.height),r.margin=r.margin||ya.c4ShapeMargin,t.insert(r),ia(e,r,ya)}t.bumpLastMargin(ya.c4ShapeMargin)};class wa{constructor(t,e){this.x=t,this.y=e}}let Ta=function(t,e){let n=t.x,r=t.y,i=e.x,a=e.y,s=n+t.width/2,o=r+t.height/2,l=Math.abs(n-i),c=Math.abs(r-a),u=c/l,d=t.height/t.width,h=null;return r==a&&n<i?h=new wa(n+t.width,o):r==a&&n>i?h=new wa(n,o):n==i&&r<a?h=new wa(s,r+t.height):n==i&&r>a&&(h=new wa(s,r)),n>i&&r<a?h=d>=u?new wa(n,o+u*t.width/2):new wa(s-l/c*t.height/2,r+t.height):n<i&&r<a?h=d>=u?new wa(n+t.width,o+u*t.width/2):new wa(s+l/c*t.height/2,r+t.height):n<i&&r>a?h=d>=u?new wa(n+t.width,o-u*t.width/2):new wa(s+t.height/2*l/c,r):n>i&&r>a&&(h=d>=u?new wa(n,o-t.width/2*u):new wa(s-t.height/2*l/c,r)),h},Sa=function(t,e){let n={x:0,y:0};n.x=e.x+e.width/2,n.y=e.y+e.height/2;let r=Ta(t,n);return n.x=t.x+t.width/2,n.y=t.y+t.height/2,{startPoint:r,endPoint:Ta(e,n)}};function Da(t,e,n,r,i){let a=new ga(i);a.data.widthLimit=n.data.widthLimit/Math.min(fa,r.length);for(let[s,o]of r.entries()){let r=0;o.image={width:0,height:0,Y:0},o.sprite&&(o.image.width=48,o.image.height=48,o.image.Y=r,r=o.image.Y+o.image.height);let l=o.wrap&&ya.wrap,c=va(ya);if(c.fontSize=c.fontSize+2,c.fontWeight="bold",xa("label",o,l,c,a.data.widthLimit),o.label.Y=r+8,r=o.label.Y+o.label.height,o.type&&""!==o.type.text){o.type.text="["+o.type.text+"]",xa("type",o,l,va(ya),a.data.widthLimit),o.type.Y=r+5,r=o.type.Y+o.type.height}if(o.descr&&""!==o.descr.text){let t=va(ya);t.fontSize=t.fontSize-2,xa("descr",o,l,t,a.data.widthLimit),o.descr.Y=r+20,r=o.descr.Y+o.descr.height}if(0==s||s%fa==0){let t=n.data.startx+ya.diagramMarginX,e=n.data.stopy+ya.diagramMarginY+r;a.setData(t,t,e,e)}else{let t=a.data.stopx!==a.data.startx?a.data.stopx+ya.diagramMarginX:a.data.startx,e=a.data.starty;a.setData(t,t,e,e)}a.name=o.alias;let u=i.db.getC4ShapeArray(o.alias),d=i.db.getC4ShapeKeys(o.alias);d.length>0&&La(a,t,u,d),e=o.alias;let h=i.db.getBoundarys(e);h.length>0&&Da(t,e,a,h,i),"global"!==o.alias&&Ma(t,o,a),n.data.stopy=Math.max(a.data.stopy+ya.c4ShapeMargin,n.data.stopy),n.data.stopx=Math.max(a.data.stopx+ya.c4ShapeMargin,n.data.stopx),ma=Math.max(ma,n.data.stopx),_a=Math.max(_a,n.data.stopy)}}const Ya={drawPersonOrSystemArray:La,drawBoundary:Ma,setConf:ba,draw:function(t,e,n,r){ya=ar().c4;const i=ar().securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s="sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body");let l=r.db;r.db.setWrap(ya.wrap),pa=l.getC4ShapeInRow(),fa=l.getC4BoundaryInRow(),St.debug(`C:${JSON.stringify(ya,null,2)}`);const c="sandbox"===i?s.select(`[id="${e}"]`):(0,o.Ys)(`[id="${e}"]`);da(c),ua(c),ha(c);let u=new ga(r);u.setData(ya.diagramMarginX,ya.diagramMarginX,ya.diagramMarginY,ya.diagramMarginY),u.data.widthLimit=screen.availWidth,ma=ya.diagramMarginX,_a=ya.diagramMarginY;const d=r.db.getTitle();Da(c,"",u,r.db.getBoundarys(""),r),sa(c),oa(c),ca(c),la(c),function(t,e,n,r){let i=0;for(let s of e){i+=1;let t=s.wrap&&ya.wrap,e={fontFamily:(a=ya).messageFontFamily,fontSize:a.messageFontSize,fontWeight:a.messageFontWeight};"C4Dynamic"===r.db.getC4Type()&&(s.label.text=i+": "+s.label.text);let o=$n(s.label.text,e);xa("label",s,t,e,o),s.techn&&""!==s.techn.text&&(o=$n(s.techn.text,e),xa("techn",s,t,e,o)),s.descr&&""!==s.descr.text&&(o=$n(s.descr.text,e),xa("descr",s,t,e,o));let l=n(s.from),c=n(s.to),u=Sa(l,c);s.startPoint=u.startPoint,s.endPoint=u.endPoint}var a;aa(t,e,ya)}(c,r.db.getRels(),r.db.getC4Shape,r),u.data.stopx=ma,u.data.stopy=_a;const h=u.data;let m=h.stopy-h.starty+2*ya.diagramMarginY;const _=h.stopx-h.startx+2*ya.diagramMarginX;d&&c.append("text").text(d).attr("x",(h.stopx-h.startx)/2-4*ya.diagramMarginX).attr("y",h.starty+ya.diagramMarginY),hr(c,m,_,ya.useMaxWidth);const p=d?60:0;c.attr("viewBox",h.startx-ya.diagramMarginX+" -"+(ya.diagramMarginY+p)+" "+_+" "+(m+p)),St.debug("models:",h)}};var Ea=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,3],r=[1,7],i=[1,8],a=[1,9],s=[1,10],o=[1,13],l=[1,12],c=[1,16,25],u=[1,20],d=[1,32],h=[1,33],m=[1,34],_=[1,36],p=[1,39],f=[1,37],y=[1,38],g=[1,44],b=[1,45],k=[1,40],v=[1,41],x=[1,42],M=[1,43],L=[1,48],w=[1,49],T=[1,50],S=[1,51],D=[16,25],Y=[1,65],E=[1,66],C=[1,67],A=[1,68],O=[1,69],N=[1,70],B=[1,71],F=[1,80],I=[16,25,32,45,46,54,60,61,62,63,64,65,66,71,73],P=[16,25,30,32,45,46,50,54,60,61,62,63,64,65,66,71,73,88,89,90,91],j=[5,8,9,10,11,16,19,23,25],R=[54,88,89,90,91],H=[54,65,66,88,89,90,91],$=[54,60,61,62,63,64,88,89,90,91],Z=[16,25,32],W=[1,107],z={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statments:5,direction:6,directive:7,direction_tb:8,direction_bt:9,direction_rl:10,direction_lr:11,graphConfig:12,openDirective:13,typeDirective:14,closeDirective:15,NEWLINE:16,":":17,argDirective:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,CLASS_DIAGRAM:23,statements:24,EOF:25,statement:26,className:27,alphaNumToken:28,classLiteralName:29,GENERICTYPE:30,relationStatement:31,LABEL:32,classStatement:33,methodStatement:34,annotationStatement:35,clickStatement:36,cssClassStatement:37,noteStatement:38,acc_title:39,acc_title_value:40,acc_descr:41,acc_descr_value:42,acc_descr_multiline_value:43,CLASS:44,STYLE_SEPARATOR:45,STRUCT_START:46,members:47,STRUCT_STOP:48,ANNOTATION_START:49,ANNOTATION_END:50,MEMBER:51,SEPARATOR:52,relation:53,STR:54,NOTE_FOR:55,noteText:56,NOTE:57,relationType:58,lineType:59,AGGREGATION:60,EXTENSION:61,COMPOSITION:62,DEPENDENCY:63,LOLLIPOP:64,LINE:65,DOTTED_LINE:66,CALLBACK:67,LINK:68,LINK_TARGET:69,CLICK:70,CALLBACK_NAME:71,CALLBACK_ARGS:72,HREF:73,CSSCLASS:74,commentToken:75,textToken:76,graphCodeTokens:77,textNoTagsToken:78,TAGSTART:79,TAGEND:80,"==":81,"--":82,PCT:83,DEFAULT:84,SPACE:85,MINUS:86,keywords:87,UNICODE_TEXT:88,NUM:89,ALPHA:90,BQUOTE_STR:91,$accept:0,$end:1},terminals_:{2:"error",5:"statments",8:"direction_tb",9:"direction_bt",10:"direction_rl",11:"direction_lr",16:"NEWLINE",17:":",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",23:"CLASS_DIAGRAM",25:"EOF",30:"GENERICTYPE",32:"LABEL",39:"acc_title",40:"acc_title_value",41:"acc_descr",42:"acc_descr_value",43:"acc_descr_multiline_value",44:"CLASS",45:"STYLE_SEPARATOR",46:"STRUCT_START",48:"STRUCT_STOP",49:"ANNOTATION_START",50:"ANNOTATION_END",51:"MEMBER",52:"SEPARATOR",54:"STR",55:"NOTE_FOR",57:"NOTE",60:"AGGREGATION",61:"EXTENSION",62:"COMPOSITION",63:"DEPENDENCY",64:"LOLLIPOP",65:"LINE",66:"DOTTED_LINE",67:"CALLBACK",68:"LINK",69:"LINK_TARGET",70:"CLICK",71:"CALLBACK_NAME",72:"CALLBACK_ARGS",73:"HREF",74:"CSSCLASS",77:"graphCodeTokens",79:"TAGSTART",80:"TAGEND",81:"==",82:"--",83:"PCT",84:"DEFAULT",85:"SPACE",86:"MINUS",87:"keywords",88:"UNICODE_TEXT",89:"NUM",90:"ALPHA",91:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[3,1],[3,2],[6,1],[6,1],[6,1],[6,1],[4,1],[7,4],[7,6],[13,1],[14,1],[18,1],[15,1],[12,4],[24,1],[24,2],[24,3],[27,1],[27,1],[27,2],[27,2],[27,2],[26,1],[26,2],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[26,2],[26,1],[33,2],[33,4],[33,5],[33,7],[35,4],[47,1],[47,2],[34,1],[34,2],[34,1],[34,1],[31,3],[31,4],[31,4],[31,5],[38,3],[38,2],[53,3],[53,2],[53,2],[53,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[36,3],[36,4],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[37,3],[75,1],[75,1],[76,1],[76,1],[76,1],[76,1],[76,1],[76,1],[76,1],[78,1],[78,1],[78,1],[78,1],[28,1],[28,1],[28,1],[29,1],[56,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 5:r.setDirection("TB");break;case 6:r.setDirection("BT");break;case 7:r.setDirection("RL");break;case 8:r.setDirection("LR");break;case 12:r.parseDirective("%%{","open_directive");break;case 13:r.parseDirective(a[o],"type_directive");break;case 14:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 15:r.parseDirective("}%%","close_directive","class");break;case 20:case 21:this.$=a[o];break;case 22:this.$=a[o-1]+a[o];break;case 23:case 24:this.$=a[o-1]+"~"+a[o];break;case 25:r.addRelation(a[o]);break;case 26:a[o-1].title=r.cleanupLabel(a[o]),r.addRelation(a[o-1]);break;case 35:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 36:case 37:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 38:r.addClass(a[o]);break;case 39:r.addClass(a[o-2]),r.setCssClass(a[o-2],a[o]);break;case 40:r.addClass(a[o-3]),r.addMembers(a[o-3],a[o-1]);break;case 41:r.addClass(a[o-5]),r.setCssClass(a[o-5],a[o-3]),r.addMembers(a[o-5],a[o-1]);break;case 42:r.addAnnotation(a[o],a[o-2]);break;case 43:this.$=[a[o]];break;case 44:a[o].push(a[o-1]),this.$=a[o];break;case 45:case 47:case 48:break;case 46:r.addMember(a[o-1],r.cleanupLabel(a[o]));break;case 49:this.$={id1:a[o-2],id2:a[o],relation:a[o-1],relationTitle1:"none",relationTitle2:"none"};break;case 50:this.$={id1:a[o-3],id2:a[o],relation:a[o-1],relationTitle1:a[o-2],relationTitle2:"none"};break;case 51:this.$={id1:a[o-3],id2:a[o],relation:a[o-2],relationTitle1:"none",relationTitle2:a[o-1]};break;case 52:this.$={id1:a[o-4],id2:a[o],relation:a[o-2],relationTitle1:a[o-3],relationTitle2:a[o-1]};break;case 53:r.addNote(a[o],a[o-1]);break;case 54:r.addNote(a[o]);break;case 55:this.$={type1:a[o-2],type2:a[o],lineType:a[o-1]};break;case 56:this.$={type1:"none",type2:a[o],lineType:a[o-1]};break;case 57:this.$={type1:a[o-1],type2:"none",lineType:a[o]};break;case 58:this.$={type1:"none",type2:"none",lineType:a[o]};break;case 59:this.$=r.relationType.AGGREGATION;break;case 60:this.$=r.relationType.EXTENSION;break;case 61:this.$=r.relationType.COMPOSITION;break;case 62:this.$=r.relationType.DEPENDENCY;break;case 63:this.$=r.relationType.LOLLIPOP;break;case 64:this.$=r.lineType.LINE;break;case 65:this.$=r.lineType.DOTTED_LINE;break;case 66:case 72:this.$=a[o-2],r.setClickEvent(a[o-1],a[o]);break;case 67:case 73:this.$=a[o-3],r.setClickEvent(a[o-2],a[o-1]),r.setTooltip(a[o-2],a[o]);break;case 68:case 76:this.$=a[o-2],r.setLink(a[o-1],a[o]);break;case 69:case 77:this.$=a[o-3],r.setLink(a[o-2],a[o-1],a[o]);break;case 70:case 78:this.$=a[o-3],r.setLink(a[o-2],a[o-1]),r.setTooltip(a[o-2],a[o]);break;case 71:case 79:this.$=a[o-4],r.setLink(a[o-3],a[o-2],a[o]),r.setTooltip(a[o-3],a[o-1]);break;case 74:this.$=a[o-3],r.setClickEvent(a[o-2],a[o-1],a[o]);break;case 75:this.$=a[o-4],r.setClickEvent(a[o-3],a[o-2],a[o-1]),r.setTooltip(a[o-3],a[o]);break;case 80:r.setCssClass(a[o-1],a[o])}},table:[{3:1,4:2,5:n,6:4,7:5,8:r,9:i,10:a,11:s,12:6,13:11,19:o,23:l},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{3:14,4:2,5:n,6:4,7:5,8:r,9:i,10:a,11:s,12:6,13:11,19:o,23:l},{1:[2,9]},e(c,[2,5]),e(c,[2,6]),e(c,[2,7]),e(c,[2,8]),{14:15,20:[1,16]},{16:[1,17]},{20:[2,12]},{1:[2,4]},{15:18,17:[1,19],22:u},e([17,22],[2,13]),{6:31,7:30,8:r,9:i,10:a,11:s,13:11,19:o,24:21,26:22,27:35,28:46,29:47,31:23,33:24,34:25,35:26,36:27,37:28,38:29,39:d,41:h,43:m,44:_,49:p,51:f,52:y,55:g,57:b,67:k,68:v,70:x,74:M,88:L,89:w,90:T,91:S},{16:[1,52]},{18:53,21:[1,54]},{16:[2,15]},{25:[1,55]},{16:[1,56],25:[2,17]},e(D,[2,25],{32:[1,57]}),e(D,[2,27]),e(D,[2,28]),e(D,[2,29]),e(D,[2,30]),e(D,[2,31]),e(D,[2,32]),e(D,[2,33]),e(D,[2,34]),{40:[1,58]},{42:[1,59]},e(D,[2,37]),e(D,[2,45],{53:60,58:63,59:64,32:[1,62],54:[1,61],60:Y,61:E,62:C,63:A,64:O,65:N,66:B}),{27:72,28:46,29:47,88:L,89:w,90:T,91:S},e(D,[2,47]),e(D,[2,48]),{28:73,88:L,89:w,90:T},{27:74,28:46,29:47,88:L,89:w,90:T,91:S},{27:75,28:46,29:47,88:L,89:w,90:T,91:S},{27:76,28:46,29:47,88:L,89:w,90:T,91:S},{54:[1,77]},{27:78,28:46,29:47,88:L,89:w,90:T,91:S},{54:F,56:79},e(I,[2,20],{28:46,29:47,27:81,30:[1,82],88:L,89:w,90:T,91:S}),e(I,[2,21],{30:[1,83]}),e(P,[2,94]),e(P,[2,95]),e(P,[2,96]),e([16,25,30,32,45,46,54,60,61,62,63,64,65,66,71,73],[2,97]),e(j,[2,10]),{15:84,22:u},{22:[2,14]},{1:[2,16]},{6:31,7:30,8:r,9:i,10:a,11:s,13:11,19:o,24:85,25:[2,18],26:22,27:35,28:46,29:47,31:23,33:24,34:25,35:26,36:27,37:28,38:29,39:d,41:h,43:m,44:_,49:p,51:f,52:y,55:g,57:b,67:k,68:v,70:x,74:M,88:L,89:w,90:T,91:S},e(D,[2,26]),e(D,[2,35]),e(D,[2,36]),{27:86,28:46,29:47,54:[1,87],88:L,89:w,90:T,91:S},{53:88,58:63,59:64,60:Y,61:E,62:C,63:A,64:O,65:N,66:B},e(D,[2,46]),{59:89,65:N,66:B},e(R,[2,58],{58:90,60:Y,61:E,62:C,63:A,64:O}),e(H,[2,59]),e(H,[2,60]),e(H,[2,61]),e(H,[2,62]),e(H,[2,63]),e($,[2,64]),e($,[2,65]),e(D,[2,38],{45:[1,91],46:[1,92]}),{50:[1,93]},{54:[1,94]},{54:[1,95]},{71:[1,96],73:[1,97]},{28:98,88:L,89:w,90:T},{54:F,56:99},e(D,[2,54]),e(D,[2,98]),e(I,[2,22]),e(I,[2,23]),e(I,[2,24]),{16:[1,100]},{25:[2,19]},e(Z,[2,49]),{27:101,28:46,29:47,88:L,89:w,90:T,91:S},{27:102,28:46,29:47,54:[1,103],88:L,89:w,90:T,91:S},e(R,[2,57],{58:104,60:Y,61:E,62:C,63:A,64:O}),e(R,[2,56]),{28:105,88:L,89:w,90:T},{47:106,51:W},{27:108,28:46,29:47,88:L,89:w,90:T,91:S},e(D,[2,66],{54:[1,109]}),e(D,[2,68],{54:[1,111],69:[1,110]}),e(D,[2,72],{54:[1,112],72:[1,113]}),e(D,[2,76],{54:[1,115],69:[1,114]}),e(D,[2,80]),e(D,[2,53]),e(j,[2,11]),e(Z,[2,51]),e(Z,[2,50]),{27:116,28:46,29:47,88:L,89:w,90:T,91:S},e(R,[2,55]),e(D,[2,39],{46:[1,117]}),{48:[1,118]},{47:119,48:[2,43],51:W},e(D,[2,42]),e(D,[2,67]),e(D,[2,69]),e(D,[2,70],{69:[1,120]}),e(D,[2,73]),e(D,[2,74],{54:[1,121]}),e(D,[2,77]),e(D,[2,78],{69:[1,122]}),e(Z,[2,52]),{47:123,51:W},e(D,[2,40]),{48:[2,44]},e(D,[2,71]),e(D,[2,75]),e(D,[2,79]),{48:[1,124]},e(D,[2,41])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],6:[2,9],13:[2,12],14:[2,4],20:[2,15],54:[2,14],55:[2,16],85:[2,19],119:[2,44]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},U=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),19;case 1:return 8;case 2:return 9;case 3:return 10;case 4:return 11;case 5:return this.begin("type_directive"),20;case 6:return this.popState(),this.begin("arg_directive"),17;case 7:return this.popState(),this.popState(),22;case 8:return 21;case 9:case 10:case 19:case 27:break;case 11:return this.begin("acc_title"),39;case 12:return this.popState(),"acc_title_value";case 13:return this.begin("acc_descr"),41;case 14:return this.popState(),"acc_descr_value";case 15:this.begin("acc_descr_multiline");break;case 16:case 39:case 42:case 45:case 48:case 51:case 54:this.popState();break;case 17:return"acc_descr_multiline_value";case 18:return 16;case 20:case 21:return 23;case 22:return this.begin("struct"),46;case 23:return"EDGE_STATE";case 24:return"EOF_IN_STRUCT";case 25:return"OPEN_IN_STRUCT";case 26:return this.popState(),48;case 28:return"MEMBER";case 29:return 44;case 30:return 74;case 31:return 67;case 32:return 68;case 33:return 70;case 34:return 55;case 35:return 57;case 36:return 49;case 37:return 50;case 38:this.begin("generic");break;case 40:return"GENERICTYPE";case 41:this.begin("string");break;case 43:return"STR";case 44:this.begin("bqstring");break;case 46:return"BQUOTE_STR";case 47:this.begin("href");break;case 49:return 73;case 50:this.begin("callback_name");break;case 52:this.popState(),this.begin("callback_args");break;case 53:return 71;case 55:return 72;case 56:case 57:case 58:case 59:return 69;case 60:case 61:return 61;case 62:case 63:return 63;case 64:return 62;case 65:return 60;case 66:return 64;case 67:return 65;case 68:return 66;case 69:return 32;case 70:return 45;case 71:return 86;case 72:return"DOT";case 73:return"PLUS";case 74:return 83;case 75:case 76:return"EQUALS";case 77:return 90;case 78:return"PUNCTUATION";case 79:return 89;case 80:return 88;case 81:return 85;case 82:return 25}},rules:[/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:[{])/,/^(?:\[\*\])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:class\b)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},callback_args:{rules:[54,55],inclusive:!1},callback_name:{rules:[51,52,53],inclusive:!1},href:{rules:[48,49],inclusive:!1},struct:{rules:[23,24,25,26,27,28],inclusive:!1},generic:{rules:[39,40],inclusive:!1},bqstring:{rules:[45,46],inclusive:!1},string:{rules:[42,43],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,29,30,31,32,33,34,35,36,37,38,41,44,47,50,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82],inclusive:!0}}},t);function q(){this.yy={}}return z.lexer=U,q.prototype=z,z.Parser=q,new q}();Ea.parser=Ea;const Ca=Ea,Aa=(t,e)=>{var n;return"dagre-wrapper"!==(null==(n=null==e?void 0:e.class)?void 0:n.defaultRenderer)&&null!==t.match(/^\s*classDiagram/)},Oa=(t,e)=>{var n;return null!==t.match(/^\s*classDiagram/)&&"dagre-wrapper"===(null==(n=null==e?void 0:e.class)?void 0:n.defaultRenderer)||null!==t.match(/^\s*classDiagram-v2/)},Na="classid-";let Ba=[],Fa={},Ia=[],Pa=0,ja=[];const Ra=t=>Pt.sanitizeText(t,ar()),Ha=function(t){let e="",n=t;if(t.indexOf("~")>0){let r=t.split("~");n=r[0],e=Pt.sanitizeText(r[1],ar())}return{className:n,type:e}},$a=function(t){let e=Ha(t);void 0===Fa[e.className]&&(Fa[e.className]={id:e.className,type:e.type,cssClasses:[],methods:[],members:[],annotations:[],domId:Na+e.className+"-"+Pa},Pa++)},Za=function(t){const e=Object.keys(Fa);for(const n of e)if(Fa[n].id===t)return Fa[n].domId},Wa=function(t,e){const n=Ha(t).className,r=Fa[n];if("string"==typeof e){const t=e.trim();t.startsWith("<<")&&t.endsWith(">>")?r.annotations.push(Ra(t.substring(2,t.length-2))):t.indexOf(")")>0?r.methods.push(Ra(t)):t&&r.members.push(Ra(t))}},za=function(t,e){t.split(",").forEach((function(t){let n=t;t[0].match(/\d/)&&(n=Na+n),void 0!==Fa[n]&&Fa[n].cssClasses.push(e)}))},Ua=function(t,e,n){const r=ar();let i=t,a=Za(i);if("loose"===r.securityLevel&&void 0!==e&&void 0!==Fa[i]){let t=[];if("string"==typeof n){t=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let e=0;e<t.length;e++){let n=t[e].trim();'"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substr(1,n.length-2)),t[e]=n}}0===t.length&&t.push(a),ja.push((function(){const n=document.querySelector(`[id="${a}"]`);null!==n&&n.addEventListener("click",(function(){Gn.runFunc(e,...t)}),!1)}))}},qa=function(t){let e=(0,o.Ys)(".mermaidTooltip");null===(e._groups||e)[0][0]&&(e=(0,o.Ys)("body").append("div").attr("class","mermaidTooltip").style("opacity",0));(0,o.Ys)(t).select("svg").selectAll("g.node").on("mouseover",(function(){const t=(0,o.Ys)(this);if(null===t.attr("title"))return;const n=this.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.text(t.attr("title")).style("left",window.scrollX+n.left+(n.right-n.left)/2+"px").style("top",window.scrollY+n.top-14+document.body.scrollTop+"px"),e.html(e.html().replace(/<br\/>/g,"<br/>")),t.classed("hover",!0)})).on("mouseout",(function(){e.transition().duration(500).style("opacity",0);(0,o.Ys)(this).classed("hover",!1)}))};ja.push(qa);let Va="TB";const Ga={parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},setAccTitle:Or,getAccTitle:Nr,getAccDescription:Fr,setAccDescription:Br,getConfig:()=>ar().class,addClass:$a,bindFunctions:function(t){ja.forEach((function(e){e(t)}))},clear:function(){Ba=[],Fa={},Ia=[],ja=[],ja.push(qa),Ar()},getClass:function(t){return Fa[t]},getClasses:function(){return Fa},getNotes:function(){return Ia},addAnnotation:function(t,e){const n=Ha(t).className;Fa[n].annotations.push(e)},addNote:function(t,e){const n={id:`note${Ia.length}`,class:e,text:t};Ia.push(n)},getRelations:function(){return Ba},addRelation:function(t){St.debug("Adding relation: "+JSON.stringify(t)),$a(t.id1),$a(t.id2),t.id1=Ha(t.id1).className,t.id2=Ha(t.id2).className,t.relationTitle1=Pt.sanitizeText(t.relationTitle1.trim(),ar()),t.relationTitle2=Pt.sanitizeText(t.relationTitle2.trim(),ar()),Ba.push(t)},getDirection:()=>Va,setDirection:t=>{Va=t},addMember:Wa,addMembers:function(t,e){Array.isArray(e)&&(e.reverse(),e.forEach((e=>Wa(t,e))))},cleanupLabel:function(t){return":"===t.substring(0,1)?Pt.sanitizeText(t.substr(1).trim(),ar()):Ra(t.trim())},lineType:{LINE:0,DOTTED_LINE:1},relationType:{AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},setClickEvent:function(t,e,n){t.split(",").forEach((function(t){Ua(t,e,n),Fa[t].haveCallback=!0})),za(t,"clickable")},setCssClass:za,setLink:function(t,e,n){const r=ar();t.split(",").forEach((function(t){let i=t;t[0].match(/\d/)&&(i=Na+i),void 0!==Fa[i]&&(Fa[i].link=Gn.formatUrl(e,r),"sandbox"===r.securityLevel?Fa[i].linkTarget="_top":Fa[i].linkTarget="string"==typeof n?Ra(n):"_blank")})),za(t,"clickable")},getTooltip:function(t){return Fa[t].tooltip},setTooltip:function(t,e){const n=ar();t.split(",").forEach((function(t){void 0!==e&&(Fa[t].tooltip=Pt.sanitizeText(e,n))}))},lookUpDomId:Za,setDiagramTitle:Ir,getDiagramTitle:Pr};let Ja=0;const Xa=function(t){let e=t.match(/^([#+~-])?(\w+)(~\w+~|\[])?\s+(\w+) *([$*])?$/),n=t.match(/^([#+|~-])?(\w+) *\( *(.*)\) *([$*])? *(\w*[[\]|~]*\s*\w*~?)$/);return e&&!n?Ka(e):n?Qa(n):ts(t)},Ka=function(t){let e="",n="";try{let r=t[1]?t[1].trim():"",i=t[2]?t[2].trim():"",a=t[3]?It(t[3].trim()):"",s=t[4]?t[4].trim():"",o=t[5]?t[5].trim():"";n=r+i+a+" "+s,e=ns(o)}catch(r){n=t}return{displayText:n,cssStyle:e}},Qa=function(t){let e="",n="";try{let r=t[1]?t[1].trim():"",i=t[2]?t[2].trim():"",a=t[3]?It(t[3].trim()):"",s=t[4]?t[4].trim():"";n=r+i+"("+a+")"+(t[5]?" : "+It(t[5]).trim():""),e=ns(s)}catch(r){n=t}return{displayText:n,cssStyle:e}},ts=function(t){let e="",n="",r="",i=t.indexOf("("),a=t.indexOf(")");if(i>1&&a>i&&a<=t.length){let s="",o="",l=t.substring(0,1);l.match(/\w/)?o=t.substring(0,i).trim():(l.match(/[#+~-]/)&&(s=l),o=t.substring(1,i).trim());const c=t.substring(i+1,a);t.substring(a+1,1),n=ns(t.substring(a+1,a+2)),e=s+o+"("+It(c.trim())+")",a<t.length&&(r=t.substring(a+2).trim(),""!==r&&(r=" : "+It(r),e+=r))}else e=It(t);return{displayText:e,cssStyle:n}},es=function(t,e,n,r){let i=Xa(e);const a=t.append("tspan").attr("x",r.padding).text(i.displayText);""!==i.cssStyle&&a.attr("style",i.cssStyle),n||a.attr("dy",r.textHeight)},ns=function(t){switch(t){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}},rs=function(t,e,n,r){St.debug("Rendering class ",e,n);const i=e.id,a={id:i,label:e.id,width:0,height:0},s=t.append("g").attr("id",r.db.lookUpDomId(i)).attr("class","classGroup");let o;o=e.link?s.append("svg:a").attr("xlink:href",e.link).attr("target",e.linkTarget).append("text").attr("y",n.textHeight+n.padding).attr("x",0):s.append("text").attr("y",n.textHeight+n.padding).attr("x",0);let l=!0;e.annotations.forEach((function(t){const e=o.append("tspan").text("\xab"+t+"\xbb");l||e.attr("dy",n.textHeight),l=!1}));let c=e.id;void 0!==e.type&&""!==e.type&&(c+="<"+e.type+">");const u=o.append("tspan").text(c).attr("class","title");l||u.attr("dy",n.textHeight);const d=o.node().getBBox().height,h=s.append("line").attr("x1",0).attr("y1",n.padding+d+n.dividerMargin/2).attr("y2",n.padding+d+n.dividerMargin/2),m=s.append("text").attr("x",n.padding).attr("y",d+n.dividerMargin+n.textHeight).attr("fill","white").attr("class","classText");l=!0,e.members.forEach((function(t){es(m,t,l,n),l=!1}));const _=m.node().getBBox(),p=s.append("line").attr("x1",0).attr("y1",n.padding+d+n.dividerMargin+_.height).attr("y2",n.padding+d+n.dividerMargin+_.height),f=s.append("text").attr("x",n.padding).attr("y",d+2*n.dividerMargin+_.height+n.textHeight).attr("fill","white").attr("class","classText");l=!0,e.methods.forEach((function(t){es(f,t,l,n),l=!1}));const y=s.node().getBBox();var g=" ";e.cssClasses.length>0&&(g+=e.cssClasses.join(" "));const b=s.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",y.width+2*n.padding).attr("height",y.height+n.padding+.5*n.dividerMargin).attr("class",g).node().getBBox().width;return o.node().childNodes.forEach((function(t){t.setAttribute("x",(b-t.getBBox().width)/2)})),e.tooltip&&o.insert("title").text(e.tooltip),h.attr("x2",b),p.attr("x2",b),a.width=b,a.height=y.height+n.padding+.5*n.dividerMargin,a},is=function(t,e,n,r,i){const a=function(t){switch(t){case i.db.relationType.AGGREGATION:return"aggregation";case i.db.relationType.EXTENSION:return"extension";case i.db.relationType.COMPOSITION:return"composition";case i.db.relationType.DEPENDENCY:return"dependency";case i.db.relationType.LOLLIPOP:return"lollipop"}};e.points=e.points.filter((t=>!Number.isNaN(t.y)));const s=e.points,l=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(o.$0Z),c=t.append("path").attr("d",l(s)).attr("id","edge"+Ja).attr("class","relation");let u,d,h="";r.arrowMarkerAbsolute&&(h=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,h=h.replace(/\(/g,"\\("),h=h.replace(/\)/g,"\\)")),1==n.relation.lineType&&c.attr("class","relation dashed-line"),10==n.relation.lineType&&c.attr("class","relation dotted-line"),"none"!==n.relation.type1&&c.attr("marker-start","url("+h+"#"+a(n.relation.type1)+"Start)"),"none"!==n.relation.type2&&c.attr("marker-end","url("+h+"#"+a(n.relation.type2)+"End)");const m=e.points.length;let _,p,f,y,g=Gn.calcLabelPosition(e.points);if(u=g.x,d=g.y,m%2!=0&&m>1){let t=Gn.calcCardinalityPosition("none"!==n.relation.type1,e.points,e.points[0]),r=Gn.calcCardinalityPosition("none"!==n.relation.type2,e.points,e.points[m-1]);St.debug("cardinality_1_point "+JSON.stringify(t)),St.debug("cardinality_2_point "+JSON.stringify(r)),_=t.x,p=t.y,f=r.x,y=r.y}if(void 0!==n.title){const e=t.append("g").attr("class","classLabel"),i=e.append("text").attr("class","label").attr("x",u).attr("y",d).attr("fill","red").attr("text-anchor","middle").text(n.title);window.label=i;const a=i.node().getBBox();e.insert("rect",":first-child").attr("class","box").attr("x",a.x-r.padding/2).attr("y",a.y-r.padding/2).attr("width",a.width+r.padding).attr("height",a.height+r.padding)}if(St.info("Rendering relation "+JSON.stringify(n)),void 0!==n.relationTitle1&&"none"!==n.relationTitle1){t.append("g").attr("class","cardinality").append("text").attr("class","type1").attr("x",_).attr("y",p).attr("fill","black").attr("font-size","6").text(n.relationTitle1)}if(void 0!==n.relationTitle2&&"none"!==n.relationTitle2){t.append("g").attr("class","cardinality").append("text").attr("class","type2").attr("x",f).attr("y",y).attr("fill","black").attr("font-size","6").text(n.relationTitle2)}Ja++},as=function(t,e,n,r){St.debug("Rendering note ",e,n);const i=e.id,a={id:i,text:e.text,width:0,height:0},s=t.append("g").attr("id",i).attr("class","classGroup");let o=s.append("text").attr("y",n.textHeight+n.padding).attr("x",0);const l=JSON.parse(`"${e.text}"`).split("\n");l.forEach((function(t){St.debug(`Adding line: ${t}`),o.append("tspan").text(t).attr("class","title").attr("dy",n.textHeight)}));const c=s.node().getBBox(),u=s.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",c.width+2*n.padding).attr("height",c.height+l.length*n.textHeight+n.padding+.5*n.dividerMargin).node().getBBox().width;return o.node().childNodes.forEach((function(t){t.setAttribute("x",(u-t.getBBox().width)/2)})),a.width=u,a.height=c.height+l.length*n.textHeight+n.padding+.5*n.dividerMargin,a};let ss={};const os=function(t){const e=Object.entries(ss).find((e=>e[1].label===t));if(e)return e[0]},ls={draw:function(t,e,n,r){const i=ar().class;ss={},St.info("Rendering diagram "+t);const a=ar().securityLevel;let s;"sandbox"===a&&(s=(0,o.Ys)("#i"+e));const l="sandbox"===a?(0,o.Ys)(s.nodes()[0].contentDocument.body):(0,o.Ys)("body"),c=l.select(`[id='${e}']`);var u;(u=c).append("defs").append("marker").attr("id","extensionStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),u.append("defs").append("marker").attr("id","extensionEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),u.append("defs").append("marker").attr("id","compositionStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),u.append("defs").append("marker").attr("id","compositionEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),u.append("defs").append("marker").attr("id","aggregationStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),u.append("defs").append("marker").attr("id","aggregationEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),u.append("defs").append("marker").attr("id","dependencyStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),u.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z");const d=new ut.k({multigraph:!0});d.setGraph({isMultiGraph:!0}),d.setDefaultEdgeLabel((function(){return{}}));const h=r.db.getClasses(),m=Object.keys(h);for(const o of m){const t=h[o],e=rs(c,t,i,r);ss[e.id]=e,d.setNode(e.id,e),St.info("Org height: "+e.height)}r.db.getRelations().forEach((function(t){St.info("tjoho"+os(t.id1)+os(t.id2)+JSON.stringify(t)),d.setEdge(os(t.id1),os(t.id2),{relation:t},t.title||"DEFAULT")}));r.db.getNotes().forEach((function(t){St.debug(`Adding note: ${JSON.stringify(t)}`);const e=as(c,t,i,r);ss[e.id]=e,d.setNode(e.id,e),t.class&&t.class in h&&d.setEdge(t.id,os(t.class),{relation:{id1:t.id,id2:t.class,relation:{type1:"none",type2:"none",lineType:10}}},"DEFAULT")})),(0,ct.bK)(d),d.nodes().forEach((function(t){void 0!==t&&void 0!==d.node(t)&&(St.debug("Node "+t+": "+JSON.stringify(d.node(t))),l.select("#"+(r.db.lookUpDomId(t)||t)).attr("transform","translate("+(d.node(t).x-d.node(t).width/2)+","+(d.node(t).y-d.node(t).height/2)+" )"))})),d.edges().forEach((function(t){void 0!==t&&void 0!==d.edge(t)&&(St.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(d.edge(t))),is(c,d.edge(t),d.edge(t).relation,i,r))}));const _=c.node().getBBox(),p=_.width+40,f=_.height+40;hr(c,f,p,i.useMaxWidth);const y=`${_.x-20} ${_.y-20} ${p} ${f}`;St.debug(`viewBox ${y}`),c.attr("viewBox",y)}},cs={extension:(t,e,n)=>{St.trace("Making markers for ",n),t.append("defs").append("marker").attr("id",e+"-extensionStart").attr("class","marker extension "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},composition:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-compositionStart").attr("class","marker composition "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},aggregation:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},dependency:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},lollipop:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","white").attr("cx",6).attr("cy",7).attr("r",6)},point:(t,e)=>{t.append("marker").attr("id",e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 12 20").attr("refX",10).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},circle:(t,e)=>{t.append("marker").attr("id",e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},cross:(t,e)=>{t.append("marker").attr("id",e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},barb:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")}},us=(t,e,n,r)=>{e.forEach((e=>{cs[e](t,n,r)}))};const ds=(t,e,n,r)=>{let i=t||"";if("object"==typeof i&&(i=i[0]),Ft(ar().flowchart.htmlLabels)){i=i.replace(/\\n|\n/g,"<br />"),St.info("vertexText"+i);let t=function(t){const e=(0,o.Ys)(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),n=e.append("xhtml:div"),r=t.label,i=t.isNode?"nodeLabel":"edgeLabel";var a,s;return n.html('<span class="'+i+'" '+(t.labelStyle?'style="'+t.labelStyle+'"':"")+">"+r+"</span>"),a=n,(s=t.labelStyle)&&a.attr("style",s),n.style("display","inline-block"),n.style("white-space","nowrap"),n.attr("xmlns","http://www.w3.org/1999/xhtml"),e.node()}({isNode:r,label:Jh(i).replace(/fa[blrs]?:fa-[\w-]+/g,(t=>`<i class='${t.replace(":"," ")}'></i>`)),labelStyle:e.replace("fill:","color:")});return t}{const t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",e.replace("color:","fill:"));let r=[];r="string"==typeof i?i.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(i)?i:[];for(const e of r){const r=document.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),r.setAttribute("dy","1em"),r.setAttribute("x","0"),n?r.setAttribute("class","title-row"):r.setAttribute("class","row"),r.textContent=e.trim(),t.appendChild(r)}return t}},hs=(t,e,n,r)=>{let i;i=n||"node default";const a=t.insert("g").attr("class",i).attr("id",e.domId||e.id),s=a.insert("g").attr("class","label").attr("style",e.labelStyle);let l;l=void 0===e.labelText?"":"string"==typeof e.labelText?e.labelText:e.labelText[0];const c=s.node().appendChild(ds(At(Jh(l),ar()),e.labelStyle,!1,r));let u=c.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=c.children[0],e=(0,o.Ys)(c);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}const d=e.padding/2;return s.attr("transform","translate("+-u.width/2+", "+-u.height/2+")"),{shapeSvg:a,bbox:u,halfPadding:d,label:s}},ms=(t,e)=>{const n=e.node().getBBox();t.width=n.width,t.height=n.height};function _s(t,e,n,r){return t.insert("polygon",":first-child").attr("points",r.map((function(t){return t.x+","+t.y})).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+n/2+")")}let ps={},fs={},ys={};const gs=(t,e)=>(St.trace("In isDecendant",e," ",t," = ",fs[e].includes(t)),!!fs[e].includes(t)),bs=(t,e,n,r)=>{St.warn("Copying children of ",t,"root",r,"data",e.node(t),r);const i=e.children(t)||[];t!==r&&i.push(t),St.warn("Copying (nodes) clusterId",t,"nodes",i),i.forEach((i=>{if(e.children(i).length>0)bs(i,e,n,r);else{const a=e.node(i);St.info("cp ",i," to ",r," with parent ",t),n.setNode(i,a),r!==e.parent(i)&&(St.warn("Setting parent",i,e.parent(i)),n.setParent(i,e.parent(i))),t!==r&&i!==t?(St.debug("Setting parent",i,t),n.setParent(i,t)):(St.info("In copy ",t,"root",r,"data",e.node(t),r),St.debug("Not Setting parent for node=",i,"cluster!==rootId",t!==r,"node!==clusterId",i!==t));const s=e.edges(i);St.debug("Copying Edges",s),s.forEach((i=>{St.info("Edge",i);const a=e.edge(i.v,i.w,i.name);St.info("Edge data",a,r);try{((t,e)=>(St.info("Decendants of ",e," is ",fs[e]),St.info("Edge is ",t),t.v!==e&&t.w!==e&&(fs[e]?fs[e].includes(t.v)||gs(t.v,e)||gs(t.w,e)||fs[e].includes(t.w):(St.debug("Tilt, ",e,",not in decendants"),!1))))(i,r)?(St.info("Copying as ",i.v,i.w,a,i.name),n.setEdge(i.v,i.w,a,i.name),St.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):St.info("Skipping copy of edge ",i.v,"--\x3e",i.w," rootId: ",r," clusterId:",t)}catch(s){St.error(s)}}))}St.debug("Removing node",i),e.removeNode(i)}))},ks=(t,e)=>{const n=e.children(t);let r=[...n];for(const i of n)ys[i]=t,r=[...r,...ks(i,e)];return r},vs=(t,e)=>{St.trace("Searching",t);const n=e.children(t);if(St.trace("Searching children of id ",t,n),n.length<1)return St.trace("This is a valid node",t),t;for(const r of n){const n=vs(r,e);if(n)return St.trace("Found replacement for",t," => ",n),n}},xs=t=>ps[t]&&ps[t].externalConnections&&ps[t]?ps[t].id:t,Ms=(t,e)=>{if(St.warn("extractor - ",e,dt.c(t),t.children("D")),e>10)return void St.error("Bailing out");let n=t.nodes(),r=!1;for(const i of n){const e=t.children(i);r=r||e.length>0}if(r){St.debug("Nodes = ",n,e);for(const r of n)if(St.debug("Extracting node",r,ps,ps[r]&&!ps[r].externalConnections,!t.parent(r),t.node(r),t.children("D")," Depth ",e),ps[r])if(!ps[r].externalConnections&&t.children(r)&&t.children(r).length>0){St.warn("Cluster without external connections, without a parent and with children",r,e);let n="TB"===t.graph().rankdir?"LR":"TB";ps[r]&&ps[r].clusterData&&ps[r].clusterData.dir&&(n=ps[r].clusterData.dir,St.warn("Fixing dir",ps[r].clusterData.dir,n));const i=new ut.k({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}}));St.warn("Old graph before copy",dt.c(t)),bs(r,t,i,r),t.setNode(r,{clusterNode:!0,id:r,clusterData:ps[r].clusterData,labelText:ps[r].labelText,graph:i}),St.warn("New graph after copy node: (",r,")",dt.c(i)),St.debug("Old graph after copy",dt.c(t))}else St.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!ps[r].externalConnections," no parent: ",!t.parent(r)," children ",t.children(r)&&t.children(r).length>0,t.children("D"),e),St.debug(ps);else St.debug("Not a cluster",r,e);n=t.nodes(),St.warn("New list of nodes",n);for(const r of n){const n=t.node(r);St.warn(" Now next level",r,n),n.clusterNode&&Ms(n.graph,e+1)}}else St.debug("Done, no node has children",t.nodes())},Ls=(t,e)=>{if(0===e.length)return[];let n=Object.assign(e);return e.forEach((e=>{const r=t.children(e),i=Ls(t,r);n=[...n,...i]})),n};function ws(t,e,n,r){var i=t.x,a=t.y,s=i-r.x,o=a-r.y,l=Math.sqrt(e*e*o*o+n*n*s*s),c=Math.abs(e*n*s/l);r.x<i&&(c=-c);var u=Math.abs(e*n*o/l);return r.y<a&&(u=-u),{x:i+c,y:a+u}}function Ts(t,e,n,r){var i,a,s,o,l,c,u,d,h,m,_,p,f;if(i=e.y-t.y,s=t.x-e.x,l=e.x*t.y-t.x*e.y,h=i*n.x+s*n.y+l,m=i*r.x+s*r.y+l,!(0!==h&&0!==m&&Ss(h,m)||(a=r.y-n.y,o=n.x-r.x,c=r.x*n.y-n.x*r.y,u=a*t.x+o*t.y+c,d=a*e.x+o*e.y+c,0!==u&&0!==d&&Ss(u,d)||0==(_=i*o-a*s))))return p=Math.abs(_/2),{x:(f=s*c-o*l)<0?(f-p)/_:(f+p)/_,y:(f=a*l-i*c)<0?(f-p)/_:(f+p)/_}}function Ss(t,e){return t*e>0}const Ds=(t,e)=>{var n,r,i=t.x,a=t.y,s=e.x-i,o=e.y-a,l=t.width/2,c=t.height/2;return Math.abs(o)*l>Math.abs(s)*c?(o<0&&(c=-c),n=0===o?0:c*s/o,r=c):(s<0&&(l=-l),n=l,r=0===s?0:l*o/s),{x:i+n,y:a+r}},Ys={node:function(t,e){return t.intersect(e)},circle:function(t,e,n){return ws(t,e,e,n)},ellipse:ws,polygon:function(t,e,n){var r=t.x,i=t.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;"function"==typeof e.forEach?e.forEach((function(t){s=Math.min(s,t.x),o=Math.min(o,t.y)})):(s=Math.min(s,e.x),o=Math.min(o,e.y));for(var l=r-t.width/2-s,c=i-t.height/2-o,u=0;u<e.length;u++){var d=e[u],h=e[u<e.length-1?u+1:0],m=Ts(t,n,{x:l+d.x,y:c+d.y},{x:l+h.x,y:c+h.y});m&&a.push(m)}return a.length?(a.length>1&&a.sort((function(t,e){var r=t.x-n.x,i=t.y-n.y,a=Math.sqrt(r*r+i*i),s=e.x-n.x,o=e.y-n.y,l=Math.sqrt(s*s+o*o);return a<l?-1:a===l?0:1})),a[0]):t},rect:Ds},Es=(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=hs(t,e,"node "+e.classes,!0);St.info("Classes = ",e.classes);const a=n.insert("rect",":first-child");return a.attr("rx",e.rx).attr("ry",e.ry).attr("x",-r.width/2-i).attr("y",-r.height/2-i).attr("width",r.width+e.padding).attr("height",r.height+e.padding),ms(e,a),e.intersect=function(t){return Ys.rect(e,t)},n},Cs=(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding+(r.height+e.padding),a=[{x:i/2,y:0},{x:i,y:-i/2},{x:i/2,y:-i},{x:0,y:-i/2}];St.info("Question main (Circle)");const s=_s(n,i,i,a);return s.attr("style",e.style),ms(e,s),e.intersect=function(t){return St.warn("Intersect called"),Ys.polygon(e,a,t)},n};function As(t,e,n,r){const i=[],a=t=>{i.push(t,0)},s=t=>{i.push(0,t)};e.includes("t")?(St.debug("add top border"),a(n)):s(n),e.includes("r")?(St.debug("add right border"),a(r)):s(r),e.includes("b")?(St.debug("add bottom border"),a(n)):s(n),e.includes("l")?(St.debug("add left border"),a(r)):s(r),t.attr("stroke-dasharray",i.join(" "))}const Os=(t,e,n)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let i=70,a=10;"LR"===n&&(i=10,a=70);const s=r.append("rect").attr("x",-1*i/2).attr("y",-1*a/2).attr("width",i).attr("height",a).attr("class","fork-join");return ms(e,s),e.height=e.height+e.padding/2,e.width=e.width+e.padding/2,e.intersect=function(t){return Ys.rect(e,t)},r},Ns={rhombus:Cs,question:Cs,rect:(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=hs(t,e,"node "+e.classes,!0);St.trace("Classes = ",e.classes);const a=n.insert("rect",":first-child"),s=r.width+e.padding,o=r.height+e.padding;if(a.attr("class","basic label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",-r.width/2-i).attr("y",-r.height/2-i).attr("width",s).attr("height",o),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(As(a,e.props.borders,s,o),t.delete("borders")),t.forEach((t=>{St.warn(`Unknown node property ${t}`)}))}return ms(e,a),e.intersect=function(t){return Ys.rect(e,t)},n},labelRect:(t,e)=>{const{shapeSvg:n}=hs(t,e,"label",!0);St.trace("Classes = ",e.classes);const r=n.insert("rect",":first-child");if(r.attr("width",0).attr("height",0),n.attr("class","label edgeLabel"),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(As(r,e.props.borders,0,0),t.delete("borders")),t.forEach((t=>{St.warn(`Unknown node property ${t}`)}))}return ms(e,r),e.intersect=function(t){return Ys.rect(e,t)},n},rectWithTitle:(t,e)=>{let n;n=e.classes?"node "+e.classes:"node default";const r=t.insert("g").attr("class",n).attr("id",e.domId||e.id),i=r.insert("rect",":first-child"),a=r.insert("line"),s=r.insert("g").attr("class","label"),l=e.labelText.flat?e.labelText.flat():e.labelText;let c="";c="object"==typeof l?l[0]:l,St.info("Label text abc79",c,l,"object"==typeof l);const u=s.node().appendChild(ds(c,e.labelStyle,!0,!0));let d={width:0,height:0};if(Ft(ar().flowchart.htmlLabels)){const t=u.children[0],e=(0,o.Ys)(u);d=t.getBoundingClientRect(),e.attr("width",d.width),e.attr("height",d.height)}St.info("Text 2",l);const h=l.slice(1,l.length);let m=u.getBBox();const _=s.node().appendChild(ds(h.join?h.join("<br/>"):h,e.labelStyle,!0,!0));if(Ft(ar().flowchart.htmlLabels)){const t=_.children[0],e=(0,o.Ys)(_);d=t.getBoundingClientRect(),e.attr("width",d.width),e.attr("height",d.height)}const p=e.padding/2;return(0,o.Ys)(_).attr("transform","translate( "+(d.width>m.width?0:(m.width-d.width)/2)+", "+(m.height+p+5)+")"),(0,o.Ys)(u).attr("transform","translate( "+(d.width<m.width?0:-(m.width-d.width)/2)+", 0)"),d=s.node().getBBox(),s.attr("transform","translate("+-d.width/2+", "+(-d.height/2-p+3)+")"),i.attr("class","outer title-state").attr("x",-d.width/2-p).attr("y",-d.height/2-p).attr("width",d.width+e.padding).attr("height",d.height+e.padding),a.attr("class","divider").attr("x1",-d.width/2-p).attr("x2",d.width/2+p).attr("y1",-d.height/2-p+m.height+p).attr("y2",-d.height/2-p+m.height+p),ms(e,i),e.intersect=function(t){return Ys.rect(e,t)},r},choice:(t,e)=>{const n=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),r=[{x:0,y:14},{x:14,y:0},{x:0,y:-14},{x:-14,y:0}];return n.insert("polygon",":first-child").attr("points",r.map((function(t){return t.x+","+t.y})).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),e.width=28,e.height=28,e.intersect=function(t){return Ys.circle(e,14,t)},n},circle:(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=hs(t,e,void 0,!0),a=n.insert("circle",":first-child");return a.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",r.width/2+i).attr("width",r.width+e.padding).attr("height",r.height+e.padding),St.info("Circle main"),ms(e,a),e.intersect=function(t){return St.info("Circle intersect",e,r.width/2+i,t),Ys.circle(e,r.width/2+i,t)},n},doublecircle:(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=hs(t,e,void 0,!0),a=n.insert("g",":first-child"),s=a.insert("circle"),o=a.insert("circle");return s.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",r.width/2+i+5).attr("width",r.width+e.padding+10).attr("height",r.height+e.padding+10),o.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",r.width/2+i).attr("width",r.width+e.padding).attr("height",r.height+e.padding),St.info("DoubleCircle main"),ms(e,s),e.intersect=function(t){return St.info("DoubleCircle intersect",e,r.width/2+i+5,t),Ys.circle(e,r.width/2+i+5,t)},n},stadium:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.height+e.padding,a=r.width+i/4+e.padding,s=n.insert("rect",":first-child").attr("style",e.style).attr("rx",i/2).attr("ry",i/2).attr("x",-a/2).attr("y",-i/2).attr("width",a).attr("height",i);return ms(e,s),e.intersect=function(t){return Ys.rect(e,t)},n},hexagon:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.height+e.padding,a=i/4,s=r.width+2*a+e.padding,o=[{x:a,y:0},{x:s-a,y:0},{x:s,y:-i/2},{x:s-a,y:-i},{x:a,y:-i},{x:0,y:-i/2}],l=_s(n,s,i,o);return l.attr("style",e.style),ms(e,l),e.intersect=function(t){return Ys.polygon(e,o,t)},n},rect_left_inv_arrow:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:-a/2,y:0},{x:i,y:0},{x:i,y:-a},{x:-a/2,y:-a},{x:0,y:-a/2}];return _s(n,i,a,s).attr("style",e.style),e.width=i+a,e.height=a,e.intersect=function(t){return Ys.polygon(e,s,t)},n},lean_right:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:-2*a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:a/6,y:-a}],o=_s(n,i,a,s);return o.attr("style",e.style),ms(e,o),e.intersect=function(t){return Ys.polygon(e,s,t)},n},lean_left:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:2*a/6,y:0},{x:i+a/6,y:0},{x:i-2*a/6,y:-a},{x:-a/6,y:-a}],o=_s(n,i,a,s);return o.attr("style",e.style),ms(e,o),e.intersect=function(t){return Ys.polygon(e,s,t)},n},trapezoid:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:-2*a/6,y:0},{x:i+2*a/6,y:0},{x:i-a/6,y:-a},{x:a/6,y:-a}],o=_s(n,i,a,s);return o.attr("style",e.style),ms(e,o),e.intersect=function(t){return Ys.polygon(e,s,t)},n},inv_trapezoid:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:-2*a/6,y:-a}],o=_s(n,i,a,s);return o.attr("style",e.style),ms(e,o),e.intersect=function(t){return Ys.polygon(e,s,t)},n},rect_right_inv_arrow:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:0,y:0},{x:i+a/2,y:0},{x:i,y:-a/2},{x:i+a/2,y:-a},{x:0,y:-a}],o=_s(n,i,a,s);return o.attr("style",e.style),ms(e,o),e.intersect=function(t){return Ys.polygon(e,s,t)},n},cylinder:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=i/2,s=a/(2.5+i/50),o=r.height+s+e.padding,l="M 0,"+s+" a "+a+","+s+" 0,0,0 "+i+" 0 a "+a+","+s+" 0,0,0 "+-i+" 0 l 0,"+o+" a "+a+","+s+" 0,0,0 "+i+" 0 l 0,"+-o,c=n.attr("label-offset-y",s).insert("path",":first-child").attr("style",e.style).attr("d",l).attr("transform","translate("+-i/2+","+-(o/2+s)+")");return ms(e,c),e.intersect=function(t){const n=Ys.rect(e,t),r=n.x-e.x;if(0!=a&&(Math.abs(r)<e.width/2||Math.abs(r)==e.width/2&&Math.abs(n.y-e.y)>e.height/2-s)){let i=s*s*(1-r*r/(a*a));0!=i&&(i=Math.sqrt(i)),i=s-i,t.y-e.y>0&&(i=-i),n.y+=i}return n},n},start:(t,e)=>{const n=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),r=n.insert("circle",":first-child");return r.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),ms(e,r),e.intersect=function(t){return Ys.circle(e,7,t)},n},end:(t,e)=>{const n=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),r=n.insert("circle",":first-child"),i=n.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),r.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),ms(e,i),e.intersect=function(t){return Ys.circle(e,7,t)},n},note:Es,subroutine:(t,e)=>{const{shapeSvg:n,bbox:r}=hs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:0,y:0},{x:i,y:0},{x:i,y:-a},{x:0,y:-a},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-a},{x:-8,y:-a},{x:-8,y:0}],o=_s(n,i,a,s);return o.attr("style",e.style),ms(e,o),e.intersect=function(t){return Ys.polygon(e,s,t)},n},fork:Os,join:Os,class_box:(t,e)=>{const n=e.padding/2;let r;r=e.classes?"node "+e.classes:"node default";const i=t.insert("g").attr("class",r).attr("id",e.domId||e.id),a=i.insert("rect",":first-child"),s=i.insert("line"),l=i.insert("line");let c=0,u=4;const d=i.insert("g").attr("class","label");let h=0;const m=e.classData.annotations&&e.classData.annotations[0],_=e.classData.annotations[0]?"\xab"+e.classData.annotations[0]+"\xbb":"",p=d.node().appendChild(ds(_,e.labelStyle,!0,!0));let f=p.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=p.children[0],e=(0,o.Ys)(p);f=t.getBoundingClientRect(),e.attr("width",f.width),e.attr("height",f.height)}e.classData.annotations[0]&&(u+=f.height+4,c+=f.width);let y=e.classData.id;void 0!==e.classData.type&&""!==e.classData.type&&(ar().flowchart.htmlLabels?y+="<"+e.classData.type+">":y+="<"+e.classData.type+">");const g=d.node().appendChild(ds(y,e.labelStyle,!0,!0));(0,o.Ys)(g).attr("class","classTitle");let b=g.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=g.children[0],e=(0,o.Ys)(g);b=t.getBoundingClientRect(),e.attr("width",b.width),e.attr("height",b.height)}u+=b.height+4,b.width>c&&(c=b.width);const k=[];e.classData.members.forEach((t=>{const n=Xa(t);let r=n.displayText;ar().flowchart.htmlLabels&&(r=r.replace(/</g,"<").replace(/>/g,">"));const i=d.node().appendChild(ds(r,n.cssStyle?n.cssStyle:e.labelStyle,!0,!0));let a=i.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=i.children[0],e=(0,o.Ys)(i);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>c&&(c=a.width),u+=a.height+4,k.push(i)})),u+=8;const v=[];if(e.classData.methods.forEach((t=>{const n=Xa(t);let r=n.displayText;ar().flowchart.htmlLabels&&(r=r.replace(/</g,"<").replace(/>/g,">"));const i=d.node().appendChild(ds(r,n.cssStyle?n.cssStyle:e.labelStyle,!0,!0));let a=i.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=i.children[0],e=(0,o.Ys)(i);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>c&&(c=a.width),u+=a.height+4,v.push(i)})),u+=8,m){let t=(c-f.width)/2;(0,o.Ys)(p).attr("transform","translate( "+(-1*c/2+t)+", "+-1*u/2+")"),h=f.height+4}let x=(c-b.width)/2;return(0,o.Ys)(g).attr("transform","translate( "+(-1*c/2+x)+", "+(-1*u/2+h)+")"),h+=b.height+4,s.attr("class","divider").attr("x1",-c/2-n).attr("x2",c/2+n).attr("y1",-u/2-n+8+h).attr("y2",-u/2-n+8+h),h+=8,k.forEach((t=>{(0,o.Ys)(t).attr("transform","translate( "+-c/2+", "+(-1*u/2+h+4)+")"),h+=b.height+4})),h+=8,l.attr("class","divider").attr("x1",-c/2-n).attr("x2",c/2+n).attr("y1",-u/2-n+8+h).attr("y2",-u/2-n+8+h),h+=8,v.forEach((t=>{(0,o.Ys)(t).attr("transform","translate( "+-c/2+", "+(-1*u/2+h)+")"),h+=b.height+4})),a.attr("class","outer title-state").attr("x",-c/2-n).attr("y",-u/2-n).attr("width",c+e.padding).attr("height",u+e.padding),ms(e,a),e.intersect=function(t){return Ys.rect(e,t)},i}};let Bs={};const Fs=(t,e,n)=>{let r,i;if(e.link){let a;"sandbox"===ar().securityLevel?a="_top":e.linkTarget&&(a=e.linkTarget||"_blank"),r=t.insert("svg:a").attr("xlink:href",e.link).attr("target",a),i=Ns[e.shape](r,e,n)}else i=Ns[e.shape](t,e,n),r=i;return e.tooltip&&i.attr("title",e.tooltip),e.class&&i.attr("class","node default "+e.class),Bs[e.id]=r,e.haveCallback&&Bs[e.id].attr("class",Bs[e.id].attr("class")+" clickable"),r},Is=t=>{const e=Bs[t.id];St.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-8)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},Ps={rect:(t,e)=>{St.trace("Creating subgraph rect for ",e.id,e);const n=t.insert("g").attr("class","cluster"+(e.class?" "+e.class:"")).attr("id",e.id),r=n.insert("rect",":first-child"),i=n.insert("g").attr("class","cluster-label"),a=i.node().appendChild(ds(e.labelText,e.labelStyle,void 0,!0));let s=a.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=a.children[0],e=(0,o.Ys)(a);s=t.getBoundingClientRect(),e.attr("width",s.width),e.attr("height",s.height)}const l=0*e.padding,c=l/2,u=e.width<=s.width+l?s.width+l:e.width;e.width<=s.width+l?e.diff=(s.width-e.width)/2-e.padding/2:e.diff=-e.padding/2,St.trace("Data ",e,JSON.stringify(e)),r.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-u/2).attr("y",e.y-e.height/2-c).attr("width",u).attr("height",e.height+l),i.attr("transform","translate("+(e.x-s.width/2)+", "+(e.y-e.height/2)+")");const d=r.node().getBBox();return e.width=d.width,e.height=d.height,e.intersect=function(t){return Ds(e,t)},n},roundedWithTitle:(t,e)=>{const n=t.insert("g").attr("class",e.classes).attr("id",e.id),r=n.insert("rect",":first-child"),i=n.insert("g").attr("class","cluster-label"),a=n.append("rect"),s=i.node().appendChild(ds(e.labelText,e.labelStyle,void 0,!0));let l=s.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=s.children[0],e=(0,o.Ys)(s);l=t.getBoundingClientRect(),e.attr("width",l.width),e.attr("height",l.height)}l=s.getBBox();const c=0*e.padding,u=c/2,d=e.width<=l.width+e.padding?l.width+e.padding:e.width;e.width<=l.width+e.padding?e.diff=(l.width+0*e.padding-e.width)/2:e.diff=-e.padding/2,r.attr("class","outer").attr("x",e.x-d/2-u).attr("y",e.y-e.height/2-u).attr("width",d+c).attr("height",e.height+c),a.attr("class","inner").attr("x",e.x-d/2-u).attr("y",e.y-e.height/2-u+l.height-1).attr("width",d+c).attr("height",e.height+c-l.height-3),i.attr("transform","translate("+(e.x-l.width/2)+", "+(e.y-e.height/2-e.padding/3+(Ft(ar().flowchart.htmlLabels)?5:3))+")");const h=r.node().getBBox();return e.height=h.height,e.intersect=function(t){return Ds(e,t)},n},noteGroup:(t,e)=>{const n=t.insert("g").attr("class","note-cluster").attr("id",e.id),r=n.insert("rect",":first-child"),i=0*e.padding,a=i/2;r.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-a).attr("y",e.y-e.height/2-a).attr("width",e.width+i).attr("height",e.height+i).attr("fill","none");const s=r.node().getBBox();return e.width=s.width,e.height=s.height,e.intersect=function(t){return Ds(e,t)},n},divider:(t,e)=>{const n=t.insert("g").attr("class",e.classes).attr("id",e.id),r=n.insert("rect",":first-child"),i=0*e.padding,a=i/2;r.attr("class","divider").attr("x",e.x-e.width/2-a).attr("y",e.y-e.height/2).attr("width",e.width+i).attr("height",e.height+i);const s=r.node().getBBox();return e.width=s.width,e.height=s.height,e.diff=-e.padding/2,e.intersect=function(t){return Ds(e,t)},n}};let js={};let Rs={},Hs={};const $s=(t,e)=>{const n=ds(e.label,e.labelStyle),r=t.insert("g").attr("class","edgeLabel"),i=r.insert("g").attr("class","label");i.node().appendChild(n);let a,s=n.getBBox();if(Ft(ar().flowchart.htmlLabels)){const t=n.children[0],e=(0,o.Ys)(n);s=t.getBoundingClientRect(),e.attr("width",s.width),e.attr("height",s.height)}if(i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),Rs[e.id]=r,e.width=s.width,e.height=s.height,e.startLabelLeft){const n=ds(e.startLabelLeft,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),Hs[e.id]||(Hs[e.id]={}),Hs[e.id].startLeft=r,Zs(a,e.startLabelLeft)}if(e.startLabelRight){const n=ds(e.startLabelRight,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=r.node().appendChild(n),i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),Hs[e.id]||(Hs[e.id]={}),Hs[e.id].startRight=r,Zs(a,e.startLabelRight)}if(e.endLabelLeft){const n=ds(e.endLabelLeft,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),r.node().appendChild(n),Hs[e.id]||(Hs[e.id]={}),Hs[e.id].endLeft=r,Zs(a,e.endLabelLeft)}if(e.endLabelRight){const n=ds(e.endLabelRight,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),r.node().appendChild(n),Hs[e.id]||(Hs[e.id]={}),Hs[e.id].endRight=r,Zs(a,e.endLabelRight)}return n};function Zs(t,e){ar().flowchart.htmlLabels&&t&&(t.style.width=9*e.length+"px",t.style.height="12px")}const Ws=(t,e)=>{St.warn("abc88 cutPathAtIntersect",t,e);let n=[],r=t[0],i=!1;return t.forEach((t=>{if(St.info("abc88 checking point",t,e),((t,e)=>{const n=t.x,r=t.y,i=Math.abs(e.x-n),a=Math.abs(e.y-r),s=t.width/2,o=t.height/2;return i>=s||a>=o})(e,t)||i)St.warn("abc88 outside",t,r),r=t,i||n.push(t);else{const a=((t,e,n)=>{St.warn(`intersection calc abc89:\n outsidePoint: ${JSON.stringify(e)}\n insidePoint : ${JSON.stringify(n)}\n node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const r=t.x,i=t.y,a=Math.abs(r-n.x),s=t.width/2;let o=n.x<e.x?s-a:s+a;const l=t.height/2,c=Math.abs(e.y-n.y),u=Math.abs(e.x-n.x);if(Math.abs(i-e.y)*s>Math.abs(r-e.x)*l){let t=n.y<e.y?e.y-l-i:i-l-e.y;o=u*t/c;const r={x:n.x<e.x?n.x+o:n.x-u+o,y:n.y<e.y?n.y+c-t:n.y-c+t};return 0===o&&(r.x=e.x,r.y=e.y),0===u&&(r.x=e.x),0===c&&(r.y=e.y),St.warn(`abc89 topp/bott calc, Q ${c}, q ${t}, R ${u}, r ${o}`,r),r}{o=n.x<e.x?e.x-s-r:r-s-e.x;let t=c*o/u,i=n.x<e.x?n.x+u-o:n.x-u+o,a=n.y<e.y?n.y+t:n.y-t;return St.warn(`sides calc abc89, Q ${c}, q ${t}, R ${u}, r ${o}`,{_x:i,_y:a}),0===o&&(i=e.x,a=e.y),0===u&&(i=e.x),0===c&&(a=e.y),{x:i,y:a}}})(e,r,t);St.warn("abc88 inside",t,r,a),St.warn("abc88 intersection",a);let s=!1;n.forEach((t=>{s=s||t.x===a.x&&t.y===a.y})),n.some((t=>t.x===a.x&&t.y===a.y))?St.warn("abc88 no intersect",a,n):n.push(a),i=!0}})),St.warn("abc88 returning points",n),n},zs=(t,e,n,r)=>{St.info("Graph in recursive render: XXX",dt.c(e),r);const i=e.graph().rankdir;St.trace("Dir in recursive render - dir:",i);const a=t.insert("g").attr("class","root");e.nodes()?St.info("Recursive render XXX",e.nodes()):St.info("No nodes found for",e),e.edges().length>0&&St.trace("Recursive edges",e.edge(e.edges()[0]));const s=a.insert("g").attr("class","clusters"),l=a.insert("g").attr("class","edgePaths"),c=a.insert("g").attr("class","edgeLabels"),u=a.insert("g").attr("class","nodes");e.nodes().forEach((function(t){const a=e.node(t);if(void 0!==r){const n=JSON.parse(JSON.stringify(r.clusterData));St.info("Setting data for cluster XXX (",t,") ",n,r),e.setNode(r.id,n),e.parent(t)||(St.trace("Setting parent",t,r.id),e.setParent(t,r.id,n))}if(St.info("(Insert) Node XXX"+t+": "+JSON.stringify(e.node(t))),a&&a.clusterNode){St.info("Cluster identified",t,a.width,e.node(t));const r=zs(u,a.graph,n,e.node(t)),i=r.elem;ms(a,i),a.diff=r.diff||0,St.info("Node bounds (abc123)",t,a,a.width,a.x,a.y),((t,e)=>{Bs[e.id]=t})(i,a),St.warn("Recursive render complete ",i,a)}else e.children(t).length>0?(St.info("Cluster - the non recursive path XXX",t,a.id,a,e),St.info(vs(a.id,e)),ps[a.id]={id:vs(a.id,e),node:a}):(St.info("Node - the non recursive path",t,a.id,a),Fs(u,e.node(t),i))})),e.edges().forEach((function(t){const n=e.edge(t.v,t.w,t.name);St.info("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),St.info("Edge "+t.v+" -> "+t.w+": ",t," ",JSON.stringify(e.edge(t))),St.info("Fix",ps,"ids:",t.v,t.w,"Translateing: ",ps[t.v],ps[t.w]),$s(c,n)})),e.edges().forEach((function(t){St.info("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t))})),St.info("#############################################"),St.info("### Layout ###"),St.info("#############################################"),St.info(e),(0,ct.bK)(e),St.info("Graph after layout:",dt.c(e));let d=0;return(t=>Ls(t,t.children()))(e).forEach((function(t){const n=e.node(t);St.info("Position "+t+": "+JSON.stringify(e.node(t))),St.info("Position "+t+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n&&n.clusterNode?Is(n):e.children(t).length>0?(((t,e)=>{St.trace("Inserting cluster");const n=e.shape||"rect";js[e.id]=Ps[n](t,e)})(s,n),ps[n.id].node=n):Is(n)})),e.edges().forEach((function(t){const r=e.edge(t);St.info("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r),r);const i=function(t,e,n,r,i,a){let s=n.points,l=!1;const c=a.node(e.v);var u=a.node(e.w);St.info("abc88 InsertEdge: ",n),u.intersect&&c.intersect&&(s=s.slice(1,n.points.length-1),s.unshift(c.intersect(s[0])),St.info("Last point",s[s.length-1],u,u.intersect(s[s.length-1])),s.push(u.intersect(s[s.length-1]))),n.toCluster&&(St.info("to cluster abc88",r[n.toCluster]),s=Ws(n.points,r[n.toCluster].node),l=!0),n.fromCluster&&(St.info("from cluster abc88",r[n.fromCluster]),s=Ws(s.reverse(),r[n.fromCluster].node).reverse(),l=!0);const d=s.filter((t=>!Number.isNaN(t.y)));let h;h=("graph"===i||"flowchart"===i)&&n.curve||o.$0Z;const m=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(h);let _;switch(n.thickness){case"normal":_="edge-thickness-normal";break;case"thick":_="edge-thickness-thick";break;default:_=""}switch(n.pattern){case"solid":_+=" edge-pattern-solid";break;case"dotted":_+=" edge-pattern-dotted";break;case"dashed":_+=" edge-pattern-dashed"}const p=t.append("path").attr("d",m(d)).attr("id",n.id).attr("class"," "+_+(n.classes?" "+n.classes:"")).attr("style",n.style);let f="";switch((ar().flowchart.arrowMarkerAbsolute||ar().state.arrowMarkerAbsolute)&&(f=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,f=f.replace(/\(/g,"\\("),f=f.replace(/\)/g,"\\)")),St.info("arrowTypeStart",n.arrowTypeStart),St.info("arrowTypeEnd",n.arrowTypeEnd),n.arrowTypeStart){case"arrow_cross":p.attr("marker-start","url("+f+"#"+i+"-crossStart)");break;case"arrow_point":p.attr("marker-start","url("+f+"#"+i+"-pointStart)");break;case"arrow_barb":p.attr("marker-start","url("+f+"#"+i+"-barbStart)");break;case"arrow_circle":p.attr("marker-start","url("+f+"#"+i+"-circleStart)");break;case"aggregation":p.attr("marker-start","url("+f+"#"+i+"-aggregationStart)");break;case"extension":p.attr("marker-start","url("+f+"#"+i+"-extensionStart)");break;case"composition":p.attr("marker-start","url("+f+"#"+i+"-compositionStart)");break;case"dependency":p.attr("marker-start","url("+f+"#"+i+"-dependencyStart)");break;case"lollipop":p.attr("marker-start","url("+f+"#"+i+"-lollipopStart)")}switch(n.arrowTypeEnd){case"arrow_cross":p.attr("marker-end","url("+f+"#"+i+"-crossEnd)");break;case"arrow_point":p.attr("marker-end","url("+f+"#"+i+"-pointEnd)");break;case"arrow_barb":p.attr("marker-end","url("+f+"#"+i+"-barbEnd)");break;case"arrow_circle":p.attr("marker-end","url("+f+"#"+i+"-circleEnd)");break;case"aggregation":p.attr("marker-end","url("+f+"#"+i+"-aggregationEnd)");break;case"extension":p.attr("marker-end","url("+f+"#"+i+"-extensionEnd)");break;case"composition":p.attr("marker-end","url("+f+"#"+i+"-compositionEnd)");break;case"dependency":p.attr("marker-end","url("+f+"#"+i+"-dependencyEnd)");break;case"lollipop":p.attr("marker-end","url("+f+"#"+i+"-lollipopEnd)")}let y={};return l&&(y.updatedPath=s),y.originalPath=n.points,y}(l,t,r,ps,n,e);((t,e)=>{St.info("Moving label abc78 ",t.id,t.label,Rs[t.id]);let n=e.updatedPath?e.updatedPath:e.originalPath;if(t.label){const r=Rs[t.id];let i=t.x,a=t.y;if(n){const r=Gn.calcLabelPosition(n);St.info("Moving label "+t.label+" from (",i,",",a,") to (",r.x,",",r.y,") abc78"),e.updatedPath&&(i=r.x,a=r.y)}r.attr("transform","translate("+i+", "+a+")")}if(t.startLabelLeft){const e=Hs[t.id].startLeft;let r=t.x,i=t.y;if(n){const e=Gn.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}if(t.startLabelRight){const e=Hs[t.id].startRight;let r=t.x,i=t.y;if(n){const e=Gn.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}if(t.endLabelLeft){const e=Hs[t.id].endLeft;let r=t.x,i=t.y;if(n){const e=Gn.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}if(t.endLabelRight){const e=Hs[t.id].endRight;let r=t.x,i=t.y;if(n){const e=Gn.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}})(r,i)})),e.nodes().forEach((function(t){const n=e.node(t);St.info(t,n.type,n.diff),"group"===n.type&&(d=n.diff)})),{elem:a,diff:d}},Us=(t,e,n,r,i)=>{us(t,n,r,i),Bs={},Rs={},Hs={},js={},fs={},ys={},ps={},St.warn("Graph at first:",dt.c(e)),((t,e)=>{!t||e>10?St.debug("Opting out, no graph "):(St.debug("Opting in, graph "),t.nodes().forEach((function(e){t.children(e).length>0&&(St.warn("Cluster identified",e," Replacement id in edges: ",vs(e,t)),fs[e]=ks(e,t),ps[e]={id:vs(e,t),clusterData:t.node(e)})})),t.nodes().forEach((function(e){const n=t.children(e),r=t.edges();n.length>0?(St.debug("Cluster identified",e,fs),r.forEach((t=>{t.v!==e&&t.w!==e&&gs(t.v,e)^gs(t.w,e)&&(St.warn("Edge: ",t," leaves cluster ",e),St.warn("Decendants of XXX ",e,": ",fs[e]),ps[e].externalConnections=!0)}))):St.debug("Not a cluster ",e,fs)})),t.edges().forEach((function(e){const n=t.edge(e);St.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),St.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(t.edge(e)));let r=e.v,i=e.w;if(St.warn("Fix XXX",ps,"ids:",e.v,e.w,"Translating: ",ps[e.v]," --- ",ps[e.w]),ps[e.v]&&ps[e.w]&&ps[e.v]===ps[e.w]){St.warn("Fixing and trixing link to self - removing XXX",e.v,e.w,e.name),St.warn("Fixing and trixing - removing XXX",e.v,e.w,e.name),r=xs(e.v),i=xs(e.w),t.removeEdge(e.v,e.w,e.name);const a=e.w+"---"+e.v;t.setNode(a,{domId:a,id:a,labelStyle:"",labelText:n.label,padding:0,shape:"labelRect",style:""});const s=JSON.parse(JSON.stringify(n)),o=JSON.parse(JSON.stringify(n));s.label="",s.arrowTypeEnd="none",o.label="",s.fromCluster=e.v,o.toCluster=e.v,t.setEdge(r,a,s,e.name+"-cyclic-special"),t.setEdge(a,i,o,e.name+"-cyclic-special")}else(ps[e.v]||ps[e.w])&&(St.warn("Fixing and trixing - removing XXX",e.v,e.w,e.name),r=xs(e.v),i=xs(e.w),t.removeEdge(e.v,e.w,e.name),r!==e.v&&(n.fromCluster=e.v),i!==e.w&&(n.toCluster=e.w),St.warn("Fix Replacing with XXX",r,i,e.name),t.setEdge(r,i,n,e.name))})),St.warn("Adjusted Graph",dt.c(t)),Ms(t,0),St.trace(ps))})(e),St.warn("Graph after:",dt.c(e)),zs(t,e,r)},qs=t=>Pt.sanitizeText(t,ar());let Vs={dividerMargin:10,padding:5,textHeight:10};function Gs(t){let e;switch(t){case 0:e="aggregation";break;case 1:e="extension";break;case 2:e="composition";break;case 3:e="dependency";break;case 4:e="lollipop";break;default:e="none"}return e}const Js={setConf:function(t){Object.keys(t).forEach((function(e){Vs[e]=t[e]}))},draw:function(t,e,n,r){St.info("Drawing class - ",e);const i=ar().flowchart,a=ar().securityLevel;St.info("config:",i);const s=i.nodeSpacing||50,l=i.rankSpacing||50,c=new ut.k({multigraph:!0,compound:!0}).setGraph({rankdir:r.db.getDirection(),nodesep:s,ranksep:l,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}})),u=r.db.getClasses(),d=r.db.getRelations(),h=r.db.getNotes();let m;St.info(d),function(t,e,n,r){const i=Object.keys(t);St.info("keys:",i),St.info(t),i.forEach((function(n){const i=t[n];let a="";i.cssClasses.length>0&&(a=a+" "+i.cssClasses.join(" "));const s={labelStyle:""};let o=void 0!==i.text?i.text:i.id,l="";i.type,l="class_box",e.setNode(i.id,{labelStyle:s.labelStyle,shape:l,labelText:qs(o),classData:i,rx:0,ry:0,class:a,style:s.style,id:i.id,domId:i.domId,tooltip:r.db.getTooltip(i.id)||"",haveCallback:i.haveCallback,link:i.link,width:"group"===i.type?500:void 0,type:i.type,padding:ar().flowchart.padding}),St.info("setNode",{labelStyle:s.labelStyle,shape:l,labelText:o,rx:0,ry:0,class:a,style:s.style,id:i.id,width:"group"===i.type?500:void 0,type:i.type,padding:ar().flowchart.padding})}))}(u,c,0,r),function(t,e){const n=ar().flowchart;let r=0;t.forEach((function(i){r++;const a={classes:"relation"};a.pattern=1==i.relation.lineType?"dashed":"solid",a.id="id"+r,"arrow_open"===i.type?a.arrowhead="none":a.arrowhead="normal",St.info(a,i),a.startLabelRight="none"===i.relationTitle1?"":i.relationTitle1,a.endLabelLeft="none"===i.relationTitle2?"":i.relationTitle2,a.arrowTypeStart=Gs(i.relation.type1),a.arrowTypeEnd=Gs(i.relation.type2);let s="",l="";if(void 0!==i.style){const t=Nn(i.style);s=t.style,l=t.labelStyle}else s="fill:none";a.style=s,a.labelStyle=l,void 0!==i.interpolate?a.curve=An(i.interpolate,o.c_6):void 0!==t.defaultInterpolate?a.curve=An(t.defaultInterpolate,o.c_6):a.curve=An(n.curve,o.c_6),i.text=i.title,void 0===i.text?void 0!==i.style&&(a.arrowheadStyle="fill: #333"):(a.arrowheadStyle="fill: #333",a.labelpos="c",ar().flowchart.htmlLabels?(a.labelType="html",a.label='<span class="edgeLabel">'+i.text+"</span>"):(a.labelType="text",a.label=i.text.replace(Pt.lineBreakRegex,"\n"),void 0===i.style&&(a.style=a.style||"stroke: #333; stroke-width: 1.5px;fill:none"),a.labelStyle=a.labelStyle.replace("color:","fill:"))),e.setEdge(i.id1,i.id2,a,r)}))}(d,c),function(t,e,n,r){St.info(t),t.forEach((function(t,i){const a=t,s="",l="";let c=a.text,u="note";if(e.setNode(a.id,{labelStyle:s,shape:u,labelText:qs(c),noteData:a,rx:0,ry:0,class:"",style:l,id:a.id,domId:a.id,tooltip:"",type:"note",padding:ar().flowchart.padding}),St.info("setNode",{labelStyle:s,shape:u,labelText:c,rx:0,ry:0,style:l,id:a.id,type:"note",padding:ar().flowchart.padding}),!a.class||!(a.class in r))return;const d=n+i,h={classes:"relation",pattern:"dotted"};h.id=`edgeNote${d}`,h.arrowhead="none",St.info(`Note edge: ${JSON.stringify(h)}, ${JSON.stringify(a)}`),h.startLabelRight="",h.endLabelLeft="",h.arrowTypeStart="none",h.arrowTypeEnd="none",h.style="fill:none",h.labelStyle="",h.curve=An(Vs.curve,o.c_6),e.setEdge(a.id,a.class,h,d)}))}(h,c,d.length+1,u),"sandbox"===a&&(m=(0,o.Ys)("#i"+e));const _="sandbox"===a?(0,o.Ys)(m.nodes()[0].contentDocument.body):(0,o.Ys)("body"),p=_.select(`[id="${e}"]`),f=_.select("#"+e+" g");if(Us(f,c,["aggregation","extension","composition","dependency","lollipop"],"classDiagram",e),Gn.insertTitle(p,"classTitleText",i.titleTopMargin,r.db.getDiagramTitle()),mr(c,p,i.diagramPadding,i.useMaxWidth),!i.htmlLabels){const t="sandbox"===a?m.nodes()[0].contentDocument:document,n=t.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(const e of n){const n=e.getBBox(),r=t.createElementNS("http://www.w3.org/2000/svg","rect");r.setAttribute("rx",0),r.setAttribute("ry",0),r.setAttribute("width",n.width),r.setAttribute("height",n.height),e.insertBefore(r,e.firstChild)}}}};var Xs=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,5],i=[6,9,11,23,25,27,29,30,31,51],a=[1,17],s=[1,18],o=[1,19],l=[1,20],c=[1,21],u=[1,22],d=[1,25],h=[1,30],m=[1,31],_=[1,32],p=[1,33],f=[6,9,11,15,20,23,25,27,29,30,31,44,45,46,47,51],y=[1,45],g=[30,31,48,49],b=[4,6,9,11,23,25,27,29,30,31,51],k=[44,45,46,47],v=[22,37],x=[1,65],M=[1,64],L=[22,37,39,41],w={trace:function(){},yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,entityName:17,relSpec:18,role:19,BLOCK_START:20,attributes:21,BLOCK_STOP:22,title:23,title_value:24,acc_title:25,acc_title_value:26,acc_descr:27,acc_descr_value:28,acc_descr_multiline_value:29,ALPHANUM:30,ENTITY_NAME:31,attribute:32,attributeType:33,attributeName:34,attributeKeyTypeList:35,attributeComment:36,ATTRIBUTE_WORD:37,attributeKeyType:38,COMMA:39,ATTRIBUTE_KEY:40,COMMENT:41,cardinality:42,relType:43,ZERO_OR_ONE:44,ZERO_OR_MORE:45,ONE_OR_MORE:46,ONLY_ONE:47,NON_IDENTIFYING:48,IDENTIFYING:49,WORD:50,open_directive:51,type_directive:52,arg_directive:53,close_directive:54,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"BLOCK_START",22:"BLOCK_STOP",23:"title",24:"title_value",25:"acc_title",26:"acc_title_value",27:"acc_descr",28:"acc_descr_value",29:"acc_descr_multiline_value",30:"ALPHANUM",31:"ENTITY_NAME",37:"ATTRIBUTE_WORD",39:"COMMA",40:"ATTRIBUTE_KEY",41:"COMMENT",44:"ZERO_OR_ONE",45:"ZERO_OR_MORE",46:"ONE_OR_MORE",47:"ONLY_ONE",48:"NON_IDENTIFYING",49:"IDENTIFYING",50:"WORD",51:"open_directive",52:"type_directive",53:"arg_directive",54:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[10,2],[10,2],[10,2],[10,1],[17,1],[17,1],[21,1],[21,2],[32,2],[32,3],[32,3],[32,4],[33,1],[34,1],[35,1],[35,3],[38,1],[36,1],[18,3],[42,1],[42,1],[42,1],[42,1],[43,1],[43,1],[19,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 1:break;case 3:case 7:case 8:this.$=[];break;case 4:a[o-1].push(a[o]),this.$=a[o-1];break;case 5:case 6:case 20:case 43:case 28:case 29:case 32:this.$=a[o];break;case 12:r.addEntity(a[o-4]),r.addEntity(a[o-2]),r.addRelationship(a[o-4],a[o],a[o-2],a[o-3]);break;case 13:r.addEntity(a[o-3]),r.addAttributes(a[o-3],a[o-1]);break;case 14:r.addEntity(a[o-2]);break;case 15:r.addEntity(a[o]);break;case 16:case 17:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 21:case 41:case 42:case 33:this.$=a[o].replace(/"/g,"");break;case 22:case 30:this.$=[a[o]];break;case 23:a[o].push(a[o-1]),this.$=a[o];break;case 24:this.$={attributeType:a[o-1],attributeName:a[o]};break;case 25:this.$={attributeType:a[o-2],attributeName:a[o-1],attributeKeyTypeList:a[o]};break;case 26:this.$={attributeType:a[o-2],attributeName:a[o-1],attributeComment:a[o]};break;case 27:this.$={attributeType:a[o-3],attributeName:a[o-2],attributeKeyTypeList:a[o-1],attributeComment:a[o]};break;case 31:a[o-2].push(a[o]),this.$=a[o-2];break;case 34:this.$={cardA:a[o],relType:a[o-1],cardB:a[o-2]};break;case 35:this.$=r.Cardinality.ZERO_OR_ONE;break;case 36:this.$=r.Cardinality.ZERO_OR_MORE;break;case 37:this.$=r.Cardinality.ONE_OR_MORE;break;case 38:this.$=r.Cardinality.ONLY_ONE;break;case 39:this.$=r.Identification.NON_IDENTIFYING;break;case 40:this.$=r.Identification.IDENTIFYING;break;case 44:r.parseDirective("%%{","open_directive");break;case 45:r.parseDirective(a[o],"type_directive");break;case 46:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 47:r.parseDirective("}%%","close_directive","er")}},table:[{3:1,4:n,7:3,12:4,51:r},{1:[3]},e(i,[2,3],{5:6}),{3:7,4:n,7:3,12:4,51:r},{13:8,52:[1,9]},{52:[2,44]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:a,25:s,27:o,29:l,30:c,31:u,51:r},{1:[2,2]},{14:23,15:[1,24],54:d},e([15,54],[2,45]),e(i,[2,8],{1:[2,1]}),e(i,[2,4]),{7:15,10:26,12:4,17:16,23:a,25:s,27:o,29:l,30:c,31:u,51:r},e(i,[2,6]),e(i,[2,7]),e(i,[2,11]),e(i,[2,15],{18:27,42:29,20:[1,28],44:h,45:m,46:_,47:p}),{24:[1,34]},{26:[1,35]},{28:[1,36]},e(i,[2,19]),e(f,[2,20]),e(f,[2,21]),{11:[1,37]},{16:38,53:[1,39]},{11:[2,47]},e(i,[2,5]),{17:40,30:c,31:u},{21:41,22:[1,42],32:43,33:44,37:y},{43:46,48:[1,47],49:[1,48]},e(g,[2,35]),e(g,[2,36]),e(g,[2,37]),e(g,[2,38]),e(i,[2,16]),e(i,[2,17]),e(i,[2,18]),e(b,[2,9]),{14:49,54:d},{54:[2,46]},{15:[1,50]},{22:[1,51]},e(i,[2,14]),{21:52,22:[2,22],32:43,33:44,37:y},{34:53,37:[1,54]},{37:[2,28]},{42:55,44:h,45:m,46:_,47:p},e(k,[2,39]),e(k,[2,40]),{11:[1,56]},{19:57,30:[1,60],31:[1,59],50:[1,58]},e(i,[2,13]),{22:[2,23]},e(v,[2,24],{35:61,36:62,38:63,40:x,41:M}),e([22,37,40,41],[2,29]),e([30,31],[2,34]),e(b,[2,10]),e(i,[2,12]),e(i,[2,41]),e(i,[2,42]),e(i,[2,43]),e(v,[2,25],{36:66,39:[1,67],41:M}),e(v,[2,26]),e(L,[2,30]),e(v,[2,33]),e(L,[2,32]),e(v,[2,27]),{38:68,40:x},e(L,[2,31])],defaultActions:{5:[2,44],7:[2,2],25:[2,47],39:[2,46],45:[2,28],52:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},T=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("acc_title"),25;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),27;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return this.begin("open_directive"),51;case 8:return this.begin("type_directive"),52;case 9:return this.popState(),this.begin("arg_directive"),15;case 10:return this.popState(),this.popState(),54;case 11:return 53;case 12:case 13:case 15:case 22:case 27:break;case 14:return 11;case 16:return 9;case 17:return 31;case 18:return 50;case 19:return 4;case 20:return this.begin("block"),20;case 21:return 39;case 23:return 40;case 24:case 25:return 37;case 26:return 41;case 28:return this.popState(),22;case 29:case 58:return e.yytext[0];case 30:case 34:case 35:case 48:return 44;case 31:case 32:case 33:case 41:case 43:case 50:return 46;case 36:case 37:case 38:case 39:case 40:case 42:case 49:return 45;case 44:case 45:case 46:case 47:return 47;case 51:case 54:case 55:case 56:return 48;case 52:case 53:return 49;case 57:return 30;case 59:return 6}},rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:,)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:(.*?)[~](.*?)*[~])/i,/^(?:[A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:1\b)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:.)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},open_directive:{rules:[8],inclusive:!1},type_directive:{rules:[9,10],inclusive:!1},arg_directive:{rules:[10,11],inclusive:!1},block:{rules:[21,22,23,24,25,26,27,28,29],inclusive:!1},INITIAL:{rules:[0,2,4,7,12,13,14,15,16,17,18,19,20,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],inclusive:!0}}},t);function S(){this.yy={}}return w.lexer=T,S.prototype=w,w.Parser=S,new S}();Xs.parser=Xs;const Ks=Xs,Qs=t=>null!==t.match(/^\s*erDiagram/);let to={},eo=[];const no=function(t){return void 0===to[t]&&(to[t]={attributes:[]},St.info("Added new entity :",t)),to[t]},ro={Cardinality:{ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE"},Identification:{NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().er,addEntity:no,addAttributes:function(t,e){let n,r=no(t);for(n=e.length-1;n>=0;n--)r.attributes.push(e[n]),St.debug("Added attribute ",e[n].attributeName)},getEntities:()=>to,addRelationship:function(t,e,n,r){let i={entityA:t,roleA:e,entityB:n,relSpec:r};eo.push(i),St.debug("Added new relationship :",i)},getRelationships:()=>eo,clear:function(){to={},eo=[],Ar()},setAccTitle:Or,getAccTitle:Nr,setAccDescription:Br,getAccDescription:Fr,setDiagramTitle:Ir,getDiagramTitle:Pr},io={ONLY_ONE_START:"ONLY_ONE_START",ONLY_ONE_END:"ONLY_ONE_END",ZERO_OR_ONE_START:"ZERO_OR_ONE_START",ZERO_OR_ONE_END:"ZERO_OR_ONE_END",ONE_OR_MORE_START:"ONE_OR_MORE_START",ONE_OR_MORE_END:"ONE_OR_MORE_END",ZERO_OR_MORE_START:"ZERO_OR_MORE_START",ZERO_OR_MORE_END:"ZERO_OR_MORE_END"},ao=io,so=function(t,e){let n;t.append("defs").append("marker").attr("id",io.ONLY_ONE_START).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",io.ONLY_ONE_END).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M3,0 L3,18 M9,0 L9,18"),n=t.append("defs").append("marker").attr("id",io.ZERO_OR_ONE_START).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M9,0 L9,18"),n=t.append("defs").append("marker").attr("id",io.ZERO_OR_ONE_END).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M21,0 L21,18"),t.append("defs").append("marker").attr("id",io.ONE_OR_MORE_START).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",io.ONE_OR_MORE_END).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"),n=t.append("defs").append("marker").attr("id",io.ZERO_OR_MORE_START).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18"),n=t.append("defs").append("marker").attr("id",io.ZERO_OR_MORE_END).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},oo=/[^\dA-Za-z](\W)*/g;let lo={},co=new Map;const uo=function(t,e,n){let r;return Object.keys(e).forEach((function(i){const a=function(t="",e=""){const n=t.replace(oo,"");return`${po(e)}${po(n)}${vt(t,_o)}`}(i,"entity");co.set(i,a);const s=t.append("g").attr("id",a);r=void 0===r?a:r;const o="text-"+a,l=s.append("text").classed("er entityLabel",!0).attr("id",o).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","middle").style("font-family",ar().fontFamily).style("font-size",lo.fontSize+"px").text(i),{width:c,height:u}=((t,e,n)=>{const r=lo.entityPadding/3,i=lo.entityPadding/3,a=.85*lo.fontSize,s=e.node().getBBox(),o=[];let l=!1,c=!1,u=0,d=0,h=0,m=0,_=s.height+2*r,p=1;n.forEach((t=>{void 0!==t.attributeKeyTypeList&&t.attributeKeyTypeList.length>0&&(l=!0),void 0!==t.attributeComment&&(c=!0)})),n.forEach((n=>{const i=`${e.node().id}-attr-${p}`;let s=0;const f=It(n.attributeType),y=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-type`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ar().fontFamily).style("font-size",a+"px").text(f),g=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-name`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ar().fontFamily).style("font-size",a+"px").text(n.attributeName),b={};b.tn=y,b.nn=g;const k=y.node().getBBox(),v=g.node().getBBox();if(u=Math.max(u,k.width),d=Math.max(d,v.width),s=Math.max(k.height,v.height),l){const e=void 0!==n.attributeKeyTypeList?n.attributeKeyTypeList.join(","):"",r=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-key`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ar().fontFamily).style("font-size",a+"px").text(e);b.kn=r;const o=r.node().getBBox();h=Math.max(h,o.width),s=Math.max(s,o.height)}if(c){const e=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-comment`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ar().fontFamily).style("font-size",a+"px").text(n.attributeComment||"");b.cn=e;const r=e.node().getBBox();m=Math.max(m,r.width),s=Math.max(s,r.height)}b.height=s,o.push(b),_+=s+2*r,p+=1}));let f=4;l&&(f+=2),c&&(f+=2);const y=u+d+h+m,g={width:Math.max(lo.minEntityWidth,Math.max(s.width+2*lo.entityPadding,y+i*f)),height:n.length>0?_:Math.max(lo.minEntityHeight,s.height+2*lo.entityPadding)};if(n.length>0){const n=Math.max(0,(g.width-y-i*f)/(f/2));e.attr("transform","translate("+g.width/2+","+(r+s.height/2)+")");let a=s.height+2*r,_="attributeBoxOdd";o.forEach((e=>{const s=a+r+e.height/2;e.tn.attr("transform","translate("+i+","+s+")");const o=t.insert("rect","#"+e.tn.node().id).classed(`er ${_}`,!0).attr("x",0).attr("y",a).attr("width",u+2*i+n).attr("height",e.height+2*r),p=parseFloat(o.attr("x"))+parseFloat(o.attr("width"));e.nn.attr("transform","translate("+(p+i)+","+s+")");const f=t.insert("rect","#"+e.nn.node().id).classed(`er ${_}`,!0).attr("x",p).attr("y",a).attr("width",d+2*i+n).attr("height",e.height+2*r);let y=parseFloat(f.attr("x"))+parseFloat(f.attr("width"));if(l){e.kn.attr("transform","translate("+(y+i)+","+s+")");const o=t.insert("rect","#"+e.kn.node().id).classed(`er ${_}`,!0).attr("x",y).attr("y",a).attr("width",h+2*i+n).attr("height",e.height+2*r);y=parseFloat(o.attr("x"))+parseFloat(o.attr("width"))}c&&(e.cn.attr("transform","translate("+(y+i)+","+s+")"),t.insert("rect","#"+e.cn.node().id).classed(`er ${_}`,"true").attr("x",y).attr("y",a).attr("width",m+2*i+n).attr("height",e.height+2*r)),a+=e.height+2*r,_="attributeBoxOdd"===_?"attributeBoxEven":"attributeBoxOdd"}))}else g.height=Math.max(lo.minEntityHeight,_),e.attr("transform","translate("+g.width/2+","+g.height/2+")");return g})(s,l,e[i].attributes),d=s.insert("rect","#"+o).classed("er entityBox",!0).attr("x",0).attr("y",0).attr("width",c).attr("height",u).node().getBBox();n.setNode(a,{width:d.width,height:d.height,shape:"rect",id:a})})),r},ho=function(t){return(t.entityA+t.roleA+t.entityB).replace(/\s/g,"")};let mo=0;const _o="28e9f9db-3c8d-5aa5-9faf-44286ae5937c";function po(t=""){return t.length>0?`${t}-`:""}const fo={setConf:function(t){const e=Object.keys(t);for(const n of e)lo[n]=t[n]},draw:function(t,e,n,r){lo=ar().er,St.info("Drawing ER diagram");const i=ar().securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s=("sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body")).select(`[id='${e}']`);let l;so(s,lo),l=new ut.k({multigraph:!0,directed:!0,compound:!1}).setGraph({rankdir:lo.layoutDirection,marginx:20,marginy:20,nodesep:100,edgesep:100,ranksep:100}).setDefaultEdgeLabel((function(){return{}}));const c=uo(s,r.db.getEntities(),l),u=function(t,e){return t.forEach((function(t){e.setEdge(co.get(t.entityA),co.get(t.entityB),{relationship:t},ho(t))})),t}(r.db.getRelationships(),l);var d,h;(0,ct.bK)(l),d=s,(h=l).nodes().forEach((function(t){void 0!==t&&void 0!==h.node(t)&&d.select("#"+t).attr("transform","translate("+(h.node(t).x-h.node(t).width/2)+","+(h.node(t).y-h.node(t).height/2)+" )")})),u.forEach((function(t){!function(t,e,n,r,i){mo++;const a=n.edge(co.get(e.entityA),co.get(e.entityB),ho(e)),s=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(o.$0Z),l=t.insert("path","#"+r).classed("er relationshipLine",!0).attr("d",s(a.points)).style("stroke",lo.stroke).style("fill","none");e.relSpec.relType===i.db.Identification.NON_IDENTIFYING&&l.attr("stroke-dasharray","8,8");let c="";switch(lo.arrowMarkerAbsolute&&(c=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,c=c.replace(/\(/g,"\\("),c=c.replace(/\)/g,"\\)")),e.relSpec.cardA){case i.db.Cardinality.ZERO_OR_ONE:l.attr("marker-end","url("+c+"#"+ao.ZERO_OR_ONE_END+")");break;case i.db.Cardinality.ZERO_OR_MORE:l.attr("marker-end","url("+c+"#"+ao.ZERO_OR_MORE_END+")");break;case i.db.Cardinality.ONE_OR_MORE:l.attr("marker-end","url("+c+"#"+ao.ONE_OR_MORE_END+")");break;case i.db.Cardinality.ONLY_ONE:l.attr("marker-end","url("+c+"#"+ao.ONLY_ONE_END+")")}switch(e.relSpec.cardB){case i.db.Cardinality.ZERO_OR_ONE:l.attr("marker-start","url("+c+"#"+ao.ZERO_OR_ONE_START+")");break;case i.db.Cardinality.ZERO_OR_MORE:l.attr("marker-start","url("+c+"#"+ao.ZERO_OR_MORE_START+")");break;case i.db.Cardinality.ONE_OR_MORE:l.attr("marker-start","url("+c+"#"+ao.ONE_OR_MORE_START+")");break;case i.db.Cardinality.ONLY_ONE:l.attr("marker-start","url("+c+"#"+ao.ONLY_ONE_START+")")}const u=l.node().getTotalLength(),d=l.node().getPointAtLength(.5*u),h="rel"+mo,m=t.append("text").classed("er relationshipLabel",!0).attr("id",h).attr("x",d.x).attr("y",d.y).style("text-anchor","middle").style("dominant-baseline","middle").style("font-family",ar().fontFamily).style("font-size",lo.fontSize+"px").text(e.roleA).node().getBBox();t.insert("rect","#"+h).classed("er relationshipLabelBox",!0).attr("x",d.x-m.width/2).attr("y",d.y-m.height/2).attr("width",m.width).attr("height",m.height)}(s,t,l,c,r)}));const m=lo.diagramPadding;Gn.insertTitle(s,"entityTitleText",lo.titleTopMargin,r.db.getDiagramTitle());const _=s.node().getBBox(),p=_.width+2*m,f=_.height+2*m;hr(s,f,p,lo.useMaxWidth),s.attr("viewBox",`${_.x-m} ${_.y-m} ${p} ${f}`)}};var yo=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,9],r=[1,7],i=[1,6],a=[1,8],s=[1,20,21,22,23,38,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],o=[2,10],l=[1,20],c=[1,21],u=[1,22],d=[1,23],h=[1,30],m=[1,32],_=[1,33],p=[1,34],f=[1,62],y=[1,48],g=[1,52],b=[1,36],k=[1,37],v=[1,38],x=[1,39],M=[1,40],L=[1,56],w=[1,63],T=[1,51],S=[1,53],D=[1,55],Y=[1,59],E=[1,60],C=[1,41],A=[1,42],O=[1,43],N=[1,44],B=[1,61],F=[1,50],I=[1,54],P=[1,57],j=[1,58],R=[1,49],H=[1,66],$=[1,71],Z=[1,20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],W=[1,75],z=[1,74],U=[1,76],q=[20,21,23,81,82],V=[1,99],G=[1,104],J=[1,107],X=[1,108],K=[1,101],Q=[1,106],tt=[1,109],et=[1,102],nt=[1,114],rt=[1,113],it=[1,103],at=[1,105],st=[1,110],ot=[1,111],lt=[1,112],ct=[1,115],ut=[20,21,22,23,81,82],dt=[20,21,22,23,53,81,82],ht=[20,21,22,23,40,52,53,55,57,59,61,63,65,66,67,69,71,73,74,76,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],mt=[20,21,23],_t=[20,21,23,52,66,67,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],pt=[1,12,20,21,22,23,24,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],ft=[52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],yt=[1,149],gt=[1,157],bt=[1,158],kt=[1,159],vt=[1,160],xt=[1,144],Mt=[1,145],Lt=[1,141],wt=[1,152],Tt=[1,153],St=[1,154],Dt=[1,155],Yt=[1,156],Et=[1,161],Ct=[1,162],At=[1,147],Ot=[1,150],Nt=[1,146],Bt=[1,143],Ft=[20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],It=[1,165],Pt=[20,21,22,23,26,52,66,67,91,105,106,109,111,112,122,123,124,125,126,127],jt=[20,21,22,23,24,26,38,40,41,42,52,56,58,60,62,64,66,67,68,70,72,73,75,77,81,82,86,87,88,89,90,91,92,95,105,106,109,111,112,113,114,122,123,124,125,126,127],Rt=[12,21,22,24],Ht=[22,106],$t=[1,250],Zt=[1,245],Wt=[1,246],zt=[1,254],Ut=[1,251],qt=[1,248],Vt=[1,247],Gt=[1,249],Jt=[1,252],Xt=[1,253],Kt=[1,255],Qt=[1,273],te=[20,21,23,106],ee=[20,21,22,23,66,67,86,102,105,106,109,110,111,112,113],ne={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,directive:5,openDirective:6,typeDirective:7,closeDirective:8,separator:9,":":10,argDirective:11,open_directive:12,type_directive:13,arg_directive:14,close_directive:15,graphConfig:16,document:17,line:18,statement:19,SEMI:20,NEWLINE:21,SPACE:22,EOF:23,GRAPH:24,NODIR:25,DIR:26,FirstStmtSeperator:27,ending:28,endToken:29,spaceList:30,spaceListNewline:31,verticeStatement:32,styleStatement:33,linkStyleStatement:34,classDefStatement:35,classStatement:36,clickStatement:37,subgraph:38,text:39,SQS:40,SQE:41,end:42,direction:43,acc_title:44,acc_title_value:45,acc_descr:46,acc_descr_value:47,acc_descr_multiline_value:48,link:49,node:50,vertex:51,AMP:52,STYLE_SEPARATOR:53,idString:54,DOUBLECIRCLESTART:55,DOUBLECIRCLEEND:56,PS:57,PE:58,"(-":59,"-)":60,STADIUMSTART:61,STADIUMEND:62,SUBROUTINESTART:63,SUBROUTINEEND:64,VERTEX_WITH_PROPS_START:65,ALPHA:66,COLON:67,PIPE:68,CYLINDERSTART:69,CYLINDEREND:70,DIAMOND_START:71,DIAMOND_STOP:72,TAGEND:73,TRAPSTART:74,TRAPEND:75,INVTRAPSTART:76,INVTRAPEND:77,linkStatement:78,arrowText:79,TESTSTR:80,START_LINK:81,LINK:82,textToken:83,STR:84,keywords:85,STYLE:86,LINKSTYLE:87,CLASSDEF:88,CLASS:89,CLICK:90,DOWN:91,UP:92,textNoTags:93,textNoTagsToken:94,DEFAULT:95,stylesOpt:96,alphaNum:97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,HEX:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,MINUS:109,UNIT:110,BRKT:111,DOT:112,PCT:113,TAGSTART:114,alphaNumToken:115,idStringToken:116,alphaNumStatement:117,direction_tb:118,direction_bt:119,direction_rl:120,direction_lr:121,PUNCTUATION:122,UNICODE_TEXT:123,PLUS:124,EQUALS:125,MULT:126,UNDERSCORE:127,graphCodeTokens:128,ARROW_CROSS:129,ARROW_POINT:130,ARROW_CIRCLE:131,ARROW_OPEN:132,QUOTE:133,$accept:0,$end:1},terminals_:{2:"error",10:":",12:"open_directive",13:"type_directive",14:"arg_directive",15:"close_directive",20:"SEMI",21:"NEWLINE",22:"SPACE",23:"EOF",24:"GRAPH",25:"NODIR",26:"DIR",38:"subgraph",40:"SQS",41:"SQE",42:"end",44:"acc_title",45:"acc_title_value",46:"acc_descr",47:"acc_descr_value",48:"acc_descr_multiline_value",52:"AMP",53:"STYLE_SEPARATOR",55:"DOUBLECIRCLESTART",56:"DOUBLECIRCLEEND",57:"PS",58:"PE",59:"(-",60:"-)",61:"STADIUMSTART",62:"STADIUMEND",63:"SUBROUTINESTART",64:"SUBROUTINEEND",65:"VERTEX_WITH_PROPS_START",66:"ALPHA",67:"COLON",68:"PIPE",69:"CYLINDERSTART",70:"CYLINDEREND",71:"DIAMOND_START",72:"DIAMOND_STOP",73:"TAGEND",74:"TRAPSTART",75:"TRAPEND",76:"INVTRAPSTART",77:"INVTRAPEND",80:"TESTSTR",81:"START_LINK",82:"LINK",84:"STR",86:"STYLE",87:"LINKSTYLE",88:"CLASSDEF",89:"CLASS",90:"CLICK",91:"DOWN",92:"UP",95:"DEFAULT",98:"CALLBACKNAME",99:"CALLBACKARGS",100:"HREF",101:"LINK_TARGET",102:"HEX",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"MINUS",110:"UNIT",111:"BRKT",112:"DOT",113:"PCT",114:"TAGSTART",118:"direction_tb",119:"direction_bt",120:"direction_rl",121:"direction_lr",122:"PUNCTUATION",123:"UNICODE_TEXT",124:"PLUS",125:"EQUALS",126:"MULT",127:"UNDERSCORE",129:"ARROW_CROSS",130:"ARROW_POINT",131:"ARROW_CIRCLE",132:"ARROW_OPEN",133:"QUOTE"},productions_:[0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[19,2],[19,2],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[50,1],[50,5],[50,3],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,8],[51,4],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,4],[51,4],[51,1],[49,2],[49,3],[49,3],[49,1],[49,3],[78,1],[79,3],[39,1],[39,2],[39,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[93,1],[93,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[103,1],[103,3],[96,1],[96,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[94,1],[94,1],[94,1],[94,1],[54,1],[54,2],[97,1],[97,2],[117,1],[117,1],[117,1],[117,1],[43,1],[43,1],[43,1],[43,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 5:r.parseDirective("%%{","open_directive");break;case 6:r.parseDirective(a[o],"type_directive");break;case 7:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 8:r.parseDirective("}%%","close_directive","flowchart");break;case 10:case 36:case 37:case 38:case 39:case 40:this.$=[];break;case 11:(!Array.isArray(a[o])||a[o].length>0)&&a[o-1].push(a[o]),this.$=a[o-1];break;case 12:case 82:case 84:case 96:case 152:case 154:case 155:case 78:case 150:this.$=a[o];break;case 19:r.setDirection("TB"),this.$="TB";break;case 20:r.setDirection(a[o-1]),this.$=a[o-1];break;case 35:this.$=a[o-1].nodes;break;case 41:this.$=r.addSubGraph(a[o-6],a[o-1],a[o-4]);break;case 42:this.$=r.addSubGraph(a[o-3],a[o-1],a[o-3]);break;case 43:this.$=r.addSubGraph(void 0,a[o-1],void 0);break;case 45:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 46:case 47:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 51:r.addLink(a[o-2].stmt,a[o],a[o-1]),this.$={stmt:a[o],nodes:a[o].concat(a[o-2].nodes)};break;case 52:r.addLink(a[o-3].stmt,a[o-1],a[o-2]),this.$={stmt:a[o-1],nodes:a[o-1].concat(a[o-3].nodes)};break;case 53:this.$={stmt:a[o-1],nodes:a[o-1]};break;case 54:this.$={stmt:a[o],nodes:a[o]};break;case 55:case 123:case 125:this.$=[a[o]];break;case 56:this.$=a[o-4].concat(a[o]);break;case 57:this.$=[a[o-2]],r.setClass(a[o-2],a[o]);break;case 58:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"square");break;case 59:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"doublecircle");break;case 60:this.$=a[o-5],r.addVertex(a[o-5],a[o-2],"circle");break;case 61:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"ellipse");break;case 62:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"stadium");break;case 63:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"subroutine");break;case 64:this.$=a[o-7],r.addVertex(a[o-7],a[o-1],"rect",void 0,void 0,void 0,Object.fromEntries([[a[o-5],a[o-3]]]));break;case 65:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"cylinder");break;case 66:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"round");break;case 67:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"diamond");break;case 68:this.$=a[o-5],r.addVertex(a[o-5],a[o-2],"hexagon");break;case 69:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"odd");break;case 70:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"trapezoid");break;case 71:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"inv_trapezoid");break;case 72:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"lean_right");break;case 73:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"lean_left");break;case 74:this.$=a[o],r.addVertex(a[o]);break;case 75:a[o-1].text=a[o],this.$=a[o-1];break;case 76:case 77:a[o-2].text=a[o-1],this.$=a[o-2];break;case 79:var l=r.destructLink(a[o],a[o-2]);this.$={type:l.type,stroke:l.stroke,length:l.length,text:a[o-1]};break;case 80:l=r.destructLink(a[o]);this.$={type:l.type,stroke:l.stroke,length:l.length};break;case 81:this.$=a[o-1];break;case 83:case 97:case 153:case 151:this.$=a[o-1]+""+a[o];break;case 98:case 99:this.$=a[o-4],r.addClass(a[o-2],a[o]);break;case 100:this.$=a[o-4],r.setClass(a[o-2],a[o]);break;case 101:case 109:this.$=a[o-1],r.setClickEvent(a[o-1],a[o]);break;case 102:case 110:this.$=a[o-3],r.setClickEvent(a[o-3],a[o-2]),r.setTooltip(a[o-3],a[o]);break;case 103:this.$=a[o-2],r.setClickEvent(a[o-2],a[o-1],a[o]);break;case 104:this.$=a[o-4],r.setClickEvent(a[o-4],a[o-3],a[o-2]),r.setTooltip(a[o-4],a[o]);break;case 105:case 111:this.$=a[o-1],r.setLink(a[o-1],a[o]);break;case 106:case 112:this.$=a[o-3],r.setLink(a[o-3],a[o-2]),r.setTooltip(a[o-3],a[o]);break;case 107:case 113:this.$=a[o-3],r.setLink(a[o-3],a[o-2],a[o]);break;case 108:case 114:this.$=a[o-5],r.setLink(a[o-5],a[o-4],a[o]),r.setTooltip(a[o-5],a[o-2]);break;case 115:this.$=a[o-4],r.addVertex(a[o-2],void 0,void 0,a[o]);break;case 116:case 118:this.$=a[o-4],r.updateLink(a[o-2],a[o]);break;case 117:this.$=a[o-4],r.updateLink([a[o-2]],a[o]);break;case 119:this.$=a[o-8],r.updateLinkInterpolate([a[o-6]],a[o-2]),r.updateLink([a[o-6]],a[o]);break;case 120:this.$=a[o-8],r.updateLinkInterpolate(a[o-6],a[o-2]),r.updateLink(a[o-6],a[o]);break;case 121:this.$=a[o-6],r.updateLinkInterpolate([a[o-4]],a[o]);break;case 122:this.$=a[o-6],r.updateLinkInterpolate(a[o-4],a[o]);break;case 124:case 126:a[o-2].push(a[o]),this.$=a[o-2];break;case 128:this.$=a[o-1]+a[o];break;case 156:this.$="v";break;case 157:this.$="-";break;case 158:this.$={stmt:"dir",value:"TB"};break;case 159:this.$={stmt:"dir",value:"BT"};break;case 160:this.$={stmt:"dir",value:"RL"};break;case 161:this.$={stmt:"dir",value:"LR"}}},table:[{3:1,4:2,5:3,6:5,12:n,16:4,21:r,22:i,24:a},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:n,16:4,21:r,22:i,24:a},e(s,o,{17:11}),{7:12,13:[1,13]},{16:14,21:r,22:i,24:a},{16:15,21:r,22:i,24:a},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:l,21:c,22:u,23:d,32:24,33:25,34:26,35:27,36:28,37:29,38:h,43:31,44:m,46:_,48:p,50:35,51:45,52:f,54:46,66:y,67:g,86:b,87:k,88:v,89:x,90:M,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,116:47,118:C,119:A,120:O,121:N,122:B,123:F,124:I,125:P,126:j,127:R},{8:64,10:[1,65],15:H},e([10,15],[2,6]),e(s,[2,17]),e(s,[2,18]),e(s,[2,19]),{20:[1,68],21:[1,69],22:$,27:67,30:70},e(Z,[2,11]),e(Z,[2,12]),e(Z,[2,13]),e(Z,[2,14]),e(Z,[2,15]),e(Z,[2,16]),{9:72,20:W,21:z,23:U,49:73,78:77,81:[1,78],82:[1,79]},{9:80,20:W,21:z,23:U},{9:81,20:W,21:z,23:U},{9:82,20:W,21:z,23:U},{9:83,20:W,21:z,23:U},{9:84,20:W,21:z,23:U},{9:86,20:W,21:z,22:[1,85],23:U},e(Z,[2,44]),{45:[1,87]},{47:[1,88]},e(Z,[2,47]),e(q,[2,54],{30:89,22:$}),{22:[1,90]},{22:[1,91]},{22:[1,92]},{22:[1,93]},{26:V,52:G,66:J,67:X,84:[1,97],91:K,97:96,98:[1,94],100:[1,95],105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(Z,[2,158]),e(Z,[2,159]),e(Z,[2,160]),e(Z,[2,161]),e(ut,[2,55],{53:[1,116]}),e(dt,[2,74],{116:129,40:[1,117],52:f,55:[1,118],57:[1,119],59:[1,120],61:[1,121],63:[1,122],65:[1,123],66:y,67:g,69:[1,124],71:[1,125],73:[1,126],74:[1,127],76:[1,128],91:L,95:w,105:T,106:S,109:D,111:Y,112:E,122:B,123:F,124:I,125:P,126:j,127:R}),e(ht,[2,150]),e(ht,[2,175]),e(ht,[2,176]),e(ht,[2,177]),e(ht,[2,178]),e(ht,[2,179]),e(ht,[2,180]),e(ht,[2,181]),e(ht,[2,182]),e(ht,[2,183]),e(ht,[2,184]),e(ht,[2,185]),e(ht,[2,186]),e(ht,[2,187]),e(ht,[2,188]),e(ht,[2,189]),e(ht,[2,190]),{9:130,20:W,21:z,23:U},{11:131,14:[1,132]},e(mt,[2,8]),e(s,[2,20]),e(s,[2,26]),e(s,[2,27]),{21:[1,133]},e(_t,[2,34],{30:134,22:$}),e(Z,[2,35]),{50:135,51:45,52:f,54:46,66:y,67:g,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,116:47,122:B,123:F,124:I,125:P,126:j,127:R},e(pt,[2,48]),e(pt,[2,49]),e(pt,[2,50]),e(ft,[2,78],{79:136,68:[1,138],80:[1,137]}),{22:yt,24:gt,26:bt,38:kt,39:139,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e([52,66,67,68,80,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,80]),e(Z,[2,36]),e(Z,[2,37]),e(Z,[2,38]),e(Z,[2,39]),e(Z,[2,40]),{22:yt,24:gt,26:bt,38:kt,39:163,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(Ft,o,{17:164}),e(Z,[2,45]),e(Z,[2,46]),e(q,[2,53],{52:It}),{26:V,52:G,66:J,67:X,91:K,97:166,102:[1,167],105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:lt,127:ct},{95:[1,168],103:169,105:[1,170]},{26:V,52:G,66:J,67:X,91:K,95:[1,171],97:172,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:lt,127:ct},{26:V,52:G,66:J,67:X,91:K,97:173,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(mt,[2,101],{22:[1,174],99:[1,175]}),e(mt,[2,105],{22:[1,176]}),e(mt,[2,109],{115:100,117:178,22:[1,177],26:V,52:G,66:J,67:X,91:K,105:Q,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:lt,127:ct}),e(mt,[2,111],{22:[1,179]}),e(Pt,[2,152]),e(Pt,[2,154]),e(Pt,[2,155]),e(Pt,[2,156]),e(Pt,[2,157]),e(jt,[2,162]),e(jt,[2,163]),e(jt,[2,164]),e(jt,[2,165]),e(jt,[2,166]),e(jt,[2,167]),e(jt,[2,168]),e(jt,[2,169]),e(jt,[2,170]),e(jt,[2,171]),e(jt,[2,172]),e(jt,[2,173]),e(jt,[2,174]),{52:f,54:180,66:y,67:g,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,116:47,122:B,123:F,124:I,125:P,126:j,127:R},{22:yt,24:gt,26:bt,38:kt,39:181,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:182,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:184,42:vt,52:G,57:[1,183],66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:185,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:186,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:187,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{66:[1,188]},{22:yt,24:gt,26:bt,38:kt,39:189,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:190,42:vt,52:G,66:J,67:X,71:[1,191],73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:192,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:193,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:194,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(ht,[2,151]),e(Rt,[2,3]),{8:195,15:H},{15:[2,7]},e(s,[2,28]),e(_t,[2,33]),e(q,[2,51],{30:196,22:$}),e(ft,[2,75],{22:[1,197]}),{22:[1,198]},{22:yt,24:gt,26:bt,38:kt,39:199,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,66:J,67:X,73:xt,81:Mt,82:[1,200],83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(jt,[2,82]),e(jt,[2,84]),e(jt,[2,140]),e(jt,[2,141]),e(jt,[2,142]),e(jt,[2,143]),e(jt,[2,144]),e(jt,[2,145]),e(jt,[2,146]),e(jt,[2,147]),e(jt,[2,148]),e(jt,[2,149]),e(jt,[2,85]),e(jt,[2,86]),e(jt,[2,87]),e(jt,[2,88]),e(jt,[2,89]),e(jt,[2,90]),e(jt,[2,91]),e(jt,[2,92]),e(jt,[2,93]),e(jt,[2,94]),e(jt,[2,95]),{9:203,20:W,21:z,22:yt,23:U,24:gt,26:bt,38:kt,40:[1,202],42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{18:18,19:19,20:l,21:c,22:u,23:d,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,204],43:31,44:m,46:_,48:p,50:35,51:45,52:f,54:46,66:y,67:g,86:b,87:k,88:v,89:x,90:M,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,116:47,118:C,119:A,120:O,121:N,122:B,123:F,124:I,125:P,126:j,127:R},{22:$,30:205},{22:[1,206],26:V,52:G,66:J,67:X,91:K,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:178,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:[1,207]},{22:[1,208]},{22:[1,209],106:[1,210]},e(Ht,[2,123]),{22:[1,211]},{22:[1,212],26:V,52:G,66:J,67:X,91:K,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:178,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:[1,213],26:V,52:G,66:J,67:X,91:K,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:178,122:it,123:at,124:st,125:ot,126:lt,127:ct},{84:[1,214]},e(mt,[2,103],{22:[1,215]}),{84:[1,216],101:[1,217]},{84:[1,218]},e(Pt,[2,153]),{84:[1,219],101:[1,220]},e(ut,[2,57],{116:129,52:f,66:y,67:g,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,122:B,123:F,124:I,125:P,126:j,127:R}),{22:yt,24:gt,26:bt,38:kt,41:[1,221],42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,56:[1,222],66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:223,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,58:[1,224],66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,60:[1,225],66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,62:[1,226],66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,64:[1,227],66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{67:[1,228]},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,66:J,67:X,70:[1,229],73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,66:J,67:X,72:[1,230],73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,39:231,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,41:[1,232],42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,66:J,67:X,73:xt,75:[1,233],77:[1,234],81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,66:J,67:X,73:xt,75:[1,236],77:[1,235],81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{9:237,20:W,21:z,23:U},e(q,[2,52],{52:It}),e(ft,[2,77]),e(ft,[2,76]),{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,66:J,67:X,68:[1,238],73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(ft,[2,79]),e(jt,[2,83]),{22:yt,24:gt,26:bt,38:kt,39:239,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(Ft,o,{17:240}),e(Z,[2,43]),{51:241,52:f,54:46,66:y,67:g,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,116:47,122:B,123:F,124:I,125:P,126:j,127:R},{22:$t,66:Zt,67:Wt,86:zt,96:242,102:Ut,105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},{22:$t,66:Zt,67:Wt,86:zt,96:256,102:Ut,105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},{22:$t,66:Zt,67:Wt,86:zt,96:257,102:Ut,104:[1,258],105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},{22:$t,66:Zt,67:Wt,86:zt,96:259,102:Ut,104:[1,260],105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},{105:[1,261]},{22:$t,66:Zt,67:Wt,86:zt,96:262,102:Ut,105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},{22:$t,66:Zt,67:Wt,86:zt,96:263,102:Ut,105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},{26:V,52:G,66:J,67:X,91:K,97:264,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(mt,[2,102]),{84:[1,265]},e(mt,[2,106],{22:[1,266]}),e(mt,[2,107]),e(mt,[2,110]),e(mt,[2,112],{22:[1,267]}),e(mt,[2,113]),e(dt,[2,58]),e(dt,[2,59]),{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,58:[1,268],66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(dt,[2,66]),e(dt,[2,61]),e(dt,[2,62]),e(dt,[2,63]),{66:[1,269]},e(dt,[2,65]),e(dt,[2,67]),{22:yt,24:gt,26:bt,38:kt,42:vt,52:G,66:J,67:X,72:[1,270],73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(dt,[2,69]),e(dt,[2,70]),e(dt,[2,72]),e(dt,[2,71]),e(dt,[2,73]),e(Rt,[2,4]),e([22,52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,81]),{22:yt,24:gt,26:bt,38:kt,41:[1,271],42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{18:18,19:19,20:l,21:c,22:u,23:d,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,272],43:31,44:m,46:_,48:p,50:35,51:45,52:f,54:46,66:y,67:g,86:b,87:k,88:v,89:x,90:M,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,116:47,118:C,119:A,120:O,121:N,122:B,123:F,124:I,125:P,126:j,127:R},e(ut,[2,56]),e(mt,[2,115],{106:Qt}),e(te,[2,125],{108:274,22:$t,66:Zt,67:Wt,86:zt,102:Ut,105:qt,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt}),e(ee,[2,127]),e(ee,[2,129]),e(ee,[2,130]),e(ee,[2,131]),e(ee,[2,132]),e(ee,[2,133]),e(ee,[2,134]),e(ee,[2,135]),e(ee,[2,136]),e(ee,[2,137]),e(ee,[2,138]),e(ee,[2,139]),e(mt,[2,116],{106:Qt}),e(mt,[2,117],{106:Qt}),{22:[1,275]},e(mt,[2,118],{106:Qt}),{22:[1,276]},e(Ht,[2,124]),e(mt,[2,98],{106:Qt}),e(mt,[2,99],{106:Qt}),e(mt,[2,100],{115:100,117:178,26:V,52:G,66:J,67:X,91:K,105:Q,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:lt,127:ct}),e(mt,[2,104]),{101:[1,277]},{101:[1,278]},{58:[1,279]},{68:[1,280]},{72:[1,281]},{9:282,20:W,21:z,23:U},e(Z,[2,42]),{22:$t,66:Zt,67:Wt,86:zt,102:Ut,105:qt,107:283,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},e(ee,[2,128]),{26:V,52:G,66:J,67:X,91:K,97:284,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:lt,127:ct},{26:V,52:G,66:J,67:X,91:K,97:285,105:Q,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(mt,[2,108]),e(mt,[2,114]),e(dt,[2,60]),{22:yt,24:gt,26:bt,38:kt,39:286,42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:140,84:Lt,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},e(dt,[2,68]),e(Ft,o,{17:287}),e(te,[2,126],{108:274,22:$t,66:Zt,67:Wt,86:zt,102:Ut,105:qt,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt}),e(mt,[2,121],{115:100,117:178,22:[1,288],26:V,52:G,66:J,67:X,91:K,105:Q,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:lt,127:ct}),e(mt,[2,122],{115:100,117:178,22:[1,289],26:V,52:G,66:J,67:X,91:K,105:Q,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:lt,127:ct}),{22:yt,24:gt,26:bt,38:kt,41:[1,290],42:vt,52:G,66:J,67:X,73:xt,81:Mt,83:201,85:151,86:wt,87:Tt,88:St,89:Dt,90:Yt,91:Et,92:Ct,94:142,95:At,105:Q,106:tt,109:Ot,111:nt,112:rt,113:Nt,114:Bt,115:148,122:it,123:at,124:st,125:ot,126:lt,127:ct},{18:18,19:19,20:l,21:c,22:u,23:d,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,291],43:31,44:m,46:_,48:p,50:35,51:45,52:f,54:46,66:y,67:g,86:b,87:k,88:v,89:x,90:M,91:L,95:w,105:T,106:S,109:D,111:Y,112:E,116:47,118:C,119:A,120:O,121:N,122:B,123:F,124:I,125:P,126:j,127:R},{22:$t,66:Zt,67:Wt,86:zt,96:292,102:Ut,105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},{22:$t,66:Zt,67:Wt,86:zt,96:293,102:Ut,105:qt,107:243,108:244,109:Vt,110:Gt,111:Jt,112:Xt,113:Kt},e(dt,[2,64]),e(Z,[2,41]),e(mt,[2,119],{106:Qt}),e(mt,[2,120],{106:Qt})],defaultActions:{2:[2,1],9:[2,5],10:[2,2],132:[2,7]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},re=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),12;case 1:return this.begin("type_directive"),13;case 2:return this.popState(),this.begin("arg_directive"),10;case 3:return this.popState(),this.popState(),15;case 4:return 14;case 5:case 6:break;case 7:return this.begin("acc_title"),44;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),46;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:case 15:case 24:case 27:case 30:case 33:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:this.begin("string");break;case 16:return"STR";case 17:return 86;case 18:return 95;case 19:return 87;case 20:return 104;case 21:return 88;case 22:return 89;case 23:this.begin("href");break;case 25:return 100;case 26:this.begin("callbackname");break;case 28:this.popState(),this.begin("callbackargs");break;case 29:return 98;case 31:return 99;case 32:this.begin("click");break;case 34:return 90;case 35:case 36:case 37:return t.lex.firstGraph()&&this.begin("dir"),24;case 38:return 38;case 39:return 42;case 40:case 41:case 42:case 43:return 101;case 44:return this.popState(),25;case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:case 54:return this.popState(),26;case 55:return 118;case 56:return 119;case 57:return 120;case 58:return 121;case 59:return 105;case 60:return 111;case 61:return 53;case 62:return 67;case 63:return 52;case 64:return 20;case 65:return 106;case 66:return 126;case 67:case 68:case 69:return 82;case 70:case 71:case 72:return 81;case 73:return 59;case 74:return 60;case 75:return 61;case 76:return 62;case 77:return 63;case 78:return 64;case 79:return 65;case 80:return 69;case 81:return 70;case 82:return 55;case 83:return 56;case 84:return 109;case 85:return 112;case 86:return 127;case 87:return 124;case 88:return 113;case 89:case 90:return 125;case 91:return 114;case 92:return 73;case 93:return 92;case 94:return"SEP";case 95:return 91;case 96:return 66;case 97:return 75;case 98:return 74;case 99:return 77;case 100:return 76;case 101:return 122;case 102:return 123;case 103:return 68;case 104:return 57;case 105:return 58;case 106:return 40;case 107:return 41;case 108:return 71;case 109:return 72;case 110:return 133;case 111:return 21;case 112:return 22;case 113:return 23}},rules:[/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:flowchart-elk\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\[)/,/^(?:\]\))/,/^(?:\[\[)/,/^(?:\]\])/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\])/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:-)/,/^(?:\.)/,/^(?:[\_])/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\])/,/^(?:\[\/)/,/^(?:\/\])/,/^(?:\[\\)/,/^(?:[!"#$%&'*+,-.`?\\_/])/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[30,31],inclusive:!1},callbackname:{rules:[27,28,29],inclusive:!1},href:{rules:[24,25],inclusive:!1},click:{rules:[33,34],inclusive:!1},vertex:{rules:[],inclusive:!1},dir:{rules:[44,45,46,47,48,49,50,51,52,53,54],inclusive:!1},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},string:{rules:[15,16],inclusive:!1},INITIAL:{rules:[0,5,6,7,9,11,14,17,18,19,20,21,22,23,26,32,35,36,37,38,39,40,41,42,43,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113],inclusive:!0}}},t);function ie(){this.yy={}}return ne.lexer=re,ie.prototype=ne,ne.Parser=ie,new ie}();yo.parser=yo;const go=yo,bo=(t,e)=>{var n,r;return"dagre-wrapper"!==(null==(n=null==e?void 0:e.flowchart)?void 0:n.defaultRenderer)&&("elk"!==(null==(r=null==e?void 0:e.flowchart)?void 0:r.defaultRenderer)&&null!==t.match(/^\s*graph/))},ko=(t,e)=>{var n,r;return"dagre-d3"!==(null==(n=null==e?void 0:e.flowchart)?void 0:n.defaultRenderer)&&("elk"!==(null==(r=null==e?void 0:e.flowchart)?void 0:r.defaultRenderer)&&(null!==t.match(/^\s*graph/)||null!==t.match(/^\s*flowchart/)))};let vo,xo,Mo=0,Lo=ar(),wo={},To=[],So={},Do=[],Yo={},Eo={},Co=0,Ao=!0,Oo=[];const No=t=>Pt.sanitizeText(t,Lo),Bo=function(t,e,n){am.parseDirective(this,t,e,n)},Fo=function(t){const e=Object.keys(wo);for(const n of e)if(wo[n].id===t)return wo[n].domId;return t},Io=function(t,e,n,r,i,a,s={}){let o,l=t;void 0!==l&&0!==l.trim().length&&(void 0===wo[l]&&(wo[l]={id:l,domId:"flowchart-"+l+"-"+Mo,styles:[],classes:[]}),Mo++,void 0!==e?(Lo=ar(),o=No(e.trim()),'"'===o[0]&&'"'===o[o.length-1]&&(o=o.substring(1,o.length-1)),wo[l].text=o):void 0===wo[l].text&&(wo[l].text=t),void 0!==n&&(wo[l].type=n),null!=r&&r.forEach((function(t){wo[l].styles.push(t)})),null!=i&&i.forEach((function(t){wo[l].classes.push(t)})),void 0!==a&&(wo[l].dir=a),void 0===wo[l].props?wo[l].props=s:void 0!==s&&Object.assign(wo[l].props,s))},Po=function(t,e,n,r){const i={start:t,end:e,type:void 0,text:""};void 0!==(r=n.text)&&(i.text=No(r.trim()),'"'===i.text[0]&&'"'===i.text[i.text.length-1]&&(i.text=i.text.substring(1,i.text.length-1))),void 0!==n&&(i.type=n.type,i.stroke=n.stroke,i.length=n.length),To.push(i)},jo=function(t,e,n,r){let i,a;for(i=0;i<t.length;i++)for(a=0;a<e.length;a++)Po(t[i],e[a],n,r)},Ro=function(t,e){t.forEach((function(t){"default"===t?To.defaultInterpolate=e:To[t].interpolate=e}))},Ho=function(t,e){t.forEach((function(t){"default"===t?To.defaultStyle=e:(-1===Gn.isSubstringInArray("fill",e)&&e.push("fill:none"),To[t].style=e)}))},$o=function(t,e){void 0===So[t]&&(So[t]={id:t,styles:[],textStyles:[]}),null!=e&&e.forEach((function(e){if(e.match("color")){const n=e.replace("fill","bgFill").replace("color","fill");So[t].textStyles.push(n)}So[t].styles.push(e)}))},Zo=function(t){vo=t,vo.match(/.*</)&&(vo="RL"),vo.match(/.*\^/)&&(vo="BT"),vo.match(/.*>/)&&(vo="LR"),vo.match(/.*v/)&&(vo="TB"),"TD"===vo&&(vo="TB")},Wo=function(t,e){t.split(",").forEach((function(t){let n=t;void 0!==wo[n]&&wo[n].classes.push(e),void 0!==Yo[n]&&Yo[n].classes.push(e)}))},zo=function(t,e,n){t.split(",").forEach((function(t){void 0!==wo[t]&&(wo[t].link=Gn.formatUrl(e,Lo),wo[t].linkTarget=n)})),Wo(t,"clickable")},Uo=function(t){return Eo[t]},qo=function(t,e,n){t.split(",").forEach((function(t){!function(t,e,n){let r=Fo(t);if("loose"!==ar().securityLevel)return;if(void 0===e)return;let i=[];if("string"==typeof n){i=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let t=0;t<i.length;t++){let e=i[t].trim();'"'===e.charAt(0)&&'"'===e.charAt(e.length-1)&&(e=e.substr(1,e.length-2)),i[t]=e}}0===i.length&&i.push(t),void 0!==wo[t]&&(wo[t].haveCallback=!0,Oo.push((function(){const t=document.querySelector(`[id="${r}"]`);null!==t&&t.addEventListener("click",(function(){Gn.runFunc(e,...i)}),!1)})))}(t,e,n)})),Wo(t,"clickable")},Vo=function(t){Oo.forEach((function(e){e(t)}))},Go=function(){return vo.trim()},Jo=function(){return wo},Xo=function(){return To},Ko=function(){return So},Qo=function(t){let e=(0,o.Ys)(".mermaidTooltip");null===(e._groups||e)[0][0]&&(e=(0,o.Ys)("body").append("div").attr("class","mermaidTooltip").style("opacity",0));(0,o.Ys)(t).select("svg").selectAll("g.node").on("mouseover",(function(){const t=(0,o.Ys)(this);if(null===t.attr("title"))return;const n=this.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.text(t.attr("title")).style("left",window.scrollX+n.left+(n.right-n.left)/2+"px").style("top",window.scrollY+n.top-14+document.body.scrollTop+"px"),e.html(e.html().replace(/<br\/>/g,"<br/>")),t.classed("hover",!0)})).on("mouseout",(function(){e.transition().duration(500).style("opacity",0);(0,o.Ys)(this).classed("hover",!1)}))};Oo.push(Qo);const tl=function(t="gen-1"){wo={},So={},To=[],Oo=[Qo],Do=[],Yo={},Co=0,Eo=[],Ao=!0,xo=t,Ar()},el=t=>{xo=t||"gen-2"},nl=function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"},rl=function(t,e,n){let r=t.trim(),i=n;t===n&&n.match(/\s/)&&(r=void 0);let a=[];const{nodeList:s,dir:o}=function(t){const e={boolean:{},number:{},string:{}},n=[];let r;return{nodeList:t.filter((function(t){const i=typeof t;return t.stmt&&"dir"===t.stmt?(r=t.value,!1):""!==t.trim()&&(i in e?!e[i].hasOwnProperty(t)&&(e[i][t]=!0):!n.includes(t)&&n.push(t))})),dir:r}}(a.concat.apply(a,e));if(a=s,"gen-1"===xo)for(let c=0;c<a.length;c++)a[c]=Fo(a[c]);r=r||"subGraph"+Co,i=i||"",i=No(i),Co+=1;const l={id:r,nodes:a,title:i.trim(),classes:[],dir:o};return St.info("Adding",l.id,l.nodes,l.dir),l.nodes=_l(l,Do).nodes,Do.push(l),Yo[r]=l,r},il=function(t){for(const[e,n]of Do.entries())if(n.id===t)return e;return-1};let al=-1;const sl=[],ol=function(t,e){const n=Do[e].nodes;if(al+=1,al>2e3)return;if(sl[al]=e,Do[e].id===t)return{result:!0,count:0};let r=0,i=1;for(;r<n.length;){const e=il(n[r]);if(e>=0){const n=ol(t,e);if(n.result)return{result:!0,count:i+n.count};i+=n.count}r+=1}return{result:!1,count:i}},ll=function(t){return sl[t]},cl=function(){al=-1,Do.length>0&&ol("none",Do.length-1)},ul=function(){return Do},dl=()=>!!Ao&&(Ao=!1,!0),hl=(t,e)=>{const n=(t=>{const e=t.trim();let n=e.slice(0,-1),r="arrow_open";switch(e.slice(-1)){case"x":r="arrow_cross","x"===e[0]&&(r="double_"+r,n=n.slice(1));break;case">":r="arrow_point","<"===e[0]&&(r="double_"+r,n=n.slice(1));break;case"o":r="arrow_circle","o"===e[0]&&(r="double_"+r,n=n.slice(1))}let i="normal",a=n.length-1;"="===n[0]&&(i="thick");let s=((t,e)=>{const n=e.length;let r=0;for(let i=0;i<n;++i)e[i]===t&&++r;return r})(".",n);return s&&(i="dotted",a=s),{type:r,stroke:i,length:a}})(t);let r;if(e){if(r=(t=>{let e=t.trim(),n="arrow_open";switch(e[0]){case"<":n="arrow_point",e=e.slice(1);break;case"x":n="arrow_cross",e=e.slice(1);break;case"o":n="arrow_circle",e=e.slice(1)}let r="normal";return e.includes("=")&&(r="thick"),e.includes(".")&&(r="dotted"),{type:n,stroke:r}})(e),r.stroke!==n.stroke)return{type:"INVALID",stroke:"INVALID"};if("arrow_open"===r.type)r.type=n.type;else{if(r.type!==n.type)return{type:"INVALID",stroke:"INVALID"};r.type="double_"+r.type}return"double_arrow"===r.type&&(r.type="double_arrow_point"),r.length=n.length,r}return n},ml=(t,e)=>{let n=!1;return t.forEach((t=>{t.nodes.indexOf(e)>=0&&(n=!0)})),n},_l=(t,e)=>{const n=[];return t.nodes.forEach(((r,i)=>{ml(e,r)||n.push(t.nodes[i])})),{nodes:n}},pl={firstGraph:dl},fl={parseDirective:Bo,defaultConfig:()=>Xn.flowchart,setAccTitle:Or,getAccTitle:Nr,getAccDescription:Fr,setAccDescription:Br,addVertex:Io,lookUpDomId:Fo,addLink:jo,updateLinkInterpolate:Ro,updateLink:Ho,addClass:$o,setDirection:Zo,setClass:Wo,setTooltip:function(t,e){t.split(",").forEach((function(t){void 0!==e&&(Eo["gen-1"===xo?Fo(t):t]=No(e))}))},getTooltip:Uo,setClickEvent:qo,setLink:zo,bindFunctions:Vo,getDirection:Go,getVertices:Jo,getEdges:Xo,getClasses:Ko,clear:tl,setGen:el,defaultStyle:nl,addSubGraph:rl,getDepthFirstPos:ll,indexNodes:cl,getSubGraphs:ul,destructLink:hl,lex:pl,exists:ml,makeUniq:_l,setDiagramTitle:Ir,getDiagramTitle:Pr},yl=Object.freeze(Object.defineProperty({__proto__:null,parseDirective:Bo,lookUpDomId:Fo,addVertex:Io,addSingleLink:Po,addLink:jo,updateLinkInterpolate:Ro,updateLink:Ho,addClass:$o,setDirection:Zo,setClass:Wo,setLink:zo,getTooltip:Uo,setClickEvent:qo,bindFunctions:Vo,getDirection:Go,getVertices:Jo,getEdges:Xo,getClasses:Ko,clear:tl,setGen:el,defaultStyle:nl,addSubGraph:rl,getDepthFirstPos:ll,indexNodes:cl,getSubGraphs:ul,firstGraph:dl,destructLink:hl,lex:pl,default:fl},Symbol.toStringTag,{value:"Module"}));const gl={},bl=function(t){const e=Object.keys(t);for(const n of e)gl[n]=t[n]},kl={},vl=function(t,e,n,r,i,a){const s=r.select(`[id="${n}"]`);Object.keys(t).forEach((function(n){const r=t[n];let o="default";r.classes.length>0&&(o=r.classes.join(" "));const l=Nn(r.styles);let c,u=void 0!==r.text?r.text:r.id;if(Ft(ar().flowchart.htmlLabels)){const t={label:u.replace(/fa[blrs]?:fa-[\w-]+/g,(t=>`<i class='${t.replace(":"," ")}'></i>`))};c=(0,xt.a)(s,t).node(),c.parentNode.removeChild(c)}else{const t=i.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",l.labelStyle.replace("color:","fill:"));const e=u.split(Pt.lineBreakRegex);for(const n of e){const e=i.createElementNS("http://www.w3.org/2000/svg","tspan");e.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),e.setAttribute("dy","1em"),e.setAttribute("x","1"),e.textContent=n,t.appendChild(e)}c=t}let d=0,h="";switch(r.type){case"round":d=5,h="rect";break;case"square":case"group":default:h="rect";break;case"diamond":h="question";break;case"hexagon":h="hexagon";break;case"odd":case"odd_right":h="rect_left_inv_arrow";break;case"lean_right":h="lean_right";break;case"lean_left":h="lean_left";break;case"trapezoid":h="trapezoid";break;case"inv_trapezoid":h="inv_trapezoid";break;case"circle":h="circle";break;case"ellipse":h="ellipse";break;case"stadium":h="stadium";break;case"subroutine":h="subroutine";break;case"cylinder":h="cylinder";break;case"doublecircle":h="doublecircle"}e.setNode(r.id,{labelStyle:l.labelStyle,shape:h,labelText:u,rx:d,ry:d,class:o,style:l.style,id:r.id,link:r.link,linkTarget:r.linkTarget,tooltip:a.db.getTooltip(r.id)||"",domId:a.db.lookUpDomId(r.id),haveCallback:r.haveCallback,width:"group"===r.type?500:void 0,dir:r.dir,type:r.type,props:r.props,padding:ar().flowchart.padding}),St.info("setNode",{labelStyle:l.labelStyle,shape:h,labelText:u,rx:d,ry:d,class:o,style:l.style,id:r.id,domId:a.db.lookUpDomId(r.id),width:"group"===r.type?500:void 0,type:r.type,dir:r.dir,props:r.props,padding:ar().flowchart.padding})}))},xl=function(t,e,n){St.info("abc78 edges = ",t);let r,i,a=0,s={};if(void 0!==t.defaultStyle){const e=Nn(t.defaultStyle);r=e.style,i=e.labelStyle}t.forEach((function(n){a++;var l="L-"+n.start+"-"+n.end;void 0===s[l]?(s[l]=0,St.info("abc78 new entry",l,s[l])):(s[l]++,St.info("abc78 new entry",l,s[l]));let c=l+"-"+s[l];St.info("abc78 new link id to be used is",l,c,s[l]);var u="LS-"+n.start,d="LE-"+n.end;const h={style:"",labelStyle:""};switch(h.minlen=n.length||1,"arrow_open"===n.type?h.arrowhead="none":h.arrowhead="normal",h.arrowTypeStart="arrow_open",h.arrowTypeEnd="arrow_open",n.type){case"double_arrow_cross":h.arrowTypeStart="arrow_cross";case"arrow_cross":h.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":h.arrowTypeStart="arrow_point";case"arrow_point":h.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":h.arrowTypeStart="arrow_circle";case"arrow_circle":h.arrowTypeEnd="arrow_circle"}let m="",_="";switch(n.stroke){case"normal":m="fill:none;",void 0!==r&&(m=r),void 0!==i&&(_=i),h.thickness="normal",h.pattern="solid";break;case"dotted":h.thickness="normal",h.pattern="dotted",h.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":h.thickness="thick",h.pattern="solid",h.style="stroke-width: 3.5px;fill:none;"}if(void 0!==n.style){const t=Nn(n.style);m=t.style,_=t.labelStyle}h.style=h.style+=m,h.labelStyle=h.labelStyle+=_,void 0!==n.interpolate?h.curve=An(n.interpolate,o.c_6):void 0!==t.defaultInterpolate?h.curve=An(t.defaultInterpolate,o.c_6):h.curve=An(kl.curve,o.c_6),void 0===n.text?void 0!==n.style&&(h.arrowheadStyle="fill: #333"):(h.arrowheadStyle="fill: #333",h.labelpos="c"),h.labelType="text",h.label=n.text.replace(Pt.lineBreakRegex,"\n"),void 0===n.style&&(h.style=h.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),h.labelStyle=h.labelStyle.replace("color:","fill:"),h.id=c,h.classes="flowchart-link "+u+" "+d,e.setEdge(n.start,n.end,h,a)}))},Ml={setConf:function(t){const e=Object.keys(t);for(const n of e)kl[n]=t[n]},addVertices:vl,addEdges:xl,getClasses:function(t,e){St.info("Extracting classes"),e.db.clear();try{return e.parse(t),e.db.getClasses()}catch(n){return}},draw:function(t,e,n,r){St.info("Drawing flowchart"),r.db.clear(),fl.setGen("gen-2"),r.parser.parse(t);let i=r.db.getDirection();void 0===i&&(i="TD");const{securityLevel:a,flowchart:s}=ar(),l=s.nodeSpacing||50,c=s.rankSpacing||50;let u;"sandbox"===a&&(u=(0,o.Ys)("#i"+e));const d="sandbox"===a?(0,o.Ys)(u.nodes()[0].contentDocument.body):(0,o.Ys)("body"),h="sandbox"===a?u.nodes()[0].contentDocument:document,m=new ut.k({multigraph:!0,compound:!0}).setGraph({rankdir:i,nodesep:l,ranksep:c,marginx:0,marginy:0}).setDefaultEdgeLabel((function(){return{}}));let _;const p=r.db.getSubGraphs();St.info("Subgraphs - ",p);for(let o=p.length-1;o>=0;o--)_=p[o],St.info("Subgraph - ",_),r.db.addVertex(_.id,_.title,"group",void 0,_.classes,_.dir);const f=r.db.getVertices(),y=r.db.getEdges();St.info("Edges",y);let g=0;for(g=p.length-1;g>=0;g--){_=p[g],(0,o.td_)("cluster").append("text");for(let t=0;t<_.nodes.length;t++)St.info("Setting up subgraphs",_.nodes[t],_.id),m.setParent(_.nodes[t],_.id)}vl(f,m,e,d,h,r),xl(y,m);const b=d.select(`[id="${e}"]`),k=d.select("#"+e+" g");if(Us(k,m,["point","circle","cross"],"flowchart",e),Gn.insertTitle(b,"flowchartTitleText",s.titleTopMargin,r.db.getDiagramTitle()),mr(m,b,s.diagramPadding,s.useMaxWidth),r.db.indexNodes("subGraph"+g),!s.htmlLabels){const t=h.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(const e of t){const t=e.getBBox(),n=h.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("rx",0),n.setAttribute("ry",0),n.setAttribute("width",t.width),n.setAttribute("height",t.height),e.insertBefore(n,e.firstChild)}}Object.keys(f).forEach((function(t){const n=f[t];if(n.link){const r=(0,o.Ys)("#"+e+' [id="'+t+'"]');if(r){const t=h.createElementNS("http://www.w3.org/2000/svg","a");t.setAttributeNS("http://www.w3.org/2000/svg","class",n.classes.join(" ")),t.setAttributeNS("http://www.w3.org/2000/svg","href",n.link),t.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),"sandbox"===a?t.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):n.linkTarget&&t.setAttributeNS("http://www.w3.org/2000/svg","target",n.linkTarget);const e=r.insert((function(){return t}),":first-child"),i=r.select(".label-container");i&&e.append((function(){return i.node()}));const s=r.select(".label");s&&e.append((function(){return s.node()}))}}}))}};var Ll=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,3],r=[1,5],i=[7,9,11,12,13,14,15,16,17,18,19,20,21,23,25,26,28,35,40],a=[1,15],s=[1,16],o=[1,17],l=[1,18],c=[1,19],u=[1,20],d=[1,21],h=[1,22],m=[1,23],_=[1,24],p=[1,25],f=[1,26],y=[1,27],g=[1,29],b=[1,31],k=[1,34],v=[5,7,9,11,12,13,14,15,16,17,18,19,20,21,23,25,26,28,35,40],x={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,gantt:5,document:6,EOF:7,line:8,SPACE:9,statement:10,NL:11,dateFormat:12,inclusiveEndDates:13,topAxis:14,axisFormat:15,tickInterval:16,excludes:17,includes:18,todayMarker:19,title:20,acc_title:21,acc_title_value:22,acc_descr:23,acc_descr_value:24,acc_descr_multiline_value:25,section:26,clickStatement:27,taskTxt:28,taskData:29,openDirective:30,typeDirective:31,closeDirective:32,":":33,argDirective:34,click:35,callbackname:36,callbackargs:37,href:38,clickStatementDebug:39,open_directive:40,type_directive:41,arg_directive:42,close_directive:43,$accept:0,$end:1},terminals_:{2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"topAxis",15:"axisFormat",16:"tickInterval",17:"excludes",18:"includes",19:"todayMarker",20:"title",21:"acc_title",22:"acc_title_value",23:"acc_descr",24:"acc_descr_value",25:"acc_descr_multiline_value",26:"section",28:"taskTxt",29:"taskData",33:":",35:"click",36:"callbackname",37:"callbackargs",38:"href",40:"open_directive",41:"type_directive",42:"arg_directive",43:"close_directive"},productions_:[0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[27,2],[27,3],[27,3],[27,4],[27,3],[27,4],[27,2],[39,2],[39,3],[39,3],[39,4],[39,3],[39,4],[39,2],[30,1],[31,1],[34,1],[32,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 2:return a[o-1];case 3:case 7:case 8:this.$=[];break;case 4:a[o-1].push(a[o]),this.$=a[o-1];break;case 5:case 6:this.$=a[o];break;case 9:r.setDateFormat(a[o].substr(11)),this.$=a[o].substr(11);break;case 10:r.enableInclusiveEndDates(),this.$=a[o].substr(18);break;case 11:r.TopAxis(),this.$=a[o].substr(8);break;case 12:r.setAxisFormat(a[o].substr(11)),this.$=a[o].substr(11);break;case 13:r.setTickInterval(a[o].substr(13)),this.$=a[o].substr(13);break;case 14:r.setExcludes(a[o].substr(9)),this.$=a[o].substr(9);break;case 15:r.setIncludes(a[o].substr(9)),this.$=a[o].substr(9);break;case 16:r.setTodayMarker(a[o].substr(12)),this.$=a[o].substr(12);break;case 17:r.setDiagramTitle(a[o].substr(6)),this.$=a[o].substr(6);break;case 18:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 19:case 20:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 21:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 23:r.addTask(a[o-1],a[o]),this.$="task";break;case 27:this.$=a[o-1],r.setClickEvent(a[o-1],a[o],null);break;case 28:this.$=a[o-2],r.setClickEvent(a[o-2],a[o-1],a[o]);break;case 29:this.$=a[o-2],r.setClickEvent(a[o-2],a[o-1],null),r.setLink(a[o-2],a[o]);break;case 30:this.$=a[o-3],r.setClickEvent(a[o-3],a[o-2],a[o-1]),r.setLink(a[o-3],a[o]);break;case 31:this.$=a[o-2],r.setClickEvent(a[o-2],a[o],null),r.setLink(a[o-2],a[o-1]);break;case 32:this.$=a[o-3],r.setClickEvent(a[o-3],a[o-1],a[o]),r.setLink(a[o-3],a[o-2]);break;case 33:this.$=a[o-1],r.setLink(a[o-1],a[o]);break;case 34:case 40:this.$=a[o-1]+" "+a[o];break;case 35:case 36:case 38:this.$=a[o-2]+" "+a[o-1]+" "+a[o];break;case 37:case 39:this.$=a[o-3]+" "+a[o-2]+" "+a[o-1]+" "+a[o];break;case 41:r.parseDirective("%%{","open_directive");break;case 42:r.parseDirective(a[o],"type_directive");break;case 43:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 44:r.parseDirective("}%%","close_directive","gantt")}},table:[{3:1,4:2,5:n,30:4,40:r},{1:[3]},{3:6,4:2,5:n,30:4,40:r},e(i,[2,3],{6:7}),{31:8,41:[1,9]},{41:[2,41]},{1:[2,1]},{4:30,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:a,13:s,14:o,15:l,16:c,17:u,18:d,19:h,20:m,21:_,23:p,25:f,26:y,27:28,28:g,30:4,35:b,40:r},{32:32,33:[1,33],43:k},e([33,43],[2,42]),e(i,[2,8],{1:[2,2]}),e(i,[2,4]),{4:30,10:35,12:a,13:s,14:o,15:l,16:c,17:u,18:d,19:h,20:m,21:_,23:p,25:f,26:y,27:28,28:g,30:4,35:b,40:r},e(i,[2,6]),e(i,[2,7]),e(i,[2,9]),e(i,[2,10]),e(i,[2,11]),e(i,[2,12]),e(i,[2,13]),e(i,[2,14]),e(i,[2,15]),e(i,[2,16]),e(i,[2,17]),{22:[1,36]},{24:[1,37]},e(i,[2,20]),e(i,[2,21]),e(i,[2,22]),{29:[1,38]},e(i,[2,24]),{36:[1,39],38:[1,40]},{11:[1,41]},{34:42,42:[1,43]},{11:[2,44]},e(i,[2,5]),e(i,[2,18]),e(i,[2,19]),e(i,[2,23]),e(i,[2,27],{37:[1,44],38:[1,45]}),e(i,[2,33],{36:[1,46]}),e(v,[2,25]),{32:47,43:k},{43:[2,43]},e(i,[2,28],{38:[1,48]}),e(i,[2,29]),e(i,[2,31],{37:[1,49]}),{11:[1,50]},e(i,[2,30]),e(i,[2,32]),e(v,[2,26])],defaultActions:{5:[2,41],6:[2,1],34:[2,44],43:[2,43]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},M=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),40;case 1:return this.begin("type_directive"),41;case 2:return this.popState(),this.begin("arg_directive"),33;case 3:return this.popState(),this.popState(),43;case 4:return 42;case 5:return this.begin("acc_title"),21;case 6:return this.popState(),"acc_title_value";case 7:return this.begin("acc_descr"),23;case 8:return this.popState(),"acc_descr_value";case 9:this.begin("acc_descr_multiline");break;case 10:case 20:case 23:case 26:case 29:this.popState();break;case 11:return"acc_descr_multiline_value";case 12:case 13:case 14:case 16:case 17:case 18:break;case 15:return 11;case 19:this.begin("href");break;case 21:return 38;case 22:this.begin("callbackname");break;case 24:this.popState(),this.begin("callbackargs");break;case 25:return 36;case 27:return 37;case 28:this.begin("click");break;case 30:return 35;case 31:return 5;case 32:return 12;case 33:return 13;case 34:return 14;case 35:return 15;case 36:return 16;case 37:return 18;case 38:return 17;case 39:return 19;case 40:return"date";case 41:return 20;case 42:return"accDescription";case 43:return 26;case 44:return 28;case 45:return 29;case 46:return 33;case 47:return 7;case 48:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:tickInterval\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[26,27],inclusive:!1},callbackname:{rules:[23,24,25],inclusive:!1},href:{rules:[20,21],inclusive:!1},click:{rules:[29,30],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,22,28,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],inclusive:!0}}},t);function L(){this.yy={}}return x.lexer=M,L.prototype=x,x.Parser=L,new L}();Ll.parser=Ll;const wl=Ll,Tl=t=>null!==t.match(/^\s*gantt/);let Sl,Dl="",Yl="",El="",Cl=[],Al=[],Ol={},Nl=[],Bl=[],Fl="";const Il=["active","done","crit","milestone"];let Pl=[],jl=!1,Rl=!1,Hl=0;const $l=function(t,e,n,r){return!r.includes(t.format(e.trim()))&&(!!(t.isoWeekday()>=6&&n.includes("weekends"))||(!!n.includes(t.format("dddd").toLowerCase())||n.includes(t.format(e.trim()))))},Zl=function(t,e,n,r){if(!n.length||t.manualEndTime)return;let i=a()(t.startTime,e,!0);i.add(1,"d");let s=a()(t.endTime,e,!0),o=Wl(i,s,e,n,r);t.endTime=s.toDate(),t.renderEndTime=o},Wl=function(t,e,n,r,i){let a=!1,s=null;for(;t<=e;)a||(s=e.toDate()),a=$l(t,n,r,i),a&&e.add(1,"d"),t.add(1,"d");return s},zl=function(t,e,n){n=n.trim();const r=/^after\s+([\d\w- ]+)/.exec(n.trim());if(null!==r){let t=null;if(r[1].split(" ").forEach((function(e){let n=tc(e);void 0!==n&&(t?n.endTime>t.endTime&&(t=n):t=n)})),t)return t.endTime;{const t=new Date;return t.setHours(0,0,0,0),t}}let i=a()(n,e.trim(),!0);if(i.isValid())return i.toDate();{St.debug("Invalid date:"+n),St.debug("With date format:"+e.trim());const t=new Date(n);if(void 0===t||isNaN(t.getTime()))throw new Error("Invalid date:"+n);return t}},Ul=function(t){const e=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim());return null!==e?a().duration(Number.parseFloat(e[1]),e[2]):a().duration.invalid()},ql=function(t,e,n,r=!1){n=n.trim();let i=a()(n,e.trim(),!0);if(i.isValid())return r&&i.add(1,"d"),i.toDate();const s=a()(t),o=Ul(n);return o.isValid()&&s.add(o),s.toDate()};let Vl=0;const Gl=function(t){return void 0===t?(Vl+=1,"task"+Vl):t};let Jl,Xl,Kl=[];const Ql={},tc=function(t){const e=Ql[t];return Kl[e]},ec=function(){const t=function(t){const e=Kl[t];let n="";switch(Kl[t].raw.startTime.type){case"prevTaskEnd":{const t=tc(e.prevTaskId);e.startTime=t.endTime;break}case"getStartDate":n=zl(0,Dl,Kl[t].raw.startTime.startData),n&&(Kl[t].startTime=n)}return Kl[t].startTime&&(Kl[t].endTime=ql(Kl[t].startTime,Dl,Kl[t].raw.endTime.data,jl),Kl[t].endTime&&(Kl[t].processed=!0,Kl[t].manualEndTime=a()(Kl[t].raw.endTime.data,"YYYY-MM-DD",!0).isValid(),Zl(Kl[t],Dl,Al,Cl))),Kl[t].processed};let e=!0;for(const[n,r]of Kl.entries())t(n),e=e&&r.processed;return e},nc=function(t,e){t.split(",").forEach((function(t){let n=tc(t);void 0!==n&&n.classes.push(e)}))},rc=function(t,e){Pl.push((function(){const n=document.querySelector(`[id="${t}"]`);null!==n&&n.addEventListener("click",(function(){e()}))}),(function(){const n=document.querySelector(`[id="${t}-text"]`);null!==n&&n.addEventListener("click",(function(){e()}))}))},ic={parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().gantt,clear:function(){Nl=[],Bl=[],Fl="",Pl=[],Vl=0,Jl=void 0,Xl=void 0,Kl=[],Dl="",Yl="",Sl=void 0,El="",Cl=[],Al=[],jl=!1,Rl=!1,Hl=0,Ol={},Ar()},setDateFormat:function(t){Dl=t},getDateFormat:function(){return Dl},enableInclusiveEndDates:function(){jl=!0},endDatesAreInclusive:function(){return jl},enableTopAxis:function(){Rl=!0},topAxisEnabled:function(){return Rl},setAxisFormat:function(t){Yl=t},getAxisFormat:function(){return Yl},setTickInterval:function(t){Sl=t},getTickInterval:function(){return Sl},setTodayMarker:function(t){El=t},getTodayMarker:function(){return El},setAccTitle:Or,getAccTitle:Nr,setDiagramTitle:Ir,getDiagramTitle:Pr,setAccDescription:Br,getAccDescription:Fr,addSection:function(t){Fl=t,Nl.push(t)},getSections:function(){return Nl},getTasks:function(){let t=ec();let e=0;for(;!t&&e<10;)t=ec(),e++;return Bl=Kl,Bl},addTask:function(t,e){const n={section:Fl,type:Fl,processed:!1,manualEndTime:!1,renderEndTime:null,raw:{data:e},task:t,classes:[]},r=function(t,e){let n;n=":"===e.substr(0,1)?e.substr(1,e.length):e;const r=n.split(","),i={};ac(r,i,Il);for(let a=0;a<r.length;a++)r[a]=r[a].trim();switch(r.length){case 1:i.id=Gl(),i.startTime={type:"prevTaskEnd",id:t},i.endTime={data:r[0]};break;case 2:i.id=Gl(),i.startTime={type:"getStartDate",startData:r[0]},i.endTime={data:r[1]};break;case 3:i.id=Gl(r[0]),i.startTime={type:"getStartDate",startData:r[1]},i.endTime={data:r[2]}}return i}(Xl,e);n.raw.startTime=r.startTime,n.raw.endTime=r.endTime,n.id=r.id,n.prevTaskId=Xl,n.active=r.active,n.done=r.done,n.crit=r.crit,n.milestone=r.milestone,n.order=Hl,Hl++;const i=Kl.push(n);Xl=n.id,Ql[n.id]=i-1},findTaskById:tc,addTaskOrg:function(t,e){const n={section:Fl,type:Fl,description:t,task:t,classes:[]},r=function(t,e){let n;n=":"===e.substr(0,1)?e.substr(1,e.length):e;const r=n.split(","),i={};ac(r,i,Il);for(let a=0;a<r.length;a++)r[a]=r[a].trim();let s="";switch(r.length){case 1:i.id=Gl(),i.startTime=t.endTime,s=r[0];break;case 2:i.id=Gl(),i.startTime=zl(0,Dl,r[0]),s=r[1];break;case 3:i.id=Gl(r[0]),i.startTime=zl(0,Dl,r[1]),s=r[2]}return s&&(i.endTime=ql(i.startTime,Dl,s,jl),i.manualEndTime=a()(s,"YYYY-MM-DD",!0).isValid(),Zl(i,Dl,Al,Cl)),i}(Jl,e);n.startTime=r.startTime,n.endTime=r.endTime,n.id=r.id,n.active=r.active,n.done=r.done,n.crit=r.crit,n.milestone=r.milestone,Jl=n,Bl.push(n)},setIncludes:function(t){Cl=t.toLowerCase().split(/[\s,]+/)},getIncludes:function(){return Cl},setExcludes:function(t){Al=t.toLowerCase().split(/[\s,]+/)},getExcludes:function(){return Al},setClickEvent:function(t,e,n){t.split(",").forEach((function(t){!function(t,e,n){if("loose"!==ar().securityLevel)return;if(void 0===e)return;let r=[];if("string"==typeof n){r=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let t=0;t<r.length;t++){let e=r[t].trim();'"'===e.charAt(0)&&'"'===e.charAt(e.length-1)&&(e=e.substr(1,e.length-2)),r[t]=e}}0===r.length&&r.push(t),void 0!==tc(t)&&rc(t,(()=>{Gn.runFunc(e,...r)}))}(t,e,n)})),nc(t,"clickable")},setLink:function(t,e){let n=e;"loose"!==ar().securityLevel&&(n=(0,s.N)(e)),t.split(",").forEach((function(t){void 0!==tc(t)&&(rc(t,(()=>{window.open(n,"_self")})),Ol[t]=n)})),nc(t,"clickable")},getLinks:function(){return Ol},bindFunctions:function(t){Pl.forEach((function(e){e(t)}))},parseDuration:Ul,isInvalidDate:$l};function ac(t,e,n){let r=!0;for(;r;)r=!1,n.forEach((function(n){const i=new RegExp("^\\s*"+n+"\\s*$");t[0].match(i)&&(e[n]=!0,t.shift(1),r=!0)}))}let sc;const oc={setConf:function(){St.debug("Something is calling, setConf, remove the call")},draw:function(t,e,n,r){const i=ar().gantt,s=ar().securityLevel;let l;"sandbox"===s&&(l=(0,o.Ys)("#i"+e));const c="sandbox"===s?(0,o.Ys)(l.nodes()[0].contentDocument.body):(0,o.Ys)("body"),u="sandbox"===s?l.nodes()[0].contentDocument:document,d=u.getElementById(e);sc=d.parentElement.offsetWidth,void 0===sc&&(sc=1200),void 0!==i.useWidth&&(sc=i.useWidth);const h=r.db.getTasks(),m=h.length*(i.barHeight+i.barGap)+2*i.topPadding;d.setAttribute("viewBox","0 0 "+sc+" "+m);const _=c.select(`[id="${e}"]`),p=(0,o.Xf)().domain([(0,o.VV$)(h,(function(t){return t.startTime})),(0,o.Fp7)(h,(function(t){return t.endTime}))]).rangeRound([0,sc-i.leftPadding-i.rightPadding]);let f=[];for(const a of h)f.push(a.type);const y=f;function g(t,e){return function(t){let e=t.length;const n={};for(;e;)n[t[--e]]=(n[t[e]]||0)+1;return n}(e)[t]||0}f=function(t){const e={},n=[];for(let r=0,i=t.length;r<i;++r)Object.prototype.hasOwnProperty.call(e,t[r])||(e[t[r]]=!0,n.push(t[r]));return n}(f),h.sort((function(t,e){const n=t.startTime,r=e.startTime;let i=0;return n>r?i=1:n<r&&(i=-1),i})),function(t,n,s){const l=i.barHeight,c=l+i.barGap,d=i.topPadding,h=i.leftPadding;(0,o.BYU)().domain([0,f.length]).range(["#00B9FA","#F95002"]).interpolate(o.JHv);(function(t,e,n,s,o,l,c,u){const d=l.reduce(((t,{startTime:e})=>t?Math.min(t,e):e),0),h=l.reduce(((t,{endTime:e})=>t?Math.max(t,e):e),0),m=r.db.getDateFormat();if(!d||!h)return;const f=[];let y=null,g=a()(d);for(;g.valueOf()<=h;)r.db.isInvalidDate(g,m,c,u)?y?y.end=g.clone():y={start:g.clone(),end:g.clone()}:y&&(f.push(y),y=null),g.add(1,"d");_.append("g").selectAll("rect").data(f).enter().append("rect").attr("id",(function(t){return"exclude-"+t.start.format("YYYY-MM-DD")})).attr("x",(function(t){return p(t.start)+n})).attr("y",i.gridLineStartPadding).attr("width",(function(t){const e=t.end.clone().add(1,"day");return p(e)-p(t.start)})).attr("height",o-e-i.gridLineStartPadding).attr("transform-origin",(function(e,r){return(p(e.start)+n+.5*(p(e.end)-p(e.start))).toString()+"px "+(r*t+.5*o).toString()+"px"})).attr("class","exclude-range")})(c,d,h,0,s,t,r.db.getExcludes(),r.db.getIncludes()),function(t,e,n,a){let s=(0,o.LLu)(p).tickSize(-a+e+i.gridLineStartPadding).tickFormat((0,o.i$Z)(r.db.getAxisFormat()||i.axisFormat||"%Y-%m-%d"));const l=/^([1-9]\d*)(minute|hour|day|week|month)$/.exec(r.db.getTickInterval()||i.tickInterval);if(null!==l){const t=l[1];switch(l[2]){case"minute":s.ticks(o.Z_i.every(t));break;case"hour":s.ticks(o.WQD.every(t));break;case"day":s.ticks(o.rr1.every(t));break;case"week":s.ticks(o.NGh.every(t));break;case"month":s.ticks(o.F0B.every(t))}}if(_.append("g").attr("class","grid").attr("transform","translate("+t+", "+(a-50)+")").call(s).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10).attr("dy","1em"),r.db.topAxisEnabled()||i.topAxis){let n=(0,o.F5q)(p).tickSize(-a+e+i.gridLineStartPadding).tickFormat((0,o.i$Z)(r.db.getAxisFormat()||i.axisFormat||"%Y-%m-%d"));if(null!==l){const t=l[1];switch(l[2]){case"minute":n.ticks(o.Z_i.every(t));break;case"hour":n.ticks(o.WQD.every(t));break;case"day":n.ticks(o.rr1.every(t));break;case"week":n.ticks(o.NGh.every(t));break;case"month":n.ticks(o.F0B.every(t))}}_.append("g").attr("class","grid").attr("transform","translate("+t+", "+e+")").call(n).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10)}}(h,d,0,s),function(t,n,a,s,l,c,u){_.append("g").selectAll("rect").data(t).enter().append("rect").attr("x",0).attr("y",(function(t,e){return t.order*n+a-2})).attr("width",(function(){return u-i.rightPadding/2})).attr("height",n).attr("class",(function(t){for(const[e,n]of f.entries())if(t.type===n)return"section section"+e%i.numberSectionStyles;return"section section0"}));const d=_.append("g").selectAll("rect").data(t).enter(),h=r.db.getLinks();d.append("rect").attr("id",(function(t){return t.id})).attr("rx",3).attr("ry",3).attr("x",(function(t){return t.milestone?p(t.startTime)+s+.5*(p(t.endTime)-p(t.startTime))-.5*l:p(t.startTime)+s})).attr("y",(function(t,e){return t.order*n+a})).attr("width",(function(t){return t.milestone?l:p(t.renderEndTime||t.endTime)-p(t.startTime)})).attr("height",l).attr("transform-origin",(function(t,e){return e=t.order,(p(t.startTime)+s+.5*(p(t.endTime)-p(t.startTime))).toString()+"px "+(e*n+a+.5*l).toString()+"px"})).attr("class",(function(t){const e="task";let n="";t.classes.length>0&&(n=t.classes.join(" "));let r=0;for(const[s,o]of f.entries())t.type===o&&(r=s%i.numberSectionStyles);let a="";return t.active?t.crit?a+=" activeCrit":a=" active":t.done?a=t.crit?" doneCrit":" done":t.crit&&(a+=" crit"),0===a.length&&(a=" task"),t.milestone&&(a=" milestone "+a),a+=r,a+=" "+n,e+a})),d.append("text").attr("id",(function(t){return t.id+"-text"})).text((function(t){return t.task})).attr("font-size",i.fontSize).attr("x",(function(t){let e=p(t.startTime),n=p(t.renderEndTime||t.endTime);t.milestone&&(e+=.5*(p(t.endTime)-p(t.startTime))-.5*l),t.milestone&&(n=e+l);const r=this.getBBox().width;return r>n-e?n+r+1.5*i.leftPadding>u?e+s-5:n+s+5:(n-e)/2+e+s})).attr("y",(function(t,e){return t.order*n+i.barHeight/2+(i.fontSize/2-2)+a})).attr("text-height",l).attr("class",(function(t){const e=p(t.startTime);let n=p(t.endTime);t.milestone&&(n=e+l);const r=this.getBBox().width;let a="";t.classes.length>0&&(a=t.classes.join(" "));let s=0;for(const[l,c]of f.entries())t.type===c&&(s=l%i.numberSectionStyles);let o="";return t.active&&(o=t.crit?"activeCritText"+s:"activeText"+s),t.done?o=t.crit?o+" doneCritText"+s:o+" doneText"+s:t.crit&&(o=o+" critText"+s),t.milestone&&(o+=" milestoneText"),r>n-e?n+r+1.5*i.leftPadding>u?a+" taskTextOutsideLeft taskTextOutside"+s+" "+o:a+" taskTextOutsideRight taskTextOutside"+s+" "+o+" width-"+r:a+" taskText taskText"+s+" "+o+" width-"+r}));if("sandbox"===ar().securityLevel){let t;t=(0,o.Ys)("#i"+e);const n=t.nodes()[0].contentDocument;d.filter((function(t){return void 0!==h[t.id]})).each((function(t){var e=n.querySelector("#"+t.id),r=n.querySelector("#"+t.id+"-text");const i=e.parentNode;var a=n.createElement("a");a.setAttribute("xlink:href",h[t.id]),a.setAttribute("target","_top"),i.appendChild(a),a.appendChild(e),a.appendChild(r)}))}}(t,c,d,h,l,0,n),function(t,e){const n=[];let r=0;for(const[i,a]of f.entries())n[i]=[a,g(a,y)];_.append("g").selectAll("text").data(n).enter().append((function(t){const e=t[0].split(Pt.lineBreakRegex),n=-(e.length-1)/2,r=u.createElementNS("http://www.w3.org/2000/svg","text");r.setAttribute("dy",n+"em");for(const[i,a]of e.entries()){const t=u.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttribute("alignment-baseline","central"),t.setAttribute("x","10"),i>0&&t.setAttribute("dy","1em"),t.textContent=a,r.appendChild(t)}return r})).attr("x",10).attr("y",(function(i,a){if(!(a>0))return i[1]*t/2+e;for(let s=0;s<a;s++)return r+=n[a-1][1],i[1]*t/2+r*t+e})).attr("font-size",i.sectionFontSize).attr("font-size",i.sectionFontSize).attr("class",(function(t){for(const[e,n]of f.entries())if(t[0]===n)return"sectionTitle sectionTitle"+e%i.numberSectionStyles;return"sectionTitle"}))}(c,d),function(t,e,n,a){const s=r.db.getTodayMarker();if("off"===s)return;const o=_.append("g").attr("class","today"),l=new Date,c=o.append("line");c.attr("x1",p(l)+t).attr("x2",p(l)+t).attr("y1",i.titleTopMargin).attr("y2",a-i.titleTopMargin).attr("class","today"),""!==s&&c.attr("style",s.replace(/,/g,";"))}(h,0,0,s)}(h,sc,m),hr(_,m,sc,i.useMaxWidth),_.append("text").text(r.db.getDiagramTitle()).attr("x",sc/2).attr("y",i.titleTopMargin).attr("class","titleText")}};var lc=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[6,9,10],r={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,r,i,a,s){switch(a.length,i){case 1:return r;case 4:break;case 6:r.setInfo(!0)}},table:[{3:1,4:[1,2]},{1:[3]},e(n,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},e(n,[2,3]),e(n,[2,4]),e(n,[2,5]),e(n,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},i=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return 4;case 1:return 9;case 2:return"space";case 3:return 10;case 4:return 6;case 5:return"TXT"}},rules:[/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5],inclusive:!0}}},t);function a(){this.yy={}}return r.lexer=i,a.prototype=r,r.Parser=a,new a}();lc.parser=lc;const cc=lc;var uc="",dc=!1;const hc={setMessage:t=>{St.debug("Setting message to: "+t),uc=t},getMessage:()=>uc,setInfo:t=>{dc=t},getInfo:()=>dc,clear:Ar},mc={draw:(t,e,n)=>{try{St.debug("Rendering info diagram\n"+t);const r=ar().securityLevel;let i;"sandbox"===r&&(i=(0,o.Ys)("#i"+e));const a=("sandbox"===r?(0,o.Ys)(i.nodes()[0].contentDocument.body):(0,o.Ys)("body")).select("#"+e);a.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size","32px").style("text-anchor","middle").text("v "+n),a.attr("height",100),a.attr("width",400)}catch(r){St.error("Error while rendering info diagram"),St.error(r.message)}}},_c=t=>null!==t.match(/^\s*info/);var pc=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,4],r=[1,5],i=[1,6],a=[1,7],s=[1,9],o=[1,11,13,15,17,19,20,26,27,28,29],l=[2,5],c=[1,6,11,13,15,17,19,20,26,27,28,29],u=[26,27,28],d=[2,8],h=[1,18],m=[1,19],_=[1,20],p=[1,21],f=[1,22],y=[1,23],g=[1,28],b=[6,26,27,28,29],k={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,PIE:6,document:7,showData:8,line:9,statement:10,txt:11,value:12,title:13,title_value:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,openDirective:21,typeDirective:22,closeDirective:23,":":24,argDirective:25,NEWLINE:26,";":27,EOF:28,open_directive:29,type_directive:30,arg_directive:31,close_directive:32,$accept:0,$end:1},terminals_:{2:"error",6:"PIE",8:"showData",11:"txt",12:"value",13:"title",14:"title_value",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",24:":",26:"NEWLINE",27:";",28:"EOF",29:"open_directive",30:"type_directive",31:"arg_directive",32:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[21,1],[22,1],[25,1],[23,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:r.setShowData(!0);break;case 7:this.$=a[o-1];break;case 9:r.addSection(a[o-1],r.cleanupValue(a[o]));break;case 10:this.$=a[o].trim(),r.setDiagramTitle(this.$);break;case 11:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 12:case 13:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 14:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 21:r.parseDirective("%%{","open_directive");break;case 22:r.parseDirective(a[o],"type_directive");break;case 23:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 24:r.parseDirective("}%%","close_directive","pie")}},table:[{3:1,4:2,5:3,6:n,21:8,26:r,27:i,28:a,29:s},{1:[3]},{3:10,4:2,5:3,6:n,21:8,26:r,27:i,28:a,29:s},{3:11,4:2,5:3,6:n,21:8,26:r,27:i,28:a,29:s},e(o,l,{7:12,8:[1,13]}),e(c,[2,18]),e(c,[2,19]),e(c,[2,20]),{22:14,30:[1,15]},{30:[2,21]},{1:[2,1]},{1:[2,2]},e(u,d,{21:8,9:16,10:17,5:24,1:[2,3],11:h,13:m,15:_,17:p,19:f,20:y,29:s}),e(o,l,{7:25}),{23:26,24:[1,27],32:g},e([24,32],[2,22]),e(o,[2,6]),{4:29,26:r,27:i,28:a},{12:[1,30]},{14:[1,31]},{16:[1,32]},{18:[1,33]},e(u,[2,13]),e(u,[2,14]),e(u,[2,15]),e(u,d,{21:8,9:16,10:17,5:24,1:[2,4],11:h,13:m,15:_,17:p,19:f,20:y,29:s}),e(b,[2,16]),{25:34,31:[1,35]},e(b,[2,24]),e(o,[2,7]),e(u,[2,9]),e(u,[2,10]),e(u,[2,11]),e(u,[2,12]),{23:36,32:g},{32:[2,23]},e(b,[2,17])],defaultActions:{9:[2,21],10:[2,1],11:[2,2],35:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},v=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),29;case 1:return this.begin("type_directive"),30;case 2:return this.popState(),this.begin("arg_directive"),24;case 3:return this.popState(),this.popState(),32;case 4:return 31;case 5:case 6:case 8:case 9:break;case 7:return 26;case 10:return this.begin("title"),13;case 11:return this.popState(),"title_value";case 12:return this.begin("acc_title"),15;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),17;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:case 20:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:this.begin("string");break;case 21:return"txt";case 22:return 6;case 23:return 8;case 24:return"value";case 25:return 28}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?:showData\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},title:{rules:[11],inclusive:!1},string:{rules:[20,21],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,12,14,16,19,22,23,24,25],inclusive:!0}}},t);function x(){this.yy={}}return k.lexer=v,x.prototype=k,k.Parser=x,new x}();pc.parser=pc;const fc=pc,yc=t=>null!==t.match(/^\s*pie/)||null!==t.match(/^\s*bar/);let gc={},bc=!1;const kc={parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().pie,addSection:function(t,e){t=Pt.sanitizeText(t,ar()),void 0===gc[t]&&(gc[t]=e,St.debug("Added new section :",t))},getSections:()=>gc,cleanupValue:function(t){return":"===t.substring(0,1)?(t=t.substring(1).trim(),Number(t.trim())):Number(t.trim())},clear:function(){gc={},bc=!1,Ar()},setAccTitle:Or,getAccTitle:Nr,setDiagramTitle:Ir,getDiagramTitle:Pr,setShowData:function(t){bc=t},getShowData:function(){return bc},getAccDescription:Fr,setAccDescription:Br};let vc,xc=ar();const Mc=450,Lc={draw:(t,e,n,r)=>{try{xc=ar(),St.debug("Rendering info diagram\n"+t);const n=ar().securityLevel;let f;"sandbox"===n&&(f=(0,o.Ys)("#i"+e));const y="sandbox"===n?(0,o.Ys)(f.nodes()[0].contentDocument.body):(0,o.Ys)("body"),g="sandbox"===n?f.nodes()[0].contentDocument:document;r.db.clear(),r.parser.parse(t),St.debug("Parsed info diagram");const b=g.getElementById(e);vc=b.parentElement.offsetWidth,void 0===vc&&(vc=1200),void 0!==xc.useWidth&&(vc=xc.useWidth),void 0!==xc.pie.useWidth&&(vc=xc.pie.useWidth);const k=y.select("#"+e);hr(k,Mc,vc,xc.pie.useMaxWidth),b.setAttribute("viewBox","0 0 "+vc+" "+Mc);var i=18,a=Math.min(vc,Mc)/2-40,s=k.append("g").attr("transform","translate("+vc/2+",225)"),l=r.db.getSections(),c=0;Object.keys(l).forEach((function(t){c+=l[t]}));const v=xc.themeVariables;var u=[v.pie1,v.pie2,v.pie3,v.pie4,v.pie5,v.pie6,v.pie7,v.pie8,v.pie9,v.pie10,v.pie11,v.pie12],d=(0,o.PKp)().range(u),h=Object.entries(l).map((function(t,e){return{order:e,name:t[0],value:t[1]}})),m=(0,o.ve8)().value((function(t){return t.value})).sort((function(t,e){return t.order-e.order}))(h),_=(0,o.Nb1)().innerRadius(0).outerRadius(a);s.selectAll("mySlices").data(m).enter().append("path").attr("d",_).attr("fill",(function(t){return d(t.data.name)})).attr("class","pieCircle"),s.selectAll("mySlices").data(m).enter().append("text").text((function(t){return(t.data.value/c*100).toFixed(0)+"%"})).attr("transform",(function(t){return"translate("+_.centroid(t)+")"})).style("text-anchor","middle").attr("class","slice"),s.append("text").text(r.db.getDiagramTitle()).attr("x",0).attr("y",-200).attr("class","pieTitleText");var p=s.selectAll(".legend").data(d.domain()).enter().append("g").attr("class","legend").attr("transform",(function(t,e){return"translate(216,"+(22*e-22*d.domain().length/2)+")"}));p.append("rect").attr("width",i).attr("height",i).style("fill",d).style("stroke",d),p.data(m).append("text").attr("x",22).attr("y",14).text((function(t){return r.db.getShowData()||xc.showData||xc.pie.showData?t.data.name+" ["+t.data.value+"]":t.data.name}))}catch(f){St.error("Error while rendering info diagram"),St.error(f)}}};var wc=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,3],r=[1,5],i=[1,6],a=[1,7],s=[1,8],o=[5,6,8,14,16,18,19,40,41,42,43,44,45,53,71,72],l=[1,22],c=[2,13],u=[1,26],d=[1,27],h=[1,28],m=[1,29],_=[1,30],p=[1,31],f=[1,24],y=[1,32],g=[1,33],b=[1,36],k=[71,72],v=[5,8,14,16,18,19,40,41,42,43,44,45,53,60,62,71,72],x=[1,56],M=[1,57],L=[1,58],w=[1,59],T=[1,60],S=[1,61],D=[1,62],Y=[62,63],E=[1,74],C=[1,70],A=[1,71],O=[1,72],N=[1,73],B=[1,75],F=[1,79],I=[1,80],P=[1,77],j=[1,78],R=[5,8,14,16,18,19,40,41,42,43,44,45,53,71,72],H={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,openDirective:9,typeDirective:10,closeDirective:11,":":12,argDirective:13,acc_title:14,acc_title_value:15,acc_descr:16,acc_descr_value:17,acc_descr_multiline_value:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,requirementDef:23,elementDef:24,relationshipDef:25,requirementType:26,requirementName:27,STRUCT_START:28,requirementBody:29,ID:30,COLONSEP:31,id:32,TEXT:33,text:34,RISK:35,riskLevel:36,VERIFYMTHD:37,verifyType:38,STRUCT_STOP:39,REQUIREMENT:40,FUNCTIONAL_REQUIREMENT:41,INTERFACE_REQUIREMENT:42,PERFORMANCE_REQUIREMENT:43,PHYSICAL_REQUIREMENT:44,DESIGN_CONSTRAINT:45,LOW_RISK:46,MED_RISK:47,HIGH_RISK:48,VERIFY_ANALYSIS:49,VERIFY_DEMONSTRATION:50,VERIFY_INSPECTION:51,VERIFY_TEST:52,ELEMENT:53,elementName:54,elementBody:55,TYPE:56,type:57,DOCREF:58,ref:59,END_ARROW_L:60,relationship:61,LINE:62,END_ARROW_R:63,CONTAINS:64,COPIES:65,DERIVES:66,SATISFIES:67,VERIFIES:68,REFINES:69,TRACES:70,unqString:71,qString:72,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",12:":",14:"acc_title",15:"acc_title_value",16:"acc_descr",17:"acc_descr_value",18:"acc_descr_multiline_value",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",28:"STRUCT_START",30:"ID",31:"COLONSEP",33:"TEXT",35:"RISK",37:"VERIFYMTHD",39:"STRUCT_STOP",40:"REQUIREMENT",41:"FUNCTIONAL_REQUIREMENT",42:"INTERFACE_REQUIREMENT",43:"PERFORMANCE_REQUIREMENT",44:"PHYSICAL_REQUIREMENT",45:"DESIGN_CONSTRAINT",46:"LOW_RISK",47:"MED_RISK",48:"HIGH_RISK",49:"VERIFY_ANALYSIS",50:"VERIFY_DEMONSTRATION",51:"VERIFY_INSPECTION",52:"VERIFY_TEST",53:"ELEMENT",56:"TYPE",58:"DOCREF",60:"END_ARROW_L",62:"LINE",63:"END_ARROW_R",64:"CONTAINS",65:"COPIES",66:"DERIVES",67:"SATISFIES",68:"VERIFIES",69:"REFINES",70:"TRACES",71:"unqString",72:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,3],[4,5],[4,2],[4,2],[4,1],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[23,5],[29,5],[29,5],[29,5],[29,5],[29,2],[29,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[36,1],[36,1],[36,1],[38,1],[38,1],[38,1],[38,1],[24,5],[55,5],[55,5],[55,2],[55,1],[25,5],[25,5],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[27,1],[27,1],[32,1],[32,1],[34,1],[34,1],[54,1],[54,1],[57,1],[57,1],[59,1],[59,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 6:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 7:case 8:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 9:r.parseDirective("%%{","open_directive");break;case 10:r.parseDirective(a[o],"type_directive");break;case 11:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 12:r.parseDirective("}%%","close_directive","pie");break;case 13:this.$=[];break;case 19:r.addRequirement(a[o-3],a[o-4]);break;case 20:r.setNewReqId(a[o-2]);break;case 21:r.setNewReqText(a[o-2]);break;case 22:r.setNewReqRisk(a[o-2]);break;case 23:r.setNewReqVerifyMethod(a[o-2]);break;case 26:this.$=r.RequirementType.REQUIREMENT;break;case 27:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 28:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 29:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 30:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 32:this.$=r.RiskLevel.LOW_RISK;break;case 33:this.$=r.RiskLevel.MED_RISK;break;case 34:this.$=r.RiskLevel.HIGH_RISK;break;case 35:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 36:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 37:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 38:this.$=r.VerifyType.VERIFY_TEST;break;case 39:r.addElement(a[o-3]);break;case 40:r.setNewElementType(a[o-2]);break;case 41:r.setNewElementDocRef(a[o-2]);break;case 44:r.addRelationship(a[o-2],a[o],a[o-4]);break;case 45:r.addRelationship(a[o-2],a[o-4],a[o]);break;case 46:this.$=r.Relationships.CONTAINS;break;case 47:this.$=r.Relationships.COPIES;break;case 48:this.$=r.Relationships.DERIVES;break;case 49:this.$=r.Relationships.SATISFIES;break;case 50:this.$=r.Relationships.VERIFIES;break;case 51:this.$=r.Relationships.REFINES;break;case 52:this.$=r.Relationships.TRACES}},table:[{3:1,4:2,6:n,9:4,14:r,16:i,18:a,19:s},{1:[3]},{3:10,4:2,5:[1,9],6:n,9:4,14:r,16:i,18:a,19:s},{5:[1,11]},{10:12,20:[1,13]},{15:[1,14]},{17:[1,15]},e(o,[2,8]),{20:[2,9]},{3:16,4:2,6:n,9:4,14:r,16:i,18:a,19:s},{1:[2,2]},{4:21,5:l,7:17,8:c,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:u,41:d,42:h,43:m,44:_,45:p,53:f,71:y,72:g},{11:34,12:[1,35],22:b},e([12,22],[2,10]),e(o,[2,6]),e(o,[2,7]),{1:[2,1]},{8:[1,37]},{4:21,5:l,7:38,8:c,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:u,41:d,42:h,43:m,44:_,45:p,53:f,71:y,72:g},{4:21,5:l,7:39,8:c,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:u,41:d,42:h,43:m,44:_,45:p,53:f,71:y,72:g},{4:21,5:l,7:40,8:c,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:u,41:d,42:h,43:m,44:_,45:p,53:f,71:y,72:g},{4:21,5:l,7:41,8:c,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:u,41:d,42:h,43:m,44:_,45:p,53:f,71:y,72:g},{4:21,5:l,7:42,8:c,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:u,41:d,42:h,43:m,44:_,45:p,53:f,71:y,72:g},{27:43,71:[1,44],72:[1,45]},{54:46,71:[1,47],72:[1,48]},{60:[1,49],62:[1,50]},e(k,[2,26]),e(k,[2,27]),e(k,[2,28]),e(k,[2,29]),e(k,[2,30]),e(k,[2,31]),e(v,[2,55]),e(v,[2,56]),e(o,[2,4]),{13:51,21:[1,52]},e(o,[2,12]),{1:[2,3]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{8:[2,17]},{8:[2,18]},{28:[1,53]},{28:[2,53]},{28:[2,54]},{28:[1,54]},{28:[2,59]},{28:[2,60]},{61:55,64:x,65:M,66:L,67:w,68:T,69:S,70:D},{61:63,64:x,65:M,66:L,67:w,68:T,69:S,70:D},{11:64,22:b},{22:[2,11]},{5:[1,65]},{5:[1,66]},{62:[1,67]},e(Y,[2,46]),e(Y,[2,47]),e(Y,[2,48]),e(Y,[2,49]),e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),{63:[1,68]},e(o,[2,5]),{5:E,29:69,30:C,33:A,35:O,37:N,39:B},{5:F,39:I,55:76,56:P,58:j},{32:81,71:y,72:g},{32:82,71:y,72:g},e(R,[2,19]),{31:[1,83]},{31:[1,84]},{31:[1,85]},{31:[1,86]},{5:E,29:87,30:C,33:A,35:O,37:N,39:B},e(R,[2,25]),e(R,[2,39]),{31:[1,88]},{31:[1,89]},{5:F,39:I,55:90,56:P,58:j},e(R,[2,43]),e(R,[2,44]),e(R,[2,45]),{32:91,71:y,72:g},{34:92,71:[1,93],72:[1,94]},{36:95,46:[1,96],47:[1,97],48:[1,98]},{38:99,49:[1,100],50:[1,101],51:[1,102],52:[1,103]},e(R,[2,24]),{57:104,71:[1,105],72:[1,106]},{59:107,71:[1,108],72:[1,109]},e(R,[2,42]),{5:[1,110]},{5:[1,111]},{5:[2,57]},{5:[2,58]},{5:[1,112]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[1,113]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[2,38]},{5:[1,114]},{5:[2,61]},{5:[2,62]},{5:[1,115]},{5:[2,63]},{5:[2,64]},{5:E,29:116,30:C,33:A,35:O,37:N,39:B},{5:E,29:117,30:C,33:A,35:O,37:N,39:B},{5:E,29:118,30:C,33:A,35:O,37:N,39:B},{5:E,29:119,30:C,33:A,35:O,37:N,39:B},{5:F,39:I,55:120,56:P,58:j},{5:F,39:I,55:121,56:P,58:j},e(R,[2,20]),e(R,[2,21]),e(R,[2,22]),e(R,[2,23]),e(R,[2,40]),e(R,[2,41])],defaultActions:{8:[2,9],10:[2,2],16:[2,1],37:[2,3],38:[2,14],39:[2,15],40:[2,16],41:[2,17],42:[2,18],44:[2,53],45:[2,54],47:[2,59],48:[2,60],52:[2,11],93:[2,57],94:[2,58],96:[2,32],97:[2,33],98:[2,34],100:[2,35],101:[2,36],102:[2,37],103:[2,38],105:[2,61],106:[2,62],108:[2,63],109:[2,64]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},$=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),19;case 1:return this.begin("type_directive"),20;case 2:return this.popState(),this.begin("arg_directive"),12;case 3:return this.popState(),this.popState(),22;case 4:return 21;case 5:return"title";case 6:return this.begin("acc_title"),14;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),16;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 53:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 5;case 14:case 15:case 16:break;case 17:return 8;case 18:return 6;case 19:return 28;case 20:return 39;case 21:return 31;case 22:return 30;case 23:return 33;case 24:return 35;case 25:return 37;case 26:return 40;case 27:return 41;case 28:return 42;case 29:return 43;case 30:return 44;case 31:return 45;case 32:return 46;case 33:return 47;case 34:return 48;case 35:return 49;case 36:return 50;case 37:return 51;case 38:return 52;case 39:return 53;case 40:return 64;case 41:return 65;case 42:return 66;case 43:return 67;case 44:return 68;case 45:return 69;case 46:return 70;case 47:return 56;case 48:return 58;case 49:return 60;case 50:return 63;case 51:return 62;case 52:this.begin("string");break;case 54:return"qString";case 55:return e.yytext=e.yytext.trim(),71}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^\r\n\{\<\>\-\=]*)/i],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},unqString:{rules:[],inclusive:!1},token:{rules:[],inclusive:!1},string:{rules:[53,54],inclusive:!1},INITIAL:{rules:[0,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55],inclusive:!0}}},t);function Z(){this.yy={}}return H.lexer=$,Z.prototype=H,H.Parser=Z,new Z}();wc.parser=wc;const Tc=wc,Sc=t=>null!==t.match(/^\s*requirement(Diagram)?/);let Dc=[],Yc={},Ec={},Cc={},Ac={};const Oc={RequirementType:{REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},RiskLevel:{LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},VerifyType:{VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},Relationships:{CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().req,addRequirement:(t,e)=>(void 0===Ec[t]&&(Ec[t]={name:t,type:e,id:Yc.id,text:Yc.text,risk:Yc.risk,verifyMethod:Yc.verifyMethod}),Yc={},Ec[t]),getRequirements:()=>Ec,setNewReqId:t=>{void 0!==Yc&&(Yc.id=t)},setNewReqText:t=>{void 0!==Yc&&(Yc.text=t)},setNewReqRisk:t=>{void 0!==Yc&&(Yc.risk=t)},setNewReqVerifyMethod:t=>{void 0!==Yc&&(Yc.verifyMethod=t)},setAccTitle:Or,getAccTitle:Nr,setAccDescription:Br,getAccDescription:Fr,addElement:t=>(void 0===Ac[t]&&(Ac[t]={name:t,type:Cc.type,docRef:Cc.docRef},St.info("Added new requirement: ",t)),Cc={},Ac[t]),getElements:()=>Ac,setNewElementType:t=>{void 0!==Cc&&(Cc.type=t)},setNewElementDocRef:t=>{void 0!==Cc&&(Cc.docRef=t)},addRelationship:(t,e,n)=>{Dc.push({type:t,src:e,dst:n})},getRelationships:()=>Dc,clear:()=>{Dc=[],Yc={},Ec={},Cc={},Ac={},Ar()}},Nc={CONTAINS:"contains",ARROW:"arrow"},Bc=Nc,Fc=(t,e)=>{let n=t.append("defs").append("marker").attr("id",Nc.CONTAINS+"_line_ending").attr("refX",0).attr("refY",e.line_height/2).attr("markerWidth",e.line_height).attr("markerHeight",e.line_height).attr("orient","auto").append("g");n.append("circle").attr("cx",e.line_height/2).attr("cy",e.line_height/2).attr("r",e.line_height/2).attr("fill","none"),n.append("line").attr("x1",0).attr("x2",e.line_height).attr("y1",e.line_height/2).attr("y2",e.line_height/2).attr("stroke-width",1),n.append("line").attr("y1",0).attr("y2",e.line_height).attr("x1",e.line_height/2).attr("x2",e.line_height/2).attr("stroke-width",1),t.append("defs").append("marker").attr("id",Nc.ARROW+"_line_ending").attr("refX",e.line_height).attr("refY",.5*e.line_height).attr("markerWidth",e.line_height).attr("markerHeight",e.line_height).attr("orient","auto").append("path").attr("d",`M0,0\n L${e.line_height},${e.line_height/2}\n M${e.line_height},${e.line_height/2}\n L0,${e.line_height}`).attr("stroke-width",1)};let Ic={},Pc=0;const jc=(t,e)=>t.insert("rect","#"+e).attr("class","req reqBox").attr("x",0).attr("y",0).attr("width",Ic.rect_min_width+"px").attr("height",Ic.rect_min_height+"px"),Rc=(t,e,n)=>{let r=Ic.rect_min_width/2,i=t.append("text").attr("class","req reqLabel reqTitle").attr("id",e).attr("x",r).attr("y",Ic.rect_padding).attr("dominant-baseline","hanging"),a=0;n.forEach((t=>{0==a?i.append("tspan").attr("text-anchor","middle").attr("x",Ic.rect_min_width/2).attr("dy",0).text(t):i.append("tspan").attr("text-anchor","middle").attr("x",Ic.rect_min_width/2).attr("dy",.75*Ic.line_height).text(t),a++}));let s=1.5*Ic.rect_padding+a*Ic.line_height*.75;return t.append("line").attr("class","req-title-line").attr("x1","0").attr("x2",Ic.rect_min_width).attr("y1",s).attr("y2",s),{titleNode:i,y:s}},Hc=(t,e,n,r)=>{let i=t.append("text").attr("class","req reqLabel").attr("id",e).attr("x",Ic.rect_padding).attr("y",r).attr("dominant-baseline","hanging"),a=0;let s=[];return n.forEach((t=>{let e=t.length;for(;e>30&&a<3;){let n=t.substring(0,30);e=(t=t.substring(30,t.length)).length,s[s.length]=n,a++}if(3==a){let t=s[s.length-1];s[s.length-1]=t.substring(0,t.length-4)+"..."}else s[s.length]=t;a=0})),s.forEach((t=>{i.append("tspan").attr("x",Ic.rect_padding).attr("dy",Ic.line_height).text(t)})),i},$c=function(t,e,n,r,i){const a=n.edge(Zc(e.src),Zc(e.dst)),s=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})),l=t.insert("path","#"+r).attr("class","er relationshipLine").attr("d",s(a.points)).attr("fill","none");e.type==i.db.Relationships.CONTAINS?l.attr("marker-start","url("+Pt.getUrl(Ic.arrowMarkerAbsolute)+"#"+e.type+"_line_ending)"):(l.attr("stroke-dasharray","10,7"),l.attr("marker-end","url("+Pt.getUrl(Ic.arrowMarkerAbsolute)+"#"+Bc.ARROW+"_line_ending)")),((t,e,n,r)=>{const i=e.node().getTotalLength(),a=e.node().getPointAtLength(.5*i),s="rel"+Pc;Pc++;const o=t.append("text").attr("class","req relationshipLabel").attr("id",s).attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","middle").text(r).node().getBBox();t.insert("rect","#"+s).attr("class","req reqLabelBox").attr("x",a.x-o.width/2).attr("y",a.y-o.height/2).attr("width",o.width).attr("height",o.height).attr("fill","white").attr("fill-opacity","85%")})(t,l,0,`<<${e.type}>>`)},Zc=t=>t.replace(/\s/g,"").replace(/\./g,"_"),Wc={draw:(t,e,n,r)=>{Ic=ar().requirement,r.db.clear(),r.parser.parse(t);const i=Ic.securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s=("sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body")).select(`[id='${e}']`);Fc(s,Ic);const l=new ut.k({multigraph:!1,compound:!1,directed:!0}).setGraph({rankdir:Ic.layoutDirection,marginx:20,marginy:20,nodesep:100,edgesep:100,ranksep:100}).setDefaultEdgeLabel((function(){return{}}));let c=r.db.getRequirements(),u=r.db.getElements(),d=r.db.getRelationships();var h,m,_;h=c,m=l,_=s,Object.keys(h).forEach((t=>{let e=h[t];t=Zc(t),St.info("Added new requirement: ",t);const n=_.append("g").attr("id",t),r=jc(n,"req-"+t);let i=Rc(n,t+"_title",[`<<${e.type}>>`,`${e.name}`]);Hc(n,t+"_body",[`Id: ${e.id}`,`Text: ${e.text}`,`Risk: ${e.risk}`,`Verification: ${e.verifyMethod}`],i.y);const a=r.node().getBBox();m.setNode(t,{width:a.width,height:a.height,shape:"rect",id:t})})),((t,e,n)=>{Object.keys(t).forEach((r=>{let i=t[r];const a=Zc(r),s=n.append("g").attr("id",a),o="element-"+a,l=jc(s,o);let c=Rc(s,o+"_title",["<<Element>>",`${r}`]);Hc(s,o+"_body",[`Type: ${i.type||"Not Specified"}`,`Doc Ref: ${i.docRef||"None"}`],c.y);const u=l.node().getBBox();e.setNode(a,{width:u.width,height:u.height,shape:"rect",id:a})}))})(u,l,s),((t,e)=>{t.forEach((function(t){let n=Zc(t.src),r=Zc(t.dst);e.setEdge(n,r,{relationship:t})}))})(d,l),(0,ct.bK)(l),function(t,e){e.nodes().forEach((function(n){void 0!==n&&void 0!==e.node(n)&&(t.select("#"+n),t.select("#"+n).attr("transform","translate("+(e.node(n).x-e.node(n).width/2)+","+(e.node(n).y-e.node(n).height/2)+" )"))}))}(s,l),d.forEach((function(t){$c(s,t,l,e,r)}));const p=Ic.rect_padding,f=s.node().getBBox(),y=f.width+2*p,g=f.height+2*p;hr(s,g,y,Ic.useMaxWidth),s.attr("viewBox",`${f.x-p} ${f.y-p} ${y} ${g}`)}};var zc=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,3],i=[1,5],a=[1,7],s=[2,5],o=[1,15],l=[1,17],c=[1,19],u=[1,21],d=[1,22],h=[1,23],m=[1,29],_=[1,30],p=[1,31],f=[1,32],y=[1,33],g=[1,34],b=[1,35],k=[1,36],v=[1,37],x=[1,38],M=[1,39],L=[1,40],w=[1,42],T=[1,43],S=[1,45],D=[1,46],Y=[1,47],E=[1,48],C=[1,49],A=[1,50],O=[1,53],N=[1,4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,51,52,53,54,56,57,62,63,64,65,73,83],B=[4,5,21,54,56],F=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,54,56,57,62,63,64,65,73,83],I=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,53,54,56,57,62,63,64,65,73,83],P=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,52,54,56,57,62,63,64,65,73,83],j=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,51,54,56,57,62,63,64,65,73,83],R=[71,72,73],H=[1,125],$=[1,4,5,7,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,51,52,53,54,56,57,62,63,64,65,73,83],Z={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,directive:6,SD:7,document:8,line:9,statement:10,box_section:11,box_line:12,participant_statement:13,openDirective:14,typeDirective:15,closeDirective:16,":":17,argDirective:18,box:19,restOfLine:20,end:21,signal:22,autonumber:23,NUM:24,off:25,activate:26,actor:27,deactivate:28,note_statement:29,links_statement:30,link_statement:31,properties_statement:32,details_statement:33,title:34,legacy_title:35,acc_title:36,acc_title_value:37,acc_descr:38,acc_descr_value:39,acc_descr_multiline_value:40,loop:41,rect:42,opt:43,alt:44,else_sections:45,par:46,par_sections:47,critical:48,option_sections:49,break:50,option:51,and:52,else:53,participant:54,AS:55,participant_actor:56,note:57,placement:58,text2:59,over:60,actor_pair:61,links:62,link:63,properties:64,details:65,spaceList:66,",":67,left_of:68,right_of:69,signaltype:70,"+":71,"-":72,ACTOR:73,SOLID_OPEN_ARROW:74,DOTTED_OPEN_ARROW:75,SOLID_ARROW:76,DOTTED_ARROW:77,SOLID_CROSS:78,DOTTED_CROSS:79,SOLID_POINT:80,DOTTED_POINT:81,TXT:82,open_directive:83,type_directive:84,arg_directive:85,close_directive:86,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",7:"SD",17:":",19:"box",20:"restOfLine",21:"end",23:"autonumber",24:"NUM",25:"off",26:"activate",28:"deactivate",34:"title",35:"legacy_title",36:"acc_title",37:"acc_title_value",38:"acc_descr",39:"acc_descr_value",40:"acc_descr_multiline_value",41:"loop",42:"rect",43:"opt",44:"alt",46:"par",48:"critical",50:"break",51:"option",52:"and",53:"else",54:"participant",55:"AS",56:"participant_actor",57:"note",60:"over",62:"links",63:"link",64:"properties",65:"details",67:",",68:"left_of",69:"right_of",71:"+",72:"-",73:"ACTOR",74:"SOLID_OPEN_ARROW",75:"DOTTED_OPEN_ARROW",76:"SOLID_ARROW",77:"DOTTED_ARROW",78:"SOLID_CROSS",79:"DOTTED_CROSS",80:"SOLID_POINT",81:"DOTTED_POINT",82:"TXT",83:"open_directive",84:"type_directive",85:"arg_directive",86:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[11,0],[11,2],[12,2],[12,1],[12,1],[6,4],[6,6],[10,1],[10,4],[10,2],[10,4],[10,3],[10,3],[10,2],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,2],[10,2],[10,1],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[49,1],[49,4],[47,1],[47,4],[45,1],[45,4],[13,5],[13,3],[13,5],[13,3],[29,4],[29,4],[30,3],[31,3],[32,3],[33,3],[66,2],[66,1],[61,3],[61,1],[58,1],[58,1],[22,5],[22,5],[22,4],[27,1],[70,1],[70,1],[70,1],[70,1],[70,1],[70,1],[70,1],[70,1],[59,1],[14,1],[15,1],[18,1],[16,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:return r.apply(a[o]),a[o];case 5:case 10:case 9:case 14:this.$=[];break;case 6:case 11:a[o-1].push(a[o]),this.$=a[o-1];break;case 7:case 8:case 12:case 13:case 63:this.$=a[o];break;case 18:a[o-1].unshift({type:"boxStart",boxData:r.parseBoxData(a[o-2])}),a[o-1].push({type:"boxEnd",boxText:a[o-2]}),this.$=a[o-1];break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(a[o-2]),sequenceIndexStep:Number(a[o-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceIndex:Number(a[o-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 24:this.$={type:"activeStart",signalType:r.LINETYPE.ACTIVE_START,actor:a[o-1]};break;case 25:this.$={type:"activeEnd",signalType:r.LINETYPE.ACTIVE_END,actor:a[o-1]};break;case 31:r.setDiagramTitle(a[o].substring(6)),this.$=a[o].substring(6);break;case 32:r.setDiagramTitle(a[o].substring(7)),this.$=a[o].substring(7);break;case 33:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 34:case 35:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 36:a[o-1].unshift({type:"loopStart",loopText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.LOOP_START}),a[o-1].push({type:"loopEnd",loopText:a[o-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[o-1];break;case 37:a[o-1].unshift({type:"rectStart",color:r.parseMessage(a[o-2]),signalType:r.LINETYPE.RECT_START}),a[o-1].push({type:"rectEnd",color:r.parseMessage(a[o-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[o-1];break;case 38:a[o-1].unshift({type:"optStart",optText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.OPT_START}),a[o-1].push({type:"optEnd",optText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[o-1];break;case 39:a[o-1].unshift({type:"altStart",altText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.ALT_START}),a[o-1].push({type:"altEnd",signalType:r.LINETYPE.ALT_END}),this.$=a[o-1];break;case 40:a[o-1].unshift({type:"parStart",parText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.PAR_START}),a[o-1].push({type:"parEnd",signalType:r.LINETYPE.PAR_END}),this.$=a[o-1];break;case 41:a[o-1].unshift({type:"criticalStart",criticalText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.CRITICAL_START}),a[o-1].push({type:"criticalEnd",signalType:r.LINETYPE.CRITICAL_END}),this.$=a[o-1];break;case 42:a[o-1].unshift({type:"breakStart",breakText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.BREAK_START}),a[o-1].push({type:"breakEnd",optText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[o-1];break;case 45:this.$=a[o-3].concat([{type:"option",optionText:r.parseMessage(a[o-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[o]]);break;case 47:this.$=a[o-3].concat([{type:"and",parText:r.parseMessage(a[o-1]),signalType:r.LINETYPE.PAR_AND},a[o]]);break;case 49:this.$=a[o-3].concat([{type:"else",altText:r.parseMessage(a[o-1]),signalType:r.LINETYPE.ALT_ELSE},a[o]]);break;case 50:a[o-3].type="addParticipant",a[o-3].description=r.parseMessage(a[o-1]),this.$=a[o-3];break;case 51:a[o-1].type="addParticipant",this.$=a[o-1];break;case 52:a[o-3].type="addActor",a[o-3].description=r.parseMessage(a[o-1]),this.$=a[o-3];break;case 53:a[o-1].type="addActor",this.$=a[o-1];break;case 54:this.$=[a[o-1],{type:"addNote",placement:a[o-2],actor:a[o-1].actor,text:a[o]}];break;case 55:a[o-2]=[].concat(a[o-1],a[o-1]).slice(0,2),a[o-2][0]=a[o-2][0].actor,a[o-2][1]=a[o-2][1].actor,this.$=[a[o-1],{type:"addNote",placement:r.PLACEMENT.OVER,actor:a[o-2].slice(0,2),text:a[o]}];break;case 56:this.$=[a[o-1],{type:"addLinks",actor:a[o-1].actor,text:a[o]}];break;case 57:this.$=[a[o-1],{type:"addALink",actor:a[o-1].actor,text:a[o]}];break;case 58:this.$=[a[o-1],{type:"addProperties",actor:a[o-1].actor,text:a[o]}];break;case 59:this.$=[a[o-1],{type:"addDetails",actor:a[o-1].actor,text:a[o]}];break;case 62:this.$=[a[o-2],a[o]];break;case 64:this.$=r.PLACEMENT.LEFTOF;break;case 65:this.$=r.PLACEMENT.RIGHTOF;break;case 66:this.$=[a[o-4],a[o-1],{type:"addMessage",from:a[o-4].actor,to:a[o-1].actor,signalType:a[o-3],msg:a[o]},{type:"activeStart",signalType:r.LINETYPE.ACTIVE_START,actor:a[o-1]}];break;case 67:this.$=[a[o-4],a[o-1],{type:"addMessage",from:a[o-4].actor,to:a[o-1].actor,signalType:a[o-3],msg:a[o]},{type:"activeEnd",signalType:r.LINETYPE.ACTIVE_END,actor:a[o-4]}];break;case 68:this.$=[a[o-3],a[o-1],{type:"addMessage",from:a[o-3].actor,to:a[o-1].actor,signalType:a[o-2],msg:a[o]}];break;case 69:this.$={type:"addParticipant",actor:a[o]};break;case 70:this.$=r.LINETYPE.SOLID_OPEN;break;case 71:this.$=r.LINETYPE.DOTTED_OPEN;break;case 72:this.$=r.LINETYPE.SOLID;break;case 73:this.$=r.LINETYPE.DOTTED;break;case 74:this.$=r.LINETYPE.SOLID_CROSS;break;case 75:this.$=r.LINETYPE.DOTTED_CROSS;break;case 76:this.$=r.LINETYPE.SOLID_POINT;break;case 77:this.$=r.LINETYPE.DOTTED_POINT;break;case 78:this.$=r.parseMessage(a[o].trim().substring(1));break;case 79:r.parseDirective("%%{","open_directive");break;case 80:r.parseDirective(a[o],"type_directive");break;case 81:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 82:r.parseDirective("}%%","close_directive","sequence")}},table:[{3:1,4:n,5:r,6:4,7:i,14:6,83:a},{1:[3]},{3:8,4:n,5:r,6:4,7:i,14:6,83:a},{3:9,4:n,5:r,6:4,7:i,14:6,83:a},{3:10,4:n,5:r,6:4,7:i,14:6,83:a},e([1,4,5,19,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,54,56,57,62,63,64,65,73,83],s,{8:11}),{15:12,84:[1,13]},{84:[2,79]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{16:51,17:[1,52],86:O},e([17,86],[2,80]),e(N,[2,6]),{6:41,10:54,13:18,14:6,19:c,22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},e(N,[2,8]),e(N,[2,9]),e(N,[2,17]),{20:[1,55]},{5:[1,56]},{5:[1,59],24:[1,57],25:[1,58]},{27:60,73:A},{27:61,73:A},{5:[1,62]},{5:[1,63]},{5:[1,64]},{5:[1,65]},{5:[1,66]},e(N,[2,31]),e(N,[2,32]),{37:[1,67]},{39:[1,68]},e(N,[2,35]),{20:[1,69]},{20:[1,70]},{20:[1,71]},{20:[1,72]},{20:[1,73]},{20:[1,74]},{20:[1,75]},e(N,[2,43]),{27:76,73:A},{27:77,73:A},{70:78,74:[1,79],75:[1,80],76:[1,81],77:[1,82],78:[1,83],79:[1,84],80:[1,85],81:[1,86]},{58:87,60:[1,88],68:[1,89],69:[1,90]},{27:91,73:A},{27:92,73:A},{27:93,73:A},{27:94,73:A},e([5,55,67,74,75,76,77,78,79,80,81,82],[2,69]),{5:[1,95]},{18:96,85:[1,97]},{5:[2,82]},e(N,[2,7]),e(B,[2,10],{11:98}),e(N,[2,19]),{5:[1,100],24:[1,99]},{5:[1,101]},e(N,[2,23]),{5:[1,102]},{5:[1,103]},e(N,[2,26]),e(N,[2,27]),e(N,[2,28]),e(N,[2,29]),e(N,[2,30]),e(N,[2,33]),e(N,[2,34]),e(F,s,{8:104}),e(F,s,{8:105}),e(F,s,{8:106}),e(I,s,{45:107,8:108}),e(P,s,{47:109,8:110}),e(j,s,{49:111,8:112}),e(F,s,{8:113}),{5:[1,115],55:[1,114]},{5:[1,117],55:[1,116]},{27:120,71:[1,118],72:[1,119],73:A},e(R,[2,70]),e(R,[2,71]),e(R,[2,72]),e(R,[2,73]),e(R,[2,74]),e(R,[2,75]),e(R,[2,76]),e(R,[2,77]),{27:121,73:A},{27:123,61:122,73:A},{73:[2,64]},{73:[2,65]},{59:124,82:H},{59:126,82:H},{59:127,82:H},{59:128,82:H},e($,[2,15]),{16:129,86:O},{86:[2,81]},{4:[1,132],5:[1,134],12:131,13:133,21:[1,130],54:w,56:T},{5:[1,135]},e(N,[2,21]),e(N,[2,22]),e(N,[2,24]),e(N,[2,25]),{4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,21:[1,136],22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,21:[1,137],22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,21:[1,138],22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{21:[1,139]},{4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,21:[2,48],22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,53:[1,140],54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{21:[1,141]},{4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,21:[2,46],22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,52:[1,142],54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{21:[1,143]},{4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,21:[2,44],22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,51:[1,144],54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{4:o,5:l,6:41,9:14,10:16,13:18,14:6,19:c,21:[1,145],22:20,23:u,26:d,27:44,28:h,29:24,30:25,31:26,32:27,33:28,34:m,35:_,36:p,38:f,40:y,41:g,42:b,43:k,44:v,46:x,48:M,50:L,54:w,56:T,57:S,62:D,63:Y,64:E,65:C,73:A,83:a},{20:[1,146]},e(N,[2,51]),{20:[1,147]},e(N,[2,53]),{27:148,73:A},{27:149,73:A},{59:150,82:H},{59:151,82:H},{59:152,82:H},{67:[1,153],82:[2,63]},{5:[2,56]},{5:[2,78]},{5:[2,57]},{5:[2,58]},{5:[2,59]},{5:[1,154]},e(N,[2,18]),e(B,[2,11]),{13:155,54:w,56:T},e(B,[2,13]),e(B,[2,14]),e(N,[2,20]),e(N,[2,36]),e(N,[2,37]),e(N,[2,38]),e(N,[2,39]),{20:[1,156]},e(N,[2,40]),{20:[1,157]},e(N,[2,41]),{20:[1,158]},e(N,[2,42]),{5:[1,159]},{5:[1,160]},{59:161,82:H},{59:162,82:H},{5:[2,68]},{5:[2,54]},{5:[2,55]},{27:163,73:A},e($,[2,16]),e(B,[2,12]),e(I,s,{8:108,45:164}),e(P,s,{8:110,47:165}),e(j,s,{8:112,49:166}),e(N,[2,50]),e(N,[2,52]),{5:[2,66]},{5:[2,67]},{82:[2,62]},{21:[2,49]},{21:[2,47]},{21:[2,45]}],defaultActions:{7:[2,79],8:[2,1],9:[2,2],10:[2,3],53:[2,82],89:[2,64],90:[2,65],97:[2,81],124:[2,56],125:[2,78],126:[2,57],127:[2,58],128:[2,59],150:[2,68],151:[2,54],152:[2,55],161:[2,66],162:[2,67],163:[2,62],164:[2,49],165:[2,47],166:[2,45]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},W=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),83;case 1:return this.begin("type_directive"),84;case 2:return this.popState(),this.begin("arg_directive"),17;case 3:return this.popState(),this.popState(),86;case 4:return 85;case 5:case 53:case 66:return 5;case 6:case 7:case 8:case 9:case 10:break;case 11:return 24;case 12:return this.begin("LINE"),19;case 13:return this.begin("ID"),54;case 14:return this.begin("ID"),56;case 15:return e.yytext=e.yytext.trim(),this.begin("ALIAS"),73;case 16:return this.popState(),this.popState(),this.begin("LINE"),55;case 17:return this.popState(),this.popState(),5;case 18:return this.begin("LINE"),41;case 19:return this.begin("LINE"),42;case 20:return this.begin("LINE"),43;case 21:return this.begin("LINE"),44;case 22:return this.begin("LINE"),53;case 23:return this.begin("LINE"),46;case 24:return this.begin("LINE"),52;case 25:return this.begin("LINE"),48;case 26:return this.begin("LINE"),51;case 27:return this.begin("LINE"),50;case 28:return this.popState(),20;case 29:return 21;case 30:return 68;case 31:return 69;case 32:return 62;case 33:return 63;case 34:return 64;case 35:return 65;case 36:return 60;case 37:return 57;case 38:return this.begin("ID"),26;case 39:return this.begin("ID"),28;case 40:return 34;case 41:return 35;case 42:return this.begin("acc_title"),36;case 43:return this.popState(),"acc_title_value";case 44:return this.begin("acc_descr"),38;case 45:return this.popState(),"acc_descr_value";case 46:this.begin("acc_descr_multiline");break;case 47:this.popState();break;case 48:return"acc_descr_multiline_value";case 49:return 7;case 50:return 23;case 51:return 25;case 52:return 67;case 54:return e.yytext=e.yytext.trim(),73;case 55:return 76;case 56:return 77;case 57:return 74;case 58:return 75;case 59:return 78;case 60:return 79;case 61:return 80;case 62:return 81;case 63:return 82;case 64:return 71;case 65:return 72;case 67:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:[^\->:\n,;]+?([\-]*[^\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[47,48],inclusive:!1},acc_descr:{rules:[45],inclusive:!1},acc_title:{rules:[43],inclusive:!1},open_directive:{rules:[1,8],inclusive:!1},type_directive:{rules:[2,3,8],inclusive:!1},arg_directive:{rules:[3,4,8],inclusive:!1},ID:{rules:[7,8,15],inclusive:!1},ALIAS:{rules:[7,8,16,17],inclusive:!1},LINE:{rules:[7,8,28],inclusive:!1},INITIAL:{rules:[0,5,6,8,9,10,11,12,13,14,18,19,20,21,22,23,24,25,26,27,29,30,31,32,33,34,35,36,37,38,39,40,41,42,44,46,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],inclusive:!0}}},t);function z(){this.yy={}}return Z.lexer=W,z.prototype=Z,Z.Parser=z,new z}();zc.parser=zc;const Uc=zc,qc=t=>null!==t.match(/^\s*sequenceDiagram/);let Vc,Gc,Jc,Xc={},Kc=[],Qc=[],tu=!1;const eu=function(t,e,n,r){let i=Jc;const a=Xc[t];if(a){if(Jc&&a.box&&Jc!==a.box)throw new Error("A same participant should only be defined in one Box: "+a.name+" can't be in '"+a.box.name+"' and in '"+Jc.name+"' at the same time.");if(i=a.box?a.box:Jc,a.box=i,a&&e===a.name&&null==n)return}null!=n&&null!=n.text||(n={text:e,wrap:null,type:r}),null!=r&&null!=n.text||(n={text:e,wrap:null,type:r}),Xc[t]={box:i,name:e,description:n.text,wrap:void 0===n.wrap&&iu()||!!n.wrap,prevActor:Vc,links:{},properties:{},actorCnt:null,rectData:null,type:r||"participant"},Vc&&Xc[Vc]&&(Xc[Vc].nextActor=t),Jc&&Jc.actorKeys.push(t),Vc=t},nu=function(t,e,n={text:void 0,wrap:void 0},r){if(r===au.ACTIVE_END){const e=(t=>{let e,n=0;for(e=0;e<Qc.length;e++)Qc[e].type===au.ACTIVE_START&&Qc[e].from.actor===t&&n++,Qc[e].type===au.ACTIVE_END&&Qc[e].from.actor===t&&n--;return n})(t.actor);if(e<1){let e=new Error("Trying to inactivate an inactive participant ("+t.actor+")");throw e.hash={text:"->>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},e}}return Qc.push({from:t,to:e,message:n.text,wrap:void 0===n.wrap&&iu()||!!n.wrap,type:r}),!0},ru=function(t){return Xc[t]},iu=()=>void 0!==Gc?Gc:ar().sequence.wrap,au={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31},su=function(t,e,n){n.text,void 0===n.wrap&&iu()||n.wrap;const r=[].concat(t,t);Qc.push({from:r[0],to:r[1],message:n.text,wrap:void 0===n.wrap&&iu()||!!n.wrap,type:au.NOTE,placement:e})},ou=function(t,e){const n=ru(t);try{let t=At(e.text,ar());t=t.replace(/&/g,"&"),t=t.replace(/=/g,"=");lu(n,JSON.parse(t))}catch(r){St.error("error while parsing actor link text",r)}};function lu(t,e){if(null==t.links)t.links=e;else for(let n in e)t.links[n]=e[n]}const cu=function(t,e){const n=ru(t);try{let t=At(e.text,ar());uu(n,JSON.parse(t))}catch(r){St.error("error while parsing actor properties text",r)}};function uu(t,e){if(null==t.properties)t.properties=e;else for(let n in e)t.properties[n]=e[n]}const du=function(t,e){const n=ru(t),r=document.getElementById(e.text);try{const t=r.innerHTML,e=JSON.parse(t);e.properties&&uu(n,e.properties),e.links&&lu(n,e.links)}catch(i){St.error("error while parsing actor details text",i)}},hu=function(t){if(Array.isArray(t))t.forEach((function(t){hu(t)}));else switch(t.type){case"sequenceIndex":Qc.push({from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible},wrap:!1,type:t.signalType});break;case"addParticipant":eu(t.actor,t.actor,t.description,"participant");break;case"addActor":eu(t.actor,t.actor,t.description,"actor");break;case"activeStart":case"activeEnd":nu(t.actor,void 0,void 0,t.signalType);break;case"addNote":su(t.actor,t.placement,t.text);break;case"addLinks":ou(t.actor,t.text);break;case"addALink":!function(t,e){const n=ru(t);try{const t={};let s=At(e.text,ar());var r=s.indexOf("@");s=s.replace(/&/g,"&"),s=s.replace(/=/g,"=");var i=s.slice(0,r-1).trim(),a=s.slice(r+1).trim();t[i]=a,lu(n,t)}catch(s){St.error("error while parsing actor link text",s)}}(t.actor,t.text);break;case"addProperties":cu(t.actor,t.text);break;case"addDetails":du(t.actor,t.text);break;case"addMessage":nu(t.from,t.to,t.msg,t.signalType);break;case"boxStart":e=t.boxData,Kc.push({name:e.text,wrap:void 0===e.wrap&&iu()||!!e.wrap,fill:e.color,actorKeys:[]}),Jc=Kc.slice(-1)[0];break;case"boxEnd":Jc=void 0;break;case"loopStart":nu(void 0,void 0,t.loopText,t.signalType);break;case"loopEnd":case"rectEnd":case"optEnd":case"altEnd":case"parEnd":case"criticalEnd":case"breakEnd":nu(void 0,void 0,void 0,t.signalType);break;case"rectStart":nu(void 0,void 0,t.color,t.signalType);break;case"optStart":nu(void 0,void 0,t.optText,t.signalType);break;case"altStart":case"else":nu(void 0,void 0,t.altText,t.signalType);break;case"setAccTitle":Or(t.text);break;case"parStart":case"and":nu(void 0,void 0,t.parText,t.signalType);break;case"criticalStart":nu(void 0,void 0,t.criticalText,t.signalType);break;case"option":nu(void 0,void 0,t.optionText,t.signalType);break;case"breakStart":nu(void 0,void 0,t.breakText,t.signalType)}var e},mu={addActor:eu,addMessage:function(t,e,n,r){Qc.push({from:t,to:e,message:n.text,wrap:void 0===n.wrap&&iu()||!!n.wrap,answer:r})},addSignal:nu,addLinks:ou,addDetails:du,addProperties:cu,autoWrap:iu,setWrap:function(t){Gc=t},enableSequenceNumbers:function(){tu=!0},disableSequenceNumbers:function(){tu=!1},showSequenceNumbers:()=>tu,getMessages:function(){return Qc},getActors:function(){return Xc},getActor:ru,getActorKeys:function(){return Object.keys(Xc)},getActorProperty:function(t,e){if(void 0!==t&&void 0!==t.properties)return t.properties[e]},getAccTitle:Nr,getBoxes:function(){return Kc},getDiagramTitle:Pr,setDiagramTitle:Ir,parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().sequence,clear:function(){Xc={},Kc=[],Qc=[],tu=!1,Ar()},parseMessage:function(t){const e=t.trim(),n={text:e.replace(/^:?(?:no)?wrap:/,"").trim(),wrap:null!==e.match(/^:?wrap:/)||null===e.match(/^:?nowrap:/)&&void 0};return St.debug("parseMessage:",n),n},parseBoxData:function(t){const e=t.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/);let n=null!=e&&e[1]?e[1].trim():"transparent",r=null!=e&&e[2]?e[2].trim():void 0;if(window&&window.CSS)window.CSS.supports("color",n)||(n="transparent",r=t.trim());else{const e=(new Option).style;e.color=n,e.color!==n&&(n="transparent",r=t.trim())}return{color:n,text:void 0!==r?At(r.replace(/^:?(?:no)?wrap:/,""),ar()):void 0,wrap:void 0!==r?null!==r.match(/^:?wrap:/)||null===r.match(/^:?nowrap:/)&&void 0:void 0}},LINETYPE:au,ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},addNote:su,setAccTitle:Or,apply:hu,setAccDescription:Br,getAccDescription:Fr,hasAtLeastOneBox:function(){return Kc.length>0},hasAtLeastOneBoxWithTitle:function(){return Kc.some((t=>t.name))}};let _u=[];const pu=()=>{_u.forEach((t=>{t()})),_u=[]},fu=function(t,e){const n=t.append("rect");return n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),void 0!==e.class&&n.attr("class",e.class),n},yu=(t,e)=>{var n;n=()=>{const n=document.querySelectorAll(t);0!==n.length&&(n[0].addEventListener("mouseover",(function(){ku("actor"+e+"_popup")})),n[0].addEventListener("mouseout",(function(){vu("actor"+e+"_popup")})))},_u.push(n)},gu=function(t,e,n,r){const i=t.append("image");i.attr("x",e),i.attr("y",n);var a=(0,s.N)(r);i.attr("xlink:href",a)},bu=function(t,e,n,r){const i=t.append("use");i.attr("x",e),i.attr("y",n);var a=(0,s.N)(r);i.attr("xlink:href","#"+a)},ku=function(t){var e=document.getElementById(t);null!=e&&(e.style.display="block")},vu=function(t){var e=document.getElementById(t);null!=e&&(e.style.display="none")},xu=function(t,e){let n=0,r=0;const i=e.text.split(Pt.lineBreakRegex),[a,s]=Vn(e.fontSize);let o=[],l=0,c=()=>e.y;if(void 0!==e.valign&&void 0!==e.textMargin&&e.textMargin>0)switch(e.valign){case"top":case"start":c=()=>Math.round(e.y+e.textMargin);break;case"middle":case"center":c=()=>Math.round(e.y+(n+r+e.textMargin)/2);break;case"bottom":case"end":c=()=>Math.round(e.y+(n+r+2*e.textMargin)-e.textMargin)}if(void 0!==e.anchor&&void 0!==e.textMargin&&void 0!==e.width)switch(e.anchor){case"left":case"start":e.x=Math.round(e.x+e.textMargin),e.anchor="start",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"middle":case"center":e.x=Math.round(e.x+e.width/2),e.anchor="middle",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"right":case"end":e.x=Math.round(e.x+e.width-e.textMargin),e.anchor="end",e.dominantBaseline="middle",e.alignmentBaseline="middle"}for(let[u,d]of i.entries()){void 0!==e.textMargin&&0===e.textMargin&&void 0!==a&&(l=u*a);const i=t.append("text");if(i.attr("x",e.x),i.attr("y",c()),void 0!==e.anchor&&i.attr("text-anchor",e.anchor).attr("dominant-baseline",e.dominantBaseline).attr("alignment-baseline",e.alignmentBaseline),void 0!==e.fontFamily&&i.style("font-family",e.fontFamily),void 0!==s&&i.style("font-size",s),void 0!==e.fontWeight&&i.style("font-weight",e.fontWeight),void 0!==e.fill&&i.attr("fill",e.fill),void 0!==e.class&&i.attr("class",e.class),void 0!==e.dy?i.attr("dy",e.dy):0!==l&&i.attr("dy",l),e.tspan){const t=i.append("tspan");t.attr("x",e.x),void 0!==e.fill&&t.attr("fill",e.fill),t.text(d)}else i.text(d);void 0!==e.valign&&void 0!==e.textMargin&&e.textMargin>0&&(r+=(i._groups||i)[0][0].getBBox().height,n=r),o.push(i)}return o},Mu=function(t,e){const n=t.append("polygon");var r,i,a,s,o;return n.attr("points",(r=e.x,i=e.y,a=e.width,s=e.height,r+","+i+" "+(r+a)+","+i+" "+(r+a)+","+(i+s-(o=7))+" "+(r+a-1.2*o)+","+(i+s)+" "+r+","+(i+s))),n.attr("class","labelBox"),e.y=e.y+e.height/2,xu(t,e),n};let Lu=-1;const wu=(t,e)=>{t.selectAll&&t.selectAll(".actor-line").attr("class","200").attr("y2",e-55)},Tu=function(t,e){fu(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"}).lower()},Su=function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},Du=function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},Yu=function(){function t(t,e,n,i,a,s,o){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("text-anchor","middle").text(t),o)}function e(t,e,n,i,a,s,o,l){const{actorFontSize:c,actorFontFamily:u,actorFontWeight:d}=l,[h,m]=Vn(c),_=t.split(Pt.lineBreakRegex);for(let p=0;p<_.length;p++){const t=p*h-h*(_.length-1)/2,l=e.append("text").attr("x",n+a/2).attr("y",i).style("text-anchor","middle").style("font-size",m).style("font-weight",d).style("font-family",u);l.append("tspan").attr("x",n+a/2).attr("dy",t).text(_[p]),l.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(l,o)}}function n(t,n,i,a,s,o,l,c){const u=n.append("switch"),d=u.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,u,i,a,s,o,l,c),r(d,l)}function r(t,e){for(const n in e)e.hasOwnProperty(n)&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),Eu=function(){function t(t,e,n,i,a,s,o){r(e.append("text").attr("x",n).attr("y",i).style("text-anchor","start").text(t),o)}function e(t,e,n,i,a,s,o,l){const{actorFontSize:c,actorFontFamily:u,actorFontWeight:d}=l,h=t.split(Pt.lineBreakRegex);for(let m=0;m<h.length;m++){const t=m*c-c*(h.length-1)/2,a=e.append("text").attr("x",n).attr("y",i).style("text-anchor","start").style("font-size",c).style("font-weight",d).style("font-family",u);a.append("tspan").attr("x",n).attr("dy",t).text(h[m]),a.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(a,o)}}function n(t,n,i,a,s,o,l,c){const u=n.append("switch"),d=u.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,u,i,a,0,o,l,c),r(d,l)}function r(t,e){for(const n in e)e.hasOwnProperty(n)&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),Cu={drawRect:fu,drawText:xu,drawLabel:Mu,drawActor:function(t,e,n,r){switch(e.type){case"actor":return function(t,e,n,r){const i=e.x+e.width/2,a=e.y+80;r||(Lu++,t.append("line").attr("id","actor"+Lu).attr("x1",i).attr("y1",a).attr("x2",i).attr("y2",2e3).attr("class","actor-line").attr("stroke-width","0.5px").attr("stroke","#999"));const s=t.append("g");s.attr("class","actor-man");const o=Du();o.x=e.x,o.y=e.y,o.fill="#eaeaea",o.width=e.width,o.height=e.height,o.class="actor",o.rx=3,o.ry=3,s.append("line").attr("id","actor-man-torso"+Lu).attr("x1",i).attr("y1",e.y+25).attr("x2",i).attr("y2",e.y+45),s.append("line").attr("id","actor-man-arms"+Lu).attr("x1",i-18).attr("y1",e.y+33).attr("x2",i+18).attr("y2",e.y+33),s.append("line").attr("x1",i-18).attr("y1",e.y+60).attr("x2",i).attr("y2",e.y+45),s.append("line").attr("x1",i).attr("y1",e.y+45).attr("x2",i+16).attr("y2",e.y+60);const l=s.append("circle");l.attr("cx",e.x+e.width/2),l.attr("cy",e.y+10),l.attr("r",15),l.attr("width",e.width),l.attr("height",e.height);const c=s.node().getBBox();return e.height=c.height,Yu(n)(e.description,s,o.x,o.y+35,o.width,o.height,{class:"actor"},n),e.height}(t,e,n,r);case"participant":return function(t,e,n,r){const i=e.x+e.width/2,a=e.y+5,s=t.append("g");var o=s;r||(Lu++,o.append("line").attr("id","actor"+Lu).attr("x1",i).attr("y1",a).attr("x2",i).attr("y2",2e3).attr("class","actor-line").attr("stroke-width","0.5px").attr("stroke","#999"),o=s.append("g"),e.actorCnt=Lu,null!=e.links&&(o.attr("id","root-"+Lu),yu("#root-"+Lu,Lu)));const l=Du();var c="actor";null!=e.properties&&e.properties.class?c=e.properties.class:l.fill="#eaeaea",l.x=e.x,l.y=e.y,l.width=e.width,l.height=e.height,l.class=c,l.rx=3,l.ry=3;const u=fu(o,l);if(e.rectData=l,null!=e.properties&&e.properties.icon){const t=e.properties.icon.trim();"@"===t.charAt(0)?bu(o,l.x+l.width-20,l.y+10,t.substr(1)):gu(o,l.x+l.width-20,l.y+10,t)}Yu(n)(e.description,o,l.x,l.y,l.width,l.height,{class:"actor"},n);let d=e.height;if(u.node){const t=u.node().getBBox();e.height=t.height,d=t.height}return d}(t,e,n,r)}},drawBox:function(t,e,n){const r=t.append("g");Tu(r,e),e.name&&Yu(n)(e.name,r,e.x,e.y+(e.textMaxHeight||0)/2,e.width,0,{class:"text"},n),r.lower()},drawPopup:function(t,e,n,r,i){if(void 0===e.links||null===e.links||0===Object.keys(e.links).length)return{height:0,width:0};const a=e.links,o=e.actorCnt,l=e.rectData;var c="none";i&&(c="block !important");const u=t.append("g");u.attr("id","actor"+o+"_popup"),u.attr("class","actorPopupMenu"),u.attr("display",c),yu("#actor"+o+"_popup",o);var d="";void 0!==l.class&&(d=" "+l.class);let h=l.width>n?l.width:n;const m=u.append("rect");if(m.attr("class","actorPopupMenuPanel"+d),m.attr("x",l.x),m.attr("y",l.height),m.attr("fill",l.fill),m.attr("stroke",l.stroke),m.attr("width",h),m.attr("height",l.height),m.attr("rx",l.rx),m.attr("ry",l.ry),null!=a){var _=20;for(let t in a){var p=u.append("a"),f=(0,s.N)(a[t]);p.attr("xlink:href",f),p.attr("target","_blank"),Eu(r)(t,p,l.x+10,l.height+_,h,20,{class:"actor"},r),_+=30}}return m.attr("height",_),{height:l.height+_,width:h}},drawImage:gu,drawEmbeddedImage:bu,anchorElement:function(t){return t.append("g")},drawActivation:function(t,e,n,r,i){const a=Du(),s=e.anchored;a.x=e.startx,a.y=e.starty,a.class="activation"+i%3,a.width=e.stopx-e.startx,a.height=n-e.starty,fu(s,a)},drawLoop:function(t,e,n,r){const{boxMargin:i,boxTextMargin:a,labelBoxHeight:s,labelBoxWidth:o,messageFontFamily:l,messageFontSize:c,messageFontWeight:u}=r,d=t.append("g"),h=function(t,e,n,r){return d.append("line").attr("x1",t).attr("y1",e).attr("x2",n).attr("y2",r).attr("class","loopLine")};h(e.startx,e.starty,e.stopx,e.starty),h(e.stopx,e.starty,e.stopx,e.stopy),h(e.startx,e.stopy,e.stopx,e.stopy),h(e.startx,e.starty,e.startx,e.stopy),void 0!==e.sections&&e.sections.forEach((function(t){h(e.startx,t.y,e.stopx,t.y).style("stroke-dasharray","3, 3")}));let m=Su();m.text=n,m.x=e.startx,m.y=e.starty,m.fontFamily=l,m.fontSize=c,m.fontWeight=u,m.anchor="middle",m.valign="middle",m.tspan=!1,m.width=o||50,m.height=s||20,m.textMargin=a,m.class="labelText",Mu(d,m),m=Su(),m.text=e.title,m.x=e.startx+o/2+(e.stopx-e.startx)/2,m.y=e.starty+i+a,m.anchor="middle",m.valign="middle",m.textMargin=a,m.class="loopText",m.fontFamily=l,m.fontSize=c,m.fontWeight=u,m.wrap=!0;let _=xu(d,m);return void 0!==e.sectionTitles&&e.sectionTitles.forEach((function(t,n){if(t.message){m.text=t.message,m.x=e.startx+(e.stopx-e.startx)/2,m.y=e.sections[n].y+i+a,m.class="loopText",m.anchor="middle",m.valign="middle",m.tspan=!1,m.fontFamily=l,m.fontSize=c,m.fontWeight=u,m.wrap=e.wrap,_=xu(d,m);let r=Math.round(_.map((t=>(t._groups||t)[0][0].getBBox().height)).reduce(((t,e)=>t+e)));e.sections[n].height+=r-(i+a)}})),e.height=Math.round(e.stopy-e.starty),d},drawBackgroundRect:Tu,insertArrowHead:function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},insertArrowFilledHead:function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},insertSequenceNumber:function(t){t.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},insertArrowCrossHead:function(t){t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},insertDatabaseIcon:function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},insertComputerIcon:function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},insertClockIcon:function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},getTextObj:Su,getNoteRect:Du,popupMenu:function(t){return"var pu = document.getElementById('"+t+"'); if (pu != null) { pu.style.display = 'block'; }"},popdownMenu:function(t){return"var pu = document.getElementById('"+t+"'); if (pu != null) { pu.style.display = 'none'; }"},fixLifeLineHeights:wu,sanitizeUrl:s.N};let Au={};const Ou={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],activations:[],models:{getHeight:function(){return Math.max.apply(null,0===this.actors.length?[0]:this.actors.map((t=>t.height||0)))+(0===this.loops.length?0:this.loops.map((t=>t.height||0)).reduce(((t,e)=>t+e)))+(0===this.messages.length?0:this.messages.map((t=>t.height||0)).reduce(((t,e)=>t+e)))+(0===this.notes.length?0:this.notes.map((t=>t.height||0)).reduce(((t,e)=>t+e)))},clear:function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},addBox:function(t){this.boxes.push(t)},addActor:function(t){this.actors.push(t)},addLoop:function(t){this.loops.push(t)},addMessage:function(t){this.messages.push(t)},addNote:function(t){this.notes.push(t)},lastActor:function(){return this.actors[this.actors.length-1]},lastLoop:function(){return this.loops[this.loops.length-1]},lastMessage:function(){return this.messages[this.messages.length-1]},lastNote:function(){return this.notes[this.notes.length-1]},actors:[],boxes:[],loops:[],messages:[],notes:[]},init:function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,ju(ar())},updateVal:function(t,e,n,r){void 0===t[e]?t[e]=n:t[e]=r(n,t[e])},updateBounds:function(t,e,n,r){const i=this;let a=0;function s(s){return function(o){a++;const l=i.sequenceItems.length-a+1;i.updateVal(o,"starty",e-l*Au.boxMargin,Math.min),i.updateVal(o,"stopy",r+l*Au.boxMargin,Math.max),i.updateVal(Ou.data,"startx",t-l*Au.boxMargin,Math.min),i.updateVal(Ou.data,"stopx",n+l*Au.boxMargin,Math.max),"activation"!==s&&(i.updateVal(o,"startx",t-l*Au.boxMargin,Math.min),i.updateVal(o,"stopx",n+l*Au.boxMargin,Math.max),i.updateVal(Ou.data,"starty",e-l*Au.boxMargin,Math.min),i.updateVal(Ou.data,"stopy",r+l*Au.boxMargin,Math.max))}}this.sequenceItems.forEach(s()),this.activations.forEach(s("activation"))},insert:function(t,e,n,r){const i=Math.min(t,n),a=Math.max(t,n),s=Math.min(e,r),o=Math.max(e,r);this.updateVal(Ou.data,"startx",i,Math.min),this.updateVal(Ou.data,"starty",s,Math.min),this.updateVal(Ou.data,"stopx",a,Math.max),this.updateVal(Ou.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},newActivation:function(t,e,n){const r=n[t.from.actor],i=Ru(t.from.actor).length||0,a=r.x+r.width/2+(i-1)*Au.activationWidth/2;this.activations.push({startx:a,starty:this.verticalPos+2,stopx:a+Au.activationWidth,stopy:void 0,actor:t.from.actor,anchored:Cu.anchorElement(e)})},endActivation:function(t){const e=this.activations.map((function(t){return t.actor})).lastIndexOf(t.from.actor);return this.activations.splice(e,1)[0]},createLoop:function(t={message:void 0,wrap:!1,width:void 0},e){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:t.message,wrap:t.wrap,width:t.width,height:0,fill:e}},newLoop:function(t={message:void 0,wrap:!1,width:void 0},e){this.sequenceItems.push(this.createLoop(t,e))},endLoop:function(){return this.sequenceItems.pop()},addSectionToLoop:function(t){const e=this.sequenceItems.pop();e.sections=e.sections||[],e.sectionTitles=e.sectionTitles||[],e.sections.push({y:Ou.getVerticalPos(),height:0}),e.sectionTitles.push(t),this.sequenceItems.push(e)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return{bounds:this.data,models:this.models}}},Nu=t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),Bu=t=>({fontFamily:t.noteFontFamily,fontSize:t.noteFontSize,fontWeight:t.noteFontWeight}),Fu=t=>({fontFamily:t.actorFontFamily,fontSize:t.actorFontSize,fontWeight:t.actorFontWeight});const Iu=function(t,e,n,r,i,a,s){if(!0===i.hideUnusedParticipants){const t=new Set;a.forEach((e=>{t.add(e.from),t.add(e.to)})),n=n.filter((e=>t.has(e)))}let o,l=0,c=0,u=0;for(const d of n){const n=e[d],i=n.box;o&&o!=i&&(s||Ou.models.addBox(o),c+=Au.boxMargin+o.margin),i&&i!=o&&(s||(i.x=l+c,i.y=r),c+=i.margin),n.width=n.width||Au.width,n.height=Math.max(n.height||Au.height,Au.height),n.margin=n.margin||Au.actorMargin,n.x=l+c,n.y=Ou.getVerticalPos();const a=Cu.drawActor(t,n,Au,s);u=Math.max(u,a),Ou.insert(n.x,r,n.x+n.width,n.height),l+=n.width+c,n.box&&(n.box.width=l+i.margin-n.box.x),c=n.margin,o=n.box,Ou.models.addActor(n)}o&&!s&&Ou.models.addBox(o),Ou.bumpVerticalPos(u)},Pu=function(t,e,n,r){let i=0,a=0;for(const s of n){const n=e[s],o=Zu(n),l=Cu.drawPopup(t,n,o,Au,Au.forceMenus,r);l.height>i&&(i=l.height),l.width+n.x>a&&(a=l.width+n.x)}return{maxHeight:i,maxWidth:a}},ju=function(t){Sn(Au,t),t.fontFamily&&(Au.actorFontFamily=Au.noteFontFamily=Au.messageFontFamily=t.fontFamily),t.fontSize&&(Au.actorFontSize=Au.noteFontSize=Au.messageFontSize=t.fontSize),t.fontWeight&&(Au.actorFontWeight=Au.noteFontWeight=Au.messageFontWeight=t.fontWeight)},Ru=function(t){return Ou.activations.filter((function(e){return e.actor===t}))},Hu=function(t,e){const n=e[t],r=Ru(t);return[r.reduce((function(t,e){return Math.min(t,e.startx)}),n.x+n.width/2),r.reduce((function(t,e){return Math.max(t,e.stopx)}),n.x+n.width/2)]};function $u(t,e,n,r,i){Ou.bumpVerticalPos(n);let a=r;if(e.id&&e.message&&t[e.id]){const n=t[e.id].width,i=Nu(Au);e.message=Gn.wrapLabel(`[${e.message}]`,n-2*Au.wrapPadding,i),e.width=n,e.wrap=!0;const s=Gn.calculateTextDimensions(e.message,i),o=Math.max(s.height,Au.labelBoxHeight);a=r+o,St.debug(`${o} - ${e.message}`)}i(e),Ou.bumpVerticalPos(a)}const Zu=function(t){let e=0;const n=Fu(Au);for(const r in t.links){const t=Gn.calculateTextDimensions(r,n).width+2*Au.wrapPadding+2*Au.boxMargin;e<t&&(e=t)}return e};const Wu=function(t,e,n,r){const i={},a=[];let s,o,l;return t.forEach((function(t){switch(t.id=Gn.random({length:10}),t.type){case r.db.LINETYPE.LOOP_START:case r.db.LINETYPE.ALT_START:case r.db.LINETYPE.OPT_START:case r.db.LINETYPE.PAR_START:case r.db.LINETYPE.CRITICAL_START:case r.db.LINETYPE.BREAK_START:a.push({id:t.id,msg:t.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case r.db.LINETYPE.ALT_ELSE:case r.db.LINETYPE.PAR_AND:case r.db.LINETYPE.CRITICAL_OPTION:t.message&&(s=a.pop(),i[s.id]=s,i[t.id]=s,a.push(s));break;case r.db.LINETYPE.LOOP_END:case r.db.LINETYPE.ALT_END:case r.db.LINETYPE.OPT_END:case r.db.LINETYPE.PAR_END:case r.db.LINETYPE.CRITICAL_END:case r.db.LINETYPE.BREAK_END:s=a.pop(),i[s.id]=s;break;case r.db.LINETYPE.ACTIVE_START:{const n=e[t.from?t.from.actor:t.to.actor],r=Ru(t.from?t.from.actor:t.to.actor).length,i=n.x+n.width/2+(r-1)*Au.activationWidth/2,a={startx:i,stopx:i+Au.activationWidth,actor:t.from.actor,enabled:!0};Ou.activations.push(a)}break;case r.db.LINETYPE.ACTIVE_END:{const e=Ou.activations.map((t=>t.actor)).lastIndexOf(t.from.actor);delete Ou.activations.splice(e,1)[0]}}void 0!==t.placement?(o=function(t,e,n){const r=e[t.from].x,i=e[t.to].x,a=t.wrap&&t.message;let s=Gn.calculateTextDimensions(a?Gn.wrapLabel(t.message,Au.width,Bu(Au)):t.message,Bu(Au));const o={width:a?Au.width:Math.max(Au.width,s.width+2*Au.noteMargin),height:0,startx:e[t.from].x,stopx:0,starty:0,stopy:0,message:t.message};return t.placement===n.db.PLACEMENT.RIGHTOF?(o.width=a?Math.max(Au.width,s.width):Math.max(e[t.from].width/2+e[t.to].width/2,s.width+2*Au.noteMargin),o.startx=r+(e[t.from].width+Au.actorMargin)/2):t.placement===n.db.PLACEMENT.LEFTOF?(o.width=a?Math.max(Au.width,s.width+2*Au.noteMargin):Math.max(e[t.from].width/2+e[t.to].width/2,s.width+2*Au.noteMargin),o.startx=r-o.width+(e[t.from].width-Au.actorMargin)/2):t.to===t.from?(s=Gn.calculateTextDimensions(a?Gn.wrapLabel(t.message,Math.max(Au.width,e[t.from].width),Bu(Au)):t.message,Bu(Au)),o.width=a?Math.max(Au.width,e[t.from].width):Math.max(e[t.from].width,Au.width,s.width+2*Au.noteMargin),o.startx=r+(e[t.from].width-o.width)/2):(o.width=Math.abs(r+e[t.from].width/2-(i+e[t.to].width/2))+Au.actorMargin,o.startx=r<i?r+e[t.from].width/2-Au.actorMargin/2:i+e[t.to].width/2-Au.actorMargin/2),a&&(o.message=Gn.wrapLabel(t.message,o.width-2*Au.wrapPadding,Bu(Au))),St.debug(`NM:[${o.startx},${o.stopx},${o.starty},${o.stopy}:${o.width},${o.height}=${t.message}]`),o}(t,e,r),t.noteModel=o,a.forEach((t=>{s=t,s.from=Math.min(s.from,o.startx),s.to=Math.max(s.to,o.startx+o.width),s.width=Math.max(s.width,Math.abs(s.from-s.to))-Au.labelBoxWidth}))):(l=function(t,e,n){let r=!1;if([n.db.LINETYPE.SOLID_OPEN,n.db.LINETYPE.DOTTED_OPEN,n.db.LINETYPE.SOLID,n.db.LINETYPE.DOTTED,n.db.LINETYPE.SOLID_CROSS,n.db.LINETYPE.DOTTED_CROSS,n.db.LINETYPE.SOLID_POINT,n.db.LINETYPE.DOTTED_POINT].includes(t.type)&&(r=!0),!r)return{};const i=Hu(t.from,e),a=Hu(t.to,e),s=i[0]<=a[0]?1:0,o=i[0]<a[0]?0:1,l=[...i,...a],c=Math.abs(a[o]-i[s]);t.wrap&&t.message&&(t.message=Gn.wrapLabel(t.message,Math.max(c+2*Au.wrapPadding,Au.width),Nu(Au)));const u=Gn.calculateTextDimensions(t.message,Nu(Au));return{width:Math.max(t.wrap?0:u.width+2*Au.wrapPadding,c+2*Au.wrapPadding,Au.width),height:0,startx:i[s],stopx:a[o],starty:0,stopy:0,message:t.message,type:t.type,wrap:t.wrap,fromBounds:Math.min.apply(null,l),toBounds:Math.max.apply(null,l)}}(t,e,r),t.msgModel=l,l.startx&&l.stopx&&a.length>0&&a.forEach((n=>{if(s=n,l.startx===l.stopx){const n=e[t.from],r=e[t.to];s.from=Math.min(n.x-l.width/2,n.x-n.width/2,s.from),s.to=Math.max(r.x+l.width/2,r.x+n.width/2,s.to),s.width=Math.max(s.width,Math.abs(s.to-s.from))-Au.labelBoxWidth}else s.from=Math.min(l.startx,s.from),s.to=Math.max(l.stopx,s.to),s.width=Math.max(s.width,l.width)-Au.labelBoxWidth})))})),Ou.activations=[],St.debug("Loop type widths:",i),i},zu={bounds:Ou,drawActors:Iu,drawActorsPopup:Pu,setConf:ju,draw:function(t,e,n,r){const{securityLevel:i,sequence:a}=ar();let s;Au=a,r.db.clear(),r.parser.parse(t),"sandbox"===i&&(s=(0,o.Ys)("#i"+e));const l="sandbox"===i?(0,o.Ys)(s.nodes()[0].contentDocument.body):(0,o.Ys)("body"),c="sandbox"===i?s.nodes()[0].contentDocument:document;Ou.init(),St.debug(r.db);const u="sandbox"===i?l.select(`[id="${e}"]`):(0,o.Ys)(`[id="${e}"]`),d=r.db.getActors(),h=r.db.getBoxes(),m=r.db.getActorKeys(),_=r.db.getMessages(),p=r.db.getDiagramTitle(),f=r.db.hasAtLeastOneBox(),y=r.db.hasAtLeastOneBoxWithTitle(),g=function(t,e,n){const r={};return e.forEach((function(e){if(t[e.to]&&t[e.from]){const i=t[e.to];if(e.placement===n.db.PLACEMENT.LEFTOF&&!i.prevActor)return;if(e.placement===n.db.PLACEMENT.RIGHTOF&&!i.nextActor)return;const a=void 0!==e.placement,s=!a,o=a?Bu(Au):Nu(Au),l=e.wrap?Gn.wrapLabel(e.message,Au.width-2*Au.wrapPadding,o):e.message,c=Gn.calculateTextDimensions(l,o).width+2*Au.wrapPadding;s&&e.from===i.nextActor?r[e.to]=Math.max(r[e.to]||0,c):s&&e.from===i.prevActor?r[e.from]=Math.max(r[e.from]||0,c):s&&e.from===e.to?(r[e.from]=Math.max(r[e.from]||0,c/2),r[e.to]=Math.max(r[e.to]||0,c/2)):e.placement===n.db.PLACEMENT.RIGHTOF?r[e.from]=Math.max(r[e.from]||0,c):e.placement===n.db.PLACEMENT.LEFTOF?r[i.prevActor]=Math.max(r[i.prevActor]||0,c):e.placement===n.db.PLACEMENT.OVER&&(i.prevActor&&(r[i.prevActor]=Math.max(r[i.prevActor]||0,c/2)),i.nextActor&&(r[e.from]=Math.max(r[e.from]||0,c/2)))}})),St.debug("maxMessageWidthPerActor:",r),r}(d,_,r);Au.height=function(t,e,n){let r=0;Object.keys(t).forEach((e=>{const n=t[e];n.wrap&&(n.description=Gn.wrapLabel(n.description,Au.width-2*Au.wrapPadding,Fu(Au)));const i=Gn.calculateTextDimensions(n.description,Fu(Au));n.width=n.wrap?Au.width:Math.max(Au.width,i.width+2*Au.wrapPadding),n.height=n.wrap?Math.max(i.height,Au.height):Au.height,r=Math.max(r,n.height)}));for(const a in e){const n=t[a];if(!n)continue;const r=t[n.nextActor];if(!r){const t=e[a]+Au.actorMargin-n.width/2;n.margin=Math.max(t,Au.actorMargin);continue}const i=e[a]+Au.actorMargin-n.width/2-r.width/2;n.margin=Math.max(i,Au.actorMargin)}let i=0;return n.forEach((e=>{const n=Nu(Au);let r=e.actorKeys.reduce(((e,n)=>e+(t[n].width+(t[n].margin||0))),0);r-=2*Au.boxTextMargin,e.wrap&&(e.name=Gn.wrapLabel(e.name,r-2*Au.wrapPadding,n));const a=Gn.calculateTextDimensions(e.name,n);i=Math.max(a.height,i);const s=Math.max(r,a.width+2*Au.wrapPadding);if(e.margin=Au.boxTextMargin,r<s){const t=(s-r)/2;e.margin+=t}})),n.forEach((t=>t.textMaxHeight=i)),Math.max(r,Au.height)}(d,g,h),Cu.insertComputerIcon(u),Cu.insertDatabaseIcon(u),Cu.insertClockIcon(u),f&&(Ou.bumpVerticalPos(Au.boxMargin),y&&Ou.bumpVerticalPos(h[0].textMaxHeight)),Iu(u,d,m,0,Au,_,!1);const b=Wu(_,d,g,r);Cu.insertArrowHead(u),Cu.insertArrowCrossHead(u),Cu.insertArrowFilledHead(u),Cu.insertSequenceNumber(u);let k=1,v=1;const x=[];_.forEach((function(t){let e,n,i;switch(t.type){case r.db.LINETYPE.NOTE:n=t.noteModel,function(t,e){Ou.bumpVerticalPos(Au.boxMargin),e.height=Au.boxMargin,e.starty=Ou.getVerticalPos();const n=Cu.getNoteRect();n.x=e.startx,n.y=e.starty,n.width=e.width||Au.width,n.class="note";const r=t.append("g"),i=Cu.drawRect(r,n),a=Cu.getTextObj();a.x=e.startx,a.y=e.starty,a.width=n.width,a.dy="1em",a.text=e.message,a.class="noteText",a.fontFamily=Au.noteFontFamily,a.fontSize=Au.noteFontSize,a.fontWeight=Au.noteFontWeight,a.anchor=Au.noteAlign,a.textMargin=Au.noteMargin,a.valign="center";const s=xu(r,a),o=Math.round(s.map((t=>(t._groups||t)[0][0].getBBox().height)).reduce(((t,e)=>t+e)));i.attr("height",o+2*Au.noteMargin),e.height+=o+2*Au.noteMargin,Ou.bumpVerticalPos(o+2*Au.noteMargin),e.stopy=e.starty+o+2*Au.noteMargin,e.stopx=e.startx+n.width,Ou.insert(e.startx,e.starty,e.stopx,e.stopy),Ou.models.addNote(e)}(u,n);break;case r.db.LINETYPE.ACTIVE_START:Ou.newActivation(t,u,d);break;case r.db.LINETYPE.ACTIVE_END:!function(t,e){const n=Ou.endActivation(t);n.starty+18>e&&(n.starty=e-6,e+=12),Cu.drawActivation(u,n,e,Au,Ru(t.from.actor).length),Ou.insert(n.startx,e-10,n.stopx,e)}(t,Ou.getVerticalPos());break;case r.db.LINETYPE.LOOP_START:$u(b,t,Au.boxMargin,Au.boxMargin+Au.boxTextMargin,(t=>Ou.newLoop(t)));break;case r.db.LINETYPE.LOOP_END:e=Ou.endLoop(),Cu.drawLoop(u,e,"loop",Au),Ou.bumpVerticalPos(e.stopy-Ou.getVerticalPos()),Ou.models.addLoop(e);break;case r.db.LINETYPE.RECT_START:$u(b,t,Au.boxMargin,Au.boxMargin,(t=>Ou.newLoop(void 0,t.message)));break;case r.db.LINETYPE.RECT_END:e=Ou.endLoop(),Cu.drawBackgroundRect(u,e),Ou.models.addLoop(e),Ou.bumpVerticalPos(e.stopy-Ou.getVerticalPos());break;case r.db.LINETYPE.OPT_START:$u(b,t,Au.boxMargin,Au.boxMargin+Au.boxTextMargin,(t=>Ou.newLoop(t)));break;case r.db.LINETYPE.OPT_END:e=Ou.endLoop(),Cu.drawLoop(u,e,"opt",Au),Ou.bumpVerticalPos(e.stopy-Ou.getVerticalPos()),Ou.models.addLoop(e);break;case r.db.LINETYPE.ALT_START:$u(b,t,Au.boxMargin,Au.boxMargin+Au.boxTextMargin,(t=>Ou.newLoop(t)));break;case r.db.LINETYPE.ALT_ELSE:$u(b,t,Au.boxMargin+Au.boxTextMargin,Au.boxMargin,(t=>Ou.addSectionToLoop(t)));break;case r.db.LINETYPE.ALT_END:e=Ou.endLoop(),Cu.drawLoop(u,e,"alt",Au),Ou.bumpVerticalPos(e.stopy-Ou.getVerticalPos()),Ou.models.addLoop(e);break;case r.db.LINETYPE.PAR_START:$u(b,t,Au.boxMargin,Au.boxMargin+Au.boxTextMargin,(t=>Ou.newLoop(t)));break;case r.db.LINETYPE.PAR_AND:$u(b,t,Au.boxMargin+Au.boxTextMargin,Au.boxMargin,(t=>Ou.addSectionToLoop(t)));break;case r.db.LINETYPE.PAR_END:e=Ou.endLoop(),Cu.drawLoop(u,e,"par",Au),Ou.bumpVerticalPos(e.stopy-Ou.getVerticalPos()),Ou.models.addLoop(e);break;case r.db.LINETYPE.AUTONUMBER:k=t.message.start||k,v=t.message.step||v,t.message.visible?r.db.enableSequenceNumbers():r.db.disableSequenceNumbers();break;case r.db.LINETYPE.CRITICAL_START:$u(b,t,Au.boxMargin,Au.boxMargin+Au.boxTextMargin,(t=>Ou.newLoop(t)));break;case r.db.LINETYPE.CRITICAL_OPTION:$u(b,t,Au.boxMargin+Au.boxTextMargin,Au.boxMargin,(t=>Ou.addSectionToLoop(t)));break;case r.db.LINETYPE.CRITICAL_END:e=Ou.endLoop(),Cu.drawLoop(u,e,"critical",Au),Ou.bumpVerticalPos(e.stopy-Ou.getVerticalPos()),Ou.models.addLoop(e);break;case r.db.LINETYPE.BREAK_START:$u(b,t,Au.boxMargin,Au.boxMargin+Au.boxTextMargin,(t=>Ou.newLoop(t)));break;case r.db.LINETYPE.BREAK_END:e=Ou.endLoop(),Cu.drawLoop(u,e,"break",Au),Ou.bumpVerticalPos(e.stopy-Ou.getVerticalPos()),Ou.models.addLoop(e);break;default:try{i=t.msgModel,i.starty=Ou.getVerticalPos(),i.sequenceIndex=k,i.sequenceVisible=r.db.showSequenceNumbers();const e=function(t,e){Ou.bumpVerticalPos(10);const{startx:n,stopx:r,message:i}=e,a=Pt.splitBreaks(i).length,s=Gn.calculateTextDimensions(i,Nu(Au)),o=s.height/a;let l;e.height+=o,Ou.bumpVerticalPos(o);let c=s.height-10;const u=s.width;if(n===r){l=Ou.getVerticalPos()+c,Au.rightAngles||(c+=Au.boxMargin,l=Ou.getVerticalPos()+c),c+=30;const t=Math.max(u/2,Au.width/2);Ou.insert(n-t,Ou.getVerticalPos()-10+c,r+t,Ou.getVerticalPos()+30+c)}else c+=Au.boxMargin,l=Ou.getVerticalPos()+c,Ou.insert(n,l-10,r,l);return Ou.bumpVerticalPos(c),e.height+=c,e.stopy=e.starty+e.height,Ou.insert(e.fromBounds,e.starty,e.toBounds,e.stopy),l}(0,i);x.push({messageModel:i,lineStartY:e}),Ou.models.addMessage(i)}catch(a){St.error("error while drawing message",a)}}[r.db.LINETYPE.SOLID_OPEN,r.db.LINETYPE.DOTTED_OPEN,r.db.LINETYPE.SOLID,r.db.LINETYPE.DOTTED,r.db.LINETYPE.SOLID_CROSS,r.db.LINETYPE.DOTTED_CROSS,r.db.LINETYPE.SOLID_POINT,r.db.LINETYPE.DOTTED_POINT].includes(t.type)&&(k+=v)})),x.forEach((t=>function(t,e,n,r){const{startx:i,stopx:a,starty:s,message:o,type:l,sequenceIndex:c,sequenceVisible:u}=e,d=Gn.calculateTextDimensions(o,Nu(Au)),h=Cu.getTextObj();h.x=i,h.y=s+10,h.width=a-i,h.class="messageText",h.dy="1em",h.text=o,h.fontFamily=Au.messageFontFamily,h.fontSize=Au.messageFontSize,h.fontWeight=Au.messageFontWeight,h.anchor=Au.messageAlign,h.valign="center",h.textMargin=Au.wrapPadding,h.tspan=!1,xu(t,h);const m=d.width;let _;i===a?_=Au.rightAngles?t.append("path").attr("d",`M ${i},${n} H ${i+Math.max(Au.width/2,m/2)} V ${n+25} H ${i}`):t.append("path").attr("d","M "+i+","+n+" C "+(i+60)+","+(n-10)+" "+(i+60)+","+(n+30)+" "+i+","+(n+20)):(_=t.append("line"),_.attr("x1",i),_.attr("y1",n),_.attr("x2",a),_.attr("y2",n)),l===r.db.LINETYPE.DOTTED||l===r.db.LINETYPE.DOTTED_CROSS||l===r.db.LINETYPE.DOTTED_POINT||l===r.db.LINETYPE.DOTTED_OPEN?(_.style("stroke-dasharray","3, 3"),_.attr("class","messageLine1")):_.attr("class","messageLine0");let p="";Au.arrowMarkerAbsolute&&(p=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,p=p.replace(/\(/g,"\\("),p=p.replace(/\)/g,"\\)")),_.attr("stroke-width",2),_.attr("stroke","none"),_.style("fill","none"),l!==r.db.LINETYPE.SOLID&&l!==r.db.LINETYPE.DOTTED||_.attr("marker-end","url("+p+"#arrowhead)"),l!==r.db.LINETYPE.SOLID_POINT&&l!==r.db.LINETYPE.DOTTED_POINT||_.attr("marker-end","url("+p+"#filled-head)"),l!==r.db.LINETYPE.SOLID_CROSS&&l!==r.db.LINETYPE.DOTTED_CROSS||_.attr("marker-end","url("+p+"#crosshead)"),(u||Au.showSequenceNumbers)&&(_.attr("marker-start","url("+p+"#sequencenumber)"),t.append("text").attr("x",i).attr("y",n+4).attr("font-family","sans-serif").attr("font-size","12px").attr("text-anchor","middle").attr("class","sequenceNumber").text(c))}(u,t.messageModel,t.lineStartY,r))),Au.mirrorActors&&(Ou.bumpVerticalPos(2*Au.boxMargin),Iu(u,d,m,Ou.getVerticalPos(),Au,_,!0),Ou.bumpVerticalPos(Au.boxMargin),wu(u,Ou.getVerticalPos())),Ou.models.boxes.forEach((function(t){t.height=Ou.getVerticalPos()-t.y,Ou.insert(t.x,t.y,t.x+t.width,t.height),t.startx=t.x,t.starty=t.y,t.stopx=t.startx+t.width,t.stopy=t.starty+t.height,t.stroke="rgb(0,0,0, 0.5)",Cu.drawBox(u,t,Au)})),f&&Ou.bumpVerticalPos(Au.boxMargin);const M=Pu(u,d,m,c),{bounds:L}=Ou.getBounds();St.debug("For line height fix Querying: #"+e+" .actor-line");(0,o.td_)("#"+e+" .actor-line").attr("y2",L.stopy);let w=L.stopy-L.starty;w<M.maxHeight&&(w=M.maxHeight);let T=w+2*Au.diagramMarginY;Au.mirrorActors&&(T=T-Au.boxMargin+Au.bottomMarginAdj);let S=L.stopx-L.startx;S<M.maxWidth&&(S=M.maxWidth);const D=S+2*Au.diagramMarginX;p&&u.append("text").text(p).attr("x",(L.stopx-L.startx)/2-2*Au.diagramMarginX).attr("y",-25),hr(u,T,D,Au.useMaxWidth);const Y=p?40:0;u.attr("viewBox",L.startx-Au.diagramMarginX+" -"+(Au.diagramMarginY+Y)+" "+D+" "+(T+Y)),St.debug("models:",Ou.models)}};var Uu=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,3],i=[1,5],a=[1,7],s=[2,5],o=[1,15],l=[1,17],c=[1,21],u=[1,22],d=[1,23],h=[1,24],m=[1,37],_=[1,25],p=[1,26],f=[1,27],y=[1,28],g=[1,29],b=[1,32],k=[1,33],v=[1,34],x=[1,35],M=[1,36],L=[1,39],w=[1,40],T=[1,41],S=[1,42],D=[1,38],Y=[1,45],E=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],C=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],A=[1,4,5,7,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],O=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],N={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,directive:6,SD:7,document:8,line:9,statement:10,classDefStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"--\x3e":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,classDef:38,CLASSDEF_ID:39,CLASSDEF_STYLEOPTS:40,DEFAULT:41,class:42,CLASSENTITY_IDS:43,STYLECLASS:44,openDirective:45,typeDirective:46,closeDirective:47,":":48,argDirective:49,direction_tb:50,direction_bt:51,direction_rl:52,direction_lr:53,eol:54,";":55,EDGE_STATE:56,STYLE_SEPARATOR:57,left_of:58,right_of:59,open_directive:60,type_directive:61,arg_directive:62,close_directive:63,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",7:"SD",14:"DESCR",15:"--\x3e",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"classDef",39:"CLASSDEF_ID",40:"CLASSDEF_STYLEOPTS",41:"DEFAULT",42:"class",43:"CLASSENTITY_IDS",44:"STYLECLASS",48:":",50:"direction_tb",51:"direction_bt",52:"direction_rl",53:"direction_lr",55:";",56:"EDGE_STATE",57:"STYLE_SEPARATOR",58:"left_of",59:"right_of",60:"open_directive",61:"type_directive",62:"arg_directive",63:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[10,2],[10,2],[10,1],[11,3],[11,3],[12,3],[6,3],[6,5],[32,1],[32,1],[32,1],[32,1],[54,1],[54,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1],[45,1],[46,1],[49,1],[47,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:return r.setRootDoc(a[o]),a[o];case 5:this.$=[];break;case 6:"nl"!=a[o]&&(a[o-1].push(a[o]),this.$=a[o-1]);break;case 7:case 8:case 12:this.$=a[o];break;case 9:this.$="nl";break;case 13:const t=a[o-1];t.description=r.trimColon(a[o]),this.$=t;break;case 14:this.$={stmt:"relation",state1:a[o-2],state2:a[o]};break;case 15:const e=r.trimColon(a[o]);this.$={stmt:"relation",state1:a[o-3],state2:a[o-1],description:e};break;case 19:this.$={stmt:"state",id:a[o-3],type:"default",description:"",doc:a[o-1]};break;case 20:var l=a[o],c=a[o-2].trim();if(a[o].match(":")){var u=a[o].split(":");l=u[0],c=[c,u[1]]}this.$={stmt:"state",id:l,type:"default",description:c};break;case 21:this.$={stmt:"state",id:a[o-3],type:"default",description:a[o-5],doc:a[o-1]};break;case 22:this.$={stmt:"state",id:a[o],type:"fork"};break;case 23:this.$={stmt:"state",id:a[o],type:"join"};break;case 24:this.$={stmt:"state",id:a[o],type:"choice"};break;case 25:this.$={stmt:"state",id:r.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:a[o-1].trim(),note:{position:a[o-2].trim(),text:a[o].trim()}};break;case 30:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 31:case 32:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 33:case 34:this.$={stmt:"classDef",id:a[o-1].trim(),classes:a[o].trim()};break;case 35:this.$={stmt:"applyClass",id:a[o-1].trim(),styleClass:a[o].trim()};break;case 38:r.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:r.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:r.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:r.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:a[o].trim(),type:"default",description:""};break;case 46:case 47:this.$={stmt:"state",id:a[o-2].trim(),classes:[a[o].trim()],type:"default",description:""};break;case 50:r.parseDirective("%%{","open_directive");break;case 51:r.parseDirective(a[o],"type_directive");break;case 52:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 53:r.parseDirective("}%%","close_directive","state")}},table:[{3:1,4:n,5:r,6:4,7:i,45:6,60:a},{1:[3]},{3:8,4:n,5:r,6:4,7:i,45:6,60:a},{3:9,4:n,5:r,6:4,7:i,45:6,60:a},{3:10,4:n,5:r,6:4,7:i,45:6,60:a},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],s,{8:11}),{46:12,61:[1,13]},{61:[2,50]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:l,6:30,9:14,10:16,11:18,12:19,13:20,16:c,17:u,19:d,22:h,24:m,25:_,26:p,27:f,28:y,29:g,32:31,33:b,35:k,37:v,38:x,42:M,45:6,50:L,51:w,52:T,53:S,56:D,60:a},{47:43,48:[1,44],63:Y},e([48,63],[2,51]),e(E,[2,6]),{6:30,10:46,11:18,12:19,13:20,16:c,17:u,19:d,22:h,24:m,25:_,26:p,27:f,28:y,29:g,32:31,33:b,35:k,37:v,38:x,42:M,45:6,50:L,51:w,52:T,53:S,56:D,60:a},e(E,[2,8]),e(E,[2,9]),e(E,[2,10]),e(E,[2,11]),e(E,[2,12],{14:[1,47],15:[1,48]}),e(E,[2,16]),{18:[1,49]},e(E,[2,18],{20:[1,50]}),{23:[1,51]},e(E,[2,22]),e(E,[2,23]),e(E,[2,24]),e(E,[2,25]),{30:52,31:[1,53],58:[1,54],59:[1,55]},e(E,[2,28]),e(E,[2,29]),{34:[1,56]},{36:[1,57]},e(E,[2,32]),{39:[1,58],41:[1,59]},{43:[1,60]},e(C,[2,44],{57:[1,61]}),e(C,[2,45],{57:[1,62]}),e(E,[2,38]),e(E,[2,39]),e(E,[2,40]),e(E,[2,41]),e(A,[2,36]),{49:63,62:[1,64]},e(A,[2,53]),e(E,[2,7]),e(E,[2,13]),{13:65,24:m,56:D},e(E,[2,17]),e(O,s,{8:66}),{24:[1,67]},{24:[1,68]},{23:[1,69]},{24:[2,48]},{24:[2,49]},e(E,[2,30]),e(E,[2,31]),{40:[1,70]},{40:[1,71]},{44:[1,72]},{24:[1,73]},{24:[1,74]},{47:75,63:Y},{63:[2,52]},e(E,[2,14],{14:[1,76]}),{4:o,5:l,6:30,9:14,10:16,11:18,12:19,13:20,16:c,17:u,19:d,21:[1,77],22:h,24:m,25:_,26:p,27:f,28:y,29:g,32:31,33:b,35:k,37:v,38:x,42:M,45:6,50:L,51:w,52:T,53:S,56:D,60:a},e(E,[2,20],{20:[1,78]}),{31:[1,79]},{24:[1,80]},e(E,[2,33]),e(E,[2,34]),e(E,[2,35]),e(C,[2,46]),e(C,[2,47]),e(A,[2,37]),e(E,[2,15]),e(E,[2,19]),e(O,s,{8:81}),e(E,[2,26]),e(E,[2,27]),{4:o,5:l,6:30,9:14,10:16,11:18,12:19,13:20,16:c,17:u,19:d,21:[1,82],22:h,24:m,25:_,26:p,27:f,28:y,29:g,32:31,33:b,35:k,37:v,38:x,42:M,45:6,50:L,51:w,52:T,53:S,56:D,60:a},e(E,[2,21])],defaultActions:{7:[2,50],8:[2,1],9:[2,2],10:[2,3],54:[2,48],55:[2,49],64:[2,52]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},B=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return 41;case 1:case 44:return 50;case 2:case 45:return 51;case 3:case 46:return 52;case 4:case 47:return 53;case 5:return this.begin("open_directive"),60;case 6:return this.begin("type_directive"),61;case 7:return this.popState(),this.begin("arg_directive"),48;case 8:return this.popState(),this.popState(),63;case 9:return 62;case 10:case 11:case 13:case 14:case 15:case 16:case 56:case 58:case 64:break;case 12:case 79:return 5;case 17:case 34:return this.pushState("SCALE"),17;case 18:case 35:return 18;case 19:case 25:case 36:case 51:case 54:this.popState();break;case 20:return this.begin("acc_title"),33;case 21:return this.popState(),"acc_title_value";case 22:return this.begin("acc_descr"),35;case 23:return this.popState(),"acc_descr_value";case 24:this.begin("acc_descr_multiline");break;case 26:return"acc_descr_multiline_value";case 27:return this.pushState("CLASSDEF"),38;case 28:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 29:return this.popState(),this.pushState("CLASSDEFID"),39;case 30:return this.popState(),40;case 31:return this.pushState("CLASS"),42;case 32:return this.popState(),this.pushState("CLASS_STYLE"),43;case 33:return this.popState(),44;case 37:this.pushState("STATE");break;case 38:case 41:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),25;case 39:case 42:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),26;case 40:case 43:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),27;case 48:this.pushState("STATE_STRING");break;case 49:return this.pushState("STATE_ID"),"AS";case 50:case 66:return this.popState(),"ID";case 52:return"STATE_DESCR";case 53:return 19;case 55:return this.popState(),this.pushState("struct"),20;case 57:return this.popState(),21;case 59:return this.begin("NOTE"),29;case 60:return this.popState(),this.pushState("NOTE_ID"),58;case 61:return this.popState(),this.pushState("NOTE_ID"),59;case 62:this.popState(),this.pushState("FLOATING_NOTE");break;case 63:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 65:return"NOTE_TEXT";case 67:return this.popState(),this.pushState("NOTE_TEXT"),24;case 68:return this.popState(),e.yytext=e.yytext.substr(2).trim(),31;case 69:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),31;case 70:case 71:return 7;case 72:return 16;case 73:return 56;case 74:return 24;case 75:return e.yytext=e.yytext.trim(),14;case 76:return 15;case 77:return 28;case 78:return 57;case 80:return"INVALID"}},rules:[/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[14,15],inclusive:!1},close_directive:{rules:[14,15],inclusive:!1},arg_directive:{rules:[8,9,14,15],inclusive:!1},type_directive:{rules:[7,8,14,15],inclusive:!1},open_directive:{rules:[6,14,15],inclusive:!1},struct:{rules:[14,15,27,31,37,44,45,46,47,56,57,58,59,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[66],inclusive:!1},FLOATING_NOTE:{rules:[63,64,65],inclusive:!1},NOTE_TEXT:{rules:[68,69],inclusive:!1},NOTE_ID:{rules:[67],inclusive:!1},NOTE:{rules:[60,61,62],inclusive:!1},CLASS_STYLE:{rules:[33],inclusive:!1},CLASS:{rules:[32],inclusive:!1},CLASSDEFID:{rules:[30],inclusive:!1},CLASSDEF:{rules:[28,29],inclusive:!1},acc_descr_multiline:{rules:[25,26],inclusive:!1},acc_descr:{rules:[23],inclusive:!1},acc_title:{rules:[21],inclusive:!1},SCALE:{rules:[18,19,35,36],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[50],inclusive:!1},STATE_STRING:{rules:[51,52],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[14,15,38,39,40,41,42,43,48,49,53,54,55],inclusive:!1},ID:{rules:[14,15],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,10,11,12,13,15,16,17,20,22,24,27,31,34,37,55,59,70,71,72,73,74,75,76,78,79,80],inclusive:!0}}},t);function F(){this.yy={}}return N.lexer=B,F.prototype=N,N.Parser=F,new F}();Uu.parser=Uu;const qu=Uu,Vu=(t,e)=>{var n;return"dagre-wrapper"!==(null==(n=null==e?void 0:e.state)?void 0:n.defaultRenderer)&&null!==t.match(/^\s*stateDiagram/)},Gu=(t,e)=>{var n;return null!==t.match(/^\s*stateDiagram-v2/)||!(!t.match(/^\s*stateDiagram/)||"dagre-wrapper"!==(null==(n=null==e?void 0:e.state)?void 0:n.defaultRenderer))},Ju="state",Xu="relation",Ku="default",Qu="divider",td="[*]",ed="start",nd="color",rd="fill";let id="LR",ad=[],sd={};let od={root:{relations:[],states:{},documents:{}}},ld=od.root,cd=0,ud=0;const dd=t=>JSON.parse(JSON.stringify(t)),hd=(t,e,n)=>{if(e.stmt===Xu)hd(t,e.state1,!0),hd(t,e.state2,!1);else if(e.stmt===Ju&&("[*]"===e.id?(e.id=n?t.id+"_start":t.id+"_end",e.start=n):e.id=e.id.trim()),e.doc){const t=[];let n,r=[];for(n=0;n<e.doc.length;n++)if(e.doc[n].type===Qu){const i=dd(e.doc[n]);i.doc=dd(r),t.push(i),r=[]}else r.push(e.doc[n]);if(t.length>0&&r.length>0){const n={stmt:Ju,id:Fn(),type:"divider",doc:dd(r)};t.push(dd(n)),e.doc=t}e.doc.forEach((t=>hd(e,t,!0)))}},md=function(t,e="default",n=null,r=null,i=null,a=null,s=null,o=null){const l=null==t?void 0:t.trim();if(void 0===ld.states[l]?(St.info("Adding state ",l,r),ld.states[l]={id:l,descriptions:[],type:e,doc:n,note:i,classes:[],styles:[],textStyles:[]}):(ld.states[l].doc||(ld.states[l].doc=n),ld.states[l].type||(ld.states[l].type=e)),r&&(St.info("Setting state description",l,r),"string"==typeof r&&bd(l,r.trim()),"object"==typeof r&&r.forEach((t=>bd(l,t.trim())))),i&&(ld.states[l].note=i,ld.states[l].note.text=Pt.sanitizeText(ld.states[l].note.text,ar())),a){St.info("Setting state classes",l,a);("string"==typeof a?[a]:a).forEach((t=>vd(l,t.trim())))}if(s){St.info("Setting state styles",l,s);("string"==typeof s?[s]:s).forEach((t=>xd(l,t.trim())))}if(o){St.info("Setting state styles",l,s);("string"==typeof o?[o]:o).forEach((t=>Md(l,t.trim())))}},_d=function(t){od={root:{relations:[],states:{},documents:{}}},ld=od.root,cd=0,sd={},t||Ar()},pd=function(t){return ld.states[t]};function fd(t=""){let e=t;return t===td&&(cd++,e=`start${cd}`),e}function yd(t="",e="default"){return t===td?ed:e}const gd=function(t,e,n){if("object"==typeof t)!function(t,e,n){let r=fd(t.id.trim()),i=yd(t.id.trim(),t.type),a=fd(e.id.trim()),s=yd(e.id.trim(),e.type);md(r,i,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),md(a,s,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),ld.relations.push({id1:r,id2:a,relationTitle:Pt.sanitizeText(n,ar())})}(t,e,n);else{const r=fd(t.trim()),i=yd(t),a=function(t=""){let e=t;return"[*]"===t&&(cd++,e=`end${cd}`),e}(e.trim()),s=function(t="",e="default"){return"[*]"===t?"end":e}(e);md(r,i),md(a,s),ld.relations.push({id1:r,id2:a,title:Pt.sanitizeText(n,ar())})}},bd=function(t,e){const n=ld.states[t],r=e.startsWith(":")?e.replace(":","").trim():e;n.descriptions.push(Pt.sanitizeText(r,ar()))},kd=function(t,e=""){void 0===sd[t]&&(sd[t]={id:t,styles:[],textStyles:[]});const n=sd[t];null!=e&&e.split(",").forEach((t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(t.match(nd)){const t=e.replace(rd,"bgFill").replace(nd,rd);n.textStyles.push(t)}n.styles.push(e)}))},vd=function(t,e){t.split(",").forEach((function(t){let n=pd(t);if(void 0===n){const e=t.trim();md(e),n=pd(e)}n.classes.push(e)}))},xd=function(t,e){const n=pd(t);void 0!==n&&n.textStyles.push(e)},Md=function(t,e){const n=pd(t);void 0!==n&&n.textStyles.push(e)},Ld={parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().state,addState:md,clear:_d,getState:pd,getStates:function(){return ld.states},getRelations:function(){return ld.relations},getClasses:function(){return sd},getDirection:()=>id,addRelation:gd,getDividerId:()=>(ud++,"divider-id-"+ud),setDirection:t=>{id=t},cleanupLabel:function(t){return":"===t.substring(0,1)?t.substr(2).trim():t.trim()},lineType:{LINE:0,DOTTED_LINE:1},relationType:{AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3},logDocuments:function(){St.info("Documents = ",od)},getRootDoc:()=>ad,setRootDoc:t=>{St.info("Setting root doc",t),ad=t},getRootDocV2:()=>(hd({id:"root"},{id:"root",doc:ad},!0),{id:"root",doc:ad}),extract:t=>{let e;e=t.doc?t.doc:t,St.info(e),_d(!0),St.info("Extract",e),e.forEach((t=>{switch(t.stmt){case Ju:md(t.id.trim(),t.type,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles);break;case Xu:gd(t.state1,t.state2,t.description);break;case"classDef":kd(t.id.trim(),t.classes);break;case"applyClass":vd(t.id.trim(),t.styleClass)}}))},trimColon:t=>t&&":"===t[0]?t.substr(1).trim():t.trim(),getAccTitle:Nr,setAccTitle:Or,getAccDescription:Fr,setAccDescription:Br,addStyleClass:kd,setCssClass:vd,addDescription:bd,setDiagramTitle:Ir,getDiagramTitle:Pr},wd={},Td=(t,e)=>{wd[t]=e},Sd=(t,e)=>{const n=t.append("text").attr("x",2*ar().state.padding).attr("y",ar().state.textHeight+1.3*ar().state.padding).attr("font-size",ar().state.fontSize).attr("class","state-title").text(e.descriptions[0]).node().getBBox(),r=n.height,i=t.append("text").attr("x",ar().state.padding).attr("y",r+.4*ar().state.padding+ar().state.dividerMargin+ar().state.textHeight).attr("class","state-description");let a=!0,s=!0;e.descriptions.forEach((function(t){a||(!function(t,e,n){const r=t.append("tspan").attr("x",2*ar().state.padding).text(e);n||r.attr("dy",ar().state.textHeight)}(i,t,s),s=!1),a=!1}));const o=t.append("line").attr("x1",ar().state.padding).attr("y1",ar().state.padding+r+ar().state.dividerMargin/2).attr("y2",ar().state.padding+r+ar().state.dividerMargin/2).attr("class","descr-divider"),l=i.node().getBBox(),c=Math.max(l.width,n.width);return o.attr("x2",c+3*ar().state.padding),t.insert("rect",":first-child").attr("x",ar().state.padding).attr("y",ar().state.padding).attr("width",c+2*ar().state.padding).attr("height",l.height+r+2*ar().state.padding).attr("rx",ar().state.radius),t},Dd=(t,e,n)=>{const r=ar().state.padding,i=2*ar().state.padding,a=t.node().getBBox(),s=a.width,o=a.x,l=t.append("text").attr("x",0).attr("y",ar().state.titleShift).attr("font-size",ar().state.fontSize).attr("class","state-title").text(e.id),c=l.node().getBBox().width+i;let u,d=Math.max(c,s);d===s&&(d+=i);const h=t.node().getBBox();e.doc,u=o-r,c>s&&(u=(s-d)/2+r),Math.abs(o-h.x)<r&&c>s&&(u=o-(c-s)/2);const m=1-ar().state.textHeight;return t.insert("rect",":first-child").attr("x",u).attr("y",m).attr("class",n?"alt-composit":"composit").attr("width",d).attr("height",h.height+ar().state.textHeight+ar().state.titleShift+1).attr("rx","0"),l.attr("x",u+r),c<=s&&l.attr("x",o+(d-i)/2-c/2+r),t.insert("rect",":first-child").attr("x",u).attr("y",ar().state.titleShift-ar().state.textHeight-ar().state.padding).attr("width",d).attr("height",3*ar().state.textHeight).attr("rx",ar().state.radius),t.insert("rect",":first-child").attr("x",u).attr("y",ar().state.titleShift-ar().state.textHeight-ar().state.padding).attr("width",d).attr("height",h.height+3+2*ar().state.textHeight).attr("rx",ar().state.radius),t},Yd=(t,e)=>{e.attr("class","state-note");const n=e.append("rect").attr("x",0).attr("y",ar().state.padding),r=e.append("g"),{textWidth:i,textHeight:a}=((t,e,n,r)=>{let i=0;const a=r.append("text");a.style("text-anchor","start"),a.attr("class","noteText");let s=t.replace(/\r\n/g,"<br/>");s=s.replace(/\n/g,"<br/>");const o=s.split(Pt.lineBreakRegex);let l=1.25*ar().state.noteMargin;for(const c of o){const t=c.trim();if(t.length>0){const r=a.append("tspan");r.text(t),0===l&&(l+=r.node().getBBox().height),i+=l,r.attr("x",e+ar().state.noteMargin),r.attr("y",n+i+1.25*ar().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}})(t,0,0,r);return n.attr("height",a+2*ar().state.noteMargin),n.attr("width",i+2*ar().state.noteMargin),n},Ed=function(t,e){const n=e.id,r={id:n,label:e.id,width:0,height:0},i=t.append("g").attr("id",n).attr("class","stateGroup");"start"===e.type&&(t=>{t.append("circle").attr("class","start-state").attr("r",ar().state.sizeUnit).attr("cx",ar().state.padding+ar().state.sizeUnit).attr("cy",ar().state.padding+ar().state.sizeUnit)})(i),"end"===e.type&&(t=>{t.append("circle").attr("class","end-state-outer").attr("r",ar().state.sizeUnit+ar().state.miniPadding).attr("cx",ar().state.padding+ar().state.sizeUnit+ar().state.miniPadding).attr("cy",ar().state.padding+ar().state.sizeUnit+ar().state.miniPadding),t.append("circle").attr("class","end-state-inner").attr("r",ar().state.sizeUnit).attr("cx",ar().state.padding+ar().state.sizeUnit+2).attr("cy",ar().state.padding+ar().state.sizeUnit+2)})(i),"fork"!==e.type&&"join"!==e.type||((t,e)=>{let n=ar().state.forkWidth,r=ar().state.forkHeight;if(e.parentId){let t=n;n=r,r=t}t.append("rect").style("stroke","black").style("fill","black").attr("width",n).attr("height",r).attr("x",ar().state.padding).attr("y",ar().state.padding)})(i,e),"note"===e.type&&Yd(e.note.text,i),"divider"===e.type&&(t=>{t.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",ar().state.textHeight).attr("class","divider").attr("x2",2*ar().state.textHeight).attr("y1",0).attr("y2",0)})(i),"default"===e.type&&0===e.descriptions.length&&((t,e)=>{const n=t.append("text").attr("x",2*ar().state.padding).attr("y",ar().state.textHeight+2*ar().state.padding).attr("font-size",ar().state.fontSize).attr("class","state-title").text(e.id),r=n.node().getBBox();t.insert("rect",":first-child").attr("x",ar().state.padding).attr("y",ar().state.padding).attr("width",r.width+2*ar().state.padding).attr("height",r.height+2*ar().state.padding).attr("rx",ar().state.radius)})(i,e),"default"===e.type&&e.descriptions.length>0&&Sd(i,e);const a=i.node().getBBox();return r.width=a.width+2*ar().state.padding,r.height=a.height+2*ar().state.padding,Td(n,r),r};let Cd=0;let Ad;const Od={},Nd=(t,e,n,r,i,a,s)=>{const l=new ut.k({compound:!0,multigraph:!0});let c,u=!0;for(c=0;c<t.length;c++)if("relation"===t[c].stmt){u=!1;break}n?l.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:u?1:Ad.edgeLengthFactor,nodeSep:u?1:50,isMultiGraph:!0}):l.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:u?1:Ad.edgeLengthFactor,nodeSep:u?1:50,ranker:"tight-tree",isMultiGraph:!0}),l.setDefaultEdgeLabel((function(){return{}})),s.db.extract(t);const d=s.db.getStates(),h=s.db.getRelations(),m=Object.keys(d);for(const o of m){const t=d[o];let c;if(n&&(t.parentId=n),t.doc){let n=e.append("g").attr("id",t.id).attr("class","stateGroup");c=Nd(t.doc,n,t.id,!r,i,a,s);{n=Dd(n,t,r);let e=n.node().getBBox();c.width=e.width,c.height=e.height+Ad.padding/2,Od[t.id]={y:Ad.compositTitleSize}}}else c=Ed(e,t);if(t.note){const n={descriptions:[],id:t.id+"-note",note:t.note,type:"note"},r=Ed(e,n);"left of"===t.note.position?(l.setNode(c.id+"-note",r),l.setNode(c.id,c)):(l.setNode(c.id,c),l.setNode(c.id+"-note",r)),l.setParent(c.id,c.id+"-group"),l.setParent(c.id+"-note",c.id+"-group")}else l.setNode(c.id,c)}St.debug("Count=",l.nodeCount(),l);let _=0;h.forEach((function(t){var e;_++,St.debug("Setting edge",t),l.setEdge(t.id1,t.id2,{relation:t,width:(e=t.title,e?e.length*Ad.fontSizeFactor:1),height:Ad.labelHeight*Pt.getRows(t.title).length,labelpos:"c"},"id"+_)})),(0,ct.bK)(l),St.debug("Graph after layout",l.nodes());const p=e.node();l.nodes().forEach((function(t){if(void 0!==t&&void 0!==l.node(t)){St.warn("Node "+t+": "+JSON.stringify(l.node(t))),i.select("#"+p.id+" #"+t).attr("transform","translate("+(l.node(t).x-l.node(t).width/2)+","+(l.node(t).y+(Od[t]?Od[t].y:0)-l.node(t).height/2)+" )"),i.select("#"+p.id+" #"+t).attr("data-x-shift",l.node(t).x-l.node(t).width/2);a.querySelectorAll("#"+p.id+" #"+t+" .divider").forEach((t=>{const e=t.parentElement;let n=0,r=0;e&&(e.parentElement&&(n=e.parentElement.getBBox().width),r=parseInt(e.getAttribute("data-x-shift"),10),Number.isNaN(r)&&(r=0)),t.setAttribute("x1",0-r+8),t.setAttribute("x2",n-r-8)}))}else St.debug("No Node "+t+": "+JSON.stringify(l.node(t)))}));let f=p.getBBox();l.edges().forEach((function(t){void 0!==t&&void 0!==l.edge(t)&&(St.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(l.edge(t))),function(t,e,n){e.points=e.points.filter((t=>!Number.isNaN(t.y)));const r=e.points,i=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(o.$0Z),a=t.append("path").attr("d",i(r)).attr("id","edge"+Cd).attr("class","transition");let s="";if(ar().state.arrowMarkerAbsolute&&(s=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,s=s.replace(/\(/g,"\\("),s=s.replace(/\)/g,"\\)")),a.attr("marker-end","url("+s+"#"+function(t){switch(t){case Ld.relationType.AGGREGATION:return"aggregation";case Ld.relationType.EXTENSION:return"extension";case Ld.relationType.COMPOSITION:return"composition";case Ld.relationType.DEPENDENCY:return"dependency"}}(Ld.relationType.DEPENDENCY)+"End)"),void 0!==n.title){const r=t.append("g").attr("class","stateLabel"),{x:i,y:a}=Gn.calcLabelPosition(e.points),s=Pt.getRows(n.title);let o=0;const l=[];let c=0,u=0;for(let t=0;t<=s.length;t++){const e=r.append("text").attr("text-anchor","middle").text(s[t]).attr("x",i).attr("y",a+o),n=e.node().getBBox();if(c=Math.max(c,n.width),u=Math.min(u,n.x),St.info(n.x,i,a+o),0===o){const t=e.node().getBBox();o=t.height,St.info("Title height",o,a)}l.push(e)}let d=o*s.length;if(s.length>1){const t=(s.length-1)*o*.5;l.forEach(((e,n)=>e.attr("y",a+n*o-t))),d=o*s.length}const h=r.node().getBBox();r.insert("rect",":first-child").attr("class","box").attr("x",i-c/2-ar().state.padding/2).attr("y",a-d/2-ar().state.padding/2-3.5).attr("width",c+ar().state.padding).attr("height",d+ar().state.padding),St.info(h)}Cd++}(e,l.edge(t),l.edge(t).relation))})),f=p.getBBox();const y={id:n||"root",label:n||"root",width:0,height:0};return y.width=f.width+2*Ad.padding,y.height=f.height+2*Ad.padding,St.debug("Doc rendered",y,l),y},Bd={setConf:function(){},draw:function(t,e,n,r){Ad=ar().state;const i=ar().securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s="sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body"),l="sandbox"===i?a.nodes()[0].contentDocument:document;St.debug("Rendering diagram "+t);const c=s.select(`[id='${e}']`);c.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z");new ut.k({multigraph:!0,compound:!0,rankdir:"RL"}).setDefaultEdgeLabel((function(){return{}}));const u=r.db.getRootDoc();Nd(u,c,void 0,!1,s,l,r);const d=Ad.padding,h=c.node().getBBox(),m=h.width+2*d,_=h.height+2*d;hr(c,_,1.75*m,Ad.useMaxWidth),c.attr("viewBox",`${h.x-Ad.padding} ${h.y-Ad.padding} `+m+" "+_)}},Fd="rect",Id="rectWithTitle",Pd="statediagram",jd="transition",Rd="parent",Hd="note",$d="----parent",Zd="fill:none",Wd="fill: #333",zd="text",Ud="normal";let qd={},Vd=0;function Gd(t="",e=0,n="",r="----"){return`state-${t}${null!==n&&n.length>0?`${r}${n}`:""}-${e}`}const Jd=(t,e,n,r,i,a)=>{const s=n.id,o=null==(l=r[s])?"":l.classes?l.classes.join(" "):"";var l;if("root"!==s){let e=Fd;!0===n.start&&(e="start"),!1===n.start&&(e="end"),n.type!==Ku&&(e=n.type),qd[s]||(qd[s]={id:s,shape:e,description:Pt.sanitizeText(s,ar()),classes:`${o} statediagram-state`});const r=qd[s];n.description&&(Array.isArray(r.description)?(r.shape=Id,r.description.push(n.description)):r.description.length>0?(r.shape=Id,r.description===s?r.description=[n.description]:r.description=[r.description,n.description]):(r.shape=Fd,r.description=n.description),r.description=Pt.sanitizeTextOrArray(r.description,ar())),1===r.description.length&&r.shape===Id&&(r.shape=Fd),!r.type&&n.doc&&(St.info("Setting cluster for ",s,Kd(n)),r.type="group",r.dir=Kd(n),r.shape=n.type===Qu?"divider":"roundedWithTitle",r.classes=r.classes+" statediagram-cluster "+(a?"statediagram-cluster-alt":""));const i={labelStyle:"",shape:r.shape,labelText:r.description,classes:r.classes,style:"",id:s,dir:r.dir,domId:Gd(s,Vd),type:r.type,padding:15};if(n.note){const e={labelStyle:"",shape:"note",labelText:n.note.text,classes:"statediagram-note",style:"",id:s+"----note-"+Vd,domId:Gd(s,Vd,Hd),type:r.type,padding:15},a={labelStyle:"",shape:"noteGroup",labelText:n.note.text,classes:r.classes,style:"",id:s+$d,domId:Gd(s,Vd,Rd),type:"group",padding:0};Vd++;const o=s+$d;t.setNode(o,a),t.setNode(e.id,e),t.setNode(s,i),t.setParent(s,o),t.setParent(e.id,o);let l=s,c=e.id;"left of"===n.note.position&&(l=e.id,c=s),t.setEdge(l,c,{arrowhead:"none",arrowType:"",style:Zd,labelStyle:"",classes:"transition note-edge",arrowheadStyle:Wd,labelpos:"c",labelType:zd,thickness:Ud})}else t.setNode(s,i)}e&&"root"!==e.id&&(St.trace("Setting node ",s," to be child of its parent ",e.id),t.setParent(s,e.id)),n.doc&&(St.trace("Adding nodes children "),Xd(t,n,n.doc,r,i,!a))},Xd=(t,e,n,r,i,a)=>{St.trace("items",n),n.forEach((n=>{switch(n.stmt){case Ju:case Ku:Jd(t,e,n,r,i,a);break;case Xu:{Jd(t,e,n.state1,r,i,a),Jd(t,e,n.state2,r,i,a);const s={id:"edge"+Vd,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:Zd,labelStyle:"",label:Pt.sanitizeText(n.description,ar()),arrowheadStyle:Wd,labelpos:"c",labelType:zd,thickness:Ud,classes:jd};t.setEdge(n.state1.id,n.state2.id,s,Vd),Vd++}}}))},Kd=(t,e="TB")=>{let n=e;if(t.doc)for(let r=0;r<t.doc.length;r++){const e=t.doc[r];"dir"===e.stmt&&(n=e.value)}return n},Qd={setConf:function(t){const e=Object.keys(t);for(const n of e)t[n]},getClasses:function(t,e){St.trace("Extracting classes"),e.db.clear();try{return e.parser.parse(t),e.db.extract(e.db.getRootDocV2()),e.db.getClasses()}catch(n){return n}},draw:function(t,e,n,r){St.info("Drawing state diagram (v2)",e),qd={};let i=r.db.getDirection();void 0===i&&(i="LR");const{securityLevel:a,state:s}=ar(),l=s.nodeSpacing||50,c=s.rankSpacing||50;St.info(r.db.getRootDocV2()),r.db.extract(r.db.getRootDocV2()),St.info(r.db.getRootDocV2());const u=r.db.getStates(),d=new ut.k({multigraph:!0,compound:!0}).setGraph({rankdir:Kd(r.db.getRootDocV2()),nodesep:l,ranksep:c,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}}));let h;Jd(d,void 0,r.db.getRootDocV2(),u,r.db,!0),"sandbox"===a&&(h=(0,o.Ys)("#i"+e));const m="sandbox"===a?(0,o.Ys)(h.nodes()[0].contentDocument.body):(0,o.Ys)("body"),_=m.select(`[id="${e}"]`),p=m.select("#"+e+" g");Us(p,d,["barb"],Pd,e);Gn.insertTitle(_,"statediagramTitleText",s.titleTopMargin,r.db.getDiagramTitle());const f=_.node().getBBox(),y=f.width+16,g=f.height+16;_.attr("class",Pd);const b=_.node().getBBox();hr(_,g,y,s.useMaxWidth);const k=`${b.x-8} ${b.y-8} ${y} ${g}`;St.debug(`viewBox ${k}`),_.attr("viewBox",k);const v=document.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(const o of v){const t=o.getBBox(),e=document.createElementNS("http://www.w3.org/2000/svg",Fd);e.setAttribute("rx",0),e.setAttribute("ry",0),e.setAttribute("width",t.width),e.setAttribute("height",t.height),o.insertBefore(e,o.firstChild)}}};var th=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,5],i=[6,9,11,17,18,20,22,23,24,26],a=[1,15],s=[1,16],o=[1,17],l=[1,18],c=[1,19],u=[1,20],d=[1,24],h=[4,6,9,11,17,18,20,22,23,24,26],m={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,taskName:24,taskData:25,open_directive:26,type_directive:27,arg_directive:28,close_directive:29,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",24:"taskName",25:"taskData",26:"open_directive",27:"type_directive",28:"arg_directive",29:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 1:return a[o-1];case 3:case 7:case 8:this.$=[];break;case 4:a[o-1].push(a[o]),this.$=a[o-1];break;case 5:case 6:this.$=a[o];break;case 11:r.setDiagramTitle(a[o].substr(6)),this.$=a[o].substr(6);break;case 12:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 13:case 14:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 15:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 16:r.addTask(a[o-1],a[o]),this.$="task";break;case 18:r.parseDirective("%%{","open_directive");break;case 19:r.parseDirective(a[o],"type_directive");break;case 20:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 21:r.parseDirective("}%%","close_directive","journey")}},table:[{3:1,4:n,7:3,12:4,26:r},{1:[3]},e(i,[2,3],{5:6}),{3:7,4:n,7:3,12:4,26:r},{13:8,27:[1,9]},{27:[2,18]},{6:[1,10],7:21,8:11,9:[1,12],10:13,11:[1,14],12:4,17:a,18:s,20:o,22:l,23:c,24:u,26:r},{1:[2,2]},{14:22,15:[1,23],29:d},e([15,29],[2,19]),e(i,[2,8],{1:[2,1]}),e(i,[2,4]),{7:21,10:25,12:4,17:a,18:s,20:o,22:l,23:c,24:u,26:r},e(i,[2,6]),e(i,[2,7]),e(i,[2,11]),{19:[1,26]},{21:[1,27]},e(i,[2,14]),e(i,[2,15]),{25:[1,28]},e(i,[2,17]),{11:[1,29]},{16:30,28:[1,31]},{11:[2,21]},e(i,[2,5]),e(i,[2,12]),e(i,[2,13]),e(i,[2,16]),e(h,[2,9]),{14:32,29:d},{29:[2,20]},{11:[1,33]},e(h,[2,10])],defaultActions:{5:[2,18],7:[2,2],24:[2,21],31:[2,20]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",l=0,c=0,u=2,d=1,h=a.slice.call(arguments,1),m=Object.create(this.lexer),_={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(_.yy[p]=this.yy[p]);m.setInput(t,_.yy),_.yy.lexer=m,_.yy.parser=this,void 0===m.yylloc&&(m.yylloc={});var f=m.yylloc;a.push(f);var y=m.options&&m.options.ranges;function g(){var t;return"number"!=typeof(t=r.pop()||m.lex()||d)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof _.yy.parseError?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var b,k,v,x,M,L,w,T,S={};;){if(k=n[n.length-1],this.defaultActions[k]?v=this.defaultActions[k]:(null==b&&(b=g()),v=s[k]&&s[k][b]),void 0===v||!v.length||!v[0]){var D="";for(M in T=[],s[k])this.terminals_[M]&&M>u&&T.push("'"+this.terminals_[M]+"'");D=m.showPosition?"Parse error on line "+(l+1)+":\n"+m.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==d?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:f,expected:T})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+b);switch(v[0]){case 1:n.push(b),i.push(m.yytext),a.push(m.yylloc),n.push(v[1]),b=null,c=m.yyleng,o=m.yytext,l=m.yylineno,f=m.yylloc;break;case 2:if(L=this.productions_[v[1]][1],S.$=i[i.length-L],S._$={first_line:a[a.length-(L||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(L||1)].first_column,last_column:a[a.length-1].last_column},y&&(S._$.range=[a[a.length-(L||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(S,[o,c,l,_.yy,v[1],i,a].concat(h))))return x;L&&(n=n.slice(0,-1*L*2),i=i.slice(0,-1*L),a=a.slice(0,-1*L)),n.push(this.productions_[v[1]][0]),i.push(S.$),a.push(S._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},_=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),26;case 1:return this.begin("type_directive"),27;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}},t);function p(){this.yy={}}return m.lexer=_,p.prototype=m,m.Parser=p,new p}();th.parser=th;const eh=th,nh=t=>null!==t.match(/^\s*journey/);let rh="";const ih=[],ah=[],sh=[],oh=function(){let t=!0;for(const[e,n]of sh.entries())sh[e].processed,t=t&&n.processed;return t},lh={parseDirective:function(t,e,n){am.parseDirective(this,t,e,n)},getConfig:()=>ar().journey,clear:function(){ih.length=0,ah.length=0,rh="",sh.length=0,Ar()},setDiagramTitle:Ir,getDiagramTitle:Pr,setAccTitle:Or,getAccTitle:Nr,setAccDescription:Br,getAccDescription:Fr,addSection:function(t){rh=t,ih.push(t)},getSections:function(){return ih},getTasks:function(){let t=oh();let e=0;for(;!t&&e<100;)t=oh(),e++;return ah.push(...sh),ah},addTask:function(t,e){const n=e.substr(1).split(":");let r=0,i=[];1===n.length?(r=Number(n[0]),i=[]):(r=Number(n[0]),i=n[1].split(","));const a=i.map((t=>t.trim())),s={section:rh,type:rh,people:a,task:t,score:r};sh.push(s)},addTaskOrg:function(t){const e={section:rh,type:rh,description:t,task:t,classes:[]};ah.push(e)},getActors:function(){return function(){const t=[];return ah.forEach((e=>{e.people&&t.push(...e.people)})),[...new Set(t)].sort()}()}},ch=function(t,e){const n=t.append("rect");return n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),void 0!==e.class&&n.attr("class",e.class),n},uh=function(t,e){const n=t.append("circle");return n.attr("cx",e.cx),n.attr("cy",e.cy),n.attr("class","actor-"+e.pos),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("r",e.r),void 0!==n.class&&n.attr("class",n.class),void 0!==e.title&&n.append("title").text(e.title),n},dh=function(t,e){const n=e.text.replace(/<br\s*\/?>/gi," "),r=t.append("text");r.attr("x",e.x),r.attr("y",e.y),r.attr("class","legend"),r.style("text-anchor",e.anchor),void 0!==e.class&&r.attr("class",e.class);const i=r.append("tspan");return i.attr("x",e.x+2*e.textMargin),i.text(n),r};let hh=-1;const mh=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},_h=function(){function t(t,e,n,i,a,s,o,l){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("font-color",l).style("text-anchor","middle").text(t),o)}function e(t,e,n,i,a,s,o,l,c){const{taskFontSize:u,taskFontFamily:d}=l,h=t.split(/<br\s*\/?>/gi);for(let m=0;m<h.length;m++){const t=m*u-u*(h.length-1)/2,l=e.append("text").attr("x",n+a/2).attr("y",i).attr("fill",c).style("text-anchor","middle").style("font-size",u).style("font-family",d);l.append("tspan").attr("x",n+a/2).attr("dy",t).text(h[m]),l.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(l,o)}}function n(t,n,i,a,s,o,l,c){const u=n.append("switch"),d=u.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,u,i,a,s,o,l,c),r(d,l)}function r(t,e){for(const n in e)n in e&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),ph=uh,fh=function(t,e,n){const r=t.append("g"),i=mh();i.x=e.x,i.y=e.y,i.fill=e.fill,i.width=n.width,i.height=n.height,i.class="journey-section section-type-"+e.num,i.rx=3,i.ry=3,ch(r,i),_h(n)(e.text,r,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+e.num},n,e.colour)},yh=dh,gh=function(t,e,n){const r=e.x+n.width/2,i=t.append("g");hh++;i.append("line").attr("id","task"+hh).attr("x1",r).attr("y1",e.y).attr("x2",r).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),function(t,e){const n=15,r=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",n).attr("stroke-width",2).attr("overflow","visible"),i=t.append("g");i.append("circle").attr("cx",e.cx-5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",e.cx+5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),e.score>3?function(t){const r=(0,o.Nb1)().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",r).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}(i):e.score<3?function(t){const r=(0,o.Nb1)().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",r).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}(i):i.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}(i,{cx:r,cy:300+30*(5-e.score),score:e.score});const a=mh();a.x=e.x,a.y=e.y,a.fill=e.fill,a.width=n.width,a.height=n.height,a.class="task task-type-"+e.num,a.rx=3,a.ry=3,ch(i,a);let s=e.x+14;e.people.forEach((t=>{const n=e.actors[t].color,r={cx:s,cy:e.y,r:7,fill:n,stroke:"#000",title:t,pos:e.actors[t].position};uh(i,r),s+=10})),_h(n)(e.task,i,a.x,a.y,a.width,a.height,{class:"task"},n,e.colour)},bh=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},kh={};const vh=ar().journey,xh=vh.leftMargin,Mh={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},updateVal:function(t,e,n,r){void 0===t[e]?t[e]=n:t[e]=r(n,t[e])},updateBounds:function(t,e,n,r){const i=ar().journey,a=this;let s=0;var o;this.sequenceItems.forEach((function(l){s++;const c=a.sequenceItems.length-s+1;a.updateVal(l,"starty",e-c*i.boxMargin,Math.min),a.updateVal(l,"stopy",r+c*i.boxMargin,Math.max),a.updateVal(Mh.data,"startx",t-c*i.boxMargin,Math.min),a.updateVal(Mh.data,"stopx",n+c*i.boxMargin,Math.max),"activation"!==o&&(a.updateVal(l,"startx",t-c*i.boxMargin,Math.min),a.updateVal(l,"stopx",n+c*i.boxMargin,Math.max),a.updateVal(Mh.data,"starty",e-c*i.boxMargin,Math.min),a.updateVal(Mh.data,"stopy",r+c*i.boxMargin,Math.max))}))},insert:function(t,e,n,r){const i=Math.min(t,n),a=Math.max(t,n),s=Math.min(e,r),o=Math.max(e,r);this.updateVal(Mh.data,"startx",i,Math.min),this.updateVal(Mh.data,"starty",s,Math.min),this.updateVal(Mh.data,"stopx",a,Math.max),this.updateVal(Mh.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return this.data}},Lh=vh.sectionFills,wh=vh.sectionColours,Th=function(t,e,n){const r=ar().journey;let i="";const a=n+(2*r.height+r.diagramMarginY);let s=0,o="#CCC",l="black",c=0;for(const[u,d]of e.entries()){if(i!==d.section){o=Lh[s%Lh.length],c=s%Lh.length,l=wh[s%wh.length];const e={x:u*r.taskMargin+u*r.width+xh,y:50,text:d.section,fill:o,num:c,colour:l};fh(t,e,r),i=d.section,s++}const e=d.people.reduce(((t,e)=>(kh[e]&&(t[e]=kh[e]),t)),{});d.x=u*r.taskMargin+u*r.width+xh,d.y=a,d.width=r.diagramMarginX,d.height=r.diagramMarginY,d.colour=l,d.fill=o,d.num=c,d.actors=e,gh(t,d,r),Mh.insert(d.x,d.y,d.x+d.width+r.taskMargin,450)}},Sh={setConf:function(t){Object.keys(t).forEach((function(e){vh[e]=t[e]}))},draw:function(t,e,n,r){const i=ar().journey;r.db.clear(),r.parser.parse(t+"\n");const a=ar().securityLevel;let s;"sandbox"===a&&(s=(0,o.Ys)("#i"+e));const l="sandbox"===a?(0,o.Ys)(s.nodes()[0].contentDocument.body):(0,o.Ys)("body");Mh.init();const c=l.select("#"+e);bh(c);const u=r.db.getTasks(),d=r.db.getDiagramTitle(),h=r.db.getActors();for(const o in kh)delete kh[o];let m=0;h.forEach((t=>{kh[t]={color:i.actorColours[m%i.actorColours.length],position:m},m++})),function(t){const e=ar().journey;let n=60;Object.keys(kh).forEach((r=>{const i=kh[r].color,a={cx:20,cy:n,r:7,fill:i,stroke:"#000",pos:kh[r].position};ph(t,a);const s={x:40,y:n+7,fill:"#666",text:r,textMargin:5|e.boxTextMargin};yh(t,s),n+=20}))}(c),Mh.insert(0,0,xh,50*Object.keys(kh).length),Th(c,u,0);const _=Mh.getBounds();d&&c.append("text").text(d).attr("x",xh).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const p=_.stopy-_.starty+2*i.diagramMarginY,f=xh+_.stopx+2*i.diagramMarginX;hr(c,p,f,i.useMaxWidth),c.append("line").attr("x1",xh).attr("y1",4*i.height).attr("x2",f-xh-4).attr("y2",4*i.height).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const y=d?70:0;c.attr("viewBox",`${_.startx} -25 ${f} ${p+y}`),c.attr("preserveAspectRatio","xMinYMin meet"),c.attr("height",p+y+25)}};let Dh={};const Yh={setConf:function(t){Dh={...Dh,...t}},draw:(t,e,n)=>{try{St.debug("Renering svg for syntax error\n");const t=(0,o.Ys)("#"+e),r=t.append("g");r.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),r.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),r.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),r.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),r.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),r.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),r.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),r.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+n),t.attr("height",100),t.attr("width",500),t.attr("viewBox","768 0 912 512")}catch(i){St.error("Error while rendering info diagram"),St.error((r=i)instanceof Error?r.message:String(r))}var r}},Eh="flowchart-elk",Ch={id:Eh,detector:(t,e)=>{var n;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&"elk"===(null==(n=null==e?void 0:e.flowchart)?void 0:n.defaultRenderer))},loader:async()=>{const{diagram:t}=await n.e(83209).then(n.bind(n,83209));return{id:Eh,diagram:t}}},Ah="timeline",Oh={id:Ah,detector:t=>null!==t.match(/^\s*timeline/),loader:async()=>{const{diagram:t}=await n.e(11071).then(n.bind(n,11071));return{id:Ah,diagram:t}}},Nh="mindmap",Bh={id:Nh,detector:t=>null!==t.match(/^\s*mindmap/),loader:async()=>{const{diagram:t}=await n.e(12366).then(n.bind(n,12366));return{id:Nh,diagram:t}}};let Fh=!1;const Ih=()=>{Fh||(Fh=!0,Ln(Ch,Oh,Bh),Xr("error",{db:{clear:()=>{}},styles:fr,renderer:Yh,parser:{parser:{yy:{}},parse:()=>{}},init:()=>{}},(t=>"error"===t.toLowerCase().trim())),Xr("---",{db:{clear:()=>{}},styles:fr,renderer:Yh,parser:{parser:{yy:{}},parse:()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with unindented `---` blocks")}},init:()=>null},(t=>t.toLowerCase().trimStart().startsWith("---"))),Xr("c4",{parser:Fi,db:Xi,renderer:Ya,styles:wr,init:t=>{Ya.setConf(t.c4)}},Ii),Xr("class",{parser:Ca,db:Ga,renderer:ls,styles:_r,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ga.clear()}},Aa),Xr("classDiagram",{parser:Ca,db:Ga,renderer:Js,styles:_r,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ga.clear()}},Oa),Xr("er",{parser:Ks,db:ro,renderer:fo,styles:pr},Qs),Xr("gantt",{parser:wl,db:ic,renderer:oc,styles:gr},Tl),Xr("info",{parser:cc,db:hc,renderer:mc,styles:br},_c),Xr("pie",{parser:fc,db:kc,renderer:Lc,styles:kr},yc),Xr("requirement",{parser:Tc,db:Oc,renderer:Wc,styles:vr},Sc),Xr("sequence",{parser:Uc,db:mu,renderer:zu,styles:xr,init:t=>{if(t.sequence||(t.sequence={}),t.sequence.arrowMarkerAbsolute=t.arrowMarkerAbsolute,"sequenceDiagram"in t)throw new Error("`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.");mu.setWrap(t.wrap),zu.setConf(t.sequence)}},qc),Xr("state",{parser:qu,db:Ld,renderer:Bd,styles:Mr,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ld.clear()}},Vu),Xr("stateDiagram",{parser:qu,db:Ld,renderer:Qd,styles:Mr,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ld.clear()}},Gu),Xr("journey",{parser:eh,db:lh,renderer:Sh,styles:Lr,init:t=>{Sh.setConf(t.journey),lh.clear()}},nh),Xr("flowchart",{parser:go,db:fl,renderer:Ml,styles:yr,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,bl(t.flowchart),fl.clear(),fl.setGen("gen-1")}},bo),Xr("flowchart-v2",{parser:go,db:fl,renderer:Ml,styles:yr,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,ir({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Ml.setConf(t.flowchart),fl.clear(),fl.setGen("gen-2")}},ko),Xr("gitGraph",{parser:ti,db:gi,renderer:Oi,styles:Ni},ei))};class Ph{constructor(t,e){var n,r;wt(this,"type","graph"),wt(this,"parser"),wt(this,"renderer"),wt(this,"db"),wt(this,"detectTypeFailed",!1),this.txt=t;const i=ar();this.txt=t;try{this.type=Mn(t,i)}catch(o){this.handleError(o,e),this.type="error",this.detectTypeFailed=!0}const a=Kr(this.type);St.debug("Type "+this.type),this.db=a.db,null==(r=(n=this.db).clear)||r.call(n),this.renderer=a.renderer,this.parser=a.parser;const s=this.parser.parse.bind(this.parser);this.parser.parse=t=>s(function(t,e){var n;const r=t.match(bn);if(r){const i=gn(r[1],{schema:yn});return(null==i?void 0:i.title)&&(null==(n=e.setDiagramTitle)||n.call(e,i.title)),t.slice(r[0].length)}return t}(t,this.db)),this.parser.parser.yy=this.db,a.init&&(a.init(i),St.info("Initialized diagram "+this.type,i)),this.txt+="\n",this.parse(this.txt,e)}parse(t,e){var n,r;if(this.detectTypeFailed)return!1;try{return t+="\n",null==(r=(n=this.db).clear)||r.call(n),this.parser.parse(t),!0}catch(i){this.handleError(i,e)}return!1}handleError(t,e){if(void 0===e)throw t;qn(t)?e(t.str,t.hash):e(t)}getParser(){return this.parser}getType(){return this.type}}const jh=(t,e)=>{const n=Mn(t,ar());try{Kr(n)}catch(r){const i=xn[n].loader;if(!i)throw new Error(`Diagram ${n} not found.`);return i().then((({diagram:r})=>(Xr(n,r,void 0),new Ph(t,e))))}return new Ph(t,e)},Rh=Ph;const Hh=["graph","flowchart","flowchart-v2","stateDiagram","stateDiagram-v2"],$h="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",Zh="sandbox",Wh="loose",zh="http://www.w3.org/1999/xlink",Uh="http://www.w3.org/1999/xhtml",qh=["foreignobject"],Vh=["dominant-baseline"];const Gh=function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,(function(t){return t.substring(0,t.length-1)})),e=e.replace(/classDef.*:\S*#.*;/g,(function(t){return t.substring(0,t.length-1)})),e=e.replace(/#\w+;/g,(function(t){const e=t.substring(1,t.length-1);return/^\+?\d+$/.test(e)?"\ufb02\xb0\xb0"+e+"\xb6\xdf":"\ufb02\xb0"+e+"\xb6\xdf"})),e},Jh=function(t){let e=t;return e=e.replace(/\ufb02\xb0\xb0/g,"&#"),e=e.replace(/\ufb02\xb0/g,"&"),e=e.replace(/\xb6\xdf/g,";"),e},Xh=(t,e,n=[])=>`\n.${t} ${e} { ${n.join(" !important; ")} !important; }`,Kh=(t,e,n,r)=>{const i=((t,e,n={})=>{var r;let i="";if(void 0!==t.themeCSS&&(i+=`\n${t.themeCSS}`),void 0!==t.fontFamily&&(i+=`\n:root { --mermaid-font-family: ${t.fontFamily}}`),void 0!==t.altFontFamily&&(i+=`\n:root { --mermaid-alt-font-family: ${t.altFontFamily}}`),!(0,Mt.Z)(n)&&Hh.includes(e)){const e=["> *","span"],a=["rect","polygon","ellipse","circle","path"],s=t.htmlLabels||(null==(r=t.flowchart)?void 0:r.htmlLabels)?e:a;for(const t in n){const e=n[t];(0,Mt.Z)(e.styles)||s.forEach((t=>{i+=Xh(e.id,t,e.styles)})),(0,Mt.Z)(e.textStyles)||(i+=Xh(e.id,"tspan",e.textStyles))}}return i})(t,e,n);return B(it(`${r}{${Sr(e,i,t.themeVariables)}}`),F)},Qh=(t="",e,n)=>{let r=t;return n||e||(r=r.replace(/marker-end="url\(.*?#/g,'marker-end="url(#')),r=Jh(r),r=r.replace(/<br>/g,"<br/>"),r},tm=(t="",e)=>`<iframe style="width:100%;height:${e?e.viewBox.baseVal.height+"px":"100%"};border:0;margin:0;" src="data:text/html;base64,${btoa('<body style="margin:0">'+t+"</body>")}" sandbox="allow-top-navigation-by-user-activation allow-popups">\n The "iframe" tag is not supported by your browser.\n</iframe>`,em=(t,e,n,r,i)=>{const a=t.append("div");a.attr("id",n),r&&a.attr("style",r);const s=a.append("svg").attr("id",e).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return i&&s.attr("xmlns:xlink",i),s.append("g"),t};function nm(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}const rm=(t,e,n,r)=>{var i,a,s;null==(i=t.getElementById(e))||i.remove(),null==(a=t.getElementById(n))||a.remove(),null==(s=t.getElementById(r))||s.remove()};function im(t,e,n,r){var i,a;a=t,(i=e).attr("role","graphics-document document"),(0,Mt.Z)(a)||i.attr("aria-roledescription",a),function(t,e,n,r){if(void 0!==t.insert&&(e||n)){if(n){const e="chart-desc-"+r;t.attr("aria-describedby",e),t.insert("desc",":first-child").attr("id",e).text(n)}if(e){const n="chart-title-"+r;t.attr("aria-labelledby",n),t.insert("title",":first-child").attr("id",n).text(e)}}}(e,n,r,e.attr("id"))}const am=Object.freeze({render:function(t,e,n,r){var i,a,s,l,c;Ih(),lr();const d=Gn.detectInit(e);d&&(zn(d),or(d));const h=ar();St.debug(h),e.length>(null!=(i=null==h?void 0:h.maxTextSize)?i:5e4)&&(e=$h),e=e.replace(/\r\n?/g,"\n");const m="#"+t,_="i"+t,p="#"+_,f="d"+t,y="#"+f;let g=(0,o.Ys)("body");const b=h.securityLevel===Zh,k=h.securityLevel===Wh,v=h.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),b){const t=nm((0,o.Ys)(r),_);g=(0,o.Ys)(t.nodes()[0].contentDocument.body),g.node().style.margin=0}else g=(0,o.Ys)(r);em(g,t,f,`font-family: ${v}`,zh)}else{if(rm(document,t,f,_),b){const t=nm((0,o.Ys)("body"),_);g=(0,o.Ys)(t.nodes()[0].contentDocument.body),g.node().style.margin=0}else g=(0,o.Ys)("body");em(g,t,f)}let x,M;e=Gh(e);try{if(x=jh(e),"then"in x)throw new Error("Diagram is a promise. Use renderAsync.")}catch(N){x=new Rh("error"),M=N}const L=g.select(y).node(),w=x.type,T=L.firstChild,S=T.firstChild,D=Hh.includes(w)?x.renderer.getClasses(e,x):{},Y=Kh(h,w,D,m),E=document.createElement("style");E.innerHTML=Y,T.insertBefore(E,S);try{x.renderer.draw(e,t,Jn,x)}catch(B){throw Yh.draw(e,t,Jn),B}im(w,g.select(`${y} svg`),null==(s=(a=x.db).getAccTitle)?void 0:s.call(a),null==(c=(l=x.db).getAccDescription)?void 0:c.call(l)),g.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",Uh);let C=g.select(y).node().innerHTML;if(St.debug("config.arrowMarkerAbsolute",h.arrowMarkerAbsolute),C=Qh(C,b,Ft(h.arrowMarkerAbsolute)),b){const t=g.select(y+" svg").node();C=tm(C,t)}else k||(C=u().sanitize(C,{ADD_TAGS:qh,ADD_ATTR:Vh}));if(void 0!==n)switch(w){case"flowchart":case"flowchart-v2":n(C,fl.bindFunctions);break;case"gantt":n(C,ic.bindFunctions);break;case"class":case"classDiagram":n(C,Ga.bindFunctions);break;default:n(C)}else St.debug("CB = undefined!");pu();const A=b?p:y,O=(0,o.Ys)(A).node();if(O&&"remove"in O&&O.remove(),M)throw M;return C},renderAsync:async function(t,e,n,r){var i,a,s,l,c;Ih(),lr();const d=Gn.detectInit(e);d&&(zn(d),or(d));const h=ar();St.debug(h),e.length>(null!=(i=null==h?void 0:h.maxTextSize)?i:5e4)&&(e=$h),e=e.replace(/\r\n?/g,"\n");const m="#"+t,_="i"+t,p="#"+_,f="d"+t,y="#"+f;let g=(0,o.Ys)("body");const b=h.securityLevel===Zh,k=h.securityLevel===Wh,v=h.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),b){const t=nm((0,o.Ys)(r),_);g=(0,o.Ys)(t.nodes()[0].contentDocument.body),g.node().style.margin=0}else g=(0,o.Ys)(r);em(g,t,f,`font-family: ${v}`,zh)}else{if(rm(document,t,f,_),b){const t=nm((0,o.Ys)("body"),_);g=(0,o.Ys)(t.nodes()[0].contentDocument.body),g.node().style.margin=0}else g=(0,o.Ys)("body");em(g,t,f)}let x,M;e=Gh(e);try{x=await jh(e)}catch(N){x=new Rh("error"),M=N}const L=g.select(y).node(),w=x.type,T=L.firstChild,S=T.firstChild,D=Hh.includes(w)?x.renderer.getClasses(e,x):{},Y=Kh(h,w,D,m),E=document.createElement("style");E.innerHTML=Y,T.insertBefore(E,S);try{await x.renderer.draw(e,t,Jn,x)}catch(B){throw Yh.draw(e,t,Jn),B}im(w,g.select(`${y} svg`),null==(s=(a=x.db).getAccTitle)?void 0:s.call(a),null==(c=(l=x.db).getAccDescription)?void 0:c.call(l)),g.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",Uh);let C=g.select(y).node().innerHTML;if(St.debug("config.arrowMarkerAbsolute",h.arrowMarkerAbsolute),C=Qh(C,b,Ft(h.arrowMarkerAbsolute)),b){const t=g.select(y+" svg").node();C=tm(C,t)}else k||(C=u().sanitize(C,{ADD_TAGS:qh,ADD_ATTR:Vh}));if(void 0!==n)switch(w){case"flowchart":case"flowchart-v2":n(C,fl.bindFunctions);break;case"gantt":n(C,ic.bindFunctions);break;case"class":case"classDiagram":n(C,Ga.bindFunctions);break;default:n(C)}else St.debug("CB = undefined!");pu();const A=b?p:y,O=(0,o.Ys)(A).node();if(O&&"remove"in O&&O.remove(),M)throw M;return C},parse:function(t,e){return Ih(),new Rh(t,e).parse(t,e)},parseAsync:async function(t,e){return Ih(),(await jh(t,e)).parse(t,e)},parseDirective:$r,initialize:function(t={}){var e;(null==t?void 0:t.fontFamily)&&!(null==(e=t.themeVariables)?void 0:e.fontFamily)&&(t.themeVariables={fontFamily:t.fontFamily}),Kn=Sn({},t),(null==t?void 0:t.theme)&&t.theme in qt?t.themeVariables=qt[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=qt.default.getThemeVariables(t.themeVariables));const n="object"==typeof t?(t=>(Qn=Sn({},Xn),Qn=Sn(Qn,t),t.theme&&qt[t.theme]&&(Qn.themeVariables=qt[t.theme].getThemeVariables(t.themeVariables)),nr(Qn,tr),Qn))(t):rr();Dt(n.logLevel),Ih()},getConfig:ar,setConfig:ir,getSiteConfig:rr,updateSiteConfig:t=>(Qn=Sn(Qn,t),nr(Qn,tr),Qn),reset:()=>{lr()},globalReset:()=>{lr(Xn)},defaultConfig:Xn});Dt(ar().logLevel),lr(ar());const sm=(t,e,n)=>{St.warn(t),qn(t)?(n&&n(t.str,t.hash),e.push({...t,message:t.str,error:t})):(n&&n(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},om=async function(t,e,n){const i=am.getConfig();let a;if(t&&(hm.sequenceConfig=t),St.debug((n?"":"No ")+"Callback function found"),void 0===e)a=document.querySelectorAll(".mermaid");else if("string"==typeof e)a=document.querySelectorAll(e);else if(e instanceof HTMLElement)a=[e];else{if(!(e instanceof NodeList))throw new Error("Invalid argument nodes for mermaid.init");a=e}St.debug(`Found ${a.length} diagrams`),void 0!==(null==t?void 0:t.startOnLoad)&&(St.debug("Start On Load: "+(null==t?void 0:t.startOnLoad)),am.updateSiteConfig({startOnLoad:null==t?void 0:t.startOnLoad}));const s=new Gn.initIdGenerator(i.deterministicIds,i.deterministicIDSeed);let o;const l=[];for(const u of Array.from(a)){if(St.info("Rendering diagram: "+u.id),u.getAttribute("data-processed"))continue;u.setAttribute("data-processed","true");const t=`mermaid-${s.next()}`;o=u.innerHTML,o=r(Gn.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const e=Gn.detectInit(o);e&&St.debug("Detected early reinit: ",e);try{await am.renderAsync(t,o,((e,r)=>{u.innerHTML=e,void 0!==n&&n(t),r&&r(u)}),u)}catch(c){sm(c,l,hm.parseError)}}if(l.length>0)throw l[0]},lm=function(){if(hm.startOnLoad){const{startOnLoad:t}=am.getConfig();t&&hm.init().catch((t=>St.error("Mermaid failed to initialize",t)))}};"undefined"!=typeof document&&window.addEventListener("load",lm,!1);const cm=[];let um=!1;const dm=async()=>{if(!um){for(um=!0;cm.length>0;){const e=cm.shift();if(e)try{await e()}catch(t){St.error("Error executing queue",t)}}um=!1}},hm={startOnLoad:!0,diagrams:{},mermaidAPI:am,parse:t=>am.parse(t,hm.parseError),parseAsync:t=>new Promise(((e,n)=>{cm.push((()=>new Promise(((r,i)=>{am.parseAsync(t,hm.parseError).then((t=>{r(t),e(t)}),(t=>{St.error("Error parsing",t),i(t),n(t)}))})))),dm().catch(n)})),render:am.render,renderAsync:(t,e,n,r)=>new Promise(((i,a)=>{cm.push((()=>new Promise(((s,o)=>{am.renderAsync(t,e,n,r).then((t=>{s(t),i(t)}),(t=>{St.error("Error parsing",t),o(t),a(t)}))})))),dm().catch(a)})),init:async function(t,e,n){try{await om(t,e,n)}catch(r){St.warn("Syntax Error rendering"),qn(r)&&St.warn(r.str),hm.parseError&&hm.parseError(r)}},initThrowsErrors:function(t,e,n){const i=am.getConfig();let a;if(t&&(hm.sequenceConfig=t),St.debug((n?"":"No ")+"Callback function found"),void 0===e)a=document.querySelectorAll(".mermaid");else if("string"==typeof e)a=document.querySelectorAll(e);else if(e instanceof HTMLElement)a=[e];else{if(!(e instanceof NodeList))throw new Error("Invalid argument nodes for mermaid.init");a=e}St.debug(`Found ${a.length} diagrams`),void 0!==(null==t?void 0:t.startOnLoad)&&(St.debug("Start On Load: "+(null==t?void 0:t.startOnLoad)),am.updateSiteConfig({startOnLoad:null==t?void 0:t.startOnLoad}));const s=new Gn.initIdGenerator(i.deterministicIds,i.deterministicIDSeed);let o;const l=[];for(const u of Array.from(a)){if(St.info("Rendering diagram: "+u.id),u.getAttribute("data-processed"))continue;u.setAttribute("data-processed","true");const t=`mermaid-${s.next()}`;o=u.innerHTML,o=r(Gn.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const e=Gn.detectInit(o);e&&St.debug("Detected early reinit: ",e);try{am.render(t,o,((e,r)=>{u.innerHTML=e,void 0!==n&&n(t),r&&r(u)}),u)}catch(c){sm(c,l,hm.parseError)}}if(l.length>0)throw l[0]},initThrowsErrorsAsync:om,registerExternalDiagrams:async(t,{lazyLoad:e=!0}={})=>{e?Ln(...t):await(async(...t)=>{St.debug(`Loading ${t.length} external diagrams`);const e=(await Promise.allSettled(t.map((async({id:t,detector:e,loader:n})=>{const{diagram:r}=await n();Xr(t,r,e)})))).filter((t=>"rejected"===t.status));if(e.length>0){St.error(`Failed to load ${e.length} external diagrams`);for(const t of e)St.error(t);throw new Error(`Failed to load ${e.length} external diagrams`)}})(...t)},initialize:function(t){am.initialize(t)},parseError:void 0,contentLoaded:lm,setParseErrorHandler:function(t){hm.parseError=t}}},42786:function(t,e,n){!function(t){"use strict";t.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(t){return/^nm$/i.test(t)},meridiem:function(t,e,n){return t<12?n?"vm":"VM":n?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[M\xf4re om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",ss:"%d sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},14130:function(t,e,n){!function(t){"use strict";var e=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},n={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},r=function(t){return function(r,i,a,s){var o=e(r),l=n[t][e(r)];return 2===o&&(l=l[i?0:1]),l.replace(/%d/i,r)}},i=["\u062c\u0627\u0646\u0641\u064a","\u0641\u064a\u0641\u0631\u064a","\u0645\u0627\u0631\u0633","\u0623\u0641\u0631\u064a\u0644","\u0645\u0627\u064a","\u062c\u0648\u0627\u0646","\u062c\u0648\u064a\u0644\u064a\u0629","\u0623\u0648\u062a","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];t.defineLocale("ar-dz",{months:i,monthsShort:i,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(t){return"\u0645"===t},meridiem:function(t,e,n){return t<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:r("s"),ss:r("s"),m:r("m"),mm:r("m"),h:r("h"),hh:r("h"),d:r("d"),dd:r("d"),M:r("M"),MM:r("M"),y:r("y"),yy:r("y")},postformat:function(t){return t.replace(/,/g,"\u060c")},week:{dow:0,doy:4}})}(n(30381))},96135:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-kw",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062a\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0627\u062d\u062f_\u0627\u062a\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:0,doy:12}})}(n(30381))},56440:function(t,e,n){!function(t){"use strict";var e={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},n=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},r={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},i=function(t){return function(e,i,a,s){var o=n(e),l=r[t][n(e)];return 2===o&&(l=l[i?0:1]),l.replace(/%d/i,e)}},a=["\u064a\u0646\u0627\u064a\u0631","\u0641\u0628\u0631\u0627\u064a\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064a\u0644","\u0645\u0627\u064a\u0648","\u064a\u0648\u0646\u064a\u0648","\u064a\u0648\u0644\u064a\u0648","\u0623\u063a\u0633\u0637\u0633","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];t.defineLocale("ar-ly",{months:a,monthsShort:a,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(t){return"\u0645"===t},meridiem:function(t,e,n){return t<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:i("s"),ss:i("s"),m:i("m"),mm:i("m"),h:i("h"),hh:i("h"),d:i("d"),dd:i("d"),M:i("M"),MM:i("M"),y:i("y"),yy:i("y")},preparse:function(t){return t.replace(/\u060c/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"\u060c")},week:{dow:6,doy:12}})}(n(30381))},47702:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-ma",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0627\u062d\u062f_\u0627\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:1,doy:4}})}(n(30381))},16040:function(t,e,n){!function(t){"use strict";var e={1:"\u0661",2:"\u0662",3:"\u0663",4:"\u0664",5:"\u0665",6:"\u0666",7:"\u0667",8:"\u0668",9:"\u0669",0:"\u0660"},n={"\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u0660":"0"};t.defineLocale("ar-sa",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a\u0648_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648_\u0623\u063a\u0633\u0637\u0633_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a\u0648_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648_\u0623\u063a\u0633\u0637\u0633_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(t){return"\u0645"===t},meridiem:function(t,e,n){return t<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},preparse:function(t){return t.replace(/[\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u0660]/g,(function(t){return n[t]})).replace(/\u060c/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"\u060c")},week:{dow:0,doy:6}})}(n(30381))},37100:function(t,e,n){!function(t){"use strict";t.defineLocale("ar-tn",{months:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),monthsShort:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:1,doy:4}})}(n(30381))},30867:function(t,e,n){!function(t){"use strict";var e={1:"\u0661",2:"\u0662",3:"\u0663",4:"\u0664",5:"\u0665",6:"\u0666",7:"\u0667",8:"\u0668",9:"\u0669",0:"\u0660"},n={"\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u0660":"0"},r=function(t){return 0===t?0:1===t?1:2===t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},i={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},a=function(t){return function(e,n,a,s){var o=r(e),l=i[t][r(e)];return 2===o&&(l=l[n?0:1]),l.replace(/%d/i,e)}},s=["\u064a\u0646\u0627\u064a\u0631","\u0641\u0628\u0631\u0627\u064a\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064a\u0644","\u0645\u0627\u064a\u0648","\u064a\u0648\u0646\u064a\u0648","\u064a\u0648\u0644\u064a\u0648","\u0623\u063a\u0633\u0637\u0633","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];t.defineLocale("ar",{months:s,monthsShort:s,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(t){return"\u0645"===t},meridiem:function(t,e,n){return t<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:a("s"),ss:a("s"),m:a("m"),mm:a("m"),h:a("h"),hh:a("h"),d:a("d"),dd:a("d"),M:a("M"),MM:a("M"),y:a("y"),yy:a("y")},preparse:function(t){return t.replace(/[\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u0660]/g,(function(t){return n[t]})).replace(/\u060c/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"\u060c")},week:{dow:6,doy:12}})}(n(30381))},31083:function(t,e,n){!function(t){"use strict";var e={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-\xfcnc\xfc",4:"-\xfcnc\xfc",100:"-\xfcnc\xfc",6:"-nc\u0131",9:"-uncu",10:"-uncu",30:"-uncu",60:"-\u0131nc\u0131",90:"-\u0131nc\u0131"};t.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ert\u0259si_\xc7\u0259r\u015f\u0259nb\u0259 ax\u015fam\u0131_\xc7\u0259r\u015f\u0259nb\u0259_C\xfcm\u0259 ax\u015fam\u0131_C\xfcm\u0259_\u015e\u0259nb\u0259".split("_"),weekdaysShort:"Baz_BzE_\xc7Ax_\xc7\u0259r_CAx_C\xfcm_\u015e\u0259n".split("_"),weekdaysMin:"Bz_BE_\xc7A_\xc7\u0259_CA_C\xfc_\u015e\u0259".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bug\xfcn saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[g\u0259l\u0259n h\u0259ft\u0259] dddd [saat] LT",lastDay:"[d\xfcn\u0259n] LT",lastWeek:"[ke\xe7\u0259n h\u0259ft\u0259] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s \u0259vv\u0259l",s:"bir ne\xe7\u0259 saniy\u0259",ss:"%d saniy\u0259",m:"bir d\u0259qiq\u0259",mm:"%d d\u0259qiq\u0259",h:"bir saat",hh:"%d saat",d:"bir g\xfcn",dd:"%d g\xfcn",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gec\u0259|s\u0259h\u0259r|g\xfcnd\xfcz|ax\u015fam/,isPM:function(t){return/^(g\xfcnd\xfcz|ax\u015fam)$/.test(t)},meridiem:function(t,e,n){return t<4?"gec\u0259":t<12?"s\u0259h\u0259r":t<17?"g\xfcnd\xfcz":"ax\u015fam"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0131nc\u0131|inci|nci|\xfcnc\xfc|nc\u0131|uncu)/,ordinal:function(t){if(0===t)return t+"-\u0131nc\u0131";var n=t%10,r=t%100-n,i=t>=100?100:null;return t+(e[n]||e[r]||e[i])},week:{dow:1,doy:7}})}(n(30381))},9808:function(t,e,n){!function(t){"use strict";function e(t,e){var n=t.split("_");return e%10==1&&e%100!=11?n[0]:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?n[1]:n[2]}function n(t,n,r){return"m"===r?n?"\u0445\u0432\u0456\u043b\u0456\u043d\u0430":"\u0445\u0432\u0456\u043b\u0456\u043d\u0443":"h"===r?n?"\u0433\u0430\u0434\u0437\u0456\u043d\u0430":"\u0433\u0430\u0434\u0437\u0456\u043d\u0443":t+" "+e({ss:n?"\u0441\u0435\u043a\u0443\u043d\u0434\u0430_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434":"\u0441\u0435\u043a\u0443\u043d\u0434\u0443_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434",mm:n?"\u0445\u0432\u0456\u043b\u0456\u043d\u0430_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d":"\u0445\u0432\u0456\u043b\u0456\u043d\u0443_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d",hh:n?"\u0433\u0430\u0434\u0437\u0456\u043d\u0430_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d":"\u0433\u0430\u0434\u0437\u0456\u043d\u0443_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d",dd:"\u0434\u0437\u0435\u043d\u044c_\u0434\u043d\u0456_\u0434\u0437\u0451\u043d",MM:"\u043c\u0435\u0441\u044f\u0446_\u043c\u0435\u0441\u044f\u0446\u044b_\u043c\u0435\u0441\u044f\u0446\u0430\u045e",yy:"\u0433\u043e\u0434_\u0433\u0430\u0434\u044b_\u0433\u0430\u0434\u043e\u045e"}[r],+t)}t.defineLocale("be",{months:{format:"\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044f_\u043b\u044e\u0442\u0430\u0433\u0430_\u0441\u0430\u043a\u0430\u0432\u0456\u043a\u0430_\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a\u0430_\u0442\u0440\u0430\u045e\u043d\u044f_\u0447\u044d\u0440\u0432\u0435\u043d\u044f_\u043b\u0456\u043f\u0435\u043d\u044f_\u0436\u043d\u0456\u045e\u043d\u044f_\u0432\u0435\u0440\u0430\u0441\u043d\u044f_\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a\u0430_\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434\u0430_\u0441\u043d\u0435\u0436\u043d\u044f".split("_"),standalone:"\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044c_\u043b\u044e\u0442\u044b_\u0441\u0430\u043a\u0430\u0432\u0456\u043a_\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a_\u0442\u0440\u0430\u0432\u0435\u043d\u044c_\u0447\u044d\u0440\u0432\u0435\u043d\u044c_\u043b\u0456\u043f\u0435\u043d\u044c_\u0436\u043d\u0456\u0432\u0435\u043d\u044c_\u0432\u0435\u0440\u0430\u0441\u0435\u043d\u044c_\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a_\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434_\u0441\u043d\u0435\u0436\u0430\u043d\u044c".split("_")},monthsShort:"\u0441\u0442\u0443\u0434_\u043b\u044e\u0442_\u0441\u0430\u043a_\u043a\u0440\u0430\u0441_\u0442\u0440\u0430\u0432_\u0447\u044d\u0440\u0432_\u043b\u0456\u043f_\u0436\u043d\u0456\u0432_\u0432\u0435\u0440_\u043a\u0430\u0441\u0442_\u043b\u0456\u0441\u0442_\u0441\u043d\u0435\u0436".split("_"),weekdays:{format:"\u043d\u044f\u0434\u0437\u0435\u043b\u044e_\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a_\u0430\u045e\u0442\u043e\u0440\u0430\u043a_\u0441\u0435\u0440\u0430\u0434\u0443_\u0447\u0430\u0446\u0432\u0435\u0440_\u043f\u044f\u0442\u043d\u0456\u0446\u0443_\u0441\u0443\u0431\u043e\u0442\u0443".split("_"),standalone:"\u043d\u044f\u0434\u0437\u0435\u043b\u044f_\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a_\u0430\u045e\u0442\u043e\u0440\u0430\u043a_\u0441\u0435\u0440\u0430\u0434\u0430_\u0447\u0430\u0446\u0432\u0435\u0440_\u043f\u044f\u0442\u043d\u0456\u0446\u0430_\u0441\u0443\u0431\u043e\u0442\u0430".split("_"),isFormat:/\[ ?[\u0423\u0443\u045e] ?(?:\u043c\u0456\u043d\u0443\u043b\u0443\u044e|\u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0443\u044e)? ?\] ?dddd/},weekdaysShort:"\u043d\u0434_\u043f\u043d_\u0430\u0442_\u0441\u0440_\u0447\u0446_\u043f\u0442_\u0441\u0431".split("_"),weekdaysMin:"\u043d\u0434_\u043f\u043d_\u0430\u0442_\u0441\u0440_\u0447\u0446_\u043f\u0442_\u0441\u0431".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY \u0433.",LLL:"D MMMM YYYY \u0433., HH:mm",LLLL:"dddd, D MMMM YYYY \u0433., HH:mm"},calendar:{sameDay:"[\u0421\u0451\u043d\u043d\u044f \u045e] LT",nextDay:"[\u0417\u0430\u045e\u0442\u0440\u0430 \u045e] LT",lastDay:"[\u0423\u0447\u043e\u0440\u0430 \u045e] LT",nextWeek:function(){return"[\u0423] dddd [\u045e] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[\u0423 \u043c\u0456\u043d\u0443\u043b\u0443\u044e] dddd [\u045e] LT";case 1:case 2:case 4:return"[\u0423 \u043c\u0456\u043d\u0443\u043b\u044b] dddd [\u045e] LT"}},sameElse:"L"},relativeTime:{future:"\u043f\u0440\u0430\u0437 %s",past:"%s \u0442\u0430\u043c\u0443",s:"\u043d\u0435\u043a\u0430\u043b\u044c\u043a\u0456 \u0441\u0435\u043a\u0443\u043d\u0434",m:n,mm:n,h:n,hh:n,d:"\u0434\u0437\u0435\u043d\u044c",dd:n,M:"\u043c\u0435\u0441\u044f\u0446",MM:n,y:"\u0433\u043e\u0434",yy:n},meridiemParse:/\u043d\u043e\u0447\u044b|\u0440\u0430\u043d\u0456\u0446\u044b|\u0434\u043d\u044f|\u0432\u0435\u0447\u0430\u0440\u0430/,isPM:function(t){return/^(\u0434\u043d\u044f|\u0432\u0435\u0447\u0430\u0440\u0430)$/.test(t)},meridiem:function(t,e,n){return t<4?"\u043d\u043e\u0447\u044b":t<12?"\u0440\u0430\u043d\u0456\u0446\u044b":t<17?"\u0434\u043d\u044f":"\u0432\u0435\u0447\u0430\u0440\u0430"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0456|\u044b|\u0433\u0430)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t%10!=2&&t%10!=3||t%100==12||t%100==13?t+"-\u044b":t+"-\u0456";case"D":return t+"-\u0433\u0430";default:return t}},week:{dow:1,doy:7}})}(n(30381))},68338:function(t,e,n){!function(t){"use strict";t.defineLocale("bg",{months:"\u044f\u043d\u0443\u0430\u0440\u0438_\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0438\u043b_\u043c\u0430\u0439_\u044e\u043d\u0438_\u044e\u043b\u0438_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438_\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438_\u043d\u043e\u0435\u043c\u0432\u0440\u0438_\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438".split("_"),monthsShort:"\u044f\u043d\u0443_\u0444\u0435\u0432_\u043c\u0430\u0440_\u0430\u043f\u0440_\u043c\u0430\u0439_\u044e\u043d\u0438_\u044e\u043b\u0438_\u0430\u0432\u0433_\u0441\u0435\u043f_\u043e\u043a\u0442_\u043d\u043e\u0435_\u0434\u0435\u043a".split("_"),weekdays:"\u043d\u0435\u0434\u0435\u043b\u044f_\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a_\u0432\u0442\u043e\u0440\u043d\u0438\u043a_\u0441\u0440\u044f\u0434\u0430_\u0447\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a_\u043f\u0435\u0442\u044a\u043a_\u0441\u044a\u0431\u043e\u0442\u0430".split("_"),weekdaysShort:"\u043d\u0435\u0434_\u043f\u043e\u043d_\u0432\u0442\u043e_\u0441\u0440\u044f_\u0447\u0435\u0442_\u043f\u0435\u0442_\u0441\u044a\u0431".split("_"),weekdaysMin:"\u043d\u0434_\u043f\u043d_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043f\u0442_\u0441\u0431".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[\u0414\u043d\u0435\u0441 \u0432] LT",nextDay:"[\u0423\u0442\u0440\u0435 \u0432] LT",nextWeek:"dddd [\u0432] LT",lastDay:"[\u0412\u0447\u0435\u0440\u0430 \u0432] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[\u041c\u0438\u043d\u0430\u043b\u0430\u0442\u0430] dddd [\u0432] LT";case 1:case 2:case 4:case 5:return"[\u041c\u0438\u043d\u0430\u043b\u0438\u044f] dddd [\u0432] LT"}},sameElse:"L"},relativeTime:{future:"\u0441\u043b\u0435\u0434 %s",past:"\u043f\u0440\u0435\u0434\u0438 %s",s:"\u043d\u044f\u043a\u043e\u043b\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434\u0438",ss:"%d \u0441\u0435\u043a\u0443\u043d\u0434\u0438",m:"\u043c\u0438\u043d\u0443\u0442\u0430",mm:"%d \u043c\u0438\u043d\u0443\u0442\u0438",h:"\u0447\u0430\u0441",hh:"%d \u0447\u0430\u0441\u0430",d:"\u0434\u0435\u043d",dd:"%d \u0434\u0435\u043d\u0430",w:"\u0441\u0435\u0434\u043c\u0438\u0446\u0430",ww:"%d \u0441\u0435\u0434\u043c\u0438\u0446\u0438",M:"\u043c\u0435\u0441\u0435\u0446",MM:"%d \u043c\u0435\u0441\u0435\u0446\u0430",y:"\u0433\u043e\u0434\u0438\u043d\u0430",yy:"%d \u0433\u043e\u0434\u0438\u043d\u0438"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0435\u0432|\u0435\u043d|\u0442\u0438|\u0432\u0438|\u0440\u0438|\u043c\u0438)/,ordinal:function(t){var e=t%10,n=t%100;return 0===t?t+"-\u0435\u0432":0===n?t+"-\u0435\u043d":n>10&&n<20?t+"-\u0442\u0438":1===e?t+"-\u0432\u0438":2===e?t+"-\u0440\u0438":7===e||8===e?t+"-\u043c\u0438":t+"-\u0442\u0438"},week:{dow:1,doy:7}})}(n(30381))},67438:function(t,e,n){!function(t){"use strict";t.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_M\u025bkalo_Zuw\u025bnkalo_Zuluyekalo_Utikalo_S\u025btanburukalo_\u0254kut\u0254burukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_M\u025b_Zuw_Zul_Uti_S\u025bt_\u0254ku_Now_Des".split("_"),weekdays:"Kari_Nt\u025bn\u025bn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Nt\u025b_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [l\u025br\u025b] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [l\u025br\u025b] HH:mm"},calendar:{sameDay:"[Bi l\u025br\u025b] LT",nextDay:"[Sini l\u025br\u025b] LT",nextWeek:"dddd [don l\u025br\u025b] LT",lastDay:"[Kunu l\u025br\u025b] LT",lastWeek:"dddd [t\u025bm\u025bnen l\u025br\u025b] LT",sameElse:"L"},relativeTime:{future:"%s k\u0254n\u0254",past:"a b\u025b %s b\u0254",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"l\u025br\u025b kelen",hh:"l\u025br\u025b %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}})}(n(30381))},76225:function(t,e,n){!function(t){"use strict";var e={1:"\u09e7",2:"\u09e8",3:"\u09e9",4:"\u09ea",5:"\u09eb",6:"\u09ec",7:"\u09ed",8:"\u09ee",9:"\u09ef",0:"\u09e6"},n={"\u09e7":"1","\u09e8":"2","\u09e9":"3","\u09ea":"4","\u09eb":"5","\u09ec":"6","\u09ed":"7","\u09ee":"8","\u09ef":"9","\u09e6":"0"};t.defineLocale("bn-bd",{months:"\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09bf_\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09bf_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0\u09bf\u09b2_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2\u09be\u0987_\u0986\u0997\u09b8\u09cd\u099f_\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0_\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0_\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0_\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0".split("_"),monthsShort:"\u099c\u09be\u09a8\u09c1_\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0\u09bf\u09b2_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2\u09be\u0987_\u0986\u0997\u09b8\u09cd\u099f_\u09b8\u09c7\u09aa\u09cd\u099f_\u0985\u0995\u09cd\u099f\u09cb_\u09a8\u09ad\u09c7_\u09a1\u09bf\u09b8\u09c7".split("_"),weekdays:"\u09b0\u09ac\u09bf\u09ac\u09be\u09b0_\u09b8\u09cb\u09ae\u09ac\u09be\u09b0_\u09ae\u0999\u09cd\u0997\u09b2\u09ac\u09be\u09b0_\u09ac\u09c1\u09a7\u09ac\u09be\u09b0_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0_\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0_\u09b6\u09a8\u09bf\u09ac\u09be\u09b0".split("_"),weekdaysShort:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997\u09b2_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),weekdaysMin:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997\u09b2_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),longDateFormat:{LT:"A h:mm \u09b8\u09ae\u09df",LTS:"A h:mm:ss \u09b8\u09ae\u09df",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u09b8\u09ae\u09df",LLLL:"dddd, D MMMM YYYY, A h:mm \u09b8\u09ae\u09df"},calendar:{sameDay:"[\u0986\u099c] LT",nextDay:"[\u0986\u0997\u09be\u09ae\u09c0\u0995\u09be\u09b2] LT",nextWeek:"dddd, LT",lastDay:"[\u0997\u09a4\u0995\u09be\u09b2] LT",lastWeek:"[\u0997\u09a4] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u09aa\u09b0\u09c7",past:"%s \u0986\u0997\u09c7",s:"\u0995\u09df\u09c7\u0995 \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",ss:"%d \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",m:"\u098f\u0995 \u09ae\u09bf\u09a8\u09bf\u099f",mm:"%d \u09ae\u09bf\u09a8\u09bf\u099f",h:"\u098f\u0995 \u0998\u09a8\u09cd\u099f\u09be",hh:"%d \u0998\u09a8\u09cd\u099f\u09be",d:"\u098f\u0995 \u09a6\u09bf\u09a8",dd:"%d \u09a6\u09bf\u09a8",M:"\u098f\u0995 \u09ae\u09be\u09b8",MM:"%d \u09ae\u09be\u09b8",y:"\u098f\u0995 \u09ac\u099b\u09b0",yy:"%d \u09ac\u099b\u09b0"},preparse:function(t){return t.replace(/[\u09e7\u09e8\u09e9\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u09e6]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u09b0\u09be\u09a4|\u09ad\u09cb\u09b0|\u09b8\u0995\u09be\u09b2|\u09a6\u09c1\u09aa\u09c1\u09b0|\u09ac\u09bf\u0995\u09be\u09b2|\u09b8\u09a8\u09cd\u09a7\u09cd\u09af\u09be|\u09b0\u09be\u09a4/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u09b0\u09be\u09a4"===e?t<4?t:t+12:"\u09ad\u09cb\u09b0"===e||"\u09b8\u0995\u09be\u09b2"===e?t:"\u09a6\u09c1\u09aa\u09c1\u09b0"===e?t>=3?t:t+12:"\u09ac\u09bf\u0995\u09be\u09b2"===e||"\u09b8\u09a8\u09cd\u09a7\u09cd\u09af\u09be"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u09b0\u09be\u09a4":t<6?"\u09ad\u09cb\u09b0":t<12?"\u09b8\u0995\u09be\u09b2":t<15?"\u09a6\u09c1\u09aa\u09c1\u09b0":t<18?"\u09ac\u09bf\u0995\u09be\u09b2":t<20?"\u09b8\u09a8\u09cd\u09a7\u09cd\u09af\u09be":"\u09b0\u09be\u09a4"},week:{dow:0,doy:6}})}(n(30381))},8905:function(t,e,n){!function(t){"use strict";var e={1:"\u09e7",2:"\u09e8",3:"\u09e9",4:"\u09ea",5:"\u09eb",6:"\u09ec",7:"\u09ed",8:"\u09ee",9:"\u09ef",0:"\u09e6"},n={"\u09e7":"1","\u09e8":"2","\u09e9":"3","\u09ea":"4","\u09eb":"5","\u09ec":"6","\u09ed":"7","\u09ee":"8","\u09ef":"9","\u09e6":"0"};t.defineLocale("bn",{months:"\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09bf_\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09bf_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0\u09bf\u09b2_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2\u09be\u0987_\u0986\u0997\u09b8\u09cd\u099f_\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0_\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0_\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0_\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0".split("_"),monthsShort:"\u099c\u09be\u09a8\u09c1_\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0\u09bf\u09b2_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2\u09be\u0987_\u0986\u0997\u09b8\u09cd\u099f_\u09b8\u09c7\u09aa\u09cd\u099f_\u0985\u0995\u09cd\u099f\u09cb_\u09a8\u09ad\u09c7_\u09a1\u09bf\u09b8\u09c7".split("_"),weekdays:"\u09b0\u09ac\u09bf\u09ac\u09be\u09b0_\u09b8\u09cb\u09ae\u09ac\u09be\u09b0_\u09ae\u0999\u09cd\u0997\u09b2\u09ac\u09be\u09b0_\u09ac\u09c1\u09a7\u09ac\u09be\u09b0_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0_\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0_\u09b6\u09a8\u09bf\u09ac\u09be\u09b0".split("_"),weekdaysShort:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997\u09b2_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),weekdaysMin:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997\u09b2_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),longDateFormat:{LT:"A h:mm \u09b8\u09ae\u09df",LTS:"A h:mm:ss \u09b8\u09ae\u09df",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u09b8\u09ae\u09df",LLLL:"dddd, D MMMM YYYY, A h:mm \u09b8\u09ae\u09df"},calendar:{sameDay:"[\u0986\u099c] LT",nextDay:"[\u0986\u0997\u09be\u09ae\u09c0\u0995\u09be\u09b2] LT",nextWeek:"dddd, LT",lastDay:"[\u0997\u09a4\u0995\u09be\u09b2] LT",lastWeek:"[\u0997\u09a4] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u09aa\u09b0\u09c7",past:"%s \u0986\u0997\u09c7",s:"\u0995\u09df\u09c7\u0995 \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",ss:"%d \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",m:"\u098f\u0995 \u09ae\u09bf\u09a8\u09bf\u099f",mm:"%d \u09ae\u09bf\u09a8\u09bf\u099f",h:"\u098f\u0995 \u0998\u09a8\u09cd\u099f\u09be",hh:"%d \u0998\u09a8\u09cd\u099f\u09be",d:"\u098f\u0995 \u09a6\u09bf\u09a8",dd:"%d \u09a6\u09bf\u09a8",M:"\u098f\u0995 \u09ae\u09be\u09b8",MM:"%d \u09ae\u09be\u09b8",y:"\u098f\u0995 \u09ac\u099b\u09b0",yy:"%d \u09ac\u099b\u09b0"},preparse:function(t){return t.replace(/[\u09e7\u09e8\u09e9\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u09e6]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u09b0\u09be\u09a4|\u09b8\u0995\u09be\u09b2|\u09a6\u09c1\u09aa\u09c1\u09b0|\u09ac\u09bf\u0995\u09be\u09b2|\u09b0\u09be\u09a4/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u09b0\u09be\u09a4"===e&&t>=4||"\u09a6\u09c1\u09aa\u09c1\u09b0"===e&&t<5||"\u09ac\u09bf\u0995\u09be\u09b2"===e?t+12:t},meridiem:function(t,e,n){return t<4?"\u09b0\u09be\u09a4":t<10?"\u09b8\u0995\u09be\u09b2":t<17?"\u09a6\u09c1\u09aa\u09c1\u09b0":t<20?"\u09ac\u09bf\u0995\u09be\u09b2":"\u09b0\u09be\u09a4"},week:{dow:0,doy:6}})}(n(30381))},11560:function(t,e,n){!function(t){"use strict";var e={1:"\u0f21",2:"\u0f22",3:"\u0f23",4:"\u0f24",5:"\u0f25",6:"\u0f26",7:"\u0f27",8:"\u0f28",9:"\u0f29",0:"\u0f20"},n={"\u0f21":"1","\u0f22":"2","\u0f23":"3","\u0f24":"4","\u0f25":"5","\u0f26":"6","\u0f27":"7","\u0f28":"8","\u0f29":"9","\u0f20":"0"};t.defineLocale("bo",{months:"\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f44\u0f0b\u0f54\u0f7c_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f66\u0f74\u0f58\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f5e\u0f72\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f63\u0f94\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0fb2\u0f74\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f62\u0f92\u0fb1\u0f51\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f42\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f45\u0f72\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54".split("_"),monthsShort:"\u0f5f\u0fb3\u0f0b1_\u0f5f\u0fb3\u0f0b2_\u0f5f\u0fb3\u0f0b3_\u0f5f\u0fb3\u0f0b4_\u0f5f\u0fb3\u0f0b5_\u0f5f\u0fb3\u0f0b6_\u0f5f\u0fb3\u0f0b7_\u0f5f\u0fb3\u0f0b8_\u0f5f\u0fb3\u0f0b9_\u0f5f\u0fb3\u0f0b10_\u0f5f\u0fb3\u0f0b11_\u0f5f\u0fb3\u0f0b12".split("_"),monthsShortRegex:/^(\u0f5f\u0fb3\u0f0b\d{1,2})/,monthsParseExact:!0,weekdays:"\u0f42\u0f5f\u0f60\u0f0b\u0f49\u0f72\u0f0b\u0f58\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f5f\u0fb3\u0f0b\u0f56\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f58\u0f72\u0f42\u0f0b\u0f51\u0f58\u0f62\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f63\u0fb7\u0f42\u0f0b\u0f54\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f55\u0f74\u0f62\u0f0b\u0f56\u0f74_\u0f42\u0f5f\u0f60\u0f0b\u0f54\u0f0b\u0f66\u0f44\u0f66\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f66\u0fa4\u0f7a\u0f53\u0f0b\u0f54\u0f0b".split("_"),weekdaysShort:"\u0f49\u0f72\u0f0b\u0f58\u0f0b_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b_\u0f58\u0f72\u0f42\u0f0b\u0f51\u0f58\u0f62\u0f0b_\u0f63\u0fb7\u0f42\u0f0b\u0f54\u0f0b_\u0f55\u0f74\u0f62\u0f0b\u0f56\u0f74_\u0f54\u0f0b\u0f66\u0f44\u0f66\u0f0b_\u0f66\u0fa4\u0f7a\u0f53\u0f0b\u0f54\u0f0b".split("_"),weekdaysMin:"\u0f49\u0f72_\u0f5f\u0fb3_\u0f58\u0f72\u0f42_\u0f63\u0fb7\u0f42_\u0f55\u0f74\u0f62_\u0f66\u0f44\u0f66_\u0f66\u0fa4\u0f7a\u0f53".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[\u0f51\u0f72\u0f0b\u0f62\u0f72\u0f44] LT",nextDay:"[\u0f66\u0f44\u0f0b\u0f49\u0f72\u0f53] LT",nextWeek:"[\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f55\u0fb2\u0f42\u0f0b\u0f62\u0f97\u0f7a\u0f66\u0f0b\u0f58], LT",lastDay:"[\u0f41\u0f0b\u0f66\u0f44] LT",lastWeek:"[\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f55\u0fb2\u0f42\u0f0b\u0f58\u0f50\u0f60\u0f0b\u0f58] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0f63\u0f0b",past:"%s \u0f66\u0f94\u0f53\u0f0b\u0f63",s:"\u0f63\u0f58\u0f0b\u0f66\u0f44",ss:"%d \u0f66\u0f90\u0f62\u0f0b\u0f46\u0f0d",m:"\u0f66\u0f90\u0f62\u0f0b\u0f58\u0f0b\u0f42\u0f45\u0f72\u0f42",mm:"%d \u0f66\u0f90\u0f62\u0f0b\u0f58",h:"\u0f46\u0f74\u0f0b\u0f5a\u0f7c\u0f51\u0f0b\u0f42\u0f45\u0f72\u0f42",hh:"%d \u0f46\u0f74\u0f0b\u0f5a\u0f7c\u0f51",d:"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f45\u0f72\u0f42",dd:"%d \u0f49\u0f72\u0f53\u0f0b",M:"\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f45\u0f72\u0f42",MM:"%d \u0f5f\u0fb3\u0f0b\u0f56",y:"\u0f63\u0f7c\u0f0b\u0f42\u0f45\u0f72\u0f42",yy:"%d \u0f63\u0f7c"},preparse:function(t){return t.replace(/[\u0f21\u0f22\u0f23\u0f24\u0f25\u0f26\u0f27\u0f28\u0f29\u0f20]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c|\u0f5e\u0f7c\u0f42\u0f66\u0f0b\u0f40\u0f66|\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44|\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42|\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c"===e&&t>=4||"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44"===e&&t<5||"\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42"===e?t+12:t},meridiem:function(t,e,n){return t<4?"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c":t<10?"\u0f5e\u0f7c\u0f42\u0f66\u0f0b\u0f40\u0f66":t<17?"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44":t<20?"\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42":"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c"},week:{dow:0,doy:6}})}(n(30381))},1278:function(t,e,n){!function(t){"use strict";function e(t,e,n){return t+" "+i({mm:"munutenn",MM:"miz",dd:"devezh"}[n],t)}function n(t){switch(r(t)){case 1:case 3:case 4:case 5:case 9:return t+" bloaz";default:return t+" vloaz"}}function r(t){return t>9?r(t%10):t}function i(t,e){return 2===e?a(t):t}function a(t){var e={m:"v",b:"v",d:"z"};return void 0===e[t.charAt(0)]?t:e[t.charAt(0)]+t.substring(1)}var s=[/^gen/i,/^c[\u02bc\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],o=/^(genver|c[\u02bc\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[\u02bc\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,l=/^(genver|c[\u02bc\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,c=/^(gen|c[\u02bc\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,u=[/^sul/i,/^lun/i,/^meurzh/i,/^merc[\u02bc\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],d=[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],h=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];t.defineLocale("br",{months:"Genver_C\u02bchwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C\u02bchwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc\u02bcher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:h,fullWeekdaysParse:u,shortWeekdaysParse:d,minWeekdaysParse:h,monthsRegex:o,monthsShortRegex:o,monthsStrictRegex:l,monthsShortStrictRegex:c,monthsParse:s,longMonthsParse:s,shortMonthsParse:s,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc\u02bchoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec\u02bch da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s \u02bczo",s:"un nebeud segondenno\xf9",ss:"%d eilenn",m:"ur vunutenn",mm:e,h:"un eur",hh:"%d eur",d:"un devezh",dd:e,M:"ur miz",MM:e,y:"ur bloaz",yy:n},dayOfMonthOrdinalParse:/\d{1,2}(a\xf1|vet)/,ordinal:function(t){return t+(1===t?"a\xf1":"vet")},week:{dow:1,doy:4},meridiemParse:/a.m.|g.m./,isPM:function(t){return"g.m."===t},meridiem:function(t,e,n){return t<12?"a.m.":"g.m."}})}(n(30381))},80622:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=t+" ";switch(n){case"ss":return r+=1===t?"sekunda":2===t||3===t||4===t?"sekunde":"sekundi";case"m":return e?"jedna minuta":"jedne minute";case"mm":return r+=1===t?"minuta":2===t||3===t||4===t?"minute":"minuta";case"h":return e?"jedan sat":"jednog sata";case"hh":return r+=1===t?"sat":2===t||3===t||4===t?"sata":"sati";case"dd":return r+=1===t?"dan":"dana";case"MM":return r+=1===t?"mjesec":2===t||3===t||4===t?"mjeseca":"mjeseci";case"yy":return r+=1===t?"godina":2===t||3===t||4===t?"godine":"godina"}}t.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_\u010detvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._\u010det._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_\u010de_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[ju\u010der u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[pro\u0161lu] dddd [u] LT";case 6:return"[pro\u0161le] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[pro\u0161li] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:e,m:e,mm:e,h:e,hh:e,d:"dan",dd:e,M:"mjesec",MM:e,y:"godinu",yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},2468:function(t,e,n){!function(t){"use strict";t.defineLocale("ca",{months:{standalone:"gener_febrer_mar\xe7_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),format:"de gener_de febrer_de mar\xe7_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._mar\xe7_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dt_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a les] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a les] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[dem\xe0 a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"d'aqu\xed %s",past:"fa %s",s:"uns segons",ss:"%d segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|\xe8|a)/,ordinal:function(t,e){var n=1===t?"r":2===t?"n":3===t?"r":4===t?"t":"\xe8";return"w"!==e&&"W"!==e||(n="a"),t+n},week:{dow:1,doy:4}})}(n(30381))},5822:function(t,e,n){!function(t){"use strict";var e={format:"leden_\xfanor_b\u0159ezen_duben_kv\u011bten_\u010derven_\u010dervenec_srpen_z\xe1\u0159\xed_\u0159\xedjen_listopad_prosinec".split("_"),standalone:"ledna_\xfanora_b\u0159ezna_dubna_kv\u011btna_\u010dervna_\u010dervence_srpna_z\xe1\u0159\xed_\u0159\xedjna_listopadu_prosince".split("_")},n="led_\xfano_b\u0159e_dub_kv\u011b_\u010dvn_\u010dvc_srp_z\xe1\u0159_\u0159\xedj_lis_pro".split("_"),r=[/^led/i,/^\xfano/i,/^b\u0159e/i,/^dub/i,/^kv\u011b/i,/^(\u010dvn|\u010derven$|\u010dervna)/i,/^(\u010dvc|\u010dervenec|\u010dervence)/i,/^srp/i,/^z\xe1\u0159/i,/^\u0159\xedj/i,/^lis/i,/^pro/i],i=/^(leden|\xfanor|b\u0159ezen|duben|kv\u011bten|\u010dervenec|\u010dervence|\u010derven|\u010dervna|srpen|z\xe1\u0159\xed|\u0159\xedjen|listopad|prosinec|led|\xfano|b\u0159e|dub|kv\u011b|\u010dvn|\u010dvc|srp|z\xe1\u0159|\u0159\xedj|lis|pro)/i;function a(t){return t>1&&t<5&&1!=~~(t/10)}function s(t,e,n,r){var i=t+" ";switch(n){case"s":return e||r?"p\xe1r sekund":"p\xe1r sekundami";case"ss":return e||r?i+(a(t)?"sekundy":"sekund"):i+"sekundami";case"m":return e?"minuta":r?"minutu":"minutou";case"mm":return e||r?i+(a(t)?"minuty":"minut"):i+"minutami";case"h":return e?"hodina":r?"hodinu":"hodinou";case"hh":return e||r?i+(a(t)?"hodiny":"hodin"):i+"hodinami";case"d":return e||r?"den":"dnem";case"dd":return e||r?i+(a(t)?"dny":"dn\xed"):i+"dny";case"M":return e||r?"m\u011bs\xedc":"m\u011bs\xedcem";case"MM":return e||r?i+(a(t)?"m\u011bs\xedce":"m\u011bs\xedc\u016f"):i+"m\u011bs\xedci";case"y":return e||r?"rok":"rokem";case"yy":return e||r?i+(a(t)?"roky":"let"):i+"lety"}}t.defineLocale("cs",{months:e,monthsShort:n,monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(leden|ledna|\xfanora|\xfanor|b\u0159ezen|b\u0159ezna|duben|dubna|kv\u011bten|kv\u011btna|\u010dervenec|\u010dervence|\u010derven|\u010dervna|srpen|srpna|z\xe1\u0159\xed|\u0159\xedjen|\u0159\xedjna|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|\xfano|b\u0159e|dub|kv\u011b|\u010dvn|\u010dvc|srp|z\xe1\u0159|\u0159\xedj|lis|pro)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"ned\u011ble_pond\u011bl\xed_\xfater\xfd_st\u0159eda_\u010dtvrtek_p\xe1tek_sobota".split("_"),weekdaysShort:"ne_po_\xfat_st_\u010dt_p\xe1_so".split("_"),weekdaysMin:"ne_po_\xfat_st_\u010dt_p\xe1_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[z\xedtra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v ned\u011bli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve st\u0159edu v] LT";case 4:return"[ve \u010dtvrtek v] LT";case 5:return"[v p\xe1tek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[v\u010dera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou ned\u011bli v] LT";case 1:case 2:return"[minul\xe9] dddd [v] LT";case 3:return"[minulou st\u0159edu v] LT";case 4:case 5:return"[minul\xfd] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"p\u0159ed %s",s:s,ss:s,m:s,mm:s,h:s,hh:s,d:s,dd:s,M:s,MM:s,y:s,yy:s},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},50877:function(t,e,n){!function(t){"use strict";t.defineLocale("cv",{months:"\u043a\u04d1\u0440\u043b\u0430\u0447_\u043d\u0430\u0440\u04d1\u0441_\u043f\u0443\u0448_\u0430\u043a\u0430_\u043c\u0430\u0439_\u04ab\u04d7\u0440\u0442\u043c\u0435_\u0443\u0442\u04d1_\u04ab\u0443\u0440\u043b\u0430_\u0430\u0432\u04d1\u043d_\u044e\u043f\u0430_\u0447\u04f3\u043a_\u0440\u0430\u0448\u0442\u0430\u0432".split("_"),monthsShort:"\u043a\u04d1\u0440_\u043d\u0430\u0440_\u043f\u0443\u0448_\u0430\u043a\u0430_\u043c\u0430\u0439_\u04ab\u04d7\u0440_\u0443\u0442\u04d1_\u04ab\u0443\u0440_\u0430\u0432\u043d_\u044e\u043f\u0430_\u0447\u04f3\u043a_\u0440\u0430\u0448".split("_"),weekdays:"\u0432\u044b\u0440\u0441\u0430\u0440\u043d\u0438\u043a\u0443\u043d_\u0442\u0443\u043d\u0442\u0438\u043a\u0443\u043d_\u044b\u0442\u043b\u0430\u0440\u0438\u043a\u0443\u043d_\u044e\u043d\u043a\u0443\u043d_\u043a\u04d7\u04ab\u043d\u0435\u0440\u043d\u0438\u043a\u0443\u043d_\u044d\u0440\u043d\u0435\u043a\u0443\u043d_\u0448\u04d1\u043c\u0430\u0442\u043a\u0443\u043d".split("_"),weekdaysShort:"\u0432\u044b\u0440_\u0442\u0443\u043d_\u044b\u0442\u043b_\u044e\u043d_\u043a\u04d7\u04ab_\u044d\u0440\u043d_\u0448\u04d1\u043c".split("_"),weekdaysMin:"\u0432\u0440_\u0442\u043d_\u044b\u0442_\u044e\u043d_\u043a\u04ab_\u044d\u0440_\u0448\u043c".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [\u04ab\u0443\u043b\u0445\u0438] MMMM [\u0443\u0439\u04d1\u0445\u04d7\u043d] D[-\u043c\u04d7\u0448\u04d7]",LLL:"YYYY [\u04ab\u0443\u043b\u0445\u0438] MMMM [\u0443\u0439\u04d1\u0445\u04d7\u043d] D[-\u043c\u04d7\u0448\u04d7], HH:mm",LLLL:"dddd, YYYY [\u04ab\u0443\u043b\u0445\u0438] MMMM [\u0443\u0439\u04d1\u0445\u04d7\u043d] D[-\u043c\u04d7\u0448\u04d7], HH:mm"},calendar:{sameDay:"[\u041f\u0430\u044f\u043d] LT [\u0441\u0435\u0445\u0435\u0442\u0440\u0435]",nextDay:"[\u042b\u0440\u0430\u043d] LT [\u0441\u0435\u0445\u0435\u0442\u0440\u0435]",lastDay:"[\u04d6\u043d\u0435\u0440] LT [\u0441\u0435\u0445\u0435\u0442\u0440\u0435]",nextWeek:"[\u04aa\u0438\u0442\u0435\u0441] dddd LT [\u0441\u0435\u0445\u0435\u0442\u0440\u0435]",lastWeek:"[\u0418\u0440\u0442\u043d\u04d7] dddd LT [\u0441\u0435\u0445\u0435\u0442\u0440\u0435]",sameElse:"L"},relativeTime:{future:function(t){return t+(/\u0441\u0435\u0445\u0435\u0442$/i.exec(t)?"\u0440\u0435\u043d":/\u04ab\u0443\u043b$/i.exec(t)?"\u0442\u0430\u043d":"\u0440\u0430\u043d")},past:"%s \u043a\u0430\u044f\u043b\u043b\u0430",s:"\u043f\u04d7\u0440-\u0438\u043a \u04ab\u0435\u043a\u043a\u0443\u043d\u0442",ss:"%d \u04ab\u0435\u043a\u043a\u0443\u043d\u0442",m:"\u043f\u04d7\u0440 \u043c\u0438\u043d\u0443\u0442",mm:"%d \u043c\u0438\u043d\u0443\u0442",h:"\u043f\u04d7\u0440 \u0441\u0435\u0445\u0435\u0442",hh:"%d \u0441\u0435\u0445\u0435\u0442",d:"\u043f\u04d7\u0440 \u043a\u0443\u043d",dd:"%d \u043a\u0443\u043d",M:"\u043f\u04d7\u0440 \u0443\u0439\u04d1\u0445",MM:"%d \u0443\u0439\u04d1\u0445",y:"\u043f\u04d7\u0440 \u04ab\u0443\u043b",yy:"%d \u04ab\u0443\u043b"},dayOfMonthOrdinalParse:/\d{1,2}-\u043c\u04d7\u0448/,ordinal:"%d-\u043c\u04d7\u0448",week:{dow:1,doy:7}})}(n(30381))},47373:function(t,e,n){!function(t){"use strict";t.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn \xf4l",s:"ychydig eiliadau",ss:"%d eiliad",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},dayOfMonthOrdinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(t){var e="";return t>20?e=40===t||50===t||60===t||80===t||100===t?"fed":"ain":t>0&&(e=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"][t]),t+e},week:{dow:1,doy:4}})}(n(30381))},24780:function(t,e,n){!function(t){"use strict";t.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"s\xf8ndag_mandag_tirsdag_onsdag_torsdag_fredag_l\xf8rdag".split("_"),weekdaysShort:"s\xf8n_man_tir_ons_tor_fre_l\xf8r".split("_"),weekdaysMin:"s\xf8_ma_ti_on_to_fr_l\xf8".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"p\xe5 dddd [kl.] LT",lastDay:"[i g\xe5r kl.] LT",lastWeek:"[i] dddd[s kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"f\xe5 sekunder",ss:"%d sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en m\xe5ned",MM:"%d m\xe5neder",y:"et \xe5r",yy:"%d \xe5r"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},60217:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de-at",{months:"J\xe4nner_Februar_M\xe4rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"J\xe4n._Feb._M\xe4rz_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},60894:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de-ch",{months:"Januar_Februar_M\xe4rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._M\xe4rz_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},59740:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?i[n][0]:i[n][1]}t.defineLocale("de",{months:"Januar_Februar_M\xe4rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._M\xe4rz_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},5300:function(t,e,n){!function(t){"use strict";var e=["\u0796\u07ac\u0782\u07aa\u0787\u07a6\u0783\u07a9","\u078a\u07ac\u0784\u07b0\u0783\u07aa\u0787\u07a6\u0783\u07a9","\u0789\u07a7\u0783\u07a8\u0797\u07aa","\u0787\u07ad\u0795\u07b0\u0783\u07a9\u078d\u07aa","\u0789\u07ad","\u0796\u07ab\u0782\u07b0","\u0796\u07aa\u078d\u07a6\u0787\u07a8","\u0787\u07af\u078e\u07a6\u0790\u07b0\u0793\u07aa","\u0790\u07ac\u0795\u07b0\u0793\u07ac\u0789\u07b0\u0784\u07a6\u0783\u07aa","\u0787\u07ae\u0786\u07b0\u0793\u07af\u0784\u07a6\u0783\u07aa","\u0782\u07ae\u0788\u07ac\u0789\u07b0\u0784\u07a6\u0783\u07aa","\u0791\u07a8\u0790\u07ac\u0789\u07b0\u0784\u07a6\u0783\u07aa"],n=["\u0787\u07a7\u078b\u07a8\u0787\u07b0\u078c\u07a6","\u0780\u07af\u0789\u07a6","\u0787\u07a6\u0782\u07b0\u078e\u07a7\u0783\u07a6","\u0784\u07aa\u078b\u07a6","\u0784\u07aa\u0783\u07a7\u0790\u07b0\u078a\u07a6\u078c\u07a8","\u0780\u07aa\u0786\u07aa\u0783\u07aa","\u0780\u07ae\u0782\u07a8\u0780\u07a8\u0783\u07aa"];t.defineLocale("dv",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:"\u0787\u07a7\u078b\u07a8_\u0780\u07af\u0789\u07a6_\u0787\u07a6\u0782\u07b0_\u0784\u07aa\u078b\u07a6_\u0784\u07aa\u0783\u07a7_\u0780\u07aa\u0786\u07aa_\u0780\u07ae\u0782\u07a8".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0789\u0786|\u0789\u078a/,isPM:function(t){return"\u0789\u078a"===t},meridiem:function(t,e,n){return t<12?"\u0789\u0786":"\u0789\u078a"},calendar:{sameDay:"[\u0789\u07a8\u0787\u07a6\u078b\u07aa] LT",nextDay:"[\u0789\u07a7\u078b\u07a6\u0789\u07a7] LT",nextWeek:"dddd LT",lastDay:"[\u0787\u07a8\u0787\u07b0\u0794\u07ac] LT",lastWeek:"[\u078a\u07a7\u0787\u07a8\u078c\u07aa\u0788\u07a8] dddd LT",sameElse:"L"},relativeTime:{future:"\u078c\u07ac\u0783\u07ad\u078e\u07a6\u0787\u07a8 %s",past:"\u0786\u07aa\u0783\u07a8\u0782\u07b0 %s",s:"\u0790\u07a8\u0786\u07aa\u0782\u07b0\u078c\u07aa\u0786\u07ae\u0785\u07ac\u0787\u07b0",ss:"d% \u0790\u07a8\u0786\u07aa\u0782\u07b0\u078c\u07aa",m:"\u0789\u07a8\u0782\u07a8\u0793\u07ac\u0787\u07b0",mm:"\u0789\u07a8\u0782\u07a8\u0793\u07aa %d",h:"\u078e\u07a6\u0791\u07a8\u0787\u07a8\u0783\u07ac\u0787\u07b0",hh:"\u078e\u07a6\u0791\u07a8\u0787\u07a8\u0783\u07aa %d",d:"\u078b\u07aa\u0788\u07a6\u0780\u07ac\u0787\u07b0",dd:"\u078b\u07aa\u0788\u07a6\u0790\u07b0 %d",M:"\u0789\u07a6\u0780\u07ac\u0787\u07b0",MM:"\u0789\u07a6\u0790\u07b0 %d",y:"\u0787\u07a6\u0780\u07a6\u0783\u07ac\u0787\u07b0",yy:"\u0787\u07a6\u0780\u07a6\u0783\u07aa %d"},preparse:function(t){return t.replace(/\u060c/g,",")},postformat:function(t){return t.replace(/,/g,"\u060c")},week:{dow:7,doy:12}})}(n(30381))},50837:function(t,e,n){!function(t){"use strict";function e(t){return"undefined"!=typeof Function&&t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}t.defineLocale("el",{monthsNominativeEl:"\u0399\u03b1\u03bd\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2_\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2_\u039c\u03ac\u03c1\u03c4\u03b9\u03bf\u03c2_\u0391\u03c0\u03c1\u03af\u03bb\u03b9\u03bf\u03c2_\u039c\u03ac\u03b9\u03bf\u03c2_\u0399\u03bf\u03cd\u03bd\u03b9\u03bf\u03c2_\u0399\u03bf\u03cd\u03bb\u03b9\u03bf\u03c2_\u0391\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2_\u03a3\u03b5\u03c0\u03c4\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2_\u039f\u03ba\u03c4\u03ce\u03b2\u03c1\u03b9\u03bf\u03c2_\u039d\u03bf\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2_\u0394\u03b5\u03ba\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2".split("_"),monthsGenitiveEl:"\u0399\u03b1\u03bd\u03bf\u03c5\u03b1\u03c1\u03af\u03bf\u03c5_\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03b1\u03c1\u03af\u03bf\u03c5_\u039c\u03b1\u03c1\u03c4\u03af\u03bf\u03c5_\u0391\u03c0\u03c1\u03b9\u03bb\u03af\u03bf\u03c5_\u039c\u03b1\u0390\u03bf\u03c5_\u0399\u03bf\u03c5\u03bd\u03af\u03bf\u03c5_\u0399\u03bf\u03c5\u03bb\u03af\u03bf\u03c5_\u0391\u03c5\u03b3\u03bf\u03cd\u03c3\u03c4\u03bf\u03c5_\u03a3\u03b5\u03c0\u03c4\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5_\u039f\u03ba\u03c4\u03c9\u03b2\u03c1\u03af\u03bf\u03c5_\u039d\u03bf\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5_\u0394\u03b5\u03ba\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5".split("_"),months:function(t,e){return t?"string"==typeof e&&/D/.test(e.substring(0,e.indexOf("MMMM")))?this._monthsGenitiveEl[t.month()]:this._monthsNominativeEl[t.month()]:this._monthsNominativeEl},monthsShort:"\u0399\u03b1\u03bd_\u03a6\u03b5\u03b2_\u039c\u03b1\u03c1_\u0391\u03c0\u03c1_\u039c\u03b1\u03ca_\u0399\u03bf\u03c5\u03bd_\u0399\u03bf\u03c5\u03bb_\u0391\u03c5\u03b3_\u03a3\u03b5\u03c0_\u039f\u03ba\u03c4_\u039d\u03bf\u03b5_\u0394\u03b5\u03ba".split("_"),weekdays:"\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae_\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1_\u03a4\u03c1\u03af\u03c4\u03b7_\u03a4\u03b5\u03c4\u03ac\u03c1\u03c4\u03b7_\u03a0\u03ad\u03bc\u03c0\u03c4\u03b7_\u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae_\u03a3\u03ac\u03b2\u03b2\u03b1\u03c4\u03bf".split("_"),weekdaysShort:"\u039a\u03c5\u03c1_\u0394\u03b5\u03c5_\u03a4\u03c1\u03b9_\u03a4\u03b5\u03c4_\u03a0\u03b5\u03bc_\u03a0\u03b1\u03c1_\u03a3\u03b1\u03b2".split("_"),weekdaysMin:"\u039a\u03c5_\u0394\u03b5_\u03a4\u03c1_\u03a4\u03b5_\u03a0\u03b5_\u03a0\u03b1_\u03a3\u03b1".split("_"),meridiem:function(t,e,n){return t>11?n?"\u03bc\u03bc":"\u039c\u039c":n?"\u03c0\u03bc":"\u03a0\u039c"},isPM:function(t){return"\u03bc"===(t+"").toLowerCase()[0]},meridiemParse:/[\u03a0\u039c]\.?\u039c?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[\u03a3\u03ae\u03bc\u03b5\u03c1\u03b1 {}] LT",nextDay:"[\u0391\u03cd\u03c1\u03b9\u03bf {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[\u03a7\u03b8\u03b5\u03c2 {}] LT",lastWeek:function(){return 6===this.day()?"[\u03c4\u03bf \u03c0\u03c1\u03bf\u03b7\u03b3\u03bf\u03cd\u03bc\u03b5\u03bd\u03bf] dddd [{}] LT":"[\u03c4\u03b7\u03bd \u03c0\u03c1\u03bf\u03b7\u03b3\u03bf\u03cd\u03bc\u03b5\u03bd\u03b7] dddd [{}] LT"},sameElse:"L"},calendar:function(t,n){var r=this._calendarEl[t],i=n&&n.hours();return e(r)&&(r=r.apply(n)),r.replace("{}",i%12==1?"\u03c3\u03c4\u03b7":"\u03c3\u03c4\u03b9\u03c2")},relativeTime:{future:"\u03c3\u03b5 %s",past:"%s \u03c0\u03c1\u03b9\u03bd",s:"\u03bb\u03af\u03b3\u03b1 \u03b4\u03b5\u03c5\u03c4\u03b5\u03c1\u03cc\u03bb\u03b5\u03c0\u03c4\u03b1",ss:"%d \u03b4\u03b5\u03c5\u03c4\u03b5\u03c1\u03cc\u03bb\u03b5\u03c0\u03c4\u03b1",m:"\u03ad\u03bd\u03b1 \u03bb\u03b5\u03c0\u03c4\u03cc",mm:"%d \u03bb\u03b5\u03c0\u03c4\u03ac",h:"\u03bc\u03af\u03b1 \u03ce\u03c1\u03b1",hh:"%d \u03ce\u03c1\u03b5\u03c2",d:"\u03bc\u03af\u03b1 \u03bc\u03ad\u03c1\u03b1",dd:"%d \u03bc\u03ad\u03c1\u03b5\u03c2",M:"\u03ad\u03bd\u03b1\u03c2 \u03bc\u03ae\u03bd\u03b1\u03c2",MM:"%d \u03bc\u03ae\u03bd\u03b5\u03c2",y:"\u03ad\u03bd\u03b1\u03c2 \u03c7\u03c1\u03cc\u03bd\u03bf\u03c2",yy:"%d \u03c7\u03c1\u03cc\u03bd\u03b9\u03b1"},dayOfMonthOrdinalParse:/\d{1,2}\u03b7/,ordinal:"%d\u03b7",week:{dow:1,doy:4}})}(n(30381))},78348:function(t,e,n){!function(t){"use strict";t.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:0,doy:4}})}(n(30381))},77925:function(t,e,n){!function(t){"use strict";t.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}})}(n(30381))},22243:function(t,e,n){!function(t){"use strict";t.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},46436:function(t,e,n){!function(t){"use strict";t.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},47207:function(t,e,n){!function(t){"use strict";t.defineLocale("en-il",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}})}(n(30381))},44175:function(t,e,n){!function(t){"use strict";t.defineLocale("en-in",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:0,doy:6}})}(n(30381))},76319:function(t,e,n){!function(t){"use strict";t.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},31662:function(t,e,n){!function(t){"use strict";t.defineLocale("en-sg",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},92915:function(t,e,n){!function(t){"use strict";t.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_a\u016dgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mart_apr_maj_jun_jul_a\u016dg_sept_okt_nov_dec".split("_"),weekdays:"diman\u0109o_lundo_mardo_merkredo_\u0135a\u016ddo_vendredo_sabato".split("_"),weekdaysShort:"dim_lun_mard_merk_\u0135a\u016d_ven_sab".split("_"),weekdaysMin:"di_lu_ma_me_\u0135a_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"[la] D[-an de] MMMM, YYYY",LLL:"[la] D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd[n], [la] D[-an de] MMMM, YYYY HH:mm",llll:"ddd, [la] D[-an de] MMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(t){return"p"===t.charAt(0).toLowerCase()},meridiem:function(t,e,n){return t>11?n?"p.t.m.":"P.T.M.":n?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodia\u016d je] LT",nextDay:"[Morga\u016d je] LT",nextWeek:"dddd[n je] LT",lastDay:"[Hiera\u016d je] LT",lastWeek:"[pasintan] dddd[n je] LT",sameElse:"L"},relativeTime:{future:"post %s",past:"anta\u016d %s",s:"kelkaj sekundoj",ss:"%d sekundoj",m:"unu minuto",mm:"%d minutoj",h:"unu horo",hh:"%d horoj",d:"unu tago",dd:"%d tagoj",M:"unu monato",MM:"%d monatoj",y:"unu jaro",yy:"%d jaroj"},dayOfMonthOrdinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}})}(n(30381))},55251:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-do",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_mi\xe9rcoles_jueves_viernes_s\xe1bado".split("_"),weekdaysShort:"dom._lun._mar._mi\xe9._jue._vie._s\xe1b.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_s\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[ma\xf1ana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un d\xeda",dd:"%d d\xedas",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un a\xf1o",yy:"%d a\xf1os"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4}})}(n(30381))},96112:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-mx",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_mi\xe9rcoles_jueves_viernes_s\xe1bado".split("_"),weekdaysShort:"dom._lun._mar._mi\xe9._jue._vie._s\xe1b.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_s\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[ma\xf1ana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un d\xeda",dd:"%d d\xedas",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un a\xf1o",yy:"%d a\xf1os"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:0,doy:4},invalidDate:"Fecha inv\xe1lida"})}(n(30381))},71146:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es-us",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_mi\xe9rcoles_jueves_viernes_s\xe1bado".split("_"),weekdaysShort:"dom._lun._mar._mi\xe9._jue._vie._s\xe1b.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_s\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"MM/DD/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[ma\xf1ana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un d\xeda",dd:"%d d\xedas",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un a\xf1o",yy:"%d a\xf1os"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:0,doy:6}})}(n(30381))},55655:function(t,e,n){!function(t){"use strict";var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),r=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],i=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;t.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"domingo_lunes_martes_mi\xe9rcoles_jueves_viernes_s\xe1bado".split("_"),weekdaysShort:"dom._lun._mar._mi\xe9._jue._vie._s\xe1b.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_s\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[ma\xf1ana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un d\xeda",dd:"%d d\xedas",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un a\xf1o",yy:"%d a\xf1os"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4},invalidDate:"Fecha inv\xe1lida"})}(n(30381))},5603:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["m\xf5ne sekundi","m\xf5ni sekund","paar sekundit"],ss:[t+"sekundi",t+"sekundit"],m:["\xfche minuti","\xfcks minut"],mm:[t+" minuti",t+" minutit"],h:["\xfche tunni","tund aega","\xfcks tund"],hh:[t+" tunni",t+" tundi"],d:["\xfche p\xe4eva","\xfcks p\xe4ev"],M:["kuu aja","kuu aega","\xfcks kuu"],MM:[t+" kuu",t+" kuud"],y:["\xfche aasta","aasta","\xfcks aasta"],yy:[t+" aasta",t+" aastat"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}t.defineLocale("et",{months:"jaanuar_veebruar_m\xe4rts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_m\xe4rts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"p\xfchap\xe4ev_esmasp\xe4ev_teisip\xe4ev_kolmap\xe4ev_neljap\xe4ev_reede_laup\xe4ev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[T\xe4na,] LT",nextDay:"[Homme,] LT",nextWeek:"[J\xe4rgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s p\xe4rast",past:"%s tagasi",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:"%d p\xe4eva",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},77763:function(t,e,n){!function(t){"use strict";t.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",ss:"%d segundo",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},76959:function(t,e,n){!function(t){"use strict";var e={1:"\u06f1",2:"\u06f2",3:"\u06f3",4:"\u06f4",5:"\u06f5",6:"\u06f6",7:"\u06f7",8:"\u06f8",9:"\u06f9",0:"\u06f0"},n={"\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9","\u06f0":"0"};t.defineLocale("fa",{months:"\u0698\u0627\u0646\u0648\u06cc\u0647_\u0641\u0648\u0631\u06cc\u0647_\u0645\u0627\u0631\u0633_\u0622\u0648\u0631\u06cc\u0644_\u0645\u0647_\u0698\u0648\u0626\u0646_\u0698\u0648\u0626\u06cc\u0647_\u0627\u0648\u062a_\u0633\u067e\u062a\u0627\u0645\u0628\u0631_\u0627\u06a9\u062a\u0628\u0631_\u0646\u0648\u0627\u0645\u0628\u0631_\u062f\u0633\u0627\u0645\u0628\u0631".split("_"),monthsShort:"\u0698\u0627\u0646\u0648\u06cc\u0647_\u0641\u0648\u0631\u06cc\u0647_\u0645\u0627\u0631\u0633_\u0622\u0648\u0631\u06cc\u0644_\u0645\u0647_\u0698\u0648\u0626\u0646_\u0698\u0648\u0626\u06cc\u0647_\u0627\u0648\u062a_\u0633\u067e\u062a\u0627\u0645\u0628\u0631_\u0627\u06a9\u062a\u0628\u0631_\u0646\u0648\u0627\u0645\u0628\u0631_\u062f\u0633\u0627\u0645\u0628\u0631".split("_"),weekdays:"\u06cc\u06a9\u200c\u0634\u0646\u0628\u0647_\u062f\u0648\u0634\u0646\u0628\u0647_\u0633\u0647\u200c\u0634\u0646\u0628\u0647_\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647_\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647_\u062c\u0645\u0639\u0647_\u0634\u0646\u0628\u0647".split("_"),weekdaysShort:"\u06cc\u06a9\u200c\u0634\u0646\u0628\u0647_\u062f\u0648\u0634\u0646\u0628\u0647_\u0633\u0647\u200c\u0634\u0646\u0628\u0647_\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647_\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647_\u062c\u0645\u0639\u0647_\u0634\u0646\u0628\u0647".split("_"),weekdaysMin:"\u06cc_\u062f_\u0633_\u0686_\u067e_\u062c_\u0634".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/\u0642\u0628\u0644 \u0627\u0632 \u0638\u0647\u0631|\u0628\u0639\u062f \u0627\u0632 \u0638\u0647\u0631/,isPM:function(t){return/\u0628\u0639\u062f \u0627\u0632 \u0638\u0647\u0631/.test(t)},meridiem:function(t,e,n){return t<12?"\u0642\u0628\u0644 \u0627\u0632 \u0638\u0647\u0631":"\u0628\u0639\u062f \u0627\u0632 \u0638\u0647\u0631"},calendar:{sameDay:"[\u0627\u0645\u0631\u0648\u0632 \u0633\u0627\u0639\u062a] LT",nextDay:"[\u0641\u0631\u062f\u0627 \u0633\u0627\u0639\u062a] LT",nextWeek:"dddd [\u0633\u0627\u0639\u062a] LT",lastDay:"[\u062f\u06cc\u0631\u0648\u0632 \u0633\u0627\u0639\u062a] LT",lastWeek:"dddd [\u067e\u06cc\u0634] [\u0633\u0627\u0639\u062a] LT",sameElse:"L"},relativeTime:{future:"\u062f\u0631 %s",past:"%s \u067e\u06cc\u0634",s:"\u0686\u0646\u062f \u062b\u0627\u0646\u06cc\u0647",ss:"%d \u062b\u0627\u0646\u06cc\u0647",m:"\u06cc\u06a9 \u062f\u0642\u06cc\u0642\u0647",mm:"%d \u062f\u0642\u06cc\u0642\u0647",h:"\u06cc\u06a9 \u0633\u0627\u0639\u062a",hh:"%d \u0633\u0627\u0639\u062a",d:"\u06cc\u06a9 \u0631\u0648\u0632",dd:"%d \u0631\u0648\u0632",M:"\u06cc\u06a9 \u0645\u0627\u0647",MM:"%d \u0645\u0627\u0647",y:"\u06cc\u06a9 \u0633\u0627\u0644",yy:"%d \u0633\u0627\u0644"},preparse:function(t){return t.replace(/[\u06f0-\u06f9]/g,(function(t){return n[t]})).replace(/\u060c/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"\u060c")},dayOfMonthOrdinalParse:/\d{1,2}\u0645/,ordinal:"%d\u0645",week:{dow:6,doy:12}})}(n(30381))},11897:function(t,e,n){!function(t){"use strict";var e="nolla yksi kaksi kolme nelj\xe4 viisi kuusi seitsem\xe4n kahdeksan yhdeks\xe4n".split(" "),n=["nolla","yhden","kahden","kolmen","nelj\xe4n","viiden","kuuden",e[7],e[8],e[9]];function r(t,e,n,r){var a="";switch(n){case"s":return r?"muutaman sekunnin":"muutama sekunti";case"ss":a=r?"sekunnin":"sekuntia";break;case"m":return r?"minuutin":"minuutti";case"mm":a=r?"minuutin":"minuuttia";break;case"h":return r?"tunnin":"tunti";case"hh":a=r?"tunnin":"tuntia";break;case"d":return r?"p\xe4iv\xe4n":"p\xe4iv\xe4";case"dd":a=r?"p\xe4iv\xe4n":"p\xe4iv\xe4\xe4";break;case"M":return r?"kuukauden":"kuukausi";case"MM":a=r?"kuukauden":"kuukautta";break;case"y":return r?"vuoden":"vuosi";case"yy":a=r?"vuoden":"vuotta"}return a=i(t,r)+" "+a}function i(t,r){return t<10?r?n[t]:e[t]:t}t.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kes\xe4kuu_hein\xe4kuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kes\xe4_hein\xe4_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[t\xe4n\xe4\xe4n] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s p\xe4\xe4st\xe4",past:"%s sitten",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},42549:function(t,e,n){!function(t){"use strict";t.defineLocale("fil",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},94694:function(t,e,n){!function(t){"use strict";t.defineLocale("fo",{months:"januar_februar_mars_apr\xedl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_m\xe1nadagur_t\xfdsdagur_mikudagur_h\xf3sdagur_fr\xedggjadagur_leygardagur".split("_"),weekdaysShort:"sun_m\xe1n_t\xfds_mik_h\xf3s_fr\xed_ley".split("_"),weekdaysMin:"su_m\xe1_t\xfd_mi_h\xf3_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[\xcd dag kl.] LT",nextDay:"[\xcd morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[\xcd gj\xe1r kl.] LT",lastWeek:"[s\xed\xf0stu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s s\xed\xf0ani",s:"f\xe1 sekund",ss:"%d sekundir",m:"ein minuttur",mm:"%d minuttir",h:"ein t\xedmi",hh:"%d t\xedmar",d:"ein dagur",dd:"%d dagar",M:"ein m\xe1na\xf0ur",MM:"%d m\xe1na\xf0ir",y:"eitt \xe1r",yy:"%d \xe1r"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},63049:function(t,e,n){!function(t){"use strict";t.defineLocale("fr-ca",{months:"janvier_f\xe9vrier_mars_avril_mai_juin_juillet_ao\xfbt_septembre_octobre_novembre_d\xe9cembre".split("_"),monthsShort:"janv._f\xe9vr._mars_avr._mai_juin_juil._ao\xfbt_sept._oct._nov._d\xe9c.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd\u2019hui \xe0] LT",nextDay:"[Demain \xe0] LT",nextWeek:"dddd [\xe0] LT",lastDay:"[Hier \xe0] LT",lastWeek:"dddd [dernier \xe0] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(t,e){switch(e){default:case"M":case"Q":case"D":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}}})}(n(30381))},52330:function(t,e,n){!function(t){"use strict";t.defineLocale("fr-ch",{months:"janvier_f\xe9vrier_mars_avril_mai_juin_juillet_ao\xfbt_septembre_octobre_novembre_d\xe9cembre".split("_"),monthsShort:"janv._f\xe9vr._mars_avr._mai_juin_juil._ao\xfbt_sept._oct._nov._d\xe9c.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd\u2019hui \xe0] LT",nextDay:"[Demain \xe0] LT",nextWeek:"dddd [\xe0] LT",lastDay:"[Hier \xe0] LT",lastWeek:"dddd [dernier \xe0] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(t,e){switch(e){default:case"M":case"Q":case"D":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}})}(n(30381))},94470:function(t,e,n){!function(t){"use strict";var e=/^(janvier|f\xe9vrier|mars|avril|mai|juin|juillet|ao\xfbt|septembre|octobre|novembre|d\xe9cembre)/i,n=/(janv\.?|f\xe9vr\.?|mars|avr\.?|mai|juin|juil\.?|ao\xfbt|sept\.?|oct\.?|nov\.?|d\xe9c\.?)/i,r=/(janv\.?|f\xe9vr\.?|mars|avr\.?|mai|juin|juil\.?|ao\xfbt|sept\.?|oct\.?|nov\.?|d\xe9c\.?|janvier|f\xe9vrier|mars|avril|mai|juin|juillet|ao\xfbt|septembre|octobre|novembre|d\xe9cembre)/i,i=[/^janv/i,/^f\xe9vr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^ao\xfbt/i,/^sept/i,/^oct/i,/^nov/i,/^d\xe9c/i];t.defineLocale("fr",{months:"janvier_f\xe9vrier_mars_avril_mai_juin_juillet_ao\xfbt_septembre_octobre_novembre_d\xe9cembre".split("_"),monthsShort:"janv._f\xe9vr._mars_avr._mai_juin_juil._ao\xfbt_sept._oct._nov._d\xe9c.".split("_"),monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:e,monthsShortStrictRegex:n,monthsParse:i,longMonthsParse:i,shortMonthsParse:i,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd\u2019hui \xe0] LT",nextDay:"[Demain \xe0] LT",nextWeek:"dddd [\xe0] LT",lastDay:"[Hier \xe0] LT",lastWeek:"dddd [dernier \xe0] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(t,e){switch(e){case"D":return t+(1===t?"er":"");default:case"M":case"Q":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}})}(n(30381))},5044:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_"),n="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_");t.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[\xf4fr\xfbne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",ss:"%d sekonden",m:"ien min\xfat",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},29295:function(t,e,n){!function(t){"use strict";var e=["Ean\xe1ir","Feabhra","M\xe1rta","Aibre\xe1n","Bealtaine","Meitheamh","I\xfail","L\xfanasa","Me\xe1n F\xf3mhair","Deireadh F\xf3mhair","Samhain","Nollaig"],n=["Ean","Feabh","M\xe1rt","Aib","Beal","Meith","I\xfail","L\xfan","M.F.","D.F.","Samh","Noll"],r=["D\xe9 Domhnaigh","D\xe9 Luain","D\xe9 M\xe1irt","D\xe9 C\xe9adaoin","D\xe9ardaoin","D\xe9 hAoine","D\xe9 Sathairn"],i=["Domh","Luan","M\xe1irt","C\xe9ad","D\xe9ar","Aoine","Sath"],a=["Do","Lu","M\xe1","C\xe9","D\xe9","A","Sa"];t.defineLocale("ga",{months:e,monthsShort:n,monthsParseExact:!0,weekdays:r,weekdaysShort:i,weekdaysMin:a,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Inniu ag] LT",nextDay:"[Am\xe1rach ag] LT",nextWeek:"dddd [ag] LT",lastDay:"[Inn\xe9 ag] LT",lastWeek:"dddd [seo caite] [ag] LT",sameElse:"L"},relativeTime:{future:"i %s",past:"%s \xf3 shin",s:"c\xfapla soicind",ss:"%d soicind",m:"n\xf3im\xe9ad",mm:"%d n\xf3im\xe9ad",h:"uair an chloig",hh:"%d uair an chloig",d:"l\xe1",dd:"%d l\xe1",M:"m\xed",MM:"%d m\xedonna",y:"bliain",yy:"%d bliain"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(t){return t+(1===t?"d":t%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n(30381))},2101:function(t,e,n){!function(t){"use strict";var e=["Am Faoilleach","An Gearran","Am M\xe0rt","An Giblean","An C\xe8itean","An t-\xd2gmhios","An t-Iuchar","An L\xf9nastal","An t-Sultain","An D\xe0mhair","An t-Samhain","An D\xf9bhlachd"],n=["Faoi","Gear","M\xe0rt","Gibl","C\xe8it","\xd2gmh","Iuch","L\xf9n","Sult","D\xe0mh","Samh","D\xf9bh"],r=["Did\xf2mhnaich","Diluain","Dim\xe0irt","Diciadain","Diardaoin","Dihaoine","Disathairne"],i=["Did","Dil","Dim","Dic","Dia","Dih","Dis"],a=["D\xf2","Lu","M\xe0","Ci","Ar","Ha","Sa"];t.defineLocale("gd",{months:e,monthsShort:n,monthsParseExact:!0,weekdays:r,weekdaysShort:i,weekdaysMin:a,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-m\xe0ireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-d\xe8 aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",ss:"%d diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"m\xecos",MM:"%d m\xecosan",y:"bliadhna",yy:"%d bliadhna"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(t){return t+(1===t?"d":t%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n(30381))},38794:function(t,e,n){!function(t){"use strict";t.defineLocale("gl",{months:"xaneiro_febreiro_marzo_abril_maio_xu\xf1o_xullo_agosto_setembro_outubro_novembro_decembro".split("_"),monthsShort:"xan._feb._mar._abr._mai._xu\xf1._xul._ago._set._out._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"domingo_luns_martes_m\xe9rcores_xoves_venres_s\xe1bado".split("_"),weekdaysShort:"dom._lun._mar._m\xe9r._xov._ven._s\xe1b.".split("_"),weekdaysMin:"do_lu_ma_m\xe9_xo_ve_s\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"\xe1s":"\xe1")+"] LT"},nextDay:function(){return"[ma\xf1\xe1 "+(1!==this.hours()?"\xe1s":"\xe1")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"\xe1s":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"\xe1":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"\xe1s":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(t){return 0===t.indexOf("un")?"n"+t:"en "+t},past:"hai %s",s:"uns segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un d\xeda",dd:"%d d\xedas",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4}})}(n(30381))},27884:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["\u0925\u094b\u0921\u092f\u093e \u0938\u0945\u0915\u0902\u0921\u093e\u0902\u0928\u0940","\u0925\u094b\u0921\u0947 \u0938\u0945\u0915\u0902\u0921"],ss:[t+" \u0938\u0945\u0915\u0902\u0921\u093e\u0902\u0928\u0940",t+" \u0938\u0945\u0915\u0902\u0921"],m:["\u090f\u0915\u093e \u092e\u093f\u0923\u091f\u093e\u0928","\u090f\u0915 \u092e\u093f\u0928\u0942\u091f"],mm:[t+" \u092e\u093f\u0923\u091f\u093e\u0902\u0928\u0940",t+" \u092e\u093f\u0923\u091f\u093e\u0902"],h:["\u090f\u0915\u093e \u0935\u0930\u093e\u0928","\u090f\u0915 \u0935\u0930"],hh:[t+" \u0935\u0930\u093e\u0902\u0928\u0940",t+" \u0935\u0930\u093e\u0902"],d:["\u090f\u0915\u093e \u0926\u093f\u0938\u093e\u0928","\u090f\u0915 \u0926\u0940\u0938"],dd:[t+" \u0926\u093f\u0938\u093e\u0902\u0928\u0940",t+" \u0926\u0940\u0938"],M:["\u090f\u0915\u093e \u092e\u094d\u0939\u092f\u0928\u094d\u092f\u093e\u0928","\u090f\u0915 \u092e\u094d\u0939\u092f\u0928\u094b"],MM:[t+" \u092e\u094d\u0939\u092f\u0928\u094d\u092f\u093e\u0928\u0940",t+" \u092e\u094d\u0939\u092f\u0928\u0947"],y:["\u090f\u0915\u093e \u0935\u0930\u094d\u0938\u093e\u0928","\u090f\u0915 \u0935\u0930\u094d\u0938"],yy:[t+" \u0935\u0930\u094d\u0938\u093e\u0902\u0928\u0940",t+" \u0935\u0930\u094d\u0938\u093e\u0902"]};return r?i[n][0]:i[n][1]}t.defineLocale("gom-deva",{months:{standalone:"\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940_\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940_\u092e\u093e\u0930\u094d\u091a_\u090f\u092a\u094d\u0930\u0940\u0932_\u092e\u0947_\u091c\u0942\u0928_\u091c\u0941\u0932\u092f_\u0911\u0917\u0938\u094d\u091f_\u0938\u092a\u094d\u091f\u0947\u0902\u092c\u0930_\u0911\u0915\u094d\u091f\u094b\u092c\u0930_\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930_\u0921\u093f\u0938\u0947\u0902\u092c\u0930".split("_"),format:"\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940\u091a\u094d\u092f\u093e_\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940\u091a\u094d\u092f\u093e_\u092e\u093e\u0930\u094d\u091a\u093e\u091a\u094d\u092f\u093e_\u090f\u092a\u094d\u0930\u0940\u0932\u093e\u091a\u094d\u092f\u093e_\u092e\u0947\u092f\u093e\u091a\u094d\u092f\u093e_\u091c\u0942\u0928\u093e\u091a\u094d\u092f\u093e_\u091c\u0941\u0932\u092f\u093e\u091a\u094d\u092f\u093e_\u0911\u0917\u0938\u094d\u091f\u093e\u091a\u094d\u092f\u093e_\u0938\u092a\u094d\u091f\u0947\u0902\u092c\u0930\u093e\u091a\u094d\u092f\u093e_\u0911\u0915\u094d\u091f\u094b\u092c\u0930\u093e\u091a\u094d\u092f\u093e_\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930\u093e\u091a\u094d\u092f\u093e_\u0921\u093f\u0938\u0947\u0902\u092c\u0930\u093e\u091a\u094d\u092f\u093e".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"\u091c\u093e\u0928\u0947._\u092b\u0947\u092c\u094d\u0930\u0941._\u092e\u093e\u0930\u094d\u091a_\u090f\u092a\u094d\u0930\u0940._\u092e\u0947_\u091c\u0942\u0928_\u091c\u0941\u0932._\u0911\u0917._\u0938\u092a\u094d\u091f\u0947\u0902._\u0911\u0915\u094d\u091f\u094b._\u0928\u094b\u0935\u094d\u0939\u0947\u0902._\u0921\u093f\u0938\u0947\u0902.".split("_"),monthsParseExact:!0,weekdays:"\u0906\u092f\u0924\u093e\u0930_\u0938\u094b\u092e\u093e\u0930_\u092e\u0902\u0917\u0933\u093e\u0930_\u092c\u0941\u0927\u0935\u093e\u0930_\u092c\u093f\u0930\u0947\u0938\u094d\u0924\u093e\u0930_\u0938\u0941\u0915\u094d\u0930\u093e\u0930_\u0936\u0947\u0928\u0935\u093e\u0930".split("_"),weekdaysShort:"\u0906\u092f\u0924._\u0938\u094b\u092e._\u092e\u0902\u0917\u0933._\u092c\u0941\u0927._\u092c\u094d\u0930\u0947\u0938\u094d\u0924._\u0938\u0941\u0915\u094d\u0930._\u0936\u0947\u0928.".split("_"),weekdaysMin:"\u0906_\u0938\u094b_\u092e\u0902_\u092c\u0941_\u092c\u094d\u0930\u0947_\u0938\u0941_\u0936\u0947".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [\u0935\u093e\u091c\u0924\u093e\u0902]",LTS:"A h:mm:ss [\u0935\u093e\u091c\u0924\u093e\u0902]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [\u0935\u093e\u091c\u0924\u093e\u0902]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [\u0935\u093e\u091c\u0924\u093e\u0902]",llll:"ddd, D MMM YYYY, A h:mm [\u0935\u093e\u091c\u0924\u093e\u0902]"},calendar:{sameDay:"[\u0906\u092f\u091c] LT",nextDay:"[\u092b\u093e\u0932\u094d\u092f\u093e\u0902] LT",nextWeek:"[\u092b\u0941\u0921\u0932\u094b] dddd[,] LT",lastDay:"[\u0915\u093e\u0932] LT",lastWeek:"[\u092b\u093e\u091f\u0932\u094b] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s \u0906\u0926\u0940\u0902",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(\u0935\u0947\u0930)/,ordinal:function(t,e){return"D"===e?t+"\u0935\u0947\u0930":t},week:{dow:0,doy:3},meridiemParse:/\u0930\u093e\u0924\u0940|\u0938\u0915\u093e\u0933\u0940\u0902|\u0926\u0928\u092a\u093e\u0930\u093e\u0902|\u0938\u093e\u0902\u091c\u0947/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0930\u093e\u0924\u0940"===e?t<4?t:t+12:"\u0938\u0915\u093e\u0933\u0940\u0902"===e?t:"\u0926\u0928\u092a\u093e\u0930\u093e\u0902"===e?t>12?t:t+12:"\u0938\u093e\u0902\u091c\u0947"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u0930\u093e\u0924\u0940":t<12?"\u0938\u0915\u093e\u0933\u0940\u0902":t<16?"\u0926\u0928\u092a\u093e\u0930\u093e\u0902":t<20?"\u0938\u093e\u0902\u091c\u0947":"\u0930\u093e\u0924\u0940"}})}(n(30381))},23168:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["thoddea sekondamni","thodde sekond"],ss:[t+" sekondamni",t+" sekond"],m:["eka mintan","ek minut"],mm:[t+" mintamni",t+" mintam"],h:["eka voran","ek vor"],hh:[t+" voramni",t+" voram"],d:["eka disan","ek dis"],dd:[t+" disamni",t+" dis"],M:["eka mhoinean","ek mhoino"],MM:[t+" mhoineamni",t+" mhoine"],y:["eka vorsan","ek voros"],yy:[t+" vorsamni",t+" vorsam"]};return r?i[n][0]:i[n][1]}t.defineLocale("gom-latn",{months:{standalone:"Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),format:"Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split("_"),weekdaysShort:"Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),weekdaysMin:"Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [vazta]",LTS:"A h:mm:ss [vazta]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [vazta]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [vazta]",llll:"ddd, D MMM YYYY, A h:mm [vazta]"},calendar:{sameDay:"[Aiz] LT",nextDay:"[Faleam] LT",nextWeek:"[Fuddlo] dddd[,] LT",lastDay:"[Kal] LT",lastWeek:"[Fattlo] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s adim",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}(er)/,ordinal:function(t,e){return"D"===e?t+"er":t},week:{dow:0,doy:3},meridiemParse:/rati|sokallim|donparam|sanje/,meridiemHour:function(t,e){return 12===t&&(t=0),"rati"===e?t<4?t:t+12:"sokallim"===e?t:"donparam"===e?t>12?t:t+12:"sanje"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"rati":t<12?"sokallim":t<16?"donparam":t<20?"sanje":"rati"}})}(n(30381))},95349:function(t,e,n){!function(t){"use strict";var e={1:"\u0ae7",2:"\u0ae8",3:"\u0ae9",4:"\u0aea",5:"\u0aeb",6:"\u0aec",7:"\u0aed",8:"\u0aee",9:"\u0aef",0:"\u0ae6"},n={"\u0ae7":"1","\u0ae8":"2","\u0ae9":"3","\u0aea":"4","\u0aeb":"5","\u0aec":"6","\u0aed":"7","\u0aee":"8","\u0aef":"9","\u0ae6":"0"};t.defineLocale("gu",{months:"\u0a9c\u0abe\u0aa8\u0acd\u0aaf\u0ac1\u0a86\u0ab0\u0ac0_\u0aab\u0ac7\u0aac\u0acd\u0ab0\u0ac1\u0a86\u0ab0\u0ac0_\u0aae\u0abe\u0ab0\u0acd\u0a9a_\u0a8f\u0aaa\u0acd\u0ab0\u0abf\u0ab2_\u0aae\u0ac7_\u0a9c\u0ac2\u0aa8_\u0a9c\u0ac1\u0ab2\u0abe\u0a88_\u0a91\u0a97\u0ab8\u0acd\u0a9f_\u0ab8\u0aaa\u0acd\u0a9f\u0ac7\u0aae\u0acd\u0aac\u0ab0_\u0a91\u0a95\u0acd\u0a9f\u0acd\u0aac\u0ab0_\u0aa8\u0ab5\u0ac7\u0aae\u0acd\u0aac\u0ab0_\u0aa1\u0abf\u0ab8\u0ac7\u0aae\u0acd\u0aac\u0ab0".split("_"),monthsShort:"\u0a9c\u0abe\u0aa8\u0acd\u0aaf\u0ac1._\u0aab\u0ac7\u0aac\u0acd\u0ab0\u0ac1._\u0aae\u0abe\u0ab0\u0acd\u0a9a_\u0a8f\u0aaa\u0acd\u0ab0\u0abf._\u0aae\u0ac7_\u0a9c\u0ac2\u0aa8_\u0a9c\u0ac1\u0ab2\u0abe._\u0a91\u0a97._\u0ab8\u0aaa\u0acd\u0a9f\u0ac7._\u0a91\u0a95\u0acd\u0a9f\u0acd._\u0aa8\u0ab5\u0ac7._\u0aa1\u0abf\u0ab8\u0ac7.".split("_"),monthsParseExact:!0,weekdays:"\u0ab0\u0ab5\u0abf\u0ab5\u0abe\u0ab0_\u0ab8\u0acb\u0aae\u0ab5\u0abe\u0ab0_\u0aae\u0a82\u0a97\u0ab3\u0ab5\u0abe\u0ab0_\u0aac\u0ac1\u0aa7\u0acd\u0ab5\u0abe\u0ab0_\u0a97\u0ac1\u0ab0\u0ac1\u0ab5\u0abe\u0ab0_\u0ab6\u0ac1\u0a95\u0acd\u0ab0\u0ab5\u0abe\u0ab0_\u0ab6\u0aa8\u0abf\u0ab5\u0abe\u0ab0".split("_"),weekdaysShort:"\u0ab0\u0ab5\u0abf_\u0ab8\u0acb\u0aae_\u0aae\u0a82\u0a97\u0ab3_\u0aac\u0ac1\u0aa7\u0acd_\u0a97\u0ac1\u0ab0\u0ac1_\u0ab6\u0ac1\u0a95\u0acd\u0ab0_\u0ab6\u0aa8\u0abf".split("_"),weekdaysMin:"\u0ab0_\u0ab8\u0acb_\u0aae\u0a82_\u0aac\u0ac1_\u0a97\u0ac1_\u0ab6\u0ac1_\u0ab6".split("_"),longDateFormat:{LT:"A h:mm \u0ab5\u0abe\u0a97\u0acd\u0aaf\u0ac7",LTS:"A h:mm:ss \u0ab5\u0abe\u0a97\u0acd\u0aaf\u0ac7",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u0ab5\u0abe\u0a97\u0acd\u0aaf\u0ac7",LLLL:"dddd, D MMMM YYYY, A h:mm \u0ab5\u0abe\u0a97\u0acd\u0aaf\u0ac7"},calendar:{sameDay:"[\u0a86\u0a9c] LT",nextDay:"[\u0a95\u0abe\u0ab2\u0ac7] LT",nextWeek:"dddd, LT",lastDay:"[\u0a97\u0a87\u0a95\u0abe\u0ab2\u0ac7] LT",lastWeek:"[\u0aaa\u0abe\u0a9b\u0ab2\u0abe] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0aae\u0abe",past:"%s \u0aaa\u0ab9\u0ac7\u0ab2\u0abe",s:"\u0a85\u0aae\u0ac1\u0a95 \u0aaa\u0ab3\u0acb",ss:"%d \u0ab8\u0ac7\u0a95\u0a82\u0aa1",m:"\u0a8f\u0a95 \u0aae\u0abf\u0aa8\u0abf\u0a9f",mm:"%d \u0aae\u0abf\u0aa8\u0abf\u0a9f",h:"\u0a8f\u0a95 \u0a95\u0ab2\u0abe\u0a95",hh:"%d \u0a95\u0ab2\u0abe\u0a95",d:"\u0a8f\u0a95 \u0aa6\u0abf\u0ab5\u0ab8",dd:"%d \u0aa6\u0abf\u0ab5\u0ab8",M:"\u0a8f\u0a95 \u0aae\u0ab9\u0abf\u0aa8\u0acb",MM:"%d \u0aae\u0ab9\u0abf\u0aa8\u0acb",y:"\u0a8f\u0a95 \u0ab5\u0ab0\u0acd\u0ab7",yy:"%d \u0ab5\u0ab0\u0acd\u0ab7"},preparse:function(t){return t.replace(/[\u0ae7\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef\u0ae6]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u0ab0\u0abe\u0aa4|\u0aac\u0aaa\u0acb\u0ab0|\u0ab8\u0ab5\u0abe\u0ab0|\u0ab8\u0abe\u0a82\u0a9c/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0ab0\u0abe\u0aa4"===e?t<4?t:t+12:"\u0ab8\u0ab5\u0abe\u0ab0"===e?t:"\u0aac\u0aaa\u0acb\u0ab0"===e?t>=10?t:t+12:"\u0ab8\u0abe\u0a82\u0a9c"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u0ab0\u0abe\u0aa4":t<10?"\u0ab8\u0ab5\u0abe\u0ab0":t<17?"\u0aac\u0aaa\u0acb\u0ab0":t<20?"\u0ab8\u0abe\u0a82\u0a9c":"\u0ab0\u0abe\u0aa4"},week:{dow:0,doy:6}})}(n(30381))},24206:function(t,e,n){!function(t){"use strict";t.defineLocale("he",{months:"\u05d9\u05e0\u05d5\u05d0\u05e8_\u05e4\u05d1\u05e8\u05d5\u05d0\u05e8_\u05de\u05e8\u05e5_\u05d0\u05e4\u05e8\u05d9\u05dc_\u05de\u05d0\u05d9_\u05d9\u05d5\u05e0\u05d9_\u05d9\u05d5\u05dc\u05d9_\u05d0\u05d5\u05d2\u05d5\u05e1\u05d8_\u05e1\u05e4\u05d8\u05de\u05d1\u05e8_\u05d0\u05d5\u05e7\u05d8\u05d5\u05d1\u05e8_\u05e0\u05d5\u05d1\u05de\u05d1\u05e8_\u05d3\u05e6\u05de\u05d1\u05e8".split("_"),monthsShort:"\u05d9\u05e0\u05d5\u05f3_\u05e4\u05d1\u05e8\u05f3_\u05de\u05e8\u05e5_\u05d0\u05e4\u05e8\u05f3_\u05de\u05d0\u05d9_\u05d9\u05d5\u05e0\u05d9_\u05d9\u05d5\u05dc\u05d9_\u05d0\u05d5\u05d2\u05f3_\u05e1\u05e4\u05d8\u05f3_\u05d0\u05d5\u05e7\u05f3_\u05e0\u05d5\u05d1\u05f3_\u05d3\u05e6\u05de\u05f3".split("_"),weekdays:"\u05e8\u05d0\u05e9\u05d5\u05df_\u05e9\u05e0\u05d9_\u05e9\u05dc\u05d9\u05e9\u05d9_\u05e8\u05d1\u05d9\u05e2\u05d9_\u05d7\u05de\u05d9\u05e9\u05d9_\u05e9\u05d9\u05e9\u05d9_\u05e9\u05d1\u05ea".split("_"),weekdaysShort:"\u05d0\u05f3_\u05d1\u05f3_\u05d2\u05f3_\u05d3\u05f3_\u05d4\u05f3_\u05d5\u05f3_\u05e9\u05f3".split("_"),weekdaysMin:"\u05d0_\u05d1_\u05d2_\u05d3_\u05d4_\u05d5_\u05e9".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [\u05d1]MMMM YYYY",LLL:"D [\u05d1]MMMM YYYY HH:mm",LLLL:"dddd, D [\u05d1]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[\u05d4\u05d9\u05d5\u05dd \u05d1\u05be]LT",nextDay:"[\u05de\u05d7\u05e8 \u05d1\u05be]LT",nextWeek:"dddd [\u05d1\u05e9\u05e2\u05d4] LT",lastDay:"[\u05d0\u05ea\u05de\u05d5\u05dc \u05d1\u05be]LT",lastWeek:"[\u05d1\u05d9\u05d5\u05dd] dddd [\u05d4\u05d0\u05d7\u05e8\u05d5\u05df \u05d1\u05e9\u05e2\u05d4] LT",sameElse:"L"},relativeTime:{future:"\u05d1\u05e2\u05d5\u05d3 %s",past:"\u05dc\u05e4\u05e0\u05d9 %s",s:"\u05de\u05e1\u05e4\u05e8 \u05e9\u05e0\u05d9\u05d5\u05ea",ss:"%d \u05e9\u05e0\u05d9\u05d5\u05ea",m:"\u05d3\u05e7\u05d4",mm:"%d \u05d3\u05e7\u05d5\u05ea",h:"\u05e9\u05e2\u05d4",hh:function(t){return 2===t?"\u05e9\u05e2\u05ea\u05d9\u05d9\u05dd":t+" \u05e9\u05e2\u05d5\u05ea"},d:"\u05d9\u05d5\u05dd",dd:function(t){return 2===t?"\u05d9\u05d5\u05de\u05d9\u05d9\u05dd":t+" \u05d9\u05de\u05d9\u05dd"},M:"\u05d7\u05d5\u05d3\u05e9",MM:function(t){return 2===t?"\u05d7\u05d5\u05d3\u05e9\u05d9\u05d9\u05dd":t+" \u05d7\u05d5\u05d3\u05e9\u05d9\u05dd"},y:"\u05e9\u05e0\u05d4",yy:function(t){return 2===t?"\u05e9\u05e0\u05ea\u05d9\u05d9\u05dd":t%10==0&&10!==t?t+" \u05e9\u05e0\u05d4":t+" \u05e9\u05e0\u05d9\u05dd"}},meridiemParse:/\u05d0\u05d7\u05d4"\u05e6|\u05dc\u05e4\u05e0\u05d4"\u05e6|\u05d0\u05d7\u05e8\u05d9 \u05d4\u05e6\u05d4\u05e8\u05d9\u05d9\u05dd|\u05dc\u05e4\u05e0\u05d9 \u05d4\u05e6\u05d4\u05e8\u05d9\u05d9\u05dd|\u05dc\u05e4\u05e0\u05d5\u05ea \u05d1\u05d5\u05e7\u05e8|\u05d1\u05d1\u05d5\u05e7\u05e8|\u05d1\u05e2\u05e8\u05d1/i,isPM:function(t){return/^(\u05d0\u05d7\u05d4"\u05e6|\u05d0\u05d7\u05e8\u05d9 \u05d4\u05e6\u05d4\u05e8\u05d9\u05d9\u05dd|\u05d1\u05e2\u05e8\u05d1)$/.test(t)},meridiem:function(t,e,n){return t<5?"\u05dc\u05e4\u05e0\u05d5\u05ea \u05d1\u05d5\u05e7\u05e8":t<10?"\u05d1\u05d1\u05d5\u05e7\u05e8":t<12?n?'\u05dc\u05e4\u05e0\u05d4"\u05e6':"\u05dc\u05e4\u05e0\u05d9 \u05d4\u05e6\u05d4\u05e8\u05d9\u05d9\u05dd":t<18?n?'\u05d0\u05d7\u05d4"\u05e6':"\u05d0\u05d7\u05e8\u05d9 \u05d4\u05e6\u05d4\u05e8\u05d9\u05d9\u05dd":"\u05d1\u05e2\u05e8\u05d1"}})}(n(30381))},30094:function(t,e,n){!function(t){"use strict";var e={1:"\u0967",2:"\u0968",3:"\u0969",4:"\u096a",5:"\u096b",6:"\u096c",7:"\u096d",8:"\u096e",9:"\u096f",0:"\u0966"},n={"\u0967":"1","\u0968":"2","\u0969":"3","\u096a":"4","\u096b":"5","\u096c":"6","\u096d":"7","\u096e":"8","\u096f":"9","\u0966":"0"},r=[/^\u091c\u0928/i,/^\u092b\u093c\u0930|\u092b\u0930/i,/^\u092e\u093e\u0930\u094d\u091a/i,/^\u0905\u092a\u094d\u0930\u0948/i,/^\u092e\u0908/i,/^\u091c\u0942\u0928/i,/^\u091c\u0941\u0932/i,/^\u0905\u0917/i,/^\u0938\u093f\u0924\u0902|\u0938\u093f\u0924/i,/^\u0905\u0915\u094d\u091f\u0942/i,/^\u0928\u0935|\u0928\u0935\u0902/i,/^\u0926\u093f\u0938\u0902|\u0926\u093f\u0938/i],i=[/^\u091c\u0928/i,/^\u092b\u093c\u0930/i,/^\u092e\u093e\u0930\u094d\u091a/i,/^\u0905\u092a\u094d\u0930\u0948/i,/^\u092e\u0908/i,/^\u091c\u0942\u0928/i,/^\u091c\u0941\u0932/i,/^\u0905\u0917/i,/^\u0938\u093f\u0924/i,/^\u0905\u0915\u094d\u091f\u0942/i,/^\u0928\u0935/i,/^\u0926\u093f\u0938/i];t.defineLocale("hi",{months:{format:"\u091c\u0928\u0935\u0930\u0940_\u092b\u093c\u0930\u0935\u0930\u0940_\u092e\u093e\u0930\u094d\u091a_\u0905\u092a\u094d\u0930\u0948\u0932_\u092e\u0908_\u091c\u0942\u0928_\u091c\u0941\u0932\u093e\u0908_\u0905\u0917\u0938\u094d\u0924_\u0938\u093f\u0924\u092e\u094d\u092c\u0930_\u0905\u0915\u094d\u091f\u0942\u092c\u0930_\u0928\u0935\u092e\u094d\u092c\u0930_\u0926\u093f\u0938\u092e\u094d\u092c\u0930".split("_"),standalone:"\u091c\u0928\u0935\u0930\u0940_\u092b\u0930\u0935\u0930\u0940_\u092e\u093e\u0930\u094d\u091a_\u0905\u092a\u094d\u0930\u0948\u0932_\u092e\u0908_\u091c\u0942\u0928_\u091c\u0941\u0932\u093e\u0908_\u0905\u0917\u0938\u094d\u0924_\u0938\u093f\u0924\u0902\u092c\u0930_\u0905\u0915\u094d\u091f\u0942\u092c\u0930_\u0928\u0935\u0902\u092c\u0930_\u0926\u093f\u0938\u0902\u092c\u0930".split("_")},monthsShort:"\u091c\u0928._\u092b\u093c\u0930._\u092e\u093e\u0930\u094d\u091a_\u0905\u092a\u094d\u0930\u0948._\u092e\u0908_\u091c\u0942\u0928_\u091c\u0941\u0932._\u0905\u0917._\u0938\u093f\u0924._\u0905\u0915\u094d\u091f\u0942._\u0928\u0935._\u0926\u093f\u0938.".split("_"),weekdays:"\u0930\u0935\u093f\u0935\u093e\u0930_\u0938\u094b\u092e\u0935\u093e\u0930_\u092e\u0902\u0917\u0932\u0935\u093e\u0930_\u092c\u0941\u0927\u0935\u093e\u0930_\u0917\u0941\u0930\u0942\u0935\u093e\u0930_\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930_\u0936\u0928\u093f\u0935\u093e\u0930".split("_"),weekdaysShort:"\u0930\u0935\u093f_\u0938\u094b\u092e_\u092e\u0902\u0917\u0932_\u092c\u0941\u0927_\u0917\u0941\u0930\u0942_\u0936\u0941\u0915\u094d\u0930_\u0936\u0928\u093f".split("_"),weekdaysMin:"\u0930_\u0938\u094b_\u092e\u0902_\u092c\u0941_\u0917\u0941_\u0936\u0941_\u0936".split("_"),longDateFormat:{LT:"A h:mm \u092c\u091c\u0947",LTS:"A h:mm:ss \u092c\u091c\u0947",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u092c\u091c\u0947",LLLL:"dddd, D MMMM YYYY, A h:mm \u092c\u091c\u0947"},monthsParse:r,longMonthsParse:r,shortMonthsParse:i,monthsRegex:/^(\u091c\u0928\u0935\u0930\u0940|\u091c\u0928\.?|\u092b\u093c\u0930\u0935\u0930\u0940|\u092b\u0930\u0935\u0930\u0940|\u092b\u093c\u0930\.?|\u092e\u093e\u0930\u094d\u091a?|\u0905\u092a\u094d\u0930\u0948\u0932|\u0905\u092a\u094d\u0930\u0948\.?|\u092e\u0908?|\u091c\u0942\u0928?|\u091c\u0941\u0932\u093e\u0908|\u091c\u0941\u0932\.?|\u0905\u0917\u0938\u094d\u0924|\u0905\u0917\.?|\u0938\u093f\u0924\u092e\u094d\u092c\u0930|\u0938\u093f\u0924\u0902\u092c\u0930|\u0938\u093f\u0924\.?|\u0905\u0915\u094d\u091f\u0942\u092c\u0930|\u0905\u0915\u094d\u091f\u0942\.?|\u0928\u0935\u092e\u094d\u092c\u0930|\u0928\u0935\u0902\u092c\u0930|\u0928\u0935\.?|\u0926\u093f\u0938\u092e\u094d\u092c\u0930|\u0926\u093f\u0938\u0902\u092c\u0930|\u0926\u093f\u0938\.?)/i,monthsShortRegex:/^(\u091c\u0928\u0935\u0930\u0940|\u091c\u0928\.?|\u092b\u093c\u0930\u0935\u0930\u0940|\u092b\u0930\u0935\u0930\u0940|\u092b\u093c\u0930\.?|\u092e\u093e\u0930\u094d\u091a?|\u0905\u092a\u094d\u0930\u0948\u0932|\u0905\u092a\u094d\u0930\u0948\.?|\u092e\u0908?|\u091c\u0942\u0928?|\u091c\u0941\u0932\u093e\u0908|\u091c\u0941\u0932\.?|\u0905\u0917\u0938\u094d\u0924|\u0905\u0917\.?|\u0938\u093f\u0924\u092e\u094d\u092c\u0930|\u0938\u093f\u0924\u0902\u092c\u0930|\u0938\u093f\u0924\.?|\u0905\u0915\u094d\u091f\u0942\u092c\u0930|\u0905\u0915\u094d\u091f\u0942\.?|\u0928\u0935\u092e\u094d\u092c\u0930|\u0928\u0935\u0902\u092c\u0930|\u0928\u0935\.?|\u0926\u093f\u0938\u092e\u094d\u092c\u0930|\u0926\u093f\u0938\u0902\u092c\u0930|\u0926\u093f\u0938\.?)/i,monthsStrictRegex:/^(\u091c\u0928\u0935\u0930\u0940?|\u092b\u093c\u0930\u0935\u0930\u0940|\u092b\u0930\u0935\u0930\u0940?|\u092e\u093e\u0930\u094d\u091a?|\u0905\u092a\u094d\u0930\u0948\u0932?|\u092e\u0908?|\u091c\u0942\u0928?|\u091c\u0941\u0932\u093e\u0908?|\u0905\u0917\u0938\u094d\u0924?|\u0938\u093f\u0924\u092e\u094d\u092c\u0930|\u0938\u093f\u0924\u0902\u092c\u0930|\u0938\u093f\u0924?\.?|\u0905\u0915\u094d\u091f\u0942\u092c\u0930|\u0905\u0915\u094d\u091f\u0942\.?|\u0928\u0935\u092e\u094d\u092c\u0930|\u0928\u0935\u0902\u092c\u0930?|\u0926\u093f\u0938\u092e\u094d\u092c\u0930|\u0926\u093f\u0938\u0902\u092c\u0930?)/i,monthsShortStrictRegex:/^(\u091c\u0928\.?|\u092b\u093c\u0930\.?|\u092e\u093e\u0930\u094d\u091a?|\u0905\u092a\u094d\u0930\u0948\.?|\u092e\u0908?|\u091c\u0942\u0928?|\u091c\u0941\u0932\.?|\u0905\u0917\.?|\u0938\u093f\u0924\.?|\u0905\u0915\u094d\u091f\u0942\.?|\u0928\u0935\.?|\u0926\u093f\u0938\.?)/i,calendar:{sameDay:"[\u0906\u091c] LT",nextDay:"[\u0915\u0932] LT",nextWeek:"dddd, LT",lastDay:"[\u0915\u0932] LT",lastWeek:"[\u092a\u093f\u091b\u0932\u0947] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u092e\u0947\u0902",past:"%s \u092a\u0939\u0932\u0947",s:"\u0915\u0941\u091b \u0939\u0940 \u0915\u094d\u0937\u0923",ss:"%d \u0938\u0947\u0915\u0902\u0921",m:"\u090f\u0915 \u092e\u093f\u0928\u091f",mm:"%d \u092e\u093f\u0928\u091f",h:"\u090f\u0915 \u0918\u0902\u091f\u093e",hh:"%d \u0918\u0902\u091f\u0947",d:"\u090f\u0915 \u0926\u093f\u0928",dd:"%d \u0926\u093f\u0928",M:"\u090f\u0915 \u092e\u0939\u0940\u0928\u0947",MM:"%d \u092e\u0939\u0940\u0928\u0947",y:"\u090f\u0915 \u0935\u0930\u094d\u0937",yy:"%d \u0935\u0930\u094d\u0937"},preparse:function(t){return t.replace(/[\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0966]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u0930\u093e\u0924|\u0938\u0941\u092c\u0939|\u0926\u094b\u092a\u0939\u0930|\u0936\u093e\u092e/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0930\u093e\u0924"===e?t<4?t:t+12:"\u0938\u0941\u092c\u0939"===e?t:"\u0926\u094b\u092a\u0939\u0930"===e?t>=10?t:t+12:"\u0936\u093e\u092e"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u0930\u093e\u0924":t<10?"\u0938\u0941\u092c\u0939":t<17?"\u0926\u094b\u092a\u0939\u0930":t<20?"\u0936\u093e\u092e":"\u0930\u093e\u0924"},week:{dow:0,doy:6}})}(n(30381))},30316:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=t+" ";switch(n){case"ss":return r+=1===t?"sekunda":2===t||3===t||4===t?"sekunde":"sekundi";case"m":return e?"jedna minuta":"jedne minute";case"mm":return r+=1===t?"minuta":2===t||3===t||4===t?"minute":"minuta";case"h":return e?"jedan sat":"jednog sata";case"hh":return r+=1===t?"sat":2===t||3===t||4===t?"sata":"sati";case"dd":return r+=1===t?"dan":"dana";case"MM":return r+=1===t?"mjesec":2===t||3===t||4===t?"mjeseca":"mjeseci";case"yy":return r+=1===t?"godina":2===t||3===t||4===t?"godine":"godina"}}t.defineLocale("hr",{months:{format:"sije\u010dnja_velja\u010de_o\u017eujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"sije\u010danj_velja\u010da_o\u017eujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._o\u017eu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_\u010detvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._\u010det._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_\u010de_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM YYYY",LLL:"Do MMMM YYYY H:mm",LLLL:"dddd, Do MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[ju\u010der u] LT",lastWeek:function(){switch(this.day()){case 0:return"[pro\u0161lu] [nedjelju] [u] LT";case 3:return"[pro\u0161lu] [srijedu] [u] LT";case 6:return"[pro\u0161le] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[pro\u0161li] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:e,m:e,mm:e,h:e,hh:e,d:"dan",dd:e,M:"mjesec",MM:e,y:"godinu",yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},22138:function(t,e,n){!function(t){"use strict";var e="vas\xe1rnap h\xe9tf\u0151n kedden szerd\xe1n cs\xfct\xf6rt\xf6k\xf6n p\xe9nteken szombaton".split(" ");function n(t,e,n,r){var i=t;switch(n){case"s":return r||e?"n\xe9h\xe1ny m\xe1sodperc":"n\xe9h\xe1ny m\xe1sodperce";case"ss":return i+(r||e)?" m\xe1sodperc":" m\xe1sodperce";case"m":return"egy"+(r||e?" perc":" perce");case"mm":return i+(r||e?" perc":" perce");case"h":return"egy"+(r||e?" \xf3ra":" \xf3r\xe1ja");case"hh":return i+(r||e?" \xf3ra":" \xf3r\xe1ja");case"d":return"egy"+(r||e?" nap":" napja");case"dd":return i+(r||e?" nap":" napja");case"M":return"egy"+(r||e?" h\xf3nap":" h\xf3napja");case"MM":return i+(r||e?" h\xf3nap":" h\xf3napja");case"y":return"egy"+(r||e?" \xe9v":" \xe9ve");case"yy":return i+(r||e?" \xe9v":" \xe9ve")}return""}function r(t){return(t?"":"[m\xfalt] ")+"["+e[this.day()]+"] LT[-kor]"}t.defineLocale("hu",{months:"janu\xe1r_febru\xe1r_m\xe1rcius_\xe1prilis_m\xe1jus_j\xfanius_j\xfalius_augusztus_szeptember_okt\xf3ber_november_december".split("_"),monthsShort:"jan._feb._m\xe1rc._\xe1pr._m\xe1j._j\xfan._j\xfal._aug._szept._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"vas\xe1rnap_h\xe9tf\u0151_kedd_szerda_cs\xfct\xf6rt\xf6k_p\xe9ntek_szombat".split("_"),weekdaysShort:"vas_h\xe9t_kedd_sze_cs\xfct_p\xe9n_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(t){return"u"===t.charAt(1).toLowerCase()},meridiem:function(t,e,n){return t<12?!0===n?"de":"DE":!0===n?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return r.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return r.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s m\xfalva",past:"%s",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},11423:function(t,e,n){!function(t){"use strict";t.defineLocale("hy-am",{months:{format:"\u0570\u0578\u0582\u0576\u057e\u0561\u0580\u056b_\u0583\u0565\u057f\u0580\u057e\u0561\u0580\u056b_\u0574\u0561\u0580\u057f\u056b_\u0561\u057a\u0580\u056b\u056c\u056b_\u0574\u0561\u0575\u056b\u057d\u056b_\u0570\u0578\u0582\u0576\u056b\u057d\u056b_\u0570\u0578\u0582\u056c\u056b\u057d\u056b_\u0585\u0563\u0578\u057d\u057f\u0578\u057d\u056b_\u057d\u0565\u057a\u057f\u0565\u0574\u0562\u0565\u0580\u056b_\u0570\u0578\u056f\u057f\u0565\u0574\u0562\u0565\u0580\u056b_\u0576\u0578\u0575\u0565\u0574\u0562\u0565\u0580\u056b_\u0564\u0565\u056f\u057f\u0565\u0574\u0562\u0565\u0580\u056b".split("_"),standalone:"\u0570\u0578\u0582\u0576\u057e\u0561\u0580_\u0583\u0565\u057f\u0580\u057e\u0561\u0580_\u0574\u0561\u0580\u057f_\u0561\u057a\u0580\u056b\u056c_\u0574\u0561\u0575\u056b\u057d_\u0570\u0578\u0582\u0576\u056b\u057d_\u0570\u0578\u0582\u056c\u056b\u057d_\u0585\u0563\u0578\u057d\u057f\u0578\u057d_\u057d\u0565\u057a\u057f\u0565\u0574\u0562\u0565\u0580_\u0570\u0578\u056f\u057f\u0565\u0574\u0562\u0565\u0580_\u0576\u0578\u0575\u0565\u0574\u0562\u0565\u0580_\u0564\u0565\u056f\u057f\u0565\u0574\u0562\u0565\u0580".split("_")},monthsShort:"\u0570\u0576\u057e_\u0583\u057f\u0580_\u0574\u0580\u057f_\u0561\u057a\u0580_\u0574\u0575\u057d_\u0570\u0576\u057d_\u0570\u056c\u057d_\u0585\u0563\u057d_\u057d\u057a\u057f_\u0570\u056f\u057f_\u0576\u0574\u0562_\u0564\u056f\u057f".split("_"),weekdays:"\u056f\u056b\u0580\u0561\u056f\u056b_\u0565\u0580\u056f\u0578\u0582\u0577\u0561\u0562\u0569\u056b_\u0565\u0580\u0565\u0584\u0577\u0561\u0562\u0569\u056b_\u0579\u0578\u0580\u0565\u0584\u0577\u0561\u0562\u0569\u056b_\u0570\u056b\u0576\u0563\u0577\u0561\u0562\u0569\u056b_\u0578\u0582\u0580\u0562\u0561\u0569_\u0577\u0561\u0562\u0561\u0569".split("_"),weekdaysShort:"\u056f\u0580\u056f_\u0565\u0580\u056f_\u0565\u0580\u0584_\u0579\u0580\u0584_\u0570\u0576\u0563_\u0578\u0582\u0580\u0562_\u0577\u0562\u0569".split("_"),weekdaysMin:"\u056f\u0580\u056f_\u0565\u0580\u056f_\u0565\u0580\u0584_\u0579\u0580\u0584_\u0570\u0576\u0563_\u0578\u0582\u0580\u0562_\u0577\u0562\u0569".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY \u0569.",LLL:"D MMMM YYYY \u0569., HH:mm",LLLL:"dddd, D MMMM YYYY \u0569., HH:mm"},calendar:{sameDay:"[\u0561\u0575\u057d\u0585\u0580] LT",nextDay:"[\u057e\u0561\u0572\u0568] LT",lastDay:"[\u0565\u0580\u0565\u056f] LT",nextWeek:function(){return"dddd [\u0585\u0580\u0568 \u056a\u0561\u0574\u0568] LT"},lastWeek:function(){return"[\u0561\u0576\u0581\u0561\u056e] dddd [\u0585\u0580\u0568 \u056a\u0561\u0574\u0568] LT"},sameElse:"L"},relativeTime:{future:"%s \u0570\u0565\u057f\u0578",past:"%s \u0561\u057c\u0561\u057b",s:"\u0574\u056b \u0584\u0561\u0576\u056b \u057e\u0561\u0575\u0580\u056f\u0575\u0561\u0576",ss:"%d \u057e\u0561\u0575\u0580\u056f\u0575\u0561\u0576",m:"\u0580\u0578\u057a\u0565",mm:"%d \u0580\u0578\u057a\u0565",h:"\u056a\u0561\u0574",hh:"%d \u056a\u0561\u0574",d:"\u0585\u0580",dd:"%d \u0585\u0580",M:"\u0561\u0574\u056b\u057d",MM:"%d \u0561\u0574\u056b\u057d",y:"\u057f\u0561\u0580\u056b",yy:"%d \u057f\u0561\u0580\u056b"},meridiemParse:/\u0563\u056b\u0577\u0565\u0580\u057e\u0561|\u0561\u057c\u0561\u057e\u0578\u057f\u057e\u0561|\u0581\u0565\u0580\u0565\u056f\u057e\u0561|\u0565\u0580\u0565\u056f\u0578\u0575\u0561\u0576/,isPM:function(t){return/^(\u0581\u0565\u0580\u0565\u056f\u057e\u0561|\u0565\u0580\u0565\u056f\u0578\u0575\u0561\u0576)$/.test(t)},meridiem:function(t){return t<4?"\u0563\u056b\u0577\u0565\u0580\u057e\u0561":t<12?"\u0561\u057c\u0561\u057e\u0578\u057f\u057e\u0561":t<17?"\u0581\u0565\u0580\u0565\u056f\u057e\u0561":"\u0565\u0580\u0565\u056f\u0578\u0575\u0561\u0576"},dayOfMonthOrdinalParse:/\d{1,2}|\d{1,2}-(\u056b\u0576|\u0580\u0564)/,ordinal:function(t,e){switch(e){case"DDD":case"w":case"W":case"DDDo":return 1===t?t+"-\u056b\u0576":t+"-\u0580\u0564";default:return t}},week:{dow:1,doy:7}})}(n(30381))},29218:function(t,e,n){!function(t){"use strict";t.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"siang"===e?t>=11?t:t+12:"sore"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"siang":t<19?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",ss:"%d detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:0,doy:6}})}(n(30381))},90135:function(t,e,n){!function(t){"use strict";function e(t){return t%100==11||t%10!=1}function n(t,n,r,i){var a=t+" ";switch(r){case"s":return n||i?"nokkrar sek\xfandur":"nokkrum sek\xfandum";case"ss":return e(t)?a+(n||i?"sek\xfandur":"sek\xfandum"):a+"sek\xfanda";case"m":return n?"m\xedn\xfata":"m\xedn\xfatu";case"mm":return e(t)?a+(n||i?"m\xedn\xfatur":"m\xedn\xfatum"):n?a+"m\xedn\xfata":a+"m\xedn\xfatu";case"hh":return e(t)?a+(n||i?"klukkustundir":"klukkustundum"):a+"klukkustund";case"d":return n?"dagur":i?"dag":"degi";case"dd":return e(t)?n?a+"dagar":a+(i?"daga":"d\xf6gum"):n?a+"dagur":a+(i?"dag":"degi");case"M":return n?"m\xe1nu\xf0ur":i?"m\xe1nu\xf0":"m\xe1nu\xf0i";case"MM":return e(t)?n?a+"m\xe1nu\xf0ir":a+(i?"m\xe1nu\xf0i":"m\xe1nu\xf0um"):n?a+"m\xe1nu\xf0ur":a+(i?"m\xe1nu\xf0":"m\xe1nu\xf0i");case"y":return n||i?"\xe1r":"\xe1ri";case"yy":return e(t)?a+(n||i?"\xe1r":"\xe1rum"):a+(n||i?"\xe1r":"\xe1ri")}}t.defineLocale("is",{months:"jan\xfaar_febr\xfaar_mars_apr\xedl_ma\xed_j\xfan\xed_j\xfal\xed_\xe1g\xfast_september_okt\xf3ber_n\xf3vember_desember".split("_"),monthsShort:"jan_feb_mar_apr_ma\xed_j\xfan_j\xfal_\xe1g\xfa_sep_okt_n\xf3v_des".split("_"),weekdays:"sunnudagur_m\xe1nudagur_\xferi\xf0judagur_mi\xf0vikudagur_fimmtudagur_f\xf6studagur_laugardagur".split("_"),weekdaysShort:"sun_m\xe1n_\xferi_mi\xf0_fim_f\xf6s_lau".split("_"),weekdaysMin:"Su_M\xe1_\xder_Mi_Fi_F\xf6_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[\xed dag kl.] LT",nextDay:"[\xe1 morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[\xed g\xe6r kl.] LT",lastWeek:"[s\xed\xf0asta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s s\xed\xf0an",s:n,ss:n,m:n,mm:n,h:"klukkustund",hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},10150:function(t,e,n){!function(t){"use strict";t.defineLocale("it-ch",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_luned\xec_marted\xec_mercoled\xec_gioved\xec_venerd\xec_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){return 0===this.day()?"[la scorsa] dddd [alle] LT":"[lo scorso] dddd [alle] LT"},sameElse:"L"},relativeTime:{future:function(t){return(/^[0-9].+$/.test(t)?"tra":"in")+" "+t},past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4}})}(n(30381))},90626:function(t,e,n){!function(t){"use strict";t.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_luned\xec_marted\xec_mercoled\xec_gioved\xec_venerd\xec_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){return 0===this.day()?"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT":"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4}})}(n(30381))},39183:function(t,e,n){!function(t){"use strict";t.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"\u4ee4\u548c",narrow:"\u32ff",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"\u5e73\u6210",narrow:"\u337b",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"\u662d\u548c",narrow:"\u337c",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"\u5927\u6b63",narrow:"\u337d",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"\u660e\u6cbb",narrow:"\u337e",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"\u897f\u66a6",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"\u7d00\u5143\u524d",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(\u5143|\d+)\u5e74/,eraYearOrdinalParse:function(t,e){return"\u5143"===e[1]?1:parseInt(e[1]||t,10)},months:"1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),monthsShort:"1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),weekdays:"\u65e5\u66dc\u65e5_\u6708\u66dc\u65e5_\u706b\u66dc\u65e5_\u6c34\u66dc\u65e5_\u6728\u66dc\u65e5_\u91d1\u66dc\u65e5_\u571f\u66dc\u65e5".split("_"),weekdaysShort:"\u65e5_\u6708_\u706b_\u6c34_\u6728_\u91d1_\u571f".split("_"),weekdaysMin:"\u65e5_\u6708_\u706b_\u6c34_\u6728_\u91d1_\u571f".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY\u5e74M\u6708D\u65e5",LLL:"YYYY\u5e74M\u6708D\u65e5 HH:mm",LLLL:"YYYY\u5e74M\u6708D\u65e5 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY\u5e74M\u6708D\u65e5",lll:"YYYY\u5e74M\u6708D\u65e5 HH:mm",llll:"YYYY\u5e74M\u6708D\u65e5(ddd) HH:mm"},meridiemParse:/\u5348\u524d|\u5348\u5f8c/i,isPM:function(t){return"\u5348\u5f8c"===t},meridiem:function(t,e,n){return t<12?"\u5348\u524d":"\u5348\u5f8c"},calendar:{sameDay:"[\u4eca\u65e5] LT",nextDay:"[\u660e\u65e5] LT",nextWeek:function(t){return t.week()!==this.week()?"[\u6765\u9031]dddd LT":"dddd LT"},lastDay:"[\u6628\u65e5] LT",lastWeek:function(t){return this.week()!==t.week()?"[\u5148\u9031]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}\u65e5/,ordinal:function(t,e){switch(e){case"y":return 1===t?"\u5143\u5e74":t+"\u5e74";case"d":case"D":case"DDD":return t+"\u65e5";default:return t}},relativeTime:{future:"%s\u5f8c",past:"%s\u524d",s:"\u6570\u79d2",ss:"%d\u79d2",m:"1\u5206",mm:"%d\u5206",h:"1\u6642\u9593",hh:"%d\u6642\u9593",d:"1\u65e5",dd:"%d\u65e5",M:"1\u30f6\u6708",MM:"%d\u30f6\u6708",y:"1\u5e74",yy:"%d\u5e74"}})}(n(30381))},24286:function(t,e,n){!function(t){"use strict";t.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(t,e){return 12===t&&(t=0),"enjing"===e?t:"siyang"===e?t>=11?t:t+12:"sonten"===e||"ndalu"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"enjing":t<15?"siyang":t<19?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",ss:"%d detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}})}(n(30381))},12105:function(t,e,n){!function(t){"use strict";t.defineLocale("ka",{months:"\u10d8\u10d0\u10dc\u10d5\u10d0\u10e0\u10d8_\u10d7\u10d4\u10d1\u10d4\u10e0\u10d5\u10d0\u10da\u10d8_\u10db\u10d0\u10e0\u10e2\u10d8_\u10d0\u10de\u10e0\u10d8\u10da\u10d8_\u10db\u10d0\u10d8\u10e1\u10d8_\u10d8\u10d5\u10dc\u10d8\u10e1\u10d8_\u10d8\u10d5\u10da\u10d8\u10e1\u10d8_\u10d0\u10d2\u10d5\u10d8\u10e1\u10e2\u10dd_\u10e1\u10d4\u10e5\u10e2\u10d4\u10db\u10d1\u10d4\u10e0\u10d8_\u10dd\u10e5\u10e2\u10dd\u10db\u10d1\u10d4\u10e0\u10d8_\u10dc\u10dd\u10d4\u10db\u10d1\u10d4\u10e0\u10d8_\u10d3\u10d4\u10d9\u10d4\u10db\u10d1\u10d4\u10e0\u10d8".split("_"),monthsShort:"\u10d8\u10d0\u10dc_\u10d7\u10d4\u10d1_\u10db\u10d0\u10e0_\u10d0\u10de\u10e0_\u10db\u10d0\u10d8_\u10d8\u10d5\u10dc_\u10d8\u10d5\u10da_\u10d0\u10d2\u10d5_\u10e1\u10d4\u10e5_\u10dd\u10e5\u10e2_\u10dc\u10dd\u10d4_\u10d3\u10d4\u10d9".split("_"),weekdays:{standalone:"\u10d9\u10d5\u10d8\u10e0\u10d0_\u10dd\u10e0\u10e8\u10d0\u10d1\u10d0\u10d7\u10d8_\u10e1\u10d0\u10db\u10e8\u10d0\u10d1\u10d0\u10d7\u10d8_\u10dd\u10d7\u10ee\u10e8\u10d0\u10d1\u10d0\u10d7\u10d8_\u10ee\u10e3\u10d7\u10e8\u10d0\u10d1\u10d0\u10d7\u10d8_\u10de\u10d0\u10e0\u10d0\u10e1\u10d9\u10d4\u10d5\u10d8_\u10e8\u10d0\u10d1\u10d0\u10d7\u10d8".split("_"),format:"\u10d9\u10d5\u10d8\u10e0\u10d0\u10e1_\u10dd\u10e0\u10e8\u10d0\u10d1\u10d0\u10d7\u10e1_\u10e1\u10d0\u10db\u10e8\u10d0\u10d1\u10d0\u10d7\u10e1_\u10dd\u10d7\u10ee\u10e8\u10d0\u10d1\u10d0\u10d7\u10e1_\u10ee\u10e3\u10d7\u10e8\u10d0\u10d1\u10d0\u10d7\u10e1_\u10de\u10d0\u10e0\u10d0\u10e1\u10d9\u10d4\u10d5\u10e1_\u10e8\u10d0\u10d1\u10d0\u10d7\u10e1".split("_"),isFormat:/(\u10ec\u10d8\u10dc\u10d0|\u10e8\u10d4\u10db\u10d3\u10d4\u10d2)/},weekdaysShort:"\u10d9\u10d5\u10d8_\u10dd\u10e0\u10e8_\u10e1\u10d0\u10db_\u10dd\u10d7\u10ee_\u10ee\u10e3\u10d7_\u10de\u10d0\u10e0_\u10e8\u10d0\u10d1".split("_"),weekdaysMin:"\u10d9\u10d5_\u10dd\u10e0_\u10e1\u10d0_\u10dd\u10d7_\u10ee\u10e3_\u10de\u10d0_\u10e8\u10d0".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u10d3\u10e6\u10d4\u10e1] LT[-\u10d6\u10d4]",nextDay:"[\u10ee\u10d5\u10d0\u10da] LT[-\u10d6\u10d4]",lastDay:"[\u10d2\u10e3\u10e8\u10d8\u10dc] LT[-\u10d6\u10d4]",nextWeek:"[\u10e8\u10d4\u10db\u10d3\u10d4\u10d2] dddd LT[-\u10d6\u10d4]",lastWeek:"[\u10ec\u10d8\u10dc\u10d0] dddd LT-\u10d6\u10d4",sameElse:"L"},relativeTime:{future:function(t){return t.replace(/(\u10ec\u10d0\u10db|\u10ec\u10e3\u10d7|\u10e1\u10d0\u10d0\u10d7|\u10ec\u10d4\u10da|\u10d3\u10e6|\u10d7\u10d5)(\u10d8|\u10d4)/,(function(t,e,n){return"\u10d8"===n?e+"\u10e8\u10d8":e+n+"\u10e8\u10d8"}))},past:function(t){return/(\u10ec\u10d0\u10db\u10d8|\u10ec\u10e3\u10d7\u10d8|\u10e1\u10d0\u10d0\u10d7\u10d8|\u10d3\u10e6\u10d4|\u10d7\u10d5\u10d4)/.test(t)?t.replace(/(\u10d8|\u10d4)$/,"\u10d8\u10e1 \u10ec\u10d8\u10dc"):/\u10ec\u10d4\u10da\u10d8/.test(t)?t.replace(/\u10ec\u10d4\u10da\u10d8$/,"\u10ec\u10da\u10d8\u10e1 \u10ec\u10d8\u10dc"):t},s:"\u10e0\u10d0\u10db\u10d3\u10d4\u10dc\u10d8\u10db\u10d4 \u10ec\u10d0\u10db\u10d8",ss:"%d \u10ec\u10d0\u10db\u10d8",m:"\u10ec\u10e3\u10d7\u10d8",mm:"%d \u10ec\u10e3\u10d7\u10d8",h:"\u10e1\u10d0\u10d0\u10d7\u10d8",hh:"%d \u10e1\u10d0\u10d0\u10d7\u10d8",d:"\u10d3\u10e6\u10d4",dd:"%d \u10d3\u10e6\u10d4",M:"\u10d7\u10d5\u10d4",MM:"%d \u10d7\u10d5\u10d4",y:"\u10ec\u10d4\u10da\u10d8",yy:"%d \u10ec\u10d4\u10da\u10d8"},dayOfMonthOrdinalParse:/0|1-\u10da\u10d8|\u10db\u10d4-\d{1,2}|\d{1,2}-\u10d4/,ordinal:function(t){return 0===t?t:1===t?t+"-\u10da\u10d8":t<20||t<=100&&t%20==0||t%100==0?"\u10db\u10d4-"+t:t+"-\u10d4"},week:{dow:1,doy:7}})}(n(30381))},47772:function(t,e,n){!function(t){"use strict";var e={0:"-\u0448\u0456",1:"-\u0448\u0456",2:"-\u0448\u0456",3:"-\u0448\u0456",4:"-\u0448\u0456",5:"-\u0448\u0456",6:"-\u0448\u044b",7:"-\u0448\u0456",8:"-\u0448\u0456",9:"-\u0448\u044b",10:"-\u0448\u044b",20:"-\u0448\u044b",30:"-\u0448\u044b",40:"-\u0448\u044b",50:"-\u0448\u0456",60:"-\u0448\u044b",70:"-\u0448\u0456",80:"-\u0448\u0456",90:"-\u0448\u044b",100:"-\u0448\u0456"};t.defineLocale("kk",{months:"\u049b\u0430\u04a3\u0442\u0430\u0440_\u0430\u049b\u043f\u0430\u043d_\u043d\u0430\u0443\u0440\u044b\u0437_\u0441\u04d9\u0443\u0456\u0440_\u043c\u0430\u043c\u044b\u0440_\u043c\u0430\u0443\u0441\u044b\u043c_\u0448\u0456\u043b\u0434\u0435_\u0442\u0430\u043c\u044b\u0437_\u049b\u044b\u0440\u043a\u04af\u0439\u0435\u043a_\u049b\u0430\u0437\u0430\u043d_\u049b\u0430\u0440\u0430\u0448\u0430_\u0436\u0435\u043b\u0442\u043e\u049b\u0441\u0430\u043d".split("_"),monthsShort:"\u049b\u0430\u04a3_\u0430\u049b\u043f_\u043d\u0430\u0443_\u0441\u04d9\u0443_\u043c\u0430\u043c_\u043c\u0430\u0443_\u0448\u0456\u043b_\u0442\u0430\u043c_\u049b\u044b\u0440_\u049b\u0430\u0437_\u049b\u0430\u0440_\u0436\u0435\u043b".split("_"),weekdays:"\u0436\u0435\u043a\u0441\u0435\u043d\u0431\u0456_\u0434\u04af\u0439\u0441\u0435\u043d\u0431\u0456_\u0441\u0435\u0439\u0441\u0435\u043d\u0431\u0456_\u0441\u04d9\u0440\u0441\u0435\u043d\u0431\u0456_\u0431\u0435\u0439\u0441\u0435\u043d\u0431\u0456_\u0436\u04b1\u043c\u0430_\u0441\u0435\u043d\u0431\u0456".split("_"),weekdaysShort:"\u0436\u0435\u043a_\u0434\u04af\u0439_\u0441\u0435\u0439_\u0441\u04d9\u0440_\u0431\u0435\u0439_\u0436\u04b1\u043c_\u0441\u0435\u043d".split("_"),weekdaysMin:"\u0436\u043a_\u0434\u0439_\u0441\u0439_\u0441\u0440_\u0431\u0439_\u0436\u043c_\u0441\u043d".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0411\u04af\u0433\u0456\u043d \u0441\u0430\u0493\u0430\u0442] LT",nextDay:"[\u0415\u0440\u0442\u0435\u04a3 \u0441\u0430\u0493\u0430\u0442] LT",nextWeek:"dddd [\u0441\u0430\u0493\u0430\u0442] LT",lastDay:"[\u041a\u0435\u0448\u0435 \u0441\u0430\u0493\u0430\u0442] LT",lastWeek:"[\u04e8\u0442\u043a\u0435\u043d \u0430\u043f\u0442\u0430\u043d\u044b\u04a3] dddd [\u0441\u0430\u0493\u0430\u0442] LT",sameElse:"L"},relativeTime:{future:"%s \u0456\u0448\u0456\u043d\u0434\u0435",past:"%s \u0431\u04b1\u0440\u044b\u043d",s:"\u0431\u0456\u0440\u043d\u0435\u0448\u0435 \u0441\u0435\u043a\u0443\u043d\u0434",ss:"%d \u0441\u0435\u043a\u0443\u043d\u0434",m:"\u0431\u0456\u0440 \u043c\u0438\u043d\u0443\u0442",mm:"%d \u043c\u0438\u043d\u0443\u0442",h:"\u0431\u0456\u0440 \u0441\u0430\u0493\u0430\u0442",hh:"%d \u0441\u0430\u0493\u0430\u0442",d:"\u0431\u0456\u0440 \u043a\u04af\u043d",dd:"%d \u043a\u04af\u043d",M:"\u0431\u0456\u0440 \u0430\u0439",MM:"%d \u0430\u0439",y:"\u0431\u0456\u0440 \u0436\u044b\u043b",yy:"%d \u0436\u044b\u043b"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0448\u0456|\u0448\u044b)/,ordinal:function(t){var n=t%10,r=t>=100?100:null;return t+(e[t]||e[n]||e[r])},week:{dow:1,doy:7}})}(n(30381))},18758:function(t,e,n){!function(t){"use strict";var e={1:"\u17e1",2:"\u17e2",3:"\u17e3",4:"\u17e4",5:"\u17e5",6:"\u17e6",7:"\u17e7",8:"\u17e8",9:"\u17e9",0:"\u17e0"},n={"\u17e1":"1","\u17e2":"2","\u17e3":"3","\u17e4":"4","\u17e5":"5","\u17e6":"6","\u17e7":"7","\u17e8":"8","\u17e9":"9","\u17e0":"0"};t.defineLocale("km",{months:"\u1798\u1780\u179a\u17b6_\u1780\u17bb\u1798\u17d2\u1797\u17c8_\u1798\u17b8\u1793\u17b6_\u1798\u17c1\u179f\u17b6_\u17a7\u179f\u1797\u17b6_\u1798\u17b7\u1790\u17bb\u1793\u17b6_\u1780\u1780\u17d2\u1780\u178a\u17b6_\u179f\u17b8\u17a0\u17b6_\u1780\u1789\u17d2\u1789\u17b6_\u178f\u17bb\u179b\u17b6_\u179c\u17b7\u1785\u17d2\u1786\u17b7\u1780\u17b6_\u1792\u17d2\u1793\u17bc".split("_"),monthsShort:"\u1798\u1780\u179a\u17b6_\u1780\u17bb\u1798\u17d2\u1797\u17c8_\u1798\u17b8\u1793\u17b6_\u1798\u17c1\u179f\u17b6_\u17a7\u179f\u1797\u17b6_\u1798\u17b7\u1790\u17bb\u1793\u17b6_\u1780\u1780\u17d2\u1780\u178a\u17b6_\u179f\u17b8\u17a0\u17b6_\u1780\u1789\u17d2\u1789\u17b6_\u178f\u17bb\u179b\u17b6_\u179c\u17b7\u1785\u17d2\u1786\u17b7\u1780\u17b6_\u1792\u17d2\u1793\u17bc".split("_"),weekdays:"\u17a2\u17b6\u1791\u17b7\u178f\u17d2\u1799_\u1785\u17d0\u1793\u17d2\u1791_\u17a2\u1784\u17d2\u1782\u17b6\u179a_\u1796\u17bb\u1792_\u1796\u17d2\u179a\u17a0\u179f\u17d2\u1794\u178f\u17b7\u17cd_\u179f\u17bb\u1780\u17d2\u179a_\u179f\u17c5\u179a\u17cd".split("_"),weekdaysShort:"\u17a2\u17b6_\u1785_\u17a2_\u1796_\u1796\u17d2\u179a_\u179f\u17bb_\u179f".split("_"),weekdaysMin:"\u17a2\u17b6_\u1785_\u17a2_\u1796_\u1796\u17d2\u179a_\u179f\u17bb_\u179f".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/\u1796\u17d2\u179a\u17b9\u1780|\u179b\u17d2\u1784\u17b6\u1785/,isPM:function(t){return"\u179b\u17d2\u1784\u17b6\u1785"===t},meridiem:function(t,e,n){return t<12?"\u1796\u17d2\u179a\u17b9\u1780":"\u179b\u17d2\u1784\u17b6\u1785"},calendar:{sameDay:"[\u1790\u17d2\u1784\u17c3\u1793\u17c1\u17c7 \u1798\u17c9\u17c4\u1784] LT",nextDay:"[\u179f\u17d2\u17a2\u17c2\u1780 \u1798\u17c9\u17c4\u1784] LT",nextWeek:"dddd [\u1798\u17c9\u17c4\u1784] LT",lastDay:"[\u1798\u17d2\u179f\u17b7\u179b\u1798\u17b7\u1789 \u1798\u17c9\u17c4\u1784] LT",lastWeek:"dddd [\u179f\u1794\u17d2\u178f\u17b6\u17a0\u17cd\u1798\u17bb\u1793] [\u1798\u17c9\u17c4\u1784] LT",sameElse:"L"},relativeTime:{future:"%s\u1791\u17c0\u178f",past:"%s\u1798\u17bb\u1793",s:"\u1794\u17c9\u17bb\u1793\u17d2\u1798\u17b6\u1793\u179c\u17b7\u1793\u17b6\u1791\u17b8",ss:"%d \u179c\u17b7\u1793\u17b6\u1791\u17b8",m:"\u1798\u17bd\u1799\u1793\u17b6\u1791\u17b8",mm:"%d \u1793\u17b6\u1791\u17b8",h:"\u1798\u17bd\u1799\u1798\u17c9\u17c4\u1784",hh:"%d \u1798\u17c9\u17c4\u1784",d:"\u1798\u17bd\u1799\u1790\u17d2\u1784\u17c3",dd:"%d \u1790\u17d2\u1784\u17c3",M:"\u1798\u17bd\u1799\u1781\u17c2",MM:"%d \u1781\u17c2",y:"\u1798\u17bd\u1799\u1786\u17d2\u1793\u17b6\u17c6",yy:"%d \u1786\u17d2\u1793\u17b6\u17c6"},dayOfMonthOrdinalParse:/\u1791\u17b8\d{1,2}/,ordinal:"\u1791\u17b8%d",preparse:function(t){return t.replace(/[\u17e1\u17e2\u17e3\u17e4\u17e5\u17e6\u17e7\u17e8\u17e9\u17e0]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},week:{dow:1,doy:4}})}(n(30381))},79282:function(t,e,n){!function(t){"use strict";var e={1:"\u0ce7",2:"\u0ce8",3:"\u0ce9",4:"\u0cea",5:"\u0ceb",6:"\u0cec",7:"\u0ced",8:"\u0cee",9:"\u0cef",0:"\u0ce6"},n={"\u0ce7":"1","\u0ce8":"2","\u0ce9":"3","\u0cea":"4","\u0ceb":"5","\u0cec":"6","\u0ced":"7","\u0cee":"8","\u0cef":"9","\u0ce6":"0"};t.defineLocale("kn",{months:"\u0c9c\u0ca8\u0cb5\u0cb0\u0cbf_\u0cab\u0cc6\u0cac\u0ccd\u0cb0\u0cb5\u0cb0\u0cbf_\u0cae\u0cbe\u0cb0\u0ccd\u0c9a\u0ccd_\u0c8f\u0caa\u0ccd\u0cb0\u0cbf\u0cb2\u0ccd_\u0cae\u0cc6\u0cd5_\u0c9c\u0cc2\u0ca8\u0ccd_\u0c9c\u0cc1\u0cb2\u0cc6\u0cd6_\u0c86\u0c97\u0cb8\u0ccd\u0c9f\u0ccd_\u0cb8\u0cc6\u0caa\u0ccd\u0c9f\u0cc6\u0c82\u0cac\u0cb0\u0ccd_\u0c85\u0c95\u0ccd\u0c9f\u0cc6\u0cc2\u0cd5\u0cac\u0cb0\u0ccd_\u0ca8\u0cb5\u0cc6\u0c82\u0cac\u0cb0\u0ccd_\u0ca1\u0cbf\u0cb8\u0cc6\u0c82\u0cac\u0cb0\u0ccd".split("_"),monthsShort:"\u0c9c\u0ca8_\u0cab\u0cc6\u0cac\u0ccd\u0cb0_\u0cae\u0cbe\u0cb0\u0ccd\u0c9a\u0ccd_\u0c8f\u0caa\u0ccd\u0cb0\u0cbf\u0cb2\u0ccd_\u0cae\u0cc6\u0cd5_\u0c9c\u0cc2\u0ca8\u0ccd_\u0c9c\u0cc1\u0cb2\u0cc6\u0cd6_\u0c86\u0c97\u0cb8\u0ccd\u0c9f\u0ccd_\u0cb8\u0cc6\u0caa\u0ccd\u0c9f\u0cc6\u0c82_\u0c85\u0c95\u0ccd\u0c9f\u0cc6\u0cc2\u0cd5_\u0ca8\u0cb5\u0cc6\u0c82_\u0ca1\u0cbf\u0cb8\u0cc6\u0c82".split("_"),monthsParseExact:!0,weekdays:"\u0cad\u0cbe\u0ca8\u0cc1\u0cb5\u0cbe\u0cb0_\u0cb8\u0cc6\u0cc2\u0cd5\u0cae\u0cb5\u0cbe\u0cb0_\u0cae\u0c82\u0c97\u0cb3\u0cb5\u0cbe\u0cb0_\u0cac\u0cc1\u0ca7\u0cb5\u0cbe\u0cb0_\u0c97\u0cc1\u0cb0\u0cc1\u0cb5\u0cbe\u0cb0_\u0cb6\u0cc1\u0c95\u0ccd\u0cb0\u0cb5\u0cbe\u0cb0_\u0cb6\u0ca8\u0cbf\u0cb5\u0cbe\u0cb0".split("_"),weekdaysShort:"\u0cad\u0cbe\u0ca8\u0cc1_\u0cb8\u0cc6\u0cc2\u0cd5\u0cae_\u0cae\u0c82\u0c97\u0cb3_\u0cac\u0cc1\u0ca7_\u0c97\u0cc1\u0cb0\u0cc1_\u0cb6\u0cc1\u0c95\u0ccd\u0cb0_\u0cb6\u0ca8\u0cbf".split("_"),weekdaysMin:"\u0cad\u0cbe_\u0cb8\u0cc6\u0cc2\u0cd5_\u0cae\u0c82_\u0cac\u0cc1_\u0c97\u0cc1_\u0cb6\u0cc1_\u0cb6".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[\u0c87\u0c82\u0ca6\u0cc1] LT",nextDay:"[\u0ca8\u0cbe\u0cb3\u0cc6] LT",nextWeek:"dddd, LT",lastDay:"[\u0ca8\u0cbf\u0ca8\u0ccd\u0ca8\u0cc6] LT",lastWeek:"[\u0c95\u0cc6\u0cc2\u0ca8\u0cc6\u0caf] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0ca8\u0c82\u0ca4\u0cb0",past:"%s \u0cb9\u0cbf\u0c82\u0ca6\u0cc6",s:"\u0c95\u0cc6\u0cb2\u0cb5\u0cc1 \u0c95\u0ccd\u0cb7\u0ca3\u0c97\u0cb3\u0cc1",ss:"%d \u0cb8\u0cc6\u0c95\u0cc6\u0c82\u0ca1\u0cc1\u0c97\u0cb3\u0cc1",m:"\u0c92\u0c82\u0ca6\u0cc1 \u0ca8\u0cbf\u0cae\u0cbf\u0cb7",mm:"%d \u0ca8\u0cbf\u0cae\u0cbf\u0cb7",h:"\u0c92\u0c82\u0ca6\u0cc1 \u0c97\u0c82\u0c9f\u0cc6",hh:"%d \u0c97\u0c82\u0c9f\u0cc6",d:"\u0c92\u0c82\u0ca6\u0cc1 \u0ca6\u0cbf\u0ca8",dd:"%d \u0ca6\u0cbf\u0ca8",M:"\u0c92\u0c82\u0ca6\u0cc1 \u0ca4\u0cbf\u0c82\u0c97\u0cb3\u0cc1",MM:"%d \u0ca4\u0cbf\u0c82\u0c97\u0cb3\u0cc1",y:"\u0c92\u0c82\u0ca6\u0cc1 \u0cb5\u0cb0\u0ccd\u0cb7",yy:"%d \u0cb5\u0cb0\u0ccd\u0cb7"},preparse:function(t){return t.replace(/[\u0ce7\u0ce8\u0ce9\u0cea\u0ceb\u0cec\u0ced\u0cee\u0cef\u0ce6]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u0cb0\u0cbe\u0ca4\u0ccd\u0cb0\u0cbf|\u0cac\u0cc6\u0cb3\u0cbf\u0c97\u0ccd\u0c97\u0cc6|\u0cae\u0ca7\u0ccd\u0caf\u0cbe\u0cb9\u0ccd\u0ca8|\u0cb8\u0c82\u0c9c\u0cc6/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0cb0\u0cbe\u0ca4\u0ccd\u0cb0\u0cbf"===e?t<4?t:t+12:"\u0cac\u0cc6\u0cb3\u0cbf\u0c97\u0ccd\u0c97\u0cc6"===e?t:"\u0cae\u0ca7\u0ccd\u0caf\u0cbe\u0cb9\u0ccd\u0ca8"===e?t>=10?t:t+12:"\u0cb8\u0c82\u0c9c\u0cc6"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u0cb0\u0cbe\u0ca4\u0ccd\u0cb0\u0cbf":t<10?"\u0cac\u0cc6\u0cb3\u0cbf\u0c97\u0ccd\u0c97\u0cc6":t<17?"\u0cae\u0ca7\u0ccd\u0caf\u0cbe\u0cb9\u0ccd\u0ca8":t<20?"\u0cb8\u0c82\u0c9c\u0cc6":"\u0cb0\u0cbe\u0ca4\u0ccd\u0cb0\u0cbf"},dayOfMonthOrdinalParse:/\d{1,2}(\u0ca8\u0cc6\u0cd5)/,ordinal:function(t){return t+"\u0ca8\u0cc6\u0cd5"},week:{dow:0,doy:6}})}(n(30381))},33730:function(t,e,n){!function(t){"use strict";t.defineLocale("ko",{months:"1\uc6d4_2\uc6d4_3\uc6d4_4\uc6d4_5\uc6d4_6\uc6d4_7\uc6d4_8\uc6d4_9\uc6d4_10\uc6d4_11\uc6d4_12\uc6d4".split("_"),monthsShort:"1\uc6d4_2\uc6d4_3\uc6d4_4\uc6d4_5\uc6d4_6\uc6d4_7\uc6d4_8\uc6d4_9\uc6d4_10\uc6d4_11\uc6d4_12\uc6d4".split("_"),weekdays:"\uc77c\uc694\uc77c_\uc6d4\uc694\uc77c_\ud654\uc694\uc77c_\uc218\uc694\uc77c_\ubaa9\uc694\uc77c_\uae08\uc694\uc77c_\ud1a0\uc694\uc77c".split("_"),weekdaysShort:"\uc77c_\uc6d4_\ud654_\uc218_\ubaa9_\uae08_\ud1a0".split("_"),weekdaysMin:"\uc77c_\uc6d4_\ud654_\uc218_\ubaa9_\uae08_\ud1a0".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY\ub144 MMMM D\uc77c",LLL:"YYYY\ub144 MMMM D\uc77c A h:mm",LLLL:"YYYY\ub144 MMMM D\uc77c dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY\ub144 MMMM D\uc77c",lll:"YYYY\ub144 MMMM D\uc77c A h:mm",llll:"YYYY\ub144 MMMM D\uc77c dddd A h:mm"},calendar:{sameDay:"\uc624\ub298 LT",nextDay:"\ub0b4\uc77c LT",nextWeek:"dddd LT",lastDay:"\uc5b4\uc81c LT",lastWeek:"\uc9c0\ub09c\uc8fc dddd LT",sameElse:"L"},relativeTime:{future:"%s \ud6c4",past:"%s \uc804",s:"\uba87 \ucd08",ss:"%d\ucd08",m:"1\ubd84",mm:"%d\ubd84",h:"\ud55c \uc2dc\uac04",hh:"%d\uc2dc\uac04",d:"\ud558\ub8e8",dd:"%d\uc77c",M:"\ud55c \ub2ec",MM:"%d\ub2ec",y:"\uc77c \ub144",yy:"%d\ub144"},dayOfMonthOrdinalParse:/\d{1,2}(\uc77c|\uc6d4|\uc8fc)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"\uc77c";case"M":return t+"\uc6d4";case"w":case"W":return t+"\uc8fc";default:return t}},meridiemParse:/\uc624\uc804|\uc624\ud6c4/,isPM:function(t){return"\uc624\ud6c4"===t},meridiem:function(t,e,n){return t<12?"\uc624\uc804":"\uc624\ud6c4"}})}(n(30381))},1408:function(t,e,n){!function(t){"use strict";var e={1:"\u0661",2:"\u0662",3:"\u0663",4:"\u0664",5:"\u0665",6:"\u0666",7:"\u0667",8:"\u0668",9:"\u0669",0:"\u0660"},n={"\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u0660":"0"},r=["\u06a9\u0627\u0646\u0648\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645","\u0634\u0648\u0628\u0627\u062a","\u0626\u0627\u0632\u0627\u0631","\u0646\u06cc\u0633\u0627\u0646","\u0626\u0627\u06cc\u0627\u0631","\u062d\u0648\u0632\u06d5\u06cc\u0631\u0627\u0646","\u062a\u06d5\u0645\u0645\u0648\u0632","\u0626\u0627\u0628","\u0626\u06d5\u06cc\u0644\u0648\u0648\u0644","\u062a\u0634\u0631\u06cc\u0646\u06cc \u06cc\u06d5\u0643\u06d5\u0645","\u062a\u0634\u0631\u06cc\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645","\u0643\u0627\u0646\u0648\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645"];t.defineLocale("ku",{months:r,monthsShort:r,weekdays:"\u06cc\u0647\u200c\u0643\u0634\u0647\u200c\u0645\u0645\u0647\u200c_\u062f\u0648\u0648\u0634\u0647\u200c\u0645\u0645\u0647\u200c_\u0633\u06ce\u0634\u0647\u200c\u0645\u0645\u0647\u200c_\u0686\u0648\u0627\u0631\u0634\u0647\u200c\u0645\u0645\u0647\u200c_\u067e\u06ce\u0646\u062c\u0634\u0647\u200c\u0645\u0645\u0647\u200c_\u0647\u0647\u200c\u06cc\u0646\u06cc_\u0634\u0647\u200c\u0645\u0645\u0647\u200c".split("_"),weekdaysShort:"\u06cc\u0647\u200c\u0643\u0634\u0647\u200c\u0645_\u062f\u0648\u0648\u0634\u0647\u200c\u0645_\u0633\u06ce\u0634\u0647\u200c\u0645_\u0686\u0648\u0627\u0631\u0634\u0647\u200c\u0645_\u067e\u06ce\u0646\u062c\u0634\u0647\u200c\u0645_\u0647\u0647\u200c\u06cc\u0646\u06cc_\u0634\u0647\u200c\u0645\u0645\u0647\u200c".split("_"),weekdaysMin:"\u06cc_\u062f_\u0633_\u0686_\u067e_\u0647_\u0634".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/\u0626\u06ce\u0648\u0627\u0631\u0647\u200c|\u0628\u0647\u200c\u06cc\u0627\u0646\u06cc/,isPM:function(t){return/\u0626\u06ce\u0648\u0627\u0631\u0647\u200c/.test(t)},meridiem:function(t,e,n){return t<12?"\u0628\u0647\u200c\u06cc\u0627\u0646\u06cc":"\u0626\u06ce\u0648\u0627\u0631\u0647\u200c"},calendar:{sameDay:"[\u0626\u0647\u200c\u0645\u0631\u06c6 \u0643\u0627\u062a\u0698\u0645\u06ce\u0631] LT",nextDay:"[\u0628\u0647\u200c\u06cc\u0627\u0646\u06cc \u0643\u0627\u062a\u0698\u0645\u06ce\u0631] LT",nextWeek:"dddd [\u0643\u0627\u062a\u0698\u0645\u06ce\u0631] LT",lastDay:"[\u062f\u0648\u06ce\u0646\u06ce \u0643\u0627\u062a\u0698\u0645\u06ce\u0631] LT",lastWeek:"dddd [\u0643\u0627\u062a\u0698\u0645\u06ce\u0631] LT",sameElse:"L"},relativeTime:{future:"\u0644\u0647\u200c %s",past:"%s",s:"\u0686\u0647\u200c\u0646\u062f \u0686\u0631\u0643\u0647\u200c\u06cc\u0647\u200c\u0643",ss:"\u0686\u0631\u0643\u0647\u200c %d",m:"\u06cc\u0647\u200c\u0643 \u062e\u0648\u0644\u0647\u200c\u0643",mm:"%d \u062e\u0648\u0644\u0647\u200c\u0643",h:"\u06cc\u0647\u200c\u0643 \u0643\u0627\u062a\u0698\u0645\u06ce\u0631",hh:"%d \u0643\u0627\u062a\u0698\u0645\u06ce\u0631",d:"\u06cc\u0647\u200c\u0643 \u0695\u06c6\u0698",dd:"%d \u0695\u06c6\u0698",M:"\u06cc\u0647\u200c\u0643 \u0645\u0627\u0646\u06af",MM:"%d \u0645\u0627\u0646\u06af",y:"\u06cc\u0647\u200c\u0643 \u0633\u0627\u06b5",yy:"%d \u0633\u0627\u06b5"},preparse:function(t){return t.replace(/[\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u0660]/g,(function(t){return n[t]})).replace(/\u060c/g,",")},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]})).replace(/,/g,"\u060c")},week:{dow:6,doy:12}})}(n(30381))},33291:function(t,e,n){!function(t){"use strict";var e={0:"-\u0447\u04af",1:"-\u0447\u0438",2:"-\u0447\u0438",3:"-\u0447\u04af",4:"-\u0447\u04af",5:"-\u0447\u0438",6:"-\u0447\u044b",7:"-\u0447\u0438",8:"-\u0447\u0438",9:"-\u0447\u0443",10:"-\u0447\u0443",20:"-\u0447\u044b",30:"-\u0447\u0443",40:"-\u0447\u044b",50:"-\u0447\u04af",60:"-\u0447\u044b",70:"-\u0447\u0438",80:"-\u0447\u0438",90:"-\u0447\u0443",100:"-\u0447\u04af"};t.defineLocale("ky",{months:"\u044f\u043d\u0432\u0430\u0440\u044c_\u0444\u0435\u0432\u0440\u0430\u043b\u044c_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0435\u043b\u044c_\u043c\u0430\u0439_\u0438\u044e\u043d\u044c_\u0438\u044e\u043b\u044c_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c_\u043e\u043a\u0442\u044f\u0431\u0440\u044c_\u043d\u043e\u044f\u0431\u0440\u044c_\u0434\u0435\u043a\u0430\u0431\u0440\u044c".split("_"),monthsShort:"\u044f\u043d\u0432_\u0444\u0435\u0432_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440_\u043c\u0430\u0439_\u0438\u044e\u043d\u044c_\u0438\u044e\u043b\u044c_\u0430\u0432\u0433_\u0441\u0435\u043d_\u043e\u043a\u0442_\u043d\u043e\u044f_\u0434\u0435\u043a".split("_"),weekdays:"\u0416\u0435\u043a\u0448\u0435\u043c\u0431\u0438_\u0414\u04af\u0439\u0448\u04e9\u043c\u0431\u04af_\u0428\u0435\u0439\u0448\u0435\u043c\u0431\u0438_\u0428\u0430\u0440\u0448\u0435\u043c\u0431\u0438_\u0411\u0435\u0439\u0448\u0435\u043c\u0431\u0438_\u0416\u0443\u043c\u0430_\u0418\u0448\u0435\u043c\u0431\u0438".split("_"),weekdaysShort:"\u0416\u0435\u043a_\u0414\u04af\u0439_\u0428\u0435\u0439_\u0428\u0430\u0440_\u0411\u0435\u0439_\u0416\u0443\u043c_\u0418\u0448\u0435".split("_"),weekdaysMin:"\u0416\u043a_\u0414\u0439_\u0428\u0439_\u0428\u0440_\u0411\u0439_\u0416\u043c_\u0418\u0448".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0411\u04af\u0433\u04af\u043d \u0441\u0430\u0430\u0442] LT",nextDay:"[\u042d\u0440\u0442\u0435\u04a3 \u0441\u0430\u0430\u0442] LT",nextWeek:"dddd [\u0441\u0430\u0430\u0442] LT",lastDay:"[\u041a\u0435\u0447\u044d\u044d \u0441\u0430\u0430\u0442] LT",lastWeek:"[\u04e8\u0442\u043a\u04e9\u043d \u0430\u043f\u0442\u0430\u043d\u044b\u043d] dddd [\u043a\u04af\u043d\u04af] [\u0441\u0430\u0430\u0442] LT",sameElse:"L"},relativeTime:{future:"%s \u0438\u0447\u0438\u043d\u0434\u0435",past:"%s \u043c\u0443\u0440\u0443\u043d",s:"\u0431\u0438\u0440\u043d\u0435\u0447\u0435 \u0441\u0435\u043a\u0443\u043d\u0434",ss:"%d \u0441\u0435\u043a\u0443\u043d\u0434",m:"\u0431\u0438\u0440 \u043c\u04af\u043d\u04e9\u0442",mm:"%d \u043c\u04af\u043d\u04e9\u0442",h:"\u0431\u0438\u0440 \u0441\u0430\u0430\u0442",hh:"%d \u0441\u0430\u0430\u0442",d:"\u0431\u0438\u0440 \u043a\u04af\u043d",dd:"%d \u043a\u04af\u043d",M:"\u0431\u0438\u0440 \u0430\u0439",MM:"%d \u0430\u0439",y:"\u0431\u0438\u0440 \u0436\u044b\u043b",yy:"%d \u0436\u044b\u043b"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0447\u0438|\u0447\u044b|\u0447\u04af|\u0447\u0443)/,ordinal:function(t){var n=t%10,r=t>=100?100:null;return t+(e[t]||e[n]||e[r])},week:{dow:1,doy:7}})}(n(30381))},36841:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return e?i[n][0]:i[n][1]}function n(t){return i(t.substr(0,t.indexOf(" ")))?"a "+t:"an "+t}function r(t){return i(t.substr(0,t.indexOf(" ")))?"viru "+t:"virun "+t}function i(t){if(t=parseInt(t,10),isNaN(t))return!1;if(t<0)return!0;if(t<10)return 4<=t&&t<=7;if(t<100){var e=t%10;return i(0===e?t/10:e)}if(t<1e4){for(;t>=10;)t/=10;return i(t)}return i(t/=1e3)}t.defineLocale("lb",{months:"Januar_Februar_M\xe4erz_Abr\xebll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_M\xe9indeg_D\xebnschdeg_M\xebttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._M\xe9._D\xeb._M\xeb._Do._Fr._Sa.".split("_"),weekdaysMin:"So_M\xe9_D\xeb_M\xeb_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[G\xebschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:n,past:r,s:"e puer Sekonnen",ss:"%d Sekonnen",m:e,mm:"%d Minutten",h:e,hh:"%d Stonnen",d:e,dd:"%d Deeg",M:e,MM:"%d M\xe9int",y:e,yy:"%d Joer"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},55466:function(t,e,n){!function(t){"use strict";t.defineLocale("lo",{months:"\u0ea1\u0eb1\u0e87\u0e81\u0ead\u0e99_\u0e81\u0eb8\u0ea1\u0e9e\u0eb2_\u0ea1\u0eb5\u0e99\u0eb2_\u0ec0\u0ea1\u0eaa\u0eb2_\u0e9e\u0eb6\u0e94\u0eaa\u0eb0\u0e9e\u0eb2_\u0ea1\u0eb4\u0e96\u0eb8\u0e99\u0eb2_\u0e81\u0ecd\u0ea5\u0eb0\u0e81\u0ebb\u0e94_\u0eaa\u0eb4\u0e87\u0eab\u0eb2_\u0e81\u0eb1\u0e99\u0e8d\u0eb2_\u0e95\u0eb8\u0ea5\u0eb2_\u0e9e\u0eb0\u0e88\u0eb4\u0e81_\u0e97\u0eb1\u0e99\u0ea7\u0eb2".split("_"),monthsShort:"\u0ea1\u0eb1\u0e87\u0e81\u0ead\u0e99_\u0e81\u0eb8\u0ea1\u0e9e\u0eb2_\u0ea1\u0eb5\u0e99\u0eb2_\u0ec0\u0ea1\u0eaa\u0eb2_\u0e9e\u0eb6\u0e94\u0eaa\u0eb0\u0e9e\u0eb2_\u0ea1\u0eb4\u0e96\u0eb8\u0e99\u0eb2_\u0e81\u0ecd\u0ea5\u0eb0\u0e81\u0ebb\u0e94_\u0eaa\u0eb4\u0e87\u0eab\u0eb2_\u0e81\u0eb1\u0e99\u0e8d\u0eb2_\u0e95\u0eb8\u0ea5\u0eb2_\u0e9e\u0eb0\u0e88\u0eb4\u0e81_\u0e97\u0eb1\u0e99\u0ea7\u0eb2".split("_"),weekdays:"\u0ead\u0eb2\u0e97\u0eb4\u0e94_\u0e88\u0eb1\u0e99_\u0ead\u0eb1\u0e87\u0e84\u0eb2\u0e99_\u0e9e\u0eb8\u0e94_\u0e9e\u0eb0\u0eab\u0eb1\u0e94_\u0eaa\u0eb8\u0e81_\u0ec0\u0eaa\u0ebb\u0eb2".split("_"),weekdaysShort:"\u0e97\u0eb4\u0e94_\u0e88\u0eb1\u0e99_\u0ead\u0eb1\u0e87\u0e84\u0eb2\u0e99_\u0e9e\u0eb8\u0e94_\u0e9e\u0eb0\u0eab\u0eb1\u0e94_\u0eaa\u0eb8\u0e81_\u0ec0\u0eaa\u0ebb\u0eb2".split("_"),weekdaysMin:"\u0e97_\u0e88_\u0ead\u0e84_\u0e9e_\u0e9e\u0eab_\u0eaa\u0e81_\u0eaa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"\u0ea7\u0eb1\u0e99dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0e95\u0ead\u0e99\u0ec0\u0e8a\u0ebb\u0ec9\u0eb2|\u0e95\u0ead\u0e99\u0ec1\u0ea5\u0e87/,isPM:function(t){return"\u0e95\u0ead\u0e99\u0ec1\u0ea5\u0e87"===t},meridiem:function(t,e,n){return t<12?"\u0e95\u0ead\u0e99\u0ec0\u0e8a\u0ebb\u0ec9\u0eb2":"\u0e95\u0ead\u0e99\u0ec1\u0ea5\u0e87"},calendar:{sameDay:"[\u0ea1\u0eb7\u0ec9\u0e99\u0eb5\u0ec9\u0ec0\u0ea7\u0ea5\u0eb2] LT",nextDay:"[\u0ea1\u0eb7\u0ec9\u0ead\u0eb7\u0ec8\u0e99\u0ec0\u0ea7\u0ea5\u0eb2] LT",nextWeek:"[\u0ea7\u0eb1\u0e99]dddd[\u0edc\u0ec9\u0eb2\u0ec0\u0ea7\u0ea5\u0eb2] LT",lastDay:"[\u0ea1\u0eb7\u0ec9\u0ea7\u0eb2\u0e99\u0e99\u0eb5\u0ec9\u0ec0\u0ea7\u0ea5\u0eb2] LT",lastWeek:"[\u0ea7\u0eb1\u0e99]dddd[\u0ec1\u0ea5\u0ec9\u0ea7\u0e99\u0eb5\u0ec9\u0ec0\u0ea7\u0ea5\u0eb2] LT",sameElse:"L"},relativeTime:{future:"\u0ead\u0eb5\u0e81 %s",past:"%s\u0e9c\u0ec8\u0eb2\u0e99\u0ea1\u0eb2",s:"\u0e9a\u0ecd\u0ec8\u0ec0\u0e97\u0ebb\u0ec8\u0eb2\u0ec3\u0e94\u0ea7\u0eb4\u0e99\u0eb2\u0e97\u0eb5",ss:"%d \u0ea7\u0eb4\u0e99\u0eb2\u0e97\u0eb5",m:"1 \u0e99\u0eb2\u0e97\u0eb5",mm:"%d \u0e99\u0eb2\u0e97\u0eb5",h:"1 \u0e8a\u0ebb\u0ec8\u0ea7\u0ec2\u0ea1\u0e87",hh:"%d \u0e8a\u0ebb\u0ec8\u0ea7\u0ec2\u0ea1\u0e87",d:"1 \u0ea1\u0eb7\u0ec9",dd:"%d \u0ea1\u0eb7\u0ec9",M:"1 \u0ec0\u0e94\u0eb7\u0ead\u0e99",MM:"%d \u0ec0\u0e94\u0eb7\u0ead\u0e99",y:"1 \u0e9b\u0eb5",yy:"%d \u0e9b\u0eb5"},dayOfMonthOrdinalParse:/(\u0e97\u0eb5\u0ec8)\d{1,2}/,ordinal:function(t){return"\u0e97\u0eb5\u0ec8"+t}})}(n(30381))},57010:function(t,e,n){!function(t){"use strict";var e={ss:"sekund\u0117_sekund\u017ei\u0173_sekundes",m:"minut\u0117_minut\u0117s_minut\u0119",mm:"minut\u0117s_minu\u010di\u0173_minutes",h:"valanda_valandos_valand\u0105",hh:"valandos_valand\u0173_valandas",d:"diena_dienos_dien\u0105",dd:"dienos_dien\u0173_dienas",M:"m\u0117nuo_m\u0117nesio_m\u0117nes\u012f",MM:"m\u0117nesiai_m\u0117nesi\u0173_m\u0117nesius",y:"metai_met\u0173_metus",yy:"metai_met\u0173_metus"};function n(t,e,n,r){return e?"kelios sekund\u0117s":r?"keli\u0173 sekund\u017ei\u0173":"kelias sekundes"}function r(t,e,n,r){return e?a(n)[0]:r?a(n)[1]:a(n)[2]}function i(t){return t%10==0||t>10&&t<20}function a(t){return e[t].split("_")}function s(t,e,n,s){var o=t+" ";return 1===t?o+r(t,e,n[0],s):e?o+(i(t)?a(n)[1]:a(n)[0]):s?o+a(n)[1]:o+(i(t)?a(n)[1]:a(n)[2])}t.defineLocale("lt",{months:{format:"sausio_vasario_kovo_baland\u017eio_gegu\u017e\u0117s_bir\u017eelio_liepos_rugpj\u016b\u010dio_rugs\u0117jo_spalio_lapkri\u010dio_gruod\u017eio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegu\u017e\u0117_bir\u017eelis_liepa_rugpj\u016btis_rugs\u0117jis_spalis_lapkritis_gruodis".split("_"),isFormat:/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadien\u012f_pirmadien\u012f_antradien\u012f_tre\u010diadien\u012f_ketvirtadien\u012f_penktadien\u012f_\u0161e\u0161tadien\u012f".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_tre\u010diadienis_ketvirtadienis_penktadienis_\u0161e\u0161tadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_\u0160e\u0161".split("_"),weekdaysMin:"S_P_A_T_K_Pn_\u0160".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[\u0160iandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Pra\u0117jus\u012f] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prie\u0161 %s",s:n,ss:s,m:r,mm:s,h:r,hh:s,d:r,dd:s,M:r,MM:s,y:r,yy:s},dayOfMonthOrdinalParse:/\d{1,2}-oji/,ordinal:function(t){return t+"-oji"},week:{dow:1,doy:4}})}(n(30381))},37595:function(t,e,n){!function(t){"use strict";var e={ss:"sekundes_sekund\u0113m_sekunde_sekundes".split("_"),m:"min\u016btes_min\u016bt\u0113m_min\u016bte_min\u016btes".split("_"),mm:"min\u016btes_min\u016bt\u0113m_min\u016bte_min\u016btes".split("_"),h:"stundas_stund\u0101m_stunda_stundas".split("_"),hh:"stundas_stund\u0101m_stunda_stundas".split("_"),d:"dienas_dien\u0101m_diena_dienas".split("_"),dd:"dienas_dien\u0101m_diena_dienas".split("_"),M:"m\u0113ne\u0161a_m\u0113ne\u0161iem_m\u0113nesis_m\u0113ne\u0161i".split("_"),MM:"m\u0113ne\u0161a_m\u0113ne\u0161iem_m\u0113nesis_m\u0113ne\u0161i".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")};function n(t,e,n){return n?e%10==1&&e%100!=11?t[2]:t[3]:e%10==1&&e%100!=11?t[0]:t[1]}function r(t,r,i){return t+" "+n(e[i],t,r)}function i(t,r,i){return n(e[i],t,r)}function a(t,e){return e?"da\u017eas sekundes":"da\u017e\u0101m sekund\u0113m"}t.defineLocale("lv",{months:"janv\u0101ris_febru\u0101ris_marts_apr\u012blis_maijs_j\u016bnijs_j\u016blijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_j\u016bn_j\u016bl_aug_sep_okt_nov_dec".split("_"),weekdays:"sv\u0113tdiena_pirmdiena_otrdiena_tre\u0161diena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[\u0160odien pulksten] LT",nextDay:"[R\u012bt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pag\u0101ju\u0161\u0101] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"p\u0113c %s",past:"pirms %s",s:a,ss:r,m:i,mm:r,h:i,hh:r,d:i,dd:r,M:i,MM:r,y:i,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},39861:function(t,e,n){!function(t){"use strict";var e={words:{ss:["sekund","sekunda","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(t,e){return 1===t?e[0]:t>=2&&t<=4?e[1]:e[2]},translate:function(t,n,r){var i=e.words[r];return 1===r.length?n?i[0]:i[1]:t+" "+e.correctGrammaticalCase(t,i)}};t.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_\u010detvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._\u010det._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_\u010de_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[ju\u010de u] LT",lastWeek:function(){return["[pro\u0161le] [nedjelje] [u] LT","[pro\u0161log] [ponedjeljka] [u] LT","[pro\u0161log] [utorka] [u] LT","[pro\u0161le] [srijede] [u] LT","[pro\u0161log] [\u010detvrtka] [u] LT","[pro\u0161log] [petka] [u] LT","[pro\u0161le] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:"dan",dd:e.translate,M:"mjesec",MM:e.translate,y:"godinu",yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},35493:function(t,e,n){!function(t){"use strict";t.defineLocale("mi",{months:"Kohi-t\u0101te_Hui-tanguru_Pout\u016b-te-rangi_Paenga-wh\u0101wh\u0101_Haratua_Pipiri_H\u014dngoingoi_Here-turi-k\u014dk\u0101_Mahuru_Whiringa-\u0101-nuku_Whiringa-\u0101-rangi_Hakihea".split("_"),monthsShort:"Kohi_Hui_Pou_Pae_Hara_Pipi_H\u014dngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),monthsRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,weekdays:"R\u0101tapu_Mane_T\u016brei_Wenerei_T\u0101ite_Paraire_H\u0101tarei".split("_"),weekdaysShort:"Ta_Ma_T\u016b_We_T\u0101i_Pa_H\u0101".split("_"),weekdaysMin:"Ta_Ma_T\u016b_We_T\u0101i_Pa_H\u0101".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [i] HH:mm",LLLL:"dddd, D MMMM YYYY [i] HH:mm"},calendar:{sameDay:"[i teie mahana, i] LT",nextDay:"[apopo i] LT",nextWeek:"dddd [i] LT",lastDay:"[inanahi i] LT",lastWeek:"dddd [whakamutunga i] LT",sameElse:"L"},relativeTime:{future:"i roto i %s",past:"%s i mua",s:"te h\u0113kona ruarua",ss:"%d h\u0113kona",m:"he meneti",mm:"%d meneti",h:"te haora",hh:"%d haora",d:"he ra",dd:"%d ra",M:"he marama",MM:"%d marama",y:"he tau",yy:"%d tau"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4}})}(n(30381))},95966:function(t,e,n){!function(t){"use strict";t.defineLocale("mk",{months:"\u0458\u0430\u043d\u0443\u0430\u0440\u0438_\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0438\u043b_\u043c\u0430\u0458_\u0458\u0443\u043d\u0438_\u0458\u0443\u043b\u0438_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438_\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438_\u043d\u043e\u0435\u043c\u0432\u0440\u0438_\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438".split("_"),monthsShort:"\u0458\u0430\u043d_\u0444\u0435\u0432_\u043c\u0430\u0440_\u0430\u043f\u0440_\u043c\u0430\u0458_\u0458\u0443\u043d_\u0458\u0443\u043b_\u0430\u0432\u0433_\u0441\u0435\u043f_\u043e\u043a\u0442_\u043d\u043e\u0435_\u0434\u0435\u043a".split("_"),weekdays:"\u043d\u0435\u0434\u0435\u043b\u0430_\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a_\u0432\u0442\u043e\u0440\u043d\u0438\u043a_\u0441\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0440\u0442\u043e\u043a_\u043f\u0435\u0442\u043e\u043a_\u0441\u0430\u0431\u043e\u0442\u0430".split("_"),weekdaysShort:"\u043d\u0435\u0434_\u043f\u043e\u043d_\u0432\u0442\u043e_\u0441\u0440\u0435_\u0447\u0435\u0442_\u043f\u0435\u0442_\u0441\u0430\u0431".split("_"),weekdaysMin:"\u043de_\u043fo_\u0432\u0442_\u0441\u0440_\u0447\u0435_\u043f\u0435_\u0441a".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[\u0414\u0435\u043d\u0435\u0441 \u0432\u043e] LT",nextDay:"[\u0423\u0442\u0440\u0435 \u0432\u043e] LT",nextWeek:"[\u0412\u043e] dddd [\u0432\u043e] LT",lastDay:"[\u0412\u0447\u0435\u0440\u0430 \u0432\u043e] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[\u0418\u0437\u043c\u0438\u043d\u0430\u0442\u0430\u0442\u0430] dddd [\u0432\u043e] LT";case 1:case 2:case 4:case 5:return"[\u0418\u0437\u043c\u0438\u043d\u0430\u0442\u0438\u043e\u0442] dddd [\u0432\u043e] LT"}},sameElse:"L"},relativeTime:{future:"\u0437\u0430 %s",past:"\u043f\u0440\u0435\u0434 %s",s:"\u043d\u0435\u043a\u043e\u043b\u043a\u0443 \u0441\u0435\u043a\u0443\u043d\u0434\u0438",ss:"%d \u0441\u0435\u043a\u0443\u043d\u0434\u0438",m:"\u0435\u0434\u043d\u0430 \u043c\u0438\u043d\u0443\u0442\u0430",mm:"%d \u043c\u0438\u043d\u0443\u0442\u0438",h:"\u0435\u0434\u0435\u043d \u0447\u0430\u0441",hh:"%d \u0447\u0430\u0441\u0430",d:"\u0435\u0434\u0435\u043d \u0434\u0435\u043d",dd:"%d \u0434\u0435\u043d\u0430",M:"\u0435\u0434\u0435\u043d \u043c\u0435\u0441\u0435\u0446",MM:"%d \u043c\u0435\u0441\u0435\u0446\u0438",y:"\u0435\u0434\u043d\u0430 \u0433\u043e\u0434\u0438\u043d\u0430",yy:"%d \u0433\u043e\u0434\u0438\u043d\u0438"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0435\u0432|\u0435\u043d|\u0442\u0438|\u0432\u0438|\u0440\u0438|\u043c\u0438)/,ordinal:function(t){var e=t%10,n=t%100;return 0===t?t+"-\u0435\u0432":0===n?t+"-\u0435\u043d":n>10&&n<20?t+"-\u0442\u0438":1===e?t+"-\u0432\u0438":2===e?t+"-\u0440\u0438":7===e||8===e?t+"-\u043c\u0438":t+"-\u0442\u0438"},week:{dow:1,doy:7}})}(n(30381))},87341:function(t,e,n){!function(t){"use strict";t.defineLocale("ml",{months:"\u0d1c\u0d28\u0d41\u0d35\u0d30\u0d3f_\u0d2b\u0d46\u0d2c\u0d4d\u0d30\u0d41\u0d35\u0d30\u0d3f_\u0d2e\u0d3e\u0d7c\u0d1a\u0d4d\u0d1a\u0d4d_\u0d0f\u0d2a\u0d4d\u0d30\u0d3f\u0d7d_\u0d2e\u0d47\u0d2f\u0d4d_\u0d1c\u0d42\u0d7a_\u0d1c\u0d42\u0d32\u0d48_\u0d13\u0d17\u0d38\u0d4d\u0d31\u0d4d\u0d31\u0d4d_\u0d38\u0d46\u0d2a\u0d4d\u0d31\u0d4d\u0d31\u0d02\u0d2c\u0d7c_\u0d12\u0d15\u0d4d\u0d1f\u0d4b\u0d2c\u0d7c_\u0d28\u0d35\u0d02\u0d2c\u0d7c_\u0d21\u0d3f\u0d38\u0d02\u0d2c\u0d7c".split("_"),monthsShort:"\u0d1c\u0d28\u0d41._\u0d2b\u0d46\u0d2c\u0d4d\u0d30\u0d41._\u0d2e\u0d3e\u0d7c._\u0d0f\u0d2a\u0d4d\u0d30\u0d3f._\u0d2e\u0d47\u0d2f\u0d4d_\u0d1c\u0d42\u0d7a_\u0d1c\u0d42\u0d32\u0d48._\u0d13\u0d17._\u0d38\u0d46\u0d2a\u0d4d\u0d31\u0d4d\u0d31._\u0d12\u0d15\u0d4d\u0d1f\u0d4b._\u0d28\u0d35\u0d02._\u0d21\u0d3f\u0d38\u0d02.".split("_"),monthsParseExact:!0,weekdays:"\u0d1e\u0d3e\u0d2f\u0d31\u0d3e\u0d34\u0d4d\u0d1a_\u0d24\u0d3f\u0d19\u0d4d\u0d15\u0d33\u0d3e\u0d34\u0d4d\u0d1a_\u0d1a\u0d4a\u0d35\u0d4d\u0d35\u0d3e\u0d34\u0d4d\u0d1a_\u0d2c\u0d41\u0d27\u0d28\u0d3e\u0d34\u0d4d\u0d1a_\u0d35\u0d4d\u0d2f\u0d3e\u0d34\u0d3e\u0d34\u0d4d\u0d1a_\u0d35\u0d46\u0d33\u0d4d\u0d33\u0d3f\u0d2f\u0d3e\u0d34\u0d4d\u0d1a_\u0d36\u0d28\u0d3f\u0d2f\u0d3e\u0d34\u0d4d\u0d1a".split("_"),weekdaysShort:"\u0d1e\u0d3e\u0d2f\u0d7c_\u0d24\u0d3f\u0d19\u0d4d\u0d15\u0d7e_\u0d1a\u0d4a\u0d35\u0d4d\u0d35_\u0d2c\u0d41\u0d27\u0d7b_\u0d35\u0d4d\u0d2f\u0d3e\u0d34\u0d02_\u0d35\u0d46\u0d33\u0d4d\u0d33\u0d3f_\u0d36\u0d28\u0d3f".split("_"),weekdaysMin:"\u0d1e\u0d3e_\u0d24\u0d3f_\u0d1a\u0d4a_\u0d2c\u0d41_\u0d35\u0d4d\u0d2f\u0d3e_\u0d35\u0d46_\u0d36".split("_"),longDateFormat:{LT:"A h:mm -\u0d28\u0d41",LTS:"A h:mm:ss -\u0d28\u0d41",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -\u0d28\u0d41",LLLL:"dddd, D MMMM YYYY, A h:mm -\u0d28\u0d41"},calendar:{sameDay:"[\u0d07\u0d28\u0d4d\u0d28\u0d4d] LT",nextDay:"[\u0d28\u0d3e\u0d33\u0d46] LT",nextWeek:"dddd, LT",lastDay:"[\u0d07\u0d28\u0d4d\u0d28\u0d32\u0d46] LT",lastWeek:"[\u0d15\u0d34\u0d3f\u0d1e\u0d4d\u0d1e] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0d15\u0d34\u0d3f\u0d1e\u0d4d\u0d1e\u0d4d",past:"%s \u0d2e\u0d41\u0d7b\u0d2a\u0d4d",s:"\u0d05\u0d7d\u0d2a \u0d28\u0d3f\u0d2e\u0d3f\u0d37\u0d19\u0d4d\u0d19\u0d7e",ss:"%d \u0d38\u0d46\u0d15\u0d4d\u0d15\u0d7b\u0d21\u0d4d",m:"\u0d12\u0d30\u0d41 \u0d2e\u0d3f\u0d28\u0d3f\u0d31\u0d4d\u0d31\u0d4d",mm:"%d \u0d2e\u0d3f\u0d28\u0d3f\u0d31\u0d4d\u0d31\u0d4d",h:"\u0d12\u0d30\u0d41 \u0d2e\u0d23\u0d3f\u0d15\u0d4d\u0d15\u0d42\u0d7c",hh:"%d \u0d2e\u0d23\u0d3f\u0d15\u0d4d\u0d15\u0d42\u0d7c",d:"\u0d12\u0d30\u0d41 \u0d26\u0d3f\u0d35\u0d38\u0d02",dd:"%d \u0d26\u0d3f\u0d35\u0d38\u0d02",M:"\u0d12\u0d30\u0d41 \u0d2e\u0d3e\u0d38\u0d02",MM:"%d \u0d2e\u0d3e\u0d38\u0d02",y:"\u0d12\u0d30\u0d41 \u0d35\u0d7c\u0d37\u0d02",yy:"%d \u0d35\u0d7c\u0d37\u0d02"},meridiemParse:/\u0d30\u0d3e\u0d24\u0d4d\u0d30\u0d3f|\u0d30\u0d3e\u0d35\u0d3f\u0d32\u0d46|\u0d09\u0d1a\u0d4d\u0d1a \u0d15\u0d34\u0d3f\u0d1e\u0d4d\u0d1e\u0d4d|\u0d35\u0d48\u0d15\u0d41\u0d28\u0d4d\u0d28\u0d47\u0d30\u0d02|\u0d30\u0d3e\u0d24\u0d4d\u0d30\u0d3f/i,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0d30\u0d3e\u0d24\u0d4d\u0d30\u0d3f"===e&&t>=4||"\u0d09\u0d1a\u0d4d\u0d1a \u0d15\u0d34\u0d3f\u0d1e\u0d4d\u0d1e\u0d4d"===e||"\u0d35\u0d48\u0d15\u0d41\u0d28\u0d4d\u0d28\u0d47\u0d30\u0d02"===e?t+12:t},meridiem:function(t,e,n){return t<4?"\u0d30\u0d3e\u0d24\u0d4d\u0d30\u0d3f":t<12?"\u0d30\u0d3e\u0d35\u0d3f\u0d32\u0d46":t<17?"\u0d09\u0d1a\u0d4d\u0d1a \u0d15\u0d34\u0d3f\u0d1e\u0d4d\u0d1e\u0d4d":t<20?"\u0d35\u0d48\u0d15\u0d41\u0d28\u0d4d\u0d28\u0d47\u0d30\u0d02":"\u0d30\u0d3e\u0d24\u0d4d\u0d30\u0d3f"}})}(n(30381))},5115:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){switch(n){case"s":return e?"\u0445\u044d\u0434\u0445\u044d\u043d \u0441\u0435\u043a\u0443\u043d\u0434":"\u0445\u044d\u0434\u0445\u044d\u043d \u0441\u0435\u043a\u0443\u043d\u0434\u044b\u043d";case"ss":return t+(e?" \u0441\u0435\u043a\u0443\u043d\u0434":" \u0441\u0435\u043a\u0443\u043d\u0434\u044b\u043d");case"m":case"mm":return t+(e?" \u043c\u0438\u043d\u0443\u0442":" \u043c\u0438\u043d\u0443\u0442\u044b\u043d");case"h":case"hh":return t+(e?" \u0446\u0430\u0433":" \u0446\u0430\u0433\u0438\u0439\u043d");case"d":case"dd":return t+(e?" \u04e9\u0434\u04e9\u0440":" \u04e9\u0434\u0440\u0438\u0439\u043d");case"M":case"MM":return t+(e?" \u0441\u0430\u0440":" \u0441\u0430\u0440\u044b\u043d");case"y":case"yy":return t+(e?" \u0436\u0438\u043b":" \u0436\u0438\u043b\u0438\u0439\u043d");default:return t}}t.defineLocale("mn",{months:"\u041d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440_\u0425\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440_\u0413\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440_\u0414\u04e9\u0440\u04e9\u0432\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440_\u0422\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440_\u0417\u0443\u0440\u0433\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440_\u0414\u043e\u043b\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440_\u041d\u0430\u0439\u043c\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440_\u0415\u0441\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440_\u0410\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440_\u0410\u0440\u0432\u0430\u043d \u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440_\u0410\u0440\u0432\u0430\u043d \u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440".split("_"),monthsShort:"1 \u0441\u0430\u0440_2 \u0441\u0430\u0440_3 \u0441\u0430\u0440_4 \u0441\u0430\u0440_5 \u0441\u0430\u0440_6 \u0441\u0430\u0440_7 \u0441\u0430\u0440_8 \u0441\u0430\u0440_9 \u0441\u0430\u0440_10 \u0441\u0430\u0440_11 \u0441\u0430\u0440_12 \u0441\u0430\u0440".split("_"),monthsParseExact:!0,weekdays:"\u041d\u044f\u043c_\u0414\u0430\u0432\u0430\u0430_\u041c\u044f\u0433\u043c\u0430\u0440_\u041b\u0445\u0430\u0433\u0432\u0430_\u041f\u04af\u0440\u044d\u0432_\u0411\u0430\u0430\u0441\u0430\u043d_\u0411\u044f\u043c\u0431\u0430".split("_"),weekdaysShort:"\u041d\u044f\u043c_\u0414\u0430\u0432_\u041c\u044f\u0433_\u041b\u0445\u0430_\u041f\u04af\u0440_\u0411\u0430\u0430_\u0411\u044f\u043c".split("_"),weekdaysMin:"\u041d\u044f_\u0414\u0430_\u041c\u044f_\u041b\u0445_\u041f\u04af_\u0411\u0430_\u0411\u044f".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY \u043e\u043d\u044b MMMM\u044b\u043d D",LLL:"YYYY \u043e\u043d\u044b MMMM\u044b\u043d D HH:mm",LLLL:"dddd, YYYY \u043e\u043d\u044b MMMM\u044b\u043d D HH:mm"},meridiemParse:/\u04ae\u04e8|\u04ae\u0425/i,isPM:function(t){return"\u04ae\u0425"===t},meridiem:function(t,e,n){return t<12?"\u04ae\u04e8":"\u04ae\u0425"},calendar:{sameDay:"[\u04e8\u043d\u04e9\u04e9\u0434\u04e9\u0440] LT",nextDay:"[\u041c\u0430\u0440\u0433\u0430\u0430\u0448] LT",nextWeek:"[\u0418\u0440\u044d\u0445] dddd LT",lastDay:"[\u04e8\u0447\u0438\u0433\u0434\u04e9\u0440] LT",lastWeek:"[\u04e8\u043d\u0433\u04e9\u0440\u0441\u04e9\u043d] dddd LT",sameElse:"L"},relativeTime:{future:"%s \u0434\u0430\u0440\u0430\u0430",past:"%s \u04e9\u043c\u043d\u04e9",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2} \u04e9\u0434\u04e9\u0440/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+" \u04e9\u0434\u04e9\u0440";default:return t}}})}(n(30381))},10370:function(t,e,n){!function(t){"use strict";var e={1:"\u0967",2:"\u0968",3:"\u0969",4:"\u096a",5:"\u096b",6:"\u096c",7:"\u096d",8:"\u096e",9:"\u096f",0:"\u0966"},n={"\u0967":"1","\u0968":"2","\u0969":"3","\u096a":"4","\u096b":"5","\u096c":"6","\u096d":"7","\u096e":"8","\u096f":"9","\u0966":"0"};function r(t,e,n,r){var i="";if(e)switch(n){case"s":i="\u0915\u093e\u0939\u0940 \u0938\u0947\u0915\u0902\u0926";break;case"ss":i="%d \u0938\u0947\u0915\u0902\u0926";break;case"m":i="\u090f\u0915 \u092e\u093f\u0928\u093f\u091f";break;case"mm":i="%d \u092e\u093f\u0928\u093f\u091f\u0947";break;case"h":i="\u090f\u0915 \u0924\u093e\u0938";break;case"hh":i="%d \u0924\u093e\u0938";break;case"d":i="\u090f\u0915 \u0926\u093f\u0935\u0938";break;case"dd":i="%d \u0926\u093f\u0935\u0938";break;case"M":i="\u090f\u0915 \u092e\u0939\u093f\u0928\u093e";break;case"MM":i="%d \u092e\u0939\u093f\u0928\u0947";break;case"y":i="\u090f\u0915 \u0935\u0930\u094d\u0937";break;case"yy":i="%d \u0935\u0930\u094d\u0937\u0947"}else switch(n){case"s":i="\u0915\u093e\u0939\u0940 \u0938\u0947\u0915\u0902\u0926\u093e\u0902";break;case"ss":i="%d \u0938\u0947\u0915\u0902\u0926\u093e\u0902";break;case"m":i="\u090f\u0915\u093e \u092e\u093f\u0928\u093f\u091f\u093e";break;case"mm":i="%d \u092e\u093f\u0928\u093f\u091f\u093e\u0902";break;case"h":i="\u090f\u0915\u093e \u0924\u093e\u0938\u093e";break;case"hh":i="%d \u0924\u093e\u0938\u093e\u0902";break;case"d":i="\u090f\u0915\u093e \u0926\u093f\u0935\u0938\u093e";break;case"dd":i="%d \u0926\u093f\u0935\u0938\u093e\u0902";break;case"M":i="\u090f\u0915\u093e \u092e\u0939\u093f\u0928\u094d\u092f\u093e";break;case"MM":i="%d \u092e\u0939\u093f\u0928\u094d\u092f\u093e\u0902";break;case"y":i="\u090f\u0915\u093e \u0935\u0930\u094d\u0937\u093e";break;case"yy":i="%d \u0935\u0930\u094d\u0937\u093e\u0902"}return i.replace(/%d/i,t)}t.defineLocale("mr",{months:"\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940_\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940_\u092e\u093e\u0930\u094d\u091a_\u090f\u092a\u094d\u0930\u093f\u0932_\u092e\u0947_\u091c\u0942\u0928_\u091c\u0941\u0932\u0948_\u0911\u0917\u0938\u094d\u091f_\u0938\u092a\u094d\u091f\u0947\u0902\u092c\u0930_\u0911\u0915\u094d\u091f\u094b\u092c\u0930_\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930_\u0921\u093f\u0938\u0947\u0902\u092c\u0930".split("_"),monthsShort:"\u091c\u093e\u0928\u0947._\u092b\u0947\u092c\u094d\u0930\u0941._\u092e\u093e\u0930\u094d\u091a._\u090f\u092a\u094d\u0930\u093f._\u092e\u0947._\u091c\u0942\u0928._\u091c\u0941\u0932\u0948._\u0911\u0917._\u0938\u092a\u094d\u091f\u0947\u0902._\u0911\u0915\u094d\u091f\u094b._\u0928\u094b\u0935\u094d\u0939\u0947\u0902._\u0921\u093f\u0938\u0947\u0902.".split("_"),monthsParseExact:!0,weekdays:"\u0930\u0935\u093f\u0935\u093e\u0930_\u0938\u094b\u092e\u0935\u093e\u0930_\u092e\u0902\u0917\u0933\u0935\u093e\u0930_\u092c\u0941\u0927\u0935\u093e\u0930_\u0917\u0941\u0930\u0942\u0935\u093e\u0930_\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930_\u0936\u0928\u093f\u0935\u093e\u0930".split("_"),weekdaysShort:"\u0930\u0935\u093f_\u0938\u094b\u092e_\u092e\u0902\u0917\u0933_\u092c\u0941\u0927_\u0917\u0941\u0930\u0942_\u0936\u0941\u0915\u094d\u0930_\u0936\u0928\u093f".split("_"),weekdaysMin:"\u0930_\u0938\u094b_\u092e\u0902_\u092c\u0941_\u0917\u0941_\u0936\u0941_\u0936".split("_"),longDateFormat:{LT:"A h:mm \u0935\u093e\u091c\u0924\u093e",LTS:"A h:mm:ss \u0935\u093e\u091c\u0924\u093e",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u0935\u093e\u091c\u0924\u093e",LLLL:"dddd, D MMMM YYYY, A h:mm \u0935\u093e\u091c\u0924\u093e"},calendar:{sameDay:"[\u0906\u091c] LT",nextDay:"[\u0909\u0926\u094d\u092f\u093e] LT",nextWeek:"dddd, LT",lastDay:"[\u0915\u093e\u0932] LT",lastWeek:"[\u092e\u093e\u0917\u0940\u0932] dddd, LT",sameElse:"L"},relativeTime:{future:"%s\u092e\u0927\u094d\u092f\u0947",past:"%s\u092a\u0942\u0930\u094d\u0935\u0940",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},preparse:function(t){return t.replace(/[\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0966]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u092a\u0939\u093e\u091f\u0947|\u0938\u0915\u093e\u0933\u0940|\u0926\u0941\u092a\u093e\u0930\u0940|\u0938\u093e\u092f\u0902\u0915\u093e\u0933\u0940|\u0930\u093e\u0924\u094d\u0930\u0940/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u092a\u0939\u093e\u091f\u0947"===e||"\u0938\u0915\u093e\u0933\u0940"===e?t:"\u0926\u0941\u092a\u093e\u0930\u0940"===e||"\u0938\u093e\u092f\u0902\u0915\u093e\u0933\u0940"===e||"\u0930\u093e\u0924\u094d\u0930\u0940"===e?t>=12?t:t+12:void 0},meridiem:function(t,e,n){return t>=0&&t<6?"\u092a\u0939\u093e\u091f\u0947":t<12?"\u0938\u0915\u093e\u0933\u0940":t<17?"\u0926\u0941\u092a\u093e\u0930\u0940":t<20?"\u0938\u093e\u092f\u0902\u0915\u093e\u0933\u0940":"\u0930\u093e\u0924\u094d\u0930\u0940"},week:{dow:0,doy:6}})}(n(30381))},41237:function(t,e,n){!function(t){"use strict";t.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"tengahari"===e?t>=11?t:t+12:"petang"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"tengahari":t<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n(30381))},9847:function(t,e,n){!function(t){"use strict";t.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(t,e){return 12===t&&(t=0),"pagi"===e?t:"tengahari"===e?t>=11?t:t+12:"petang"===e||"malam"===e?t+12:void 0},meridiem:function(t,e,n){return t<11?"pagi":t<15?"tengahari":t<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n(30381))},72126:function(t,e,n){!function(t){"use strict";t.defineLocale("mt",{months:"Jannar_Frar_Marzu_April_Mejju_\u0120unju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Di\u010bembru".split("_"),monthsShort:"Jan_Fra_Mar_Apr_Mej_\u0120un_Lul_Aww_Set_Ott_Nov_Di\u010b".split("_"),weekdays:"Il-\u0126add_It-Tnejn_It-Tlieta_L-Erbg\u0127a_Il-\u0126amis_Il-\u0120img\u0127a_Is-Sibt".split("_"),weekdaysShort:"\u0126ad_Tne_Tli_Erb_\u0126am_\u0120im_Sib".split("_"),weekdaysMin:"\u0126a_Tn_Tl_Er_\u0126a_\u0120i_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Illum fil-]LT",nextDay:"[G\u0127ada fil-]LT",nextWeek:"dddd [fil-]LT",lastDay:"[Il-biera\u0127 fil-]LT",lastWeek:"dddd [li g\u0127adda] [fil-]LT",sameElse:"L"},relativeTime:{future:"f\u2019 %s",past:"%s ilu",s:"ftit sekondi",ss:"%d sekondi",m:"minuta",mm:"%d minuti",h:"sieg\u0127a",hh:"%d sieg\u0127at",d:"\u0121urnata",dd:"%d \u0121ranet",M:"xahar",MM:"%d xhur",y:"sena",yy:"%d sni"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4}})}(n(30381))},56165:function(t,e,n){!function(t){"use strict";var e={1:"\u1041",2:"\u1042",3:"\u1043",4:"\u1044",5:"\u1045",6:"\u1046",7:"\u1047",8:"\u1048",9:"\u1049",0:"\u1040"},n={"\u1041":"1","\u1042":"2","\u1043":"3","\u1044":"4","\u1045":"5","\u1046":"6","\u1047":"7","\u1048":"8","\u1049":"9","\u1040":"0"};t.defineLocale("my",{months:"\u1007\u1014\u103a\u1014\u101d\u102b\u101b\u102e_\u1016\u1031\u1016\u1031\u102c\u103a\u101d\u102b\u101b\u102e_\u1019\u1010\u103a_\u1027\u1015\u103c\u102e_\u1019\u1031_\u1007\u103d\u1014\u103a_\u1007\u1030\u101c\u102d\u102f\u1004\u103a_\u101e\u103c\u1002\u102f\u1010\u103a_\u1005\u1000\u103a\u1010\u1004\u103a\u1018\u102c_\u1021\u1031\u102c\u1000\u103a\u1010\u102d\u102f\u1018\u102c_\u1014\u102d\u102f\u101d\u1004\u103a\u1018\u102c_\u1012\u102e\u1007\u1004\u103a\u1018\u102c".split("_"),monthsShort:"\u1007\u1014\u103a_\u1016\u1031_\u1019\u1010\u103a_\u1015\u103c\u102e_\u1019\u1031_\u1007\u103d\u1014\u103a_\u101c\u102d\u102f\u1004\u103a_\u101e\u103c_\u1005\u1000\u103a_\u1021\u1031\u102c\u1000\u103a_\u1014\u102d\u102f_\u1012\u102e".split("_"),weekdays:"\u1010\u1014\u1004\u103a\u1039\u1002\u1014\u103d\u1031_\u1010\u1014\u1004\u103a\u1039\u101c\u102c_\u1021\u1004\u103a\u1039\u1002\u102b_\u1017\u102f\u1012\u1039\u1013\u101f\u1030\u1038_\u1000\u103c\u102c\u101e\u1015\u1010\u1031\u1038_\u101e\u1031\u102c\u1000\u103c\u102c_\u1005\u1014\u1031".split("_"),weekdaysShort:"\u1014\u103d\u1031_\u101c\u102c_\u1002\u102b_\u101f\u1030\u1038_\u1000\u103c\u102c_\u101e\u1031\u102c_\u1014\u1031".split("_"),weekdaysMin:"\u1014\u103d\u1031_\u101c\u102c_\u1002\u102b_\u101f\u1030\u1038_\u1000\u103c\u102c_\u101e\u1031\u102c_\u1014\u1031".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u101a\u1014\u1031.] LT [\u1019\u103e\u102c]",nextDay:"[\u1019\u1014\u1000\u103a\u1016\u103c\u1014\u103a] LT [\u1019\u103e\u102c]",nextWeek:"dddd LT [\u1019\u103e\u102c]",lastDay:"[\u1019\u1014\u1031.\u1000] LT [\u1019\u103e\u102c]",lastWeek:"[\u1015\u103c\u102e\u1038\u1001\u1032\u1037\u101e\u1031\u102c] dddd LT [\u1019\u103e\u102c]",sameElse:"L"},relativeTime:{future:"\u101c\u102c\u1019\u100a\u103a\u1037 %s \u1019\u103e\u102c",past:"\u101c\u103d\u1014\u103a\u1001\u1032\u1037\u101e\u1031\u102c %s \u1000",s:"\u1005\u1000\u1039\u1000\u1014\u103a.\u1021\u1014\u100a\u103a\u1038\u1004\u101a\u103a",ss:"%d \u1005\u1000\u1039\u1000\u1014\u1037\u103a",m:"\u1010\u1005\u103a\u1019\u102d\u1014\u1005\u103a",mm:"%d \u1019\u102d\u1014\u1005\u103a",h:"\u1010\u1005\u103a\u1014\u102c\u101b\u102e",hh:"%d \u1014\u102c\u101b\u102e",d:"\u1010\u1005\u103a\u101b\u1000\u103a",dd:"%d \u101b\u1000\u103a",M:"\u1010\u1005\u103a\u101c",MM:"%d \u101c",y:"\u1010\u1005\u103a\u1014\u103e\u1005\u103a",yy:"%d \u1014\u103e\u1005\u103a"},preparse:function(t){return t.replace(/[\u1041\u1042\u1043\u1044\u1045\u1046\u1047\u1048\u1049\u1040]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},week:{dow:1,doy:4}})}(n(30381))},64924:function(t,e,n){!function(t){"use strict";t.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"s\xf8ndag_mandag_tirsdag_onsdag_torsdag_fredag_l\xf8rdag".split("_"),weekdaysShort:"s\xf8._ma._ti._on._to._fr._l\xf8.".split("_"),weekdaysMin:"s\xf8_ma_ti_on_to_fr_l\xf8".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i g\xe5r kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",ss:"%d sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",w:"en uke",ww:"%d uker",M:"en m\xe5ned",MM:"%d m\xe5neder",y:"ett \xe5r",yy:"%d \xe5r"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},16744:function(t,e,n){!function(t){"use strict";var e={1:"\u0967",2:"\u0968",3:"\u0969",4:"\u096a",5:"\u096b",6:"\u096c",7:"\u096d",8:"\u096e",9:"\u096f",0:"\u0966"},n={"\u0967":"1","\u0968":"2","\u0969":"3","\u096a":"4","\u096b":"5","\u096c":"6","\u096d":"7","\u096e":"8","\u096f":"9","\u0966":"0"};t.defineLocale("ne",{months:"\u091c\u0928\u0935\u0930\u0940_\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u0930\u0940_\u092e\u093e\u0930\u094d\u091a_\u0905\u092a\u094d\u0930\u093f\u0932_\u092e\u0908_\u091c\u0941\u0928_\u091c\u0941\u0932\u093e\u0908_\u0905\u0917\u0937\u094d\u091f_\u0938\u0947\u092a\u094d\u091f\u0947\u092e\u094d\u092c\u0930_\u0905\u0915\u094d\u091f\u094b\u092c\u0930_\u0928\u094b\u092d\u0947\u092e\u094d\u092c\u0930_\u0921\u093f\u0938\u0947\u092e\u094d\u092c\u0930".split("_"),monthsShort:"\u091c\u0928._\u092b\u0947\u092c\u094d\u0930\u0941._\u092e\u093e\u0930\u094d\u091a_\u0905\u092a\u094d\u0930\u093f._\u092e\u0908_\u091c\u0941\u0928_\u091c\u0941\u0932\u093e\u0908._\u0905\u0917._\u0938\u0947\u092a\u094d\u091f._\u0905\u0915\u094d\u091f\u094b._\u0928\u094b\u092d\u0947._\u0921\u093f\u0938\u0947.".split("_"),monthsParseExact:!0,weekdays:"\u0906\u0907\u0924\u092c\u093e\u0930_\u0938\u094b\u092e\u092c\u093e\u0930_\u092e\u0919\u094d\u0917\u0932\u092c\u093e\u0930_\u092c\u0941\u0927\u092c\u093e\u0930_\u092c\u093f\u0939\u093f\u092c\u093e\u0930_\u0936\u0941\u0915\u094d\u0930\u092c\u093e\u0930_\u0936\u0928\u093f\u092c\u093e\u0930".split("_"),weekdaysShort:"\u0906\u0907\u0924._\u0938\u094b\u092e._\u092e\u0919\u094d\u0917\u0932._\u092c\u0941\u0927._\u092c\u093f\u0939\u093f._\u0936\u0941\u0915\u094d\u0930._\u0936\u0928\u093f.".split("_"),weekdaysMin:"\u0906._\u0938\u094b._\u092e\u0902._\u092c\u0941._\u092c\u093f._\u0936\u0941._\u0936.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A\u0915\u094b h:mm \u092c\u091c\u0947",LTS:"A\u0915\u094b h:mm:ss \u092c\u091c\u0947",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A\u0915\u094b h:mm \u092c\u091c\u0947",LLLL:"dddd, D MMMM YYYY, A\u0915\u094b h:mm \u092c\u091c\u0947"},preparse:function(t){return t.replace(/[\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0966]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u0930\u093e\u0924\u093f|\u092c\u093f\u0939\u093e\u0928|\u0926\u093f\u0909\u0901\u0938\u094b|\u0938\u093e\u0901\u091d/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0930\u093e\u0924\u093f"===e?t<4?t:t+12:"\u092c\u093f\u0939\u093e\u0928"===e?t:"\u0926\u093f\u0909\u0901\u0938\u094b"===e?t>=10?t:t+12:"\u0938\u093e\u0901\u091d"===e?t+12:void 0},meridiem:function(t,e,n){return t<3?"\u0930\u093e\u0924\u093f":t<12?"\u092c\u093f\u0939\u093e\u0928":t<16?"\u0926\u093f\u0909\u0901\u0938\u094b":t<20?"\u0938\u093e\u0901\u091d":"\u0930\u093e\u0924\u093f"},calendar:{sameDay:"[\u0906\u091c] LT",nextDay:"[\u092d\u094b\u0932\u093f] LT",nextWeek:"[\u0906\u0909\u0901\u0926\u094b] dddd[,] LT",lastDay:"[\u0939\u093f\u091c\u094b] LT",lastWeek:"[\u0917\u090f\u0915\u094b] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s\u092e\u093e",past:"%s \u0905\u0917\u093e\u0921\u093f",s:"\u0915\u0947\u0939\u0940 \u0915\u094d\u0937\u0923",ss:"%d \u0938\u0947\u0915\u0947\u0923\u094d\u0921",m:"\u090f\u0915 \u092e\u093f\u0928\u0947\u091f",mm:"%d \u092e\u093f\u0928\u0947\u091f",h:"\u090f\u0915 \u0918\u0923\u094d\u091f\u093e",hh:"%d \u0918\u0923\u094d\u091f\u093e",d:"\u090f\u0915 \u0926\u093f\u0928",dd:"%d \u0926\u093f\u0928",M:"\u090f\u0915 \u092e\u0939\u093f\u0928\u093e",MM:"%d \u092e\u0939\u093f\u0928\u093e",y:"\u090f\u0915 \u092c\u0930\u094d\u0937",yy:"%d \u092c\u0930\u094d\u0937"},week:{dow:0,doy:6}})}(n(30381))},59814:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),r=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],i=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;t.defineLocale("nl-be",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"\xe9\xe9n minuut",mm:"%d minuten",h:"\xe9\xe9n uur",hh:"%d uur",d:"\xe9\xe9n dag",dd:"%d dagen",M:"\xe9\xe9n maand",MM:"%d maanden",y:"\xe9\xe9n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},93901:function(t,e,n){!function(t){"use strict";var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),r=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],i=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;t.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,r){return t?/-MMM-/.test(r)?n[t.month()]:e[t.month()]:e},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"\xe9\xe9n minuut",mm:"%d minuten",h:"\xe9\xe9n uur",hh:"%d uur",d:"\xe9\xe9n dag",dd:"%d dagen",w:"\xe9\xe9n week",ww:"%d weken",M:"\xe9\xe9n maand",MM:"%d maanden",y:"\xe9\xe9n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}})}(n(30381))},83877:function(t,e,n){!function(t){"use strict";t.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"sundag_m\xe5ndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"su._m\xe5._ty._on._to._fr._lau.".split("_"),weekdaysMin:"su_m\xe5_ty_on_to_fr_la".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I g\xe5r klokka] LT",lastWeek:"[F\xf8reg\xe5ande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",ss:"%d sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",w:"ei veke",ww:"%d veker",M:"ein m\xe5nad",MM:"%d m\xe5nader",y:"eit \xe5r",yy:"%d \xe5r"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},92135:function(t,e,n){!function(t){"use strict";t.defineLocale("oc-lnc",{months:{standalone:"geni\xe8r_febri\xe8r_mar\xe7_abril_mai_junh_julhet_agost_setembre_oct\xf2bre_novembre_decembre".split("_"),format:"de geni\xe8r_de febri\xe8r_de mar\xe7_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'oct\xf2bre_de novembre_de decembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._mar\xe7_abr._mai_junh_julh._ago._set._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"dimenge_diluns_dimars_dim\xe8cres_dij\xf2us_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dm._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dm_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:"[u\xe8i a] LT",nextDay:"[deman a] LT",nextWeek:"dddd [a] LT",lastDay:"[i\xe8r a] LT",lastWeek:"dddd [passat a] LT",sameElse:"L"},relativeTime:{future:"d'aqu\xed %s",past:"fa %s",s:"unas segondas",ss:"%d segondas",m:"una minuta",mm:"%d minutas",h:"una ora",hh:"%d oras",d:"un jorn",dd:"%d jorns",M:"un mes",MM:"%d meses",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|\xe8|a)/,ordinal:function(t,e){var n=1===t?"r":2===t?"n":3===t?"r":4===t?"t":"\xe8";return"w"!==e&&"W"!==e||(n="a"),t+n},week:{dow:1,doy:4}})}(n(30381))},15858:function(t,e,n){!function(t){"use strict";var e={1:"\u0a67",2:"\u0a68",3:"\u0a69",4:"\u0a6a",5:"\u0a6b",6:"\u0a6c",7:"\u0a6d",8:"\u0a6e",9:"\u0a6f",0:"\u0a66"},n={"\u0a67":"1","\u0a68":"2","\u0a69":"3","\u0a6a":"4","\u0a6b":"5","\u0a6c":"6","\u0a6d":"7","\u0a6e":"8","\u0a6f":"9","\u0a66":"0"};t.defineLocale("pa-in",{months:"\u0a1c\u0a28\u0a35\u0a30\u0a40_\u0a2b\u0a3c\u0a30\u0a35\u0a30\u0a40_\u0a2e\u0a3e\u0a30\u0a1a_\u0a05\u0a2a\u0a4d\u0a30\u0a48\u0a32_\u0a2e\u0a08_\u0a1c\u0a42\u0a28_\u0a1c\u0a41\u0a32\u0a3e\u0a08_\u0a05\u0a17\u0a38\u0a24_\u0a38\u0a24\u0a70\u0a2c\u0a30_\u0a05\u0a15\u0a24\u0a42\u0a2c\u0a30_\u0a28\u0a35\u0a70\u0a2c\u0a30_\u0a26\u0a38\u0a70\u0a2c\u0a30".split("_"),monthsShort:"\u0a1c\u0a28\u0a35\u0a30\u0a40_\u0a2b\u0a3c\u0a30\u0a35\u0a30\u0a40_\u0a2e\u0a3e\u0a30\u0a1a_\u0a05\u0a2a\u0a4d\u0a30\u0a48\u0a32_\u0a2e\u0a08_\u0a1c\u0a42\u0a28_\u0a1c\u0a41\u0a32\u0a3e\u0a08_\u0a05\u0a17\u0a38\u0a24_\u0a38\u0a24\u0a70\u0a2c\u0a30_\u0a05\u0a15\u0a24\u0a42\u0a2c\u0a30_\u0a28\u0a35\u0a70\u0a2c\u0a30_\u0a26\u0a38\u0a70\u0a2c\u0a30".split("_"),weekdays:"\u0a10\u0a24\u0a35\u0a3e\u0a30_\u0a38\u0a4b\u0a2e\u0a35\u0a3e\u0a30_\u0a2e\u0a70\u0a17\u0a32\u0a35\u0a3e\u0a30_\u0a2c\u0a41\u0a27\u0a35\u0a3e\u0a30_\u0a35\u0a40\u0a30\u0a35\u0a3e\u0a30_\u0a38\u0a3c\u0a41\u0a71\u0a15\u0a30\u0a35\u0a3e\u0a30_\u0a38\u0a3c\u0a28\u0a40\u0a1a\u0a30\u0a35\u0a3e\u0a30".split("_"),weekdaysShort:"\u0a10\u0a24_\u0a38\u0a4b\u0a2e_\u0a2e\u0a70\u0a17\u0a32_\u0a2c\u0a41\u0a27_\u0a35\u0a40\u0a30_\u0a38\u0a3c\u0a41\u0a15\u0a30_\u0a38\u0a3c\u0a28\u0a40".split("_"),weekdaysMin:"\u0a10\u0a24_\u0a38\u0a4b\u0a2e_\u0a2e\u0a70\u0a17\u0a32_\u0a2c\u0a41\u0a27_\u0a35\u0a40\u0a30_\u0a38\u0a3c\u0a41\u0a15\u0a30_\u0a38\u0a3c\u0a28\u0a40".split("_"),longDateFormat:{LT:"A h:mm \u0a35\u0a1c\u0a47",LTS:"A h:mm:ss \u0a35\u0a1c\u0a47",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u0a35\u0a1c\u0a47",LLLL:"dddd, D MMMM YYYY, A h:mm \u0a35\u0a1c\u0a47"},calendar:{sameDay:"[\u0a05\u0a1c] LT",nextDay:"[\u0a15\u0a32] LT",nextWeek:"[\u0a05\u0a17\u0a32\u0a3e] dddd, LT",lastDay:"[\u0a15\u0a32] LT",lastWeek:"[\u0a2a\u0a3f\u0a1b\u0a32\u0a47] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0a35\u0a3f\u0a71\u0a1a",past:"%s \u0a2a\u0a3f\u0a1b\u0a32\u0a47",s:"\u0a15\u0a41\u0a1d \u0a38\u0a15\u0a3f\u0a70\u0a1f",ss:"%d \u0a38\u0a15\u0a3f\u0a70\u0a1f",m:"\u0a07\u0a15 \u0a2e\u0a3f\u0a70\u0a1f",mm:"%d \u0a2e\u0a3f\u0a70\u0a1f",h:"\u0a07\u0a71\u0a15 \u0a18\u0a70\u0a1f\u0a3e",hh:"%d \u0a18\u0a70\u0a1f\u0a47",d:"\u0a07\u0a71\u0a15 \u0a26\u0a3f\u0a28",dd:"%d \u0a26\u0a3f\u0a28",M:"\u0a07\u0a71\u0a15 \u0a2e\u0a39\u0a40\u0a28\u0a3e",MM:"%d \u0a2e\u0a39\u0a40\u0a28\u0a47",y:"\u0a07\u0a71\u0a15 \u0a38\u0a3e\u0a32",yy:"%d \u0a38\u0a3e\u0a32"},preparse:function(t){return t.replace(/[\u0a67\u0a68\u0a69\u0a6a\u0a6b\u0a6c\u0a6d\u0a6e\u0a6f\u0a66]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u0a30\u0a3e\u0a24|\u0a38\u0a35\u0a47\u0a30|\u0a26\u0a41\u0a2a\u0a39\u0a3f\u0a30|\u0a38\u0a3c\u0a3e\u0a2e/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0a30\u0a3e\u0a24"===e?t<4?t:t+12:"\u0a38\u0a35\u0a47\u0a30"===e?t:"\u0a26\u0a41\u0a2a\u0a39\u0a3f\u0a30"===e?t>=10?t:t+12:"\u0a38\u0a3c\u0a3e\u0a2e"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u0a30\u0a3e\u0a24":t<10?"\u0a38\u0a35\u0a47\u0a30":t<17?"\u0a26\u0a41\u0a2a\u0a39\u0a3f\u0a30":t<20?"\u0a38\u0a3c\u0a3e\u0a2e":"\u0a30\u0a3e\u0a24"},week:{dow:0,doy:6}})}(n(30381))},64495:function(t,e,n){!function(t){"use strict";var e="stycze\u0144_luty_marzec_kwiecie\u0144_maj_czerwiec_lipiec_sierpie\u0144_wrzesie\u0144_pa\u017adziernik_listopad_grudzie\u0144".split("_"),n="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_wrze\u015bnia_pa\u017adziernika_listopada_grudnia".split("_"),r=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^pa\u017a/i,/^lis/i,/^gru/i];function i(t){return t%10<5&&t%10>1&&~~(t/10)%10!=1}function a(t,e,n){var r=t+" ";switch(n){case"ss":return r+(i(t)?"sekundy":"sekund");case"m":return e?"minuta":"minut\u0119";case"mm":return r+(i(t)?"minuty":"minut");case"h":return e?"godzina":"godzin\u0119";case"hh":return r+(i(t)?"godziny":"godzin");case"ww":return r+(i(t)?"tygodnie":"tygodni");case"MM":return r+(i(t)?"miesi\u0105ce":"miesi\u0119cy");case"yy":return r+(i(t)?"lata":"lat")}}t.defineLocale("pl",{months:function(t,r){return t?/D MMMM/.test(r)?n[t.month()]:e[t.month()]:e},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_pa\u017a_lis_gru".split("_"),monthsParse:r,longMonthsParse:r,shortMonthsParse:r,weekdays:"niedziela_poniedzia\u0142ek_wtorek_\u015broda_czwartek_pi\u0105tek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_\u015br_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_\u015ar_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dzi\u015b o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedziel\u0119 o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W \u015brod\u0119 o] LT";case 6:return"[W sobot\u0119 o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zesz\u0142\u0105 niedziel\u0119 o] LT";case 3:return"[W zesz\u0142\u0105 \u015brod\u0119 o] LT";case 6:return"[W zesz\u0142\u0105 sobot\u0119 o] LT";default:return"[W zesz\u0142y] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:a,m:a,mm:a,h:a,hh:a,d:"1 dzie\u0144",dd:"%d dni",w:"tydzie\u0144",ww:a,M:"miesi\u0105c",MM:a,y:"rok",yy:a},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},57971:function(t,e,n){!function(t){"use strict";t.defineLocale("pt-br",{months:"janeiro_fevereiro_mar\xe7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_ter\xe7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xe1bado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_s\xe1b".split("_"),weekdaysMin:"do_2\xaa_3\xaa_4\xaa_5\xaa_6\xaa_s\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [\xe0s] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [\xe0s] HH:mm"},calendar:{sameDay:"[Hoje \xe0s] LT",nextDay:"[Amanh\xe3 \xe0s] LT",nextWeek:"dddd [\xe0s] LT",lastDay:"[Ontem \xe0s] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[\xdaltimo] dddd [\xe0s] LT":"[\xdaltima] dddd [\xe0s] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"h\xe1 %s",s:"poucos segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um m\xeas",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",invalidDate:"Data inv\xe1lida"})}(n(30381))},89520:function(t,e,n){!function(t){"use strict";t.defineLocale("pt",{months:"janeiro_fevereiro_mar\xe7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"Domingo_Segunda-feira_Ter\xe7a-feira_Quarta-feira_Quinta-feira_Sexta-feira_S\xe1bado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_S\xe1b".split("_"),weekdaysMin:"Do_2\xaa_3\xaa_4\xaa_5\xaa_6\xaa_S\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje \xe0s] LT",nextDay:"[Amanh\xe3 \xe0s] LT",nextWeek:"dddd [\xe0s] LT",lastDay:"[Ontem \xe0s] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[\xdaltimo] dddd [\xe0s] LT":"[\xdaltima] dddd [\xe0s] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"h\xe1 %s",s:"segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",w:"uma semana",ww:"%d semanas",M:"um m\xeas",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}\xba/,ordinal:"%d\xba",week:{dow:1,doy:4}})}(n(30381))},96459:function(t,e,n){!function(t){"use strict";function e(t,e,n){var r=" ";return(t%100>=20||t>=100&&t%100==0)&&(r=" de "),t+r+{ss:"secunde",mm:"minute",hh:"ore",dd:"zile",ww:"s\u0103pt\u0103m\xe2ni",MM:"luni",yy:"ani"}[n]}t.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminic\u0103_luni_mar\u021bi_miercuri_joi_vineri_s\xe2mb\u0103t\u0103".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_S\xe2m".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_S\xe2".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[m\xe2ine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s \xeen urm\u0103",s:"c\xe2teva secunde",ss:e,m:"un minut",mm:e,h:"o or\u0103",hh:e,d:"o zi",dd:e,w:"o s\u0103pt\u0103m\xe2n\u0103",ww:e,M:"o lun\u0103",MM:e,y:"un an",yy:e},week:{dow:1,doy:7}})}(n(30381))},21793:function(t,e,n){!function(t){"use strict";function e(t,e){var n=t.split("_");return e%10==1&&e%100!=11?n[0]:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?n[1]:n[2]}function n(t,n,r){return"m"===r?n?"\u043c\u0438\u043d\u0443\u0442\u0430":"\u043c\u0438\u043d\u0443\u0442\u0443":t+" "+e({ss:n?"\u0441\u0435\u043a\u0443\u043d\u0434\u0430_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434":"\u0441\u0435\u043a\u0443\u043d\u0434\u0443_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434",mm:n?"\u043c\u0438\u043d\u0443\u0442\u0430_\u043c\u0438\u043d\u0443\u0442\u044b_\u043c\u0438\u043d\u0443\u0442":"\u043c\u0438\u043d\u0443\u0442\u0443_\u043c\u0438\u043d\u0443\u0442\u044b_\u043c\u0438\u043d\u0443\u0442",hh:"\u0447\u0430\u0441_\u0447\u0430\u0441\u0430_\u0447\u0430\u0441\u043e\u0432",dd:"\u0434\u0435\u043d\u044c_\u0434\u043d\u044f_\u0434\u043d\u0435\u0439",ww:"\u043d\u0435\u0434\u0435\u043b\u044f_\u043d\u0435\u0434\u0435\u043b\u0438_\u043d\u0435\u0434\u0435\u043b\u044c",MM:"\u043c\u0435\u0441\u044f\u0446_\u043c\u0435\u0441\u044f\u0446\u0430_\u043c\u0435\u0441\u044f\u0446\u0435\u0432",yy:"\u0433\u043e\u0434_\u0433\u043e\u0434\u0430_\u043b\u0435\u0442"}[r],+t)}var r=[/^\u044f\u043d\u0432/i,/^\u0444\u0435\u0432/i,/^\u043c\u0430\u0440/i,/^\u0430\u043f\u0440/i,/^\u043c\u0430[\u0439\u044f]/i,/^\u0438\u044e\u043d/i,/^\u0438\u044e\u043b/i,/^\u0430\u0432\u0433/i,/^\u0441\u0435\u043d/i,/^\u043e\u043a\u0442/i,/^\u043d\u043e\u044f/i,/^\u0434\u0435\u043a/i];t.defineLocale("ru",{months:{format:"\u044f\u043d\u0432\u0430\u0440\u044f_\u0444\u0435\u0432\u0440\u0430\u043b\u044f_\u043c\u0430\u0440\u0442\u0430_\u0430\u043f\u0440\u0435\u043b\u044f_\u043c\u0430\u044f_\u0438\u044e\u043d\u044f_\u0438\u044e\u043b\u044f_\u0430\u0432\u0433\u0443\u0441\u0442\u0430_\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f_\u043e\u043a\u0442\u044f\u0431\u0440\u044f_\u043d\u043e\u044f\u0431\u0440\u044f_\u0434\u0435\u043a\u0430\u0431\u0440\u044f".split("_"),standalone:"\u044f\u043d\u0432\u0430\u0440\u044c_\u0444\u0435\u0432\u0440\u0430\u043b\u044c_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0435\u043b\u044c_\u043c\u0430\u0439_\u0438\u044e\u043d\u044c_\u0438\u044e\u043b\u044c_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c_\u043e\u043a\u0442\u044f\u0431\u0440\u044c_\u043d\u043e\u044f\u0431\u0440\u044c_\u0434\u0435\u043a\u0430\u0431\u0440\u044c".split("_")},monthsShort:{format:"\u044f\u043d\u0432._\u0444\u0435\u0432\u0440._\u043c\u0430\u0440._\u0430\u043f\u0440._\u043c\u0430\u044f_\u0438\u044e\u043d\u044f_\u0438\u044e\u043b\u044f_\u0430\u0432\u0433._\u0441\u0435\u043d\u0442._\u043e\u043a\u0442._\u043d\u043e\u044f\u0431._\u0434\u0435\u043a.".split("_"),standalone:"\u044f\u043d\u0432._\u0444\u0435\u0432\u0440._\u043c\u0430\u0440\u0442_\u0430\u043f\u0440._\u043c\u0430\u0439_\u0438\u044e\u043d\u044c_\u0438\u044e\u043b\u044c_\u0430\u0432\u0433._\u0441\u0435\u043d\u0442._\u043e\u043a\u0442._\u043d\u043e\u044f\u0431._\u0434\u0435\u043a.".split("_")},weekdays:{standalone:"\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435_\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a_\u0432\u0442\u043e\u0440\u043d\u0438\u043a_\u0441\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0435\u0440\u0433_\u043f\u044f\u0442\u043d\u0438\u0446\u0430_\u0441\u0443\u0431\u0431\u043e\u0442\u0430".split("_"),format:"\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435_\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a_\u0432\u0442\u043e\u0440\u043d\u0438\u043a_\u0441\u0440\u0435\u0434\u0443_\u0447\u0435\u0442\u0432\u0435\u0440\u0433_\u043f\u044f\u0442\u043d\u0438\u0446\u0443_\u0441\u0443\u0431\u0431\u043e\u0442\u0443".split("_"),isFormat:/\[ ?[\u0412\u0432] ?(?:\u043f\u0440\u043e\u0448\u043b\u0443\u044e|\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e|\u044d\u0442\u0443)? ?] ?dddd/},weekdaysShort:"\u0432\u0441_\u043f\u043d_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043f\u0442_\u0441\u0431".split("_"),weekdaysMin:"\u0432\u0441_\u043f\u043d_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043f\u0442_\u0441\u0431".split("_"),monthsParse:r,longMonthsParse:r,shortMonthsParse:r,monthsRegex:/^(\u044f\u043d\u0432\u0430\u0440[\u044c\u044f]|\u044f\u043d\u0432\.?|\u0444\u0435\u0432\u0440\u0430\u043b[\u044c\u044f]|\u0444\u0435\u0432\u0440?\.?|\u043c\u0430\u0440\u0442\u0430?|\u043c\u0430\u0440\.?|\u0430\u043f\u0440\u0435\u043b[\u044c\u044f]|\u0430\u043f\u0440\.?|\u043c\u0430[\u0439\u044f]|\u0438\u044e\u043d[\u044c\u044f]|\u0438\u044e\u043d\.?|\u0438\u044e\u043b[\u044c\u044f]|\u0438\u044e\u043b\.?|\u0430\u0432\u0433\u0443\u0441\u0442\u0430?|\u0430\u0432\u0433\.?|\u0441\u0435\u043d\u0442\u044f\u0431\u0440[\u044c\u044f]|\u0441\u0435\u043d\u0442?\.?|\u043e\u043a\u0442\u044f\u0431\u0440[\u044c\u044f]|\u043e\u043a\u0442\.?|\u043d\u043e\u044f\u0431\u0440[\u044c\u044f]|\u043d\u043e\u044f\u0431?\.?|\u0434\u0435\u043a\u0430\u0431\u0440[\u044c\u044f]|\u0434\u0435\u043a\.?)/i,monthsShortRegex:/^(\u044f\u043d\u0432\u0430\u0440[\u044c\u044f]|\u044f\u043d\u0432\.?|\u0444\u0435\u0432\u0440\u0430\u043b[\u044c\u044f]|\u0444\u0435\u0432\u0440?\.?|\u043c\u0430\u0440\u0442\u0430?|\u043c\u0430\u0440\.?|\u0430\u043f\u0440\u0435\u043b[\u044c\u044f]|\u0430\u043f\u0440\.?|\u043c\u0430[\u0439\u044f]|\u0438\u044e\u043d[\u044c\u044f]|\u0438\u044e\u043d\.?|\u0438\u044e\u043b[\u044c\u044f]|\u0438\u044e\u043b\.?|\u0430\u0432\u0433\u0443\u0441\u0442\u0430?|\u0430\u0432\u0433\.?|\u0441\u0435\u043d\u0442\u044f\u0431\u0440[\u044c\u044f]|\u0441\u0435\u043d\u0442?\.?|\u043e\u043a\u0442\u044f\u0431\u0440[\u044c\u044f]|\u043e\u043a\u0442\.?|\u043d\u043e\u044f\u0431\u0440[\u044c\u044f]|\u043d\u043e\u044f\u0431?\.?|\u0434\u0435\u043a\u0430\u0431\u0440[\u044c\u044f]|\u0434\u0435\u043a\.?)/i,monthsStrictRegex:/^(\u044f\u043d\u0432\u0430\u0440[\u044f\u044c]|\u0444\u0435\u0432\u0440\u0430\u043b[\u044f\u044c]|\u043c\u0430\u0440\u0442\u0430?|\u0430\u043f\u0440\u0435\u043b[\u044f\u044c]|\u043c\u0430[\u044f\u0439]|\u0438\u044e\u043d[\u044f\u044c]|\u0438\u044e\u043b[\u044f\u044c]|\u0430\u0432\u0433\u0443\u0441\u0442\u0430?|\u0441\u0435\u043d\u0442\u044f\u0431\u0440[\u044f\u044c]|\u043e\u043a\u0442\u044f\u0431\u0440[\u044f\u044c]|\u043d\u043e\u044f\u0431\u0440[\u044f\u044c]|\u0434\u0435\u043a\u0430\u0431\u0440[\u044f\u044c])/i,monthsShortStrictRegex:/^(\u044f\u043d\u0432\.|\u0444\u0435\u0432\u0440?\.|\u043c\u0430\u0440[\u0442.]|\u0430\u043f\u0440\.|\u043c\u0430[\u044f\u0439]|\u0438\u044e\u043d[\u044c\u044f.]|\u0438\u044e\u043b[\u044c\u044f.]|\u0430\u0432\u0433\.|\u0441\u0435\u043d\u0442?\.|\u043e\u043a\u0442\.|\u043d\u043e\u044f\u0431?\.|\u0434\u0435\u043a\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY \u0433.",LLL:"D MMMM YYYY \u0433., H:mm",LLLL:"dddd, D MMMM YYYY \u0433., H:mm"},calendar:{sameDay:"[\u0421\u0435\u0433\u043e\u0434\u043d\u044f, \u0432] LT",nextDay:"[\u0417\u0430\u0432\u0442\u0440\u0430, \u0432] LT",lastDay:"[\u0412\u0447\u0435\u0440\u0430, \u0432] LT",nextWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[\u0412\u043e] dddd, [\u0432] LT":"[\u0412] dddd, [\u0432] LT";switch(this.day()){case 0:return"[\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435] dddd, [\u0432] LT";case 1:case 2:case 4:return"[\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439] dddd, [\u0432] LT";case 3:case 5:case 6:return"[\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e] dddd, [\u0432] LT"}},lastWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[\u0412\u043e] dddd, [\u0432] LT":"[\u0412] dddd, [\u0432] LT";switch(this.day()){case 0:return"[\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0435] dddd, [\u0432] LT";case 1:case 2:case 4:return"[\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439] dddd, [\u0432] LT";case 3:case 5:case 6:return"[\u0412 \u043f\u0440\u043e\u0448\u043b\u0443\u044e] dddd, [\u0432] LT"}},sameElse:"L"},relativeTime:{future:"\u0447\u0435\u0440\u0435\u0437 %s",past:"%s \u043d\u0430\u0437\u0430\u0434",s:"\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434",ss:n,m:n,mm:n,h:"\u0447\u0430\u0441",hh:n,d:"\u0434\u0435\u043d\u044c",dd:n,w:"\u043d\u0435\u0434\u0435\u043b\u044f",ww:n,M:"\u043c\u0435\u0441\u044f\u0446",MM:n,y:"\u0433\u043e\u0434",yy:n},meridiemParse:/\u043d\u043e\u0447\u0438|\u0443\u0442\u0440\u0430|\u0434\u043d\u044f|\u0432\u0435\u0447\u0435\u0440\u0430/i,isPM:function(t){return/^(\u0434\u043d\u044f|\u0432\u0435\u0447\u0435\u0440\u0430)$/.test(t)},meridiem:function(t,e,n){return t<4?"\u043d\u043e\u0447\u0438":t<12?"\u0443\u0442\u0440\u0430":t<17?"\u0434\u043d\u044f":"\u0432\u0435\u0447\u0435\u0440\u0430"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0439|\u0433\u043e|\u044f)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":return t+"-\u0439";case"D":return t+"-\u0433\u043e";case"w":case"W":return t+"-\u044f";default:return t}},week:{dow:1,doy:4}})}(n(30381))},40950:function(t,e,n){!function(t){"use strict";var e=["\u062c\u0646\u0648\u0631\u064a","\u0641\u064a\u0628\u0631\u0648\u0631\u064a","\u0645\u0627\u0631\u0686","\u0627\u067e\u0631\u064a\u0644","\u0645\u0626\u064a","\u062c\u0648\u0646","\u062c\u0648\u0644\u0627\u0621\u0650","\u0622\u06af\u0633\u067d","\u0633\u064a\u067e\u067d\u0645\u0628\u0631","\u0622\u06aa\u067d\u0648\u0628\u0631","\u0646\u0648\u0645\u0628\u0631","\u068a\u0633\u0645\u0628\u0631"],n=["\u0622\u0686\u0631","\u0633\u0648\u0645\u0631","\u0627\u06b1\u0627\u0631\u0648","\u0627\u0631\u0628\u0639","\u062e\u0645\u064a\u0633","\u062c\u0645\u0639","\u0687\u0646\u0687\u0631"];t.defineLocale("sd",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd\u060c D MMMM YYYY HH:mm"},meridiemParse:/\u0635\u0628\u062d|\u0634\u0627\u0645/,isPM:function(t){return"\u0634\u0627\u0645"===t},meridiem:function(t,e,n){return t<12?"\u0635\u0628\u062d":"\u0634\u0627\u0645"},calendar:{sameDay:"[\u0627\u0684] LT",nextDay:"[\u0633\u0680\u0627\u06bb\u064a] LT",nextWeek:"dddd [\u0627\u06b3\u064a\u0646 \u0647\u0641\u062a\u064a \u062a\u064a] LT",lastDay:"[\u06aa\u0627\u0644\u0647\u0647] LT",lastWeek:"[\u06af\u0632\u0631\u064a\u0644 \u0647\u0641\u062a\u064a] dddd [\u062a\u064a] LT",sameElse:"L"},relativeTime:{future:"%s \u067e\u0648\u0621",past:"%s \u0627\u06b3",s:"\u0686\u0646\u062f \u0633\u064a\u06aa\u0646\u068a",ss:"%d \u0633\u064a\u06aa\u0646\u068a",m:"\u0647\u06aa \u0645\u0646\u067d",mm:"%d \u0645\u0646\u067d",h:"\u0647\u06aa \u06aa\u0644\u0627\u06aa",hh:"%d \u06aa\u0644\u0627\u06aa",d:"\u0647\u06aa \u068f\u064a\u0646\u0647\u0646",dd:"%d \u068f\u064a\u0646\u0647\u0646",M:"\u0647\u06aa \u0645\u0647\u064a\u0646\u0648",MM:"%d \u0645\u0647\u064a\u0646\u0627",y:"\u0647\u06aa \u0633\u0627\u0644",yy:"%d \u0633\u0627\u0644"},preparse:function(t){return t.replace(/\u060c/g,",")},postformat:function(t){return t.replace(/,/g,"\u060c")},week:{dow:1,doy:4}})}(n(30381))},10490:function(t,e,n){!function(t){"use strict";t.defineLocale("se",{months:"o\u0111\u0111ajagem\xe1nnu_guovvam\xe1nnu_njuk\u010dam\xe1nnu_cuo\u014bom\xe1nnu_miessem\xe1nnu_geassem\xe1nnu_suoidnem\xe1nnu_borgem\xe1nnu_\u010dak\u010dam\xe1nnu_golggotm\xe1nnu_sk\xe1bmam\xe1nnu_juovlam\xe1nnu".split("_"),monthsShort:"o\u0111\u0111j_guov_njuk_cuo_mies_geas_suoi_borg_\u010dak\u010d_golg_sk\xe1b_juov".split("_"),weekdays:"sotnabeaivi_vuoss\xe1rga_ma\u014b\u014beb\xe1rga_gaskavahkku_duorastat_bearjadat_l\xe1vvardat".split("_"),weekdaysShort:"sotn_vuos_ma\u014b_gask_duor_bear_l\xe1v".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s gea\u017ees",past:"ma\u014bit %s",s:"moadde sekunddat",ss:"%d sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta m\xe1nnu",MM:"%d m\xe1nut",y:"okta jahki",yy:"%d jagit"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},90124:function(t,e,n){!function(t){"use strict";t.defineLocale("si",{months:"\u0da2\u0db1\u0dc0\u0dcf\u0dbb\u0dd2_\u0db4\u0dd9\u0db6\u0dbb\u0dc0\u0dcf\u0dbb\u0dd2_\u0db8\u0dcf\u0dbb\u0dca\u0dad\u0dd4_\u0d85\u0db4\u0dca\u200d\u0dbb\u0dda\u0dbd\u0dca_\u0db8\u0dd0\u0dba\u0dd2_\u0da2\u0dd6\u0db1\u0dd2_\u0da2\u0dd6\u0dbd\u0dd2_\u0d85\u0d9c\u0ddd\u0dc3\u0dca\u0dad\u0dd4_\u0dc3\u0dd0\u0db4\u0dca\u0dad\u0dd0\u0db8\u0dca\u0db6\u0dbb\u0dca_\u0d94\u0d9a\u0dca\u0dad\u0ddd\u0db6\u0dbb\u0dca_\u0db1\u0ddc\u0dc0\u0dd0\u0db8\u0dca\u0db6\u0dbb\u0dca_\u0daf\u0dd9\u0dc3\u0dd0\u0db8\u0dca\u0db6\u0dbb\u0dca".split("_"),monthsShort:"\u0da2\u0db1_\u0db4\u0dd9\u0db6_\u0db8\u0dcf\u0dbb\u0dca_\u0d85\u0db4\u0dca_\u0db8\u0dd0\u0dba\u0dd2_\u0da2\u0dd6\u0db1\u0dd2_\u0da2\u0dd6\u0dbd\u0dd2_\u0d85\u0d9c\u0ddd_\u0dc3\u0dd0\u0db4\u0dca_\u0d94\u0d9a\u0dca_\u0db1\u0ddc\u0dc0\u0dd0_\u0daf\u0dd9\u0dc3\u0dd0".split("_"),weekdays:"\u0d89\u0dbb\u0dd2\u0daf\u0dcf_\u0dc3\u0db3\u0dd4\u0daf\u0dcf_\u0d85\u0d9f\u0dc4\u0dbb\u0dd4\u0dc0\u0dcf\u0daf\u0dcf_\u0db6\u0daf\u0dcf\u0daf\u0dcf_\u0db6\u0dca\u200d\u0dbb\u0dc4\u0dc3\u0dca\u0db4\u0dad\u0dd2\u0db1\u0dca\u0daf\u0dcf_\u0dc3\u0dd2\u0d9a\u0dd4\u0dbb\u0dcf\u0daf\u0dcf_\u0dc3\u0dd9\u0db1\u0dc3\u0dd4\u0dbb\u0dcf\u0daf\u0dcf".split("_"),weekdaysShort:"\u0d89\u0dbb\u0dd2_\u0dc3\u0db3\u0dd4_\u0d85\u0d9f_\u0db6\u0daf\u0dcf_\u0db6\u0dca\u200d\u0dbb\u0dc4_\u0dc3\u0dd2\u0d9a\u0dd4_\u0dc3\u0dd9\u0db1".split("_"),weekdaysMin:"\u0d89_\u0dc3_\u0d85_\u0db6_\u0db6\u0dca\u200d\u0dbb_\u0dc3\u0dd2_\u0dc3\u0dd9".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [\u0dc0\u0dd0\u0db1\u0dd2] dddd, a h:mm:ss"},calendar:{sameDay:"[\u0d85\u0daf] LT[\u0da7]",nextDay:"[\u0dc4\u0dd9\u0da7] LT[\u0da7]",nextWeek:"dddd LT[\u0da7]",lastDay:"[\u0d8a\u0dba\u0dda] LT[\u0da7]",lastWeek:"[\u0db4\u0dc3\u0dd4\u0d9c\u0dd2\u0dba] dddd LT[\u0da7]",sameElse:"L"},relativeTime:{future:"%s\u0d9a\u0dd2\u0db1\u0dca",past:"%s\u0d9a\u0da7 \u0db4\u0dd9\u0dbb",s:"\u0dad\u0dad\u0dca\u0db4\u0dbb \u0d9a\u0dd2\u0dc4\u0dd2\u0db4\u0dba",ss:"\u0dad\u0dad\u0dca\u0db4\u0dbb %d",m:"\u0db8\u0dd2\u0db1\u0dd2\u0dad\u0dca\u0dad\u0dd4\u0dc0",mm:"\u0db8\u0dd2\u0db1\u0dd2\u0dad\u0dca\u0dad\u0dd4 %d",h:"\u0db4\u0dd0\u0dba",hh:"\u0db4\u0dd0\u0dba %d",d:"\u0daf\u0dd2\u0db1\u0dba",dd:"\u0daf\u0dd2\u0db1 %d",M:"\u0db8\u0dcf\u0dc3\u0dba",MM:"\u0db8\u0dcf\u0dc3 %d",y:"\u0dc0\u0dc3\u0dbb",yy:"\u0dc0\u0dc3\u0dbb %d"},dayOfMonthOrdinalParse:/\d{1,2} \u0dc0\u0dd0\u0db1\u0dd2/,ordinal:function(t){return t+" \u0dc0\u0dd0\u0db1\u0dd2"},meridiemParse:/\u0db4\u0dd9\u0dbb \u0dc0\u0dbb\u0dd4|\u0db4\u0dc3\u0dca \u0dc0\u0dbb\u0dd4|\u0db4\u0dd9.\u0dc0|\u0db4.\u0dc0./,isPM:function(t){return"\u0db4.\u0dc0."===t||"\u0db4\u0dc3\u0dca \u0dc0\u0dbb\u0dd4"===t},meridiem:function(t,e,n){return t>11?n?"\u0db4.\u0dc0.":"\u0db4\u0dc3\u0dca \u0dc0\u0dbb\u0dd4":n?"\u0db4\u0dd9.\u0dc0.":"\u0db4\u0dd9\u0dbb \u0dc0\u0dbb\u0dd4"}})}(n(30381))},64249:function(t,e,n){!function(t){"use strict";var e="janu\xe1r_febru\xe1r_marec_apr\xedl_m\xe1j_j\xfan_j\xfal_august_september_okt\xf3ber_november_december".split("_"),n="jan_feb_mar_apr_m\xe1j_j\xfan_j\xfal_aug_sep_okt_nov_dec".split("_");function r(t){return t>1&&t<5}function i(t,e,n,i){var a=t+" ";switch(n){case"s":return e||i?"p\xe1r sek\xfand":"p\xe1r sekundami";case"ss":return e||i?a+(r(t)?"sekundy":"sek\xfand"):a+"sekundami";case"m":return e?"min\xfata":i?"min\xfatu":"min\xfatou";case"mm":return e||i?a+(r(t)?"min\xfaty":"min\xfat"):a+"min\xfatami";case"h":return e?"hodina":i?"hodinu":"hodinou";case"hh":return e||i?a+(r(t)?"hodiny":"hod\xedn"):a+"hodinami";case"d":return e||i?"de\u0148":"d\u0148om";case"dd":return e||i?a+(r(t)?"dni":"dn\xed"):a+"d\u0148ami";case"M":return e||i?"mesiac":"mesiacom";case"MM":return e||i?a+(r(t)?"mesiace":"mesiacov"):a+"mesiacmi";case"y":return e||i?"rok":"rokom";case"yy":return e||i?a+(r(t)?"roky":"rokov"):a+"rokmi"}}t.defineLocale("sk",{months:e,monthsShort:n,weekdays:"nede\u013ea_pondelok_utorok_streda_\u0161tvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_\u0161t_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_\u0161t_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nede\u013eu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo \u0161tvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[v\u010dera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minul\xfa nede\u013eu o] LT";case 1:case 2:case 4:case 5:return"[minul\xfd] dddd [o] LT";case 3:return"[minul\xfa stredu o] LT";case 6:return"[minul\xfa sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:i,ss:i,m:i,mm:i,h:i,hh:i,d:i,dd:i,M:i,MM:i,y:i,yy:i},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},14985:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i=t+" ";switch(n){case"s":return e||r?"nekaj sekund":"nekaj sekundami";case"ss":return i+=1===t?e?"sekundo":"sekundi":2===t?e||r?"sekundi":"sekundah":t<5?e||r?"sekunde":"sekundah":"sekund";case"m":return e?"ena minuta":"eno minuto";case"mm":return i+=1===t?e?"minuta":"minuto":2===t?e||r?"minuti":"minutama":t<5?e||r?"minute":"minutami":e||r?"minut":"minutami";case"h":return e?"ena ura":"eno uro";case"hh":return i+=1===t?e?"ura":"uro":2===t?e||r?"uri":"urama":t<5?e||r?"ure":"urami":e||r?"ur":"urami";case"d":return e||r?"en dan":"enim dnem";case"dd":return i+=1===t?e||r?"dan":"dnem":2===t?e||r?"dni":"dnevoma":e||r?"dni":"dnevi";case"M":return e||r?"en mesec":"enim mesecem";case"MM":return i+=1===t?e||r?"mesec":"mesecem":2===t?e||r?"meseca":"mesecema":t<5?e||r?"mesece":"meseci":e||r?"mesecev":"meseci";case"y":return e||r?"eno leto":"enim letom";case"yy":return i+=1===t?e||r?"leto":"letom":2===t?e||r?"leti":"letoma":t<5?e||r?"leta":"leti":e||r?"let":"leti"}}t.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_\u010detrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._\u010det._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_\u010de_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[v\u010deraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prej\u0161njo] [nedeljo] [ob] LT";case 3:return"[prej\u0161njo] [sredo] [ob] LT";case 6:return"[prej\u0161njo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prej\u0161nji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"\u010dez %s",past:"pred %s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},51104:function(t,e,n){!function(t){"use strict";t.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_N\xebntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_N\xebn_Dhj".split("_"),weekdays:"E Diel_E H\xebn\xeb_E Mart\xeb_E M\xebrkur\xeb_E Enjte_E Premte_E Shtun\xeb".split("_"),weekdaysShort:"Die_H\xebn_Mar_M\xebr_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_M\xeb_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(t){return"M"===t.charAt(0)},meridiem:function(t,e,n){return t<12?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot n\xeb] LT",nextDay:"[Nes\xebr n\xeb] LT",nextWeek:"dddd [n\xeb] LT",lastDay:"[Dje n\xeb] LT",lastWeek:"dddd [e kaluar n\xeb] LT",sameElse:"L"},relativeTime:{future:"n\xeb %s",past:"%s m\xeb par\xeb",s:"disa sekonda",ss:"%d sekonda",m:"nj\xeb minut\xeb",mm:"%d minuta",h:"nj\xeb or\xeb",hh:"%d or\xeb",d:"nj\xeb dit\xeb",dd:"%d dit\xeb",M:"nj\xeb muaj",MM:"%d muaj",y:"nj\xeb vit",yy:"%d vite"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},79915:function(t,e,n){!function(t){"use strict";var e={words:{ss:["\u0441\u0435\u043a\u0443\u043d\u0434\u0430","\u0441\u0435\u043a\u0443\u043d\u0434\u0435","\u0441\u0435\u043a\u0443\u043d\u0434\u0438"],m:["\u0458\u0435\u0434\u0430\u043d \u043c\u0438\u043d\u0443\u0442","\u0458\u0435\u0434\u043d\u043e\u0433 \u043c\u0438\u043d\u0443\u0442\u0430"],mm:["\u043c\u0438\u043d\u0443\u0442","\u043c\u0438\u043d\u0443\u0442\u0430","\u043c\u0438\u043d\u0443\u0442\u0430"],h:["\u0458\u0435\u0434\u0430\u043d \u0441\u0430\u0442","\u0458\u0435\u0434\u043d\u043e\u0433 \u0441\u0430\u0442\u0430"],hh:["\u0441\u0430\u0442","\u0441\u0430\u0442\u0430","\u0441\u0430\u0442\u0438"],d:["\u0458\u0435\u0434\u0430\u043d \u0434\u0430\u043d","\u0458\u0435\u0434\u043d\u043e\u0433 \u0434\u0430\u043d\u0430"],dd:["\u0434\u0430\u043d","\u0434\u0430\u043d\u0430","\u0434\u0430\u043d\u0430"],M:["\u0458\u0435\u0434\u0430\u043d \u043c\u0435\u0441\u0435\u0446","\u0458\u0435\u0434\u043d\u043e\u0433 \u043c\u0435\u0441\u0435\u0446\u0430"],MM:["\u043c\u0435\u0441\u0435\u0446","\u043c\u0435\u0441\u0435\u0446\u0430","\u043c\u0435\u0441\u0435\u0446\u0438"],y:["\u0458\u0435\u0434\u043d\u0443 \u0433\u043e\u0434\u0438\u043d\u0443","\u0458\u0435\u0434\u043d\u0435 \u0433\u043e\u0434\u0438\u043d\u0435"],yy:["\u0433\u043e\u0434\u0438\u043d\u0443","\u0433\u043e\u0434\u0438\u043d\u0435","\u0433\u043e\u0434\u0438\u043d\u0430"]},correctGrammaticalCase:function(t,e){return t%10>=1&&t%10<=4&&(t%100<10||t%100>=20)?t%10==1?e[0]:e[1]:e[2]},translate:function(t,n,r,i){var a,s=e.words[r];return 1===r.length?"y"===r&&n?"\u0458\u0435\u0434\u043d\u0430 \u0433\u043e\u0434\u0438\u043d\u0430":i||n?s[0]:s[1]:(a=e.correctGrammaticalCase(t,s),"yy"===r&&n&&"\u0433\u043e\u0434\u0438\u043d\u0443"===a?t+" \u0433\u043e\u0434\u0438\u043d\u0430":t+" "+a)}};t.defineLocale("sr-cyrl",{months:"\u0458\u0430\u043d\u0443\u0430\u0440_\u0444\u0435\u0431\u0440\u0443\u0430\u0440_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0438\u043b_\u043c\u0430\u0458_\u0458\u0443\u043d_\u0458\u0443\u043b_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043f\u0442\u0435\u043c\u0431\u0430\u0440_\u043e\u043a\u0442\u043e\u0431\u0430\u0440_\u043d\u043e\u0432\u0435\u043c\u0431\u0430\u0440_\u0434\u0435\u0446\u0435\u043c\u0431\u0430\u0440".split("_"),monthsShort:"\u0458\u0430\u043d._\u0444\u0435\u0431._\u043c\u0430\u0440._\u0430\u043f\u0440._\u043c\u0430\u0458_\u0458\u0443\u043d_\u0458\u0443\u043b_\u0430\u0432\u0433._\u0441\u0435\u043f._\u043e\u043a\u0442._\u043d\u043e\u0432._\u0434\u0435\u0446.".split("_"),monthsParseExact:!0,weekdays:"\u043d\u0435\u0434\u0435\u0459\u0430_\u043f\u043e\u043d\u0435\u0434\u0435\u0459\u0430\u043a_\u0443\u0442\u043e\u0440\u0430\u043a_\u0441\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0440\u0442\u0430\u043a_\u043f\u0435\u0442\u0430\u043a_\u0441\u0443\u0431\u043e\u0442\u0430".split("_"),weekdaysShort:"\u043d\u0435\u0434._\u043f\u043e\u043d._\u0443\u0442\u043e._\u0441\u0440\u0435._\u0447\u0435\u0442._\u043f\u0435\u0442._\u0441\u0443\u0431.".split("_"),weekdaysMin:"\u043d\u0435_\u043f\u043e_\u0443\u0442_\u0441\u0440_\u0447\u0435_\u043f\u0435_\u0441\u0443".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[\u0434\u0430\u043d\u0430\u0441 \u0443] LT",nextDay:"[\u0441\u0443\u0442\u0440\u0430 \u0443] LT",nextWeek:function(){switch(this.day()){case 0:return"[\u0443] [\u043d\u0435\u0434\u0435\u0459\u0443] [\u0443] LT";case 3:return"[\u0443] [\u0441\u0440\u0435\u0434\u0443] [\u0443] LT";case 6:return"[\u0443] [\u0441\u0443\u0431\u043e\u0442\u0443] [\u0443] LT";case 1:case 2:case 4:case 5:return"[\u0443] dddd [\u0443] LT"}},lastDay:"[\u0458\u0443\u0447\u0435 \u0443] LT",lastWeek:function(){return["[\u043f\u0440\u043e\u0448\u043b\u0435] [\u043d\u0435\u0434\u0435\u0459\u0435] [\u0443] LT","[\u043f\u0440\u043e\u0448\u043b\u043e\u0433] [\u043f\u043e\u043d\u0435\u0434\u0435\u0459\u043a\u0430] [\u0443] LT","[\u043f\u0440\u043e\u0448\u043b\u043e\u0433] [\u0443\u0442\u043e\u0440\u043a\u0430] [\u0443] LT","[\u043f\u0440\u043e\u0448\u043b\u0435] [\u0441\u0440\u0435\u0434\u0435] [\u0443] LT","[\u043f\u0440\u043e\u0448\u043b\u043e\u0433] [\u0447\u0435\u0442\u0432\u0440\u0442\u043a\u0430] [\u0443] LT","[\u043f\u0440\u043e\u0448\u043b\u043e\u0433] [\u043f\u0435\u0442\u043a\u0430] [\u0443] LT","[\u043f\u0440\u043e\u0448\u043b\u0435] [\u0441\u0443\u0431\u043e\u0442\u0435] [\u0443] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"\u0437\u0430 %s",past:"\u043f\u0440\u0435 %s",s:"\u043d\u0435\u043a\u043e\u043b\u0438\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434\u0438",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:e.translate,dd:e.translate,M:e.translate,MM:e.translate,y:e.translate,yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},49131:function(t,e,n){!function(t){"use strict";var e={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],d:["jedan dan","jednog dana"],dd:["dan","dana","dana"],M:["jedan mesec","jednog meseca"],MM:["mesec","meseca","meseci"],y:["jednu godinu","jedne godine"],yy:["godinu","godine","godina"]},correctGrammaticalCase:function(t,e){return t%10>=1&&t%10<=4&&(t%100<10||t%100>=20)?t%10==1?e[0]:e[1]:e[2]},translate:function(t,n,r,i){var a,s=e.words[r];return 1===r.length?"y"===r&&n?"jedna godina":i||n?s[0]:s[1]:(a=e.correctGrammaticalCase(t,s),"yy"===r&&n&&"godinu"===a?t+" godina":t+" "+a)}};t.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_\u010detvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._\u010det._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_\u010de_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[ju\u010de u] LT",lastWeek:function(){return["[pro\u0161le] [nedelje] [u] LT","[pro\u0161log] [ponedeljka] [u] LT","[pro\u0161log] [utorka] [u] LT","[pro\u0161le] [srede] [u] LT","[pro\u0161log] [\u010detvrtka] [u] LT","[pro\u0161log] [petka] [u] LT","[pro\u0161le] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:e.translate,m:e.translate,mm:e.translate,h:e.translate,hh:e.translate,d:e.translate,dd:e.translate,M:e.translate,MM:e.translate,y:e.translate,yy:e.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n(30381))},85893:function(t,e,n){!function(t){"use strict";t.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",ss:"%d mzuzwana",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(t,e,n){return t<11?"ekuseni":t<15?"emini":t<19?"entsambama":"ebusuku"},meridiemHour:function(t,e){return 12===t&&(t=0),"ekuseni"===e?t:"emini"===e?t>=11?t:t+12:"entsambama"===e||"ebusuku"===e?0===t?0:t+12:void 0},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}})}(n(30381))},98760:function(t,e,n){!function(t){"use strict";t.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"s\xf6ndag_m\xe5ndag_tisdag_onsdag_torsdag_fredag_l\xf6rdag".split("_"),weekdaysShort:"s\xf6n_m\xe5n_tis_ons_tor_fre_l\xf6r".split("_"),weekdaysMin:"s\xf6_m\xe5_ti_on_to_fr_l\xf6".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Ig\xe5r] LT",nextWeek:"[P\xe5] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"f\xf6r %s sedan",s:"n\xe5gra sekunder",ss:"%d sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en m\xe5nad",MM:"%d m\xe5nader",y:"ett \xe5r",yy:"%d \xe5r"},dayOfMonthOrdinalParse:/\d{1,2}(\:e|\:a)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?":e":1===e||2===e?":a":":e")},week:{dow:1,doy:4}})}(n(30381))},91172:function(t,e,n){!function(t){"use strict";t.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"hh:mm A",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",ss:"sekunde %d",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"siku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}})}(n(30381))},27333:function(t,e,n){!function(t){"use strict";var e={1:"\u0be7",2:"\u0be8",3:"\u0be9",4:"\u0bea",5:"\u0beb",6:"\u0bec",7:"\u0bed",8:"\u0bee",9:"\u0bef",0:"\u0be6"},n={"\u0be7":"1","\u0be8":"2","\u0be9":"3","\u0bea":"4","\u0beb":"5","\u0bec":"6","\u0bed":"7","\u0bee":"8","\u0bef":"9","\u0be6":"0"};t.defineLocale("ta",{months:"\u0b9c\u0ba9\u0bb5\u0bb0\u0bbf_\u0baa\u0bbf\u0baa\u0bcd\u0bb0\u0bb5\u0bb0\u0bbf_\u0bae\u0bbe\u0bb0\u0bcd\u0b9a\u0bcd_\u0b8f\u0baa\u0bcd\u0bb0\u0bb2\u0bcd_\u0bae\u0bc7_\u0b9c\u0bc2\u0ba9\u0bcd_\u0b9c\u0bc2\u0bb2\u0bc8_\u0b86\u0b95\u0bb8\u0bcd\u0b9f\u0bcd_\u0b9a\u0bc6\u0baa\u0bcd\u0b9f\u0bc6\u0bae\u0bcd\u0baa\u0bb0\u0bcd_\u0b85\u0b95\u0bcd\u0b9f\u0bc7\u0bbe\u0baa\u0bb0\u0bcd_\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd_\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcd".split("_"),monthsShort:"\u0b9c\u0ba9\u0bb5\u0bb0\u0bbf_\u0baa\u0bbf\u0baa\u0bcd\u0bb0\u0bb5\u0bb0\u0bbf_\u0bae\u0bbe\u0bb0\u0bcd\u0b9a\u0bcd_\u0b8f\u0baa\u0bcd\u0bb0\u0bb2\u0bcd_\u0bae\u0bc7_\u0b9c\u0bc2\u0ba9\u0bcd_\u0b9c\u0bc2\u0bb2\u0bc8_\u0b86\u0b95\u0bb8\u0bcd\u0b9f\u0bcd_\u0b9a\u0bc6\u0baa\u0bcd\u0b9f\u0bc6\u0bae\u0bcd\u0baa\u0bb0\u0bcd_\u0b85\u0b95\u0bcd\u0b9f\u0bc7\u0bbe\u0baa\u0bb0\u0bcd_\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd_\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcd".split("_"),weekdays:"\u0b9e\u0bbe\u0baf\u0bbf\u0bb1\u0bcd\u0bb1\u0bc1\u0b95\u0bcd\u0b95\u0bbf\u0bb4\u0bae\u0bc8_\u0ba4\u0bbf\u0b99\u0bcd\u0b95\u0b9f\u0bcd\u0b95\u0bbf\u0bb4\u0bae\u0bc8_\u0b9a\u0bc6\u0bb5\u0bcd\u0bb5\u0bbe\u0baf\u0bcd\u0b95\u0bbf\u0bb4\u0bae\u0bc8_\u0baa\u0bc1\u0ba4\u0ba9\u0bcd\u0b95\u0bbf\u0bb4\u0bae\u0bc8_\u0bb5\u0bbf\u0baf\u0bbe\u0bb4\u0b95\u0bcd\u0b95\u0bbf\u0bb4\u0bae\u0bc8_\u0bb5\u0bc6\u0bb3\u0bcd\u0bb3\u0bbf\u0b95\u0bcd\u0b95\u0bbf\u0bb4\u0bae\u0bc8_\u0b9a\u0ba9\u0bbf\u0b95\u0bcd\u0b95\u0bbf\u0bb4\u0bae\u0bc8".split("_"),weekdaysShort:"\u0b9e\u0bbe\u0baf\u0bbf\u0bb1\u0bc1_\u0ba4\u0bbf\u0b99\u0bcd\u0b95\u0bb3\u0bcd_\u0b9a\u0bc6\u0bb5\u0bcd\u0bb5\u0bbe\u0baf\u0bcd_\u0baa\u0bc1\u0ba4\u0ba9\u0bcd_\u0bb5\u0bbf\u0baf\u0bbe\u0bb4\u0ba9\u0bcd_\u0bb5\u0bc6\u0bb3\u0bcd\u0bb3\u0bbf_\u0b9a\u0ba9\u0bbf".split("_"),weekdaysMin:"\u0b9e\u0bbe_\u0ba4\u0bbf_\u0b9a\u0bc6_\u0baa\u0bc1_\u0bb5\u0bbf_\u0bb5\u0bc6_\u0b9a".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[\u0b87\u0ba9\u0bcd\u0bb1\u0bc1] LT",nextDay:"[\u0ba8\u0bbe\u0bb3\u0bc8] LT",nextWeek:"dddd, LT",lastDay:"[\u0ba8\u0bc7\u0bb1\u0bcd\u0bb1\u0bc1] LT",lastWeek:"[\u0b95\u0b9f\u0ba8\u0bcd\u0ba4 \u0bb5\u0bbe\u0bb0\u0bae\u0bcd] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0b87\u0bb2\u0bcd",past:"%s \u0bae\u0bc1\u0ba9\u0bcd",s:"\u0b92\u0bb0\u0bc1 \u0b9a\u0bbf\u0bb2 \u0bb5\u0bbf\u0ba8\u0bbe\u0b9f\u0bbf\u0b95\u0bb3\u0bcd",ss:"%d \u0bb5\u0bbf\u0ba8\u0bbe\u0b9f\u0bbf\u0b95\u0bb3\u0bcd",m:"\u0b92\u0bb0\u0bc1 \u0ba8\u0bbf\u0bae\u0bbf\u0b9f\u0bae\u0bcd",mm:"%d \u0ba8\u0bbf\u0bae\u0bbf\u0b9f\u0b99\u0bcd\u0b95\u0bb3\u0bcd",h:"\u0b92\u0bb0\u0bc1 \u0bae\u0ba3\u0bbf \u0ba8\u0bc7\u0bb0\u0bae\u0bcd",hh:"%d \u0bae\u0ba3\u0bbf \u0ba8\u0bc7\u0bb0\u0bae\u0bcd",d:"\u0b92\u0bb0\u0bc1 \u0ba8\u0bbe\u0bb3\u0bcd",dd:"%d \u0ba8\u0bbe\u0b9f\u0bcd\u0b95\u0bb3\u0bcd",M:"\u0b92\u0bb0\u0bc1 \u0bae\u0bbe\u0ba4\u0bae\u0bcd",MM:"%d \u0bae\u0bbe\u0ba4\u0b99\u0bcd\u0b95\u0bb3\u0bcd",y:"\u0b92\u0bb0\u0bc1 \u0bb5\u0bb0\u0bc1\u0b9f\u0bae\u0bcd",yy:"%d \u0b86\u0ba3\u0bcd\u0b9f\u0bc1\u0b95\u0bb3\u0bcd"},dayOfMonthOrdinalParse:/\d{1,2}\u0bb5\u0ba4\u0bc1/,ordinal:function(t){return t+"\u0bb5\u0ba4\u0bc1"},preparse:function(t){return t.replace(/[\u0be7\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef\u0be6]/g,(function(t){return n[t]}))},postformat:function(t){return t.replace(/\d/g,(function(t){return e[t]}))},meridiemParse:/\u0baf\u0bbe\u0bae\u0bae\u0bcd|\u0bb5\u0bc8\u0b95\u0bb1\u0bc8|\u0b95\u0bbe\u0bb2\u0bc8|\u0ba8\u0ba3\u0bcd\u0baa\u0b95\u0bb2\u0bcd|\u0b8e\u0bb1\u0bcd\u0baa\u0bbe\u0b9f\u0bc1|\u0bae\u0bbe\u0bb2\u0bc8/,meridiem:function(t,e,n){return t<2?" \u0baf\u0bbe\u0bae\u0bae\u0bcd":t<6?" \u0bb5\u0bc8\u0b95\u0bb1\u0bc8":t<10?" \u0b95\u0bbe\u0bb2\u0bc8":t<14?" \u0ba8\u0ba3\u0bcd\u0baa\u0b95\u0bb2\u0bcd":t<18?" \u0b8e\u0bb1\u0bcd\u0baa\u0bbe\u0b9f\u0bc1":t<22?" \u0bae\u0bbe\u0bb2\u0bc8":" \u0baf\u0bbe\u0bae\u0bae\u0bcd"},meridiemHour:function(t,e){return 12===t&&(t=0),"\u0baf\u0bbe\u0bae\u0bae\u0bcd"===e?t<2?t:t+12:"\u0bb5\u0bc8\u0b95\u0bb1\u0bc8"===e||"\u0b95\u0bbe\u0bb2\u0bc8"===e||"\u0ba8\u0ba3\u0bcd\u0baa\u0b95\u0bb2\u0bcd"===e&&t>=10?t:t+12},week:{dow:0,doy:6}})}(n(30381))},23110:function(t,e,n){!function(t){"use strict";t.defineLocale("te",{months:"\u0c1c\u0c28\u0c35\u0c30\u0c3f_\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f_\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f_\u0c0f\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d_\u0c2e\u0c47_\u0c1c\u0c42\u0c28\u0c4d_\u0c1c\u0c41\u0c32\u0c48_\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41_\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d_\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d_\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d_\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d".split("_"),monthsShort:"\u0c1c\u0c28._\u0c2b\u0c3f\u0c2c\u0c4d\u0c30._\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f_\u0c0f\u0c2a\u0c4d\u0c30\u0c3f._\u0c2e\u0c47_\u0c1c\u0c42\u0c28\u0c4d_\u0c1c\u0c41\u0c32\u0c48_\u0c06\u0c17._\u0c38\u0c46\u0c2a\u0c4d._\u0c05\u0c15\u0c4d\u0c1f\u0c4b._\u0c28\u0c35._\u0c21\u0c3f\u0c38\u0c46.".split("_"),monthsParseExact:!0,weekdays:"\u0c06\u0c26\u0c3f\u0c35\u0c3e\u0c30\u0c02_\u0c38\u0c4b\u0c2e\u0c35\u0c3e\u0c30\u0c02_\u0c2e\u0c02\u0c17\u0c33\u0c35\u0c3e\u0c30\u0c02_\u0c2c\u0c41\u0c27\u0c35\u0c3e\u0c30\u0c02_\u0c17\u0c41\u0c30\u0c41\u0c35\u0c3e\u0c30\u0c02_\u0c36\u0c41\u0c15\u0c4d\u0c30\u0c35\u0c3e\u0c30\u0c02_\u0c36\u0c28\u0c3f\u0c35\u0c3e\u0c30\u0c02".split("_"),weekdaysShort:"\u0c06\u0c26\u0c3f_\u0c38\u0c4b\u0c2e_\u0c2e\u0c02\u0c17\u0c33_\u0c2c\u0c41\u0c27_\u0c17\u0c41\u0c30\u0c41_\u0c36\u0c41\u0c15\u0c4d\u0c30_\u0c36\u0c28\u0c3f".split("_"),weekdaysMin:"\u0c06_\u0c38\u0c4b_\u0c2e\u0c02_\u0c2c\u0c41_\u0c17\u0c41_\u0c36\u0c41_\u0c36".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[\u0c28\u0c47\u0c21\u0c41] LT",nextDay:"[\u0c30\u0c47\u0c2a\u0c41] LT",nextWeek:"dddd, LT",lastDay:"[\u0c28\u0c3f\u0c28\u0c4d\u0c28] LT",lastWeek:"[\u0c17\u0c24] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0c32\u0c4b",past:"%s \u0c15\u0c4d\u0c30\u0c3f\u0c24\u0c02",s:"\u0c15\u0c4a\u0c28\u0c4d\u0c28\u0c3f \u0c15\u0c4d\u0c37\u0c23\u0c3e\u0c32\u0c41",ss:"%d \u0c38\u0c46\u0c15\u0c28\u0c4d\u0c32\u0c41",m:"\u0c12\u0c15 \u0c28\u0c3f\u0c2e\u0c3f\u0c37\u0c02",mm:"%d \u0c28\u0c3f\u0c2e\u0c3f\u0c37\u0c3e\u0c32\u0c41",h:"\u0c12\u0c15 \u0c17\u0c02\u0c1f",hh:"%d \u0c17\u0c02\u0c1f\u0c32\u0c41",d:"\u0c12\u0c15 \u0c30\u0c4b\u0c1c\u0c41",dd:"%d \u0c30\u0c4b\u0c1c\u0c41\u0c32\u0c41",M:"\u0c12\u0c15 \u0c28\u0c46\u0c32",MM:"%d \u0c28\u0c46\u0c32\u0c32\u0c41",y:"\u0c12\u0c15 \u0c38\u0c02\u0c35\u0c24\u0c4d\u0c38\u0c30\u0c02",yy:"%d \u0c38\u0c02\u0c35\u0c24\u0c4d\u0c38\u0c30\u0c3e\u0c32\u0c41"},dayOfMonthOrdinalParse:/\d{1,2}\u0c35/,ordinal:"%d\u0c35",meridiemParse:/\u0c30\u0c3e\u0c24\u0c4d\u0c30\u0c3f|\u0c09\u0c26\u0c2f\u0c02|\u0c2e\u0c27\u0c4d\u0c2f\u0c3e\u0c39\u0c4d\u0c28\u0c02|\u0c38\u0c3e\u0c2f\u0c02\u0c24\u0c4d\u0c30\u0c02/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0c30\u0c3e\u0c24\u0c4d\u0c30\u0c3f"===e?t<4?t:t+12:"\u0c09\u0c26\u0c2f\u0c02"===e?t:"\u0c2e\u0c27\u0c4d\u0c2f\u0c3e\u0c39\u0c4d\u0c28\u0c02"===e?t>=10?t:t+12:"\u0c38\u0c3e\u0c2f\u0c02\u0c24\u0c4d\u0c30\u0c02"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u0c30\u0c3e\u0c24\u0c4d\u0c30\u0c3f":t<10?"\u0c09\u0c26\u0c2f\u0c02":t<17?"\u0c2e\u0c27\u0c4d\u0c2f\u0c3e\u0c39\u0c4d\u0c28\u0c02":t<20?"\u0c38\u0c3e\u0c2f\u0c02\u0c24\u0c4d\u0c30\u0c02":"\u0c30\u0c3e\u0c24\u0c4d\u0c30\u0c3f"},week:{dow:0,doy:6}})}(n(30381))},52095:function(t,e,n){!function(t){"use strict";t.defineLocale("tet",{months:"Janeiru_Fevereiru_Marsu_Abril_Maiu_Ju\xf1u_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu".split("_"),weekdaysShort:"Dom_Seg_Ters_Kua_Kint_Sest_Sab".split("_"),weekdaysMin:"Do_Seg_Te_Ku_Ki_Ses_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Ohin iha] LT",nextDay:"[Aban iha] LT",nextWeek:"dddd [iha] LT",lastDay:"[Horiseik iha] LT",lastWeek:"dddd [semana kotuk] [iha] LT",sameElse:"L"},relativeTime:{future:"iha %s",past:"%s liuba",s:"segundu balun",ss:"segundu %d",m:"minutu ida",mm:"minutu %d",h:"oras ida",hh:"oras %d",d:"loron ida",dd:"loron %d",M:"fulan ida",MM:"fulan %d",y:"tinan ida",yy:"tinan %d"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},27321:function(t,e,n){!function(t){"use strict";var e={0:"-\u0443\u043c",1:"-\u0443\u043c",2:"-\u044e\u043c",3:"-\u044e\u043c",4:"-\u0443\u043c",5:"-\u0443\u043c",6:"-\u0443\u043c",7:"-\u0443\u043c",8:"-\u0443\u043c",9:"-\u0443\u043c",10:"-\u0443\u043c",12:"-\u0443\u043c",13:"-\u0443\u043c",20:"-\u0443\u043c",30:"-\u044e\u043c",40:"-\u0443\u043c",50:"-\u0443\u043c",60:"-\u0443\u043c",70:"-\u0443\u043c",80:"-\u0443\u043c",90:"-\u0443\u043c",100:"-\u0443\u043c"};t.defineLocale("tg",{months:{format:"\u044f\u043d\u0432\u0430\u0440\u0438_\u0444\u0435\u0432\u0440\u0430\u043b\u0438_\u043c\u0430\u0440\u0442\u0438_\u0430\u043f\u0440\u0435\u043b\u0438_\u043c\u0430\u0439\u0438_\u0438\u044e\u043d\u0438_\u0438\u044e\u043b\u0438_\u0430\u0432\u0433\u0443\u0441\u0442\u0438_\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u0438_\u043e\u043a\u0442\u044f\u0431\u0440\u0438_\u043d\u043e\u044f\u0431\u0440\u0438_\u0434\u0435\u043a\u0430\u0431\u0440\u0438".split("_"),standalone:"\u044f\u043d\u0432\u0430\u0440_\u0444\u0435\u0432\u0440\u0430\u043b_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0435\u043b_\u043c\u0430\u0439_\u0438\u044e\u043d_\u0438\u044e\u043b_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043d\u0442\u044f\u0431\u0440_\u043e\u043a\u0442\u044f\u0431\u0440_\u043d\u043e\u044f\u0431\u0440_\u0434\u0435\u043a\u0430\u0431\u0440".split("_")},monthsShort:"\u044f\u043d\u0432_\u0444\u0435\u0432_\u043c\u0430\u0440_\u0430\u043f\u0440_\u043c\u0430\u0439_\u0438\u044e\u043d_\u0438\u044e\u043b_\u0430\u0432\u0433_\u0441\u0435\u043d_\u043e\u043a\u0442_\u043d\u043e\u044f_\u0434\u0435\u043a".split("_"),weekdays:"\u044f\u043a\u0448\u0430\u043d\u0431\u0435_\u0434\u0443\u0448\u0430\u043d\u0431\u0435_\u0441\u0435\u0448\u0430\u043d\u0431\u0435_\u0447\u043e\u0440\u0448\u0430\u043d\u0431\u0435_\u043f\u0430\u043d\u04b7\u0448\u0430\u043d\u0431\u0435_\u04b7\u0443\u043c\u044a\u0430_\u0448\u0430\u043d\u0431\u0435".split("_"),weekdaysShort:"\u044f\u0448\u0431_\u0434\u0448\u0431_\u0441\u0448\u0431_\u0447\u0448\u0431_\u043f\u0448\u0431_\u04b7\u0443\u043c_\u0448\u043d\u0431".split("_"),weekdaysMin:"\u044f\u0448_\u0434\u0448_\u0441\u0448_\u0447\u0448_\u043f\u0448_\u04b7\u043c_\u0448\u0431".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0418\u043c\u0440\u04ef\u0437 \u0441\u043e\u0430\u0442\u0438] LT",nextDay:"[\u0424\u0430\u0440\u0434\u043e \u0441\u043e\u0430\u0442\u0438] LT",lastDay:"[\u0414\u0438\u0440\u04ef\u0437 \u0441\u043e\u0430\u0442\u0438] LT",nextWeek:"dddd[\u0438] [\u04b3\u0430\u0444\u0442\u0430\u0438 \u043e\u044f\u043d\u0434\u0430 \u0441\u043e\u0430\u0442\u0438] LT",lastWeek:"dddd[\u0438] [\u04b3\u0430\u0444\u0442\u0430\u0438 \u0433\u0443\u0437\u0430\u0448\u0442\u0430 \u0441\u043e\u0430\u0442\u0438] LT",sameElse:"L"},relativeTime:{future:"\u0431\u0430\u044a\u0434\u0438 %s",past:"%s \u043f\u0435\u0448",s:"\u044f\u043a\u0447\u0430\u043d\u0434 \u0441\u043e\u043d\u0438\u044f",m:"\u044f\u043a \u0434\u0430\u049b\u0438\u049b\u0430",mm:"%d \u0434\u0430\u049b\u0438\u049b\u0430",h:"\u044f\u043a \u0441\u043e\u0430\u0442",hh:"%d \u0441\u043e\u0430\u0442",d:"\u044f\u043a \u0440\u04ef\u0437",dd:"%d \u0440\u04ef\u0437",M:"\u044f\u043a \u043c\u043e\u04b3",MM:"%d \u043c\u043e\u04b3",y:"\u044f\u043a \u0441\u043e\u043b",yy:"%d \u0441\u043e\u043b"},meridiemParse:/\u0448\u0430\u0431|\u0441\u0443\u0431\u04b3|\u0440\u04ef\u0437|\u0431\u0435\u0433\u043e\u04b3/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u0448\u0430\u0431"===e?t<4?t:t+12:"\u0441\u0443\u0431\u04b3"===e?t:"\u0440\u04ef\u0437"===e?t>=11?t:t+12:"\u0431\u0435\u0433\u043e\u04b3"===e?t+12:void 0},meridiem:function(t,e,n){return t<4?"\u0448\u0430\u0431":t<11?"\u0441\u0443\u0431\u04b3":t<16?"\u0440\u04ef\u0437":t<19?"\u0431\u0435\u0433\u043e\u04b3":"\u0448\u0430\u0431"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0443\u043c|\u044e\u043c)/,ordinal:function(t){var n=t%10,r=t>=100?100:null;return t+(e[t]||e[n]||e[r])},week:{dow:1,doy:7}})}(n(30381))},9041:function(t,e,n){!function(t){"use strict";t.defineLocale("th",{months:"\u0e21\u0e01\u0e23\u0e32\u0e04\u0e21_\u0e01\u0e38\u0e21\u0e20\u0e32\u0e1e\u0e31\u0e19\u0e18\u0e4c_\u0e21\u0e35\u0e19\u0e32\u0e04\u0e21_\u0e40\u0e21\u0e29\u0e32\u0e22\u0e19_\u0e1e\u0e24\u0e29\u0e20\u0e32\u0e04\u0e21_\u0e21\u0e34\u0e16\u0e38\u0e19\u0e32\u0e22\u0e19_\u0e01\u0e23\u0e01\u0e0e\u0e32\u0e04\u0e21_\u0e2a\u0e34\u0e07\u0e2b\u0e32\u0e04\u0e21_\u0e01\u0e31\u0e19\u0e22\u0e32\u0e22\u0e19_\u0e15\u0e38\u0e25\u0e32\u0e04\u0e21_\u0e1e\u0e24\u0e28\u0e08\u0e34\u0e01\u0e32\u0e22\u0e19_\u0e18\u0e31\u0e19\u0e27\u0e32\u0e04\u0e21".split("_"),monthsShort:"\u0e21.\u0e04._\u0e01.\u0e1e._\u0e21\u0e35.\u0e04._\u0e40\u0e21.\u0e22._\u0e1e.\u0e04._\u0e21\u0e34.\u0e22._\u0e01.\u0e04._\u0e2a.\u0e04._\u0e01.\u0e22._\u0e15.\u0e04._\u0e1e.\u0e22._\u0e18.\u0e04.".split("_"),monthsParseExact:!0,weekdays:"\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c_\u0e08\u0e31\u0e19\u0e17\u0e23\u0e4c_\u0e2d\u0e31\u0e07\u0e04\u0e32\u0e23_\u0e1e\u0e38\u0e18_\u0e1e\u0e24\u0e2b\u0e31\u0e2a\u0e1a\u0e14\u0e35_\u0e28\u0e38\u0e01\u0e23\u0e4c_\u0e40\u0e2a\u0e32\u0e23\u0e4c".split("_"),weekdaysShort:"\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c_\u0e08\u0e31\u0e19\u0e17\u0e23\u0e4c_\u0e2d\u0e31\u0e07\u0e04\u0e32\u0e23_\u0e1e\u0e38\u0e18_\u0e1e\u0e24\u0e2b\u0e31\u0e2a_\u0e28\u0e38\u0e01\u0e23\u0e4c_\u0e40\u0e2a\u0e32\u0e23\u0e4c".split("_"),weekdaysMin:"\u0e2d\u0e32._\u0e08._\u0e2d._\u0e1e._\u0e1e\u0e24._\u0e28._\u0e2a.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY \u0e40\u0e27\u0e25\u0e32 H:mm",LLLL:"\u0e27\u0e31\u0e19dddd\u0e17\u0e35\u0e48 D MMMM YYYY \u0e40\u0e27\u0e25\u0e32 H:mm"},meridiemParse:/\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07|\u0e2b\u0e25\u0e31\u0e07\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07/,isPM:function(t){return"\u0e2b\u0e25\u0e31\u0e07\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07"===t},meridiem:function(t,e,n){return t<12?"\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07":"\u0e2b\u0e25\u0e31\u0e07\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07"},calendar:{sameDay:"[\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49 \u0e40\u0e27\u0e25\u0e32] LT",nextDay:"[\u0e1e\u0e23\u0e38\u0e48\u0e07\u0e19\u0e35\u0e49 \u0e40\u0e27\u0e25\u0e32] LT",nextWeek:"dddd[\u0e2b\u0e19\u0e49\u0e32 \u0e40\u0e27\u0e25\u0e32] LT",lastDay:"[\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e27\u0e32\u0e19\u0e19\u0e35\u0e49 \u0e40\u0e27\u0e25\u0e32] LT",lastWeek:"[\u0e27\u0e31\u0e19]dddd[\u0e17\u0e35\u0e48\u0e41\u0e25\u0e49\u0e27 \u0e40\u0e27\u0e25\u0e32] LT",sameElse:"L"},relativeTime:{future:"\u0e2d\u0e35\u0e01 %s",past:"%s\u0e17\u0e35\u0e48\u0e41\u0e25\u0e49\u0e27",s:"\u0e44\u0e21\u0e48\u0e01\u0e35\u0e48\u0e27\u0e34\u0e19\u0e32\u0e17\u0e35",ss:"%d \u0e27\u0e34\u0e19\u0e32\u0e17\u0e35",m:"1 \u0e19\u0e32\u0e17\u0e35",mm:"%d \u0e19\u0e32\u0e17\u0e35",h:"1 \u0e0a\u0e31\u0e48\u0e27\u0e42\u0e21\u0e07",hh:"%d \u0e0a\u0e31\u0e48\u0e27\u0e42\u0e21\u0e07",d:"1 \u0e27\u0e31\u0e19",dd:"%d \u0e27\u0e31\u0e19",w:"1 \u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c",ww:"%d \u0e2a\u0e31\u0e1b\u0e14\u0e32\u0e2b\u0e4c",M:"1 \u0e40\u0e14\u0e37\u0e2d\u0e19",MM:"%d \u0e40\u0e14\u0e37\u0e2d\u0e19",y:"1 \u0e1b\u0e35",yy:"%d \u0e1b\u0e35"}})}(n(30381))},19005:function(t,e,n){!function(t){"use strict";var e={1:"'inji",5:"'inji",8:"'inji",70:"'inji",80:"'inji",2:"'nji",7:"'nji",20:"'nji",50:"'nji",3:"'\xfcnji",4:"'\xfcnji",100:"'\xfcnji",6:"'njy",9:"'unjy",10:"'unjy",30:"'unjy",60:"'ynjy",90:"'ynjy"};t.defineLocale("tk",{months:"\xddanwar_Fewral_Mart_Aprel_Ma\xfd_I\xfdun_I\xfdul_Awgust_Sent\xfdabr_Okt\xfdabr_No\xfdabr_Dekabr".split("_"),monthsShort:"\xddan_Few_Mar_Apr_Ma\xfd_I\xfdn_I\xfdl_Awg_Sen_Okt_No\xfd_Dek".split("_"),weekdays:"\xddek\u015fenbe_Du\u015fenbe_Si\u015fenbe_\xc7ar\u015fenbe_Pen\u015fenbe_Anna_\u015eenbe".split("_"),weekdaysShort:"\xddek_Du\u015f_Si\u015f_\xc7ar_Pen_Ann_\u015een".split("_"),weekdaysMin:"\xddk_D\u015f_S\u015f_\xc7r_Pn_An_\u015en".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bug\xfcn sagat] LT",nextDay:"[ertir sagat] LT",nextWeek:"[indiki] dddd [sagat] LT",lastDay:"[d\xfc\xfdn] LT",lastWeek:"[ge\xe7en] dddd [sagat] LT",sameElse:"L"},relativeTime:{future:"%s so\u0148",past:"%s \xf6\u0148",s:"birn\xe4\xe7e sekunt",m:"bir minut",mm:"%d minut",h:"bir sagat",hh:"%d sagat",d:"bir g\xfcn",dd:"%d g\xfcn",M:"bir a\xfd",MM:"%d a\xfd",y:"bir \xfdyl",yy:"%d \xfdyl"},ordinal:function(t,n){switch(n){case"d":case"D":case"Do":case"DD":return t;default:if(0===t)return t+"'unjy";var r=t%10,i=t%100-r,a=t>=100?100:null;return t+(e[r]||e[i]||e[a])}},week:{dow:1,doy:7}})}(n(30381))},75768:function(t,e,n){!function(t){"use strict";t.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},89444:function(t,e,n){!function(t){"use strict";var e="pagh_wa\u2019_cha\u2019_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");function n(t){var e=t;return e=-1!==t.indexOf("jaj")?e.slice(0,-3)+"leS":-1!==t.indexOf("jar")?e.slice(0,-3)+"waQ":-1!==t.indexOf("DIS")?e.slice(0,-3)+"nem":e+" pIq"}function r(t){var e=t;return e=-1!==t.indexOf("jaj")?e.slice(0,-3)+"Hu\u2019":-1!==t.indexOf("jar")?e.slice(0,-3)+"wen":-1!==t.indexOf("DIS")?e.slice(0,-3)+"ben":e+" ret"}function i(t,e,n,r){var i=a(t);switch(n){case"ss":return i+" lup";case"mm":return i+" tup";case"hh":return i+" rep";case"dd":return i+" jaj";case"MM":return i+" jar";case"yy":return i+" DIS"}}function a(t){var n=Math.floor(t%1e3/100),r=Math.floor(t%100/10),i=t%10,a="";return n>0&&(a+=e[n]+"vatlh"),r>0&&(a+=(""!==a?" ":"")+e[r]+"maH"),i>0&&(a+=(""!==a?" ":"")+e[i]),""===a?"pagh":a}t.defineLocale("tlh",{months:"tera\u2019 jar wa\u2019_tera\u2019 jar cha\u2019_tera\u2019 jar wej_tera\u2019 jar loS_tera\u2019 jar vagh_tera\u2019 jar jav_tera\u2019 jar Soch_tera\u2019 jar chorgh_tera\u2019 jar Hut_tera\u2019 jar wa\u2019maH_tera\u2019 jar wa\u2019maH wa\u2019_tera\u2019 jar wa\u2019maH cha\u2019".split("_"),monthsShort:"jar wa\u2019_jar cha\u2019_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa\u2019maH_jar wa\u2019maH wa\u2019_jar wa\u2019maH cha\u2019".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa\u2019leS] LT",nextWeek:"LLL",lastDay:"[wa\u2019Hu\u2019] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:n,past:r,s:"puS lup",ss:i,m:"wa\u2019 tup",mm:i,h:"wa\u2019 rep",hh:i,d:"wa\u2019 jaj",dd:i,M:"wa\u2019 jar",MM:i,y:"wa\u2019 DIS",yy:i},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},72397:function(t,e,n){!function(t){"use strict";var e={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'\xfcnc\xfc",4:"'\xfcnc\xfc",100:"'\xfcnc\xfc",6:"'nc\u0131",9:"'uncu",10:"'uncu",30:"'uncu",60:"'\u0131nc\u0131",90:"'\u0131nc\u0131"};t.defineLocale("tr",{months:"Ocak_\u015eubat_Mart_Nisan_May\u0131s_Haziran_Temmuz_A\u011fustos_Eyl\xfcl_Ekim_Kas\u0131m_Aral\u0131k".split("_"),monthsShort:"Oca_\u015eub_Mar_Nis_May_Haz_Tem_A\u011fu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Sal\u0131_\xc7ar\u015famba_Per\u015fembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pzt_Sal_\xc7ar_Per_Cum_Cmt".split("_"),weekdaysMin:"Pz_Pt_Sa_\xc7a_Pe_Cu_Ct".split("_"),meridiem:function(t,e,n){return t<12?n?"\xf6\xf6":"\xd6\xd6":n?"\xf6s":"\xd6S"},meridiemParse:/\xf6\xf6|\xd6\xd6|\xf6s|\xd6S/,isPM:function(t){return"\xf6s"===t||"\xd6S"===t},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bug\xfcn saat] LT",nextDay:"[yar\u0131n saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[d\xfcn] LT",lastWeek:"[ge\xe7en] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s \xf6nce",s:"birka\xe7 saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir g\xfcn",dd:"%d g\xfcn",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir y\u0131l",yy:"%d y\u0131l"},ordinal:function(t,n){switch(n){case"d":case"D":case"Do":case"DD":return t;default:if(0===t)return t+"'\u0131nc\u0131";var r=t%10,i=t%100-r,a=t>=100?100:null;return t+(e[r]||e[i]||e[a])}},week:{dow:1,doy:7}})}(n(30381))},28254:function(t,e,n){!function(t){"use strict";function e(t,e,n,r){var i={s:["viensas secunds","'iensas secunds"],ss:[t+" secunds",t+" secunds"],m:["'n m\xedut","'iens m\xedut"],mm:[t+" m\xeduts",t+" m\xeduts"],h:["'n \xfeora","'iensa \xfeora"],hh:[t+" \xfeoras",t+" \xfeoras"],d:["'n ziua","'iensa ziua"],dd:[t+" ziuas",t+" ziuas"],M:["'n mes","'iens mes"],MM:[t+" mesen",t+" mesen"],y:["'n ar","'iens ar"],yy:[t+" ars",t+" ars"]};return r||e?i[n][0]:i[n][1]}t.defineLocale("tzl",{months:"Januar_Fevraglh_Mar\xe7_Avr\xefu_Mai_G\xfcn_Julia_Guscht_Setemvar_Listop\xe4ts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_G\xfcn_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"S\xfaladi_L\xfane\xe7i_Maitzi_M\xe1rcuri_Xh\xfaadi_Vi\xe9ner\xe7i_S\xe1turi".split("_"),weekdaysShort:"S\xfal_L\xfan_Mai_M\xe1r_Xh\xfa_Vi\xe9_S\xe1t".split("_"),weekdaysMin:"S\xfa_L\xfa_Ma_M\xe1_Xh_Vi_S\xe1".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(t){return"d'o"===t.toLowerCase()},meridiem:function(t,e,n){return t>11?n?"d'o":"D'O":n?"d'a":"D'A"},calendar:{sameDay:"[oxhi \xe0] LT",nextDay:"[dem\xe0 \xe0] LT",nextWeek:"dddd [\xe0] LT",lastDay:"[ieiri \xe0] LT",lastWeek:"[s\xfcr el] dddd [lasteu \xe0] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:e,ss:e,m:e,mm:e,h:e,hh:e,d:e,dd:e,M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n(30381))},30699:function(t,e,n){!function(t){"use strict";t.defineLocale("tzm-latn",{months:"innayr_br\u02e4ayr\u02e4_mar\u02e4s\u02e4_ibrir_mayyw_ywnyw_ywlywz_\u0263w\u0161t_\u0161wtanbir_kt\u02e4wbr\u02e4_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_br\u02e4ayr\u02e4_mar\u02e4s\u02e4_ibrir_mayyw_ywnyw_ywlywz_\u0263w\u0161t_\u0161wtanbir_kt\u02e4wbr\u02e4_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asi\u1e0dyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asi\u1e0dyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asi\u1e0dyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",ss:"%d imik",m:"minu\u1e0d",mm:"%d minu\u1e0d",h:"sa\u025ba",hh:"%d tassa\u025bin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}(n(30381))},51106:function(t,e,n){!function(t){"use strict";t.defineLocale("tzm",{months:"\u2d49\u2d4f\u2d4f\u2d30\u2d62\u2d54_\u2d31\u2d55\u2d30\u2d62\u2d55_\u2d4e\u2d30\u2d55\u2d5a_\u2d49\u2d31\u2d54\u2d49\u2d54_\u2d4e\u2d30\u2d62\u2d62\u2d53_\u2d62\u2d53\u2d4f\u2d62\u2d53_\u2d62\u2d53\u2d4d\u2d62\u2d53\u2d63_\u2d56\u2d53\u2d5b\u2d5c_\u2d5b\u2d53\u2d5c\u2d30\u2d4f\u2d31\u2d49\u2d54_\u2d3d\u2d5f\u2d53\u2d31\u2d55_\u2d4f\u2d53\u2d61\u2d30\u2d4f\u2d31\u2d49\u2d54_\u2d37\u2d53\u2d4a\u2d4f\u2d31\u2d49\u2d54".split("_"),monthsShort:"\u2d49\u2d4f\u2d4f\u2d30\u2d62\u2d54_\u2d31\u2d55\u2d30\u2d62\u2d55_\u2d4e\u2d30\u2d55\u2d5a_\u2d49\u2d31\u2d54\u2d49\u2d54_\u2d4e\u2d30\u2d62\u2d62\u2d53_\u2d62\u2d53\u2d4f\u2d62\u2d53_\u2d62\u2d53\u2d4d\u2d62\u2d53\u2d63_\u2d56\u2d53\u2d5b\u2d5c_\u2d5b\u2d53\u2d5c\u2d30\u2d4f\u2d31\u2d49\u2d54_\u2d3d\u2d5f\u2d53\u2d31\u2d55_\u2d4f\u2d53\u2d61\u2d30\u2d4f\u2d31\u2d49\u2d54_\u2d37\u2d53\u2d4a\u2d4f\u2d31\u2d49\u2d54".split("_"),weekdays:"\u2d30\u2d59\u2d30\u2d4e\u2d30\u2d59_\u2d30\u2d62\u2d4f\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d4f\u2d30\u2d59_\u2d30\u2d3d\u2d54\u2d30\u2d59_\u2d30\u2d3d\u2d61\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d4e\u2d61\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d39\u2d62\u2d30\u2d59".split("_"),weekdaysShort:"\u2d30\u2d59\u2d30\u2d4e\u2d30\u2d59_\u2d30\u2d62\u2d4f\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d4f\u2d30\u2d59_\u2d30\u2d3d\u2d54\u2d30\u2d59_\u2d30\u2d3d\u2d61\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d4e\u2d61\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d39\u2d62\u2d30\u2d59".split("_"),weekdaysMin:"\u2d30\u2d59\u2d30\u2d4e\u2d30\u2d59_\u2d30\u2d62\u2d4f\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d4f\u2d30\u2d59_\u2d30\u2d3d\u2d54\u2d30\u2d59_\u2d30\u2d3d\u2d61\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d4e\u2d61\u2d30\u2d59_\u2d30\u2d59\u2d49\u2d39\u2d62\u2d30\u2d59".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u2d30\u2d59\u2d37\u2d45 \u2d34] LT",nextDay:"[\u2d30\u2d59\u2d3d\u2d30 \u2d34] LT",nextWeek:"dddd [\u2d34] LT",lastDay:"[\u2d30\u2d5a\u2d30\u2d4f\u2d5c \u2d34] LT",lastWeek:"dddd [\u2d34] LT",sameElse:"L"},relativeTime:{future:"\u2d37\u2d30\u2d37\u2d45 \u2d59 \u2d62\u2d30\u2d4f %s",past:"\u2d62\u2d30\u2d4f %s",s:"\u2d49\u2d4e\u2d49\u2d3d",ss:"%d \u2d49\u2d4e\u2d49\u2d3d",m:"\u2d4e\u2d49\u2d4f\u2d53\u2d3a",mm:"%d \u2d4e\u2d49\u2d4f\u2d53\u2d3a",h:"\u2d59\u2d30\u2d44\u2d30",hh:"%d \u2d5c\u2d30\u2d59\u2d59\u2d30\u2d44\u2d49\u2d4f",d:"\u2d30\u2d59\u2d59",dd:"%d o\u2d59\u2d59\u2d30\u2d4f",M:"\u2d30\u2d62o\u2d53\u2d54",MM:"%d \u2d49\u2d62\u2d62\u2d49\u2d54\u2d4f",y:"\u2d30\u2d59\u2d33\u2d30\u2d59",yy:"%d \u2d49\u2d59\u2d33\u2d30\u2d59\u2d4f"},week:{dow:6,doy:12}})}(n(30381))},9288:function(t,e,n){!function(t){"use strict";t.defineLocale("ug-cn",{months:"\u064a\u0627\u0646\u06cb\u0627\u0631_\u0641\u06d0\u06cb\u0631\u0627\u0644_\u0645\u0627\u0631\u062a_\u0626\u0627\u067e\u0631\u06d0\u0644_\u0645\u0627\u064a_\u0626\u0649\u064a\u06c7\u0646_\u0626\u0649\u064a\u06c7\u0644_\u0626\u0627\u06cb\u063a\u06c7\u0633\u062a_\u0633\u06d0\u0646\u062a\u06d5\u0628\u0649\u0631_\u0626\u06c6\u0643\u062a\u06d5\u0628\u0649\u0631_\u0646\u0648\u064a\u0627\u0628\u0649\u0631_\u062f\u06d0\u0643\u0627\u0628\u0649\u0631".split("_"),monthsShort:"\u064a\u0627\u0646\u06cb\u0627\u0631_\u0641\u06d0\u06cb\u0631\u0627\u0644_\u0645\u0627\u0631\u062a_\u0626\u0627\u067e\u0631\u06d0\u0644_\u0645\u0627\u064a_\u0626\u0649\u064a\u06c7\u0646_\u0626\u0649\u064a\u06c7\u0644_\u0626\u0627\u06cb\u063a\u06c7\u0633\u062a_\u0633\u06d0\u0646\u062a\u06d5\u0628\u0649\u0631_\u0626\u06c6\u0643\u062a\u06d5\u0628\u0649\u0631_\u0646\u0648\u064a\u0627\u0628\u0649\u0631_\u062f\u06d0\u0643\u0627\u0628\u0649\u0631".split("_"),weekdays:"\u064a\u06d5\u0643\u0634\u06d5\u0646\u0628\u06d5_\u062f\u06c8\u0634\u06d5\u0646\u0628\u06d5_\u0633\u06d5\u064a\u0634\u06d5\u0646\u0628\u06d5_\u0686\u0627\u0631\u0634\u06d5\u0646\u0628\u06d5_\u067e\u06d5\u064a\u0634\u06d5\u0646\u0628\u06d5_\u062c\u06c8\u0645\u06d5_\u0634\u06d5\u0646\u0628\u06d5".split("_"),weekdaysShort:"\u064a\u06d5_\u062f\u06c8_\u0633\u06d5_\u0686\u0627_\u067e\u06d5_\u062c\u06c8_\u0634\u06d5".split("_"),weekdaysMin:"\u064a\u06d5_\u062f\u06c8_\u0633\u06d5_\u0686\u0627_\u067e\u06d5_\u062c\u06c8_\u0634\u06d5".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY-\u064a\u0649\u0644\u0649M-\u0626\u0627\u064a\u0646\u0649\u06adD-\u0643\u06c8\u0646\u0649",LLL:"YYYY-\u064a\u0649\u0644\u0649M-\u0626\u0627\u064a\u0646\u0649\u06adD-\u0643\u06c8\u0646\u0649\u060c HH:mm",LLLL:"dddd\u060c YYYY-\u064a\u0649\u0644\u0649M-\u0626\u0627\u064a\u0646\u0649\u06adD-\u0643\u06c8\u0646\u0649\u060c HH:mm"},meridiemParse:/\u064a\u06d0\u0631\u0649\u0645 \u0643\u06d0\u0686\u06d5|\u0633\u06d5\u06be\u06d5\u0631|\u0686\u06c8\u0634\u062a\u0649\u0646 \u0628\u06c7\u0631\u06c7\u0646|\u0686\u06c8\u0634|\u0686\u06c8\u0634\u062a\u0649\u0646 \u0643\u06d0\u064a\u0649\u0646|\u0643\u06d5\u0686/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u064a\u06d0\u0631\u0649\u0645 \u0643\u06d0\u0686\u06d5"===e||"\u0633\u06d5\u06be\u06d5\u0631"===e||"\u0686\u06c8\u0634\u062a\u0649\u0646 \u0628\u06c7\u0631\u06c7\u0646"===e?t:"\u0686\u06c8\u0634\u062a\u0649\u0646 \u0643\u06d0\u064a\u0649\u0646"===e||"\u0643\u06d5\u0686"===e?t+12:t>=11?t:t+12},meridiem:function(t,e,n){var r=100*t+e;return r<600?"\u064a\u06d0\u0631\u0649\u0645 \u0643\u06d0\u0686\u06d5":r<900?"\u0633\u06d5\u06be\u06d5\u0631":r<1130?"\u0686\u06c8\u0634\u062a\u0649\u0646 \u0628\u06c7\u0631\u06c7\u0646":r<1230?"\u0686\u06c8\u0634":r<1800?"\u0686\u06c8\u0634\u062a\u0649\u0646 \u0643\u06d0\u064a\u0649\u0646":"\u0643\u06d5\u0686"},calendar:{sameDay:"[\u0628\u06c8\u06af\u06c8\u0646 \u0633\u0627\u0626\u06d5\u062a] LT",nextDay:"[\u0626\u06d5\u062a\u06d5 \u0633\u0627\u0626\u06d5\u062a] LT",nextWeek:"[\u0643\u06d0\u0644\u06d5\u0631\u0643\u0649] dddd [\u0633\u0627\u0626\u06d5\u062a] LT",lastDay:"[\u062a\u06c6\u0646\u06c8\u06af\u06c8\u0646] LT",lastWeek:"[\u0626\u0627\u0644\u062f\u0649\u0646\u0642\u0649] dddd [\u0633\u0627\u0626\u06d5\u062a] LT",sameElse:"L"},relativeTime:{future:"%s \u0643\u06d0\u064a\u0649\u0646",past:"%s \u0628\u06c7\u0631\u06c7\u0646",s:"\u0646\u06d5\u0686\u0686\u06d5 \u0633\u06d0\u0643\u0648\u0646\u062a",ss:"%d \u0633\u06d0\u0643\u0648\u0646\u062a",m:"\u0628\u0649\u0631 \u0645\u0649\u0646\u06c7\u062a",mm:"%d \u0645\u0649\u0646\u06c7\u062a",h:"\u0628\u0649\u0631 \u0633\u0627\u0626\u06d5\u062a",hh:"%d \u0633\u0627\u0626\u06d5\u062a",d:"\u0628\u0649\u0631 \u0643\u06c8\u0646",dd:"%d \u0643\u06c8\u0646",M:"\u0628\u0649\u0631 \u0626\u0627\u064a",MM:"%d \u0626\u0627\u064a",y:"\u0628\u0649\u0631 \u064a\u0649\u0644",yy:"%d \u064a\u0649\u0644"},dayOfMonthOrdinalParse:/\d{1,2}(-\u0643\u06c8\u0646\u0649|-\u0626\u0627\u064a|-\u06be\u06d5\u067e\u062a\u06d5)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"-\u0643\u06c8\u0646\u0649";case"w":case"W":return t+"-\u06be\u06d5\u067e\u062a\u06d5";default:return t}},preparse:function(t){return t.replace(/\u060c/g,",")},postformat:function(t){return t.replace(/,/g,"\u060c")},week:{dow:1,doy:7}})}(n(30381))},67691:function(t,e,n){!function(t){"use strict";function e(t,e){var n=t.split("_");return e%10==1&&e%100!=11?n[0]:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?n[1]:n[2]}function n(t,n,r){return"m"===r?n?"\u0445\u0432\u0438\u043b\u0438\u043d\u0430":"\u0445\u0432\u0438\u043b\u0438\u043d\u0443":"h"===r?n?"\u0433\u043e\u0434\u0438\u043d\u0430":"\u0433\u043e\u0434\u0438\u043d\u0443":t+" "+e({ss:n?"\u0441\u0435\u043a\u0443\u043d\u0434\u0430_\u0441\u0435\u043a\u0443\u043d\u0434\u0438_\u0441\u0435\u043a\u0443\u043d\u0434":"\u0441\u0435\u043a\u0443\u043d\u0434\u0443_\u0441\u0435\u043a\u0443\u043d\u0434\u0438_\u0441\u0435\u043a\u0443\u043d\u0434",mm:n?"\u0445\u0432\u0438\u043b\u0438\u043d\u0430_\u0445\u0432\u0438\u043b\u0438\u043d\u0438_\u0445\u0432\u0438\u043b\u0438\u043d":"\u0445\u0432\u0438\u043b\u0438\u043d\u0443_\u0445\u0432\u0438\u043b\u0438\u043d\u0438_\u0445\u0432\u0438\u043b\u0438\u043d",hh:n?"\u0433\u043e\u0434\u0438\u043d\u0430_\u0433\u043e\u0434\u0438\u043d\u0438_\u0433\u043e\u0434\u0438\u043d":"\u0433\u043e\u0434\u0438\u043d\u0443_\u0433\u043e\u0434\u0438\u043d\u0438_\u0433\u043e\u0434\u0438\u043d",dd:"\u0434\u0435\u043d\u044c_\u0434\u043d\u0456_\u0434\u043d\u0456\u0432",MM:"\u043c\u0456\u0441\u044f\u0446\u044c_\u043c\u0456\u0441\u044f\u0446\u0456_\u043c\u0456\u0441\u044f\u0446\u0456\u0432",yy:"\u0440\u0456\u043a_\u0440\u043e\u043a\u0438_\u0440\u043e\u043a\u0456\u0432"}[r],+t)}function r(t,e){var n={nominative:"\u043d\u0435\u0434\u0456\u043b\u044f_\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a_\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a_\u0441\u0435\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0435\u0440_\u043f\u2019\u044f\u0442\u043d\u0438\u0446\u044f_\u0441\u0443\u0431\u043e\u0442\u0430".split("_"),accusative:"\u043d\u0435\u0434\u0456\u043b\u044e_\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a_\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a_\u0441\u0435\u0440\u0435\u0434\u0443_\u0447\u0435\u0442\u0432\u0435\u0440_\u043f\u2019\u044f\u0442\u043d\u0438\u0446\u044e_\u0441\u0443\u0431\u043e\u0442\u0443".split("_"),genitive:"\u043d\u0435\u0434\u0456\u043b\u0456_\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043a\u0430_\u0432\u0456\u0432\u0442\u043e\u0440\u043a\u0430_\u0441\u0435\u0440\u0435\u0434\u0438_\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430_\u043f\u2019\u044f\u0442\u043d\u0438\u0446\u0456_\u0441\u0443\u0431\u043e\u0442\u0438".split("_")};return!0===t?n.nominative.slice(1,7).concat(n.nominative.slice(0,1)):t?n[/(\[[\u0412\u0432\u0423\u0443]\]) ?dddd/.test(e)?"accusative":/\[?(?:\u043c\u0438\u043d\u0443\u043b\u043e\u0457|\u043d\u0430\u0441\u0442\u0443\u043f\u043d\u043e\u0457)? ?\] ?dddd/.test(e)?"genitive":"nominative"][t.day()]:n.nominative}function i(t){return function(){return t+"\u043e"+(11===this.hours()?"\u0431":"")+"] LT"}}t.defineLocale("uk",{months:{format:"\u0441\u0456\u0447\u043d\u044f_\u043b\u044e\u0442\u043e\u0433\u043e_\u0431\u0435\u0440\u0435\u0437\u043d\u044f_\u043a\u0432\u0456\u0442\u043d\u044f_\u0442\u0440\u0430\u0432\u043d\u044f_\u0447\u0435\u0440\u0432\u043d\u044f_\u043b\u0438\u043f\u043d\u044f_\u0441\u0435\u0440\u043f\u043d\u044f_\u0432\u0435\u0440\u0435\u0441\u043d\u044f_\u0436\u043e\u0432\u0442\u043d\u044f_\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434\u0430_\u0433\u0440\u0443\u0434\u043d\u044f".split("_"),standalone:"\u0441\u0456\u0447\u0435\u043d\u044c_\u043b\u044e\u0442\u0438\u0439_\u0431\u0435\u0440\u0435\u0437\u0435\u043d\u044c_\u043a\u0432\u0456\u0442\u0435\u043d\u044c_\u0442\u0440\u0430\u0432\u0435\u043d\u044c_\u0447\u0435\u0440\u0432\u0435\u043d\u044c_\u043b\u0438\u043f\u0435\u043d\u044c_\u0441\u0435\u0440\u043f\u0435\u043d\u044c_\u0432\u0435\u0440\u0435\u0441\u0435\u043d\u044c_\u0436\u043e\u0432\u0442\u0435\u043d\u044c_\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434_\u0433\u0440\u0443\u0434\u0435\u043d\u044c".split("_")},monthsShort:"\u0441\u0456\u0447_\u043b\u044e\u0442_\u0431\u0435\u0440_\u043a\u0432\u0456\u0442_\u0442\u0440\u0430\u0432_\u0447\u0435\u0440\u0432_\u043b\u0438\u043f_\u0441\u0435\u0440\u043f_\u0432\u0435\u0440_\u0436\u043e\u0432\u0442_\u043b\u0438\u0441\u0442_\u0433\u0440\u0443\u0434".split("_"),weekdays:r,weekdaysShort:"\u043d\u0434_\u043f\u043d_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043f\u0442_\u0441\u0431".split("_"),weekdaysMin:"\u043d\u0434_\u043f\u043d_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043f\u0442_\u0441\u0431".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY \u0440.",LLL:"D MMMM YYYY \u0440., HH:mm",LLLL:"dddd, D MMMM YYYY \u0440., HH:mm"},calendar:{sameDay:i("[\u0421\u044c\u043e\u0433\u043e\u0434\u043d\u0456 "),nextDay:i("[\u0417\u0430\u0432\u0442\u0440\u0430 "),lastDay:i("[\u0412\u0447\u043e\u0440\u0430 "),nextWeek:i("[\u0423] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return i("[\u041c\u0438\u043d\u0443\u043b\u043e\u0457] dddd [").call(this);case 1:case 2:case 4:return i("[\u041c\u0438\u043d\u0443\u043b\u043e\u0433\u043e] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"\u0437\u0430 %s",past:"%s \u0442\u043e\u043c\u0443",s:"\u0434\u0435\u043a\u0456\u043b\u044c\u043a\u0430 \u0441\u0435\u043a\u0443\u043d\u0434",ss:n,m:n,mm:n,h:"\u0433\u043e\u0434\u0438\u043d\u0443",hh:n,d:"\u0434\u0435\u043d\u044c",dd:n,M:"\u043c\u0456\u0441\u044f\u0446\u044c",MM:n,y:"\u0440\u0456\u043a",yy:n},meridiemParse:/\u043d\u043e\u0447\u0456|\u0440\u0430\u043d\u043a\u0443|\u0434\u043d\u044f|\u0432\u0435\u0447\u043e\u0440\u0430/,isPM:function(t){return/^(\u0434\u043d\u044f|\u0432\u0435\u0447\u043e\u0440\u0430)$/.test(t)},meridiem:function(t,e,n){return t<4?"\u043d\u043e\u0447\u0456":t<12?"\u0440\u0430\u043d\u043a\u0443":t<17?"\u0434\u043d\u044f":"\u0432\u0435\u0447\u043e\u0440\u0430"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0439|\u0433\u043e)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t+"-\u0439";case"D":return t+"-\u0433\u043e";default:return t}},week:{dow:1,doy:7}})}(n(30381))},13795:function(t,e,n){!function(t){"use strict";var e=["\u062c\u0646\u0648\u0631\u06cc","\u0641\u0631\u0648\u0631\u06cc","\u0645\u0627\u0631\u0686","\u0627\u067e\u0631\u06cc\u0644","\u0645\u0626\u06cc","\u062c\u0648\u0646","\u062c\u0648\u0644\u0627\u0626\u06cc","\u0627\u06af\u0633\u062a","\u0633\u062a\u0645\u0628\u0631","\u0627\u06a9\u062a\u0648\u0628\u0631","\u0646\u0648\u0645\u0628\u0631","\u062f\u0633\u0645\u0628\u0631"],n=["\u0627\u062a\u0648\u0627\u0631","\u067e\u06cc\u0631","\u0645\u0646\u06af\u0644","\u0628\u062f\u06be","\u062c\u0645\u0639\u0631\u0627\u062a","\u062c\u0645\u0639\u06c1","\u06c1\u0641\u062a\u06c1"];t.defineLocale("ur",{months:e,monthsShort:e,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd\u060c D MMMM YYYY HH:mm"},meridiemParse:/\u0635\u0628\u062d|\u0634\u0627\u0645/,isPM:function(t){return"\u0634\u0627\u0645"===t},meridiem:function(t,e,n){return t<12?"\u0635\u0628\u062d":"\u0634\u0627\u0645"},calendar:{sameDay:"[\u0622\u062c \u0628\u0648\u0642\u062a] LT",nextDay:"[\u06a9\u0644 \u0628\u0648\u0642\u062a] LT",nextWeek:"dddd [\u0628\u0648\u0642\u062a] LT",lastDay:"[\u06af\u0630\u0634\u062a\u06c1 \u0631\u0648\u0632 \u0628\u0648\u0642\u062a] LT",lastWeek:"[\u06af\u0630\u0634\u062a\u06c1] dddd [\u0628\u0648\u0642\u062a] LT",sameElse:"L"},relativeTime:{future:"%s \u0628\u0639\u062f",past:"%s \u0642\u0628\u0644",s:"\u0686\u0646\u062f \u0633\u06cc\u06a9\u0646\u0688",ss:"%d \u0633\u06cc\u06a9\u0646\u0688",m:"\u0627\u06cc\u06a9 \u0645\u0646\u0679",mm:"%d \u0645\u0646\u0679",h:"\u0627\u06cc\u06a9 \u06af\u06be\u0646\u0679\u06c1",hh:"%d \u06af\u06be\u0646\u0679\u06d2",d:"\u0627\u06cc\u06a9 \u062f\u0646",dd:"%d \u062f\u0646",M:"\u0627\u06cc\u06a9 \u0645\u0627\u06c1",MM:"%d \u0645\u0627\u06c1",y:"\u0627\u06cc\u06a9 \u0633\u0627\u0644",yy:"%d \u0633\u0627\u0644"},preparse:function(t){return t.replace(/\u060c/g,",")},postformat:function(t){return t.replace(/,/g,"\u060c")},week:{dow:1,doy:4}})}(n(30381))},60588:function(t,e,n){!function(t){"use strict";t.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}})}(n(30381))},6791:function(t,e,n){!function(t){"use strict";t.defineLocale("uz",{months:"\u044f\u043d\u0432\u0430\u0440_\u0444\u0435\u0432\u0440\u0430\u043b_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0435\u043b_\u043c\u0430\u0439_\u0438\u044e\u043d_\u0438\u044e\u043b_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043d\u0442\u044f\u0431\u0440_\u043e\u043a\u0442\u044f\u0431\u0440_\u043d\u043e\u044f\u0431\u0440_\u0434\u0435\u043a\u0430\u0431\u0440".split("_"),monthsShort:"\u044f\u043d\u0432_\u0444\u0435\u0432_\u043c\u0430\u0440_\u0430\u043f\u0440_\u043c\u0430\u0439_\u0438\u044e\u043d_\u0438\u044e\u043b_\u0430\u0432\u0433_\u0441\u0435\u043d_\u043e\u043a\u0442_\u043d\u043e\u044f_\u0434\u0435\u043a".split("_"),weekdays:"\u042f\u043a\u0448\u0430\u043d\u0431\u0430_\u0414\u0443\u0448\u0430\u043d\u0431\u0430_\u0421\u0435\u0448\u0430\u043d\u0431\u0430_\u0427\u043e\u0440\u0448\u0430\u043d\u0431\u0430_\u041f\u0430\u0439\u0448\u0430\u043d\u0431\u0430_\u0416\u0443\u043c\u0430_\u0428\u0430\u043d\u0431\u0430".split("_"),weekdaysShort:"\u042f\u043a\u0448_\u0414\u0443\u0448_\u0421\u0435\u0448_\u0427\u043e\u0440_\u041f\u0430\u0439_\u0416\u0443\u043c_\u0428\u0430\u043d".split("_"),weekdaysMin:"\u042f\u043a_\u0414\u0443_\u0421\u0435_\u0427\u043e_\u041f\u0430_\u0416\u0443_\u0428\u0430".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[\u0411\u0443\u0433\u0443\u043d \u0441\u043e\u0430\u0442] LT [\u0434\u0430]",nextDay:"[\u042d\u0440\u0442\u0430\u0433\u0430] LT [\u0434\u0430]",nextWeek:"dddd [\u043a\u0443\u043d\u0438 \u0441\u043e\u0430\u0442] LT [\u0434\u0430]",lastDay:"[\u041a\u0435\u0447\u0430 \u0441\u043e\u0430\u0442] LT [\u0434\u0430]",lastWeek:"[\u0423\u0442\u0433\u0430\u043d] dddd [\u043a\u0443\u043d\u0438 \u0441\u043e\u0430\u0442] LT [\u0434\u0430]",sameElse:"L"},relativeTime:{future:"\u042f\u043a\u0438\u043d %s \u0438\u0447\u0438\u0434\u0430",past:"\u0411\u0438\u0440 \u043d\u0435\u0447\u0430 %s \u043e\u043b\u0434\u0438\u043d",s:"\u0444\u0443\u0440\u0441\u0430\u0442",ss:"%d \u0444\u0443\u0440\u0441\u0430\u0442",m:"\u0431\u0438\u0440 \u0434\u0430\u043a\u0438\u043a\u0430",mm:"%d \u0434\u0430\u043a\u0438\u043a\u0430",h:"\u0431\u0438\u0440 \u0441\u043e\u0430\u0442",hh:"%d \u0441\u043e\u0430\u0442",d:"\u0431\u0438\u0440 \u043a\u0443\u043d",dd:"%d \u043a\u0443\u043d",M:"\u0431\u0438\u0440 \u043e\u0439",MM:"%d \u043e\u0439",y:"\u0431\u0438\u0440 \u0439\u0438\u043b",yy:"%d \u0439\u0438\u043b"},week:{dow:1,doy:7}})}(n(30381))},65666:function(t,e,n){!function(t){"use strict";t.defineLocale("vi",{months:"th\xe1ng 1_th\xe1ng 2_th\xe1ng 3_th\xe1ng 4_th\xe1ng 5_th\xe1ng 6_th\xe1ng 7_th\xe1ng 8_th\xe1ng 9_th\xe1ng 10_th\xe1ng 11_th\xe1ng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"ch\u1ee7 nh\u1eadt_th\u1ee9 hai_th\u1ee9 ba_th\u1ee9 t\u01b0_th\u1ee9 n\u0103m_th\u1ee9 s\xe1u_th\u1ee9 b\u1ea3y".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(t){return/^ch$/i.test(t)},meridiem:function(t,e,n){return t<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [n\u0103m] YYYY",LLL:"D MMMM [n\u0103m] YYYY HH:mm",LLLL:"dddd, D MMMM [n\u0103m] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[H\xf4m nay l\xfac] LT",nextDay:"[Ng\xe0y mai l\xfac] LT",nextWeek:"dddd [tu\u1ea7n t\u1edbi l\xfac] LT",lastDay:"[H\xf4m qua l\xfac] LT",lastWeek:"dddd [tu\u1ea7n tr\u01b0\u1edbc l\xfac] LT",sameElse:"L"},relativeTime:{future:"%s t\u1edbi",past:"%s tr\u01b0\u1edbc",s:"v\xe0i gi\xe2y",ss:"%d gi\xe2y",m:"m\u1ed9t ph\xfat",mm:"%d ph\xfat",h:"m\u1ed9t gi\u1edd",hh:"%d gi\u1edd",d:"m\u1ed9t ng\xe0y",dd:"%d ng\xe0y",w:"m\u1ed9t tu\u1ea7n",ww:"%d tu\u1ea7n",M:"m\u1ed9t th\xe1ng",MM:"%d th\xe1ng",y:"m\u1ed9t n\u0103m",yy:"%d n\u0103m"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(t){return t},week:{dow:1,doy:4}})}(n(30381))},14378:function(t,e,n){!function(t){"use strict";t.defineLocale("x-pseudo",{months:"J~\xe1\xf1\xfa\xe1~r\xfd_F~\xe9br\xfa~\xe1r\xfd_~M\xe1rc~h_\xc1p~r\xedl_~M\xe1\xfd_~J\xfa\xf1\xe9~_J\xfal~\xfd_\xc1\xfa~g\xfast~_S\xe9p~t\xe9mb~\xe9r_\xd3~ct\xf3b~\xe9r_\xd1~\xf3v\xe9m~b\xe9r_~D\xe9c\xe9~mb\xe9r".split("_"),monthsShort:"J~\xe1\xf1_~F\xe9b_~M\xe1r_~\xc1pr_~M\xe1\xfd_~J\xfa\xf1_~J\xfal_~\xc1\xfag_~S\xe9p_~\xd3ct_~\xd1\xf3v_~D\xe9c".split("_"),monthsParseExact:!0,weekdays:"S~\xfa\xf1d\xe1~\xfd_M\xf3~\xf1d\xe1\xfd~_T\xfa\xe9~sd\xe1\xfd~_W\xe9d~\xf1\xe9sd~\xe1\xfd_T~h\xfars~d\xe1\xfd_~Fr\xedd~\xe1\xfd_S~\xe1t\xfar~d\xe1\xfd".split("_"),weekdaysShort:"S~\xfa\xf1_~M\xf3\xf1_~T\xfa\xe9_~W\xe9d_~Th\xfa_~Fr\xed_~S\xe1t".split("_"),weekdaysMin:"S~\xfa_M\xf3~_T\xfa_~W\xe9_T~h_Fr~_S\xe1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~\xf3d\xe1~\xfd \xe1t] LT",nextDay:"[T~\xf3m\xf3~rr\xf3~w \xe1t] LT",nextWeek:"dddd [\xe1t] LT",lastDay:"[\xdd~\xe9st~\xe9rd\xe1~\xfd \xe1t] LT",lastWeek:"[L~\xe1st] dddd [\xe1t] LT",sameElse:"L"},relativeTime:{future:"\xed~\xf1 %s",past:"%s \xe1~g\xf3",s:"\xe1 ~f\xe9w ~s\xe9c\xf3~\xf1ds",ss:"%d s~\xe9c\xf3\xf1~ds",m:"\xe1 ~m\xed\xf1~\xfat\xe9",mm:"%d m~\xed\xf1\xfa~t\xe9s",h:"\xe1~\xf1 h\xf3~\xfar",hh:"%d h~\xf3\xfars",d:"\xe1 ~d\xe1\xfd",dd:"%d d~\xe1\xfds",M:"\xe1 ~m\xf3\xf1~th",MM:"%d m~\xf3\xf1t~hs",y:"\xe1 ~\xfd\xe9\xe1r",yy:"%d \xfd~\xe9\xe1rs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")},week:{dow:1,doy:4}})}(n(30381))},75805:function(t,e,n){!function(t){"use strict";t.defineLocale("yo",{months:"S\u1eb9\u0301r\u1eb9\u0301_E\u0300re\u0300le\u0300_\u1eb8r\u1eb9\u0300na\u0300_I\u0300gbe\u0301_E\u0300bibi_O\u0300ku\u0300du_Ag\u1eb9mo_O\u0300gu\u0301n_Owewe_\u1ecc\u0300wa\u0300ra\u0300_Be\u0301lu\u0301_\u1ecc\u0300p\u1eb9\u0300\u0300".split("_"),monthsShort:"S\u1eb9\u0301r_E\u0300rl_\u1eb8rn_I\u0300gb_E\u0300bi_O\u0300ku\u0300_Ag\u1eb9_O\u0300gu\u0301_Owe_\u1ecc\u0300wa\u0300_Be\u0301l_\u1ecc\u0300p\u1eb9\u0300\u0300".split("_"),weekdays:"A\u0300i\u0300ku\u0301_Aje\u0301_I\u0300s\u1eb9\u0301gun_\u1eccj\u1ecd\u0301ru\u0301_\u1eccj\u1ecd\u0301b\u1ecd_\u1eb8ti\u0300_A\u0300ba\u0301m\u1eb9\u0301ta".split("_"),weekdaysShort:"A\u0300i\u0300k_Aje\u0301_I\u0300s\u1eb9\u0301_\u1eccjr_\u1eccjb_\u1eb8ti\u0300_A\u0300ba\u0301".split("_"),weekdaysMin:"A\u0300i\u0300_Aj_I\u0300s_\u1eccr_\u1eccb_\u1eb8t_A\u0300b".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[O\u0300ni\u0300 ni] LT",nextDay:"[\u1ecc\u0300la ni] LT",nextWeek:"dddd [\u1eccs\u1eb9\u0300 to\u0301n'b\u1ecd] [ni] LT",lastDay:"[A\u0300na ni] LT",lastWeek:"dddd [\u1eccs\u1eb9\u0300 to\u0301l\u1ecd\u0301] [ni] LT",sameElse:"L"},relativeTime:{future:"ni\u0301 %s",past:"%s k\u1ecdja\u0301",s:"i\u0300s\u1eb9ju\u0301 aaya\u0301 die",ss:"aaya\u0301 %d",m:"i\u0300s\u1eb9ju\u0301 kan",mm:"i\u0300s\u1eb9ju\u0301 %d",h:"wa\u0301kati kan",hh:"wa\u0301kati %d",d:"\u1ecdj\u1ecd\u0301 kan",dd:"\u1ecdj\u1ecd\u0301 %d",M:"osu\u0300 kan",MM:"osu\u0300 %d",y:"\u1ecddu\u0301n kan",yy:"\u1ecddu\u0301n %d"},dayOfMonthOrdinalParse:/\u1ecdj\u1ecd\u0301\s\d{1,2}/,ordinal:"\u1ecdj\u1ecd\u0301 %d",week:{dow:1,doy:4}})}(n(30381))},83839:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-cn",{months:"\u4e00\u6708_\u4e8c\u6708_\u4e09\u6708_\u56db\u6708_\u4e94\u6708_\u516d\u6708_\u4e03\u6708_\u516b\u6708_\u4e5d\u6708_\u5341\u6708_\u5341\u4e00\u6708_\u5341\u4e8c\u6708".split("_"),monthsShort:"1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),weekdays:"\u661f\u671f\u65e5_\u661f\u671f\u4e00_\u661f\u671f\u4e8c_\u661f\u671f\u4e09_\u661f\u671f\u56db_\u661f\u671f\u4e94_\u661f\u671f\u516d".split("_"),weekdaysShort:"\u5468\u65e5_\u5468\u4e00_\u5468\u4e8c_\u5468\u4e09_\u5468\u56db_\u5468\u4e94_\u5468\u516d".split("_"),weekdaysMin:"\u65e5_\u4e00_\u4e8c_\u4e09_\u56db_\u4e94_\u516d".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY\u5e74M\u6708D\u65e5",LLL:"YYYY\u5e74M\u6708D\u65e5Ah\u70b9mm\u5206",LLLL:"YYYY\u5e74M\u6708D\u65e5ddddAh\u70b9mm\u5206",l:"YYYY/M/D",ll:"YYYY\u5e74M\u6708D\u65e5",lll:"YYYY\u5e74M\u6708D\u65e5 HH:mm",llll:"YYYY\u5e74M\u6708D\u65e5dddd HH:mm"},meridiemParse:/\u51cc\u6668|\u65e9\u4e0a|\u4e0a\u5348|\u4e2d\u5348|\u4e0b\u5348|\u665a\u4e0a/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u51cc\u6668"===e||"\u65e9\u4e0a"===e||"\u4e0a\u5348"===e?t:"\u4e0b\u5348"===e||"\u665a\u4e0a"===e?t+12:t>=11?t:t+12},meridiem:function(t,e,n){var r=100*t+e;return r<600?"\u51cc\u6668":r<900?"\u65e9\u4e0a":r<1130?"\u4e0a\u5348":r<1230?"\u4e2d\u5348":r<1800?"\u4e0b\u5348":"\u665a\u4e0a"},calendar:{sameDay:"[\u4eca\u5929]LT",nextDay:"[\u660e\u5929]LT",nextWeek:function(t){return t.week()!==this.week()?"[\u4e0b]dddLT":"[\u672c]dddLT"},lastDay:"[\u6628\u5929]LT",lastWeek:function(t){return this.week()!==t.week()?"[\u4e0a]dddLT":"[\u672c]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(\u65e5|\u6708|\u5468)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"\u65e5";case"M":return t+"\u6708";case"w":case"W":return t+"\u5468";default:return t}},relativeTime:{future:"%s\u540e",past:"%s\u524d",s:"\u51e0\u79d2",ss:"%d \u79d2",m:"1 \u5206\u949f",mm:"%d \u5206\u949f",h:"1 \u5c0f\u65f6",hh:"%d \u5c0f\u65f6",d:"1 \u5929",dd:"%d \u5929",w:"1 \u5468",ww:"%d \u5468",M:"1 \u4e2a\u6708",MM:"%d \u4e2a\u6708",y:"1 \u5e74",yy:"%d \u5e74"},week:{dow:1,doy:4}})}(n(30381))},55726:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-hk",{months:"\u4e00\u6708_\u4e8c\u6708_\u4e09\u6708_\u56db\u6708_\u4e94\u6708_\u516d\u6708_\u4e03\u6708_\u516b\u6708_\u4e5d\u6708_\u5341\u6708_\u5341\u4e00\u6708_\u5341\u4e8c\u6708".split("_"),monthsShort:"1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),weekdays:"\u661f\u671f\u65e5_\u661f\u671f\u4e00_\u661f\u671f\u4e8c_\u661f\u671f\u4e09_\u661f\u671f\u56db_\u661f\u671f\u4e94_\u661f\u671f\u516d".split("_"),weekdaysShort:"\u9031\u65e5_\u9031\u4e00_\u9031\u4e8c_\u9031\u4e09_\u9031\u56db_\u9031\u4e94_\u9031\u516d".split("_"),weekdaysMin:"\u65e5_\u4e00_\u4e8c_\u4e09_\u56db_\u4e94_\u516d".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY\u5e74M\u6708D\u65e5",LLL:"YYYY\u5e74M\u6708D\u65e5 HH:mm",LLLL:"YYYY\u5e74M\u6708D\u65e5dddd HH:mm",l:"YYYY/M/D",ll:"YYYY\u5e74M\u6708D\u65e5",lll:"YYYY\u5e74M\u6708D\u65e5 HH:mm",llll:"YYYY\u5e74M\u6708D\u65e5dddd HH:mm"},meridiemParse:/\u51cc\u6668|\u65e9\u4e0a|\u4e0a\u5348|\u4e2d\u5348|\u4e0b\u5348|\u665a\u4e0a/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u51cc\u6668"===e||"\u65e9\u4e0a"===e||"\u4e0a\u5348"===e?t:"\u4e2d\u5348"===e?t>=11?t:t+12:"\u4e0b\u5348"===e||"\u665a\u4e0a"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"\u51cc\u6668":r<900?"\u65e9\u4e0a":r<1200?"\u4e0a\u5348":1200===r?"\u4e2d\u5348":r<1800?"\u4e0b\u5348":"\u665a\u4e0a"},calendar:{sameDay:"[\u4eca\u5929]LT",nextDay:"[\u660e\u5929]LT",nextWeek:"[\u4e0b]ddddLT",lastDay:"[\u6628\u5929]LT",lastWeek:"[\u4e0a]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(\u65e5|\u6708|\u9031)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"\u65e5";case"M":return t+"\u6708";case"w":case"W":return t+"\u9031";default:return t}},relativeTime:{future:"%s\u5f8c",past:"%s\u524d",s:"\u5e7e\u79d2",ss:"%d \u79d2",m:"1 \u5206\u9418",mm:"%d \u5206\u9418",h:"1 \u5c0f\u6642",hh:"%d \u5c0f\u6642",d:"1 \u5929",dd:"%d \u5929",M:"1 \u500b\u6708",MM:"%d \u500b\u6708",y:"1 \u5e74",yy:"%d \u5e74"}})}(n(30381))},99807:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-mo",{months:"\u4e00\u6708_\u4e8c\u6708_\u4e09\u6708_\u56db\u6708_\u4e94\u6708_\u516d\u6708_\u4e03\u6708_\u516b\u6708_\u4e5d\u6708_\u5341\u6708_\u5341\u4e00\u6708_\u5341\u4e8c\u6708".split("_"),monthsShort:"1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),weekdays:"\u661f\u671f\u65e5_\u661f\u671f\u4e00_\u661f\u671f\u4e8c_\u661f\u671f\u4e09_\u661f\u671f\u56db_\u661f\u671f\u4e94_\u661f\u671f\u516d".split("_"),weekdaysShort:"\u9031\u65e5_\u9031\u4e00_\u9031\u4e8c_\u9031\u4e09_\u9031\u56db_\u9031\u4e94_\u9031\u516d".split("_"),weekdaysMin:"\u65e5_\u4e00_\u4e8c_\u4e09_\u56db_\u4e94_\u516d".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY\u5e74M\u6708D\u65e5",LLL:"YYYY\u5e74M\u6708D\u65e5 HH:mm",LLLL:"YYYY\u5e74M\u6708D\u65e5dddd HH:mm",l:"D/M/YYYY",ll:"YYYY\u5e74M\u6708D\u65e5",lll:"YYYY\u5e74M\u6708D\u65e5 HH:mm",llll:"YYYY\u5e74M\u6708D\u65e5dddd HH:mm"},meridiemParse:/\u51cc\u6668|\u65e9\u4e0a|\u4e0a\u5348|\u4e2d\u5348|\u4e0b\u5348|\u665a\u4e0a/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u51cc\u6668"===e||"\u65e9\u4e0a"===e||"\u4e0a\u5348"===e?t:"\u4e2d\u5348"===e?t>=11?t:t+12:"\u4e0b\u5348"===e||"\u665a\u4e0a"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"\u51cc\u6668":r<900?"\u65e9\u4e0a":r<1130?"\u4e0a\u5348":r<1230?"\u4e2d\u5348":r<1800?"\u4e0b\u5348":"\u665a\u4e0a"},calendar:{sameDay:"[\u4eca\u5929] LT",nextDay:"[\u660e\u5929] LT",nextWeek:"[\u4e0b]dddd LT",lastDay:"[\u6628\u5929] LT",lastWeek:"[\u4e0a]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(\u65e5|\u6708|\u9031)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"\u65e5";case"M":return t+"\u6708";case"w":case"W":return t+"\u9031";default:return t}},relativeTime:{future:"%s\u5167",past:"%s\u524d",s:"\u5e7e\u79d2",ss:"%d \u79d2",m:"1 \u5206\u9418",mm:"%d \u5206\u9418",h:"1 \u5c0f\u6642",hh:"%d \u5c0f\u6642",d:"1 \u5929",dd:"%d \u5929",M:"1 \u500b\u6708",MM:"%d \u500b\u6708",y:"1 \u5e74",yy:"%d \u5e74"}})}(n(30381))},74152:function(t,e,n){!function(t){"use strict";t.defineLocale("zh-tw",{months:"\u4e00\u6708_\u4e8c\u6708_\u4e09\u6708_\u56db\u6708_\u4e94\u6708_\u516d\u6708_\u4e03\u6708_\u516b\u6708_\u4e5d\u6708_\u5341\u6708_\u5341\u4e00\u6708_\u5341\u4e8c\u6708".split("_"),monthsShort:"1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),weekdays:"\u661f\u671f\u65e5_\u661f\u671f\u4e00_\u661f\u671f\u4e8c_\u661f\u671f\u4e09_\u661f\u671f\u56db_\u661f\u671f\u4e94_\u661f\u671f\u516d".split("_"),weekdaysShort:"\u9031\u65e5_\u9031\u4e00_\u9031\u4e8c_\u9031\u4e09_\u9031\u56db_\u9031\u4e94_\u9031\u516d".split("_"),weekdaysMin:"\u65e5_\u4e00_\u4e8c_\u4e09_\u56db_\u4e94_\u516d".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY\u5e74M\u6708D\u65e5",LLL:"YYYY\u5e74M\u6708D\u65e5 HH:mm",LLLL:"YYYY\u5e74M\u6708D\u65e5dddd HH:mm",l:"YYYY/M/D",ll:"YYYY\u5e74M\u6708D\u65e5",lll:"YYYY\u5e74M\u6708D\u65e5 HH:mm",llll:"YYYY\u5e74M\u6708D\u65e5dddd HH:mm"},meridiemParse:/\u51cc\u6668|\u65e9\u4e0a|\u4e0a\u5348|\u4e2d\u5348|\u4e0b\u5348|\u665a\u4e0a/,meridiemHour:function(t,e){return 12===t&&(t=0),"\u51cc\u6668"===e||"\u65e9\u4e0a"===e||"\u4e0a\u5348"===e?t:"\u4e2d\u5348"===e?t>=11?t:t+12:"\u4e0b\u5348"===e||"\u665a\u4e0a"===e?t+12:void 0},meridiem:function(t,e,n){var r=100*t+e;return r<600?"\u51cc\u6668":r<900?"\u65e9\u4e0a":r<1130?"\u4e0a\u5348":r<1230?"\u4e2d\u5348":r<1800?"\u4e0b\u5348":"\u665a\u4e0a"},calendar:{sameDay:"[\u4eca\u5929] LT",nextDay:"[\u660e\u5929] LT",nextWeek:"[\u4e0b]dddd LT",lastDay:"[\u6628\u5929] LT",lastWeek:"[\u4e0a]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(\u65e5|\u6708|\u9031)/,ordinal:function(t,e){switch(e){case"d":case"D":case"DDD":return t+"\u65e5";case"M":return t+"\u6708";case"w":case"W":return t+"\u9031";default:return t}},relativeTime:{future:"%s\u5f8c",past:"%s\u524d",s:"\u5e7e\u79d2",ss:"%d \u79d2",m:"1 \u5206\u9418",mm:"%d \u5206\u9418",h:"1 \u5c0f\u6642",hh:"%d \u5c0f\u6642",d:"1 \u5929",dd:"%d \u5929",M:"1 \u500b\u6708",MM:"%d \u500b\u6708",y:"1 \u5e74",yy:"%d \u5e74"}})}(n(30381))},30381:function(t,e,n){(t=n.nmd(t)).exports=function(){"use strict";var e,r;function i(){return e.apply(null,arguments)}function a(t){e=t}function s(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function o(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function l(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function c(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(l(t,e))return!1;return!0}function u(t){return void 0===t}function d(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function h(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function m(t,e){var n,r=[],i=t.length;for(n=0;n<i;++n)r.push(e(t[n],n));return r}function _(t,e){for(var n in e)l(e,n)&&(t[n]=e[n]);return l(e,"toString")&&(t.toString=e.toString),l(e,"valueOf")&&(t.valueOf=e.valueOf),t}function p(t,e,n,r){return Gn(t,e,n,r,!0).utc()}function f(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function y(t){return null==t._pf&&(t._pf=f()),t._pf}function g(t){if(null==t._isValid){var e=y(t),n=r.call(e.parsedDateParts,(function(t){return null!=t})),i=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidEra&&!e.invalidMonth&&!e.invalidWeekday&&!e.weekdayMismatch&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&n);if(t._strict&&(i=i&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour),null!=Object.isFrozen&&Object.isFrozen(t))return i;t._isValid=i}return t._isValid}function b(t){var e=p(NaN);return null!=t?_(y(e),t):y(e).userInvalidated=!0,e}r=Array.prototype.some?Array.prototype.some:function(t){var e,n=Object(this),r=n.length>>>0;for(e=0;e<r;e++)if(e in n&&t.call(this,n[e],e,n))return!0;return!1};var k=i.momentProperties=[],v=!1;function x(t,e){var n,r,i,a=k.length;if(u(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),u(e._i)||(t._i=e._i),u(e._f)||(t._f=e._f),u(e._l)||(t._l=e._l),u(e._strict)||(t._strict=e._strict),u(e._tzm)||(t._tzm=e._tzm),u(e._isUTC)||(t._isUTC=e._isUTC),u(e._offset)||(t._offset=e._offset),u(e._pf)||(t._pf=y(e)),u(e._locale)||(t._locale=e._locale),a>0)for(n=0;n<a;n++)u(i=e[r=k[n]])||(t[r]=i);return t}function M(t){x(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===v&&(v=!0,i.updateOffset(this),v=!1)}function L(t){return t instanceof M||null!=t&&null!=t._isAMomentObject}function w(t){!1===i.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function T(t,e){var n=!0;return _((function(){if(null!=i.deprecationHandler&&i.deprecationHandler(null,t),n){var r,a,s,o=[],c=arguments.length;for(a=0;a<c;a++){if(r="","object"==typeof arguments[a]){for(s in r+="\n["+a+"] ",arguments[0])l(arguments[0],s)&&(r+=s+": "+arguments[0][s]+", ");r=r.slice(0,-2)}else r=arguments[a];o.push(r)}w(t+"\nArguments: "+Array.prototype.slice.call(o).join("")+"\n"+(new Error).stack),n=!1}return e.apply(this,arguments)}),e)}var S,D={};function Y(t,e){null!=i.deprecationHandler&&i.deprecationHandler(t,e),D[t]||(w(e),D[t]=!0)}function E(t){return"undefined"!=typeof Function&&t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function C(t){var e,n;for(n in t)l(t,n)&&(E(e=t[n])?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function A(t,e){var n,r=_({},t);for(n in e)l(e,n)&&(o(t[n])&&o(e[n])?(r[n]={},_(r[n],t[n]),_(r[n],e[n])):null!=e[n]?r[n]=e[n]:delete r[n]);for(n in t)l(t,n)&&!l(e,n)&&o(t[n])&&(r[n]=_({},r[n]));return r}function O(t){null!=t&&this.set(t)}i.suppressDeprecationWarnings=!1,i.deprecationHandler=null,S=Object.keys?Object.keys:function(t){var e,n=[];for(e in t)l(t,e)&&n.push(e);return n};var N={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function B(t,e,n){var r=this._calendar[t]||this._calendar.sameElse;return E(r)?r.call(e,n):r}function F(t,e,n){var r=""+Math.abs(t),i=e-r.length;return(t>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var I=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,P=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,j={},R={};function H(t,e,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),t&&(R[t]=i),e&&(R[e[0]]=function(){return F(i.apply(this,arguments),e[1],e[2])}),n&&(R[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function $(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function Z(t){var e,n,r=t.match(I);for(e=0,n=r.length;e<n;e++)R[r[e]]?r[e]=R[r[e]]:r[e]=$(r[e]);return function(e){var i,a="";for(i=0;i<n;i++)a+=E(r[i])?r[i].call(e,t):r[i];return a}}function W(t,e){return t.isValid()?(e=z(e,t.localeData()),j[e]=j[e]||Z(e),j[e](t)):t.localeData().invalidDate()}function z(t,e){var n=5;function r(t){return e.longDateFormat(t)||t}for(P.lastIndex=0;n>=0&&P.test(t);)t=t.replace(P,r),P.lastIndex=0,n-=1;return t}var U={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function q(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(I).map((function(t){return"MMMM"===t||"MM"===t||"DD"===t||"dddd"===t?t.slice(1):t})).join(""),this._longDateFormat[t])}var V="Invalid date";function G(){return this._invalidDate}var J="%d",X=/\d{1,2}/;function K(t){return this._ordinal.replace("%d",t)}var Q={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function tt(t,e,n,r){var i=this._relativeTime[n];return E(i)?i(t,e,n,r):i.replace(/%d/i,t)}function et(t,e){var n=this._relativeTime[t>0?"future":"past"];return E(n)?n(e):n.replace(/%s/i,e)}var nt={};function rt(t,e){var n=t.toLowerCase();nt[n]=nt[n+"s"]=nt[e]=t}function it(t){return"string"==typeof t?nt[t]||nt[t.toLowerCase()]:void 0}function at(t){var e,n,r={};for(n in t)l(t,n)&&(e=it(n))&&(r[e]=t[n]);return r}var st={};function ot(t,e){st[t]=e}function lt(t){var e,n=[];for(e in t)l(t,e)&&n.push({unit:e,priority:st[e]});return n.sort((function(t,e){return t.priority-e.priority})),n}function ct(t){return t%4==0&&t%100!=0||t%400==0}function ut(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function dt(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=ut(e)),n}function ht(t,e){return function(n){return null!=n?(_t(this,t,n),i.updateOffset(this,e),this):mt(this,t)}}function mt(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function _t(t,e,n){t.isValid()&&!isNaN(n)&&("FullYear"===e&&ct(t.year())&&1===t.month()&&29===t.date()?(n=dt(n),t._d["set"+(t._isUTC?"UTC":"")+e](n,t.month(),te(n,t.month()))):t._d["set"+(t._isUTC?"UTC":"")+e](n))}function pt(t){return E(this[t=it(t)])?this[t]():this}function ft(t,e){if("object"==typeof t){var n,r=lt(t=at(t)),i=r.length;for(n=0;n<i;n++)this[r[n].unit](t[r[n].unit])}else if(E(this[t=it(t)]))return this[t](e);return this}var yt,gt=/\d/,bt=/\d\d/,kt=/\d{3}/,vt=/\d{4}/,xt=/[+-]?\d{6}/,Mt=/\d\d?/,Lt=/\d\d\d\d?/,wt=/\d\d\d\d\d\d?/,Tt=/\d{1,3}/,St=/\d{1,4}/,Dt=/[+-]?\d{1,6}/,Yt=/\d+/,Et=/[+-]?\d+/,Ct=/Z|[+-]\d\d:?\d\d/gi,At=/Z|[+-]\d\d(?::?\d\d)?/gi,Ot=/[+-]?\d+(\.\d{1,3})?/,Nt=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function Bt(t,e,n){yt[t]=E(e)?e:function(t,r){return t&&n?n:e}}function Ft(t,e){return l(yt,t)?yt[t](e._strict,e._locale):new RegExp(It(t))}function It(t){return Pt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(t,e,n,r,i){return e||n||r||i})))}function Pt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}yt={};var jt={};function Rt(t,e){var n,r,i=e;for("string"==typeof t&&(t=[t]),d(e)&&(i=function(t,n){n[e]=dt(t)}),r=t.length,n=0;n<r;n++)jt[t[n]]=i}function Ht(t,e){Rt(t,(function(t,n,r,i){r._w=r._w||{},e(t,r._w,r,i)}))}function $t(t,e,n){null!=e&&l(jt,t)&&jt[t](e,n._a,n,t)}var Zt,Wt=0,zt=1,Ut=2,qt=3,Vt=4,Gt=5,Jt=6,Xt=7,Kt=8;function Qt(t,e){return(t%e+e)%e}function te(t,e){if(isNaN(t)||isNaN(e))return NaN;var n=Qt(e,12);return t+=(e-n)/12,1===n?ct(t)?29:28:31-n%7%2}Zt=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1},H("M",["MM",2],"Mo",(function(){return this.month()+1})),H("MMM",0,0,(function(t){return this.localeData().monthsShort(this,t)})),H("MMMM",0,0,(function(t){return this.localeData().months(this,t)})),rt("month","M"),ot("month",8),Bt("M",Mt),Bt("MM",Mt,bt),Bt("MMM",(function(t,e){return e.monthsShortRegex(t)})),Bt("MMMM",(function(t,e){return e.monthsRegex(t)})),Rt(["M","MM"],(function(t,e){e[zt]=dt(t)-1})),Rt(["MMM","MMMM"],(function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);null!=i?e[zt]=i:y(n).invalidMonth=t}));var ee="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ne="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),re=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,ie=Nt,ae=Nt;function se(t,e){return t?s(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||re).test(e)?"format":"standalone"][t.month()]:s(this._months)?this._months:this._months.standalone}function oe(t,e){return t?s(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[re.test(e)?"format":"standalone"][t.month()]:s(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function le(t,e,n){var r,i,a,s=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)a=p([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(a,"").toLocaleLowerCase();return n?"MMM"===e?-1!==(i=Zt.call(this._shortMonthsParse,s))?i:null:-1!==(i=Zt.call(this._longMonthsParse,s))?i:null:"MMM"===e?-1!==(i=Zt.call(this._shortMonthsParse,s))||-1!==(i=Zt.call(this._longMonthsParse,s))?i:null:-1!==(i=Zt.call(this._longMonthsParse,s))||-1!==(i=Zt.call(this._shortMonthsParse,s))?i:null}function ce(t,e,n){var r,i,a;if(this._monthsParseExact)return le.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=p([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(a="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(a.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[r].test(t))return r;if(n&&"MMM"===e&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}}function ue(t,e){var n;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=dt(e);else if(!d(e=t.localeData().monthsParse(e)))return t;return n=Math.min(t.date(),te(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t}function de(t){return null!=t?(ue(this,t),i.updateOffset(this,!0),this):mt(this,"Month")}function he(){return te(this.year(),this.month())}function me(t){return this._monthsParseExact?(l(this,"_monthsRegex")||pe.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(l(this,"_monthsShortRegex")||(this._monthsShortRegex=ie),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function _e(t){return this._monthsParseExact?(l(this,"_monthsRegex")||pe.call(this),t?this._monthsStrictRegex:this._monthsRegex):(l(this,"_monthsRegex")||(this._monthsRegex=ae),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function pe(){function t(t,e){return e.length-t.length}var e,n,r=[],i=[],a=[];for(e=0;e<12;e++)n=p([2e3,e]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),a.push(this.months(n,"")),a.push(this.monthsShort(n,""));for(r.sort(t),i.sort(t),a.sort(t),e=0;e<12;e++)r[e]=Pt(r[e]),i[e]=Pt(i[e]);for(e=0;e<24;e++)a[e]=Pt(a[e]);this._monthsRegex=new RegExp("^("+a.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i")}function fe(t){return ct(t)?366:365}H("Y",0,0,(function(){var t=this.year();return t<=9999?F(t,4):"+"+t})),H(0,["YY",2],0,(function(){return this.year()%100})),H(0,["YYYY",4],0,"year"),H(0,["YYYYY",5],0,"year"),H(0,["YYYYYY",6,!0],0,"year"),rt("year","y"),ot("year",1),Bt("Y",Et),Bt("YY",Mt,bt),Bt("YYYY",St,vt),Bt("YYYYY",Dt,xt),Bt("YYYYYY",Dt,xt),Rt(["YYYYY","YYYYYY"],Wt),Rt("YYYY",(function(t,e){e[Wt]=2===t.length?i.parseTwoDigitYear(t):dt(t)})),Rt("YY",(function(t,e){e[Wt]=i.parseTwoDigitYear(t)})),Rt("Y",(function(t,e){e[Wt]=parseInt(t,10)})),i.parseTwoDigitYear=function(t){return dt(t)+(dt(t)>68?1900:2e3)};var ye=ht("FullYear",!0);function ge(){return ct(this.year())}function be(t,e,n,r,i,a,s){var o;return t<100&&t>=0?(o=new Date(t+400,e,n,r,i,a,s),isFinite(o.getFullYear())&&o.setFullYear(t)):o=new Date(t,e,n,r,i,a,s),o}function ke(t){var e,n;return t<100&&t>=0?((n=Array.prototype.slice.call(arguments))[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function ve(t,e,n){var r=7+e-n;return-(7+ke(t,0,r).getUTCDay()-e)%7+r-1}function xe(t,e,n,r,i){var a,s,o=1+7*(e-1)+(7+n-r)%7+ve(t,r,i);return o<=0?s=fe(a=t-1)+o:o>fe(t)?(a=t+1,s=o-fe(t)):(a=t,s=o),{year:a,dayOfYear:s}}function Me(t,e,n){var r,i,a=ve(t.year(),e,n),s=Math.floor((t.dayOfYear()-a-1)/7)+1;return s<1?r=s+Le(i=t.year()-1,e,n):s>Le(t.year(),e,n)?(r=s-Le(t.year(),e,n),i=t.year()+1):(i=t.year(),r=s),{week:r,year:i}}function Le(t,e,n){var r=ve(t,e,n),i=ve(t+1,e,n);return(fe(t)-r+i)/7}function we(t){return Me(t,this._week.dow,this._week.doy).week}H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),rt("week","w"),rt("isoWeek","W"),ot("week",5),ot("isoWeek",5),Bt("w",Mt),Bt("ww",Mt,bt),Bt("W",Mt),Bt("WW",Mt,bt),Ht(["w","ww","W","WW"],(function(t,e,n,r){e[r.substr(0,1)]=dt(t)}));var Te={dow:0,doy:6};function Se(){return this._week.dow}function De(){return this._week.doy}function Ye(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Ee(t){var e=Me(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Ce(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}function Ae(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Oe(t,e){return t.slice(e,7).concat(t.slice(0,e))}H("d",0,"do","day"),H("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),H("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),H("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),rt("day","d"),rt("weekday","e"),rt("isoWeekday","E"),ot("day",11),ot("weekday",11),ot("isoWeekday",11),Bt("d",Mt),Bt("e",Mt),Bt("E",Mt),Bt("dd",(function(t,e){return e.weekdaysMinRegex(t)})),Bt("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),Bt("dddd",(function(t,e){return e.weekdaysRegex(t)})),Ht(["dd","ddd","dddd"],(function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);null!=i?e.d=i:y(n).invalidWeekday=t})),Ht(["d","e","E"],(function(t,e,n,r){e[r]=dt(t)}));var Ne="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Be="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Fe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ie=Nt,Pe=Nt,je=Nt;function Re(t,e){var n=s(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Oe(n,this._week.dow):t?n[t.day()]:n}function He(t){return!0===t?Oe(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function $e(t){return!0===t?Oe(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Ze(t,e,n){var r,i,a,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)a=p([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(a,"").toLocaleLowerCase();return n?"dddd"===e?-1!==(i=Zt.call(this._weekdaysParse,s))?i:null:"ddd"===e?-1!==(i=Zt.call(this._shortWeekdaysParse,s))?i:null:-1!==(i=Zt.call(this._minWeekdaysParse,s))?i:null:"dddd"===e?-1!==(i=Zt.call(this._weekdaysParse,s))||-1!==(i=Zt.call(this._shortWeekdaysParse,s))||-1!==(i=Zt.call(this._minWeekdaysParse,s))?i:null:"ddd"===e?-1!==(i=Zt.call(this._shortWeekdaysParse,s))||-1!==(i=Zt.call(this._weekdaysParse,s))||-1!==(i=Zt.call(this._minWeekdaysParse,s))?i:null:-1!==(i=Zt.call(this._minWeekdaysParse,s))||-1!==(i=Zt.call(this._weekdaysParse,s))||-1!==(i=Zt.call(this._shortWeekdaysParse,s))?i:null}function We(t,e,n){var r,i,a;if(this._weekdaysParseExact)return Ze.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=p([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(a="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(a.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[r].test(t))return r;if(n&&"ddd"===e&&this._shortWeekdaysParse[r].test(t))return r;if(n&&"dd"===e&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function ze(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Ce(t,this.localeData()),this.add(t-e,"d")):e}function Ue(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function qe(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Ae(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function Ve(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Xe.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=Ie),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ge(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Xe.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Pe),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Je(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Xe.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=je),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Xe(){function t(t,e){return e.length-t.length}var e,n,r,i,a,s=[],o=[],l=[],c=[];for(e=0;e<7;e++)n=p([2e3,1]).day(e),r=Pt(this.weekdaysMin(n,"")),i=Pt(this.weekdaysShort(n,"")),a=Pt(this.weekdays(n,"")),s.push(r),o.push(i),l.push(a),c.push(r),c.push(i),c.push(a);s.sort(t),o.sort(t),l.sort(t),c.sort(t),this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ke(){return this.hours()%12||12}function Qe(){return this.hours()||24}function tn(t,e){H(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function en(t,e){return e._meridiemParse}function nn(t){return"p"===(t+"").toLowerCase().charAt(0)}H("H",["HH",2],0,"hour"),H("h",["hh",2],0,Ke),H("k",["kk",2],0,Qe),H("hmm",0,0,(function(){return""+Ke.apply(this)+F(this.minutes(),2)})),H("hmmss",0,0,(function(){return""+Ke.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)})),H("Hmm",0,0,(function(){return""+this.hours()+F(this.minutes(),2)})),H("Hmmss",0,0,(function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)})),tn("a",!0),tn("A",!1),rt("hour","h"),ot("hour",13),Bt("a",en),Bt("A",en),Bt("H",Mt),Bt("h",Mt),Bt("k",Mt),Bt("HH",Mt,bt),Bt("hh",Mt,bt),Bt("kk",Mt,bt),Bt("hmm",Lt),Bt("hmmss",wt),Bt("Hmm",Lt),Bt("Hmmss",wt),Rt(["H","HH"],qt),Rt(["k","kk"],(function(t,e,n){var r=dt(t);e[qt]=24===r?0:r})),Rt(["a","A"],(function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t})),Rt(["h","hh"],(function(t,e,n){e[qt]=dt(t),y(n).bigHour=!0})),Rt("hmm",(function(t,e,n){var r=t.length-2;e[qt]=dt(t.substr(0,r)),e[Vt]=dt(t.substr(r)),y(n).bigHour=!0})),Rt("hmmss",(function(t,e,n){var r=t.length-4,i=t.length-2;e[qt]=dt(t.substr(0,r)),e[Vt]=dt(t.substr(r,2)),e[Gt]=dt(t.substr(i)),y(n).bigHour=!0})),Rt("Hmm",(function(t,e,n){var r=t.length-2;e[qt]=dt(t.substr(0,r)),e[Vt]=dt(t.substr(r))})),Rt("Hmmss",(function(t,e,n){var r=t.length-4,i=t.length-2;e[qt]=dt(t.substr(0,r)),e[Vt]=dt(t.substr(r,2)),e[Gt]=dt(t.substr(i))}));var rn=/[ap]\.?m?\.?/i,an=ht("Hours",!0);function sn(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var on,ln={calendar:N,longDateFormat:U,invalidDate:V,ordinal:J,dayOfMonthOrdinalParse:X,relativeTime:Q,months:ee,monthsShort:ne,week:Te,weekdays:Ne,weekdaysMin:Fe,weekdaysShort:Be,meridiemParse:rn},cn={},un={};function dn(t,e){var n,r=Math.min(t.length,e.length);for(n=0;n<r;n+=1)if(t[n]!==e[n])return n;return r}function hn(t){return t?t.toLowerCase().replace("_","-"):t}function mn(t){for(var e,n,r,i,a=0;a<t.length;){for(e=(i=hn(t[a]).split("-")).length,n=(n=hn(t[a+1]))?n.split("-"):null;e>0;){if(r=pn(i.slice(0,e).join("-")))return r;if(n&&n.length>=e&&dn(i,n)>=e-1)break;e--}a++}return on}function _n(t){return null!=t.match("^[^/\\\\]*$")}function pn(e){var r=null;if(void 0===cn[e]&&t&&t.exports&&_n(e))try{r=on._abbr,n(46700)("./"+e),fn(r)}catch(i){cn[e]=null}return cn[e]}function fn(t,e){var n;return t&&((n=u(e)?bn(t):yn(t,e))?on=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),on._abbr}function yn(t,e){if(null!==e){var n,r=ln;if(e.abbr=t,null!=cn[t])Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=cn[t]._config;else if(null!=e.parentLocale)if(null!=cn[e.parentLocale])r=cn[e.parentLocale]._config;else{if(null==(n=pn(e.parentLocale)))return un[e.parentLocale]||(un[e.parentLocale]=[]),un[e.parentLocale].push({name:t,config:e}),null;r=n._config}return cn[t]=new O(A(r,e)),un[t]&&un[t].forEach((function(t){yn(t.name,t.config)})),fn(t),cn[t]}return delete cn[t],null}function gn(t,e){if(null!=e){var n,r,i=ln;null!=cn[t]&&null!=cn[t].parentLocale?cn[t].set(A(cn[t]._config,e)):(null!=(r=pn(t))&&(i=r._config),e=A(i,e),null==r&&(e.abbr=t),(n=new O(e)).parentLocale=cn[t],cn[t]=n),fn(t)}else null!=cn[t]&&(null!=cn[t].parentLocale?(cn[t]=cn[t].parentLocale,t===fn()&&fn(t)):null!=cn[t]&&delete cn[t]);return cn[t]}function bn(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return on;if(!s(t)){if(e=pn(t))return e;t=[t]}return mn(t)}function kn(){return S(cn)}function vn(t){var e,n=t._a;return n&&-2===y(t).overflow&&(e=n[zt]<0||n[zt]>11?zt:n[Ut]<1||n[Ut]>te(n[Wt],n[zt])?Ut:n[qt]<0||n[qt]>24||24===n[qt]&&(0!==n[Vt]||0!==n[Gt]||0!==n[Jt])?qt:n[Vt]<0||n[Vt]>59?Vt:n[Gt]<0||n[Gt]>59?Gt:n[Jt]<0||n[Jt]>999?Jt:-1,y(t)._overflowDayOfYear&&(e<Wt||e>Ut)&&(e=Ut),y(t)._overflowWeeks&&-1===e&&(e=Xt),y(t)._overflowWeekday&&-1===e&&(e=Kt),y(t).overflow=e),t}var xn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Mn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ln=/Z|[+-]\d\d(?::?\d\d)?/,wn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Tn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Sn=/^\/?Date\((-?\d+)/i,Dn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Yn={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function En(t){var e,n,r,i,a,s,o=t._i,l=xn.exec(o)||Mn.exec(o),c=wn.length,u=Tn.length;if(l){for(y(t).iso=!0,e=0,n=c;e<n;e++)if(wn[e][1].exec(l[1])){i=wn[e][0],r=!1!==wn[e][2];break}if(null==i)return void(t._isValid=!1);if(l[3]){for(e=0,n=u;e<n;e++)if(Tn[e][1].exec(l[3])){a=(l[2]||" ")+Tn[e][0];break}if(null==a)return void(t._isValid=!1)}if(!r&&null!=a)return void(t._isValid=!1);if(l[4]){if(!Ln.exec(l[4]))return void(t._isValid=!1);s="Z"}t._f=i+(a||"")+(s||""),$n(t)}else t._isValid=!1}function Cn(t,e,n,r,i,a){var s=[An(t),ne.indexOf(e),parseInt(n,10),parseInt(r,10),parseInt(i,10)];return a&&s.push(parseInt(a,10)),s}function An(t){var e=parseInt(t,10);return e<=49?2e3+e:e<=999?1900+e:e}function On(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Nn(t,e,n){return!t||Be.indexOf(t)===new Date(e[0],e[1],e[2]).getDay()||(y(n).weekdayMismatch=!0,n._isValid=!1,!1)}function Bn(t,e,n){if(t)return Yn[t];if(e)return 0;var r=parseInt(n,10),i=r%100;return(r-i)/100*60+i}function Fn(t){var e,n=Dn.exec(On(t._i));if(n){if(e=Cn(n[4],n[3],n[2],n[5],n[6],n[7]),!Nn(n[1],e,t))return;t._a=e,t._tzm=Bn(n[8],n[9],n[10]),t._d=ke.apply(null,t._a),t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),y(t).rfc2822=!0}else t._isValid=!1}function In(t){var e=Sn.exec(t._i);null===e?(En(t),!1===t._isValid&&(delete t._isValid,Fn(t),!1===t._isValid&&(delete t._isValid,t._strict?t._isValid=!1:i.createFromInputFallback(t)))):t._d=new Date(+e[1])}function Pn(t,e,n){return null!=t?t:null!=e?e:n}function jn(t){var e=new Date(i.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function Rn(t){var e,n,r,i,a,s=[];if(!t._d){for(r=jn(t),t._w&&null==t._a[Ut]&&null==t._a[zt]&&Hn(t),null!=t._dayOfYear&&(a=Pn(t._a[Wt],r[Wt]),(t._dayOfYear>fe(a)||0===t._dayOfYear)&&(y(t)._overflowDayOfYear=!0),n=ke(a,0,t._dayOfYear),t._a[zt]=n.getUTCMonth(),t._a[Ut]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=s[e]=r[e];for(;e<7;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[qt]&&0===t._a[Vt]&&0===t._a[Gt]&&0===t._a[Jt]&&(t._nextDay=!0,t._a[qt]=0),t._d=(t._useUTC?ke:be).apply(null,s),i=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[qt]=24),t._w&&void 0!==t._w.d&&t._w.d!==i&&(y(t).weekdayMismatch=!0)}}function Hn(t){var e,n,r,i,a,s,o,l,c;null!=(e=t._w).GG||null!=e.W||null!=e.E?(a=1,s=4,n=Pn(e.GG,t._a[Wt],Me(Jn(),1,4).year),r=Pn(e.W,1),((i=Pn(e.E,1))<1||i>7)&&(l=!0)):(a=t._locale._week.dow,s=t._locale._week.doy,c=Me(Jn(),a,s),n=Pn(e.gg,t._a[Wt],c.year),r=Pn(e.w,c.week),null!=e.d?((i=e.d)<0||i>6)&&(l=!0):null!=e.e?(i=e.e+a,(e.e<0||e.e>6)&&(l=!0)):i=a),r<1||r>Le(n,a,s)?y(t)._overflowWeeks=!0:null!=l?y(t)._overflowWeekday=!0:(o=xe(n,r,i,a,s),t._a[Wt]=o.year,t._dayOfYear=o.dayOfYear)}function $n(t){if(t._f!==i.ISO_8601)if(t._f!==i.RFC_2822){t._a=[],y(t).empty=!0;var e,n,r,a,s,o,l,c=""+t._i,u=c.length,d=0;for(l=(r=z(t._f,t._locale).match(I)||[]).length,e=0;e<l;e++)a=r[e],(n=(c.match(Ft(a,t))||[])[0])&&((s=c.substr(0,c.indexOf(n))).length>0&&y(t).unusedInput.push(s),c=c.slice(c.indexOf(n)+n.length),d+=n.length),R[a]?(n?y(t).empty=!1:y(t).unusedTokens.push(a),$t(a,n,t)):t._strict&&!n&&y(t).unusedTokens.push(a);y(t).charsLeftOver=u-d,c.length>0&&y(t).unusedInput.push(c),t._a[qt]<=12&&!0===y(t).bigHour&&t._a[qt]>0&&(y(t).bigHour=void 0),y(t).parsedDateParts=t._a.slice(0),y(t).meridiem=t._meridiem,t._a[qt]=Zn(t._locale,t._a[qt],t._meridiem),null!==(o=y(t).era)&&(t._a[Wt]=t._locale.erasConvertYear(o,t._a[Wt])),Rn(t),vn(t)}else Fn(t);else En(t)}function Zn(t,e,n){var r;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?((r=t.isPM(n))&&e<12&&(e+=12),r||12!==e||(e=0),e):e}function Wn(t){var e,n,r,i,a,s,o=!1,l=t._f.length;if(0===l)return y(t).invalidFormat=!0,void(t._d=new Date(NaN));for(i=0;i<l;i++)a=0,s=!1,e=x({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[i],$n(e),g(e)&&(s=!0),a+=y(e).charsLeftOver,a+=10*y(e).unusedTokens.length,y(e).score=a,o?a<r&&(r=a,n=e):(null==r||a<r||s)&&(r=a,n=e,s&&(o=!0));_(t,n||e)}function zn(t){if(!t._d){var e=at(t._i),n=void 0===e.day?e.date:e.day;t._a=m([e.year,e.month,n,e.hour,e.minute,e.second,e.millisecond],(function(t){return t&&parseInt(t,10)})),Rn(t)}}function Un(t){var e=new M(vn(qn(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function qn(t){var e=t._i,n=t._f;return t._locale=t._locale||bn(t._l),null===e||void 0===n&&""===e?b({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),L(e)?new M(vn(e)):(h(e)?t._d=e:s(n)?Wn(t):n?$n(t):Vn(t),g(t)||(t._d=null),t))}function Vn(t){var e=t._i;u(e)?t._d=new Date(i.now()):h(e)?t._d=new Date(e.valueOf()):"string"==typeof e?In(t):s(e)?(t._a=m(e.slice(0),(function(t){return parseInt(t,10)})),Rn(t)):o(e)?zn(t):d(e)?t._d=new Date(e):i.createFromInputFallback(t)}function Gn(t,e,n,r,i){var a={};return!0!==e&&!1!==e||(r=e,e=void 0),!0!==n&&!1!==n||(r=n,n=void 0),(o(t)&&c(t)||s(t)&&0===t.length)&&(t=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=t,a._f=e,a._strict=r,Un(a)}function Jn(t,e,n,r){return Gn(t,e,n,r,!1)}i.createFromInputFallback=T("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))})),i.ISO_8601=function(){},i.RFC_2822=function(){};var Xn=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var t=Jn.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:b()})),Kn=T("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var t=Jn.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:b()}));function Qn(t,e){var n,r;if(1===e.length&&s(e[0])&&(e=e[0]),!e.length)return Jn();for(n=e[0],r=1;r<e.length;++r)e[r].isValid()&&!e[r][t](n)||(n=e[r]);return n}function tr(){return Qn("isBefore",[].slice.call(arguments,0))}function er(){return Qn("isAfter",[].slice.call(arguments,0))}var nr=function(){return Date.now?Date.now():+new Date},rr=["year","quarter","month","week","day","hour","minute","second","millisecond"];function ir(t){var e,n,r=!1,i=rr.length;for(e in t)if(l(t,e)&&(-1===Zt.call(rr,e)||null!=t[e]&&isNaN(t[e])))return!1;for(n=0;n<i;++n)if(t[rr[n]]){if(r)return!1;parseFloat(t[rr[n]])!==dt(t[rr[n]])&&(r=!0)}return!0}function ar(){return this._isValid}function sr(){return Yr(NaN)}function or(t){var e=at(t),n=e.year||0,r=e.quarter||0,i=e.month||0,a=e.week||e.isoWeek||0,s=e.day||0,o=e.hour||0,l=e.minute||0,c=e.second||0,u=e.millisecond||0;this._isValid=ir(e),this._milliseconds=+u+1e3*c+6e4*l+1e3*o*60*60,this._days=+s+7*a,this._months=+i+3*r+12*n,this._data={},this._locale=bn(),this._bubble()}function lr(t){return t instanceof or}function cr(t){return t<0?-1*Math.round(-1*t):Math.round(t)}function ur(t,e,n){var r,i=Math.min(t.length,e.length),a=Math.abs(t.length-e.length),s=0;for(r=0;r<i;r++)(n&&t[r]!==e[r]||!n&&dt(t[r])!==dt(e[r]))&&s++;return s+a}function dr(t,e){H(t,0,0,(function(){var t=this.utcOffset(),n="+";return t<0&&(t=-t,n="-"),n+F(~~(t/60),2)+e+F(~~t%60,2)}))}dr("Z",":"),dr("ZZ",""),Bt("Z",At),Bt("ZZ",At),Rt(["Z","ZZ"],(function(t,e,n){n._useUTC=!0,n._tzm=mr(At,t)}));var hr=/([\+\-]|\d\d)/gi;function mr(t,e){var n,r,i=(e||"").match(t);return null===i?null:0===(r=60*(n=((i[i.length-1]||[])+"").match(hr)||["-",0,0])[1]+dt(n[2]))?0:"+"===n[0]?r:-r}function _r(t,e){var n,r;return e._isUTC?(n=e.clone(),r=(L(t)||h(t)?t.valueOf():Jn(t).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+r),i.updateOffset(n,!1),n):Jn(t).local()}function pr(t){return-Math.round(t._d.getTimezoneOffset())}function fr(t,e,n){var r,a=this._offset||0;if(!this.isValid())return null!=t?this:NaN;if(null!=t){if("string"==typeof t){if(null===(t=mr(At,t)))return this}else Math.abs(t)<16&&!n&&(t*=60);return!this._isUTC&&e&&(r=pr(this)),this._offset=t,this._isUTC=!0,null!=r&&this.add(r,"m"),a!==t&&(!e||this._changeInProgress?Nr(this,Yr(t-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,i.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?a:pr(this)}function yr(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function gr(t){return this.utcOffset(0,t)}function br(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(pr(this),"m")),this}function kr(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var t=mr(Ct,this._i);null!=t?this.utcOffset(t):this.utcOffset(0,!0)}return this}function vr(t){return!!this.isValid()&&(t=t?Jn(t).utcOffset():0,(this.utcOffset()-t)%60==0)}function xr(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Mr(){if(!u(this._isDSTShifted))return this._isDSTShifted;var t,e={};return x(e,this),(e=qn(e))._a?(t=e._isUTC?p(e._a):Jn(e._a),this._isDSTShifted=this.isValid()&&ur(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Lr(){return!!this.isValid()&&!this._isUTC}function wr(){return!!this.isValid()&&this._isUTC}function Tr(){return!!this.isValid()&&this._isUTC&&0===this._offset}i.updateOffset=function(){};var Sr=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Dr=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Yr(t,e){var n,r,i,a=t,s=null;return lr(t)?a={ms:t._milliseconds,d:t._days,M:t._months}:d(t)||!isNaN(+t)?(a={},e?a[e]=+t:a.milliseconds=+t):(s=Sr.exec(t))?(n="-"===s[1]?-1:1,a={y:0,d:dt(s[Ut])*n,h:dt(s[qt])*n,m:dt(s[Vt])*n,s:dt(s[Gt])*n,ms:dt(cr(1e3*s[Jt]))*n}):(s=Dr.exec(t))?(n="-"===s[1]?-1:1,a={y:Er(s[2],n),M:Er(s[3],n),w:Er(s[4],n),d:Er(s[5],n),h:Er(s[6],n),m:Er(s[7],n),s:Er(s[8],n)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(i=Ar(Jn(a.from),Jn(a.to)),(a={}).ms=i.milliseconds,a.M=i.months),r=new or(a),lr(t)&&l(t,"_locale")&&(r._locale=t._locale),lr(t)&&l(t,"_isValid")&&(r._isValid=t._isValid),r}function Er(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Cr(t,e){var n={};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Ar(t,e){var n;return t.isValid()&&e.isValid()?(e=_r(e,t),t.isBefore(e)?n=Cr(t,e):((n=Cr(e,t)).milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Or(t,e){return function(n,r){var i;return null===r||isNaN(+r)||(Y(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=r,r=i),Nr(this,Yr(n,r),t),this}}function Nr(t,e,n,r){var a=e._milliseconds,s=cr(e._days),o=cr(e._months);t.isValid()&&(r=null==r||r,o&&ue(t,mt(t,"Month")+o*n),s&&_t(t,"Date",mt(t,"Date")+s*n),a&&t._d.setTime(t._d.valueOf()+a*n),r&&i.updateOffset(t,s||o))}Yr.fn=or.prototype,Yr.invalid=sr;var Br=Or(1,"add"),Fr=Or(-1,"subtract");function Ir(t){return"string"==typeof t||t instanceof String}function Pr(t){return L(t)||h(t)||Ir(t)||d(t)||Rr(t)||jr(t)||null==t}function jr(t){var e,n,r=o(t)&&!c(t),i=!1,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s=a.length;for(e=0;e<s;e+=1)n=a[e],i=i||l(t,n);return r&&i}function Rr(t){var e=s(t),n=!1;return e&&(n=0===t.filter((function(e){return!d(e)&&Ir(t)})).length),e&&n}function Hr(t){var e,n,r=o(t)&&!c(t),i=!1,a=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(e=0;e<a.length;e+=1)n=a[e],i=i||l(t,n);return r&&i}function $r(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Zr(t,e){1===arguments.length&&(arguments[0]?Pr(arguments[0])?(t=arguments[0],e=void 0):Hr(arguments[0])&&(e=arguments[0],t=void 0):(t=void 0,e=void 0));var n=t||Jn(),r=_r(n,this).startOf("day"),a=i.calendarFormat(this,r)||"sameElse",s=e&&(E(e[a])?e[a].call(this,n):e[a]);return this.format(s||this.localeData().calendar(a,this,Jn(n)))}function Wr(){return new M(this)}function zr(t,e){var n=L(t)?t:Jn(t);return!(!this.isValid()||!n.isValid())&&("millisecond"===(e=it(e)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf())}function Ur(t,e){var n=L(t)?t:Jn(t);return!(!this.isValid()||!n.isValid())&&("millisecond"===(e=it(e)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf())}function qr(t,e,n,r){var i=L(t)?t:Jn(t),a=L(e)?e:Jn(e);return!!(this.isValid()&&i.isValid()&&a.isValid())&&("("===(r=r||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===r[1]?this.isBefore(a,n):!this.isAfter(a,n))}function Vr(t,e){var n,r=L(t)?t:Jn(t);return!(!this.isValid()||!r.isValid())&&("millisecond"===(e=it(e)||"millisecond")?this.valueOf()===r.valueOf():(n=r.valueOf(),this.clone().startOf(e).valueOf()<=n&&n<=this.clone().endOf(e).valueOf()))}function Gr(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function Jr(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function Xr(t,e,n){var r,i,a;if(!this.isValid())return NaN;if(!(r=_r(t,this)).isValid())return NaN;switch(i=6e4*(r.utcOffset()-this.utcOffset()),e=it(e)){case"year":a=Kr(this,r)/12;break;case"month":a=Kr(this,r);break;case"quarter":a=Kr(this,r)/3;break;case"second":a=(this-r)/1e3;break;case"minute":a=(this-r)/6e4;break;case"hour":a=(this-r)/36e5;break;case"day":a=(this-r-i)/864e5;break;case"week":a=(this-r-i)/6048e5;break;default:a=this-r}return n?a:ut(a)}function Kr(t,e){if(t.date()<e.date())return-Kr(e,t);var n=12*(e.year()-t.year())+(e.month()-t.month()),r=t.clone().add(n,"months");return-(n+(e-r<0?(e-r)/(r-t.clone().add(n-1,"months")):(e-r)/(t.clone().add(n+1,"months")-r)))||0}function Qr(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ti(t){if(!this.isValid())return null;var e=!0!==t,n=e?this.clone().utc():this;return n.year()<0||n.year()>9999?W(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):E(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",W(n,"Z")):W(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ei(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t,e,n,r,i="moment",a="";return this.isLocal()||(i=0===this.utcOffset()?"moment.utc":"moment.parseZone",a="Z"),t="["+i+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",r=a+'[")]',this.format(t+e+n+r)}function ni(t){t||(t=this.isUtc()?i.defaultFormatUtc:i.defaultFormat);var e=W(this,t);return this.localeData().postformat(e)}function ri(t,e){return this.isValid()&&(L(t)&&t.isValid()||Jn(t).isValid())?Yr({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function ii(t){return this.from(Jn(),t)}function ai(t,e){return this.isValid()&&(L(t)&&t.isValid()||Jn(t).isValid())?Yr({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function si(t){return this.to(Jn(),t)}function oi(t){var e;return void 0===t?this._locale._abbr:(null!=(e=bn(t))&&(this._locale=e),this)}i.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",i.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var li=T("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(t){return void 0===t?this.localeData():this.locale(t)}));function ci(){return this._locale}var ui=1e3,di=60*ui,hi=60*di,mi=3506328*hi;function _i(t,e){return(t%e+e)%e}function pi(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-mi:new Date(t,e,n).valueOf()}function fi(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-mi:Date.UTC(t,e,n)}function yi(t){var e,n;if(void 0===(t=it(t))||"millisecond"===t||!this.isValid())return this;switch(n=this._isUTC?fi:pi,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=_i(e+(this._isUTC?0:this.utcOffset()*di),hi);break;case"minute":e=this._d.valueOf(),e-=_i(e,di);break;case"second":e=this._d.valueOf(),e-=_i(e,ui)}return this._d.setTime(e),i.updateOffset(this,!0),this}function gi(t){var e,n;if(void 0===(t=it(t))||"millisecond"===t||!this.isValid())return this;switch(n=this._isUTC?fi:pi,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=hi-_i(e+(this._isUTC?0:this.utcOffset()*di),hi)-1;break;case"minute":e=this._d.valueOf(),e+=di-_i(e,di)-1;break;case"second":e=this._d.valueOf(),e+=ui-_i(e,ui)-1}return this._d.setTime(e),i.updateOffset(this,!0),this}function bi(){return this._d.valueOf()-6e4*(this._offset||0)}function ki(){return Math.floor(this.valueOf()/1e3)}function vi(){return new Date(this.valueOf())}function xi(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function Mi(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function Li(){return this.isValid()?this.toISOString():null}function wi(){return g(this)}function Ti(){return _({},y(this))}function Si(){return y(this).overflow}function Di(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Yi(t,e){var n,r,a,s=this._eras||bn("en")._eras;for(n=0,r=s.length;n<r;++n)switch("string"==typeof s[n].since&&(a=i(s[n].since).startOf("day"),s[n].since=a.valueOf()),typeof s[n].until){case"undefined":s[n].until=1/0;break;case"string":a=i(s[n].until).startOf("day").valueOf(),s[n].until=a.valueOf()}return s}function Ei(t,e,n){var r,i,a,s,o,l=this.eras();for(t=t.toUpperCase(),r=0,i=l.length;r<i;++r)if(a=l[r].name.toUpperCase(),s=l[r].abbr.toUpperCase(),o=l[r].narrow.toUpperCase(),n)switch(e){case"N":case"NN":case"NNN":if(s===t)return l[r];break;case"NNNN":if(a===t)return l[r];break;case"NNNNN":if(o===t)return l[r]}else if([a,s,o].indexOf(t)>=0)return l[r]}function Ci(t,e){var n=t.since<=t.until?1:-1;return void 0===e?i(t.since).year():i(t.since).year()+(e-t.offset)*n}function Ai(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t){if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until)return r[t].name;if(r[t].until<=n&&n<=r[t].since)return r[t].name}return""}function Oi(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t){if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until)return r[t].narrow;if(r[t].until<=n&&n<=r[t].since)return r[t].narrow}return""}function Ni(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t){if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until)return r[t].abbr;if(r[t].until<=n&&n<=r[t].since)return r[t].abbr}return""}function Bi(){var t,e,n,r,a=this.localeData().eras();for(t=0,e=a.length;t<e;++t)if(n=a[t].since<=a[t].until?1:-1,r=this.clone().startOf("day").valueOf(),a[t].since<=r&&r<=a[t].until||a[t].until<=r&&r<=a[t].since)return(this.year()-i(a[t].since).year())*n+a[t].offset;return this.year()}function Fi(t){return l(this,"_erasNameRegex")||Zi.call(this),t?this._erasNameRegex:this._erasRegex}function Ii(t){return l(this,"_erasAbbrRegex")||Zi.call(this),t?this._erasAbbrRegex:this._erasRegex}function Pi(t){return l(this,"_erasNarrowRegex")||Zi.call(this),t?this._erasNarrowRegex:this._erasRegex}function ji(t,e){return e.erasAbbrRegex(t)}function Ri(t,e){return e.erasNameRegex(t)}function Hi(t,e){return e.erasNarrowRegex(t)}function $i(t,e){return e._eraYearOrdinalRegex||Yt}function Zi(){var t,e,n=[],r=[],i=[],a=[],s=this.eras();for(t=0,e=s.length;t<e;++t)r.push(Pt(s[t].name)),n.push(Pt(s[t].abbr)),i.push(Pt(s[t].narrow)),a.push(Pt(s[t].name)),a.push(Pt(s[t].abbr)),a.push(Pt(s[t].narrow));this._erasRegex=new RegExp("^("+a.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+r.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+n.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+i.join("|")+")","i")}function Wi(t,e){H(0,[t,t.length],0,e)}function zi(t){return Xi.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Ui(t){return Xi.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function qi(){return Le(this.year(),1,4)}function Vi(){return Le(this.isoWeekYear(),1,4)}function Gi(){var t=this.localeData()._week;return Le(this.year(),t.dow,t.doy)}function Ji(){var t=this.localeData()._week;return Le(this.weekYear(),t.dow,t.doy)}function Xi(t,e,n,r,i){var a;return null==t?Me(this,r,i).year:(e>(a=Le(t,r,i))&&(e=a),Ki.call(this,t,e,n,r,i))}function Ki(t,e,n,r,i){var a=xe(t,e,n,r,i),s=ke(a.year,0,a.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Qi(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}H("N",0,0,"eraAbbr"),H("NN",0,0,"eraAbbr"),H("NNN",0,0,"eraAbbr"),H("NNNN",0,0,"eraName"),H("NNNNN",0,0,"eraNarrow"),H("y",["y",1],"yo","eraYear"),H("y",["yy",2],0,"eraYear"),H("y",["yyy",3],0,"eraYear"),H("y",["yyyy",4],0,"eraYear"),Bt("N",ji),Bt("NN",ji),Bt("NNN",ji),Bt("NNNN",Ri),Bt("NNNNN",Hi),Rt(["N","NN","NNN","NNNN","NNNNN"],(function(t,e,n,r){var i=n._locale.erasParse(t,r,n._strict);i?y(n).era=i:y(n).invalidEra=t})),Bt("y",Yt),Bt("yy",Yt),Bt("yyy",Yt),Bt("yyyy",Yt),Bt("yo",$i),Rt(["y","yy","yyy","yyyy"],Wt),Rt(["yo"],(function(t,e,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[Wt]=n._locale.eraYearOrdinalParse(t,i):e[Wt]=parseInt(t,10)})),H(0,["gg",2],0,(function(){return this.weekYear()%100})),H(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Wi("gggg","weekYear"),Wi("ggggg","weekYear"),Wi("GGGG","isoWeekYear"),Wi("GGGGG","isoWeekYear"),rt("weekYear","gg"),rt("isoWeekYear","GG"),ot("weekYear",1),ot("isoWeekYear",1),Bt("G",Et),Bt("g",Et),Bt("GG",Mt,bt),Bt("gg",Mt,bt),Bt("GGGG",St,vt),Bt("gggg",St,vt),Bt("GGGGG",Dt,xt),Bt("ggggg",Dt,xt),Ht(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,n,r){e[r.substr(0,2)]=dt(t)})),Ht(["gg","GG"],(function(t,e,n,r){e[r]=i.parseTwoDigitYear(t)})),H("Q",0,"Qo","quarter"),rt("quarter","Q"),ot("quarter",7),Bt("Q",gt),Rt("Q",(function(t,e){e[zt]=3*(dt(t)-1)})),H("D",["DD",2],"Do","date"),rt("date","D"),ot("date",9),Bt("D",Mt),Bt("DD",Mt,bt),Bt("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),Rt(["D","DD"],Ut),Rt("Do",(function(t,e){e[Ut]=dt(t.match(Mt)[0])}));var ta=ht("Date",!0);function ea(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}H("DDD",["DDDD",3],"DDDo","dayOfYear"),rt("dayOfYear","DDD"),ot("dayOfYear",4),Bt("DDD",Tt),Bt("DDDD",kt),Rt(["DDD","DDDD"],(function(t,e,n){n._dayOfYear=dt(t)})),H("m",["mm",2],0,"minute"),rt("minute","m"),ot("minute",14),Bt("m",Mt),Bt("mm",Mt,bt),Rt(["m","mm"],Vt);var na=ht("Minutes",!1);H("s",["ss",2],0,"second"),rt("second","s"),ot("second",15),Bt("s",Mt),Bt("ss",Mt,bt),Rt(["s","ss"],Gt);var ra,ia,aa=ht("Seconds",!1);for(H("S",0,0,(function(){return~~(this.millisecond()/100)})),H(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),H(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),H(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),H(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),H(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),H(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),rt("millisecond","ms"),ot("millisecond",16),Bt("S",Tt,gt),Bt("SS",Tt,bt),Bt("SSS",Tt,kt),ra="SSSS";ra.length<=9;ra+="S")Bt(ra,Yt);function sa(t,e){e[Jt]=dt(1e3*("0."+t))}for(ra="S";ra.length<=9;ra+="S")Rt(ra,sa);function oa(){return this._isUTC?"UTC":""}function la(){return this._isUTC?"Coordinated Universal Time":""}ia=ht("Milliseconds",!1),H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");var ca=M.prototype;function ua(t){return Jn(1e3*t)}function da(){return Jn.apply(null,arguments).parseZone()}function ha(t){return t}ca.add=Br,ca.calendar=Zr,ca.clone=Wr,ca.diff=Xr,ca.endOf=gi,ca.format=ni,ca.from=ri,ca.fromNow=ii,ca.to=ai,ca.toNow=si,ca.get=pt,ca.invalidAt=Si,ca.isAfter=zr,ca.isBefore=Ur,ca.isBetween=qr,ca.isSame=Vr,ca.isSameOrAfter=Gr,ca.isSameOrBefore=Jr,ca.isValid=wi,ca.lang=li,ca.locale=oi,ca.localeData=ci,ca.max=Kn,ca.min=Xn,ca.parsingFlags=Ti,ca.set=ft,ca.startOf=yi,ca.subtract=Fr,ca.toArray=xi,ca.toObject=Mi,ca.toDate=vi,ca.toISOString=ti,ca.inspect=ei,"undefined"!=typeof Symbol&&null!=Symbol.for&&(ca[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ca.toJSON=Li,ca.toString=Qr,ca.unix=ki,ca.valueOf=bi,ca.creationData=Di,ca.eraName=Ai,ca.eraNarrow=Oi,ca.eraAbbr=Ni,ca.eraYear=Bi,ca.year=ye,ca.isLeapYear=ge,ca.weekYear=zi,ca.isoWeekYear=Ui,ca.quarter=ca.quarters=Qi,ca.month=de,ca.daysInMonth=he,ca.week=ca.weeks=Ye,ca.isoWeek=ca.isoWeeks=Ee,ca.weeksInYear=Gi,ca.weeksInWeekYear=Ji,ca.isoWeeksInYear=qi,ca.isoWeeksInISOWeekYear=Vi,ca.date=ta,ca.day=ca.days=ze,ca.weekday=Ue,ca.isoWeekday=qe,ca.dayOfYear=ea,ca.hour=ca.hours=an,ca.minute=ca.minutes=na,ca.second=ca.seconds=aa,ca.millisecond=ca.milliseconds=ia,ca.utcOffset=fr,ca.utc=gr,ca.local=br,ca.parseZone=kr,ca.hasAlignedHourOffset=vr,ca.isDST=xr,ca.isLocal=Lr,ca.isUtcOffset=wr,ca.isUtc=Tr,ca.isUTC=Tr,ca.zoneAbbr=oa,ca.zoneName=la,ca.dates=T("dates accessor is deprecated. Use date instead.",ta),ca.months=T("months accessor is deprecated. Use month instead",de),ca.years=T("years accessor is deprecated. Use year instead",ye),ca.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",yr),ca.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Mr);var ma=O.prototype;function _a(t,e,n,r){var i=bn(),a=p().set(r,e);return i[n](a,t)}function pa(t,e,n){if(d(t)&&(e=t,t=void 0),t=t||"",null!=e)return _a(t,e,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=_a(t,r,n,"month");return i}function fa(t,e,n,r){"boolean"==typeof t?(d(e)&&(n=e,e=void 0),e=e||""):(n=e=t,t=!1,d(e)&&(n=e,e=void 0),e=e||"");var i,a=bn(),s=t?a._week.dow:0,o=[];if(null!=n)return _a(e,(n+s)%7,r,"day");for(i=0;i<7;i++)o[i]=_a(e,(i+s)%7,r,"day");return o}function ya(t,e){return pa(t,e,"months")}function ga(t,e){return pa(t,e,"monthsShort")}function ba(t,e,n){return fa(t,e,n,"weekdays")}function ka(t,e,n){return fa(t,e,n,"weekdaysShort")}function va(t,e,n){return fa(t,e,n,"weekdaysMin")}ma.calendar=B,ma.longDateFormat=q,ma.invalidDate=G,ma.ordinal=K,ma.preparse=ha,ma.postformat=ha,ma.relativeTime=tt,ma.pastFuture=et,ma.set=C,ma.eras=Yi,ma.erasParse=Ei,ma.erasConvertYear=Ci,ma.erasAbbrRegex=Ii,ma.erasNameRegex=Fi,ma.erasNarrowRegex=Pi,ma.months=se,ma.monthsShort=oe,ma.monthsParse=ce,ma.monthsRegex=_e,ma.monthsShortRegex=me,ma.week=we,ma.firstDayOfYear=De,ma.firstDayOfWeek=Se,ma.weekdays=Re,ma.weekdaysMin=$e,ma.weekdaysShort=He,ma.weekdaysParse=We,ma.weekdaysRegex=Ve,ma.weekdaysShortRegex=Ge,ma.weekdaysMinRegex=Je,ma.isPM=nn,ma.meridiem=sn,fn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===dt(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),i.lang=T("moment.lang is deprecated. Use moment.locale instead.",fn),i.langData=T("moment.langData is deprecated. Use moment.localeData instead.",bn);var xa=Math.abs;function Ma(){var t=this._data;return this._milliseconds=xa(this._milliseconds),this._days=xa(this._days),this._months=xa(this._months),t.milliseconds=xa(t.milliseconds),t.seconds=xa(t.seconds),t.minutes=xa(t.minutes),t.hours=xa(t.hours),t.months=xa(t.months),t.years=xa(t.years),this}function La(t,e,n,r){var i=Yr(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function wa(t,e){return La(this,t,e,1)}function Ta(t,e){return La(this,t,e,-1)}function Sa(t){return t<0?Math.floor(t):Math.ceil(t)}function Da(){var t,e,n,r,i,a=this._milliseconds,s=this._days,o=this._months,l=this._data;return a>=0&&s>=0&&o>=0||a<=0&&s<=0&&o<=0||(a+=864e5*Sa(Ea(o)+s),s=0,o=0),l.milliseconds=a%1e3,t=ut(a/1e3),l.seconds=t%60,e=ut(t/60),l.minutes=e%60,n=ut(e/60),l.hours=n%24,s+=ut(n/24),o+=i=ut(Ya(s)),s-=Sa(Ea(i)),r=ut(o/12),o%=12,l.days=s,l.months=o,l.years=r,this}function Ya(t){return 4800*t/146097}function Ea(t){return 146097*t/4800}function Ca(t){if(!this.isValid())return NaN;var e,n,r=this._milliseconds;if("month"===(t=it(t))||"quarter"===t||"year"===t)switch(e=this._days+r/864e5,n=this._months+Ya(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(Ea(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return 24*e+r/36e5;case"minute":return 1440*e+r/6e4;case"second":return 86400*e+r/1e3;case"millisecond":return Math.floor(864e5*e)+r;default:throw new Error("Unknown unit "+t)}}function Aa(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*dt(this._months/12):NaN}function Oa(t){return function(){return this.as(t)}}var Na=Oa("ms"),Ba=Oa("s"),Fa=Oa("m"),Ia=Oa("h"),Pa=Oa("d"),ja=Oa("w"),Ra=Oa("M"),Ha=Oa("Q"),$a=Oa("y");function Za(){return Yr(this)}function Wa(t){return t=it(t),this.isValid()?this[t+"s"]():NaN}function za(t){return function(){return this.isValid()?this._data[t]:NaN}}var Ua=za("milliseconds"),qa=za("seconds"),Va=za("minutes"),Ga=za("hours"),Ja=za("days"),Xa=za("months"),Ka=za("years");function Qa(){return ut(this.days()/7)}var ts=Math.round,es={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ns(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function rs(t,e,n,r){var i=Yr(t).abs(),a=ts(i.as("s")),s=ts(i.as("m")),o=ts(i.as("h")),l=ts(i.as("d")),c=ts(i.as("M")),u=ts(i.as("w")),d=ts(i.as("y")),h=a<=n.ss&&["s",a]||a<n.s&&["ss",a]||s<=1&&["m"]||s<n.m&&["mm",s]||o<=1&&["h"]||o<n.h&&["hh",o]||l<=1&&["d"]||l<n.d&&["dd",l];return null!=n.w&&(h=h||u<=1&&["w"]||u<n.w&&["ww",u]),(h=h||c<=1&&["M"]||c<n.M&&["MM",c]||d<=1&&["y"]||["yy",d])[2]=e,h[3]=+t>0,h[4]=r,ns.apply(null,h)}function is(t){return void 0===t?ts:"function"==typeof t&&(ts=t,!0)}function as(t,e){return void 0!==es[t]&&(void 0===e?es[t]:(es[t]=e,"s"===t&&(es.ss=e-1),!0))}function ss(t,e){if(!this.isValid())return this.localeData().invalidDate();var n,r,i=!1,a=es;return"object"==typeof t&&(e=t,t=!1),"boolean"==typeof t&&(i=t),"object"==typeof e&&(a=Object.assign({},es,e),null!=e.s&&null==e.ss&&(a.ss=e.s-1)),r=rs(this,!i,a,n=this.localeData()),i&&(r=n.pastFuture(+this,r)),n.postformat(r)}var os=Math.abs;function ls(t){return(t>0)-(t<0)||+t}function cs(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,r,i,a,s,o,l=os(this._milliseconds)/1e3,c=os(this._days),u=os(this._months),d=this.asSeconds();return d?(t=ut(l/60),e=ut(t/60),l%=60,t%=60,n=ut(u/12),u%=12,r=l?l.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",a=ls(this._months)!==ls(d)?"-":"",s=ls(this._days)!==ls(d)?"-":"",o=ls(this._milliseconds)!==ls(d)?"-":"",i+"P"+(n?a+n+"Y":"")+(u?a+u+"M":"")+(c?s+c+"D":"")+(e||t||l?"T":"")+(e?o+e+"H":"")+(t?o+t+"M":"")+(l?o+r+"S":"")):"P0D"}var us=or.prototype;return us.isValid=ar,us.abs=Ma,us.add=wa,us.subtract=Ta,us.as=Ca,us.asMilliseconds=Na,us.asSeconds=Ba,us.asMinutes=Fa,us.asHours=Ia,us.asDays=Pa,us.asWeeks=ja,us.asMonths=Ra,us.asQuarters=Ha,us.asYears=$a,us.valueOf=Aa,us._bubble=Da,us.clone=Za,us.get=Wa,us.milliseconds=Ua,us.seconds=qa,us.minutes=Va,us.hours=Ga,us.days=Ja,us.weeks=Qa,us.months=Xa,us.years=Ka,us.humanize=ss,us.toISOString=cs,us.toString=cs,us.toJSON=cs,us.locale=oi,us.localeData=ci,us.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",cs),us.lang=li,H("X",0,0,"unix"),H("x",0,0,"valueOf"),Bt("x",Et),Bt("X",Ot),Rt("X",(function(t,e,n){n._d=new Date(1e3*parseFloat(t))})),Rt("x",(function(t,e,n){n._d=new Date(dt(t))})),i.version="2.29.4",a(Jn),i.fn=ca,i.min=tr,i.max=er,i.now=nr,i.utc=p,i.unix=ua,i.months=ya,i.isDate=h,i.locale=fn,i.invalid=b,i.duration=Yr,i.isMoment=L,i.weekdays=ba,i.parseZone=da,i.localeData=bn,i.isDuration=lr,i.monthsShort=ga,i.weekdaysMin=va,i.defineLocale=yn,i.updateLocale=gn,i.locales=kn,i.weekdaysShort=ka,i.normalizeUnits=it,i.relativeTimeRounding=is,i.relativeTimeThreshold=as,i.calendarFormat=$r,i.prototype=ca,i.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},i}()},87594:(t,e)=>{function n(t){let e,n=[];for(let r of t.split(",").map((t=>t.trim())))if(/^-?\d+$/.test(r))n.push(parseInt(r,10));else if(e=r.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[t,r,i,a]=e;if(r&&a){r=parseInt(r),a=parseInt(a);const t=r<a?1:-1;"-"!==i&&".."!==i&&"\u2025"!==i||(a+=t);for(let e=r;e!==a;e+=t)n.push(e)}}return n}e.default=n,t.exports=n},59373:(t,e,n)=>{"use strict";function r(t,e){let n;if(void 0===e)for(const r of t)null!=r&&(n<r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function i(t,e){let n;if(void 0===e)for(const r of t)null!=r&&(n>r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function a(t){return t}n.d(e,{Nb1:()=>so,LLu:()=>_,F5q:()=>m,$0Z:()=>ko,Dts:()=>xo,WQY:()=>Lo,qpX:()=>To,u93:()=>So,tFB:()=>Yo,YY7:()=>Ao,OvA:()=>No,dCK:()=>Fo,zgE:()=>jo,fGX:()=>Ho,$m7:()=>Zo,c_6:()=>co,fxm:()=>zo,FdL:()=>Qo,ak_:()=>tl,SxZ:()=>rl,eA_:()=>al,jsv:()=>ol,iJ:()=>sl,JHv:()=>hr,jvg:()=>mo,Fp7:()=>r,VV$:()=>i,ve8:()=>fo,BYU:()=>ai,PKp:()=>mi,Xf:()=>Ys,Ys:()=>Es,td_:()=>Cs,YPS:()=>qn,rr1:()=>Ei,i$Z:()=>la,WQD:()=>Di,Z_i:()=>Ti,F0B:()=>Gi,NGh:()=>Ni});var s=1e-6;function o(t){return"translate("+t+",0)"}function l(t){return"translate(0,"+t+")"}function c(t){return e=>+t(e)}function u(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function d(){return!this.__axis}function h(t,e){var n=[],r=null,i=null,h=6,m=6,_=3,p="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,f=1===t||4===t?-1:1,y=4===t||2===t?"x":"y",g=1===t||3===t?o:l;function b(o){var l=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,b=null==i?e.tickFormat?e.tickFormat.apply(e,n):a:i,k=Math.max(h,0)+_,v=e.range(),x=+v[0]+p,M=+v[v.length-1]+p,L=(e.bandwidth?u:c)(e.copy(),p),w=o.selection?o.selection():o,T=w.selectAll(".domain").data([null]),S=w.selectAll(".tick").data(l,e).order(),D=S.exit(),Y=S.enter().append("g").attr("class","tick"),E=S.select("line"),C=S.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(Y),E=E.merge(Y.append("line").attr("stroke","currentColor").attr(y+"2",f*h)),C=C.merge(Y.append("text").attr("fill","currentColor").attr(y,f*k).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),o!==w&&(T=T.transition(o),S=S.transition(o),E=E.transition(o),C=C.transition(o),D=D.transition(o).attr("opacity",s).attr("transform",(function(t){return isFinite(t=L(t))?g(t+p):this.getAttribute("transform")})),Y.attr("opacity",s).attr("transform",(function(t){var e=this.parentNode.__axis;return g((e&&isFinite(e=e(t))?e:L(t))+p)}))),D.remove(),T.attr("d",4===t||2===t?m?"M"+f*m+","+x+"H"+p+"V"+M+"H"+f*m:"M"+p+","+x+"V"+M:m?"M"+x+","+f*m+"V"+p+"H"+M+"V"+f*m:"M"+x+","+p+"H"+M),S.attr("opacity",1).attr("transform",(function(t){return g(L(t)+p)})),E.attr(y+"2",f*h),C.attr(y,f*k).text(b),w.filter(d).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=L}))}return b.scale=function(t){return arguments.length?(e=t,b):e},b.ticks=function(){return n=Array.from(arguments),b},b.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),b):n.slice()},b.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),b):r&&r.slice()},b.tickFormat=function(t){return arguments.length?(i=t,b):i},b.tickSize=function(t){return arguments.length?(h=m=+t,b):h},b.tickSizeInner=function(t){return arguments.length?(h=+t,b):h},b.tickSizeOuter=function(t){return arguments.length?(m=+t,b):m},b.tickPadding=function(t){return arguments.length?(_=+t,b):_},b.offset=function(t){return arguments.length?(p=+t,b):p},b}function m(t){return h(1,t)}function _(t){return h(3,t)}function p(){}function f(t){return null==t?p:function(){return this.querySelector(t)}}function y(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function g(){return[]}function b(t){return null==t?g:function(){return this.querySelectorAll(t)}}function k(t){return function(){return this.matches(t)}}function v(t){return function(e){return e.matches(t)}}var x=Array.prototype.find;function M(){return this.firstElementChild}var L=Array.prototype.filter;function w(){return Array.from(this.children)}function T(t){return new Array(t.length)}function S(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function D(t){return function(){return t}}function Y(t,e,n,r,i,a){for(var s,o=0,l=e.length,c=a.length;o<c;++o)(s=e[o])?(s.__data__=a[o],r[o]=s):n[o]=new S(t,a[o]);for(;o<l;++o)(s=e[o])&&(i[o]=s)}function E(t,e,n,r,i,a,s){var o,l,c,u=new Map,d=e.length,h=a.length,m=new Array(d);for(o=0;o<d;++o)(l=e[o])&&(m[o]=c=s.call(l,l.__data__,o,e)+"",u.has(c)?i[o]=l:u.set(c,l));for(o=0;o<h;++o)c=s.call(t,a[o],o,a)+"",(l=u.get(c))?(r[o]=l,l.__data__=a[o],u.delete(c)):n[o]=new S(t,a[o]);for(o=0;o<d;++o)(l=e[o])&&u.get(m[o])===l&&(i[o]=l)}function C(t){return t.__data__}function A(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function O(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}S.prototype={constructor:S,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var N="http://www.w3.org/1999/xhtml";const B={svg:"http://www.w3.org/2000/svg",xhtml:N,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function F(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),B.hasOwnProperty(e)?{space:B[e],local:t}:t}function I(t){return function(){this.removeAttribute(t)}}function P(t){return function(){this.removeAttributeNS(t.space,t.local)}}function j(t,e){return function(){this.setAttribute(t,e)}}function R(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function H(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Z(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function W(t){return function(){this.style.removeProperty(t)}}function z(t,e,n){return function(){this.style.setProperty(t,e,n)}}function U(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function q(t,e){return t.style.getPropertyValue(e)||Z(t).getComputedStyle(t,null).getPropertyValue(e)}function V(t){return function(){delete this[t]}}function G(t,e){return function(){this[t]=e}}function J(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function X(t){return t.trim().split(/^|\s+/)}function K(t){return t.classList||new Q(t)}function Q(t){this._node=t,this._names=X(t.getAttribute("class")||"")}function tt(t,e){for(var n=K(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function et(t,e){for(var n=K(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function nt(t){return function(){tt(this,t)}}function rt(t){return function(){et(this,t)}}function it(t,e){return function(){(e.apply(this,arguments)?tt:et)(this,t)}}function at(){this.textContent=""}function st(t){return function(){this.textContent=t}}function ot(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function lt(){this.innerHTML=""}function ct(t){return function(){this.innerHTML=t}}function ut(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function dt(){this.nextSibling&&this.parentNode.appendChild(this)}function ht(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===N&&e.documentElement.namespaceURI===N?e.createElement(t):e.createElementNS(n,t)}}function _t(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function pt(t){var e=F(t);return(e.local?_t:mt)(e)}function ft(){return null}function yt(){var t=this.parentNode;t&&t.removeChild(this)}function gt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function bt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function kt(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function vt(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r<a;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function xt(t,e,n){return function(){var r,i=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var s=0,o=i.length;s<o;++s)if((r=i[s]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),void(r.value=e);this.addEventListener(t.type,a,n),r={type:t.type,name:t.name,value:e,listener:a,options:n},i?i.push(r):this.__on=[r]}}function Mt(t,e,n){var r=Z(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Lt(t,e){return function(){return Mt(this,t,e)}}function wt(t,e){return function(){return Mt(this,t,e.apply(this,arguments))}}Q.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Tt=[null];function St(t,e){this._groups=t,this._parents=e}function Dt(){return new St([[document.documentElement]],Tt)}St.prototype=Dt.prototype={constructor:St,select:function(t){"function"!=typeof t&&(t=f(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,s,o=e[i],l=o.length,c=r[i]=new Array(l),u=0;u<l;++u)(a=o[u])&&(s=t.call(a,a.__data__,u,o))&&("__data__"in a&&(s.__data__=a.__data__),c[u]=s);return new St(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return y(t.apply(this,arguments))}}(t):b(t);for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var s,o=e[a],l=o.length,c=0;c<l;++c)(s=o[c])&&(r.push(t.call(s,s.__data__,c,o)),i.push(s));return new St(r,i)},selectChild:function(t){return this.select(null==t?M:function(t){return function(){return x.call(this.children,t)}}("function"==typeof t?t:v(t)))},selectChildren:function(t){return this.selectAll(null==t?w:function(t){return function(){return L.call(this.children,t)}}("function"==typeof t?t:v(t)))},filter:function(t){"function"!=typeof t&&(t=k(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,s=e[i],o=s.length,l=r[i]=[],c=0;c<o;++c)(a=s[c])&&t.call(a,a.__data__,c,s)&&l.push(a);return new St(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,C);var n=e?E:Y,r=this._parents,i=this._groups;"function"!=typeof t&&(t=D(t));for(var a=i.length,s=new Array(a),o=new Array(a),l=new Array(a),c=0;c<a;++c){var u=r[c],d=i[c],h=d.length,m=A(t.call(u,u&&u.__data__,c,r)),_=m.length,p=o[c]=new Array(_),f=s[c]=new Array(_),y=l[c]=new Array(h);n(u,d,p,f,y,m,e);for(var g,b,k=0,v=0;k<_;++k)if(g=p[k]){for(k>=v&&(v=k+1);!(b=f[v])&&++v<_;);g._next=b||null}}return(s=new St(s,r))._enter=o,s._exit=l,s},enter:function(){return new St(this._enter||this._groups.map(T),this._parents)},exit:function(){return new St(this._exit||this._groups.map(T),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,a=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?a.remove():n(a),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,a=r.length,s=Math.min(i,a),o=new Array(i),l=0;l<s;++l)for(var c,u=n[l],d=r[l],h=u.length,m=o[l]=new Array(h),_=0;_<h;++_)(c=u[_]||d[_])&&(m[_]=c);for(;l<i;++l)o[l]=n[l];return new St(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],a=i.length-1,s=i[a];--a>=0;)(r=i[a])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=O);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var s,o=n[a],l=o.length,c=i[a]=new Array(l),u=0;u<l;++u)(s=o[u])&&(c[u]=s);c.sort(e)}return new St(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var s=r[i];if(s)return s}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,a=e[n],s=0,o=a.length;s<o;++s)(i=a[s])&&t.call(i,i.__data__,s,a);return this},attr:function(t,e){var n=F(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?P:I:"function"==typeof e?n.local?$:H:n.local?R:j)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?W:"function"==typeof e?U:z)(t,e,null==n?"":n)):q(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?V:"function"==typeof e?J:G)(t,e)):this.node()[t]},classed:function(t,e){var n=X(t+"");if(arguments.length<2){for(var r=K(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?it:e?nt:rt)(n,e))},text:function(t){return arguments.length?this.each(null==t?at:("function"==typeof t?ot:st)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?lt:("function"==typeof t?ut:ct)(t)):this.node().innerHTML},raise:function(){return this.each(dt)},lower:function(){return this.each(ht)},append:function(t){var e="function"==typeof t?t:pt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:pt(t),r=null==e?ft:"function"==typeof e?e:f(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(yt)},clone:function(t){return this.select(t?bt:gt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,a=kt(t+""),s=a.length;if(!(arguments.length<2)){for(o=e?xt:vt,r=0;r<s;++r)this.each(o(a[r],e,n));return this}var o=this.node().__on;if(o)for(var l,c=0,u=o.length;c<u;++c)for(r=0,l=o[c];r<s;++r)if((i=a[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?wt:Lt)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],a=0,s=i.length;a<s;++a)(r=i[a])&&(yield r)}};const Yt=Dt;var Et={value:()=>{}};function Ct(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new At(r)}function At(t){this._=t}function Ot(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Nt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Bt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Et,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}At.prototype=Ct.prototype={constructor:At,on:function(t,e){var n,r=this._,i=Ot(t+"",r),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=i[a]).type)r[n]=Bt(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Bt(r[n],t.name,null);return this}for(;++a<s;)if((n=(t=i[a]).type)&&(n=Nt(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new At(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};const Ft=Ct;var It,Pt,jt=0,Rt=0,Ht=0,$t=0,Zt=0,Wt=0,zt="object"==typeof performance&&performance.now?performance:Date,Ut="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function qt(){return Zt||(Ut(Vt),Zt=zt.now()+Wt)}function Vt(){Zt=0}function Gt(){this._call=this._time=this._next=null}function Jt(t,e,n){var r=new Gt;return r.restart(t,e,n),r}function Xt(){Zt=($t=zt.now())+Wt,jt=Rt=0;try{!function(){qt(),++jt;for(var t,e=It;e;)(t=Zt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jt}()}finally{jt=0,function(){var t,e,n=It,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:It=e);Pt=t,Qt(r)}(),Zt=0}}function Kt(){var t=zt.now(),e=t-$t;e>1e3&&(Wt-=e,$t=t)}function Qt(t){jt||(Rt&&(Rt=clearTimeout(Rt)),t-Zt>24?(t<1/0&&(Rt=setTimeout(Xt,t-zt.now()-Wt)),Ht&&(Ht=clearInterval(Ht))):(Ht||($t=zt.now(),Ht=setInterval(Kt,1e3)),jt=1,Ut(Xt)))}function te(t,e,n){var r=new Gt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Gt.prototype=Jt.prototype={constructor:Gt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?qt():+n)+(null==e?0:+e),this._next||Pt===this||(Pt?Pt._next=this:It=this,Pt=this),this._call=t,this._time=n,Qt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qt())}};var ee=Ft("start","end","cancel","interrupt"),ne=[];function re(t,e,n,r,i,a){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(t){n.state=1,n.timer.restart(s,n.delay,n.time),n.delay<=t&&s(t-n.delay)}function s(a){var c,u,d,h;if(1!==n.state)return l();for(c in i)if((h=i[c]).name===n.name){if(3===h.state)return te(s);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+c<e&&(h.state=6,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[c])}if(te((function(){3===n.state&&(n.state=4,n.timer.restart(o,n.delay,n.time),o(a))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(h=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function o(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),a=-1,s=r.length;++a<s;)r[a].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Jt(a,0,n.time)}(t,n,{name:e,index:r,group:i,on:ee,tween:ne,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ie(t,e){var n=se(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function ae(t,e){var n=se(t,e);if(n.state>3)throw new Error("too late; already running");return n}function se(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function oe(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var le,ce=180/Math.PI,ue={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function de(t,e,n,r,i,a){var s,o,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(o=Math.sqrt(n*n+r*r))&&(n/=o,r/=o,l/=o),t*r<e*n&&(t=-t,e=-e,l=-l,s=-s),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*ce,skewX:Math.atan(l)*ce,scaleX:s,scaleY:o}}function he(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(a,s){var o=[],l=[];return a=t(a),s=t(s),function(t,r,i,a,s,o){if(t!==i||r!==a){var l=s.push("translate(",null,e,null,n);o.push({i:l-4,x:oe(t,i)},{i:l-2,x:oe(r,a)})}else(i||a)&&s.push("translate("+i+e+a+n)}(a.translateX,a.translateY,s.translateX,s.translateY,o,l),function(t,e,n,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:oe(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,s.rotate,o,l),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:oe(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,s.skewX,o,l),function(t,e,n,r,a,s){if(t!==n||e!==r){var o=a.push(i(a)+"scale(",null,",",null,")");s.push({i:o-4,x:oe(t,n)},{i:o-2,x:oe(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,s.scaleX,s.scaleY,o,l),a=s=null,function(t){for(var e,n=-1,r=l.length;++n<r;)o[(e=l[n]).i]=e.x(t);return o.join("")}}}var me=he((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ue:de(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),_e=he((function(t){return null==t?ue:(le||(le=document.createElementNS("http://www.w3.org/2000/svg","g")),le.setAttribute("transform",t),(t=le.transform.baseVal.consolidate())?de((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ue)}),", ",")",")");function pe(t,e){var n,r;return function(){var i=ae(this,t),a=i.tween;if(a!==n)for(var s=0,o=(r=n=a).length;s<o;++s)if(r[s].name===e){(r=r.slice()).splice(s,1);break}i.tween=r}}function fe(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=ae(this,t),s=a.tween;if(s!==r){i=(r=s).slice();for(var o={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=o;break}l===c&&i.push(o)}a.tween=i}}function ye(t,e,n){var r=t._id;return t.each((function(){var t=ae(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return se(t,r).value[e]}}function ge(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function be(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ke(){}var ve=.7,xe=1/ve,Me="\\s*([+-]?\\d+)\\s*",Le="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Te=/^#([0-9a-f]{3,8})$/,Se=new RegExp(`^rgb\\(${Me},${Me},${Me}\\)$`),De=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),Ye=new RegExp(`^rgba\\(${Me},${Me},${Me},${Le}\\)$`),Ee=new RegExp(`^rgba\\(${we},${we},${we},${Le}\\)$`),Ce=new RegExp(`^hsl\\(${Le},${we},${we}\\)$`),Ae=new RegExp(`^hsla\\(${Le},${we},${we},${Le}\\)$`),Oe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ne(){return this.rgb().formatHex()}function Be(){return this.rgb().formatRgb()}function Fe(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Te.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Ie(e):3===n?new He(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Pe(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Pe(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Se.exec(t))?new He(e[1],e[2],e[3],1):(e=De.exec(t))?new He(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ye.exec(t))?Pe(e[1],e[2],e[3],e[4]):(e=Ee.exec(t))?Pe(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ce.exec(t))?qe(e[1],e[2]/100,e[3]/100,1):(e=Ae.exec(t))?qe(e[1],e[2]/100,e[3]/100,e[4]):Oe.hasOwnProperty(t)?Ie(Oe[t]):"transparent"===t?new He(NaN,NaN,NaN,0):null}function Ie(t){return new He(t>>16&255,t>>8&255,255&t,1)}function Pe(t,e,n,r){return r<=0&&(t=e=n=NaN),new He(t,e,n,r)}function je(t){return t instanceof ke||(t=Fe(t)),t?new He((t=t.rgb()).r,t.g,t.b,t.opacity):new He}function Re(t,e,n,r){return 1===arguments.length?je(t):new He(t,e,n,null==r?1:r)}function He(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function $e(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}`}function Ze(){const t=We(this.opacity);return`${1===t?"rgb(":"rgba("}${ze(this.r)}, ${ze(this.g)}, ${ze(this.b)}${1===t?")":`, ${t})`}`}function We(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ze(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ue(t){return((t=ze(t))<16?"0":"")+t.toString(16)}function qe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ge(t,e,n,r)}function Ve(t){if(t instanceof Ge)return new Ge(t.h,t.s,t.l,t.opacity);if(t instanceof ke||(t=Fe(t)),!t)return new Ge;if(t instanceof Ge)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),s=NaN,o=a-i,l=(a+i)/2;return o?(s=e===a?(n-r)/o+6*(n<r):n===a?(r-e)/o+2:(e-n)/o+4,o/=l<.5?a+i:2-a-i,s*=60):o=l>0&&l<1?0:s,new Ge(s,o,l,t.opacity)}function Ge(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Je(t){return(t=(t||0)%360)<0?t+360:t}function Xe(t){return Math.max(0,Math.min(1,t||0))}function Ke(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Qe(t,e,n,r,i){var a=t*t,s=a*t;return((1-3*t+3*a-s)*e+(4-6*a+3*s)*n+(1+3*t+3*a-3*s)*r+s*i)/6}ge(ke,Fe,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ne,formatHex:Ne,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ve(this).formatHsl()},formatRgb:Be,toString:Be}),ge(He,Re,be(ke,{brighter(t){return t=null==t?xe:Math.pow(xe,t),new He(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ve:Math.pow(ve,t),new He(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new He(ze(this.r),ze(this.g),ze(this.b),We(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:$e,formatHex:$e,formatHex8:function(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}${Ue(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ze,toString:Ze})),ge(Ge,(function(t,e,n,r){return 1===arguments.length?Ve(t):new Ge(t,e,n,null==r?1:r)}),be(ke,{brighter(t){return t=null==t?xe:Math.pow(xe,t),new Ge(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ve:Math.pow(ve,t),new Ge(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new He(Ke(t>=240?t-240:t+120,i,r),Ke(t,i,r),Ke(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ge(Je(this.h),Xe(this.s),Xe(this.l),We(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=We(this.opacity);return`${1===t?"hsl(":"hsla("}${Je(this.h)}, ${100*Xe(this.s)}%, ${100*Xe(this.l)}%${1===t?")":`, ${t})`}`}}));const tn=t=>()=>t;function en(t,e){return function(n){return t+n*e}}function nn(t){return 1==(t=+t)?rn:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):tn(isNaN(e)?n:e)}}function rn(t,e){var n=e-t;return n?en(t,n):tn(isNaN(t)?e:t)}const an=function t(e){var n=nn(e);function r(t,e){var r=n((t=Re(t)).r,(e=Re(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),s=rn(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function sn(t){return function(e){var n,r,i=e.length,a=new Array(i),s=new Array(i),o=new Array(i);for(n=0;n<i;++n)r=Re(e[n]),a[n]=r.r||0,s[n]=r.g||0,o[n]=r.b||0;return a=t(a),s=t(s),o=t(o),r.opacity=1,function(t){return r.r=a(t),r.g=s(t),r.b=o(t),r+""}}}sn((function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],s=r>0?t[r-1]:2*i-a,o=r<e-1?t[r+2]:2*a-i;return Qe((n-r/e)*e,s,i,a,o)}})),sn((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],a=t[r%e],s=t[(r+1)%e],o=t[(r+2)%e];return Qe((n-r/e)*e,i,a,s,o)}}));var on=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ln=new RegExp(on.source,"g");function cn(t,e){var n,r,i,a=on.lastIndex=ln.lastIndex=0,s=-1,o=[],l=[];for(t+="",e+="";(n=on.exec(t))&&(r=ln.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),o[s]?o[s]+=i:o[++s]=i),(n=n[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,l.push({i:s,x:oe(n,r)})),a=ln.lastIndex;return a<e.length&&(i=e.slice(a),o[s]?o[s]+=i:o[++s]=i),o.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)o[(n=l[r]).i]=n.x(t);return o.join("")})}function un(t,e){var n;return("number"==typeof e?oe:e instanceof Fe?an:(n=Fe(e))?(e=n,an):cn)(t,e)}function dn(t){return function(){this.removeAttribute(t)}}function hn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function mn(t,e,n){var r,i,a=n+"";return function(){var s=this.getAttribute(t);return s===a?null:s===r?i:i=e(r=s,n)}}function _n(t,e,n){var r,i,a=n+"";return function(){var s=this.getAttributeNS(t.space,t.local);return s===a?null:s===r?i:i=e(r=s,n)}}function pn(t,e,n){var r,i,a;return function(){var s,o,l=n(this);if(null!=l)return(s=this.getAttribute(t))===(o=l+"")?null:s===r&&o===i?a:(i=o,a=e(r=s,l));this.removeAttribute(t)}}function fn(t,e,n){var r,i,a;return function(){var s,o,l=n(this);if(null!=l)return(s=this.getAttributeNS(t.space,t.local))===(o=l+"")?null:s===r&&o===i?a:(i=o,a=e(r=s,l));this.removeAttributeNS(t.space,t.local)}}function yn(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function gn(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function bn(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&gn(t,i)),n}return i._value=e,i}function kn(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&yn(t,i)),n}return i._value=e,i}function vn(t,e){return function(){ie(this,t).delay=+e.apply(this,arguments)}}function xn(t,e){return e=+e,function(){ie(this,t).delay=e}}function Mn(t,e){return function(){ae(this,t).duration=+e.apply(this,arguments)}}function Ln(t,e){return e=+e,function(){ae(this,t).duration=e}}function wn(t,e){if("function"!=typeof e)throw new Error;return function(){ae(this,t).ease=e}}function Tn(t,e,n){var r,i,a=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?ie:ae;return function(){var s=a(this,t),o=s.on;o!==r&&(i=(r=o).copy()).on(e,n),s.on=i}}var Sn=Yt.prototype.constructor;function Dn(t){return function(){this.style.removeProperty(t)}}function Yn(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function En(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&Yn(t,a,n)),r}return a._value=e,a}function Cn(t){return function(e){this.textContent=t.call(this,e)}}function An(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Cn(r)),e}return r._value=t,r}var On=0;function Nn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Bn(){return++On}var Fn=Yt.prototype;Nn.prototype=function(t){return Yt().transition(t)}.prototype={constructor:Nn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=f(t));for(var r=this._groups,i=r.length,a=new Array(i),s=0;s<i;++s)for(var o,l,c=r[s],u=c.length,d=a[s]=new Array(u),h=0;h<u;++h)(o=c[h])&&(l=t.call(o,o.__data__,h,c))&&("__data__"in o&&(l.__data__=o.__data__),d[h]=l,re(d[h],e,n,h,d,se(o,n)));return new Nn(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=b(t));for(var r=this._groups,i=r.length,a=[],s=[],o=0;o<i;++o)for(var l,c=r[o],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var h,m=t.call(l,l.__data__,d,c),_=se(l,n),p=0,f=m.length;p<f;++p)(h=m[p])&&re(h,e,n,p,m,_);a.push(m),s.push(l)}return new Nn(a,s,e,n)},selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:function(t){"function"!=typeof t&&(t=k(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,s=e[i],o=s.length,l=r[i]=[],c=0;c<o;++c)(a=s[c])&&t.call(a,a.__data__,c,s)&&l.push(a);return new Nn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),s=new Array(r),o=0;o<a;++o)for(var l,c=e[o],u=n[o],d=c.length,h=s[o]=new Array(d),m=0;m<d;++m)(l=c[m]||u[m])&&(h[m]=l);for(;o<r;++o)s[o]=e[o];return new Nn(s,this._parents,this._name,this._id)},selection:function(){return new Sn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Bn(),r=this._groups,i=r.length,a=0;a<i;++a)for(var s,o=r[a],l=o.length,c=0;c<l;++c)if(s=o[c]){var u=se(s,e);re(s,t,n,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Nn(r,this._parents,t,n)},call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:function(t,e){var n=this._id;return arguments.length<2?se(this.node(),n).on.on(t):this.each(Tn(n,t,e))},attr:function(t,e){var n=F(t),r="transform"===n?_e:un;return this.attrTween(t,"function"==typeof e?(n.local?fn:pn)(n,r,ye(this,"attr."+t,e)):null==e?(n.local?hn:dn)(n):(n.local?_n:mn)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=F(t);return this.tween(n,(r.local?bn:kn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?me:un;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var a=q(this,t),s=(this.style.removeProperty(t),q(this,t));return a===s?null:a===n&&s===r?i:i=e(n=a,r=s)}}(t,r)).on("end.style."+t,Dn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,a;return function(){var s=q(this,t),o=n(this),l=o+"";return null==o&&(this.style.removeProperty(t),l=o=q(this,t)),s===l?null:s===r&&l===i?a:(i=l,a=e(r=s,o))}}(t,r,ye(this,"style."+t,e))).each(function(t,e){var n,r,i,a,s="style."+e,o="end."+s;return function(){var l=ae(this,t),c=l.on,u=null==l.value[s]?a||(a=Dn(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(o,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,a=n+"";return function(){var s=q(this,t);return s===a?null:s===r?i:i=e(r=s,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,En(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(ye(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,An(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=se(this.node(),n).tween,a=0,s=i.length;a<s;++a)if((r=i[a]).name===t)return r.value;return null}return this.each((null==e?pe:fe)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?vn:xn)(e,t)):se(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Mn:Ln)(e,t)):se(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(wn(e,t)):se(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;ae(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(a,s){var o={value:s},l={value:function(){0==--i&&a()}};n.each((function(){var n=ae(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),n.on=e})),0===i&&a()}))},[Symbol.iterator]:Fn[Symbol.iterator]};var In={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Pn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}Yt.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,r,i,a=t.__transition,s=!0;if(a){for(i in e=null==e?null:e+"",a)(n=a[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete a[i]):s=!1;s&&delete t.__transition}}(this,t)}))},Yt.prototype.transition=function(t){var e,n;t instanceof Nn?(e=t._id,t=t._name):(e=Bn(),(n=In).time=qt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var s,o=r[a],l=o.length,c=0;c<l;++c)(s=o[c])&&re(s,t,e,c,o,n||Pn(s,e));return new Nn(r,this._parents,t,e)};const{abs:jn,max:Rn,min:Hn}=Math;function $n(t){return[+t[0],+t[1]]}function Zn(t){return[$n(t[0]),$n(t[1])]}["w","e"].map(Wn),["n","s"].map(Wn),["n","w","e","s","nw","ne","sw","se"].map(Wn);function Wn(t){return{type:t}}function zn(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function Un(t){return(e,n)=>function(t,e){return fetch(t,e).then(zn)}(e,n).then((e=>(new DOMParser).parseFromString(e,t)))}Un("application/xml");Un("text/html");var qn=Un("image/svg+xml");const Vn=Math.PI/180,Gn=180/Math.PI,Jn=.96422,Xn=.82521,Kn=4/29,Qn=6/29,tr=3*Qn*Qn;function er(t){if(t instanceof nr)return new nr(t.l,t.a,t.b,t.opacity);if(t instanceof cr)return ur(t);t instanceof He||(t=je(t));var e,n,r=sr(t.r),i=sr(t.g),a=sr(t.b),s=rr((.2225045*r+.7168786*i+.0606169*a)/1);return r===i&&i===a?e=n=s:(e=rr((.4360747*r+.3850649*i+.1430804*a)/Jn),n=rr((.0139322*r+.0971045*i+.7141733*a)/Xn)),new nr(116*s-16,500*(e-s),200*(s-n),t.opacity)}function nr(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function rr(t){return t>.008856451679035631?Math.pow(t,1/3):t/tr+Kn}function ir(t){return t>Qn?t*t*t:tr*(t-Kn)}function ar(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function sr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function or(t){if(t instanceof cr)return new cr(t.h,t.c,t.l,t.opacity);if(t instanceof nr||(t=er(t)),0===t.a&&0===t.b)return new cr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Gn;return new cr(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function lr(t,e,n,r){return 1===arguments.length?or(t):new cr(t,e,n,null==r?1:r)}function cr(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function ur(t){if(isNaN(t.h))return new nr(t.l,0,0,t.opacity);var e=t.h*Vn;return new nr(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function dr(t){return function(e,n){var r=t((e=lr(e)).h,(n=lr(n)).h),i=rn(e.c,n.c),a=rn(e.l,n.l),s=rn(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=a(t),e.opacity=s(t),e+""}}}ge(nr,(function(t,e,n,r){return 1===arguments.length?er(t):new nr(t,e,n,null==r?1:r)}),be(ke,{brighter(t){return new nr(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new nr(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new He(ar(3.1338561*(e=Jn*ir(e))-1.6168667*(t=1*ir(t))-.4906146*(n=Xn*ir(n))),ar(-.9787684*e+1.9161415*t+.033454*n),ar(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),ge(cr,lr,be(ke,{brighter(t){return new cr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new cr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return ur(this).rgb()}}));const hr=dr((function(t,e){var n=e-t;return n?en(t,n>180||n<-180?n-360*Math.round(n/360):n):tn(isNaN(t)?e:t)}));dr(rn);const mr=Math.sqrt(50),_r=Math.sqrt(10),pr=Math.sqrt(2);function fr(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),s=a>=mr?10:a>=_r?5:a>=pr?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/s,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*s,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=n&&n<2?fr(t,e,2*n):[o,l,c]}function yr(t,e,n){return fr(t=+t,e=+e,n=+n)[2]}function gr(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?yr(e,t,n):yr(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function br(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function kr(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vr(t){let e,n,r;function i(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<0?i=e+1:a=e}while(i<a)}return i}return 2!==t.length?(e=br,n=(e,n)=>br(t(e),n),r=(e,n)=>t(e)-n):(e=t===br||t===kr?t:xr,n=t,r=t),{left:i,center:function(t,e,n=0,a=t.length){const s=i(t,e,n,a-1);return s>n&&r(t[s-1],e)>-r(t[s],e)?s-1:s},right:function(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<=0?i=e+1:a=e}while(i<a)}return i}}}function xr(){return 0}const Mr=vr(br),Lr=Mr.right,wr=(Mr.left,vr((function(t){return null===t?NaN:+t})).center,Lr);function Tr(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),s=new Array(r);for(n=0;n<i;++n)a[n]=Er(t[n],e[n]);for(;n<r;++n)s[n]=e[n];return function(t){for(n=0;n<i;++n)s[n]=a[n](t);return s}}function Sr(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Dr(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Er(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}function Yr(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(a){for(n=0;n<r;++n)i[n]=t[n]*(1-a)+e[n]*a;return i}}function Er(t,e){var n,r,i=typeof e;return null==e||"boolean"===i?tn(e):("number"===i?oe:"string"===i?(n=Fe(e))?(e=n,an):cn:e instanceof Fe?an:e instanceof Date?Sr:(r=e,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(e)?Tr:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Dr:oe:Yr))(t,e)}function Cr(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Ar(t){return+t}var Or=[0,1];function Nr(t){return t}function Br(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function Fr(t,e,n){var r=t[0],i=t[1],a=e[0],s=e[1];return i<r?(r=Br(i,r),a=n(s,a)):(r=Br(r,i),a=n(a,s)),function(t){return a(r(t))}}function Ir(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),a=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=Br(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(e){var n=wr(t,e,1,r)-1;return a[n](i[n](e))}}function Pr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function jr(){var t,e,n,r,i,a,s=Or,o=Or,l=Er,c=Nr;function u(){var t,e,n,l=Math.min(s.length,o.length);return c!==Nr&&(t=s[0],e=s[l-1],t>e&&(n=t,t=e,e=n),c=function(n){return Math.max(t,Math.min(e,n))}),r=l>2?Ir:Fr,i=a=null,d}function d(e){return null==e||isNaN(e=+e)?n:(i||(i=r(s.map(t),o,l)))(t(c(e)))}return d.invert=function(n){return c(e((a||(a=r(o,s.map(t),oe)))(n)))},d.domain=function(t){return arguments.length?(s=Array.from(t,Ar),u()):s.slice()},d.range=function(t){return arguments.length?(o=Array.from(t),u()):o.slice()},d.rangeRound=function(t){return o=Array.from(t),l=Cr,u()},d.clamp=function(t){return arguments.length?(c=!!t||Nr,u()):c!==Nr},d.interpolate=function(t){return arguments.length?(l=t,u()):l},d.unknown=function(t){return arguments.length?(n=t,d):n},function(n,r){return t=n,e=r,u()}}function Rr(){return jr()(Nr,Nr)}function Hr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}var $r,Zr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wr(t){if(!(e=Zr.exec(t)))throw new Error("invalid format: "+t);var e;return new zr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function zr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Ur(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function qr(t){return(t=Ur(Math.abs(t)))?t[1]:NaN}function Vr(t,e){var n=Ur(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Wr.prototype=zr.prototype,zr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Gr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Vr(100*t,e),r:Vr,s:function(t,e){var n=Ur(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-($r=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return a===s?r:a>s?r+new Array(a-s+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Ur(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Jr(t){return t}var Xr,Kr,Qr,ti=Array.prototype.map,ei=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function ni(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Jr:(e=ti.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],s=0,o=e[0],l=0;i>0&&o>0&&(l+o+1>r&&(o=Math.max(1,r-l)),a.push(t.substring(i-=o,i+o)),!((l+=o+1)>r));)o=e[s=(s+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Jr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ti.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"\u2212":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=Wr(t)).fill,n=t.align,d=t.sign,h=t.symbol,m=t.zero,_=t.width,p=t.comma,f=t.precision,y=t.trim,g=t.type;"n"===g?(p=!0,g="g"):Gr[g]||(void 0===f&&(f=12),y=!0,g="g"),(m||"0"===e&&"="===n)&&(m=!0,e="0",n="=");var b="$"===h?i:"#"===h&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",k="$"===h?a:/[%p]/.test(g)?l:"",v=Gr[g],x=/[defgprs%]/.test(g);function M(t){var i,a,l,h=b,M=k;if("c"===g)M=v(t)+M,t="";else{var L=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:v(Math.abs(t),f),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),L&&0==+t&&"+"!==d&&(L=!1),h=(L?"("===d?d:c:"-"===d||"("===d?"":d)+h,M=("s"===g?ei[8+$r/3]:"")+M+(L&&"("===d?")":""),x)for(i=-1,a=t.length;++i<a;)if(48>(l=t.charCodeAt(i))||l>57){M=(46===l?s+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}p&&!m&&(t=r(t,1/0));var w=h.length+t.length+M.length,T=w<_?new Array(_-w+1).join(e):"";switch(p&&m&&(t=r(T+t,T.length?_-M.length:1/0),T=""),n){case"<":t=h+t+M+T;break;case"=":t=h+T+t+M;break;case"^":t=T.slice(0,w=T.length>>1)+h+t+M+T.slice(w);break;default:t=T+h+t+M}return o(t)}return f=void 0===f?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),M.toString=function(){return t+""},M}return{format:d,formatPrefix:function(t,e){var n=d(((t=Wr(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(qr(e)/3))),i=Math.pow(10,-r),a=ei[8+r/3];return function(t){return n(i*t)+a}}}}function ri(t,e,n,r){var i,a=gr(t,e,n);switch((r=Wr(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(qr(e)/3)))-qr(Math.abs(t)))}(a,s))||(r.precision=i),Qr(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,qr(e)-qr(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-qr(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return Kr(r)}function ii(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const r=e<t,[i,a,s]=r?fr(e,t,n):fr(t,e,n);if(!(a>=i))return[];const o=a-i+1,l=new Array(o);if(r)if(s<0)for(let c=0;c<o;++c)l[c]=(a-c)/-s;else for(let c=0;c<o;++c)l[c]=(a-c)*s;else if(s<0)for(let c=0;c<o;++c)l[c]=(i+c)/-s;else for(let c=0;c<o;++c)l[c]=(i+c)*s;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return ri(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,a=e(),s=0,o=a.length-1,l=a[s],c=a[o],u=10;for(c<l&&(i=l,l=c,c=i,i=s,s=o,o=i);u-- >0;){if((i=yr(l,c,n))===r)return a[s]=l,a[o]=c,e(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function ai(){var t=Rr();return t.copy=function(){return Pr(t,ai())},Hr.apply(t,arguments),ii(t)}Xr=ni({thousands:",",grouping:[3],currency:["$",""]}),Kr=Xr.format,Qr=Xr.formatPrefix;class si extends Map{constructor(t,e=di){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[n,r]of t)this.set(n,r)}get(t){return super.get(li(this,t))}has(t){return super.has(li(this,t))}set(t,e){return super.set(ci(this,t),e)}delete(t){return super.delete(ui(this,t))}}class oi extends Set{constructor(t,e=di){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(li(this,t))}add(t){return super.add(ci(this,t))}delete(t){return super.delete(ui(this,t))}}function li({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function ci({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function ui({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function di(t){return null!==t&&"object"==typeof t?t.valueOf():t}const hi=Symbol("implicit");function mi(){var t=new si,e=[],n=[],r=hi;function i(i){let a=t.get(i);if(void 0===a){if(r!==hi)return r;t.set(i,a=e.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new si;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return mi(e,n).unknown(r)},Hr.apply(i,arguments),i}const _i=1e3,pi=6e4,fi=36e5,yi=864e5,gi=6048e5,bi=2592e6,ki=31536e6,vi=new Date,xi=new Date;function Mi(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,a)=>{const s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return s;let o;do{s.push(o=new Date(+n)),e(n,a),t(n)}while(o<n&&n<r);return s},i.filter=n=>Mi((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})),n&&(i.count=(e,r)=>(vi.setTime(+e),xi.setTime(+r),t(vi),t(xi),Math.floor(n(vi,xi))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t==0:e=>i.count(0,e)%t==0):i:null)),i}const Li=Mi((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));Li.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Mi((e=>{e.setTime(Math.floor(e/t)*t)}),((e,n)=>{e.setTime(+e+n*t)}),((e,n)=>(n-e)/t)):Li:null);Li.range;const wi=Mi((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*_i)}),((t,e)=>(e-t)/_i),(t=>t.getUTCSeconds())),Ti=(wi.range,Mi((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*_i)}),((t,e)=>{t.setTime(+t+e*pi)}),((t,e)=>(e-t)/pi),(t=>t.getMinutes()))),Si=(Ti.range,Mi((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*pi)}),((t,e)=>(e-t)/pi),(t=>t.getUTCMinutes()))),Di=(Si.range,Mi((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*_i-t.getMinutes()*pi)}),((t,e)=>{t.setTime(+t+e*fi)}),((t,e)=>(e-t)/fi),(t=>t.getHours()))),Yi=(Di.range,Mi((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*fi)}),((t,e)=>(e-t)/fi),(t=>t.getUTCHours()))),Ei=(Yi.range,Mi((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*pi)/yi),(t=>t.getDate()-1))),Ci=(Ei.range,Mi((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/yi),(t=>t.getUTCDate()-1))),Ai=(Ci.range,Mi((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/yi),(t=>Math.floor(t/yi))));Ai.range;function Oi(t){return Mi((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*pi)/gi))}const Ni=Oi(0),Bi=Oi(1),Fi=Oi(2),Ii=Oi(3),Pi=Oi(4),ji=Oi(5),Ri=Oi(6);Ni.range,Bi.range,Fi.range,Ii.range,Pi.range,ji.range,Ri.range;function Hi(t){return Mi((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/gi))}const $i=Hi(0),Zi=Hi(1),Wi=Hi(2),zi=Hi(3),Ui=Hi(4),qi=Hi(5),Vi=Hi(6),Gi=($i.range,Zi.range,Wi.range,zi.range,Ui.range,qi.range,Vi.range,Mi((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth()))),Ji=(Gi.range,Mi((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()))),Xi=(Ji.range,Mi((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear())));Xi.every=t=>isFinite(t=Math.floor(t))&&t>0?Mi((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null;Xi.range;const Ki=Mi((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));Ki.every=t=>isFinite(t=Math.floor(t))&&t>0?Mi((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null;Ki.range;function Qi(t,e,n,r,i,a){const s=[[wi,1,_i],[wi,5,5e3],[wi,15,15e3],[wi,30,3e4],[a,1,pi],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,fi],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,yi],[r,2,1728e5],[n,1,gi],[e,1,bi],[e,3,7776e6],[t,1,ki]];function o(e,n,r){const i=Math.abs(n-e)/r,a=vr((([,,t])=>t)).right(s,i);if(a===s.length)return t.every(gr(e/ki,n/ki,r));if(0===a)return Li.every(Math.max(gr(e,n,r),1));const[o,l]=s[i/s[a-1][2]<s[a][2]/i?a-1:a];return o.every(l)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:o(t,e,n),a=i?i.range(t,+e+1):[];return r?a.reverse():a},o]}const[ta,ea]=Qi(Ki,Ji,$i,Ai,Yi,Si),[na,ra]=Qi(Xi,Gi,Ni,Ei,Di,Ti);function ia(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function aa(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function sa(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var oa,la,ca={"-":"",_:" ",0:"0"},ua=/^\s*\d+/,da=/^%/,ha=/[\\^$*+?|[\]().{}]/g;function ma(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function _a(t){return t.replace(ha,"\\$&")}function pa(t){return new RegExp("^(?:"+t.map(_a).join("|")+")","i")}function fa(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function ya(t,e,n){var r=ua.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function ga(t,e,n){var r=ua.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ba(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ka(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function va(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function xa(t,e,n){var r=ua.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ma(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function La(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function wa(t,e,n){var r=ua.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Ta(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Sa(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Da(t,e,n){var r=ua.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ya(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Ea(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Ca(t,e,n){var r=ua.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Aa(t,e,n){var r=ua.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Oa(t,e,n){var r=ua.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Na(t,e,n){var r=da.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ba(t,e,n){var r=ua.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Fa(t,e,n){var r=ua.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ia(t,e){return ma(t.getDate(),e,2)}function Pa(t,e){return ma(t.getHours(),e,2)}function ja(t,e){return ma(t.getHours()%12||12,e,2)}function Ra(t,e){return ma(1+Ei.count(Xi(t),t),e,3)}function Ha(t,e){return ma(t.getMilliseconds(),e,3)}function $a(t,e){return Ha(t,e)+"000"}function Za(t,e){return ma(t.getMonth()+1,e,2)}function Wa(t,e){return ma(t.getMinutes(),e,2)}function za(t,e){return ma(t.getSeconds(),e,2)}function Ua(t){var e=t.getDay();return 0===e?7:e}function qa(t,e){return ma(Ni.count(Xi(t)-1,t),e,2)}function Va(t){var e=t.getDay();return e>=4||0===e?Pi(t):Pi.ceil(t)}function Ga(t,e){return t=Va(t),ma(Pi.count(Xi(t),t)+(4===Xi(t).getDay()),e,2)}function Ja(t){return t.getDay()}function Xa(t,e){return ma(Bi.count(Xi(t)-1,t),e,2)}function Ka(t,e){return ma(t.getFullYear()%100,e,2)}function Qa(t,e){return ma((t=Va(t)).getFullYear()%100,e,2)}function ts(t,e){return ma(t.getFullYear()%1e4,e,4)}function es(t,e){var n=t.getDay();return ma((t=n>=4||0===n?Pi(t):Pi.ceil(t)).getFullYear()%1e4,e,4)}function ns(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ma(e/60|0,"0",2)+ma(e%60,"0",2)}function rs(t,e){return ma(t.getUTCDate(),e,2)}function is(t,e){return ma(t.getUTCHours(),e,2)}function as(t,e){return ma(t.getUTCHours()%12||12,e,2)}function ss(t,e){return ma(1+Ci.count(Ki(t),t),e,3)}function os(t,e){return ma(t.getUTCMilliseconds(),e,3)}function ls(t,e){return os(t,e)+"000"}function cs(t,e){return ma(t.getUTCMonth()+1,e,2)}function us(t,e){return ma(t.getUTCMinutes(),e,2)}function ds(t,e){return ma(t.getUTCSeconds(),e,2)}function hs(t){var e=t.getUTCDay();return 0===e?7:e}function ms(t,e){return ma($i.count(Ki(t)-1,t),e,2)}function _s(t){var e=t.getUTCDay();return e>=4||0===e?Ui(t):Ui.ceil(t)}function ps(t,e){return t=_s(t),ma(Ui.count(Ki(t),t)+(4===Ki(t).getUTCDay()),e,2)}function fs(t){return t.getUTCDay()}function ys(t,e){return ma(Zi.count(Ki(t)-1,t),e,2)}function gs(t,e){return ma(t.getUTCFullYear()%100,e,2)}function bs(t,e){return ma((t=_s(t)).getUTCFullYear()%100,e,2)}function ks(t,e){return ma(t.getUTCFullYear()%1e4,e,4)}function vs(t,e){var n=t.getUTCDay();return ma((t=n>=4||0===n?Ui(t):Ui.ceil(t)).getUTCFullYear()%1e4,e,4)}function xs(){return"+0000"}function Ms(){return"%"}function Ls(t){return+t}function ws(t){return Math.floor(+t/1e3)}function Ts(t){return new Date(t)}function Ss(t){return t instanceof Date?+t:+new Date(+t)}function Ds(t,e,n,r,i,a,s,o,l,c){var u=Rr(),d=u.invert,h=u.domain,m=c(".%L"),_=c(":%S"),p=c("%I:%M"),f=c("%I %p"),y=c("%a %d"),g=c("%b %d"),b=c("%B"),k=c("%Y");function v(t){return(l(t)<t?m:o(t)<t?_:s(t)<t?p:a(t)<t?f:r(t)<t?i(t)<t?y:g:n(t)<t?b:k)(t)}return u.invert=function(t){return new Date(d(t))},u.domain=function(t){return arguments.length?h(Array.from(t,Ss)):h().map(Ts)},u.ticks=function(e){var n=h();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?v:c(e)},u.nice=function(t){var n=h();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?h(function(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],s=t[i];return s<a&&(n=r,r=i,i=n,n=a,a=s,s=n),t[r]=e.floor(a),t[i]=e.ceil(s),t}(n,t)):u},u.copy=function(){return Pr(u,Ds(t,e,n,r,i,a,s,o,l,c))},u}function Ys(){return Hr.apply(Ds(na,ra,Xi,Gi,Ni,Ei,Di,Ti,wi,la).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Es(t){return"string"==typeof t?new St([[document.querySelector(t)]],[document.documentElement]):new St([[t]],Tt)}function Cs(t){return"string"==typeof t?new St([document.querySelectorAll(t)],[document.documentElement]):new St([y(t)],Tt)}function As(t){return function(){return t}}!function(t){oa=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,s=t.shortDays,o=t.months,l=t.shortMonths,c=pa(i),u=fa(i),d=pa(a),h=fa(a),m=pa(s),_=fa(s),p=pa(o),f=fa(o),y=pa(l),g=fa(l),b={a:function(t){return s[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:Ia,e:Ia,f:$a,g:Qa,G:es,H:Pa,I:ja,j:Ra,L:Ha,m:Za,M:Wa,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ls,s:ws,S:za,u:Ua,U:qa,V:Ga,w:Ja,W:Xa,x:null,X:null,y:Ka,Y:ts,Z:ns,"%":Ms},k={a:function(t){return s[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:rs,e:rs,f:ls,g:bs,G:vs,H:is,I:as,j:ss,L:os,m:cs,M:us,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ls,s:ws,S:ds,u:hs,U:ms,V:ps,w:fs,W:ys,x:null,X:null,y:gs,Y:ks,Z:xs,"%":Ms},v={a:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.w=_.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=p.exec(e.slice(n));return r?(t.m=f.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return L(t,e,n,r)},d:Sa,e:Sa,f:Oa,g:Ma,G:xa,H:Ya,I:Ya,j:Da,L:Aa,m:Ta,M:Ea,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:wa,Q:Ba,s:Fa,S:Ca,u:ga,U:ba,V:ka,w:ya,W:va,x:function(t,e,r){return L(t,n,e,r)},X:function(t,e,n){return L(t,r,e,n)},y:Ma,Y:xa,Z:La,"%":Na};function x(t,e){return function(n){var r,i,a,s=[],o=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++o<c;)37===t.charCodeAt(o)&&(s.push(t.slice(l,o)),null!=(i=ca[r=t.charAt(++o)])?r=t.charAt(++o):i="e"===r?" ":"0",(a=e[r])&&(r=a(n,i)),s.push(r),l=o+1);return s.push(t.slice(l,o)),s.join("")}}function M(t,e){return function(n){var r,i,a=sa(1900,void 0,1);if(L(a,t,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(e&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=aa(sa(a.y,0,1))).getUTCDay(),r=i>4||0===i?Zi.ceil(r):Zi(r),r=Ci.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=ia(sa(a.y,0,1))).getDay(),r=i>4||0===i?Bi.ceil(r):Bi(r),r=Ei.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?aa(sa(a.y,0,1)).getUTCDay():ia(sa(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,aa(a)):ia(a)}}function L(t,e,n,r){for(var i,a,s=0,o=e.length,l=n.length;s<o;){if(r>=l)return-1;if(37===(i=e.charCodeAt(s++))){if(i=e.charAt(s++),!(a=v[i in ca?e.charAt(s++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=x(n,b),b.X=x(r,b),b.c=x(e,b),k.x=x(n,k),k.X=x(r,k),k.c=x(e,k),{format:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=M(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",k);return e.toString=function(){return t},e},utcParse:function(t){var e=M(t+="",!0);return e.toString=function(){return t},e}}}(t),la=oa.format,oa.parse,oa.utcFormat,oa.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});const Os=Math.abs,Ns=Math.atan2,Bs=Math.cos,Fs=Math.max,Is=Math.min,Ps=Math.sin,js=Math.sqrt,Rs=1e-12,Hs=Math.PI,$s=Hs/2,Zs=2*Hs;function Ws(t){return t>1?0:t<-1?Hs:Math.acos(t)}function zs(t){return t>=1?$s:t<=-1?-$s:Math.asin(t)}const Us=Math.PI,qs=2*Us,Vs=1e-6,Gs=qs-Vs;function Js(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}class Xs{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Js:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Js;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,a){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let a=this._x1,s=this._y1,o=n-t,l=r-e,c=a-t,u=s-e,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(d>Vs)if(Math.abs(u*o-l*c)>Vs&&i){let h=n-a,m=r-s,_=o*o+l*l,p=h*h+m*m,f=Math.sqrt(_),y=Math.sqrt(d),g=i*Math.tan((Us-Math.acos((_+d-p)/(2*f*y)))/2),b=g/y,k=g/f;Math.abs(b-1)>Vs&&this._append`L${t+b*c},${e+b*u}`,this._append`A${i},${i},0,0,${+(u*h>c*m)},${this._x1=t+k*o},${this._y1=e+k*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,a){if(t=+t,e=+e,a=!!a,(n=+n)<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(r),o=n*Math.sin(r),l=t+s,c=e+o,u=1^a,d=a?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>Vs||Math.abs(this._y1-c)>Vs)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%qs+qs),d>Gs?this._append`A${n},${n},0,1,${u},${t-s},${e-o}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>Vs&&this._append`A${n},${n},0,${+(d>=Us)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function Ks(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Xs(e)}function Qs(t){return t.innerRadius}function to(t){return t.outerRadius}function eo(t){return t.startAngle}function no(t){return t.endAngle}function ro(t){return t&&t.padAngle}function io(t,e,n,r,i,a,s,o){var l=n-t,c=r-e,u=s-i,d=o-a,h=d*l-u*c;if(!(h*h<Rs))return[t+(h=(u*(e-a)-d*(t-i))/h)*l,e+h*c]}function ao(t,e,n,r,i,a,s){var o=t-n,l=e-r,c=(s?a:-a)/js(o*o+l*l),u=c*l,d=-c*o,h=t+u,m=e+d,_=n+u,p=r+d,f=(h+_)/2,y=(m+p)/2,g=_-h,b=p-m,k=g*g+b*b,v=i-a,x=h*p-_*m,M=(b<0?-1:1)*js(Fs(0,v*v*k-x*x)),L=(x*b-g*M)/k,w=(-x*g-b*M)/k,T=(x*b+g*M)/k,S=(-x*g+b*M)/k,D=L-f,Y=w-y,E=T-f,C=S-y;return D*D+Y*Y>E*E+C*C&&(L=T,w=S),{cx:L,cy:w,x01:-u,y01:-d,x11:L*(i/v-1),y11:w*(i/v-1)}}function so(){var t=Qs,e=to,n=As(0),r=null,i=eo,a=no,s=ro,o=null,l=Ks(c);function c(){var c,u,d=+t.apply(this,arguments),h=+e.apply(this,arguments),m=i.apply(this,arguments)-$s,_=a.apply(this,arguments)-$s,p=Os(_-m),f=_>m;if(o||(o=c=l()),h<d&&(u=h,h=d,d=u),h>Rs)if(p>Zs-Rs)o.moveTo(h*Bs(m),h*Ps(m)),o.arc(0,0,h,m,_,!f),d>Rs&&(o.moveTo(d*Bs(_),d*Ps(_)),o.arc(0,0,d,_,m,f));else{var y,g,b=m,k=_,v=m,x=_,M=p,L=p,w=s.apply(this,arguments)/2,T=w>Rs&&(r?+r.apply(this,arguments):js(d*d+h*h)),S=Is(Os(h-d)/2,+n.apply(this,arguments)),D=S,Y=S;if(T>Rs){var E=zs(T/d*Ps(w)),C=zs(T/h*Ps(w));(M-=2*E)>Rs?(v+=E*=f?1:-1,x-=E):(M=0,v=x=(m+_)/2),(L-=2*C)>Rs?(b+=C*=f?1:-1,k-=C):(L=0,b=k=(m+_)/2)}var A=h*Bs(b),O=h*Ps(b),N=d*Bs(x),B=d*Ps(x);if(S>Rs){var F,I=h*Bs(k),P=h*Ps(k),j=d*Bs(v),R=d*Ps(v);if(p<Hs)if(F=io(A,O,j,R,I,P,N,B)){var H=A-F[0],$=O-F[1],Z=I-F[0],W=P-F[1],z=1/Ps(Ws((H*Z+$*W)/(js(H*H+$*$)*js(Z*Z+W*W)))/2),U=js(F[0]*F[0]+F[1]*F[1]);D=Is(S,(d-U)/(z-1)),Y=Is(S,(h-U)/(z+1))}else D=Y=0}L>Rs?Y>Rs?(y=ao(j,R,A,O,h,Y,f),g=ao(I,P,N,B,h,Y,f),o.moveTo(y.cx+y.x01,y.cy+y.y01),Y<S?o.arc(y.cx,y.cy,Y,Ns(y.y01,y.x01),Ns(g.y01,g.x01),!f):(o.arc(y.cx,y.cy,Y,Ns(y.y01,y.x01),Ns(y.y11,y.x11),!f),o.arc(0,0,h,Ns(y.cy+y.y11,y.cx+y.x11),Ns(g.cy+g.y11,g.cx+g.x11),!f),o.arc(g.cx,g.cy,Y,Ns(g.y11,g.x11),Ns(g.y01,g.x01),!f))):(o.moveTo(A,O),o.arc(0,0,h,b,k,!f)):o.moveTo(A,O),d>Rs&&M>Rs?D>Rs?(y=ao(N,B,I,P,d,-D,f),g=ao(A,O,j,R,d,-D,f),o.lineTo(y.cx+y.x01,y.cy+y.y01),D<S?o.arc(y.cx,y.cy,D,Ns(y.y01,y.x01),Ns(g.y01,g.x01),!f):(o.arc(y.cx,y.cy,D,Ns(y.y01,y.x01),Ns(y.y11,y.x11),!f),o.arc(0,0,d,Ns(y.cy+y.y11,y.cx+y.x11),Ns(g.cy+g.y11,g.cx+g.x11),f),o.arc(g.cx,g.cy,D,Ns(g.y11,g.x11),Ns(g.y01,g.x01),!f))):o.arc(0,0,d,x,v,f):o.lineTo(N,B)}else o.moveTo(0,0);if(o.closePath(),c)return o=null,c+""||null}return c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-Hs/2;return[Bs(r)*n,Ps(r)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:As(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:As(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:As(+t),c):n},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:As(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:As(+t),c):i},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:As(+t),c):a},c.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:As(+t),c):s},c.context=function(t){return arguments.length?(o=null==t?null:t,c):o},c}Array.prototype.slice;function oo(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function lo(t){this._context=t}function co(t){return new lo(t)}function uo(t){return t[0]}function ho(t){return t[1]}function mo(t,e){var n=As(!0),r=null,i=co,a=null,s=Ks(o);function o(o){var l,c,u,d=(o=oo(o)).length,h=!1;for(null==r&&(a=i(u=s())),l=0;l<=d;++l)!(l<d&&n(c=o[l],l,o))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+t(c,l,o),+e(c,l,o));if(u)return a=null,u+""||null}return t="function"==typeof t?t:void 0===t?uo:As(t),e="function"==typeof e?e:void 0===e?ho:As(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:As(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:As(+t),o):e},o.defined=function(t){return arguments.length?(n="function"==typeof t?t:As(!!t),o):n},o.curve=function(t){return arguments.length?(i=t,null!=r&&(a=i(r)),o):i},o.context=function(t){return arguments.length?(null==t?r=a=null:a=i(r=t),o):r},o}function _o(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function po(t){return t}function fo(){var t=po,e=_o,n=null,r=As(0),i=As(Zs),a=As(0);function s(s){var o,l,c,u,d,h=(s=oo(s)).length,m=0,_=new Array(h),p=new Array(h),f=+r.apply(this,arguments),y=Math.min(Zs,Math.max(-Zs,i.apply(this,arguments)-f)),g=Math.min(Math.abs(y)/h,a.apply(this,arguments)),b=g*(y<0?-1:1);for(o=0;o<h;++o)(d=p[_[o]=o]=+t(s[o],o,s))>0&&(m+=d);for(null!=e?_.sort((function(t,n){return e(p[t],p[n])})):null!=n&&_.sort((function(t,e){return n(s[t],s[e])})),o=0,c=m?(y-h*b)/m:0;o<h;++o,f=u)l=_[o],u=f+((d=p[l])>0?d*c:0)+b,p[l]={data:s[l],index:o,value:d,startAngle:f,endAngle:u,padAngle:g};return p}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:As(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,n=null,s):e},s.sort=function(t){return arguments.length?(n=t,e=null,s):n},s.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:As(+t),s):r},s.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:As(+t),s):i},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:As(+t),s):a},s}function yo(){}function go(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function bo(t){this._context=t}function ko(t){return new bo(t)}function vo(t){this._context=t}function xo(t){return new vo(t)}function Mo(t){this._context=t}function Lo(t){return new Mo(t)}lo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},bo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:go(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:go(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},vo.prototype={areaStart:yo,areaEnd:yo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:go(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Mo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:go(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};class wo{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function To(t){return new wo(t,!0)}function So(t){return new wo(t,!1)}function Do(t,e){this._basis=new bo(t),this._beta=e}Do.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],a=e[0],s=t[n]-i,o=e[n]-a,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+r*s),this._beta*e[l]+(1-this._beta)*(a+r*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const Yo=function t(e){function n(t){return 1===e?new bo(t):new Do(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Eo(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Co(t,e){this._context=t,this._k=(1-e)/6}Co.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Eo(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Eo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Ao=function t(e){function n(t){return new Co(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Oo(t,e){this._context=t,this._k=(1-e)/6}Oo.prototype={areaStart:yo,areaEnd:yo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Eo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const No=function t(e){function n(t){return new Oo(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Bo(t,e){this._context=t,this._k=(1-e)/6}Bo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Eo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Fo=function t(e){function n(t){return new Bo(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Io(t,e,n){var r=t._x1,i=t._y1,a=t._x2,s=t._y2;if(t._l01_a>Rs){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Rs){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*c+t._x1*t._l23_2a-e*t._l12_2a)/u,s=(s*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,i,a,s,t._x2,t._y2)}function Po(t,e){this._context=t,this._alpha=e}Po.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Io(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const jo=function t(e){function n(t){return e?new Po(t,e):new Co(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ro(t,e){this._context=t,this._alpha=e}Ro.prototype={areaStart:yo,areaEnd:yo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Io(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Ho=function t(e){function n(t){return e?new Ro(t,e):new Oo(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function $o(t,e){this._context=t,this._alpha=e}$o.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Io(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Zo=function t(e){function n(t){return e?new $o(t,e):new Bo(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Wo(t){this._context=t}function zo(t){return new Wo(t)}function Uo(t){return t<0?-1:1}function qo(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(Uo(a)+Uo(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function Vo(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Go(t,e,n){var r=t._x0,i=t._y0,a=t._x1,s=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*e,a-o,s-o*n,a,s)}function Jo(t){this._context=t}function Xo(t){this._context=new Ko(t)}function Ko(t){this._context=t}function Qo(t){return new Jo(t)}function tl(t){return new Xo(t)}function el(t){this._context=t}function nl(t){var e,n,r=t.length-1,i=new Array(r),a=new Array(r),s=new Array(r);for(i[0]=0,a[0]=2,s[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,s[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,s[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,s[e]-=n*s[e-1];for(i[r-1]=s[r-1]/a[r-1],e=r-2;e>=0;--e)i[e]=(s[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function rl(t){return new el(t)}function il(t,e){this._context=t,this._t=e}function al(t){return new il(t,.5)}function sl(t){return new il(t,0)}function ol(t){return new il(t,1)}function ll(t,e,n){this.k=t,this.x=e,this.y=n}Wo.prototype={areaStart:yo,areaEnd:yo,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},Jo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Go(this,this._t0,Vo(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Go(this,Vo(this,n=qo(this,t,e)),n);break;default:Go(this,this._t0,n=qo(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Xo.prototype=Object.create(Jo.prototype)).point=function(t,e){Jo.prototype.point.call(this,e,t)},Ko.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,a){this._context.bezierCurveTo(e,t,r,n,a,i)}},el.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=nl(t),i=nl(e),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],t[s],e[s]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},il.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}},ll.prototype={constructor:ll,scale:function(t){return 1===t?this:new ll(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new ll(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new ll(1,0,0);ll.prototype},23352:(t,e,n)=>{"use strict";function r(t,e,n,r){var a,s,o,l,c,u,d,h,m,_,p,f,y;if(a=e.y-t.y,o=t.x-e.x,c=e.x*t.y-t.x*e.y,m=a*n.x+o*n.y+c,_=a*r.x+o*r.y+c,!(0!==m&&0!==_&&i(m,_)||(s=r.y-n.y,l=n.x-r.x,u=r.x*n.y-n.x*r.y,d=s*t.x+l*t.y+u,h=s*e.x+l*e.y+u,0!==d&&0!==h&&i(d,h)||0==(p=a*l-s*o))))return f=Math.abs(p/2),{x:(y=o*u-l*c)<0?(y-f)/p:(y+f)/p,y:(y=s*c-a*u)<0?(y-f)/p:(y+f)/p}}function i(t,e){return t*e>0}function a(t,e,n){var i=t.x,a=t.y,s=[],o=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;e.forEach((function(t){o=Math.min(o,t.x),l=Math.min(l,t.y)}));for(var c=i-t.width/2-o,u=a-t.height/2-l,d=0;d<e.length;d++){var h=e[d],m=e[d<e.length-1?d+1:0],_=r(t,n,{x:c+h.x,y:u+h.y},{x:c+m.x,y:u+m.y});_&&s.push(_)}return s.length?(s.length>1&&s.sort((function(t,e){var r=t.x-n.x,i=t.y-n.y,a=Math.sqrt(r*r+i*i),s=e.x-n.x,o=e.y-n.y,l=Math.sqrt(s*s+o*o);return a<l?-1:a===l?0:1})),s[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",t),t)}n.d(e,{A:()=>a})},22930:(t,e,n)=>{"use strict";function r(t,e){var n,r,i=t.x,a=t.y,s=e.x-i,o=e.y-a,l=t.width/2,c=t.height/2;return Math.abs(o)*l>Math.abs(s)*c?(o<0&&(c=-c),n=0===o?0:c*s/o,r=c):(s<0&&(l=-l),n=l,r=0===s?0:l*o/s),{x:i+n,y:a+r}}n.d(e,{q:()=>r})},43349:(t,e,n)=>{"use strict";n.d(e,{a:()=>i});var r=n(96225);function i(t,e){var n=t.append("foreignObject").attr("width","100000"),i=n.append("xhtml:div");i.attr("xmlns","http://www.w3.org/1999/xhtml");var a=e.label;switch(typeof a){case"function":i.insert(a);break;case"object":i.insert((function(){return a}));break;default:i.html(a)}r.bg(i,e.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap");var s=i.node().getBoundingClientRect();return n.attr("width",s.width).attr("height",s.height),n}},96225:(t,e,n)=>{"use strict";n.d(e,{$p:()=>u,O1:()=>s,WR:()=>d,bF:()=>a,bg:()=>c});var r=n(37514),i=n(73234);function a(t,e){return!!t.children(e).length}function s(t){return l(t.v)+":"+l(t.w)+":"+l(t.name)}var o=/:/g;function l(t){return t?String(t).replace(o,"\\:"):""}function c(t,e){e&&t.attr("style",e)}function u(t,e,n){e&&t.attr("class",e).attr("class",n+" "+t.attr("class"))}function d(t,e){var n=e.graph();if(r.Z(n)){var a=n.transition;if(i.Z(a))return a(t)}return t}},70277:(t,e,n)=>{"use strict";n.d(e,{L0:()=>r,bK:()=>be,Fv:()=>i,dZ:()=>on});var r={};n.r(r),n.d(r,{run:()=>k,undo:()=>v});var i={};n.r(i),n.d(i,{run:()=>Ee,undo:()=>Ce});var a=n(70870),s=n(66749),o=n(17452),l=n(62002),c=n(27961),u=n(43836),d=n(74379),h=n(45625);class m{constructor(){var t={};t._next=t._prev=t,this._sentinel=t}dequeue(){var t=this._sentinel,e=t._prev;if(e!==t)return _(e),e}enqueue(t){var e=this._sentinel;t._prev&&t._next&&_(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,p)),n=n._prev;return"["+t.join(", ")+"]"}}function _(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function p(t,e){if("_next"!==t&&"_prev"!==t)return e}var f=l.Z(1);function y(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new h.k,r=0,i=0;a.Z(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),a.Z(t.edges(),(function(t){var a=n.edge(t.v,t.w)||0,s=e(t),o=a+s;n.setEdge(t.v,t.w,o),i=Math.max(i,n.node(t.v).out+=s),r=Math.max(r,n.node(t.w).in+=s)}));var s=d.Z(i+r+3).map((function(){return new m})),o=r+1;return a.Z(n.nodes(),(function(t){b(s,o,n.node(t))})),{graph:n,buckets:s,zeroIdx:o}}(t,e||f),r=function(t,e,n){var r,i=[],a=e[e.length-1],s=e[0];for(;t.nodeCount();){for(;r=s.dequeue();)g(t,e,n,r);for(;r=a.dequeue();)g(t,e,n,r);if(t.nodeCount())for(var o=e.length-2;o>0;--o)if(r=e[o].dequeue()){i=i.concat(g(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return c.Z(u.Z(r,(function(e){return t.outEdges(e.v,e.w)})))}function g(t,e,n,r,i){var s=i?[]:void 0;return a.Z(t.inEdges(r.v),(function(r){var a=t.edge(r),o=t.node(r.v);i&&s.push({v:r.v,w:r.w}),o.out-=a,b(e,n,o)})),a.Z(t.outEdges(r.v),(function(r){var i=t.edge(r),a=r.w,s=t.node(a);s.in-=i,b(e,n,s)})),t.removeNode(r.v),s}function b(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}function k(t){var e="greedy"===t.graph().acyclicer?y(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},r={};function i(s){o.Z(r,s)||(r[s]=!0,n[s]=!0,a.Z(t.outEdges(s),(function(t){o.Z(n,t.w)?e.push(t):i(t.w)})),delete n[s])}return a.Z(t.nodes(),i),e}(t);a.Z(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,s.Z("rev"))}))}function v(t){a.Z(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}var x=n(31667),M=n(74752),L=n(79651);const w=function(t,e,n){(void 0!==n&&!(0,L.Z)(t[e],n)||void 0===n&&!(e in t))&&(0,M.Z)(t,e,n)};var T=n(61395),S=n(91050),D=n(12701),Y=n(87215),E=n(73658),C=n(29169),A=n(27771),O=n(836),N=n(77008),B=n(73234),F=n(77226),I=n(37514),P=n(18843);const j=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]};var R=n(31899),H=n(32957);const $=function(t){return(0,R.Z)(t,(0,H.Z)(t))};const Z=function(t,e,n,r,i,a,s){var o=j(t,n),l=j(e,n),c=s.get(l);if(c)w(t,n,c);else{var u=a?a(o,l,n+"",t,e,s):void 0,d=void 0===u;if(d){var h=(0,A.Z)(l),m=!h&&(0,N.Z)(l),_=!h&&!m&&(0,P.Z)(l);u=l,h||m||_?(0,A.Z)(o)?u=o:(0,O.Z)(o)?u=(0,Y.Z)(o):m?(d=!1,u=(0,S.Z)(l,!0)):_?(d=!1,u=(0,D.Z)(l,!0)):u=[]:(0,I.Z)(l)||(0,C.Z)(l)?(u=o,(0,C.Z)(o)?u=$(o):(0,F.Z)(o)&&!(0,B.Z)(o)||(u=(0,E.Z)(l))):d=!1}d&&(s.set(l,u),i(u,l,r,a,s),s.delete(l)),w(t,n,u)}};const W=function t(e,n,r,i,a){e!==n&&(0,T.Z)(n,(function(s,o){if(a||(a=new x.Z),(0,F.Z)(s))Z(e,n,o,r,t,i,a);else{var l=i?i(j(e,o),s,o+"",e,n,a):void 0;void 0===l&&(l=s),w(e,o,l)}}),H.Z)};var z=n(69581),U=n(50439);const q=function(t){return(0,z.Z)((function(e,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,s&&(0,U.Z)(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,a)}return e}))}((function(t,e,n){W(t,e,n)}));var V=n(61666),G=n(3688),J=n(72714);const X=function(t,e,n){for(var r=-1,i=t.length;++r<i;){var a=t[r],s=e(a);if(null!=s&&(void 0===o?s==s&&!(0,J.Z)(s):n(s,o)))var o=s,l=a}return l};const K=function(t,e){return t>e};var Q=n(69203);const tt=function(t){return t&&t.length?X(t,Q.Z,K):void 0};const et=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0};var nt=n(2693),rt=n(74765);const it=function(t,e){var n={};return e=(0,rt.Z)(e,3),(0,nt.Z)(t,(function(t,r,i){(0,M.Z)(n,r,e(t,r,i))})),n};var at=n(49360);const st=function(t,e){return t<e};const ot=function(t){return t&&t.length?X(t,Q.Z,st):void 0};var lt=n(66092);const ct=function(){return lt.Z.Date.now()};function ut(t,e,n,r){var i;do{i=s.Z(r)}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function dt(t){var e=new h.k({multigraph:t.isMultigraph()}).setGraph(t.graph());return a.Z(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),a.Z(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e}function ht(t,e){var n,r,i=t.x,a=t.y,s=e.x-i,o=e.y-a,l=t.width/2,c=t.height/2;if(!s&&!o)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(o)*l>Math.abs(s)*c?(o<0&&(c=-c),n=c*s/o,r=c):(s<0&&(l=-l),n=l,r=l*o/s),{x:i+n,y:a+r}}function mt(t){var e=u.Z(d.Z(pt(t)+1),(function(){return[]}));return a.Z(t.nodes(),(function(n){var r=t.node(n),i=r.rank;at.Z(i)||(e[i][r.order]=n)})),e}function _t(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),ut(t,"border",i,e)}function pt(t){return tt(u.Z(t.nodes(),(function(e){var n=t.node(e).rank;if(!at.Z(n))return n})))}function ft(t,e){var n=ct();try{return e()}finally{console.log(t+" time: "+(ct()-n)+"ms")}}function yt(t,e){return e()}function gt(t,e,n,r,i,a){var s={width:0,height:0,rank:a,borderType:e},o=i[e][a-1],l=ut(t,"border",s,n);i[e][a]=l,t.setParent(l,r),o&&t.setEdge(o,l,{weight:1})}function bt(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){a.Z(t.nodes(),(function(e){xt(t.node(e))})),a.Z(t.edges(),(function(e){var n=t.edge(e);a.Z(n.points,xt),o.Z(n,"y")&&xt(n)}))}(t),"lr"!==e&&"rl"!==e||(!function(t){a.Z(t.nodes(),(function(e){Mt(t.node(e))})),a.Z(t.edges(),(function(e){var n=t.edge(e);a.Z(n.points,Mt),o.Z(n,"x")&&Mt(n)}))}(t),kt(t))}function kt(t){a.Z(t.nodes(),(function(e){vt(t.node(e))})),a.Z(t.edges(),(function(e){vt(t.edge(e))}))}function vt(t){var e=t.width;t.width=t.height,t.height=e}function xt(t){t.y=-t.y}function Mt(t){var e=t.x;t.x=t.y,t.y=e}var Lt=n(34148),wt=n(92344);function Tt(t){var e=ut(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var s=t.children(r);s&&s.length&&a.Z(s,(function(t){n(t,i+1)})),e[r]=i}return a.Z(t.children(),(function(t){n(t,1)})),e}(t),r=tt(Lt.Z(n))-1,i=2*r+1;t.graph().nestingRoot=e,a.Z(t.edges(),(function(e){t.edge(e).minlen*=i}));var s=function(t){return wt.Z(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;a.Z(t.children(),(function(a){St(t,e,i,s,r,n,a)})),t.graph().nodeRankFactor=i}function St(t,e,n,r,i,s,o){var l=t.children(o);if(l.length){var c=_t(t,"_bt"),u=_t(t,"_bb"),d=t.node(o);t.setParent(c,o),d.borderTop=c,t.setParent(u,o),d.borderBottom=u,a.Z(l,(function(a){St(t,e,n,r,i,s,a);var l=t.node(a),d=l.borderTop?l.borderTop:a,h=l.borderBottom?l.borderBottom:a,m=l.borderTop?r:2*r,_=d!==h?1:i-s[o]+1;t.setEdge(c,d,{weight:m,minlen:_,nestingEdge:!0}),t.setEdge(h,u,{weight:m,minlen:_,nestingEdge:!0})})),t.parent(o)||t.setEdge(e,c,{weight:0,minlen:i+s[o]})}else o!==e&&t.setEdge(e,o,{weight:0,minlen:n})}var Dt=n(48451);const Yt=function(t){return(0,Dt.Z)(t,5)};function Et(t,e,n){var r=function(t){var e;for(;t.hasNode(e=s.Z("_root")););return e}(t),i=new h.k({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return a.Z(t.nodes(),(function(s){var l=t.node(s),c=t.parent(s);(l.rank===e||l.minRank<=e&&e<=l.maxRank)&&(i.setNode(s),i.setParent(s,c||r),a.Z(t[n](s),(function(e){var n=e.v===s?e.w:e.v,r=i.edge(n,s),a=at.Z(r)?0:r.weight;i.setEdge(n,s,{weight:t.edge(e).weight+a})})),o.Z(l,"minRank")&&i.setNode(s,{borderLeft:l.borderLeft[e],borderRight:l.borderRight[e]}))})),i}var Ct=n(72954);const At=function(t,e,n){for(var r=-1,i=t.length,a=e.length,s={};++r<i;){var o=r<a?e[r]:void 0;n(s,t[r],o)}return s};const Ot=function(t,e){return At(t||[],e||[],Ct.Z)};var Nt=n(10626),Bt=n(74073),Ft=n(13317),It=n(21018);const Pt=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t};var jt=n(21162);const Rt=function(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,a=(0,J.Z)(t),s=void 0!==e,o=null===e,l=e==e,c=(0,J.Z)(e);if(!o&&!c&&!a&&t>e||a&&s&&l&&!o&&!c||r&&s&&l||!n&&l||!i)return 1;if(!r&&!a&&!c&&t<e||c&&n&&i&&!r&&!a||o&&n&&i||!s&&i||!l)return-1}return 0};const Ht=function(t,e,n){for(var r=-1,i=t.criteria,a=e.criteria,s=i.length,o=n.length;++r<s;){var l=Rt(i[r],a[r]);if(l)return r>=o?l:l*("desc"==n[r]?-1:1)}return t.index-e.index};const $t=function(t,e,n){e=e.length?(0,Bt.Z)(e,(function(t){return(0,A.Z)(t)?function(e){return(0,Ft.Z)(e,1===t.length?t[0]:t)}:t})):[Q.Z];var r=-1;e=(0,Bt.Z)(e,(0,jt.Z)(rt.Z));var i=(0,It.Z)(t,(function(t,n,i){return{criteria:(0,Bt.Z)(e,(function(e){return e(t)})),index:++r,value:t}}));return Pt(i,(function(t,e){return Ht(t,e,n)}))};const Zt=(0,z.Z)((function(t,e){if(null==t)return[];var n=e.length;return n>1&&(0,U.Z)(t,e[0],e[1])?e=[]:n>2&&(0,U.Z)(e[0],e[1],e[2])&&(e=[e[0]]),$t(t,(0,Nt.Z)(e,1),[])}));function Wt(t,e){for(var n=0,r=1;r<e.length;++r)n+=zt(t,e[r-1],e[r]);return n}function zt(t,e,n){for(var r=Ot(n,u.Z(n,(function(t,e){return e}))),i=c.Z(u.Z(e,(function(e){return Zt(u.Z(t.outEdges(e),(function(e){return{pos:r[e.w],weight:t.edge(e).weight}})),"pos")}))),s=1;s<n.length;)s<<=1;var o=2*s-1;s-=1;var l=u.Z(new Array(o),(function(){return 0})),d=0;return a.Z(i.forEach((function(t){var e=t.pos+s;l[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=l[e+1]),l[e=e-1>>1]+=t.weight;d+=t.weight*n}))),d}var Ut=n(13445);function qt(t,e){var n={};return a.Z(t,(function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};at.Z(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)})),a.Z(e.edges(),(function(t){var e=n[t.v],r=n[t.w];at.Z(e)||at.Z(r)||(r.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){e.merged||(at.Z(e.barycenter)||at.Z(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var i=t.pop();e.push(i),a.Z(i.in.reverse(),n(i)),a.Z(i.out,r(i))}return u.Z(Ut.Z(e,(function(t){return!t.merged})),(function(t){return V.Z(t,["vs","i","barycenter","weight"])}))}(Ut.Z(n,(function(t){return!t.indegree})))}function Vt(t,e){var n,r=function(t,e){var n={lhs:[],rhs:[]};return a.Z(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n}(t,(function(t){return o.Z(t,"barycenter")})),i=r.lhs,s=Zt(r.rhs,(function(t){return-t.i})),l=[],u=0,d=0,h=0;i.sort((n=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:n?e.i-t.i:t.i-e.i})),h=Gt(l,s,h),a.Z(i,(function(t){h+=t.vs.length,l.push(t.vs),u+=t.barycenter*t.weight,d+=t.weight,h=Gt(l,s,h)}));var m={vs:c.Z(l)};return d&&(m.barycenter=u/d,m.weight=d),m}function Gt(t,e,n){for(var r;e.length&&(r=et(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}function Jt(t,e,n,r){var i=t.children(e),s=t.node(e),l=s?s.borderLeft:void 0,d=s?s.borderRight:void 0,h={};l&&(i=Ut.Z(i,(function(t){return t!==l&&t!==d})));var m=function(t,e){return u.Z(e,(function(e){var n=t.inEdges(e);if(n.length){var r=wt.Z(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))}(t,i);a.Z(m,(function(e){if(t.children(e.v).length){var i=Jt(t,e.v,n,r);h[e.v]=i,o.Z(i,"barycenter")&&(a=e,s=i,at.Z(a.barycenter)?(a.barycenter=s.barycenter,a.weight=s.weight):(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight))}var a,s}));var _=qt(m,n);!function(t,e){a.Z(t,(function(t){t.vs=c.Z(t.vs.map((function(t){return e[t]?e[t].vs:t})))}))}(_,h);var p=Vt(_,r);if(l&&(p.vs=c.Z([l,p.vs,d]),t.predecessors(l).length)){var f=t.node(t.predecessors(l)[0]),y=t.node(t.predecessors(d)[0]);o.Z(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+f.order+y.order)/(p.weight+2),p.weight+=2}return p}function Xt(t){var e=pt(t),n=Kt(t,d.Z(1,e+1),"inEdges"),r=Kt(t,d.Z(e-1,-1,-1),"outEdges"),i=function(t){var e={},n=Ut.Z(t.nodes(),(function(e){return!t.children(e).length})),r=tt(u.Z(n,(function(e){return t.node(e).rank}))),i=u.Z(d.Z(r+1),(function(){return[]})),s=Zt(n,(function(e){return t.node(e).rank}));return a.Z(s,(function n(r){if(!o.Z(e,r)){e[r]=!0;var s=t.node(r);i[s.rank].push(r),a.Z(t.successors(r),n)}})),i}(t);te(t,i);for(var s,l=Number.POSITIVE_INFINITY,c=0,h=0;h<4;++c,++h){Qt(c%2?n:r,c%4>=2);var m=Wt(t,i=mt(t));m<l&&(h=0,s=Yt(i),l=m)}te(t,s)}function Kt(t,e,n){return u.Z(e,(function(e){return Et(t,e,n)}))}function Qt(t,e){var n=new h.k;a.Z(t,(function(t){var r=t.graph().root,i=Jt(t,r,n,e);a.Z(i.vs,(function(e,n){t.node(e).order=n})),function(t,e,n){var r,i={};a.Z(n,(function(n){for(var a,s,o=t.parent(n);o;){if((a=t.parent(o))?(s=i[a],i[a]=o):(s=r,r=o),s&&s!==o)return void e.setEdge(s,o);o=a}}))}(t,n,i.vs)}))}function te(t,e){a.Z(e,(function(e){a.Z(e,(function(e,n){t.node(e).order=n}))}))}function ee(t){var e=function(t){var e={},n=0;function r(i){var s=n;a.Z(t.children(i),r),e[i]={low:s,lim:n++}}return a.Z(t.children(),r),e}(t);a.Z(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,a=function(t,e,n,r){var i,a,s=[],o=[],l=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),s.push(i)}while(i&&(e[i].low>l||c>e[i].lim));a=i,i=r;for(;(i=t.parent(i))!==a;)o.push(i);return{path:s.concat(o.reverse()),lca:a}}(t,e,i.v,i.w),s=a.path,o=a.lca,l=0,c=s[l],u=!0;n!==i.w;){if(r=t.node(n),u){for(;(c=s[l])!==o&&t.node(c).maxRank<r.rank;)l++;c===o&&(u=!1)}if(!u){for(;l<s.length-1&&t.node(c=s[l+1]).minRank<=r.rank;)l++;c=s[l]}t.setParent(n,c),n=t.successors(n)[0]}}))}var ne=n(50585),re=n(17179);const ie=function(t){return function(e,n,r){var i=Object(e);if(!(0,ne.Z)(e)){var a=(0,rt.Z)(n,3);e=(0,re.Z)(e),n=function(t){return a(i[t],t,i)}}var s=t(e,n,r);return s>-1?i[a?e[s]:s]:void 0}};var ae=n(21692),se=n(94099);const oe=function(t){var e=(0,se.Z)(t),n=e%1;return e==e?n?e-n:e:0};var le=Math.max;const ce=ie((function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:oe(n);return i<0&&(i=le(r+i,0)),(0,ae.Z)(t,(0,rt.Z)(e,3),i)}));const ue=function(t,e){return t&&t.length?X(t,(0,rt.Z)(e,2),st):void 0};var de=n(68882);const he=function(t,e){return null==t?t:(0,T.Z)(t,(0,de.Z)(e),H.Z)};function me(t,e){var n={};return wt.Z(e,(function(e,r){var i=0,s=0,o=e.length,l=et(r);return a.Z(r,(function(e,c){var u=function(t,e){if(t.node(e).dummy)return ce(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),d=u?t.node(u).order:o;(u||e===l)&&(a.Z(r.slice(s,c+1),(function(e){a.Z(t.predecessors(e),(function(r){var a=t.node(r),s=a.order;!(s<i||d<s)||a.dummy&&t.node(e).dummy||_e(n,r,e)}))})),s=c+1,i=d)})),r})),n}function _e(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function pe(t,e,n){if(e>n){var r=e;e=n,n=r}return o.Z(t[e],n)}function fe(t,e,n,r,i){var s={},l=function(t,e,n,r){var i=new h.k,s=t.graph(),l=function(t,e,n){return function(r,i,a){var s,l=r.node(i),c=r.node(a),u=0;if(u+=l.width/2,o.Z(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":s=-l.width/2;break;case"r":s=l.width/2}if(s&&(u+=n?s:-s),s=0,u+=(l.dummy?e:t)/2,u+=(c.dummy?e:t)/2,u+=c.width/2,o.Z(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":s=c.width/2;break;case"r":s=-c.width/2}return s&&(u+=n?s:-s),s=0,u}}(s.nodesep,s.edgesep,r);return a.Z(e,(function(e){var r;a.Z(e,(function(e){var a=n[e];if(i.setNode(a),r){var s=n[r],o=i.edge(s,a);i.setEdge(s,a,Math.max(l(t,e,r),o||0))}r=e}))})),i}(t,e,n,i),c=i?"borderLeft":"borderRight";function u(t,e){for(var n=l.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}return u((function(t){s[t]=l.inEdges(t).reduce((function(t,e){return Math.max(t,s[e.v]+l.edge(e))}),0)}),l.predecessors.bind(l)),u((function(e){var n=l.outEdges(e).reduce((function(t,e){return Math.min(t,s[e.w]-l.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==c&&(s[e]=Math.max(s[e],n))}),l.successors.bind(l)),a.Z(r,(function(t){s[t]=s[n[t]]})),s}function ye(t){var e,n=mt(t),r=q(me(t,n),function(t,e){var n={};function r(e,r,i,s,o){var l;a.Z(d.Z(r,i),(function(r){l=e[r],t.node(l).dummy&&a.Z(t.predecessors(l),(function(e){var r=t.node(e);r.dummy&&(r.order<s||r.order>o)&&_e(n,e,l)}))}))}return wt.Z(e,(function(e,n){var i,s=-1,o=0;return a.Z(n,(function(a,l){if("border"===t.node(a).dummy){var c=t.predecessors(a);c.length&&(i=t.node(c[0]).order,r(n,o,l,s,i),o=l,s=i)}r(n,o,n.length,i,e.length)})),n})),n}(t,n)),i={};a.Z(["u","d"],(function(s){e="u"===s?n:Lt.Z(n).reverse(),a.Z(["l","r"],(function(n){"r"===n&&(e=u.Z(e,(function(t){return Lt.Z(t).reverse()})));var o=("u"===s?t.predecessors:t.successors).bind(t),l=function(t,e,n,r){var i={},s={},o={};return a.Z(e,(function(t){a.Z(t,(function(t,e){i[t]=t,s[t]=t,o[t]=e}))})),a.Z(e,(function(t){var e=-1;a.Z(t,(function(t){var a=r(t);if(a.length){a=Zt(a,(function(t){return o[t]}));for(var l=(a.length-1)/2,c=Math.floor(l),u=Math.ceil(l);c<=u;++c){var d=a[c];s[t]===t&&e<o[d]&&!pe(n,t,d)&&(s[d]=t,s[t]=i[t]=i[d],e=o[d])}}}))})),{root:i,align:s}}(0,e,r,o),c=fe(t,e,l.root,l.align,"r"===n);"r"===n&&(c=it(c,(function(t){return-t}))),i[s+n]=c}))}));var s=function(t,e){return ue(Lt.Z(e),(function(e){var n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return he(e,(function(e,i){var a=function(t,e){return t.node(e).width}(t,i)/2;n=Math.max(e+a,n),r=Math.min(e-a,r)})),n-r}))}(t,i);return function(t,e){var n=Lt.Z(e),r=ot(n),i=tt(n);a.Z(["u","d"],(function(n){a.Z(["l","r"],(function(a){var s,o=n+a,l=t[o];if(l!==e){var c=Lt.Z(l);(s="l"===a?r-ot(c):i-tt(c))&&(t[o]=it(l,(function(t){return t+s})))}}))}))}(i,s),function(t,e){return it(t.ul,(function(n,r){if(e)return t[e.toLowerCase()][r];var i=Zt(u.Z(t,r));return(i[1]+i[2])/2}))}(i,t.graph().align)}function ge(t){(function(t){var e=mt(t),n=t.graph().ranksep,r=0;a.Z(e,(function(e){var i=tt(u.Z(e,(function(e){return t.node(e).height})));a.Z(e,(function(e){t.node(e).y=r+i/2})),r+=i+n}))})(t=dt(t)),a.Z(ye(t),(function(e,n){t.node(n).x=e}))}function be(t,e){var n=e&&e.debugTiming?ft:yt;n("layout",(function(){var e=n(" buildLayoutGraph",(function(){return function(t){var e=new h.k({multigraph:!0,compound:!0}),n=Ye(t.graph());return e.setGraph(q({},ve,De(n,ke),V.Z(n,xe))),a.Z(t.nodes(),(function(n){var r=Ye(t.node(n));e.setNode(n,G.Z(De(r,Me),Le)),e.setParent(n,t.parent(n))})),a.Z(t.edges(),(function(n){var r=Ye(t.edge(n));e.setEdge(n,q({},Te,De(r,we),V.Z(r,Se)))})),e}(t)}));n(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,a.Z(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){a.Z(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){k(t)})),e(" nestingGraph.run",(function(){Tt(t)})),e(" rank",(function(){on(dt(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){a.Z(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};ut(t,"edge-proxy",i,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){!function(t){var e=ot(u.Z(t.nodes(),(function(e){return t.node(e).rank}))),n=[];a.Z(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var r=0,i=t.graph().nodeRankFactor;a.Z(n,(function(e,n){at.Z(e)&&n%i!=0?--r:r&&a.Z(e,(function(e){t.node(e).rank+=r}))}))}(t)})),e(" nestingGraph.cleanup",(function(){!function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,a.Z(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}(t)})),e(" normalizeRanks",(function(){!function(t){var e=ot(u.Z(t.nodes(),(function(e){return t.node(e).rank})));a.Z(t.nodes(),(function(n){var r=t.node(n);o.Z(r,"rank")&&(r.rank-=e)}))}(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;a.Z(t.nodes(),(function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=tt(e,r.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){a.Z(t.nodes(),(function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){Ee(t)})),e(" parentDummyChains",(function(){ee(t)})),e(" addBorderSegments",(function(){!function(t){a.Z(t.children(),(function e(n){var r=t.children(n),i=t.node(n);if(r.length&&a.Z(r,e),o.Z(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var s=i.minRank,l=i.maxRank+1;s<l;++s)gt(t,"borderLeft","_bl",n,i,s),gt(t,"borderRight","_br",n,i,s)}}))}(t)})),e(" order",(function(){Xt(t)})),e(" insertSelfEdges",(function(){!function(t){var e=mt(t);a.Z(e,(function(e){var n=0;a.Z(e,(function(e,r){var i=t.node(e);i.order=r+n,a.Z(i.selfEdges,(function(e){ut(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){!function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||kt(t)}(t)})),e(" position",(function(){ge(t)})),e(" positionSelfEdges",(function(){!function(t){a.Z(t.nodes(),(function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,a=r.y,s=n.x-i,o=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){a.Z(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),a=t.node(et(n.borderLeft)),s=t.node(et(n.borderRight));n.width=Math.abs(s.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}})),a.Z(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){Ce(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){a.Z(t.edges(),(function(e){var n=t.edge(e);if(o.Z(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){bt(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,s=t.graph(),l=s.marginx||0,c=s.marginy||0;function u(t){var a=t.x,s=t.y,o=t.width,l=t.height;e=Math.min(e,a-o/2),n=Math.max(n,a+o/2),r=Math.min(r,s-l/2),i=Math.max(i,s+l/2)}a.Z(t.nodes(),(function(e){u(t.node(e))})),a.Z(t.edges(),(function(e){var n=t.edge(e);o.Z(n,"x")&&u(n)})),e-=l,r-=c,a.Z(t.nodes(),(function(n){var i=t.node(n);i.x-=e,i.y-=r})),a.Z(t.edges(),(function(n){var i=t.edge(n);a.Z(i.points,(function(t){t.x-=e,t.y-=r})),o.Z(i,"x")&&(i.x-=e),o.Z(i,"y")&&(i.y-=r)})),s.width=n-e+l,s.height=i-r+c}(t)})),e(" assignNodeIntersects",(function(){!function(t){a.Z(t.edges(),(function(e){var n,r,i=t.edge(e),a=t.node(e.v),s=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=s,r=a),i.points.unshift(ht(a,n)),i.points.push(ht(s,r))}))}(t)})),e(" reversePoints",(function(){!function(t){a.Z(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){v(t)}))}(e,n)})),n(" updateInputGraph",(function(){!function(t,e){a.Z(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),a.Z(t.edges(),(function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,o.Z(i,"x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))}var ke=["nodesep","edgesep","ranksep","marginx","marginy"],ve={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},xe=["acyclicer","ranker","rankdir","align"],Me=["width","height"],Le={width:0,height:0},we=["minlen","weight","width","height","labeloffset"],Te={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Se=["labelpos"];function De(t,e){return it(V.Z(t,e),Number)}function Ye(t){var e={};return a.Z(t,(function(t,n){e[n.toLowerCase()]=t})),e}function Ee(t){t.graph().dummyChains=[],a.Z(t.edges(),(function(e){!function(t,e){var n,r,i,a=e.v,s=t.node(a).rank,o=e.w,l=t.node(o).rank,c=e.name,u=t.edge(e),d=u.labelRank;if(l===s+1)return;for(t.removeEdge(e),i=0,++s;s<l;++i,++s)u.points=[],n=ut(t,"edge",r={width:0,height:0,edgeLabel:u,edgeObj:e,rank:s},"_d"),s===d&&(r.width=u.width,r.height=u.height,r.dummy="edge-label",r.labelpos=u.labelpos),t.setEdge(a,n,{weight:u.weight},c),0===i&&t.graph().dummyChains.push(n),a=n;t.setEdge(a,o,{weight:u.weight},c)}(t,e)}))}function Ce(t){a.Z(t.graph().dummyChains,(function(e){var n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)}))}function Ae(t){var e={};a.Z(t.sources(),(function n(r){var i=t.node(r);if(o.Z(e,r))return i.rank;e[r]=!0;var a=ot(u.Z(t.outEdges(r),(function(e){return n(e.w)-t.edge(e).minlen})));return a!==Number.POSITIVE_INFINITY&&null!=a||(a=0),i.rank=a}))}function Oe(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function Ne(t){var e,n,r=new h.k({directed:!1}),i=t.nodes()[0],a=t.nodeCount();for(r.setNode(i,{});Be(r,t)<a;)e=Fe(r,t),n=r.hasNode(e.v)?Oe(t,e):-Oe(t,e),Ie(r,t,n);return r}function Be(t,e){return a.Z(t.nodes(),(function n(r){a.Z(e.nodeEdges(r),(function(i){var a=i.v,s=r===a?i.w:a;t.hasNode(s)||Oe(e,i)||(t.setNode(s,{}),t.setEdge(r,s,{}),n(s))}))})),t.nodeCount()}function Fe(t,e){return ue(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return Oe(e,n)}))}function Ie(t,e,n){a.Z(t.nodes(),(function(t){e.node(t).rank+=n}))}l.Z(1);l.Z(1);n(39473),n(83970),n(93589),n(18533);(0,n(54193).Z)("length");RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Pe="[\\ud800-\\udfff]",je="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Re="\\ud83c[\\udffb-\\udfff]",He="[^\\ud800-\\udfff]",$e="(?:\\ud83c[\\udde6-\\uddff]){2}",Ze="[\\ud800-\\udbff][\\udc00-\\udfff]",We="(?:"+je+"|"+Re+")"+"?",ze="[\\ufe0e\\ufe0f]?",Ue=ze+We+("(?:\\u200d(?:"+[He,$e,Ze].join("|")+")"+ze+We+")*"),qe="(?:"+[He+je+"?",je,$e,Ze,Pe].join("|")+")";RegExp(Re+"(?="+Re+")|"+qe+Ue,"g");function Ve(){}function Ge(t,e,n){A.Z(e)||(e=[e]);var r=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],s={};return a.Z(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);Je(t,e,"post"===n,s,r,i)})),i}function Je(t,e,n,r,i,s){o.Z(r,e)||(r[e]=!0,n||s.push(e),a.Z(i(e),(function(e){Je(t,e,n,r,i,s)})),n&&s.push(e))}Ve.prototype=new Error;n(52544);function Xe(t){t=function(t){var e=(new h.k).setGraph(t.graph());return a.Z(t.nodes(),(function(n){e.setNode(n,t.node(n))})),a.Z(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e}(t),Ae(t);var e,n=Ne(t);for(tn(n),Ke(n,t);e=nn(n);)an(n,t,e,rn(n,t,e))}function Ke(t,e){var n=function(t,e){return Ge(t,e,"post")}(t,t.nodes());n=n.slice(0,n.length-1),a.Z(n,(function(n){!function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=Qe(t,e,n)}(t,e,n)}))}function Qe(t,e,n){var r=t.node(n).parent,i=!0,s=e.edge(n,r),o=0;return s||(i=!1,s=e.edge(r,n)),o=s.weight,a.Z(e.nodeEdges(n),(function(a){var s,l,c=a.v===n,u=c?a.w:a.v;if(u!==r){var d=c===i,h=e.edge(a).weight;if(o+=d?h:-h,s=n,l=u,t.hasEdge(s,l)){var m=t.edge(n,u).cutvalue;o+=d?-m:m}}})),o}function tn(t,e){arguments.length<2&&(e=t.nodes()[0]),en(t,{},1,e)}function en(t,e,n,r,i){var s=n,l=t.node(r);return e[r]=!0,a.Z(t.neighbors(r),(function(i){o.Z(e,i)||(n=en(t,e,n,i,r))})),l.low=s,l.lim=n++,i?l.parent=i:delete l.parent,n}function nn(t){return ce(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function rn(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var a=t.node(r),s=t.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var c=Ut.Z(e.edges(),(function(e){return l===sn(t,t.node(e.v),o)&&l!==sn(t,t.node(e.w),o)}));return ue(c,(function(t){return Oe(e,t)}))}function an(t,e,n,r){var i=n.v,s=n.w;t.removeEdge(i,s),t.setEdge(r.v,r.w,{}),tn(t),Ke(t,e),function(t,e){var n=ce(t.nodes(),(function(t){return!e.node(t).parent})),r=function(t,e){return Ge(t,e,"pre")}(t,n);r=r.slice(1),a.Z(r,(function(n){var r=t.node(n).parent,i=e.edge(n,r),a=!1;i||(i=e.edge(r,n),a=!0),e.node(n).rank=e.node(r).rank+(a?i.minlen:-i.minlen)}))}(t,e)}function sn(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}function on(t){switch(t.graph().ranker){case"network-simplex":default:cn(t);break;case"tight-tree":!function(t){Ae(t),Ne(t)}(t);break;case"longest-path":ln(t)}}Xe.initLowLimValues=tn,Xe.initCutValues=Ke,Xe.calcCutValue=Qe,Xe.leaveEdge=nn,Xe.enterEdge=rn,Xe.exchangeEdges=an;var ln=Ae;function cn(t){Xe(t)}},52544:(t,e,n)=>{"use strict";n.d(e,{k:()=>A});var r=n(17452),i=n(62002),a=n(73234),s=n(17179),o=n(13445),l=n(79697),c=n(70870),u=n(49360),d=n(10626),h=n(69581),m=n(63001),_=n(21692);const p=function(t){return t!=t};const f=function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1};const y=function(t,e,n){return e==e?f(t,e,n):(0,_.Z)(t,p,n)};const g=function(t,e){return!!(null==t?0:t.length)&&y(t,e,0)>-1};const b=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1};var k=n(59548),v=n(93203);const x=function(){};var M=n(6545),L=v.Z&&1/(0,M.Z)(new v.Z([,-0]))[1]==1/0?function(t){return new v.Z(t)}:x;const w=L;const T=function(t,e,n){var r=-1,i=g,a=t.length,s=!0,o=[],l=o;if(n)s=!1,i=b;else if(a>=200){var c=e?null:w(t);if(c)return(0,M.Z)(c);s=!1,i=k.Z,l=new m.Z}else l=e?[]:o;t:for(;++r<a;){var u=t[r],d=e?e(u):u;if(u=n||0!==u?u:0,s&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue t;e&&l.push(d),o.push(u)}else i(l,d,n)||(l!==o&&l.push(d),o.push(u))}return o};var S=n(836);const D=(0,h.Z)((function(t){return T((0,d.Z)(t,1,S.Z,!0))}));var Y=n(34148),E=n(92344),C="\0";class A{constructor(t={}){this._isDirected=!r.Z(t,"directed")||t.directed,this._isMultigraph=!!r.Z(t,"multigraph")&&t.multigraph,this._isCompound=!!r.Z(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=i.Z(void 0),this._defaultEdgeLabelFn=i.Z(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return a.Z(t)||(t=i.Z(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return s.Z(this._nodes)}sources(){var t=this;return o.Z(this.nodes(),(function(e){return l.Z(t._in[e])}))}sinks(){var t=this;return o.Z(this.nodes(),(function(e){return l.Z(t._out[e])}))}setNodes(t,e){var n=arguments,r=this;return c.Z(t,(function(t){n.length>1?r.setNode(t,e):r.setNode(t)})),this}setNode(t,e){return r.Z(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=C,this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return r.Z(this._nodes,t)}removeNode(t){var e=this;if(r.Z(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],c.Z(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),c.Z(s.Z(this._in[t]),n),delete this._in[t],delete this._preds[t],c.Z(s.Z(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(u.Z(e))e=C;else{for(var n=e+="";!u.Z(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==C)return e}}children(t){if(u.Z(t)&&(t=C),this._isCompound){var e=this._children[t];if(e)return s.Z(e)}else{if(t===C)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var e=this._preds[t];if(e)return s.Z(e)}successors(t){var e=this._sucs[t];if(e)return s.Z(e)}neighbors(t){var e=this.predecessors(t);if(e)return D(e,this.successors(t))}isLeaf(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;c.Z(this._nodes,(function(n,r){t(r)&&e.setNode(r,n)})),c.Z(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))}));var r={};function i(t){var a=n.parent(t);return void 0===a||e.hasNode(a)?(r[t]=a,a):a in r?r[a]:i(a)}return this._isCompound&&c.Z(e.nodes(),(function(t){e.setParent(t,i(t))})),e}setDefaultEdgeLabel(t){return a.Z(t)||(t=i.Z(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Y.Z(this._edgeObjs)}setPath(t,e){var n=this,r=arguments;return E.Z(t,(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i})),this}setEdge(){var t,e,n,i,a=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,n=s.name,2===arguments.length&&(i=arguments[1],a=!0)):(t=s,e=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),t=""+t,e=""+e,u.Z(n)||(n=""+n);var o=B(this._isDirected,t,e,n);if(r.Z(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!u.Z(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(t,e,n);var l=function(t,e,n,r){var i=""+e,a=""+n;if(!t&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};r&&(o.name=r);return o}(this._isDirected,t,e,n);return t=l.v,e=l.w,Object.freeze(l),this._edgeObjs[o]=l,O(this._preds[e],t),O(this._sucs[t],e),this._in[e][o]=l,this._out[t][o]=l,this._edgeCount++,this}edge(t,e,n){var r=1===arguments.length?F(this._isDirected,arguments[0]):B(this._isDirected,t,e,n);return this._edgeLabels[r]}hasEdge(t,e,n){var i=1===arguments.length?F(this._isDirected,arguments[0]):B(this._isDirected,t,e,n);return r.Z(this._edgeLabels,i)}removeEdge(t,e,n){var r=1===arguments.length?F(this._isDirected,arguments[0]):B(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],N(this._preds[e],t),N(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this}inEdges(t,e){var n=this._in[t];if(n){var r=Y.Z(n);return e?o.Z(r,(function(t){return t.v===e})):r}}outEdges(t,e){var n=this._out[t];if(n){var r=Y.Z(n);return e?o.Z(r,(function(t){return t.w===e})):r}}nodeEdges(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}}function O(t,e){t[e]?t[e]++:t[e]=1}function N(t,e){--t[e]||delete t[e]}function B(t,e,n,r){var i=""+e,a=""+n;if(!t&&i>a){var s=i;i=a,a=s}return i+"\x01"+a+"\x01"+(u.Z(r)?"\0":r)}function F(t,e){return B(t,e.v,e.w,e.name)}A.prototype._nodeCount=0,A.prototype._edgeCount=0},45625:(t,e,n)=>{"use strict";n.d(e,{k:()=>r.k});var r=n(52544)},39354:(t,e,n)=>{"use strict";n.d(e,{c:()=>o});var r=n(49360),i=n(48451);const a=function(t){return(0,i.Z)(t,4)};var s=n(43836);n(52544);function o(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:l(t),edges:c(t)};return r.Z(t.graph())||(e.value=a(t.graph())),e}function l(t){return s.Z(t.nodes(),(function(e){var n=t.node(e),i=t.parent(e),a={v:e};return r.Z(n)||(a.value=n),r.Z(i)||(a.parent=i),a}))}function c(t){return s.Z(t.edges(),(function(e){var n=t.edge(e),i={v:e.v,w:e.w};return r.Z(e.name)||(i.name=e.name),r.Z(n)||(i.value=n),i}))}},91518:(t,e,n)=>{"use strict";n.d(e,{sY:()=>C});var r=n(59373),i=n(17452),a=n(3688),s=n(70870),o=n(70277),l=n(96225),c={normal:function(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.bg(i,n[r+"Style"]),n[r+"Class"]&&i.attr("class",n[r+"Class"])},vee:function(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.bg(i,n[r+"Style"]),n[r+"Class"]&&i.attr("class",n[r+"Class"])},undirected:function(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");l.bg(i,n[r+"Style"]),n[r+"Class"]&&i.attr("class",n[r+"Class"])}};function u(t){c=t}var d=n(43349);function h(t,e,n){var r=e.label,i=t.append("g");"svg"===e.labelType?function(t,e){var n=t;n.node().appendChild(e.label),l.bg(n,e.labelStyle)}(i,e):"string"!=typeof r||"html"===e.labelType?(0,d.a)(i,e):function(t,e){for(var n=t.append("text"),r=function(t){for(var e,n="",r=!1,i=0;i<t.length;++i)e=t[i],r?(n+="n"===e?"\n":e,r=!1):"\\"===e?r=!0:n+=e;return n}(e.label).split("\n"),i=0;i<r.length;i++)n.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(r[i]);l.bg(n,e.labelStyle)}(i,e);var a,s=i.node().getBBox();switch(n){case"top":a=-e.height/2;break;case"bottom":a=e.height/2-s.height;break;default:a=-s.height/2}return i.attr("transform","translate("+-s.width/2+","+a+")"),i}var m=function(t,e){var n=e.nodes().filter((function(t){return l.bF(e,t)})),i=t.selectAll("g.cluster").data(n,(function(t){return t}));l.WR(i.exit(),e).style("opacity",0).remove();var a=i.enter().append("g").attr("class","cluster").attr("id",(function(t){return e.node(t).id})).style("opacity",0).each((function(t){var n=e.node(t),i=r.Ys(this);r.Ys(this).append("rect"),h(i.append("g").attr("class","label"),n,n.clusterLabelPos)}));return i=i.merge(a),(i=l.WR(i,e).style("opacity",1)).selectAll("rect").each((function(t){var n=e.node(t),i=r.Ys(this);l.bg(i,n.style)})),i};function _(t){m=t}let p=function(t,e){var n,a=t.selectAll("g.edgeLabel").data(e.edges(),(function(t){return l.O1(t)})).classed("update",!0);return a.exit().remove(),a.enter().append("g").classed("edgeLabel",!0).style("opacity",0),(a=t.selectAll("g.edgeLabel")).each((function(t){var n=r.Ys(this);n.select(".label").remove();var a=e.edge(t),s=h(n,e.edge(t),0).classed("label",!0),o=s.node().getBBox();a.labelId&&s.attr("id",a.labelId),i.Z(a,"width")||(a.width=o.width),i.Z(a,"height")||(a.height=o.height)})),n=a.exit?a.exit():a.selectAll(null),l.WR(n,e).style("opacity",0).remove(),a};function f(t){p=t}var y=n(66749),g=n(74379);function b(t,e){return t.intersect(e)}var k=function(t,e,n){var i=t.selectAll("g.edgePath").data(e.edges(),(function(t){return l.O1(t)})).classed("update",!0),a=function(t,e){var n=t.enter().append("g").attr("class","edgePath").style("opacity",0);return n.append("path").attr("class","path").attr("d",(function(t){var n=e.edge(t),r=e.node(t.v).elem;return x(n,g.Z(n.points.length).map((function(){return e=(t=r).getBBox(),{x:(n=t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width/2,e.height/2)).e,y:n.f};var t,e,n})))})),n.append("defs"),n}(i,e);!function(t,e){var n=t.exit();l.WR(n,e).style("opacity",0).remove()}(i,e);var s=void 0!==i.merge?i.merge(a):i;return l.WR(s,e).style("opacity",1),s.each((function(t){var n=r.Ys(this),i=e.edge(t);i.elem=this,i.id&&n.attr("id",i.id),l.$p(n,i.class,(n.classed("update")?"update ":"")+"edgePath")})),s.selectAll("path.path").each((function(t){var n=e.edge(t);n.arrowheadId=y.Z("arrowhead");var i=r.Ys(this).attr("marker-end",(function(){return"url("+(t=location.href,e=n.arrowheadId,t.split("#")[0]+"#"+e+")");var t,e})).style("fill","none");l.WR(i,e).attr("d",(function(t){return function(t,e){var n=t.edge(e),r=t.node(e.v),i=t.node(e.w),a=n.points.slice(1,n.points.length-1);return a.unshift(b(r,a[0])),a.push(b(i,a[a.length-1])),x(n,a)}(e,t)})),l.bg(i,n.style)})),s.selectAll("defs *").remove(),s.selectAll("defs").each((function(t){var i=e.edge(t);(0,n[i.arrowhead])(r.Ys(this),i.arrowheadId,i,"arrowhead")})),s};function v(t){k=t}function x(t,e){var n=(r.jvg||r.YPS.line)().x((function(t){return t.x})).y((function(t){return t.y}));return(n.curve||n.interpolate)(t.curve),n(e)}var M=n(61666),L=function(t,e,n){var a,s=e.nodes().filter((function(t){return!l.bF(e,t)})),o=t.selectAll("g.node").data(s,(function(t){return t})).classed("update",!0);return o.exit().remove(),o.enter().append("g").attr("class","node").style("opacity",0),(o=t.selectAll("g.node")).each((function(t){var a=e.node(t),s=r.Ys(this);l.$p(s,a.class,(s.classed("update")?"update ":"")+"node"),s.select("g.label").remove();var o=s.append("g").attr("class","label"),c=h(o,a),u=n[a.shape],d=M.Z(c.node().getBBox(),"width","height");a.elem=this,a.id&&s.attr("id",a.id),a.labelId&&o.attr("id",a.labelId),i.Z(a,"width")&&(d.width=a.width),i.Z(a,"height")&&(d.height=a.height),d.width+=a.paddingLeft+a.paddingRight,d.height+=a.paddingTop+a.paddingBottom,o.attr("transform","translate("+(a.paddingLeft-a.paddingRight)/2+","+(a.paddingTop-a.paddingBottom)/2+")");var m=r.Ys(this);m.select(".label-container").remove();var _=u(m,d,a).classed("label-container",!0);l.bg(_,a.style);var p=_.node().getBBox();a.width=p.width,a.height=p.height})),a=o.exit?o.exit():o.selectAll(null),l.WR(a,e).style("opacity",0).remove(),o};function w(t){L=t}function T(t,e,n,r){var i=t.x,a=t.y,s=i-r.x,o=a-r.y,l=Math.sqrt(e*e*o*o+n*n*s*s),c=Math.abs(e*n*s/l);r.x<i&&(c=-c);var u=Math.abs(e*n*o/l);return r.y<a&&(u=-u),{x:i+c,y:a+u}}var S=n(23352),D=n(22930),Y={rect:function(t,e,n){var r=t.insert("rect",":first-child").attr("rx",n.rx).attr("ry",n.ry).attr("x",-e.width/2).attr("y",-e.height/2).attr("width",e.width).attr("height",e.height);return n.intersect=function(t){return(0,D.q)(n,t)},r},ellipse:function(t,e,n){var r=e.width/2,i=e.height/2,a=t.insert("ellipse",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("rx",r).attr("ry",i);return n.intersect=function(t){return T(n,r,i,t)},a},circle:function(t,e,n){var r=Math.max(e.width,e.height)/2,i=t.insert("circle",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("r",r);return n.intersect=function(t){return function(t,e,n){return T(t,e,e,n)}(n,r,t)},i},diamond:function(t,e,n){var r=e.width*Math.SQRT2/2,i=e.height*Math.SQRT2/2,a=[{x:0,y:-i},{x:-r,y:0},{x:0,y:i},{x:r,y:0}],s=t.insert("polygon",":first-child").attr("points",a.map((function(t){return t.x+","+t.y})).join(" "));return n.intersect=function(t){return(0,S.A)(n,a,t)},s}};function E(t){Y=t}function C(){var t=function(t,e){!function(t){t.nodes().forEach((function(e){var n=t.node(e);i.Z(n,"label")||t.children(e).length||(n.label=e),i.Z(n,"paddingX")&&a.Z(n,{paddingLeft:n.paddingX,paddingRight:n.paddingX}),i.Z(n,"paddingY")&&a.Z(n,{paddingTop:n.paddingY,paddingBottom:n.paddingY}),i.Z(n,"padding")&&a.Z(n,{paddingLeft:n.padding,paddingRight:n.padding,paddingTop:n.padding,paddingBottom:n.padding}),a.Z(n,A),s.Z(["paddingLeft","paddingRight","paddingTop","paddingBottom"],(function(t){n[t]=Number(n[t])})),i.Z(n,"width")&&(n._prevWidth=n.width),i.Z(n,"height")&&(n._prevHeight=n.height)})),t.edges().forEach((function(e){var n=t.edge(e);i.Z(n,"label")||(n.label=""),a.Z(n,O)}))}(e);var n=N(t,"output"),u=N(n,"clusters"),d=N(n,"edgePaths"),h=p(N(n,"edgeLabels"),e),_=L(N(n,"nodes"),e,Y);(0,o.bK)(e),function(t,e){function n(t){var n=e.node(t);return"translate("+n.x+","+n.y+")"}t.filter((function(){return!r.Ys(this).classed("update")})).attr("transform",n),l.WR(t,e).style("opacity",1).attr("transform",n)}(_,e),function(t,e){function n(t){var n=e.edge(t);return i.Z(n,"x")?"translate("+n.x+","+n.y+")":""}t.filter((function(){return!r.Ys(this).classed("update")})).attr("transform",n),l.WR(t,e).style("opacity",1).attr("transform",n)}(h,e),k(d,e,c),function(t,e){var n=t.filter((function(){return!r.Ys(this).classed("update")}));function i(t){var n=e.node(t);return"translate("+n.x+","+n.y+")"}n.attr("transform",i),l.WR(t,e).style("opacity",1).attr("transform",i),l.WR(n.selectAll("rect"),e).attr("width",(function(t){return e.node(t).width})).attr("height",(function(t){return e.node(t).height})).attr("x",(function(t){return-e.node(t).width/2})).attr("y",(function(t){return-e.node(t).height/2}))}(m(u,e),e),function(t){s.Z(t.nodes(),(function(e){var n=t.node(e);i.Z(n,"_prevWidth")?n.width=n._prevWidth:delete n.width,i.Z(n,"_prevHeight")?n.height=n._prevHeight:delete n.height,delete n._prevWidth,delete n._prevHeight}))}(e)};return t.createNodes=function(e){return arguments.length?(w(e),t):L},t.createClusters=function(e){return arguments.length?(_(e),t):m},t.createEdgeLabels=function(e){return arguments.length?(f(e),t):p},t.createEdgePaths=function(e){return arguments.length?(v(e),t):k},t.shapes=function(e){return arguments.length?(E(e),t):Y},t.arrows=function(e){return arguments.length?(u(e),t):c},t}var A={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},O={arrowhead:"normal",curve:r.c_6};function N(t,e){var n=t.select("g."+e);return n.empty()&&(n=t.append("g").attr("class",e)),n}n(45625)},21883:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(61691),i=n(82142);const a=class{constructor(){this.type=i.w.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=i.w.ALL}is(t){return this.type===t}};const s=new class{constructor(t,e){this.color=e,this.changed=!1,this.data=t,this.type=new a}set(t,e){return this.color=e,this.changed=!1,this.data=t,this.type.type=i.w.ALL,this}_ensureHSL(){const t=this.data,{h:e,s:n,l:i}=t;void 0===e&&(t.h=r.Z.channel.rgb2hsl(t,"h")),void 0===n&&(t.s=r.Z.channel.rgb2hsl(t,"s")),void 0===i&&(t.l=r.Z.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r:e,g:n,b:i}=t;void 0===e&&(t.r=r.Z.channel.hsl2rgb(t,"r")),void 0===n&&(t.g=r.Z.channel.hsl2rgb(t,"g")),void 0===i&&(t.b=r.Z.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,e=t.r;return this.type.is(i.w.HSL)||void 0===e?(this._ensureHSL(),r.Z.channel.hsl2rgb(t,"r")):e}get g(){const t=this.data,e=t.g;return this.type.is(i.w.HSL)||void 0===e?(this._ensureHSL(),r.Z.channel.hsl2rgb(t,"g")):e}get b(){const t=this.data,e=t.b;return this.type.is(i.w.HSL)||void 0===e?(this._ensureHSL(),r.Z.channel.hsl2rgb(t,"b")):e}get h(){const t=this.data,e=t.h;return this.type.is(i.w.RGB)||void 0===e?(this._ensureRGB(),r.Z.channel.rgb2hsl(t,"h")):e}get s(){const t=this.data,e=t.s;return this.type.is(i.w.RGB)||void 0===e?(this._ensureRGB(),r.Z.channel.rgb2hsl(t,"s")):e}get l(){const t=this.data,e=t.l;return this.type.is(i.w.RGB)||void 0===e?(this._ensureRGB(),r.Z.channel.rgb2hsl(t,"l")):e}get a(){return this.data.a}set r(t){this.type.set(i.w.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(i.w.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(i.w.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(i.w.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(i.w.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(i.w.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}({r:0,g:0,b:0,a:0},"transparent")},71610:(t,e,n)=>{"use strict";n.d(e,{Z:()=>p});var r=n(21883),i=n(82142);const a={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(35!==t.charCodeAt(0))return;const e=t.match(a.re);if(!e)return;const n=e[1],i=parseInt(n,16),s=n.length,o=s%4==0,l=s>4,c=l?1:17,u=l?8:4,d=o?0:-1,h=l?255:15;return r.Z.set({r:(i>>u*(d+3)&h)*c,g:(i>>u*(d+2)&h)*c,b:(i>>u*(d+1)&h)*c,a:o?(i&h)*c/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:a}=t;return a<1?`#${i.Q[Math.round(e)]}${i.Q[Math.round(n)]}${i.Q[Math.round(r)]}${i.Q[Math.round(255*a)]}`:`#${i.Q[Math.round(e)]}${i.Q[Math.round(n)]}${i.Q[Math.round(r)]}`}},s=a;var o=n(61691);const l={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(l.hueRe);if(e){const[,t,n]=e;switch(n){case"grad":return o.Z.channel.clamp.h(.9*parseFloat(t));case"rad":return o.Z.channel.clamp.h(180*parseFloat(t)/Math.PI);case"turn":return o.Z.channel.clamp.h(360*parseFloat(t))}}return o.Z.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(104!==e&&72!==e)return;const n=t.match(l.re);if(!n)return;const[,i,a,s,c,u]=n;return r.Z.set({h:l._hue2deg(i),s:o.Z.channel.clamp.s(parseFloat(a)),l:o.Z.channel.clamp.l(parseFloat(s)),a:c?o.Z.channel.clamp.a(u?parseFloat(c)/100:parseFloat(c)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}%, ${o.Z.lang.round(r)}%, ${i})`:`hsl(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}%, ${o.Z.lang.round(r)}%)`}},c=l,u={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=u.colors[t];if(e)return s.parse(e)},stringify:t=>{const e=s.stringify(t);for(const n in u.colors)if(u.colors[n]===e)return n}},d=u,h={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(114!==e&&82!==e)return;const n=t.match(h.re);if(!n)return;const[,i,a,s,l,c,u,d,m]=n;return r.Z.set({r:o.Z.channel.clamp.r(a?2.55*parseFloat(i):parseFloat(i)),g:o.Z.channel.clamp.g(l?2.55*parseFloat(s):parseFloat(s)),b:o.Z.channel.clamp.b(u?2.55*parseFloat(c):parseFloat(c)),a:d?o.Z.channel.clamp.a(m?parseFloat(d)/100:parseFloat(d)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}, ${o.Z.lang.round(r)}, ${o.Z.lang.round(i)})`:`rgb(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}, ${o.Z.lang.round(r)})`}},m=h,_={format:{keyword:u,hex:s,rgb:h,rgba:h,hsl:l,hsla:l},parse:t=>{if("string"!=typeof t)return t;const e=s.parse(t)||m.parse(t)||c.parse(t)||d.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(i.w.HSL)||void 0===t.data.r?c.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?m.stringify(t):s.stringify(t)},p=_},82142:(t,e,n)=>{"use strict";n.d(e,{Q:()=>i,w:()=>a});var r=n(61691);const i={};for(let s=0;s<=255;s++)i[s]=r.Z.unit.dec2hex(s);const a={ALL:0,RGB:1,HSL:2}},26174:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(61691),i=n(71610);const a=(t,e,n)=>{const a=i.Z.parse(t),s=a[e],o=r.Z.channel.clamp[e](s+n);return s!==o&&(a[e]=o),i.Z.stringify(a)}},7201:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(26174);const i=(t,e)=>(0,r.Z)(t,"l",-e)},12281:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(26174);const i=(t,e)=>(0,r.Z)(t,"l",e)},61691:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});const r={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},i)=>{if(!e)return 2.55*n;t/=360,e/=100;const a=(n/=100)<.5?n*(1+e):n+e-n*e,s=2*n-a;switch(i){case"r":return 255*r.hue2rgb(s,a,t+1/3);case"g":return 255*r.hue2rgb(s,a,t);case"b":return 255*r.hue2rgb(s,a,t-1/3)}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),a=Math.min(t,e,n),s=(i+a)/2;if("l"===r)return 100*s;if(i===a)return 0;const o=i-a;if("s"===r)return 100*(s>.5?o/(2-i-a):o/(i+a));switch(i){case t:return 60*((e-n)/o+(e<n?6:0));case e:return 60*((n-t)/o+2);case n:return 60*((t-e)/o+4);default:return-1}}},i={channel:r,lang:{clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(1e10*t)/1e10},unit:{dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}}}},67308:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});const r=function(){this.__data__=[],this.size=0};var i=n(79651);const a=function(t,e){for(var n=t.length;n--;)if((0,i.Z)(t[n][0],e))return n;return-1};var s=Array.prototype.splice;const o=function(t){var e=this.__data__,n=a(e,t);return!(n<0)&&(n==e.length-1?e.pop():s.call(e,n,1),--this.size,!0)};const l=function(t){var e=this.__data__,n=a(e,t);return n<0?void 0:e[n][1]};const c=function(t){return a(this.__data__,t)>-1};const u=function(t,e){var n=this.__data__,r=a(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function d(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d.prototype.clear=r,d.prototype.delete=o,d.prototype.get=l,d.prototype.has=c,d.prototype.set=u;const h=d},86183:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(62508),i=n(66092);const a=(0,r.Z)(i.Z,"Map")},37834:(t,e,n)=>{"use strict";n.d(e,{Z:()=>M});const r=(0,n(62508).Z)(Object,"create");const i=function(){this.__data__=r?r(null):{},this.size=0};const a=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e};var s=Object.prototype.hasOwnProperty;const o=function(t){var e=this.__data__;if(r){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return s.call(e,t)?e[t]:void 0};var l=Object.prototype.hasOwnProperty;const c=function(t){var e=this.__data__;return r?void 0!==e[t]:l.call(e,t)};const u=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?"__lodash_hash_undefined__":e,this};function d(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d.prototype.clear=i,d.prototype.delete=a,d.prototype.get=o,d.prototype.has=c,d.prototype.set=u;const h=d;var m=n(67308),_=n(86183);const p=function(){this.size=0,this.__data__={hash:new h,map:new(_.Z||m.Z),string:new h}};const f=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};const y=function(t,e){var n=t.__data__;return f(e)?n["string"==typeof e?"string":"hash"]:n.map};const g=function(t){var e=y(this,t).delete(t);return this.size-=e?1:0,e};const b=function(t){return y(this,t).get(t)};const k=function(t){return y(this,t).has(t)};const v=function(t,e){var n=y(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function x(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}x.prototype.clear=p,x.prototype.delete=g,x.prototype.get=b,x.prototype.has=k,x.prototype.set=v;const M=x},93203:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(62508),i=n(66092);const a=(0,r.Z)(i.Z,"Set")},63001:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(37834);const i=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};const a=function(t){return this.__data__.has(t)};function s(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new r.Z;++e<n;)this.add(t[e])}s.prototype.add=s.prototype.push=i,s.prototype.has=a;const o=s},31667:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(67308);const i=function(){this.__data__=new r.Z,this.size=0};const a=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};const s=function(t){return this.__data__.get(t)};const o=function(t){return this.__data__.has(t)};var l=n(86183),c=n(37834);const u=function(t,e){var n=this.__data__;if(n instanceof r.Z){var i=n.__data__;if(!l.Z||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new c.Z(i)}return n.set(t,e),this.size=n.size,this};function d(t){var e=this.__data__=new r.Z(t);this.size=e.size}d.prototype.clear=i,d.prototype.delete=a,d.prototype.get=s,d.prototype.has=o,d.prototype.set=u;const h=d},17685:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=n(66092).Z.Symbol},84073:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=n(66092).Z.Uint8Array},76579:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}},68774:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,a=[];++n<r;){var s=t[n];e(s,n,t)&&(a[i++]=s)}return a}},87668:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});const r=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r};var i=n(29169),a=n(27771),s=n(77008),o=n(56009),l=n(18843),c=Object.prototype.hasOwnProperty;const u=function(t,e){var n=(0,a.Z)(t),u=!n&&(0,i.Z)(t),d=!n&&!u&&(0,s.Z)(t),h=!n&&!u&&!d&&(0,l.Z)(t),m=n||u||d||h,_=m?r(t.length,String):[],p=_.length;for(var f in t)!e&&!c.call(t,f)||m&&("length"==f||d&&("offset"==f||"parent"==f)||h&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||(0,o.Z)(f,p))||_.push(f);return _}},74073:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}},58694:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}},72954:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(74752),i=n(79651),a=Object.prototype.hasOwnProperty;const s=function(t,e,n){var s=t[e];a.call(t,e)&&(0,i.Z)(s,n)&&(void 0!==n||e in t)||(0,r.Z)(t,e,n)}},74752:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(77904);const i=function(t,e,n){"__proto__"==e&&r.Z?(0,r.Z)(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},48451:(t,e,n)=>{"use strict";n.d(e,{Z:()=>Q});var r=n(31667),i=n(76579),a=n(72954),s=n(31899),o=n(17179);const l=function(t,e){return t&&(0,s.Z)(e,(0,o.Z)(e),t)};var c=n(32957);const u=function(t,e){return t&&(0,s.Z)(e,(0,c.Z)(e),t)};var d=n(91050),h=n(87215),m=n(95695);const _=function(t,e){return(0,s.Z)(t,(0,m.Z)(t),e)};var p=n(58694),f=n(12513),y=n(60532);const g=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)(0,p.Z)(e,(0,m.Z)(t)),t=(0,f.Z)(t);return e}:y.Z;const b=function(t,e){return(0,s.Z)(t,g(t),e)};var k=n(1808),v=n(63327);const x=function(t){return(0,v.Z)(t,c.Z,g)};var M=n(83970),L=Object.prototype.hasOwnProperty;const w=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&L.call(t,"index")&&(n.index=t.index,n.input=t.input),n};var T=n(41884);const S=function(t,e){var n=e?(0,T.Z)(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)};var D=/\w*$/;const Y=function(t){var e=new t.constructor(t.source,D.exec(t));return e.lastIndex=t.lastIndex,e};var E=n(17685),C=E.Z?E.Z.prototype:void 0,A=C?C.valueOf:void 0;const O=function(t){return A?Object(A.call(t)):{}};var N=n(12701);const B=function(t,e,n){var r=t.constructor;switch(e){case"[object ArrayBuffer]":return(0,T.Z)(t);case"[object Boolean]":case"[object Date]":return new r(+t);case"[object DataView]":return S(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return(0,N.Z)(t,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(t);case"[object RegExp]":return Y(t);case"[object Symbol]":return O(t)}};var F=n(73658),I=n(27771),P=n(77008),j=n(18533);const R=function(t){return(0,j.Z)(t)&&"[object Map]"==(0,M.Z)(t)};var H=n(21162),$=n(98351),Z=$.Z&&$.Z.isMap;const W=Z?(0,H.Z)(Z):R;var z=n(77226);const U=function(t){return(0,j.Z)(t)&&"[object Set]"==(0,M.Z)(t)};var q=$.Z&&$.Z.isSet;const V=q?(0,H.Z)(q):U;var G="[object Arguments]",J="[object Function]",X="[object Object]",K={};K[G]=K["[object Array]"]=K["[object ArrayBuffer]"]=K["[object DataView]"]=K["[object Boolean]"]=K["[object Date]"]=K["[object Float32Array]"]=K["[object Float64Array]"]=K["[object Int8Array]"]=K["[object Int16Array]"]=K["[object Int32Array]"]=K["[object Map]"]=K["[object Number]"]=K[X]=K["[object RegExp]"]=K["[object Set]"]=K["[object String]"]=K["[object Symbol]"]=K["[object Uint8Array]"]=K["[object Uint8ClampedArray]"]=K["[object Uint16Array]"]=K["[object Uint32Array]"]=!0,K["[object Error]"]=K[J]=K["[object WeakMap]"]=!1;const Q=function t(e,n,s,m,p,f){var y,g=1&n,v=2&n,L=4&n;if(s&&(y=p?s(e,m,p,f):s(e)),void 0!==y)return y;if(!(0,z.Z)(e))return e;var T=(0,I.Z)(e);if(T){if(y=w(e),!g)return(0,h.Z)(e,y)}else{var S=(0,M.Z)(e),D=S==J||"[object GeneratorFunction]"==S;if((0,P.Z)(e))return(0,d.Z)(e,g);if(S==X||S==G||D&&!p){if(y=v||D?{}:(0,F.Z)(e),!g)return v?b(e,u(y,e)):_(e,l(y,e))}else{if(!K[S])return p?e:{};y=B(e,S,g)}}f||(f=new r.Z);var Y=f.get(e);if(Y)return Y;f.set(e,y),V(e)?e.forEach((function(r){y.add(t(r,n,s,r,e,f))})):W(e)&&e.forEach((function(r,i){y.set(i,t(r,n,s,i,e,f))}));var E=L?v?x:k.Z:v?c.Z:o.Z,C=T?void 0:E(e);return(0,i.Z)(C||e,(function(r,i){C&&(r=e[i=r]),(0,a.Z)(y,i,t(r,n,s,i,e,f))})),y}},49811:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(2693),i=n(50585);const a=function(t,e){return function(n,r){if(null==n)return n;if(!(0,i.Z)(n))return t(n,r);for(var a=n.length,s=e?a:-1,o=Object(n);(e?s--:++s<a)&&!1!==r(o[s],s,o););return n}}(r.Z)},21692:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e,n,r){for(var i=t.length,a=n+(r?1:-1);r?a--:++a<i;)if(e(t[a],a,t))return a;return-1}},10626:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(58694),i=n(17685),a=n(29169),s=n(27771),o=i.Z?i.Z.isConcatSpreadable:void 0;const l=function(t){return(0,s.Z)(t)||(0,a.Z)(t)||!!(o&&t&&t[o])};const c=function t(e,n,i,a,s){var o=-1,c=e.length;for(i||(i=l),s||(s=[]);++o<c;){var u=e[o];n>0&&i(u)?n>1?t(u,n-1,i,a,s):(0,r.Z)(s,u):a||(s[s.length]=u)}return s}},61395:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(e,n,r){for(var i=-1,a=Object(e),s=r(e),o=s.length;o--;){var l=s[t?o:++i];if(!1===n(a[l],l,a))break}return e}}()},2693:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(61395),i=n(17179);const a=function(t,e){return t&&(0,r.Z)(t,e,i.Z)}},13317:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(22823),i=n(62281);const a=function(t,e){for(var n=0,a=(e=(0,r.Z)(e,t)).length;null!=t&&n<a;)t=t[(0,i.Z)(e[n++])];return n&&n==a?t:void 0}},63327:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(58694),i=n(27771);const a=function(t,e,n){var a=e(t);return(0,i.Z)(t)?a:(0,r.Z)(a,n(t))}},93589:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(17685),i=Object.prototype,a=i.hasOwnProperty,s=i.toString,o=r.Z?r.Z.toStringTag:void 0;const l=function(t){var e=a.call(t,o),n=t[o];try{t[o]=void 0;var r=!0}catch(l){}var i=s.call(t);return r&&(e?t[o]=n:delete t[o]),i};var c=Object.prototype.toString;const u=function(t){return c.call(t)};var d=r.Z?r.Z.toStringTag:void 0;const h=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":d&&d in Object(t)?l(t):u(t)}},74765:(t,e,n)=>{"use strict";n.d(e,{Z:()=>q});var r=n(31667),i=n(63001);const a=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1};var s=n(59548);const o=function(t,e,n,r,o,l){var c=1&n,u=t.length,d=e.length;if(u!=d&&!(c&&d>u))return!1;var h=l.get(t),m=l.get(e);if(h&&m)return h==e&&m==t;var _=-1,p=!0,f=2&n?new i.Z:void 0;for(l.set(t,e),l.set(e,t);++_<u;){var y=t[_],g=e[_];if(r)var b=c?r(g,y,_,e,t,l):r(y,g,_,t,e,l);if(void 0!==b){if(b)continue;p=!1;break}if(f){if(!a(e,(function(t,e){if(!(0,s.Z)(f,e)&&(y===t||o(y,t,n,r,l)))return f.push(e)}))){p=!1;break}}else if(y!==g&&!o(y,g,n,r,l)){p=!1;break}}return l.delete(t),l.delete(e),p};var l=n(17685),c=n(84073),u=n(79651);const d=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n};var h=n(6545),m=l.Z?l.Z.prototype:void 0,_=m?m.valueOf:void 0;const p=function(t,e,n,r,i,a,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!a(new c.Z(t),new c.Z(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return(0,u.Z)(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var l=d;case"[object Set]":var m=1&r;if(l||(l=h.Z),t.size!=e.size&&!m)return!1;var p=s.get(t);if(p)return p==e;r|=2,s.set(t,e);var f=o(l(t),l(e),r,i,a,s);return s.delete(t),f;case"[object Symbol]":if(_)return _.call(t)==_.call(e)}return!1};var f=n(1808),y=Object.prototype.hasOwnProperty;const g=function(t,e,n,r,i,a){var s=1&n,o=(0,f.Z)(t),l=o.length;if(l!=(0,f.Z)(e).length&&!s)return!1;for(var c=l;c--;){var u=o[c];if(!(s?u in e:y.call(e,u)))return!1}var d=a.get(t),h=a.get(e);if(d&&h)return d==e&&h==t;var m=!0;a.set(t,e),a.set(e,t);for(var _=s;++c<l;){var p=t[u=o[c]],g=e[u];if(r)var b=s?r(g,p,u,e,t,a):r(p,g,u,t,e,a);if(!(void 0===b?p===g||i(p,g,n,r,a):b)){m=!1;break}_||(_="constructor"==u)}if(m&&!_){var k=t.constructor,v=e.constructor;k==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof k&&k instanceof k&&"function"==typeof v&&v instanceof v||(m=!1)}return a.delete(t),a.delete(e),m};var b=n(83970),k=n(27771),v=n(77008),x=n(18843),M="[object Arguments]",L="[object Array]",w="[object Object]",T=Object.prototype.hasOwnProperty;const S=function(t,e,n,i,a,s){var l=(0,k.Z)(t),c=(0,k.Z)(e),u=l?L:(0,b.Z)(t),d=c?L:(0,b.Z)(e),h=(u=u==M?w:u)==w,m=(d=d==M?w:d)==w,_=u==d;if(_&&(0,v.Z)(t)){if(!(0,v.Z)(e))return!1;l=!0,h=!1}if(_&&!h)return s||(s=new r.Z),l||(0,x.Z)(t)?o(t,e,n,i,a,s):p(t,e,u,n,i,a,s);if(!(1&n)){var f=h&&T.call(t,"__wrapped__"),y=m&&T.call(e,"__wrapped__");if(f||y){var S=f?t.value():t,D=y?e.value():e;return s||(s=new r.Z),a(S,D,n,i,s)}}return!!_&&(s||(s=new r.Z),g(t,e,n,i,a,s))};var D=n(18533);const Y=function t(e,n,r,i,a){return e===n||(null==e||null==n||!(0,D.Z)(e)&&!(0,D.Z)(n)?e!=e&&n!=n:S(e,n,r,i,t,a))};const E=function(t,e,n,i){var a=n.length,s=a,o=!i;if(null==t)return!s;for(t=Object(t);a--;){var l=n[a];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<s;){var c=(l=n[a])[0],u=t[c],d=l[1];if(o&&l[2]){if(void 0===u&&!(c in t))return!1}else{var h=new r.Z;if(i)var m=i(u,d,c,t,e,h);if(!(void 0===m?Y(d,u,3,i,h):m))return!1}}return!0};var C=n(77226);const A=function(t){return t==t&&!(0,C.Z)(t)};var O=n(17179);const N=function(t){for(var e=(0,O.Z)(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,A(i)]}return e};const B=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}};const F=function(t){var e=N(t);return 1==e.length&&e[0][2]?B(e[0][0],e[0][1]):function(n){return n===t||E(n,t,e)}};var I=n(13317);const P=function(t,e,n){var r=null==t?void 0:(0,I.Z)(t,e);return void 0===r?n:r};var j=n(75487),R=n(99365),H=n(62281);const $=function(t,e){return(0,R.Z)(t)&&A(e)?B((0,H.Z)(t),e):function(n){var r=P(n,t);return void 0===r&&r===e?(0,j.Z)(n,t):Y(e,r,3)}};var Z=n(69203),W=n(54193);const z=function(t){return function(e){return(0,I.Z)(e,t)}};const U=function(t){return(0,R.Z)(t)?(0,W.Z)((0,H.Z)(t)):z(t)};const q=function(t){return"function"==typeof t?t:null==t?Z.Z:"object"==typeof t?(0,k.Z)(t)?$(t[0],t[1]):F(t):U(t)}},39473:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(72764);const i=(0,n(1851).Z)(Object.keys,Object);var a=Object.prototype.hasOwnProperty;const s=function(t){if(!(0,r.Z)(t))return i(t);var e=[];for(var n in Object(t))a.call(t,n)&&"constructor"!=n&&e.push(n);return e}},21018:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(49811),i=n(50585);const a=function(t,e){var n=-1,a=(0,i.Z)(t)?Array(t.length):[];return(0,r.Z)(t,(function(t,r,i){a[++n]=e(t,r,i)})),a}},54193:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(e){return null==e?void 0:e[t]}}},69581:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(69203),i=n(81211),a=n(27227);const s=function(t,e){return(0,a.Z)((0,i.Z)(t,e,r.Z),t+"")}},21162:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(e){return t(e)}}},59548:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){return t.has(e)}},68882:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(69203);const i=function(t){return"function"==typeof t?t:r.Z}},22823:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(27771),i=n(99365),a=n(42454);var s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g;const l=function(t){var e=(0,a.Z)(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(s,(function(t,n,r,i){e.push(r?i.replace(o,"$1"):n||t)})),e}));var c=n(50751);const u=function(t,e){return(0,r.Z)(t)?t:(0,i.Z)(t,e)?[t]:l((0,c.Z)(t))}},41884:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(84073);const i=function(t){var e=new t.constructor(t.byteLength);return new r.Z(e).set(new r.Z(t)),e}},91050:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(66092),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof module&&module&&!module.nodeType&&module,s=a&&a.exports===i?r.Z.Buffer:void 0,o=s?s.allocUnsafe:void 0;const l=function(t,e){if(e)return t.slice();var n=t.length,r=o?o(n):new t.constructor(n);return t.copy(r),r}},12701:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(41884);const i=function(t,e){var n=e?(0,r.Z)(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},87215:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},31899:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(72954),i=n(74752);const a=function(t,e,n,a){var s=!n;n||(n={});for(var o=-1,l=e.length;++o<l;){var c=e[o],u=a?a(n[c],t[c],c,n,t):void 0;void 0===u&&(u=t[c]),s?(0,i.Z)(n,c,u):(0,r.Z)(n,c,u)}return n}},77904:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(62508);const i=function(){try{var t=(0,r.Z)(Object,"defineProperty");return t({},"",{}),t}catch(e){}}()},13413:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r="object"==typeof global&&global&&global.Object===Object&&global},1808:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(63327),i=n(95695),a=n(17179);const s=function(t){return(0,r.Z)(t,a.Z,i.Z)}},62508:(t,e,n)=>{"use strict";n.d(e,{Z:()=>g});var r=n(73234);const i=n(66092).Z["__core-js_shared__"];var a,s=(a=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";const o=function(t){return!!s&&s in t};var l=n(77226),c=n(90019),u=/^\[object .+?Constructor\]$/,d=Function.prototype,h=Object.prototype,m=d.toString,_=h.hasOwnProperty,p=RegExp("^"+m.call(_).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const f=function(t){return!(!(0,l.Z)(t)||o(t))&&((0,r.Z)(t)?p:u).test((0,c.Z)(t))};const y=function(t,e){return null==t?void 0:t[e]};const g=function(t,e){var n=y(t,e);return f(n)?n:void 0}},12513:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=(0,n(1851).Z)(Object.getPrototypeOf,Object)},95695:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(68774),i=n(60532),a=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols;const o=s?function(t){return null==t?[]:(t=Object(t),(0,r.Z)(s(t),(function(e){return a.call(t,e)})))}:i.Z},83970:(t,e,n)=>{"use strict";n.d(e,{Z:()=>M});var r=n(62508),i=n(66092);const a=(0,r.Z)(i.Z,"DataView");var s=n(86183);const o=(0,r.Z)(i.Z,"Promise");var l=n(93203);const c=(0,r.Z)(i.Z,"WeakMap");var u=n(93589),d=n(90019),h="[object Map]",m="[object Promise]",_="[object Set]",p="[object WeakMap]",f="[object DataView]",y=(0,d.Z)(a),g=(0,d.Z)(s.Z),b=(0,d.Z)(o),k=(0,d.Z)(l.Z),v=(0,d.Z)(c),x=u.Z;(a&&x(new a(new ArrayBuffer(1)))!=f||s.Z&&x(new s.Z)!=h||o&&x(o.resolve())!=m||l.Z&&x(new l.Z)!=_||c&&x(new c)!=p)&&(x=function(t){var e=(0,u.Z)(t),n="[object Object]"==e?t.constructor:void 0,r=n?(0,d.Z)(n):"";if(r)switch(r){case y:return f;case g:return h;case b:return m;case k:return _;case v:return p}return e});const M=x},16174:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(22823),i=n(29169),a=n(27771),s=n(56009),o=n(1656),l=n(62281);const c=function(t,e,n){for(var c=-1,u=(e=(0,r.Z)(e,t)).length,d=!1;++c<u;){var h=(0,l.Z)(e[c]);if(!(d=null!=t&&n(t,h)))break;t=t[h]}return d||++c!=u?d:!!(u=null==t?0:t.length)&&(0,o.Z)(u)&&(0,s.Z)(h,u)&&((0,a.Z)(t)||(0,i.Z)(t))}},73658:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(77226),i=Object.create;const a=function(){function t(){}return function(e){if(!(0,r.Z)(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var s=n(12513),o=n(72764);const l=function(t){return"function"!=typeof t.constructor||(0,o.Z)(t)?{}:a((0,s.Z)(t))}},56009:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=/^(?:0|[1-9]\d*)$/;const i=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&r.test(t))&&t>-1&&t%1==0&&t<e}},50439:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(79651),i=n(50585),a=n(56009),s=n(77226);const o=function(t,e,n){if(!(0,s.Z)(n))return!1;var o=typeof e;return!!("number"==o?(0,i.Z)(n)&&(0,a.Z)(e,n.length):"string"==o&&e in n)&&(0,r.Z)(n[e],t)}},99365:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(27771),i=n(72714),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;const o=function(t,e){if((0,r.Z)(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!(0,i.Z)(t))||(s.test(t)||!a.test(t)||null!=e&&t in Object(e))}},72764:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=Object.prototype;const i=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},98351:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(13413),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof module&&module&&!module.nodeType&&module,s=a&&a.exports===i&&r.Z.process;const o=function(){try{var t=a&&a.require&&a.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(e){}}()},1851:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){return function(n){return t(e(n))}}},81211:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});const r=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)};var i=Math.max;const a=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var a=arguments,s=-1,o=i(a.length-e,0),l=Array(o);++s<o;)l[s]=a[e+s];s=-1;for(var c=Array(e+1);++s<e;)c[s]=a[s];return c[e]=n(l),r(t,this,c)}}},66092:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(13413),i="object"==typeof self&&self&&self.Object===Object&&self;const a=r.Z||i||Function("return this")()},6545:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}},27227:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(62002),i=n(77904),a=n(69203);const s=i.Z?function(t,e){return(0,i.Z)(t,"toString",{configurable:!0,enumerable:!1,value:(0,r.Z)(e),writable:!0})}:a.Z;var o=Date.now;const l=function(t){var e=0,n=0;return function(){var r=o(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(s)},62281:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(72714);const i=function(t){if("string"==typeof t||(0,r.Z)(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}},90019:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=Function.prototype.toString;const i=function(t){if(null!=t){try{return r.call(t)}catch(e){}try{return t+""}catch(e){}}return""}},62002:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(){return t}}},3688:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(69581),i=n(79651),a=n(50439),s=n(32957),o=Object.prototype,l=o.hasOwnProperty;const c=(0,r.Z)((function(t,e){t=Object(t);var n=-1,r=e.length,c=r>2?e[2]:void 0;for(c&&(0,a.Z)(e[0],e[1],c)&&(r=1);++n<r;)for(var u=e[n],d=(0,s.Z)(u),h=-1,m=d.length;++h<m;){var _=d[h],p=t[_];(void 0===p||(0,i.Z)(p,o[_])&&!l.call(t,_))&&(t[_]=u[_])}return t}))},79651:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){return t===e||t!=t&&e!=e}},13445:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(68774),i=n(49811);const a=function(t,e){var n=[];return(0,i.Z)(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n};var s=n(74765),o=n(27771);const l=function(t,e){return((0,o.Z)(t)?r.Z:a)(t,(0,s.Z)(e,3))}},27961:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(10626);const i=function(t){return(null==t?0:t.length)?(0,r.Z)(t,1):[]}},70870:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(76579),i=n(49811),a=n(68882),s=n(27771);const o=function(t,e){return((0,s.Z)(t)?r.Z:i.Z)(t,(0,a.Z)(e))}},17452:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=Object.prototype.hasOwnProperty;const i=function(t,e){return null!=t&&r.call(t,e)};var a=n(16174);const s=function(t,e){return null!=t&&(0,a.Z)(t,e,i)}},75487:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});const r=function(t,e){return null!=t&&e in Object(t)};var i=n(16174);const a=function(t,e){return null!=t&&(0,i.Z)(t,e,r)}},69203:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return t}},29169:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(93589),i=n(18533);const a=function(t){return(0,i.Z)(t)&&"[object Arguments]"==(0,r.Z)(t)};var s=Object.prototype,o=s.hasOwnProperty,l=s.propertyIsEnumerable;const c=a(function(){return arguments}())?a:function(t){return(0,i.Z)(t)&&o.call(t,"callee")&&!l.call(t,"callee")}},27771:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=Array.isArray},50585:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(73234),i=n(1656);const a=function(t){return null!=t&&(0,i.Z)(t.length)&&!(0,r.Z)(t)}},836:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(50585),i=n(18533);const a=function(t){return(0,i.Z)(t)&&(0,r.Z)(t)}},77008:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(66092);const i=function(){return!1};var a="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=a&&"object"==typeof module&&module&&!module.nodeType&&module,o=s&&s.exports===a?r.Z.Buffer:void 0;const l=(o?o.isBuffer:void 0)||i},79697:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(39473),i=n(83970),a=n(29169),s=n(27771),o=n(50585),l=n(77008),c=n(72764),u=n(18843),d=Object.prototype.hasOwnProperty;const h=function(t){if(null==t)return!0;if((0,o.Z)(t)&&((0,s.Z)(t)||"string"==typeof t||"function"==typeof t.splice||(0,l.Z)(t)||(0,u.Z)(t)||(0,a.Z)(t)))return!t.length;var e=(0,i.Z)(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if((0,c.Z)(t))return!(0,r.Z)(t).length;for(var n in t)if(d.call(t,n))return!1;return!0}},73234:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(93589),i=n(77226);const a=function(t){if(!(0,i.Z)(t))return!1;var e=(0,r.Z)(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},1656:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},77226:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},18533:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return null!=t&&"object"==typeof t}},37514:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(93589),i=n(12513),a=n(18533),s=Function.prototype,o=Object.prototype,l=s.toString,c=o.hasOwnProperty,u=l.call(Object);const d=function(t){if(!(0,a.Z)(t)||"[object Object]"!=(0,r.Z)(t))return!1;var e=(0,i.Z)(t);if(null===e)return!0;var n=c.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==u}},72714:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(93589),i=n(18533);const a=function(t){return"symbol"==typeof t||(0,i.Z)(t)&&"[object Symbol]"==(0,r.Z)(t)}},18843:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(93589),i=n(1656),a=n(18533),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;const o=function(t){return(0,a.Z)(t)&&(0,i.Z)(t.length)&&!!s[(0,r.Z)(t)]};var l=n(21162),c=n(98351),u=c.Z&&c.Z.isTypedArray;const d=u?(0,l.Z)(u):o},49360:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return void 0===t}},17179:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(87668),i=n(39473),a=n(50585);const s=function(t){return(0,a.Z)(t)?(0,r.Z)(t):(0,i.Z)(t)}},32957:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(87668),i=n(77226),a=n(72764);const s=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e};var o=Object.prototype.hasOwnProperty;const l=function(t){if(!(0,i.Z)(t))return s(t);var e=(0,a.Z)(t),n=[];for(var r in t)("constructor"!=r||!e&&o.call(t,r))&&n.push(r);return n};var c=n(50585);const u=function(t){return(0,c.Z)(t)?(0,r.Z)(t,!0):l(t)}},43836:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(74073),i=n(74765),a=n(21018),s=n(27771);const o=function(t,e){return((0,s.Z)(t)?r.Z:a.Z)(t,(0,i.Z)(e,3))}},42454:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(37834);function i(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var s=t.apply(this,r);return n.cache=a.set(i,s)||a,s};return n.cache=new(i.Cache||r.Z),n}i.Cache=r.Z;const a=i},61666:(t,e,n)=>{"use strict";n.d(e,{Z:()=>f});var r=n(13317),i=n(72954),a=n(22823),s=n(56009),o=n(77226),l=n(62281);const c=function(t,e,n,r){if(!(0,o.Z)(t))return t;for(var c=-1,u=(e=(0,a.Z)(e,t)).length,d=u-1,h=t;null!=h&&++c<u;){var m=(0,l.Z)(e[c]),_=n;if("__proto__"===m||"constructor"===m||"prototype"===m)return t;if(c!=d){var p=h[m];void 0===(_=r?r(p,m,h):void 0)&&(_=(0,o.Z)(p)?p:(0,s.Z)(e[c+1])?[]:{})}(0,i.Z)(h,m,_),h=h[m]}return t};const u=function(t,e,n){for(var i=-1,s=e.length,o={};++i<s;){var l=e[i],u=(0,r.Z)(t,l);n(u,l)&&c(o,(0,a.Z)(l,t),u)}return o};var d=n(75487);const h=function(t,e){return u(t,e,(function(e,n){return(0,d.Z)(t,n)}))};var m=n(27961),_=n(81211),p=n(27227);const f=function(t){return(0,p.Z)((0,_.Z)(t,void 0,m.Z),t+"")}((function(t,e){return null==t?{}:h(t,e)}))},74379:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=Math.ceil,i=Math.max;const a=function(t,e,n,a){for(var s=-1,o=i(r((e-t)/(n||1)),0),l=Array(o);o--;)l[a?o:++s]=t,t+=n;return l};var s=n(50439),o=n(94099);const l=function(t){return function(e,n,r){return r&&"number"!=typeof r&&(0,s.Z)(e,n,r)&&(n=r=void 0),e=(0,o.Z)(e),void 0===n?(n=e,e=0):n=(0,o.Z)(n),r=void 0===r?e<n?1:-1:(0,o.Z)(r),a(e,n,r,t)}}()},92344:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});const r=function(t,e,n,r){var i=-1,a=null==t?0:t.length;for(r&&a&&(n=t[++i]);++i<a;)n=e(n,t[i],i,t);return n};var i=n(49811),a=n(74765);const s=function(t,e,n,r,i){return i(t,(function(t,i,a){n=r?(r=!1,t):e(n,t,i,a)})),n};var o=n(27771);const l=function(t,e,n){var l=(0,o.Z)(t)?r:s,c=arguments.length<3;return l(t,(0,a.Z)(e,4),n,c,i.Z)}},60532:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(){return[]}},94099:(t,e,n)=>{"use strict";n.d(e,{Z:()=>p});var r=/\s/;const i=function(t){for(var e=t.length;e--&&r.test(t.charAt(e)););return e};var a=/^\s+/;const s=function(t){return t?t.slice(0,i(t)+1).replace(a,""):t};var o=n(77226),l=n(72714),c=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,d=/^0o[0-7]+$/i,h=parseInt;const m=function(t){if("number"==typeof t)return t;if((0,l.Z)(t))return NaN;if((0,o.Z)(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=(0,o.Z)(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=s(t);var n=u.test(t);return n||d.test(t)?h(t.slice(2),n?2:8):c.test(t)?NaN:+t};var _=1/0;const p=function(t){return t?(t=m(t))===_||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},50751:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(17685),i=n(74073),a=n(27771),s=n(72714),o=r.Z?r.Z.prototype:void 0,l=o?o.toString:void 0;const c=function t(e){if("string"==typeof e)return e;if((0,a.Z)(e))return(0,i.Z)(e,t)+"";if((0,s.Z)(e))return l?l.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n};const u=function(t){return null==t?"":c(t)}},66749:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(50751),i=0;const a=function(t){var e=++i;return(0,r.Z)(t)+e}},34148:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(74073);const i=function(t,e){return(0,r.Z)(e,(function(e){return t[e]}))};var a=n(17179);const s=function(t){return null==t?[]:i(t,(0,a.Z)(t))}}}]); \ No newline at end of file diff --git a/docs/assets/js/90239.4728e4d9.js.LICENSE.txt b/docs/assets/js/90239.4728e4d9.js.LICENSE.txt new file mode 100644 index 000000000..6eb8857f4 --- /dev/null +++ b/docs/assets/js/90239.4728e4d9.js.LICENSE.txt @@ -0,0 +1,13 @@ +/*! + * Wait for document loaded before starting the execution + */ + +/*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE */ + +/*! Check if previously processed */ + +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ + +//! moment.js + +//! moment.js locale configuration diff --git a/docs/assets/js/909eb646.f36d5405.js b/docs/assets/js/909eb646.f36d5405.js new file mode 100644 index 000000000..3e04c3f2d --- /dev/null +++ b/docs/assets/js/909eb646.f36d5405.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[58218],{8749:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.9.0/category/examples","navigation":{"previous":{"title":"Livenet","permalink":"/docs/0.9.0/backends/livenet"},"next":{"title":"odra-examples","permalink":"/docs/0.9.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/90c053b1.2c497dc2.js b/docs/assets/js/90c053b1.2c497dc2.js new file mode 100644 index 000000000..7c62ce6f4 --- /dev/null +++ b/docs/assets/js/90c053b1.2c497dc2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[14593],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(h,s(s({ref:t},d),{},{components:n})):r.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},42345:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.3.1/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.3.1/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.3.1/basics/testing",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.3.1/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.3.1/basics/errors"}},l={},c=[{value:"Test env",id:"test-env",level:2},{value:"Deployer",id:"deployer",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'use odra::{Variable, List};\n\n#[cfg(test)]\nmod tests {\n use super::DogContract3Deployer;\n\n #[test]\n fn init_test() {\n let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(module)]")," macro created a Deployer code for us, which will deploy the contract on the\nVM:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n')),(0,a.kt)("p",null,"From now on, we can use ",(0,a.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with a macro are available to us:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,a.kt)("h2",{id:"test-env"},"Test env"),(0,a.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/testing.rs"',title:'"examples/src/docs/testing.rs"'},'#[cfg(test)]\nmod tests {\n use super::TestingContractDeployer;\n\n #[test]\n fn test_env() {\n let testing_contract = TestingContractDeployer::init("MyContract".to_string());\n let creator = testing_contract.created_by();\n odra::test_env::set_caller(odra::test_env::get_account(1));\n let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());\n let creator2 = testing_contract2.created_by();\n assert!(creator != creator2);\n }\n}\n')),(0,a.kt)("p",null,"In the code above, we are deploying two instances of the same contract, but we're using ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::test_env::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::contract_env::caller()"),"\nthe function we are calling inside the contract."),(0,a.kt)("p",null,"Each test env comes with a set of functions that will let you write better tests:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_caller(address: Address)")," - you've seen it in action just now"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn token_balance(address: Address) -> Balance")," - it returns the balance of the account associated with the given address"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn advance_block_time_by(seconds: BlockTime)")," - it increases the current value of block_time"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_account(n: usize) -> Address")," - it returns an nth address that was prepared for you by Odra in advance;\nby default, you start with the 0th account"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn assert_exception<F, E>(err: E, block: F)")," - it executes the ",(0,a.kt)("inlineCode",{parentName:"li"},"block")," code and expects ",(0,a.kt)("inlineCode",{parentName:"li"},"err")," to happen"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError>")," - returns\nthe event emitted by the contract")),(0,a.kt)("p",null,"Again, we'll see those used in the next articles."),(0,a.kt)("h2",{id:"deployer"},"Deployer"),(0,a.kt)("p",null,"You may be wondering what is the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractDeployer")," and where did it come from.\nIt is a piece of code generated automatically for you, thanks to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nIf you used the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," on one of the methods, it will be the constructor of your contract.\nOdra will make sure that it is called only once, so you can use it to initialize your data structures etc."),(0,a.kt)("p",null,"If you do not provide the init method, you can deploy the contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"::default()")," method.\nIn the end, you will get a ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," instance (in our case the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractRef"),") which reimplements all\nthe methods you defined in the contract, but executes them on a blockchain!"),(0,a.kt)("p",null,"To learn more about the ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," contract, visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/cross-calls"},"Cross calls")," article."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We take a look at how Odra handles errors!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/90c71d04.d5214806.js b/docs/assets/js/90c71d04.d5214806.js new file mode 100644 index 000000000..6bf4dda80 --- /dev/null +++ b/docs/assets/js/90c71d04.d5214806.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[79004],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var d=2;d<o;d++)i[d]=n[d];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},99111:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="OdraVM",c={unversionedId:"backends/odra-vm",id:"version-0.8.0/backends/odra-vm",title:"OdraVM",description:"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.8.0/backends/02-odra-vm.md",sourceDirName:"backends",slug:"/backends/odra-vm",permalink:"/docs/0.8.0/backends/odra-vm",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.8.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.8.0/backends/casper"}},s={},d=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],l={toc:d};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odravm"},"OdraVM"),(0,a.kt)("p",null,"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time -\nsimply use your IDE's debug functionality."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The OdraVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"OdraVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is a list of contracts deployed onto the OdraVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the OdraVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe OdraVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the OdraVM.\nThanks to this and the fact that we do not need the blockchain itself,\nOdraVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the OdraVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Container"),".\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, OdraVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(OdraVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/90f06335.8b8a70e1.js b/docs/assets/js/90f06335.8b8a70e1.js new file mode 100644 index 000000000..c77a6767f --- /dev/null +++ b/docs/assets/js/90f06335.8b8a70e1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[1459],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d<o;d++)l[d]=t[d];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}c.displayName="MDXCreateElement"},58009:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.4.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.4.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.4.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.4.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.4.0/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = { path = "../core", default-features = false }\nodra-modules = { path = "../modules", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]\ncasper = ["odra/casper", "odra-modules/casper"]\n')),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules")," defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," feature in your project, add ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules/casper"),"specifically (it applies to each backend).")),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::types::{Address, U256};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main Odra repository.")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/918e870d.2fe045b9.js b/docs/assets/js/918e870d.2fe045b9.js new file mode 100644 index 000000000..19f7972f1 --- /dev/null +++ b/docs/assets/js/918e870d.2fe045b9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[13849],{38967:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.5.0/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.5.0/basics/native-token"},"next":{"title":"Module reusing","permalink":"/docs/0.5.0/advanced/using"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/919c36c8.0e087792.js b/docs/assets/js/919c36c8.0e087792.js new file mode 100644 index 000000000..bd452f7b2 --- /dev/null +++ b/docs/assets/js/919c36c8.0e087792.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[48221],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,o,a=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var r=o.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return o.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},u=o.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?o.createElement(f,l(l({ref:r},c),{},{components:t})):o.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p<n;p++)l[p]=t[p];return o.createElement.apply(null,l)}return o.createElement.apply(null,t)}u.displayName="MDXCreateElement"},96739:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.5.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.",source:"@site/versioned_docs/version-0.5.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.5.0/examples/odra-examples",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.5.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.5.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,a.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,a.kt)("inlineCode",{parentName:"p"},"examples")," in the Odra main repository."),(0,a.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,a.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,a.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/91b04621.e9cd120b.js b/docs/assets/js/91b04621.e9cd120b.js new file mode 100644 index 000000000..bf8cbaf74 --- /dev/null +++ b/docs/assets/js/91b04621.e9cd120b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59809],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);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 s(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?s(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):s(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)a=s[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)a=s[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p<s;p++)i[p]=a[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"},38392:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.7.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.7.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.7.0/basics/storage-interaction",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.7.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.7.0/basics/communicating-with-host"}},l={},p=[{value:"Variable",id:"variable",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"variable"},"Variable"),(0,r.kt)("p",null,"The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Variable<bool>,\n weight: Variable<u32>,\n name: Variable<String>,\n walks: Variable<Vec<u32>>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::Variable;\n\n#[odra::module]\nimpl DogContract {\n #[odra(init)]\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::<u32>::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A Variable is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses Mapping to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{Mapping, Variable};\n\n#[odra::module]\npub struct DogContract2 {\n name: Variable<String>,\n friends: Mapping<String, u32>,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a Mapping we use a similar approach\nto the one shown in the Variables section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Variable working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{Variable, List};\n\npub struct List<T> {\n values: Mapping<u32, T>,\n index: Variable<u32>\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Variable<String>,\n walks: List<u32>,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/docs/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option<Address>\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/93381d6e.dd65ae1c.js b/docs/assets/js/93381d6e.dd65ae1c.js new file mode 100644 index 000000000..d47941203 --- /dev/null +++ b/docs/assets/js/93381d6e.dd65ae1c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76798],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),f=o,h=p["".concat(l,".").concat(f)]||p[f]||u[f]||r;return n?a.createElement(h,s(s({ref:t},d),{},{components:n})):a.createElement(h,s({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,s=new Array(r);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c<r;c++)s[c]=n[c];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"},74173:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:10},s="Deploying a Token on Casper Livenet",i={unversionedId:"tutorials/deploying-on-casper",id:"tutorials/deploying-on-casper",title:"Deploying a Token on Casper Livenet",description:"In this tutorial, we will take the token we created in",source:"@site/docs/tutorials/deploying-on-casper.md",sourceDirName:"tutorials",slug:"/tutorials/deploying-on-casper",permalink:"/docs/next/tutorials/deploying-on-casper",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10},sidebar:"tutorialSidebar",previous:{title:"Odra for Solidity developers",permalink:"/docs/next/tutorials/odra-solidity"},next:{title:"Migrations",permalink:"/docs/next/category/migrations"}},l={},c=[{value:"Casper Wallet",id:"casper-wallet",level:2},{value:"Getting tokens",id:"getting-tokens",level:2},{value:"Odra Livenet",id:"odra-livenet",level:2},{value:"Cspr.live",id:"csprlive",level:2},{value:"Transferring Tokens using Casper Wallet",id:"transferring-tokens-using-casper-wallet",level:2},{value:"Conclusion",id:"conclusion",level:2}],d={toc:c};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"deploying-a-token-on-casper-livenet"},"Deploying a Token on Casper Livenet"),(0,o.kt)("p",null,"In this tutorial, we will take the token we created in\nthe previous one and deploy it on the Livenet Casper network,\nusing the Odra Livenet backend."),(0,o.kt)("p",null,"We will also take a look at the tools that Casper Ecosystem\nprovides to interact with our newly deployed token."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"Most of this tutorial will work with any Casper contract.")),(0,o.kt)("h2",{id:"casper-wallet"},"Casper Wallet"),(0,o.kt)("p",null,"We will be using Casper Wallet to do some tasks in this tutorial.\nTo install it, please follow the instructions on the\n",(0,o.kt)("a",{parentName:"p",href:"https://www.casperwallet.io/"},"official website"),"."),(0,o.kt)("p",null,"After setting up the wallet, extract the private key of the account\nyou want to use for our testing.\nYou can do this by clicking on the Menu > Download account keys."),(0,o.kt)("admonition",{type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"You are solely responsible for the security of your private keys.\nWe recommend creating a new account for the testing purposes.")),(0,o.kt)("p",null,"Why do we need the private key? We will use it in Odra to deploy\nour contract to the Casper network using Livenet backend."),(0,o.kt)("h2",{id:"getting-tokens"},"Getting tokens"),(0,o.kt)("p",null,"To deploy the contract on the Livenet, we need to have some CSPR.\nThe easiest way to get them is to use the faucet, which will send\nus 1000 CSPR for free. Unfortunately, only on the Testnet."),(0,o.kt)("p",null,"To use the faucet, go to the ",(0,o.kt)("a",{parentName:"p",href:"https://testnet.cspr.live/tools/faucet"},"Casper Testnet Faucet"),'.\nLog in using your Casper Wallet account and click on the "Request Tokens" button.'),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"One account can request tokens only once. If you run out of tokens, you can\neither ask someone in the Casper community to send you some, or simply create a new account\nin the wallet.")),(0,o.kt)("p",null,"Now, when we have the tokens, we can deploy the contract. Let's do it using Odra!"),(0,o.kt)("h2",{id:"odra-livenet"},"Odra Livenet"),(0,o.kt)("p",null,"Odra Livenet is described in detail in the\n",(0,o.kt)("a",{parentName:"p",href:"../backends/livenet"},"backends section")," of this documentation.\nWe will then briefly describe how to use set it up in this tutorial."),(0,o.kt)("p",null,"In your contract code, create a new file in the bin folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="bin/our_token_livenet.rs"',title:'"bin/our_token_livenet.rs"'},'//! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial\n//! creator.\nuse std::str::FromStr;\n\nuse odra::casper_types::U256;\nuse odra::host::{Deployer, HostEnv, HostRef, HostRefLoader};\nuse odra::Address;\nuse ourcoin::token::{OurTokenHostRef, OurTokenInitArgs};\n\nfn main() {\n // Load the Casper livenet environment.\n let env = odra_casper_livenet_env::env();\n\n // Caller is the deployer and the owner of the private key.\n let owner = env.caller();\n // Just some random address...\n let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Deploy new contract.\n let mut token = deploy_our_token(&env);\n println!("Token address: {}", token.address().to_string());\n\n // Propose minting new tokens.\n env.set_gas(1_000_000_000u64);\n token.propose_new_mint(recipient, U256::from(1_000));\n\n // Vote, we are the only voter.\n env.set_gas(1_000_000_000u64);\n token.vote(true, U256::from(1_000));\n\n // Let\'s advance the block time by 11 minutes, as\n // we set the voting time to 10 minutes.\n // OH NO! It is the Livenet, so we need to wait real time...\n // Hopefully you are not in a hurry.\n env.advance_block_time(11 * 60 * 1000);\n\n // Tally the votes.\n env.set_gas(1_500_000_000u64);\n token.tally();\n\n // Check the balances.\n println!("Owner\'s balance: {:?}", token.balance_of(&owner));\n println!(\n "Tutorial creator\'s balance: {:?}",\n token.balance_of(&recipient)\n );\n}\n\n/// Deploys a contract.\npub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef {\n let name = String::from("OurToken");\n let symbol = String::from("OT");\n let decimals = 0;\n let initial_supply = U256::from(1_000);\n\n let init_args = OurTokenInitArgs {\n name,\n symbol,\n decimals,\n initial_supply,\n };\n\n env.set_gas(300_000_000_000u64);\n OurTokenHostRef::deploy(env, init_args)\n}\n\n/// Loads a contract. Just in case you need to load an existing contract later...\nfn _load_cep18(env: &HostEnv) -> OurTokenHostRef {\n let address = "hash-XXXXX";\n let address = Address::from_str(address).unwrap();\n OurTokenHostRef::load(env, address)\n}\n')),(0,o.kt)("p",null,"In your ",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file, we need to add a new dependency, a feature and\nregister the new binary. In the end, it should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml",metastring:'title="Cargo.toml"',title:'"Cargo.toml"'},'[package]\nname = "ourcoin"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "1.1.0", features = [], default-features = false }\nodra-modules = { version = "1.1.0", features = [], default-features = false }\nodra-casper-livenet-env = { version = "1.1.0", optional = true }\n\n[dev-dependencies]\nodra-test = { version = "1.1.0", features = [], default-features = false }\n\n[build-dependencies]\nodra-build = { version = "1.1.0", features = [], default-features = false }\n\n[features]\ndefault = []\nlivenet = ["odra-casper-livenet-env"]\n\n[[bin]]\nname = "ourcoin_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "ourcoin_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[[bin]]\nname = "our_token_livenet"\npath = "bin/our_token_livenet.rs"\nrequired-features = ["livenet"]\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,o.kt)("p",null,"Finally, add the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with the following content:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env",metastring:'title=".env"',title:'".env"'},"# Path to the secret key of the account that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777\n\n# Chain name of the network.\nODRA_CASPER_LIVENET_CHAIN_NAME=casper-test\n")),(0,o.kt)("p",null,"Of course, you need to replace the secret key's path\nwith the path to the secret key file you downloaded from the Casper Wallet."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"One of the problems you may encounter is that the node you are using\nwill be down or will not accept your calls. In this case, you will\nhave to find and use another node IP address.")),(0,o.kt)("p",null,"Now, we will run our code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin our_token_livenet --features livenet\n")),(0,o.kt)("p",null,"If everything is set up correctly, you should see the output similar to this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' Running `target/debug/our_token_livenet`\n\ud83d\udc81 INFO : Deploying "OurToken".\n\ud83d\udc81 INFO : Found wasm under "wasm/OurToken.wasm".\n\ud83d\ude44 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".\n\ud83d\ude44 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".\n\ud83d\udc81 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed.\n\ud83d\udc81 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed.\n\nToken address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857\n\n\ud83d\udc81 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint".\n\ud83d\ude44 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".\n\ud83d\ude44 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".\n\ud83d\udc81 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed.\n\ud83d\udc81 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote".\n\ud83d\ude44 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".\n\ud83d\ude44 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".\n\ud83d\udc81 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed.\n\ud83d\udc81 INFO : advance_block_time called - Waiting for 660000 ms\n\ud83d\udc81 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally".\n\ud83d\ude44 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".\n\ud83d\ude44 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".\n\ud83d\udc81 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed.\n\nOwner\'s balance: 1000\nTutorial creator\'s balance: 1000\n')),(0,o.kt)("p",null,"Congratulations, your contract is now deployed on the Casper network!\nBefore we move on, note the address of the token!"),(0,o.kt)("p",null,"We will use it in the next section to interact with the token. In our case it is\n",(0,o.kt)("inlineCode",{parentName:"p"},"hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857"),"."),(0,o.kt)("h2",{id:"csprlive"},"Cspr.live"),(0,o.kt)("p",null,"The first thing we will do is to explore Casper's network block explorer,\n",(0,o.kt)("a",{parentName:"p",href:"https://cspr.live/"},"cspr.live"),". We can put the address of our token in the search bar\nto find it."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"If you deployed your contract on the Testnet, remember to make sure that the Testnet\nnetwork is selected in the dropdown menu in the top right corner.")),(0,o.kt)("p",null,"If everything is set up correctly, you should see the contract package's details.\nBesides the owner, keys etc., you can also see the contract's metdata, if it\nwas developed using a standard that cspr.live supports."),(0,o.kt)("p",null,"Indeed, we can see that it detected that our contract is a CEP-18 token!\nWe see the name, symbol and total supply.\nAll the mentions of the contract on the website will use the token name instead\nof the contract address."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"contract.png",src:n(27149).Z,width:"444",height:"417"})),(0,o.kt)("p",null,"Additionally, on the Token Txs tab, we can see the transactions that happened\nwith the token. We can see the minting transaction we did in the previous section\nand transfers done during the voting process."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"transactions.png",src:n(98477).Z,width:"605",height:"343"})),(0,o.kt)("p",null,"If we click on one of the accounts that recieved the tokens, we will go to the\naccount page. Here, on the Tokens tab, we can see all the tokens that the account\nhas - and OurToken is one of them!"),(0,o.kt)("p",null,"If you wish, you can check the status of the contract deployed during the development\nof this tutorial ",(0,o.kt)("a",{parentName:"p",href:"https://testnet.cspr.live/contract-package/565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857"},"here"),"."),(0,o.kt)("h2",{id:"transferring-tokens-using-casper-wallet"},"Transferring Tokens using Casper Wallet"),(0,o.kt)("p",null,"Casper wallet can do much more than just logging in to the faucet, exporting\nthe private keys and transferring CSPR. It can also interact with the contracts\ndeployed on the network."),(0,o.kt)("p",null,"If you deployed the contract and left some OT tokens to yourself, you should see\nthem in the Casper Wallet window."),(0,o.kt)("p",null,"You should also be able to transfer them to another account!"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"wallet.png",src:n(30416).Z,width:"351",height:"591"})),(0,o.kt)("h2",{id:"conclusion"},"Conclusion"),(0,o.kt)("p",null,"We've successfully deployed a token on the Casper network and interacted with it\nusing the Odra backend and Casper Wallet. We've also learned how to use the\ncspr.live block explorer to check the status of your contract."),(0,o.kt)("p",null,"Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem\nprovides. Feel free to explore them on ",(0,o.kt)("a",{parentName:"p",href:"https://casperecosystem.io/"},"casperecosystem.io"),"."))}u.isMDXComponent=!0},27149:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/contract-4a6ad767dffcbb5b1b7e793447a41680.png"},98477:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/transactions-3d96ebac6e49c7b9bee5ef5bc14a4ef4.png"},30416:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wallet-d80c30c75d661377a4d31b1c8fb24664.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/93514764.4449932d.js b/docs/assets/js/93514764.4449932d.js new file mode 100644 index 000000000..74c20444d --- /dev/null +++ b/docs/assets/js/93514764.4449932d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63336],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=s(r),d=a,f=m["".concat(c,".").concat(d)]||m[d]||p[d]||o;return r?n.createElement(f,i(i({ref:t},u),{},{components:r})):n.createElement(f,i({ref:t},u))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},92755:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const o={slug:"its-all-about-the-community",title:"It's all about the community!",authors:["zie1ony"],image:"./roadmap.png"},i=void 0,l={permalink:"/blog/its-all-about-the-community",source:"@site/blog/2023-06-27-we-are-here-to-stay/index.md",title:"It's all about the community!",description:"Over the past months,",date:"2023-06-27T00:00:00.000Z",formattedDate:"June 27, 2023",tags:[],readingTime:2.825,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"its-all-about-the-community",title:"It's all about the community!",authors:["zie1ony"],image:"./roadmap.png"},prevItem:{title:"Nysa",permalink:"/blog/Nysa"},nextItem:{title:"OpenAI writes ERC20 in Odra",permalink:"/blog/2023-02-27-openai-writes-erc20-in-odra"}},c={image:r(32899).Z,authorsImageUrls:[void 0]},s=[],u={toc:s};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Over the past months,\nwe have been working hard on bringing Odra to the Casper world.\nWhile we are proud of what we have achieved so far,\nthe hard part is just beginning.\nSmart contract developers from outside of our team are starting to use Odra.\nWe are thrilled about it and here is how we are going to support the community."))}p.isMDXComponent=!0},32899:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/roadmap-8255e4b08deb4134a7e97e32c21ad0dc.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/935f2afb.34b51fba.js b/docs/assets/js/935f2afb.34b51fba.js new file mode 100644 index 000000000..ab86f0ef1 --- /dev/null +++ b/docs/assets/js/935f2afb.34b51fba.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[80053],{1109:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"next","banner":"unreleased","badge":true,"noIndex":false,"className":"docs-version-current","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/next/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/next/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/next/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/next/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/next/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/next/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/next/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/next/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/next/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/next/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/next/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/next/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/next/basics/events","docId":"basics/events"},{"type":"link","label":"Casper Contract Schema","href":"/docs/next/basics/casper-contract-schema","docId":"basics/casper-contract-schema"},{"type":"link","label":"Cross calls","href":"/docs/next/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/next/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/next/basics/native-token","docId":"basics/native-token"}],"href":"/docs/next/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Delegate","href":"/docs/next/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/next/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/next/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Storage Layout","href":"/docs/next/advanced/storage-layout","docId":"advanced/storage-layout"},{"type":"link","label":"Memory allocators","href":"/docs/next/advanced/using-different-allocator","docId":"advanced/using-different-allocator"},{"type":"link","label":"Building contracts manually","href":"/docs/next/advanced/building-manually","docId":"advanced/building-manually"}],"href":"/docs/next/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/next/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"OdraVM","href":"/docs/next/backends/odra-vm","docId":"backends/odra-vm"},{"type":"link","label":"Casper","href":"/docs/next/backends/casper","docId":"backends/casper"},{"type":"link","label":"Livenet","href":"/docs/next/backends/livenet","docId":"backends/livenet"}],"href":"/docs/next/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/next/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/next/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/next/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/next/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/next/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/next/tutorials/owned-token","docId":"tutorials/owned-token"},{"type":"link","label":"Access Control","href":"/docs/next/tutorials/access-control","docId":"tutorials/access-control"},{"type":"link","label":"Pausable","href":"/docs/next/tutorials/pauseable","docId":"tutorials/pauseable"},{"type":"link","label":"Ticketing System","href":"/docs/next/tutorials/nft","docId":"tutorials/nft"},{"type":"link","label":"Build, Deploy and Read the State of a Contract","href":"/docs/next/tutorials/build-deploy-read","docId":"tutorials/build-deploy-read"},{"type":"link","label":"Using Proxy Caller","href":"/docs/next/tutorials/using-proxy-caller","docId":"tutorials/using-proxy-caller"},{"type":"link","label":"CEP-18","href":"/docs/next/tutorials/cep18","docId":"tutorials/cep18"},{"type":"link","label":"Odra for Solidity developers","href":"/docs/next/tutorials/odra-solidity","docId":"tutorials/odra-sol"},{"type":"link","label":"Deploying a Token on Casper Livenet","href":"/docs/next/tutorials/deploying-on-casper","docId":"tutorials/deploying-on-casper"}],"href":"/docs/next/category/tutorials"},{"type":"category","label":"Migrations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Migration guide to v0.8.0","href":"/docs/next/migrations/to-0.8.0","docId":"migrations/to-0.8.0"},{"type":"link","label":"Migration guide to v0.9.0","href":"/docs/next/migrations/to-0.9.0","docId":"migrations/to-0.9.0"}],"href":"/docs/next/category/migrations"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that","sidebar":"tutorialSidebar"},"advanced/building-manually":{"id":"advanced/building-manually","title":"Building contracts manually","description":"cargo odra is a great tool to build and test your contracts, but sometimes","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/storage-layout":{"id":"advanced/storage-layout","title":"Storage Layout","description":"Odra\'s innovative modular design necessitates a unique storage layout. This","sidebar":"tutorialSidebar"},"advanced/using-different-allocator":{"id":"advanced/using-different-allocator","title":"Memory allocators","description":"When compiling contracts to wasm, your code needs to be no-std.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/livenet":{"id":"backends/livenet","title":"Livenet","description":"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local","sidebar":"tutorialSidebar"},"backends/odra-vm":{"id":"backends/odra-vm","title":"OdraVM","description":"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/casper-contract-schema":{"id":"basics/casper-contract-schema","title":"Casper Contract Schema","description":"Casper Contract Schema","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"migrations/to-0.8.0":{"id":"migrations/to-0.8.0","title":"Migration guide to v0.8.0","description":"Migration guide to v0.8.0","sidebar":"tutorialSidebar"},"migrations/to-0.9.0":{"id":"migrations/to-0.9.0","title":"Migration guide to v0.9.0","description":"Migration guide to v0.9.0","sidebar":"tutorialSidebar"},"tutorials/access-control":{"id":"tutorials/access-control","title":"Access Control","description":"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,","sidebar":"tutorialSidebar"},"tutorials/build-deploy-read":{"id":"tutorials/build-deploy-read","title":"Build, Deploy and Read the State of a Contract","description":"In this guide, we will show the full path from creating a contract, deploying it and reading the state.","sidebar":"tutorialSidebar"},"tutorials/cep18":{"id":"tutorials/cep18","title":"CEP-18","description":"Not so different from ERC-20, the CEP-18 standard describes a fungible","sidebar":"tutorialSidebar"},"tutorials/deploying-on-casper":{"id":"tutorials/deploying-on-casper","title":"Deploying a Token on Casper Livenet","description":"In this tutorial, we will take the token we created in","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/nft":{"id":"tutorials/nft","title":"Ticketing System","description":"Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens.","sidebar":"tutorialSidebar"},"tutorials/odra-sol":{"id":"tutorials/odra-sol","title":"Odra for Solidity developers","description":"Learn how to transition from Solidity to Odra.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"},"tutorials/pauseable":{"id":"tutorials/pauseable","title":"Pausable","description":"The Pausable module is like your smart contract\'s safety switch. It lets authorized users temporarily pause certain features if needed. It\'s a great way to boost security, but it\'s not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.","sidebar":"tutorialSidebar"},"tutorials/using-proxy-caller":{"id":"tutorials/using-proxy-caller","title":"Using Proxy Caller","description":"In this tutorial, we will learn how to use the proxycaller wasm to call an Odra payable function. The proxycaller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/9390dd74.42b1f407.js b/docs/assets/js/9390dd74.42b1f407.js new file mode 100644 index 000000000..6a8cd6c61 --- /dev/null +++ b/docs/assets/js/9390dd74.42b1f407.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[30196],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},p=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=d(t),m=r,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},p),{},{components:t})):a.createElement(f,l({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d<o;d++)l[d]=t[d];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}c.displayName="MDXCreateElement"},92969:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:2},l="Using odra-modules",i={unversionedId:"examples/using-odra-modules",id:"version-0.8.1/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.8.1/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.8.1/examples/using-odra-modules",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711523026,formattedLastUpdatedAt:"Mar 27, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"odra-examples",permalink:"/docs/0.8.1/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.8.1/category/tutorials"}},s={},d=[{value:"Available modules",id:"available-modules",level:2},{value:"Tokens",id:"tokens",level:3},{value:"Erc20",id:"erc20",level:4},{value:"Erc721",id:"erc721",level:4},{value:"Erc1155",id:"erc1155",level:4},{value:"Wrapped native token",id:"wrapped-native-token",level:4},{value:"Access",id:"access",level:3},{value:"AccessControl",id:"accesscontrol",level:4},{value:"Ownable",id:"ownable",level:4},{value:"Ownable2Step",id:"ownable2step",level:4},{value:"Security",id:"security",level:3},{value:"Pausable",id:"pausable",level:4}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,r.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.1"\n\n[dev-dependencies]\nodra-test = "0.8.1"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,r.kt)("p",null,"To use ",(0,r.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,r.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = "0.8.1"\nodra-modules = "0.8.1"\n')),(0,r.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,r.kt)("p",null,"Let's write an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::prelude::*;\nuse odra::{Address, casper_types::U256, module::SubModule};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: SubModule<Erc20>\n}\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All available modules are placed in the main ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra repository"),".")),(0,r.kt)("h2",{id:"available-modules"},"Available modules"),(0,r.kt)("p",null,"Odra modules comes with couple of ready-to-use modules and reusable extensions."),(0,r.kt)("h3",{id:"tokens"},"Tokens"),(0,r.kt)("h4",{id:"erc20"},"Erc20"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20")," standard."),(0,r.kt)("h4",{id:"erc721"},"Erc721"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-721"},"ERC721")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC721Base")," and additionally uses\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extensions."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Receiver")," trait lets you implement your own logic for receiving NFTs."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc721WithMetadata")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Token"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc721Metadata")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"erc1155"},"Erc1155"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Base")," module implements the ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-1155"},"ERC1155")," standard, adjusted for the Odra framework."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," module implements the ",(0,r.kt)("inlineCode",{parentName:"p"},"ERC1155Base")," and additionally uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," extension."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedErc1155")," trait is a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc1155Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," modules."),(0,r.kt)("h4",{id:"wrapped-native-token"},"Wrapped native token"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"WrappedNativeToken")," module implements the Wrapper for the native token,\nit was inspired by the WETH."),(0,r.kt)("h3",{id:"access"},"Access"),(0,r.kt)("h4",{id:"accesscontrol"},"AccessControl"),(0,r.kt)("p",null,"This module enables the implementation of role-based access control mechanisms for children\nmodules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API."),(0,r.kt)("h4",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner."),(0,r.kt)("p",null,"The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the\n",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," function."),(0,r.kt)("h4",{id:"ownable2step"},"Ownable2Step"),(0,r.kt)("p",null,"An extension of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module. "),(0,r.kt)("p",null,"Ownership can be transferred in a two-step process by using ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_ownership()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"accept_ownership()")," functions."),(0,r.kt)("h3",{id:"security"},"Security"),(0,r.kt)("h4",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"A module allowing to implement an emergency stop mechanism that can be triggered by any account."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/94723368.0196233a.js b/docs/assets/js/94723368.0196233a.js new file mode 100644 index 000000000..7783405b9 --- /dev/null +++ b/docs/assets/js/94723368.0196233a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[84916],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),u=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(r),m=o,f=p["".concat(l,".").concat(m)]||p[m]||d[m]||a;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u<a;u++)s[u]=r[u];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}p.displayName="MDXCreateElement"},53568:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:11,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-0.5.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.5.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.5.0/basics/modules",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.5.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.5.0/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:u};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to a macro ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),'. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: MathEngine,\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use super::ModulesContractDeployer;\n\n#[test]\nfn test_modules() {\n let modules_contract = ModulesContractDeployer::default();\n assert_eq!(modules_contract.add_using_module(), 8);\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/94fadafc.5cd94602.js b/docs/assets/js/94fadafc.5cd94602.js new file mode 100644 index 000000000..1f633c7d0 --- /dev/null +++ b/docs/assets/js/94fadafc.5cd94602.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74805],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,v=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c<s;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},27766:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.8.1/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.8.1/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.8.1/basics/events",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.8.1/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.8.1/basics/cross-calls"}},l={},c=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::prelude::*;\nuse odra::{Address, Event};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract;\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64\n}\n\n#[odra::module]\nimpl PartyContract {\n pub fn init(&self) {\n self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n });\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]")," attribute like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64,\n}\n")),(0,a.kt)("p",null,"To emit an event, we use the ",(0,a.kt)("inlineCode",{parentName:"p"},"emit_event")," function from the ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),", passing the event as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n});\n")),(0,a.kt)("p",null,"To determine all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a few functions which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},'use super::{PartyContractHostRef, PartyStarted};\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\n#[test]\nfn test_party() {\n let test_env: HostEnv = odra_test::env();\n let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);\n test_env.emitted_event(\n party_contract.address(),\n &PartyStarted {\n caller: test_env.get_account(0),\n block_time: 0\n }\n );\n // If you do not want to check the exact event, you can use `emitted` function\n test_env.emitted(party_contract.address(), "PartyStarted");\n // You can also check how many events were emitted.\n assert_eq!(test_env.events_count(party_contract.address()), 1);\n}\n')),(0,a.kt)("p",null,"To explore more event testing functions, check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/95045a66.99df232b.js b/docs/assets/js/95045a66.99df232b.js new file mode 100644 index 000000000..fced392d2 --- /dev/null +++ b/docs/assets/js/95045a66.99df232b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[7196],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},28005:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.9.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.9.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.9.0/basics/odra-toml",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.9.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.9.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the building tools to locate and build the contract.\nThe last segment of the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," will be used as the name for your contract - the generated wasm file will\nbe in the above case named ",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n\n[[contracts]]\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/95db938c.eae77a25.js b/docs/assets/js/95db938c.eae77a25.js new file mode 100644 index 000000000..db9860ebb --- /dev/null +++ b/docs/assets/js/95db938c.eae77a25.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46145],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),c=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=c(n),m=o,f=p["".concat(i,".").concat(m)]||p[m]||d[m]||s;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,a=new Array(s);a[0]=p;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var c=2;c<s;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},99314:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const s={sidebar_position:11,description:"Divide your code into modules"},a="Modules",l={unversionedId:"basics/modules",id:"version-0.2.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.2.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.2.0/basics/modules",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"defaultSidebar",previous:{title:"Cross calls",permalink:"/docs/0.2.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.2.0/basics/native-token"}},i={},c=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to a macro ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),'. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use crate::docs::cross_calls::MathEngine;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: MathEngine,\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/modules.rs"',title:'"examples/src/docs/modules.rs"'},"use super::ModulesContractDeployer;\n\n#[test]\nfn test_modules() {\n let modules_contract = ModulesContractDeployer::default();\n assert_eq!(modules_contract.add_using_module(), 8);\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/95f5ef42.b01d7c43.js b/docs/assets/js/95f5ef42.b01d7c43.js new file mode 100644 index 000000000..c469a743b --- /dev/null +++ b/docs/assets/js/95f5ef42.b01d7c43.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[84296],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>g});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),c=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=c(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(t),g=r,m=u["".concat(p,".").concat(g)]||u[g]||d[g]||i;return t?a.createElement(m,o(o({ref:n},l),{},{components:t})):a.createElement(m,o({ref:n},l))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var c=2;c<i;c++)o[c]=t[c];return a.createElement.apply(null,o)}return a.createElement.apply(null,t)}u.displayName="MDXCreateElement"},29490:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const i={},o="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.6.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.6.0/advanced/03-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.6.0/advanced/advanced-storage",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.6.0/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.6.0/advanced/attributes"}},p={},c=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],l={toc:c};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Variable"),": A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The Sequence in Odra is a basic module that holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence<T>\nwhere\n T: Num + One + OdraType\n{\n value: Variable<T>\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{map, types::U256, Mapping, UnwrapOrRevert};\n\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct NestedMapping {\n strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,\n tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>\n}\n\n#[odra::module]\nimpl NestedMapping {\n\n ...\n\n pub fn set_token(\n &mut self,\n key1: String,\n key2: u32,\n key3: String,\n token_name: String,\n decimals: u8,\n symbol: String,\n initial_supply: &U256\n ) {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .init(token_name, symbol, decimals, initial_supply);\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let mapping = self.strings.get_instance(&key1).get_instance(&key2);\n mapping.get(&key3).unwrap_or_revert()\n }\n\n pub fn total_supply(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> U256 {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .total_supply()\n }\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers. "),(0,r.kt)("p",{parentName:"admonition"},"Instead of using the ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()"),", which sets the correct namespace for nested modules.")),(0,r.kt)("p",null,"If the terminal value is deeply nested, a long chain of ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()")," calls is required."),(0,r.kt)("p",null,"To keep the codebase consistent, a ",(0,r.kt)("inlineCode",{parentName:"p"},"map!")," macro can be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"...\n\npub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {\n map!(self.strings[key1][key2][key3] = value);\n}\n\npub fn get_string_macro(\n &self, \n key1: String, \n key2: u32, \n key3: String\n) -> String {\n map!(self.strings[key1][key2][key3])\n}\n\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The terminal value must not be an Odra Module.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Sequence, Mapping};\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n my_sequence: Sequence<u32>,\n my_mapping: Mapping<String, Mapping<String, Token>>,\n}\n\nimpl AdvancedStorage {\n pub fn get_sequence_current_value(&self) -> u32 {\n self.my_sequence.get_current_value()\n }\n\n pub fn next_sequence_value(&mut self) -> u32 {\n self.my_sequence.next_value()\n }\n\n pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.set(&inner_key, value);\n }\n\n pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.get(&inner_key)\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/969eb6fb.12f6d2a2.js b/docs/assets/js/969eb6fb.12f6d2a2.js new file mode 100644 index 000000000..e079e05d4 --- /dev/null +++ b/docs/assets/js/969eb6fb.12f6d2a2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[14015],{48356:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.9.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.9.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.9.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/97237b2f.576d5a37.js b/docs/assets/js/97237b2f.576d5a37.js new file mode 100644 index 000000000..bad5e3afb --- /dev/null +++ b/docs/assets/js/97237b2f.576d5a37.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[98984],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var d=2;d<o;d++)i[d]=n[d];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},74529:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="OdraVM",c={unversionedId:"backends/odra-vm",id:"version-0.8.1/backends/odra-vm",title:"OdraVM",description:"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.8.1/backends/02-odra-vm.md",sourceDirName:"backends",slug:"/backends/odra-vm",permalink:"/docs/0.8.1/backends/odra-vm",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.8.1/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.8.1/backends/casper"}},s={},d=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],l={toc:d};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odravm"},"OdraVM"),(0,a.kt)("p",null,"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time -\nsimply use your IDE's debug functionality."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The OdraVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"OdraVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is a list of contracts deployed onto the OdraVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the OdraVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe OdraVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the OdraVM.\nThanks to this and the fact that we do not need the blockchain itself,\nOdraVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the OdraVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Container"),".\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, OdraVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(OdraVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/98b2adcf.8bb9369d.js b/docs/assets/js/98b2adcf.8bb9369d.js new file mode 100644 index 000000000..4068bb404 --- /dev/null +++ b/docs/assets/js/98b2adcf.8bb9369d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[85930],{24469:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-blog","id":"default"}')}}]); \ No newline at end of file diff --git a/docs/assets/js/9a6d52da.3ad57ffb.js b/docs/assets/js/9a6d52da.3ad57ffb.js new file mode 100644 index 000000000..8b75f640b --- /dev/null +++ b/docs/assets/js/9a6d52da.3ad57ffb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[87250],{81938:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.9.0","label":"0.9.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.9.0","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.9.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.9.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.9.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.9.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.9.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.9.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.9.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.9.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.9.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.9.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.9.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.9.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.9.0/basics/events","docId":"basics/events"},{"type":"link","label":"Casper Contract Schema","href":"/docs/0.9.0/basics/casper-contract-schema","docId":"basics/casper-contract-schema"},{"type":"link","label":"Cross calls","href":"/docs/0.9.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.9.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.9.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.9.0/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Delegate","href":"/docs/0.9.0/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.9.0/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.9.0/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Storage Layout","href":"/docs/0.9.0/advanced/storage-layout","docId":"advanced/storage-layout"},{"type":"link","label":"Memory allocators","href":"/docs/0.9.0/advanced/using-different-allocator","docId":"advanced/using-different-allocator"},{"type":"link","label":"Building contracts manually","href":"/docs/0.9.0/advanced/building-manually","docId":"advanced/building-manually"}],"href":"/docs/0.9.0/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.9.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"OdraVM","href":"/docs/0.9.0/backends/odra-vm","docId":"backends/odra-vm"},{"type":"link","label":"Casper","href":"/docs/0.9.0/backends/casper","docId":"backends/casper"},{"type":"link","label":"Livenet","href":"/docs/0.9.0/backends/livenet","docId":"backends/livenet"}],"href":"/docs/0.9.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.9.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.9.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.9.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.9.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.9.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.9.0/tutorials/owned-token","docId":"tutorials/owned-token"},{"type":"link","label":"Access Control","href":"/docs/0.9.0/tutorials/access-control","docId":"tutorials/access-control"},{"type":"link","label":"Pausable","href":"/docs/0.9.0/tutorials/pauseable","docId":"tutorials/pauseable"},{"type":"link","label":"Build, Deploy and Read the State of a Contract","href":"/docs/0.9.0/tutorials/build-deploy-read","docId":"tutorials/build-deploy-read"}],"href":"/docs/0.9.0/category/tutorials"},{"type":"category","label":"Migrations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Migration guide to v0.8.0","href":"/docs/0.9.0/migrations/to-0.8.0","docId":"migrations/to-0.8.0"},{"type":"link","label":"Migration guide to v0.9.0","href":"/docs/0.9.0/migrations/to-0.9.0","docId":"migrations/to-0.9.0"}],"href":"/docs/0.9.0/category/migrations"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that","sidebar":"tutorialSidebar"},"advanced/building-manually":{"id":"advanced/building-manually","title":"Building contracts manually","description":"cargo odra is a great tool to build and test your contracts, but sometimes","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/storage-layout":{"id":"advanced/storage-layout","title":"Storage Layout","description":"Odra\'s innovative modular design necessitates a unique storage layout. This","sidebar":"tutorialSidebar"},"advanced/using-different-allocator":{"id":"advanced/using-different-allocator","title":"Memory allocators","description":"When compiling contracts to wasm, your code needs to be no-std.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/livenet":{"id":"backends/livenet","title":"Livenet","description":"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local","sidebar":"tutorialSidebar"},"backends/odra-vm":{"id":"backends/odra-vm","title":"OdraVM","description":"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/casper-contract-schema":{"id":"basics/casper-contract-schema","title":"Casper Contract Schema","description":"Casper Contract Schema","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"migrations/to-0.8.0":{"id":"migrations/to-0.8.0","title":"Migration guide to v0.8.0","description":"Migration guide to v0.8.0","sidebar":"tutorialSidebar"},"migrations/to-0.9.0":{"id":"migrations/to-0.9.0","title":"Migration guide to v0.9.0","description":"Migration guide to v0.9.0","sidebar":"tutorialSidebar"},"tutorials/access-control":{"id":"tutorials/access-control","title":"Access Control","description":"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,","sidebar":"tutorialSidebar"},"tutorials/build-deploy-read":{"id":"tutorials/build-deploy-read","title":"Build, Deploy and Read the State of a Contract","description":"In this guide, we will show the full path from creating a contract, deploying it and reading the state.","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"},"tutorials/pauseable":{"id":"tutorials/pauseable","title":"Pausable","description":"The Pausable module is like your smart contract\'s safety switch. It lets authorized users temporarily pause certain features if needed. It\'s a great way to boost security, but it\'s not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/9a7c9bac.a14c6bd6.js b/docs/assets/js/9a7c9bac.a14c6bd6.js new file mode 100644 index 000000000..330808e19 --- /dev/null +++ b/docs/assets/js/9a7c9bac.a14c6bd6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[6701],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},10596:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="MockVM",c={unversionedId:"backends/mock-vm",id:"version-0.3.1/backends/mock-vm",title:"MockVM",description:"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.3.1/backends/02-mock-vm.md",sourceDirName:"backends",slug:"/backends/mock-vm",permalink:"/docs/0.3.1/backends/mock-vm",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.3.1/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.3.1/backends/casper"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mockvm"},"MockVM"),(0,a.kt)("p",null,"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The MockVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"MockVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is just a list of contracts deployed onto the MockVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),".\nEach time we call the contract, we call its instance stored in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the MockVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe MockVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the MockVM.\nThanks to this and the fact that we do not need the blockchain itself,\nMockVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the MockVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a Contract Container.\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, MockVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(MockVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9a7f4a11.931eca48.js b/docs/assets/js/9a7f4a11.931eca48.js new file mode 100644 index 000000000..8f454e428 --- /dev/null +++ b/docs/assets/js/9a7f4a11.931eca48.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[8923],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>f});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?l(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)t=l[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)t=l[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),d=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=d(t),f=r,m=u["".concat(i,".").concat(f)]||u[f]||p[f]||l;return t?a.createElement(m,o(o({ref:n},c),{},{components:t})):a.createElement(m,o({ref:n},c))}));function f(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,o=new Array(l);o[0]=u;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d<l;d++)o[d]=t[d];return a.createElement.apply(null,o)}return a.createElement.apply(null,t)}u.displayName="MDXCreateElement"},49614:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const l={slug:"2023-02-27-openai-writes-erc20-in-odra",title:"OpenAI writes ERC20 in Odra",authors:["zie1ony"],image:"./twitter-card.png"},o=void 0,s={permalink:"/blog/2023-02-27-openai-writes-erc20-in-odra",source:"@site/blog/2023-02-27-openai-writes-erc20-in-odra/index.md",title:"OpenAI writes ERC20 in Odra",description:"OpenAI can write Odra smart contracts.",date:"2023-02-27T00:00:00.000Z",formattedDate:"February 27, 2023",tags:[],readingTime:3.785,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"2023-02-27-openai-writes-erc20-in-odra",title:"OpenAI writes ERC20 in Odra",authors:["zie1ony"],image:"./twitter-card.png"},prevItem:{title:"It's all about the community!",permalink:"/blog/its-all-about-the-community"},nextItem:{title:"Odra + CosmWasm",permalink:"/blog/odra-cosmwasm"}},i={image:t(901).Z,authorsImageUrls:[void 0]},d=[{value:"OpenAI",id:"openai",level:2},{value:"DaVinci Edit",id:"davinci-edit",level:2},{value:"ERC20 by AI",id:"erc20-by-ai",level:2},{value:"What is next?",id:"what-is-next",level:2}],c={toc:d};function p(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"OpenAI can write Odra smart contracts.\nThis is how."),(0,r.kt)("h2",{id:"openai"},"OpenAI"),(0,r.kt)("p",null,"OpenAI already proved that AI can code.\nGithub Copilot is used by more and more developers.\nMany times it is mind-blowing how accurate it is.\nIt would be great if one of the OpenAI models could simply work after writing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Q: Write the ERC20 smart contract.\n\nA: use odra::{Mapping, Variable}...\n")),(0,r.kt)("p",null,"So far OpenAI hasn't indexed Odra. I even asked ChatGPT."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Q: Do you know what is the Odra Framework for writing smart contracts?\n Response in one sentence. Use Yoda style.\n\nA: Aware of an Odra Framework for writing smart contracts, I am not.\n")),(0,r.kt)("p",null,"Soon (year or two) it will happen and Odra will be supported out of the box,\nsimply because it is available on GitHub."),(0,r.kt)("h2",{id:"davinci-edit"},"DaVinci Edit"),(0,r.kt)("p",null,"OpenAI gives us a great tool called ",(0,r.kt)("a",{parentName:"p",href:"https://openai.com/blog/gpt-3-edit-insert/"},"Edit"),".\nIt uses the same technology Github Copiled it based on called ",(0,r.kt)("a",{parentName:"p",href:"https://openai.com/blog/openai-codex/"},"Codex"),",\nOpenAI gives us access to the model ",(0,r.kt)("inlineCode",{parentName:"p"},"code-davinci-edit-001"),".\nIt allows you to paste in the code and ask for changes.\nSee more examples like rewriting Fibonacci to a recursive version ",(0,r.kt)("a",{parentName:"p",href:"https://platform.openai.com/docs/guides/code/editing-code"},"here"),". "),(0,r.kt)("p",null,"But it doesn't know Odra.\nLuckily this is not a problem.\nI have found a nice trick that allows producing the code I want.\nWe simply have to present all the features of Odra and ask a good question."),(0,r.kt)("h2",{id:"erc20-by-ai"},"ERC20 by AI"),(0,r.kt)("p",null,"The goal is to bend AI to write the ERC20 token using Odra.\nThe Edit query needs two elements:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"source code,"),(0,r.kt)("li",{parentName:"ul"},"text that describes what should be changed. ")),(0,r.kt)("p",null,"As the input source code I wrote the code that uses all the features ERC20 would use.\nI need ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"caller()"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),",\nconstructor, and errors."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=flipper.rs",title:"flipper.rs"},"use odra::{Variable, types::Address, contract_env, Mapping, execution_error};\n\n#[odra::module]\npub struct Flipper {\n value: Variable<bool>,\n flips_count: Variable<u32>,\n owner: Variable<Address>,\n messages: Mapping<(Address, Address), String>\n}\n\n#[odra::module]\nimpl Flipper {\n #[odra(init)]\n pub fn init(&mut self, owner: Address) {\n self.value.set(false);\n self.owner.set(owner);\n }\n\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n pub fn flip(&mut self) {\n self.value.set(!self.get_value());\n self.flips_count.set(self.flips_count.get_or_default());\n }\n\n pub fn get_value(&self) -> bool {\n self.value.get_or_default()\n }\n \n pub fn get_owner(&self) -> Option<Address> {\n self.owner.get()\n }\n\n pub fn set_message(&mut self, recipient: Address, msg: String) {\n let sender = contract_env::caller();\n let current_msg = self.messages.get(&(sender, recipient));\n match current_msg {\n Some(_) => contract_env::revert(Error::MessageAlreadyDefined),\n None => self.messages.set(&(sender, recipient), msg)\n }\n }\n\n pub fn get_message(&self, sender: Address, recipient: Address) -> String {\n self.messages.get_or_default(&(sender, recipient))\n }\n}\n\nexecution_error! {\n pub enum Error {\n MessageAlreadyDefined => 1,\n NotAnMessageSender => 2,\n }\n}\n")),(0,r.kt)("p",null,"ChatGPT knows what the ERC20 is, so the kind request for changes is simple."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Q: Implement another smart contract called ERC20.\n Balances should be of type U256.\n")),(0,r.kt)("p",null,"This is the result."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="ERC20 contract in Odra generated by OpenAI"',title:'"ERC20',contract:!0,in:!0,Odra:!0,generated:!0,by:!0,'OpenAI"':!0},"use odra::{Variable, types::Address, contract_env, Mapping, execution_error, U256};\n\n#[odra::module]\npub struct ERC20 {\n name: Variable<String>,\n symbol: Variable<String>,\n decimals: Variable<u8>,\n total_supply: Variable<U256>,\n balances: Mapping<Address, U256>,\n allowed: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl ERC20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, total_supply: U256) {\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.total_supply.set(total_supply);\n self.balances.set(&contract_env::caller(), total_supply);\n }\n\n pub fn total_supply(&self) -> U256 {\n self.total_supply.get_or_default()\n }\n\n pub fn balance_of(&self, owner: Address) -> U256 {\n self.balances.get_or_default(&owner)\n }\n\n pub fn transfer(&mut self, to: Address, value: U256) {\n let from = contract_env::caller();\n let from_balance = self.balances.get_or_default(&from);\n let to_balance = self.balances.get_or_default(&to);\n if from_balance < value {\n contract_env::revert(Error::InsufficientBalance);\n }\n self.balances.set(&from, from_balance - value);\n self.balances.set(&to, to_balance + value);\n }\n\n pub fn transfer_from(&mut self, from: Address, to: Address, value: U256) {\n let caller = contract_env::caller();\n let from_balance = self.balances.get_or_default(&from);\n let to_balance = self.balances.get_or_default(&to);\n let allowed = self.allowed.get_or_default(&(from, caller));\n if from_balance < value {\n contract_env::revert(Error::InsufficientBalance);\n }\n if allowed < value {\n contract_env::revert(Error::InsufficientAllowance);\n }\n self.balances.set(&from, from_balance - value);\n self.balances.set(&to, to_balance + value);\n self.allowed.set(&(from, caller), allowed - value);\n }\n\n pub fn approve(&mut self, spender: Address, value: U256) {\n let owner = contract_env::caller();\n self.allowed.set(&(owner, spender), value);\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.allowed.get_or_default(&(owner, spender))\n }\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,r.kt)("p",null,"Wow!"),(0,r.kt)("h2",{id:"what-is-next"},"What is next?"),(0,r.kt)("p",null,"AI already understands smart contracts.\nIt had to read a lot of Solidity code.\nI checked and it knows Uniswap and Compound source code.\nMost interesting is that AI was able to implement a concept it already knew\nfrom another programming language in the unseen Rust framework.\nAt some point, we will be able to translate all the Solidity code to Odra.\nOr maybe we will not have to..."),(0,r.kt)("p",null,"It is hard to imagine how good it will be in 2025 and beyond."))}p.isMDXComponent=!0},901:(e,n,t)=>{t.d(n,{Z:()=>a});const a=t.p+"assets/images/twitter-card-0f7e768e63da0acd629609954ba26f62.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/9aad49c5.c4e4a256.js b/docs/assets/js/9aad49c5.c4e4a256.js new file mode 100644 index 000000000..ba97103df --- /dev/null +++ b/docs/assets/js/9aad49c5.c4e4a256.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[19588],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,f=c["".concat(s,".").concat(m)]||c[m]||p[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u<a;u++)l[u]=t[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},96854:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.9.1/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.9.1/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.9.1/tutorials/owned-token",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.9.1/tutorials/erc20"},next:{title:"Access Control",permalink:"/docs/0.9.1/tutorials/access-control"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow only the module owner to mint tokens."),(0,o.kt)("li",{parentName:"ol"},"Enable the current owner to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::prelude::*;\nuse odra::module::SubModule;\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule<Ownable>,\n erc20: SubModule<Erc20>\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"...\nuse odra::{Address, casper_types::U256};\n...\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.ownable.ensure_ownership(&self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L9-L10")," - A constructor is an excellent place to initialize both modules at once."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L13-L15")," - Most of the entrypoints do not need any modification, so we simply delegate them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49-L51")," - The same is done with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L57-L60")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is indeed the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9c04347b.b2e8ee61.js b/docs/assets/js/9c04347b.b2e8ee61.js new file mode 100644 index 000000000..2ca2a3d52 --- /dev/null +++ b/docs/assets/js/9c04347b.b2e8ee61.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[26831],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||o;return t?r.createElement(f,s(s({ref:n},u),{},{components:t})):r.createElement(f,s({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var d=2;d<o;d++)s[d]=t[d];return r.createElement.apply(null,s)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},85162:(e,n,t)=>{t.d(n,{Z:()=>s});var r=t(67294),a=t(86010);const o="tabItem_Ymn6";function s(e){let{children:n,hidden:t,className:s}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(o,s),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>y});var r=t(87462),a=t(67294),o=t(86010),s=t(12466),l=t(16550),i=t(91980),d=t(67392),u=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(o),(0,a.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function v(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=c(e),[s,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[i,d]=f({queryString:t,groupId:r}),[p,v]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,u.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:o})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:s,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),v(e)}),[d,v,o]),tabValues:o}}var g=t(72389);const h="tabList__CuJ",k="tabItem_LNqP";function b(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:d}=e;const u=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),c=e=>{const n=e.currentTarget,t=u.indexOf(n),r=d[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;n=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;n=u[t]??u[u.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},n)},d.map((e=>{let{value:n,label:t,attributes:s}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>u.push(e),onKeyDown:m,onClick:c},s,{className:(0,o.Z)("tabs__item",k,s?.className,{"tabs__item--active":l===n})}),t??n)})))}function _(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function N(e){const n=v(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",h)},a.createElement(b,(0,r.Z)({},e,n)),a.createElement(_,(0,r.Z)({},e,n)))}function y(e){const n=(0,g.Z)();return a.createElement(N,(0,r.Z)({key:String(n)},e))}},72341:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),o=t(74866),s=t(85162);const l={sidebar_position:1,description:"Migration guide to v0.8.0"},i="Migration guide to v0.8.0",d={unversionedId:"migrations/to-0.8.0",id:"version-0.8.1/migrations/to-0.8.0",title:"Migration guide to v0.8.0",description:"Migration guide to v0.8.0",source:"@site/versioned_docs/version-0.8.1/migrations/to-0.8.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.8.0",permalink:"/docs/0.8.1/migrations/to-0.8.0",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Migration guide to v0.8.0"},sidebar:"tutorialSidebar",previous:{title:"Migrations",permalink:"/docs/0.8.1/category/migrations"}},u={},p=[{value:"<strong>1. Prerequisites</strong>",id:"1-prerequisites",level:2},{value:"1.1. <strong>Update cargo-odra</strong>",id:"11-update-cargo-odra",level:3},{value:"1.2. <strong>Review the Changelog</strong>",id:"12-review-the-changelog",level:3},{value:"<strong>2. Migration Steps</strong>",id:"2-migration-steps",level:2},{value:"2.1 <strong>Add bin directory</strong>",id:"21-add-bin-directory",level:3},{value:"2.2. <strong>Update Cargo.toml</strong>",id:"22-update-cargotoml",level:3},{value:"2.2. <strong>Update Odra.toml</strong>",id:"22-update-odratoml",level:3},{value:"2.3. <strong>Update Smart Contracts</strong>",id:"23-update-smart-contracts",level:3},{value:"2.3.1. <strong>Update the <code>use</code> statements to reflect the new module structure.</strong>",id:"231-update-the-use-statements-to-reflect-the-new-module-structure",level:4},{value:"2.3.2. <strong>Some type aliases are no longer in use.</strong>",id:"232-some-type-aliases-are-no-longer-in-use",level:4},{value:"2.3.3. <strong>Consider import <code>odra::prelude::*</code> in your module files.</strong>",id:"233-consider-import-odraprelude-in-your-module-files",level:4},{value:"2.3.4. <strong>Flatten nested <code>Mapping</code>s.</strong>",id:"234-flatten-nested-mappings",level:4},{value:"2.3.5. <strong>Update errors definitions.</strong>",id:"235-update-errors-definitions",level:4},{value:"2.3.6. <strong>Update events definitions.</strong>",id:"236-update-events-definitions",level:4},{value:"2.3.7. <strong>Replace <code>contract_env</code> with <code>self.env()</code> in your modules.</strong>",id:"237-replace-contract_env-with-selfenv-in-your-modules",level:4},{value:"2.3.8. <strong>Wrap submodules of your module with <code>odra::SubModule<T></code>.</strong>",id:"238-wrap-submodules-of-your-module-with-odrasubmodulet",level:4},{value:"2.3.9. <strong>Update external contract calls.</strong>",id:"239-update-external-contract-calls",level:4},{value:"2.3.10. <strong>Update constructors.</strong>",id:"2310-update-constructors",level:4},{value:"2.3.11. <strong>Update <code>UnwrapOrRevert</code> calls.</strong>",id:"2311-update-unwraporrevert-calls",level:4},{value:"2.3.12. <strong>Remove <code>#[odra(using)]</code> attribute from your module definition.</strong>",id:"2312-remove-odrausing-attribute-from-your-module-definition",level:4},{value:"2.4. <strong>Update Tests</strong>",id:"24-update-tests",level:3},{value:"2.4.1. <strong>Contract deployment.</strong>",id:"241-contract-deployment",level:4},{value:"2.4.2. <strong>Host interactions.</strong>",id:"242-host-interactions",level:4},{value:"2.4.3. <strong>Testing failing scenarios.</strong>",id:"243-testing-failing-scenarios",level:4},{value:"2.4.4. <strong>Testing events.</strong>",id:"244-testing-events",level:4},{value:"3. <strong>Code Examples</strong>",id:"3-code-examples",level:2},{value:"4. <strong>Troubleshooting</strong>",id:"4-troubleshooting",level:2},{value:"5. <strong>References</strong>",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v080"},"Migration guide to v0.8.0"),(0,a.kt)("p",null,"Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version."),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant changes in v0.8.0 include:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only."),(0,a.kt)("li",{parentName:"ul"},"Framework internals redesign.")),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.8.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-add-bin-directory"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Add bin directory")),(0,a.kt)("p",null,"Odra 0.8.0 introduces a new way to build smart contracts. The ",(0,a.kt)("inlineCode",{parentName:"p"},".builder_casper")," directory is no longer used. Instead, you should create a new directory called ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," in the root of your project and add the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files to the ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," directory."),(0,a.kt)("p",null,"You can find the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-cargotoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Cargo.toml")),(0,a.kt)("p",null,"There a bunch of changes in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"You don't have to specify the features anymore - remove the ",(0,a.kt)("inlineCode",{parentName:"li"},"features")," section and ",(0,a.kt)("inlineCode",{parentName:"li"},"default-features")," flag from the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra")," dependency."),(0,a.kt)("li",{parentName:"ul"},"Register bins you added in the previous step."),(0,a.kt)("li",{parentName:"ul"},"Add ",(0,a.kt)("inlineCode",{parentName:"li"},"dev-dependencies")," section with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra-test")," crate."),(0,a.kt)("li",{parentName:"ul"},"Add recommended profiles for ",(0,a.kt)("inlineCode",{parentName:"li"},"release")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," to optimize the build process.")),(0,a.kt)("p",null,"Below you can compare the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file after and before the migration to v0.8.0:"),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.7.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')))),(0,a.kt)("h3",{id:"22-update-odratoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Odra.toml")),(0,a.kt)("p",null,"Due to the changes in cargo-odra, the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file has been simplified. The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," property is no longer required."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "my_project::Flipper"\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "my_project::Flipper"\n')))),(0,a.kt)("h3",{id:"23-update-smart-contracts"},"2.3. ",(0,a.kt)("strong",{parentName:"h3"},"Update Smart Contracts")),(0,a.kt)("p",null,"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"231-update-the-use-statements-to-reflect-the-new-module-structure"},"2.3.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update the ",(0,a.kt)("inlineCode",{parentName:"strong"},"use")," statements to reflect the new module structure.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Big integer types are now located in the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types")," module."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::Address")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::Address"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Variable")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::contract_env"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::OdraType")," as it is no longer required."),(0,a.kt)("li",{parentName:"ul"},"Change ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::casper_types::*;")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::*;"),".")),(0,a.kt)("h4",{id:"232-some-type-aliases-are-no-longer-in-use"},"2.3.2. ",(0,a.kt)("strong",{parentName:"h4"},"Some type aliases are no longer in use.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Balance")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::U512"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BlockTime")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"EventData")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::bytesrepr::Bytes"),".")),(0,a.kt)("h4",{id:"233-consider-import-odraprelude-in-your-module-files"},"2.3.3. ",(0,a.kt)("strong",{parentName:"h4"},"Consider import ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::prelude::*")," in your module files.")),(0,a.kt)("h4",{id:"234-flatten-nested-mappings"},"2.3.4. ",(0,a.kt)("strong",{parentName:"h4"},"Flatten nested ",(0,a.kt)("inlineCode",{parentName:"strong"},"Mapping"),"s.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// Before\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<Address, Mapping<Address, U256>>\n}\n// After\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("h4",{id:"235-update-errors-definitions"},"2.3.5. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::execution_error;\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n}\n")))),(0,a.kt)("h4",{id:"236-update-events-definitions"},"2.3.6. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n\n// Emitting the event\nself.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n});\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n\n// Emitting the event\nuse odra::types::event::OdraEvent;\n\nTransfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n}.emit();\n")))),(0,a.kt)("h4",{id:"237-replace-contract_env-with-selfenv-in-your-modules"},"2.3.7. ",(0,a.kt)("strong",{parentName:"h4"},"Replace ",(0,a.kt)("inlineCode",{parentName:"strong"},"contract_env")," with ",(0,a.kt)("inlineCode",{parentName:"strong"},"self.env()")," in your modules.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"self.env()")," is a new way to access the contract environment, returns a reference to ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),". The API is similar to the previous ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env")," but with some changes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_var<T: FromBytes>(key: &[u8]) -> Option<T>")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"set_dict_value()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_dict_value()")," has been removed. All the dictionary operations should be performed using ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," type, internally using ",(0,a.kt)("inlineCode",{parentName:"li"},"set_var()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_var()")," functions. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8>")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn hash<T: ToBytes>(&self, value: T) -> [u8; 32]"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn revert<E: Into<ExecutionError>>(error: E) -> !")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn revert<E: Into<OdraError>>(&self, error: E) -> !"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event<T: ToBytes + OdraEvent>(event: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event<T: ToBytes>(&self, event: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"native_token_metadata()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"one_token()")," have been removed.")),(0,a.kt)("h4",{id:"238-wrap-submodules-of-your-module-with-odrasubmodulet"},"2.3.8. ",(0,a.kt)("strong",{parentName:"h4"},"Wrap submodules of your module with ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::SubModule<T>"),".")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: SubModule<Erc721Base>,\n metadata: SubModule<Erc721MetadataExtension>,\n ownable: SubModule<Ownable>\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: Erc721Base,\n metadata: Erc721MetadataExtension,\n ownable: Ownable\n}\n")))),(0,a.kt)("h4",{id:"239-update-external-contract-calls"},"2.3.9. ",(0,a.kt)("strong",{parentName:"h4"},"Update external contract calls.")),(0,a.kt)("p",null,"However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref"),") and you can call it using ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env, address)")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref::at()"),")."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenContractRef::new(env, token).balance_of(account)\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenRef::at(token).balance_of(account)\n")))),(0,a.kt)("h4",{id:"2310-update-constructors"},"2.3.10. ",(0,a.kt)("strong",{parentName:"h4"},"Update constructors.")),(0,a.kt)("p",null,"Remove the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::init]")," attribute from the constructor and ensure that the constructor function is named ",(0,a.kt)("inlineCode",{parentName:"p"},"init"),"."),(0,a.kt)("h4",{id:"2311-update-unwraporrevert-calls"},"2.3.11. ",(0,a.kt)("strong",{parentName:"h4"},"Update ",(0,a.kt)("inlineCode",{parentName:"strong"},"UnwrapOrRevert")," calls.")),(0,a.kt)("p",null,"The functions ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," now require ",(0,a.kt)("inlineCode",{parentName:"p"},"&HostEnv")," as the first parameter."),(0,a.kt)("h4",{id:"2312-remove-odrausing-attribute-from-your-module-definition"},"2.3.12. ",(0,a.kt)("strong",{parentName:"h4"},"Remove ",(0,a.kt)("inlineCode",{parentName:"strong"},"#[odra(using)]")," attribute from your module definition.")),(0,a.kt)("p",null,"Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required."),(0,a.kt)("h3",{id:"24-update-tests"},"2.4. ",(0,a.kt)("strong",{parentName:"h3"},"Update Tests")),(0,a.kt)("p",null,"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"241-contract-deployment"},"2.4.1. ",(0,a.kt)("strong",{parentName:"h4"},"Contract deployment.")),(0,a.kt)("p",null,"The way you deploy a contract has changed:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef::deploy(&env, args)")," instead of ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}Deployer::init()"),". The ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef")," implements ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer"),"."),(0,a.kt)("li",{parentName:"ol"},"Instantiate the ",(0,a.kt)("inlineCode",{parentName:"li"},"HostEnv")," using ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),", required by the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract doesn't have init args, you should use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract has init args, you should pass the autogenerated ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableHostRef;\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\nlet env: HostEnv = odra_test::env();\nlet ownable = OwnableHostRef::deploy(&env, NoArgs)\n\n// A contract with init args\nuse super::{Erc20HostRef, Erc20InitArgs};\nuse odra::host::{Deployer, HostEnv};\n\nlet env: HostEnv = odra_test::env();\nlet init_args = Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n};\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableDeployer;\n\nlet ownable = OwnableDeployer::init();\n\n// A contract with init args\nlet erc20 = Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n);\n")))),(0,a.kt)("h4",{id:"242-host-interactions"},"2.4.2. ",(0,a.kt)("strong",{parentName:"h4"},"Host interactions.")),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Replace ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),"."),(0,a.kt)("li",{parentName:"ol"},"The API of ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()")," are similar, but there are some differences:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::advance_block_time_by(BlockTime)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.advance_block_time(u64)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::token_balance(Address)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.balance_of(&Address)"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_cost()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_used()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::total_gas_used(Address)"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::gas_report()")," have been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef::last_call()")," and extract the data from a ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::ContractCallResult")," instance. ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef")," is a trait implemented by ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef"),".")))),(0,a.kt)("h4",{id:"243-testing-failing-scenarios"},"2.4.3. ",(0,a.kt)("strong",{parentName:"h4"},"Testing failing scenarios.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"test_env::assert_exception()")," has been removed. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix to call the function and then assert the result.\n",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix is a new way to call a function that might fail. It returns a ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult"))," type, which you can then assert using the standard Rust ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n let (env, mut erc20) = setup();\n\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n assert_eq!(\n erc20.try_transfer_from(owner, recipient, amount),\n Err(Error::InsufficientAllowance.into())\n );\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n test_env::assert_exception(Error::InsufficientAllowance, || {\n let mut erc20 = setup();\n\n let (owner, spender, recipient) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let amount = 1_000.into();\n test_env::set_caller(spender);\n\n erc20.transfer_from(&owner, &recipient, &amount)\n });\n}\n")))),(0,a.kt)("h4",{id:"244-testing-events"},"2.4.4. ",(0,a.kt)("strong",{parentName:"h4"},"Testing events.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," macro has been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv::emitted_event()")," to assert the emitted events.\nThe new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation to explore the available options."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let env: HostEnv = odra_test::env();\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n\n...\n\nassert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n));\nassert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n));\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let erc20 = Erc20HostDeployer::init(&env, ...);\n\n...\n\nassert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n);\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.8.0."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option<U256>\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20HostRef, Erc20InitArgs\n };\n use odra::{\n casper_types::U256,\n host::{Deployer, HostEnv, HostRef},\n prelude::*\n };\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n // Other tests...\n}\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use odra::prelude::string::String;\nuse odra::{\n contract_env,\n types::{event::OdraEvent, Address, U256},\n Mapping, UnwrapOrRevert, Variable\n};\n\nuse self::{\n errors::Error,\n events::{Approval, Transfer}\n};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Variable<u8>,\n symbol: Variable<String>,\n name: Variable<String>,\n total_supply: Variable<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<Address, Mapping<Address, U256>>\n}\n\n#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: &Option<U256>\n ) {\n let caller = contract_env::caller();\n\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = *initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n }\n .emit();\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = contract_env::caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = contract_env::caller();\n\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn name(&self) -> String {\n self.name.get().unwrap_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n contract_env::revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n }\n .emit();\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n contract_env::revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n self.allowances\n .get_instance(owner)\n .subtract(spender, *amount);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\npub mod events {\n use odra::types::{casper_types::U256, Address};\n use odra::Event;\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::execution_error;\n\n execution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20Deployer, Erc20Ref\n };\n use odra::prelude::string::ToString;\n use odra::{assert_events, test_env, types::casper_types::U256};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let erc20 = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When transfer tokens to a recipient.\n let sender = test_env::get_account(0);\n let recipient = test_env::get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n test_env::assert_exception(Error::InsufficientBalance, || {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n erc20.transfer(&recipient, &amount)\n });\n }\n\n // Other tests...\n}\n')))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9cc9201d.b8c69beb.js b/docs/assets/js/9cc9201d.b8c69beb.js new file mode 100644 index 000000000..979a9606d --- /dev/null +++ b/docs/assets/js/9cc9201d.b8c69beb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63395],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>g});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),c=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=c(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(t),g=r,m=u["".concat(p,".").concat(g)]||u[g]||d[g]||i;return t?a.createElement(m,o(o({ref:n},l),{},{components:t})):a.createElement(m,o({ref:n},l))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var c=2;c<i;c++)o[c]=t[c];return a.createElement.apply(null,o)}return a.createElement.apply(null,t)}u.displayName="MDXCreateElement"},50030:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const i={},o="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.5.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.5.0/advanced/03-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.5.0/advanced/advanced-storage",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.5.0/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.5.0/advanced/attributes"}},p={},c=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],l={toc:c};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Variable"),": A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The Sequence in Odra is a basic module that holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence<T>\nwhere\n T: Num + One + OdraType\n{\n value: Variable<T>\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{map, types::U256, Mapping, UnwrapOrRevert};\n\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct NestedMapping {\n strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,\n tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>\n}\n\n#[odra::module]\nimpl NestedMapping {\n\n ...\n\n pub fn set_token(\n &mut self,\n key1: String,\n key2: u32,\n key3: String,\n token_name: String,\n decimals: u8,\n symbol: String,\n initial_supply: &U256\n ) {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .init(token_name, symbol, decimals, initial_supply);\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let mapping = self.strings.get_instance(&key1).get_instance(&key2);\n mapping.get(&key3).unwrap_or_revert()\n }\n\n pub fn total_supply(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> U256 {\n self.tokens\n .get_instance(&key1)\n .get_instance(&key2)\n .get_instance(&key3)\n .total_supply()\n }\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers. "),(0,r.kt)("p",{parentName:"admonition"},"Instead of using the ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()"),", which sets the correct namespace for nested modules.")),(0,r.kt)("p",null,"If the terminal value is deeply nested, a long chain of ",(0,r.kt)("inlineCode",{parentName:"p"},"get_instance()")," calls is required."),(0,r.kt)("p",null,"To keep the codebase consistent, a ",(0,r.kt)("inlineCode",{parentName:"p"},"map!")," macro can be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"...\n\npub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {\n map!(self.strings[key1][key2][key3] = value);\n}\n\npub fn get_string_macro(\n &self, \n key1: String, \n key2: u32, \n key3: String\n) -> String {\n map!(self.strings[key1][key2][key3])\n}\n\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The terminal value must not be an Odra Module.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Sequence, Mapping};\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n my_sequence: Sequence<u32>,\n my_mapping: Mapping<String, Mapping<String, Token>>,\n}\n\nimpl AdvancedStorage {\n pub fn get_sequence_current_value(&self) -> u32 {\n self.my_sequence.get_current_value()\n }\n\n pub fn next_sequence_value(&mut self) -> u32 {\n self.my_sequence.next_value()\n }\n\n pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.set(&inner_key, value);\n }\n\n pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {\n let inner_mapping = self.my_mapping.get_instance(&outer_key);\n inner_mapping.get(&inner_key)\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9d620965.1b03cdc8.js b/docs/assets/js/9d620965.1b03cdc8.js new file mode 100644 index 000000000..793c06bdd --- /dev/null +++ b/docs/assets/js/9d620965.1b03cdc8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29634],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),u=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(r),m=o,f=p["".concat(l,".").concat(m)]||p[m]||d[m]||a;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u<a;u++)s[u]=r[u];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}p.displayName="MDXCreateElement"},27177:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:11,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-0.6.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.6.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.6.0/basics/modules",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.6.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.6.0/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:u};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to a macro ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),'. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: MathEngine,\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use super::ModulesContractDeployer;\n\n#[test]\nfn test_modules() {\n let modules_contract = ModulesContractDeployer::default();\n assert_eq!(modules_contract.add_using_module(), 8);\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9d95fe34.c375cee2.js b/docs/assets/js/9d95fe34.c375cee2.js new file mode 100644 index 000000000..4d4c59327 --- /dev/null +++ b/docs/assets/js/9d95fe34.c375cee2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[54434],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},91975:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.3.1/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.3.1/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.3.1/basics/native-token",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.3.1/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.3.1/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"native-token"},"Native token"),(0,r.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::contract_env;\n\n#[odra::module]\npub struct PublicWallet {\n}\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {\n }\n\n pub fn withdraw(&mut self, amount: Balance) {\n contract_env::transfer_tokens(contract_env::caller(), amount);\n }\n}\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,r.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/tlw.rs")," in the odra main repository.")),(0,r.kt)("p",null,"You can see a new macro used here: ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from contract_env - ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_tokens"),".\nIt does exactly what you are expecting it to do - it will transfer native tokens from the contract to the\nspecified address."),(0,r.kt)("p",null,"We are also using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Balance")," - an Odra type that wraps around the type that the underlying blockchain uses\nfor counting tokens."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,r.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a function -\n",(0,r.kt)("inlineCode",{parentName:"p"},"token_balance"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::test_env;\nuse super::PublicWalletDeployer;\n\n#[test]\nfn test_modules() {\n let mut my_contract = PublicWalletDeployer::default();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());\n\n my_contract.with_tokens(Balance::from(100)).deposit();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));\n\n my_contract.withdraw(Balance::from(25));\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9dc5d51e.8872b6b2.js b/docs/assets/js/9dc5d51e.8872b6b2.js new file mode 100644 index 000000000..9fe849c4f --- /dev/null +++ b/docs/assets/js/9dc5d51e.8872b6b2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73201],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=d(t),m=a,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||s;return t?r.createElement(f,o(o({ref:n},c),{},{components:t})):r.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=p;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var d=2;d<s;d++)o[d]=t[d];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}p.displayName="MDXCreateElement"},97714:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const s={sidebar_position:3},o="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.8.1/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.8.1/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.8.1/tutorials/erc20",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.8.1/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.8.1/tutorials/owned-token"}},i={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"erc-20"},"ERC-20"),(0,a.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,a.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,a.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value."),(0,a.kt)("h2",{id:"framework-features"},"Framework features"),(0,a.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Advanced storage using key-value pairs,"),(0,a.kt)("li",{parentName:"ul"},"Odra types such as ",(0,a.kt)("inlineCode",{parentName:"li"},"Address"),","),(0,a.kt)("li",{parentName:"ul"},"Advanced event assertion.")),(0,a.kt)("h2",{id:"code"},"Code"),(0,a.kt)("p",null,"Our module features a considerably more complex storage layout compared to the previous example. "),(0,a.kt)("p",null,"It is designed to store the following data:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol, and decimals."),(0,a.kt)("li",{parentName:"ol"},"Total supply."),(0,a.kt)("li",{parentName:"ol"},"Balances of individual users."),(0,a.kt)("li",{parentName:"ol"},"Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.")),(0,a.kt)("h2",{id:"module-definition"},"Module definition"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Mapping, Var};\n\n#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,a.kt)("inlineCode",{parentName:"li"},"mapping"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L11")," - Odra does not allows nested ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),"s as Solidity does. Instead, you can create a compound key using a tuple of keys.")),(0,a.kt)("h3",{id:"metadata"},"Metadata"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"...\nuse odra::Event;\n\n...\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let caller = self.env().caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, &initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.balances.add(address, *amount);\n self.total_supply.add(*amount);\n \n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L6")," - The first ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L8-L14")," - A constructor sets the token metadata and mints the initial supply."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L33")," - The second ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," is not an Odra module; in other words, these functions will not be part of the contract's public interface."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L34-L43")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"mint")," function is public, so, like in regular Rust code, it will be accessible from the outside. ",(0,a.kt)("inlineCode",{parentName:"li"},"mint()")," uses the notation ",(0,a.kt)("inlineCode",{parentName:"li"},"self.balances.add(address, *amount);"),", which is syntactic sugar for:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::UnwrapOrRevert;\n\nlet current_balance = self.balances.get(address).unwrap_or_default();\nlet new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());\nself.balances.set(address, new_balance);\n")),(0,a.kt)("h3",{id:"core"},"Core"),(0,a.kt)("p",null,"To ensure comprehensive functionality, let's implement the remaining features such as ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer_from"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"approve"),". Since they do not introduce any new concepts, we will present them without additional remarks."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers title=erc20.rs",showLineNumbers:!0,title:"erc20.rs"},"...\nuse odra::OdraError;\n\n#[odra::module]\nimpl Erc20 {\n ...\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n self.env().revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowance(owner, spender);\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .set(&(*owner, *spender), new_allowance);\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 1,\n InsufficientAllowance = 2,\n}\n")),(0,a.kt)("p",null,"Now, compare the code we have written, with ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,a.kt)("h3",{id:"test"},"Test"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::*;\n use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: INITIAL_SUPPLY.into()\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let (env, mut erc20) = setup();\n\n let (owner, recipient, spender) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount\n }\n ));\n\n // Spender transfers tokens from Owner to Recipient.\n env.set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n ));\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n ));\n // assert!(env.emitted(erc20.address(), "Transfer"));\n }\n\n #[test]\n fn transfer_from_error() {\n // Given a new instance.\n let (env, mut erc20) = setup();\n\n // When the spender\'s allowance is zero.\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n // Then transfer fails.\n assert_eq!(\n erc20.try_transfer_from(&owner, &recipient, &amount),\n Err(Error::InsufficientAllowance.into())\n );\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L146")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Having two modules: ",(0,a.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9e3cc906.53c795a3.js b/docs/assets/js/9e3cc906.53c795a3.js new file mode 100644 index 000000000..1dc6d03b5 --- /dev/null +++ b/docs/assets/js/9e3cc906.53c795a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[69697],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},33318:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.8.1/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.8.1/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.8.1/basics/odra-toml",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.8.1/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.8.1/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the building tools to locate and build the contract.\nThe last segment of the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," will be used as the name for your contract - the generated wasm file will\nbe in the above case named ",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n\n[[contracts]]\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9e4087bc.e552b938.js b/docs/assets/js/9e4087bc.e552b938.js new file mode 100644 index 000000000..18b9924cc --- /dev/null +++ b/docs/assets/js/9e4087bc.e552b938.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53608],{63169:(e,t,a)=>{a.r(t),a.d(t,{default:()=>o});var r=a(67294),l=a(39960),n=a(95999),c=a(1944),i=a(12684);function m(e){let{year:t,posts:a}=e;return r.createElement(r.Fragment,null,r.createElement("h3",null,t),r.createElement("ul",null,a.map((e=>r.createElement("li",{key:e.metadata.date},r.createElement(l.Z,{to:e.metadata.permalink},e.metadata.formattedDate," - ",e.metadata.title))))))}function s(e){let{years:t}=e;return r.createElement("section",{className:"margin-vert--lg"},r.createElement("div",{className:"container"},r.createElement("div",{className:"row"},t.map(((e,t)=>r.createElement("div",{key:t,className:"col col--4 margin-vert--lg"},r.createElement(m,e)))))))}function o(e){let{archive:t}=e;const a=(0,n.I)({id:"theme.blog.archive.title",message:"Archive",description:"The page & hero title of the blog archive page"}),l=(0,n.I)({id:"theme.blog.archive.description",message:"Archive",description:"The page & hero description of the blog archive page"}),m=function(e){const t=e.reduceRight(((e,t)=>{const a=t.metadata.date.split("-")[0],r=e.get(a)??[];return e.set(a,[t,...r])}),new Map);return Array.from(t,(e=>{let[t,a]=e;return{year:t,posts:a}}))}(t.blogPosts);return r.createElement(r.Fragment,null,r.createElement(c.d,{title:a,description:l}),r.createElement(i.Z,null,r.createElement("header",{className:"hero hero--primary"},r.createElement("div",{className:"container"},r.createElement("h1",{className:"hero__title"},a),r.createElement("p",{className:"hero__subtitle"},l))),r.createElement("main",null,m.length>0&&r.createElement(s,{years:m}))))}}}]); \ No newline at end of file diff --git a/docs/assets/js/9e73c0bb.984e2821.js b/docs/assets/js/9e73c0bb.984e2821.js new file mode 100644 index 000000000..f5d37d2b1 --- /dev/null +++ b/docs/assets/js/9e73c0bb.984e2821.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62432],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,o,a=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var r=o.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return o.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},u=o.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?o.createElement(f,l(l({ref:r},c),{},{components:t})):o.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p<n;p++)l[p]=t[p];return o.createElement.apply(null,l)}return o.createElement.apply(null,t)}u.displayName="MDXCreateElement"},76108:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.2.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.",source:"@site/versioned_docs/version-0.2.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.2.0/examples/odra-examples",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Examples",permalink:"/docs/0.2.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.2.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,a.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,a.kt)("inlineCode",{parentName:"p"},"examples")," in the Odra main repository."),(0,a.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,a.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,a.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9e93cf3e.28e650ad.js b/docs/assets/js/9e93cf3e.28e650ad.js new file mode 100644 index 000000000..6f3250287 --- /dev/null +++ b/docs/assets/js/9e93cf3e.28e650ad.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33659],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function l(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){o(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}))}return e}function s(e,n){if(null==e)return{};var r,t,o=function(e,n){if(null==e)return{};var r,t,o={},a=Object.keys(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=t.createContext({}),d=function(e){var n=t.useContext(i),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},p=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=d(r),m=o,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||a;return r?t.createElement(f,l(l({ref:n},c),{},{components:r})):t.createElement(f,l({ref:n},c))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=p;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var d=2;d<a;d++)l[d]=r[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,r)}p.displayName="MDXCreateElement"},11041:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var t=r(87462),o=(r(67294),r(3905));const a={sidebar_position:4},l="Access Control",s={unversionedId:"tutorials/access-control",id:"version-0.9.1/tutorials/access-control",title:"Access Control",description:"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,",source:"@site/versioned_docs/version-0.9.1/tutorials/access-control.md",sourceDirName:"tutorials",slug:"/tutorials/access-control",permalink:"/docs/0.9.1/tutorials/access-control",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"OwnedToken",permalink:"/docs/0.9.1/tutorials/owned-token"},next:{title:"Pausable",permalink:"/docs/0.9.1/tutorials/pauseable"}},i={},d=[{value:"Code",id:"code",level:2},{value:"Project Structure",id:"project-structure",level:3},{value:"Events and Errors",id:"events-and-errors",level:3},{value:"Module",id:"module",level:3}],c={toc:d};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"access-control"},"Access Control"),(0,o.kt)("p",null,"In a previous tutorial, we introduced the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.1/tutorials/ownable"},(0,o.kt)("inlineCode",{parentName:"a"},"Ownable"))," module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient, "),(0,o.kt)("p",null,"In this article we design and implement a more fine-grained access control layer."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"Before we start writing code, we list the functionalities of our access control layer."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type is used across the module."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be assigned to many ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es."),(0,o.kt)("li",{parentName:"ol"},"Each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," may have a corresponding admin role."),(0,o.kt)("li",{parentName:"ol"},"Only an admin can grant/revoke a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),"."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be renounced."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," cannot be renounced on someone's behalf."),(0,o.kt)("li",{parentName:"ol"},"Each action triggers an event."),(0,o.kt)("li",{parentName:"ol"},"Unauthorized access stops contract execution.")),(0,o.kt)("h3",{id:"project-structure"},"Project Structure"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-plaintext"},"access-control\n\u251c\u2500\u2500 src\n\u2502 \u251c\u2500\u2500 access\n\u2502 \u2502 \u251c\u2500\u2500 access_control.rs\n\u2502 \u2502 \u251c\u2500\u2500 events.rs\n\u2502 \u2502 \u2514\u2500\u2500 errors.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n|\u2500\u2500 build.rs\n|\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 Odra.toml\n")),(0,o.kt)("h3",{id:"events-and-errors"},"Events and Errors"),(0,o.kt)("p",null,"There are three actions that can be performed concerning a ",(0,o.kt)("inlineCode",{parentName:"p"},"Role"),": granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=events.rs showLineNumbers",title:"events.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\nuse super::access_control::Role;\n\n#[odra::event]\npub struct RoleGranted {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleRevoked {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleAdminChanged {\n pub role: Role,\n pub previous_admin_role: Role,\n pub new_admin_role: Role\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L5-L17")," - to describe the grant or revoke actions, our events specify the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", and ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es indicating who receives or loses access and who provides or withdraws it."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L19-L24")," - the event describing the admin role change, requires the subject ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", the previous and the current admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=errors.rs",title:"errors.rs"},"#[odra::odra_error]\npub enum Error {\n MissingRole = 20_000,\n RoleRenounceForAnotherAddress = 20_001,\n}\n")),(0,o.kt)("p",null,"Errors definition is straightforward - there are only two invalid states: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"An action is triggered by an unauthorized actor."),(0,o.kt)("li",{parentName:"ol"},"The caller is attempting to resign the Role on someone's behalf. ")),(0,o.kt)("h3",{id:"module"},"Module"),(0,o.kt)("p",null,"Now, we are stepping into the most interesting part: the module definition and implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=access_control.rs showLineNumbers",title:"access_control.rs",showLineNumbers:!0},"use super::events::*;\nuse super::errors::Error;\nuse odra::prelude::*;\nuse odra::{Address, Mapping};\n\npub type Role = [u8; 32];\n\npub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];\n\n#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]\npub struct AccessControl {\n roles: Mapping<(Role, Address), bool>,\n role_admin: Mapping<Role, Role>\n}\n\n#[odra::module]\nimpl AccessControl {\n pub fn has_role(&self, role: &Role, address: &Address) -> bool {\n self.roles.get_or_default(&(*role, *address))\n }\n\n pub fn get_role_admin(&self, role: &Role) -> Role {\n let admin_role = self.role_admin.get(role);\n if let Some(admin) = admin_role {\n admin\n } else {\n DEFAULT_ADMIN_ROLE\n }\n }\n\n pub fn grant_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_grant_role(role, address);\n }\n\n pub fn revoke_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_revoke_role(role, address);\n }\n\n pub fn renounce_role(&mut self, role: &Role, address: &Address) {\n if address != &self.env().caller() {\n self.env().revert(Error::RoleRenounceForAnotherAddress);\n }\n self.unchecked_revoke_role(role, address);\n }\n}\n\nimpl AccessControl {\n pub fn check_role(&self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.env().revert(Error::MissingRole);\n }\n }\n\n pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {\n let previous_admin_role = self.get_role_admin(role);\n self.role_admin.set(role, *admin_role);\n self.env().emit_event(RoleAdminChanged {\n role: *role,\n previous_admin_role,\n new_admin_role: *admin_role\n });\n }\n\n pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.roles.set(&(*role, *address), true);\n self.env().emit_event(RoleGranted {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n\n pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {\n if self.has_role(role, address) {\n self.roles.set(&(*role, *address), false);\n self.env().emit_event(RoleRevoked {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L6")," - Firstly, we need the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type. It is simply an alias for a 32-byte array."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L8")," - The default role is an array filled with zeros."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L13")," - The storage consists of two mappings:")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"roles")," - a nested mapping that stores information about whether a certain Role is granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"role_admin")," - each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can have a single admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L18-L20")," - This is a simple check to determine if a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," has been granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),". It is an exposed entry point and an important building block widely used throughout the entire module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49")," - This is a non-exported block containing helper functions."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L54")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," function serves as a guard function. Before a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with ",(0,o.kt)("inlineCode",{parentName:"li"},"Error::MissingRole"),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L56-L64")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"set_admin_role()")," function simply updates the role_admin mapping and emits the ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleAdminChanged")," event."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L66-L86")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_revoke_role()")," functions are mirror functions that update the roles mapping and post ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleGranted")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleRevoked")," events. If the role is already granted, ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," has no effect (the opposite check is made in the case of revoking a role)."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L22-L29")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"get_role_admin()")," entry point reads the role_admin. If there is no admin role for a given role, it returns the default role."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L31-L46")," - This is a combination of ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_*_role()"),". Entry points fail on unauthorized access.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9f0f335a.c8edc22c.js b/docs/assets/js/9f0f335a.c8edc22c.js new file mode 100644 index 000000000..d6ed391dc --- /dev/null +++ b/docs/assets/js/9f0f335a.c8edc22c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[6459],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,h=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(h,i(i({ref:t},d),{},{components:n})):a.createElement(h,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},23872:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.8.1/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.8.1/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.8.1/backends/what-is-a-backend",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.8.1/category/backends"},next:{title:"OdraVM",permalink:"/docs/0.8.1/backends/odra-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Host Env",id:"host-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/odra-vm"},"OdraVM"),",\na complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/casper"},"CasperVM"),",\nor even a real blockchain - when using ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/backends/casper"},"Livenet backend"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"host-env"},"Host Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/9f6fd0ea.1ae6ca7a.js b/docs/assets/js/9f6fd0ea.1ae6ca7a.js new file mode 100644 index 000000000..3afaa724a --- /dev/null +++ b/docs/assets/js/9f6fd0ea.1ae6ca7a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[29037],{39684:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.8.1/category/examples","navigation":{"previous":{"title":"Livenet","permalink":"/docs/0.8.1/backends/livenet"},"next":{"title":"odra-examples","permalink":"/docs/0.8.1/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/9ffb5fe4.01bae231.js b/docs/assets/js/9ffb5fe4.01bae231.js new file mode 100644 index 000000000..7335b386f --- /dev/null +++ b/docs/assets/js/9ffb5fe4.01bae231.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25558],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},55642:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.3.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.3.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.3.0/basics/native-token",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"defaultSidebar",previous:{title:"Modules",permalink:"/docs/0.3.0/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.3.0/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"native-token"},"Native token"),(0,r.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::contract_env;\n\n#[odra::module]\npub struct PublicWallet {\n}\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {\n }\n\n pub fn withdraw(&mut self, amount: Balance) {\n contract_env::transfer_tokens(contract_env::caller(), amount);\n }\n}\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,r.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/tlw.rs")," in the odra main repository.")),(0,r.kt)("p",null,"You can see a new macro used here: ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from contract_env - ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_tokens"),".\nIt does exactly what you are expecting it to do - it will transfer native tokens from the contract to the\nspecified address."),(0,r.kt)("p",null,"We are also using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Balance")," - an Odra type that wraps around the type that the underlying blockchain uses\nfor counting tokens."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,r.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a function -\n",(0,r.kt)("inlineCode",{parentName:"p"},"token_balance"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/native_token.rs"',title:'"examples/src/docs/native_token.rs"'},"use odra::types::Balance;\nuse odra::test_env;\nuse super::PublicWalletDeployer;\n\n#[test]\nfn test_modules() {\n let mut my_contract = PublicWalletDeployer::default();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());\n\n my_contract.with_tokens(Balance::from(100)).deposit();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));\n\n my_contract.withdraw(Balance::from(25));\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a046a162.387512f6.js b/docs/assets/js/a046a162.387512f6.js new file mode 100644 index 000000000..95c1b2e87 --- /dev/null +++ b/docs/assets/js/a046a162.387512f6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59344],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},88654:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},o="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.6.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.6.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.6.0/basics/flipper-internals",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.6.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.6.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.6.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Variable;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Variables and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Variable<bool>,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," macro marks the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperDeployer")," - a piece of code generated automatically thanks to the macros.\nThe contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a05c6bda.a17716a5.js b/docs/assets/js/a05c6bda.a17716a5.js new file mode 100644 index 000000000..ac0eeb112 --- /dev/null +++ b/docs/assets/js/a05c6bda.a17716a5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[18118],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var r=a(67294);function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function n(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?n(Object(a),!0).forEach((function(t){o(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):n(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,r,o=function(e,t){if(null==e)return{};var a,r,o={},n=Object.keys(e);for(r=0;r<n.length;r++)a=n[r],t.indexOf(a)>=0||(o[a]=e[a]);return o}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)a=n[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(o[a]=e[a])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var a=e.components,o=e.mdxType,n=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(a),m=o,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||n;return a?r.createElement(h,i(i({ref:t},u),{},{components:a})):r.createElement(h,i({ref:t},u))}));function m(e,t){var a=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var n=a.length,i=new Array(n);i[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p<n;p++)i[p]=a[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,a)}c.displayName="MDXCreateElement"},52936:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>n,metadata:()=>l,toc:()=>p});var r=a(87462),o=(a(67294),a(3905));const n={slug:"its-all-about-the-community",title:"It's all about the community!",authors:["zie1ony"],image:"./roadmap.png"},i=void 0,l={permalink:"/blog/its-all-about-the-community",source:"@site/blog/2023-06-27-we-are-here-to-stay/index.md",title:"It's all about the community!",description:"Over the past months,",date:"2023-06-27T00:00:00.000Z",formattedDate:"June 27, 2023",tags:[],readingTime:2.825,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"its-all-about-the-community",title:"It's all about the community!",authors:["zie1ony"],image:"./roadmap.png"},prevItem:{title:"Nysa",permalink:"/blog/Nysa"},nextItem:{title:"OpenAI writes ERC20 in Odra",permalink:"/blog/2023-02-27-openai-writes-erc20-in-odra"}},s={image:a(32899).Z,authorsImageUrls:[void 0]},p=[{value:"Hello Odra Community",id:"hello-odra-community",level:2},{value:"We will help with your project",id:"we-will-help-with-your-project",level:2},{value:"Roadmap",id:"roadmap",level:2}],u={toc:p};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Over the past months,\nwe have been working hard on bringing Odra to the Casper world.\nWhile we are proud of what we have achieved so far,\nthe hard part is just beginning.\nSmart contract developers from outside of our team are starting to use Odra.\nWe are thrilled about it and here is how we are going to support the community."),(0,o.kt)("h2",{id:"hello-odra-community"},"Hello Odra Community"),(0,o.kt)("p",null,"Whether you are a Rust developer, Solidity developer or a Casper enthusiast\nwe are happy to have you here, reading this blog post."),(0,o.kt)("p",null,"We have built Odra to make smart contract development on Casper easy.\nNow we are entering the next phase of the open source journey.\nWe are going to focus on the community and make sure\nOdra is the best tool for the job.\nOur motto (we borrowed from the Django Project) is:"),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("strong",{parentName:"p"},"We bring cutting-edge smart contract development tools to\nprofessionals with deadlines."))),(0,o.kt)("p",null,"How will we do it? We are going to focus on four things:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Quality")," - Our code and documentation will be of the highest quality.\nWe will always have tons of tests and examples."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Simplicity")," - The simplest solution is the best solution.\nOdra's API needs to be simple and easy to use.\nAlways!\nWe are not afraid to take a few steps back and rethink our design.\nWe believe in short feedback loops and fast iterations."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Reusability")," - No one likes to repeat itself.\nWe see a huge potential in Odra Modules.\nIn time, it can become a standard library of Casper smart contracts,\nthat are battle-tested and ready to use."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Community")," - We are here to help you.\nYou can always reach out to us on ",(0,o.kt)("a",{parentName:"li",href:"https://discord.gg/Mm5ABc9P8k"},"Discord")," or ",(0,o.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra"},"Github"),".")),(0,o.kt)("h2",{id:"we-will-help-with-your-project"},"We will help with your project"),(0,o.kt)("p",null,"Whether you are a Rust developer or not, you can start using Odra today.\nWe have prepared a few ",(0,o.kt)("a",{parentName:"p",href:"https://odra.dev/docs"},"examples and docs")," to help you get started.\nRust knowledge required to use Odra is minimal.\nThat was always the goal."),(0,o.kt)("p",null,"But we understand that it is hard to start.\nWe got your back."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("strong",{parentName:"p"},"We offer free consulting + 2 hours of live coding."))),(0,o.kt)("p",null,"All you have to do is write us an email at ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("a",{parentName:"strong",href:"mailto:contract@odra.dev"},"contract@odra.dev")),"\nwith a short description of your project.\nWe will schedule a call and help you get started with Odra.\nAfter 2 hours of live coding, you will have a working repository with 2 or 3\nsmart contracts, that you can use as a starting point for your project."),(0,o.kt)("h2",{id:"roadmap"},"Roadmap"),(0,o.kt)("p",null,"The feedback we got quite often was:\n",(0,o.kt)("strong",{parentName:"p"},"It's nice, but will it last? What's the direction of the project?"),"\nPoint taken. Now we answer: ",(0,o.kt)("strong",{parentName:"p"},"We are here to stay."),"\nWe got the support from the Casper Association and some projects of our own\nto keep us funded. We play the long game."),(0,o.kt)("p",null,"To systematize our work, we have prepared the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/milestones"},"roadmap"),".\nAs of now, we maintain plans for at least three future releases.\nIt is a good balance between predictability and flexibility.\nWe will release new versions approximately every 1-2 months or as needed.\nEveryone is encouraged to propose a new Odra feature or enhancement.\nNew proposals need to be discussed and approved by the core team.\nWhen the feature is ready, we assign it to one of the future releases."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Odra Roadmap",src:a(32899).Z,width:"1642",height:"1094"})))}d.isMDXComponent=!0},32899:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/roadmap-8255e4b08deb4134a7e97e32c21ad0dc.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/a0a709a1.bdfba5f4.js b/docs/assets/js/a0a709a1.bdfba5f4.js new file mode 100644 index 000000000..034243282 --- /dev/null +++ b/docs/assets/js/a0a709a1.bdfba5f4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[98017],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),i=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=i(e.components);return a.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=i(n),m=r,f=c["".concat(u,".").concat(m)]||c[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=c;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var i=2;i<s;i++)o[i]=n[i];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},1720:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>i});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5},o="Pausable",l={unversionedId:"tutorials/pauseable",id:"version-0.9.0/tutorials/pauseable",title:"Pausable",description:"The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.",source:"@site/versioned_docs/version-0.9.0/tutorials/pauseable.md",sourceDirName:"tutorials",slug:"/tutorials/pauseable",permalink:"/docs/0.9.0/tutorials/pauseable",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Access Control",permalink:"/docs/0.9.0/tutorials/access-control"},next:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/0.9.0/tutorials/build-deploy-read"}},u={},i=[{value:"Code",id:"code",level:2},{value:"Events and Error",id:"events-and-error",level:3},{value:"Module definition",id:"module-definition",level:3},{value:"Checks and guards",id:"checks-and-guards",level:3},{value:"Actions",id:"actions",level:3},{value:"Pausable counter",id:"pausable-counter",level:2}],d={toc:i};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently."),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"As always, we will start with defining functionalities of our module."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Check the state - is it paused or not."),(0,r.kt)("li",{parentName:"ol"},"State guards - a contract should stop execution if is in a state we don't expect."),(0,r.kt)("li",{parentName:"ol"},"Switch the state.")),(0,r.kt)("h3",{id:"events-and-error"},"Events and Error"),(0,r.kt)("p",null,"There just two errors that may occur: ",(0,r.kt)("inlineCode",{parentName:"p"},"PausedRequired"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"UnpausedRequired"),". We define them in a standard Odra way."),(0,r.kt)("p",null,"Events definition is highly uncomplicated: ",(0,r.kt)("inlineCode",{parentName:"p"},"Paused")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused")," events holds only the address of the pauser."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::odra_error]\npub enum Error {\n PausedRequired = 1_000,\n UnpausedRequired = 1_001,\n}\n\n#[odra::event]\npub struct Paused {\n pub account: Address\n}\n\n#[odra::event]\npub struct Unpaused {\n pub account: Address\n}\n")),(0,r.kt)("h3",{id:"module-definition"},"Module definition"),(0,r.kt)("p",null,"The module storage is extremely simple - has a single ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," of type bool, that indicates if a contract is paused."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::Var;\n...\n\n#[odra::module(events = [Paused, Unpaused])]\npub struct Pausable {\n is_paused: Var<bool>\n}\n")),(0,r.kt)("h3",{id:"checks-and-guards"},"Checks and guards"),(0,r.kt)("p",null,"Now, let's move to state checks and guards."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn is_paused(&self) -> bool {\n self.is_paused.get_or_default()\n }\n\n pub fn require_not_paused(&self) {\n if self.is_paused() {\n self.env().revert(Error::UnpausedRequired);\n }\n }\n\n pub fn require_paused(&self) {\n if !self.is_paused() {\n self.env().revert(Error::PausedRequired);\n }\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - as mentioned in the intro, the module is not intended to be a standalone contract, so the only ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block is not annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::module")," and hence does not expose any entrypoint."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L2")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused()")," checks the contract state, if the Var ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused")," has not been initialized, the default value (false) is returned."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - to guarantee the code is executed when the contract is not paused, ",(0,r.kt)("inlineCode",{parentName:"li"},"require_not_paused()")," function reads the state and reverts if the contract is paused. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"require_paused()")," is a mirror function - stops the contract execution if the contract is not paused.")),(0,r.kt)("h3",{id:"actions"},"Actions"),(0,r.kt)("p",null,"Finally, we will add the ability to switch the module state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn pause(&mut self) {\n self.require_not_paused();\n self.is_paused.set(true);\n\n self.env().emit_event(Paused {\n account: self.env().caller()\n });\n }\n\n pub fn unpause(&mut self) {\n self.require_paused();\n self.is_paused.set(false);\n\n self.env().emit_event(Unpaused {\n account: self.env().caller()\n });\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"pause()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()")," functions do three things: ensure the contract is the right state (unpaused for ",(0,r.kt)("inlineCode",{parentName:"p"},"pause()"),", not paused for ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()"),"), updates the state, and finally emits events (",(0,r.kt)("inlineCode",{parentName:"p"},"Paused"),"/",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused"),")."),(0,r.kt)("h2",{id:"pausable-counter"},"Pausable counter"),(0,r.kt)("p",null,"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called ",(0,r.kt)("inlineCode",{parentName:"p"},"PausableCounter"),". The contract consists of a Var ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module. The counter can only be incremented if the contract is in a normal state (is not paused)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"...\nuse odra::SubModule;\n...\n\n#[odra::module]\npub struct PausableCounter {\n value: Var<u32>,\n pauseable: SubModule<Pausable>\n}\n\n#[odra::module]\nimpl PausableCounter {\n pub fn increment(&mut self) {\n self.pauseable.require_not_paused();\n\n let new_value = self.value.get_or_default() + 1;\n self.value.set(new_value);\n }\n\n pub fn pause(&mut self) {\n self.pauseable.pause();\n }\n\n pub fn unpause(&mut self) {\n self.pauseable.unpause();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn increment_only_if_unpaused() {\n let test_env = odra_test::env();\n let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);\n contract.increment();\n contract.pause();\n\n assert_eq!(\n contract.try_increment().unwrap_err(),\n Error::UnpausedRequired.into()\n );\n assert_eq!(contract.get_value(), 1);\n }\n}\n")),(0,r.kt)("p",null,"As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a0d3df9d.4b67f1a8.js b/docs/assets/js/a0d3df9d.4b67f1a8.js new file mode 100644 index 000000000..d0110fd1a --- /dev/null +++ b/docs/assets/js/a0d3df9d.4b67f1a8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[3743],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||p[m]||s;return n?r.createElement(v,o(o({ref:t},d),{},{components:n})):r.createElement(v,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=n[l];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},2544:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.3.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.3.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.3.0/basics/events",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"defaultSidebar",previous:{title:"Errors",permalink:"/docs/0.3.0/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.3.0/basics/cross-calls"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Different blockchains implement events in different ways. Odra lets you forget about it by introducing\nOdra Events. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{Event, contract_env};\nuse odra::types::{Address, BlockTime, event::OdraEvent};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract {\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n\n#[odra::module]\nimpl PartyContract {\n #[odra(init)]\n pub fn init(&self) {\n PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n }.emit();\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, we derive an ",(0,a.kt)("inlineCode",{parentName:"p"},"Event")," macro like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n")),(0,a.kt)("p",null,"Among other things, it adds an ",(0,a.kt)("inlineCode",{parentName:"p"},"emit()")," function to the struct, which allows you to emit the event simply\nas that:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n}.emit();\n")),(0,a.kt)("p",null,"Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro and use array-like syntax to list events your module emits. "),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a handy macro ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{assert_events, test_env};\nuse crate::docs::events::PartyStarted;\nuse super::PartyContractDeployer;\n\n#[test]\nfn test_party() {\n let party_contract = PartyContractDeployer::init();\n assert_events!(\n party_contract,\n PartyStarted {\n caller: test_env::get_account(0),\n block_time: 0,\n }\n );\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a33e3bb6.78013d16.js b/docs/assets/js/a33e3bb6.78013d16.js new file mode 100644 index 000000000..185f1fb25 --- /dev/null +++ b/docs/assets/js/a33e3bb6.78013d16.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[27776],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p<o;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},58640:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},i="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.9.1/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.9.1/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.9.1/basics/flipper-internals",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.9.1/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.9.1/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.1/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Var;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Var<bool>,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Var<T>")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the attribute - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The function named ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," is the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," function is optional,\nif your contract does not need any initialization, you can skip it."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Var<T>"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.Deployer.html#tymethod.deploy"},(0,a.kt)("inlineCode",{parentName:"a"},"Deployer::deploy"))," function called on ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperHostRef")," - a piece of code generated\nby the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),". Because the module implements the constructor but does not accept any arguments,\nas the second argument of the deploy function, we pass ",(0,a.kt)("inlineCode",{parentName:"p"},"NoArgs")," - one of the implementations of\nthe ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.InitArgs.html"},(0,a.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait provided with the framework. "),(0,a.kt)("p",null,"The contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a3d6ef01.5926c801.js b/docs/assets/js/a3d6ef01.5926c801.js new file mode 100644 index 000000000..453658986 --- /dev/null +++ b/docs/assets/js/a3d6ef01.5926c801.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76153],{41835:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/next/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/next/basics/native-token"},"next":{"title":"Delegate","permalink":"/docs/next/advanced/delegate"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/a663e775.91628a77.js b/docs/assets/js/a663e775.91628a77.js new file mode 100644 index 000000000..791efa633 --- /dev/null +++ b/docs/assets/js/a663e775.91628a77.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[56317],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c<s;c++)o[c]=n[c];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},35789:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.4.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.4.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.4.0/basics/cross-calls",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.4.0/basics/events"},next:{title:"Modules",permalink:"/docs/0.4.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use odra::Variable;\nuse odra::types::{Address};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Variable<Address>,\n}\n\n#[odra::module]\nimpl CrossContract {\n #[odra(init)]\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap();\n MathEngineRef::at(math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine {\n}\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To call the external contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"MathEngineRef::at(math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/testing"},"Testing")," article.\nIt is a reference to already deployed - running contract.\nHere we are going to take a deeper look at it."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," is generated automatically, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nTo get an instance of a reference, we can either deploy a contract (using ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),") or by building it\ndirectly, using ",(0,r.kt)("inlineCode",{parentName:"p"},"::at(address: Address)")," method, as shown above.\nThe reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), alongside couple methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"at(Address) -> Self")," - points the reference to an Address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"address() -> Address")," - returns the Address the reference is currently pointing at"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"with_tokens(Amount) -> Self")," - attaches Amount of native tokens to the next call")),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderRef")," struct (but do not create the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderDeployer"),"). Having an address we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"AdderRef::at(address).add(3, 5)\n")),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use super::{CrossContractDeployer, MathEngineDeployer};\n\n#[test]\nfn test_cross_calls() {\n let math_engine_contract = MathEngineDeployer::default();\n let cross_contract = CrossContractDeployer::init(math_engine_contract.address());\n\n assert_eq!(cross_contract.add_using_another(), 8);\n}\n")),(0,r.kt)("p",null,"Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function we want to use."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use odra::types::Address;\n use crate::docs::cross_calls::{Adder, AdderRef};\n \n #[test]\n fn test_ext() {\n let adder = AdderRef::at(get_adder_address());\n\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address() -> Address {\n let contract = MathEngineDeployer::default();\n contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a6734805.c4add5cd.js b/docs/assets/js/a6734805.c4add5cd.js new file mode 100644 index 000000000..1de0e669f --- /dev/null +++ b/docs/assets/js/a6734805.c4add5cd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[32947],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=a.createContext({}),p=function(e){var n=a.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=r,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(f,s(s({ref:n},c),{},{components:t})):a.createElement(f,s({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,s=new Array(o);s[0]=d;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var p=2;p<o;p++)s[p]=t[p];return a.createElement.apply(null,s)}return a.createElement.apply(null,t)}d.displayName="MDXCreateElement"},15469:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const o={sidebar_position:3},s="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.3.1/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.3.1/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.3.1/tutorials/erc20",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.3.1/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.3.1/tutorials/owned-token"}},i={},p=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"erc-20"},"ERC-20"),(0,r.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,r.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value. "),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"advanced storage - key-value pairs, "),(0,r.kt)("li",{parentName:"ul"},"Odra types like ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),", "),(0,r.kt)("li",{parentName:"ul"},"advanced events assertion.")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Our module has a pretty complex storage layout in comparison to the previous example."),(0,r.kt)("p",null,"We need to store the following data:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol and decimals."),(0,r.kt)("li",{parentName:"ol"},"Total supply."),(0,r.kt)("li",{parentName:"ol"},"Users' balances."),(0,r.kt)("li",{parentName:"ol"},"Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.")),(0,r.kt)("h2",{id:"module-definition"},"Module definition"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Variable<u8>,\n symbol: Variable<String>,\n name: Variable<String>,\n total_supply: Variable<Balance>,\n balances: Mapping<Address, Balance>,\n allowances: Mapping<Address, Mapping<Address, Balance>>\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,r.kt)("inlineCode",{parentName:"li"},"mapping"),". You may notice the ",(0,r.kt)("inlineCode",{parentName:"li"},"balances")," property maps ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," to ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance"),". If you deal with addresses or you operate on tokens, you should always choose ",(0,r.kt)("inlineCode",{parentName:"li"},"Address")," over ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Odra allows nested ",(0,r.kt)("inlineCode",{parentName:"li"},"Mapping"),"s, what we utilize to store allowances.")),(0,r.kt)("h3",{id:"metadata"},"Metadata"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.balances.add(address, *amount);\n self.total_supply.add(amount);\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: Balance\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3-L10")," - A constructor sets the token metadata and mints the initial supply."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12-L14")," - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," example, we used the ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returning an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<T>"),". If the type implements ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function and the contract does not fail even if the value is not initialized."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29")," - The second ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," is not an odra module, in other words these function will not be a part of contract's ABI."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30-L39")," - Mint function is public, so like in a regular rust code will be accessible from the outside. ",(0,r.kt)("inlineCode",{parentName:"li"},"mint()")," use notation ",(0,r.kt)("inlineCode",{parentName:"li"},"self.balances.add(&address, amount);"),", which it is syntactic sugar for:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"let current_balance = self.balances.get(&address).unwrap_or_default();\nlet new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();\nself.balances.set(&address, new_balance);\n")),(0,r.kt)("h3",{id:"core"},"Core"),(0,r.kt)("p",null,"For the sake of completeness, let's implement the remaining functionalities like ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_from"),", or ",(0,r.kt)("inlineCode",{parentName:"p"},"approve"),". They are not introducing any new concepts, so we leave them without additional remarks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs",title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let spender = contract_env::caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n let owner = contract_env::caller();\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n contract_env::revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .get_instance(owner)\n .set(spender, new_allowance);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 1,\n InsufficientAllowance => 2,\n }\n}\n")),(0,r.kt)("p",null,"Now, compare the code we have written, with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};\n use odra::{assert_events, test_env, types::U256};\n\n pub const NAME: &str = "Plascoin";\n pub const SYMBOL: &str = "PLS";\n pub const DECIMALS: u8 = 10;\n pub const INITIAL_SUPPLY: u32 = 10_000;\n\n pub fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n String::from(NAME),\n String::from(SYMBOL),\n DECIMALS,\n INITIAL_SUPPLY.into()\n )\n }\n\n #[test]\n fn initialization() {\n let erc20 = setup();\n\n assert_eq!(&erc20.symbol(), SYMBOL);\n assert_eq!(&erc20.name(), NAME);\n assert_eq!(erc20.decimals(), DECIMALS);\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n let mut erc20 = setup();\n let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n erc20.transfer(&recipient, &amount);\n\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n assert_eq!(erc20.balance_of(&recipient), amount);\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n let mut erc20 = setup();\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);\n\n test_env::assert_exception(Error::InsufficientBalance, || {\n erc20.transfer(&recipient, &amount)\n });\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let mut erc20 = setup();\n let (owner, recipient, spender) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount\n }\n );\n\n // Spender transfers tokens from Owner to Recipient.\n test_env::set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n );\n \n assert_events!(erc20, Approval, Transfer);\n }\n\n #[test]\n fn transfer_from_error() {\n let mut erc20 = setup();\n let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));\n let amount = 1_000.into();\n\n test_env::set_caller(spender);\n test_env::assert_exception(Error::InsufficientAllowance, || {\n erc20.transfer_from(&owner, &spender, &amount)\n });\n }\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L111-123")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events!()")," macro accepts multiple events. You must pass them in the order they were emitted. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L125")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"You can not mix both approaches, you pass full events or types only.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"Having two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a6aa9e1f.c52e9195.js b/docs/assets/js/a6aa9e1f.c52e9195.js new file mode 100644 index 000000000..a8d3de6d0 --- /dev/null +++ b/docs/assets/js/a6aa9e1f.c52e9195.js @@ -0,0 +1 @@ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[93089],{39058:(e,t,a)=>{"use strict";a.d(t,{Z:()=>v});var s=a(67294),n=a(86010),l=a(12684),r=a(87524),o=a(39960),i=a(95999);const m="sidebar_re4s",c="sidebarItemTitle_pO2u",u="sidebarItemList_Yudw",d="sidebarItem__DBe",g="sidebarItemLink_mo7H",j="sidebarItemLinkActive_I1ZP";function p(e){let{sidebar:t}=e;return s.createElement("aside",{className:"col col--3"},s.createElement("nav",{className:(0,n.Z)(m,"thin-scrollbar"),"aria-label":(0,i.I)({id:"theme.blog.sidebar.navAriaLabel",message:"Blog recent posts navigation",description:"The ARIA label for recent posts in the blog sidebar"})},s.createElement("div",{className:(0,n.Z)(c,"margin-bottom--md")},t.title),s.createElement("ul",{className:(0,n.Z)(u,"clean-list")},t.items.map((e=>s.createElement("li",{key:e.permalink,className:d},s.createElement(o.Z,{isNavLink:!0,to:e.permalink,className:g,activeClassName:j},e.title)))))))}var h=a(13102);function b(e){let{sidebar:t}=e;return s.createElement("ul",{className:"menu__list"},t.items.map((e=>s.createElement("li",{key:e.permalink,className:"menu__list-item"},s.createElement(o.Z,{isNavLink:!0,to:e.permalink,className:"menu__link",activeClassName:"menu__link--active"},e.title)))))}function f(e){return s.createElement(h.Zo,{component:b,props:e})}function E(e){let{sidebar:t}=e;const a=(0,r.i)();return t?.items.length?"mobile"===a?s.createElement(f,{sidebar:t}):s.createElement(p,{sidebar:t}):null}function v(e){const{sidebar:t,toc:a,children:r,...o}=e,i=t&&t.items.length>0;return s.createElement(l.Z,o,s.createElement("div",{className:"container margin-vert--lg"},s.createElement("div",{className:"row"},s.createElement(E,{sidebar:t}),s.createElement("main",{className:(0,n.Z)("col",{"col--7":i,"col--9 col--offset-1":!i}),itemScope:!0,itemType:"http://schema.org/Blog"},r),a&&s.createElement("div",{className:"col col--2"},a))))}},93269:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>f});var s=a(67294),n=a(86010),l=a(52263),r=a(1944),o=a(35281),i=a(39058),m=a(95999),c=a(32244);function u(e){const{metadata:t}=e,{previousPage:a,nextPage:n}=t;return s.createElement("nav",{className:"pagination-nav","aria-label":(0,m.I)({id:"theme.blog.paginator.navAriaLabel",message:"Blog list page navigation",description:"The ARIA label for the blog pagination"})},a&&s.createElement(c.Z,{permalink:a,title:s.createElement(m.Z,{id:"theme.blog.paginator.newerEntries",description:"The label used to navigate to the newer blog posts page (previous page)"},"Newer Entries")}),n&&s.createElement(c.Z,{permalink:n,title:s.createElement(m.Z,{id:"theme.blog.paginator.olderEntries",description:"The label used to navigate to the older blog posts page (next page)"},"Older Entries"),isNext:!0}))}var d=a(90197),g=a(9460),j=a(63496);function p(e){let{items:t,component:a=j.Z}=e;return s.createElement(s.Fragment,null,t.map((e=>{let{content:t}=e;return s.createElement(g.n,{key:t.metadata.permalink,content:t},s.createElement(a,null,s.createElement(t,null)))})))}function h(e){const{metadata:t}=e,{siteConfig:{title:a}}=(0,l.Z)(),{blogDescription:n,blogTitle:o,permalink:i}=t,m="/"===i?a:o;return s.createElement(s.Fragment,null,s.createElement(r.d,{title:m,description:n}),s.createElement(d.Z,{tag:"blog_posts_list"}))}function b(e){const{metadata:t,items:a,sidebar:n}=e;return s.createElement(i.Z,{sidebar:n},s.createElement(p,{items:a}),s.createElement(u,{metadata:t}))}function f(e){return s.createElement(r.FG,{className:(0,n.Z)(o.k.wrapper.blogPages,o.k.page.blogListPage)},s.createElement(h,e),s.createElement(b,e))}},63496:(e,t,a)=>{"use strict";a.d(t,{Z:()=>O});var s=a(67294),n=a(86010),l=a(9460),r=a(44996);function o(e){let{children:t,className:a}=e;const{frontMatter:n,assets:o}=(0,l.C)(),{withBaseUrl:i}=(0,r.C)(),m=o.image??n.image;return s.createElement("article",{className:a,itemProp:"blogPost",itemScope:!0,itemType:"http://schema.org/BlogPosting"},m&&s.createElement("meta",{itemProp:"image",content:i(m,{absolute:!0})}),t)}var i=a(39960);const m="title_f1Hy";function c(e){let{className:t}=e;const{metadata:a,isBlogPostPage:r}=(0,l.C)(),{permalink:o,title:c}=a,u=r?"h1":"h2";return s.createElement(u,{className:(0,n.Z)(m,t),itemProp:"headline"},r?c:s.createElement(i.Z,{itemProp:"url",to:o},c))}var u=a(95999),d=a(52263);const g=["zero","one","two","few","many","other"];function j(e){return g.filter((t=>e.includes(t)))}const p={locale:"en",pluralForms:j(["one","other"]),select:e=>1===e?"one":"other"};function h(){const{i18n:{currentLocale:e}}=(0,d.Z)();return(0,s.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:j(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),p}}),[e])}function b(){const e=h();return{selectMessage:(t,a)=>function(e,t,a){const s=e.split("|");if(1===s.length)return s[0];s.length>a.pluralForms.length&&console.error(`For locale=${a.locale}, a maximum of ${a.pluralForms.length} plural forms are expected (${a.pluralForms.join(",")}), but the message contains ${s.length}: ${e}`);const n=a.select(t),l=a.pluralForms.indexOf(n);return s[Math.min(l,s.length-1)]}(a,t,e)}}const f="container_mt6G";function E(e){let{readingTime:t}=e;const a=function(){const{selectMessage:e}=b();return t=>{const a=Math.ceil(t);return e(a,(0,u.I)({id:"theme.blog.post.readingTime.plurals",description:'Pluralized label for "{readingTime} min read". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One min read|{readingTime} min read"},{readingTime:a}))}}();return s.createElement(s.Fragment,null,a(t))}function v(e){let{date:t,formattedDate:a}=e;return s.createElement("time",{dateTime:t,itemProp:"datePublished"},a)}function k(){return s.createElement(s.Fragment,null," \xb7 ")}function N(e){let{className:t}=e;const{metadata:a}=(0,l.C)(),{date:r,formattedDate:o,readingTime:i}=a;return s.createElement("div",{className:(0,n.Z)(f,"margin-vert--md",t)},s.createElement(v,{date:r,formattedDate:o}),void 0!==i&&s.createElement(s.Fragment,null,s.createElement(k,null),s.createElement(E,{readingTime:i})))}function P(e){return e.href?s.createElement(i.Z,e):s.createElement(s.Fragment,null,e.children)}function Z(e){let{author:t,className:a}=e;const{name:l,title:r,url:o,imageURL:i,email:m}=t,c=o||m&&`mailto:${m}`||void 0;return s.createElement("div",{className:(0,n.Z)("avatar margin-bottom--sm",a)},i&&s.createElement(P,{href:c,className:"avatar__photo-link"},s.createElement("img",{className:"avatar__photo",src:i,alt:l})),l&&s.createElement("div",{className:"avatar__intro",itemProp:"author",itemScope:!0,itemType:"https://schema.org/Person"},s.createElement("div",{className:"avatar__name"},s.createElement(P,{href:c,itemProp:"url"},s.createElement("span",{itemProp:"name"},l))),r&&s.createElement("small",{className:"avatar__subtitle",itemProp:"description"},r)))}const _="authorCol_q4o9",y="imageOnlyAuthorRow_lXe7",w="imageOnlyAuthorCol_cxD5";function z(e){let{className:t}=e;const{metadata:{authors:a},assets:r}=(0,l.C)();if(0===a.length)return null;const o=a.every((e=>{let{name:t}=e;return!t}));return s.createElement("div",{className:(0,n.Z)("margin-top--md margin-bottom--sm",o?y:"row",t)},a.map(((e,t)=>s.createElement("div",{className:(0,n.Z)(!o&&"col col--4",o?w:_),key:t},s.createElement(Z,{author:{...e,imageURL:r.authorsImageUrls[t]??e.imageURL}})))))}function T(){return s.createElement("header",null,s.createElement(c,null),s.createElement(N,null),s.createElement(z,null))}var C=a(18780),x=a(88905);function F(e){let{children:t,className:a}=e;const{isBlogPostPage:r}=(0,l.C)();return s.createElement("div",{id:r?C.blogPostContainerID:void 0,className:(0,n.Z)("markdown",a),itemProp:"articleBody"},s.createElement(x.Z,null,t))}var I=a(84881),B=a(86233),L=a(87462);function M(){return s.createElement("b",null,s.createElement(u.Z,{id:"theme.blog.post.readMore",description:"The label used in blog post item excerpts to link to full blog posts"},"Read More"))}function R(e){const{blogPostTitle:t,...a}=e;return s.createElement(i.Z,(0,L.Z)({"aria-label":(0,u.I)({message:"Read more about {title}",id:"theme.blog.post.readMoreLabel",description:"The ARIA label for the link to full blog posts from excerpts"},{title:t})},a),s.createElement(M,null))}const A="blogPostFooterDetailsFull_mRVl";function D(){const{metadata:e,isBlogPostPage:t}=(0,l.C)(),{tags:a,title:r,editUrl:o,hasTruncateMarker:i}=e,m=!t&&i,c=a.length>0;return c||m||o?s.createElement("footer",{className:(0,n.Z)("row docusaurus-mt-lg",t&&A)},c&&s.createElement("div",{className:(0,n.Z)("col",{"col--9":m})},s.createElement(B.Z,{tags:a})),t&&o&&s.createElement("div",{className:"col margin-top--sm"},s.createElement(I.Z,{editUrl:o})),m&&s.createElement("div",{className:(0,n.Z)("col text--right",{"col--3":c})},s.createElement(R,{blogPostTitle:r,to:e.permalink}))):null}function O(e){let{children:t,className:a}=e;const r=function(){const{isBlogPostPage:e}=(0,l.C)();return e?void 0:"margin-bottom--xl"}();return s.createElement(o,{className:(0,n.Z)(r,a)},s.createElement(T,null),s.createElement(F,null,t),s.createElement(D,null))}},9460:(e,t,a)=>{"use strict";a.d(t,{C:()=>o,n:()=>r});var s=a(67294),n=a(902);const l=s.createContext(null);function r(e){let{children:t,content:a,isBlogPostPage:n=!1}=e;const r=function(e){let{content:t,isBlogPostPage:a}=e;return(0,s.useMemo)((()=>({metadata:t.metadata,frontMatter:t.frontMatter,assets:t.assets,toc:t.toc,isBlogPostPage:a})),[t,a])}({content:a,isBlogPostPage:n});return s.createElement(l.Provider,{value:r},t)}function o(){const e=(0,s.useContext)(l);if(null===e)throw new n.i6("BlogPostProvider");return e}},46700:(e,t,a)=>{var s={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function n(e){var t=l(e);return a(t)}function l(e){if(!a.o(s,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return s[e]}n.keys=function(){return Object.keys(s)},n.resolve=l,e.exports=n,n.id=46700}}]); \ No newline at end of file diff --git a/docs/assets/js/a6f6e2b9.72124867.js b/docs/assets/js/a6f6e2b9.72124867.js new file mode 100644 index 000000000..51700811d --- /dev/null +++ b/docs/assets/js/a6f6e2b9.72124867.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67093],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=c(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||s[f]||a;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c<a;c++)i[c]=r[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},32193:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>s,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={slug:"release-020",title:"Odra 0.2.0 Released",authors:["kubaplas","kpob","zie1ony"],image:"https://github.com/odradev.png"},i=void 0,l={permalink:"/blog/release-020",source:"@site/blog/2022-11-30-release-020/index.md",title:"Odra 0.2.0 Released",description:"We want to introduce you to the very first public release of the Odra Framework proudly!",date:"2022-11-30T00:00:00.000Z",formattedDate:"November 30, 2022",tags:[],readingTime:3.07,hasTruncateMarker:!0,authors:[{name:"Kuba P\u0142askonka",title:"Lead Developer",url:"https://github.com/kubaplas",key:"kubaplas"},{name:"Krzysztof Pobiar\u017cyn",title:"Lead Developer",url:"https://github.com/kpob",key:"kpob"},{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"release-020",title:"Odra 0.2.0 Released",authors:["kubaplas","kpob","zie1ony"],image:"https://github.com/odradev.png"},prevItem:{title:"Zero Knowledge on Casper",permalink:"/blog/casper-zk-risc0"}},p={authorsImageUrls:[void 0,void 0,void 0]},c=[],u={toc:c};function s(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"We want to introduce you to the very first public release of the Odra Framework proudly!"))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a7794a1d.52f07ecd.js b/docs/assets/js/a7794a1d.52f07ecd.js new file mode 100644 index 000000000..7c53c722b --- /dev/null +++ b/docs/assets/js/a7794a1d.52f07ecd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[88993],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function l(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){o(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}))}return e}function s(e,n){if(null==e)return{};var r,t,o=function(e,n){if(null==e)return{};var r,t,o={},a=Object.keys(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=t.createContext({}),d=function(e){var n=t.useContext(i),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},p=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=d(r),m=o,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||a;return r?t.createElement(f,l(l({ref:n},c),{},{components:r})):t.createElement(f,l({ref:n},c))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=p;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var d=2;d<a;d++)l[d]=r[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,r)}p.displayName="MDXCreateElement"},98913:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var t=r(87462),o=(r(67294),r(3905));const a={sidebar_position:4},l="Access Control",s={unversionedId:"tutorials/access-control",id:"version-1.0.0/tutorials/access-control",title:"Access Control",description:"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,",source:"@site/versioned_docs/version-1.0.0/tutorials/access-control.md",sourceDirName:"tutorials",slug:"/tutorials/access-control",permalink:"/docs/tutorials/access-control",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"OwnedToken",permalink:"/docs/tutorials/owned-token"},next:{title:"Pausable",permalink:"/docs/tutorials/pauseable"}},i={},d=[{value:"Code",id:"code",level:2},{value:"Project Structure",id:"project-structure",level:3},{value:"Events and Errors",id:"events-and-errors",level:3},{value:"Module",id:"module",level:3}],c={toc:d};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"access-control"},"Access Control"),(0,o.kt)("p",null,"In a previous tutorial, we introduced the ",(0,o.kt)("a",{parentName:"p",href:"/docs/tutorials/ownable"},(0,o.kt)("inlineCode",{parentName:"a"},"Ownable"))," module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient, "),(0,o.kt)("p",null,"In this article we design and implement a more fine-grained access control layer."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"Before we start writing code, we list the functionalities of our access control layer."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type is used across the module."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be assigned to many ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es."),(0,o.kt)("li",{parentName:"ol"},"Each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," may have a corresponding admin role."),(0,o.kt)("li",{parentName:"ol"},"Only an admin can grant/revoke a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),"."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be renounced."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," cannot be renounced on someone's behalf."),(0,o.kt)("li",{parentName:"ol"},"Each action triggers an event."),(0,o.kt)("li",{parentName:"ol"},"Unauthorized access stops contract execution.")),(0,o.kt)("h3",{id:"project-structure"},"Project Structure"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-plaintext"},"access-control\n\u251c\u2500\u2500 src\n\u2502 \u251c\u2500\u2500 access\n\u2502 \u2502 \u251c\u2500\u2500 access_control.rs\n\u2502 \u2502 \u251c\u2500\u2500 events.rs\n\u2502 \u2502 \u2514\u2500\u2500 errors.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n|\u2500\u2500 build.rs\n|\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 Odra.toml\n")),(0,o.kt)("h3",{id:"events-and-errors"},"Events and Errors"),(0,o.kt)("p",null,"There are three actions that can be performed concerning a ",(0,o.kt)("inlineCode",{parentName:"p"},"Role"),": granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=events.rs showLineNumbers",title:"events.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\nuse super::access_control::Role;\n\n#[odra::event]\npub struct RoleGranted {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleRevoked {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleAdminChanged {\n pub role: Role,\n pub previous_admin_role: Role,\n pub new_admin_role: Role\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L5-L17")," - to describe the grant or revoke actions, our events specify the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", and ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es indicating who receives or loses access and who provides or withdraws it."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L19-L24")," - the event describing the admin role change, requires the subject ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", the previous and the current admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=errors.rs",title:"errors.rs"},"#[odra::odra_error]\npub enum Error {\n MissingRole = 20_000,\n RoleRenounceForAnotherAddress = 20_001,\n}\n")),(0,o.kt)("p",null,"Errors definition is straightforward - there are only two invalid states: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"An action is triggered by an unauthorized actor."),(0,o.kt)("li",{parentName:"ol"},"The caller is attempting to resign the Role on someone's behalf. ")),(0,o.kt)("h3",{id:"module"},"Module"),(0,o.kt)("p",null,"Now, we are stepping into the most interesting part: the module definition and implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=access_control.rs showLineNumbers",title:"access_control.rs",showLineNumbers:!0},"use super::events::*;\nuse super::errors::Error;\nuse odra::prelude::*;\nuse odra::{Address, Mapping};\n\npub type Role = [u8; 32];\n\npub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];\n\n#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]\npub struct AccessControl {\n roles: Mapping<(Role, Address), bool>,\n role_admin: Mapping<Role, Role>\n}\n\n#[odra::module]\nimpl AccessControl {\n pub fn has_role(&self, role: &Role, address: &Address) -> bool {\n self.roles.get_or_default(&(*role, *address))\n }\n\n pub fn get_role_admin(&self, role: &Role) -> Role {\n let admin_role = self.role_admin.get(role);\n if let Some(admin) = admin_role {\n admin\n } else {\n DEFAULT_ADMIN_ROLE\n }\n }\n\n pub fn grant_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_grant_role(role, address);\n }\n\n pub fn revoke_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_revoke_role(role, address);\n }\n\n pub fn renounce_role(&mut self, role: &Role, address: &Address) {\n if address != &self.env().caller() {\n self.env().revert(Error::RoleRenounceForAnotherAddress);\n }\n self.unchecked_revoke_role(role, address);\n }\n}\n\nimpl AccessControl {\n pub fn check_role(&self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.env().revert(Error::MissingRole);\n }\n }\n\n pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {\n let previous_admin_role = self.get_role_admin(role);\n self.role_admin.set(role, *admin_role);\n self.env().emit_event(RoleAdminChanged {\n role: *role,\n previous_admin_role,\n new_admin_role: *admin_role\n });\n }\n\n pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.roles.set(&(*role, *address), true);\n self.env().emit_event(RoleGranted {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n\n pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {\n if self.has_role(role, address) {\n self.roles.set(&(*role, *address), false);\n self.env().emit_event(RoleRevoked {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L6")," - Firstly, we need the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type. It is simply an alias for a 32-byte array."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L8")," - The default role is an array filled with zeros."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L13")," - The storage consists of two mappings:")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"roles")," - a nested mapping that stores information about whether a certain Role is granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"role_admin")," - each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can have a single admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L18-L20")," - This is a simple check to determine if a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," has been granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),". It is an exposed entry point and an important building block widely used throughout the entire module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49")," - This is a non-exported block containing helper functions."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L54")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," function serves as a guard function. Before a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with ",(0,o.kt)("inlineCode",{parentName:"li"},"Error::MissingRole"),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L56-L64")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"set_admin_role()")," function simply updates the role_admin mapping and emits the ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleAdminChanged")," event."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L66-L86")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_revoke_role()")," functions are mirror functions that update the roles mapping and post ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleGranted")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleRevoked")," events. If the role is already granted, ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," has no effect (the opposite check is made in the case of revoking a role)."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L22-L29")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"get_role_admin()")," entry point reads the role_admin. If there is no admin role for a given role, it returns the default role."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L31-L46")," - This is a combination of ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_*_role()"),". Entry points fail on unauthorized access.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a809f3b7.357785a7.js b/docs/assets/js/a809f3b7.357785a7.js new file mode 100644 index 000000000..33b4d3659 --- /dev/null +++ b/docs/assets/js/a809f3b7.357785a7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33146],{43450:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.8.1/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.8.1/"},"next":{"title":"Installation","permalink":"/docs/0.8.1/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/a88260b3.3908f049.js b/docs/assets/js/a88260b3.3908f049.js new file mode 100644 index 000000000..07db71599 --- /dev/null +++ b/docs/assets/js/a88260b3.3908f049.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[75176],{49449:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.3.1/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.3.1/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.3.1/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/a892851d.7fbd0068.js b/docs/assets/js/a892851d.7fbd0068.js new file mode 100644 index 000000000..72f8d7c6d --- /dev/null +++ b/docs/assets/js/a892851d.7fbd0068.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[55046],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 l(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 i(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 s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return a?n.createElement(g,l(l({ref:t},c),{},{components:a})):n.createElement(g,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var p=2;p<o;p++)l[p]=a[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"},67036:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.8.1/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.8.1/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.8.1/getting-started/installation",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.8.1/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.8.1/getting-started/flipper"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-unknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --locked\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,r.kt)("p",null,"This will create a new folder called ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," and initialize Odra there. Cargo Odra\nwill create a sample contract for you in ",(0,r.kt)("inlineCode",{parentName:"p"},"src")," directory. You can run the tests of this contract\nby executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/a98f838e.1d40bbf8.js b/docs/assets/js/a98f838e.1d40bbf8.js new file mode 100644 index 000000000..edb834582 --- /dev/null +++ b/docs/assets/js/a98f838e.1d40bbf8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[98651],{26665:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.8.0/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.8.0/basics/native-token"},"next":{"title":"Delegate","permalink":"/docs/0.8.0/advanced/delegate"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/aaadf060.9572af8a.js b/docs/assets/js/aaadf060.9572af8a.js new file mode 100644 index 000000000..de226438b --- /dev/null +++ b/docs/assets/js/aaadf060.9572af8a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[64318],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},15470:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"version-0.5.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.5.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.5.0/basics/cargo-odra",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.5.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.5.0/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Updating dependencies",id:"updating-dependencies",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them on multiple backends (blockchains)."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands will help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This will create a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it will create a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This will create a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It will run your tests against Odra's MockVM. It is substantially faster than virtual machines\nprovided by blockchains developers and implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files,\nspin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat.\nKeep in mind that this is a lot slower than MockVM and you cannot use the debugger.\nThis is why MockVM was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("p",null,"Where ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," is the name of the backend we are using in this example. If the build process\nfinishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder."),(0,r.kt)("h2",{id:"updating-dependencies"},"Updating dependencies"),(0,r.kt)("p",null,"You will learn later, that the project using Odra contains more than one Rust project - your own and\none or more builders. To run ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo update")," on all of them at once instead of traversing all the folders\nyou can use this command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra update\n")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ab4716a0.2806994c.js b/docs/assets/js/ab4716a0.2806994c.js new file mode 100644 index 000000000..dc67950bb --- /dev/null +++ b/docs/assets/js/ab4716a0.2806994c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12933],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},71550:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},o="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.5.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.5.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.5.0/basics/flipper-internals",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.5.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.5.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.5.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Variable;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Variables and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Variable<bool>,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," macro marks the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperDeployer")," - a piece of code generated automatically thanks to the macros.\nThe contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ab49860c.44c0ae6b.js b/docs/assets/js/ab49860c.44c0ae6b.js new file mode 100644 index 000000000..b8767f160 --- /dev/null +++ b/docs/assets/js/ab49860c.44c0ae6b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95211],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(n),d=o,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},34584:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.4.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.4.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.4.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.4.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.4.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],p={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/host.rs"',title:'"examples/src/docs/host.rs"'},"use odra::Variable;\nuse odra::types::{BlockTime, Address};\n\n#[odra::module]\npub struct HostContract {\n name: Variable<String>,\n created_at: Variable<BlockTime>,\n created_by: Variable<Address>,\n}\n\n#[odra::module]\nimpl HostContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(odra::contract_env::get_block_time());\n self.created_by.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are calling functions from ",(0,o.kt)("inlineCode",{parentName:"p"},"odra::contract_env"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"get_block_time()")," will return\nthe current block time wrapped in Odra type ",(0,o.kt)("inlineCode",{parentName:"p"},"BlockTime"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"caller()")," will return an Odra ",(0,o.kt)("inlineCode",{parentName:"p"},"Address")," of\na caller (this can be an external caller or another contract)."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ac692f92.136ee2fc.js b/docs/assets/js/ac692f92.136ee2fc.js new file mode 100644 index 000000000..25a50be38 --- /dev/null +++ b/docs/assets/js/ac692f92.136ee2fc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46539],{30577:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/next/category/backends","navigation":{"previous":{"title":"Building contracts manually","permalink":"/docs/next/advanced/building-manually"},"next":{"title":"What is a backend?","permalink":"/docs/next/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/acbba37b.61073794.js b/docs/assets/js/acbba37b.61073794.js new file mode 100644 index 000000000..187897ea4 --- /dev/null +++ b/docs/assets/js/acbba37b.61073794.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[77715],{96687:e=>{e.exports=JSON.parse('{"title":"Migrations","description":"How to keep your code in sync with the latest version of the Odra Framework.","slug":"/category/migrations","permalink":"/docs/0.8.0/category/migrations","navigation":{"previous":{"title":"Build, Deploy and Read the State of a Contract","permalink":"/docs/0.8.0/tutorials/build-deploy-read"},"next":{"title":"Migration guide to v0.8.0","permalink":"/docs/0.8.0/migrations/to-0.8.0"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/acebe248.7b1cfaa9.js b/docs/assets/js/acebe248.7b1cfaa9.js new file mode 100644 index 000000000..88ab461c0 --- /dev/null +++ b/docs/assets/js/acebe248.7b1cfaa9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46393],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||s;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p<s;p++)i[p]=n[p];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},70411:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.4.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.4.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.4.0/basics/storage-interaction",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.4.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.4.0/basics/communicating-with-host"}},l={},p=[{value:"Variable",id:"variable",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"variable"},"Variable"),(0,r.kt)("p",null,"The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Variable<bool>,\n weight: Variable<u32>,\n name: Variable<String>,\n walks: Variable<Vec<u32>>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"use odra::Variable;\n\n#[odra::module]\nimpl DogContract {\n #[odra(init)]\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::<u32>::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A Variable is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses Mapping to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"use odra::{Mapping, Variable};\n\n#[odra::module]\npub struct DogContract2 {\n name: Variable<String>,\n friends: Mapping<String, u32>,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a Mapping we use a similar approach\nto the one shown in the Variables section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Variable working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{Variable, List};\n\npub struct List<T> {\n values: Mapping<u32, T>,\n index: Variable<u32>\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Variable<String>,\n walks: List<u32>,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/docs/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option<Address>\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ad92572d.51cc1d95.js b/docs/assets/js/ad92572d.51cc1d95.js new file mode 100644 index 000000000..3da8094ac --- /dev/null +++ b/docs/assets/js/ad92572d.51cc1d95.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[10242],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,m=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},96867:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.5.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.5.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.5.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.5.0/category/backends"},next:{title:"MockVM",permalink:"/docs/0.5.0/backends/mock-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Test Env",id:"test-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/backends/mock-vm"},"MockVM"),",\nor a complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/backends/casper"},"CasperVM"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/aee91c2e.70832445.js b/docs/assets/js/aee91c2e.70832445.js new file mode 100644 index 000000000..df0127646 --- /dev/null +++ b/docs/assets/js/aee91c2e.70832445.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[23073],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var d=2;d<o;d++)i[d]=n[d];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},17118:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="OdraVM",c={unversionedId:"backends/odra-vm",id:"backends/odra-vm",title:"OdraVM",description:"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/docs/backends/02-odra-vm.md",sourceDirName:"backends",slug:"/backends/odra-vm",permalink:"/docs/next/backends/odra-vm",draft:!1,tags:[],version:"current",lastUpdatedAt:1711379330,formattedLastUpdatedAt:"Mar 25, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/next/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/next/backends/casper"}},s={},d=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],l={toc:d};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odravm"},"OdraVM"),(0,a.kt)("p",null,"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time -\nsimply use your IDE's debug functionality."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The OdraVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"OdraVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is a list of contracts deployed onto the OdraVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the OdraVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe OdraVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the OdraVM.\nThanks to this and the fact that we do not need the blockchain itself,\nOdraVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the OdraVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Container"),".\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, OdraVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(OdraVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/af2a4ce0.b8a4062a.js b/docs/assets/js/af2a4ce0.b8a4062a.js new file mode 100644 index 000000000..489b4c530 --- /dev/null +++ b/docs/assets/js/af2a4ce0.b8a4062a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63376],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},d),{},{components:r})):n.createElement(f,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c<o;c++)i[c]=r[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},15008:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.6.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.6.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.6.0/basics/directory-structure",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.6.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.6.0/basics/odra-toml"}},s={},c=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:".builder_* folders",id:"builder_-folders",level:2},{value:"src/",id:"src",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 .builder_casper/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. We are using two features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/mock-vm")," - it is responsible for running tests on Odra's MockVM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/casper")," - backend implementation of Casper blockchain\nMore backends will be released as features that will be possible to enable here.")),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"builder_-folders"},".builder_* folders"),(0,a.kt)("p",null,"Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary\nfor building wasm files and running them against blockchain VMs. As it is not necessary to modify\nfiles in those folders in any way, by default they are hidden (hence the ",(0,a.kt)("inlineCode",{parentName:"p"},".")," at the beginning of the\nfolder name)."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain of your choosing."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/afc3a23f.02141f3c.js b/docs/assets/js/afc3a23f.02141f3c.js new file mode 100644 index 000000000..9ae39ab03 --- /dev/null +++ b/docs/assets/js/afc3a23f.02141f3c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40996],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},1883:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"version-0.7.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.7.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.7.0/basics/cargo-odra",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.7.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.7.0/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Updating dependencies",id:"updating-dependencies",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them on multiple backends (blockchains)."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands will help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This will create a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it will create a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This will create a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.7.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It will run your tests against Odra's MockVM. It is substantially faster than virtual machines\nprovided by blockchains developers and implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files,\nspin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat.\nKeep in mind that this is a lot slower than MockVM and you cannot use the debugger.\nThis is why MockVM was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("p",null,"Where ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," is the name of the backend we are using in this example. If the build process\nfinishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder."),(0,r.kt)("h2",{id:"updating-dependencies"},"Updating dependencies"),(0,r.kt)("p",null,"You will learn later, that the project using Odra contains more than one Rust project - your own and\none or more builders. To run ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo update")," on all of them at once instead of traversing all the folders\nyou can use this command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra update\n")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b0f6aa87.8f7ef603.js b/docs/assets/js/b0f6aa87.8f7ef603.js new file mode 100644 index 000000000..d1ea2c116 --- /dev/null +++ b/docs/assets/js/b0f6aa87.8f7ef603.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[78584],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(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 i(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 l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p<o;p++)s[p]=a[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},69182:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.4.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.4.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.4.0/backends/casper",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"MockVM",permalink:"/docs/0.4.0/backends/mock-vm"},next:{title:"Examples",permalink:"/docs/0.4.0/category/examples"}},l={},p=[{value:"Types",id:"types",level:2},{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Constructors",id:"constructors",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Example usage",id:"example-usage",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"types"},"Types"),(0,r.kt)("p",null,"A struct to be written into the storage must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait OdraType: \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("p",null,"The other exposed types are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CallArgs")," - wraps around casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"RuntimeArgs")),";"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," - U512 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"BlockTime")," - u64 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Address")," - an enum that encapsulates casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/account/struct.AccountHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"AccountHash"))," and ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/struct.ContractPackageHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractPackageHash")))),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"SerializableEvent")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait SerializableEvent: \n odra_types::event::OdraEvent + \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance, you call ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_balance"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("p",null,"Let's define a basic Odra module that includes a constructor:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\nstruct Counter {\n value: Variable<u32>\n}\n\n#[odra::module]\nimpl Counter {\n #[odra(init)]\n pub initialize(&mut self, value: u32) {\n self.value.set(value);\n }\n}\n")),(0,r.kt)("p",null,"Read more about constructors ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/advanced/attributes#init"},"here"),"."),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you have to specify following arguments."),(0,r.kt)("p",null,"Required arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Optional arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. If the contract has the constructor entry point marked with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]"),", this should be set to the constructor name."),(0,r.kt)("li",{parentName:"ul"},"constructor arguments that match entry point set in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor"),".")),(0,r.kt)("h3",{id:"example-usage"},"Example usage"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "odra_cfg_constructor:string:\'initialize\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.4.0/odra-casper/livenet/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<U512>")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.4.0/backends/mock-vm"},"MockVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b241ea99.ff10f529.js b/docs/assets/js/b241ea99.ff10f529.js new file mode 100644 index 000000000..a32da0e7b --- /dev/null +++ b/docs/assets/js/b241ea99.ff10f529.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74230],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(t),m=o,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u<a;u++)l[u]=t[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}p.displayName="MDXCreateElement"},16017:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.3.1/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.3.1/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.3.1/tutorials/owned-token",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.3.1/tutorials/erc20"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function c(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow minting tokens but only the module owner."),(0,o.kt)("li",{parentName:"ol"},"The current owner should be able to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use odra::types::{Address, Balance}\n\n...\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.ownable.ensure_ownership(&contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L11")," - A constructor is a great place to init both modules at once. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L14-L16")," - Most of the entrypoints do not need any modification, so we simply delegates them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L52")," - The same we do with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L58-L61")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b25a9e84.0219d75f.js b/docs/assets/js/b25a9e84.0219d75f.js new file mode 100644 index 000000000..ef86f3e64 --- /dev/null +++ b/docs/assets/js/b25a9e84.0219d75f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[53644],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(t),m=a,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},c),{},{components:t})):r.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=u;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var d=2;d<s;d++)o[d]=t[d];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}u.displayName="MDXCreateElement"},13175:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const s={sidebar_position:3},o="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.9.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.9.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.9.0/tutorials/erc20",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.9.0/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.9.0/tutorials/owned-token"}},i={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:d};function p(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"erc-20"},"ERC-20"),(0,a.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,a.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,a.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value."),(0,a.kt)("h2",{id:"framework-features"},"Framework features"),(0,a.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Advanced storage using key-value pairs,"),(0,a.kt)("li",{parentName:"ul"},"Odra types such as ",(0,a.kt)("inlineCode",{parentName:"li"},"Address"),","),(0,a.kt)("li",{parentName:"ul"},"Advanced event assertion.")),(0,a.kt)("h2",{id:"code"},"Code"),(0,a.kt)("p",null,"Our module features a considerably more complex storage layout compared to the previous example. "),(0,a.kt)("p",null,"It is designed to store the following data:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol, and decimals."),(0,a.kt)("li",{parentName:"ol"},"Total supply."),(0,a.kt)("li",{parentName:"ol"},"Balances of individual users."),(0,a.kt)("li",{parentName:"ol"},"Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.")),(0,a.kt)("h2",{id:"module-definition"},"Module definition"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Mapping, Var};\n\n#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,a.kt)("inlineCode",{parentName:"li"},"mapping"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L11")," - Odra does not allows nested ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),"s as Solidity does. Instead, you can create a compound key using a tuple of keys.")),(0,a.kt)("h3",{id:"metadata"},"Metadata"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let caller = self.env().caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, &initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.balances.add(address, *amount);\n self.total_supply.add(*amount);\n \n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n}\n\n#[odra::event]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L3-L9")," - A constructor sets the token metadata and mints the initial supply."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L28")," - The second ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," is not an Odra module; in other words, these functions will not be part of the contract's public interface."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L29-L38")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"mint")," function is public, so, like in regular Rust code, it will be accessible from the outside. ",(0,a.kt)("inlineCode",{parentName:"li"},"mint()")," uses the notation ",(0,a.kt)("inlineCode",{parentName:"li"},"self.balances.add(address, *amount);"),", which is syntactic sugar for:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::UnwrapOrRevert;\n\nlet current_balance = self.balances.get(address).unwrap_or_default();\nlet new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());\nself.balances.set(address, new_balance);\n")),(0,a.kt)("h3",{id:"core"},"Core"),(0,a.kt)("p",null,"To ensure comprehensive functionality, let's implement the remaining features such as ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer_from"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"approve"),". Since they do not introduce any new concepts, we will present them without additional remarks."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers title=erc20.rs",showLineNumbers:!0,title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n self.env().revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowance(owner, spender);\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .set(&(*owner, *spender), new_allowance);\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\n#[odra::event]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 1,\n InsufficientAllowance = 2,\n}\n")),(0,a.kt)("p",null,"Now, compare the code we have written, with ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,a.kt)("h3",{id:"test"},"Test"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::*;\n use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: INITIAL_SUPPLY.into()\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let (env, mut erc20) = setup();\n\n let (owner, recipient, spender) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount\n }\n ));\n\n // Spender transfers tokens from Owner to Recipient.\n env.set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n ));\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n ));\n // assert!(env.emitted(erc20.address(), "Transfer"));\n }\n\n #[test]\n fn transfer_from_error() {\n // Given a new instance.\n let (env, mut erc20) = setup();\n\n // When the spender\'s allowance is zero.\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n // Then transfer fails.\n assert_eq!(\n erc20.try_transfer_from(&owner, &recipient, &amount),\n Err(Error::InsufficientAllowance.into())\n );\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L146")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Having two modules: ",(0,a.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b2b12f9a.6926e5b2.js b/docs/assets/js/b2b12f9a.6926e5b2.js new file mode 100644 index 000000000..a2c9cdcc5 --- /dev/null +++ b/docs/assets/js/b2b12f9a.6926e5b2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[92349],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),i=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=i(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=i(n),m=r,h=p["".concat(c,".").concat(m)]||p[m]||d[m]||o;return n?a.createElement(h,l(l({ref:t},u),{},{components:n})):a.createElement(h,l({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var i=2;i<o;i++)l[i]=n[i];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"},85162:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(67294),r=n(86010);const o="tabItem_Ymn6";function l(e){let{children:t,hidden:n,className:l}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,l),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>_});var a=n(87462),r=n(67294),o=n(86010),l=n(12466),s=n(16550),c=n(91980),i=n(67392),u=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,s.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,c._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(a.location.search);t.set(o,e),a.replace({...a.location,search:t.toString()})}),[o,a])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,o=p(e),[l,s]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:o}))),[c,i]=h({queryString:n,groupId:a}),[d,f]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,o]=(0,u.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:a}),b=(()=>{const e=c??d;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{b&&s(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),i(e),f(e)}),[i,f,o]),tabValues:o}}var b=n(72389);const y="tabList__CuJ",g="tabItem_LNqP";function k(e){let{className:t,block:n,selectedValue:s,selectValue:c,tabValues:i}=e;const u=[],{blockElementScrollPositionUntilNextRender:d}=(0,l.o5)(),p=e=>{const t=e.currentTarget,n=u.indexOf(t),a=i[n].value;a!==s&&(d(t),c(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=u.indexOf(e.currentTarget)+1;t=u[n]??u[0];break}case"ArrowLeft":{const n=u.indexOf(e.currentTarget)-1;t=u[n]??u[u.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:l}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>u.push(e),onKeyDown:m,onClick:p},l,{className:(0,o.Z)("tabs__item",g,l?.className,{"tabs__item--active":s===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",y)},r.createElement(k,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function _(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},71352:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),o=n(74866),l=n(85162);const s={sidebar_position:8},c="Using Proxy Caller",i={unversionedId:"tutorials/using-proxy-caller",id:"version-1.0.0/tutorials/using-proxy-caller",title:"Using Proxy Caller",description:"In this tutorial, we will learn how to use the proxycaller wasm to call an Odra payable function. The proxycaller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.",source:"@site/versioned_docs/version-1.0.0/tutorials/using-proxy-caller.md",sourceDirName:"tutorials",slug:"/tutorials/using-proxy-caller",permalink:"/docs/tutorials/using-proxy-caller",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8},sidebar:"tutorialSidebar",previous:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/tutorials/build-deploy-read"},next:{title:"CEP-18",permalink:"/docs/tutorials/cep18"}},u={},d=[{value:"Contract",id:"contract",level:2},{value:"Client",id:"client",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"using-proxy-caller"},"Using Proxy Caller"),(0,r.kt)("p",null,"In this tutorial, we will learn how to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," wasm to call an Odra ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/casper#payable"},"payable")," function. The ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," is a session code that top-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some ",(0,r.kt)("inlineCode",{parentName:"p"},"CSPR"),"s to the call."),(0,r.kt)("p",null,"Read more about the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/casper#using-proxy_callerwasm"},"here"),"."),(0,r.kt)("h2",{id:"contract"},"Contract"),(0,r.kt)("p",null,"For this tutorial, we will use the ",(0,r.kt)("inlineCode",{parentName:"p"},"TimeLockWallet")," contract from our examples."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs showLineNumbers",title:"examples/src/contracts/tlw.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{casper_types::U512, Address, Mapping, Var};\n\n#[odra::module(errors = Error, events = [Deposit, Withdrawal])]\npub struct TimeLockWallet {\n balances: Mapping<Address, U512>,\n lock_expiration_map: Mapping<Address, u64>,\n lock_duration: Var<u64>\n}\n\n#[odra::module]\nimpl TimeLockWallet {\n /// Initializes the contract with the lock duration.\n pub fn init(&mut self, lock_duration: u64) {\n self.lock_duration.set(lock_duration);\n }\n\n /// Deposits the tokens into the contract.\n #[odra(payable)]\n pub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U512 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env().revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env().emit_event(Deposit {\n address: caller,\n amount\n });\n }\n\n /// Withdraws the tokens from the contract.\n pub fn withdraw(&mut self, amount: &U512) {\n // code omitted for brevity\n }\n\n /// Returns the balance of the given account.\n pub fn get_balance(&self, address: &Address) -> U512 {\n // code omitted for brevity\n }\n\n /// Returns the lock duration.\n pub fn lock_duration(&self) -> u64 {\n // code omitted for brevity\n }\n}\n\n/// Errors that may occur during the contract execution.\n#[odra::odra_error]\npub enum Error {\n LockIsNotOver = 1,\n CannotLockTwice = 2,\n InsufficientBalance = 3\n}\n\n/// Deposit event.\n#[odra::event]\npub struct Deposit {\n pub address: Address,\n pub amount: U512\n}\n\n/// Withdrawal event.\n#[odra::event]\npub struct Withdrawal {\n pub address: Address,\n pub amount: U512\n}\n")),(0,r.kt)("p",null,"Full code can be found ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/examples/src/contracts/tlw.rs"},"here"),"."),(0,r.kt)("h2",{id:"client"},"Client"),(0,r.kt)("p",null,"Before we can interact with the node, we need to set it up. We will use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-nctl-docker"},(0,r.kt)("inlineCode",{parentName:"a"},"casper-nctl-docker"))," image."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Make sure you have the contract's wasm file and the secret key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# Build the contract\ncargo odra build -c TimeLockWallet\n# Extract secret key\ndocker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem\n')),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("p",null,"To interact with the contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"livenet")," backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "odra-examples"\nversion = "1.0.0"\nedition = "2021"\n\n[dependencies]\nodra = { path = "../odra", default-features = false }\n... # other dependencies\nodra-casper-livenet-env = { version = "1.0.0", optional = true }\n\n... # other sections\n\n[features]\ndefault = []\nlivenet = ["odra-casper-livenet-env"]\n\n... # other sections\n\n[[bin]]\nname = "tlw_on_livenet"\npath = "bin/tlw_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n\n... # other sections\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/bin/tlw_on_livenet.rs showLineNumbers",title:"examples/bin/tlw_on_livenet.rs",showLineNumbers:!0},'//! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs.\nuse odra::casper_types::{AsymmetricType, PublicKey, U512};\nuse odra::host::{Deployer, HostRef};\nuse odra::Address;\nuse odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs};\n\nconst DEPOSIT: u64 = 100;\nconst WITHDRAWAL: u64 = 99;\nconst GAS: u64 = 20u64.pow(9);\n\nfn main() {\n let env = odra_casper_livenet_env::env();\n let caller = env.get_account(0);\n\n env.set_caller(caller);\n env.set_gas(GAS);\n\n let mut contract = TimeLockWalletHostRef::deploy(\n &env, \n TimeLockWalletInitArgs { lock_duration: 60 * 60 }\n );\n // Send 100 CSPRs to the contract.\n contract\n .with_tokens(U512::from(DEPOSIT))\n .deposit();\n \n println!("Caller\'s balance: {:?}", contract.get_balance(&caller));\n // Withdraw 99 CSPRs from the contract.\n contract.withdraw(&U512::from(WITHDRAWAL));\n println!("Remaining balance: {:?}", contract.get_balance(&caller));\n}\n')),(0,r.kt)("p",null,"To run the code, execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \\\nODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \\\nODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \\ \ncargo run --bin tlw_on_livenet --features=livenet\n# Sample output\n\ud83d\udc81 INFO : Deploying "TimeLockWallet".\n\ud83d\udc81 INFO : Found wasm under "wasm/TimeLockWallet.wasm".\n\ud83d\ude44 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558".\n\ud83d\udc81 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed.\n\ud83d\udc81 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed.\n\ud83d\udc81 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy.\n\ud83d\ude44 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3".\n\ud83d\udc81 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed.\nCaller\'s balance: 100\n\ud83d\udc81 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw".\n\ud83d\ude44 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e".\n\ud83d\udc81 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed.\nRemaining balance: 1\n')),(0,r.kt)("p",null,"As observed, the contract was successfully deployed, and the ",(0,r.kt)("inlineCode",{parentName:"p"},"Caller")," deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR.\nThe logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity.")),(0,r.kt)(l.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("p",null,"Since TypeScript code often requires considerable boilerplate, we offer a streamlined version of the code. We demonstrate how to deploy the contract and prepare a deploy that utilizes the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," to invoke a payable function with attached ",(0,r.kt)("inlineCode",{parentName:"p"},"CSPR")," tokens. The ",(0,r.kt)("a",{parentName:"p",href:"/docs/tutorials/build-deploy-read"},"previous tutorial")," details how to read the state, which is not the focus of our current discussion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'import {\n CLByteArray,\n CLList,\n CLU8,\n CLValueBuilder,\n CasperClient,\n Contracts,\n Keys,\n RuntimeArgs,\n csprToMotes,\n decodeBase16,\n} from "casper-js-sdk";\nimport fs from "fs";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\nconst SECRET_KEY_PATH = "keys/secret_key.pem"\nconst PROXY_CALLER_PATH = "wasm/proxy_caller.wasm"\nconst CONTRACT_PATH = "wasm/TimeLockWallet.wasm";\nconst CHAIN_NAME = "casper-net-1";\nconst ENTRY_POINT = "deposit";\nconst DEPOSIT = 100;\nconst GAS = 110;\n// Once the contract is deployed, the contract package hash\n// can be obtained from the global state.\nconst CONTRACT_PACKAGE_HASH = "...";\n\nconst casperClient = new CasperClient(LOCAL_NODE_URL);\nconst keypair = Keys.Ed25519.loadKeyPairFromPrivateFile(\n SECRET_KEY_PATH\n);\nconst contract = new Contracts.Contract(casperClient);\n\nexport async function deploy_contract(): Promise<string> {\n // Required odra_cfg args and the constructor args\n const args = RuntimeArgs.fromMap({\n odra_cfg_package_hash_key_name: CLValueBuilder.string("tlw"),\n odra_cfg_allow_key_override: CLValueBuilder.bool(true),\n odra_cfg_is_upgradable: CLValueBuilder.bool(true),\n lock_duration: CLValueBuilder.u64(60 * 60)\n });\n \n const wasm = new Uint8Array(fs.readFileSync(CONTRACT_PATH));\n const deploy = contract.install(\n wasm,\n args,\n csprToMotes(GAS).toString(),\n keypair.publicKey,\n CHAIN_NAME,\n [keypair],\n );\n return casperClient.putDeploy(deploy);\n}\n \nexport async function deposit(): Promise<string> {\n // Contract package hash is a 32-byte array, \n // so take the hex string and convert it to a byte array.\n // This is done using the decodeBase16 function from \n // the casper-js-sdk.\n const contractPackageHashBytes = new CLByteArray(\n decodeBase16(CONTRACT_PACKAGE_HASH)\n );\n // Next, create RuntimeArgs for the deploy \n // and pass them as bytes to the contract.\n // Note that the args are not a byte array, but a CLList \n // of CLU8s - a different type of CLValue.\n // Finally, create a Uint8Array from the bytes and \n // then transform it into a CLList<CLU8>.\n const args_bytes: Uint8Array = RuntimeArgs.fromMap({})\n .toBytes()\n .unwrap();\n const serialized_args = new CLList(\n Array.from(args_bytes)\n .map(value => new CLU8(value))\n );\n\n const args = RuntimeArgs.fromMap({\n attached_value: CLValueBuilder.u512(DEPOSIT),\n amount: CLValueBuilder.u512(DEPOSIT),\n entry_point: CLValueBuilder.string(ENTRY_POINT),\n contract_package_hash: contractPackageHashBytes,\n args: serialized_args\n });\n // Use proxy_caller to send tokens to the contract.\n const wasm = new Uint8Array(fs.readFileSync(PROXY_CALLER_PATH));\n const deploy = contract.install(\n wasm,\n args,\n csprToMotes(GAS).toString(),\n keypair.publicKey,\n CHAIN_NAME,\n [keypair],\n );\n return casperClient.putDeploy(deploy);\n}\n \ndeploy_contract()\n .then((result) => { console.log(result); });\n\n// One you obatin the contract hash, you can call the deposit function:\n// deposit()\n// .then((result) => { console.log(result); });\n')),(0,r.kt)("p",null,"To run the code, execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \n# Sample output\nf40e3ca983034435d829462dd53d801df4e98013009cbf4a6654b3ee467063a1 # the deploy hash\n")))),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"In this tutorial, we learned how to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," wasm to make a payable function call. We deployed the ",(0,r.kt)("inlineCode",{parentName:"p"},"TimeLockWallet")," contract, deposited tokens using the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller")," with attached CSPRs, and withdrew them. You got to try it out in both ",(0,r.kt)("inlineCode",{parentName:"p"},"Rust")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"TypeScript"),", so you can choose whichever you prefer. ",(0,r.kt)("inlineCode",{parentName:"p"},"Rust")," code seemed simpler, thanks to the Odra ",(0,r.kt)("inlineCode",{parentName:"p"},"livenet")," backend making chain interactions easier to handle."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b2b675dd.aaa7ce95.js b/docs/assets/js/b2b675dd.aaa7ce95.js new file mode 100644 index 000000000..709443c34 --- /dev/null +++ b/docs/assets/js/b2b675dd.aaa7ce95.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90533],{28017:e=>{e.exports=JSON.parse('{"permalink":"/blog","page":1,"postsPerPage":7,"totalPages":1,"totalCount":7,"blogDescription":"Blog","blogTitle":"Blog"}')}}]); \ No newline at end of file diff --git a/docs/assets/js/b2c1dfd0.e941435d.js b/docs/assets/js/b2c1dfd0.e941435d.js new file mode 100644 index 000000000..a9be2b8e5 --- /dev/null +++ b/docs/assets/js/b2c1dfd0.e941435d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[44781],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),h=c(n),u=o,m=h["".concat(s,".").concat(u)]||h[u]||p[u]||r;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c<r;c++)i[c]=n[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}h.displayName="MDXCreateElement"},49333:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:3},i="Livenet",l={unversionedId:"backends/livenet",id:"version-0.8.1/backends/livenet",title:"Livenet",description:"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local",source:"@site/versioned_docs/version-0.8.1/backends/04-livenet.md",sourceDirName:"backends",slug:"/backends/livenet",permalink:"/docs/0.8.1/backends/livenet",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Casper",permalink:"/docs/0.8.1/backends/casper"},next:{title:"Examples",permalink:"/docs/0.8.1/category/examples"}},s={},c=[{value:"Setup",id:"setup",level:2},{value:"Usage",id:"usage",level:2},{value:"How Livenet backend works",id:"how-livenet-backend-works",level:2},{value:"Multiple enviroments",id:"multiple-enviroments",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"livenet"},"Livenet"),(0,o.kt)("p",null,"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local\ntest node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend\nto handle the deployment of your contracts to the real blockchain."),(0,o.kt)("p",null,"Furthermore, it is implemented in a similarly to Casper or OdraVM,\nhowever, it uses a real blockchain to deploy contracts and store the state.\nThis lets us use Odra to deploy and test contracts on a real blockchain, but\non the other hand, it comes with some limitations on what can be done in the tests."),(0,o.kt)("p",null,"The main differences between Livenet and e.g. CasperVM backend are:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Real CSPR tokens are used to deploy and call contracts. This also means that we need to\npay for each contract deployment and each contract call. Of course, we can use the ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/tools/faucet"},"faucet"),"\nto get some tokens for testing purposes, but we still need to specify the amount needed\nfor each action."),(0,o.kt)("li",{parentName:"ul"},"The contract state is stored on the real blockchain, so we can't just reset the state -\nwe can redeploy the contract, but we can't remove the old one."),(0,o.kt)("li",{parentName:"ul"},"Because of the above, we can load the existing contracts and use them in the tests."),(0,o.kt)("li",{parentName:"ul"},"We have no control over the block time. This means that for example, ",(0,o.kt)("inlineCode",{parentName:"li"},"advance_block_time")," function\nis implemented by waiting for the real time to pass.")),(0,o.kt)("p",null,"This is also a cause for the fact that the Livenet backend cannot be (yet) used for running\nthe regular Odra tests. Instead, we can create integration tests or binaries which will\nuse a slightly different workflow to test the contracts."),(0,o.kt)("h2",{id:"setup"},"Setup"),(0,o.kt)("p",null,"To use Livenet backend, we need to provide Odra with some information - the network address, our private\nkey and the name of the chain we want to use. Optionally, we can add multiple private keys to use\nmore than one account in our tests. Those values are passed using environment variables. We can use .env\nfile to store them - let's take a look at an example .env file, created from the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.1/examples/.env.sample"},".env.sample")," file from\nexamples folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env"},"# Path to the secret key of the account that will be used\n# to deploy the contracts.\n# We're using .keys folder so we don't accidentally commit\n# the secret key to the repository.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777\n\n# Chain name of the network. Known values:\n# - integration-test\nODRA_CASPER_LIVENET_CHAIN_NAME=integration-test\n\n# Paths to the secret keys of the additional accounts.\n# Main secret key will be 0th account.\nODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem\nODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem\n")),(0,o.kt)("p",null,"With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find\na simple binary that deploys a contract and calls it. The test is located in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.1/examples/bin/erc20_on_livenet.rs"},"erc20_on_livenet.rs")," file.\nLet's go through the code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // Similar to the OdraVM backend, we need to initialize\n // the environment:\n let env = odra_casper_livenet_env::env();\n\n // Most of the for the host env works the same as in the\n // OdraVM backend.\n let owner = env.caller();\n // Addresses are the real addresses on the blockchain,\n // so we need to provide them\n // if we did not import their secret keys.\n let recipient = \n "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Arguments for the contract init method.\n let name = String::from("Plascoin");\n let symbol = String::from("PLS");\n let decimals = 10u8;\n let initial_supply: U256 = U256::from(10_000);\n \n // The main difference between other backends - we need to specify\n // the gas limit for each action.\n // The limit will be used for every consecutive action\n // until we change it.\n env.set_gas(100_000_000_000u64);\n \n // Deploy the contract. The API is the same as in the OdraVM backend.\n let init_args = Erc20InitArgs {\n name,\n symbol,\n decimals,\n initial_supply: Some(initial_supply)\n };\n let mut token = Erc20HostRef::deploy(env, init_args);\n \n // We can now use the contract as we would in the OdraVM backend.\n println!("Token address: {}", token.address().to_string());\n\n // Uncomment to load existing contract.\n // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n // let address = Address::from_str(address).unwrap();\n // We use the Livenet-specific `load` method to load the contract\n // that is already deployed.\n // let mut token = Erc20Deployer::load(env, address);\n\n // Non-mutable calls are free! Neat, huh? More on that later.\n println!("Token name: {}", token.name());\n\n // The next call is mutable, but the cost is lower that the deployment,\n // so we change the amount of gas\n env.set_gas(3_000_000_000u64);\n token.transfer(recipient, U256::from(1000));\n\n println!("Owner\'s balance: {:?}", token.balance_of(owner));\n println!("Recipient\'s balance: {:?}", token.balance_of(recipient));\n}\n')),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The above example is a rust binary, not a test. Note that it is also added as a section of the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[bin]\nname = "erc20_on_livenet"\npath = "src/bin/erc20_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n'))),(0,o.kt)("h2",{id:"usage"},"Usage"),(0,o.kt)("p",null,"To run the above code, we simply need to run the binary with the ",(0,o.kt)("inlineCode",{parentName:"p"},"livenet")," feature enabled:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Before executing the binary, make sure you built a wasm file.")),(0,o.kt)("p",null,"A part of a sample output should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'...\n\ud83d\udc81 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\udc81 INFO : Deploy "65b1a5d21..." successfully executed.\nOwner\'s balance: 4004\nRecipient\'s balance: 4000\n')),(0,o.kt)("p",null,"Those logs are a result of the last 4 lines of the above listing.\nEach deployment or a call to the blockchain will be noted and will take some time to execute.\nWe can see that the ",(0,o.kt)("inlineCode",{parentName:"p"},"transfer")," call took over 15 seconds to execute. But calling ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," was nearly instant\nand cost us nothing. How it is possible?"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You can see the deployment on ",(0,o.kt)("a",{parentName:"p",href:"http://cspr.live/"},"http://cspr.live/")," - the transfer from the example\ncan be seen ",(0,o.kt)("a",{parentName:"p",href:"https://integration.cspr.live/deploy/65b1a5d21174a62c675f89683aba995c453b942c705b404a1f8bbf6f0f6de32a"},"here"),".")),(0,o.kt)("h2",{id:"how-livenet-backend-works"},"How Livenet backend works"),(0,o.kt)("p",null,"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state.\nIt is possible however to query the state of the blockchain for free."),(0,o.kt)("p",null,"This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the\nnode is the current state. This is why the ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," call was almost instant and free."),(0,o.kt)("p",null,"Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract\n(see ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/cross-calls"},"Cross Calls"),"), it is executed offline and\nnode is used for the state query only. However, the Livenet needs to know the connection between the contracts\nand the code, so make sure to deploy or load already deployed contracts"),(0,o.kt)("h2",{id:"multiple-enviroments"},"Multiple enviroments"),(0,o.kt)("p",null,"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts,\nmultiple nodes or even multiple chains."),(0,o.kt)("p",null,"To do this, simply create a new ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with a different prefix - for example, ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet.env"),".\nThen, pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"ODRA_CASPER_LIVENET_ENV")," variable with value either ",(0,o.kt)("inlineCode",{parentName:"p"},"integration")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet")," to select which file\nhas to be used first. If your ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file has a value that IS present in the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file, it will\noverride the value from the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene\n")),(0,o.kt)("p",null,"To sum up - this command will firstly load the ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file and then load the missing values from ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b2e57a16.6de2dfbb.js b/docs/assets/js/b2e57a16.6de2dfbb.js new file mode 100644 index 000000000..6fb56ab66 --- /dev/null +++ b/docs/assets/js/b2e57a16.6de2dfbb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[19243],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,m=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},71345:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.6.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.6.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.6.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/0.6.0/category/backends"},next:{title:"MockVM",permalink:"/docs/0.6.0/backends/mock-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Test Env",id:"test-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/backends/mock-vm"},"MockVM"),",\nor a complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/backends/casper"},"CasperVM"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b2f44958.256626f4.js b/docs/assets/js/b2f44958.256626f4.js new file mode 100644 index 000000000..cb7ea417b --- /dev/null +++ b/docs/assets/js/b2f44958.256626f4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[5776],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},88144:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.5.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.5.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.5.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.5.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.5.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::Variable;\nuse odra::types::{BlockTime, Address};\n\n#[odra::module]\npub struct HostContract {\n name: Variable<String>,\n created_at: Variable<BlockTime>,\n created_by: Variable<Address>,\n}\n\n#[odra::module]\nimpl HostContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(odra::contract_env::get_block_time());\n self.created_by.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are calling functions from ",(0,o.kt)("inlineCode",{parentName:"p"},"odra::contract_env"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"get_block_time()")," will return\nthe current block time wrapped in Odra type ",(0,o.kt)("inlineCode",{parentName:"p"},"BlockTime"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"caller()")," will return an Odra ",(0,o.kt)("inlineCode",{parentName:"p"},"Address")," of\na caller (this can be an external caller or another contract)."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b2f554cd.ac3dfe73.js b/docs/assets/js/b2f554cd.ac3dfe73.js new file mode 100644 index 000000000..59b92185f --- /dev/null +++ b/docs/assets/js/b2f554cd.ac3dfe73.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11477],{30010:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"Nysa","metadata":{"permalink":"/blog/Nysa","source":"@site/blog/2023-08-18-nysa/index.md","title":"Nysa","description":"The Oder River, known as \\"Odra\\" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wroc\u0142aw, Szczecin, and Gda\u0144sk, to international waterways. The Oder also plays a significant role in the region\'s ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.","date":"2023-08-18T00:00:00.000Z","formattedDate":"August 18, 2023","tags":[],"readingTime":8.47,"hasTruncateMarker":true,"authors":[{"name":"Krzysztof Pobiar\u017cyn","title":"Lead Developer","url":"https://github.com/kpob","key":"kpob"}],"frontMatter":{"slug":"Nysa","title":"Nysa","authors":["kpob"],"image":"./twitter-card.png"},"nextItem":{"title":"It\'s all about the community!","permalink":"/blog/its-all-about-the-community"}},"content":"The Oder River, known as \\"Odra\\" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wroc\u0142aw, Szczecin, and Gda\u0144sk, to international waterways. The Oder also plays a significant role in the region\'s ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.\\n\\nThe Nysa K\u0142odzka is a significant river in Poland, flowing through the country\'s southwestern part. It travels approximately 188 kilometers, originating in the Czech Republic and merging with the Oder River in Poland. The river passes through picturesque landscapes, including the K\u0142odzko Valley, and plays a crucial role in local ecosystems. Its waters are harnessed for various purposes, such as hydroelectric power generation and irrigation.\\n\\nOh, wait, shouldn\'t it be a tech blog?\\n\\nThis is a valid question, we will get back to it in a moment.\\n\\n\x3c!--truncate--\x3e\\n\\n## Odra\\n\\nA short reminder:\\n\\n> Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design ...\\n> it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. \\n>\\n> [Odra][odra]\\n\\nUnderstanding that people generally dislike learning new things, we\'ve kept this in mind throughout development. Since day one, we have focused on creating Odra with the largest group of smart contract developers in mind - those familiar with Solidity. The Odra Framework is designed to flatten the learning curve for this group.\\n\\nA Solidity developer will encounter familiar concepts such as:\\n\\n* Constructors\\n* Payable functions\\n* Mappings\\n* Reverts\\n* Current caller\\n* Current block time\\n* A standard module library (similar to OpenZeppelin)\\n* And more\\n\\n:::note\\nIt\'s important to note that the Odra Framework is intentionally blockchain-agnostic. Its design does not target any particular blockchain. \\n\\nUltimately, Odra is built to support multiple blockchains, allowing the writing of smart contracts in Rust.\\n:::\\n\\nHaving so many similarities, why not take the next step and transpile Solidity code into Odra code?\\n\\nThis is where Nysa comes into play.\\n\\n## Nysa\\n\\nSolidity and Rust share some syntax similarities despite being designed for different purposes. Both languages emphasize strong typing, pattern matching, and immutability by default.\\n\\nNysa performs Solidity-to-Rust transpilation through four simple steps.\\n\\n![nysa-gen](./nysa_generic.drawio.svg)\\n\\n1. **Solidity Parser**\\n \\nFirstly, we need a well-structured Rust representation of Solidity code. Nysa utilizes [LALRPOP][lalrpop] - a Rust parser generator framework. In the further steps, this enables us to conduct static analysis of the Solidity code, ranging from contract context down to individual expressions.\\n\\n```rust title=solidity-parser/src/pt.rs\\n// The representation of a Solidity contract\\n#[derive(Debug, PartialEq)]\\npub struct ContractDefinition {\\n pub doc: Vec<DocComment>,\\n pub loc: Loc,\\n pub ty: ContractTy,\\n pub name: Identifier,\\n pub base: Vec<Base>,\\n pub parts: Vec<ContractPart>,\\n}\\n```\\n\\n2. **C3 Linearization**\\n \\nOne of the most notable distinctions between Rust and Solidity is their approach to inheritance. Rust says `No, thx`, whereas Solidity opts for `The more, the better`. Speaking more technically, Solidity supports multiple inheritance with [C3 linearization][c3].\\n\\n:::info\\nThe primary purpose of the C3 Linearization Algorithm is to establish a consistent and unambiguous order of method resolution in cases where there might be ambiguity or conflicts due to multiple inheritance. It ensures that the inherited methods are called in a predictable and well-defined sequence based on the class hierarchy and the order in which classes are defined.\\n:::\\n\\nFor simulating C3 linearization, Nysa utilizes an [implementation][c3-impl] of the C3 linearization in Rust written by [Maciej Zieli\u0144ski][z1elony], so everything stays in the Odra family.\\n\\n3. **Nysa Parser**\\n\\nAfter that, we step to the essential part, converting Solidity code into Rust code.\\n\\nFor example, a Solidity event.\\n\\n```solidity\\nevent Transfer(address indexed from, address indexed to, uint256 value);\\n```\\ncan easily be represented as an plain Rust struct - the same name, the same fields, similar types. \\n\\n```rust\\n#[derive(PartialEq, Eq, Debug)]\\npub struct Transfer {\\n from: Option<Address>,\\n to: Option<Address>,\\n value: U256,\\n}\\n```\\n\\nThe same we do with contracts, interfaces, libraries, errors, variables, functions, statements, etc.\\n\\nHere is a snippet of the expression parser:\\n\\n```rust title=nysa/src/parser/odra/expr/mod.rs\\npub fn parse<T>(expression: &Expression, ctx: &mut T) -> Result<syn::Expr, ParserError>\\nwhere\\n T: StorageInfo + TypeInfo + EventsRegister + ExternalCallsRegister + ContractInfo + FnContext,\\n{\\n match expression {\\n Expression::Require { condition, error } => error::revert(Some(condition), error, ctx),\\n Expression::ZeroAddress => Ok(parse_quote!(None)),\\n Expression::Add { left, right } => math::add(left, right, ctx),\\n Expression::Subtract { left, right } => math::sub(left, right, ctx),\\n Expression::Increment { expr } => {\\n let expr = parse(expr, ctx)?;\\n Ok(parse_quote!(#expr += 1))\\n }\\n Expression::ExternalCall {\\n variable,\\n fn_name,\\n args,\\n } => parse_ext_call(variable, fn_name, args, ctx),\\n Expression::Type { ty } => {\\n let ty = ty::parse_plain_type_from_ty(ty, ctx)?;\\n Ok(parse_quote!(#ty))\\n }\\n Expression::BoolLiteral(b) => Ok(parse_quote!(#b)),\\n ...\\n }\\n}\\n\\n```\\n\\n4. **Printing the code**\\n\\nThe last step is just consuming the resulting C3 AST. Nysa produces a token stream from the AST. Most likely you would write it to a file.\\n\\nAnd there you are: a Rust smart contract is ready to be compiled!\\n\\n### Nysa + Odra\\nBy design, Nysa is a universal tool, so the third step from the pipeline is replaceable. In other words, a Solidity input can be converted to Rust code supporting a framework/SDK of your choice unless you provide a parser implementation.\\n\\nHowever, the default implementation is `OdraParser`, which takes a contract written in Solidity and splits out an Odra module.\\n\\nI hope you see an analogy to the first two paragraphs at this point. Nysa the river and Nysa the transpiler `flow into` Odra.\\n\\n![nysa-odra](./nysa_odra.drawio.svg)\\n\\n## Examples\\n\\n### Status message\\n\\nLet\'s get our hands dirty and create a very simple project. We will write a contract that stores a single mapping of records - an address to a string message.\\n\\nTo set up the project, we use `cargo odra`.\\n``` bash\\ncargo odra new -n status -t blank\\ncd status\\n```\\n\\nThe first thing is to add Nysa to the project and create a rudimentary `build.rs` where we define the input - a solidity contract and the output - an Odra module generated by Nysa.\\n\\n```toml title=Cargo.toml\\n[build-dependencies]\\nnysa = { version = \\"0.1.0\\", features = [\\"builder\\"] }\\n```\\n\\n```rust title=build.rs\\nconst DEST_FILE_PATH: &str = \\"src/status_message.rs\\";\\nconst SOURCE_FILE_PATH: &str = \\"src/status_message.sol\\";\\n\\nfn main() {\\n nysa::builder::generate_file::<&str, nysa::OdraParser>(SOURCE_FILE_PATH, DEST_FILE_PATH);\\n}\\n```\\n\\nNext, implement the contract. Naturally, a Solidity one.\\n\\n```solidity title=src/status_message.sol\\n// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ncontract StatusMessage {\\n mapping(address => string) records;\\n\\n function setStatus(string memory status) public payable {\\n address accountId = msg.sender;\\n records[accountId] = status;\\n }\\n\\n function getStatus(address accountId) public view returns (string memory) {\\n return records[accountId];\\n }\\n}\\n```\\n\\nThe contract has a single mapping `records` that stores a message and its owner. Additionally, exposes two entry points: `setStatus` (sets current\'s sender message) and `getStatus`.\\n\\nFollowing, let\'s define a `lib.rs` file.\\n\\n```rust title=src/lib.rs\\nmod status_message;\\npub use status_message::{StatusMessage, StatusMessageDeployer, StatusMessageRef};\\n\\n#[cfg(test)]\\nmod test;\\n```\\nThe file is straightforward: registers a `status_message` rust module, reexports some Odra abstractions, and adds a test module.\\n\\nLastly, we can test our contract.\\nLike the original solidity contract, our Odra contract exposes two entry points: `set_message()` and `get_message()`.\\nThe test code looks like [any other][odra-docs-testing] Odra test: we use `StatusMessageDeployer` to instantiate a contract, which gets us a reference to interact with the contract.\\n\\n```rust title=src/test.rs\\nuse odra::{test_env, types::Address};\\nuse super::*;\\n\\nconst ACCOUNT: fn() -> Address = || odra::test_env::get_account(1);\\n\\n#[test]\\nfn set_get_message() {\\n let mut contract = StatusMessageDeployer::default();\\n\\n test_env::set_caller(ACCOUNT());\\n contract.set_status(\\"hello\\".to_string());\\n assert_eq!(\\"hello\\".to_string(), contract.get_status(Some(ACCOUNT())));\\n}\\n\\n#[test]\\nfn get_nonexistent_message() {\\n let contract = StatusMessageDeployer::default();\\n\\n assert_eq!(\\n String::new(),\\n contract.get_status(Some(ACCOUNT()))\\n );\\n}\\n```\\n\\n```bash\\ncargo odra test # test against MockVM\\n# or\\ncargo odra test -b casper # build a wasm file and test against CasperVM\\n```\\n\\n```\\nstatus-message\\n\u251c\u2500\u2500 src\\n\u2502 \u251c\u2500\u2500 lib.rs\\n\u2502 \u251c\u2500\u2500 status_message.sol\\n\u2502 \u2514\u2500\u2500 test.rs\\n\u251c\u2500\u2500 build.rs\\n\u251c\u2500\u2500 Cargo.toml\\n\u2514\u2500\u2500 Odra.toml\\n```\\n\\nFull example available [here][nysa-status-example].\\n\\n### CappedErc20\\n\\nA more complex, real-world example is a `CappedErc20` contract. It is a ERC20 [Ownable][oz-ownable], [Burnable][oz-burnable] and [Capped][oz-capped] token contract.\\n\\n```solidity title=plascoin.sol\\n// ...\\n// rest of the code\\n\\ncontract Plascoin is ERC20Capped, ERC20Burnable, Ownable {\\n constructor(string memory name_, string memory symbol_, uint256 cap_, address initialOwner) ERC20(name_, symbol_) ERC20Capped(cap_) Ownable(initialOwner) {\\n }\\n\\n function mint(address account, uint256 amount) public onlyOwner {\\n _mint(account, amount);\\n }\\n\\n function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Capped) {\\n super._update(from, to, value);\\n }\\n}\\n```\\nYou can check out the full source code [here][nysa-capped-erc20-sol].\\n\\nDeployment of such a contract onto the Casper testnet is straightforward. We are just two steps from it. \\n\\n```sh\\n# to make sure the contract works as expected \\n# we execute cargo odra test command to build and run tests\\ncargo odra test -b casper\\n\\n# deploy onto the testnet\\ncasper-client put-deploy\\n --node-address {{NODE_ADDRESS}}\\n --chain-name casper-test\\n --secret-key {{SECRET_KEY}} \\\\\\n --session-path {{CONTRACT_WASM}} \\\\\\n --payment-amount 130000000000 \\\\\\n --session-arg \\"odra_cfg_package_hash_key_name:string:\'{{CONTRACT_PACKAGE_HASH_NAMED_KEY}}\'\\" \\\\\\n --session-arg \\"odra_cfg_allow_key_override:bool:\'true\'\\" \\\\\\n --session-arg \\"odra_cfg_is_upgradable:bool:\'true\'\\" \\\\\\n --session-arg \\"odra_cfg_constructor:string:\'init\'\\" \\\\\\n --session-arg \\"name:string=\'{{name}}\'\\" \\\\\\n --session-arg \\"symbol:string=\'{{symbol}}\'\\" \\\\\\n --session-arg \\"cap:u256=\'{{cap}}\'\\" \\\\\\n --session-arg \\"initial_owner:opt_key=\'{{owner}}\'\\"\\n```\\n\\nLiterally in 5 minutes I was able to:\\n1. Build a wasm file from Solidity source code\\n2. Successfully [deploy][nysa-deploy] the contract onto Testnet,\\n3. [Mint][nysa-mint] some tokens,\\n4. And [transfer][nysa-transfer] them.\\n \\nFinally, we compare the costs of Solidity-to-Odra contract and a native CEP-18 implementation. Despite the contracts being different in terms of the internal logic and exposed entry points, such comparison gives us some insight into Nysa\'s efficiency.\\n\\n| action | CEP-18 | Nysa |\\n|-----------|----------------------|-----------------------|\\n| deploy | [143.87][cep-deploy] | [93.37][nysa-deploy] |\\n| transfer | [1.29][cep-transfer] | [1.36][nysa-transfer] |\\n\\n## Conclusion\\n\\nNysa is at early stage of development, but already has shown a huge potential. In a few simple steps, you can take advantage of an existing smart contract and convert it into an Odra module. The module can be a standalone contract, or a building block of a bigger contract.\\n\\n[lalrpop]: https://github.com/lalrpop/lalrpop\\n[c3]: https://en.wikipedia.org/wiki/C3_linearization\\n[c3-impl]: https://github.com/odradev/c3-lang\\n[z1elony]: https://github.com/zie1ony\\n[odra]: https://odra.dev/docs/\\n[odra-discord]: https://discord.gg/Mm5ABc9P8k\\n[odra-twitter]: https://twitter.com/odradev\\n[odra-wiki]: https://en.wikipedia.org/wiki/Oder\\n[nysa-wiki]: https://en.wikipedia.org/wiki/Eastern_Neisse\\n[nysa-capped-erc20-sol]: https://github.com/odradev/nysa/blob/feature/odra/examples/capped-erc20/src/plascoin.sol\\n[nysa-capped-erc20]: https://github.com/odradev/nysa/blob/feature/odra/examples/capped-erc20/\\n[nysa-status-example]: https://github.com/odradev/nysa/tree/feature/odra/examples/status-message/nysa\\n[odra-docs-testing]: https://odra.dev/docs/basics/testing\\n[cep-deploy]: https://testnet.cspr.live/deploy/2b5d17ea5d9c093c4252705285f7aeabe58cff37fb48b5837567908e2d91329a\\n[cep-transfer]: https://testnet.cspr.live/deploy/3ab866e7cf7b59e081f12aea4103f9552b261b601d91b072ea10ab5be6cf0e45\\n[nysa-deploy]: https://testnet.cspr.live/deploy/b1dd9628f8a36b7ed24949f88ea97ebb21d0c213e9cc87fc5ee4076074de0c88\\n[nysa-mint]: https://testnet.cspr.live/deploy/1def539f806fd39ec1b75687c46946c7510fe3bb15860fcc3420c7bea7e7f10f\\n[nysa-transfer]: https://testnet.cspr.live/deploy/0e2e0fa490f00783ddaecd06aaf2b43d8c5f6d3224a28a31ad66bfef48ce26e6\\n[open-zeppelin]: https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts\\n[oz-ownable]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n[oz-capped]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Capped.sol\\n[oz-burnable]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol"},{"id":"its-all-about-the-community","metadata":{"permalink":"/blog/its-all-about-the-community","source":"@site/blog/2023-06-27-we-are-here-to-stay/index.md","title":"It\'s all about the community!","description":"Over the past months,","date":"2023-06-27T00:00:00.000Z","formattedDate":"June 27, 2023","tags":[],"readingTime":2.825,"hasTruncateMarker":true,"authors":[{"name":"Maciej Zieli\u0144ski","title":"CTO","url":"https://github.com/zie1ony","key":"zie1ony"}],"frontMatter":{"slug":"its-all-about-the-community","title":"It\'s all about the community!","authors":["zie1ony"],"image":"./roadmap.png"},"prevItem":{"title":"Nysa","permalink":"/blog/Nysa"},"nextItem":{"title":"OpenAI writes ERC20 in Odra","permalink":"/blog/2023-02-27-openai-writes-erc20-in-odra"}},"content":"Over the past months,\\nwe have been working hard on bringing Odra to the Casper world.\\nWhile we are proud of what we have achieved so far,\\nthe hard part is just beginning.\\nSmart contract developers from outside of our team are starting to use Odra.\\nWe are thrilled about it and here is how we are going to support the community.\\n\\n\x3c!--truncate--\x3e\\n\\n## Hello Odra Community\\n\\nWhether you are a Rust developer, Solidity developer or a Casper enthusiast\\nwe are happy to have you here, reading this blog post.\\n\\nWe have built Odra to make smart contract development on Casper easy.\\nNow we are entering the next phase of the open source journey.\\nWe are going to focus on the community and make sure\\nOdra is the best tool for the job.\\nOur motto (we borrowed from the Django Project) is:\\n\\n> **We bring cutting-edge smart contract development tools to \\nprofessionals with deadlines.**\\n\\nHow will we do it? We are going to focus on four things:\\n- **Quality** - Our code and documentation will be of the highest quality.\\nWe will always have tons of tests and examples.\\n- **Simplicity** - The simplest solution is the best solution.\\nOdra\'s API needs to be simple and easy to use.\\nAlways!\\nWe are not afraid to take a few steps back and rethink our design.\\nWe believe in short feedback loops and fast iterations.\\n- **Reusability** - No one likes to repeat itself.\\nWe see a huge potential in Odra Modules.\\nIn time, it can become a standard library of Casper smart contracts,\\nthat are battle-tested and ready to use.\\n- **Community** - We are here to help you.\\nYou can always reach out to us on [Discord] or [Github].\\n\\n## We will help with your project\\n\\nWhether you are a Rust developer or not, you can start using Odra today.\\nWe have prepared a few [examples and docs] to help you get started.\\nRust knowledge required to use Odra is minimal.\\nThat was always the goal.\\n\\nBut we understand that it is hard to start.\\nWe got your back.\\n\\n> **We offer free consulting + 2 hours of live coding.**\\n\\nAll you have to do is write us an email at **contract@odra.dev**\\nwith a short description of your project.\\nWe will schedule a call and help you get started with Odra.\\nAfter 2 hours of live coding, you will have a working repository with 2 or 3 \\nsmart contracts, that you can use as a starting point for your project.\\n\\n## Roadmap\\n\\nThe feedback we got quite often was:\\n__It\'s nice, but will it last? What\'s the direction of the project?__\\nPoint taken. Now we answer: __We are here to stay.__\\nWe got the support from the Casper Association and some projects of our own\\nto keep us funded. We play the long game.\\n\\nTo systematize our work, we have prepared the [roadmap].\\nAs of now, we maintain plans for at least three future releases.\\nIt is a good balance between predictability and flexibility.\\nWe will release new versions approximately every 1-2 months or as needed.\\nEveryone is encouraged to propose a new Odra feature or enhancement.\\nNew proposals need to be discussed and approved by the core team.\\nWhen the feature is ready, we assign it to one of the future releases.\\n\\n![Odra Roadmap](./roadmap.png)\\n\\n[Discord]: https://discord.gg/Mm5ABc9P8k\\n[Github]: https://github.com/odradev/odra\\n[examples and docs]: https://odra.dev/docs\\n[roadmap]: https://github.com/odradev/odra/milestones"},{"id":"2023-02-27-openai-writes-erc20-in-odra","metadata":{"permalink":"/blog/2023-02-27-openai-writes-erc20-in-odra","source":"@site/blog/2023-02-27-openai-writes-erc20-in-odra/index.md","title":"OpenAI writes ERC20 in Odra","description":"OpenAI can write Odra smart contracts.","date":"2023-02-27T00:00:00.000Z","formattedDate":"February 27, 2023","tags":[],"readingTime":3.785,"hasTruncateMarker":true,"authors":[{"name":"Maciej Zieli\u0144ski","title":"CTO","url":"https://github.com/zie1ony","key":"zie1ony"}],"frontMatter":{"slug":"2023-02-27-openai-writes-erc20-in-odra","title":"OpenAI writes ERC20 in Odra","authors":["zie1ony"],"image":"./twitter-card.png"},"prevItem":{"title":"It\'s all about the community!","permalink":"/blog/its-all-about-the-community"},"nextItem":{"title":"Odra + CosmWasm","permalink":"/blog/odra-cosmwasm"}},"content":"OpenAI can write Odra smart contracts.\\nThis is how.\\n\\n\x3c!--truncate--\x3e\\n\\n## OpenAI\\nOpenAI already proved that AI can code.\\nGithub Copilot is used by more and more developers.\\nMany times it is mind-blowing how accurate it is.\\nIt would be great if one of the OpenAI models could simply work after writing:\\n\\n```\\nQ: Write the ERC20 smart contract.\\n\\nA: use odra::{Mapping, Variable}...\\n```\\n\\nSo far OpenAI hasn\'t indexed Odra. I even asked ChatGPT.\\n\\n```\\nQ: Do you know what is the Odra Framework for writing smart contracts?\\n Response in one sentence. Use Yoda style.\\n\\nA: Aware of an Odra Framework for writing smart contracts, I am not.\\n```\\n\\nSoon (year or two) it will happen and Odra will be supported out of the box,\\nsimply because it is available on GitHub.\\n\\n## DaVinci Edit\\n\\nOpenAI gives us a great tool called [Edit](https://openai.com/blog/gpt-3-edit-insert/).\\nIt uses the same technology Github Copiled it based on called [Codex](https://openai.com/blog/openai-codex/),\\nOpenAI gives us access to the model `code-davinci-edit-001`.\\nIt allows you to paste in the code and ask for changes.\\nSee more examples like rewriting Fibonacci to a recursive version [here](https://platform.openai.com/docs/guides/code/editing-code). \\n\\nBut it doesn\'t know Odra.\\nLuckily this is not a problem.\\nI have found a nice trick that allows producing the code I want.\\nWe simply have to present all the features of Odra and ask a good question.\\n\\n## ERC20 by AI\\n\\nThe goal is to bend AI to write the ERC20 token using Odra.\\nThe Edit query needs two elements:\\n* source code,\\n* text that describes what should be changed. \\n\\nAs the input source code I wrote the code that uses all the features ERC20 would use.\\nI need `odra::module`, `Variable`, `Mapping`, `caller()`, `Address`,\\nconstructor, and errors.\\n\\n```rust title=flipper.rs\\nuse odra::{Variable, types::Address, contract_env, Mapping, execution_error};\\n\\n#[odra::module]\\npub struct Flipper {\\n value: Variable<bool>,\\n flips_count: Variable<u32>,\\n owner: Variable<Address>,\\n messages: Mapping<(Address, Address), String>\\n}\\n\\n#[odra::module]\\nimpl Flipper {\\n #[odra(init)]\\n pub fn init(&mut self, owner: Address) {\\n self.value.set(false);\\n self.owner.set(owner);\\n }\\n\\n pub fn set(&mut self, value: bool) {\\n self.value.set(value);\\n }\\n\\n pub fn flip(&mut self) {\\n self.value.set(!self.get_value());\\n self.flips_count.set(self.flips_count.get_or_default());\\n }\\n\\n pub fn get_value(&self) -> bool {\\n self.value.get_or_default()\\n }\\n \\n pub fn get_owner(&self) -> Option<Address> {\\n self.owner.get()\\n }\\n\\n pub fn set_message(&mut self, recipient: Address, msg: String) {\\n let sender = contract_env::caller();\\n let current_msg = self.messages.get(&(sender, recipient));\\n match current_msg {\\n Some(_) => contract_env::revert(Error::MessageAlreadyDefined),\\n None => self.messages.set(&(sender, recipient), msg)\\n }\\n }\\n\\n pub fn get_message(&self, sender: Address, recipient: Address) -> String {\\n self.messages.get_or_default(&(sender, recipient))\\n }\\n}\\n\\nexecution_error! {\\n pub enum Error {\\n MessageAlreadyDefined => 1,\\n NotAnMessageSender => 2,\\n }\\n}\\n```\\n\\nChatGPT knows what the ERC20 is, so the kind request for changes is simple.\\n\\n```\\nQ: Implement another smart contract called ERC20.\\n Balances should be of type U256.\\n```\\n\\nThis is the result.\\n\\n```rust title=\\"ERC20 contract in Odra generated by OpenAI\\"\\nuse odra::{Variable, types::Address, contract_env, Mapping, execution_error, U256};\\n\\n#[odra::module]\\npub struct ERC20 {\\n name: Variable<String>,\\n symbol: Variable<String>,\\n decimals: Variable<u8>,\\n total_supply: Variable<U256>,\\n balances: Mapping<Address, U256>,\\n allowed: Mapping<(Address, Address), U256>\\n}\\n\\n#[odra::module]\\nimpl ERC20 {\\n #[odra(init)]\\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, total_supply: U256) {\\n self.name.set(name);\\n self.symbol.set(symbol);\\n self.decimals.set(decimals);\\n self.total_supply.set(total_supply);\\n self.balances.set(&contract_env::caller(), total_supply);\\n }\\n\\n pub fn total_supply(&self) -> U256 {\\n self.total_supply.get_or_default()\\n }\\n\\n pub fn balance_of(&self, owner: Address) -> U256 {\\n self.balances.get_or_default(&owner)\\n }\\n\\n pub fn transfer(&mut self, to: Address, value: U256) {\\n let from = contract_env::caller();\\n let from_balance = self.balances.get_or_default(&from);\\n let to_balance = self.balances.get_or_default(&to);\\n if from_balance < value {\\n contract_env::revert(Error::InsufficientBalance);\\n }\\n self.balances.set(&from, from_balance - value);\\n self.balances.set(&to, to_balance + value);\\n }\\n\\n pub fn transfer_from(&mut self, from: Address, to: Address, value: U256) {\\n let caller = contract_env::caller();\\n let from_balance = self.balances.get_or_default(&from);\\n let to_balance = self.balances.get_or_default(&to);\\n let allowed = self.allowed.get_or_default(&(from, caller));\\n if from_balance < value {\\n contract_env::revert(Error::InsufficientBalance);\\n }\\n if allowed < value {\\n contract_env::revert(Error::InsufficientAllowance);\\n }\\n self.balances.set(&from, from_balance - value);\\n self.balances.set(&to, to_balance + value);\\n self.allowed.set(&(from, caller), allowed - value);\\n }\\n\\n pub fn approve(&mut self, spender: Address, value: U256) {\\n let owner = contract_env::caller();\\n self.allowed.set(&(owner, spender), value);\\n }\\n\\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\\n self.allowed.get_or_default(&(owner, spender))\\n }\\n}\\n\\nexecution_error! {\\n pub enum Error {\\n InsufficientBalance => 1,\\n InsufficientAllowance => 2,\\n }\\n}\\n```\\n\\nWow!\\n\\n## What is next?\\n\\nAI already understands smart contracts.\\nIt had to read a lot of Solidity code.\\nI checked and it knows Uniswap and Compound source code.\\nMost interesting is that AI was able to implement a concept it already knew\\nfrom another programming language in the unseen Rust framework.\\nAt some point, we will be able to translate all the Solidity code to Odra.\\nOr maybe we will not have to...\\n\\nIt is hard to imagine how good it will be in 2025 and beyond."},{"id":"odra-cosmwasm","metadata":{"permalink":"/blog/odra-cosmwasm","source":"@site/blog/2023-02-15-odra-cosmos.md","title":"Odra + CosmWasm","description":"In November 2022 we released the first version of the Odra Framework. It\'s time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm.","date":"2023-02-15T00:00:00.000Z","formattedDate":"February 15, 2023","tags":[],"readingTime":5.96,"hasTruncateMarker":true,"authors":[{"name":"Krzysztof Pobiar\u017cyn","title":"Lead Developer","url":"https://github.com/kpob","key":"kpob"}],"frontMatter":{"slug":"odra-cosmwasm","title":"Odra + CosmWasm","authors":["kpob"],"image":"https://github.com/odradev.png"},"prevItem":{"title":"OpenAI writes ERC20 in Odra","permalink":"/blog/2023-02-27-openai-writes-erc20-in-odra"},"nextItem":{"title":"EVM at Risc0","permalink":"/blog/evm-at-risc0"}},"content":"In November 2022 we released [the first version](../blog/2022-11-30-release-020/index.md) of the Odra Framework. It\'s time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm.\\n\\n\x3c!--truncate--\x3e\\n\\n## CosmWasm\\n\\nCosmWasm is a smart contract platform for building dApps on the Cosmos blockchain ecosystem.\\nThe platform is designed as a module that can be integrated into the Cosmos SDK, enabling developers who are already building blockchains with the Cosmos SDK to easily incorporate CosmWasm smart contract functionality without the need to modify their existing code.\\n\\nIt uses the Rust programming language, so is potentially a perfect candidate for an Odra backend.\\nThere are many blockchains like [Osmosis], [Secret Network], [Juno] that utilize CosmWasm.\\n\\n## Show me your code\\n\\nI would like to write a `Counter` smart contract that is CosmWasm compatible.\\nWhat are the requirements?\\n\\n1. It should store a `u32` value. \\n2. The initial value it set by the contract deployer.\\n3. The value can be incremented.\\n4. The value can read from the storage.\\n5. The contract can call another contract and increment its counter.\\n\\nSo let\'s write an Odra module first.\\n\\n```rust title=counter.rs\\nuse odra::{types::{Address, event::OdraEvent}, Variable, contract_env};\\nuse self::events::{Init, ValueUpdated};\\n\\n#[odra::module]\\npub struct Counter {\\n pub value: Variable<u32>\\n}\\n\\n#[odra::module]\\nimpl Counter {\\n #[odra(init)]\\n pub fn init(&mut self, value: u32) {\\n self.value.set(value);\\n <Init as OdraEvent>::emit(Init {\\n value,\\n });\\n }\\n\\n pub fn increment(&mut self) {\\n let old_value = self.value.get_or_default();\\n let new_value = old_value + 1;\\n self.value.set(new_value);\\n \\n ValueUpdated {\\n old_value,\\n new_value,\\n operator: contract_env::caller()\\n }.emit();\\n }\\n\\n pub fn cross_increment(&mut self, counter_address: Address) {\\n CounterRef::at(counter_address).increment();\\n }\\n\\n pub fn get_value(&self) -> u32 {\\n self.value.get_or_default()\\n }\\n}\\n\\nmod events {\\n use odra::types::Address;\\n\\n #[derive(odra::Event)]\\n pub struct ValueUpdated {\\n pub old_value: u32,\\n pub new_value: u32,\\n pub operator: Address\\n }\\n \\n #[derive(odra::Event)]\\n pub struct Init {\\n pub value: u32,\\n }\\n}\\n\\n#[cfg(test)]\\nmod tests {\\n use super::*;\\n\\n #[test]\\n fn deploy() {\\n let counter = CounterDeployer::init(10);\\n assert_eq!(10, counter.get_value());\\n }\\n\\n #[test]\\n fn increment() {\\n let mut counter = CounterDeployer::init(10);\\n counter.increment();\\n assert_eq!(11, counter.get_value());\\n }\\n}\\n```\\nBut wait, I mentioned CosmWasm, did I?\\n\\nHere the beauty of Odra comes into play.\\n\\nLet\'s use `cargo-odra`.\\n```bash\\ncargo odra build -b cosmos\\n```\\nAnd... that\'s it, congratulations! We have just written and build our first CosmWasm contract.\\nAs you see, it is nothing different from building a contract for Casper. No additional code, we only changed the `-b` flag.\\n\\n## Deploy\\nWe have just built a wasm file, but is it really a fully functional contract?\\n\\nAs a battlefield let\'s choose [Juno Network] (if you would like to read more about smart contract development on Juno read this [Quick Start tutorial]). This is an arbitrary choice, each client is built upon a so-called Wasm Zone [wasmd], and its interface is alike.\\n\\nAssuming you already know how to interact with Juno testnet, let\'s move to the fun part.\\n\\nBut before we go, to keep things simple, let\'s prepare a [justfile]. It\'ll make our interactions with the blockchain much easier. See [full version].\\n\\n```justfile title=justfile\\nNODE := \\"--node https://rpc.uni.juno.deuslabs.fi:443\\"\\nCHAIN_ID := \\"--chain-id uni-6\\"\\nQUERY_FLAGS := NODE + \\" \\" + CHAIN_ID\\nTRANSACTION_DEFAULTS := \\"--gas-prices 0.025ujunox --gas auto --gas-adjustment 1.3 --broadcast-mode block\\"\\nEXEC_FLAGS := NODE + \\" \\" + CHAIN_ID + \\" \\" + TRANSACTION_DEFAULTS\\n\\nget-address NAME:\\n junod keys show {{NAME}} | grep -o juno.*\\n\\nstore-wasm WASM_PATH SENDER:\\n junod tx wasm store \\\\\\n {{WASM_PATH}} --from {{SENDER}} {{EXEC_FLAGS}}\\n\\ninit-contract CODE_ID VALUE SENDER CONTRACT_NAME:\\n junod tx wasm instantiate \\\\\\n {{CODE_ID}} \\\\\\n `just run-args-parser \'{\\"name\\": \\"init\\", \\"args\\": [ { \\"value\\" : {{VALUE}} }]}\'` \\\\\\n --label \'{{CONTRACT_NAME}}\' --from {{SENDER}} \\\\\\n --admin `just get-address {{SENDER}}` \\\\\\n {{EXEC_FLAGS}}\\n\\nexec-increment ADDRESS SENDER:\\n junod tx wasm execute \\\\\\n {{ADDRESS}} \\\\\\n `just run-args-parser \'{\\"name\\": \\"increment\\"}\'` \\\\\\n --from {{SENDER}} \\\\\\n {{EXEC_FLAGS}}\\n\\nquery-get-value ADDRESS:\\n junod q wasm contract-state smart {{ADDRESS}} \\\\\\n `just run-args-parser \'{\\"name\\": \\"get_value\\"}\'` {{QUERY_FLAGS}}\\n```\\n\\nOk, we are ready to go.\\n\\nFirst, a CosmWasm contract needs to be stored, technically is not a contract yet. Like a larva waiting to morph into a butterfly (sorry for that).\\n\\nThere are three ways to interact with a contract.\\n1. Instantiate - in other words, a constructor call. Once the contract is instantiated, it gets an address.\\n2. Execute - call an entrypoint that modifies the state.\\n3. Query - read the contract\'s state.\\n \\nNow, let\'s take a look at how to do it using the tools we have just prepared.\\n\\n```bash\\n# args: \\n# the path to a wasm file,\\n# the name under we store the private key.\\njust store-wasm counter.wasm odra\\n\\n...\\nraw_log: \'[{\\"events\\":[{\\"type\\":\\"message\\",\\"attributes\\":[{\\"key\\":\\"action\\",\\"value\\":\\"/cosmwasm.wasm.v1.MsgStoreCode\\"},{\\"key\\":\\"module\\",\\"value\\":\\"wasm\\"},{\\"key\\":\\"sender\\",\\"value\\":\\"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\\"}]},{\\"type\\":\\"store_code\\",\\"attributes\\":[{\\"key\\":\\"code_checksum\\",\\"value\\":\\"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59\\"},{\\"key\\":\\"code_id\\",\\"value\\":\\"286\\"}]}]}]\'\\n...\\ntxhash: 1A8BA520E980C5ABCBCFA6F62D68B6BB82E780544605DE4DD5C6B1C5E966441B\\n```\\n\\nGreat, our code is successfully stored. Form the logs we can read now the `code_id` which we will use to initialize the contract.\\n\\n```bash\\n# args: \\n# code id taken from the previous tx, \\n# counter initial value, \\n# named private key,\\n# contract label.\\njust init-contract 286 1 odra \\"My Counter\\"\\n\\n...\\nraw_log: \'[{\\"events\\":[{\\"type\\":\\"instantiate\\",\\"attributes\\":[{\\"key\\":\\"_contract_address\\",\\"value\\":\\"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\"},{\\"key\\":\\"code_id\\",\\"value\\":\\"286\\"}]},{\\"type\\":\\"message\\",\\"attributes\\":[{\\"key\\":\\"action\\",\\"value\\":\\"/cosmwasm.wasm.v1.MsgInstantiateContract\\"},{\\"key\\":\\"module\\",\\"value\\":\\"wasm\\"},{\\"key\\":\\"sender\\",\\"value\\":\\"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\\"}]},{\\"type\\":\\"wasm\\",\\"attributes\\":[{\\"key\\":\\"_contract_address\\",\\"value\\":\\"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\"},{\\"key\\":\\"value\\",\\"value\\":\\"1\\"}]},{\\"type\\":\\"wasm-Init\\",\\"attributes\\":[{\\"key\\":\\"_contract_address\\",\\"value\\":\\"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\"},{\\"key\\":\\"value\\",\\"value\\":\\"1\\"}]}]}]\'\\n...\\ntxhash: 8DC53F95805349C3763CF4AF9527CAB2AEBEC77B240EFD3801C61231D8748F26\\n```\\n\\nFantastic, the contract has been initialized and we have its address - `juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g`.\\nIt\'s time to increment the counter.\\n\\n```bash\\n# args:\\n# contract address taken from the previous tx,\\n# named private key\\njust exec-increment juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g odra\\n\\n...\\nraw_log: \'[{\\"events\\":[{\\"type\\":\\"execute\\",\\"attributes\\":[{\\"key\\":\\"_contract_address\\",\\"value\\":\\"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\"}]},{\\"type\\":\\"message\\",\\"attributes\\":[{\\"key\\":\\"action\\",\\"value\\":\\"/cosmwasm.wasm.v1.MsgExecuteContract\\"},{\\"key\\":\\"module\\",\\"value\\":\\"wasm\\"},{\\"key\\":\\"sender\\",\\"value\\":\\"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\\"}]},{\\"type\\":\\"wasm\\",\\"attributes\\":[{\\"key\\":\\"_contract_address\\",\\"value\\":\\"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\"},{\\"key\\":\\"action\\",\\"value\\":\\"increment\\"}]},{\\"type\\":\\"wasm-ValueUpdated\\",\\"attributes\\":[{\\"key\\":\\"_contract_address\\",\\"value\\":\\"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\"},{\\"key\\":\\"old_value\\",\\"value\\":\\"1\\"},{\\"key\\":\\"new_value\\",\\"value\\":\\"2\\"},{\\"key\\":\\"operator\\",\\"value\\":\\"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\\"}]}]}]\'\\n...\\ntxhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2\\n```\\n\\nFinally, we expected, the value to be equal to 2 (the initial value was 1 and we incremented it once).\\n\\n``` bash\\n# args:\\n# contract address\\njust query-get-value juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\n\\ndata: 2\\n```\\nIndeed, as expected the current counter value is 2.\\n\\n## Show me your transaction\\nI get it, you don\'t want to do it all by yourself. So let\'s take a closer look at one of my transactions.\\n\\n```bash\\njunod q tx 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 --node https://rpc.uni.juno.deuslabs.fi:443 --chain-id uni-6\\n...\\nlogs:\\n- events:\\n - attributes:\\n - key: _contract_address\\n value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\n type: execute\\n - attributes:\\n - key: action\\n value: /cosmwasm.wasm.v1.MsgExecuteContract\\n - key: module\\n value: wasm\\n - key: sender\\n value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\\n type: message\\n - attributes:\\n - key: _contract_address\\n value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\n - key: action\\n value: increment\\n type: wasm\\n - attributes:\\n - key: _contract_address\\n value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\\n - key: old_value\\n value: \\"1\\"\\n - key: new_value\\n value: \\"2\\"\\n - key: operator\\n value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\\n type: wasm-ValueUpdated\\n...\\ntxhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2\\n```\\n\\nIf you are familiar Cosmos ecosystem, you can see that there is an attribute containing\\nthe performed action (`increment`) (If there were some parameters, they would be included in this attribute).\\nWe can find here also our `ValueUpdated` event with its arguments `old_value`, `new_value` and `operator`.\\n\\nWow, we have it, everything worked as intended!\\n\\n## Conclusion\\nWouldn\'t it be great to replace [Casper Erc20] and [Cosmos Erc20] with a super-simple\\nsingle [Odra Erc20] implementation?\\n\\nThe `Counter` contract is just a POC, and there is still a long road ahead of us.\\nThis simple example shows that features like storage, events, and cross-contract calls\\ncan be unified in a simple readable interface.\\n\\nCosmWasm integration hasn\'t been published yet, but if you want to experiment by yourself, \\ncheck our GitHub (don\'t forget to update cargo-odra as well).\\n\\n## Join us\\nInterested?\\n\\nJoin [our Discord][odra-discord], [our Twitter][odra-twitter] or write us\\nat contact@odra.dev.\\n\\n[odra-discord]: https://discord.gg/Mm5ABc9P8k\\n[odra-twitter]: https://twitter.com/odradev\\n[Secret Network]: https://scrt.network/\\n[Osmosis]: https://docsosmosis.zone/\\n[Juno]: https://www.junonetwork.io/\\n[wasmd]: https://github.com/CosmWasm/wasmd\\n[`cargo-odra`]: https://odra.dev/docs/basics/cargo-odra\\n[Juno Network]: https://www.junonetwork.io/\\n[Quick Start tutorial]: https://medium.com/@NitroBiell/smart-contract-development-quick-start-on-juno-5dabf6fdcad0\\n[justfile]: https://github.com/casey/just\\n[full version]: https://github.com/odradev/odra/blob/feature/cosmos/odra-cosmos/juno-client/justfile\\n[Casper Erc20]: https://github.com/casper-ecosystem/erc20/tree/master/erc20/src\\n[Cosmos Erc20]: https://github.com/CosmWasm/cw-plus/tree/main/contracts/cw20-base/src\\n[Odra Erc20]: https://github.com/odradev/odra/blob/release/0.2.0/examples/src/erc20.rs"},{"id":"evm-at-risc0","metadata":{"permalink":"/blog/evm-at-risc0","source":"@site/blog/2023-02-13-evm-at-risc0.md","title":"EVM at Risc0","description":"Let\'s run Solidity code inside SputnikVM inside Risc0.","date":"2023-02-13T00:00:00.000Z","formattedDate":"February 13, 2023","tags":[],"readingTime":3.97,"hasTruncateMarker":true,"authors":[{"name":"Maciej Zieli\u0144ski","title":"CTO","url":"https://github.com/zie1ony","key":"zie1ony"}],"frontMatter":{"slug":"evm-at-risc0","title":"EVM at Risc0","authors":["zie1ony"],"image":"https://github.com/odradev.png"},"prevItem":{"title":"Odra + CosmWasm","permalink":"/blog/odra-cosmwasm"},"nextItem":{"title":"Zero Knowledge on Casper","permalink":"/blog/casper-zk-risc0"}},"content":"Let\'s run Solidity code inside [SputnikVM](https://github.com/rust-blockchain/evm/) inside [Risc0](https://github.com/risc0/risc0).\\n\\n\x3c!--truncate--\x3e\\nFirst make sure you know how Risc0 works.\\nMy [previous post](2022-12-12-casper-zk-risc0.md) explains it.\\n\\nIf you want to jump directly to the full code example, it\'s in the [repo](https://github.com/odradev/evm-at-risc0).\\n\\n## Solidity\\n\\nAs an example, I have this simple Solidity code.\\nIt is a calculator with two functions.\\nOne for addition and one for the nth Fibonacci number.\\n\\n```solidity title=\\"bytecode/Calculator.sol\\"\\ncontract Calculator {\\n function add(uint256 a, uint256 b) public pure returns (uint256) {\\n return a + b;\\n }\\n\\n function fibonacci(uint256 n) public returns (uint256) {\\n if (n <= 1) {\\n return n;\\n } else {\\n return fibonacci(n - 1) + fibonacci(n - 2);\\n }\\n }\\n}\\n```\\n\\nIt needs to be compiled into the byte code. `solc` can do this.\\n\\n```bash\\n$ solc \\\\\\n --bin-runtime \\\\\\n --optimize \\\\\\n --overwrite \\\\\\n --evm-version istanbul \\\\\\n --output-dir bytecode \\\\\\n bytecode/Calculator.sol \\n```\\n\\nIt produces an EVM bytecode in the `bytecode` directory.\\n\\n```bash\\n$ ls bytecode/\\nCalculator.bin-runtime Calculator.sol\\n```\\n\\n## EVM\\n\\nThe EVM I used is [SputnikVM](https://github.com/rust-blockchain/evm/).\\nMost important it is written in pure Rust and even with `no_std` mode.\\nThis way I can start an in-memory instance of EVM.\\nThen take the bytecode of a contract and install it.\\nFinally, call the contract with arguments and obtain the result value.\\nFor now, it\'s just a Rust code. Risc0 comes later.\\n\\nThe code is based on Sputnik\'s [benchmark test](https://github.com/rust-blockchain/evm/blob/master/benches/loop.rs).\\nHuge thanks to [Michael Birch](https://github.com/birchmd) for helping with Sputnik.\\nAlso make sure how EVM\'s [function selectors](https://solidity-by-example.org/function-selector) work.\\n\\n```rust title=\\"evm-runner/src/lib.rs\\"\\n\\n// Load previously compiled Calculator contract.\\npub const CALCULATOR_EVM_PROGRAM: &str = include_str!(\\n \\"../../bytecode/Calculator.bin-runtime\\"\\n);\\n\\n// Run Calculator for a given input.\\npub fn run_calc_contract(input: &str) -> String {\\n run_evm(CALCULATOR_EVM_PROGRAM, input)\\n}\\n\\n// Run a program (contract) for a given input. \\nfn run_evm(program: &str, input: &str) -> String {\\n\\n // Define EVM configuration.\\n let config = Config::istanbul();\\n\\tlet vicinity = MemoryVicinity {\\n\\t\\tgas_price: U256::zero(),\\n\\t\\torigin: H160::default(),\\n\\t\\tblock_hashes: Vec::new(),\\n\\t\\tblock_number: Default::default(),\\n\\t\\tblock_coinbase: Default::default(),\\n\\t\\tblock_timestamp: Default::default(),\\n\\t\\tblock_difficulty: Default::default(),\\n\\t\\tblock_gas_limit: Default::default(),\\n\\t\\tchain_id: U256::one(),\\n\\t\\tblock_base_fee_per_gas: U256::zero(),\\n\\t};\\n\\n // Initialized the state of EVM\'s memory.\\n\\tlet mut state = BTreeMap::new();\\n\\n // Add our contract under the 0x10 address.\\n state.insert(\\n\\t\\tH160::from_str(\\"0x1000000000000000000000000000000000000000\\")\\n .unwrap(),\\n\\t\\tMemoryAccount {\\n\\t\\t\\tnonce: U256::one(),\\n\\t\\t\\tbalance: U256::from(10000000),\\n\\t\\t\\tstorage: BTreeMap::new(),\\n\\t\\t\\tcode: hex::decode(program).unwrap(),\\n\\t\\t}\\n\\t);\\n\\n // Add new user 0xf0 that will be used as the contract caller.\\n state.insert(\\n\\t\\tH160::from_str(\\"0xf000000000000000000000000000000000000000\\")\\n .unwrap(),\\n\\t\\tMemoryAccount {\\n\\t\\t\\tnonce: U256::one(),\\n\\t\\t\\tbalance: U256::from(10000000),\\n\\t\\t\\tstorage: BTreeMap::new(),\\n\\t\\t\\tcode: Vec::new(),\\n\\t\\t},\\n\\t);\\n\\n // Prepare the executor.\\n\\tlet backend = MemoryBackend::new(&vicinity, state);\\n\\tlet metadata = StackSubstateMetadata::new(u64::MAX, &config);\\n\\tlet state = MemoryStackState::new(metadata, &backend);\\n\\tlet precompiles = BTreeMap::new();\\n\\tlet mut executor \\n = StackExecutor::new_with_precompiles(state, &config, &precompiles);\\n\\n // Call the 0x10 contract using the 0xf0 user.\\n // Use the input variable. \\n\\tlet (exit_reason, result) = executor.transact_call(\\n\\t\\tH160::from_str(\\"0xf000000000000000000000000000000000000000\\")\\n .unwrap(),\\n\\t\\tH160::from_str(\\"0x1000000000000000000000000000000000000000\\")\\n .unwrap(),\\n\\t\\tU256::zero(),\\n\\t\\thex::decode(input).unwrap(),\\n\\t\\tu64::MAX,\\n\\t\\tVec::new(),\\n\\t);\\n\\n // Make sure the execution succeeded.\\n assert!(exit_reason == ExitReason::Succeed(ExitSucceed::Returned));\\n \\n // Return hex encoded string.\\n hex::encode(result)\\n}\\n```\\n\\nLet\'s execute it. In below tests the `data` variable hold two things:\\nfunction selector and arguments.\\n\\nFor example `61047ff4000000000000000000000000000000000000000000000000000000000000000a`\\nis concatination of the function selector (first 8 chars) and 256-bit long argument.\\nIt is just `fibonacci(10)`. `a` is hex of `10` and `37` is hex of `52`. \\n\\n```rust title=\\"evm-runner/src/lib.rs\\"\\n#[test]\\nfn fibonacci_works() {\\n let data = \\"61047ff4000000000000000000000000000000000000000000000000000000000000000a\\";\\n let result = run_calc_contract(data);\\n assert_eq!(result, \\"0000000000000000000000000000000000000000000000000000000000000037\\"); \\n}\\n\\n#[test]\\nfn addition_works() {\\n let data = \\"771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002\\";\\n let result = run_calc_contract(data);\\n assert_eq!(result, \\"0000000000000000000000000000000000000000000000000000000000000009\\");\\n}\\n```\\n\\n## Risc0\\n\\nIt\'s time for `risc0`.\\n\\nFirst the guest program.\\nIt is super simple.\\nIt takes a string as an argument,\\npasses it to the `run_calc_contract`\\nand returns the result.\\n\\n```rust title=methods/guest/src/bin/evm_calc.rs\\n#![no_main]\\n#![no_std]\\n\\nextern crate alloc;\\n\\nuse alloc::{string::String};\\nuse risc0_zkvm::guest::{env};\\nuse evm_runner::run_calc_contract;\\n\\nrisc0_zkvm::guest::entry!(main);\\n\\npub fn main() {\\n let input: String = env::read();\\n let result = run_calc_contract(&input);\\n env::commit(&result);\\n}\\n```\\n\\nThe final step is calling it under ZK.\\n\\n```rust title=host/src/main.rs\\nfn main() {\\n println!(\\"Proving Calculator.add(7, 2)\\");\\n let input = \\"771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002\\";\\n let result = run_prover(input);\\n println!(\\"Proof generated. 7 + 2 = {result}\\");\\n \\n println!(\\"Proving Calculator.fibonacci(4)\\");\\n let input = \\"61047ff40000000000000000000000000000000000000000000000000000000000000004\\";\\n let result = run_prover(input);\\n println!(\\"Proof generated. fibonacci(4) = {result}\\");\\n}\\n\\nfn run_prover(input: &str) -> u32 {\\n // Make the prover.\\n let method_code = std::fs::read(EVM_CALC_PATH).unwrap();\\n let mut prover = Prover::new(&method_code, EVM_CALC_ID).unwrap();\\n\\n // Push the input as an argument.\\n prover.add_input_u32_slice(to_vec(input).unwrap().as_slice());\\n \\n // Execute the prover.\\n let receipt = prover.run().unwrap();\\n \\n // Verify the proof.\\n assert!(receipt.verify(EVM_CALC_ID).is_ok());\\n \\n // Return result as an u32 value.\\n let result: String = from_slice(receipt.journal.as_slice()).unwrap();\\n u32::from_str_radix(&result, 16).unwrap()\\n}\\n```\\n\\n```bash\\n$ cargo run --release -p host\\nProving Calculator.add(7, 2)\\nProof generated. 7 + 2 = 9\\nProving Calculator.fibonacci(4)\\nProof generated. fibonacci(4) = 3\\n```\\n\\n## Conclusion\\nHow amazing and mindblowing it is!\\nOf course, it\'s just a proof of concept.\\nYet with further development of Risc0 improving its proving time and\\nwith more flexible SputnikVM this approach is more than promising.\\n\\n## Join us\\nInterested?\\n\\nJoin [our Discord][odra-discord], [our Twitter][odra-twitter] or write us\\nat contact@odra.dev.\\n\\n[odra-discord]: https://discord.gg/Mm5ABc9P8k\\n[odra-twitter]: https://twitter.com/odradev"},{"id":"casper-zk-risc0","metadata":{"permalink":"/blog/casper-zk-risc0","source":"@site/blog/2022-12-12-casper-zk-risc0.md","title":"Zero Knowledge on Casper","description":"In this post, I present how to verify a zero knowledge proof on Casper.","date":"2022-12-12T00:00:00.000Z","formattedDate":"December 12, 2022","tags":[],"readingTime":4.215,"hasTruncateMarker":true,"authors":[{"name":"Maciej Zieli\u0144ski","title":"CTO","url":"https://github.com/zie1ony","key":"zie1ony"}],"frontMatter":{"slug":"casper-zk-risc0","title":"Zero Knowledge on Casper","authors":["zie1ony"],"image":"https://github.com/odradev.png"},"prevItem":{"title":"EVM at Risc0","permalink":"/blog/evm-at-risc0"},"nextItem":{"title":"Odra 0.2.0 Released","permalink":"/blog/release-020"}},"content":"In this post, I present how to verify a zero knowledge proof on Casper.\\n\x3c!--truncate--\x3e\\n\\n## Zero Knowledge\\nIn my opinion, the **zero knowledge** (ZK) is the largest revolution in \\nblockchains, since Ethereum introduced Turing-complete, account-based \\nsmart contracts.\\nTo put it in simple words, ZK enables two use cases not possible before:\\n\\n1. Computation scaling - I can perform expensive computation off-chain\\nand put the result on a chain with the proof.\\n2. Anonymity - I can prove to you, I know something without revealing it. \\n\\n## Risc Zero\\nI\'d like to introduce you to [Risc Zero](https://www.risczero.com/).\\nIt is the general purpose zero-knowledge virtual machine.\\nGo ahead and spend time reading their website!\\nFor us, the key component is the proof verifier that can be compiled into WASM.\\nSooo... we can run it on Casper :)\\nYes! We can prove any program, produce proof, and send it to Casper\'s\\nsmart contract for verification.\\n\\n## Example\\nLet\'s dive into the example to see how it works.\\n[The full example code](https://github.com/odradev/casper-zk-with-risc0)\\nyou can find on our GitHub. \\nIt is based on Risc Zero\'s [Hello, Multiply!](https://www.risczero.com/docs/examples/hello_multiply)\\nexample. So make sure you understand it first.\\n[Guest](#guest) and [Prover](#prover) sections are taken from this example.\\n\\n### Guest\\nThe program we are proving is called a **guest** in Risc Zero.\\nOur goal is to prove we know the factors of an arbitrary number.\\nGiven `a` and `b` below guest program computes `a * b` and produces\\na proof of computation.\\n\\n```rust title=\\"methods/guest/src/multiply.rs\\"\\npub fn main() {\\n // Load the first number from the host\\n let a: u64 = env::read();\\n // Load the second number from the host\\n let b: u64 = env::read();\\n // Verify that neither of them are 1 (i.e. nontrivial factors)\\n if a == 1 || b == 1 {\\n panic!(\\"Trivial factors\\")\\n }\\n // Compute the product while being careful with integer overflow\\n let product = a.checked_mul(b).expect(\\"Integer overflow\\");\\n env::commit(&product);\\n}\\n```\\n\\n### Prover\\nIt\'s time to run the guest program and build the proof for \\na specific `a` and `b` values.\\n\\n```rust title=\\"prover/src/main.rs\\"\\nfn main() {\\n // Pick two numbers.\\n let a: u64 = 17;\\n let b: u64 = 23;\\n\\n // First, we make the prover, loading the \'multiply\' method.\\n let multiply_src = std::fs::read(MULTIPLY_PATH)\\n .expect(\\"Method code should be present at the specified path.\\");\\n let mut prover = Prover::new(&multiply_src, MULTIPLY_ID)\\n .expect(\\"Prover should be constructed.\\",);\\n\\n // Next we send a & b to the guest.\\n prover.add_input_u32_slice(to_vec(&a).unwrap().as_slice());\\n prover.add_input_u32_slice(to_vec(&b).unwrap().as_slice());\\n \\n // Run prover & generate receipt\\n let receipt = prover.run()\\n .expect(\\"Valid code should be provable.\\");\\n\\n // Extract journal of receipt (i.e. output c, where c = a * b)\\n let c: u64 = from_slice(&receipt.journal)\\n .expect(\\"Journal output should deserialize.\\");\\n\\n // Print an assertion\\n println!(\\"I know the factors of {}, and I can prove it!\\", c);\\n\\n // Verify receipt, panic if it\'s wrong.\\n receipt.verify(MULTIPLY_ID).expect(\\n \\"Code you have proven should successfully verify.\\",\\n );\\n\\n // Convert journal to string and store on disk.\\n let journal = serde_json::to_string(&receipt.journal).unwrap();\\n write_to_file(\\"../data/journal\\", &journal);\\n\\n // Convert seal to string and store on disk.\\n let seal = serde_json::to_string(&receipt.seal).unwrap();\\n write_to_file(\\"../data/seal\\", &seal);\\n\\n // Convert method_id to string and store on disk.\\n let result = serde_json::to_string(MULTIPLY_ID).unwrap();\\n write_to_file(\\"../data/method\\", &result);\\n}\\n```\\n\\n### Verifier\\nNow the verification step.\\nGiven the proof (journal + seal) and the guest program definition (method),\\nCasper\'s smart contract checks its correctness. This one is written\\njust for the demonstration, but in general you want `METHOD_ID` to be\\nstored in your contract and both `SEAL` and `JOURNAL` to be passed to\\nthe contract via arguments from the outside.\\n\\n```rust title=\\"verifier/src/verifier_contract.rs\\"\\n// Import the proof and the method.\\nconst METHOD_ID: &[u8] = &include!(\\"../../data/method\\");\\nconst SEAL: &[u32] = &include!(\\"../../data/seal\\");\\nconst JOURNAL: &[u32] = &include!(\\"../../data/journal\\");\\n\\n// Verifier contract holds a result of the zk verification. \\n#[odra::module]\\npub struct Verifier {\\n result: Variable<String>,\\n}\\n\\n#[odra::module]\\nimpl Verifier {\\n // Calling this entry point triggers the zk proof verification.\\n pub fn verify(&mut self) {\\n let result = verify(JOURNAL, SEAL, METHOD_ID);\\n self.result.set(result);\\n }\\n\\n // Result getter.\\n pub fn result(&self) -> String {\\n self.result.get().unwrap_or(String::from(\\"Not processed\\"))\\n }\\n}\\n\\n// The verification method. It constructs new Receipt and verifies it.\\nfn verify(journal: &[u32], seal: &[u32], method_id: &[u8]) -> String {\\n let result = Receipt::new(&journal, &seal).verify(method_id);\\n\\n match result {\\n Ok(()) => String::from(\\"Ok\\"),\\n Err(err) => format!(\\"Error: {}\\", err.to_string())\\n }\\n}\\n```\\n\\n### Livenet results\\nI have deployed it to the testnet and called the `verify` method.\\nThe `result` was `Ok`. Wow, first-ever ZK proof verification on Casper.\\nTrustless bridging, layer 2 here we come :)\\n\\nThe cost of running the `verify` method is `2324 CSPR`. That\'s a lot, but\\nwe have to start somewhere.\\n\\n## What next\\nI think it is a good place to outline possible Casper ZK goals for moving\\nthis forward. The community should discuss: \\n1. Building more examples. Risc Zero has a nice battleship game to port over\\nto Casper.\\n2. Adding Risc Zero verification method to Casper\'s FFI.\\n3. Supporting Risc Zero team. We should help develop this awesome\\nopen-source project and gain the ZK expertise.\\n\\n## Join us\\nInterested in zero knowledge on Casper?\\n\\nJoin [our Discord][odra-discord], [our Twitter][odra-twitter] or write us\\nat contact@odra.dev.\\n\\n[odra-discord]: https://discord.gg/Mm5ABc9P8k\\n[odra-twitter]: https://twitter.com/odradev"},{"id":"release-020","metadata":{"permalink":"/blog/release-020","source":"@site/blog/2022-11-30-release-020/index.md","title":"Odra 0.2.0 Released","description":"We want to introduce you to the very first public release of the Odra Framework proudly!","date":"2022-11-30T00:00:00.000Z","formattedDate":"November 30, 2022","tags":[],"readingTime":3.07,"hasTruncateMarker":true,"authors":[{"name":"Kuba P\u0142askonka","title":"Lead Developer","url":"https://github.com/kubaplas","key":"kubaplas"},{"name":"Krzysztof Pobiar\u017cyn","title":"Lead Developer","url":"https://github.com/kpob","key":"kpob"},{"name":"Maciej Zieli\u0144ski","title":"CTO","url":"https://github.com/zie1ony","key":"zie1ony"}],"frontMatter":{"slug":"release-020","title":"Odra 0.2.0 Released","authors":["kubaplas","kpob","zie1ony"],"image":"https://github.com/odradev.png"},"prevItem":{"title":"Zero Knowledge on Casper","permalink":"/blog/casper-zk-risc0"}},"content":"We want to introduce you to the very first public release of the Odra Framework proudly!\\n\\n\x3c!--truncate--\x3e\\n\\n## A bit of history\\nMore than a year ago Maciej Zieli\u0144ski resigned from the position of Ecosystem Leader at [CasperLabs][casperlabs].\\nAlong with Krzysztof Pobiar\u017cyn and Kuba P\u0142askonka, we formed an engineering team dedicated to smart contracts.\\n\\nLooking at the blockchain ecosystems from the smart contract developer perspective there are two universes.\\nThe first one is Solidity, which thrives and is at its best now.\\nIt has a ton of well-tested code and security tooling.\\nWhenever an EVM-based blockchain pops out it gets populated by forks of DeFi and DAO protocols.\\nFascinating network effect emerges - code written for one EVM-based blockchain can be run on every other EVM-based blockchain.\\nThe second universe is Rust which compiles to WebAssembly.\\nHere developer communities live in the guarded cities of Polkadot, Cosmos, Solana, Casper, and Near. \\nThe code written for one platform is not portable.\\nThe network effect never had a chance to arise.\\n\\nThe main reason why Odra exists is achieving this cross-chain code reusability.\\nWe could paraphrase a bit and say:\\n\\"One to bring them all and in the code bind them.\\"\\n\\n## Odra for Casper\\nThe very first blockchain we have integrated with Odra is Casper.\\nIn comparison to [casper-contract][casper-contract] API, it greatly cuts development time and offers a much lower entry level.\\nThe Odra interface is developer friendly and people familiar with Solidity, [Ink][ink], or [Near][near-sdk] will feel like at home.\\nWe hope it will unleash the creativity and bring a whole bunch of products onto Casper.\\n\\n## Odra Framework\\n\\nOdra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design.\\nBuilt by experienced developers, it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel.\\nIt\'s free and open source.\\n\\nOdra\'s goal is to become the go-to smart contract framework for all WebAssembly-based blockchains. \\n\\nA smart contract written using Odra can be executed on all integrated systems.\\nWe can do it by abstracting over core concepts that all the above systems are built around. \\nThese are type system, storage, entry points, execution context, and testing environment.\\nWe believe it will bring standardization to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this ecosystem.\\n\\nLet\u2019s look at a Flipper contract, that holds a boolean value.\\nThe contract has a constructor that sets the initial value, and two entry points: `flip()` and `get()`, to change and query the current value, respectively.\\n\\n```rust\\nuse odra::Variable;\\n\\n#[odra::module]\\npub struct Flipper {\\n value: Variable<bool>,\\n}\\n\\n#[odra::module]\\nimpl Flipper {\\n\\n #[odra(init)]\\n pub fn init(&mut self, value: bool) {\\n self.value.set(value);\\n }\\n\\n pub fn flip(&mut self) {\\n self.value.set(!self.get());\\n }\\n\\n pub fn get(&self) -> bool {\\n self.value.get_or_default()\\n }\\n}\\n```\\n\\nIt comes with the CLI tool [cargo-odra][cargo-odra] that makes it easy to use Odra.\\n\\n![cargo-odra](./cargo_odra.gif)\\n\\nNeat and simple, isn\'t it? Do you like it? Start flowing with us!\\n\\n## What next\\n\\nLet\'s be honest, we are just starting.\\nThe codebase is still hot.\\nOn the other hand, we are happy with the interfaces we designed.\\nNow is the time to write documentation and tutorials.\\nWe are also building the modules library inspired by [OpenZeppelin][open-zeppelin].\\nThe security code audit is still ahead of us.\\n\\n## Join us\\n\\nCheck out the [Odra GitHub repository][odra-repo] for more info on how to get the most out of Odra. \\nShould you have questions, join [our Discord][odra-discord], [our Twitter][odra-twitter] or write us at contact@odra.dev.\\n\\n[casperlabs]: https://casperlabs.io\\n[odra-repo]: https://github.com/odradev/odra\\n[cargo-odra]: https://github.com/odradev/cargo-odra\\n[odra-discord]: https://discord.gg/Mm5ABc9P8k\\n[odra-twitter]: https://twitter.com/odradev\\n[casper-contract]: https://crates.io/crates/casper-contract\\n[ink]: https://crates.io/crates/ink_lang\\n[near-sdk]: https://crates.io/crates/near-sdk\\n[open-zeppelin]: https://github.com/OpenZeppelin/openzeppelin-contracts/"}]}')}}]); \ No newline at end of file diff --git a/docs/assets/js/b338949b.ed59f570.js b/docs/assets/js/b338949b.ed59f570.js new file mode 100644 index 000000000..1067b4b3f --- /dev/null +++ b/docs/assets/js/b338949b.ed59f570.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[32103],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=s(n),m=r,b=p["".concat(c,".").concat(m)]||p[m]||d[m]||o;return n?a.createElement(b,l(l({ref:t},u),{},{components:n})):a.createElement(b,l({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"},60208:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-0.5.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.",source:"@site/versioned_docs/version-0.5.0/advanced/04-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.5.0/advanced/attributes",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.5.0/advanced/advanced-storage"},next:{title:"Signatures",permalink:"/docs/0.5.0/advanced/signatures"}},c={},s=[{value:"Init",id:"init",level:2},{value:"Example",id:"example",level:3},{value:"Using",id:"using",level:2},{value:"Example",id:"example-1",level:3},{value:"Payable",id:"payable",level:2},{value:"Example",id:"example-2",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:s};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attributes"},"Attributes"),(0,r.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution."),(0,r.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,r.kt)("h2",{id:"init"},"Init"),(0,r.kt)("p",null,"If your contract needs initial setup, adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed."),(0,r.kt)("p",null,"It's important to note that a constructor function should not be invoked in any other context."),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/erc20.rs",title:"examples/src/contracts/erc20.rs"},"#[odra(init)]\npub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n}\n")),(0,r.kt)("h2",{id:"using"},"Using"),(0,r.kt)("p",null,"An attribute applicable to struct fields. The ",(0,r.kt)("inlineCode",{parentName:"p"},"using")," attribute accepts multiple values, separated by ",(0,r.kt)("inlineCode",{parentName:"p"},","),".\nEach value attribute must point at an existing field."),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n access_control: AccessControl,\n meta: Metadata,\n #[odra(using = "access_control, meta")]\n // #[odra(using = "access_control, metadata")] - would not compile - `metadata` field does not exist\n storage: Storage\n}\n\n#[odra::module]\nstruct AccessControl {\n owner: Variable<Address>\n}\n\n#[odra::module]\nstruct Metadata {\n version: Variable<String>\n}\n\n#[odra::module]\nstruct Storage {\n value: Variable<u8>,\n access_control: AccessControl,\n meta: Metadata\n}\n')),(0,r.kt)("h2",{id:"payable"},"Payable"),(0,r.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,r.kt)("h3",{id:"example-2"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = contract_env::caller();\n let amount: Balance = contract_env::attached_value();\n let current_block_time: BlockTime = contract_env::get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n contract_env::revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n Deposit {\n address: caller,\n amount\n }\n .emit();\n}\n")),(0,r.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,r.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,r.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,r.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,r.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,r.kt)("p",null,"In Odra you can just apply the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,r.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,r.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"or "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"In both cases attributes order does not matter."),(0,r.kt)("p",null,"However, a constructor cannot be payable, so the below code would not compile."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(init)]\nfn initialize() {\n // your logic...\n}\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b435d362.b8ed03e8.js b/docs/assets/js/b435d362.b8ed03e8.js new file mode 100644 index 000000000..7072a6307 --- /dev/null +++ b/docs/assets/js/b435d362.b8ed03e8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37150],{43396:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.4.0/category/examples","navigation":{"previous":{"title":"Casper","permalink":"/docs/0.4.0/backends/casper"},"next":{"title":"odra-examples","permalink":"/docs/0.4.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/b4f02106.8e03b0b8.js b/docs/assets/js/b4f02106.8e03b0b8.js new file mode 100644 index 000000000..b068831eb --- /dev/null +++ b/docs/assets/js/b4f02106.8e03b0b8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[1442],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},c),{},{components:t})):a.createElement(f,l({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d<o;d++)l[d]=t[d];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},73437:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={},l="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.6.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.6.0/advanced/02-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.6.0/advanced/delegate",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Module reusing",permalink:"/docs/0.6.0/advanced/using"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.6.0/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n pub fn approve(&mut self, spender: Address, amount: U256);\n pub fn name(&self) -> String;\n pub fn symbol(&self) -> String;\n pub fn decimals(&self) -> u8;\n pub fn total_supply(&self) -> U256;\n pub fn balance_of(&self, owner: Address) -> U256;\n pub fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n pub fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: Ownable,\n erc20: Erc20,\n exchange: Exchange\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n pub fn swap(&mut self, sender: Address, recipient: Address);\n pub fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b50b03ee.0ecca809.js b/docs/assets/js/b50b03ee.0ecca809.js new file mode 100644 index 000000000..d0948c6a1 --- /dev/null +++ b/docs/assets/js/b50b03ee.0ecca809.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[45486],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=n[l];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},57740:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.9.1/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.9.1/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.9.1/basics/events",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.9.1/basics/errors"},next:{title:"Casper Contract Schema",permalink:"/docs/0.9.1/basics/casper-contract-schema"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract;\n\n#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64\n}\n\n#[odra::module]\nimpl PartyContract {\n pub fn init(&self) {\n self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n });\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64,\n}\n")),(0,a.kt)("p",null,"To emit an event, we use the ",(0,a.kt)("inlineCode",{parentName:"p"},"emit_event")," function from the ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),", passing the event as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n});\n")),(0,a.kt)("p",null,"To determine all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The registered events will also be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a few functions which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},'use super::{PartyContractHostRef, PartyStarted};\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\n#[test]\nfn test_party() {\n let test_env: HostEnv = odra_test::env();\n let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);\n test_env.emitted_event(\n party_contract.address(),\n &PartyStarted {\n caller: test_env.get_account(0),\n block_time: 0\n }\n );\n // If you do not want to check the exact event, you can use `emitted` function\n test_env.emitted(party_contract.address(), "PartyStarted");\n // You can also check how many events were emitted.\n assert_eq!(test_env.events_count(party_contract.address()), 1);\n}\n')),(0,a.kt)("p",null,"To explore more event testing functions, check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b548b5e0.1f669fd4.js b/docs/assets/js/b548b5e0.1f669fd4.js new file mode 100644 index 000000000..ea3e54370 --- /dev/null +++ b/docs/assets/js/b548b5e0.1f669fd4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41810],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},7954:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.4.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.4.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.4.0/",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.4.0/category/getting-started"}},c={image:r(34954).Z},l=[{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean,\npragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open\nsource."),(0,o.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains."),(0,o.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems. We can do it\nby abstracting over core concepts that all the above systems are built around. These are type system,\nstorage, entry points, execution context, and testing environment. We believe it will bring standardization\nto the development of Rust-based smart contracts and enable code reusability we have not yet seen in this\necosystem."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.4.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.4.0/getting-started/flipper"},"Flipper example"),"\nto find out how to start your new project with Odra."))}p.isMDXComponent=!0},34954:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/b6aaec29.43153ad9.js b/docs/assets/js/b6aaec29.43153ad9.js new file mode 100644 index 000000000..6de0a3b65 --- /dev/null +++ b/docs/assets/js/b6aaec29.43153ad9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[61655],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,v=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c<s;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},63510:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.6.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.6.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.6.0/basics/events",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.6.0/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.6.0/basics/cross-calls"}},l={},c=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Different blockchains implement events in different ways. Odra lets you forget about it by introducing\nOdra Events. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::{Event, contract_env};\nuse odra::types::{Address, BlockTime, event::OdraEvent};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract {\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n\n#[odra::module]\nimpl PartyContract {\n #[odra(init)]\n pub fn init(&self) {\n PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n }.emit();\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, we derive an ",(0,a.kt)("inlineCode",{parentName:"p"},"Event")," macro like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n")),(0,a.kt)("p",null,"Among other things, it adds an ",(0,a.kt)("inlineCode",{parentName:"p"},"emit()")," function to the struct, which allows you to emit the event simply\nas that:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n}.emit();\n")),(0,a.kt)("p",null,"Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. "),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a handy macro ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::{assert_events, test_env};\nuse crate::features::events::PartyStarted;\nuse super::PartyContractDeployer;\n\n#[test]\nfn test_party() {\n let party_contract = PartyContractDeployer::init();\n assert_events!(\n party_contract,\n PartyStarted {\n caller: test_env::get_account(0),\n block_time: 0,\n }\n );\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b6d3d7c8.b5c90ec5.js b/docs/assets/js/b6d3d7c8.b5c90ec5.js new file mode 100644 index 000000000..c6cc52d67 --- /dev/null +++ b/docs/assets/js/b6d3d7c8.b5c90ec5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59158],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s(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 l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},36748:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",s={unversionedId:"basics/cargo-odra",id:"version-1.0.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-1.0.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/basics/cargo-odra",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/category/basics"},next:{title:"Directory structure",permalink:"/docs/basics/directory-structure"}},l={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Generating contract schema",id:"generating-contract-schema",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them with various configurations."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This creates a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"The third available template is ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace"),", which creates a workspace with two projects, similar to the one created\nwith the ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template."),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 1.0.0 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it creates a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This creates a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"The most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It runs your tests against Odra's ",(0,r.kt)("inlineCode",{parentName:"p"},"MockVM"),". It is substantially faster than ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM"),"\nand implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra builds the project, generates the wasm files,\nspin up ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM")," instance, deploys the contracts onto it and runs the tests against it. Pretty neat."),(0,r.kt)("p",null,"Keep in mind that this is a lot slower than ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," and you cannot use the debugger.\nThis is why ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build\n")),(0,r.kt)("p",null,"If the build process finishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder.\nNotice, that this command does not require the ",(0,r.kt)("inlineCode",{parentName:"p"},"-b")," option."),(0,r.kt)("p",null,"If you want to build specific contract, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -c counter # you pass many comma separated contracts\n")),(0,r.kt)("h2",{id:"generating-contract-schema"},"Generating contract schema"),(0,r.kt)("p",null,"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"schema")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema \n")),(0,r.kt)("p",null,"This generates a schema file in JSON format for all your contracts and places them in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder.\nIf the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder does not exist, it creates the folder for you."),(0,r.kt)("p",null,"Like with the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," command, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option to generate a schema for a specific contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b70aea30.a6277723.js b/docs/assets/js/b70aea30.a6277723.js new file mode 100644 index 000000000..0e06b299b --- /dev/null +++ b/docs/assets/js/b70aea30.a6277723.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[15705],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),f=a,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||o;return n?r.createElement(m,s(s({ref:t},d),{},{components:n})):r.createElement(m,s({ref:t},d))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},22242:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.8.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.8.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.8.0/basics/native-token",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.8.0/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.8.0/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"native-token"},"Native token"),(0,a.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::prelude::*;\nuse odra::casper_types::U512;\n\n#[odra::module]\npub struct PublicWallet;\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {}\n\n pub fn withdraw(&mut self, amount: &U512) {\n self.env().transfer_tokens(&self.env().caller(), amount);\n }\n}\n")),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,a.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,a.kt)("inlineCode",{parentName:"p"},"examples/src/contracts/tlw.rs")," in the odra main repository.")),(0,a.kt)("p",null,"You can see a new attribute used here: ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv::transfer_tokens()"),".\nIt does exactly what you are expecting it to do - it transfers native tokens from the contract to the\nspecified address."),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a function -\n",(0,a.kt)("inlineCode",{parentName:"p"},"balance_of"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"#[cfg(test)]\nmod tests {\n use super::PublicWalletHostRef;\n use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);\n assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());\n\n my_contract.with_tokens(U512::from(100)).deposit();\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));\n\n my_contract.withdraw(U512::from(25));\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b7573e33.11d8a8e5.js b/docs/assets/js/b7573e33.11d8a8e5.js new file mode 100644 index 000000000..2d94c9000 --- /dev/null +++ b/docs/assets/js/b7573e33.11d8a8e5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67897],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var r=a(67294);function n(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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(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){n(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 s(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var i=r.createContext({}),u=function(e){var t=r.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=u(e.components);return r.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=u(a),m=n,h=p["".concat(i,".").concat(m)]||p[m]||c[m]||o;return a?r.createElement(h,l(l({ref:t},d),{},{components:a})):r.createElement(h,l({ref:t},d))}));function m(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,l=new Array(o);l[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:n,l[1]=s;for(var u=2;u<o;u++)l[u]=a[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,a)}p.displayName="MDXCreateElement"},51464:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var r=a(87462),n=(a(67294),a(3905));const o={},l="Module Composer",s={unversionedId:"advanced/composer",id:"version-0.3.0/advanced/composer",title:"Module Composer",description:"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.",source:"@site/versioned_docs/version-0.3.0/advanced/01-composer.md",sourceDirName:"advanced",slug:"/advanced/composer",permalink:"/docs/0.3.0/advanced/composer",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Advanced",permalink:"/docs/0.3.0/category/advanced"},next:{title:"Delegate",permalink:"/docs/0.3.0/advanced/delegate"}},i={},u=[{value:"Conceptual Overview",id:"conceptual-overview",level:2},{value:"Usage",id:"usage",level:2},{value:"Conclusion",id:"conclusion",level:2}],d={toc:u};function c(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"module-composer"},"Module Composer"),(0,n.kt)("p",null,"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples."),(0,n.kt)("h2",{id:"conceptual-overview"},"Conceptual Overview"),(0,n.kt)("p",null,"By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n value: Variable<u8>, // the default namespace would be "contract_value"\n module: Module\n}\n\n#[odra::module]\nstruct Module {\n secret: Variable<String> // the default namespace would be "contract_module_secret"\n}\n')),(0,n.kt)("p",null,"While this isolation often proves useful, there are scenarios where shared storage is beneficial. Here, the Module Composer comes in."),(0,n.kt)("p",null,"Additionally, the Module Composer shortens the storage key - a handy side effect of shared storage. "),(0,n.kt)("p",null,"For each module, Odra generates a corresponding Composer struct (e.g., ",(0,n.kt)("inlineCode",{parentName:"p"},"MyContractComposer")," for ",(0,n.kt)("inlineCode",{parentName:"p"},"MyContract")," module), which aids in manual module composition."),(0,n.kt)("h2",{id:"usage"},"Usage"),(0,n.kt)("p",null,"By default, the #","[odra::module]"," macro generates an implementation of the odra::Instance trait, prefixing the storage key of child modules with the parent namespace. To disable this behavior, pass the ",(0,n.kt)("inlineCode",{parentName:"p"},"skip_instance")," argument to the #","[odra::module]"," macro."),(0,n.kt)("p",null,"Let's write a simple code example. The example provided below introduces some additional complexity by featuring deeper module nesting."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::{Instance, Variable};\n\n#[odra::module]\npub struct SharedStorage {\n pub value: Variable<String>\n}\n\n#[odra::module]\npub struct MyStorage {\n pub shared: SharedStorage,\n pub version: Variable<u8>\n}\n\n#[odra::module]\npub struct MoreStorage {\n pub my_storage: MyStorage,\n pub extra: Variable<u32>\n}\n\n#[odra::module(skip_instance)]\npub struct ComplexContract {\n pub shared: SharedStorage,\n pub more_storage: MoreStorage\n}\n\n#[odra::module]\nimpl ComplexContract {\n #[odra(init)]\n pub fn init(&mut self, version: u8, value: String, extra: u32) {\n self.more_storage.my_storage.version.set(version);\n self.shared.value.set(value);\n self.more_storage.extra.set(extra);\n }\n\n pub fn get_value(&self) -> String {\n self.shared.value.get_or_default()\n }\n\n pub fn get_value_via_storage(&self) -> String {\n self.more_storage.my_storage.shared.value.get_or_default()\n }\n\n pub fn get_extra_value(&self) -> u32 {\n self.more_storage.extra.get_or_default()\n }\n}\n\nimpl Instance for ComplexContract {\n fn instance(namespace: &str) -> Self {\n let shared = SharedStorageComposer::new(namespace, "shared").compose();\n let my_storage = MyStorageComposer::new(namespace, "my_storage")\n .with_shared(&shared)\n .compose();\n let more_storage = MoreStorageComposer::new(namespace, "more_storage")\n .with_my_storage(&my_storage)\n .compose();\n Self { shared, more_storage }\n }\n}\n\n#[cfg(test)]\nmod test {\n use crate::composer::ComplexContractDeployer;\n\n #[test]\n fn t() {\n let shared_value = "shared_value".to_string();\n let extra_value: u32 = 314;\n let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);\n\n assert_eq!(token.get_value(), shared_value);\n assert_eq!(token.get_value_via_storage(), shared_value);\n assert_eq!(token.get_extra_value(), extra_value);\n }\n}\n')),(0,n.kt)("p",null,"In this example, we've introduced a new module, ",(0,n.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", which nests ",(0,n.kt)("inlineCode",{parentName:"p"},"MyStorage")," and includes an extra value. The ",(0,n.kt)("inlineCode",{parentName:"p"},"ComplexContract")," contains ",(0,n.kt)("inlineCode",{parentName:"p"},"SharedStorage")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels."),(0,n.kt)("p",null,"If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:"),(0,n.kt)("ol",null,(0,n.kt)("li",{parentName:"ol"},"On the contract level - ",(0,n.kt)("inlineCode",{parentName:"li"},"contract_shared_value"),"."),(0,n.kt)("li",{parentName:"ol"},"On the ",(0,n.kt)("inlineCode",{parentName:"li"},"MyStorage")," module level - ",(0,n.kt)("inlineCode",{parentName:"li"},"contract_more_storage_shared_value"),".")),(0,n.kt)("p",null,"This example showcases how you can effectively use the Module Composer feature to build intricate and efficient smart contracts."),(0,n.kt)("h2",{id:"conclusion"},"Conclusion"),(0,n.kt)("p",null,"The Module Composer in Odra provides developers with a high level of flexibility and control over module behavior in their smart contracts. This guide, complete with a practical example, should give you a good understanding of the feature. Embrace the power of the Module Composer and unleash the full potential of your smart contracts!"))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b759477d.7077244e.js b/docs/assets/js/b759477d.7077244e.js new file mode 100644 index 000000000..37ac1f710 --- /dev/null +++ b/docs/assets/js/b759477d.7077244e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[10079],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},95150:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.2.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.2.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.2.0/",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"defaultSidebar",next:{title:"Getting started",permalink:"/docs/0.2.0/category/getting-started"}},c={image:r(72709).Z},l=[{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean,\npragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open\nsource."),(0,o.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains."),(0,o.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems. We can do it\nby abstracting over core concepts that all the above systems are built around. These are type system,\nstorage, entry points, execution context, and testing environment. We believe it will bring standardization\nto the development of Rust-based smart contracts and enable code reusability we have not yet seen in this\necosystem."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.2.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.2.0/getting-started/flipper"},"Flipper example"),"\nto find out how to start your new project with Odra."))}p.isMDXComponent=!0},72709:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/b7d3ed64.de32a7f7.js b/docs/assets/js/b7d3ed64.de32a7f7.js new file mode 100644 index 000000000..6def56221 --- /dev/null +++ b/docs/assets/js/b7d3ed64.de32a7f7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[98666],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=p(n),d=a,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},14454:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",i={unversionedId:"getting-started/flipper",id:"version-0.3.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.3.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.3.0/getting-started/flipper",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"Installation",permalink:"/docs/0.3.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.3.0/category/basics"}},s={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Variable;\n\n/// A module definition. Each module struct consists Variables and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Variable<bool>,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let mut contract1 = FlipperDeployer::initial_settings();\n let contract2 = FlipperDeployer::initial_settings();\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b87f41d0.ee3d1ad7.js b/docs/assets/js/b87f41d0.ee3d1ad7.js new file mode 100644 index 000000000..f944b8ae6 --- /dev/null +++ b/docs/assets/js/b87f41d0.ee3d1ad7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97752],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=p(n),d=a,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},82979:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",i={unversionedId:"getting-started/flipper",id:"version-0.3.1/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.3.1/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.3.1/getting-started/flipper",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.3.1/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.3.1/category/basics"}},s={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.1/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Variable;\n\n/// A module definition. Each module struct consists Variables and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Variable<bool>,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let mut contract1 = FlipperDeployer::initial_settings();\n let contract2 = FlipperDeployer::initial_settings();\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/b94504cb.72965cbe.js b/docs/assets/js/b94504cb.72965cbe.js new file mode 100644 index 000000000..5a9e61868 --- /dev/null +++ b/docs/assets/js/b94504cb.72965cbe.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[24415],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(c,".").concat(m)]||d[m]||p[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},70872:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Attributes",l={unversionedId:"advanced/attributes",id:"version-0.4.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.",source:"@site/versioned_docs/version-0.4.0/advanced/04-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.4.0/advanced/attributes",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.4.0/advanced/advanced-storage"},next:{title:"Backends",permalink:"/docs/0.4.0/category/backends"}},c={},s=[{value:"Init",id:"init",level:2},{value:"Example",id:"example",level:3},{value:"Payable",id:"payable",level:2},{value:"Example",id:"example-1",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:s};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attributes"},"Attributes"),(0,r.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution."),(0,r.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,r.kt)("h2",{id:"init"},"Init"),(0,r.kt)("p",null,"If your contract needs initial setup, adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed."),(0,r.kt)("p",null,"It's important to note that a constructor function should not be invoked in any other context."),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/erc20.rs",title:"examples/erc20.rs"},"#[odra(init)]\npub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n}\n")),(0,r.kt)("h2",{id:"payable"},"Payable"),(0,r.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/tlw.rs",title:"examples/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = contract_env::caller();\n let amount: Balance = contract_env::attached_value();\n let current_block_time: BlockTime = contract_env::get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n contract_env::revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n Deposit {\n address: caller,\n amount\n }\n .emit();\n}\n")),(0,r.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,r.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,r.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,r.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,r.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,r.kt)("p",null,"In Odra you can just apply the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,r.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,r.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"or "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"In both cases attributes order does not matter."),(0,r.kt)("p",null,"However, a constructor cannot be payable, so the below code would not compile."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(init)]\nfn initialize() {\n // your logic...\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ba36c747.90cf523f.js b/docs/assets/js/ba36c747.90cf523f.js new file mode 100644 index 000000000..2e86b946b --- /dev/null +++ b/docs/assets/js/ba36c747.90cf523f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74997],{3905:(t,e,n)=>{n.d(e,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function s(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t,e){if(null==t)return{};var n,a,r=function(t,e){if(null==t)return{};var n,a,r={},o=Object.keys(t);for(a=0;a<o.length;a++)n=o[a],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)n=o[a],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var l=a.createContext({}),c=function(t){var e=a.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},p=function(t){var e=c(t.components);return a.createElement(l.Provider,{value:e},t.children)},d={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,l=t.parentName,p=i(t,["components","mdxType","originalType","parentName"]),u=c(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?a.createElement(h,s(s({ref:e},p),{},{components:n})):a.createElement(h,s({ref:e},p))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in e)hasOwnProperty.call(e,l)&&(i[l]=e[l]);i.originalType=t,i.mdxType="string"==typeof t?t:r,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},44326:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/docs/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/next/basics/testing",draft:!1,tags:[],version:"current",lastUpdatedAt:1718616680,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/next/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/next/basics/errors"}},l={},c=[{value:"HostEnv",id:"hostenv",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(t){let{components:e,...n}=t;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{List, Var};\n\n#[cfg(test)]\nmod tests {\n use super::{DogContract3HostRef, DogContract3InitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn init_test() {\n let test_env = odra_test::env();\n let init_args = DogContract3InitArgs {\n name: "DogContract".to_string()\n };\n let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,r.kt)("p",null,"The first interesting thing you may notice is placed the import section."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use super::{DogContract3HostRef, DogContract3InitArgs};\nuse odra::{host::Deployer, prelude::*};\n")),(0,r.kt)("p",null,"We are using ",(0,r.kt)("inlineCode",{parentName:"p"},"super")," to import the ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," from the parent module.\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}InitArgs")," are types that was generated for us by Odra."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," is a reference to the contract that we can use to interact with it (call entrypoints)\nand implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/host/trait.HostRef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostRef"))," trait. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," is a struct that we use to initialize the contract and implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/host/trait.InitArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait.\nConsidering the contract initialization, there three possible scenarios:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with arguments, then Odra creates a struct named ",(0,r.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with no arguments, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract does not have a constructor, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),".\nAll of those structs implement the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::InitArgs")," trait, required to conform to the\n",(0,r.kt)("inlineCode",{parentName:"li"},"Deployer::deploy")," method signature. ")),(0,r.kt)("p",null,"The other import is ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::host::Deployer"),". This is a trait is used to deploy the contract and give us a reference to it."),(0,r.kt)("p",null,"Let's take a look at the test itself. How to obtain a reference to the contract?\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," implements the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/host/trait.Deployer.html"},(0,r.kt)("inlineCode",{parentName:"a"},"Deployer"))," trait, which provides the ",(0,r.kt)("inlineCode",{parentName:"p"},"deploy")," method:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n")),(0,r.kt)("p",null,"From now on, we can use ",(0,r.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute are available to us:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,r.kt)("h2",{id:"hostenv"},"HostEnv"),(0,r.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};\n use odra::{host::{Deployer, HostEnv}, prelude::*};\n\n #[test]\n fn env() {\n let test_env: HostEnv = odra_test::env();\n test_env.set_caller(test_env.get_account(0));\n let init_args = TestingContractInitArgs {\n name: "MyContract".to_string()\n };\n let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);\n let creator = testing_contract.created_by();\n test_env.set_caller(test_env.get_account(1));\n let init_args = TestingContractInitArgs {\n name: "MyContract2".to_string()\n };\n let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);\n let creator2 = testing_contract2.created_by();\n assert_ne!(creator, creator2);\n }\n}\n')),(0,r.kt)("p",null,"In the code above, at the beginning of the test, we are obtaining a ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," instance using ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_test::env()"),".\nNext, we are deploying two instances of the same contract, but we're using ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::ContractEnv::caller()"),"\nthe function we are calling inside the contract."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a set of functions that will let you write better tests:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn set_caller(&self, address: Address)")," - you've seen it in action just now"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn balance_of(&self, address: &Address) -> U512")," - returns the balance of the account associated with the given address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn advance_block_time(&self, time_diff: u64)")," - increases the current value of ",(0,r.kt)("inlineCode",{parentName:"li"},"block_time")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn get_account(&self, n: usize) -> Address")," - returns an n-th address that was prepared for you by Odra in advance;\nby default, you start with the 0-th account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn emitted_event<T: ToBytes + EventInstance, R: Addressable>(&self, contract_address: &R, event: &T) -> bool")," - verifies if the event was emitted by the contract")),(0,r.kt)("p",null,"Full list of functions can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/host/struct.HostEnv.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We take a look at how Odra handles errors!"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bab04a93.0a2ff427.js b/docs/assets/js/bab04a93.0a2ff427.js new file mode 100644 index 000000000..f0048f12a --- /dev/null +++ b/docs/assets/js/bab04a93.0a2ff427.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[45006],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=s(n),m=r,f=p["".concat(c,".").concat(m)]||p[m]||d[m]||o;return n?a.createElement(f,l(l({ref:t},u),{},{components:n})):a.createElement(f,l({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"},94071:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-0.7.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.",source:"@site/versioned_docs/version-0.7.0/advanced/04-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.7.0/advanced/attributes",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.7.0/advanced/advanced-storage"},next:{title:"Signatures",permalink:"/docs/0.7.0/advanced/signatures"}},c={},s=[{value:"Init",id:"init",level:2},{value:"Example",id:"example",level:3},{value:"Using",id:"using",level:2},{value:"Example",id:"example-1",level:3},{value:"Payable",id:"payable",level:2},{value:"Example",id:"example-2",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Example",id:"example-3",level:3},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:s};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"attributes"},"Attributes"),(0,r.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution."),(0,r.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,r.kt)("h2",{id:"init"},"Init"),(0,r.kt)("p",null,"If your contract needs initial setup, adding the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed."),(0,r.kt)("p",null,"It's important to note that a constructor function should not be invoked in any other context."),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/erc20.rs",title:"examples/src/contracts/erc20.rs"},"#[odra(init)]\npub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {\n let caller = contract_env::caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, initial_supply);\n}\n")),(0,r.kt)("h2",{id:"using"},"Using"),(0,r.kt)("p",null,"An attribute applicable to struct fields. The ",(0,r.kt)("inlineCode",{parentName:"p"},"using")," attribute accepts multiple values, separated by ",(0,r.kt)("inlineCode",{parentName:"p"},","),".\nEach value attribute must point at an existing field."),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n access_control: AccessControl,\n meta: Metadata,\n #[odra(using = "access_control, meta")]\n // #[odra(using = "access_control, metadata")] - would not compile - `metadata` field does not exist\n storage: Storage\n}\n\n#[odra::module]\nstruct AccessControl {\n owner: Variable<Address>\n}\n\n#[odra::module]\nstruct Metadata {\n version: Variable<String>\n}\n\n#[odra::module]\nstruct Storage {\n value: Variable<u8>,\n access_control: AccessControl,\n meta: Metadata\n}\n')),(0,r.kt)("h2",{id:"payable"},"Payable"),(0,r.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,r.kt)("h3",{id:"example-2"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = contract_env::caller();\n let amount: Balance = contract_env::attached_value();\n let current_block_time: BlockTime = contract_env::get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n contract_env::revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n Deposit {\n address: caller,\n amount\n }\n .emit();\n}\n")),(0,r.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,r.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,r.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,r.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,r.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,r.kt)("p",null,"In Odra you can just apply the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,r.kt)("h3",{id:"example-3"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct NonReentrantCounter {\n counter: Variable<u32>\n}\n\n#[odra::module]\nimpl NonReentrantCounter {\n #[odra(non_reentrant)]\n pub fn count_ref_recursive(&mut self, n: u32) {\n if n > 0 {\n self.count();\n ReentrancyMockRef::at(&contract_env::self_address()).count_ref_recursive(n - 1);\n }\n }\n}\n\nimpl NonReentrantCounter {\n fn count(&mut self) {\n let c = self.counter.get_or_default();\n self.counter.set(c + 1);\n }\n}\n\n#[cfg(test)]\nmod test {\n use odra::{test_env, types::ExecutionError};\n\n #[test]\n fn ref_recursion_not_allowed() {\n test_env::assert_exception(ExecutionError::reentrant_call(), || {\n let mut contract = super::NonReentrantCounterDeployer::default();\n contract.count_ref_recursive(11);\n });\n }\n}\n")),(0,r.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,r.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"or "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,r.kt)("p",null,"In both cases attributes order does not matter."),(0,r.kt)("p",null,"However, a constructor cannot be payable, so the below code would not compile."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(init)]\nfn initialize() {\n // your logic...\n}\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bac2ca12.472bb76d.js b/docs/assets/js/bac2ca12.472bb76d.js new file mode 100644 index 000000000..59a0aefcd --- /dev/null +++ b/docs/assets/js/bac2ca12.472bb76d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[4720],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(n),f=a,m=d["".concat(c,".").concat(f)]||d[f]||p[f]||o;return n?r.createElement(m,l(l({ref:t},u),{},{components:n})):r.createElement(m,l({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},17144:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that",source:"@site/docs/advanced/03-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/next/advanced/attributes",draft:!1,tags:[],version:"current",lastUpdatedAt:1707307948,formattedLastUpdatedAt:"Feb 7, 2024",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/next/advanced/advanced-storage"},next:{title:"Storage Layout",permalink:"/docs/next/advanced/storage-layout"}},c={},s=[{value:"Payable",id:"payable",level:2},{value:"Example",id:"example",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Example",id:"example-1",level:3},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:s};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"attributes"},"Attributes"),(0,a.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that\nallows developers to embed common checks into function definitions in a readable and reusable manner.\nThese are essentially prerequisites for function execution."),(0,a.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,a.kt)("h2",{id:"payable"},"Payable"),(0,a.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,a.kt)("h3",{id:"example"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U256 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env.revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env()\n .emit_event(Deposit {\n address: caller,\n amount\n });\n}\n")),(0,a.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,a.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,a.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,a.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,a.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,a.kt)("p",null,"In Odra you can just apply the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,a.kt)("h3",{id:"example-1"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct NonReentrantCounter {\n counter: Var<u32>\n}\n\n#[odra::module]\nimpl NonReentrantCounter {\n #[odra(non_reentrant)]\n pub fn count_ref_recursive(&mut self, n: u32) {\n if n > 0 {\n self.count();\n ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);\n }\n }\n}\n\nimpl NonReentrantCounter {\n fn count(&mut self) {\n let c = self.counter.get_or_default();\n self.counter.set(c + 1);\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::{host::{Deployer, NoArgs}, ExecutionError};\n\n #[test]\n fn ref_recursion_not_allowed() {\n let test_env = odra_test::env();\n let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);\n\n let result = contract.count_ref_recursive(11);\n assert_eq!(result, ExecutionError::ReentrantCall.into());\n }\n}\n")),(0,a.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,a.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"or "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"In both cases attributes order does not matter."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bb6e6682.6ceffa2c.js b/docs/assets/js/bb6e6682.6ceffa2c.js new file mode 100644 index 000000000..d871ae7a5 --- /dev/null +++ b/docs/assets/js/bb6e6682.6ceffa2c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74563],{73593:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.8.0/category/examples","navigation":{"previous":{"title":"Livenet","permalink":"/docs/0.8.0/backends/livenet"},"next":{"title":"odra-examples","permalink":"/docs/0.8.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/bc0e7bcb.45d16336.js b/docs/assets/js/bc0e7bcb.45d16336.js new file mode 100644 index 000000000..7722a9b26 --- /dev/null +++ b/docs/assets/js/bc0e7bcb.45d16336.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52962],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},71611:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",s={unversionedId:"getting-started/flipper",id:"version-0.9.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.9.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.9.0/getting-started/flipper",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.9.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.9.0/category/basics"}},i={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Var;\n\n/// A module definition. Each module struct consists Vars and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Var<bool>,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor, must be named `init`.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let env = odra_test::env();\n let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);\n let contract2 = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To run the tests, execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test # or add the `-b casper` flag to run tests on the CasperVM\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bc53adba.fa09a0b2.js b/docs/assets/js/bc53adba.fa09a0b2.js new file mode 100644 index 000000000..8c67e928d --- /dev/null +++ b/docs/assets/js/bc53adba.fa09a0b2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83306],{18721:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.7.0/category/backends","navigation":{"previous":{"title":"Signatures","permalink":"/docs/0.7.0/advanced/signatures"},"next":{"title":"What is a backend?","permalink":"/docs/0.7.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/bc61aabc.81b56e5b.js b/docs/assets/js/bc61aabc.81b56e5b.js new file mode 100644 index 000000000..049f21026 --- /dev/null +++ b/docs/assets/js/bc61aabc.81b56e5b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[91613],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,y=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d<i;d++)o[d]=n[d];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},74321:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={},o="Storage Layout",s={unversionedId:"advanced/storage-layout",id:"version-0.8.0/advanced/storage-layout",title:"Storage Layout",description:"Odra's innovative modular design necessitates a unique storage layout. This",source:"@site/versioned_docs/version-0.8.0/advanced/04-storage-layout.md",sourceDirName:"advanced",slug:"/advanced/storage-layout",permalink:"/docs/0.8.0/advanced/storage-layout",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/0.8.0/advanced/attributes"},next:{title:"Backends",permalink:"/docs/0.8.0/category/backends"}},l={},d=[{value:"Casper VM Perspective",id:"casper-vm-perspective",level:2},{value:"Odra Perspective",id:"odra-perspective",level:2},{value:"Key generation.",id:"key-generation",level:2},{value:"Value serialization",id:"value-serialization",level:2}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"Odra's innovative modular design necessitates a unique storage layout. This\narticle explains step-by-step Odra's storage layout."),(0,r.kt)("h2",{id:"casper-vm-perspective"},"Casper VM Perspective"),(0,r.kt)("p",null,"The Casper Execution Engine (VM) enables the storage of data in named keys or\ndictionaries. However, a smart contract has a limited number of named keys,\nmaking it unsuitable for storing substantial data volumes. Odra resolves this\nissue by storing all user-generated data in a dictionary called ",(0,r.kt)("inlineCode",{parentName:"p"},"state"),". This\ndictionary operates as a key-value store, where keys are strings with a maximum\nlength of 64 characters, and values are arbitrary byte arrays."),(0,r.kt)("p",null,"Here is an example of what the interface for reading and writing data could look\nlike:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait CasperStorage {\n fn read(key: &str) -> Option<Vec<u8>>;\n fn write(key: &str, value: Vec<u8>);\n}\n")),(0,r.kt)("h2",{id:"odra-perspective"},"Odra Perspective"),(0,r.kt)("p",null,"Odra was conceived with modularity and code reusability in mind. Additionally,\nwe aimed to streamline storage definition through the struct object. Consider\nthis straightforward storage definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Token {\n name: Var<String>,\n balances: Mapping<Address, U256>\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," structure contains two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"name")," of type ",(0,r.kt)("inlineCode",{parentName:"p"},"String")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"balances"),", which functions as a key-value store with ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," as keys and\n",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," as values."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module can be reused in another module, as demonstrated in a more\ncomplex example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Loans {\n lenders: SubModule<Token>,\n borrowers: SubModule<Token>,\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," module has two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers"),", both of which have\nthe same storage layout as defined by the ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module. Odra guarantees that\n",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers")," are stored under distinct keys within the storage\ndictionary."),(0,r.kt)("p",null,"Both ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," serve as examples to show how Odra's storage layout\noperates."),(0,r.kt)("h2",{id:"key-generation"},"Key generation."),(0,r.kt)("p",null,"Every element of a module (",(0,r.kt)("inlineCode",{parentName:"p"},"struct"),") with N elements is associated with an index\nranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an\nelement of a module is another module (",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<...>"),"), the associated index\nserves as a prefix for the indexes of the inner module."),(0,r.kt)("p",null,"While this may initially appear complex, it is easily understood through an\nexample. In the example, indexes are presented as bytes, reflecting the actual\nimplementation."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Loans {\n lenders: Token { // prefix: 0x0000\n name: 0, // key: 0x0000_0000\n balances: 1 // key: 0x0000_0001\n },\n borrowers: Token { // prefix: 0x0001\n name: 0, // key: 0x0001_0000\n balances: 1 // key: 0x0001_0001\n }\n}\n")),(0,r.kt)("p",null,"Additionally, it's worth mentioning how ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"'s keys are used in the\n",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),". They are simply concatenated with the index of the module, as\ndemonstrated in the example."),(0,r.kt)("p",null,"For instance, triggering ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers.balances.get(0x1234abcd)")," would result in a\nkey:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"0x0001_0001_1234_abcd\n")),(0,r.kt)("p",null,"Finally, the key must be hashed to fit within the 64-character limit and then\nencoded in hexadecimal format."),(0,r.kt)("h2",{id:"value-serialization"},"Value serialization"),(0,r.kt)("p",null,"Before being stored in the storage, each value is serialized into bytes using\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," serialization method and subsequently encapsulated with Casper's\n",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," types."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bc77ce48.be2d9c50.js b/docs/assets/js/bc77ce48.be2d9c50.js new file mode 100644 index 000000000..258de7a12 --- /dev/null +++ b/docs/assets/js/bc77ce48.be2d9c50.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[43379],{19626:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.8.1","label":"0.8.1","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.8.1","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.8.1/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.8.1/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.8.1/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.8.1/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.8.1/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.8.1/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.8.1/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.8.1/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.8.1/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.8.1/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.8.1/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.8.1/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.8.1/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.8.1/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.8.1/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.8.1/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.8.1/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Delegate","href":"/docs/0.8.1/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.8.1/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.8.1/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Storage Layout","href":"/docs/0.8.1/advanced/storage-layout","docId":"advanced/storage-layout"},{"type":"link","label":"Memory allocators","href":"/docs/0.8.1/advanced/using-different-allocator","docId":"advanced/using-different-allocator"},{"type":"link","label":"Building contracts manually","href":"/docs/0.8.1/advanced/building-manually","docId":"advanced/building-manually"}],"href":"/docs/0.8.1/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.8.1/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"OdraVM","href":"/docs/0.8.1/backends/odra-vm","docId":"backends/odra-vm"},{"type":"link","label":"Casper","href":"/docs/0.8.1/backends/casper","docId":"backends/casper"},{"type":"link","label":"Livenet","href":"/docs/0.8.1/backends/livenet","docId":"backends/livenet"}],"href":"/docs/0.8.1/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.8.1/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.8.1/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.8.1/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.8.1/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.8.1/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.8.1/tutorials/owned-token","docId":"tutorials/owned-token"},{"type":"link","label":"Access Control","href":"/docs/0.8.1/tutorials/access-control","docId":"tutorials/access-control"},{"type":"link","label":"Pausable","href":"/docs/0.8.1/tutorials/pauseable","docId":"tutorials/pauseable"},{"type":"link","label":"Build, Deploy and Read the State of a Contract","href":"/docs/0.8.1/tutorials/build-deploy-read","docId":"tutorials/build-deploy-read"}],"href":"/docs/0.8.1/category/tutorials"},{"type":"category","label":"Migrations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Migration guide to v0.8.0","href":"/docs/0.8.1/migrations/to-0.8.0","docId":"migrations/to-0.8.0"}],"href":"/docs/0.8.1/category/migrations"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that","sidebar":"tutorialSidebar"},"advanced/building-manually":{"id":"advanced/building-manually","title":"Building contracts manually","description":"cargo odra is a great tool to build and test your contracts, but sometimes","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/storage-layout":{"id":"advanced/storage-layout","title":"Storage Layout","description":"Odra\'s innovative modular design necessitates a unique storage layout. This","sidebar":"tutorialSidebar"},"advanced/using-different-allocator":{"id":"advanced/using-different-allocator","title":"Memory allocators","description":"When compiling contracts to wasm, your code needs to be no-std.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/livenet":{"id":"backends/livenet","title":"Livenet","description":"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local","sidebar":"tutorialSidebar"},"backends/odra-vm":{"id":"backends/odra-vm","title":"OdraVM","description":"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"migrations/to-0.8.0":{"id":"migrations/to-0.8.0","title":"Migration guide to v0.8.0","description":"Migration guide to v0.8.0","sidebar":"tutorialSidebar"},"tutorials/access-control":{"id":"tutorials/access-control","title":"Access Control","description":"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,","sidebar":"tutorialSidebar"},"tutorials/build-deploy-read":{"id":"tutorials/build-deploy-read","title":"Build, Deploy and Read the State of a Contract","description":"In this guide, we will show the full path from creating a contract, deploying it and reading the state.","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"},"tutorials/pauseable":{"id":"tutorials/pauseable","title":"Pausable","description":"The Pausable module is like your smart contract\'s safety switch. It lets authorized users temporarily pause certain features if needed. It\'s a great way to boost security, but it\'s not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/bc9af134.55bc4c62.js b/docs/assets/js/bc9af134.55bc4c62.js new file mode 100644 index 000000000..0638f9916 --- /dev/null +++ b/docs/assets/js/bc9af134.55bc4c62.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[30637],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),u=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=u(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},d),{},{components:t})):r.createElement(f,o({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var u=2;u<s;u++)o[u]=t[u];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},85162:(e,n,t)=>{t.d(n,{Z:()=>o});var r=t(67294),a=t(86010);const s="tabItem_Ymn6";function o(e){let{children:n,hidden:t,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(s,o),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>_});var r=t(87462),a=t(67294),s=t(86010),o=t(12466),l=t(16550),i=t(91980),u=t(67392),d=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,u.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),s=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(s),(0,a.useCallback)((e=>{if(!s)return;const n=new URLSearchParams(r.location.search);n.set(s,e),r.replace({...r.location,search:n.toString()})}),[s,r])]}function b(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,s=c(e),[o,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:s}))),[i,u]=f({queryString:t,groupId:r}),[p,b]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,s]=(0,d.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&s.set(e)}),[t,s])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:s})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),b(e)}),[u,b,s]),tabValues:s}}var g=t(72389);const v="tabList__CuJ",h="tabItem_LNqP";function y(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:u}=e;const d=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),c=e=>{const n=e.currentTarget,t=d.indexOf(n),r=u[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;n=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;n=d[t]??d[d.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":t},n)},u.map((e=>{let{value:n,label:t,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>d.push(e),onKeyDown:m,onClick:c},o,{className:(0,s.Z)("tabs__item",h,o?.className,{"tabs__item--active":l===n})}),t??n)})))}function w(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function k(e){const n=b(e);return a.createElement("div",{className:(0,s.Z)("tabs-container",v)},a.createElement(y,(0,r.Z)({},e,n)),a.createElement(w,(0,r.Z)({},e,n)))}function _(e){const n=(0,g.Z)();return a.createElement(k,(0,r.Z)({key:String(n)},e))}},64052:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),s=t(74866),o=t(85162);const l={sidebar_position:2,description:"Migration guide to v0.9.0"},i="Migration guide to v0.9.0",u={unversionedId:"migrations/to-0.9.0",id:"migrations/to-0.9.0",title:"Migration guide to v0.9.0",description:"Migration guide to v0.9.0",source:"@site/docs/migrations/to-0.9.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.9.0",permalink:"/docs/next/migrations/to-0.9.0",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Migration guide to v0.9.0"},sidebar:"tutorialSidebar",previous:{title:"Migration guide to v0.8.0",permalink:"/docs/next/migrations/to-0.8.0"}},d={},p=[{value:"<strong>1. Prerequisites</strong>",id:"1-prerequisites",level:2},{value:"1.1. <strong>Update cargo-odra</strong>",id:"11-update-cargo-odra",level:3},{value:"1.2. <strong>Review the Changelog</strong>",id:"12-review-the-changelog",level:3},{value:"<strong>2. Migration Steps</strong>",id:"2-migration-steps",level:2},{value:"2.1 <strong>Update build_schema.rs bin</strong>",id:"21-update-build_schemars-bin",level:3},{value:"2.2 <strong>Update smart contract code</strong>",id:"22-update-smart-contract-code",level:3},{value:"2.2.1. <strong>Update custom types definitions.</strong>",id:"221-update-custom-types-definitions",level:4},{value:"2.2.2. <strong>Update errors definitions.</strong>",id:"222-update-errors-definitions",level:4},{value:"2.2.3. <strong>Update events definitions.</strong>",id:"223-update-events-definitions",level:4},{value:"3. <strong>Code Examples</strong>",id:"3-code-examples",level:2},{value:"4. <strong>Troubleshooting</strong>",id:"4-troubleshooting",level:2},{value:"5. <strong>References</strong>",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v090"},"Migration guide to v0.9.0"),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.7.1")," and below, start with the ",(0,a.kt)("a",{parentName:"p",href:"./to-0.8.0"},"previous guide"),". It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant change in ",(0,a.kt)("inlineCode",{parentName:"p"},"0.9.0")," is the way of defining custom elements namely type, events and errors."),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.9.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-update-build_schemars-bin"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Update build_schema.rs bin")),(0,a.kt)("p",null,"Odra 0.9.0 adds a new standardized way of generating contract schema - ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema"),". You can find the updated ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," file in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-smart-contract-code"},"2.2 ",(0,a.kt)("strong",{parentName:"h3"},"Update smart contract code")),(0,a.kt)("p",null,"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes."),(0,a.kt)("h4",{id:"221-update-custom-types-definitions"},"2.2.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update custom types definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraType)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option<Address>\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option<Address>\n}\n")))),(0,a.kt)("h4",{id:"222-update-errors-definitions"},"2.2.2. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraError)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute.\nError enum should be passed as a parameter to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */], errors = Error)]\npub struct Erc20 {\n // fields\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */])]\npub struct Erc20 {\n // fields\n}\n\nuse odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n")))),(0,a.kt)("h4",{id:"223-update-events-definitions"},"2.2.3. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256};\n\n#[odra::event]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Event};\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.9.0."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer], errors = Error)]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option<U256>\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address};\n\n #[odra::event]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[odra::event]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n #[odra::odra_error]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option<U256>\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n")))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P9k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bcf5f050.7b072a85.js b/docs/assets/js/bcf5f050.7b072a85.js new file mode 100644 index 000000000..9bcbdce6a --- /dev/null +++ b/docs/assets/js/bcf5f050.7b072a85.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[267],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p<o;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},10486:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},i="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.9.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.9.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.9.0/basics/flipper-internals",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.9.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.9.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Var;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Var<bool>,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Var<T>")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the attribute - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The function named ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," is the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," function is optional,\nif your contract does not need any initialization, you can skip it."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Var<T>"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.Deployer.html#tymethod.deploy"},(0,a.kt)("inlineCode",{parentName:"a"},"Deployer::deploy"))," function called on ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperHostRef")," - a piece of code generated\nby the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),". Because the module implements the constructor but does not accept any arguments,\nas the second argument of the deploy function, we pass ",(0,a.kt)("inlineCode",{parentName:"p"},"NoArgs")," - one of the implementations of\nthe ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/host/trait.InitArgs.html"},(0,a.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait provided with the framework. "),(0,a.kt)("p",null,"The contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bd4cf5c0.5db26abf.js b/docs/assets/js/bd4cf5c0.5db26abf.js new file mode 100644 index 000000000..36aeae200 --- /dev/null +++ b/docs/assets/js/bd4cf5c0.5db26abf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83241],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s(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 o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?s(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):s(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)a=s[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)a=s[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||s;return a?n.createElement(h,o(o({ref:t},p),{},{components:a})):n.createElement(h,o({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,o=new Array(s);o[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var c=2;c<s;c++)o[c]=a[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},37493:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:3},o="Casper",i={unversionedId:"backends/casper",id:"version-0.2.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.2.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.2.0/backends/casper",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"defaultSidebar",previous:{title:"MockVM",permalink:"/docs/0.2.0/backends/mock-vm"},next:{title:"Examples",permalink:"/docs/0.2.0/category/examples"}},l={},c=[{value:"Types",id:"types",level:2},{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Execution",id:"execution",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"types"},"Types"),(0,r.kt)("p",null,"A struct to be written into the storage must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait OdraType: \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("p",null,"The other exposed types are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CallArgs")," - wraps around casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"RuntimeArgs")),";"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," - U512 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"BlockTime")," - u64 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Address")," - an enum that encapsulates casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/account/struct.AccountHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"AccountHash"))," and ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/struct.ContractPackageHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractPackageHash")))),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra creates two ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count.")),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"SerializableEvent")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait SerializableEvent: \n odra_types::event::OdraEvent + \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance, you call ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_balance"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/backends/mock-vm"},"MockVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/be0b2ac1.c2904d19.js b/docs/assets/js/be0b2ac1.c2904d19.js new file mode 100644 index 000000000..bac11aee9 --- /dev/null +++ b/docs/assets/js/be0b2ac1.c2904d19.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[589],{82532:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.6.0/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.6.0/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.6.0/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/beab0651.c96ec135.js b/docs/assets/js/beab0651.c96ec135.js new file mode 100644 index 000000000..85caaa118 --- /dev/null +++ b/docs/assets/js/beab0651.c96ec135.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67620],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,o,a=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var r=o.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return o.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},u=o.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?o.createElement(f,l(l({ref:r},c),{},{components:t})):o.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p<n;p++)l[p]=t[p];return o.createElement.apply(null,l)}return o.createElement.apply(null,t)}u.displayName="MDXCreateElement"},25369:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.3.1/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.",source:"@site/versioned_docs/version-0.3.1/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.3.1/examples/odra-examples",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.3.1/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.3.1/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,a.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,a.kt)("inlineCode",{parentName:"p"},"examples")," in the Odra main repository."),(0,a.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,a.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,a.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bee0af8b.8fea05d4.js b/docs/assets/js/bee0af8b.8fea05d4.js new file mode 100644 index 000000000..1d482420d --- /dev/null +++ b/docs/assets/js/bee0af8b.8fea05d4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25662],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},95920:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.3.0/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.3.0/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.3.0/",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"defaultSidebar",next:{title:"Getting started",permalink:"/docs/0.3.0/category/getting-started"}},c={image:r(15866).Z},l=[{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean,\npragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open\nsource."),(0,o.kt)("p",null,"Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains."),(0,o.kt)("p",null,"A smart contract written using Odra can be executed on all integrated systems. We can do it\nby abstracting over core concepts that all the above systems are built around. These are type system,\nstorage, entry points, execution context, and testing environment. We believe it will bring standardization\nto the development of Rust-based smart contracts and enable code reusability we have not yet seen in this\necosystem."),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.3.0/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.3.0/getting-started/flipper"},"Flipper example"),"\nto find out how to start your new project with Odra."))}p.isMDXComponent=!0},15866:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/befd1fba.8e72e32e.js b/docs/assets/js/befd1fba.8e72e32e.js new file mode 100644 index 000000000..5dcbc290e --- /dev/null +++ b/docs/assets/js/befd1fba.8e72e32e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[31215],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},98158:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.6.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.6.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.6.0/basics/native-token",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.6.0/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.6.0/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"native-token"},"Native token"),(0,r.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::types::Balance;\nuse odra::contract_env;\n\n#[odra::module]\npub struct PublicWallet {\n}\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {\n }\n\n pub fn withdraw(&mut self, amount: Balance) {\n contract_env::transfer_tokens(contract_env::caller(), amount);\n }\n}\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,r.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/tlw.rs")," in the odra main repository.")),(0,r.kt)("p",null,"You can see a new macro used here: ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from contract_env - ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_tokens"),".\nIt does exactly what you are expecting it to do - it will transfer native tokens from the contract to the\nspecified address."),(0,r.kt)("p",null,"We are also using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Balance")," - an Odra type that wraps around the type that the underlying blockchain uses\nfor counting tokens."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,r.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a function -\n",(0,r.kt)("inlineCode",{parentName:"p"},"token_balance"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::types::Balance;\nuse odra::test_env;\nuse super::PublicWalletDeployer;\n\n#[test]\nfn test_modules() {\n let mut my_contract = PublicWalletDeployer::default();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());\n\n my_contract.with_tokens(Balance::from(100)).deposit();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));\n\n my_contract.withdraw(Balance::from(25));\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bfc20097.c9d6a863.js b/docs/assets/js/bfc20097.c9d6a863.js new file mode 100644 index 000000000..55fcc7cf7 --- /dev/null +++ b/docs/assets/js/bfc20097.c9d6a863.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[55897],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function l(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){o(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}))}return e}function s(e,n){if(null==e)return{};var r,t,o=function(e,n){if(null==e)return{};var r,t,o={},a=Object.keys(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=t.createContext({}),d=function(e){var n=t.useContext(i),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},p=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=d(r),m=o,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||a;return r?t.createElement(f,l(l({ref:n},c),{},{components:r})):t.createElement(f,l({ref:n},c))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=p;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var d=2;d<a;d++)l[d]=r[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,r)}p.displayName="MDXCreateElement"},93969:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var t=r(87462),o=(r(67294),r(3905));const a={sidebar_position:4},l="Access Control",s={unversionedId:"tutorials/access-control",id:"tutorials/access-control",title:"Access Control",description:"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,",source:"@site/docs/tutorials/access-control.md",sourceDirName:"tutorials",slug:"/tutorials/access-control",permalink:"/docs/next/tutorials/access-control",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"OwnedToken",permalink:"/docs/next/tutorials/owned-token"},next:{title:"Pausable",permalink:"/docs/next/tutorials/pauseable"}},i={},d=[{value:"Code",id:"code",level:2},{value:"Project Structure",id:"project-structure",level:3},{value:"Events and Errors",id:"events-and-errors",level:3},{value:"Module",id:"module",level:3}],c={toc:d};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"access-control"},"Access Control"),(0,o.kt)("p",null,"In a previous tutorial, we introduced the ",(0,o.kt)("a",{parentName:"p",href:"/docs/next/tutorials/ownable"},(0,o.kt)("inlineCode",{parentName:"a"},"Ownable"))," module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient, "),(0,o.kt)("p",null,"In this article we design and implement a more fine-grained access control layer."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"Before we start writing code, we list the functionalities of our access control layer."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type is used across the module."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be assigned to many ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es."),(0,o.kt)("li",{parentName:"ol"},"Each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," may have a corresponding admin role."),(0,o.kt)("li",{parentName:"ol"},"Only an admin can grant/revoke a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),"."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be renounced."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," cannot be renounced on someone's behalf."),(0,o.kt)("li",{parentName:"ol"},"Each action triggers an event."),(0,o.kt)("li",{parentName:"ol"},"Unauthorized access stops contract execution.")),(0,o.kt)("h3",{id:"project-structure"},"Project Structure"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-plaintext"},"access-control\n\u251c\u2500\u2500 src\n\u2502 \u251c\u2500\u2500 access\n\u2502 \u2502 \u251c\u2500\u2500 access_control.rs\n\u2502 \u2502 \u251c\u2500\u2500 events.rs\n\u2502 \u2502 \u2514\u2500\u2500 errors.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n|\u2500\u2500 build.rs\n|\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 Odra.toml\n")),(0,o.kt)("h3",{id:"events-and-errors"},"Events and Errors"),(0,o.kt)("p",null,"There are three actions that can be performed concerning a ",(0,o.kt)("inlineCode",{parentName:"p"},"Role"),": granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=events.rs showLineNumbers",title:"events.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\nuse super::access_control::Role;\n\n#[odra::event]\npub struct RoleGranted {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleRevoked {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[odra::event]\npub struct RoleAdminChanged {\n pub role: Role,\n pub previous_admin_role: Role,\n pub new_admin_role: Role\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L5-L17")," - to describe the grant or revoke actions, our events specify the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", and ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es indicating who receives or loses access and who provides or withdraws it."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L19-L24")," - the event describing the admin role change, requires the subject ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", the previous and the current admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=errors.rs",title:"errors.rs"},"#[odra::odra_error]\npub enum Error {\n MissingRole = 20_000,\n RoleRenounceForAnotherAddress = 20_001,\n}\n")),(0,o.kt)("p",null,"Errors definition is straightforward - there are only two invalid states: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"An action is triggered by an unauthorized actor."),(0,o.kt)("li",{parentName:"ol"},"The caller is attempting to resign the Role on someone's behalf. ")),(0,o.kt)("h3",{id:"module"},"Module"),(0,o.kt)("p",null,"Now, we are stepping into the most interesting part: the module definition and implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=access_control.rs showLineNumbers",title:"access_control.rs",showLineNumbers:!0},"use super::events::*;\nuse super::errors::Error;\nuse odra::prelude::*;\nuse odra::{Address, Mapping};\n\npub type Role = [u8; 32];\n\npub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];\n\n#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]\npub struct AccessControl {\n roles: Mapping<(Role, Address), bool>,\n role_admin: Mapping<Role, Role>\n}\n\n#[odra::module]\nimpl AccessControl {\n pub fn has_role(&self, role: &Role, address: &Address) -> bool {\n self.roles.get_or_default(&(*role, *address))\n }\n\n pub fn get_role_admin(&self, role: &Role) -> Role {\n let admin_role = self.role_admin.get(role);\n if let Some(admin) = admin_role {\n admin\n } else {\n DEFAULT_ADMIN_ROLE\n }\n }\n\n pub fn grant_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_grant_role(role, address);\n }\n\n pub fn revoke_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_revoke_role(role, address);\n }\n\n pub fn renounce_role(&mut self, role: &Role, address: &Address) {\n if address != &self.env().caller() {\n self.env().revert(Error::RoleRenounceForAnotherAddress);\n }\n self.unchecked_revoke_role(role, address);\n }\n}\n\nimpl AccessControl {\n pub fn check_role(&self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.env().revert(Error::MissingRole);\n }\n }\n\n pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {\n let previous_admin_role = self.get_role_admin(role);\n self.role_admin.set(role, *admin_role);\n self.env().emit_event(RoleAdminChanged {\n role: *role,\n previous_admin_role,\n new_admin_role: *admin_role\n });\n }\n\n pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.roles.set(&(*role, *address), true);\n self.env().emit_event(RoleGranted {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n\n pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {\n if self.has_role(role, address) {\n self.roles.set(&(*role, *address), false);\n self.env().emit_event(RoleRevoked {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L6")," - Firstly, we need the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type. It is simply an alias for a 32-byte array."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L8")," - The default role is an array filled with zeros."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L13")," - The storage consists of two mappings:")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"roles")," - a nested mapping that stores information about whether a certain Role is granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"role_admin")," - each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can have a single admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L18-L20")," - This is a simple check to determine if a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," has been granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),". It is an exposed entry point and an important building block widely used throughout the entire module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49")," - This is a non-exported block containing helper functions."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L54")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," function serves as a guard function. Before a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with ",(0,o.kt)("inlineCode",{parentName:"li"},"Error::MissingRole"),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L56-L64")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"set_admin_role()")," function simply updates the role_admin mapping and emits the ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleAdminChanged")," event."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L66-L86")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_revoke_role()")," functions are mirror functions that update the roles mapping and post ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleGranted")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleRevoked")," events. If the role is already granted, ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," has no effect (the opposite check is made in the case of revoking a role)."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L22-L29")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"get_role_admin()")," entry point reads the role_admin. If there is no admin role for a given role, it returns the default role."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L31-L46")," - This is a combination of ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_*_role()"),". Entry points fail on unauthorized access.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/bfc8213d.e11492ee.js b/docs/assets/js/bfc8213d.e11492ee.js new file mode 100644 index 000000000..8d672c36b --- /dev/null +++ b/docs/assets/js/bfc8213d.e11492ee.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59309],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>g});var r=a(67294);function n(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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(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){n(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 i(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),c=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(a),g=n,m=d["".concat(s,".").concat(g)]||d[g]||u[g]||o;return a?r.createElement(m,l(l({ref:t},p),{},{components:a})):r.createElement(m,l({ref:t},p))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:n,l[1]=i;for(var c=2;c<o;c++)l[c]=a[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,a)}d.displayName="MDXCreateElement"},93853:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=a(87462),n=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.5.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.5.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.5.0/getting-started/installation",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.5.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.5.0/getting-started/flipper"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"installation"},"Installation"),(0,n.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,n.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,n.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,n.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,n.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,n.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-uknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,n.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,n.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,n.kt)("p",null,"To install it, simply execute the following command:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra\n")),(0,n.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,n.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,n.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,n.kt)("p",null,"To create a new project, simply execute:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,n.kt)("p",null,'This will create a new folder called "my_project" and initialize Odra there. Cargo Odra\nwill create a sample contract for you in src directory. You can run the tests of this contract\nby executing:'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,n.kt)("p",null,"This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,n.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,n.kt)("h2",{id:"whats-next"},"What's next?"),(0,n.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,n.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c10f3592.195aa02a.js b/docs/assets/js/c10f3592.195aa02a.js new file mode 100644 index 000000000..ed113afc4 --- /dev/null +++ b/docs/assets/js/c10f3592.195aa02a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[28966],{8968:a=>{a.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/category/backends","navigation":{"previous":{"title":"Building contracts manually","permalink":"/docs/advanced/building-manually"},"next":{"title":"What is a backend?","permalink":"/docs/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/c13d152b.606a6d4b.js b/docs/assets/js/c13d152b.606a6d4b.js new file mode 100644 index 000000000..375a27fee --- /dev/null +++ b/docs/assets/js/c13d152b.606a6d4b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63668],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},62260:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.5.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.5.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.5.0/basics/native-token",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.5.0/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.5.0/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"native-token"},"Native token"),(0,r.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::types::Balance;\nuse odra::contract_env;\n\n#[odra::module]\npub struct PublicWallet {\n}\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {\n }\n\n pub fn withdraw(&mut self, amount: Balance) {\n contract_env::transfer_tokens(contract_env::caller(), amount);\n }\n}\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,r.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/tlw.rs")," in the odra main repository.")),(0,r.kt)("p",null,"You can see a new macro used here: ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from contract_env - ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_tokens"),".\nIt does exactly what you are expecting it to do - it will transfer native tokens from the contract to the\nspecified address."),(0,r.kt)("p",null,"We are also using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Balance")," - an Odra type that wraps around the type that the underlying blockchain uses\nfor counting tokens."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,r.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a function -\n",(0,r.kt)("inlineCode",{parentName:"p"},"token_balance"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::types::Balance;\nuse odra::test_env;\nuse super::PublicWalletDeployer;\n\n#[test]\nfn test_modules() {\n let mut my_contract = PublicWalletDeployer::default();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());\n\n my_contract.with_tokens(Balance::from(100)).deposit();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));\n\n my_contract.withdraw(Balance::from(25));\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c1418166.9370acda.js b/docs/assets/js/c1418166.9370acda.js new file mode 100644 index 000000000..71f68ea4a --- /dev/null +++ b/docs/assets/js/c1418166.9370acda.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[7978],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||p[m]||o;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},62393:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:13,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/docs/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/next/basics/native-token",draft:!1,tags:[],version:"current",lastUpdatedAt:1718616680,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:13,frontMatter:{sidebar_position:13,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/next/basics/modules"},next:{title:"Advanced",permalink:"/docs/next/category/advanced"}},l={},c=[{value:"Testing",id:"testing",level:2},{value:"HostEnv",id:"hostenv",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"native-token"},"Native token"),(0,a.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::prelude::*;\nuse odra::{casper_types::U512, module::Module};\n\n#[odra::module]\npub struct PublicWallet;\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {}\n\n pub fn withdraw(&mut self, amount: &U512) {\n self.env().transfer_tokens(&self.env().caller(), amount);\n }\n}\n")),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,a.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,a.kt)("inlineCode",{parentName:"p"},"examples/src/contracts/tlw.rs")," in the odra main repository.")),(0,a.kt)("p",null,"You can see a new attribute used here: ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv::transfer_tokens()"),".\nIt does exactly what you are expecting it to do - it transfers native tokens from the contract to the\nspecified address."),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a function -\n",(0,a.kt)("inlineCode",{parentName:"p"},"balance_of"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"#[cfg(test)]\nmod tests {\n use super::PublicWalletHostRef;\n use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);\n assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());\n\n my_contract.with_tokens(U512::from(100)).deposit();\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));\n\n my_contract.withdraw(U512::from(25));\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));\n }\n}\n")),(0,a.kt)("h2",{id:"hostenv"},"HostEnv"),(0,a.kt)("p",null,"In a broader context of the host environment (test, livenet), you can also transfer ",(0,a.kt)("inlineCode",{parentName:"p"},"CSPR")," tokens between accounts:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"let env = odra_casper_livenet_env::env();\n//let env = odra_test::env();\nlet (alice, bob) = (env.get_account(0), env.get_account(1));\n\nenv.set_caller(alice);\nlet result = env.transfer_tokens(bob, odra::casper_types::U512::from(100));\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c1ae59bd.5624c97f.js b/docs/assets/js/c1ae59bd.5624c97f.js new file mode 100644 index 000000000..825403a34 --- /dev/null +++ b/docs/assets/js/c1ae59bd.5624c97f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[7437],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),g=a,m=d["".concat(l,".").concat(g)]||d[g]||u[g]||i;return n?r.createElement(m,o(o({ref:t},p),{},{components:n})):r.createElement(m,o({ref:t},p))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c<i;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},64970:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const i={slug:"Nysa",title:"Nysa",authors:["kpob"],image:"./twitter-card.png"},o=void 0,s={permalink:"/blog/Nysa",source:"@site/blog/2023-08-18-nysa/index.md",title:"Nysa",description:'The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wroc\u0142aw, Szczecin, and Gda\u0144sk, to international waterways. The Oder also plays a significant role in the region\'s ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.',date:"2023-08-18T00:00:00.000Z",formattedDate:"August 18, 2023",tags:[],readingTime:8.47,hasTruncateMarker:!0,authors:[{name:"Krzysztof Pobiar\u017cyn",title:"Lead Developer",url:"https://github.com/kpob",key:"kpob"}],frontMatter:{slug:"Nysa",title:"Nysa",authors:["kpob"],image:"./twitter-card.png"},nextItem:{title:"It's all about the community!",permalink:"/blog/its-all-about-the-community"}},l={image:n(46180).Z,authorsImageUrls:[void 0]},c=[],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,'The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wroc\u0142aw, Szczecin, and Gda\u0144sk, to international waterways. The Oder also plays a significant role in the region\'s ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.'),(0,a.kt)("p",null,"The Nysa K\u0142odzka is a significant river in Poland, flowing through the country's southwestern part. It travels approximately 188 kilometers, originating in the Czech Republic and merging with the Oder River in Poland. The river passes through picturesque landscapes, including the K\u0142odzko Valley, and plays a crucial role in local ecosystems. Its waters are harnessed for various purposes, such as hydroelectric power generation and irrigation."),(0,a.kt)("p",null,"Oh, wait, shouldn't it be a tech blog?"),(0,a.kt)("p",null,"This is a valid question, we will get back to it in a moment."))}u.isMDXComponent=!0},46180:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/twitter-card-941b7cfa84d4da7dd4848d3556845b53.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/c1bc45da.0db54df8.js b/docs/assets/js/c1bc45da.0db54df8.js new file mode 100644 index 000000000..4188db5d0 --- /dev/null +++ b/docs/assets/js/c1bc45da.0db54df8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[17927],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),d=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=d(n),f=a,m=p["".concat(c,".").concat(f)]||p[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d<o;d++)l[d]=n[d];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},73799:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={},l="Memory allocators",i={unversionedId:"advanced/using-different-allocator",id:"advanced/using-different-allocator",title:"Memory allocators",description:"When compiling contracts to wasm, your code needs to be no-std.",source:"@site/docs/advanced/05-using-different-allocator.md",sourceDirName:"advanced",slug:"/advanced/using-different-allocator",permalink:"/docs/next/advanced/using-different-allocator",draft:!1,tags:[],version:"current",lastUpdatedAt:1709127847,formattedLastUpdatedAt:"Feb 28, 2024",sidebarPosition:5,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Storage Layout",permalink:"/docs/next/advanced/storage-layout"},next:{title:"Building contracts manually",permalink:"/docs/next/advanced/building-manually"}},c={},d=[{value:"Using a different allocator",id:"using-a-different-allocator",level:2}],s={toc:d};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"memory-allocators"},"Memory allocators"),(0,a.kt)("p",null,"When compiling contracts to wasm, your code needs to be ",(0,a.kt)("inlineCode",{parentName:"p"},"no-std"),".\nThis means that instead of using the standard library, the ",(0,a.kt)("inlineCode",{parentName:"p"},"core"),"\ncrate will be linked to your code. This crate does not contain\na memory allocator."),(0,a.kt)("p",null,"Happily, Odra automatically enables allocator - from our tests\nthe one developed by ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/ink_allocator/latest/ink_allocator/"},"ink!"),"\nseems to be the best."),(0,a.kt)("h2",{id:"using-a-different-allocator"},"Using a different allocator"),(0,a.kt)("p",null,"If the default allocator does not suit your needs, or you use a crate that\nalready provides an allocator, you can disable the default allocator by enabling\nthe ",(0,a.kt)("inlineCode",{parentName:"p"},"disable-allocator")," feature in the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra")," dependency in your project:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[dependencies]\nodra = { path = "../odra", features = ["disable-allocator"] }\n')),(0,a.kt)("p",null,"If you want to have a better control over the features that are enabled\nduring the building and tests, see the next article on ",(0,a.kt)("a",{parentName:"p",href:"/docs/next/advanced/building-manually"},"building manually"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c24519ee.c9bb5e5f.js b/docs/assets/js/c24519ee.c9bb5e5f.js new file mode 100644 index 000000000..ca5ed549c --- /dev/null +++ b/docs/assets/js/c24519ee.c9bb5e5f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[87541],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},c),{},{components:t})):a.createElement(f,l({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d<o;d++)l[d]=t[d];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},52402:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={},l="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.4.0/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.4.0/advanced/02-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.4.0/advanced/delegate",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Module Composer",permalink:"/docs/0.4.0/advanced/composer"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.4.0/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n pub fn approve(&mut self, spender: Address, amount: U256);\n pub fn name(&self) -> String;\n pub fn symbol(&self) -> String;\n pub fn decimals(&self) -> u8;\n pub fn total_supply(&self) -> U256;\n pub fn balance_of(&self, owner: Address) -> U256;\n pub fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n pub fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: Ownable,\n erc20: Erc20,\n exchange: Exchange\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n pub fn swap(&mut self, sender: Address, recipient: Address);\n pub fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c3fd70b6.de5707fc.js b/docs/assets/js/c3fd70b6.de5707fc.js new file mode 100644 index 000000000..61217bd62 --- /dev/null +++ b/docs/assets/js/c3fd70b6.de5707fc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[68459],{28939:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/next/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/next/"},"next":{"title":"Installation","permalink":"/docs/next/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/c40f324a.a145b9fb.js b/docs/assets/js/c40f324a.a145b9fb.js new file mode 100644 index 000000000..35504e869 --- /dev/null +++ b/docs/assets/js/c40f324a.a145b9fb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[79812],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,f=d["".concat(l,".").concat(k)]||d[k]||p[k]||i;return n?r.createElement(f,o(o({ref:t},u),{},{components:n})):r.createElement(f,o({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c<i;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},8974:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:6},o="Ticketing System",s={unversionedId:"tutorials/nft",id:"tutorials/nft",title:"Ticketing System",description:"Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens.",source:"@site/docs/tutorials/nft.md",sourceDirName:"tutorials",slug:"/tutorials/nft",permalink:"/docs/next/tutorials/nft",draft:!1,tags:[],version:"current",lastUpdatedAt:1716209688,formattedLastUpdatedAt:"May 20, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"tutorialSidebar",previous:{title:"Pausable",permalink:"/docs/next/tutorials/pauseable"},next:{title:"Build, Deploy and Read the State of a Contract",permalink:"/docs/next/tutorials/build-deploy-read"}},l={},c=[{value:"Ticket Office Contract",id:"ticket-office-contract",level:3},{value:"Setup the project",id:"setup-the-project",level:3},{value:"Contract implementation",id:"contract-implementation",level:3},{value:"Redesign",id:"redesign",level:3},{value:"Ticket Operator Contract",id:"ticket-operator-contract",level:4},{value:"Conclusion",id:"conclusion",level:3}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ticketing-system"},"Ticketing System"),(0,a.kt)("p",null,"Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens."),(0,a.kt)("p",null,"Our contract will adhere to the CEP-78 standard, which is the standard for NFTs on the Casper blockchain."),(0,a.kt)("p",null,"Learn more about the CEP-78 standard ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/casper-ecosystem/cep-78-enhanced-nft/tree/dev/docs"},"here"),"."),(0,a.kt)("h3",{id:"ticket-office-contract"},"Ticket Office Contract"),(0,a.kt)("p",null,"Our TicketOffice contract will include the following features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Compliance with the CEP-78 standard."),(0,a.kt)("li",{parentName:"ul"},"Ownership functionality."),(0,a.kt)("li",{parentName:"ul"},"Only the owner can issue new event tickets."),(0,a.kt)("li",{parentName:"ul"},"Users can purchase tickets for events."),(0,a.kt)("li",{parentName:"ul"},"Tickets are limited to a one-time sale."),(0,a.kt)("li",{parentName:"ul"},"Public access to view the total income of the ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOffice"),".")),(0,a.kt)("h3",{id:"setup-the-project"},"Setup the project"),(0,a.kt)("p",null,"Creating a new NFT token with Odra is straightforward. Use the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command to create a new project with the CEP-78 template:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name ticket-office --template cep78\n")),(0,a.kt)("h3",{id:"contract-implementation"},"Contract implementation"),(0,a.kt)("p",null,"Let's start implementing the ",(0,a.kt)("inlineCode",{parentName:"p"},"TicketOffice")," contract by modify the code generated from the template. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},'use odra::{\n args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert\n};\nuse odra_modules::access::Ownable;\nuse odra_modules::cep78::{\n modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode},\n token::Cep78,\n};\n\npub type TicketId = u64;\n\n#[odra::odra_type]\npub enum TicketStatus {\n Available,\n Sold,\n}\n\n#[odra::odra_type]\npub struct TicketInfo {\n event_name: String,\n price: U512,\n status: TicketStatus,\n}\n\n#[odra::event]\npub struct OnTicketIssue {\n ticket_id: TicketId,\n event_name: String,\n price: U512,\n}\n\n#[odra::event]\npub struct OnTicketSell {\n ticket_id: TicketId,\n buyer: Address,\n}\n\n#[odra::odra_error]\npub enum Error {\n TicketNotAvailableForSale = 200,\n InsufficientFunds = 201,\n InvalidTicketId = 202,\n TicketDoesNotExist = 203,\n}\n\n#[odra::module(\n events = [OnTicketIssue, OnTicketSell],\n errors = Error\n)]\npub struct TicketOffice {\n token: SubModule<Cep78>,\n ownable: SubModule<Ownable>,\n tickets: Mapping<TicketId, TicketInfo>,\n}\n\n#[odra::module]\nimpl TicketOffice {\n pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) {\n self.ownable.init();\n let receipt_name = format!("cep78_{}", collection_name);\n self.token.init(\n collection_name,\n collection_symbol,\n total_supply,\n OwnershipMode::Transferable,\n NFTKind::Digital,\n NFTIdentifierMode::Ordinal,\n NFTMetadataKind::Raw,\n MetadataMutability::Immutable,\n receipt_name,\n // remaining args are optional and can set to Maybe::None\n ...\n );\n }\n\n pub fn issue_ticket(&mut self, event_name: String, price: U512) {\n let env = self.env();\n let caller = env.caller();\n self.ownable.assert_owner(&caller);\n // mint a new token\n let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None);\n let ticket_id: u64 = token_id\n .parse()\n .map_err(|_| Error::InvalidTicketId)\n .unwrap_or_revert(&env);\n // store ticket info\n self.tickets.set(\n &ticket_id,\n TicketInfo {\n event_name: event_name.clone(),\n price,\n status: TicketStatus::Available,\n },\n );\n // emit an event\n env.emit_event(OnTicketIssue {\n ticket_id,\n event_name,\n price,\n });\n }\n\n #[odra(payable)]\n pub fn buy_ticket(&mut self, ticket_id: TicketId) {\n let env = self.env();\n let owner = self.ownable.get_owner();\n let buyer = env.caller();\n let value = env.attached_value();\n // only tokens owned by the owner can be sold\n if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner {\n env.revert(Error::TicketNotAvailableForSale);\n }\n let mut ticket = self\n .tickets\n .get(&ticket_id)\n .unwrap_or_revert_with(&env, Error::TicketDoesNotExist);\n // only available tickets can be sold\n if ticket.status != TicketStatus::Available {\n env.revert(Error::TicketNotAvailableForSale);\n }\n // check if the buyer sends enough funds\n if value < ticket.price {\n env.revert(Error::InsufficientFunds);\n }\n // transfer csprs to the owner\n env.transfer_tokens(&owner, &value);\n // transfer the ticket to the buyer\n self.token\n .transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer);\n ticket.status = TicketStatus::Sold;\n self.tickets.set(&ticket_id, ticket);\n\n env.emit_event(OnTicketSell { ticket_id, buyer });\n }\n\n pub fn balance_of(&self) -> U512 {\n self.env().self_balance()\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10-L44")," - We define structures and enums that will be used in our contract. ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketStatus")," enum represents the status of a ticket, ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketInfo")," struct contains information about a ticket that is written to the storage, ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketId")," is a type alias for ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),". ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketIssue")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketSell")," are events that will be emitted when a ticket is issued or sold."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L46-L49")," - Register errors and events that will be used in our contract, required to produce a complete contract schema."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L51-L53")," - ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOffice")," module definition. The module contains a ",(0,a.kt)("inlineCode",{parentName:"li"},"Cep78")," token, an ",(0,a.kt)("inlineCode",{parentName:"li"},"Ownable")," module, and a ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," that stores information about tickets."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L58-L74")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"init")," function has been generated from the template and there is no need to modify it, except the ",(0,a.kt)("inlineCode",{parentName:"li"},"Ownable")," module initialization."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L76-L94")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"issue_ticket")," function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketIssue")," event."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L103")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"payable")," attribute indicates that the ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function can receive funds."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L104-L134")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an ",(0,a.kt)("inlineCode",{parentName:"li"},"OnTicketSell")," event.")),(0,a.kt)("p",null,"Lets test the contract. The test scenario will be as follows:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Deploy the contract."),(0,a.kt)("li",{parentName:"ol"},"Issue two tickets."),(0,a.kt)("li",{parentName:"ol"},"Try to buy a ticket with insufficient funds."),(0,a.kt)("li",{parentName:"ol"},"Buy tickets."),(0,a.kt)("li",{parentName:"ol"},"Try to buy the same ticket again."),(0,a.kt)("li",{parentName:"ol"},"Check the balance of the contract.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/tests.rs"',showLineNumbers:!0,title:'"src/tests.rs"'},'use odra::{\n casper_types::U512,\n host::{Deployer, HostRef},\n};\n\nuse crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs};\n\n#[test]\nfn it_works() {\n let env = odra_test::env();\n let init_args = TicketOfficeInitArgs {\n collection_name: "Ticket".to_string(),\n collection_symbol: "T".to_string(),\n total_supply: 100,\n }; \n let mut contract = TicketOfficeHostRef::deploy(&env, init_args);\n contract.issue_ticket("Ev".to_string(), U512::from(100));\n contract.issue_ticket("Ev".to_string(), U512::from(50));\n\n let buyer = env.get_account(1);\n env.set_caller(buyer);\n\n assert_eq!(\n contract\n .with_tokens(U512::from(50))\n .try_buy_ticket(0),\n Err(Error::InsufficientFunds.into())\n );\n\n assert_eq!(\n contract\n .with_tokens(U512::from(100))\n .try_buy_ticket(0),\n Ok(())\n );\n assert_eq!(\n contract\n .with_tokens(U512::from(50))\n .try_buy_ticket(1),\n Ok(())\n );\n\n assert_eq!(\n contract\n .with_tokens(U512::from(100))\n .try_buy_ticket(0),\n Err(Error::TicketNotAvailableForSale.into())\n );\n}\n')),(0,a.kt)("p",null,"Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with ",(0,a.kt)("inlineCode",{parentName:"p"},"Cep78Error::InvalidTokenOwner")," because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="odra/modules/src/cep78/token78.rs"',title:'"odra/modules/src/cep78/token78.rs"'},"pub fn transfer(\n &mut self,\n token_id: Maybe<u64>,\n token_hash: Maybe<String>,\n source_key: Address,\n target_key: Address\n) -> TransferReceipt {\n ...\n\n if !is_owner && !is_approved && !is_operator {\n self.revert(CEP78Error::InvalidTokenOwner);\n }\n\n ...\n}\n")),(0,a.kt)("p",null,"Let's fix it by redesigning our little system."),(0,a.kt)("h3",{id:"redesign"},"Redesign"),(0,a.kt)("p",null,"Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary \u2014 an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets."),(0,a.kt)("p",null,"The sequence diagram below illustrates the new flow:"),(0,a.kt)("mermaid",{value:"sequenceDiagram;\n autonumber\n actor Owner\n Owner->>+TicketOffice: Deploy\n Owner->>+Operator: Deploy\n actor Buyer\n Owner->>TicketOffice: call register_operator\n TicketOffice->>Operator: Register\n Operator->>TicketOffice: Register\n Owner->>TicketOffice: call issue_ticket\n TicketOffice->>Operator: Approve\n Buyer->>Operator: call buy_ticket\n Operator->>TicketOffice: call buy_ticket\n TicketOffice->>Buyer: Transfer ticket"}),(0,a.kt)("h4",{id:"ticket-operator-contract"},"Ticket Operator Contract"),(0,a.kt)("p",null,"As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra generate -c ticket_operator\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/ticket_operator.rs"',showLineNumbers:!0,title:'"src/ticket_operator.rs"'},"use crate::token::{TicketId, TicketOfficeContractRef};\nuse odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var};\n\n#[odra::odra_error]\npub enum Error {\n UnknownTicketOffice = 300,\n}\n\n#[odra::module(errors = Error)]\npub struct TicketOperator {\n ticket_office_address: Var<Address>,\n}\n\n#[odra::module]\nimpl TicketOperator {\n pub fn register(&mut self, ticket_office_address: Address) {\n self.ticket_office_address.set(ticket_office_address);\n }\n\n // now the operator's `buy_ticket` receives funds.\n #[odra(payable)]\n pub fn buy_ticket(&mut self, ticket_id: TicketId) {\n let env = self.env();\n let buyer = env.caller();\n let value = env.attached_value();\n let center = self\n .ticket_office_address\n .get()\n .unwrap_or_revert_with(&env, Error::UnknownTicketOffice);\n let mut ticket_contract = TicketOfficeContractRef::new(env, center);\n // now and approved entity - the operator - buys the ticket on behalf of the buyer\n ticket_contract.buy_ticket(ticket_id, buyer, value);\n }\n\n pub fn balance_of(&self) -> U512 {\n self.env().self_balance()\n }\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L4-L7")," - Define errors that will be used in the contract."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L9-L13")," - Define the ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOperator")," module that stores the address of the ticketing office."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L16-L18")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"register")," function sets the address of the ticketing office."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L20-L32")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOfficeContractRef")," to interact we the ",(0,a.kt)("inlineCode",{parentName:"li"},"TicketOffice")," contract. Note that, the operator's ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," now receives funds.")),(0,a.kt)("p",null,"Now we need to adjust the ",(0,a.kt)("inlineCode",{parentName:"p"},"TicketOffice")," contract to use the ",(0,a.kt)("inlineCode",{parentName:"p"},"TicketOperator")," contract to buy tickets."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"use odra::Var;\n\n... \n\n#[odra::odra_error]\npub enum Error {\n ...\n MissingOperator = 204,\n Unauthorized = 205,\n}\n\n#[odra::module]\npub struct TicketOffice {\n ...\n operator: Var<Address>,\n}\n\n#[odra::module]\nimpl TicketOffice {\n ... \n\n pub fn register_operator(&mut self, operator: Address) {\n // only the owner can register an operator\n let caller = self.env().caller();\n self.ownable.assert_owner(&caller);\n // store the ticketing center address in the operator contract\n TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address());\n self.operator.set(operator);\n }\n\n pub fn issue_ticket(&mut self, event_name: String, price: U512) {\n // minting logic remains the same...\n ...\n\n // approve the operator to transfer the ticket\n let operator = self.operator();\n self.token\n .approve(operator, Maybe::Some(ticket_id), Maybe::None);\n\n // emit an event\n ...\n }\n\n pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) {\n let env = self.env();\n let owner = self.ownable.get_owner();\n let caller = env.caller();\n // make sure the caller is the operator\n if !self.is_operator(caller) {\n env.revert(Error::Unauthorized);\n }\n\n ...\n // the logic remains the same, except for the csprs transfer\n // it is now handled by the operator contract.\n // env.transfer_tokens(&owner, &value);\n }\n\n #[inline]\n fn is_operator(&self, caller: Address) -> bool {\n Some(caller) == self.operator.get()\n }\n\n #[inline]\n fn operator(&self) -> Address {\n self.operator\n .get()\n .unwrap_or_revert_with(&self.env(), Error::MissingOperator)\n }\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L15")," - the contract stores the operator address."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L22-L29")," - a new function ",(0,a.kt)("inlineCode",{parentName:"li"},"register_operator")," allows the owner to register an operator. Also calls the ",(0,a.kt)("inlineCode",{parentName:"li"},"register")," entry point on the operator contract."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L36-38")," - modify the ",(0,a.kt)("inlineCode",{parentName:"li"},"issue_ticket")," function: once a new token is minted, approves the operator to transfer the ticket later."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L44-L57")," - modify the ",(0,a.kt)("inlineCode",{parentName:"li"},"buy_ticket")," function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds."),(0,a.kt)("li",{parentName:"ul"},"We also added two helper functions: ",(0,a.kt)("inlineCode",{parentName:"li"},"is_operator")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"operator")," to check if the caller is the operator and get the operator address. Two new errors were added: ",(0,a.kt)("inlineCode",{parentName:"li"},"MissingOperator")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"Unauthorized"),".")),(0,a.kt)("p",null,"Now we need to update our tests to create a scenario we presented in the sequence diagram."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/tests.rs"',showLineNumbers:!0,title:'"src/tests.rs"'},'use odra::{\n casper_types::U512,\n host::{Deployer, HostRef, NoArgs},\n OdraResult,\n};\n\nuse crate::{\n ticket_operator::TicketOperatorHostRef,\n token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs},\n};\n\n#[test]\nfn it_works() {\n let env = odra_test::env();\n let init_args = TicketOfficeInitArgs {\n collection_name: "Ticket".to_string(),\n collection_symbol: "T".to_string(),\n total_supply: 100,\n };\n let operator = TicketOperatorHostRef::deploy(&env, NoArgs);\n let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args);\n ticket_office.register_operator(operator.address().clone());\n ticket_office.issue_ticket("Ev".to_string(), U512::from(100));\n ticket_office.issue_ticket("Ev".to_string(), U512::from(50));\n\n let buyer = env.get_account(1);\n env.set_caller(buyer);\n\n assert_eq!(\n buy_ticket(&operator, 0, 50),\n Err(Error::InsufficientFunds.into())\n );\n assert_eq!(buy_ticket(&operator, 0, 100), Ok(()));\n assert_eq!(buy_ticket(&operator, 1, 50), Ok(()));\n assert_eq!(\n buy_ticket(&operator, 0, 100),\n Err(Error::TicketNotAvailableForSale.into())\n );\n\n assert_eq!(operator.balance_of(), U512::from(150));\n}\n\nfn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> {\n operator.with_tokens(U512::from(price)).try_buy_ticket(id)\n}\n\n')),(0,a.kt)("h3",{id:"conclusion"},"Conclusion"),(0,a.kt)("p",null,"In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c43892d3.fe422566.js b/docs/assets/js/c43892d3.fe422566.js new file mode 100644 index 000000000..837c5c8be --- /dev/null +++ b/docs/assets/js/c43892d3.fe422566.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[59138],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},64917:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="MockVM",c={unversionedId:"backends/mock-vm",id:"version-0.3.0/backends/mock-vm",title:"MockVM",description:"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.3.0/backends/02-mock-vm.md",sourceDirName:"backends",slug:"/backends/mock-vm",permalink:"/docs/0.3.0/backends/mock-vm",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.3.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.3.0/backends/casper"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mockvm"},"MockVM"),(0,a.kt)("p",null,"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The MockVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"MockVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is just a list of contracts deployed onto the MockVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),".\nEach time we call the contract, we call its instance stored in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the MockVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe MockVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the MockVM.\nThanks to this and the fact that we do not need the blockchain itself,\nMockVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the MockVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a Contract Container.\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, MockVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(MockVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c4f5d8e4.0f060f34.js b/docs/assets/js/c4f5d8e4.0f060f34.js new file mode 100644 index 000000000..288ba287d --- /dev/null +++ b/docs/assets/js/c4f5d8e4.0f060f34.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[64195],{9722:(e,a,t)=>{t.d(a,{Z:()=>c});var l,r=t(67294);function n(){return n=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},n.apply(this,arguments)}const c=e=>{let{title:a,titleId:t,...c}=e;return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:1088,height:687.962,viewBox:"0 0 1088 687.962","aria-labelledby":t},c),void 0===a?r.createElement("title",{id:t},"Easy to Use"):a?r.createElement("title",{id:t},a):null,l||(l=r.createElement("g",{"data-name":"Group 12"},r.createElement("g",{"data-name":"Group 11"},r.createElement("path",{"data-name":"Path 83",d:"M961.81 454.442c-5.27 45.15-16.22 81.4-31.25 110.31-20 38.52-54.21 54.04-84.77 70.28a193.275 193.275 0 0 1-27.46 11.94c-55.61 19.3-117.85 14.18-166.74 3.99a657.282 657.282 0 0 0-104.09-13.16q-14.97-.675-29.97-.67c-15.42.02-293.07 5.29-360.67-131.57-16.69-33.76-28.13-75-32.24-125.27-11.63-142.12 52.29-235.46 134.74-296.47 155.97-115.41 369.76-110.57 523.43 7.88 102.36 78.9 198.2 198.31 179.02 362.74Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 84",d:"M930.56 564.752c-20 38.52-47.21 64.04-77.77 80.28a193.272 193.272 0 0 1-27.46 11.94c-55.61 19.3-117.85 14.18-166.74 3.99a657.3 657.3 0 0 0-104.09-13.16q-14.97-.675-29.97-.67-23.13.03-46.25 1.72c-100.17 7.36-253.82-6.43-321.42-143.29L326 177.962l62.95 161.619 20.09 51.59 55.37-75.98L493 275.962l130.2 149.27 36.8-81.27 254.78 207.919 14.21 11.59Z",fill:"#f2f2f2"}),r.createElement("path",{"data-name":"Path 85",d:"m302 282.962 26-57 36 83-31-60Z",opacity:.1}),r.createElement("path",{"data-name":"Path 86",d:"M554.5 647.802q-14.97-.675-29.97-.67l-115.49-255.96Z",opacity:.1}),r.createElement("path",{"data-name":"Path 87",d:"M464.411 315.191 493 292.962l130 150-132-128Z",opacity:.1}),r.createElement("path",{"data-name":"Path 88",d:"M852.79 645.032a193.265 193.265 0 0 1-27.46 11.94L623.2 425.232Z",opacity:.1}),r.createElement("circle",{"data-name":"Ellipse 11",cx:3,cy:3,r:3,transform:"translate(479 98.962)",fill:"#f2f2f2"}),r.createElement("circle",{"data-name":"Ellipse 12",cx:3,cy:3,r:3,transform:"translate(396 201.962)",fill:"#f2f2f2"}),r.createElement("circle",{"data-name":"Ellipse 13",cx:2,cy:2,r:2,transform:"translate(600 220.962)",fill:"#f2f2f2"}),r.createElement("circle",{"data-name":"Ellipse 14",cx:2,cy:2,r:2,transform:"translate(180 265.962)",fill:"#f2f2f2"}),r.createElement("circle",{"data-name":"Ellipse 15",cx:2,cy:2,r:2,transform:"translate(612 96.962)",fill:"#f2f2f2"}),r.createElement("circle",{"data-name":"Ellipse 16",cx:2,cy:2,r:2,transform:"translate(736 192.962)",fill:"#f2f2f2"}),r.createElement("circle",{"data-name":"Ellipse 17",cx:2,cy:2,r:2,transform:"translate(858 344.962)",fill:"#f2f2f2"}),r.createElement("path",{"data-name":"Path 89",d:"M306 121.222h-2.76v-2.76h-1.48v2.76H299v1.478h2.76v2.759h1.48V122.7H306Z",fill:"#f2f2f2"}),r.createElement("path",{"data-name":"Path 90",d:"M848 424.222h-2.76v-2.76h-1.48v2.76H841v1.478h2.76v2.759h1.48V425.7H848Z",fill:"#f2f2f2"}),r.createElement("path",{"data-name":"Path 91",d:"M1088 613.962c0 16.569-243.557 74-544 74s-544-57.431-544-74 243.557 14 544 14 544-30.568 544-14Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 92",d:"M1088 613.962c0 16.569-243.557 74-544 74s-544-57.431-544-74 243.557 14 544 14 544-30.568 544-14Z",opacity:.1}),r.createElement("ellipse",{"data-name":"Ellipse 18",cx:544,cy:30,rx:544,ry:30,transform:"translate(0 583.962)",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 93",d:"M568 571.962c0 33.137-14.775 24-33 24s-33 9.137-33-24 33-96 33-96 33 62.863 33 96Z",fill:"#ff6584"}),r.createElement("path",{"data-name":"Path 94",d:"M550 584.641c0 15.062-6.716 10.909-15 10.909s-15 4.153-15-10.909 15-43.636 15-43.636 15 28.576 15 43.636Z",opacity:.1}),r.createElement("rect",{"data-name":"Rectangle 97",width:92,height:18,rx:9,transform:"translate(489 604.962)",fill:"#2f2e41"}),r.createElement("rect",{"data-name":"Rectangle 98",width:92,height:18,rx:9,transform:"translate(489 586.962)",fill:"#2f2e41"}),r.createElement("path",{"data-name":"Path 95",d:"M137 490.528c0 55.343 34.719 100.126 77.626 100.126",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 96",d:"M214.626 590.654c0-55.965 38.745-101.251 86.626-101.251",fill:"#6c63ff"}),r.createElement("path",{"data-name":"Path 97",d:"M165.125 495.545c0 52.57 22.14 95.109 49.5 95.109",fill:"#6c63ff"}),r.createElement("path",{"data-name":"Path 98",d:"M214.626 590.654c0-71.511 44.783-129.377 100.126-129.377",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 99",d:"M198.3 591.36s11.009-.339 14.326-2.7 16.934-5.183 17.757-1.395 16.544 18.844 4.115 18.945-28.879-1.936-32.19-3.953-4.008-10.897-4.008-10.897Z",fill:"#a8a8a8"}),r.createElement("path",{"data-name":"Path 100",d:"M234.716 604.89c-12.429.1-28.879-1.936-32.19-3.953-2.522-1.536-3.527-7.048-3.863-9.591l-.368.014s.7 8.879 4.009 10.9 19.761 4.053 32.19 3.953c3.588-.029 4.827-1.305 4.759-3.2-.498 1.142-1.867 1.855-4.537 1.877Z",opacity:.2}),r.createElement("path",{"data-name":"Path 101",d:"M721.429 527.062c0 38.029 23.857 68.8 53.341 68.8",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 102",d:"M774.769 595.863c0-38.456 26.623-69.575 59.525-69.575",fill:"#6c63ff"}),r.createElement("path",{"data-name":"Path 103",d:"M740.755 530.509c0 36.124 15.213 65.354 34.014 65.354",fill:"#6c63ff"}),r.createElement("path",{"data-name":"Path 104",d:"M774.769 595.863c0-49.139 30.773-88.9 68.8-88.9",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 105",d:"M763.548 596.348s7.565-.233 9.844-1.856 11.636-3.562 12.2-.958 11.368 12.949 2.828 13.018-19.844-1.33-22.119-2.716-2.753-7.488-2.753-7.488Z",fill:"#a8a8a8"}),r.createElement("path",{"data-name":"Path 106",d:"M788.574 605.645c-8.54.069-19.844-1.33-22.119-2.716-1.733-1.056-2.423-4.843-2.654-6.59l-.253.01s.479 6.1 2.755 7.487 13.579 2.785 22.119 2.716c2.465-.02 3.317-.9 3.27-2.2-.343.788-1.283 1.278-3.118 1.293Z",opacity:.2}),r.createElement("path",{"data-name":"Path 107",d:"M893.813 618.699s11.36-1.729 14.5-4.591 16.89-7.488 18.217-3.667 19.494 17.447 6.633 19.107-30.153 1.609-33.835-.065-5.515-10.784-5.515-10.784Z",fill:"#a8a8a8"}),r.createElement("path",{"data-name":"Path 108",d:"M933.228 628.154c-12.86 1.659-30.153 1.609-33.835-.065-2.8-1.275-4.535-6.858-5.2-9.45l-.379.061s1.833 9.109 5.516 10.783 20.975 1.725 33.835.065c3.712-.479 4.836-1.956 4.529-3.906-.375 1.246-1.703 2.156-4.466 2.512Z",opacity:.2}),r.createElement("path",{"data-name":"Path 109",d:"M614.26 617.881s9.587-1.459 12.237-3.875 14.255-6.32 15.374-3.095 16.452 14.725 5.6 16.125-25.448 1.358-28.555-.055-4.656-9.1-4.656-9.1Z",fill:"#a8a8a8"}),r.createElement("path",{"data-name":"Path 110",d:"M647.524 625.856c-10.853 1.4-25.448 1.358-28.555-.055-2.367-1.076-3.827-5.788-4.39-7.976l-.32.051s1.547 7.687 4.655 9.1 17.7 1.456 28.555.055c3.133-.4 4.081-1.651 3.822-3.3-.314 1.057-1.435 1.825-3.767 2.125Z",opacity:.2}),r.createElement("path",{"data-name":"Path 111",d:"M122.389 613.09s7.463-1.136 9.527-3.016 11.1-4.92 11.969-2.409 12.808 11.463 4.358 12.553-19.811 1.057-22.23-.043-3.624-7.085-3.624-7.085Z",fill:"#a8a8a8"}),r.createElement("path",{"data-name":"Path 112",d:"M148.285 619.302c-8.449 1.09-19.811 1.057-22.23-.043-1.842-.838-2.979-4.506-3.417-6.209l-.249.04s1.2 5.984 3.624 7.085 13.781 1.133 22.23.043c2.439-.315 3.177-1.285 2.976-2.566-.246.818-1.119 1.416-2.934 1.65Z",opacity:.2}),r.createElement("path",{"data-name":"Path 113",d:"M383.7 601.318c0 30.22-42.124 20.873-93.7 20.873s-93.074 9.347-93.074-20.873 42.118-36.793 93.694-36.793 93.08 6.573 93.08 36.793Z",opacity:.1}),r.createElement("path",{"data-name":"Path 114",d:"M383.7 593.881c0 30.22-42.124 20.873-93.7 20.873s-93.074 9.347-93.074-20.873 42.114-36.8 93.69-36.8 93.084 6.576 93.084 36.8Z",fill:"#3f3d56"})),r.createElement("path",{"data-name":"Path 40",d:"M360.175 475.732h91.791v37.153h-91.791Z",fill:"#fff",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 41",d:"M277.126 597.026a21.828 21.828 0 0 1-18.908-10.927 21.829 21.829 0 0 0 18.908 32.782h21.855v-21.855Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 42",d:"m375.451 481.607 76.514-4.782v-10.928a21.854 21.854 0 0 0-21.855-21.855h-98.347l-2.732-4.735a3.154 3.154 0 0 0-5.464 0l-2.732 4.732-2.732-4.732a3.154 3.154 0 0 0-5.464 0l-2.732 4.732-2.731-4.732a3.154 3.154 0 0 0-5.464 0l-2.732 4.735h-.071l-4.526-4.525a3.153 3.153 0 0 0-5.276 1.414l-1.5 5.577-5.674-1.521a3.154 3.154 0 0 0-3.863 3.864l1.52 5.679-5.575 1.494a3.155 3.155 0 0 0-1.416 5.278l4.526 4.526v.07l-4.735 2.731a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.732a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.731a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.727a3.154 3.154 0 0 0 0 5.464l4.735 2.736-4.735 2.732a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.732a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.731a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.732a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.731a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.731a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.735a3.154 3.154 0 0 0 0 5.464l4.732 2.732-4.732 2.728a3.154 3.154 0 0 0 0 5.464l4.732 2.732a21.854 21.854 0 0 0 21.858 21.855h131.13a21.854 21.854 0 0 0 21.855-21.855v-87.42l-76.514-4.782a11.632 11.632 0 0 1 0-23.219",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 43",d:"M408.255 618.882h32.782v-43.71h-32.782Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 44",d:"M462.893 591.563a5.438 5.438 0 0 0-.7.07c-.042-.164-.081-.329-.127-.493a5.457 5.457 0 1 0-5.4-9.372q-.181-.185-.366-.367a5.454 5.454 0 1 0-9.384-5.4c-.162-.046-.325-.084-.486-.126a5.467 5.467 0 1 0-10.788 0c-.162.042-.325.08-.486.126a5.457 5.457 0 1 0-9.384 5.4 21.843 21.843 0 1 0 36.421 21.02 5.452 5.452 0 1 0 .7-10.858",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 45",d:"M419.183 553.317h32.782v-21.855h-32.782Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 46",d:"M462.893 545.121a2.732 2.732 0 1 0 0-5.464 2.811 2.811 0 0 0-.349.035c-.022-.082-.04-.164-.063-.246a2.733 2.733 0 0 0-1.052-5.253 2.7 2.7 0 0 0-1.648.566q-.09-.093-.184-.184a2.7 2.7 0 0 0 .553-1.633 2.732 2.732 0 0 0-5.245-1.07 10.928 10.928 0 1 0 0 21.031 2.732 2.732 0 0 0 5.245-1.07 2.7 2.7 0 0 0-.553-1.633q.093-.09.184-.184a2.7 2.7 0 0 0 1.648.566 2.732 2.732 0 0 0 1.052-5.253c.023-.081.042-.164.063-.246a2.814 2.814 0 0 0 .349.035",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 47",d:"M320.836 479.556a2.732 2.732 0 0 1-2.732-2.732 8.2 8.2 0 0 0-16.391 0 2.732 2.732 0 0 1-5.464 0 13.66 13.66 0 0 1 27.319 0 2.732 2.732 0 0 1-2.732 2.732",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 48",d:"M364.546 618.881h65.565a21.854 21.854 0 0 0 21.855-21.855v-76.492h-65.565a21.854 21.854 0 0 0-21.855 21.855Z",fill:"#ffff50",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 49",d:"M435.596 554.41h-54.681a1.093 1.093 0 1 1 0-2.185h54.681a1.093 1.093 0 0 1 0 2.185m0 21.855h-54.681a1.093 1.093 0 1 1 0-2.186h54.681a1.093 1.093 0 0 1 0 2.186m0 21.855h-54.681a1.093 1.093 0 1 1 0-2.185h54.681a1.093 1.093 0 0 1 0 2.185m0-54.434h-54.681a1.093 1.093 0 1 1 0-2.185h54.681a1.093 1.093 0 0 1 0 2.185m0 21.652h-54.681a1.093 1.093 0 1 1 0-2.186h54.681a1.093 1.093 0 0 1 0 2.186m0 21.855h-54.681a1.093 1.093 0 1 1 0-2.186h54.681a1.093 1.093 0 0 1 0 2.186m16.369-100.959c-.013 0-.024-.007-.037-.005-3.377.115-4.974 3.492-6.384 6.472-1.471 3.114-2.608 5.139-4.473 5.078-2.064-.074-3.244-2.406-4.494-4.874-1.436-2.835-3.075-6.049-6.516-5.929-3.329.114-4.932 3.053-6.346 5.646-1.5 2.762-2.529 4.442-4.5 4.364-2.106-.076-3.225-1.972-4.52-4.167-1.444-2.443-3.112-5.191-6.487-5.1-3.272.113-4.879 2.606-6.3 4.808-1.5 2.328-2.552 3.746-4.551 3.662-2.156-.076-3.27-1.65-4.558-3.472-1.447-2.047-3.077-4.363-6.442-4.251-3.2.109-4.807 2.153-6.224 3.954-1.346 1.709-2.4 3.062-4.621 2.977a1.094 1.094 0 0 0-.079 2.186c3.3.11 4.967-1.967 6.417-3.81 1.286-1.635 2.4-3.045 4.582-3.12 2.1-.09 3.091 1.218 4.584 3.327 1.417 2 3.026 4.277 6.263 4.394 3.391.114 5.022-2.42 6.467-4.663 1.292-2 2.406-3.734 4.535-3.807 1.959-.073 3.026 1.475 4.529 4.022 1.417 2.4 3.023 5.121 6.324 5.241 3.415.118 5.064-2.863 6.5-5.5 1.245-2.282 2.419-4.437 4.5-4.509 1.959-.046 2.981 1.743 4.492 4.732 1.412 2.79 3.013 5.95 6.365 6.071h.185c3.348 0 4.937-3.36 6.343-6.331 1.245-2.634 2.423-5.114 4.444-5.216Z",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 50",d:"M342.691 618.882h43.71v-43.71h-43.71Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("g",{"data-name":"Group 8",transform:"rotate(-14.98 2188.845 -1120.376)"},r.createElement("rect",{"data-name":"Rectangle 3",width:92.361,height:36.462,rx:2,fill:"#d8d8d8"}),r.createElement("g",{"data-name":"Group 2",transform:"translate(1.531 23.03)",fill:"#4a4a4a"},r.createElement("rect",{"data-name":"Rectangle 4",width:5.336,height:5.336,rx:1,transform:"translate(16.797)"}),r.createElement("rect",{"data-name":"Rectangle 5",width:5.336,height:5.336,rx:1,transform:"translate(23.12)"}),r.createElement("rect",{"data-name":"Rectangle 6",width:5.336,height:5.336,rx:1,transform:"translate(29.444)"}),r.createElement("rect",{"data-name":"Rectangle 7",width:5.336,height:5.336,rx:1,transform:"translate(35.768)"}),r.createElement("rect",{"data-name":"Rectangle 8",width:5.336,height:5.336,rx:1,transform:"translate(42.091)"}),r.createElement("rect",{"data-name":"Rectangle 9",width:5.336,height:5.336,rx:1,transform:"translate(48.415)"}),r.createElement("rect",{"data-name":"Rectangle 10",width:5.336,height:5.336,rx:1,transform:"translate(54.739)"}),r.createElement("rect",{"data-name":"Rectangle 11",width:5.336,height:5.336,rx:1,transform:"translate(61.063)"}),r.createElement("rect",{"data-name":"Rectangle 12",width:5.336,height:5.336,rx:1,transform:"translate(67.386)"}),r.createElement("path",{"data-name":"Path 51",d:"M1.093 0h13.425a1.093 1.093 0 0 1 1.093 1.093v3.15a1.093 1.093 0 0 1-1.093 1.093H1.093A1.093 1.093 0 0 1 0 4.243v-3.15A1.093 1.093 0 0 1 1.093 0ZM75 0h13.426a1.093 1.093 0 0 1 1.093 1.093v3.15a1.093 1.093 0 0 1-1.093 1.093H75a1.093 1.093 0 0 1-1.093-1.093v-3.15A1.093 1.093 0 0 1 75 0Z",fillRule:"evenodd"})),r.createElement("g",{"data-name":"Group 3",transform:"translate(1.531 10.261)",fill:"#4a4a4a"},r.createElement("path",{"data-name":"Path 52",d:"M1.093 0h5.125A1.093 1.093 0 0 1 7.31 1.093v3.149a1.093 1.093 0 0 1-1.092 1.093H1.093A1.093 1.093 0 0 1 0 4.242V1.093A1.093 1.093 0 0 1 1.093 0Z",fillRule:"evenodd"}),r.createElement("rect",{"data-name":"Rectangle 13",width:5.336,height:5.336,rx:1,transform:"translate(8.299)"}),r.createElement("rect",{"data-name":"Rectangle 14",width:5.336,height:5.336,rx:1,transform:"translate(14.623)"}),r.createElement("rect",{"data-name":"Rectangle 15",width:5.336,height:5.336,rx:1,transform:"translate(20.947)"}),r.createElement("rect",{"data-name":"Rectangle 16",width:5.336,height:5.336,rx:1,transform:"translate(27.271)"}),r.createElement("rect",{"data-name":"Rectangle 17",width:5.336,height:5.336,rx:1,transform:"translate(33.594)"}),r.createElement("rect",{"data-name":"Rectangle 18",width:5.336,height:5.336,rx:1,transform:"translate(39.918)"}),r.createElement("rect",{"data-name":"Rectangle 19",width:5.336,height:5.336,rx:1,transform:"translate(46.242)"}),r.createElement("rect",{"data-name":"Rectangle 20",width:5.336,height:5.336,rx:1,transform:"translate(52.565)"}),r.createElement("rect",{"data-name":"Rectangle 21",width:5.336,height:5.336,rx:1,transform:"translate(58.888)"}),r.createElement("rect",{"data-name":"Rectangle 22",width:5.336,height:5.336,rx:1,transform:"translate(65.212)"}),r.createElement("rect",{"data-name":"Rectangle 23",width:5.336,height:5.336,rx:1,transform:"translate(71.536)"}),r.createElement("rect",{"data-name":"Rectangle 24",width:5.336,height:5.336,rx:1,transform:"translate(77.859)"}),r.createElement("rect",{"data-name":"Rectangle 25",width:5.336,height:5.336,rx:1,transform:"translate(84.183)"})),r.createElement("g",{"data-name":"Group 4",transform:"rotate(180 45.525 4.773)",fill:"#4a4a4a"},r.createElement("path",{"data-name":"Path 53",d:"M1.093 0h5.126a1.093 1.093 0 0 1 1.093 1.093v3.15a1.093 1.093 0 0 1-1.093 1.093H1.093A1.093 1.093 0 0 1 0 4.243v-3.15A1.093 1.093 0 0 1 1.093 0Z",fillRule:"evenodd"}),r.createElement("rect",{"data-name":"Rectangle 26",width:5.336,height:5.336,rx:1,transform:"translate(8.299)"}),r.createElement("rect",{"data-name":"Rectangle 27",width:5.336,height:5.336,rx:1,transform:"translate(14.623)"}),r.createElement("rect",{"data-name":"Rectangle 28",width:5.336,height:5.336,rx:1,transform:"translate(20.947)"}),r.createElement("rect",{"data-name":"Rectangle 29",width:5.336,height:5.336,rx:1,transform:"translate(27.271)"}),r.createElement("rect",{"data-name":"Rectangle 30",width:5.336,height:5.336,rx:1,transform:"translate(33.594)"}),r.createElement("rect",{"data-name":"Rectangle 31",width:5.336,height:5.336,rx:1,transform:"translate(39.918)"}),r.createElement("rect",{"data-name":"Rectangle 32",width:5.336,height:5.336,rx:1,transform:"translate(46.242)"}),r.createElement("rect",{"data-name":"Rectangle 33",width:5.336,height:5.336,rx:1,transform:"translate(52.565)"}),r.createElement("rect",{"data-name":"Rectangle 34",width:5.336,height:5.336,rx:1,transform:"translate(58.889)"}),r.createElement("rect",{"data-name":"Rectangle 35",width:5.336,height:5.336,rx:1,transform:"translate(65.213)"}),r.createElement("rect",{"data-name":"Rectangle 36",width:5.336,height:5.336,rx:1,transform:"translate(71.537)"}),r.createElement("rect",{"data-name":"Rectangle 37",width:5.336,height:5.336,rx:1,transform:"translate(77.86)"}),r.createElement("rect",{"data-name":"Rectangle 38",width:5.336,height:5.336,rx:1,transform:"translate(84.183)"}),r.createElement("rect",{"data-name":"Rectangle 39",width:5.336,height:5.336,rx:1,transform:"translate(8.299)"}),r.createElement("rect",{"data-name":"Rectangle 40",width:5.336,height:5.336,rx:1,transform:"translate(14.623)"}),r.createElement("rect",{"data-name":"Rectangle 41",width:5.336,height:5.336,rx:1,transform:"translate(20.947)"}),r.createElement("rect",{"data-name":"Rectangle 42",width:5.336,height:5.336,rx:1,transform:"translate(27.271)"}),r.createElement("rect",{"data-name":"Rectangle 43",width:5.336,height:5.336,rx:1,transform:"translate(33.594)"}),r.createElement("rect",{"data-name":"Rectangle 44",width:5.336,height:5.336,rx:1,transform:"translate(39.918)"}),r.createElement("rect",{"data-name":"Rectangle 45",width:5.336,height:5.336,rx:1,transform:"translate(46.242)"}),r.createElement("rect",{"data-name":"Rectangle 46",width:5.336,height:5.336,rx:1,transform:"translate(52.565)"}),r.createElement("rect",{"data-name":"Rectangle 47",width:5.336,height:5.336,rx:1,transform:"translate(58.889)"}),r.createElement("rect",{"data-name":"Rectangle 48",width:5.336,height:5.336,rx:1,transform:"translate(65.213)"}),r.createElement("rect",{"data-name":"Rectangle 49",width:5.336,height:5.336,rx:1,transform:"translate(71.537)"}),r.createElement("rect",{"data-name":"Rectangle 50",width:5.336,height:5.336,rx:1,transform:"translate(77.86)"}),r.createElement("rect",{"data-name":"Rectangle 51",width:5.336,height:5.336,rx:1,transform:"translate(84.183)"})),r.createElement("g",{"data-name":"Group 6",fill:"#4a4a4a"},r.createElement("path",{"data-name":"Path 54",d:"M2.624 16.584h7.3a1.093 1.093 0 0 1 1.092 1.093v3.15a1.093 1.093 0 0 1-1.093 1.093h-7.3a1.093 1.093 0 0 1-1.092-1.093v-3.149a1.093 1.093 0 0 1 1.093-1.094Z",fillRule:"evenodd"}),r.createElement("g",{"data-name":"Group 5",transform:"translate(12.202 16.584)"},r.createElement("rect",{"data-name":"Rectangle 52",width:5.336,height:5.336,rx:1}),r.createElement("rect",{"data-name":"Rectangle 53",width:5.336,height:5.336,rx:1,transform:"translate(6.324)"}),r.createElement("rect",{"data-name":"Rectangle 54",width:5.336,height:5.336,rx:1,transform:"translate(12.647)"}),r.createElement("rect",{"data-name":"Rectangle 55",width:5.336,height:5.336,rx:1,transform:"translate(18.971)"}),r.createElement("rect",{"data-name":"Rectangle 56",width:5.336,height:5.336,rx:1,transform:"translate(25.295)"}),r.createElement("rect",{"data-name":"Rectangle 57",width:5.336,height:5.336,rx:1,transform:"translate(31.619)"}),r.createElement("rect",{"data-name":"Rectangle 58",width:5.336,height:5.336,rx:1,transform:"translate(37.942)"}),r.createElement("rect",{"data-name":"Rectangle 59",width:5.336,height:5.336,rx:1,transform:"translate(44.265)"}),r.createElement("rect",{"data-name":"Rectangle 60",width:5.336,height:5.336,rx:1,transform:"translate(50.589)"}),r.createElement("rect",{"data-name":"Rectangle 61",width:5.336,height:5.336,rx:1,transform:"translate(56.912)"}),r.createElement("rect",{"data-name":"Rectangle 62",width:5.336,height:5.336,rx:1,transform:"translate(63.236)"})),r.createElement("path",{"data-name":"Path 55",d:"M83.053 16.584h6.906a1.093 1.093 0 0 1 1.091 1.093v3.15a1.093 1.093 0 0 1-1.091 1.093h-6.907a1.093 1.093 0 0 1-1.093-1.093v-3.149a1.093 1.093 0 0 1 1.093-1.094Z",fillRule:"evenodd"})),r.createElement("g",{"data-name":"Group 7",transform:"translate(1.531 29.627)",fill:"#4a4a4a"},r.createElement("rect",{"data-name":"Rectangle 63",width:5.336,height:5.336,rx:1}),r.createElement("rect",{"data-name":"Rectangle 64",width:5.336,height:5.336,rx:1,transform:"translate(6.324)"}),r.createElement("rect",{"data-name":"Rectangle 65",width:5.336,height:5.336,rx:1,transform:"translate(12.647)"}),r.createElement("rect",{"data-name":"Rectangle 66",width:5.336,height:5.336,rx:1,transform:"translate(18.971)"}),r.createElement("path",{"data-name":"Path 56",d:"M26.387 0h30.422a1.093 1.093 0 0 1 1.093 1.093v3.151a1.093 1.093 0 0 1-1.093 1.093H26.387a1.093 1.093 0 0 1-1.093-1.093V1.093A1.093 1.093 0 0 1 26.387 0Zm33.594 0h3.942a1.093 1.093 0 0 1 1.093 1.093v3.151a1.093 1.093 0 0 1-1.093 1.093h-3.942a1.093 1.093 0 0 1-1.093-1.093V1.093A1.093 1.093 0 0 1 59.981 0Z",fillRule:"evenodd"}),r.createElement("rect",{"data-name":"Rectangle 67",width:5.336,height:5.336,rx:1,transform:"translate(66.003)"}),r.createElement("rect",{"data-name":"Rectangle 68",width:5.336,height:5.336,rx:1,transform:"translate(72.327)"}),r.createElement("rect",{"data-name":"Rectangle 69",width:5.336,height:5.336,rx:1,transform:"translate(84.183)"}),r.createElement("path",{"data-name":"Path 57",d:"M78.254 2.273v-1.18A1.093 1.093 0 0 1 79.347 0h3.15a1.093 1.093 0 0 1 1.093 1.093v1.18Z"}),r.createElement("path",{"data-name":"Path 58",d:"M83.591 3.063v1.18a1.093 1.093 0 0 1-1.093 1.093h-3.15a1.093 1.093 0 0 1-1.093-1.093v-1.18Z"})),r.createElement("rect",{"data-name":"Rectangle 70",width:88.927,height:2.371,rx:1.085,transform:"translate(1.925 1.17)",fill:"#4a4a4a"}),r.createElement("rect",{"data-name":"Rectangle 71",width:4.986,height:1.581,rx:.723,transform:"translate(4.1 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 72",width:4.986,height:1.581,rx:.723,transform:"translate(10.923 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 73",width:4.986,height:1.581,rx:.723,transform:"translate(16.173 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 74",width:4.986,height:1.581,rx:.723,transform:"translate(21.421 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 75",width:4.986,height:1.581,rx:.723,transform:"translate(26.671 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 76",width:4.986,height:1.581,rx:.723,transform:"translate(33.232 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 77",width:4.986,height:1.581,rx:.723,transform:"translate(38.48 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 78",width:4.986,height:1.581,rx:.723,transform:"translate(43.73 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 79",width:4.986,height:1.581,rx:.723,transform:"translate(48.978 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 80",width:4.986,height:1.581,rx:.723,transform:"translate(55.54 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 81",width:4.986,height:1.581,rx:.723,transform:"translate(60.788 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 82",width:4.986,height:1.581,rx:.723,transform:"translate(66.038 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 83",width:4.986,height:1.581,rx:.723,transform:"translate(72.599 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 84",width:4.986,height:1.581,rx:.723,transform:"translate(77.847 1.566)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 85",width:4.986,height:1.581,rx:.723,transform:"translate(83.097 1.566)",fill:"#d8d8d8",opacity:.136})),r.createElement("path",{"data-name":"Path 59",d:"M408.256 591.563a5.439 5.439 0 0 0-.7.07c-.042-.164-.081-.329-.127-.493a5.457 5.457 0 1 0-5.4-9.372q-.181-.185-.366-.367a5.454 5.454 0 1 0-9.384-5.4c-.162-.046-.325-.084-.486-.126a5.467 5.467 0 1 0-10.788 0c-.162.042-.325.08-.486.126a5.457 5.457 0 1 0-9.384 5.4 21.843 21.843 0 1 0 36.421 21.02 5.452 5.452 0 1 0 .7-10.858",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 60",d:"M342.691 553.317h43.71v-21.855h-43.71Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 61",d:"M397.328 545.121a2.732 2.732 0 1 0 0-5.464 2.811 2.811 0 0 0-.349.035c-.022-.082-.04-.164-.063-.246a2.733 2.733 0 0 0-1.052-5.253 2.7 2.7 0 0 0-1.648.566q-.09-.093-.184-.184a2.7 2.7 0 0 0 .553-1.633 2.732 2.732 0 0 0-5.245-1.07 10.928 10.928 0 1 0 0 21.031 2.732 2.732 0 0 0 5.245-1.07 2.7 2.7 0 0 0-.553-1.633q.093-.09.184-.184a2.7 2.7 0 0 0 1.648.566 2.732 2.732 0 0 0 1.052-5.253c.023-.081.042-.164.063-.246a2.811 2.811 0 0 0 .349.035",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 62",d:"M408.256 464.531a2.967 2.967 0 0 1-.535-.055 2.754 2.754 0 0 1-.514-.153 2.838 2.838 0 0 1-.471-.251 4.139 4.139 0 0 1-.415-.339 3.2 3.2 0 0 1-.338-.415 2.7 2.7 0 0 1-.459-1.517 2.968 2.968 0 0 1 .055-.535 3.152 3.152 0 0 1 .152-.514 2.874 2.874 0 0 1 .252-.47 2.633 2.633 0 0 1 .753-.754 2.837 2.837 0 0 1 .471-.251 2.753 2.753 0 0 1 .514-.153 2.527 2.527 0 0 1 1.071 0 2.654 2.654 0 0 1 .983.4 4.139 4.139 0 0 1 .415.339 4.019 4.019 0 0 1 .339.415 2.786 2.786 0 0 1 .251.47 2.864 2.864 0 0 1 .208 1.049 2.77 2.77 0 0 1-.8 1.934 4.139 4.139 0 0 1-.415.339 2.722 2.722 0 0 1-1.519.459m21.855-1.366a2.789 2.789 0 0 1-1.935-.8 4.162 4.162 0 0 1-.338-.415 2.7 2.7 0 0 1-.459-1.519 2.789 2.789 0 0 1 .8-1.934 4.139 4.139 0 0 1 .415-.339 2.838 2.838 0 0 1 .471-.251 2.752 2.752 0 0 1 .514-.153 2.527 2.527 0 0 1 1.071 0 2.654 2.654 0 0 1 .983.4 4.139 4.139 0 0 1 .415.339 2.79 2.79 0 0 1 .8 1.934 3.069 3.069 0 0 1-.055.535 2.779 2.779 0 0 1-.153.514 3.885 3.885 0 0 1-.251.47 4.02 4.02 0 0 1-.339.415 4.138 4.138 0 0 1-.415.339 2.722 2.722 0 0 1-1.519.459",fillRule:"evenodd"}))))}},88066:(e,a,t)=>{t.d(a,{Z:()=>c});var l,r=t(67294);function n(){return n=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},n.apply(this,arguments)}const c=e=>{let{title:a,titleId:t,...c}=e;return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:1041.277,height:554.141,viewBox:"0 0 1041.277 554.141","aria-labelledby":t},c),void 0===a?r.createElement("title",{id:t},"Powered by React"):a?r.createElement("title",{id:t},a):null,l||(l=r.createElement("g",{"data-name":"Group 24"},r.createElement("g",{"data-name":"Group 23",transform:"translate(-.011 -.035)"},r.createElement("path",{"data-name":"Path 299",d:"M961.48 438.21q-1.74 3.75-3.47 7.4-2.7 5.67-5.33 11.12c-.78 1.61-1.56 3.19-2.32 4.77-8.6 17.57-16.63 33.11-23.45 45.89a73.21 73.21 0 0 1-63.81 38.7l-151.65 1.65h-1.6l-13 .14-11.12.12-34.1.37h-1.38l-17.36.19h-.53l-107 1.16-95.51 1-11.11.12-69 .75h-.08l-44.75.48h-.48l-141.5 1.53-42.33.46a87.991 87.991 0 0 1-10.79-.54c-1.22-.14-2.44-.3-3.65-.49a87.38 87.38 0 0 1-51.29-27.54c-18.21-20.03-31.46-43.4-40.36-68.76q-1.93-5.49-3.6-11.12c-30.81-104.15 6.75-238.52 74.35-328.44q4.25-5.64 8.64-11l.07-.08c20.79-25.52 44.1-46.84 68.93-62 44-26.91 92.75-34.49 140.7-11.9 40.57 19.12 78.45 28.11 115.17 30.55 3.71.24 7.42.42 11.11.53 84.23 2.65 163.17-27.7 255.87-47.29 3.69-.78 7.39-1.55 11.12-2.28C763 .54 836.36-6.4 923.6 8.19a189.089 189.089 0 0 1 26.76 6.4q5.77 1.86 11.12 4c41.64 16.94 64.35 48.24 74 87.46q1.37 5.46 2.37 11.11c17.11 94.34-33 228.16-76.37 321.05Z",fill:"#f2f2f2"}),r.createElement("path",{"data-name":"Path 300",d:"M497.02 445.61a95.21 95.21 0 0 1-1.87 11.12h93.7v-11.12Zm-78.25 62.81 11.11-.09v-27.47c-3.81-.17-7.52-.34-11.11-.52Zm-232.92-62.81v11.12h198.5v-11.12Zm849.68-339.52h-74V18.6q-5.35-2.17-11.12-4v91.49H696.87V13.67c-3.73.73-7.43 1.5-11.12 2.28v90.14H429.88V63.24c-3.69-.11-7.4-.29-11.11-.53v43.38H162.9v-62c-24.83 15.16-48.14 36.48-68.93 62h-.07v.08q-4.4 5.4-8.64 11h8.64v328.44h-83q1.66 5.63 3.6 11.12h79.39v93.62a87 87 0 0 0 12.2 2.79c1.21.19 2.43.35 3.65.49a87.991 87.991 0 0 0 10.79.54l42.33-.46v-97h255.91v94.21l11.11-.12v-94.07h255.87v91.36l11.12-.12v-91.24h253.49v4.77c.76-1.58 1.54-3.16 2.32-4.77q2.63-5.45 5.33-11.12 1.73-3.64 3.47-7.4v-321h76.42q-1.01-5.69-2.37-11.12ZM162.9 445.61V117.17h255.87v328.44Zm267 0V117.17h255.85v328.44Zm520.48 0H696.87V117.17h253.49Z",opacity:.1}),r.createElement("path",{"data-name":"Path 301",d:"M863.09 533.65v13l-151.92 1.4-1.62.03-57.74.53-1.38.02-17.55.15h-.52l-106.98.99-175.61 1.63h-.15l-44.65.42-.48.01-198.4 1.82v-15l46.65-28 93.6-.78 2-.01.66-.01 2-.03 44.94-.37 2.01-.01.64-.01 2-.01 14.41-.12.38-.01 35.55-.3h.29l277.4-2.34 6.79-.05h.68l5.18-.05 37.65-.31 2-.03 1.85-.02h.96l11.71-.09 2.32-.03 3.11-.02 9.75-.09 15.47-.13 2-.02 3.48-.02h.65l74.71-.64Z",fill:"#65617d"}),r.createElement("path",{"data-name":"Path 302",d:"M863.09 533.65v13l-151.92 1.4-1.62.03-57.74.53-1.38.02-17.55.15h-.52l-106.98.99-175.61 1.63h-.15l-44.65.42-.48.01-198.4 1.82v-15l46.65-28 93.6-.78 2-.01.66-.01 2-.03 44.94-.37 2.01-.01.64-.01 2-.01 14.41-.12.38-.01 35.55-.3h.29l277.4-2.34 6.79-.05h.68l5.18-.05 37.65-.31 2-.03 1.85-.02h.96l11.71-.09 2.32-.03 3.11-.02 9.75-.09 15.47-.13 2-.02 3.48-.02h.65l74.71-.64Z",opacity:.2}),r.createElement("path",{"data-name":"Path 303",d:"M296.1 483.66v24.49a6.13 6.13 0 0 1-3.5 5.54 6 6 0 0 1-2.5.6l-34.9.74a6 6 0 0 1-2.7-.57 6.12 6.12 0 0 1-3.57-5.57v-25.23Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 304",d:"M296.1 483.66v24.49a6.13 6.13 0 0 1-3.5 5.54 6 6 0 0 1-2.5.6l-34.9.74a6 6 0 0 1-2.7-.57 6.12 6.12 0 0 1-3.57-5.57v-25.23Z",opacity:.1}),r.createElement("path",{"data-name":"Path 305",d:"M298.1 483.66v24.49a6.13 6.13 0 0 1-3.5 5.54 6 6 0 0 1-2.5.6l-34.9.74a6 6 0 0 1-2.7-.57 6.12 6.12 0 0 1-3.57-5.57v-25.23Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Rectangle 137",fill:"#3f3d56",d:"M680.92 483.65h47.17v31.5h-47.17z"}),r.createElement("path",{"data-name":"Rectangle 138",opacity:.1,d:"M680.92 483.65h47.17v31.5h-47.17z"}),r.createElement("path",{"data-name":"Rectangle 139",fill:"#3f3d56",d:"M678.92 483.65h47.17v31.5h-47.17z"}),r.createElement("path",{"data-name":"Path 306",d:"M298.09 483.65v4.97l-47.17 1.26v-6.23Z",opacity:.1}),r.createElement("path",{"data-name":"Path 307",d:"M381.35 312.36v168.2a4 4 0 0 1-3.85 3.95l-191.65 5.1h-.05a4 4 0 0 1-3.95-3.95v-173.3a4 4 0 0 1 3.95-3.95h191.6a4 4 0 0 1 3.95 3.95Z",fill:"#65617d"}),r.createElement("path",{"data-name":"Path 308",d:"M185.85 308.41v181.2h-.05a4 4 0 0 1-3.95-3.95v-173.3a4 4 0 0 1 3.95-3.95Z",opacity:.1}),r.createElement("path",{"data-name":"Path 309",d:"M194.59 319.15h177.5V467.4l-177.5 4Z",fill:"#39374d"}),r.createElement("path",{"data-name":"Path 310",d:"M726.09 483.65v6.41l-47.17-1.26v-5.15Z",opacity:.1}),r.createElement("path",{"data-name":"Path 311",d:"M788.35 312.36v173.3a4 4 0 0 1-4 3.95l-191.69-5.1a4 4 0 0 1-3.85-3.95v-168.2a4 4 0 0 1 3.95-3.95h191.6a4 4 0 0 1 3.99 3.95Z",fill:"#65617d"}),r.createElement("path",{"data-name":"Path 312",d:"M788.35 312.36v173.3a4 4 0 0 1-4 3.95v-181.2a4 4 0 0 1 4 3.95Z",opacity:.1}),r.createElement("path",{"data-name":"Path 313",d:"M775.59 319.15h-177.5V467.4l177.5 4Z",fill:"#39374d"}),r.createElement("path",{"data-name":"Path 314",d:"M583.85 312.36v168.2a4 4 0 0 1-3.85 3.95l-191.65 5.1a4 4 0 0 1-4-3.95v-173.3a4 4 0 0 1 3.95-3.95h191.6a4 4 0 0 1 3.95 3.95Z",fill:"#65617d"}),r.createElement("path",{"data-name":"Path 315",d:"M397.09 319.15h177.5V467.4l-177.5 4Z",fill:"#4267b2"}),r.createElement("path",{"data-name":"Path 316",d:"M863.09 533.65v13l-151.92 1.4-1.62.03-57.74.53-1.38.02-17.55.15h-.52l-106.98.99-175.61 1.63h-.15l-44.65.42-.48.01-198.4 1.82v-15l202.51-1.33h.48l40.99-.28h.19l283.08-1.87h.29l.17-.01h.47l4.79-.03h1.46l74.49-.5 4.4-.02.98-.01Z",opacity:.1}),r.createElement("circle",{"data-name":"Ellipse 111",cx:51.33,cy:51.33,r:51.33,transform:"translate(435.93 246.82)",fill:"#fbbebe"}),r.createElement("path",{"data-name":"Path 317",d:"M538.6 377.16s-99.5 12-90 0c3.44-4.34 4.39-17.2 4.2-31.85-.06-4.45-.22-9.06-.45-13.65-1.1-22-3.75-43.5-3.75-43.5s87-41 77-8.5c-4 13.13-2.69 31.57.35 48.88.89 5.05 1.92 10 3 14.7a344.66 344.66 0 0 0 9.65 33.92Z",fill:"#fbbebe"}),r.createElement("path",{"data-name":"Path 318",d:"M506.13 373.09c11.51-2.13 23.7-6 34.53-1.54 2.85 1.17 5.47 2.88 8.39 3.86s6.12 1.22 9.16 1.91c10.68 2.42 19.34 10.55 24.9 20s8.44 20.14 11.26 30.72l6.9 25.83c6 22.45 12 45.09 13.39 68.3a2437.506 2437.506 0 0 1-250.84 1.43c5.44-10.34 11-21.31 10.54-33s-7.19-23.22-4.76-34.74c1.55-7.34 6.57-13.39 9.64-20.22 8.75-19.52 1.94-45.79 17.32-60.65 6.92-6.68 17-9.21 26.63-8.89 12.28.41 24.85 4.24 37 6.11 15.56 2.36 30.26 3.76 45.94.88Z",fill:"#ff6584"}),r.createElement("path",{"data-name":"Path 319",d:"m637.03 484.26-.1 1.43v.1l-.17 2.3-1.33 18.51-1.61 22.3-.46 6.28-1 13.44v.17l-107 1-175.59 1.9v.84h-.14v-1.12l.45-14.36.86-28.06.74-23.79.07-2.37a10.53 10.53 0 0 1 11.42-10.17c4.72.4 10.85.89 18.18 1.41l3 .22c42.33 2.94 120.56 6.74 199.5 2 1.66-.09 3.33-.19 5-.31 12.24-.77 24.47-1.76 36.58-3a10.53 10.53 0 0 1 11.6 11.23Z",opacity:.1}),r.createElement("path",{"data-name":"Path 320",d:"M349.74 552.53v-.84l175.62-1.91 107-1h.3v-.17l1-13.44.43-6 1.64-22.61 1.29-17.9v-.44a10.617 10.617 0 0 0-.11-2.47.3.3 0 0 0 0-.1 10.391 10.391 0 0 0-2-4.64 10.54 10.54 0 0 0-9.42-4 937.419 937.419 0 0 1-36.58 3c-1.67.12-3.34.22-5 .31-78.94 4.69-157.17.89-199.5-2l-3-.22c-7.33-.52-13.46-1-18.18-1.41a10.54 10.54 0 0 0-11.24 8.53 11 11 0 0 0-.18 1.64l-.68 22.16-.93 28.07-.44 14.36v1.12Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 321",d:"m637.33 491.27-1.23 15.33-1.83 22.85-.46 5.72-1 12.81-.06.64v.17l-.15 1.48.11-1.48h-.29l-107 1-175.65 1.9v-.28l.49-14.36 1-28.06.64-18.65a6.36 6.36 0 0 1 3.06-5.25 6.25 6.25 0 0 1 3.78-.9c2.1.17 4.68.37 7.69.59 4.89.36 10.92.78 17.94 1.22 13 .82 29.31 1.7 48 2.42 52 2 122.2 2.67 188.88-3.17 3-.26 6.1-.55 9.13-.84a6.26 6.26 0 0 1 3.48.66 5.159 5.159 0 0 1 .86.54 6.14 6.14 0 0 1 2 2.46 3.564 3.564 0 0 1 .25.61 6.279 6.279 0 0 1 .36 2.59Z",opacity:.1}),r.createElement("path",{"data-name":"Path 322",d:"M298.1 504.96v3.19a6.13 6.13 0 0 1-3.5 5.54l-40.1.77a6.12 6.12 0 0 1-3.57-5.57v-3Z",opacity:.1}),r.createElement("path",{"data-name":"Path 323",d:"m298.59 515.57-52.25 1v-8.67l52.25-1Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 324",d:"m298.59 515.57-52.25 1v-8.67l52.25-1Z",opacity:.1}),r.createElement("path",{"data-name":"Path 325",d:"m300.59 515.57-52.25 1v-8.67l52.25-1Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 326",d:"M679.22 506.96v3.19a6.13 6.13 0 0 0 3.5 5.54l40.1.77a6.12 6.12 0 0 0 3.57-5.57v-3Z",opacity:.1}),r.createElement("path",{"data-name":"Path 327",d:"m678.72 517.57 52.25 1v-8.67l-52.25-1Z",opacity:.1}),r.createElement("path",{"data-name":"Path 328",d:"m676.72 517.57 52.25 1v-8.67l-52.25-1Z",fill:"#3f3d56"}),r.createElement("path",{"data-name":"Path 329",d:"M454.79 313.88c.08 7-3.16 13.6-5.91 20.07a163.491 163.491 0 0 0-12.66 74.71c.73 11 2.58 22 .73 32.9s-8.43 21.77-19 24.9c17.53 10.45 41.26 9.35 57.76-2.66 8.79-6.4 15.34-15.33 21.75-24.11a97.86 97.86 0 0 1-13.31 44.75 103.43 103.43 0 0 0 73.51-40.82c4.31-5.81 8.06-12.19 9.72-19.23 3.09-13-1.22-26.51-4.51-39.5a266.055 266.055 0 0 1-6.17-33c-.43-3.56-.78-7.22.1-10.7 1-4.07 3.67-7.51 5.64-11.22 5.6-10.54 5.73-23.3 2.86-34.88s-8.49-22.26-14.06-32.81c-4.46-8.46-9.3-17.31-17.46-22.28-5.1-3.1-11-4.39-16.88-5.64l-25.37-5.43c-5.55-1.19-11.26-2.38-16.87-1.51-9.47 1.48-16.14 8.32-22 15.34-4.59 5.46-15.81 15.71-16.6 22.86-.72 6.59 5.1 17.63 6.09 24.58 1.3 9 2.22 6 7.3 11.52 3.21 3.42 5.28 7.37 5.34 12.16Z",fill:"#3f3d56"})),r.createElement("path",{"data-name":"Path 40",d:"M280.139 370.832h43.635v17.662h-43.635Z",fill:"#fff",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 41",d:"M240.66 428.493a10.377 10.377 0 0 1-8.989-5.195 10.377 10.377 0 0 0 8.988 15.584h10.391v-10.389Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 42",d:"m287.402 373.625 36.373-2.273v-5.195a10.389 10.389 0 0 0-10.39-10.389h-46.75l-1.3-2.249a1.5 1.5 0 0 0-2.6 0l-1.3 2.249-1.3-2.249a1.5 1.5 0 0 0-2.6 0l-1.3 2.249-1.3-2.249a1.5 1.5 0 0 0-2.6 0l-1.3 2.249h-.034l-2.152-2.151a1.5 1.5 0 0 0-2.508.672l-.696 2.653-2.7-.723a1.5 1.5 0 0 0-1.836 1.837l.722 2.7-2.65.71a1.5 1.5 0 0 0-.673 2.509l2.152 2.152v.033l-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.25 1.282-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3-2.249 1.3a1.5 1.5 0 0 0 0 2.6l2.249 1.3a10.389 10.389 0 0 0 10.389 10.34h62.335a10.389 10.389 0 0 0 10.39-10.39v-41.557l-36.373-2.273a5.53 5.53 0 0 1 0-11.038",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 43",d:"M302.996 438.882h15.584v-20.779h-15.584Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 44",d:"M328.97 425.895a2.582 2.582 0 0 0-.332.033c-.02-.078-.038-.156-.06-.234a2.594 2.594 0 1 0-2.567-4.455q-.086-.088-.174-.175a2.593 2.593 0 1 0-4.461-2.569c-.077-.022-.154-.04-.231-.06a2.6 2.6 0 1 0-5.128 0c-.077.02-.154.038-.231.06a2.594 2.594 0 1 0-4.461 2.569 10.384 10.384 0 1 0 17.314 9.992 2.592 2.592 0 1 0 .332-5.161",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 45",d:"M308.191 407.713h15.584v-10.389h-15.584Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 46",d:"M328.969 403.818a1.3 1.3 0 1 0 0-2.6 1.336 1.336 0 0 0-.166.017l-.03-.117a1.3 1.3 0 0 0-.5-2.5 1.285 1.285 0 0 0-.783.269l-.087-.087a1.285 1.285 0 0 0 .263-.776 1.3 1.3 0 0 0-2.493-.509 5.195 5.195 0 1 0 0 10 1.3 1.3 0 0 0 2.493-.509 1.285 1.285 0 0 0-.263-.776l.087-.087a1.285 1.285 0 0 0 .783.269 1.3 1.3 0 0 0 .5-2.5c.011-.038.02-.078.03-.117a1.337 1.337 0 0 0 .166.017",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 47",d:"M261.439 372.65a1.3 1.3 0 0 1-1.3-1.3 3.9 3.9 0 0 0-7.792 0 1.3 1.3 0 1 1-2.6 0 6.494 6.494 0 0 1 12.987 0 1.3 1.3 0 0 1-1.3 1.3",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 48",d:"M282.217 438.882h31.168a10.389 10.389 0 0 0 10.389-10.389V392.13h-31.168a10.389 10.389 0 0 0-10.389 10.389Z",fill:"#ffff50",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 49",d:"M315.993 408.233h-25.994a.52.52 0 1 1 0-1.039h25.994a.52.52 0 0 1 0 1.039m0 10.389h-25.994a.52.52 0 1 1 0-1.039h25.994a.52.52 0 0 1 0 1.039m0 10.389h-25.994a.52.52 0 1 1 0-1.039h25.994a.52.52 0 0 1 0 1.039m0-25.877h-25.994a.52.52 0 1 1 0-1.039h25.994a.52.52 0 0 1 0 1.039m0 10.293h-25.994a.52.52 0 1 1 0-1.039h25.994a.52.52 0 0 1 0 1.039m0 10.389h-25.994a.52.52 0 1 1 0-1.039h25.994a.52.52 0 0 1 0 1.039m7.782-47.993h-.018c-1.605.055-2.365 1.66-3.035 3.077-.7 1.48-1.24 2.443-2.126 2.414-.981-.035-1.542-1.144-2.137-2.317-.683-1.347-1.462-2.876-3.1-2.819-1.582.054-2.344 1.451-3.017 2.684-.715 1.313-1.2 2.112-2.141 2.075-1-.036-1.533-.938-2.149-1.981-.686-1.162-1.479-2.467-3.084-2.423-1.555.053-2.319 1.239-2.994 2.286-.713 1.106-1.213 1.781-2.164 1.741-1.025-.036-1.554-.784-2.167-1.65-.688-.973-1.463-2.074-3.062-2.021a3.815 3.815 0 0 0-2.959 1.879c-.64.812-1.14 1.456-2.2 1.415a.52.52 0 0 0-.037 1.039 3.588 3.588 0 0 0 3.05-1.811c.611-.777 1.139-1.448 2.178-1.483 1-.043 1.47.579 2.179 1.582.674.953 1.438 2.033 2.977 2.089 1.612.054 2.387-1.151 3.074-2.217.614-.953 1.144-1.775 2.156-1.81.931-.035 1.438.7 2.153 1.912.674 1.141 1.437 2.434 3.006 2.491 1.623.056 2.407-1.361 3.09-2.616.592-1.085 1.15-2.109 2.14-2.143.931-.022 1.417.829 2.135 2.249.671 1.326 1.432 2.828 3.026 2.886h.088c1.592 0 2.347-1.6 3.015-3.01.592-1.252 1.152-2.431 2.113-2.479Z",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 50",d:"M271.828 438.882h20.779v-20.779h-20.779Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("g",{"data-name":"Group 8",transform:"rotate(-14.98 1643.944 -873.93)"},r.createElement("rect",{"data-name":"Rectangle 3",width:43.906,height:17.333,rx:2,fill:"#d8d8d8"}),r.createElement("g",{"data-name":"Group 2",transform:"translate(.728 10.948)",fill:"#4a4a4a"},r.createElement("rect",{"data-name":"Rectangle 4",width:2.537,height:2.537,rx:1,transform:"translate(7.985)"}),r.createElement("rect",{"data-name":"Rectangle 5",width:2.537,height:2.537,rx:1,transform:"translate(10.991)"}),r.createElement("rect",{"data-name":"Rectangle 6",width:2.537,height:2.537,rx:1,transform:"translate(13.997)"}),r.createElement("rect",{"data-name":"Rectangle 7",width:2.537,height:2.537,rx:1,transform:"translate(17.003)"}),r.createElement("rect",{"data-name":"Rectangle 8",width:2.537,height:2.537,rx:1,transform:"translate(20.009)"}),r.createElement("rect",{"data-name":"Rectangle 9",width:2.537,height:2.537,rx:1,transform:"translate(23.015)"}),r.createElement("rect",{"data-name":"Rectangle 10",width:2.537,height:2.537,rx:1,transform:"translate(26.021)"}),r.createElement("rect",{"data-name":"Rectangle 11",width:2.537,height:2.537,rx:1,transform:"translate(29.028)"}),r.createElement("rect",{"data-name":"Rectangle 12",width:2.537,height:2.537,rx:1,transform:"translate(32.034)"}),r.createElement("path",{"data-name":"Path 51",d:"M.519 0H6.9a.519.519 0 0 1 .521.52v1.5a.519.519 0 0 1-.519.519H.519A.519.519 0 0 1 0 2.017V.519A.519.519 0 0 1 .519 0Zm35.134 0h6.383a.519.519 0 0 1 .519.519v1.5a.519.519 0 0 1-.519.519h-6.384a.519.519 0 0 1-.519-.519v-1.5A.519.519 0 0 1 35.652 0Z",fillRule:"evenodd"})),r.createElement("g",{"data-name":"Group 3",transform:"translate(.728 4.878)",fill:"#4a4a4a"},r.createElement("path",{"data-name":"Path 52",d:"M.519 0h2.437a.519.519 0 0 1 .519.519v1.5a.519.519 0 0 1-.519.519H.519A.519.519 0 0 1 0 2.017V.519A.519.519 0 0 1 .519 0Z",fillRule:"evenodd"}),r.createElement("rect",{"data-name":"Rectangle 13",width:2.537,height:2.537,rx:1,transform:"translate(3.945)"}),r.createElement("rect",{"data-name":"Rectangle 14",width:2.537,height:2.537,rx:1,transform:"translate(6.951)"}),r.createElement("rect",{"data-name":"Rectangle 15",width:2.537,height:2.537,rx:1,transform:"translate(9.958)"}),r.createElement("rect",{"data-name":"Rectangle 16",width:2.537,height:2.537,rx:1,transform:"translate(12.964)"}),r.createElement("rect",{"data-name":"Rectangle 17",width:2.537,height:2.537,rx:1,transform:"translate(15.97)"}),r.createElement("rect",{"data-name":"Rectangle 18",width:2.537,height:2.537,rx:1,transform:"translate(18.976)"}),r.createElement("rect",{"data-name":"Rectangle 19",width:2.537,height:2.537,rx:1,transform:"translate(21.982)"}),r.createElement("rect",{"data-name":"Rectangle 20",width:2.537,height:2.537,rx:1,transform:"translate(24.988)"}),r.createElement("rect",{"data-name":"Rectangle 21",width:2.537,height:2.537,rx:1,transform:"translate(27.994)"}),r.createElement("rect",{"data-name":"Rectangle 22",width:2.537,height:2.537,rx:1,transform:"translate(31)"}),r.createElement("rect",{"data-name":"Rectangle 23",width:2.537,height:2.537,rx:1,transform:"translate(34.006)"}),r.createElement("rect",{"data-name":"Rectangle 24",width:2.537,height:2.537,rx:1,transform:"translate(37.012)"}),r.createElement("rect",{"data-name":"Rectangle 25",width:2.537,height:2.537,rx:1,transform:"translate(40.018)"})),r.createElement("g",{"data-name":"Group 4",transform:"rotate(180 21.642 2.269)",fill:"#4a4a4a"},r.createElement("path",{"data-name":"Path 53",d:"M.519 0h2.437a.519.519 0 0 1 .519.519v1.5a.519.519 0 0 1-.519.519H.519A.519.519 0 0 1 0 2.017V.519A.519.519 0 0 1 .519 0Z",fillRule:"evenodd"}),r.createElement("rect",{"data-name":"Rectangle 26",width:2.537,height:2.537,rx:1,transform:"translate(3.945)"}),r.createElement("rect",{"data-name":"Rectangle 27",width:2.537,height:2.537,rx:1,transform:"translate(6.951)"}),r.createElement("rect",{"data-name":"Rectangle 28",width:2.537,height:2.537,rx:1,transform:"translate(9.958)"}),r.createElement("rect",{"data-name":"Rectangle 29",width:2.537,height:2.537,rx:1,transform:"translate(12.964)"}),r.createElement("rect",{"data-name":"Rectangle 30",width:2.537,height:2.537,rx:1,transform:"translate(15.97)"}),r.createElement("rect",{"data-name":"Rectangle 31",width:2.537,height:2.537,rx:1,transform:"translate(18.976)"}),r.createElement("rect",{"data-name":"Rectangle 32",width:2.537,height:2.537,rx:1,transform:"translate(21.982)"}),r.createElement("rect",{"data-name":"Rectangle 33",width:2.537,height:2.537,rx:1,transform:"translate(24.988)"}),r.createElement("rect",{"data-name":"Rectangle 34",width:2.537,height:2.537,rx:1,transform:"translate(27.994)"}),r.createElement("rect",{"data-name":"Rectangle 35",width:2.537,height:2.537,rx:1,transform:"translate(31.001)"}),r.createElement("rect",{"data-name":"Rectangle 36",width:2.537,height:2.537,rx:1,transform:"translate(34.007)"}),r.createElement("rect",{"data-name":"Rectangle 37",width:2.537,height:2.537,rx:1,transform:"translate(37.013)"}),r.createElement("rect",{"data-name":"Rectangle 38",width:2.537,height:2.537,rx:1,transform:"translate(40.018)"}),r.createElement("rect",{"data-name":"Rectangle 39",width:2.537,height:2.537,rx:1,transform:"translate(3.945)"}),r.createElement("rect",{"data-name":"Rectangle 40",width:2.537,height:2.537,rx:1,transform:"translate(6.951)"}),r.createElement("rect",{"data-name":"Rectangle 41",width:2.537,height:2.537,rx:1,transform:"translate(9.958)"}),r.createElement("rect",{"data-name":"Rectangle 42",width:2.537,height:2.537,rx:1,transform:"translate(12.964)"}),r.createElement("rect",{"data-name":"Rectangle 43",width:2.537,height:2.537,rx:1,transform:"translate(15.97)"}),r.createElement("rect",{"data-name":"Rectangle 44",width:2.537,height:2.537,rx:1,transform:"translate(18.976)"}),r.createElement("rect",{"data-name":"Rectangle 45",width:2.537,height:2.537,rx:1,transform:"translate(21.982)"}),r.createElement("rect",{"data-name":"Rectangle 46",width:2.537,height:2.537,rx:1,transform:"translate(24.988)"}),r.createElement("rect",{"data-name":"Rectangle 47",width:2.537,height:2.537,rx:1,transform:"translate(27.994)"}),r.createElement("rect",{"data-name":"Rectangle 48",width:2.537,height:2.537,rx:1,transform:"translate(31.001)"}),r.createElement("rect",{"data-name":"Rectangle 49",width:2.537,height:2.537,rx:1,transform:"translate(34.007)"}),r.createElement("rect",{"data-name":"Rectangle 50",width:2.537,height:2.537,rx:1,transform:"translate(37.013)"}),r.createElement("rect",{"data-name":"Rectangle 51",width:2.537,height:2.537,rx:1,transform:"translate(40.018)"})),r.createElement("g",{"data-name":"Group 6",fill:"#4a4a4a"},r.createElement("path",{"data-name":"Path 54",d:"M1.247 7.883h3.47a.519.519 0 0 1 .519.519v1.5a.519.519 0 0 1-.519.519h-3.47A.519.519 0 0 1 .728 9.9V8.403a.519.519 0 0 1 .519-.52Z",fillRule:"evenodd"}),r.createElement("g",{"data-name":"Group 5",transform:"translate(5.801 7.883)"},r.createElement("rect",{"data-name":"Rectangle 52",width:2.537,height:2.537,rx:1}),r.createElement("rect",{"data-name":"Rectangle 53",width:2.537,height:2.537,rx:1,transform:"translate(3.006)"}),r.createElement("rect",{"data-name":"Rectangle 54",width:2.537,height:2.537,rx:1,transform:"translate(6.012)"}),r.createElement("rect",{"data-name":"Rectangle 55",width:2.537,height:2.537,rx:1,transform:"translate(9.018)"}),r.createElement("rect",{"data-name":"Rectangle 56",width:2.537,height:2.537,rx:1,transform:"translate(12.025)"}),r.createElement("rect",{"data-name":"Rectangle 57",width:2.537,height:2.537,rx:1,transform:"translate(15.031)"}),r.createElement("rect",{"data-name":"Rectangle 58",width:2.537,height:2.537,rx:1,transform:"translate(18.037)"}),r.createElement("rect",{"data-name":"Rectangle 59",width:2.537,height:2.537,rx:1,transform:"translate(21.042)"}),r.createElement("rect",{"data-name":"Rectangle 60",width:2.537,height:2.537,rx:1,transform:"translate(24.049)"}),r.createElement("rect",{"data-name":"Rectangle 61",width:2.537,height:2.537,rx:1,transform:"translate(27.055)"}),r.createElement("rect",{"data-name":"Rectangle 62",width:2.537,height:2.537,rx:1,transform:"translate(30.061)"})),r.createElement("path",{"data-name":"Path 55",d:"M39.482 7.883h3.28a.519.519 0 0 1 .519.519v1.5a.519.519 0 0 1-.519.519h-3.281a.519.519 0 0 1-.519-.521V8.403a.519.519 0 0 1 .519-.52Z",fillRule:"evenodd"})),r.createElement("g",{"data-name":"Group 7",transform:"translate(.728 14.084)",fill:"#4a4a4a"},r.createElement("rect",{"data-name":"Rectangle 63",width:2.537,height:2.537,rx:1}),r.createElement("rect",{"data-name":"Rectangle 64",width:2.537,height:2.537,rx:1,transform:"translate(3.006)"}),r.createElement("rect",{"data-name":"Rectangle 65",width:2.537,height:2.537,rx:1,transform:"translate(6.012)"}),r.createElement("rect",{"data-name":"Rectangle 66",width:2.537,height:2.537,rx:1,transform:"translate(9.018)"}),r.createElement("path",{"data-name":"Path 56",d:"M12.543 0h14.462a.519.519 0 0 1 .519.519v1.5a.519.519 0 0 1-.519.519H12.543a.519.519 0 0 1-.519-.52V.519A.519.519 0 0 1 12.543 0Zm15.97 0h1.874a.519.519 0 0 1 .519.519v1.5a.519.519 0 0 1-.519.519h-1.874a.519.519 0 0 1-.519-.519v-1.5A.519.519 0 0 1 28.513 0Z",fillRule:"evenodd"}),r.createElement("rect",{"data-name":"Rectangle 67",width:2.537,height:2.537,rx:1,transform:"translate(31.376)"}),r.createElement("rect",{"data-name":"Rectangle 68",width:2.537,height:2.537,rx:1,transform:"translate(34.382)"}),r.createElement("rect",{"data-name":"Rectangle 69",width:2.537,height:2.537,rx:1,transform:"translate(40.018)"}),r.createElement("path",{"data-name":"Path 57",d:"M37.199 1.08V.519A.519.519 0 0 1 37.718 0h1.499a.519.519 0 0 1 .519.519v.561Z"}),r.createElement("path",{"data-name":"Path 58",d:"M39.737 1.456v.561a.519.519 0 0 1-.519.519h-1.499a.519.519 0 0 1-.519-.519v-.561Z"})),r.createElement("rect",{"data-name":"Rectangle 70",width:42.273,height:1.127,rx:.564,transform:"translate(.915 .556)",fill:"#4a4a4a"}),r.createElement("rect",{"data-name":"Rectangle 71",width:2.37,height:.752,rx:.376,transform:"translate(1.949 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 72",width:2.37,height:.752,rx:.376,transform:"translate(5.193 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 73",width:2.37,height:.752,rx:.376,transform:"translate(7.688 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 74",width:2.37,height:.752,rx:.376,transform:"translate(10.183 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 75",width:2.37,height:.752,rx:.376,transform:"translate(12.679 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 76",width:2.37,height:.752,rx:.376,transform:"translate(15.797 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 77",width:2.37,height:.752,rx:.376,transform:"translate(18.292 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 78",width:2.37,height:.752,rx:.376,transform:"translate(20.788 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 79",width:2.37,height:.752,rx:.376,transform:"translate(23.283 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 80",width:2.37,height:.752,rx:.376,transform:"translate(26.402 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 81",width:2.37,height:.752,rx:.376,transform:"translate(28.897 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 82",width:2.37,height:.752,rx:.376,transform:"translate(31.393 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 83",width:2.37,height:.752,rx:.376,transform:"translate(34.512 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 84",width:2.37,height:.752,rx:.376,transform:"translate(37.007 .744)",fill:"#d8d8d8",opacity:.136}),r.createElement("rect",{"data-name":"Rectangle 85",width:2.37,height:.752,rx:.376,transform:"translate(39.502 .744)",fill:"#d8d8d8",opacity:.136})),r.createElement("path",{"data-name":"Path 59",d:"M302.996 425.895a2.583 2.583 0 0 0-.332.033c-.02-.078-.038-.156-.06-.234a2.594 2.594 0 1 0-2.567-4.455q-.086-.088-.174-.175a2.593 2.593 0 1 0-4.461-2.569c-.077-.022-.154-.04-.231-.06a2.6 2.6 0 1 0-5.128 0c-.077.02-.154.038-.231.06a2.594 2.594 0 1 0-4.461 2.569 10.384 10.384 0 1 0 17.314 9.992 2.592 2.592 0 1 0 .332-5.161",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 60",d:"M271.828 407.713h20.779v-10.389h-20.779Z",fill:"#3ecc5f",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 61",d:"M297.801 403.818a1.3 1.3 0 1 0 0-2.6 1.338 1.338 0 0 0-.166.017l-.03-.117a1.3 1.3 0 0 0-.5-2.5 1.285 1.285 0 0 0-.783.269l-.087-.087a1.285 1.285 0 0 0 .263-.776 1.3 1.3 0 0 0-2.493-.509 5.195 5.195 0 1 0 0 10 1.3 1.3 0 0 0 2.493-.509 1.285 1.285 0 0 0-.263-.776l.087-.087a1.285 1.285 0 0 0 .783.269 1.3 1.3 0 0 0 .5-2.5c.011-.038.02-.078.03-.117a1.335 1.335 0 0 0 .166.017",fill:"#44d860",fillRule:"evenodd"}),r.createElement("path",{"data-name":"Path 62",d:"M302.997 365.507a1.41 1.41 0 0 1-.255-.026 1.309 1.309 0 0 1-.244-.073 1.349 1.349 0 0 1-.224-.119 1.967 1.967 0 0 1-.2-.161 1.52 1.52 0 0 1-.161-.2 1.282 1.282 0 0 1-.218-.722 1.41 1.41 0 0 1 .026-.255 1.5 1.5 0 0 1 .072-.244 1.364 1.364 0 0 1 .12-.223 1.252 1.252 0 0 1 .358-.358 1.349 1.349 0 0 1 .224-.119 1.309 1.309 0 0 1 .244-.073 1.2 1.2 0 0 1 .509 0 1.262 1.262 0 0 1 .468.192 1.968 1.968 0 0 1 .2.161 1.908 1.908 0 0 1 .161.2 1.322 1.322 0 0 1 .12.223 1.361 1.361 0 0 1 .1.5 1.317 1.317 0 0 1-.379.919 1.968 1.968 0 0 1-.2.161 1.346 1.346 0 0 1-.223.119 1.332 1.332 0 0 1-.5.1m10.389-.649a1.326 1.326 0 0 1-.92-.379 1.979 1.979 0 0 1-.161-.2 1.282 1.282 0 0 1-.218-.722 1.326 1.326 0 0 1 .379-.919 1.967 1.967 0 0 1 .2-.161 1.351 1.351 0 0 1 .224-.119 1.308 1.308 0 0 1 .244-.073 1.2 1.2 0 0 1 .509 0 1.262 1.262 0 0 1 .468.192 1.967 1.967 0 0 1 .2.161 1.326 1.326 0 0 1 .379.919 1.461 1.461 0 0 1-.026.255 1.323 1.323 0 0 1-.073.244 1.847 1.847 0 0 1-.119.223 1.911 1.911 0 0 1-.161.2 1.967 1.967 0 0 1-.2.161 1.294 1.294 0 0 1-.722.218",fillRule:"evenodd"}),r.createElement("g",{transform:"translate(466.3 278.56)",fill:"#61dafb"},r.createElement("path",{"data-name":"Path 330",d:"M263.668 117.179c0-5.827-7.3-11.35-18.487-14.775 2.582-11.4 1.434-20.477-3.622-23.382a7.861 7.861 0 0 0-4.016-1v4a4.152 4.152 0 0 1 2.044.466c2.439 1.4 3.5 6.724 2.672 13.574-.2 1.685-.52 3.461-.914 5.272a86.9 86.9 0 0 0-11.386-1.954 87.469 87.469 0 0 0-7.459-8.965c5.845-5.433 11.332-8.41 15.062-8.41V78c-4.931 0-11.386 3.514-17.913 9.611-6.527-6.061-12.982-9.539-17.913-9.539v4c3.712 0 9.216 2.959 15.062 8.356a84.687 84.687 0 0 0-7.405 8.947 83.732 83.732 0 0 0-11.4 1.972 54.136 54.136 0 0 1-.932-5.2c-.843-6.85.2-12.175 2.618-13.592a3.991 3.991 0 0 1 2.062-.466v-4a8 8 0 0 0-4.052 1c-5.039 2.9-6.168 11.96-3.568 23.328-11.153 3.443-18.415 8.947-18.415 14.757 0 5.828 7.3 11.35 18.487 14.775-2.582 11.4-1.434 20.477 3.622 23.382a7.882 7.882 0 0 0 4.034 1c4.931 0 11.386-3.514 17.913-9.611 6.527 6.061 12.982 9.539 17.913 9.539a8 8 0 0 0 4.052-1c5.039-2.9 6.168-11.96 3.568-23.328 11.111-3.42 18.373-8.943 18.373-14.752Zm-23.346-11.96a80.235 80.235 0 0 1-2.421 7.083 83.185 83.185 0 0 0-2.349-4.3 96.877 96.877 0 0 0-2.582-4.2c2.547.377 5.004.843 7.353 1.417Zm-8.212 19.1c-1.4 2.421-2.833 4.716-4.321 6.85a93.313 93.313 0 0 1-8.1.359c-2.708 0-5.415-.126-8.069-.341q-2.232-3.2-4.339-6.814-2.044-3.523-3.73-7.136a94.058 94.058 0 0 1 3.712-7.154c1.4-2.421 2.833-4.716 4.321-6.85a93.313 93.313 0 0 1 8.1-.359c2.708 0 5.415.126 8.069.341q2.232 3.2 4.339 6.814 2.044 3.523 3.73 7.136a101.198 101.198 0 0 1-3.712 7.15Zm5.792-2.331a76.525 76.525 0 0 1 2.474 7.136 80.22 80.22 0 0 1-7.387 1.434c.879-1.381 1.757-2.8 2.582-4.25a96.22 96.22 0 0 0 2.329-4.324Zm-18.182 19.128a73.921 73.921 0 0 1-4.985-5.738c1.614.072 3.263.126 4.931.126 1.685 0 3.353-.036 4.985-.126a69.993 69.993 0 0 1-4.931 5.738Zm-13.34-10.561c-2.546-.377-5-.843-7.352-1.417a80.235 80.235 0 0 1 2.421-7.083c.735 1.434 1.506 2.869 2.349 4.3s1.702 2.837 2.582 4.2Zm13.25-37.314a73.924 73.924 0 0 1 4.985 5.738 110.567 110.567 0 0 0-4.931-.126c-1.686 0-3.353.036-4.985.126a69.993 69.993 0 0 1 4.931-5.738ZM206.362 103.8a100.567 100.567 0 0 0-4.913 8.55 76.525 76.525 0 0 1-2.474-7.136 90.158 90.158 0 0 1 7.387-1.414Zm-16.227 22.449c-6.348-2.708-10.454-6.258-10.454-9.073s4.106-6.383 10.454-9.073c1.542-.663 3.228-1.255 4.967-1.811a86.122 86.122 0 0 0 4.034 10.92 84.9 84.9 0 0 0-3.981 10.866 53.804 53.804 0 0 1-5.021-1.826Zm9.647 25.623c-2.439-1.4-3.5-6.724-2.672-13.574.2-1.686.52-3.461.914-5.272a86.9 86.9 0 0 0 11.386 1.954 87.465 87.465 0 0 0 7.459 8.965c-5.845 5.433-11.332 8.41-15.062 8.41a4.279 4.279 0 0 1-2.026-.48Zm42.532-13.663c.843 6.85-.2 12.175-2.618 13.592a3.99 3.99 0 0 1-2.062.466c-3.712 0-9.216-2.959-15.062-8.356a84.689 84.689 0 0 0 7.405-8.947 83.731 83.731 0 0 0 11.4-1.972 50.194 50.194 0 0 1 .936 5.22Zm6.9-11.96c-1.542.663-3.228 1.255-4.967 1.811a86.12 86.12 0 0 0-4.034-10.92 84.9 84.9 0 0 0 3.981-10.866 56.777 56.777 0 0 1 5.039 1.829c6.348 2.708 10.454 6.258 10.454 9.073-.017 2.818-4.123 6.386-10.471 9.076Z"}),r.createElement("path",{"data-name":"Path 331",d:"M201.718 78.072Z"}),r.createElement("circle",{"data-name":"Ellipse 112",cx:8.194,cy:8.194,r:8.194,transform:"translate(211.472 108.984)"}),r.createElement("path",{"data-name":"Path 332",d:"M237.525 78.018Z"})))))}},14002:(e,a,t)=>{t.d(a,{Z:()=>S});var l,r,n,c,h,m,d,i,f,s,o,g,E,p,v,R,x,w,u,Z,M,y,P,b,q,V,A,H,G,N,O,_,j,k,z,D,F=t(67294);function C(){return C=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},C.apply(this,arguments)}const S=e=>{let{title:a,titleId:t,...S}=e;return F.createElement("svg",C({xmlns:"http://www.w3.org/2000/svg",width:1129,height:663,viewBox:"0 0 1129 663","aria-labelledby":t},S),void 0===a?F.createElement("title",{id:t},"Focus on What Matters"):a?F.createElement("title",{id:t},a):null,l||(l=F.createElement("circle",{cx:321,cy:321,r:321,fill:"#f2f2f2"})),r||(r=F.createElement("ellipse",{cx:559,cy:635.5,rx:514,ry:27.5,fill:"#3f3d56"})),n||(n=F.createElement("ellipse",{cx:558,cy:627,rx:460,ry:22,opacity:.2})),c||(c=F.createElement("path",{fill:"#3f3d56",d:"M131 152.5h840v50H131z"})),h||(h=F.createElement("path",{d:"M131 608.83a21.67 21.67 0 0 0 21.67 21.67h796.66A21.67 21.67 0 0 0 971 608.83V177.5H131ZM949.33 117.5H152.67A21.67 21.67 0 0 0 131 139.17v38.33h840v-38.33a21.67 21.67 0 0 0-21.67-21.67Z",fill:"#3f3d56"})),m||(m=F.createElement("path",{d:"M949.33 117.5H152.67A21.67 21.67 0 0 0 131 139.17v38.33h840v-38.33a21.67 21.67 0 0 0-21.67-21.67Z",opacity:.2})),d||(d=F.createElement("circle",{cx:181,cy:147.5,r:13,fill:"#3f3d56"})),i||(i=F.createElement("circle",{cx:217,cy:147.5,r:13,fill:"#3f3d56"})),f||(f=F.createElement("circle",{cx:253,cy:147.5,r:13,fill:"#3f3d56"})),s||(s=F.createElement("rect",{x:168,y:213.5,width:337,height:386,rx:5.335,fill:"#606060"})),o||(o=F.createElement("rect",{x:603,y:272.5,width:284,height:22,rx:5.476,fill:"#2e8555"})),g||(g=F.createElement("rect",{x:537,y:352.5,width:416,height:15,rx:5.476,fill:"#2e8555"})),E||(E=F.createElement("rect",{x:537,y:396.5,width:416,height:15,rx:5.476,fill:"#2e8555"})),p||(p=F.createElement("rect",{x:537,y:440.5,width:416,height:15,rx:5.476,fill:"#2e8555"})),v||(v=F.createElement("rect",{x:537,y:484.5,width:416,height:15,rx:5.476,fill:"#2e8555"})),R||(R=F.createElement("rect",{x:865,y:552.5,width:88,height:26,rx:7.028,fill:"#3ecc5f"})),x||(x=F.createElement("path",{d:"M1053.103 506.116a30.114 30.114 0 0 0 3.983-15.266c0-13.797-8.544-24.98-19.083-24.98s-19.082 11.183-19.082 24.98a30.114 30.114 0 0 0 3.983 15.266 31.248 31.248 0 0 0 0 30.532 31.248 31.248 0 0 0 0 30.532 31.248 31.248 0 0 0 0 30.532 30.114 30.114 0 0 0-3.983 15.266c0 13.797 8.543 24.981 19.082 24.981s19.083-11.184 19.083-24.98a30.114 30.114 0 0 0-3.983-15.267 31.248 31.248 0 0 0 0-30.532 31.248 31.248 0 0 0 0-30.532 31.248 31.248 0 0 0 0-30.532Z",fill:"#3f3d56"})),w||(w=F.createElement("ellipse",{cx:1038.003,cy:460.318,rx:19.083,ry:24.981,fill:"#3f3d56"})),u||(u=F.createElement("ellipse",{cx:1038.003,cy:429.786,rx:19.083,ry:24.981,fill:"#3f3d56"})),Z||(Z=F.createElement("path",{d:"M1109.439 220.845a91.61 91.61 0 0 0 7.106-10.461l-50.14-8.235 54.228.403a91.566 91.566 0 0 0 1.746-72.426l-72.755 37.742 67.097-49.321A91.413 91.413 0 1 0 965.75 220.845a91.458 91.458 0 0 0-10.425 16.67l65.087 33.814-69.4-23.292a91.46 91.46 0 0 0 14.738 85.837 91.406 91.406 0 1 0 143.689 0 91.418 91.418 0 0 0 0-113.03Z",fill:"#3ecc5f",fillRule:"evenodd"})),M||(M=F.createElement("path",{d:"M946.188 277.36a91.013 91.013 0 0 0 19.562 56.514 91.406 91.406 0 1 0 143.689 0c12.25-15.553-163.25-66.774-163.25-56.515Z",opacity:.1})),y||(y=F.createElement("path",{d:"M330.12 342.936h111.474v45.12H330.12Z",fill:"#fff",fillRule:"evenodd"})),P||(P=F.createElement("path",{d:"M229.263 490.241a26.51 26.51 0 0 1-22.963-13.27 26.51 26.51 0 0 0 22.963 39.812h26.541V490.24Z",fill:"#3ecc5f",fillRule:"evenodd"})),b||(b=F.createElement("path",{d:"m348.672 350.07 92.922-5.807v-13.27a26.54 26.54 0 0 0-26.541-26.542H295.616l-3.318-5.746a3.83 3.83 0 0 0-6.635 0l-3.318 5.746-3.317-5.746a3.83 3.83 0 0 0-6.636 0l-3.317 5.746-3.318-5.746a3.83 3.83 0 0 0-6.635 0l-3.318 5.746c-.03 0-.056.004-.086.004l-5.497-5.495a3.83 3.83 0 0 0-6.407 1.717l-1.817 6.773-6.89-1.847a3.83 3.83 0 0 0-4.691 4.693l1.844 6.891-6.77 1.814a3.832 3.832 0 0 0-1.72 6.41l5.497 5.497c0 .028-.004.055-.004.085l-5.747 3.317a3.83 3.83 0 0 0 0 6.636l5.747 3.317-5.747 3.318a3.83 3.83 0 0 0 0 6.635l5.747 3.318-5.747 3.318a3.83 3.83 0 0 0 0 6.635l5.747 3.318-5.747 3.317a3.83 3.83 0 0 0 0 6.636l5.747 3.317-5.747 3.318a3.83 3.83 0 0 0 0 6.636l5.747 3.317-5.747 3.318a3.83 3.83 0 0 0 0 6.635l5.747 3.318-5.747 3.318a3.83 3.83 0 0 0 0 6.635l5.747 3.318-5.747 3.317a3.83 3.83 0 0 0 0 6.636l5.747 3.317-5.747 3.318a3.83 3.83 0 0 0 0 6.635l5.747 3.318-5.747 3.318a3.83 3.83 0 0 0 0 6.635l5.747 3.318-5.747 3.317a3.83 3.83 0 0 0 0 6.636l5.747 3.317-5.747 3.318a3.83 3.83 0 0 0 0 6.635l5.747 3.318a26.54 26.54 0 0 0 26.541 26.542h159.249a26.54 26.54 0 0 0 26.541-26.542V384.075l-92.922-5.807a14.126 14.126 0 0 1 0-28.197",fill:"#3ecc5f",fillRule:"evenodd"})),q||(q=F.createElement("path",{d:"M388.511 516.783h39.812V463.7h-39.812Z",fill:"#3ecc5f",fillRule:"evenodd"})),V||(V=F.createElement("path",{d:"M454.865 483.606a6.602 6.602 0 0 0-.848.085c-.05-.2-.099-.4-.154-.599a6.627 6.627 0 1 0-6.557-11.382q-.22-.225-.445-.446a6.624 6.624 0 1 0-11.397-6.564c-.196-.055-.394-.102-.59-.152a6.64 6.64 0 1 0-13.101 0c-.197.05-.394.097-.59.152a6.628 6.628 0 1 0-11.398 6.564 26.528 26.528 0 1 0 44.232 25.528 6.621 6.621 0 1 0 .848-13.186",fill:"#44d860",fillRule:"evenodd"})),A||(A=F.createElement("path",{d:"M401.782 437.158h39.812v-26.541h-39.812Z",fill:"#3ecc5f",fillRule:"evenodd"})),H||(H=F.createElement("path",{d:"M454.865 427.205a3.318 3.318 0 0 0 0-6.635 3.411 3.411 0 0 0-.424.042c-.026-.1-.049-.199-.077-.298a3.319 3.319 0 0 0-1.278-6.38 3.282 3.282 0 0 0-2 .688q-.11-.113-.224-.223a3.282 3.282 0 0 0 .672-1.983 3.318 3.318 0 0 0-6.37-1.299 13.27 13.27 0 1 0 0 25.541 3.318 3.318 0 0 0 6.37-1.3 3.282 3.282 0 0 0-.672-1.982q.114-.11.223-.223a3.282 3.282 0 0 0 2.001.688 3.318 3.318 0 0 0 1.278-6.38c.028-.098.05-.199.077-.298a3.413 3.413 0 0 0 .424.042",fill:"#44d860",fillRule:"evenodd"})),G||(G=F.createElement("path",{d:"M282.345 347.581a3.318 3.318 0 0 1-3.317-3.318 9.953 9.953 0 1 0-19.906 0 3.318 3.318 0 1 1-6.636 0 16.588 16.588 0 1 1 33.177 0 3.318 3.318 0 0 1-3.318 3.318",fillRule:"evenodd"})),N||(N=F.createElement("path",{d:"M335.428 516.783h79.625a26.54 26.54 0 0 0 26.541-26.542v-92.895H361.97a26.54 26.54 0 0 0-26.542 26.542Z",fill:"#ffff50",fillRule:"evenodd"})),O||(O=F.createElement("path",{d:"M421.714 438.485h-66.406a1.327 1.327 0 0 1 0-2.654h66.406a1.327 1.327 0 0 1 0 2.654m0 26.542h-66.406a1.327 1.327 0 1 1 0-2.654h66.406a1.327 1.327 0 0 1 0 2.654m0 26.541h-66.406a1.327 1.327 0 1 1 0-2.654h66.406a1.327 1.327 0 0 1 0 2.654m0-66.106h-66.406a1.327 1.327 0 0 1 0-2.655h66.406a1.327 1.327 0 0 1 0 2.655m0 26.294h-66.406a1.327 1.327 0 0 1 0-2.654h66.406a1.327 1.327 0 0 1 0 2.654m0 26.542h-66.406a1.327 1.327 0 0 1 0-2.655h66.406a1.327 1.327 0 0 1 0 2.655m19.88-122.607c-.016 0-.03-.008-.045-.007-4.1.14-6.04 4.241-7.753 7.86-1.786 3.783-3.168 6.242-5.432 6.167-2.506-.09-3.94-2.922-5.458-5.918-1.744-3.443-3.734-7.347-7.913-7.201-4.042.138-5.99 3.708-7.706 6.857-1.828 3.355-3.071 5.394-5.47 5.3-2.557-.093-3.916-2.395-5.488-5.06-1.753-2.967-3.78-6.304-7.878-6.19-3.973.137-5.925 3.166-7.648 5.84-1.822 2.826-3.098 4.549-5.527 4.447-2.618-.093-3.97-2.004-5.535-4.216-1.757-2.486-3.737-5.3-7.823-5.163-3.886.133-5.838 2.615-7.56 4.802-1.634 2.075-2.91 3.718-5.611 3.615a1.328 1.328 0 1 0-.096 2.654c4.004.134 6.032-2.389 7.793-4.628 1.562-1.985 2.91-3.698 5.564-3.789 2.556-.108 3.754 1.48 5.567 4.041 1.721 2.434 3.675 5.195 7.606 5.337 4.118.138 6.099-2.94 7.853-5.663 1.569-2.434 2.923-4.535 5.508-4.624 2.38-.088 3.674 1.792 5.5 4.885 1.722 2.916 3.671 6.22 7.68 6.365 4.147.143 6.15-3.477 7.895-6.682 1.511-2.77 2.938-5.388 5.466-5.475 2.38-.056 3.62 2.116 5.456 5.746 1.714 3.388 3.658 7.226 7.73 7.373l.224.004c4.066 0 5.996-4.08 7.704-7.689 1.511-3.198 2.942-6.21 5.397-6.334Z",fillRule:"evenodd"})),_||(_=F.createElement("path",{d:"M308.887 516.783h53.083V463.7h-53.083Z",fill:"#3ecc5f",fillRule:"evenodd"})),j||(j=F.createElement("path",{d:"M388.511 483.606a6.602 6.602 0 0 0-.848.085c-.05-.2-.098-.4-.154-.599a6.627 6.627 0 1 0-6.557-11.382q-.22-.225-.444-.446a6.624 6.624 0 1 0-11.397-6.564c-.197-.055-.394-.102-.59-.152a6.64 6.64 0 1 0-13.102 0c-.196.05-.394.097-.59.152a6.628 6.628 0 1 0-11.397 6.564 26.528 26.528 0 1 0 44.231 25.528 6.621 6.621 0 1 0 .848-13.186",fill:"#44d860",fillRule:"evenodd"})),k||(k=F.createElement("path",{d:"M308.887 437.158h53.083v-26.541h-53.083Z",fill:"#3ecc5f",fillRule:"evenodd"})),z||(z=F.createElement("path",{d:"M375.24 427.205a3.318 3.318 0 1 0 0-6.635 3.411 3.411 0 0 0-.423.042c-.026-.1-.05-.199-.077-.298a3.319 3.319 0 0 0-1.278-6.38 3.282 3.282 0 0 0-2.001.688q-.11-.113-.223-.223a3.282 3.282 0 0 0 .671-1.983 3.318 3.318 0 0 0-6.37-1.299 13.27 13.27 0 1 0 0 25.541 3.318 3.318 0 0 0 6.37-1.3 3.282 3.282 0 0 0-.671-1.982q.113-.11.223-.223a3.282 3.282 0 0 0 2.001.688 3.318 3.318 0 0 0 1.278-6.38c.028-.098.05-.199.077-.298a3.413 3.413 0 0 0 .423.042",fill:"#44d860",fillRule:"evenodd"})),D||(D=F.createElement("path",{d:"M388.511 329.334a3.603 3.603 0 0 1-.65-.067 3.344 3.344 0 0 1-.624-.185 3.447 3.447 0 0 1-.572-.306 5.027 5.027 0 0 1-.504-.411 3.887 3.887 0 0 1-.41-.504 3.275 3.275 0 0 1-.558-1.845 3.602 3.602 0 0 1 .067-.65 3.826 3.826 0 0 1 .184-.624 3.489 3.489 0 0 1 .307-.57 3.197 3.197 0 0 1 .914-.916 3.447 3.447 0 0 1 .572-.305 3.344 3.344 0 0 1 .624-.186 3.07 3.07 0 0 1 1.3 0 3.223 3.223 0 0 1 1.195.49 5.028 5.028 0 0 1 .504.412 4.88 4.88 0 0 1 .411.504 3.382 3.382 0 0 1 .306.571 3.478 3.478 0 0 1 .252 1.274 3.364 3.364 0 0 1-.969 2.349 5.027 5.027 0 0 1-.504.411 3.306 3.306 0 0 1-1.845.558m26.542-1.66a3.388 3.388 0 0 1-2.35-.968 5.042 5.042 0 0 1-.41-.504 3.275 3.275 0 0 1-.558-1.845 3.387 3.387 0 0 1 .967-2.349 5.026 5.026 0 0 1 .505-.411 3.447 3.447 0 0 1 .572-.305 3.343 3.343 0 0 1 .623-.186 3.07 3.07 0 0 1 1.3 0 3.224 3.224 0 0 1 1.195.49 5.026 5.026 0 0 1 .504.412 3.388 3.388 0 0 1 .97 2.35 3.726 3.726 0 0 1-.067.65 3.374 3.374 0 0 1-.186.623 4.715 4.715 0 0 1-.305.57 4.88 4.88 0 0 1-.412.505 5.026 5.026 0 0 1-.504.412 3.305 3.305 0 0 1-1.844.557",fillRule:"evenodd"})))}},53261:(e,a,t)=>{t.r(a),t.d(a,{default:()=>v});var l=t(67294),r=t(86010),n=t(39960),c=t(52263),h=t(12684),m=t(87462);const d="features_t9lD",i="featureSvg_GfXr",f=[{title:"Easy to Use",Svg:t(9722).Z,description:l.createElement(l.Fragment,null,"Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly.")},{title:"Focus on What Matters",Svg:t(14002).Z,description:l.createElement(l.Fragment,null,"Docusaurus lets you focus on your docs, and we'll do the chores. Go ahead and move your docs into the ",l.createElement("code",null,"docs")," directory.")},{title:"Powered by React",Svg:t(88066).Z,description:l.createElement(l.Fragment,null,"Extend or customize your website layout by reusing React. Docusaurus can be extended while reusing the same header and footer.")}];function s(e){let{Svg:a,title:t,description:n}=e;return l.createElement("div",{className:(0,r.Z)("col col--4")},l.createElement("div",{className:"text--center"},l.createElement(a,{className:i,role:"img"})),l.createElement("div",{className:"text--center padding-horiz--md"},l.createElement("h3",null,t),l.createElement("p",null,n)))}function o(){return l.createElement("section",{className:d},l.createElement("div",{className:"container"},l.createElement("div",{className:"row"},f.map(((e,a)=>l.createElement(s,(0,m.Z)({key:a},e)))))))}const g="heroBanner_qdFl",E="buttons_AeoN";function p(){const{siteConfig:e}=(0,c.Z)();return l.createElement("header",{className:(0,r.Z)("hero hero--primary",g)},l.createElement("div",{className:"container"},l.createElement("h1",{className:"hero__title"},e.title),l.createElement("p",{className:"hero__subtitle"},e.tagline),l.createElement("div",{className:E},l.createElement(n.Z,{className:"button button--secondary button--lg",to:"/docs"},"Docusaurus Tutorial - 5min \u23f1\ufe0f"))))}function v(){const{siteConfig:e}=(0,c.Z)();return l.createElement(h.Z,{title:`Hello from ${e.title}`,description:"Description will go into a meta tag in <head />"},l.createElement(p,null),l.createElement("main",null,l.createElement(o,null)))}}}]); \ No newline at end of file diff --git a/docs/assets/js/c52764ec.3dc0d11a.js b/docs/assets/js/c52764ec.3dc0d11a.js new file mode 100644 index 000000000..8e8c70551 --- /dev/null +++ b/docs/assets/js/c52764ec.3dc0d11a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[72653],{46492:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.6.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.6.0/"},"next":{"title":"Installation","permalink":"/docs/0.6.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/c5296eae.e4a61dcb.js b/docs/assets/js/c5296eae.e4a61dcb.js new file mode 100644 index 000000000..0454a1149 --- /dev/null +++ b/docs/assets/js/c5296eae.e4a61dcb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25396],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c<s;c++)o[c]=n[c];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},49944:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.2.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.2.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.2.0/basics/cross-calls",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"defaultSidebar",previous:{title:"Events",permalink:"/docs/0.2.0/basics/events"},next:{title:"Modules",permalink:"/docs/0.2.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use odra::Variable;\nuse odra::types::{Address};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Variable<Address>,\n}\n\n#[odra::module]\nimpl CrossContract {\n #[odra(init)]\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap();\n MathEngineRef::at(math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine {\n}\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To call the external contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"MathEngineRef::at(math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/basics/testing"},"Testing")," article.\nIt is a reference to already deployed - running contract.\nHere we are going to take a deeper look at it."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," is generated automatically, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nTo get an instance of a reference, we can either deploy a contract (using ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),") or by building it\ndirectly, using ",(0,r.kt)("inlineCode",{parentName:"p"},"::at(address: Address)")," method, as shown above.\nThe reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), alongside couple methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"at(Address) -> Self")," - points the reference to an Address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"address() -> Address")," - returns the Address the reference is currently pointing at"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"with_tokens(Amount) -> Self")," - attaches Amount of native tokens to the next call")),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderRef")," struct (but do not create the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderDeployer"),"). Having an address we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"AdderRef::at(address).add(3, 5)\n")),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use super::{CrossContractDeployer, MathEngineDeployer};\n\n#[test]\nfn test_cross_calls() {\n let math_engine_contract = MathEngineDeployer::default();\n let cross_contract = CrossContractDeployer::init(math_engine_contract.address());\n\n assert_eq!(cross_contract.add_using_another(), 8);\n}\n")),(0,r.kt)("p",null,"Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function we want to use."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use odra::types::Address;\n use crate::docs::cross_calls::{Adder, AdderRef};\n \n #[test]\n fn test_ext() {\n let adder = AdderRef::at(get_adder_address());\n\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address() -> Address {\n let contract = MathEngineDeployer::default();\n contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c52d4d42.f39f1744.js b/docs/assets/js/c52d4d42.f39f1744.js new file mode 100644 index 000000000..48638cd85 --- /dev/null +++ b/docs/assets/js/c52d4d42.f39f1744.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97227],{3905:(e,r,n)=>{n.d(r,{Zo:()=>u,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){a(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function i(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},u=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},p={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return n?t.createElement(f,s(s({ref:r},u),{},{components:n})):t.createElement(f,s({ref:r},u))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return t.createElement.apply(null,s)}return t.createElement.apply(null,n)}d.displayName="MDXCreateElement"},38008:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.6.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.6.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.6.0/basics/errors",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.6.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.6.0/basics/events"}},l={},c=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:c};function p(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},u,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::{execution_error, Variable, UnwrapOrRevert};\nuse odra::types::Address;\n\n#[odra::module]\npub struct OwnedContract {\n name: Variable<String>,\n owner: Variable<Address>,\n}\n\nexecution_error! {\n pub enum Error {\n OwnerNotSet => 1,\n NotAnOwner => 2,\n }\n}\n\n\n#[odra::module]\nimpl OwnedContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = odra::contract_env::caller();\n if caller != self.owner() {\n odra::contract_env::revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,a.kt)("p",null,"Firstly, we are using ",(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You and the users of your contract will be thankful for a meaningful error message!"),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"odra::contract_env::revert(Error::NotAnOwner)\n")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? We've already mentioned a function - ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_exception"),". This is how you will\nuse it:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'use super::{OwnedContractDeployer, OwnedContractRef};\nuse super::Error;\n\n#[test]\nfn test_owner_error() {\n let owner = odra::test_env::get_account(0);\n let not_an_owner = odra::test_env::get_account(1);\n\n odra::test_env::set_caller(owner);\n let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());\n\n odra::test_env::set_caller(not_an_owner);\n odra::test_env::assert_exception(Error::NotAnOwner, || {\n owned_contract.change_name("NewName".to_string());\n })\n}\n')),(0,a.kt)("p",null,"In the example above, because we are calling the ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),' method as an address which is not an "owner",\nwe are expecting that "NotAnOwner" error will be thrown.'),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"Here we are creating another reference to the already deployed contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractRef::at()")," and passing to it\nits Address. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractDeployer::init()")," returns the same type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c5cef920.99f0fcba.js b/docs/assets/js/c5cef920.99f0fcba.js new file mode 100644 index 000000000..c572fc3d1 --- /dev/null +++ b/docs/assets/js/c5cef920.99f0fcba.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[88590],{3905:(e,r,n)=>{n.d(r,{Zo:()=>p,kt:()=>m});var t=n(67294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?a(Object(n),!0).forEach((function(r){o(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function i(e,r){if(null==e)return{};var n,t,o=function(e,r){if(null==e)return{};var n,t,o={},a=Object.keys(e);for(t=0;t<a.length;t++)n=a[t],r.indexOf(n)>=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)n=a[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},u=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=o,w=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return n?t.createElement(w,s(s({ref:r},p),{},{components:n})):t.createElement(w,s({ref:r},p))}));function m(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=u;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c<a;c++)s[c]=n[c];return t.createElement.apply(null,s)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},62467:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=n(87462),o=(n(67294),n(3905));const a={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.3.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.3.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.3.0/basics/errors",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"defaultSidebar",previous:{title:"Testing",permalink:"/docs/0.3.0/basics/testing"},next:{title:"Events",permalink:"/docs/0.3.0/basics/events"}},l={},c=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:r,...n}=e;return(0,o.kt)("wrapper",(0,t.Z)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"errors"},"Errors"),(0,o.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"use odra::{execution_error, Variable, UnwrapOrRevert};\nuse odra::types::Address;\n\n#[odra::module]\npub struct OwnedContract {\n name: Variable<String>,\n owner: Variable<Address>,\n}\n\nexecution_error! {\n pub enum Error {\n OwnerNotSet => 1,\n NotAnOwner => 2,\n }\n}\n\n\n#[odra::module]\nimpl OwnedContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = odra::contract_env::caller();\n if caller != self.owner() {\n odra::contract_env::revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,o.kt)("p",null,"Firstly, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use\n",(0,o.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,o.kt)("p",null,"You and the users of your contract will be thankful for a meaningful error message!"),(0,o.kt)("p",null,"You can also throw the error directly, by using ",(0,o.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},"odra::contract_env::revert(Error::NotAnOwner)\n")),(0,o.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,o.kt)("p",null,"Okay, but how about testing it? We've already mentioned a function - ",(0,o.kt)("inlineCode",{parentName:"p"},"assert_exception"),". This is how you will\nuse it:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/errors.rs"',title:'"examples/src/docs/errors.rs"'},'use super::{OwnedContractDeployer, OwnedContractRef};\nuse super::Error;\n\n#[test]\nfn test_owner_error() {\n let owner = odra::test_env::get_account(0);\n let not_an_owner = odra::test_env::get_account(1);\n\n odra::test_env::set_caller(owner);\n let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());\n\n odra::test_env::set_caller(not_an_owner);\n odra::test_env::assert_exception(Error::NotAnOwner, || {\n let mut owned_contract = OwnedContractRef::at(owned_contract.address());\n owned_contract.change_name("NewName".to_string());\n })\n}\n')),(0,o.kt)("p",null,"In the example above, because we are calling the ",(0,o.kt)("inlineCode",{parentName:"p"},"change_name"),' method as an address which is not an "owner",\nwe are expecting that "NotAnOwner" error will be thrown.'),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Here we are creating another reference to the already deployed contract using ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractRef::at()")," and passing to it\nits Address. Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedContractDeployer::init()")," returns the same type.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will learn how to emit and test events using Odra."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c5f43526.355822f4.js b/docs/assets/js/c5f43526.355822f4.js new file mode 100644 index 000000000..726b6ddee --- /dev/null +++ b/docs/assets/js/c5f43526.355822f4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[2037],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},d),{},{components:r})):n.createElement(f,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c<o;c++)i[c]=r[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},50605:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.3.1/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.3.1/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.3.1/basics/directory-structure",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.3.1/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.3.1/basics/odra-toml"}},s={},c=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:".builder_* folders",id:"builder_-folders",level:2},{value:"src/",id:"src",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 .builder_casper/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. We are using two features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/mock-vm")," - it is responsible for running tests on Odra's MockVM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/casper")," - backend implementation of Casper blockchain\nMore backends will be released as features that will be possible to enable here.")),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"builder_-folders"},".builder_* folders"),(0,a.kt)("p",null,"Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary\nfor building wasm files and running them against blockchain VMs. As it is not necessary to modify\nfiles in those folders in any way, by default they are hidden (hence the ",(0,a.kt)("inlineCode",{parentName:"p"},".")," at the beginning of the\nfolder name)."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain of your choosing."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c6385d27.f868001d.js b/docs/assets/js/c6385d27.f868001d.js new file mode 100644 index 000000000..4c531801c --- /dev/null +++ b/docs/assets/js/c6385d27.f868001d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25579],{48187:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.6.0/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.6.0/basics/native-token"},"next":{"title":"Module reusing","permalink":"/docs/0.6.0/advanced/using"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/c705646d.96e548c5.js b/docs/assets/js/c705646d.96e548c5.js new file mode 100644 index 000000000..9e00f7929 --- /dev/null +++ b/docs/assets/js/c705646d.96e548c5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[6489],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(h,s(s({ref:t},d),{},{components:n})):r.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},65350:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.6.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.6.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.6.0/basics/testing",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.6.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.6.0/basics/errors"}},l={},c=[{value:"Test env",id:"test-env",level:2},{value:"Deployer",id:"deployer",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{Variable, List};\n\n#[cfg(test)]\nmod tests {\n use super::DogContract3Deployer;\n\n #[test]\n fn init_test() {\n let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(module)]")," macro created a Deployer code for us, which will deploy the contract on the\nVM:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n')),(0,a.kt)("p",null,"From now on, we can use ",(0,a.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with a macro are available to us:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,a.kt)("h2",{id:"test-env"},"Test env"),(0,a.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use super::TestingContractDeployer;\n\n #[test]\n fn test_env() {\n let testing_contract = TestingContractDeployer::init("MyContract".to_string());\n let creator = testing_contract.created_by();\n odra::test_env::set_caller(odra::test_env::get_account(1));\n let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());\n let creator2 = testing_contract2.created_by();\n assert!(creator != creator2);\n }\n}\n')),(0,a.kt)("p",null,"In the code above, we are deploying two instances of the same contract, but we're using ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::test_env::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::contract_env::caller()"),"\nthe function we are calling inside the contract."),(0,a.kt)("p",null,"Each test env comes with a set of functions that will let you write better tests:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_caller(address: Address)")," - you've seen it in action just now"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn token_balance(address: Address) -> Balance")," - it returns the balance of the account associated with the given address"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn advance_block_time_by(seconds: BlockTime)")," - it increases the current value of block_time"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_account(n: usize) -> Address")," - it returns an nth address that was prepared for you by Odra in advance;\nby default, you start with the 0th account"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn assert_exception<F, E>(err: E, block: F)")," - it executes the ",(0,a.kt)("inlineCode",{parentName:"li"},"block")," code and expects ",(0,a.kt)("inlineCode",{parentName:"li"},"err")," to happen"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError>")," - returns\nthe event emitted by the contract")),(0,a.kt)("p",null,"Again, we'll see those used in the next articles."),(0,a.kt)("h2",{id:"deployer"},"Deployer"),(0,a.kt)("p",null,"You may be wondering what is the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractDeployer")," and where did it come from.\nIt is a piece of code generated automatically for you, thanks to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nIf you used the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," on one of the methods, it will be the constructor of your contract.\nOdra will make sure that it is called only once, so you can use it to initialize your data structures etc."),(0,a.kt)("p",null,"If you do not provide the init method, you can deploy the contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"::default()")," method.\nIn the end, you will get a ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," instance (in our case the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractRef"),") which reimplements all\nthe methods you defined in the contract, but executes them on a blockchain!"),(0,a.kt)("p",null,"To learn more about the ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," contract, visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/cross-calls"},"Cross calls")," article."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We take a look at how Odra handles errors!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c714b9ee.2703fad9.js b/docs/assets/js/c714b9ee.2703fad9.js new file mode 100644 index 000000000..de82d5472 --- /dev/null +++ b/docs/assets/js/c714b9ee.2703fad9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[96105],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},91651:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="MockVM",c={unversionedId:"backends/mock-vm",id:"version-0.2.0/backends/mock-vm",title:"MockVM",description:"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.2.0/backends/02-mock-vm.md",sourceDirName:"backends",slug:"/backends/mock-vm",permalink:"/docs/0.2.0/backends/mock-vm",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.2.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.2.0/backends/casper"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mockvm"},"MockVM"),(0,a.kt)("p",null,"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The MockVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"MockVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is just a list of contracts deployed onto the MockVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),".\nEach time we call the contract, we call its instance stored in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the MockVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe MockVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the MockVM.\nThanks to this and the fact that we do not need the blockchain itself,\nMockVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the MockVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a Contract Container.\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, MockVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(MockVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c71fcec7.628403bd.js b/docs/assets/js/c71fcec7.628403bd.js new file mode 100644 index 000000000..b69b08a1a --- /dev/null +++ b/docs/assets/js/c71fcec7.628403bd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76974],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(n),d=o,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},48458:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.3.1/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.3.1/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.3.1/basics/communicating-with-host",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.3.1/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.3.1/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],p={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/host.rs"',title:'"examples/src/docs/host.rs"'},"use odra::Variable;\nuse odra::types::{BlockTime, Address};\n\n#[odra::module]\npub struct HostContract {\n name: Variable<String>,\n created_at: Variable<BlockTime>,\n created_by: Variable<Address>,\n}\n\n#[odra::module]\nimpl HostContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(odra::contract_env::get_block_time());\n self.created_by.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are calling functions from ",(0,o.kt)("inlineCode",{parentName:"p"},"odra::contract_env"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"get_block_time()")," will return\nthe current block time wrapped in Odra type ",(0,o.kt)("inlineCode",{parentName:"p"},"BlockTime"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"caller()")," will return an Odra ",(0,o.kt)("inlineCode",{parentName:"p"},"Address")," of\na caller (this can be an external caller or another contract)."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c8e7910f.a063a3f7.js b/docs/assets/js/c8e7910f.a063a3f7.js new file mode 100644 index 000000000..d0f596f53 --- /dev/null +++ b/docs/assets/js/c8e7910f.a063a3f7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90897],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 l(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 i(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 s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return a?n.createElement(g,l(l({ref:t},c),{},{components:a})):n.createElement(g,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var p=2;p<o;p++)l[p]=a[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"},13136:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.8.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.8.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.8.0/getting-started/installation",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.8.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.8.0/getting-started/flipper"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-unknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --locked\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,r.kt)("p",null,"This will create a new folder called ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," and initialize Odra there. Cargo Odra\nwill create a sample contract for you in ",(0,r.kt)("inlineCode",{parentName:"p"},"src")," directory. You can run the tests of this contract\nby executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/c95b781b.7aece3f4.js b/docs/assets/js/c95b781b.7aece3f4.js new file mode 100644 index 000000000..8181efc9f --- /dev/null +++ b/docs/assets/js/c95b781b.7aece3f4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[69810],{86280:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.8.0","label":"0.8.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.8.0","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.8.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.8.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.8.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.8.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.8.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.8.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.8.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.8.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.8.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.8.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.8.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.8.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.8.0/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.8.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.8.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.8.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.8.0/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Delegate","href":"/docs/0.8.0/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.8.0/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.8.0/advanced/attributes","docId":"advanced/attributes"},{"type":"link","label":"Storage Layout","href":"/docs/0.8.0/advanced/storage-layout","docId":"advanced/storage-layout"}],"href":"/docs/0.8.0/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.8.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"OdraVM","href":"/docs/0.8.0/backends/odra-vm","docId":"backends/odra-vm"},{"type":"link","label":"Casper","href":"/docs/0.8.0/backends/casper","docId":"backends/casper"},{"type":"link","label":"Livenet","href":"/docs/0.8.0/backends/livenet","docId":"backends/livenet"}],"href":"/docs/0.8.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.8.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.8.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.8.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.8.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.8.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.8.0/tutorials/owned-token","docId":"tutorials/owned-token"},{"type":"link","label":"Access Control","href":"/docs/0.8.0/tutorials/access-control","docId":"tutorials/access-control"},{"type":"link","label":"Pausable","href":"/docs/0.8.0/tutorials/pauseable","docId":"tutorials/pauseable"},{"type":"link","label":"Build, Deploy and Read the State of a Contract","href":"/docs/0.8.0/tutorials/build-deploy-read","docId":"tutorials/build-deploy-read"}],"href":"/docs/0.8.0/category/tutorials"},{"type":"category","label":"Migrations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Migration guide to v0.8.0","href":"/docs/0.8.0/migrations/to-0.8.0","docId":"migrations/to-0.8.0"}],"href":"/docs/0.8.0/category/migrations"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"advanced/storage-layout":{"id":"advanced/storage-layout","title":"Storage Layout","description":"Odra\'s innovative modular design necessitates a unique storage layout. This","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/livenet":{"id":"backends/livenet","title":"Livenet","description":"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local","sidebar":"tutorialSidebar"},"backends/odra-vm":{"id":"backends/odra-vm","title":"OdraVM","description":"The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the [Odra main repository].","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"migrations/to-0.8.0":{"id":"migrations/to-0.8.0","title":"Migration guide to v0.8.0","description":"Migration guide to v0.8.0","sidebar":"tutorialSidebar"},"tutorials/access-control":{"id":"tutorials/access-control","title":"Access Control","description":"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,","sidebar":"tutorialSidebar"},"tutorials/build-deploy-read":{"id":"tutorials/build-deploy-read","title":"Build, Deploy and Read the State of a Contract","description":"In this guide, we will show the full path from creating a contract, deploying it and reading the state.","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"},"tutorials/pauseable":{"id":"tutorials/pauseable","title":"Pausable","description":"The Pausable module is like your smart contract\'s safety switch. It lets authorized users temporarily pause certain features if needed. It\'s a great way to boost security, but it\'s not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/ca19d087.d547ca7c.js b/docs/assets/js/ca19d087.d547ca7c.js new file mode 100644 index 000000000..f4a3f36a2 --- /dev/null +++ b/docs/assets/js/ca19d087.d547ca7c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52481],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(t),m=a,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},c),{},{components:t})):r.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=u;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var d=2;d<s;d++)o[d]=t[d];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}u.displayName="MDXCreateElement"},97142:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const s={sidebar_position:3},o="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-1.0.0/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-1.0.0/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/tutorials/erc20",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/tutorials/owned-token"}},i={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:d};function p(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"erc-20"},"ERC-20"),(0,a.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,a.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,a.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value."),(0,a.kt)("h2",{id:"framework-features"},"Framework features"),(0,a.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Advanced storage using key-value pairs,"),(0,a.kt)("li",{parentName:"ul"},"Odra types such as ",(0,a.kt)("inlineCode",{parentName:"li"},"Address"),","),(0,a.kt)("li",{parentName:"ul"},"Advanced event assertion.")),(0,a.kt)("h2",{id:"code"},"Code"),(0,a.kt)("p",null,"Our module features a considerably more complex storage layout compared to the previous example. "),(0,a.kt)("p",null,"It is designed to store the following data:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol, and decimals."),(0,a.kt)("li",{parentName:"ol"},"Total supply."),(0,a.kt)("li",{parentName:"ol"},"Balances of individual users."),(0,a.kt)("li",{parentName:"ol"},"Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.")),(0,a.kt)("h2",{id:"module-definition"},"Module definition"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Mapping, Var};\n\n#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,a.kt)("inlineCode",{parentName:"li"},"mapping"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L11")," - Odra does not allows nested ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),"s as Solidity does. Instead, you can create a compound key using a tuple of keys.")),(0,a.kt)("h3",{id:"metadata"},"Metadata"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let caller = self.env().caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, &initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.balances.add(address, *amount);\n self.total_supply.add(*amount);\n \n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n}\n\n#[odra::event]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L3-L9")," - A constructor sets the token metadata and mints the initial supply."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L28")," - The second ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," is not an Odra module; in other words, these functions will not be part of the contract's public interface."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L29-L38")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"mint")," function is public, so, like in regular Rust code, it will be accessible from the outside. ",(0,a.kt)("inlineCode",{parentName:"li"},"mint()")," uses the notation ",(0,a.kt)("inlineCode",{parentName:"li"},"self.balances.add(address, *amount);"),", which is syntactic sugar for:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::UnwrapOrRevert;\n\nlet current_balance = self.balances.get(address).unwrap_or_default();\nlet new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());\nself.balances.set(address, new_balance);\n")),(0,a.kt)("h3",{id:"core"},"Core"),(0,a.kt)("p",null,"To ensure comprehensive functionality, let's implement the remaining features such as ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer_from"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"approve"),". Since they do not introduce any new concepts, we will present them without additional remarks."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers title=erc20.rs",showLineNumbers:!0,title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n self.env().revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowance(owner, spender);\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .set(&(*owner, *spender), new_allowance);\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\n#[odra::event]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 1,\n InsufficientAllowance = 2,\n}\n")),(0,a.kt)("p",null,"Now, compare the code we have written, with ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,a.kt)("h3",{id:"test"},"Test"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::*;\n use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: INITIAL_SUPPLY.into()\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let (env, mut erc20) = setup();\n\n let (owner, recipient, spender) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount\n }\n ));\n\n // Spender transfers tokens from Owner to Recipient.\n env.set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n ));\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n ));\n // assert!(env.emitted(erc20.address(), "Transfer"));\n }\n\n #[test]\n fn transfer_from_error() {\n // Given a new instance.\n let (env, mut erc20) = setup();\n\n // When the spender\'s allowance is zero.\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n // Then transfer fails.\n assert_eq!(\n erc20.try_transfer_from(&owner, &recipient, &amount),\n Err(Error::InsufficientAllowance.into())\n );\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L146")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Having two modules: ",(0,a.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ca76cddc.dbb2125a.js b/docs/assets/js/ca76cddc.dbb2125a.js new file mode 100644 index 000000000..c52babf87 --- /dev/null +++ b/docs/assets/js/ca76cddc.dbb2125a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[44191],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(v,o(o({ref:t},p),{},{components:n})):r.createElement(v,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=n[l];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},46486:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/docs/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/next/basics/events",draft:!1,tags:[],version:"current",lastUpdatedAt:1718616680,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/next/basics/errors"},next:{title:"Casper Contract Schema",permalink:"/docs/next/basics/casper-contract-schema"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract;\n\n#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64\n}\n\n#[odra::module]\nimpl PartyContract {\n pub fn init(&self) {\n self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n });\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"#[odra::event]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: u64,\n}\n")),(0,a.kt)("p",null,"To emit an event, we use the ",(0,a.kt)("inlineCode",{parentName:"p"},"emit_event")," function from the ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),", passing the event as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},"self.env().emit_event(PartyStarted {\n caller: self.env().caller(),\n block_time: self.env().get_block_time()\n});\n")),(0,a.kt)("p",null,"To determine all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The registered events will also be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a few functions which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/events.rs"',title:'"examples/src/features/events.rs"'},'use super::{PartyContractHostRef, PartyStarted};\nuse odra::host::{Deployer, HostEnv, NoArgs};\n\n#[test]\nfn test_party() {\n let test_env: HostEnv = odra_test::env();\n let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);\n test_env.emitted_event(\n &party_contract,\n &PartyStarted {\n caller: test_env.get_account(0),\n block_time: 0\n }\n );\n // If you do not want to check the exact event, you can use `emitted` function\n test_env.emitted(&party_contract, "PartyStarted");\n // You can also check how many events were emitted.\n assert_eq!(test_env.events_count(&party_contract), 1);\n}\n')),(0,a.kt)("p",null,"To explore more event testing functions, check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ca9ead02.0b662191.js b/docs/assets/js/ca9ead02.0b662191.js new file mode 100644 index 000000000..e92b4f5a8 --- /dev/null +++ b/docs/assets/js/ca9ead02.0b662191.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[91950],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);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 s(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?s(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):s(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)a=s[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)a=s[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(a),m=r,f=c["".concat(l,".").concat(m)]||c[m]||d[m]||s;return a?n.createElement(f,i(i({ref:t},u),{},{components:a})):n.createElement(f,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,i=new Array(s);i[0]=c;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p<s;p++)i[p]=a[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}c.displayName="MDXCreateElement"},87998:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const s={sidebar_position:5,description:"How to write data into blockchain's storage"},i="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.8.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.8.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.8.0/basics/storage-interaction",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"tutorialSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.8.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.8.0/basics/communicating-with-host"}},l={},p=[{value:"Var",id:"var",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"Custom Types",id:"custom-types",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"var"},"Var"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Var<bool>,\n weight: Var<u32>,\n name: Var<String>,\n walks: Var<Vec<u32>>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"use odra::Var;\n\n#[odra::module]\nimpl DogContract {\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::<u32>::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/variable.rs"',title:'"examples/src/features/storage/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is used to store and access data as key-value pairs. To define a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{Mapping, Var};\n\n#[odra::module]\npub struct DogContract2 {\n name: Var<String>,\n friends: Mapping<String, u32>,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," we use a similar approach\nto the one shown in the Vars section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n self.friends.get_or_default(&friend_name)\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behavior by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Var working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{List, Var};\n\npub struct List<T> {\n values: Mapping<u32, T>,\n index: Var<u32>\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Var<String>,\n walks: List<u32>,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the Odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/features/")," folder.")),(0,r.kt)("h2",{id:"custom-types"},"Custom Types"),(0,r.kt)("p",null,"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors."),(0,r.kt)("p",null,"Implementing custom types is straightforward, your type must derive from ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option<Address>\n}\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Each field of your struct must be an OdraType.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cad7ddc9.8113f4dd.js b/docs/assets/js/cad7ddc9.8113f4dd.js new file mode 100644 index 000000000..5491f5c83 --- /dev/null +++ b/docs/assets/js/cad7ddc9.8113f4dd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[77042],{74431:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.2.0/category/examples","navigation":{"previous":{"title":"Casper","permalink":"/docs/0.2.0/backends/casper"},"next":{"title":"odra-examples","permalink":"/docs/0.2.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/cb085bdb.0a0815b5.js b/docs/assets/js/cb085bdb.0a0815b5.js new file mode 100644 index 000000000..b00659137 --- /dev/null +++ b/docs/assets/js/cb085bdb.0a0815b5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[84201],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},84299:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},o="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.3.1/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.3.1/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.3.1/basics/flipper-internals",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.3.1/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.3.1/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.1/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Variable;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Variables and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Variable<bool>,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.1/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," macro marks the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperDeployer")," - a piece of code generated automatically thanks to the macros.\nThe contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cbdaac1b.75435457.js b/docs/assets/js/cbdaac1b.75435457.js new file mode 100644 index 000000000..162b0bcaf --- /dev/null +++ b/docs/assets/js/cbdaac1b.75435457.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[3744],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),u=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return a.createElement(s.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=u(t),c=r,w=p["".concat(s,".").concat(c)]||p[c]||m[c]||i;return t?a.createElement(w,o(o({ref:n},d),{},{components:t})):a.createElement(w,o({ref:n},d))}));function c(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=p;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u<i;u++)o[u]=t[u];return a.createElement.apply(null,o)}return a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},55468:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-0.2.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-0.2.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/0.2.0/tutorials/ownable",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Tutorials",permalink:"/docs/0.2.0/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/0.2.0/tutorials/erc20"}},s={},u=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function m(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining constructors,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{types::Address, Variable};\n\n#[odra::module]\npub struct Ownable {\n owner: Variable<Address>\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basic before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - Firstly, we need create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," to it above."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"use odra::{execution_error, contract_env, Event, types::{Address, event::OdraEvent};\n\n...\n\n#[odra::module]\nimpl Ownable {\n #[odra(init)]\n pub fn init(&mut self, owner: Address) {\n if self.owner.get().is_some() {\n contract_env::revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(owner);\n \n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n .emit();\n }\n}\n\nexecution_error! {\n pub enum Error {\n OwnerIsNotInitialized => 1,\n }\n}\n\n#[derive(Event, Debug, PartialEq, Eq)]\npub struct OwnershipChanged {\n pub prev_owner: Option<Address>,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is marked as ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]")," making it a constructor. It matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum is defined inside the ",(0,r.kt)("inlineCode",{parentName:"li"},"execution_error")," macro. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into<ExecutionError>")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L9-L11")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::revert()")," function. As an argument we pass ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsNotInitialized"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L13")," - Then we write the owner passed as an argument to the storage. To do so we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L29-L33")," - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::Event"),". We highly recommend to derive ",(0,r.kt)("inlineCode",{parentName:"li"},"Debug"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"PartialEq")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Eq")," for testing purpose."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L23")," - Finally, we create the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," struct and call ",(0,r.kt)("inlineCode",{parentName:"li"},"emit()")," function on it (import ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent")," trait). Hence we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: Address) {\n if Some(address) != self.owner.get() {\n contract_env::revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: Address) {\n self.ensure_ownership(contract_env::caller());\n let current_owner = self.get_owner();\n self.owner.set(new_owner);\n OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner\n }\n .emit();\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get() {\n Some(owner) => owner,\n None => contract_env::revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\nexecution_error! {\n pub enum Error {\n NotOwner => 1,\n OwnerIsAlreadyInitialized => 2,\n OwnerIsNotInitialized => 3,\n }\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L5,L32")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," is reads the current owner, and reverts if is does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_env::caller()")," function. The we update the state, and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22,L34")," - Lastly, a getter function. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"Variable")," ",(0,r.kt)("inlineCode",{parentName:"li"},"get()")," function returns an ",(0,r.kt)("inlineCode",{parentName:"li"},"Option"),", we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),".")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::{assert_events, test_env};\n\n fn setup() -> (Address, OwnableRef) {\n let owner = test_env::get_account(0);\n let ownable = OwnableDeployer::init(owner);\n (owner, ownable)\n }\n\n #[test]\n fn initialization_works() {\n let (owner, ownable) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (owner, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n \n test_env::set_caller(owner);\n ownable.change_ownership(new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n assert_events!(\n ownable,\n OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (_, mut ownable) = setup();\n let new_owner = test_env::get_account(1);\n ownable.change_ownership(new_owner);\n \n test_env::assert_exception(Error::NotOwner, || {\n // If we don't create a new ref, an error occurs:\n // cannot borrow `ownable` as mutable, as it is \n // a captured variable in a `Fn` closure cannot borrow as mutable\n let mut ownable = OwnableRef::at(ownable.address());\n ownable.change_ownership(new_owner);\n });\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we call as the first statement in each test. Take a look at the signature ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (Address, OwnableRef)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableRef")," is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7")," - Now, the module needs an owner, the easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env"),". We choose the address of first account (which is the default one)."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Odra created for us ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableDeployer")," struct which implements all constructor functions. In this case there is just one function - ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," which corresponds the function we have implemented in the module."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - It is time to define the first test. As you see, it is a regular rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14-15")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-23")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro ",(0,r.kt)("inlineCode",{parentName:"li"},"assert_events"),". As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L30")," - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"test env")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L32")," - As mentioned, the default is the 0-th account, if you want to change the executor call the ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L49-55")," - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"test_env::assert_exception()")," with the error you expect and a failing block of code.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"In the test we create a second contract reference ",(0,r.kt)("inlineCode",{parentName:"p"},"let mut ownable = OwnableRef::at(ownable.address());"),". As the name stands, it is just a reference, we interact with the same contract - only the address matters.")))),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cc61c55f.c5640e08.js b/docs/assets/js/cc61c55f.c5640e08.js new file mode 100644 index 000000000..dbff48467 --- /dev/null +++ b/docs/assets/js/cc61c55f.c5640e08.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[27867],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=l(n),d=o,f=p["".concat(c,".").concat(d)]||p[d]||m[d]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},35660:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.8.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.8.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.8.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.8.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.8.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],u={toc:l};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module]\npub struct HostContract {\n name: Var<String>,\n created_at: Var<u64>,\n created_by: Var<Address>\n}\n\n#[odra::module]\nimpl HostContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(self.env().get_block_time());\n self.created_by.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"self.env()"),". It is an implementation of ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/module/trait.Module.html#tymehtod.env"},(0,o.kt)("inlineCode",{parentName:"a"},"Module::env()")),", autogenerated\nby ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The function returns a reference to the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/struct.ContractEnv.html"},(0,o.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," (you can read more in\nthe ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.0/backends/what-is-a-backend#contract-env"},(0,o.kt)("inlineCode",{parentName:"a"},"Backend section")),"). This is a structure that provides access to the host functions and variables. "),(0,o.kt)("p",null,"In this example, we use two of them:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"get_block_time()")," - returns the current block time as u64. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"caller()")," - returns an Odra ",(0,o.kt)("inlineCode",{parentName:"li"},"Address")," of the caller (this can be an external caller or another contract).")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cca6b120.08744a58.js b/docs/assets/js/cca6b120.08744a58.js new file mode 100644 index 000000000..61ac168d1 --- /dev/null +++ b/docs/assets/js/cca6b120.08744a58.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[15775],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},54790:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.3.1/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.3.1/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.3.1/basics/odra-toml",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.3.1/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.3.1/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," will be used as a name for the contract - the generated wasm file will be in the above case named\n",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the builder to locate the exact struct where\nthe contract is defined."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n\n[[contracts]]\nname = "counter"\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ccc49370.570e05ea.js b/docs/assets/js/ccc49370.570e05ea.js new file mode 100644 index 000000000..190f00fec --- /dev/null +++ b/docs/assets/js/ccc49370.570e05ea.js @@ -0,0 +1 @@ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46103],{39058:(e,t,n)=>{"use strict";n.d(t,{Z:()=>E});var a=n(67294),s=n(86010),l=n(12684),r=n(87524),o=n(39960),i=n(95999);const c="sidebar_re4s",m="sidebarItemTitle_pO2u",u="sidebarItemList_Yudw",d="sidebarItem__DBe",g="sidebarItemLink_mo7H",h="sidebarItemLinkActive_I1ZP";function f(e){let{sidebar:t}=e;return a.createElement("aside",{className:"col col--3"},a.createElement("nav",{className:(0,s.Z)(c,"thin-scrollbar"),"aria-label":(0,i.I)({id:"theme.blog.sidebar.navAriaLabel",message:"Blog recent posts navigation",description:"The ARIA label for recent posts in the blog sidebar"})},a.createElement("div",{className:(0,s.Z)(m,"margin-bottom--md")},t.title),a.createElement("ul",{className:(0,s.Z)(u,"clean-list")},t.items.map((e=>a.createElement("li",{key:e.permalink,className:d},a.createElement(o.Z,{isNavLink:!0,to:e.permalink,className:g,activeClassName:h},e.title)))))))}var j=n(13102);function p(e){let{sidebar:t}=e;return a.createElement("ul",{className:"menu__list"},t.items.map((e=>a.createElement("li",{key:e.permalink,className:"menu__list-item"},a.createElement(o.Z,{isNavLink:!0,to:e.permalink,className:"menu__link",activeClassName:"menu__link--active"},e.title)))))}function v(e){return a.createElement(j.Zo,{component:p,props:e})}function b(e){let{sidebar:t}=e;const n=(0,r.i)();return t?.items.length?"mobile"===n?a.createElement(v,{sidebar:t}):a.createElement(f,{sidebar:t}):null}function E(e){const{sidebar:t,toc:n,children:r,...o}=e,i=t&&t.items.length>0;return a.createElement(l.Z,o,a.createElement("div",{className:"container margin-vert--lg"},a.createElement("div",{className:"row"},a.createElement(b,{sidebar:t}),a.createElement("main",{className:(0,s.Z)("col",{"col--7":i,"col--9 col--offset-1":!i}),itemScope:!0,itemType:"http://schema.org/Blog"},r),n&&a.createElement("div",{className:"col col--2"},n))))}},63496:(e,t,n)=>{"use strict";n.d(t,{Z:()=>R});var a=n(67294),s=n(86010),l=n(9460),r=n(44996);function o(e){let{children:t,className:n}=e;const{frontMatter:s,assets:o}=(0,l.C)(),{withBaseUrl:i}=(0,r.C)(),c=o.image??s.image;return a.createElement("article",{className:n,itemProp:"blogPost",itemScope:!0,itemType:"http://schema.org/BlogPosting"},c&&a.createElement("meta",{itemProp:"image",content:i(c,{absolute:!0})}),t)}var i=n(39960);const c="title_f1Hy";function m(e){let{className:t}=e;const{metadata:n,isBlogPostPage:r}=(0,l.C)(),{permalink:o,title:m}=n,u=r?"h1":"h2";return a.createElement(u,{className:(0,s.Z)(c,t),itemProp:"headline"},r?m:a.createElement(i.Z,{itemProp:"url",to:o},m))}var u=n(95999),d=n(52263);const g=["zero","one","two","few","many","other"];function h(e){return g.filter((t=>e.includes(t)))}const f={locale:"en",pluralForms:h(["one","other"]),select:e=>1===e?"one":"other"};function j(){const{i18n:{currentLocale:e}}=(0,d.Z)();return(0,a.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:h(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),f}}),[e])}function p(){const e=j();return{selectMessage:(t,n)=>function(e,t,n){const a=e.split("|");if(1===a.length)return a[0];a.length>n.pluralForms.length&&console.error(`For locale=${n.locale}, a maximum of ${n.pluralForms.length} plural forms are expected (${n.pluralForms.join(",")}), but the message contains ${a.length}: ${e}`);const s=n.select(t),l=n.pluralForms.indexOf(s);return a[Math.min(l,a.length-1)]}(n,t,e)}}const v="container_mt6G";function b(e){let{readingTime:t}=e;const n=function(){const{selectMessage:e}=p();return t=>{const n=Math.ceil(t);return e(n,(0,u.I)({id:"theme.blog.post.readingTime.plurals",description:'Pluralized label for "{readingTime} min read". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One min read|{readingTime} min read"},{readingTime:n}))}}();return a.createElement(a.Fragment,null,n(t))}function E(e){let{date:t,formattedDate:n}=e;return a.createElement("time",{dateTime:t,itemProp:"datePublished"},n)}function k(){return a.createElement(a.Fragment,null," \xb7 ")}function N(e){let{className:t}=e;const{metadata:n}=(0,l.C)(),{date:r,formattedDate:o,readingTime:i}=n;return a.createElement("div",{className:(0,s.Z)(v,"margin-vert--md",t)},a.createElement(E,{date:r,formattedDate:o}),void 0!==i&&a.createElement(a.Fragment,null,a.createElement(k,null),a.createElement(b,{readingTime:i})))}function _(e){return e.href?a.createElement(i.Z,e):a.createElement(a.Fragment,null,e.children)}function y(e){let{author:t,className:n}=e;const{name:l,title:r,url:o,imageURL:i,email:c}=t,m=o||c&&`mailto:${c}`||void 0;return a.createElement("div",{className:(0,s.Z)("avatar margin-bottom--sm",n)},i&&a.createElement(_,{href:m,className:"avatar__photo-link"},a.createElement("img",{className:"avatar__photo",src:i,alt:l})),l&&a.createElement("div",{className:"avatar__intro",itemProp:"author",itemScope:!0,itemType:"https://schema.org/Person"},a.createElement("div",{className:"avatar__name"},a.createElement(_,{href:m,itemProp:"url"},a.createElement("span",{itemProp:"name"},l))),r&&a.createElement("small",{className:"avatar__subtitle",itemProp:"description"},r)))}const L="authorCol_q4o9",P="imageOnlyAuthorRow_lXe7",Z="imageOnlyAuthorCol_cxD5";function C(e){let{className:t}=e;const{metadata:{authors:n},assets:r}=(0,l.C)();if(0===n.length)return null;const o=n.every((e=>{let{name:t}=e;return!t}));return a.createElement("div",{className:(0,s.Z)("margin-top--md margin-bottom--sm",o?P:"row",t)},n.map(((e,t)=>a.createElement("div",{className:(0,s.Z)(!o&&"col col--4",o?Z:L),key:t},a.createElement(y,{author:{...e,imageURL:r.authorsImageUrls[t]??e.imageURL}})))))}function x(){return a.createElement("header",null,a.createElement(m,null),a.createElement(N,null),a.createElement(C,null))}var w=n(18780),H=n(88905);function z(e){let{children:t,className:n}=e;const{isBlogPostPage:r}=(0,l.C)();return a.createElement("div",{id:r?w.blogPostContainerID:void 0,className:(0,s.Z)("markdown",n),itemProp:"articleBody"},a.createElement(H.Z,null,t))}var I=n(84881),T=n(86233),M=n(87462);function B(){return a.createElement("b",null,a.createElement(u.Z,{id:"theme.blog.post.readMore",description:"The label used in blog post item excerpts to link to full blog posts"},"Read More"))}function A(e){const{blogPostTitle:t,...n}=e;return a.createElement(i.Z,(0,M.Z)({"aria-label":(0,u.I)({message:"Read more about {title}",id:"theme.blog.post.readMoreLabel",description:"The ARIA label for the link to full blog posts from excerpts"},{title:t})},n),a.createElement(B,null))}const O="blogPostFooterDetailsFull_mRVl";function F(){const{metadata:e,isBlogPostPage:t}=(0,l.C)(),{tags:n,title:r,editUrl:o,hasTruncateMarker:i}=e,c=!t&&i,m=n.length>0;return m||c||o?a.createElement("footer",{className:(0,s.Z)("row docusaurus-mt-lg",t&&O)},m&&a.createElement("div",{className:(0,s.Z)("col",{"col--9":c})},a.createElement(T.Z,{tags:n})),t&&o&&a.createElement("div",{className:"col margin-top--sm"},a.createElement(I.Z,{editUrl:o})),c&&a.createElement("div",{className:(0,s.Z)("col text--right",{"col--3":m})},a.createElement(A,{blogPostTitle:r,to:e.permalink}))):null}function R(e){let{children:t,className:n}=e;const r=function(){const{isBlogPostPage:e}=(0,l.C)();return e?void 0:"margin-bottom--xl"}();return a.createElement(o,{className:(0,s.Z)(r,n)},a.createElement(x,null),a.createElement(z,null,t),a.createElement(F,null))}},65203:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>p});var a=n(67294),s=n(86010),l=n(1944),r=n(35281),o=n(9460),i=n(39058),c=n(63496),m=n(87462),u=n(95999),d=n(32244);function g(e){const{nextItem:t,prevItem:n}=e;return a.createElement("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,u.I)({id:"theme.blog.post.paginator.navAriaLabel",message:"Blog post page navigation",description:"The ARIA label for the blog posts pagination"})},n&&a.createElement(d.Z,(0,m.Z)({},n,{subLabel:a.createElement(u.Z,{id:"theme.blog.post.paginator.newerPost",description:"The blog post button label to navigate to the newer/previous post"},"Newer Post")})),t&&a.createElement(d.Z,(0,m.Z)({},t,{subLabel:a.createElement(u.Z,{id:"theme.blog.post.paginator.olderPost",description:"The blog post button label to navigate to the older/next post"},"Older Post"),isNext:!0})))}function h(){const{assets:e,metadata:t}=(0,o.C)(),{title:n,description:s,date:r,tags:i,authors:c,frontMatter:m}=t,{keywords:u}=m,d=e.image??m.image;return a.createElement(l.d,{title:n,description:s,keywords:u,image:d},a.createElement("meta",{property:"og:type",content:"article"}),a.createElement("meta",{property:"article:published_time",content:r}),c.some((e=>e.url))&&a.createElement("meta",{property:"article:author",content:c.map((e=>e.url)).filter(Boolean).join(",")}),i.length>0&&a.createElement("meta",{property:"article:tag",content:i.map((e=>e.label)).join(",")}))}var f=n(39407);function j(e){let{sidebar:t,children:n}=e;const{metadata:s,toc:l}=(0,o.C)(),{nextItem:r,prevItem:m,frontMatter:u}=s,{hide_table_of_contents:d,toc_min_heading_level:h,toc_max_heading_level:j}=u;return a.createElement(i.Z,{sidebar:t,toc:!d&&l.length>0?a.createElement(f.Z,{toc:l,minHeadingLevel:h,maxHeadingLevel:j}):void 0},a.createElement(c.Z,null,n),(r||m)&&a.createElement(g,{nextItem:r,prevItem:m}))}function p(e){const t=e.content;return a.createElement(o.n,{content:e.content,isBlogPostPage:!0},a.createElement(l.FG,{className:(0,s.Z)(r.k.wrapper.blogPages,r.k.page.blogPostPage)},a.createElement(h,null),a.createElement(j,{sidebar:e.sidebar},a.createElement(t,null))))}},39407:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var a=n(87462),s=n(67294),l=n(86010),r=n(93743);const o="tableOfContents_bqdL";function i(e){let{className:t,...n}=e;return s.createElement("div",{className:(0,l.Z)(o,"thin-scrollbar",t)},s.createElement(r.Z,(0,a.Z)({},n,{linkClassName:"table-of-contents__link toc-highlight",linkActiveClassName:"table-of-contents__link--active"})))}},93743:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var a=n(87462),s=n(67294),l=n(86668);function r(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const a=n.slice(2,e.level);e.parentIndex=Math.max(...a),n[e.level]=t}));const a=[];return t.forEach((e=>{const{parentIndex:n,...s}=e;n>=0?t[n].children.push(s):a.push(s)})),a}function o(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return t.flatMap((e=>{const t=o({toc:e.children,minHeadingLevel:n,maxHeadingLevel:a});return function(e){return e.level>=n&&e.level<=a}(e)?[{...e,children:t}]:t}))}function i(e){const t=e.getBoundingClientRect();return t.top===t.bottom?i(e.parentNode):t}function c(e,t){let{anchorTopOffset:n}=t;const a=e.find((e=>i(e).top>=n));if(a){return function(e){return e.top>0&&e.bottom<window.innerHeight/2}(i(a))?a:e[e.indexOf(a)-1]??null}return e[e.length-1]??null}function m(){const e=(0,s.useRef)(0),{navbar:{hideOnScroll:t}}=(0,l.L)();return(0,s.useEffect)((()=>{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function u(e){const t=(0,s.useRef)(void 0),n=m();(0,s.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:a,linkActiveClassName:s,minHeadingLevel:l,maxHeadingLevel:r}=e;function o(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(a),o=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const a=[];for(let s=t;s<=n;s+=1)a.push(`h${s}.anchor`);return Array.from(document.querySelectorAll(a.join()))}({minHeadingLevel:l,maxHeadingLevel:r}),i=c(o,{anchorTopOffset:n.current}),m=e.find((e=>i&&i.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(s),e.classList.add(s),t.current=e):e.classList.remove(s)}(e,e===m)}))}return document.addEventListener("scroll",o),document.addEventListener("resize",o),o(),()=>{document.removeEventListener("scroll",o),document.removeEventListener("resize",o)}}),[e,n])}function d(e){let{toc:t,className:n,linkClassName:a,isChild:l}=e;return t.length?s.createElement("ul",{className:l?void 0:n},t.map((e=>s.createElement("li",{key:e.id},s.createElement("a",{href:`#${e.id}`,className:a??void 0,dangerouslySetInnerHTML:{__html:e.value}}),s.createElement(d,{isChild:!0,toc:e.children,className:n,linkClassName:a}))))):null}const g=s.memo(d);function h(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:i="table-of-contents__link",linkActiveClassName:c,minHeadingLevel:m,maxHeadingLevel:d,...h}=e;const f=(0,l.L)(),j=m??f.tableOfContents.minHeadingLevel,p=d??f.tableOfContents.maxHeadingLevel,v=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return(0,s.useMemo)((()=>o({toc:r(t),minHeadingLevel:n,maxHeadingLevel:a})),[t,n,a])}({toc:t,minHeadingLevel:j,maxHeadingLevel:p});return u((0,s.useMemo)((()=>{if(i&&c)return{linkClassName:i,linkActiveClassName:c,minHeadingLevel:j,maxHeadingLevel:p}}),[i,c,j,p])),s.createElement(g,(0,a.Z)({toc:v,className:n,linkClassName:i},h))}},9460:(e,t,n)=>{"use strict";n.d(t,{C:()=>o,n:()=>r});var a=n(67294),s=n(902);const l=a.createContext(null);function r(e){let{children:t,content:n,isBlogPostPage:s=!1}=e;const r=function(e){let{content:t,isBlogPostPage:n}=e;return(0,a.useMemo)((()=>({metadata:t.metadata,frontMatter:t.frontMatter,assets:t.assets,toc:t.toc,isBlogPostPage:n})),[t,n])}({content:n,isBlogPostPage:s});return a.createElement(l.Provider,{value:r},t)}function o(){const e=(0,a.useContext)(l);if(null===e)throw new s.i6("BlogPostProvider");return e}},46700:(e,t,n)=>{var a={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function s(e){var t=l(e);return n(t)}function l(e){if(!n.o(a,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return a[e]}s.keys=function(){return Object.keys(a)},s.resolve=l,e.exports=s,s.id=46700}}]); \ No newline at end of file diff --git a/docs/assets/js/ccd6c61b.806c9d2e.js b/docs/assets/js/ccd6c61b.806c9d2e.js new file mode 100644 index 000000000..b3760899b --- /dev/null +++ b/docs/assets/js/ccd6c61b.806c9d2e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33985],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(r),m=a,b=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(b,i(i({ref:t},c),{},{components:r})):n.createElement(b,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d<o;d++)i[d]=r[d];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},7736:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.9.1/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.9.1/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.9.1/basics/directory-structure",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.9.1/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.9.1/basics/odra-toml"}},s={},d=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:"src/",id:"src",level:2},{value:"bin/",id:"bin",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],c={toc:d};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 bin/\n| |\u2500\u2500 build_contract.rs\n| \u2514\u2500\u2500 build_schema.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.9.0"\n\n[dev-dependencies]\nodra-test = "0.9.0"\n\n[build-dependencies]\nodra-build = "0.9.0"\n\n[[bin]]\nname = "sample_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "sample_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. For testing purposes, ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-test")," is also\nadded as a dev dependency."),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"bin"},"bin/"),(0,a.kt)("p",null,"This is the folder where scripts that will be used to generate code or schemas live.\nYou don't need to modify those files, they are generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command and\nare used by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra schema")," commands."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cd591068.e0df5b95.js b/docs/assets/js/cd591068.e0df5b95.js new file mode 100644 index 000000000..562cc53b7 --- /dev/null +++ b/docs/assets/js/cd591068.e0df5b95.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[92331],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(h,s(s({ref:t},d),{},{components:n})):r.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},94806:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.3.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.3.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.3.0/basics/testing",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"defaultSidebar",previous:{title:"Host Communication",permalink:"/docs/0.3.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.3.0/basics/errors"}},l={},c=[{value:"Test env",id:"test-env",level:2},{value:"Deployer",id:"deployer",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'use odra::{Variable, List};\n\n#[cfg(test)]\nmod tests {\n use super::DogContract3Deployer;\n\n #[test]\n fn init_test() {\n let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(module)]")," macro created a Deployer code for us, which will deploy the contract on the\nVM:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},'let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());\n')),(0,a.kt)("p",null,"From now on, we can use ",(0,a.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with a macro are available to us:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,a.kt)("h2",{id:"test-env"},"Test env"),(0,a.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/testing.rs"',title:'"examples/src/docs/testing.rs"'},'#[cfg(test)]\nmod tests {\n use super::TestingContractDeployer;\n\n #[test]\n fn test_env() {\n let testing_contract = TestingContractDeployer::init("MyContract".to_string());\n let creator = testing_contract.created_by();\n odra::test_env::set_caller(odra::test_env::get_account(1));\n let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());\n let creator2 = testing_contract2.created_by();\n assert!(creator != creator2);\n }\n}\n')),(0,a.kt)("p",null,"In the code above, we are deploying two instances of the same contract, but we're using ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::test_env::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,a.kt)("inlineCode",{parentName:"p"},"odra::contract_env::caller()"),"\nthe function we are calling inside the contract."),(0,a.kt)("p",null,"Each test env comes with a set of functions that will let you write better tests:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_caller(address: Address)")," - you've seen it in action just now"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn token_balance(address: Address) -> Balance")," - it returns the balance of the account associated with the given address"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn advance_block_time_by(seconds: BlockTime)")," - it increases the current value of block_time"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_account(n: usize) -> Address")," - it returns an nth address that was prepared for you by Odra in advance;\nby default, you start with the 0th account"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn assert_exception<F, E>(err: E, block: F)")," - it executes the ",(0,a.kt)("inlineCode",{parentName:"li"},"block")," code and expects ",(0,a.kt)("inlineCode",{parentName:"li"},"err")," to happen"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError>")," - returns\nthe event emitted by the contract")),(0,a.kt)("p",null,"Again, we'll see those used in the next articles."),(0,a.kt)("h2",{id:"deployer"},"Deployer"),(0,a.kt)("p",null,"You may be wondering what is the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractDeployer")," and where did it come from.\nIt is a piece of code generated automatically for you, thanks to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nIf you used the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," on one of the methods, it will be the constructor of your contract.\nOdra will make sure that it is called only once, so you can use it to initialize your data structures etc."),(0,a.kt)("p",null,"If you do not provide the init method, you can deploy the contract using ",(0,a.kt)("inlineCode",{parentName:"p"},"::default()")," method.\nIn the end, you will get a ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," instance (in our case the ",(0,a.kt)("inlineCode",{parentName:"p"},"TestingContractRef"),") which reimplements all\nthe methods you defined in the contract, but executes them on a blockchain!"),(0,a.kt)("p",null,"To learn more about the ",(0,a.kt)("inlineCode",{parentName:"p"},"Ref")," contract, visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/cross-calls"},"Cross calls")," article."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We take a look at how Odra handles errors!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cd790770.a74b1a35.js b/docs/assets/js/cd790770.a74b1a35.js new file mode 100644 index 000000000..4206b3d9f --- /dev/null +++ b/docs/assets/js/cd790770.a74b1a35.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[58841],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(r),f=a,d=m["".concat(l,".").concat(f)]||m[f]||u[f]||o;return r?n.createElement(d,i(i({ref:t},p),{},{components:r})):n.createElement(d,i({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},74324:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const o={slug:"2023-02-27-openai-writes-erc20-in-odra",title:"OpenAI writes ERC20 in Odra",authors:["zie1ony"],image:"./twitter-card.png"},i=void 0,c={permalink:"/blog/2023-02-27-openai-writes-erc20-in-odra",source:"@site/blog/2023-02-27-openai-writes-erc20-in-odra/index.md",title:"OpenAI writes ERC20 in Odra",description:"OpenAI can write Odra smart contracts.",date:"2023-02-27T00:00:00.000Z",formattedDate:"February 27, 2023",tags:[],readingTime:3.785,hasTruncateMarker:!0,authors:[{name:"Maciej Zieli\u0144ski",title:"CTO",url:"https://github.com/zie1ony",key:"zie1ony"}],frontMatter:{slug:"2023-02-27-openai-writes-erc20-in-odra",title:"OpenAI writes ERC20 in Odra",authors:["zie1ony"],image:"./twitter-card.png"},prevItem:{title:"It's all about the community!",permalink:"/blog/its-all-about-the-community"},nextItem:{title:"Odra + CosmWasm",permalink:"/blog/odra-cosmwasm"}},l={image:r(901).Z,authorsImageUrls:[void 0]},s=[],p={toc:s};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"OpenAI can write Odra smart contracts.\nThis is how."))}u.isMDXComponent=!0},901:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/twitter-card-0f7e768e63da0acd629609954ba26f62.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/cdca8af0.f22d45e4.js b/docs/assets/js/cdca8af0.f22d45e4.js new file mode 100644 index 000000000..3700a4c65 --- /dev/null +++ b/docs/assets/js/cdca8af0.f22d45e4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40588],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 l(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 i(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 s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(a),m=r,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return a?n.createElement(g,l(l({ref:t},c),{},{components:a})):n.createElement(g,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var p=2;p<o;p++)l[p]=a[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"},27382:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-1.0.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-1.0.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/getting-started/installation",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/getting-started/flipper"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,r.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,r.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,r.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-unknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,r.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,r.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,r.kt)("p",null,"To install it, simply execute the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --locked\n")),(0,r.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,r.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,r.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,r.kt)("p",null,"To create a new project, simply execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,r.kt)("p",null,"This will create a new folder called ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," and initialize Odra there. Cargo Odra\nwill create a sample contract for you in ",(0,r.kt)("inlineCode",{parentName:"p"},"src")," directory. You can run the tests of this contract\nby executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,r.kt)("h2",{id:"whats-next"},"What's next?"),(0,r.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,r.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cde2d623.b80529fb.js b/docs/assets/js/cde2d623.b80529fb.js new file mode 100644 index 000000000..8302c0398 --- /dev/null +++ b/docs/assets/js/cde2d623.b80529fb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[70825],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u<a;u++)s[u]=n[u];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},60090:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:12,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/docs/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/next/basics/modules",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/next/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/next/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to the ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),' attribute. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\nuse odra::module::SubModule;\nuse odra::prelude::*;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: SubModule<MathEngine>\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("admonition",{type:"important"},(0,o.kt)("p",{parentName:"admonition"},"To use a module as a component of another module, you need to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"SubModule")," type. This is a special type\nthat crates a keyspace (read more in ",(0,o.kt)("a",{parentName:"p",href:"/docs/next/advanced/storage-layout"},"Storage Layout"),") and provide access to its public methods.")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the ",(0,o.kt)("inlineCode",{parentName:"p"},"MathEngine")," - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.1.0/examples/src/contracts/owned_token.rs"},"OwnedToken example")," in the main Odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"#[cfg(test)]\nmod tests {\n use super::ModulesContractHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);\n assert_eq!(modules_contract.add_using_module(), 8);\n }\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ce4f9116.5a0bbbe5.js b/docs/assets/js/ce4f9116.5a0bbbe5.js new file mode 100644 index 000000000..8a0c4d883 --- /dev/null +++ b/docs/assets/js/ce4f9116.5a0bbbe5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99680],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=d(t),m=o,h=p["".concat(i,".").concat(m)]||p[m]||u[m]||a;return t?r.createElement(h,l(l({ref:n},c),{},{components:t})):r.createElement(h,l({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var d=2;d<a;d++)l[d]=t[d];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}p.displayName="MDXCreateElement"},3529:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:4},l="Access Control",s={unversionedId:"tutorials/access-control",id:"version-0.7.0/tutorials/access-control",title:"Access Control",description:"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,",source:"@site/versioned_docs/version-0.7.0/tutorials/access-control.md",sourceDirName:"tutorials",slug:"/tutorials/access-control",permalink:"/docs/0.7.0/tutorials/access-control",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"OwnedToken",permalink:"/docs/0.7.0/tutorials/owned-token"},next:{title:"Pausable",permalink:"/docs/0.7.0/tutorials/pauseable"}},i={},d=[{value:"Code",id:"code",level:2},{value:"Events and Errors",id:"events-and-errors",level:3},{value:"Module",id:"module",level:3}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"access-control"},"Access Control"),(0,o.kt)("p",null,"In a previous tutorial, we introduced the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.7.0/tutorials/ownable"},(0,o.kt)("inlineCode",{parentName:"a"},"Ownable"))," module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient, "),(0,o.kt)("p",null,"In this article we design and implement a more fine-grained access control layer."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"Before we start writing code, we list the functionalities of our access control layer."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type is used across the module."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be assigned to many ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es."),(0,o.kt)("li",{parentName:"ol"},"Each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," may have a corresponding admin role."),(0,o.kt)("li",{parentName:"ol"},"Only an admin can grant/revoke a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),"."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be renounced."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," cannot be renounced on someone's behalf."),(0,o.kt)("li",{parentName:"ol"},"Each action triggers an event."),(0,o.kt)("li",{parentName:"ol"},"Unauthorized access stops contract execution.")),(0,o.kt)("h3",{id:"events-and-errors"},"Events and Errors"),(0,o.kt)("p",null,"There are three actions that can be performed concerning a ",(0,o.kt)("inlineCode",{parentName:"p"},"Role"),": granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=events.rs showLineNumbers",title:"events.rs",showLineNumbers:!0},"use odra::{types::Address, Event};\nuse super::access_control::Role;\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleGranted {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleRevoked {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleAdminChanged {\n pub role: Role,\n pub previous_admin_role: Role,\n pub new_admin_role: Role\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L4-L16")," - to describe the grant or revoke actions, our events specify the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", and ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es indicating who receives or loses access and who provides or withdraws it."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L18-L21")," - the event describing the admin role change, requires the subject ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", the previous and the current admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=errors.rs",title:"errors.rs"},"use odra::execution_error;\n\nexecution_error! {\n pub enum Error {\n MissingRole => 20_000,\n RoleRenounceForAnotherAddress => 20_001,\n }\n}\n")),(0,o.kt)("p",null,"Errors definition is straightforward - there are only two invalid states: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"An action is triggered by an unauthorized actor."),(0,o.kt)("li",{parentName:"ol"},"The caller is attempting to resign the Role on someone's behalf. ")),(0,o.kt)("h3",{id:"module"},"Module"),(0,o.kt)("p",null,"Now, we are stepping into the most interesting part: the module definition and implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=access_control.rs showLineNumbers",title:"access_control.rs",showLineNumbers:!0},"use super::{\n errors::Error,\n events::{RoleAdminChanged, RoleGranted, RoleRevoked}\n};\nuse odra::{\n contract_env,\n types::{event::OdraEvent, Address},\n Mapping\n};\n\npub type Role = [u8; 32];\n\npub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];\n\n#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]\npub struct AccessControl {\n roles: Mapping<Role, Mapping<Address, bool>>,\n role_admin: Mapping<Role, Role>\n}\n\n#[odra::module]\nimpl AccessControl {\n pub fn has_role(&self, role: &Role, address: &Address) -> bool {\n self.roles.get_instance(role).get_or_default(address)\n }\n\n pub fn get_role_admin(&self, role: &Role) -> Role {\n let admin_role = self.role_admin.get(role);\n if let Some(admin) = admin_role {\n admin\n } else {\n DEFAULT_ADMIN_ROLE\n }\n }\n\n pub fn grant_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &contract_env::caller());\n self.unchecked_grant_role(role, address);\n }\n\n pub fn revoke_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &contract_env::caller());\n self.unchecked_revoke_role(role, address);\n }\n\n pub fn renounce_role(&mut self, role: &Role, address: &Address) {\n if address != &contract_env::caller() {\n contract_env::revert(Error::RoleRenounceForAnotherAddress);\n }\n self.unchecked_revoke_role(role, address);\n }\n}\n\nimpl AccessControl {\n pub fn check_role(&self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n contract_env::revert(Error::MissingRole);\n }\n }\n\n pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {\n let previous_admin_role = self.get_role_admin(role);\n self.role_admin.set(role, *admin_role);\n RoleAdminChanged {\n role: *role,\n previous_admin_role,\n new_admin_role: *admin_role\n }\n .emit();\n }\n\n pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.roles.get_instance(role).set(address, true);\n RoleGranted {\n role: *role,\n address: *address,\n sender: contract_env::caller()\n }\n .emit();\n }\n }\n\n pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {\n if self.has_role(role, address) {\n self.roles.get_instance(role).set(address, false);\n RoleRevoked {\n role: *role,\n address: *address,\n sender: contract_env::caller()\n }\n .emit();\n }\n }\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L11")," - Firstly, we need the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type. It is simply an alias for a 32-byte array."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L13")," - The default role is an array filled with zeros."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L15-L19")," - The storage consists of two mappings:")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"roles - a nested mapping that stores information about whether a certain Role is granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"."),(0,o.kt)("li",{parentName:"ol"},"role_admin - each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can have a single admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L23-L25")," - This is a simple check to determine if a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," has been granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),". It is an exposed entry point and an important building block widely used throughout the entire module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L54")," - This is a non-exported block containing helper functions."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L55-L59")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," function serves as a guard function. Before a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with ",(0,o.kt)("inlineCode",{parentName:"li"},"Error::MissingRole"),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L61-L70")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"set_admin_role()")," function simply updates the role_admin mapping and emits the ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleAdminChanged")," event."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L72-L94")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_revoke_role()")," functions are mirror functions that update the roles mapping and post ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleGranted")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleRevoked")," events. If the role is already granted, ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," has no effect (the opposite check is made in the case of revoking a role)."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L27-L34")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"get_role_admin()")," entry point reads the role_admin. If there is no admin role for a given role, it returns the default role."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L36-L51")," - This is a combination of ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_*_role()"),". Entry points fail on unauthorized access.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ce999a4e.3e2a770e.js b/docs/assets/js/ce999a4e.3e2a770e.js new file mode 100644 index 000000000..d6b547e59 --- /dev/null +++ b/docs/assets/js/ce999a4e.3e2a770e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12862],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},71824:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"version-0.2.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.2.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.2.0/basics/cargo-odra",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"defaultSidebar",previous:{title:"Basics",permalink:"/docs/0.2.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.2.0/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Updating dependencies",id:"updating-dependencies",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them on multiple backends (blockchains)."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands will help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This will create a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my-project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my-project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my-project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using an existing template located in\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra-template"},"https://github.com/odradev/odra-template"),".\nIf you want, you can use your own template, by passing ",(0,r.kt)("inlineCode",{parentName:"p"},"-r")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -r https://github.com/my-repo/my-odra-template --name my-project\n")),(0,r.kt)("p",null,"Additionally, you can pass a branch name you want to use using ",(0,r.kt)("inlineCode",{parentName:"p"},"-g"),", otherwise, the default\nbranch will be used. To see an example of a template, take a look at the repository linked above."),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it will create a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This will create a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.2.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It will run your tests against Odra's MockVM. It is substantially faster than virtual machines\nprovided by blockchains developers and implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files,\nspin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat.\nKeep in mind that this is a lot slower than MockVM and you cannot use the debugger.\nThis is why MockVM was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("p",null,"Where ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," is the name of the backend we are using in this example. If the build process\nfinishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder."),(0,r.kt)("h2",{id:"updating-dependencies"},"Updating dependencies"),(0,r.kt)("p",null,"You will learn later, that the project using Odra contains more than one Rust project - your own and\none or more builders. To run ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo update")," on all of them at once instead of traversing all the folders\nyou can use this command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra update\n")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ce9c8ec6.dd9e5ce1.js b/docs/assets/js/ce9c8ec6.dd9e5ce1.js new file mode 100644 index 000000000..cae225687 --- /dev/null +++ b/docs/assets/js/ce9c8ec6.dd9e5ce1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[21957],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,g=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return t?a.createElement(g,i(i({ref:n},p),{},{components:t})):a.createElement(g,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l<o;l++)i[l]=t[l];return a.createElement.apply(null,i)}return a.createElement.apply(null,t)}u.displayName="MDXCreateElement"},15766:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const o={},i="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-0.9.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-0.9.0/advanced/02-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/0.9.0/advanced/advanced-storage",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/0.9.0/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/0.9.0/advanced/attributes"}},c={},l=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:l};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Var"),": A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence<T>\nwhere\n T: Num + One + ToBytes + FromBytes + CLTyped\n{\n value: Var<T>\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is a key-value storage system where the key is associated with a value.\nIn previous examples, the value of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,r.kt)("p",null,"However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{casper_types::U256, Mapping, UnwrapOrRevert};\nuse odra::prelude::*;\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct Mappings {\n strings: Mapping<(String, u32, String), String>,\n tokens: Mapping<String, OwnedToken>\n}\n\n#[odra::module]\nimpl Mappings {\n\n ...\n\n pub fn total_supply(&mut self, token_name: String) -> U256 {\n self.tokens.module(&token_name).total_supply()\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let opt_string = self.strings.get(&(key1, key2, key3));\n opt_string.unwrap_or_revert(&self.env())\n }\n}\n")),(0,r.kt)("p",null,"As you can see, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," key can consist of a tuple of values, not limited to a single value."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra modules differs from accessing regular values such as strings or numbers."),(0,r.kt)("p",{parentName:"admonition"},"Firstly, within a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you don't encapsulate the module with ",(0,r.kt)("inlineCode",{parentName:"p"},"Submodule"),"."),(0,r.kt)("p",{parentName:"admonition"},"Secondly, rather than utilizing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::module()"),", which returns ",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<T>")," and sets the appropriate namespace for nested modules.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, casper_types::U512, Sequence, Mapping};\nuse odra::prelude::*;\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n counter: Sequence<u32>,\n tokens: Mapping<(String, String), Token>,\n}\n\nimpl AdvancedStorage {\n pub fn current_value(&self) -> u32 {\n self.counter.get_current_value()\n }\n\n pub fn increment_and_get(&mut self) -> u32 {\n self.counter.next_value()\n }\n\n pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {\n let token = self.tokens.module(&(token_name, creator));\n token.balance_of(&address)\n }\n\n pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {\n let mut token = self.tokens.module(&(token_name, creator));\n token.mint(amount, to);\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra offers a Sequence module, enabling contracts to store and increment a single value."),(0,r.kt)("li",{parentName:"ol"},"Mappings support composite keys expressed as tuples and can store modules as values.")),(0,r.kt)("p",null,"Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cecbc2b5.b41420c7.js b/docs/assets/js/cecbc2b5.b41420c7.js new file mode 100644 index 000000000..027798513 --- /dev/null +++ b/docs/assets/js/cecbc2b5.b41420c7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[65901],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,m=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},63481:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-0.3.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-0.3.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/0.3.0/backends/what-is-a-backend",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"defaultSidebar",previous:{title:"Backends",permalink:"/docs/0.3.0/category/backends"},next:{title:"MockVM",permalink:"/docs/0.3.0/backends/mock-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Test Env",id:"test-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/backends/mock-vm"},"MockVM"),",\nor a complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/backends/casper"},"CasperVM"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cf3f256a.78eca585.js b/docs/assets/js/cf3f256a.78eca585.js new file mode 100644 index 000000000..469cf0026 --- /dev/null +++ b/docs/assets/js/cf3f256a.78eca585.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73175],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},d),{},{components:r})):n.createElement(f,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c<o;c++)i[c]=r[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},55132:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.7.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.7.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.7.0/basics/directory-structure",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.7.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.7.0/basics/odra-toml"}},s={},c=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:".builder_* folders",id:"builder_-folders",level:2},{value:"src/",id:"src",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 .builder_casper/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. We are using two features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/mock-vm")," - it is responsible for running tests on Odra's MockVM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/casper")," - backend implementation of Casper blockchain\nMore backends will be released as features that will be possible to enable here.")),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"builder_-folders"},".builder_* folders"),(0,a.kt)("p",null,"Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary\nfor building wasm files and running them against blockchain VMs. As it is not necessary to modify\nfiles in those folders in any way, by default they are hidden (hence the ",(0,a.kt)("inlineCode",{parentName:"p"},".")," at the beginning of the\nfolder name)."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain of your choosing."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/cfdaa3fd.f7f00778.js b/docs/assets/js/cfdaa3fd.f7f00778.js new file mode 100644 index 000000000..ed12935f1 --- /dev/null +++ b/docs/assets/js/cfdaa3fd.f7f00778.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[24999],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(t),m=a,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},c),{},{components:t})):r.createElement(f,o({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=u;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var d=2;d<s;d++)o[d]=t[d];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}u.displayName="MDXCreateElement"},37982:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const s={sidebar_position:3},o="ERC-20",l={unversionedId:"tutorials/erc20",id:"version-0.9.1/tutorials/erc20",title:"ERC-20",description:"It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.",source:"@site/versioned_docs/version-0.9.1/tutorials/erc20.md",sourceDirName:"tutorials",slug:"/tutorials/erc20",permalink:"/docs/0.9.1/tutorials/erc20",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Ownable",permalink:"/docs/0.9.1/tutorials/ownable"},next:{title:"OwnedToken",permalink:"/docs/0.9.1/tutorials/owned-token"}},i={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:2},{value:"Metadata",id:"metadata",level:3},{value:"Core",id:"core",level:3},{value:"Test",id:"test",level:3},{value:"What's next",id:"whats-next",level:2}],c={toc:d};function p(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"erc-20"},"ERC-20"),(0,a.kt)("p",null,"It's time for something that every smart contract developer has done at least once. Let's try to implement ",(0,a.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"Erc20")," standard. Of course, we are going to use the Odra Framework. "),(0,a.kt)("p",null,"The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value."),(0,a.kt)("h2",{id:"framework-features"},"Framework features"),(0,a.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Advanced storage using key-value pairs,"),(0,a.kt)("li",{parentName:"ul"},"Odra types such as ",(0,a.kt)("inlineCode",{parentName:"li"},"Address"),","),(0,a.kt)("li",{parentName:"ul"},"Advanced event assertion.")),(0,a.kt)("h2",{id:"code"},"Code"),(0,a.kt)("p",null,"Our module features a considerably more complex storage layout compared to the previous example. "),(0,a.kt)("p",null,"It is designed to store the following data:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Immutable metadata - name, symbol, and decimals."),(0,a.kt)("li",{parentName:"ol"},"Total supply."),(0,a.kt)("li",{parentName:"ol"},"Balances of individual users."),(0,a.kt)("li",{parentName:"ol"},"Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.")),(0,a.kt)("h2",{id:"module-definition"},"Module definition"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Mapping, Var};\n\n#[odra::module(events = [Transfer, Approval])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L10")," - For the first time, we need to store key-value pairs. In order to do that, we use ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),". The name is taken after Solidity's native type ",(0,a.kt)("inlineCode",{parentName:"li"},"mapping"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L11")," - Odra does not allows nested ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping"),"s as Solidity does. Instead, you can create a compound key using a tuple of keys.")),(0,a.kt)("h3",{id:"metadata"},"Metadata"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},"#[odra::module]\nimpl Erc20 {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let caller = self.env().caller();\n self.name.set(name);\n self.symbol.set(symbol);\n self.decimals.set(decimals);\n self.mint(&caller, &initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn symbol(&self) -> String {\n self.symbol.get_or_default()\n }\n\n pub fn decimals(&self) -> u8 {\n self.decimals.get_or_default()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.total_supply.get_or_default()\n }\n}\n\nimpl Erc20 {\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.balances.add(address, *amount);\n self.total_supply.add(*amount);\n \n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n}\n\n#[odra::event]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L1")," - The first ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," block, marked as a module, contains functions defined in the ERC-20 standard."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L3-L9")," - A constructor sets the token metadata and mints the initial supply."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L28")," - The second ",(0,a.kt)("inlineCode",{parentName:"li"},"impl")," is not an Odra module; in other words, these functions will not be part of the contract's public interface."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L29-L38")," - The ",(0,a.kt)("inlineCode",{parentName:"li"},"mint")," function is public, so, like in regular Rust code, it will be accessible from the outside. ",(0,a.kt)("inlineCode",{parentName:"li"},"mint()")," uses the notation ",(0,a.kt)("inlineCode",{parentName:"li"},"self.balances.add(address, *amount);"),", which is syntactic sugar for:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::UnwrapOrRevert;\n\nlet current_balance = self.balances.get(address).unwrap_or_default();\nlet new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());\nself.balances.set(address, new_balance);\n")),(0,a.kt)("h3",{id:"core"},"Core"),(0,a.kt)("p",null,"To ensure comprehensive functionality, let's implement the remaining features such as ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"transfer_from"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"approve"),". Since they do not introduce any new concepts, we will present them without additional remarks."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"showLineNumbers title=erc20.rs",showLineNumbers:!0,title:"erc20.rs"},"#[odra::module]\nimpl Erc20 {\n ...\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.balances.get_or_default(&address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n}\n\nimpl Erc20 {\n ...\n\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let owner_balance = self.balances.get_or_default(&owner);\n if *amount > owner_balance {\n self.env().revert(Error::InsufficientBalance)\n }\n self.balances.set(owner, owner_balance - *amount);\n self.balances.add(recipient, *amount);\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowance(owner, spender);\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n let new_allowance = allowance - *amount;\n self.allowances\n .set(&(*owner, *spender), new_allowance);\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\n#[odra::event]\npub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 1,\n InsufficientAllowance = 2,\n}\n")),(0,a.kt)("p",null,"Now, compare the code we have written, with ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"},"Open Zeppelin code"),". Out of 10, how Solidity-ish is our implementation?"),(0,a.kt)("h3",{id:"test"},"Test"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=erc20.rs showLineNumbers",title:"erc20.rs",showLineNumbers:!0},'#[cfg(test)]\npub mod tests {\n use super::*;\n use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: INITIAL_SUPPLY.into()\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n #[test]\n fn transfer_from_and_approval_work() {\n let (env, mut erc20) = setup();\n\n let (owner, recipient, spender) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let approved_amount = 3_000.into();\n let transfer_amount = 1_000.into();\n\n assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));\n\n // Owner approves Spender.\n erc20.approve(&spender, &approved_amount);\n\n // Allowance was recorded.\n assert_eq!(erc20.allowance(&owner, &spender), approved_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount\n }\n ));\n\n // Spender transfers tokens from Owner to Recipient.\n env.set_caller(spender);\n erc20.transfer_from(&owner, &recipient, &transfer_amount);\n\n // Tokens are transferred and allowance decremented.\n assert_eq!(\n erc20.balance_of(&owner),\n U256::from(INITIAL_SUPPLY) - transfer_amount\n );\n assert_eq!(erc20.balance_of(&recipient), transfer_amount);\n assert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n ));\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n ));\n // assert!(env.emitted(erc20.address(), "Transfer"));\n }\n\n #[test]\n fn transfer_from_error() {\n // Given a new instance.\n let (env, mut erc20) = setup();\n\n // When the spender\'s allowance is zero.\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n // Then transfer fails.\n assert_eq!(\n erc20.try_transfer_from(&owner, &recipient, &amount),\n Err(Error::InsufficientAllowance.into())\n );\n }\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"L146")," - Alternatively, if you don't want to check the entire event, you may assert only its type.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Having two modules: ",(0,a.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20"),", let's combine them, and create an ERC-20 on steroids."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d0c01b74.6a43ad0e.js b/docs/assets/js/d0c01b74.6a43ad0e.js new file mode 100644 index 000000000..b72e722b7 --- /dev/null +++ b/docs/assets/js/d0c01b74.6a43ad0e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33622],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?a.createElement(f,s(s({ref:t},u),{},{components:n})):a.createElement(f,s({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,s=new Array(i);s[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,s[1]=o;for(var p=2;p<i;p++)s[p]=n[p];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},62276:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const i={sidebar_position:5,description:"How to write data into blockchain's storage"},s="Storage interaction",o={unversionedId:"basics/storage-interaction",id:"version-0.2.0/basics/storage-interaction",title:"Storage interaction",description:"How to write data into blockchain's storage",source:"@site/versioned_docs/version-0.2.0/basics/05-storage-interaction.md",sourceDirName:"basics",slug:"/basics/storage-interaction",permalink:"/docs/0.2.0/basics/storage-interaction",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"How to write data into blockchain's storage"},sidebar:"defaultSidebar",previous:{title:"Flipper Internals",permalink:"/docs/0.2.0/basics/flipper-internals"},next:{title:"Host Communication",permalink:"/docs/0.2.0/basics/communicating-with-host"}},l={},p=[{value:"Variable",id:"variable",level:2},{value:"Mapping",id:"mapping",level:2},{value:"List",id:"list",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-interaction"},"Storage interaction"),(0,r.kt)("p",null,"The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go\nthrough all of them and explain their pros and cons."),(0,r.kt)("h2",{id:"variable"},"Variable"),(0,r.kt)("p",null,"The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your\nvariable in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable"),' type. Let\'s look at a "real world" example of a contract that represents a dog:'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"#[odra::module]\npub struct DogContract {\n barks: Variable<bool>,\n weight: Variable<u32>,\n name: Variable<String>,\n pets: Variable<Vec<u32>>,\n}\n")),(0,r.kt)("p",null,"You can see the ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," wrapping the data. Even complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," can be wrapped (with some caveats)!"),(0,r.kt)("p",null,"Let's make this contract usable, by providing a constructor and some getter functions:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"use odra::Variable;\n\n#[odra::module]\nimpl DogContract {\n #[odra(init)]\n pub fn init(&mut self, barks: bool, weight: u32, name: String) {\n self.barks.set(barks);\n self.weight.set(weight);\n self.name.set(name);\n self.walks.set(Vec::<u32>::default());\n }\n\n pub fn barks(&self) -> bool {\n self.barks.get_or_default()\n }\n\n pub fn weight(&self) -> u32 {\n self.weight.get_or_default()\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.len() as u32\n }\n\n pub fn walks_total_length(&self) -> u32 {\n let walks = self.walks.get_or_default();\n walks.iter().sum()\n }\n}\n")),(0,r.kt)("p",null,"As you can see, you can access the data, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"get_or_default")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"...\nself.barks.get_or_default()\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Keep in mind that using ",(0,r.kt)("inlineCode",{parentName:"p"},"get()")," will result in an Option that you'll need to unwrap - the variable\ndoesn't have to be initialized!")),(0,r.kt)("p",null,"To modify the data, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"set()")," function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"self.barks.set(barks);\n")),(0,r.kt)("p",null,"A Variable is easy to use and efficient for simple data types. One of its downsides is that it\nserializes the data as a whole, so when you're using complex types like ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap"),",\neach time you ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," the whole data is read and written to the blockchain storage."),(0,r.kt)("p",null,"In the example above, if we want to see how many walks our dog had, we would use the function:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/variable.rs"',title:'"examples/src/docs/variable.rs"'},"pub fn walks_amount(&self) -> usize {\n let walks = self.walks.get_or_default();\n walks.len()\n}\n")),(0,r.kt)("p",null,"But to do so, we need to extract the whole serialized vector from the storage, which would inefficient,\nespecially for larger sets of data."),(0,r.kt)("p",null,"To tackle this issue following two types were created."),(0,r.kt)("h2",{id:"mapping"},"Mapping"),(0,r.kt)("p",null,"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to\npass two values - the key type and the value type. Let's look at the variation of the Dog contract, that\nuses Mapping to store information about our dog's friends and how many times they visited:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"use odra::{Mapping, Variable};\n\n#[odra::module]\npub struct DogContract2 {\n name: Variable<String>,\n friends: Mapping<String, u32>,\n}\n")),(0,r.kt)("p",null,"In the example above, our key is a String (it is a name of the friend) and we are storing u32 values\n(amount of visits). To read and write values from and into a Mapping we use a similar approach\nto the one shown in the Variables section with one difference - we need to pass a key:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/mapping.rs"',title:'"examples/src/docs/mapping.rs"'},"pub fn visit(&mut self, friend_name: String) {\n let visits = self.visits(friend_name.clone());\n self.friends.set(&friend_name, visits + 1);\n}\n\npub fn visits(&self, friend_name: String) -> u32 {\n match self.friends.get(&friend_name) {\n None => {\n 0\n },\n Some(v) => {\n v\n }\n }\n}\n")),(0,r.kt)("p",null,"The biggest improvement over a ",(0,r.kt)("inlineCode",{parentName:"p"},"Variable")," is that we can model functionality of a ",(0,r.kt)("inlineCode",{parentName:"p"},"HashMap")," using ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nThe amount of data written to and read from the storage is minimal. However, we cannot iterate over ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),".\nWe could implement such behaviour by using a numeric type key and saving the length of the set in a\nseparate variable. Thankfully Odra comes with a prepared solution - the ",(0,r.kt)("inlineCode",{parentName:"p"},"List")," type."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with\na Variable working together:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="core/src/list.rs"',title:'"core/src/list.rs"'},"use odra::{Variable, List};\n\npub struct List<T> {\n values: Mapping<u32, T>,\n index: Variable<u32>\n}\n"))),(0,r.kt)("h2",{id:"list"},"List"),(0,r.kt)("p",null,"Going back to our DogContract example - let's revisit the walk case. This time, instead of ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),",\nwe'll use the list:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\npub struct DogContract3 {\n name: Variable<String>,\n walks: List<u32>,\n}\n")),(0,r.kt)("p",null,"As you can see, the notation is very similar to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Vec"),". To understand the usage, take a look\nat the reimplementation of the functions with an additional function that takes our dog for a walk\n(it writes the data to the storage):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/list.rs"',title:'"examples/src/docs/list.rs"'},"#[odra::module]\nimpl DogContract3 {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn walks_amount(&self) -> u32 {\n self.walks.len()\n }\n\n pub fn walks_total_length(&self) -> u32 {\n self.walks.iter().sum()\n }\n\n pub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n }\n}\n")),(0,r.kt)("p",null,"Now, we can know how many walks our dog had without loading the whole vector from the storage.\nWe need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all\nthe cases for you."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"All of the above examples, alongside the tests, are available in the odra repository in the ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/docs/")," folder.")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next article, we'll see how to query the host for information about the world and our contract."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d15969ed.fe295ed8.js b/docs/assets/js/d15969ed.fe295ed8.js new file mode 100644 index 000000000..d4ee11349 --- /dev/null +++ b/docs/assets/js/d15969ed.fe295ed8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40190],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>p});var n=a(67294);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 s(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 u=n.createContext({}),i=function(e){var t=n.useContext(u),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=i(e.components);return n.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,u=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),m=i(a),p=r,h=m["".concat(u,".").concat(p)]||m[p]||d[p]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function p(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=m;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var i=2;i<o;i++)s[i]=a[i];return n.createElement.apply(null,s)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"},86318:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>i});var n=a(87462),r=(a(67294),a(3905));const o={slug:"odra-cosmwasm",title:"Odra + CosmWasm",authors:["kpob"],image:"https://github.com/odradev.png"},s=void 0,l={permalink:"/blog/odra-cosmwasm",source:"@site/blog/2023-02-15-odra-cosmos.md",title:"Odra + CosmWasm",description:"In November 2022 we released the first version of the Odra Framework. It's time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm.",date:"2023-02-15T00:00:00.000Z",formattedDate:"February 15, 2023",tags:[],readingTime:5.96,hasTruncateMarker:!0,authors:[{name:"Krzysztof Pobiar\u017cyn",title:"Lead Developer",url:"https://github.com/kpob",key:"kpob"}],frontMatter:{slug:"odra-cosmwasm",title:"Odra + CosmWasm",authors:["kpob"],image:"https://github.com/odradev.png"},prevItem:{title:"OpenAI writes ERC20 in Odra",permalink:"/blog/2023-02-27-openai-writes-erc20-in-odra"},nextItem:{title:"EVM at Risc0",permalink:"/blog/evm-at-risc0"}},u={authorsImageUrls:[void 0]},i=[{value:"CosmWasm",id:"cosmwasm",level:2},{value:"Show me your code",id:"show-me-your-code",level:2},{value:"Deploy",id:"deploy",level:2},{value:"Show me your transaction",id:"show-me-your-transaction",level:2},{value:"Conclusion",id:"conclusion",level:2},{value:"Join us",id:"join-us",level:2}],c={toc:i};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"In November 2022 we released ",(0,r.kt)("a",{parentName:"p",href:"/blog/release-020"},"the first version")," of the Odra Framework. It's time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm."),(0,r.kt)("h2",{id:"cosmwasm"},"CosmWasm"),(0,r.kt)("p",null,"CosmWasm is a smart contract platform for building dApps on the Cosmos blockchain ecosystem.\nThe platform is designed as a module that can be integrated into the Cosmos SDK, enabling developers who are already building blockchains with the Cosmos SDK to easily incorporate CosmWasm smart contract functionality without the need to modify their existing code."),(0,r.kt)("p",null,"It uses the Rust programming language, so is potentially a perfect candidate for an Odra backend.\nThere are many blockchains like ",(0,r.kt)("a",{parentName:"p",href:"https://docsosmosis.zone/"},"Osmosis"),", ",(0,r.kt)("a",{parentName:"p",href:"https://scrt.network/"},"Secret Network"),", ",(0,r.kt)("a",{parentName:"p",href:"https://www.junonetwork.io/"},"Juno")," that utilize CosmWasm."),(0,r.kt)("h2",{id:"show-me-your-code"},"Show me your code"),(0,r.kt)("p",null,"I would like to write a ",(0,r.kt)("inlineCode",{parentName:"p"},"Counter")," smart contract that is CosmWasm compatible.\nWhat are the requirements?"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"It should store a ",(0,r.kt)("inlineCode",{parentName:"li"},"u32")," value. "),(0,r.kt)("li",{parentName:"ol"},"The initial value it set by the contract deployer."),(0,r.kt)("li",{parentName:"ol"},"The value can be incremented."),(0,r.kt)("li",{parentName:"ol"},"The value can read from the storage."),(0,r.kt)("li",{parentName:"ol"},"The contract can call another contract and increment its counter.")),(0,r.kt)("p",null,"So let's write an Odra module first."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=counter.rs",title:"counter.rs"},"use odra::{types::{Address, event::OdraEvent}, Variable, contract_env};\nuse self::events::{Init, ValueUpdated};\n\n#[odra::module]\npub struct Counter {\n pub value: Variable<u32>\n}\n\n#[odra::module]\nimpl Counter {\n #[odra(init)]\n pub fn init(&mut self, value: u32) {\n self.value.set(value);\n <Init as OdraEvent>::emit(Init {\n value,\n });\n }\n\n pub fn increment(&mut self) {\n let old_value = self.value.get_or_default();\n let new_value = old_value + 1;\n self.value.set(new_value);\n \n ValueUpdated {\n old_value,\n new_value,\n operator: contract_env::caller()\n }.emit();\n }\n\n pub fn cross_increment(&mut self, counter_address: Address) {\n CounterRef::at(counter_address).increment();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\nmod events {\n use odra::types::Address;\n\n #[derive(odra::Event)]\n pub struct ValueUpdated {\n pub old_value: u32,\n pub new_value: u32,\n pub operator: Address\n }\n \n #[derive(odra::Event)]\n pub struct Init {\n pub value: u32,\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn deploy() {\n let counter = CounterDeployer::init(10);\n assert_eq!(10, counter.get_value());\n }\n\n #[test]\n fn increment() {\n let mut counter = CounterDeployer::init(10);\n counter.increment();\n assert_eq!(11, counter.get_value());\n }\n}\n")),(0,r.kt)("p",null,"But wait, I mentioned CosmWasm, did I?"),(0,r.kt)("p",null,"Here the beauty of Odra comes into play."),(0,r.kt)("p",null,"Let's use ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo-odra"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b cosmos\n")),(0,r.kt)("p",null,"And... that's it, congratulations! We have just written and build our first CosmWasm contract.\nAs you see, it is nothing different from building a contract for Casper. No additional code, we only changed the ",(0,r.kt)("inlineCode",{parentName:"p"},"-b")," flag."),(0,r.kt)("h2",{id:"deploy"},"Deploy"),(0,r.kt)("p",null,"We have just built a wasm file, but is it really a fully functional contract?"),(0,r.kt)("p",null,"As a battlefield let's choose ",(0,r.kt)("a",{parentName:"p",href:"https://www.junonetwork.io/"},"Juno Network")," (if you would like to read more about smart contract development on Juno read this ",(0,r.kt)("a",{parentName:"p",href:"https://medium.com/@NitroBiell/smart-contract-development-quick-start-on-juno-5dabf6fdcad0"},"Quick Start tutorial"),"). This is an arbitrary choice, each client is built upon a so-called Wasm Zone ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/CosmWasm/wasmd"},"wasmd"),", and its interface is alike."),(0,r.kt)("p",null,"Assuming you already know how to interact with Juno testnet, let's move to the fun part."),(0,r.kt)("p",null,"But before we go, to keep things simple, let's prepare a ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casey/just"},"justfile"),". It'll make our interactions with the blockchain much easier. See ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/feature/cosmos/odra-cosmos/juno-client/justfile"},"full version"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-justfile",metastring:"title=justfile",title:"justfile"},'NODE := "--node https://rpc.uni.juno.deuslabs.fi:443"\nCHAIN_ID := "--chain-id uni-6"\nQUERY_FLAGS := NODE + " " + CHAIN_ID\nTRANSACTION_DEFAULTS := "--gas-prices 0.025ujunox --gas auto --gas-adjustment 1.3 --broadcast-mode block"\nEXEC_FLAGS := NODE + " " + CHAIN_ID + " " + TRANSACTION_DEFAULTS\n\nget-address NAME:\n junod keys show {{NAME}} | grep -o juno.*\n\nstore-wasm WASM_PATH SENDER:\n junod tx wasm store \\\n {{WASM_PATH}} --from {{SENDER}} {{EXEC_FLAGS}}\n\ninit-contract CODE_ID VALUE SENDER CONTRACT_NAME:\n junod tx wasm instantiate \\\n {{CODE_ID}} \\\n `just run-args-parser \'{"name": "init", "args": [ { "value" : {{VALUE}} }]}\'` \\\n --label \'{{CONTRACT_NAME}}\' --from {{SENDER}} \\\n --admin `just get-address {{SENDER}}` \\\n {{EXEC_FLAGS}}\n\nexec-increment ADDRESS SENDER:\n junod tx wasm execute \\\n {{ADDRESS}} \\\n `just run-args-parser \'{"name": "increment"}\'` \\\n --from {{SENDER}} \\\n {{EXEC_FLAGS}}\n\nquery-get-value ADDRESS:\n junod q wasm contract-state smart {{ADDRESS}} \\\n `just run-args-parser \'{"name": "get_value"}\'` {{QUERY_FLAGS}}\n')),(0,r.kt)("p",null,"Ok, we are ready to go."),(0,r.kt)("p",null,"First, a CosmWasm contract needs to be stored, technically is not a contract yet. Like a larva waiting to morph into a butterfly (sorry for that)."),(0,r.kt)("p",null,"There are three ways to interact with a contract."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Instantiate - in other words, a constructor call. Once the contract is instantiated, it gets an address."),(0,r.kt)("li",{parentName:"ol"},"Execute - call an entrypoint that modifies the state."),(0,r.kt)("li",{parentName:"ol"},"Query - read the contract's state.")),(0,r.kt)("p",null,"Now, let's take a look at how to do it using the tools we have just prepared."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# args: \n# the path to a wasm file,\n# the name under we store the private key.\njust store-wasm counter.wasm odra\n\n...\nraw_log: \'[{"events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgStoreCode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"}]}]}]\'\n...\ntxhash: 1A8BA520E980C5ABCBCFA6F62D68B6BB82E780544605DE4DD5C6B1C5E966441B\n')),(0,r.kt)("p",null,"Great, our code is successfully stored. Form the logs we can read now the ",(0,r.kt)("inlineCode",{parentName:"p"},"code_id")," which we will use to initialize the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# args: \n# code id taken from the previous tx, \n# counter initial value, \n# named private key,\n# contract label.\njust init-contract 286 1 odra "My Counter"\n\n...\nraw_log: \'[{"events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgInstantiateContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm-Init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]}]}]\'\n...\ntxhash: 8DC53F95805349C3763CF4AF9527CAB2AEBEC77B240EFD3801C61231D8748F26\n')),(0,r.kt)("p",null,"Fantastic, the contract has been initialized and we have its address - ",(0,r.kt)("inlineCode",{parentName:"p"},"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"),".\nIt's time to increment the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# args:\n# contract address taken from the previous tx,\n# named private key\njust exec-increment juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g odra\n\n...\nraw_log: \'[{"events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm-ValueUpdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]}]}]\'\n...\ntxhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2\n')),(0,r.kt)("p",null,"Finally, we expected, the value to be equal to 2 (the initial value was 1 and we incremented it once)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# args:\n# contract address\njust query-get-value juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\n\ndata: 2\n")),(0,r.kt)("p",null,"Indeed, as expected the current counter value is 2."),(0,r.kt)("h2",{id:"show-me-your-transaction"},"Show me your transaction"),(0,r.kt)("p",null,"I get it, you don't want to do it all by yourself. So let's take a closer look at one of my transactions."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'junod q tx 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 --node https://rpc.uni.juno.deuslabs.fi:443 --chain-id uni-6\n...\nlogs:\n- events:\n - attributes:\n - key: _contract_address\n value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\n type: execute\n - attributes:\n - key: action\n value: /cosmwasm.wasm.v1.MsgExecuteContract\n - key: module\n value: wasm\n - key: sender\n value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\n type: message\n - attributes:\n - key: _contract_address\n value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\n - key: action\n value: increment\n type: wasm\n - attributes:\n - key: _contract_address\n value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g\n - key: old_value\n value: "1"\n - key: new_value\n value: "2"\n - key: operator\n value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh\n type: wasm-ValueUpdated\n...\ntxhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2\n')),(0,r.kt)("p",null,"If you are familiar Cosmos ecosystem, you can see that there is an attribute containing\nthe performed action (",(0,r.kt)("inlineCode",{parentName:"p"},"increment"),") (If there were some parameters, they would be included in this attribute).\nWe can find here also our ",(0,r.kt)("inlineCode",{parentName:"p"},"ValueUpdated")," event with its arguments ",(0,r.kt)("inlineCode",{parentName:"p"},"old_value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"new_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"operator"),"."),(0,r.kt)("p",null,"Wow, we have it, everything worked as intended!"),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Wouldn't it be great to replace ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casper-ecosystem/erc20/tree/master/erc20/src"},"Casper Erc20")," and ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/CosmWasm/cw-plus/tree/main/contracts/cw20-base/src"},"Cosmos Erc20")," with a super-simple\nsingle ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.2.0/examples/src/erc20.rs"},"Odra Erc20")," implementation?"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Counter")," contract is just a POC, and there is still a long road ahead of us.\nThis simple example shows that features like storage, events, and cross-contract calls\ncan be unified in a simple readable interface."),(0,r.kt)("p",null,"CosmWasm integration hasn't been published yet, but if you want to experiment by yourself,\ncheck our GitHub (don't forget to update cargo-odra as well)."),(0,r.kt)("h2",{id:"join-us"},"Join us"),(0,r.kt)("p",null,"Interested?"),(0,r.kt)("p",null,"Join ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/Mm5ABc9P8k"},"our Discord"),", ",(0,r.kt)("a",{parentName:"p",href:"https://twitter.com/odradev"},"our Twitter")," or write us\nat ",(0,r.kt)("a",{parentName:"p",href:"mailto:contact@odra.dev"},"contact@odra.dev"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d25c8023.10b4b74e.js b/docs/assets/js/d25c8023.10b4b74e.js new file mode 100644 index 000000000..a27ab6130 --- /dev/null +++ b/docs/assets/js/d25c8023.10b4b74e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90437],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||c[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u<a;u++)s[u]=n[u];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},9438:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:11,description:"Divide your code into modules"},s="Modules",i={unversionedId:"basics/modules",id:"version-0.8.0/basics/modules",title:"Modules",description:"Divide your code into modules",source:"@site/versioned_docs/version-0.8.0/basics/11-modules.md",sourceDirName:"basics",slug:"/basics/modules",permalink:"/docs/0.8.0/basics/modules",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1711379330,formattedLastUpdatedAt:"Mar 25, 2024",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Divide your code into modules"},sidebar:"tutorialSidebar",previous:{title:"Cross calls",permalink:"/docs/0.8.0/basics/cross-calls"},next:{title:"Native token",permalink:"/docs/0.8.0/basics/native-token"}},l={},u=[{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"modules"},"Modules"),(0,o.kt)("p",null,"Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you\nwrite is also a module, thanks to the ",(0,o.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),' attribute. This means that we can easily rewrite our math\nexample from the previous article, to use a single contract, but still separate our "math" code:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"use crate::features::cross_calls::MathEngine;\nuse odra::module::SubModule;\nuse odra::prelude::*;\n\n#[odra::module]\npub struct ModulesContract {\n pub math_engine: SubModule<MathEngine>\n}\n\n#[odra::module]\nimpl ModulesContract {\n pub fn add_using_module(&self) -> u32 {\n self.math_engine.add(3, 5)\n }\n}\n")),(0,o.kt)("admonition",{type:"important"},(0,o.kt)("p",{parentName:"admonition"},"To use a module as a component of another module, you need to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"SubModule")," type. This is a special type\nthat crates a keyspace (read more in ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.0/advanced/storage-layout"},"Storage Layout"),") and provide access to its public methods.")),(0,o.kt)("p",null,"Note that we didn't need to rewrite the ",(0,o.kt)("inlineCode",{parentName:"p"},"MathEngine")," - we are using the contract from cross calls example as\na module!"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"To see how modules can be used in a real-world scenario, check out the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/examples/src/contracts/owned_token.rs"},"OwnedToken example")," in the main Odra repository!")),(0,o.kt)("h2",{id:"testing"},"Testing"),(0,o.kt)("p",null,"As we don't need to hold addresses, the test is really simple:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/modules.rs"',title:'"examples/src/features/modules.rs"'},"#[cfg(test)]\nmod tests {\n use super::ModulesContractHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);\n assert_eq!(modules_contract.add_using_module(), 8);\n }\n}\n")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"We will see how to handle native token transfers."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d2eb1abd.e7ba6d8f.js b/docs/assets/js/d2eb1abd.e7ba6d8f.js new file mode 100644 index 000000000..73b9dd658 --- /dev/null +++ b/docs/assets/js/d2eb1abd.e7ba6d8f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99661],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||p[f]||o;return n?r.createElement(m,l(l({ref:t},u),{},{components:n})):r.createElement(m,l({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c<o;c++)l[c]=n[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},5584:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-0.9.0/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that",source:"@site/versioned_docs/version-0.9.0/advanced/03-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.9.0/advanced/attributes",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.9.0/advanced/advanced-storage"},next:{title:"Storage Layout",permalink:"/docs/0.9.0/advanced/storage-layout"}},s={},c=[{value:"Payable",id:"payable",level:2},{value:"Example",id:"example",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Example",id:"example-1",level:3},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"attributes"},"Attributes"),(0,a.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that\nallows developers to embed common checks into function definitions in a readable and reusable manner.\nThese are essentially prerequisites for function execution."),(0,a.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,a.kt)("h2",{id:"payable"},"Payable"),(0,a.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,a.kt)("h3",{id:"example"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U256 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env.revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env()\n .emit_event(Deposit {\n address: caller,\n amount\n });\n}\n")),(0,a.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,a.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,a.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,a.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,a.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,a.kt)("p",null,"In Odra you can just apply the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,a.kt)("h3",{id:"example-1"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct NonReentrantCounter {\n counter: Var<u32>\n}\n\n#[odra::module]\nimpl NonReentrantCounter {\n #[odra(non_reentrant)]\n pub fn count_ref_recursive(&mut self, n: u32) {\n if n > 0 {\n self.count();\n ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);\n }\n }\n}\n\nimpl NonReentrantCounter {\n fn count(&mut self) {\n let c = self.counter.get_or_default();\n self.counter.set(c + 1);\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::{host::{Deployer, NoArgs}, ExecutionError};\n\n #[test]\n fn ref_recursion_not_allowed() {\n let test_env = odra_test::env();\n let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);\n\n let result = contract.count_ref_recursive(11);\n assert_eq!(result, ExecutionError::ReentrantCall.into());\n }\n}\n")),(0,a.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,a.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"or "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"In both cases attributes order does not matter."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d32d6987.346ba851.js b/docs/assets/js/d32d6987.346ba851.js new file mode 100644 index 000000000..ccdcadbc5 --- /dev/null +++ b/docs/assets/js/d32d6987.346ba851.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[95684],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),f=a,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||o;return n?r.createElement(m,s(s({ref:t},d),{},{components:n})):r.createElement(m,s({ref:t},d))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},3023:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:13,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-1.0.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-1.0.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/basics/native-token",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:13,frontMatter:{sidebar_position:13,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/basics/modules"},next:{title:"Advanced",permalink:"/docs/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"native-token"},"Native token"),(0,a.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::prelude::*;\nuse odra::{casper_types::U512, module::Module};\n\n#[odra::module]\npub struct PublicWallet;\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {}\n\n pub fn withdraw(&mut self, amount: &U512) {\n self.env().transfer_tokens(&self.env().caller(), amount);\n }\n}\n")),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,a.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,a.kt)("inlineCode",{parentName:"p"},"examples/src/contracts/tlw.rs")," in the odra main repository.")),(0,a.kt)("p",null,"You can see a new attribute used here: ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv::transfer_tokens()"),".\nIt does exactly what you are expecting it to do - it transfers native tokens from the contract to the\nspecified address."),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a function -\n",(0,a.kt)("inlineCode",{parentName:"p"},"balance_of"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"#[cfg(test)]\nmod tests {\n use super::PublicWalletHostRef;\n use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);\n assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());\n\n my_contract.with_tokens(U512::from(100)).deposit();\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));\n\n my_contract.withdraw(U512::from(25));\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d386dd06.401d8ccf.js b/docs/assets/js/d386dd06.401d8ccf.js new file mode 100644 index 000000000..30d285ce4 --- /dev/null +++ b/docs/assets/js/d386dd06.401d8ccf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[65067],{75444:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.6.0/category/backends","navigation":{"previous":{"title":"Signatures","permalink":"/docs/0.6.0/advanced/signatures"},"next":{"title":"What is a backend?","permalink":"/docs/0.6.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/d5e3179c.18951c94.js b/docs/assets/js/d5e3179c.18951c94.js new file mode 100644 index 000000000..dc78f252b --- /dev/null +++ b/docs/assets/js/d5e3179c.18951c94.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[38089],{3905:(e,r,n)=>{n.d(r,{Zo:()=>c,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){a(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function i(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},c=function(e){var r=p(e.components);return t.createElement(l.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?t.createElement(f,s(s({ref:r},c),{},{components:n})):t.createElement(f,s({ref:r},c))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var p=2;p<o;p++)s[p]=n[p];return t.createElement.apply(null,s)}return t.createElement.apply(null,n)}d.displayName="MDXCreateElement"},41453:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/docs/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/next/basics/errors",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/next/basics/testing"},next:{title:"Events",permalink:"/docs/next/basics/events"}},l={},p=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},c,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(errors = Error)]\npub struct OwnedContract {\n name: Var<String>,\n owner: Var<Address>\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerNotSet = 1,\n NotAnOwner = 2\n}\n\n#[odra::module]\nimpl OwnedContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = self.env().caller();\n if caller != self.owner() {\n self.env().revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,a.kt)("p",null,"Firstly, we are using the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.env().revert(Error::NotAnOwner)\n")),(0,a.kt)("p",null,"To register errors, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"errors")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute and pass the error type as the value. The registered errors will be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"Defining an error in Odra, you must keep in mind a few rules:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"An error should be a field-less enum. "),(0,a.kt)("li",{parentName:"ol"},"The enum must be annotated with ",(0,a.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]"),"."),(0,a.kt)("li",{parentName:"ol"},"Avoid implicit discriminants.")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'#[cfg(test)]\nmod tests {\n use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn test_owner_error() {\n let test_env = odra_test::env();\n let owner = test_env.get_account(0);\n let not_an_owner = test_env.get_account(1);\n\n test_env.set_caller(owner);\n let init_args = OwnedContractInitArgs {\n name: "OwnedContract".to_string()\n };\n let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);\n\n test_env.set_caller(not_an_owner);\n assert_eq!(\n owned_contract.try_change_name("NewName".to_string()),\n Err(Error::NotAnOwner.into())\n );\n }\n}\n')),(0,a.kt)("p",null,"Each ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," has ",(0,a.kt)("inlineCode",{parentName:"p"},"try_{{entry_point_name}}")," functions that return an ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult")),".\n",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractHostRef")," implements regular entrypoints: ",(0,a.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),", and\nand safe its safe version: ",(0,a.kt)("inlineCode",{parentName:"p"},"try_name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name"),"."),(0,a.kt)("p",null,"In our example, we are calling ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name")," and expecting an error to be thrown.\nFor assertions, we are using a standard ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro. As the contract call returns an ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError"),",\nwe need to convert our custom error to ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," using ",(0,a.kt)("inlineCode",{parentName:"p"},"Into::into()"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d691a609.591d9f0c.js b/docs/assets/js/d691a609.591d9f0c.js new file mode 100644 index 000000000..e9edcd92b --- /dev/null +++ b/docs/assets/js/d691a609.591d9f0c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[33468],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),c=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=u;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var c=2;c<s;c++)o[c]=n[c];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},89562:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:10,description:"Contracts calling contracts"},o="Cross calls",l={unversionedId:"basics/cross-calls",id:"version-0.3.0/basics/cross-calls",title:"Cross calls",description:"Contracts calling contracts",source:"@site/versioned_docs/version-0.3.0/basics/10-cross-calls.md",sourceDirName:"basics",slug:"/basics/cross-calls",permalink:"/docs/0.3.0/basics/cross-calls",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Contracts calling contracts"},sidebar:"defaultSidebar",previous:{title:"Events",permalink:"/docs/0.3.0/basics/events"},next:{title:"Modules",permalink:"/docs/0.3.0/basics/modules"}},i={},c=[{value:"Contract Ref",id:"contract-ref",level:2},{value:"Testing",id:"testing",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-calls"},"Cross calls"),(0,r.kt)("p",null,"To show how to handle calls between contracts, first, let's implement two of them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use odra::Variable;\nuse odra::types::{Address};\n\n#[odra::module]\npub struct CrossContract {\n pub math_engine: Variable<Address>,\n}\n\n#[odra::module]\nimpl CrossContract {\n #[odra(init)]\n pub fn init(&mut self, math_engine_address: Address) {\n self.math_engine.set(math_engine_address);\n }\n\n pub fn add_using_another(&self) -> u32 {\n let math_engine_address = self.math_engine.get().unwrap();\n MathEngineRef::at(math_engine_address).add(3, 5)\n }\n}\n\n#[odra::module]\npub struct MathEngine {\n}\n\n#[odra::module]\nimpl MathEngine {\n pub fn add(&self, n1: u32, n2: u32) -> u32 {\n n1 + n2\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract can add two numbers. ",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," takes an ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," in its init function and saves it in\nstorage for later use. If we deploy the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," first and take note of its address, we can then deploy\n",(0,r.kt)("inlineCode",{parentName:"p"},"CrossContract")," and use ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," to perform complicated calculations for us!"),(0,r.kt)("p",null,"To call the external contract, we use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," that was created for us by Odra:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"MathEngineRef::at(math_engine_address).add(3, 5)\n")),(0,r.kt)("h2",{id:"contract-ref"},"Contract Ref"),(0,r.kt)("p",null,"We mentioned ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," already in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.3.0/basics/testing"},"Testing")," article.\nIt is a reference to already deployed - running contract.\nHere we are going to take a deeper look at it."),(0,r.kt)("p",null,"Similarly to a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ref")," is generated automatically, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro.\nTo get an instance of a reference, we can either deploy a contract (using ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployer"),") or by building it\ndirectly, using ",(0,r.kt)("inlineCode",{parentName:"p"},"::at(address: Address)")," method, as shown above.\nThe reference implements all the public endpoints to the contract (those marked as ",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),"\nimpl), alongside couple methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"at(Address) -> Self")," - points the reference to an Address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"address() -> Address")," - returns the Address the reference is currently pointing at"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"with_tokens(Amount) -> Self")," - attaches Amount of native tokens to the next call")),(0,r.kt)("h1",{id:"external-contracts"},"External Contracts"),(0,r.kt)("p",null,"Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI."),(0,r.kt)("p",null,"For that purpose, we use ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra:external_contract]")," macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of."),(0,r.kt)("p",null,"Let's pretend the ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," we defined is an external contract. There is a contract with ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function that adds two numbers somewhere."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[odra::external_contract]\npub trait Adder {\n fn add(&self, n1: u32, n2: u32) -> u32;\n}\n")),(0,r.kt)("p",null,"Analogously to modules, Odra creates the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderRef")," struct (but do not create the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdderDeployer"),"). Having an address we can call:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"AdderRef::at(address).add(3, 5)\n")),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Let's see how we can test our cross calls using this knowledge:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"use super::{CrossContractDeployer, MathEngineDeployer};\n\n#[test]\nfn test_cross_calls() {\n let math_engine_contract = MathEngineDeployer::default();\n let cross_contract = CrossContractDeployer::init(math_engine_contract.address());\n\n assert_eq!(cross_contract.add_using_another(), 8);\n}\n")),(0,r.kt)("p",null,"Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a ",(0,r.kt)("inlineCode",{parentName:"p"},"MathEngine")," contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the ",(0,r.kt)("inlineCode",{parentName:"p"},"add()")," function we want to use."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/cross_calls.rs"',title:'"examples/src/docs/cross_calls.rs"'},"#[cfg(test)]\nmod tests {\n use odra::types::Address;\n use crate::docs::cross_calls::{Adder, AdderRef};\n \n #[test]\n fn test_ext() {\n let adder = AdderRef::at(get_adder_address());\n\n assert_eq!(adder.add(1, 2), 3);\n }\n\n fn get_adder_address() -> Address {\n let contract = MathEngineDeployer::default();\n contract.address()\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d7637d81.b88db64f.js b/docs/assets/js/d7637d81.b88db64f.js new file mode 100644 index 000000000..863e38e6e --- /dev/null +++ b/docs/assets/js/d7637d81.b88db64f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[14062],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>c});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=d(t),c=a,f=m["".concat(i,".").concat(c)]||m[c]||u[c]||o;return t?r.createElement(f,s(s({ref:n},p),{},{components:t})):r.createElement(f,s({ref:n},p))}));function c(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=m;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var d=2;d<o;d++)s[d]=t[d];return r.createElement.apply(null,s)}return r.createElement.apply(null,t)}m.displayName="MDXCreateElement"},40808:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const o={sidebar_position:2},s="Using odra-modules",l={unversionedId:"examples/using-odra-modules",id:"version-0.2.0/examples/using-odra-modules",title:"Using odra-modules",description:"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.",source:"@site/versioned_docs/version-0.2.0/examples/using-odra-modules.md",sourceDirName:"examples",slug:"/examples/using-odra-modules",permalink:"/docs/0.2.0/examples/using-odra-modules",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"odra-examples",permalink:"/docs/0.2.0/examples/odra-examples"},next:{title:"Tutorials",permalink:"/docs/0.2.0/category/tutorials"}},i={},d=[],p={toc:d};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"using-odra-modules"},"Using odra-modules"),(0,a.kt)("p",null,"Besides the Odra framework, you can attach to your project ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-module")," - a set of plug-and-play modules."),(0,a.kt)("p",null,"If you followed the ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.2.0/getting-started/installation"},"Installation guide")," your Cargo.toml should look like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.2.0", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"To use ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),", edit your ",(0,a.kt)("inlineCode",{parentName:"p"},"dependency")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"features")," sections."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml",metastring:"title=Cargo.toml",title:"Cargo.toml"},'[dependencies]\nodra = { path = "../core", default-features = false }\nodra-modules = { path = "../modules", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]\ncasper = ["odra/casper", "odra-modules/casper"]\n')),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules")," defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a ",(0,a.kt)("inlineCode",{parentName:"p"},"casper")," feature in your project, add ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules/casper"),"specifically (it applies to each backend).")),(0,a.kt)("p",null,"Now, the only thing left is to add a module to your contract."),(0,a.kt)("p",null,"Let's write an example of ",(0,a.kt)("inlineCode",{parentName:"p"},"MyToken")," based on ",(0,a.kt)("inlineCode",{parentName:"p"},"Erc20")," module."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::types::{Address, U256};\nuse odra_modules::erc20::Erc20;\n\n#[odra::module]\npub struct MyToken {\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, initial_supply: U256) {\n let name = String::from("MyToken");\n let symbol = String::from("MT");\n let decimals = 9u8;\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: Address, spender: Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: Address, amount: U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: Address, amount: U256) {\n self.erc20.approve(spender, amount);\n }\n}\n')),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"All available modules are placed in the main Odra repository.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d7dfd89f.40965436.js b/docs/assets/js/d7dfd89f.40965436.js new file mode 100644 index 000000000..0bbc549b1 --- /dev/null +++ b/docs/assets/js/d7dfd89f.40965436.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[1655],{87197:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.9.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.9.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.9.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/d8ed494b.5f78aa6c.js b/docs/assets/js/d8ed494b.5f78aa6c.js new file mode 100644 index 000000000..32fa0c01a --- /dev/null +++ b/docs/assets/js/d8ed494b.5f78aa6c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[17342],{3905:(t,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function s(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t,e){if(null==t)return{};var n,a,r=function(t,e){if(null==t)return{};var n,a,r={},o=Object.keys(t);for(a=0;a<o.length;a++)n=o[a],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)n=o[a],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var l=a.createContext({}),c=function(t){var e=a.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},d=function(t){var e=c(t.components);return a.createElement(l.Provider,{value:e},t.children)},p={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,l=t.parentName,d=i(t,["components","mdxType","originalType","parentName"]),u=c(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(h,s(s({ref:e},d),{},{components:n})):a.createElement(h,s({ref:e},d))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in e)hasOwnProperty.call(e,l)&&(i[l]=e[l]);i.originalType=t,i.mdxType="string"==typeof t?t:r,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},74844:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7,description:"How to write tests in Odra"},s="Testing",i={unversionedId:"basics/testing",id:"version-0.8.0/basics/testing",title:"Testing",description:"How to write tests in Odra",source:"@site/versioned_docs/version-0.8.0/basics/07-testing.md",sourceDirName:"basics",slug:"/basics/testing",permalink:"/docs/0.8.0/basics/testing",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1711379330,formattedLastUpdatedAt:"Mar 25, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7,description:"How to write tests in Odra"},sidebar:"tutorialSidebar",previous:{title:"Host Communication",permalink:"/docs/0.8.0/basics/communicating-with-host"},next:{title:"Errors",permalink:"/docs/0.8.0/basics/errors"}},l={},c=[{value:"HostEnv",id:"hostenv",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:c};function p(t){let{components:e,...n}=t;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write\nregular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the\nprevious article:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},'use odra::{List, Var};\n\n#[cfg(test)]\nmod tests {\n use super::{DogContract3HostRef, DogContract3InitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn init_test() {\n let test_env = odra_test::env();\n let init_args = DogContract3InitArgs {\n name: "DogContract".to_string()\n };\n let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n assert_eq!(dog_contract.walks_amount(), 0);\n assert_eq!(dog_contract.walks_total_length(), 0);\n dog_contract.walk_the_dog(5);\n dog_contract.walk_the_dog(10);\n assert_eq!(dog_contract.walks_amount(), 2);\n assert_eq!(dog_contract.walks_total_length(), 15);\n }\n}\n')),(0,r.kt)("p",null,"The first interesting thing you may notice is placed the import section."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use super::{DogContract3HostRef, DogContract3InitArgs};\nuse odra::{host::Deployer, prelude::*};\n")),(0,r.kt)("p",null,"We are using ",(0,r.kt)("inlineCode",{parentName:"p"},"super")," to import the ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," from the parent module.\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}InitArgs")," are types that was generated for us by Odra."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3HostRef")," is a reference to the contract that we can use to interact with it (call entrypoints)\nand implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/trait.HostRef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostRef"))," trait. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"DogContract3InitArgs")," is a struct that we use to initialize the contract and implements ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/trait.InitArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait.\nConsidering the contract initialization, there three possible scenarios:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with arguments, then Odra creates a struct named ",(0,r.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract has a constructor with no arguments, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),"."),(0,r.kt)("li",{parentName:"ol"},"The contract does not have a constructor, then you can use ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs"),".\nAll of those structs implement the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::InitArgs")," trait, required to conform to the\n",(0,r.kt)("inlineCode",{parentName:"li"},"Deployer::deploy")," method signature. ")),(0,r.kt)("p",null,"The other import is ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::host::Deployer"),". This is a trait is used to deploy the contract and give us a reference to it."),(0,r.kt)("p",null,"Let's take a look at the test itself. How to obtain a reference to the contract?\n",(0,r.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," implements the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/trait.Deployer.html"},(0,r.kt)("inlineCode",{parentName:"a"},"Deployer"))," trait, which provides the ",(0,r.kt)("inlineCode",{parentName:"p"},"deploy")," method:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);\n")),(0,r.kt)("p",null,"From now on, we can use ",(0,r.kt)("inlineCode",{parentName:"p"},"dog_contract")," to interact with our deployed contract - in particular, all\n",(0,r.kt)("inlineCode",{parentName:"p"},"pub")," functions from the impl section that was annotated with the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::module")," attribute are available to us:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/list.rs"',title:'"examples/src/features/storage/list.rs"'},"// Impl\npub fn walk_the_dog(&mut self, length: u32) {\n self.walks.push(length);\n}\n\n...\n\n// Test\ndog_contract.walk_the_dog(5);\n")),(0,r.kt)("h2",{id:"hostenv"},"HostEnv"),(0,r.kt)("p",null,"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context)\nand to configure how the contracts are deployed and called. Let's revisit the example from the previous\narticle about host communication and implement the tests that prove it works:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/testing.rs"',title:'"examples/src/features/testing.rs"'},'#[cfg(test)]\nmod tests {\n use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};\n use odra::{host::{Deployer, HostEnv}, prelude::*};\n\n #[test]\n fn env() {\n let test_env: HostEnv = odra_test::env();\n test_env.set_caller(test_env.get_account(0));\n let init_args = TestingContractInitArgs {\n name: "MyContract".to_string()\n };\n let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);\n let creator = testing_contract.created_by();\n test_env.set_caller(test_env.get_account(1));\n let init_args = TestingContractInitArgs {\n name: "MyContract2".to_string()\n };\n let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);\n let creator2 = testing_contract2.created_by();\n assert_ne!(creator, creator2);\n }\n}\n')),(0,r.kt)("p",null,"In the code above, at the beginning of the test, we are obtaining a ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," instance using ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_test::env()"),".\nNext, we are deploying two instances of the same contract, but we're using ",(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv::set_caller"),"\nto change the caller - so the Address which is deploying the contract. This changes the result of the ",(0,r.kt)("inlineCode",{parentName:"p"},"odra::ContractEnv::caller()"),"\nthe function we are calling inside the contract."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a set of functions that will let you write better tests:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn set_caller(&self, address: Address)")," - you've seen it in action just now"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn balance_of(&self, address: &Address) -> U512")," - returns the balance of the account associated with the given address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn advance_block_time(&self, time_diff: u64)")," - increases the current value of ",(0,r.kt)("inlineCode",{parentName:"li"},"block_time")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn get_account(&self, n: usize) -> Address")," - returns an n-th address that was prepared for you by Odra in advance;\nby default, you start with the 0-th account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool")," - verifies if the event was emitted by the contract")),(0,r.kt)("p",null,"Full list of functions can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,r.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We take a look at how Odra handles errors!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d90ea429.4ebb6567.js b/docs/assets/js/d90ea429.4ebb6567.js new file mode 100644 index 000000000..e313c5cb6 --- /dev/null +++ b/docs/assets/js/d90ea429.4ebb6567.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[48435],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),d=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||o;return t?r.createElement(f,s(s({ref:n},u),{},{components:t})):r.createElement(f,s({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var d=2;d<o;d++)s[d]=t[d];return r.createElement.apply(null,s)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},85162:(e,n,t)=>{t.d(n,{Z:()=>s});var r=t(67294),a=t(86010);const o="tabItem_Ymn6";function s(e){let{children:n,hidden:t,className:s}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(o,s),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>y});var r=t(87462),a=t(67294),o=t(86010),s=t(12466),l=t(16550),i=t(91980),d=t(67392),u=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(o),(0,a.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function v(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=c(e),[s,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[i,d]=f({queryString:t,groupId:r}),[p,v]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,u.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:o})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:s,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),v(e)}),[d,v,o]),tabValues:o}}var g=t(72389);const h="tabList__CuJ",k="tabItem_LNqP";function b(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:d}=e;const u=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),c=e=>{const n=e.currentTarget,t=u.indexOf(n),r=d[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;n=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;n=u[t]??u[u.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},n)},d.map((e=>{let{value:n,label:t,attributes:s}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>u.push(e),onKeyDown:m,onClick:c},s,{className:(0,o.Z)("tabs__item",k,s?.className,{"tabs__item--active":l===n})}),t??n)})))}function _(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function N(e){const n=v(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",h)},a.createElement(b,(0,r.Z)({},e,n)),a.createElement(_,(0,r.Z)({},e,n)))}function y(e){const n=(0,g.Z)();return a.createElement(N,(0,r.Z)({key:String(n)},e))}},29230:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),o=t(74866),s=t(85162);const l={sidebar_position:1,description:"Migration guide to v0.8.0"},i="Migration guide to v0.8.0",d={unversionedId:"migrations/to-0.8.0",id:"version-0.9.1/migrations/to-0.8.0",title:"Migration guide to v0.8.0",description:"Migration guide to v0.8.0",source:"@site/versioned_docs/version-0.9.1/migrations/to-0.8.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.8.0",permalink:"/docs/0.9.1/migrations/to-0.8.0",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Migration guide to v0.8.0"},sidebar:"tutorialSidebar",previous:{title:"Migrations",permalink:"/docs/0.9.1/category/migrations"},next:{title:"Migration guide to v0.9.0",permalink:"/docs/0.9.1/migrations/to-0.9.0"}},u={},p=[{value:"<strong>1. Prerequisites</strong>",id:"1-prerequisites",level:2},{value:"1.1. <strong>Update cargo-odra</strong>",id:"11-update-cargo-odra",level:3},{value:"1.2. <strong>Review the Changelog</strong>",id:"12-review-the-changelog",level:3},{value:"<strong>2. Migration Steps</strong>",id:"2-migration-steps",level:2},{value:"2.1 <strong>Add bin directory</strong>",id:"21-add-bin-directory",level:3},{value:"2.2. <strong>Update Cargo.toml</strong>",id:"22-update-cargotoml",level:3},{value:"2.2. <strong>Update Odra.toml</strong>",id:"22-update-odratoml",level:3},{value:"2.3. <strong>Update Smart Contracts</strong>",id:"23-update-smart-contracts",level:3},{value:"2.3.1. <strong>Update the <code>use</code> statements to reflect the new module structure.</strong>",id:"231-update-the-use-statements-to-reflect-the-new-module-structure",level:4},{value:"2.3.2. <strong>Some type aliases are no longer in use.</strong>",id:"232-some-type-aliases-are-no-longer-in-use",level:4},{value:"2.3.3. <strong>Consider import <code>odra::prelude::*</code> in your module files.</strong>",id:"233-consider-import-odraprelude-in-your-module-files",level:4},{value:"2.3.4. <strong>Flatten nested <code>Mapping</code>s.</strong>",id:"234-flatten-nested-mappings",level:4},{value:"2.3.5. <strong>Update errors definitions.</strong>",id:"235-update-errors-definitions",level:4},{value:"2.3.6. <strong>Update events definitions.</strong>",id:"236-update-events-definitions",level:4},{value:"2.3.7. <strong>Replace <code>contract_env</code> with <code>self.env()</code> in your modules.</strong>",id:"237-replace-contract_env-with-selfenv-in-your-modules",level:4},{value:"2.3.8. <strong>Wrap submodules of your module with <code>odra::SubModule<T></code>.</strong>",id:"238-wrap-submodules-of-your-module-with-odrasubmodulet",level:4},{value:"2.3.9. <strong>Update external contract calls.</strong>",id:"239-update-external-contract-calls",level:4},{value:"2.3.10. <strong>Update constructors.</strong>",id:"2310-update-constructors",level:4},{value:"2.3.11. <strong>Update <code>UnwrapOrRevert</code> calls.</strong>",id:"2311-update-unwraporrevert-calls",level:4},{value:"2.3.12. <strong>Remove <code>#[odra(using)]</code> attribute from your module definition.</strong>",id:"2312-remove-odrausing-attribute-from-your-module-definition",level:4},{value:"2.4. <strong>Update Tests</strong>",id:"24-update-tests",level:3},{value:"2.4.1. <strong>Contract deployment.</strong>",id:"241-contract-deployment",level:4},{value:"2.4.2. <strong>Host interactions.</strong>",id:"242-host-interactions",level:4},{value:"2.4.3. <strong>Testing failing scenarios.</strong>",id:"243-testing-failing-scenarios",level:4},{value:"2.4.4. <strong>Testing events.</strong>",id:"244-testing-events",level:4},{value:"3. <strong>Code Examples</strong>",id:"3-code-examples",level:2},{value:"4. <strong>Troubleshooting</strong>",id:"4-troubleshooting",level:2},{value:"5. <strong>References</strong>",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v080"},"Migration guide to v0.8.0"),(0,a.kt)("p",null,"Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version."),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant changes in v0.8.0 include:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only."),(0,a.kt)("li",{parentName:"ul"},"Framework internals redesign.")),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.8.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-add-bin-directory"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Add bin directory")),(0,a.kt)("p",null,"Odra 0.8.0 introduces a new way to build smart contracts. The ",(0,a.kt)("inlineCode",{parentName:"p"},".builder_casper")," directory is no longer used. Instead, you should create a new directory called ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," in the root of your project and add the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files to the ",(0,a.kt)("inlineCode",{parentName:"p"},"bin")," directory."),(0,a.kt)("p",null,"You can find the ",(0,a.kt)("inlineCode",{parentName:"p"},"build_contract.rs")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," files in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.8.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-cargotoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Cargo.toml")),(0,a.kt)("p",null,"There a bunch of changes in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"You don't have to specify the features anymore - remove the ",(0,a.kt)("inlineCode",{parentName:"li"},"features")," section and ",(0,a.kt)("inlineCode",{parentName:"li"},"default-features")," flag from the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra")," dependency."),(0,a.kt)("li",{parentName:"ul"},"Register bins you added in the previous step."),(0,a.kt)("li",{parentName:"ul"},"Add ",(0,a.kt)("inlineCode",{parentName:"li"},"dev-dependencies")," section with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra-test")," crate."),(0,a.kt)("li",{parentName:"ul"},"Add recommended profiles for ",(0,a.kt)("inlineCode",{parentName:"li"},"release")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," to optimize the build process.")),(0,a.kt)("p",null,"Below you can compare the ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file after and before the migration to v0.8.0:"),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.8.0"\n\n[dev-dependencies]\nodra-test = "0.8.0"\n\n[[bin]]\nname = "my_project_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "my_project_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.7.1", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')))),(0,a.kt)("h3",{id:"22-update-odratoml"},"2.2. ",(0,a.kt)("strong",{parentName:"h3"},"Update Odra.toml")),(0,a.kt)("p",null,"Due to the changes in cargo-odra, the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file has been simplified. The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," property is no longer required."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "my_project::Flipper"\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "my_project::Flipper"\n')))),(0,a.kt)("h3",{id:"23-update-smart-contracts"},"2.3. ",(0,a.kt)("strong",{parentName:"h3"},"Update Smart Contracts")),(0,a.kt)("p",null,"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"231-update-the-use-statements-to-reflect-the-new-module-structure"},"2.3.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update the ",(0,a.kt)("inlineCode",{parentName:"strong"},"use")," statements to reflect the new module structure.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Big integer types are now located in the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types")," module."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::Address")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::Address"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Variable")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::contract_env"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::event::OdraEvent"),"."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::OdraType")," as it is no longer required."),(0,a.kt)("li",{parentName:"ul"},"Change ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::types::casper_types::*;")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::*;"),".")),(0,a.kt)("h4",{id:"232-some-type-aliases-are-no-longer-in-use"},"2.3.2. ",(0,a.kt)("strong",{parentName:"h4"},"Some type aliases are no longer in use.")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Balance")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::U512"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BlockTime")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"u64"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"EventData")," - use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::casper_types::bytesrepr::Bytes"),".")),(0,a.kt)("h4",{id:"233-consider-import-odraprelude-in-your-module-files"},"2.3.3. ",(0,a.kt)("strong",{parentName:"h4"},"Consider import ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::prelude::*")," in your module files.")),(0,a.kt)("h4",{id:"234-flatten-nested-mappings"},"2.3.4. ",(0,a.kt)("strong",{parentName:"h4"},"Flatten nested ",(0,a.kt)("inlineCode",{parentName:"strong"},"Mapping"),"s.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// Before\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<Address, Mapping<Address, U256>>\n}\n// After\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n ...\n allowances: Mapping<(Address, Address), U256>\n}\n")),(0,a.kt)("h4",{id:"235-update-errors-definitions"},"2.3.5. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"execution_error!")," macro has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," derive macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::execution_error;\n\nexecution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n}\n")))),(0,a.kt)("h4",{id:"236-update-events-definitions"},"2.3.6. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n\n// Emitting the event\nself.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n});\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Event;\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n\n// Emitting the event\nuse odra::types::event::OdraEvent;\n\nTransfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n}.emit();\n")))),(0,a.kt)("h4",{id:"237-replace-contract_env-with-selfenv-in-your-modules"},"2.3.7. ",(0,a.kt)("strong",{parentName:"h4"},"Replace ",(0,a.kt)("inlineCode",{parentName:"strong"},"contract_env")," with ",(0,a.kt)("inlineCode",{parentName:"strong"},"self.env()")," in your modules.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"self.env()")," is a new way to access the contract environment, returns a reference to ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv"),". The API is similar to the previous ",(0,a.kt)("inlineCode",{parentName:"p"},"contract_env")," but with some changes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn get_var<T: FromBytes>(key: &[u8]) -> Option<T>")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"set_dict_value()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_dict_value()")," has been removed. All the dictionary operations should be performed using ",(0,a.kt)("inlineCode",{parentName:"li"},"Mapping")," type, internally using ",(0,a.kt)("inlineCode",{parentName:"li"},"set_var()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"get_var()")," functions. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8>")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn hash<T: ToBytes>(&self, value: T) -> [u8; 32]"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn revert<E: Into<ExecutionError>>(error: E) -> !")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn revert<E: Into<OdraError>>(&self, error: E) -> !"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event<T: ToBytes + OdraEvent>(event: T)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn emit_event<T: ToBytes>(&self, event: T)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"native_token_metadata()")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"one_token()")," have been removed.")),(0,a.kt)("h4",{id:"238-wrap-submodules-of-your-module-with-odrasubmodulet"},"2.3.8. ",(0,a.kt)("strong",{parentName:"h4"},"Wrap submodules of your module with ",(0,a.kt)("inlineCode",{parentName:"strong"},"odra::SubModule<T>"),".")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: SubModule<Erc721Base>,\n metadata: SubModule<Erc721MetadataExtension>,\n ownable: SubModule<Ownable>\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [Transfer])]\npub struct Erc721Token {\n core: Erc721Base,\n metadata: Erc721MetadataExtension,\n ownable: Ownable\n}\n")))),(0,a.kt)("h4",{id:"239-update-external-contract-calls"},"2.3.9. ",(0,a.kt)("strong",{parentName:"h4"},"Update external contract calls.")),(0,a.kt)("p",null,"However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref"),") and you can call it using ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}ContractRef::new(env, address)")," (former ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}Ref::at()"),")."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenContractRef::new(env, token).balance_of(account)\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::external_contract]\npub trait Token {\n fn balance_of(&self, owner: &Address) -> U256;\n}\n\n// Usage\nTokenRef::at(token).balance_of(account)\n")))),(0,a.kt)("h4",{id:"2310-update-constructors"},"2.3.10. ",(0,a.kt)("strong",{parentName:"h4"},"Update constructors.")),(0,a.kt)("p",null,"Remove the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::init]")," attribute from the constructor and ensure that the constructor function is named ",(0,a.kt)("inlineCode",{parentName:"p"},"init"),"."),(0,a.kt)("h4",{id:"2311-update-unwraporrevert-calls"},"2.3.11. ",(0,a.kt)("strong",{parentName:"h4"},"Update ",(0,a.kt)("inlineCode",{parentName:"strong"},"UnwrapOrRevert")," calls.")),(0,a.kt)("p",null,"The functions ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," now require ",(0,a.kt)("inlineCode",{parentName:"p"},"&HostEnv")," as the first parameter."),(0,a.kt)("h4",{id:"2312-remove-odrausing-attribute-from-your-module-definition"},"2.3.12. ",(0,a.kt)("strong",{parentName:"h4"},"Remove ",(0,a.kt)("inlineCode",{parentName:"strong"},"#[odra(using)]")," attribute from your module definition.")),(0,a.kt)("p",null,"Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required."),(0,a.kt)("h3",{id:"24-update-tests"},"2.4. ",(0,a.kt)("strong",{parentName:"h3"},"Update Tests")),(0,a.kt)("p",null,"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:"),(0,a.kt)("h4",{id:"241-contract-deployment"},"2.4.1. ",(0,a.kt)("strong",{parentName:"h4"},"Contract deployment.")),(0,a.kt)("p",null,"The way you deploy a contract has changed:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef::deploy(&env, args)")," instead of ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}Deployer::init()"),". The ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef")," implements ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer"),"."),(0,a.kt)("li",{parentName:"ol"},"Instantiate the ",(0,a.kt)("inlineCode",{parentName:"li"},"HostEnv")," using ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),", required by the ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract doesn't have init args, you should use ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::host::NoArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function."),(0,a.kt)("li",{parentName:"ol"},"If the contract has init args, you should pass the autogenerated ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}InitArgs")," as the second argument of the ",(0,a.kt)("inlineCode",{parentName:"li"},"deploy")," function.")),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableHostRef;\nuse odra::host::{Deployer, HostEnv, HostRef, NoArgs};\n\nlet env: HostEnv = odra_test::env();\nlet ownable = OwnableHostRef::deploy(&env, NoArgs)\n\n// A contract with init args\nuse super::{Erc20HostRef, Erc20InitArgs};\nuse odra::host::{Deployer, HostEnv};\n\nlet env: HostEnv = odra_test::env();\nlet init_args = Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n};\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"// A contract without init args\nuse super::OwnableDeployer;\n\nlet ownable = OwnableDeployer::init();\n\n// A contract with init args\nlet erc20 = Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n);\n")))),(0,a.kt)("h4",{id:"242-host-interactions"},"2.4.2. ",(0,a.kt)("strong",{parentName:"h4"},"Host interactions.")),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Replace ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," with ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),"."),(0,a.kt)("li",{parentName:"ol"},"The API of ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::test_env")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"odra_test::env()")," are similar, but there are some differences:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::advance_block_time_by(BlockTime)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.advance_block_time(u64)"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"test_env::token_balance(Address)")," is now ",(0,a.kt)("inlineCode",{parentName:"li"},"env.balance_of(&Address)"),"."),(0,a.kt)("li",{parentName:"ul"},"functions ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_cost()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::last_call_contract_gas_used()"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::total_gas_used(Address)"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"test_env::gas_report()")," have been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef::last_call()")," and extract the data from a ",(0,a.kt)("inlineCode",{parentName:"li"},"odra::ContractCallResult")," instance. ",(0,a.kt)("inlineCode",{parentName:"li"},"HostRef")," is a trait implemented by ",(0,a.kt)("inlineCode",{parentName:"li"},"{{ModuleName}}HostRef"),".")))),(0,a.kt)("h4",{id:"243-testing-failing-scenarios"},"2.4.3. ",(0,a.kt)("strong",{parentName:"h4"},"Testing failing scenarios.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"test_env::assert_exception()")," has been removed. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix to call the function and then assert the result.\n",(0,a.kt)("inlineCode",{parentName:"p"},"try_")," prefix is a new way to call a function that might fail. It returns a ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult"))," type, which you can then assert using the standard Rust ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n let (env, mut erc20) = setup();\n\n let (owner, spender, recipient) =\n (env.get_account(0), env.get_account(1), env.get_account(2));\n let amount = 1_000.into();\n env.set_caller(spender);\n\n assert_eq!(\n erc20.try_transfer_from(owner, recipient, amount),\n Err(Error::InsufficientAllowance.into())\n );\n}\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[test]\nfn transfer_from_error() {\n test_env::assert_exception(Error::InsufficientAllowance, || {\n let mut erc20 = setup();\n\n let (owner, spender, recipient) = (\n test_env::get_account(0),\n test_env::get_account(1),\n test_env::get_account(2)\n );\n let amount = 1_000.into();\n test_env::set_caller(spender);\n\n erc20.transfer_from(&owner, &recipient, &amount)\n });\n}\n")))),(0,a.kt)("h4",{id:"244-testing-events"},"2.4.4. ",(0,a.kt)("strong",{parentName:"h4"},"Testing events.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," macro has been removed. You should use ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv::emitted_event()")," to assert the emitted events.\nThe new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/host/struct.HostEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"HostEnv"))," documentation to explore the available options."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let env: HostEnv = odra_test::env();\nlet erc20 = Erc20HostRef::deploy(&env, init_args);\n\n...\n\nassert!(env.emitted_event(\n erc20.address(),\n &Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n }\n));\nassert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n));\n"))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"let erc20 = Erc20HostDeployer::init(&env, ...);\n\n...\n\nassert_events!(\n erc20,\n Approval {\n owner,\n spender,\n value: approved_amount - transfer_amount\n },\n Transfer {\n from: Some(owner),\n to: Some(recipient),\n amount: transfer_amount\n }\n);\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.8.0."),(0,a.kt)(o.Z,{mdxType:"Tabs"},(0,a.kt)(s.Z,{value:"current",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option<U256>\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20HostRef, Erc20InitArgs\n };\n use odra::{\n casper_types::U256,\n host::{Deployer, HostEnv, HostRef},\n prelude::*\n };\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> (HostEnv, Erc20HostRef) {\n let env = odra_test::env();\n (\n env.clone(),\n Erc20HostRef::deploy(\n &env,\n Erc20InitArgs {\n symbol: SYMBOL.to_string(),\n name: NAME.to_string(),\n decimals: DECIMALS,\n initial_supply: Some(INITIAL_SUPPLY.into())\n }\n )\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let (env, erc20) = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: None,\n to: Some(env.get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n ));\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When transfer tokens to a recipient.\n let sender = env.get_account(0);\n let recipient = env.get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert!(env.emitted_event(\n erc20.address(),\n &Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n ));\n }\n\n #[test]\n fn transfer_error() {\n // Given a new contract.\n let (env, mut erc20) = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = env.get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n assert!(erc20.try_transfer(&recipient, &amount).is_err());\n }\n\n // Other tests...\n}\n'))),(0,a.kt)(s.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},'use odra::prelude::string::String;\nuse odra::{\n contract_env,\n types::{event::OdraEvent, Address, U256},\n Mapping, UnwrapOrRevert, Variable\n};\n\nuse self::{\n errors::Error,\n events::{Approval, Transfer}\n};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Variable<u8>,\n symbol: Variable<String>,\n name: Variable<String>,\n total_supply: Variable<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<Address, Mapping<Address, U256>>\n}\n\n#[odra::module]\nimpl Erc20 {\n #[odra(init)]\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: &Option<U256>\n ) {\n let caller = contract_env::caller();\n\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = *initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n }\n .emit();\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = contract_env::caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = contract_env::caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = contract_env::caller();\n\n self.allowances.get_instance(&owner).set(spender, *amount);\n Approval {\n owner,\n spender: *spender,\n value: *amount\n }\n .emit();\n }\n\n pub fn name(&self) -> String {\n self.name.get().unwrap_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_instance(owner).get_or_default(spender)\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n }\n .emit();\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n contract_env::revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n }\n .emit();\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n contract_env::revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n }\n .emit();\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_instance(owner).get_or_default(spender);\n if allowance < *amount {\n contract_env::revert(Error::InsufficientAllowance)\n }\n self.allowances\n .get_instance(owner)\n .subtract(spender, *amount);\n Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n }\n .emit();\n }\n}\n\npub mod events {\n use odra::types::{casper_types::U256, Address};\n use odra::Event;\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::execution_error;\n\n execution_error! {\n pub enum Error {\n InsufficientBalance => 30_000,\n InsufficientAllowance => 30_001,\n NameNotSet => 30_002,\n SymbolNotSet => 30_003,\n DecimalsNotSet => 30_004,\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::{\n errors::Error,\n events::{Approval, Transfer},\n Erc20Deployer, Erc20Ref\n };\n use odra::prelude::string::ToString;\n use odra::{assert_events, test_env, types::casper_types::U256};\n\n const NAME: &str = "Plascoin";\n const SYMBOL: &str = "PLS";\n const DECIMALS: u8 = 10;\n const INITIAL_SUPPLY: u32 = 10_000;\n\n fn setup() -> Erc20Ref {\n Erc20Deployer::init(\n SYMBOL.to_string(),\n NAME.to_string(),\n DECIMALS,\n &Some(INITIAL_SUPPLY.into())\n )\n }\n\n #[test]\n fn initialization() {\n // When deploy a contract with the initial supply.\n let erc20 = setup();\n\n // Then the contract has the metadata set.\n assert_eq!(erc20.symbol(), SYMBOL.to_string());\n assert_eq!(erc20.name(), NAME.to_string());\n assert_eq!(erc20.decimals(), DECIMALS);\n\n // Then the total supply is updated.\n assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());\n\n // Then a Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: None,\n to: Some(test_env::get_account(0)),\n amount: INITIAL_SUPPLY.into()\n }\n );\n }\n\n #[test]\n fn transfer_works() {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When transfer tokens to a recipient.\n let sender = test_env::get_account(0);\n let recipient = test_env::get_account(1);\n let amount = 1_000.into();\n erc20.transfer(&recipient, &amount);\n\n // Then the sender balance is deducted.\n assert_eq!(\n erc20.balance_of(&sender),\n U256::from(INITIAL_SUPPLY) - amount\n );\n\n // Then the recipient balance is updated.\n assert_eq!(erc20.balance_of(&recipient), amount);\n\n // Then Transfer event was emitted.\n assert_events!(\n erc20,\n Transfer {\n from: Some(sender),\n to: Some(recipient),\n amount\n }\n );\n }\n\n #[test]\n fn transfer_error() {\n test_env::assert_exception(Error::InsufficientBalance, || {\n // Given a new contract.\n let mut erc20 = setup();\n\n // When the transfer amount exceeds the sender balance.\n let recipient = test_env::get_account(1);\n let amount = U256::from(INITIAL_SUPPLY) + U256::one();\n\n // Then an error occurs.\n erc20.transfer(&recipient, &amount)\n });\n }\n\n // Other tests...\n}\n')))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.8.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.8.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.8.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/d985b3f7.e852e117.js b/docs/assets/js/d985b3f7.e852e117.js new file mode 100644 index 000000000..c4f4ab1a7 --- /dev/null +++ b/docs/assets/js/d985b3f7.e852e117.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[9558],{15745:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-pages","id":"default"}')}}]); \ No newline at end of file diff --git a/docs/assets/js/d9fee9da.bbc56e04.js b/docs/assets/js/d9fee9da.bbc56e04.js new file mode 100644 index 000000000..928d41d1c --- /dev/null +++ b/docs/assets/js/d9fee9da.bbc56e04.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97405],{29124:e=>{e.exports=JSON.parse('{"title":"Basics","description":"Basic concepts of Odra Framework","slug":"/category/basics","permalink":"/docs/0.3.1/category/basics","navigation":{"previous":{"title":"Flipper example","permalink":"/docs/0.3.1/getting-started/flipper"},"next":{"title":"Cargo Odra","permalink":"/docs/0.3.1/basics/cargo-odra"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/da555cce.c57445d0.js b/docs/assets/js/da555cce.c57445d0.js new file mode 100644 index 000000000..06ae3217d --- /dev/null +++ b/docs/assets/js/da555cce.c57445d0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[85228],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={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,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},7275:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",l={unversionedId:"basics/cargo-odra",id:"version-0.6.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.6.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.6.0/basics/cargo-odra",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.6.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.6.0/basics/directory-structure"}},s={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Updating dependencies",id:"updating-dependencies",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them on multiple backends (blockchains)."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands will help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This will create a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it will create a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This will create a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.6.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It will run your tests against Odra's MockVM. It is substantially faster than virtual machines\nprovided by blockchains developers and implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files,\nspin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat.\nKeep in mind that this is a lot slower than MockVM and you cannot use the debugger.\nThis is why MockVM was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("p",null,"Where ",(0,r.kt)("inlineCode",{parentName:"p"},"casper")," is the name of the backend we are using in this example. If the build process\nfinishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder."),(0,r.kt)("h2",{id:"updating-dependencies"},"Updating dependencies"),(0,r.kt)("p",null,"You will learn later, that the project using Odra contains more than one Rust project - your own and\none or more builders. To run ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo update")," on all of them at once instead of traversing all the folders\nyou can use this command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra update\n")),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/da9e3acc.05c302a3.js b/docs/assets/js/da9e3acc.05c302a3.js new file mode 100644 index 000000000..5438f5b86 --- /dev/null +++ b/docs/assets/js/da9e3acc.05c302a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[90827],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},47820:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},o="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.2.0/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.2.0/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.2.0/basics/flipper-internals",draft:!1,tags:[],version:"0.2.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"defaultSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.2.0/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.2.0/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.2.0/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Variable;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Variables and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Variable<bool>,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.2.0/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(init)]")," macro marks the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Variable<T>"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperDeployer")," - a piece of code generated automatically thanks to the macros.\nThe contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/db36feee.bcd96a50.js b/docs/assets/js/db36feee.bcd96a50.js new file mode 100644 index 000000000..02b6b7737 --- /dev/null +++ b/docs/assets/js/db36feee.bcd96a50.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[28663],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=l(t),u=r,h=p["".concat(c,".").concat(u)]||p[u]||m[u]||i;return t?a.createElement(h,o(o({ref:n},d),{},{components:t})):a.createElement(h,o({ref:n},d))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=p;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var l=2;l<i;l++)o[l]=t[l];return a.createElement.apply(null,o)}return a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},7838:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:10,description:"Casper Contract Schema"},o="Casper Contract Schema",s={unversionedId:"basics/casper-contract-schema",id:"version-0.9.1/basics/casper-contract-schema",title:"Casper Contract Schema",description:"Casper Contract Schema",source:"@site/versioned_docs/version-0.9.1/basics/13-casper-contract-schema.md",sourceDirName:"basics",slug:"/basics/casper-contract-schema",permalink:"/docs/0.9.1/basics/casper-contract-schema",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Casper Contract Schema"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.9.1/basics/events"},next:{title:"Cross calls",permalink:"/docs/0.9.1/basics/cross-calls"}},c={},l=[{value:"Odra and CCS",id:"odra-and-ccs",level:2},{value:"Generating the Schema",id:"generating-the-schema",level:2},{value:"Schema Output",id:"schema-output",level:2},{value:"Schema Fields",id:"schema-fields",level:2}],d={toc:l};function m(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper-contract-schema"},"Casper Contract Schema"),(0,r.kt)("p",null," Working in collaboration with the Casper Association we designed the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema")," (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability."),(0,r.kt)("h2",{id:"odra-and-ccs"},"Odra and CCS"),(0,r.kt)("p",null,"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: ",(0,r.kt)("inlineCode",{parentName:"p"},"module"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"event"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_type"),". The schema will be generated for you and available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/contract.rs"',showLineNumbers:!0,title:'"src/contract.rs"'},'use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(\n // the name of the contract, default is the module name\n name = "MyContract",\n // the version of the contract, default is the version of the crate\n version = "0.1.0", \n // events that the contract can emit, collected recursively if submodules are used\n events = [ \n Created,\n Updated\n ],\n // the error enum the contract can revert with, collected recursively if submodules are used\n errors = MyErrors \n)]\npub struct MyContract {\n name: Var<String>,\n owner: Var<Address>,\n}\n\n#[odra::module]\nimpl MyContract {\n /// Initializes the contract, sets the name and owner and emits an event\n pub fn init(&mut self, name: String, owner: Address) {\n self.name.set(name.clone());\n self.owner.set(owner.clone());\n self.env().emit_event(Created { name });\n }\n\n /// Updates the name of the contract and emits an event\n pub fn update(&mut self, name: String) {\n self.name.set(name.clone());\n self.env().emit_event(Updated { name });\n }\n\n /// Returns the data of the contract\n pub fn get_data(&self) -> Data {\n Data {\n name: self.name.get_or_default(),\n owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),\n }\n }\n}\n\n// The struct will we visible in the schema in the types section\n#[odra::odra_type]\npub struct Data {\n name: String,\n owner: Address,\n}\n\n// The enum variants will we visible in the schema in the errors section\n#[odra::odra_error]\npub enum MyErrors {\n /// The owner is invalid\n InvalidOwner,\n /// The name is invalid\n InvalidName,\n}\n\n// The struct will we visible in the schema in the types and events section\n#[odra::event]\npub struct Updated {\n name: String,\n}\n\n// The struct will we visible in the schema in the types section and events section\n#[odra::event]\npub struct Created {\n name: String,\n}\n')),(0,r.kt)("h2",{id:"generating-the-schema"},"Generating the Schema"),(0,r.kt)("p",null,"To generate the schema run the following ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo-odra")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema # or pass -c flag to generate the schema for a specific contract\n")),(0,r.kt)("h2",{id:"schema-output"},"Schema Output"),(0,r.kt)("p",null,"The generated schema will be available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'showLineNumbers title="resources/my_contract_schema.json"',showLineNumbers:!0,title:'"resources/my_contract_schema.json"'},'{\n "casper_contract_schema_version": 1,\n "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",\n "authors": [],\n "repository": null,\n "homepage": null,\n "contract_name": "MyContract",\n "contract_version": "0.1.0",\n "types": [\n {\n "struct": {\n "name": "Created",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Data",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Updated",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n }\n ],\n "errors": [\n {\n "name": "InvalidName",\n "description": "The name is invalid",\n "discriminant": 1\n },\n {\n "name": "InvalidOwner",\n "description": "The owner is invalid",\n "discriminant": 0\n }\n ],\n "entry_points": [\n {\n "name": "update",\n "description": "Updates the name of the contract and emits an event",\n "is_mutable": true,\n "arguments": [\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n }\n ],\n "return_ty": "Unit",\n "is_contract_context": true,\n "access": "public"\n },\n {\n "name": "get_data",\n "description": "Returns the data of the contract",\n "is_mutable": false,\n "arguments": [],\n "return_ty": "Data",\n "is_contract_context": true,\n "access": "public"\n }\n ],\n "events": [\n {\n "name": "Created",\n "ty": "Created"\n },\n {\n "name": "Updated",\n "ty": "Updated"\n }\n ],\n "call": {\n "wasm_file_name": "MyContract.wasm",\n "description": "Initializes the contract, sets the name and owner and emits an event",\n "arguments": [\n {\n "name": "odra_cfg_package_hash_key_name",\n "description": "The arg name for the package hash key name.",\n "ty": "String",\n "optional": false\n },\n {\n "name": "odra_cfg_allow_key_override",\n "description": "The arg name for the allow key override.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "odra_cfg_is_upgradable",\n "description": "The arg name for the contract upgradeability setting.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key",\n "optional": false\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"schema-fields"},"Schema Fields"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"casper_contract_schema_version")," is the version of the schema.\n",(0,r.kt)("inlineCode",{parentName:"li"},"toolchain")," is the version of the Rust compiler used to compile the contract."),(0,r.kt)("li",{parentName:"ul"},"Fields ",(0,r.kt)("inlineCode",{parentName:"li"},"authors"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"repository"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"homepage")," are optional and can be set in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_name")," is the name of the contract - by default is the module name, may be overriden by the module attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_version")," denotes the version of the contract, defaulting to the version specified in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file, but can be overridden by the ",(0,r.kt)("inlineCode",{parentName:"li"},"module")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"types")," comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), and a list of members."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"errors")," is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_points")," is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"events")," is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in ",(0,r.kt)("inlineCode",{parentName:"li"},"types"),") of the event."),(0,r.kt)("li",{parentName:"ul"},"The ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," section provides details regarding the contract's ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/db82a1c0.01b7c8ed.js b/docs/assets/js/db82a1c0.01b7c8ed.js new file mode 100644 index 000000000..a8f9fa60e --- /dev/null +++ b/docs/assets/js/db82a1c0.01b7c8ed.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[494],{32259:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"0.4.0","label":"0.4.0","banner":"unmaintained","badge":true,"noIndex":false,"className":"docs-version-0.4.0","isLast":false,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Odra framework","href":"/docs/0.4.0/","docId":"intro"},{"type":"category","label":"Getting started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/0.4.0/getting-started/installation","docId":"getting-started/installation"},{"type":"link","label":"Flipper example","href":"/docs/0.4.0/getting-started/flipper","docId":"getting-started/flipper"}],"href":"/docs/0.4.0/category/getting-started"},{"type":"category","label":"Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Cargo Odra","href":"/docs/0.4.0/basics/cargo-odra","docId":"basics/cargo-odra"},{"type":"link","label":"Directory structure","href":"/docs/0.4.0/basics/directory-structure","docId":"basics/directory-structure"},{"type":"link","label":"Odra.toml","href":"/docs/0.4.0/basics/odra-toml","docId":"basics/odra-toml"},{"type":"link","label":"Flipper Internals","href":"/docs/0.4.0/basics/flipper-internals","docId":"basics/flipper-internals"},{"type":"link","label":"Storage interaction","href":"/docs/0.4.0/basics/storage-interaction","docId":"basics/storage-interaction"},{"type":"link","label":"Host Communication","href":"/docs/0.4.0/basics/communicating-with-host","docId":"basics/communicating-with-host"},{"type":"link","label":"Testing","href":"/docs/0.4.0/basics/testing","docId":"basics/testing"},{"type":"link","label":"Errors","href":"/docs/0.4.0/basics/errors","docId":"basics/errors"},{"type":"link","label":"Events","href":"/docs/0.4.0/basics/events","docId":"basics/events"},{"type":"link","label":"Cross calls","href":"/docs/0.4.0/basics/cross-calls","docId":"basics/cross-calls"},{"type":"link","label":"Modules","href":"/docs/0.4.0/basics/modules","docId":"basics/modules"},{"type":"link","label":"Native token","href":"/docs/0.4.0/basics/native-token","docId":"basics/native-token"}],"href":"/docs/0.4.0/category/basics"},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Module Composer","href":"/docs/0.4.0/advanced/composer","docId":"advanced/composer"},{"type":"link","label":"Delegate","href":"/docs/0.4.0/advanced/delegate","docId":"advanced/delegate"},{"type":"link","label":"Advanced Storage Concepts","href":"/docs/0.4.0/advanced/advanced-storage","docId":"advanced/advanced-storage"},{"type":"link","label":"Attributes","href":"/docs/0.4.0/advanced/attributes","docId":"advanced/attributes"}],"href":"/docs/0.4.0/category/advanced"},{"type":"category","label":"Backends","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"What is a backend?","href":"/docs/0.4.0/backends/what-is-a-backend","docId":"backends/what-is-a-backend"},{"type":"link","label":"MockVM","href":"/docs/0.4.0/backends/mock-vm","docId":"backends/mock-vm"},{"type":"link","label":"Casper","href":"/docs/0.4.0/backends/casper","docId":"backends/casper"}],"href":"/docs/0.4.0/category/backends"},{"type":"category","label":"Examples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"odra-examples","href":"/docs/0.4.0/examples/odra-examples","docId":"examples/odra-examples"},{"type":"link","label":"Using odra-modules","href":"/docs/0.4.0/examples/using-odra-modules","docId":"examples/using-odra-modules"}],"href":"/docs/0.4.0/category/examples"},{"type":"category","label":"Tutorials","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Ownable","href":"/docs/0.4.0/tutorials/ownable","docId":"tutorials/ownable"},{"type":"link","label":"ERC-20","href":"/docs/0.4.0/tutorials/erc20","docId":"tutorials/erc20"},{"type":"link","label":"OwnedToken","href":"/docs/0.4.0/tutorials/owned-token","docId":"tutorials/owned-token"}],"href":"/docs/0.4.0/category/tutorials"}]},"docs":{"advanced/advanced-storage":{"id":"advanced/advanced-storage","title":"Advanced Storage Concepts","description":"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.","sidebar":"tutorialSidebar"},"advanced/attributes":{"id":"advanced/attributes","title":"Attributes","description":"Smart contract developers with Ethereum background are familiar with Solidity\'s concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.","sidebar":"tutorialSidebar"},"advanced/composer":{"id":"advanced/composer","title":"Module Composer","description":"The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.","sidebar":"tutorialSidebar"},"advanced/delegate":{"id":"advanced/delegate","title":"Delegate","description":"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.","sidebar":"tutorialSidebar"},"backends/casper":{"id":"backends/casper","title":"Casper","description":"The Casper backend allows you to compile your contracts into WASM files which can be deployed","sidebar":"tutorialSidebar"},"backends/mock-vm":{"id":"backends/mock-vm","title":"MockVM","description":"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing","sidebar":"tutorialSidebar"},"backends/what-is-a-backend":{"id":"backends/what-is-a-backend","title":"What is a backend?","description":"You can think of a backend as a target platform for your smart contract.","sidebar":"tutorialSidebar"},"basics/cargo-odra":{"id":"basics/cargo-odra","title":"Cargo Odra","description":"A tool for managing Odra projects","sidebar":"tutorialSidebar"},"basics/communicating-with-host":{"id":"basics/communicating-with-host","title":"Host Communication","description":"How to get information from the Host","sidebar":"tutorialSidebar"},"basics/cross-calls":{"id":"basics/cross-calls","title":"Cross calls","description":"Contracts calling contracts","sidebar":"tutorialSidebar"},"basics/directory-structure":{"id":"basics/directory-structure","title":"Directory structure","description":"Files and folders in the Odra project","sidebar":"tutorialSidebar"},"basics/errors":{"id":"basics/errors","title":"Errors","description":"Causing and handling errors","sidebar":"tutorialSidebar"},"basics/events":{"id":"basics/events","title":"Events","description":"Creating and emitting Events","sidebar":"tutorialSidebar"},"basics/flipper-internals":{"id":"basics/flipper-internals","title":"Flipper Internals","description":"Detailed explanation of the Flipper contract","sidebar":"tutorialSidebar"},"basics/modules":{"id":"basics/modules","title":"Modules","description":"Divide your code into modules","sidebar":"tutorialSidebar"},"basics/native-token":{"id":"basics/native-token","title":"Native token","description":"How to deposit, withdraw and transfer","sidebar":"tutorialSidebar"},"basics/odra-toml":{"id":"basics/odra-toml","title":"Odra.toml","description":"Odra\'s configuration file","sidebar":"tutorialSidebar"},"basics/storage-interaction":{"id":"basics/storage-interaction","title":"Storage interaction","description":"How to write data into blockchain\'s storage","sidebar":"tutorialSidebar"},"basics/testing":{"id":"basics/testing","title":"Testing","description":"How to write tests in Odra","sidebar":"tutorialSidebar"},"examples/odra-examples":{"id":"examples/odra-examples","title":"odra-examples","description":"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.","sidebar":"tutorialSidebar"},"examples/using-odra-modules":{"id":"examples/using-odra-modules","title":"Using odra-modules","description":"Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.","sidebar":"tutorialSidebar"},"getting-started/flipper":{"id":"getting-started/flipper","title":"Flipper example","description":"To quickly start working with Odra, take a look at the following code sample. If you followed the","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"Hello fellow Odra user! This page will guide you through the installation process.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Odra framework","description":"Odra Docs","sidebar":"tutorialSidebar"},"tutorials/erc20":{"id":"tutorials/erc20","title":"ERC-20","description":"It\'s time for something that every smart contract developer has done at least once. Let\'s try to implement Erc20 standard. Of course, we are going to use the Odra Framework.","sidebar":"tutorialSidebar"},"tutorials/ownable":{"id":"tutorials/ownable","title":"Ownable","description":"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract\'s critical features.","sidebar":"tutorialSidebar"},"tutorials/owned-token":{"id":"tutorials/owned-token","title":"OwnedToken","description":"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/db95cb73.9301cd2d.js b/docs/assets/js/db95cb73.9301cd2d.js new file mode 100644 index 000000000..18ca00dc9 --- /dev/null +++ b/docs/assets/js/db95cb73.9301cd2d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[16828],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,y=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d<i;d++)o[d]=n[d];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},9370:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={},o="Storage Layout",s={unversionedId:"advanced/storage-layout",id:"version-1.0.0/advanced/storage-layout",title:"Storage Layout",description:"Odra's innovative modular design necessitates a unique storage layout. This",source:"@site/versioned_docs/version-1.0.0/advanced/04-storage-layout.md",sourceDirName:"advanced",slug:"/advanced/storage-layout",permalink:"/docs/advanced/storage-layout",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:4,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Attributes",permalink:"/docs/advanced/attributes"},next:{title:"Memory allocators",permalink:"/docs/advanced/using-different-allocator"}},l={},d=[{value:"Casper VM Perspective",id:"casper-vm-perspective",level:2},{value:"Odra Perspective",id:"odra-perspective",level:2},{value:"Key generation.",id:"key-generation",level:2},{value:"Value serialization",id:"value-serialization",level:2}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"Odra's innovative modular design necessitates a unique storage layout. This\narticle explains step-by-step Odra's storage layout."),(0,r.kt)("h2",{id:"casper-vm-perspective"},"Casper VM Perspective"),(0,r.kt)("p",null,"The Casper Execution Engine (VM) enables the storage of data in named keys or\ndictionaries. However, a smart contract has a limited number of named keys,\nmaking it unsuitable for storing substantial data volumes. Odra resolves this\nissue by storing all user-generated data in a dictionary called ",(0,r.kt)("inlineCode",{parentName:"p"},"state"),". This\ndictionary operates as a key-value store, where keys are strings with a maximum\nlength of 64 characters, and values are arbitrary byte arrays."),(0,r.kt)("p",null,"Here is an example of what the interface for reading and writing data could look\nlike:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait CasperStorage {\n fn read(key: &str) -> Option<Vec<u8>>;\n fn write(key: &str, value: Vec<u8>);\n}\n")),(0,r.kt)("h2",{id:"odra-perspective"},"Odra Perspective"),(0,r.kt)("p",null,"Odra was conceived with modularity and code reusability in mind. Additionally,\nwe aimed to streamline storage definition through the struct object. Consider\nthis straightforward storage definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Token {\n name: Var<String>,\n balances: Mapping<Address, U256>\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," structure contains two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"name")," of type ",(0,r.kt)("inlineCode",{parentName:"p"},"String")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"balances"),", which functions as a key-value store with ",(0,r.kt)("inlineCode",{parentName:"p"},"Address")," as keys and\n",(0,r.kt)("inlineCode",{parentName:"p"},"U256")," as values."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module can be reused in another module, as demonstrated in a more\ncomplex example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct Loans {\n lenders: SubModule<Token>,\n borrowers: SubModule<Token>,\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," module has two fields: ",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers"),", both of which have\nthe same storage layout as defined by the ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," module. Odra guarantees that\n",(0,r.kt)("inlineCode",{parentName:"p"},"lenders")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers")," are stored under distinct keys within the storage\ndictionary."),(0,r.kt)("p",null,"Both ",(0,r.kt)("inlineCode",{parentName:"p"},"Token")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Loans")," serve as examples to show how Odra's storage layout\noperates."),(0,r.kt)("h2",{id:"key-generation"},"Key generation."),(0,r.kt)("p",null,"Every element of a module (",(0,r.kt)("inlineCode",{parentName:"p"},"struct"),") with N elements is associated with an index\nranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an\nelement of a module is another module (",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<...>"),"), the associated index\nserves as a prefix for the indexes of the inner module."),(0,r.kt)("p",null,"While this may initially appear complex, it is easily understood through an\nexample. In the example, indexes are presented as bytes, reflecting the actual\nimplementation."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Loans {\n lenders: Token { // prefix: 0x0001\n name: 1, // key: 0x0001_0001\n balances: 2 // key: 0x0001_0010\n },\n borrowers: Token { // prefix: 0x0010\n name: 1, // key: 0x0010_0001\n balances: 2 // key: 0x0010_0010\n }\n}\n")),(0,r.kt)("p",null,"Additionally, it's worth mentioning how ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"'s keys are used in the\n",(0,r.kt)("inlineCode",{parentName:"p"},"storage"),". They are simply concatenated with the index of the module, as\ndemonstrated in the example."),(0,r.kt)("p",null,"For instance, triggering ",(0,r.kt)("inlineCode",{parentName:"p"},"borrowers.balances.get(0x1234abcd)")," would result in a\nkey:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"0x0001_0001_1234_abcd\n")),(0,r.kt)("p",null,"Finally, the key must be hashed to fit within the 64-character limit and then\nencoded in hexadecimal format."),(0,r.kt)("h2",{id:"value-serialization"},"Value serialization"),(0,r.kt)("p",null,"Before being stored in the storage, each value is serialized into bytes using\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"CLType")," serialization method and subsequently encapsulated with Casper's\n",(0,r.kt)("inlineCode",{parentName:"p"},"Bytes")," types."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/dc0bb66d.c2e7fe01.js b/docs/assets/js/dc0bb66d.c2e7fe01.js new file mode 100644 index 000000000..a92dcdee3 --- /dev/null +++ b/docs/assets/js/dc0bb66d.c2e7fe01.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67766],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=o,f=c["".concat(s,".").concat(m)]||c[m]||p[m]||a;return t?r.createElement(f,l(l({ref:n},d),{},{components:t})):r.createElement(f,l({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=c;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var u=2;u<a;u++)l[u]=t[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},56052:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.8.1/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.8.1/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.8.1/tutorials/owned-token",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"ERC-20",permalink:"/docs/0.8.1/tutorials/erc20"},next:{title:"Access Control",permalink:"/docs/0.8.1/tutorials/access-control"}},s={},u=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],d={toc:u};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow only the module owner to mint tokens."),(0,o.kt)("li",{parentName:"ol"},"Enable the current owner to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\nuse odra::prelude::*;\nuse odra::module::SubModule;\n\n#[odra::module]\npub struct OwnedToken {\n ownable: SubModule<Ownable>,\n erc20: SubModule<Erc20>\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"...\nuse odra::{Address, casper_types::U256};\n...\n\n#[odra::module]\nimpl OwnedToken {\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = self.env().caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> U256 {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> U256 {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.ownable.ensure_ownership(&self.env().caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L9-L10")," - A constructor is an excellent place to initialize both modules at once."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L13-L15")," - Most of the entrypoints do not need any modification, so we simply delegate them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49-L51")," - The same is done with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L57-L60")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is indeed the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/dcb2dd04.934d3f90.js b/docs/assets/js/dcb2dd04.934d3f90.js new file mode 100644 index 000000000..c12cc4f55 --- /dev/null +++ b/docs/assets/js/dcb2dd04.934d3f90.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[16504],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=l(t),u=r,h=p["".concat(c,".").concat(u)]||p[u]||m[u]||i;return t?a.createElement(h,o(o({ref:n},d),{},{components:t})):a.createElement(h,o({ref:n},d))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=p;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var l=2;l<i;l++)o[l]=t[l];return a.createElement.apply(null,o)}return a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},65154:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const i={sidebar_position:10,description:"Casper Contract Schema"},o="Casper Contract Schema",s={unversionedId:"basics/casper-contract-schema",id:"version-0.9.0/basics/casper-contract-schema",title:"Casper Contract Schema",description:"Casper Contract Schema",source:"@site/versioned_docs/version-0.9.0/basics/13-casper-contract-schema.md",sourceDirName:"basics",slug:"/basics/casper-contract-schema",permalink:"/docs/0.9.0/basics/casper-contract-schema",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Casper Contract Schema"},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/docs/0.9.0/basics/events"},next:{title:"Cross calls",permalink:"/docs/0.9.0/basics/cross-calls"}},c={},l=[{value:"Odra and CCS",id:"odra-and-ccs",level:2},{value:"Generating the Schema",id:"generating-the-schema",level:2},{value:"Schema Output",id:"schema-output",level:2},{value:"Schema Fields",id:"schema-fields",level:2}],d={toc:l};function m(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper-contract-schema"},"Casper Contract Schema"),(0,r.kt)("p",null," Working in collaboration with the Casper Association we designed the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema")," (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability."),(0,r.kt)("h2",{id:"odra-and-ccs"},"Odra and CCS"),(0,r.kt)("p",null,"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: ",(0,r.kt)("inlineCode",{parentName:"p"},"module"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"event"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"odra_type"),". The schema will be generated for you and available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/contract.rs"',showLineNumbers:!0,title:'"src/contract.rs"'},'use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(\n // the name of the contract, default is the module name\n name = "MyContract",\n // the version of the contract, default is the version of the crate\n version = "0.1.0", \n // events that the contract can emit, collected recursively if submodules are used\n events = [ \n Created,\n Updated\n ],\n // the error enum the contract can revert with, collected recursively if submodules are used\n errors = MyErrors \n)]\npub struct MyContract {\n name: Var<String>,\n owner: Var<Address>,\n}\n\n#[odra::module]\nimpl MyContract {\n /// Initializes the contract, sets the name and owner and emits an event\n pub fn init(&mut self, name: String, owner: Address) {\n self.name.set(name.clone());\n self.owner.set(owner.clone());\n self.env().emit_event(Created { name });\n }\n\n /// Updates the name of the contract and emits an event\n pub fn update(&mut self, name: String) {\n self.name.set(name.clone());\n self.env().emit_event(Updated { name });\n }\n\n /// Returns the data of the contract\n pub fn get_data(&self) -> Data {\n Data {\n name: self.name.get_or_default(),\n owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),\n }\n }\n}\n\n// The struct will we visible in the schema in the types section\n#[odra::odra_type]\npub struct Data {\n name: String,\n owner: Address,\n}\n\n// The enum variants will we visible in the schema in the errors section\n#[odra::odra_error]\npub enum MyErrors {\n /// The owner is invalid\n InvalidOwner,\n /// The name is invalid\n InvalidName,\n}\n\n// The struct will we visible in the schema in the types and events section\n#[odra::event]\npub struct Updated {\n name: String,\n}\n\n// The struct will we visible in the schema in the types section and events section\n#[odra::event]\npub struct Created {\n name: String,\n}\n')),(0,r.kt)("h2",{id:"generating-the-schema"},"Generating the Schema"),(0,r.kt)("p",null,"To generate the schema run the following ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo-odra")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema # or pass -c flag to generate the schema for a specific contract\n")),(0,r.kt)("h2",{id:"schema-output"},"Schema Output"),(0,r.kt)("p",null,"The generated schema will be available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'showLineNumbers title="resources/my_contract_schema.json"',showLineNumbers:!0,title:'"resources/my_contract_schema.json"'},'{\n "casper_contract_schema_version": 1,\n "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",\n "authors": [],\n "repository": null,\n "homepage": null,\n "contract_name": "MyContract",\n "contract_version": "0.1.0",\n "types": [\n {\n "struct": {\n "name": "Created",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Data",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key"\n }\n ]\n }\n },\n {\n "struct": {\n "name": "Updated",\n "description": null,\n "members": [\n {\n "name": "name",\n "description": null,\n "ty": "String"\n }\n ]\n }\n }\n ],\n "errors": [\n {\n "name": "InvalidName",\n "description": "The name is invalid",\n "discriminant": 1\n },\n {\n "name": "InvalidOwner",\n "description": "The owner is invalid",\n "discriminant": 0\n }\n ],\n "entry_points": [\n {\n "name": "update",\n "description": "Updates the name of the contract and emits an event",\n "is_mutable": true,\n "arguments": [\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n }\n ],\n "return_ty": "Unit",\n "is_contract_context": true,\n "access": "public"\n },\n {\n "name": "get_data",\n "description": "Returns the data of the contract",\n "is_mutable": false,\n "arguments": [],\n "return_ty": "Data",\n "is_contract_context": true,\n "access": "public"\n }\n ],\n "events": [\n {\n "name": "Created",\n "ty": "Created"\n },\n {\n "name": "Updated",\n "ty": "Updated"\n }\n ],\n "call": {\n "wasm_file_name": "MyContract.wasm",\n "description": "Initializes the contract, sets the name and owner and emits an event",\n "arguments": [\n {\n "name": "odra_cfg_package_hash_key_name",\n "description": "The arg name for the package hash key name.",\n "ty": "String",\n "optional": false\n },\n {\n "name": "odra_cfg_allow_key_override",\n "description": "The arg name for the allow key override.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "odra_cfg_is_upgradable",\n "description": "The arg name for the contract upgradeability setting.",\n "ty": "Bool",\n "optional": false\n },\n {\n "name": "name",\n "description": null,\n "ty": "String",\n "optional": false\n },\n {\n "name": "owner",\n "description": null,\n "ty": "Key",\n "optional": false\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"schema-fields"},"Schema Fields"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"casper_contract_schema_version")," is the version of the schema.\n",(0,r.kt)("inlineCode",{parentName:"li"},"toolchain")," is the version of the Rust compiler used to compile the contract."),(0,r.kt)("li",{parentName:"ul"},"Fields ",(0,r.kt)("inlineCode",{parentName:"li"},"authors"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"repository"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"homepage")," are optional and can be set in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_name")," is the name of the contract - by default is the module name, may be overriden by the module attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_version")," denotes the version of the contract, defaulting to the version specified in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Cargo.toml")," file, but can be overridden by the ",(0,r.kt)("inlineCode",{parentName:"li"},"module")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"types")," comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), and a list of members."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"errors")," is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_points")," is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to ",(0,r.kt)("inlineCode",{parentName:"li"},"null"),"), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"events")," is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in ",(0,r.kt)("inlineCode",{parentName:"li"},"types"),") of the event."),(0,r.kt)("li",{parentName:"ul"},"The ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," section provides details regarding the contract's ",(0,r.kt)("inlineCode",{parentName:"li"},"call")," function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/dd174fa2.4ef27673.js b/docs/assets/js/dd174fa2.4ef27673.js new file mode 100644 index 000000000..3fc5a3243 --- /dev/null +++ b/docs/assets/js/dd174fa2.4ef27673.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[58727],{86995:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.8.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.8.0/"},"next":{"title":"Installation","permalink":"/docs/0.8.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/ddaed26d.aa3a910a.js b/docs/assets/js/ddaed26d.aa3a910a.js new file mode 100644 index 000000000..f8a8d8548 --- /dev/null +++ b/docs/assets/js/ddaed26d.aa3a910a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[67759],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s(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 l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},13092:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",s={unversionedId:"basics/cargo-odra",id:"version-0.8.1/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.8.1/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.8.1/basics/cargo-odra",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.8.1/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.8.1/basics/directory-structure"}},l={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Generating contract schema",id:"generating-contract-schema",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them with various configurations."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This creates a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"The third available template is ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace"),", which creates a workspace with two projects, similar to the one created\nwith the ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template."),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.8.1 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it creates a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This creates a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"The most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It runs your tests against Odra's ",(0,r.kt)("inlineCode",{parentName:"p"},"MockVM"),". It is substantially faster than ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM"),"\nand implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra builds the project, generates the wasm files,\nspin up ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM")," instance, deploys the contracts onto it and runs the tests against it. Pretty neat."),(0,r.kt)("p",null,"Keep in mind that this is a lot slower than ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," and you cannot use the debugger.\nThis is why ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build\n")),(0,r.kt)("p",null,"If the build process finishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder.\nNotice, that this command does not require the ",(0,r.kt)("inlineCode",{parentName:"p"},"-b")," option."),(0,r.kt)("p",null,"If you want to build specific contract, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -c counter # you pass many comma separated contracts\n")),(0,r.kt)("h2",{id:"generating-contract-schema"},"Generating contract schema"),(0,r.kt)("p",null,"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"schema")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema \n")),(0,r.kt)("p",null,"This generates a schema file in JSON format for all your contracts and places them in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder.\nIf the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder does not exist, it creates the folder for you."),(0,r.kt)("p",null,"Like with the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," command, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option to generate a schema for a specific contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/de67a916.2900fd98.js b/docs/assets/js/de67a916.2900fd98.js new file mode 100644 index 000000000..cf2840456 --- /dev/null +++ b/docs/assets/js/de67a916.2900fd98.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[6156],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(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 i(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 l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p<o;p++)s[p]=a[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},63847:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-1.0.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-1.0.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/backends/casper",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"OdraVM",permalink:"/docs/backends/odra-vm"},next:{title:"Livenet",permalink:"/docs/backends/livenet"}},l={},p=[{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Deploying a contract to Casper network",id:"deploying-a-contract-to-casper-network",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement traits defined by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard"),", thankfully you can derive them using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::event]"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance,\nyou call ",(0,r.kt)("inlineCode",{parentName:"p"},"self.env().self_balance()"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"deploying-a-contract-to-casper-network"},"Deploying a contract to Casper network"),(0,r.kt)("p",null,"There would be no point in writing a contract if you couldn't deploy it to the blockchain.\nYou can do it in two ways: provided by the Casper itself: using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool\nor using the Odra's Livenet integration."),(0,r.kt)("p",null,"Let's explore the first option to better understand the process."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you wish, you can skip the following section and jump to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/livenet"},"Livenet integration"),".")),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you can pass some arguments to it.\nEvery contract written in Odra expects those arguments to be set:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Additionally, if required by the contract, you can pass constructor arguments."),(0,r.kt)("p",null,"When working with the test env via ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," or when using\n",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/livenet"},"Livenet integration")," this is handled automatically. However, if you rather use\n",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," directly, you have to pass them manually:"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/odra-casper/test-vm/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK. See an example in the ",(0,r.kt)("a",{parentName:"p",href:"../tutorials/using-proxy-caller"},"Tutorial section"),"."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/odra-vm"},"OdraVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/defc5a9a.fd6c2d8c.js b/docs/assets/js/defc5a9a.fd6c2d8c.js new file mode 100644 index 000000000..cb9f3c5c5 --- /dev/null +++ b/docs/assets/js/defc5a9a.fd6c2d8c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[85804],{57771:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/0.9.0/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/0.9.0/basics/native-token"},"next":{"title":"Delegate","permalink":"/docs/0.9.0/advanced/delegate"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/df1503d8.f2996f7b.js b/docs/assets/js/df1503d8.f2996f7b.js new file mode 100644 index 000000000..05a5c1d72 --- /dev/null +++ b/docs/assets/js/df1503d8.f2996f7b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[98445],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),i=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=i(e.components);return a.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=i(n),m=r,f=c["".concat(u,".").concat(m)]||c[m]||p[m]||s;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=c;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var i=2;i<s;i++)o[i]=n[i];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},14797:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>i});var a=n(87462),r=(n(67294),n(3905));const s={sidebar_position:5},o="Pausable",l={unversionedId:"tutorials/pauseable",id:"tutorials/pauseable",title:"Pausable",description:"The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.",source:"@site/docs/tutorials/pauseable.md",sourceDirName:"tutorials",slug:"/tutorials/pauseable",permalink:"/docs/next/tutorials/pauseable",draft:!1,tags:[],version:"current",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Access Control",permalink:"/docs/next/tutorials/access-control"},next:{title:"Ticketing System",permalink:"/docs/next/tutorials/nft"}},u={},i=[{value:"Code",id:"code",level:2},{value:"Events and Error",id:"events-and-error",level:3},{value:"Module definition",id:"module-definition",level:3},{value:"Checks and guards",id:"checks-and-guards",level:3},{value:"Actions",id:"actions",level:3},{value:"Pausable counter",id:"pausable-counter",level:2}],d={toc:i};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"pausable"},"Pausable"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently."),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"As always, we will start with defining functionalities of our module."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Check the state - is it paused or not."),(0,r.kt)("li",{parentName:"ol"},"State guards - a contract should stop execution if is in a state we don't expect."),(0,r.kt)("li",{parentName:"ol"},"Switch the state.")),(0,r.kt)("h3",{id:"events-and-error"},"Events and Error"),(0,r.kt)("p",null,"There just two errors that may occur: ",(0,r.kt)("inlineCode",{parentName:"p"},"PausedRequired"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"UnpausedRequired"),". We define them in a standard Odra way."),(0,r.kt)("p",null,"Events definition is highly uncomplicated: ",(0,r.kt)("inlineCode",{parentName:"p"},"Paused")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused")," events holds only the address of the pauser."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::Address;\n\n#[odra::odra_error]\npub enum Error {\n PausedRequired = 1_000,\n UnpausedRequired = 1_001,\n}\n\n#[odra::event]\npub struct Paused {\n pub account: Address\n}\n\n#[odra::event]\npub struct Unpaused {\n pub account: Address\n}\n")),(0,r.kt)("h3",{id:"module-definition"},"Module definition"),(0,r.kt)("p",null,"The module storage is extremely simple - has a single ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," of type bool, that indicates if a contract is paused."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"use odra::Var;\n...\n\n#[odra::module(events = [Paused, Unpaused])]\npub struct Pausable {\n is_paused: Var<bool>\n}\n")),(0,r.kt)("h3",{id:"checks-and-guards"},"Checks and guards"),(0,r.kt)("p",null,"Now, let's move to state checks and guards."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn is_paused(&self) -> bool {\n self.is_paused.get_or_default()\n }\n\n pub fn require_not_paused(&self) {\n if self.is_paused() {\n self.env().revert(Error::UnpausedRequired);\n }\n }\n\n pub fn require_paused(&self) {\n if !self.is_paused() {\n self.env().revert(Error::PausedRequired);\n }\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - as mentioned in the intro, the module is not intended to be a standalone contract, so the only ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," block is not annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::module")," and hence does not expose any entrypoint."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L2")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused()")," checks the contract state, if the Var ",(0,r.kt)("inlineCode",{parentName:"li"},"is_paused")," has not been initialized, the default value (false) is returned."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - to guarantee the code is executed when the contract is not paused, ",(0,r.kt)("inlineCode",{parentName:"li"},"require_not_paused()")," function reads the state and reverts if the contract is paused. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L12")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"require_paused()")," is a mirror function - stops the contract execution if the contract is not paused.")),(0,r.kt)("h3",{id:"actions"},"Actions"),(0,r.kt)("p",null,"Finally, we will add the ability to switch the module state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"impl Pausable {\n pub fn pause(&mut self) {\n self.require_not_paused();\n self.is_paused.set(true);\n\n self.env().emit_event(Paused {\n account: self.env().caller()\n });\n }\n\n pub fn unpause(&mut self) {\n self.require_paused();\n self.is_paused.set(false);\n\n self.env().emit_event(Unpaused {\n account: self.env().caller()\n });\n }\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"pause()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()")," functions do three things: ensure the contract is the right state (unpaused for ",(0,r.kt)("inlineCode",{parentName:"p"},"pause()"),", not paused for ",(0,r.kt)("inlineCode",{parentName:"p"},"unpause()"),"), updates the state, and finally emits events (",(0,r.kt)("inlineCode",{parentName:"p"},"Paused"),"/",(0,r.kt)("inlineCode",{parentName:"p"},"Unpaused"),")."),(0,r.kt)("h2",{id:"pausable-counter"},"Pausable counter"),(0,r.kt)("p",null,"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called ",(0,r.kt)("inlineCode",{parentName:"p"},"PausableCounter"),". The contract consists of a Var ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Pausable")," module. The counter can only be incremented if the contract is in a normal state (is not paused)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=pauseable.rs showLineNumbers",title:"pauseable.rs",showLineNumbers:!0},"...\nuse odra::SubModule;\n...\n\n#[odra::module]\npub struct PausableCounter {\n value: Var<u32>,\n pauseable: SubModule<Pausable>\n}\n\n#[odra::module]\nimpl PausableCounter {\n pub fn increment(&mut self) {\n self.pauseable.require_not_paused();\n\n let new_value = self.value.get_or_default() + 1;\n self.value.set(new_value);\n }\n\n pub fn pause(&mut self) {\n self.pauseable.pause();\n }\n\n pub fn unpause(&mut self) {\n self.pauseable.unpause();\n }\n\n pub fn get_value(&self) -> u32 {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn increment_only_if_unpaused() {\n let test_env = odra_test::env();\n let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);\n contract.increment();\n contract.pause();\n\n assert_eq!(\n contract.try_increment().unwrap_err(),\n Error::UnpausedRequired.into()\n );\n assert_eq!(contract.get_value(), 1);\n }\n}\n")),(0,r.kt)("p",null,"As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/dfe71587.ab442927.js b/docs/assets/js/dfe71587.ab442927.js new file mode 100644 index 000000000..452e237e0 --- /dev/null +++ b/docs/assets/js/dfe71587.ab442927.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[34267],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s(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 l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},47821:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",s={unversionedId:"basics/cargo-odra",id:"version-0.8.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.8.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.8.0/basics/cargo-odra",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.8.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.8.0/basics/directory-structure"}},l={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Generating contract schema",id:"generating-contract-schema",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them with various configurations."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This creates a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"The third available template is ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace"),", which creates a workspace with two projects, similar to the one created\nwith the ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template."),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.8.0 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it creates a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This creates a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.8.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"The most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It runs your tests against Odra's ",(0,r.kt)("inlineCode",{parentName:"p"},"MockVM"),". It is substantially faster than ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM"),"\nand implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra builds the project, generates the wasm files,\nspin up ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM")," instance, deploys the contracts onto it and runs the tests against it. Pretty neat."),(0,r.kt)("p",null,"Keep in mind that this is a lot slower than ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," and you cannot use the debugger.\nThis is why ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build\n")),(0,r.kt)("p",null,"If the build process finishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder.\nNotice, that this command does not require the ",(0,r.kt)("inlineCode",{parentName:"p"},"-b")," option."),(0,r.kt)("p",null,"If you want to build specific contract, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -c counter # you pass many comma separated contracts\n")),(0,r.kt)("h2",{id:"generating-contract-schema"},"Generating contract schema"),(0,r.kt)("p",null,"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"schema")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema \n")),(0,r.kt)("p",null,"This generates a schema file in JSON format for all your contracts and places them in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder.\nIf the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder does not exist, it creates the folder for you."),(0,r.kt)("p",null,"Like with the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," command, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option to generate a schema for a specific contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e018be55.507669d8.js b/docs/assets/js/e018be55.507669d8.js new file mode 100644 index 000000000..be352c440 --- /dev/null +++ b/docs/assets/js/e018be55.507669d8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[99314],{36590:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/next/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/next/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/next/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/e07dea01.712046fc.js b/docs/assets/js/e07dea01.712046fc.js new file mode 100644 index 000000000..f89aef843 --- /dev/null +++ b/docs/assets/js/e07dea01.712046fc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[15924],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,o,r=function(e,n){if(null==e)return{};var t,o,r={},s=Object.keys(e);for(o=0;o<s.length;o++)t=s[o],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)t=s[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=o.createContext({}),m=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},d=function(e){var n=m(e.components);return o.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},p=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=m(t),u=r,h=p["".concat(l,".").concat(u)]||p[u]||c[u]||s;return t?o.createElement(h,a(a({ref:n},d),{},{components:t})):o.createElement(h,a({ref:n},d))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var s=t.length,a=new Array(s);a[0]=p;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,a[1]=i;for(var m=2;m<s;m++)a[m]=t[m];return o.createElement.apply(null,a)}return o.createElement.apply(null,t)}p.displayName="MDXCreateElement"},17137:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>c,frontMatter:()=>s,metadata:()=>i,toc:()=>m});var o=t(87462),r=(t(67294),t(3905));const s={sidebar_position:9},a="CEP-18",i={unversionedId:"tutorials/cep18",id:"version-1.0.0/tutorials/cep18",title:"CEP-18",description:"Not so different from ERC-20, the CEP-18 standard describes a fungible",source:"@site/versioned_docs/version-1.0.0/tutorials/cep18.md",sourceDirName:"tutorials",slug:"/tutorials/cep18",permalink:"/docs/tutorials/cep18",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9},sidebar:"tutorialSidebar",previous:{title:"Using Proxy Caller",permalink:"/docs/tutorials/using-proxy-caller"},next:{title:"Odra for Solidity developers",permalink:"/docs/tutorials/odra-solidity"}},l={},m=[{value:"Self-governing token",id:"self-governing-token",level:2},{value:"Token implementation",id:"token-implementation",level:2},{value:"Governance implementation",id:"governance-implementation",level:2},{value:"Voting mechanism",id:"voting-mechanism",level:3},{value:"Storage",id:"storage",level:4},{value:"Proposing a new mint",id:"proposing-a-new-mint",level:4},{value:"Voting for the mint",id:"voting-for-the-mint",level:4},{value:"Tallying the votes",id:"tallying-the-votes",level:4},{value:"Testing",id:"testing",level:3},{value:"What's next",id:"whats-next",level:2},{value:"Complete code",id:"complete-code",level:2}],d={toc:m};function c(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cep-18"},"CEP-18"),(0,r.kt)("p",null,"Not so different from ERC-20, the CEP-18 standard describes a fungible\ntoken interface, but for the Casper network.\nThere are some differences, which will be shown in this tutorial.\nThe most visible one however, is the compatibility with the Casper Ecosystem."),(0,r.kt)("p",null,"In our example, we will implement a CEP-18 token with a simple self-governance mechanism.\nWe will also deploy our token on the Casper network, and interact with it."),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"This implementation of the governance in this tutorial is by no means\na complete one, and should not be used in production.")),(0,r.kt)("h2",{id:"self-governing-token"},"Self-governing token"),(0,r.kt)("p",null,"There are many ways to implement a governance mechanism for a token,\neach more complex than the other. In our example, we will use a simple\none, where the community of token holders can vote to mint new tokens."),(0,r.kt)("h2",{id:"token-implementation"},"Token implementation"),(0,r.kt)("p",null,"Let's start by creating a new project, choosing a clever name and using\ncep18 as our starting template:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name ourcoin --template cep18\n")),(0,r.kt)("p",null,"Let's glance at our token code:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"#[odra::module]\npub struct MyToken {\n token: SubModule<Cep18>,\n}\n\nimpl MyToken {\n // Delegate all Cep18 functions to the token sub-module.\n delegate! {\n to self.token {\n ...\n fn name(&self) -> String;\n fn symbol(&self) -> String;\n ...\n")),(0,r.kt)("p",null,"As we can see, it indeed uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"Cep18")," module and delegates\nall the methods to it."),(0,r.kt)("p",null,"The only thing to do is to change the name of the struct to more\nappropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"OurToken"),", run the provided tests using ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra test"),",\nand continue with the implementation of the governance."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Remember to change the name of the struct and its usages as well as\nthe struct name in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file!")),(0,r.kt)("h2",{id:"governance-implementation"},"Governance implementation"),(0,r.kt)("p",null,"Let's go through the process of implementing the governance mechanism.\nIf we don't want to, we don't have to hide entrypoints from the public responsible\nfor minting new tokens. By default, minting ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/casper-ecosystem/cep18/tree/dev/cep18#modalities"},"Modality"),"\nis turned off, so any attempt of direct minting will result in an error."),(0,r.kt)("p",null,"We will however implement a voting mechanism, where the token holders can vote\nto mint new tokens."),(0,r.kt)("h3",{id:"voting-mechanism"},"Voting mechanism"),(0,r.kt)("p",null,"Our voting system will be straightforward:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Anyone with the tokens can propose a new mint."),(0,r.kt)("li",{parentName:"ol"},"Anyone with the tokens can vote for the new mint by staking their tokens."),(0,r.kt)("li",{parentName:"ol"},"If the majority of the token holders vote for the mint, it is executed.")),(0,r.kt)("h4",{id:"storage"},"Storage"),(0,r.kt)("p",null,"We will need to store some additional information about the votes, so let's\nadd some fields to our token struct:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"#[odra::module]\npub struct OurToken {\n /// A sub-module that implements the CEP-18 token standard.\n token: SubModule<Cep18>,\n /// The proposed mint.\n proposed_mint: Var<(Address, U256)>,\n /// The list of votes cast in the current vote.\n votes: List<Ballot>,\n /// Whether a vote is open.\n is_vote_open: Var<bool>,\n /// The time when the vote ends.\n vote_end_time: Var<u64>,\n}\n\n/// A ballot cast by a voter.\n#[odra::odra_type]\nstruct Ballot {\n voter: Address,\n choice: bool,\n amount: U256,\n}\n")),(0,r.kt)("p",null,"Notice that ",(0,r.kt)("inlineCode",{parentName:"p"},"proposed_mint")," contains a tuple containing the address of\nthe proposer and the amount of tokens to mint. Moreover, we need to keep track if\nthe vote time has ended, but also if it was already tallied, that's why\nwe need both ",(0,r.kt)("inlineCode",{parentName:"p"},"is_vote_open")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"vote_end_time"),"."),(0,r.kt)("p",null,"We will also use the power of the ",(0,r.kt)("a",{parentName:"p",href:"../basics/storage-interaction#list"},"List"),"\ntype to store the ",(0,r.kt)("inlineCode",{parentName:"p"},"Ballots"),"."),(0,r.kt)("h4",{id:"proposing-a-new-mint"},"Proposing a new mint"),(0,r.kt)("p",null,"To implement the endpoint that allows token holders to propose a new mint,\nwe need to add a new function to our token module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"/// Proposes a new mint for the contract.\npub fn propose_new_mint(&mut self, account: Address, amount: U256) {\n // Only allow proposing a new mint if there is no vote in progress.\n if self.is_vote_open().get_or_default() {\n self.env().revert(GovernanceError::VoteAlreadyOpen);\n }\n\n // Only the token holders can propose a new mint.\n if self.balance_of(&self.env().caller()) == U256::zero() {\n self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose);\n }\n\n // Set the proposed mint.\n self.proposed_mint.set((account, amount));\n // Open a vote.\n self.is_vote_open.set(true);\n // Set the vote end time to 10 minutes from now.\n self.vote_end_time\n .set(self.env().get_block_time() + 60 * 10 * 1000);\n}\n")),(0,r.kt)("p",null,"As a parameters to the function, we pass the address of the account that should be the receiver of\nthe minted tokens, and the amount."),(0,r.kt)("p",null,"After some validation, we open the vote by setting the ",(0,r.kt)("inlineCode",{parentName:"p"},"is_vote_open")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),",\nand setting the ",(0,r.kt)("inlineCode",{parentName:"p"},"vote_end_time")," to 10 minutes. In real-world scenarios,\nthe time could be configurable, but for the sake of simplicity, we hardcoded it.\nAlso, it should be quite longer than 10 minutes, but it will come in handy\nwhen we test it on Livenet."),(0,r.kt)("h4",{id:"voting-for-the-mint"},"Voting for the mint"),(0,r.kt)("p",null,"Next, we need an endpoint that will allow us to cast a ballot:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"/// Votes on the proposed mint.\npub fn vote(&mut self, choice: bool, amount: U256) {\n // Only allow voting if there is a vote in progress.\n self.assert_vote_in_progress();\n\n let voter = self.env().caller();\n let contract = self.env().self_address();\n\n // Transfer the voting tokens from the voter to the contract.\n self.token\n .transfer(&contract, &amount);\n\n // Add the vote to the list.\n self.votes.push(Ballot {\n voter,\n choice,\n amount,\n });\n}\n")),(0,r.kt)("p",null,"The most interesting thing here is that we are using a mechanism of staking,\nwhere we transfer our tokens to the contract, to show that we really mean it."),(0,r.kt)("p",null,"The tokens will be locked until the vote is over, and tallied."),(0,r.kt)("p",null,"Speaking of tallying..."),(0,r.kt)("h4",{id:"tallying-the-votes"},"Tallying the votes"),(0,r.kt)("p",null,"The last step is to tally the votes and mint the tokens if the majority\nof voters agreed to do so:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},"/// Count the votes and perform the action\npub fn tally(&mut self) {\n // Only allow tallying the votes once.\n if !self.is_vote_open.get_or_default()\n {\n self.env().revert(GovernanceError::NoVoteInProgress);\n }\n\n // Only allow tallying the votes after the vote has ended.\n let finish_time = self\n .vote_end_time\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n if self.env().get_block_time() < finish_time {\n self.env().revert(GovernanceError::VoteNotYetEnded);\n }\n\n // Count the votes\n let mut yes_votes = U256::zero();\n let mut no_votes = U256::zero();\n\n let contract = self.env().self_address();\n\n while let Some(vote) = self.votes.pop() {\n if vote.choice {\n yes_votes += vote.amount;\n } else {\n no_votes += vote.amount;\n }\n\n // Transfer back the voting tokens to the voter.\n self.token.raw_transfer(&contract, &vote.voter, &vote.amount);\n }\n\n // Perform the action if the vote has passed.\n if yes_votes > no_votes {\n let (account, amount) = self\n .proposed_mint\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n self.token.raw_mint(&account, &amount);\n }\n\n // Close the vote.\n self.is_vote_open.set(false);\n}\n")),(0,r.kt)("p",null,"Notice how we used ",(0,r.kt)("inlineCode",{parentName:"p"},"raw_transfer")," from the ",(0,r.kt)("inlineCode",{parentName:"p"},"Cep18")," module. We used it\nto set the sender, so the contract's balance will be used, instead of\nthe caller's."),(0,r.kt)("p",null,"Additonally, we used ",(0,r.kt)("inlineCode",{parentName:"p"},"raw_mint")," to mint the tokens, skipping the security\nchecks. We have no modality for minting, but even if we had, we don't\nhave anyone with permissions! The Contract needs to mint the tokens itself."),(0,r.kt)("h3",{id:"testing"},"Testing"),(0,r.kt)("p",null,"Now, we will put our implementation to the test. One unit test, that we can\nrun both on OdraVM and on the CasperVM."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},'#[test]\nfn it_works() {\n let env = odra_test::env();\n let init_args = OurTokenInitArgs {\n name: "OurToken".to_string(),\n symbol: "OT".to_string(),\n decimals: 0,\n initial_supply: U256::from(1_000u64),\n };\n\n let mut token = OurTokenHostRef::deploy(&env, init_args);\n\n // The deployer, as the only token holder,\n // starts a new voting to mint 1000 tokens to account 1.\n // There is only 1 token holder, so there is one Ballot cast.\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(1000));\n\n // The tokens should now be staked.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());\n\n // Wait for the vote to end.\n env.advance_block_time(60 * 11 * 1000);\n\n // Finish the vote.\n token.tally();\n\n // The tokens should now be minted.\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));\n assert_eq!(token.total_supply(), 3000.into());\n\n // The stake should be returned.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));\n\n // Now account 1 can mint new tokens with their voting power...\n env.set_caller(env.get_account(1));\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(2000));\n\n // ...Even if the deployer votes against it.\n env.set_caller(env.get_account(0));\n token.vote(false, U256::from(1000));\n\n env.advance_block_time(60 * 11 * 1000);\n\n token.tally();\n\n // The power of community governance!\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));\n}\n')),(0,r.kt)("p",null,"We can run the test using both methods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\ncargo odra test -b casper\n")),(0,r.kt)("p",null,"It is all nice and green, but it would be really nice to see it in action."),(0,r.kt)("p",null,"How about deploying it on the Casper network?"),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will se our token in action, by ",(0,r.kt)("a",{parentName:"p",href:"deploying-on-casper"},"deploying it on the Casper network"),",\nand using tools from the Casper Ecosystem to interact with it."),(0,r.kt)("h2",{id:"complete-code"},"Complete code"),(0,r.kt)("p",null,"Here is the complete code of the ",(0,r.kt)("inlineCode",{parentName:"p"},"OurToken")," module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'showLineNumbers title="src/token.rs"',showLineNumbers:!0,title:'"src/token.rs"'},'use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var};\nuse odra_modules::cep18_token::Cep18;\n\n/// A ballot cast by a voter.\n#[odra::odra_type]\nstruct Ballot {\n voter: Address,\n choice: bool,\n amount: U256,\n}\n\n/// Errors for the governed token.\n#[odra::odra_error]\npub enum GovernanceError {\n /// The vote is already in progress.\n VoteAlreadyOpen = 0,\n /// No vote is in progress.\n NoVoteInProgress = 1,\n /// Cannot tally votes yet.\n VoteNotYetEnded = 2,\n /// Vote ended\n VoteEnded = 3,\n /// Only the token holders can propose a new mint.\n OnlyTokenHoldersCanPropose = 4,\n}\n\n/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct OurToken {\n /// A submodule that implements the CEP-18 token standard.\n token: SubModule<Cep18>,\n /// The proposed mint.\n proposed_mint: Var<(Address, U256)>,\n /// The list of votes cast in the current vote.\n votes: List<Ballot>,\n /// Whether a vote is open.\n is_vote_open: Var<bool>,\n /// The time when the vote ends.\n vote_end_time: Var<u64>,\n}\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl OurToken {\n /// Initializes the contract with the given metadata and initial supply.\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n // We put the token address as an admin, so it can govern itself. Self-governing token!\n self.token\n .init(symbol, name, decimals, initial_supply, vec![], vec![], None);\n }\n\n // Delegate all Cep18 functions to the token submodule.\n delegate! {\n to self.token {\n /// Admin EntryPoint to manipulate the security access granted to users.\n /// One user can only possess one access group badge.\n /// Change strength: None > Admin > Minter\n /// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an\n /// Admin, also if a user is added to Admin and None then they will be removed from having rights.\n /// Beware: do not remove the last Admin because that will lock out all admin functionality.\n fn change_security(\n &mut self,\n admin_list: Vec<Address>,\n minter_list: Vec<Address>,\n none_list: Vec<Address>\n );\n\n /// Returns the name of the token.\n fn name(&self) -> String;\n\n /// Returns the symbol of the token.\n fn symbol(&self) -> String;\n\n /// Returns the number of decimals the token uses.\n fn decimals(&self) -> u8;\n\n /// Returns the total supply of the token.\n fn total_supply(&self) -> U256;\n\n /// Returns the balance of the given address.\n fn balance_of(&self, address: &Address) -> U256;\n\n /// Returns the amount of tokens the owner has allowed the spender to spend.\n fn allowance(&self, owner: &Address, spender: &Address) -> U256;\n\n /// Approves the spender to spend the given amount of tokens on behalf of the caller.\n fn approve(&mut self, spender: &Address, amount: &U256);\n\n /// Decreases the allowance of the spender by the given amount.\n fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256);\n\n /// Increases the allowance of the spender by the given amount.\n fn increase_allowance(&mut self, spender: &Address, inc_by: &U256);\n\n /// Transfers tokens from the caller to the recipient.\n fn transfer(&mut self, recipient: &Address, amount: &U256);\n\n /// Transfers tokens from the owner to the recipient using the spender\'s allowance.\n fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256);\n\n /// Mints new tokens and assigns them to the given address.\n fn mint(&mut self, owner: &Address, amount: &U256);\n\n /// Burns the given amount of tokens from the given address.\n fn burn(&mut self, owner: &Address, amount: &U256);\n }\n }\n\n /// Proposes a new mint for the contract.\n pub fn propose_new_mint(&mut self, account: Address, amount: U256) {\n // Only allow proposing a new mint if there is no vote in progress.\n if self.is_vote_open.get_or_default() {\n self.env().revert(GovernanceError::VoteAlreadyOpen);\n }\n\n // Only the token holders can propose a new mint.\n if self.balance_of(&self.env().caller()) == U256::zero() {\n self.env()\n .revert(GovernanceError::OnlyTokenHoldersCanPropose);\n }\n\n // Set the proposed mint.\n self.proposed_mint.set((account, amount));\n // Open a vote.\n self.is_vote_open.set(true);\n // Set the vote end time to 10 minutes from now.\n self.vote_end_time\n .set(self.env().get_block_time() + 10 * 60 * 1000);\n }\n\n /// Votes on the proposed mint.\n pub fn vote(&mut self, choice: bool, amount: U256) {\n // Only allow voting if there is a vote in progress.\n self.assert_vote_in_progress();\n\n let voter = self.env().caller();\n let contract = self.env().self_address();\n\n // Transfer the voting tokens from the voter to the contract.\n self.token.transfer(&contract, &amount);\n\n // Add the vote to the list.\n self.votes.push(Ballot {\n voter,\n choice,\n amount,\n });\n }\n\n /// Count the votes and perform the action\n pub fn tally(&mut self) {\n // Only allow tallying the votes once.\n if !self.is_vote_open.get_or_default() {\n self.env().revert(GovernanceError::NoVoteInProgress);\n }\n\n // Only allow tallying the votes after the vote has ended.\n let finish_time = self\n .vote_end_time\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n if self.env().get_block_time() < finish_time {\n self.env().revert(GovernanceError::VoteNotYetEnded);\n }\n\n // Count the votes\n let mut yes_votes = U256::zero();\n let mut no_votes = U256::zero();\n\n let contract = self.env().self_address();\n\n while let Some(vote) = self.votes.pop() {\n if vote.choice {\n yes_votes += vote.amount;\n } else {\n no_votes += vote.amount;\n }\n\n // Transfer back the voting tokens to the voter.\n self.token\n .raw_transfer(&contract, &vote.voter, &vote.amount);\n }\n\n // Perform the action if the vote has passed.\n if yes_votes > no_votes {\n let (account, amount) = self\n .proposed_mint\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n self.token.raw_mint(&account, &amount);\n }\n\n // Close the vote.\n self.is_vote_open.set(false);\n }\n\n fn assert_vote_in_progress(&self) {\n if !self.is_vote_open.get_or_default() {\n self.env().revert(GovernanceError::NoVoteInProgress);\n }\n\n let finish_time = self\n .vote_end_time\n .get_or_revert_with(GovernanceError::NoVoteInProgress);\n\n if self.env().get_block_time() > finish_time {\n self.env().revert(GovernanceError::VoteEnded);\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::Deployer;\n\n #[test]\n fn it_works() {\n let env = odra_test::env();\n let init_args = OurTokenInitArgs {\n name: "OurToken".to_string(),\n symbol: "OT".to_string(),\n decimals: 0,\n initial_supply: U256::from(1_000u64),\n };\n\n let mut token = OurTokenHostRef::deploy(&env, init_args);\n\n // The deployer, as the only token holder,\n // starts a new voting to mint 1000 tokens to account 1.\n // There is only 1 token holder, so there is one Ballot cast.\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(1000));\n\n // The tokens should now be staked.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());\n\n // Wait for the vote to end.\n env.advance_block_time(60 * 11 * 1000);\n\n // Finish the vote.\n token.tally();\n\n // The tokens should now be minted.\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));\n assert_eq!(token.total_supply(), 3000.into());\n\n // The stake should be returned.\n assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));\n\n // Now account 1 can mint new tokens with their voting power...\n env.set_caller(env.get_account(1));\n token.propose_new_mint(env.get_account(1), U256::from(2000));\n token.vote(true, U256::from(2000));\n\n // ...Even if the deployer votes against it.\n env.set_caller(env.get_account(0));\n token.vote(false, U256::from(1000));\n\n env.advance_block_time(60 * 11 * 1000);\n\n token.tally();\n\n // The power of community governance!\n assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e2022d8c.86b488fd.js b/docs/assets/js/e2022d8c.86b488fd.js new file mode 100644 index 000000000..e3f5203f3 --- /dev/null +++ b/docs/assets/js/e2022d8c.86b488fd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52701],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=d(n),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return n?a.createElement(w,o(o({ref:t},u),{},{components:n})):a.createElement(w,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d<i;d++)o[d]=n[d];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},86058:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/docs/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/next/tutorials/ownable",draft:!1,tags:[],version:"current",lastUpdatedAt:1718616680,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/next/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/next/tutorials/erc20"}},s={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining a constructor,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(events = [OwnershipChanged])]\npub struct Ownable {\n owner: Var<Option<Address>>\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basics before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4")," - Firstly, we need to create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module(events = [OwnershipChanged])]")," attribute to it. The ",(0,r.kt)("inlineCode",{parentName:"li"},"events")," attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," is a type that will be defined later."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n pub fn init(&mut self, owner: Address) {\n if self.owner.get_or_default().is_some() {\n self.env().revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(Some(owner));\n \n self.env().emit_event(OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n });\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerIsAlreadyInitialized = 1,\n}\n\n#[odra::event]\npub struct OwnershipChanged {\n pub prev_owner: Option<Address>,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an Odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is a constructor. This matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-L20")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]")," attribute is applied to the enum. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into<odra::OdraError>")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4-L6")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::revert()")," function with an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsAlreadyInitialized")," argument. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Then we write the owner passed as an argument to the storage. To do so, we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22-L26")," - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::event]")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L10")," - Finally, call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::emit_event()")," passing the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," instance to the function. Hence, we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),". ")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get_or_default().as_ref() {\n self.env().revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&self.env().caller());\n let current_owner = self.get_owner();\n self.owner.set(Some(*new_owner));\n self.env().emit_event(OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n });\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get_or_default() {\n Some(owner) => owner,\n None => self.env().revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n NotOwner = 1,\n OwnerIsAlreadyInitialized = 2,\n OwnerIsNotInitialized = 3,\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7,L31")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," reads the current owner and reverts if it does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also, we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum by adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in the ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::caller()")," function. Then we update the state and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L21,L33")," - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),". There is one worth-mentioning subtlety: ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," function returns ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<T>"),". If the type implements the ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call the ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function, and the contract does not fail even if the value is not initialized. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"owner")," is of type ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<Address>")," the ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," would return ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<Option<Address>>"),", we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get_or_default()")," instead.")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::{Deployer, HostEnv, HostRef};\n\n fn setup() -> (OwnableHostRef, HostEnv, Address) {\n let env: HostEnv = odra_test::env();\n let init_args = OwnableInitArgs {\n owner: env.get_account(0)\n };\n (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))\n }\n\n #[test]\n fn initialization_works() {\n let (ownable, env, owner) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n env.emitted_event(\n &ownable,\n &OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (mut ownable, env, owner) = setup();\n let new_owner = env.get_account(1);\n \n env.set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n\n env.emitted_event(\n &ownable,\n &OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (mut ownable, env, _) = setup();\n let new_owner = env.get_account(1);\n ownable.change_ownership(&new_owner);\n \n assert_eq!(\n ownable.try_change_ownership(&new_owner), \n Err(Error::NotOwner.into())\n );\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we have defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, which we call in the first statement of each test. Take a look at the signature: ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (OwnableHostRef, HostEnv, Address)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef")," is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7-L11")," - The starting point of every test is getting an instance of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," by calling ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),". Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," attribute implements a ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer")," for ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableInitArgs")," that we pass as the second argument of the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function. Lastly, the module needs an owner. The easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". We choose the address of first account (which is the default one). "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - It is time to define the first test. As you see, it is a regular Rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16-17")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L19-25")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event to have been emitted. To assert that, let's use ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". To get the env, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"env()")," on the contract, then call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::emitted_event"),". As the first argument, pass the contract you want to read events from, followed by an event as you expect it to have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L31")," - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L33")," - As mentioned, the default is the 0th account, if you want to change the executor, call the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L46-55")," - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::try_change_ownership()")," instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::change_ownership()"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," provides try_ functions for each contract's entrypoint. The ",(0,r.kt)("inlineCode",{parentName:"li"},"try")," functions return ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraResult")," (an alias for ",(0,r.kt)("inlineCode",{parentName:"li"},"Result<T, OdraError>"),") instead of panicking and halting the execution. In our case, we expect the contract to revert with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::NotOwner")," error. To compare the error, we use the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::into()")," function, which converts the error into the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," type.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e2724f12.86ac1af1.js b/docs/assets/js/e2724f12.86ac1af1.js new file mode 100644 index 000000000..4f18ce169 --- /dev/null +++ b/docs/assets/js/e2724f12.86ac1af1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[9370],{50583:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.7.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.7.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.7.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/e294fa30.15b9ed1a.js b/docs/assets/js/e294fa30.15b9ed1a.js new file mode 100644 index 000000000..da7cf1697 --- /dev/null +++ b/docs/assets/js/e294fa30.15b9ed1a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[94023],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},95086:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"version-0.7.0/basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/versioned_docs/version-0.7.0/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/0.7.0/basics/communicating-with-host",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/0.7.0/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/0.7.0/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"host-communication"},"Host Communication"),(0,o.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::Variable;\nuse odra::types::{BlockTime, Address};\n\n#[odra::module]\npub struct HostContract {\n name: Variable<String>,\n created_at: Variable<BlockTime>,\n created_by: Variable<Address>,\n}\n\n#[odra::module]\nimpl HostContract {\n #[odra(init)]\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(odra::contract_env::get_block_time());\n self.created_by.set(odra::contract_env::caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,o.kt)("p",null,"As you can see, we are calling functions from ",(0,o.kt)("inlineCode",{parentName:"p"},"odra::contract_env"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"get_block_time()")," will return\nthe current block time wrapped in Odra type ",(0,o.kt)("inlineCode",{parentName:"p"},"BlockTime"),". ",(0,o.kt)("inlineCode",{parentName:"p"},"caller()")," will return an Odra ",(0,o.kt)("inlineCode",{parentName:"p"},"Address")," of\na caller (this can be an external caller or another contract)."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e309b9ad.468e192c.js b/docs/assets/js/e309b9ad.468e192c.js new file mode 100644 index 000000000..78ccd384b --- /dev/null +++ b/docs/assets/js/e309b9ad.468e192c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[18355],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},23399:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",s={unversionedId:"getting-started/flipper",id:"version-0.9.1/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.9.1/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.9.1/getting-started/flipper",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.9.1/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.9.1/category/basics"}},i={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.1/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.9.1/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Var;\n\n/// A module definition. Each module struct consists Vars and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Var<bool>,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor, must be named `init`.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let env = odra_test::env();\n let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);\n let contract2 = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To run the tests, execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test # or add the `-b casper` flag to run tests on the CasperVM\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e30c7d5f.25efb038.js b/docs/assets/js/e30c7d5f.25efb038.js new file mode 100644 index 000000000..5217551a7 --- /dev/null +++ b/docs/assets/js/e30c7d5f.25efb038.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[14665],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),u=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=u(e.components);return r.createElement(i.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=u(t),m=a,f=c["".concat(i,".").concat(m)]||c[m]||p[m]||s;return t?r.createElement(f,o(o({ref:n},d),{},{components:t})):r.createElement(f,o({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=c;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var u=2;u<s;u++)o[u]=t[u];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},85162:(e,n,t)=>{t.d(n,{Z:()=>o});var r=t(67294),a=t(86010);const s="tabItem_Ymn6";function o(e){let{children:n,hidden:t,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(s,o),hidden:t},n)}},74866:(e,n,t)=>{t.d(n,{Z:()=>_});var r=t(87462),a=t(67294),s=t(86010),o=t(12466),l=t(16550),i=t(91980),u=t(67392),d=t(50012);function p(e){return function(e){return a.Children.map(e,(e=>{if((0,a.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}function c(e){const{values:n,children:t}=e;return(0,a.useMemo)((()=>{const e=n??p(t);return function(e){const n=(0,u.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function m(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function f(e){let{queryString:n=!1,groupId:t}=e;const r=(0,l.k6)(),s=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(s),(0,a.useCallback)((e=>{if(!s)return;const n=new URLSearchParams(r.location.search);n.set(s,e),r.replace({...r.location,search:n.toString()})}),[s,r])]}function b(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,s=c(e),[o,l]=(0,a.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!m({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:s}))),[i,u]=f({queryString:t,groupId:r}),[p,b]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,s]=(0,d.Nk)(t);return[r,(0,a.useCallback)((e=>{t&&s.set(e)}),[t,s])]}({groupId:r}),g=(()=>{const e=i??p;return m({value:e,tabValues:s})?e:null})();(0,a.useLayoutEffect)((()=>{g&&l(g)}),[g]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),b(e)}),[u,b,s]),tabValues:s}}var g=t(72389);const v="tabList__CuJ",h="tabItem_LNqP";function y(e){let{className:n,block:t,selectedValue:l,selectValue:i,tabValues:u}=e;const d=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),c=e=>{const n=e.currentTarget,t=d.indexOf(n),r=u[t].value;r!==l&&(p(n),i(r))},m=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;n=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;n=d[t]??d[d.length-1];break}}n?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":t},n)},u.map((e=>{let{value:n,label:t,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===n?0:-1,"aria-selected":l===n,key:n,ref:e=>d.push(e),onKeyDown:m,onClick:c},o,{className:(0,s.Z)("tabs__item",h,o?.className,{"tabs__item--active":l===n})}),t??n)})))}function w(e){let{lazy:n,children:t,selectedValue:r}=e;if(t=Array.isArray(t)?t:[t],n){const e=t.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},t.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r}))))}function k(e){const n=b(e);return a.createElement("div",{className:(0,s.Z)("tabs-container",v)},a.createElement(y,(0,r.Z)({},e,n)),a.createElement(w,(0,r.Z)({},e,n)))}function _(e){const n=(0,g.Z)();return a.createElement(k,(0,r.Z)({key:String(n)},e))}},86159:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>p});var r=t(87462),a=(t(67294),t(3905)),s=t(74866),o=t(85162);const l={sidebar_position:2,description:"Migration guide to v0.9.0"},i="Migration guide to v0.9.0",u={unversionedId:"migrations/to-0.9.0",id:"version-0.9.0/migrations/to-0.9.0",title:"Migration guide to v0.9.0",description:"Migration guide to v0.9.0",source:"@site/versioned_docs/version-0.9.0/migrations/to-0.9.0.md",sourceDirName:"migrations",slug:"/migrations/to-0.9.0",permalink:"/docs/0.9.0/migrations/to-0.9.0",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Migration guide to v0.9.0"},sidebar:"tutorialSidebar",previous:{title:"Migration guide to v0.8.0",permalink:"/docs/0.9.0/migrations/to-0.8.0"}},d={},p=[{value:"<strong>1. Prerequisites</strong>",id:"1-prerequisites",level:2},{value:"1.1. <strong>Update cargo-odra</strong>",id:"11-update-cargo-odra",level:3},{value:"1.2. <strong>Review the Changelog</strong>",id:"12-review-the-changelog",level:3},{value:"<strong>2. Migration Steps</strong>",id:"2-migration-steps",level:2},{value:"2.1 <strong>Update build_schema.rs bin</strong>",id:"21-update-build_schemars-bin",level:3},{value:"2.2 <strong>Update smart contract code</strong>",id:"22-update-smart-contract-code",level:3},{value:"2.2.1. <strong>Update custom types definitions.</strong>",id:"221-update-custom-types-definitions",level:4},{value:"2.2.2. <strong>Update errors definitions.</strong>",id:"222-update-errors-definitions",level:4},{value:"2.2.3. <strong>Update events definitions.</strong>",id:"223-update-events-definitions",level:4},{value:"3. <strong>Code Examples</strong>",id:"3-code-examples",level:2},{value:"4. <strong>Troubleshooting</strong>",id:"4-troubleshooting",level:2},{value:"5. <strong>References</strong>",id:"5-references",level:2}],c={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migration-guide-to-v090"},"Migration guide to v0.9.0"),(0,a.kt)("p",null,"This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.7.1")," and below, start with the ",(0,a.kt)("a",{parentName:"p",href:"./to-0.8.0"},"previous guide"),". It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the ",(0,a.kt)("a",{parentName:"p",href:"../category/getting-started/"},"Getting Started"),"."),(0,a.kt)("p",null,"The most significant change in ",(0,a.kt)("inlineCode",{parentName:"p"},"0.9.0")," is the way of defining custom elements namely type, events and errors."),(0,a.kt)("h2",{id:"1-prerequisites"},(0,a.kt)("strong",{parentName:"h2"},"1. Prerequisites")),(0,a.kt)("h3",{id:"11-update-cargo-odra"},"1.1. ",(0,a.kt)("strong",{parentName:"h3"},"Update cargo-odra")),(0,a.kt)("p",null,"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra --force --locked\n")),(0,a.kt)("h3",{id:"12-review-the-changelog"},"1.2. ",(0,a.kt)("strong",{parentName:"h3"},"Review the Changelog")),(0,a.kt)("p",null,"Before you move to changing your code, start by reviewing the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")," to understand the changes introduced in v0.9.0."),(0,a.kt)("h2",{id:"2-migration-steps"},(0,a.kt)("strong",{parentName:"h2"},"2. Migration Steps")),(0,a.kt)("h3",{id:"21-update-build_schemars-bin"},"2.1 ",(0,a.kt)("strong",{parentName:"h3"},"Update build_schema.rs bin")),(0,a.kt)("p",null,"Odra 0.9.0 adds a new standardized way of generating contract schema - ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/casper-contract-schema"},"Casper Contract Schema"),". You can find the updated ",(0,a.kt)("inlineCode",{parentName:"p"},"build_schema.rs")," file in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.9.0/templates"},"templates")," directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace ",(0,a.kt)("inlineCode",{parentName:"p"},"{{project-name}}")," with the name of your project."),(0,a.kt)("h3",{id:"22-update-smart-contract-code"},"2.2 ",(0,a.kt)("strong",{parentName:"h3"},"Update smart contract code")),(0,a.kt)("p",null,"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes."),(0,a.kt)("h4",{id:"221-update-custom-types-definitions"},"2.2.1. ",(0,a.kt)("strong",{parentName:"h4"},"Update custom types definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraType)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::Address;\n\n#[odra::odra_type]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option<Address>\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, OdraType};\n\n#[derive(OdraType)]\npub struct Dog {\n pub name: String,\n pub age: u8,\n pub owner: Option<Address>\n}\n")))),(0,a.kt)("h4",{id:"222-update-errors-definitions"},"2.2.2. ",(0,a.kt)("strong",{parentName:"h4"},"Update errors definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(OdraError)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute.\nError enum should be passed as a parameter to the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */], errors = Error)]\npub struct Erc20 {\n // fields\n}\n\n#[odra::odra_error]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module(events = [/* events go here */])]\npub struct Erc20 {\n // fields\n}\n\nuse odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n}\n")))),(0,a.kt)("h4",{id:"223-update-events-definitions"},"2.2.3. ",(0,a.kt)("strong",{parentName:"h4"},"Update events definitions.")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"#[derive(Event)]")," attribute has been replace with ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::event]")," attribute."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256};\n\n#[odra::event]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"0.8.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::prelude::*;\nuse odra::{Address, casper_types::U256, Event};\n\n#[derive(Event, Eq, PartialEq, Debug)]\npub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n}\n")))),(0,a.kt)("h2",{id:"3-code-examples"},"3. ",(0,a.kt)("strong",{parentName:"h2"},"Code Examples")),(0,a.kt)("p",null,"Here is a complete example of a smart contract after and before the migration to v0.9.0."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"current",label:"0.9.0",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer], errors = Error)]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option<U256>\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(Error::NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(Error::InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(Error::InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(Error::InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address};\n\n #[odra::event]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[odra::event]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n #[odra::odra_error]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n"))),(0,a.kt)(o.Z,{value:"old",label:"Prev",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="src/erc20.rs"',title:'"src/erc20.rs"'},"use crate::erc20::errors::Error::*;\nuse crate::erc20::events::*;\nuse odra::prelude::*;\nuse odra::{casper_types::U256, Address, Mapping, Var};\n\n#[odra::module(events = [Approval, Transfer])]\npub struct Erc20 {\n decimals: Var<u8>,\n symbol: Var<String>,\n name: Var<String>,\n total_supply: Var<U256>,\n balances: Mapping<Address, U256>,\n allowances: Mapping<(Address, Address), U256>\n}\n\n#[odra::module]\nimpl Erc20 {\n pub fn init(\n &mut self,\n symbol: String,\n name: String,\n decimals: u8,\n initial_supply: Option<U256>\n ) {\n let caller = self.env().caller();\n self.symbol.set(symbol);\n self.name.set(name);\n self.decimals.set(decimals);\n\n if let Some(initial_supply) = initial_supply {\n self.total_supply.set(initial_supply);\n self.balances.set(&caller, initial_supply);\n\n if !initial_supply.is_zero() {\n self.env().emit_event(Transfer {\n from: None,\n to: Some(caller),\n amount: initial_supply\n });\n }\n }\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &U256) {\n let caller = self.env().caller();\n self.raw_transfer(&caller, recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n let spender = self.env().caller();\n\n self.spend_allowance(owner, &spender, amount);\n self.raw_transfer(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &U256) {\n let owner = self.env().caller();\n\n self.allowances.set(&(owner, *spender), *amount);\n self.env().emit_event(Approval {\n owner,\n spender: *spender,\n value: *amount\n });\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_revert_with(NameNotSet)\n }\n\n // Other getter functions...\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {\n self.allowances.get_or_default(&(*owner, *spender))\n }\n\n pub fn mint(&mut self, address: &Address, amount: &U256) {\n self.total_supply.add(*amount);\n self.balances.add(address, *amount);\n\n self.env().emit_event(Transfer {\n from: None,\n to: Some(*address),\n amount: *amount\n });\n }\n\n pub fn burn(&mut self, address: &Address, amount: &U256) {\n if self.balance_of(address) < *amount {\n self.env().revert(InsufficientBalance);\n }\n self.total_supply.subtract(*amount);\n self.balances.subtract(address, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*address),\n to: None,\n amount: *amount\n });\n }\n}\n\nimpl Erc20 {\n fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {\n if *amount > self.balances.get_or_default(owner) {\n self.env().revert(InsufficientBalance)\n }\n\n self.balances.subtract(owner, *amount);\n self.balances.add(recipient, *amount);\n\n self.env().emit_event(Transfer {\n from: Some(*owner),\n to: Some(*recipient),\n amount: *amount\n });\n }\n\n fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {\n let allowance = self.allowances.get_or_default(&(*owner, *spender));\n if allowance < *amount {\n self.env().revert(InsufficientAllowance)\n }\n self.allowances.subtract(&(*owner, *spender), *amount);\n\n self.env().emit_event(Approval {\n owner: *owner,\n spender: *spender,\n value: allowance - *amount\n });\n }\n}\n\npub mod events {\n use odra::prelude::*;\n use odra::{casper_types::U256, Address, Event};\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Transfer {\n pub from: Option<Address>,\n pub to: Option<Address>,\n pub amount: U256\n }\n\n #[derive(Event, Eq, PartialEq, Debug)]\n pub struct Approval {\n pub owner: Address,\n pub spender: Address,\n pub value: U256\n }\n}\n\npub mod errors {\n use odra::OdraError;\n\n #[derive(OdraError)]\n pub enum Error {\n InsufficientBalance = 30_000,\n InsufficientAllowance = 30_001,\n NameNotSet = 30_002,\n SymbolNotSet = 30_003,\n DecimalsNotSet = 30_004\n }\n}\n\n#[cfg(test)]\nmod tests {\n // nothing changed in the tests\n}\n")))),(0,a.kt)("h2",{id:"4-troubleshooting"},"4. ",(0,a.kt)("strong",{parentName:"h2"},"Troubleshooting")),(0,a.kt)("p",null,"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on ",(0,a.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P9k"},"Discord")," or explore the other sections this documentation. You can also refer to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"technical documentation")," for more detailed information. Additionally, our ",(0,a.kt)("a",{parentName:"p",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"examples")," repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments."),(0,a.kt)("h2",{id:"5-references"},"5. ",(0,a.kt)("strong",{parentName:"h2"},"References")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/odradev/odra/blob/release/0.9.0/CHANGELOG.md"},"Changelog")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.odra.dev"},"Odra Documentation")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://docs.rs/odra/0.9.0/odra/index.html"},"Docs.rs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https:://github.com/odradev/odra/tree/release/0.9.0/examples"},"Examples"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e31bed34.6e43a6e9.js b/docs/assets/js/e31bed34.6e43a6e9.js new file mode 100644 index 000000000..0ec19919a --- /dev/null +++ b/docs/assets/js/e31bed34.6e43a6e9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11839],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),d=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=d(e.components);return a.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},p=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=r,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return t?a.createElement(f,l(l({ref:n},c),{},{components:t})):a.createElement(f,l({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,l=new Array(o);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d<o;d++)l[d]=t[d];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},38090:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=t(87462),r=(t(67294),t(3905));const o={},l="Delegate",i={unversionedId:"advanced/delegate",id:"version-0.3.1/advanced/delegate",title:"Delegate",description:"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.",source:"@site/versioned_docs/version-0.3.1/advanced/02-delegate.md",sourceDirName:"advanced",slug:"/advanced/delegate",permalink:"/docs/0.3.1/advanced/delegate",draft:!1,tags:[],version:"0.3.1",lastUpdatedAt:1687775506,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Module Composer",permalink:"/docs/0.3.1/advanced/composer"},next:{title:"Advanced Storage Concepts",permalink:"/docs/0.3.1/advanced/advanced-storage"}},s={},d=[{value:"Overview",id:"overview",level:2},{value:"Code Examples",id:"code-examples",level:2}],c={toc:d};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"delegate"},"Delegate"),(0,r.kt)("p",null,"Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module."),(0,r.kt)("p",null,"The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable."),(0,r.kt)("h2",{id:"overview"},"Overview"),(0,r.kt)("p",null,"To utilize the delegate feature in your contract, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro, your parent module remains clean and easy to understand."),(0,r.kt)("p",null,"You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself."),(0,r.kt)("h2",{id:"code-examples"},"Code Examples"),(0,r.kt)("p",null,"Consider the following basic example for better understanding:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);\n pub fn approve(&mut self, spender: Address, amount: U256);\n pub fn name(&self) -> String;\n pub fn symbol(&self) -> String;\n pub fn decimals(&self) -> u8;\n pub fn total_supply(&self) -> U256;\n pub fn balance_of(&self, owner: Address) -> U256;\n pub fn allowance(&self, owner: Address, spender: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n pub fn change_ownership(&mut self, new_owner: Address);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"This ",(0,r.kt)("inlineCode",{parentName:"p"},"OwnedToken")," contract includes two modules: ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),". We delegate various functions from both modules using the ",(0,r.kt)("inlineCode",{parentName:"p"},"delegate!")," macro. As a result, the contract retains its succinctness without compromising on functionality."),(0,r.kt)("p",null,"The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities."),(0,r.kt)("p",null,"Let's take a look at another example."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{\n contract_env,\n types::{Address, U256}\n};\n\nuse crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};\n\n#[odra::module]\npub struct DeFiPlatform {\n ownable: Ownable,\n erc20: Erc20,\n exchange: Exchange\n}\n\n#[odra::module]\nimpl DeFiPlatform {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n self.exchange.init(exchange_rate);\n }\n\n delegate! {\n to self.erc20 {\n pub fn transfer(&mut self, recipient: Address, amount: U256);\n pub fn balance_of(&self, owner: Address) -> U256;\n }\n\n to self.ownable {\n pub fn get_owner(&self) -> Address;\n }\n\n to self.exchange {\n pub fn swap(&mut self, sender: Address, recipient: Address);\n pub fn set_exchange_rate(&mut self, new_rate: u64);\n }\n }\n\n pub fn mint(&mut self, address: Address, amount: U256) {\n self.ownable.ensure_ownership(contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,r.kt)("p",null,"In this ",(0,r.kt)("inlineCode",{parentName:"p"},"DeFiPlatform")," contract, we include ",(0,r.kt)("inlineCode",{parentName:"p"},"Erc20"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"Exchange")," modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure."),(0,r.kt)("p",null,"Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e47e02bd.840c6163.js b/docs/assets/js/e47e02bd.840c6163.js new file mode 100644 index 000000000..0ae2e3d89 --- /dev/null +++ b/docs/assets/js/e47e02bd.840c6163.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[4056],{66923:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.9.1/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.9.1/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.9.1/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/e4b2a41e.24c95f48.js b/docs/assets/js/e4b2a41e.24c95f48.js new file mode 100644 index 000000000..069774f1b --- /dev/null +++ b/docs/assets/js/e4b2a41e.24c95f48.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11422],{67251:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.3.0/category/examples","navigation":{"previous":{"title":"Casper","permalink":"/docs/0.3.0/backends/casper"},"next":{"title":"odra-examples","permalink":"/docs/0.3.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/e4e3cd82.86cd4465.js b/docs/assets/js/e4e3cd82.86cd4465.js new file mode 100644 index 000000000..2730bb87b --- /dev/null +++ b/docs/assets/js/e4e3cd82.86cd4465.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[68334],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function l(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){o(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}))}return e}function s(e,n){if(null==e)return{};var r,t,o=function(e,n){if(null==e)return{};var r,t,o={},a=Object.keys(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=t.createContext({}),d=function(e){var n=t.useContext(i),r=n;return e&&(r="function"==typeof e?e(n):l(l({},n),e)),r},c=function(e){var n=d(e.components);return t.createElement(i.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},p=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=d(r),m=o,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||a;return r?t.createElement(f,l(l({ref:n},c),{},{components:r})):t.createElement(f,l({ref:n},c))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=p;var s={};for(var i in n)hasOwnProperty.call(n,i)&&(s[i]=n[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var d=2;d<a;d++)l[d]=r[d];return t.createElement.apply(null,l)}return t.createElement.apply(null,r)}p.displayName="MDXCreateElement"},91578:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var t=r(87462),o=(r(67294),r(3905));const a={sidebar_position:4},l="Access Control",s={unversionedId:"tutorials/access-control",id:"version-0.8.0/tutorials/access-control",title:"Access Control",description:"In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,",source:"@site/versioned_docs/version-0.8.0/tutorials/access-control.md",sourceDirName:"tutorials",slug:"/tutorials/access-control",permalink:"/docs/0.8.0/tutorials/access-control",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"OwnedToken",permalink:"/docs/0.8.0/tutorials/owned-token"},next:{title:"Pausable",permalink:"/docs/0.8.0/tutorials/pauseable"}},i={},d=[{value:"Code",id:"code",level:2},{value:"Project Structure",id:"project-structure",level:3},{value:"Events and Errors",id:"events-and-errors",level:3},{value:"Module",id:"module",level:3}],c={toc:d};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"access-control"},"Access Control"),(0,o.kt)("p",null,"In a previous tutorial, we introduced the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.8.0/tutorials/ownable"},(0,o.kt)("inlineCode",{parentName:"a"},"Ownable"))," module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient, "),(0,o.kt)("p",null,"In this article we design and implement a more fine-grained access control layer."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"Before we start writing code, we list the functionalities of our access control layer."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type is used across the module."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be assigned to many ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es."),(0,o.kt)("li",{parentName:"ol"},"Each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," may have a corresponding admin role."),(0,o.kt)("li",{parentName:"ol"},"Only an admin can grant/revoke a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),"."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can be renounced."),(0,o.kt)("li",{parentName:"ol"},"A ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," cannot be renounced on someone's behalf."),(0,o.kt)("li",{parentName:"ol"},"Each action triggers an event."),(0,o.kt)("li",{parentName:"ol"},"Unauthorized access stops contract execution.")),(0,o.kt)("h3",{id:"project-structure"},"Project Structure"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-plaintext"},"access-control\n\u251c\u2500\u2500 src\n\u2502 \u251c\u2500\u2500 access\n\u2502 \u2502 \u251c\u2500\u2500 access_control.rs\n\u2502 \u2502 \u251c\u2500\u2500 events.rs\n\u2502 \u2502 \u2514\u2500\u2500 errors.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n|\u2500\u2500 build.rs\n|\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 Odra.toml\n")),(0,o.kt)("h3",{id:"events-and-errors"},"Events and Errors"),(0,o.kt)("p",null,"There are three actions that can be performed concerning a ",(0,o.kt)("inlineCode",{parentName:"p"},"Role"),": granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=events.rs showLineNumbers",title:"events.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Event};\nuse super::access_control::Role;\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleGranted {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleRevoked {\n pub role: Role,\n pub address: Address,\n pub sender: Address\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct RoleAdminChanged {\n pub role: Role,\n pub previous_admin_role: Role,\n pub new_admin_role: Role\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L5-L17")," - to describe the grant or revoke actions, our events specify the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", and ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"es indicating who receives or loses access and who provides or withdraws it."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L19-L24")," - the event describing the admin role change, requires the subject ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),", the previous and the current admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=errors.rs",title:"errors.rs"},"use odra::OdraError;\n\n#[derive(OdraError)]\npub enum Error {\n MissingRole = 20_000,\n RoleRenounceForAnotherAddress = 20_001,\n}\n")),(0,o.kt)("p",null,"Errors definition is straightforward - there are only two invalid states: "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"An action is triggered by an unauthorized actor."),(0,o.kt)("li",{parentName:"ol"},"The caller is attempting to resign the Role on someone's behalf. ")),(0,o.kt)("h3",{id:"module"},"Module"),(0,o.kt)("p",null,"Now, we are stepping into the most interesting part: the module definition and implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=access_control.rs showLineNumbers",title:"access_control.rs",showLineNumbers:!0},"use super::events::*;\nuse super::errors::Error;\nuse odra::prelude::*;\nuse odra::{module::Module, Address, Mapping};\n\npub type Role = [u8; 32];\n\npub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];\n\n#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]\npub struct AccessControl {\n roles: Mapping<(Role, Address), bool>,\n role_admin: Mapping<Role, Role>\n}\n\n#[odra::module]\nimpl AccessControl {\n pub fn has_role(&self, role: &Role, address: &Address) -> bool {\n self.roles.get_or_default(&(*role, *address))\n }\n\n pub fn get_role_admin(&self, role: &Role) -> Role {\n let admin_role = self.role_admin.get(role);\n if let Some(admin) = admin_role {\n admin\n } else {\n DEFAULT_ADMIN_ROLE\n }\n }\n\n pub fn grant_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_grant_role(role, address);\n }\n\n pub fn revoke_role(&mut self, role: &Role, address: &Address) {\n self.check_role(&self.get_role_admin(role), &self.env().caller());\n self.unchecked_revoke_role(role, address);\n }\n\n pub fn renounce_role(&mut self, role: &Role, address: &Address) {\n if address != &self.env().caller() {\n self.env().revert(Error::RoleRenounceForAnotherAddress);\n }\n self.unchecked_revoke_role(role, address);\n }\n}\n\nimpl AccessControl {\n pub fn check_role(&self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.env().revert(Error::MissingRole);\n }\n }\n\n pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {\n let previous_admin_role = self.get_role_admin(role);\n self.role_admin.set(role, *admin_role);\n self.env().emit_event(RoleAdminChanged {\n role: *role,\n previous_admin_role,\n new_admin_role: *admin_role\n });\n }\n\n pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {\n if !self.has_role(role, address) {\n self.roles.set(&(*role, *address), true);\n self.env().emit_event(RoleGranted {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n\n pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {\n if self.has_role(role, address) {\n self.roles.set(&(*role, *address), false);\n self.env().emit_event(RoleRevoked {\n role: *role,\n address: *address,\n sender: self.env().caller()\n });\n }\n }\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L6")," - Firstly, we need the ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," type. It is simply an alias for a 32-byte array."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L8")," - The default role is an array filled with zeros."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L13")," - The storage consists of two mappings:")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"roles")," - a nested mapping that stores information about whether a certain Role is granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),"."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"role_admin")," - each ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," can have a single admin ",(0,o.kt)("inlineCode",{parentName:"li"},"Role"),".")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L18-L20")," - This is a simple check to determine if a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," has been granted to a given ",(0,o.kt)("inlineCode",{parentName:"li"},"Address"),". It is an exposed entry point and an important building block widely used throughout the entire module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L49")," - This is a non-exported block containing helper functions."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L54")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," function serves as a guard function. Before a ",(0,o.kt)("inlineCode",{parentName:"li"},"Role")," is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with ",(0,o.kt)("inlineCode",{parentName:"li"},"Error::MissingRole"),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L56-L64")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"set_admin_role()")," function simply updates the role_admin mapping and emits the ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleAdminChanged")," event."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L66-L86")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_revoke_role()")," functions are mirror functions that update the roles mapping and post ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleGranted")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"RoleRevoked")," events. If the role is already granted, ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_grant_role()")," has no effect (the opposite check is made in the case of revoking a role)."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L22-L29")," - The ",(0,o.kt)("inlineCode",{parentName:"li"},"get_role_admin()")," entry point reads the role_admin. If there is no admin role for a given role, it returns the default role."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L31-L46")," - This is a combination of ",(0,o.kt)("inlineCode",{parentName:"li"},"check_role()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"unchecked_*_role()"),". Entry points fail on unauthorized access.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e4e8123e.f954eb0a.js b/docs/assets/js/e4e8123e.f954eb0a.js new file mode 100644 index 000000000..9cfc6f098 --- /dev/null +++ b/docs/assets/js/e4e8123e.f954eb0a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[68887],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},77240:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},i="Odra framework",s={unversionedId:"intro",id:"version-0.9.1/intro",title:"Odra framework",description:"Odra Docs",source:"@site/versioned_docs/version-0.9.1/intro.md",sourceDirName:".",slug:"/",permalink:"/docs/0.9.1/",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:0,frontMatter:{sidebar_position:0,slug:"/",image:"./docs-cover.png",description:"Odra Docs"},sidebar:"tutorialSidebar",next:{title:"Getting started",permalink:"/docs/0.9.1/category/getting-started"}},c={image:r(20125).Z},p=[{value:"What's next",id:"whats-next",level:2}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"odra-framework"},"Odra framework"),(0,o.kt)("p",null,"Odra is a Rust-based smart contract framework for ",(0,o.kt)("a",{parentName:"p",href:"https://casper.network"},"Casper Network"),". Odra encourages rapid development and clean,\npragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract\ndevelopment, enabling you to focus on writing your dapp without reinventing the wheel. "),(0,o.kt)("p",null,"It's free and open source!"),(0,o.kt)("h2",{id:"whats-next"},"What's next"),(0,o.kt)("p",null,"See the ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.1/getting-started/installation"},"Installation")," and our ",(0,o.kt)("a",{parentName:"p",href:"/docs/0.9.1/getting-started/flipper"},"Flipper example")," to find out how to start your new project with Odra."))}d.isMDXComponent=!0},20125:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/docs-cover-b8a52fd3e2deb53e343dd3094b0727c0.png"}}]); \ No newline at end of file diff --git a/docs/assets/js/e538a9e1.b1ac556f.js b/docs/assets/js/e538a9e1.b1ac556f.js new file mode 100644 index 000000000..8381831e8 --- /dev/null +++ b/docs/assets/js/e538a9e1.b1ac556f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[50635],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(f,i(i({ref:t},d),{},{components:r})):n.createElement(f,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c<o;c++)i[c]=r[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},24046:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.3.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.3.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.3.0/basics/directory-structure",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"defaultSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.3.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.3.0/basics/odra-toml"}},s={},c=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:".builder_* folders",id:"builder_-folders",level:2},{value:"src/",id:"src",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 .builder_casper/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = { version = "0.3.0", default-features = false }\n\n[features]\ndefault = ["mock-vm"]\nmock-vm = ["odra/mock-vm"]\ncasper = ["odra/casper"]\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. We are using two features:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/mock-vm")," - it is responsible for running tests on Odra's MockVM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"odra/casper")," - backend implementation of Casper blockchain\nMore backends will be released as features that will be possible to enable here.")),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"builder_-folders"},".builder_* folders"),(0,a.kt)("p",null,"Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary\nfor building wasm files and running them against blockchain VMs. As it is not necessary to modify\nfiles in those folders in any way, by default they are hidden (hence the ",(0,a.kt)("inlineCode",{parentName:"p"},".")," at the beginning of the\nfolder name)."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain of your choosing."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e5e64bd0.2ff789c0.js b/docs/assets/js/e5e64bd0.2ff789c0.js new file mode 100644 index 000000000..16fc58abd --- /dev/null +++ b/docs/assets/js/e5e64bd0.2ff789c0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[31401],{65322:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.3.0/category/backends","navigation":{"previous":{"title":"Attributes","permalink":"/docs/0.3.0/advanced/attributes"},"next":{"title":"What is a backend?","permalink":"/docs/0.3.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/e745da21.062bec3d.js b/docs/assets/js/e745da21.062bec3d.js new file mode 100644 index 000000000..b8f9ab6c4 --- /dev/null +++ b/docs/assets/js/e745da21.062bec3d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[36361],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(r),m=a,b=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(b,i(i({ref:t},c),{},{components:r})):n.createElement(b,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d<o;d++)i[d]=r[d];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},48401:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-1.0.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-1.0.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/basics/directory-structure",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/basics/odra-toml"}},s={},d=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:"src/",id:"src",level:2},{value:"bin/",id:"bin",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],c={toc:d};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 bin/\n| |\u2500\u2500 build_contract.rs\n| \u2514\u2500\u2500 build_schema.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "1.0.0"\n\n[dev-dependencies]\nodra-test = "1.0.0"\n\n[build-dependencies]\nodra-build = "1.0.0"\n\n[[bin]]\nname = "sample_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "sample_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. For testing purposes, ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-test")," is also\nadded as a dev dependency."),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"bin"},"bin/"),(0,a.kt)("p",null,"This is the folder where scripts that will be used to generate code or schemas live.\nYou don't need to modify those files, they are generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command and\nare used by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra schema")," commands."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e74fcb0e.4b825331.js b/docs/assets/js/e74fcb0e.4b825331.js new file mode 100644 index 000000000..1194fc390 --- /dev/null +++ b/docs/assets/js/e74fcb0e.4b825331.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[38705],{3905:(e,r,n)=>{n.d(r,{Zo:()=>c,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){a(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function i(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},c=function(e){var r=p(e.components);return t.createElement(l.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},u=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?t.createElement(f,s(s({ref:r},c),{},{components:n})):t.createElement(f,s({ref:r},c))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var p=2;p<o;p++)s[p]=n[p];return t.createElement.apply(null,s)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},67467:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-1.0.0/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-1.0.0/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/basics/errors",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/basics/testing"},next:{title:"Events",permalink:"/docs/basics/events"}},l={},p=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},c,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(errors = Error)]\npub struct OwnedContract {\n name: Var<String>,\n owner: Var<Address>\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerNotSet = 1,\n NotAnOwner = 2\n}\n\n#[odra::module]\nimpl OwnedContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = self.env().caller();\n if caller != self.owner() {\n self.env().revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,a.kt)("p",null,"Firstly, we are using the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.env().revert(Error::NotAnOwner)\n")),(0,a.kt)("p",null,"To register errors, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"errors")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute and pass the error type as the value. The registered errors will be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"Defining an error in Odra, you must keep in mind a few rules:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"An error should be a field-less enum. "),(0,a.kt)("li",{parentName:"ol"},"The enum must be annotated with ",(0,a.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]"),"."),(0,a.kt)("li",{parentName:"ol"},"Avoid implicit discriminants.")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'#[cfg(test)]\nmod tests {\n use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};\n use odra::{host::Deployer, prelude::*};\n\n #[test]\n fn test_owner_error() {\n let test_env = odra_test::env();\n let owner = test_env.get_account(0);\n let not_an_owner = test_env.get_account(1);\n\n test_env.set_caller(owner);\n let init_args = OwnedContractInitArgs {\n name: "OwnedContract".to_string()\n };\n let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);\n\n test_env.set_caller(not_an_owner);\n assert_eq!(\n owned_contract.try_change_name("NewName".to_string()),\n Err(Error::NotAnOwner.into())\n );\n }\n}\n')),(0,a.kt)("p",null,"Each ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," has ",(0,a.kt)("inlineCode",{parentName:"p"},"try_{{entry_point_name}}")," functions that return an ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.0.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult")),".\n",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractHostRef")," implements regular entrypoints: ",(0,a.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),", and\nand safe its safe version: ",(0,a.kt)("inlineCode",{parentName:"p"},"try_name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name"),"."),(0,a.kt)("p",null,"In our example, we are calling ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name")," and expecting an error to be thrown.\nFor assertions, we are using a standard ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro. As the contract call returns an ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError"),",\nwe need to convert our custom error to ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," using ",(0,a.kt)("inlineCode",{parentName:"p"},"Into::into()"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e78a982b.647528a6.js b/docs/assets/js/e78a982b.647528a6.js new file mode 100644 index 000000000..c72798351 --- /dev/null +++ b/docs/assets/js/e78a982b.647528a6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83400],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>d});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),u=s(n),d=r,g=u["".concat(c,".").concat(d)]||u[d]||p[d]||o;return n?a.createElement(g,i(i({ref:t},m),{},{components:n})):a.createElement(g,i({ref:t},m))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},5959:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Building contracts manually",l={unversionedId:"advanced/building-manually",id:"version-1.0.0/advanced/building-manually",title:"Building contracts manually",description:"cargo odra is a great tool to build and test your contracts, but sometimes",source:"@site/versioned_docs/version-1.0.0/advanced/06-building-manually.md",sourceDirName:"advanced",slug:"/advanced/building-manually",permalink:"/docs/advanced/building-manually",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:6,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Memory allocators",permalink:"/docs/advanced/using-different-allocator"},next:{title:"Backends",permalink:"/docs/category/backends"}},c={},s=[{value:"Building the contract manually",id:"building-the-contract-manually",level:2},{value:"Optimizing the contract",id:"optimizing-the-contract",level:2},{value:"Running the tests manually",id:"running-the-tests-manually",level:2},{value:"Wrapping up",id:"wrapping-up",level:2}],m={toc:s};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"building-contracts-manually"},"Building contracts manually"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a great tool to build and test your contracts, but sometimes\na better control over the parameters that are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),"\nor the compiler is needed. "),(0,r.kt)("p",null,"This is especially useful when the project has multiple features, and there is a need\nto switch between them during the building and testing."),(0,r.kt)("p",null,"Knowing that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a simple wrapper around ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),", it is easy to replicate\nthe same behavior by using ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo")," directly."),(0,r.kt)("h2",{id:"building-the-contract-manually"},"Building the contract manually"),(0,r.kt)("p",null,"To build the contract manually, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Odra uses the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"ODRA_MODULE")," to determine which contract to build.")),(0,r.kt)("p",null,"Assuming that project's crate is named ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),", this command will build\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," contract in release mode and generate the wasm file.\nThe file will be put into the ",(0,r.kt)("inlineCode",{parentName:"p"},"target/wasm32-unknown-unknown/release")," directory under\nthe name ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project_build_contract.wasm"),"."),(0,r.kt)("p",null,"The Odra Framework expects the contracts to be placed in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory, and\nto be named correctly, so the next step would be to move the file:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm\n")),(0,r.kt)("h2",{id:"optimizing-the-contract"},"Optimizing the contract"),(0,r.kt)("p",null,"To lower the size of the wasm file, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-strip")," tool:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-strip wasm/my_contract.wasm\n")),(0,r.kt)("p",null,"To further optimize the wasm file, the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-opt")," tool is also used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"This step is required, as the wasm file generated by the Rust compiler is not\nfully compatible with the Casper execution engine.")),(0,r.kt)("h2",{id:"running-the-tests-manually"},"Running the tests manually"),(0,r.kt)("p",null,"To run the tests manually, Odra needs to know which backend to use.\nTo run tests against Casper backend, the following command needs to be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_BACKEND=casper cargo test\n")),(0,r.kt)("h2",{id:"wrapping-up"},"Wrapping up"),(0,r.kt)("p",null,"Let's say we want to build the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," in debug mode, run the tests against the\ncasper backend and use the ",(0,r.kt)("inlineCode",{parentName:"p"},"my-own-allocator")," feature from our ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," project."),(0,r.kt)("p",null,"To do that, we can use the following set of commands:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract\nmv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm\nwasm-strip wasm/my_contract.wasm\nwasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\nODRA_BACKEND=casper cargo test --features my-own-allocator\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e7a2e79a.56b362d6.js b/docs/assets/js/e7a2e79a.56b362d6.js new file mode 100644 index 000000000..97e30b0b6 --- /dev/null +++ b/docs/assets/js/e7a2e79a.56b362d6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[11830],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p<o;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},96900:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:4,description:"Detailed explanation of the Flipper contract"},i="Flipper Internals",l={unversionedId:"basics/flipper-internals",id:"version-0.8.1/basics/flipper-internals",title:"Flipper Internals",description:"Detailed explanation of the Flipper contract",source:"@site/versioned_docs/version-0.8.1/basics/04-flipper-internals.md",sourceDirName:"basics",slug:"/basics/flipper-internals",permalink:"/docs/0.8.1/basics/flipper-internals",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1711464534,formattedLastUpdatedAt:"Mar 26, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Detailed explanation of the Flipper contract"},sidebar:"tutorialSidebar",previous:{title:"Odra.toml",permalink:"/docs/0.8.1/basics/odra-toml"},next:{title:"Storage interaction",permalink:"/docs/0.8.1/basics/storage-interaction"}},s={},p=[{value:"Header",id:"header",level:2},{value:"Struct",id:"struct",level:2},{value:"Impl",id:"impl",level:2},{value:"Tests",id:"tests",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-internals"},"Flipper Internals"),(0,a.kt)("p",null,"In this article, we take a deep dive into the code shown in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.1/getting-started/flipper"},"Flipper example"),", where we will explain in more detail all\nthe Odra-specific sections of the code."),(0,a.kt)("h2",{id:"header"},"Header"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"use odra::Var;\n")),(0,a.kt)("p",null,"Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation\nthat can be reused between targets. In the above case, we're importing ",(0,a.kt)("inlineCode",{parentName:"p"},"Var"),", which is responsible\nfor storing simple values on the blockchain's storage."),(0,a.kt)("h2",{id:"struct"},"Struct"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// A module definition. Each module struct consists of Vars and Mappings\n/// or/and other modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value,\n /// it's a proxy that writes/reads value to/from the host.\n value: Var<bool>,\n}\n")),(0,a.kt)("p",null,"In Odra, all contracts are also modules, which can be reused between contracts. That's why we need\nto mark the struct with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. In the struct definition itself, we state all\nthe fields of the contract. Those fields can be regular Rust data types, however - those will not\nbe persisted on the blockchain. They can also be Odra modules - defined in your project or coming\nfrom Odra itself. Finally, to make the data persistent on the blockchain, you can use something like\n",(0,a.kt)("inlineCode",{parentName:"p"},"Var<T>")," showed above. To learn more about storage interaction, take a look at the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.8.1/basics/storage-interaction"},"next article"),"."),(0,a.kt)("h2",{id:"impl"},"Impl"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n ...\n")),(0,a.kt)("p",null,"Similarly to the struct, we mark the ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. Odra will take all\n",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions from this section and create contract endpoints from them. So, if you wish to have\nfunctions that are not available for calling outside the contract, do not make them public. Alternatively,\nyou can create a separate ",(0,a.kt)("inlineCode",{parentName:"p"},"impl")," section without the macro - all functions defined there, even marked\nwith ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," will be not callable."),(0,a.kt)("p",null,"The function named ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," is the constructor of the contract. This function will be limited to only\nto a single call, all further calls to it will result in an error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"init")," function is optional,\nif your contract does not need any initialization, you can skip it."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'}," ...\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n ...\n")),(0,a.kt)("p",null,"The endpoints above show you how to interact with the simplest type of storage - ",(0,a.kt)("inlineCode",{parentName:"p"},"Var<T>"),". The data\nsaved there using ",(0,a.kt)("inlineCode",{parentName:"p"},"set")," function will be persisted in the blockchain."),(0,a.kt)("h2",{id:"tests"},"Tests"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs"',title:'"flipper.rs"'},"#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n ...\n")),(0,a.kt)("p",null,"You can write tests in any way you prefer and know in Rust. In the example above we are deploying the\ncontract using ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/host/trait.Deployer.html#tymethod.deploy"},(0,a.kt)("inlineCode",{parentName:"a"},"Deployer::deploy"))," function called on ",(0,a.kt)("inlineCode",{parentName:"p"},"FlipperHostRef")," - a piece of code generated\nby the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]"),". Because the module implements the constructor but does not accept any arguments,\nas the second argument of the deploy function, we pass ",(0,a.kt)("inlineCode",{parentName:"p"},"NoArgs")," - one of the implementations of\nthe ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.8.1/odra/host/trait.InitArgs.html"},(0,a.kt)("inlineCode",{parentName:"a"},"InitArgs"))," trait provided with the framework. "),(0,a.kt)("p",null,"The contract will be deployed on the VM you chose while running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now let's take a look at the different types of storage that Odra provides and how to use them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e8902c41.524ac2a7.js b/docs/assets/js/e8902c41.524ac2a7.js new file mode 100644 index 000000000..2ce76a965 --- /dev/null +++ b/docs/assets/js/e8902c41.524ac2a7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[64875],{79495:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.9.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.9.0/"},"next":{"title":"Installation","permalink":"/docs/0.9.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/e8a3ffa2.11029ee4.js b/docs/assets/js/e8a3ffa2.11029ee4.js new file mode 100644 index 000000000..bfc5d19d0 --- /dev/null +++ b/docs/assets/js/e8a3ffa2.11029ee4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[21389],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>g});var r=a(67294);function n(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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(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){n(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 i(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),c=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(a),g=n,m=d["".concat(s,".").concat(g)]||d[g]||u[g]||o;return a?r.createElement(m,l(l({ref:t},p),{},{components:a})):r.createElement(m,l({ref:t},p))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:n,l[1]=i;for(var c=2;c<o;c++)l[c]=a[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,a)}d.displayName="MDXCreateElement"},10296:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=a(87462),n=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.6.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.6.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.6.0/getting-started/installation",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.6.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.6.0/getting-started/flipper"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"installation"},"Installation"),(0,n.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,n.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,n.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,n.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,n.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,n.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-uknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,n.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,n.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,n.kt)("p",null,"To install it, simply execute the following command:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra\n")),(0,n.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,n.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,n.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,n.kt)("p",null,"To create a new project, simply execute:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,n.kt)("p",null,'This will create a new folder called "my_project" and initialize Odra there. Cargo Odra\nwill create a sample contract for you in src directory. You can run the tests of this contract\nby executing:'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,n.kt)("p",null,"This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,n.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,n.kt)("h2",{id:"whats-next"},"What's next?"),(0,n.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,n.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/e9ea549b.f94a54d3.js b/docs/assets/js/e9ea549b.f94a54d3.js new file mode 100644 index 000000000..bd54bfe4b --- /dev/null +++ b/docs/assets/js/e9ea549b.f94a54d3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[25495],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},3070:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",s={unversionedId:"getting-started/flipper",id:"getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/docs/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/next/getting-started/flipper",draft:!1,tags:[],version:"current",lastUpdatedAt:1707307948,formattedLastUpdatedAt:"Feb 7, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/next/getting-started/installation"},next:{title:"Basics",permalink:"/docs/next/category/basics"}},i={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"Testing",id:"testing",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/next/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/next/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Var;\n\n/// A module definition. Each module struct consists Vars and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Var<bool>,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor, must be named `init`.\n ///\n /// Initializes the contract with the value of value.\n pub fn init(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperHostRef;\n use odra::host::{Deployer, NoArgs};\n\n #[test]\n fn flipping() {\n let env = odra_test::env();\n // To test a module we need to deploy it. Autogenerated `FlipperHostRef`\n // implements `Deployer` trait, so we can use it to deploy the module.\n let mut contract = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let env = odra_test::env();\n let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);\n let contract2 = FlipperHostRef::deploy(&env, NoArgs);\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To run the tests, execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test # or add the `-b casper` flag to run tests on the CasperVM\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ea0379ae.88c6f4d8.js b/docs/assets/js/ea0379ae.88c6f4d8.js new file mode 100644 index 000000000..acea0d4c9 --- /dev/null +++ b/docs/assets/js/ea0379ae.88c6f4d8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[88854],{49059:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.7.0/category/examples","navigation":{"previous":{"title":"Casper","permalink":"/docs/0.7.0/backends/casper"},"next":{"title":"odra-examples","permalink":"/docs/0.7.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/ea145f46.e7336e76.js b/docs/assets/js/ea145f46.e7336e76.js new file mode 100644 index 000000000..5a0cdc147 --- /dev/null +++ b/docs/assets/js/ea145f46.e7336e76.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[19856],{92892:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.2.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.2.0/"},"next":{"title":"Installation","permalink":"/docs/0.2.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/eae8630e.a5fe12a9.js b/docs/assets/js/eae8630e.a5fe12a9.js new file mode 100644 index 000000000..b758365e2 --- /dev/null +++ b/docs/assets/js/eae8630e.a5fe12a9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[91501],{73627:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.8.1/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.8.1/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.8.1/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/ed6ae2e5.fcf896d2.js b/docs/assets/js/ed6ae2e5.fcf896d2.js new file mode 100644 index 000000000..e185473dc --- /dev/null +++ b/docs/assets/js/ed6ae2e5.fcf896d2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[7493],{35069:e=>{e.exports=JSON.parse('{"title":"Backends","description":"Backends","slug":"/category/backends","permalink":"/docs/0.4.0/category/backends","navigation":{"previous":{"title":"Attributes","permalink":"/docs/0.4.0/advanced/attributes"},"next":{"title":"What is a backend?","permalink":"/docs/0.4.0/backends/what-is-a-backend"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/ed898d19.a0166f5f.js b/docs/assets/js/ed898d19.a0166f5f.js new file mode 100644 index 000000000..83dbbf0fc --- /dev/null +++ b/docs/assets/js/ed898d19.a0166f5f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[30659],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,v=p["".concat(s,".").concat(m)]||p[m]||c[m]||o;return n?a.createElement(v,l(l({ref:t},d),{},{components:n})):a.createElement(v,l({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var u=2;u<o;u++)l[u]=n[u];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"},65822:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>u});var a=n(87462),r=(n(67294),n(3905));const o={},l="Module reusing",i={unversionedId:"advanced/using",id:"version-0.6.0/advanced/using",title:"Module reusing",description:"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.",source:"@site/versioned_docs/version-0.6.0/advanced/01-using.md",sourceDirName:"advanced",slug:"/advanced/using",permalink:"/docs/0.6.0/advanced/using",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced",permalink:"/docs/0.6.0/category/advanced"},next:{title:"Delegate",permalink:"/docs/0.6.0/advanced/delegate"}},s={},u=[{value:"Conceptual Overview",id:"conceptual-overview",level:2},{value:"Usage",id:"usage",level:2}],d={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"module-reusing"},"Module reusing"),(0,r.kt)("p",null,"This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples."),(0,r.kt)("h2",{id:"conceptual-overview"},"Conceptual Overview"),(0,r.kt)("p",null,"By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'#[odra::module]\nstruct Contract {\n value: Variable<u8>, // the default namespace would be "value"\n module: Module\n}\n\n#[odra::module]\nstruct Module {\n secret: Variable<String> // the default namespace would be "module_secret"\n}\n')),(0,r.kt)("p",null,"While this isolation often proves useful, there are scenarios where shared storage is beneficial."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null," Odra generates an array of keys, prefixing the storage key of child modules with the parent namespace, like in the example above. But what if you want to reuse the same instance of a module? Add a ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(using)]"),' attribute to a module to override the default behavior. This is information for the module "Do not prefix storage keys for the given module." so effectively, the child and the parent use the same module instance.'),(0,r.kt)("p",null,"Let's illustrate it with a simple example. The example provided below introduces some additional complexity by featuring deeper module nesting."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},'use odra::Variable;\n\n#[odra::module]\npub struct SharedStorage {\n pub value: Variable<String>\n}\n\n#[odra::module]\npub struct MyStorage {\n pub shared: SharedStorage,\n pub version: Variable<u8>\n}\n\n#[odra::module]\npub struct ComposableContract {\n pub shared: SharedStorage,\n #[odra(using = "shared")]\n pub storage: MyStorage\n}\n\n#[odra::module]\nimpl ComposableContract {\n #[odra(init)]\n pub fn init(&mut self, version: u8, value: String) {\n self.storage.version.set(version);\n self.shared.value.set(value);\n }\n\n pub fn get_value(&self) -> String {\n self.shared.value.get_or_default()\n }\n\n pub fn get_value_via_storage(&self) -> String {\n self.storage.shared.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod test {\n use crate::composer::ComplexContractDeployer;\n\n #[test]\n fn t() {\n let shared_value = "shared_value".to_string();\n let extra_value: u32 = 314;\n let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);\n\n assert_eq!(token.get_value(), shared_value);\n assert_eq!(token.get_value_via_storage(), shared_value);\n assert_eq!(token.get_extra_value(), extra_value);\n }\n}\n')),(0,r.kt)("p",null,"In this example, we've introduced a new module, ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", which nests ",(0,r.kt)("inlineCode",{parentName:"p"},"MyStorage")," and includes an extra value. The ",(0,r.kt)("inlineCode",{parentName:"p"},"ComplexContract")," contains ",(0,r.kt)("inlineCode",{parentName:"p"},"SharedStorage")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"MoreStorage"),", creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels."),(0,r.kt)("p",null,"If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"On the contract level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_shared_value"),"."),(0,r.kt)("li",{parentName:"ol"},"On the ",(0,r.kt)("inlineCode",{parentName:"li"},"MyStorage")," module level - ",(0,r.kt)("inlineCode",{parentName:"li"},"contract_more_storage_shared_value"),".")),(0,r.kt)("p",null,"This example showcases how you can effectively use the module reusing feature to build intricate and efficient smart contracts."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ee3d80a6.ffa24edf.js b/docs/assets/js/ee3d80a6.ffa24edf.js new file mode 100644 index 000000000..b1a3db787 --- /dev/null +++ b/docs/assets/js/ee3d80a6.ffa24edf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[12535],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},78575:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.7.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.7.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.7.0/basics/odra-toml",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.7.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.7.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"name")," will be used as a name for the contract - the generated wasm file will be in the above case named\n",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the builder to locate the exact struct where\nthe contract is defined."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nname = "flipper"\nfqn = "sample::Flipper"\n\n[[contracts]]\nname = "counter"\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/eedc1cb5.b76c65f8.js b/docs/assets/js/eedc1cb5.b76c65f8.js new file mode 100644 index 000000000..6526cba5b --- /dev/null +++ b/docs/assets/js/eedc1cb5.b76c65f8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[44248],{3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,o,a=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var r=o.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return o.createElement(s.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},u=o.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||n;return t?o.createElement(f,l(l({ref:r},c),{},{components:t})):o.createElement(f,l({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,l=new Array(n);l[0]=u;var i={};for(var s in r)hasOwnProperty.call(r,s)&&(i[s]=r[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p<n;p++)l[p]=t[p];return o.createElement.apply(null,l)}return o.createElement.apply(null,t)}u.displayName="MDXCreateElement"},30420:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>n,metadata:()=>i,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const n={sidebar_position:1},l="odra-examples",i={unversionedId:"examples/odra-examples",id:"version-0.6.0/examples/odra-examples",title:"odra-examples",description:"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.",source:"@site/versioned_docs/version-0.6.0/examples/odra-examples.md",sourceDirName:"examples",slug:"/examples/odra-examples",permalink:"/docs/0.6.0/examples/odra-examples",draft:!1,tags:[],version:"0.6.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Examples",permalink:"/docs/0.6.0/category/examples"},next:{title:"Using odra-modules",permalink:"/docs/0.6.0/examples/using-odra-modules"}},s={},p=[{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odra-examples"},"odra-examples"),(0,a.kt)("p",null,"Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the ",(0,a.kt)("inlineCode",{parentName:"p"},"examples")," in the Odra main repository."),(0,a.kt)("p",null,'The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.'),(0,a.kt)("p",null,"Don't worry if you find learning solely by reading the code challenging. Go to the ",(0,a.kt)("a",{parentName:"p",href:"../category/tutorials/"},"Tutorial")," section, where we will review it together. We will break the code into pieces, leaving no space for further questions."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn about reusable Odra components encapsulated in ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-modules"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ef626e06.5169c2cb.js b/docs/assets/js/ef626e06.5169c2cb.js new file mode 100644 index 000000000..fbad9c621 --- /dev/null +++ b/docs/assets/js/ef626e06.5169c2cb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[73808],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);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 s(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 l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(g,i(i({ref:t},p),{},{components:a})):n.createElement(g,i({ref:t},p))}));function m(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 s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c<o;c++)i[c]=a[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},27909:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:1,description:"A tool for managing Odra projects"},i="Cargo Odra",s={unversionedId:"basics/cargo-odra",id:"version-0.9.0/basics/cargo-odra",title:"Cargo Odra",description:"A tool for managing Odra projects",source:"@site/versioned_docs/version-0.9.0/basics/01-cargo-odra.md",sourceDirName:"basics",slug:"/basics/cargo-odra",permalink:"/docs/0.9.0/basics/cargo-odra",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"A tool for managing Odra projects"},sidebar:"tutorialSidebar",previous:{title:"Basics",permalink:"/docs/0.9.0/category/basics"},next:{title:"Directory structure",permalink:"/docs/0.9.0/basics/directory-structure"}},l={},c=[{value:"Managing projects",id:"managing-projects",level:2},{value:"Generating code",id:"generating-code",level:2},{value:"Testing",id:"testing",level:2},{value:"Building code",id:"building-code",level:2},{value:"Generating contract schema",id:"generating-contract-schema",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:c};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cargo-odra"},"Cargo Odra"),(0,r.kt)("p",null,"If you followed the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/getting-started/installation"},"Installation")," tutorial properly,\nyou should already be set up with the Cargo Odra tool. It is an executable that will help you with\nmanaging your smart contracts project, testing and running them with various configurations."),(0,r.kt)("p",null,"Let's take a look at all the possibilities that Cargo Odra gives you."),(0,r.kt)("h2",{id:"managing-projects"},"Managing projects"),(0,r.kt)("p",null,"Two commands help you create a new project. The first one is ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra new"),".\nYou need to pass one parameter, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"--name {PROJECT_NAME}"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project\n")),(0,r.kt)("p",null,"This creates a new project in the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," folder and name it ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),". You can see it\nfor yourself, for example by taking a look into a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file created in your project's folder:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "my_project"\nversion = "0.1.0"\nedition = "2021"\n')),(0,r.kt)("p",null,"The project is created using the template located in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra"},"Odra's main repository"),".\nBy default it uses ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template, if you want, you can use minimalistic ",(0,r.kt)("inlineCode",{parentName:"p"},"blank")," by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -t blank --name my-project\n")),(0,r.kt)("p",null,"The third available template is ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace"),", which creates a workspace with two projects, similar to the one created\nwith the ",(0,r.kt)("inlineCode",{parentName:"p"},"full")," template."),(0,r.kt)("p",null,"By default, the latest release of Odra will be used for the template and as a dependency.\nYou can pass a source of Odra you want to use, by using ",(0,r.kt)("inlineCode",{parentName:"p"},"-s")," parameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new -n my-project -s ../odra # will use local folder of odra\ncargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release\ncargo odra new -n my-project -s 0.8.0 # will use a version released on crates.io\n")),(0,r.kt)("p",null,"The second way of creating a project is by using ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra init --name my-project\n")),(0,r.kt)("p",null,"It works in the same way as ",(0,r.kt)("inlineCode",{parentName:"p"},"new"),", but instead of creating a new folder, it creates a project\nin the current, empty directory."),(0,r.kt)("h2",{id:"generating-code"},"Generating code"),(0,r.kt)("p",null,"If you want to quickly create a new contract code, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"generate")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra generate -c counter \n")),(0,r.kt)("p",null,"This creates a new file ",(0,r.kt)("inlineCode",{parentName:"p"},"src/counter.rs")," with sample code, add appropriate ",(0,r.kt)("inlineCode",{parentName:"p"},"use")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mod")," sections\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"src/lib.rs")," and update the ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file accordingly. To learn more about ",(0,r.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file,\nvisit ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.0/basics/odra-toml"},"Odra.toml"),"."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"The most used command during the development of your project should be this one:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,r.kt)("p",null,"It runs your tests against Odra's ",(0,r.kt)("inlineCode",{parentName:"p"},"MockVM"),". It is substantially faster than ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM"),"\nand implements all the features Odra uses."),(0,r.kt)("p",null,'When you want to run tests against a "real" VM, just provide the name of the backend using ',(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\noption:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"In the example above, Cargo Odra builds the project, generates the wasm files,\nspin up ",(0,r.kt)("inlineCode",{parentName:"p"},"CasperVM")," instance, deploys the contracts onto it and runs the tests against it. Pretty neat."),(0,r.kt)("p",null,"Keep in mind that this is a lot slower than ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," and you cannot use the debugger.\nThis is why ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraVM")," was created and should be your first choice when developing contracts.\nOf course, testing all of your code against a blockchain VM is a must in the end."),(0,r.kt)("p",null,"If you want to run only some of the tests, you can pass arguments to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo test")," command\n(which is run in the background obviously):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- this-will-be-passed-to-cargo-test\n")),(0,r.kt)("p",null,"If you want to run tests which names contain the word ",(0,r.kt)("inlineCode",{parentName:"p"},"two"),", you can execute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -- two\n")),(0,r.kt)("p",null,"Of course, you can do the same when using the backend:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper -- two\n")),(0,r.kt)("h2",{id:"building-code"},"Building code"),(0,r.kt)("p",null,"You can also build the code itself and generate the output contracts without running the tests.\nTo do so, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build\n")),(0,r.kt)("p",null,"If the build process finishes successfully, wasm files will be located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," folder.\nNotice, that this command does not require the ",(0,r.kt)("inlineCode",{parentName:"p"},"-b")," option."),(0,r.kt)("p",null,"If you want to build specific contract, you can use ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -c counter # you pass many comma separated contracts\n")),(0,r.kt)("h2",{id:"generating-contract-schema"},"Generating contract schema"),(0,r.kt)("p",null,"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"schema")," command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra schema \n")),(0,r.kt)("p",null,"This generates a schema file in JSON format for all your contracts and places them in the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder.\nIf the ",(0,r.kt)("inlineCode",{parentName:"p"},"resources")," folder does not exist, it creates the folder for you."),(0,r.kt)("p",null,"Like with the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," command, you can use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," option to generate a schema for a specific contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next section, we will take a look at all the files and directories that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," created\nfor us and explain their purpose."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f00a1e6f.7ab6ff68.js b/docs/assets/js/f00a1e6f.7ab6ff68.js new file mode 100644 index 000000000..540e0c9f6 --- /dev/null +++ b/docs/assets/js/f00a1e6f.7ab6ff68.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[81171],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,v=u["".concat(c,".").concat(m)]||u[m]||p[m]||s;return n?r.createElement(v,o(o({ref:t},d),{},{components:n})):r.createElement(v,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=n[l];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},88378:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={sidebar_position:9,description:"Creating and emitting Events"},o="Events",i={unversionedId:"basics/events",id:"version-0.4.0/basics/events",title:"Events",description:"Creating and emitting Events",source:"@site/versioned_docs/version-0.4.0/basics/09-events.md",sourceDirName:"basics",slug:"/basics/events",permalink:"/docs/0.4.0/basics/events",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Creating and emitting Events"},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/docs/0.4.0/basics/errors"},next:{title:"Cross calls",permalink:"/docs/0.4.0/basics/cross-calls"}},c={},l=[{value:"Testing events",id:"testing-events",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Different blockchains implement events in different ways. Odra lets you forget about it by introducing\nOdra Events. Take a look:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{Event, contract_env};\nuse odra::types::{Address, BlockTime, event::OdraEvent};\n\n#[odra::module(events = [PartyStarted])]\npub struct PartyContract {\n}\n\n#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n\n#[odra::module]\nimpl PartyContract {\n #[odra(init)]\n pub fn init(&self) {\n PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n }.emit();\n }\n}\n")),(0,a.kt)("p",null,"We defined a new contract, which emits an event called ",(0,a.kt)("inlineCode",{parentName:"p"},"PartyStarted")," when the contract is deployed.\nTo define an event, we derive an ",(0,a.kt)("inlineCode",{parentName:"p"},"Event")," macro like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"#[derive(Event, PartialEq, Eq, Debug)]\npub struct PartyStarted {\n pub caller: Address,\n pub block_time: BlockTime,\n}\n")),(0,a.kt)("p",null,"Among other things, it adds an ",(0,a.kt)("inlineCode",{parentName:"p"},"emit()")," function to the struct, which allows you to emit the event simply\nas that:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"PartyStarted {\n caller: contract_env::caller(),\n block_time: contract_env::get_block_time(),\n}.emit();\n")),(0,a.kt)("p",null,"Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an ",(0,a.kt)("inlineCode",{parentName:"p"},"events")," attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro. "),(0,a.kt)("p",null,"The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module."),(0,a.kt)("h2",{id:"testing-events"},"Testing events"),(0,a.kt)("p",null,"Odra's ",(0,a.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a handy macro ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_events!")," which lets you easily test the events that a given contract has emitted:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/docs/events.rs"',title:'"examples/src/docs/events.rs"'},"use odra::{assert_events, test_env};\nuse crate::docs::events::PartyStarted;\nuse super::PartyContractDeployer;\n\n#[test]\nfn test_party() {\n let party_contract = PartyContractDeployer::init();\n assert_events!(\n party_contract,\n PartyStarted {\n caller: test_env::get_account(0),\n block_time: 0,\n }\n );\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Read the next article to learn how to call other contracts from the contract context."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f0928d2f.ed28131e.js b/docs/assets/js/f0928d2f.ed28131e.js new file mode 100644 index 000000000..9ba1bd415 --- /dev/null +++ b/docs/assets/js/f0928d2f.ed28131e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[35660],{78942:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.3.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.3.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.3.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/f1080184.e897441c.js b/docs/assets/js/f1080184.e897441c.js new file mode 100644 index 000000000..cb5afdc06 --- /dev/null +++ b/docs/assets/js/f1080184.e897441c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[89074],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>g});var r=a(67294);function n(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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(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){n(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 i(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),c=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(a),g=n,m=d["".concat(s,".").concat(g)]||d[g]||u[g]||o;return a?r.createElement(m,l(l({ref:t},p),{},{components:a})):r.createElement(m,l({ref:t},p))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:n,l[1]=i;for(var c=2;c<o;c++)l[c]=a[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,a)}d.displayName="MDXCreateElement"},58327:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=a(87462),n=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.7.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.7.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.7.0/getting-started/installation",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.7.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.7.0/getting-started/flipper"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"installation"},"Installation"),(0,n.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,n.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,n.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,n.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,n.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,n.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-uknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,n.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,n.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,n.kt)("p",null,"To install it, simply execute the following command:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra\n")),(0,n.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,n.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,n.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,n.kt)("p",null,"To create a new project, simply execute:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,n.kt)("p",null,'This will create a new folder called "my_project" and initialize Odra there. Cargo Odra\nwill create a sample contract for you in src directory. You can run the tests of this contract\nby executing:'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,n.kt)("p",null,"This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,n.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,n.kt)("h2",{id:"whats-next"},"What's next?"),(0,n.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,n.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f139e68c.e69808ae.js b/docs/assets/js/f139e68c.e69808ae.js new file mode 100644 index 000000000..8cc5aa605 --- /dev/null +++ b/docs/assets/js/f139e68c.e69808ae.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[62191],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),f=a,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||o;return n?r.createElement(m,s(s({ref:t},d),{},{components:n})):r.createElement(m,s({ref:t},d))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},46675:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:13,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.9.1/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.9.1/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.9.1/basics/native-token",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:13,frontMatter:{sidebar_position:13,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.9.1/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.9.1/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"native-token"},"Native token"),(0,a.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::prelude::*;\nuse odra::{casper_types::U512, module::Module};\n\n#[odra::module]\npub struct PublicWallet;\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {}\n\n pub fn withdraw(&mut self, amount: &U512) {\n self.env().transfer_tokens(&self.env().caller(), amount);\n }\n}\n")),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,a.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,a.kt)("inlineCode",{parentName:"p"},"examples/src/contracts/tlw.rs")," in the odra main repository.")),(0,a.kt)("p",null,"You can see a new attribute used here: ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv::transfer_tokens()"),".\nIt does exactly what you are expecting it to do - it transfers native tokens from the contract to the\nspecified address."),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a function -\n",(0,a.kt)("inlineCode",{parentName:"p"},"balance_of"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"#[cfg(test)]\nmod tests {\n use super::PublicWalletHostRef;\n use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);\n assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());\n\n my_contract.with_tokens(U512::from(100)).deposit();\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));\n\n my_contract.withdraw(U512::from(25));\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f146bc3c.737d9f98.js b/docs/assets/js/f146bc3c.737d9f98.js new file mode 100644 index 000000000..5478ddcc7 --- /dev/null +++ b/docs/assets/js/f146bc3c.737d9f98.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[57731],{73800:e=>{e.exports=JSON.parse('{"title":"Examples","description":"Examples","slug":"/category/examples","permalink":"/docs/0.6.0/category/examples","navigation":{"previous":{"title":"Casper","permalink":"/docs/0.6.0/backends/casper"},"next":{"title":"odra-examples","permalink":"/docs/0.6.0/examples/odra-examples"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/f446cb0a.13096a8d.js b/docs/assets/js/f446cb0a.13096a8d.js new file mode 100644 index 000000000..c83d34b3a --- /dev/null +++ b/docs/assets/js/f446cb0a.13096a8d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[26418],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},5537:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:3,description:"Odra's configuration file"},i="Odra.toml",l={unversionedId:"basics/odra-toml",id:"version-0.8.0/basics/odra-toml",title:"Odra.toml",description:"Odra's configuration file",source:"@site/versioned_docs/version-0.8.0/basics/03-odra-toml.md",sourceDirName:"basics",slug:"/basics/odra-toml",permalink:"/docs/0.8.0/basics/odra-toml",draft:!1,tags:[],version:"0.8.0",lastUpdatedAt:1707733219,formattedLastUpdatedAt:"Feb 12, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Odra's configuration file"},sidebar:"tutorialSidebar",previous:{title:"Directory structure",permalink:"/docs/0.8.0/basics/directory-structure"},next:{title:"Flipper Internals",permalink:"/docs/0.8.0/basics/flipper-internals"}},c={},s=[{value:"Adding a new contract manually",id:"adding-a-new-contract-manually",level:2},{value:"What's next",id:"whats-next",level:2}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"As mentioned in the previous article, ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," is a file that contains information about all the contracts\nthat Odra will build. Let's take a look at the file structure again:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) is used by the building tools to locate and build the contract.\nThe last segment of the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," will be used as the name for your contract - the generated wasm file will\nbe in the above case named ",(0,a.kt)("inlineCode",{parentName:"p"},"flipper.wasm"),"."),(0,a.kt)("h2",{id:"adding-a-new-contract-manually"},"Adding a new contract manually"),(0,a.kt)("p",null,"Besides using the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command, you can add a new contract to be compiled by hand.\nTo do this, add another ",(0,a.kt)("inlineCode",{parentName:"p"},"[[contracts]]")," element, name it and make sure that the ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," is set correctly."),(0,a.kt)("p",null,"For example, if you want to create a new contract called ",(0,a.kt)("inlineCode",{parentName:"p"},"counter"),", your ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file should finally\nlook like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n\n[[contracts]]\nfqn = "sample::Counter"\n')),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous\n",(0,a.kt)("inlineCode",{parentName:"p"},"Flipper")," contract."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f4926997.db39f923.js b/docs/assets/js/f4926997.db39f923.js new file mode 100644 index 000000000..0ad54354b --- /dev/null +++ b/docs/assets/js/f4926997.db39f923.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[83518],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=d(n),c=r,w=m["".concat(s,".").concat(c)]||m[c]||p[c]||i;return n?a.createElement(w,o(o({ref:t},u),{},{components:n})):a.createElement(w,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d<i;d++)o[d]=n[d];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},13966:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const i={sidebar_position:1},o="Ownable",l={unversionedId:"tutorials/ownable",id:"version-1.0.0/tutorials/ownable",title:"Ownable",description:"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.",source:"@site/versioned_docs/version-1.0.0/tutorials/ownable.md",sourceDirName:"tutorials",slug:"/tutorials/ownable",permalink:"/docs/tutorials/ownable",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Tutorials",permalink:"/docs/category/tutorials"},next:{title:"ERC-20",permalink:"/docs/tutorials/erc20"}},s={},d=[{value:"Framework features",id:"framework-features",level:2},{value:"Code",id:"code",level:2},{value:"Define a module",id:"define-a-module",level:3},{value:"Init the module",id:"init-the-module",level:3},{value:"Features implementation",id:"features-implementation",level:3},{value:"Test",id:"test",level:3},{value:"Summary",id:"summary",level:2},{value:"What's next",id:"whats-next",level:2}],u={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"ownable"},"Ownable"),(0,r.kt)("p",null,"In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features."),(0,r.kt)("h2",{id:"framework-features"},"Framework features"),(0,r.kt)("p",null,"A module we will write in a minute, will help you master a few Odra features:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"storing a single value,"),(0,r.kt)("li",{parentName:"ul"},"defining a constructor,"),(0,r.kt)("li",{parentName:"ul"},"error handling,"),(0,r.kt)("li",{parentName:"ul"},"defining and emitting ",(0,r.kt)("inlineCode",{parentName:"li"},"events"),"."),(0,r.kt)("li",{parentName:"ul"},"registering a contact in a test environment,"),(0,r.kt)("li",{parentName:"ul"},"interactions with the test environment,"),(0,r.kt)("li",{parentName:"ul"},"assertions (value, events, errors assertions).")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("p",null,"Before we write any code, we define functionalities we would like to implement."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Module has an initializer that should be called once. "),(0,r.kt)("li",{parentName:"ol"},"Only the current owner can set a new owner."),(0,r.kt)("li",{parentName:"ol"},"Read the current owner."),(0,r.kt)("li",{parentName:"ol"},"A function that fails if called by a non-owner account.")),(0,r.kt)("h3",{id:"define-a-module"},"Define a module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(events = [OwnershipChanged])]\npub struct Ownable {\n owner: Var<Option<Address>>\n}\n")),(0,r.kt)("p",null,"That was easy, but it is crucial to understand the basics before we move on."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4")," - Firstly, we need to create a struct called ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," and apply ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module(events = [OwnershipChanged])]")," attribute to it. The ",(0,r.kt)("inlineCode",{parentName:"li"},"events")," attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," is a type that will be defined later."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),".")),(0,r.kt)("h3",{id:"init-the-module"},"Init the module"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n pub fn init(&mut self, owner: Address) {\n if self.owner.get_or_default().is_some() {\n self.env().revert(Error::OwnerIsAlreadyInitialized)\n }\n\n self.owner.set(Some(owner));\n \n self.env().emit_event(OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n });\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerIsAlreadyInitialized = 1,\n}\n\n#[odra::event]\npub struct OwnershipChanged {\n pub prev_owner: Option<Address>,\n pub new_owner: Address\n}\n")),(0,r.kt)("p",null,"Ok, we have done a couple of things, let's analyze them one by one:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L1")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"impl")," should be an Odra module, so add ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L3")," - The ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," function is a constructor. This matters if we would like to deploy the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ownable")," module as a standalone contract."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L17-L20")," - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum. Notice that the ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]")," attribute is applied to the enum. It generates, among others, the required ",(0,r.kt)("inlineCode",{parentName:"li"},"Into<odra::OdraError>")," binding."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L4-L6")," - If the owner has been set already, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::revert()")," function with an ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::OwnerIsAlreadyInitialized")," argument. "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L8")," - Then we write the owner passed as an argument to the storage. To do so, we call the ",(0,r.kt)("inlineCode",{parentName:"li"},"set()")," on ",(0,r.kt)("inlineCode",{parentName:"li"},"Var"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L22-L26")," - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::event]")," attribute."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L10")," - Finally, call ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::emit_event()")," passing the ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged")," instance to the function. Hence, we set the first owner, we set the ",(0,r.kt)("inlineCode",{parentName:"li"},"prev_owner")," value to ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),". ")),(0,r.kt)("h3",{id:"features-implementation"},"Features implementation"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[odra::module]\nimpl Ownable {\n ...\n\n pub fn ensure_ownership(&self, address: &Address) {\n if Some(address) != self.owner.get_or_default().as_ref() {\n self.env().revert(Error::NotOwner)\n }\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ensure_ownership(&self.env().caller());\n let current_owner = self.get_owner();\n self.owner.set(Some(*new_owner));\n self.env().emit_event(OwnershipChanged {\n prev_owner: Some(current_owner),\n new_owner: *new_owner\n });\n }\n\n pub fn get_owner(&self) -> Address {\n match self.owner.get_or_default() {\n Some(owner) => owner,\n None => self.env().revert(Error::OwnerIsNotInitialized)\n }\n }\n}\n\n#[odra::odra_error]\npub enum Error {\n NotOwner = 1,\n OwnerIsAlreadyInitialized = 2,\n OwnerIsNotInitialized = 3,\n}\n")),(0,r.kt)("p",null,"The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7,L31")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()")," reads the current owner and reverts if it does not match the input ",(0,r.kt)("inlineCode",{parentName:"li"},"Address"),". Also, we need to update our ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," enum by adding a new variant ",(0,r.kt)("inlineCode",{parentName:"li"},"NotOwner"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L11")," - The function defined above can be reused in the ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()")," implementation. We pass to it the current caller, using the ",(0,r.kt)("inlineCode",{parentName:"li"},"ContractEnv::caller()")," function. Then we update the state and emit ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnershipChanged"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L21,L33")," - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new ",(0,r.kt)("inlineCode",{parentName:"li"},"Error")," variant ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnerIsNotInitialized"),". There is one worth-mentioning subtlety: ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," function returns ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<T>"),". If the type implements the ",(0,r.kt)("inlineCode",{parentName:"li"},"Default")," trait, you can call the ",(0,r.kt)("inlineCode",{parentName:"li"},"get_or_default()")," function, and the contract does not fail even if the value is not initialized. As the ",(0,r.kt)("inlineCode",{parentName:"li"},"owner")," is of type ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<Address>")," the ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get()")," would return ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<Option<Address>>"),", we use ",(0,r.kt)("inlineCode",{parentName:"li"},"Var::get_or_default()")," instead.")),(0,r.kt)("h3",{id:"test"},"Test"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=ownable.rs showLineNumbers",title:"ownable.rs",showLineNumbers:!0},"#[cfg(test)]\nmod tests {\n use super::*;\n use odra::host::{Deployer, HostEnv, HostRef};\n\n fn setup() -> (OwnableHostRef, HostEnv, Address) {\n let env: HostEnv = odra_test::env();\n let init_args = OwnableInitArgs {\n owner: env.get_account(0)\n };\n (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))\n }\n\n #[test]\n fn initialization_works() {\n let (ownable, env, owner) = setup();\n assert_eq!(ownable.get_owner(), owner);\n \n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: None,\n new_owner: owner\n }\n );\n }\n\n #[test]\n fn owner_can_change_ownership() {\n let (mut ownable, env, owner) = setup();\n let new_owner = env.get_account(1);\n \n env.set_caller(owner);\n ownable.change_ownership(&new_owner);\n assert_eq!(ownable.get_owner(), new_owner);\n\n env.emitted_event(\n ownable.address(),\n &OwnershipChanged {\n prev_owner: Some(owner),\n new_owner\n }\n );\n }\n\n #[test]\n fn non_owner_cannot_change_ownership() {\n let (mut ownable, env, _) = setup();\n let new_owner = env.get_account(1);\n ownable.change_ownership(&new_owner);\n \n assert_eq!(\n ownable.try_change_ownership(&new_owner), \n Err(Error::NotOwner.into())\n );\n }\n}\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L6")," - Each test case starts with the same initialization process, so for convenience, we have defined the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, which we call in the first statement of each test. Take a look at the signature: ",(0,r.kt)("inlineCode",{parentName:"li"},"fn setup() -> (OwnableHostRef, HostEnv, Address)"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef")," is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ",(0,r.kt)("inlineCode",{parentName:"li"},"ensure_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"change_ownership()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"get_owner()"),", but not ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", which is a constructor."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L7-L11")," - The starting point of every test is getting an instance of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," by calling ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_test::env()"),". Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra::module]")," attribute implements a ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer")," for ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableHostRef"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"OwnableInitArgs")," that we pass as the second argument of the ",(0,r.kt)("inlineCode",{parentName:"li"},"odra::host::Deployer::deploy()")," function. Lastly, the module needs an owner. The easiest way is to take one from the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". We choose the address of first account (which is the default one). "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L14")," - It is time to define the first test. As you see, it is a regular Rust test."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L16-17")," - Using the ",(0,r.kt)("inlineCode",{parentName:"li"},"setup()")," function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"You may have noticed, we use here the term ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," interchangeably with ",(0,r.kt)("inlineCode",{parentName:"p"},"contract"),". The reason is once we deploy our module onto a virtual blockchain it may be considered a contract."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L19-25")," - On the contract, only the ",(0,r.kt)("inlineCode",{parentName:"li"},"init()")," function has been called, so we expect one event to have been emitted. To assert that, let's use ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv"),". To get the env, we call ",(0,r.kt)("inlineCode",{parentName:"li"},"env()")," on the contract, then call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::emitted_event"),". As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L31")," - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," predefines 20 accounts."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L33")," - As mentioned, the default is the 0th account, if you want to change the executor, call the ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::set_caller()")," function. ",(0,r.kt)("admonition",{parentName:"li",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"The caller switch applies only the next contract interaction, the second call will be done as the default account."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"L46-55")," - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::try_change_ownership()")," instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv::change_ownership()"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"HostEnv")," provides try_ functions for each contract's entrypoint. The ",(0,r.kt)("inlineCode",{parentName:"li"},"try")," functions return ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraResult")," (an alias for ",(0,r.kt)("inlineCode",{parentName:"li"},"Result<T, OdraError>"),") instead of panicking and halting the execution. In our case, we expect the contract to revert with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::NotOwner")," error. To compare the error, we use the ",(0,r.kt)("inlineCode",{parentName:"li"},"Error::into()")," function, which converts the error into the ",(0,r.kt)("inlineCode",{parentName:"li"},"OdraError")," type.")),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Ownable")," module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"In the next tutorial we will implement a ERC20 standard."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f54718af.50ba5cbf.js b/docs/assets/js/f54718af.50ba5cbf.js new file mode 100644 index 000000000..0bbbfffe4 --- /dev/null +++ b/docs/assets/js/f54718af.50ba5cbf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[52294],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);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 s(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 i(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 l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={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,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return a?n.createElement(h,s(s({ref:t},c),{},{components:a})):n.createElement(h,s({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p<o;p++)s[p]=a[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"},53478:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={sidebar_position:3},s="Casper",i={unversionedId:"backends/casper",id:"version-0.5.0/backends/casper",title:"Casper",description:"The Casper backend allows you to compile your contracts into WASM files which can be deployed",source:"@site/versioned_docs/version-0.5.0/backends/03-casper.md",sourceDirName:"backends",slug:"/backends/casper",permalink:"/docs/0.5.0/backends/casper",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"MockVM",permalink:"/docs/0.5.0/backends/mock-vm"},next:{title:"Examples",permalink:"/docs/0.5.0/category/examples"}},l={},p=[{value:"Types",id:"types",level:2},{value:"Contract Env",id:"contract-env",level:2},{value:"Events",id:"events",level:3},{value:"Payable",id:"payable",level:3},{value:"Revert",id:"revert",level:3},{value:"Context",id:"context",level:3},{value:"Test Env",id:"test-env",level:2},{value:"Usage",id:"usage",level:2},{value:"Constructors",id:"constructors",level:2},{value:"WASM arguments",id:"wasm-arguments",level:3},{value:"Contract Deploys",id:"contract-deploys",level:2},{value:"Example: Deploy Counter",id:"example-deploy-counter",level:3},{value:"Example: Deploy ERC721",id:"example-deploy-erc721",level:3},{value:"Example: Deploy ERC1155",id:"example-deploy-erc1155",level:3},{value:"Sending CSPR to a contract",id:"sending-cspr-to-a-contract",level:2},{value:"Using proxy_caller.wasm",id:"using-proxy_callerwasm",level:3},{value:"Execution",id:"execution",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"casper"},"Casper"),(0,r.kt)("p",null,"The Casper backend allows you to compile your contracts into WASM files which can be deployed\nonto ",(0,r.kt)("a",{parentName:"p",href:"https://casper.network/"},"Casper Blockchain"),"\nand lets you to easily run them against ",(0,r.kt)("a",{parentName:"p",href:"https://crates.io/crates/casper-execution-engine"},"Casper's Execution Engine")," locally."),(0,r.kt)("h2",{id:"types"},"Types"),(0,r.kt)("p",null,"A struct to be written into the storage must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"OdraType")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait OdraType: \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("p",null,"The other exposed types are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CallArgs")," - wraps around casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},(0,r.kt)("inlineCode",{parentName:"a"},"RuntimeArgs")),";"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Balance")," - U512 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"BlockTime")," - u64 type alias;"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Address")," - an enum that encapsulates casper's ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/account/struct.AccountHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"AccountHash"))," and ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/struct.ContractPackageHash.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ContractPackageHash")))),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've\nalready learned from the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/events"},"events article"),", in Odra you emit an event, similarly, you would do it in ",(0,r.kt)("a",{parentName:"p",href:"https://docs.soliditylang.org/en/v0.8.15/contracts.html#example"},"Solidity"),"."),(0,r.kt)("p",null,"Under the hood, Odra integrates with ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/make-software/casper-event-standard"},"Casper Event Standard")," and creates a few ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/struct.URef.html"},(0,r.kt)("inlineCode",{parentName:"a"},"URef"),"s")," in the global state when a contract is being installed:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events")," - a dictionary that stores events' data."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_length")," - the evens count."),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_ces_version")," - the version of ",(0,r.kt)("inlineCode",{parentName:"li"},"Casper Event Standard"),". "),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"__events_schema")," - a dictionary that stores event schemas.")),(0,r.kt)("p",null,"Besides that, all the events the contract emits are registered - events schemas are written to the storage under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__events_schema")," key."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Don't forget to expose events in the module using ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module(events = [...])]"),". ")),(0,r.kt)("p",null,"So, ",(0,r.kt)("inlineCode",{parentName:"p"},"Events")," are nothing different from any other data stored by a contract."),(0,r.kt)("p",null,"A struct to be an event must implement ",(0,r.kt)("inlineCode",{parentName:"p"},"SerializableEvent")," which is defined as follow:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub trait SerializableEvent: \n odra_types::event::OdraEvent + \n casper_types::CLTyped + \n casper_types::bytesrepr::ToBytes + \n casper_types::bytesrepr::FromBytes {}\n")),(0,r.kt)("h3",{id:"payable"},"Payable"),(0,r.kt)("p",null,"The first Odra idiom is a ",(0,r.kt)("inlineCode",{parentName:"p"},"Contract Main Purse"),". It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper ",(0,r.kt)("inlineCode",{parentName:"p"},"URef")," and a purse are created and stored under the ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse")," key."),(0,r.kt)("p",null,"Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a ",(0,r.kt)("inlineCode",{parentName:"p"},"Cargo Purse"),". It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse."),(0,r.kt)("p",null,"Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable.\nIf under the way something goes wrong with the transfer, the contract reverts."),(0,r.kt)("p",null,"The transferred amount can be read inside the contract by calling ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()"),"."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Odra expects the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," runtime argument to be attached to a contract call.\nIn case of its absence, the ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::attached_value()")," returns zero.")),(0,r.kt)("h3",{id:"revert"},"Revert"),(0,r.kt)("p",null,"In Casper, we can stop the execution pretty straightforwardly - call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::revert()"),".\nOdra adds an extra abstraction layer - in a contract ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecutionError"),"s are defined, which ultimately are transformed into Casper's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-types/latest/casper_types/enum.ApiError.html"},(0,r.kt)("inlineCode",{parentName:"a"},"ApiError::User")),"."),(0,r.kt)("h3",{id:"context"},"Context"),(0,r.kt)("p",null,"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers.\nIf you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_address()")," function takes the first element of the callstack (",(0,r.kt)("a",{parentName:"p",href:"https://docs.rs/casper-contract/latest/casper_contract/contract_api/runtime/fn.get_call_stack.html"},(0,r.kt)("inlineCode",{parentName:"a"},"runtime::get_call_stack()")),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::caller()")," function takes the second element of the call stack (",(0,r.kt)("inlineCode",{parentName:"p"},"runtime::get_call_stack()"),") and casts it to ",(0,r.kt)("inlineCode",{parentName:"p"},"Address"),"."),(0,r.kt)("p",null,"As mentioned in the ","[Payable]"," section, to store CSPR, each contract creates its purse. To read the contract balance, you call ",(0,r.kt)("inlineCode",{parentName:"p"},"contract_env::self_balance"),", which checks the balance of the purse stored under ",(0,r.kt)("inlineCode",{parentName:"p"},"__contract_main_purse"),"."),(0,r.kt)("h2",{id:"test-env"},"Test Env"),(0,r.kt)("p",null,"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Casper Execution Engine"),"."),(0,r.kt)("p",null,"In your test, you can freely switch execution context by setting as a caller (",(0,r.kt)("inlineCode",{parentName:"p"},"test_env::set_caller()"),") one of the 20 predefined accounts. Each account possesses the default amount of ",(0,r.kt)("inlineCode",{parentName:"p"},"Motes")," (100_000_000_000_000_000)."),(0,r.kt)("p",null,"The Test Env internally keeps track of the current ",(0,r.kt)("inlineCode",{parentName:"p"},"block time"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"attached value"),"."),(0,r.kt)("p",null,"Each test is executed on a fresh instance of the Test Env."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Name of the Casper backend in Odra is ",(0,r.kt)("inlineCode",{parentName:"p"},"casper"),", so to run the tests against it, simply pass it as a ",(0,r.kt)("inlineCode",{parentName:"p"},"-b"),"\nparameter:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,r.kt)("p",null,"If you want to just generate a wasm file, simply run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper\n")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("p",null,"Let's define a basic Odra module that includes a constructor:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\nstruct Counter {\n value: Variable<u32>\n}\n\n#[odra::module]\nimpl Counter {\n #[odra(init)]\n pub initialize(&mut self, value: u32) {\n self.value.set(value);\n }\n}\n")),(0,r.kt)("p",null,"Read more about constructors ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/advanced/attributes#init"},"here"),"."),(0,r.kt)("h3",{id:"wasm-arguments"},"WASM arguments"),(0,r.kt)("p",null,"When deploying a new contract you have to specify following arguments."),(0,r.kt)("p",null,"Required arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The key under which the package hash of the contract will be stored."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_allow_key_override")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," and the key specified in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_package_hash_key_name")," already exists, it will be overwritten."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_is_upgradable")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bool")," type. If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", the contract will be deployed as upgradable.")),(0,r.kt)("p",null,"Optional arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. If the contract has the constructor entry point marked with ",(0,r.kt)("inlineCode",{parentName:"li"},"#[odra(init)]"),", this should be set to the constructor name."),(0,r.kt)("li",{parentName:"ul"},"constructor arguments that match entry point set in ",(0,r.kt)("inlineCode",{parentName:"li"},"odra_cfg_constructor"),".")),(0,r.kt)("h2",{id:"contract-deploys"},"Contract Deploys"),(0,r.kt)("h3",{id:"example-deploy-counter"},"Example: Deploy Counter"),(0,r.kt)("p",null,"To deploy your contract with a constructor using ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client"),", you need to pass the above arguments.\nAdditionally, you need to pass the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument, which sets the arbitrary initial value for the counter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 5000000000000 \\\n --session-path ./wasm/counter.wasm \\\n --session-arg "odra_cfg_package_hash_key_name:string:\'counter_package_hash\'" \\\n --session-arg "odra_cfg_allow_key_override:bool:\'true\'" \\\n --session-arg "odra_cfg_is_upgradable:bool:\'true\'" \\\n --session-arg "odra_cfg_constructor:string:\'initialize\'" \\\n --session-arg "value:u32:42" \n')),(0,r.kt)("p",null,"For a more in-depth tutorial, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.casper.network/writing-contracts/"},"Casper's 'Writing On-Chain Code'"),"."),(0,r.kt)("h3",{id:"example-deploy-erc721"},"Example: Deploy ERC721"),(0,r.kt)("p",null,"Odra comes with a standard ERC721 token implementation.\nClone the main Odra repo and navigate to the ",(0,r.kt)("inlineCode",{parentName:"p"},"modules")," directory."),(0,r.kt)("p",null,"Firstly contract needs to be compiled."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc721_token\n")),(0,r.kt)("p",null,"It produces the ",(0,r.kt)("inlineCode",{parentName:"p"},"erc721_token.wasm")," file in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory."),(0,r.kt)("p",null,"Now it's time to deploy the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc721_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_nft'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n --session-arg \"name:string:'MyNFT'\" \\\n --session-arg \"symbol:string:'NFT'\" \\\n --session-arg \"base_uri:string:'https://example.com/'\"\n")),(0,r.kt)("p",null,"It's done.\nThe contract is deployed and ready to use.\nYour account is the owner of the contract and you can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.5.0/modules/src/erc721_token.rs"},"ERC721")," module."),(0,r.kt)("p",null,"To obtain the package hash of the contract search for ",(0,r.kt)("inlineCode",{parentName:"p"},"my_nft")," key\nin your account's named keys."),(0,r.kt)("h3",{id:"example-deploy-erc1155"},"Example: Deploy ERC1155"),(0,r.kt)("p",null,"The process is similar to the one described in the previous section."),(0,r.kt)("p",null,"Contract compilation:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra build -b casper -c erc1155_token\n")),(0,r.kt)("p",null,"Contract deployment:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"casper-client put-deploy \\\n --node-address [NODE_ADDRESS] \\\n --chain-name casper-test \\\n --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\\n --payment-amount 300000000000 \\\n --session-path ./wasm/erc1155_token.wasm \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'my_tokens'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'false'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"odra_cfg_constructor:string:'init'\" \\\n")),(0,r.kt)("p",null,"As previously, your account is the owner and can mint and burn tokens.\nFor more details see the code of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.5.0/modules/src/erc1155_token.rs"},"ERC1155")," module."),(0,r.kt)("h2",{id:"sending-cspr-to-a-contract"},"Sending CSPR to a contract"),(0,r.kt)("p",null,"Defining payable entry points is described in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/native-token"},"Native Token")," section."),(0,r.kt)("p",null,"What is happening under the hood is that Odra creates a new ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," argument for each payable\nentry point. The ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," needs to be top-upped with CSPR before calling the contract.\nWhen a contract adds CSPR to another contract call, Odra handles it for you.\nThe problem arises when you want to call an entry point and attach CSPR as an account.\nThe only way of doing that is by executing code in the sessions context, that\ntop-ups the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo_purse")," and then calls the contract."),(0,r.kt)("p",null,"Odra provides a generic ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," that does exactly that.\nYou can build it by yourself from the main Odra repository, or use the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/0.4.0/odra-casper/livenet/resources/proxy_caller.wasm"},"proxy_caller.wasm"),"\nwe maintain."),(0,r.kt)("h3",{id:"using-proxy_callerwasm"},"Using proxy_caller.wasm"),(0,r.kt)("p",null,"To use the ",(0,r.kt)("inlineCode",{parentName:"p"},"proxy_caller.wasm")," you need to attach the following arguments:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"contract_package_hash")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"BytesArray(32)")," type. The package hash of the contract you want to call.\nResult of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," on ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/contracts/struct.ContractPackageHash.html"},"CasperPackageHash"),"."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"entry_point")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"String")," type. The name of the entry point you want to call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"args")," - ",(0,r.kt)("inlineCode",{parentName:"li"},"Bytes")," type. It is a serialized ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/runtime_args/struct.RuntimeArgs.html"},"RuntimeArgs")," with the arguments you want to pass\nto the entry point. To be specific it is the result of ",(0,r.kt)("inlineCode",{parentName:"li"},"to_bytes")," method wrapped with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.rs/casper-types/latest/casper_types/bytesrepr/struct.Bytes.html"},"Bytes")," type."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"attached_value"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"Option<U512>")," type. The amount of CSPR you want to attach to the call."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"amount"),". ",(0,r.kt)("inlineCode",{parentName:"li"},"U512")," type. Should be the same value as ",(0,r.kt)("inlineCode",{parentName:"li"},"attached_value")," if not ",(0,r.kt)("inlineCode",{parentName:"li"},"None"),".\nIt is a special Casper argument that enables the access to account's main purse.")),(0,r.kt)("p",null,"Currently ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," doesn't allow building such arguments.\nYou have to build it using your SDK."),(0,r.kt)("h2",{id:"execution"},"Execution"),(0,r.kt)("p",null,"First thing Odra does with your code, is similar to the one used in ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.5.0/backends/mock-vm"},"MockVM")," -\na list of entrypoints is generated, thanks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro."),(0,r.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[IR];\n id2[IR]--\x3eid3((WASM))\n id3((WASM))--\x3eid4[(Local Casper\\nExecution Engine)]\n id3((WASM))--\x3eid5[(Casper Network)]"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f5bf02f1.38546c06.js b/docs/assets/js/f5bf02f1.38546c06.js new file mode 100644 index 000000000..8cdb3c71e --- /dev/null +++ b/docs/assets/js/f5bf02f1.38546c06.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[69756],{60374:e=>{e.exports=JSON.parse('{"title":"Advanced","description":"Advanced concepts of Odra Framework","slug":"/category/advanced","permalink":"/docs/category/advanced","navigation":{"previous":{"title":"Native token","permalink":"/docs/basics/native-token"},"next":{"title":"Delegate","permalink":"/docs/advanced/delegate"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/f63d58d7.28e40329.js b/docs/assets/js/f63d58d7.28e40329.js new file mode 100644 index 000000000..7a3483817 --- /dev/null +++ b/docs/assets/js/f63d58d7.28e40329.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[41906],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||p[f]||o;return n?r.createElement(m,l(l({ref:t},u),{},{components:n})):r.createElement(m,l({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c<o;c++)l[c]=n[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},27107:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="Attributes",i={unversionedId:"advanced/attributes",id:"version-0.8.1/advanced/attributes",title:"Attributes",description:"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that",source:"@site/versioned_docs/version-0.8.1/advanced/03-attributes.md",sourceDirName:"advanced",slug:"/advanced/attributes",permalink:"/docs/0.8.1/advanced/attributes",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1709886222,formattedLastUpdatedAt:"Mar 8, 2024",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Advanced Storage Concepts",permalink:"/docs/0.8.1/advanced/advanced-storage"},next:{title:"Storage Layout",permalink:"/docs/0.8.1/advanced/storage-layout"}},s={},c=[{value:"Payable",id:"payable",level:2},{value:"Example",id:"example",level:3},{value:"Non Reentrant",id:"non-reentrant",level:2},{value:"Example",id:"example-1",level:3},{value:"Mixing attributes",id:"mixing-attributes",level:2}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"attributes"},"Attributes"),(0,a.kt)("p",null,"Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that\nallows developers to embed common checks into function definitions in a readable and reusable manner.\nThese are essentially prerequisites for function execution."),(0,a.kt)("p",null,"Odra defines a few attributes that can be applied to functions to equip them with superpowers."),(0,a.kt)("h2",{id:"payable"},"Payable"),(0,a.kt)("p",null,"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," attribute can send and take money in the form of native tokens. "),(0,a.kt)("h3",{id:"example"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=examples/src/contracts/tlw.rs",title:"examples/src/contracts/tlw.rs"},"#[odra(payable)]\npub fn deposit(&mut self) {\n // Extract values\n let caller: Address = self.env().caller();\n let amount: U256 = self.env().attached_value();\n let current_block_time: u64 = self.env().get_block_time();\n\n // Multiple lock check\n if self.balances.get(&caller).is_some() {\n self.env.revert(Error::CannotLockTwice)\n }\n\n // Update state, emit event\n self.balances.set(&caller, amount);\n self.lock_expiration_map\n .set(&caller, current_block_time + self.lock_duration());\n self.env()\n .emit_event(Deposit {\n address: caller,\n amount\n });\n}\n")),(0,a.kt)("p",null,"If you try to send tokens to a non-payable function, the transaction will be automatically rejected."),(0,a.kt)("h2",{id:"non-reentrant"},"Non Reentrant"),(0,a.kt)("p",null,"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. "),(0,a.kt)("p",null,"To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. "),(0,a.kt)("p",null,"They can also use reentrancy guards to block recursive calls to sensitive functions."),(0,a.kt)("p",null,"In Odra you can just apply the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(non_reentrant)]")," attribute to your function."),(0,a.kt)("h3",{id:"example-1"},"Example"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra::module]\npub struct NonReentrantCounter {\n counter: Var<u32>\n}\n\n#[odra::module]\nimpl NonReentrantCounter {\n #[odra(non_reentrant)]\n pub fn count_ref_recursive(&mut self, n: u32) {\n if n > 0 {\n self.count();\n ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);\n }\n }\n}\n\nimpl NonReentrantCounter {\n fn count(&mut self) {\n let c = self.counter.get_or_default();\n self.counter.set(c + 1);\n }\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n use odra::{host::{Deployer, NoArgs}, ExecutionError};\n\n #[test]\n fn ref_recursion_not_allowed() {\n let test_env = odra_test::env();\n let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);\n\n let result = contract.count_ref_recursive(11);\n assert_eq!(result, ExecutionError::ReentrantCall.into());\n }\n}\n")),(0,a.kt)("h2",{id:"mixing-attributes"},"Mixing attributes"),(0,a.kt)("p",null,"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable.\nTo apply multiple attributes, you can write:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable, non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"or "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust"},"#[odra(payable)]\n#[odra(non_reentrant)]\nfn deposit() {\n // your logic...\n}\n")),(0,a.kt)("p",null,"In both cases attributes order does not matter."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f6aaa6b5.cc2a8cd1.js b/docs/assets/js/f6aaa6b5.cc2a8cd1.js new file mode 100644 index 000000000..1a8a7d3a3 --- /dev/null +++ b/docs/assets/js/f6aaa6b5.cc2a8cd1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[97987],{28603:e=>{e.exports=JSON.parse('{"title":"Migrations","description":"How to keep your code in sync with the latest version of the Odra Framework.","slug":"/category/migrations","permalink":"/docs/0.9.0/category/migrations","navigation":{"previous":{"title":"Build, Deploy and Read the State of a Contract","permalink":"/docs/0.9.0/tutorials/build-deploy-read"},"next":{"title":"Migration guide to v0.8.0","permalink":"/docs/0.9.0/migrations/to-0.8.0"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/f781f173.92dbdfd5.js b/docs/assets/js/f781f173.92dbdfd5.js new file mode 100644 index 000000000..c7ecb9a87 --- /dev/null +++ b/docs/assets/js/f781f173.92dbdfd5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[24854],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),l=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return a.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,g=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return t?a.createElement(g,i(i({ref:n},p),{},{components:t})):a.createElement(g,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l<o;l++)i[l]=t[l];return a.createElement.apply(null,i)}return a.createElement.apply(null,t)}u.displayName="MDXCreateElement"},76279:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=t(87462),r=(t(67294),t(3905));const o={},i="Advanced Storage Concepts",s={unversionedId:"advanced/advanced-storage",id:"version-1.0.0/advanced/advanced-storage",title:"Advanced Storage Concepts",description:"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.",source:"@site/versioned_docs/version-1.0.0/advanced/02-advanced-storage.md",sourceDirName:"advanced",slug:"/advanced/advanced-storage",permalink:"/docs/advanced/advanced-storage",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:2,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Delegate",permalink:"/docs/advanced/delegate"},next:{title:"Attributes",permalink:"/docs/advanced/attributes"}},c={},l=[{value:"Recap and Basic Concepts",id:"recap-and-basic-concepts",level:2},{value:"Advanced Storage Concepts",id:"advanced-storage-concepts-1",level:2},{value:"Sequence",id:"sequence",level:3},{value:"Advanced Mapping",id:"advanced-mapping",level:3},{value:"AdvancedStorage Contract",id:"advancedstorage-contract",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:l};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"advanced-storage-concepts"},"Advanced Storage Concepts"),(0,r.kt)("p",null,"The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," modules, which are key components of the advanced storage interaction in Odra."),(0,r.kt)("h2",{id:"recap-and-basic-concepts"},"Recap and Basic Concepts"),(0,r.kt)("p",null,"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Var"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"List"),". These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Var"),": A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Mapping"),": Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"List"),": Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over."),(0,r.kt)("p",null,"If you need a refresher on these topics, please refer to our ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/storage-interaction"},"guide")," on basic storage in Odra."),(0,r.kt)("h2",{id:"advanced-storage-concepts-1"},"Advanced Storage Concepts"),(0,r.kt)("h3",{id:"sequence"},"Sequence"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Sequence")," in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a ",(0,r.kt)("inlineCode",{parentName:"p"},"Var")," which keeps track of the current value. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"pub struct Sequence<T>\nwhere\n T: Num + One + ToBytes + FromBytes + CLTyped\n{\n value: Var<T>\n}\n")),(0,r.kt)("p",null,"The Sequence module provides functions ",(0,r.kt)("inlineCode",{parentName:"p"},"get_current_value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"next_value")," to get the current value and increment the value respectively."),(0,r.kt)("h3",{id:"advanced-mapping"},"Advanced Mapping"),(0,r.kt)("p",null,"In Odra, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," is a key-value storage system where the key is associated with a value.\nIn previous examples, the value of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra::odra_type]")," attribute."),(0,r.kt)("p",null,"However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state."),(0,r.kt)("p",null,"Let's consider the following example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/storage/mapping.rs"',title:'"examples/src/features/storage/mapping.rs"'},"use odra::{casper_types::U256, Mapping, UnwrapOrRevert};\nuse odra::prelude::*;\nuse crate::owned_token::OwnedToken;\n\n#[odra::module]\npub struct Mappings {\n strings: Mapping<(String, u32, String), String>,\n tokens: Mapping<String, OwnedToken>\n}\n\n#[odra::module]\nimpl Mappings {\n\n ...\n\n pub fn total_supply(&mut self, token_name: String) -> U256 {\n self.tokens.module(&token_name).total_supply()\n }\n\n pub fn get_string_api(\n &self, \n key1: String, \n key2: u32, \n key3: String\n ) -> String {\n let opt_string = self.strings.get(&(key1, key2, key3));\n opt_string.unwrap_or_revert(&self.env())\n }\n}\n")),(0,r.kt)("p",null,"As you can see, a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping")," key can consist of a tuple of values, not limited to a single value."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Accessing Odra modules differs from accessing regular values such as strings or numbers."),(0,r.kt)("p",{parentName:"admonition"},"Firstly, within a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),", you don't encapsulate the module with ",(0,r.kt)("inlineCode",{parentName:"p"},"Submodule"),"."),(0,r.kt)("p",{parentName:"admonition"},"Secondly, rather than utilizing the ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::get()")," function, call ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping::module()"),", which returns ",(0,r.kt)("inlineCode",{parentName:"p"},"SubModule<T>")," and sets the appropriate namespace for nested modules.")),(0,r.kt)("h2",{id:"advancedstorage-contract"},"AdvancedStorage Contract"),(0,r.kt)("p",null,"The given code snippet showcases the ",(0,r.kt)("inlineCode",{parentName:"p"},"AdvancedStorage")," contract that incorporates these storage concepts."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust"},"use odra::{Address, casper_types::U512, Sequence, Mapping};\nuse odra::prelude::*;\nuse crate::modules::Token;\n\n#[odra::module]\npub struct AdvancedStorage {\n counter: Sequence<u32>,\n tokens: Mapping<(String, String), Token>,\n}\n\nimpl AdvancedStorage {\n pub fn current_value(&self) -> u32 {\n self.counter.get_current_value()\n }\n\n pub fn increment_and_get(&mut self) -> u32 {\n self.counter.next_value()\n }\n\n pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {\n let token = self.tokens.module(&(token_name, creator));\n token.balance_of(&address)\n }\n\n pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {\n let mut token = self.tokens.module(&(token_name, creator));\n token.mint(amount, to);\n }\n}\n")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Odra offers a Sequence module, enabling contracts to store and increment a single value."),(0,r.kt)("li",{parentName:"ol"},"Mappings support composite keys expressed as tuples and can store modules as values.")),(0,r.kt)("p",null,"Understanding these concepts can help developers design and implement more efficient and flexible smart contracts."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f8f99b0e.5b69f68a.js b/docs/assets/js/f8f99b0e.5b69f68a.js new file mode 100644 index 000000000..a59826603 --- /dev/null +++ b/docs/assets/js/f8f99b0e.5b69f68a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[20626],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(n),m=r,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=p;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var u=2;u<s;u++)i[u]=n[u];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"},85162:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>w});var a=n(87462),r=n(67294),s=n(86010),i=n(12466),o=n(16550),l=n(91980),u=n(67392),c=n(50012);function d(e){return function(e){return r.Children.map(e,(e=>{if((0,r.isValidElement)(e)&&"value"in e.props)return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??d(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,o.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function y(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[i,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[l,u]=h({queryString:n,groupId:a}),[d,y]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=l??d;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{b&&o(b)}),[b]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);o(e),u(e),y(e)}),[u,y,s]),tabValues:s}}var b=n(72389);const g="tabList__CuJ",f="tabItem_LNqP";function _(e){let{className:t,block:n,selectedValue:o,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),p=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==o&&(d(t),l(a))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:p},i,{className:(0,s.Z)("tabs__item",f,i?.className,{"tabs__item--active":o===t})}),n??t)})))}function k(e){let{lazy:t,children:n,selectedValue:a}=e;if(n=Array.isArray(n)?n:[n],t){const e=n.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},n.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function v(e){const t=y(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",g)},r.createElement(_,(0,a.Z)({},e,t)),r.createElement(k,(0,a.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return r.createElement(v,(0,a.Z)({key:String(t)},e))}},1417:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),i=n(85162);const o={sidebar_position:6},l="Build, Deploy and Read the State of a Contract",u={unversionedId:"tutorials/build-deploy-read",id:"version-0.9.1/tutorials/build-deploy-read",title:"Build, Deploy and Read the State of a Contract",description:"In this guide, we will show the full path from creating a contract, deploying it and reading the state.",source:"@site/versioned_docs/version-0.9.1/tutorials/build-deploy-read.md",sourceDirName:"tutorials",slug:"/tutorials/build-deploy-read",permalink:"/docs/0.9.1/tutorials/build-deploy-read",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"tutorialSidebar",previous:{title:"Pausable",permalink:"/docs/0.9.1/tutorials/pauseable"},next:{title:"Using Proxy Caller",permalink:"/docs/0.9.1/tutorials/using-proxy-caller"}},c={},d=[{value:"Contract",id:"contract",level:3},{value:"Deploying the contract",id:"deploying-the-contract",level:3},{value:"Storage Layout",id:"storage-layout",level:3},{value:"Reading the state",id:"reading-the-state",level:3}],p={toc:d};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"build-deploy-and-read-the-state-of-a-contract"},"Build, Deploy and Read the State of a Contract"),(0,r.kt)("p",null,"In this guide, we will show the full path from creating a contract, deploying it and reading the state."),(0,r.kt)("p",null,"We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript."),(0,r.kt)("p",null,"Before you start, make sure you completed the following steps:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Read the ",(0,r.kt)("a",{parentName:"li",href:"../category/getting-started"},"Getting Started")," guide"),(0,r.kt)("li",{parentName:"ul"},"Get familiar with ",(0,r.kt)("a",{parentName:"li",href:"https://docs.casper.network/developers/dapps/setup-nctl/"},"NCTL tutorial")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/make-software/casper-nctl-docker"},"NCTL docker")," image"),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/casper-ecosystem/casper-client-rs"},"casper-client"))),(0,r.kt)("h3",{id:"contract"},"Contract"),(0,r.kt)("p",null,"Let's write a contract with complex storage layout."),(0,r.kt)("p",null,"The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a ",(0,r.kt)("inlineCode",{parentName:"p"},"Mapping"),"."),(0,r.kt)("p",null,"We will expose two methods:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The constructor ",(0,r.kt)("inlineCode",{parentName:"li"},"init")," which sets the metadata and the version of the contract."),(0,r.kt)("li",{parentName:"ol"},"The method ",(0,r.kt)("inlineCode",{parentName:"li"},"set_data")," which sets the value of the numeric field and the values of the mapping.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=custom_item.rs showLineNumbers",title:"custom_item.rs",showLineNumbers:!0},"use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};\n\n// A custom type with a vector of another custom type\n#[odra::odra_type]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec<Price>,\n}\n\n#[odra::odra_type]\npub struct Price {\n value: U256,\n}\n\n// The main contract with a version, metadata and a submodule\n#[odra::module]\npub struct CustomItem {\n version: Var<u32>,\n meta: Var<Metadata>,\n data: SubModule<Data>\n}\n\n#[odra::module]\nimpl CustomItem {\n pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {\n let meta = Metadata {\n name,\n description,\n prices: vec![\n Price { value: price_1 },\n Price { value: price_2 }\n ]\n };\n self.meta.set(meta);\n self.version.set(self.version.get_or_default() + 1);\n }\n\n pub fn set_data(&mut self, value: u32, name: String, name2: String) {\n self.data.value.set(value);\n self.data.inner.named_values.set(&name, 10);\n self.data.inner.named_values.set(&name2, 20);\n }\n}\n\n// A submodule with a numeric value and another submodule\n#[odra::module]\nstruct Data {\n value: Var<u32>,\n inner: SubModule<InnerData>,\n}\n\n// A submodule with a mapping\n#[odra::module]\nstruct InnerData {\n named_values: Mapping<String, u32>,\n}\n\n")),(0,r.kt)("h3",{id:"deploying-the-contract"},"Deploying the contract"),(0,r.kt)("p",null,"First, we need to setup the chain. We will use the NCTL docker image to run a local network."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl\n")),(0,r.kt)("p",null,"Next, we need to compile the contract to a Wasm file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cargo odra build -c custom_item \n")),(0,r.kt)("p",null,"Then, we can deploy the contract using the ",(0,r.kt)("inlineCode",{parentName:"p"},"casper-client")," tool."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"casper-client put-deploy \\\n --node-address http://localhost:11101 \\\n --chain-name casper-net-1 \\\n --secret-key path/to/your/secret_key.pem \\ \n --session-path [PATH_TO_WASM] \\\n --payment-amount 100000000000 \\\n --session-arg \"odra_cfg_package_hash_key_name:string:'test_contract_package_hash'\" \\\n --session-arg \"odra_cfg_allow_key_override:bool:'true'\" \\\n --session-arg \"odra_cfg_is_upgradable:bool:'true'\" \\\n --session-arg \"name:string='My Name'\" \\\n --session-arg \"description:string='My Description'\" \\ \n --session-arg \"price_1:u256='101'\" \\\n --session-arg \"price_2:u256='202'\"\n")),(0,r.kt)("p",null,"Finally, we can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"set_data")," method to set the values of the contract."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'casper-client put-deploy \\\n --node-address http://localhost:11101 \\ \n --chain-name casper-net-1 \\\n --secret-key ./keys/secret_key.pem \\ \n --payment-amount 2000000000 \\\n --session-hash [DEPLOYED_CONTRACT_HASH] \\\n --session-entry-point "set_data" \\\n --session-arg "value:u32:\'666\'" \\\n --session-arg "name:string=\'alice\'" \\ \n --session-arg "name2:string=\'bob\'"\n')),(0,r.kt)("h3",{id:"storage-layout"},"Storage Layout"),(0,r.kt)("p",null,"To read the state of the contract, we need to understand the storage layout."),(0,r.kt)("p",null,"The first step is to calculate the index of the keys. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Storage Layout\n\nCustomItem: prefix: 0x0..._0000_0000_0000 0\n version: u32, 0x0..._0000_0000_0000 0\n meta: Metadata, 0x0..._0000_0000_0001 1\n data: Data: prefix: 0x0..._0000_0000_0010 2\n value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0\n inner: InnerData: prefix: 0x0..._0000_0010_0001 (2 << 4) + 1\n named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0\n")),(0,r.kt)("p",null,"The actual key is obtained as follows:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Convert the index to a big-endian byte array."),(0,r.kt)("li",{parentName:"ol"},"Concatenate the index with the mapping data."),(0,r.kt)("li",{parentName:"ol"},"Hash the concatenated bytes using blake2b."),(0,r.kt)("li",{parentName:"ol"},"Return the hex representation of the hash (the stored key must be utf-8 encoded).")),(0,r.kt)("p",null,"In more detail, the storage layout is described in the ",(0,r.kt)("a",{parentName:"p",href:"/docs/0.9.1/advanced/storage-layout"},"Storage Layout article"),"."),(0,r.kt)("h3",{id:"reading-the-state"},"Reading the state"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"rust",label:"Rust",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=main.rs showLineNumbers",title:"main.rs",showLineNumbers:!0},'use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};\nuse casper_types::{\n bytesrepr::{FromBytes, ToBytes},\n U256,\n};\n\n// replace with your contract hash\nconst CONTRACT_HASH: &str = "hash-...";\nconst NODE_ADDRESS: &str = "http://localhost:11101/rpc";\nconst RPC_ID: &str = "casper-net-1";\nconst DICTIONARY_NAME: &str = "state";\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Metadata {\n name: String,\n description: String,\n prices: Vec<Price>,\n}\n\n#[derive(Debug, PartialEq, Eq, Hash)]\npub struct Price {\n value: U256,\n}\n\nasync fn read_state_key(key: String) -> Vec<u8> {\n let state_root_hash = casper_client::get_state_root_hash(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n None,\n )\n .await\n .unwrap()\n .result\n .state_root_hash\n .unwrap();\n\n // Read the value from the `state` dictionary.\n let result = casper_client::get_dictionary_item(\n RPC_ID.to_string().into(),\n NODE_ADDRESS,\n Verbosity::Low,\n state_root_hash,\n DictionaryItemIdentifier::ContractNamedKey {\n key: CONTRACT_HASH.to_string(),\n dictionary_name: DICTIONARY_NAME.to_string(),\n dictionary_item_key: key,\n },\n )\n .await\n .unwrap()\n .result\n .stored_value;\n\n // We expect the value to be a CLValue\n if let StoredValue::CLValue(cl_value) = result {\n // Ignore the first 4 bytes, which are the length of the CLType.\n cl_value.inner_bytes()[4..].to_vec()\n } else {\n vec![]\n }\n}\n\nasync fn metadata() -> Metadata {\n // The key for the metadata is 1, and it has no mapping data\n let key = key(1, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the name and store the remaining bytes\n let (name, bytes) = String::from_bytes(&bytes).unwrap();\n // Read the description and store the remaining bytes\n let (description, bytes) = String::from_bytes(&bytes).unwrap();\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();\n\n let mut prices = vec![];\n // As we know the size of the vector, we can loop over it\n for _ in 0..size {\n // Read the value and store the remaining bytes\n let (value, rem) = U256::from_bytes(&bytes).unwrap();\n bytes = rem;\n prices.push(Price { value });\n }\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n Metadata {\n name,\n description,\n prices\n }\n}\n\nasync fn value() -> u32 {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n let key = key(2 << 4, &[]);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nasync fn named_value(name: &str) -> u32 {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = name.to_bytes().unwrap();\n let key = key(((2 << 4) + 1) << 4, &mapping_data);\n let bytes = read_state_key(key).await;\n\n // Read the value and ignore the remaining bytes for simplicity\n u32::from_bytes(&bytes).unwrap().0\n}\n\nfn main() {\n let runtime = tokio::runtime::Runtime::new().unwrap();\n dbg!(runtime.block_on(metadata()));\n dbg!(runtime.block_on(value()));\n dbg!(runtime.block_on(named_value("alice")));\n dbg!(runtime.block_on(named_value("bob")));\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfn key(idx: u32, mapping_data: &[u8]) -> String {\n let mut key = Vec::new();\n key.extend_from_slice(idx.to_be_bytes().as_ref());\n key.extend_from_slice(mapping_data);\n let hashed_key = blake2b(&key);\n\n hex::encode(&hashed_key)\n}\n\nfn blake2b(bytes: &[u8]) -> [u8; 32] {\n let mut result = [0u8; 32];\n let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32)\n .expect("should create hasher");\n let _ = std::io::Write::write(&mut hasher, bytes);\n blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)\n .expect("should copy hash to the result array");\n result\n}\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'cargo run\n[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {\n name: "My Contract",\n description: "My Description",\n prices: [\n Price {\n value: 123,\n },\n Price {\n value: 321,\n },\n ],\n}\n[src/main.rs:117:5] runtime.block_on(value()) = 666\n[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20\n[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10\n'))),(0,r.kt)(i.Z,{value:"ts",label:"TypeScript",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript",metastring:"title=index.ts showLineNumbers",title:"index.ts",showLineNumbers:!0},'\nimport { blake2bHex } from "blakejs";\nimport {\n CLList,\n CLListBytesParser,\n CLStringBytesParser,\n CLU256BytesParser,\n CLU32BytesParser,\n CLU8,\n CLValueBuilder,\n CasperClient,\n CasperServiceByJsonRPC,\n Contracts,\n ToBytes,\n} from "casper-js-sdk";\n\nconst LOCAL_NODE_URL = "http://127.0.0.1:11101/rpc";\n// replace with your contract hash\nconst CONTRACT_HASH = "hash-...";\nconst STATE_DICTIONARY_NAME = "state";\nconst U32_SIZE = 4;\n\nclass Price {\n value: bigint;\n\n constructor(value: bigint) {\n this.value = value;\n }\n}\n\nclass Metadata {\n name: string;\n description: string;\n prices: Price[];\n\n constructor(name: string, description: string, prices: Price[]) {\n this.name = name;\n this.description = description;\n this.prices = prices;\n }\n}\n\nexport class Contract {\n client: CasperClient;\n service: CasperServiceByJsonRPC;\n contract: Contracts.Contract;\n\n private constructor() {\n this.client = new CasperClient(LOCAL_NODE_URL);\n this.service = new CasperServiceByJsonRPC(LOCAL_NODE_URL);\n this.contract = new Contracts.Contract(this.client);\n this.contract.setContractHash(CONTRACT_HASH);\n }\n\n static async load() {\n return new Contract();\n }\n\n async read_state(key: string) {\n const response = await this.contract.queryContractDictionary(STATE_DICTIONARY_NAME, key);\n let data: CLList<CLU8 & ToBytes> = CLValueBuilder.list(response.value());\n let bytes = new CLListBytesParser().toBytes(data).unwrap();\n // Ignore the first 4 bytes, which are the length of the CLType\n return bytes.slice(4);\n }\n\n async metadata() {\n // The key for the metadata is 1, and it has no mapping data\n let bytes: Uint8Array = await this.read_state(key(1));\n\n // Read the name and store the remaining bytes\n let name = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = name.remainder as Uint8Array;\n\n // Read the description and store the remaining bytes\n let description = new CLStringBytesParser().fromBytesWithRemainder(bytes);\n bytes = description.remainder as Uint8Array;\n\n let prices: Price[] = [];\n // A vector is stored as a u32 size followed by the elements\n // Read the size of the vector and store the remaining bytes\n let size = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n bytes = size.remainder as Uint8Array;\n\n // As we know the size of the vector, we can loop over it\n for (let i = 0; i < size.result.unwrap().data.toNumber(); i++) {\n let price = new CLU256BytesParser().fromBytesWithRemainder(bytes);\n bytes = price.remainder as Uint8Array;\n prices.push(new Price(price.result.unwrap().data.toBigInt()));\n }\n\n // Anytime you finish parsing a value, you should check if there are any remaining bytes\n // if there are, it means you have a bug in your parsing logic.\n // For simplicity, we will ignore the remaining bytes here.\n return new Metadata(\n name.result.unwrap().data,\n description.result.unwrap().data,\n prices\n );\n }\n \n async value() {\n // The key for the value is (2 << 4) + 0, and it has no mapping data\n const bytes = await this.read_state(key((2 << 4) + 0));\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n\n async named_value(name: string) {\n // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes\n let mapping_data = new CLStringBytesParser()\n .toBytes(CLValueBuilder.string(name))\n .unwrap();\n let bytes: Uint8Array = await this.read_state(\n key(((2 << 4) + 1) << 4, mapping_data)\n );\n\n // Read the value and ignore the remaining bytes for simplicity\n let value = new CLU32BytesParser().fromBytesWithRemainder(bytes);\n return value.result.unwrap().data.toBigInt();\n }\n}\n\n// The key is a combination of the index and the mapping data\n// The algorithm is as follows:\n// 1. Convert the index to a big-endian byte array\n// 2. Concatenate the index with the mapping data\n// 3. Hash the concatenated bytes using blake2b\n// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)\nfunction key(idx: number, mapping_data: Uint8Array = new Uint8Array([])) {\n let key = new Uint8Array(U32_SIZE + mapping_data.length);\n new DataView(key.buffer).setUint32(0, idx, false); // false for big-endian\n key.set(mapping_data, U32_SIZE);\n\n return blake2bHex(key, undefined, 32);\n}\n\nconst contract = Contract.load();\ncontract.then(async (c) => {\n console.log(await c.value());\n console.log(await c.metadata());\n console.log(await c.named_value("alice"));\n console.log(await c.named_value("bob"));\n});\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tsc && node target/index.js \nMetadata {\n name: 'My Contract',\n description: 'My Description',\n prices: [ Price { value: 123n }, Price { value: 321n } ]\n}\n666n\n20n\n10n\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f91f9bef.593a0b5e.js b/docs/assets/js/f91f9bef.593a0b5e.js new file mode 100644 index 000000000..3b4459c84 --- /dev/null +++ b/docs/assets/js/f91f9bef.593a0b5e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[74234],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),h=c(n),u=o,m=h["".concat(s,".").concat(u)]||h[u]||p[u]||r;return n?a.createElement(m,i(i({ref:t},d),{},{components:n})):a.createElement(m,i({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c<r;c++)i[c]=n[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}h.displayName="MDXCreateElement"},79812:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:3},i="Livenet",l={unversionedId:"backends/livenet",id:"version-1.0.0/backends/livenet",title:"Livenet",description:"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local",source:"@site/versioned_docs/version-1.0.0/backends/04-livenet.md",sourceDirName:"backends",slug:"/backends/livenet",permalink:"/docs/backends/livenet",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Casper",permalink:"/docs/backends/casper"},next:{title:"Examples",permalink:"/docs/category/examples"}},s={},c=[{value:"Setup",id:"setup",level:2},{value:"Usage",id:"usage",level:2},{value:"How Livenet backend works",id:"how-livenet-backend-works",level:2},{value:"Multiple environments",id:"multiple-environments",level:2}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"livenet"},"Livenet"),(0,o.kt)("p",null,"The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local\ntest node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend\nto handle the deployment of your contracts to the real blockchain."),(0,o.kt)("p",null,"Furthermore, it is implemented in a similarly to Casper or OdraVM,\nhowever, it uses a real blockchain to deploy contracts and store the state.\nThis lets us use Odra to deploy and test contracts on a real blockchain, but\non the other hand, it comes with some limitations on what can be done in the tests."),(0,o.kt)("p",null,"The main differences between Livenet and e.g. CasperVM backend are:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Real CSPR tokens are used to deploy and call contracts. This also means that we need to\npay for each contract deployment and each contract call. Of course, we can use the ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.cspr.live/tools/faucet"},"faucet"),"\nto get some tokens for testing purposes, but we still need to specify the amount needed\nfor each action."),(0,o.kt)("li",{parentName:"ul"},"The contract state is stored on the real blockchain, so we can't just reset the state -\nwe can redeploy the contract, but we can't remove the old one."),(0,o.kt)("li",{parentName:"ul"},"Because of the above, we can load the existing contracts and use them in the tests."),(0,o.kt)("li",{parentName:"ul"},"We have no control over the block time. This means that for example, ",(0,o.kt)("inlineCode",{parentName:"li"},"advance_block_time")," function\nis implemented by waiting for the real time to pass.")),(0,o.kt)("p",null,"This is also a cause for the fact that the Livenet backend cannot be (yet) used for running\nthe regular Odra tests. Instead, we can create integration tests or binaries which will\nuse a slightly different workflow to test the contracts."),(0,o.kt)("h2",{id:"setup"},"Setup"),(0,o.kt)("p",null,"To use Livenet backend, we need to provide Odra with some information - the network address, our private\nkey and the name of the chain we want to use. Optionally, we can add multiple private keys to use\nmore than one account in our tests. Those values are passed using environment variables. We can use .env\nfile to store them - let's take a look at an example .env file, created from the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/examples/.env.sample"},".env.sample")," file from\nexamples folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-env"},"# Path to the secret key of the account that will be used\n# to deploy the contracts.\n# We're using .keys folder so we don't accidentally commit\n# the secret key to the repository.\nODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem\n\n# RPC address of the node that will be used to deploy the contracts.\nODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777\n\n# Chain name of the network. Known values:\n# - integration-test\nODRA_CASPER_LIVENET_CHAIN_NAME=integration-test\n\n# Paths to the secret keys of the additional accounts.\n# Main secret key will be 0th account.\nODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem\nODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem\n")),(0,o.kt)("p",null,"With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find\na simple binary that deploys a contract and calls it. The test is located in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/odradev/odra/blob/release/1.0.0/examples/bin/erc20_on_livenet.rs"},"erc20_on_livenet.rs")," file.\nLet's go through the code:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust"},'fn main() {\n // Similar to the OdraVM backend, we need to initialize\n // the environment:\n let env = odra_casper_livenet_env::env();\n\n // Most of the for the host env works the same as in the\n // OdraVM backend.\n let owner = env.caller();\n // Addresses are the real addresses on the blockchain,\n // so we need to provide them\n // if we did not import their secret keys.\n let recipient = \n "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";\n let recipient = Address::from_str(recipient).unwrap();\n\n // Arguments for the contract init method.\n let name = String::from("Plascoin");\n let symbol = String::from("PLS");\n let decimals = 10u8;\n let initial_supply: U256 = U256::from(10_000);\n \n // The main difference between other backends - we need to specify\n // the gas limit for each action.\n // The limit will be used for every consecutive action\n // until we change it.\n env.set_gas(100_000_000_000u64);\n \n // Deploy the contract. The API is the same as in the OdraVM backend.\n let init_args = Erc20InitArgs {\n name,\n symbol,\n decimals,\n initial_supply: Some(initial_supply)\n };\n let mut token = Erc20HostRef::deploy(env, init_args);\n \n // We can now use the contract as we would in the OdraVM backend.\n println!("Token address: {}", token.address().to_string());\n\n // Uncomment to load existing contract.\n // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";\n // let address = Address::from_str(address).unwrap();\n // We use the Livenet-specific `load` method to load the contract\n // that is already deployed.\n // let mut token = Erc20Deployer::load(env, address);\n\n // Non-mutable calls are free! Neat, huh? More on that later.\n println!("Token name: {}", token.name());\n\n // The next call is mutable, but the cost is lower that the deployment,\n // so we change the amount of gas\n env.set_gas(3_000_000_000u64);\n token.transfer(recipient, U256::from(1000));\n\n println!("Owner\'s balance: {:?}", token.balance_of(owner));\n println!("Recipient\'s balance: {:?}", token.balance_of(recipient));\n}\n')),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The above example is a rust binary, not a test. Note that it is also added as a section of the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[bin]\nname = "erc20_on_livenet"\npath = "src/bin/erc20_on_livenet.rs"\nrequired-features = ["livenet"]\ntest = false\n'))),(0,o.kt)("h2",{id:"usage"},"Usage"),(0,o.kt)("p",null,"To run the above code, we simply need to run the binary with the ",(0,o.kt)("inlineCode",{parentName:"p"},"livenet")," feature enabled:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"Before executing the binary, make sure you built a wasm file.")),(0,o.kt)("p",null,"A part of a sample output should look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'...\n\ud83d\udc81 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\ude44 WAIT : Waiting 15s for "65b1a5d21...".\n\ud83d\udc81 INFO : Deploy "65b1a5d21..." successfully executed.\nOwner\'s balance: 4004\nRecipient\'s balance: 4000\n')),(0,o.kt)("p",null,"Those logs are a result of the last 4 lines of the above listing.\nEach deployment or a call to the blockchain will be noted and will take some time to execute.\nWe can see that the ",(0,o.kt)("inlineCode",{parentName:"p"},"transfer")," call took over 15 seconds to execute. But calling ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," was nearly instant\nand cost us nothing. How it is possible?"),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"You can see the deployment on ",(0,o.kt)("a",{parentName:"p",href:"http://cspr.live/"},"http://cspr.live/")," - the transfer from the example\ncan be seen ",(0,o.kt)("a",{parentName:"p",href:"https://integration.cspr.live/deploy/65b1a5d21174a62c675f89683aba995c453b942c705b404a1f8bbf6f0f6de32a"},"here"),".")),(0,o.kt)("h2",{id:"how-livenet-backend-works"},"How Livenet backend works"),(0,o.kt)("p",null,"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state.\nIt is possible however to query the state of the blockchain for free."),(0,o.kt)("p",null,"This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the\nnode is the current state. This is why the ",(0,o.kt)("inlineCode",{parentName:"p"},"balance_of")," call was almost instant and free."),(0,o.kt)("p",null,"Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract\n(see ",(0,o.kt)("a",{parentName:"p",href:"/docs/basics/cross-calls"},"Cross Calls"),"), it is executed offline and\nnode is used for the state query only. However, the Livenet needs to know the connection between the contracts\nand the code, so make sure to deploy or load already deployed contracts"),(0,o.kt)("h2",{id:"multiple-environments"},"Multiple environments"),(0,o.kt)("p",null,"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts,\nmultiple nodes or even multiple chains."),(0,o.kt)("p",null,"To do this, simply create a new ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file with a different prefix - for example, ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet.env"),".\nThen, pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"ODRA_CASPER_LIVENET_ENV")," variable with value either ",(0,o.kt)("inlineCode",{parentName:"p"},"integration")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"mainnet")," to select which file\nhas to be used first. If your ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file has a value that IS present in the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file, it will\noverride the value from the ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet\n")),(0,o.kt)("p",null,"To sum up - this command will firstly load the ",(0,o.kt)("inlineCode",{parentName:"p"},"integration.env")," file and then load the missing values from ",(0,o.kt)("inlineCode",{parentName:"p"},".env")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/f92986d2.114c4b29.js b/docs/assets/js/f92986d2.114c4b29.js new file mode 100644 index 000000000..99f4bdff5 --- /dev/null +++ b/docs/assets/js/f92986d2.114c4b29.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[49165],{49749:t=>{t.exports=JSON.parse('{"title":"Getting started","description":"5 minutes to learn the most important Odra concepts.","slug":"/category/getting-started","permalink":"/docs/0.4.0/category/getting-started","navigation":{"previous":{"title":"Odra framework","permalink":"/docs/0.4.0/"},"next":{"title":"Installation","permalink":"/docs/0.4.0/getting-started/installation"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/fa4e959a.b9a69e0e.js b/docs/assets/js/fa4e959a.b9a69e0e.js new file mode 100644 index 000000000..816242b2b --- /dev/null +++ b/docs/assets/js/fa4e959a.b9a69e0e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[21544],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=l(n),d=a,f=p["".concat(c,".").concat(d)]||p[d]||m[d]||o;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=p;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},73633:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:6,description:"How to get information from the Host"},i="Host Communication",s={unversionedId:"basics/communicating-with-host",id:"basics/communicating-with-host",title:"Host Communication",description:"How to get information from the Host",source:"@site/docs/basics/06-communicating-with-host.md",sourceDirName:"basics",slug:"/basics/communicating-with-host",permalink:"/docs/next/basics/communicating-with-host",draft:!1,tags:[],version:"current",lastUpdatedAt:1718615463,formattedLastUpdatedAt:"Jun 17, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"How to get information from the Host"},sidebar:"tutorialSidebar",previous:{title:"Storage interaction",permalink:"/docs/next/basics/storage-interaction"},next:{title:"Testing",permalink:"/docs/next/basics/testing"}},c={},l=[{value:"What's next",id:"whats-next",level:2}],u={toc:l};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"host-communication"},"Host Communication"),(0,a.kt)("p",null,"One of the things that your contract will probably do is to query the host for some information -\nwhat is the current time? Who called me? Following example shows how to do this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/host_functions.rs"',title:'"examples/src/features/host_functions.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module]\npub struct HostContract {\n name: Var<String>,\n created_at: Var<u64>,\n created_by: Var<Address>\n}\n\n#[odra::module]\nimpl HostContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.created_at.set(self.env().get_block_time());\n self.created_by.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n}\n")),(0,a.kt)("p",null,"As you can see, we are using ",(0,a.kt)("inlineCode",{parentName:"p"},"self.env()"),". It is an implementation of ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/module/trait.Module.html#tymehtod.env"},(0,a.kt)("inlineCode",{parentName:"a"},"Module::env()")),", autogenerated\nby ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute. The function returns a reference to the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/1.1.0/odra/struct.ContractEnv.html"},(0,a.kt)("inlineCode",{parentName:"a"},"ContractEnv"))," (you can read more in\nthe ",(0,a.kt)("a",{parentName:"p",href:"/docs/next/backends/what-is-a-backend#contract-env"},(0,a.kt)("inlineCode",{parentName:"a"},"Backend section")),"). This is a structure that provides access to the host functions and variables. "),(0,a.kt)("p",null,"In this example, we use two of them:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"get_block_time()")," - returns the current block time as u64. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"caller()")," - returns an Odra ",(0,a.kt)("inlineCode",{parentName:"li"},"Address")," of the caller (this can be an external caller or another contract).")),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"You will learn more functions that Odra exposes from host and types it uses in further articles.")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code\nwe presented in fact works!"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fabdfba1.7d02e6eb.js b/docs/assets/js/fabdfba1.7d02e6eb.js new file mode 100644 index 000000000..fdf32984a --- /dev/null +++ b/docs/assets/js/fabdfba1.7d02e6eb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[63898],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(r),m=a,b=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(b,i(i({ref:t},c),{},{components:r})):n.createElement(b,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d<o;d++)i[d]=r[d];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},88672:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var n=r(87462),a=(r(67294),r(3905));const o={sidebar_position:2,description:"Files and folders in the Odra project"},i="Directory structure",l={unversionedId:"basics/directory-structure",id:"version-0.9.0/basics/directory-structure",title:"Directory structure",description:"Files and folders in the Odra project",source:"@site/versioned_docs/version-0.9.0/basics/02-directory-structure.md",sourceDirName:"basics",slug:"/basics/directory-structure",permalink:"/docs/0.9.0/basics/directory-structure",draft:!1,tags:[],version:"0.9.0",lastUpdatedAt:1712051787,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Files and folders in the Odra project"},sidebar:"tutorialSidebar",previous:{title:"Cargo Odra",permalink:"/docs/0.9.0/basics/cargo-odra"},next:{title:"Odra.toml",permalink:"/docs/0.9.0/basics/odra-toml"}},s={},d=[{value:"Cargo.toml",id:"cargotoml",level:2},{value:"Odra.toml",id:"odratoml",level:2},{value:"src/",id:"src",level:2},{value:"bin/",id:"bin",level:2},{value:"target/",id:"target",level:2},{value:"wasm/",id:"wasm",level:2}],c={toc:d};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"directory-structure"},"Directory structure"),(0,a.kt)("p",null,"After creating a new project using Odra and running the tests, you will be presented with the\nfollowing files and directories:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},".\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 Odra.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 flipper.rs\n\u2502 \u2514\u2500\u2500 lib.rs\n\u251c\u2500\u2500 bin/\n| |\u2500\u2500 build_contract.rs\n| \u2514\u2500\u2500 build_schema.rs\n\u251c\u2500\u2500 target/\n\u2514\u2500\u2500 wasm/\n")),(0,a.kt)("h2",{id:"cargotoml"},"Cargo.toml"),(0,a.kt)("p",null,"Let's first take a look at ",(0,a.kt)("inlineCode",{parentName:"p"},"Cargo.toml")," file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "sample"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nodra = "0.9.0"\n\n[dev-dependencies]\nodra-test = "0.9.0"\n\n[build-dependencies]\nodra-build = "0.9.0"\n\n[[bin]]\nname = "sample_build_contract"\npath = "bin/build_contract.rs"\ntest = false\n\n[[bin]]\nname = "sample_build_schema"\npath = "bin/build_schema.rs"\ntest = false\n\n[profile.release]\ncodegen-units = 1\nlto = true\n\n[profile.dev.package."*"]\nopt-level = 3\n')),(0,a.kt)("p",null,"By default, your project will use the latest odra version available at crates.io. For testing purposes, ",(0,a.kt)("inlineCode",{parentName:"p"},"odra-test")," is also\nadded as a dev dependency."),(0,a.kt)("h2",{id:"odratoml"},"Odra.toml"),(0,a.kt)("p",null,"This is the file that holds information about contracts that will be generated when running ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[[contracts]]\nfqn = "sample::Flipper"\n')),(0,a.kt)("p",null,"As we can see, we have a single contract, its ",(0,a.kt)("inlineCode",{parentName:"p"},"fqn")," (Fully Qualified Name) corresponds to\nthe contract is located in ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),".\nMore contracts can be added here by hand, or by using ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra generate")," command."),(0,a.kt)("h2",{id:"src"},"src/"),(0,a.kt)("p",null,"This is the folder where your smart contract files live."),(0,a.kt)("h2",{id:"bin"},"bin/"),(0,a.kt)("p",null,"This is the folder where scripts that will be used to generate code or schemas live.\nYou don't need to modify those files, they are generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra new")," command and\nare used by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra schema")," commands."),(0,a.kt)("h2",{id:"target"},"target/"),(0,a.kt)("p",null,"Files generated by cargo during the build process are put here."),(0,a.kt)("h2",{id:"wasm"},"wasm/"),(0,a.kt)("p",null,"WASM files generated by ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra build")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo odra test")," are put here. You can grab those WASM files\nand deploy them on the blockchain."),(0,a.kt)("h1",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"Now, let's take a look at one of the files mentioned above in more detail,\nnamely the ",(0,a.kt)("inlineCode",{parentName:"p"},"Odra.toml")," file."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fb249be3.27a1f96f.js b/docs/assets/js/fb249be3.27a1f96f.js new file mode 100644 index 000000000..f58f3947a --- /dev/null +++ b/docs/assets/js/fb249be3.27a1f96f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[6e4],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),d=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=d(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=d(t),m=o,f=p["".concat(s,".").concat(m)]||p[m]||c[m]||a;return t?r.createElement(f,l(l({ref:n},u),{},{components:t})):r.createElement(f,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=p;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var d=2;d<a;d++)l[d]=t[d];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}p.displayName="MDXCreateElement"},67268:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>d});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},l="OwnedToken",i={unversionedId:"tutorials/owned-token",id:"version-0.3.0/tutorials/owned-token",title:"OwnedToken",description:"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.",source:"@site/versioned_docs/version-0.3.0/tutorials/owned-token.md",sourceDirName:"tutorials",slug:"/tutorials/owned-token",permalink:"/docs/0.3.0/tutorials/owned-token",draft:!1,tags:[],version:"0.3.0",lastUpdatedAt:1687764750,formattedLastUpdatedAt:"Jun 26, 2023",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"defaultSidebar",previous:{title:"ERC-20",permalink:"/docs/0.3.0/tutorials/erc20"}},s={},d=[{value:"Code",id:"code",level:2},{value:"Module definition",id:"module-definition",level:3},{value:"Delegation",id:"delegation",level:3},{value:"Summary",id:"summary",level:2}],u={toc:d};function c(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ownedtoken"},"OwnedToken"),(0,o.kt)("p",null,"This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one."),(0,o.kt)("h2",{id:"code"},"Code"),(0,o.kt)("p",null,"What should our module be capable of?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Conform the Erc20 interface."),(0,o.kt)("li",{parentName:"ol"},"Allow minting tokens but only the module owner."),(0,o.kt)("li",{parentName:"ol"},"The current owner should be able to designate a new owner.")),(0,o.kt)("h3",{id:"module-definition"},"Module definition"),(0,o.kt)("p",null,"Let's define a module called ",(0,o.kt)("inlineCode",{parentName:"p"},"OwnedToken")," that is a composition of ",(0,o.kt)("inlineCode",{parentName:"p"},"Ownable")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Erc20")," modules."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use crate::{erc20::Erc20, ownable::Ownable};\n\n#[odra::module]\npub struct OwnedToken {\n ownable: Ownable,\n erc20: Erc20\n}\n")),(0,o.kt)("p",null,"As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!"),(0,o.kt)("h3",{id:"delegation"},"Delegation"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-rust",metastring:"title=owned_token.rs showLineNumbers",title:"owned_token.rs",showLineNumbers:!0},"use odra::types::{Address, Balance}\n\n...\n\n#[odra::module]\nimpl OwnedToken {\n #[odra(init)]\n pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {\n let deployer = contract_env::caller();\n self.ownable.init(deployer);\n self.erc20.init(name, symbol, decimals, initial_supply);\n }\n\n pub fn name(&self) -> String {\n self.erc20.name()\n }\n\n pub fn symbol(&self) -> String {\n self.erc20.symbol()\n }\n\n pub fn decimals(&self) -> u8 {\n self.erc20.decimals()\n }\n\n pub fn total_supply(&self) -> Balance {\n self.erc20.total_supply()\n }\n\n pub fn balance_of(&self, address: &Address) -> Balance {\n self.erc20.balance_of(address)\n }\n\n pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {\n self.erc20.allowance(owner, spender)\n }\n\n pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {\n self.erc20.transfer(recipient, amount);\n }\n\n pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {\n self.erc20.transfer_from(owner, recipient, amount);\n }\n\n pub fn approve(&mut self, spender: &Address, amount: &Balance) {\n self.erc20.approve(spender, amount);\n }\n\n pub fn get_owner(&self) -> Address {\n self.ownable.get_owner()\n }\n\n pub fn change_ownership(&mut self, new_owner: &Address) {\n self.ownable.change_ownership(new_owner);\n }\n\n pub fn mint(&mut self, address: &Address, amount: &Balance) {\n self.ownable.ensure_ownership(&contract_env::caller());\n self.erc20.mint(address, amount);\n }\n}\n")),(0,o.kt)("p",null,"Easy. However, there are a few worth mentioning subtleness:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L10-L11")," - A constructor is a great place to init both modules at once. "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L14-L16")," - Most of the entrypoints do not need any modification, so we simply delegates them to the ",(0,o.kt)("inlineCode",{parentName:"li"},"erc20")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L50-L52")," - The same we do with the ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," module."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"L58-L61")," - Minting should not be unconditional, we need some control over it. First, using ",(0,o.kt)("inlineCode",{parentName:"li"},"ownable")," we make sure the ",(0,o.kt)("inlineCode",{parentName:"li"},"caller")," really is the owner.")),(0,o.kt)("h2",{id:"summary"},"Summary"),(0,o.kt)("p",null,"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fcdcfd4e.79b4abcb.js b/docs/assets/js/fcdcfd4e.79b4abcb.js new file mode 100644 index 000000000..81db08fee --- /dev/null +++ b/docs/assets/js/fcdcfd4e.79b4abcb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76391],{3905:(e,r,n)=>{n.d(r,{Zo:()=>c,kt:()=>m});var t=n(67294);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){a(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function i(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=t.createContext({}),p=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},c=function(e){var r=p(e.components);return t.createElement(l.Provider,{value:r},e.children)},d={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},u=t.forwardRef((function(e,r){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?t.createElement(f,s(s({ref:r},c),{},{components:n})):t.createElement(f,s({ref:r},c))}));function m(e,r){var n=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var p=2;p<o;p++)s[p]=n[p];return t.createElement.apply(null,s)}return t.createElement.apply(null,n)}u.displayName="MDXCreateElement"},20343:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(87462),a=(n(67294),n(3905));const o={sidebar_position:8,description:"Causing and handling errors"},s="Errors",i={unversionedId:"basics/errors",id:"version-0.9.1/basics/errors",title:"Errors",description:"Causing and handling errors",source:"@site/versioned_docs/version-0.9.1/basics/08-errors.md",sourceDirName:"basics",slug:"/basics/errors",permalink:"/docs/0.9.1/basics/errors",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8,description:"Causing and handling errors"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/docs/0.9.1/basics/testing"},next:{title:"Events",permalink:"/docs/0.9.1/basics/events"}},l={},p=[{value:"Testing errors",id:"testing-errors",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function d(e){let{components:r,...n}=e;return(0,a.kt)("wrapper",(0,t.Z)({},c,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("p",null,"Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the\nfollowing example of a simple owned contract:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"use odra::prelude::*;\nuse odra::{Address, Var};\n\n#[odra::module(errors = Error)]\npub struct OwnedContract {\n name: Var<String>,\n owner: Var<Address>\n}\n\n#[odra::odra_error]\npub enum Error {\n OwnerNotSet = 1,\n NotAnOwner = 2\n}\n\n#[odra::module]\nimpl OwnedContract {\n pub fn init(&mut self, name: String) {\n self.name.set(name);\n self.owner.set(self.env().caller())\n }\n\n pub fn name(&self) -> String {\n self.name.get_or_default()\n }\n\n pub fn owner(&self) -> Address {\n self.owner.get_or_revert_with(Error::OwnerNotSet)\n }\n\n pub fn change_name(&mut self, name: String) {\n let caller = self.env().caller();\n if caller != self.owner() {\n self.env().revert(Error::NotAnOwner)\n }\n\n self.name.set(name);\n }\n}\n")),(0,a.kt)("p",null,"Firstly, we are using the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::odra_error]")," attribute to define our own set of Errors that our contract will\nthrow. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"unwrap_or_revert_with")," and pass an error as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)\n")),(0,a.kt)("p",null,"You can also throw the error directly, by using ",(0,a.kt)("inlineCode",{parentName:"p"},"revert"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},"self.env().revert(Error::NotAnOwner)\n")),(0,a.kt)("p",null,"To register errors, add the ",(0,a.kt)("inlineCode",{parentName:"p"},"errors")," inner attribute to the struct's ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," attribute and pass the error type as the value. The registered errors will be present in the contract ",(0,a.kt)("a",{parentName:"p",href:"./casper-contract-schema"},(0,a.kt)("inlineCode",{parentName:"a"},"schema")),"."),(0,a.kt)("p",null,"Defining an error in Odra, you must keep in mind a few rules:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"An error should be a field-less enum. "),(0,a.kt)("li",{parentName:"ol"},"The enum must be annotated with ",(0,a.kt)("inlineCode",{parentName:"li"},"#[odra::odra_error]"),"."),(0,a.kt)("li",{parentName:"ol"},"Avoid implicit discriminants.")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!")),(0,a.kt)("h2",{id:"testing-errors"},"Testing errors"),(0,a.kt)("p",null,"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/handling_errors.rs"',title:'"examples/src/features/handling_errors.rs"'},'#[cfg(test)]\nmod tests {\n use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};\n use odra::host::Deployer;\n use odra::prelude::*;\n\n #[test]\n fn test_owner_error() {\n let test_env = odra_test::env();\n let owner = test_env.get_account(0);\n let not_an_owner = test_env.get_account(1);\n\n test_env.set_caller(owner);\n let init_args = OwnedContractInitArgs {\n name: "OwnedContract".to_string()\n };\n let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);\n\n test_env.set_caller(not_an_owner);\n assert_eq!(\n owned_contract.try_change_name("NewName".to_string()),\n Err(Error::NotAnOwner.into())\n );\n }\n}\n')),(0,a.kt)("p",null,"Each ",(0,a.kt)("inlineCode",{parentName:"p"},"{{ModuleName}}HostRef")," has ",(0,a.kt)("inlineCode",{parentName:"p"},"try_{{entry_point_name}}")," functions that return an ",(0,a.kt)("a",{parentName:"p",href:"https://docs.rs/odra/0.9.0/odra/type.OdraResult.html"},(0,a.kt)("inlineCode",{parentName:"a"},"OdraResult")),".\n",(0,a.kt)("inlineCode",{parentName:"p"},"OwnedContractHostRef")," implements regular entrypoints: ",(0,a.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"change_name"),", and\nand safe its safe version: ",(0,a.kt)("inlineCode",{parentName:"p"},"try_name"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_owner"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name"),"."),(0,a.kt)("p",null,"In our example, we are calling ",(0,a.kt)("inlineCode",{parentName:"p"},"try_change_name")," and expecting an error to be thrown.\nFor assertions, we are using a standard ",(0,a.kt)("inlineCode",{parentName:"p"},"assert_eq!")," macro. As the contract call returns an ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError"),",\nwe need to convert our custom error to ",(0,a.kt)("inlineCode",{parentName:"p"},"OdraError")," using ",(0,a.kt)("inlineCode",{parentName:"p"},"Into::into()"),"."),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"We will learn how to emit and test events using Odra."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fcdd79ea.e519e17a.js b/docs/assets/js/fcdd79ea.e519e17a.js new file mode 100644 index 000000000..4d1882c54 --- /dev/null +++ b/docs/assets/js/fcdd79ea.e519e17a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[31201],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),f=r,h=u["".concat(s,".").concat(f)]||u[f]||p[f]||o;return n?a.createElement(h,i(i({ref:t},d),{},{components:n})):a.createElement(h,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},13805:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:1},i="What is a backend?",c={unversionedId:"backends/what-is-a-backend",id:"version-1.0.0/backends/what-is-a-backend",title:"What is a backend?",description:"You can think of a backend as a target platform for your smart contract.",source:"@site/versioned_docs/version-1.0.0/backends/01-what-is-a-backend.md",sourceDirName:"backends",slug:"/backends/what-is-a-backend",permalink:"/docs/backends/what-is-a-backend",draft:!1,tags:[],version:"1.0.0",lastUpdatedAt:1716473940,formattedLastUpdatedAt:"May 23, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Backends",permalink:"/docs/category/backends"},next:{title:"OdraVM",permalink:"/docs/backends/odra-vm"}},s={},l=[{value:"Contract Env",id:"contract-env",level:2},{value:"Host Env",id:"host-env",level:2},{value:"What's next",id:"whats-next",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"what-is-a-backend"},"What is a backend?"),(0,r.kt)("p",null,"You can think of a backend as a target platform for your smart contract.\nThis can be a piece of code allowing you to quickly check your code - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/odra-vm"},"OdraVM"),",\na complete virtual machine, spinning up a blockchain for you - like ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/casper"},"CasperVM"),",\nor even a real blockchain - when using ",(0,r.kt)("a",{parentName:"p",href:"/docs/backends/casper"},"Livenet backend"),"."),(0,r.kt)("p",null,"Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env."),(0,r.kt)("h2",{id:"contract-env"},"Contract Env"),(0,r.kt)("p",null,"The Contract Env is a simple interface that each backend needs to implement,\nexposing features of the blockchain from the perspective of the contract."),(0,r.kt)("p",null,"It gives Odra a set of functions, which allows implementing more complex concepts -\nfor example, to implement ",(0,r.kt)("a",{parentName:"p",href:"/docs/basics/storage-interaction"},"Mapping"),",\nOdra requires some kind of storage integration.\nThe exact implementation of those functions is a responsibility of a backend,\nmaking Odra and its user free to implement the contract logic,\ninstead of messing with the blockchain internals."),(0,r.kt)("p",null,"Other functions from Contract Env include handling transfers, addresses, block time, errors and events."),(0,r.kt)("h2",{id:"host-env"},"Host Env"),(0,r.kt)("p",null,"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with\nthe backend from the outside world - really useful for implementing tests."),(0,r.kt)("p",null,"This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts,\nto the more test-oriented - handling errors, forwarding the block time, etc."),(0,r.kt)("h2",{id:"whats-next"},"What's next"),(0,r.kt)("p",null,"We will take a look at backends Odra implements in more detail."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fdb5f68c.d6ad3336.js b/docs/assets/js/fdb5f68c.d6ad3336.js new file mode 100644 index 000000000..934389a0f --- /dev/null +++ b/docs/assets/js/fdb5f68c.d6ad3336.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[37178],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>g});var r=a(67294);function n(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 r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(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){n(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 i(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),c=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(a),g=n,m=d["".concat(s,".").concat(g)]||d[g]||u[g]||o;return a?r.createElement(m,l(l({ref:t},p),{},{components:a})):r.createElement(m,l({ref:t},p))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:n,l[1]=i;for(var c=2;c<o;c++)l[c]=a[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,a)}d.displayName="MDXCreateElement"},34258:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=a(87462),n=(a(67294),a(3905));const o={sidebar_position:1},l="Installation",i={unversionedId:"getting-started/installation",id:"version-0.4.0/getting-started/installation",title:"Installation",description:"Hello fellow Odra user! This page will guide you through the installation process.",source:"@site/versioned_docs/version-0.4.0/getting-started/installation.md",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/0.4.0/getting-started/installation",draft:!1,tags:[],version:"0.4.0",lastUpdatedAt:1688045346,formattedLastUpdatedAt:"Jun 29, 2023",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Getting started",permalink:"/docs/0.4.0/category/getting-started"},next:{title:"Flipper example",permalink:"/docs/0.4.0/getting-started/flipper"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Installing Cargo Odra",id:"installing-cargo-odra",level:2},{value:"Creating a new Odra project",id:"creating-a-new-odra-project",level:2},{value:"What's next?",id:"whats-next",level:2}],p={toc:c};function u(e){let{components:t,...a}=e;return(0,n.kt)("wrapper",(0,r.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"installation"},"Installation"),(0,n.kt)("p",null,"Hello fellow Odra user! This page will guide you through the installation process."),(0,n.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,n.kt)("p",null,"To start working with Odra, you need to have the following installed on your machine:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Rust toolchain installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://rustup.rs/"},"rustup.rs"),")"),(0,n.kt)("li",{parentName:"ul"},"wasmstrip tool installed (see ",(0,n.kt)("a",{parentName:"li",href:"https://github.com/WebAssembly/wabt"},"wabt"),")")),(0,n.kt)("p",null,"We do not provide exact commands for installing these tools, as they are different for different operating systems.\nPlease refer to the documentation of the tools themselves."),(0,n.kt)("p",null,"With Rust toolchain ready, you can add a new target:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"rustup target add wasm32-unknown-unknown\n")),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"wasm32-unknown-uknown")," is a target that will be used by Odra to compile your smart contracts to WASM files.")),(0,n.kt)("h2",{id:"installing-cargo-odra"},"Installing Cargo Odra"),(0,n.kt)("p",null,"Cargo Odra is a helpful tool that will help you to build and test your smart contracts.\nIt is not required to use Odra, but the documentation will assume that you have it installed."),(0,n.kt)("p",null,"To install it, simply execute the following command:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo install cargo-odra\n")),(0,n.kt)("p",null,"To check if it was installed correctly and see available commands, type:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra --help\n")),(0,n.kt)("p",null,"If everything went fine, we can proceed to the next step."),(0,n.kt)("h2",{id:"creating-a-new-odra-project"},"Creating a new Odra project"),(0,n.kt)("p",null,"To create a new project, simply execute:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra new --name my-project && cd my_project\n")),(0,n.kt)("p",null,'This will create a new folder called "my_project" and initialize Odra there. Cargo Odra\nwill create a sample contract for you in src directory. You can run the tests of this contract\nby executing:'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,n.kt)("p",null,"This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test -b casper\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Congratulations!")," Now you are ready to create contracts using Odra framework! If you had any problems during\nthe installation process, feel free to ask for help on our ",(0,n.kt)("a",{parentName:"p",href:"https://discord.com/invite/Mm5ABc9P8k"},"Discord"),"."),(0,n.kt)("h2",{id:"whats-next"},"What's next?"),(0,n.kt)("p",null,"If you want to see the code that you just tested, continue to the description of ",(0,n.kt)("a",{parentName:"p",href:"flipper"},"Flipper example"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fe2b6021.9038ba28.js b/docs/assets/js/fe2b6021.9038ba28.js new file mode 100644 index 000000000..5e26393ac --- /dev/null +++ b/docs/assets/js/fe2b6021.9038ba28.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[4467],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=p(n),d=a,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},36958:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},l="Flipper example",i={unversionedId:"getting-started/flipper",id:"version-0.5.0/getting-started/flipper",title:"Flipper example",description:"To quickly start working with Odra, take a look at the following code sample. If you followed the",source:"@site/versioned_docs/version-0.5.0/getting-started/flipper.md",sourceDirName:"getting-started",slug:"/getting-started/flipper",permalink:"/docs/0.5.0/getting-started/flipper",draft:!1,tags:[],version:"0.5.0",lastUpdatedAt:1691663853,formattedLastUpdatedAt:"Aug 10, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/0.5.0/getting-started/installation"},next:{title:"Basics",permalink:"/docs/0.5.0/category/basics"}},s={},p=[{value:"Let's flip",id:"lets-flip",level:2},{value:"What's next",id:"whats-next",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"flipper-example"},"Flipper example"),(0,a.kt)("p",null,"To quickly start working with Odra, take a look at the following code sample. If you followed the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/0.5.0/getting-started/installation"},"Installation")," tutorial, you should have this file already at ",(0,a.kt)("inlineCode",{parentName:"p"},"src/flipper.rs"),"."),(0,a.kt)("p",null,"For further explanation of how this code works, see ",(0,a.kt)("a",{parentName:"p",href:"/docs/0.5.0/basics/flipper-internals"},"Flipper Internals"),"."),(0,a.kt)("h2",{id:"lets-flip"},"Let's flip"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="flipper.rs" showLineNumbers',title:'"flipper.rs"',showLineNumbers:!0},"use odra::Variable;\n\n/// A module definition. Each module struct consists Variables and Mappings\n/// or/and another modules.\n#[odra::module]\npub struct Flipper {\n /// The module itself does not store the value, \n /// it's a proxy that writes/reads value to/from the host.\n value: Variable<bool>,\n}\n\n/// Module implementation.\n///\n/// To generate entrypoints,\n/// an implementation block must be marked as #[odra::module].\n#[odra::module]\nimpl Flipper {\n /// Odra constructor.\n ///\n /// Initializes the contract with the value of value.\n #[odra(init)]\n pub fn initial_settings(&mut self) {\n self.value.set(false);\n }\n\n /// Replaces the current value with the passed argument.\n pub fn set(&mut self, value: bool) {\n self.value.set(value);\n }\n\n /// Replaces the current value with the opposite value.\n pub fn flip(&mut self) {\n self.value.set(!self.get());\n }\n\n /// Retrieves value from the storage. \n /// If the value has never been set, the default value is returned.\n pub fn get(&self) -> bool {\n self.value.get_or_default()\n }\n}\n\n#[cfg(test)]\nmod tests {\n use crate::flipper::FlipperDeployer;\n\n #[test]\n fn flipping() {\n // To test a module we need to deploy it using autogenerated Deployer. \n let mut contract = FlipperDeployer::initial_settings();\n assert!(!contract.get());\n contract.flip();\n assert!(contract.get());\n }\n\n #[test]\n fn test_two_flippers() {\n let mut contract1 = FlipperDeployer::initial_settings();\n let contract2 = FlipperDeployer::initial_settings();\n assert!(!contract1.get());\n assert!(!contract2.get());\n contract1.flip();\n assert!(contract1.get());\n assert!(!contract2.get());\n }\n}\n")),(0,a.kt)("h2",{id:"whats-next"},"What's next"),(0,a.kt)("p",null,"In the next category of articles, we will go through basic concepts of Odra."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fec7bf31.2c7f68ff.js b/docs/assets/js/fec7bf31.2c7f68ff.js new file mode 100644 index 000000000..3697b988e --- /dev/null +++ b/docs/assets/js/fec7bf31.2c7f68ff.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[46844],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},39055:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:2},i="MockVM",c={unversionedId:"backends/mock-vm",id:"version-0.7.0/backends/mock-vm",title:"MockVM",description:"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing",source:"@site/versioned_docs/version-0.7.0/backends/02-mock-vm.md",sourceDirName:"backends",slug:"/backends/mock-vm",permalink:"/docs/0.7.0/backends/mock-vm",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"What is a backend?",permalink:"/docs/0.7.0/backends/what-is-a-backend"},next:{title:"Casper",permalink:"/docs/0.7.0/backends/casper"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Execution",id:"execution",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mockvm"},"MockVM"),(0,a.kt)("p",null,"The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing\nthe code written in Odra without compiling the contract to the target architecture and spinning up the\nblockchain."),(0,a.kt)("p",null,"Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler."),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"The MockVM is the default backend for Odra framework, so each time you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cargo odra test\n")),(0,a.kt)("p",null,"You are running your code against it."),(0,a.kt)("h2",{id:"architecture"},"Architecture"),(0,a.kt)("p",null,"MockVM consists of two main parts: the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," and the ",(0,a.kt)("inlineCode",{parentName:"p"},"State"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register")," is just a list of contracts deployed onto the MockVM, identified by an ",(0,a.kt)("inlineCode",{parentName:"p"},"Address"),".\nEach time we call the contract, we call its instance stored in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Contract Register"),"."),(0,a.kt)("p",null,"Contracts and Test Env functions can modify the ",(0,a.kt)("inlineCode",{parentName:"p"},"State")," of the MockVM."),(0,a.kt)("p",null,'Contrary to the "real" backend, which holds the whole history of the blockchain,\nthe MockVM ',(0,a.kt)("inlineCode",{parentName:"p"},"State")," holds only the current state of the MockVM.\nThanks to this and the fact that we do not need the blockchain itself,\nMockVM starts instantly and runs the tests in the native speed."),(0,a.kt)("h2",{id:"execution"},"Execution"),(0,a.kt)("p",null,"When the MockVM backend is enabled, the ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra::module]")," macro is responsible for converting\nyour ",(0,a.kt)("inlineCode",{parentName:"p"},"pub")," functions into a list of Entrypoints, which are put into a Contract Container.\nWhen the contract is deployed, its Container registered into a Registry under an address.\nDuring the contract call, MockVM finds an Entrypoint and executes the code."),(0,a.kt)("mermaid",{value:"graph TD;\n id1[[Odra code]]--\x3eid2[Contract Container];\n id2[Contract Container]--\x3eid3((Contract Registry))\n id3((Contract Registry))--\x3eid4[(MockVM Execution)]"}))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fed89aff.c973bc06.js b/docs/assets/js/fed89aff.c973bc06.js new file mode 100644 index 000000000..5bd0f13e8 --- /dev/null +++ b/docs/assets/js/fed89aff.c973bc06.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[68453],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),d=r,g=u["".concat(c,".").concat(d)]||u[d]||m[d]||o;return n?a.createElement(g,i(i({ref:t},p),{},{components:n})):a.createElement(g,i({ref:t},p))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},28983:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},i="Building contracts manually",l={unversionedId:"advanced/building-manually",id:"version-0.9.1/advanced/building-manually",title:"Building contracts manually",description:"cargo odra is a great tool to build and test your contracts, but sometimes",source:"@site/versioned_docs/version-0.9.1/advanced/06-building-manually.md",sourceDirName:"advanced",slug:"/advanced/building-manually",permalink:"/docs/0.9.1/advanced/building-manually",draft:!1,tags:[],version:"0.9.1",lastUpdatedAt:1713174573,formattedLastUpdatedAt:"Apr 15, 2024",sidebarPosition:6,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Memory allocators",permalink:"/docs/0.9.1/advanced/using-different-allocator"},next:{title:"Backends",permalink:"/docs/0.9.1/category/backends"}},c={},s=[{value:"Building the contract manually",id:"building-the-contract-manually",level:2},{value:"Optimizing the contract",id:"optimizing-the-contract",level:2},{value:"Running the tests manually",id:"running-the-tests-manually",level:2},{value:"Wrapping up",id:"wrapping-up",level:2}],p={toc:s};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"building-contracts-manually"},"Building contracts manually"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a great tool to build and test your contracts, but sometimes\na better control over the parameters that are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),"\nor the compiler is needed. "),(0,r.kt)("p",null,"This is especially useful when the project has multiple features, and there is a need\nto switch between them during the building and testing."),(0,r.kt)("p",null,"Knowing that ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," is a simple wrapper around ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo"),", it is easy to replicate\nthe same behavior by using ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo")," directly."),(0,r.kt)("h2",{id:"building-the-contract-manually"},"Building the contract manually"),(0,r.kt)("p",null,"To build the contract manually, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Odra uses the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"ODRA_MODULE")," to determine which contract to build.")),(0,r.kt)("p",null,"Assuming that project's crate is named ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project"),", this command will build\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," contract in release mode and generate the wasm file.\nThe file will be put into the ",(0,r.kt)("inlineCode",{parentName:"p"},"target/wasm32-unknown-unknown/release")," directory under\nthe name ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project_build_contract.wasm"),"."),(0,r.kt)("p",null,"The Odra Framework expects the contracts to be placed in the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm")," directory, and\nto be named correctly, so the next step would be to move the file:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm\n")),(0,r.kt)("h2",{id:"optimizing-the-contract"},"Optimizing the contract"),(0,r.kt)("p",null,"To lower the size of the wasm file, ",(0,r.kt)("inlineCode",{parentName:"p"},"cargo odra")," uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-strip")," tool:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-strip wasm/my_contract.wasm\n")),(0,r.kt)("p",null,"To further optimize the wasm file, the ",(0,r.kt)("inlineCode",{parentName:"p"},"wasm-opt")," tool is also used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"This step is required, as the wasm file generated by the Rust compiler is not\nfully compatible with the Casper execution engine.")),(0,r.kt)("h2",{id:"running-the-tests-manually"},"Running the tests manually"),(0,r.kt)("p",null,"To run the tests manually, Odra needs to know which backend to use.\nTo run tests agains Casper backend, the following command needs to be used:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_BACKEND=casper cargo test\n")),(0,r.kt)("h2",{id:"wrapping-up"},"Wrapping up"),(0,r.kt)("p",null,"Let's say we want to build the ",(0,r.kt)("inlineCode",{parentName:"p"},"my_contract")," in debug mode, run the tests against the\ncasper backend and use the ",(0,r.kt)("inlineCode",{parentName:"p"},"my-own-allocator")," feature from our ",(0,r.kt)("inlineCode",{parentName:"p"},"my_project")," project."),(0,r.kt)("p",null,"To do that, we can use the following set of commands:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract\nmv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm\nwasm-strip wasm/my_contract.wasm\nwasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm\nODRA_BACKEND=casper cargo test --features my-own-allocator\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/fefb7f4a.6864c472.js b/docs/assets/js/fefb7f4a.6864c472.js new file mode 100644 index 000000000..92de44c94 --- /dev/null +++ b/docs/assets/js/fefb7f4a.6864c472.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[50572],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),f=a,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||o;return n?r.createElement(m,s(s({ref:t},d),{},{components:n})):r.createElement(m,s({ref:t},d))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},87329:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.8.1/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.8.1/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.8.1/basics/native-token",draft:!1,tags:[],version:"0.8.1",lastUpdatedAt:1712050215,formattedLastUpdatedAt:"Apr 2, 2024",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.8.1/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.8.1/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"native-token"},"Native token"),(0,a.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::prelude::*;\nuse odra::casper_types::U512;\n\n#[odra::module]\npub struct PublicWallet;\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {}\n\n pub fn withdraw(&mut self, amount: &U512) {\n self.env().transfer_tokens(&self.env().caller(), amount);\n }\n}\n")),(0,a.kt)("admonition",{type:"warning"},(0,a.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,a.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,a.kt)("inlineCode",{parentName:"p"},"examples/src/contracts/tlw.rs")," in the odra main repository.")),(0,a.kt)("p",null,"You can see a new attribute used here: ",(0,a.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from ",(0,a.kt)("inlineCode",{parentName:"p"},"ContractEnv::transfer_tokens()"),".\nIt does exactly what you are expecting it to do - it transfers native tokens from the contract to the\nspecified address."),(0,a.kt)("h2",{id:"testing"},"Testing"),(0,a.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,a.kt)("inlineCode",{parentName:"p"},"HostEnv")," comes with a function -\n",(0,a.kt)("inlineCode",{parentName:"p"},"balance_of"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"#[cfg(test)]\nmod tests {\n use super::PublicWalletHostRef;\n use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};\n\n #[test]\n fn test_modules() {\n let test_env = odra_test::env();\n let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);\n assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());\n\n my_contract.with_tokens(U512::from(100)).deposit();\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));\n\n my_contract.withdraw(U512::from(25));\n assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));\n }\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ff33c5f7.9bab4fdb.js b/docs/assets/js/ff33c5f7.9bab4fdb.js new file mode 100644 index 000000000..7486be621 --- /dev/null +++ b/docs/assets/js/ff33c5f7.9bab4fdb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[76901],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l<o;l++)s[l]=n[l];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},41516:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:12,description:"How to deposit, withdraw and transfer"},s="Native token",i={unversionedId:"basics/native-token",id:"version-0.7.0/basics/native-token",title:"Native token",description:"How to deposit, withdraw and transfer",source:"@site/versioned_docs/version-0.7.0/basics/12-native-token.md",sourceDirName:"basics",slug:"/basics/native-token",permalink:"/docs/0.7.0/basics/native-token",draft:!1,tags:[],version:"0.7.0",lastUpdatedAt:1699367878,formattedLastUpdatedAt:"Nov 7, 2023",sidebarPosition:12,frontMatter:{sidebar_position:12,description:"How to deposit, withdraw and transfer"},sidebar:"tutorialSidebar",previous:{title:"Modules",permalink:"/docs/0.7.0/basics/modules"},next:{title:"Advanced",permalink:"/docs/0.7.0/category/advanced"}},c={},l=[{value:"Testing",id:"testing",level:2}],d={toc:l};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"native-token"},"Native token"),(0,r.kt)("p",null,"Different blockchains come with different implementations of their native tokens. Odra wraps it all for you\nin easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit\ntheir funds and anyone can withdraw them:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::types::Balance;\nuse odra::contract_env;\n\n#[odra::module]\npub struct PublicWallet {\n}\n\n#[odra::module]\nimpl PublicWallet {\n #[odra(payable)]\n pub fn deposit(&mut self) {\n }\n\n pub fn withdraw(&mut self, amount: Balance) {\n contract_env::transfer_tokens(contract_env::caller(), amount);\n }\n}\n")),(0,r.kt)("admonition",{type:"warning"},(0,r.kt)("p",{parentName:"admonition"},"The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make\nany checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is\neven possible."),(0,r.kt)("p",{parentName:"admonition"},"To see a more reasonable example, check out ",(0,r.kt)("inlineCode",{parentName:"p"},"examples/src/tlw.rs")," in the odra main repository.")),(0,r.kt)("p",null,"You can see a new macro used here: ",(0,r.kt)("inlineCode",{parentName:"p"},"#[odra(payable)]")," - it will add all the code needed for a function to\nbe able to receive the funds. Additionally, we are using a new function from contract_env - ",(0,r.kt)("inlineCode",{parentName:"p"},"transfer_tokens"),".\nIt does exactly what you are expecting it to do - it will transfer native tokens from the contract to the\nspecified address."),(0,r.kt)("p",null,"We are also using the ",(0,r.kt)("inlineCode",{parentName:"p"},"Balance")," - an Odra type that wraps around the type that the underlying blockchain uses\nfor counting tokens."),(0,r.kt)("h2",{id:"testing"},"Testing"),(0,r.kt)("p",null,"To be able to test how many tokens a contract (or any address) has, ",(0,r.kt)("inlineCode",{parentName:"p"},"test_env")," comes with a function -\n",(0,r.kt)("inlineCode",{parentName:"p"},"token_balance"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-rust",metastring:'title="examples/src/features/native_token.rs"',title:'"examples/src/features/native_token.rs"'},"use odra::types::Balance;\nuse odra::test_env;\nuse super::PublicWalletDeployer;\n\n#[test]\nfn test_modules() {\n let mut my_contract = PublicWalletDeployer::default();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());\n\n my_contract.with_tokens(Balance::from(100)).deposit();\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));\n\n my_contract.withdraw(Balance::from(25));\n assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));\n}\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/assets/js/ff3976bd.eda77dfb.js b/docs/assets/js/ff3976bd.eda77dfb.js new file mode 100644 index 000000000..3108d23bc --- /dev/null +++ b/docs/assets/js/ff3976bd.eda77dfb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[3037],{36944:e=>{e.exports=JSON.parse('{"title":"Tutorials","description":"The theory is good, but the practice is even better. Let\'s go through a few examples summing up all the Odra concepts.","slug":"/category/tutorials","permalink":"/docs/0.6.0/category/tutorials","navigation":{"previous":{"title":"Using odra-modules","permalink":"/docs/0.6.0/examples/using-odra-modules"},"next":{"title":"Ownable","permalink":"/docs/0.6.0/tutorials/ownable"}}}')}}]); \ No newline at end of file diff --git a/docs/assets/js/main.4b7de4ef.js b/docs/assets/js/main.4b7de4ef.js new file mode 100644 index 000000000..f68719f9a --- /dev/null +++ b/docs/assets/js/main.4b7de4ef.js @@ -0,0 +1,2 @@ +/*! For license information please see main.4b7de4ef.js.LICENSE.txt */ +(self.webpackChunkodra_website=self.webpackChunkodra_website||[]).push([[40179],{723:(e,t,a)=>{"use strict";a.d(t,{Z:()=>b});var n=a(67294),r=a(87462),o=a(68356),s=a.n(o),i=a(16887);const c={"0030fd86":[()=>a.e(21887).then(a.t.bind(a,47619,19)),"~docs/default/version-0-5-0-metadata-prop-3bc.json",47619],"0093993c":[()=>a.e(87945).then(a.bind(a,43116)),"@site/versioned_docs/version-0.9.1/tutorials/ownable.md",43116],"01086ac7":[()=>a.e(60516).then(a.t.bind(a,54816,19)),"~docs/default/category-docs-091-tutorialsidebar-category-backends-d09.json",54816],"01337889":[()=>a.e(65969).then(a.bind(a,98954)),"@site/versioned_docs/version-0.9.1/basics/06-communicating-with-host.md",98954],"01e5113f":[()=>a.e(83052).then(a.bind(a,89592)),"@site/versioned_docs/version-0.6.0/basics/03-odra-toml.md",89592],"02192c58":[()=>a.e(64836).then(a.bind(a,87994)),"@site/versioned_docs/version-0.5.0/basics/07-testing.md",87994],"028141a3":[()=>a.e(18283).then(a.bind(a,42309)),"@site/versioned_docs/version-0.2.0/basics/02-directory-structure.md",42309],"02a3f783":[()=>a.e(99410).then(a.bind(a,79644)),"@site/versioned_docs/version-0.5.0/tutorials/owned-token.md",79644],"030cb818":[()=>a.e(86683).then(a.bind(a,557)),"@site/versioned_docs/version-0.9.0/tutorials/access-control.md",557],"031cd168":[()=>a.e(74861).then(a.bind(a,39652)),"@site/versioned_docs/version-0.8.1/advanced/06-building-manually.md",39652],"03436d61":[()=>a.e(97417).then(a.bind(a,60272)),"@site/versioned_docs/version-1.0.0/tutorials/nft.md",60272],"037547ca":[()=>a.e(9184).then(a.t.bind(a,33709,19)),"~docs/default/category-docs-031-tutorialsidebar-category-getting-started-093.json",33709],"03d24697":[()=>a.e(45333).then(a.bind(a,9887)),"@site/versioned_docs/version-0.7.0/tutorials/pauseable.md",9887],"03ddc63e":[()=>Promise.all([a.e(40532),a.e(37077)]).then(a.bind(a,98620)),"@site/versioned_docs/version-0.9.1/tutorials/using-proxy-caller.md",98620],"03f3dff9":[()=>a.e(73044).then(a.t.bind(a,70199,19)),"~docs/default/category-docs-081-tutorialsidebar-category-advanced-d5e.json",70199],"0413f781":[()=>a.e(65666).then(a.bind(a,93316)),"@site/versioned_docs/version-0.9.1/backends/01-what-is-a-backend.md",93316],"04477b87":[()=>a.e(56056).then(a.bind(a,6835)),"@site/versioned_docs/version-0.3.0/getting-started/installation.md",6835],"04d6639f":[()=>a.e(41258).then(a.bind(a,22120)),"@site/versioned_docs/version-1.0.0/basics/10-cross-calls.md",22120],"06a0fa51":[()=>a.e(20348).then(a.bind(a,9284)),"@site/docs/backends/03-casper.md",9284],"06d8044c":[()=>a.e(73807).then(a.t.bind(a,36924,19)),"~docs/default/category-docs-080-tutorialsidebar-category-basics-4da.json",36924],"07fff18d":[()=>a.e(11577).then(a.bind(a,30715)),"@site/versioned_docs/version-1.0.0/basics/13-casper-contract-schema.md",30715],"09109da1":[()=>a.e(68492).then(a.bind(a,85051)),"@site/versioned_docs/version-0.7.0/basics/08-errors.md",85051],"0993954b":[()=>a.e(67646).then(a.t.bind(a,83769,19)),"/home/runner/work/odradev.github.io/odradev.github.io/docusaurus/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",83769],"0a44181e":[()=>a.e(27731).then(a.t.bind(a,55448,19)),"~docs/default/category-docsnext-tutorialsidebar-category-basics-714.json",55448],"0a8f7599":[()=>a.e(54589).then(a.bind(a,23588)),"@site/versioned_docs/version-0.4.0/basics/12-native-token.md",23588],"0abf45c2":[()=>a.e(37625).then(a.bind(a,11377)),"@site/docs/basics/01-cargo-odra.md",11377],"0b779dad":[()=>a.e(53538).then(a.bind(a,94824)),"@site/versioned_docs/version-0.8.1/basics/02-directory-structure.md",94824],"0be49901":[()=>a.e(61109).then(a.bind(a,90890)),"@site/versioned_docs/version-0.4.0/backends/01-what-is-a-backend.md",90890],"0bf9d8ab":[()=>a.e(52325).then(a.bind(a,20203)),"@site/versioned_docs/version-0.7.0/advanced/01-using.md",20203],"0c77f976":[()=>Promise.all([a.e(40532),a.e(4781)]).then(a.bind(a,10330)),"@site/docs/tutorials/build-deploy-read.md",10330],"0cc148ac":[()=>a.e(23697).then(a.bind(a,85772)),"@site/versioned_docs/version-0.8.0/tutorials/owned-token.md",85772],"0d02cb66":[()=>a.e(37282).then(a.bind(a,35316)),"@site/versioned_docs/version-0.9.1/backends/03-casper.md",35316],"0d4fe067":[()=>a.e(13030).then(a.t.bind(a,16750,19)),"~docs/default/category-docs-091-tutorialsidebar-category-basics-f0f.json",16750],"0e384e19":[()=>a.e(59671).then(a.bind(a,59881)),"@site/docs/intro.md",59881],"0ea00542":[()=>a.e(56388).then(a.bind(a,56716)),"@site/versioned_docs/version-0.3.0/backends/03-casper.md",56716],"1030000d":[()=>a.e(72042).then(a.bind(a,70592)),"@site/versioned_docs/version-0.3.0/basics/05-storage-interaction.md",70592],"112c15b6":[()=>a.e(40922).then(a.bind(a,74558)),"@site/versioned_docs/version-1.0.0/advanced/05-using-different-allocator.md",74558],"116347ba":[()=>Promise.all([a.e(40532),a.e(466)]).then(a.bind(a,33222)),"@site/versioned_docs/version-0.9.1/migrations/to-0.9.0.md",33222],"119fbfb6":[()=>a.e(11969).then(a.bind(a,41173)),"@site/versioned_docs/version-0.7.0/intro.md",41173],"11e5b730":[()=>a.e(29906).then(a.bind(a,86507)),"@site/versioned_docs/version-0.2.0/basics/03-odra-toml.md",86507],"120e723d":[()=>a.e(11502).then(a.bind(a,64580)),"@site/versioned_docs/version-0.9.1/advanced/02-advanced-storage.md",64580],"120e9383":[()=>Promise.all([a.e(40532),a.e(25867)]).then(a.bind(a,28158)),"@site/docs/tutorials/using-proxy-caller.md",28158],"125a74bf":[()=>a.e(37904).then(a.bind(a,39074)),"@site/versioned_docs/version-1.0.0/basics/09-events.md",39074],13066500:[()=>a.e(53772).then(a.bind(a,33136)),"@site/versioned_docs/version-0.5.0/advanced/01-using.md",33136],"13ab0148":[()=>a.e(20523).then(a.bind(a,12440)),"@site/versioned_docs/version-0.3.1/intro.md",12440],"1416c8f4":[()=>a.e(28700).then(a.bind(a,76223)),"@site/versioned_docs/version-0.7.0/tutorials/owned-token.md",76223],"14355e8c":[()=>a.e(76693).then(a.bind(a,29841)),"@site/versioned_docs/version-0.4.0/basics/07-testing.md",29841],"145548d1":[()=>a.e(1615).then(a.bind(a,30779)),"@site/versioned_docs/version-0.8.1/tutorials/ownable.md",30779],"14eb3368":[()=>Promise.all([a.e(40532),a.e(9817)]).then(a.bind(a,34228)),"@theme/DocCategoryGeneratedIndexPage",34228],"1524a02c":[()=>a.e(55399).then(a.t.bind(a,28289,19)),"~docs/default/category-docs-050-tutorialsidebar-category-getting-started-e5b.json",28289],"156a315c":[()=>a.e(95278).then(a.t.bind(a,58437,19)),"~docs/default/category-docs-080-tutorialsidebar-category-backends-4e0.json",58437],"16691bef":[()=>a.e(2536).then(a.t.bind(a,96992,19)),"~docs/default/category-docs-081-tutorialsidebar-category-migrations-57c.json",96992],"1684519a":[()=>a.e(78381).then(a.bind(a,79176)),"@site/versioned_docs/version-0.4.0/advanced/03-advanced-storage.md",79176],"16c5018d":[()=>a.e(34437).then(a.bind(a,10966)),"@site/versioned_docs/version-0.8.0/basics/02-directory-structure.md",10966],"17498f44":[()=>a.e(19828).then(a.t.bind(a,8173,19)),"~docs/default/category-docsnext-tutorialsidebar-category-migrations-c0b.json",8173],"175a5a59":[()=>a.e(63024).then(a.bind(a,78496)),"@site/versioned_docs/version-0.8.1/backends/03-casper.md",78496],"177939f6":[()=>a.e(60995).then(a.bind(a,65883)),"@site/blog/2022-11-30-release-020/index.md",65883],17896441:[()=>Promise.all([a.e(40532),a.e(90239),a.e(27918)]).then(a.bind(a,15154)),"@theme/DocItem",15154],"17908ca6":[()=>a.e(87671).then(a.bind(a,75785)),"@site/versioned_docs/version-0.8.0/backends/01-what-is-a-backend.md",75785],"17e51713":[()=>a.e(34926).then(a.bind(a,55014)),"@site/versioned_docs/version-0.9.1/advanced/03-attributes.md",55014],"181ab02d":[()=>a.e(8099).then(a.t.bind(a,89891,19)),"~docs/default/category-docs-020-defaultsidebar-category-backends-651.json",89891],"192dc956":[()=>a.e(81133).then(a.bind(a,29142)),"@site/versioned_docs/version-0.8.0/tutorials/erc20.md",29142],"1999a842":[()=>a.e(40427).then(a.t.bind(a,89813,19)),"~docs/default/category-docs-031-tutorialsidebar-category-backends-c6a.json",89813],"1b34e22f":[()=>a.e(73785).then(a.bind(a,55309)),"@site/versioned_docs/version-0.2.0/getting-started/installation.md",55309],"1b36f1ff":[()=>a.e(38602).then(a.bind(a,85822)),"@site/versioned_docs/version-1.0.0/advanced/03-attributes.md",85822],"1bc92503":[()=>a.e(65010).then(a.bind(a,98282)),"@site/versioned_docs/version-0.9.1/basics/10-cross-calls.md",98282],"1be56b3c":[()=>a.e(63962).then(a.t.bind(a,80396,19)),"~docs/default/category-docs-081-tutorialsidebar-category-basics-dbc.json",80396],"1be78505":[()=>Promise.all([a.e(40532),a.e(29514)]).then(a.bind(a,19963)),"@theme/DocPage",19963],"1d7f9163":[()=>a.e(90627).then(a.bind(a,21501)),"@site/versioned_docs/version-0.9.0/advanced/01-delegate.md",21501],"1d854f2b":[()=>a.e(53230).then(a.bind(a,77032)),"@site/versioned_docs/version-0.8.1/basics/05-storage-interaction.md",77032],"1dd27823":[()=>a.e(31529).then(a.bind(a,18183)),"@site/versioned_docs/version-0.9.0/basics/06-communicating-with-host.md",18183],"1e877671":[()=>Promise.all([a.e(40532),a.e(37139)]).then(a.bind(a,72865)),"@site/versioned_docs/version-1.0.0/migrations/to-0.8.0.md",72865],"1f63a7a5":[()=>a.e(55914).then(a.bind(a,86519)),"@site/versioned_docs/version-0.2.0/tutorials/erc20.md",86519],"2033cf69":[()=>a.e(67808).then(a.bind(a,43128)),"@site/versioned_docs/version-0.9.1/getting-started/installation.md",43128],"208794bf":[()=>a.e(11172).then(a.bind(a,61684)),"@site/versioned_docs/version-0.3.1/advanced/03-advanced-storage.md",61684],"20f44f94":[()=>a.e(81079).then(a.bind(a,86330)),"@site/versioned_docs/version-0.4.0/basics/08-errors.md",86330],"2131dc9d":[()=>a.e(95310).then(a.t.bind(a,31582,19)),"~docs/default/category-docs-050-tutorialsidebar-category-basics-0bf.json",31582],"21d4362d":[()=>a.e(47646).then(a.bind(a,82467)),"@site/versioned_docs/version-1.0.0/tutorials/pauseable.md",82467],"21fc20bd":[()=>a.e(5724).then(a.bind(a,78514)),"@site/versioned_docs/version-0.3.0/examples/odra-examples.md",78514],"237cf9c7":[()=>a.e(32806).then(a.bind(a,75556)),"@site/versioned_docs/version-0.2.0/basics/09-events.md",75556],"24942c38":[()=>a.e(28511).then(a.bind(a,34912)),"@site/versioned_docs/version-0.8.0/advanced/01-delegate.md",34912],"24bf3011":[()=>a.e(36882).then(a.bind(a,6067)),"@site/versioned_docs/version-0.3.1/advanced/01-composer.md",6067],"252d6971":[()=>a.e(59543).then(a.t.bind(a,5582,19)),"~docs/default/category-docs-091-tutorialsidebar-category-getting-started-c49.json",5582],"26441f8e":[()=>a.e(7742).then(a.bind(a,43240)),"@site/versioned_docs/version-0.6.0/advanced/05-signatures.md",43240],"26ab3a9c":[()=>a.e(79106).then(a.bind(a,75134)),"@site/versioned_docs/version-1.0.0/examples/odra-examples.md",75134],"274ccf11":[()=>a.e(37057).then(a.bind(a,31990)),"@site/versioned_docs/version-0.2.0/basics/06-communicating-with-host.md",31990],"28efbf3f":[()=>a.e(42240).then(a.bind(a,65114)),"@site/versioned_docs/version-0.2.0/basics/07-testing.md",65114],"2937371c":[()=>a.e(91457).then(a.bind(a,30335)),"@site/versioned_docs/version-1.0.0/basics/03-odra-toml.md",30335],"29c8e325":[()=>a.e(97447).then(a.bind(a,72984)),"@site/versioned_docs/version-0.4.0/basics/02-directory-structure.md",72984],"2b7acc9d":[()=>a.e(34923).then(a.bind(a,83808)),"@site/versioned_docs/version-0.3.0/basics/03-odra-toml.md",83808],"2bf460c7":[()=>a.e(16286).then(a.bind(a,34226)),"@site/versioned_docs/version-0.3.0/basics/01-cargo-odra.md",34226],"2c824dec":[()=>a.e(88367).then(a.bind(a,43783)),"@site/versioned_docs/version-0.5.0/tutorials/erc20.md",43783],"2fe15297":[()=>a.e(52111).then(a.t.bind(a,21388,19)),"~docs/default/version-0-7-0-metadata-prop-303.json",21388],"3129ff44":[()=>a.e(6367).then(a.bind(a,6533)),"@site/versioned_docs/version-0.3.1/backends/01-what-is-a-backend.md",6533],"31372b4d":[()=>a.e(52675).then(a.bind(a,24071)),"@site/versioned_docs/version-0.9.0/basics/05-storage-interaction.md",24071],"3152febb":[()=>a.e(60225).then(a.t.bind(a,43492,19)),"~docs/default/category-docs-tutorialsidebar-category-getting-started-3f9.json",43492],"31959af2":[()=>a.e(53911).then(a.bind(a,60046)),"@site/versioned_docs/version-0.9.0/backends/01-what-is-a-backend.md",60046],32993410:[()=>a.e(75510).then(a.t.bind(a,65216,19)),"~docs/default/category-docs-050-tutorialsidebar-category-examples-d18.json",65216],"32e511f4":[()=>a.e(20248).then(a.t.bind(a,86365,19)),"~docs/default/category-docs-091-tutorialsidebar-category-advanced-b34.json",86365],33762072:[()=>a.e(27669).then(a.t.bind(a,82154,19)),"~docs/default/version-0-3-1-metadata-prop-266.json",82154],"33e7c3de":[()=>a.e(23914).then(a.bind(a,86747)),"@site/versioned_docs/version-0.7.0/backends/03-casper.md",86747],34731735:[()=>a.e(15604).then(a.bind(a,70551)),"@site/docs/basics/10-cross-calls.md",70551],"3593900a":[()=>a.e(15376).then(a.bind(a,25618)),"@site/versioned_docs/version-0.9.1/backends/04-livenet.md",25618],"35d161a3":[()=>a.e(57464).then(a.bind(a,43682)),"@site/versioned_docs/version-0.8.0/basics/08-errors.md",43682],"367de8e8":[()=>a.e(56527).then(a.bind(a,75572)),"@site/versioned_docs/version-0.6.0/getting-started/flipper.md",75572],"3701fb97":[()=>a.e(62253).then(a.bind(a,21439)),"@site/versioned_docs/version-0.3.1/basics/10-cross-calls.md",21439],"3721b008":[()=>a.e(25151).then(a.bind(a,87454)),"@site/versioned_docs/version-0.5.0/basics/08-errors.md",87454],"372918e4":[()=>a.e(59132).then(a.bind(a,61583)),"@site/versioned_docs/version-0.9.0/backends/04-livenet.md",61583],"377695c3":[()=>a.e(60915).then(a.bind(a,45353)),"@site/versioned_docs/version-0.9.0/tutorials/ownable.md",45353],"383c9ad7":[()=>a.e(46491).then(a.bind(a,62030)),"@site/docs/advanced/01-delegate.md",62030],"3849c38e":[()=>a.e(58050).then(a.bind(a,77115)),"@site/versioned_docs/version-0.8.1/basics/08-errors.md",77115],"386627d1":[()=>Promise.all([a.e(40532),a.e(25633)]).then(a.bind(a,86865)),"@site/docs/tutorials/odra-sol.md",86865],"3879932b":[()=>a.e(36578).then(a.bind(a,92666)),"@site/versioned_docs/version-0.9.0/intro.md",92666],"39d2189a":[()=>a.e(76262).then(a.bind(a,80158)),"@site/versioned_docs/version-0.4.0/basics/04-flipper-internals.md",80158],"3ac77d2e":[()=>a.e(34627).then(a.bind(a,8985)),"@site/versioned_docs/version-0.4.0/basics/03-odra-toml.md",8985],"3b67cac2":[()=>a.e(68800).then(a.bind(a,21762)),"@site/versioned_docs/version-0.8.1/tutorials/pauseable.md",21762],"3bb5653d":[()=>a.e(89167).then(a.bind(a,47844)),"@site/versioned_docs/version-0.5.0/basics/05-storage-interaction.md",47844],"3c817d4f":[()=>a.e(62801).then(a.bind(a,82285)),"@site/blog/2023-02-15-odra-cosmos.md?truncated=true",82285],"3cb0761e":[()=>a.e(95108).then(a.bind(a,24992)),"@site/docs/basics/02-directory-structure.md",24992],"3cbbe945":[()=>a.e(11961).then(a.bind(a,65227)),"@site/versioned_docs/version-0.9.1/backends/02-odra-vm.md",65227],"3cdf4a35":[()=>Promise.all([a.e(40532),a.e(63050)]).then(a.bind(a,30127)),"@site/versioned_docs/version-1.0.0/tutorials/build-deploy-read.md",30127],"3ce92bbb":[()=>a.e(36323).then(a.bind(a,95720)),"@site/versioned_docs/version-0.9.0/basics/12-native-token.md",95720],"3e0ea7e3":[()=>a.e(58406).then(a.bind(a,39494)),"@site/versioned_docs/version-0.8.0/advanced/02-advanced-storage.md",39494],"3e663e98":[()=>a.e(29831).then(a.bind(a,82545)),"@site/versioned_docs/version-0.9.0/basics/07-testing.md",82545],"3e885f31":[()=>a.e(50568).then(a.bind(a,30389)),"@site/versioned_docs/version-0.9.0/basics/09-events.md",30389],"3e9ef03c":[()=>a.e(32717).then(a.bind(a,69455)),"@site/versioned_docs/version-0.2.0/backends/01-what-is-a-backend.md",69455],"3ec01721":[()=>a.e(54938).then(a.bind(a,43230)),"@site/versioned_docs/version-1.0.0/basics/11-modules.md",43230],"3edee900":[()=>a.e(56010).then(a.bind(a,69042)),"@site/versioned_docs/version-0.3.1/basics/05-storage-interaction.md",69042],"3eed3f1a":[()=>a.e(73362).then(a.bind(a,33984)),"@site/versioned_docs/version-0.7.0/basics/07-testing.md",33984],"3f00e816":[()=>a.e(53227).then(a.bind(a,90744)),"@site/versioned_docs/version-0.6.0/tutorials/owned-token.md",90744],"40692c03":[()=>a.e(86116).then(a.bind(a,54546)),"@site/versioned_docs/version-0.9.1/basics/11-modules.md",54546],"40b2cc78":[()=>a.e(99706).then(a.bind(a,91513)),"@site/versioned_docs/version-0.9.0/getting-started/installation.md",91513],"41445f6c":[()=>a.e(78784).then(a.bind(a,90347)),"@site/versioned_docs/version-0.6.0/basics/10-cross-calls.md",90347],"419e5fad":[()=>Promise.all([a.e(40532),a.e(41220)]).then(a.bind(a,7447)),"@site/versioned_docs/version-1.0.0/tutorials/odra-sol.md",7447],"42407bf6":[()=>a.e(65185).then(a.t.bind(a,46064,19)),"~docs/default/category-docs-090-tutorialsidebar-category-backends-808.json",46064],"4279e616":[()=>a.e(12890).then(a.bind(a,82177)),"@site/versioned_docs/version-0.5.0/intro.md",82177],"42eeae87":[()=>a.e(95866).then(a.bind(a,83948)),"@site/versioned_docs/version-0.7.0/basics/11-modules.md",83948],"42fe661b":[()=>a.e(30800).then(a.bind(a,96841)),"@site/versioned_docs/version-0.5.0/basics/03-odra-toml.md",96841],"43e47b8e":[()=>a.e(29108).then(a.bind(a,10195)),"@site/versioned_docs/version-0.4.0/backends/02-mock-vm.md",10195],"443d45d4":[()=>a.e(88932).then(a.bind(a,12528)),"@site/versioned_docs/version-0.9.1/tutorials/pauseable.md",12528],"448060b1":[()=>a.e(62081).then(a.bind(a,18382)),"@site/versioned_docs/version-0.4.0/getting-started/flipper.md",18382],"452b335c":[()=>a.e(91802).then(a.bind(a,35729)),"@site/versioned_docs/version-1.0.0/basics/06-communicating-with-host.md",35729],"45990ab7":[()=>a.e(18088).then(a.bind(a,90119)),"@site/versioned_docs/version-0.3.1/backends/03-casper.md",90119],"46da96af":[()=>a.e(41563).then(a.bind(a,20044)),"@site/versioned_docs/version-0.9.1/basics/03-odra-toml.md",20044],"46ef55c5":[()=>a.e(89561).then(a.bind(a,73326)),"@site/versioned_docs/version-0.9.0/examples/using-odra-modules.md",73326],"473b33d6":[()=>a.e(34050).then(a.bind(a,48265)),"@site/versioned_docs/version-0.6.0/backends/02-mock-vm.md",48265],"4760a525":[()=>a.e(84062).then(a.bind(a,85584)),"@site/versioned_docs/version-0.8.1/basics/10-cross-calls.md",85584],"481896f1":[()=>a.e(40906).then(a.bind(a,53269)),"@site/versioned_docs/version-0.8.1/basics/11-modules.md",53269],"48d43fc1":[()=>a.e(96611).then(a.bind(a,85279)),"@site/docs/basics/04-flipper-internals.md",85279],"4913a3b5":[()=>a.e(36653).then(a.t.bind(a,11837,19)),"~docs/default/version-0-9-1-metadata-prop-373.json",11837],"496b44fb":[()=>a.e(4266).then(a.bind(a,45352)),"@site/versioned_docs/version-0.4.0/tutorials/owned-token.md",45352],"4a017cdd":[()=>a.e(52827).then(a.bind(a,79791)),"@site/versioned_docs/version-0.9.0/backends/02-odra-vm.md",79791],"4a070847":[()=>a.e(90357).then(a.t.bind(a,36834,19)),"~docs/default/category-docs-tutorialsidebar-category-examples-5d5.json",36834],"4ba42032":[()=>a.e(51096).then(a.bind(a,2042)),"@site/versioned_docs/version-1.0.0/backends/02-odra-vm.md",2042],"4c38ccb3":[()=>a.e(58552).then(a.bind(a,69239)),"@site/versioned_docs/version-0.9.0/basics/11-modules.md",69239],"4cd738bd":[()=>a.e(78322).then(a.t.bind(a,84876,19)),"~docs/default/category-docs-tutorialsidebar-category-tutorials-d5c.json",84876],"4d5b435f":[()=>a.e(67530).then(a.t.bind(a,13555,19)),"~docs/default/category-docs-080-tutorialsidebar-category-tutorials-615.json",13555],"4da81bc4":[()=>a.e(30663).then(a.bind(a,52506)),"@site/versioned_docs/version-0.6.0/tutorials/ownable.md",52506],"4da873a0":[()=>a.e(19431).then(a.bind(a,88209)),"@site/versioned_docs/version-0.9.1/basics/07-testing.md",88209],"4dd99f24":[()=>Promise.all([a.e(40532),a.e(62082)]).then(a.bind(a,16997)),"@site/versioned_docs/version-0.8.1/tutorials/build-deploy-read.md",16997],"4e50b37d":[()=>a.e(71588).then(a.t.bind(a,64570,19)),"~docs/default/category-docs-040-tutorialsidebar-category-basics-d09.json",64570],"4e69c95d":[()=>a.e(60).then(a.bind(a,3422)),"@site/versioned_docs/version-0.8.1/basics/06-communicating-with-host.md",3422],"4f40819b":[()=>a.e(20874).then(a.bind(a,74645)),"@site/versioned_docs/version-0.5.0/basics/09-events.md",74645],"509c4227":[()=>a.e(50723).then(a.bind(a,61505)),"@site/versioned_docs/version-0.3.0/basics/06-communicating-with-host.md",61505],51652154:[()=>a.e(16952).then(a.bind(a,27168)),"@site/versioned_docs/version-1.0.0/tutorials/owned-token.md",27168],"51bf83ad":[()=>a.e(87127).then(a.bind(a,21740)),"@site/versioned_docs/version-0.4.0/tutorials/ownable.md",21740],"5326f0ca":[()=>a.e(1378).then(a.bind(a,30800)),"@site/versioned_docs/version-0.9.1/examples/using-odra-modules.md",30800],"53726ad7":[()=>a.e(82288).then(a.bind(a,11661)),"@site/versioned_docs/version-0.3.0/basics/11-modules.md",11661],"54d8e0e1":[()=>a.e(18914).then(a.bind(a,10544)),"@site/versioned_docs/version-0.9.0/basics/08-errors.md",10544],"54dbc4b0":[()=>a.e(99186).then(a.bind(a,36170)),"@site/versioned_docs/version-0.6.0/intro.md",36170],"54f44165":[()=>a.e(40152).then(a.bind(a,60681)),"@site/docs/getting-started/installation.md",60681],"55362a87":[()=>a.e(59616).then(a.bind(a,41096)),"@site/versioned_docs/version-0.3.0/tutorials/ownable.md",41096],"558ac3fc":[()=>a.e(59654).then(a.bind(a,85403)),"@site/versioned_docs/version-0.5.0/advanced/05-signatures.md",85403],"56296f23":[()=>a.e(41577).then(a.bind(a,87983)),"@site/versioned_docs/version-0.4.0/advanced/01-composer.md",87983],"575b7125":[()=>a.e(90992).then(a.bind(a,37990)),"@site/versioned_docs/version-0.7.0/advanced/03-advanced-storage.md",37990],"57648d1e":[()=>a.e(88181).then(a.bind(a,63279)),"@site/versioned_docs/version-0.3.1/advanced/04-attributes.md",63279],"57bc1a35":[()=>Promise.all([a.e(40532),a.e(33394)]).then(a.bind(a,10349)),"@site/docs/migrations/to-0.8.0.md",10349],"5825ca57":[()=>a.e(37199).then(a.bind(a,68526)),"@site/versioned_docs/version-0.3.0/tutorials/erc20.md",68526],"585204f8":[()=>a.e(26077).then(a.bind(a,74318)),"@site/versioned_docs/version-0.9.0/tutorials/owned-token.md",74318],"58abd590":[()=>a.e(97457).then(a.t.bind(a,76045,19)),"~docs/default/category-docs-tutorialsidebar-category-basics-2c3.json",76045],"58f10d9f":[()=>a.e(12493).then(a.t.bind(a,99005,19)),"~docs/default/version-0-6-0-metadata-prop-089.json",99005],"5905dfac":[()=>a.e(52579).then(a.bind(a,90655)),"@site/versioned_docs/version-0.8.1/examples/odra-examples.md",90655],"599e53c2":[()=>a.e(52411).then(a.bind(a,60007)),"@site/blog/2023-02-13-evm-at-risc0.md?truncated=true",60007],"5a816386":[()=>a.e(91390).then(a.bind(a,55551)),"@site/versioned_docs/version-0.3.1/basics/11-modules.md",55551],"5aa50e24":[()=>a.e(2944).then(a.bind(a,67927)),"@site/docs/advanced/04-storage-layout.md",67927],"5ad2f7ef":[()=>a.e(73814).then(a.bind(a,76602)),"@site/versioned_docs/version-0.6.0/backends/03-casper.md",76602],"5b4d97e3":[()=>a.e(95057).then(a.bind(a,35061)),"@site/versioned_docs/version-0.7.0/tutorials/ownable.md",35061],"5bcb7a16":[()=>a.e(52098).then(a.t.bind(a,66904,19)),"~docs/default/category-docs-030-defaultsidebar-category-advanced-1d0.json",66904],"5be2abc9":[()=>a.e(39737).then(a.t.bind(a,95650,19)),"~docs/default/category-docs-020-defaultsidebar-category-basics-042.json",95650],"5bf6529c":[()=>a.e(15113).then(a.t.bind(a,50520,19)),"~docs/default/category-docs-040-tutorialsidebar-category-advanced-bcf.json",50520],"5bff39d6":[()=>a.e(15753).then(a.t.bind(a,86871,19)),"~docs/default/category-docs-030-defaultsidebar-category-basics-feb.json",86871],"5c4991bb":[()=>a.e(64189).then(a.bind(a,57890)),"@site/versioned_docs/version-0.3.1/basics/01-cargo-odra.md",57890],"5c77c5fd":[()=>a.e(62007).then(a.bind(a,23022)),"@site/versioned_docs/version-0.4.0/examples/odra-examples.md",23022],"5c7e9aff":[()=>Promise.all([a.e(40532),a.e(11777)]).then(a.bind(a,61919)),"@site/versioned_docs/version-0.8.0/tutorials/build-deploy-read.md",61919],"5c8f3a1c":[()=>a.e(54097).then(a.bind(a,66886)),"@site/versioned_docs/version-1.0.0/basics/05-storage-interaction.md",66886],"5ca766f6":[()=>a.e(73538).then(a.bind(a,91669)),"@site/versioned_docs/version-0.6.0/basics/06-communicating-with-host.md",91669],"5d94dea0":[()=>a.e(79486).then(a.bind(a,48736)),"@site/versioned_docs/version-1.0.0/intro.md",48736],"5e9f5e1a":[()=>Promise.resolve().then(a.bind(a,36809)),"@generated/docusaurus.config",36809],"5f012ce0":[()=>a.e(72945).then(a.t.bind(a,47805,19)),"~docs/default/version-0-3-0-metadata-prop-150.json",47805],"5f13c361":[()=>a.e(99820).then(a.t.bind(a,77715,19)),"~docs/default/category-docs-040-tutorialsidebar-category-tutorials-20a.json",77715],"5f2971ba":[()=>a.e(23633).then(a.bind(a,1164)),"@site/versioned_docs/version-0.2.0/basics/08-errors.md",1164],"5fd0213e":[()=>a.e(87974).then(a.bind(a,63657)),"@site/versioned_docs/version-0.8.0/getting-started/flipper.md",63657],"5ffb61b1":[()=>a.e(98632).then(a.bind(a,6525)),"@site/versioned_docs/version-0.8.0/basics/09-events.md",6525],"60d35280":[()=>a.e(48733).then(a.bind(a,23694)),"@site/docs/basics/03-odra-toml.md",23694],"60dd6115":[()=>a.e(73069).then(a.bind(a,21229)),"@site/versioned_docs/version-0.5.0/basics/10-cross-calls.md",21229],"61047f5a":[()=>a.e(25377).then(a.bind(a,1220)),"@site/versioned_docs/version-0.8.1/advanced/01-delegate.md",1220],"615e12e7":[()=>a.e(93472).then(a.bind(a,84147)),"@site/docs/advanced/02-advanced-storage.md",84147],"615fce32":[()=>a.e(5527).then(a.bind(a,22675)),"@site/versioned_docs/version-0.8.0/backends/03-casper.md",22675],"6171926c":[()=>a.e(33860).then(a.t.bind(a,18365,19)),"~docs/default/category-docs-070-tutorialsidebar-category-basics-c52.json",18365],"626c8e99":[()=>a.e(35114).then(a.bind(a,37293)),"@site/versioned_docs/version-0.8.1/getting-started/flipper.md",37293],"6289863c":[()=>a.e(54733).then(a.bind(a,31050)),"@site/versioned_docs/version-0.3.0/basics/04-flipper-internals.md",31050],"62e81aa6":[()=>a.e(25329).then(a.t.bind(a,74421,19)),"~docs/default/version-1-0-0-metadata-prop-608.json",74421],"632b087e":[()=>a.e(46499).then(a.bind(a,67033)),"@site/versioned_docs/version-0.5.0/basics/02-directory-structure.md",67033],"636decee":[()=>a.e(84051).then(a.t.bind(a,89933,19)),"~docs/default/category-docs-081-tutorialsidebar-category-backends-858.json",89933],"641fd09d":[()=>a.e(28748).then(a.bind(a,43504)),"@site/versioned_docs/version-0.8.1/tutorials/access-control.md",43504],"6428a729":[()=>a.e(14220).then(a.t.bind(a,11106,19)),"~docs/default/category-docs-070-tutorialsidebar-category-advanced-6b8.json",11106],"64fba0bc":[()=>a.e(74500).then(a.bind(a,53101)),"@site/docs/tutorials/erc20.md",53101],"657d5854":[()=>a.e(25085).then(a.bind(a,42181)),"@site/versioned_docs/version-1.0.0/advanced/01-delegate.md",42181],"659ab8cb":[()=>a.e(87922).then(a.bind(a,91724)),"@site/docs/examples/odra-examples.md",91724],"65ab6b77":[()=>a.e(62540).then(a.t.bind(a,47143,19)),"~docs/default/category-docs-030-defaultsidebar-category-getting-started-698.json",47143],"6617ee69":[()=>a.e(90366).then(a.bind(a,9555)),"@site/versioned_docs/version-0.7.0/advanced/05-signatures.md",9555],"6640477e":[()=>a.e(77552).then(a.bind(a,81313)),"@site/docs/backends/04-livenet.md",81313],"666726ac":[()=>a.e(20355).then(a.bind(a,69806)),"@site/versioned_docs/version-1.0.0/tutorials/deploying-on-casper.md",69806],"67a34253":[()=>a.e(42691).then(a.t.bind(a,75821,19)),"~docs/default/category-docs-050-tutorialsidebar-category-backends-3ca.json",75821],"67cb2d26":[()=>a.e(72522).then(a.t.bind(a,21861,19)),"~docs/default/category-docs-031-tutorialsidebar-category-advanced-d13.json",21861],"67cf10af":[()=>a.e(49168).then(a.bind(a,85243)),"@site/docs/tutorials/owned-token.md",85243],"67d74c2d":[()=>a.e(63556).then(a.bind(a,3705)),"@site/versioned_docs/version-0.6.0/basics/05-storage-interaction.md",3705],"68495fce":[()=>a.e(17552).then(a.bind(a,1754)),"@site/versioned_docs/version-0.5.0/tutorials/ownable.md",1754],"68deafd0":[()=>a.e(97779).then(a.bind(a,68461)),"@site/versioned_docs/version-0.6.0/advanced/04-attributes.md",68461],"695d43df":[()=>a.e(43751).then(a.bind(a,87133)),"@site/versioned_docs/version-0.8.1/basics/07-testing.md",87133],"69fd3230":[()=>a.e(24371).then(a.bind(a,47277)),"@site/docs/examples/using-odra-modules.md",47277],"6a9553ca":[()=>a.e(73774).then(a.bind(a,51092)),"@site/versioned_docs/version-0.9.0/examples/odra-examples.md",51092],"6acba536":[()=>a.e(23408).then(a.bind(a,64370)),"@site/versioned_docs/version-0.8.0/intro.md",64370],"6add768b":[()=>a.e(40656).then(a.bind(a,61294)),"@site/versioned_docs/version-0.3.0/examples/using-odra-modules.md",61294],"6b1ad888":[()=>a.e(60132).then(a.bind(a,86603)),"@site/versioned_docs/version-0.9.0/backends/03-casper.md",86603],"6be2997d":[()=>a.e(41783).then(a.bind(a,24537)),"@site/docs/tutorials/cep18.md",24537],"6c16b7b1":[()=>Promise.all([a.e(40532),a.e(47593)]).then(a.bind(a,31742)),"@site/versioned_docs/version-0.9.0/migrations/to-0.8.0.md",31742],"6d263cfa":[()=>a.e(52498).then(a.t.bind(a,75210,19)),"~docs/default/category-docs-tutorialsidebar-category-migrations-123.json",75210],"6d494689":[()=>a.e(61034).then(a.bind(a,85395)),"@site/versioned_docs/version-0.8.0/tutorials/ownable.md",85395],"6e2102f2":[()=>a.e(7064).then(a.bind(a,56875)),"@site/docs/backends/01-what-is-a-backend.md",56875],"6e5ab397":[()=>a.e(9954).then(a.bind(a,81828)),"@site/versioned_docs/version-0.7.0/basics/04-flipper-internals.md",81828],"6f7f3f28":[()=>a.e(37591).then(a.t.bind(a,19732,19)),"~docs/default/category-docs-050-tutorialsidebar-category-tutorials-126.json",19732],"705c2b64":[()=>a.e(91178).then(a.bind(a,10600)),"@site/versioned_docs/version-0.5.0/examples/using-odra-modules.md",10600],"70c316d8":[()=>a.e(28550).then(a.bind(a,61366)),"@site/versioned_docs/version-0.8.0/examples/odra-examples.md",61366],"70d9d1e8":[()=>a.e(64709).then(a.bind(a,7060)),"@site/versioned_docs/version-0.2.0/tutorials/owned-token.md",7060],"716fdc54":[()=>a.e(50703).then(a.bind(a,15928)),"@site/versioned_docs/version-0.7.0/basics/09-events.md",15928],71735968:[()=>a.e(79345).then(a.bind(a,53309)),"@site/blog/2022-12-12-casper-zk-risc0.md",53309],"71958ad0":[()=>a.e(67556).then(a.bind(a,97454)),"@site/versioned_docs/version-0.6.0/examples/using-odra-modules.md",97454],71994587:[()=>a.e(74398).then(a.bind(a,51143)),"@site/versioned_docs/version-0.8.0/basics/10-cross-calls.md",51143],"71b12fda":[()=>a.e(42986).then(a.bind(a,35138)),"@site/versioned_docs/version-1.0.0/basics/04-flipper-internals.md",35138],"71b691b7":[()=>a.e(53095).then(a.bind(a,84710)),"@site/blog/2023-02-13-evm-at-risc0.md",84710],"728e71a1":[()=>a.e(54301).then(a.bind(a,54540)),"@site/versioned_docs/version-0.5.0/advanced/02-delegate.md",54540],73285975:[()=>a.e(82869).then(a.bind(a,38419)),"@site/versioned_docs/version-0.3.0/advanced/04-attributes.md",38419],"733ac994":[()=>a.e(77952).then(a.bind(a,15774)),"@site/versioned_docs/version-0.3.1/getting-started/installation.md",15774],"739a70a9":[()=>a.e(69986).then(a.bind(a,82698)),"@site/blog/2022-12-12-casper-zk-risc0.md?truncated=true",82698],"73b9c18c":[()=>a.e(16027).then(a.t.bind(a,92396,19)),"~docs/default/category-docs-091-tutorialsidebar-category-migrations-792.json",92396],"74137f62":[()=>a.e(12921).then(a.bind(a,35201)),"@site/versioned_docs/version-0.9.1/advanced/01-delegate.md",35201],"7414f7c1":[()=>a.e(42858).then(a.bind(a,72017)),"@site/versioned_docs/version-0.3.0/advanced/03-advanced-storage.md",72017],"74376d79":[()=>a.e(29413).then(a.bind(a,42014)),"@site/versioned_docs/version-0.3.0/advanced/02-delegate.md",42014],"74442e8e":[()=>a.e(82761).then(a.bind(a,80449)),"@site/versioned_docs/version-0.3.1/examples/using-odra-modules.md",80449],"7457cffc":[()=>a.e(3675).then(a.bind(a,54410)),"@site/versioned_docs/version-0.7.0/tutorials/erc20.md",54410],"748fd4ff":[()=>a.e(78743).then(a.bind(a,41970)),"@site/versioned_docs/version-0.9.0/advanced/04-storage-layout.md",41970],"74ec7413":[()=>a.e(66746).then(a.bind(a,96882)),"@site/versioned_docs/version-0.9.0/advanced/06-building-manually.md",96882],"7546c635":[()=>a.e(64733).then(a.bind(a,60773)),"@site/versioned_docs/version-0.9.1/advanced/05-using-different-allocator.md",60773],"754937b2":[()=>a.e(23308).then(a.bind(a,34370)),"@site/versioned_docs/version-0.4.0/basics/11-modules.md",34370],"75ab3d8c":[()=>a.e(89854).then(a.bind(a,46002)),"@site/versioned_docs/version-0.8.1/advanced/05-using-different-allocator.md",46002],"76b68520":[()=>a.e(99122).then(a.bind(a,45470)),"@site/versioned_docs/version-0.9.1/advanced/04-storage-layout.md",45470],77193147:[()=>a.e(50327).then(a.bind(a,89749)),"@site/versioned_docs/version-0.8.0/examples/using-odra-modules.md",89749],78452797:[()=>a.e(46100).then(a.t.bind(a,89199,19)),"~docs/default/category-docs-031-tutorialsidebar-category-examples-a1d.json",89199],"786408bf":[()=>a.e(83441).then(a.bind(a,32006)),"@site/versioned_docs/version-0.9.0/basics/10-cross-calls.md",32006],79253424:[()=>a.e(36571).then(a.bind(a,56098)),"@site/docs/basics/05-storage-interaction.md",56098],"7933b4e2":[()=>a.e(99604).then(a.bind(a,57306)),"@site/versioned_docs/version-0.9.0/advanced/05-using-different-allocator.md",57306],"794d4fad":[()=>a.e(95555).then(a.bind(a,83985)),"@site/versioned_docs/version-0.8.0/basics/04-flipper-internals.md",83985],"799b1c68":[()=>a.e(65657).then(a.t.bind(a,47790,19)),"~docs/default/version-0-2-0-metadata-prop-0a3.json",47790],"79b67993":[()=>a.e(37798).then(a.t.bind(a,19217,19)),"~docs/default/category-docsnext-tutorialsidebar-category-examples-41f.json",19217],"79d3180c":[()=>a.e(9375).then(a.bind(a,79522)),"@site/versioned_docs/version-0.7.0/getting-started/flipper.md",79522],"7acce579":[()=>a.e(33158).then(a.bind(a,51003)),"@site/versioned_docs/version-0.4.0/basics/01-cargo-odra.md",51003],"7c233f44":[()=>Promise.all([a.e(40532),a.e(7011)]).then(a.bind(a,87736)),"@site/versioned_docs/version-1.0.0/migrations/to-0.9.0.md",87736],"7c29795c":[()=>a.e(46867).then(a.bind(a,90782)),"@site/docs/advanced/06-building-manually.md",90782],"7cc7edf9":[()=>a.e(78212).then(a.bind(a,72423)),"@site/versioned_docs/version-0.9.1/basics/05-storage-interaction.md",72423],"7cf5f48a":[()=>a.e(8068).then(a.bind(a,91866)),"@site/versioned_docs/version-0.8.1/advanced/04-storage-layout.md",91866],"7d8962a6":[()=>a.e(46671).then(a.bind(a,20210)),"@site/blog/2023-08-18-nysa/index.md",20210],"7df6186d":[()=>a.e(13968).then(a.bind(a,12458)),"@site/versioned_docs/version-0.2.0/getting-started/flipper.md",12458],"7e706e45":[()=>a.e(79032).then(a.bind(a,80960)),"@site/versioned_docs/version-0.3.1/tutorials/ownable.md",80960],"7f9a1b7a":[()=>a.e(54133).then(a.bind(a,97329)),"@site/versioned_docs/version-0.7.0/basics/10-cross-calls.md",97329],"800dfaa2":[()=>a.e(84928).then(a.bind(a,44531)),"@site/versioned_docs/version-0.7.0/backends/01-what-is-a-backend.md",44531],"8010fede":[()=>a.e(12628).then(a.bind(a,29011)),"@site/versioned_docs/version-0.7.0/examples/using-odra-modules.md",29011],"80b62ebf":[()=>a.e(81229).then(a.t.bind(a,27926,19)),"~docs/default/category-docs-091-tutorialsidebar-category-examples-749.json",27926],"80b82873":[()=>a.e(45299).then(a.bind(a,10783)),"@site/docs/basics/13-casper-contract-schema.md",10783],"814f3328":[()=>a.e(52535).then(a.t.bind(a,45641,19)),"~blog/default/blog-post-list-prop-default.json",45641],"815ad8c9":[()=>a.e(29145).then(a.bind(a,71900)),"@site/versioned_docs/version-0.3.1/basics/08-errors.md",71900],82287515:[()=>a.e(32164).then(a.t.bind(a,84196,19)),"~docs/default/category-docs-070-tutorialsidebar-category-getting-started-b93.json",84196],83697071:[()=>a.e(75894).then(a.bind(a,69707)),"@site/versioned_docs/version-0.3.1/basics/09-events.md",69707],"8509f041":[()=>a.e(83633).then(a.bind(a,31234)),"@site/versioned_docs/version-1.0.0/examples/using-odra-modules.md",31234],"86127e86":[()=>a.e(24608).then(a.bind(a,31340)),"@site/versioned_docs/version-1.0.0/basics/07-testing.md",31340],"86253fdc":[()=>a.e(76333).then(a.bind(a,22032)),"@site/versioned_docs/version-0.9.1/basics/01-cargo-odra.md",22032],"86598a2c":[()=>Promise.all([a.e(40532),a.e(10276)]).then(a.bind(a,56645)),"@site/versioned_docs/version-0.9.0/tutorials/build-deploy-read.md",56645],"874ec8b8":[()=>a.e(33e3).then(a.bind(a,2237)),"@site/versioned_docs/version-1.0.0/getting-started/flipper.md",2237],"87661fc3":[()=>a.e(85100).then(a.bind(a,30277)),"@site/versioned_docs/version-0.8.1/intro.md",30277],87854661:[()=>a.e(30819).then(a.bind(a,53175)),"@site/versioned_docs/version-0.8.0/advanced/03-attributes.md",53175],"881a4843":[()=>a.e(81557).then(a.bind(a,15622)),"@site/versioned_docs/version-0.8.0/backends/04-livenet.md",15622],"8837ae20":[()=>a.e(41817).then(a.bind(a,75932)),"@site/versioned_docs/version-0.9.1/examples/odra-examples.md",75932],"88434b46":[()=>a.e(27195).then(a.bind(a,82625)),"@site/versioned_docs/version-0.8.1/advanced/02-advanced-storage.md",82625],"88506cf5":[()=>a.e(86188).then(a.bind(a,57376)),"@site/versioned_docs/version-0.8.0/tutorials/pauseable.md",57376],"88b75f2c":[()=>a.e(96075).then(a.bind(a,68306)),"@site/versioned_docs/version-0.7.0/advanced/02-delegate.md",68306],"893f4b86":[()=>a.e(36452).then(a.bind(a,25661)),"@site/versioned_docs/version-0.7.0/examples/odra-examples.md",25661],"8988b866":[()=>a.e(95598).then(a.bind(a,86965)),"@site/versioned_docs/version-0.4.0/tutorials/erc20.md",86965],"8a2be6b7":[()=>Promise.all([a.e(40532),a.e(3816)]).then(a.bind(a,83214)),"@site/versioned_docs/version-0.8.0/migrations/to-0.8.0.md",83214],"8b0ca31f":[()=>a.e(88071).then(a.bind(a,74879)),"@site/versioned_docs/version-0.5.0/backends/02-mock-vm.md",74879],"8e991cde":[()=>a.e(47287).then(a.t.bind(a,14737,19)),"~docs/default/category-docs-020-defaultsidebar-category-tutorials-d40.json",14737],"8f162cb9":[()=>a.e(86221).then(a.bind(a,31832)),"@site/versioned_docs/version-0.2.0/basics/12-native-token.md",31832],"9005cef3":[()=>a.e(35973).then(a.bind(a,64021)),"@site/versioned_docs/version-0.6.0/tutorials/erc20.md",64021],"909eb646":[()=>a.e(58218).then(a.t.bind(a,8749,19)),"~docs/default/category-docs-090-tutorialsidebar-category-examples-72a.json",8749],"90c053b1":[()=>a.e(14593).then(a.bind(a,42345)),"@site/versioned_docs/version-0.3.1/basics/07-testing.md",42345],"90c71d04":[()=>a.e(79004).then(a.bind(a,99111)),"@site/versioned_docs/version-0.8.0/backends/02-odra-vm.md",99111],"90f06335":[()=>a.e(1459).then(a.bind(a,58009)),"@site/versioned_docs/version-0.4.0/examples/using-odra-modules.md",58009],"918e870d":[()=>a.e(13849).then(a.t.bind(a,38967,19)),"~docs/default/category-docs-050-tutorialsidebar-category-advanced-c5b.json",38967],"919c36c8":[()=>a.e(48221).then(a.bind(a,96739)),"@site/versioned_docs/version-0.5.0/examples/odra-examples.md",96739],"91b04621":[()=>a.e(59809).then(a.bind(a,38392)),"@site/versioned_docs/version-0.7.0/basics/05-storage-interaction.md",38392],"93381d6e":[()=>a.e(76798).then(a.bind(a,74173)),"@site/docs/tutorials/deploying-on-casper.md",74173],93514764:[()=>a.e(63336).then(a.bind(a,92755)),"@site/blog/2023-06-27-we-are-here-to-stay/index.md?truncated=true",92755],"935f2afb":[()=>a.e(80053).then(a.t.bind(a,1109,19)),"~docs/default/version-current-metadata-prop-751.json",1109],"9390dd74":[()=>a.e(30196).then(a.bind(a,92969)),"@site/versioned_docs/version-0.8.1/examples/using-odra-modules.md",92969],94723368:[()=>a.e(84916).then(a.bind(a,53568)),"@site/versioned_docs/version-0.5.0/basics/11-modules.md",53568],"94fadafc":[()=>a.e(74805).then(a.bind(a,27766)),"@site/versioned_docs/version-0.8.1/basics/09-events.md",27766],"95045a66":[()=>a.e(7196).then(a.bind(a,28005)),"@site/versioned_docs/version-0.9.0/basics/03-odra-toml.md",28005],"95db938c":[()=>a.e(46145).then(a.bind(a,99314)),"@site/versioned_docs/version-0.2.0/basics/11-modules.md",99314],"95f5ef42":[()=>a.e(84296).then(a.bind(a,29490)),"@site/versioned_docs/version-0.6.0/advanced/03-advanced-storage.md",29490],"969eb6fb":[()=>a.e(14015).then(a.t.bind(a,48356,19)),"~docs/default/category-docs-090-tutorialsidebar-category-basics-356.json",48356],"97237b2f":[()=>a.e(98984).then(a.bind(a,74529)),"@site/versioned_docs/version-0.8.1/backends/02-odra-vm.md",74529],"98b2adcf":[()=>a.e(85930).then(a.t.bind(a,24469,19)),"/home/runner/work/odradev.github.io/odradev.github.io/docusaurus/.docusaurus/docusaurus-plugin-content-blog/default/plugin-route-context-module-100.json",24469],"9a6d52da":[()=>a.e(87250).then(a.t.bind(a,81938,19)),"~docs/default/version-0-9-0-metadata-prop-adb.json",81938],"9a7c9bac":[()=>a.e(6701).then(a.bind(a,10596)),"@site/versioned_docs/version-0.3.1/backends/02-mock-vm.md",10596],"9a7f4a11":[()=>a.e(8923).then(a.bind(a,49614)),"@site/blog/2023-02-27-openai-writes-erc20-in-odra/index.md",49614],"9aad49c5":[()=>a.e(19588).then(a.bind(a,96854)),"@site/versioned_docs/version-0.9.1/tutorials/owned-token.md",96854],"9c04347b":[()=>Promise.all([a.e(40532),a.e(26831)]).then(a.bind(a,72341)),"@site/versioned_docs/version-0.8.1/migrations/to-0.8.0.md",72341],"9cc9201d":[()=>a.e(63395).then(a.bind(a,50030)),"@site/versioned_docs/version-0.5.0/advanced/03-advanced-storage.md",50030],"9d620965":[()=>a.e(29634).then(a.bind(a,27177)),"@site/versioned_docs/version-0.6.0/basics/11-modules.md",27177],"9d95fe34":[()=>a.e(54434).then(a.bind(a,91975)),"@site/versioned_docs/version-0.3.1/basics/12-native-token.md",91975],"9dc5d51e":[()=>a.e(73201).then(a.bind(a,97714)),"@site/versioned_docs/version-0.8.1/tutorials/erc20.md",97714],"9e3cc906":[()=>a.e(69697).then(a.bind(a,33318)),"@site/versioned_docs/version-0.8.1/basics/03-odra-toml.md",33318],"9e4087bc":[()=>a.e(53608).then(a.bind(a,63169)),"@theme/BlogArchivePage",63169],"9e73c0bb":[()=>a.e(62432).then(a.bind(a,76108)),"@site/versioned_docs/version-0.2.0/examples/odra-examples.md",76108],"9e93cf3e":[()=>a.e(33659).then(a.bind(a,11041)),"@site/versioned_docs/version-0.9.1/tutorials/access-control.md",11041],"9f0f335a":[()=>a.e(6459).then(a.bind(a,23872)),"@site/versioned_docs/version-0.8.1/backends/01-what-is-a-backend.md",23872],"9f6fd0ea":[()=>a.e(29037).then(a.t.bind(a,39684,19)),"~docs/default/category-docs-081-tutorialsidebar-category-examples-a30.json",39684],"9ffb5fe4":[()=>a.e(25558).then(a.bind(a,55642)),"@site/versioned_docs/version-0.3.0/basics/12-native-token.md",55642],a046a162:[()=>a.e(59344).then(a.bind(a,88654)),"@site/versioned_docs/version-0.6.0/basics/04-flipper-internals.md",88654],a05c6bda:[()=>a.e(18118).then(a.bind(a,52936)),"@site/blog/2023-06-27-we-are-here-to-stay/index.md",52936],a0a709a1:[()=>a.e(98017).then(a.bind(a,1720)),"@site/versioned_docs/version-0.9.0/tutorials/pauseable.md",1720],a0d3df9d:[()=>a.e(3743).then(a.bind(a,2544)),"@site/versioned_docs/version-0.3.0/basics/09-events.md",2544],a33e3bb6:[()=>a.e(27776).then(a.bind(a,58640)),"@site/versioned_docs/version-0.9.1/basics/04-flipper-internals.md",58640],a3d6ef01:[()=>a.e(76153).then(a.t.bind(a,41835,19)),"~docs/default/category-docsnext-tutorialsidebar-category-advanced-59f.json",41835],a663e775:[()=>a.e(56317).then(a.bind(a,35789)),"@site/versioned_docs/version-0.4.0/basics/10-cross-calls.md",35789],a6734805:[()=>a.e(32947).then(a.bind(a,15469)),"@site/versioned_docs/version-0.3.1/tutorials/erc20.md",15469],a6aa9e1f:[()=>Promise.all([a.e(40532),a.e(90239),a.e(93089)]).then(a.bind(a,93269)),"@theme/BlogListPage",93269],a6f6e2b9:[()=>a.e(67093).then(a.bind(a,32193)),"@site/blog/2022-11-30-release-020/index.md?truncated=true",32193],a7794a1d:[()=>a.e(88993).then(a.bind(a,98913)),"@site/versioned_docs/version-1.0.0/tutorials/access-control.md",98913],a809f3b7:[()=>a.e(33146).then(a.t.bind(a,43450,19)),"~docs/default/category-docs-081-tutorialsidebar-category-getting-started-453.json",43450],a88260b3:[()=>a.e(75176).then(a.t.bind(a,49449,19)),"~docs/default/category-docs-031-tutorialsidebar-category-tutorials-00f.json",49449],a892851d:[()=>a.e(55046).then(a.bind(a,67036)),"@site/versioned_docs/version-0.8.1/getting-started/installation.md",67036],a98f838e:[()=>a.e(98651).then(a.t.bind(a,26665,19)),"~docs/default/category-docs-080-tutorialsidebar-category-advanced-0ca.json",26665],aaadf060:[()=>a.e(64318).then(a.bind(a,15470)),"@site/versioned_docs/version-0.5.0/basics/01-cargo-odra.md",15470],ab4716a0:[()=>a.e(12933).then(a.bind(a,71550)),"@site/versioned_docs/version-0.5.0/basics/04-flipper-internals.md",71550],ab49860c:[()=>a.e(95211).then(a.bind(a,34584)),"@site/versioned_docs/version-0.4.0/basics/06-communicating-with-host.md",34584],ac692f92:[()=>a.e(46539).then(a.t.bind(a,30577,19)),"~docs/default/category-docsnext-tutorialsidebar-category-backends-ad3.json",30577],acbba37b:[()=>a.e(77715).then(a.t.bind(a,96687,19)),"~docs/default/category-docs-080-tutorialsidebar-category-migrations-277.json",96687],acebe248:[()=>a.e(46393).then(a.bind(a,70411)),"@site/versioned_docs/version-0.4.0/basics/05-storage-interaction.md",70411],ad92572d:[()=>a.e(10242).then(a.bind(a,96867)),"@site/versioned_docs/version-0.5.0/backends/01-what-is-a-backend.md",96867],aee91c2e:[()=>a.e(23073).then(a.bind(a,17118)),"@site/docs/backends/02-odra-vm.md",17118],af2a4ce0:[()=>a.e(63376).then(a.bind(a,15008)),"@site/versioned_docs/version-0.6.0/basics/02-directory-structure.md",15008],afc3a23f:[()=>a.e(40996).then(a.bind(a,1883)),"@site/versioned_docs/version-0.7.0/basics/01-cargo-odra.md",1883],b0f6aa87:[()=>a.e(78584).then(a.bind(a,69182)),"@site/versioned_docs/version-0.4.0/backends/03-casper.md",69182],b241ea99:[()=>a.e(74230).then(a.bind(a,16017)),"@site/versioned_docs/version-0.3.1/tutorials/owned-token.md",16017],b25a9e84:[()=>a.e(53644).then(a.bind(a,13175)),"@site/versioned_docs/version-0.9.0/tutorials/erc20.md",13175],b2b12f9a:[()=>Promise.all([a.e(40532),a.e(92349)]).then(a.bind(a,71352)),"@site/versioned_docs/version-1.0.0/tutorials/using-proxy-caller.md",71352],b2b675dd:[()=>a.e(90533).then(a.t.bind(a,28017,19)),"~blog/default/blog-c06.json",28017],b2c1dfd0:[()=>a.e(44781).then(a.bind(a,49333)),"@site/versioned_docs/version-0.8.1/backends/04-livenet.md",49333],b2e57a16:[()=>a.e(19243).then(a.bind(a,71345)),"@site/versioned_docs/version-0.6.0/backends/01-what-is-a-backend.md",71345],b2f44958:[()=>a.e(5776).then(a.bind(a,88144)),"@site/versioned_docs/version-0.5.0/basics/06-communicating-with-host.md",88144],b2f554cd:[()=>a.e(11477).then(a.t.bind(a,30010,19)),"~blog/default/blog-archive-80c.json",30010],b338949b:[()=>a.e(32103).then(a.bind(a,60208)),"@site/versioned_docs/version-0.5.0/advanced/04-attributes.md",60208],b435d362:[()=>a.e(37150).then(a.t.bind(a,43396,19)),"~docs/default/category-docs-040-tutorialsidebar-category-examples-524.json",43396],b4f02106:[()=>a.e(1442).then(a.bind(a,73437)),"@site/versioned_docs/version-0.6.0/advanced/02-delegate.md",73437],b50b03ee:[()=>a.e(45486).then(a.bind(a,57740)),"@site/versioned_docs/version-0.9.1/basics/09-events.md",57740],b548b5e0:[()=>a.e(41810).then(a.bind(a,7954)),"@site/versioned_docs/version-0.4.0/intro.md",7954],b6aaec29:[()=>a.e(61655).then(a.bind(a,63510)),"@site/versioned_docs/version-0.6.0/basics/09-events.md",63510],b6d3d7c8:[()=>a.e(59158).then(a.bind(a,36748)),"@site/versioned_docs/version-1.0.0/basics/01-cargo-odra.md",36748],b70aea30:[()=>a.e(15705).then(a.bind(a,22242)),"@site/versioned_docs/version-0.8.0/basics/12-native-token.md",22242],b7573e33:[()=>a.e(67897).then(a.bind(a,51464)),"@site/versioned_docs/version-0.3.0/advanced/01-composer.md",51464],b759477d:[()=>a.e(10079).then(a.bind(a,95150)),"@site/versioned_docs/version-0.2.0/intro.md",95150],b7d3ed64:[()=>a.e(98666).then(a.bind(a,14454)),"@site/versioned_docs/version-0.3.0/getting-started/flipper.md",14454],b87f41d0:[()=>a.e(97752).then(a.bind(a,82979)),"@site/versioned_docs/version-0.3.1/getting-started/flipper.md",82979],b94504cb:[()=>a.e(24415).then(a.bind(a,70872)),"@site/versioned_docs/version-0.4.0/advanced/04-attributes.md",70872],ba36c747:[()=>a.e(74997).then(a.bind(a,44326)),"@site/docs/basics/07-testing.md",44326],bab04a93:[()=>a.e(45006).then(a.bind(a,94071)),"@site/versioned_docs/version-0.7.0/advanced/04-attributes.md",94071],bac2ca12:[()=>a.e(4720).then(a.bind(a,17144)),"@site/docs/advanced/03-attributes.md",17144],bb6e6682:[()=>a.e(74563).then(a.t.bind(a,73593,19)),"~docs/default/category-docs-080-tutorialsidebar-category-examples-cbd.json",73593],bc0e7bcb:[()=>a.e(52962).then(a.bind(a,71611)),"@site/versioned_docs/version-0.9.0/getting-started/flipper.md",71611],bc53adba:[()=>a.e(83306).then(a.t.bind(a,18721,19)),"~docs/default/category-docs-070-tutorialsidebar-category-backends-f0e.json",18721],bc61aabc:[()=>a.e(91613).then(a.bind(a,74321)),"@site/versioned_docs/version-0.8.0/advanced/04-storage-layout.md",74321],bc77ce48:[()=>a.e(43379).then(a.t.bind(a,19626,19)),"~docs/default/version-0-8-1-metadata-prop-331.json",19626],bc9af134:[()=>Promise.all([a.e(40532),a.e(30637)]).then(a.bind(a,64052)),"@site/docs/migrations/to-0.9.0.md",64052],bcf5f050:[()=>a.e(267).then(a.bind(a,10486)),"@site/versioned_docs/version-0.9.0/basics/04-flipper-internals.md",10486],bd4cf5c0:[()=>a.e(83241).then(a.bind(a,37493)),"@site/versioned_docs/version-0.2.0/backends/03-casper.md",37493],be0b2ac1:[()=>a.e(589).then(a.t.bind(a,82532,19)),"~docs/default/category-docs-060-tutorialsidebar-category-basics-f9f.json",82532],beab0651:[()=>a.e(67620).then(a.bind(a,25369)),"@site/versioned_docs/version-0.3.1/examples/odra-examples.md",25369],bee0af8b:[()=>a.e(25662).then(a.bind(a,95920)),"@site/versioned_docs/version-0.3.0/intro.md",95920],befd1fba:[()=>a.e(31215).then(a.bind(a,98158)),"@site/versioned_docs/version-0.6.0/basics/12-native-token.md",98158],bfc20097:[()=>a.e(55897).then(a.bind(a,93969)),"@site/docs/tutorials/access-control.md",93969],bfc8213d:[()=>a.e(59309).then(a.bind(a,93853)),"@site/versioned_docs/version-0.5.0/getting-started/installation.md",93853],c10f3592:[()=>a.e(28966).then(a.t.bind(a,8968,19)),"~docs/default/category-docs-tutorialsidebar-category-backends-ecf.json",8968],c13d152b:[()=>a.e(63668).then(a.bind(a,62260)),"@site/versioned_docs/version-0.5.0/basics/12-native-token.md",62260],c1418166:[()=>a.e(7978).then(a.bind(a,62393)),"@site/docs/basics/12-native-token.md",62393],c1ae59bd:[()=>a.e(7437).then(a.bind(a,64970)),"@site/blog/2023-08-18-nysa/index.md?truncated=true",64970],c1bc45da:[()=>a.e(17927).then(a.bind(a,73799)),"@site/docs/advanced/05-using-different-allocator.md",73799],c24519ee:[()=>a.e(87541).then(a.bind(a,52402)),"@site/versioned_docs/version-0.4.0/advanced/02-delegate.md",52402],c3fd70b6:[()=>a.e(68459).then(a.t.bind(a,28939,19)),"~docs/default/category-docsnext-tutorialsidebar-category-getting-started-fbc.json",28939],c40f324a:[()=>a.e(79812).then(a.bind(a,8974)),"@site/docs/tutorials/nft.md",8974],c43892d3:[()=>a.e(59138).then(a.bind(a,64917)),"@site/versioned_docs/version-0.3.0/backends/02-mock-vm.md",64917],c4f5d8e4:[()=>Promise.all([a.e(40532),a.e(64195)]).then(a.bind(a,53261)),"@site/src/pages/index.js",53261],c52764ec:[()=>a.e(72653).then(a.t.bind(a,46492,19)),"~docs/default/category-docs-060-tutorialsidebar-category-getting-started-2f5.json",46492],c5296eae:[()=>a.e(25396).then(a.bind(a,49944)),"@site/versioned_docs/version-0.2.0/basics/10-cross-calls.md",49944],c52d4d42:[()=>a.e(97227).then(a.bind(a,38008)),"@site/versioned_docs/version-0.6.0/basics/08-errors.md",38008],c5cef920:[()=>a.e(88590).then(a.bind(a,62467)),"@site/versioned_docs/version-0.3.0/basics/08-errors.md",62467],c5f43526:[()=>a.e(2037).then(a.bind(a,50605)),"@site/versioned_docs/version-0.3.1/basics/02-directory-structure.md",50605],c6385d27:[()=>a.e(25579).then(a.t.bind(a,48187,19)),"~docs/default/category-docs-060-tutorialsidebar-category-advanced-0fe.json",48187],c705646d:[()=>a.e(6489).then(a.bind(a,65350)),"@site/versioned_docs/version-0.6.0/basics/07-testing.md",65350],c714b9ee:[()=>a.e(96105).then(a.bind(a,91651)),"@site/versioned_docs/version-0.2.0/backends/02-mock-vm.md",91651],c71fcec7:[()=>a.e(76974).then(a.bind(a,48458)),"@site/versioned_docs/version-0.3.1/basics/06-communicating-with-host.md",48458],c8e7910f:[()=>a.e(90897).then(a.bind(a,13136)),"@site/versioned_docs/version-0.8.0/getting-started/installation.md",13136],c95b781b:[()=>a.e(69810).then(a.t.bind(a,86280,19)),"~docs/default/version-0-8-0-metadata-prop-466.json",86280],ca19d087:[()=>a.e(52481).then(a.bind(a,97142)),"@site/versioned_docs/version-1.0.0/tutorials/erc20.md",97142],ca76cddc:[()=>a.e(44191).then(a.bind(a,46486)),"@site/docs/basics/09-events.md",46486],ca9ead02:[()=>a.e(91950).then(a.bind(a,87998)),"@site/versioned_docs/version-0.8.0/basics/05-storage-interaction.md",87998],cad7ddc9:[()=>a.e(77042).then(a.t.bind(a,74431,19)),"~docs/default/category-docs-020-defaultsidebar-category-examples-b7f.json",74431],cb085bdb:[()=>a.e(84201).then(a.bind(a,84299)),"@site/versioned_docs/version-0.3.1/basics/04-flipper-internals.md",84299],cbdaac1b:[()=>a.e(3744).then(a.bind(a,55468)),"@site/versioned_docs/version-0.2.0/tutorials/ownable.md",55468],cc61c55f:[()=>a.e(27867).then(a.bind(a,35660)),"@site/versioned_docs/version-0.8.0/basics/06-communicating-with-host.md",35660],cca6b120:[()=>a.e(15775).then(a.bind(a,54790)),"@site/versioned_docs/version-0.3.1/basics/03-odra-toml.md",54790],ccc49370:[()=>Promise.all([a.e(40532),a.e(90239),a.e(46103)]).then(a.bind(a,65203)),"@theme/BlogPostPage",65203],ccd6c61b:[()=>a.e(33985).then(a.bind(a,7736)),"@site/versioned_docs/version-0.9.1/basics/02-directory-structure.md",7736],cd591068:[()=>a.e(92331).then(a.bind(a,94806)),"@site/versioned_docs/version-0.3.0/basics/07-testing.md",94806],cd790770:[()=>a.e(58841).then(a.bind(a,74324)),"@site/blog/2023-02-27-openai-writes-erc20-in-odra/index.md?truncated=true",74324],cdca8af0:[()=>a.e(40588).then(a.bind(a,27382)),"@site/versioned_docs/version-1.0.0/getting-started/installation.md",27382],cde2d623:[()=>a.e(70825).then(a.bind(a,60090)),"@site/docs/basics/11-modules.md",60090],ce4f9116:[()=>a.e(99680).then(a.bind(a,3529)),"@site/versioned_docs/version-0.7.0/tutorials/access-control.md",3529],ce999a4e:[()=>a.e(12862).then(a.bind(a,71824)),"@site/versioned_docs/version-0.2.0/basics/01-cargo-odra.md",71824],ce9c8ec6:[()=>a.e(21957).then(a.bind(a,15766)),"@site/versioned_docs/version-0.9.0/advanced/02-advanced-storage.md",15766],cecbc2b5:[()=>a.e(65901).then(a.bind(a,63481)),"@site/versioned_docs/version-0.3.0/backends/01-what-is-a-backend.md",63481],cf3f256a:[()=>a.e(73175).then(a.bind(a,55132)),"@site/versioned_docs/version-0.7.0/basics/02-directory-structure.md",55132],cfdaa3fd:[()=>a.e(24999).then(a.bind(a,37982)),"@site/versioned_docs/version-0.9.1/tutorials/erc20.md",37982],d0c01b74:[()=>a.e(33622).then(a.bind(a,62276)),"@site/versioned_docs/version-0.2.0/basics/05-storage-interaction.md",62276],d15969ed:[()=>a.e(40190).then(a.bind(a,86318)),"@site/blog/2023-02-15-odra-cosmos.md",86318],d25c8023:[()=>a.e(90437).then(a.bind(a,9438)),"@site/versioned_docs/version-0.8.0/basics/11-modules.md",9438],d2eb1abd:[()=>a.e(99661).then(a.bind(a,5584)),"@site/versioned_docs/version-0.9.0/advanced/03-attributes.md",5584],d32d6987:[()=>a.e(95684).then(a.bind(a,3023)),"@site/versioned_docs/version-1.0.0/basics/12-native-token.md",3023],d386dd06:[()=>a.e(65067).then(a.t.bind(a,75444,19)),"~docs/default/category-docs-060-tutorialsidebar-category-backends-58b.json",75444],d5e3179c:[()=>a.e(38089).then(a.bind(a,41453)),"@site/docs/basics/08-errors.md",41453],d691a609:[()=>a.e(33468).then(a.bind(a,89562)),"@site/versioned_docs/version-0.3.0/basics/10-cross-calls.md",89562],d7637d81:[()=>a.e(14062).then(a.bind(a,40808)),"@site/versioned_docs/version-0.2.0/examples/using-odra-modules.md",40808],d7dfd89f:[()=>a.e(1655).then(a.t.bind(a,87197,19)),"~docs/default/category-docs-090-tutorialsidebar-category-tutorials-92d.json",87197],d8ed494b:[()=>a.e(17342).then(a.bind(a,74844)),"@site/versioned_docs/version-0.8.0/basics/07-testing.md",74844],d90ea429:[()=>Promise.all([a.e(40532),a.e(48435)]).then(a.bind(a,29230)),"@site/versioned_docs/version-0.9.1/migrations/to-0.8.0.md",29230],d985b3f7:[()=>a.e(9558).then(a.t.bind(a,15745,19)),"/home/runner/work/odradev.github.io/odradev.github.io/docusaurus/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",15745],d9fee9da:[()=>a.e(97405).then(a.t.bind(a,29124,19)),"~docs/default/category-docs-031-tutorialsidebar-category-basics-96f.json",29124],da555cce:[()=>a.e(85228).then(a.bind(a,7275)),"@site/versioned_docs/version-0.6.0/basics/01-cargo-odra.md",7275],da9e3acc:[()=>a.e(90827).then(a.bind(a,47820)),"@site/versioned_docs/version-0.2.0/basics/04-flipper-internals.md",47820],db36feee:[()=>a.e(28663).then(a.bind(a,7838)),"@site/versioned_docs/version-0.9.1/basics/13-casper-contract-schema.md",7838],db82a1c0:[()=>a.e(494).then(a.t.bind(a,32259,19)),"~docs/default/version-0-4-0-metadata-prop-913.json",32259],db95cb73:[()=>a.e(16828).then(a.bind(a,9370)),"@site/versioned_docs/version-1.0.0/advanced/04-storage-layout.md",9370],dc0bb66d:[()=>a.e(67766).then(a.bind(a,56052)),"@site/versioned_docs/version-0.8.1/tutorials/owned-token.md",56052],dcb2dd04:[()=>a.e(16504).then(a.bind(a,65154)),"@site/versioned_docs/version-0.9.0/basics/13-casper-contract-schema.md",65154],dd174fa2:[()=>a.e(58727).then(a.t.bind(a,86995,19)),"~docs/default/category-docs-080-tutorialsidebar-category-getting-started-d9b.json",86995],ddaed26d:[()=>a.e(67759).then(a.bind(a,13092)),"@site/versioned_docs/version-0.8.1/basics/01-cargo-odra.md",13092],de67a916:[()=>a.e(6156).then(a.bind(a,63847)),"@site/versioned_docs/version-1.0.0/backends/03-casper.md",63847],defc5a9a:[()=>a.e(85804).then(a.t.bind(a,57771,19)),"~docs/default/category-docs-090-tutorialsidebar-category-advanced-614.json",57771],df1503d8:[()=>a.e(98445).then(a.bind(a,14797)),"@site/docs/tutorials/pauseable.md",14797],dfe71587:[()=>a.e(34267).then(a.bind(a,47821)),"@site/versioned_docs/version-0.8.0/basics/01-cargo-odra.md",47821],e018be55:[()=>a.e(99314).then(a.t.bind(a,36590,19)),"~docs/default/category-docsnext-tutorialsidebar-category-tutorials-f26.json",36590],e07dea01:[()=>a.e(15924).then(a.bind(a,17137)),"@site/versioned_docs/version-1.0.0/tutorials/cep18.md",17137],e2022d8c:[()=>a.e(52701).then(a.bind(a,86058)),"@site/docs/tutorials/ownable.md",86058],e2724f12:[()=>a.e(9370).then(a.t.bind(a,50583,19)),"~docs/default/category-docs-070-tutorialsidebar-category-tutorials-48d.json",50583],e294fa30:[()=>a.e(94023).then(a.bind(a,95086)),"@site/versioned_docs/version-0.7.0/basics/06-communicating-with-host.md",95086],e309b9ad:[()=>a.e(18355).then(a.bind(a,23399)),"@site/versioned_docs/version-0.9.1/getting-started/flipper.md",23399],e30c7d5f:[()=>Promise.all([a.e(40532),a.e(14665)]).then(a.bind(a,86159)),"@site/versioned_docs/version-0.9.0/migrations/to-0.9.0.md",86159],e31bed34:[()=>a.e(11839).then(a.bind(a,38090)),"@site/versioned_docs/version-0.3.1/advanced/02-delegate.md",38090],e47e02bd:[()=>a.e(4056).then(a.t.bind(a,66923,19)),"~docs/default/category-docs-091-tutorialsidebar-category-tutorials-31d.json",66923],e4b2a41e:[()=>a.e(11422).then(a.t.bind(a,67251,19)),"~docs/default/category-docs-030-defaultsidebar-category-examples-be4.json",67251],e4e3cd82:[()=>a.e(68334).then(a.bind(a,91578)),"@site/versioned_docs/version-0.8.0/tutorials/access-control.md",91578],e4e8123e:[()=>a.e(68887).then(a.bind(a,77240)),"@site/versioned_docs/version-0.9.1/intro.md",77240],e538a9e1:[()=>a.e(50635).then(a.bind(a,24046)),"@site/versioned_docs/version-0.3.0/basics/02-directory-structure.md",24046],e5e64bd0:[()=>a.e(31401).then(a.t.bind(a,65322,19)),"~docs/default/category-docs-030-defaultsidebar-category-backends-73f.json",65322],e745da21:[()=>a.e(36361).then(a.bind(a,48401)),"@site/versioned_docs/version-1.0.0/basics/02-directory-structure.md",48401],e74fcb0e:[()=>a.e(38705).then(a.bind(a,67467)),"@site/versioned_docs/version-1.0.0/basics/08-errors.md",67467],e78a982b:[()=>a.e(83400).then(a.bind(a,5959)),"@site/versioned_docs/version-1.0.0/advanced/06-building-manually.md",5959],e7a2e79a:[()=>a.e(11830).then(a.bind(a,96900)),"@site/versioned_docs/version-0.8.1/basics/04-flipper-internals.md",96900],e8902c41:[()=>a.e(64875).then(a.t.bind(a,79495,19)),"~docs/default/category-docs-090-tutorialsidebar-category-getting-started-26c.json",79495],e8a3ffa2:[()=>a.e(21389).then(a.bind(a,10296)),"@site/versioned_docs/version-0.6.0/getting-started/installation.md",10296],e9ea549b:[()=>a.e(25495).then(a.bind(a,3070)),"@site/docs/getting-started/flipper.md",3070],ea0379ae:[()=>a.e(88854).then(a.t.bind(a,49059,19)),"~docs/default/category-docs-070-tutorialsidebar-category-examples-23e.json",49059],ea145f46:[()=>a.e(19856).then(a.t.bind(a,92892,19)),"~docs/default/category-docs-020-defaultsidebar-category-getting-started-e58.json",92892],eae8630e:[()=>a.e(91501).then(a.t.bind(a,73627,19)),"~docs/default/category-docs-081-tutorialsidebar-category-tutorials-217.json",73627],ed6ae2e5:[()=>a.e(7493).then(a.t.bind(a,35069,19)),"~docs/default/category-docs-040-tutorialsidebar-category-backends-062.json",35069],ed898d19:[()=>a.e(30659).then(a.bind(a,65822)),"@site/versioned_docs/version-0.6.0/advanced/01-using.md",65822],ee3d80a6:[()=>a.e(12535).then(a.bind(a,78575)),"@site/versioned_docs/version-0.7.0/basics/03-odra-toml.md",78575],eedc1cb5:[()=>a.e(44248).then(a.bind(a,30420)),"@site/versioned_docs/version-0.6.0/examples/odra-examples.md",30420],ef626e06:[()=>a.e(73808).then(a.bind(a,27909)),"@site/versioned_docs/version-0.9.0/basics/01-cargo-odra.md",27909],f00a1e6f:[()=>a.e(81171).then(a.bind(a,88378)),"@site/versioned_docs/version-0.4.0/basics/09-events.md",88378],f0928d2f:[()=>a.e(35660).then(a.t.bind(a,78942,19)),"~docs/default/category-docs-030-defaultsidebar-category-tutorials-000.json",78942],f1080184:[()=>a.e(89074).then(a.bind(a,58327)),"@site/versioned_docs/version-0.7.0/getting-started/installation.md",58327],f139e68c:[()=>a.e(62191).then(a.bind(a,46675)),"@site/versioned_docs/version-0.9.1/basics/12-native-token.md",46675],f146bc3c:[()=>a.e(57731).then(a.t.bind(a,73800,19)),"~docs/default/category-docs-060-tutorialsidebar-category-examples-ba1.json",73800],f446cb0a:[()=>a.e(26418).then(a.bind(a,5537)),"@site/versioned_docs/version-0.8.0/basics/03-odra-toml.md",5537],f4926997:[()=>a.e(83518).then(a.bind(a,13966)),"@site/versioned_docs/version-1.0.0/tutorials/ownable.md",13966],f54718af:[()=>a.e(52294).then(a.bind(a,53478)),"@site/versioned_docs/version-0.5.0/backends/03-casper.md",53478],f5bf02f1:[()=>a.e(69756).then(a.t.bind(a,60374,19)),"~docs/default/category-docs-tutorialsidebar-category-advanced-90a.json",60374],f63d58d7:[()=>a.e(41906).then(a.bind(a,27107)),"@site/versioned_docs/version-0.8.1/advanced/03-attributes.md",27107],f6aaa6b5:[()=>a.e(97987).then(a.t.bind(a,28603,19)),"~docs/default/category-docs-090-tutorialsidebar-category-migrations-9e8.json",28603],f781f173:[()=>a.e(24854).then(a.bind(a,76279)),"@site/versioned_docs/version-1.0.0/advanced/02-advanced-storage.md",76279],f8f99b0e:[()=>Promise.all([a.e(40532),a.e(20626)]).then(a.bind(a,1417)),"@site/versioned_docs/version-0.9.1/tutorials/build-deploy-read.md",1417],f91f9bef:[()=>a.e(74234).then(a.bind(a,79812)),"@site/versioned_docs/version-1.0.0/backends/04-livenet.md",79812],f92986d2:[()=>a.e(49165).then(a.t.bind(a,49749,19)),"~docs/default/category-docs-040-tutorialsidebar-category-getting-started-a8e.json",49749],fa4e959a:[()=>a.e(21544).then(a.bind(a,73633)),"@site/docs/basics/06-communicating-with-host.md",73633],fabdfba1:[()=>a.e(63898).then(a.bind(a,88672)),"@site/versioned_docs/version-0.9.0/basics/02-directory-structure.md",88672],fb249be3:[()=>a.e(6e4).then(a.bind(a,67268)),"@site/versioned_docs/version-0.3.0/tutorials/owned-token.md",67268],fcdcfd4e:[()=>a.e(76391).then(a.bind(a,20343)),"@site/versioned_docs/version-0.9.1/basics/08-errors.md",20343],fcdd79ea:[()=>a.e(31201).then(a.bind(a,13805)),"@site/versioned_docs/version-1.0.0/backends/01-what-is-a-backend.md",13805],fdb5f68c:[()=>a.e(37178).then(a.bind(a,34258)),"@site/versioned_docs/version-0.4.0/getting-started/installation.md",34258],fe2b6021:[()=>a.e(4467).then(a.bind(a,36958)),"@site/versioned_docs/version-0.5.0/getting-started/flipper.md",36958],fec7bf31:[()=>a.e(46844).then(a.bind(a,39055)),"@site/versioned_docs/version-0.7.0/backends/02-mock-vm.md",39055],fed89aff:[()=>a.e(68453).then(a.bind(a,28983)),"@site/versioned_docs/version-0.9.1/advanced/06-building-manually.md",28983],fefb7f4a:[()=>a.e(50572).then(a.bind(a,87329)),"@site/versioned_docs/version-0.8.1/basics/12-native-token.md",87329],ff33c5f7:[()=>a.e(76901).then(a.bind(a,41516)),"@site/versioned_docs/version-0.7.0/basics/12-native-token.md",41516],ff3976bd:[()=>a.e(3037).then(a.t.bind(a,36944,19)),"~docs/default/category-docs-060-tutorialsidebar-category-tutorials-b61.json",36944]};function d(e){let{error:t,retry:a,pastDelay:r}=e;return t?n.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},n.createElement("p",null,String(t)),n.createElement("div",null,n.createElement("button",{type:"button",onClick:a},"Retry"))):r?n.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},n.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},n.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},n.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},n.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),n.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),n.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),n.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},n.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),n.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),n.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),n.createElement("circle",{cx:"22",cy:"22",r:"8"},n.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var l=a(99670),u=a(30226);function p(e,t){if("*"===e)return s()({loading:d,loader:()=>a.e(4972).then(a.bind(a,4972)),modules:["@theme/NotFound"],webpack:()=>[4972],render(e,t){const a=e.default;return n.createElement(u.z,{value:{plugin:{name:"native",id:"default"}}},n.createElement(a,t))}});const o=i[`${e}-${t}`],p={},b=[],f=[],m=(0,l.Z)(o);return Object.entries(m).forEach((e=>{let[t,a]=e;const n=c[a];n&&(p[t]=n[0],b.push(n[1]),f.push(n[2]))})),s().Map({loading:d,loader:p,modules:b,webpack:()=>f,render(t,a){const s=JSON.parse(JSON.stringify(o));Object.entries(t).forEach((t=>{let[a,n]=t;const r=n.default;if(!r)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof r&&"function"!=typeof r||Object.keys(n).filter((e=>"default"!==e)).forEach((e=>{r[e]=n[e]}));let o=s;const i=a.split(".");i.slice(0,-1).forEach((e=>{o=o[e]})),o[i[i.length-1]]=r}));const i=s.__comp;delete s.__comp;const c=s.__context;return delete s.__context,n.createElement(u.z,{value:c},n.createElement(i,(0,r.Z)({},s,a)))}})}const b=[{path:"/blog",component:p("/blog","8e1"),exact:!0},{path:"/blog/2023-02-27-openai-writes-erc20-in-odra",component:p("/blog/2023-02-27-openai-writes-erc20-in-odra","d74"),exact:!0},{path:"/blog/archive",component:p("/blog/archive","fb4"),exact:!0},{path:"/blog/casper-zk-risc0",component:p("/blog/casper-zk-risc0","130"),exact:!0},{path:"/blog/evm-at-risc0",component:p("/blog/evm-at-risc0","d36"),exact:!0},{path:"/blog/its-all-about-the-community",component:p("/blog/its-all-about-the-community","1cb"),exact:!0},{path:"/blog/Nysa",component:p("/blog/Nysa","9ad"),exact:!0},{path:"/blog/odra-cosmwasm",component:p("/blog/odra-cosmwasm","70d"),exact:!0},{path:"/blog/release-020",component:p("/blog/release-020","1af"),exact:!0},{path:"/docs/0.2.0",component:p("/docs/0.2.0","eb8"),routes:[{path:"/docs/0.2.0/",component:p("/docs/0.2.0/","dd7"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/backends/casper",component:p("/docs/0.2.0/backends/casper","9e3"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/backends/mock-vm",component:p("/docs/0.2.0/backends/mock-vm","af2"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/backends/what-is-a-backend",component:p("/docs/0.2.0/backends/what-is-a-backend","ac7"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/cargo-odra",component:p("/docs/0.2.0/basics/cargo-odra","0cf"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/communicating-with-host",component:p("/docs/0.2.0/basics/communicating-with-host","76d"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/cross-calls",component:p("/docs/0.2.0/basics/cross-calls","9e3"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/directory-structure",component:p("/docs/0.2.0/basics/directory-structure","49a"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/errors",component:p("/docs/0.2.0/basics/errors","dc2"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/events",component:p("/docs/0.2.0/basics/events","d84"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/flipper-internals",component:p("/docs/0.2.0/basics/flipper-internals","5d3"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/modules",component:p("/docs/0.2.0/basics/modules","592"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/native-token",component:p("/docs/0.2.0/basics/native-token","8f7"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/odra-toml",component:p("/docs/0.2.0/basics/odra-toml","b95"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/storage-interaction",component:p("/docs/0.2.0/basics/storage-interaction","5ec"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/basics/testing",component:p("/docs/0.2.0/basics/testing","101"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/category/backends",component:p("/docs/0.2.0/category/backends","f65"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/category/basics",component:p("/docs/0.2.0/category/basics","3e9"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/category/examples",component:p("/docs/0.2.0/category/examples","539"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/category/getting-started",component:p("/docs/0.2.0/category/getting-started","d19"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/category/tutorials",component:p("/docs/0.2.0/category/tutorials","05e"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/examples/odra-examples",component:p("/docs/0.2.0/examples/odra-examples","640"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/examples/using-odra-modules",component:p("/docs/0.2.0/examples/using-odra-modules","765"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/getting-started/flipper",component:p("/docs/0.2.0/getting-started/flipper","5ff"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/getting-started/installation",component:p("/docs/0.2.0/getting-started/installation","c82"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/tutorials/erc20",component:p("/docs/0.2.0/tutorials/erc20","05b"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/tutorials/ownable",component:p("/docs/0.2.0/tutorials/ownable","d53"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.2.0/tutorials/owned-token",component:p("/docs/0.2.0/tutorials/owned-token","79e"),exact:!0,sidebar:"defaultSidebar"}]},{path:"/docs/0.3.0",component:p("/docs/0.3.0","10f"),routes:[{path:"/docs/0.3.0/",component:p("/docs/0.3.0/","959"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/advanced/advanced-storage",component:p("/docs/0.3.0/advanced/advanced-storage","141"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/advanced/attributes",component:p("/docs/0.3.0/advanced/attributes","2c9"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/advanced/composer",component:p("/docs/0.3.0/advanced/composer","226"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/advanced/delegate",component:p("/docs/0.3.0/advanced/delegate","bfb"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/backends/casper",component:p("/docs/0.3.0/backends/casper","106"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/backends/mock-vm",component:p("/docs/0.3.0/backends/mock-vm","187"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/backends/what-is-a-backend",component:p("/docs/0.3.0/backends/what-is-a-backend","37a"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/cargo-odra",component:p("/docs/0.3.0/basics/cargo-odra","c76"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/communicating-with-host",component:p("/docs/0.3.0/basics/communicating-with-host","049"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/cross-calls",component:p("/docs/0.3.0/basics/cross-calls","790"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/directory-structure",component:p("/docs/0.3.0/basics/directory-structure","5e5"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/errors",component:p("/docs/0.3.0/basics/errors","8ce"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/events",component:p("/docs/0.3.0/basics/events","fbf"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/flipper-internals",component:p("/docs/0.3.0/basics/flipper-internals","c30"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/modules",component:p("/docs/0.3.0/basics/modules","c88"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/native-token",component:p("/docs/0.3.0/basics/native-token","87f"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/odra-toml",component:p("/docs/0.3.0/basics/odra-toml","cd5"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/storage-interaction",component:p("/docs/0.3.0/basics/storage-interaction","12e"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/basics/testing",component:p("/docs/0.3.0/basics/testing","fda"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/category/advanced",component:p("/docs/0.3.0/category/advanced","08a"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/category/backends",component:p("/docs/0.3.0/category/backends","5e8"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/category/basics",component:p("/docs/0.3.0/category/basics","03f"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/category/examples",component:p("/docs/0.3.0/category/examples","bf7"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/category/getting-started",component:p("/docs/0.3.0/category/getting-started","20b"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/category/tutorials",component:p("/docs/0.3.0/category/tutorials","814"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/examples/odra-examples",component:p("/docs/0.3.0/examples/odra-examples","fa6"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/examples/using-odra-modules",component:p("/docs/0.3.0/examples/using-odra-modules","c03"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/getting-started/flipper",component:p("/docs/0.3.0/getting-started/flipper","553"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/getting-started/installation",component:p("/docs/0.3.0/getting-started/installation","6ad"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/tutorials/erc20",component:p("/docs/0.3.0/tutorials/erc20","2a7"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/tutorials/ownable",component:p("/docs/0.3.0/tutorials/ownable","11c"),exact:!0,sidebar:"defaultSidebar"},{path:"/docs/0.3.0/tutorials/owned-token",component:p("/docs/0.3.0/tutorials/owned-token","a68"),exact:!0,sidebar:"defaultSidebar"}]},{path:"/docs/0.3.1",component:p("/docs/0.3.1","af3"),routes:[{path:"/docs/0.3.1/",component:p("/docs/0.3.1/","0fe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/advanced/advanced-storage",component:p("/docs/0.3.1/advanced/advanced-storage","f06"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/advanced/attributes",component:p("/docs/0.3.1/advanced/attributes","bce"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/advanced/composer",component:p("/docs/0.3.1/advanced/composer","a52"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/advanced/delegate",component:p("/docs/0.3.1/advanced/delegate","e81"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/backends/casper",component:p("/docs/0.3.1/backends/casper","e0e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/backends/mock-vm",component:p("/docs/0.3.1/backends/mock-vm","039"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/backends/what-is-a-backend",component:p("/docs/0.3.1/backends/what-is-a-backend","8d7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/cargo-odra",component:p("/docs/0.3.1/basics/cargo-odra","76a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/communicating-with-host",component:p("/docs/0.3.1/basics/communicating-with-host","85d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/cross-calls",component:p("/docs/0.3.1/basics/cross-calls","ed1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/directory-structure",component:p("/docs/0.3.1/basics/directory-structure","95e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/errors",component:p("/docs/0.3.1/basics/errors","699"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/events",component:p("/docs/0.3.1/basics/events","0ff"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/flipper-internals",component:p("/docs/0.3.1/basics/flipper-internals","8ce"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/modules",component:p("/docs/0.3.1/basics/modules","a5c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/native-token",component:p("/docs/0.3.1/basics/native-token","b51"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/odra-toml",component:p("/docs/0.3.1/basics/odra-toml","39b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/storage-interaction",component:p("/docs/0.3.1/basics/storage-interaction","5cc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/basics/testing",component:p("/docs/0.3.1/basics/testing","d8f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/category/advanced",component:p("/docs/0.3.1/category/advanced","7fc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/category/backends",component:p("/docs/0.3.1/category/backends","521"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/category/basics",component:p("/docs/0.3.1/category/basics","be6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/category/examples",component:p("/docs/0.3.1/category/examples","793"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/category/getting-started",component:p("/docs/0.3.1/category/getting-started","1b7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/category/tutorials",component:p("/docs/0.3.1/category/tutorials","55a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/examples/odra-examples",component:p("/docs/0.3.1/examples/odra-examples","9f8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/examples/using-odra-modules",component:p("/docs/0.3.1/examples/using-odra-modules","9a9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/getting-started/flipper",component:p("/docs/0.3.1/getting-started/flipper","1e0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/getting-started/installation",component:p("/docs/0.3.1/getting-started/installation","999"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/tutorials/erc20",component:p("/docs/0.3.1/tutorials/erc20","3c7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/tutorials/ownable",component:p("/docs/0.3.1/tutorials/ownable","939"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.3.1/tutorials/owned-token",component:p("/docs/0.3.1/tutorials/owned-token","e34"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.4.0",component:p("/docs/0.4.0","6b9"),routes:[{path:"/docs/0.4.0/",component:p("/docs/0.4.0/","f26"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/advanced/advanced-storage",component:p("/docs/0.4.0/advanced/advanced-storage","8c8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/advanced/attributes",component:p("/docs/0.4.0/advanced/attributes","8f9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/advanced/composer",component:p("/docs/0.4.0/advanced/composer","37a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/advanced/delegate",component:p("/docs/0.4.0/advanced/delegate","66f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/backends/casper",component:p("/docs/0.4.0/backends/casper","c05"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/backends/mock-vm",component:p("/docs/0.4.0/backends/mock-vm","bbe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/backends/what-is-a-backend",component:p("/docs/0.4.0/backends/what-is-a-backend","afc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/cargo-odra",component:p("/docs/0.4.0/basics/cargo-odra","be3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/communicating-with-host",component:p("/docs/0.4.0/basics/communicating-with-host","2c9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/cross-calls",component:p("/docs/0.4.0/basics/cross-calls","cd2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/directory-structure",component:p("/docs/0.4.0/basics/directory-structure","fda"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/errors",component:p("/docs/0.4.0/basics/errors","6ff"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/events",component:p("/docs/0.4.0/basics/events","7b1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/flipper-internals",component:p("/docs/0.4.0/basics/flipper-internals","a33"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/modules",component:p("/docs/0.4.0/basics/modules","2a3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/native-token",component:p("/docs/0.4.0/basics/native-token","a56"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/odra-toml",component:p("/docs/0.4.0/basics/odra-toml","011"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/storage-interaction",component:p("/docs/0.4.0/basics/storage-interaction","a7a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/basics/testing",component:p("/docs/0.4.0/basics/testing","7ac"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/category/advanced",component:p("/docs/0.4.0/category/advanced","0be"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/category/backends",component:p("/docs/0.4.0/category/backends","7c2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/category/basics",component:p("/docs/0.4.0/category/basics","1ef"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/category/examples",component:p("/docs/0.4.0/category/examples","84f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/category/getting-started",component:p("/docs/0.4.0/category/getting-started","651"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/category/tutorials",component:p("/docs/0.4.0/category/tutorials","d6c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/examples/odra-examples",component:p("/docs/0.4.0/examples/odra-examples","48a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/examples/using-odra-modules",component:p("/docs/0.4.0/examples/using-odra-modules","174"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/getting-started/flipper",component:p("/docs/0.4.0/getting-started/flipper","c72"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/getting-started/installation",component:p("/docs/0.4.0/getting-started/installation","ed5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/tutorials/erc20",component:p("/docs/0.4.0/tutorials/erc20","f49"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/tutorials/ownable",component:p("/docs/0.4.0/tutorials/ownable","0ce"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.4.0/tutorials/owned-token",component:p("/docs/0.4.0/tutorials/owned-token","d8c"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.5.0",component:p("/docs/0.5.0","ed6"),routes:[{path:"/docs/0.5.0/",component:p("/docs/0.5.0/","96f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/advanced/advanced-storage",component:p("/docs/0.5.0/advanced/advanced-storage","656"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/advanced/attributes",component:p("/docs/0.5.0/advanced/attributes","f61"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/advanced/delegate",component:p("/docs/0.5.0/advanced/delegate","0f8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/advanced/signatures",component:p("/docs/0.5.0/advanced/signatures","96c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/advanced/using",component:p("/docs/0.5.0/advanced/using","93b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/backends/casper",component:p("/docs/0.5.0/backends/casper","372"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/backends/mock-vm",component:p("/docs/0.5.0/backends/mock-vm","96e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/backends/what-is-a-backend",component:p("/docs/0.5.0/backends/what-is-a-backend","a98"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/cargo-odra",component:p("/docs/0.5.0/basics/cargo-odra","d15"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/communicating-with-host",component:p("/docs/0.5.0/basics/communicating-with-host","545"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/cross-calls",component:p("/docs/0.5.0/basics/cross-calls","d66"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/directory-structure",component:p("/docs/0.5.0/basics/directory-structure","161"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/errors",component:p("/docs/0.5.0/basics/errors","393"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/events",component:p("/docs/0.5.0/basics/events","056"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/flipper-internals",component:p("/docs/0.5.0/basics/flipper-internals","93e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/modules",component:p("/docs/0.5.0/basics/modules","eae"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/native-token",component:p("/docs/0.5.0/basics/native-token","186"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/odra-toml",component:p("/docs/0.5.0/basics/odra-toml","1c3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/storage-interaction",component:p("/docs/0.5.0/basics/storage-interaction","14c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/basics/testing",component:p("/docs/0.5.0/basics/testing","3e5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/category/advanced",component:p("/docs/0.5.0/category/advanced","d06"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/category/backends",component:p("/docs/0.5.0/category/backends","c3c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/category/basics",component:p("/docs/0.5.0/category/basics","8c1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/category/examples",component:p("/docs/0.5.0/category/examples","170"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/category/getting-started",component:p("/docs/0.5.0/category/getting-started","4a6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/category/tutorials",component:p("/docs/0.5.0/category/tutorials","44a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/examples/odra-examples",component:p("/docs/0.5.0/examples/odra-examples","398"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/examples/using-odra-modules",component:p("/docs/0.5.0/examples/using-odra-modules","2bf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/getting-started/flipper",component:p("/docs/0.5.0/getting-started/flipper","a09"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/getting-started/installation",component:p("/docs/0.5.0/getting-started/installation","6a7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/tutorials/erc20",component:p("/docs/0.5.0/tutorials/erc20","277"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/tutorials/ownable",component:p("/docs/0.5.0/tutorials/ownable","681"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.5.0/tutorials/owned-token",component:p("/docs/0.5.0/tutorials/owned-token","217"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.6.0",component:p("/docs/0.6.0","07e"),routes:[{path:"/docs/0.6.0/",component:p("/docs/0.6.0/","6cb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/advanced/advanced-storage",component:p("/docs/0.6.0/advanced/advanced-storage","e45"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/advanced/attributes",component:p("/docs/0.6.0/advanced/attributes","30c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/advanced/delegate",component:p("/docs/0.6.0/advanced/delegate","9cd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/advanced/signatures",component:p("/docs/0.6.0/advanced/signatures","ade"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/advanced/using",component:p("/docs/0.6.0/advanced/using","623"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/backends/casper",component:p("/docs/0.6.0/backends/casper","ffb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/backends/mock-vm",component:p("/docs/0.6.0/backends/mock-vm","936"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/backends/what-is-a-backend",component:p("/docs/0.6.0/backends/what-is-a-backend","cad"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/cargo-odra",component:p("/docs/0.6.0/basics/cargo-odra","6a0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/communicating-with-host",component:p("/docs/0.6.0/basics/communicating-with-host","704"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/cross-calls",component:p("/docs/0.6.0/basics/cross-calls","4a3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/directory-structure",component:p("/docs/0.6.0/basics/directory-structure","adb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/errors",component:p("/docs/0.6.0/basics/errors","5af"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/events",component:p("/docs/0.6.0/basics/events","77a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/flipper-internals",component:p("/docs/0.6.0/basics/flipper-internals","b3c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/modules",component:p("/docs/0.6.0/basics/modules","e0c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/native-token",component:p("/docs/0.6.0/basics/native-token","089"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/odra-toml",component:p("/docs/0.6.0/basics/odra-toml","142"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/storage-interaction",component:p("/docs/0.6.0/basics/storage-interaction","568"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/basics/testing",component:p("/docs/0.6.0/basics/testing","4f2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/category/advanced",component:p("/docs/0.6.0/category/advanced","b04"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/category/backends",component:p("/docs/0.6.0/category/backends","567"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/category/basics",component:p("/docs/0.6.0/category/basics","7b9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/category/examples",component:p("/docs/0.6.0/category/examples","933"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/category/getting-started",component:p("/docs/0.6.0/category/getting-started","d6e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/category/tutorials",component:p("/docs/0.6.0/category/tutorials","565"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/examples/odra-examples",component:p("/docs/0.6.0/examples/odra-examples","297"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/examples/using-odra-modules",component:p("/docs/0.6.0/examples/using-odra-modules","b91"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/getting-started/flipper",component:p("/docs/0.6.0/getting-started/flipper","41a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/getting-started/installation",component:p("/docs/0.6.0/getting-started/installation","f64"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/tutorials/erc20",component:p("/docs/0.6.0/tutorials/erc20","9af"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/tutorials/ownable",component:p("/docs/0.6.0/tutorials/ownable","f5c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.6.0/tutorials/owned-token",component:p("/docs/0.6.0/tutorials/owned-token","900"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.7.0",component:p("/docs/0.7.0","bd2"),routes:[{path:"/docs/0.7.0/",component:p("/docs/0.7.0/","753"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/advanced/advanced-storage",component:p("/docs/0.7.0/advanced/advanced-storage","39b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/advanced/attributes",component:p("/docs/0.7.0/advanced/attributes","5a8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/advanced/delegate",component:p("/docs/0.7.0/advanced/delegate","1ae"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/advanced/signatures",component:p("/docs/0.7.0/advanced/signatures","042"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/advanced/using",component:p("/docs/0.7.0/advanced/using","a15"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/backends/casper",component:p("/docs/0.7.0/backends/casper","967"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/backends/mock-vm",component:p("/docs/0.7.0/backends/mock-vm","2e1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/backends/what-is-a-backend",component:p("/docs/0.7.0/backends/what-is-a-backend","0a9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/cargo-odra",component:p("/docs/0.7.0/basics/cargo-odra","953"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/communicating-with-host",component:p("/docs/0.7.0/basics/communicating-with-host","a8b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/cross-calls",component:p("/docs/0.7.0/basics/cross-calls","4f0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/directory-structure",component:p("/docs/0.7.0/basics/directory-structure","25e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/errors",component:p("/docs/0.7.0/basics/errors","787"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/events",component:p("/docs/0.7.0/basics/events","151"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/flipper-internals",component:p("/docs/0.7.0/basics/flipper-internals","5ab"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/modules",component:p("/docs/0.7.0/basics/modules","21a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/native-token",component:p("/docs/0.7.0/basics/native-token","10a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/odra-toml",component:p("/docs/0.7.0/basics/odra-toml","c05"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/storage-interaction",component:p("/docs/0.7.0/basics/storage-interaction","617"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/basics/testing",component:p("/docs/0.7.0/basics/testing","0fd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/category/advanced",component:p("/docs/0.7.0/category/advanced","277"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/category/backends",component:p("/docs/0.7.0/category/backends","86f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/category/basics",component:p("/docs/0.7.0/category/basics","f96"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/category/examples",component:p("/docs/0.7.0/category/examples","bdd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/category/getting-started",component:p("/docs/0.7.0/category/getting-started","e9f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/category/tutorials",component:p("/docs/0.7.0/category/tutorials","17e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/examples/odra-examples",component:p("/docs/0.7.0/examples/odra-examples","3c9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/examples/using-odra-modules",component:p("/docs/0.7.0/examples/using-odra-modules","94e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/getting-started/flipper",component:p("/docs/0.7.0/getting-started/flipper","06e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/getting-started/installation",component:p("/docs/0.7.0/getting-started/installation","628"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/tutorials/access-control",component:p("/docs/0.7.0/tutorials/access-control","6e8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/tutorials/erc20",component:p("/docs/0.7.0/tutorials/erc20","e2f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/tutorials/ownable",component:p("/docs/0.7.0/tutorials/ownable","d9d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/tutorials/owned-token",component:p("/docs/0.7.0/tutorials/owned-token","17e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.7.0/tutorials/pauseable",component:p("/docs/0.7.0/tutorials/pauseable","c4a"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.8.0",component:p("/docs/0.8.0","813"),routes:[{path:"/docs/0.8.0/",component:p("/docs/0.8.0/","0f7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/advanced/advanced-storage",component:p("/docs/0.8.0/advanced/advanced-storage","795"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/advanced/attributes",component:p("/docs/0.8.0/advanced/attributes","196"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/advanced/delegate",component:p("/docs/0.8.0/advanced/delegate","2eb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/advanced/storage-layout",component:p("/docs/0.8.0/advanced/storage-layout","800"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/backends/casper",component:p("/docs/0.8.0/backends/casper","f72"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/backends/livenet",component:p("/docs/0.8.0/backends/livenet","90a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/backends/odra-vm",component:p("/docs/0.8.0/backends/odra-vm","df7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/backends/what-is-a-backend",component:p("/docs/0.8.0/backends/what-is-a-backend","201"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/cargo-odra",component:p("/docs/0.8.0/basics/cargo-odra","1f9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/communicating-with-host",component:p("/docs/0.8.0/basics/communicating-with-host","c1b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/cross-calls",component:p("/docs/0.8.0/basics/cross-calls","08c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/directory-structure",component:p("/docs/0.8.0/basics/directory-structure","9f5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/errors",component:p("/docs/0.8.0/basics/errors","931"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/events",component:p("/docs/0.8.0/basics/events","9f3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/flipper-internals",component:p("/docs/0.8.0/basics/flipper-internals","e4d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/modules",component:p("/docs/0.8.0/basics/modules","952"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/native-token",component:p("/docs/0.8.0/basics/native-token","068"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/odra-toml",component:p("/docs/0.8.0/basics/odra-toml","76e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/storage-interaction",component:p("/docs/0.8.0/basics/storage-interaction","fc2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/basics/testing",component:p("/docs/0.8.0/basics/testing","45b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/category/advanced",component:p("/docs/0.8.0/category/advanced","f7a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/category/backends",component:p("/docs/0.8.0/category/backends","ef8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/category/basics",component:p("/docs/0.8.0/category/basics","a8b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/category/examples",component:p("/docs/0.8.0/category/examples","353"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/category/getting-started",component:p("/docs/0.8.0/category/getting-started","b5b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/category/migrations",component:p("/docs/0.8.0/category/migrations","45a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/category/tutorials",component:p("/docs/0.8.0/category/tutorials","30b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/examples/odra-examples",component:p("/docs/0.8.0/examples/odra-examples","4de"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/examples/using-odra-modules",component:p("/docs/0.8.0/examples/using-odra-modules","b4d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/getting-started/flipper",component:p("/docs/0.8.0/getting-started/flipper","d0e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/getting-started/installation",component:p("/docs/0.8.0/getting-started/installation","58d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/migrations/to-0.8.0",component:p("/docs/0.8.0/migrations/to-0.8.0","0e2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/tutorials/access-control",component:p("/docs/0.8.0/tutorials/access-control","2a5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/tutorials/build-deploy-read",component:p("/docs/0.8.0/tutorials/build-deploy-read","22e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/tutorials/erc20",component:p("/docs/0.8.0/tutorials/erc20","df9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/tutorials/ownable",component:p("/docs/0.8.0/tutorials/ownable","27d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/tutorials/owned-token",component:p("/docs/0.8.0/tutorials/owned-token","df9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.0/tutorials/pauseable",component:p("/docs/0.8.0/tutorials/pauseable","410"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.8.1",component:p("/docs/0.8.1","2ae"),routes:[{path:"/docs/0.8.1/",component:p("/docs/0.8.1/","4ac"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/advanced/advanced-storage",component:p("/docs/0.8.1/advanced/advanced-storage","85a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/advanced/attributes",component:p("/docs/0.8.1/advanced/attributes","481"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/advanced/building-manually",component:p("/docs/0.8.1/advanced/building-manually","8ad"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/advanced/delegate",component:p("/docs/0.8.1/advanced/delegate","1e0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/advanced/storage-layout",component:p("/docs/0.8.1/advanced/storage-layout","d7d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/advanced/using-different-allocator",component:p("/docs/0.8.1/advanced/using-different-allocator","c91"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/backends/casper",component:p("/docs/0.8.1/backends/casper","3bb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/backends/livenet",component:p("/docs/0.8.1/backends/livenet","ec6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/backends/odra-vm",component:p("/docs/0.8.1/backends/odra-vm","b57"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/backends/what-is-a-backend",component:p("/docs/0.8.1/backends/what-is-a-backend","ef2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/cargo-odra",component:p("/docs/0.8.1/basics/cargo-odra","5c3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/communicating-with-host",component:p("/docs/0.8.1/basics/communicating-with-host","171"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/cross-calls",component:p("/docs/0.8.1/basics/cross-calls","cfe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/directory-structure",component:p("/docs/0.8.1/basics/directory-structure","d78"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/errors",component:p("/docs/0.8.1/basics/errors","274"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/events",component:p("/docs/0.8.1/basics/events","fba"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/flipper-internals",component:p("/docs/0.8.1/basics/flipper-internals","f00"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/modules",component:p("/docs/0.8.1/basics/modules","26b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/native-token",component:p("/docs/0.8.1/basics/native-token","797"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/odra-toml",component:p("/docs/0.8.1/basics/odra-toml","1e7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/storage-interaction",component:p("/docs/0.8.1/basics/storage-interaction","7d6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/basics/testing",component:p("/docs/0.8.1/basics/testing","4d7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/category/advanced",component:p("/docs/0.8.1/category/advanced","7e6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/category/backends",component:p("/docs/0.8.1/category/backends","2b5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/category/basics",component:p("/docs/0.8.1/category/basics","3be"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/category/examples",component:p("/docs/0.8.1/category/examples","dca"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/category/getting-started",component:p("/docs/0.8.1/category/getting-started","dd6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/category/migrations",component:p("/docs/0.8.1/category/migrations","e93"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/category/tutorials",component:p("/docs/0.8.1/category/tutorials","56d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/examples/odra-examples",component:p("/docs/0.8.1/examples/odra-examples","099"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/examples/using-odra-modules",component:p("/docs/0.8.1/examples/using-odra-modules","f30"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/getting-started/flipper",component:p("/docs/0.8.1/getting-started/flipper","449"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/getting-started/installation",component:p("/docs/0.8.1/getting-started/installation","0e3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/migrations/to-0.8.0",component:p("/docs/0.8.1/migrations/to-0.8.0","fb6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/tutorials/access-control",component:p("/docs/0.8.1/tutorials/access-control","fa5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/tutorials/build-deploy-read",component:p("/docs/0.8.1/tutorials/build-deploy-read","b1d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/tutorials/erc20",component:p("/docs/0.8.1/tutorials/erc20","282"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/tutorials/ownable",component:p("/docs/0.8.1/tutorials/ownable","e3d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/tutorials/owned-token",component:p("/docs/0.8.1/tutorials/owned-token","a42"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.8.1/tutorials/pauseable",component:p("/docs/0.8.1/tutorials/pauseable","bb1"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.9.0",component:p("/docs/0.9.0","bab"),routes:[{path:"/docs/0.9.0/",component:p("/docs/0.9.0/","837"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/advanced/advanced-storage",component:p("/docs/0.9.0/advanced/advanced-storage","694"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/advanced/attributes",component:p("/docs/0.9.0/advanced/attributes","8be"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/advanced/building-manually",component:p("/docs/0.9.0/advanced/building-manually","ebe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/advanced/delegate",component:p("/docs/0.9.0/advanced/delegate","b68"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/advanced/storage-layout",component:p("/docs/0.9.0/advanced/storage-layout","d3a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/advanced/using-different-allocator",component:p("/docs/0.9.0/advanced/using-different-allocator","5bf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/backends/casper",component:p("/docs/0.9.0/backends/casper","324"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/backends/livenet",component:p("/docs/0.9.0/backends/livenet","86e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/backends/odra-vm",component:p("/docs/0.9.0/backends/odra-vm","063"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/backends/what-is-a-backend",component:p("/docs/0.9.0/backends/what-is-a-backend","f05"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/cargo-odra",component:p("/docs/0.9.0/basics/cargo-odra","8f2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/casper-contract-schema",component:p("/docs/0.9.0/basics/casper-contract-schema","e38"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/communicating-with-host",component:p("/docs/0.9.0/basics/communicating-with-host","a21"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/cross-calls",component:p("/docs/0.9.0/basics/cross-calls","064"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/directory-structure",component:p("/docs/0.9.0/basics/directory-structure","bd7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/errors",component:p("/docs/0.9.0/basics/errors","667"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/events",component:p("/docs/0.9.0/basics/events","15a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/flipper-internals",component:p("/docs/0.9.0/basics/flipper-internals","49f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/modules",component:p("/docs/0.9.0/basics/modules","40c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/native-token",component:p("/docs/0.9.0/basics/native-token","e8c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/odra-toml",component:p("/docs/0.9.0/basics/odra-toml","b36"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/storage-interaction",component:p("/docs/0.9.0/basics/storage-interaction","3c6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/basics/testing",component:p("/docs/0.9.0/basics/testing","fb7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/category/advanced",component:p("/docs/0.9.0/category/advanced","0bf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/category/backends",component:p("/docs/0.9.0/category/backends","5fc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/category/basics",component:p("/docs/0.9.0/category/basics","755"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/category/examples",component:p("/docs/0.9.0/category/examples","3b9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/category/getting-started",component:p("/docs/0.9.0/category/getting-started","ea3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/category/migrations",component:p("/docs/0.9.0/category/migrations","84b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/category/tutorials",component:p("/docs/0.9.0/category/tutorials","8fd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/examples/odra-examples",component:p("/docs/0.9.0/examples/odra-examples","97a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/examples/using-odra-modules",component:p("/docs/0.9.0/examples/using-odra-modules","ce1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/getting-started/flipper",component:p("/docs/0.9.0/getting-started/flipper","586"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/getting-started/installation",component:p("/docs/0.9.0/getting-started/installation","a46"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/migrations/to-0.8.0",component:p("/docs/0.9.0/migrations/to-0.8.0","087"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/migrations/to-0.9.0",component:p("/docs/0.9.0/migrations/to-0.9.0","0d0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/tutorials/access-control",component:p("/docs/0.9.0/tutorials/access-control","8fb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/tutorials/build-deploy-read",component:p("/docs/0.9.0/tutorials/build-deploy-read","862"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/tutorials/erc20",component:p("/docs/0.9.0/tutorials/erc20","504"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/tutorials/ownable",component:p("/docs/0.9.0/tutorials/ownable","7a6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/tutorials/owned-token",component:p("/docs/0.9.0/tutorials/owned-token","404"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.0/tutorials/pauseable",component:p("/docs/0.9.0/tutorials/pauseable","1d2"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/0.9.1",component:p("/docs/0.9.1","8f7"),routes:[{path:"/docs/0.9.1/",component:p("/docs/0.9.1/","855"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/advanced/advanced-storage",component:p("/docs/0.9.1/advanced/advanced-storage","28f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/advanced/attributes",component:p("/docs/0.9.1/advanced/attributes","d5a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/advanced/building-manually",component:p("/docs/0.9.1/advanced/building-manually","7d2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/advanced/delegate",component:p("/docs/0.9.1/advanced/delegate","582"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/advanced/storage-layout",component:p("/docs/0.9.1/advanced/storage-layout","365"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/advanced/using-different-allocator",component:p("/docs/0.9.1/advanced/using-different-allocator","76c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/backends/casper",component:p("/docs/0.9.1/backends/casper","78e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/backends/livenet",component:p("/docs/0.9.1/backends/livenet","45c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/backends/odra-vm",component:p("/docs/0.9.1/backends/odra-vm","a2f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/backends/what-is-a-backend",component:p("/docs/0.9.1/backends/what-is-a-backend","c98"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/cargo-odra",component:p("/docs/0.9.1/basics/cargo-odra","83f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/casper-contract-schema",component:p("/docs/0.9.1/basics/casper-contract-schema","8c3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/communicating-with-host",component:p("/docs/0.9.1/basics/communicating-with-host","cfd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/cross-calls",component:p("/docs/0.9.1/basics/cross-calls","0b2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/directory-structure",component:p("/docs/0.9.1/basics/directory-structure","ae1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/errors",component:p("/docs/0.9.1/basics/errors","d39"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/events",component:p("/docs/0.9.1/basics/events","6a4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/flipper-internals",component:p("/docs/0.9.1/basics/flipper-internals","97d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/modules",component:p("/docs/0.9.1/basics/modules","63d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/native-token",component:p("/docs/0.9.1/basics/native-token","30a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/odra-toml",component:p("/docs/0.9.1/basics/odra-toml","619"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/storage-interaction",component:p("/docs/0.9.1/basics/storage-interaction","b73"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/basics/testing",component:p("/docs/0.9.1/basics/testing","fab"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/category/advanced",component:p("/docs/0.9.1/category/advanced","708"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/category/backends",component:p("/docs/0.9.1/category/backends","82e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/category/basics",component:p("/docs/0.9.1/category/basics","7db"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/category/examples",component:p("/docs/0.9.1/category/examples","a93"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/category/getting-started",component:p("/docs/0.9.1/category/getting-started","c74"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/category/migrations",component:p("/docs/0.9.1/category/migrations","bc5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/category/tutorials",component:p("/docs/0.9.1/category/tutorials","cc1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/examples/odra-examples",component:p("/docs/0.9.1/examples/odra-examples","b3e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/examples/using-odra-modules",component:p("/docs/0.9.1/examples/using-odra-modules","3ad"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/getting-started/flipper",component:p("/docs/0.9.1/getting-started/flipper","d9c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/getting-started/installation",component:p("/docs/0.9.1/getting-started/installation","05d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/migrations/to-0.8.0",component:p("/docs/0.9.1/migrations/to-0.8.0","e9a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/migrations/to-0.9.0",component:p("/docs/0.9.1/migrations/to-0.9.0","704"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/tutorials/access-control",component:p("/docs/0.9.1/tutorials/access-control","06d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/tutorials/build-deploy-read",component:p("/docs/0.9.1/tutorials/build-deploy-read","6bf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/tutorials/erc20",component:p("/docs/0.9.1/tutorials/erc20","881"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/tutorials/ownable",component:p("/docs/0.9.1/tutorials/ownable","be2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/tutorials/owned-token",component:p("/docs/0.9.1/tutorials/owned-token","cf0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/tutorials/pauseable",component:p("/docs/0.9.1/tutorials/pauseable","30e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/0.9.1/tutorials/using-proxy-caller",component:p("/docs/0.9.1/tutorials/using-proxy-caller","537"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs/next",component:p("/docs/next","0ec"),routes:[{path:"/docs/next/",component:p("/docs/next/","a05"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/advanced/advanced-storage",component:p("/docs/next/advanced/advanced-storage","bb5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/advanced/attributes",component:p("/docs/next/advanced/attributes","372"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/advanced/building-manually",component:p("/docs/next/advanced/building-manually","232"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/advanced/delegate",component:p("/docs/next/advanced/delegate","b46"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/advanced/storage-layout",component:p("/docs/next/advanced/storage-layout","152"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/advanced/using-different-allocator",component:p("/docs/next/advanced/using-different-allocator","a0d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/backends/casper",component:p("/docs/next/backends/casper","823"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/backends/livenet",component:p("/docs/next/backends/livenet","2f8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/backends/odra-vm",component:p("/docs/next/backends/odra-vm","a9b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/backends/what-is-a-backend",component:p("/docs/next/backends/what-is-a-backend","c4c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/cargo-odra",component:p("/docs/next/basics/cargo-odra","5d3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/casper-contract-schema",component:p("/docs/next/basics/casper-contract-schema","683"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/communicating-with-host",component:p("/docs/next/basics/communicating-with-host","8bf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/cross-calls",component:p("/docs/next/basics/cross-calls","f0e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/directory-structure",component:p("/docs/next/basics/directory-structure","cf2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/errors",component:p("/docs/next/basics/errors","b56"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/events",component:p("/docs/next/basics/events","d09"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/flipper-internals",component:p("/docs/next/basics/flipper-internals","136"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/modules",component:p("/docs/next/basics/modules","d67"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/native-token",component:p("/docs/next/basics/native-token","a1b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/odra-toml",component:p("/docs/next/basics/odra-toml","efe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/storage-interaction",component:p("/docs/next/basics/storage-interaction","ca7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/basics/testing",component:p("/docs/next/basics/testing","95b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/category/advanced",component:p("/docs/next/category/advanced","655"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/category/backends",component:p("/docs/next/category/backends","b10"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/category/basics",component:p("/docs/next/category/basics","48a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/category/examples",component:p("/docs/next/category/examples","caa"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/category/getting-started",component:p("/docs/next/category/getting-started","345"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/category/migrations",component:p("/docs/next/category/migrations","fa2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/category/tutorials",component:p("/docs/next/category/tutorials","fad"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/examples/odra-examples",component:p("/docs/next/examples/odra-examples","3a4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/examples/using-odra-modules",component:p("/docs/next/examples/using-odra-modules","a73"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/getting-started/flipper",component:p("/docs/next/getting-started/flipper","9d2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/getting-started/installation",component:p("/docs/next/getting-started/installation","89e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/migrations/to-0.8.0",component:p("/docs/next/migrations/to-0.8.0","118"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/migrations/to-0.9.0",component:p("/docs/next/migrations/to-0.9.0","311"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/access-control",component:p("/docs/next/tutorials/access-control","182"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/build-deploy-read",component:p("/docs/next/tutorials/build-deploy-read","886"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/cep18",component:p("/docs/next/tutorials/cep18","3bb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/deploying-on-casper",component:p("/docs/next/tutorials/deploying-on-casper","17d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/erc20",component:p("/docs/next/tutorials/erc20","0c8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/nft",component:p("/docs/next/tutorials/nft","1f8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/odra-solidity",component:p("/docs/next/tutorials/odra-solidity","761"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/ownable",component:p("/docs/next/tutorials/ownable","aac"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/owned-token",component:p("/docs/next/tutorials/owned-token","6be"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/pauseable",component:p("/docs/next/tutorials/pauseable","6ca"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/next/tutorials/using-proxy-caller",component:p("/docs/next/tutorials/using-proxy-caller","472"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/docs",component:p("/docs","63d"),routes:[{path:"/docs/",component:p("/docs/","264"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/advanced-storage",component:p("/docs/advanced/advanced-storage","0bf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/attributes",component:p("/docs/advanced/attributes","7f6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/building-manually",component:p("/docs/advanced/building-manually","fdc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/delegate",component:p("/docs/advanced/delegate","420"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/storage-layout",component:p("/docs/advanced/storage-layout","5a3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/using-different-allocator",component:p("/docs/advanced/using-different-allocator","999"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/backends/casper",component:p("/docs/backends/casper","5cf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/backends/livenet",component:p("/docs/backends/livenet","3bf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/backends/odra-vm",component:p("/docs/backends/odra-vm","b63"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/backends/what-is-a-backend",component:p("/docs/backends/what-is-a-backend","3f8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/cargo-odra",component:p("/docs/basics/cargo-odra","800"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/casper-contract-schema",component:p("/docs/basics/casper-contract-schema","d22"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/communicating-with-host",component:p("/docs/basics/communicating-with-host","0b1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/cross-calls",component:p("/docs/basics/cross-calls","f38"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/directory-structure",component:p("/docs/basics/directory-structure","5c2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/errors",component:p("/docs/basics/errors","b77"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/events",component:p("/docs/basics/events","cc6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/flipper-internals",component:p("/docs/basics/flipper-internals","a88"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/modules",component:p("/docs/basics/modules","688"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/native-token",component:p("/docs/basics/native-token","f42"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/odra-toml",component:p("/docs/basics/odra-toml","a62"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/storage-interaction",component:p("/docs/basics/storage-interaction","f52"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basics/testing",component:p("/docs/basics/testing","222"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/category/advanced",component:p("/docs/category/advanced","7b4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/category/backends",component:p("/docs/category/backends","744"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/category/basics",component:p("/docs/category/basics","dd3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/category/examples",component:p("/docs/category/examples","fe3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/category/getting-started",component:p("/docs/category/getting-started","01f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/category/migrations",component:p("/docs/category/migrations","86a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/category/tutorials",component:p("/docs/category/tutorials","f40"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/examples/odra-examples",component:p("/docs/examples/odra-examples","08c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/examples/using-odra-modules",component:p("/docs/examples/using-odra-modules","5ca"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/getting-started/flipper",component:p("/docs/getting-started/flipper","90e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/getting-started/installation",component:p("/docs/getting-started/installation","96c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/migrations/to-0.8.0",component:p("/docs/migrations/to-0.8.0","170"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/migrations/to-0.9.0",component:p("/docs/migrations/to-0.9.0","b45"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/access-control",component:p("/docs/tutorials/access-control","b88"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/build-deploy-read",component:p("/docs/tutorials/build-deploy-read","72d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/cep18",component:p("/docs/tutorials/cep18","dba"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/deploying-on-casper",component:p("/docs/tutorials/deploying-on-casper","acc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/erc20",component:p("/docs/tutorials/erc20","99f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/nft",component:p("/docs/tutorials/nft","041"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/odra-solidity",component:p("/docs/tutorials/odra-solidity","54e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/ownable",component:p("/docs/tutorials/ownable","50d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/owned-token",component:p("/docs/tutorials/owned-token","63b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/pauseable",component:p("/docs/tutorials/pauseable","711"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/tutorials/using-proxy-caller",component:p("/docs/tutorials/using-proxy-caller","a75"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/",component:p("/","780"),exact:!0},{path:"*",component:p("*")}]},98934:(e,t,a)=>{"use strict";a.d(t,{_:()=>r,t:()=>o});var n=a(67294);const r=n.createContext(!1);function o(e){let{children:t}=e;const[a,o]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{o(!0)}),[]),n.createElement(r.Provider,{value:a},t)}},49383:(e,t,a)=>{"use strict";var n=a(67294),r=a(73935),o=a(73727),s=a(70405),i=a(10412);const c=[a(32497),a(3310),a(18320),a(52295)];var d=a(723),l=a(16550),u=a(18790);function p(e){let{children:t}=e;return n.createElement(n.Fragment,null,t)}var b=a(87462),f=a(35742),m=a(52263),g=a(44996),h=a(86668),v=a(1944),y=a(94711),_=a(19727),S=a(43320),x=a(90197);function k(){const{i18n:{defaultLocale:e,localeConfigs:t}}=(0,m.Z)(),a=(0,y.l)();return n.createElement(f.Z,null,Object.entries(t).map((e=>{let[t,{htmlLang:r}]=e;return n.createElement("link",{key:t,rel:"alternate",href:a.createUrl({locale:t,fullyQualified:!0}),hrefLang:r})})),n.createElement("link",{rel:"alternate",href:a.createUrl({locale:e,fullyQualified:!0}),hrefLang:"x-default"}))}function w(e){let{permalink:t}=e;const{siteConfig:{url:a}}=(0,m.Z)(),r=function(){const{siteConfig:{url:e}}=(0,m.Z)(),{pathname:t}=(0,l.TH)();return e+(0,g.Z)(t)}(),o=t?`${a}${t}`:r;return n.createElement(f.Z,null,n.createElement("meta",{property:"og:url",content:o}),n.createElement("link",{rel:"canonical",href:o}))}function E(){const{i18n:{currentLocale:e}}=(0,m.Z)(),{metadata:t,image:a}=(0,h.L)();return n.createElement(n.Fragment,null,n.createElement(f.Z,null,n.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),n.createElement("body",{className:_.h})),a&&n.createElement(v.d,{image:a}),n.createElement(w,null),n.createElement(k,null),n.createElement(x.Z,{tag:S.HX,locale:e}),n.createElement(f.Z,null,t.map(((e,t)=>n.createElement("meta",(0,b.Z)({key:t},e))))))}const C=new Map;function T(e){if(C.has(e.pathname))return{...e,pathname:C.get(e.pathname)};if((0,u.f)(d.Z,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return C.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return C.set(e.pathname,t),{...e,pathname:t}}var I=a(98934),N=a(58940);function A(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];const r=c.map((t=>(t.default?.[e]??t[e])?.(...a)));return()=>r.forEach((e=>e?.()))}const L=function(e){let{children:t,location:a,previousLocation:r}=e;return(0,n.useLayoutEffect)((()=>{r!==a&&(!function(e){let{location:t,previousLocation:a}=e;if(!a)return;const n=t.pathname===a.pathname,r=t.hash===a.hash,o=t.search===a.search;if(n&&r&&!o)return;const{hash:s}=t;if(s){const e=decodeURIComponent(s.substring(1));document.getElementById(e)?.scrollIntoView()}else window.scrollTo(0,0)}({location:a,previousLocation:r}),A("onRouteDidUpdate",{previousLocation:r,location:a}))}),[r,a]),t};function O(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,u.f)(d.Z,e))).flat();return Promise.all(t.map((e=>e.route.component.preload?.())))}class P extends n.Component{constructor(e){super(e),this.previousLocation=void 0,this.routeUpdateCleanupCb=void 0,this.previousLocation=null,this.routeUpdateCleanupCb=i.Z.canUseDOM?A("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const a=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=A("onRouteUpdate",{previousLocation:this.previousLocation,location:a}),O(a.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return n.createElement(L,{previousLocation:this.previousLocation,location:t},n.createElement(l.AW,{location:t,render:()=>e}))}}const R=P,M="docusaurus-base-url-issue-banner-container",D="docusaurus-base-url-issue-banner-suggestion-container",F="__DOCUSAURUS_INSERT_BASEURL_BANNER";function j(e){return`\nwindow['${F}'] = true;\n\ndocument.addEventListener('DOMContentLoaded', maybeInsertBanner);\n\nfunction maybeInsertBanner() {\n var shouldInsert = window['${F}'];\n shouldInsert && insertBanner();\n}\n\nfunction insertBanner() {\n var bannerContainer = document.getElementById('${M}');\n if (!bannerContainer) {\n return;\n }\n var bannerHtml = ${JSON.stringify(function(e){return`\n<div id="docusaurus-base-url-issue-banner" style="border: thick solid red; background-color: rgb(255, 230, 179); margin: 20px; padding: 20px; font-size: 20px;">\n <p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>\n <p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseurl" style="font-weight: bold;">baseUrl configuration</a>.</p>\n <p>Current configured baseUrl = <span style="font-weight: bold; color: red;">${e}</span> ${"/"===e?" (default value)":""}</p>\n <p>We suggest trying baseUrl = <span id="${D}" style="font-weight: bold; color: green;"></span></p>\n</div>\n`}(e)).replace(/</g,"\\<")};\n bannerContainer.innerHTML = bannerHtml;\n var suggestionContainer = document.getElementById('${D}');\n var actualHomePagePath = window.location.pathname;\n var suggestedBaseUrl = actualHomePagePath.substr(-1) === '/'\n ? actualHomePagePath\n : actualHomePagePath + '/';\n suggestionContainer.innerHTML = suggestedBaseUrl;\n}\n`}function B(){const{siteConfig:{baseUrl:e}}=(0,m.Z)();return(0,n.useLayoutEffect)((()=>{window[F]=!1}),[]),n.createElement(n.Fragment,null,!i.Z.canUseDOM&&n.createElement(f.Z,null,n.createElement("script",null,j(e))),n.createElement("div",{id:M}))}function z(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,m.Z)(),{pathname:a}=(0,l.TH)();return t&&a===e?n.createElement(B,null):null}function $(){const{siteConfig:{favicon:e,title:t,noIndex:a},i18n:{currentLocale:r,localeConfigs:o}}=(0,m.Z)(),s=(0,g.Z)(e),{htmlLang:i,direction:c}=o[r];return n.createElement(f.Z,null,n.createElement("html",{lang:i,dir:c}),n.createElement("title",null,t),n.createElement("meta",{property:"og:title",content:t}),n.createElement("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),a&&n.createElement("meta",{name:"robots",content:"noindex, nofollow"}),e&&n.createElement("link",{rel:"icon",href:s}))}var U=a(44763);function Z(){const e=(0,u.H)(d.Z),t=(0,l.TH)();return n.createElement(U.Z,null,n.createElement(N.M,null,n.createElement(I.t,null,n.createElement(p,null,n.createElement($,null),n.createElement(E,null),n.createElement(z,null),n.createElement(R,{location:T(t)},e)))))}var G=a(16887);const H=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,a)=>{if("undefined"==typeof document)return void a();const n=document.createElement("link");n.setAttribute("rel","prefetch"),n.setAttribute("href",e),n.onload=()=>t(),n.onerror=()=>a();(document.getElementsByTagName("head")[0]??document.getElementsByName("script")[0]?.parentNode)?.appendChild(n)}))}:function(e){return new Promise(((t,a)=>{const n=new XMLHttpRequest;n.open("GET",e,!0),n.withCredentials=!0,n.onload=()=>{200===n.status?t():a()},n.send(null)}))};var V=a(99670);const W=new Set,q=new Set,Y=()=>navigator.connection?.effectiveType.includes("2g")||navigator.connection?.saveData,K={prefetch(e){if(!(e=>!Y()&&!q.has(e)&&!W.has(e))(e))return!1;W.add(e);const t=(0,u.f)(d.Z,e).flatMap((e=>{return t=e.route.path,Object.entries(G).filter((e=>{let[a]=e;return a.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,V.Z)(t))}));var t}));return Promise.all(t.map((e=>{const t=a.gca(e);return t&&!t.includes("undefined")?H(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!Y()&&!q.has(e))(e)&&(q.add(e),O(e))},X=Object.freeze(K);if(i.Z.canUseDOM){window.docusaurus=X;const e=r.hydrate;O(window.location.pathname).then((()=>{e(n.createElement(s.B6,null,n.createElement(o.VK,null,n.createElement(Z,null))),document.getElementById("__docusaurus"))}))}},58940:(e,t,a)=>{"use strict";a.d(t,{_:()=>l,M:()=>u});var n=a(67294),r=a(36809);const o=JSON.parse('{"docusaurus-lunr-search":{"default":{"fileNames":{"searchDoc":"search-doc-1718616732280.json","lunrIndex":"lunr-index-1718616732280.json"}}},"docusaurus-plugin-content-docs":{"default":{"path":"/docs","versions":[{"name":"current","label":"next","isLast":false,"path":"/docs/next","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/next/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/next/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/building-manually","path":"/docs/next/advanced/building-manually","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/next/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/storage-layout","path":"/docs/next/advanced/storage-layout","sidebar":"tutorialSidebar"},{"id":"advanced/using-different-allocator","path":"/docs/next/advanced/using-different-allocator","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/next/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/livenet","path":"/docs/next/backends/livenet","sidebar":"tutorialSidebar"},{"id":"backends/odra-vm","path":"/docs/next/backends/odra-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/next/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/next/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/casper-contract-schema","path":"/docs/next/basics/casper-contract-schema","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/next/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/next/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/next/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/next/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/next/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/next/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/next/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/next/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/next/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/next/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/next/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/next/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/next/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/next/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/next/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/next/","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.8.0","path":"/docs/next/migrations/to-0.8.0","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.9.0","path":"/docs/next/migrations/to-0.9.0","sidebar":"tutorialSidebar"},{"id":"tutorials/access-control","path":"/docs/next/tutorials/access-control","sidebar":"tutorialSidebar"},{"id":"tutorials/build-deploy-read","path":"/docs/next/tutorials/build-deploy-read","sidebar":"tutorialSidebar"},{"id":"tutorials/cep18","path":"/docs/next/tutorials/cep18","sidebar":"tutorialSidebar"},{"id":"tutorials/deploying-on-casper","path":"/docs/next/tutorials/deploying-on-casper","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/next/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/nft","path":"/docs/next/tutorials/nft","sidebar":"tutorialSidebar"},{"id":"tutorials/odra-sol","path":"/docs/next/tutorials/odra-solidity","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/next/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/next/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"tutorials/pauseable","path":"/docs/next/tutorials/pauseable","sidebar":"tutorialSidebar"},{"id":"tutorials/using-proxy-caller","path":"/docs/next/tutorials/using-proxy-caller","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/next/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/next/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/next/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/next/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/next/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/next/category/tutorials","sidebar":"tutorialSidebar"},{"id":"/category/migrations","path":"/docs/next/category/migrations","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/next/","label":"intro"}}}},{"name":"1.0.0","label":"1.0.0","isLast":true,"path":"/docs","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/building-manually","path":"/docs/advanced/building-manually","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/storage-layout","path":"/docs/advanced/storage-layout","sidebar":"tutorialSidebar"},{"id":"advanced/using-different-allocator","path":"/docs/advanced/using-different-allocator","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/livenet","path":"/docs/backends/livenet","sidebar":"tutorialSidebar"},{"id":"backends/odra-vm","path":"/docs/backends/odra-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/casper-contract-schema","path":"/docs/basics/casper-contract-schema","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.8.0","path":"/docs/migrations/to-0.8.0","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.9.0","path":"/docs/migrations/to-0.9.0","sidebar":"tutorialSidebar"},{"id":"tutorials/access-control","path":"/docs/tutorials/access-control","sidebar":"tutorialSidebar"},{"id":"tutorials/build-deploy-read","path":"/docs/tutorials/build-deploy-read","sidebar":"tutorialSidebar"},{"id":"tutorials/cep18","path":"/docs/tutorials/cep18","sidebar":"tutorialSidebar"},{"id":"tutorials/deploying-on-casper","path":"/docs/tutorials/deploying-on-casper","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/nft","path":"/docs/tutorials/nft","sidebar":"tutorialSidebar"},{"id":"tutorials/odra-sol","path":"/docs/tutorials/odra-solidity","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"tutorials/pauseable","path":"/docs/tutorials/pauseable","sidebar":"tutorialSidebar"},{"id":"tutorials/using-proxy-caller","path":"/docs/tutorials/using-proxy-caller","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/category/tutorials","sidebar":"tutorialSidebar"},{"id":"/category/migrations","path":"/docs/category/migrations","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/","label":"version-1.0.0/intro"}}}},{"name":"0.9.1","label":"0.9.1","isLast":false,"path":"/docs/0.9.1","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.9.1/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.9.1/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/building-manually","path":"/docs/0.9.1/advanced/building-manually","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.9.1/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/storage-layout","path":"/docs/0.9.1/advanced/storage-layout","sidebar":"tutorialSidebar"},{"id":"advanced/using-different-allocator","path":"/docs/0.9.1/advanced/using-different-allocator","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.9.1/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/livenet","path":"/docs/0.9.1/backends/livenet","sidebar":"tutorialSidebar"},{"id":"backends/odra-vm","path":"/docs/0.9.1/backends/odra-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.9.1/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.9.1/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/casper-contract-schema","path":"/docs/0.9.1/basics/casper-contract-schema","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.9.1/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.9.1/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.9.1/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.9.1/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.9.1/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.9.1/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.9.1/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.9.1/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.9.1/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.9.1/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.9.1/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.9.1/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.9.1/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.9.1/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.9.1/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.9.1/","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.8.0","path":"/docs/0.9.1/migrations/to-0.8.0","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.9.0","path":"/docs/0.9.1/migrations/to-0.9.0","sidebar":"tutorialSidebar"},{"id":"tutorials/access-control","path":"/docs/0.9.1/tutorials/access-control","sidebar":"tutorialSidebar"},{"id":"tutorials/build-deploy-read","path":"/docs/0.9.1/tutorials/build-deploy-read","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.9.1/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.9.1/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.9.1/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"tutorials/pauseable","path":"/docs/0.9.1/tutorials/pauseable","sidebar":"tutorialSidebar"},{"id":"tutorials/using-proxy-caller","path":"/docs/0.9.1/tutorials/using-proxy-caller","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.9.1/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.9.1/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.9.1/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.9.1/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.9.1/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.9.1/category/tutorials","sidebar":"tutorialSidebar"},{"id":"/category/migrations","path":"/docs/0.9.1/category/migrations","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.9.1/","label":"version-0.9.1/intro"}}}},{"name":"0.9.0","label":"0.9.0","isLast":false,"path":"/docs/0.9.0","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.9.0/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.9.0/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/building-manually","path":"/docs/0.9.0/advanced/building-manually","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.9.0/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/storage-layout","path":"/docs/0.9.0/advanced/storage-layout","sidebar":"tutorialSidebar"},{"id":"advanced/using-different-allocator","path":"/docs/0.9.0/advanced/using-different-allocator","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.9.0/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/livenet","path":"/docs/0.9.0/backends/livenet","sidebar":"tutorialSidebar"},{"id":"backends/odra-vm","path":"/docs/0.9.0/backends/odra-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.9.0/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.9.0/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/casper-contract-schema","path":"/docs/0.9.0/basics/casper-contract-schema","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.9.0/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.9.0/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.9.0/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.9.0/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.9.0/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.9.0/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.9.0/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.9.0/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.9.0/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.9.0/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.9.0/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.9.0/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.9.0/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.9.0/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.9.0/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.9.0/","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.8.0","path":"/docs/0.9.0/migrations/to-0.8.0","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.9.0","path":"/docs/0.9.0/migrations/to-0.9.0","sidebar":"tutorialSidebar"},{"id":"tutorials/access-control","path":"/docs/0.9.0/tutorials/access-control","sidebar":"tutorialSidebar"},{"id":"tutorials/build-deploy-read","path":"/docs/0.9.0/tutorials/build-deploy-read","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.9.0/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.9.0/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.9.0/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"tutorials/pauseable","path":"/docs/0.9.0/tutorials/pauseable","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.9.0/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.9.0/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.9.0/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.9.0/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.9.0/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.9.0/category/tutorials","sidebar":"tutorialSidebar"},{"id":"/category/migrations","path":"/docs/0.9.0/category/migrations","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.9.0/","label":"version-0.9.0/intro"}}}},{"name":"0.8.1","label":"0.8.1","isLast":false,"path":"/docs/0.8.1","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.8.1/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.8.1/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/building-manually","path":"/docs/0.8.1/advanced/building-manually","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.8.1/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/storage-layout","path":"/docs/0.8.1/advanced/storage-layout","sidebar":"tutorialSidebar"},{"id":"advanced/using-different-allocator","path":"/docs/0.8.1/advanced/using-different-allocator","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.8.1/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/livenet","path":"/docs/0.8.1/backends/livenet","sidebar":"tutorialSidebar"},{"id":"backends/odra-vm","path":"/docs/0.8.1/backends/odra-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.8.1/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.8.1/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.8.1/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.8.1/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.8.1/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.8.1/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.8.1/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.8.1/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.8.1/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.8.1/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.8.1/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.8.1/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.8.1/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.8.1/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.8.1/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.8.1/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.8.1/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.8.1/","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.8.0","path":"/docs/0.8.1/migrations/to-0.8.0","sidebar":"tutorialSidebar"},{"id":"tutorials/access-control","path":"/docs/0.8.1/tutorials/access-control","sidebar":"tutorialSidebar"},{"id":"tutorials/build-deploy-read","path":"/docs/0.8.1/tutorials/build-deploy-read","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.8.1/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.8.1/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.8.1/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"tutorials/pauseable","path":"/docs/0.8.1/tutorials/pauseable","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.8.1/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.8.1/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.8.1/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.8.1/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.8.1/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.8.1/category/tutorials","sidebar":"tutorialSidebar"},{"id":"/category/migrations","path":"/docs/0.8.1/category/migrations","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.8.1/","label":"version-0.8.1/intro"}}}},{"name":"0.8.0","label":"0.8.0","isLast":false,"path":"/docs/0.8.0","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.8.0/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.8.0/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.8.0/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/storage-layout","path":"/docs/0.8.0/advanced/storage-layout","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.8.0/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/livenet","path":"/docs/0.8.0/backends/livenet","sidebar":"tutorialSidebar"},{"id":"backends/odra-vm","path":"/docs/0.8.0/backends/odra-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.8.0/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.8.0/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.8.0/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.8.0/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.8.0/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.8.0/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.8.0/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.8.0/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.8.0/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.8.0/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.8.0/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.8.0/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.8.0/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.8.0/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.8.0/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.8.0/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.8.0/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.8.0/","sidebar":"tutorialSidebar"},{"id":"migrations/to-0.8.0","path":"/docs/0.8.0/migrations/to-0.8.0","sidebar":"tutorialSidebar"},{"id":"tutorials/access-control","path":"/docs/0.8.0/tutorials/access-control","sidebar":"tutorialSidebar"},{"id":"tutorials/build-deploy-read","path":"/docs/0.8.0/tutorials/build-deploy-read","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.8.0/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.8.0/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.8.0/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"tutorials/pauseable","path":"/docs/0.8.0/tutorials/pauseable","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.8.0/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.8.0/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.8.0/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.8.0/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.8.0/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.8.0/category/tutorials","sidebar":"tutorialSidebar"},{"id":"/category/migrations","path":"/docs/0.8.0/category/migrations","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.8.0/","label":"version-0.8.0/intro"}}}},{"name":"0.7.0","label":"0.7.0","isLast":false,"path":"/docs/0.7.0","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.7.0/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.7.0/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.7.0/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/signatures","path":"/docs/0.7.0/advanced/signatures","sidebar":"tutorialSidebar"},{"id":"advanced/using","path":"/docs/0.7.0/advanced/using","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.7.0/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/mock-vm","path":"/docs/0.7.0/backends/mock-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.7.0/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.7.0/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.7.0/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.7.0/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.7.0/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.7.0/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.7.0/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.7.0/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.7.0/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.7.0/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.7.0/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.7.0/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.7.0/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.7.0/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.7.0/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.7.0/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.7.0/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.7.0/","sidebar":"tutorialSidebar"},{"id":"tutorials/access-control","path":"/docs/0.7.0/tutorials/access-control","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.7.0/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.7.0/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.7.0/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"tutorials/pauseable","path":"/docs/0.7.0/tutorials/pauseable","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.7.0/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.7.0/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.7.0/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.7.0/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.7.0/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.7.0/category/tutorials","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.7.0/","label":"version-0.7.0/intro"}}}},{"name":"0.6.0","label":"0.6.0","isLast":false,"path":"/docs/0.6.0","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.6.0/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.6.0/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.6.0/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/signatures","path":"/docs/0.6.0/advanced/signatures","sidebar":"tutorialSidebar"},{"id":"advanced/using","path":"/docs/0.6.0/advanced/using","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.6.0/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/mock-vm","path":"/docs/0.6.0/backends/mock-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.6.0/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.6.0/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.6.0/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.6.0/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.6.0/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.6.0/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.6.0/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.6.0/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.6.0/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.6.0/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.6.0/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.6.0/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.6.0/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.6.0/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.6.0/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.6.0/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.6.0/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.6.0/","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.6.0/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.6.0/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.6.0/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.6.0/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.6.0/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.6.0/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.6.0/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.6.0/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.6.0/category/tutorials","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.6.0/","label":"version-0.6.0/intro"}}}},{"name":"0.5.0","label":"0.5.0","isLast":false,"path":"/docs/0.5.0","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.5.0/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.5.0/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.5.0/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"advanced/signatures","path":"/docs/0.5.0/advanced/signatures","sidebar":"tutorialSidebar"},{"id":"advanced/using","path":"/docs/0.5.0/advanced/using","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.5.0/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/mock-vm","path":"/docs/0.5.0/backends/mock-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.5.0/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.5.0/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.5.0/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.5.0/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.5.0/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.5.0/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.5.0/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.5.0/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.5.0/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.5.0/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.5.0/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.5.0/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.5.0/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.5.0/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.5.0/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.5.0/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.5.0/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.5.0/","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.5.0/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.5.0/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.5.0/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.5.0/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.5.0/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.5.0/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.5.0/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.5.0/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.5.0/category/tutorials","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.5.0/","label":"version-0.5.0/intro"}}}},{"name":"0.4.0","label":"0.4.0","isLast":false,"path":"/docs/0.4.0","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.4.0/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.4.0/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/composer","path":"/docs/0.4.0/advanced/composer","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.4.0/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.4.0/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/mock-vm","path":"/docs/0.4.0/backends/mock-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.4.0/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.4.0/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.4.0/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.4.0/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.4.0/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.4.0/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.4.0/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.4.0/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.4.0/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.4.0/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.4.0/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.4.0/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.4.0/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.4.0/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.4.0/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.4.0/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.4.0/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.4.0/","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.4.0/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.4.0/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.4.0/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.4.0/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.4.0/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.4.0/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.4.0/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.4.0/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.4.0/category/tutorials","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.4.0/","label":"version-0.4.0/intro"}}}},{"name":"0.3.1","label":"0.3.1","isLast":false,"path":"/docs/0.3.1","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.3.1/advanced/advanced-storage","sidebar":"tutorialSidebar"},{"id":"advanced/attributes","path":"/docs/0.3.1/advanced/attributes","sidebar":"tutorialSidebar"},{"id":"advanced/composer","path":"/docs/0.3.1/advanced/composer","sidebar":"tutorialSidebar"},{"id":"advanced/delegate","path":"/docs/0.3.1/advanced/delegate","sidebar":"tutorialSidebar"},{"id":"backends/casper","path":"/docs/0.3.1/backends/casper","sidebar":"tutorialSidebar"},{"id":"backends/mock-vm","path":"/docs/0.3.1/backends/mock-vm","sidebar":"tutorialSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.3.1/backends/what-is-a-backend","sidebar":"tutorialSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.3.1/basics/cargo-odra","sidebar":"tutorialSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.3.1/basics/communicating-with-host","sidebar":"tutorialSidebar"},{"id":"basics/cross-calls","path":"/docs/0.3.1/basics/cross-calls","sidebar":"tutorialSidebar"},{"id":"basics/directory-structure","path":"/docs/0.3.1/basics/directory-structure","sidebar":"tutorialSidebar"},{"id":"basics/errors","path":"/docs/0.3.1/basics/errors","sidebar":"tutorialSidebar"},{"id":"basics/events","path":"/docs/0.3.1/basics/events","sidebar":"tutorialSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.3.1/basics/flipper-internals","sidebar":"tutorialSidebar"},{"id":"basics/modules","path":"/docs/0.3.1/basics/modules","sidebar":"tutorialSidebar"},{"id":"basics/native-token","path":"/docs/0.3.1/basics/native-token","sidebar":"tutorialSidebar"},{"id":"basics/odra-toml","path":"/docs/0.3.1/basics/odra-toml","sidebar":"tutorialSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.3.1/basics/storage-interaction","sidebar":"tutorialSidebar"},{"id":"basics/testing","path":"/docs/0.3.1/basics/testing","sidebar":"tutorialSidebar"},{"id":"examples/odra-examples","path":"/docs/0.3.1/examples/odra-examples","sidebar":"tutorialSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.3.1/examples/using-odra-modules","sidebar":"tutorialSidebar"},{"id":"getting-started/flipper","path":"/docs/0.3.1/getting-started/flipper","sidebar":"tutorialSidebar"},{"id":"getting-started/installation","path":"/docs/0.3.1/getting-started/installation","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/0.3.1/","sidebar":"tutorialSidebar"},{"id":"tutorials/erc20","path":"/docs/0.3.1/tutorials/erc20","sidebar":"tutorialSidebar"},{"id":"tutorials/ownable","path":"/docs/0.3.1/tutorials/ownable","sidebar":"tutorialSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.3.1/tutorials/owned-token","sidebar":"tutorialSidebar"},{"id":"/category/getting-started","path":"/docs/0.3.1/category/getting-started","sidebar":"tutorialSidebar"},{"id":"/category/basics","path":"/docs/0.3.1/category/basics","sidebar":"tutorialSidebar"},{"id":"/category/advanced","path":"/docs/0.3.1/category/advanced","sidebar":"tutorialSidebar"},{"id":"/category/backends","path":"/docs/0.3.1/category/backends","sidebar":"tutorialSidebar"},{"id":"/category/examples","path":"/docs/0.3.1/category/examples","sidebar":"tutorialSidebar"},{"id":"/category/tutorials","path":"/docs/0.3.1/category/tutorials","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/0.3.1/","label":"version-0.3.1/intro"}}}},{"name":"0.3.0","label":"0.3.0","isLast":false,"path":"/docs/0.3.0","mainDocId":"intro","docs":[{"id":"advanced/advanced-storage","path":"/docs/0.3.0/advanced/advanced-storage","sidebar":"defaultSidebar"},{"id":"advanced/attributes","path":"/docs/0.3.0/advanced/attributes","sidebar":"defaultSidebar"},{"id":"advanced/composer","path":"/docs/0.3.0/advanced/composer","sidebar":"defaultSidebar"},{"id":"advanced/delegate","path":"/docs/0.3.0/advanced/delegate","sidebar":"defaultSidebar"},{"id":"backends/casper","path":"/docs/0.3.0/backends/casper","sidebar":"defaultSidebar"},{"id":"backends/mock-vm","path":"/docs/0.3.0/backends/mock-vm","sidebar":"defaultSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.3.0/backends/what-is-a-backend","sidebar":"defaultSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.3.0/basics/cargo-odra","sidebar":"defaultSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.3.0/basics/communicating-with-host","sidebar":"defaultSidebar"},{"id":"basics/cross-calls","path":"/docs/0.3.0/basics/cross-calls","sidebar":"defaultSidebar"},{"id":"basics/directory-structure","path":"/docs/0.3.0/basics/directory-structure","sidebar":"defaultSidebar"},{"id":"basics/errors","path":"/docs/0.3.0/basics/errors","sidebar":"defaultSidebar"},{"id":"basics/events","path":"/docs/0.3.0/basics/events","sidebar":"defaultSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.3.0/basics/flipper-internals","sidebar":"defaultSidebar"},{"id":"basics/modules","path":"/docs/0.3.0/basics/modules","sidebar":"defaultSidebar"},{"id":"basics/native-token","path":"/docs/0.3.0/basics/native-token","sidebar":"defaultSidebar"},{"id":"basics/odra-toml","path":"/docs/0.3.0/basics/odra-toml","sidebar":"defaultSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.3.0/basics/storage-interaction","sidebar":"defaultSidebar"},{"id":"basics/testing","path":"/docs/0.3.0/basics/testing","sidebar":"defaultSidebar"},{"id":"examples/odra-examples","path":"/docs/0.3.0/examples/odra-examples","sidebar":"defaultSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.3.0/examples/using-odra-modules","sidebar":"defaultSidebar"},{"id":"getting-started/flipper","path":"/docs/0.3.0/getting-started/flipper","sidebar":"defaultSidebar"},{"id":"getting-started/installation","path":"/docs/0.3.0/getting-started/installation","sidebar":"defaultSidebar"},{"id":"intro","path":"/docs/0.3.0/","sidebar":"defaultSidebar"},{"id":"tutorials/erc20","path":"/docs/0.3.0/tutorials/erc20","sidebar":"defaultSidebar"},{"id":"tutorials/ownable","path":"/docs/0.3.0/tutorials/ownable","sidebar":"defaultSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.3.0/tutorials/owned-token","sidebar":"defaultSidebar"},{"id":"/category/getting-started","path":"/docs/0.3.0/category/getting-started","sidebar":"defaultSidebar"},{"id":"/category/basics","path":"/docs/0.3.0/category/basics","sidebar":"defaultSidebar"},{"id":"/category/advanced","path":"/docs/0.3.0/category/advanced","sidebar":"defaultSidebar"},{"id":"/category/backends","path":"/docs/0.3.0/category/backends","sidebar":"defaultSidebar"},{"id":"/category/examples","path":"/docs/0.3.0/category/examples","sidebar":"defaultSidebar"},{"id":"/category/tutorials","path":"/docs/0.3.0/category/tutorials","sidebar":"defaultSidebar"}],"draftIds":[],"sidebars":{"defaultSidebar":{"link":{"path":"/docs/0.3.0/","label":"version-0.3.0/intro"}}}},{"name":"0.2.0","label":"0.2.0","isLast":false,"path":"/docs/0.2.0","mainDocId":"intro","docs":[{"id":"backends/casper","path":"/docs/0.2.0/backends/casper","sidebar":"defaultSidebar"},{"id":"backends/mock-vm","path":"/docs/0.2.0/backends/mock-vm","sidebar":"defaultSidebar"},{"id":"backends/what-is-a-backend","path":"/docs/0.2.0/backends/what-is-a-backend","sidebar":"defaultSidebar"},{"id":"basics/cargo-odra","path":"/docs/0.2.0/basics/cargo-odra","sidebar":"defaultSidebar"},{"id":"basics/communicating-with-host","path":"/docs/0.2.0/basics/communicating-with-host","sidebar":"defaultSidebar"},{"id":"basics/cross-calls","path":"/docs/0.2.0/basics/cross-calls","sidebar":"defaultSidebar"},{"id":"basics/directory-structure","path":"/docs/0.2.0/basics/directory-structure","sidebar":"defaultSidebar"},{"id":"basics/errors","path":"/docs/0.2.0/basics/errors","sidebar":"defaultSidebar"},{"id":"basics/events","path":"/docs/0.2.0/basics/events","sidebar":"defaultSidebar"},{"id":"basics/flipper-internals","path":"/docs/0.2.0/basics/flipper-internals","sidebar":"defaultSidebar"},{"id":"basics/modules","path":"/docs/0.2.0/basics/modules","sidebar":"defaultSidebar"},{"id":"basics/native-token","path":"/docs/0.2.0/basics/native-token","sidebar":"defaultSidebar"},{"id":"basics/odra-toml","path":"/docs/0.2.0/basics/odra-toml","sidebar":"defaultSidebar"},{"id":"basics/storage-interaction","path":"/docs/0.2.0/basics/storage-interaction","sidebar":"defaultSidebar"},{"id":"basics/testing","path":"/docs/0.2.0/basics/testing","sidebar":"defaultSidebar"},{"id":"examples/odra-examples","path":"/docs/0.2.0/examples/odra-examples","sidebar":"defaultSidebar"},{"id":"examples/using-odra-modules","path":"/docs/0.2.0/examples/using-odra-modules","sidebar":"defaultSidebar"},{"id":"getting-started/flipper","path":"/docs/0.2.0/getting-started/flipper","sidebar":"defaultSidebar"},{"id":"getting-started/installation","path":"/docs/0.2.0/getting-started/installation","sidebar":"defaultSidebar"},{"id":"intro","path":"/docs/0.2.0/","sidebar":"defaultSidebar"},{"id":"tutorials/erc20","path":"/docs/0.2.0/tutorials/erc20","sidebar":"defaultSidebar"},{"id":"tutorials/ownable","path":"/docs/0.2.0/tutorials/ownable","sidebar":"defaultSidebar"},{"id":"tutorials/owned-token","path":"/docs/0.2.0/tutorials/owned-token","sidebar":"defaultSidebar"},{"id":"/category/getting-started","path":"/docs/0.2.0/category/getting-started","sidebar":"defaultSidebar"},{"id":"/category/basics","path":"/docs/0.2.0/category/basics","sidebar":"defaultSidebar"},{"id":"/category/backends","path":"/docs/0.2.0/category/backends","sidebar":"defaultSidebar"},{"id":"/category/examples","path":"/docs/0.2.0/category/examples","sidebar":"defaultSidebar"},{"id":"/category/tutorials","path":"/docs/0.2.0/category/tutorials","sidebar":"defaultSidebar"}],"draftIds":[],"sidebars":{"defaultSidebar":{"link":{"path":"/docs/0.2.0/","label":"version-0.2.0/intro"}}}}],"breadcrumbs":true}}}'),s=JSON.parse('{"defaultLocale":"en","locales":["en"],"path":"i18n","currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory","path":"en"}}}');var i=a(57529);const c=JSON.parse('{"docusaurusVersion":"2.3.1","siteVersion":"0.0.1","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"2.3.1"},"docusaurus-plugin-content-blog":{"type":"package","name":"@docusaurus/plugin-content-blog","version":"2.3.1"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"2.3.1"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"2.3.1"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"2.3.1"},"docusaurus-lunr-search":{"type":"package","name":"docusaurus-lunr-search","version":"3.3.2"},"docusaurus-theme-mermaid":{"type":"package","name":"@docusaurus/theme-mermaid","version":"2.3.1"}}}'),d={siteConfig:r.default,siteMetadata:c,globalData:o,i18n:s,codeTranslations:i},l=n.createContext(d);function u(e){let{children:t}=e;return n.createElement(l.Provider,{value:d},t)}},44763:(e,t,a)=>{"use strict";a.d(t,{Z:()=>l});var n=a(67294),r=a(10412),o=a(35742),s=a(12684);function i(e){let{error:t,tryAgain:a}=e;return n.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"50vh",width:"100%",fontSize:"20px"}},n.createElement("h1",null,"This page crashed."),n.createElement("p",null,t.message),n.createElement("button",{type:"button",onClick:a},"Try again"))}function c(e){let{error:t,tryAgain:a}=e;return n.createElement(l,{fallback:()=>n.createElement(i,{error:t,tryAgain:a})},n.createElement(o.Z,null,n.createElement("title",null,"Page Error")),n.createElement(s.Z,null,n.createElement(i,{error:t,tryAgain:a})))}const d=e=>n.createElement(c,e);class l extends n.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){r.Z.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??d)(e)}return e??null}}},10412:(e,t,a)=>{"use strict";a.d(t,{Z:()=>r});const n="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,r={canUseDOM:n,canUseEventListeners:n&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:n&&"IntersectionObserver"in window,canUseViewport:n&&"screen"in window}},35742:(e,t,a)=>{"use strict";a.d(t,{Z:()=>o});var n=a(67294),r=a(70405);function o(e){return n.createElement(r.ql,e)}},39960:(e,t,a)=>{"use strict";a.d(t,{Z:()=>b});var n=a(87462),r=a(67294),o=a(73727),s=a(18780),i=a(52263),c=a(13919),d=a(10412);const l=r.createContext({collectLink:()=>{}});var u=a(44996);function p(e,t){let{isNavLink:a,to:p,href:b,activeClassName:f,isActive:m,"data-noBrokenLinkCheck":g,autoAddBaseUrl:h=!0,...v}=e;const{siteConfig:{trailingSlash:y,baseUrl:_}}=(0,i.Z)(),{withBaseUrl:S}=(0,u.C)(),x=(0,r.useContext)(l),k=(0,r.useRef)(null);(0,r.useImperativeHandle)(t,(()=>k.current));const w=p||b;const E=(0,c.Z)(w),C=w?.replace("pathname://","");let T=void 0!==C?(I=C,h&&(e=>e.startsWith("/"))(I)?S(I):I):void 0;var I;T&&E&&(T=(0,s.applyTrailingSlash)(T,{trailingSlash:y,baseUrl:_}));const N=(0,r.useRef)(!1),A=a?o.OL:o.rU,L=d.Z.canUseIntersectionObserver,O=(0,r.useRef)(),P=()=>{N.current||null==T||(window.docusaurus.preload(T),N.current=!0)};(0,r.useEffect)((()=>(!L&&E&&null!=T&&window.docusaurus.prefetch(T),()=>{L&&O.current&&O.current.disconnect()})),[O,T,L,E]);const R=T?.startsWith("#")??!1,M=!T||!E||R;return M||g||x.collectLink(T),M?r.createElement("a",(0,n.Z)({ref:k,href:T},w&&!E&&{target:"_blank",rel:"noopener noreferrer"},v)):r.createElement(A,(0,n.Z)({},v,{onMouseEnter:P,onTouchStart:P,innerRef:e=>{k.current=e,L&&e&&E&&(O.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(O.current.unobserve(e),O.current.disconnect(),null!=T&&window.docusaurus.prefetch(T))}))})),O.current.observe(e))},to:T},a&&{isActive:m,activeClassName:f}))}const b=r.forwardRef(p)},95999:(e,t,a)=>{"use strict";a.d(t,{Z:()=>c,I:()=>i});var n=a(67294);function r(e,t){const a=e.split(/(\{\w+\})/).map(((e,a)=>{if(a%2==1){const a=t?.[e.slice(1,-1)];if(void 0!==a)return a}return e}));return a.some((e=>(0,n.isValidElement)(e)))?a.map(((e,t)=>(0,n.isValidElement)(e)?n.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):a.join("")}var o=a(57529);function s(e){let{id:t,message:a}=e;if(void 0===t&&void 0===a)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return o[t??a]??a??t}function i(e,t){let{message:a,id:n}=e;return r(s({message:a,id:n}),t)}function c(e){let{children:t,id:a,values:o}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal <Translate> children",t),new Error("The Docusaurus <Translate> component only accept simple string values");const i=s({message:t,id:a});return n.createElement(n.Fragment,null,r(i,o))}},29935:(e,t,a)=>{"use strict";a.d(t,{m:()=>n});const n="default"},13919:(e,t,a)=>{"use strict";function n(e){return/^(?:\w*:|\/\/)/.test(e)}function r(e){return void 0!==e&&!n(e)}a.d(t,{Z:()=>r,b:()=>n})},44996:(e,t,a)=>{"use strict";a.d(t,{C:()=>s,Z:()=>i});var n=a(67294),r=a(52263),o=a(13919);function s(){const{siteConfig:{baseUrl:e,url:t}}=(0,r.Z)(),a=(0,n.useCallback)(((a,n)=>function(e,t,a,n){let{forcePrependBaseUrl:r=!1,absolute:s=!1}=void 0===n?{}:n;if(!a||a.startsWith("#")||(0,o.b)(a))return a;if(r)return t+a.replace(/^\//,"");if(a===t.replace(/\/$/,""))return t;const i=a.startsWith(t)?a:t+a.replace(/^\//,"");return s?e+i:i}(t,e,a,n)),[t,e]);return{withBaseUrl:a}}function i(e,t){void 0===t&&(t={});const{withBaseUrl:a}=s();return a(e,t)}},52263:(e,t,a)=>{"use strict";a.d(t,{Z:()=>o});var n=a(67294),r=a(58940);function o(){return(0,n.useContext)(r._)}},28084:(e,t,a)=>{"use strict";a.d(t,{OD:()=>o,eZ:()=>s});var n=a(52263),r=a(29935);function o(e,t){void 0===t&&(t={});const a=function(){const{globalData:e}=(0,n.Z)();return e}()[e];if(!a&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return a}function s(e,t,a){void 0===t&&(t=r.m),void 0===a&&(a={});const n=o(e)?.[t];if(!n&&a.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return n}},72389:(e,t,a)=>{"use strict";a.d(t,{Z:()=>o});var n=a(67294),r=a(98934);function o(){return(0,n.useContext)(r._)}},99670:(e,t,a)=>{"use strict";a.d(t,{Z:()=>n});function n(e){const t={};return function e(a,n){Object.entries(a).forEach((a=>{let[r,o]=a;const s=n?`${n}.${r}`:r;var i;"object"==typeof(i=o)&&i&&Object.keys(i).length>0?e(o,s):t[s]=o}))}(e),t}},30226:(e,t,a)=>{"use strict";a.d(t,{_:()=>r,z:()=>o});var n=a(67294);const r=n.createContext(null);function o(e){let{children:t,value:a}=e;const o=n.useContext(r),s=(0,n.useMemo)((()=>function(e){let{parent:t,value:a}=e;if(!t){if(!a)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in a))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return a}const n={...t.data,...a?.data};return{plugin:t.plugin,data:n}}({parent:o,value:a})),[o,a]);return n.createElement(r.Provider,{value:s},t)}},94104:(e,t,a)=>{"use strict";a.d(t,{Iw:()=>b,gA:()=>l,_r:()=>c,Jo:()=>f,zh:()=>d,yW:()=>p,gB:()=>u});var n=a(16550),r=a(28084);const o=e=>e.versions.find((e=>e.isLast));function s(e,t){const a=function(e,t){const a=o(e);return[...e.versions.filter((e=>e!==a)),a].find((e=>!!(0,n.LX)(t,{path:e.path,exact:!1,strict:!1})))}(e,t),r=a?.docs.find((e=>!!(0,n.LX)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:a,activeDoc:r,alternateDocVersions:r?function(t){const a={};return e.versions.forEach((e=>{e.docs.forEach((n=>{n.id===t&&(a[e.name]=n)}))})),a}(r.id):{}}}const i={},c=()=>(0,r.OD)("docusaurus-plugin-content-docs")??i,d=e=>(0,r.eZ)("docusaurus-plugin-content-docs",e,{failfast:!0});function l(e){void 0===e&&(e={});const t=c(),{pathname:a}=(0,n.TH)();return function(e,t,a){void 0===a&&(a={});const r=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,a]=e;return!!(0,n.LX)(t,{path:a.path,exact:!1,strict:!1})})),o=r?{pluginId:r[0],pluginData:r[1]}:void 0;if(!o&&a.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return o}(t,a,e)}function u(e){return d(e).versions}function p(e){const t=d(e);return o(t)}function b(e){const t=d(e),{pathname:a}=(0,n.TH)();return s(t,a)}function f(e){const t=d(e),{pathname:a}=(0,n.TH)();return function(e,t){const a=o(e);return{latestDocSuggestion:s(e,t).alternateDocVersions[a.name],latestVersionSuggestion:a}}(t,a)}},18320:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>o});var n=a(74865),r=a.n(n);r().configure({showSpinner:!1});const o={onRouteUpdate(e){let{location:t,previousLocation:a}=e;if(a&&t.pathname!==a.pathname){const e=window.setTimeout((()=>{r().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){r().done()}}},3310:(e,t,a)=>{"use strict";a.r(t);var n=a(87410),r=a(36809);!function(e){const{themeConfig:{prism:t}}=r.default,{additionalLanguages:n}=t;globalThis.Prism=e,n.forEach((e=>{a(25583)(`./prism-${e}`)})),delete globalThis.Prism}(n.Z)},39471:(e,t,a)=>{"use strict";a.d(t,{Z:()=>o});var n=a(67294);const r="iconExternalLink_nPIU";function o(e){let{width:t=13.5,height:a=13.5}=e;return n.createElement("svg",{width:t,height:a,"aria-hidden":"true",viewBox:"0 0 24 24",className:r},n.createElement("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"}))}},12684:(e,t,a)=>{"use strict";a.d(t,{Z:()=>pt});var n=a(67294),r=a(86010),o=a(44763),s=a(1944),i=a(87462),c=a(16550),d=a(95999),l=a(85936);const u="docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function b(){const e=(0,n.useRef)(null),{action:t}=(0,c.k6)(),a=(0,n.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(u);t&&p(t)}),[]);return(0,l.S)((a=>{let{location:n}=a;e.current&&!n.hash&&"PUSH"===t&&p(e.current)})),{containerRef:e,onClick:a}}const f=(0,d.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function m(e){const t=e.children??f,{containerRef:a,onClick:r}=b();return n.createElement("div",{ref:a,role:"region","aria-label":f},n.createElement("a",(0,i.Z)({},e,{href:`#${u}`,onClick:r}),t))}var g=a(35281),h=a(19727);const v="skipToContent_fXgn";function y(){return n.createElement(m,{className:v})}var _=a(86668),S=a(59689);function x(e){let{width:t=21,height:a=21,color:r="currentColor",strokeWidth:o=1.2,className:s,...c}=e;return n.createElement("svg",(0,i.Z)({viewBox:"0 0 15 15",width:t,height:a},c),n.createElement("g",{stroke:r,strokeWidth:o},n.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}const k="closeButton_CVFx";function w(e){return n.createElement("button",(0,i.Z)({type:"button","aria-label":(0,d.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},e,{className:(0,r.Z)("clean-btn close",k,e.className)}),n.createElement(x,{width:14,height:14,strokeWidth:3.1}))}const E="content_knG7";function C(e){const{announcementBar:t}=(0,_.L)(),{content:a}=t;return n.createElement("div",(0,i.Z)({},e,{className:(0,r.Z)(E,e.className),dangerouslySetInnerHTML:{__html:a}}))}const T="announcementBar_mb4j",I="announcementBarPlaceholder_vyr4",N="announcementBarClose_gvF7",A="announcementBarContent_xLdY";function L(){const{announcementBar:e}=(0,_.L)(),{isActive:t,close:a}=(0,S.nT)();if(!t)return null;const{backgroundColor:r,textColor:o,isCloseable:s}=e;return n.createElement("div",{className:T,style:{backgroundColor:r,color:o},role:"banner"},s&&n.createElement("div",{className:I}),n.createElement(C,{className:A}),s&&n.createElement(w,{onClick:a,className:N}))}var O=a(93163),P=a(12466);var R=a(902),M=a(13102);const D=n.createContext(null);function F(e){let{children:t}=e;const a=function(){const e=(0,O.e)(),t=(0,M.HY)(),[a,r]=(0,n.useState)(!1),o=null!==t.component,s=(0,R.D9)(o);return(0,n.useEffect)((()=>{o&&!s&&r(!0)}),[o,s]),(0,n.useEffect)((()=>{o?e.shown||r(!0):r(!1)}),[e.shown,o]),(0,n.useMemo)((()=>[a,r]),[a])}();return n.createElement(D.Provider,{value:a},t)}function j(e){if(e.component){const t=e.component;return n.createElement(t,e.props)}}function B(){const e=(0,n.useContext)(D);if(!e)throw new R.i6("NavbarSecondaryMenuDisplayProvider");const[t,a]=e,r=(0,n.useCallback)((()=>a(!1)),[a]),o=(0,M.HY)();return(0,n.useMemo)((()=>({shown:t,hide:r,content:j(o)})),[r,o,t])}function z(e){let{header:t,primaryMenu:a,secondaryMenu:o}=e;const{shown:s}=B();return n.createElement("div",{className:"navbar-sidebar"},t,n.createElement("div",{className:(0,r.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":s})},n.createElement("div",{className:"navbar-sidebar__item menu"},a),n.createElement("div",{className:"navbar-sidebar__item menu"},o)))}var $=a(92949),U=a(72389);function Z(e){return n.createElement("svg",(0,i.Z)({viewBox:"0 0 24 24",width:24,height:24},e),n.createElement("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"}))}function G(e){return n.createElement("svg",(0,i.Z)({viewBox:"0 0 24 24",width:24,height:24},e),n.createElement("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"}))}const H={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function V(e){let{className:t,value:a,onChange:o}=e;const s=(0,U.Z)(),i=(0,d.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===a?(0,d.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,d.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return n.createElement("div",{className:(0,r.Z)(H.toggle,t)},n.createElement("button",{className:(0,r.Z)("clean-btn",H.toggleButton,!s&&H.toggleButtonDisabled),type:"button",onClick:()=>o("dark"===a?"light":"dark"),disabled:!s,title:i,"aria-label":i,"aria-live":"polite"},n.createElement(Z,{className:(0,r.Z)(H.toggleIcon,H.lightToggleIcon)}),n.createElement(G,{className:(0,r.Z)(H.toggleIcon,H.darkToggleIcon)})))}const W=n.memo(V);function q(e){let{className:t}=e;const a=(0,_.L)().colorMode.disableSwitch,{colorMode:r,setColorMode:o}=(0,$.I)();return a?null:n.createElement(W,{className:t,value:r,onChange:o})}var Y=a(11231);function K(){return n.createElement(Y.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function X(){const e=(0,O.e)();return n.createElement("button",{type:"button","aria-label":(0,d.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle()},n.createElement(x,{color:"var(--ifm-color-emphasis-600)"}))}function Q(){return n.createElement("div",{className:"navbar-sidebar__brand"},n.createElement(K,null),n.createElement(q,{className:"margin-right--md"}),n.createElement(X,null))}var J=a(39960),ee=a(44996),te=a(13919);function ae(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}var ne=a(39471);function re(e){let{activeBasePath:t,activeBaseRegex:a,to:r,href:o,label:s,html:c,isDropdownLink:d,prependBaseUrlToHref:l,...u}=e;const p=(0,ee.Z)(r),b=(0,ee.Z)(t),f=(0,ee.Z)(o,{forcePrependBaseUrl:!0}),m=s&&o&&!(0,te.Z)(o),g=c?{dangerouslySetInnerHTML:{__html:c}}:{children:n.createElement(n.Fragment,null,s,m&&n.createElement(ne.Z,d&&{width:12,height:12}))};return o?n.createElement(J.Z,(0,i.Z)({href:l?f:o},u,g)):n.createElement(J.Z,(0,i.Z)({to:p,isNavLink:!0},(t||a)&&{isActive:(e,t)=>a?ae(a,t.pathname):t.pathname.startsWith(b)},u,g))}function oe(e){let{className:t,isDropdownItem:a=!1,...o}=e;const s=n.createElement(re,(0,i.Z)({className:(0,r.Z)(a?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:a},o));return a?n.createElement("li",null,s):s}function se(e){let{className:t,isDropdownItem:a,...o}=e;return n.createElement("li",{className:"menu__list-item"},n.createElement(re,(0,i.Z)({className:(0,r.Z)("menu__link",t)},o)))}function ie(e){let{mobile:t=!1,position:a,...r}=e;const o=t?se:oe;return n.createElement(o,(0,i.Z)({},r,{activeClassName:r.activeClassName??(t?"menu__link--active":"navbar__link--active")}))}var ce=a(86043),de=a(48596),le=a(52263);function ue(e,t){return e.some((e=>function(e,t){return!!(0,de.Mg)(e.to,t)||!!ae(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function pe(e){let{items:t,position:a,className:o,onClick:s,...c}=e;const d=(0,n.useRef)(null),[l,u]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&u(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[d]),n.createElement("div",{ref:d,className:(0,r.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===a,"dropdown--show":l})},n.createElement(re,(0,i.Z)({"aria-haspopup":"true","aria-expanded":l,role:"button",href:c.to?void 0:"#",className:(0,r.Z)("navbar__link",o)},c,{onClick:c.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),u(!l))}}),c.children??c.label),n.createElement("ul",{className:"dropdown__menu"},t.map(((e,a)=>n.createElement(Ae,(0,i.Z)({isDropdownItem:!0,onKeyDown:e=>{if(a===t.length-1&&"Tab"===e.key){e.preventDefault(),u(!1);const t=d.current.nextElementSibling;if(t){(t instanceof HTMLAnchorElement?t:t.querySelector("a")).focus()}}},activeClassName:"dropdown__link--active"},e,{key:a}))))))}function be(e){let{items:t,className:a,position:o,onClick:s,...d}=e;const l=function(){const{siteConfig:{baseUrl:e}}=(0,le.Z)(),{pathname:t}=(0,c.TH)();return t.replace(e,"/")}(),u=ue(t,l),{collapsed:p,toggleCollapsed:b,setCollapsed:f}=(0,ce.u)({initialState:()=>!u});return(0,n.useEffect)((()=>{u&&f(!u)}),[l,u,f]),n.createElement("li",{className:(0,r.Z)("menu__list-item",{"menu__list-item--collapsed":p})},n.createElement(re,(0,i.Z)({role:"button",className:(0,r.Z)("menu__link menu__link--sublist menu__link--sublist-caret",a)},d,{onClick:e=>{e.preventDefault(),b()}}),d.children??d.label),n.createElement(ce.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:p},t.map(((e,t)=>n.createElement(Ae,(0,i.Z)({mobile:!0,isDropdownItem:!0,onClick:s,activeClassName:"menu__link--active"},e,{key:t}))))))}function fe(e){let{mobile:t=!1,...a}=e;const r=t?be:pe;return n.createElement(r,a)}var me=a(94711);function ge(e){let{width:t=20,height:a=20,...r}=e;return n.createElement("svg",(0,i.Z)({viewBox:"0 0 24 24",width:t,height:a,"aria-hidden":!0},r),n.createElement("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"}))}const he="iconLanguage_nlXk";var ve=a(28084),ye=a(813),_e=a.n(ye);function Se(){const e=(0,c.TH)(),t=(0,c.k6)(),{siteConfig:{baseUrl:a}}=(0,le.Z)(),[r,o]=(0,n.useState)({wordToHighlight:"",isTitleSuggestion:!1,titleText:""});return(0,n.useEffect)((()=>{if(!e.state?.highlightState||0===e.state.highlightState.wordToHighlight.length)return;o(e.state.highlightState);const{highlightState:a,...n}=e.state;t.replace({...e,state:n})}),[e.state?.highlightState,t,e]),(0,n.useEffect)((()=>{if(0===r.wordToHighlight.length)return;const e=document.getElementsByTagName("article")[0]??document.getElementsByTagName("main")[0];if(!e)return;const t=new(_e())(e),a={ignoreJoiners:!0};return t.mark(r.wordToHighlight,a),()=>t.unmark(a)}),[r,a]),null}const xe=e=>{const t=(0,n.useRef)(!1),o=(0,n.useRef)(null),[s,i]=(0,n.useState)(!1),d=(0,c.k6)(),{siteConfig:l={}}=(0,le.Z)(),u=(l.plugins||[]).find((e=>Array.isArray(e)&&"string"==typeof e[0]&&e[0].includes("docusaurus-lunr-search"))),p=(0,U.Z)(),{baseUrl:b}=l,f=u&&u[1]?.assetUrl||b,m=(0,ve.eZ)("docusaurus-lunr-search"),g=()=>{t.current||(Promise.all([fetch(`${f}${m.fileNames.searchDoc}`).then((e=>e.json())),fetch(`${f}${m.fileNames.lunrIndex}`).then((e=>e.json())),Promise.all([a.e(84611),a.e(25684)]).then(a.bind(a,4734)),Promise.all([a.e(40532),a.e(32572)]).then(a.bind(a,32572))]).then((e=>{let[t,a,{default:n}]=e;const{searchDocs:r,options:o}=t;r&&0!==r.length&&(((e,t,a,n)=>{new a({searchDocs:e,searchIndex:t,baseUrl:b,inputSelector:"#search_input_react",handleSelected:(e,t,a)=>{const r=a.url||"/";document.createElement("a").href=r,e.setVal(""),t.target.blur();let o="";if(n.highlightResult)try{const e=(a.text||a.subcategory||a.title).match(new RegExp("<span.+span>\\w*","g"));if(e&&e.length>0){const t=document.createElement("div");t.innerHTML=e[0],o=t.textContent}}catch(s){console.log(s)}d.push(r,{highlightState:{wordToHighlight:o}})},maxHits:n.maxHits})})(r,a,n,o),i(!0))})),t.current=!0)},h=(0,n.useCallback)((t=>{o.current.contains(t.target)||o.current.focus(),e.handleSearchBarToggle&&e.handleSearchBarToggle(!e.isSearchBarExpanded)}),[e.isSearchBarExpanded]);let v;return p&&(g(),v=window.navigator.platform.startsWith("Mac")?"Search \u2318+K":"Search Ctrl+K"),n.createElement("div",{className:"navbar__search",key:"search-box"},n.createElement("span",{"aria-label":"expand searchbar",role:"button",className:(0,r.Z)("search-icon",{"search-icon-hidden":e.isSearchBarExpanded}),onClick:h,onKeyDown:h,tabIndex:0}),n.createElement("input",{id:"search_input_react",type:"search",placeholder:s?v:"Loading...","aria-label":"Search",className:(0,r.Z)("navbar__search-input",{"search-bar-expanded":e.isSearchBarExpanded},{"search-bar":!e.isSearchBarExpanded}),onClick:g,onMouseOver:g,onFocus:h,onBlur:h,ref:o,disabled:!s}),n.createElement(Se,null))},ke="searchBox_ZlJk";function we(e){let{children:t,className:a}=e;return n.createElement("div",{className:(0,r.Z)(a,ke)},t)}var Ee=a(94104),Ce=a(53438);var Te=a(60373);const Ie=e=>e.docs.find((t=>t.id===e.mainDocId));const Ne={default:ie,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:a,dropdownItemsAfter:r,...o}=e;const{i18n:{currentLocale:s,locales:l,localeConfigs:u}}=(0,le.Z)(),p=(0,me.l)(),{search:b,hash:f}=(0,c.TH)(),m=[...a,...l.map((e=>{const a=`${`pathname://${p.createUrl({locale:e,fullyQualified:!1})}`}${b}${f}`;return{label:u[e].label,lang:u[e].htmlLang,to:a,target:"_self",autoAddBaseUrl:!1,className:e===s?t?"menu__link--active":"dropdown__link--active":""}})),...r],g=t?(0,d.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):u[s].label;return n.createElement(fe,(0,i.Z)({},o,{mobile:t,label:n.createElement(n.Fragment,null,n.createElement(ge,{className:he}),g),items:m}))},search:function(e){let{mobile:t,className:a}=e;return t?null:n.createElement(we,{className:a},n.createElement(xe,null))},dropdown:fe,html:function(e){let{value:t,className:a,mobile:o=!1,isDropdownItem:s=!1}=e;const i=s?"li":"div";return n.createElement(i,{className:(0,r.Z)({navbar__item:!o&&!s,"menu__list-item":o},a),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:a,docsPluginId:r,...o}=e;const{activeDoc:s}=(0,Ee.Iw)(r),c=(0,Ce.vY)(t,r);return null===c?null:n.createElement(ie,(0,i.Z)({exact:!0},o,{isActive:()=>s?.path===c.path||!!s?.sidebar&&s.sidebar===c.sidebar,label:a??c.id,to:c.path}))},docSidebar:function(e){let{sidebarId:t,label:a,docsPluginId:r,...o}=e;const{activeDoc:s}=(0,Ee.Iw)(r),c=(0,Ce.oz)(t,r).link;if(!c)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return n.createElement(ie,(0,i.Z)({exact:!0},o,{isActive:()=>s?.sidebar===t,label:a??c.label,to:c.path}))},docsVersion:function(e){let{label:t,to:a,docsPluginId:r,...o}=e;const s=(0,Ce.lO)(r)[0],c=t??s.label,d=a??(e=>e.docs.find((t=>t.id===e.mainDocId)))(s).path;return n.createElement(ie,(0,i.Z)({},o,{label:c,to:d}))},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:a,dropdownActiveClassDisabled:r,dropdownItemsBefore:o,dropdownItemsAfter:s,...l}=e;const{search:u,hash:p}=(0,c.TH)(),b=(0,Ee.Iw)(a),f=(0,Ee.gB)(a),{savePreferredVersionName:m}=(0,Te.J)(a),g=[...o,...f.map((e=>{const t=b.alternateDocVersions[e.name]??Ie(e);return{label:e.label,to:`${t.path}${u}${p}`,isActive:()=>e===b.activeVersion,onClick:()=>m(e.name)}})),...s],h=(0,Ce.lO)(a)[0],v=t&&g.length>1?(0,d.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):h.label,y=t&&g.length>1?void 0:Ie(h).path;return g.length<=1?n.createElement(ie,(0,i.Z)({},l,{mobile:t,label:v,to:y,isActive:r?()=>!1:void 0})):n.createElement(fe,(0,i.Z)({},l,{mobile:t,label:v,to:y,items:g,isActive:r?()=>!1:void 0}))}};function Ae(e){let{type:t,...a}=e;const r=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,a),o=Ne[r];if(!o)throw new Error(`No NavbarItem component found for type "${t}".`);return n.createElement(o,a)}function Le(){const e=(0,O.e)(),t=(0,_.L)().navbar.items;return n.createElement("ul",{className:"menu__list"},t.map(((t,a)=>n.createElement(Ae,(0,i.Z)({mobile:!0},t,{onClick:()=>e.toggle(),key:a})))))}function Oe(e){return n.createElement("button",(0,i.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),n.createElement(d.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function Pe(){const e=0===(0,_.L)().navbar.items.length,t=B();return n.createElement(n.Fragment,null,!e&&n.createElement(Oe,{onClick:()=>t.hide()}),t.content)}function Re(){const e=(0,O.e)();var t;return void 0===(t=e.shown)&&(t=!0),(0,n.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?n.createElement(z,{header:n.createElement(Q,null),primaryMenu:n.createElement(Le,null),secondaryMenu:n.createElement(Pe,null)}):null}const Me="navbarHideable_m1mJ",De="navbarHidden_jGov";function Fe(e){return n.createElement("div",(0,i.Z)({role:"presentation"},e,{className:(0,r.Z)("navbar-sidebar__backdrop",e.className)}))}function je(e){let{children:t}=e;const{navbar:{hideOnScroll:a,style:o}}=(0,_.L)(),s=(0,O.e)(),{navbarRef:i,isNavbarVisible:c}=function(e){const[t,a]=(0,n.useState)(e),r=(0,n.useRef)(!1),o=(0,n.useRef)(0),s=(0,n.useCallback)((e=>{null!==e&&(o.current=e.getBoundingClientRect().height)}),[]);return(0,P.RF)(((t,n)=>{let{scrollY:s}=t;if(!e)return;if(s<o.current)return void a(!0);if(r.current)return void(r.current=!1);const i=n?.scrollY,c=document.documentElement.scrollHeight-o.current,d=window.innerHeight;i&&s>=i?a(!1):s+d<c&&a(!0)})),(0,l.S)((t=>{if(!e)return;const n=t.location.hash;if(n?document.getElementById(n.substring(1)):void 0)return r.current=!0,void a(!1);a(!0)})),{navbarRef:s,isNavbarVisible:t}}(a);return n.createElement("nav",{ref:i,"aria-label":(0,d.I)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,r.Z)("navbar","navbar--fixed-top",a&&[Me,!c&&De],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":s.shown})},t,n.createElement(Fe,{onClick:s.toggle}),n.createElement(Re,null))}function Be(e){let{width:t=30,height:a=30,className:r,...o}=e;return n.createElement("svg",(0,i.Z)({className:r,width:t,height:a,viewBox:"0 0 30 30","aria-hidden":"true"},o),n.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function ze(){const{toggle:e,shown:t}=(0,O.e)();return n.createElement("button",{onClick:e,"aria-label":(0,d.I)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button"},n.createElement(Be,null))}const $e="colorModeToggle_DEke";function Ue(e){let{items:t}=e;return n.createElement(n.Fragment,null,t.map(((e,t)=>n.createElement(Ae,(0,i.Z)({},e,{key:t})))))}function Ze(e){let{left:t,right:a}=e;return n.createElement("div",{className:"navbar__inner"},n.createElement("div",{className:"navbar__items"},t),n.createElement("div",{className:"navbar__items navbar__items--right"},a))}function Ge(){const e=(0,O.e)(),t=(0,_.L)().navbar.items,[a,r]=function(e){function t(e){return"left"===(e.position??"right")}return[e.filter(t),e.filter((e=>!t(e)))]}(t),o=t.find((e=>"search"===e.type));return n.createElement(Ze,{left:n.createElement(n.Fragment,null,!e.disabled&&n.createElement(ze,null),n.createElement(K,null),n.createElement(Ue,{items:a})),right:n.createElement(n.Fragment,null,n.createElement(Ue,{items:r}),n.createElement(q,{className:$e}),!o&&n.createElement(we,null,n.createElement(xe,null)))})}function He(){return n.createElement(je,null,n.createElement(Ge,null))}function Ve(e){let{item:t}=e;const{to:a,href:r,label:o,prependBaseUrlToHref:s,...c}=t,d=(0,ee.Z)(a),l=(0,ee.Z)(r,{forcePrependBaseUrl:!0});return n.createElement(J.Z,(0,i.Z)({className:"footer__link-item"},r?{href:s?l:r}:{to:d},c),o,r&&!(0,te.Z)(r)&&n.createElement(ne.Z,null))}function We(e){let{item:t}=e;return t.html?n.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):n.createElement("li",{key:t.href??t.to,className:"footer__item"},n.createElement(Ve,{item:t}))}function qe(e){let{column:t}=e;return n.createElement("div",{className:"col footer__col"},n.createElement("div",{className:"footer__title"},t.title),n.createElement("ul",{className:"footer__items clean-list"},t.items.map(((e,t)=>n.createElement(We,{key:t,item:e})))))}function Ye(e){let{columns:t}=e;return n.createElement("div",{className:"row footer__links"},t.map(((e,t)=>n.createElement(qe,{key:t,column:e}))))}function Ke(){return n.createElement("span",{className:"footer__link-separator"},"\xb7")}function Xe(e){let{item:t}=e;return t.html?n.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):n.createElement(Ve,{item:t})}function Qe(e){let{links:t}=e;return n.createElement("div",{className:"footer__links text--center"},n.createElement("div",{className:"footer__links"},t.map(((e,a)=>n.createElement(n.Fragment,{key:a},n.createElement(Xe,{item:e}),t.length!==a+1&&n.createElement(Ke,null))))))}function Je(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?n.createElement(Ye,{columns:t}):n.createElement(Qe,{links:t})}var et=a(50941);const tt="footerLogoLink_BH7S";function at(e){let{logo:t}=e;const{withBaseUrl:a}=(0,ee.C)(),o={light:a(t.src),dark:a(t.srcDark??t.src)};return n.createElement(et.Z,{className:(0,r.Z)("footer__logo",t.className),alt:t.alt,sources:o,width:t.width,height:t.height,style:t.style})}function nt(e){let{logo:t}=e;return t.href?n.createElement(J.Z,{href:t.href,className:tt,target:t.target},n.createElement(at,{logo:t})):n.createElement(at,{logo:t})}function rt(e){let{copyright:t}=e;return n.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function ot(e){let{style:t,links:a,logo:o,copyright:s}=e;return n.createElement("footer",{className:(0,r.Z)("footer",{"footer--dark":"dark"===t})},n.createElement("div",{className:"container container-fluid"},a,(o||s)&&n.createElement("div",{className:"footer__bottom text--center"},o&&n.createElement("div",{className:"margin-bottom--sm"},o),s)))}function st(){const{footer:e}=(0,_.L)();if(!e)return null;const{copyright:t,links:a,logo:r,style:o}=e;return n.createElement(ot,{style:o,links:a&&a.length>0&&n.createElement(Je,{links:a}),logo:r&&n.createElement(nt,{logo:r}),copyright:t&&n.createElement(rt,{copyright:t})})}const it=n.memo(st),ct=(0,R.Qc)([$.S,S.pl,P.OC,Te.L5,s.VC,function(e){let{children:t}=e;return n.createElement(M.n2,null,n.createElement(O.M,null,n.createElement(F,null,t)))}]);function dt(e){let{children:t}=e;return n.createElement(ct,null,t)}function lt(e){let{error:t,tryAgain:a}=e;return n.createElement("main",{className:"container margin-vert--xl"},n.createElement("div",{className:"row"},n.createElement("div",{className:"col col--6 col--offset-3"},n.createElement("h1",{className:"hero__title"},n.createElement(d.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),n.createElement("p",null,t.message),n.createElement("div",null,n.createElement("button",{type:"button",onClick:a},n.createElement(d.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again when the page crashed"},"Try again"))))))}const ut="mainWrapper_z2l0";function pt(e){const{children:t,noFooter:a,wrapperClassName:i,title:c,description:d}=e;return(0,h.t)(),n.createElement(dt,null,n.createElement(s.d,{title:c,description:d}),n.createElement(y,null),n.createElement(L,null),n.createElement(He,null),n.createElement("div",{id:u,className:(0,r.Z)(g.k.wrapper.main,ut,i)},n.createElement(o.Z,{fallback:e=>n.createElement(lt,e)},t)),!a&&n.createElement(it,null))}},90197:(e,t,a)=>{"use strict";a.d(t,{Z:()=>o});var n=a(67294),r=a(35742);function o(e){let{locale:t,version:a,tag:o}=e;const s=t;return n.createElement(r.Z,null,t&&n.createElement("meta",{name:"docusaurus_locale",content:t}),a&&n.createElement("meta",{name:"docusaurus_version",content:a}),o&&n.createElement("meta",{name:"docusaurus_tag",content:o}),s&&n.createElement("meta",{name:"docsearch:language",content:s}),a&&n.createElement("meta",{name:"docsearch:version",content:a}),o&&n.createElement("meta",{name:"docsearch:docusaurus_tag",content:o}))}},50941:(e,t,a)=>{"use strict";a.d(t,{Z:()=>d});var n=a(87462),r=a(67294),o=a(86010),s=a(72389),i=a(92949);const c={themedImage:"themedImage_ToTc","themedImage--light":"themedImage--light_HNdA","themedImage--dark":"themedImage--dark_i4oU"};function d(e){const t=(0,s.Z)(),{colorMode:a}=(0,i.I)(),{sources:d,className:l,alt:u,...p}=e,b=t?"dark"===a?["dark"]:["light"]:["light","dark"];return r.createElement(r.Fragment,null,b.map((e=>r.createElement("img",(0,n.Z)({key:e,src:d[e],alt:u,className:(0,o.Z)(c.themedImage,c[`themedImage--${e}`],l)},p)))))}},86043:(e,t,a)=>{"use strict";a.d(t,{u:()=>s,z:()=>f});var n=a(87462),r=a(67294),o=a(10412);function s(e){let{initialState:t}=e;const[a,n]=(0,r.useState)(t??!1),o=(0,r.useCallback)((()=>{n((e=>!e))}),[]);return{collapsed:a,setCollapsed:n,toggleCollapsed:o}}const i={display:"none",overflow:"hidden",height:"0px"},c={display:"block",overflow:"visible",height:"auto"};function d(e,t){const a=t?i:c;e.style.display=a.display,e.style.overflow=a.overflow,e.style.height=a.height}function l(e){let{collapsibleRef:t,collapsed:a,animation:n}=e;const o=(0,r.useRef)(!1);(0,r.useEffect)((()=>{const e=t.current;function r(){const t=e.scrollHeight,a=n?.duration??function(e){const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${a}ms ${n?.easing??"ease-in-out"}`,height:`${t}px`}}function s(){const t=r();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return d(e,a),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{a?(s(),requestAnimationFrame((()=>{e.style.height=i.height,e.style.overflow=i.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{s()})))}));return()=>cancelAnimationFrame(t)}()}),[t,a,n])}function u(e){if(!o.Z.canUseDOM)return e?i:c}function p(e){let{as:t="div",collapsed:a,children:n,animation:o,onCollapseTransitionEnd:s,className:i,disableSSRStyle:c}=e;const p=(0,r.useRef)(null);return l({collapsibleRef:p,collapsed:a,animation:o}),r.createElement(t,{ref:p,style:c?void 0:u(a),onTransitionEnd:e=>{"height"===e.propertyName&&(d(p.current,a),s?.(a))},className:i},n)}function b(e){let{collapsed:t,...a}=e;const[o,s]=(0,r.useState)(!t),[i,c]=(0,r.useState)(t);return(0,r.useLayoutEffect)((()=>{t||s(!0)}),[t]),(0,r.useLayoutEffect)((()=>{o&&c(t)}),[o,t]),o?r.createElement(p,(0,n.Z)({},a,{collapsed:i})):null}function f(e){let{lazy:t,...a}=e;const n=t?b:p;return r.createElement(n,a)}},59689:(e,t,a)=>{"use strict";a.d(t,{nT:()=>f,pl:()=>b});var n=a(67294),r=a(72389),o=a(50012),s=a(902),i=a(86668);const c=(0,o.WA)("docusaurus.announcement.dismiss"),d=(0,o.WA)("docusaurus.announcement.id"),l=()=>"true"===c.get(),u=e=>c.set(String(e)),p=n.createContext(null);function b(e){let{children:t}=e;const a=function(){const{announcementBar:e}=(0,i.L)(),t=(0,r.Z)(),[a,o]=(0,n.useState)((()=>!!t&&l()));(0,n.useEffect)((()=>{o(l())}),[]);const s=(0,n.useCallback)((()=>{u(!0),o(!0)}),[]);return(0,n.useEffect)((()=>{if(!e)return;const{id:t}=e;let a=d.get();"annoucement-bar"===a&&(a="announcement-bar");const n=t!==a;d.set(t),n&&u(!1),!n&&l()||o(!1)}),[e]),(0,n.useMemo)((()=>({isActive:!!e&&!a,close:s})),[e,a,s])}();return n.createElement(p.Provider,{value:a},t)}function f(){const e=(0,n.useContext)(p);if(!e)throw new s.i6("AnnouncementBarProvider");return e}},92949:(e,t,a)=>{"use strict";a.d(t,{I:()=>g,S:()=>m});var n=a(67294),r=a(10412),o=a(902),s=a(50012),i=a(86668);const c=n.createContext(void 0),d="theme",l=(0,s.WA)(d),u="light",p="dark",b=e=>e===p?p:u;function f(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:a}}=(0,i.L)(),[o,s]=(0,n.useState)((e=>r.Z.canUseDOM?b(document.documentElement.getAttribute("data-theme")):b(e))(e));(0,n.useEffect)((()=>{t&&l.del()}),[t]);const c=(0,n.useCallback)((function(t,n){void 0===n&&(n={});const{persist:r=!0}=n;t?(s(t),r&&(e=>{l.set(b(e))})(t)):(s(a?window.matchMedia("(prefers-color-scheme: dark)").matches?p:u:e),l.del())}),[a,e]);(0,n.useEffect)((()=>{document.documentElement.setAttribute("data-theme",b(o))}),[o]),(0,n.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==d)return;const t=l.get();null!==t&&c(b(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,c]);const f=(0,n.useRef)(!1);return(0,n.useEffect)((()=>{if(t&&!a)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>{window.matchMedia("print").matches||f.current?f.current=window.matchMedia("print").matches:c(null)};return e.addListener(n),()=>e.removeListener(n)}),[c,t,a]),(0,n.useMemo)((()=>({colorMode:o,setColorMode:c,get isDarkTheme(){return o===p},setLightTheme(){c(u)},setDarkTheme(){c(p)}})),[o,c])}function m(e){let{children:t}=e;const a=f();return n.createElement(c.Provider,{value:a},t)}function g(){const e=(0,n.useContext)(c);if(null==e)throw new o.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},60373:(e,t,a)=>{"use strict";a.d(t,{J:()=>y,L5:()=>h});var n=a(67294),r=a(94104),o=a(29935),s=a(86668),i=a(53438),c=a(902),d=a(50012);const l=e=>`docs-preferred-version-${e}`,u=(e,t,a)=>{(0,d.WA)(l(e),{persistence:t}).set(a)},p=(e,t)=>(0,d.WA)(l(e),{persistence:t}).get(),b=(e,t)=>{(0,d.WA)(l(e),{persistence:t}).del()};const f=n.createContext(null);function m(){const e=(0,r._r)(),t=(0,s.L)().docs.versionPersistence,a=(0,n.useMemo)((()=>Object.keys(e)),[e]),[o,i]=(0,n.useState)((()=>(e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}]))))(a)));(0,n.useEffect)((()=>{i(function(e){let{pluginIds:t,versionPersistence:a,allDocsData:n}=e;function r(e){const t=p(e,a);return n[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(b(e,a),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,r(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:a}))}),[e,t,a]);return[o,(0,n.useMemo)((()=>({savePreferredVersion:function(e,a){u(e,t,a),i((t=>({...t,[e]:{preferredVersionName:a}})))}})),[t])]}function g(e){let{children:t}=e;const a=m();return n.createElement(f.Provider,{value:a},t)}function h(e){let{children:t}=e;return i.cE?n.createElement(g,null,t):n.createElement(n.Fragment,null,t)}function v(){const e=(0,n.useContext)(f);if(!e)throw new c.i6("DocsPreferredVersionContextProvider");return e}function y(e){void 0===e&&(e=o.m);const t=(0,r.zh)(e),[a,s]=v(),{preferredVersionName:i}=a[e];return{preferredVersion:t.versions.find((e=>e.name===i))??null,savePreferredVersionName:(0,n.useCallback)((t=>{s.savePreferredVersion(e,t)}),[s,e])}}},1116:(e,t,a)=>{"use strict";a.d(t,{V:()=>c,b:()=>i});var n=a(67294),r=a(902);const o=Symbol("EmptyContext"),s=n.createContext(o);function i(e){let{children:t,name:a,items:r}=e;const o=(0,n.useMemo)((()=>a&&r?{name:a,items:r}:null),[a,r]);return n.createElement(s.Provider,{value:o},t)}function c(){const e=(0,n.useContext)(s);if(e===o)throw new r.i6("DocsSidebarProvider");return e}},74477:(e,t,a)=>{"use strict";a.d(t,{E:()=>i,q:()=>s});var n=a(67294),r=a(902);const o=n.createContext(null);function s(e){let{children:t,version:a}=e;return n.createElement(o.Provider,{value:a},t)}function i(){const e=(0,n.useContext)(o);if(null===e)throw new r.i6("DocsVersionProvider");return e}},93163:(e,t,a)=>{"use strict";a.d(t,{M:()=>u,e:()=>p});var n=a(67294),r=a(13102),o=a(87524),s=a(91980),i=a(86668),c=a(902);const d=n.createContext(void 0);function l(){const e=function(){const e=(0,r.HY)(),{items:t}=(0,i.L)().navbar;return 0===t.length&&!e.component}(),t=(0,o.i)(),a=!e&&"mobile"===t,[c,d]=(0,n.useState)(!1);(0,s.Rb)((()=>{if(c)return d(!1),!1}));const l=(0,n.useCallback)((()=>{d((e=>!e))}),[]);return(0,n.useEffect)((()=>{"desktop"===t&&d(!1)}),[t]),(0,n.useMemo)((()=>({disabled:e,shouldRender:a,toggle:l,shown:c})),[e,a,l,c])}function u(e){let{children:t}=e;const a=l();return n.createElement(d.Provider,{value:a},t)}function p(){const e=n.useContext(d);if(void 0===e)throw new c.i6("NavbarMobileSidebarProvider");return e}},13102:(e,t,a)=>{"use strict";a.d(t,{HY:()=>i,Zo:()=>c,n2:()=>s});var n=a(67294),r=a(902);const o=n.createContext(null);function s(e){let{children:t}=e;const a=(0,n.useState)({component:null,props:null});return n.createElement(o.Provider,{value:a},t)}function i(){const e=(0,n.useContext)(o);if(!e)throw new r.i6("NavbarSecondaryMenuContentProvider");return e[0]}function c(e){let{component:t,props:a}=e;const s=(0,n.useContext)(o);if(!s)throw new r.i6("NavbarSecondaryMenuContentProvider");const[,i]=s,c=(0,r.Ql)(a);return(0,n.useEffect)((()=>{i({component:t,props:c})}),[i,t,c]),(0,n.useEffect)((()=>()=>i({component:null,props:null})),[i]),null}},19727:(e,t,a)=>{"use strict";a.d(t,{h:()=>r,t:()=>o});var n=a(67294);const r="navigation-with-keyboard";function o(){(0,n.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(r),"mousedown"===e.type&&document.body.classList.remove(r)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(r),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},87524:(e,t,a)=>{"use strict";a.d(t,{i:()=>d});var n=a(67294),r=a(10412);const o="desktop",s="mobile",i="ssr";function c(){return r.Z.canUseDOM?window.innerWidth>996?o:s:i}function d(){const[e,t]=(0,n.useState)((()=>c()));return(0,n.useEffect)((()=>{function e(){t(c())}return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),clearTimeout(undefined)}}),[]),e}},35281:(e,t,a)=>{"use strict";a.d(t,{k:()=>n});const n={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},53438:(e,t,a)=>{"use strict";a.d(t,{MN:()=>w,Wl:()=>f,_F:()=>h,cE:()=>p,hI:()=>k,jA:()=>m,lO:()=>_,oz:()=>S,s1:()=>y,vY:()=>x,xz:()=>b});var n=a(67294),r=a(16550),o=a(18790),s=a(94104),i=a(60373),c=a(74477),d=a(1116),l=a(67392),u=a(48596);const p=!!s._r;function b(e){const t=(0,c.E)();if(!e)return;const a=t.docs[e];if(!a)throw new Error(`no version doc found by id=${e}`);return a}function f(e){if(e.href)return e.href;for(const t of e.items){if("link"===t.type)return t.href;if("category"===t.type){const e=f(t);if(e)return e}}}function m(){const{pathname:e}=(0,r.TH)(),t=(0,d.V)();if(!t)throw new Error("Unexpected: cant find current sidebar in context");const a=v({sidebarItems:t.items,pathname:e,onlyCategories:!0}).slice(-1)[0];if(!a)throw new Error(`${e} is not associated with a category. useCurrentSidebarCategory() should only be used on category index pages.`);return a}const g=(e,t)=>void 0!==e&&(0,u.Mg)(e,t);function h(e,t){return"link"===e.type?g(e.href,t):"category"===e.type&&(g(e.href,t)||((e,t)=>e.some((e=>h(e,t))))(e.items,t))}function v(e){let{sidebarItems:t,pathname:a,onlyCategories:n=!1}=e;const r=[];return function e(t){for(const o of t)if("category"===o.type&&((0,u.Mg)(o.href,a)||e(o.items))||"link"===o.type&&(0,u.Mg)(o.href,a)){return n&&"category"!==o.type||r.unshift(o),!0}return!1}(t),r}function y(){const e=(0,d.V)(),{pathname:t}=(0,r.TH)(),a=(0,s.gA)()?.pluginData.breadcrumbs;return!1!==a&&e?v({sidebarItems:e.items,pathname:t}):null}function _(e){const{activeVersion:t}=(0,s.Iw)(e),{preferredVersion:a}=(0,i.J)(e),r=(0,s.yW)(e);return(0,n.useMemo)((()=>(0,l.j)([t,a,r].filter(Boolean))),[t,a,r])}function S(e,t){const a=_(t);return(0,n.useMemo)((()=>{const t=a.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),n=t.find((t=>t[0]===e));if(!n)throw new Error(`Can't find any sidebar with id "${e}" in version${a.length>1?"s":""} ${a.map((e=>e.name)).join(", ")}".\n Available sidebar ids are:\n - ${Object.keys(t).join("\n- ")}`);return n[1]}),[e,a])}function x(e,t){const a=_(t);return(0,n.useMemo)((()=>{const t=a.flatMap((e=>e.docs)),n=t.find((t=>t.id===e));if(!n){if(a.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`DocNavbarItem: couldn't find any doc with id "${e}" in version${a.length>1?"s":""} ${a.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${(0,l.j)(t.map((e=>e.id))).join("\n- ")}`)}return n}),[e,a])}function k(e){let{route:t,versionMetadata:a}=e;const n=(0,r.TH)(),s=t.routes,i=s.find((e=>(0,r.LX)(n.pathname,e)));if(!i)return null;const c=i.sidebar,d=c?a.docsSidebars[c]:void 0;return{docElement:(0,o.H)(s),sidebarName:c,sidebarItems:d}}function w(e){return e.filter((e=>"category"!==e.type||!!f(e)))}},91980:(e,t,a)=>{"use strict";a.d(t,{Rb:()=>i,_X:()=>c});var n=a(67294),r=a(16550),o=a(61688),s=a(902);function i(e){!function(e){const t=(0,r.k6)(),a=(0,s.zX)(e);(0,n.useEffect)((()=>t.block(((e,t)=>a(e,t)))),[t,a])}(((t,a)=>{if("POP"===a)return e(t,a)}))}function c(e){return function(e){const t=(0,r.k6)();return(0,o.useSyncExternalStore)(t.listen,(()=>e(t)),(()=>e(t)))}((t=>null===e?null:new URLSearchParams(t.location.search).get(e)))}},67392:(e,t,a)=>{"use strict";function n(e,t){return void 0===t&&(t=(e,t)=>e===t),e.filter(((a,n)=>e.findIndex((e=>t(e,a)))!==n))}function r(e){return Array.from(new Set(e))}a.d(t,{j:()=>r,l:()=>n})},1944:(e,t,a)=>{"use strict";a.d(t,{FG:()=>p,d:()=>l,VC:()=>b});var n=a(67294),r=a(86010),o=a(35742),s=a(30226);function i(){const e=n.useContext(s._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var c=a(44996),d=a(52263);function l(e){let{title:t,description:a,keywords:r,image:s,children:i}=e;const l=function(e){const{siteConfig:t}=(0,d.Z)(),{title:a,titleDelimiter:n}=t;return e?.trim().length?`${e.trim()} ${n} ${a}`:a}(t),{withBaseUrl:u}=(0,c.C)(),p=s?u(s,{absolute:!0}):void 0;return n.createElement(o.Z,null,t&&n.createElement("title",null,l),t&&n.createElement("meta",{property:"og:title",content:l}),a&&n.createElement("meta",{name:"description",content:a}),a&&n.createElement("meta",{property:"og:description",content:a}),r&&n.createElement("meta",{name:"keywords",content:Array.isArray(r)?r.join(","):r}),p&&n.createElement("meta",{property:"og:image",content:p}),p&&n.createElement("meta",{name:"twitter:image",content:p}),i)}const u=n.createContext(void 0);function p(e){let{className:t,children:a}=e;const s=n.useContext(u),i=(0,r.Z)(s,t);return n.createElement(u.Provider,{value:i},n.createElement(o.Z,null,n.createElement("html",{className:i})),a)}function b(e){let{children:t}=e;const a=i(),o=`plugin-${a.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const s=`plugin-id-${a.plugin.id}`;return n.createElement(p,{className:(0,r.Z)(o,s)},t)}},902:(e,t,a)=>{"use strict";a.d(t,{D9:()=>s,Qc:()=>d,Ql:()=>c,i6:()=>i,zX:()=>o});var n=a(67294);const r=a(10412).Z.canUseDOM?n.useLayoutEffect:n.useEffect;function o(e){const t=(0,n.useRef)(e);return r((()=>{t.current=e}),[e]),(0,n.useCallback)((function(){return t.current(...arguments)}),[])}function s(e){const t=(0,n.useRef)();return r((()=>{t.current=e})),t.current}class i extends Error{constructor(e,t){super(),this.name="ReactContextError",this.message=`Hook ${this.stack?.split("\n")[1]?.match(/at (?:\w+\.)?(?<name>\w+)/)?.groups.name??""} is called outside the <${e}>. ${t??""}`}}function c(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,n.useMemo)((()=>e),t.flat())}function d(e){return t=>{let{children:a}=t;return n.createElement(n.Fragment,null,e.reduceRight(((e,t)=>n.createElement(t,null,e)),a))}}},48596:(e,t,a)=>{"use strict";a.d(t,{Mg:()=>s,Ns:()=>i});var n=a(67294),r=a(723),o=a(52263);function s(e,t){const a=e=>(!e||e.endsWith("/")?e:`${e}/`)?.toLowerCase();return a(e)===a(t)}function i(){const{baseUrl:e}=(0,o.Z)().siteConfig;return(0,n.useMemo)((()=>function(e){let{baseUrl:t,routes:a}=e;function n(e){return e.path===t&&!0===e.exact}function r(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(n)||e(t.filter(r).flatMap((e=>e.routes??[])))}(a)}({routes:r.Z,baseUrl:e})),[e])}},12466:(e,t,a)=>{"use strict";a.d(t,{Ct:()=>b,OC:()=>c,RF:()=>u,o5:()=>p});var n=a(67294),r=a(10412),o=a(72389),s=a(902);const i=n.createContext(void 0);function c(e){let{children:t}=e;const a=function(){const e=(0,n.useRef)(!0);return(0,n.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return n.createElement(i.Provider,{value:a},t)}function d(){const e=(0,n.useContext)(i);if(null==e)throw new s.i6("ScrollControllerProvider");return e}const l=()=>r.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function u(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:a}=d(),r=(0,n.useRef)(l()),o=(0,s.zX)(e);(0,n.useEffect)((()=>{const e=()=>{if(!a.current)return;const e=l();o(e,r.current),r.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[o,a,...t])}function p(){const e=d(),t=function(){const e=(0,n.useRef)({elem:null,top:0}),t=(0,n.useCallback)((t=>{e.current={elem:t,top:t.getBoundingClientRect().top}}),[]),a=(0,n.useCallback)((()=>{const{current:{elem:t,top:a}}=e;if(!t)return{restored:!1};const n=t.getBoundingClientRect().top-a;return n&&window.scrollBy({left:0,top:n}),e.current={elem:null,top:0},{restored:0!==n}}),[]);return(0,n.useMemo)((()=>({save:t,restore:a})),[a,t])}(),a=(0,n.useRef)(void 0),r=(0,n.useCallback)((n=>{t.save(n),e.disableScrollEvents(),a.current=()=>{const{restored:n}=t.restore();if(a.current=void 0,n){const t=()=>{e.enableScrollEvents(),window.removeEventListener("scroll",t)};window.addEventListener("scroll",t)}else e.enableScrollEvents()}}),[e,t]);return(0,n.useLayoutEffect)((()=>{queueMicrotask((()=>a.current?.()))})),{blockElementScrollPositionUntilNextRender:r}}function b(){const e=(0,n.useRef)(null),t=(0,o.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:a=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(a):function(e){let t=null;const a=document.documentElement.scrollTop>e;return function n(){const r=document.documentElement.scrollTop;(a&&r>e||!a&&r<e)&&(t=requestAnimationFrame(n),window.scrollTo(0,Math.floor(.85*(r-e))+e))}(),()=>t&&cancelAnimationFrame(t)}(a)},cancelScroll:()=>e.current?.()}}},43320:(e,t,a)=>{"use strict";a.d(t,{HX:()=>n,os:()=>r});a(52263);const n="default";function r(e,t){return`docs-${e}-${t}`}},50012:(e,t,a)=>{"use strict";a.d(t,{Nk:()=>u,WA:()=>l});var n=a(67294),r=a(61688);const o="localStorage";function s(e){let{key:t,oldValue:a,newValue:n,storage:r}=e;if(a===n)return;const o=document.createEvent("StorageEvent");o.initStorageEvent("storage",!1,!1,t,a,n,window.location.href,r),window.dispatchEvent(o)}function i(e){if(void 0===e&&(e=o),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(a){return t=a,c||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),c=!0),null}var t}let c=!1;const d={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function l(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t,listen:t}}(e);const a=i(t?.persistence);return null===a?d:{get:()=>{try{return a.getItem(e)}catch(t){return console.error(`Docusaurus storage error, can't get key=${e}`,t),null}},set:t=>{try{const n=a.getItem(e);a.setItem(e,t),s({key:e,oldValue:n,newValue:t,storage:a})}catch(n){console.error(`Docusaurus storage error, can't set ${e}=${t}`,n)}},del:()=>{try{const t=a.getItem(e);a.removeItem(e),s({key:e,oldValue:t,newValue:null,storage:a})}catch(t){console.error(`Docusaurus storage error, can't delete key=${e}`,t)}},listen:t=>{try{const n=n=>{n.storageArea===a&&n.key===e&&t(n)};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)}catch(n){return console.error(`Docusaurus storage error, can't listen for changes of key=${e}`,n),()=>{}}}}}function u(e,t){const a=(0,n.useRef)((()=>null===e?d:l(e,t))).current(),o=(0,n.useCallback)((e=>"undefined"==typeof window?()=>{}:a.listen(e)),[a]);return[(0,r.useSyncExternalStore)(o,(()=>"undefined"==typeof window?null:a.get()),(()=>null)),a]}},94711:(e,t,a)=>{"use strict";a.d(t,{l:()=>o});var n=a(52263),r=a(16550);function o(){const{siteConfig:{baseUrl:e,url:t},i18n:{defaultLocale:a,currentLocale:o}}=(0,n.Z)(),{pathname:s}=(0,r.TH)(),i=o===a?e:e.replace(`/${o}/`,"/"),c=s.replace(e,"");return{createUrl:function(e){let{locale:n,fullyQualified:r}=e;return`${r?t:""}${function(e){return e===a?`${i}`:`${i}${e}/`}(n)}${c}`}}}},85936:(e,t,a)=>{"use strict";a.d(t,{S:()=>s});var n=a(67294),r=a(16550),o=a(902);function s(e){const t=(0,r.TH)(),a=(0,o.D9)(t),s=(0,o.zX)(e);(0,n.useEffect)((()=>{a&&t!==a&&s({location:t,previousLocation:a})}),[s,t,a])}},86668:(e,t,a)=>{"use strict";a.d(t,{L:()=>r});var n=a(52263);function r(){return(0,n.Z)().siteConfig.themeConfig}},8802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const{trailingSlash:a,baseUrl:n}=t;if(e.startsWith("#"))return e;if(void 0===a)return e;const[r]=e.split(/[#?]/),o="/"===r||r===n?r:(s=r,a?function(e){return e.endsWith("/")?e:`${e}/`}(s):function(e){return e.endsWith("/")?e.slice(0,-1):e}(s));var s;return e.replace(r,o)}},18780:function(e,t,a){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="post-content";var r=a(8802);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return n(r).default}})},11231:(e,t,a)=>{"use strict";a.d(t,{Z:()=>u});var n=a(87462),r=a(67294),o=a(39960),s=a(44996),i=a(52263),c=a(86668),d=a(50941);function l(e){let{logo:t,alt:a,imageClassName:n}=e;const o={light:(0,s.Z)(t.src),dark:(0,s.Z)(t.srcDark||t.src)},i=r.createElement(d.Z,{className:t.className,sources:o,height:t.height,width:t.width,alt:a,style:t.style});return n?r.createElement("div",{className:n},i):i}function u(e){const{siteConfig:{title:t}}=(0,i.Z)(),{navbar:{title:a,logo:s}}=(0,c.L)(),{imageClassName:d,titleClassName:u,...p}=e,b=a?"":t,f=s?.alt??b;return r.createElement(o.Z,(0,n.Z)({},p,s?.target&&{target:s.target}),s&&r.createElement(l,{logo:s,alt:f,imageClassName:d}),null!=a&&r.createElement("b",{className:u},a))}},86010:(e,t,a)=>{"use strict";function n(e){var t,a,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(a=n(e[t]))&&(r&&(r+=" "),r+=a);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}a.d(t,{Z:()=>r});const r=function(){for(var e,t,a=0,r="";a<arguments.length;)(e=arguments[a++])&&(t=n(e))&&(r&&(r+=" "),r+=t);return r}},99318:(e,t,a)=>{"use strict";a.d(t,{lX:()=>_,q_:()=>C,ob:()=>b,PP:()=>I,Ep:()=>p});var n=a(87462);function r(e){return"/"===e.charAt(0)}function o(e,t){for(var a=t,n=a+1,r=e.length;n<r;a+=1,n+=1)e[a]=e[n];e.pop()}const s=function(e,t){void 0===t&&(t="");var a,n=e&&e.split("/")||[],s=t&&t.split("/")||[],i=e&&r(e),c=t&&r(t),d=i||c;if(e&&r(e)?s=n:n.length&&(s.pop(),s=s.concat(n)),!s.length)return"/";if(s.length){var l=s[s.length-1];a="."===l||".."===l||""===l}else a=!1;for(var u=0,p=s.length;p>=0;p--){var b=s[p];"."===b?o(s,p):".."===b?(o(s,p),u++):u&&(o(s,p),u--)}if(!d)for(;u--;u)s.unshift("..");!d||""===s[0]||s[0]&&r(s[0])||s.unshift("");var f=s.join("/");return a&&"/"!==f.substr(-1)&&(f+="/"),f};var i=a(38776);function c(e){return"/"===e.charAt(0)?e:"/"+e}function d(e){return"/"===e.charAt(0)?e.substr(1):e}function l(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function u(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var t=e.pathname,a=e.search,n=e.hash,r=t||"/";return a&&"?"!==a&&(r+="?"===a.charAt(0)?a:"?"+a),n&&"#"!==n&&(r+="#"===n.charAt(0)?n:"#"+n),r}function b(e,t,a,r){var o;"string"==typeof e?(o=function(e){var t=e||"/",a="",n="",r=t.indexOf("#");-1!==r&&(n=t.substr(r),t=t.substr(0,r));var o=t.indexOf("?");return-1!==o&&(a=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===a?"":a,hash:"#"===n?"":n}}(e),o.state=t):(void 0===(o=(0,n.Z)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(i){throw i instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):i}return a&&(o.key=a),r?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=s(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o}function f(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,a,n,r){if(null!=e){var o="function"==typeof e?e(t,a):e;"string"==typeof o?"function"==typeof n?n(o,r):r(!0):r(!1!==o)}else r(!0)},appendListener:function(e){var a=!0;function n(){a&&e.apply(void 0,arguments)}return t.push(n),function(){a=!1,t=t.filter((function(e){return e!==n}))}},notifyListeners:function(){for(var e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];t.forEach((function(e){return e.apply(void 0,a)}))}}}var m=!("undefined"==typeof window||!window.document||!window.document.createElement);function g(e,t){t(window.confirm(e))}var h="popstate",v="hashchange";function y(){try{return window.history.state||{}}catch(e){return{}}}function _(e){void 0===e&&(e={}),m||(0,i.Z)(!1);var t,a=window.history,r=(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,o=!(-1===window.navigator.userAgent.indexOf("Trident")),s=e,d=s.forceRefresh,_=void 0!==d&&d,S=s.getUserConfirmation,x=void 0===S?g:S,k=s.keyLength,w=void 0===k?6:k,E=e.basename?u(c(e.basename)):"";function C(e){var t=e||{},a=t.key,n=t.state,r=window.location,o=r.pathname+r.search+r.hash;return E&&(o=l(o,E)),b(o,n,a)}function T(){return Math.random().toString(36).substr(2,w)}var I=f();function N(e){(0,n.Z)($,e),$.length=a.length,I.notifyListeners($.location,$.action)}function A(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||P(C(e.state))}function L(){P(C(y()))}var O=!1;function P(e){if(O)O=!1,N();else{I.confirmTransitionTo(e,"POP",x,(function(t){t?N({action:"POP",location:e}):function(e){var t=$.location,a=M.indexOf(t.key);-1===a&&(a=0);var n=M.indexOf(e.key);-1===n&&(n=0);var r=a-n;r&&(O=!0,F(r))}(e)}))}}var R=C(y()),M=[R.key];function D(e){return E+p(e)}function F(e){a.go(e)}var j=0;function B(e){1===(j+=e)&&1===e?(window.addEventListener(h,A),o&&window.addEventListener(v,L)):0===j&&(window.removeEventListener(h,A),o&&window.removeEventListener(v,L))}var z=!1;var $={length:a.length,action:"POP",location:R,createHref:D,push:function(e,t){var n="PUSH",o=b(e,t,T(),$.location);I.confirmTransitionTo(o,n,x,(function(e){if(e){var t=D(o),s=o.key,i=o.state;if(r)if(a.pushState({key:s,state:i},null,t),_)window.location.href=t;else{var c=M.indexOf($.location.key),d=M.slice(0,c+1);d.push(o.key),M=d,N({action:n,location:o})}else window.location.href=t}}))},replace:function(e,t){var n="REPLACE",o=b(e,t,T(),$.location);I.confirmTransitionTo(o,n,x,(function(e){if(e){var t=D(o),s=o.key,i=o.state;if(r)if(a.replaceState({key:s,state:i},null,t),_)window.location.replace(t);else{var c=M.indexOf($.location.key);-1!==c&&(M[c]=o.key),N({action:n,location:o})}else window.location.replace(t)}}))},go:F,goBack:function(){F(-1)},goForward:function(){F(1)},block:function(e){void 0===e&&(e=!1);var t=I.setPrompt(e);return z||(B(1),z=!0),function(){return z&&(z=!1,B(-1)),t()}},listen:function(e){var t=I.appendListener(e);return B(1),function(){B(-1),t()}}};return $}var S="hashchange",x={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+d(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:d,decodePath:c},slash:{encodePath:c,decodePath:c}};function k(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function w(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function E(e){window.location.replace(k(window.location.href)+"#"+e)}function C(e){void 0===e&&(e={}),m||(0,i.Z)(!1);var t=window.history,a=(window.navigator.userAgent.indexOf("Firefox"),e),r=a.getUserConfirmation,o=void 0===r?g:r,s=a.hashType,d=void 0===s?"slash":s,h=e.basename?u(c(e.basename)):"",v=x[d],y=v.encodePath,_=v.decodePath;function C(){var e=_(w());return h&&(e=l(e,h)),b(e)}var T=f();function I(e){(0,n.Z)(z,e),z.length=t.length,T.notifyListeners(z.location,z.action)}var N=!1,A=null;function L(){var e,t,a=w(),n=y(a);if(a!==n)E(n);else{var r=C(),s=z.location;if(!N&&(t=r,(e=s).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(A===p(r))return;A=null,function(e){if(N)N=!1,I();else{var t="POP";T.confirmTransitionTo(e,t,o,(function(a){a?I({action:t,location:e}):function(e){var t=z.location,a=M.lastIndexOf(p(t));-1===a&&(a=0);var n=M.lastIndexOf(p(e));-1===n&&(n=0);var r=a-n;r&&(N=!0,D(r))}(e)}))}}(r)}}var O=w(),P=y(O);O!==P&&E(P);var R=C(),M=[p(R)];function D(e){t.go(e)}var F=0;function j(e){1===(F+=e)&&1===e?window.addEventListener(S,L):0===F&&window.removeEventListener(S,L)}var B=!1;var z={length:t.length,action:"POP",location:R,createHref:function(e){var t=document.querySelector("base"),a="";return t&&t.getAttribute("href")&&(a=k(window.location.href)),a+"#"+y(h+p(e))},push:function(e,t){var a="PUSH",n=b(e,void 0,void 0,z.location);T.confirmTransitionTo(n,a,o,(function(e){if(e){var t=p(n),r=y(h+t);if(w()!==r){A=t,function(e){window.location.hash=e}(r);var o=M.lastIndexOf(p(z.location)),s=M.slice(0,o+1);s.push(t),M=s,I({action:a,location:n})}else I()}}))},replace:function(e,t){var a="REPLACE",n=b(e,void 0,void 0,z.location);T.confirmTransitionTo(n,a,o,(function(e){if(e){var t=p(n),r=y(h+t);w()!==r&&(A=t,E(r));var o=M.indexOf(p(z.location));-1!==o&&(M[o]=t),I({action:a,location:n})}}))},go:D,goBack:function(){D(-1)},goForward:function(){D(1)},block:function(e){void 0===e&&(e=!1);var t=T.setPrompt(e);return B||(j(1),B=!0),function(){return B&&(B=!1,j(-1)),t()}},listen:function(e){var t=T.appendListener(e);return j(1),function(){j(-1),t()}}};return z}function T(e,t,a){return Math.min(Math.max(e,t),a)}function I(e){void 0===e&&(e={});var t=e,a=t.getUserConfirmation,r=t.initialEntries,o=void 0===r?["/"]:r,s=t.initialIndex,i=void 0===s?0:s,c=t.keyLength,d=void 0===c?6:c,l=f();function u(e){(0,n.Z)(_,e),_.length=_.entries.length,l.notifyListeners(_.location,_.action)}function m(){return Math.random().toString(36).substr(2,d)}var g=T(i,0,o.length-1),h=o.map((function(e){return b(e,void 0,"string"==typeof e?m():e.key||m())})),v=p;function y(e){var t=T(_.index+e,0,_.entries.length-1),n=_.entries[t];l.confirmTransitionTo(n,"POP",a,(function(e){e?u({action:"POP",location:n,index:t}):u()}))}var _={length:h.length,action:"POP",location:h[g],index:g,entries:h,createHref:v,push:function(e,t){var n="PUSH",r=b(e,t,m(),_.location);l.confirmTransitionTo(r,n,a,(function(e){if(e){var t=_.index+1,a=_.entries.slice(0);a.length>t?a.splice(t,a.length-t,r):a.push(r),u({action:n,location:r,index:t,entries:a})}}))},replace:function(e,t){var n="REPLACE",r=b(e,t,m(),_.location);l.confirmTransitionTo(r,n,a,(function(e){e&&(_.entries[_.index]=r,u({action:n,location:r}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=_.index+e;return t>=0&&t<_.entries.length},block:function(e){return void 0===e&&(e=!1),l.setPrompt(e)},listen:function(e){return l.appendListener(e)}};return _}},8679:(e,t,a)=>{"use strict";var n=a(59864),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function c(e){return n.isMemo(e)?s:i[e.$$typeof]||r}i[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[n.Memo]=s;var d=Object.defineProperty,l=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,b=Object.getPrototypeOf,f=Object.prototype;e.exports=function e(t,a,n){if("string"!=typeof a){if(f){var r=b(a);r&&r!==f&&e(t,r,n)}var s=l(a);u&&(s=s.concat(u(a)));for(var i=c(t),m=c(a),g=0;g<s.length;++g){var h=s[g];if(!(o[h]||n&&n[h]||m&&m[h]||i&&i[h])){var v=p(a,h);try{d(t,h,v)}catch(y){}}}}return t}},41143:e=>{"use strict";e.exports=function(e,t,a,n,r,o,s,i){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[a,n,r,o,s,i],l=0;(c=new Error(t.replace(/%s/g,(function(){return d[l++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}},5826:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},813:function(e){e.exports=function(){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r=function(){function e(a){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=a,this.iframes=n,this.exclude=r,this.iframesTimeout=o}return a(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach((function(t){var a=e.filter((function(e){return e.contains(t)})).length>0;-1!==e.indexOf(t)||a||e.push(t)})),e}},{key:"getIframeContents",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=void 0;try{var r=e.contentWindow;if(n=r.document,!r||!n)throw new Error("iframe inaccessible")}catch(o){a()}n&&t(n)}},{key:"isIframeBlank",value:function(e){var t="about:blank",a=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&a!==t&&a}},{key:"observeIframeLoad",value:function(e,t,a){var n=this,r=!1,o=null,s=function s(){if(!r){r=!0,clearTimeout(o);try{n.isIframeBlank(e)||(e.removeEventListener("load",s),n.getIframeContents(e,t,a))}catch(i){a()}}};e.addEventListener("load",s),o=setTimeout(s,this.iframesTimeout)}},{key:"onIframeReady",value:function(e,t,a){try{"complete"===e.contentWindow.document.readyState?this.isIframeBlank(e)?this.observeIframeLoad(e,t,a):this.getIframeContents(e,t,a):this.observeIframeLoad(e,t,a)}catch(n){a()}}},{key:"waitForIframes",value:function(e,t){var a=this,n=0;this.forEachIframe(e,(function(){return!0}),(function(e){n++,a.waitForIframes(e.querySelector("html"),(function(){--n||t()}))}),(function(e){e||t()}))}},{key:"forEachIframe",value:function(t,a,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},s=t.querySelectorAll("iframe"),i=s.length,c=0;s=Array.prototype.slice.call(s);var d=function(){--i<=0&&o(c)};i||d(),s.forEach((function(t){e.matches(t,r.exclude)?d():r.onIframeReady(t,(function(e){a(t)&&(c++,n(e)),d()}),d)}))}},{key:"createIterator",value:function(e,t,a){return document.createNodeIterator(e,t,a,!1)}},{key:"createInstanceOnIframe",value:function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(e,t,a){if(e.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_PRECEDING){if(null===t)return!0;if(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e){var t=e.previousNode();return{prevNode:t,node:(null===t||e.nextNode())&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,a,n){var r=!1,o=!1;return n.forEach((function(e,t){e.val===a&&(r=t,o=e.handled)})),this.compareNodeIframe(e,t,a)?(!1!==r||o?!1===r||o||(n[r].handled=!0):n.push({val:a,handled:!0}),!0):(!1===r&&n.push({val:a,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(e,t,a,n){var r=this;e.forEach((function(e){e.handled||r.getIframeContents(e.val,(function(e){r.createInstanceOnIframe(e).forEachNode(t,a,n)}))}))}},{key:"iterateThroughNodes",value:function(e,t,a,n,r){for(var o=this,s=this.createIterator(t,e,n),i=[],c=[],d=void 0,l=void 0,u=function(){var e=o.getIteratorNode(s);return l=e.prevNode,d=e.node};u();)this.iframes&&this.forEachIframe(t,(function(e){return o.checkIframeFilter(d,l,e,i)}),(function(t){o.createInstanceOnIframe(t).forEachNode(e,(function(e){return c.push(e)}),n)})),c.push(d);c.forEach((function(e){a(e)})),this.iframes&&this.handleOpenIframes(i,e,a,n),r()}},{key:"forEachNode",value:function(e,t,a){var n=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),s=o.length;s||r(),o.forEach((function(o){var i=function(){n.iterateThroughNodes(e,o,t,a,(function(){--s<=0&&r()}))};n.iframes?n.waitForIframes(o,i):i()}))}}],[{key:"matches",value:function(e,t){var a="string"==typeof t?[t]:t,n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(n){var r=!1;return a.every((function(t){return!n.call(e,t)||(r=!0,!1)})),r}return!1}}]),e}(),o=function(){function o(e){t(this,o),this.ctx=e,this.ie=!1;var a=window.navigator.userAgent;(a.indexOf("MSIE")>-1||a.indexOf("Trident")>-1)&&(this.ie=!0)}return a(o,[{key:"log",value:function(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",n=this.opt.log;this.opt.debug&&"object"===(void 0===n?"undefined":e(n))&&"function"==typeof n[a]&&n[a]("mark.js: "+t)}},{key:"escapeStr",value:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(e){return"disabled"!==this.opt.wildcards&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.createWildcardsRegExp(e)),e=this.createAccuracyRegExp(e)}},{key:"createSynonymsRegExp",value:function(e){var t=this.opt.synonyms,a=this.opt.caseSensitive?"":"i",n=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var r in t)if(t.hasOwnProperty(r)){var o=t[r],s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(r):this.escapeStr(r),i="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==s&&""!==i&&(e=e.replace(new RegExp("("+this.escapeStr(s)+"|"+this.escapeStr(i)+")","gm"+a),n+"("+this.processSynomyms(s)+"|"+this.processSynomyms(i)+")"+n))}return e}},{key:"processSynomyms",value:function(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\)*\?/g,(function(e){return"\\"===e.charAt(0)?"?":"\x01"}))).replace(/(?:\\)*\*/g,(function(e){return"\\"===e.charAt(0)?"*":"\x02"}))}},{key:"createWildcardsRegExp",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,(function(e,t,a){var n=a.charAt(t+1);return/[(|)\\]/.test(n)||""===n?e:e+"\0"}))}},{key:"createJoinersRegExp",value:function(e){var t=[],a=this.opt.ignorePunctuation;return Array.isArray(a)&&a.length&&t.push(this.escapeStr(a.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:function(e){var t=this.opt.caseSensitive?"":"i",a=this.opt.caseSensitive?["a\xe0\xe1\u1ea3\xe3\u1ea1\u0103\u1eb1\u1eaf\u1eb3\u1eb5\u1eb7\xe2\u1ea7\u1ea5\u1ea9\u1eab\u1ead\xe4\xe5\u0101\u0105","A\xc0\xc1\u1ea2\xc3\u1ea0\u0102\u1eb0\u1eae\u1eb2\u1eb4\u1eb6\xc2\u1ea6\u1ea4\u1ea8\u1eaa\u1eac\xc4\xc5\u0100\u0104","c\xe7\u0107\u010d","C\xc7\u0106\u010c","d\u0111\u010f","D\u0110\u010e","e\xe8\xe9\u1ebb\u1ebd\u1eb9\xea\u1ec1\u1ebf\u1ec3\u1ec5\u1ec7\xeb\u011b\u0113\u0119","E\xc8\xc9\u1eba\u1ebc\u1eb8\xca\u1ec0\u1ebe\u1ec2\u1ec4\u1ec6\xcb\u011a\u0112\u0118","i\xec\xed\u1ec9\u0129\u1ecb\xee\xef\u012b","I\xcc\xcd\u1ec8\u0128\u1eca\xce\xcf\u012a","l\u0142","L\u0141","n\xf1\u0148\u0144","N\xd1\u0147\u0143","o\xf2\xf3\u1ecf\xf5\u1ecd\xf4\u1ed3\u1ed1\u1ed5\u1ed7\u1ed9\u01a1\u1edf\u1ee1\u1edb\u1edd\u1ee3\xf6\xf8\u014d","O\xd2\xd3\u1ece\xd5\u1ecc\xd4\u1ed2\u1ed0\u1ed4\u1ed6\u1ed8\u01a0\u1ede\u1ee0\u1eda\u1edc\u1ee2\xd6\xd8\u014c","r\u0159","R\u0158","s\u0161\u015b\u0219\u015f","S\u0160\u015a\u0218\u015e","t\u0165\u021b\u0163","T\u0164\u021a\u0162","u\xf9\xfa\u1ee7\u0169\u1ee5\u01b0\u1eeb\u1ee9\u1eed\u1eef\u1ef1\xfb\xfc\u016f\u016b","U\xd9\xda\u1ee6\u0168\u1ee4\u01af\u1eea\u1ee8\u1eec\u1eee\u1ef0\xdb\xdc\u016e\u016a","y\xfd\u1ef3\u1ef7\u1ef9\u1ef5\xff","Y\xdd\u1ef2\u1ef6\u1ef8\u1ef4\u0178","z\u017e\u017c\u017a","Z\u017d\u017b\u0179"]:["a\xe0\xe1\u1ea3\xe3\u1ea1\u0103\u1eb1\u1eaf\u1eb3\u1eb5\u1eb7\xe2\u1ea7\u1ea5\u1ea9\u1eab\u1ead\xe4\xe5\u0101\u0105A\xc0\xc1\u1ea2\xc3\u1ea0\u0102\u1eb0\u1eae\u1eb2\u1eb4\u1eb6\xc2\u1ea6\u1ea4\u1ea8\u1eaa\u1eac\xc4\xc5\u0100\u0104","c\xe7\u0107\u010dC\xc7\u0106\u010c","d\u0111\u010fD\u0110\u010e","e\xe8\xe9\u1ebb\u1ebd\u1eb9\xea\u1ec1\u1ebf\u1ec3\u1ec5\u1ec7\xeb\u011b\u0113\u0119E\xc8\xc9\u1eba\u1ebc\u1eb8\xca\u1ec0\u1ebe\u1ec2\u1ec4\u1ec6\xcb\u011a\u0112\u0118","i\xec\xed\u1ec9\u0129\u1ecb\xee\xef\u012bI\xcc\xcd\u1ec8\u0128\u1eca\xce\xcf\u012a","l\u0142L\u0141","n\xf1\u0148\u0144N\xd1\u0147\u0143","o\xf2\xf3\u1ecf\xf5\u1ecd\xf4\u1ed3\u1ed1\u1ed5\u1ed7\u1ed9\u01a1\u1edf\u1ee1\u1edb\u1edd\u1ee3\xf6\xf8\u014dO\xd2\xd3\u1ece\xd5\u1ecc\xd4\u1ed2\u1ed0\u1ed4\u1ed6\u1ed8\u01a0\u1ede\u1ee0\u1eda\u1edc\u1ee2\xd6\xd8\u014c","r\u0159R\u0158","s\u0161\u015b\u0219\u015fS\u0160\u015a\u0218\u015e","t\u0165\u021b\u0163T\u0164\u021a\u0162","u\xf9\xfa\u1ee7\u0169\u1ee5\u01b0\u1eeb\u1ee9\u1eed\u1eef\u1ef1\xfb\xfc\u016f\u016bU\xd9\xda\u1ee6\u0168\u1ee4\u01af\u1eea\u1ee8\u1eec\u1eee\u1ef0\xdb\xdc\u016e\u016a","y\xfd\u1ef3\u1ef7\u1ef9\u1ef5\xffY\xdd\u1ef2\u1ef6\u1ef8\u1ef4\u0178","z\u017e\u017c\u017aZ\u017d\u017b\u0179"],n=[];return e.split("").forEach((function(r){a.every((function(a){if(-1!==a.indexOf(r)){if(n.indexOf(a)>-1)return!1;e=e.replace(new RegExp("["+a+"]","gm"+t),"["+a+"]"),n.push(a)}return!0}))})),e}},{key:"createMergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(e){var t=this,a="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\xa1\xbf",n=this.opt.accuracy,r="string"==typeof n?n:n.value,o="string"==typeof n?[]:n.limiters,s="";switch(o.forEach((function(e){s+="|"+t.escapeStr(e)})),r){case"partially":default:return"()("+e+")";case"complementary":return"()([^"+(s="\\s"+(s||this.escapeStr(a)))+"]*"+e+"[^"+s+"]*)";case"exactly":return"(^|\\s"+s+")("+e+")(?=$|\\s"+s+")"}}},{key:"getSeparatedKeywords",value:function(e){var t=this,a=[];return e.forEach((function(e){t.opt.separateWordSearch?e.split(" ").forEach((function(e){e.trim()&&-1===a.indexOf(e)&&a.push(e)})):e.trim()&&-1===a.indexOf(e)&&a.push(e)})),{keywords:a.sort((function(e,t){return t.length-e.length})),length:a.length}}},{key:"isNumeric",value:function(e){return Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var a=[],n=0;return e.sort((function(e,t){return e.start-t.start})).forEach((function(e){var r=t.callNoMatchOnInvalidRanges(e,n),o=r.start,s=r.end;r.valid&&(e.start=o,e.length=s-o,a.push(e),n=s)})),a}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){var a=void 0,n=void 0,r=!1;return e&&void 0!==e.start?(n=(a=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&n-t>0&&n-a>0?r=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:a,end:n,valid:r}}},{key:"checkWhitespaceRanges",value:function(e,t,a){var n=void 0,r=!0,o=a.length,s=t-o,i=parseInt(e.start,10)-s;return(n=(i=i>o?o:i)+parseInt(e.length,10))>o&&(n=o,this.log("End range automatically set to the max value of "+o)),i<0||n-i<0||i>o||n>o?(r=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===a.substring(i,n).replace(/\s+/g,"")&&(r=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:i,end:n,valid:r}}},{key:"getTextNodes",value:function(e){var t=this,a="",n=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,(function(e){n.push({start:a.length,end:(a+=e.textContent).length,node:e})}),(function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),(function(){e({value:a,nodes:n})}))}},{key:"matchesExclude",value:function(e){return r.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,a){var n=this.opt.element?this.opt.element:"mark",r=e.splitText(t),o=r.splitText(a-t),s=document.createElement(n);return s.setAttribute("data-markjs","true"),this.opt.className&&s.setAttribute("class",this.opt.className),s.textContent=r.textContent,r.parentNode.replaceChild(s,r),o}},{key:"wrapRangeInMappedTextNode",value:function(e,t,a,n,r){var o=this;e.nodes.every((function(s,i){var c=e.nodes[i+1];if(void 0===c||c.start>t){if(!n(s.node))return!1;var d=t-s.start,l=(a>s.end?s.end:a)-s.start,u=e.value.substr(0,s.start),p=e.value.substr(l+s.start);if(s.node=o.wrapRangeInTextNode(s.node,d,l),e.value=u+p,e.nodes.forEach((function(t,a){a>=i&&(e.nodes[a].start>0&&a!==i&&(e.nodes[a].start-=l),e.nodes[a].end-=l)})),a-=l,r(s.node.previousSibling,s.start),!(a>s.end))return!1;t=s.end}return!0}))}},{key:"wrapMatches",value:function(e,t,a,n,r){var o=this,s=0===t?0:t+1;this.getTextNodes((function(t){t.nodes.forEach((function(t){t=t.node;for(var r=void 0;null!==(r=e.exec(t.textContent))&&""!==r[s];)if(a(r[s],t)){var i=r.index;if(0!==s)for(var c=1;c<s;c++)i+=r[c].length;t=o.wrapRangeInTextNode(t,i,i+r[s].length),n(t.previousSibling),e.lastIndex=0}})),r()}))}},{key:"wrapMatchesAcrossElements",value:function(e,t,a,n,r){var o=this,s=0===t?0:t+1;this.getTextNodes((function(t){for(var i=void 0;null!==(i=e.exec(t.value))&&""!==i[s];){var c=i.index;if(0!==s)for(var d=1;d<s;d++)c+=i[d].length;var l=c+i[s].length;o.wrapRangeInMappedTextNode(t,c,l,(function(e){return a(i[s],e)}),(function(t,a){e.lastIndex=a,n(t)}))}r()}))}},{key:"wrapRangeFromIndex",value:function(e,t,a,n){var r=this;this.getTextNodes((function(o){var s=o.value.length;e.forEach((function(e,n){var i=r.checkWhitespaceRanges(e,s,o.value),c=i.start,d=i.end;i.valid&&r.wrapRangeInMappedTextNode(o,c,d,(function(a){return t(a,e,o.value.substring(c,d),n)}),(function(t){a(t,e)}))})),n()}))}},{key:"unwrapMatches",value:function(e){for(var t=e.parentNode,a=document.createDocumentFragment();e.firstChild;)a.appendChild(e.removeChild(e.firstChild));t.replaceChild(a,e),this.ie?this.normalizeTextNode(t):t.normalize()}},{key:"normalizeTextNode",value:function(e){if(e){if(3===e.nodeType)for(;e.nextSibling&&3===e.nextSibling.nodeType;)e.nodeValue+=e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);else this.normalizeTextNode(e.firstChild);this.normalizeTextNode(e.nextSibling)}}},{key:"markRegExp",value:function(e,t){var a=this;this.opt=t,this.log('Searching with expression "'+e+'"');var n=0,r="wrapMatches",o=function(e){n++,a.opt.each(e)};this.opt.acrossElements&&(r="wrapMatchesAcrossElements"),this[r](e,this.opt.ignoreGroups,(function(e,t){return a.opt.filter(t,e,n)}),o,(function(){0===n&&a.opt.noMatch(e),a.opt.done(n)}))}},{key:"mark",value:function(e,t){var a=this;this.opt=t;var n=0,r="wrapMatches",o=this.getSeparatedKeywords("string"==typeof e?[e]:e),s=o.keywords,i=o.length,c=this.opt.caseSensitive?"":"i",d=function e(t){var o=new RegExp(a.createRegExp(t),"gm"+c),d=0;a.log('Searching with expression "'+o+'"'),a[r](o,1,(function(e,r){return a.opt.filter(r,t,n,d)}),(function(e){d++,n++,a.opt.each(e)}),(function(){0===d&&a.opt.noMatch(t),s[i-1]===t?a.opt.done(n):e(s[s.indexOf(t)+1])}))};this.opt.acrossElements&&(r="wrapMatchesAcrossElements"),0===i?this.opt.done(n):d(s[0])}},{key:"markRanges",value:function(e,t){var a=this;this.opt=t;var n=0,r=this.checkRanges(e);r&&r.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(r)),this.wrapRangeFromIndex(r,(function(e,t,n,r){return a.opt.filter(e,t,n,r)}),(function(e,t){n++,a.opt.each(e,t)}),(function(){a.opt.done(n)}))):this.opt.done(n)}},{key:"unmark",value:function(e){var t=this;this.opt=e;var a=this.opt.element?this.opt.element:"*";a+="[data-markjs]",this.opt.className&&(a+="."+this.opt.className),this.log('Removal selector "'+a+'"'),this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT,(function(e){t.unwrapMatches(e)}),(function(e){var n=r.matches(e,a),o=t.matchesExclude(e);return!n||o?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),this.opt.done)}},{key:"opt",set:function(e){this._opt=n({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e3,separateWordSearch:!0,diacritics:!0,synonyms:{},accuracy:"partially",acrossElements:!1,caseSensitive:!1,ignoreJoiners:!1,ignoreGroups:0,ignorePunctuation:[],wildcards:"disabled",each:function(){},noMatch:function(){},filter:function(){return!0},done:function(){},debug:!1,log:window.console},e)},get:function(){return this._opt}},{key:"iterator",get:function(){return new r(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}}]),o}();function s(e){var t=this,a=new o(e);return this.mark=function(e,n){return a.mark(e,n),t},this.markRegExp=function(e,n){return a.markRegExp(e,n),t},this.markRanges=function(e,n){return a.markRanges(e,n),t},this.unmark=function(e){return a.unmark(e),t},this}return s}()},32497:(e,t,a)=>{"use strict";a.r(t)},52295:(e,t,a)=>{"use strict";a.r(t)},74865:function(e,t,a){var n,r;n=function(){var e,t,a={version:"0.2.0"},n=a.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function r(e,t,a){return e<t?t:e>a?a:e}function o(e){return 100*(-1+e)}function s(e,t,a){var r;return(r="translate3d"===n.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===n.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+a,r}a.configure=function(e){var t,a;for(t in e)void 0!==(a=e[t])&&e.hasOwnProperty(t)&&(n[t]=a);return this},a.status=null,a.set=function(e){var t=a.isStarted();e=r(e,n.minimum,1),a.status=1===e?null:e;var o=a.render(!t),d=o.querySelector(n.barSelector),l=n.speed,u=n.easing;return o.offsetWidth,i((function(t){""===n.positionUsing&&(n.positionUsing=a.getPositioningCSS()),c(d,s(e,l,u)),1===e?(c(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){c(o,{transition:"all "+l+"ms linear",opacity:0}),setTimeout((function(){a.remove(),t()}),l)}),l)):setTimeout(t,l)})),this},a.isStarted=function(){return"number"==typeof a.status},a.start=function(){a.status||a.set(0);var e=function(){setTimeout((function(){a.status&&(a.trickle(),e())}),n.trickleSpeed)};return n.trickle&&e(),this},a.done=function(e){return e||a.status?a.inc(.3+.5*Math.random()).set(1):this},a.inc=function(e){var t=a.status;return t?("number"!=typeof e&&(e=(1-t)*r(Math.random()*t,.1,.95)),t=r(t+e,0,.994),a.set(t)):a.start()},a.trickle=function(){return a.inc(Math.random()*n.trickleRate)},e=0,t=0,a.promise=function(n){return n&&"resolved"!==n.state()?(0===t&&a.start(),e++,t++,n.always((function(){0==--t?(e=0,a.done()):a.set((e-t)/e)})),this):this},a.render=function(e){if(a.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=n.template;var r,s=t.querySelector(n.barSelector),i=e?"-100":o(a.status||0),d=document.querySelector(n.parent);return c(s,{transition:"all 0 linear",transform:"translate3d("+i+"%,0,0)"}),n.showSpinner||(r=t.querySelector(n.spinnerSelector))&&b(r),d!=document.body&&l(d,"nprogress-custom-parent"),d.appendChild(t),t},a.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(n.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&b(e)},a.isRendered=function(){return!!document.getElementById("nprogress")},a.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var i=function(){var e=[];function t(){var a=e.shift();a&&a(t)}return function(a){e.push(a),1==e.length&&t()}}(),c=function(){var e=["Webkit","O","Moz","ms"],t={};function a(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function n(t){var a=document.body.style;if(t in a)return t;for(var n,r=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);r--;)if((n=e[r]+o)in a)return n;return t}function r(e){return e=a(e),t[e]||(t[e]=n(e))}function o(e,t,a){t=r(t),e.style[t]=a}return function(e,t){var a,n,r=arguments;if(2==r.length)for(a in t)void 0!==(n=t[a])&&t.hasOwnProperty(a)&&o(e,a,n);else o(e,r[1],r[2])}}();function d(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function l(e,t){var a=p(e),n=a+t;d(a,t)||(e.className=n.substring(1))}function u(e,t){var a,n=p(e);d(e,t)&&(a=n.replace(" "+t+" "," "),e.className=a.substring(1,a.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return a},void 0===(r="function"==typeof n?n.call(t,a,t,e):n)||(e.exports=r)},27418:e=>{"use strict";var t=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},a=0;a<10;a++)t["_"+String.fromCharCode(a)]=a;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(r){return!1}}()?Object.assign:function(e,o){for(var s,i,c=r(e),d=1;d<arguments.length;d++){for(var l in s=Object(arguments[d]))a.call(s,l)&&(c[l]=s[l]);if(t){i=t(s);for(var u=0;u<i.length;u++)n.call(s,i[u])&&(c[i[u]]=s[i[u]])}}return c}},14779:(e,t,a)=>{var n=a(5826);e.exports=b,e.exports.parse=o,e.exports.compile=function(e,t){return i(o(e,t),t)},e.exports.tokensToFunction=i,e.exports.tokensToRegExp=p;var r=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function o(e,t){for(var a,n=[],o=0,s=0,i="",l=t&&t.delimiter||"/";null!=(a=r.exec(e));){var u=a[0],p=a[1],b=a.index;if(i+=e.slice(s,b),s=b+u.length,p)i+=p[1];else{var f=e[s],m=a[2],g=a[3],h=a[4],v=a[5],y=a[6],_=a[7];i&&(n.push(i),i="");var S=null!=m&&null!=f&&f!==m,x="+"===y||"*"===y,k="?"===y||"*"===y,w=a[2]||l,E=h||v;n.push({name:g||o++,prefix:m||"",delimiter:w,optional:k,repeat:x,partial:S,asterisk:!!_,pattern:E?d(E):_?".*":"[^"+c(w)+"]+?"})}}return s<e.length&&(i+=e.substr(s)),i&&n.push(i),n}function s(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function i(e,t){for(var a=new Array(e.length),r=0;r<e.length;r++)"object"==typeof e[r]&&(a[r]=new RegExp("^(?:"+e[r].pattern+")$",u(t)));return function(t,r){for(var o="",i=t||{},c=(r||{}).pretty?s:encodeURIComponent,d=0;d<e.length;d++){var l=e[d];if("string"!=typeof l){var u,p=i[l.name];if(null==p){if(l.optional){l.partial&&(o+=l.prefix);continue}throw new TypeError('Expected "'+l.name+'" to be defined')}if(n(p)){if(!l.repeat)throw new TypeError('Expected "'+l.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(l.optional)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var b=0;b<p.length;b++){if(u=c(p[b]),!a[d].test(u))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'", but received `'+JSON.stringify(u)+"`");o+=(0===b?l.prefix:l.delimiter)+u}}else{if(u=l.asterisk?encodeURI(p).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):c(p),!a[d].test(u))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but received "'+u+'"');o+=l.prefix+u}}else o+=l}return o}}function c(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function d(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function l(e,t){return e.keys=t,e}function u(e){return e&&e.sensitive?"":"i"}function p(e,t,a){n(t)||(a=t||a,t=[]);for(var r=(a=a||{}).strict,o=!1!==a.end,s="",i=0;i<e.length;i++){var d=e[i];if("string"==typeof d)s+=c(d);else{var p=c(d.prefix),b="(?:"+d.pattern+")";t.push(d),d.repeat&&(b+="(?:"+p+b+")*"),s+=b=d.optional?d.partial?p+"("+b+")?":"(?:"+p+"("+b+"))?":p+"("+b+")"}}var f=c(a.delimiter||"/"),m=s.slice(-f.length)===f;return r||(s=(m?s.slice(0,-f.length):s)+"(?:"+f+"(?=$))?"),s+=o?"$":r&&m?"":"(?="+f+"|$)",l(new RegExp("^"+s,u(a)),t)}function b(e,t,a){return n(t)||(a=t||a,t=[]),a=a||{},e instanceof RegExp?function(e,t){var a=e.source.match(/\((?!\?)/g);if(a)for(var n=0;n<a.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return l(e,t)}(e,t):n(e)?function(e,t,a){for(var n=[],r=0;r<e.length;r++)n.push(b(e[r],t,a).source);return l(new RegExp("(?:"+n.join("|")+")",u(a)),t)}(e,t,a):function(e,t,a){return p(o(e,a),t,a)}(e,t,a)}},87410:(e,t,a)=>{"use strict";a.d(t,{Z:()=>o});var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,a={},n={util:{encode:function e(t){return t instanceof r?new r(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,a){var r,o;switch(a=a||{},n.util.type(t)){case"Object":if(o=n.util.objId(t),a[o])return a[o];for(var s in r={},a[o]=r,t)t.hasOwnProperty(s)&&(r[s]=e(t[s],a));return r;case"Array":return o=n.util.objId(t),a[o]?a[o]:(r=[],a[o]=r,t.forEach((function(t,n){r[n]=e(t,a)})),r);default:return t}},getLanguage:function(t){for(;t;){var a=e.exec(t.className);if(a)return a[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,a){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+a)},isActive:function(e,t,a){for(var n="no-"+t;e;){var r=e.classList;if(r.contains(t))return!0;if(r.contains(n))return!1;e=e.parentElement}return!!a}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(e,t){var a=n.util.clone(n.languages[e]);for(var r in t)a[r]=t[r];return a},insertBefore:function(e,t,a,r){var o=(r=r||n.languages)[e],s={};for(var i in o)if(o.hasOwnProperty(i)){if(i==t)for(var c in a)a.hasOwnProperty(c)&&(s[c]=a[c]);a.hasOwnProperty(i)||(s[i]=o[i])}var d=r[e];return r[e]=s,n.languages.DFS(n.languages,(function(t,a){a===d&&t!=e&&(this[t]=s)})),s},DFS:function e(t,a,r,o){o=o||{};var s=n.util.objId;for(var i in t)if(t.hasOwnProperty(i)){a.call(t,i,t[i],r||i);var c=t[i],d=n.util.type(c);"Object"!==d||o[s(c)]?"Array"!==d||o[s(c)]||(o[s(c)]=!0,e(c,a,i,o)):(o[s(c)]=!0,e(c,a,null,o))}}},plugins:{},highlight:function(e,t,a){var o={code:e,grammar:t,language:a};return n.hooks.run("before-tokenize",o),o.tokens=n.tokenize(o.code,o.grammar),n.hooks.run("after-tokenize",o),r.stringify(n.util.encode(o.tokens),o.language)},tokenize:function(e,t){var a=t.rest;if(a){for(var n in a)t[n]=a[n];delete t.rest}var r=new i;return c(r,r.head,e),s(e,r,t,r.head,0),function(e){var t=[],a=e.head.next;for(;a!==e.tail;)t.push(a.value),a=a.next;return t}(r)},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,o=0;r=a[o++];)r(t)}},Token:r};function r(e,t,a,n){this.type=e,this.content=t,this.alias=a,this.length=0|(n||"").length}function o(e,t,a,n){e.lastIndex=t;var r=e.exec(a);if(r&&n&&r[1]){var o=r[1].length;r.index+=o,r[0]=r[0].slice(o)}return r}function s(e,t,a,i,l,u){for(var p in a)if(a.hasOwnProperty(p)&&a[p]){var b=a[p];b=Array.isArray(b)?b:[b];for(var f=0;f<b.length;++f){if(u&&u.cause==p+","+f)return;var m=b[f],g=m.inside,h=!!m.lookbehind,v=!!m.greedy,y=m.alias;if(v&&!m.pattern.global){var _=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,_+"g")}for(var S=m.pattern||m,x=i.next,k=l;x!==t.tail&&!(u&&k>=u.reach);k+=x.value.length,x=x.next){var w=x.value;if(t.length>e.length)return;if(!(w instanceof r)){var E,C=1;if(v){if(!(E=o(S,k,e,h))||E.index>=e.length)break;var T=E.index,I=E.index+E[0].length,N=k;for(N+=x.value.length;T>=N;)N+=(x=x.next).value.length;if(k=N-=x.value.length,x.value instanceof r)continue;for(var A=x;A!==t.tail&&(N<I||"string"==typeof A.value);A=A.next)C++,N+=A.value.length;C--,w=e.slice(k,N),E.index-=k}else if(!(E=o(S,0,w,h)))continue;T=E.index;var L=E[0],O=w.slice(0,T),P=w.slice(T+L.length),R=k+w.length;u&&R>u.reach&&(u.reach=R);var M=x.prev;if(O&&(M=c(t,M,O),k+=O.length),d(t,M,C),x=c(t,M,new r(p,g?n.tokenize(L,g):L,y,L)),P&&c(t,x,P),C>1){var D={cause:p+","+f,reach:R};s(e,t,a,x.prev,k,D),u&&D.reach>u.reach&&(u.reach=D.reach)}}}}}}function i(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,a){var n=t.next,r={value:a,prev:t,next:n};return t.next=r,n.prev=r,e.length++,r}function d(e,t,a){for(var n=t.next,r=0;r<a&&n!==e.tail;r++)n=n.next;t.next=n,n.prev=t,e.length-=r}return r.stringify=function e(t,a){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach((function(t){r+=e(t,a)})),r}var o={type:t.type,content:e(t.content,a),tag:"span",classes:["token",t.type],attributes:{},language:a},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(o.classes,s):o.classes.push(s)),n.hooks.run("wrap",o);var i="";for(var c in o.attributes)i+=" "+c+'="'+(o.attributes[c]||"").replace(/"/g,""")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+i+">"+o.content+"</"+o.tag+">"},n}(),r=n;n.default=n,r.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(e,t){var a={};a["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[t]},a.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:a}};n["language-"+t]={pattern:/[\s\S]+/,inside:r.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:n},r.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(e,t){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:r.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:a,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},a.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=n.variable[1].inside,s=0;s<r.length;s++)o[r[s]]=e.languages.bash[r[s]];e.languages.shell=e.languages.bash}(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.c=r.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),r.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),r.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},r.languages.c.string],char:r.languages.c.char,comment:r.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:r.languages.c}}}}),r.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete r.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,a=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return a}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(r),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var a=e.languages.markup;a&&(a.tag.addInlined("style","css"),a.tag.addAttribute("style","css"))}(r),function(e){var t,a=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+a.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[a,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var n={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},r={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:n,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:n,number:r})}(r),r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,function(e){var t=/#(?!\{).+/,a={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:a}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:a}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:a}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(r),function(e){var t=/[*&][^\s[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,n="(?:"+a.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+a.source+")?)",r=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(e,t){t=(t||"").replace(/m/g,"")+"m";var a=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return n})).replace(/<<value>>/g,(function(){return e}));return RegExp(a,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return n}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return n})).replace(/<<key>>/g,(function(){return"(?:"+r+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(o),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(r),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return n})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+o+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+o+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(a){t!==a&&(e.languages.markdown[t].inside.content.inside[a]=e.languages.markdown[a])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var a=0,n=t.length;a<n;a++){var r=t[a];if("code"===r.type){var o=r.content[1],s=r.content[3];if(o&&s&&"code-language"===o.type&&"code-block"===s.type&&"string"==typeof o.content){var i=o.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),c="language-"+(i=(/[a-z][\w-]*/i.exec(i)||[""])[0].toLowerCase());s.alias?"string"==typeof s.alias?s.alias=[s.alias,c]:s.alias.push(c):s.alias=[c]}}else e(r.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var a="",n=0,r=t.classes.length;n<r;n++){var o=t.classes[n],d=/language-(.+)/.exec(o);if(d){a=d[1];break}}var l,u=e.languages[a];if(u)t.content=e.highlight((l=t.content,l.replace(s,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var a;if("#"===(t=t.toLowerCase())[0])return a="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),c(a);var n=i[t];return n||e}))),u,a);else if(a&&"none"!==a&&e.plugins.autoloader){var p="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=p,e.plugins.autoloader.loadLanguages(a,(function(){var t=document.getElementById(p);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[a],a))}))}}}));var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),i={amp:"&",lt:"<",gt:">",quot:'"'},c=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(r),r.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:r.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},r.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),a=0;a<t.length;){var n=t[a++];if("keyword"===n.type&&"mutation"===n.content){var r=[];if(u(["definition-mutation","punctuation"])&&"("===l(1).content){a+=2;var o=p(/^\($/,/^\)$/);if(-1===o)continue;for(;a<o;a++){var s=l(0);"variable"===s.type&&(b(s,"variable-input"),r.push(s.content))}a=o+1}if(u(["punctuation","property-query"])&&"{"===l(0).content&&(a++,b(l(0),"property-mutation"),r.length>0)){var i=p(/^\{$/,/^\}$/);if(-1===i)continue;for(var c=a;c<i;c++){var d=t[c];"variable"===d.type&&r.indexOf(d.content)>=0&&b(d,"variable-input")}}}}function l(e){return t[a+e]}function u(e,t){t=t||0;for(var a=0;a<e.length;a++){var n=l(a+t);if(!n||n.type!==e[a])return!1}return!0}function p(e,n){for(var r=1,o=a;o<t.length;o++){var s=t[o],i=s.content;if("punctuation"===s.type&&"string"==typeof i)if(e.test(i))r++;else if(n.test(i)&&0===--r)return o}return-1}function b(e,t){var a=e.alias;a?Array.isArray(a)||(e.alias=a=[a]):e.alias=a=[],a.push(t)}})),r.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],a=t.pattern.source,n=t.inside.interpolation,r=n.inside["interpolation-punctuation"],o=n.pattern.source;function s(t,n){if(e.languages[t])return{pattern:RegExp("((?:"+n+")\\s*)"+a),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function i(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function c(t,a,n){var r={code:t,grammar:a,language:n};return e.hooks.run("before-tokenize",r),r.tokens=e.tokenize(r.code,r.grammar),e.hooks.run("after-tokenize",r),r.tokens}function d(t){var a={};a["interpolation-punctuation"]=r;var o=e.tokenize(t,a);if(3===o.length){var s=[1,1];s.push.apply(s,c(o[1],e.languages.javascript,"javascript")),o.splice.apply(o,s)}return new e.Token("interpolation",o,n.alias,t)}function l(t,a,n){var r=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),s=0,l={},u=c(r.map((function(e){if("string"==typeof e)return e;for(var a,r=e.content;-1!==t.indexOf(a=i(s++,n)););return l[a]=r,a})).join(""),a,n),p=Object.keys(l);return s=0,function e(t){for(var a=0;a<t.length;a++){if(s>=p.length)return;var n=t[a];if("string"==typeof n||"string"==typeof n.content){var r=p[s],o="string"==typeof n?n:n.content,i=o.indexOf(r);if(-1!==i){++s;var c=o.substring(0,i),u=d(l[r]),b=o.substring(i+r.length),f=[];if(c&&f.push(c),f.push(u),b){var m=[b];e(m),f.push.apply(f,m)}"string"==typeof n?(t.splice.apply(t,[a,1].concat(f)),a+=f.length-1):n.content=f}}else{var g=n.content;Array.isArray(g)?e(g):e([g])}}}(u),new e.Token(n,u,"language-"+n,t)}e.languages.javascript["template-string"]=[s("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),s("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),s("svg",/\bsvg/.source),s("markdown",/\b(?:markdown|md)/.source),s("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),s("sql",/\bsql/.source),t].filter(Boolean);var u={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function p(e){return"string"==typeof e?e:Array.isArray(e)?e.map(p).join(""):p(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in u&&function t(a){for(var n=0,r=a.length;n<r;n++){var o=a[n];if("string"!=typeof o){var s=o.content;if(Array.isArray(s))if("template-string"===o.type){var i=s[1];if(3===s.length&&"string"!=typeof i&&"embedded-code"===i.type){var c=p(i),d=i.alias,u=Array.isArray(d)?d[0]:d,b=e.languages[u];if(!b)continue;s[1]=l(c,b,u)}}else t(s);else"string"!=typeof s&&t([s])}}}(t.tokens)}))}(r),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(r),function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var a=["function","function-variable","method","method-variable","property-access"],n=0;n<a.length;n++){var r=a[n],o=e.languages.javascript[r];"RegExp"===e.util.type(o)&&(o=e.languages.javascript[r]={pattern:o});var s=o.inside||{};o.inside=s,s["maybe-class-name"]=/^[A-Z][\s\S]*/}}(r),function(e){var t=e.util.clone(e.languages.javascript),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,n=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(e,t){return e=e.replace(/<S>/g,(function(){return a})).replace(/<BRACES>/g,(function(){return n})).replace(/<SPREAD>/g,(function(){return r})),RegExp(e,t)}r=o(r).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var s=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(s).join(""):""},i=function(t){for(var a=[],n=0;n<t.length;n++){var r=t[n],o=!1;if("string"!=typeof r&&("tag"===r.type&&r.content[0]&&"tag"===r.content[0].type?"</"===r.content[0].content[0].content?a.length>0&&a[a.length-1].tagName===s(r.content[0].content[1])&&a.pop():"/>"===r.content[r.content.length-1].content||a.push({tagName:s(r.content[0].content[1]),openedBraces:0}):a.length>0&&"punctuation"===r.type&&"{"===r.content?a[a.length-1].openedBraces++:a.length>0&&a[a.length-1].openedBraces>0&&"punctuation"===r.type&&"}"===r.content?a[a.length-1].openedBraces--:o=!0),(o||"string"==typeof r)&&a.length>0&&0===a[a.length-1].openedBraces){var c=s(r);n<t.length-1&&("string"==typeof t[n+1]||"plain-text"===t[n+1].type)&&(c+=s(t[n+1]),t.splice(n+1,1)),n>0&&("string"==typeof t[n-1]||"plain-text"===t[n-1].type)&&(c=s(t[n-1])+c,t.splice(n-1,1),n--),t[n]=new e.Token("plain-text",c,null,c)}r.content&&"string"!=typeof r.content&&i(r.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||i(e.tokens)}))}(r),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(a){var n=t[a],r=[];/^\w+$/.test(a)||r.push(/\w+/.exec(a)[0]),"diff"===a&&r.push("bold"),e.languages.diff[a]={pattern:RegExp("^(?:["+n+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(a)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(r),r.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},r.languages.go=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),r.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete r.languages.go["class-name"],function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(a,n,r,o){if(a.language===n){var s=a.tokenStack=[];a.code=a.code.replace(r,(function(e){if("function"==typeof o&&!o(e))return e;for(var r,i=s.length;-1!==a.code.indexOf(r=t(n,i));)++i;return s[i]=e,r})),a.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(a,n){if(a.language===n&&a.tokenStack){a.grammar=e.languages[n];var r=0,o=Object.keys(a.tokenStack);!function s(i){for(var c=0;c<i.length&&!(r>=o.length);c++){var d=i[c];if("string"==typeof d||d.content&&"string"==typeof d.content){var l=o[r],u=a.tokenStack[l],p="string"==typeof d?d:d.content,b=t(n,l),f=p.indexOf(b);if(f>-1){++r;var m=p.substring(0,f),g=new e.Token(n,e.tokenize(u,a.grammar),"language-"+n,u),h=p.substring(f+b.length),v=[];m&&v.push.apply(v,s([m])),v.push(g),h&&v.push.apply(v,s([h])),"string"==typeof d?i.splice.apply(i,[c,1].concat(v)):d.content=v}}else d.content&&s(d.content)}return i}(a.tokens)}}}})}(r),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(r),r.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},r.languages.webmanifest=r.languages.json,r.languages.less=r.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),r.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),r.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},r.languages.objectivec=r.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete r.languages.objectivec["class-name"],r.languages.objc=r.languages.objectivec,r.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},r.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},r.languages.python["string-interpolation"].inside.interpolation.inside.rest=r.languages.python,r.languages.py=r.languages.python,r.languages.reason=r.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),r.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete r.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,a=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:a}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:a,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(r),r.languages.scss=r.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),r.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),r.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),r.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),r.languages.scss.atrule.inside.rest=r.languages.scss,function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},a={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},n={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:a,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:a,punctuation:/[{}()\[\];:,]/};n.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:n}},n.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:n}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:n}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:n}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:n}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:n.interpolation}},rest:n}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:n.interpolation,comment:n.comment,punctuation:/[{},]/}},func:n.func,string:n.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:n.interpolation,punctuation:/[{}()\[\];:.]/}}(r),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var a=e.languages.tsx.tag;a.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.lookbehind=!0}(r),r.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/};const o=r},70767:()=>{!function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,a=0;a<2;a++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Prism)},30893:()=>{Prism.languages.solidity=Prism.languages.extend("clike",{"class-name":{pattern:/(\b(?:contract|enum|interface|library|new|struct|using)\s+)(?!\d)[\w$]+/,lookbehind:!0},keyword:/\b(?:_|anonymous|as|assembly|assert|break|calldata|case|constant|constructor|continue|contract|default|delete|do|else|emit|enum|event|external|for|from|function|if|import|indexed|inherited|interface|internal|is|let|library|mapping|memory|modifier|new|payable|pragma|private|public|pure|require|returns?|revert|selfdestruct|solidity|storage|struct|suicide|switch|this|throw|using|var|view|while)\b/,operator:/=>|->|:=|=:|\*\*|\+\+|--|\|\||&&|<<=?|>>=?|[-+*/%^&|<>!=]=?|[~?]/}),Prism.languages.insertBefore("solidity","keyword",{builtin:/\b(?:address|bool|byte|u?int(?:8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?|string|bytes(?:[1-9]|[12]\d|3[0-2])?)\b/}),Prism.languages.insertBefore("solidity","number",{version:{pattern:/([<>]=?|\^)\d+\.\d+\.\d+\b/,lookbehind:!0,alias:"number"}}),Prism.languages.sol=Prism.languages.solidity},25583:(e,t,a)=>{var n={"./prism-rust":70767,"./prism-solidity":30893};function r(e){var t=o(e);return a(t)}function o(e){if(!a.o(n,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n[e]}r.keys=function(){return Object.keys(n)},r.resolve=o,e.exports=r,r.id=25583},92703:(e,t,a)=>{"use strict";var n=a(50414);function r(){}function o(){}o.resetWarningCache=r,e.exports=function(){function e(e,t,a,r,o,s){if(s!==n){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:r};return a.PropTypes=a,a}},45697:(e,t,a)=>{e.exports=a(92703)()},50414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},64448:(e,t,a)=>{"use strict";var n=a(67294),r=a(27418),o=a(63840);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!n)throw Error(s(227));var i=new Set,c={};function d(e,t){l(e,t),l(e+"Capture",t)}function l(e,t){for(c[e]=t,e=0;e<t.length;e++)i.add(t[e])}var u=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,b=Object.prototype.hasOwnProperty,f={},m={};function g(e,t,a,n,r,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=a,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var h={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){h[e]=new g(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];h[t]=new g(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){h[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){h[e]=new g(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){h[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){h[e]=new g(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){h[e]=new g(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){h[e]=new g(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){h[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)}));var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}function _(e,t,a,n){var r=h.hasOwnProperty(t)?h[t]:null;(null!==r?0===r.type:!n&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,a,n){if(null==t||function(e,t,a,n){if(null!==a&&0===a.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==a?!a.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,a,n))return!0;if(n)return!1;if(null!==a)switch(a.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,a,r,n)&&(a=null),n||null===r?function(e){return!!b.call(m,e)||!b.call(f,e)&&(p.test(e)?m[e]=!0:(f[e]=!0,!1))}(t)&&(null===a?e.removeAttribute(t):e.setAttribute(t,""+a)):r.mustUseProperty?e[r.propertyName]=null===a?3!==r.type&&"":a:(t=r.attributeName,n=r.attributeNamespace,null===a?e.removeAttribute(t):(a=3===(r=r.type)||4===r&&!0===a?"":""+a,n?e.setAttributeNS(n,t,a):e.setAttribute(t,a))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(v,y);h[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(v,y);h[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(v,y);h[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){h[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),h.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){h[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var S=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,x=60103,k=60106,w=60107,E=60108,C=60114,T=60109,I=60110,N=60112,A=60113,L=60120,O=60115,P=60116,R=60121,M=60128,D=60129,F=60130,j=60131;if("function"==typeof Symbol&&Symbol.for){var B=Symbol.for;x=B("react.element"),k=B("react.portal"),w=B("react.fragment"),E=B("react.strict_mode"),C=B("react.profiler"),T=B("react.provider"),I=B("react.context"),N=B("react.forward_ref"),A=B("react.suspense"),L=B("react.suspense_list"),O=B("react.memo"),P=B("react.lazy"),R=B("react.block"),B("react.scope"),M=B("react.opaque.id"),D=B("react.debug_trace_mode"),F=B("react.offscreen"),j=B("react.legacy_hidden")}var z,$="function"==typeof Symbol&&Symbol.iterator;function U(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=$&&e[$]||e["@@iterator"])?e:null}function Z(e){if(void 0===z)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||""}return"\n"+z+e}var G=!1;function H(e,t){if(!e||G)return"";G=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&"string"==typeof c.stack){for(var r=c.stack.split("\n"),o=n.stack.split("\n"),s=r.length-1,i=o.length-1;1<=s&&0<=i&&r[s]!==o[i];)i--;for(;1<=s&&0<=i;s--,i--)if(r[s]!==o[i]){if(1!==s||1!==i)do{if(s--,0>--i||r[s]!==o[i])return"\n"+r[s].replace(" at new "," at ")}while(1<=s&&0<=i);break}}}finally{G=!1,Error.prepareStackTrace=a}return(e=e?e.displayName||e.name:"")?Z(e):""}function V(e){switch(e.tag){case 5:return Z(e.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return e=H(e.type,!1);case 11:return e=H(e.type.render,!1);case 22:return e=H(e.type._render,!1);case 1:return e=H(e.type,!0);default:return""}}function W(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case w:return"Fragment";case k:return"Portal";case C:return"Profiler";case E:return"StrictMode";case A:return"Suspense";case L:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case I:return(e.displayName||"Context")+".Consumer";case T:return(e._context.displayName||"Context")+".Provider";case N:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case O:return W(e.type);case R:return W(e._render);case P:t=e._payload,e=e._init;try{return W(e(t))}catch(a){}}return null}function q(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Y(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function K(e){e._valueTracker||(e._valueTracker=function(e){var t=Y(e)?"checked":"value",a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==a&&"function"==typeof a.get&&"function"==typeof a.set){var r=a.get,o=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){n=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function X(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=Y(e)?e.checked?"true":"false":e.value),(e=n)!==a&&(t.setValue(e),!0)}function Q(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function J(e,t){var a=t.checked;return r({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=a?a:e._wrapperState.initialChecked})}function ee(e,t){var a=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;a=q(null!=t.value?t.value:a),e._wrapperState={initialChecked:n,initialValue:a,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&_(e,"checked",t,!1)}function ae(e,t){te(e,t);var a=q(t.value),n=t.type;if(null!=a)"number"===n?(0===a&&""===e.value||e.value!=a)&&(e.value=""+a):e.value!==""+a&&(e.value=""+a);else if("submit"===n||"reset"===n)return void e.removeAttribute("value");t.hasOwnProperty("value")?re(e,t.type,a):t.hasOwnProperty("defaultValue")&&re(e,t.type,q(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function ne(e,t,a){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!("submit"!==n&&"reset"!==n||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,a||t===e.value||(e.value=t),e.defaultValue=t}""!==(a=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==a&&(e.name=a)}function re(e,t,a){"number"===t&&Q(e.ownerDocument)===e||(null==a?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+a&&(e.defaultValue=""+a))}function oe(e,t){return e=r({children:void 0},t),(t=function(e){var t="";return n.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function se(e,t,a,n){if(e=e.options,t){t={};for(var r=0;r<a.length;r++)t["$"+a[r]]=!0;for(a=0;a<e.length;a++)r=t.hasOwnProperty("$"+e[a].value),e[a].selected!==r&&(e[a].selected=r),r&&n&&(e[a].defaultSelected=!0)}else{for(a=""+q(a),t=null,r=0;r<e.length;r++){if(e[r].value===a)return e[r].selected=!0,void(n&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function ie(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(s(91));return r({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ce(e,t){var a=t.value;if(null==a){if(a=t.children,t=t.defaultValue,null!=a){if(null!=t)throw Error(s(92));if(Array.isArray(a)){if(!(1>=a.length))throw Error(s(93));a=a[0]}t=a}null==t&&(t=""),a=t}e._wrapperState={initialValue:q(a)}}function de(e,t){var a=q(t.value),n=q(t.defaultValue);null!=a&&((a=""+a)!==e.value&&(e.value=a),null==t.defaultValue&&e.defaultValue!==a&&(e.defaultValue=a)),null!=n&&(e.defaultValue=""+n)}function le(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var ue="http://www.w3.org/1999/xhtml",pe="http://www.w3.org/2000/svg";function be(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function fe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?be(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var me,ge,he=(ge=function(e,t){if(e.namespaceURI!==pe||"innerHTML"in e)e.innerHTML=t;else{for((me=me||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=me.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,a,n){MSApp.execUnsafeLocalFunction((function(){return ge(e,t)}))}:ge);function ve(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&3===a.nodeType)return void(a.nodeValue=t)}e.textContent=t}var ye={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_e=["Webkit","ms","Moz","O"];function Se(e,t,a){return null==t||"boolean"==typeof t||""===t?"":a||"number"!=typeof t||0===t||ye.hasOwnProperty(e)&&ye[e]?(""+t).trim():t+"px"}function xe(e,t){for(var a in e=e.style,t)if(t.hasOwnProperty(a)){var n=0===a.indexOf("--"),r=Se(a,t[a],n);"float"===a&&(a="cssFloat"),n?e.setProperty(a,r):e[a]=r}}Object.keys(ye).forEach((function(e){_e.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ye[t]=ye[e]}))}));var ke=r({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function we(e,t){if(t){if(ke[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(s(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(s(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(s(62))}}function Ee(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function Ce(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Te=null,Ie=null,Ne=null;function Ae(e){if(e=nr(e)){if("function"!=typeof Te)throw Error(s(280));var t=e.stateNode;t&&(t=or(t),Te(e.stateNode,e.type,t))}}function Le(e){Ie?Ne?Ne.push(e):Ne=[e]:Ie=e}function Oe(){if(Ie){var e=Ie,t=Ne;if(Ne=Ie=null,Ae(e),t)for(e=0;e<t.length;e++)Ae(t[e])}}function Pe(e,t){return e(t)}function Re(e,t,a,n,r){return e(t,a,n,r)}function Me(){}var De=Pe,Fe=!1,je=!1;function Be(){null===Ie&&null===Ne||(Me(),Oe())}function ze(e,t){var a=e.stateNode;if(null===a)return null;var n=or(a);if(null===n)return null;a=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(a&&"function"!=typeof a)throw Error(s(231,t,typeof a));return a}var $e=!1;if(u)try{var Ue={};Object.defineProperty(Ue,"passive",{get:function(){$e=!0}}),window.addEventListener("test",Ue,Ue),window.removeEventListener("test",Ue,Ue)}catch(ge){$e=!1}function Ze(e,t,a,n,r,o,s,i,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(a,d)}catch(l){this.onError(l)}}var Ge=!1,He=null,Ve=!1,We=null,qe={onError:function(e){Ge=!0,He=e}};function Ye(e,t,a,n,r,o,s,i,c){Ge=!1,He=null,Ze.apply(qe,arguments)}function Ke(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(a=t.return),e=t.return}while(e)}return 3===t.tag?a:null}function Xe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Qe(e){if(Ke(e)!==e)throw Error(s(188))}function Je(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ke(e)))throw Error(s(188));return t!==e?null:e}for(var a=e,n=t;;){var r=a.return;if(null===r)break;var o=r.alternate;if(null===o){if(null!==(n=r.return)){a=n;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===a)return Qe(r),e;if(o===n)return Qe(r),t;o=o.sibling}throw Error(s(188))}if(a.return!==n.return)a=r,n=o;else{for(var i=!1,c=r.child;c;){if(c===a){i=!0,a=r,n=o;break}if(c===n){i=!0,n=r,a=o;break}c=c.sibling}if(!i){for(c=o.child;c;){if(c===a){i=!0,a=o,n=r;break}if(c===n){i=!0,n=o,a=r;break}c=c.sibling}if(!i)throw Error(s(189))}}if(a.alternate!==n)throw Error(s(190))}if(3!==a.tag)throw Error(s(188));return a.stateNode.current===a?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function et(e,t){for(var a=e.alternate;null!==t;){if(t===e||t===a)return!0;t=t.return}return!1}var tt,at,nt,rt,ot=!1,st=[],it=null,ct=null,dt=null,lt=new Map,ut=new Map,pt=[],bt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ft(e,t,a,n,r){return{blockedOn:e,domEventName:t,eventSystemFlags:16|a,nativeEvent:r,targetContainers:[n]}}function mt(e,t){switch(e){case"focusin":case"focusout":it=null;break;case"dragenter":case"dragleave":ct=null;break;case"mouseover":case"mouseout":dt=null;break;case"pointerover":case"pointerout":lt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ut.delete(t.pointerId)}}function gt(e,t,a,n,r,o){return null===e||e.nativeEvent!==o?(e=ft(t,a,n,r,o),null!==t&&(null!==(t=nr(t))&&at(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function ht(e){var t=ar(e.target);if(null!==t){var a=Ke(t);if(null!==a)if(13===(t=a.tag)){if(null!==(t=Xe(a)))return e.blockedOn=t,void rt(e.lanePriority,(function(){o.unstable_runWithPriority(e.priority,(function(){nt(a)}))}))}else if(3===t&&a.stateNode.hydrate)return void(e.blockedOn=3===a.tag?a.stateNode.containerInfo:null)}e.blockedOn=null}function vt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var a=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==a)return null!==(t=nr(a))&&at(t),e.blockedOn=a,!1;t.shift()}return!0}function yt(e,t,a){vt(e)&&a.delete(t)}function _t(){for(ot=!1;0<st.length;){var e=st[0];if(null!==e.blockedOn){null!==(e=nr(e.blockedOn))&&tt(e);break}for(var t=e.targetContainers;0<t.length;){var a=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==a){e.blockedOn=a;break}t.shift()}null===e.blockedOn&&st.shift()}null!==it&&vt(it)&&(it=null),null!==ct&&vt(ct)&&(ct=null),null!==dt&&vt(dt)&&(dt=null),lt.forEach(yt),ut.forEach(yt)}function St(e,t){e.blockedOn===t&&(e.blockedOn=null,ot||(ot=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,_t)))}function xt(e){function t(t){return St(t,e)}if(0<st.length){St(st[0],e);for(var a=1;a<st.length;a++){var n=st[a];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==it&&St(it,e),null!==ct&&St(ct,e),null!==dt&&St(dt,e),lt.forEach(t),ut.forEach(t),a=0;a<pt.length;a++)(n=pt[a]).blockedOn===e&&(n.blockedOn=null);for(;0<pt.length&&null===(a=pt[0]).blockedOn;)ht(a),null===a.blockedOn&&pt.shift()}function kt(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var wt={animationend:kt("Animation","AnimationEnd"),animationiteration:kt("Animation","AnimationIteration"),animationstart:kt("Animation","AnimationStart"),transitionend:kt("Transition","TransitionEnd")},Et={},Ct={};function Tt(e){if(Et[e])return Et[e];if(!wt[e])return e;var t,a=wt[e];for(t in a)if(a.hasOwnProperty(t)&&t in Ct)return Et[e]=a[t];return e}u&&(Ct=document.createElement("div").style,"AnimationEvent"in window||(delete wt.animationend.animation,delete wt.animationiteration.animation,delete wt.animationstart.animation),"TransitionEvent"in window||delete wt.transitionend.transition);var It=Tt("animationend"),Nt=Tt("animationiteration"),At=Tt("animationstart"),Lt=Tt("transitionend"),Ot=new Map,Pt=new Map,Rt=["abort","abort",It,"animationEnd",Nt,"animationIteration",At,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Lt,"transitionEnd","waiting","waiting"];function Mt(e,t){for(var a=0;a<e.length;a+=2){var n=e[a],r=e[a+1];r="on"+(r[0].toUpperCase()+r.slice(1)),Pt.set(n,t),Ot.set(n,r),d(r,[n])}}(0,o.unstable_now)();var Dt=8;function Ft(e){if(0!=(1&e))return Dt=15,1;if(0!=(2&e))return Dt=14,2;if(0!=(4&e))return Dt=13,4;var t=24&e;return 0!==t?(Dt=12,t):0!=(32&e)?(Dt=11,32):0!==(t=192&e)?(Dt=10,t):0!=(256&e)?(Dt=9,256):0!==(t=3584&e)?(Dt=8,t):0!=(4096&e)?(Dt=7,4096):0!==(t=4186112&e)?(Dt=6,t):0!==(t=62914560&e)?(Dt=5,t):67108864&e?(Dt=4,67108864):0!=(134217728&e)?(Dt=3,134217728):0!==(t=805306368&e)?(Dt=2,t):0!=(1073741824&e)?(Dt=1,1073741824):(Dt=8,e)}function jt(e,t){var a=e.pendingLanes;if(0===a)return Dt=0;var n=0,r=0,o=e.expiredLanes,s=e.suspendedLanes,i=e.pingedLanes;if(0!==o)n=o,r=Dt=15;else if(0!==(o=134217727&a)){var c=o&~s;0!==c?(n=Ft(c),r=Dt):0!==(i&=o)&&(n=Ft(i),r=Dt)}else 0!==(o=a&~s)?(n=Ft(o),r=Dt):0!==i&&(n=Ft(i),r=Dt);if(0===n)return 0;if(n=a&((0>(n=31-Gt(n))?0:1<<n)<<1)-1,0!==t&&t!==n&&0==(t&s)){if(Ft(t),r<=Dt)return t;Dt=r}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=n;0<t;)r=1<<(a=31-Gt(t)),n|=e[a],t&=~r;return n}function Bt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function zt(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=$t(24&~t))?zt(10,t):e;case 10:return 0===(e=$t(192&~t))?zt(8,t):e;case 8:return 0===(e=$t(3584&~t))&&(0===(e=$t(4186112&~t))&&(e=512)),e;case 2:return 0===(t=$t(805306368&~t))&&(t=268435456),t}throw Error(s(358,e))}function $t(e){return e&-e}function Ut(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Zt(e,t,a){e.pendingLanes|=t;var n=t-1;e.suspendedLanes&=n,e.pingedLanes&=n,(e=e.eventTimes)[t=31-Gt(t)]=a}var Gt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Ht(e)/Vt|0)|0},Ht=Math.log,Vt=Math.LN2;var Wt=o.unstable_UserBlockingPriority,qt=o.unstable_runWithPriority,Yt=!0;function Kt(e,t,a,n){Fe||Me();var r=Qt,o=Fe;Fe=!0;try{Re(r,e,t,a,n)}finally{(Fe=o)||Be()}}function Xt(e,t,a,n){qt(Wt,Qt.bind(null,e,t,a,n))}function Qt(e,t,a,n){var r;if(Yt)if((r=0==(4&t))&&0<st.length&&-1<bt.indexOf(e))e=ft(null,e,t,a,n),st.push(e);else{var o=Jt(e,t,a,n);if(null===o)r&&mt(e,n);else{if(r){if(-1<bt.indexOf(e))return e=ft(o,e,t,a,n),void st.push(e);if(function(e,t,a,n,r){switch(t){case"focusin":return it=gt(it,e,t,a,n,r),!0;case"dragenter":return ct=gt(ct,e,t,a,n,r),!0;case"mouseover":return dt=gt(dt,e,t,a,n,r),!0;case"pointerover":var o=r.pointerId;return lt.set(o,gt(lt.get(o)||null,e,t,a,n,r)),!0;case"gotpointercapture":return o=r.pointerId,ut.set(o,gt(ut.get(o)||null,e,t,a,n,r)),!0}return!1}(o,e,t,a,n))return;mt(e,n)}Mn(e,t,n,null,a)}}}function Jt(e,t,a,n){var r=Ce(n);if(null!==(r=ar(r))){var o=Ke(r);if(null===o)r=null;else{var s=o.tag;if(13===s){if(null!==(r=Xe(o)))return r;r=null}else if(3===s){if(o.stateNode.hydrate)return 3===o.tag?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null)}}return Mn(e,t,n,r,a),null}var ea=null,ta=null,aa=null;function na(){if(aa)return aa;var e,t,a=ta,n=a.length,r="value"in ea?ea.value:ea.textContent,o=r.length;for(e=0;e<n&&a[e]===r[e];e++);var s=n-e;for(t=1;t<=s&&a[n-t]===r[o-t];t++);return aa=r.slice(e,1<t?1-t:void 0)}function ra(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function oa(){return!0}function sa(){return!1}function ia(e){function t(t,a,n,r,o){for(var s in this._reactName=t,this._targetInst=n,this.type=a,this.nativeEvent=r,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(r):r[s]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?oa:sa,this.isPropagationStopped=sa,this}return r(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=oa)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=oa)},persist:function(){},isPersistent:oa}),t}var ca,da,la,ua={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pa=ia(ua),ba=r({},ua,{view:0,detail:0}),fa=ia(ba),ma=r({},ba,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ta,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==la&&(la&&"mousemove"===e.type?(ca=e.screenX-la.screenX,da=e.screenY-la.screenY):da=ca=0,la=e),ca)},movementY:function(e){return"movementY"in e?e.movementY:da}}),ga=ia(ma),ha=ia(r({},ma,{dataTransfer:0})),va=ia(r({},ba,{relatedTarget:0})),ya=ia(r({},ua,{animationName:0,elapsedTime:0,pseudoElement:0})),_a=r({},ua,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Sa=ia(_a),xa=ia(r({},ua,{data:0})),ka={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wa={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ea={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ca(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Ea[e])&&!!t[e]}function Ta(){return Ca}var Ia=r({},ba,{key:function(e){if(e.key){var t=ka[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=ra(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?wa[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ta,charCode:function(e){return"keypress"===e.type?ra(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?ra(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Na=ia(Ia),Aa=ia(r({},ma,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),La=ia(r({},ba,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ta})),Oa=ia(r({},ua,{propertyName:0,elapsedTime:0,pseudoElement:0})),Pa=r({},ma,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ra=ia(Pa),Ma=[9,13,27,32],Da=u&&"CompositionEvent"in window,Fa=null;u&&"documentMode"in document&&(Fa=document.documentMode);var ja=u&&"TextEvent"in window&&!Fa,Ba=u&&(!Da||Fa&&8<Fa&&11>=Fa),za=String.fromCharCode(32),$a=!1;function Ua(e,t){switch(e){case"keyup":return-1!==Ma.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Za(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ga=!1;var Ha={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Va(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Ha[e.type]:"textarea"===t}function Wa(e,t,a,n){Le(n),0<(t=Fn(t,"onChange")).length&&(a=new pa("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var qa=null,Ya=null;function Ka(e){Nn(e,0)}function Xa(e){if(X(rr(e)))return e}function Qa(e,t){if("change"===e)return t}var Ja=!1;if(u){var en;if(u){var tn="oninput"in document;if(!tn){var an=document.createElement("div");an.setAttribute("oninput","return;"),tn="function"==typeof an.oninput}en=tn}else en=!1;Ja=en&&(!document.documentMode||9<document.documentMode)}function nn(){qa&&(qa.detachEvent("onpropertychange",rn),Ya=qa=null)}function rn(e){if("value"===e.propertyName&&Xa(Ya)){var t=[];if(Wa(t,Ya,e,Ce(e)),e=Ka,Fe)e(t);else{Fe=!0;try{Pe(e,t)}finally{Fe=!1,Be()}}}}function on(e,t,a){"focusin"===e?(nn(),Ya=a,(qa=t).attachEvent("onpropertychange",rn)):"focusout"===e&&nn()}function sn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Xa(Ya)}function cn(e,t){if("click"===e)return Xa(t)}function dn(e,t){if("input"===e||"change"===e)return Xa(t)}var ln="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},un=Object.prototype.hasOwnProperty;function pn(e,t){if(ln(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++)if(!un.call(t,a[n])||!ln(e[a[n]],t[a[n]]))return!1;return!0}function bn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fn(e,t){var a,n=bn(e);for(e=0;n;){if(3===n.nodeType){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=bn(n)}}function mn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?mn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function gn(){for(var e=window,t=Q();t instanceof e.HTMLIFrameElement;){try{var a="string"==typeof t.contentWindow.location.href}catch(n){a=!1}if(!a)break;t=Q((e=t.contentWindow).document)}return t}function hn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var vn=u&&"documentMode"in document&&11>=document.documentMode,yn=null,_n=null,Sn=null,xn=!1;function kn(e,t,a){var n=a.window===a?a.document:9===a.nodeType?a:a.ownerDocument;xn||null==yn||yn!==Q(n)||("selectionStart"in(n=yn)&&hn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},Sn&&pn(Sn,n)||(Sn=n,0<(n=Fn(_n,"onSelect")).length&&(t=new pa("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=yn)))}Mt("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Mt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Mt(Rt,2);for(var wn="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),En=0;En<wn.length;En++)Pt.set(wn[En],0);l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),d("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),d("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),d("onBeforeInput",["compositionend","keypress","textInput","paste"]),d("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),d("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),d("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Cn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tn=new Set("cancel close invalid load scroll toggle".split(" ").concat(Cn));function In(e,t,a){var n=e.type||"unknown-event";e.currentTarget=a,function(e,t,a,n,r,o,i,c,d){if(Ye.apply(this,arguments),Ge){if(!Ge)throw Error(s(198));var l=He;Ge=!1,He=null,Ve||(Ve=!0,We=l)}}(n,t,void 0,e),e.currentTarget=null}function Nn(e,t){t=0!=(4&t);for(var a=0;a<e.length;a++){var n=e[a],r=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var s=n.length-1;0<=s;s--){var i=n[s],c=i.instance,d=i.currentTarget;if(i=i.listener,c!==o&&r.isPropagationStopped())break e;In(r,i,d),o=c}else for(s=0;s<n.length;s++){if(c=(i=n[s]).instance,d=i.currentTarget,i=i.listener,c!==o&&r.isPropagationStopped())break e;In(r,i,d),o=c}}}if(Ve)throw e=We,Ve=!1,We=null,e}function An(e,t){var a=sr(t),n=e+"__bubble";a.has(n)||(Rn(t,e,2,!1),a.add(n))}var Ln="_reactListening"+Math.random().toString(36).slice(2);function On(e){e[Ln]||(e[Ln]=!0,i.forEach((function(t){Tn.has(t)||Pn(t,!1,e,null),Pn(t,!0,e,null)})))}function Pn(e,t,a,n){var r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=a;if("selectionchange"===e&&9!==a.nodeType&&(o=a.ownerDocument),null!==n&&!t&&Tn.has(e)){if("scroll"!==e)return;r|=2,o=n}var s=sr(o),i=e+"__"+(t?"capture":"bubble");s.has(i)||(t&&(r|=4),Rn(o,e,r,t),s.add(i))}function Rn(e,t,a,n){var r=Pt.get(t);switch(void 0===r?2:r){case 0:r=Kt;break;case 1:r=Xt;break;default:r=Qt}a=r.bind(null,t,a,e),r=void 0,!$e||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),n?void 0!==r?e.addEventListener(t,a,{capture:!0,passive:r}):e.addEventListener(t,a,!0):void 0!==r?e.addEventListener(t,a,{passive:r}):e.addEventListener(t,a,!1)}function Mn(e,t,a,n,r){var o=n;if(0==(1&t)&&0==(2&t)&&null!==n)e:for(;;){if(null===n)return;var s=n.tag;if(3===s||4===s){var i=n.stateNode.containerInfo;if(i===r||8===i.nodeType&&i.parentNode===r)break;if(4===s)for(s=n.return;null!==s;){var c=s.tag;if((3===c||4===c)&&((c=s.stateNode.containerInfo)===r||8===c.nodeType&&c.parentNode===r))return;s=s.return}for(;null!==i;){if(null===(s=ar(i)))return;if(5===(c=s.tag)||6===c){n=o=s;continue e}i=i.parentNode}}n=n.return}!function(e,t,a){if(je)return e(t,a);je=!0;try{De(e,t,a)}finally{je=!1,Be()}}((function(){var n=o,r=Ce(a),s=[];e:{var i=Ot.get(e);if(void 0!==i){var c=pa,d=e;switch(e){case"keypress":if(0===ra(a))break e;case"keydown":case"keyup":c=Na;break;case"focusin":d="focus",c=va;break;case"focusout":d="blur",c=va;break;case"beforeblur":case"afterblur":c=va;break;case"click":if(2===a.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=ga;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=ha;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=La;break;case It:case Nt:case At:c=ya;break;case Lt:c=Oa;break;case"scroll":c=fa;break;case"wheel":c=Ra;break;case"copy":case"cut":case"paste":c=Sa;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Aa}var l=0!=(4&t),u=!l&&"scroll"===e,p=l?null!==i?i+"Capture":null:i;l=[];for(var b,f=n;null!==f;){var m=(b=f).stateNode;if(5===b.tag&&null!==m&&(b=m,null!==p&&(null!=(m=ze(f,p))&&l.push(Dn(f,m,b)))),u)break;f=f.return}0<l.length&&(i=new c(i,d,null,a,r),s.push({event:i,listeners:l}))}}if(0==(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(i="mouseover"===e||"pointerover"===e)||0!=(16&t)||!(d=a.relatedTarget||a.fromElement)||!ar(d)&&!d[er])&&(c||i)&&(i=r.window===r?r:(i=r.ownerDocument)?i.defaultView||i.parentWindow:window,c?(c=n,null!==(d=(d=a.relatedTarget||a.toElement)?ar(d):null)&&(d!==(u=Ke(d))||5!==d.tag&&6!==d.tag)&&(d=null)):(c=null,d=n),c!==d)){if(l=ga,m="onMouseLeave",p="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(l=Aa,m="onPointerLeave",p="onPointerEnter",f="pointer"),u=null==c?i:rr(c),b=null==d?i:rr(d),(i=new l(m,f+"leave",c,a,r)).target=u,i.relatedTarget=b,m=null,ar(r)===n&&((l=new l(p,f+"enter",d,a,r)).target=b,l.relatedTarget=u,m=l),u=m,c&&d)e:{for(p=d,f=0,b=l=c;b;b=jn(b))f++;for(b=0,m=p;m;m=jn(m))b++;for(;0<f-b;)l=jn(l),f--;for(;0<b-f;)p=jn(p),b--;for(;f--;){if(l===p||null!==p&&l===p.alternate)break e;l=jn(l),p=jn(p)}l=null}else l=null;null!==c&&Bn(s,i,c,l,!1),null!==d&&null!==u&&Bn(s,u,d,l,!0)}if("select"===(c=(i=n?rr(n):window).nodeName&&i.nodeName.toLowerCase())||"input"===c&&"file"===i.type)var g=Qa;else if(Va(i))if(Ja)g=dn;else{g=sn;var h=on}else(c=i.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(g=cn);switch(g&&(g=g(e,n))?Wa(s,g,a,r):(h&&h(e,i,n),"focusout"===e&&(h=i._wrapperState)&&h.controlled&&"number"===i.type&&re(i,"number",i.value)),h=n?rr(n):window,e){case"focusin":(Va(h)||"true"===h.contentEditable)&&(yn=h,_n=n,Sn=null);break;case"focusout":Sn=_n=yn=null;break;case"mousedown":xn=!0;break;case"contextmenu":case"mouseup":case"dragend":xn=!1,kn(s,a,r);break;case"selectionchange":if(vn)break;case"keydown":case"keyup":kn(s,a,r)}var v;if(Da)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Ga?Ua(e,a)&&(y="onCompositionEnd"):"keydown"===e&&229===a.keyCode&&(y="onCompositionStart");y&&(Ba&&"ko"!==a.locale&&(Ga||"onCompositionStart"!==y?"onCompositionEnd"===y&&Ga&&(v=na()):(ta="value"in(ea=r)?ea.value:ea.textContent,Ga=!0)),0<(h=Fn(n,y)).length&&(y=new xa(y,e,null,a,r),s.push({event:y,listeners:h}),v?y.data=v:null!==(v=Za(a))&&(y.data=v))),(v=ja?function(e,t){switch(e){case"compositionend":return Za(t);case"keypress":return 32!==t.which?null:($a=!0,za);case"textInput":return(e=t.data)===za&&$a?null:e;default:return null}}(e,a):function(e,t){if(Ga)return"compositionend"===e||!Da&&Ua(e,t)?(e=na(),aa=ta=ea=null,Ga=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ba&&"ko"!==t.locale?null:t.data}}(e,a))&&(0<(n=Fn(n,"onBeforeInput")).length&&(r=new xa("onBeforeInput","beforeinput",null,a,r),s.push({event:r,listeners:n}),r.data=v))}Nn(s,t)}))}function Dn(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Fn(e,t){for(var a=t+"Capture",n=[];null!==e;){var r=e,o=r.stateNode;5===r.tag&&null!==o&&(r=o,null!=(o=ze(e,a))&&n.unshift(Dn(e,o,r)),null!=(o=ze(e,t))&&n.push(Dn(e,o,r))),e=e.return}return n}function jn(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Bn(e,t,a,n,r){for(var o=t._reactName,s=[];null!==a&&a!==n;){var i=a,c=i.alternate,d=i.stateNode;if(null!==c&&c===n)break;5===i.tag&&null!==d&&(i=d,r?null!=(c=ze(a,o))&&s.unshift(Dn(a,c,i)):r||null!=(c=ze(a,o))&&s.push(Dn(a,c,i))),a=a.return}0!==s.length&&e.push({event:t,listeners:s})}function zn(){}var $n=null,Un=null;function Zn(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Gn(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Hn="function"==typeof setTimeout?setTimeout:void 0,Vn="function"==typeof clearTimeout?clearTimeout:void 0;function Wn(e){1===e.nodeType?e.textContent="":9===e.nodeType&&(null!=(e=e.body)&&(e.textContent=""))}function qn(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Yn(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var a=e.data;if("$"===a||"$!"===a||"$?"===a){if(0===t)return e;t--}else"/$"===a&&t++}e=e.previousSibling}return null}var Kn=0;var Xn=Math.random().toString(36).slice(2),Qn="__reactFiber$"+Xn,Jn="__reactProps$"+Xn,er="__reactContainer$"+Xn,tr="__reactEvents$"+Xn;function ar(e){var t=e[Qn];if(t)return t;for(var a=e.parentNode;a;){if(t=a[er]||a[Qn]){if(a=t.alternate,null!==t.child||null!==a&&null!==a.child)for(e=Yn(e);null!==e;){if(a=e[Qn])return a;e=Yn(e)}return t}a=(e=a).parentNode}return null}function nr(e){return!(e=e[Qn]||e[er])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function rr(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(s(33))}function or(e){return e[Jn]||null}function sr(e){var t=e[tr];return void 0===t&&(t=e[tr]=new Set),t}var ir=[],cr=-1;function dr(e){return{current:e}}function lr(e){0>cr||(e.current=ir[cr],ir[cr]=null,cr--)}function ur(e,t){cr++,ir[cr]=e.current,e.current=t}var pr={},br=dr(pr),fr=dr(!1),mr=pr;function gr(e,t){var a=e.type.contextTypes;if(!a)return pr;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var r,o={};for(r in a)o[r]=t[r];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function hr(e){return null!=(e=e.childContextTypes)}function vr(){lr(fr),lr(br)}function yr(e,t,a){if(br.current!==pr)throw Error(s(168));ur(br,t),ur(fr,a)}function _r(e,t,a){var n=e.stateNode;if(e=t.childContextTypes,"function"!=typeof n.getChildContext)return a;for(var o in n=n.getChildContext())if(!(o in e))throw Error(s(108,W(t)||"Unknown",o));return r({},a,n)}function Sr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pr,mr=br.current,ur(br,e),ur(fr,fr.current),!0}function xr(e,t,a){var n=e.stateNode;if(!n)throw Error(s(169));a?(e=_r(e,t,mr),n.__reactInternalMemoizedMergedChildContext=e,lr(fr),lr(br),ur(br,e)):lr(fr),ur(fr,a)}var kr=null,wr=null,Er=o.unstable_runWithPriority,Cr=o.unstable_scheduleCallback,Tr=o.unstable_cancelCallback,Ir=o.unstable_shouldYield,Nr=o.unstable_requestPaint,Ar=o.unstable_now,Lr=o.unstable_getCurrentPriorityLevel,Or=o.unstable_ImmediatePriority,Pr=o.unstable_UserBlockingPriority,Rr=o.unstable_NormalPriority,Mr=o.unstable_LowPriority,Dr=o.unstable_IdlePriority,Fr={},jr=void 0!==Nr?Nr:function(){},Br=null,zr=null,$r=!1,Ur=Ar(),Zr=1e4>Ur?Ar:function(){return Ar()-Ur};function Gr(){switch(Lr()){case Or:return 99;case Pr:return 98;case Rr:return 97;case Mr:return 96;case Dr:return 95;default:throw Error(s(332))}}function Hr(e){switch(e){case 99:return Or;case 98:return Pr;case 97:return Rr;case 96:return Mr;case 95:return Dr;default:throw Error(s(332))}}function Vr(e,t){return e=Hr(e),Er(e,t)}function Wr(e,t,a){return e=Hr(e),Cr(e,t,a)}function qr(){if(null!==zr){var e=zr;zr=null,Tr(e)}Yr()}function Yr(){if(!$r&&null!==Br){$r=!0;var e=0;try{var t=Br;Vr(99,(function(){for(;e<t.length;e++){var a=t[e];do{a=a(!0)}while(null!==a)}})),Br=null}catch(a){throw null!==Br&&(Br=Br.slice(e+1)),Cr(Or,qr),a}finally{$r=!1}}}var Kr=S.ReactCurrentBatchConfig;function Xr(e,t){if(e&&e.defaultProps){for(var a in t=r({},t),e=e.defaultProps)void 0===t[a]&&(t[a]=e[a]);return t}return t}var Qr=dr(null),Jr=null,eo=null,to=null;function ao(){to=eo=Jr=null}function no(e){var t=Qr.current;lr(Qr),e.type._context._currentValue=t}function ro(e,t){for(;null!==e;){var a=e.alternate;if((e.childLanes&t)===t){if(null===a||(a.childLanes&t)===t)break;a.childLanes|=t}else e.childLanes|=t,null!==a&&(a.childLanes|=t);e=e.return}}function oo(e,t){Jr=e,to=eo=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Fs=!0),e.firstContext=null)}function so(e,t){if(to!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(to=e,t=1073741823),t={context:e,observedBits:t,next:null},null===eo){if(null===Jr)throw Error(s(308));eo=t,Jr.dependencies={lanes:0,firstContext:t,responders:null}}else eo=eo.next=t;return e._currentValue}var io=!1;function co(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function lo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function uo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function po(e,t){if(null!==(e=e.updateQueue)){var a=(e=e.shared).pending;null===a?t.next=t:(t.next=a.next,a.next=t),e.pending=t}}function bo(e,t){var a=e.updateQueue,n=e.alternate;if(null!==n&&a===(n=n.updateQueue)){var r=null,o=null;if(null!==(a=a.firstBaseUpdate)){do{var s={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};null===o?r=o=s:o=o.next=s,a=a.next}while(null!==a);null===o?r=o=t:o=o.next=t}else r=o=t;return a={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:n.shared,effects:n.effects},void(e.updateQueue=a)}null===(e=a.lastBaseUpdate)?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}function fo(e,t,a,n){var o=e.updateQueue;io=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,c=o.shared.pending;if(null!==c){o.shared.pending=null;var d=c,l=d.next;d.next=null,null===i?s=l:i.next=l,i=d;var u=e.alternate;if(null!==u){var p=(u=u.updateQueue).lastBaseUpdate;p!==i&&(null===p?u.firstBaseUpdate=l:p.next=l,u.lastBaseUpdate=d)}}if(null!==s){for(p=o.baseState,i=0,u=l=d=null;;){c=s.lane;var b=s.eventTime;if((n&c)===c){null!==u&&(u=u.next={eventTime:b,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var f=e,m=s;switch(c=t,b=a,m.tag){case 1:if("function"==typeof(f=m.payload)){p=f.call(b,p,c);break e}p=f;break e;case 3:f.flags=-4097&f.flags|64;case 0:if(null==(c="function"==typeof(f=m.payload)?f.call(b,p,c):f))break e;p=r({},p,c);break e;case 2:io=!0}}null!==s.callback&&(e.flags|=32,null===(c=o.effects)?o.effects=[s]:c.push(s))}else b={eventTime:b,lane:c,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===u?(l=u=b,d=p):u=u.next=b,i|=c;if(null===(s=s.next)){if(null===(c=o.shared.pending))break;s=c.next,c.next=null,o.lastBaseUpdate=c,o.shared.pending=null}}null===u&&(d=p),o.baseState=d,o.firstBaseUpdate=l,o.lastBaseUpdate=u,$i|=i,e.lanes=i,e.memoizedState=p}}function mo(e,t,a){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var n=e[t],r=n.callback;if(null!==r){if(n.callback=null,n=a,"function"!=typeof r)throw Error(s(191,r));r.call(n)}}}var go=(new n.Component).refs;function ho(e,t,a,n){a=null==(a=a(n,t=e.memoizedState))?t:r({},t,a),e.memoizedState=a,0===e.lanes&&(e.updateQueue.baseState=a)}var vo={isMounted:function(e){return!!(e=e._reactInternals)&&Ke(e)===e},enqueueSetState:function(e,t,a){e=e._reactInternals;var n=pc(),r=bc(e),o=uo(n,r);o.payload=t,null!=a&&(o.callback=a),po(e,o),fc(e,r,n)},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=pc(),r=bc(e),o=uo(n,r);o.tag=1,o.payload=t,null!=a&&(o.callback=a),po(e,o),fc(e,r,n)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=pc(),n=bc(e),r=uo(a,n);r.tag=2,null!=t&&(r.callback=t),po(e,r),fc(e,n,a)}};function yo(e,t,a,n,r,o,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!pn(a,n)||!pn(r,o))}function _o(e,t,a){var n=!1,r=pr,o=t.contextType;return"object"==typeof o&&null!==o?o=so(o):(r=hr(t)?mr:br.current,o=(n=null!=(n=t.contextTypes))?gr(e,r):pr),t=new t(a,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=vo,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=o),t}function So(e,t,a,n){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(a,n),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&vo.enqueueReplaceState(t,t.state,null)}function xo(e,t,a,n){var r=e.stateNode;r.props=a,r.state=e.memoizedState,r.refs=go,co(e);var o=t.contextType;"object"==typeof o&&null!==o?r.context=so(o):(o=hr(t)?mr:br.current,r.context=gr(e,o)),fo(e,a,r,n),r.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(ho(e,t,o,a),r.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof r.getSnapshotBeforeUpdate||"function"!=typeof r.UNSAFE_componentWillMount&&"function"!=typeof r.componentWillMount||(t=r.state,"function"==typeof r.componentWillMount&&r.componentWillMount(),"function"==typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),t!==r.state&&vo.enqueueReplaceState(r,r.state,null),fo(e,a,r,n),r.state=e.memoizedState),"function"==typeof r.componentDidMount&&(e.flags|=4)}var ko=Array.isArray;function wo(e,t,a){if(null!==(e=a.ref)&&"function"!=typeof e&&"object"!=typeof e){if(a._owner){if(a=a._owner){if(1!==a.tag)throw Error(s(309));var n=a.stateNode}if(!n)throw Error(s(147,e));var r=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===r?t.ref:(t=function(e){var t=n.refs;t===go&&(t=n.refs={}),null===e?delete t[r]:t[r]=e},t._stringRef=r,t)}if("string"!=typeof e)throw Error(s(284));if(!a._owner)throw Error(s(290,e))}return e}function Eo(e,t){if("textarea"!==e.type)throw Error(s(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function Co(e){function t(t,a){if(e){var n=t.lastEffect;null!==n?(n.nextEffect=a,t.lastEffect=a):t.firstEffect=t.lastEffect=a,a.nextEffect=null,a.flags=8}}function a(a,n){if(!e)return null;for(;null!==n;)t(a,n),n=n.sibling;return null}function n(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function r(e,t){return(e=Vc(e,t)).index=0,e.sibling=null,e}function o(t,a,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<a?(t.flags=2,a):n:(t.flags=2,a):a}function i(t){return e&&null===t.alternate&&(t.flags=2),t}function c(e,t,a,n){return null===t||6!==t.tag?((t=Kc(a,e.mode,n)).return=e,t):((t=r(t,a)).return=e,t)}function d(e,t,a,n){return null!==t&&t.elementType===a.type?((n=r(t,a.props)).ref=wo(e,t,a),n.return=e,n):((n=Wc(a.type,a.key,a.props,null,e.mode,n)).ref=wo(e,t,a),n.return=e,n)}function l(e,t,a,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==a.containerInfo||t.stateNode.implementation!==a.implementation?((t=Xc(a,e.mode,n)).return=e,t):((t=r(t,a.children||[])).return=e,t)}function u(e,t,a,n,o){return null===t||7!==t.tag?((t=qc(a,e.mode,n,o)).return=e,t):((t=r(t,a)).return=e,t)}function p(e,t,a){if("string"==typeof t||"number"==typeof t)return(t=Kc(""+t,e.mode,a)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case x:return(a=Wc(t.type,t.key,t.props,null,e.mode,a)).ref=wo(e,null,t),a.return=e,a;case k:return(t=Xc(t,e.mode,a)).return=e,t}if(ko(t)||U(t))return(t=qc(t,e.mode,a,null)).return=e,t;Eo(e,t)}return null}function b(e,t,a,n){var r=null!==t?t.key:null;if("string"==typeof a||"number"==typeof a)return null!==r?null:c(e,t,""+a,n);if("object"==typeof a&&null!==a){switch(a.$$typeof){case x:return a.key===r?a.type===w?u(e,t,a.props.children,n,r):d(e,t,a,n):null;case k:return a.key===r?l(e,t,a,n):null}if(ko(a)||U(a))return null!==r?null:u(e,t,a,n,null);Eo(e,a)}return null}function f(e,t,a,n,r){if("string"==typeof n||"number"==typeof n)return c(t,e=e.get(a)||null,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case x:return e=e.get(null===n.key?a:n.key)||null,n.type===w?u(t,e,n.props.children,r,n.key):d(t,e,n,r);case k:return l(t,e=e.get(null===n.key?a:n.key)||null,n,r)}if(ko(n)||U(n))return u(t,e=e.get(a)||null,n,r,null);Eo(t,n)}return null}function m(r,s,i,c){for(var d=null,l=null,u=s,m=s=0,g=null;null!==u&&m<i.length;m++){u.index>m?(g=u,u=null):g=u.sibling;var h=b(r,u,i[m],c);if(null===h){null===u&&(u=g);break}e&&u&&null===h.alternate&&t(r,u),s=o(h,s,m),null===l?d=h:l.sibling=h,l=h,u=g}if(m===i.length)return a(r,u),d;if(null===u){for(;m<i.length;m++)null!==(u=p(r,i[m],c))&&(s=o(u,s,m),null===l?d=u:l.sibling=u,l=u);return d}for(u=n(r,u);m<i.length;m++)null!==(g=f(u,r,m,i[m],c))&&(e&&null!==g.alternate&&u.delete(null===g.key?m:g.key),s=o(g,s,m),null===l?d=g:l.sibling=g,l=g);return e&&u.forEach((function(e){return t(r,e)})),d}function g(r,i,c,d){var l=U(c);if("function"!=typeof l)throw Error(s(150));if(null==(c=l.call(c)))throw Error(s(151));for(var u=l=null,m=i,g=i=0,h=null,v=c.next();null!==m&&!v.done;g++,v=c.next()){m.index>g?(h=m,m=null):h=m.sibling;var y=b(r,m,v.value,d);if(null===y){null===m&&(m=h);break}e&&m&&null===y.alternate&&t(r,m),i=o(y,i,g),null===u?l=y:u.sibling=y,u=y,m=h}if(v.done)return a(r,m),l;if(null===m){for(;!v.done;g++,v=c.next())null!==(v=p(r,v.value,d))&&(i=o(v,i,g),null===u?l=v:u.sibling=v,u=v);return l}for(m=n(r,m);!v.done;g++,v=c.next())null!==(v=f(m,r,g,v.value,d))&&(e&&null!==v.alternate&&m.delete(null===v.key?g:v.key),i=o(v,i,g),null===u?l=v:u.sibling=v,u=v);return e&&m.forEach((function(e){return t(r,e)})),l}return function(e,n,o,c){var d="object"==typeof o&&null!==o&&o.type===w&&null===o.key;d&&(o=o.props.children);var l="object"==typeof o&&null!==o;if(l)switch(o.$$typeof){case x:e:{for(l=o.key,d=n;null!==d;){if(d.key===l){if(7===d.tag){if(o.type===w){a(e,d.sibling),(n=r(d,o.props.children)).return=e,e=n;break e}}else if(d.elementType===o.type){a(e,d.sibling),(n=r(d,o.props)).ref=wo(e,d,o),n.return=e,e=n;break e}a(e,d);break}t(e,d),d=d.sibling}o.type===w?((n=qc(o.props.children,e.mode,c,o.key)).return=e,e=n):((c=Wc(o.type,o.key,o.props,null,e.mode,c)).ref=wo(e,n,o),c.return=e,e=c)}return i(e);case k:e:{for(d=o.key;null!==n;){if(n.key===d){if(4===n.tag&&n.stateNode.containerInfo===o.containerInfo&&n.stateNode.implementation===o.implementation){a(e,n.sibling),(n=r(n,o.children||[])).return=e,e=n;break e}a(e,n);break}t(e,n),n=n.sibling}(n=Xc(o,e.mode,c)).return=e,e=n}return i(e)}if("string"==typeof o||"number"==typeof o)return o=""+o,null!==n&&6===n.tag?(a(e,n.sibling),(n=r(n,o)).return=e,e=n):(a(e,n),(n=Kc(o,e.mode,c)).return=e,e=n),i(e);if(ko(o))return m(e,n,o,c);if(U(o))return g(e,n,o,c);if(l&&Eo(e,o),void 0===o&&!d)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(s(152,W(e.type)||"Component"))}return a(e,n)}}var To=Co(!0),Io=Co(!1),No={},Ao=dr(No),Lo=dr(No),Oo=dr(No);function Po(e){if(e===No)throw Error(s(174));return e}function Ro(e,t){switch(ur(Oo,t),ur(Lo,e),ur(Ao,No),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fe(null,"");break;default:t=fe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}lr(Ao),ur(Ao,t)}function Mo(){lr(Ao),lr(Lo),lr(Oo)}function Do(e){Po(Oo.current);var t=Po(Ao.current),a=fe(t,e.type);t!==a&&(ur(Lo,e),ur(Ao,a))}function Fo(e){Lo.current===e&&(lr(Ao),lr(Lo))}var jo=dr(0);function Bo(e){for(var t=e;null!==t;){if(13===t.tag){var a=t.memoizedState;if(null!==a&&(null===(a=a.dehydrated)||"$?"===a.data||"$!"===a.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zo=null,$o=null,Uo=!1;function Zo(e,t){var a=Gc(5,null,null,0);a.elementType="DELETED",a.type="DELETED",a.stateNode=t,a.return=e,a.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=a,e.lastEffect=a):e.firstEffect=e.lastEffect=a}function Go(e,t){switch(e.tag){case 5:var a=e.type;return null!==(t=1!==t.nodeType||a.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Ho(e){if(Uo){var t=$o;if(t){var a=t;if(!Go(e,t)){if(!(t=qn(a.nextSibling))||!Go(e,t))return e.flags=-1025&e.flags|2,Uo=!1,void(zo=e);Zo(zo,a)}zo=e,$o=qn(t.firstChild)}else e.flags=-1025&e.flags|2,Uo=!1,zo=e}}function Vo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;zo=e}function Wo(e){if(e!==zo)return!1;if(!Uo)return Vo(e),Uo=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Gn(t,e.memoizedProps))for(t=$o;t;)Zo(e,t),t=qn(t.nextSibling);if(Vo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var a=e.data;if("/$"===a){if(0===t){$o=qn(e.nextSibling);break e}t--}else"$"!==a&&"$!"!==a&&"$?"!==a||t++}e=e.nextSibling}$o=null}}else $o=zo?qn(e.stateNode.nextSibling):null;return!0}function qo(){$o=zo=null,Uo=!1}var Yo=[];function Ko(){for(var e=0;e<Yo.length;e++)Yo[e]._workInProgressVersionPrimary=null;Yo.length=0}var Xo=S.ReactCurrentDispatcher,Qo=S.ReactCurrentBatchConfig,Jo=0,es=null,ts=null,as=null,ns=!1,rs=!1;function os(){throw Error(s(321))}function ss(e,t){if(null===t)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!ln(e[a],t[a]))return!1;return!0}function is(e,t,a,n,r,o){if(Jo=o,es=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Xo.current=null===e||null===e.memoizedState?Ps:Rs,e=a(n,r),rs){o=0;do{if(rs=!1,!(25>o))throw Error(s(301));o+=1,as=ts=null,t.updateQueue=null,Xo.current=Ms,e=a(n,r)}while(rs)}if(Xo.current=Os,t=null!==ts&&null!==ts.next,Jo=0,as=ts=es=null,ns=!1,t)throw Error(s(300));return e}function cs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===as?es.memoizedState=as=e:as=as.next=e,as}function ds(){if(null===ts){var e=es.alternate;e=null!==e?e.memoizedState:null}else e=ts.next;var t=null===as?es.memoizedState:as.next;if(null!==t)as=t,ts=e;else{if(null===e)throw Error(s(310));e={memoizedState:(ts=e).memoizedState,baseState:ts.baseState,baseQueue:ts.baseQueue,queue:ts.queue,next:null},null===as?es.memoizedState=as=e:as=as.next=e}return as}function ls(e,t){return"function"==typeof t?t(e):t}function us(e){var t=ds(),a=t.queue;if(null===a)throw Error(s(311));a.lastRenderedReducer=e;var n=ts,r=n.baseQueue,o=a.pending;if(null!==o){if(null!==r){var i=r.next;r.next=o.next,o.next=i}n.baseQueue=r=o,a.pending=null}if(null!==r){r=r.next,n=n.baseState;var c=i=o=null,d=r;do{var l=d.lane;if((Jo&l)===l)null!==c&&(c=c.next={lane:0,action:d.action,eagerReducer:d.eagerReducer,eagerState:d.eagerState,next:null}),n=d.eagerReducer===e?d.eagerState:e(n,d.action);else{var u={lane:l,action:d.action,eagerReducer:d.eagerReducer,eagerState:d.eagerState,next:null};null===c?(i=c=u,o=n):c=c.next=u,es.lanes|=l,$i|=l}d=d.next}while(null!==d&&d!==r);null===c?o=n:c.next=i,ln(n,t.memoizedState)||(Fs=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=c,a.lastRenderedState=n}return[t.memoizedState,a.dispatch]}function ps(e){var t=ds(),a=t.queue;if(null===a)throw Error(s(311));a.lastRenderedReducer=e;var n=a.dispatch,r=a.pending,o=t.memoizedState;if(null!==r){a.pending=null;var i=r=r.next;do{o=e(o,i.action),i=i.next}while(i!==r);ln(o,t.memoizedState)||(Fs=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),a.lastRenderedState=o}return[o,n]}function bs(e,t,a){var n=t._getVersion;n=n(t._source);var r=t._workInProgressVersionPrimary;if(null!==r?e=r===n:(e=e.mutableReadLanes,(e=(Jo&e)===e)&&(t._workInProgressVersionPrimary=n,Yo.push(t))),e)return a(t._source);throw Yo.push(t),Error(s(350))}function fs(e,t,a,n){var r=Pi;if(null===r)throw Error(s(349));var o=t._getVersion,i=o(t._source),c=Xo.current,d=c.useState((function(){return bs(r,t,a)})),l=d[1],u=d[0];d=as;var p=e.memoizedState,b=p.refs,f=b.getSnapshot,m=p.source;p=p.subscribe;var g=es;return e.memoizedState={refs:b,source:t,subscribe:n},c.useEffect((function(){b.getSnapshot=a,b.setSnapshot=l;var e=o(t._source);if(!ln(i,e)){e=a(t._source),ln(u,e)||(l(e),e=bc(g),r.mutableReadLanes|=e&r.pendingLanes),e=r.mutableReadLanes,r.entangledLanes|=e;for(var n=r.entanglements,s=e;0<s;){var c=31-Gt(s),d=1<<c;n[c]|=e,s&=~d}}}),[a,t,n]),c.useEffect((function(){return n(t._source,(function(){var e=b.getSnapshot,a=b.setSnapshot;try{a(e(t._source));var n=bc(g);r.mutableReadLanes|=n&r.pendingLanes}catch(o){a((function(){throw o}))}}))}),[t,n]),ln(f,a)&&ln(m,t)&&ln(p,n)||((e={pending:null,dispatch:null,lastRenderedReducer:ls,lastRenderedState:u}).dispatch=l=Ls.bind(null,es,e),d.queue=e,d.baseQueue=null,u=bs(r,t,a),d.memoizedState=d.baseState=u),u}function ms(e,t,a){return fs(ds(),e,t,a)}function gs(e){var t=cs();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:ls,lastRenderedState:e}).dispatch=Ls.bind(null,es,e),[t.memoizedState,e]}function hs(e,t,a,n){return e={tag:e,create:t,destroy:a,deps:n,next:null},null===(t=es.updateQueue)?(t={lastEffect:null},es.updateQueue=t,t.lastEffect=e.next=e):null===(a=t.lastEffect)?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function vs(e){return e={current:e},cs().memoizedState=e}function ys(){return ds().memoizedState}function _s(e,t,a,n){var r=cs();es.flags|=e,r.memoizedState=hs(1|t,a,void 0,void 0===n?null:n)}function Ss(e,t,a,n){var r=ds();n=void 0===n?null:n;var o=void 0;if(null!==ts){var s=ts.memoizedState;if(o=s.destroy,null!==n&&ss(n,s.deps))return void hs(t,a,o,n)}es.flags|=e,r.memoizedState=hs(1|t,a,o,n)}function xs(e,t){return _s(516,4,e,t)}function ks(e,t){return Ss(516,4,e,t)}function ws(e,t){return Ss(4,2,e,t)}function Es(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Cs(e,t,a){return a=null!=a?a.concat([e]):null,Ss(4,2,Es.bind(null,t,e),a)}function Ts(){}function Is(e,t){var a=ds();t=void 0===t?null:t;var n=a.memoizedState;return null!==n&&null!==t&&ss(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function Ns(e,t){var a=ds();t=void 0===t?null:t;var n=a.memoizedState;return null!==n&&null!==t&&ss(t,n[1])?n[0]:(e=e(),a.memoizedState=[e,t],e)}function As(e,t){var a=Gr();Vr(98>a?98:a,(function(){e(!0)})),Vr(97<a?97:a,(function(){var a=Qo.transition;Qo.transition=1;try{e(!1),t()}finally{Qo.transition=a}}))}function Ls(e,t,a){var n=pc(),r=bc(e),o={lane:r,action:a,eagerReducer:null,eagerState:null,next:null},s=t.pending;if(null===s?o.next=o:(o.next=s.next,s.next=o),t.pending=o,s=e.alternate,e===es||null!==s&&s===es)rs=ns=!0;else{if(0===e.lanes&&(null===s||0===s.lanes)&&null!==(s=t.lastRenderedReducer))try{var i=t.lastRenderedState,c=s(i,a);if(o.eagerReducer=s,o.eagerState=c,ln(c,i))return}catch(d){}fc(e,r,n)}}var Os={readContext:so,useCallback:os,useContext:os,useEffect:os,useImperativeHandle:os,useLayoutEffect:os,useMemo:os,useReducer:os,useRef:os,useState:os,useDebugValue:os,useDeferredValue:os,useTransition:os,useMutableSource:os,useOpaqueIdentifier:os,unstable_isNewReconciler:!1},Ps={readContext:so,useCallback:function(e,t){return cs().memoizedState=[e,void 0===t?null:t],e},useContext:so,useEffect:xs,useImperativeHandle:function(e,t,a){return a=null!=a?a.concat([e]):null,_s(4,2,Es.bind(null,t,e),a)},useLayoutEffect:function(e,t){return _s(4,2,e,t)},useMemo:function(e,t){var a=cs();return t=void 0===t?null:t,e=e(),a.memoizedState=[e,t],e},useReducer:function(e,t,a){var n=cs();return t=void 0!==a?a(t):t,n.memoizedState=n.baseState=t,e=(e=n.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Ls.bind(null,es,e),[n.memoizedState,e]},useRef:vs,useState:gs,useDebugValue:Ts,useDeferredValue:function(e){var t=gs(e),a=t[0],n=t[1];return xs((function(){var t=Qo.transition;Qo.transition=1;try{n(e)}finally{Qo.transition=t}}),[e]),a},useTransition:function(){var e=gs(!1),t=e[0];return vs(e=As.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,a){var n=cs();return n.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:a},fs(n,e,t,a)},useOpaqueIdentifier:function(){if(Uo){var e=!1,t=function(e){return{$$typeof:M,toString:e,valueOf:e}}((function(){throw e||(e=!0,a("r:"+(Kn++).toString(36))),Error(s(355))})),a=gs(t)[1];return 0==(2&es.mode)&&(es.flags|=516,hs(5,(function(){a("r:"+(Kn++).toString(36))}),void 0,null)),t}return gs(t="r:"+(Kn++).toString(36)),t},unstable_isNewReconciler:!1},Rs={readContext:so,useCallback:Is,useContext:so,useEffect:ks,useImperativeHandle:Cs,useLayoutEffect:ws,useMemo:Ns,useReducer:us,useRef:ys,useState:function(){return us(ls)},useDebugValue:Ts,useDeferredValue:function(e){var t=us(ls),a=t[0],n=t[1];return ks((function(){var t=Qo.transition;Qo.transition=1;try{n(e)}finally{Qo.transition=t}}),[e]),a},useTransition:function(){var e=us(ls)[0];return[ys().current,e]},useMutableSource:ms,useOpaqueIdentifier:function(){return us(ls)[0]},unstable_isNewReconciler:!1},Ms={readContext:so,useCallback:Is,useContext:so,useEffect:ks,useImperativeHandle:Cs,useLayoutEffect:ws,useMemo:Ns,useReducer:ps,useRef:ys,useState:function(){return ps(ls)},useDebugValue:Ts,useDeferredValue:function(e){var t=ps(ls),a=t[0],n=t[1];return ks((function(){var t=Qo.transition;Qo.transition=1;try{n(e)}finally{Qo.transition=t}}),[e]),a},useTransition:function(){var e=ps(ls)[0];return[ys().current,e]},useMutableSource:ms,useOpaqueIdentifier:function(){return ps(ls)[0]},unstable_isNewReconciler:!1},Ds=S.ReactCurrentOwner,Fs=!1;function js(e,t,a,n){t.child=null===e?Io(t,null,a,n):To(t,e.child,a,n)}function Bs(e,t,a,n,r){a=a.render;var o=t.ref;return oo(t,r),n=is(e,t,a,n,o,r),null===e||Fs?(t.flags|=1,js(e,t,n,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~r,oi(e,t,r))}function zs(e,t,a,n,r,o){if(null===e){var s=a.type;return"function"!=typeof s||Hc(s)||void 0!==s.defaultProps||null!==a.compare||void 0!==a.defaultProps?((e=Wc(a.type,null,n,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=s,$s(e,t,s,n,r,o))}return s=e.child,0==(r&o)&&(r=s.memoizedProps,(a=null!==(a=a.compare)?a:pn)(r,n)&&e.ref===t.ref)?oi(e,t,o):(t.flags|=1,(e=Vc(s,n)).ref=t.ref,e.return=t,t.child=e)}function $s(e,t,a,n,r,o){if(null!==e&&pn(e.memoizedProps,n)&&e.ref===t.ref){if(Fs=!1,0==(o&r))return t.lanes=e.lanes,oi(e,t,o);0!=(16384&e.flags)&&(Fs=!0)}return Gs(e,t,a,n,o)}function Us(e,t,a){var n=t.pendingProps,r=n.children,o=null!==e?e.memoizedState:null;if("hidden"===n.mode||"unstable-defer-without-hiding"===n.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},xc(t,a);else{if(0==(1073741824&a))return e=null!==o?o.baseLanes|a:a,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},xc(t,e),null;t.memoizedState={baseLanes:0},xc(t,null!==o?o.baseLanes:a)}else null!==o?(n=o.baseLanes|a,t.memoizedState=null):n=a,xc(t,n);return js(e,t,r,a),t.child}function Zs(e,t){var a=t.ref;(null===e&&null!==a||null!==e&&e.ref!==a)&&(t.flags|=128)}function Gs(e,t,a,n,r){var o=hr(a)?mr:br.current;return o=gr(t,o),oo(t,r),a=is(e,t,a,n,o,r),null===e||Fs?(t.flags|=1,js(e,t,a,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~r,oi(e,t,r))}function Hs(e,t,a,n,r){if(hr(a)){var o=!0;Sr(t)}else o=!1;if(oo(t,r),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),_o(t,a,n),xo(t,a,n,r),n=!0;else if(null===e){var s=t.stateNode,i=t.memoizedProps;s.props=i;var c=s.context,d=a.contextType;"object"==typeof d&&null!==d?d=so(d):d=gr(t,d=hr(a)?mr:br.current);var l=a.getDerivedStateFromProps,u="function"==typeof l||"function"==typeof s.getSnapshotBeforeUpdate;u||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(i!==n||c!==d)&&So(t,s,n,d),io=!1;var p=t.memoizedState;s.state=p,fo(t,n,s,r),c=t.memoizedState,i!==n||p!==c||fr.current||io?("function"==typeof l&&(ho(t,a,l,n),c=t.memoizedState),(i=io||yo(t,a,i,n,p,c,d))?(u||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4)):("function"==typeof s.componentDidMount&&(t.flags|=4),t.memoizedProps=n,t.memoizedState=c),s.props=n,s.state=c,s.context=d,n=i):("function"==typeof s.componentDidMount&&(t.flags|=4),n=!1)}else{s=t.stateNode,lo(e,t),i=t.memoizedProps,d=t.type===t.elementType?i:Xr(t.type,i),s.props=d,u=t.pendingProps,p=s.context,"object"==typeof(c=a.contextType)&&null!==c?c=so(c):c=gr(t,c=hr(a)?mr:br.current);var b=a.getDerivedStateFromProps;(l="function"==typeof b||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(i!==u||p!==c)&&So(t,s,n,c),io=!1,p=t.memoizedState,s.state=p,fo(t,n,s,r);var f=t.memoizedState;i!==u||p!==f||fr.current||io?("function"==typeof b&&(ho(t,a,b,n),f=t.memoizedState),(d=io||yo(t,a,d,n,p,f,c))?(l||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(n,f,c),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(n,f,c)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof s.componentDidUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=256),t.memoizedProps=n,t.memoizedState=f),s.props=n,s.state=f,s.context=c,n=d):("function"!=typeof s.componentDidUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=256),n=!1)}return Vs(e,t,a,n,o,r)}function Vs(e,t,a,n,r,o){Zs(e,t);var s=0!=(64&t.flags);if(!n&&!s)return r&&xr(t,a,!1),oi(e,t,o);n=t.stateNode,Ds.current=t;var i=s&&"function"!=typeof a.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&s?(t.child=To(t,e.child,null,o),t.child=To(t,null,i,o)):js(e,t,i,o),t.memoizedState=n.state,r&&xr(t,a,!0),t.child}function Ws(e){var t=e.stateNode;t.pendingContext?yr(0,t.pendingContext,t.pendingContext!==t.context):t.context&&yr(0,t.context,!1),Ro(e,t.containerInfo)}var qs,Ys,Ks,Xs={dehydrated:null,retryLane:0};function Qs(e,t,a){var n,r=t.pendingProps,o=jo.current,s=!1;return(n=0!=(64&t.flags))||(n=(null===e||null!==e.memoizedState)&&0!=(2&o)),n?(s=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===r.fallback||!0===r.unstable_avoidThisFallback||(o|=1),ur(jo,1&o),null===e?(void 0!==r.fallback&&Ho(t),e=r.children,o=r.fallback,s?(e=Js(t,e,o,a),t.child.memoizedState={baseLanes:a},t.memoizedState=Xs,e):"number"==typeof r.unstable_expectedLoadTime?(e=Js(t,e,o,a),t.child.memoizedState={baseLanes:a},t.memoizedState=Xs,t.lanes=33554432,e):((a=Yc({mode:"visible",children:e},t.mode,a,null)).return=t,t.child=a)):(e.memoizedState,s?(r=ti(e,t,r.children,r.fallback,a),s=t.child,o=e.child.memoizedState,s.memoizedState=null===o?{baseLanes:a}:{baseLanes:o.baseLanes|a},s.childLanes=e.childLanes&~a,t.memoizedState=Xs,r):(a=ei(e,t,r.children,a),t.memoizedState=null,a))}function Js(e,t,a,n){var r=e.mode,o=e.child;return t={mode:"hidden",children:t},0==(2&r)&&null!==o?(o.childLanes=0,o.pendingProps=t):o=Yc(t,r,0,null),a=qc(a,r,n,null),o.return=e,a.return=e,o.sibling=a,e.child=o,a}function ei(e,t,a,n){var r=e.child;return e=r.sibling,a=Vc(r,{mode:"visible",children:a}),0==(2&t.mode)&&(a.lanes=n),a.return=t,a.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=a}function ti(e,t,a,n,r){var o=t.mode,s=e.child;e=s.sibling;var i={mode:"hidden",children:a};return 0==(2&o)&&t.child!==s?((a=t.child).childLanes=0,a.pendingProps=i,null!==(s=a.lastEffect)?(t.firstEffect=a.firstEffect,t.lastEffect=s,s.nextEffect=null):t.firstEffect=t.lastEffect=null):a=Vc(s,i),null!==e?n=Vc(e,n):(n=qc(n,o,r,null)).flags|=2,n.return=t,a.return=t,a.sibling=n,t.child=a,n}function ai(e,t){e.lanes|=t;var a=e.alternate;null!==a&&(a.lanes|=t),ro(e.return,t)}function ni(e,t,a,n,r,o){var s=e.memoizedState;null===s?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:r,lastEffect:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=a,s.tailMode=r,s.lastEffect=o)}function ri(e,t,a){var n=t.pendingProps,r=n.revealOrder,o=n.tail;if(js(e,t,n.children,a),0!=(2&(n=jo.current)))n=1&n|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&ai(e,a);else if(19===e.tag)ai(e,a);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(ur(jo,n),0==(2&t.mode))t.memoizedState=null;else switch(r){case"forwards":for(a=t.child,r=null;null!==a;)null!==(e=a.alternate)&&null===Bo(e)&&(r=a),a=a.sibling;null===(a=r)?(r=t.child,t.child=null):(r=a.sibling,a.sibling=null),ni(t,!1,r,a,o,t.lastEffect);break;case"backwards":for(a=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===Bo(e)){t.child=r;break}e=r.sibling,r.sibling=a,a=r,r=e}ni(t,!0,a,null,o,t.lastEffect);break;case"together":ni(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function oi(e,t,a){if(null!==e&&(t.dependencies=e.dependencies),$i|=t.lanes,0!=(a&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(a=Vc(e=t.child,e.pendingProps),t.child=a,a.return=t;null!==e.sibling;)e=e.sibling,(a=a.sibling=Vc(e,e.pendingProps)).return=t;a.sibling=null}return t.child}return null}function si(e,t){if(!Uo)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;null!==t;)null!==t.alternate&&(a=t),t=t.sibling;null===a?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;null!==a;)null!==a.alternate&&(n=a),a=a.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function ii(e,t,a){var n=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return hr(t.type)&&vr(),null;case 3:return Mo(),lr(fr),lr(br),Ko(),(n=t.stateNode).pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(Wo(t)?t.flags|=4:n.hydrate||(t.flags|=256)),null;case 5:Fo(t);var o=Po(Oo.current);if(a=t.type,null!==e&&null!=t.stateNode)Ys(e,t,a,n),e.ref!==t.ref&&(t.flags|=128);else{if(!n){if(null===t.stateNode)throw Error(s(166));return null}if(e=Po(Ao.current),Wo(t)){n=t.stateNode,a=t.type;var i=t.memoizedProps;switch(n[Qn]=t,n[Jn]=i,a){case"dialog":An("cancel",n),An("close",n);break;case"iframe":case"object":case"embed":An("load",n);break;case"video":case"audio":for(e=0;e<Cn.length;e++)An(Cn[e],n);break;case"source":An("error",n);break;case"img":case"image":case"link":An("error",n),An("load",n);break;case"details":An("toggle",n);break;case"input":ee(n,i),An("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},An("invalid",n);break;case"textarea":ce(n,i),An("invalid",n)}for(var d in we(a,i),e=null,i)i.hasOwnProperty(d)&&(o=i[d],"children"===d?"string"==typeof o?n.textContent!==o&&(e=["children",o]):"number"==typeof o&&n.textContent!==""+o&&(e=["children",""+o]):c.hasOwnProperty(d)&&null!=o&&"onScroll"===d&&An("scroll",n));switch(a){case"input":K(n),ne(n,i,!0);break;case"textarea":K(n),le(n);break;case"select":case"option":break;default:"function"==typeof i.onClick&&(n.onclick=zn)}n=e,t.updateQueue=n,null!==n&&(t.flags|=4)}else{switch(d=9===o.nodeType?o:o.ownerDocument,e===ue&&(e=be(a)),e===ue?"script"===a?((e=d.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof n.is?e=d.createElement(a,{is:n.is}):(e=d.createElement(a),"select"===a&&(d=e,n.multiple?d.multiple=!0:n.size&&(d.size=n.size))):e=d.createElementNS(e,a),e[Qn]=t,e[Jn]=n,qs(e,t),t.stateNode=e,d=Ee(a,n),a){case"dialog":An("cancel",e),An("close",e),o=n;break;case"iframe":case"object":case"embed":An("load",e),o=n;break;case"video":case"audio":for(o=0;o<Cn.length;o++)An(Cn[o],e);o=n;break;case"source":An("error",e),o=n;break;case"img":case"image":case"link":An("error",e),An("load",e),o=n;break;case"details":An("toggle",e),o=n;break;case"input":ee(e,n),o=J(e,n),An("invalid",e);break;case"option":o=oe(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},o=r({},n,{value:void 0}),An("invalid",e);break;case"textarea":ce(e,n),o=ie(e,n),An("invalid",e);break;default:o=n}we(a,o);var l=o;for(i in l)if(l.hasOwnProperty(i)){var u=l[i];"style"===i?xe(e,u):"dangerouslySetInnerHTML"===i?null!=(u=u?u.__html:void 0)&&he(e,u):"children"===i?"string"==typeof u?("textarea"!==a||""!==u)&&ve(e,u):"number"==typeof u&&ve(e,""+u):"suppressContentEditableWarning"!==i&&"suppressHydrationWarning"!==i&&"autoFocus"!==i&&(c.hasOwnProperty(i)?null!=u&&"onScroll"===i&&An("scroll",e):null!=u&&_(e,i,u,d))}switch(a){case"input":K(e),ne(e,n,!1);break;case"textarea":K(e),le(e);break;case"option":null!=n.value&&e.setAttribute("value",""+q(n.value));break;case"select":e.multiple=!!n.multiple,null!=(i=n.value)?se(e,!!n.multiple,i,!1):null!=n.defaultValue&&se(e,!!n.multiple,n.defaultValue,!0);break;default:"function"==typeof o.onClick&&(e.onclick=zn)}Zn(a,n)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)Ks(0,t,e.memoizedProps,n);else{if("string"!=typeof n&&null===t.stateNode)throw Error(s(166));a=Po(Oo.current),Po(Ao.current),Wo(t)?(n=t.stateNode,a=t.memoizedProps,n[Qn]=t,n.nodeValue!==a&&(t.flags|=4)):((n=(9===a.nodeType?a:a.ownerDocument).createTextNode(n))[Qn]=t,t.stateNode=n)}return null;case 13:return lr(jo),n=t.memoizedState,0!=(64&t.flags)?(t.lanes=a,t):(n=null!==n,a=!1,null===e?void 0!==t.memoizedProps.fallback&&Wo(t):a=null!==e.memoizedState,n&&!a&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&jo.current)?0===ji&&(ji=3):(0!==ji&&3!==ji||(ji=4),null===Pi||0==(134217727&$i)&&0==(134217727&Ui)||vc(Pi,Mi))),(n||a)&&(t.flags|=4),null);case 4:return Mo(),null===e&&On(t.stateNode.containerInfo),null;case 10:return no(t),null;case 19:if(lr(jo),null===(n=t.memoizedState))return null;if(i=0!=(64&t.flags),null===(d=n.rendering))if(i)si(n,!1);else{if(0!==ji||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(d=Bo(e))){for(t.flags|=64,si(n,!1),null!==(i=d.updateQueue)&&(t.updateQueue=i,t.flags|=4),null===n.lastEffect&&(t.firstEffect=null),t.lastEffect=n.lastEffect,n=a,a=t.child;null!==a;)e=n,(i=a).flags&=2,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null,null===(d=i.alternate)?(i.childLanes=0,i.lanes=e,i.child=null,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,e=d.dependencies,i.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),a=a.sibling;return ur(jo,1&jo.current|2),t.child}e=e.sibling}null!==n.tail&&Zr()>Vi&&(t.flags|=64,i=!0,si(n,!1),t.lanes=33554432)}else{if(!i)if(null!==(e=Bo(d))){if(t.flags|=64,i=!0,null!==(a=e.updateQueue)&&(t.updateQueue=a,t.flags|=4),si(n,!0),null===n.tail&&"hidden"===n.tailMode&&!d.alternate&&!Uo)return null!==(t=t.lastEffect=n.lastEffect)&&(t.nextEffect=null),null}else 2*Zr()-n.renderingStartTime>Vi&&1073741824!==a&&(t.flags|=64,i=!0,si(n,!1),t.lanes=33554432);n.isBackwards?(d.sibling=t.child,t.child=d):(null!==(a=n.last)?a.sibling=d:t.child=d,n.last=d)}return null!==n.tail?(a=n.tail,n.rendering=a,n.tail=a.sibling,n.lastEffect=t.lastEffect,n.renderingStartTime=Zr(),a.sibling=null,t=jo.current,ur(jo,i?1&t|2:1&t),a):null;case 23:case 24:return kc(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==n.mode&&(t.flags|=4),null}throw Error(s(156,t.tag))}function ci(e){switch(e.tag){case 1:hr(e.type)&&vr();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Mo(),lr(fr),lr(br),Ko(),0!=(64&(t=e.flags)))throw Error(s(285));return e.flags=-4097&t|64,e;case 5:return Fo(e),null;case 13:return lr(jo),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return lr(jo),null;case 4:return Mo(),null;case 10:return no(e),null;case 23:case 24:return kc(),null;default:return null}}function di(e,t){try{var a="",n=t;do{a+=V(n),n=n.return}while(n);var r=a}catch(o){r="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:r}}function li(e,t){try{console.error(t.value)}catch(a){setTimeout((function(){throw a}))}}qs=function(e,t){for(var a=t.child;null!==a;){if(5===a.tag||6===a.tag)e.appendChild(a.stateNode);else if(4!==a.tag&&null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},Ys=function(e,t,a,n){var o=e.memoizedProps;if(o!==n){e=t.stateNode,Po(Ao.current);var s,i=null;switch(a){case"input":o=J(e,o),n=J(e,n),i=[];break;case"option":o=oe(e,o),n=oe(e,n),i=[];break;case"select":o=r({},o,{value:void 0}),n=r({},n,{value:void 0}),i=[];break;case"textarea":o=ie(e,o),n=ie(e,n),i=[];break;default:"function"!=typeof o.onClick&&"function"==typeof n.onClick&&(e.onclick=zn)}for(u in we(a,n),a=null,o)if(!n.hasOwnProperty(u)&&o.hasOwnProperty(u)&&null!=o[u])if("style"===u){var d=o[u];for(s in d)d.hasOwnProperty(s)&&(a||(a={}),a[s]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(c.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var l=n[u];if(d=null!=o?o[u]:void 0,n.hasOwnProperty(u)&&l!==d&&(null!=l||null!=d))if("style"===u)if(d){for(s in d)!d.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(a||(a={}),a[s]="");for(s in l)l.hasOwnProperty(s)&&d[s]!==l[s]&&(a||(a={}),a[s]=l[s])}else a||(i||(i=[]),i.push(u,a)),a=l;else"dangerouslySetInnerHTML"===u?(l=l?l.__html:void 0,d=d?d.__html:void 0,null!=l&&d!==l&&(i=i||[]).push(u,l)):"children"===u?"string"!=typeof l&&"number"!=typeof l||(i=i||[]).push(u,""+l):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(c.hasOwnProperty(u)?(null!=l&&"onScroll"===u&&An("scroll",e),i||d===l||(i=[])):"object"==typeof l&&null!==l&&l.$$typeof===M?l.toString():(i=i||[]).push(u,l))}a&&(i=i||[]).push("style",a);var u=i;(t.updateQueue=u)&&(t.flags|=4)}},Ks=function(e,t,a,n){a!==n&&(t.flags|=4)};var ui="function"==typeof WeakMap?WeakMap:Map;function pi(e,t,a){(a=uo(-1,a)).tag=3,a.payload={element:null};var n=t.value;return a.callback=function(){Ki||(Ki=!0,Xi=n),li(0,t)},a}function bi(e,t,a){(a=uo(-1,a)).tag=3;var n=e.type.getDerivedStateFromError;if("function"==typeof n){var r=t.value;a.payload=function(){return li(0,t),n(r)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(a.callback=function(){"function"!=typeof n&&(null===Qi?Qi=new Set([this]):Qi.add(this),li(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),a}var fi="function"==typeof WeakSet?WeakSet:Set;function mi(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(a){zc(e,a)}else t.current=null}function gi(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var a=e.memoizedProps,n=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?a:Xr(t.type,a),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Wn(t.stateNode.containerInfo))}throw Error(s(163))}function hi(e,t,a){switch(a.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=a.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var n=e.create;e.destroy=n()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=a.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var r=e;n=r.next,0!=(4&(r=r.tag))&&0!=(1&r)&&(Fc(a,e),Dc(a,e)),e=n}while(e!==t)}return;case 1:return e=a.stateNode,4&a.flags&&(null===t?e.componentDidMount():(n=a.elementType===a.type?t.memoizedProps:Xr(a.type,t.memoizedProps),e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=a.updateQueue)&&mo(a,t,e));case 3:if(null!==(t=a.updateQueue)){if(e=null,null!==a.child)switch(a.child.tag){case 5:case 1:e=a.child.stateNode}mo(a,t,e)}return;case 5:return e=a.stateNode,void(null===t&&4&a.flags&&Zn(a.type,a.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===a.memoizedState&&(a=a.alternate,null!==a&&(a=a.memoizedState,null!==a&&(a=a.dehydrated,null!==a&&xt(a)))))}throw Error(s(163))}function vi(e,t){for(var a=e;;){if(5===a.tag){var n=a.stateNode;if(t)"function"==typeof(n=n.style).setProperty?n.setProperty("display","none","important"):n.display="none";else{n=a.stateNode;var r=a.memoizedProps.style;r=null!=r&&r.hasOwnProperty("display")?r.display:null,n.style.display=Se("display",r)}}else if(6===a.tag)a.stateNode.nodeValue=t?"":a.memoizedProps;else if((23!==a.tag&&24!==a.tag||null===a.memoizedState||a===e)&&null!==a.child){a.child.return=a,a=a.child;continue}if(a===e)break;for(;null===a.sibling;){if(null===a.return||a.return===e)return;a=a.return}a.sibling.return=a.return,a=a.sibling}}function yi(e,t){if(wr&&"function"==typeof wr.onCommitFiberUnmount)try{wr.onCommitFiberUnmount(kr,t)}catch(o){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var a=e=e.next;do{var n=a,r=n.destroy;if(n=n.tag,void 0!==r)if(0!=(4&n))Fc(t,a);else{n=t;try{r()}catch(o){zc(n,o)}}a=a.next}while(a!==e)}break;case 1:if(mi(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(o){zc(t,o)}break;case 5:mi(t);break;case 4:Ei(e,t)}}function _i(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function Si(e){return 5===e.tag||3===e.tag||4===e.tag}function xi(e){e:{for(var t=e.return;null!==t;){if(Si(t))break e;t=t.return}throw Error(s(160))}var a=t;switch(t=a.stateNode,a.tag){case 5:var n=!1;break;case 3:case 4:t=t.containerInfo,n=!0;break;default:throw Error(s(161))}16&a.flags&&(ve(t,""),a.flags&=-17);e:t:for(a=e;;){for(;null===a.sibling;){if(null===a.return||Si(a.return)){a=null;break e}a=a.return}for(a.sibling.return=a.return,a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(2&a.flags)continue t;if(null===a.child||4===a.tag)continue t;a.child.return=a,a=a.child}if(!(2&a.flags)){a=a.stateNode;break e}}n?ki(e,a,t):wi(e,a,t)}function ki(e,t,a){var n=e.tag,r=5===n||6===n;if(r)e=r?e.stateNode:e.stateNode.instance,t?8===a.nodeType?a.parentNode.insertBefore(e,t):a.insertBefore(e,t):(8===a.nodeType?(t=a.parentNode).insertBefore(e,a):(t=a).appendChild(e),null!=(a=a._reactRootContainer)||null!==t.onclick||(t.onclick=zn));else if(4!==n&&null!==(e=e.child))for(ki(e,t,a),e=e.sibling;null!==e;)ki(e,t,a),e=e.sibling}function wi(e,t,a){var n=e.tag,r=5===n||6===n;if(r)e=r?e.stateNode:e.stateNode.instance,t?a.insertBefore(e,t):a.appendChild(e);else if(4!==n&&null!==(e=e.child))for(wi(e,t,a),e=e.sibling;null!==e;)wi(e,t,a),e=e.sibling}function Ei(e,t){for(var a,n,r=t,o=!1;;){if(!o){o=r.return;e:for(;;){if(null===o)throw Error(s(160));switch(a=o.stateNode,o.tag){case 5:n=!1;break e;case 3:case 4:a=a.containerInfo,n=!0;break e}o=o.return}o=!0}if(5===r.tag||6===r.tag){e:for(var i=e,c=r,d=c;;)if(yi(i,d),null!==d.child&&4!==d.tag)d.child.return=d,d=d.child;else{if(d===c)break e;for(;null===d.sibling;){if(null===d.return||d.return===c)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}n?(i=a,c=r.stateNode,8===i.nodeType?i.parentNode.removeChild(c):i.removeChild(c)):a.removeChild(r.stateNode)}else if(4===r.tag){if(null!==r.child){a=r.stateNode.containerInfo,n=!0,r.child.return=r,r=r.child;continue}}else if(yi(e,r),null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;4===(r=r.return).tag&&(o=!1)}r.sibling.return=r.return,r=r.sibling}}function Ci(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var a=t.updateQueue;if(null!==(a=null!==a?a.lastEffect:null)){var n=a=a.next;do{3==(3&n.tag)&&(e=n.destroy,n.destroy=void 0,void 0!==e&&e()),n=n.next}while(n!==a)}return;case 1:case 12:case 17:return;case 5:if(null!=(a=t.stateNode)){n=t.memoizedProps;var r=null!==e?e.memoizedProps:n;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(a[Jn]=n,"input"===e&&"radio"===n.type&&null!=n.name&&te(a,n),Ee(e,r),t=Ee(e,n),r=0;r<o.length;r+=2){var i=o[r],c=o[r+1];"style"===i?xe(a,c):"dangerouslySetInnerHTML"===i?he(a,c):"children"===i?ve(a,c):_(a,i,c,t)}switch(e){case"input":ae(a,n);break;case"textarea":de(a,n);break;case"select":e=a._wrapperState.wasMultiple,a._wrapperState.wasMultiple=!!n.multiple,null!=(o=n.value)?se(a,!!n.multiple,o,!1):e!==!!n.multiple&&(null!=n.defaultValue?se(a,!!n.multiple,n.defaultValue,!0):se(a,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(s(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((a=t.stateNode).hydrate&&(a.hydrate=!1,xt(a.containerInfo)));case 13:return null!==t.memoizedState&&(Hi=Zr(),vi(t.child,!0)),void Ti(t);case 19:return void Ti(t);case 23:case 24:return void vi(t,null!==t.memoizedState)}throw Error(s(163))}function Ti(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var a=e.stateNode;null===a&&(a=e.stateNode=new fi),t.forEach((function(t){var n=Uc.bind(null,e,t);a.has(t)||(a.add(t),t.then(n,n))}))}}function Ii(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var Ni=Math.ceil,Ai=S.ReactCurrentDispatcher,Li=S.ReactCurrentOwner,Oi=0,Pi=null,Ri=null,Mi=0,Di=0,Fi=dr(0),ji=0,Bi=null,zi=0,$i=0,Ui=0,Zi=0,Gi=null,Hi=0,Vi=1/0;function Wi(){Vi=Zr()+500}var qi,Yi=null,Ki=!1,Xi=null,Qi=null,Ji=!1,ec=null,tc=90,ac=[],nc=[],rc=null,oc=0,sc=null,ic=-1,cc=0,dc=0,lc=null,uc=!1;function pc(){return 0!=(48&Oi)?Zr():-1!==ic?ic:ic=Zr()}function bc(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Gr()?1:2;if(0===cc&&(cc=zi),0!==Kr.transition){0!==dc&&(dc=null!==Gi?Gi.pendingLanes:0),e=cc;var t=4186112&~dc;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Gr(),0!=(4&Oi)&&98===e?e=zt(12,cc):e=zt(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),cc),e}function fc(e,t,a){if(50<oc)throw oc=0,sc=null,Error(s(185));if(null===(e=mc(e,t)))return null;Zt(e,t,a),e===Pi&&(Ui|=t,4===ji&&vc(e,Mi));var n=Gr();1===t?0!=(8&Oi)&&0==(48&Oi)?yc(e):(gc(e,a),0===Oi&&(Wi(),qr())):(0==(4&Oi)||98!==n&&99!==n||(null===rc?rc=new Set([e]):rc.add(e)),gc(e,a)),Gi=e}function mc(e,t){e.lanes|=t;var a=e.alternate;for(null!==a&&(a.lanes|=t),a=e,e=e.return;null!==e;)e.childLanes|=t,null!==(a=e.alternate)&&(a.childLanes|=t),a=e,e=e.return;return 3===a.tag?a.stateNode:null}function gc(e,t){for(var a=e.callbackNode,n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var c=31-Gt(i),d=1<<c,l=o[c];if(-1===l){if(0==(d&n)||0!=(d&r)){l=t,Ft(d);var u=Dt;o[c]=10<=u?l+250:6<=u?l+5e3:-1}}else l<=t&&(e.expiredLanes|=d);i&=~d}if(n=jt(e,e===Pi?Mi:0),t=Dt,0===n)null!==a&&(a!==Fr&&Tr(a),e.callbackNode=null,e.callbackPriority=0);else{if(null!==a){if(e.callbackPriority===t)return;a!==Fr&&Tr(a)}15===t?(a=yc.bind(null,e),null===Br?(Br=[a],zr=Cr(Or,Yr)):Br.push(a),a=Fr):14===t?a=Wr(99,yc.bind(null,e)):(a=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(s(358,e))}}(t),a=Wr(a,hc.bind(null,e))),e.callbackPriority=t,e.callbackNode=a}}function hc(e){if(ic=-1,dc=cc=0,0!=(48&Oi))throw Error(s(327));var t=e.callbackNode;if(Mc()&&e.callbackNode!==t)return null;var a=jt(e,e===Pi?Mi:0);if(0===a)return null;var n=a,r=Oi;Oi|=16;var o=Cc();for(Pi===e&&Mi===n||(Wi(),wc(e,n));;)try{Nc();break}catch(c){Ec(e,c)}if(ao(),Ai.current=o,Oi=r,null!==Ri?n=0:(Pi=null,Mi=0,n=ji),0!=(zi&Ui))wc(e,0);else if(0!==n){if(2===n&&(Oi|=64,e.hydrate&&(e.hydrate=!1,Wn(e.containerInfo)),0!==(a=Bt(e))&&(n=Tc(e,a))),1===n)throw t=Bi,wc(e,0),vc(e,a),gc(e,Zr()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=a,n){case 0:case 1:throw Error(s(345));case 2:case 5:Oc(e);break;case 3:if(vc(e,a),(62914560&a)===a&&10<(n=Hi+500-Zr())){if(0!==jt(e,0))break;if(((r=e.suspendedLanes)&a)!==a){pc(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=Hn(Oc.bind(null,e),n);break}Oc(e);break;case 4:if(vc(e,a),(4186112&a)===a)break;for(n=e.eventTimes,r=-1;0<a;){var i=31-Gt(a);o=1<<i,(i=n[i])>r&&(r=i),a&=~o}if(a=r,10<(a=(120>(a=Zr()-a)?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*Ni(a/1960))-a)){e.timeoutHandle=Hn(Oc.bind(null,e),a);break}Oc(e);break;default:throw Error(s(329))}}return gc(e,Zr()),e.callbackNode===t?hc.bind(null,e):null}function vc(e,t){for(t&=~Zi,t&=~Ui,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var a=31-Gt(t),n=1<<a;e[a]=-1,t&=~n}}function yc(e){if(0!=(48&Oi))throw Error(s(327));if(Mc(),e===Pi&&0!=(e.expiredLanes&Mi)){var t=Mi,a=Tc(e,t);0!=(zi&Ui)&&(a=Tc(e,t=jt(e,t)))}else a=Tc(e,t=jt(e,0));if(0!==e.tag&&2===a&&(Oi|=64,e.hydrate&&(e.hydrate=!1,Wn(e.containerInfo)),0!==(t=Bt(e))&&(a=Tc(e,t))),1===a)throw a=Bi,wc(e,0),vc(e,t),gc(e,Zr()),a;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Oc(e),gc(e,Zr()),null}function _c(e,t){var a=Oi;Oi|=1;try{return e(t)}finally{0===(Oi=a)&&(Wi(),qr())}}function Sc(e,t){var a=Oi;Oi&=-2,Oi|=8;try{return e(t)}finally{0===(Oi=a)&&(Wi(),qr())}}function xc(e,t){ur(Fi,Di),Di|=t,zi|=t}function kc(){Di=Fi.current,lr(Fi)}function wc(e,t){e.finishedWork=null,e.finishedLanes=0;var a=e.timeoutHandle;if(-1!==a&&(e.timeoutHandle=-1,Vn(a)),null!==Ri)for(a=Ri.return;null!==a;){var n=a;switch(n.tag){case 1:null!=(n=n.type.childContextTypes)&&vr();break;case 3:Mo(),lr(fr),lr(br),Ko();break;case 5:Fo(n);break;case 4:Mo();break;case 13:case 19:lr(jo);break;case 10:no(n);break;case 23:case 24:kc()}a=a.return}Pi=e,Ri=Vc(e.current,null),Mi=Di=zi=t,ji=0,Bi=null,Zi=Ui=$i=0}function Ec(e,t){for(;;){var a=Ri;try{if(ao(),Xo.current=Os,ns){for(var n=es.memoizedState;null!==n;){var r=n.queue;null!==r&&(r.pending=null),n=n.next}ns=!1}if(Jo=0,as=ts=es=null,rs=!1,Li.current=null,null===a||null===a.return){ji=1,Bi=t,Ri=null;break}e:{var o=e,s=a.return,i=a,c=t;if(t=Mi,i.flags|=2048,i.firstEffect=i.lastEffect=null,null!==c&&"object"==typeof c&&"function"==typeof c.then){var d=c;if(0==(2&i.mode)){var l=i.alternate;l?(i.updateQueue=l.updateQueue,i.memoizedState=l.memoizedState,i.lanes=l.lanes):(i.updateQueue=null,i.memoizedState=null)}var u=0!=(1&jo.current),p=s;do{var b;if(b=13===p.tag){var f=p.memoizedState;if(null!==f)b=null!==f.dehydrated;else{var m=p.memoizedProps;b=void 0!==m.fallback&&(!0!==m.unstable_avoidThisFallback||!u)}}if(b){var g=p.updateQueue;if(null===g){var h=new Set;h.add(d),p.updateQueue=h}else g.add(d);if(0==(2&p.mode)){if(p.flags|=64,i.flags|=16384,i.flags&=-2981,1===i.tag)if(null===i.alternate)i.tag=17;else{var v=uo(-1,1);v.tag=2,po(i,v)}i.lanes|=1;break e}c=void 0,i=t;var y=o.pingCache;if(null===y?(y=o.pingCache=new ui,c=new Set,y.set(d,c)):void 0===(c=y.get(d))&&(c=new Set,y.set(d,c)),!c.has(i)){c.add(i);var _=$c.bind(null,o,d,i);d.then(_,_)}p.flags|=4096,p.lanes=t;break e}p=p.return}while(null!==p);c=Error((W(i.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==ji&&(ji=2),c=di(c,i),p=s;do{switch(p.tag){case 3:o=c,p.flags|=4096,t&=-t,p.lanes|=t,bo(p,pi(0,o,t));break e;case 1:o=c;var S=p.type,x=p.stateNode;if(0==(64&p.flags)&&("function"==typeof S.getDerivedStateFromError||null!==x&&"function"==typeof x.componentDidCatch&&(null===Qi||!Qi.has(x)))){p.flags|=4096,t&=-t,p.lanes|=t,bo(p,bi(p,o,t));break e}}p=p.return}while(null!==p)}Lc(a)}catch(k){t=k,Ri===a&&null!==a&&(Ri=a=a.return);continue}break}}function Cc(){var e=Ai.current;return Ai.current=Os,null===e?Os:e}function Tc(e,t){var a=Oi;Oi|=16;var n=Cc();for(Pi===e&&Mi===t||wc(e,t);;)try{Ic();break}catch(r){Ec(e,r)}if(ao(),Oi=a,Ai.current=n,null!==Ri)throw Error(s(261));return Pi=null,Mi=0,ji}function Ic(){for(;null!==Ri;)Ac(Ri)}function Nc(){for(;null!==Ri&&!Ir();)Ac(Ri)}function Ac(e){var t=qi(e.alternate,e,Di);e.memoizedProps=e.pendingProps,null===t?Lc(e):Ri=t,Li.current=null}function Lc(e){var t=e;do{var a=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(a=ii(a,t,Di)))return void(Ri=a);if(24!==(a=t).tag&&23!==a.tag||null===a.memoizedState||0!=(1073741824&Di)||0==(4&a.mode)){for(var n=0,r=a.child;null!==r;)n|=r.lanes|r.childLanes,r=r.sibling;a.childLanes=n}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(a=ci(t)))return a.flags&=2047,void(Ri=a);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(Ri=t);Ri=t=e}while(null!==t);0===ji&&(ji=5)}function Oc(e){var t=Gr();return Vr(99,Pc.bind(null,e,t)),null}function Pc(e,t){do{Mc()}while(null!==ec);if(0!=(48&Oi))throw Error(s(327));var a=e.finishedWork;if(null===a)return null;if(e.finishedWork=null,e.finishedLanes=0,a===e.current)throw Error(s(177));e.callbackNode=null;var n=a.lanes|a.childLanes,r=n,o=e.pendingLanes&~r;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=r,e.mutableReadLanes&=r,e.entangledLanes&=r,r=e.entanglements;for(var i=e.eventTimes,c=e.expirationTimes;0<o;){var d=31-Gt(o),l=1<<d;r[d]=0,i[d]=-1,c[d]=-1,o&=~l}if(null!==rc&&0==(24&n)&&rc.has(e)&&rc.delete(e),e===Pi&&(Ri=Pi=null,Mi=0),1<a.flags?null!==a.lastEffect?(a.lastEffect.nextEffect=a,n=a.firstEffect):n=a:n=a.firstEffect,null!==n){if(r=Oi,Oi|=32,Li.current=null,$n=Yt,hn(i=gn())){if("selectionStart"in i)c={start:i.selectionStart,end:i.selectionEnd};else e:if(c=(c=i.ownerDocument)&&c.defaultView||window,(l=c.getSelection&&c.getSelection())&&0!==l.rangeCount){c=l.anchorNode,o=l.anchorOffset,d=l.focusNode,l=l.focusOffset;try{c.nodeType,d.nodeType}catch(C){c=null;break e}var u=0,p=-1,b=-1,f=0,m=0,g=i,h=null;t:for(;;){for(var v;g!==c||0!==o&&3!==g.nodeType||(p=u+o),g!==d||0!==l&&3!==g.nodeType||(b=u+l),3===g.nodeType&&(u+=g.nodeValue.length),null!==(v=g.firstChild);)h=g,g=v;for(;;){if(g===i)break t;if(h===c&&++f===o&&(p=u),h===d&&++m===l&&(b=u),null!==(v=g.nextSibling))break;h=(g=h).parentNode}g=v}c=-1===p||-1===b?null:{start:p,end:b}}else c=null;c=c||{start:0,end:0}}else c=null;Un={focusedElem:i,selectionRange:c},Yt=!1,lc=null,uc=!1,Yi=n;do{try{Rc()}catch(C){if(null===Yi)throw Error(s(330));zc(Yi,C),Yi=Yi.nextEffect}}while(null!==Yi);lc=null,Yi=n;do{try{for(i=e;null!==Yi;){var y=Yi.flags;if(16&y&&ve(Yi.stateNode,""),128&y){var _=Yi.alternate;if(null!==_){var S=_.ref;null!==S&&("function"==typeof S?S(null):S.current=null)}}switch(1038&y){case 2:xi(Yi),Yi.flags&=-3;break;case 6:xi(Yi),Yi.flags&=-3,Ci(Yi.alternate,Yi);break;case 1024:Yi.flags&=-1025;break;case 1028:Yi.flags&=-1025,Ci(Yi.alternate,Yi);break;case 4:Ci(Yi.alternate,Yi);break;case 8:Ei(i,c=Yi);var x=c.alternate;_i(c),null!==x&&_i(x)}Yi=Yi.nextEffect}}catch(C){if(null===Yi)throw Error(s(330));zc(Yi,C),Yi=Yi.nextEffect}}while(null!==Yi);if(S=Un,_=gn(),y=S.focusedElem,i=S.selectionRange,_!==y&&y&&y.ownerDocument&&mn(y.ownerDocument.documentElement,y)){null!==i&&hn(y)&&(_=i.start,void 0===(S=i.end)&&(S=_),"selectionStart"in y?(y.selectionStart=_,y.selectionEnd=Math.min(S,y.value.length)):(S=(_=y.ownerDocument||document)&&_.defaultView||window).getSelection&&(S=S.getSelection(),c=y.textContent.length,x=Math.min(i.start,c),i=void 0===i.end?x:Math.min(i.end,c),!S.extend&&x>i&&(c=i,i=x,x=c),c=fn(y,x),o=fn(y,i),c&&o&&(1!==S.rangeCount||S.anchorNode!==c.node||S.anchorOffset!==c.offset||S.focusNode!==o.node||S.focusOffset!==o.offset)&&((_=_.createRange()).setStart(c.node,c.offset),S.removeAllRanges(),x>i?(S.addRange(_),S.extend(o.node,o.offset)):(_.setEnd(o.node,o.offset),S.addRange(_))))),_=[];for(S=y;S=S.parentNode;)1===S.nodeType&&_.push({element:S,left:S.scrollLeft,top:S.scrollTop});for("function"==typeof y.focus&&y.focus(),y=0;y<_.length;y++)(S=_[y]).element.scrollLeft=S.left,S.element.scrollTop=S.top}Yt=!!$n,Un=$n=null,e.current=a,Yi=n;do{try{for(y=e;null!==Yi;){var k=Yi.flags;if(36&k&&hi(y,Yi.alternate,Yi),128&k){_=void 0;var w=Yi.ref;if(null!==w){var E=Yi.stateNode;Yi.tag,_=E,"function"==typeof w?w(_):w.current=_}}Yi=Yi.nextEffect}}catch(C){if(null===Yi)throw Error(s(330));zc(Yi,C),Yi=Yi.nextEffect}}while(null!==Yi);Yi=null,jr(),Oi=r}else e.current=a;if(Ji)Ji=!1,ec=e,tc=t;else for(Yi=n;null!==Yi;)t=Yi.nextEffect,Yi.nextEffect=null,8&Yi.flags&&((k=Yi).sibling=null,k.stateNode=null),Yi=t;if(0===(n=e.pendingLanes)&&(Qi=null),1===n?e===sc?oc++:(oc=0,sc=e):oc=0,a=a.stateNode,wr&&"function"==typeof wr.onCommitFiberRoot)try{wr.onCommitFiberRoot(kr,a,void 0,64==(64&a.current.flags))}catch(C){}if(gc(e,Zr()),Ki)throw Ki=!1,e=Xi,Xi=null,e;return 0!=(8&Oi)||qr(),null}function Rc(){for(;null!==Yi;){var e=Yi.alternate;uc||null===lc||(0!=(8&Yi.flags)?et(Yi,lc)&&(uc=!0):13===Yi.tag&&Ii(e,Yi)&&et(Yi,lc)&&(uc=!0));var t=Yi.flags;0!=(256&t)&&gi(e,Yi),0==(512&t)||Ji||(Ji=!0,Wr(97,(function(){return Mc(),null}))),Yi=Yi.nextEffect}}function Mc(){if(90!==tc){var e=97<tc?97:tc;return tc=90,Vr(e,jc)}return!1}function Dc(e,t){ac.push(t,e),Ji||(Ji=!0,Wr(97,(function(){return Mc(),null})))}function Fc(e,t){nc.push(t,e),Ji||(Ji=!0,Wr(97,(function(){return Mc(),null})))}function jc(){if(null===ec)return!1;var e=ec;if(ec=null,0!=(48&Oi))throw Error(s(331));var t=Oi;Oi|=32;var a=nc;nc=[];for(var n=0;n<a.length;n+=2){var r=a[n],o=a[n+1],i=r.destroy;if(r.destroy=void 0,"function"==typeof i)try{i()}catch(d){if(null===o)throw Error(s(330));zc(o,d)}}for(a=ac,ac=[],n=0;n<a.length;n+=2){r=a[n],o=a[n+1];try{var c=r.create;r.destroy=c()}catch(d){if(null===o)throw Error(s(330));zc(o,d)}}for(c=e.current.firstEffect;null!==c;)e=c.nextEffect,c.nextEffect=null,8&c.flags&&(c.sibling=null,c.stateNode=null),c=e;return Oi=t,qr(),!0}function Bc(e,t,a){po(e,t=pi(0,t=di(a,t),1)),t=pc(),null!==(e=mc(e,1))&&(Zt(e,1,t),gc(e,t))}function zc(e,t){if(3===e.tag)Bc(e,e,t);else for(var a=e.return;null!==a;){if(3===a.tag){Bc(a,e,t);break}if(1===a.tag){var n=a.stateNode;if("function"==typeof a.type.getDerivedStateFromError||"function"==typeof n.componentDidCatch&&(null===Qi||!Qi.has(n))){var r=bi(a,e=di(t,e),1);if(po(a,r),r=pc(),null!==(a=mc(a,1)))Zt(a,1,r),gc(a,r);else if("function"==typeof n.componentDidCatch&&(null===Qi||!Qi.has(n)))try{n.componentDidCatch(t,e)}catch(o){}break}}a=a.return}}function $c(e,t,a){var n=e.pingCache;null!==n&&n.delete(t),t=pc(),e.pingedLanes|=e.suspendedLanes&a,Pi===e&&(Mi&a)===a&&(4===ji||3===ji&&(62914560&Mi)===Mi&&500>Zr()-Hi?wc(e,0):Zi|=a),gc(e,t)}function Uc(e,t){var a=e.stateNode;null!==a&&a.delete(t),0===(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Gr()?1:2:(0===cc&&(cc=zi),0===(t=$t(62914560&~cc))&&(t=4194304))),a=pc(),null!==(e=mc(e,t))&&(Zt(e,t,a),gc(e,a))}function Zc(e,t,a,n){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Gc(e,t,a,n){return new Zc(e,t,a,n)}function Hc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Vc(e,t){var a=e.alternate;return null===a?((a=Gc(e.tag,t,e.key,e.mode)).elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.nextEffect=null,a.firstEffect=null,a.lastEffect=null),a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a}function Wc(e,t,a,n,r,o){var i=2;if(n=e,"function"==typeof e)Hc(e)&&(i=1);else if("string"==typeof e)i=5;else e:switch(e){case w:return qc(a.children,r,o,t);case D:i=8,r|=16;break;case E:i=8,r|=1;break;case C:return(e=Gc(12,a,t,8|r)).elementType=C,e.type=C,e.lanes=o,e;case A:return(e=Gc(13,a,t,r)).type=A,e.elementType=A,e.lanes=o,e;case L:return(e=Gc(19,a,t,r)).elementType=L,e.lanes=o,e;case F:return Yc(a,r,o,t);case j:return(e=Gc(24,a,t,r)).elementType=j,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case T:i=10;break e;case I:i=9;break e;case N:i=11;break e;case O:i=14;break e;case P:i=16,n=null;break e;case R:i=22;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=Gc(i,a,t,r)).elementType=e,t.type=n,t.lanes=o,t}function qc(e,t,a,n){return(e=Gc(7,e,n,t)).lanes=a,e}function Yc(e,t,a,n){return(e=Gc(23,e,n,t)).elementType=F,e.lanes=a,e}function Kc(e,t,a){return(e=Gc(6,e,null,t)).lanes=a,e}function Xc(e,t,a){return(t=Gc(4,null!==e.children?e.children:[],e.key,t)).lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qc(e,t,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=a,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=Ut(0),this.expirationTimes=Ut(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ut(0),this.mutableSourceEagerHydrationData=null}function Jc(e,t,a){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:k,key:null==n?null:""+n,children:e,containerInfo:t,implementation:a}}function ed(e,t,a,n){var r=t.current,o=pc(),i=bc(r);e:if(a){t:{if(Ke(a=a._reactInternals)!==a||1!==a.tag)throw Error(s(170));var c=a;do{switch(c.tag){case 3:c=c.stateNode.context;break t;case 1:if(hr(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break t}}c=c.return}while(null!==c);throw Error(s(171))}if(1===a.tag){var d=a.type;if(hr(d)){a=_r(a,d,c);break e}}a=c}else a=pr;return null===t.context?t.context=a:t.pendingContext=a,(t=uo(o,i)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),po(r,t),fc(r,i,o),i}function td(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function ad(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var a=e.retryLane;e.retryLane=0!==a&&a<t?a:t}}function nd(e,t){ad(e,t),(e=e.alternate)&&ad(e,t)}function rd(e,t,a){var n=null!=a&&null!=a.hydrationOptions&&a.hydrationOptions.mutableSources||null;if(a=new Qc(e,t,null!=a&&!0===a.hydrate),t=Gc(3,null,null,2===t?7:1===t?3:0),a.current=t,t.stateNode=a,co(t),e[er]=a.current,On(8===e.nodeType?e.parentNode:e),n)for(e=0;e<n.length;e++){var r=(t=n[e])._getVersion;r=r(t._source),null==a.mutableSourceEagerHydrationData?a.mutableSourceEagerHydrationData=[t,r]:a.mutableSourceEagerHydrationData.push(t,r)}this._internalRoot=a}function od(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function sd(e,t,a,n,r){var o=a._reactRootContainer;if(o){var s=o._internalRoot;if("function"==typeof r){var i=r;r=function(){var e=td(s);i.call(e)}}ed(t,s,e,r)}else{if(o=a._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var a;a=e.lastChild;)e.removeChild(a);return new rd(e,0,t?{hydrate:!0}:void 0)}(a,n),s=o._internalRoot,"function"==typeof r){var c=r;r=function(){var e=td(s);c.call(e)}}Sc((function(){ed(t,s,e,r)}))}return td(s)}function id(e,t){var a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!od(t))throw Error(s(200));return Jc(e,t,null,a)}qi=function(e,t,a){var n=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||fr.current)Fs=!0;else{if(0==(a&n)){switch(Fs=!1,t.tag){case 3:Ws(t),qo();break;case 5:Do(t);break;case 1:hr(t.type)&&Sr(t);break;case 4:Ro(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value;var r=t.type._context;ur(Qr,r._currentValue),r._currentValue=n;break;case 13:if(null!==t.memoizedState)return 0!=(a&t.child.childLanes)?Qs(e,t,a):(ur(jo,1&jo.current),null!==(t=oi(e,t,a))?t.sibling:null);ur(jo,1&jo.current);break;case 19:if(n=0!=(a&t.childLanes),0!=(64&e.flags)){if(n)return ri(e,t,a);t.flags|=64}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),ur(jo,jo.current),n)break;return null;case 23:case 24:return t.lanes=0,Us(e,t,a)}return oi(e,t,a)}Fs=0!=(16384&e.flags)}else Fs=!1;switch(t.lanes=0,t.tag){case 2:if(n=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,r=gr(t,br.current),oo(t,a),r=is(null,t,n,e,r,a),t.flags|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,hr(n)){var o=!0;Sr(t)}else o=!1;t.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,co(t);var i=n.getDerivedStateFromProps;"function"==typeof i&&ho(t,n,i,e),r.updater=vo,t.stateNode=r,r._reactInternals=t,xo(t,n,e,a),t=Vs(null,t,n,!0,o,a)}else t.tag=0,js(null,t,r,a),t=t.child;return t;case 16:r=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,r=(o=r._init)(r._payload),t.type=r,o=t.tag=function(e){if("function"==typeof e)return Hc(e)?1:0;if(null!=e){if((e=e.$$typeof)===N)return 11;if(e===O)return 14}return 2}(r),e=Xr(r,e),o){case 0:t=Gs(null,t,r,e,a);break e;case 1:t=Hs(null,t,r,e,a);break e;case 11:t=Bs(null,t,r,e,a);break e;case 14:t=zs(null,t,r,Xr(r.type,e),n,a);break e}throw Error(s(306,r,""))}return t;case 0:return n=t.type,r=t.pendingProps,Gs(e,t,n,r=t.elementType===n?r:Xr(n,r),a);case 1:return n=t.type,r=t.pendingProps,Hs(e,t,n,r=t.elementType===n?r:Xr(n,r),a);case 3:if(Ws(t),n=t.updateQueue,null===e||null===n)throw Error(s(282));if(n=t.pendingProps,r=null!==(r=t.memoizedState)?r.element:null,lo(e,t),fo(t,n,null,a),(n=t.memoizedState.element)===r)qo(),t=oi(e,t,a);else{if((o=(r=t.stateNode).hydrate)&&($o=qn(t.stateNode.containerInfo.firstChild),zo=t,o=Uo=!0),o){if(null!=(e=r.mutableSourceEagerHydrationData))for(r=0;r<e.length;r+=2)(o=e[r])._workInProgressVersionPrimary=e[r+1],Yo.push(o);for(a=Io(t,null,n,a),t.child=a;a;)a.flags=-3&a.flags|1024,a=a.sibling}else js(e,t,n,a),qo();t=t.child}return t;case 5:return Do(t),null===e&&Ho(t),n=t.type,r=t.pendingProps,o=null!==e?e.memoizedProps:null,i=r.children,Gn(n,r)?i=null:null!==o&&Gn(n,o)&&(t.flags|=16),Zs(e,t),js(e,t,i,a),t.child;case 6:return null===e&&Ho(t),null;case 13:return Qs(e,t,a);case 4:return Ro(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=To(t,null,n,a):js(e,t,n,a),t.child;case 11:return n=t.type,r=t.pendingProps,Bs(e,t,n,r=t.elementType===n?r:Xr(n,r),a);case 7:return js(e,t,t.pendingProps,a),t.child;case 8:case 12:return js(e,t,t.pendingProps.children,a),t.child;case 10:e:{n=t.type._context,r=t.pendingProps,i=t.memoizedProps,o=r.value;var c=t.type._context;if(ur(Qr,c._currentValue),c._currentValue=o,null!==i)if(c=i.value,0===(o=ln(c,o)?0:0|("function"==typeof n._calculateChangedBits?n._calculateChangedBits(c,o):1073741823))){if(i.children===r.children&&!fr.current){t=oi(e,t,a);break e}}else for(null!==(c=t.child)&&(c.return=t);null!==c;){var d=c.dependencies;if(null!==d){i=c.child;for(var l=d.firstContext;null!==l;){if(l.context===n&&0!=(l.observedBits&o)){1===c.tag&&((l=uo(-1,a&-a)).tag=2,po(c,l)),c.lanes|=a,null!==(l=c.alternate)&&(l.lanes|=a),ro(c.return,a),d.lanes|=a;break}l=l.next}}else i=10===c.tag&&c.type===t.type?null:c.child;if(null!==i)i.return=c;else for(i=c;null!==i;){if(i===t){i=null;break}if(null!==(c=i.sibling)){c.return=i.return,i=c;break}i=i.return}c=i}js(e,t,r.children,a),t=t.child}return t;case 9:return r=t.type,n=(o=t.pendingProps).children,oo(t,a),n=n(r=so(r,o.unstable_observedBits)),t.flags|=1,js(e,t,n,a),t.child;case 14:return o=Xr(r=t.type,t.pendingProps),zs(e,t,r,o=Xr(r.type,o),n,a);case 15:return $s(e,t,t.type,t.pendingProps,n,a);case 17:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Xr(n,r),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,hr(n)?(e=!0,Sr(t)):e=!1,oo(t,a),_o(t,n,r),xo(t,n,r,a),Vs(null,t,n,!0,e,a);case 19:return ri(e,t,a);case 23:case 24:return Us(e,t,a)}throw Error(s(156,t.tag))},rd.prototype.render=function(e){ed(e,this._internalRoot,null,null)},rd.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;ed(null,e,null,(function(){t[er]=null}))},tt=function(e){13===e.tag&&(fc(e,4,pc()),nd(e,4))},at=function(e){13===e.tag&&(fc(e,67108864,pc()),nd(e,67108864))},nt=function(e){if(13===e.tag){var t=pc(),a=bc(e);fc(e,a,t),nd(e,a)}},rt=function(e,t){return t()},Te=function(e,t,a){switch(t){case"input":if(ae(e,a),t=a.name,"radio"===a.type&&null!=t){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var r=or(n);if(!r)throw Error(s(90));X(n),ae(n,r)}}}break;case"textarea":de(e,a);break;case"select":null!=(t=a.value)&&se(e,!!a.multiple,t,!1)}},Pe=_c,Re=function(e,t,a,n,r){var o=Oi;Oi|=4;try{return Vr(98,e.bind(null,t,a,n,r))}finally{0===(Oi=o)&&(Wi(),qr())}},Me=function(){0==(49&Oi)&&(function(){if(null!==rc){var e=rc;rc=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,gc(e,Zr())}))}qr()}(),Mc())},De=function(e,t){var a=Oi;Oi|=2;try{return e(t)}finally{0===(Oi=a)&&(Wi(),qr())}};var cd={Events:[nr,rr,or,Le,Oe,Mc,{current:!1}]},dd={findFiberByHostInstance:ar,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},ld={bundleType:dd.bundleType,version:dd.version,rendererPackageName:dd.rendererPackageName,rendererConfig:dd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Je(e))?null:e.stateNode},findFiberByHostInstance:dd.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ud=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ud.isDisabled&&ud.supportsFiber)try{kr=ud.inject(ld),wr=ud}catch(ge){}}t.hydrate=function(e,t,a){if(!od(t))throw Error(s(200));return sd(null,e,t,!0,a)}},73935:(e,t,a)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=a(64448)},69590:e=>{var t="undefined"!=typeof Element,a="function"==typeof Map,n="function"==typeof Set,r="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function o(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var i,c,d,l;if(Array.isArray(e)){if((i=e.length)!=s.length)return!1;for(c=i;0!=c--;)if(!o(e[c],s[c]))return!1;return!0}if(a&&e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(l=e.entries();!(c=l.next()).done;)if(!s.has(c.value[0]))return!1;for(l=e.entries();!(c=l.next()).done;)if(!o(c.value[1],s.get(c.value[0])))return!1;return!0}if(n&&e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(l=e.entries();!(c=l.next()).done;)if(!s.has(c.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(s)){if((i=e.length)!=s.length)return!1;for(c=i;0!=c--;)if(e[c]!==s[c])return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===s.toString();if((i=(d=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(c=i;0!=c--;)if(!Object.prototype.hasOwnProperty.call(s,d[c]))return!1;if(t&&e instanceof Element)return!1;for(c=i;0!=c--;)if(("_owner"!==d[c]&&"__v"!==d[c]&&"__o"!==d[c]||!e.$$typeof)&&!o(e[d[c]],s[d[c]]))return!1;return!0}return e!=e&&s!=s}e.exports=function(e,t){try{return o(e,t)}catch(a){if((a.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw a}}},70405:(e,t,a)=>{"use strict";a.d(t,{B6:()=>H,ql:()=>J});var n=a(67294),r=a(45697),o=a.n(r),s=a(69590),i=a.n(s),c=a(41143),d=a.n(c),l=a(96774),u=a.n(l);function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},p.apply(this,arguments)}function b(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,f(e,t)}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function m(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(a=o[n])>=0||(r[a]=e[a]);return r}var g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},h={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},y={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},_=Object.keys(g).map((function(e){return g[e]})),S={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},x=Object.keys(S).reduce((function(e,t){return e[S[t]]=t,e}),{}),k=function(e,t){for(var a=e.length-1;a>=0;a-=1){var n=e[a];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},w=function(e){var t=k(e,g.TITLE),a=k(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),a&&t)return a.replace(/%s/g,(function(){return t}));var n=k(e,"defaultTitle");return t||n||void 0},E=function(e){return k(e,"onChangeClientState")||function(){}},C=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return p({},e,t)}),{})},T=function(e,t){return t.filter((function(e){return void 0!==e[g.BASE]})).map((function(e){return e[g.BASE]})).reverse().reduce((function(t,a){if(!t.length)for(var n=Object.keys(a),r=0;r<n.length;r+=1){var o=n[r].toLowerCase();if(-1!==e.indexOf(o)&&a[o])return t.concat(a)}return t}),[])},I=function(e,t,a){var n={};return a.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,a){var r={};a.filter((function(e){for(var a,o=Object.keys(e),s=0;s<o.length;s+=1){var i=o[s],c=i.toLowerCase();-1===t.indexOf(c)||"rel"===a&&"canonical"===e[a].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(a=c),-1===t.indexOf(i)||"innerHTML"!==i&&"cssText"!==i&&"itemprop"!==i||(a=i)}if(!a||!e[a])return!1;var d=e[a].toLowerCase();return n[a]||(n[a]={}),r[a]||(r[a]={}),!n[a][d]&&(r[a][d]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var o=Object.keys(r),s=0;s<o.length;s+=1){var i=o[s],c=p({},n[i],r[i]);n[i]=c}return e}),[]).reverse()},N=function(e,t){if(Array.isArray(e)&&e.length)for(var a=0;a<e.length;a+=1)if(e[a][t])return!0;return!1},A=function(e){return Array.isArray(e)?e.join(""):e},L=function(e,t){return Array.isArray(e)?e.reduce((function(e,a){return function(e,t){for(var a=Object.keys(e),n=0;n<a.length;n+=1)if(t[a[n]]&&t[a[n]].includes(e[a[n]]))return!0;return!1}(a,t)?e.priority.push(a):e.default.push(a),e}),{priority:[],default:[]}):{default:e}},O=function(e,t){var a;return p({},e,((a={})[t]=void 0,a))},P=[g.NOSCRIPT,g.SCRIPT,g.STYLE],R=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},M=function(e){return Object.keys(e).reduce((function(t,a){var n=void 0!==e[a]?a+'="'+e[a]+'"':""+a;return t?t+" "+n:n}),"")},D=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce((function(t,a){return t[S[a]||a]=e[a],t}),t)},F=function(e,t){return t.map((function(t,a){var r,o=((r={key:a})["data-rh"]=!0,r);return Object.keys(t).forEach((function(e){var a=S[e]||e;"innerHTML"===a||"cssText"===a?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[a]=t[e]})),n.createElement(e,o)}))},j=function(e,t,a){switch(e){case g.TITLE:return{toComponent:function(){return a=t.titleAttributes,(r={key:e=t.title})["data-rh"]=!0,o=D(a,r),[n.createElement(g.TITLE,o,e)];var e,a,r,o},toString:function(){return function(e,t,a,n){var r=M(a),o=A(t);return r?"<"+e+' data-rh="true" '+r+">"+R(o,n)+"</"+e+">":"<"+e+' data-rh="true">'+R(o,n)+"</"+e+">"}(e,t.title,t.titleAttributes,a)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return D(t)},toString:function(){return M(t)}};default:return{toComponent:function(){return F(e,t)},toString:function(){return function(e,t,a){return t.reduce((function(t,n){var r=Object.keys(n).filter((function(e){return!("innerHTML"===e||"cssText"===e)})).reduce((function(e,t){var r=void 0===n[t]?t:t+'="'+R(n[t],a)+'"';return e?e+" "+r:r}),""),o=n.innerHTML||n.cssText||"",s=-1===P.indexOf(e);return t+"<"+e+' data-rh="true" '+r+(s?"/>":">"+o+"</"+e+">")}),"")}(e,t,a)}}}},B=function(e){var t=e.baseTag,a=e.bodyAttributes,n=e.encode,r=e.htmlAttributes,o=e.noscriptTags,s=e.styleTags,i=e.title,c=void 0===i?"":i,d=e.titleAttributes,l=e.linkTags,u=e.metaTags,p=e.scriptTags,b={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var f=function(e){var t=e.linkTags,a=e.scriptTags,n=e.encode,r=L(e.metaTags,y),o=L(t,h),s=L(a,v);return{priorityMethods:{toComponent:function(){return[].concat(F(g.META,r.priority),F(g.LINK,o.priority),F(g.SCRIPT,s.priority))},toString:function(){return j(g.META,r.priority,n)+" "+j(g.LINK,o.priority,n)+" "+j(g.SCRIPT,s.priority,n)}},metaTags:r.default,linkTags:o.default,scriptTags:s.default}}(e);b=f.priorityMethods,l=f.linkTags,u=f.metaTags,p=f.scriptTags}return{priority:b,base:j(g.BASE,t,n),bodyAttributes:j("bodyAttributes",a,n),htmlAttributes:j("htmlAttributes",r,n),link:j(g.LINK,l,n),meta:j(g.META,u,n),noscript:j(g.NOSCRIPT,o,n),script:j(g.SCRIPT,p,n),style:j(g.STYLE,s,n),title:j(g.TITLE,{title:c,titleAttributes:d},n)}},z=[],$=function(e,t){var a=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){a.context.helmet=e},helmetInstances:{get:function(){return a.canUseDOM?z:a.instances},add:function(e){(a.canUseDOM?z:a.instances).push(e)},remove:function(e){var t=(a.canUseDOM?z:a.instances).indexOf(e);(a.canUseDOM?z:a.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=B({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},U=n.createContext({}),Z=o().shape({setHelmet:o().func,helmetInstances:o().shape({get:o().func,add:o().func,remove:o().func})}),G="undefined"!=typeof document,H=function(e){function t(a){var n;return(n=e.call(this,a)||this).helmetData=new $(n.props.context,t.canUseDOM),n}return b(t,e),t.prototype.render=function(){return n.createElement(U.Provider,{value:this.helmetData.value},this.props.children)},t}(n.Component);H.canUseDOM=G,H.propTypes={context:o().shape({helmet:o().shape()}),children:o().node.isRequired},H.defaultProps={context:{}},H.displayName="HelmetProvider";var V=function(e,t){var a,n=document.head||document.querySelector(g.HEAD),r=n.querySelectorAll(e+"[data-rh]"),o=[].slice.call(r),s=[];return t&&t.length&&t.forEach((function(t){var n=document.createElement(e);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("innerHTML"===r?n.innerHTML=t.innerHTML:"cssText"===r?n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText)):n.setAttribute(r,void 0===t[r]?"":t[r]));n.setAttribute("data-rh","true"),o.some((function(e,t){return a=t,n.isEqualNode(e)}))?o.splice(a,1):s.push(n)})),o.forEach((function(e){return e.parentNode.removeChild(e)})),s.forEach((function(e){return n.appendChild(e)})),{oldTags:o,newTags:s}},W=function(e,t){var a=document.getElementsByTagName(e)[0];if(a){for(var n=a.getAttribute("data-rh"),r=n?n.split(","):[],o=[].concat(r),s=Object.keys(t),i=0;i<s.length;i+=1){var c=s[i],d=t[c]||"";a.getAttribute(c)!==d&&a.setAttribute(c,d),-1===r.indexOf(c)&&r.push(c);var l=o.indexOf(c);-1!==l&&o.splice(l,1)}for(var u=o.length-1;u>=0;u-=1)a.removeAttribute(o[u]);r.length===o.length?a.removeAttribute("data-rh"):a.getAttribute("data-rh")!==s.join(",")&&a.setAttribute("data-rh",s.join(","))}},q=function(e,t){var a=e.baseTag,n=e.htmlAttributes,r=e.linkTags,o=e.metaTags,s=e.noscriptTags,i=e.onChangeClientState,c=e.scriptTags,d=e.styleTags,l=e.title,u=e.titleAttributes;W(g.BODY,e.bodyAttributes),W(g.HTML,n),function(e,t){void 0!==e&&document.title!==e&&(document.title=A(e)),W(g.TITLE,t)}(l,u);var p={baseTag:V(g.BASE,a),linkTags:V(g.LINK,r),metaTags:V(g.META,o),noscriptTags:V(g.NOSCRIPT,s),scriptTags:V(g.SCRIPT,c),styleTags:V(g.STYLE,d)},b={},f={};Object.keys(p).forEach((function(e){var t=p[e],a=t.newTags,n=t.oldTags;a.length&&(b[e]=a),n.length&&(f[e]=p[e].oldTags)})),t&&t(),i(e,b,f)},Y=null,K=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).rendered=!1,t}b(t,e);var a=t.prototype;return a.shouldComponentUpdate=function(e){return!u()(e,this.props)},a.componentDidUpdate=function(){this.emitChange()},a.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},a.emitChange=function(){var e,t,a=this.props.context,n=a.setHelmet,r=null,o=(e=a.helmetInstances.get().map((function(e){var t=p({},e.props);return delete t.context,t})),{baseTag:T(["href"],e),bodyAttributes:C("bodyAttributes",e),defer:k(e,"defer"),encode:k(e,"encodeSpecialCharacters"),htmlAttributes:C("htmlAttributes",e),linkTags:I(g.LINK,["rel","href"],e),metaTags:I(g.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:I(g.NOSCRIPT,["innerHTML"],e),onChangeClientState:E(e),scriptTags:I(g.SCRIPT,["src","innerHTML"],e),styleTags:I(g.STYLE,["cssText"],e),title:w(e),titleAttributes:C("titleAttributes",e),prioritizeSeoTags:N(e,"prioritizeSeoTags")});H.canUseDOM?(t=o,Y&&cancelAnimationFrame(Y),t.defer?Y=requestAnimationFrame((function(){q(t,(function(){Y=null}))})):(q(t),Y=null)):B&&(r=B(o)),n(r)},a.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},a.render=function(){return this.init(),null},t}(n.Component);K.propTypes={context:Z.isRequired},K.displayName="HelmetDispatcher";var X=["children"],Q=["children"],J=function(e){function t(){return e.apply(this,arguments)||this}b(t,e);var a=t.prototype;return a.shouldComponentUpdate=function(e){return!i()(O(this.props,"helmetData"),O(e,"helmetData"))},a.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case g.SCRIPT:case g.NOSCRIPT:return{innerHTML:t};case g.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},a.flattenArrayTypeChildren=function(e){var t,a=e.child,n=e.arrayTypeChildren;return p({},n,((t={})[a.type]=[].concat(n[a.type]||[],[p({},e.newChildProps,this.mapNestedChildrenToProps(a,e.nestedChildren))]),t))},a.mapObjectTypeChildren=function(e){var t,a,n=e.child,r=e.newProps,o=e.newChildProps,s=e.nestedChildren;switch(n.type){case g.TITLE:return p({},r,((t={})[n.type]=s,t.titleAttributes=p({},o),t));case g.BODY:return p({},r,{bodyAttributes:p({},o)});case g.HTML:return p({},r,{htmlAttributes:p({},o)});default:return p({},r,((a={})[n.type]=p({},o),a))}},a.mapArrayTypeChildrenToProps=function(e,t){var a=p({},t);return Object.keys(e).forEach((function(t){var n;a=p({},a,((n={})[t]=e[t],n))})),a},a.warnOnInvalidChildren=function(e,t){return d()(_.some((function(t){return e.type===t})),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+_.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),d()(!t||"string"==typeof t||Array.isArray(t)&&!t.some((function(e){return"string"!=typeof e})),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},a.mapChildrenToProps=function(e,t){var a=this,r={};return n.Children.forEach(e,(function(e){if(e&&e.props){var n=e.props,o=n.children,s=m(n,X),i=Object.keys(s).reduce((function(e,t){return e[x[t]||t]=s[t],e}),{}),c=e.type;switch("symbol"==typeof c?c=c.toString():a.warnOnInvalidChildren(e,o),c){case g.FRAGMENT:t=a.mapChildrenToProps(o,t);break;case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:r=a.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:i,nestedChildren:o});break;default:t=a.mapObjectTypeChildren({child:e,newProps:t,newChildProps:i,nestedChildren:o})}}})),this.mapArrayTypeChildrenToProps(r,t)},a.render=function(){var e=this.props,t=e.children,a=m(e,Q),r=p({},a),o=a.helmetData;return t&&(r=this.mapChildrenToProps(t,r)),!o||o instanceof $||(o=new $(o.context,o.instances)),o?n.createElement(K,p({},r,{context:o.value,helmetData:void 0})):n.createElement(U.Consumer,null,(function(e){return n.createElement(K,p({},r,{context:e}))}))},t}(n.Component);J.propTypes={base:o().object,bodyAttributes:o().object,children:o().oneOfType([o().arrayOf(o().node),o().node]),defaultTitle:o().string,defer:o().bool,encodeSpecialCharacters:o().bool,htmlAttributes:o().object,link:o().arrayOf(o().object),meta:o().arrayOf(o().object),noscript:o().arrayOf(o().object),onChangeClientState:o().func,script:o().arrayOf(o().object),style:o().arrayOf(o().object),title:o().string,titleAttributes:o().object,titleTemplate:o().string,prioritizeSeoTags:o().bool,helmetData:o().object},J.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},J.displayName="Helmet"},69921:(e,t)=>{"use strict";var a="function"==typeof Symbol&&Symbol.for,n=a?Symbol.for("react.element"):60103,r=a?Symbol.for("react.portal"):60106,o=a?Symbol.for("react.fragment"):60107,s=a?Symbol.for("react.strict_mode"):60108,i=a?Symbol.for("react.profiler"):60114,c=a?Symbol.for("react.provider"):60109,d=a?Symbol.for("react.context"):60110,l=a?Symbol.for("react.async_mode"):60111,u=a?Symbol.for("react.concurrent_mode"):60111,p=a?Symbol.for("react.forward_ref"):60112,b=a?Symbol.for("react.suspense"):60113,f=a?Symbol.for("react.suspense_list"):60120,m=a?Symbol.for("react.memo"):60115,g=a?Symbol.for("react.lazy"):60116,h=a?Symbol.for("react.block"):60121,v=a?Symbol.for("react.fundamental"):60117,y=a?Symbol.for("react.responder"):60118,_=a?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case l:case u:case o:case i:case s:case b:return e;default:switch(e=e&&e.$$typeof){case d:case p:case g:case m:case c:return e;default:return t}}case r:return t}}}function x(e){return S(e)===u}t.AsyncMode=l,t.ConcurrentMode=u,t.ContextConsumer=d,t.ContextProvider=c,t.Element=n,t.ForwardRef=p,t.Fragment=o,t.Lazy=g,t.Memo=m,t.Portal=r,t.Profiler=i,t.StrictMode=s,t.Suspense=b,t.isAsyncMode=function(e){return x(e)||S(e)===l},t.isConcurrentMode=x,t.isContextConsumer=function(e){return S(e)===d},t.isContextProvider=function(e){return S(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return S(e)===p},t.isFragment=function(e){return S(e)===o},t.isLazy=function(e){return S(e)===g},t.isMemo=function(e){return S(e)===m},t.isPortal=function(e){return S(e)===r},t.isProfiler=function(e){return S(e)===i},t.isStrictMode=function(e){return S(e)===s},t.isSuspense=function(e){return S(e)===b},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===u||e===i||e===s||e===b||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===c||e.$$typeof===d||e.$$typeof===p||e.$$typeof===v||e.$$typeof===y||e.$$typeof===_||e.$$typeof===h)},t.typeOf=S},59864:(e,t,a)=>{"use strict";e.exports=a(69921)},68356:(e,t,a)=>{"use strict";function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}var i=a(67294),c=a(45697),d=[],l=[];function u(e){var t=e(),a={loading:!0,loaded:null,error:null};return a.promise=t.then((function(e){return a.loading=!1,a.loaded=e,e})).catch((function(e){throw a.loading=!1,a.error=e,e})),a}function p(e){var t={loading:!1,loaded:{},error:null},a=[];try{Object.keys(e).forEach((function(n){var r=u(e[n]);r.loading?t.loading=!0:(t.loaded[n]=r.loaded,t.error=r.error),a.push(r.promise),r.promise.then((function(e){t.loaded[n]=e})).catch((function(e){t.error=e}))}))}catch(n){t.error=n}return t.promise=Promise.all(a).then((function(e){return t.loading=!1,e})).catch((function(e){throw t.loading=!1,e})),t}function b(e,t){return i.createElement((a=e)&&a.__esModule?a.default:a,t);var a}function f(e,t){var u,p;if(!t.loading)throw new Error("react-loadable requires a `loading` component");var f=s({loader:null,loading:null,delay:200,timeout:null,render:b,webpack:null,modules:null},t),m=null;function g(){return m||(m=e(f.loader)),m.promise}return d.push(g),"function"==typeof f.webpack&&l.push((function(){if((0,f.webpack)().every((function(e){return void 0!==e&&void 0!==a.m[e]})))return g()})),p=u=function(t){function a(a){var n;return o(r(r(n=t.call(this,a)||this)),"retry",(function(){n.setState({error:null,loading:!0,timedOut:!1}),m=e(f.loader),n._loadModule()})),g(),n.state={error:m.error,pastDelay:!1,timedOut:!1,loading:m.loading,loaded:m.loaded},n}n(a,t),a.preload=function(){return g()};var s=a.prototype;return s.UNSAFE_componentWillMount=function(){this._loadModule()},s.componentDidMount=function(){this._mounted=!0},s._loadModule=function(){var e=this;if(this.context.loadable&&Array.isArray(f.modules)&&f.modules.forEach((function(t){e.context.loadable.report(t)})),m.loading){var t=function(t){e._mounted&&e.setState(t)};"number"==typeof f.delay&&(0===f.delay?this.setState({pastDelay:!0}):this._delay=setTimeout((function(){t({pastDelay:!0})}),f.delay)),"number"==typeof f.timeout&&(this._timeout=setTimeout((function(){t({timedOut:!0})}),f.timeout));var a=function(){t({error:m.error,loaded:m.loaded,loading:m.loading}),e._clearTimeouts()};m.promise.then((function(){return a(),null})).catch((function(e){return a(),null}))}},s.componentWillUnmount=function(){this._mounted=!1,this._clearTimeouts()},s._clearTimeouts=function(){clearTimeout(this._delay),clearTimeout(this._timeout)},s.render=function(){return this.state.loading||this.state.error?i.createElement(f.loading,{isLoading:this.state.loading,pastDelay:this.state.pastDelay,timedOut:this.state.timedOut,error:this.state.error,retry:this.retry}):this.state.loaded?f.render(this.state.loaded,this.props):null},a}(i.Component),o(u,"contextTypes",{loadable:c.shape({report:c.func.isRequired})}),p}function m(e){return f(u,e)}m.Map=function(e){if("function"!=typeof e.render)throw new Error("LoadableMap requires a `render(loaded, props)` function");return f(p,e)};var g=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var a=t.prototype;return a.getChildContext=function(){return{loadable:{report:this.props.report}}},a.render=function(){return i.Children.only(this.props.children)},t}(i.Component);function h(e){for(var t=[];e.length;){var a=e.pop();t.push(a())}return Promise.all(t).then((function(){if(e.length)return h(e)}))}o(g,"propTypes",{report:c.func.isRequired}),o(g,"childContextTypes",{loadable:c.shape({report:c.func.isRequired}).isRequired}),m.Capture=g,m.preloadAll=function(){return new Promise((function(e,t){h(d).then(e,t)}))},m.preloadReady=function(){return new Promise((function(e,t){h(l).then(e,e)}))},e.exports=m},18790:(e,t,a)=>{"use strict";a.d(t,{H:()=>i,f:()=>s});var n=a(16550),r=a(87462),o=a(67294);function s(e,t,a){return void 0===a&&(a=[]),e.some((function(e){var r=e.path?(0,n.LX)(t,e):a.length?a[a.length-1].match:n.F0.computeRootMatch(t);return r&&(a.push({route:e,match:r}),e.routes&&s(e.routes,t,a)),r})),a}function i(e,t,a){return void 0===t&&(t={}),void 0===a&&(a={}),e?o.createElement(n.rs,a,e.map((function(e,a){return o.createElement(n.AW,{key:e.key||a,path:e.path,exact:e.exact,strict:e.strict,render:function(a){return e.render?e.render((0,r.Z)({},a,{},t,{route:e})):o.createElement(e.component,(0,r.Z)({},a,t,{route:e}))}})}))):null}},73727:(e,t,a)=>{"use strict";a.d(t,{OL:()=>y,VK:()=>l,rU:()=>g});var n=a(16550),r=a(75068),o=a(67294),s=a(99318),i=a(87462),c=a(63366),d=a(38776),l=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).history=(0,s.lX)(t.props),t}return(0,r.Z)(t,e),t.prototype.render=function(){return o.createElement(n.F0,{history:this.history,children:this.props.children})},t}(o.Component);o.Component;var u=function(e,t){return"function"==typeof e?e(t):e},p=function(e,t){return"string"==typeof e?(0,s.ob)(e,null,null,t):e},b=function(e){return e},f=o.forwardRef;void 0===f&&(f=b);var m=f((function(e,t){var a=e.innerRef,n=e.navigate,r=e.onClick,s=(0,c.Z)(e,["innerRef","navigate","onClick"]),d=s.target,l=(0,i.Z)({},s,{onClick:function(e){try{r&&r(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||d&&"_self"!==d||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),n())}});return l.ref=b!==f&&t||a,o.createElement("a",l)}));var g=f((function(e,t){var a=e.component,r=void 0===a?m:a,l=e.replace,g=e.to,h=e.innerRef,v=(0,c.Z)(e,["component","replace","to","innerRef"]);return o.createElement(n.s6.Consumer,null,(function(e){e||(0,d.Z)(!1);var a=e.history,n=p(u(g,e.location),e.location),c=n?a.createHref(n):"",m=(0,i.Z)({},v,{href:c,navigate:function(){var t=u(g,e.location),n=(0,s.Ep)(e.location)===(0,s.Ep)(p(t));(l||n?a.replace:a.push)(t)}});return b!==f?m.ref=t||h:m.innerRef=h,o.createElement(r,m)}))})),h=function(e){return e},v=o.forwardRef;void 0===v&&(v=h);var y=v((function(e,t){var a=e["aria-current"],r=void 0===a?"page":a,s=e.activeClassName,l=void 0===s?"active":s,b=e.activeStyle,f=e.className,m=e.exact,y=e.isActive,_=e.location,S=e.sensitive,x=e.strict,k=e.style,w=e.to,E=e.innerRef,C=(0,c.Z)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return o.createElement(n.s6.Consumer,null,(function(e){e||(0,d.Z)(!1);var a=_||e.location,s=p(u(w,a),a),c=s.pathname,T=c&&c.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),I=T?(0,n.LX)(a.pathname,{path:T,exact:m,sensitive:S,strict:x}):null,N=!!(y?y(I,a):I),A="function"==typeof f?f(N):f,L="function"==typeof k?k(N):k;N&&(A=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((function(e){return e})).join(" ")}(A,l),L=(0,i.Z)({},L,b));var O=(0,i.Z)({"aria-current":N&&r||null,className:A,style:L,to:s},C);return h!==v?O.ref=t||E:O.innerRef=E,o.createElement(g,O)}))}))},16550:(e,t,a)=>{"use strict";a.d(t,{AW:()=>w,F0:()=>_,LX:()=>k,TH:()=>P,k6:()=>O,rs:()=>A,s6:()=>y});var n=a(75068),r=a(67294),o=a(45697),s=a.n(o),i=a(99318),c=a(38776),d=a(87462),l=a(14779),u=a.n(l),p=(a(59864),a(63366)),b=(a(8679),1073741823),f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==a.g?a.g:{};function m(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(a,n){e=a,t.forEach((function(t){return t(e,n)}))}}}var g=r.createContext||function(e,t){var a,o,i="__create-react-context-"+function(){var e="__global_unique_id__";return f[e]=(f[e]||0)+1}()+"__",c=function(e){function a(){for(var t,a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).emitter=m(t.props.value),t}(0,n.Z)(a,e);var r=a.prototype;return r.getChildContext=function(){var e;return(e={})[i]=this.emitter,e},r.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var a,n=this.props.value,r=e.value;((o=n)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)?a=0:(a="function"==typeof t?t(n,r):b,0!==(a|=0)&&this.emitter.set(e.value,a))}var o,s},r.render=function(){return this.props.children},a}(r.Component);c.childContextTypes=((a={})[i]=s().object.isRequired,a);var d=function(t){function a(){for(var e,a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).observedBits=void 0,e.state={value:e.getValue()},e.onUpdate=function(t,a){0!=((0|e.observedBits)&a)&&e.setState({value:e.getValue()})},e}(0,n.Z)(a,t);var r=a.prototype;return r.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?b:t},r.componentDidMount=function(){this.context[i]&&this.context[i].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?b:e},r.componentWillUnmount=function(){this.context[i]&&this.context[i].off(this.onUpdate)},r.getValue=function(){return this.context[i]?this.context[i].get():e},r.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},a}(r.Component);return d.contextTypes=((o={})[i]=s().object,o),{Provider:c,Consumer:d}},h=function(e){var t=g();return t.displayName=e,t},v=h("Router-History"),y=h("Router"),_=function(e){function t(t){var a;return(a=e.call(this,t)||this).state={location:t.history.location},a._isMounted=!1,a._pendingLocation=null,t.staticContext||(a.unlisten=t.history.listen((function(e){a._pendingLocation=e}))),a}(0,n.Z)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var a=t.prototype;return a.componentDidMount=function(){var e=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen((function(t){e._isMounted&&e.setState({location:t})}))),this._pendingLocation&&this.setState({location:this._pendingLocation})},a.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},a.render=function(){return r.createElement(y.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},r.createElement(v.Provider,{children:this.props.children||null,value:this.props.history}))},t}(r.Component);r.Component;r.Component;var S={},x=0;function k(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var a=t,n=a.path,r=a.exact,o=void 0!==r&&r,s=a.strict,i=void 0!==s&&s,c=a.sensitive,d=void 0!==c&&c;return[].concat(n).reduce((function(t,a){if(!a&&""!==a)return null;if(t)return t;var n=function(e,t){var a=""+t.end+t.strict+t.sensitive,n=S[a]||(S[a]={});if(n[e])return n[e];var r=[],o={regexp:u()(e,r,t),keys:r};return x<1e4&&(n[e]=o,x++),o}(a,{end:o,strict:i,sensitive:d}),r=n.regexp,s=n.keys,c=r.exec(e);if(!c)return null;var l=c[0],p=c.slice(1),b=e===l;return o&&!b?null:{path:a,url:"/"===a&&""===l?"/":l,isExact:b,params:s.reduce((function(e,t,a){return e[t.name]=p[a],e}),{})}}),null)}var w=function(e){function t(){return e.apply(this,arguments)||this}return(0,n.Z)(t,e),t.prototype.render=function(){var e=this;return r.createElement(y.Consumer,null,(function(t){t||(0,c.Z)(!1);var a=e.props.location||t.location,n=e.props.computedMatch?e.props.computedMatch:e.props.path?k(a.pathname,e.props):t.match,o=(0,d.Z)({},t,{location:a,match:n}),s=e.props,i=s.children,l=s.component,u=s.render;return Array.isArray(i)&&function(e){return 0===r.Children.count(e)}(i)&&(i=null),r.createElement(y.Provider,{value:o},o.match?i?"function"==typeof i?i(o):i:l?r.createElement(l,o):u?u(o):null:"function"==typeof i?i(o):null)}))},t}(r.Component);function E(e){return"/"===e.charAt(0)?e:"/"+e}function C(e,t){if(!e)return t;var a=E(e);return 0!==t.pathname.indexOf(a)?t:(0,d.Z)({},t,{pathname:t.pathname.substr(a.length)})}function T(e){return"string"==typeof e?e:(0,i.Ep)(e)}function I(e){return function(){(0,c.Z)(!1)}}function N(){}r.Component;var A=function(e){function t(){return e.apply(this,arguments)||this}return(0,n.Z)(t,e),t.prototype.render=function(){var e=this;return r.createElement(y.Consumer,null,(function(t){t||(0,c.Z)(!1);var a,n,o=e.props.location||t.location;return r.Children.forEach(e.props.children,(function(e){if(null==n&&r.isValidElement(e)){a=e;var s=e.props.path||e.props.from;n=s?k(o.pathname,(0,d.Z)({},e.props,{path:s})):t.match}})),n?r.cloneElement(a,{location:o,computedMatch:n}):null}))},t}(r.Component);var L=r.useContext;function O(){return L(v)}function P(){return L(y).location}},72408:(e,t,a)=>{"use strict";var n=a(27418),r=60103,o=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var s=60109,i=60110,c=60112;t.Suspense=60113;var d=60115,l=60116;if("function"==typeof Symbol&&Symbol.for){var u=Symbol.for;r=u("react.element"),o=u("react.portal"),t.Fragment=u("react.fragment"),t.StrictMode=u("react.strict_mode"),t.Profiler=u("react.profiler"),s=u("react.provider"),i=u("react.context"),c=u("react.forward_ref"),t.Suspense=u("react.suspense"),d=u("react.memo"),l=u("react.lazy")}var p="function"==typeof Symbol&&Symbol.iterator;function b(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m={};function g(e,t,a){this.props=e,this.context=t,this.refs=m,this.updater=a||f}function h(){}function v(e,t,a){this.props=e,this.context=t,this.refs=m,this.updater=a||f}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(b(85));this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},h.prototype=g.prototype;var y=v.prototype=new h;y.constructor=v,n(y,g.prototype),y.isPureReactComponent=!0;var _={current:null},S=Object.prototype.hasOwnProperty,x={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,a){var n,o={},s=null,i=null;if(null!=t)for(n in void 0!==t.ref&&(i=t.ref),void 0!==t.key&&(s=""+t.key),t)S.call(t,n)&&!x.hasOwnProperty(n)&&(o[n]=t[n]);var c=arguments.length-2;if(1===c)o.children=a;else if(1<c){for(var d=Array(c),l=0;l<c;l++)d[l]=arguments[l+2];o.children=d}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===o[n]&&(o[n]=c[n]);return{$$typeof:r,type:e,key:s,ref:i,props:o,_owner:_.current}}function w(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var E=/\/+/g;function C(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function T(e,t,a,n,s){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var c=!1;if(null===e)c=!0;else switch(i){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case r:case o:c=!0}}if(c)return s=s(c=e),e=""===n?"."+C(c,0):n,Array.isArray(s)?(a="",null!=e&&(a=e.replace(E,"$&/")+"/"),T(s,t,a,"",(function(e){return e}))):null!=s&&(w(s)&&(s=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,a+(!s.key||c&&c.key===s.key?"":(""+s.key).replace(E,"$&/")+"/")+e)),t.push(s)),1;if(c=0,n=""===n?".":n+":",Array.isArray(e))for(var d=0;d<e.length;d++){var l=n+C(i=e[d],d);c+=T(i,t,a,l,s)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),d=0;!(i=e.next()).done;)c+=T(i=i.value,t,a,l=n+C(i,d++),s);else if("object"===i)throw t=""+e,Error(b(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return c}function I(e,t,a){if(null==e)return e;var n=[],r=0;return T(e,n,"","",(function(e){return t.call(a,e,r++)})),n}function N(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var A={current:null};function L(){var e=A.current;if(null===e)throw Error(b(321));return e}var O={ReactCurrentDispatcher:A,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:_,IsSomeRendererActing:{current:!1},assign:n};t.Children={map:I,forEach:function(e,t,a){I(e,(function(){t.apply(this,arguments)}),a)},count:function(e){var t=0;return I(e,(function(){t++})),t},toArray:function(e){return I(e,(function(e){return e}))||[]},only:function(e){if(!w(e))throw Error(b(143));return e}},t.Component=g,t.PureComponent=v,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,t.cloneElement=function(e,t,a){if(null==e)throw Error(b(267,e));var o=n({},e.props),s=e.key,i=e.ref,c=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,c=_.current),void 0!==t.key&&(s=""+t.key),e.type&&e.type.defaultProps)var d=e.type.defaultProps;for(l in t)S.call(t,l)&&!x.hasOwnProperty(l)&&(o[l]=void 0===t[l]&&void 0!==d?d[l]:t[l])}var l=arguments.length-2;if(1===l)o.children=a;else if(1<l){d=Array(l);for(var u=0;u<l;u++)d[u]=arguments[u+2];o.children=d}return{$$typeof:r,type:e.type,key:s,ref:i,props:o,_owner:c}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:i,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=k,t.createFactory=function(e){var t=k.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=w,t.lazy=function(e){return{$$typeof:l,_payload:{_status:-1,_result:e},_init:N}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return L().useCallback(e,t)},t.useContext=function(e,t){return L().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return L().useEffect(e,t)},t.useImperativeHandle=function(e,t,a){return L().useImperativeHandle(e,t,a)},t.useLayoutEffect=function(e,t){return L().useLayoutEffect(e,t)},t.useMemo=function(e,t){return L().useMemo(e,t)},t.useReducer=function(e,t,a){return L().useReducer(e,t,a)},t.useRef=function(e){return L().useRef(e)},t.useState=function(e){return L().useState(e)},t.version="17.0.2"},67294:(e,t,a)=>{"use strict";e.exports=a(72408)},60053:(e,t)=>{"use strict";var a,n,r,o;if("object"==typeof performance&&"function"==typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var d=null,l=null,u=function(){if(null!==d)try{var e=t.unstable_now();d(!0,e),d=null}catch(a){throw setTimeout(u,0),a}};a=function(e){null!==d?setTimeout(a,0,e):(d=e,setTimeout(u,0))},n=function(e,t){l=setTimeout(e,t)},r=function(){clearTimeout(l)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var p=window.setTimeout,b=window.clearTimeout;if("undefined"!=typeof console){var f=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof f&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var m=!1,g=null,h=-1,v=5,y=0;t.unstable_shouldYield=function(){return t.unstable_now()>=y},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):v=0<e?Math.floor(1e3/e):5};var _=new MessageChannel,S=_.port2;_.port1.onmessage=function(){if(null!==g){var e=t.unstable_now();y=e+v;try{g(!0,e)?S.postMessage(null):(m=!1,g=null)}catch(a){throw S.postMessage(null),a}}else m=!1},a=function(e){g=e,m||(m=!0,S.postMessage(null))},n=function(e,a){h=p((function(){e(t.unstable_now())}),a)},r=function(){b(h),h=-1}}function x(e,t){var a=e.length;e.push(t);e:for(;;){var n=a-1>>>1,r=e[n];if(!(void 0!==r&&0<E(r,t)))break e;e[n]=t,e[a]=r,a=n}}function k(e){return void 0===(e=e[0])?null:e}function w(e){var t=e[0];if(void 0!==t){var a=e.pop();if(a!==t){e[0]=a;e:for(var n=0,r=e.length;n<r;){var o=2*(n+1)-1,s=e[o],i=o+1,c=e[i];if(void 0!==s&&0>E(s,a))void 0!==c&&0>E(c,s)?(e[n]=c,e[i]=a,n=i):(e[n]=s,e[o]=a,n=o);else{if(!(void 0!==c&&0>E(c,a)))break e;e[n]=c,e[i]=a,n=i}}}return t}return null}function E(e,t){var a=e.sortIndex-t.sortIndex;return 0!==a?a:e.id-t.id}var C=[],T=[],I=1,N=null,A=3,L=!1,O=!1,P=!1;function R(e){for(var t=k(T);null!==t;){if(null===t.callback)w(T);else{if(!(t.startTime<=e))break;w(T),t.sortIndex=t.expirationTime,x(C,t)}t=k(T)}}function M(e){if(P=!1,R(e),!O)if(null!==k(C))O=!0,a(D);else{var t=k(T);null!==t&&n(M,t.startTime-e)}}function D(e,a){O=!1,P&&(P=!1,r()),L=!0;var o=A;try{for(R(a),N=k(C);null!==N&&(!(N.expirationTime>a)||e&&!t.unstable_shouldYield());){var s=N.callback;if("function"==typeof s){N.callback=null,A=N.priorityLevel;var i=s(N.expirationTime<=a);a=t.unstable_now(),"function"==typeof i?N.callback=i:N===k(C)&&w(C),R(a)}else w(C);N=k(C)}if(null!==N)var c=!0;else{var d=k(T);null!==d&&n(M,d.startTime-a),c=!1}return c}finally{N=null,A=o,L=!1}}var F=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){O||L||(O=!0,a(D))},t.unstable_getCurrentPriorityLevel=function(){return A},t.unstable_getFirstCallbackNode=function(){return k(C)},t.unstable_next=function(e){switch(A){case 1:case 2:case 3:var t=3;break;default:t=A}var a=A;A=t;try{return e()}finally{A=a}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=F,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var a=A;A=e;try{return t()}finally{A=a}},t.unstable_scheduleCallback=function(e,o,s){var i=t.unstable_now();switch("object"==typeof s&&null!==s?s="number"==typeof(s=s.delay)&&0<s?i+s:i:s=i,e){case 1:var c=-1;break;case 2:c=250;break;case 5:c=1073741823;break;case 4:c=1e4;break;default:c=5e3}return e={id:I++,callback:o,priorityLevel:e,startTime:s,expirationTime:c=s+c,sortIndex:-1},s>i?(e.sortIndex=s,x(T,e),null===k(C)&&e===k(T)&&(P?r():P=!0,n(M,s-i))):(e.sortIndex=c,x(C,e),O||L||(O=!0,a(D))),e},t.unstable_wrapCallback=function(e){var t=A;return function(){var a=A;A=t;try{return e.apply(this,arguments)}finally{A=a}}}},63840:(e,t,a)=>{"use strict";e.exports=a(60053)},96774:e=>{e.exports=function(e,t,a,n){var r=a?a.call(n,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(t),c=0;c<o.length;c++){var d=o[c];if(!i(d))return!1;var l=e[d],u=t[d];if(!1===(r=a?a.call(n,l,u,d):void 0)||void 0===r&&l!==u)return!1}return!0}},53250:(e,t,a)=>{"use strict";var n=a(67294);var r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useState,s=n.useEffect,i=n.useLayoutEffect,c=n.useDebugValue;function d(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!r(e,a)}catch(n){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),n=o({inst:{value:a,getSnapshot:t}}),r=n[0].inst,l=n[1];return i((function(){r.value=a,r.getSnapshot=t,d(r)&&l({inst:r})}),[e,a,t]),s((function(){return d(r)&&l({inst:r}),e((function(){d(r)&&l({inst:r})}))}),[e]),c(a),a};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:l},61688:(e,t,a)=>{"use strict";e.exports=a(53250)},36809:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>n});const n={title:"Odra",tagline:"Writing smart contracts have never been easier!",url:"https://odra.dev",baseUrl:"/",onBrokenLinks:"throw",onBrokenMarkdownLinks:"warn",favicon:"img/favicon.ico",organizationName:"odradev",projectName:"odra",i18n:{defaultLocale:"en",locales:["en"],path:"i18n",localeConfigs:{}},plugins:[["/home/runner/work/odradev.github.io/odradev.github.io/docusaurus/node_modules/docusaurus-lunr-search/src/index.js",{excludeRoutes:["docs/0.2.0/**/*","docs/0.3.0/**/*","docs/0.3.1/**/*","docs/0.4.0/**/*","docs/0.5.0/**/*","docs/0.6.0/**/*","docs/0.7.0/**/*","docs/0.8.0/**/*","docs/0.9.0/**/*","docs/0.9.1/**/*"]}]],presets:[["classic",{blog:{showReadingTime:!0,blogSidebarCount:0,postsPerPage:"ALL"},docs:{sidebarPath:"/home/runner/work/odradev.github.io/odradev.github.io/docusaurus/sidebars.js",includeCurrentVersion:!0,showLastUpdateTime:!0,lastVersion:"1.0.0",versions:{current:{label:"next"}}},theme:{customCss:"/home/runner/work/odradev.github.io/odradev.github.io/docusaurus/src/css/custom.css"}}]],markdown:{mermaid:!0},themes:["@docusaurus/theme-mermaid"],themeConfig:{colorMode:{defaultMode:"dark",disableSwitch:!1,respectPrefersColorScheme:!1},navbar:{logo:{alt:"Odra Logo",src:"img/small_logo_light.png",srcDark:"img/small_logo_dark.png"},items:[{to:"/blog",label:"Blog",position:"left"},{to:"/docs",label:"Docs",position:"left"},{type:"docsVersionDropdown",position:"right",dropdownActiveClassDisabled:!0,dropdownItemsBefore:[],dropdownItemsAfter:[]},{href:"https://github.com/odradev/odra",label:"GitHub",position:"right"},{href:"https://twitter.com/odradev",label:"Twitter",position:"right"},{href:"https://discord.gg/Mm5ABc9P8k",label:"Discord",position:"right"}],hideOnScroll:!1},footer:{style:"light",copyright:'by <a href="https://odra.dev">odra.dev<a>',links:[]},prism:{theme:{plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},darkTheme:{plain:{color:"#9CDCFE",backgroundColor:"#1E1E1E"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}}]},additionalLanguages:["rust","solidity"],magicComments:[{className:"theme-code-block-highlighted-line",line:"highlight-next-line",block:{start:"highlight-start",end:"highlight-end"}}]},docs:{versionPersistence:"localStorage",sidebar:{hideable:!1,autoCollapseCategories:!1}},metadata:[],tableOfContents:{minHeadingLevel:2,maxHeadingLevel:3},mermaid:{theme:{dark:"dark",light:"default"},options:{}}},baseUrlIssueBanner:!0,onDuplicateRoutes:"warn",staticDirectories:["static"],customFields:{},scripts:[],headTags:[],stylesheets:[],clientModules:[],titleDelimiter:"|",noIndex:!1}},87462:(e,t,a)=>{"use strict";function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},n.apply(this,arguments)}a.d(t,{Z:()=>n})},75068:(e,t,a)=>{"use strict";function n(e,t){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},n(e,t)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}a.d(t,{Z:()=>r})},63366:(e,t,a)=>{"use strict";function n(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}a.d(t,{Z:()=>n})},38776:(e,t,a)=>{"use strict";a.d(t,{Z:()=>r});var n="Invariant failed";function r(e,t){if(!e)throw new Error(n)}},57529:e=>{"use strict";e.exports={}},16887:e=>{"use strict";e.exports=JSON.parse('{"/blog-8e1":{"__comp":"a6aa9e1f","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","items":[{"content":"c1ae59bd"},{"content":"93514764"},{"content":"cd790770"},{"content":"3c817d4f"},{"content":"599e53c2"},{"content":"739a70a9"},{"content":"a6f6e2b9"}],"metadata":"b2b675dd"},"/blog/2023-02-27-openai-writes-erc20-in-odra-d74":{"__comp":"ccc49370","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","content":"9a7f4a11"},"/blog/archive-fb4":{"__comp":"9e4087bc","__context":{"plugin":"98b2adcf"},"archive":"b2f554cd"},"/blog/casper-zk-risc0-130":{"__comp":"ccc49370","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","content":"71735968"},"/blog/evm-at-risc0-d36":{"__comp":"ccc49370","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","content":"71b691b7"},"/blog/its-all-about-the-community-1cb":{"__comp":"ccc49370","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","content":"a05c6bda"},"/blog/Nysa-9ad":{"__comp":"ccc49370","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","content":"7d8962a6"},"/blog/odra-cosmwasm-70d":{"__comp":"ccc49370","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","content":"d15969ed"},"/blog/release-020-1af":{"__comp":"ccc49370","__context":{"plugin":"98b2adcf"},"sidebar":"814f3328","content":"177939f6"},"/docs/0.2.0-eb8":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"799b1c68"},"/docs/0.2.0/-dd7":{"__comp":"17896441","content":"b759477d"},"/docs/0.2.0/backends/casper-9e3":{"__comp":"17896441","content":"bd4cf5c0"},"/docs/0.2.0/backends/mock-vm-af2":{"__comp":"17896441","content":"c714b9ee"},"/docs/0.2.0/backends/what-is-a-backend-ac7":{"__comp":"17896441","content":"3e9ef03c"},"/docs/0.2.0/basics/cargo-odra-0cf":{"__comp":"17896441","content":"ce999a4e"},"/docs/0.2.0/basics/communicating-with-host-76d":{"__comp":"17896441","content":"274ccf11"},"/docs/0.2.0/basics/cross-calls-9e3":{"__comp":"17896441","content":"c5296eae"},"/docs/0.2.0/basics/directory-structure-49a":{"__comp":"17896441","content":"028141a3"},"/docs/0.2.0/basics/errors-dc2":{"__comp":"17896441","content":"5f2971ba"},"/docs/0.2.0/basics/events-d84":{"__comp":"17896441","content":"237cf9c7"},"/docs/0.2.0/basics/flipper-internals-5d3":{"__comp":"17896441","content":"da9e3acc"},"/docs/0.2.0/basics/modules-592":{"__comp":"17896441","content":"95db938c"},"/docs/0.2.0/basics/native-token-8f7":{"__comp":"17896441","content":"8f162cb9"},"/docs/0.2.0/basics/odra-toml-b95":{"__comp":"17896441","content":"11e5b730"},"/docs/0.2.0/basics/storage-interaction-5ec":{"__comp":"17896441","content":"d0c01b74"},"/docs/0.2.0/basics/testing-101":{"__comp":"17896441","content":"28efbf3f"},"/docs/0.2.0/category/backends-f65":{"__comp":"14eb3368","categoryGeneratedIndex":"181ab02d"},"/docs/0.2.0/category/basics-3e9":{"__comp":"14eb3368","categoryGeneratedIndex":"5be2abc9"},"/docs/0.2.0/category/examples-539":{"__comp":"14eb3368","categoryGeneratedIndex":"cad7ddc9"},"/docs/0.2.0/category/getting-started-d19":{"__comp":"14eb3368","categoryGeneratedIndex":"ea145f46"},"/docs/0.2.0/category/tutorials-05e":{"__comp":"14eb3368","categoryGeneratedIndex":"8e991cde"},"/docs/0.2.0/examples/odra-examples-640":{"__comp":"17896441","content":"9e73c0bb"},"/docs/0.2.0/examples/using-odra-modules-765":{"__comp":"17896441","content":"d7637d81"},"/docs/0.2.0/getting-started/flipper-5ff":{"__comp":"17896441","content":"7df6186d"},"/docs/0.2.0/getting-started/installation-c82":{"__comp":"17896441","content":"1b34e22f"},"/docs/0.2.0/tutorials/erc20-05b":{"__comp":"17896441","content":"1f63a7a5"},"/docs/0.2.0/tutorials/ownable-d53":{"__comp":"17896441","content":"cbdaac1b"},"/docs/0.2.0/tutorials/owned-token-79e":{"__comp":"17896441","content":"70d9d1e8"},"/docs/0.3.0-10f":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"5f012ce0"},"/docs/0.3.0/-959":{"__comp":"17896441","content":"bee0af8b"},"/docs/0.3.0/advanced/advanced-storage-141":{"__comp":"17896441","content":"7414f7c1"},"/docs/0.3.0/advanced/attributes-2c9":{"__comp":"17896441","content":"73285975"},"/docs/0.3.0/advanced/composer-226":{"__comp":"17896441","content":"b7573e33"},"/docs/0.3.0/advanced/delegate-bfb":{"__comp":"17896441","content":"74376d79"},"/docs/0.3.0/backends/casper-106":{"__comp":"17896441","content":"0ea00542"},"/docs/0.3.0/backends/mock-vm-187":{"__comp":"17896441","content":"c43892d3"},"/docs/0.3.0/backends/what-is-a-backend-37a":{"__comp":"17896441","content":"cecbc2b5"},"/docs/0.3.0/basics/cargo-odra-c76":{"__comp":"17896441","content":"2bf460c7"},"/docs/0.3.0/basics/communicating-with-host-049":{"__comp":"17896441","content":"509c4227"},"/docs/0.3.0/basics/cross-calls-790":{"__comp":"17896441","content":"d691a609"},"/docs/0.3.0/basics/directory-structure-5e5":{"__comp":"17896441","content":"e538a9e1"},"/docs/0.3.0/basics/errors-8ce":{"__comp":"17896441","content":"c5cef920"},"/docs/0.3.0/basics/events-fbf":{"__comp":"17896441","content":"a0d3df9d"},"/docs/0.3.0/basics/flipper-internals-c30":{"__comp":"17896441","content":"6289863c"},"/docs/0.3.0/basics/modules-c88":{"__comp":"17896441","content":"53726ad7"},"/docs/0.3.0/basics/native-token-87f":{"__comp":"17896441","content":"9ffb5fe4"},"/docs/0.3.0/basics/odra-toml-cd5":{"__comp":"17896441","content":"2b7acc9d"},"/docs/0.3.0/basics/storage-interaction-12e":{"__comp":"17896441","content":"1030000d"},"/docs/0.3.0/basics/testing-fda":{"__comp":"17896441","content":"cd591068"},"/docs/0.3.0/category/advanced-08a":{"__comp":"14eb3368","categoryGeneratedIndex":"5bcb7a16"},"/docs/0.3.0/category/backends-5e8":{"__comp":"14eb3368","categoryGeneratedIndex":"e5e64bd0"},"/docs/0.3.0/category/basics-03f":{"__comp":"14eb3368","categoryGeneratedIndex":"5bff39d6"},"/docs/0.3.0/category/examples-bf7":{"__comp":"14eb3368","categoryGeneratedIndex":"e4b2a41e"},"/docs/0.3.0/category/getting-started-20b":{"__comp":"14eb3368","categoryGeneratedIndex":"65ab6b77"},"/docs/0.3.0/category/tutorials-814":{"__comp":"14eb3368","categoryGeneratedIndex":"f0928d2f"},"/docs/0.3.0/examples/odra-examples-fa6":{"__comp":"17896441","content":"21fc20bd"},"/docs/0.3.0/examples/using-odra-modules-c03":{"__comp":"17896441","content":"6add768b"},"/docs/0.3.0/getting-started/flipper-553":{"__comp":"17896441","content":"b7d3ed64"},"/docs/0.3.0/getting-started/installation-6ad":{"__comp":"17896441","content":"04477b87"},"/docs/0.3.0/tutorials/erc20-2a7":{"__comp":"17896441","content":"5825ca57"},"/docs/0.3.0/tutorials/ownable-11c":{"__comp":"17896441","content":"55362a87"},"/docs/0.3.0/tutorials/owned-token-a68":{"__comp":"17896441","content":"fb249be3"},"/docs/0.3.1-af3":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"33762072"},"/docs/0.3.1/-0fe":{"__comp":"17896441","content":"13ab0148"},"/docs/0.3.1/advanced/advanced-storage-f06":{"__comp":"17896441","content":"208794bf"},"/docs/0.3.1/advanced/attributes-bce":{"__comp":"17896441","content":"57648d1e"},"/docs/0.3.1/advanced/composer-a52":{"__comp":"17896441","content":"24bf3011"},"/docs/0.3.1/advanced/delegate-e81":{"__comp":"17896441","content":"e31bed34"},"/docs/0.3.1/backends/casper-e0e":{"__comp":"17896441","content":"45990ab7"},"/docs/0.3.1/backends/mock-vm-039":{"__comp":"17896441","content":"9a7c9bac"},"/docs/0.3.1/backends/what-is-a-backend-8d7":{"__comp":"17896441","content":"3129ff44"},"/docs/0.3.1/basics/cargo-odra-76a":{"__comp":"17896441","content":"5c4991bb"},"/docs/0.3.1/basics/communicating-with-host-85d":{"__comp":"17896441","content":"c71fcec7"},"/docs/0.3.1/basics/cross-calls-ed1":{"__comp":"17896441","content":"3701fb97"},"/docs/0.3.1/basics/directory-structure-95e":{"__comp":"17896441","content":"c5f43526"},"/docs/0.3.1/basics/errors-699":{"__comp":"17896441","content":"815ad8c9"},"/docs/0.3.1/basics/events-0ff":{"__comp":"17896441","content":"83697071"},"/docs/0.3.1/basics/flipper-internals-8ce":{"__comp":"17896441","content":"cb085bdb"},"/docs/0.3.1/basics/modules-a5c":{"__comp":"17896441","content":"5a816386"},"/docs/0.3.1/basics/native-token-b51":{"__comp":"17896441","content":"9d95fe34"},"/docs/0.3.1/basics/odra-toml-39b":{"__comp":"17896441","content":"cca6b120"},"/docs/0.3.1/basics/storage-interaction-5cc":{"__comp":"17896441","content":"3edee900"},"/docs/0.3.1/basics/testing-d8f":{"__comp":"17896441","content":"90c053b1"},"/docs/0.3.1/category/advanced-7fc":{"__comp":"14eb3368","categoryGeneratedIndex":"67cb2d26"},"/docs/0.3.1/category/backends-521":{"__comp":"14eb3368","categoryGeneratedIndex":"1999a842"},"/docs/0.3.1/category/basics-be6":{"__comp":"14eb3368","categoryGeneratedIndex":"d9fee9da"},"/docs/0.3.1/category/examples-793":{"__comp":"14eb3368","categoryGeneratedIndex":"78452797"},"/docs/0.3.1/category/getting-started-1b7":{"__comp":"14eb3368","categoryGeneratedIndex":"037547ca"},"/docs/0.3.1/category/tutorials-55a":{"__comp":"14eb3368","categoryGeneratedIndex":"a88260b3"},"/docs/0.3.1/examples/odra-examples-9f8":{"__comp":"17896441","content":"beab0651"},"/docs/0.3.1/examples/using-odra-modules-9a9":{"__comp":"17896441","content":"74442e8e"},"/docs/0.3.1/getting-started/flipper-1e0":{"__comp":"17896441","content":"b87f41d0"},"/docs/0.3.1/getting-started/installation-999":{"__comp":"17896441","content":"733ac994"},"/docs/0.3.1/tutorials/erc20-3c7":{"__comp":"17896441","content":"a6734805"},"/docs/0.3.1/tutorials/ownable-939":{"__comp":"17896441","content":"7e706e45"},"/docs/0.3.1/tutorials/owned-token-e34":{"__comp":"17896441","content":"b241ea99"},"/docs/0.4.0-6b9":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"db82a1c0"},"/docs/0.4.0/-f26":{"__comp":"17896441","content":"b548b5e0"},"/docs/0.4.0/advanced/advanced-storage-8c8":{"__comp":"17896441","content":"1684519a"},"/docs/0.4.0/advanced/attributes-8f9":{"__comp":"17896441","content":"b94504cb"},"/docs/0.4.0/advanced/composer-37a":{"__comp":"17896441","content":"56296f23"},"/docs/0.4.0/advanced/delegate-66f":{"__comp":"17896441","content":"c24519ee"},"/docs/0.4.0/backends/casper-c05":{"__comp":"17896441","content":"b0f6aa87"},"/docs/0.4.0/backends/mock-vm-bbe":{"__comp":"17896441","content":"43e47b8e"},"/docs/0.4.0/backends/what-is-a-backend-afc":{"__comp":"17896441","content":"0be49901"},"/docs/0.4.0/basics/cargo-odra-be3":{"__comp":"17896441","content":"7acce579"},"/docs/0.4.0/basics/communicating-with-host-2c9":{"__comp":"17896441","content":"ab49860c"},"/docs/0.4.0/basics/cross-calls-cd2":{"__comp":"17896441","content":"a663e775"},"/docs/0.4.0/basics/directory-structure-fda":{"__comp":"17896441","content":"29c8e325"},"/docs/0.4.0/basics/errors-6ff":{"__comp":"17896441","content":"20f44f94"},"/docs/0.4.0/basics/events-7b1":{"__comp":"17896441","content":"f00a1e6f"},"/docs/0.4.0/basics/flipper-internals-a33":{"__comp":"17896441","content":"39d2189a"},"/docs/0.4.0/basics/modules-2a3":{"__comp":"17896441","content":"754937b2"},"/docs/0.4.0/basics/native-token-a56":{"__comp":"17896441","content":"0a8f7599"},"/docs/0.4.0/basics/odra-toml-011":{"__comp":"17896441","content":"3ac77d2e"},"/docs/0.4.0/basics/storage-interaction-a7a":{"__comp":"17896441","content":"acebe248"},"/docs/0.4.0/basics/testing-7ac":{"__comp":"17896441","content":"14355e8c"},"/docs/0.4.0/category/advanced-0be":{"__comp":"14eb3368","categoryGeneratedIndex":"5bf6529c"},"/docs/0.4.0/category/backends-7c2":{"__comp":"14eb3368","categoryGeneratedIndex":"ed6ae2e5"},"/docs/0.4.0/category/basics-1ef":{"__comp":"14eb3368","categoryGeneratedIndex":"4e50b37d"},"/docs/0.4.0/category/examples-84f":{"__comp":"14eb3368","categoryGeneratedIndex":"b435d362"},"/docs/0.4.0/category/getting-started-651":{"__comp":"14eb3368","categoryGeneratedIndex":"f92986d2"},"/docs/0.4.0/category/tutorials-d6c":{"__comp":"14eb3368","categoryGeneratedIndex":"5f13c361"},"/docs/0.4.0/examples/odra-examples-48a":{"__comp":"17896441","content":"5c77c5fd"},"/docs/0.4.0/examples/using-odra-modules-174":{"__comp":"17896441","content":"90f06335"},"/docs/0.4.0/getting-started/flipper-c72":{"__comp":"17896441","content":"448060b1"},"/docs/0.4.0/getting-started/installation-ed5":{"__comp":"17896441","content":"fdb5f68c"},"/docs/0.4.0/tutorials/erc20-f49":{"__comp":"17896441","content":"8988b866"},"/docs/0.4.0/tutorials/ownable-0ce":{"__comp":"17896441","content":"51bf83ad"},"/docs/0.4.0/tutorials/owned-token-d8c":{"__comp":"17896441","content":"496b44fb"},"/docs/0.5.0-ed6":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"0030fd86"},"/docs/0.5.0/-96f":{"__comp":"17896441","content":"4279e616"},"/docs/0.5.0/advanced/advanced-storage-656":{"__comp":"17896441","content":"9cc9201d"},"/docs/0.5.0/advanced/attributes-f61":{"__comp":"17896441","content":"b338949b"},"/docs/0.5.0/advanced/delegate-0f8":{"__comp":"17896441","content":"728e71a1"},"/docs/0.5.0/advanced/signatures-96c":{"__comp":"17896441","content":"558ac3fc"},"/docs/0.5.0/advanced/using-93b":{"__comp":"17896441","content":"13066500"},"/docs/0.5.0/backends/casper-372":{"__comp":"17896441","content":"f54718af"},"/docs/0.5.0/backends/mock-vm-96e":{"__comp":"17896441","content":"8b0ca31f"},"/docs/0.5.0/backends/what-is-a-backend-a98":{"__comp":"17896441","content":"ad92572d"},"/docs/0.5.0/basics/cargo-odra-d15":{"__comp":"17896441","content":"aaadf060"},"/docs/0.5.0/basics/communicating-with-host-545":{"__comp":"17896441","content":"b2f44958"},"/docs/0.5.0/basics/cross-calls-d66":{"__comp":"17896441","content":"60dd6115"},"/docs/0.5.0/basics/directory-structure-161":{"__comp":"17896441","content":"632b087e"},"/docs/0.5.0/basics/errors-393":{"__comp":"17896441","content":"3721b008"},"/docs/0.5.0/basics/events-056":{"__comp":"17896441","content":"4f40819b"},"/docs/0.5.0/basics/flipper-internals-93e":{"__comp":"17896441","content":"ab4716a0"},"/docs/0.5.0/basics/modules-eae":{"__comp":"17896441","content":"94723368"},"/docs/0.5.0/basics/native-token-186":{"__comp":"17896441","content":"c13d152b"},"/docs/0.5.0/basics/odra-toml-1c3":{"__comp":"17896441","content":"42fe661b"},"/docs/0.5.0/basics/storage-interaction-14c":{"__comp":"17896441","content":"3bb5653d"},"/docs/0.5.0/basics/testing-3e5":{"__comp":"17896441","content":"02192c58"},"/docs/0.5.0/category/advanced-d06":{"__comp":"14eb3368","categoryGeneratedIndex":"918e870d"},"/docs/0.5.0/category/backends-c3c":{"__comp":"14eb3368","categoryGeneratedIndex":"67a34253"},"/docs/0.5.0/category/basics-8c1":{"__comp":"14eb3368","categoryGeneratedIndex":"2131dc9d"},"/docs/0.5.0/category/examples-170":{"__comp":"14eb3368","categoryGeneratedIndex":"32993410"},"/docs/0.5.0/category/getting-started-4a6":{"__comp":"14eb3368","categoryGeneratedIndex":"1524a02c"},"/docs/0.5.0/category/tutorials-44a":{"__comp":"14eb3368","categoryGeneratedIndex":"6f7f3f28"},"/docs/0.5.0/examples/odra-examples-398":{"__comp":"17896441","content":"919c36c8"},"/docs/0.5.0/examples/using-odra-modules-2bf":{"__comp":"17896441","content":"705c2b64"},"/docs/0.5.0/getting-started/flipper-a09":{"__comp":"17896441","content":"fe2b6021"},"/docs/0.5.0/getting-started/installation-6a7":{"__comp":"17896441","content":"bfc8213d"},"/docs/0.5.0/tutorials/erc20-277":{"__comp":"17896441","content":"2c824dec"},"/docs/0.5.0/tutorials/ownable-681":{"__comp":"17896441","content":"68495fce"},"/docs/0.5.0/tutorials/owned-token-217":{"__comp":"17896441","content":"02a3f783"},"/docs/0.6.0-07e":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"58f10d9f"},"/docs/0.6.0/-6cb":{"__comp":"17896441","content":"54dbc4b0"},"/docs/0.6.0/advanced/advanced-storage-e45":{"__comp":"17896441","content":"95f5ef42"},"/docs/0.6.0/advanced/attributes-30c":{"__comp":"17896441","content":"68deafd0"},"/docs/0.6.0/advanced/delegate-9cd":{"__comp":"17896441","content":"b4f02106"},"/docs/0.6.0/advanced/signatures-ade":{"__comp":"17896441","content":"26441f8e"},"/docs/0.6.0/advanced/using-623":{"__comp":"17896441","content":"ed898d19"},"/docs/0.6.0/backends/casper-ffb":{"__comp":"17896441","content":"5ad2f7ef"},"/docs/0.6.0/backends/mock-vm-936":{"__comp":"17896441","content":"473b33d6"},"/docs/0.6.0/backends/what-is-a-backend-cad":{"__comp":"17896441","content":"b2e57a16"},"/docs/0.6.0/basics/cargo-odra-6a0":{"__comp":"17896441","content":"da555cce"},"/docs/0.6.0/basics/communicating-with-host-704":{"__comp":"17896441","content":"5ca766f6"},"/docs/0.6.0/basics/cross-calls-4a3":{"__comp":"17896441","content":"41445f6c"},"/docs/0.6.0/basics/directory-structure-adb":{"__comp":"17896441","content":"af2a4ce0"},"/docs/0.6.0/basics/errors-5af":{"__comp":"17896441","content":"c52d4d42"},"/docs/0.6.0/basics/events-77a":{"__comp":"17896441","content":"b6aaec29"},"/docs/0.6.0/basics/flipper-internals-b3c":{"__comp":"17896441","content":"a046a162"},"/docs/0.6.0/basics/modules-e0c":{"__comp":"17896441","content":"9d620965"},"/docs/0.6.0/basics/native-token-089":{"__comp":"17896441","content":"befd1fba"},"/docs/0.6.0/basics/odra-toml-142":{"__comp":"17896441","content":"01e5113f"},"/docs/0.6.0/basics/storage-interaction-568":{"__comp":"17896441","content":"67d74c2d"},"/docs/0.6.0/basics/testing-4f2":{"__comp":"17896441","content":"c705646d"},"/docs/0.6.0/category/advanced-b04":{"__comp":"14eb3368","categoryGeneratedIndex":"c6385d27"},"/docs/0.6.0/category/backends-567":{"__comp":"14eb3368","categoryGeneratedIndex":"d386dd06"},"/docs/0.6.0/category/basics-7b9":{"__comp":"14eb3368","categoryGeneratedIndex":"be0b2ac1"},"/docs/0.6.0/category/examples-933":{"__comp":"14eb3368","categoryGeneratedIndex":"f146bc3c"},"/docs/0.6.0/category/getting-started-d6e":{"__comp":"14eb3368","categoryGeneratedIndex":"c52764ec"},"/docs/0.6.0/category/tutorials-565":{"__comp":"14eb3368","categoryGeneratedIndex":"ff3976bd"},"/docs/0.6.0/examples/odra-examples-297":{"__comp":"17896441","content":"eedc1cb5"},"/docs/0.6.0/examples/using-odra-modules-b91":{"__comp":"17896441","content":"71958ad0"},"/docs/0.6.0/getting-started/flipper-41a":{"__comp":"17896441","content":"367de8e8"},"/docs/0.6.0/getting-started/installation-f64":{"__comp":"17896441","content":"e8a3ffa2"},"/docs/0.6.0/tutorials/erc20-9af":{"__comp":"17896441","content":"9005cef3"},"/docs/0.6.0/tutorials/ownable-f5c":{"__comp":"17896441","content":"4da81bc4"},"/docs/0.6.0/tutorials/owned-token-900":{"__comp":"17896441","content":"3f00e816"},"/docs/0.7.0-bd2":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"2fe15297"},"/docs/0.7.0/-753":{"__comp":"17896441","content":"119fbfb6"},"/docs/0.7.0/advanced/advanced-storage-39b":{"__comp":"17896441","content":"575b7125"},"/docs/0.7.0/advanced/attributes-5a8":{"__comp":"17896441","content":"bab04a93"},"/docs/0.7.0/advanced/delegate-1ae":{"__comp":"17896441","content":"88b75f2c"},"/docs/0.7.0/advanced/signatures-042":{"__comp":"17896441","content":"6617ee69"},"/docs/0.7.0/advanced/using-a15":{"__comp":"17896441","content":"0bf9d8ab"},"/docs/0.7.0/backends/casper-967":{"__comp":"17896441","content":"33e7c3de"},"/docs/0.7.0/backends/mock-vm-2e1":{"__comp":"17896441","content":"fec7bf31"},"/docs/0.7.0/backends/what-is-a-backend-0a9":{"__comp":"17896441","content":"800dfaa2"},"/docs/0.7.0/basics/cargo-odra-953":{"__comp":"17896441","content":"afc3a23f"},"/docs/0.7.0/basics/communicating-with-host-a8b":{"__comp":"17896441","content":"e294fa30"},"/docs/0.7.0/basics/cross-calls-4f0":{"__comp":"17896441","content":"7f9a1b7a"},"/docs/0.7.0/basics/directory-structure-25e":{"__comp":"17896441","content":"cf3f256a"},"/docs/0.7.0/basics/errors-787":{"__comp":"17896441","content":"09109da1"},"/docs/0.7.0/basics/events-151":{"__comp":"17896441","content":"716fdc54"},"/docs/0.7.0/basics/flipper-internals-5ab":{"__comp":"17896441","content":"6e5ab397"},"/docs/0.7.0/basics/modules-21a":{"__comp":"17896441","content":"42eeae87"},"/docs/0.7.0/basics/native-token-10a":{"__comp":"17896441","content":"ff33c5f7"},"/docs/0.7.0/basics/odra-toml-c05":{"__comp":"17896441","content":"ee3d80a6"},"/docs/0.7.0/basics/storage-interaction-617":{"__comp":"17896441","content":"91b04621"},"/docs/0.7.0/basics/testing-0fd":{"__comp":"17896441","content":"3eed3f1a"},"/docs/0.7.0/category/advanced-277":{"__comp":"14eb3368","categoryGeneratedIndex":"6428a729"},"/docs/0.7.0/category/backends-86f":{"__comp":"14eb3368","categoryGeneratedIndex":"bc53adba"},"/docs/0.7.0/category/basics-f96":{"__comp":"14eb3368","categoryGeneratedIndex":"6171926c"},"/docs/0.7.0/category/examples-bdd":{"__comp":"14eb3368","categoryGeneratedIndex":"ea0379ae"},"/docs/0.7.0/category/getting-started-e9f":{"__comp":"14eb3368","categoryGeneratedIndex":"82287515"},"/docs/0.7.0/category/tutorials-17e":{"__comp":"14eb3368","categoryGeneratedIndex":"e2724f12"},"/docs/0.7.0/examples/odra-examples-3c9":{"__comp":"17896441","content":"893f4b86"},"/docs/0.7.0/examples/using-odra-modules-94e":{"__comp":"17896441","content":"8010fede"},"/docs/0.7.0/getting-started/flipper-06e":{"__comp":"17896441","content":"79d3180c"},"/docs/0.7.0/getting-started/installation-628":{"__comp":"17896441","content":"f1080184"},"/docs/0.7.0/tutorials/access-control-6e8":{"__comp":"17896441","content":"ce4f9116"},"/docs/0.7.0/tutorials/erc20-e2f":{"__comp":"17896441","content":"7457cffc"},"/docs/0.7.0/tutorials/ownable-d9d":{"__comp":"17896441","content":"5b4d97e3"},"/docs/0.7.0/tutorials/owned-token-17e":{"__comp":"17896441","content":"1416c8f4"},"/docs/0.7.0/tutorials/pauseable-c4a":{"__comp":"17896441","content":"03d24697"},"/docs/0.8.0-813":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"c95b781b"},"/docs/0.8.0/-0f7":{"__comp":"17896441","content":"6acba536"},"/docs/0.8.0/advanced/advanced-storage-795":{"__comp":"17896441","content":"3e0ea7e3"},"/docs/0.8.0/advanced/attributes-196":{"__comp":"17896441","content":"87854661"},"/docs/0.8.0/advanced/delegate-2eb":{"__comp":"17896441","content":"24942c38"},"/docs/0.8.0/advanced/storage-layout-800":{"__comp":"17896441","content":"bc61aabc"},"/docs/0.8.0/backends/casper-f72":{"__comp":"17896441","content":"615fce32"},"/docs/0.8.0/backends/livenet-90a":{"__comp":"17896441","content":"881a4843"},"/docs/0.8.0/backends/odra-vm-df7":{"__comp":"17896441","content":"90c71d04"},"/docs/0.8.0/backends/what-is-a-backend-201":{"__comp":"17896441","content":"17908ca6"},"/docs/0.8.0/basics/cargo-odra-1f9":{"__comp":"17896441","content":"dfe71587"},"/docs/0.8.0/basics/communicating-with-host-c1b":{"__comp":"17896441","content":"cc61c55f"},"/docs/0.8.0/basics/cross-calls-08c":{"__comp":"17896441","content":"71994587"},"/docs/0.8.0/basics/directory-structure-9f5":{"__comp":"17896441","content":"16c5018d"},"/docs/0.8.0/basics/errors-931":{"__comp":"17896441","content":"35d161a3"},"/docs/0.8.0/basics/events-9f3":{"__comp":"17896441","content":"5ffb61b1"},"/docs/0.8.0/basics/flipper-internals-e4d":{"__comp":"17896441","content":"794d4fad"},"/docs/0.8.0/basics/modules-952":{"__comp":"17896441","content":"d25c8023"},"/docs/0.8.0/basics/native-token-068":{"__comp":"17896441","content":"b70aea30"},"/docs/0.8.0/basics/odra-toml-76e":{"__comp":"17896441","content":"f446cb0a"},"/docs/0.8.0/basics/storage-interaction-fc2":{"__comp":"17896441","content":"ca9ead02"},"/docs/0.8.0/basics/testing-45b":{"__comp":"17896441","content":"d8ed494b"},"/docs/0.8.0/category/advanced-f7a":{"__comp":"14eb3368","categoryGeneratedIndex":"a98f838e"},"/docs/0.8.0/category/backends-ef8":{"__comp":"14eb3368","categoryGeneratedIndex":"156a315c"},"/docs/0.8.0/category/basics-a8b":{"__comp":"14eb3368","categoryGeneratedIndex":"06d8044c"},"/docs/0.8.0/category/examples-353":{"__comp":"14eb3368","categoryGeneratedIndex":"bb6e6682"},"/docs/0.8.0/category/getting-started-b5b":{"__comp":"14eb3368","categoryGeneratedIndex":"dd174fa2"},"/docs/0.8.0/category/migrations-45a":{"__comp":"14eb3368","categoryGeneratedIndex":"acbba37b"},"/docs/0.8.0/category/tutorials-30b":{"__comp":"14eb3368","categoryGeneratedIndex":"4d5b435f"},"/docs/0.8.0/examples/odra-examples-4de":{"__comp":"17896441","content":"70c316d8"},"/docs/0.8.0/examples/using-odra-modules-b4d":{"__comp":"17896441","content":"77193147"},"/docs/0.8.0/getting-started/flipper-d0e":{"__comp":"17896441","content":"5fd0213e"},"/docs/0.8.0/getting-started/installation-58d":{"__comp":"17896441","content":"c8e7910f"},"/docs/0.8.0/migrations/to-0.8.0-0e2":{"__comp":"17896441","content":"8a2be6b7"},"/docs/0.8.0/tutorials/access-control-2a5":{"__comp":"17896441","content":"e4e3cd82"},"/docs/0.8.0/tutorials/build-deploy-read-22e":{"__comp":"17896441","content":"5c7e9aff"},"/docs/0.8.0/tutorials/erc20-df9":{"__comp":"17896441","content":"192dc956"},"/docs/0.8.0/tutorials/ownable-27d":{"__comp":"17896441","content":"6d494689"},"/docs/0.8.0/tutorials/owned-token-df9":{"__comp":"17896441","content":"0cc148ac"},"/docs/0.8.0/tutorials/pauseable-410":{"__comp":"17896441","content":"88506cf5"},"/docs/0.8.1-2ae":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"bc77ce48"},"/docs/0.8.1/-4ac":{"__comp":"17896441","content":"87661fc3"},"/docs/0.8.1/advanced/advanced-storage-85a":{"__comp":"17896441","content":"88434b46"},"/docs/0.8.1/advanced/attributes-481":{"__comp":"17896441","content":"f63d58d7"},"/docs/0.8.1/advanced/building-manually-8ad":{"__comp":"17896441","content":"031cd168"},"/docs/0.8.1/advanced/delegate-1e0":{"__comp":"17896441","content":"61047f5a"},"/docs/0.8.1/advanced/storage-layout-d7d":{"__comp":"17896441","content":"7cf5f48a"},"/docs/0.8.1/advanced/using-different-allocator-c91":{"__comp":"17896441","content":"75ab3d8c"},"/docs/0.8.1/backends/casper-3bb":{"__comp":"17896441","content":"175a5a59"},"/docs/0.8.1/backends/livenet-ec6":{"__comp":"17896441","content":"b2c1dfd0"},"/docs/0.8.1/backends/odra-vm-b57":{"__comp":"17896441","content":"97237b2f"},"/docs/0.8.1/backends/what-is-a-backend-ef2":{"__comp":"17896441","content":"9f0f335a"},"/docs/0.8.1/basics/cargo-odra-5c3":{"__comp":"17896441","content":"ddaed26d"},"/docs/0.8.1/basics/communicating-with-host-171":{"__comp":"17896441","content":"4e69c95d"},"/docs/0.8.1/basics/cross-calls-cfe":{"__comp":"17896441","content":"4760a525"},"/docs/0.8.1/basics/directory-structure-d78":{"__comp":"17896441","content":"0b779dad"},"/docs/0.8.1/basics/errors-274":{"__comp":"17896441","content":"3849c38e"},"/docs/0.8.1/basics/events-fba":{"__comp":"17896441","content":"94fadafc"},"/docs/0.8.1/basics/flipper-internals-f00":{"__comp":"17896441","content":"e7a2e79a"},"/docs/0.8.1/basics/modules-26b":{"__comp":"17896441","content":"481896f1"},"/docs/0.8.1/basics/native-token-797":{"__comp":"17896441","content":"fefb7f4a"},"/docs/0.8.1/basics/odra-toml-1e7":{"__comp":"17896441","content":"9e3cc906"},"/docs/0.8.1/basics/storage-interaction-7d6":{"__comp":"17896441","content":"1d854f2b"},"/docs/0.8.1/basics/testing-4d7":{"__comp":"17896441","content":"695d43df"},"/docs/0.8.1/category/advanced-7e6":{"__comp":"14eb3368","categoryGeneratedIndex":"03f3dff9"},"/docs/0.8.1/category/backends-2b5":{"__comp":"14eb3368","categoryGeneratedIndex":"636decee"},"/docs/0.8.1/category/basics-3be":{"__comp":"14eb3368","categoryGeneratedIndex":"1be56b3c"},"/docs/0.8.1/category/examples-dca":{"__comp":"14eb3368","categoryGeneratedIndex":"9f6fd0ea"},"/docs/0.8.1/category/getting-started-dd6":{"__comp":"14eb3368","categoryGeneratedIndex":"a809f3b7"},"/docs/0.8.1/category/migrations-e93":{"__comp":"14eb3368","categoryGeneratedIndex":"16691bef"},"/docs/0.8.1/category/tutorials-56d":{"__comp":"14eb3368","categoryGeneratedIndex":"eae8630e"},"/docs/0.8.1/examples/odra-examples-099":{"__comp":"17896441","content":"5905dfac"},"/docs/0.8.1/examples/using-odra-modules-f30":{"__comp":"17896441","content":"9390dd74"},"/docs/0.8.1/getting-started/flipper-449":{"__comp":"17896441","content":"626c8e99"},"/docs/0.8.1/getting-started/installation-0e3":{"__comp":"17896441","content":"a892851d"},"/docs/0.8.1/migrations/to-0.8.0-fb6":{"__comp":"17896441","content":"9c04347b"},"/docs/0.8.1/tutorials/access-control-fa5":{"__comp":"17896441","content":"641fd09d"},"/docs/0.8.1/tutorials/build-deploy-read-b1d":{"__comp":"17896441","content":"4dd99f24"},"/docs/0.8.1/tutorials/erc20-282":{"__comp":"17896441","content":"9dc5d51e"},"/docs/0.8.1/tutorials/ownable-e3d":{"__comp":"17896441","content":"145548d1"},"/docs/0.8.1/tutorials/owned-token-a42":{"__comp":"17896441","content":"dc0bb66d"},"/docs/0.8.1/tutorials/pauseable-bb1":{"__comp":"17896441","content":"3b67cac2"},"/docs/0.9.0-bab":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"9a6d52da"},"/docs/0.9.0/-837":{"__comp":"17896441","content":"3879932b"},"/docs/0.9.0/advanced/advanced-storage-694":{"__comp":"17896441","content":"ce9c8ec6"},"/docs/0.9.0/advanced/attributes-8be":{"__comp":"17896441","content":"d2eb1abd"},"/docs/0.9.0/advanced/building-manually-ebe":{"__comp":"17896441","content":"74ec7413"},"/docs/0.9.0/advanced/delegate-b68":{"__comp":"17896441","content":"1d7f9163"},"/docs/0.9.0/advanced/storage-layout-d3a":{"__comp":"17896441","content":"748fd4ff"},"/docs/0.9.0/advanced/using-different-allocator-5bf":{"__comp":"17896441","content":"7933b4e2"},"/docs/0.9.0/backends/casper-324":{"__comp":"17896441","content":"6b1ad888"},"/docs/0.9.0/backends/livenet-86e":{"__comp":"17896441","content":"372918e4"},"/docs/0.9.0/backends/odra-vm-063":{"__comp":"17896441","content":"4a017cdd"},"/docs/0.9.0/backends/what-is-a-backend-f05":{"__comp":"17896441","content":"31959af2"},"/docs/0.9.0/basics/cargo-odra-8f2":{"__comp":"17896441","content":"ef626e06"},"/docs/0.9.0/basics/casper-contract-schema-e38":{"__comp":"17896441","content":"dcb2dd04"},"/docs/0.9.0/basics/communicating-with-host-a21":{"__comp":"17896441","content":"1dd27823"},"/docs/0.9.0/basics/cross-calls-064":{"__comp":"17896441","content":"786408bf"},"/docs/0.9.0/basics/directory-structure-bd7":{"__comp":"17896441","content":"fabdfba1"},"/docs/0.9.0/basics/errors-667":{"__comp":"17896441","content":"54d8e0e1"},"/docs/0.9.0/basics/events-15a":{"__comp":"17896441","content":"3e885f31"},"/docs/0.9.0/basics/flipper-internals-49f":{"__comp":"17896441","content":"bcf5f050"},"/docs/0.9.0/basics/modules-40c":{"__comp":"17896441","content":"4c38ccb3"},"/docs/0.9.0/basics/native-token-e8c":{"__comp":"17896441","content":"3ce92bbb"},"/docs/0.9.0/basics/odra-toml-b36":{"__comp":"17896441","content":"95045a66"},"/docs/0.9.0/basics/storage-interaction-3c6":{"__comp":"17896441","content":"31372b4d"},"/docs/0.9.0/basics/testing-fb7":{"__comp":"17896441","content":"3e663e98"},"/docs/0.9.0/category/advanced-0bf":{"__comp":"14eb3368","categoryGeneratedIndex":"defc5a9a"},"/docs/0.9.0/category/backends-5fc":{"__comp":"14eb3368","categoryGeneratedIndex":"42407bf6"},"/docs/0.9.0/category/basics-755":{"__comp":"14eb3368","categoryGeneratedIndex":"969eb6fb"},"/docs/0.9.0/category/examples-3b9":{"__comp":"14eb3368","categoryGeneratedIndex":"909eb646"},"/docs/0.9.0/category/getting-started-ea3":{"__comp":"14eb3368","categoryGeneratedIndex":"e8902c41"},"/docs/0.9.0/category/migrations-84b":{"__comp":"14eb3368","categoryGeneratedIndex":"f6aaa6b5"},"/docs/0.9.0/category/tutorials-8fd":{"__comp":"14eb3368","categoryGeneratedIndex":"d7dfd89f"},"/docs/0.9.0/examples/odra-examples-97a":{"__comp":"17896441","content":"6a9553ca"},"/docs/0.9.0/examples/using-odra-modules-ce1":{"__comp":"17896441","content":"46ef55c5"},"/docs/0.9.0/getting-started/flipper-586":{"__comp":"17896441","content":"bc0e7bcb"},"/docs/0.9.0/getting-started/installation-a46":{"__comp":"17896441","content":"40b2cc78"},"/docs/0.9.0/migrations/to-0.8.0-087":{"__comp":"17896441","content":"6c16b7b1"},"/docs/0.9.0/migrations/to-0.9.0-0d0":{"__comp":"17896441","content":"e30c7d5f"},"/docs/0.9.0/tutorials/access-control-8fb":{"__comp":"17896441","content":"030cb818"},"/docs/0.9.0/tutorials/build-deploy-read-862":{"__comp":"17896441","content":"86598a2c"},"/docs/0.9.0/tutorials/erc20-504":{"__comp":"17896441","content":"b25a9e84"},"/docs/0.9.0/tutorials/ownable-7a6":{"__comp":"17896441","content":"377695c3"},"/docs/0.9.0/tutorials/owned-token-404":{"__comp":"17896441","content":"585204f8"},"/docs/0.9.0/tutorials/pauseable-1d2":{"__comp":"17896441","content":"a0a709a1"},"/docs/0.9.1-8f7":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"4913a3b5"},"/docs/0.9.1/-855":{"__comp":"17896441","content":"e4e8123e"},"/docs/0.9.1/advanced/advanced-storage-28f":{"__comp":"17896441","content":"120e723d"},"/docs/0.9.1/advanced/attributes-d5a":{"__comp":"17896441","content":"17e51713"},"/docs/0.9.1/advanced/building-manually-7d2":{"__comp":"17896441","content":"fed89aff"},"/docs/0.9.1/advanced/delegate-582":{"__comp":"17896441","content":"74137f62"},"/docs/0.9.1/advanced/storage-layout-365":{"__comp":"17896441","content":"76b68520"},"/docs/0.9.1/advanced/using-different-allocator-76c":{"__comp":"17896441","content":"7546c635"},"/docs/0.9.1/backends/casper-78e":{"__comp":"17896441","content":"0d02cb66"},"/docs/0.9.1/backends/livenet-45c":{"__comp":"17896441","content":"3593900a"},"/docs/0.9.1/backends/odra-vm-a2f":{"__comp":"17896441","content":"3cbbe945"},"/docs/0.9.1/backends/what-is-a-backend-c98":{"__comp":"17896441","content":"0413f781"},"/docs/0.9.1/basics/cargo-odra-83f":{"__comp":"17896441","content":"86253fdc"},"/docs/0.9.1/basics/casper-contract-schema-8c3":{"__comp":"17896441","content":"db36feee"},"/docs/0.9.1/basics/communicating-with-host-cfd":{"__comp":"17896441","content":"01337889"},"/docs/0.9.1/basics/cross-calls-0b2":{"__comp":"17896441","content":"1bc92503"},"/docs/0.9.1/basics/directory-structure-ae1":{"__comp":"17896441","content":"ccd6c61b"},"/docs/0.9.1/basics/errors-d39":{"__comp":"17896441","content":"fcdcfd4e"},"/docs/0.9.1/basics/events-6a4":{"__comp":"17896441","content":"b50b03ee"},"/docs/0.9.1/basics/flipper-internals-97d":{"__comp":"17896441","content":"a33e3bb6"},"/docs/0.9.1/basics/modules-63d":{"__comp":"17896441","content":"40692c03"},"/docs/0.9.1/basics/native-token-30a":{"__comp":"17896441","content":"f139e68c"},"/docs/0.9.1/basics/odra-toml-619":{"__comp":"17896441","content":"46da96af"},"/docs/0.9.1/basics/storage-interaction-b73":{"__comp":"17896441","content":"7cc7edf9"},"/docs/0.9.1/basics/testing-fab":{"__comp":"17896441","content":"4da873a0"},"/docs/0.9.1/category/advanced-708":{"__comp":"14eb3368","categoryGeneratedIndex":"32e511f4"},"/docs/0.9.1/category/backends-82e":{"__comp":"14eb3368","categoryGeneratedIndex":"01086ac7"},"/docs/0.9.1/category/basics-7db":{"__comp":"14eb3368","categoryGeneratedIndex":"0d4fe067"},"/docs/0.9.1/category/examples-a93":{"__comp":"14eb3368","categoryGeneratedIndex":"80b62ebf"},"/docs/0.9.1/category/getting-started-c74":{"__comp":"14eb3368","categoryGeneratedIndex":"252d6971"},"/docs/0.9.1/category/migrations-bc5":{"__comp":"14eb3368","categoryGeneratedIndex":"73b9c18c"},"/docs/0.9.1/category/tutorials-cc1":{"__comp":"14eb3368","categoryGeneratedIndex":"e47e02bd"},"/docs/0.9.1/examples/odra-examples-b3e":{"__comp":"17896441","content":"8837ae20"},"/docs/0.9.1/examples/using-odra-modules-3ad":{"__comp":"17896441","content":"5326f0ca"},"/docs/0.9.1/getting-started/flipper-d9c":{"__comp":"17896441","content":"e309b9ad"},"/docs/0.9.1/getting-started/installation-05d":{"__comp":"17896441","content":"2033cf69"},"/docs/0.9.1/migrations/to-0.8.0-e9a":{"__comp":"17896441","content":"d90ea429"},"/docs/0.9.1/migrations/to-0.9.0-704":{"__comp":"17896441","content":"116347ba"},"/docs/0.9.1/tutorials/access-control-06d":{"__comp":"17896441","content":"9e93cf3e"},"/docs/0.9.1/tutorials/build-deploy-read-6bf":{"__comp":"17896441","content":"f8f99b0e"},"/docs/0.9.1/tutorials/erc20-881":{"__comp":"17896441","content":"cfdaa3fd"},"/docs/0.9.1/tutorials/ownable-be2":{"__comp":"17896441","content":"0093993c"},"/docs/0.9.1/tutorials/owned-token-cf0":{"__comp":"17896441","content":"9aad49c5"},"/docs/0.9.1/tutorials/pauseable-30e":{"__comp":"17896441","content":"443d45d4"},"/docs/0.9.1/tutorials/using-proxy-caller-537":{"__comp":"17896441","content":"03ddc63e"},"/docs/next-0ec":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"935f2afb"},"/docs/next/-a05":{"__comp":"17896441","content":"0e384e19"},"/docs/next/advanced/advanced-storage-bb5":{"__comp":"17896441","content":"615e12e7"},"/docs/next/advanced/attributes-372":{"__comp":"17896441","content":"bac2ca12"},"/docs/next/advanced/building-manually-232":{"__comp":"17896441","content":"7c29795c"},"/docs/next/advanced/delegate-b46":{"__comp":"17896441","content":"383c9ad7"},"/docs/next/advanced/storage-layout-152":{"__comp":"17896441","content":"5aa50e24"},"/docs/next/advanced/using-different-allocator-a0d":{"__comp":"17896441","content":"c1bc45da"},"/docs/next/backends/casper-823":{"__comp":"17896441","content":"06a0fa51"},"/docs/next/backends/livenet-2f8":{"__comp":"17896441","content":"6640477e"},"/docs/next/backends/odra-vm-a9b":{"__comp":"17896441","content":"aee91c2e"},"/docs/next/backends/what-is-a-backend-c4c":{"__comp":"17896441","content":"6e2102f2"},"/docs/next/basics/cargo-odra-5d3":{"__comp":"17896441","content":"0abf45c2"},"/docs/next/basics/casper-contract-schema-683":{"__comp":"17896441","content":"80b82873"},"/docs/next/basics/communicating-with-host-8bf":{"__comp":"17896441","content":"fa4e959a"},"/docs/next/basics/cross-calls-f0e":{"__comp":"17896441","content":"34731735"},"/docs/next/basics/directory-structure-cf2":{"__comp":"17896441","content":"3cb0761e"},"/docs/next/basics/errors-b56":{"__comp":"17896441","content":"d5e3179c"},"/docs/next/basics/events-d09":{"__comp":"17896441","content":"ca76cddc"},"/docs/next/basics/flipper-internals-136":{"__comp":"17896441","content":"48d43fc1"},"/docs/next/basics/modules-d67":{"__comp":"17896441","content":"cde2d623"},"/docs/next/basics/native-token-a1b":{"__comp":"17896441","content":"c1418166"},"/docs/next/basics/odra-toml-efe":{"__comp":"17896441","content":"60d35280"},"/docs/next/basics/storage-interaction-ca7":{"__comp":"17896441","content":"79253424"},"/docs/next/basics/testing-95b":{"__comp":"17896441","content":"ba36c747"},"/docs/next/category/advanced-655":{"__comp":"14eb3368","categoryGeneratedIndex":"a3d6ef01"},"/docs/next/category/backends-b10":{"__comp":"14eb3368","categoryGeneratedIndex":"ac692f92"},"/docs/next/category/basics-48a":{"__comp":"14eb3368","categoryGeneratedIndex":"0a44181e"},"/docs/next/category/examples-caa":{"__comp":"14eb3368","categoryGeneratedIndex":"79b67993"},"/docs/next/category/getting-started-345":{"__comp":"14eb3368","categoryGeneratedIndex":"c3fd70b6"},"/docs/next/category/migrations-fa2":{"__comp":"14eb3368","categoryGeneratedIndex":"17498f44"},"/docs/next/category/tutorials-fad":{"__comp":"14eb3368","categoryGeneratedIndex":"e018be55"},"/docs/next/examples/odra-examples-3a4":{"__comp":"17896441","content":"659ab8cb"},"/docs/next/examples/using-odra-modules-a73":{"__comp":"17896441","content":"69fd3230"},"/docs/next/getting-started/flipper-9d2":{"__comp":"17896441","content":"e9ea549b"},"/docs/next/getting-started/installation-89e":{"__comp":"17896441","content":"54f44165"},"/docs/next/migrations/to-0.8.0-118":{"__comp":"17896441","content":"57bc1a35"},"/docs/next/migrations/to-0.9.0-311":{"__comp":"17896441","content":"bc9af134"},"/docs/next/tutorials/access-control-182":{"__comp":"17896441","content":"bfc20097"},"/docs/next/tutorials/build-deploy-read-886":{"__comp":"17896441","content":"0c77f976"},"/docs/next/tutorials/cep18-3bb":{"__comp":"17896441","content":"6be2997d"},"/docs/next/tutorials/deploying-on-casper-17d":{"__comp":"17896441","content":"93381d6e"},"/docs/next/tutorials/erc20-0c8":{"__comp":"17896441","content":"64fba0bc"},"/docs/next/tutorials/nft-1f8":{"__comp":"17896441","content":"c40f324a"},"/docs/next/tutorials/odra-solidity-761":{"__comp":"17896441","content":"386627d1"},"/docs/next/tutorials/ownable-aac":{"__comp":"17896441","content":"e2022d8c"},"/docs/next/tutorials/owned-token-6be":{"__comp":"17896441","content":"67cf10af"},"/docs/next/tutorials/pauseable-6ca":{"__comp":"17896441","content":"df1503d8"},"/docs/next/tutorials/using-proxy-caller-472":{"__comp":"17896441","content":"120e9383"},"/docs-63d":{"__comp":"1be78505","__context":{"plugin":"0993954b"},"versionMetadata":"62e81aa6"},"/docs/-264":{"__comp":"17896441","content":"5d94dea0"},"/docs/advanced/advanced-storage-0bf":{"__comp":"17896441","content":"f781f173"},"/docs/advanced/attributes-7f6":{"__comp":"17896441","content":"1b36f1ff"},"/docs/advanced/building-manually-fdc":{"__comp":"17896441","content":"e78a982b"},"/docs/advanced/delegate-420":{"__comp":"17896441","content":"657d5854"},"/docs/advanced/storage-layout-5a3":{"__comp":"17896441","content":"db95cb73"},"/docs/advanced/using-different-allocator-999":{"__comp":"17896441","content":"112c15b6"},"/docs/backends/casper-5cf":{"__comp":"17896441","content":"de67a916"},"/docs/backends/livenet-3bf":{"__comp":"17896441","content":"f91f9bef"},"/docs/backends/odra-vm-b63":{"__comp":"17896441","content":"4ba42032"},"/docs/backends/what-is-a-backend-3f8":{"__comp":"17896441","content":"fcdd79ea"},"/docs/basics/cargo-odra-800":{"__comp":"17896441","content":"b6d3d7c8"},"/docs/basics/casper-contract-schema-d22":{"__comp":"17896441","content":"07fff18d"},"/docs/basics/communicating-with-host-0b1":{"__comp":"17896441","content":"452b335c"},"/docs/basics/cross-calls-f38":{"__comp":"17896441","content":"04d6639f"},"/docs/basics/directory-structure-5c2":{"__comp":"17896441","content":"e745da21"},"/docs/basics/errors-b77":{"__comp":"17896441","content":"e74fcb0e"},"/docs/basics/events-cc6":{"__comp":"17896441","content":"125a74bf"},"/docs/basics/flipper-internals-a88":{"__comp":"17896441","content":"71b12fda"},"/docs/basics/modules-688":{"__comp":"17896441","content":"3ec01721"},"/docs/basics/native-token-f42":{"__comp":"17896441","content":"d32d6987"},"/docs/basics/odra-toml-a62":{"__comp":"17896441","content":"2937371c"},"/docs/basics/storage-interaction-f52":{"__comp":"17896441","content":"5c8f3a1c"},"/docs/basics/testing-222":{"__comp":"17896441","content":"86127e86"},"/docs/category/advanced-7b4":{"__comp":"14eb3368","categoryGeneratedIndex":"f5bf02f1"},"/docs/category/backends-744":{"__comp":"14eb3368","categoryGeneratedIndex":"c10f3592"},"/docs/category/basics-dd3":{"__comp":"14eb3368","categoryGeneratedIndex":"58abd590"},"/docs/category/examples-fe3":{"__comp":"14eb3368","categoryGeneratedIndex":"4a070847"},"/docs/category/getting-started-01f":{"__comp":"14eb3368","categoryGeneratedIndex":"3152febb"},"/docs/category/migrations-86a":{"__comp":"14eb3368","categoryGeneratedIndex":"6d263cfa"},"/docs/category/tutorials-f40":{"__comp":"14eb3368","categoryGeneratedIndex":"4cd738bd"},"/docs/examples/odra-examples-08c":{"__comp":"17896441","content":"26ab3a9c"},"/docs/examples/using-odra-modules-5ca":{"__comp":"17896441","content":"8509f041"},"/docs/getting-started/flipper-90e":{"__comp":"17896441","content":"874ec8b8"},"/docs/getting-started/installation-96c":{"__comp":"17896441","content":"cdca8af0"},"/docs/migrations/to-0.8.0-170":{"__comp":"17896441","content":"1e877671"},"/docs/migrations/to-0.9.0-b45":{"__comp":"17896441","content":"7c233f44"},"/docs/tutorials/access-control-b88":{"__comp":"17896441","content":"a7794a1d"},"/docs/tutorials/build-deploy-read-72d":{"__comp":"17896441","content":"3cdf4a35"},"/docs/tutorials/cep18-dba":{"__comp":"17896441","content":"e07dea01"},"/docs/tutorials/deploying-on-casper-acc":{"__comp":"17896441","content":"666726ac"},"/docs/tutorials/erc20-99f":{"__comp":"17896441","content":"ca19d087"},"/docs/tutorials/nft-041":{"__comp":"17896441","content":"03436d61"},"/docs/tutorials/odra-solidity-54e":{"__comp":"17896441","content":"419e5fad"},"/docs/tutorials/ownable-50d":{"__comp":"17896441","content":"f4926997"},"/docs/tutorials/owned-token-63b":{"__comp":"17896441","content":"51652154"},"/docs/tutorials/pauseable-711":{"__comp":"17896441","content":"21d4362d"},"/docs/tutorials/using-proxy-caller-a75":{"__comp":"17896441","content":"b2b12f9a"},"/-780":{"__comp":"c4f5d8e4","__context":{"plugin":"d985b3f7"},"config":"5e9f5e1a"}}')}},e=>{e.O(0,[40532],(()=>{return t=49383,e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/docs/assets/js/main.4b7de4ef.js.LICENSE.txt b/docs/assets/js/main.4b7de4ef.js.LICENSE.txt new file mode 100644 index 000000000..3cbf99441 --- /dev/null +++ b/docs/assets/js/main.4b7de4ef.js.LICENSE.txt @@ -0,0 +1,70 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress + * @license MIT */ + +/*!*************************************************** +* mark.js v8.11.1 +* https://markjs.io/ +* Copyright (c) 2014–2018, Julian Kühnel +* Released under the MIT license https://git.io/vwTVl +*****************************************************/ + +/** + * @license React + * use-sync-external-store-shim.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT <https://opensource.org/licenses/MIT> + * @author Lea Verou <https://lea.verou.me> + * @namespace + * @public + */ + +/** @license React v0.20.2 + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** @license React v17.0.2 + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** @license React v17.0.2 + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ diff --git a/docs/assets/js/runtime~main.e3ff15e2.js b/docs/assets/js/runtime~main.e3ff15e2.js new file mode 100644 index 000000000..1d9f5f9ee --- /dev/null +++ b/docs/assets/js/runtime~main.e3ff15e2.js @@ -0,0 +1 @@ +(()=>{"use strict";var e,c,f,d,b,a={},t={};function r(e){var c=t[e];if(void 0!==c)return c.exports;var f=t[e]={id:e,loaded:!1,exports:{}};return a[e].call(f.exports,f,f.exports,r),f.loaded=!0,f.exports}r.m=a,e=[],r.O=(c,f,d,b)=>{if(!f){var a=1/0;for(i=0;i<e.length;i++){f=e[i][0],d=e[i][1],b=e[i][2];for(var t=!0,o=0;o<f.length;o++)(!1&b||a>=b)&&Object.keys(r.O).every((e=>r.O[e](f[o])))?f.splice(o--,1):(t=!1,b<a&&(a=b));if(t){e.splice(i--,1);var n=d();void 0!==n&&(c=n)}}return c}b=b||0;for(var i=e.length;i>0&&e[i-1][2]>b;i--)e[i]=e[i-1];e[i]=[f,d,b]},r.n=e=>{var c=e&&e.__esModule?()=>e.default:()=>e;return r.d(c,{a:c}),c},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var b=Object.create(null);r.r(b);var a={};c=c||[null,f({}),f([]),f(f)];for(var t=2&d&&e;"object"==typeof t&&!~c.indexOf(t);t=f(t))Object.getOwnPropertyNames(t).forEach((c=>a[c]=()=>e[c]));return a.default=()=>e,r.d(b,a),b},r.d=(e,c)=>{for(var f in c)r.o(c,f)&&!r.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:c[f]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((c,f)=>(r.f[f](e,c),c)),[])),r.u=e=>"assets/js/"+({60:"4e69c95d",267:"bcf5f050",466:"116347ba",494:"db82a1c0",589:"be0b2ac1",1378:"5326f0ca",1442:"b4f02106",1459:"90f06335",1615:"145548d1",1655:"d7dfd89f",2037:"c5f43526",2536:"16691bef",2944:"5aa50e24",3037:"ff3976bd",3675:"7457cffc",3743:"a0d3df9d",3744:"cbdaac1b",3816:"8a2be6b7",4056:"e47e02bd",4266:"496b44fb",4467:"fe2b6021",4720:"bac2ca12",4781:"0c77f976",5527:"615fce32",5724:"21fc20bd",5776:"b2f44958",6156:"de67a916",6367:"3129ff44",6459:"9f0f335a",6489:"c705646d",6701:"9a7c9bac",7011:"7c233f44",7064:"6e2102f2",7196:"95045a66",7437:"c1ae59bd",7493:"ed6ae2e5",7742:"26441f8e",7978:"c1418166",8068:"7cf5f48a",8099:"181ab02d",8923:"9a7f4a11",9184:"037547ca",9370:"e2724f12",9375:"79d3180c",9558:"d985b3f7",9817:"14eb3368",9954:"6e5ab397",10079:"b759477d",10242:"ad92572d",10276:"86598a2c",11172:"208794bf",11422:"e4b2a41e",11477:"b2f554cd",11502:"120e723d",11577:"07fff18d",11777:"5c7e9aff",11830:"e7a2e79a",11839:"e31bed34",11961:"3cbbe945",11969:"119fbfb6",12493:"58f10d9f",12535:"ee3d80a6",12628:"8010fede",12862:"ce999a4e",12890:"4279e616",12921:"74137f62",12933:"ab4716a0",13030:"0d4fe067",13849:"918e870d",13968:"7df6186d",14015:"969eb6fb",14062:"d7637d81",14220:"6428a729",14593:"90c053b1",14665:"e30c7d5f",15113:"5bf6529c",15376:"3593900a",15604:"34731735",15705:"b70aea30",15753:"5bff39d6",15775:"cca6b120",15924:"e07dea01",16027:"73b9c18c",16286:"2bf460c7",16504:"dcb2dd04",16828:"db95cb73",16952:"51652154",17342:"d8ed494b",17552:"68495fce",17927:"c1bc45da",18088:"45990ab7",18118:"a05c6bda",18283:"028141a3",18355:"e309b9ad",18914:"54d8e0e1",19243:"b2e57a16",19431:"4da873a0",19588:"9aad49c5",19828:"17498f44",19856:"ea145f46",20248:"32e511f4",20348:"06a0fa51",20355:"666726ac",20523:"13ab0148",20626:"f8f99b0e",20874:"4f40819b",21389:"e8a3ffa2",21544:"fa4e959a",21887:"0030fd86",21957:"ce9c8ec6",23073:"aee91c2e",23308:"754937b2",23408:"6acba536",23633:"5f2971ba",23697:"0cc148ac",23914:"33e7c3de",24371:"69fd3230",24415:"b94504cb",24608:"86127e86",24854:"f781f173",24999:"cfdaa3fd",25085:"657d5854",25151:"3721b008",25329:"62e81aa6",25377:"61047f5a",25396:"c5296eae",25495:"e9ea549b",25558:"9ffb5fe4",25579:"c6385d27",25633:"386627d1",25662:"bee0af8b",25867:"120e9383",26077:"585204f8",26418:"f446cb0a",26831:"9c04347b",27195:"88434b46",27669:"33762072",27731:"0a44181e",27776:"a33e3bb6",27867:"cc61c55f",27918:"17896441",28511:"24942c38",28550:"70c316d8",28663:"db36feee",28700:"1416c8f4",28748:"641fd09d",28966:"c10f3592",29037:"9f6fd0ea",29108:"43e47b8e",29145:"815ad8c9",29413:"74376d79",29514:"1be78505",29634:"9d620965",29831:"3e663e98",29906:"11e5b730",30196:"9390dd74",30637:"bc9af134",30659:"ed898d19",30663:"4da81bc4",30800:"42fe661b",30819:"87854661",31201:"fcdd79ea",31215:"befd1fba",31401:"e5e64bd0",31529:"1dd27823",32103:"b338949b",32164:"82287515",32717:"3e9ef03c",32806:"237cf9c7",32947:"a6734805",33e3:"874ec8b8",33146:"a809f3b7",33158:"7acce579",33394:"57bc1a35",33468:"d691a609",33622:"d0c01b74",33659:"9e93cf3e",33860:"6171926c",33985:"ccd6c61b",34050:"473b33d6",34267:"dfe71587",34437:"16c5018d",34627:"3ac77d2e",34923:"2b7acc9d",34926:"17e51713",35114:"626c8e99",35660:"f0928d2f",35973:"9005cef3",36323:"3ce92bbb",36361:"e745da21",36452:"893f4b86",36571:"79253424",36578:"3879932b",36653:"4913a3b5",36882:"24bf3011",37057:"274ccf11",37077:"03ddc63e",37139:"1e877671",37150:"b435d362",37178:"fdb5f68c",37199:"5825ca57",37282:"0d02cb66",37591:"6f7f3f28",37625:"0abf45c2",37798:"79b67993",37904:"125a74bf",38089:"d5e3179c",38602:"1b36f1ff",38705:"e74fcb0e",39737:"5be2abc9",40152:"54f44165",40190:"d15969ed",40427:"1999a842",40588:"cdca8af0",40656:"6add768b",40906:"481896f1",40922:"112c15b6",40996:"afc3a23f",41220:"419e5fad",41258:"04d6639f",41563:"46da96af",41577:"56296f23",41783:"6be2997d",41810:"b548b5e0",41817:"8837ae20",41906:"f63d58d7",42240:"28efbf3f",42691:"67a34253",42858:"7414f7c1",42986:"71b12fda",43379:"bc77ce48",43751:"695d43df",44191:"ca76cddc",44248:"eedc1cb5",44781:"b2c1dfd0",45006:"bab04a93",45299:"80b82873",45333:"03d24697",45486:"b50b03ee",46100:"78452797",46103:"ccc49370",46145:"95db938c",46393:"acebe248",46491:"383c9ad7",46499:"632b087e",46539:"ac692f92",46671:"7d8962a6",46844:"fec7bf31",46867:"7c29795c",47287:"8e991cde",47593:"6c16b7b1",47646:"21d4362d",48221:"919c36c8",48435:"d90ea429",48733:"60d35280",49165:"f92986d2",49168:"67cf10af",50327:"77193147",50568:"3e885f31",50572:"fefb7f4a",50635:"e538a9e1",50703:"716fdc54",50723:"509c4227",51096:"4ba42032",52098:"5bcb7a16",52111:"2fe15297",52294:"f54718af",52325:"0bf9d8ab",52411:"599e53c2",52481:"ca19d087",52498:"6d263cfa",52535:"814f3328",52579:"5905dfac",52675:"31372b4d",52701:"e2022d8c",52827:"4a017cdd",52962:"bc0e7bcb",53095:"71b691b7",53227:"3f00e816",53230:"1d854f2b",53538:"0b779dad",53608:"9e4087bc",53644:"b25a9e84",53772:"13066500",53911:"31959af2",54097:"5c8f3a1c",54133:"7f9a1b7a",54301:"728e71a1",54434:"9d95fe34",54589:"0a8f7599",54733:"6289863c",54938:"3ec01721",55046:"a892851d",55399:"1524a02c",55897:"bfc20097",55914:"1f63a7a5",56010:"3edee900",56056:"04477b87",56317:"a663e775",56388:"0ea00542",56527:"367de8e8",57464:"35d161a3",57731:"f146bc3c",58050:"3849c38e",58218:"909eb646",58406:"3e0ea7e3",58552:"4c38ccb3",58727:"dd174fa2",58841:"cd790770",59132:"372918e4",59138:"c43892d3",59158:"b6d3d7c8",59309:"bfc8213d",59344:"a046a162",59543:"252d6971",59616:"55362a87",59654:"558ac3fc",59671:"0e384e19",59809:"91b04621",6e4:"fb249be3",60132:"6b1ad888",60225:"3152febb",60516:"01086ac7",60915:"377695c3",60995:"177939f6",61034:"6d494689",61109:"0be49901",61655:"b6aaec29",62007:"5c77c5fd",62081:"448060b1",62082:"4dd99f24",62191:"f139e68c",62253:"3701fb97",62432:"9e73c0bb",62540:"65ab6b77",62801:"3c817d4f",63024:"175a5a59",63050:"3cdf4a35",63336:"93514764",63376:"af2a4ce0",63395:"9cc9201d",63556:"67d74c2d",63668:"c13d152b",63898:"fabdfba1",63962:"1be56b3c",64189:"5c4991bb",64195:"c4f5d8e4",64318:"aaadf060",64709:"70d9d1e8",64733:"7546c635",64836:"02192c58",64875:"e8902c41",65010:"1bc92503",65067:"d386dd06",65185:"42407bf6",65657:"799b1c68",65666:"0413f781",65901:"cecbc2b5",65969:"01337889",66746:"74ec7413",67093:"a6f6e2b9",67530:"4d5b435f",67556:"71958ad0",67620:"beab0651",67646:"0993954b",67759:"ddaed26d",67766:"dc0bb66d",67808:"2033cf69",67897:"b7573e33",68334:"e4e3cd82",68453:"fed89aff",68459:"c3fd70b6",68492:"09109da1",68800:"3b67cac2",68887:"e4e8123e",69697:"9e3cc906",69756:"f5bf02f1",69810:"c95b781b",69986:"739a70a9",70825:"cde2d623",71588:"4e50b37d",72042:"1030000d",72522:"67cb2d26",72653:"c52764ec",72945:"5f012ce0",73044:"03f3dff9",73069:"60dd6115",73175:"cf3f256a",73201:"9dc5d51e",73362:"3eed3f1a",73538:"5ca766f6",73774:"6a9553ca",73785:"1b34e22f",73807:"06d8044c",73808:"ef626e06",73814:"5ad2f7ef",74230:"b241ea99",74234:"f91f9bef",74398:"71994587",74500:"64fba0bc",74563:"bb6e6682",74805:"94fadafc",74861:"031cd168",74997:"ba36c747",75176:"a88260b3",75510:"32993410",75894:"83697071",76153:"a3d6ef01",76262:"39d2189a",76333:"86253fdc",76391:"fcdcfd4e",76693:"14355e8c",76798:"93381d6e",76901:"ff33c5f7",76974:"c71fcec7",77042:"cad7ddc9",77552:"6640477e",77715:"acbba37b",77952:"733ac994",78212:"7cc7edf9",78322:"4cd738bd",78381:"1684519a",78584:"b0f6aa87",78743:"748fd4ff",78784:"41445f6c",79004:"90c71d04",79032:"7e706e45",79106:"26ab3a9c",79345:"71735968",79486:"5d94dea0",79812:"c40f324a",80053:"935f2afb",81079:"20f44f94",81133:"192dc956",81171:"f00a1e6f",81229:"80b62ebf",81557:"881a4843",82288:"53726ad7",82761:"74442e8e",82869:"73285975",83052:"01e5113f",83241:"bd4cf5c0",83306:"bc53adba",83400:"e78a982b",83441:"786408bf",83518:"f4926997",83633:"8509f041",84051:"636decee",84062:"4760a525",84201:"cb085bdb",84296:"95f5ef42",84916:"94723368",84928:"800dfaa2",85100:"87661fc3",85228:"da555cce",85804:"defc5a9a",85930:"98b2adcf",86116:"40692c03",86188:"88506cf5",86221:"8f162cb9",86683:"030cb818",87127:"51bf83ad",87250:"9a6d52da",87541:"c24519ee",87671:"17908ca6",87922:"659ab8cb",87945:"0093993c",87974:"5fd0213e",88071:"8b0ca31f",88181:"57648d1e",88367:"2c824dec",88590:"c5cef920",88854:"ea0379ae",88932:"443d45d4",88993:"a7794a1d",89074:"f1080184",89167:"3bb5653d",89561:"46ef55c5",89854:"75ab3d8c",90357:"4a070847",90366:"6617ee69",90437:"d25c8023",90533:"b2b675dd",90627:"1d7f9163",90827:"da9e3acc",90897:"c8e7910f",90992:"575b7125",91178:"705c2b64",91390:"5a816386",91457:"2937371c",91501:"eae8630e",91613:"bc61aabc",91802:"452b335c",91950:"ca9ead02",92331:"cd591068",92349:"b2b12f9a",93089:"a6aa9e1f",93472:"615e12e7",94023:"e294fa30",95057:"5b4d97e3",95108:"3cb0761e",95211:"ab49860c",95278:"156a315c",95310:"2131dc9d",95555:"794d4fad",95598:"8988b866",95684:"d32d6987",95866:"42eeae87",96075:"88b75f2c",96105:"c714b9ee",96611:"48d43fc1",97227:"c52d4d42",97405:"d9fee9da",97417:"03436d61",97447:"29c8e325",97457:"58abd590",97752:"b87f41d0",97779:"68deafd0",97987:"f6aaa6b5",98017:"a0a709a1",98445:"df1503d8",98632:"5ffb61b1",98651:"a98f838e",98666:"b7d3ed64",98984:"97237b2f",99122:"76b68520",99186:"54dbc4b0",99314:"e018be55",99410:"02a3f783",99604:"7933b4e2",99661:"d2eb1abd",99680:"ce4f9116",99706:"40b2cc78",99820:"5f13c361"}[e]||e)+"."+{60:"6f130810",267:"7b072a85",466:"db2b0ea7",494:"01b7c8ed",589:"c2904d19",1378:"9b6d5c53",1442:"8e03b0b8",1459:"8b8a70e1",1615:"2d24085b",1655:"40965436",2037:"355822f4",2536:"357a29b0",2944:"0d2baac1",3037:"eda77dfb",3675:"2c0275c2",3743:"4b67f1a8",3744:"75435457",3816:"cde9757a",4056:"840c6163",4266:"57bc7548",4467:"9038ba28",4720:"472bb76d",4781:"49d1f801",4972:"4e40c906",5527:"d648bf7a",5724:"3d44a9ed",5776:"256626f4",6156:"2900fd98",6367:"72d42a77",6459:"c8edc22c",6489:"96e548c5",6701:"a14c6bd6",7011:"b837d5ab",7064:"32e24cdc",7196:"99df232b",7437:"5624c97f",7493:"fcf896d2",7742:"07ba3604",7978:"9370acda",8068:"f0cb80d8",8099:"a47d9657",8923:"931eca48",9184:"36ecaa56",9370:"86ac1af1",9375:"3bc62d83",9558:"e852e117",9817:"5911e1e7",9954:"4d21bab4",10079:"7077244e",10242:"51cc1d95",10276:"31f7d9e6",11071:"136fff66",11172:"72cd6324",11422:"24c95f48",11477:"ac3dfe73",11502:"0f481bf7",11577:"20c4e66f",11777:"fb41ea76",11830:"56b362d6",11839:"6e43a6e9",11961:"33998820",11969:"bd53aeee",12366:"ba3d5d9a",12493:"ae141d4d",12535:"ffa24edf",12628:"3156057a",12862:"3e2a770e",12890:"278554fc",12921:"bda66425",12933:"2806994c",13030:"f7ed9d8b",13849:"2fe045b9",13968:"f9bca2cb",14015:"12f6d2a2",14062:"b88db64f",14220:"5d1e8c04",14593:"2c497dc2",14665:"25efb038",15113:"d41932c4",15376:"4e34e084",15604:"3ab0e6a8",15705:"a6277723",15753:"9d0d4f1d",15775:"08744a58",15924:"712046fc",16027:"22209469",16286:"170ca46e",16504:"934d3f90",16828:"9301cd2d",16952:"1dd53f3b",17342:"5f78aa6c",17552:"d141d5bc",17927:"0db54df8",18088:"bc27b658",18118:"a17716a5",18283:"0f670700",18355:"468e192c",18914:"12ac30d3",19243:"6de2dfbb",19431:"a57433e3",19588:"c4e4a256",19828:"7f7ba661",19856:"e7336e76",20248:"78ddb0b4",20348:"a0324118",20355:"41e21f2e",20523:"1e22ac78",20626:"5b69f68a",20874:"7895a349",21389:"11029ee4",21544:"b9a69e0e",21887:"5a85d5cb",21957:"dd9e5ce1",23073:"70832445",23308:"8f524e65",23408:"e5151411",23633:"56be8820",23697:"4f84770a",23914:"c7ec380c",24371:"4359bf34",24415:"72965cbe",24608:"2d2f8a5e",24854:"92dbdfd5",24999:"f7f00778",25085:"9d29b7b8",25151:"43d60be0",25329:"16ba0842",25377:"5d5f642f",25396:"e4a61dcb",25495:"f94a54d3",25558:"01bae231",25579:"f868001d",25633:"9f970544",25662:"8fea05d4",25684:"b0063456",25867:"0372d791",26077:"91f66114",26418:"13096a8d",26831:"b2e8ee61",27195:"6ea04786",27669:"6a8f15e1",27731:"f9264a07",27776:"78013d16",27867:"c5640e08",27918:"de6aaa32",28511:"c6eb3e72",28550:"760602b6",28663:"bcd96a50",28700:"c1dfbbd3",28748:"89ed3898",28966:"195aa02a",29037:"1ae6ca7a",29108:"4d3a14c0",29145:"3053e87b",29413:"b8f4f9bf",29514:"a6a0c605",29634:"1b03cdc8",29831:"6b0cdb10",29906:"56c24770",30196:"42b1f407",30637:"55bc4c62",30659:"a0166f5f",30663:"a67502da",30800:"d2261711",30819:"edba6a17",31201:"e519e17a",31215:"8e72e32e",31401:"2ff789c0",31529:"0ecd9d7e",32103:"ed59f570",32164:"5c83760d",32572:"8d89fc67",32717:"f1c84d37",32806:"da0e30cd",32947:"c4add5cd",33e3:"1685691c",33146:"357785a7",33158:"86722aa3",33394:"d17a2440",33468:"591d9f0c",33622:"6a43ad0e",33659:"28e650ad",33860:"124c5590",33985:"806c9d2e",34050:"586ce226",34267:"ab442927",34437:"6ba1e1a0",34627:"890d3613",34923:"f7a4bee4",34926:"e47787e4",35114:"79affc12",35660:"ed28131e",35973:"eab22a5a",36323:"dc5e4bfc",36361:"062bec3d",36452:"669333e9",36571:"035754eb",36578:"fed9f072",36653:"3ce4fa7d",36882:"896e175e",37057:"4e6ac37f",37077:"27dad346",37139:"1c98356b",37150:"b8ed03e8",37178:"d6ad3336",37199:"c8a72c36",37282:"aeb2473a",37591:"d907fa0c",37625:"dcd1e6ff",37798:"487f8cc3",37904:"d0f30e3e",38089:"18951c94",38602:"bdb158a2",38705:"4b825331",39737:"7b3cb4c9",40152:"222c4c99",40190:"fe295ed8",40427:"96b6056c",40588:"f22d45e4",40656:"b3f603cd",40906:"fda457f3",40922:"945bb02c",40996:"02141f3c",41220:"11f62120",41258:"fd92504b",41563:"e337d27c",41577:"be1c8e52",41783:"cc92ff66",41810:"1f669fd4",41817:"6e051c8b",41906:"28e40329",42240:"b6ef9373",42691:"4f55f823",42858:"de1f8981",42986:"7fb73702",43379:"be2d9c50",43751:"7dd8f767",44191:"dbb2125a",44248:"b76c65f8",44781:"e941435d",45006:"0a2ff427",45299:"0e48c302",45333:"06b0b929",45486:"0ecca809",46100:"61fa9cf5",46103:"570e05ea",46145:"eae77a25",46393:"7b1cfaa9",46491:"444afe3d",46499:"269d4b86",46539:"136ee2fc",46671:"3648a759",46844:"2c7f68ff",46867:"f16b488f",47287:"9d41f266",47593:"9da40895",47646:"9aa7b094",48221:"0e087792",48435:"4ebb6567",48733:"74286aaf",49165:"114c4b29",49168:"11106de3",50327:"177b697d",50568:"1bfb0a3a",50572:"6864c472",50635:"b1ac556f",50703:"08318d9e",50723:"d8458b40",51096:"7cba8fbc",52098:"6cfe9cb2",52111:"2add7442",52294:"50ba5cbf",52325:"1f694098",52411:"0940a6ec",52481:"d547ca7c",52498:"aa630ecb",52535:"f224db02",52579:"abbc96a6",52675:"9f500a79",52701:"86b488fd",52827:"aae1cda4",52962:"45d16336",53095:"d90ad4d0",53227:"4afdd87b",53230:"7ee594a4",53538:"d62c6414",53608:"e552b938",53644:"0219d75f",53772:"d533b27c",53911:"7b5be119",54097:"9a73c0f8",54133:"d809c29f",54301:"bb5e2a21",54434:"c375cee2",54589:"8e63a745",54733:"64636b87",54938:"3d462533",55046:"7fbd0068",55399:"4db2e1c4",55897:"c9d6a863",55914:"d372f3bd",56010:"6fc3a2e1",56056:"ef2fdb17",56317:"91628a77",56388:"a2c2d17e",56527:"2223341e",57464:"f591f5a6",57731:"737d9f98",58050:"c5398bdb",58218:"f36d5405",58406:"f809c5a5",58552:"351ab798",58727:"4ef27673",58841:"a74b1a35",59132:"75d6668d",59138:"fe422566",59158:"b5c90ec5",59309:"e11492ee",59344:"387512f6",59543:"b2640c03",59616:"b8f3b75c",59654:"f85ab1c2",59671:"727c42f9",59809:"e9cd120b",6e4:"27a1f96f",60132:"0fb0a010",60225:"c41e5ef3",60516:"7e27c5ae",60915:"014b13fe",60995:"be774bf0",61034:"242b10e3",61109:"749ace4a",61655:"43153ad9",62007:"7df91293",62081:"f426f77e",62082:"d76438ac",62191:"e69808ae",62253:"be0d6388",62432:"984e2821",62540:"097f5870",62801:"360b4190",63024:"a325bdf1",63050:"cbdd8579",63336:"4449932d",63376:"b8a4062a",63395:"b8c69beb",63556:"9f25edcc",63668:"606a6d4b",63898:"7d02e6eb",63962:"bc52f942",64189:"d9e32a53",64195:"0f060f34",64318:"9572af8a",64709:"d4709a4b",64733:"e8e5f267",64836:"fcf39d71",64875:"524ac2a7",65010:"619287f3",65067:"401d8ccf",65185:"db5ee144",65657:"774a06c2",65666:"a3a1549e",65901:"b41420c7",65969:"3f9ca992",66746:"cc73bf48",67093:"72124867",67530:"f4706a13",67556:"3cb1ee08",67620:"c96ec135",67646:"41f9d80a",67759:"aa3a910a",67766:"c2e7fe01",67808:"7fc7f3bc",67897:"11d8a8e5",68334:"86cd4465",68453:"c973bc06",68459:"de5707fc",68492:"8b20ba8d",68800:"a2ccd153",68887:"f954eb0a",69697:"53c795a3",69756:"38546c06",69810:"7aece3f4",69986:"1d02e4d3",70825:"b80529fb",71588:"caab9145",72042:"32178e3d",72522:"9e2cf7d9",72653:"3dc0d11a",72945:"a1138b74",73044:"a9b8cff3",73069:"f5b81372",73175:"78eca585",73201:"8872b6b2",73362:"756bd337",73538:"cd60df16",73774:"a415a1c0",73785:"e8e90041",73807:"87feadbf",73808:"5169c2cb",73814:"f3cf482f",74230:"ff10f529",74234:"593a0b5e",74398:"73f3f62c",74500:"19332a20",74563:"6ceffa2c",74805:"5cd94602",74861:"a427750a",74997:"90cf523f",75176:"3908f049",75510:"56acc780",75894:"c02d7a68",76153:"5926c801",76262:"571d697d",76333:"00a64871",76391:"79b4abcb",76693:"7cb7d1ac",76798:"dd65ae1c",76901:"9bab4fdb",76974:"628403bd",77042:"8113f4dd",77552:"216c2b69",77715:"61073794",77952:"d2f8f864",78212:"41260fae",78322:"ccbc4af1",78381:"a1abee45",78584:"8f7ef603",78743:"70dfb286",78784:"a2ba707a",79004:"d5214806",79032:"74b9b103",79106:"da36b1ce",79345:"d6559de6",79486:"d74be659",79812:"a145b9fb",80053:"34b51fba",81079:"f9274e66",81133:"412c3489",81171:"7ab6ff68",81229:"8179cf95",81557:"9eaa4ee0",82288:"78d3fcb6",82761:"a86d067e",82869:"138f6b7b",83052:"00e09ea3",83209:"932ca8b0",83241:"5db26abf",83306:"fa09a0b2",83400:"647528a6",83441:"28769d3b",83518:"db39f923",83633:"70243559",84051:"454ca7aa",84062:"da688a97",84201:"0a0815b5",84296:"b01d7c43",84611:"915c8d72",84916:"0196233a",84928:"c83d6029",85100:"59126e17",85228:"c57445d0",85804:"fd6c2d8c",85930:"8bb9369d",86116:"21673b4f",86188:"bc7196b9",86221:"73caf660",86683:"91616ce2",87127:"a7f729c4",87250:"3ad57ffb",87541:"c9bb5e5f",87671:"f9fc0d33",87922:"bb6c2d9a",87945:"dc79e333",87974:"7610abf6",88071:"addba81e",88181:"e14bc56b",88367:"00faeb2d",88590:"99f0fcba",88854:"88c6f4d8",88932:"a66dbfe2",88993:"52f07ecd",89074:"e897441c",89167:"b216ea79",89561:"cd37fe24",89854:"b31148ea",90239:"4728e4d9",90357:"d2e30f72",90366:"befbed80",90437:"10b4b74e",90533:"aaa7ce95",90627:"b6cce7da",90827:"05c302a3",90897:"a063a3f7",90992:"5a145ab1",91178:"92032e23",91390:"66df1b60",91457:"dad2af32",91501:"a5fe12a9",91613:"81b56e5b",91802:"ec234700",91950:"0b662191",92331:"e0df5b95",92349:"6926e5b2",93089:"c52e9195",93472:"364dd08a",94023:"15b9ed1a",95057:"a5ad39a8",95108:"2fe3a3df",95211:"44c0ae6b",95278:"f6984bfd",95310:"6cd5a464",95555:"5dc128ca",95598:"61fbde3e",95684:"346ba851",95866:"4940915b",96075:"31067f7a",96105:"2703fad9",96611:"7508dbb8",97227:"f39f1744",97405:"bbc56e04",97417:"8b173a40",97447:"69c046be",97457:"87399871",97752:"ee3d1ad7",97779:"21dfeb75",97987:"cc2a8cd1",98017:"bdfba5f4",98445:"f2996f7b",98632:"3a343e40",98651:"1d40bbf8",98666:"de32a7f7",98984:"576d5a37",99122:"50e92bed",99186:"35d4cae9",99314:"507669d8",99410:"1a12f8e6",99604:"e06c6ca6",99661:"e7ba6d8f",99680:"5a0bbbe5",99706:"3e3097c4",99820:"a3855261"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,c)=>Object.prototype.hasOwnProperty.call(e,c),d={},b="odra-website:",r.l=(e,c,f,a)=>{if(d[e])d[e].push(c);else{var t,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var l=n[i];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==b+f){t=l;break}}t||(o=!0,(t=document.createElement("script")).charset="utf-8",t.timeout=120,r.nc&&t.setAttribute("nonce",r.nc),t.setAttribute("data-webpack",b+f),t.src=e),d[e]=[c];var u=(c,f)=>{t.onerror=t.onload=null,clearTimeout(s);var b=d[e];if(delete d[e],t.parentNode&&t.parentNode.removeChild(t),b&&b.forEach((e=>e(f))),c)return c(f)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=u.bind(null,t.onerror),t.onload=u.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r.p="/",r.gca=function(e){return e={13066500:"53772",17896441:"27918",32993410:"75510",33762072:"27669",34731735:"15604",51652154:"16952",71735968:"79345",71994587:"74398",73285975:"82869",77193147:"50327",78452797:"46100",79253424:"36571",82287515:"32164",83697071:"75894",87854661:"30819",93514764:"63336",94723368:"84916","4e69c95d":"60",bcf5f050:"267","116347ba":"466",db82a1c0:"494",be0b2ac1:"589","5326f0ca":"1378",b4f02106:"1442","90f06335":"1459","145548d1":"1615",d7dfd89f:"1655",c5f43526:"2037","16691bef":"2536","5aa50e24":"2944",ff3976bd:"3037","7457cffc":"3675",a0d3df9d:"3743",cbdaac1b:"3744","8a2be6b7":"3816",e47e02bd:"4056","496b44fb":"4266",fe2b6021:"4467",bac2ca12:"4720","0c77f976":"4781","615fce32":"5527","21fc20bd":"5724",b2f44958:"5776",de67a916:"6156","3129ff44":"6367","9f0f335a":"6459",c705646d:"6489","9a7c9bac":"6701","7c233f44":"7011","6e2102f2":"7064","95045a66":"7196",c1ae59bd:"7437",ed6ae2e5:"7493","26441f8e":"7742",c1418166:"7978","7cf5f48a":"8068","181ab02d":"8099","9a7f4a11":"8923","037547ca":"9184",e2724f12:"9370","79d3180c":"9375",d985b3f7:"9558","14eb3368":"9817","6e5ab397":"9954",b759477d:"10079",ad92572d:"10242","86598a2c":"10276","208794bf":"11172",e4b2a41e:"11422",b2f554cd:"11477","120e723d":"11502","07fff18d":"11577","5c7e9aff":"11777",e7a2e79a:"11830",e31bed34:"11839","3cbbe945":"11961","119fbfb6":"11969","58f10d9f":"12493",ee3d80a6:"12535","8010fede":"12628",ce999a4e:"12862","4279e616":"12890","74137f62":"12921",ab4716a0:"12933","0d4fe067":"13030","918e870d":"13849","7df6186d":"13968","969eb6fb":"14015",d7637d81:"14062","6428a729":"14220","90c053b1":"14593",e30c7d5f:"14665","5bf6529c":"15113","3593900a":"15376",b70aea30:"15705","5bff39d6":"15753",cca6b120:"15775",e07dea01:"15924","73b9c18c":"16027","2bf460c7":"16286",dcb2dd04:"16504",db95cb73:"16828",d8ed494b:"17342","68495fce":"17552",c1bc45da:"17927","45990ab7":"18088",a05c6bda:"18118","028141a3":"18283",e309b9ad:"18355","54d8e0e1":"18914",b2e57a16:"19243","4da873a0":"19431","9aad49c5":"19588","17498f44":"19828",ea145f46:"19856","32e511f4":"20248","06a0fa51":"20348","666726ac":"20355","13ab0148":"20523",f8f99b0e:"20626","4f40819b":"20874",e8a3ffa2:"21389",fa4e959a:"21544","0030fd86":"21887",ce9c8ec6:"21957",aee91c2e:"23073","754937b2":"23308","6acba536":"23408","5f2971ba":"23633","0cc148ac":"23697","33e7c3de":"23914","69fd3230":"24371",b94504cb:"24415","86127e86":"24608",f781f173:"24854",cfdaa3fd:"24999","657d5854":"25085","3721b008":"25151","62e81aa6":"25329","61047f5a":"25377",c5296eae:"25396",e9ea549b:"25495","9ffb5fe4":"25558",c6385d27:"25579","386627d1":"25633",bee0af8b:"25662","120e9383":"25867","585204f8":"26077",f446cb0a:"26418","9c04347b":"26831","88434b46":"27195","0a44181e":"27731",a33e3bb6:"27776",cc61c55f:"27867","24942c38":"28511","70c316d8":"28550",db36feee:"28663","1416c8f4":"28700","641fd09d":"28748",c10f3592:"28966","9f6fd0ea":"29037","43e47b8e":"29108","815ad8c9":"29145","74376d79":"29413","1be78505":"29514","9d620965":"29634","3e663e98":"29831","11e5b730":"29906","9390dd74":"30196",bc9af134:"30637",ed898d19:"30659","4da81bc4":"30663","42fe661b":"30800",fcdd79ea:"31201",befd1fba:"31215",e5e64bd0:"31401","1dd27823":"31529",b338949b:"32103","3e9ef03c":"32717","237cf9c7":"32806",a6734805:"32947","874ec8b8":"33000",a809f3b7:"33146","7acce579":"33158","57bc1a35":"33394",d691a609:"33468",d0c01b74:"33622","9e93cf3e":"33659","6171926c":"33860",ccd6c61b:"33985","473b33d6":"34050",dfe71587:"34267","16c5018d":"34437","3ac77d2e":"34627","2b7acc9d":"34923","17e51713":"34926","626c8e99":"35114",f0928d2f:"35660","9005cef3":"35973","3ce92bbb":"36323",e745da21:"36361","893f4b86":"36452","3879932b":"36578","4913a3b5":"36653","24bf3011":"36882","274ccf11":"37057","03ddc63e":"37077","1e877671":"37139",b435d362:"37150",fdb5f68c:"37178","5825ca57":"37199","0d02cb66":"37282","6f7f3f28":"37591","0abf45c2":"37625","79b67993":"37798","125a74bf":"37904",d5e3179c:"38089","1b36f1ff":"38602",e74fcb0e:"38705","5be2abc9":"39737","54f44165":"40152",d15969ed:"40190","1999a842":"40427",cdca8af0:"40588","6add768b":"40656","481896f1":"40906","112c15b6":"40922",afc3a23f:"40996","419e5fad":"41220","04d6639f":"41258","46da96af":"41563","56296f23":"41577","6be2997d":"41783",b548b5e0:"41810","8837ae20":"41817",f63d58d7:"41906","28efbf3f":"42240","67a34253":"42691","7414f7c1":"42858","71b12fda":"42986",bc77ce48:"43379","695d43df":"43751",ca76cddc:"44191",eedc1cb5:"44248",b2c1dfd0:"44781",bab04a93:"45006","80b82873":"45299","03d24697":"45333",b50b03ee:"45486",ccc49370:"46103","95db938c":"46145",acebe248:"46393","383c9ad7":"46491","632b087e":"46499",ac692f92:"46539","7d8962a6":"46671",fec7bf31:"46844","7c29795c":"46867","8e991cde":"47287","6c16b7b1":"47593","21d4362d":"47646","919c36c8":"48221",d90ea429:"48435","60d35280":"48733",f92986d2:"49165","67cf10af":"49168","3e885f31":"50568",fefb7f4a:"50572",e538a9e1:"50635","716fdc54":"50703","509c4227":"50723","4ba42032":"51096","5bcb7a16":"52098","2fe15297":"52111",f54718af:"52294","0bf9d8ab":"52325","599e53c2":"52411",ca19d087:"52481","6d263cfa":"52498","814f3328":"52535","5905dfac":"52579","31372b4d":"52675",e2022d8c:"52701","4a017cdd":"52827",bc0e7bcb:"52962","71b691b7":"53095","3f00e816":"53227","1d854f2b":"53230","0b779dad":"53538","9e4087bc":"53608",b25a9e84:"53644","31959af2":"53911","5c8f3a1c":"54097","7f9a1b7a":"54133","728e71a1":"54301","9d95fe34":"54434","0a8f7599":"54589","6289863c":"54733","3ec01721":"54938",a892851d:"55046","1524a02c":"55399",bfc20097:"55897","1f63a7a5":"55914","3edee900":"56010","04477b87":"56056",a663e775:"56317","0ea00542":"56388","367de8e8":"56527","35d161a3":"57464",f146bc3c:"57731","3849c38e":"58050","909eb646":"58218","3e0ea7e3":"58406","4c38ccb3":"58552",dd174fa2:"58727",cd790770:"58841","372918e4":"59132",c43892d3:"59138",b6d3d7c8:"59158",bfc8213d:"59309",a046a162:"59344","252d6971":"59543","55362a87":"59616","558ac3fc":"59654","0e384e19":"59671","91b04621":"59809",fb249be3:"60000","6b1ad888":"60132","3152febb":"60225","01086ac7":"60516","377695c3":"60915","177939f6":"60995","6d494689":"61034","0be49901":"61109",b6aaec29:"61655","5c77c5fd":"62007","448060b1":"62081","4dd99f24":"62082",f139e68c:"62191","3701fb97":"62253","9e73c0bb":"62432","65ab6b77":"62540","3c817d4f":"62801","175a5a59":"63024","3cdf4a35":"63050",af2a4ce0:"63376","9cc9201d":"63395","67d74c2d":"63556",c13d152b:"63668",fabdfba1:"63898","1be56b3c":"63962","5c4991bb":"64189",c4f5d8e4:"64195",aaadf060:"64318","70d9d1e8":"64709","7546c635":"64733","02192c58":"64836",e8902c41:"64875","1bc92503":"65010",d386dd06:"65067","42407bf6":"65185","799b1c68":"65657","0413f781":"65666",cecbc2b5:"65901","01337889":"65969","74ec7413":"66746",a6f6e2b9:"67093","4d5b435f":"67530","71958ad0":"67556",beab0651:"67620","0993954b":"67646",ddaed26d:"67759",dc0bb66d:"67766","2033cf69":"67808",b7573e33:"67897",e4e3cd82:"68334",fed89aff:"68453",c3fd70b6:"68459","09109da1":"68492","3b67cac2":"68800",e4e8123e:"68887","9e3cc906":"69697",f5bf02f1:"69756",c95b781b:"69810","739a70a9":"69986",cde2d623:"70825","4e50b37d":"71588","1030000d":"72042","67cb2d26":"72522",c52764ec:"72653","5f012ce0":"72945","03f3dff9":"73044","60dd6115":"73069",cf3f256a:"73175","9dc5d51e":"73201","3eed3f1a":"73362","5ca766f6":"73538","6a9553ca":"73774","1b34e22f":"73785","06d8044c":"73807",ef626e06:"73808","5ad2f7ef":"73814",b241ea99:"74230",f91f9bef:"74234","64fba0bc":"74500",bb6e6682:"74563","94fadafc":"74805","031cd168":"74861",ba36c747:"74997",a88260b3:"75176",a3d6ef01:"76153","39d2189a":"76262","86253fdc":"76333",fcdcfd4e:"76391","14355e8c":"76693","93381d6e":"76798",ff33c5f7:"76901",c71fcec7:"76974",cad7ddc9:"77042","6640477e":"77552",acbba37b:"77715","733ac994":"77952","7cc7edf9":"78212","4cd738bd":"78322","1684519a":"78381",b0f6aa87:"78584","748fd4ff":"78743","41445f6c":"78784","90c71d04":"79004","7e706e45":"79032","26ab3a9c":"79106","5d94dea0":"79486",c40f324a:"79812","935f2afb":"80053","20f44f94":"81079","192dc956":"81133",f00a1e6f:"81171","80b62ebf":"81229","881a4843":"81557","53726ad7":"82288","74442e8e":"82761","01e5113f":"83052",bd4cf5c0:"83241",bc53adba:"83306",e78a982b:"83400","786408bf":"83441",f4926997:"83518","8509f041":"83633","636decee":"84051","4760a525":"84062",cb085bdb:"84201","95f5ef42":"84296","800dfaa2":"84928","87661fc3":"85100",da555cce:"85228",defc5a9a:"85804","98b2adcf":"85930","40692c03":"86116","88506cf5":"86188","8f162cb9":"86221","030cb818":"86683","51bf83ad":"87127","9a6d52da":"87250",c24519ee:"87541","17908ca6":"87671","659ab8cb":"87922","0093993c":"87945","5fd0213e":"87974","8b0ca31f":"88071","57648d1e":"88181","2c824dec":"88367",c5cef920:"88590",ea0379ae:"88854","443d45d4":"88932",a7794a1d:"88993",f1080184:"89074","3bb5653d":"89167","46ef55c5":"89561","75ab3d8c":"89854","4a070847":"90357","6617ee69":"90366",d25c8023:"90437",b2b675dd:"90533","1d7f9163":"90627",da9e3acc:"90827",c8e7910f:"90897","575b7125":"90992","705c2b64":"91178","5a816386":"91390","2937371c":"91457",eae8630e:"91501",bc61aabc:"91613","452b335c":"91802",ca9ead02:"91950",cd591068:"92331",b2b12f9a:"92349",a6aa9e1f:"93089","615e12e7":"93472",e294fa30:"94023","5b4d97e3":"95057","3cb0761e":"95108",ab49860c:"95211","156a315c":"95278","2131dc9d":"95310","794d4fad":"95555","8988b866":"95598",d32d6987:"95684","42eeae87":"95866","88b75f2c":"96075",c714b9ee:"96105","48d43fc1":"96611",c52d4d42:"97227",d9fee9da:"97405","03436d61":"97417","29c8e325":"97447","58abd590":"97457",b87f41d0:"97752","68deafd0":"97779",f6aaa6b5:"97987",a0a709a1:"98017",df1503d8:"98445","5ffb61b1":"98632",a98f838e:"98651",b7d3ed64:"98666","97237b2f":"98984","76b68520":"99122","54dbc4b0":"99186",e018be55:"99314","02a3f783":"99410","7933b4e2":"99604",d2eb1abd:"99661",ce4f9116:"99680","40b2cc78":"99706","5f13c361":"99820"}[e]||e,r.p+r.u(e)},(()=>{var e={51303:0,40532:0};r.f.j=(c,f)=>{var d=r.o(e,c)?e[c]:void 0;if(0!==d)if(d)f.push(d[2]);else if(/^(40532|51303)$/.test(c))e[c]=0;else{var b=new Promise(((f,b)=>d=e[c]=[f,b]));f.push(d[2]=b);var a=r.p+r.u(c),t=new Error;r.l(a,(f=>{if(r.o(e,c)&&(0!==(d=e[c])&&(e[c]=void 0),d)){var b=f&&("load"===f.type?"missing":f.type),a=f&&f.target&&f.target.src;t.message="Loading chunk "+c+" failed.\n("+b+": "+a+")",t.name="ChunkLoadError",t.type=b,t.request=a,d[1](t)}}),"chunk-"+c,c)}},r.O.j=c=>0===e[c];var c=(c,f)=>{var d,b,a=f[0],t=f[1],o=f[2],n=0;if(a.some((c=>0!==e[c]))){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(o)var i=o(r)}for(c&&c(f);n<a.length;n++)b=a[n],r.o(e,b)&&e[b]&&e[b][0](),e[b]=0;return r.O(i)},f=self.webpackChunkodra_website=self.webpackChunkodra_website||[];f.forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f))})()})(); \ No newline at end of file diff --git a/docs/blog/2023-02-27-openai-writes-erc20-in-odra/index.html b/docs/blog/2023-02-27-openai-writes-erc20-in-odra/index.html new file mode 100644 index 000000000..20953bb9a --- /dev/null +++ b/docs/blog/2023-02-27-openai-writes-erc20-in-odra/index.html @@ -0,0 +1,38 @@ +<!doctype html> +<html lang="en" dir="ltr" class="blog-wrapper blog-post-page plugin-blog plugin-id-default"> +<head> +<meta charset="UTF-8"> +<meta name="generator" content="Docusaurus v2.3.1"> +<title data-rh="true">OpenAI writes ERC20 in Odra | Odra + + + + + +
+

OpenAI writes ERC20 in Odra

· 4 min read

OpenAI can write Odra smart contracts. +This is how.

OpenAI

OpenAI already proved that AI can code. +Github Copilot is used by more and more developers. +Many times it is mind-blowing how accurate it is. +It would be great if one of the OpenAI models could simply work after writing:

Q: Write the ERC20 smart contract.

A: use odra::{Mapping, Variable}...

So far OpenAI hasn't indexed Odra. I even asked ChatGPT.

Q: Do you know what is the Odra Framework for writing smart contracts?
Response in one sentence. Use Yoda style.

A: Aware of an Odra Framework for writing smart contracts, I am not.

Soon (year or two) it will happen and Odra will be supported out of the box, +simply because it is available on GitHub.

DaVinci Edit

OpenAI gives us a great tool called Edit. +It uses the same technology Github Copiled it based on called Codex, +OpenAI gives us access to the model code-davinci-edit-001. +It allows you to paste in the code and ask for changes. +See more examples like rewriting Fibonacci to a recursive version here.

But it doesn't know Odra. +Luckily this is not a problem. +I have found a nice trick that allows producing the code I want. +We simply have to present all the features of Odra and ask a good question.

ERC20 by AI

The goal is to bend AI to write the ERC20 token using Odra. +The Edit query needs two elements:

  • source code,
  • text that describes what should be changed.

As the input source code I wrote the code that uses all the features ERC20 would use. +I need odra::module, Variable, Mapping, caller(), Address, +constructor, and errors.

flipper.rs
use odra::{Variable, types::Address, contract_env, Mapping, execution_error};

#[odra::module]
pub struct Flipper {
value: Variable<bool>,
flips_count: Variable<u32>,
owner: Variable<Address>,
messages: Mapping<(Address, Address), String>
}

#[odra::module]
impl Flipper {
#[odra(init)]
pub fn init(&mut self, owner: Address) {
self.value.set(false);
self.owner.set(owner);
}

pub fn set(&mut self, value: bool) {
self.value.set(value);
}

pub fn flip(&mut self) {
self.value.set(!self.get_value());
self.flips_count.set(self.flips_count.get_or_default());
}

pub fn get_value(&self) -> bool {
self.value.get_or_default()
}

pub fn get_owner(&self) -> Option<Address> {
self.owner.get()
}

pub fn set_message(&mut self, recipient: Address, msg: String) {
let sender = contract_env::caller();
let current_msg = self.messages.get(&(sender, recipient));
match current_msg {
Some(_) => contract_env::revert(Error::MessageAlreadyDefined),
None => self.messages.set(&(sender, recipient), msg)
}
}

pub fn get_message(&self, sender: Address, recipient: Address) -> String {
self.messages.get_or_default(&(sender, recipient))
}
}

execution_error! {
pub enum Error {
MessageAlreadyDefined => 1,
NotAnMessageSender => 2,
}
}

ChatGPT knows what the ERC20 is, so the kind request for changes is simple.

Q: Implement another smart contract called ERC20.
Balances should be of type U256.

This is the result.

ERC20 contract in Odra generated by OpenAI
use odra::{Variable, types::Address, contract_env, Mapping, execution_error, U256};

#[odra::module]
pub struct ERC20 {
name: Variable<String>,
symbol: Variable<String>,
decimals: Variable<u8>,
total_supply: Variable<U256>,
balances: Mapping<Address, U256>,
allowed: Mapping<(Address, Address), U256>
}

#[odra::module]
impl ERC20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, total_supply: U256) {
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.total_supply.set(total_supply);
self.balances.set(&contract_env::caller(), total_supply);
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}

pub fn balance_of(&self, owner: Address) -> U256 {
self.balances.get_or_default(&owner)
}

pub fn transfer(&mut self, to: Address, value: U256) {
let from = contract_env::caller();
let from_balance = self.balances.get_or_default(&from);
let to_balance = self.balances.get_or_default(&to);
if from_balance < value {
contract_env::revert(Error::InsufficientBalance);
}
self.balances.set(&from, from_balance - value);
self.balances.set(&to, to_balance + value);
}

pub fn transfer_from(&mut self, from: Address, to: Address, value: U256) {
let caller = contract_env::caller();
let from_balance = self.balances.get_or_default(&from);
let to_balance = self.balances.get_or_default(&to);
let allowed = self.allowed.get_or_default(&(from, caller));
if from_balance < value {
contract_env::revert(Error::InsufficientBalance);
}
if allowed < value {
contract_env::revert(Error::InsufficientAllowance);
}
self.balances.set(&from, from_balance - value);
self.balances.set(&to, to_balance + value);
self.allowed.set(&(from, caller), allowed - value);
}

pub fn approve(&mut self, spender: Address, value: U256) {
let owner = contract_env::caller();
self.allowed.set(&(owner, spender), value);
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.allowed.get_or_default(&(owner, spender))
}
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Wow!

What is next?

AI already understands smart contracts. +It had to read a lot of Solidity code. +I checked and it knows Uniswap and Compound source code. +Most interesting is that AI was able to implement a concept it already knew +from another programming language in the unseen Rust framework. +At some point, we will be able to translate all the Solidity code to Odra. +Or maybe we will not have to...

It is hard to imagine how good it will be in 2025 and beyond.

+ + + + \ No newline at end of file diff --git a/docs/blog/Nysa/index.html b/docs/blog/Nysa/index.html new file mode 100644 index 000000000..9023b6b69 --- /dev/null +++ b/docs/blog/Nysa/index.html @@ -0,0 +1,20 @@ + + + + + +Nysa | Odra + + + + + +
+

Nysa

· 9 min read

The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wrocław, Szczecin, and Gdańsk, to international waterways. The Oder also plays a significant role in the region's ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.

The Nysa Kłodzka is a significant river in Poland, flowing through the country's southwestern part. It travels approximately 188 kilometers, originating in the Czech Republic and merging with the Oder River in Poland. The river passes through picturesque landscapes, including the Kłodzko Valley, and plays a crucial role in local ecosystems. Its waters are harnessed for various purposes, such as hydroelectric power generation and irrigation.

Oh, wait, shouldn't it be a tech blog?

This is a valid question, we will get back to it in a moment.

Odra

A short reminder:

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design ... +it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel.

Odra

Understanding that people generally dislike learning new things, we've kept this in mind throughout development. Since day one, we have focused on creating Odra with the largest group of smart contract developers in mind - those familiar with Solidity. The Odra Framework is designed to flatten the learning curve for this group.

A Solidity developer will encounter familiar concepts such as:

  • Constructors
  • Payable functions
  • Mappings
  • Reverts
  • Current caller
  • Current block time
  • A standard module library (similar to OpenZeppelin)
  • And more
note

It's important to note that the Odra Framework is intentionally blockchain-agnostic. Its design does not target any particular blockchain.

Ultimately, Odra is built to support multiple blockchains, allowing the writing of smart contracts in Rust.

Having so many similarities, why not take the next step and transpile Solidity code into Odra code?

This is where Nysa comes into play.

Nysa

Solidity and Rust share some syntax similarities despite being designed for different purposes. Both languages emphasize strong typing, pattern matching, and immutability by default.

Nysa performs Solidity-to-Rust transpilation through four simple steps.

nysa-gen

  1. Solidity Parser

Firstly, we need a well-structured Rust representation of Solidity code. Nysa utilizes LALRPOP - a Rust parser generator framework. In the further steps, this enables us to conduct static analysis of the Solidity code, ranging from contract context down to individual expressions.

solidity-parser/src/pt.rs
// The representation of a Solidity contract
#[derive(Debug, PartialEq)]
pub struct ContractDefinition {
pub doc: Vec<DocComment>,
pub loc: Loc,
pub ty: ContractTy,
pub name: Identifier,
pub base: Vec<Base>,
pub parts: Vec<ContractPart>,
}
  1. C3 Linearization

One of the most notable distinctions between Rust and Solidity is their approach to inheritance. Rust says No, thx, whereas Solidity opts for The more, the better. Speaking more technically, Solidity supports multiple inheritance with C3 linearization.

info

The primary purpose of the C3 Linearization Algorithm is to establish a consistent and unambiguous order of method resolution in cases where there might be ambiguity or conflicts due to multiple inheritance. It ensures that the inherited methods are called in a predictable and well-defined sequence based on the class hierarchy and the order in which classes are defined.

For simulating C3 linearization, Nysa utilizes an implementation of the C3 linearization in Rust written by Maciej Zieliński, so everything stays in the Odra family.

  1. Nysa Parser

After that, we step to the essential part, converting Solidity code into Rust code.

For example, a Solidity event.

event Transfer(address indexed from, address indexed to, uint256 value);

can easily be represented as an plain Rust struct - the same name, the same fields, similar types.

#[derive(PartialEq, Eq, Debug)]
pub struct Transfer {
from: Option<Address>,
to: Option<Address>,
value: U256,
}

The same we do with contracts, interfaces, libraries, errors, variables, functions, statements, etc.

Here is a snippet of the expression parser:

nysa/src/parser/odra/expr/mod.rs
pub fn parse<T>(expression: &Expression, ctx: &mut T) -> Result<syn::Expr, ParserError>
where
T: StorageInfo + TypeInfo + EventsRegister + ExternalCallsRegister + ContractInfo + FnContext,
{
match expression {
Expression::Require { condition, error } => error::revert(Some(condition), error, ctx),
Expression::ZeroAddress => Ok(parse_quote!(None)),
Expression::Add { left, right } => math::add(left, right, ctx),
Expression::Subtract { left, right } => math::sub(left, right, ctx),
Expression::Increment { expr } => {
let expr = parse(expr, ctx)?;
Ok(parse_quote!(#expr += 1))
}
Expression::ExternalCall {
variable,
fn_name,
args,
} => parse_ext_call(variable, fn_name, args, ctx),
Expression::Type { ty } => {
let ty = ty::parse_plain_type_from_ty(ty, ctx)?;
Ok(parse_quote!(#ty))
}
Expression::BoolLiteral(b) => Ok(parse_quote!(#b)),
...
}
}

  1. Printing the code

The last step is just consuming the resulting C3 AST. Nysa produces a token stream from the AST. Most likely you would write it to a file.

And there you are: a Rust smart contract is ready to be compiled!

Nysa + Odra

By design, Nysa is a universal tool, so the third step from the pipeline is replaceable. In other words, a Solidity input can be converted to Rust code supporting a framework/SDK of your choice unless you provide a parser implementation.

However, the default implementation is OdraParser, which takes a contract written in Solidity and splits out an Odra module.

I hope you see an analogy to the first two paragraphs at this point. Nysa the river and Nysa the transpiler flow into Odra.

nysa-odra

Examples

Status message

Let's get our hands dirty and create a very simple project. We will write a contract that stores a single mapping of records - an address to a string message.

To set up the project, we use cargo odra.

cargo odra new -n status -t blank
cd status

The first thing is to add Nysa to the project and create a rudimentary build.rs where we define the input - a solidity contract and the output - an Odra module generated by Nysa.

Cargo.toml
[build-dependencies]
nysa = { version = "0.1.0", features = ["builder"] }
build.rs
const DEST_FILE_PATH: &str = "src/status_message.rs";
const SOURCE_FILE_PATH: &str = "src/status_message.sol";

fn main() {
nysa::builder::generate_file::<&str, nysa::OdraParser>(SOURCE_FILE_PATH, DEST_FILE_PATH);
}

Next, implement the contract. Naturally, a Solidity one.

src/status_message.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

contract StatusMessage {
mapping(address => string) records;

function setStatus(string memory status) public payable {
address accountId = msg.sender;
records[accountId] = status;
}

function getStatus(address accountId) public view returns (string memory) {
return records[accountId];
}
}

The contract has a single mapping records that stores a message and its owner. Additionally, exposes two entry points: setStatus (sets current's sender message) and getStatus.

Following, let's define a lib.rs file.

src/lib.rs
mod status_message;
pub use status_message::{StatusMessage, StatusMessageDeployer, StatusMessageRef};

#[cfg(test)]
mod test;

The file is straightforward: registers a status_message rust module, reexports some Odra abstractions, and adds a test module.

Lastly, we can test our contract. +Like the original solidity contract, our Odra contract exposes two entry points: set_message() and get_message(). +The test code looks like any other Odra test: we use StatusMessageDeployer to instantiate a contract, which gets us a reference to interact with the contract.

src/test.rs
use odra::{test_env, types::Address};
use super::*;

const ACCOUNT: fn() -> Address = || odra::test_env::get_account(1);

#[test]
fn set_get_message() {
let mut contract = StatusMessageDeployer::default();

test_env::set_caller(ACCOUNT());
contract.set_status("hello".to_string());
assert_eq!("hello".to_string(), contract.get_status(Some(ACCOUNT())));
}

#[test]
fn get_nonexistent_message() {
let contract = StatusMessageDeployer::default();

assert_eq!(
String::new(),
contract.get_status(Some(ACCOUNT()))
);
}
cargo odra test # test against MockVM
# or
cargo odra test -b casper # build a wasm file and test against CasperVM
status-message
├── src
│ ├── lib.rs
│ ├── status_message.sol
│ └── test.rs
├── build.rs
├── Cargo.toml
└── Odra.toml

Full example available here.

CappedErc20

A more complex, real-world example is a CappedErc20 contract. It is a ERC20 Ownable, Burnable and Capped token contract.

plascoin.sol
// ...
// rest of the code

contract Plascoin is ERC20Capped, ERC20Burnable, Ownable {
constructor(string memory name_, string memory symbol_, uint256 cap_, address initialOwner) ERC20(name_, symbol_) ERC20Capped(cap_) Ownable(initialOwner) {
}

function mint(address account, uint256 amount) public onlyOwner {
_mint(account, amount);
}

function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Capped) {
super._update(from, to, value);
}
}

You can check out the full source code here.

Deployment of such a contract onto the Casper testnet is straightforward. We are just two steps from it.

# to make sure the contract works as expected 
# we execute cargo odra test command to build and run tests
cargo odra test -b casper

# deploy onto the testnet
casper-client put-deploy
--node-address {{NODE_ADDRESS}}
--chain-name casper-test
--secret-key {{SECRET_KEY}} \
--session-path {{CONTRACT_WASM}} \
--payment-amount 130000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'{{CONTRACT_PACKAGE_HASH_NAMED_KEY}}'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string='{{name}}'" \
--session-arg "symbol:string='{{symbol}}'" \
--session-arg "cap:u256='{{cap}}'" \
--session-arg "initial_owner:opt_key='{{owner}}'"

Literally in 5 minutes I was able to:

  1. Build a wasm file from Solidity source code
  2. Successfully deploy the contract onto Testnet,
  3. Mint some tokens,
  4. And transfer them.

Finally, we compare the costs of Solidity-to-Odra contract and a native CEP-18 implementation. Despite the contracts being different in terms of the internal logic and exposed entry points, such comparison gives us some insight into Nysa's efficiency.

actionCEP-18Nysa
deploy143.8793.37
transfer1.291.36

Conclusion

Nysa is at early stage of development, but already has shown a huge potential. In a few simple steps, you can take advantage of an existing smart contract and convert it into an Odra module. The module can be a standalone contract, or a building block of a bigger contract.

+ + + + \ No newline at end of file diff --git a/docs/blog/archive/index.html b/docs/blog/archive/index.html new file mode 100644 index 000000000..708eed324 --- /dev/null +++ b/docs/blog/archive/index.html @@ -0,0 +1,17 @@ + + + + + +Archive | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/atom.xml b/docs/blog/atom.xml new file mode 100644 index 000000000..32eb2a7f3 --- /dev/null +++ b/docs/blog/atom.xml @@ -0,0 +1,254 @@ + + + https://odra.dev/blog + Odra Blog + 2023-08-18T00:00:00.000Z + https://github.com/jpmonette/feed + + Odra Blog + https://odra.dev/img/favicon.ico + + <![CDATA[Nysa]]> + https://odra.dev/blog/Nysa + + 2023-08-18T00:00:00.000Z + + The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wrocław, Szczecin, and Gdańsk, to international waterways. The Oder also plays a significant role in the region's ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.

The Nysa Kłodzka is a significant river in Poland, flowing through the country's southwestern part. It travels approximately 188 kilometers, originating in the Czech Republic and merging with the Oder River in Poland. The river passes through picturesque landscapes, including the Kłodzko Valley, and plays a crucial role in local ecosystems. Its waters are harnessed for various purposes, such as hydroelectric power generation and irrigation.

Oh, wait, shouldn't it be a tech blog?

This is a valid question, we will get back to it in a moment.

Odra

A short reminder:

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design ... +it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel.

Odra

Understanding that people generally dislike learning new things, we've kept this in mind throughout development. Since day one, we have focused on creating Odra with the largest group of smart contract developers in mind - those familiar with Solidity. The Odra Framework is designed to flatten the learning curve for this group.

A Solidity developer will encounter familiar concepts such as:

  • Constructors
  • Payable functions
  • Mappings
  • Reverts
  • Current caller
  • Current block time
  • A standard module library (similar to OpenZeppelin)
  • And more
note

It's important to note that the Odra Framework is intentionally blockchain-agnostic. Its design does not target any particular blockchain.

Ultimately, Odra is built to support multiple blockchains, allowing the writing of smart contracts in Rust.

Having so many similarities, why not take the next step and transpile Solidity code into Odra code?

This is where Nysa comes into play.

Nysa

Solidity and Rust share some syntax similarities despite being designed for different purposes. Both languages emphasize strong typing, pattern matching, and immutability by default.

Nysa performs Solidity-to-Rust transpilation through four simple steps.

nysa-gen

  1. Solidity Parser

Firstly, we need a well-structured Rust representation of Solidity code. Nysa utilizes LALRPOP - a Rust parser generator framework. In the further steps, this enables us to conduct static analysis of the Solidity code, ranging from contract context down to individual expressions.

solidity-parser/src/pt.rs
// The representation of a Solidity contract
#[derive(Debug, PartialEq)]
pub struct ContractDefinition {
pub doc: Vec<DocComment>,
pub loc: Loc,
pub ty: ContractTy,
pub name: Identifier,
pub base: Vec<Base>,
pub parts: Vec<ContractPart>,
}
  1. C3 Linearization

One of the most notable distinctions between Rust and Solidity is their approach to inheritance. Rust says No, thx, whereas Solidity opts for The more, the better. Speaking more technically, Solidity supports multiple inheritance with C3 linearization.

info

The primary purpose of the C3 Linearization Algorithm is to establish a consistent and unambiguous order of method resolution in cases where there might be ambiguity or conflicts due to multiple inheritance. It ensures that the inherited methods are called in a predictable and well-defined sequence based on the class hierarchy and the order in which classes are defined.

For simulating C3 linearization, Nysa utilizes an implementation of the C3 linearization in Rust written by Maciej Zieliński, so everything stays in the Odra family.

  1. Nysa Parser

After that, we step to the essential part, converting Solidity code into Rust code.

For example, a Solidity event.

event Transfer(address indexed from, address indexed to, uint256 value);

can easily be represented as an plain Rust struct - the same name, the same fields, similar types.

#[derive(PartialEq, Eq, Debug)]
pub struct Transfer {
from: Option<Address>,
to: Option<Address>,
value: U256,
}

The same we do with contracts, interfaces, libraries, errors, variables, functions, statements, etc.

Here is a snippet of the expression parser:

nysa/src/parser/odra/expr/mod.rs
pub fn parse<T>(expression: &Expression, ctx: &mut T) -> Result<syn::Expr, ParserError>
where
T: StorageInfo + TypeInfo + EventsRegister + ExternalCallsRegister + ContractInfo + FnContext,
{
match expression {
Expression::Require { condition, error } => error::revert(Some(condition), error, ctx),
Expression::ZeroAddress => Ok(parse_quote!(None)),
Expression::Add { left, right } => math::add(left, right, ctx),
Expression::Subtract { left, right } => math::sub(left, right, ctx),
Expression::Increment { expr } => {
let expr = parse(expr, ctx)?;
Ok(parse_quote!(#expr += 1))
}
Expression::ExternalCall {
variable,
fn_name,
args,
} => parse_ext_call(variable, fn_name, args, ctx),
Expression::Type { ty } => {
let ty = ty::parse_plain_type_from_ty(ty, ctx)?;
Ok(parse_quote!(#ty))
}
Expression::BoolLiteral(b) => Ok(parse_quote!(#b)),
...
}
}

  1. Printing the code

The last step is just consuming the resulting C3 AST. Nysa produces a token stream from the AST. Most likely you would write it to a file.

And there you are: a Rust smart contract is ready to be compiled!

Nysa + Odra

By design, Nysa is a universal tool, so the third step from the pipeline is replaceable. In other words, a Solidity input can be converted to Rust code supporting a framework/SDK of your choice unless you provide a parser implementation.

However, the default implementation is OdraParser, which takes a contract written in Solidity and splits out an Odra module.

I hope you see an analogy to the first two paragraphs at this point. Nysa the river and Nysa the transpiler flow into Odra.

nysa-odra

Examples

Status message

Let's get our hands dirty and create a very simple project. We will write a contract that stores a single mapping of records - an address to a string message.

To set up the project, we use cargo odra.

cargo odra new -n status -t blank
cd status

The first thing is to add Nysa to the project and create a rudimentary build.rs where we define the input - a solidity contract and the output - an Odra module generated by Nysa.

Cargo.toml
[build-dependencies]
nysa = { version = "0.1.0", features = ["builder"] }
build.rs
const DEST_FILE_PATH: &str = "src/status_message.rs";
const SOURCE_FILE_PATH: &str = "src/status_message.sol";

fn main() {
nysa::builder::generate_file::<&str, nysa::OdraParser>(SOURCE_FILE_PATH, DEST_FILE_PATH);
}

Next, implement the contract. Naturally, a Solidity one.

src/status_message.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

contract StatusMessage {
mapping(address => string) records;

function setStatus(string memory status) public payable {
address accountId = msg.sender;
records[accountId] = status;
}

function getStatus(address accountId) public view returns (string memory) {
return records[accountId];
}
}

The contract has a single mapping records that stores a message and its owner. Additionally, exposes two entry points: setStatus (sets current's sender message) and getStatus.

Following, let's define a lib.rs file.

src/lib.rs
mod status_message;
pub use status_message::{StatusMessage, StatusMessageDeployer, StatusMessageRef};

#[cfg(test)]
mod test;

The file is straightforward: registers a status_message rust module, reexports some Odra abstractions, and adds a test module.

Lastly, we can test our contract. +Like the original solidity contract, our Odra contract exposes two entry points: set_message() and get_message(). +The test code looks like any other Odra test: we use StatusMessageDeployer to instantiate a contract, which gets us a reference to interact with the contract.

src/test.rs
use odra::{test_env, types::Address};
use super::*;

const ACCOUNT: fn() -> Address = || odra::test_env::get_account(1);

#[test]
fn set_get_message() {
let mut contract = StatusMessageDeployer::default();

test_env::set_caller(ACCOUNT());
contract.set_status("hello".to_string());
assert_eq!("hello".to_string(), contract.get_status(Some(ACCOUNT())));
}

#[test]
fn get_nonexistent_message() {
let contract = StatusMessageDeployer::default();

assert_eq!(
String::new(),
contract.get_status(Some(ACCOUNT()))
);
}
cargo odra test # test against MockVM
# or
cargo odra test -b casper # build a wasm file and test against CasperVM
status-message
├── src
│ ├── lib.rs
│ ├── status_message.sol
│ └── test.rs
├── build.rs
├── Cargo.toml
└── Odra.toml

Full example available here.

CappedErc20

A more complex, real-world example is a CappedErc20 contract. It is a ERC20 Ownable, Burnable and Capped token contract.

plascoin.sol
// ...
// rest of the code

contract Plascoin is ERC20Capped, ERC20Burnable, Ownable {
constructor(string memory name_, string memory symbol_, uint256 cap_, address initialOwner) ERC20(name_, symbol_) ERC20Capped(cap_) Ownable(initialOwner) {
}

function mint(address account, uint256 amount) public onlyOwner {
_mint(account, amount);
}

function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Capped) {
super._update(from, to, value);
}
}

You can check out the full source code here.

Deployment of such a contract onto the Casper testnet is straightforward. We are just two steps from it.

# to make sure the contract works as expected 
# we execute cargo odra test command to build and run tests
cargo odra test -b casper

# deploy onto the testnet
casper-client put-deploy
--node-address {{NODE_ADDRESS}}
--chain-name casper-test
--secret-key {{SECRET_KEY}} \
--session-path {{CONTRACT_WASM}} \
--payment-amount 130000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'{{CONTRACT_PACKAGE_HASH_NAMED_KEY}}'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string='{{name}}'" \
--session-arg "symbol:string='{{symbol}}'" \
--session-arg "cap:u256='{{cap}}'" \
--session-arg "initial_owner:opt_key='{{owner}}'"

Literally in 5 minutes I was able to:

  1. Build a wasm file from Solidity source code
  2. Successfully deploy the contract onto Testnet,
  3. Mint some tokens,
  4. And transfer them.

Finally, we compare the costs of Solidity-to-Odra contract and a native CEP-18 implementation. Despite the contracts being different in terms of the internal logic and exposed entry points, such comparison gives us some insight into Nysa's efficiency.

actionCEP-18Nysa
deploy143.8793.37
transfer1.291.36

Conclusion

Nysa is at early stage of development, but already has shown a huge potential. In a few simple steps, you can take advantage of an existing smart contract and convert it into an Odra module. The module can be a standalone contract, or a building block of a bigger contract.

]]>
+ + Krzysztof Pobiarżyn + https://github.com/kpob + +
+ + <![CDATA[It's all about the community!]]> + https://odra.dev/blog/its-all-about-the-community + + 2023-06-27T00:00:00.000Z + + Over the past months, +we have been working hard on bringing Odra to the Casper world. +While we are proud of what we have achieved so far, +the hard part is just beginning. +Smart contract developers from outside of our team are starting to use Odra. +We are thrilled about it and here is how we are going to support the community.

Hello Odra Community

Whether you are a Rust developer, Solidity developer or a Casper enthusiast +we are happy to have you here, reading this blog post.

We have built Odra to make smart contract development on Casper easy. +Now we are entering the next phase of the open source journey. +We are going to focus on the community and make sure +Odra is the best tool for the job. +Our motto (we borrowed from the Django Project) is:

We bring cutting-edge smart contract development tools to +professionals with deadlines.

How will we do it? We are going to focus on four things:

  • Quality - Our code and documentation will be of the highest quality. +We will always have tons of tests and examples.
  • Simplicity - The simplest solution is the best solution. +Odra's API needs to be simple and easy to use. +Always! +We are not afraid to take a few steps back and rethink our design. +We believe in short feedback loops and fast iterations.
  • Reusability - No one likes to repeat itself. +We see a huge potential in Odra Modules. +In time, it can become a standard library of Casper smart contracts, +that are battle-tested and ready to use.
  • Community - We are here to help you. +You can always reach out to us on Discord or Github.

We will help with your project

Whether you are a Rust developer or not, you can start using Odra today. +We have prepared a few examples and docs to help you get started. +Rust knowledge required to use Odra is minimal. +That was always the goal.

But we understand that it is hard to start. +We got your back.

We offer free consulting + 2 hours of live coding.

All you have to do is write us an email at contract@odra.dev +with a short description of your project. +We will schedule a call and help you get started with Odra. +After 2 hours of live coding, you will have a working repository with 2 or 3 +smart contracts, that you can use as a starting point for your project.

Roadmap

The feedback we got quite often was: +It's nice, but will it last? What's the direction of the project? +Point taken. Now we answer: We are here to stay. +We got the support from the Casper Association and some projects of our own +to keep us funded. We play the long game.

To systematize our work, we have prepared the roadmap. +As of now, we maintain plans for at least three future releases. +It is a good balance between predictability and flexibility. +We will release new versions approximately every 1-2 months or as needed. +Everyone is encouraged to propose a new Odra feature or enhancement. +New proposals need to be discussed and approved by the core team. +When the feature is ready, we assign it to one of the future releases.

Odra Roadmap

]]>
+ + Maciej Zieliński + https://github.com/zie1ony + +
+ + <![CDATA[OpenAI writes ERC20 in Odra]]> + https://odra.dev/blog/2023-02-27-openai-writes-erc20-in-odra + + 2023-02-27T00:00:00.000Z + + OpenAI can write Odra smart contracts. +This is how.

OpenAI

OpenAI already proved that AI can code. +Github Copilot is used by more and more developers. +Many times it is mind-blowing how accurate it is. +It would be great if one of the OpenAI models could simply work after writing:

Q: Write the ERC20 smart contract.

A: use odra::{Mapping, Variable}...

So far OpenAI hasn't indexed Odra. I even asked ChatGPT.

Q: Do you know what is the Odra Framework for writing smart contracts?
Response in one sentence. Use Yoda style.

A: Aware of an Odra Framework for writing smart contracts, I am not.

Soon (year or two) it will happen and Odra will be supported out of the box, +simply because it is available on GitHub.

DaVinci Edit

OpenAI gives us a great tool called Edit. +It uses the same technology Github Copiled it based on called Codex, +OpenAI gives us access to the model code-davinci-edit-001. +It allows you to paste in the code and ask for changes. +See more examples like rewriting Fibonacci to a recursive version here.

But it doesn't know Odra. +Luckily this is not a problem. +I have found a nice trick that allows producing the code I want. +We simply have to present all the features of Odra and ask a good question.

ERC20 by AI

The goal is to bend AI to write the ERC20 token using Odra. +The Edit query needs two elements:

  • source code,
  • text that describes what should be changed.

As the input source code I wrote the code that uses all the features ERC20 would use. +I need odra::module, Variable, Mapping, caller(), Address, +constructor, and errors.

flipper.rs
use odra::{Variable, types::Address, contract_env, Mapping, execution_error};

#[odra::module]
pub struct Flipper {
value: Variable<bool>,
flips_count: Variable<u32>,
owner: Variable<Address>,
messages: Mapping<(Address, Address), String>
}

#[odra::module]
impl Flipper {
#[odra(init)]
pub fn init(&mut self, owner: Address) {
self.value.set(false);
self.owner.set(owner);
}

pub fn set(&mut self, value: bool) {
self.value.set(value);
}

pub fn flip(&mut self) {
self.value.set(!self.get_value());
self.flips_count.set(self.flips_count.get_or_default());
}

pub fn get_value(&self) -> bool {
self.value.get_or_default()
}

pub fn get_owner(&self) -> Option<Address> {
self.owner.get()
}

pub fn set_message(&mut self, recipient: Address, msg: String) {
let sender = contract_env::caller();
let current_msg = self.messages.get(&(sender, recipient));
match current_msg {
Some(_) => contract_env::revert(Error::MessageAlreadyDefined),
None => self.messages.set(&(sender, recipient), msg)
}
}

pub fn get_message(&self, sender: Address, recipient: Address) -> String {
self.messages.get_or_default(&(sender, recipient))
}
}

execution_error! {
pub enum Error {
MessageAlreadyDefined => 1,
NotAnMessageSender => 2,
}
}

ChatGPT knows what the ERC20 is, so the kind request for changes is simple.

Q: Implement another smart contract called ERC20.
Balances should be of type U256.

This is the result.

ERC20 contract in Odra generated by OpenAI
use odra::{Variable, types::Address, contract_env, Mapping, execution_error, U256};

#[odra::module]
pub struct ERC20 {
name: Variable<String>,
symbol: Variable<String>,
decimals: Variable<u8>,
total_supply: Variable<U256>,
balances: Mapping<Address, U256>,
allowed: Mapping<(Address, Address), U256>
}

#[odra::module]
impl ERC20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, total_supply: U256) {
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.total_supply.set(total_supply);
self.balances.set(&contract_env::caller(), total_supply);
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}

pub fn balance_of(&self, owner: Address) -> U256 {
self.balances.get_or_default(&owner)
}

pub fn transfer(&mut self, to: Address, value: U256) {
let from = contract_env::caller();
let from_balance = self.balances.get_or_default(&from);
let to_balance = self.balances.get_or_default(&to);
if from_balance < value {
contract_env::revert(Error::InsufficientBalance);
}
self.balances.set(&from, from_balance - value);
self.balances.set(&to, to_balance + value);
}

pub fn transfer_from(&mut self, from: Address, to: Address, value: U256) {
let caller = contract_env::caller();
let from_balance = self.balances.get_or_default(&from);
let to_balance = self.balances.get_or_default(&to);
let allowed = self.allowed.get_or_default(&(from, caller));
if from_balance < value {
contract_env::revert(Error::InsufficientBalance);
}
if allowed < value {
contract_env::revert(Error::InsufficientAllowance);
}
self.balances.set(&from, from_balance - value);
self.balances.set(&to, to_balance + value);
self.allowed.set(&(from, caller), allowed - value);
}

pub fn approve(&mut self, spender: Address, value: U256) {
let owner = contract_env::caller();
self.allowed.set(&(owner, spender), value);
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.allowed.get_or_default(&(owner, spender))
}
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Wow!

What is next?

AI already understands smart contracts. +It had to read a lot of Solidity code. +I checked and it knows Uniswap and Compound source code. +Most interesting is that AI was able to implement a concept it already knew +from another programming language in the unseen Rust framework. +At some point, we will be able to translate all the Solidity code to Odra. +Or maybe we will not have to...

It is hard to imagine how good it will be in 2025 and beyond.

]]>
+ + Maciej Zieliński + https://github.com/zie1ony + +
+ + <![CDATA[Odra + CosmWasm]]> + https://odra.dev/blog/odra-cosmwasm + + 2023-02-15T00:00:00.000Z + + In November 2022 we released the first version of the Odra Framework. It's time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm.

CosmWasm

CosmWasm is a smart contract platform for building dApps on the Cosmos blockchain ecosystem. +The platform is designed as a module that can be integrated into the Cosmos SDK, enabling developers who are already building blockchains with the Cosmos SDK to easily incorporate CosmWasm smart contract functionality without the need to modify their existing code.

It uses the Rust programming language, so is potentially a perfect candidate for an Odra backend. +There are many blockchains like Osmosis, Secret Network, Juno that utilize CosmWasm.

Show me your code

I would like to write a Counter smart contract that is CosmWasm compatible. +What are the requirements?

  1. It should store a u32 value.
  2. The initial value it set by the contract deployer.
  3. The value can be incremented.
  4. The value can read from the storage.
  5. The contract can call another contract and increment its counter.

So let's write an Odra module first.

counter.rs
use odra::{types::{Address, event::OdraEvent}, Variable, contract_env};
use self::events::{Init, ValueUpdated};

#[odra::module]
pub struct Counter {
pub value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub fn init(&mut self, value: u32) {
self.value.set(value);
<Init as OdraEvent>::emit(Init {
value,
});
}

pub fn increment(&mut self) {
let old_value = self.value.get_or_default();
let new_value = old_value + 1;
self.value.set(new_value);

ValueUpdated {
old_value,
new_value,
operator: contract_env::caller()
}.emit();
}

pub fn cross_increment(&mut self, counter_address: Address) {
CounterRef::at(counter_address).increment();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

mod events {
use odra::types::Address;

#[derive(odra::Event)]
pub struct ValueUpdated {
pub old_value: u32,
pub new_value: u32,
pub operator: Address
}

#[derive(odra::Event)]
pub struct Init {
pub value: u32,
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn deploy() {
let counter = CounterDeployer::init(10);
assert_eq!(10, counter.get_value());
}

#[test]
fn increment() {
let mut counter = CounterDeployer::init(10);
counter.increment();
assert_eq!(11, counter.get_value());
}
}

But wait, I mentioned CosmWasm, did I?

Here the beauty of Odra comes into play.

Let's use cargo-odra.

cargo odra build -b cosmos

And... that's it, congratulations! We have just written and build our first CosmWasm contract. +As you see, it is nothing different from building a contract for Casper. No additional code, we only changed the -b flag.

Deploy

We have just built a wasm file, but is it really a fully functional contract?

As a battlefield let's choose Juno Network (if you would like to read more about smart contract development on Juno read this Quick Start tutorial). This is an arbitrary choice, each client is built upon a so-called Wasm Zone wasmd, and its interface is alike.

Assuming you already know how to interact with Juno testnet, let's move to the fun part.

But before we go, to keep things simple, let's prepare a justfile. It'll make our interactions with the blockchain much easier. See full version.

justfile
NODE := "--node https://rpc.uni.juno.deuslabs.fi:443"
CHAIN_ID := "--chain-id uni-6"
QUERY_FLAGS := NODE + " " + CHAIN_ID
TRANSACTION_DEFAULTS := "--gas-prices 0.025ujunox --gas auto --gas-adjustment 1.3 --broadcast-mode block"
EXEC_FLAGS := NODE + " " + CHAIN_ID + " " + TRANSACTION_DEFAULTS

get-address NAME:
junod keys show {{NAME}} | grep -o juno.*

store-wasm WASM_PATH SENDER:
junod tx wasm store \
{{WASM_PATH}} --from {{SENDER}} {{EXEC_FLAGS}}

init-contract CODE_ID VALUE SENDER CONTRACT_NAME:
junod tx wasm instantiate \
{{CODE_ID}} \
`just run-args-parser '{"name": "init", "args": [ { "value" : {{VALUE}} }]}'` \
--label '{{CONTRACT_NAME}}' --from {{SENDER}} \
--admin `just get-address {{SENDER}}` \
{{EXEC_FLAGS}}

exec-increment ADDRESS SENDER:
junod tx wasm execute \
{{ADDRESS}} \
`just run-args-parser '{"name": "increment"}'` \
--from {{SENDER}} \
{{EXEC_FLAGS}}

query-get-value ADDRESS:
junod q wasm contract-state smart {{ADDRESS}} \
`just run-args-parser '{"name": "get_value"}'` {{QUERY_FLAGS}}

Ok, we are ready to go.

First, a CosmWasm contract needs to be stored, technically is not a contract yet. Like a larva waiting to morph into a butterfly (sorry for that).

There are three ways to interact with a contract.

  1. Instantiate - in other words, a constructor call. Once the contract is instantiated, it gets an address.
  2. Execute - call an entrypoint that modifies the state.
  3. Query - read the contract's state.

Now, let's take a look at how to do it using the tools we have just prepared.

# args: 
# the path to a wasm file,
# the name under we store the private key.
just store-wasm counter.wasm odra

...
raw_log: '[{"events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgStoreCode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"}]}]}]'
...
txhash: 1A8BA520E980C5ABCBCFA6F62D68B6BB82E780544605DE4DD5C6B1C5E966441B

Great, our code is successfully stored. Form the logs we can read now the code_id which we will use to initialize the contract.

# args: 
# code id taken from the previous tx,
# counter initial value,
# named private key,
# contract label.
just init-contract 286 1 odra "My Counter"

...
raw_log: '[{"events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgInstantiateContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm-Init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]}]}]'
...
txhash: 8DC53F95805349C3763CF4AF9527CAB2AEBEC77B240EFD3801C61231D8748F26

Fantastic, the contract has been initialized and we have its address - juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g. +It's time to increment the counter.

# args:
# contract address taken from the previous tx,
# named private key
just exec-increment juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g odra

...
raw_log: '[{"events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm-ValueUpdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]}]}]'
...
txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2

Finally, we expected, the value to be equal to 2 (the initial value was 1 and we incremented it once).

# args:
# contract address
just query-get-value juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g

data: 2

Indeed, as expected the current counter value is 2.

Show me your transaction

I get it, you don't want to do it all by yourself. So let's take a closer look at one of my transactions.

junod q tx 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 --node https://rpc.uni.juno.deuslabs.fi:443 --chain-id uni-6
...
logs:
- events:
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
type: execute
- attributes:
- key: action
value: /cosmwasm.wasm.v1.MsgExecuteContract
- key: module
value: wasm
- key: sender
value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh
type: message
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
- key: action
value: increment
type: wasm
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
- key: old_value
value: "1"
- key: new_value
value: "2"
- key: operator
value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh
type: wasm-ValueUpdated
...
txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2

If you are familiar Cosmos ecosystem, you can see that there is an attribute containing +the performed action (increment) (If there were some parameters, they would be included in this attribute). +We can find here also our ValueUpdated event with its arguments old_value, new_value and operator.

Wow, we have it, everything worked as intended!

Conclusion

Wouldn't it be great to replace Casper Erc20 and Cosmos Erc20 with a super-simple +single Odra Erc20 implementation?

The Counter contract is just a POC, and there is still a long road ahead of us. +This simple example shows that features like storage, events, and cross-contract calls +can be unified in a simple readable interface.

CosmWasm integration hasn't been published yet, but if you want to experiment by yourself, +check our GitHub (don't forget to update cargo-odra as well).

Join us

Interested?

Join our Discord, our Twitter or write us +at contact@odra.dev.

]]>
+ + Krzysztof Pobiarżyn + https://github.com/kpob + +
+ + <![CDATA[EVM at Risc0]]> + https://odra.dev/blog/evm-at-risc0 + + 2023-02-13T00:00:00.000Z + + Let's run Solidity code inside SputnikVM inside Risc0.

First make sure you know how Risc0 works. +My previous post explains it.

If you want to jump directly to the full code example, it's in the repo.

Solidity

As an example, I have this simple Solidity code. +It is a calculator with two functions. +One for addition and one for the nth Fibonacci number.

bytecode/Calculator.sol
contract Calculator {
function add(uint256 a, uint256 b) public pure returns (uint256) {
return a + b;
}

function fibonacci(uint256 n) public returns (uint256) {
if (n <= 1) {
return n;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
}

It needs to be compiled into the byte code. solc can do this.

$ solc \
--bin-runtime \
--optimize \
--overwrite \
--evm-version istanbul \
--output-dir bytecode \
bytecode/Calculator.sol

It produces an EVM bytecode in the bytecode directory.

$ ls bytecode/
Calculator.bin-runtime Calculator.sol

EVM

The EVM I used is SputnikVM. +Most important it is written in pure Rust and even with no_std mode. +This way I can start an in-memory instance of EVM. +Then take the bytecode of a contract and install it. +Finally, call the contract with arguments and obtain the result value. +For now, it's just a Rust code. Risc0 comes later.

The code is based on Sputnik's benchmark test. +Huge thanks to Michael Birch for helping with Sputnik. +Also make sure how EVM's function selectors work.

evm-runner/src/lib.rs

// Load previously compiled Calculator contract.
pub const CALCULATOR_EVM_PROGRAM: &str = include_str!(
"../../bytecode/Calculator.bin-runtime"
);

// Run Calculator for a given input.
pub fn run_calc_contract(input: &str) -> String {
run_evm(CALCULATOR_EVM_PROGRAM, input)
}

// Run a program (contract) for a given input.
fn run_evm(program: &str, input: &str) -> String {

// Define EVM configuration.
let config = Config::istanbul();
let vicinity = MemoryVicinity {
gas_price: U256::zero(),
origin: H160::default(),
block_hashes: Vec::new(),
block_number: Default::default(),
block_coinbase: Default::default(),
block_timestamp: Default::default(),
block_difficulty: Default::default(),
block_gas_limit: Default::default(),
chain_id: U256::one(),
block_base_fee_per_gas: U256::zero(),
};

// Initialized the state of EVM's memory.
let mut state = BTreeMap::new();

// Add our contract under the 0x10 address.
state.insert(
H160::from_str("0x1000000000000000000000000000000000000000")
.unwrap(),
MemoryAccount {
nonce: U256::one(),
balance: U256::from(10000000),
storage: BTreeMap::new(),
code: hex::decode(program).unwrap(),
}
);

// Add new user 0xf0 that will be used as the contract caller.
state.insert(
H160::from_str("0xf000000000000000000000000000000000000000")
.unwrap(),
MemoryAccount {
nonce: U256::one(),
balance: U256::from(10000000),
storage: BTreeMap::new(),
code: Vec::new(),
},
);

// Prepare the executor.
let backend = MemoryBackend::new(&vicinity, state);
let metadata = StackSubstateMetadata::new(u64::MAX, &config);
let state = MemoryStackState::new(metadata, &backend);
let precompiles = BTreeMap::new();
let mut executor
= StackExecutor::new_with_precompiles(state, &config, &precompiles);

// Call the 0x10 contract using the 0xf0 user.
// Use the input variable.
let (exit_reason, result) = executor.transact_call(
H160::from_str("0xf000000000000000000000000000000000000000")
.unwrap(),
H160::from_str("0x1000000000000000000000000000000000000000")
.unwrap(),
U256::zero(),
hex::decode(input).unwrap(),
u64::MAX,
Vec::new(),
);

// Make sure the execution succeeded.
assert!(exit_reason == ExitReason::Succeed(ExitSucceed::Returned));

// Return hex encoded string.
hex::encode(result)
}

Let's execute it. In below tests the data variable hold two things: +function selector and arguments.

For example 61047ff4000000000000000000000000000000000000000000000000000000000000000a +is concatination of the function selector (first 8 chars) and 256-bit long argument. +It is just fibonacci(10). a is hex of 10 and 37 is hex of 52.

evm-runner/src/lib.rs
#[test]
fn fibonacci_works() {
let data = "61047ff4000000000000000000000000000000000000000000000000000000000000000a";
let result = run_calc_contract(data);
assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000037");
}

#[test]
fn addition_works() {
let data = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";
let result = run_calc_contract(data);
assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000009");
}

Risc0

It's time for risc0.

First the guest program. +It is super simple. +It takes a string as an argument, +passes it to the run_calc_contract +and returns the result.

methods/guest/src/bin/evm_calc.rs
#![no_main]
#![no_std]

extern crate alloc;

use alloc::{string::String};
use risc0_zkvm::guest::{env};
use evm_runner::run_calc_contract;

risc0_zkvm::guest::entry!(main);

pub fn main() {
let input: String = env::read();
let result = run_calc_contract(&input);
env::commit(&result);
}

The final step is calling it under ZK.

host/src/main.rs
fn main() {
println!("Proving Calculator.add(7, 2)");
let input = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";
let result = run_prover(input);
println!("Proof generated. 7 + 2 = {result}");

println!("Proving Calculator.fibonacci(4)");
let input = "61047ff40000000000000000000000000000000000000000000000000000000000000004";
let result = run_prover(input);
println!("Proof generated. fibonacci(4) = {result}");
}

fn run_prover(input: &str) -> u32 {
// Make the prover.
let method_code = std::fs::read(EVM_CALC_PATH).unwrap();
let mut prover = Prover::new(&method_code, EVM_CALC_ID).unwrap();

// Push the input as an argument.
prover.add_input_u32_slice(to_vec(input).unwrap().as_slice());

// Execute the prover.
let receipt = prover.run().unwrap();

// Verify the proof.
assert!(receipt.verify(EVM_CALC_ID).is_ok());

// Return result as an u32 value.
let result: String = from_slice(receipt.journal.as_slice()).unwrap();
u32::from_str_radix(&result, 16).unwrap()
}
$ cargo run --release -p host
Proving Calculator.add(7, 2)
Proof generated. 7 + 2 = 9
Proving Calculator.fibonacci(4)
Proof generated. fibonacci(4) = 3

Conclusion

How amazing and mindblowing it is! +Of course, it's just a proof of concept. +Yet with further development of Risc0 improving its proving time and +with more flexible SputnikVM this approach is more than promising.

Join us

Interested?

Join our Discord, our Twitter or write us +at contact@odra.dev.

]]>
+ + Maciej Zieliński + https://github.com/zie1ony + +
+ + <![CDATA[Zero Knowledge on Casper]]> + https://odra.dev/blog/casper-zk-risc0 + + 2022-12-12T00:00:00.000Z + + In this post, I present how to verify a zero knowledge proof on Casper.

Zero Knowledge

In my opinion, the zero knowledge (ZK) is the largest revolution in +blockchains, since Ethereum introduced Turing-complete, account-based +smart contracts. +To put it in simple words, ZK enables two use cases not possible before:

  1. Computation scaling - I can perform expensive computation off-chain +and put the result on a chain with the proof.
  2. Anonymity - I can prove to you, I know something without revealing it.

Risc Zero

I'd like to introduce you to Risc Zero. +It is the general purpose zero-knowledge virtual machine. +Go ahead and spend time reading their website! +For us, the key component is the proof verifier that can be compiled into WASM. +Sooo... we can run it on Casper :) +Yes! We can prove any program, produce proof, and send it to Casper's +smart contract for verification.

Example

Let's dive into the example to see how it works. +The full example code +you can find on our GitHub. +It is based on Risc Zero's Hello, Multiply! +example. So make sure you understand it first. +Guest and Prover sections are taken from this example.

Guest

The program we are proving is called a guest in Risc Zero. +Our goal is to prove we know the factors of an arbitrary number. +Given a and b below guest program computes a * b and produces +a proof of computation.

methods/guest/src/multiply.rs
pub fn main() {
// Load the first number from the host
let a: u64 = env::read();
// Load the second number from the host
let b: u64 = env::read();
// Verify that neither of them are 1 (i.e. nontrivial factors)
if a == 1 || b == 1 {
panic!("Trivial factors")
}
// Compute the product while being careful with integer overflow
let product = a.checked_mul(b).expect("Integer overflow");
env::commit(&product);
}

Prover

It's time to run the guest program and build the proof for +a specific a and b values.

prover/src/main.rs
fn main() {
// Pick two numbers.
let a: u64 = 17;
let b: u64 = 23;

// First, we make the prover, loading the 'multiply' method.
let multiply_src = std::fs::read(MULTIPLY_PATH)
.expect("Method code should be present at the specified path.");
let mut prover = Prover::new(&multiply_src, MULTIPLY_ID)
.expect("Prover should be constructed.",);

// Next we send a & b to the guest.
prover.add_input_u32_slice(to_vec(&a).unwrap().as_slice());
prover.add_input_u32_slice(to_vec(&b).unwrap().as_slice());

// Run prover & generate receipt
let receipt = prover.run()
.expect("Valid code should be provable.");

// Extract journal of receipt (i.e. output c, where c = a * b)
let c: u64 = from_slice(&receipt.journal)
.expect("Journal output should deserialize.");

// Print an assertion
println!("I know the factors of {}, and I can prove it!", c);

// Verify receipt, panic if it's wrong.
receipt.verify(MULTIPLY_ID).expect(
"Code you have proven should successfully verify.",
);

// Convert journal to string and store on disk.
let journal = serde_json::to_string(&receipt.journal).unwrap();
write_to_file("../data/journal", &journal);

// Convert seal to string and store on disk.
let seal = serde_json::to_string(&receipt.seal).unwrap();
write_to_file("../data/seal", &seal);

// Convert method_id to string and store on disk.
let result = serde_json::to_string(MULTIPLY_ID).unwrap();
write_to_file("../data/method", &result);
}

Verifier

Now the verification step. +Given the proof (journal + seal) and the guest program definition (method), +Casper's smart contract checks its correctness. This one is written +just for the demonstration, but in general you want METHOD_ID to be +stored in your contract and both SEAL and JOURNAL to be passed to +the contract via arguments from the outside.

verifier/src/verifier_contract.rs
// Import the proof and the method.
const METHOD_ID: &[u8] = &include!("../../data/method");
const SEAL: &[u32] = &include!("../../data/seal");
const JOURNAL: &[u32] = &include!("../../data/journal");

// Verifier contract holds a result of the zk verification.
#[odra::module]
pub struct Verifier {
result: Variable<String>,
}

#[odra::module]
impl Verifier {
// Calling this entry point triggers the zk proof verification.
pub fn verify(&mut self) {
let result = verify(JOURNAL, SEAL, METHOD_ID);
self.result.set(result);
}

// Result getter.
pub fn result(&self) -> String {
self.result.get().unwrap_or(String::from("Not processed"))
}
}

// The verification method. It constructs new Receipt and verifies it.
fn verify(journal: &[u32], seal: &[u32], method_id: &[u8]) -> String {
let result = Receipt::new(&journal, &seal).verify(method_id);

match result {
Ok(()) => String::from("Ok"),
Err(err) => format!("Error: {}", err.to_string())
}
}

Livenet results

I have deployed it to the testnet and called the verify method. +The result was Ok. Wow, first-ever ZK proof verification on Casper. +Trustless bridging, layer 2 here we come :)

The cost of running the verify method is 2324 CSPR. That's a lot, but +we have to start somewhere.

What next

I think it is a good place to outline possible Casper ZK goals for moving +this forward. The community should discuss:

  1. Building more examples. Risc Zero has a nice battleship game to port over +to Casper.
  2. Adding Risc Zero verification method to Casper's FFI.
  3. Supporting Risc Zero team. We should help develop this awesome +open-source project and gain the ZK expertise.

Join us

Interested in zero knowledge on Casper?

Join our Discord, our Twitter or write us +at contact@odra.dev.

]]>
+ + Maciej Zieliński + https://github.com/zie1ony + +
+ + <![CDATA[Odra 0.2.0 Released]]> + https://odra.dev/blog/release-020 + + 2022-11-30T00:00:00.000Z + + We want to introduce you to the very first public release of the Odra Framework proudly!

A bit of history

More than a year ago Maciej Zieliński resigned from the position of Ecosystem Leader at CasperLabs. +Along with Krzysztof Pobiarżyn and Kuba Płaskonka, we formed an engineering team dedicated to smart contracts.

Looking at the blockchain ecosystems from the smart contract developer perspective there are two universes. +The first one is Solidity, which thrives and is at its best now. +It has a ton of well-tested code and security tooling. +Whenever an EVM-based blockchain pops out it gets populated by forks of DeFi and DAO protocols. +Fascinating network effect emerges - code written for one EVM-based blockchain can be run on every other EVM-based blockchain. +The second universe is Rust which compiles to WebAssembly. +Here developer communities live in the guarded cities of Polkadot, Cosmos, Solana, Casper, and Near. +The code written for one platform is not portable. +The network effect never had a chance to arise.

The main reason why Odra exists is achieving this cross-chain code reusability. +We could paraphrase a bit and say: +"One to bring them all and in the code bind them."

Odra for Casper

The very first blockchain we have integrated with Odra is Casper. +In comparison to casper-contract API, it greatly cuts development time and offers a much lower entry level. +The Odra interface is developer friendly and people familiar with Solidity, Ink, or Near will feel like at home. +We hope it will unleash the creativity and bring a whole bunch of products onto Casper.

Odra Framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design. +Built by experienced developers, it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. +It's free and open source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. +We can do it by abstracting over core concepts that all the above systems are built around. +These are type system, storage, entry points, execution context, and testing environment. +We believe it will bring standardization to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this ecosystem.

Let’s look at a Flipper contract, that holds a boolean value. +The contract has a constructor that sets the initial value, and two entry points: flip() and get(), to change and query the current value, respectively.

use odra::Variable;

#[odra::module]
pub struct Flipper {
value: Variable<bool>,
}

#[odra::module]
impl Flipper {

#[odra(init)]
pub fn init(&mut self, value: bool) {
self.value.set(value);
}

pub fn flip(&mut self) {
self.value.set(!self.get());
}

pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

It comes with the CLI tool cargo-odra that makes it easy to use Odra.

cargo-odra

Neat and simple, isn't it? Do you like it? Start flowing with us!

What next

Let's be honest, we are just starting. +The codebase is still hot. +On the other hand, we are happy with the interfaces we designed. +Now is the time to write documentation and tutorials. +We are also building the modules library inspired by OpenZeppelin. +The security code audit is still ahead of us.

Join us

Check out the Odra GitHub repository for more info on how to get the most out of Odra. +Should you have questions, join our Discord, our Twitter or write us at contact@odra.dev.

]]>
+ + Kuba Płaskonka + https://github.com/kubaplas + + + Krzysztof Pobiarżyn + https://github.com/kpob + + + Maciej Zieliński + https://github.com/zie1ony + +
+
\ No newline at end of file diff --git a/docs/blog/casper-zk-risc0/index.html b/docs/blog/casper-zk-risc0/index.html new file mode 100644 index 000000000..baae879f3 --- /dev/null +++ b/docs/blog/casper-zk-risc0/index.html @@ -0,0 +1,48 @@ + + + + + +Zero Knowledge on Casper | Odra + + + + + +
+

Zero Knowledge on Casper

· 5 min read

In this post, I present how to verify a zero knowledge proof on Casper.

Zero Knowledge

In my opinion, the zero knowledge (ZK) is the largest revolution in +blockchains, since Ethereum introduced Turing-complete, account-based +smart contracts. +To put it in simple words, ZK enables two use cases not possible before:

  1. Computation scaling - I can perform expensive computation off-chain +and put the result on a chain with the proof.
  2. Anonymity - I can prove to you, I know something without revealing it.

Risc Zero

I'd like to introduce you to Risc Zero. +It is the general purpose zero-knowledge virtual machine. +Go ahead and spend time reading their website! +For us, the key component is the proof verifier that can be compiled into WASM. +Sooo... we can run it on Casper :) +Yes! We can prove any program, produce proof, and send it to Casper's +smart contract for verification.

Example

Let's dive into the example to see how it works. +The full example code +you can find on our GitHub. +It is based on Risc Zero's Hello, Multiply! +example. So make sure you understand it first. +Guest and Prover sections are taken from this example.

Guest

The program we are proving is called a guest in Risc Zero. +Our goal is to prove we know the factors of an arbitrary number. +Given a and b below guest program computes a * b and produces +a proof of computation.

methods/guest/src/multiply.rs
pub fn main() {
// Load the first number from the host
let a: u64 = env::read();
// Load the second number from the host
let b: u64 = env::read();
// Verify that neither of them are 1 (i.e. nontrivial factors)
if a == 1 || b == 1 {
panic!("Trivial factors")
}
// Compute the product while being careful with integer overflow
let product = a.checked_mul(b).expect("Integer overflow");
env::commit(&product);
}

Prover

It's time to run the guest program and build the proof for +a specific a and b values.

prover/src/main.rs
fn main() {
// Pick two numbers.
let a: u64 = 17;
let b: u64 = 23;

// First, we make the prover, loading the 'multiply' method.
let multiply_src = std::fs::read(MULTIPLY_PATH)
.expect("Method code should be present at the specified path.");
let mut prover = Prover::new(&multiply_src, MULTIPLY_ID)
.expect("Prover should be constructed.",);

// Next we send a & b to the guest.
prover.add_input_u32_slice(to_vec(&a).unwrap().as_slice());
prover.add_input_u32_slice(to_vec(&b).unwrap().as_slice());

// Run prover & generate receipt
let receipt = prover.run()
.expect("Valid code should be provable.");

// Extract journal of receipt (i.e. output c, where c = a * b)
let c: u64 = from_slice(&receipt.journal)
.expect("Journal output should deserialize.");

// Print an assertion
println!("I know the factors of {}, and I can prove it!", c);

// Verify receipt, panic if it's wrong.
receipt.verify(MULTIPLY_ID).expect(
"Code you have proven should successfully verify.",
);

// Convert journal to string and store on disk.
let journal = serde_json::to_string(&receipt.journal).unwrap();
write_to_file("../data/journal", &journal);

// Convert seal to string and store on disk.
let seal = serde_json::to_string(&receipt.seal).unwrap();
write_to_file("../data/seal", &seal);

// Convert method_id to string and store on disk.
let result = serde_json::to_string(MULTIPLY_ID).unwrap();
write_to_file("../data/method", &result);
}

Verifier

Now the verification step. +Given the proof (journal + seal) and the guest program definition (method), +Casper's smart contract checks its correctness. This one is written +just for the demonstration, but in general you want METHOD_ID to be +stored in your contract and both SEAL and JOURNAL to be passed to +the contract via arguments from the outside.

verifier/src/verifier_contract.rs
// Import the proof and the method.
const METHOD_ID: &[u8] = &include!("../../data/method");
const SEAL: &[u32] = &include!("../../data/seal");
const JOURNAL: &[u32] = &include!("../../data/journal");

// Verifier contract holds a result of the zk verification.
#[odra::module]
pub struct Verifier {
result: Variable<String>,
}

#[odra::module]
impl Verifier {
// Calling this entry point triggers the zk proof verification.
pub fn verify(&mut self) {
let result = verify(JOURNAL, SEAL, METHOD_ID);
self.result.set(result);
}

// Result getter.
pub fn result(&self) -> String {
self.result.get().unwrap_or(String::from("Not processed"))
}
}

// The verification method. It constructs new Receipt and verifies it.
fn verify(journal: &[u32], seal: &[u32], method_id: &[u8]) -> String {
let result = Receipt::new(&journal, &seal).verify(method_id);

match result {
Ok(()) => String::from("Ok"),
Err(err) => format!("Error: {}", err.to_string())
}
}

Livenet results

I have deployed it to the testnet and called the verify method. +The result was Ok. Wow, first-ever ZK proof verification on Casper. +Trustless bridging, layer 2 here we come :)

The cost of running the verify method is 2324 CSPR. That's a lot, but +we have to start somewhere.

What next

I think it is a good place to outline possible Casper ZK goals for moving +this forward. The community should discuss:

  1. Building more examples. Risc Zero has a nice battleship game to port over +to Casper.
  2. Adding Risc Zero verification method to Casper's FFI.
  3. Supporting Risc Zero team. We should help develop this awesome +open-source project and gain the ZK expertise.

Join us

Interested in zero knowledge on Casper?

Join our Discord, our Twitter or write us +at contact@odra.dev.

+ + + + \ No newline at end of file diff --git a/docs/blog/evm-at-risc0/index.html b/docs/blog/evm-at-risc0/index.html new file mode 100644 index 000000000..5397a1efb --- /dev/null +++ b/docs/blog/evm-at-risc0/index.html @@ -0,0 +1,38 @@ + + + + + +EVM at Risc0 | Odra + + + + + +
+

EVM at Risc0

· 4 min read

Let's run Solidity code inside SputnikVM inside Risc0.

First make sure you know how Risc0 works. +My previous post explains it.

If you want to jump directly to the full code example, it's in the repo.

Solidity

As an example, I have this simple Solidity code. +It is a calculator with two functions. +One for addition and one for the nth Fibonacci number.

bytecode/Calculator.sol
contract Calculator {
function add(uint256 a, uint256 b) public pure returns (uint256) {
return a + b;
}

function fibonacci(uint256 n) public returns (uint256) {
if (n <= 1) {
return n;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
}

It needs to be compiled into the byte code. solc can do this.

$ solc \
--bin-runtime \
--optimize \
--overwrite \
--evm-version istanbul \
--output-dir bytecode \
bytecode/Calculator.sol

It produces an EVM bytecode in the bytecode directory.

$ ls bytecode/
Calculator.bin-runtime Calculator.sol

EVM

The EVM I used is SputnikVM. +Most important it is written in pure Rust and even with no_std mode. +This way I can start an in-memory instance of EVM. +Then take the bytecode of a contract and install it. +Finally, call the contract with arguments and obtain the result value. +For now, it's just a Rust code. Risc0 comes later.

The code is based on Sputnik's benchmark test. +Huge thanks to Michael Birch for helping with Sputnik. +Also make sure how EVM's function selectors work.

evm-runner/src/lib.rs

// Load previously compiled Calculator contract.
pub const CALCULATOR_EVM_PROGRAM: &str = include_str!(
"../../bytecode/Calculator.bin-runtime"
);

// Run Calculator for a given input.
pub fn run_calc_contract(input: &str) -> String {
run_evm(CALCULATOR_EVM_PROGRAM, input)
}

// Run a program (contract) for a given input.
fn run_evm(program: &str, input: &str) -> String {

// Define EVM configuration.
let config = Config::istanbul();
let vicinity = MemoryVicinity {
gas_price: U256::zero(),
origin: H160::default(),
block_hashes: Vec::new(),
block_number: Default::default(),
block_coinbase: Default::default(),
block_timestamp: Default::default(),
block_difficulty: Default::default(),
block_gas_limit: Default::default(),
chain_id: U256::one(),
block_base_fee_per_gas: U256::zero(),
};

// Initialized the state of EVM's memory.
let mut state = BTreeMap::new();

// Add our contract under the 0x10 address.
state.insert(
H160::from_str("0x1000000000000000000000000000000000000000")
.unwrap(),
MemoryAccount {
nonce: U256::one(),
balance: U256::from(10000000),
storage: BTreeMap::new(),
code: hex::decode(program).unwrap(),
}
);

// Add new user 0xf0 that will be used as the contract caller.
state.insert(
H160::from_str("0xf000000000000000000000000000000000000000")
.unwrap(),
MemoryAccount {
nonce: U256::one(),
balance: U256::from(10000000),
storage: BTreeMap::new(),
code: Vec::new(),
},
);

// Prepare the executor.
let backend = MemoryBackend::new(&vicinity, state);
let metadata = StackSubstateMetadata::new(u64::MAX, &config);
let state = MemoryStackState::new(metadata, &backend);
let precompiles = BTreeMap::new();
let mut executor
= StackExecutor::new_with_precompiles(state, &config, &precompiles);

// Call the 0x10 contract using the 0xf0 user.
// Use the input variable.
let (exit_reason, result) = executor.transact_call(
H160::from_str("0xf000000000000000000000000000000000000000")
.unwrap(),
H160::from_str("0x1000000000000000000000000000000000000000")
.unwrap(),
U256::zero(),
hex::decode(input).unwrap(),
u64::MAX,
Vec::new(),
);

// Make sure the execution succeeded.
assert!(exit_reason == ExitReason::Succeed(ExitSucceed::Returned));

// Return hex encoded string.
hex::encode(result)
}

Let's execute it. In below tests the data variable hold two things: +function selector and arguments.

For example 61047ff4000000000000000000000000000000000000000000000000000000000000000a +is concatination of the function selector (first 8 chars) and 256-bit long argument. +It is just fibonacci(10). a is hex of 10 and 37 is hex of 52.

evm-runner/src/lib.rs
#[test]
fn fibonacci_works() {
let data = "61047ff4000000000000000000000000000000000000000000000000000000000000000a";
let result = run_calc_contract(data);
assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000037");
}

#[test]
fn addition_works() {
let data = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";
let result = run_calc_contract(data);
assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000009");
}

Risc0

It's time for risc0.

First the guest program. +It is super simple. +It takes a string as an argument, +passes it to the run_calc_contract +and returns the result.

methods/guest/src/bin/evm_calc.rs
#![no_main]
#![no_std]

extern crate alloc;

use alloc::{string::String};
use risc0_zkvm::guest::{env};
use evm_runner::run_calc_contract;

risc0_zkvm::guest::entry!(main);

pub fn main() {
let input: String = env::read();
let result = run_calc_contract(&input);
env::commit(&result);
}

The final step is calling it under ZK.

host/src/main.rs
fn main() {
println!("Proving Calculator.add(7, 2)");
let input = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";
let result = run_prover(input);
println!("Proof generated. 7 + 2 = {result}");

println!("Proving Calculator.fibonacci(4)");
let input = "61047ff40000000000000000000000000000000000000000000000000000000000000004";
let result = run_prover(input);
println!("Proof generated. fibonacci(4) = {result}");
}

fn run_prover(input: &str) -> u32 {
// Make the prover.
let method_code = std::fs::read(EVM_CALC_PATH).unwrap();
let mut prover = Prover::new(&method_code, EVM_CALC_ID).unwrap();

// Push the input as an argument.
prover.add_input_u32_slice(to_vec(input).unwrap().as_slice());

// Execute the prover.
let receipt = prover.run().unwrap();

// Verify the proof.
assert!(receipt.verify(EVM_CALC_ID).is_ok());

// Return result as an u32 value.
let result: String = from_slice(receipt.journal.as_slice()).unwrap();
u32::from_str_radix(&result, 16).unwrap()
}
$ cargo run --release -p host
Proving Calculator.add(7, 2)
Proof generated. 7 + 2 = 9
Proving Calculator.fibonacci(4)
Proof generated. fibonacci(4) = 3

Conclusion

How amazing and mindblowing it is! +Of course, it's just a proof of concept. +Yet with further development of Risc0 improving its proving time and +with more flexible SputnikVM this approach is more than promising.

Join us

Interested?

Join our Discord, our Twitter or write us +at contact@odra.dev.

+ + + + \ No newline at end of file diff --git a/docs/blog/index.html b/docs/blog/index.html new file mode 100644 index 000000000..a9c667232 --- /dev/null +++ b/docs/blog/index.html @@ -0,0 +1,23 @@ + + + + + +Blog | Odra + + + + + +
+

· 9 min read

The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wrocław, Szczecin, and Gdańsk, to international waterways. The Oder also plays a significant role in the region's ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.

The Nysa Kłodzka is a significant river in Poland, flowing through the country's southwestern part. It travels approximately 188 kilometers, originating in the Czech Republic and merging with the Oder River in Poland. The river passes through picturesque landscapes, including the Kłodzko Valley, and plays a crucial role in local ecosystems. Its waters are harnessed for various purposes, such as hydroelectric power generation and irrigation.

Oh, wait, shouldn't it be a tech blog?

This is a valid question, we will get back to it in a moment.

· 3 min read

Over the past months, +we have been working hard on bringing Odra to the Casper world. +While we are proud of what we have achieved so far, +the hard part is just beginning. +Smart contract developers from outside of our team are starting to use Odra. +We are thrilled about it and here is how we are going to support the community.

+ + + + \ No newline at end of file diff --git a/docs/blog/its-all-about-the-community/index.html b/docs/blog/its-all-about-the-community/index.html new file mode 100644 index 000000000..e9e01e8c1 --- /dev/null +++ b/docs/blog/its-all-about-the-community/index.html @@ -0,0 +1,55 @@ + + + + + +It's all about the community! | Odra + + + + + +
+

It's all about the community!

· 3 min read

Over the past months, +we have been working hard on bringing Odra to the Casper world. +While we are proud of what we have achieved so far, +the hard part is just beginning. +Smart contract developers from outside of our team are starting to use Odra. +We are thrilled about it and here is how we are going to support the community.

Hello Odra Community

Whether you are a Rust developer, Solidity developer or a Casper enthusiast +we are happy to have you here, reading this blog post.

We have built Odra to make smart contract development on Casper easy. +Now we are entering the next phase of the open source journey. +We are going to focus on the community and make sure +Odra is the best tool for the job. +Our motto (we borrowed from the Django Project) is:

We bring cutting-edge smart contract development tools to +professionals with deadlines.

How will we do it? We are going to focus on four things:

  • Quality - Our code and documentation will be of the highest quality. +We will always have tons of tests and examples.
  • Simplicity - The simplest solution is the best solution. +Odra's API needs to be simple and easy to use. +Always! +We are not afraid to take a few steps back and rethink our design. +We believe in short feedback loops and fast iterations.
  • Reusability - No one likes to repeat itself. +We see a huge potential in Odra Modules. +In time, it can become a standard library of Casper smart contracts, +that are battle-tested and ready to use.
  • Community - We are here to help you. +You can always reach out to us on Discord or Github.

We will help with your project

Whether you are a Rust developer or not, you can start using Odra today. +We have prepared a few examples and docs to help you get started. +Rust knowledge required to use Odra is minimal. +That was always the goal.

But we understand that it is hard to start. +We got your back.

We offer free consulting + 2 hours of live coding.

All you have to do is write us an email at contract@odra.dev +with a short description of your project. +We will schedule a call and help you get started with Odra. +After 2 hours of live coding, you will have a working repository with 2 or 3 +smart contracts, that you can use as a starting point for your project.

Roadmap

The feedback we got quite often was: +It's nice, but will it last? What's the direction of the project? +Point taken. Now we answer: We are here to stay. +We got the support from the Casper Association and some projects of our own +to keep us funded. We play the long game.

To systematize our work, we have prepared the roadmap. +As of now, we maintain plans for at least three future releases. +It is a good balance between predictability and flexibility. +We will release new versions approximately every 1-2 months or as needed. +Everyone is encouraged to propose a new Odra feature or enhancement. +New proposals need to be discussed and approved by the core team. +When the feature is ready, we assign it to one of the future releases.

Odra Roadmap

+ + + + \ No newline at end of file diff --git a/docs/blog/odra-cosmwasm/index.html b/docs/blog/odra-cosmwasm/index.html new file mode 100644 index 000000000..77d4e955d --- /dev/null +++ b/docs/blog/odra-cosmwasm/index.html @@ -0,0 +1,29 @@ + + + + + +Odra + CosmWasm | Odra + + + + + +
+

Odra + CosmWasm

· 6 min read

In November 2022 we released the first version of the Odra Framework. It's time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm.

CosmWasm

CosmWasm is a smart contract platform for building dApps on the Cosmos blockchain ecosystem. +The platform is designed as a module that can be integrated into the Cosmos SDK, enabling developers who are already building blockchains with the Cosmos SDK to easily incorporate CosmWasm smart contract functionality without the need to modify their existing code.

It uses the Rust programming language, so is potentially a perfect candidate for an Odra backend. +There are many blockchains like Osmosis, Secret Network, Juno that utilize CosmWasm.

Show me your code

I would like to write a Counter smart contract that is CosmWasm compatible. +What are the requirements?

  1. It should store a u32 value.
  2. The initial value it set by the contract deployer.
  3. The value can be incremented.
  4. The value can read from the storage.
  5. The contract can call another contract and increment its counter.

So let's write an Odra module first.

counter.rs
use odra::{types::{Address, event::OdraEvent}, Variable, contract_env};
use self::events::{Init, ValueUpdated};

#[odra::module]
pub struct Counter {
pub value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub fn init(&mut self, value: u32) {
self.value.set(value);
<Init as OdraEvent>::emit(Init {
value,
});
}

pub fn increment(&mut self) {
let old_value = self.value.get_or_default();
let new_value = old_value + 1;
self.value.set(new_value);

ValueUpdated {
old_value,
new_value,
operator: contract_env::caller()
}.emit();
}

pub fn cross_increment(&mut self, counter_address: Address) {
CounterRef::at(counter_address).increment();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

mod events {
use odra::types::Address;

#[derive(odra::Event)]
pub struct ValueUpdated {
pub old_value: u32,
pub new_value: u32,
pub operator: Address
}

#[derive(odra::Event)]
pub struct Init {
pub value: u32,
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn deploy() {
let counter = CounterDeployer::init(10);
assert_eq!(10, counter.get_value());
}

#[test]
fn increment() {
let mut counter = CounterDeployer::init(10);
counter.increment();
assert_eq!(11, counter.get_value());
}
}

But wait, I mentioned CosmWasm, did I?

Here the beauty of Odra comes into play.

Let's use cargo-odra.

cargo odra build -b cosmos

And... that's it, congratulations! We have just written and build our first CosmWasm contract. +As you see, it is nothing different from building a contract for Casper. No additional code, we only changed the -b flag.

Deploy

We have just built a wasm file, but is it really a fully functional contract?

As a battlefield let's choose Juno Network (if you would like to read more about smart contract development on Juno read this Quick Start tutorial). This is an arbitrary choice, each client is built upon a so-called Wasm Zone wasmd, and its interface is alike.

Assuming you already know how to interact with Juno testnet, let's move to the fun part.

But before we go, to keep things simple, let's prepare a justfile. It'll make our interactions with the blockchain much easier. See full version.

justfile
NODE := "--node https://rpc.uni.juno.deuslabs.fi:443"
CHAIN_ID := "--chain-id uni-6"
QUERY_FLAGS := NODE + " " + CHAIN_ID
TRANSACTION_DEFAULTS := "--gas-prices 0.025ujunox --gas auto --gas-adjustment 1.3 --broadcast-mode block"
EXEC_FLAGS := NODE + " " + CHAIN_ID + " " + TRANSACTION_DEFAULTS

get-address NAME:
junod keys show {{NAME}} | grep -o juno.*

store-wasm WASM_PATH SENDER:
junod tx wasm store \
{{WASM_PATH}} --from {{SENDER}} {{EXEC_FLAGS}}

init-contract CODE_ID VALUE SENDER CONTRACT_NAME:
junod tx wasm instantiate \
{{CODE_ID}} \
`just run-args-parser '{"name": "init", "args": [ { "value" : {{VALUE}} }]}'` \
--label '{{CONTRACT_NAME}}' --from {{SENDER}} \
--admin `just get-address {{SENDER}}` \
{{EXEC_FLAGS}}

exec-increment ADDRESS SENDER:
junod tx wasm execute \
{{ADDRESS}} \
`just run-args-parser '{"name": "increment"}'` \
--from {{SENDER}} \
{{EXEC_FLAGS}}

query-get-value ADDRESS:
junod q wasm contract-state smart {{ADDRESS}} \
`just run-args-parser '{"name": "get_value"}'` {{QUERY_FLAGS}}

Ok, we are ready to go.

First, a CosmWasm contract needs to be stored, technically is not a contract yet. Like a larva waiting to morph into a butterfly (sorry for that).

There are three ways to interact with a contract.

  1. Instantiate - in other words, a constructor call. Once the contract is instantiated, it gets an address.
  2. Execute - call an entrypoint that modifies the state.
  3. Query - read the contract's state.

Now, let's take a look at how to do it using the tools we have just prepared.

# args: 
# the path to a wasm file,
# the name under we store the private key.
just store-wasm counter.wasm odra

...
raw_log: '[{"events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgStoreCode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"}]}]}]'
...
txhash: 1A8BA520E980C5ABCBCFA6F62D68B6BB82E780544605DE4DD5C6B1C5E966441B

Great, our code is successfully stored. Form the logs we can read now the code_id which we will use to initialize the contract.

# args: 
# code id taken from the previous tx,
# counter initial value,
# named private key,
# contract label.
just init-contract 286 1 odra "My Counter"

...
raw_log: '[{"events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgInstantiateContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm-Init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]}]}]'
...
txhash: 8DC53F95805349C3763CF4AF9527CAB2AEBEC77B240EFD3801C61231D8748F26

Fantastic, the contract has been initialized and we have its address - juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g. +It's time to increment the counter.

# args:
# contract address taken from the previous tx,
# named private key
just exec-increment juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g odra

...
raw_log: '[{"events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm-ValueUpdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]}]}]'
...
txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2

Finally, we expected, the value to be equal to 2 (the initial value was 1 and we incremented it once).

# args:
# contract address
just query-get-value juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g

data: 2

Indeed, as expected the current counter value is 2.

Show me your transaction

I get it, you don't want to do it all by yourself. So let's take a closer look at one of my transactions.

junod q tx 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 --node https://rpc.uni.juno.deuslabs.fi:443 --chain-id uni-6
...
logs:
- events:
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
type: execute
- attributes:
- key: action
value: /cosmwasm.wasm.v1.MsgExecuteContract
- key: module
value: wasm
- key: sender
value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh
type: message
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
- key: action
value: increment
type: wasm
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
- key: old_value
value: "1"
- key: new_value
value: "2"
- key: operator
value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh
type: wasm-ValueUpdated
...
txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2

If you are familiar Cosmos ecosystem, you can see that there is an attribute containing +the performed action (increment) (If there were some parameters, they would be included in this attribute). +We can find here also our ValueUpdated event with its arguments old_value, new_value and operator.

Wow, we have it, everything worked as intended!

Conclusion

Wouldn't it be great to replace Casper Erc20 and Cosmos Erc20 with a super-simple +single Odra Erc20 implementation?

The Counter contract is just a POC, and there is still a long road ahead of us. +This simple example shows that features like storage, events, and cross-contract calls +can be unified in a simple readable interface.

CosmWasm integration hasn't been published yet, but if you want to experiment by yourself, +check our GitHub (don't forget to update cargo-odra as well).

Join us

Interested?

Join our Discord, our Twitter or write us +at contact@odra.dev.

+ + + + \ No newline at end of file diff --git a/docs/blog/release-020/index.html b/docs/blog/release-020/index.html new file mode 100644 index 000000000..737902468 --- /dev/null +++ b/docs/blog/release-020/index.html @@ -0,0 +1,43 @@ + + + + + +Odra 0.2.0 Released | Odra + + + + + +
+

Odra 0.2.0 Released

· 4 min read

We want to introduce you to the very first public release of the Odra Framework proudly!

A bit of history

More than a year ago Maciej Zieliński resigned from the position of Ecosystem Leader at CasperLabs. +Along with Krzysztof Pobiarżyn and Kuba Płaskonka, we formed an engineering team dedicated to smart contracts.

Looking at the blockchain ecosystems from the smart contract developer perspective there are two universes. +The first one is Solidity, which thrives and is at its best now. +It has a ton of well-tested code and security tooling. +Whenever an EVM-based blockchain pops out it gets populated by forks of DeFi and DAO protocols. +Fascinating network effect emerges - code written for one EVM-based blockchain can be run on every other EVM-based blockchain. +The second universe is Rust which compiles to WebAssembly. +Here developer communities live in the guarded cities of Polkadot, Cosmos, Solana, Casper, and Near. +The code written for one platform is not portable. +The network effect never had a chance to arise.

The main reason why Odra exists is achieving this cross-chain code reusability. +We could paraphrase a bit and say: +"One to bring them all and in the code bind them."

Odra for Casper

The very first blockchain we have integrated with Odra is Casper. +In comparison to casper-contract API, it greatly cuts development time and offers a much lower entry level. +The Odra interface is developer friendly and people familiar with Solidity, Ink, or Near will feel like at home. +We hope it will unleash the creativity and bring a whole bunch of products onto Casper.

Odra Framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design. +Built by experienced developers, it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. +It's free and open source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. +We can do it by abstracting over core concepts that all the above systems are built around. +These are type system, storage, entry points, execution context, and testing environment. +We believe it will bring standardization to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this ecosystem.

Let’s look at a Flipper contract, that holds a boolean value. +The contract has a constructor that sets the initial value, and two entry points: flip() and get(), to change and query the current value, respectively.

use odra::Variable;

#[odra::module]
pub struct Flipper {
value: Variable<bool>,
}

#[odra::module]
impl Flipper {

#[odra(init)]
pub fn init(&mut self, value: bool) {
self.value.set(value);
}

pub fn flip(&mut self) {
self.value.set(!self.get());
}

pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

It comes with the CLI tool cargo-odra that makes it easy to use Odra.

cargo-odra

Neat and simple, isn't it? Do you like it? Start flowing with us!

What next

Let's be honest, we are just starting. +The codebase is still hot. +On the other hand, we are happy with the interfaces we designed. +Now is the time to write documentation and tutorials. +We are also building the modules library inspired by OpenZeppelin. +The security code audit is still ahead of us.

Join us

Check out the Odra GitHub repository for more info on how to get the most out of Odra. +Should you have questions, join our Discord, our Twitter or write us at contact@odra.dev.

+ + + + \ No newline at end of file diff --git a/docs/blog/rss.xml b/docs/blog/rss.xml new file mode 100644 index 000000000..b1378d854 --- /dev/null +++ b/docs/blog/rss.xml @@ -0,0 +1,220 @@ + + + + Odra Blog + https://odra.dev/blog + Odra Blog + Fri, 18 Aug 2023 00:00:00 GMT + https://validator.w3.org/feed/docs/rss2.html + https://github.com/jpmonette/feed + en + + <![CDATA[Nysa]]> + https://odra.dev/blog/Nysa + https://odra.dev/blog/Nysa + Fri, 18 Aug 2023 00:00:00 GMT + + The Oder River, known as "Odra" in Polish, is one of the major rivers in Poland. It flows for approximately 854 kilometers, originating in the Czech Republic and flowing through southwestern Poland before emptying into the Baltic Sea. The river is a vital transportation route, connecting several Polish cities, including Wrocław, Szczecin, and Gdańsk, to international waterways. The Oder also plays a significant role in the region's ecology, supporting diverse habitats and species. Its watershed area spans multiple countries, making it a part of various international cooperation initiatives aimed at water management and environmental conservation.

The Nysa Kłodzka is a significant river in Poland, flowing through the country's southwestern part. It travels approximately 188 kilometers, originating in the Czech Republic and merging with the Oder River in Poland. The river passes through picturesque landscapes, including the Kłodzko Valley, and plays a crucial role in local ecosystems. Its waters are harnessed for various purposes, such as hydroelectric power generation and irrigation.

Oh, wait, shouldn't it be a tech blog?

This is a valid question, we will get back to it in a moment.

Odra

A short reminder:

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design ... +it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel.

Odra

Understanding that people generally dislike learning new things, we've kept this in mind throughout development. Since day one, we have focused on creating Odra with the largest group of smart contract developers in mind - those familiar with Solidity. The Odra Framework is designed to flatten the learning curve for this group.

A Solidity developer will encounter familiar concepts such as:

  • Constructors
  • Payable functions
  • Mappings
  • Reverts
  • Current caller
  • Current block time
  • A standard module library (similar to OpenZeppelin)
  • And more
note

It's important to note that the Odra Framework is intentionally blockchain-agnostic. Its design does not target any particular blockchain.

Ultimately, Odra is built to support multiple blockchains, allowing the writing of smart contracts in Rust.

Having so many similarities, why not take the next step and transpile Solidity code into Odra code?

This is where Nysa comes into play.

Nysa

Solidity and Rust share some syntax similarities despite being designed for different purposes. Both languages emphasize strong typing, pattern matching, and immutability by default.

Nysa performs Solidity-to-Rust transpilation through four simple steps.

nysa-gen

  1. Solidity Parser

Firstly, we need a well-structured Rust representation of Solidity code. Nysa utilizes LALRPOP - a Rust parser generator framework. In the further steps, this enables us to conduct static analysis of the Solidity code, ranging from contract context down to individual expressions.

solidity-parser/src/pt.rs
// The representation of a Solidity contract
#[derive(Debug, PartialEq)]
pub struct ContractDefinition {
pub doc: Vec<DocComment>,
pub loc: Loc,
pub ty: ContractTy,
pub name: Identifier,
pub base: Vec<Base>,
pub parts: Vec<ContractPart>,
}
  1. C3 Linearization

One of the most notable distinctions between Rust and Solidity is their approach to inheritance. Rust says No, thx, whereas Solidity opts for The more, the better. Speaking more technically, Solidity supports multiple inheritance with C3 linearization.

info

The primary purpose of the C3 Linearization Algorithm is to establish a consistent and unambiguous order of method resolution in cases where there might be ambiguity or conflicts due to multiple inheritance. It ensures that the inherited methods are called in a predictable and well-defined sequence based on the class hierarchy and the order in which classes are defined.

For simulating C3 linearization, Nysa utilizes an implementation of the C3 linearization in Rust written by Maciej Zieliński, so everything stays in the Odra family.

  1. Nysa Parser

After that, we step to the essential part, converting Solidity code into Rust code.

For example, a Solidity event.

event Transfer(address indexed from, address indexed to, uint256 value);

can easily be represented as an plain Rust struct - the same name, the same fields, similar types.

#[derive(PartialEq, Eq, Debug)]
pub struct Transfer {
from: Option<Address>,
to: Option<Address>,
value: U256,
}

The same we do with contracts, interfaces, libraries, errors, variables, functions, statements, etc.

Here is a snippet of the expression parser:

nysa/src/parser/odra/expr/mod.rs
pub fn parse<T>(expression: &Expression, ctx: &mut T) -> Result<syn::Expr, ParserError>
where
T: StorageInfo + TypeInfo + EventsRegister + ExternalCallsRegister + ContractInfo + FnContext,
{
match expression {
Expression::Require { condition, error } => error::revert(Some(condition), error, ctx),
Expression::ZeroAddress => Ok(parse_quote!(None)),
Expression::Add { left, right } => math::add(left, right, ctx),
Expression::Subtract { left, right } => math::sub(left, right, ctx),
Expression::Increment { expr } => {
let expr = parse(expr, ctx)?;
Ok(parse_quote!(#expr += 1))
}
Expression::ExternalCall {
variable,
fn_name,
args,
} => parse_ext_call(variable, fn_name, args, ctx),
Expression::Type { ty } => {
let ty = ty::parse_plain_type_from_ty(ty, ctx)?;
Ok(parse_quote!(#ty))
}
Expression::BoolLiteral(b) => Ok(parse_quote!(#b)),
...
}
}

  1. Printing the code

The last step is just consuming the resulting C3 AST. Nysa produces a token stream from the AST. Most likely you would write it to a file.

And there you are: a Rust smart contract is ready to be compiled!

Nysa + Odra

By design, Nysa is a universal tool, so the third step from the pipeline is replaceable. In other words, a Solidity input can be converted to Rust code supporting a framework/SDK of your choice unless you provide a parser implementation.

However, the default implementation is OdraParser, which takes a contract written in Solidity and splits out an Odra module.

I hope you see an analogy to the first two paragraphs at this point. Nysa the river and Nysa the transpiler flow into Odra.

nysa-odra

Examples

Status message

Let's get our hands dirty and create a very simple project. We will write a contract that stores a single mapping of records - an address to a string message.

To set up the project, we use cargo odra.

cargo odra new -n status -t blank
cd status

The first thing is to add Nysa to the project and create a rudimentary build.rs where we define the input - a solidity contract and the output - an Odra module generated by Nysa.

Cargo.toml
[build-dependencies]
nysa = { version = "0.1.0", features = ["builder"] }
build.rs
const DEST_FILE_PATH: &str = "src/status_message.rs";
const SOURCE_FILE_PATH: &str = "src/status_message.sol";

fn main() {
nysa::builder::generate_file::<&str, nysa::OdraParser>(SOURCE_FILE_PATH, DEST_FILE_PATH);
}

Next, implement the contract. Naturally, a Solidity one.

src/status_message.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

contract StatusMessage {
mapping(address => string) records;

function setStatus(string memory status) public payable {
address accountId = msg.sender;
records[accountId] = status;
}

function getStatus(address accountId) public view returns (string memory) {
return records[accountId];
}
}

The contract has a single mapping records that stores a message and its owner. Additionally, exposes two entry points: setStatus (sets current's sender message) and getStatus.

Following, let's define a lib.rs file.

src/lib.rs
mod status_message;
pub use status_message::{StatusMessage, StatusMessageDeployer, StatusMessageRef};

#[cfg(test)]
mod test;

The file is straightforward: registers a status_message rust module, reexports some Odra abstractions, and adds a test module.

Lastly, we can test our contract. +Like the original solidity contract, our Odra contract exposes two entry points: set_message() and get_message(). +The test code looks like any other Odra test: we use StatusMessageDeployer to instantiate a contract, which gets us a reference to interact with the contract.

src/test.rs
use odra::{test_env, types::Address};
use super::*;

const ACCOUNT: fn() -> Address = || odra::test_env::get_account(1);

#[test]
fn set_get_message() {
let mut contract = StatusMessageDeployer::default();

test_env::set_caller(ACCOUNT());
contract.set_status("hello".to_string());
assert_eq!("hello".to_string(), contract.get_status(Some(ACCOUNT())));
}

#[test]
fn get_nonexistent_message() {
let contract = StatusMessageDeployer::default();

assert_eq!(
String::new(),
contract.get_status(Some(ACCOUNT()))
);
}
cargo odra test # test against MockVM
# or
cargo odra test -b casper # build a wasm file and test against CasperVM
status-message
├── src
│ ├── lib.rs
│ ├── status_message.sol
│ └── test.rs
├── build.rs
├── Cargo.toml
└── Odra.toml

Full example available here.

CappedErc20

A more complex, real-world example is a CappedErc20 contract. It is a ERC20 Ownable, Burnable and Capped token contract.

plascoin.sol
// ...
// rest of the code

contract Plascoin is ERC20Capped, ERC20Burnable, Ownable {
constructor(string memory name_, string memory symbol_, uint256 cap_, address initialOwner) ERC20(name_, symbol_) ERC20Capped(cap_) Ownable(initialOwner) {
}

function mint(address account, uint256 amount) public onlyOwner {
_mint(account, amount);
}

function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Capped) {
super._update(from, to, value);
}
}

You can check out the full source code here.

Deployment of such a contract onto the Casper testnet is straightforward. We are just two steps from it.

# to make sure the contract works as expected 
# we execute cargo odra test command to build and run tests
cargo odra test -b casper

# deploy onto the testnet
casper-client put-deploy
--node-address {{NODE_ADDRESS}}
--chain-name casper-test
--secret-key {{SECRET_KEY}} \
--session-path {{CONTRACT_WASM}} \
--payment-amount 130000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'{{CONTRACT_PACKAGE_HASH_NAMED_KEY}}'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string='{{name}}'" \
--session-arg "symbol:string='{{symbol}}'" \
--session-arg "cap:u256='{{cap}}'" \
--session-arg "initial_owner:opt_key='{{owner}}'"

Literally in 5 minutes I was able to:

  1. Build a wasm file from Solidity source code
  2. Successfully deploy the contract onto Testnet,
  3. Mint some tokens,
  4. And transfer them.

Finally, we compare the costs of Solidity-to-Odra contract and a native CEP-18 implementation. Despite the contracts being different in terms of the internal logic and exposed entry points, such comparison gives us some insight into Nysa's efficiency.

actionCEP-18Nysa
deploy143.8793.37
transfer1.291.36

Conclusion

Nysa is at early stage of development, but already has shown a huge potential. In a few simple steps, you can take advantage of an existing smart contract and convert it into an Odra module. The module can be a standalone contract, or a building block of a bigger contract.

]]>
+
+ + <![CDATA[It's all about the community!]]> + https://odra.dev/blog/its-all-about-the-community + https://odra.dev/blog/its-all-about-the-community + Tue, 27 Jun 2023 00:00:00 GMT + + Over the past months, +we have been working hard on bringing Odra to the Casper world. +While we are proud of what we have achieved so far, +the hard part is just beginning. +Smart contract developers from outside of our team are starting to use Odra. +We are thrilled about it and here is how we are going to support the community.

Hello Odra Community

Whether you are a Rust developer, Solidity developer or a Casper enthusiast +we are happy to have you here, reading this blog post.

We have built Odra to make smart contract development on Casper easy. +Now we are entering the next phase of the open source journey. +We are going to focus on the community and make sure +Odra is the best tool for the job. +Our motto (we borrowed from the Django Project) is:

We bring cutting-edge smart contract development tools to +professionals with deadlines.

How will we do it? We are going to focus on four things:

  • Quality - Our code and documentation will be of the highest quality. +We will always have tons of tests and examples.
  • Simplicity - The simplest solution is the best solution. +Odra's API needs to be simple and easy to use. +Always! +We are not afraid to take a few steps back and rethink our design. +We believe in short feedback loops and fast iterations.
  • Reusability - No one likes to repeat itself. +We see a huge potential in Odra Modules. +In time, it can become a standard library of Casper smart contracts, +that are battle-tested and ready to use.
  • Community - We are here to help you. +You can always reach out to us on Discord or Github.

We will help with your project

Whether you are a Rust developer or not, you can start using Odra today. +We have prepared a few examples and docs to help you get started. +Rust knowledge required to use Odra is minimal. +That was always the goal.

But we understand that it is hard to start. +We got your back.

We offer free consulting + 2 hours of live coding.

All you have to do is write us an email at contract@odra.dev +with a short description of your project. +We will schedule a call and help you get started with Odra. +After 2 hours of live coding, you will have a working repository with 2 or 3 +smart contracts, that you can use as a starting point for your project.

Roadmap

The feedback we got quite often was: +It's nice, but will it last? What's the direction of the project? +Point taken. Now we answer: We are here to stay. +We got the support from the Casper Association and some projects of our own +to keep us funded. We play the long game.

To systematize our work, we have prepared the roadmap. +As of now, we maintain plans for at least three future releases. +It is a good balance between predictability and flexibility. +We will release new versions approximately every 1-2 months or as needed. +Everyone is encouraged to propose a new Odra feature or enhancement. +New proposals need to be discussed and approved by the core team. +When the feature is ready, we assign it to one of the future releases.

Odra Roadmap

]]>
+
+ + <![CDATA[OpenAI writes ERC20 in Odra]]> + https://odra.dev/blog/2023-02-27-openai-writes-erc20-in-odra + https://odra.dev/blog/2023-02-27-openai-writes-erc20-in-odra + Mon, 27 Feb 2023 00:00:00 GMT + + OpenAI can write Odra smart contracts. +This is how.

OpenAI

OpenAI already proved that AI can code. +Github Copilot is used by more and more developers. +Many times it is mind-blowing how accurate it is. +It would be great if one of the OpenAI models could simply work after writing:

Q: Write the ERC20 smart contract.

A: use odra::{Mapping, Variable}...

So far OpenAI hasn't indexed Odra. I even asked ChatGPT.

Q: Do you know what is the Odra Framework for writing smart contracts?
Response in one sentence. Use Yoda style.

A: Aware of an Odra Framework for writing smart contracts, I am not.

Soon (year or two) it will happen and Odra will be supported out of the box, +simply because it is available on GitHub.

DaVinci Edit

OpenAI gives us a great tool called Edit. +It uses the same technology Github Copiled it based on called Codex, +OpenAI gives us access to the model code-davinci-edit-001. +It allows you to paste in the code and ask for changes. +See more examples like rewriting Fibonacci to a recursive version here.

But it doesn't know Odra. +Luckily this is not a problem. +I have found a nice trick that allows producing the code I want. +We simply have to present all the features of Odra and ask a good question.

ERC20 by AI

The goal is to bend AI to write the ERC20 token using Odra. +The Edit query needs two elements:

  • source code,
  • text that describes what should be changed.

As the input source code I wrote the code that uses all the features ERC20 would use. +I need odra::module, Variable, Mapping, caller(), Address, +constructor, and errors.

flipper.rs
use odra::{Variable, types::Address, contract_env, Mapping, execution_error};

#[odra::module]
pub struct Flipper {
value: Variable<bool>,
flips_count: Variable<u32>,
owner: Variable<Address>,
messages: Mapping<(Address, Address), String>
}

#[odra::module]
impl Flipper {
#[odra(init)]
pub fn init(&mut self, owner: Address) {
self.value.set(false);
self.owner.set(owner);
}

pub fn set(&mut self, value: bool) {
self.value.set(value);
}

pub fn flip(&mut self) {
self.value.set(!self.get_value());
self.flips_count.set(self.flips_count.get_or_default());
}

pub fn get_value(&self) -> bool {
self.value.get_or_default()
}

pub fn get_owner(&self) -> Option<Address> {
self.owner.get()
}

pub fn set_message(&mut self, recipient: Address, msg: String) {
let sender = contract_env::caller();
let current_msg = self.messages.get(&(sender, recipient));
match current_msg {
Some(_) => contract_env::revert(Error::MessageAlreadyDefined),
None => self.messages.set(&(sender, recipient), msg)
}
}

pub fn get_message(&self, sender: Address, recipient: Address) -> String {
self.messages.get_or_default(&(sender, recipient))
}
}

execution_error! {
pub enum Error {
MessageAlreadyDefined => 1,
NotAnMessageSender => 2,
}
}

ChatGPT knows what the ERC20 is, so the kind request for changes is simple.

Q: Implement another smart contract called ERC20.
Balances should be of type U256.

This is the result.

ERC20 contract in Odra generated by OpenAI
use odra::{Variable, types::Address, contract_env, Mapping, execution_error, U256};

#[odra::module]
pub struct ERC20 {
name: Variable<String>,
symbol: Variable<String>,
decimals: Variable<u8>,
total_supply: Variable<U256>,
balances: Mapping<Address, U256>,
allowed: Mapping<(Address, Address), U256>
}

#[odra::module]
impl ERC20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, total_supply: U256) {
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.total_supply.set(total_supply);
self.balances.set(&contract_env::caller(), total_supply);
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}

pub fn balance_of(&self, owner: Address) -> U256 {
self.balances.get_or_default(&owner)
}

pub fn transfer(&mut self, to: Address, value: U256) {
let from = contract_env::caller();
let from_balance = self.balances.get_or_default(&from);
let to_balance = self.balances.get_or_default(&to);
if from_balance < value {
contract_env::revert(Error::InsufficientBalance);
}
self.balances.set(&from, from_balance - value);
self.balances.set(&to, to_balance + value);
}

pub fn transfer_from(&mut self, from: Address, to: Address, value: U256) {
let caller = contract_env::caller();
let from_balance = self.balances.get_or_default(&from);
let to_balance = self.balances.get_or_default(&to);
let allowed = self.allowed.get_or_default(&(from, caller));
if from_balance < value {
contract_env::revert(Error::InsufficientBalance);
}
if allowed < value {
contract_env::revert(Error::InsufficientAllowance);
}
self.balances.set(&from, from_balance - value);
self.balances.set(&to, to_balance + value);
self.allowed.set(&(from, caller), allowed - value);
}

pub fn approve(&mut self, spender: Address, value: U256) {
let owner = contract_env::caller();
self.allowed.set(&(owner, spender), value);
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.allowed.get_or_default(&(owner, spender))
}
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Wow!

What is next?

AI already understands smart contracts. +It had to read a lot of Solidity code. +I checked and it knows Uniswap and Compound source code. +Most interesting is that AI was able to implement a concept it already knew +from another programming language in the unseen Rust framework. +At some point, we will be able to translate all the Solidity code to Odra. +Or maybe we will not have to...

It is hard to imagine how good it will be in 2025 and beyond.

]]>
+
+ + <![CDATA[Odra + CosmWasm]]> + https://odra.dev/blog/odra-cosmwasm + https://odra.dev/blog/odra-cosmwasm + Wed, 15 Feb 2023 00:00:00 GMT + + In November 2022 we released the first version of the Odra Framework. It's time for the next big step in our framework development - a new platform integration. Meet Odra + CosmWasm.

CosmWasm

CosmWasm is a smart contract platform for building dApps on the Cosmos blockchain ecosystem. +The platform is designed as a module that can be integrated into the Cosmos SDK, enabling developers who are already building blockchains with the Cosmos SDK to easily incorporate CosmWasm smart contract functionality without the need to modify their existing code.

It uses the Rust programming language, so is potentially a perfect candidate for an Odra backend. +There are many blockchains like Osmosis, Secret Network, Juno that utilize CosmWasm.

Show me your code

I would like to write a Counter smart contract that is CosmWasm compatible. +What are the requirements?

  1. It should store a u32 value.
  2. The initial value it set by the contract deployer.
  3. The value can be incremented.
  4. The value can read from the storage.
  5. The contract can call another contract and increment its counter.

So let's write an Odra module first.

counter.rs
use odra::{types::{Address, event::OdraEvent}, Variable, contract_env};
use self::events::{Init, ValueUpdated};

#[odra::module]
pub struct Counter {
pub value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub fn init(&mut self, value: u32) {
self.value.set(value);
<Init as OdraEvent>::emit(Init {
value,
});
}

pub fn increment(&mut self) {
let old_value = self.value.get_or_default();
let new_value = old_value + 1;
self.value.set(new_value);

ValueUpdated {
old_value,
new_value,
operator: contract_env::caller()
}.emit();
}

pub fn cross_increment(&mut self, counter_address: Address) {
CounterRef::at(counter_address).increment();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

mod events {
use odra::types::Address;

#[derive(odra::Event)]
pub struct ValueUpdated {
pub old_value: u32,
pub new_value: u32,
pub operator: Address
}

#[derive(odra::Event)]
pub struct Init {
pub value: u32,
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn deploy() {
let counter = CounterDeployer::init(10);
assert_eq!(10, counter.get_value());
}

#[test]
fn increment() {
let mut counter = CounterDeployer::init(10);
counter.increment();
assert_eq!(11, counter.get_value());
}
}

But wait, I mentioned CosmWasm, did I?

Here the beauty of Odra comes into play.

Let's use cargo-odra.

cargo odra build -b cosmos

And... that's it, congratulations! We have just written and build our first CosmWasm contract. +As you see, it is nothing different from building a contract for Casper. No additional code, we only changed the -b flag.

Deploy

We have just built a wasm file, but is it really a fully functional contract?

As a battlefield let's choose Juno Network (if you would like to read more about smart contract development on Juno read this Quick Start tutorial). This is an arbitrary choice, each client is built upon a so-called Wasm Zone wasmd, and its interface is alike.

Assuming you already know how to interact with Juno testnet, let's move to the fun part.

But before we go, to keep things simple, let's prepare a justfile. It'll make our interactions with the blockchain much easier. See full version.

justfile
NODE := "--node https://rpc.uni.juno.deuslabs.fi:443"
CHAIN_ID := "--chain-id uni-6"
QUERY_FLAGS := NODE + " " + CHAIN_ID
TRANSACTION_DEFAULTS := "--gas-prices 0.025ujunox --gas auto --gas-adjustment 1.3 --broadcast-mode block"
EXEC_FLAGS := NODE + " " + CHAIN_ID + " " + TRANSACTION_DEFAULTS

get-address NAME:
junod keys show {{NAME}} | grep -o juno.*

store-wasm WASM_PATH SENDER:
junod tx wasm store \
{{WASM_PATH}} --from {{SENDER}} {{EXEC_FLAGS}}

init-contract CODE_ID VALUE SENDER CONTRACT_NAME:
junod tx wasm instantiate \
{{CODE_ID}} \
`just run-args-parser '{"name": "init", "args": [ { "value" : {{VALUE}} }]}'` \
--label '{{CONTRACT_NAME}}' --from {{SENDER}} \
--admin `just get-address {{SENDER}}` \
{{EXEC_FLAGS}}

exec-increment ADDRESS SENDER:
junod tx wasm execute \
{{ADDRESS}} \
`just run-args-parser '{"name": "increment"}'` \
--from {{SENDER}} \
{{EXEC_FLAGS}}

query-get-value ADDRESS:
junod q wasm contract-state smart {{ADDRESS}} \
`just run-args-parser '{"name": "get_value"}'` {{QUERY_FLAGS}}

Ok, we are ready to go.

First, a CosmWasm contract needs to be stored, technically is not a contract yet. Like a larva waiting to morph into a butterfly (sorry for that).

There are three ways to interact with a contract.

  1. Instantiate - in other words, a constructor call. Once the contract is instantiated, it gets an address.
  2. Execute - call an entrypoint that modifies the state.
  3. Query - read the contract's state.

Now, let's take a look at how to do it using the tools we have just prepared.

# args: 
# the path to a wasm file,
# the name under we store the private key.
just store-wasm counter.wasm odra

...
raw_log: '[{"events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgStoreCode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"}]}]}]'
...
txhash: 1A8BA520E980C5ABCBCFA6F62D68B6BB82E780544605DE4DD5C6B1C5E966441B

Great, our code is successfully stored. Form the logs we can read now the code_id which we will use to initialize the contract.

# args: 
# code id taken from the previous tx,
# counter initial value,
# named private key,
# contract label.
just init-contract 286 1 odra "My Counter"

...
raw_log: '[{"events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgInstantiateContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm-Init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]}]}]'
...
txhash: 8DC53F95805349C3763CF4AF9527CAB2AEBEC77B240EFD3801C61231D8748F26

Fantastic, the contract has been initialized and we have its address - juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g. +It's time to increment the counter.

# args:
# contract address taken from the previous tx,
# named private key
just exec-increment juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g odra

...
raw_log: '[{"events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm-ValueUpdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]}]}]'
...
txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2

Finally, we expected, the value to be equal to 2 (the initial value was 1 and we incremented it once).

# args:
# contract address
just query-get-value juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g

data: 2

Indeed, as expected the current counter value is 2.

Show me your transaction

I get it, you don't want to do it all by yourself. So let's take a closer look at one of my transactions.

junod q tx 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 --node https://rpc.uni.juno.deuslabs.fi:443 --chain-id uni-6
...
logs:
- events:
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
type: execute
- attributes:
- key: action
value: /cosmwasm.wasm.v1.MsgExecuteContract
- key: module
value: wasm
- key: sender
value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh
type: message
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
- key: action
value: increment
type: wasm
- attributes:
- key: _contract_address
value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g
- key: old_value
value: "1"
- key: new_value
value: "2"
- key: operator
value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh
type: wasm-ValueUpdated
...
txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2

If you are familiar Cosmos ecosystem, you can see that there is an attribute containing +the performed action (increment) (If there were some parameters, they would be included in this attribute). +We can find here also our ValueUpdated event with its arguments old_value, new_value and operator.

Wow, we have it, everything worked as intended!

Conclusion

Wouldn't it be great to replace Casper Erc20 and Cosmos Erc20 with a super-simple +single Odra Erc20 implementation?

The Counter contract is just a POC, and there is still a long road ahead of us. +This simple example shows that features like storage, events, and cross-contract calls +can be unified in a simple readable interface.

CosmWasm integration hasn't been published yet, but if you want to experiment by yourself, +check our GitHub (don't forget to update cargo-odra as well).

Join us

Interested?

Join our Discord, our Twitter or write us +at contact@odra.dev.

]]>
+
+ + <![CDATA[EVM at Risc0]]> + https://odra.dev/blog/evm-at-risc0 + https://odra.dev/blog/evm-at-risc0 + Mon, 13 Feb 2023 00:00:00 GMT + + Let's run Solidity code inside SputnikVM inside Risc0.

First make sure you know how Risc0 works. +My previous post explains it.

If you want to jump directly to the full code example, it's in the repo.

Solidity

As an example, I have this simple Solidity code. +It is a calculator with two functions. +One for addition and one for the nth Fibonacci number.

bytecode/Calculator.sol
contract Calculator {
function add(uint256 a, uint256 b) public pure returns (uint256) {
return a + b;
}

function fibonacci(uint256 n) public returns (uint256) {
if (n <= 1) {
return n;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
}

It needs to be compiled into the byte code. solc can do this.

$ solc \
--bin-runtime \
--optimize \
--overwrite \
--evm-version istanbul \
--output-dir bytecode \
bytecode/Calculator.sol

It produces an EVM bytecode in the bytecode directory.

$ ls bytecode/
Calculator.bin-runtime Calculator.sol

EVM

The EVM I used is SputnikVM. +Most important it is written in pure Rust and even with no_std mode. +This way I can start an in-memory instance of EVM. +Then take the bytecode of a contract and install it. +Finally, call the contract with arguments and obtain the result value. +For now, it's just a Rust code. Risc0 comes later.

The code is based on Sputnik's benchmark test. +Huge thanks to Michael Birch for helping with Sputnik. +Also make sure how EVM's function selectors work.

evm-runner/src/lib.rs

// Load previously compiled Calculator contract.
pub const CALCULATOR_EVM_PROGRAM: &str = include_str!(
"../../bytecode/Calculator.bin-runtime"
);

// Run Calculator for a given input.
pub fn run_calc_contract(input: &str) -> String {
run_evm(CALCULATOR_EVM_PROGRAM, input)
}

// Run a program (contract) for a given input.
fn run_evm(program: &str, input: &str) -> String {

// Define EVM configuration.
let config = Config::istanbul();
let vicinity = MemoryVicinity {
gas_price: U256::zero(),
origin: H160::default(),
block_hashes: Vec::new(),
block_number: Default::default(),
block_coinbase: Default::default(),
block_timestamp: Default::default(),
block_difficulty: Default::default(),
block_gas_limit: Default::default(),
chain_id: U256::one(),
block_base_fee_per_gas: U256::zero(),
};

// Initialized the state of EVM's memory.
let mut state = BTreeMap::new();

// Add our contract under the 0x10 address.
state.insert(
H160::from_str("0x1000000000000000000000000000000000000000")
.unwrap(),
MemoryAccount {
nonce: U256::one(),
balance: U256::from(10000000),
storage: BTreeMap::new(),
code: hex::decode(program).unwrap(),
}
);

// Add new user 0xf0 that will be used as the contract caller.
state.insert(
H160::from_str("0xf000000000000000000000000000000000000000")
.unwrap(),
MemoryAccount {
nonce: U256::one(),
balance: U256::from(10000000),
storage: BTreeMap::new(),
code: Vec::new(),
},
);

// Prepare the executor.
let backend = MemoryBackend::new(&vicinity, state);
let metadata = StackSubstateMetadata::new(u64::MAX, &config);
let state = MemoryStackState::new(metadata, &backend);
let precompiles = BTreeMap::new();
let mut executor
= StackExecutor::new_with_precompiles(state, &config, &precompiles);

// Call the 0x10 contract using the 0xf0 user.
// Use the input variable.
let (exit_reason, result) = executor.transact_call(
H160::from_str("0xf000000000000000000000000000000000000000")
.unwrap(),
H160::from_str("0x1000000000000000000000000000000000000000")
.unwrap(),
U256::zero(),
hex::decode(input).unwrap(),
u64::MAX,
Vec::new(),
);

// Make sure the execution succeeded.
assert!(exit_reason == ExitReason::Succeed(ExitSucceed::Returned));

// Return hex encoded string.
hex::encode(result)
}

Let's execute it. In below tests the data variable hold two things: +function selector and arguments.

For example 61047ff4000000000000000000000000000000000000000000000000000000000000000a +is concatination of the function selector (first 8 chars) and 256-bit long argument. +It is just fibonacci(10). a is hex of 10 and 37 is hex of 52.

evm-runner/src/lib.rs
#[test]
fn fibonacci_works() {
let data = "61047ff4000000000000000000000000000000000000000000000000000000000000000a";
let result = run_calc_contract(data);
assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000037");
}

#[test]
fn addition_works() {
let data = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";
let result = run_calc_contract(data);
assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000009");
}

Risc0

It's time for risc0.

First the guest program. +It is super simple. +It takes a string as an argument, +passes it to the run_calc_contract +and returns the result.

methods/guest/src/bin/evm_calc.rs
#![no_main]
#![no_std]

extern crate alloc;

use alloc::{string::String};
use risc0_zkvm::guest::{env};
use evm_runner::run_calc_contract;

risc0_zkvm::guest::entry!(main);

pub fn main() {
let input: String = env::read();
let result = run_calc_contract(&input);
env::commit(&result);
}

The final step is calling it under ZK.

host/src/main.rs
fn main() {
println!("Proving Calculator.add(7, 2)");
let input = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002";
let result = run_prover(input);
println!("Proof generated. 7 + 2 = {result}");

println!("Proving Calculator.fibonacci(4)");
let input = "61047ff40000000000000000000000000000000000000000000000000000000000000004";
let result = run_prover(input);
println!("Proof generated. fibonacci(4) = {result}");
}

fn run_prover(input: &str) -> u32 {
// Make the prover.
let method_code = std::fs::read(EVM_CALC_PATH).unwrap();
let mut prover = Prover::new(&method_code, EVM_CALC_ID).unwrap();

// Push the input as an argument.
prover.add_input_u32_slice(to_vec(input).unwrap().as_slice());

// Execute the prover.
let receipt = prover.run().unwrap();

// Verify the proof.
assert!(receipt.verify(EVM_CALC_ID).is_ok());

// Return result as an u32 value.
let result: String = from_slice(receipt.journal.as_slice()).unwrap();
u32::from_str_radix(&result, 16).unwrap()
}
$ cargo run --release -p host
Proving Calculator.add(7, 2)
Proof generated. 7 + 2 = 9
Proving Calculator.fibonacci(4)
Proof generated. fibonacci(4) = 3

Conclusion

How amazing and mindblowing it is! +Of course, it's just a proof of concept. +Yet with further development of Risc0 improving its proving time and +with more flexible SputnikVM this approach is more than promising.

Join us

Interested?

Join our Discord, our Twitter or write us +at contact@odra.dev.

]]>
+
+ + <![CDATA[Zero Knowledge on Casper]]> + https://odra.dev/blog/casper-zk-risc0 + https://odra.dev/blog/casper-zk-risc0 + Mon, 12 Dec 2022 00:00:00 GMT + + In this post, I present how to verify a zero knowledge proof on Casper.

Zero Knowledge

In my opinion, the zero knowledge (ZK) is the largest revolution in +blockchains, since Ethereum introduced Turing-complete, account-based +smart contracts. +To put it in simple words, ZK enables two use cases not possible before:

  1. Computation scaling - I can perform expensive computation off-chain +and put the result on a chain with the proof.
  2. Anonymity - I can prove to you, I know something without revealing it.

Risc Zero

I'd like to introduce you to Risc Zero. +It is the general purpose zero-knowledge virtual machine. +Go ahead and spend time reading their website! +For us, the key component is the proof verifier that can be compiled into WASM. +Sooo... we can run it on Casper :) +Yes! We can prove any program, produce proof, and send it to Casper's +smart contract for verification.

Example

Let's dive into the example to see how it works. +The full example code +you can find on our GitHub. +It is based on Risc Zero's Hello, Multiply! +example. So make sure you understand it first. +Guest and Prover sections are taken from this example.

Guest

The program we are proving is called a guest in Risc Zero. +Our goal is to prove we know the factors of an arbitrary number. +Given a and b below guest program computes a * b and produces +a proof of computation.

methods/guest/src/multiply.rs
pub fn main() {
// Load the first number from the host
let a: u64 = env::read();
// Load the second number from the host
let b: u64 = env::read();
// Verify that neither of them are 1 (i.e. nontrivial factors)
if a == 1 || b == 1 {
panic!("Trivial factors")
}
// Compute the product while being careful with integer overflow
let product = a.checked_mul(b).expect("Integer overflow");
env::commit(&product);
}

Prover

It's time to run the guest program and build the proof for +a specific a and b values.

prover/src/main.rs
fn main() {
// Pick two numbers.
let a: u64 = 17;
let b: u64 = 23;

// First, we make the prover, loading the 'multiply' method.
let multiply_src = std::fs::read(MULTIPLY_PATH)
.expect("Method code should be present at the specified path.");
let mut prover = Prover::new(&multiply_src, MULTIPLY_ID)
.expect("Prover should be constructed.",);

// Next we send a & b to the guest.
prover.add_input_u32_slice(to_vec(&a).unwrap().as_slice());
prover.add_input_u32_slice(to_vec(&b).unwrap().as_slice());

// Run prover & generate receipt
let receipt = prover.run()
.expect("Valid code should be provable.");

// Extract journal of receipt (i.e. output c, where c = a * b)
let c: u64 = from_slice(&receipt.journal)
.expect("Journal output should deserialize.");

// Print an assertion
println!("I know the factors of {}, and I can prove it!", c);

// Verify receipt, panic if it's wrong.
receipt.verify(MULTIPLY_ID).expect(
"Code you have proven should successfully verify.",
);

// Convert journal to string and store on disk.
let journal = serde_json::to_string(&receipt.journal).unwrap();
write_to_file("../data/journal", &journal);

// Convert seal to string and store on disk.
let seal = serde_json::to_string(&receipt.seal).unwrap();
write_to_file("../data/seal", &seal);

// Convert method_id to string and store on disk.
let result = serde_json::to_string(MULTIPLY_ID).unwrap();
write_to_file("../data/method", &result);
}

Verifier

Now the verification step. +Given the proof (journal + seal) and the guest program definition (method), +Casper's smart contract checks its correctness. This one is written +just for the demonstration, but in general you want METHOD_ID to be +stored in your contract and both SEAL and JOURNAL to be passed to +the contract via arguments from the outside.

verifier/src/verifier_contract.rs
// Import the proof and the method.
const METHOD_ID: &[u8] = &include!("../../data/method");
const SEAL: &[u32] = &include!("../../data/seal");
const JOURNAL: &[u32] = &include!("../../data/journal");

// Verifier contract holds a result of the zk verification.
#[odra::module]
pub struct Verifier {
result: Variable<String>,
}

#[odra::module]
impl Verifier {
// Calling this entry point triggers the zk proof verification.
pub fn verify(&mut self) {
let result = verify(JOURNAL, SEAL, METHOD_ID);
self.result.set(result);
}

// Result getter.
pub fn result(&self) -> String {
self.result.get().unwrap_or(String::from("Not processed"))
}
}

// The verification method. It constructs new Receipt and verifies it.
fn verify(journal: &[u32], seal: &[u32], method_id: &[u8]) -> String {
let result = Receipt::new(&journal, &seal).verify(method_id);

match result {
Ok(()) => String::from("Ok"),
Err(err) => format!("Error: {}", err.to_string())
}
}

Livenet results

I have deployed it to the testnet and called the verify method. +The result was Ok. Wow, first-ever ZK proof verification on Casper. +Trustless bridging, layer 2 here we come :)

The cost of running the verify method is 2324 CSPR. That's a lot, but +we have to start somewhere.

What next

I think it is a good place to outline possible Casper ZK goals for moving +this forward. The community should discuss:

  1. Building more examples. Risc Zero has a nice battleship game to port over +to Casper.
  2. Adding Risc Zero verification method to Casper's FFI.
  3. Supporting Risc Zero team. We should help develop this awesome +open-source project and gain the ZK expertise.

Join us

Interested in zero knowledge on Casper?

Join our Discord, our Twitter or write us +at contact@odra.dev.

]]>
+
+ + <![CDATA[Odra 0.2.0 Released]]> + https://odra.dev/blog/release-020 + https://odra.dev/blog/release-020 + Wed, 30 Nov 2022 00:00:00 GMT + + We want to introduce you to the very first public release of the Odra Framework proudly!

A bit of history

More than a year ago Maciej Zieliński resigned from the position of Ecosystem Leader at CasperLabs. +Along with Krzysztof Pobiarżyn and Kuba Płaskonka, we formed an engineering team dedicated to smart contracts.

Looking at the blockchain ecosystems from the smart contract developer perspective there are two universes. +The first one is Solidity, which thrives and is at its best now. +It has a ton of well-tested code and security tooling. +Whenever an EVM-based blockchain pops out it gets populated by forks of DeFi and DAO protocols. +Fascinating network effect emerges - code written for one EVM-based blockchain can be run on every other EVM-based blockchain. +The second universe is Rust which compiles to WebAssembly. +Here developer communities live in the guarded cities of Polkadot, Cosmos, Solana, Casper, and Near. +The code written for one platform is not portable. +The network effect never had a chance to arise.

The main reason why Odra exists is achieving this cross-chain code reusability. +We could paraphrase a bit and say: +"One to bring them all and in the code bind them."

Odra for Casper

The very first blockchain we have integrated with Odra is Casper. +In comparison to casper-contract API, it greatly cuts development time and offers a much lower entry level. +The Odra interface is developer friendly and people familiar with Solidity, Ink, or Near will feel like at home. +We hope it will unleash the creativity and bring a whole bunch of products onto Casper.

Odra Framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design. +Built by experienced developers, it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. +It's free and open source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. +We can do it by abstracting over core concepts that all the above systems are built around. +These are type system, storage, entry points, execution context, and testing environment. +We believe it will bring standardization to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this ecosystem.

Let’s look at a Flipper contract, that holds a boolean value. +The contract has a constructor that sets the initial value, and two entry points: flip() and get(), to change and query the current value, respectively.

use odra::Variable;

#[odra::module]
pub struct Flipper {
value: Variable<bool>,
}

#[odra::module]
impl Flipper {

#[odra(init)]
pub fn init(&mut self, value: bool) {
self.value.set(value);
}

pub fn flip(&mut self) {
self.value.set(!self.get());
}

pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

It comes with the CLI tool cargo-odra that makes it easy to use Odra.

cargo-odra

Neat and simple, isn't it? Do you like it? Start flowing with us!

What next

Let's be honest, we are just starting. +The codebase is still hot. +On the other hand, we are happy with the interfaces we designed. +Now is the time to write documentation and tutorials. +We are also building the modules library inspired by OpenZeppelin. +The security code audit is still ahead of us.

Join us

Check out the Odra GitHub repository for more info on how to get the most out of Odra. +Should you have questions, join our Discord, our Twitter or write us at contact@odra.dev.

]]>
+
+
+
\ No newline at end of file diff --git a/docs/docs/0.2.0/backends/casper/index.html b/docs/docs/0.2.0/backends/casper/index.html new file mode 100644 index 000000000..f91f09f1c --- /dev/null +++ b/docs/docs/0.2.0/backends/casper/index.html @@ -0,0 +1,25 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.2.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Types

A struct to be written into the storage must implement OdraType which is defined as follow:

pub trait OdraType: 
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

The other exposed types are:

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra creates two URefs in the global state:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement SerializableEvent which is defined as follow:

pub trait SerializableEvent: 
odra_types::event::OdraEvent +
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling contract_env::attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The contract_env::self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The contract_env::caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call contract_env::self_balance, which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Execution

First thing Odra does with your code, is similar to the one used in MockVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/backends/mock-vm/index.html b/docs/docs/0.2.0/backends/mock-vm/index.html new file mode 100644 index 000000000..731d72c02 --- /dev/null +++ b/docs/docs/0.2.0/backends/mock-vm/index.html @@ -0,0 +1,26 @@ + + + + + +MockVM | Odra + + + + + +
+
Version: 0.2.0

MockVM

The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler.

Usage

The MockVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

MockVM consists of two main parts: the Contract Register and the State.

The Contract Register is just a list of contracts deployed onto the MockVM, identified by an Address. +Each time we call the contract, we call its instance stored in the Contract Register.

Contracts and Test Env functions can modify the State of the MockVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the MockVM State holds only the current state of the MockVM. +Thanks to this and the fact that we do not need the blockchain itself, +MockVM starts instantly and runs the tests in the native speed.

Execution

When the MockVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, MockVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/backends/what-is-a-backend/index.html b/docs/docs/0.2.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..ecb41de53 --- /dev/null +++ b/docs/docs/0.2.0/backends/what-is-a-backend/index.html @@ -0,0 +1,27 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.2.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like MockVM, +or a complete virtual machine, spinning up a blockchain for you - like CasperVM.

Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Test Env

Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/cargo-odra/index.html b/docs/docs/0.2.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..8c22bb789 --- /dev/null +++ b/docs/docs/0.2.0/basics/cargo-odra/index.html @@ -0,0 +1,39 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.2.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them on multiple backends (blockchains).

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands will help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This will create a new project in the my-project folder and name it my-project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my-project"
version = "0.1.0"
edition = "2021"

The project is created using an existing template located in +https://github.com/odradev/odra-template. +If you want, you can use your own template, by passing -r parameter:

cargo odra new -r https://github.com/my-repo/my-odra-template --name my-project

Additionally, you can pass a branch name you want to use using -g, otherwise, the default +branch will be used. To see an example of a template, take a look at the repository linked above.

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it will create a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This will create a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

Most used command during the development of your project should be this one:

cargo odra test

It will run your tests against Odra's MockVM. It is substantially faster than virtual machines +provided by blockchains developers and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files, +spin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat. +Keep in mind that this is a lot slower than MockVM and you cannot use the debugger. +This is why MockVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build -b casper

Where casper is the name of the backend we are using in this example. If the build process +finishes successfully, wasm files will be located in wasm folder.

Updating dependencies

You will learn later, that the project using Odra contains more than one Rust project - your own and +one or more builders. To run cargo update on all of them at once instead of traversing all the folders +you can use this command:

cargo odra update

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/communicating-with-host/index.html b/docs/docs/0.2.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..69592a486 --- /dev/null +++ b/docs/docs/0.2.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.2.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/docs/host.rs
use odra::Variable;
use odra::types::{BlockTime, Address};

#[odra::module]
pub struct HostContract {
name: Variable<String>,
created_at: Variable<BlockTime>,
created_by: Variable<Address>,
}

#[odra::module]
impl HostContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(odra::contract_env::get_block_time());
self.created_by.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are calling functions from odra::contract_env. get_block_time() will return +the current block time wrapped in Odra type Blocktime. caller() will return an Odra Address of +a caller (this can be an external caller or another contract).

info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/cross-calls/index.html b/docs/docs/0.2.0/basics/cross-calls/index.html new file mode 100644 index 000000000..923b13ffb --- /dev/null +++ b/docs/docs/0.2.0/basics/cross-calls/index.html @@ -0,0 +1,25 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.2.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/docs/cross_calls.rs
use odra::Variable;
use odra::types::{Address};

#[odra::module]
pub struct CrossContract {
pub math_engine: Variable<Address>,
}

#[odra::module]
impl CrossContract {
#[odra(init)]
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap();
MathEngineRef::at(math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine {
}

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To call the external contract, we use the Ref that was created for us by Odra:

examples/src/docs/cross_calls.rs
MathEngineRef::at(math_engine_address).add(3, 5)

Contract Ref

We mentioned Ref already in our Testing article. +It is a reference to already deployed - running contract. +Here we are going to take a deeper look at it.

Similarly to a Deployer, the Ref is generated automatically, thanks to the #[odra::module] macro. +To get an instance of a reference, we can either deploy a contract (using Deployer) or by building it +directly, using ::at(address: Address) method, as shown above. +The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), alongside couple methods:

  • at(Address) -> Self - points the reference to an Address
  • address() -> Address - returns the Address the reference is currently pointing at
  • with_tokens(Amount) -> Self - attaches Amount of native tokens to the next call

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

examples/src/docs/cross_calls.rs
#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderRef struct (but do not create the AdderDeployer). Having an address we can call:

examples/src/docs/cross_calls.rs
AdderRef::at(address).add(3, 5)

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/docs/cross_calls.rs
use super::{CrossContractDeployer, MathEngineDeployer};

#[test]
fn test_cross_calls() {
let math_engine_contract = MathEngineDeployer::default();
let cross_contract = CrossContractDeployer::init(math_engine_contract.address());

assert_eq!(cross_contract.add_using_another(), 8);
}

Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a MathEngine contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the add() function we want to use.

examples/src/docs/cross_calls.rs
#[cfg(test)]
mod tests {
use odra::types::Address;
use crate::docs::cross_calls::{Adder, AdderRef};

#[test]
fn test_ext() {
let adder = AdderRef::at(get_adder_address());

assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address() -> Address {
let contract = MathEngineDeployer::default();
contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/directory-structure/index.html b/docs/docs/0.2.0/basics/directory-structure/index.html new file mode 100644 index 000000000..0a953e19a --- /dev/null +++ b/docs/docs/0.2.0/basics/directory-structure/index.html @@ -0,0 +1,27 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.2.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── .builder_casper/
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.2.0", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

By default, your project will use the latest odra version available at crates.io. We are using two features:

  • odra/mock-vm - it is responsible for running tests on Odra's MockVM
  • odra/casper - backend implementation of Casper blockchain +More backends will be released as features that will be possible to enable here.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

.builder_* folders

Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary +for building wasm files and running them against blockchain VMs. As it is not necessary to modify +files in those folders in any way, by default they are hidden (hence the . at the beginning of the +folder name).

src/

This is the folder where your smart contract files live.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain of your choosing.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/errors/index.html b/docs/docs/0.2.0/basics/errors/index.html new file mode 100644 index 000000000..a32e51763 --- /dev/null +++ b/docs/docs/0.2.0/basics/errors/index.html @@ -0,0 +1,23 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.2.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/docs/errors.rs
use odra::{execution_error, Variable, UnwrapOrRevert};
use odra::types::Address;

#[odra::module]
pub struct OwnedContract {
name: Variable<String>,
owner: Variable<Address>,
}

execution_error! {
pub enum Error {
OwnerNotSet => 1,
NotAnOwner => 2,
}
}


#[odra::module]
impl OwnedContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = odra::contract_env::caller();
if caller != self.owner() {
odra::contract_env::revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using execution_error! macro to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/docs/errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You and the users of your contract will be thankful for a meaningful error message!

You can also throw the error directly, by using revert:

examples/src/docs/errors.rs
odra::contract_env::revert(Error::NotAnOwner)

Testing errors

Okay, but how about testing it? We've already mentioned a function - assert_exception. This is how you will +use it:

examples/src/docs/errors.rs
use super::{OwnedContractDeployer, OwnedContractRef};
use super::Error;

#[test]
fn test_owner_error() {
let owner = odra::test_env::get_account(0);
let not_an_owner = odra::test_env::get_account(1);

odra::test_env::set_caller(owner);
let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());

odra::test_env::set_caller(not_an_owner);
odra::test_env::assert_exception(Error::NotAnOwner, || {
let mut owned_contract = OwnedContractRef::at(owned_contract.address());
owned_contract.change_name("NewName".to_string());
})
}

In the example above, because we are calling the change_name method as an address which is not an "owner", +we are expecting that "NotAnOwner" error will be thrown.

note

Here we are creating another reference to the already deployed contract using OwnedContractRef::at() and passing to it +its Address. Note that OwnedContractDeployer::init() returns the same type.

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/events/index.html b/docs/docs/0.2.0/basics/events/index.html new file mode 100644 index 000000000..d4235feee --- /dev/null +++ b/docs/docs/0.2.0/basics/events/index.html @@ -0,0 +1,20 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.2.0

Events

Different blockchains implement events in different ways. Odra lets you forget about it by introducing +Odra Events. Take a look:

examples/src/docs/events.rs
use odra::{Event, contract_env};
use odra::types::{Address, BlockTime, event::OdraEvent};

#[odra::module]
pub struct PartyContract {
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

#[odra::module]
impl PartyContract {
#[odra(init)]
pub fn init(&self) {
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, we derive an Event macro like this:

examples/src/docs/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

Among other things, it adds an emit() function to the struct, which allows you to emit the event simply +as that:

examples/src/docs/events.rs
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();

Testing events

Odra's test_env comes with a handy macro assert_events! which lets you easily test the events that a given contract has emitted:

examples/src/docs/events.rs
use odra::{assert_events, test_env};
use crate::docs::events::PartyStarted;
use super::PartyContractDeployer;

#[test]
fn test_party() {
let party_contract = PartyContractDeployer::init();
assert_events!(
party_contract,
PartyStarted {
caller: test_env::get_account(0),
block_time: 0,
}
);
}

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/flipper-internals/index.html b/docs/docs/0.2.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..d5bea76f6 --- /dev/null +++ b/docs/docs/0.2.0/basics/flipper-internals/index.html @@ -0,0 +1,35 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.2.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Variable;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Variable, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Variables and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Variable<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The #[odra(init)] macro marks the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Variable<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using FlipperDeployer - a piece of code generated automatically thanks to the macros. +The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/modules/index.html b/docs/docs/0.2.0/basics/modules/index.html new file mode 100644 index 000000000..3fdb91640 --- /dev/null +++ b/docs/docs/0.2.0/basics/modules/index.html @@ -0,0 +1,20 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.2.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to a macro #[odra::module]. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/docs/modules.rs
use crate::docs::cross_calls::MathEngine;

#[odra::module]
pub struct ModulesContract {
pub math_engine: MathEngine,
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/docs/modules.rs
use super::ModulesContractDeployer;

#[test]
fn test_modules() {
let modules_contract = ModulesContractDeployer::default();
assert_eq!(modules_contract.add_using_module(), 8);
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/native-token/index.html b/docs/docs/0.2.0/basics/native-token/index.html new file mode 100644 index 000000000..4fa82b639 --- /dev/null +++ b/docs/docs/0.2.0/basics/native-token/index.html @@ -0,0 +1,26 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.2.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::contract_env;

#[odra::module]
pub struct PublicWallet {
}

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {
}

pub fn withdraw(&mut self, amount: Balance) {
contract_env::transfer_tokens(contract_env::caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/tlw.rs in the odra main repository.

You can see a new macro used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from contract_env - transfer_tokens. +It does exactly what you are expecting it to do - it will transfer native tokens from the contract to the +specified address.

We are also using the Balance - an Odra type that wraps around the type that the underlying blockchain uses +for counting tokens.

Testing

To be able to test how many tokens a contract (or any address) has, test_env comes with a function - +token_balance:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::test_env;
use super::PublicWalletDeployer;

#[test]
fn test_modules() {
let mut my_contract = PublicWalletDeployer::default();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());

my_contract.with_tokens(Balance::from(100)).deposit();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));

my_contract.withdraw(Balance::from(25));
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/odra-toml/index.html b/docs/docs/0.2.0/basics/odra-toml/index.html new file mode 100644 index 000000000..efc5046e1 --- /dev/null +++ b/docs/docs/0.2.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.2.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

The name will be used as a name for the contract - the generated wasm file will be in the above case named +flipper.wasm.

The fqn (Fully Qualified Name) is used by the builder to locate the exact struct where +the contract is defined.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

[[contracts]]
name = "counter"
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/storage-interaction/index.html b/docs/docs/0.2.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..154830bf7 --- /dev/null +++ b/docs/docs/0.2.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.2.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Variable

The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Variable type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/docs/variable.rs
#[odra::module]
pub struct DogContract {
barks: Variable<bool>,
weight: Variable<u32>,
name: Variable<String>,
pets: Variable<Vec<u32>>,
}

You can see the Variable wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/docs/variable.rs
use odra::Variable;

#[odra::module]
impl DogContract {
#[odra(init)]
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/docs/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/docs/variable.rs
self.barks.set(barks);

A Variable is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/docs/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/docs/mapping.rs
use odra::{Mapping, Variable};

#[odra::module]
pub struct DogContract2 {
name: Variable<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Variables section with one difference - we need to pass a key:

examples/src/docs/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
match self.friends.get(&friend_name) {
None => {
0
},
Some(v) => {
v
}
}
}

The biggest improvement over a Variable is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behaviour by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Variable working together:

core/src/list.rs
use odra::{Variable, List};

pub struct List<T> {
values: Mapping<u32, T>,
index: Variable<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/docs/list.rs
#[odra::module]
pub struct DogContract3 {
name: Variable<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/docs/list.rs
#[odra::module]
impl DogContract3 {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the odra repository in the examples/src/docs/ folder.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/basics/testing/index.html b/docs/docs/0.2.0/basics/testing/index.html new file mode 100644 index 000000000..96a2c2e84 --- /dev/null +++ b/docs/docs/0.2.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.2.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/docs/list.rs
use odra::{Variable, List};

#[cfg(test)]
mod tests {
use super::DogContract3Deployer;

#[test]
fn init_test() {
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The #[odra(module)] macro created a Deployer code for us, which will deploy the contract on the +VM:

examples/src/docs/list.rs
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with a macro are available to us:

examples/src/docs/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

Test env

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/docs/testing.rs
#[cfg(test)]
mod tests {
use super::TestingContractDeployer;

#[test]
fn test_env() {
let testing_contract = TestingContractDeployer::init("MyContract".to_string());
let creator = testing_contract.created_by();
odra::test_env::set_caller(odra::test_env::get_account(1));
let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());
let creator2 = testing_contract2.created_by();
assert!(creator != creator2);
}
}

In the code above, we are deploying two instances of the same contract, but we're using odra::test_env::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::contract_env::caller() +the function we are calling inside the contract.

Each test env comes with a set of functions that will let you write better tests:

  • fn set_caller(address: Address) - you've seen it in action just now
  • fn token_balance(address: Address) -> Balance - it returns the balance of the account associated with the given address
  • fn advance_block_time_by(seconds: BlockTime) - it increases the current value of block_time
  • fn get_account(n: usize) -> Address - it returns an nth address that was prepared for you by Odra in advance; +by default, you start with the 0th account
  • fn assert_exception<F, E>(err: E, block: F) - it executes the block code and expects err to happen
  • fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError> - returns +the event emitted by the contract

Again, we'll see those used in the next articles.

Deployer

You may be wondering what is the TestingContractDeployer and where did it come from. +It is a piece of code generated automatically for you, thanks to the #[odra::module] macro. +If you used the #[odra(init)] on one of the methods, it will be the constructor of your contract. +Odra will make sure that it is called only once, so you can use it to initialize your data structures etc.

If you do not provide the init method, you can deploy the contract using ::default() method. +In the end, you will get a Ref instance (in our case the TestingContractRef) which reimplements all +the methods you defined in the contract, but executes them on a blockchain!

To learn more about the Ref contract, visit the Cross calls article.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/category/backends/index.html b/docs/docs/0.2.0/category/backends/index.html new file mode 100644 index 000000000..150166532 --- /dev/null +++ b/docs/docs/0.2.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/category/basics/index.html b/docs/docs/0.2.0/category/basics/index.html new file mode 100644 index 000000000..61667d908 --- /dev/null +++ b/docs/docs/0.2.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/category/examples/index.html b/docs/docs/0.2.0/category/examples/index.html new file mode 100644 index 000000000..7d34e2e8e --- /dev/null +++ b/docs/docs/0.2.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/category/getting-started/index.html b/docs/docs/0.2.0/category/getting-started/index.html new file mode 100644 index 000000000..3694b3025 --- /dev/null +++ b/docs/docs/0.2.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/category/tutorials/index.html b/docs/docs/0.2.0/category/tutorials/index.html new file mode 100644 index 000000000..831fc3ab1 --- /dev/null +++ b/docs/docs/0.2.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/examples/odra-examples/index.html b/docs/docs/0.2.0/examples/odra-examples/index.html new file mode 100644 index 000000000..bbeb7cfdc --- /dev/null +++ b/docs/docs/0.2.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.2.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/examples/using-odra-modules/index.html b/docs/docs/0.2.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..4e32d131b --- /dev/null +++ b/docs/docs/0.2.0/examples/using-odra-modules/index.html @@ -0,0 +1,17 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.2.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.2.0", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]
casper = ["odra/casper", "odra-modules/casper"]
danger

odra-modules defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a casper feature in your project, add odra-modules/casperspecifically (it applies to each backend).

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::types::{Address, U256};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/getting-started/flipper/index.html b/docs/docs/0.2.0/getting-started/flipper/index.html new file mode 100644 index 000000000..02107fca8 --- /dev/null +++ b/docs/docs/0.2.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.2.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Variable;

/// A module definition. Each module struct consists Variables and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let mut contract1 = FlipperDeployer::initial_settings();
let contract2 = FlipperDeployer::initial_settings();
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/getting-started/installation/index.html b/docs/docs/0.2.0/getting-started/installation/index.html new file mode 100644 index 000000000..24b22eba1 --- /dev/null +++ b/docs/docs/0.2.0/getting-started/installation/index.html @@ -0,0 +1,23 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.2.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-uknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my-project

This will create a new folder called "my-project" and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal MockVM. You can run those tests against a real backend, to do so +we need to add a new backend. Let's use CasperVM:

cargo odra backend add -p casper

Now we can run the tests against it:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/index.html b/docs/docs/0.2.0/index.html new file mode 100644 index 000000000..ee0a3d162 --- /dev/null +++ b/docs/docs/0.2.0/index.html @@ -0,0 +1,25 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.2.0

Odra framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, +pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open +source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. We can do it +by abstracting over core concepts that all the above systems are built around. These are type system, +storage, entry points, execution context, and testing environment. We believe it will bring standardization +to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this +ecosystem.

What's next

See the Installation and our Flipper example +to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/tutorials/erc20/index.html b/docs/docs/0.2.0/tutorials/erc20/index.html new file mode 100644 index 000000000..a56d6773e --- /dev/null +++ b/docs/docs/0.2.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.2.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • advanced storage - key-value pairs,
  • Odra types like Address or Balance,
  • advanced events assertion.

Code

Our module has a pretty complex storage layout in comparison to the previous example.

We need to store the following data:

  1. Immutable metadata - name, symbol and decimals.
  2. Total supply.
  3. Users' balances.
  4. Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.

Module definition

#[odra::module]
pub struct Erc20 {
decimals: Variable<u8>,
symbol: Variable<String>,
name: Variable<String>,
total_supply: Variable<Balance>,
balances: Mapping<Address, Balance>,
allowances: Mapping<(Address, Address), Balance>
}
  • L6 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping. You may notice the balances property maps Address to Balance. If you deal with addresses or you operate on tokens, you should always choose Address over String and Balance over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform.
  • L7 - Odra does not allow nested Mappings, but you can overcome it using a tuple as a key.

Metadata

#[odra::module]
impl Erc20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: Balance) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(caller, initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> Balance {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: Address, amount: Balance) {
self.balances.add(&address, amount);
self.total_supply.add(amount);
Transfer {
from: None,
to: Some(address),
amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: Balance
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L10 - A constructor sets the token metadata and mints the initial supply.
  • L12-L14 - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the Ownable example, we used the get() function returning an Option<T>. If the type implements Default trait, you can call get_or_default() function and the contract does not fail even if the value is not initialized.
  • L29 - The second impl is not an odra module, in other words these function will not be a part of contract's ABI.
  • L30-L39 - Mint function is public, so like in a regular rust code will be accessible from the outside. mint() use notation self.balances.add(&address, amount);, which it is syntactic sugar for:
let current_balance = self.balances.get(&address).unwrap_or_default();
let new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();
self.balances.set(&address, new_balance);

Core

For the sake of completeness, let's implement the remaining functionalities like transfer, transfer_from, or approve. They are not introducing any new concepts, so we leave them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...
pub fn transfer(&mut self, recipient: Address, amount: U256) {
let caller = contract_env::caller();
self.raw_transfer(caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
let spender = contract_env::caller();
self.spend_allowance(owner, spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
let owner = contract_env::caller();
self.allowances.set(&(owner, spender), amount);
Approval {
owner,
spender,
value: amount
}
.emit();
}

pub fn balance_of(&self, address: Address) -> U256 {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.allowances.get_or_default(&(owner, spender))
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: Address, recipient: Address, amount: U256) {
let owner_balance = self.balances.get_or_default(&owner);
if amount > owner_balance {
contract_env::revert(Error::InsufficientBalance)
}
self.balances.set(&owner, owner_balance - amount);
self.balances.add(&recipient, amount);
Transfer {
from: Some(owner),
to: Some(recipient),
amount
}
.emit();
}

fn spend_allowance(&mut self, owner: Address, spender: Address, amount: U256) {
let key = (owner, spender);
let allowance = self.allowances.get_or_default(&key);
if allowance < amount {
contract_env::revert(Error::InsufficientAllowance)
}
self.allowances.set(&key, allowance - amount);
Approval {
owner,
spender,
value: allowance - amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20rs
#[cfg(test)]
pub mod tests {
use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};
use odra::{assert_events, test_env, types::U256};

pub const NAME: &str = "Plascoin";
pub const SYMBOL: &str = "PLS";
pub const DECIMALS: u8 = 10;
pub const INITIAL_SUPPLY: u32 = 10_000;

pub fn setup() -> Erc20Ref {
Erc20Deployer::init(
String::from(NAME),
String::from(SYMBOL),
DECIMALS,
INITIAL_SUPPLY.into()
)
}

#[test]
fn initialization() {
let erc20 = setup();

assert_eq!(&erc20.symbol(), SYMBOL);
assert_eq!(&erc20.name(), NAME);
assert_eq!(erc20.decimals(), DECIMALS);
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());
assert_events!(
erc20,
Transfer {
from: None,
to: Some(test_env::get_account(0)),
amount: INITIAL_SUPPLY.into()
}
);
}

#[test]
fn transfer_works() {
let mut erc20 = setup();
let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

erc20.transfer(recipient, amount);

assert_eq!(
erc20.balance_of(sender),
U256::from(INITIAL_SUPPLY) - amount
);
assert_eq!(erc20.balance_of(recipient), amount);
assert_events!(
erc20,
Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
);
}

#[test]
fn transfer_error() {
let erc20 = setup();
let recipient = test_env::get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);

test_env::assert_exception(Error::InsufficientBalance, || {
// If we don't create a new ref, an error occurs:
// cannot borrow `erc20` as mutable, as it is a captured variable
// in a `Fn` closure cannot borrow as mutable
let mut erc20 = Erc20Ref::at(erc20.address());
erc20.transfer(recipient, amount)
});
}

#[test]
fn transfer_from_and_approval_work() {
let mut erc20 = setup();
let (owner, recipient, spender) = (
test_env::get_account(0),
test_env::get_account(1),
test_env::get_account(2)
);
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

// Owner approves Spender.
erc20.approve(spender, approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(owner, spender), approved_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount
}
);

// Spender transfers tokens from Owner to Recipient.
test_env::set_caller(spender);
erc20.transfer_from(owner, recipient, transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(recipient), transfer_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount - transfer_amount
},
Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
);

assert_events!(erc20, Approval, Transfer);
}

#[test]
fn transfer_from_error() {
let erc20 = setup();
let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

test_env::set_caller(spender);
test_env::assert_exception(Error::InsufficientAllowance, || {
// If we don't create a new ref, an error occurs:
// cannot borrow `erc20` as mutable, as it is a captured variable
// in a `Fn` closure cannot borrow as mutable
let mut erc20 = Erc20Ref::at(erc20.address());
erc20.transfer_from(owner, spender, amount)
});
}
}
  • L111-123 - assert_events!() macro accepts multiple events. You must pass them in the order they were emitted.
  • L125 - Alternatively, if you don't want to check the entire event, you may assert only its type.
danger

You can not mix both approaches, you pass full events or types only.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/tutorials/ownable/index.html b/docs/docs/0.2.0/tutorials/ownable/index.html new file mode 100644 index 000000000..be752d934 --- /dev/null +++ b/docs/docs/0.2.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.2.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining constructors,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

use odra::{types::Address, Variable};

#[odra::module]
pub struct Ownable {
owner: Variable<Address>
}

That was easy, but it is crucial to understand the basic before we move on.

  • L3 - Firstly, we need create a struct called Ownable and apply #[odra::module] to it above.
  • L5 - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with Variable.

Init the module

use odra::{execution_error, contract_env, Event, types::{Address, event::OdraEvent};

...

#[odra::module]
impl Ownable {
#[odra(init)]
pub fn init(&mut self, owner: Address) {
if self.owner.get().is_some() {
contract_env::revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(owner);

OwnershipChanged {
prev_owner: None,
new_owner: owner
}
.emit();
}
}

execution_error! {
pub enum Error {
OwnerIsNotInitialized => 1,
}
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L5 - The impl should be an odra module, so add #[odra::module].
  • L7 - The init function is marked as #[odra(init)] making it a constructor. It matters if we would like to deploy the Ownable module as a standalone contract.
  • L23 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an Error enum. Notice that the Error enum is defined inside the execution_error macro. It generates, among others, the required Into<ExecutionError> binding.
  • L9-L11 - If the owner has been set already, we call contract_env::revert() function. As an argument we pass Error::OwnerIsNotInitialized.
  • L13 - Then we write the owner passed as an argument to the storage. To do so we call the set() on Variable.
  • L29-L33 - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L23 - Finally, we create the OwnershipChanged struct and call emit() function on it (import odra::types::event::OdraEvent trait). Hence we set the first owner, we set the prev_owner value to None.

Features implementation

#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: Address) {
if Some(address) != self.owner.get() {
contract_env::revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: Address) {
self.ensure_ownership(contract_env::caller());
let current_owner = self.get_owner();
self.owner.set(new_owner);
OwnershipChanged {
prev_owner: Some(current_owner),
new_owner
}
.emit();
}

pub fn get_owner(&self) -> Address {
match self.owner.get() {
Some(owner) => owner,
None => contract_env::revert(Error::OwnerIsNotInitialized)
}
}
}

execution_error! {
pub enum Error {
NotOwner => 1,
OwnerIsAlreadyInitialized => 2,
OwnerIsNotInitialized => 3,
}
}

The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along.

  • L5,L32 - ensure_ownership() is reads the current owner, and reverts if is does not match the input Address. Also we need to update our Error enum adding a new variant NotOwner.
  • L11 - The function defined above can be reused in change_ownership() implementation. We pass to it the current caller, using the contract_env::caller() function. The we update the state, and emit OwnershipChanged.
  • L22,L34 - Lastly, a getter function. As the Variable get() function returns an Option, we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized.

Test

#[cfg(test)]
mod tests {
use super::*;
use odra::{assert_events, test_env};

fn setup() -> (Address, OwnableRef) {
let owner = test_env::get_account(0);
let ownable = OwnableDeployer::init(owner);
(owner, ownable)
}

#[test]
fn initialization_works() {
let (owner, ownable) = setup();
assert_eq!(ownable.get_owner(), owner);

assert_events!(
ownable,
OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (owner, mut ownable) = setup();
let new_owner = test_env::get_account(1);

test_env::set_caller(owner);
ownable.change_ownership(new_owner);
assert_eq!(ownable.get_owner(), new_owner);
assert_events!(
ownable,
OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (_, mut ownable) = setup();
let new_owner = test_env::get_account(1);
ownable.change_ownership(new_owner);

test_env::assert_exception(Error::NotOwner, || {
// If we don't create a new ref, an error occurs:
// cannot borrow `ownable` as mutable, as it is
// a captured variable in a `Fn` closure cannot borrow as mutable
let mut ownable = OwnableRef::at(ownable.address());
ownable.change_ownership(new_owner);
});
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we defined the setup() function we call as the first statement in each test. Take a look at the signature fn setup() -> (Address, OwnableRef). OwnableRef is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ensure_ownership(), change_ownership(), get_owner(), but not init() which is a constructor.
  • L7 - Now, the module needs an owner, the easiest way is to take one from the test_env. We choose the address of first account (which is the default one).
  • L8 - Odra created for us OwnableDeployer struct which implements all constructor functions. In this case there is just one function - init() which corresponds the function we have implemented in the module.
  • L12 - It is time to define the first test. As you see, it is a regular rust test.
  • L14-15 - Using the setup() function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L17-23 - On the contract, only the init() function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro assert_events. As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred.
  • L30 - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the test env predefines 20 accounts.
  • L32 - As mentioned, the default is the 0-th account, if you want to change the executor call the test_env::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L49-55 - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call test_env::assert_exception() with the error you expect and a failing block of code.
    note

    In the test we create a second contract reference let mut ownable = OwnableRef::at(ownable.address());. As the name stands, it is just a reference, we interact with the same contract - only the address matters.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.2.0/tutorials/owned-token/index.html b/docs/docs/0.2.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..4282b2394 --- /dev/null +++ b/docs/docs/0.2.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.2.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow minting tokens but only the module owner.
  3. The current owner should be able to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
use odra::types::{Address, Balance}

...

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: Balance) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> Balance {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> Balance {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> Balance {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: Balance) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: Balance) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: Balance) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: Address, amount: Balance) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L10-L11 - A constructor is a great place to init both modules at once.
  • L14-L16 - Most of the entrypoints do not need any modification, so we simply delegates them to the erc20 module.
  • L50-L52 - The same we do with the ownable module.
  • L58-L61 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/advanced/advanced-storage/index.html b/docs/docs/0.3.0/advanced/advanced-storage/index.html new file mode 100644 index 000000000..152640290 --- /dev/null +++ b/docs/docs/0.3.0/advanced/advanced-storage/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.3.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Variable, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values.

Variable: A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that holds a Variable which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Variable<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility.

Let's consider the following example:

examples/mapping.rs
use odra::{map, types::U256, Mapping, UnwrapOrRevert};

use crate::owned_token::OwnedToken;

#[odra::module]
pub struct NestedMapping {
strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,
tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>
}

#[odra::module]
impl NestedMapping {

...

pub fn set_token(
&mut self,
key1: String,
key2: u32,
key3: String,
token_name: String,
decimals: u8,
symbol: String,
initial_supply: &U256
) {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.init(token_name, symbol, decimals, initial_supply);
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let mapping = self.strings.get_instance(&key1).get_instance(&key2);
mapping.get(&key3).unwrap_or_revert()
}

pub fn total_supply(
&self,
key1: String,
key2: u32,
key3: String
) -> U256 {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.total_supply()
}
}
note

Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers.

Instead of using the get() function, call get_instance(), which sets the correct namespace for nested modules.

If the terminal value is deeply nested, a long chain of get_instance() calls is required.

To keep the codebase consistent, a map! macro can be used:

examples/mapping.rs
...

pub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {
map!(self.strings[key1][key2][key3] = value);
}

pub fn get_string_macro(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
map!(self.strings[key1][key2][key3])
}

danger

The terminal value must not be an Odra Module.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Sequence, Mapping};
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
my_sequence: Sequence<u32>,
my_mapping: Mapping<String, Mapping<String, Token>>,
}

impl AdvancedStorage {
pub fn get_sequence_current_value(&self) -> u32 {
self.my_sequence.get_current_value()
}

pub fn next_sequence_value(&mut self) -> u32 {
self.my_sequence.next_value()
}

pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.set(&inner_key, value);
}

pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.get(&inner_key)
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/advanced/attributes/index.html b/docs/docs/0.3.0/advanced/attributes/index.html new file mode 100644 index 000000000..272f4b219 --- /dev/null +++ b/docs/docs/0.3.0/advanced/attributes/index.html @@ -0,0 +1,18 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.3.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Init

If your contract needs initial setup, adding the #[odra(init)] attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed.

It's important to note that a constructor function should not be invoked in any other context.

Example

examples/erc20.rs
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = contract_env::caller();
let amount: Balance = contract_env::attached_value();
let current_block_time: BlockTime = contract_env::get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
contract_env::revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
Deposit {
address: caller,
amount
}
.emit();
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

However, a constructor cannot be payable, so the below code would not compile.

#[odra(payable)]
#[odra(init)]
fn initialize() {
// your logic...
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/advanced/composer/index.html b/docs/docs/0.3.0/advanced/composer/index.html new file mode 100644 index 000000000..7aae1d4df --- /dev/null +++ b/docs/docs/0.3.0/advanced/composer/index.html @@ -0,0 +1,17 @@ + + + + + +Module Composer | Odra + + + + + +
+
Version: 0.3.0

Module Composer

The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.

Conceptual Overview

By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key.

#[odra::module]
struct Contract {
value: Variable<u8>, // the default namespace would be "contract_value"
module: Module
}

#[odra::module]
struct Module {
secret: Variable<String> // the default namespace would be "contract_module_secret"
}

While this isolation often proves useful, there are scenarios where shared storage is beneficial. Here, the Module Composer comes in.

Additionally, the Module Composer shortens the storage key - a handy side effect of shared storage.

For each module, Odra generates a corresponding Composer struct (e.g., MyContractComposer for MyContract module), which aids in manual module composition.

Usage

By default, the #[odra::module] macro generates an implementation of the odra::Instance trait, prefixing the storage key of child modules with the parent namespace. To disable this behavior, pass the skip_instance argument to the #[odra::module] macro.

Let's write a simple code example. The example provided below introduces some additional complexity by featuring deeper module nesting.

use odra::{Instance, Variable};

#[odra::module]
pub struct SharedStorage {
pub value: Variable<String>
}

#[odra::module]
pub struct MyStorage {
pub shared: SharedStorage,
pub version: Variable<u8>
}

#[odra::module]
pub struct MoreStorage {
pub my_storage: MyStorage,
pub extra: Variable<u32>
}

#[odra::module(skip_instance)]
pub struct ComplexContract {
pub shared: SharedStorage,
pub more_storage: MoreStorage
}

#[odra::module]
impl ComplexContract {
#[odra(init)]
pub fn init(&mut self, version: u8, value: String, extra: u32) {
self.more_storage.my_storage.version.set(version);
self.shared.value.set(value);
self.more_storage.extra.set(extra);
}

pub fn get_value(&self) -> String {
self.shared.value.get_or_default()
}

pub fn get_value_via_storage(&self) -> String {
self.more_storage.my_storage.shared.value.get_or_default()
}

pub fn get_extra_value(&self) -> u32 {
self.more_storage.extra.get_or_default()
}
}

impl Instance for ComplexContract {
fn instance(namespace: &str) -> Self {
let shared = SharedStorageComposer::new(namespace, "shared").compose();
let my_storage = MyStorageComposer::new(namespace, "my_storage")
.with_shared(&shared)
.compose();
let more_storage = MoreStorageComposer::new(namespace, "more_storage")
.with_my_storage(&my_storage)
.compose();
Self { shared, more_storage }
}
}

#[cfg(test)]
mod test {
use crate::composer::ComplexContractDeployer;

#[test]
fn t() {
let shared_value = "shared_value".to_string();
let extra_value: u32 = 314;
let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);

assert_eq!(token.get_value(), shared_value);
assert_eq!(token.get_value_via_storage(), shared_value);
assert_eq!(token.get_extra_value(), extra_value);
}
}

In this example, we've introduced a new module, MoreStorage, which nests MyStorage and includes an extra value. The ComplexContract contains SharedStorage and MoreStorage, creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels.

If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:

  1. On the contract level - contract_shared_value.
  2. On the MyStorage module level - contract_more_storage_shared_value.

This example showcases how you can effectively use the Module Composer feature to build intricate and efficient smart contracts.

Conclusion

The Module Composer in Odra provides developers with a high level of flexibility and control over module behavior in their smart contracts. This guide, complete with a practical example, should give you a good understanding of the feature. Embrace the power of the Module Composer and unleash the full potential of your smart contracts!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/advanced/delegate/index.html b/docs/docs/0.3.0/advanced/delegate/index.html new file mode 100644 index 000000000..54064506c --- /dev/null +++ b/docs/docs/0.3.0/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.3.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
pub fn approve(&mut self, spender: Address, amount: U256);
pub fn name(&self) -> String;
pub fn symbol(&self) -> String;
pub fn decimals(&self) -> u8;
pub fn total_supply(&self) -> U256;
pub fn balance_of(&self, owner: Address) -> U256;
pub fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
pub fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};

#[odra::module]
pub struct DeFiPlatform {
ownable: Ownable,
erc20: Erc20,
exchange: Exchange
}

#[odra::module]
impl DeFiPlatform {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
}

to self.exchange {
pub fn swap(&mut self, sender: Address, recipient: Address);
pub fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/backends/casper/index.html b/docs/docs/0.3.0/backends/casper/index.html new file mode 100644 index 000000000..ef0ad9f5d --- /dev/null +++ b/docs/docs/0.3.0/backends/casper/index.html @@ -0,0 +1,25 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.3.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Types

A struct to be written into the storage must implement OdraType which is defined as follow:

pub trait OdraType: 
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

The other exposed types are:

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with [Casper Event Standard] and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement SerializableEvent which is defined as follow:

pub trait SerializableEvent: 
odra_types::event::OdraEvent +
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling contract_env::attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The contract_env::self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The contract_env::caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call contract_env::self_balance, which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Constructors

Let's define a basic Odra module that includes a constructor:

#[odra::module]
struct Counter {
value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub initialize(&mut self, value: u32) {
self.value.set(value);
}
}

Read more about constructors here.

To deploy your contract with a constructor using casper-client, you need to pass the constructor argument with a value of initialize - this represents the name of the constructor function. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "constructor:string:'initialize'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Execution

First thing Odra does with your code, is similar to the one used in MockVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/backends/mock-vm/index.html b/docs/docs/0.3.0/backends/mock-vm/index.html new file mode 100644 index 000000000..7c2e0df10 --- /dev/null +++ b/docs/docs/0.3.0/backends/mock-vm/index.html @@ -0,0 +1,26 @@ + + + + + +MockVM | Odra + + + + + +
+
Version: 0.3.0

MockVM

The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler.

Usage

The MockVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

MockVM consists of two main parts: the Contract Register and the State.

The Contract Register is just a list of contracts deployed onto the MockVM, identified by an Address. +Each time we call the contract, we call its instance stored in the Contract Register.

Contracts and Test Env functions can modify the State of the MockVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the MockVM State holds only the current state of the MockVM. +Thanks to this and the fact that we do not need the blockchain itself, +MockVM starts instantly and runs the tests in the native speed.

Execution

When the MockVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, MockVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/backends/what-is-a-backend/index.html b/docs/docs/0.3.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..baf6614f5 --- /dev/null +++ b/docs/docs/0.3.0/backends/what-is-a-backend/index.html @@ -0,0 +1,27 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.3.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like MockVM, +or a complete virtual machine, spinning up a blockchain for you - like CasperVM.

Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Test Env

Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/cargo-odra/index.html b/docs/docs/0.3.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..39ba64ae2 --- /dev/null +++ b/docs/docs/0.3.0/basics/cargo-odra/index.html @@ -0,0 +1,38 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.3.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them on multiple backends (blockchains).

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands will help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This will create a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it will create a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This will create a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

Most used command during the development of your project should be this one:

cargo odra test

It will run your tests against Odra's MockVM. It is substantially faster than virtual machines +provided by blockchains developers and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files, +spin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat. +Keep in mind that this is a lot slower than MockVM and you cannot use the debugger. +This is why MockVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build -b casper

Where casper is the name of the backend we are using in this example. If the build process +finishes successfully, wasm files will be located in wasm folder.

Updating dependencies

You will learn later, that the project using Odra contains more than one Rust project - your own and +one or more builders. To run cargo update on all of them at once instead of traversing all the folders +you can use this command:

cargo odra update

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/communicating-with-host/index.html b/docs/docs/0.3.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..a4e0b83f1 --- /dev/null +++ b/docs/docs/0.3.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.3.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/docs/host.rs
use odra::Variable;
use odra::types::{BlockTime, Address};

#[odra::module]
pub struct HostContract {
name: Variable<String>,
created_at: Variable<BlockTime>,
created_by: Variable<Address>,
}

#[odra::module]
impl HostContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(odra::contract_env::get_block_time());
self.created_by.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are calling functions from odra::contract_env. get_block_time() will return +the current block time wrapped in Odra type BlockTime. caller() will return an Odra Address of +a caller (this can be an external caller or another contract).

info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/cross-calls/index.html b/docs/docs/0.3.0/basics/cross-calls/index.html new file mode 100644 index 000000000..d3278192d --- /dev/null +++ b/docs/docs/0.3.0/basics/cross-calls/index.html @@ -0,0 +1,25 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.3.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/docs/cross_calls.rs
use odra::Variable;
use odra::types::{Address};

#[odra::module]
pub struct CrossContract {
pub math_engine: Variable<Address>,
}

#[odra::module]
impl CrossContract {
#[odra(init)]
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap();
MathEngineRef::at(math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine {
}

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To call the external contract, we use the Ref that was created for us by Odra:

examples/src/docs/cross_calls.rs
MathEngineRef::at(math_engine_address).add(3, 5)

Contract Ref

We mentioned Ref already in our Testing article. +It is a reference to already deployed - running contract. +Here we are going to take a deeper look at it.

Similarly to a Deployer, the Ref is generated automatically, thanks to the #[odra::module] macro. +To get an instance of a reference, we can either deploy a contract (using Deployer) or by building it +directly, using ::at(address: Address) method, as shown above. +The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), alongside couple methods:

  • at(Address) -> Self - points the reference to an Address
  • address() -> Address - returns the Address the reference is currently pointing at
  • with_tokens(Amount) -> Self - attaches Amount of native tokens to the next call

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

examples/src/docs/cross_calls.rs
#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderRef struct (but do not create the AdderDeployer). Having an address we can call:

examples/src/docs/cross_calls.rs
AdderRef::at(address).add(3, 5)

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/docs/cross_calls.rs
use super::{CrossContractDeployer, MathEngineDeployer};

#[test]
fn test_cross_calls() {
let math_engine_contract = MathEngineDeployer::default();
let cross_contract = CrossContractDeployer::init(math_engine_contract.address());

assert_eq!(cross_contract.add_using_another(), 8);
}

Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a MathEngine contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the add() function we want to use.

examples/src/docs/cross_calls.rs
#[cfg(test)]
mod tests {
use odra::types::Address;
use crate::docs::cross_calls::{Adder, AdderRef};

#[test]
fn test_ext() {
let adder = AdderRef::at(get_adder_address());

assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address() -> Address {
let contract = MathEngineDeployer::default();
contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/directory-structure/index.html b/docs/docs/0.3.0/basics/directory-structure/index.html new file mode 100644 index 000000000..e8a9aea28 --- /dev/null +++ b/docs/docs/0.3.0/basics/directory-structure/index.html @@ -0,0 +1,27 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.3.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── .builder_casper/
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.0", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

By default, your project will use the latest odra version available at crates.io. We are using two features:

  • odra/mock-vm - it is responsible for running tests on Odra's MockVM
  • odra/casper - backend implementation of Casper blockchain +More backends will be released as features that will be possible to enable here.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

.builder_* folders

Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary +for building wasm files and running them against blockchain VMs. As it is not necessary to modify +files in those folders in any way, by default they are hidden (hence the . at the beginning of the +folder name).

src/

This is the folder where your smart contract files live.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain of your choosing.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/errors/index.html b/docs/docs/0.3.0/basics/errors/index.html new file mode 100644 index 000000000..dbe63daba --- /dev/null +++ b/docs/docs/0.3.0/basics/errors/index.html @@ -0,0 +1,23 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.3.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/docs/errors.rs
use odra::{execution_error, Variable, UnwrapOrRevert};
use odra::types::Address;

#[odra::module]
pub struct OwnedContract {
name: Variable<String>,
owner: Variable<Address>,
}

execution_error! {
pub enum Error {
OwnerNotSet => 1,
NotAnOwner => 2,
}
}


#[odra::module]
impl OwnedContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = odra::contract_env::caller();
if caller != self.owner() {
odra::contract_env::revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using execution_error! macro to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/docs/errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You and the users of your contract will be thankful for a meaningful error message!

You can also throw the error directly, by using revert:

examples/src/docs/errors.rs
odra::contract_env::revert(Error::NotAnOwner)

Testing errors

Okay, but how about testing it? We've already mentioned a function - assert_exception. This is how you will +use it:

examples/src/docs/errors.rs
use super::{OwnedContractDeployer, OwnedContractRef};
use super::Error;

#[test]
fn test_owner_error() {
let owner = odra::test_env::get_account(0);
let not_an_owner = odra::test_env::get_account(1);

odra::test_env::set_caller(owner);
let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());

odra::test_env::set_caller(not_an_owner);
odra::test_env::assert_exception(Error::NotAnOwner, || {
let mut owned_contract = OwnedContractRef::at(owned_contract.address());
owned_contract.change_name("NewName".to_string());
})
}

In the example above, because we are calling the change_name method as an address which is not an "owner", +we are expecting that "NotAnOwner" error will be thrown.

note

Here we are creating another reference to the already deployed contract using OwnedContractRef::at() and passing to it +its Address. Note that OwnedContractDeployer::init() returns the same type.

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/events/index.html b/docs/docs/0.3.0/basics/events/index.html new file mode 100644 index 000000000..c89d6b02a --- /dev/null +++ b/docs/docs/0.3.0/basics/events/index.html @@ -0,0 +1,20 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.3.0

Events

Different blockchains implement events in different ways. Odra lets you forget about it by introducing +Odra Events. Take a look:

examples/src/docs/events.rs
use odra::{Event, contract_env};
use odra::types::{Address, BlockTime, event::OdraEvent};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract {
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

#[odra::module]
impl PartyContract {
#[odra(init)]
pub fn init(&self) {
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, we derive an Event macro like this:

examples/src/docs/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

Among other things, it adds an emit() function to the struct, which allows you to emit the event simply +as that:

examples/src/docs/events.rs
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();

Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] macro and use array-like syntax to list events your module emits.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's test_env comes with a handy macro assert_events! which lets you easily test the events that a given contract has emitted:

examples/src/docs/events.rs
use odra::{assert_events, test_env};
use crate::docs::events::PartyStarted;
use super::PartyContractDeployer;

#[test]
fn test_party() {
let party_contract = PartyContractDeployer::init();
assert_events!(
party_contract,
PartyStarted {
caller: test_env::get_account(0),
block_time: 0,
}
);
}

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/flipper-internals/index.html b/docs/docs/0.3.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..bfab289d4 --- /dev/null +++ b/docs/docs/0.3.0/basics/flipper-internals/index.html @@ -0,0 +1,35 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.3.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Variable;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Variable, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Variables and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Variable<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The #[odra(init)] macro marks the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Variable<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using FlipperDeployer - a piece of code generated automatically thanks to the macros. +The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/modules/index.html b/docs/docs/0.3.0/basics/modules/index.html new file mode 100644 index 000000000..211e65252 --- /dev/null +++ b/docs/docs/0.3.0/basics/modules/index.html @@ -0,0 +1,20 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.3.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to a macro #[odra::module]. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/docs/modules.rs
use crate::docs::cross_calls::MathEngine;

#[odra::module]
pub struct ModulesContract {
pub math_engine: MathEngine,
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/docs/modules.rs
use super::ModulesContractDeployer;

#[test]
fn test_modules() {
let modules_contract = ModulesContractDeployer::default();
assert_eq!(modules_contract.add_using_module(), 8);
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/native-token/index.html b/docs/docs/0.3.0/basics/native-token/index.html new file mode 100644 index 000000000..ea8f32939 --- /dev/null +++ b/docs/docs/0.3.0/basics/native-token/index.html @@ -0,0 +1,26 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.3.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::contract_env;

#[odra::module]
pub struct PublicWallet {
}

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {
}

pub fn withdraw(&mut self, amount: Balance) {
contract_env::transfer_tokens(contract_env::caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/tlw.rs in the odra main repository.

You can see a new macro used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from contract_env - transfer_tokens. +It does exactly what you are expecting it to do - it will transfer native tokens from the contract to the +specified address.

We are also using the Balance - an Odra type that wraps around the type that the underlying blockchain uses +for counting tokens.

Testing

To be able to test how many tokens a contract (or any address) has, test_env comes with a function - +token_balance:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::test_env;
use super::PublicWalletDeployer;

#[test]
fn test_modules() {
let mut my_contract = PublicWalletDeployer::default();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());

my_contract.with_tokens(Balance::from(100)).deposit();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));

my_contract.withdraw(Balance::from(25));
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/odra-toml/index.html b/docs/docs/0.3.0/basics/odra-toml/index.html new file mode 100644 index 000000000..74c71fcb0 --- /dev/null +++ b/docs/docs/0.3.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.3.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

The name will be used as a name for the contract - the generated wasm file will be in the above case named +flipper.wasm.

The fqn (Fully Qualified Name) is used by the builder to locate the exact struct where +the contract is defined.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

[[contracts]]
name = "counter"
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/storage-interaction/index.html b/docs/docs/0.3.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..d91141682 --- /dev/null +++ b/docs/docs/0.3.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.3.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Variable

The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Variable type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/docs/variable.rs
#[odra::module]
pub struct DogContract {
barks: Variable<bool>,
weight: Variable<u32>,
name: Variable<String>,
pets: Variable<Vec<u32>>,
}

You can see the Variable wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/docs/variable.rs
use odra::Variable;

#[odra::module]
impl DogContract {
#[odra(init)]
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/docs/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/docs/variable.rs
self.barks.set(barks);

A Variable is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/docs/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/docs/mapping.rs
use odra::{Mapping, Variable};

#[odra::module]
pub struct DogContract2 {
name: Variable<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Variables section with one difference - we need to pass a key:

examples/src/docs/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Variable is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Variable working together:

core/src/list.rs
use odra::{Variable, List};

pub struct List<T> {
values: Mapping<u32, T>,
index: Variable<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/docs/list.rs
#[odra::module]
pub struct DogContract3 {
name: Variable<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/docs/list.rs
#[odra::module]
impl DogContract3 {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the odra repository in the examples/src/docs/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/basics/testing/index.html b/docs/docs/0.3.0/basics/testing/index.html new file mode 100644 index 000000000..0cf0272ab --- /dev/null +++ b/docs/docs/0.3.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.3.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/docs/list.rs
use odra::{Variable, List};

#[cfg(test)]
mod tests {
use super::DogContract3Deployer;

#[test]
fn init_test() {
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The #[odra(module)] macro created a Deployer code for us, which will deploy the contract on the +VM:

examples/src/docs/list.rs
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with a macro are available to us:

examples/src/docs/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

Test env

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/docs/testing.rs
#[cfg(test)]
mod tests {
use super::TestingContractDeployer;

#[test]
fn test_env() {
let testing_contract = TestingContractDeployer::init("MyContract".to_string());
let creator = testing_contract.created_by();
odra::test_env::set_caller(odra::test_env::get_account(1));
let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());
let creator2 = testing_contract2.created_by();
assert!(creator != creator2);
}
}

In the code above, we are deploying two instances of the same contract, but we're using odra::test_env::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::contract_env::caller() +the function we are calling inside the contract.

Each test env comes with a set of functions that will let you write better tests:

  • fn set_caller(address: Address) - you've seen it in action just now
  • fn token_balance(address: Address) -> Balance - it returns the balance of the account associated with the given address
  • fn advance_block_time_by(seconds: BlockTime) - it increases the current value of block_time
  • fn get_account(n: usize) -> Address - it returns an nth address that was prepared for you by Odra in advance; +by default, you start with the 0th account
  • fn assert_exception<F, E>(err: E, block: F) - it executes the block code and expects err to happen
  • fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError> - returns +the event emitted by the contract

Again, we'll see those used in the next articles.

Deployer

You may be wondering what is the TestingContractDeployer and where did it come from. +It is a piece of code generated automatically for you, thanks to the #[odra::module] macro. +If you used the #[odra(init)] on one of the methods, it will be the constructor of your contract. +Odra will make sure that it is called only once, so you can use it to initialize your data structures etc.

If you do not provide the init method, you can deploy the contract using ::default() method. +In the end, you will get a Ref instance (in our case the TestingContractRef) which reimplements all +the methods you defined in the contract, but executes them on a blockchain!

To learn more about the Ref contract, visit the Cross calls article.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/category/advanced/index.html b/docs/docs/0.3.0/category/advanced/index.html new file mode 100644 index 000000000..8e7e0e3fa --- /dev/null +++ b/docs/docs/0.3.0/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
Version: 0.3.0

Advanced

Advanced concepts of Odra Framework

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/category/backends/index.html b/docs/docs/0.3.0/category/backends/index.html new file mode 100644 index 000000000..89381f471 --- /dev/null +++ b/docs/docs/0.3.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/category/basics/index.html b/docs/docs/0.3.0/category/basics/index.html new file mode 100644 index 000000000..4fcbbf2c1 --- /dev/null +++ b/docs/docs/0.3.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/category/examples/index.html b/docs/docs/0.3.0/category/examples/index.html new file mode 100644 index 000000000..695a74f14 --- /dev/null +++ b/docs/docs/0.3.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/category/getting-started/index.html b/docs/docs/0.3.0/category/getting-started/index.html new file mode 100644 index 000000000..26e2dcaa1 --- /dev/null +++ b/docs/docs/0.3.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/category/tutorials/index.html b/docs/docs/0.3.0/category/tutorials/index.html new file mode 100644 index 000000000..a99ca1ee2 --- /dev/null +++ b/docs/docs/0.3.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/examples/odra-examples/index.html b/docs/docs/0.3.0/examples/odra-examples/index.html new file mode 100644 index 000000000..3b5e33b50 --- /dev/null +++ b/docs/docs/0.3.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.3.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/examples/using-odra-modules/index.html b/docs/docs/0.3.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..a561fd3db --- /dev/null +++ b/docs/docs/0.3.0/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.3.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.0", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]
casper = ["odra/casper", "odra-modules/casper"]
danger

odra-modules defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a casper feature in your project, add odra-modules/casperspecifically (it applies to each backend).

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::types::{Address, U256};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/getting-started/flipper/index.html b/docs/docs/0.3.0/getting-started/flipper/index.html new file mode 100644 index 000000000..cfc3b1343 --- /dev/null +++ b/docs/docs/0.3.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.3.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Variable;

/// A module definition. Each module struct consists Variables and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let mut contract1 = FlipperDeployer::initial_settings();
let contract2 = FlipperDeployer::initial_settings();
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/getting-started/installation/index.html b/docs/docs/0.3.0/getting-started/installation/index.html new file mode 100644 index 000000000..621d03baa --- /dev/null +++ b/docs/docs/0.3.0/getting-started/installation/index.html @@ -0,0 +1,23 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.3.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-uknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my-project

This will create a new folder called "my-project" and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal MockVM. You can run those tests against a real backend, to do so +we need to add a new backend. Let's use CasperVM:

cargo odra backend add -p casper

Now we can run the tests against it:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/index.html b/docs/docs/0.3.0/index.html new file mode 100644 index 000000000..0598ea17c --- /dev/null +++ b/docs/docs/0.3.0/index.html @@ -0,0 +1,25 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.3.0

Odra framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, +pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open +source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. We can do it +by abstracting over core concepts that all the above systems are built around. These are type system, +storage, entry points, execution context, and testing environment. We believe it will bring standardization +to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this +ecosystem.

What's next

See the Installation and our Flipper example +to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/tutorials/erc20/index.html b/docs/docs/0.3.0/tutorials/erc20/index.html new file mode 100644 index 000000000..6b0c87c9b --- /dev/null +++ b/docs/docs/0.3.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.3.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • advanced storage - key-value pairs,
  • Odra types like Address or Balance,
  • advanced events assertion.

Code

Our module has a pretty complex storage layout in comparison to the previous example.

We need to store the following data:

  1. Immutable metadata - name, symbol and decimals.
  2. Total supply.
  3. Users' balances.
  4. Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.

Module definition

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Variable<u8>,
symbol: Variable<String>,
name: Variable<String>,
total_supply: Variable<Balance>,
balances: Mapping<Address, Balance>,
allowances: Mapping<Address, Mapping<Address, Balance>>
}
  • L6 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping. You may notice the balances property maps Address to Balance. If you deal with addresses or you operate on tokens, you should always choose Address over String and Balance over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform.
  • L7 - Odra allows nested Mappings, what we utilize to store allowances.

Metadata

#[odra::module]
impl Erc20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> Balance {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.balances.add(address, *amount);
self.total_supply.add(amount);
Transfer {
from: None,
to: Some(*address),
amount: *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: Balance
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L10 - A constructor sets the token metadata and mints the initial supply.
  • L12-L14 - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the Ownable example, we used the get() function returning an Option<T>. If the type implements Default trait, you can call get_or_default() function and the contract does not fail even if the value is not initialized.
  • L29 - The second impl is not an odra module, in other words these function will not be a part of contract's ABI.
  • L30-L39 - Mint function is public, so like in a regular rust code will be accessible from the outside. mint() use notation self.balances.add(&address, amount);, which it is syntactic sugar for:
let current_balance = self.balances.get(&address).unwrap_or_default();
let new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();
self.balances.set(&address, new_balance);

Core

For the sake of completeness, let's implement the remaining functionalities like transfer, transfer_from, or approve. They are not introducing any new concepts, so we leave them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...
pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
let caller = contract_env::caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let spender = contract_env::caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
let owner = contract_env::caller();
self.allowances.get_instance(&owner).set(spender, *amount);
Approval {
owner,
spender: *spender,
value: *amount
}
.emit();
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.allowances.get_instance(owner).get_or_default(spender)
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
contract_env::revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
}
.emit();
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {
let allowance = self.allowances.get_instance(owner).get_or_default(spender);
if allowance < *amount {
contract_env::revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.get_instance(owner)
.set(spender, new_allowance);
Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};
use odra::{assert_events, test_env, types::U256};

pub const NAME: &str = "Plascoin";
pub const SYMBOL: &str = "PLS";
pub const DECIMALS: u8 = 10;
pub const INITIAL_SUPPLY: u32 = 10_000;

pub fn setup() -> Erc20Ref {
Erc20Deployer::init(
String::from(NAME),
String::from(SYMBOL),
DECIMALS,
INITIAL_SUPPLY.into()
)
}

#[test]
fn initialization() {
let erc20 = setup();

assert_eq!(&erc20.symbol(), SYMBOL);
assert_eq!(&erc20.name(), NAME);
assert_eq!(erc20.decimals(), DECIMALS);
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());
assert_events!(
erc20,
Transfer {
from: None,
to: Some(test_env::get_account(0)),
amount: INITIAL_SUPPLY.into()
}
);
}

#[test]
fn transfer_works() {
let mut erc20 = setup();
let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

erc20.transfer(&recipient, &amount);

assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);
assert_eq!(erc20.balance_of(&recipient), amount);
assert_events!(
erc20,
Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
);
}

#[test]
fn transfer_error() {
let mut erc20 = setup();
let recipient = test_env::get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);

test_env::assert_exception(Error::InsufficientBalance, || {
erc20.transfer(&recipient, &amount)
});
}

#[test]
fn transfer_from_and_approval_work() {
let mut erc20 = setup();
let (owner, recipient, spender) = (
test_env::get_account(0),
test_env::get_account(1),
test_env::get_account(2)
);
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount
}
);

// Spender transfers tokens from Owner to Recipient.
test_env::set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount - transfer_amount
},
Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
);

assert_events!(erc20, Approval, Transfer);
}

#[test]
fn transfer_from_error() {
let mut erc20 = setup();
let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

test_env::set_caller(spender);
test_env::assert_exception(Error::InsufficientAllowance, || {
erc20.transfer_from(&owner, &spender, &amount)
});
}
}
  • L111-123 - assert_events!() macro accepts multiple events. You must pass them in the order they were emitted.
  • L125 - Alternatively, if you don't want to check the entire event, you may assert only its type.
danger

You can not mix both approaches, you pass full events or types only.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/tutorials/ownable/index.html b/docs/docs/0.3.0/tutorials/ownable/index.html new file mode 100644 index 000000000..cc80b9e3e --- /dev/null +++ b/docs/docs/0.3.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.3.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining constructors,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

use odra::{types::Address, Variable};

#[odra::module]
pub struct Ownable {
owner: Variable<Address>
}

That was easy, but it is crucial to understand the basic before we move on.

  • L3 - Firstly, we need create a struct called Ownable and apply #[odra::module] to it above.
  • L5 - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with Variable.

Init the module

use odra::{
execution_error, contract_env, Event, types::{Address, event::OdraEvent}
};
...

#[odra::module]
impl Ownable {
#[odra(init)]
pub fn init(&mut self, owner: &Address) {
if self.owner.get().is_some() {
contract_env::revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(*owner);

OwnershipChanged {
prev_owner: None,
new_owner: *owner
}
.emit();
}
}

execution_error! {
pub enum Error {
OwnerIsNotInitialized => 1,
}
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L5 - The impl should be an odra module, so add #[odra::module].
  • L7 - The init function is marked as #[odra(init)] making it a constructor. It matters if we would like to deploy the Ownable module as a standalone contract.
  • L23 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an Error enum. Notice that the Error enum is defined inside the execution_error macro. It generates, among others, the required Into<ExecutionError> binding.
  • L9-L11 - If the owner has been set already, we call contract_env::revert() function. As an argument we pass Error::OwnerIsNotInitialized.
  • L13 - Then we write the owner passed as an argument to the storage. To do so we call the set() on Variable.
  • L29-L33 - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L23 - Finally, we create the OwnershipChanged struct and call emit() function on it (import odra::types::event::OdraEvent trait). Hence we set the first owner, we set the prev_owner value to None.

Features implementation

#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get().as_ref() {
contract_env::revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&contract_env::caller());
let current_owner = self.get_owner();
self.owner.set(*new_owner);
OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
}
.emit();
}

pub fn get_owner(&self) -> Address {
match self.owner.get() {
Some(owner) => owner,
None => contract_env::revert(Error::OwnerIsNotInitialized)
}
}
}

execution_error! {
pub enum Error {
NotOwner => 1,
OwnerIsAlreadyInitialized => 2,
OwnerIsNotInitialized => 3,
}
}

The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along.

  • L5,L32 - ensure_ownership() is reads the current owner, and reverts if is does not match the input Address. Also we need to update our Error enum adding a new variant NotOwner.
  • L11 - The function defined above can be reused in change_ownership() implementation. We pass to it the current caller, using the contract_env::caller() function. The we update the state, and emit OwnershipChanged.
  • L22,L34 - Lastly, a getter function. As the Variable get() function returns an Option, we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized.

Test

#[cfg(test)]
mod tests {
use super::*;
use odra::{assert_events, test_env};

fn setup() -> (Address, OwnableRef) {
let owner = test_env::get_account(0);
let ownable = OwnableDeployer::init(owner);
(owner, ownable)
}

#[test]
fn initialization_works() {
let (owner, ownable) = setup();
assert_eq!(ownable.get_owner(), owner);

assert_events!(
ownable,
OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (owner, mut ownable) = setup();
let new_owner = test_env::get_account(1);

test_env::set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);
assert_events!(
ownable,
OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (_, mut ownable) = setup();
let new_owner = test_env::get_account(1);
ownable.change_ownership(&new_owner);

test_env::assert_exception(Error::NotOwner, || {
ownable.change_ownership(&new_owner);
});
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we defined the setup() function we call as the first statement in each test. Take a look at the signature fn setup() -> (Address, OwnableRef). OwnableRef is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ensure_ownership(), change_ownership(), get_owner(), but not init() which is a constructor.
  • L7 - Now, the module needs an owner, the easiest way is to take one from the test_env. We choose the address of first account (which is the default one).
  • L8 - Odra created for us OwnableDeployer struct which implements all constructor functions. In this case there is just one function - init() which corresponds the function we have implemented in the module.
  • L12 - It is time to define the first test. As you see, it is a regular rust test.
  • L14-15 - Using the setup() function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L17-23 - On the contract, only the init() function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro assert_events. As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred.
  • L30 - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the test env predefines 20 accounts.
  • L32 - As mentioned, the default is the 0-th account, if you want to change the executor call the test_env::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L49-55 - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call test_env::assert_exception() with the error you expect and a failing block of code.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.0/tutorials/owned-token/index.html b/docs/docs/0.3.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..25744ed7e --- /dev/null +++ b/docs/docs/0.3.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.3.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow minting tokens but only the module owner.
  3. The current owner should be able to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
use odra::types::{Address, Balance}

...

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> Balance {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.ownable.ensure_ownership(&contract_env::caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L10-L11 - A constructor is a great place to init both modules at once.
  • L14-L16 - Most of the entrypoints do not need any modification, so we simply delegates them to the erc20 module.
  • L50-L52 - The same we do with the ownable module.
  • L58-L61 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/advanced/advanced-storage/index.html b/docs/docs/0.3.1/advanced/advanced-storage/index.html new file mode 100644 index 000000000..a60b5931c --- /dev/null +++ b/docs/docs/0.3.1/advanced/advanced-storage/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.3.1

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Variable, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values.

Variable: A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that holds a Variable which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Variable<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility.

Let's consider the following example:

examples/mapping.rs
use odra::{map, types::U256, Mapping, UnwrapOrRevert};

use crate::owned_token::OwnedToken;

#[odra::module]
pub struct NestedMapping {
strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,
tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>
}

#[odra::module]
impl NestedMapping {

...

pub fn set_token(
&mut self,
key1: String,
key2: u32,
key3: String,
token_name: String,
decimals: u8,
symbol: String,
initial_supply: &U256
) {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.init(token_name, symbol, decimals, initial_supply);
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let mapping = self.strings.get_instance(&key1).get_instance(&key2);
mapping.get(&key3).unwrap_or_revert()
}

pub fn total_supply(
&self,
key1: String,
key2: u32,
key3: String
) -> U256 {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.total_supply()
}
}
note

Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers.

Instead of using the get() function, call get_instance(), which sets the correct namespace for nested modules.

If the terminal value is deeply nested, a long chain of get_instance() calls is required.

To keep the codebase consistent, a map! macro can be used:

examples/mapping.rs
...

pub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {
map!(self.strings[key1][key2][key3] = value);
}

pub fn get_string_macro(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
map!(self.strings[key1][key2][key3])
}

danger

The terminal value must not be an Odra Module.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Sequence, Mapping};
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
my_sequence: Sequence<u32>,
my_mapping: Mapping<String, Mapping<String, Token>>,
}

impl AdvancedStorage {
pub fn get_sequence_current_value(&self) -> u32 {
self.my_sequence.get_current_value()
}

pub fn next_sequence_value(&mut self) -> u32 {
self.my_sequence.next_value()
}

pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.set(&inner_key, value);
}

pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.get(&inner_key)
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/advanced/attributes/index.html b/docs/docs/0.3.1/advanced/attributes/index.html new file mode 100644 index 000000000..8877cb732 --- /dev/null +++ b/docs/docs/0.3.1/advanced/attributes/index.html @@ -0,0 +1,18 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.3.1

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Init

If your contract needs initial setup, adding the #[odra(init)] attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed.

It's important to note that a constructor function should not be invoked in any other context.

Example

examples/erc20.rs
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = contract_env::caller();
let amount: Balance = contract_env::attached_value();
let current_block_time: BlockTime = contract_env::get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
contract_env::revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
Deposit {
address: caller,
amount
}
.emit();
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

However, a constructor cannot be payable, so the below code would not compile.

#[odra(payable)]
#[odra(init)]
fn initialize() {
// your logic...
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/advanced/composer/index.html b/docs/docs/0.3.1/advanced/composer/index.html new file mode 100644 index 000000000..db049fef3 --- /dev/null +++ b/docs/docs/0.3.1/advanced/composer/index.html @@ -0,0 +1,17 @@ + + + + + +Module Composer | Odra + + + + + +
+
Version: 0.3.1

Module Composer

The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.

Conceptual Overview

By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key.

#[odra::module]
struct Contract {
value: Variable<u8>, // the default namespace would be "contract_value"
module: Module
}

#[odra::module]
struct Module {
secret: Variable<String> // the default namespace would be "contract_module_secret"
}

While this isolation often proves useful, there are scenarios where shared storage is beneficial. Here, the Module Composer comes in.

Additionally, the Module Composer shortens the storage key - a handy side effect of shared storage.

For each module, Odra generates a corresponding Composer struct (e.g., MyContractComposer for MyContract module), which aids in manual module composition.

Usage

By default, the #[odra::module] macro generates an implementation of the odra::Instance trait, prefixing the storage key of child modules with the parent namespace. To disable this behavior, pass the skip_instance argument to the #[odra::module] macro.

Let's write a simple code example. The example provided below introduces some additional complexity by featuring deeper module nesting.

use odra::{Instance, Variable, Composer};

#[odra::module]
pub struct SharedStorage {
pub value: Variable<String>
}

#[odra::module]
pub struct MyStorage {
pub shared: SharedStorage,
pub version: Variable<u8>
}

#[odra::module]
pub struct MoreStorage {
pub my_storage: MyStorage,
pub extra: Variable<u32>
}

#[odra::module(skip_instance)]
pub struct ComplexContract {
pub shared: SharedStorage,
pub more_storage: MoreStorage
}

#[odra::module]
impl ComplexContract {
#[odra(init)]
pub fn init(&mut self, version: u8, value: String, extra: u32) {
self.more_storage.my_storage.version.set(version);
self.shared.value.set(value);
self.more_storage.extra.set(extra);
}

pub fn get_value(&self) -> String {
self.shared.value.get_or_default()
}

pub fn get_value_via_storage(&self) -> String {
self.more_storage.my_storage.shared.value.get_or_default()
}

pub fn get_extra_value(&self) -> u32 {
self.more_storage.extra.get_or_default()
}
}

impl Instance for ComplexContract {
fn instance(namespace: &str) -> Self {
let value = Composer::new(namespace, "v").compose();
let shared = SharedStorageComposer::new(namespace, "shared")
.with_value(&value)
.compose();
let my_storage = MyStorageComposer::new(namespace, "my_storage")
.with_shared(&shared)
.compose();
let more_storage = MoreStorageComposer::new(namespace, "more_storage")
.with_my_storage(&my_storage)
.compose();
Self { shared, more_storage }
}
}

#[cfg(test)]
mod test {
use crate::composer::ComplexContractDeployer;

#[test]
fn t() {
let shared_value = "shared_value".to_string();
let extra_value: u32 = 314;
let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);

assert_eq!(token.get_value(), shared_value);
assert_eq!(token.get_value_via_storage(), shared_value);
assert_eq!(token.get_extra_value(), extra_value);
}
}

In this example, we've introduced a new module, MoreStorage, which nests MyStorage and includes an extra value. The ComplexContract contains SharedStorage and MoreStorage, creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels.

If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:

  1. On the contract level - contract_shared_value.
  2. On the MyStorage module level - contract_more_storage_shared_value.

This example showcases how you can effectively use the Module Composer feature to build intricate and efficient smart contracts.

note

To customize the storage building block, you can use Composer which API matches to modules composers API.

Conclusion

The Module Composer in Odra provides developers with a high level of flexibility and control over module behavior in their smart contracts. This guide, complete with a practical example, should give you a good understanding of the feature. Embrace the power of the Module Composer and unleash the full potential of your smart contracts!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/advanced/delegate/index.html b/docs/docs/0.3.1/advanced/delegate/index.html new file mode 100644 index 000000000..ff5cebe2a --- /dev/null +++ b/docs/docs/0.3.1/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.3.1

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
pub fn approve(&mut self, spender: Address, amount: U256);
pub fn name(&self) -> String;
pub fn symbol(&self) -> String;
pub fn decimals(&self) -> u8;
pub fn total_supply(&self) -> U256;
pub fn balance_of(&self, owner: Address) -> U256;
pub fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
pub fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};

#[odra::module]
pub struct DeFiPlatform {
ownable: Ownable,
erc20: Erc20,
exchange: Exchange
}

#[odra::module]
impl DeFiPlatform {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
}

to self.exchange {
pub fn swap(&mut self, sender: Address, recipient: Address);
pub fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/backends/casper/index.html b/docs/docs/0.3.1/backends/casper/index.html new file mode 100644 index 000000000..80b680b11 --- /dev/null +++ b/docs/docs/0.3.1/backends/casper/index.html @@ -0,0 +1,25 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.3.1

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Types

A struct to be written into the storage must implement OdraType which is defined as follow:

pub trait OdraType: 
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

The other exposed types are:

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement SerializableEvent which is defined as follow:

pub trait SerializableEvent: 
odra_types::event::OdraEvent +
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling contract_env::attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The contract_env::self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The contract_env::caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call contract_env::self_balance, which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Constructors

Let's define a basic Odra module that includes a constructor:

#[odra::module]
struct Counter {
value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub initialize(&mut self, value: u32) {
self.value.set(value);
}
}

Read more about constructors here.

To deploy your contract with a constructor using casper-client, you need to pass the constructor argument with a value of initialize - this represents the name of the constructor function. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "constructor:string:'initialize'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Execution

First thing Odra does with your code, is similar to the one used in MockVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/backends/mock-vm/index.html b/docs/docs/0.3.1/backends/mock-vm/index.html new file mode 100644 index 000000000..60c522000 --- /dev/null +++ b/docs/docs/0.3.1/backends/mock-vm/index.html @@ -0,0 +1,26 @@ + + + + + +MockVM | Odra + + + + + +
+
Version: 0.3.1

MockVM

The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler.

Usage

The MockVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

MockVM consists of two main parts: the Contract Register and the State.

The Contract Register is just a list of contracts deployed onto the MockVM, identified by an Address. +Each time we call the contract, we call its instance stored in the Contract Register.

Contracts and Test Env functions can modify the State of the MockVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the MockVM State holds only the current state of the MockVM. +Thanks to this and the fact that we do not need the blockchain itself, +MockVM starts instantly and runs the tests in the native speed.

Execution

When the MockVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, MockVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/backends/what-is-a-backend/index.html b/docs/docs/0.3.1/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..e29610c43 --- /dev/null +++ b/docs/docs/0.3.1/backends/what-is-a-backend/index.html @@ -0,0 +1,27 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.3.1

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like MockVM, +or a complete virtual machine, spinning up a blockchain for you - like CasperVM.

Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Test Env

Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/cargo-odra/index.html b/docs/docs/0.3.1/basics/cargo-odra/index.html new file mode 100644 index 000000000..cab136911 --- /dev/null +++ b/docs/docs/0.3.1/basics/cargo-odra/index.html @@ -0,0 +1,38 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.3.1

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them on multiple backends (blockchains).

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands will help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This will create a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it will create a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This will create a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

Most used command during the development of your project should be this one:

cargo odra test

It will run your tests against Odra's MockVM. It is substantially faster than virtual machines +provided by blockchains developers and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files, +spin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat. +Keep in mind that this is a lot slower than MockVM and you cannot use the debugger. +This is why MockVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build -b casper

Where casper is the name of the backend we are using in this example. If the build process +finishes successfully, wasm files will be located in wasm folder.

Updating dependencies

You will learn later, that the project using Odra contains more than one Rust project - your own and +one or more builders. To run cargo update on all of them at once instead of traversing all the folders +you can use this command:

cargo odra update

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/communicating-with-host/index.html b/docs/docs/0.3.1/basics/communicating-with-host/index.html new file mode 100644 index 000000000..07858f2c9 --- /dev/null +++ b/docs/docs/0.3.1/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.3.1

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/docs/host.rs
use odra::Variable;
use odra::types::{BlockTime, Address};

#[odra::module]
pub struct HostContract {
name: Variable<String>,
created_at: Variable<BlockTime>,
created_by: Variable<Address>,
}

#[odra::module]
impl HostContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(odra::contract_env::get_block_time());
self.created_by.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are calling functions from odra::contract_env. get_block_time() will return +the current block time wrapped in Odra type BlockTime. caller() will return an Odra Address of +a caller (this can be an external caller or another contract).

info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/cross-calls/index.html b/docs/docs/0.3.1/basics/cross-calls/index.html new file mode 100644 index 000000000..2cd126fcc --- /dev/null +++ b/docs/docs/0.3.1/basics/cross-calls/index.html @@ -0,0 +1,25 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.3.1

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/docs/cross_calls.rs
use odra::Variable;
use odra::types::{Address};

#[odra::module]
pub struct CrossContract {
pub math_engine: Variable<Address>,
}

#[odra::module]
impl CrossContract {
#[odra(init)]
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap();
MathEngineRef::at(math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine {
}

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To call the external contract, we use the Ref that was created for us by Odra:

examples/src/docs/cross_calls.rs
MathEngineRef::at(math_engine_address).add(3, 5)

Contract Ref

We mentioned Ref already in our Testing article. +It is a reference to already deployed - running contract. +Here we are going to take a deeper look at it.

Similarly to a Deployer, the Ref is generated automatically, thanks to the #[odra::module] macro. +To get an instance of a reference, we can either deploy a contract (using Deployer) or by building it +directly, using ::at(address: Address) method, as shown above. +The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), alongside couple methods:

  • at(Address) -> Self - points the reference to an Address
  • address() -> Address - returns the Address the reference is currently pointing at
  • with_tokens(Amount) -> Self - attaches Amount of native tokens to the next call

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

examples/src/docs/cross_calls.rs
#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderRef struct (but do not create the AdderDeployer). Having an address we can call:

examples/src/docs/cross_calls.rs
AdderRef::at(address).add(3, 5)

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/docs/cross_calls.rs
use super::{CrossContractDeployer, MathEngineDeployer};

#[test]
fn test_cross_calls() {
let math_engine_contract = MathEngineDeployer::default();
let cross_contract = CrossContractDeployer::init(math_engine_contract.address());

assert_eq!(cross_contract.add_using_another(), 8);
}

Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a MathEngine contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the add() function we want to use.

examples/src/docs/cross_calls.rs
#[cfg(test)]
mod tests {
use odra::types::Address;
use crate::docs::cross_calls::{Adder, AdderRef};

#[test]
fn test_ext() {
let adder = AdderRef::at(get_adder_address());

assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address() -> Address {
let contract = MathEngineDeployer::default();
contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/directory-structure/index.html b/docs/docs/0.3.1/basics/directory-structure/index.html new file mode 100644 index 000000000..3f676fd46 --- /dev/null +++ b/docs/docs/0.3.1/basics/directory-structure/index.html @@ -0,0 +1,27 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.3.1

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── .builder_casper/
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

By default, your project will use the latest odra version available at crates.io. We are using two features:

  • odra/mock-vm - it is responsible for running tests on Odra's MockVM
  • odra/casper - backend implementation of Casper blockchain +More backends will be released as features that will be possible to enable here.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

.builder_* folders

Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary +for building wasm files and running them against blockchain VMs. As it is not necessary to modify +files in those folders in any way, by default they are hidden (hence the . at the beginning of the +folder name).

src/

This is the folder where your smart contract files live.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain of your choosing.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/errors/index.html b/docs/docs/0.3.1/basics/errors/index.html new file mode 100644 index 000000000..1deaf33c3 --- /dev/null +++ b/docs/docs/0.3.1/basics/errors/index.html @@ -0,0 +1,23 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.3.1

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/docs/errors.rs
use odra::{execution_error, Variable, UnwrapOrRevert};
use odra::types::Address;

#[odra::module]
pub struct OwnedContract {
name: Variable<String>,
owner: Variable<Address>,
}

execution_error! {
pub enum Error {
OwnerNotSet => 1,
NotAnOwner => 2,
}
}


#[odra::module]
impl OwnedContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = odra::contract_env::caller();
if caller != self.owner() {
odra::contract_env::revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using execution_error! macro to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/docs/errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You and the users of your contract will be thankful for a meaningful error message!

You can also throw the error directly, by using revert:

examples/src/docs/errors.rs
odra::contract_env::revert(Error::NotAnOwner)

Testing errors

Okay, but how about testing it? We've already mentioned a function - assert_exception. This is how you will +use it:

examples/src/docs/errors.rs
use super::{OwnedContractDeployer, OwnedContractRef};
use super::Error;

#[test]
fn test_owner_error() {
let owner = odra::test_env::get_account(0);
let not_an_owner = odra::test_env::get_account(1);

odra::test_env::set_caller(owner);
let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());

odra::test_env::set_caller(not_an_owner);
odra::test_env::assert_exception(Error::NotAnOwner, || {
owned_contract.change_name("NewName".to_string());
})
}

In the example above, because we are calling the change_name method as an address which is not an "owner", +we are expecting that "NotAnOwner" error will be thrown.

note

Here we are creating another reference to the already deployed contract using OwnedContractRef::at() and passing to it +its Address. Note that OwnedContractDeployer::init() returns the same type.

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/events/index.html b/docs/docs/0.3.1/basics/events/index.html new file mode 100644 index 000000000..545c583a6 --- /dev/null +++ b/docs/docs/0.3.1/basics/events/index.html @@ -0,0 +1,20 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.3.1

Events

Different blockchains implement events in different ways. Odra lets you forget about it by introducing +Odra Events. Take a look:

examples/src/docs/events.rs
use odra::{Event, contract_env};
use odra::types::{Address, BlockTime, event::OdraEvent};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract {
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

#[odra::module]
impl PartyContract {
#[odra(init)]
pub fn init(&self) {
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, we derive an Event macro like this:

examples/src/docs/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

Among other things, it adds an emit() function to the struct, which allows you to emit the event simply +as that:

examples/src/docs/events.rs
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();

Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] macro.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's test_env comes with a handy macro assert_events! which lets you easily test the events that a given contract has emitted:

examples/src/docs/events.rs
use odra::{assert_events, test_env};
use crate::docs::events::PartyStarted;
use super::PartyContractDeployer;

#[test]
fn test_party() {
let party_contract = PartyContractDeployer::init();
assert_events!(
party_contract,
PartyStarted {
caller: test_env::get_account(0),
block_time: 0,
}
);
}

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/flipper-internals/index.html b/docs/docs/0.3.1/basics/flipper-internals/index.html new file mode 100644 index 000000000..eed87130a --- /dev/null +++ b/docs/docs/0.3.1/basics/flipper-internals/index.html @@ -0,0 +1,35 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.3.1

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Variable;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Variable, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Variables and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Variable<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The #[odra(init)] macro marks the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Variable<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using FlipperDeployer - a piece of code generated automatically thanks to the macros. +The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/modules/index.html b/docs/docs/0.3.1/basics/modules/index.html new file mode 100644 index 000000000..5b25fe819 --- /dev/null +++ b/docs/docs/0.3.1/basics/modules/index.html @@ -0,0 +1,20 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.3.1

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to a macro #[odra::module]. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/docs/modules.rs
use crate::docs::cross_calls::MathEngine;

#[odra::module]
pub struct ModulesContract {
pub math_engine: MathEngine,
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/docs/modules.rs
use super::ModulesContractDeployer;

#[test]
fn test_modules() {
let modules_contract = ModulesContractDeployer::default();
assert_eq!(modules_contract.add_using_module(), 8);
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/native-token/index.html b/docs/docs/0.3.1/basics/native-token/index.html new file mode 100644 index 000000000..08b530c95 --- /dev/null +++ b/docs/docs/0.3.1/basics/native-token/index.html @@ -0,0 +1,26 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.3.1

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::contract_env;

#[odra::module]
pub struct PublicWallet {
}

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {
}

pub fn withdraw(&mut self, amount: Balance) {
contract_env::transfer_tokens(contract_env::caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/tlw.rs in the odra main repository.

You can see a new macro used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from contract_env - transfer_tokens. +It does exactly what you are expecting it to do - it will transfer native tokens from the contract to the +specified address.

We are also using the Balance - an Odra type that wraps around the type that the underlying blockchain uses +for counting tokens.

Testing

To be able to test how many tokens a contract (or any address) has, test_env comes with a function - +token_balance:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::test_env;
use super::PublicWalletDeployer;

#[test]
fn test_modules() {
let mut my_contract = PublicWalletDeployer::default();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());

my_contract.with_tokens(Balance::from(100)).deposit();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));

my_contract.withdraw(Balance::from(25));
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/odra-toml/index.html b/docs/docs/0.3.1/basics/odra-toml/index.html new file mode 100644 index 000000000..4b92c6fb5 --- /dev/null +++ b/docs/docs/0.3.1/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.3.1

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

The name will be used as a name for the contract - the generated wasm file will be in the above case named +flipper.wasm.

The fqn (Fully Qualified Name) is used by the builder to locate the exact struct where +the contract is defined.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

[[contracts]]
name = "counter"
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/storage-interaction/index.html b/docs/docs/0.3.1/basics/storage-interaction/index.html new file mode 100644 index 000000000..1149a72a0 --- /dev/null +++ b/docs/docs/0.3.1/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.3.1

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Variable

The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Variable type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/docs/variable.rs
#[odra::module]
pub struct DogContract {
barks: Variable<bool>,
weight: Variable<u32>,
name: Variable<String>,
walks: Variable<Vec<u32>>,
}

You can see the Variable wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/docs/variable.rs
use odra::Variable;

#[odra::module]
impl DogContract {
#[odra(init)]
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/docs/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/docs/variable.rs
self.barks.set(barks);

A Variable is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/docs/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/docs/mapping.rs
use odra::{Mapping, Variable};

#[odra::module]
pub struct DogContract2 {
name: Variable<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Variables section with one difference - we need to pass a key:

examples/src/docs/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Variable is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Variable working together:

core/src/list.rs
use odra::{Variable, List};

pub struct List<T> {
values: Mapping<u32, T>,
index: Variable<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/docs/list.rs
#[odra::module]
pub struct DogContract3 {
name: Variable<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/docs/list.rs
#[odra::module]
impl DogContract3 {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the odra repository in the examples/src/docs/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/basics/testing/index.html b/docs/docs/0.3.1/basics/testing/index.html new file mode 100644 index 000000000..dd5c299e0 --- /dev/null +++ b/docs/docs/0.3.1/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.3.1

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/docs/list.rs
use odra::{Variable, List};

#[cfg(test)]
mod tests {
use super::DogContract3Deployer;

#[test]
fn init_test() {
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The #[odra(module)] macro created a Deployer code for us, which will deploy the contract on the +VM:

examples/src/docs/list.rs
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with a macro are available to us:

examples/src/docs/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

Test env

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/docs/testing.rs
#[cfg(test)]
mod tests {
use super::TestingContractDeployer;

#[test]
fn test_env() {
let testing_contract = TestingContractDeployer::init("MyContract".to_string());
let creator = testing_contract.created_by();
odra::test_env::set_caller(odra::test_env::get_account(1));
let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());
let creator2 = testing_contract2.created_by();
assert!(creator != creator2);
}
}

In the code above, we are deploying two instances of the same contract, but we're using odra::test_env::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::contract_env::caller() +the function we are calling inside the contract.

Each test env comes with a set of functions that will let you write better tests:

  • fn set_caller(address: Address) - you've seen it in action just now
  • fn token_balance(address: Address) -> Balance - it returns the balance of the account associated with the given address
  • fn advance_block_time_by(seconds: BlockTime) - it increases the current value of block_time
  • fn get_account(n: usize) -> Address - it returns an nth address that was prepared for you by Odra in advance; +by default, you start with the 0th account
  • fn assert_exception<F, E>(err: E, block: F) - it executes the block code and expects err to happen
  • fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError> - returns +the event emitted by the contract

Again, we'll see those used in the next articles.

Deployer

You may be wondering what is the TestingContractDeployer and where did it come from. +It is a piece of code generated automatically for you, thanks to the #[odra::module] macro. +If you used the #[odra(init)] on one of the methods, it will be the constructor of your contract. +Odra will make sure that it is called only once, so you can use it to initialize your data structures etc.

If you do not provide the init method, you can deploy the contract using ::default() method. +In the end, you will get a Ref instance (in our case the TestingContractRef) which reimplements all +the methods you defined in the contract, but executes them on a blockchain!

To learn more about the Ref contract, visit the Cross calls article.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/category/advanced/index.html b/docs/docs/0.3.1/category/advanced/index.html new file mode 100644 index 000000000..fbc58fe15 --- /dev/null +++ b/docs/docs/0.3.1/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
Version: 0.3.1

Advanced

Advanced concepts of Odra Framework

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/category/backends/index.html b/docs/docs/0.3.1/category/backends/index.html new file mode 100644 index 000000000..68210e040 --- /dev/null +++ b/docs/docs/0.3.1/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/category/basics/index.html b/docs/docs/0.3.1/category/basics/index.html new file mode 100644 index 000000000..19f7e4be3 --- /dev/null +++ b/docs/docs/0.3.1/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/category/examples/index.html b/docs/docs/0.3.1/category/examples/index.html new file mode 100644 index 000000000..f4efb2446 --- /dev/null +++ b/docs/docs/0.3.1/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/category/getting-started/index.html b/docs/docs/0.3.1/category/getting-started/index.html new file mode 100644 index 000000000..8e6ef8c05 --- /dev/null +++ b/docs/docs/0.3.1/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/category/tutorials/index.html b/docs/docs/0.3.1/category/tutorials/index.html new file mode 100644 index 000000000..1046c291e --- /dev/null +++ b/docs/docs/0.3.1/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/examples/odra-examples/index.html b/docs/docs/0.3.1/examples/odra-examples/index.html new file mode 100644 index 000000000..7af621f09 --- /dev/null +++ b/docs/docs/0.3.1/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.3.1

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/examples/using-odra-modules/index.html b/docs/docs/0.3.1/examples/using-odra-modules/index.html new file mode 100644 index 000000000..39ff58a88 --- /dev/null +++ b/docs/docs/0.3.1/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.3.1

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]
casper = ["odra/casper", "odra-modules/casper"]
danger

odra-modules defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a casper feature in your project, add odra-modules/casperspecifically (it applies to each backend).

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::types::{Address, U256};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/getting-started/flipper/index.html b/docs/docs/0.3.1/getting-started/flipper/index.html new file mode 100644 index 000000000..3bb32bd09 --- /dev/null +++ b/docs/docs/0.3.1/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.3.1

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Variable;

/// A module definition. Each module struct consists Variables and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let mut contract1 = FlipperDeployer::initial_settings();
let contract2 = FlipperDeployer::initial_settings();
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/getting-started/installation/index.html b/docs/docs/0.3.1/getting-started/installation/index.html new file mode 100644 index 000000000..beacd82b3 --- /dev/null +++ b/docs/docs/0.3.1/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.3.1

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-uknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called "my_project" and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/index.html b/docs/docs/0.3.1/index.html new file mode 100644 index 000000000..9670aaf88 --- /dev/null +++ b/docs/docs/0.3.1/index.html @@ -0,0 +1,25 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.3.1

Odra framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, +pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open +source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. We can do it +by abstracting over core concepts that all the above systems are built around. These are type system, +storage, entry points, execution context, and testing environment. We believe it will bring standardization +to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this +ecosystem.

What's next

See the Installation and our Flipper example +to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/tutorials/erc20/index.html b/docs/docs/0.3.1/tutorials/erc20/index.html new file mode 100644 index 000000000..1ddbe579b --- /dev/null +++ b/docs/docs/0.3.1/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.3.1

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • advanced storage - key-value pairs,
  • Odra types like Address or Balance,
  • advanced events assertion.

Code

Our module has a pretty complex storage layout in comparison to the previous example.

We need to store the following data:

  1. Immutable metadata - name, symbol and decimals.
  2. Total supply.
  3. Users' balances.
  4. Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.

Module definition

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Variable<u8>,
symbol: Variable<String>,
name: Variable<String>,
total_supply: Variable<Balance>,
balances: Mapping<Address, Balance>,
allowances: Mapping<Address, Mapping<Address, Balance>>
}
  • L6 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping. You may notice the balances property maps Address to Balance. If you deal with addresses or you operate on tokens, you should always choose Address over String and Balance over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform.
  • L7 - Odra allows nested Mappings, what we utilize to store allowances.

Metadata

#[odra::module]
impl Erc20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> Balance {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.balances.add(address, *amount);
self.total_supply.add(amount);
Transfer {
from: None,
to: Some(*address),
amount: *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: Balance
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L10 - A constructor sets the token metadata and mints the initial supply.
  • L12-L14 - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the Ownable example, we used the get() function returning an Option<T>. If the type implements Default trait, you can call get_or_default() function and the contract does not fail even if the value is not initialized.
  • L29 - The second impl is not an odra module, in other words these function will not be a part of contract's ABI.
  • L30-L39 - Mint function is public, so like in a regular rust code will be accessible from the outside. mint() use notation self.balances.add(&address, amount);, which it is syntactic sugar for:
let current_balance = self.balances.get(&address).unwrap_or_default();
let new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();
self.balances.set(&address, new_balance);

Core

For the sake of completeness, let's implement the remaining functionalities like transfer, transfer_from, or approve. They are not introducing any new concepts, so we leave them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...
pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
let caller = contract_env::caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let spender = contract_env::caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
let owner = contract_env::caller();
self.allowances.get_instance(&owner).set(spender, *amount);
Approval {
owner,
spender: *spender,
value: *amount
}
.emit();
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.allowances.get_instance(owner).get_or_default(spender)
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
contract_env::revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
}
.emit();
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {
let allowance = self.allowances.get_instance(owner).get_or_default(spender);
if allowance < *amount {
contract_env::revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.get_instance(owner)
.set(spender, new_allowance);
Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};
use odra::{assert_events, test_env, types::U256};

pub const NAME: &str = "Plascoin";
pub const SYMBOL: &str = "PLS";
pub const DECIMALS: u8 = 10;
pub const INITIAL_SUPPLY: u32 = 10_000;

pub fn setup() -> Erc20Ref {
Erc20Deployer::init(
String::from(NAME),
String::from(SYMBOL),
DECIMALS,
INITIAL_SUPPLY.into()
)
}

#[test]
fn initialization() {
let erc20 = setup();

assert_eq!(&erc20.symbol(), SYMBOL);
assert_eq!(&erc20.name(), NAME);
assert_eq!(erc20.decimals(), DECIMALS);
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());
assert_events!(
erc20,
Transfer {
from: None,
to: Some(test_env::get_account(0)),
amount: INITIAL_SUPPLY.into()
}
);
}

#[test]
fn transfer_works() {
let mut erc20 = setup();
let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

erc20.transfer(&recipient, &amount);

assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);
assert_eq!(erc20.balance_of(&recipient), amount);
assert_events!(
erc20,
Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
);
}

#[test]
fn transfer_error() {
let mut erc20 = setup();
let recipient = test_env::get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);

test_env::assert_exception(Error::InsufficientBalance, || {
erc20.transfer(&recipient, &amount)
});
}

#[test]
fn transfer_from_and_approval_work() {
let mut erc20 = setup();
let (owner, recipient, spender) = (
test_env::get_account(0),
test_env::get_account(1),
test_env::get_account(2)
);
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount
}
);

// Spender transfers tokens from Owner to Recipient.
test_env::set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount - transfer_amount
},
Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
);

assert_events!(erc20, Approval, Transfer);
}

#[test]
fn transfer_from_error() {
let mut erc20 = setup();
let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

test_env::set_caller(spender);
test_env::assert_exception(Error::InsufficientAllowance, || {
erc20.transfer_from(&owner, &spender, &amount)
});
}
}
  • L111-123 - assert_events!() macro accepts multiple events. You must pass them in the order they were emitted.
  • L125 - Alternatively, if you don't want to check the entire event, you may assert only its type.
danger

You can not mix both approaches, you pass full events or types only.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/tutorials/ownable/index.html b/docs/docs/0.3.1/tutorials/ownable/index.html new file mode 100644 index 000000000..24d34ff0d --- /dev/null +++ b/docs/docs/0.3.1/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.3.1

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining constructors,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

use odra::{types::Address, Variable};

#[odra::module]
pub struct Ownable {
owner: Variable<Address>
}

That was easy, but it is crucial to understand the basic before we move on.

  • L3 - Firstly, we need create a struct called Ownable and apply #[odra::module] to it above.
  • L5 - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with Variable.

Init the module

use odra::{
execution_error, contract_env, Event, types::{Address, event::OdraEvent}
};
...

#[odra::module]
impl Ownable {
#[odra(init)]
pub fn init(&mut self, owner: &Address) {
if self.owner.get().is_some() {
contract_env::revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(*owner);

OwnershipChanged {
prev_owner: None,
new_owner: *owner
}
.emit();
}
}

execution_error! {
pub enum Error {
OwnerIsNotInitialized => 1,
}
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L5 - The impl should be an odra module, so add #[odra::module].
  • L7 - The init function is marked as #[odra(init)] making it a constructor. It matters if we would like to deploy the Ownable module as a standalone contract.
  • L23 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an Error enum. Notice that the Error enum is defined inside the execution_error macro. It generates, among others, the required Into<ExecutionError> binding.
  • L9-L11 - If the owner has been set already, we call contract_env::revert() function. As an argument we pass Error::OwnerIsNotInitialized.
  • L13 - Then we write the owner passed as an argument to the storage. To do so we call the set() on Variable.
  • L29-L33 - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L23 - Finally, we create the OwnershipChanged struct and call emit() function on it (import odra::types::event::OdraEvent trait). Hence we set the first owner, we set the prev_owner value to None.

Features implementation

#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get().as_ref() {
contract_env::revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&contract_env::caller());
let current_owner = self.get_owner();
self.owner.set(*new_owner);
OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
}
.emit();
}

pub fn get_owner(&self) -> Address {
match self.owner.get() {
Some(owner) => owner,
None => contract_env::revert(Error::OwnerIsNotInitialized)
}
}
}

execution_error! {
pub enum Error {
NotOwner => 1,
OwnerIsAlreadyInitialized => 2,
OwnerIsNotInitialized => 3,
}
}

The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along.

  • L5,L32 - ensure_ownership() is reads the current owner, and reverts if is does not match the input Address. Also we need to update our Error enum adding a new variant NotOwner.
  • L11 - The function defined above can be reused in change_ownership() implementation. We pass to it the current caller, using the contract_env::caller() function. The we update the state, and emit OwnershipChanged.
  • L22,L34 - Lastly, a getter function. As the Variable get() function returns an Option, we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized.

Test

#[cfg(test)]
mod tests {
use super::*;
use odra::{assert_events, test_env};

fn setup() -> (Address, OwnableRef) {
let owner = test_env::get_account(0);
let ownable = OwnableDeployer::init(owner);
(owner, ownable)
}

#[test]
fn initialization_works() {
let (owner, ownable) = setup();
assert_eq!(ownable.get_owner(), owner);

assert_events!(
ownable,
OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (owner, mut ownable) = setup();
let new_owner = test_env::get_account(1);

test_env::set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);
assert_events!(
ownable,
OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (_, mut ownable) = setup();
let new_owner = test_env::get_account(1);
ownable.change_ownership(&new_owner);

test_env::assert_exception(Error::NotOwner, || {
ownable.change_ownership(&new_owner);
});
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we defined the setup() function we call as the first statement in each test. Take a look at the signature fn setup() -> (Address, OwnableRef). OwnableRef is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ensure_ownership(), change_ownership(), get_owner(), but not init() which is a constructor.
  • L7 - Now, the module needs an owner, the easiest way is to take one from the test_env. We choose the address of first account (which is the default one).
  • L8 - Odra created for us OwnableDeployer struct which implements all constructor functions. In this case there is just one function - init() which corresponds the function we have implemented in the module.
  • L12 - It is time to define the first test. As you see, it is a regular rust test.
  • L14-15 - Using the setup() function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L17-23 - On the contract, only the init() function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro assert_events. As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred.
  • L30 - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the test env predefines 20 accounts.
  • L32 - As mentioned, the default is the 0-th account, if you want to change the executor call the test_env::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L49-55 - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call test_env::assert_exception() with the error you expect and a failing block of code.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.3.1/tutorials/owned-token/index.html b/docs/docs/0.3.1/tutorials/owned-token/index.html new file mode 100644 index 000000000..80c82c840 --- /dev/null +++ b/docs/docs/0.3.1/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.3.1

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow minting tokens but only the module owner.
  3. The current owner should be able to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
use odra::types::{Address, Balance}

...

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> Balance {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.ownable.ensure_ownership(&contract_env::caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L10-L11 - A constructor is a great place to init both modules at once.
  • L14-L16 - Most of the entrypoints do not need any modification, so we simply delegates them to the erc20 module.
  • L50-L52 - The same we do with the ownable module.
  • L58-L61 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/advanced/advanced-storage/index.html b/docs/docs/0.4.0/advanced/advanced-storage/index.html new file mode 100644 index 000000000..fc7a3eb85 --- /dev/null +++ b/docs/docs/0.4.0/advanced/advanced-storage/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.4.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Variable, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values.

Variable: A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that holds a Variable which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Variable<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility.

Let's consider the following example:

examples/mapping.rs
use odra::{map, types::U256, Mapping, UnwrapOrRevert};

use crate::owned_token::OwnedToken;

#[odra::module]
pub struct NestedMapping {
strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,
tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>
}

#[odra::module]
impl NestedMapping {

...

pub fn set_token(
&mut self,
key1: String,
key2: u32,
key3: String,
token_name: String,
decimals: u8,
symbol: String,
initial_supply: &U256
) {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.init(token_name, symbol, decimals, initial_supply);
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let mapping = self.strings.get_instance(&key1).get_instance(&key2);
mapping.get(&key3).unwrap_or_revert()
}

pub fn total_supply(
&self,
key1: String,
key2: u32,
key3: String
) -> U256 {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.total_supply()
}
}
note

Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers.

Instead of using the get() function, call get_instance(), which sets the correct namespace for nested modules.

If the terminal value is deeply nested, a long chain of get_instance() calls is required.

To keep the codebase consistent, a map! macro can be used:

examples/mapping.rs
...

pub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {
map!(self.strings[key1][key2][key3] = value);
}

pub fn get_string_macro(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
map!(self.strings[key1][key2][key3])
}

danger

The terminal value must not be an Odra Module.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Sequence, Mapping};
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
my_sequence: Sequence<u32>,
my_mapping: Mapping<String, Mapping<String, Token>>,
}

impl AdvancedStorage {
pub fn get_sequence_current_value(&self) -> u32 {
self.my_sequence.get_current_value()
}

pub fn next_sequence_value(&mut self) -> u32 {
self.my_sequence.next_value()
}

pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.set(&inner_key, value);
}

pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.get(&inner_key)
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/advanced/attributes/index.html b/docs/docs/0.4.0/advanced/attributes/index.html new file mode 100644 index 000000000..6f1338fb4 --- /dev/null +++ b/docs/docs/0.4.0/advanced/attributes/index.html @@ -0,0 +1,18 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.4.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Init

If your contract needs initial setup, adding the #[odra(init)] attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed.

It's important to note that a constructor function should not be invoked in any other context.

Example

examples/erc20.rs
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = contract_env::caller();
let amount: Balance = contract_env::attached_value();
let current_block_time: BlockTime = contract_env::get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
contract_env::revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
Deposit {
address: caller,
amount
}
.emit();
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

However, a constructor cannot be payable, so the below code would not compile.

#[odra(payable)]
#[odra(init)]
fn initialize() {
// your logic...
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/advanced/composer/index.html b/docs/docs/0.4.0/advanced/composer/index.html new file mode 100644 index 000000000..2dc594e86 --- /dev/null +++ b/docs/docs/0.4.0/advanced/composer/index.html @@ -0,0 +1,17 @@ + + + + + +Module Composer | Odra + + + + + +
+
Version: 0.4.0

Module Composer

The Module Composer is a feature of the Odra Framework designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the Module Composer feature, complete with practical code examples.

Conceptual Overview

By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key.

#[odra::module]
struct Contract {
value: Variable<u8>, // the default namespace would be "contract_value"
module: Module
}

#[odra::module]
struct Module {
secret: Variable<String> // the default namespace would be "contract_module_secret"
}

While this isolation often proves useful, there are scenarios where shared storage is beneficial. Here, the Module Composer comes in.

Additionally, the Module Composer shortens the storage key - a handy side effect of shared storage.

For each module, Odra generates a corresponding Composer struct (e.g., MyContractComposer for MyContract module), which aids in manual module composition.

Usage

By default, the #[odra::module] macro generates an implementation of the odra::Instance trait, prefixing the storage key of child modules with the parent namespace. To disable this behavior, pass the skip_instance argument to the #[odra::module] macro.

Let's write a simple code example. The example provided below introduces some additional complexity by featuring deeper module nesting.

use odra::{Instance, Variable, Composer};

#[odra::module]
pub struct SharedStorage {
pub value: Variable<String>
}

#[odra::module]
pub struct MyStorage {
pub shared: SharedStorage,
pub version: Variable<u8>
}

#[odra::module]
pub struct MoreStorage {
pub my_storage: MyStorage,
pub extra: Variable<u32>
}

#[odra::module(skip_instance)]
pub struct ComplexContract {
pub shared: SharedStorage,
pub more_storage: MoreStorage
}

#[odra::module]
impl ComplexContract {
#[odra(init)]
pub fn init(&mut self, version: u8, value: String, extra: u32) {
self.more_storage.my_storage.version.set(version);
self.shared.value.set(value);
self.more_storage.extra.set(extra);
}

pub fn get_value(&self) -> String {
self.shared.value.get_or_default()
}

pub fn get_value_via_storage(&self) -> String {
self.more_storage.my_storage.shared.value.get_or_default()
}

pub fn get_extra_value(&self) -> u32 {
self.more_storage.extra.get_or_default()
}
}

impl Instance for ComplexContract {
fn instance(namespace: &str) -> Self {
let value = Composer::new(namespace, "v").compose();
let shared = SharedStorageComposer::new(namespace, "shared")
.with_value(&value)
.compose();
let my_storage = MyStorageComposer::new(namespace, "my_storage")
.with_shared(&shared)
.compose();
let more_storage = MoreStorageComposer::new(namespace, "more_storage")
.with_my_storage(&my_storage)
.compose();
Self { shared, more_storage }
}
}

#[cfg(test)]
mod test {
use crate::composer::ComplexContractDeployer;

#[test]
fn t() {
let shared_value = "shared_value".to_string();
let extra_value: u32 = 314;
let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);

assert_eq!(token.get_value(), shared_value);
assert_eq!(token.get_value_via_storage(), shared_value);
assert_eq!(token.get_extra_value(), extra_value);
}
}

In this example, we've introduced a new module, MoreStorage, which nests MyStorage and includes an extra value. The ComplexContract contains SharedStorage and MoreStorage, creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels.

If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:

  1. On the contract level - contract_shared_value.
  2. On the MyStorage module level - contract_more_storage_shared_value.

This example showcases how you can effectively use the Module Composer feature to build intricate and efficient smart contracts.

note

To customize the storage building block, you can use Composer which API matches to modules composers API.

Conclusion

The Module Composer in Odra provides developers with a high level of flexibility and control over module behavior in their smart contracts. This guide, complete with a practical example, should give you a good understanding of the feature. Embrace the power of the Module Composer and unleash the full potential of your smart contracts!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/advanced/delegate/index.html b/docs/docs/0.4.0/advanced/delegate/index.html new file mode 100644 index 000000000..e55ef12ee --- /dev/null +++ b/docs/docs/0.4.0/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.4.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
pub fn approve(&mut self, spender: Address, amount: U256);
pub fn name(&self) -> String;
pub fn symbol(&self) -> String;
pub fn decimals(&self) -> u8;
pub fn total_supply(&self) -> U256;
pub fn balance_of(&self, owner: Address) -> U256;
pub fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
pub fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};

#[odra::module]
pub struct DeFiPlatform {
ownable: Ownable,
erc20: Erc20,
exchange: Exchange
}

#[odra::module]
impl DeFiPlatform {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
}

to self.exchange {
pub fn swap(&mut self, sender: Address, recipient: Address);
pub fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/backends/casper/index.html b/docs/docs/0.4.0/backends/casper/index.html new file mode 100644 index 000000000..d5c3a5614 --- /dev/null +++ b/docs/docs/0.4.0/backends/casper/index.html @@ -0,0 +1,37 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.4.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Types

A struct to be written into the storage must implement OdraType which is defined as follow:

pub trait OdraType: 
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

The other exposed types are:

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement SerializableEvent which is defined as follow:

pub trait SerializableEvent: 
odra_types::event::OdraEvent +
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling contract_env::attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The contract_env::self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The contract_env::caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call contract_env::self_balance, which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Constructors

Let's define a basic Odra module that includes a constructor:

#[odra::module]
struct Counter {
value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub initialize(&mut self, value: u32) {
self.value.set(value);
}
}

Read more about constructors here.

WASM arguments

When deploying a new contract you have to specify following arguments.

Required arguments:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Optional arguments:

  • odra_cfg_constructor - String type. If the contract has the constructor entry point marked with #[odra(init)], this should be set to the constructor name.
  • constructor arguments that match entry point set in odra_cfg_constructor.

Example usage

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'initialize'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. Option<U512> type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK.

Execution

First thing Odra does with your code, is similar to the one used in MockVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/backends/mock-vm/index.html b/docs/docs/0.4.0/backends/mock-vm/index.html new file mode 100644 index 000000000..ebe7eac5e --- /dev/null +++ b/docs/docs/0.4.0/backends/mock-vm/index.html @@ -0,0 +1,26 @@ + + + + + +MockVM | Odra + + + + + +
+
Version: 0.4.0

MockVM

The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler.

Usage

The MockVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

MockVM consists of two main parts: the Contract Register and the State.

The Contract Register is just a list of contracts deployed onto the MockVM, identified by an Address. +Each time we call the contract, we call its instance stored in the Contract Register.

Contracts and Test Env functions can modify the State of the MockVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the MockVM State holds only the current state of the MockVM. +Thanks to this and the fact that we do not need the blockchain itself, +MockVM starts instantly and runs the tests in the native speed.

Execution

When the MockVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, MockVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/backends/what-is-a-backend/index.html b/docs/docs/0.4.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..8967a2f54 --- /dev/null +++ b/docs/docs/0.4.0/backends/what-is-a-backend/index.html @@ -0,0 +1,27 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.4.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like MockVM, +or a complete virtual machine, spinning up a blockchain for you - like CasperVM.

Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Test Env

Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/cargo-odra/index.html b/docs/docs/0.4.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..74bdb61b5 --- /dev/null +++ b/docs/docs/0.4.0/basics/cargo-odra/index.html @@ -0,0 +1,38 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.4.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them on multiple backends (blockchains).

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands will help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This will create a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it will create a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This will create a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

Most used command during the development of your project should be this one:

cargo odra test

It will run your tests against Odra's MockVM. It is substantially faster than virtual machines +provided by blockchains developers and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files, +spin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat. +Keep in mind that this is a lot slower than MockVM and you cannot use the debugger. +This is why MockVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build -b casper

Where casper is the name of the backend we are using in this example. If the build process +finishes successfully, wasm files will be located in wasm folder.

Updating dependencies

You will learn later, that the project using Odra contains more than one Rust project - your own and +one or more builders. To run cargo update on all of them at once instead of traversing all the folders +you can use this command:

cargo odra update

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/communicating-with-host/index.html b/docs/docs/0.4.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..588a74871 --- /dev/null +++ b/docs/docs/0.4.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.4.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/docs/host.rs
use odra::Variable;
use odra::types::{BlockTime, Address};

#[odra::module]
pub struct HostContract {
name: Variable<String>,
created_at: Variable<BlockTime>,
created_by: Variable<Address>,
}

#[odra::module]
impl HostContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(odra::contract_env::get_block_time());
self.created_by.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are calling functions from odra::contract_env. get_block_time() will return +the current block time wrapped in Odra type BlockTime. caller() will return an Odra Address of +a caller (this can be an external caller or another contract).

info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/cross-calls/index.html b/docs/docs/0.4.0/basics/cross-calls/index.html new file mode 100644 index 000000000..53095cefa --- /dev/null +++ b/docs/docs/0.4.0/basics/cross-calls/index.html @@ -0,0 +1,25 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.4.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/docs/cross_calls.rs
use odra::Variable;
use odra::types::{Address};

#[odra::module]
pub struct CrossContract {
pub math_engine: Variable<Address>,
}

#[odra::module]
impl CrossContract {
#[odra(init)]
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap();
MathEngineRef::at(math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine {
}

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To call the external contract, we use the Ref that was created for us by Odra:

examples/src/docs/cross_calls.rs
MathEngineRef::at(math_engine_address).add(3, 5)

Contract Ref

We mentioned Ref already in our Testing article. +It is a reference to already deployed - running contract. +Here we are going to take a deeper look at it.

Similarly to a Deployer, the Ref is generated automatically, thanks to the #[odra::module] macro. +To get an instance of a reference, we can either deploy a contract (using Deployer) or by building it +directly, using ::at(address: Address) method, as shown above. +The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), alongside couple methods:

  • at(Address) -> Self - points the reference to an Address
  • address() -> Address - returns the Address the reference is currently pointing at
  • with_tokens(Amount) -> Self - attaches Amount of native tokens to the next call

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

examples/src/docs/cross_calls.rs
#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderRef struct (but do not create the AdderDeployer). Having an address we can call:

examples/src/docs/cross_calls.rs
AdderRef::at(address).add(3, 5)

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/docs/cross_calls.rs
use super::{CrossContractDeployer, MathEngineDeployer};

#[test]
fn test_cross_calls() {
let math_engine_contract = MathEngineDeployer::default();
let cross_contract = CrossContractDeployer::init(math_engine_contract.address());

assert_eq!(cross_contract.add_using_another(), 8);
}

Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a MathEngine contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the add() function we want to use.

examples/src/docs/cross_calls.rs
#[cfg(test)]
mod tests {
use odra::types::Address;
use crate::docs::cross_calls::{Adder, AdderRef};

#[test]
fn test_ext() {
let adder = AdderRef::at(get_adder_address());

assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address() -> Address {
let contract = MathEngineDeployer::default();
contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/directory-structure/index.html b/docs/docs/0.4.0/basics/directory-structure/index.html new file mode 100644 index 000000000..ee37217af --- /dev/null +++ b/docs/docs/0.4.0/basics/directory-structure/index.html @@ -0,0 +1,27 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.4.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── .builder_casper/
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

By default, your project will use the latest odra version available at crates.io. We are using two features:

  • odra/mock-vm - it is responsible for running tests on Odra's MockVM
  • odra/casper - backend implementation of Casper blockchain +More backends will be released as features that will be possible to enable here.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

.builder_* folders

Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary +for building wasm files and running them against blockchain VMs. As it is not necessary to modify +files in those folders in any way, by default they are hidden (hence the . at the beginning of the +folder name).

src/

This is the folder where your smart contract files live.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain of your choosing.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/errors/index.html b/docs/docs/0.4.0/basics/errors/index.html new file mode 100644 index 000000000..844f3a035 --- /dev/null +++ b/docs/docs/0.4.0/basics/errors/index.html @@ -0,0 +1,23 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.4.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/docs/errors.rs
use odra::{execution_error, Variable, UnwrapOrRevert};
use odra::types::Address;

#[odra::module]
pub struct OwnedContract {
name: Variable<String>,
owner: Variable<Address>,
}

execution_error! {
pub enum Error {
OwnerNotSet => 1,
NotAnOwner => 2,
}
}


#[odra::module]
impl OwnedContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = odra::contract_env::caller();
if caller != self.owner() {
odra::contract_env::revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using execution_error! macro to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/docs/errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You and the users of your contract will be thankful for a meaningful error message!

You can also throw the error directly, by using revert:

examples/src/docs/errors.rs
odra::contract_env::revert(Error::NotAnOwner)

Testing errors

Okay, but how about testing it? We've already mentioned a function - assert_exception. This is how you will +use it:

examples/src/docs/errors.rs
use super::{OwnedContractDeployer, OwnedContractRef};
use super::Error;

#[test]
fn test_owner_error() {
let owner = odra::test_env::get_account(0);
let not_an_owner = odra::test_env::get_account(1);

odra::test_env::set_caller(owner);
let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());

odra::test_env::set_caller(not_an_owner);
odra::test_env::assert_exception(Error::NotAnOwner, || {
owned_contract.change_name("NewName".to_string());
})
}

In the example above, because we are calling the change_name method as an address which is not an "owner", +we are expecting that "NotAnOwner" error will be thrown.

note

Here we are creating another reference to the already deployed contract using OwnedContractRef::at() and passing to it +its Address. Note that OwnedContractDeployer::init() returns the same type.

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/events/index.html b/docs/docs/0.4.0/basics/events/index.html new file mode 100644 index 000000000..1c4dd25de --- /dev/null +++ b/docs/docs/0.4.0/basics/events/index.html @@ -0,0 +1,20 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.4.0

Events

Different blockchains implement events in different ways. Odra lets you forget about it by introducing +Odra Events. Take a look:

examples/src/docs/events.rs
use odra::{Event, contract_env};
use odra::types::{Address, BlockTime, event::OdraEvent};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract {
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

#[odra::module]
impl PartyContract {
#[odra(init)]
pub fn init(&self) {
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, we derive an Event macro like this:

examples/src/docs/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

Among other things, it adds an emit() function to the struct, which allows you to emit the event simply +as that:

examples/src/docs/events.rs
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();

Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] macro.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's test_env comes with a handy macro assert_events! which lets you easily test the events that a given contract has emitted:

examples/src/docs/events.rs
use odra::{assert_events, test_env};
use crate::docs::events::PartyStarted;
use super::PartyContractDeployer;

#[test]
fn test_party() {
let party_contract = PartyContractDeployer::init();
assert_events!(
party_contract,
PartyStarted {
caller: test_env::get_account(0),
block_time: 0,
}
);
}

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/flipper-internals/index.html b/docs/docs/0.4.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..b773b4ab8 --- /dev/null +++ b/docs/docs/0.4.0/basics/flipper-internals/index.html @@ -0,0 +1,35 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.4.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Variable;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Variable, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Variables and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Variable<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The #[odra(init)] macro marks the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Variable<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using FlipperDeployer - a piece of code generated automatically thanks to the macros. +The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/modules/index.html b/docs/docs/0.4.0/basics/modules/index.html new file mode 100644 index 000000000..650d1380d --- /dev/null +++ b/docs/docs/0.4.0/basics/modules/index.html @@ -0,0 +1,20 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.4.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to a macro #[odra::module]. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/docs/modules.rs
use crate::docs::cross_calls::MathEngine;

#[odra::module]
pub struct ModulesContract {
pub math_engine: MathEngine,
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/docs/modules.rs
use super::ModulesContractDeployer;

#[test]
fn test_modules() {
let modules_contract = ModulesContractDeployer::default();
assert_eq!(modules_contract.add_using_module(), 8);
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/native-token/index.html b/docs/docs/0.4.0/basics/native-token/index.html new file mode 100644 index 000000000..6d342a269 --- /dev/null +++ b/docs/docs/0.4.0/basics/native-token/index.html @@ -0,0 +1,26 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.4.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::contract_env;

#[odra::module]
pub struct PublicWallet {
}

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {
}

pub fn withdraw(&mut self, amount: Balance) {
contract_env::transfer_tokens(contract_env::caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/tlw.rs in the odra main repository.

You can see a new macro used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from contract_env - transfer_tokens. +It does exactly what you are expecting it to do - it will transfer native tokens from the contract to the +specified address.

We are also using the Balance - an Odra type that wraps around the type that the underlying blockchain uses +for counting tokens.

Testing

To be able to test how many tokens a contract (or any address) has, test_env comes with a function - +token_balance:

examples/src/docs/native_token.rs
use odra::types::Balance;
use odra::test_env;
use super::PublicWalletDeployer;

#[test]
fn test_modules() {
let mut my_contract = PublicWalletDeployer::default();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());

my_contract.with_tokens(Balance::from(100)).deposit();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));

my_contract.withdraw(Balance::from(25));
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/odra-toml/index.html b/docs/docs/0.4.0/basics/odra-toml/index.html new file mode 100644 index 000000000..d796fd412 --- /dev/null +++ b/docs/docs/0.4.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.4.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

The name will be used as a name for the contract - the generated wasm file will be in the above case named +flipper.wasm.

The fqn (Fully Qualified Name) is used by the builder to locate the exact struct where +the contract is defined.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

[[contracts]]
name = "counter"
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/storage-interaction/index.html b/docs/docs/0.4.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..e4f6760fa --- /dev/null +++ b/docs/docs/0.4.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.4.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Variable

The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Variable type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/docs/variable.rs
#[odra::module]
pub struct DogContract {
barks: Variable<bool>,
weight: Variable<u32>,
name: Variable<String>,
walks: Variable<Vec<u32>>,
}

You can see the Variable wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/docs/variable.rs
use odra::Variable;

#[odra::module]
impl DogContract {
#[odra(init)]
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/docs/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/docs/variable.rs
self.barks.set(barks);

A Variable is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/docs/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/docs/mapping.rs
use odra::{Mapping, Variable};

#[odra::module]
pub struct DogContract2 {
name: Variable<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Variables section with one difference - we need to pass a key:

examples/src/docs/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Variable is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Variable working together:

core/src/list.rs
use odra::{Variable, List};

pub struct List<T> {
values: Mapping<u32, T>,
index: Variable<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/docs/list.rs
#[odra::module]
pub struct DogContract3 {
name: Variable<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/docs/list.rs
#[odra::module]
impl DogContract3 {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the odra repository in the examples/src/docs/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/basics/testing/index.html b/docs/docs/0.4.0/basics/testing/index.html new file mode 100644 index 000000000..ad08a2512 --- /dev/null +++ b/docs/docs/0.4.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.4.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/docs/list.rs
use odra::{Variable, List};

#[cfg(test)]
mod tests {
use super::DogContract3Deployer;

#[test]
fn init_test() {
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The #[odra(module)] macro created a Deployer code for us, which will deploy the contract on the +VM:

examples/src/docs/list.rs
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with a macro are available to us:

examples/src/docs/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

Test env

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/docs/testing.rs
#[cfg(test)]
mod tests {
use super::TestingContractDeployer;

#[test]
fn test_env() {
let testing_contract = TestingContractDeployer::init("MyContract".to_string());
let creator = testing_contract.created_by();
odra::test_env::set_caller(odra::test_env::get_account(1));
let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());
let creator2 = testing_contract2.created_by();
assert!(creator != creator2);
}
}

In the code above, we are deploying two instances of the same contract, but we're using odra::test_env::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::contract_env::caller() +the function we are calling inside the contract.

Each test env comes with a set of functions that will let you write better tests:

  • fn set_caller(address: Address) - you've seen it in action just now
  • fn token_balance(address: Address) -> Balance - it returns the balance of the account associated with the given address
  • fn advance_block_time_by(seconds: BlockTime) - it increases the current value of block_time
  • fn get_account(n: usize) -> Address - it returns an nth address that was prepared for you by Odra in advance; +by default, you start with the 0th account
  • fn assert_exception<F, E>(err: E, block: F) - it executes the block code and expects err to happen
  • fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError> - returns +the event emitted by the contract

Again, we'll see those used in the next articles.

Deployer

You may be wondering what is the TestingContractDeployer and where did it come from. +It is a piece of code generated automatically for you, thanks to the #[odra::module] macro. +If you used the #[odra(init)] on one of the methods, it will be the constructor of your contract. +Odra will make sure that it is called only once, so you can use it to initialize your data structures etc.

If you do not provide the init method, you can deploy the contract using ::default() method. +In the end, you will get a Ref instance (in our case the TestingContractRef) which reimplements all +the methods you defined in the contract, but executes them on a blockchain!

To learn more about the Ref contract, visit the Cross calls article.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/category/advanced/index.html b/docs/docs/0.4.0/category/advanced/index.html new file mode 100644 index 000000000..75285a07a --- /dev/null +++ b/docs/docs/0.4.0/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
Version: 0.4.0

Advanced

Advanced concepts of Odra Framework

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/category/backends/index.html b/docs/docs/0.4.0/category/backends/index.html new file mode 100644 index 000000000..1cdc344c7 --- /dev/null +++ b/docs/docs/0.4.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/category/basics/index.html b/docs/docs/0.4.0/category/basics/index.html new file mode 100644 index 000000000..75e5331f6 --- /dev/null +++ b/docs/docs/0.4.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/category/examples/index.html b/docs/docs/0.4.0/category/examples/index.html new file mode 100644 index 000000000..740f694fa --- /dev/null +++ b/docs/docs/0.4.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/category/getting-started/index.html b/docs/docs/0.4.0/category/getting-started/index.html new file mode 100644 index 000000000..c226c427c --- /dev/null +++ b/docs/docs/0.4.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/category/tutorials/index.html b/docs/docs/0.4.0/category/tutorials/index.html new file mode 100644 index 000000000..02dc761f5 --- /dev/null +++ b/docs/docs/0.4.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/examples/odra-examples/index.html b/docs/docs/0.4.0/examples/odra-examples/index.html new file mode 100644 index 000000000..7cded9229 --- /dev/null +++ b/docs/docs/0.4.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.4.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/examples/using-odra-modules/index.html b/docs/docs/0.4.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..38e1e3b59 --- /dev/null +++ b/docs/docs/0.4.0/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.4.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]
casper = ["odra/casper", "odra-modules/casper"]
danger

odra-modules defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a casper feature in your project, add odra-modules/casperspecifically (it applies to each backend).

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::types::{Address, U256};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/getting-started/flipper/index.html b/docs/docs/0.4.0/getting-started/flipper/index.html new file mode 100644 index 000000000..fe5105c8f --- /dev/null +++ b/docs/docs/0.4.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.4.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Variable;

/// A module definition. Each module struct consists Variables and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let mut contract1 = FlipperDeployer::initial_settings();
let contract2 = FlipperDeployer::initial_settings();
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/getting-started/installation/index.html b/docs/docs/0.4.0/getting-started/installation/index.html new file mode 100644 index 000000000..a71082dfd --- /dev/null +++ b/docs/docs/0.4.0/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.4.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-uknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called "my_project" and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/index.html b/docs/docs/0.4.0/index.html new file mode 100644 index 000000000..67db76ad4 --- /dev/null +++ b/docs/docs/0.4.0/index.html @@ -0,0 +1,25 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.4.0

Odra framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, +pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open +source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. We can do it +by abstracting over core concepts that all the above systems are built around. These are type system, +storage, entry points, execution context, and testing environment. We believe it will bring standardization +to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this +ecosystem.

What's next

See the Installation and our Flipper example +to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/tutorials/erc20/index.html b/docs/docs/0.4.0/tutorials/erc20/index.html new file mode 100644 index 000000000..29c6dbda9 --- /dev/null +++ b/docs/docs/0.4.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.4.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • advanced storage - key-value pairs,
  • Odra types like Address or Balance,
  • advanced events assertion.

Code

Our module has a pretty complex storage layout in comparison to the previous example.

We need to store the following data:

  1. Immutable metadata - name, symbol and decimals.
  2. Total supply.
  3. Users' balances.
  4. Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.

Module definition

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Variable<u8>,
symbol: Variable<String>,
name: Variable<String>,
total_supply: Variable<Balance>,
balances: Mapping<Address, Balance>,
allowances: Mapping<Address, Mapping<Address, Balance>>
}
  • L6 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping. You may notice the balances property maps Address to Balance. If you deal with addresses or you operate on tokens, you should always choose Address over String and Balance over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform.
  • L7 - Odra allows nested Mappings, what we utilize to store allowances.

Metadata

#[odra::module]
impl Erc20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> Balance {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.balances.add(address, *amount);
self.total_supply.add(amount);
Transfer {
from: None,
to: Some(*address),
amount: *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: Balance
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L10 - A constructor sets the token metadata and mints the initial supply.
  • L12-L14 - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the Ownable example, we used the get() function returning an Option<T>. If the type implements Default trait, you can call get_or_default() function and the contract does not fail even if the value is not initialized.
  • L29 - The second impl is not an odra module, in other words these function will not be a part of contract's ABI.
  • L30-L39 - Mint function is public, so like in a regular rust code will be accessible from the outside. mint() use notation self.balances.add(&address, amount);, which it is syntactic sugar for:
let current_balance = self.balances.get(&address).unwrap_or_default();
let new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();
self.balances.set(&address, new_balance);

Core

For the sake of completeness, let's implement the remaining functionalities like transfer, transfer_from, or approve. They are not introducing any new concepts, so we leave them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...
pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
let caller = contract_env::caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let spender = contract_env::caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
let owner = contract_env::caller();
self.allowances.get_instance(&owner).set(spender, *amount);
Approval {
owner,
spender: *spender,
value: *amount
}
.emit();
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.allowances.get_instance(owner).get_or_default(spender)
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
contract_env::revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
}
.emit();
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {
let allowance = self.allowances.get_instance(owner).get_or_default(spender);
if allowance < *amount {
contract_env::revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.get_instance(owner)
.set(spender, new_allowance);
Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};
use odra::{assert_events, test_env, types::U256};

pub const NAME: &str = "Plascoin";
pub const SYMBOL: &str = "PLS";
pub const DECIMALS: u8 = 10;
pub const INITIAL_SUPPLY: u32 = 10_000;

pub fn setup() -> Erc20Ref {
Erc20Deployer::init(
String::from(NAME),
String::from(SYMBOL),
DECIMALS,
INITIAL_SUPPLY.into()
)
}

#[test]
fn initialization() {
let erc20 = setup();

assert_eq!(&erc20.symbol(), SYMBOL);
assert_eq!(&erc20.name(), NAME);
assert_eq!(erc20.decimals(), DECIMALS);
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());
assert_events!(
erc20,
Transfer {
from: None,
to: Some(test_env::get_account(0)),
amount: INITIAL_SUPPLY.into()
}
);
}

#[test]
fn transfer_works() {
let mut erc20 = setup();
let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

erc20.transfer(&recipient, &amount);

assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);
assert_eq!(erc20.balance_of(&recipient), amount);
assert_events!(
erc20,
Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
);
}

#[test]
fn transfer_error() {
let mut erc20 = setup();
let recipient = test_env::get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);

test_env::assert_exception(Error::InsufficientBalance, || {
erc20.transfer(&recipient, &amount)
});
}

#[test]
fn transfer_from_and_approval_work() {
let mut erc20 = setup();
let (owner, recipient, spender) = (
test_env::get_account(0),
test_env::get_account(1),
test_env::get_account(2)
);
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount
}
);

// Spender transfers tokens from Owner to Recipient.
test_env::set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount - transfer_amount
},
Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
);

assert_events!(erc20, Approval, Transfer);
}

#[test]
fn transfer_from_error() {
let mut erc20 = setup();
let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

test_env::set_caller(spender);
test_env::assert_exception(Error::InsufficientAllowance, || {
erc20.transfer_from(&owner, &spender, &amount)
});
}
}
  • L111-123 - assert_events!() macro accepts multiple events. You must pass them in the order they were emitted.
  • L125 - Alternatively, if you don't want to check the entire event, you may assert only its type.
danger

You can not mix both approaches, you pass full events or types only.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/tutorials/ownable/index.html b/docs/docs/0.4.0/tutorials/ownable/index.html new file mode 100644 index 000000000..ed9c436bd --- /dev/null +++ b/docs/docs/0.4.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.4.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining constructors,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

use odra::{types::Address, Variable};

#[odra::module]
pub struct Ownable {
owner: Variable<Address>
}

That was easy, but it is crucial to understand the basic before we move on.

  • L3 - Firstly, we need create a struct called Ownable and apply #[odra::module] to it above.
  • L5 - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with Variable.

Init the module

use odra::{
execution_error, contract_env, Event, types::{Address, event::OdraEvent}
};
...

#[odra::module]
impl Ownable {
#[odra(init)]
pub fn init(&mut self, owner: &Address) {
if self.owner.get().is_some() {
contract_env::revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(*owner);

OwnershipChanged {
prev_owner: None,
new_owner: *owner
}
.emit();
}
}

execution_error! {
pub enum Error {
OwnerIsNotInitialized => 1,
}
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L5 - The impl should be an odra module, so add #[odra::module].
  • L7 - The init function is marked as #[odra(init)] making it a constructor. It matters if we would like to deploy the Ownable module as a standalone contract.
  • L23 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an Error enum. Notice that the Error enum is defined inside the execution_error macro. It generates, among others, the required Into<ExecutionError> binding.
  • L9-L11 - If the owner has been set already, we call contract_env::revert() function. As an argument we pass Error::OwnerIsNotInitialized.
  • L13 - Then we write the owner passed as an argument to the storage. To do so we call the set() on Variable.
  • L29-L33 - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L23 - Finally, we create the OwnershipChanged struct and call emit() function on it (import odra::types::event::OdraEvent trait). Hence we set the first owner, we set the prev_owner value to None.

Features implementation

#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get().as_ref() {
contract_env::revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&contract_env::caller());
let current_owner = self.get_owner();
self.owner.set(*new_owner);
OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
}
.emit();
}

pub fn get_owner(&self) -> Address {
match self.owner.get() {
Some(owner) => owner,
None => contract_env::revert(Error::OwnerIsNotInitialized)
}
}
}

execution_error! {
pub enum Error {
NotOwner => 1,
OwnerIsAlreadyInitialized => 2,
OwnerIsNotInitialized => 3,
}
}

The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along.

  • L5,L32 - ensure_ownership() is reads the current owner, and reverts if is does not match the input Address. Also we need to update our Error enum adding a new variant NotOwner.
  • L11 - The function defined above can be reused in change_ownership() implementation. We pass to it the current caller, using the contract_env::caller() function. The we update the state, and emit OwnershipChanged.
  • L22,L34 - Lastly, a getter function. As the Variable get() function returns an Option, we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized.

Test

#[cfg(test)]
mod tests {
use super::*;
use odra::{assert_events, test_env};

fn setup() -> (Address, OwnableRef) {
let owner = test_env::get_account(0);
let ownable = OwnableDeployer::init(owner);
(owner, ownable)
}

#[test]
fn initialization_works() {
let (owner, ownable) = setup();
assert_eq!(ownable.get_owner(), owner);

assert_events!(
ownable,
OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (owner, mut ownable) = setup();
let new_owner = test_env::get_account(1);

test_env::set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);
assert_events!(
ownable,
OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (_, mut ownable) = setup();
let new_owner = test_env::get_account(1);
ownable.change_ownership(&new_owner);

test_env::assert_exception(Error::NotOwner, || {
ownable.change_ownership(&new_owner);
});
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we defined the setup() function we call as the first statement in each test. Take a look at the signature fn setup() -> (Address, OwnableRef). OwnableRef is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ensure_ownership(), change_ownership(), get_owner(), but not init() which is a constructor.
  • L7 - Now, the module needs an owner, the easiest way is to take one from the test_env. We choose the address of first account (which is the default one).
  • L8 - Odra created for us OwnableDeployer struct which implements all constructor functions. In this case there is just one function - init() which corresponds the function we have implemented in the module.
  • L12 - It is time to define the first test. As you see, it is a regular rust test.
  • L14-15 - Using the setup() function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L17-23 - On the contract, only the init() function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro assert_events. As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred.
  • L30 - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the test env predefines 20 accounts.
  • L32 - As mentioned, the default is the 0-th account, if you want to change the executor call the test_env::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L49-55 - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call test_env::assert_exception() with the error you expect and a failing block of code.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.4.0/tutorials/owned-token/index.html b/docs/docs/0.4.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..cbcea304a --- /dev/null +++ b/docs/docs/0.4.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.4.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow minting tokens but only the module owner.
  3. The current owner should be able to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
use odra::types::{Address, Balance}

...

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> Balance {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.ownable.ensure_ownership(&contract_env::caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L10-L11 - A constructor is a great place to init both modules at once.
  • L14-L16 - Most of the entrypoints do not need any modification, so we simply delegates them to the erc20 module.
  • L50-L52 - The same we do with the ownable module.
  • L58-L61 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/advanced/advanced-storage/index.html b/docs/docs/0.5.0/advanced/advanced-storage/index.html new file mode 100644 index 000000000..c5280965c --- /dev/null +++ b/docs/docs/0.5.0/advanced/advanced-storage/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.5.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Variable, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values.

Variable: A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that holds a Variable which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Variable<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{map, types::U256, Mapping, UnwrapOrRevert};

use crate::owned_token::OwnedToken;

#[odra::module]
pub struct NestedMapping {
strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,
tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>
}

#[odra::module]
impl NestedMapping {

...

pub fn set_token(
&mut self,
key1: String,
key2: u32,
key3: String,
token_name: String,
decimals: u8,
symbol: String,
initial_supply: &U256
) {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.init(token_name, symbol, decimals, initial_supply);
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let mapping = self.strings.get_instance(&key1).get_instance(&key2);
mapping.get(&key3).unwrap_or_revert()
}

pub fn total_supply(
&self,
key1: String,
key2: u32,
key3: String
) -> U256 {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.total_supply()
}
}
note

Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers.

Instead of using the get() function, call get_instance(), which sets the correct namespace for nested modules.

If the terminal value is deeply nested, a long chain of get_instance() calls is required.

To keep the codebase consistent, a map! macro can be used:

examples/src/features/storage/mapping.rs
...

pub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {
map!(self.strings[key1][key2][key3] = value);
}

pub fn get_string_macro(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
map!(self.strings[key1][key2][key3])
}

danger

The terminal value must not be an Odra Module.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Sequence, Mapping};
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
my_sequence: Sequence<u32>,
my_mapping: Mapping<String, Mapping<String, Token>>,
}

impl AdvancedStorage {
pub fn get_sequence_current_value(&self) -> u32 {
self.my_sequence.get_current_value()
}

pub fn next_sequence_value(&mut self) -> u32 {
self.my_sequence.next_value()
}

pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.set(&inner_key, value);
}

pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.get(&inner_key)
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/advanced/attributes/index.html b/docs/docs/0.5.0/advanced/attributes/index.html new file mode 100644 index 000000000..374ea6b23 --- /dev/null +++ b/docs/docs/0.5.0/advanced/attributes/index.html @@ -0,0 +1,19 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.5.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Init

If your contract needs initial setup, adding the #[odra(init)] attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed.

It's important to note that a constructor function should not be invoked in any other context.

Example

examples/src/contracts/erc20.rs
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

Using

An attribute applicable to struct fields. The using attribute accepts multiple values, separated by ,. +Each value attribute must point at an existing field.

Example

#[odra::module]
struct Contract {
access_control: AccessControl,
meta: Metadata,
#[odra(using = "access_control, meta")]
// #[odra(using = "access_control, metadata")] - would not compile - `metadata` field does not exist
storage: Storage
}

#[odra::module]
struct AccessControl {
owner: Variable<Address>
}

#[odra::module]
struct Metadata {
version: Variable<String>
}

#[odra::module]
struct Storage {
value: Variable<u8>,
access_control: AccessControl,
meta: Metadata
}

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = contract_env::caller();
let amount: Balance = contract_env::attached_value();
let current_block_time: BlockTime = contract_env::get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
contract_env::revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
Deposit {
address: caller,
amount
}
.emit();
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

However, a constructor cannot be payable, so the below code would not compile.

#[odra(payable)]
#[odra(init)]
fn initialize() {
// your logic...
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/advanced/delegate/index.html b/docs/docs/0.5.0/advanced/delegate/index.html new file mode 100644 index 000000000..f86b2803a --- /dev/null +++ b/docs/docs/0.5.0/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.5.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
pub fn approve(&mut self, spender: Address, amount: U256);
pub fn name(&self) -> String;
pub fn symbol(&self) -> String;
pub fn decimals(&self) -> u8;
pub fn total_supply(&self) -> U256;
pub fn balance_of(&self, owner: Address) -> U256;
pub fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
pub fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};

#[odra::module]
pub struct DeFiPlatform {
ownable: Ownable,
erc20: Erc20,
exchange: Exchange
}

#[odra::module]
impl DeFiPlatform {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
}

to self.exchange {
pub fn swap(&mut self, sender: Address, recipient: Address);
pub fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/advanced/signatures/index.html b/docs/docs/0.5.0/advanced/signatures/index.html new file mode 100644 index 000000000..33776c8a1 --- /dev/null +++ b/docs/docs/0.5.0/advanced/signatures/index.html @@ -0,0 +1,29 @@ + + + + + +Signatures | Odra + + + + + +
+
Version: 0.5.0

Signatures

As each backend can use a different scheme for generating key pairs, +Odra Framework provides a generic function for signature verification inside the contract context. +Thanks to this, you can write your code once, without worrying about underlying cryptography.

Signature verification

Signature verification is conducted by a function in contract_env:

pub fn verify_signature(message: &Bytes, signature: &Bytes, public_key: &PublicKey) -> bool;

Here's the simplest example of this function used in a contract:

examples/src/features/signature_verifier.rs
#[odra::module]
impl SignatureVerifier {
pub fn verify_signature(
&self,
message: &Bytes,
signature: &Bytes,
public_key: &PublicKey
) -> bool {
contract_env::verify_signature(message, signature, public_key)
}
}

Testing

Besides the above function in the contract context, Odra provides corresponding functions in the test_env:

pub fn sign_message(message: &Bytes, address: &Address) -> Bytes;

pub fn public_key(address: &Address) -> PublicKey;

sign_message will return a signed message. The signing itself will be performed using a private key +of an account behind the address.

public_key returns the PublicKey of an address account.

Thanks to those, you can write generic tests, that will work with all backends, despite differences +in signature schemes they use.

examples/src/features/signature_verifier.rs
#[test]
fn signature_verification_works() {
let message = "Message to be signed";
let message_bytes = &Bytes::from(message.as_bytes().to_vec());
let account = test_env::get_account(0);

let signature = test_env::sign_message(message_bytes, &account);

let public_key = test_env::public_key(&account);

let signature_verifier = SignatureVerifierDeployer::default();
assert!(signature_verifier.verify_signature(message_bytes, &signature, &public_key));
}

If you want, you can also test signatures that were created outside Odra. +However, you will need to prepare separate tests for each backend:

examples/src/features/signature_verifier.rs
/// The following test checks that the signature verification works with the signature produced
/// by the casper wallet.
#[test]
#[cfg(feature = "casper")]
fn verify_signature_casper_wallet() {
use odra::casper::casper_types::bytesrepr::FromBytes;
// Casper Wallet for the message "Ahoj przygodo!" signed using SECP256K1 key
// produces the following signature:
// 1e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa
// Casper Wallet adds "Casper Message:\n" prefix to the message:
let message = "Casper Message:\nAhoj przygodo!";
let message_bytes = &Bytes::from(message.as_bytes().to_vec());

// Depending on the type of the key, we need to prefix the signature with a tag:
// 0x01 for ED25519
// 0x02 for SECP256K1
let signature_hex = "021e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa";
let signature: [u8; 65] = hex::decode(signature_hex).unwrap().try_into().unwrap();
let signature_bytes = &Bytes::from(signature.to_vec());

// Similar to the above, the public key is tagged:
let public_key_hex = "02036d9b880e44254afaf34330e57703a63aec53b5918d4470059b67a4a906350105";
let public_key_decoded = hex::decode(public_key_hex).unwrap();
let (public_key, _) = odra::casper::casper_types::crypto::PublicKey::from_bytes(
public_key_decoded.as_slice()
)
.unwrap();

let signature_verifier = SignatureVerifierDeployer::default();
assert!(signature_verifier.verify_signature(message_bytes, signature_bytes, &public_key));
}

ECRecover

Odra Standard Library +part of the original Odra Proposal mentioned ECRecover as one of the functions that will be +implemented by the Odra Framework. We decided to add signatures verification instead.

The reasoning behind this decision is that the ECRecover works only with one type of signature. +Odra tries to be backend-agnostic, which implies that it should also be signature-type-agnostic. +This was possible to achieve when implementing generic signature verification, but not with ECRecover.

In short, the implementation of ECRecover would not depend on the backend, pushing it into some kind of +utils library, and those already exist, for example in +solana_program +crate.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/advanced/using/index.html b/docs/docs/0.5.0/advanced/using/index.html new file mode 100644 index 000000000..8b907ef88 --- /dev/null +++ b/docs/docs/0.5.0/advanced/using/index.html @@ -0,0 +1,17 @@ + + + + + +Module reusing | Odra + + + + + +
+
Version: 0.5.0

Module reusing

This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.

Conceptual Overview

By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key.

#[odra::module]
struct Contract {
value: Variable<u8>, // the default namespace would be "value"
module: Module
}

#[odra::module]
struct Module {
secret: Variable<String> // the default namespace would be "module_secret"
}

While this isolation often proves useful, there are scenarios where shared storage is beneficial.

Usage

Odra generates an array of keys, prefixing the storage key of child modules with the parent namespace, like in the example above. But what if you want to reuse the same instance of a module? Add a #[odra(using)] attribute to a module to override the default behavior. This is information for the module "Do not prefix storage keys for the given module." so effectively, the child and the parent use the same module instance.

Let's illustrate it with a simple example. The example provided below introduces some additional complexity by featuring deeper module nesting.

use odra::Variable;

#[odra::module]
pub struct SharedStorage {
pub value: Variable<String>
}

#[odra::module]
pub struct MyStorage {
pub shared: SharedStorage,
pub version: Variable<u8>
}

#[odra::module]
pub struct ComposableContract {
pub shared: SharedStorage,
#[odra(using = "shared")]
pub storage: MyStorage
}

#[odra::module]
impl ComposableContract {
#[odra(init)]
pub fn init(&mut self, version: u8, value: String) {
self.storage.version.set(version);
self.shared.value.set(value);
}

pub fn get_value(&self) -> String {
self.shared.value.get_or_default()
}

pub fn get_value_via_storage(&self) -> String {
self.storage.shared.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use crate::composer::ComplexContractDeployer;

#[test]
fn t() {
let shared_value = "shared_value".to_string();
let extra_value: u32 = 314;
let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);

assert_eq!(token.get_value(), shared_value);
assert_eq!(token.get_value_via_storage(), shared_value);
assert_eq!(token.get_extra_value(), extra_value);
}
}

In this example, we've introduced a new module, MoreStorage, which nests MyStorage and includes an extra value. The ComplexContract contains SharedStorage and MoreStorage, creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels.

If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:

  1. On the contract level - contract_shared_value.
  2. On the MyStorage module level - contract_more_storage_shared_value.

This example showcases how you can effectively use the module reusing feature to build intricate and efficient smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/backends/casper/index.html b/docs/docs/0.5.0/backends/casper/index.html new file mode 100644 index 000000000..37978d116 --- /dev/null +++ b/docs/docs/0.5.0/backends/casper/index.html @@ -0,0 +1,44 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.5.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Types

A struct to be written into the storage must implement OdraType which is defined as follow:

pub trait OdraType: 
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

The other exposed types are:

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement SerializableEvent which is defined as follow:

pub trait SerializableEvent: 
odra_types::event::OdraEvent +
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling contract_env::attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The contract_env::self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The contract_env::caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call contract_env::self_balance, which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Constructors

Let's define a basic Odra module that includes a constructor:

#[odra::module]
struct Counter {
value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub initialize(&mut self, value: u32) {
self.value.set(value);
}
}

Read more about constructors here.

WASM arguments

When deploying a new contract you have to specify following arguments.

Required arguments:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Optional arguments:

  • odra_cfg_constructor - String type. If the contract has the constructor entry point marked with #[odra(init)], this should be set to the constructor name.
  • constructor arguments that match entry point set in odra_cfg_constructor.

Contract Deploys

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'initialize'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. Option<U512> type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK.

Execution

First thing Odra does with your code, is similar to the one used in MockVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/backends/mock-vm/index.html b/docs/docs/0.5.0/backends/mock-vm/index.html new file mode 100644 index 000000000..b8aae4c24 --- /dev/null +++ b/docs/docs/0.5.0/backends/mock-vm/index.html @@ -0,0 +1,26 @@ + + + + + +MockVM | Odra + + + + + +
+
Version: 0.5.0

MockVM

The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler.

Usage

The MockVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

MockVM consists of two main parts: the Contract Register and the State.

The Contract Register is just a list of contracts deployed onto the MockVM, identified by an Address. +Each time we call the contract, we call its instance stored in the Contract Register.

Contracts and Test Env functions can modify the State of the MockVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the MockVM State holds only the current state of the MockVM. +Thanks to this and the fact that we do not need the blockchain itself, +MockVM starts instantly and runs the tests in the native speed.

Execution

When the MockVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, MockVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/backends/what-is-a-backend/index.html b/docs/docs/0.5.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..ce574d482 --- /dev/null +++ b/docs/docs/0.5.0/backends/what-is-a-backend/index.html @@ -0,0 +1,27 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.5.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like MockVM, +or a complete virtual machine, spinning up a blockchain for you - like CasperVM.

Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Test Env

Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/cargo-odra/index.html b/docs/docs/0.5.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..886d8d1bb --- /dev/null +++ b/docs/docs/0.5.0/basics/cargo-odra/index.html @@ -0,0 +1,38 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.5.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them on multiple backends (blockchains).

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands will help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This will create a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it will create a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This will create a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

Most used command during the development of your project should be this one:

cargo odra test

It will run your tests against Odra's MockVM. It is substantially faster than virtual machines +provided by blockchains developers and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files, +spin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat. +Keep in mind that this is a lot slower than MockVM and you cannot use the debugger. +This is why MockVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build -b casper

Where casper is the name of the backend we are using in this example. If the build process +finishes successfully, wasm files will be located in wasm folder.

Updating dependencies

You will learn later, that the project using Odra contains more than one Rust project - your own and +one or more builders. To run cargo update on all of them at once instead of traversing all the folders +you can use this command:

cargo odra update

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/communicating-with-host/index.html b/docs/docs/0.5.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..cbb557c12 --- /dev/null +++ b/docs/docs/0.5.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.5.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::Variable;
use odra::types::{BlockTime, Address};

#[odra::module]
pub struct HostContract {
name: Variable<String>,
created_at: Variable<BlockTime>,
created_by: Variable<Address>,
}

#[odra::module]
impl HostContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(odra::contract_env::get_block_time());
self.created_by.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are calling functions from odra::contract_env. get_block_time() will return +the current block time wrapped in Odra type BlockTime. caller() will return an Odra Address of +a caller (this can be an external caller or another contract).

info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/cross-calls/index.html b/docs/docs/0.5.0/basics/cross-calls/index.html new file mode 100644 index 000000000..996eb3680 --- /dev/null +++ b/docs/docs/0.5.0/basics/cross-calls/index.html @@ -0,0 +1,25 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.5.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::Variable;
use odra::types::{Address};

#[odra::module]
pub struct CrossContract {
pub math_engine: Variable<Address>,
}

#[odra::module]
impl CrossContract {
#[odra(init)]
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap();
MathEngineRef::at(math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine {
}

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To call the external contract, we use the Ref that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineRef::at(math_engine_address).add(3, 5)

Contract Ref

We mentioned Ref already in our Testing article. +It is a reference to already deployed - running contract. +Here we are going to take a deeper look at it.

Similarly to a Deployer, the Ref is generated automatically, thanks to the #[odra::module] macro. +To get an instance of a reference, we can either deploy a contract (using Deployer) or by building it +directly, using ::at(address: Address) method, as shown above. +The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), alongside couple methods:

  • at(Address) -> Self - points the reference to an Address
  • address() -> Address - returns the Address the reference is currently pointing at
  • with_tokens(Amount) -> Self - attaches Amount of native tokens to the next call

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

examples/src/features/cross_calls.rs
#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderRef struct (but do not create the AdderDeployer). Having an address we can call:

examples/src/features/cross_calls.rs
AdderRef::at(address).add(3, 5)

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
use super::{CrossContractDeployer, MathEngineDeployer};

#[test]
fn test_cross_calls() {
let math_engine_contract = MathEngineDeployer::default();
let cross_contract = CrossContractDeployer::init(math_engine_contract.address());

assert_eq!(cross_contract.add_using_another(), 8);
}

Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a MathEngine contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the add() function we want to use.

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use odra::types::Address;
use crate::features::cross_calls::{Adder, AdderRef};

#[test]
fn test_ext() {
let adder = AdderRef::at(get_adder_address());

assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address() -> Address {
let contract = MathEngineDeployer::default();
contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/directory-structure/index.html b/docs/docs/0.5.0/basics/directory-structure/index.html new file mode 100644 index 000000000..c43e11337 --- /dev/null +++ b/docs/docs/0.5.0/basics/directory-structure/index.html @@ -0,0 +1,27 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.5.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── .builder_casper/
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

By default, your project will use the latest odra version available at crates.io. We are using two features:

  • odra/mock-vm - it is responsible for running tests on Odra's MockVM
  • odra/casper - backend implementation of Casper blockchain +More backends will be released as features that will be possible to enable here.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

.builder_* folders

Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary +for building wasm files and running them against blockchain VMs. As it is not necessary to modify +files in those folders in any way, by default they are hidden (hence the . at the beginning of the +folder name).

src/

This is the folder where your smart contract files live.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain of your choosing.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/errors/index.html b/docs/docs/0.5.0/basics/errors/index.html new file mode 100644 index 000000000..71f684e35 --- /dev/null +++ b/docs/docs/0.5.0/basics/errors/index.html @@ -0,0 +1,23 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.5.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::{execution_error, Variable, UnwrapOrRevert};
use odra::types::Address;

#[odra::module]
pub struct OwnedContract {
name: Variable<String>,
owner: Variable<Address>,
}

execution_error! {
pub enum Error {
OwnerNotSet => 1,
NotAnOwner => 2,
}
}


#[odra::module]
impl OwnedContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = odra::contract_env::caller();
if caller != self.owner() {
odra::contract_env::revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using execution_error! macro to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You and the users of your contract will be thankful for a meaningful error message!

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
odra::contract_env::revert(Error::NotAnOwner)

Testing errors

Okay, but how about testing it? We've already mentioned a function - assert_exception. This is how you will +use it:

examples/src/features/handling_errors.rs
use super::{OwnedContractDeployer, OwnedContractRef};
use super::Error;

#[test]
fn test_owner_error() {
let owner = odra::test_env::get_account(0);
let not_an_owner = odra::test_env::get_account(1);

odra::test_env::set_caller(owner);
let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());

odra::test_env::set_caller(not_an_owner);
odra::test_env::assert_exception(Error::NotAnOwner, || {
owned_contract.change_name("NewName".to_string());
})
}

In the example above, because we are calling the change_name method as an address which is not an "owner", +we are expecting that "NotAnOwner" error will be thrown.

note

Here we are creating another reference to the already deployed contract using OwnedContractRef::at() and passing to it +its Address. Note that OwnedContractDeployer::init() returns the same type.

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/events/index.html b/docs/docs/0.5.0/basics/events/index.html new file mode 100644 index 000000000..8204f1dea --- /dev/null +++ b/docs/docs/0.5.0/basics/events/index.html @@ -0,0 +1,20 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.5.0

Events

Different blockchains implement events in different ways. Odra lets you forget about it by introducing +Odra Events. Take a look:

examples/src/features/events.rs
use odra::{Event, contract_env};
use odra::types::{Address, BlockTime, event::OdraEvent};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract {
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

#[odra::module]
impl PartyContract {
#[odra(init)]
pub fn init(&self) {
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, we derive an Event macro like this:

examples/src/features/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

Among other things, it adds an emit() function to the struct, which allows you to emit the event simply +as that:

examples/src/features/events.rs
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();

Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] macro.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's test_env comes with a handy macro assert_events! which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use odra::{assert_events, test_env};
use crate::features::events::PartyStarted;
use super::PartyContractDeployer;

#[test]
fn test_party() {
let party_contract = PartyContractDeployer::init();
assert_events!(
party_contract,
PartyStarted {
caller: test_env::get_account(0),
block_time: 0,
}
);
}

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/flipper-internals/index.html b/docs/docs/0.5.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..1d85b6273 --- /dev/null +++ b/docs/docs/0.5.0/basics/flipper-internals/index.html @@ -0,0 +1,35 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.5.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Variable;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Variable, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Variables and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Variable<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The #[odra(init)] macro marks the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Variable<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using FlipperDeployer - a piece of code generated automatically thanks to the macros. +The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/modules/index.html b/docs/docs/0.5.0/basics/modules/index.html new file mode 100644 index 000000000..fe8c31b21 --- /dev/null +++ b/docs/docs/0.5.0/basics/modules/index.html @@ -0,0 +1,20 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.5.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to a macro #[odra::module]. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;

#[odra::module]
pub struct ModulesContract {
pub math_engine: MathEngine,
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
use super::ModulesContractDeployer;

#[test]
fn test_modules() {
let modules_contract = ModulesContractDeployer::default();
assert_eq!(modules_contract.add_using_module(), 8);
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/native-token/index.html b/docs/docs/0.5.0/basics/native-token/index.html new file mode 100644 index 000000000..707cb680d --- /dev/null +++ b/docs/docs/0.5.0/basics/native-token/index.html @@ -0,0 +1,26 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.5.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::types::Balance;
use odra::contract_env;

#[odra::module]
pub struct PublicWallet {
}

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {
}

pub fn withdraw(&mut self, amount: Balance) {
contract_env::transfer_tokens(contract_env::caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/tlw.rs in the odra main repository.

You can see a new macro used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from contract_env - transfer_tokens. +It does exactly what you are expecting it to do - it will transfer native tokens from the contract to the +specified address.

We are also using the Balance - an Odra type that wraps around the type that the underlying blockchain uses +for counting tokens.

Testing

To be able to test how many tokens a contract (or any address) has, test_env comes with a function - +token_balance:

examples/src/features/native_token.rs
use odra::types::Balance;
use odra::test_env;
use super::PublicWalletDeployer;

#[test]
fn test_modules() {
let mut my_contract = PublicWalletDeployer::default();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());

my_contract.with_tokens(Balance::from(100)).deposit();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));

my_contract.withdraw(Balance::from(25));
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/odra-toml/index.html b/docs/docs/0.5.0/basics/odra-toml/index.html new file mode 100644 index 000000000..2742c38ae --- /dev/null +++ b/docs/docs/0.5.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.5.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

The name will be used as a name for the contract - the generated wasm file will be in the above case named +flipper.wasm.

The fqn (Fully Qualified Name) is used by the builder to locate the exact struct where +the contract is defined.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

[[contracts]]
name = "counter"
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/storage-interaction/index.html b/docs/docs/0.5.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..b27d70ecf --- /dev/null +++ b/docs/docs/0.5.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.5.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Variable

The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Variable type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
#[odra::module]
pub struct DogContract {
barks: Variable<bool>,
weight: Variable<u32>,
name: Variable<String>,
walks: Variable<Vec<u32>>,
}

You can see the Variable wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
use odra::Variable;

#[odra::module]
impl DogContract {
#[odra(init)]
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Variable is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::{Mapping, Variable};

#[odra::module]
pub struct DogContract2 {
name: Variable<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Variables section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Variable is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Variable working together:

core/src/list.rs
use odra::{Variable, List};

pub struct List<T> {
values: Mapping<u32, T>,
index: Variable<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
#[odra::module]
pub struct DogContract3 {
name: Variable<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the odra repository in the examples/src/docs/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/basics/testing/index.html b/docs/docs/0.5.0/basics/testing/index.html new file mode 100644 index 000000000..b1a531ecb --- /dev/null +++ b/docs/docs/0.5.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.5.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{Variable, List};

#[cfg(test)]
mod tests {
use super::DogContract3Deployer;

#[test]
fn init_test() {
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The #[odra(module)] macro created a Deployer code for us, which will deploy the contract on the +VM:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with a macro are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

Test env

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use super::TestingContractDeployer;

#[test]
fn test_env() {
let testing_contract = TestingContractDeployer::init("MyContract".to_string());
let creator = testing_contract.created_by();
odra::test_env::set_caller(odra::test_env::get_account(1));
let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());
let creator2 = testing_contract2.created_by();
assert!(creator != creator2);
}
}

In the code above, we are deploying two instances of the same contract, but we're using odra::test_env::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::contract_env::caller() +the function we are calling inside the contract.

Each test env comes with a set of functions that will let you write better tests:

  • fn set_caller(address: Address) - you've seen it in action just now
  • fn token_balance(address: Address) -> Balance - it returns the balance of the account associated with the given address
  • fn advance_block_time_by(seconds: BlockTime) - it increases the current value of block_time
  • fn get_account(n: usize) -> Address - it returns an nth address that was prepared for you by Odra in advance; +by default, you start with the 0th account
  • fn assert_exception<F, E>(err: E, block: F) - it executes the block code and expects err to happen
  • fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError> - returns +the event emitted by the contract

Again, we'll see those used in the next articles.

Deployer

You may be wondering what is the TestingContractDeployer and where did it come from. +It is a piece of code generated automatically for you, thanks to the #[odra::module] macro. +If you used the #[odra(init)] on one of the methods, it will be the constructor of your contract. +Odra will make sure that it is called only once, so you can use it to initialize your data structures etc.

If you do not provide the init method, you can deploy the contract using ::default() method. +In the end, you will get a Ref instance (in our case the TestingContractRef) which reimplements all +the methods you defined in the contract, but executes them on a blockchain!

To learn more about the Ref contract, visit the Cross calls article.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/category/advanced/index.html b/docs/docs/0.5.0/category/advanced/index.html new file mode 100644 index 000000000..e635f7de0 --- /dev/null +++ b/docs/docs/0.5.0/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
Version: 0.5.0

Advanced

Advanced concepts of Odra Framework

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/category/backends/index.html b/docs/docs/0.5.0/category/backends/index.html new file mode 100644 index 000000000..f7a286b4c --- /dev/null +++ b/docs/docs/0.5.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/category/basics/index.html b/docs/docs/0.5.0/category/basics/index.html new file mode 100644 index 000000000..d0b41912d --- /dev/null +++ b/docs/docs/0.5.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/category/examples/index.html b/docs/docs/0.5.0/category/examples/index.html new file mode 100644 index 000000000..b0bc74a0c --- /dev/null +++ b/docs/docs/0.5.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/category/getting-started/index.html b/docs/docs/0.5.0/category/getting-started/index.html new file mode 100644 index 000000000..a7cc0cecf --- /dev/null +++ b/docs/docs/0.5.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/category/tutorials/index.html b/docs/docs/0.5.0/category/tutorials/index.html new file mode 100644 index 000000000..50e588794 --- /dev/null +++ b/docs/docs/0.5.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/examples/odra-examples/index.html b/docs/docs/0.5.0/examples/odra-examples/index.html new file mode 100644 index 000000000..b68fd2593 --- /dev/null +++ b/docs/docs/0.5.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.5.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/examples/using-odra-modules/index.html b/docs/docs/0.5.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..555f0b28e --- /dev/null +++ b/docs/docs/0.5.0/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.5.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]
casper = ["odra/casper", "odra-modules/casper"]
danger

odra-modules defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a casper feature in your project, add odra-modules/casperspecifically (it applies to each backend).

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::types::{Address, U256};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/getting-started/flipper/index.html b/docs/docs/0.5.0/getting-started/flipper/index.html new file mode 100644 index 000000000..3bed096b3 --- /dev/null +++ b/docs/docs/0.5.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.5.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Variable;

/// A module definition. Each module struct consists Variables and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let mut contract1 = FlipperDeployer::initial_settings();
let contract2 = FlipperDeployer::initial_settings();
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/getting-started/installation/index.html b/docs/docs/0.5.0/getting-started/installation/index.html new file mode 100644 index 000000000..8a2edee66 --- /dev/null +++ b/docs/docs/0.5.0/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.5.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-uknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called "my_project" and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/index.html b/docs/docs/0.5.0/index.html new file mode 100644 index 000000000..f6cde6de4 --- /dev/null +++ b/docs/docs/0.5.0/index.html @@ -0,0 +1,25 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.5.0

Odra framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, +pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open +source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. We can do it +by abstracting over core concepts that all the above systems are built around. These are type system, +storage, entry points, execution context, and testing environment. We believe it will bring standardization +to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this +ecosystem.

What's next

See the Installation and our Flipper example +to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/tutorials/erc20/index.html b/docs/docs/0.5.0/tutorials/erc20/index.html new file mode 100644 index 000000000..b69663ea3 --- /dev/null +++ b/docs/docs/0.5.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.5.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • advanced storage - key-value pairs,
  • Odra types like Address or Balance,
  • advanced events assertion.

Code

Our module has a pretty complex storage layout in comparison to the previous example.

We need to store the following data:

  1. Immutable metadata - name, symbol and decimals.
  2. Total supply.
  3. Users' balances.
  4. Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.

Module definition

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Variable<u8>,
symbol: Variable<String>,
name: Variable<String>,
total_supply: Variable<Balance>,
balances: Mapping<Address, Balance>,
allowances: Mapping<Address, Mapping<Address, Balance>>
}
  • L6 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping. You may notice the balances property maps Address to Balance. If you deal with addresses or you operate on tokens, you should always choose Address over String and Balance over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform.
  • L7 - Odra allows nested Mappings, what we utilize to store allowances.

Metadata

#[odra::module]
impl Erc20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> Balance {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.balances.add(address, *amount);
self.total_supply.add(amount);
Transfer {
from: None,
to: Some(*address),
amount: *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: Balance
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L10 - A constructor sets the token metadata and mints the initial supply.
  • L12-L14 - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the Ownable example, we used the get() function returning an Option<T>. If the type implements Default trait, you can call get_or_default() function and the contract does not fail even if the value is not initialized.
  • L29 - The second impl is not an odra module, in other words these function will not be a part of contract's ABI.
  • L30-L39 - Mint function is public, so like in a regular rust code will be accessible from the outside. mint() use notation self.balances.add(&address, amount);, which it is syntactic sugar for:
let current_balance = self.balances.get(&address).unwrap_or_default();
let new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();
self.balances.set(&address, new_balance);

Core

For the sake of completeness, let's implement the remaining functionalities like transfer, transfer_from, or approve. They are not introducing any new concepts, so we leave them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...
pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
let caller = contract_env::caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let spender = contract_env::caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
let owner = contract_env::caller();
self.allowances.get_instance(&owner).set(spender, *amount);
Approval {
owner,
spender: *spender,
value: *amount
}
.emit();
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.allowances.get_instance(owner).get_or_default(spender)
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
contract_env::revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
}
.emit();
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {
let allowance = self.allowances.get_instance(owner).get_or_default(spender);
if allowance < *amount {
contract_env::revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.get_instance(owner)
.set(spender, new_allowance);
Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};
use odra::{assert_events, test_env, types::U256};

pub const NAME: &str = "Plascoin";
pub const SYMBOL: &str = "PLS";
pub const DECIMALS: u8 = 10;
pub const INITIAL_SUPPLY: u32 = 10_000;

pub fn setup() -> Erc20Ref {
Erc20Deployer::init(
String::from(NAME),
String::from(SYMBOL),
DECIMALS,
INITIAL_SUPPLY.into()
)
}

#[test]
fn initialization() {
let erc20 = setup();

assert_eq!(&erc20.symbol(), SYMBOL);
assert_eq!(&erc20.name(), NAME);
assert_eq!(erc20.decimals(), DECIMALS);
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());
assert_events!(
erc20,
Transfer {
from: None,
to: Some(test_env::get_account(0)),
amount: INITIAL_SUPPLY.into()
}
);
}

#[test]
fn transfer_works() {
let mut erc20 = setup();
let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

erc20.transfer(&recipient, &amount);

assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);
assert_eq!(erc20.balance_of(&recipient), amount);
assert_events!(
erc20,
Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
);
}

#[test]
fn transfer_error() {
let mut erc20 = setup();
let recipient = test_env::get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);

test_env::assert_exception(Error::InsufficientBalance, || {
erc20.transfer(&recipient, &amount)
});
}

#[test]
fn transfer_from_and_approval_work() {
let mut erc20 = setup();
let (owner, recipient, spender) = (
test_env::get_account(0),
test_env::get_account(1),
test_env::get_account(2)
);
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount
}
);

// Spender transfers tokens from Owner to Recipient.
test_env::set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount - transfer_amount
},
Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
);

assert_events!(erc20, Approval, Transfer);
}

#[test]
fn transfer_from_error() {
let mut erc20 = setup();
let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

test_env::set_caller(spender);
test_env::assert_exception(Error::InsufficientAllowance, || {
erc20.transfer_from(&owner, &spender, &amount)
});
}
}
  • L111-123 - assert_events!() macro accepts multiple events. You must pass them in the order they were emitted.
  • L125 - Alternatively, if you don't want to check the entire event, you may assert only its type.
danger

You can not mix both approaches, you pass full events or types only.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/tutorials/ownable/index.html b/docs/docs/0.5.0/tutorials/ownable/index.html new file mode 100644 index 000000000..3f613d3be --- /dev/null +++ b/docs/docs/0.5.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.5.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining constructors,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

use odra::{types::Address, Variable};

#[odra::module]
pub struct Ownable {
owner: Variable<Address>
}

That was easy, but it is crucial to understand the basic before we move on.

  • L3 - Firstly, we need create a struct called Ownable and apply #[odra::module] to it above.
  • L5 - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with Variable.

Init the module

use odra::{
execution_error, contract_env, Event, types::{Address, event::OdraEvent}
};
...

#[odra::module]
impl Ownable {
#[odra(init)]
pub fn init(&mut self, owner: &Address) {
if self.owner.get().is_some() {
contract_env::revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(*owner);

OwnershipChanged {
prev_owner: None,
new_owner: *owner
}
.emit();
}
}

execution_error! {
pub enum Error {
OwnerIsNotInitialized => 1,
}
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L5 - The impl should be an odra module, so add #[odra::module].
  • L7 - The init function is marked as #[odra(init)] making it a constructor. It matters if we would like to deploy the Ownable module as a standalone contract.
  • L23 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an Error enum. Notice that the Error enum is defined inside the execution_error macro. It generates, among others, the required Into<ExecutionError> binding.
  • L9-L11 - If the owner has been set already, we call contract_env::revert() function. As an argument we pass Error::OwnerIsNotInitialized.
  • L13 - Then we write the owner passed as an argument to the storage. To do so we call the set() on Variable.
  • L29-L33 - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L23 - Finally, we create the OwnershipChanged struct and call emit() function on it (import odra::types::event::OdraEvent trait). Hence we set the first owner, we set the prev_owner value to None.

Features implementation

#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get().as_ref() {
contract_env::revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&contract_env::caller());
let current_owner = self.get_owner();
self.owner.set(*new_owner);
OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
}
.emit();
}

pub fn get_owner(&self) -> Address {
match self.owner.get() {
Some(owner) => owner,
None => contract_env::revert(Error::OwnerIsNotInitialized)
}
}
}

execution_error! {
pub enum Error {
NotOwner => 1,
OwnerIsAlreadyInitialized => 2,
OwnerIsNotInitialized => 3,
}
}

The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along.

  • L5,L32 - ensure_ownership() is reads the current owner, and reverts if is does not match the input Address. Also we need to update our Error enum adding a new variant NotOwner.
  • L11 - The function defined above can be reused in change_ownership() implementation. We pass to it the current caller, using the contract_env::caller() function. The we update the state, and emit OwnershipChanged.
  • L22,L34 - Lastly, a getter function. As the Variable get() function returns an Option, we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized.

Test

#[cfg(test)]
mod tests {
use super::*;
use odra::{assert_events, test_env};

fn setup() -> (Address, OwnableRef) {
let owner = test_env::get_account(0);
let ownable = OwnableDeployer::init(owner);
(owner, ownable)
}

#[test]
fn initialization_works() {
let (owner, ownable) = setup();
assert_eq!(ownable.get_owner(), owner);

assert_events!(
ownable,
OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (owner, mut ownable) = setup();
let new_owner = test_env::get_account(1);

test_env::set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);
assert_events!(
ownable,
OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (_, mut ownable) = setup();
let new_owner = test_env::get_account(1);
ownable.change_ownership(&new_owner);

test_env::assert_exception(Error::NotOwner, || {
ownable.change_ownership(&new_owner);
});
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we defined the setup() function we call as the first statement in each test. Take a look at the signature fn setup() -> (Address, OwnableRef). OwnableRef is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ensure_ownership(), change_ownership(), get_owner(), but not init() which is a constructor.
  • L7 - Now, the module needs an owner, the easiest way is to take one from the test_env. We choose the address of first account (which is the default one).
  • L8 - Odra created for us OwnableDeployer struct which implements all constructor functions. In this case there is just one function - init() which corresponds the function we have implemented in the module.
  • L12 - It is time to define the first test. As you see, it is a regular rust test.
  • L14-15 - Using the setup() function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L17-23 - On the contract, only the init() function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro assert_events. As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred.
  • L30 - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the test env predefines 20 accounts.
  • L32 - As mentioned, the default is the 0-th account, if you want to change the executor call the test_env::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L49-55 - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call test_env::assert_exception() with the error you expect and a failing block of code.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.5.0/tutorials/owned-token/index.html b/docs/docs/0.5.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..0eec86342 --- /dev/null +++ b/docs/docs/0.5.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.5.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow minting tokens but only the module owner.
  3. The current owner should be able to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
use odra::types::{Address, Balance}

...

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> Balance {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.ownable.ensure_ownership(&contract_env::caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L10-L11 - A constructor is a great place to init both modules at once.
  • L14-L16 - Most of the entrypoints do not need any modification, so we simply delegates them to the erc20 module.
  • L50-L52 - The same we do with the ownable module.
  • L58-L61 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/advanced/advanced-storage/index.html b/docs/docs/0.6.0/advanced/advanced-storage/index.html new file mode 100644 index 000000000..88dce2f8e --- /dev/null +++ b/docs/docs/0.6.0/advanced/advanced-storage/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.6.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Variable, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values.

Variable: A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that holds a Variable which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Variable<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{map, types::U256, Mapping, UnwrapOrRevert};

use crate::owned_token::OwnedToken;

#[odra::module]
pub struct NestedMapping {
strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,
tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>
}

#[odra::module]
impl NestedMapping {

...

pub fn set_token(
&mut self,
key1: String,
key2: u32,
key3: String,
token_name: String,
decimals: u8,
symbol: String,
initial_supply: &U256
) {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.init(token_name, symbol, decimals, initial_supply);
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let mapping = self.strings.get_instance(&key1).get_instance(&key2);
mapping.get(&key3).unwrap_or_revert()
}

pub fn total_supply(
&self,
key1: String,
key2: u32,
key3: String
) -> U256 {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.total_supply()
}
}
note

Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers.

Instead of using the get() function, call get_instance(), which sets the correct namespace for nested modules.

If the terminal value is deeply nested, a long chain of get_instance() calls is required.

To keep the codebase consistent, a map! macro can be used:

examples/src/features/storage/mapping.rs
...

pub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {
map!(self.strings[key1][key2][key3] = value);
}

pub fn get_string_macro(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
map!(self.strings[key1][key2][key3])
}

danger

The terminal value must not be an Odra Module.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Sequence, Mapping};
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
my_sequence: Sequence<u32>,
my_mapping: Mapping<String, Mapping<String, Token>>,
}

impl AdvancedStorage {
pub fn get_sequence_current_value(&self) -> u32 {
self.my_sequence.get_current_value()
}

pub fn next_sequence_value(&mut self) -> u32 {
self.my_sequence.next_value()
}

pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.set(&inner_key, value);
}

pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.get(&inner_key)
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/advanced/attributes/index.html b/docs/docs/0.6.0/advanced/attributes/index.html new file mode 100644 index 000000000..a71ddb572 --- /dev/null +++ b/docs/docs/0.6.0/advanced/attributes/index.html @@ -0,0 +1,19 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.6.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Init

If your contract needs initial setup, adding the #[odra(init)] attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed.

It's important to note that a constructor function should not be invoked in any other context.

Example

examples/src/contracts/erc20.rs
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

Using

An attribute applicable to struct fields. The using attribute accepts multiple values, separated by ,. +Each value attribute must point at an existing field.

Example

#[odra::module]
struct Contract {
access_control: AccessControl,
meta: Metadata,
#[odra(using = "access_control, meta")]
// #[odra(using = "access_control, metadata")] - would not compile - `metadata` field does not exist
storage: Storage
}

#[odra::module]
struct AccessControl {
owner: Variable<Address>
}

#[odra::module]
struct Metadata {
version: Variable<String>
}

#[odra::module]
struct Storage {
value: Variable<u8>,
access_control: AccessControl,
meta: Metadata
}

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = contract_env::caller();
let amount: Balance = contract_env::attached_value();
let current_block_time: BlockTime = contract_env::get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
contract_env::revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
Deposit {
address: caller,
amount
}
.emit();
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

However, a constructor cannot be payable, so the below code would not compile.

#[odra(payable)]
#[odra(init)]
fn initialize() {
// your logic...
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/advanced/delegate/index.html b/docs/docs/0.6.0/advanced/delegate/index.html new file mode 100644 index 000000000..d8e22b906 --- /dev/null +++ b/docs/docs/0.6.0/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.6.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
pub fn approve(&mut self, spender: Address, amount: U256);
pub fn name(&self) -> String;
pub fn symbol(&self) -> String;
pub fn decimals(&self) -> u8;
pub fn total_supply(&self) -> U256;
pub fn balance_of(&self, owner: Address) -> U256;
pub fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
pub fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};

#[odra::module]
pub struct DeFiPlatform {
ownable: Ownable,
erc20: Erc20,
exchange: Exchange
}

#[odra::module]
impl DeFiPlatform {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
}

to self.exchange {
pub fn swap(&mut self, sender: Address, recipient: Address);
pub fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/advanced/signatures/index.html b/docs/docs/0.6.0/advanced/signatures/index.html new file mode 100644 index 000000000..85572dd21 --- /dev/null +++ b/docs/docs/0.6.0/advanced/signatures/index.html @@ -0,0 +1,29 @@ + + + + + +Signatures | Odra + + + + + +
+
Version: 0.6.0

Signatures

As each backend can use a different scheme for generating key pairs, +Odra Framework provides a generic function for signature verification inside the contract context. +Thanks to this, you can write your code once, without worrying about underlying cryptography.

Signature verification

Signature verification is conducted by a function in contract_env:

pub fn verify_signature(message: &Bytes, signature: &Bytes, public_key: &PublicKey) -> bool;

Here's the simplest example of this function used in a contract:

examples/src/features/signature_verifier.rs
#[odra::module]
impl SignatureVerifier {
pub fn verify_signature(
&self,
message: &Bytes,
signature: &Bytes,
public_key: &PublicKey
) -> bool {
contract_env::verify_signature(message, signature, public_key)
}
}

Testing

Besides the above function in the contract context, Odra provides corresponding functions in the test_env:

pub fn sign_message(message: &Bytes, address: &Address) -> Bytes;

pub fn public_key(address: &Address) -> PublicKey;

sign_message will return a signed message. The signing itself will be performed using a private key +of an account behind the address.

public_key returns the PublicKey of an address account.

Thanks to those, you can write generic tests, that will work with all backends, despite differences +in signature schemes they use.

examples/src/features/signature_verifier.rs
#[test]
fn signature_verification_works() {
let message = "Message to be signed";
let message_bytes = &Bytes::from(message.as_bytes().to_vec());
let account = test_env::get_account(0);

let signature = test_env::sign_message(message_bytes, &account);

let public_key = test_env::public_key(&account);

let signature_verifier = SignatureVerifierDeployer::default();
assert!(signature_verifier.verify_signature(message_bytes, &signature, &public_key));
}

If you want, you can also test signatures that were created outside Odra. +However, you will need to prepare separate tests for each backend:

examples/src/features/signature_verifier.rs
/// The following test checks that the signature verification works with the signature produced
/// by the casper wallet.
#[test]
#[cfg(feature = "casper")]
fn verify_signature_casper_wallet() {
use odra::casper::casper_types::bytesrepr::FromBytes;
// Casper Wallet for the message "Ahoj przygodo!" signed using SECP256K1 key
// produces the following signature:
// 1e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa
// Casper Wallet adds "Casper Message:\n" prefix to the message:
let message = "Casper Message:\nAhoj przygodo!";
let message_bytes = &Bytes::from(message.as_bytes().to_vec());

// Depending on the type of the key, we need to prefix the signature with a tag:
// 0x01 for ED25519
// 0x02 for SECP256K1
let signature_hex = "021e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa";
let signature: [u8; 65] = hex::decode(signature_hex).unwrap().try_into().unwrap();
let signature_bytes = &Bytes::from(signature.to_vec());

// Similar to the above, the public key is tagged:
let public_key_hex = "02036d9b880e44254afaf34330e57703a63aec53b5918d4470059b67a4a906350105";
let public_key_decoded = hex::decode(public_key_hex).unwrap();
let (public_key, _) = odra::casper::casper_types::crypto::PublicKey::from_bytes(
public_key_decoded.as_slice()
)
.unwrap();

let signature_verifier = SignatureVerifierDeployer::default();
assert!(signature_verifier.verify_signature(message_bytes, signature_bytes, &public_key));
}

ECRecover

Odra Standard Library +part of the original Odra Proposal mentioned ECRecover as one of the functions that will be +implemented by the Odra Framework. We decided to add signatures verification instead.

The reasoning behind this decision is that the ECRecover works only with one type of signature. +Odra tries to be backend-agnostic, which implies that it should also be signature-type-agnostic. +This was possible to achieve when implementing generic signature verification, but not with ECRecover.

In short, the implementation of ECRecover would not depend on the backend, pushing it into some kind of +utils library, and those already exist, for example in +solana_program +crate.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/advanced/using/index.html b/docs/docs/0.6.0/advanced/using/index.html new file mode 100644 index 000000000..2f3792f48 --- /dev/null +++ b/docs/docs/0.6.0/advanced/using/index.html @@ -0,0 +1,17 @@ + + + + + +Module reusing | Odra + + + + + +
+
Version: 0.6.0

Module reusing

This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.

Conceptual Overview

By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key.

#[odra::module]
struct Contract {
value: Variable<u8>, // the default namespace would be "value"
module: Module
}

#[odra::module]
struct Module {
secret: Variable<String> // the default namespace would be "module_secret"
}

While this isolation often proves useful, there are scenarios where shared storage is beneficial.

Usage

Odra generates an array of keys, prefixing the storage key of child modules with the parent namespace, like in the example above. But what if you want to reuse the same instance of a module? Add a #[odra(using)] attribute to a module to override the default behavior. This is information for the module "Do not prefix storage keys for the given module." so effectively, the child and the parent use the same module instance.

Let's illustrate it with a simple example. The example provided below introduces some additional complexity by featuring deeper module nesting.

use odra::Variable;

#[odra::module]
pub struct SharedStorage {
pub value: Variable<String>
}

#[odra::module]
pub struct MyStorage {
pub shared: SharedStorage,
pub version: Variable<u8>
}

#[odra::module]
pub struct ComposableContract {
pub shared: SharedStorage,
#[odra(using = "shared")]
pub storage: MyStorage
}

#[odra::module]
impl ComposableContract {
#[odra(init)]
pub fn init(&mut self, version: u8, value: String) {
self.storage.version.set(version);
self.shared.value.set(value);
}

pub fn get_value(&self) -> String {
self.shared.value.get_or_default()
}

pub fn get_value_via_storage(&self) -> String {
self.storage.shared.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use crate::composer::ComplexContractDeployer;

#[test]
fn t() {
let shared_value = "shared_value".to_string();
let extra_value: u32 = 314;
let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);

assert_eq!(token.get_value(), shared_value);
assert_eq!(token.get_value_via_storage(), shared_value);
assert_eq!(token.get_extra_value(), extra_value);
}
}

In this example, we've introduced a new module, MoreStorage, which nests MyStorage and includes an extra value. The ComplexContract contains SharedStorage and MoreStorage, creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels.

If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:

  1. On the contract level - contract_shared_value.
  2. On the MyStorage module level - contract_more_storage_shared_value.

This example showcases how you can effectively use the module reusing feature to build intricate and efficient smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/backends/casper/index.html b/docs/docs/0.6.0/backends/casper/index.html new file mode 100644 index 000000000..2ece03b62 --- /dev/null +++ b/docs/docs/0.6.0/backends/casper/index.html @@ -0,0 +1,44 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.6.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Types

A struct to be written into the storage must implement OdraType which is defined as follow:

pub trait OdraType: 
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

The other exposed types are:

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement SerializableEvent which is defined as follow:

pub trait SerializableEvent: 
odra_types::event::OdraEvent +
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling contract_env::attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The contract_env::self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The contract_env::caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call contract_env::self_balance, which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Constructors

Let's define a basic Odra module that includes a constructor:

#[odra::module]
struct Counter {
value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub initialize(&mut self, value: u32) {
self.value.set(value);
}
}

Read more about constructors here.

WASM arguments

When deploying a new contract you have to specify following arguments.

Required arguments:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Optional arguments:

  • odra_cfg_constructor - String type. If the contract has the constructor entry point marked with #[odra(init)], this should be set to the constructor name.
  • constructor arguments that match entry point set in odra_cfg_constructor.

Contract Deploys

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'initialize'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. Option<U512> type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK.

Execution

First thing Odra does with your code, is similar to the one used in MockVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/backends/mock-vm/index.html b/docs/docs/0.6.0/backends/mock-vm/index.html new file mode 100644 index 000000000..2f47bb536 --- /dev/null +++ b/docs/docs/0.6.0/backends/mock-vm/index.html @@ -0,0 +1,26 @@ + + + + + +MockVM | Odra + + + + + +
+
Version: 0.6.0

MockVM

The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler.

Usage

The MockVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

MockVM consists of two main parts: the Contract Register and the State.

The Contract Register is just a list of contracts deployed onto the MockVM, identified by an Address. +Each time we call the contract, we call its instance stored in the Contract Register.

Contracts and Test Env functions can modify the State of the MockVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the MockVM State holds only the current state of the MockVM. +Thanks to this and the fact that we do not need the blockchain itself, +MockVM starts instantly and runs the tests in the native speed.

Execution

When the MockVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, MockVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/backends/what-is-a-backend/index.html b/docs/docs/0.6.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..e70adcfa1 --- /dev/null +++ b/docs/docs/0.6.0/backends/what-is-a-backend/index.html @@ -0,0 +1,27 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.6.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like MockVM, +or a complete virtual machine, spinning up a blockchain for you - like CasperVM.

Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Test Env

Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/cargo-odra/index.html b/docs/docs/0.6.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..dc7e3bf83 --- /dev/null +++ b/docs/docs/0.6.0/basics/cargo-odra/index.html @@ -0,0 +1,38 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.6.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them on multiple backends (blockchains).

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands will help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This will create a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it will create a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This will create a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

Most used command during the development of your project should be this one:

cargo odra test

It will run your tests against Odra's MockVM. It is substantially faster than virtual machines +provided by blockchains developers and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files, +spin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat. +Keep in mind that this is a lot slower than MockVM and you cannot use the debugger. +This is why MockVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build -b casper

Where casper is the name of the backend we are using in this example. If the build process +finishes successfully, wasm files will be located in wasm folder.

Updating dependencies

You will learn later, that the project using Odra contains more than one Rust project - your own and +one or more builders. To run cargo update on all of them at once instead of traversing all the folders +you can use this command:

cargo odra update

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/communicating-with-host/index.html b/docs/docs/0.6.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..9b5dfe553 --- /dev/null +++ b/docs/docs/0.6.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.6.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::Variable;
use odra::types::{BlockTime, Address};

#[odra::module]
pub struct HostContract {
name: Variable<String>,
created_at: Variable<BlockTime>,
created_by: Variable<Address>,
}

#[odra::module]
impl HostContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(odra::contract_env::get_block_time());
self.created_by.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are calling functions from odra::contract_env. get_block_time() will return +the current block time wrapped in Odra type BlockTime. caller() will return an Odra Address of +a caller (this can be an external caller or another contract).

info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/cross-calls/index.html b/docs/docs/0.6.0/basics/cross-calls/index.html new file mode 100644 index 000000000..ad3e53496 --- /dev/null +++ b/docs/docs/0.6.0/basics/cross-calls/index.html @@ -0,0 +1,25 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.6.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::Variable;
use odra::types::{Address};

#[odra::module]
pub struct CrossContract {
pub math_engine: Variable<Address>,
}

#[odra::module]
impl CrossContract {
#[odra(init)]
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap();
MathEngineRef::at(math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine {
}

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To call the external contract, we use the Ref that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineRef::at(math_engine_address).add(3, 5)

Contract Ref

We mentioned Ref already in our Testing article. +It is a reference to already deployed - running contract. +Here we are going to take a deeper look at it.

Similarly to a Deployer, the Ref is generated automatically, thanks to the #[odra::module] macro. +To get an instance of a reference, we can either deploy a contract (using Deployer) or by building it +directly, using ::at(address: Address) method, as shown above. +The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), alongside couple methods:

  • at(Address) -> Self - points the reference to an Address
  • address() -> Address - returns the Address the reference is currently pointing at
  • with_tokens(Amount) -> Self - attaches Amount of native tokens to the next call

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

examples/src/features/cross_calls.rs
#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderRef struct (but do not create the AdderDeployer). Having an address we can call:

examples/src/features/cross_calls.rs
AdderRef::at(address).add(3, 5)

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
use super::{CrossContractDeployer, MathEngineDeployer};

#[test]
fn test_cross_calls() {
let math_engine_contract = MathEngineDeployer::default();
let cross_contract = CrossContractDeployer::init(math_engine_contract.address());

assert_eq!(cross_contract.add_using_another(), 8);
}

Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a MathEngine contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the add() function we want to use.

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use odra::types::Address;
use crate::features::cross_calls::{Adder, AdderRef};

#[test]
fn test_ext() {
let adder = AdderRef::at(get_adder_address());

assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address() -> Address {
let contract = MathEngineDeployer::default();
contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/directory-structure/index.html b/docs/docs/0.6.0/basics/directory-structure/index.html new file mode 100644 index 000000000..2efbaf7e0 --- /dev/null +++ b/docs/docs/0.6.0/basics/directory-structure/index.html @@ -0,0 +1,27 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.6.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── .builder_casper/
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

By default, your project will use the latest odra version available at crates.io. We are using two features:

  • odra/mock-vm - it is responsible for running tests on Odra's MockVM
  • odra/casper - backend implementation of Casper blockchain +More backends will be released as features that will be possible to enable here.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

.builder_* folders

Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary +for building wasm files and running them against blockchain VMs. As it is not necessary to modify +files in those folders in any way, by default they are hidden (hence the . at the beginning of the +folder name).

src/

This is the folder where your smart contract files live.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain of your choosing.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/errors/index.html b/docs/docs/0.6.0/basics/errors/index.html new file mode 100644 index 000000000..8171c586d --- /dev/null +++ b/docs/docs/0.6.0/basics/errors/index.html @@ -0,0 +1,23 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.6.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::{execution_error, Variable, UnwrapOrRevert};
use odra::types::Address;

#[odra::module]
pub struct OwnedContract {
name: Variable<String>,
owner: Variable<Address>,
}

execution_error! {
pub enum Error {
OwnerNotSet => 1,
NotAnOwner => 2,
}
}


#[odra::module]
impl OwnedContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = odra::contract_env::caller();
if caller != self.owner() {
odra::contract_env::revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using execution_error! macro to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You and the users of your contract will be thankful for a meaningful error message!

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
odra::contract_env::revert(Error::NotAnOwner)

Testing errors

Okay, but how about testing it? We've already mentioned a function - assert_exception. This is how you will +use it:

examples/src/features/handling_errors.rs
use super::{OwnedContractDeployer, OwnedContractRef};
use super::Error;

#[test]
fn test_owner_error() {
let owner = odra::test_env::get_account(0);
let not_an_owner = odra::test_env::get_account(1);

odra::test_env::set_caller(owner);
let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());

odra::test_env::set_caller(not_an_owner);
odra::test_env::assert_exception(Error::NotAnOwner, || {
owned_contract.change_name("NewName".to_string());
})
}

In the example above, because we are calling the change_name method as an address which is not an "owner", +we are expecting that "NotAnOwner" error will be thrown.

note

Here we are creating another reference to the already deployed contract using OwnedContractRef::at() and passing to it +its Address. Note that OwnedContractDeployer::init() returns the same type.

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/events/index.html b/docs/docs/0.6.0/basics/events/index.html new file mode 100644 index 000000000..132accab0 --- /dev/null +++ b/docs/docs/0.6.0/basics/events/index.html @@ -0,0 +1,20 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.6.0

Events

Different blockchains implement events in different ways. Odra lets you forget about it by introducing +Odra Events. Take a look:

examples/src/features/events.rs
use odra::{Event, contract_env};
use odra::types::{Address, BlockTime, event::OdraEvent};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract {
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

#[odra::module]
impl PartyContract {
#[odra(init)]
pub fn init(&self) {
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, we derive an Event macro like this:

examples/src/features/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

Among other things, it adds an emit() function to the struct, which allows you to emit the event simply +as that:

examples/src/features/events.rs
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();

Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] macro.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's test_env comes with a handy macro assert_events! which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use odra::{assert_events, test_env};
use crate::features::events::PartyStarted;
use super::PartyContractDeployer;

#[test]
fn test_party() {
let party_contract = PartyContractDeployer::init();
assert_events!(
party_contract,
PartyStarted {
caller: test_env::get_account(0),
block_time: 0,
}
);
}

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/flipper-internals/index.html b/docs/docs/0.6.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..a37cbabec --- /dev/null +++ b/docs/docs/0.6.0/basics/flipper-internals/index.html @@ -0,0 +1,35 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.6.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Variable;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Variable, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Variables and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Variable<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The #[odra(init)] macro marks the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Variable<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using FlipperDeployer - a piece of code generated automatically thanks to the macros. +The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/modules/index.html b/docs/docs/0.6.0/basics/modules/index.html new file mode 100644 index 000000000..e93f5ec34 --- /dev/null +++ b/docs/docs/0.6.0/basics/modules/index.html @@ -0,0 +1,20 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.6.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to a macro #[odra::module]. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;

#[odra::module]
pub struct ModulesContract {
pub math_engine: MathEngine,
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
use super::ModulesContractDeployer;

#[test]
fn test_modules() {
let modules_contract = ModulesContractDeployer::default();
assert_eq!(modules_contract.add_using_module(), 8);
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/native-token/index.html b/docs/docs/0.6.0/basics/native-token/index.html new file mode 100644 index 000000000..458468302 --- /dev/null +++ b/docs/docs/0.6.0/basics/native-token/index.html @@ -0,0 +1,26 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.6.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::types::Balance;
use odra::contract_env;

#[odra::module]
pub struct PublicWallet {
}

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {
}

pub fn withdraw(&mut self, amount: Balance) {
contract_env::transfer_tokens(contract_env::caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/tlw.rs in the odra main repository.

You can see a new macro used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from contract_env - transfer_tokens. +It does exactly what you are expecting it to do - it will transfer native tokens from the contract to the +specified address.

We are also using the Balance - an Odra type that wraps around the type that the underlying blockchain uses +for counting tokens.

Testing

To be able to test how many tokens a contract (or any address) has, test_env comes with a function - +token_balance:

examples/src/features/native_token.rs
use odra::types::Balance;
use odra::test_env;
use super::PublicWalletDeployer;

#[test]
fn test_modules() {
let mut my_contract = PublicWalletDeployer::default();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());

my_contract.with_tokens(Balance::from(100)).deposit();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));

my_contract.withdraw(Balance::from(25));
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/odra-toml/index.html b/docs/docs/0.6.0/basics/odra-toml/index.html new file mode 100644 index 000000000..2383d64a9 --- /dev/null +++ b/docs/docs/0.6.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.6.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

The name will be used as a name for the contract - the generated wasm file will be in the above case named +flipper.wasm.

The fqn (Fully Qualified Name) is used by the builder to locate the exact struct where +the contract is defined.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

[[contracts]]
name = "counter"
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/storage-interaction/index.html b/docs/docs/0.6.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..a358a7a90 --- /dev/null +++ b/docs/docs/0.6.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.6.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Variable

The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Variable type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
#[odra::module]
pub struct DogContract {
barks: Variable<bool>,
weight: Variable<u32>,
name: Variable<String>,
walks: Variable<Vec<u32>>,
}

You can see the Variable wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
use odra::Variable;

#[odra::module]
impl DogContract {
#[odra(init)]
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Variable is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::{Mapping, Variable};

#[odra::module]
pub struct DogContract2 {
name: Variable<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Variables section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Variable is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Variable working together:

core/src/list.rs
use odra::{Variable, List};

pub struct List<T> {
values: Mapping<u32, T>,
index: Variable<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
#[odra::module]
pub struct DogContract3 {
name: Variable<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the odra repository in the examples/src/docs/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/basics/testing/index.html b/docs/docs/0.6.0/basics/testing/index.html new file mode 100644 index 000000000..1e8c24753 --- /dev/null +++ b/docs/docs/0.6.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.6.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{Variable, List};

#[cfg(test)]
mod tests {
use super::DogContract3Deployer;

#[test]
fn init_test() {
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The #[odra(module)] macro created a Deployer code for us, which will deploy the contract on the +VM:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with a macro are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

Test env

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use super::TestingContractDeployer;

#[test]
fn test_env() {
let testing_contract = TestingContractDeployer::init("MyContract".to_string());
let creator = testing_contract.created_by();
odra::test_env::set_caller(odra::test_env::get_account(1));
let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());
let creator2 = testing_contract2.created_by();
assert!(creator != creator2);
}
}

In the code above, we are deploying two instances of the same contract, but we're using odra::test_env::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::contract_env::caller() +the function we are calling inside the contract.

Each test env comes with a set of functions that will let you write better tests:

  • fn set_caller(address: Address) - you've seen it in action just now
  • fn token_balance(address: Address) -> Balance - it returns the balance of the account associated with the given address
  • fn advance_block_time_by(seconds: BlockTime) - it increases the current value of block_time
  • fn get_account(n: usize) -> Address - it returns an nth address that was prepared for you by Odra in advance; +by default, you start with the 0th account
  • fn assert_exception<F, E>(err: E, block: F) - it executes the block code and expects err to happen
  • fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError> - returns +the event emitted by the contract

Again, we'll see those used in the next articles.

Deployer

You may be wondering what is the TestingContractDeployer and where did it come from. +It is a piece of code generated automatically for you, thanks to the #[odra::module] macro. +If you used the #[odra(init)] on one of the methods, it will be the constructor of your contract. +Odra will make sure that it is called only once, so you can use it to initialize your data structures etc.

If you do not provide the init method, you can deploy the contract using ::default() method. +In the end, you will get a Ref instance (in our case the TestingContractRef) which reimplements all +the methods you defined in the contract, but executes them on a blockchain!

To learn more about the Ref contract, visit the Cross calls article.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/category/advanced/index.html b/docs/docs/0.6.0/category/advanced/index.html new file mode 100644 index 000000000..4b1d4e2a2 --- /dev/null +++ b/docs/docs/0.6.0/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
Version: 0.6.0

Advanced

Advanced concepts of Odra Framework

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/category/backends/index.html b/docs/docs/0.6.0/category/backends/index.html new file mode 100644 index 000000000..23bd3e6a9 --- /dev/null +++ b/docs/docs/0.6.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/category/basics/index.html b/docs/docs/0.6.0/category/basics/index.html new file mode 100644 index 000000000..cf708600f --- /dev/null +++ b/docs/docs/0.6.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/category/examples/index.html b/docs/docs/0.6.0/category/examples/index.html new file mode 100644 index 000000000..070d0c906 --- /dev/null +++ b/docs/docs/0.6.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/category/getting-started/index.html b/docs/docs/0.6.0/category/getting-started/index.html new file mode 100644 index 000000000..8d3006d2b --- /dev/null +++ b/docs/docs/0.6.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/category/tutorials/index.html b/docs/docs/0.6.0/category/tutorials/index.html new file mode 100644 index 000000000..c5d4af745 --- /dev/null +++ b/docs/docs/0.6.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/examples/odra-examples/index.html b/docs/docs/0.6.0/examples/odra-examples/index.html new file mode 100644 index 000000000..2db463775 --- /dev/null +++ b/docs/docs/0.6.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.6.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/examples/using-odra-modules/index.html b/docs/docs/0.6.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..4d340ed9a --- /dev/null +++ b/docs/docs/0.6.0/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.6.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]
casper = ["odra/casper", "odra-modules/casper"]
danger

odra-modules defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a casper feature in your project, add odra-modules/casperspecifically (it applies to each backend).

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::types::{Address, U256};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/getting-started/flipper/index.html b/docs/docs/0.6.0/getting-started/flipper/index.html new file mode 100644 index 000000000..e87efbd63 --- /dev/null +++ b/docs/docs/0.6.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.6.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Variable;

/// A module definition. Each module struct consists Variables and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let mut contract1 = FlipperDeployer::initial_settings();
let contract2 = FlipperDeployer::initial_settings();
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/getting-started/installation/index.html b/docs/docs/0.6.0/getting-started/installation/index.html new file mode 100644 index 000000000..6c34412fc --- /dev/null +++ b/docs/docs/0.6.0/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.6.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-uknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called "my_project" and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/index.html b/docs/docs/0.6.0/index.html new file mode 100644 index 000000000..44ef714a2 --- /dev/null +++ b/docs/docs/0.6.0/index.html @@ -0,0 +1,25 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.6.0

Odra framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, +pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open +source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. We can do it +by abstracting over core concepts that all the above systems are built around. These are type system, +storage, entry points, execution context, and testing environment. We believe it will bring standardization +to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this +ecosystem.

What's next

See the Installation and our Flipper example +to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/tutorials/erc20/index.html b/docs/docs/0.6.0/tutorials/erc20/index.html new file mode 100644 index 000000000..72b7079e0 --- /dev/null +++ b/docs/docs/0.6.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.6.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • advanced storage - key-value pairs,
  • Odra types like Address or Balance,
  • advanced events assertion.

Code

Our module has a pretty complex storage layout in comparison to the previous example.

We need to store the following data:

  1. Immutable metadata - name, symbol and decimals.
  2. Total supply.
  3. Users' balances.
  4. Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.

Module definition

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Variable<u8>,
symbol: Variable<String>,
name: Variable<String>,
total_supply: Variable<Balance>,
balances: Mapping<Address, Balance>,
allowances: Mapping<Address, Mapping<Address, Balance>>
}
  • L6 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping. You may notice the balances property maps Address to Balance. If you deal with addresses or you operate on tokens, you should always choose Address over String and Balance over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform.
  • L7 - Odra allows nested Mappings, what we utilize to store allowances.

Metadata

#[odra::module]
impl Erc20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> Balance {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.balances.add(address, *amount);
self.total_supply.add(amount);
Transfer {
from: None,
to: Some(*address),
amount: *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: Balance
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L10 - A constructor sets the token metadata and mints the initial supply.
  • L12-L14 - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the Ownable example, we used the get() function returning an Option<T>. If the type implements Default trait, you can call get_or_default() function and the contract does not fail even if the value is not initialized.
  • L29 - The second impl is not an odra module, in other words these function will not be a part of contract's ABI.
  • L30-L39 - Mint function is public, so like in a regular rust code will be accessible from the outside. mint() use notation self.balances.add(&address, amount);, which it is syntactic sugar for:
let current_balance = self.balances.get(&address).unwrap_or_default();
let new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();
self.balances.set(&address, new_balance);

Core

For the sake of completeness, let's implement the remaining functionalities like transfer, transfer_from, or approve. They are not introducing any new concepts, so we leave them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...
pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
let caller = contract_env::caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let spender = contract_env::caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
let owner = contract_env::caller();
self.allowances.get_instance(&owner).set(spender, *amount);
Approval {
owner,
spender: *spender,
value: *amount
}
.emit();
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.allowances.get_instance(owner).get_or_default(spender)
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
contract_env::revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
}
.emit();
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {
let allowance = self.allowances.get_instance(owner).get_or_default(spender);
if allowance < *amount {
contract_env::revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.get_instance(owner)
.set(spender, new_allowance);
Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};
use odra::{assert_events, test_env, types::U256};

pub const NAME: &str = "Plascoin";
pub const SYMBOL: &str = "PLS";
pub const DECIMALS: u8 = 10;
pub const INITIAL_SUPPLY: u32 = 10_000;

pub fn setup() -> Erc20Ref {
Erc20Deployer::init(
String::from(NAME),
String::from(SYMBOL),
DECIMALS,
INITIAL_SUPPLY.into()
)
}

#[test]
fn initialization() {
let erc20 = setup();

assert_eq!(&erc20.symbol(), SYMBOL);
assert_eq!(&erc20.name(), NAME);
assert_eq!(erc20.decimals(), DECIMALS);
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());
assert_events!(
erc20,
Transfer {
from: None,
to: Some(test_env::get_account(0)),
amount: INITIAL_SUPPLY.into()
}
);
}

#[test]
fn transfer_works() {
let mut erc20 = setup();
let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

erc20.transfer(&recipient, &amount);

assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);
assert_eq!(erc20.balance_of(&recipient), amount);
assert_events!(
erc20,
Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
);
}

#[test]
fn transfer_error() {
let mut erc20 = setup();
let recipient = test_env::get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);

test_env::assert_exception(Error::InsufficientBalance, || {
erc20.transfer(&recipient, &amount)
});
}

#[test]
fn transfer_from_and_approval_work() {
let mut erc20 = setup();
let (owner, recipient, spender) = (
test_env::get_account(0),
test_env::get_account(1),
test_env::get_account(2)
);
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount
}
);

// Spender transfers tokens from Owner to Recipient.
test_env::set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount - transfer_amount
},
Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
);

assert_events!(erc20, Approval, Transfer);
}

#[test]
fn transfer_from_error() {
let mut erc20 = setup();
let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

test_env::set_caller(spender);
test_env::assert_exception(Error::InsufficientAllowance, || {
erc20.transfer_from(&owner, &spender, &amount)
});
}
}
  • L111-123 - assert_events!() macro accepts multiple events. You must pass them in the order they were emitted.
  • L125 - Alternatively, if you don't want to check the entire event, you may assert only its type.
danger

You can not mix both approaches, you pass full events or types only.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/tutorials/ownable/index.html b/docs/docs/0.6.0/tutorials/ownable/index.html new file mode 100644 index 000000000..9a4372090 --- /dev/null +++ b/docs/docs/0.6.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.6.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining constructors,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

use odra::{types::Address, Variable};

#[odra::module]
pub struct Ownable {
owner: Variable<Address>
}

That was easy, but it is crucial to understand the basic before we move on.

  • L3 - Firstly, we need create a struct called Ownable and apply #[odra::module] to it above.
  • L5 - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with Variable.

Init the module

use odra::{
execution_error, contract_env, Event, types::{Address, event::OdraEvent}
};
...

#[odra::module]
impl Ownable {
#[odra(init)]
pub fn init(&mut self, owner: &Address) {
if self.owner.get().is_some() {
contract_env::revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(*owner);

OwnershipChanged {
prev_owner: None,
new_owner: *owner
}
.emit();
}
}

execution_error! {
pub enum Error {
OwnerIsNotInitialized => 1,
}
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L5 - The impl should be an odra module, so add #[odra::module].
  • L7 - The init function is marked as #[odra(init)] making it a constructor. It matters if we would like to deploy the Ownable module as a standalone contract.
  • L23 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an Error enum. Notice that the Error enum is defined inside the execution_error macro. It generates, among others, the required Into<ExecutionError> binding.
  • L9-L11 - If the owner has been set already, we call contract_env::revert() function. As an argument we pass Error::OwnerIsNotInitialized.
  • L13 - Then we write the owner passed as an argument to the storage. To do so we call the set() on Variable.
  • L29-L33 - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L23 - Finally, we create the OwnershipChanged struct and call emit() function on it (import odra::types::event::OdraEvent trait). Hence we set the first owner, we set the prev_owner value to None.

Features implementation

#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get().as_ref() {
contract_env::revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&contract_env::caller());
let current_owner = self.get_owner();
self.owner.set(*new_owner);
OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
}
.emit();
}

pub fn get_owner(&self) -> Address {
match self.owner.get() {
Some(owner) => owner,
None => contract_env::revert(Error::OwnerIsNotInitialized)
}
}
}

execution_error! {
pub enum Error {
NotOwner => 1,
OwnerIsAlreadyInitialized => 2,
OwnerIsNotInitialized => 3,
}
}

The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along.

  • L5,L32 - ensure_ownership() is reads the current owner, and reverts if is does not match the input Address. Also we need to update our Error enum adding a new variant NotOwner.
  • L11 - The function defined above can be reused in change_ownership() implementation. We pass to it the current caller, using the contract_env::caller() function. The we update the state, and emit OwnershipChanged.
  • L22,L34 - Lastly, a getter function. As the Variable get() function returns an Option, we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized.

Test

#[cfg(test)]
mod tests {
use super::*;
use odra::{assert_events, test_env};

fn setup() -> (Address, OwnableRef) {
let owner = test_env::get_account(0);
let ownable = OwnableDeployer::init(owner);
(owner, ownable)
}

#[test]
fn initialization_works() {
let (owner, ownable) = setup();
assert_eq!(ownable.get_owner(), owner);

assert_events!(
ownable,
OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (owner, mut ownable) = setup();
let new_owner = test_env::get_account(1);

test_env::set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);
assert_events!(
ownable,
OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (_, mut ownable) = setup();
let new_owner = test_env::get_account(1);
ownable.change_ownership(&new_owner);

test_env::assert_exception(Error::NotOwner, || {
ownable.change_ownership(&new_owner);
});
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we defined the setup() function we call as the first statement in each test. Take a look at the signature fn setup() -> (Address, OwnableRef). OwnableRef is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ensure_ownership(), change_ownership(), get_owner(), but not init() which is a constructor.
  • L7 - Now, the module needs an owner, the easiest way is to take one from the test_env. We choose the address of first account (which is the default one).
  • L8 - Odra created for us OwnableDeployer struct which implements all constructor functions. In this case there is just one function - init() which corresponds the function we have implemented in the module.
  • L12 - It is time to define the first test. As you see, it is a regular rust test.
  • L14-15 - Using the setup() function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L17-23 - On the contract, only the init() function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro assert_events. As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred.
  • L30 - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the test env predefines 20 accounts.
  • L32 - As mentioned, the default is the 0-th account, if you want to change the executor call the test_env::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L49-55 - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call test_env::assert_exception() with the error you expect and a failing block of code.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.6.0/tutorials/owned-token/index.html b/docs/docs/0.6.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..f61b3256b --- /dev/null +++ b/docs/docs/0.6.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.6.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow minting tokens but only the module owner.
  3. The current owner should be able to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
use odra::types::{Address, Balance}

...

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> Balance {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.ownable.ensure_ownership(&contract_env::caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L10-L11 - A constructor is a great place to init both modules at once.
  • L14-L16 - Most of the entrypoints do not need any modification, so we simply delegates them to the erc20 module.
  • L50-L52 - The same we do with the ownable module.
  • L58-L61 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/advanced/advanced-storage/index.html b/docs/docs/0.7.0/advanced/advanced-storage/index.html new file mode 100644 index 000000000..3dfb6ed5c --- /dev/null +++ b/docs/docs/0.7.0/advanced/advanced-storage/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.7.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Variable, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Variable type is used to store a single value, while the List and Mapping types store collections of values.

Variable: A Variable in Odra is a fundamental building block used for storing single values. Each Variable is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Variable and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that holds a Variable which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Variable<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, the Mapping is a key-value storage system where the key is associated with a value. However, the value of the Mapping can be another Mapping. This concept is referred to as nested mapping. Moreover, the value of the Mapping can be an Odra module, introducing a greater level of complexity and utility.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{map, types::U256, Mapping, UnwrapOrRevert};

use crate::owned_token::OwnedToken;

#[odra::module]
pub struct NestedMapping {
strings: Mapping<String, Mapping<u32, Mapping<String, String>>>,
tokens: Mapping<String, Mapping<u32, Mapping<String, OwnedToken>>>
}

#[odra::module]
impl NestedMapping {

...

pub fn set_token(
&mut self,
key1: String,
key2: u32,
key3: String,
token_name: String,
decimals: u8,
symbol: String,
initial_supply: &U256
) {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.init(token_name, symbol, decimals, initial_supply);
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let mapping = self.strings.get_instance(&key1).get_instance(&key2);
mapping.get(&key3).unwrap_or_revert()
}

pub fn total_supply(
&self,
key1: String,
key2: u32,
key3: String
) -> U256 {
self.tokens
.get_instance(&key1)
.get_instance(&key2)
.get_instance(&key3)
.total_supply()
}
}
note

Accessing Odra Modules and Mapping is a bit different from accessing regular values like strings or numbers.

Instead of using the get() function, call get_instance(), which sets the correct namespace for nested modules.

If the terminal value is deeply nested, a long chain of get_instance() calls is required.

To keep the codebase consistent, a map! macro can be used:

examples/src/features/storage/mapping.rs
...

pub fn set_string(&mut self, key1: String, key2: u32, key3: String, value: String) {
map!(self.strings[key1][key2][key3] = value);
}

pub fn get_string_macro(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
map!(self.strings[key1][key2][key3])
}

danger

The terminal value must not be an Odra Module.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Sequence, Mapping};
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
my_sequence: Sequence<u32>,
my_mapping: Mapping<String, Mapping<String, Token>>,
}

impl AdvancedStorage {
pub fn get_sequence_current_value(&self) -> u32 {
self.my_sequence.get_current_value()
}

pub fn next_sequence_value(&mut self) -> u32 {
self.my_sequence.next_value()
}

pub fn set_in_mapping(&mut self, outer_key: String, inner_key: String, value: Token) {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.set(&inner_key, value);
}

pub fn get_from_mapping(&self, outer_key: String, inner_key: String) -> Option<Token> {
let inner_mapping = self.my_mapping.get_instance(&outer_key);
inner_mapping.get(&inner_key)
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/advanced/attributes/index.html b/docs/docs/0.7.0/advanced/attributes/index.html new file mode 100644 index 000000000..8c319a92c --- /dev/null +++ b/docs/docs/0.7.0/advanced/attributes/index.html @@ -0,0 +1,19 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.7.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that allows developers to embed common checks into function definitions in a readable and reusable manner. These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Init

If your contract needs initial setup, adding the #[odra(init)] attribute to your function operates similarly to a constructor in object-oriented programming. This constructor is called immediately after the contract is deployed.

It's important to note that a constructor function should not be invoked in any other context.

Example

examples/src/contracts/erc20.rs
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &U256) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

Using

An attribute applicable to struct fields. The using attribute accepts multiple values, separated by ,. +Each value attribute must point at an existing field.

Example

#[odra::module]
struct Contract {
access_control: AccessControl,
meta: Metadata,
#[odra(using = "access_control, meta")]
// #[odra(using = "access_control, metadata")] - would not compile - `metadata` field does not exist
storage: Storage
}

#[odra::module]
struct AccessControl {
owner: Variable<Address>
}

#[odra::module]
struct Metadata {
version: Variable<String>
}

#[odra::module]
struct Storage {
value: Variable<u8>,
access_control: AccessControl,
meta: Metadata
}

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = contract_env::caller();
let amount: Balance = contract_env::attached_value();
let current_block_time: BlockTime = contract_env::get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
contract_env::revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
Deposit {
address: caller,
amount
}
.emit();
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Example

#[odra::module]
pub struct NonReentrantCounter {
counter: Variable<u32>
}

#[odra::module]
impl NonReentrantCounter {
#[odra(non_reentrant)]
pub fn count_ref_recursive(&mut self, n: u32) {
if n > 0 {
self.count();
ReentrancyMockRef::at(&contract_env::self_address()).count_ref_recursive(n - 1);
}
}
}

impl NonReentrantCounter {
fn count(&mut self) {
let c = self.counter.get_or_default();
self.counter.set(c + 1);
}
}

#[cfg(test)]
mod test {
use odra::{test_env, types::ExecutionError};

#[test]
fn ref_recursion_not_allowed() {
test_env::assert_exception(ExecutionError::reentrant_call(), || {
let mut contract = super::NonReentrantCounterDeployer::default();
contract.count_ref_recursive(11);
});
}
}

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

However, a constructor cannot be payable, so the below code would not compile.

#[odra(payable)]
#[odra(init)]
fn initialize() {
// your logic...
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/advanced/delegate/index.html b/docs/docs/0.7.0/advanced/delegate/index.html new file mode 100644 index 000000000..ff1de017e --- /dev/null +++ b/docs/docs/0.7.0/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.7.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
pub fn approve(&mut self, spender: Address, amount: U256);
pub fn name(&self) -> String;
pub fn symbol(&self) -> String;
pub fn decimals(&self) -> u8;
pub fn total_supply(&self) -> U256;
pub fn balance_of(&self, owner: Address) -> U256;
pub fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
pub fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use odra::{
contract_env,
types::{Address, U256}
};

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};

#[odra::module]
pub struct DeFiPlatform {
ownable: Ownable,
erc20: Erc20,
exchange: Exchange
}

#[odra::module]
impl DeFiPlatform {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
}

to self.exchange {
pub fn swap(&mut self, sender: Address, recipient: Address);
pub fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(contract_env::caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/advanced/signatures/index.html b/docs/docs/0.7.0/advanced/signatures/index.html new file mode 100644 index 000000000..9fd572a94 --- /dev/null +++ b/docs/docs/0.7.0/advanced/signatures/index.html @@ -0,0 +1,29 @@ + + + + + +Signatures | Odra + + + + + +
+
Version: 0.7.0

Signatures

As each backend can use a different scheme for generating key pairs, +Odra Framework provides a generic function for signature verification inside the contract context. +Thanks to this, you can write your code once, without worrying about underlying cryptography.

Signature verification

Signature verification is conducted by a function in contract_env:

pub fn verify_signature(message: &Bytes, signature: &Bytes, public_key: &PublicKey) -> bool;

Here's the simplest example of this function used in a contract:

examples/src/features/signature_verifier.rs
#[odra::module]
impl SignatureVerifier {
pub fn verify_signature(
&self,
message: &Bytes,
signature: &Bytes,
public_key: &PublicKey
) -> bool {
contract_env::verify_signature(message, signature, public_key)
}
}

Testing

Besides the above function in the contract context, Odra provides corresponding functions in the test_env:

pub fn sign_message(message: &Bytes, address: &Address) -> Bytes;

pub fn public_key(address: &Address) -> PublicKey;

sign_message will return a signed message. The signing itself will be performed using a private key +of an account behind the address.

public_key returns the PublicKey of an address account.

Thanks to those, you can write generic tests, that will work with all backends, despite differences +in signature schemes they use.

examples/src/features/signature_verifier.rs
#[test]
fn signature_verification_works() {
let message = "Message to be signed";
let message_bytes = &Bytes::from(message.as_bytes().to_vec());
let account = test_env::get_account(0);

let signature = test_env::sign_message(message_bytes, &account);

let public_key = test_env::public_key(&account);

let signature_verifier = SignatureVerifierDeployer::default();
assert!(signature_verifier.verify_signature(message_bytes, &signature, &public_key));
}

If you want, you can also test signatures that were created outside Odra. +However, you will need to prepare separate tests for each backend:

examples/src/features/signature_verifier.rs
/// The following test checks that the signature verification works with the signature produced
/// by the casper wallet.
#[test]
#[cfg(feature = "casper")]
fn verify_signature_casper_wallet() {
use odra::casper::casper_types::bytesrepr::FromBytes;
// Casper Wallet for the message "Ahoj przygodo!" signed using SECP256K1 key
// produces the following signature:
// 1e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa
// Casper Wallet adds "Casper Message:\n" prefix to the message:
let message = "Casper Message:\nAhoj przygodo!";
let message_bytes = &Bytes::from(message.as_bytes().to_vec());

// Depending on the type of the key, we need to prefix the signature with a tag:
// 0x01 for ED25519
// 0x02 for SECP256K1
let signature_hex = "021e87e186238fa1df9c222b387a79910388c6ef56285924c7e4f6d7e77ed1d6c61815312cf66a5318db204c693b79e020b1d392dafe8c1b3841e1f6b4c41ca0fa";
let signature: [u8; 65] = hex::decode(signature_hex).unwrap().try_into().unwrap();
let signature_bytes = &Bytes::from(signature.to_vec());

// Similar to the above, the public key is tagged:
let public_key_hex = "02036d9b880e44254afaf34330e57703a63aec53b5918d4470059b67a4a906350105";
let public_key_decoded = hex::decode(public_key_hex).unwrap();
let (public_key, _) = odra::casper::casper_types::crypto::PublicKey::from_bytes(
public_key_decoded.as_slice()
)
.unwrap();

let signature_verifier = SignatureVerifierDeployer::default();
assert!(signature_verifier.verify_signature(message_bytes, signature_bytes, &public_key));
}

ECRecover

Odra Standard Library +part of the original Odra Proposal mentioned ECRecover as one of the functions that will be +implemented by the Odra Framework. We decided to add signatures verification instead.

The reasoning behind this decision is that the ECRecover works only with one type of signature. +Odra tries to be backend-agnostic, which implies that it should also be signature-type-agnostic. +This was possible to achieve when implementing generic signature verification, but not with ECRecover.

In short, the implementation of ECRecover would not depend on the backend, pushing it into some kind of +utils library, and those already exist, for example in +solana_program +crate.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/advanced/using/index.html b/docs/docs/0.7.0/advanced/using/index.html new file mode 100644 index 000000000..582a4f589 --- /dev/null +++ b/docs/docs/0.7.0/advanced/using/index.html @@ -0,0 +1,17 @@ + + + + + +Module reusing | Odra + + + + + +
+
Version: 0.7.0

Module reusing

This feature of the Odra Framework is designed to enhance the reusability and modularity of your smart contracts. It empowers developers to reuse modules and override custom namespaces. This guide provides an in-depth look at the module reusing feature, complete with practical code examples.

Conceptual Overview

By default, each instance of a module has its own namespace, ensuring each internal value has a unique storage key.

#[odra::module]
struct Contract {
value: Variable<u8>, // the default namespace would be "value"
module: Module
}

#[odra::module]
struct Module {
secret: Variable<String> // the default namespace would be "module_secret"
}

While this isolation often proves useful, there are scenarios where shared storage is beneficial.

Usage

Odra generates an array of keys, prefixing the storage key of child modules with the parent namespace, like in the example above. But what if you want to reuse the same instance of a module? Add a #[odra(using)] attribute to a module to override the default behavior. This is information for the module "Do not prefix storage keys for the given module." so effectively, the child and the parent use the same module instance.

Let's illustrate it with a simple example. The example provided below introduces some additional complexity by featuring deeper module nesting.

use odra::Variable;

#[odra::module]
pub struct SharedStorage {
pub value: Variable<String>
}

#[odra::module]
pub struct MyStorage {
pub shared: SharedStorage,
pub version: Variable<u8>
}

#[odra::module]
pub struct ComposableContract {
pub shared: SharedStorage,
#[odra(using = "shared")]
pub storage: MyStorage
}

#[odra::module]
impl ComposableContract {
#[odra(init)]
pub fn init(&mut self, version: u8, value: String) {
self.storage.version.set(version);
self.shared.value.set(value);
}

pub fn get_value(&self) -> String {
self.shared.value.get_or_default()
}

pub fn get_value_via_storage(&self) -> String {
self.storage.shared.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use crate::composer::ComplexContractDeployer;

#[test]
fn t() {
let shared_value = "shared_value".to_string();
let extra_value: u32 = 314;
let token = ComplexContractDeployer::init(1, shared_value.clone(), extra_value);

assert_eq!(token.get_value(), shared_value);
assert_eq!(token.get_value_via_storage(), shared_value);
assert_eq!(token.get_extra_value(), extra_value);
}
}

In this example, we've introduced a new module, MoreStorage, which nests MyStorage and includes an extra value. The ComplexContract contains SharedStorage and MoreStorage, creating a deeper nesting. Our test ensures that values can be successfully retrieved from different storage levels.

If we had used the default behavior, would have been created (so, they would no longer be shared), each having distinct namespaces:

  1. On the contract level - contract_shared_value.
  2. On the MyStorage module level - contract_more_storage_shared_value.

This example showcases how you can effectively use the module reusing feature to build intricate and efficient smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/backends/casper/index.html b/docs/docs/0.7.0/backends/casper/index.html new file mode 100644 index 000000000..d9df0553e --- /dev/null +++ b/docs/docs/0.7.0/backends/casper/index.html @@ -0,0 +1,44 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.7.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Types

A struct to be written into the storage must implement OdraType which is defined as follow:

pub trait OdraType: 
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

The other exposed types are:

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement SerializableEvent which is defined as follow:

pub trait SerializableEvent: 
odra_types::event::OdraEvent +
casper_types::CLTyped +
casper_types::bytesrepr::ToBytes +
casper_types::bytesrepr::FromBytes {}

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling contract_env::attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The contract_env::self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The contract_env::caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call contract_env::self_balance, which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Constructors

Let's define a basic Odra module that includes a constructor:

#[odra::module]
struct Counter {
value: Variable<u32>
}

#[odra::module]
impl Counter {
#[odra(init)]
pub initialize(&mut self, value: u32) {
self.value.set(value);
}
}

Read more about constructors here.

WASM arguments

When deploying a new contract you have to specify following arguments.

Required arguments:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Optional arguments:

  • odra_cfg_constructor - String type. If the contract has the constructor entry point marked with #[odra(init)], this should be set to the constructor name.
  • constructor arguments that match entry point set in odra_cfg_constructor.

Contract Deploys

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'initialize'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. Option<U512> type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK.

Execution

First thing Odra does with your code, is similar to the one used in MockVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/backends/mock-vm/index.html b/docs/docs/0.7.0/backends/mock-vm/index.html new file mode 100644 index 000000000..68dd84ab2 --- /dev/null +++ b/docs/docs/0.7.0/backends/mock-vm/index.html @@ -0,0 +1,26 @@ + + + + + +MockVM | Odra + + + + + +
+
Version: 0.7.0

MockVM

The MockVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to MockVM tests run a lot faster than other backends and debugging is a lot simpler.

Usage

The MockVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

MockVM consists of two main parts: the Contract Register and the State.

The Contract Register is just a list of contracts deployed onto the MockVM, identified by an Address. +Each time we call the contract, we call its instance stored in the Contract Register.

Contracts and Test Env functions can modify the State of the MockVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the MockVM State holds only the current state of the MockVM. +Thanks to this and the fact that we do not need the blockchain itself, +MockVM starts instantly and runs the tests in the native speed.

Execution

When the MockVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, MockVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/backends/what-is-a-backend/index.html b/docs/docs/0.7.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..4de9dd995 --- /dev/null +++ b/docs/docs/0.7.0/backends/what-is-a-backend/index.html @@ -0,0 +1,27 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.7.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like MockVM, +or a complete virtual machine, spinning up a blockchain for you - like CasperVM.

Each backend has to come with two parts that Odra requires - the Contract Env and the Test Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Test Env

Similarly to the Contract Env, the Test Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/cargo-odra/index.html b/docs/docs/0.7.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..8d9c085e5 --- /dev/null +++ b/docs/docs/0.7.0/basics/cargo-odra/index.html @@ -0,0 +1,38 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.7.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them on multiple backends (blockchains).

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands will help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This will create a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.5.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.3.1 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it will create a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This will create a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

Most used command during the development of your project should be this one:

cargo odra test

It will run your tests against Odra's MockVM. It is substantially faster than virtual machines +provided by blockchains developers and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra will build the project, the Casper builder, generate the wasm files, +spin up CasperVM instance, deploy the contracts onto it and run the tests against it. Pretty neat. +Keep in mind that this is a lot slower than MockVM and you cannot use the debugger. +This is why MockVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build -b casper

Where casper is the name of the backend we are using in this example. If the build process +finishes successfully, wasm files will be located in wasm folder.

Updating dependencies

You will learn later, that the project using Odra contains more than one Rust project - your own and +one or more builders. To run cargo update on all of them at once instead of traversing all the folders +you can use this command:

cargo odra update

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/communicating-with-host/index.html b/docs/docs/0.7.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..0872d6f96 --- /dev/null +++ b/docs/docs/0.7.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.7.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::Variable;
use odra::types::{BlockTime, Address};

#[odra::module]
pub struct HostContract {
name: Variable<String>,
created_at: Variable<BlockTime>,
created_by: Variable<Address>,
}

#[odra::module]
impl HostContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(odra::contract_env::get_block_time());
self.created_by.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are calling functions from odra::contract_env. get_block_time() will return +the current block time wrapped in Odra type BlockTime. caller() will return an Odra Address of +a caller (this can be an external caller or another contract).

info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/cross-calls/index.html b/docs/docs/0.7.0/basics/cross-calls/index.html new file mode 100644 index 000000000..c65b5ed3e --- /dev/null +++ b/docs/docs/0.7.0/basics/cross-calls/index.html @@ -0,0 +1,25 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.7.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::Variable;
use odra::types::{Address};

#[odra::module]
pub struct CrossContract {
pub math_engine: Variable<Address>,
}

#[odra::module]
impl CrossContract {
#[odra(init)]
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap();
MathEngineRef::at(math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine {
}

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To call the external contract, we use the Ref that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineRef::at(math_engine_address).add(3, 5)

Contract Ref

We mentioned Ref already in our Testing article. +It is a reference to already deployed - running contract. +Here we are going to take a deeper look at it.

Similarly to a Deployer, the Ref is generated automatically, thanks to the #[odra::module] macro. +To get an instance of a reference, we can either deploy a contract (using Deployer) or by building it +directly, using ::at(address: Address) method, as shown above. +The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), alongside couple methods:

  • at(Address) -> Self - points the reference to an Address
  • address() -> Address - returns the Address the reference is currently pointing at
  • with_tokens(Amount) -> Self - attaches Amount of native tokens to the next call

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] macro. This macro should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

examples/src/features/cross_calls.rs
#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderRef struct (but do not create the AdderDeployer). Having an address we can call:

examples/src/features/cross_calls.rs
AdderRef::at(address).add(3, 5)

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
use super::{CrossContractDeployer, MathEngineDeployer};

#[test]
fn test_cross_calls() {
let math_engine_contract = MathEngineDeployer::default();
let cross_contract = CrossContractDeployer::init(math_engine_contract.address());

assert_eq!(cross_contract.add_using_another(), 8);
}

Each test start with a fresh instance of blockchain - no contracts are deployed. To test an external contract we deploy a MathEngine contract first, but we are not going to use it directly. We take only its address. Let's keep pretending, there is a contract with the add() function we want to use.

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use odra::types::Address;
use crate::features::cross_calls::{Adder, AdderRef};

#[test]
fn test_ext() {
let adder = AdderRef::at(get_adder_address());

assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address() -> Address {
let contract = MathEngineDeployer::default();
contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/directory-structure/index.html b/docs/docs/0.7.0/basics/directory-structure/index.html new file mode 100644 index 000000000..87a0c5f85 --- /dev/null +++ b/docs/docs/0.7.0/basics/directory-structure/index.html @@ -0,0 +1,27 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.7.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── .builder_casper/
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

By default, your project will use the latest odra version available at crates.io. We are using two features:

  • odra/mock-vm - it is responsible for running tests on Odra's MockVM
  • odra/casper - backend implementation of Casper blockchain +More backends will be released as features that will be possible to enable here.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

.builder_* folders

Those folders will be created and managed automatically by Cargo Odra. They contain project files necessary +for building wasm files and running them against blockchain VMs. As it is not necessary to modify +files in those folders in any way, by default they are hidden (hence the . at the beginning of the +folder name).

src/

This is the folder where your smart contract files live.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain of your choosing.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/errors/index.html b/docs/docs/0.7.0/basics/errors/index.html new file mode 100644 index 000000000..cfb7b7716 --- /dev/null +++ b/docs/docs/0.7.0/basics/errors/index.html @@ -0,0 +1,23 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.7.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::{execution_error, Variable, UnwrapOrRevert};
use odra::types::Address;

#[odra::module]
pub struct OwnedContract {
name: Variable<String>,
owner: Variable<Address>,
}

execution_error! {
pub enum Error {
OwnerNotSet => 1,
NotAnOwner => 2,
}
}


#[odra::module]
impl OwnedContract {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(odra::contract_env::caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = odra::contract_env::caller();
if caller != self.owner() {
odra::contract_env::revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using execution_error! macro to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You and the users of your contract will be thankful for a meaningful error message!

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
odra::contract_env::revert(Error::NotAnOwner)

Testing errors

Okay, but how about testing it? We've already mentioned a function - assert_exception. This is how you will +use it:

examples/src/features/handling_errors.rs
use super::{OwnedContractDeployer, OwnedContractRef};
use super::Error;

#[test]
fn test_owner_error() {
let owner = odra::test_env::get_account(0);
let not_an_owner = odra::test_env::get_account(1);

odra::test_env::set_caller(owner);
let mut owned_contract = OwnedContractDeployer::init("OwnedContract".to_string());

odra::test_env::set_caller(not_an_owner);
odra::test_env::assert_exception(Error::NotAnOwner, || {
owned_contract.change_name("NewName".to_string());
})
}

In the example above, because we are calling the change_name method as an address which is not an "owner", +we are expecting that "NotAnOwner" error will be thrown.

note

Here we are creating another reference to the already deployed contract using OwnedContractRef::at() and passing to it +its Address. Note that OwnedContractDeployer::init() returns the same type.

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/events/index.html b/docs/docs/0.7.0/basics/events/index.html new file mode 100644 index 000000000..eca53461a --- /dev/null +++ b/docs/docs/0.7.0/basics/events/index.html @@ -0,0 +1,20 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.7.0

Events

Different blockchains implement events in different ways. Odra lets you forget about it by introducing +Odra Events. Take a look:

examples/src/features/events.rs
use odra::{Event, contract_env};
use odra::types::{Address, BlockTime, event::OdraEvent};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract {
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

#[odra::module]
impl PartyContract {
#[odra(init)]
pub fn init(&self) {
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, we derive an Event macro like this:

examples/src/features/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: BlockTime,
}

Among other things, it adds an emit() function to the struct, which allows you to emit the event simply +as that:

examples/src/features/events.rs
PartyStarted {
caller: contract_env::caller(),
block_time: contract_env::get_block_time(),
}.emit();

Some backends may need to know all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] macro.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's test_env comes with a handy macro assert_events! which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use odra::{assert_events, test_env};
use crate::features::events::PartyStarted;
use super::PartyContractDeployer;

#[test]
fn test_party() {
let party_contract = PartyContractDeployer::init();
assert_events!(
party_contract,
PartyStarted {
caller: test_env::get_account(0),
block_time: 0,
}
);
}

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/flipper-internals/index.html b/docs/docs/0.7.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..0bd209c0f --- /dev/null +++ b/docs/docs/0.7.0/basics/flipper-internals/index.html @@ -0,0 +1,35 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.7.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Variable;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Variable, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Variables and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Variable<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The #[odra(init)] macro marks the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Variable<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using FlipperDeployer - a piece of code generated automatically thanks to the macros. +The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/modules/index.html b/docs/docs/0.7.0/basics/modules/index.html new file mode 100644 index 000000000..bca17e9e9 --- /dev/null +++ b/docs/docs/0.7.0/basics/modules/index.html @@ -0,0 +1,20 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.7.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to a macro #[odra::module]. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;

#[odra::module]
pub struct ModulesContract {
pub math_engine: MathEngine,
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the ERC20 example in the main odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
use super::ModulesContractDeployer;

#[test]
fn test_modules() {
let modules_contract = ModulesContractDeployer::default();
assert_eq!(modules_contract.add_using_module(), 8);
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/native-token/index.html b/docs/docs/0.7.0/basics/native-token/index.html new file mode 100644 index 000000000..e421d1130 --- /dev/null +++ b/docs/docs/0.7.0/basics/native-token/index.html @@ -0,0 +1,26 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.7.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::types::Balance;
use odra::contract_env;

#[odra::module]
pub struct PublicWallet {
}

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {
}

pub fn withdraw(&mut self, amount: Balance) {
contract_env::transfer_tokens(contract_env::caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/tlw.rs in the odra main repository.

You can see a new macro used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from contract_env - transfer_tokens. +It does exactly what you are expecting it to do - it will transfer native tokens from the contract to the +specified address.

We are also using the Balance - an Odra type that wraps around the type that the underlying blockchain uses +for counting tokens.

Testing

To be able to test how many tokens a contract (or any address) has, test_env comes with a function - +token_balance:

examples/src/features/native_token.rs
use odra::types::Balance;
use odra::test_env;
use super::PublicWalletDeployer;

#[test]
fn test_modules() {
let mut my_contract = PublicWalletDeployer::default();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::zero());

my_contract.with_tokens(Balance::from(100)).deposit();
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(100));

my_contract.withdraw(Balance::from(25));
assert_eq!(test_env::token_balance(my_contract.address()), Balance::from(75));
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/odra-toml/index.html b/docs/docs/0.7.0/basics/odra-toml/index.html new file mode 100644 index 000000000..070d7a2c5 --- /dev/null +++ b/docs/docs/0.7.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.7.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

The name will be used as a name for the contract - the generated wasm file will be in the above case named +flipper.wasm.

The fqn (Fully Qualified Name) is used by the builder to locate the exact struct where +the contract is defined.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
name = "flipper"
fqn = "sample::Flipper"

[[contracts]]
name = "counter"
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/storage-interaction/index.html b/docs/docs/0.7.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..514ffb008 --- /dev/null +++ b/docs/docs/0.7.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.7.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Variable

The Variable is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Variable type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
#[odra::module]
pub struct DogContract {
barks: Variable<bool>,
weight: Variable<u32>,
name: Variable<String>,
walks: Variable<Vec<u32>>,
}

You can see the Variable wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
use odra::Variable;

#[odra::module]
impl DogContract {
#[odra(init)]
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Variable is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::{Mapping, Variable};

#[odra::module]
pub struct DogContract2 {
name: Variable<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Variables section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Variable is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Variable working together:

core/src/list.rs
use odra::{Variable, List};

pub struct List<T> {
values: Mapping<u32, T>,
index: Variable<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
#[odra::module]
pub struct DogContract3 {
name: Variable<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
#[odra(init)]
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the odra repository in the examples/src/docs/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/basics/testing/index.html b/docs/docs/0.7.0/basics/testing/index.html new file mode 100644 index 000000000..711273cd9 --- /dev/null +++ b/docs/docs/0.7.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.7.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{Variable, List};

#[cfg(test)]
mod tests {
use super::DogContract3Deployer;

#[test]
fn init_test() {
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The #[odra(module)] macro created a Deployer code for us, which will deploy the contract on the +VM:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3Deployer::init("Mantus".to_string());

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with a macro are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

Test env

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use super::TestingContractDeployer;

#[test]
fn test_env() {
let testing_contract = TestingContractDeployer::init("MyContract".to_string());
let creator = testing_contract.created_by();
odra::test_env::set_caller(odra::test_env::get_account(1));
let testing_contract2 = TestingContractDeployer::init("MyContract2".to_string());
let creator2 = testing_contract2.created_by();
assert!(creator != creator2);
}
}

In the code above, we are deploying two instances of the same contract, but we're using odra::test_env::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::contract_env::caller() +the function we are calling inside the contract.

Each test env comes with a set of functions that will let you write better tests:

  • fn set_caller(address: Address) - you've seen it in action just now
  • fn token_balance(address: Address) -> Balance - it returns the balance of the account associated with the given address
  • fn advance_block_time_by(seconds: BlockTime) - it increases the current value of block_time
  • fn get_account(n: usize) -> Address - it returns an nth address that was prepared for you by Odra in advance; +by default, you start with the 0th account
  • fn assert_exception<F, E>(err: E, block: F) - it executes the block code and expects err to happen
  • fn get_event<T: MockVMType + OdraEvent>(address: Address, index: i32) -> Result<T, EventError> - returns +the event emitted by the contract

Again, we'll see those used in the next articles.

Deployer

You may be wondering what is the TestingContractDeployer and where did it come from. +It is a piece of code generated automatically for you, thanks to the #[odra::module] macro. +If you used the #[odra(init)] on one of the methods, it will be the constructor of your contract. +Odra will make sure that it is called only once, so you can use it to initialize your data structures etc.

If you do not provide the init method, you can deploy the contract using ::default() method. +In the end, you will get a Ref instance (in our case the TestingContractRef) which reimplements all +the methods you defined in the contract, but executes them on a blockchain!

To learn more about the Ref contract, visit the Cross calls article.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/category/advanced/index.html b/docs/docs/0.7.0/category/advanced/index.html new file mode 100644 index 000000000..0193d0fee --- /dev/null +++ b/docs/docs/0.7.0/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
Version: 0.7.0

Advanced

Advanced concepts of Odra Framework

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/category/backends/index.html b/docs/docs/0.7.0/category/backends/index.html new file mode 100644 index 000000000..af1f34eb0 --- /dev/null +++ b/docs/docs/0.7.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/category/basics/index.html b/docs/docs/0.7.0/category/basics/index.html new file mode 100644 index 000000000..60d6fc136 --- /dev/null +++ b/docs/docs/0.7.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/category/examples/index.html b/docs/docs/0.7.0/category/examples/index.html new file mode 100644 index 000000000..696922b66 --- /dev/null +++ b/docs/docs/0.7.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/category/getting-started/index.html b/docs/docs/0.7.0/category/getting-started/index.html new file mode 100644 index 000000000..c8e89ace6 --- /dev/null +++ b/docs/docs/0.7.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/category/tutorials/index.html b/docs/docs/0.7.0/category/tutorials/index.html new file mode 100644 index 000000000..eaa826799 --- /dev/null +++ b/docs/docs/0.7.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + +
+
Version: 0.7.0

Tutorials

The theory is good, but the practice is even better. Let's go through a few examples summing up all the Odra concepts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/examples/odra-examples/index.html b/docs/docs/0.7.0/examples/odra-examples/index.html new file mode 100644 index 000000000..6ef88f8fd --- /dev/null +++ b/docs/docs/0.7.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.7.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/examples/using-odra-modules/index.html b/docs/docs/0.7.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..1f6a48c73 --- /dev/null +++ b/docs/docs/0.7.0/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.7.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "0.3.1", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm"]
casper = ["odra/casper"]

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }

[features]
default = ["mock-vm"]
mock-vm = ["odra/mock-vm", "odra-modules/mock-vm"]
casper = ["odra/casper", "odra-modules/casper"]
danger

odra-modules defines the same features as the core framework. It's essential to add the dependency without default features. And if you define a casper feature in your project, add odra-modules/casperspecifically (it applies to each backend).

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::types::{Address, U256};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: Erc20
}

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/getting-started/flipper/index.html b/docs/docs/0.7.0/getting-started/flipper/index.html new file mode 100644 index 000000000..fda3a9cd0 --- /dev/null +++ b/docs/docs/0.7.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.7.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Variable;

/// A module definition. Each module struct consists Variables and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Variable<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
#[odra(init)]
pub fn initial_settings(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperDeployer;

#[test]
fn flipping() {
// To test a module we need to deploy it using autogenerated Deployer.
let mut contract = FlipperDeployer::initial_settings();
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let mut contract1 = FlipperDeployer::initial_settings();
let contract2 = FlipperDeployer::initial_settings();
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/getting-started/installation/index.html b/docs/docs/0.7.0/getting-started/installation/index.html new file mode 100644 index 000000000..e0ba3aba2 --- /dev/null +++ b/docs/docs/0.7.0/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.7.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-uknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called "my_project" and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal MockVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/index.html b/docs/docs/0.7.0/index.html new file mode 100644 index 000000000..0f7e19ef5 --- /dev/null +++ b/docs/docs/0.7.0/index.html @@ -0,0 +1,25 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.7.0

Odra framework

Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, +pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open +source.

Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains.

A smart contract written using Odra can be executed on all integrated systems. We can do it +by abstracting over core concepts that all the above systems are built around. These are type system, +storage, entry points, execution context, and testing environment. We believe it will bring standardization +to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this +ecosystem.

What's next

See the Installation and our Flipper example +to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/tutorials/access-control/index.html b/docs/docs/0.7.0/tutorials/access-control/index.html new file mode 100644 index 000000000..b6a1343d4 --- /dev/null +++ b/docs/docs/0.7.0/tutorials/access-control/index.html @@ -0,0 +1,17 @@ + + + + + +Access Control | Odra + + + + + +
+
Version: 0.7.0

Access Control

In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,

In this article we design and implement a more fine-grained access control layer.

Code

Before we start writing code, we list the functionalities of our access control layer.

  1. A Role type is used across the module.
  2. A Role can be assigned to many Addresses.
  3. Each Role may have a corresponding admin role.
  4. Only an admin can grant/revoke a Role.
  5. A Role can be renounced.
  6. A Role cannot be renounced on someone's behalf.
  7. Each action triggers an event.
  8. Unauthorized access stops contract execution.

Events and Errors

There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions.

events.rs
use odra::{types::Address, Event};
use super::access_control::Role;

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleGranted {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleRevoked {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleAdminChanged {
pub role: Role,
pub previous_admin_role: Role,
pub new_admin_role: Role
}
  • L4-L16 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.
  • L18-L21 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role.
errors.rs
use odra::execution_error;

execution_error! {
pub enum Error {
MissingRole => 20_000,
RoleRenounceForAnotherAddress => 20_001,
}
}

Errors definition is straightforward - there are only two invalid states:

  1. An action is triggered by an unauthorized actor.
  2. The caller is attempting to resign the Role on someone's behalf.

Module

Now, we are stepping into the most interesting part: the module definition and implementation.

access_control.rs
use super::{
errors::Error,
events::{RoleAdminChanged, RoleGranted, RoleRevoked}
};
use odra::{
contract_env,
types::{event::OdraEvent, Address},
Mapping
};

pub type Role = [u8; 32];

pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];

#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]
pub struct AccessControl {
roles: Mapping<Role, Mapping<Address, bool>>,
role_admin: Mapping<Role, Role>
}

#[odra::module]
impl AccessControl {
pub fn has_role(&self, role: &Role, address: &Address) -> bool {
self.roles.get_instance(role).get_or_default(address)
}

pub fn get_role_admin(&self, role: &Role) -> Role {
let admin_role = self.role_admin.get(role);
if let Some(admin) = admin_role {
admin
} else {
DEFAULT_ADMIN_ROLE
}
}

pub fn grant_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &contract_env::caller());
self.unchecked_grant_role(role, address);
}

pub fn revoke_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &contract_env::caller());
self.unchecked_revoke_role(role, address);
}

pub fn renounce_role(&mut self, role: &Role, address: &Address) {
if address != &contract_env::caller() {
contract_env::revert(Error::RoleRenounceForAnotherAddress);
}
self.unchecked_revoke_role(role, address);
}
}

impl AccessControl {
pub fn check_role(&self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
contract_env::revert(Error::MissingRole);
}
}

pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {
let previous_admin_role = self.get_role_admin(role);
self.role_admin.set(role, *admin_role);
RoleAdminChanged {
role: *role,
previous_admin_role,
new_admin_role: *admin_role
}
.emit();
}

pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.roles.get_instance(role).set(address, true);
RoleGranted {
role: *role,
address: *address,
sender: contract_env::caller()
}
.emit();
}
}

pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {
if self.has_role(role, address) {
self.roles.get_instance(role).set(address, false);
RoleRevoked {
role: *role,
address: *address,
sender: contract_env::caller()
}
.emit();
}
}
}
  • L11 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.
  • L13 - The default role is an array filled with zeros.
  • L15-L19 - The storage consists of two mappings:
  1. roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.
  2. role_admin - each Role can have a single admin Role.
  • L23-L25 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.
  • L54 - This is a non-exported block containing helper functions.
  • L55-L59 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.
  • L61-L70 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.
  • L72-L94 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).
  • L27-L34 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.
  • L36-L51 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access.
+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/tutorials/erc20/index.html b/docs/docs/0.7.0/tutorials/erc20/index.html new file mode 100644 index 000000000..f3b3ce1fe --- /dev/null +++ b/docs/docs/0.7.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.7.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token possesses an attribute that renders it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • advanced storage - key-value pairs,
  • Odra types like Address or Balance,
  • advanced events assertion.

Code

Our module has a pretty complex storage layout in comparison to the previous example.

We need to store the following data:

  1. Immutable metadata - name, symbol and decimals.
  2. Total supply.
  3. Users' balances.
  4. Allowances - in other words: who is allowed to spend whose tokens on his/her behalf.

Module definition

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Variable<u8>,
symbol: Variable<String>,
name: Variable<String>,
total_supply: Variable<Balance>,
balances: Mapping<Address, Balance>,
allowances: Mapping<Address, Mapping<Address, Balance>>
}
  • L6 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping. You may notice the balances property maps Address to Balance. If you deal with addresses or you operate on tokens, you should always choose Address over String and Balance over any numeric type. Each blockchain may handle these values differently. Using Odra types guarantees proper behavior on each target platform.
  • L7 - Odra allows nested Mappings, what we utilize to store allowances.

Metadata

#[odra::module]
impl Erc20 {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let caller = contract_env::caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> Balance {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.balances.add(address, *amount);
self.total_supply.add(amount);
Transfer {
from: None,
to: Some(*address),
amount: *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: Balance
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L10 - A constructor sets the token metadata and mints the initial supply.
  • L12-L14 - Getter functions are straightforward, but there is one worth-mentioning subtleness. In the Ownable example, we used the get() function returning an Option<T>. If the type implements Default trait, you can call get_or_default() function and the contract does not fail even if the value is not initialized.
  • L29 - The second impl is not an odra module, in other words these function will not be a part of contract's ABI.
  • L30-L39 - Mint function is public, so like in a regular rust code will be accessible from the outside. mint() use notation self.balances.add(&address, amount);, which it is syntactic sugar for:
let current_balance = self.balances.get(&address).unwrap_or_default();
let new_balance = current_balance.overflowing_add(current_balance).unwrap_or_revert();
self.balances.set(&address, new_balance);

Core

For the sake of completeness, let's implement the remaining functionalities like transfer, transfer_from, or approve. They are not introducing any new concepts, so we leave them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...
pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
let caller = contract_env::caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let spender = contract_env::caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
let owner = contract_env::caller();
self.allowances.get_instance(&owner).set(spender, *amount);
Approval {
owner,
spender: *spender,
value: *amount
}
.emit();
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.allowances.get_instance(owner).get_or_default(spender)
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
contract_env::revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
}
.emit();
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &Balance) {
let allowance = self.allowances.get_instance(owner).get_or_default(spender);
if allowance < *amount {
contract_env::revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.get_instance(owner)
.set(spender, new_allowance);
Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
}
.emit();
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

execution_error! {
pub enum Error {
InsufficientBalance => 1,
InsufficientAllowance => 2,
}
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::{Approval, Erc20Deployer, Erc20Ref, Error, Transfer};
use odra::{assert_events, test_env, types::U256};

pub const NAME: &str = "Plascoin";
pub const SYMBOL: &str = "PLS";
pub const DECIMALS: u8 = 10;
pub const INITIAL_SUPPLY: u32 = 10_000;

pub fn setup() -> Erc20Ref {
Erc20Deployer::init(
String::from(NAME),
String::from(SYMBOL),
DECIMALS,
INITIAL_SUPPLY.into()
)
}

#[test]
fn initialization() {
let erc20 = setup();

assert_eq!(&erc20.symbol(), SYMBOL);
assert_eq!(&erc20.name(), NAME);
assert_eq!(erc20.decimals(), DECIMALS);
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());
assert_events!(
erc20,
Transfer {
from: None,
to: Some(test_env::get_account(0)),
amount: INITIAL_SUPPLY.into()
}
);
}

#[test]
fn transfer_works() {
let mut erc20 = setup();
let (sender, recipient) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

erc20.transfer(&recipient, &amount);

assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);
assert_eq!(erc20.balance_of(&recipient), amount);
assert_events!(
erc20,
Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
);
}

#[test]
fn transfer_error() {
let mut erc20 = setup();
let recipient = test_env::get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::from(1);

test_env::assert_exception(Error::InsufficientBalance, || {
erc20.transfer(&recipient, &amount)
});
}

#[test]
fn transfer_from_and_approval_work() {
let mut erc20 = setup();
let (owner, recipient, spender) = (
test_env::get_account(0),
test_env::get_account(1),
test_env::get_account(2)
);
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount
}
);

// Spender transfers tokens from Owner to Recipient.
test_env::set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert_events!(
erc20,
Approval {
owner,
spender,
value: approved_amount - transfer_amount
},
Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
);

assert_events!(erc20, Approval, Transfer);
}

#[test]
fn transfer_from_error() {
let mut erc20 = setup();
let (owner, spender) = (test_env::get_account(0), test_env::get_account(1));
let amount = 1_000.into();

test_env::set_caller(spender);
test_env::assert_exception(Error::InsufficientAllowance, || {
erc20.transfer_from(&owner, &spender, &amount)
});
}
}
  • L111-123 - assert_events!() macro accepts multiple events. You must pass them in the order they were emitted.
  • L125 - Alternatively, if you don't want to check the entire event, you may assert only its type.
danger

You can not mix both approaches, you pass full events or types only.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/tutorials/ownable/index.html b/docs/docs/0.7.0/tutorials/ownable/index.html new file mode 100644 index 000000000..a822429cb --- /dev/null +++ b/docs/docs/0.7.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.7.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining constructors,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

use odra::{types::Address, Variable};

#[odra::module]
pub struct Ownable {
owner: Variable<Address>
}

That was easy, but it is crucial to understand the basic before we move on.

  • L3 - Firstly, we need create a struct called Ownable and apply #[odra::module] to it above.
  • L5 - Then we can define a layout of our module. That is extremely simple - just a single state value. What is most important you can never leave a raw type, you must always wrap it with Variable.

Init the module

use odra::{
execution_error, contract_env, Event, types::{Address, event::OdraEvent}
};
...

#[odra::module]
impl Ownable {
#[odra(init)]
pub fn init(&mut self, owner: &Address) {
if self.owner.get().is_some() {
contract_env::revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(*owner);

OwnershipChanged {
prev_owner: None,
new_owner: *owner
}
.emit();
}
}

execution_error! {
pub enum Error {
OwnerIsNotInitialized => 1,
}
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L5 - The impl should be an odra module, so add #[odra::module].
  • L7 - The init function is marked as #[odra(init)] making it a constructor. It matters if we would like to deploy the Ownable module as a standalone contract.
  • L23 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose we defined an Error enum. Notice that the Error enum is defined inside the execution_error macro. It generates, among others, the required Into<ExecutionError> binding.
  • L9-L11 - If the owner has been set already, we call contract_env::revert() function. As an argument we pass Error::OwnerIsNotInitialized.
  • L13 - Then we write the owner passed as an argument to the storage. To do so we call the set() on Variable.
  • L29-L33 - Once the owner is set, we would like to inform the outside world. First step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L23 - Finally, we create the OwnershipChanged struct and call emit() function on it (import odra::types::event::OdraEvent trait). Hence we set the first owner, we set the prev_owner value to None.

Features implementation

#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get().as_ref() {
contract_env::revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&contract_env::caller());
let current_owner = self.get_owner();
self.owner.set(*new_owner);
OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
}
.emit();
}

pub fn get_owner(&self) -> Address {
match self.owner.get() {
Some(owner) => owner,
None => contract_env::revert(Error::OwnerIsNotInitialized)
}
}
}

execution_error! {
pub enum Error {
NotOwner => 1,
OwnerIsAlreadyInitialized => 2,
OwnerIsNotInitialized => 3,
}
}

The above implementation relies on the concepts we have already used in this tutorial, so it should easy for you to get along.

  • L5,L32 - ensure_ownership() is reads the current owner, and reverts if is does not match the input Address. Also we need to update our Error enum adding a new variant NotOwner.
  • L11 - The function defined above can be reused in change_ownership() implementation. We pass to it the current caller, using the contract_env::caller() function. The we update the state, and emit OwnershipChanged.
  • L22,L34 - Lastly, a getter function. As the Variable get() function returns an Option, we need to handle a possible error. If someone call the getter on uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized.

Test

#[cfg(test)]
mod tests {
use super::*;
use odra::{assert_events, test_env};

fn setup() -> (Address, OwnableRef) {
let owner = test_env::get_account(0);
let ownable = OwnableDeployer::init(owner);
(owner, ownable)
}

#[test]
fn initialization_works() {
let (owner, ownable) = setup();
assert_eq!(ownable.get_owner(), owner);

assert_events!(
ownable,
OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (owner, mut ownable) = setup();
let new_owner = test_env::get_account(1);

test_env::set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);
assert_events!(
ownable,
OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (_, mut ownable) = setup();
let new_owner = test_env::get_account(1);
ownable.change_ownership(&new_owner);

test_env::assert_exception(Error::NotOwner, || {
ownable.change_ownership(&new_owner);
});
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we defined the setup() function we call as the first statement in each test. Take a look at the signature fn setup() -> (Address, OwnableRef). OwnableRef is a contract reference generated by Odra. This reference allows us call all the defined entrypoints namely: ensure_ownership(), change_ownership(), get_owner(), but not init() which is a constructor.
  • L7 - Now, the module needs an owner, the easiest way is to take one from the test_env. We choose the address of first account (which is the default one).
  • L8 - Odra created for us OwnableDeployer struct which implements all constructor functions. In this case there is just one function - init() which corresponds the function we have implemented in the module.
  • L12 - It is time to define the first test. As you see, it is a regular rust test.
  • L14-15 - Using the setup() function we get the owner, and a reference. We make a standard assertion comparing the owner we know, with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L17-23 - On the contract, only the init() function has been called, so we expect one event has been emitted. To assert that, let's use Odra's macro assert_events. As the first argument, pass the contract you want to read events from, followed by as many events as you expect have occurred.
  • L30 - Because we know the initial owner is the 0-th account, we must select a different account. It could be any index from 1 to 19 - the test env predefines 20 accounts.
  • L32 - As mentioned, the default is the 0-th account, if you want to change the executor call the test_env::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L49-55 - If a non-owner account tries to change ownership we expect it to fail. To capture the error, call test_env::assert_exception() with the error you expect and a failing block of code.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/tutorials/owned-token/index.html b/docs/docs/0.7.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..850eab964 --- /dev/null +++ b/docs/docs/0.7.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.7.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow minting tokens but only the module owner.
  3. The current owner should be able to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};

#[odra::module]
pub struct OwnedToken {
ownable: Ownable,
erc20: Erc20
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
use odra::types::{Address, Balance}

...

#[odra::module]
impl OwnedToken {
#[odra(init)]
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: &Balance) {
let deployer = contract_env::caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> Balance {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> Balance {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> Balance {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &Balance) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &Balance) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &Balance) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &Balance) {
self.ownable.ensure_ownership(&contract_env::caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L10-L11 - A constructor is a great place to init both modules at once.
  • L14-L16 - Most of the entrypoints do not need any modification, so we simply delegates them to the erc20 module.
  • L50-L52 - The same we do with the ownable module.
  • L58-L61 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.7.0/tutorials/pauseable/index.html b/docs/docs/0.7.0/tutorials/pauseable/index.html new file mode 100644 index 000000000..195b277fc --- /dev/null +++ b/docs/docs/0.7.0/tutorials/pauseable/index.html @@ -0,0 +1,17 @@ + + + + + +Pausable | Odra + + + + + +
+
Version: 0.7.0

Pausable

The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.

Code

As always, we will start with defining functionalities of our module.

  1. Check the state - is it paused or not.
  2. State guards - a contract should stop execution if is in a state we don't expect.
  3. Switch the state.

Events and Error

There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way.

Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser.

use odra::{Event, types::Address};

odra::execution_error! {
pub enum Error {
PausedRequired => 1_000,
UnpausedRequired => 1_001,
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Paused {
pub account: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Unpaused {
pub account: Address
}

Module definition

The module storage is extremely simple - has a single Variable of type bool, that indicates if a contract is paused.

#[odra::module]
pub struct Pausable {
is_paused: Variable<bool>
}

Checks and guards

Now, let's move to state checks and guards.

pauseable.rs
impl Pausable {
pub fn is_paused(&self) -> bool {
self.is_paused.get_or_default()
}

pub fn require_not_paused(&self) {
if self.is_paused() {
contract_env::revert(Error::UnpausedRequired);
}
}

pub fn require_paused(&self) {
if !self.is_paused() {
contract_env::revert(Error::PausedRequired);
}
}
}
  • L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.
  • L2 - is_paused() checks the contract state, if the Variable is_paused has not been initialized, the default value (false) is returned.
  • L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused.
  • L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused.

Actions

Finally, we will add the ability to switch the module state.

impl Pausable {
pub fn pause(&mut self) {
self.require_not_paused();
self.is_paused.set(true);

Paused {
account: contract_env::caller()
}
.emit();
}

pub fn unpause(&mut self) {
self.require_paused();
self.is_paused.set(false);

Unpaused {
account: contract_env::caller()
}
.emit();
}
}

pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused).

Pausable counter

In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Variable value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused).

use odra::Variable;
use odra_modules::security::Pausable;

#[odra::module]
pub struct PausableCounter {
value: Variable<u32>,
pauseable: Pausable
}

#[odra::module]
impl PausableCounter {
pub fn increment(&mut self) {
self.pauseable.require_not_paused();

let new_value = self.value.get_or_default() + 1;
self.value.set(new_value);
}

pub fn pause(&mut self) {
self.pauseable.pause();
}

pub fn unpause(&mut self) {
self.pauseable.unpause();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use super::PausableCounterDeployer;
use odra_modules::security::errors::Error;

#[test]
fn increment_only_if_unpaused() {
let mut contract = PausableCounterDeployer::default();
assert_eq!(contract.get_value(), 0);

contract.increment();
assert_eq!(contract.get_value(), 1);

contract.pause();
odra::test_env::assert_exception(
Error::UnpausedRequired,
|| contract.increment()
);
assert_eq!(contract.get_value(), 1);

contract.unpause();
contract.increment();
assert_eq!(contract.get_value(), 2);

}
}

As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/advanced/advanced-storage/index.html b/docs/docs/0.8.0/advanced/advanced-storage/index.html new file mode 100644 index 000000000..92e5940e3 --- /dev/null +++ b/docs/docs/0.8.0/advanced/advanced-storage/index.html @@ -0,0 +1,18 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.8.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values.

Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Var<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, a Mapping is a key-value storage system where the key is associated with a value. +In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type derived from odra::OdraType.

However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{casper_types::U256, Mapping, UnwrapOrRevert};
use odra::prelude::*;
use crate::owned_token::OwnedToken;

#[odra::module]
pub struct Mappings {
strings: Mapping<(String, u32, String), String>,
tokens: Mapping<String, OwnedToken>
}

#[odra::module]
impl Mappings {

...

pub fn total_supply(&mut self, token_name: String) -> U256 {
self.tokens.module(&token_name).total_supply()
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let opt_string = self.strings.get(&(key1, key2, key3));
opt_string.unwrap_or_revert(&self.env())
}
}

As you can see, a Mapping key can consist of a tuple of values, not limited to a single value.

note

Accessing Odra modules differs from accessing regular values such as strings or numbers.

Firstly, within a Mapping, you don't encapsulate the module with Submodule.

Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Address, casper_types::U512, Sequence, Mapping};
use odra::prelude::*;
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
counter: Sequence<u32>,
tokens: Mapping<(String, String), Token>,
}

impl AdvancedStorage {
pub fn current_value(&self) -> u32 {
self.counter.get_current_value()
}

pub fn increment_and_get(&mut self) -> u32 {
self.counter.next_value()
}

pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {
let token = self.tokens.module(&(token_name, creator));
token.balance_of(&address)
}

pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {
let mut token = self.tokens.module(&(token_name, creator));
token.mint(amount, to);
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:

  1. Odra offers a Sequence module, enabling contracts to store and increment a single value.
  2. Mappings support composite keys expressed as tuples and can store modules as values.

Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/advanced/attributes/index.html b/docs/docs/0.8.0/advanced/attributes/index.html new file mode 100644 index 000000000..fec57aca8 --- /dev/null +++ b/docs/docs/0.8.0/advanced/attributes/index.html @@ -0,0 +1,20 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.8.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that +allows developers to embed common checks into function definitions in a readable and reusable manner. +These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U256 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env.revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env()
.emit_event(Deposit {
address: caller,
amount
});
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Example

#[odra::module]
pub struct NonReentrantCounter {
counter: Var<u32>
}

#[odra::module]
impl NonReentrantCounter {
#[odra(non_reentrant)]
pub fn count_ref_recursive(&mut self, n: u32) {
if n > 0 {
self.count();
ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);
}
}
}

impl NonReentrantCounter {
fn count(&mut self) {
let c = self.counter.get_or_default();
self.counter.set(c + 1);
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::{host::{Deployer, NoArgs}, ExecutionError};

#[test]
fn ref_recursion_not_allowed() {
let test_env = odra_test::env();
let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);

let result = contract.count_ref_recursive(11);
assert_eq!(result, ExecutionError::ReentrantCall.into());
}
}

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/advanced/delegate/index.html b/docs/docs/0.8.0/advanced/delegate/index.html new file mode 100644 index 000000000..218298d59 --- /dev/null +++ b/docs/docs/0.8.0/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.8.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use crate::{erc20::Erc20, ownable::Ownable};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
fn approve(&mut self, spender: Address, amount: U256);
fn name(&self) -> String;
fn symbol(&self) -> String;
fn decimals(&self) -> u8;
fn total_supply(&self) -> U256;
fn balance_of(&self, owner: Address) -> U256;
fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct DeFiPlatform {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>,
exchange: SubModule<Exchange>
}

#[odra::module]
impl DeFiPlatform {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
}

to self.exchange {
fn swap(&mut self, sender: Address, recipient: Address);
fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/advanced/storage-layout/index.html b/docs/docs/0.8.0/advanced/storage-layout/index.html new file mode 100644 index 000000000..13d7242ff --- /dev/null +++ b/docs/docs/0.8.0/advanced/storage-layout/index.html @@ -0,0 +1,44 @@ + + + + + +Storage Layout | Odra + + + + + +
+
Version: 0.8.0

Storage Layout

Odra's innovative modular design necessitates a unique storage layout. This +article explains step-by-step Odra's storage layout.

Casper VM Perspective

The Casper Execution Engine (VM) enables the storage of data in named keys or +dictionaries. However, a smart contract has a limited number of named keys, +making it unsuitable for storing substantial data volumes. Odra resolves this +issue by storing all user-generated data in a dictionary called state. This +dictionary operates as a key-value store, where keys are strings with a maximum +length of 64 characters, and values are arbitrary byte arrays.

Here is an example of what the interface for reading and writing data could look +like:

pub trait CasperStorage {
fn read(key: &str) -> Option<Vec<u8>>;
fn write(key: &str, value: Vec<u8>);
}

Odra Perspective

Odra was conceived with modularity and code reusability in mind. Additionally, +we aimed to streamline storage definition through the struct object. Consider +this straightforward storage definition:

#[odra::module]
pub struct Token {
name: Var<String>,
balances: Mapping<Address, U256>
}

The Token structure contains two fields: name of type String and +balances, which functions as a key-value store with Address as keys and +U256 as values.

The Token module can be reused in another module, as demonstrated in a more +complex example:

#[odra::module]
pub struct Loans {
lenders: SubModule<Token>,
borrowers: SubModule<Token>,
}

The Loans module has two fields: lenders and borrowers, both of which have +the same storage layout as defined by the Token module. Odra guarantees that +lenders and borrowers are stored under distinct keys within the storage +dictionary.

Both Token and Loans serve as examples to show how Odra's storage layout +operates.

Key generation.

Every element of a module (struct) with N elements is associated with an index +ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an +element of a module is another module (SubModule<...>), the associated index +serves as a prefix for the indexes of the inner module.

While this may initially appear complex, it is easily understood through an +example. In the example, indexes are presented as bytes, reflecting the actual +implementation.

Loans {
lenders: Token { // prefix: 0x0000
name: 0, // key: 0x0000_0000
balances: 1 // key: 0x0000_0001
},
borrowers: Token { // prefix: 0x0001
name: 0, // key: 0x0001_0000
balances: 1 // key: 0x0001_0001
}
}

Additionally, it's worth mentioning how Mapping's keys are used in the +storage. They are simply concatenated with the index of the module, as +demonstrated in the example.

For instance, triggering borrowers.balances.get(0x1234abcd) would result in a +key:

0x0001_0001_1234_abcd

Finally, the key must be hashed to fit within the 64-character limit and then +encoded in hexadecimal format.

Value serialization

Before being stored in the storage, each value is serialized into bytes using +the CLType serialization method and subsequently encapsulated with Casper's +Bytes types.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/backends/casper/index.html b/docs/docs/0.8.0/backends/casper/index.html new file mode 100644 index 000000000..0261c1778 --- /dev/null +++ b/docs/docs/0.8.0/backends/casper/index.html @@ -0,0 +1,50 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.8.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[derive(Event)].

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling self.env().attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, +you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Deploying a contract to Casper network

There would be no point in writing a contract if you couldn't deploy it to the blockchain. +You can do it in two ways: provided by the Casper itself: using the casper-client tool +or using the Odra's Livenet integration.

Let's explore the first option to better understand the process.

note

If you wish, you can skip the following section and jump to the Livenet integration.

WASM arguments

When deploying a new contract you can pass some arguments to it. +Every contract written in Odra expects those arguments to be set:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Additionally, if required by the contract, you can pass constructor arguments.

When working with the test env via cargo odra or when using +Livenet integration this is handled automatically. However, if you rather use +casper-client directly, you have to pass them manually:

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. U512 type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK.

Execution

First thing Odra does with your code, is similar to the one used in OdraVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/backends/livenet/index.html b/docs/docs/0.8.0/backends/livenet/index.html new file mode 100644 index 000000000..606d54367 --- /dev/null +++ b/docs/docs/0.8.0/backends/livenet/index.html @@ -0,0 +1,49 @@ + + + + + +Livenet | Odra + + + + + +
+
Version: 0.8.0

Livenet

The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local +test node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend +to handle the deployment of your contracts to the real blockchain.

Furthermore, it is implemented in a similarly to Casper or OdraVM, +however, it uses a real blockchain to deploy contracts and store the state. +This lets us use Odra to deploy and test contracts on a real blockchain, but +on the other hand, it comes with some limitations on what can be done in the tests.

The main differences between Livenet and e.g. CasperVM backend are:

  • Real CSPR tokens are used to deploy and call contracts. This also means that we need to +pay for each contract deployment and each contract call. Of course, we can use the faucet +to get some tokens for testing purposes, but we still need to specify the amount needed +for each action.
  • The contract state is stored on the real blockchain, so we can't just reset the state - +we can redeploy the contract, but we can't remove the old one.
  • Because of the above, we can load the existing contracts and use them in the tests.
  • We have no control over the block time. This means that for example, advance_block_time function +is implemented by waiting for the real time to pass.

This is also a cause for the fact that the Livenet backend cannot be (yet) used for running +the regular Odra tests. Instead, we can create integration tests or binaries which will +use a slightly different workflow to test the contracts.

Setup

To use Livenet backend, we need to provide Odra with some information - the network address, our private +key and the name of the chain we want to use. Optionally, we can add multiple private keys to use +more than one account in our tests. Those values are passed using environment variables. We can use .env +file to store them - let's take a look at an example .env file, created from the .env.sample file from +examples folder:

# Path to the secret key of the account that will be used
# to deploy the contracts.
# We're using .keys folder so we don't accidentally commit
# the secret key to the repository.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777

# Chain name of the network. Known values:
# - integration-test
ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test

# Paths to the secret keys of the additional accounts.
# Main secret key will be 0th account.
ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem
ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem

With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find +a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. +Let's go through the code:

fn main() {
// Similar to the OdraVM backend, we need to initialize
// the environment:
let env = odra_casper_livenet_env::env();

// Most of the for the host env works the same as in the
// OdraVM backend.
let owner = env.caller();
// Addresses are the real addresses on the blockchain,
// so we need to provide them
// if we did not import their secret keys.
let recipient =
"hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";
let recipient = Address::from_str(recipient).unwrap();

// Arguments for the contract init method.
let name = String::from("Plascoin");
let symbol = String::from("PLS");
let decimals = 10u8;
let initial_supply: U256 = U256::from(10_000);

// The main difference between other backends - we need to specify
// the gas limit for each action.
// The limit will be used for every consecutive action
// until we change it.
env.set_gas(100_000_000_000u64);

// Deploy the contract. The API is the same as in the OdraVM backend.
let init_args = Erc20InitArgs {
name,
symbol,
decimals,
initial_supply: Some(initial_supply)
};
let mut token = Erc20HostRef::deploy(env, init_args);

// We can now use the contract as we would in the OdraVM backend.
println!("Token address: {}", token.address().to_string());

// Uncomment to load existing contract.
// let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
// let address = Address::from_str(address).unwrap();
// We use the Livenet-specific `load` method to load the contract
// that is already deployed.
// let mut token = Erc20Deployer::load(env, address);

// Non-mutable calls are free! Neat, huh? More on that later.
println!("Token name: {}", token.name());

// The next call is mutable, but the cost is lower that the deployment,
// so we change the amount of gas
env.set_gas(3_000_000_000u64);
token.transfer(recipient, U256::from(1000));

println!("Owner's balance: {:?}", token.balance_of(owner));
println!("Recipient's balance: {:?}", token.balance_of(recipient));
}
note

The above example is a rust binary, not a test. Note that it is also added as a section of the +Cargo.toml file:

[bin]
name = "erc20_on_livenet"
path = "src/bin/erc20_on_livenet.rs"
required-features = ["livenet"]
test = false

Usage

To run the above code, we simply need to run the binary with the livenet feature enabled:

cargo run --bin erc20_on_livenet --features=livenet
note

Before executing the binary, make sure you built a wasm file.

A part of a sample output should look like this:

...
💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
💁 INFO : Deploy "65b1a5d21..." successfully executed.
Owner's balance: 4004
Recipient's balance: 4000

Those logs are a result of the last 4 lines of the above listing. +Each deployment or a call to the blockchain will be noted and will take some time to execute. +We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant +and cost us nothing. How it is possible?

info

You can see the deployment on http://cspr.live/ - the transfer from the example +can be seen here.

How Livenet backend works

All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. +It is possible however to query the state of the blockchain for free.

This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the +node is the current state. This is why the balance_of call was almost instant and free.

Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract +(see Cross Calls), it is executed offline and +node is used for the state query only. However, the Livenet needs to know the connection between the contracts +and the code, so make sure to deploy or load already deployed contracts

Multiple enviroments

It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, +multiple nodes or even multiple chains.

To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. +Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file +has to be used first. If your integration.env file has a value that IS present in the .env file, it will +override the value from the .env file.

ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene

To sum up - this command will firstly load the integration.env file and then load the missing values from .env file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/backends/odra-vm/index.html b/docs/docs/0.8.0/backends/odra-vm/index.html new file mode 100644 index 000000000..52f63a34a --- /dev/null +++ b/docs/docs/0.8.0/backends/odra-vm/index.html @@ -0,0 +1,26 @@ + + + + + +OdraVM | Odra + + + + + +
+
Version: 0.8.0

OdraVM

The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time - +simply use your IDE's debug functionality.

Usage

The OdraVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

OdraVM consists of two main parts: the Contract Register and the State.

The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address.

Contracts and Test Env functions can modify the State of the OdraVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the OdraVM State holds only the current state of the OdraVM. +Thanks to this and the fact that we do not need the blockchain itself, +OdraVM starts instantly and runs the tests in the native speed.

Execution

When the OdraVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, OdraVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/backends/what-is-a-backend/index.html b/docs/docs/0.8.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..d41159ed2 --- /dev/null +++ b/docs/docs/0.8.0/backends/what-is-a-backend/index.html @@ -0,0 +1,28 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.8.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like OdraVM, +a complete virtual machine, spinning up a blockchain for you - like CasperVM, +or even a real blockchain - when using Livenet backend.

Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Host Env

Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/cargo-odra/index.html b/docs/docs/0.8.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..5aa15d47a --- /dev/null +++ b/docs/docs/0.8.0/basics/cargo-odra/index.html @@ -0,0 +1,37 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.8.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them with various configurations.

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This creates a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

The third available template is workspace, which creates a workspace with two projects, similar to the one created +with the full template.

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.8.0 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it creates a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This creates a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

The most used command during the development of your project should be this one:

cargo odra test

It runs your tests against Odra's MockVM. It is substantially faster than CasperVM +and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra builds the project, generates the wasm files, +spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat.

Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. +This is why OdraVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build

If the build process finishes successfully, wasm files will be located in wasm folder. +Notice, that this command does not require the -b option.

If you want to build specific contract, you can use -c option:

cargo odra build -c counter # you pass many comma separated contracts

Generating contract schema

If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command:

cargo odra schema 

This generates a schema file in JSON format for all your contracts and places them in the resources folder. +If the resources folder does not exist, it creates the folder for you.

Like with the build command, you can use the -c option to generate a schema for a specific contract.

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/communicating-with-host/index.html b/docs/docs/0.8.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..abe0e5889 --- /dev/null +++ b/docs/docs/0.8.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.8.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module]
pub struct HostContract {
name: Var<String>,
created_at: Var<u64>,
created_by: Var<Address>
}

#[odra::module]
impl HostContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(self.env().get_block_time());
self.created_by.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are using self.env(). It is an implementation of Module::env(), autogenerated +by #[odra::module] attribute. The function returns a reference to the ContractEnv (you can read more in +the Backend section). This is a structure that provides access to the host functions and variables.

In this example, we use two of them:

  • get_block_time() - returns the current block time as u64.
  • caller() - returns an Odra Address of the caller (this can be an external caller or another contract).
info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/cross-calls/index.html b/docs/docs/0.8.0/basics/cross-calls/index.html new file mode 100644 index 000000000..ffb522d7a --- /dev/null +++ b/docs/docs/0.8.0/basics/cross-calls/index.html @@ -0,0 +1,22 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.8.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::prelude::*;
use odra::{Address, UnwrapOrRevert, Var};

#[odra::module]
pub struct CrossContract {
pub math_engine: Var<Address>
}

#[odra::module]
impl CrossContract {
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine;

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To perform a cross-contact call, we use the {{ModuleName}}ContractRef that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)

Contract Ref

We mentioned HostRef already in our Testing article - a host side reference to already deployed contract.

In the module context we use a ContractRef instead, to call other contracts.

Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, +by the #[odra::module] attribute.

To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above.

The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract.

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call:

examples/src/features/cross_calls.rs
AdderContractRef::new(self.env(), address).add(3, 5)

Loading the contract

Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test +our contracts in Livenet backend. We can load the contract using load method on the Deployer:

examples/bin/erc20_on_livenet.rs
fn _load(env: &HostEnv) -> Erc20HostRef {
let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
let address = Address::from_str(address).unwrap();
<Erc20HostRef as HostRefLoader>::load(env, address)
}

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};
use odra::host::{Deployer, HostRef, NoArgs};

#[test]
fn test_cross_calls() {
let test_env = odra_test::env();
let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);

let init_args = CrossContractInitArgs {
math_engine_address: *math_engine_contract.address()
};
let cross_contract = CrossContractHostRef::deploy(&test_env, init_args);

assert_eq!(cross_contract.add_using_another(), 8);
}
}

Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize.

#[cfg(test)]
mod tests {
use super::*;
use odra::{Address, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_ext() {
let test_env = odra_test::env();
let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)
assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address(test_env: &HostEnv) -> Address {
let contract = MathEngineHostRef::deploy(test_env, NoArgs);
*contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/directory-structure/index.html b/docs/docs/0.8.0/basics/directory-structure/index.html new file mode 100644 index 000000000..20370fb8a --- /dev/null +++ b/docs/docs/0.8.0/basics/directory-structure/index.html @@ -0,0 +1,26 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.8.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── rust-toolchain
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── bin/
| |── build_contract.rs
| └── build_schema.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "sample_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "sample_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also +added as a dev dependency.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

src/

This is the folder where your smart contract files live.

bin/

This is the folder where scripts that will be used to generate code or schemas live. +You don't need to modify those files, they are generated by cargo odra new command and +are used by cargo odra build, cargo odra test and cargo odra schema commands.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/errors/index.html b/docs/docs/0.8.0/basics/errors/index.html new file mode 100644 index 000000000..a45b19c1c --- /dev/null +++ b/docs/docs/0.8.0/basics/errors/index.html @@ -0,0 +1,24 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.8.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::prelude::*;
use odra::{Address, OdraError, Var};

#[odra::module]
pub struct OwnedContract {
name: Var<String>,
owner: Var<Address>
}

#[derive(OdraError)]
pub enum Error {
OwnerNotSet = 1,
NotAnOwner = 2
}

#[odra::module]
impl OwnedContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = self.env().caller();
if caller != self.owner() {
self.env().revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using the OdraError derive attribute to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
self.env().revert(Error::NotAnOwner)

Defining an error in Odra, you must keep in mind a few rules:

  1. An error should be a field-less enum.
  2. The enum must derive from OdraError.
  3. Avoid implicit discriminants.
note

In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!

Testing errors

Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:

examples/src/features/handling_errors.rs
#[cfg(test)]
mod tests {
use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};
use odra::host::Deployer;
use odra::prelude::*;

#[test]
fn test_owner_error() {
let test_env = odra_test::env();
let owner = test_env.get_account(0);
let not_an_owner = test_env.get_account(1);

test_env.set_caller(owner);
let init_args = OwnedContractInitArgs {
name: "OwnedContract".to_string()
};
let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);

test_env.set_caller(not_an_owner);
assert_eq!(
owned_contract.try_change_name("NewName".to_string()),
Err(Error::NotAnOwner.into())
);
}
}

Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult. +OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and +and safe its safe version: try_name, try_owner, try_change_name.

In our example, we are calling try_change_name and expecting an error to be thrown. +For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, +we need to convert our custom error to OdraError using Into::into().

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/events/index.html b/docs/docs/0.8.0/basics/events/index.html new file mode 100644 index 000000000..9ff16239a --- /dev/null +++ b/docs/docs/0.8.0/basics/events/index.html @@ -0,0 +1,18 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.8.0

Events

In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:

examples/src/features/events.rs
use odra::prelude::*;
use odra::{Address, Event};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract;

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64
}

#[odra::module]
impl PartyContract {
pub fn init(&self) {
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, add the #[derive(Event)] attribute like this:

examples/src/features/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64,
}

To emit an event, we use the emit_event function from the ContractEnv, passing the event as an argument:

examples/src/features/events.rs
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});

To determine all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] attribute.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use super::{PartyContractHostRef, PartyStarted};
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

#[test]
fn test_party() {
let test_env: HostEnv = odra_test::env();
let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);
test_env.emitted_event(
party_contract.address(),
&PartyStarted {
caller: test_env.get_account(0),
block_time: 0
}
);
// If you do not want to check the exact event, you can use `emitted` function
test_env.emitted(party_contract.address(), "PartyStarted");
// You can also check how many events were emitted.
assert_eq!(test_env.events_count(party_contract.address()), 1);
}

To explore more event testing functions, check the HostEnv documentation.

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/flipper-internals/index.html b/docs/docs/0.8.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..ce80b3e4c --- /dev/null +++ b/docs/docs/0.8.0/basics/flipper-internals/index.html @@ -0,0 +1,38 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.8.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Var;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Var, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Var<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the attribute - all functions defined there, even marked +with pub will be not callable.

The function named init is the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error. The init function is optional, +if your contract does not need any initialization, you can skip it.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated +by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, +as the second argument of the deploy function, we pass NoArgs - one of the implementations of +the InitArgs trait provided with the framework.

The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/modules/index.html b/docs/docs/0.8.0/basics/modules/index.html new file mode 100644 index 000000000..f11ad6b33 --- /dev/null +++ b/docs/docs/0.8.0/basics/modules/index.html @@ -0,0 +1,21 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.8.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to the #[odra::module] attribute. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;
use odra::module::SubModule;
use odra::prelude::*;

#[odra::module]
pub struct ModulesContract {
pub math_engine: SubModule<MathEngine>
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}
info

To use a module as a component of another module, you need to use the SubModule type. This is a special type +that crates a keyspace (read more in Storage Layout) and provide access to its public methods.

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the OwnedToken example in the main Odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
#[cfg(test)]
mod tests {
use super::ModulesContractHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);
assert_eq!(modules_contract.add_using_module(), 8);
}
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/native-token/index.html b/docs/docs/0.8.0/basics/native-token/index.html new file mode 100644 index 000000000..18bd6c9c3 --- /dev/null +++ b/docs/docs/0.8.0/basics/native-token/index.html @@ -0,0 +1,25 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.8.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::prelude::*;
use odra::casper_types::U512;

#[odra::module]
pub struct PublicWallet;

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {}

pub fn withdraw(&mut self, amount: &U512) {
self.env().transfer_tokens(&self.env().caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/contracts/tlw.rs in the odra main repository.

You can see a new attribute used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from ContractEnv::transfer_tokens(). +It does exactly what you are expecting it to do - it transfers native tokens from the contract to the +specified address.

Testing

To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function - +balance_of:

examples/src/features/native_token.rs
#[cfg(test)]
mod tests {
use super::PublicWalletHostRef;
use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);
assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());

my_contract.with_tokens(U512::from(100)).deposit();
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));

my_contract.withdraw(U512::from(25));
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/odra-toml/index.html b/docs/docs/0.8.0/basics/odra-toml/index.html new file mode 100644 index 000000000..11e18d2fb --- /dev/null +++ b/docs/docs/0.8.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.8.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
fqn = "sample::Flipper"

The fqn (Fully Qualified Name) is used by the building tools to locate and build the contract. +The last segment of the fqn will be used as the name for your contract - the generated wasm file will +be in the above case named flipper.wasm.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
fqn = "sample::Flipper"

[[contracts]]
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/storage-interaction/index.html b/docs/docs/0.8.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..421d320a1 --- /dev/null +++ b/docs/docs/0.8.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.8.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Var

The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Var type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
#[odra::module]
pub struct DogContract {
barks: Var<bool>,
weight: Var<u32>,
name: Var<String>,
walks: Var<Vec<u32>>,
}

You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
use odra::Var;

#[odra::module]
impl DogContract {
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Var is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::{Mapping, Var};

#[odra::module]
pub struct DogContract2 {
name: Var<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Vars section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Var working together:

core/src/list.rs
use odra::{List, Var};

pub struct List<T> {
values: Mapping<u32, T>,
index: Var<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
#[odra::module]
pub struct DogContract3 {
name: Var<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/basics/testing/index.html b/docs/docs/0.8.0/basics/testing/index.html new file mode 100644 index 000000000..dd6a2e831 --- /dev/null +++ b/docs/docs/0.8.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.8.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{List, Var};

#[cfg(test)]
mod tests {
use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn init_test() {
let test_env = odra_test::env();
let init_args = DogContract3InitArgs {
name: "DogContract".to_string()
};
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The first interesting thing you may notice is placed the import section.

use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

We are using super to import the DogContract3HostRef and DogContract3InitArgs from the parent module. +{{ModuleName}}HostRef and {{ModuleName}}InitArgs are types that was generated for us by Odra.

DogContract3HostRef is a reference to the contract that we can use to interact with it (call entrypoints) +and implements HostRef trait.

DogContract3InitArgs is a struct that we use to initialize the contract and implements InitArgs trait. +Considering the contract initialization, there three possible scenarios:

  1. The contract has a constructor with arguments, then Odra creates a struct named {{ModuleName}}InitArgs.
  2. The contract has a constructor with no arguments, then you can use odra::host::NoArgs.
  3. The contract does not have a constructor, then you can use odra::host::NoArgs. +All of those structs implement the odra::host::InitArgs trait, required to conform to the +Deployer::deploy method signature.

The other import is odra::host::Deployer. This is a trait is used to deploy the contract and give us a reference to it.

Let's take a look at the test itself. How to obtain a reference to the contract? +{{ModuleName}}HostRef implements the Deployer trait, which provides the deploy method:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with the odra::module attribute are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

HostEnv

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};
use odra::{host::{Deployer, HostEnv}, prelude::*};

#[test]
fn env() {
let test_env: HostEnv = odra_test::env();
test_env.set_caller(test_env.get_account(0));
let init_args = TestingContractInitArgs {
name: "MyContract".to_string()
};
let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);
let creator = testing_contract.created_by();
test_env.set_caller(test_env.get_account(1));
let init_args = TestingContractInitArgs {
name: "MyContract2".to_string()
};
let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);
let creator2 = testing_contract2.created_by();
assert_ne!(creator, creator2);
}
}

In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). +Next, we are deploying two instances of the same contract, but we're using HostEnv::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller() +the function we are calling inside the contract.

HostEnv comes with a set of functions that will let you write better tests:

  • fn set_caller(&self, address: Address) - you've seen it in action just now
  • fn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given address
  • fn advance_block_time(&self, time_diff: u64) - increases the current value of block_time
  • fn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; +by default, you start with the 0-th account
  • fn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract

Full list of functions can be found in the HostEnv documentation.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/category/advanced/index.html b/docs/docs/0.8.0/category/advanced/index.html new file mode 100644 index 000000000..111d68997 --- /dev/null +++ b/docs/docs/0.8.0/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/category/backends/index.html b/docs/docs/0.8.0/category/backends/index.html new file mode 100644 index 000000000..9854637ec --- /dev/null +++ b/docs/docs/0.8.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/category/basics/index.html b/docs/docs/0.8.0/category/basics/index.html new file mode 100644 index 000000000..a976e75b1 --- /dev/null +++ b/docs/docs/0.8.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/category/examples/index.html b/docs/docs/0.8.0/category/examples/index.html new file mode 100644 index 000000000..4c98fa1e5 --- /dev/null +++ b/docs/docs/0.8.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/category/getting-started/index.html b/docs/docs/0.8.0/category/getting-started/index.html new file mode 100644 index 000000000..54858b4dd --- /dev/null +++ b/docs/docs/0.8.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/category/migrations/index.html b/docs/docs/0.8.0/category/migrations/index.html new file mode 100644 index 000000000..6241dc447 --- /dev/null +++ b/docs/docs/0.8.0/category/migrations/index.html @@ -0,0 +1,17 @@ + + + + + +Migrations | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/category/tutorials/index.html b/docs/docs/0.8.0/category/tutorials/index.html new file mode 100644 index 000000000..d159d36f5 --- /dev/null +++ b/docs/docs/0.8.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + +
+
Version: 0.8.0

Tutorials

The theory is good, but the practice is even better. Let's go through a few examples summing up all the Odra concepts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/examples/odra-examples/index.html b/docs/docs/0.8.0/examples/odra-examples/index.html new file mode 100644 index 000000000..ad7d6edcb --- /dev/null +++ b/docs/docs/0.8.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.8.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/examples/using-odra-modules/index.html b/docs/docs/0.8.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..7292563e1 --- /dev/null +++ b/docs/docs/0.8.0/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.8.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = "0.8.0"
odra-modules = "0.8.0"

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::prelude::*;
use odra::{Address, casper_types::U256, module::SubModule};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/getting-started/flipper/index.html b/docs/docs/0.8.0/getting-started/flipper/index.html new file mode 100644 index 000000000..9bd9a485c --- /dev/null +++ b/docs/docs/0.8.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.8.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Var;

/// A module definition. Each module struct consists Vars and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor, must be named `init`.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let env = odra_test::env();
let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);
let contract2 = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

Testing

To run the tests, execute the following command:

cargo odra test # or add the `-b casper` flag to run tests on the CasperVM

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/getting-started/installation/index.html b/docs/docs/0.8.0/getting-started/installation/index.html new file mode 100644 index 000000000..179ff3f57 --- /dev/null +++ b/docs/docs/0.8.0/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.8.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra --locked

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called my_project and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/index.html b/docs/docs/0.8.0/index.html new file mode 100644 index 000000000..4997f7de1 --- /dev/null +++ b/docs/docs/0.8.0/index.html @@ -0,0 +1,19 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.8.0

Odra framework

Odra is a Rust-based smart contract framework for Casper Network. Odra encourages rapid development and clean, +pragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel.

It's free and open source!

What's next

See the Installation and our Flipper example to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/migrations/to-0.8.0/index.html b/docs/docs/0.8.0/migrations/to-0.8.0/index.html new file mode 100644 index 000000000..e34ccae5f --- /dev/null +++ b/docs/docs/0.8.0/migrations/to-0.8.0/index.html @@ -0,0 +1,19 @@ + + + + + +Migration guide to v0.8.0 | Odra + + + + + +
+
Version: 0.8.0

Migration guide to v0.8.0

Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version.

This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant changes in v0.8.0 include:

  • Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only.
  • Framework internals redesign.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0.

2. Migration Steps

2.1 Add bin directory

Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory.

You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2. Update Cargo.toml

There a bunch of changes in the Cargo.toml file.

  • You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.
  • Register bins you added in the previous step.
  • Add dev-dependencies section with odra-test crate.
  • Add recommended profiles for release and dev to optimize the build process.

Below you can compare the Cargo.toml file after and before the migration to v0.8.0:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

2.2. Update Odra.toml

Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required.

[[contracts]]
fqn = "my_project::Flipper"

2.3. Update Smart Contracts

The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:

2.3.1. Update the use statements to reflect the new module structure.

  • Big integer types are now located in the odra::casper_types module.
  • odra::types::Address is now odra::Address.
  • Variable is now Var.
  • Remove odra::contract_env.
  • Remove odra::types::event::OdraEvent.
  • Remove odra::types::OdraType as it is no longer required.
  • Change odra::types::casper_types::*; to odra::casper_types::*;.

2.3.2. Some type aliases are no longer in use.

  • Balance - use odra::casper_types::U512.
  • BlockTime - use u64.
  • EventData - use odra::casper_types::bytesrepr::Bytes.

2.3.3. Consider import odra::prelude::* in your module files.

2.3.4. Flatten nested Mappings.

// Before
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<Address, Mapping<Address, U256>>
}
// After
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<(Address, Address), U256>
}

2.3.5. Update errors definitions.

execution_error! macro has been replace with OdraError derive macro.

use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.3.6. Update events definitions.

use odra::prelude::*;
use odra::Event;

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

// Emitting the event
self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});

2.3.7. Replace contract_env with self.env() in your modules.

self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes.

  • fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.
  • fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).
  • set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions.
  • fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].
  • fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.
  • fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).
  • fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.
  • functions native_token_metadata() and one_token() have been removed.

2.3.8. Wrap submodules of your module with odra::SubModule<T>.

#[odra::module(events = [Transfer])]
pub struct Erc721Token {
core: SubModule<Erc721Base>,
metadata: SubModule<Erc721MetadataExtension>,
ownable: SubModule<Ownable>
}

2.3.9. Update external contract calls.

However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()).

#[odra::external_contract]
pub trait Token {
fn balance_of(&self, owner: &Address) -> U256;
}

// Usage
TokenContractRef::new(env, token).balance_of(account)

2.3.10. Update constructors.

Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init.

2.3.11. Update UnwrapOrRevert calls.

The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter.

2.3.12. Remove #[odra(using)] attribute from your module definition.

Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required.

2.4. Update Tests

Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:

2.4.1. Contract deployment.

The way you deploy a contract has changed:

  1. You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.
  2. Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.
  3. If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.
  4. If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function.
// A contract without init args
use super::OwnableHostRef;
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

let env: HostEnv = odra_test::env();
let ownable = OwnableHostRef::deploy(&env, NoArgs)

// A contract with init args
use super::{Erc20HostRef, Erc20InitArgs};
use odra::host::{Deployer, HostEnv};

let env: HostEnv = odra_test::env();
let init_args = Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
};
let erc20 = Erc20HostRef::deploy(&env, init_args);

2.4.2. Host interactions.

  1. Replace odra::test_env with odra_test::env().
  2. The API of odra::test_env and odra_test::env() are similar, but there are some differences:
    • test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).
    • test_env::token_balance(Address) is now env.balance_of(&Address).
    • functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef.

2.4.3. Testing failing scenarios.

test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result. +try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro.

#[test]
fn transfer_from_error() {
let (env, mut erc20) = setup();

let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

assert_eq!(
erc20.try_transfer_from(owner, recipient, amount),
Err(Error::InsufficientAllowance.into())
);
}

2.4.4. Testing events.

assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. +The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options.

let env: HostEnv = odra_test::env();
let erc20 = Erc20HostRef::deploy(&env, init_args);

...

assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.8.0.

src/erc20.rs
use crate::erc20::errors::Error::*;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address, Event};

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
use super::{
errors::Error,
events::{Approval, Transfer},
Erc20HostRef, Erc20InitArgs
};
use odra::{
casper_types::U256,
host::{Deployer, HostEnv, HostRef},
prelude::*
};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

// Other tests...
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/tutorials/access-control/index.html b/docs/docs/0.8.0/tutorials/access-control/index.html new file mode 100644 index 000000000..3adca41a1 --- /dev/null +++ b/docs/docs/0.8.0/tutorials/access-control/index.html @@ -0,0 +1,17 @@ + + + + + +Access Control | Odra + + + + + +
+
Version: 0.8.0

Access Control

In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,

In this article we design and implement a more fine-grained access control layer.

Code

Before we start writing code, we list the functionalities of our access control layer.

  1. A Role type is used across the module.
  2. A Role can be assigned to many Addresses.
  3. Each Role may have a corresponding admin role.
  4. Only an admin can grant/revoke a Role.
  5. A Role can be renounced.
  6. A Role cannot be renounced on someone's behalf.
  7. Each action triggers an event.
  8. Unauthorized access stops contract execution.

Project Structure

access-control
├── src
│ ├── access
│ │ ├── access_control.rs
│ │ ├── events.rs
│ │ └── errors.rs
│ └── lib.rs
|── build.rs
|── Cargo.toml
└── Odra.toml

Events and Errors

There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions.

events.rs
use odra::prelude::*;
use odra::{Address, Event};
use super::access_control::Role;

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleGranted {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleRevoked {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleAdminChanged {
pub role: Role,
pub previous_admin_role: Role,
pub new_admin_role: Role
}
  • L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.
  • L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role.
errors.rs
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
MissingRole = 20_000,
RoleRenounceForAnotherAddress = 20_001,
}

Errors definition is straightforward - there are only two invalid states:

  1. An action is triggered by an unauthorized actor.
  2. The caller is attempting to resign the Role on someone's behalf.

Module

Now, we are stepping into the most interesting part: the module definition and implementation.

access_control.rs
use super::events::*;
use super::errors::Error;
use odra::prelude::*;
use odra::{module::Module, Address, Mapping};

pub type Role = [u8; 32];

pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];

#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]
pub struct AccessControl {
roles: Mapping<(Role, Address), bool>,
role_admin: Mapping<Role, Role>
}

#[odra::module]
impl AccessControl {
pub fn has_role(&self, role: &Role, address: &Address) -> bool {
self.roles.get_or_default(&(*role, *address))
}

pub fn get_role_admin(&self, role: &Role) -> Role {
let admin_role = self.role_admin.get(role);
if let Some(admin) = admin_role {
admin
} else {
DEFAULT_ADMIN_ROLE
}
}

pub fn grant_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_grant_role(role, address);
}

pub fn revoke_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_revoke_role(role, address);
}

pub fn renounce_role(&mut self, role: &Role, address: &Address) {
if address != &self.env().caller() {
self.env().revert(Error::RoleRenounceForAnotherAddress);
}
self.unchecked_revoke_role(role, address);
}
}

impl AccessControl {
pub fn check_role(&self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.env().revert(Error::MissingRole);
}
}

pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {
let previous_admin_role = self.get_role_admin(role);
self.role_admin.set(role, *admin_role);
self.env().emit_event(RoleAdminChanged {
role: *role,
previous_admin_role,
new_admin_role: *admin_role
});
}

pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.roles.set(&(*role, *address), true);
self.env().emit_event(RoleGranted {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}

pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {
if self.has_role(role, address) {
self.roles.set(&(*role, *address), false);
self.env().emit_event(RoleRevoked {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}
}
  • L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.
  • L8 - The default role is an array filled with zeros.
  • L10-L13 - The storage consists of two mappings:
  1. roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.
  2. role_admin - each Role can have a single admin Role.
  • L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.
  • L49 - This is a non-exported block containing helper functions.
  • L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.
  • L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.
  • L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).
  • L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.
  • L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access.
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/tutorials/build-deploy-read/index.html b/docs/docs/0.8.0/tutorials/build-deploy-read/index.html new file mode 100644 index 000000000..cb9529ff2 --- /dev/null +++ b/docs/docs/0.8.0/tutorials/build-deploy-read/index.html @@ -0,0 +1,17 @@ + + + + + +Build, Deploy and Read the State of a Contract | Odra + + + + + +
+
Version: 0.8.0

Build, Deploy and Read the State of a Contract

In this guide, we will show the full path from creating a contract, deploying it and reading the state.

We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript.

Before you start, make sure you completed the following steps:

Contract

Let's write a contract with complex storage layout.

The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping.

We will expose two methods:

  1. The constructor init which sets the metadata and the version of the contract.
  2. The method set_data which sets the value of the numeric field and the values of the mapping.
custom_item.rs
use odra::{casper_types::U256, prelude::*, Mapping, OdraType, SubModule, Var};

// A custom type with a vector of another custom type
#[derive(OdraType, Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(OdraType, Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

// The main contract with a version, metadata and a submodule
#[odra::module]
pub struct CustomItem {
version: Var<u32>,
meta: Var<Metadata>,
data: SubModule<Data>
}

#[odra::module]
impl CustomItem {
pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {
let meta = Metadata {
name,
description,
prices: vec![
Price { value: price_1 },
Price { value: price_2 }
]
};
self.meta.set(meta);
self.version.set(self.version.get_or_default() + 1);
}

pub fn set_data(&mut self, value: u32, name: String, name2: String) {
self.data.value.set(value);
self.data.inner.named_values.set(&name, 10);
self.data.inner.named_values.set(&name2, 20);
}
}

// A submodule with a numeric value and another submodule
#[odra::module]
struct Data {
value: Var<u32>,
inner: SubModule<InnerData>,
}

// A submodule with a mapping
#[odra::module]
struct InnerData {
named_values: Mapping<String, u32>,
}

Deploying the contract

First, we need to setup the chain. We will use the NCTL docker image to run a local network.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Next, we need to compile the contract to a Wasm file.

cargo odra build -c custom_item 

Then, we can deploy the contract using the casper-client tool.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key path/to/your/secret_key.pem \
--session-path [PATH_TO_WASM] \
--payment-amount 100000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string='My Name'" \
--session-arg "description:string='My Description'" \
--session-arg "price_1:u256='101'" \
--session-arg "price_2:u256='202'"

Finally, we can call the set_data method to set the values of the contract.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key ./keys/secret_key.pem \
--payment-amount 2000000000 \
--session-hash [DEPLOYED_CONTRACT_HASH] \
--session-entry-point "set_data" \
--session-arg "value:u32:'666'" \
--session-arg "name:string='alice'" \
--session-arg "name2:string='bob'"

Storage Layout

To read the state of the contract, we need to understand the storage layout.

The first step is to calculate the index of the keys.

Storage Layout

CustomItem: prefix: 0x0..._0000_0000_0000 0
version: u32, 0x0..._0000_0000_0000 0
meta: Metadata, 0x0..._0000_0000_0001 1
data: Data: prefix: 0x0..._0000_0010_0000 (2 << 4)
value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0
inner: InnerData: prefix: 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4
named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0

The actual key is obtained as follows:

  1. Convert the index to a big-endian byte array.
  2. Concatenate the index with the mapping data.
  3. Hash the concatenated bytes using blake2b.
  4. Return the hex representation of the hash (the stored key must be utf-8 encoded).

In more detail, the storage layout is described in the Storage Layout article.

Reading the state

main.rs
use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};
use casper_types::{
bytesrepr::{FromBytes, ToBytes},
U256,
};

// replace with your contract hash
const CONTRACT_HASH: &str = "hash-...";
const NODE_ADDRESS: &str = "http://localhost:11101/rpc";
const RPC_ID: &str = "casper-net-1";
const DICTIONARY_NAME: &str = "state";

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

async fn read_state_key(key: String) -> Vec<u8> {
let state_root_hash = casper_client::get_state_root_hash(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
None,
)
.await
.unwrap()
.result
.state_root_hash
.unwrap();

// Read the value from the `state` dictionary.
let result = casper_client::get_dictionary_item(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
state_root_hash,
DictionaryItemIdentifier::ContractNamedKey {
key: CONTRACT_HASH.to_string(),
dictionary_name: DICTIONARY_NAME.to_string(),
dictionary_item_key: key,
},
)
.await
.unwrap()
.result
.stored_value;

// We expect the value to be a CLValue
if let StoredValue::CLValue(cl_value) = result {
// Ignore the first 4 bytes, which are the length of the CLType.
cl_value.inner_bytes()[4..].to_vec()
} else {
vec![]
}
}

async fn metadata() -> Metadata {
// The key for the metadata is 1, and it has no mapping data
let key = key(1, &[]);
let bytes = read_state_key(key).await;

// Read the name and store the remaining bytes
let (name, bytes) = String::from_bytes(&bytes).unwrap();
// Read the description and store the remaining bytes
let (description, bytes) = String::from_bytes(&bytes).unwrap();
// A vector is stored as a u32 size followed by the elements
// Read the size of the vector and store the remaining bytes
let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();

let mut prices = vec![];
// As we know the size of the vector, we can loop over it
for _ in 0..size {
// Read the value and store the remaining bytes
let (value, rem) = U256::from_bytes(&bytes).unwrap();
bytes = rem;
prices.push(Price { value });
}
// Anytime you finish parsing a value, you should check if there are any remaining bytes
// if there are, it means you have a bug in your parsing logic.
// For simplicity, we will ignore the remaining bytes here.
Metadata {
name,
description,
prices
}
}

async fn value() -> u32 {
// The key for the value is (2 << 4) + 0, and it has no mapping data
let key = key(2 << 4, &[]);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

async fn named_value(name: &str) -> u32 {
// The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes
let mapping_data = name.to_bytes().unwrap();
let key = key(((2 << 4) + 1) << 4, &mapping_data);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

fn main() {
let runtime = tokio::runtime::Runtime::new().unwrap();
dbg!(runtime.block_on(metadata()));
dbg!(runtime.block_on(value()));
dbg!(runtime.block_on(named_value("alice")));
dbg!(runtime.block_on(named_value("bob")));
}

// The key is a combination of the index and the mapping data
// The algorithm is as follows:
// 1. Convert the index to a big-endian byte array
// 2. Concatenate the index with the mapping data
// 3. Hash the concatenated bytes using blake2b
// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)
fn key(idx: u32, mapping_data: &[u8]) -> String {
let mut key = Vec::new();
key.extend_from_slice(idx.to_be_bytes().as_ref());
key.extend_from_slice(mapping_data);
let hashed_key = blake2b(&key);

hex::encode(&hashed_key)
}

fn blake2b(bytes: &[u8]) -> [u8; 32] {
let mut result = [0u8; 32];
let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32)
.expect("should create hasher");
let _ = std::io::Write::write(&mut hasher, bytes);
blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)
.expect("should copy hash to the result array");
result
}

cargo run
[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {
name: "My Contract",
description: "My Description",
prices: [
Price {
value: 123,
},
Price {
value: 321,
},
],
}
[src/main.rs:117:5] runtime.block_on(value()) = 666
[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20
[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/tutorials/erc20/index.html b/docs/docs/0.8.0/tutorials/erc20/index.html new file mode 100644 index 000000000..202b81fca --- /dev/null +++ b/docs/docs/0.8.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.8.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • Advanced storage using key-value pairs,
  • Odra types such as Address,
  • Advanced event assertion.

Code

Our module features a considerably more complex storage layout compared to the previous example.

It is designed to store the following data:

  1. Immutable metadata - name, symbol, and decimals.
  2. Total supply.
  3. Balances of individual users.
  4. Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.

Module definition

erc20.rs
use odra::prelude::*;
use odra::{Address, casper_types::U256, Mapping, Var};

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}
  • L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.
  • L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys.

Metadata

erc20.rs
...
use odra::Event;

...

#[odra::module]
impl Erc20 {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let caller = self.env().caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, &initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &U256) {
self.balances.add(address, *amount);
self.total_supply.add(*amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}
  • L6 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L8-L14 - A constructor sets the token metadata and mints the initial supply.
  • L33 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.
  • L34-L43 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for:
use odra::UnwrapOrRevert;

let current_balance = self.balances.get(address).unwrap_or_default();
let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());
self.balances.set(address, new_balance);

Core

To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks.

erc20.rs
...
use odra::OdraError;

#[odra::module]
impl Erc20 {
...

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();
self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
self.env().revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowance(owner, spender);
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.set(&(*owner, *spender), new_allowance);
self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 1,
InsufficientAllowance = 2,
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::*;
use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: INITIAL_SUPPLY.into()
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

#[test]
fn transfer_from_and_approval_work() {
let (env, mut erc20) = setup();

let (owner, recipient, spender) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount
}
));

// Spender transfers tokens from Owner to Recipient.
env.set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));
// assert!(env.emitted(erc20.address(), "Transfer"));
}

#[test]
fn transfer_from_error() {
// Given a new instance.
let (env, mut erc20) = setup();

// When the spender's allowance is zero.
let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

// Then transfer fails.
assert_eq!(
erc20.try_transfer_from(&owner, &recipient, &amount),
Err(Error::InsufficientAllowance.into())
);
}
}
  • L146 - Alternatively, if you don't want to check the entire event, you may assert only its type.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/tutorials/ownable/index.html b/docs/docs/0.8.0/tutorials/ownable/index.html new file mode 100644 index 000000000..8ce1d8190 --- /dev/null +++ b/docs/docs/0.8.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.8.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining a constructor,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

ownable.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(events = [OwnershipChanged])]
pub struct Ownable {
owner: Var<Option<Address>>
}

That was easy, but it is crucial to understand the basics before we move on.

  • L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.
  • L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var.

Init the module

ownable.rs
...
use odra::{Event, OdraError};

...

#[odra::module]
impl Ownable {
pub fn init(&mut self, owner: Address) {
if self.owner.get_or_default().is_some() {
self.env().revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(Some(owner));

self.env().emit_event(OwnershipChanged {
prev_owner: None,
new_owner: owner
});
}
}

#[derive(OdraError)]
pub enum Error {
OwnerIsAlreadyInitialized = 1,
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L7 - The impl should be an Odra module, so add #[odra::module].
  • L9 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.
  • L23-26 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the OdraError derive macro is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.
  • L10-L12 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument.
  • L14 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.
  • L28-L32 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L16 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None.

Features implementation

ownable.rs
#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get_or_default().as_ref() {
self.env().revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&self.env().caller());
let current_owner = self.get_owner();
self.owner.set(Some(*new_owner));
self.env().emit_event(OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
});
}

pub fn get_owner(&self) -> Address {
match self.owner.get_or_default() {
Some(owner) => owner,
None => self.env().revert(Error::OwnerIsNotInitialized)
}
}
}

#[derive(OdraError)]
pub enum Error {
NotOwner = 1,
OwnerIsAlreadyInitialized = 2,
OwnerIsNotInitialized = 3,
}

The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along.

  • L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.
  • L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.
  • L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead.

Test

ownable.rs
#[cfg(test)]
mod tests {
use super::*;
use odra::host::{Deployer, HostEnv, HostRef};

fn setup() -> (OwnableHostRef, HostEnv, Address) {
let env: HostEnv = odra_test::env();
let init_args = OwnableInitArgs {
owner: env.get_account(0)
};
(OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))
}

#[test]
fn initialization_works() {
let (ownable, env, owner) = setup();
assert_eq!(ownable.get_owner(), owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (mut ownable, env, owner) = setup();
let new_owner = env.get_account(1);

env.set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (mut ownable, env, _) = setup();
let new_owner = env.get_account(1);
ownable.change_ownership(&new_owner);

assert_eq!(
ownable.try_change_ownership(&new_owner),
Err(Error::NotOwner.into())
);
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.
  • L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one).
  • L14 - It is time to define the first test. As you see, it is a regular Rust test.
  • L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.
  • L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.
  • L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/tutorials/owned-token/index.html b/docs/docs/0.8.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..34ebaac02 --- /dev/null +++ b/docs/docs/0.8.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.8.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow only the module owner to mint tokens.
  3. Enable the current owner to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};
use odra::prelude::*;
use odra::module::SubModule;

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
...
use odra::{Address, casper_types::U256};
...

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.ownable.ensure_ownership(&self.env().caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L9-L10 - A constructor is an excellent place to initialize both modules at once.
  • L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.
  • L49-L51 - The same is done with the ownable module.
  • L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.0/tutorials/pauseable/index.html b/docs/docs/0.8.0/tutorials/pauseable/index.html new file mode 100644 index 000000000..121d8474d --- /dev/null +++ b/docs/docs/0.8.0/tutorials/pauseable/index.html @@ -0,0 +1,17 @@ + + + + + +Pausable | Odra + + + + + +
+
Version: 0.8.0

Pausable

The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.

Code

As always, we will start with defining functionalities of our module.

  1. Check the state - is it paused or not.
  2. State guards - a contract should stop execution if is in a state we don't expect.
  3. Switch the state.

Events and Error

There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way.

Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser.

pauseable.rs
use odra::prelude::*;
use odra::{Address, Event, OdraError};

#[derive(OdraError)]
pub enum Error {
PausedRequired = 1_000,
UnpausedRequired = 1_001,
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Paused {
pub account: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Unpaused {
pub account: Address
}

Module definition

The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused.

pauseable.rs
use odra::Var;
...

#[odra::module(events = [Paused, Unpaused])]
pub struct Pausable {
is_paused: Var<bool>
}

Checks and guards

Now, let's move to state checks and guards.

pauseable.rs
impl Pausable {
pub fn is_paused(&self) -> bool {
self.is_paused.get_or_default()
}

pub fn require_not_paused(&self) {
if self.is_paused() {
self.env().revert(Error::UnpausedRequired);
}
}

pub fn require_paused(&self) {
if !self.is_paused() {
self.env().revert(Error::PausedRequired);
}
}
}
  • L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.
  • L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.
  • L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused.
  • L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused.

Actions

Finally, we will add the ability to switch the module state.

pauseable.rs
impl Pausable {
pub fn pause(&mut self) {
self.require_not_paused();
self.is_paused.set(true);

self.env().emit_event(Paused {
account: self.env().caller()
});
}

pub fn unpause(&mut self) {
self.require_paused();
self.is_paused.set(false);

self.env().emit_event(Unpaused {
account: self.env().caller()
});
}
}

pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused).

Pausable counter

In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused).

pauseable.rs
...
use odra::SubModule;
...

#[odra::module]
pub struct PausableCounter {
value: Var<u32>,
pauseable: SubModule<Pausable>
}

#[odra::module]
impl PausableCounter {
pub fn increment(&mut self) {
self.pauseable.require_not_paused();

let new_value = self.value.get_or_default() + 1;
self.value.set(new_value);
}

pub fn pause(&mut self) {
self.pauseable.pause();
}

pub fn unpause(&mut self) {
self.pauseable.unpause();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::host::{Deployer, NoArgs};

#[test]
fn increment_only_if_unpaused() {
let test_env = odra_test::env();
let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);
contract.increment();
contract.pause();

assert_eq!(
contract.try_increment().unwrap_err(),
Error::UnpausedRequired.into()
);
assert_eq!(contract.get_value(), 1);
}
}

As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/advanced/advanced-storage/index.html b/docs/docs/0.8.1/advanced/advanced-storage/index.html new file mode 100644 index 000000000..3146865d0 --- /dev/null +++ b/docs/docs/0.8.1/advanced/advanced-storage/index.html @@ -0,0 +1,18 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.8.1

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values.

Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + OdraType
{
value: Var<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, a Mapping is a key-value storage system where the key is associated with a value. +In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type derived from odra::OdraType.

However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{casper_types::U256, Mapping, UnwrapOrRevert};
use odra::prelude::*;
use crate::owned_token::OwnedToken;

#[odra::module]
pub struct Mappings {
strings: Mapping<(String, u32, String), String>,
tokens: Mapping<String, OwnedToken>
}

#[odra::module]
impl Mappings {

...

pub fn total_supply(&mut self, token_name: String) -> U256 {
self.tokens.module(&token_name).total_supply()
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let opt_string = self.strings.get(&(key1, key2, key3));
opt_string.unwrap_or_revert(&self.env())
}
}

As you can see, a Mapping key can consist of a tuple of values, not limited to a single value.

note

Accessing Odra modules differs from accessing regular values such as strings or numbers.

Firstly, within a Mapping, you don't encapsulate the module with Submodule.

Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Address, casper_types::U512, Sequence, Mapping};
use odra::prelude::*;
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
counter: Sequence<u32>,
tokens: Mapping<(String, String), Token>,
}

impl AdvancedStorage {
pub fn current_value(&self) -> u32 {
self.counter.get_current_value()
}

pub fn increment_and_get(&mut self) -> u32 {
self.counter.next_value()
}

pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {
let token = self.tokens.module(&(token_name, creator));
token.balance_of(&address)
}

pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {
let mut token = self.tokens.module(&(token_name, creator));
token.mint(amount, to);
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:

  1. Odra offers a Sequence module, enabling contracts to store and increment a single value.
  2. Mappings support composite keys expressed as tuples and can store modules as values.

Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/advanced/attributes/index.html b/docs/docs/0.8.1/advanced/attributes/index.html new file mode 100644 index 000000000..6ef46f0c2 --- /dev/null +++ b/docs/docs/0.8.1/advanced/attributes/index.html @@ -0,0 +1,20 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.8.1

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that +allows developers to embed common checks into function definitions in a readable and reusable manner. +These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U256 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env.revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env()
.emit_event(Deposit {
address: caller,
amount
});
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Example

#[odra::module]
pub struct NonReentrantCounter {
counter: Var<u32>
}

#[odra::module]
impl NonReentrantCounter {
#[odra(non_reentrant)]
pub fn count_ref_recursive(&mut self, n: u32) {
if n > 0 {
self.count();
ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);
}
}
}

impl NonReentrantCounter {
fn count(&mut self) {
let c = self.counter.get_or_default();
self.counter.set(c + 1);
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::{host::{Deployer, NoArgs}, ExecutionError};

#[test]
fn ref_recursion_not_allowed() {
let test_env = odra_test::env();
let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);

let result = contract.count_ref_recursive(11);
assert_eq!(result, ExecutionError::ReentrantCall.into());
}
}

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/advanced/building-manually/index.html b/docs/docs/0.8.1/advanced/building-manually/index.html new file mode 100644 index 000000000..1f1e4b59a --- /dev/null +++ b/docs/docs/0.8.1/advanced/building-manually/index.html @@ -0,0 +1,28 @@ + + + + + +Building contracts manually | Odra + + + + + +
+
Version: 0.8.1

Building contracts manually

cargo odra is a great tool to build and test your contracts, but sometimes +a better control over the parameters that are passed to the cargo +or the compiler is needed.

This is especially useful when the project has multiple features, and there is a need +to switch between them during the building and testing.

Knowing that cargo odra is a simple wrapper around cargo, it is easy to replicate +the same behavior by using cargo directly.

Building the contract manually

To build the contract manually, cargo odra uses the following command:

ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract
info

Odra uses the environment variable ODRA_MODULE to determine which contract to build.

Assuming that project's crate is named my_project, this command will build +the my_contract contract in release mode and generate the wasm file. +The file will be put into the target/wasm32-unknown-unknown/release directory under +the name my_project_build_contract.wasm.

The Odra Framework expects the contracts to be placed in the wasm directory, and +to be named correctly, so the next step would be to move the file:

mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm

Optimizing the contract

To lower the size of the wasm file, cargo odra uses the wasm-strip tool:

wasm-strip wasm/my_contract.wasm

To further optimize the wasm file, the wasm-opt tool is also used.

wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
danger

This step is required, as the wasm file generated by the Rust compiler is not +fully compatible with the Casper execution engine.

Running the tests manually

To run the tests manually, Odra needs to know which backend to use. +To run tests agains Casper backend, the following command needs to be used:

ODRA_BACKEND=casper cargo test

Wrapping up

Let's say we want to build the my_contract in debug mode, run the tests against the +casper backend and use the my-own-allocator feature from our my_project project.

To do that, we can use the following set of commands:

ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract
mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm
wasm-strip wasm/my_contract.wasm
wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
ODRA_BACKEND=casper cargo test --features my-own-allocator
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/advanced/delegate/index.html b/docs/docs/0.8.1/advanced/delegate/index.html new file mode 100644 index 000000000..369a9fa19 --- /dev/null +++ b/docs/docs/0.8.1/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.8.1

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use crate::{erc20::Erc20, ownable::Ownable};
use odra::{
Address, casper_types::U256,
module::{Module, SubModule},
prelude::*
};

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
pub fn approve(&mut self, spender: Address, amount: U256);
pub fn name(&self) -> String;
pub fn symbol(&self) -> String;
pub fn decimals(&self) -> u8;
pub fn total_supply(&self) -> U256;
pub fn balance_of(&self, owner: Address) -> U256;
pub fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
pub fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct DeFiPlatform {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>,
exchange: SubModule<Exchange>
}

#[odra::module]
impl DeFiPlatform {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: Address, amount: U256);
pub fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
pub fn get_owner(&self) -> Address;
}

to self.exchange {
pub fn swap(&mut self, sender: Address, recipient: Address);
pub fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/advanced/storage-layout/index.html b/docs/docs/0.8.1/advanced/storage-layout/index.html new file mode 100644 index 000000000..92b1c6ddf --- /dev/null +++ b/docs/docs/0.8.1/advanced/storage-layout/index.html @@ -0,0 +1,44 @@ + + + + + +Storage Layout | Odra + + + + + +
+
Version: 0.8.1

Storage Layout

Odra's innovative modular design necessitates a unique storage layout. This +article explains step-by-step Odra's storage layout.

Casper VM Perspective

The Casper Execution Engine (VM) enables the storage of data in named keys or +dictionaries. However, a smart contract has a limited number of named keys, +making it unsuitable for storing substantial data volumes. Odra resolves this +issue by storing all user-generated data in a dictionary called state. This +dictionary operates as a key-value store, where keys are strings with a maximum +length of 64 characters, and values are arbitrary byte arrays.

Here is an example of what the interface for reading and writing data could look +like:

pub trait CasperStorage {
fn read(key: &str) -> Option<Vec<u8>>;
fn write(key: &str, value: Vec<u8>);
}

Odra Perspective

Odra was conceived with modularity and code reusability in mind. Additionally, +we aimed to streamline storage definition through the struct object. Consider +this straightforward storage definition:

#[odra::module]
pub struct Token {
name: Var<String>,
balances: Mapping<Address, U256>
}

The Token structure contains two fields: name of type String and +balances, which functions as a key-value store with Address as keys and +U256 as values.

The Token module can be reused in another module, as demonstrated in a more +complex example:

#[odra::module]
pub struct Loans {
lenders: SubModule<Token>,
borrowers: SubModule<Token>,
}

The Loans module has two fields: lenders and borrowers, both of which have +the same storage layout as defined by the Token module. Odra guarantees that +lenders and borrowers are stored under distinct keys within the storage +dictionary.

Both Token and Loans serve as examples to show how Odra's storage layout +operates.

Key generation.

Every element of a module (struct) with N elements is associated with an index +ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an +element of a module is another module (SubModule<...>), the associated index +serves as a prefix for the indexes of the inner module.

While this may initially appear complex, it is easily understood through an +example. In the example, indexes are presented as bytes, reflecting the actual +implementation.

Loans {
lenders: Token { // prefix: 0x0000
name: 0, // key: 0x0000_0000
balances: 1 // key: 0x0000_0001
},
borrowers: Token { // prefix: 0x0001
name: 0, // key: 0x0001_0000
balances: 1 // key: 0x0001_0001
}
}

Additionally, it's worth mentioning how Mapping's keys are used in the +storage. They are simply concatenated with the index of the module, as +demonstrated in the example.

For instance, triggering borrowers.balances.get(0x1234abcd) would result in a +key:

0x0001_0001_1234_abcd

Finally, the key must be hashed to fit within the 64-character limit and then +encoded in hexadecimal format.

Value serialization

Before being stored in the storage, each value is serialized into bytes using +the CLType serialization method and subsequently encapsulated with Casper's +Bytes types.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/advanced/using-different-allocator/index.html b/docs/docs/0.8.1/advanced/using-different-allocator/index.html new file mode 100644 index 000000000..c07a698a8 --- /dev/null +++ b/docs/docs/0.8.1/advanced/using-different-allocator/index.html @@ -0,0 +1,25 @@ + + + + + +Memory allocators | Odra + + + + + +
+
Version: 0.8.1

Memory allocators

When compiling contracts to wasm, your code needs to be no-std. +This means that instead of using the standard library, the core +crate will be linked to your code. This crate does not contain +a memory allocator.

Happily, Odra automatically enables allocator - from our tests +the one developed by ink! +seems to be the best.

Using a different allocator

If the default allocator does not suit your needs, or you use a crate that +already provides an allocator, you can disable the default allocator by enabling +the disable-allocator feature in the odra dependency in your project:

[dependencies]
odra = { path = "../odra", features = ["disable-allocator"] }

If you want to have a better control over the features that are enabled +during the building and tests, see the next article on building manually.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/backends/casper/index.html b/docs/docs/0.8.1/backends/casper/index.html new file mode 100644 index 000000000..5e5222fad --- /dev/null +++ b/docs/docs/0.8.1/backends/casper/index.html @@ -0,0 +1,50 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.8.1

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[derive(Event)].

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling self.env().attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, +you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Deploying a contract to Casper network

There would be no point in writing a contract if you couldn't deploy it to the blockchain. +You can do it in two ways: provided by the Casper itself: using the casper-client tool +or using the Odra's Livenet integration.

Let's explore the first option to better understand the process.

note

If you wish, you can skip the following section and jump to the Livenet integration.

WASM arguments

When deploying a new contract you can pass some arguments to it. +Every contract written in Odra expects those arguments to be set:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Additionally, if required by the contract, you can pass constructor arguments.

When working with the test env via cargo odra or when using +Livenet integration this is handled automatically. However, if you rather use +casper-client directly, you have to pass them manually:

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. U512 type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK.

Execution

First thing Odra does with your code, is similar to the one used in OdraVM - +a list of entrypoints is generated, thanks to the #[odra::module] macro.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/backends/livenet/index.html b/docs/docs/0.8.1/backends/livenet/index.html new file mode 100644 index 000000000..8544e1dd9 --- /dev/null +++ b/docs/docs/0.8.1/backends/livenet/index.html @@ -0,0 +1,49 @@ + + + + + +Livenet | Odra + + + + + +
+
Version: 0.8.1

Livenet

The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local +test node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend +to handle the deployment of your contracts to the real blockchain.

Furthermore, it is implemented in a similarly to Casper or OdraVM, +however, it uses a real blockchain to deploy contracts and store the state. +This lets us use Odra to deploy and test contracts on a real blockchain, but +on the other hand, it comes with some limitations on what can be done in the tests.

The main differences between Livenet and e.g. CasperVM backend are:

  • Real CSPR tokens are used to deploy and call contracts. This also means that we need to +pay for each contract deployment and each contract call. Of course, we can use the faucet +to get some tokens for testing purposes, but we still need to specify the amount needed +for each action.
  • The contract state is stored on the real blockchain, so we can't just reset the state - +we can redeploy the contract, but we can't remove the old one.
  • Because of the above, we can load the existing contracts and use them in the tests.
  • We have no control over the block time. This means that for example, advance_block_time function +is implemented by waiting for the real time to pass.

This is also a cause for the fact that the Livenet backend cannot be (yet) used for running +the regular Odra tests. Instead, we can create integration tests or binaries which will +use a slightly different workflow to test the contracts.

Setup

To use Livenet backend, we need to provide Odra with some information - the network address, our private +key and the name of the chain we want to use. Optionally, we can add multiple private keys to use +more than one account in our tests. Those values are passed using environment variables. We can use .env +file to store them - let's take a look at an example .env file, created from the .env.sample file from +examples folder:

# Path to the secret key of the account that will be used
# to deploy the contracts.
# We're using .keys folder so we don't accidentally commit
# the secret key to the repository.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777

# Chain name of the network. Known values:
# - integration-test
ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test

# Paths to the secret keys of the additional accounts.
# Main secret key will be 0th account.
ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem
ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem

With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find +a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. +Let's go through the code:

fn main() {
// Similar to the OdraVM backend, we need to initialize
// the environment:
let env = odra_casper_livenet_env::env();

// Most of the for the host env works the same as in the
// OdraVM backend.
let owner = env.caller();
// Addresses are the real addresses on the blockchain,
// so we need to provide them
// if we did not import their secret keys.
let recipient =
"hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";
let recipient = Address::from_str(recipient).unwrap();

// Arguments for the contract init method.
let name = String::from("Plascoin");
let symbol = String::from("PLS");
let decimals = 10u8;
let initial_supply: U256 = U256::from(10_000);

// The main difference between other backends - we need to specify
// the gas limit for each action.
// The limit will be used for every consecutive action
// until we change it.
env.set_gas(100_000_000_000u64);

// Deploy the contract. The API is the same as in the OdraVM backend.
let init_args = Erc20InitArgs {
name,
symbol,
decimals,
initial_supply: Some(initial_supply)
};
let mut token = Erc20HostRef::deploy(env, init_args);

// We can now use the contract as we would in the OdraVM backend.
println!("Token address: {}", token.address().to_string());

// Uncomment to load existing contract.
// let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
// let address = Address::from_str(address).unwrap();
// We use the Livenet-specific `load` method to load the contract
// that is already deployed.
// let mut token = Erc20Deployer::load(env, address);

// Non-mutable calls are free! Neat, huh? More on that later.
println!("Token name: {}", token.name());

// The next call is mutable, but the cost is lower that the deployment,
// so we change the amount of gas
env.set_gas(3_000_000_000u64);
token.transfer(recipient, U256::from(1000));

println!("Owner's balance: {:?}", token.balance_of(owner));
println!("Recipient's balance: {:?}", token.balance_of(recipient));
}
note

The above example is a rust binary, not a test. Note that it is also added as a section of the +Cargo.toml file:

[bin]
name = "erc20_on_livenet"
path = "src/bin/erc20_on_livenet.rs"
required-features = ["livenet"]
test = false

Usage

To run the above code, we simply need to run the binary with the livenet feature enabled:

cargo run --bin erc20_on_livenet --features=livenet
note

Before executing the binary, make sure you built a wasm file.

A part of a sample output should look like this:

...
💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
💁 INFO : Deploy "65b1a5d21..." successfully executed.
Owner's balance: 4004
Recipient's balance: 4000

Those logs are a result of the last 4 lines of the above listing. +Each deployment or a call to the blockchain will be noted and will take some time to execute. +We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant +and cost us nothing. How it is possible?

info

You can see the deployment on http://cspr.live/ - the transfer from the example +can be seen here.

How Livenet backend works

All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. +It is possible however to query the state of the blockchain for free.

This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the +node is the current state. This is why the balance_of call was almost instant and free.

Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract +(see Cross Calls), it is executed offline and +node is used for the state query only. However, the Livenet needs to know the connection between the contracts +and the code, so make sure to deploy or load already deployed contracts

Multiple enviroments

It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, +multiple nodes or even multiple chains.

To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. +Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file +has to be used first. If your integration.env file has a value that IS present in the .env file, it will +override the value from the .env file.

ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene

To sum up - this command will firstly load the integration.env file and then load the missing values from .env file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/backends/odra-vm/index.html b/docs/docs/0.8.1/backends/odra-vm/index.html new file mode 100644 index 000000000..f8b93bd06 --- /dev/null +++ b/docs/docs/0.8.1/backends/odra-vm/index.html @@ -0,0 +1,26 @@ + + + + + +OdraVM | Odra + + + + + +
+
Version: 0.8.1

OdraVM

The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time - +simply use your IDE's debug functionality.

Usage

The OdraVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

OdraVM consists of two main parts: the Contract Register and the State.

The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address.

Contracts and Test Env functions can modify the State of the OdraVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the OdraVM State holds only the current state of the OdraVM. +Thanks to this and the fact that we do not need the blockchain itself, +OdraVM starts instantly and runs the tests in the native speed.

Execution

When the OdraVM backend is enabled, the #[odra::module] macro is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, OdraVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/backends/what-is-a-backend/index.html b/docs/docs/0.8.1/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..6afdbd7be --- /dev/null +++ b/docs/docs/0.8.1/backends/what-is-a-backend/index.html @@ -0,0 +1,28 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.8.1

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like OdraVM, +a complete virtual machine, spinning up a blockchain for you - like CasperVM, +or even a real blockchain - when using Livenet backend.

Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Host Env

Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/cargo-odra/index.html b/docs/docs/0.8.1/basics/cargo-odra/index.html new file mode 100644 index 000000000..9f244bfbb --- /dev/null +++ b/docs/docs/0.8.1/basics/cargo-odra/index.html @@ -0,0 +1,37 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.8.1

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them with various configurations.

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This creates a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

The third available template is workspace, which creates a workspace with two projects, similar to the one created +with the full template.

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.8.1 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it creates a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This creates a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

The most used command during the development of your project should be this one:

cargo odra test

It runs your tests against Odra's MockVM. It is substantially faster than CasperVM +and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra builds the project, generates the wasm files, +spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat.

Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. +This is why OdraVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build

If the build process finishes successfully, wasm files will be located in wasm folder. +Notice, that this command does not require the -b option.

If you want to build specific contract, you can use -c option:

cargo odra build -c counter # you pass many comma separated contracts

Generating contract schema

If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command:

cargo odra schema 

This generates a schema file in JSON format for all your contracts and places them in the resources folder. +If the resources folder does not exist, it creates the folder for you.

Like with the build command, you can use the -c option to generate a schema for a specific contract.

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/communicating-with-host/index.html b/docs/docs/0.8.1/basics/communicating-with-host/index.html new file mode 100644 index 000000000..63a539e68 --- /dev/null +++ b/docs/docs/0.8.1/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.8.1

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::prelude::*;
use odra::{Address, module::Module, Var};

#[odra::module]
pub struct HostContract {
name: Var<String>,
created_at: Var<u64>,
created_by: Var<Address>
}

#[odra::module]
impl HostContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(self.env().get_block_time());
self.created_by.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are using self.env(). It is an implementation of Module::env(), autogenerated +by #[odra::module] macro. The function returns a reference to the ContractEnv (you can read more in +the Backend section). This is a structure that provides access to the host functions and variables.

In this example, we use two of them:

  • get_block_time() - returns the current block time as u64.
  • caller() - returns an Odra Address of the caller (this can be an external caller or another contract).
info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/cross-calls/index.html b/docs/docs/0.8.1/basics/cross-calls/index.html new file mode 100644 index 000000000..93a5434ee --- /dev/null +++ b/docs/docs/0.8.1/basics/cross-calls/index.html @@ -0,0 +1,22 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.8.1

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::prelude::*;
use odra::{Address, UnwrapOrRevert, Var};

#[odra::module]
pub struct CrossContract {
pub math_engine: Var<Address>
}

#[odra::module]
impl CrossContract {
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine;

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To perform a cross-contact call, we use the {{ModuleName}}ContractRef that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)

Contract Ref

We mentioned HostRef already in our Testing article - a host side reference to already deployed contract.

In the module context we use a ContractRef instead, to call other contracts.

Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, +by the #[odra::module] attribute.

To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above.

The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract.

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call:

examples/src/features/cross_calls.rs
AdderContractRef::new(self.env(), address).add(3, 5)

Loading the contract

Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test +our contracts in Livenet backend. We can load the contract using load method on the Deployer:

examples/bin/erc20_on_livenet.rs
fn _load(env: &HostEnv) -> Erc20HostRef {
let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
let address = Address::from_str(address).unwrap();
<Erc20HostRef as HostRefLoader>::load(env, address)
}

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};
use odra::host::{Deployer, HostRef, NoArgs};

#[test]
fn test_cross_calls() {
let test_env = odra_test::env();
let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);

let init_args = CrossContractInitArgs {
math_engine_address: *math_engine_contract.address()
};
let cross_contract = CrossContractHostRef::deploy(&test_env, init_args);

assert_eq!(cross_contract.add_using_another(), 8);
}
}

Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize.

#[cfg(test)]
mod tests {
use super::*;
use odra::{Address, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_ext() {
let test_env = odra_test::env();
let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)
assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address(test_env: &HostEnv) -> Address {
let contract = MathEngineHostRef::deploy(test_env, NoArgs);
*contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/directory-structure/index.html b/docs/docs/0.8.1/basics/directory-structure/index.html new file mode 100644 index 000000000..63c19cc02 --- /dev/null +++ b/docs/docs/0.8.1/basics/directory-structure/index.html @@ -0,0 +1,26 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.8.1

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── rust-toolchain
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── bin/
| |── build_contract.rs
| └── build_schema.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.1"

[dev-dependencies]
odra-test = "0.8.1"

[[bin]]
name = "sample_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "sample_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also +added as a dev dependency.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

src/

This is the folder where your smart contract files live.

bin/

This is the folder where scripts that will be used to generate code or schemas live. +You don't need to modify those files, they are generated by cargo odra new command and +are used by cargo odra build, cargo odra test and cargo odra schema commands.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/errors/index.html b/docs/docs/0.8.1/basics/errors/index.html new file mode 100644 index 000000000..4725aa70b --- /dev/null +++ b/docs/docs/0.8.1/basics/errors/index.html @@ -0,0 +1,24 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.8.1

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::prelude::*;
use odra::{Address, OdraError, Var};

#[odra::module]
pub struct OwnedContract {
name: Var<String>,
owner: Var<Address>
}

#[derive(OdraError)]
pub enum Error {
OwnerNotSet = 1,
NotAnOwner = 2
}

#[odra::module]
impl OwnedContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = self.env().caller();
if caller != self.owner() {
self.env().revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using the OdraError derive attribute to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
self.env().revert(Error::NotAnOwner)

Defining an error in Odra, you must keep in mind a few rules:

  1. An error should be a field-less enum.
  2. The enum must derive from OdraError.
  3. Avoid implicit discriminants.
note

In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!

Testing errors

Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:

examples/src/features/handling_errors.rs
#[cfg(test)]
mod tests {
use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};
use odra::host::Deployer;
use odra::prelude::*;

#[test]
fn test_owner_error() {
let test_env = odra_test::env();
let owner = test_env.get_account(0);
let not_an_owner = test_env.get_account(1);

test_env.set_caller(owner);
let init_args = OwnedContractInitArgs {
name: "OwnedContract".to_string()
};
let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);

test_env.set_caller(not_an_owner);
assert_eq!(
owned_contract.try_change_name("NewName".to_string()),
Err(Error::NotAnOwner.into())
);
}
}

Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult. +OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and +and safe its safe version: try_name, try_owner, try_change_name.

In our example, we are calling try_change_name and expecting an error to be thrown. +For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, +we need to convert our custom error to OdraError using Into::into().

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/events/index.html b/docs/docs/0.8.1/basics/events/index.html new file mode 100644 index 000000000..f194a02d4 --- /dev/null +++ b/docs/docs/0.8.1/basics/events/index.html @@ -0,0 +1,18 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.8.1

Events

In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:

examples/src/features/events.rs
use odra::prelude::*;
use odra::{Address, Event};

#[odra::module(events = [PartyStarted])]
pub struct PartyContract;

#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64
}

#[odra::module]
impl PartyContract {
pub fn init(&self) {
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, add the #[derive(Event)] attribute like this:

examples/src/features/events.rs
#[derive(Event, PartialEq, Eq, Debug)]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64,
}

To emit an event, we use the emit_event function from the ContractEnv, passing the event as an argument:

examples/src/features/events.rs
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});

To determine all the events at compilation time to register them once the contract is deployed. To register events, add an events attribute to the struct's #[odra::module] attribute.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use super::{PartyContractHostRef, PartyStarted};
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

#[test]
fn test_party() {
let test_env: HostEnv = odra_test::env();
let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);
test_env.emitted_event(
party_contract.address(),
&PartyStarted {
caller: test_env.get_account(0),
block_time: 0
}
);
// If you do not want to check the exact event, you can use `emitted` function
test_env.emitted(party_contract.address(), "PartyStarted");
// You can also check how many events were emitted.
assert_eq!(test_env.events_count(party_contract.address()), 1);
}

To explore more event testing functions, check the HostEnv documentation.

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/flipper-internals/index.html b/docs/docs/0.8.1/basics/flipper-internals/index.html new file mode 100644 index 000000000..1f486f005 --- /dev/null +++ b/docs/docs/0.8.1/basics/flipper-internals/index.html @@ -0,0 +1,38 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.8.1

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Var;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Var, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Var<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the macro - all functions defined there, even marked +with pub will be not callable.

The function named init is the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error. The init function is optional, +if your contract does not need any initialization, you can skip it.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated +by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, +as the second argument of the deploy function, we pass NoArgs - one of the implementations of +the InitArgs trait provided with the framework.

The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/modules/index.html b/docs/docs/0.8.1/basics/modules/index.html new file mode 100644 index 000000000..817892285 --- /dev/null +++ b/docs/docs/0.8.1/basics/modules/index.html @@ -0,0 +1,21 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.8.1

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to the #[odra::module] attribute. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;
use odra::module::SubModule;
use odra::prelude::*;

#[odra::module]
pub struct ModulesContract {
pub math_engine: SubModule<MathEngine>
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}
info

To use a module as a component of another module, you need to use the SubModule type. This is a special type +that crates a keyspace (read more in Storage Layout) and provide access to its public methods.

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the OwnedToken example in the main Odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
#[cfg(test)]
mod tests {
use super::ModulesContractHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);
assert_eq!(modules_contract.add_using_module(), 8);
}
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/native-token/index.html b/docs/docs/0.8.1/basics/native-token/index.html new file mode 100644 index 000000000..46ae16062 --- /dev/null +++ b/docs/docs/0.8.1/basics/native-token/index.html @@ -0,0 +1,25 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.8.1

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::prelude::*;
use odra::casper_types::U512;

#[odra::module]
pub struct PublicWallet;

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {}

pub fn withdraw(&mut self, amount: &U512) {
self.env().transfer_tokens(&self.env().caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/contracts/tlw.rs in the odra main repository.

You can see a new attribute used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from ContractEnv::transfer_tokens(). +It does exactly what you are expecting it to do - it transfers native tokens from the contract to the +specified address.

Testing

To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function - +balance_of:

examples/src/features/native_token.rs
#[cfg(test)]
mod tests {
use super::PublicWalletHostRef;
use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);
assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());

my_contract.with_tokens(U512::from(100)).deposit();
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));

my_contract.withdraw(U512::from(25));
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/odra-toml/index.html b/docs/docs/0.8.1/basics/odra-toml/index.html new file mode 100644 index 000000000..1d94a9c41 --- /dev/null +++ b/docs/docs/0.8.1/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.8.1

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
fqn = "sample::Flipper"

The fqn (Fully Qualified Name) is used by the building tools to locate and build the contract. +The last segment of the fqn will be used as the name for your contract - the generated wasm file will +be in the above case named flipper.wasm.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
fqn = "sample::Flipper"

[[contracts]]
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/storage-interaction/index.html b/docs/docs/0.8.1/basics/storage-interaction/index.html new file mode 100644 index 000000000..eebc61742 --- /dev/null +++ b/docs/docs/0.8.1/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.8.1

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Var

The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Var type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
#[odra::module]
pub struct DogContract {
barks: Var<bool>,
weight: Var<u32>,
name: Var<String>,
walks: Var<Vec<u32>>,
}

You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
use odra::Var;

#[odra::module]
impl DogContract {
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Var is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::{Mapping, Var};

#[odra::module]
pub struct DogContract2 {
name: Var<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Vars section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Var working together:

core/src/list.rs
use odra::{List, Var};

pub struct List<T> {
values: Mapping<u32, T>,
index: Var<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
#[odra::module]
pub struct DogContract3 {
name: Var<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must derive from OdraType:

use odra::{Address, OdraType};

#[derive(OdraType)]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each field of your struct must be an OdraType.

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/basics/testing/index.html b/docs/docs/0.8.1/basics/testing/index.html new file mode 100644 index 000000000..ddc314c7f --- /dev/null +++ b/docs/docs/0.8.1/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.8.1

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{List, Var};

#[cfg(test)]
mod tests {
use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn init_test() {
let test_env = odra_test::env();
let init_args = DogContract3InitArgs {
name: "DogContract".to_string()
};
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The first interesting thing you may notice is placed the import section.

use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

We are using super to import the DogContract3HostRef and DogContract3InitArgs from the parent module. +{{ModuleName}}HostRef and {{ModuleName}}InitArgs are types that was generated for us by Odra.

DogContract3HostRef is a reference to the contract that we can use to interact with it (call entrypoints) +and implements HostRef trait.

DogContract3InitArgs is a struct that we use to initialize the contract and implements InitArgs trait. +Considering the contract initialization, there three possible scenarios:

  1. The contract has a constructor with arguments, then Odra creates a struct named {{ModuleName}}InitArgs.
  2. The contract has a constructor with no arguments, then you can use odra::host::NoArgs.
  3. The contract does not have a constructor, then you can use odra::host::NoArgs. +All of those structs implement the odra::host::InitArgs trait, required to conform to the +Deployer::deploy method signature.

The other import is odra::host::Deployer. This is a trait is used to deploy the contract and give us a reference to it.

Let's take a look at the test itself. How to obtain a reference to the contract? +{{ModuleName}}HostRef implements the Deployer trait, which provides the deploy method:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with the odra::module attribute are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

HostEnv

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};
use odra::{host::{Deployer, HostEnv}, prelude::*};

#[test]
fn env() {
let test_env: HostEnv = odra_test::env();
test_env.set_caller(test_env.get_account(0));
let init_args = TestingContractInitArgs {
name: "MyContract".to_string()
};
let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);
let creator = testing_contract.created_by();
test_env.set_caller(test_env.get_account(1));
let init_args = TestingContractInitArgs {
name: "MyContract2".to_string()
};
let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);
let creator2 = testing_contract2.created_by();
assert_ne!(creator, creator2);
}
}

In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). +Next, we are deploying two instances of the same contract, but we're using HostEnv::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller() +the function we are calling inside the contract.

HostEnv comes with a set of functions that will let you write better tests:

  • fn set_caller(&self, address: Address) - you've seen it in action just now
  • fn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given address
  • fn advance_block_time(&self, time_diff: u64) - increases the current value of block_time
  • fn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; +by default, you start with the 0-th account
  • fn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract

Full list of functions can be found in the HostEnv documentation.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/category/advanced/index.html b/docs/docs/0.8.1/category/advanced/index.html new file mode 100644 index 000000000..f42378b3d --- /dev/null +++ b/docs/docs/0.8.1/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/category/backends/index.html b/docs/docs/0.8.1/category/backends/index.html new file mode 100644 index 000000000..db4b5e75a --- /dev/null +++ b/docs/docs/0.8.1/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/category/basics/index.html b/docs/docs/0.8.1/category/basics/index.html new file mode 100644 index 000000000..7410ba5e1 --- /dev/null +++ b/docs/docs/0.8.1/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/category/examples/index.html b/docs/docs/0.8.1/category/examples/index.html new file mode 100644 index 000000000..adf38f529 --- /dev/null +++ b/docs/docs/0.8.1/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/category/getting-started/index.html b/docs/docs/0.8.1/category/getting-started/index.html new file mode 100644 index 000000000..2c25d4fa0 --- /dev/null +++ b/docs/docs/0.8.1/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/category/migrations/index.html b/docs/docs/0.8.1/category/migrations/index.html new file mode 100644 index 000000000..69a478fa1 --- /dev/null +++ b/docs/docs/0.8.1/category/migrations/index.html @@ -0,0 +1,17 @@ + + + + + +Migrations | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/category/tutorials/index.html b/docs/docs/0.8.1/category/tutorials/index.html new file mode 100644 index 000000000..caf898873 --- /dev/null +++ b/docs/docs/0.8.1/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + +
+
Version: 0.8.1

Tutorials

The theory is good, but the practice is even better. Let's go through a few examples summing up all the Odra concepts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/examples/odra-examples/index.html b/docs/docs/0.8.1/examples/odra-examples/index.html new file mode 100644 index 000000000..da1ed2d7f --- /dev/null +++ b/docs/docs/0.8.1/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.8.1

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/examples/using-odra-modules/index.html b/docs/docs/0.8.1/examples/using-odra-modules/index.html new file mode 100644 index 000000000..423271419 --- /dev/null +++ b/docs/docs/0.8.1/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.8.1

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.1"

[dev-dependencies]
odra-test = "0.8.1"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = "0.8.1"
odra-modules = "0.8.1"

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::prelude::*;
use odra::{Address, casper_types::U256, module::SubModule};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/getting-started/flipper/index.html b/docs/docs/0.8.1/getting-started/flipper/index.html new file mode 100644 index 000000000..71f17f834 --- /dev/null +++ b/docs/docs/0.8.1/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.8.1

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Var;

/// A module definition. Each module struct consists Vars and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor, must be named `init`.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let env = odra_test::env();
let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);
let contract2 = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

Testing

To run the tests, execute the following command:

cargo odra test # or add the `-b casper` flag to run tests on the CasperVM

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/getting-started/installation/index.html b/docs/docs/0.8.1/getting-started/installation/index.html new file mode 100644 index 000000000..1d683846d --- /dev/null +++ b/docs/docs/0.8.1/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.8.1

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra --locked

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called my_project and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/index.html b/docs/docs/0.8.1/index.html new file mode 100644 index 000000000..371ba3674 --- /dev/null +++ b/docs/docs/0.8.1/index.html @@ -0,0 +1,19 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.8.1

Odra framework

Odra is a Rust-based smart contract framework for Casper Network. Odra encourages rapid development and clean, +pragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel.

It's free and open source!

What's next

See the Installation and our Flipper example to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/migrations/to-0.8.0/index.html b/docs/docs/0.8.1/migrations/to-0.8.0/index.html new file mode 100644 index 000000000..8de1518c0 --- /dev/null +++ b/docs/docs/0.8.1/migrations/to-0.8.0/index.html @@ -0,0 +1,19 @@ + + + + + +Migration guide to v0.8.0 | Odra + + + + + +
+
Version: 0.8.1

Migration guide to v0.8.0

Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version.

This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant changes in v0.8.0 include:

  • Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only.
  • Framework internals redesign.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0.

2. Migration Steps

2.1 Add bin directory

Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory.

You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2. Update Cargo.toml

There a bunch of changes in the Cargo.toml file.

  • You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.
  • Register bins you added in the previous step.
  • Add dev-dependencies section with odra-test crate.
  • Add recommended profiles for release and dev to optimize the build process.

Below you can compare the Cargo.toml file after and before the migration to v0.8.0:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

2.2. Update Odra.toml

Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required.

[[contracts]]
fqn = "my_project::Flipper"

2.3. Update Smart Contracts

The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:

2.3.1. Update the use statements to reflect the new module structure.

  • Big integer types are now located in the odra::casper_types module.
  • odra::types::Address is now odra::Address.
  • Variable is now Var.
  • Remove odra::contract_env.
  • Remove odra::types::event::OdraEvent.
  • Remove odra::types::OdraType as it is no longer required.
  • Change odra::types::casper_types::*; to odra::casper_types::*;.

2.3.2. Some type aliases are no longer in use.

  • Balance - use odra::casper_types::U512.
  • BlockTime - use u64.
  • EventData - use odra::casper_types::bytesrepr::Bytes.

2.3.3. Consider import odra::prelude::* in your module files.

2.3.4. Flatten nested Mappings.

// Before
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<Address, Mapping<Address, U256>>
}
// After
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<(Address, Address), U256>
}

2.3.5. Update errors definitions.

execution_error! macro has been replace with OdraError derive macro.

use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.3.6. Update events definitions.

use odra::prelude::*;
use odra::Event;

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

// Emitting the event
self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});

2.3.7. Replace contract_env with self.env() in your modules.

self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes.

  • fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.
  • fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).
  • set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions.
  • fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].
  • fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.
  • fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).
  • fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.
  • functions native_token_metadata() and one_token() have been removed.

2.3.8. Wrap submodules of your module with odra::SubModule<T>.

#[odra::module(events = [Transfer])]
pub struct Erc721Token {
core: SubModule<Erc721Base>,
metadata: SubModule<Erc721MetadataExtension>,
ownable: SubModule<Ownable>
}

2.3.9. Update external contract calls.

However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()).

#[odra::external_contract]
pub trait Token {
fn balance_of(&self, owner: &Address) -> U256;
}

// Usage
TokenContractRef::new(env, token).balance_of(account)

2.3.10. Update constructors.

Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init.

2.3.11. Update UnwrapOrRevert calls.

The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter.

2.3.12. Remove #[odra(using)] attribute from your module definition.

Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required.

2.4. Update Tests

Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:

2.4.1. Contract deployment.

The way you deploy a contract has changed:

  1. You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.
  2. Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.
  3. If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.
  4. If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function.
// A contract without init args
use super::OwnableHostRef;
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

let env: HostEnv = odra_test::env();
let ownable = OwnableHostRef::deploy(&env, NoArgs)

// A contract with init args
use super::{Erc20HostRef, Erc20InitArgs};
use odra::host::{Deployer, HostEnv};

let env: HostEnv = odra_test::env();
let init_args = Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
};
let erc20 = Erc20HostRef::deploy(&env, init_args);

2.4.2. Host interactions.

  1. Replace odra::test_env with odra_test::env().
  2. The API of odra::test_env and odra_test::env() are similar, but there are some differences:
    • test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).
    • test_env::token_balance(Address) is now env.balance_of(&Address).
    • functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef.

2.4.3. Testing failing scenarios.

test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result. +try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro.

#[test]
fn transfer_from_error() {
let (env, mut erc20) = setup();

let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

assert_eq!(
erc20.try_transfer_from(owner, recipient, amount),
Err(Error::InsufficientAllowance.into())
);
}

2.4.4. Testing events.

assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. +The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options.

let env: HostEnv = odra_test::env();
let erc20 = Erc20HostRef::deploy(&env, init_args);

...

assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.8.0.

src/erc20.rs
use crate::erc20::errors::Error::*;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address, Event};

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
use super::{
errors::Error,
events::{Approval, Transfer},
Erc20HostRef, Erc20InitArgs
};
use odra::{
casper_types::U256,
host::{Deployer, HostEnv, HostRef},
prelude::*
};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

// Other tests...
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/tutorials/access-control/index.html b/docs/docs/0.8.1/tutorials/access-control/index.html new file mode 100644 index 000000000..47e451776 --- /dev/null +++ b/docs/docs/0.8.1/tutorials/access-control/index.html @@ -0,0 +1,17 @@ + + + + + +Access Control | Odra + + + + + +
+
Version: 0.8.1

Access Control

In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,

In this article we design and implement a more fine-grained access control layer.

Code

Before we start writing code, we list the functionalities of our access control layer.

  1. A Role type is used across the module.
  2. A Role can be assigned to many Addresses.
  3. Each Role may have a corresponding admin role.
  4. Only an admin can grant/revoke a Role.
  5. A Role can be renounced.
  6. A Role cannot be renounced on someone's behalf.
  7. Each action triggers an event.
  8. Unauthorized access stops contract execution.

Project Structure

access-control
├── src
│ ├── access
│ │ ├── access_control.rs
│ │ ├── events.rs
│ │ └── errors.rs
│ └── lib.rs
|── build.rs
|── Cargo.toml
└── Odra.toml

Events and Errors

There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions.

events.rs
use odra::prelude::*;
use odra::{Address, Event};
use super::access_control::Role;

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleGranted {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleRevoked {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct RoleAdminChanged {
pub role: Role,
pub previous_admin_role: Role,
pub new_admin_role: Role
}
  • L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.
  • L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role.
errors.rs
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
MissingRole = 20_000,
RoleRenounceForAnotherAddress = 20_001,
}

Errors definition is straightforward - there are only two invalid states:

  1. An action is triggered by an unauthorized actor.
  2. The caller is attempting to resign the Role on someone's behalf.

Module

Now, we are stepping into the most interesting part: the module definition and implementation.

access_control.rs
use super::events::*;
use super::errors::Error;
use odra::prelude::*;
use odra::{module::Module, Address, Mapping};

pub type Role = [u8; 32];

pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];

#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]
pub struct AccessControl {
roles: Mapping<(Role, Address), bool>,
role_admin: Mapping<Role, Role>
}

#[odra::module]
impl AccessControl {
pub fn has_role(&self, role: &Role, address: &Address) -> bool {
self.roles.get_or_default(&(*role, *address))
}

pub fn get_role_admin(&self, role: &Role) -> Role {
let admin_role = self.role_admin.get(role);
if let Some(admin) = admin_role {
admin
} else {
DEFAULT_ADMIN_ROLE
}
}

pub fn grant_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_grant_role(role, address);
}

pub fn revoke_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_revoke_role(role, address);
}

pub fn renounce_role(&mut self, role: &Role, address: &Address) {
if address != &self.env().caller() {
self.env().revert(Error::RoleRenounceForAnotherAddress);
}
self.unchecked_revoke_role(role, address);
}
}

impl AccessControl {
pub fn check_role(&self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.env().revert(Error::MissingRole);
}
}

pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {
let previous_admin_role = self.get_role_admin(role);
self.role_admin.set(role, *admin_role);
self.env().emit_event(RoleAdminChanged {
role: *role,
previous_admin_role,
new_admin_role: *admin_role
});
}

pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.roles.set(&(*role, *address), true);
self.env().emit_event(RoleGranted {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}

pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {
if self.has_role(role, address) {
self.roles.set(&(*role, *address), false);
self.env().emit_event(RoleRevoked {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}
}
  • L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.
  • L8 - The default role is an array filled with zeros.
  • L10-L13 - The storage consists of two mappings:
  1. roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.
  2. role_admin - each Role can have a single admin Role.
  • L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.
  • L49 - This is a non-exported block containing helper functions.
  • L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.
  • L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.
  • L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).
  • L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.
  • L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access.
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/tutorials/build-deploy-read/index.html b/docs/docs/0.8.1/tutorials/build-deploy-read/index.html new file mode 100644 index 000000000..520b9972e --- /dev/null +++ b/docs/docs/0.8.1/tutorials/build-deploy-read/index.html @@ -0,0 +1,17 @@ + + + + + +Build, Deploy and Read the State of a Contract | Odra + + + + + +
+
Version: 0.8.1

Build, Deploy and Read the State of a Contract

In this guide, we will show the full path from creating a contract, deploying it and reading the state.

We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript.

Before you start, make sure you completed the following steps:

Contract

Let's write a contract with complex storage layout.

The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping.

We will expose two methods:

  1. The constructor init which sets the metadata and the version of the contract.
  2. The method set_data which sets the value of the numeric field and the values of the mapping.
custom_item.rs
use odra::{casper_types::U256, prelude::*, Mapping, OdraType, SubModule, Var};

// A custom type with a vector of another custom type
#[derive(OdraType, Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(OdraType, Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

// The main contract with a version, metadata and a submodule
#[odra::module]
pub struct CustomItem {
version: Var<u32>,
meta: Var<Metadata>,
data: SubModule<Data>
}

#[odra::module]
impl CustomItem {
pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {
let meta = Metadata {
name,
description,
prices: vec![
Price { value: price_1 },
Price { value: price_2 }
]
};
self.meta.set(meta);
self.version.set(self.version.get_or_default() + 1);
}

pub fn set_data(&mut self, value: u32, name: String, name2: String) {
self.data.value.set(value);
self.data.inner.named_values.set(&name, 10);
self.data.inner.named_values.set(&name2, 20);
}
}

// A submodule with a numeric value and another submodule
#[odra::module]
struct Data {
value: Var<u32>,
inner: SubModule<InnerData>,
}

// A submodule with a mapping
#[odra::module]
struct InnerData {
named_values: Mapping<String, u32>,
}

Deploying the contract

First, we need to setup the chain. We will use the NCTL docker image to run a local network.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Next, we need to compile the contract to a Wasm file.

cargo odra build -c custom_item 

Then, we can deploy the contract using the casper-client tool.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key path/to/your/secret_key.pem \
--session-path [PATH_TO_WASM] \
--payment-amount 100000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \
--session-arg "name:string='My Name'" \
--session-arg "description:string='My Description'" \
--session-arg "price_1:u256='101'" \
--session-arg "price_2:u256='202'"

Finally, we can call the set_data method to set the values of the contract.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key ./keys/secret_key.pem \
--payment-amount 2000000000 \
--session-hash [DEPLOYED_CONTRACT_HASH] \
--session-entry-point "set_data" \
--session-arg "value:u32:'666'" \
--session-arg "name:string='alice'" \
--session-arg "name2:string='bob'"

Storage Layout

To read the state of the contract, we need to understand the storage layout.

The first step is to calculate the index of the keys.

Storage Layout

CustomItem: prefix: 0x0..._0000_0000_0000 0
version: u32, 0x0..._0000_0000_0000 0
meta: Metadata, 0x0..._0000_0000_0001 1
data: Data: prefix: 0x0..._0000_0010_0000 (2 << 4)
value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0
inner: InnerData: prefix: 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4
named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0

The actual key is obtained as follows:

  1. Convert the index to a big-endian byte array.
  2. Concatenate the index with the mapping data.
  3. Hash the concatenated bytes using blake2b.
  4. Return the hex representation of the hash (the stored key must be utf-8 encoded).

In more detail, the storage layout is described in the Storage Layout article.

Reading the state

main.rs
use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};
use casper_types::{
bytesrepr::{FromBytes, ToBytes},
U256,
};

// replace with your contract hash
const CONTRACT_HASH: &str = "hash-...";
const NODE_ADDRESS: &str = "http://localhost:11101/rpc";
const RPC_ID: &str = "casper-net-1";
const DICTIONARY_NAME: &str = "state";

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

async fn read_state_key(key: String) -> Vec<u8> {
let state_root_hash = casper_client::get_state_root_hash(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
None,
)
.await
.unwrap()
.result
.state_root_hash
.unwrap();

// Read the value from the `state` dictionary.
let result = casper_client::get_dictionary_item(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
state_root_hash,
DictionaryItemIdentifier::ContractNamedKey {
key: CONTRACT_HASH.to_string(),
dictionary_name: DICTIONARY_NAME.to_string(),
dictionary_item_key: key,
},
)
.await
.unwrap()
.result
.stored_value;

// We expect the value to be a CLValue
if let StoredValue::CLValue(cl_value) = result {
// Ignore the first 4 bytes, which are the length of the CLType.
cl_value.inner_bytes()[4..].to_vec()
} else {
vec![]
}
}

async fn metadata() -> Metadata {
// The key for the metadata is 1, and it has no mapping data
let key = key(1, &[]);
let bytes = read_state_key(key).await;

// Read the name and store the remaining bytes
let (name, bytes) = String::from_bytes(&bytes).unwrap();
// Read the description and store the remaining bytes
let (description, bytes) = String::from_bytes(&bytes).unwrap();
// A vector is stored as a u32 size followed by the elements
// Read the size of the vector and store the remaining bytes
let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();

let mut prices = vec![];
// As we know the size of the vector, we can loop over it
for _ in 0..size {
// Read the value and store the remaining bytes
let (value, rem) = U256::from_bytes(&bytes).unwrap();
bytes = rem;
prices.push(Price { value });
}
// Anytime you finish parsing a value, you should check if there are any remaining bytes
// if there are, it means you have a bug in your parsing logic.
// For simplicity, we will ignore the remaining bytes here.
Metadata {
name,
description,
prices
}
}

async fn value() -> u32 {
// The key for the value is (2 << 4) + 0, and it has no mapping data
let key = key(2 << 4, &[]);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

async fn named_value(name: &str) -> u32 {
// The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes
let mapping_data = name.to_bytes().unwrap();
let key = key(((2 << 4) + 1) << 4, &mapping_data);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

fn main() {
let runtime = tokio::runtime::Runtime::new().unwrap();
dbg!(runtime.block_on(metadata()));
dbg!(runtime.block_on(value()));
dbg!(runtime.block_on(named_value("alice")));
dbg!(runtime.block_on(named_value("bob")));
}

// The key is a combination of the index and the mapping data
// The algorithm is as follows:
// 1. Convert the index to a big-endian byte array
// 2. Concatenate the index with the mapping data
// 3. Hash the concatenated bytes using blake2b
// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)
fn key(idx: u32, mapping_data: &[u8]) -> String {
let mut key = Vec::new();
key.extend_from_slice(idx.to_be_bytes().as_ref());
key.extend_from_slice(mapping_data);
let hashed_key = blake2b(&key);

hex::encode(&hashed_key)
}

fn blake2b(bytes: &[u8]) -> [u8; 32] {
let mut result = [0u8; 32];
let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32)
.expect("should create hasher");
let _ = std::io::Write::write(&mut hasher, bytes);
blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)
.expect("should copy hash to the result array");
result
}

cargo run
[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {
name: "My Contract",
description: "My Description",
prices: [
Price {
value: 123,
},
Price {
value: 321,
},
],
}
[src/main.rs:117:5] runtime.block_on(value()) = 666
[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20
[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10
+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/tutorials/erc20/index.html b/docs/docs/0.8.1/tutorials/erc20/index.html new file mode 100644 index 000000000..32b4e9489 --- /dev/null +++ b/docs/docs/0.8.1/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.8.1

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • Advanced storage using key-value pairs,
  • Odra types such as Address,
  • Advanced event assertion.

Code

Our module features a considerably more complex storage layout compared to the previous example.

It is designed to store the following data:

  1. Immutable metadata - name, symbol, and decimals.
  2. Total supply.
  3. Balances of individual users.
  4. Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.

Module definition

erc20.rs
use odra::prelude::*;
use odra::{Address, casper_types::U256, Mapping, Var};

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}
  • L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.
  • L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys.

Metadata

erc20.rs
...
use odra::Event;

...

#[odra::module]
impl Erc20 {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let caller = self.env().caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, &initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &U256) {
self.balances.add(address, *amount);
self.total_supply.add(*amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}
  • L6 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L8-L14 - A constructor sets the token metadata and mints the initial supply.
  • L33 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.
  • L34-L43 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for:
use odra::UnwrapOrRevert;

let current_balance = self.balances.get(address).unwrap_or_default();
let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());
self.balances.set(address, new_balance);

Core

To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks.

erc20.rs
...
use odra::OdraError;

#[odra::module]
impl Erc20 {
...

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();
self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
self.env().revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowance(owner, spender);
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.set(&(*owner, *spender), new_allowance);
self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 1,
InsufficientAllowance = 2,
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::*;
use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: INITIAL_SUPPLY.into()
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

#[test]
fn transfer_from_and_approval_work() {
let (env, mut erc20) = setup();

let (owner, recipient, spender) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount
}
));

// Spender transfers tokens from Owner to Recipient.
env.set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));
// assert!(env.emitted(erc20.address(), "Transfer"));
}

#[test]
fn transfer_from_error() {
// Given a new instance.
let (env, mut erc20) = setup();

// When the spender's allowance is zero.
let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

// Then transfer fails.
assert_eq!(
erc20.try_transfer_from(&owner, &recipient, &amount),
Err(Error::InsufficientAllowance.into())
);
}
}
  • L146 - Alternatively, if you don't want to check the entire event, you may assert only its type.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/tutorials/ownable/index.html b/docs/docs/0.8.1/tutorials/ownable/index.html new file mode 100644 index 000000000..e6319d40a --- /dev/null +++ b/docs/docs/0.8.1/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.8.1

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining a constructor,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

ownable.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(events = [OwnershipChanged])]
pub struct Ownable {
owner: Var<Option<Address>>
}

That was easy, but it is crucial to understand the basics before we move on.

  • L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.
  • L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var.

Init the module

ownable.rs
...
use odra::{Event, OdraError};

...

#[odra::module]
impl Ownable {
pub fn init(&mut self, owner: Address) {
if self.owner.get_or_default().is_some() {
self.env().revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(Some(owner));

self.env().emit_event(OwnershipChanged {
prev_owner: None,
new_owner: owner
});
}
}

#[derive(OdraError)]
pub enum Error {
OwnerIsAlreadyInitialized = 1,
}

#[derive(Event, Debug, PartialEq, Eq)]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L7 - The impl should be an Odra module, so add #[odra::module].
  • L9 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.
  • L23-26 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the OdraError derive macro is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.
  • L10-L12 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument.
  • L14 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.
  • L28-L32 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.
  • L16 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None.

Features implementation

ownable.rs
#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get_or_default().as_ref() {
self.env().revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&self.env().caller());
let current_owner = self.get_owner();
self.owner.set(Some(*new_owner));
self.env().emit_event(OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
});
}

pub fn get_owner(&self) -> Address {
match self.owner.get_or_default() {
Some(owner) => owner,
None => self.env().revert(Error::OwnerIsNotInitialized)
}
}
}

#[derive(OdraError)]
pub enum Error {
NotOwner = 1,
OwnerIsAlreadyInitialized = 2,
OwnerIsNotInitialized = 3,
}

The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along.

  • L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.
  • L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.
  • L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead.

Test

ownable.rs
#[cfg(test)]
mod tests {
use super::*;
use odra::host::{Deployer, HostEnv, HostRef};

fn setup() -> (OwnableHostRef, HostEnv, Address) {
let env: HostEnv = odra_test::env();
let init_args = OwnableInitArgs {
owner: env.get_account(0)
};
(OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))
}

#[test]
fn initialization_works() {
let (ownable, env, owner) = setup();
assert_eq!(ownable.get_owner(), owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (mut ownable, env, owner) = setup();
let new_owner = env.get_account(1);

env.set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (mut ownable, env, _) = setup();
let new_owner = env.get_account(1);
ownable.change_ownership(&new_owner);

assert_eq!(
ownable.try_change_ownership(&new_owner),
Err(Error::NotOwner.into())
);
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.
  • L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one).
  • L14 - It is time to define the first test. As you see, it is a regular Rust test.
  • L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.
  • L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.
  • L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/tutorials/owned-token/index.html b/docs/docs/0.8.1/tutorials/owned-token/index.html new file mode 100644 index 000000000..32fc2bbb8 --- /dev/null +++ b/docs/docs/0.8.1/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.8.1

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow only the module owner to mint tokens.
  3. Enable the current owner to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};
use odra::prelude::*;
use odra::module::SubModule;

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
...
use odra::{Address, casper_types::U256};
...

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.ownable.ensure_ownership(&self.env().caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L9-L10 - A constructor is an excellent place to initialize both modules at once.
  • L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.
  • L49-L51 - The same is done with the ownable module.
  • L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.8.1/tutorials/pauseable/index.html b/docs/docs/0.8.1/tutorials/pauseable/index.html new file mode 100644 index 000000000..a13d18667 --- /dev/null +++ b/docs/docs/0.8.1/tutorials/pauseable/index.html @@ -0,0 +1,17 @@ + + + + + +Pausable | Odra + + + + + +
+
Version: 0.8.1

Pausable

The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.

Code

As always, we will start with defining functionalities of our module.

  1. Check the state - is it paused or not.
  2. State guards - a contract should stop execution if is in a state we don't expect.
  3. Switch the state.

Events and Error

There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way.

Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser.

pauseable.rs
use odra::prelude::*;
use odra::{Address, Event, OdraError};

#[derive(OdraError)]
pub enum Error {
PausedRequired = 1_000,
UnpausedRequired = 1_001,
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Paused {
pub account: Address
}

#[derive(Event, PartialEq, Eq, Debug)]
pub struct Unpaused {
pub account: Address
}

Module definition

The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused.

pauseable.rs
use odra::Var;
...

#[odra::module(events = [Paused, Unpaused])]
pub struct Pausable {
is_paused: Var<bool>
}

Checks and guards

Now, let's move to state checks and guards.

pauseable.rs
impl Pausable {
pub fn is_paused(&self) -> bool {
self.is_paused.get_or_default()
}

pub fn require_not_paused(&self) {
if self.is_paused() {
self.env().revert(Error::UnpausedRequired);
}
}

pub fn require_paused(&self) {
if !self.is_paused() {
self.env().revert(Error::PausedRequired);
}
}
}
  • L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.
  • L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.
  • L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused.
  • L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused.

Actions

Finally, we will add the ability to switch the module state.

pauseable.rs
impl Pausable {
pub fn pause(&mut self) {
self.require_not_paused();
self.is_paused.set(true);

self.env().emit_event(Paused {
account: self.env().caller()
});
}

pub fn unpause(&mut self) {
self.require_paused();
self.is_paused.set(false);

self.env().emit_event(Unpaused {
account: self.env().caller()
});
}
}

pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused).

Pausable counter

In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused).

pauseable.rs
...
use odra::SubModule;
...

#[odra::module]
pub struct PausableCounter {
value: Var<u32>,
pauseable: SubModule<Pausable>
}

#[odra::module]
impl PausableCounter {
pub fn increment(&mut self) {
self.pauseable.require_not_paused();

let new_value = self.value.get_or_default() + 1;
self.value.set(new_value);
}

pub fn pause(&mut self) {
self.pauseable.pause();
}

pub fn unpause(&mut self) {
self.pauseable.unpause();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::host::{Deployer, NoArgs};

#[test]
fn increment_only_if_unpaused() {
let test_env = odra_test::env();
let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);
contract.increment();
contract.pause();

assert_eq!(
contract.try_increment().unwrap_err(),
Error::UnpausedRequired.into()
);
assert_eq!(contract.get_value(), 1);
}
}

As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/advanced/advanced-storage/index.html b/docs/docs/0.9.0/advanced/advanced-storage/index.html new file mode 100644 index 000000000..e2fb9806b --- /dev/null +++ b/docs/docs/0.9.0/advanced/advanced-storage/index.html @@ -0,0 +1,18 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.9.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values.

Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + ToBytes + FromBytes + CLTyped
{
value: Var<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, a Mapping is a key-value storage system where the key is associated with a value. +In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute.

However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{casper_types::U256, Mapping, UnwrapOrRevert};
use odra::prelude::*;
use crate::owned_token::OwnedToken;

#[odra::module]
pub struct Mappings {
strings: Mapping<(String, u32, String), String>,
tokens: Mapping<String, OwnedToken>
}

#[odra::module]
impl Mappings {

...

pub fn total_supply(&mut self, token_name: String) -> U256 {
self.tokens.module(&token_name).total_supply()
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let opt_string = self.strings.get(&(key1, key2, key3));
opt_string.unwrap_or_revert(&self.env())
}
}

As you can see, a Mapping key can consist of a tuple of values, not limited to a single value.

note

Accessing Odra modules differs from accessing regular values such as strings or numbers.

Firstly, within a Mapping, you don't encapsulate the module with Submodule.

Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Address, casper_types::U512, Sequence, Mapping};
use odra::prelude::*;
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
counter: Sequence<u32>,
tokens: Mapping<(String, String), Token>,
}

impl AdvancedStorage {
pub fn current_value(&self) -> u32 {
self.counter.get_current_value()
}

pub fn increment_and_get(&mut self) -> u32 {
self.counter.next_value()
}

pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {
let token = self.tokens.module(&(token_name, creator));
token.balance_of(&address)
}

pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {
let mut token = self.tokens.module(&(token_name, creator));
token.mint(amount, to);
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:

  1. Odra offers a Sequence module, enabling contracts to store and increment a single value.
  2. Mappings support composite keys expressed as tuples and can store modules as values.

Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/advanced/attributes/index.html b/docs/docs/0.9.0/advanced/attributes/index.html new file mode 100644 index 000000000..e7b600b21 --- /dev/null +++ b/docs/docs/0.9.0/advanced/attributes/index.html @@ -0,0 +1,20 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.9.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that +allows developers to embed common checks into function definitions in a readable and reusable manner. +These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U256 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env.revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env()
.emit_event(Deposit {
address: caller,
amount
});
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Example

#[odra::module]
pub struct NonReentrantCounter {
counter: Var<u32>
}

#[odra::module]
impl NonReentrantCounter {
#[odra(non_reentrant)]
pub fn count_ref_recursive(&mut self, n: u32) {
if n > 0 {
self.count();
ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);
}
}
}

impl NonReentrantCounter {
fn count(&mut self) {
let c = self.counter.get_or_default();
self.counter.set(c + 1);
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::{host::{Deployer, NoArgs}, ExecutionError};

#[test]
fn ref_recursion_not_allowed() {
let test_env = odra_test::env();
let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);

let result = contract.count_ref_recursive(11);
assert_eq!(result, ExecutionError::ReentrantCall.into());
}
}

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/advanced/building-manually/index.html b/docs/docs/0.9.0/advanced/building-manually/index.html new file mode 100644 index 000000000..efc1216d6 --- /dev/null +++ b/docs/docs/0.9.0/advanced/building-manually/index.html @@ -0,0 +1,28 @@ + + + + + +Building contracts manually | Odra + + + + + +
+
Version: 0.9.0

Building contracts manually

cargo odra is a great tool to build and test your contracts, but sometimes +a better control over the parameters that are passed to the cargo +or the compiler is needed.

This is especially useful when the project has multiple features, and there is a need +to switch between them during the building and testing.

Knowing that cargo odra is a simple wrapper around cargo, it is easy to replicate +the same behavior by using cargo directly.

Building the contract manually

To build the contract manually, cargo odra uses the following command:

ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract
info

Odra uses the environment variable ODRA_MODULE to determine which contract to build.

Assuming that project's crate is named my_project, this command will build +the my_contract contract in release mode and generate the wasm file. +The file will be put into the target/wasm32-unknown-unknown/release directory under +the name my_project_build_contract.wasm.

The Odra Framework expects the contracts to be placed in the wasm directory, and +to be named correctly, so the next step would be to move the file:

mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm

Optimizing the contract

To lower the size of the wasm file, cargo odra uses the wasm-strip tool:

wasm-strip wasm/my_contract.wasm

To further optimize the wasm file, the wasm-opt tool is also used.

wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
danger

This step is required, as the wasm file generated by the Rust compiler is not +fully compatible with the Casper execution engine.

Running the tests manually

To run the tests manually, Odra needs to know which backend to use. +To run tests agains Casper backend, the following command needs to be used:

ODRA_BACKEND=casper cargo test

Wrapping up

Let's say we want to build the my_contract in debug mode, run the tests against the +casper backend and use the my-own-allocator feature from our my_project project.

To do that, we can use the following set of commands:

ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract
mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm
wasm-strip wasm/my_contract.wasm
wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
ODRA_BACKEND=casper cargo test --features my-own-allocator
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/advanced/delegate/index.html b/docs/docs/0.9.0/advanced/delegate/index.html new file mode 100644 index 000000000..02f9b649c --- /dev/null +++ b/docs/docs/0.9.0/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.9.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use crate::{erc20::Erc20, ownable::Ownable};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
fn approve(&mut self, spender: Address, amount: U256);
fn name(&self) -> String;
fn symbol(&self) -> String;
fn decimals(&self) -> u8;
fn total_supply(&self) -> U256;
fn balance_of(&self, owner: Address) -> U256;
fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct DeFiPlatform {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>,
exchange: SubModule<Exchange>
}

#[odra::module]
impl DeFiPlatform {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
}

to self.exchange {
fn swap(&mut self, sender: Address, recipient: Address);
fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/advanced/storage-layout/index.html b/docs/docs/0.9.0/advanced/storage-layout/index.html new file mode 100644 index 000000000..5fc1391aa --- /dev/null +++ b/docs/docs/0.9.0/advanced/storage-layout/index.html @@ -0,0 +1,44 @@ + + + + + +Storage Layout | Odra + + + + + +
+
Version: 0.9.0

Storage Layout

Odra's innovative modular design necessitates a unique storage layout. This +article explains step-by-step Odra's storage layout.

Casper VM Perspective

The Casper Execution Engine (VM) enables the storage of data in named keys or +dictionaries. However, a smart contract has a limited number of named keys, +making it unsuitable for storing substantial data volumes. Odra resolves this +issue by storing all user-generated data in a dictionary called state. This +dictionary operates as a key-value store, where keys are strings with a maximum +length of 64 characters, and values are arbitrary byte arrays.

Here is an example of what the interface for reading and writing data could look +like:

pub trait CasperStorage {
fn read(key: &str) -> Option<Vec<u8>>;
fn write(key: &str, value: Vec<u8>);
}

Odra Perspective

Odra was conceived with modularity and code reusability in mind. Additionally, +we aimed to streamline storage definition through the struct object. Consider +this straightforward storage definition:

#[odra::module]
pub struct Token {
name: Var<String>,
balances: Mapping<Address, U256>
}

The Token structure contains two fields: name of type String and +balances, which functions as a key-value store with Address as keys and +U256 as values.

The Token module can be reused in another module, as demonstrated in a more +complex example:

#[odra::module]
pub struct Loans {
lenders: SubModule<Token>,
borrowers: SubModule<Token>,
}

The Loans module has two fields: lenders and borrowers, both of which have +the same storage layout as defined by the Token module. Odra guarantees that +lenders and borrowers are stored under distinct keys within the storage +dictionary.

Both Token and Loans serve as examples to show how Odra's storage layout +operates.

Key generation.

Every element of a module (struct) with N elements is associated with an index +ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an +element of a module is another module (SubModule<...>), the associated index +serves as a prefix for the indexes of the inner module.

While this may initially appear complex, it is easily understood through an +example. In the example, indexes are presented as bytes, reflecting the actual +implementation.

Loans {
lenders: Token { // prefix: 0x0000
name: 0, // key: 0x0000_0000
balances: 1 // key: 0x0000_0001
},
borrowers: Token { // prefix: 0x0001
name: 0, // key: 0x0001_0000
balances: 1 // key: 0x0001_0001
}
}

Additionally, it's worth mentioning how Mapping's keys are used in the +storage. They are simply concatenated with the index of the module, as +demonstrated in the example.

For instance, triggering borrowers.balances.get(0x1234abcd) would result in a +key:

0x0001_0001_1234_abcd

Finally, the key must be hashed to fit within the 64-character limit and then +encoded in hexadecimal format.

Value serialization

Before being stored in the storage, each value is serialized into bytes using +the CLType serialization method and subsequently encapsulated with Casper's +Bytes types.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/advanced/using-different-allocator/index.html b/docs/docs/0.9.0/advanced/using-different-allocator/index.html new file mode 100644 index 000000000..f86236466 --- /dev/null +++ b/docs/docs/0.9.0/advanced/using-different-allocator/index.html @@ -0,0 +1,25 @@ + + + + + +Memory allocators | Odra + + + + + +
+
Version: 0.9.0

Memory allocators

When compiling contracts to wasm, your code needs to be no-std. +This means that instead of using the standard library, the core +crate will be linked to your code. This crate does not contain +a memory allocator.

Happily, Odra automatically enables allocator - from our tests +the one developed by ink! +seems to be the best.

Using a different allocator

If the default allocator does not suit your needs, or you use a crate that +already provides an allocator, you can disable the default allocator by enabling +the disable-allocator feature in the odra dependency in your project:

[dependencies]
odra = { path = "../odra", features = ["disable-allocator"] }

If you want to have a better control over the features that are enabled +during the building and tests, see the next article on building manually.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/backends/casper/index.html b/docs/docs/0.9.0/backends/casper/index.html new file mode 100644 index 000000000..142df0686 --- /dev/null +++ b/docs/docs/0.9.0/backends/casper/index.html @@ -0,0 +1,50 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.9.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event].

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling self.env().attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, +you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Deploying a contract to Casper network

There would be no point in writing a contract if you couldn't deploy it to the blockchain. +You can do it in two ways: provided by the Casper itself: using the casper-client tool +or using the Odra's Livenet integration.

Let's explore the first option to better understand the process.

note

If you wish, you can skip the following section and jump to the Livenet integration.

WASM arguments

When deploying a new contract you can pass some arguments to it. +Every contract written in Odra expects those arguments to be set:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Additionally, if required by the contract, you can pass constructor arguments.

When working with the test env via cargo odra or when using +Livenet integration this is handled automatically. However, if you rather use +casper-client directly, you have to pass them manually:

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. U512 type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK.

Execution

First thing Odra does with your code, is similar to the one used in OdraVM - +a list of entrypoints is generated, thanks to the #[odra::module] attribute.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/backends/livenet/index.html b/docs/docs/0.9.0/backends/livenet/index.html new file mode 100644 index 000000000..1e768039b --- /dev/null +++ b/docs/docs/0.9.0/backends/livenet/index.html @@ -0,0 +1,49 @@ + + + + + +Livenet | Odra + + + + + +
+
Version: 0.9.0

Livenet

The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local +test node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend +to handle the deployment of your contracts to the real blockchain.

Furthermore, it is implemented in a similarly to Casper or OdraVM, +however, it uses a real blockchain to deploy contracts and store the state. +This lets us use Odra to deploy and test contracts on a real blockchain, but +on the other hand, it comes with some limitations on what can be done in the tests.

The main differences between Livenet and e.g. CasperVM backend are:

  • Real CSPR tokens are used to deploy and call contracts. This also means that we need to +pay for each contract deployment and each contract call. Of course, we can use the faucet +to get some tokens for testing purposes, but we still need to specify the amount needed +for each action.
  • The contract state is stored on the real blockchain, so we can't just reset the state - +we can redeploy the contract, but we can't remove the old one.
  • Because of the above, we can load the existing contracts and use them in the tests.
  • We have no control over the block time. This means that for example, advance_block_time function +is implemented by waiting for the real time to pass.

This is also a cause for the fact that the Livenet backend cannot be (yet) used for running +the regular Odra tests. Instead, we can create integration tests or binaries which will +use a slightly different workflow to test the contracts.

Setup

To use Livenet backend, we need to provide Odra with some information - the network address, our private +key and the name of the chain we want to use. Optionally, we can add multiple private keys to use +more than one account in our tests. Those values are passed using environment variables. We can use .env +file to store them - let's take a look at an example .env file, created from the .env.sample file from +examples folder:

# Path to the secret key of the account that will be used
# to deploy the contracts.
# We're using .keys folder so we don't accidentally commit
# the secret key to the repository.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777

# Chain name of the network. Known values:
# - integration-test
ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test

# Paths to the secret keys of the additional accounts.
# Main secret key will be 0th account.
ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem
ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem

With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find +a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. +Let's go through the code:

fn main() {
// Similar to the OdraVM backend, we need to initialize
// the environment:
let env = odra_casper_livenet_env::env();

// Most of the for the host env works the same as in the
// OdraVM backend.
let owner = env.caller();
// Addresses are the real addresses on the blockchain,
// so we need to provide them
// if we did not import their secret keys.
let recipient =
"hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";
let recipient = Address::from_str(recipient).unwrap();

// Arguments for the contract init method.
let name = String::from("Plascoin");
let symbol = String::from("PLS");
let decimals = 10u8;
let initial_supply: U256 = U256::from(10_000);

// The main difference between other backends - we need to specify
// the gas limit for each action.
// The limit will be used for every consecutive action
// until we change it.
env.set_gas(100_000_000_000u64);

// Deploy the contract. The API is the same as in the OdraVM backend.
let init_args = Erc20InitArgs {
name,
symbol,
decimals,
initial_supply: Some(initial_supply)
};
let mut token = Erc20HostRef::deploy(env, init_args);

// We can now use the contract as we would in the OdraVM backend.
println!("Token address: {}", token.address().to_string());

// Uncomment to load existing contract.
// let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
// let address = Address::from_str(address).unwrap();
// We use the Livenet-specific `load` method to load the contract
// that is already deployed.
// let mut token = Erc20Deployer::load(env, address);

// Non-mutable calls are free! Neat, huh? More on that later.
println!("Token name: {}", token.name());

// The next call is mutable, but the cost is lower that the deployment,
// so we change the amount of gas
env.set_gas(3_000_000_000u64);
token.transfer(recipient, U256::from(1000));

println!("Owner's balance: {:?}", token.balance_of(owner));
println!("Recipient's balance: {:?}", token.balance_of(recipient));
}
note

The above example is a rust binary, not a test. Note that it is also added as a section of the +Cargo.toml file:

[bin]
name = "erc20_on_livenet"
path = "src/bin/erc20_on_livenet.rs"
required-features = ["livenet"]
test = false

Usage

To run the above code, we simply need to run the binary with the livenet feature enabled:

cargo run --bin erc20_on_livenet --features=livenet
note

Before executing the binary, make sure you built a wasm file.

A part of a sample output should look like this:

...
💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
💁 INFO : Deploy "65b1a5d21..." successfully executed.
Owner's balance: 4004
Recipient's balance: 4000

Those logs are a result of the last 4 lines of the above listing. +Each deployment or a call to the blockchain will be noted and will take some time to execute. +We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant +and cost us nothing. How it is possible?

info

You can see the deployment on http://cspr.live/ - the transfer from the example +can be seen here.

How Livenet backend works

All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. +It is possible however to query the state of the blockchain for free.

This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the +node is the current state. This is why the balance_of call was almost instant and free.

Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract +(see Cross Calls), it is executed offline and +node is used for the state query only. However, the Livenet needs to know the connection between the contracts +and the code, so make sure to deploy or load already deployed contracts

Multiple environments

It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, +multiple nodes or even multiple chains.

To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. +Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file +has to be used first. If your integration.env file has a value that IS present in the .env file, it will +override the value from the .env file.

ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene

To sum up - this command will firstly load the integration.env file and then load the missing values from .env file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/backends/odra-vm/index.html b/docs/docs/0.9.0/backends/odra-vm/index.html new file mode 100644 index 000000000..6f8fa3ae0 --- /dev/null +++ b/docs/docs/0.9.0/backends/odra-vm/index.html @@ -0,0 +1,26 @@ + + + + + +OdraVM | Odra + + + + + +
+
Version: 0.9.0

OdraVM

The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time - +simply use your IDE's debug functionality.

Usage

The OdraVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

OdraVM consists of two main parts: the Contract Register and the State.

The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address.

Contracts and Test Env functions can modify the State of the OdraVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the OdraVM State holds only the current state of the OdraVM. +Thanks to this and the fact that we do not need the blockchain itself, +OdraVM starts instantly and runs the tests in the native speed.

Execution

When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, OdraVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/backends/what-is-a-backend/index.html b/docs/docs/0.9.0/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..b08671b17 --- /dev/null +++ b/docs/docs/0.9.0/backends/what-is-a-backend/index.html @@ -0,0 +1,28 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.9.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like OdraVM, +a complete virtual machine, spinning up a blockchain for you - like CasperVM, +or even a real blockchain - when using Livenet backend.

Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Host Env

Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/cargo-odra/index.html b/docs/docs/0.9.0/basics/cargo-odra/index.html new file mode 100644 index 000000000..28e5dfa4f --- /dev/null +++ b/docs/docs/0.9.0/basics/cargo-odra/index.html @@ -0,0 +1,37 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.9.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them with various configurations.

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This creates a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

The third available template is workspace, which creates a workspace with two projects, similar to the one created +with the full template.

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.8.0 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it creates a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This creates a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

The most used command during the development of your project should be this one:

cargo odra test

It runs your tests against Odra's MockVM. It is substantially faster than CasperVM +and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra builds the project, generates the wasm files, +spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat.

Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. +This is why OdraVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build

If the build process finishes successfully, wasm files will be located in wasm folder. +Notice, that this command does not require the -b option.

If you want to build specific contract, you can use -c option:

cargo odra build -c counter # you pass many comma separated contracts

Generating contract schema

If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command:

cargo odra schema 

This generates a schema file in JSON format for all your contracts and places them in the resources folder. +If the resources folder does not exist, it creates the folder for you.

Like with the build command, you can use the -c option to generate a schema for a specific contract.

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/casper-contract-schema/index.html b/docs/docs/0.9.0/basics/casper-contract-schema/index.html new file mode 100644 index 000000000..75c195863 --- /dev/null +++ b/docs/docs/0.9.0/basics/casper-contract-schema/index.html @@ -0,0 +1,18 @@ + + + + + +Casper Contract Schema | Odra + + + + + +
+
Version: 0.9.0

Casper Contract Schema

Working in collaboration with the Casper Association we designed the Casper Contract Schema (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability.

Odra and CCS

There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory.

note

If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.

src/contract.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(
// the name of the contract, default is the module name
name = "MyContract",
// the version of the contract, default is the version of the crate
version = "0.1.0",
// events that the contract can emit, collected recursively if submodules are used
events = [
Created,
Updated
],
// the error enum the contract can revert with, collected recursively if submodules are used
errors = MyErrors
)]
pub struct MyContract {
name: Var<String>,
owner: Var<Address>,
}

#[odra::module]
impl MyContract {
/// Initializes the contract, sets the name and owner and emits an event
pub fn init(&mut self, name: String, owner: Address) {
self.name.set(name.clone());
self.owner.set(owner.clone());
self.env().emit_event(Created { name });
}

/// Updates the name of the contract and emits an event
pub fn update(&mut self, name: String) {
self.name.set(name.clone());
self.env().emit_event(Updated { name });
}

/// Returns the data of the contract
pub fn get_data(&self) -> Data {
Data {
name: self.name.get_or_default(),
owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),
}
}
}

// The struct will we visible in the schema in the types section
#[odra::odra_type]
pub struct Data {
name: String,
owner: Address,
}

// The enum variants will we visible in the schema in the errors section
#[odra::odra_error]
pub enum MyErrors {
/// The owner is invalid
InvalidOwner,
/// The name is invalid
InvalidName,
}

// The struct will we visible in the schema in the types and events section
#[odra::event]
pub struct Updated {
name: String,
}

// The struct will we visible in the schema in the types section and events section
#[odra::event]
pub struct Created {
name: String,
}

Generating the Schema

To generate the schema run the following cargo-odra command:

cargo odra schema # or pass -c flag to generate the schema for a specific contract

Schema Output

The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:

resources/my_contract_schema.json
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "MyContract",
"contract_version": "0.1.0",
"types": [
{
"struct": {
"name": "Created",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
},
{
"struct": {
"name": "Data",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
},
{
"name": "owner",
"description": null,
"ty": "Key"
}
]
}
},
{
"struct": {
"name": "Updated",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
}
],
"errors": [
{
"name": "InvalidName",
"description": "The name is invalid",
"discriminant": 1
},
{
"name": "InvalidOwner",
"description": "The owner is invalid",
"discriminant": 0
}
],
"entry_points": [
{
"name": "update",
"description": "Updates the name of the contract and emits an event",
"is_mutable": true,
"arguments": [
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "get_data",
"description": "Returns the data of the contract",
"is_mutable": false,
"arguments": [],
"return_ty": "Data",
"is_contract_context": true,
"access": "public"
}
],
"events": [
{
"name": "Created",
"ty": "Created"
},
{
"name": "Updated",
"ty": "Updated"
}
],
"call": {
"wasm_file_name": "MyContract.wasm",
"description": "Initializes the contract, sets the name and owner and emits an event",
"arguments": [
{
"name": "odra_cfg_package_hash_key_name",
"description": "The arg name for the package hash key name.",
"ty": "String",
"optional": false
},
{
"name": "odra_cfg_allow_key_override",
"description": "The arg name for the allow key override.",
"ty": "Bool",
"optional": false
},
{
"name": "odra_cfg_is_upgradable",
"description": "The arg name for the contract upgradeability setting.",
"ty": "Bool",
"optional": false
},
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
},
{
"name": "owner",
"description": null,
"ty": "Key",
"optional": false
}
]
}
}

Schema Fields

  • casper_contract_schema_version is the version of the schema. +toolchain is the version of the Rust compiler used to compile the contract.
  • Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.
  • contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.
  • contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.
  • types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.
  • errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.
  • entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.
  • events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.
  • The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/communicating-with-host/index.html b/docs/docs/0.9.0/basics/communicating-with-host/index.html new file mode 100644 index 000000000..e5b28d17d --- /dev/null +++ b/docs/docs/0.9.0/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.9.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module]
pub struct HostContract {
name: Var<String>,
created_at: Var<u64>,
created_by: Var<Address>
}

#[odra::module]
impl HostContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(self.env().get_block_time());
self.created_by.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are using self.env(). It is an implementation of Module::env(), autogenerated +by #[odra::module] attribute. The function returns a reference to the ContractEnv (you can read more in +the Backend section). This is a structure that provides access to the host functions and variables.

In this example, we use two of them:

  • get_block_time() - returns the current block time as u64.
  • caller() - returns an Odra Address of the caller (this can be an external caller or another contract).
info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/cross-calls/index.html b/docs/docs/0.9.0/basics/cross-calls/index.html new file mode 100644 index 000000000..ae7b53f27 --- /dev/null +++ b/docs/docs/0.9.0/basics/cross-calls/index.html @@ -0,0 +1,22 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.9.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::prelude::*;
use odra::{Address, UnwrapOrRevert, Var};

#[odra::module]
pub struct CrossContract {
pub math_engine: Var<Address>
}

#[odra::module]
impl CrossContract {
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine;

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To perform a cross-contact call, we use the {{ModuleName}}ContractRef that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)

Contract Ref

We mentioned HostRef already in our Testing article - a host side reference to already deployed contract.

In the module context we use a ContractRef instead, to call other contracts.

Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, +by the #[odra::module] attribute.

To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above.

The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract.

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call:

AdderContractRef::new(self.env(), address).add(3, 5)

Loading the contract

Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test +our contracts in Livenet backend. We can load the contract using load method on the Deployer:

examples/bin/erc20_on_livenet.rs
fn _load(env: &HostEnv) -> Erc20HostRef {
let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
let address = Address::from_str(address).unwrap();
<Erc20HostRef as HostRefLoader>::load(env, address)
}

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};
use odra::host::{Deployer, HostRef, NoArgs};

#[test]
fn test_cross_calls() {
let test_env = odra_test::env();
let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);
let cross_contract = CrossContractHostRef::deploy(
&test_env,
CrossContractInitArgs {
math_engine_address: *math_engine_contract.address()
}
);
assert_eq!(cross_contract.add_using_another(), 8);
}
}

Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize.

#[cfg(test)]
mod tests {
use super::*;
use odra::{Address, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_ext() {
let test_env = odra_test::env();
let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)
assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address(test_env: &HostEnv) -> Address {
let contract = MathEngineHostRef::deploy(test_env, NoArgs);
*contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/directory-structure/index.html b/docs/docs/0.9.0/basics/directory-structure/index.html new file mode 100644 index 000000000..d584566f1 --- /dev/null +++ b/docs/docs/0.9.0/basics/directory-structure/index.html @@ -0,0 +1,26 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.9.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── rust-toolchain
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── bin/
| |── build_contract.rs
| └── build_schema.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.9.0"

[dev-dependencies]
odra-test = "0.9.0"

[build-dependencies]
odra-build = "0.9.0"

[[bin]]
name = "sample_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "sample_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also +added as a dev dependency.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

src/

This is the folder where your smart contract files live.

bin/

This is the folder where scripts that will be used to generate code or schemas live. +You don't need to modify those files, they are generated by cargo odra new command and +are used by cargo odra build, cargo odra test and cargo odra schema commands.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/errors/index.html b/docs/docs/0.9.0/basics/errors/index.html new file mode 100644 index 000000000..27fb58a8c --- /dev/null +++ b/docs/docs/0.9.0/basics/errors/index.html @@ -0,0 +1,24 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.9.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(errors = Error)]
pub struct OwnedContract {
name: Var<String>,
owner: Var<Address>
}

#[odra::odra_error]
pub enum Error {
OwnerNotSet = 1,
NotAnOwner = 2
}

#[odra::module]
impl OwnedContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = self.env().caller();
if caller != self.owner() {
self.env().revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using the #[odra::odra_error] attribute to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
self.env().revert(Error::NotAnOwner)

To register errors, add the errors inner attribute to the struct's #[odra::module] attribute and pass the error type as the value. The registered errors will be present in the contract schema.

Defining an error in Odra, you must keep in mind a few rules:

  1. An error should be a field-less enum.
  2. The enum must be annotated with #[odra::odra_error].
  3. Avoid implicit discriminants.
note

In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!

Testing errors

Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:

examples/src/features/handling_errors.rs
#[cfg(test)]
mod tests {
use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};
use odra::host::Deployer;
use odra::prelude::*;

#[test]
fn test_owner_error() {
let test_env = odra_test::env();
let owner = test_env.get_account(0);
let not_an_owner = test_env.get_account(1);

test_env.set_caller(owner);
let init_args = OwnedContractInitArgs {
name: "OwnedContract".to_string()
};
let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);

test_env.set_caller(not_an_owner);
assert_eq!(
owned_contract.try_change_name("NewName".to_string()),
Err(Error::NotAnOwner.into())
);
}
}

Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult. +OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and +and safe its safe version: try_name, try_owner, try_change_name.

In our example, we are calling try_change_name and expecting an error to be thrown. +For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, +we need to convert our custom error to OdraError using Into::into().

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/events/index.html b/docs/docs/0.9.0/basics/events/index.html new file mode 100644 index 000000000..e35dec590 --- /dev/null +++ b/docs/docs/0.9.0/basics/events/index.html @@ -0,0 +1,18 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.9.0

Events

In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:

examples/src/features/events.rs
use odra::prelude::*;
use odra::Address;

#[odra::module(events = [PartyStarted])]
pub struct PartyContract;

#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64
}

#[odra::module]
impl PartyContract {
pub fn init(&self) {
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, add the #[odra::event] attribute like this:

examples/src/features/events.rs
#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64,
}

To emit an event, we use the emit_event function from the ContractEnv, passing the event as an argument:

examples/src/features/events.rs
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});

To determine all the events at compilation time to register them once the contract is deployed. To register events, add an events inner attribute to the struct's #[odra::module] attribute. The registered events will also be present in the contract schema.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use super::{PartyContractHostRef, PartyStarted};
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

#[test]
fn test_party() {
let test_env: HostEnv = odra_test::env();
let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);
test_env.emitted_event(
party_contract.address(),
&PartyStarted {
caller: test_env.get_account(0),
block_time: 0
}
);
// If you do not want to check the exact event, you can use `emitted` function
test_env.emitted(party_contract.address(), "PartyStarted");
// You can also check how many events were emitted.
assert_eq!(test_env.events_count(party_contract.address()), 1);
}

To explore more event testing functions, check the HostEnv documentation.

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/flipper-internals/index.html b/docs/docs/0.9.0/basics/flipper-internals/index.html new file mode 100644 index 000000000..4d6e98d9c --- /dev/null +++ b/docs/docs/0.9.0/basics/flipper-internals/index.html @@ -0,0 +1,38 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.9.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Var;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Var, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Var<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the attribute - all functions defined there, even marked +with pub will be not callable.

The function named init is the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error. The init function is optional, +if your contract does not need any initialization, you can skip it.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated +by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, +as the second argument of the deploy function, we pass NoArgs - one of the implementations of +the InitArgs trait provided with the framework.

The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/modules/index.html b/docs/docs/0.9.0/basics/modules/index.html new file mode 100644 index 000000000..72237e62d --- /dev/null +++ b/docs/docs/0.9.0/basics/modules/index.html @@ -0,0 +1,21 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.9.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to the #[odra::module] attribute. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;
use odra::module::SubModule;
use odra::prelude::*;

#[odra::module]
pub struct ModulesContract {
pub math_engine: SubModule<MathEngine>
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}
info

To use a module as a component of another module, you need to use the SubModule type. This is a special type +that crates a keyspace (read more in Storage Layout) and provide access to its public methods.

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the OwnedToken example in the main Odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
#[cfg(test)]
mod tests {
use super::ModulesContractHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);
assert_eq!(modules_contract.add_using_module(), 8);
}
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/native-token/index.html b/docs/docs/0.9.0/basics/native-token/index.html new file mode 100644 index 000000000..1d02faa07 --- /dev/null +++ b/docs/docs/0.9.0/basics/native-token/index.html @@ -0,0 +1,25 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.9.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::prelude::*;
use odra::{casper_types::U512, module::Module};

#[odra::module]
pub struct PublicWallet;

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {}

pub fn withdraw(&mut self, amount: &U512) {
self.env().transfer_tokens(&self.env().caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/contracts/tlw.rs in the odra main repository.

You can see a new attribute used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from ContractEnv::transfer_tokens(). +It does exactly what you are expecting it to do - it transfers native tokens from the contract to the +specified address.

Testing

To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function - +balance_of:

examples/src/features/native_token.rs
#[cfg(test)]
mod tests {
use super::PublicWalletHostRef;
use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);
assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());

my_contract.with_tokens(U512::from(100)).deposit();
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));

my_contract.withdraw(U512::from(25));
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/odra-toml/index.html b/docs/docs/0.9.0/basics/odra-toml/index.html new file mode 100644 index 000000000..0b572f940 --- /dev/null +++ b/docs/docs/0.9.0/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.9.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
fqn = "sample::Flipper"

The fqn (Fully Qualified Name) is used by the building tools to locate and build the contract. +The last segment of the fqn will be used as the name for your contract - the generated wasm file will +be in the above case named flipper.wasm.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
fqn = "sample::Flipper"

[[contracts]]
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/storage-interaction/index.html b/docs/docs/0.9.0/basics/storage-interaction/index.html new file mode 100644 index 000000000..e4d871249 --- /dev/null +++ b/docs/docs/0.9.0/basics/storage-interaction/index.html @@ -0,0 +1,36 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.9.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Var

The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Var type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
#[odra::module]
pub struct DogContract {
barks: Var<bool>,
weight: Var<u32>,
name: Var<String>,
walks: Var<Vec<u32>>,
}

You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
use odra::Var;

#[odra::module]
impl DogContract {
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Var is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::{Mapping, Var};

#[odra::module]
pub struct DogContract2 {
name: Var<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Vars section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Var working together:

core/src/list.rs
use odra::{List, Var};

pub struct List<T> {
values: Mapping<u32, T>,
index: Var<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
#[odra::module]
pub struct DogContract3 {
name: Var<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type:

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}
note

Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute .

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/basics/testing/index.html b/docs/docs/0.9.0/basics/testing/index.html new file mode 100644 index 000000000..f289e847c --- /dev/null +++ b/docs/docs/0.9.0/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.9.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{List, Var};

#[cfg(test)]
mod tests {
use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn init_test() {
let test_env = odra_test::env();
let init_args = DogContract3InitArgs {
name: "DogContract".to_string()
};
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The first interesting thing you may notice is placed the import section.

use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

We are using super to import the DogContract3HostRef and DogContract3InitArgs from the parent module. +{{ModuleName}}HostRef and {{ModuleName}}InitArgs are types that was generated for us by Odra.

DogContract3HostRef is a reference to the contract that we can use to interact with it (call entrypoints) +and implements HostRef trait.

DogContract3InitArgs is a struct that we use to initialize the contract and implements InitArgs trait. +Considering the contract initialization, there three possible scenarios:

  1. The contract has a constructor with arguments, then Odra creates a struct named {{ModuleName}}InitArgs.
  2. The contract has a constructor with no arguments, then you can use odra::host::NoArgs.
  3. The contract does not have a constructor, then you can use odra::host::NoArgs. +All of those structs implement the odra::host::InitArgs trait, required to conform to the +Deployer::deploy method signature.

The other import is odra::host::Deployer. This is a trait is used to deploy the contract and give us a reference to it.

Let's take a look at the test itself. How to obtain a reference to the contract? +{{ModuleName}}HostRef implements the Deployer trait, which provides the deploy method:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with the odra::module attribute are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

HostEnv

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};
use odra::{host::{Deployer, HostEnv}, prelude::*};

#[test]
fn env() {
let test_env: HostEnv = odra_test::env();
test_env.set_caller(test_env.get_account(0));
let init_args = TestingContractInitArgs {
name: "MyContract".to_string()
};
let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);
let creator = testing_contract.created_by();
test_env.set_caller(test_env.get_account(1));
let init_args = TestingContractInitArgs {
name: "MyContract2".to_string()
};
let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);
let creator2 = testing_contract2.created_by();
assert_ne!(creator, creator2);
}
}

In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). +Next, we are deploying two instances of the same contract, but we're using HostEnv::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller() +the function we are calling inside the contract.

HostEnv comes with a set of functions that will let you write better tests:

  • fn set_caller(&self, address: Address) - you've seen it in action just now
  • fn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given address
  • fn advance_block_time(&self, time_diff: u64) - increases the current value of block_time
  • fn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; +by default, you start with the 0-th account
  • fn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract

Full list of functions can be found in the HostEnv documentation.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/category/advanced/index.html b/docs/docs/0.9.0/category/advanced/index.html new file mode 100644 index 000000000..ad497afdd --- /dev/null +++ b/docs/docs/0.9.0/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/category/backends/index.html b/docs/docs/0.9.0/category/backends/index.html new file mode 100644 index 000000000..c502f58f4 --- /dev/null +++ b/docs/docs/0.9.0/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/category/basics/index.html b/docs/docs/0.9.0/category/basics/index.html new file mode 100644 index 000000000..1861476f2 --- /dev/null +++ b/docs/docs/0.9.0/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/category/examples/index.html b/docs/docs/0.9.0/category/examples/index.html new file mode 100644 index 000000000..6da2f6fdd --- /dev/null +++ b/docs/docs/0.9.0/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/category/getting-started/index.html b/docs/docs/0.9.0/category/getting-started/index.html new file mode 100644 index 000000000..dfc450d31 --- /dev/null +++ b/docs/docs/0.9.0/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/category/migrations/index.html b/docs/docs/0.9.0/category/migrations/index.html new file mode 100644 index 000000000..5498e2ca2 --- /dev/null +++ b/docs/docs/0.9.0/category/migrations/index.html @@ -0,0 +1,17 @@ + + + + + +Migrations | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/category/tutorials/index.html b/docs/docs/0.9.0/category/tutorials/index.html new file mode 100644 index 000000000..3fa0dac86 --- /dev/null +++ b/docs/docs/0.9.0/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + +
+
Version: 0.9.0

Tutorials

The theory is good, but the practice is even better. Let's go through a few examples summing up all the Odra concepts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/examples/odra-examples/index.html b/docs/docs/0.9.0/examples/odra-examples/index.html new file mode 100644 index 000000000..da95626fd --- /dev/null +++ b/docs/docs/0.9.0/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.9.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/examples/using-odra-modules/index.html b/docs/docs/0.9.0/examples/using-odra-modules/index.html new file mode 100644 index 000000000..e22311515 --- /dev/null +++ b/docs/docs/0.9.0/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.9.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.9.0"

[dev-dependencies]
odra-test = "0.9.0"

[build-dependencies]
odra-build = "0.9.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = "0.9.0"
odra-modules = "0.9.0"

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::prelude::*;
use odra::{Address, casper_types::U256, module::SubModule};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/getting-started/flipper/index.html b/docs/docs/0.9.0/getting-started/flipper/index.html new file mode 100644 index 000000000..1b1f7311e --- /dev/null +++ b/docs/docs/0.9.0/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.9.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Var;

/// A module definition. Each module struct consists Vars and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor, must be named `init`.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let env = odra_test::env();
let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);
let contract2 = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

Testing

To run the tests, execute the following command:

cargo odra test # or add the `-b casper` flag to run tests on the CasperVM

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/getting-started/installation/index.html b/docs/docs/0.9.0/getting-started/installation/index.html new file mode 100644 index 000000000..3a641b912 --- /dev/null +++ b/docs/docs/0.9.0/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.9.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra --locked

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called my_project and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/index.html b/docs/docs/0.9.0/index.html new file mode 100644 index 000000000..a978bb9c0 --- /dev/null +++ b/docs/docs/0.9.0/index.html @@ -0,0 +1,19 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.9.0

Odra framework

Odra is a Rust-based smart contract framework for Casper Network. Odra encourages rapid development and clean, +pragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel.

It's free and open source!

What's next

See the Installation and our Flipper example to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/migrations/to-0.8.0/index.html b/docs/docs/0.9.0/migrations/to-0.8.0/index.html new file mode 100644 index 000000000..0b026dd34 --- /dev/null +++ b/docs/docs/0.9.0/migrations/to-0.8.0/index.html @@ -0,0 +1,19 @@ + + + + + +Migration guide to v0.8.0 | Odra + + + + + +
+
Version: 0.9.0

Migration guide to v0.8.0

Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version.

This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant changes in v0.8.0 include:

  • Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only.
  • Framework internals redesign.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0.

2. Migration Steps

2.1 Add bin directory

Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory.

You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2. Update Cargo.toml

There a bunch of changes in the Cargo.toml file.

  • You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.
  • Register bins you added in the previous step.
  • Add dev-dependencies section with odra-test crate.
  • Add recommended profiles for release and dev to optimize the build process.

Below you can compare the Cargo.toml file after and before the migration to v0.8.0:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

2.2. Update Odra.toml

Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required.

[[contracts]]
fqn = "my_project::Flipper"

2.3. Update Smart Contracts

The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:

2.3.1. Update the use statements to reflect the new module structure.

  • Big integer types are now located in the odra::casper_types module.
  • odra::types::Address is now odra::Address.
  • Variable is now Var.
  • Remove odra::contract_env.
  • Remove odra::types::event::OdraEvent.
  • Remove odra::types::OdraType as it is no longer required.
  • Change odra::types::casper_types::*; to odra::casper_types::*;.

2.3.2. Some type aliases are no longer in use.

  • Balance - use odra::casper_types::U512.
  • BlockTime - use u64.
  • EventData - use odra::casper_types::bytesrepr::Bytes.

2.3.3. Consider import odra::prelude::* in your module files.

2.3.4. Flatten nested Mappings.

// Before
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<Address, Mapping<Address, U256>>
}
// After
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<(Address, Address), U256>
}

2.3.5. Update errors definitions.

execution_error! macro has been replace with OdraError derive macro.

use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.3.6. Update events definitions.

use odra::prelude::*;
use odra::Event;

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

// Emitting the event
self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});

2.3.7. Replace contract_env with self.env() in your modules.

self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes.

  • fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.
  • fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).
  • set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions.
  • fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].
  • fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.
  • fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).
  • fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.
  • functions native_token_metadata() and one_token() have been removed.

2.3.8. Wrap submodules of your module with odra::SubModule<T>.

#[odra::module(events = [Transfer])]
pub struct Erc721Token {
core: SubModule<Erc721Base>,
metadata: SubModule<Erc721MetadataExtension>,
ownable: SubModule<Ownable>
}

2.3.9. Update external contract calls.

However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()).

#[odra::external_contract]
pub trait Token {
fn balance_of(&self, owner: &Address) -> U256;
}

// Usage
TokenContractRef::new(env, token).balance_of(account)

2.3.10. Update constructors.

Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init.

2.3.11. Update UnwrapOrRevert calls.

The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter.

2.3.12. Remove #[odra(using)] attribute from your module definition.

Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required.

2.4. Update Tests

Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:

2.4.1. Contract deployment.

The way you deploy a contract has changed:

  1. You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.
  2. Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.
  3. If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.
  4. If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function.
// A contract without init args
use super::OwnableHostRef;
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

let env: HostEnv = odra_test::env();
let ownable = OwnableHostRef::deploy(&env, NoArgs)

// A contract with init args
use super::{Erc20HostRef, Erc20InitArgs};
use odra::host::{Deployer, HostEnv};

let env: HostEnv = odra_test::env();
let init_args = Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
};
let erc20 = Erc20HostRef::deploy(&env, init_args);

2.4.2. Host interactions.

  1. Replace odra::test_env with odra_test::env().
  2. The API of odra::test_env and odra_test::env() are similar, but there are some differences:
    • test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).
    • test_env::token_balance(Address) is now env.balance_of(&Address).
    • functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef.

2.4.3. Testing failing scenarios.

test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result. +try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro.

#[test]
fn transfer_from_error() {
let (env, mut erc20) = setup();

let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

assert_eq!(
erc20.try_transfer_from(owner, recipient, amount),
Err(Error::InsufficientAllowance.into())
);
}

2.4.4. Testing events.

assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. +The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options.

let env: HostEnv = odra_test::env();
let erc20 = Erc20HostRef::deploy(&env, init_args);

...

assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.8.0.

src/erc20.rs
use crate::erc20::errors::Error::*;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address, Event};

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
use super::{
errors::Error,
events::{Approval, Transfer},
Erc20HostRef, Erc20InitArgs
};
use odra::{
casper_types::U256,
host::{Deployer, HostEnv, HostRef},
prelude::*
};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

// Other tests...
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/migrations/to-0.9.0/index.html b/docs/docs/0.9.0/migrations/to-0.9.0/index.html new file mode 100644 index 000000000..127617752 --- /dev/null +++ b/docs/docs/0.9.0/migrations/to-0.9.0/index.html @@ -0,0 +1,18 @@ + + + + + +Migration guide to v0.9.0 | Odra + + + + + +
+
Version: 0.9.0

Migration guide to v0.9.0

This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version 0.7.1 and below, start with the previous guide. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant change in 0.9.0 is the way of defining custom elements namely type, events and errors.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0.

2. Migration Steps

2.1 Update build_schema.rs bin

Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2 Update smart contract code

The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes.

2.2.1. Update custom types definitions.

#[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute.

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}

2.2.2. Update errors definitions.

#[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. +Error enum should be passed as a parameter to the #[odra::module] attribute.

#[odra::module(events = [/* events go here */], errors = Error)]
pub struct Erc20 {
// fields
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.2.3. Update events definitions.

#[derive(Event)] attribute has been replace with #[odra::event] attribute.

use odra::prelude::*;
use odra::{Address, casper_types::U256};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.9.0.

src/erc20.rs
use crate::erc20::errors::Error;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer], errors = Error)]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(Error::NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(Error::InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(Error::InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
// nothing changed in the tests
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/tutorials/access-control/index.html b/docs/docs/0.9.0/tutorials/access-control/index.html new file mode 100644 index 000000000..dc62748b2 --- /dev/null +++ b/docs/docs/0.9.0/tutorials/access-control/index.html @@ -0,0 +1,17 @@ + + + + + +Access Control | Odra + + + + + +
+
Version: 0.9.0

Access Control

In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,

In this article we design and implement a more fine-grained access control layer.

Code

Before we start writing code, we list the functionalities of our access control layer.

  1. A Role type is used across the module.
  2. A Role can be assigned to many Addresses.
  3. Each Role may have a corresponding admin role.
  4. Only an admin can grant/revoke a Role.
  5. A Role can be renounced.
  6. A Role cannot be renounced on someone's behalf.
  7. Each action triggers an event.
  8. Unauthorized access stops contract execution.

Project Structure

access-control
├── src
│ ├── access
│ │ ├── access_control.rs
│ │ ├── events.rs
│ │ └── errors.rs
│ └── lib.rs
|── build.rs
|── Cargo.toml
└── Odra.toml

Events and Errors

There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions.

events.rs
use odra::prelude::*;
use odra::Address;
use super::access_control::Role;

#[odra::event]
pub struct RoleGranted {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleRevoked {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleAdminChanged {
pub role: Role,
pub previous_admin_role: Role,
pub new_admin_role: Role
}
  • L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.
  • L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role.
errors.rs
#[odra::odra_error]
pub enum Error {
MissingRole = 20_000,
RoleRenounceForAnotherAddress = 20_001,
}

Errors definition is straightforward - there are only two invalid states:

  1. An action is triggered by an unauthorized actor.
  2. The caller is attempting to resign the Role on someone's behalf.

Module

Now, we are stepping into the most interesting part: the module definition and implementation.

access_control.rs
use super::events::*;
use super::errors::Error;
use odra::prelude::*;
use odra::{Address, Mapping};

pub type Role = [u8; 32];

pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];

#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]
pub struct AccessControl {
roles: Mapping<(Role, Address), bool>,
role_admin: Mapping<Role, Role>
}

#[odra::module]
impl AccessControl {
pub fn has_role(&self, role: &Role, address: &Address) -> bool {
self.roles.get_or_default(&(*role, *address))
}

pub fn get_role_admin(&self, role: &Role) -> Role {
let admin_role = self.role_admin.get(role);
if let Some(admin) = admin_role {
admin
} else {
DEFAULT_ADMIN_ROLE
}
}

pub fn grant_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_grant_role(role, address);
}

pub fn revoke_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_revoke_role(role, address);
}

pub fn renounce_role(&mut self, role: &Role, address: &Address) {
if address != &self.env().caller() {
self.env().revert(Error::RoleRenounceForAnotherAddress);
}
self.unchecked_revoke_role(role, address);
}
}

impl AccessControl {
pub fn check_role(&self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.env().revert(Error::MissingRole);
}
}

pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {
let previous_admin_role = self.get_role_admin(role);
self.role_admin.set(role, *admin_role);
self.env().emit_event(RoleAdminChanged {
role: *role,
previous_admin_role,
new_admin_role: *admin_role
});
}

pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.roles.set(&(*role, *address), true);
self.env().emit_event(RoleGranted {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}

pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {
if self.has_role(role, address) {
self.roles.set(&(*role, *address), false);
self.env().emit_event(RoleRevoked {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}
}
  • L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.
  • L8 - The default role is an array filled with zeros.
  • L10-L13 - The storage consists of two mappings:
  1. roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.
  2. role_admin - each Role can have a single admin Role.
  • L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.
  • L49 - This is a non-exported block containing helper functions.
  • L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.
  • L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.
  • L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).
  • L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.
  • L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access.
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/tutorials/build-deploy-read/index.html b/docs/docs/0.9.0/tutorials/build-deploy-read/index.html new file mode 100644 index 000000000..faa3a5152 --- /dev/null +++ b/docs/docs/0.9.0/tutorials/build-deploy-read/index.html @@ -0,0 +1,17 @@ + + + + + +Build, Deploy and Read the State of a Contract | Odra + + + + + +
+
Version: 0.9.0

Build, Deploy and Read the State of a Contract

In this guide, we will show the full path from creating a contract, deploying it and reading the state.

We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript.

Before you start, make sure you completed the following steps:

Contract

Let's write a contract with complex storage layout.

The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping.

We will expose two methods:

  1. The constructor init which sets the metadata and the version of the contract.
  2. The method set_data which sets the value of the numeric field and the values of the mapping.
custom_item.rs
use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};

// A custom type with a vector of another custom type
#[odra::odra_type]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[odra::odra_type]
pub struct Price {
value: U256,
}

// The main contract with a version, metadata and a submodule
#[odra::module]
pub struct CustomItem {
version: Var<u32>,
meta: Var<Metadata>,
data: SubModule<Data>
}

#[odra::module]
impl CustomItem {
pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {
let meta = Metadata {
name,
description,
prices: vec![
Price { value: price_1 },
Price { value: price_2 }
]
};
self.meta.set(meta);
self.version.set(self.version.get_or_default() + 1);
}

pub fn set_data(&mut self, value: u32, name: String, name2: String) {
self.data.value.set(value);
self.data.inner.named_values.set(&name, 10);
self.data.inner.named_values.set(&name2, 20);
}
}

// A submodule with a numeric value and another submodule
#[odra::module]
struct Data {
value: Var<u32>,
inner: SubModule<InnerData>,
}

// A submodule with a mapping
#[odra::module]
struct InnerData {
named_values: Mapping<String, u32>,
}

Deploying the contract

First, we need to setup the chain. We will use the NCTL docker image to run a local network.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Next, we need to compile the contract to a Wasm file.

cargo odra build -c custom_item 

Then, we can deploy the contract using the casper-client tool.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key path/to/your/secret_key.pem \
--session-path [PATH_TO_WASM] \
--payment-amount 100000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string='My Name'" \
--session-arg "description:string='My Description'" \
--session-arg "price_1:u256='101'" \
--session-arg "price_2:u256='202'"

Finally, we can call the set_data method to set the values of the contract.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key ./keys/secret_key.pem \
--payment-amount 2000000000 \
--session-hash [DEPLOYED_CONTRACT_HASH] \
--session-entry-point "set_data" \
--session-arg "value:u32:'666'" \
--session-arg "name:string='alice'" \
--session-arg "name2:string='bob'"

Storage Layout

To read the state of the contract, we need to understand the storage layout.

The first step is to calculate the index of the keys.

Storage Layout

CustomItem: prefix: 0x0..._0000_0000_0000 0
version: u32, 0x0..._0000_0000_0000 0
meta: Metadata, 0x0..._0000_0000_0001 1
data: Data: prefix: 0x0..._0000_0000_0010 2
value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0
inner: InnerData: prefix: 0x0..._0000_0010_0001 (2 << 4) + 1
named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0

The actual key is obtained as follows:

  1. Convert the index to a big-endian byte array.
  2. Concatenate the index with the mapping data.
  3. Hash the concatenated bytes using blake2b.
  4. Return the hex representation of the hash (the stored key must be utf-8 encoded).

In more detail, the storage layout is described in the Storage Layout article.

Reading the state

main.rs
use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};
use casper_types::{
bytesrepr::{FromBytes, ToBytes},
U256,
};

// replace with your contract hash
const CONTRACT_HASH: &str = "hash-...";
const NODE_ADDRESS: &str = "http://localhost:11101/rpc";
const RPC_ID: &str = "casper-net-1";
const DICTIONARY_NAME: &str = "state";

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

async fn read_state_key(key: String) -> Vec<u8> {
let state_root_hash = casper_client::get_state_root_hash(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
None,
)
.await
.unwrap()
.result
.state_root_hash
.unwrap();

// Read the value from the `state` dictionary.
let result = casper_client::get_dictionary_item(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
state_root_hash,
DictionaryItemIdentifier::ContractNamedKey {
key: CONTRACT_HASH.to_string(),
dictionary_name: DICTIONARY_NAME.to_string(),
dictionary_item_key: key,
},
)
.await
.unwrap()
.result
.stored_value;

// We expect the value to be a CLValue
if let StoredValue::CLValue(cl_value) = result {
// Ignore the first 4 bytes, which are the length of the CLType.
cl_value.inner_bytes()[4..].to_vec()
} else {
vec![]
}
}

async fn metadata() -> Metadata {
// The key for the metadata is 1, and it has no mapping data
let key = key(1, &[]);
let bytes = read_state_key(key).await;

// Read the name and store the remaining bytes
let (name, bytes) = String::from_bytes(&bytes).unwrap();
// Read the description and store the remaining bytes
let (description, bytes) = String::from_bytes(&bytes).unwrap();
// A vector is stored as a u32 size followed by the elements
// Read the size of the vector and store the remaining bytes
let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();

let mut prices = vec![];
// As we know the size of the vector, we can loop over it
for _ in 0..size {
// Read the value and store the remaining bytes
let (value, rem) = U256::from_bytes(&bytes).unwrap();
bytes = rem;
prices.push(Price { value });
}
// Anytime you finish parsing a value, you should check if there are any remaining bytes
// if there are, it means you have a bug in your parsing logic.
// For simplicity, we will ignore the remaining bytes here.
Metadata {
name,
description,
prices
}
}

async fn value() -> u32 {
// The key for the value is (2 << 4) + 0, and it has no mapping data
let key = key(2 << 4, &[]);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

async fn named_value(name: &str) -> u32 {
// The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes
let mapping_data = name.to_bytes().unwrap();
let key = key(((2 << 4) + 1) << 4, &mapping_data);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

fn main() {
let runtime = tokio::runtime::Runtime::new().unwrap();
dbg!(runtime.block_on(metadata()));
dbg!(runtime.block_on(value()));
dbg!(runtime.block_on(named_value("alice")));
dbg!(runtime.block_on(named_value("bob")));
}

// The key is a combination of the index and the mapping data
// The algorithm is as follows:
// 1. Convert the index to a big-endian byte array
// 2. Concatenate the index with the mapping data
// 3. Hash the concatenated bytes using blake2b
// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)
fn key(idx: u32, mapping_data: &[u8]) -> String {
let mut key = Vec::new();
key.extend_from_slice(idx.to_be_bytes().as_ref());
key.extend_from_slice(mapping_data);
let hashed_key = blake2b(&key);

hex::encode(&hashed_key)
}

fn blake2b(bytes: &[u8]) -> [u8; 32] {
let mut result = [0u8; 32];
let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32)
.expect("should create hasher");
let _ = std::io::Write::write(&mut hasher, bytes);
blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)
.expect("should copy hash to the result array");
result
}

cargo run
[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {
name: "My Contract",
description: "My Description",
prices: [
Price {
value: 123,
},
Price {
value: 321,
},
],
}
[src/main.rs:117:5] runtime.block_on(value()) = 666
[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20
[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/tutorials/erc20/index.html b/docs/docs/0.9.0/tutorials/erc20/index.html new file mode 100644 index 000000000..d4855cc48 --- /dev/null +++ b/docs/docs/0.9.0/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.9.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • Advanced storage using key-value pairs,
  • Odra types such as Address,
  • Advanced event assertion.

Code

Our module features a considerably more complex storage layout compared to the previous example.

It is designed to store the following data:

  1. Immutable metadata - name, symbol, and decimals.
  2. Total supply.
  3. Balances of individual users.
  4. Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.

Module definition

erc20.rs
use odra::prelude::*;
use odra::{Address, casper_types::U256, Mapping, Var};

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}
  • L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.
  • L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys.

Metadata

erc20.rs
#[odra::module]
impl Erc20 {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let caller = self.env().caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, &initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &U256) {
self.balances.add(address, *amount);
self.total_supply.add(*amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}
}

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L9 - A constructor sets the token metadata and mints the initial supply.
  • L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.
  • L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for:
use odra::UnwrapOrRevert;

let current_balance = self.balances.get(address).unwrap_or_default();
let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());
self.balances.set(address, new_balance);

Core

To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();
self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
self.env().revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowance(owner, spender);
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.set(&(*owner, *spender), new_allowance);
self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 1,
InsufficientAllowance = 2,
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::*;
use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: INITIAL_SUPPLY.into()
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

#[test]
fn transfer_from_and_approval_work() {
let (env, mut erc20) = setup();

let (owner, recipient, spender) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount
}
));

// Spender transfers tokens from Owner to Recipient.
env.set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));
// assert!(env.emitted(erc20.address(), "Transfer"));
}

#[test]
fn transfer_from_error() {
// Given a new instance.
let (env, mut erc20) = setup();

// When the spender's allowance is zero.
let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

// Then transfer fails.
assert_eq!(
erc20.try_transfer_from(&owner, &recipient, &amount),
Err(Error::InsufficientAllowance.into())
);
}
}
  • L146 - Alternatively, if you don't want to check the entire event, you may assert only its type.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/tutorials/ownable/index.html b/docs/docs/0.9.0/tutorials/ownable/index.html new file mode 100644 index 000000000..88516f734 --- /dev/null +++ b/docs/docs/0.9.0/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.9.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining a constructor,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

ownable.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(events = [OwnershipChanged])]
pub struct Ownable {
owner: Var<Option<Address>>
}

That was easy, but it is crucial to understand the basics before we move on.

  • L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.
  • L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var.

Init the module

ownable.rs
#[odra::module]
impl Ownable {
pub fn init(&mut self, owner: Address) {
if self.owner.get_or_default().is_some() {
self.env().revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(Some(owner));

self.env().emit_event(OwnershipChanged {
prev_owner: None,
new_owner: owner
});
}
}

#[odra::odra_error]
pub enum Error {
OwnerIsAlreadyInitialized = 1,
}

#[odra::event]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L1 - The impl should be an Odra module, so add #[odra::module].
  • L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.
  • L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.
  • L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument.
  • L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.
  • L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.
  • L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None.

Features implementation

ownable.rs
#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get_or_default().as_ref() {
self.env().revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&self.env().caller());
let current_owner = self.get_owner();
self.owner.set(Some(*new_owner));
self.env().emit_event(OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
});
}

pub fn get_owner(&self) -> Address {
match self.owner.get_or_default() {
Some(owner) => owner,
None => self.env().revert(Error::OwnerIsNotInitialized)
}
}
}

#[odra::odra_error]
pub enum Error {
NotOwner = 1,
OwnerIsAlreadyInitialized = 2,
OwnerIsNotInitialized = 3,
}

The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along.

  • L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.
  • L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.
  • L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead.

Test

ownable.rs
#[cfg(test)]
mod tests {
use super::*;
use odra::host::{Deployer, HostEnv, HostRef};

fn setup() -> (OwnableHostRef, HostEnv, Address) {
let env: HostEnv = odra_test::env();
let init_args = OwnableInitArgs {
owner: env.get_account(0)
};
(OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))
}

#[test]
fn initialization_works() {
let (ownable, env, owner) = setup();
assert_eq!(ownable.get_owner(), owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (mut ownable, env, owner) = setup();
let new_owner = env.get_account(1);

env.set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (mut ownable, env, _) = setup();
let new_owner = env.get_account(1);
ownable.change_ownership(&new_owner);

assert_eq!(
ownable.try_change_ownership(&new_owner),
Err(Error::NotOwner.into())
);
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.
  • L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one).
  • L14 - It is time to define the first test. As you see, it is a regular Rust test.
  • L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.
  • L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.
  • L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/tutorials/owned-token/index.html b/docs/docs/0.9.0/tutorials/owned-token/index.html new file mode 100644 index 000000000..557f83db1 --- /dev/null +++ b/docs/docs/0.9.0/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.9.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow only the module owner to mint tokens.
  3. Enable the current owner to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};
use odra::prelude::*;
use odra::module::SubModule;

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
...
use odra::{Address, casper_types::U256};
...

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.ownable.ensure_ownership(&self.env().caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L9-L10 - A constructor is an excellent place to initialize both modules at once.
  • L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.
  • L49-L51 - The same is done with the ownable module.
  • L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.0/tutorials/pauseable/index.html b/docs/docs/0.9.0/tutorials/pauseable/index.html new file mode 100644 index 000000000..1e74994bf --- /dev/null +++ b/docs/docs/0.9.0/tutorials/pauseable/index.html @@ -0,0 +1,17 @@ + + + + + +Pausable | Odra + + + + + +
+
Version: 0.9.0

Pausable

The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.

Code

As always, we will start with defining functionalities of our module.

  1. Check the state - is it paused or not.
  2. State guards - a contract should stop execution if is in a state we don't expect.
  3. Switch the state.

Events and Error

There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way.

Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser.

pauseable.rs
use odra::prelude::*;
use odra::Address;

#[odra::odra_error]
pub enum Error {
PausedRequired = 1_000,
UnpausedRequired = 1_001,
}

#[odra::event]
pub struct Paused {
pub account: Address
}

#[odra::event]
pub struct Unpaused {
pub account: Address
}

Module definition

The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused.

pauseable.rs
use odra::Var;
...

#[odra::module(events = [Paused, Unpaused])]
pub struct Pausable {
is_paused: Var<bool>
}

Checks and guards

Now, let's move to state checks and guards.

pauseable.rs
impl Pausable {
pub fn is_paused(&self) -> bool {
self.is_paused.get_or_default()
}

pub fn require_not_paused(&self) {
if self.is_paused() {
self.env().revert(Error::UnpausedRequired);
}
}

pub fn require_paused(&self) {
if !self.is_paused() {
self.env().revert(Error::PausedRequired);
}
}
}
  • L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.
  • L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.
  • L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused.
  • L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused.

Actions

Finally, we will add the ability to switch the module state.

pauseable.rs
impl Pausable {
pub fn pause(&mut self) {
self.require_not_paused();
self.is_paused.set(true);

self.env().emit_event(Paused {
account: self.env().caller()
});
}

pub fn unpause(&mut self) {
self.require_paused();
self.is_paused.set(false);

self.env().emit_event(Unpaused {
account: self.env().caller()
});
}
}

pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused).

Pausable counter

In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused).

pauseable.rs
...
use odra::SubModule;
...

#[odra::module]
pub struct PausableCounter {
value: Var<u32>,
pauseable: SubModule<Pausable>
}

#[odra::module]
impl PausableCounter {
pub fn increment(&mut self) {
self.pauseable.require_not_paused();

let new_value = self.value.get_or_default() + 1;
self.value.set(new_value);
}

pub fn pause(&mut self) {
self.pauseable.pause();
}

pub fn unpause(&mut self) {
self.pauseable.unpause();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::host::{Deployer, NoArgs};

#[test]
fn increment_only_if_unpaused() {
let test_env = odra_test::env();
let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);
contract.increment();
contract.pause();

assert_eq!(
contract.try_increment().unwrap_err(),
Error::UnpausedRequired.into()
);
assert_eq!(contract.get_value(), 1);
}
}

As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/advanced/advanced-storage/index.html b/docs/docs/0.9.1/advanced/advanced-storage/index.html new file mode 100644 index 000000000..281265d79 --- /dev/null +++ b/docs/docs/0.9.1/advanced/advanced-storage/index.html @@ -0,0 +1,18 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 0.9.1

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values.

Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + ToBytes + FromBytes + CLTyped
{
value: Var<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, a Mapping is a key-value storage system where the key is associated with a value. +In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute.

However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{casper_types::U256, Mapping, UnwrapOrRevert};
use odra::prelude::*;
use crate::owned_token::OwnedToken;

#[odra::module]
pub struct Mappings {
strings: Mapping<(String, u32, String), String>,
tokens: Mapping<String, OwnedToken>
}

#[odra::module]
impl Mappings {

...

pub fn total_supply(&mut self, token_name: String) -> U256 {
self.tokens.module(&token_name).total_supply()
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let opt_string = self.strings.get(&(key1, key2, key3));
opt_string.unwrap_or_revert(&self.env())
}
}

As you can see, a Mapping key can consist of a tuple of values, not limited to a single value.

note

Accessing Odra modules differs from accessing regular values such as strings or numbers.

Firstly, within a Mapping, you don't encapsulate the module with Submodule.

Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Address, casper_types::U512, Sequence, Mapping};
use odra::prelude::*;
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
counter: Sequence<u32>,
tokens: Mapping<(String, String), Token>,
}

impl AdvancedStorage {
pub fn current_value(&self) -> u32 {
self.counter.get_current_value()
}

pub fn increment_and_get(&mut self) -> u32 {
self.counter.next_value()
}

pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {
let token = self.tokens.module(&(token_name, creator));
token.balance_of(&address)
}

pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {
let mut token = self.tokens.module(&(token_name, creator));
token.mint(amount, to);
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:

  1. Odra offers a Sequence module, enabling contracts to store and increment a single value.
  2. Mappings support composite keys expressed as tuples and can store modules as values.

Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/advanced/attributes/index.html b/docs/docs/0.9.1/advanced/attributes/index.html new file mode 100644 index 000000000..c8185c041 --- /dev/null +++ b/docs/docs/0.9.1/advanced/attributes/index.html @@ -0,0 +1,20 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 0.9.1

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that +allows developers to embed common checks into function definitions in a readable and reusable manner. +These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U256 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env.revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env()
.emit_event(Deposit {
address: caller,
amount
});
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Example

#[odra::module]
pub struct NonReentrantCounter {
counter: Var<u32>
}

#[odra::module]
impl NonReentrantCounter {
#[odra(non_reentrant)]
pub fn count_ref_recursive(&mut self, n: u32) {
if n > 0 {
self.count();
ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);
}
}
}

impl NonReentrantCounter {
fn count(&mut self) {
let c = self.counter.get_or_default();
self.counter.set(c + 1);
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::{host::{Deployer, NoArgs}, ExecutionError};

#[test]
fn ref_recursion_not_allowed() {
let test_env = odra_test::env();
let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);

let result = contract.count_ref_recursive(11);
assert_eq!(result, ExecutionError::ReentrantCall.into());
}
}

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/advanced/building-manually/index.html b/docs/docs/0.9.1/advanced/building-manually/index.html new file mode 100644 index 000000000..2cacd1a4d --- /dev/null +++ b/docs/docs/0.9.1/advanced/building-manually/index.html @@ -0,0 +1,28 @@ + + + + + +Building contracts manually | Odra + + + + + +
+
Version: 0.9.1

Building contracts manually

cargo odra is a great tool to build and test your contracts, but sometimes +a better control over the parameters that are passed to the cargo +or the compiler is needed.

This is especially useful when the project has multiple features, and there is a need +to switch between them during the building and testing.

Knowing that cargo odra is a simple wrapper around cargo, it is easy to replicate +the same behavior by using cargo directly.

Building the contract manually

To build the contract manually, cargo odra uses the following command:

ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract
info

Odra uses the environment variable ODRA_MODULE to determine which contract to build.

Assuming that project's crate is named my_project, this command will build +the my_contract contract in release mode and generate the wasm file. +The file will be put into the target/wasm32-unknown-unknown/release directory under +the name my_project_build_contract.wasm.

The Odra Framework expects the contracts to be placed in the wasm directory, and +to be named correctly, so the next step would be to move the file:

mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm

Optimizing the contract

To lower the size of the wasm file, cargo odra uses the wasm-strip tool:

wasm-strip wasm/my_contract.wasm

To further optimize the wasm file, the wasm-opt tool is also used.

wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
danger

This step is required, as the wasm file generated by the Rust compiler is not +fully compatible with the Casper execution engine.

Running the tests manually

To run the tests manually, Odra needs to know which backend to use. +To run tests agains Casper backend, the following command needs to be used:

ODRA_BACKEND=casper cargo test

Wrapping up

Let's say we want to build the my_contract in debug mode, run the tests against the +casper backend and use the my-own-allocator feature from our my_project project.

To do that, we can use the following set of commands:

ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract
mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm
wasm-strip wasm/my_contract.wasm
wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
ODRA_BACKEND=casper cargo test --features my-own-allocator
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/advanced/delegate/index.html b/docs/docs/0.9.1/advanced/delegate/index.html new file mode 100644 index 000000000..d4be38a59 --- /dev/null +++ b/docs/docs/0.9.1/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 0.9.1

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use crate::{erc20::Erc20, ownable::Ownable};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
fn approve(&mut self, spender: Address, amount: U256);
fn name(&self) -> String;
fn symbol(&self) -> String;
fn decimals(&self) -> u8;
fn total_supply(&self) -> U256;
fn balance_of(&self, owner: Address) -> U256;
fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct DeFiPlatform {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>,
exchange: SubModule<Exchange>
}

#[odra::module]
impl DeFiPlatform {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
}

to self.exchange {
fn swap(&mut self, sender: Address, recipient: Address);
fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/advanced/storage-layout/index.html b/docs/docs/0.9.1/advanced/storage-layout/index.html new file mode 100644 index 000000000..a87ee34ca --- /dev/null +++ b/docs/docs/0.9.1/advanced/storage-layout/index.html @@ -0,0 +1,44 @@ + + + + + +Storage Layout | Odra + + + + + +
+
Version: 0.9.1

Storage Layout

Odra's innovative modular design necessitates a unique storage layout. This +article explains step-by-step Odra's storage layout.

Casper VM Perspective

The Casper Execution Engine (VM) enables the storage of data in named keys or +dictionaries. However, a smart contract has a limited number of named keys, +making it unsuitable for storing substantial data volumes. Odra resolves this +issue by storing all user-generated data in a dictionary called state. This +dictionary operates as a key-value store, where keys are strings with a maximum +length of 64 characters, and values are arbitrary byte arrays.

Here is an example of what the interface for reading and writing data could look +like:

pub trait CasperStorage {
fn read(key: &str) -> Option<Vec<u8>>;
fn write(key: &str, value: Vec<u8>);
}

Odra Perspective

Odra was conceived with modularity and code reusability in mind. Additionally, +we aimed to streamline storage definition through the struct object. Consider +this straightforward storage definition:

#[odra::module]
pub struct Token {
name: Var<String>,
balances: Mapping<Address, U256>
}

The Token structure contains two fields: name of type String and +balances, which functions as a key-value store with Address as keys and +U256 as values.

The Token module can be reused in another module, as demonstrated in a more +complex example:

#[odra::module]
pub struct Loans {
lenders: SubModule<Token>,
borrowers: SubModule<Token>,
}

The Loans module has two fields: lenders and borrowers, both of which have +the same storage layout as defined by the Token module. Odra guarantees that +lenders and borrowers are stored under distinct keys within the storage +dictionary.

Both Token and Loans serve as examples to show how Odra's storage layout +operates.

Key generation.

Every element of a module (struct) with N elements is associated with an index +ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an +element of a module is another module (SubModule<...>), the associated index +serves as a prefix for the indexes of the inner module.

While this may initially appear complex, it is easily understood through an +example. In the example, indexes are presented as bytes, reflecting the actual +implementation.

Loans {
lenders: Token { // prefix: 0x0000
name: 0, // key: 0x0000_0000
balances: 1 // key: 0x0000_0001
},
borrowers: Token { // prefix: 0x0001
name: 0, // key: 0x0001_0000
balances: 1 // key: 0x0001_0001
}
}

Additionally, it's worth mentioning how Mapping's keys are used in the +storage. They are simply concatenated with the index of the module, as +demonstrated in the example.

For instance, triggering borrowers.balances.get(0x1234abcd) would result in a +key:

0x0001_0001_1234_abcd

Finally, the key must be hashed to fit within the 64-character limit and then +encoded in hexadecimal format.

Value serialization

Before being stored in the storage, each value is serialized into bytes using +the CLType serialization method and subsequently encapsulated with Casper's +Bytes types.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/advanced/using-different-allocator/index.html b/docs/docs/0.9.1/advanced/using-different-allocator/index.html new file mode 100644 index 000000000..a242bf7d7 --- /dev/null +++ b/docs/docs/0.9.1/advanced/using-different-allocator/index.html @@ -0,0 +1,25 @@ + + + + + +Memory allocators | Odra + + + + + +
+
Version: 0.9.1

Memory allocators

When compiling contracts to wasm, your code needs to be no-std. +This means that instead of using the standard library, the core +crate will be linked to your code. This crate does not contain +a memory allocator.

Happily, Odra automatically enables allocator - from our tests +the one developed by ink! +seems to be the best.

Using a different allocator

If the default allocator does not suit your needs, or you use a crate that +already provides an allocator, you can disable the default allocator by enabling +the disable-allocator feature in the odra dependency in your project:

[dependencies]
odra = { path = "../odra", features = ["disable-allocator"] }

If you want to have a better control over the features that are enabled +during the building and tests, see the next article on building manually.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/backends/casper/index.html b/docs/docs/0.9.1/backends/casper/index.html new file mode 100644 index 000000000..feca533c1 --- /dev/null +++ b/docs/docs/0.9.1/backends/casper/index.html @@ -0,0 +1,50 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 0.9.1

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event].

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling self.env().attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, +you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Deploying a contract to Casper network

There would be no point in writing a contract if you couldn't deploy it to the blockchain. +You can do it in two ways: provided by the Casper itself: using the casper-client tool +or using the Odra's Livenet integration.

Let's explore the first option to better understand the process.

note

If you wish, you can skip the following section and jump to the Livenet integration.

WASM arguments

When deploying a new contract you can pass some arguments to it. +Every contract written in Odra expects those arguments to be set:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Additionally, if required by the contract, you can pass constructor arguments.

When working with the test env via cargo odra or when using +Livenet integration this is handled automatically. However, if you rather use +casper-client directly, you have to pass them manually:

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. U512 type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK. See an example in the Tutorial section.

Execution

First thing Odra does with your code, is similar to the one used in OdraVM - +a list of entrypoints is generated, thanks to the #[odra::module] attribute.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/backends/livenet/index.html b/docs/docs/0.9.1/backends/livenet/index.html new file mode 100644 index 000000000..c963c481c --- /dev/null +++ b/docs/docs/0.9.1/backends/livenet/index.html @@ -0,0 +1,49 @@ + + + + + +Livenet | Odra + + + + + +
+
Version: 0.9.1

Livenet

The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local +test node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend +to handle the deployment of your contracts to the real blockchain.

Furthermore, it is implemented in a similarly to Casper or OdraVM, +however, it uses a real blockchain to deploy contracts and store the state. +This lets us use Odra to deploy and test contracts on a real blockchain, but +on the other hand, it comes with some limitations on what can be done in the tests.

The main differences between Livenet and e.g. CasperVM backend are:

  • Real CSPR tokens are used to deploy and call contracts. This also means that we need to +pay for each contract deployment and each contract call. Of course, we can use the faucet +to get some tokens for testing purposes, but we still need to specify the amount needed +for each action.
  • The contract state is stored on the real blockchain, so we can't just reset the state - +we can redeploy the contract, but we can't remove the old one.
  • Because of the above, we can load the existing contracts and use them in the tests.
  • We have no control over the block time. This means that for example, advance_block_time function +is implemented by waiting for the real time to pass.

This is also a cause for the fact that the Livenet backend cannot be (yet) used for running +the regular Odra tests. Instead, we can create integration tests or binaries which will +use a slightly different workflow to test the contracts.

Setup

To use Livenet backend, we need to provide Odra with some information - the network address, our private +key and the name of the chain we want to use. Optionally, we can add multiple private keys to use +more than one account in our tests. Those values are passed using environment variables. We can use .env +file to store them - let's take a look at an example .env file, created from the .env.sample file from +examples folder:

# Path to the secret key of the account that will be used
# to deploy the contracts.
# We're using .keys folder so we don't accidentally commit
# the secret key to the repository.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777

# Chain name of the network. Known values:
# - integration-test
ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test

# Paths to the secret keys of the additional accounts.
# Main secret key will be 0th account.
ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem
ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem

With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find +a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. +Let's go through the code:

fn main() {
// Similar to the OdraVM backend, we need to initialize
// the environment:
let env = odra_casper_livenet_env::env();

// Most of the for the host env works the same as in the
// OdraVM backend.
let owner = env.caller();
// Addresses are the real addresses on the blockchain,
// so we need to provide them
// if we did not import their secret keys.
let recipient =
"hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";
let recipient = Address::from_str(recipient).unwrap();

// Arguments for the contract init method.
let name = String::from("Plascoin");
let symbol = String::from("PLS");
let decimals = 10u8;
let initial_supply: U256 = U256::from(10_000);

// The main difference between other backends - we need to specify
// the gas limit for each action.
// The limit will be used for every consecutive action
// until we change it.
env.set_gas(100_000_000_000u64);

// Deploy the contract. The API is the same as in the OdraVM backend.
let init_args = Erc20InitArgs {
name,
symbol,
decimals,
initial_supply: Some(initial_supply)
};
let mut token = Erc20HostRef::deploy(env, init_args);

// We can now use the contract as we would in the OdraVM backend.
println!("Token address: {}", token.address().to_string());

// Uncomment to load existing contract.
// let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
// let address = Address::from_str(address).unwrap();
// We use the Livenet-specific `load` method to load the contract
// that is already deployed.
// let mut token = Erc20Deployer::load(env, address);

// Non-mutable calls are free! Neat, huh? More on that later.
println!("Token name: {}", token.name());

// The next call is mutable, but the cost is lower that the deployment,
// so we change the amount of gas
env.set_gas(3_000_000_000u64);
token.transfer(recipient, U256::from(1000));

println!("Owner's balance: {:?}", token.balance_of(owner));
println!("Recipient's balance: {:?}", token.balance_of(recipient));
}
note

The above example is a rust binary, not a test. Note that it is also added as a section of the +Cargo.toml file:

[bin]
name = "erc20_on_livenet"
path = "src/bin/erc20_on_livenet.rs"
required-features = ["livenet"]
test = false

Usage

To run the above code, we simply need to run the binary with the livenet feature enabled:

cargo run --bin erc20_on_livenet --features=livenet
note

Before executing the binary, make sure you built a wasm file.

A part of a sample output should look like this:

...
💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
💁 INFO : Deploy "65b1a5d21..." successfully executed.
Owner's balance: 4004
Recipient's balance: 4000

Those logs are a result of the last 4 lines of the above listing. +Each deployment or a call to the blockchain will be noted and will take some time to execute. +We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant +and cost us nothing. How it is possible?

info

You can see the deployment on http://cspr.live/ - the transfer from the example +can be seen here.

How Livenet backend works

All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. +It is possible however to query the state of the blockchain for free.

This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the +node is the current state. This is why the balance_of call was almost instant and free.

Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract +(see Cross Calls), it is executed offline and +node is used for the state query only. However, the Livenet needs to know the connection between the contracts +and the code, so make sure to deploy or load already deployed contracts

Multiple environments

It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, +multiple nodes or even multiple chains.

To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. +Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file +has to be used first. If your integration.env file has a value that IS present in the .env file, it will +override the value from the .env file.

ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene

To sum up - this command will firstly load the integration.env file and then load the missing values from .env file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/backends/odra-vm/index.html b/docs/docs/0.9.1/backends/odra-vm/index.html new file mode 100644 index 000000000..083caeb54 --- /dev/null +++ b/docs/docs/0.9.1/backends/odra-vm/index.html @@ -0,0 +1,26 @@ + + + + + +OdraVM | Odra + + + + + +
+
Version: 0.9.1

OdraVM

The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time - +simply use your IDE's debug functionality.

Usage

The OdraVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

OdraVM consists of two main parts: the Contract Register and the State.

The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address.

Contracts and Test Env functions can modify the State of the OdraVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the OdraVM State holds only the current state of the OdraVM. +Thanks to this and the fact that we do not need the blockchain itself, +OdraVM starts instantly and runs the tests in the native speed.

Execution

When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, OdraVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/backends/what-is-a-backend/index.html b/docs/docs/0.9.1/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..849845d0e --- /dev/null +++ b/docs/docs/0.9.1/backends/what-is-a-backend/index.html @@ -0,0 +1,28 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 0.9.1

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like OdraVM, +a complete virtual machine, spinning up a blockchain for you - like CasperVM, +or even a real blockchain - when using Livenet backend.

Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Host Env

Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/cargo-odra/index.html b/docs/docs/0.9.1/basics/cargo-odra/index.html new file mode 100644 index 000000000..9da15edbe --- /dev/null +++ b/docs/docs/0.9.1/basics/cargo-odra/index.html @@ -0,0 +1,37 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 0.9.1

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them with various configurations.

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This creates a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

The third available template is workspace, which creates a workspace with two projects, similar to the one created +with the full template.

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 0.8.0 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it creates a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This creates a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

The most used command during the development of your project should be this one:

cargo odra test

It runs your tests against Odra's MockVM. It is substantially faster than CasperVM +and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra builds the project, generates the wasm files, +spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat.

Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. +This is why OdraVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build

If the build process finishes successfully, wasm files will be located in wasm folder. +Notice, that this command does not require the -b option.

If you want to build specific contract, you can use -c option:

cargo odra build -c counter # you pass many comma separated contracts

Generating contract schema

If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command:

cargo odra schema 

This generates a schema file in JSON format for all your contracts and places them in the resources folder. +If the resources folder does not exist, it creates the folder for you.

Like with the build command, you can use the -c option to generate a schema for a specific contract.

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/casper-contract-schema/index.html b/docs/docs/0.9.1/basics/casper-contract-schema/index.html new file mode 100644 index 000000000..e89835b79 --- /dev/null +++ b/docs/docs/0.9.1/basics/casper-contract-schema/index.html @@ -0,0 +1,18 @@ + + + + + +Casper Contract Schema | Odra + + + + + +
+
Version: 0.9.1

Casper Contract Schema

Working in collaboration with the Casper Association we designed the Casper Contract Schema (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability.

Odra and CCS

There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory.

note

If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.

src/contract.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(
// the name of the contract, default is the module name
name = "MyContract",
// the version of the contract, default is the version of the crate
version = "0.1.0",
// events that the contract can emit, collected recursively if submodules are used
events = [
Created,
Updated
],
// the error enum the contract can revert with, collected recursively if submodules are used
errors = MyErrors
)]
pub struct MyContract {
name: Var<String>,
owner: Var<Address>,
}

#[odra::module]
impl MyContract {
/// Initializes the contract, sets the name and owner and emits an event
pub fn init(&mut self, name: String, owner: Address) {
self.name.set(name.clone());
self.owner.set(owner.clone());
self.env().emit_event(Created { name });
}

/// Updates the name of the contract and emits an event
pub fn update(&mut self, name: String) {
self.name.set(name.clone());
self.env().emit_event(Updated { name });
}

/// Returns the data of the contract
pub fn get_data(&self) -> Data {
Data {
name: self.name.get_or_default(),
owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),
}
}
}

// The struct will we visible in the schema in the types section
#[odra::odra_type]
pub struct Data {
name: String,
owner: Address,
}

// The enum variants will we visible in the schema in the errors section
#[odra::odra_error]
pub enum MyErrors {
/// The owner is invalid
InvalidOwner,
/// The name is invalid
InvalidName,
}

// The struct will we visible in the schema in the types and events section
#[odra::event]
pub struct Updated {
name: String,
}

// The struct will we visible in the schema in the types section and events section
#[odra::event]
pub struct Created {
name: String,
}

Generating the Schema

To generate the schema run the following cargo-odra command:

cargo odra schema # or pass -c flag to generate the schema for a specific contract

Schema Output

The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:

resources/my_contract_schema.json
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "MyContract",
"contract_version": "0.1.0",
"types": [
{
"struct": {
"name": "Created",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
},
{
"struct": {
"name": "Data",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
},
{
"name": "owner",
"description": null,
"ty": "Key"
}
]
}
},
{
"struct": {
"name": "Updated",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
}
],
"errors": [
{
"name": "InvalidName",
"description": "The name is invalid",
"discriminant": 1
},
{
"name": "InvalidOwner",
"description": "The owner is invalid",
"discriminant": 0
}
],
"entry_points": [
{
"name": "update",
"description": "Updates the name of the contract and emits an event",
"is_mutable": true,
"arguments": [
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "get_data",
"description": "Returns the data of the contract",
"is_mutable": false,
"arguments": [],
"return_ty": "Data",
"is_contract_context": true,
"access": "public"
}
],
"events": [
{
"name": "Created",
"ty": "Created"
},
{
"name": "Updated",
"ty": "Updated"
}
],
"call": {
"wasm_file_name": "MyContract.wasm",
"description": "Initializes the contract, sets the name and owner and emits an event",
"arguments": [
{
"name": "odra_cfg_package_hash_key_name",
"description": "The arg name for the package hash key name.",
"ty": "String",
"optional": false
},
{
"name": "odra_cfg_allow_key_override",
"description": "The arg name for the allow key override.",
"ty": "Bool",
"optional": false
},
{
"name": "odra_cfg_is_upgradable",
"description": "The arg name for the contract upgradeability setting.",
"ty": "Bool",
"optional": false
},
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
},
{
"name": "owner",
"description": null,
"ty": "Key",
"optional": false
}
]
}
}

Schema Fields

  • casper_contract_schema_version is the version of the schema. +toolchain is the version of the Rust compiler used to compile the contract.
  • Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.
  • contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.
  • contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.
  • types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.
  • errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.
  • entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.
  • events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.
  • The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/communicating-with-host/index.html b/docs/docs/0.9.1/basics/communicating-with-host/index.html new file mode 100644 index 000000000..3552121a5 --- /dev/null +++ b/docs/docs/0.9.1/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 0.9.1

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module]
pub struct HostContract {
name: Var<String>,
created_at: Var<u64>,
created_by: Var<Address>
}

#[odra::module]
impl HostContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(self.env().get_block_time());
self.created_by.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are using self.env(). It is an implementation of Module::env(), autogenerated +by #[odra::module] attribute. The function returns a reference to the ContractEnv (you can read more in +the Backend section). This is a structure that provides access to the host functions and variables.

In this example, we use two of them:

  • get_block_time() - returns the current block time as u64.
  • caller() - returns an Odra Address of the caller (this can be an external caller or another contract).
info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/cross-calls/index.html b/docs/docs/0.9.1/basics/cross-calls/index.html new file mode 100644 index 000000000..46bdf94db --- /dev/null +++ b/docs/docs/0.9.1/basics/cross-calls/index.html @@ -0,0 +1,22 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 0.9.1

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::prelude::*;
use odra::{Address, UnwrapOrRevert, Var};

#[odra::module]
pub struct CrossContract {
pub math_engine: Var<Address>
}

#[odra::module]
impl CrossContract {
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine;

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To perform a cross-contact call, we use the {{ModuleName}}ContractRef that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)

Contract Ref

We mentioned HostRef already in our Testing article - a host side reference to already deployed contract.

In the module context we use a ContractRef instead, to call other contracts.

Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, +by the #[odra::module] attribute.

To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above.

The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract.

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call:

AdderContractRef::new(self.env(), address).add(3, 5)

Loading the contract

Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test +our contracts in Livenet backend. We can load the contract using load method on the Deployer:

examples/bin/erc20_on_livenet.rs
fn _load(env: &HostEnv) -> Erc20HostRef {
let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
let address = Address::from_str(address).unwrap();
<Erc20HostRef as HostRefLoader>::load(env, address)
}

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};
use odra::host::{Deployer, HostRef, NoArgs};

#[test]
fn test_cross_calls() {
let test_env = odra_test::env();
let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);
let cross_contract = CrossContractHostRef::deploy(
&test_env,
CrossContractInitArgs {
math_engine_address: *math_engine_contract.address()
}
);
assert_eq!(cross_contract.add_using_another(), 8);
}
}

Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize.

#[cfg(test)]
mod tests {
use super::*;
use odra::{Address, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_ext() {
let test_env = odra_test::env();
let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)
assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address(test_env: &HostEnv) -> Address {
let contract = MathEngineHostRef::deploy(test_env, NoArgs);
*contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/directory-structure/index.html b/docs/docs/0.9.1/basics/directory-structure/index.html new file mode 100644 index 000000000..4ef63458e --- /dev/null +++ b/docs/docs/0.9.1/basics/directory-structure/index.html @@ -0,0 +1,26 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 0.9.1

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── rust-toolchain
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── bin/
| |── build_contract.rs
| └── build_schema.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.9.0"

[dev-dependencies]
odra-test = "0.9.0"

[build-dependencies]
odra-build = "0.9.0"

[[bin]]
name = "sample_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "sample_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also +added as a dev dependency.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

src/

This is the folder where your smart contract files live.

bin/

This is the folder where scripts that will be used to generate code or schemas live. +You don't need to modify those files, they are generated by cargo odra new command and +are used by cargo odra build, cargo odra test and cargo odra schema commands.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/errors/index.html b/docs/docs/0.9.1/basics/errors/index.html new file mode 100644 index 000000000..cb7896c10 --- /dev/null +++ b/docs/docs/0.9.1/basics/errors/index.html @@ -0,0 +1,24 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 0.9.1

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(errors = Error)]
pub struct OwnedContract {
name: Var<String>,
owner: Var<Address>
}

#[odra::odra_error]
pub enum Error {
OwnerNotSet = 1,
NotAnOwner = 2
}

#[odra::module]
impl OwnedContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = self.env().caller();
if caller != self.owner() {
self.env().revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using the #[odra::odra_error] attribute to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
self.env().revert(Error::NotAnOwner)

To register errors, add the errors inner attribute to the struct's #[odra::module] attribute and pass the error type as the value. The registered errors will be present in the contract schema.

Defining an error in Odra, you must keep in mind a few rules:

  1. An error should be a field-less enum.
  2. The enum must be annotated with #[odra::odra_error].
  3. Avoid implicit discriminants.
note

In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!

Testing errors

Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:

examples/src/features/handling_errors.rs
#[cfg(test)]
mod tests {
use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};
use odra::host::Deployer;
use odra::prelude::*;

#[test]
fn test_owner_error() {
let test_env = odra_test::env();
let owner = test_env.get_account(0);
let not_an_owner = test_env.get_account(1);

test_env.set_caller(owner);
let init_args = OwnedContractInitArgs {
name: "OwnedContract".to_string()
};
let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);

test_env.set_caller(not_an_owner);
assert_eq!(
owned_contract.try_change_name("NewName".to_string()),
Err(Error::NotAnOwner.into())
);
}
}

Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult. +OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and +and safe its safe version: try_name, try_owner, try_change_name.

In our example, we are calling try_change_name and expecting an error to be thrown. +For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, +we need to convert our custom error to OdraError using Into::into().

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/events/index.html b/docs/docs/0.9.1/basics/events/index.html new file mode 100644 index 000000000..178e846cf --- /dev/null +++ b/docs/docs/0.9.1/basics/events/index.html @@ -0,0 +1,18 @@ + + + + + +Events | Odra + + + + + +
+
Version: 0.9.1

Events

In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:

examples/src/features/events.rs
use odra::prelude::*;
use odra::Address;

#[odra::module(events = [PartyStarted])]
pub struct PartyContract;

#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64
}

#[odra::module]
impl PartyContract {
pub fn init(&self) {
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, add the #[odra::event] attribute like this:

examples/src/features/events.rs
#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64,
}

To emit an event, we use the emit_event function from the ContractEnv, passing the event as an argument:

examples/src/features/events.rs
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});

To determine all the events at compilation time to register them once the contract is deployed. To register events, add an events inner attribute to the struct's #[odra::module] attribute. The registered events will also be present in the contract schema.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use super::{PartyContractHostRef, PartyStarted};
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

#[test]
fn test_party() {
let test_env: HostEnv = odra_test::env();
let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);
test_env.emitted_event(
party_contract.address(),
&PartyStarted {
caller: test_env.get_account(0),
block_time: 0
}
);
// If you do not want to check the exact event, you can use `emitted` function
test_env.emitted(party_contract.address(), "PartyStarted");
// You can also check how many events were emitted.
assert_eq!(test_env.events_count(party_contract.address()), 1);
}

To explore more event testing functions, check the HostEnv documentation.

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/flipper-internals/index.html b/docs/docs/0.9.1/basics/flipper-internals/index.html new file mode 100644 index 000000000..1234c3d3b --- /dev/null +++ b/docs/docs/0.9.1/basics/flipper-internals/index.html @@ -0,0 +1,38 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 0.9.1

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Var;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Var, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Var<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the attribute - all functions defined there, even marked +with pub will be not callable.

The function named init is the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error. The init function is optional, +if your contract does not need any initialization, you can skip it.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated +by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, +as the second argument of the deploy function, we pass NoArgs - one of the implementations of +the InitArgs trait provided with the framework.

The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/modules/index.html b/docs/docs/0.9.1/basics/modules/index.html new file mode 100644 index 000000000..c13f74420 --- /dev/null +++ b/docs/docs/0.9.1/basics/modules/index.html @@ -0,0 +1,21 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 0.9.1

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to the #[odra::module] attribute. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;
use odra::module::SubModule;
use odra::prelude::*;

#[odra::module]
pub struct ModulesContract {
pub math_engine: SubModule<MathEngine>
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}
info

To use a module as a component of another module, you need to use the SubModule type. This is a special type +that crates a keyspace (read more in Storage Layout) and provide access to its public methods.

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the OwnedToken example in the main Odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
#[cfg(test)]
mod tests {
use super::ModulesContractHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);
assert_eq!(modules_contract.add_using_module(), 8);
}
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/native-token/index.html b/docs/docs/0.9.1/basics/native-token/index.html new file mode 100644 index 000000000..d21528b22 --- /dev/null +++ b/docs/docs/0.9.1/basics/native-token/index.html @@ -0,0 +1,25 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 0.9.1

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::prelude::*;
use odra::{casper_types::U512, module::Module};

#[odra::module]
pub struct PublicWallet;

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {}

pub fn withdraw(&mut self, amount: &U512) {
self.env().transfer_tokens(&self.env().caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/contracts/tlw.rs in the odra main repository.

You can see a new attribute used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from ContractEnv::transfer_tokens(). +It does exactly what you are expecting it to do - it transfers native tokens from the contract to the +specified address.

Testing

To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function - +balance_of:

examples/src/features/native_token.rs
#[cfg(test)]
mod tests {
use super::PublicWalletHostRef;
use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);
assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());

my_contract.with_tokens(U512::from(100)).deposit();
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));

my_contract.withdraw(U512::from(25));
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/odra-toml/index.html b/docs/docs/0.9.1/basics/odra-toml/index.html new file mode 100644 index 000000000..96ebb0121 --- /dev/null +++ b/docs/docs/0.9.1/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 0.9.1

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
fqn = "sample::Flipper"

The fqn (Fully Qualified Name) is used by the building tools to locate and build the contract. +The last segment of the fqn will be used as the name for your contract - the generated wasm file will +be in the above case named flipper.wasm.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
fqn = "sample::Flipper"

[[contracts]]
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/storage-interaction/index.html b/docs/docs/0.9.1/basics/storage-interaction/index.html new file mode 100644 index 000000000..deb1a84e2 --- /dev/null +++ b/docs/docs/0.9.1/basics/storage-interaction/index.html @@ -0,0 +1,37 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 0.9.1

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Var

The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Var type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
#[odra::module]
pub struct DogContract {
barks: Var<bool>,
weight: Var<u32>,
name: Var<String>,
walks: Var<Vec<u32>>,
}

You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
use odra::Var;

#[odra::module]
impl DogContract {
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Var is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::{Mapping, Var};

#[odra::module]
pub struct DogContract2 {
name: Var<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Vars section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Var working together:

core/src/list.rs
use odra::{List, Var};

pub struct List<T> {
values: Mapping<u32, T>,
index: Var<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
#[odra::module]
pub struct DogContract3 {
name: Var<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type:

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}

#[odra_type] is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type. +CLType of a custom type is CLType::Any, except for an unit-only enum, which is CLType::U8.

unit_only_enum.rs
enum Enum {
Foo = 3,
Bar = 2,
Baz = 1,
}
note

Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute .

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/basics/testing/index.html b/docs/docs/0.9.1/basics/testing/index.html new file mode 100644 index 000000000..7de902db1 --- /dev/null +++ b/docs/docs/0.9.1/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 0.9.1

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{List, Var};

#[cfg(test)]
mod tests {
use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn init_test() {
let test_env = odra_test::env();
let init_args = DogContract3InitArgs {
name: "DogContract".to_string()
};
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The first interesting thing you may notice is placed the import section.

use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

We are using super to import the DogContract3HostRef and DogContract3InitArgs from the parent module. +{{ModuleName}}HostRef and {{ModuleName}}InitArgs are types that was generated for us by Odra.

DogContract3HostRef is a reference to the contract that we can use to interact with it (call entrypoints) +and implements HostRef trait.

DogContract3InitArgs is a struct that we use to initialize the contract and implements InitArgs trait. +Considering the contract initialization, there three possible scenarios:

  1. The contract has a constructor with arguments, then Odra creates a struct named {{ModuleName}}InitArgs.
  2. The contract has a constructor with no arguments, then you can use odra::host::NoArgs.
  3. The contract does not have a constructor, then you can use odra::host::NoArgs. +All of those structs implement the odra::host::InitArgs trait, required to conform to the +Deployer::deploy method signature.

The other import is odra::host::Deployer. This is a trait is used to deploy the contract and give us a reference to it.

Let's take a look at the test itself. How to obtain a reference to the contract? +{{ModuleName}}HostRef implements the Deployer trait, which provides the deploy method:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with the odra::module attribute are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

HostEnv

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};
use odra::{host::{Deployer, HostEnv}, prelude::*};

#[test]
fn env() {
let test_env: HostEnv = odra_test::env();
test_env.set_caller(test_env.get_account(0));
let init_args = TestingContractInitArgs {
name: "MyContract".to_string()
};
let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);
let creator = testing_contract.created_by();
test_env.set_caller(test_env.get_account(1));
let init_args = TestingContractInitArgs {
name: "MyContract2".to_string()
};
let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);
let creator2 = testing_contract2.created_by();
assert_ne!(creator, creator2);
}
}

In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). +Next, we are deploying two instances of the same contract, but we're using HostEnv::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller() +the function we are calling inside the contract.

HostEnv comes with a set of functions that will let you write better tests:

  • fn set_caller(&self, address: Address) - you've seen it in action just now
  • fn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given address
  • fn advance_block_time(&self, time_diff: u64) - increases the current value of block_time
  • fn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; +by default, you start with the 0-th account
  • fn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract

Full list of functions can be found in the HostEnv documentation.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/category/advanced/index.html b/docs/docs/0.9.1/category/advanced/index.html new file mode 100644 index 000000000..866864e3c --- /dev/null +++ b/docs/docs/0.9.1/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/category/backends/index.html b/docs/docs/0.9.1/category/backends/index.html new file mode 100644 index 000000000..49f56c45d --- /dev/null +++ b/docs/docs/0.9.1/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/category/basics/index.html b/docs/docs/0.9.1/category/basics/index.html new file mode 100644 index 000000000..6eba0f1f9 --- /dev/null +++ b/docs/docs/0.9.1/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/category/examples/index.html b/docs/docs/0.9.1/category/examples/index.html new file mode 100644 index 000000000..b6e6557ab --- /dev/null +++ b/docs/docs/0.9.1/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/category/getting-started/index.html b/docs/docs/0.9.1/category/getting-started/index.html new file mode 100644 index 000000000..43036b32e --- /dev/null +++ b/docs/docs/0.9.1/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/category/migrations/index.html b/docs/docs/0.9.1/category/migrations/index.html new file mode 100644 index 000000000..933173ca5 --- /dev/null +++ b/docs/docs/0.9.1/category/migrations/index.html @@ -0,0 +1,17 @@ + + + + + +Migrations | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/category/tutorials/index.html b/docs/docs/0.9.1/category/tutorials/index.html new file mode 100644 index 000000000..317b80c97 --- /dev/null +++ b/docs/docs/0.9.1/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + +
+
Version: 0.9.1

Tutorials

The theory is good, but the practice is even better. Let's go through a few examples summing up all the Odra concepts.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/examples/odra-examples/index.html b/docs/docs/0.9.1/examples/odra-examples/index.html new file mode 100644 index 000000000..f7841c23d --- /dev/null +++ b/docs/docs/0.9.1/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 0.9.1

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/examples/using-odra-modules/index.html b/docs/docs/0.9.1/examples/using-odra-modules/index.html new file mode 100644 index 000000000..24a04ff74 --- /dev/null +++ b/docs/docs/0.9.1/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 0.9.1

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.9.0"

[dev-dependencies]
odra-test = "0.9.0"

[build-dependencies]
odra-build = "0.9.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = "0.9.0"
odra-modules = "0.9.0"

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::prelude::*;
use odra::{Address, casper_types::U256, module::SubModule};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/getting-started/flipper/index.html b/docs/docs/0.9.1/getting-started/flipper/index.html new file mode 100644 index 000000000..2eeb57c20 --- /dev/null +++ b/docs/docs/0.9.1/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 0.9.1

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Var;

/// A module definition. Each module struct consists Vars and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor, must be named `init`.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let env = odra_test::env();
let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);
let contract2 = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

Testing

To run the tests, execute the following command:

cargo odra test # or add the `-b casper` flag to run tests on the CasperVM

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/getting-started/installation/index.html b/docs/docs/0.9.1/getting-started/installation/index.html new file mode 100644 index 000000000..cc9e4ef15 --- /dev/null +++ b/docs/docs/0.9.1/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 0.9.1

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra --locked

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called my_project and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/index.html b/docs/docs/0.9.1/index.html new file mode 100644 index 000000000..598b8be30 --- /dev/null +++ b/docs/docs/0.9.1/index.html @@ -0,0 +1,19 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 0.9.1

Odra framework

Odra is a Rust-based smart contract framework for Casper Network. Odra encourages rapid development and clean, +pragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel.

It's free and open source!

What's next

See the Installation and our Flipper example to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/migrations/to-0.8.0/index.html b/docs/docs/0.9.1/migrations/to-0.8.0/index.html new file mode 100644 index 000000000..b1b0ec82a --- /dev/null +++ b/docs/docs/0.9.1/migrations/to-0.8.0/index.html @@ -0,0 +1,19 @@ + + + + + +Migration guide to v0.8.0 | Odra + + + + + +
+
Version: 0.9.1

Migration guide to v0.8.0

Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version.

This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant changes in v0.8.0 include:

  • Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only.
  • Framework internals redesign.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0.

2. Migration Steps

2.1 Add bin directory

Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory.

You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2. Update Cargo.toml

There a bunch of changes in the Cargo.toml file.

  • You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.
  • Register bins you added in the previous step.
  • Add dev-dependencies section with odra-test crate.
  • Add recommended profiles for release and dev to optimize the build process.

Below you can compare the Cargo.toml file after and before the migration to v0.8.0:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

2.2. Update Odra.toml

Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required.

[[contracts]]
fqn = "my_project::Flipper"

2.3. Update Smart Contracts

The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:

2.3.1. Update the use statements to reflect the new module structure.

  • Big integer types are now located in the odra::casper_types module.
  • odra::types::Address is now odra::Address.
  • Variable is now Var.
  • Remove odra::contract_env.
  • Remove odra::types::event::OdraEvent.
  • Remove odra::types::OdraType as it is no longer required.
  • Change odra::types::casper_types::*; to odra::casper_types::*;.

2.3.2. Some type aliases are no longer in use.

  • Balance - use odra::casper_types::U512.
  • BlockTime - use u64.
  • EventData - use odra::casper_types::bytesrepr::Bytes.

2.3.3. Consider import odra::prelude::* in your module files.

2.3.4. Flatten nested Mappings.

// Before
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<Address, Mapping<Address, U256>>
}
// After
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<(Address, Address), U256>
}

2.3.5. Update errors definitions.

execution_error! macro has been replace with OdraError derive macro.

use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.3.6. Update events definitions.

use odra::prelude::*;
use odra::Event;

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

// Emitting the event
self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});

2.3.7. Replace contract_env with self.env() in your modules.

self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes.

  • fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.
  • fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).
  • set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions.
  • fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].
  • fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.
  • fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).
  • fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.
  • functions native_token_metadata() and one_token() have been removed.

2.3.8. Wrap submodules of your module with odra::SubModule<T>.

#[odra::module(events = [Transfer])]
pub struct Erc721Token {
core: SubModule<Erc721Base>,
metadata: SubModule<Erc721MetadataExtension>,
ownable: SubModule<Ownable>
}

2.3.9. Update external contract calls.

However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()).

#[odra::external_contract]
pub trait Token {
fn balance_of(&self, owner: &Address) -> U256;
}

// Usage
TokenContractRef::new(env, token).balance_of(account)

2.3.10. Update constructors.

Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init.

2.3.11. Update UnwrapOrRevert calls.

The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter.

2.3.12. Remove #[odra(using)] attribute from your module definition.

Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required.

2.4. Update Tests

Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:

2.4.1. Contract deployment.

The way you deploy a contract has changed:

  1. You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.
  2. Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.
  3. If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.
  4. If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function.
// A contract without init args
use super::OwnableHostRef;
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

let env: HostEnv = odra_test::env();
let ownable = OwnableHostRef::deploy(&env, NoArgs)

// A contract with init args
use super::{Erc20HostRef, Erc20InitArgs};
use odra::host::{Deployer, HostEnv};

let env: HostEnv = odra_test::env();
let init_args = Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
};
let erc20 = Erc20HostRef::deploy(&env, init_args);

2.4.2. Host interactions.

  1. Replace odra::test_env with odra_test::env().
  2. The API of odra::test_env and odra_test::env() are similar, but there are some differences:
    • test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).
    • test_env::token_balance(Address) is now env.balance_of(&Address).
    • functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef.

2.4.3. Testing failing scenarios.

test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result. +try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro.

#[test]
fn transfer_from_error() {
let (env, mut erc20) = setup();

let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

assert_eq!(
erc20.try_transfer_from(owner, recipient, amount),
Err(Error::InsufficientAllowance.into())
);
}

2.4.4. Testing events.

assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. +The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options.

let env: HostEnv = odra_test::env();
let erc20 = Erc20HostRef::deploy(&env, init_args);

...

assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.8.0.

src/erc20.rs
use crate::erc20::errors::Error::*;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address, Event};

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
use super::{
errors::Error,
events::{Approval, Transfer},
Erc20HostRef, Erc20InitArgs
};
use odra::{
casper_types::U256,
host::{Deployer, HostEnv, HostRef},
prelude::*
};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

// Other tests...
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/migrations/to-0.9.0/index.html b/docs/docs/0.9.1/migrations/to-0.9.0/index.html new file mode 100644 index 000000000..c19b4cc8f --- /dev/null +++ b/docs/docs/0.9.1/migrations/to-0.9.0/index.html @@ -0,0 +1,18 @@ + + + + + +Migration guide to v0.9.0 | Odra + + + + + +
+
Version: 0.9.1

Migration guide to v0.9.0

This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version 0.7.1 and below, start with the previous guide. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant change in 0.9.0 is the way of defining custom elements namely type, events and errors.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0.

2. Migration Steps

2.1 Update build_schema.rs bin

Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2 Update smart contract code

The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes.

2.2.1. Update custom types definitions.

#[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute.

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}

2.2.2. Update errors definitions.

#[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. +Error enum should be passed as a parameter to the #[odra::module] attribute.

#[odra::module(events = [/* events go here */], errors = Error)]
pub struct Erc20 {
// fields
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.2.3. Update events definitions.

#[derive(Event)] attribute has been replace with #[odra::event] attribute.

use odra::prelude::*;
use odra::{Address, casper_types::U256};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.9.0.

src/erc20.rs
use crate::erc20::errors::Error;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer], errors = Error)]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(Error::NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(Error::InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(Error::InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
// nothing changed in the tests
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/tutorials/access-control/index.html b/docs/docs/0.9.1/tutorials/access-control/index.html new file mode 100644 index 000000000..d071951aa --- /dev/null +++ b/docs/docs/0.9.1/tutorials/access-control/index.html @@ -0,0 +1,17 @@ + + + + + +Access Control | Odra + + + + + +
+
Version: 0.9.1

Access Control

In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,

In this article we design and implement a more fine-grained access control layer.

Code

Before we start writing code, we list the functionalities of our access control layer.

  1. A Role type is used across the module.
  2. A Role can be assigned to many Addresses.
  3. Each Role may have a corresponding admin role.
  4. Only an admin can grant/revoke a Role.
  5. A Role can be renounced.
  6. A Role cannot be renounced on someone's behalf.
  7. Each action triggers an event.
  8. Unauthorized access stops contract execution.

Project Structure

access-control
├── src
│ ├── access
│ │ ├── access_control.rs
│ │ ├── events.rs
│ │ └── errors.rs
│ └── lib.rs
|── build.rs
|── Cargo.toml
└── Odra.toml

Events and Errors

There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions.

events.rs
use odra::prelude::*;
use odra::Address;
use super::access_control::Role;

#[odra::event]
pub struct RoleGranted {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleRevoked {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleAdminChanged {
pub role: Role,
pub previous_admin_role: Role,
pub new_admin_role: Role
}
  • L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.
  • L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role.
errors.rs
#[odra::odra_error]
pub enum Error {
MissingRole = 20_000,
RoleRenounceForAnotherAddress = 20_001,
}

Errors definition is straightforward - there are only two invalid states:

  1. An action is triggered by an unauthorized actor.
  2. The caller is attempting to resign the Role on someone's behalf.

Module

Now, we are stepping into the most interesting part: the module definition and implementation.

access_control.rs
use super::events::*;
use super::errors::Error;
use odra::prelude::*;
use odra::{Address, Mapping};

pub type Role = [u8; 32];

pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];

#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]
pub struct AccessControl {
roles: Mapping<(Role, Address), bool>,
role_admin: Mapping<Role, Role>
}

#[odra::module]
impl AccessControl {
pub fn has_role(&self, role: &Role, address: &Address) -> bool {
self.roles.get_or_default(&(*role, *address))
}

pub fn get_role_admin(&self, role: &Role) -> Role {
let admin_role = self.role_admin.get(role);
if let Some(admin) = admin_role {
admin
} else {
DEFAULT_ADMIN_ROLE
}
}

pub fn grant_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_grant_role(role, address);
}

pub fn revoke_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_revoke_role(role, address);
}

pub fn renounce_role(&mut self, role: &Role, address: &Address) {
if address != &self.env().caller() {
self.env().revert(Error::RoleRenounceForAnotherAddress);
}
self.unchecked_revoke_role(role, address);
}
}

impl AccessControl {
pub fn check_role(&self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.env().revert(Error::MissingRole);
}
}

pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {
let previous_admin_role = self.get_role_admin(role);
self.role_admin.set(role, *admin_role);
self.env().emit_event(RoleAdminChanged {
role: *role,
previous_admin_role,
new_admin_role: *admin_role
});
}

pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.roles.set(&(*role, *address), true);
self.env().emit_event(RoleGranted {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}

pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {
if self.has_role(role, address) {
self.roles.set(&(*role, *address), false);
self.env().emit_event(RoleRevoked {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}
}
  • L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.
  • L8 - The default role is an array filled with zeros.
  • L10-L13 - The storage consists of two mappings:
  1. roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.
  2. role_admin - each Role can have a single admin Role.
  • L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.
  • L49 - This is a non-exported block containing helper functions.
  • L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.
  • L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.
  • L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).
  • L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.
  • L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access.
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/tutorials/build-deploy-read/index.html b/docs/docs/0.9.1/tutorials/build-deploy-read/index.html new file mode 100644 index 000000000..8180aacbc --- /dev/null +++ b/docs/docs/0.9.1/tutorials/build-deploy-read/index.html @@ -0,0 +1,17 @@ + + + + + +Build, Deploy and Read the State of a Contract | Odra + + + + + +
+
Version: 0.9.1

Build, Deploy and Read the State of a Contract

In this guide, we will show the full path from creating a contract, deploying it and reading the state.

We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript.

Before you start, make sure you completed the following steps:

Contract

Let's write a contract with complex storage layout.

The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping.

We will expose two methods:

  1. The constructor init which sets the metadata and the version of the contract.
  2. The method set_data which sets the value of the numeric field and the values of the mapping.
custom_item.rs
use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};

// A custom type with a vector of another custom type
#[odra::odra_type]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[odra::odra_type]
pub struct Price {
value: U256,
}

// The main contract with a version, metadata and a submodule
#[odra::module]
pub struct CustomItem {
version: Var<u32>,
meta: Var<Metadata>,
data: SubModule<Data>
}

#[odra::module]
impl CustomItem {
pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {
let meta = Metadata {
name,
description,
prices: vec![
Price { value: price_1 },
Price { value: price_2 }
]
};
self.meta.set(meta);
self.version.set(self.version.get_or_default() + 1);
}

pub fn set_data(&mut self, value: u32, name: String, name2: String) {
self.data.value.set(value);
self.data.inner.named_values.set(&name, 10);
self.data.inner.named_values.set(&name2, 20);
}
}

// A submodule with a numeric value and another submodule
#[odra::module]
struct Data {
value: Var<u32>,
inner: SubModule<InnerData>,
}

// A submodule with a mapping
#[odra::module]
struct InnerData {
named_values: Mapping<String, u32>,
}

Deploying the contract

First, we need to setup the chain. We will use the NCTL docker image to run a local network.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Next, we need to compile the contract to a Wasm file.

cargo odra build -c custom_item 

Then, we can deploy the contract using the casper-client tool.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key path/to/your/secret_key.pem \
--session-path [PATH_TO_WASM] \
--payment-amount 100000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string='My Name'" \
--session-arg "description:string='My Description'" \
--session-arg "price_1:u256='101'" \
--session-arg "price_2:u256='202'"

Finally, we can call the set_data method to set the values of the contract.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key ./keys/secret_key.pem \
--payment-amount 2000000000 \
--session-hash [DEPLOYED_CONTRACT_HASH] \
--session-entry-point "set_data" \
--session-arg "value:u32:'666'" \
--session-arg "name:string='alice'" \
--session-arg "name2:string='bob'"

Storage Layout

To read the state of the contract, we need to understand the storage layout.

The first step is to calculate the index of the keys.

Storage Layout

CustomItem: prefix: 0x0..._0000_0000_0000 0
version: u32, 0x0..._0000_0000_0000 0
meta: Metadata, 0x0..._0000_0000_0001 1
data: Data: prefix: 0x0..._0000_0000_0010 2
value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0
inner: InnerData: prefix: 0x0..._0000_0010_0001 (2 << 4) + 1
named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0

The actual key is obtained as follows:

  1. Convert the index to a big-endian byte array.
  2. Concatenate the index with the mapping data.
  3. Hash the concatenated bytes using blake2b.
  4. Return the hex representation of the hash (the stored key must be utf-8 encoded).

In more detail, the storage layout is described in the Storage Layout article.

Reading the state

main.rs
use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};
use casper_types::{
bytesrepr::{FromBytes, ToBytes},
U256,
};

// replace with your contract hash
const CONTRACT_HASH: &str = "hash-...";
const NODE_ADDRESS: &str = "http://localhost:11101/rpc";
const RPC_ID: &str = "casper-net-1";
const DICTIONARY_NAME: &str = "state";

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

async fn read_state_key(key: String) -> Vec<u8> {
let state_root_hash = casper_client::get_state_root_hash(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
None,
)
.await
.unwrap()
.result
.state_root_hash
.unwrap();

// Read the value from the `state` dictionary.
let result = casper_client::get_dictionary_item(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
state_root_hash,
DictionaryItemIdentifier::ContractNamedKey {
key: CONTRACT_HASH.to_string(),
dictionary_name: DICTIONARY_NAME.to_string(),
dictionary_item_key: key,
},
)
.await
.unwrap()
.result
.stored_value;

// We expect the value to be a CLValue
if let StoredValue::CLValue(cl_value) = result {
// Ignore the first 4 bytes, which are the length of the CLType.
cl_value.inner_bytes()[4..].to_vec()
} else {
vec![]
}
}

async fn metadata() -> Metadata {
// The key for the metadata is 1, and it has no mapping data
let key = key(1, &[]);
let bytes = read_state_key(key).await;

// Read the name and store the remaining bytes
let (name, bytes) = String::from_bytes(&bytes).unwrap();
// Read the description and store the remaining bytes
let (description, bytes) = String::from_bytes(&bytes).unwrap();
// A vector is stored as a u32 size followed by the elements
// Read the size of the vector and store the remaining bytes
let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();

let mut prices = vec![];
// As we know the size of the vector, we can loop over it
for _ in 0..size {
// Read the value and store the remaining bytes
let (value, rem) = U256::from_bytes(&bytes).unwrap();
bytes = rem;
prices.push(Price { value });
}
// Anytime you finish parsing a value, you should check if there are any remaining bytes
// if there are, it means you have a bug in your parsing logic.
// For simplicity, we will ignore the remaining bytes here.
Metadata {
name,
description,
prices
}
}

async fn value() -> u32 {
// The key for the value is (2 << 4) + 0, and it has no mapping data
let key = key(2 << 4, &[]);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

async fn named_value(name: &str) -> u32 {
// The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes
let mapping_data = name.to_bytes().unwrap();
let key = key(((2 << 4) + 1) << 4, &mapping_data);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

fn main() {
let runtime = tokio::runtime::Runtime::new().unwrap();
dbg!(runtime.block_on(metadata()));
dbg!(runtime.block_on(value()));
dbg!(runtime.block_on(named_value("alice")));
dbg!(runtime.block_on(named_value("bob")));
}

// The key is a combination of the index and the mapping data
// The algorithm is as follows:
// 1. Convert the index to a big-endian byte array
// 2. Concatenate the index with the mapping data
// 3. Hash the concatenated bytes using blake2b
// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)
fn key(idx: u32, mapping_data: &[u8]) -> String {
let mut key = Vec::new();
key.extend_from_slice(idx.to_be_bytes().as_ref());
key.extend_from_slice(mapping_data);
let hashed_key = blake2b(&key);

hex::encode(&hashed_key)
}

fn blake2b(bytes: &[u8]) -> [u8; 32] {
let mut result = [0u8; 32];
let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32)
.expect("should create hasher");
let _ = std::io::Write::write(&mut hasher, bytes);
blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)
.expect("should copy hash to the result array");
result
}

cargo run
[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {
name: "My Contract",
description: "My Description",
prices: [
Price {
value: 123,
},
Price {
value: 321,
},
],
}
[src/main.rs:117:5] runtime.block_on(value()) = 666
[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20
[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10
+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/tutorials/erc20/index.html b/docs/docs/0.9.1/tutorials/erc20/index.html new file mode 100644 index 000000000..27e047e23 --- /dev/null +++ b/docs/docs/0.9.1/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 0.9.1

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • Advanced storage using key-value pairs,
  • Odra types such as Address,
  • Advanced event assertion.

Code

Our module features a considerably more complex storage layout compared to the previous example.

It is designed to store the following data:

  1. Immutable metadata - name, symbol, and decimals.
  2. Total supply.
  3. Balances of individual users.
  4. Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.

Module definition

erc20.rs
use odra::prelude::*;
use odra::{Address, casper_types::U256, Mapping, Var};

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}
  • L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.
  • L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys.

Metadata

erc20.rs
#[odra::module]
impl Erc20 {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let caller = self.env().caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, &initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &U256) {
self.balances.add(address, *amount);
self.total_supply.add(*amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}
}

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L9 - A constructor sets the token metadata and mints the initial supply.
  • L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.
  • L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for:
use odra::UnwrapOrRevert;

let current_balance = self.balances.get(address).unwrap_or_default();
let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());
self.balances.set(address, new_balance);

Core

To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();
self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
self.env().revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowance(owner, spender);
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.set(&(*owner, *spender), new_allowance);
self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 1,
InsufficientAllowance = 2,
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::*;
use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: INITIAL_SUPPLY.into()
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

#[test]
fn transfer_from_and_approval_work() {
let (env, mut erc20) = setup();

let (owner, recipient, spender) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount
}
));

// Spender transfers tokens from Owner to Recipient.
env.set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));
// assert!(env.emitted(erc20.address(), "Transfer"));
}

#[test]
fn transfer_from_error() {
// Given a new instance.
let (env, mut erc20) = setup();

// When the spender's allowance is zero.
let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

// Then transfer fails.
assert_eq!(
erc20.try_transfer_from(&owner, &recipient, &amount),
Err(Error::InsufficientAllowance.into())
);
}
}
  • L146 - Alternatively, if you don't want to check the entire event, you may assert only its type.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/tutorials/ownable/index.html b/docs/docs/0.9.1/tutorials/ownable/index.html new file mode 100644 index 000000000..fcc2e1067 --- /dev/null +++ b/docs/docs/0.9.1/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 0.9.1

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining a constructor,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

ownable.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(events = [OwnershipChanged])]
pub struct Ownable {
owner: Var<Option<Address>>
}

That was easy, but it is crucial to understand the basics before we move on.

  • L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.
  • L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var.

Init the module

ownable.rs
#[odra::module]
impl Ownable {
pub fn init(&mut self, owner: Address) {
if self.owner.get_or_default().is_some() {
self.env().revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(Some(owner));

self.env().emit_event(OwnershipChanged {
prev_owner: None,
new_owner: owner
});
}
}

#[odra::odra_error]
pub enum Error {
OwnerIsAlreadyInitialized = 1,
}

#[odra::event]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L1 - The impl should be an Odra module, so add #[odra::module].
  • L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.
  • L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.
  • L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument.
  • L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.
  • L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.
  • L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None.

Features implementation

ownable.rs
#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get_or_default().as_ref() {
self.env().revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&self.env().caller());
let current_owner = self.get_owner();
self.owner.set(Some(*new_owner));
self.env().emit_event(OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
});
}

pub fn get_owner(&self) -> Address {
match self.owner.get_or_default() {
Some(owner) => owner,
None => self.env().revert(Error::OwnerIsNotInitialized)
}
}
}

#[odra::odra_error]
pub enum Error {
NotOwner = 1,
OwnerIsAlreadyInitialized = 2,
OwnerIsNotInitialized = 3,
}

The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along.

  • L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.
  • L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.
  • L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead.

Test

ownable.rs
#[cfg(test)]
mod tests {
use super::*;
use odra::host::{Deployer, HostEnv, HostRef};

fn setup() -> (OwnableHostRef, HostEnv, Address) {
let env: HostEnv = odra_test::env();
let init_args = OwnableInitArgs {
owner: env.get_account(0)
};
(OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))
}

#[test]
fn initialization_works() {
let (ownable, env, owner) = setup();
assert_eq!(ownable.get_owner(), owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (mut ownable, env, owner) = setup();
let new_owner = env.get_account(1);

env.set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (mut ownable, env, _) = setup();
let new_owner = env.get_account(1);
ownable.change_ownership(&new_owner);

assert_eq!(
ownable.try_change_ownership(&new_owner),
Err(Error::NotOwner.into())
);
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.
  • L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one).
  • L14 - It is time to define the first test. As you see, it is a regular Rust test.
  • L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.
  • L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.
  • L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/tutorials/owned-token/index.html b/docs/docs/0.9.1/tutorials/owned-token/index.html new file mode 100644 index 000000000..bb5b98cff --- /dev/null +++ b/docs/docs/0.9.1/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 0.9.1

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow only the module owner to mint tokens.
  3. Enable the current owner to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};
use odra::prelude::*;
use odra::module::SubModule;

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
...
use odra::{Address, casper_types::U256};
...

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.ownable.ensure_ownership(&self.env().caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L9-L10 - A constructor is an excellent place to initialize both modules at once.
  • L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.
  • L49-L51 - The same is done with the ownable module.
  • L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/tutorials/pauseable/index.html b/docs/docs/0.9.1/tutorials/pauseable/index.html new file mode 100644 index 000000000..4a9bb6885 --- /dev/null +++ b/docs/docs/0.9.1/tutorials/pauseable/index.html @@ -0,0 +1,17 @@ + + + + + +Pausable | Odra + + + + + +
+
Version: 0.9.1

Pausable

The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.

Code

As always, we will start with defining functionalities of our module.

  1. Check the state - is it paused or not.
  2. State guards - a contract should stop execution if is in a state we don't expect.
  3. Switch the state.

Events and Error

There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way.

Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser.

pauseable.rs
use odra::prelude::*;
use odra::Address;

#[odra::odra_error]
pub enum Error {
PausedRequired = 1_000,
UnpausedRequired = 1_001,
}

#[odra::event]
pub struct Paused {
pub account: Address
}

#[odra::event]
pub struct Unpaused {
pub account: Address
}

Module definition

The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused.

pauseable.rs
use odra::Var;
...

#[odra::module(events = [Paused, Unpaused])]
pub struct Pausable {
is_paused: Var<bool>
}

Checks and guards

Now, let's move to state checks and guards.

pauseable.rs
impl Pausable {
pub fn is_paused(&self) -> bool {
self.is_paused.get_or_default()
}

pub fn require_not_paused(&self) {
if self.is_paused() {
self.env().revert(Error::UnpausedRequired);
}
}

pub fn require_paused(&self) {
if !self.is_paused() {
self.env().revert(Error::PausedRequired);
}
}
}
  • L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.
  • L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.
  • L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused.
  • L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused.

Actions

Finally, we will add the ability to switch the module state.

pauseable.rs
impl Pausable {
pub fn pause(&mut self) {
self.require_not_paused();
self.is_paused.set(true);

self.env().emit_event(Paused {
account: self.env().caller()
});
}

pub fn unpause(&mut self) {
self.require_paused();
self.is_paused.set(false);

self.env().emit_event(Unpaused {
account: self.env().caller()
});
}
}

pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused).

Pausable counter

In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused).

pauseable.rs
...
use odra::SubModule;
...

#[odra::module]
pub struct PausableCounter {
value: Var<u32>,
pauseable: SubModule<Pausable>
}

#[odra::module]
impl PausableCounter {
pub fn increment(&mut self) {
self.pauseable.require_not_paused();

let new_value = self.value.get_or_default() + 1;
self.value.set(new_value);
}

pub fn pause(&mut self) {
self.pauseable.pause();
}

pub fn unpause(&mut self) {
self.pauseable.unpause();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::host::{Deployer, NoArgs};

#[test]
fn increment_only_if_unpaused() {
let test_env = odra_test::env();
let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);
contract.increment();
contract.pause();

assert_eq!(
contract.try_increment().unwrap_err(),
Error::UnpausedRequired.into()
);
assert_eq!(contract.get_value(), 1);
}
}

As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!

+ + + + \ No newline at end of file diff --git a/docs/docs/0.9.1/tutorials/using-proxy-caller/index.html b/docs/docs/0.9.1/tutorials/using-proxy-caller/index.html new file mode 100644 index 000000000..08a1be165 --- /dev/null +++ b/docs/docs/0.9.1/tutorials/using-proxy-caller/index.html @@ -0,0 +1,18 @@ + + + + + +Using Proxy Caller | Odra + + + + + +
+
Version: 0.9.1

Using Proxy Caller

In this tutorial, we will learn how to use the proxy_caller wasm to call an Odra payable function. The proxy_caller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.

Read more about the proxy_caller here.

Contract

For this tutorial, we will use the TimeLockWallet contract from our examples.

examples/src/contracts/tlw.rs
use odra::prelude::*;
use odra::{casper_types::U512, Address, Mapping, Var};

#[odra::module(errors = Error, events = [Deposit, Withdrawal])]
pub struct TimeLockWallet {
balances: Mapping<Address, U512>,
lock_expiration_map: Mapping<Address, u64>,
lock_duration: Var<u64>
}

#[odra::module]
impl TimeLockWallet {
/// Initializes the contract with the lock duration.
pub fn init(&mut self, lock_duration: u64) {
self.lock_duration.set(lock_duration);
}

/// Deposits the tokens into the contract.
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U512 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env().revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env().emit_event(Deposit {
address: caller,
amount
});
}

/// Withdraws the tokens from the contract.
pub fn withdraw(&mut self, amount: &U512) {
// code omitted for brevity
}

/// Returns the balance of the given account.
pub fn get_balance(&self, address: &Address) -> U512 {
// code omitted for brevity
}

/// Returns the lock duration.
pub fn lock_duration(&self) -> u64 {
// code omitted for brevity
}
}

/// Errors that may occur during the contract execution.
#[odra::odra_error]
pub enum Error {
LockIsNotOver = 1,
CannotLockTwice = 2,
InsufficientBalance = 3
}

/// Deposit event.
#[odra::event]
pub struct Deposit {
pub address: Address,
pub amount: U512
}

/// Withdrawal event.
#[odra::event]
pub struct Withdrawal {
pub address: Address,
pub amount: U512
}

Full code can be found here.

Client

Before we can interact with the node, we need to set it up. We will use the casper-nctl-docker image.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Make sure you have the contract's wasm file and the secret key.

# Build the contract
cargo odra build -c TimeLockWallet
# Extract secret key
docker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem

To interact with the contract, we use the livenet backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case).

Cargo.toml
[package]
name = "odra-examples"
version = "1.0.0"
edition = "2021"

[dependencies]
odra = { path = "../odra", default-features = false }
... # other dependencies
odra-casper-livenet-env = { version = "1.0.0", optional = true }

... # other sections

[features]
default = []
livenet = ["odra-casper-livenet-env"]

... # other sections

[[bin]]
name = "tlw_on_livenet"
path = "bin/tlw_on_livenet.rs"
required-features = ["livenet"]
test = false

... # other sections
examples/bin/tlw_on_livenet.rs
//! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs.
use odra::casper_types::{AsymmetricType, PublicKey, U512};
use odra::host::{Deployer, HostRef};
use odra::Address;
use odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs};

const DEPOSIT: u64 = 100;
const WITHDRAWAL: u64 = 99;
const GAS: u64 = 20u64.pow(9);

fn main() {
let env = odra_casper_livenet_env::env();
let caller = env.get_account(0);

env.set_caller(caller);
env.set_gas(GAS);

let mut contract = TimeLockWalletHostRef::deploy(
&env,
TimeLockWalletInitArgs { lock_duration: 60 * 60 }
);
// Send 100 CSPRs to the contract.
contract
.with_tokens(U512::from(DEPOSIT))
.deposit();

println!("Caller's balance: {:?}", contract.get_balance(&caller));
// Withdraw 99 CSPRs from the contract.
contract.withdraw(&U512::from(WITHDRAWAL));
println!("Remaining balance: {:?}", contract.get_balance(&caller));
}

To run the code, execute the following command:

ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \
ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \
ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \
cargo run --bin tlw_on_livenet --features=livenet
# Sample output
💁 INFO : Deploying "TimeLockWallet".
💁 INFO : Found wasm under "wasm/TimeLockWallet.wasm".
🙄 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558".
💁 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed.
💁 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed.
💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy.
🙄 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3".
💁 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed.
Caller's balance: 100
💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw".
🙄 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e".
💁 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed.
Remaining balance: 1

As observed, the contract was successfully deployed, and the Caller deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR. +The logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity.

Conclusion

In this tutorial, we learned how to use the proxy_caller wasm to make a payable function call. We deployed the TimeLockWallet contract, deposited tokens using the proxy_caller with attached CSPRs, and withdrew them. You got to try it out in both Rust and TypeScript, so you can choose whichever you prefer. Rust code seemed simpler, thanks to the Odra livenet backend making chain interactions easier to handle.

+ + + + \ No newline at end of file diff --git a/docs/docs/advanced/advanced-storage/index.html b/docs/docs/advanced/advanced-storage/index.html new file mode 100644 index 000000000..09057caa2 --- /dev/null +++ b/docs/docs/advanced/advanced-storage/index.html @@ -0,0 +1,18 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: 1.0.0

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values.

Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + ToBytes + FromBytes + CLTyped
{
value: Var<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, a Mapping is a key-value storage system where the key is associated with a value. +In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute.

However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{casper_types::U256, Mapping, UnwrapOrRevert};
use odra::prelude::*;
use crate::owned_token::OwnedToken;

#[odra::module]
pub struct Mappings {
strings: Mapping<(String, u32, String), String>,
tokens: Mapping<String, OwnedToken>
}

#[odra::module]
impl Mappings {

...

pub fn total_supply(&mut self, token_name: String) -> U256 {
self.tokens.module(&token_name).total_supply()
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let opt_string = self.strings.get(&(key1, key2, key3));
opt_string.unwrap_or_revert(&self.env())
}
}

As you can see, a Mapping key can consist of a tuple of values, not limited to a single value.

note

Accessing Odra modules differs from accessing regular values such as strings or numbers.

Firstly, within a Mapping, you don't encapsulate the module with Submodule.

Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Address, casper_types::U512, Sequence, Mapping};
use odra::prelude::*;
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
counter: Sequence<u32>,
tokens: Mapping<(String, String), Token>,
}

impl AdvancedStorage {
pub fn current_value(&self) -> u32 {
self.counter.get_current_value()
}

pub fn increment_and_get(&mut self) -> u32 {
self.counter.next_value()
}

pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {
let token = self.tokens.module(&(token_name, creator));
token.balance_of(&address)
}

pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {
let mut token = self.tokens.module(&(token_name, creator));
token.mint(amount, to);
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:

  1. Odra offers a Sequence module, enabling contracts to store and increment a single value.
  2. Mappings support composite keys expressed as tuples and can store modules as values.

Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/advanced/attributes/index.html b/docs/docs/advanced/attributes/index.html new file mode 100644 index 000000000..7a2d50301 --- /dev/null +++ b/docs/docs/advanced/attributes/index.html @@ -0,0 +1,20 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: 1.0.0

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that +allows developers to embed common checks into function definitions in a readable and reusable manner. +These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U256 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env.revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env()
.emit_event(Deposit {
address: caller,
amount
});
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Example

#[odra::module]
pub struct NonReentrantCounter {
counter: Var<u32>
}

#[odra::module]
impl NonReentrantCounter {
#[odra(non_reentrant)]
pub fn count_ref_recursive(&mut self, n: u32) {
if n > 0 {
self.count();
ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);
}
}
}

impl NonReentrantCounter {
fn count(&mut self) {
let c = self.counter.get_or_default();
self.counter.set(c + 1);
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::{host::{Deployer, NoArgs}, ExecutionError};

#[test]
fn ref_recursion_not_allowed() {
let test_env = odra_test::env();
let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);

let result = contract.count_ref_recursive(11);
assert_eq!(result, ExecutionError::ReentrantCall.into());
}
}

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

+ + + + \ No newline at end of file diff --git a/docs/docs/advanced/building-manually/index.html b/docs/docs/advanced/building-manually/index.html new file mode 100644 index 000000000..f80505c8e --- /dev/null +++ b/docs/docs/advanced/building-manually/index.html @@ -0,0 +1,28 @@ + + + + + +Building contracts manually | Odra + + + + + +
+
Version: 1.0.0

Building contracts manually

cargo odra is a great tool to build and test your contracts, but sometimes +a better control over the parameters that are passed to the cargo +or the compiler is needed.

This is especially useful when the project has multiple features, and there is a need +to switch between them during the building and testing.

Knowing that cargo odra is a simple wrapper around cargo, it is easy to replicate +the same behavior by using cargo directly.

Building the contract manually

To build the contract manually, cargo odra uses the following command:

ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract
info

Odra uses the environment variable ODRA_MODULE to determine which contract to build.

Assuming that project's crate is named my_project, this command will build +the my_contract contract in release mode and generate the wasm file. +The file will be put into the target/wasm32-unknown-unknown/release directory under +the name my_project_build_contract.wasm.

The Odra Framework expects the contracts to be placed in the wasm directory, and +to be named correctly, so the next step would be to move the file:

mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm

Optimizing the contract

To lower the size of the wasm file, cargo odra uses the wasm-strip tool:

wasm-strip wasm/my_contract.wasm

To further optimize the wasm file, the wasm-opt tool is also used.

wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
danger

This step is required, as the wasm file generated by the Rust compiler is not +fully compatible with the Casper execution engine.

Running the tests manually

To run the tests manually, Odra needs to know which backend to use. +To run tests against Casper backend, the following command needs to be used:

ODRA_BACKEND=casper cargo test

Wrapping up

Let's say we want to build the my_contract in debug mode, run the tests against the +casper backend and use the my-own-allocator feature from our my_project project.

To do that, we can use the following set of commands:

ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract
mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm
wasm-strip wasm/my_contract.wasm
wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
ODRA_BACKEND=casper cargo test --features my-own-allocator
+ + + + \ No newline at end of file diff --git a/docs/docs/advanced/delegate/index.html b/docs/docs/advanced/delegate/index.html new file mode 100644 index 000000000..f6219411c --- /dev/null +++ b/docs/docs/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: 1.0.0

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use crate::{erc20::Erc20, ownable::Ownable};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
fn approve(&mut self, spender: Address, amount: U256);
fn name(&self) -> String;
fn symbol(&self) -> String;
fn decimals(&self) -> u8;
fn total_supply(&self) -> U256;
fn balance_of(&self, owner: Address) -> U256;
fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct DeFiPlatform {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>,
exchange: SubModule<Exchange>
}

#[odra::module]
impl DeFiPlatform {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
}

to self.exchange {
fn swap(&mut self, sender: Address, recipient: Address);
fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/advanced/storage-layout/index.html b/docs/docs/advanced/storage-layout/index.html new file mode 100644 index 000000000..fb2968f80 --- /dev/null +++ b/docs/docs/advanced/storage-layout/index.html @@ -0,0 +1,44 @@ + + + + + +Storage Layout | Odra + + + + + +
+
Version: 1.0.0

Storage Layout

Odra's innovative modular design necessitates a unique storage layout. This +article explains step-by-step Odra's storage layout.

Casper VM Perspective

The Casper Execution Engine (VM) enables the storage of data in named keys or +dictionaries. However, a smart contract has a limited number of named keys, +making it unsuitable for storing substantial data volumes. Odra resolves this +issue by storing all user-generated data in a dictionary called state. This +dictionary operates as a key-value store, where keys are strings with a maximum +length of 64 characters, and values are arbitrary byte arrays.

Here is an example of what the interface for reading and writing data could look +like:

pub trait CasperStorage {
fn read(key: &str) -> Option<Vec<u8>>;
fn write(key: &str, value: Vec<u8>);
}

Odra Perspective

Odra was conceived with modularity and code reusability in mind. Additionally, +we aimed to streamline storage definition through the struct object. Consider +this straightforward storage definition:

#[odra::module]
pub struct Token {
name: Var<String>,
balances: Mapping<Address, U256>
}

The Token structure contains two fields: name of type String and +balances, which functions as a key-value store with Address as keys and +U256 as values.

The Token module can be reused in another module, as demonstrated in a more +complex example:

#[odra::module]
pub struct Loans {
lenders: SubModule<Token>,
borrowers: SubModule<Token>,
}

The Loans module has two fields: lenders and borrowers, both of which have +the same storage layout as defined by the Token module. Odra guarantees that +lenders and borrowers are stored under distinct keys within the storage +dictionary.

Both Token and Loans serve as examples to show how Odra's storage layout +operates.

Key generation.

Every element of a module (struct) with N elements is associated with an index +ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an +element of a module is another module (SubModule<...>), the associated index +serves as a prefix for the indexes of the inner module.

While this may initially appear complex, it is easily understood through an +example. In the example, indexes are presented as bytes, reflecting the actual +implementation.

Loans {
lenders: Token { // prefix: 0x0001
name: 1, // key: 0x0001_0001
balances: 2 // key: 0x0001_0010
},
borrowers: Token { // prefix: 0x0010
name: 1, // key: 0x0010_0001
balances: 2 // key: 0x0010_0010
}
}

Additionally, it's worth mentioning how Mapping's keys are used in the +storage. They are simply concatenated with the index of the module, as +demonstrated in the example.

For instance, triggering borrowers.balances.get(0x1234abcd) would result in a +key:

0x0001_0001_1234_abcd

Finally, the key must be hashed to fit within the 64-character limit and then +encoded in hexadecimal format.

Value serialization

Before being stored in the storage, each value is serialized into bytes using +the CLType serialization method and subsequently encapsulated with Casper's +Bytes types.

+ + + + \ No newline at end of file diff --git a/docs/docs/advanced/using-different-allocator/index.html b/docs/docs/advanced/using-different-allocator/index.html new file mode 100644 index 000000000..3adfc3806 --- /dev/null +++ b/docs/docs/advanced/using-different-allocator/index.html @@ -0,0 +1,25 @@ + + + + + +Memory allocators | Odra + + + + + +
+
Version: 1.0.0

Memory allocators

When compiling contracts to wasm, your code needs to be no-std. +This means that instead of using the standard library, the core +crate will be linked to your code. This crate does not contain +a memory allocator.

Happily, Odra automatically enables allocator - from our tests +the one developed by ink! +seems to be the best.

Using a different allocator

If the default allocator does not suit your needs, or you use a crate that +already provides an allocator, you can disable the default allocator by enabling +the disable-allocator feature in the odra dependency in your project:

[dependencies]
odra = { path = "../odra", features = ["disable-allocator"] }

If you want to have a better control over the features that are enabled +during the building and tests, see the next article on building manually.

+ + + + \ No newline at end of file diff --git a/docs/docs/backends/casper/index.html b/docs/docs/backends/casper/index.html new file mode 100644 index 000000000..81ef35338 --- /dev/null +++ b/docs/docs/backends/casper/index.html @@ -0,0 +1,50 @@ + + + + + +Casper | Odra + + + + + +
+
Version: 1.0.0

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event].

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling self.env().attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, +you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Deploying a contract to Casper network

There would be no point in writing a contract if you couldn't deploy it to the blockchain. +You can do it in two ways: provided by the Casper itself: using the casper-client tool +or using the Odra's Livenet integration.

Let's explore the first option to better understand the process.

note

If you wish, you can skip the following section and jump to the Livenet integration.

WASM arguments

When deploying a new contract you can pass some arguments to it. +Every contract written in Odra expects those arguments to be set:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Additionally, if required by the contract, you can pass constructor arguments.

When working with the test env via cargo odra or when using +Livenet integration this is handled automatically. However, if you rather use +casper-client directly, you have to pass them manually:

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. U512 type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK. See an example in the Tutorial section.

Execution

First thing Odra does with your code, is similar to the one used in OdraVM - +a list of entrypoints is generated, thanks to the #[odra::module] attribute.

+ + + + \ No newline at end of file diff --git a/docs/docs/backends/livenet/index.html b/docs/docs/backends/livenet/index.html new file mode 100644 index 000000000..006b79947 --- /dev/null +++ b/docs/docs/backends/livenet/index.html @@ -0,0 +1,49 @@ + + + + + +Livenet | Odra + + + + + +
+
Version: 1.0.0

Livenet

The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local +test node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend +to handle the deployment of your contracts to the real blockchain.

Furthermore, it is implemented in a similarly to Casper or OdraVM, +however, it uses a real blockchain to deploy contracts and store the state. +This lets us use Odra to deploy and test contracts on a real blockchain, but +on the other hand, it comes with some limitations on what can be done in the tests.

The main differences between Livenet and e.g. CasperVM backend are:

  • Real CSPR tokens are used to deploy and call contracts. This also means that we need to +pay for each contract deployment and each contract call. Of course, we can use the faucet +to get some tokens for testing purposes, but we still need to specify the amount needed +for each action.
  • The contract state is stored on the real blockchain, so we can't just reset the state - +we can redeploy the contract, but we can't remove the old one.
  • Because of the above, we can load the existing contracts and use them in the tests.
  • We have no control over the block time. This means that for example, advance_block_time function +is implemented by waiting for the real time to pass.

This is also a cause for the fact that the Livenet backend cannot be (yet) used for running +the regular Odra tests. Instead, we can create integration tests or binaries which will +use a slightly different workflow to test the contracts.

Setup

To use Livenet backend, we need to provide Odra with some information - the network address, our private +key and the name of the chain we want to use. Optionally, we can add multiple private keys to use +more than one account in our tests. Those values are passed using environment variables. We can use .env +file to store them - let's take a look at an example .env file, created from the .env.sample file from +examples folder:

# Path to the secret key of the account that will be used
# to deploy the contracts.
# We're using .keys folder so we don't accidentally commit
# the secret key to the repository.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777

# Chain name of the network. Known values:
# - integration-test
ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test

# Paths to the secret keys of the additional accounts.
# Main secret key will be 0th account.
ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem
ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem

With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find +a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. +Let's go through the code:

fn main() {
// Similar to the OdraVM backend, we need to initialize
// the environment:
let env = odra_casper_livenet_env::env();

// Most of the for the host env works the same as in the
// OdraVM backend.
let owner = env.caller();
// Addresses are the real addresses on the blockchain,
// so we need to provide them
// if we did not import their secret keys.
let recipient =
"hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";
let recipient = Address::from_str(recipient).unwrap();

// Arguments for the contract init method.
let name = String::from("Plascoin");
let symbol = String::from("PLS");
let decimals = 10u8;
let initial_supply: U256 = U256::from(10_000);

// The main difference between other backends - we need to specify
// the gas limit for each action.
// The limit will be used for every consecutive action
// until we change it.
env.set_gas(100_000_000_000u64);

// Deploy the contract. The API is the same as in the OdraVM backend.
let init_args = Erc20InitArgs {
name,
symbol,
decimals,
initial_supply: Some(initial_supply)
};
let mut token = Erc20HostRef::deploy(env, init_args);

// We can now use the contract as we would in the OdraVM backend.
println!("Token address: {}", token.address().to_string());

// Uncomment to load existing contract.
// let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
// let address = Address::from_str(address).unwrap();
// We use the Livenet-specific `load` method to load the contract
// that is already deployed.
// let mut token = Erc20Deployer::load(env, address);

// Non-mutable calls are free! Neat, huh? More on that later.
println!("Token name: {}", token.name());

// The next call is mutable, but the cost is lower that the deployment,
// so we change the amount of gas
env.set_gas(3_000_000_000u64);
token.transfer(recipient, U256::from(1000));

println!("Owner's balance: {:?}", token.balance_of(owner));
println!("Recipient's balance: {:?}", token.balance_of(recipient));
}
note

The above example is a rust binary, not a test. Note that it is also added as a section of the +Cargo.toml file:

[bin]
name = "erc20_on_livenet"
path = "src/bin/erc20_on_livenet.rs"
required-features = ["livenet"]
test = false

Usage

To run the above code, we simply need to run the binary with the livenet feature enabled:

cargo run --bin erc20_on_livenet --features=livenet
note

Before executing the binary, make sure you built a wasm file.

A part of a sample output should look like this:

...
💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
💁 INFO : Deploy "65b1a5d21..." successfully executed.
Owner's balance: 4004
Recipient's balance: 4000

Those logs are a result of the last 4 lines of the above listing. +Each deployment or a call to the blockchain will be noted and will take some time to execute. +We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant +and cost us nothing. How it is possible?

info

You can see the deployment on http://cspr.live/ - the transfer from the example +can be seen here.

How Livenet backend works

All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. +It is possible however to query the state of the blockchain for free.

This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the +node is the current state. This is why the balance_of call was almost instant and free.

Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract +(see Cross Calls), it is executed offline and +node is used for the state query only. However, the Livenet needs to know the connection between the contracts +and the code, so make sure to deploy or load already deployed contracts

Multiple environments

It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, +multiple nodes or even multiple chains.

To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. +Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file +has to be used first. If your integration.env file has a value that IS present in the .env file, it will +override the value from the .env file.

ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet

To sum up - this command will firstly load the integration.env file and then load the missing values from .env file.

+ + + + \ No newline at end of file diff --git a/docs/docs/backends/odra-vm/index.html b/docs/docs/backends/odra-vm/index.html new file mode 100644 index 000000000..e456adff8 --- /dev/null +++ b/docs/docs/backends/odra-vm/index.html @@ -0,0 +1,26 @@ + + + + + +OdraVM | Odra + + + + + +
+
Version: 1.0.0

OdraVM

The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time - +simply use your IDE's debug functionality.

Usage

The OdraVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

OdraVM consists of two main parts: the Contract Register and the State.

The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address.

Contracts and Test Env functions can modify the State of the OdraVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the OdraVM State holds only the current state of the OdraVM. +Thanks to this and the fact that we do not need the blockchain itself, +OdraVM starts instantly and runs the tests in the native speed.

Execution

When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, OdraVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/backends/what-is-a-backend/index.html b/docs/docs/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..a281b1098 --- /dev/null +++ b/docs/docs/backends/what-is-a-backend/index.html @@ -0,0 +1,28 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: 1.0.0

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like OdraVM, +a complete virtual machine, spinning up a blockchain for you - like CasperVM, +or even a real blockchain - when using Livenet backend.

Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Host Env

Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/cargo-odra/index.html b/docs/docs/basics/cargo-odra/index.html new file mode 100644 index 000000000..82aa0e0c0 --- /dev/null +++ b/docs/docs/basics/cargo-odra/index.html @@ -0,0 +1,37 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: 1.0.0

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them with various configurations.

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This creates a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

The third available template is workspace, which creates a workspace with two projects, similar to the one created +with the full template.

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 1.0.0 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it creates a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This creates a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

The most used command during the development of your project should be this one:

cargo odra test

It runs your tests against Odra's MockVM. It is substantially faster than CasperVM +and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra builds the project, generates the wasm files, +spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat.

Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. +This is why OdraVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build

If the build process finishes successfully, wasm files will be located in wasm folder. +Notice, that this command does not require the -b option.

If you want to build specific contract, you can use -c option:

cargo odra build -c counter # you pass many comma separated contracts

Generating contract schema

If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command:

cargo odra schema 

This generates a schema file in JSON format for all your contracts and places them in the resources folder. +If the resources folder does not exist, it creates the folder for you.

Like with the build command, you can use the -c option to generate a schema for a specific contract.

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/casper-contract-schema/index.html b/docs/docs/basics/casper-contract-schema/index.html new file mode 100644 index 000000000..6674be041 --- /dev/null +++ b/docs/docs/basics/casper-contract-schema/index.html @@ -0,0 +1,18 @@ + + + + + +Casper Contract Schema | Odra + + + + + +
+
Version: 1.0.0

Casper Contract Schema

Working in collaboration with the Casper Association we designed the Casper Contract Schema (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability.

Odra and CCS

There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory.

note

If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.

src/contract.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(
// the name of the contract, default is the module name
name = "MyContract",
// the version of the contract, default is the version of the crate
version = "0.1.0",
// events that the contract can emit, collected recursively if submodules are used
events = [
Created,
Updated
],
// the error enum the contract can revert with, collected recursively if submodules are used
errors = MyErrors
)]
pub struct MyContract {
name: Var<String>,
owner: Var<Address>,
}

#[odra::module]
impl MyContract {
/// Initializes the contract, sets the name and owner and emits an event
pub fn init(&mut self, name: String, owner: Address) {
self.name.set(name.clone());
self.owner.set(owner.clone());
self.env().emit_event(Created { name });
}

/// Updates the name of the contract and emits an event
pub fn update(&mut self, name: String) {
self.name.set(name.clone());
self.env().emit_event(Updated { name });
}

/// Returns the data of the contract
pub fn get_data(&self) -> Data {
Data {
name: self.name.get_or_default(),
owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),
}
}
}

// The struct will we visible in the schema in the types section
#[odra::odra_type]
pub struct Data {
name: String,
owner: Address,
}

// The enum variants will we visible in the schema in the errors section
#[odra::odra_error]
pub enum MyErrors {
/// The owner is invalid
InvalidOwner,
/// The name is invalid
InvalidName,
}

// The struct will we visible in the schema in the types and events section
#[odra::event]
pub struct Updated {
name: String,
}

// The struct will we visible in the schema in the types section and events section
#[odra::event]
pub struct Created {
name: String,
}

Generating the Schema

To generate the schema run the following cargo-odra command:

cargo odra schema # or pass -c flag to generate the schema for a specific contract

Schema Output

The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:

resources/my_contract_schema.json
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "MyContract",
"contract_version": "0.1.0",
"types": [
{
"struct": {
"name": "Created",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
},
{
"struct": {
"name": "Data",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
},
{
"name": "owner",
"description": null,
"ty": "Key"
}
]
}
},
{
"struct": {
"name": "Updated",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
}
],
"errors": [
{
"name": "InvalidName",
"description": "The name is invalid",
"discriminant": 1
},
{
"name": "InvalidOwner",
"description": "The owner is invalid",
"discriminant": 0
}
],
"entry_points": [
{
"name": "update",
"description": "Updates the name of the contract and emits an event",
"is_mutable": true,
"arguments": [
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "get_data",
"description": "Returns the data of the contract",
"is_mutable": false,
"arguments": [],
"return_ty": "Data",
"is_contract_context": true,
"access": "public"
}
],
"events": [
{
"name": "Created",
"ty": "Created"
},
{
"name": "Updated",
"ty": "Updated"
}
],
"call": {
"wasm_file_name": "MyContract.wasm",
"description": "Initializes the contract, sets the name and owner and emits an event",
"arguments": [
{
"name": "odra_cfg_package_hash_key_name",
"description": "The arg name for the package hash key name.",
"ty": "String",
"optional": false
},
{
"name": "odra_cfg_allow_key_override",
"description": "The arg name for the allow key override.",
"ty": "Bool",
"optional": false
},
{
"name": "odra_cfg_is_upgradable",
"description": "The arg name for the contract upgradeability setting.",
"ty": "Bool",
"optional": false
},
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
},
{
"name": "owner",
"description": null,
"ty": "Key",
"optional": false
}
]
}
}

Schema Fields

  • casper_contract_schema_version is the version of the schema. +toolchain is the version of the Rust compiler used to compile the contract.
  • Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.
  • contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.
  • contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.
  • types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.
  • errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.
  • entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.
  • events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.
  • The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.
+ + + + \ No newline at end of file diff --git a/docs/docs/basics/communicating-with-host/index.html b/docs/docs/basics/communicating-with-host/index.html new file mode 100644 index 000000000..6543af1f8 --- /dev/null +++ b/docs/docs/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: 1.0.0

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module]
pub struct HostContract {
name: Var<String>,
created_at: Var<u64>,
created_by: Var<Address>
}

#[odra::module]
impl HostContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(self.env().get_block_time());
self.created_by.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are using self.env(). It is an implementation of Module::env(), autogenerated +by #[odra::module] attribute. The function returns a reference to the ContractEnv (you can read more in +the Backend section). This is a structure that provides access to the host functions and variables.

In this example, we use two of them:

  • get_block_time() - returns the current block time as u64.
  • caller() - returns an Odra Address of the caller (this can be an external caller or another contract).
info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/cross-calls/index.html b/docs/docs/basics/cross-calls/index.html new file mode 100644 index 000000000..780c7ed58 --- /dev/null +++ b/docs/docs/basics/cross-calls/index.html @@ -0,0 +1,22 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: 1.0.0

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::prelude::*;
use odra::{Address, UnwrapOrRevert, Var};

#[odra::module]
pub struct CrossContract {
pub math_engine: Var<Address>
}

#[odra::module]
impl CrossContract {
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine;

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To perform a cross-contact call, we use the {{ModuleName}}ContractRef that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)

Contract Ref

We mentioned HostRef already in our Testing article - a host side reference to already deployed contract.

In the module context we use a ContractRef instead, to call other contracts.

Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, +by the #[odra::module] attribute.

To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above.

The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract.

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call:

AdderContractRef::new(self.env(), address).add(3, 5)

Loading the contract

Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test +our contracts in Livenet backend. We can load the contract using load method on the Deployer:

examples/bin/erc20_on_livenet.rs
fn _load(env: &HostEnv) -> Erc20HostRef {
let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
let address = Address::from_str(address).unwrap();
<Erc20HostRef as HostRefLoader>::load(env, address)
}

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};
use odra::host::{Deployer, HostRef, NoArgs};

#[test]
fn test_cross_calls() {
let test_env = odra_test::env();
let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);
let cross_contract = CrossContractHostRef::deploy(
&test_env,
CrossContractInitArgs {
math_engine_address: *math_engine_contract.address()
}
);
assert_eq!(cross_contract.add_using_another(), 8);
}
}

Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize.

#[cfg(test)]
mod tests {
use super::*;
use odra::{Address, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_ext() {
let test_env = odra_test::env();
let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)
assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address(test_env: &HostEnv) -> Address {
let contract = MathEngineHostRef::deploy(test_env, NoArgs);
*contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/basics/directory-structure/index.html b/docs/docs/basics/directory-structure/index.html new file mode 100644 index 000000000..ce5c62703 --- /dev/null +++ b/docs/docs/basics/directory-structure/index.html @@ -0,0 +1,26 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: 1.0.0

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── rust-toolchain
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── bin/
| |── build_contract.rs
| └── build_schema.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "1.0.0"

[dev-dependencies]
odra-test = "1.0.0"

[build-dependencies]
odra-build = "1.0.0"

[[bin]]
name = "sample_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "sample_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also +added as a dev dependency.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

src/

This is the folder where your smart contract files live.

bin/

This is the folder where scripts that will be used to generate code or schemas live. +You don't need to modify those files, they are generated by cargo odra new command and +are used by cargo odra build, cargo odra test and cargo odra schema commands.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/errors/index.html b/docs/docs/basics/errors/index.html new file mode 100644 index 000000000..54215d2ac --- /dev/null +++ b/docs/docs/basics/errors/index.html @@ -0,0 +1,24 @@ + + + + + +Errors | Odra + + + + + +
+
Version: 1.0.0

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(errors = Error)]
pub struct OwnedContract {
name: Var<String>,
owner: Var<Address>
}

#[odra::odra_error]
pub enum Error {
OwnerNotSet = 1,
NotAnOwner = 2
}

#[odra::module]
impl OwnedContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = self.env().caller();
if caller != self.owner() {
self.env().revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using the #[odra::odra_error] attribute to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
self.env().revert(Error::NotAnOwner)

To register errors, add the errors inner attribute to the struct's #[odra::module] attribute and pass the error type as the value. The registered errors will be present in the contract schema.

Defining an error in Odra, you must keep in mind a few rules:

  1. An error should be a field-less enum.
  2. The enum must be annotated with #[odra::odra_error].
  3. Avoid implicit discriminants.
note

In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!

Testing errors

Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:

examples/src/features/handling_errors.rs
#[cfg(test)]
mod tests {
use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn test_owner_error() {
let test_env = odra_test::env();
let owner = test_env.get_account(0);
let not_an_owner = test_env.get_account(1);

test_env.set_caller(owner);
let init_args = OwnedContractInitArgs {
name: "OwnedContract".to_string()
};
let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);

test_env.set_caller(not_an_owner);
assert_eq!(
owned_contract.try_change_name("NewName".to_string()),
Err(Error::NotAnOwner.into())
);
}
}

Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult. +OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and +and safe its safe version: try_name, try_owner, try_change_name.

In our example, we are calling try_change_name and expecting an error to be thrown. +For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, +we need to convert our custom error to OdraError using Into::into().

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/events/index.html b/docs/docs/basics/events/index.html new file mode 100644 index 000000000..636cbbc52 --- /dev/null +++ b/docs/docs/basics/events/index.html @@ -0,0 +1,18 @@ + + + + + +Events | Odra + + + + + +
+
Version: 1.0.0

Events

In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:

examples/src/features/events.rs
use odra::prelude::*;
use odra::Address;

#[odra::module(events = [PartyStarted])]
pub struct PartyContract;

#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64
}

#[odra::module]
impl PartyContract {
pub fn init(&self) {
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, add the #[odra::event] attribute like this:

examples/src/features/events.rs
#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64,
}

To emit an event, we use the emit_event function from the ContractEnv, passing the event as an argument:

examples/src/features/events.rs
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});

To determine all the events at compilation time to register them once the contract is deployed. To register events, add an events inner attribute to the struct's #[odra::module] attribute. The registered events will also be present in the contract schema.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use super::{PartyContractHostRef, PartyStarted};
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

#[test]
fn test_party() {
let test_env: HostEnv = odra_test::env();
let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);
test_env.emitted_event(
party_contract.address(),
&PartyStarted {
caller: test_env.get_account(0),
block_time: 0
}
);
// If you do not want to check the exact event, you can use `emitted` function
test_env.emitted(party_contract.address(), "PartyStarted");
// You can also check how many events were emitted.
assert_eq!(test_env.events_count(party_contract.address()), 1);
}

To explore more event testing functions, check the HostEnv documentation.

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/flipper-internals/index.html b/docs/docs/basics/flipper-internals/index.html new file mode 100644 index 000000000..c1ac61734 --- /dev/null +++ b/docs/docs/basics/flipper-internals/index.html @@ -0,0 +1,38 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: 1.0.0

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Var;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Var, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Var<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the attribute - all functions defined there, even marked +with pub will be not callable.

The function named init is the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error. The init function is optional, +if your contract does not need any initialization, you can skip it.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated +by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, +as the second argument of the deploy function, we pass NoArgs - one of the implementations of +the InitArgs trait provided with the framework.

The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/modules/index.html b/docs/docs/basics/modules/index.html new file mode 100644 index 000000000..338eef4b3 --- /dev/null +++ b/docs/docs/basics/modules/index.html @@ -0,0 +1,21 @@ + + + + + +Modules | Odra + + + + + +
+
Version: 1.0.0

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to the #[odra::module] attribute. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;
use odra::module::SubModule;
use odra::prelude::*;

#[odra::module]
pub struct ModulesContract {
pub math_engine: SubModule<MathEngine>
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}
info

To use a module as a component of another module, you need to use the SubModule type. This is a special type +that crates a keyspace (read more in Storage Layout) and provide access to its public methods.

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the OwnedToken example in the main Odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
#[cfg(test)]
mod tests {
use super::ModulesContractHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);
assert_eq!(modules_contract.add_using_module(), 8);
}
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/native-token/index.html b/docs/docs/basics/native-token/index.html new file mode 100644 index 000000000..58f707d9f --- /dev/null +++ b/docs/docs/basics/native-token/index.html @@ -0,0 +1,25 @@ + + + + + +Native token | Odra + + + + + +
+
Version: 1.0.0

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::prelude::*;
use odra::{casper_types::U512, module::Module};

#[odra::module]
pub struct PublicWallet;

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {}

pub fn withdraw(&mut self, amount: &U512) {
self.env().transfer_tokens(&self.env().caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/contracts/tlw.rs in the odra main repository.

You can see a new attribute used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from ContractEnv::transfer_tokens(). +It does exactly what you are expecting it to do - it transfers native tokens from the contract to the +specified address.

Testing

To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function - +balance_of:

examples/src/features/native_token.rs
#[cfg(test)]
mod tests {
use super::PublicWalletHostRef;
use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);
assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());

my_contract.with_tokens(U512::from(100)).deposit();
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));

my_contract.withdraw(U512::from(25));
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/basics/odra-toml/index.html b/docs/docs/basics/odra-toml/index.html new file mode 100644 index 000000000..a802e30e6 --- /dev/null +++ b/docs/docs/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: 1.0.0

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
fqn = "sample::Flipper"

The fqn (Fully Qualified Name) is used by the building tools to locate and build the contract. +The last segment of the fqn will be used as the name for your contract - the generated wasm file will +be in the above case named flipper.wasm.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
fqn = "sample::Flipper"

[[contracts]]
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/storage-interaction/index.html b/docs/docs/basics/storage-interaction/index.html new file mode 100644 index 000000000..7f9d3d278 --- /dev/null +++ b/docs/docs/basics/storage-interaction/index.html @@ -0,0 +1,37 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: 1.0.0

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Var

The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Var type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
use odra::prelude::*;
use odra::Var;

#[odra::module]
pub struct DogContract {
barks: Var<bool>,
weight: Var<u32>,
name: Var<String>,
walks: Var<Vec<u32>>,
}

You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
#[odra::module]
impl DogContract {
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Var is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::prelude::*;
use odra::{Mapping, Var};

#[odra::module]
pub struct DogContract2 {
name: Var<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Vars section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Var working together:

core/src/list.rs
use odra::{List, Var};

pub struct List<T> {
values: Mapping<u32, T>,
index: Var<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
use odra::{prelude::*, List, Var};

#[odra::module]
pub struct DogContract3 {
name: Var<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type:

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}

#[odra_type] is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type. +CLType of a custom type is CLType::Any, except for an unit-only enum, which is CLType::U8.

unit_only_enum.rs
enum Enum {
Foo = 3,
Bar = 2,
Baz = 1,
}
note

Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute .

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/basics/testing/index.html b/docs/docs/basics/testing/index.html new file mode 100644 index 000000000..83902c427 --- /dev/null +++ b/docs/docs/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: 1.0.0

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{List, Var};

#[cfg(test)]
mod tests {
use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn init_test() {
let test_env = odra_test::env();
let init_args = DogContract3InitArgs {
name: "DogContract".to_string()
};
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The first interesting thing you may notice is placed the import section.

use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

We are using super to import the DogContract3HostRef and DogContract3InitArgs from the parent module. +{{ModuleName}}HostRef and {{ModuleName}}InitArgs are types that was generated for us by Odra.

DogContract3HostRef is a reference to the contract that we can use to interact with it (call entrypoints) +and implements HostRef trait.

DogContract3InitArgs is a struct that we use to initialize the contract and implements InitArgs trait. +Considering the contract initialization, there three possible scenarios:

  1. The contract has a constructor with arguments, then Odra creates a struct named {{ModuleName}}InitArgs.
  2. The contract has a constructor with no arguments, then you can use odra::host::NoArgs.
  3. The contract does not have a constructor, then you can use odra::host::NoArgs. +All of those structs implement the odra::host::InitArgs trait, required to conform to the +Deployer::deploy method signature.

The other import is odra::host::Deployer. This is a trait is used to deploy the contract and give us a reference to it.

Let's take a look at the test itself. How to obtain a reference to the contract? +{{ModuleName}}HostRef implements the Deployer trait, which provides the deploy method:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with the odra::module attribute are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

HostEnv

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};
use odra::{host::{Deployer, HostEnv}, prelude::*};

#[test]
fn env() {
let test_env: HostEnv = odra_test::env();
test_env.set_caller(test_env.get_account(0));
let init_args = TestingContractInitArgs {
name: "MyContract".to_string()
};
let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);
let creator = testing_contract.created_by();
test_env.set_caller(test_env.get_account(1));
let init_args = TestingContractInitArgs {
name: "MyContract2".to_string()
};
let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);
let creator2 = testing_contract2.created_by();
assert_ne!(creator, creator2);
}
}

In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). +Next, we are deploying two instances of the same contract, but we're using HostEnv::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller() +the function we are calling inside the contract.

HostEnv comes with a set of functions that will let you write better tests:

  • fn set_caller(&self, address: Address) - you've seen it in action just now
  • fn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given address
  • fn advance_block_time(&self, time_diff: u64) - increases the current value of block_time
  • fn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; +by default, you start with the 0-th account
  • fn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract

Full list of functions can be found in the HostEnv documentation.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/category/advanced/index.html b/docs/docs/category/advanced/index.html new file mode 100644 index 000000000..23ac050e1 --- /dev/null +++ b/docs/docs/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
+ + + + \ No newline at end of file diff --git a/docs/docs/category/backends/index.html b/docs/docs/category/backends/index.html new file mode 100644 index 000000000..e073611b1 --- /dev/null +++ b/docs/docs/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/category/basics/index.html b/docs/docs/category/basics/index.html new file mode 100644 index 000000000..d6c368be4 --- /dev/null +++ b/docs/docs/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/category/examples/index.html b/docs/docs/category/examples/index.html new file mode 100644 index 000000000..75d4383ab --- /dev/null +++ b/docs/docs/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/category/getting-started/index.html b/docs/docs/category/getting-started/index.html new file mode 100644 index 000000000..ee6f5d893 --- /dev/null +++ b/docs/docs/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/category/migrations/index.html b/docs/docs/category/migrations/index.html new file mode 100644 index 000000000..ed208b3f8 --- /dev/null +++ b/docs/docs/category/migrations/index.html @@ -0,0 +1,17 @@ + + + + + +Migrations | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/category/tutorials/index.html b/docs/docs/category/tutorials/index.html new file mode 100644 index 000000000..f35f6480b --- /dev/null +++ b/docs/docs/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + +
+
Version: 1.0.0

Tutorials

The theory is good, but the practice is even better. Let's go through a few examples summing up all the Odra concepts.

+ + + + \ No newline at end of file diff --git a/docs/docs/examples/odra-examples/index.html b/docs/docs/examples/odra-examples/index.html new file mode 100644 index 000000000..17be71243 --- /dev/null +++ b/docs/docs/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: 1.0.0

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/examples/using-odra-modules/index.html b/docs/docs/examples/using-odra-modules/index.html new file mode 100644 index 000000000..f5eed5428 --- /dev/null +++ b/docs/docs/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: 1.0.0

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "1.0.0"

[dev-dependencies]
odra-test = "1.0.0"

[build-dependencies]
odra-build = "1.0.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = "1.0.0"
odra-modules = "1.0.0"

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::prelude::*;
use odra::{Address, casper_types::U256, module::SubModule};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

CEP-18

Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 here.

CEP-78

Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 here.

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/getting-started/flipper/index.html b/docs/docs/getting-started/flipper/index.html new file mode 100644 index 000000000..6c6253aeb --- /dev/null +++ b/docs/docs/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: 1.0.0

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Var;

/// A module definition. Each module struct consists Vars and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor, must be named `init`.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let env = odra_test::env();
let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);
let contract2 = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

Testing

To run the tests, execute the following command:

cargo odra test # or add the `-b casper` flag to run tests on the CasperVM

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/getting-started/installation/index.html b/docs/docs/getting-started/installation/index.html new file mode 100644 index 000000000..50772df2a --- /dev/null +++ b/docs/docs/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: 1.0.0

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra --locked

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called my_project and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/index.html b/docs/docs/index.html new file mode 100644 index 000000000..eadb7c4e2 --- /dev/null +++ b/docs/docs/index.html @@ -0,0 +1,19 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: 1.0.0

Odra framework

Odra is a Rust-based smart contract framework for Casper Network. Odra encourages rapid development and clean, +pragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel.

It's free and open source!

What's next

See the Installation and our Flipper example to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/migrations/to-0.8.0/index.html b/docs/docs/migrations/to-0.8.0/index.html new file mode 100644 index 000000000..f1f222209 --- /dev/null +++ b/docs/docs/migrations/to-0.8.0/index.html @@ -0,0 +1,19 @@ + + + + + +Migration guide to v0.8.0 | Odra + + + + + +
+
Version: 1.0.0

Migration guide to v0.8.0

Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version.

This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant changes in v0.8.0 include:

  • Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only.
  • Framework internals redesign.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0.

2. Migration Steps

2.1 Add bin directory

Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory.

You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2. Update Cargo.toml

There a bunch of changes in the Cargo.toml file.

  • You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.
  • Register bins you added in the previous step.
  • Add dev-dependencies section with odra-test crate.
  • Add recommended profiles for release and dev to optimize the build process.

Below you can compare the Cargo.toml file after and before the migration to v0.8.0:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

2.2. Update Odra.toml

Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required.

[[contracts]]
fqn = "my_project::Flipper"

2.3. Update Smart Contracts

The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:

2.3.1. Update the use statements to reflect the new module structure.

  • Big integer types are now located in the odra::casper_types module.
  • odra::types::Address is now odra::Address.
  • Variable is now Var.
  • Remove odra::contract_env.
  • Remove odra::types::event::OdraEvent.
  • Remove odra::types::OdraType as it is no longer required.
  • Change odra::types::casper_types::*; to odra::casper_types::*;.

2.3.2. Some type aliases are no longer in use.

  • Balance - use odra::casper_types::U512.
  • BlockTime - use u64.
  • EventData - use odra::casper_types::bytesrepr::Bytes.

2.3.3. Consider import odra::prelude::* in your module files.

2.3.4. Flatten nested Mappings.

// Before
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<Address, Mapping<Address, U256>>
}
// After
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<(Address, Address), U256>
}

2.3.5. Update errors definitions.

execution_error! macro has been replace with OdraError derive macro.

use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.3.6. Update events definitions.

use odra::prelude::*;
use odra::Event;

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

// Emitting the event
self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});

2.3.7. Replace contract_env with self.env() in your modules.

self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes.

  • fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.
  • fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).
  • set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions.
  • fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].
  • fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.
  • fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).
  • fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.
  • functions native_token_metadata() and one_token() have been removed.

2.3.8. Wrap submodules of your module with odra::SubModule<T>.

#[odra::module(events = [Transfer])]
pub struct Erc721Token {
core: SubModule<Erc721Base>,
metadata: SubModule<Erc721MetadataExtension>,
ownable: SubModule<Ownable>
}

2.3.9. Update external contract calls.

However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()).

#[odra::external_contract]
pub trait Token {
fn balance_of(&self, owner: &Address) -> U256;
}

// Usage
TokenContractRef::new(env, token).balance_of(account)

2.3.10. Update constructors.

Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init.

2.3.11. Update UnwrapOrRevert calls.

The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter.

2.3.12. Remove #[odra(using)] attribute from your module definition.

Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required.

2.4. Update Tests

Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:

2.4.1. Contract deployment.

The way you deploy a contract has changed:

  1. You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.
  2. Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.
  3. If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.
  4. If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function.
// A contract without init args
use super::OwnableHostRef;
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

let env: HostEnv = odra_test::env();
let ownable = OwnableHostRef::deploy(&env, NoArgs)

// A contract with init args
use super::{Erc20HostRef, Erc20InitArgs};
use odra::host::{Deployer, HostEnv};

let env: HostEnv = odra_test::env();
let init_args = Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
};
let erc20 = Erc20HostRef::deploy(&env, init_args);

2.4.2. Host interactions.

  1. Replace odra::test_env with odra_test::env().
  2. The API of odra::test_env and odra_test::env() are similar, but there are some differences:
    • test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).
    • test_env::token_balance(Address) is now env.balance_of(&Address).
    • functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef.

2.4.3. Testing failing scenarios.

test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result. +try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro.

#[test]
fn transfer_from_error() {
let (env, mut erc20) = setup();

let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

assert_eq!(
erc20.try_transfer_from(owner, recipient, amount),
Err(Error::InsufficientAllowance.into())
);
}

2.4.4. Testing events.

assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. +The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options.

let env: HostEnv = odra_test::env();
let erc20 = Erc20HostRef::deploy(&env, init_args);

...

assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.8.0.

src/erc20.rs
use crate::erc20::errors::Error::*;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address, Event};

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
use super::{
errors::Error,
events::{Approval, Transfer},
Erc20HostRef, Erc20InitArgs
};
use odra::{
casper_types::U256,
host::{Deployer, HostEnv, HostRef},
prelude::*
};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

// Other tests...
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/migrations/to-0.9.0/index.html b/docs/docs/migrations/to-0.9.0/index.html new file mode 100644 index 000000000..0989f9887 --- /dev/null +++ b/docs/docs/migrations/to-0.9.0/index.html @@ -0,0 +1,18 @@ + + + + + +Migration guide to v0.9.0 | Odra + + + + + +
+
Version: 1.0.0

Migration guide to v0.9.0

This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version 0.7.1 and below, start with the previous guide. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant change in 0.9.0 is the way of defining custom elements namely type, events and errors.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0.

2. Migration Steps

2.1 Update build_schema.rs bin

Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2 Update smart contract code

The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes.

2.2.1. Update custom types definitions.

#[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute.

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}

2.2.2. Update errors definitions.

#[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. +Error enum should be passed as a parameter to the #[odra::module] attribute.

#[odra::module(events = [/* events go here */], errors = Error)]
pub struct Erc20 {
// fields
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.2.3. Update events definitions.

#[derive(Event)] attribute has been replace with #[odra::event] attribute.

use odra::prelude::*;
use odra::{Address, casper_types::U256};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.9.0.

src/erc20.rs
use crate::erc20::errors::Error;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer], errors = Error)]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(Error::NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(Error::InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(Error::InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
// nothing changed in the tests
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/next/advanced/advanced-storage/index.html b/docs/docs/next/advanced/advanced-storage/index.html new file mode 100644 index 000000000..988b98374 --- /dev/null +++ b/docs/docs/next/advanced/advanced-storage/index.html @@ -0,0 +1,18 @@ + + + + + +Advanced Storage Concepts | Odra + + + + + +
+
Version: next

Advanced Storage Concepts

The Odra Framework provides advanced storage interaction capabilities that extend beyond the basic storage interaction. This document will focus on the Mapping and Sequence modules, which are key components of the advanced storage interaction in Odra.

Recap and Basic Concepts

Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values.

Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract.

Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key.

List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over.

If you need a refresher on these topics, please refer to our guide on basic storage in Odra.

Advanced Storage Concepts

Sequence

The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value.

pub struct Sequence<T>
where
T: Num + One + ToBytes + FromBytes + CLTyped
{
value: Var<T>
}

The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively.

Advanced Mapping

In Odra, a Mapping is a key-value storage system where the key is associated with a value. +In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute.

However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state.

Let's consider the following example:

examples/src/features/storage/mapping.rs
use odra::{casper_types::U256, Mapping, UnwrapOrRevert};
use odra::prelude::*;
use crate::owned_token::OwnedToken;

#[odra::module]
pub struct Mappings {
strings: Mapping<(String, u32, String), String>,
tokens: Mapping<String, OwnedToken>
}

#[odra::module]
impl Mappings {

...

pub fn total_supply(&mut self, token_name: String) -> U256 {
self.tokens.module(&token_name).total_supply()
}

pub fn get_string_api(
&self,
key1: String,
key2: u32,
key3: String
) -> String {
let opt_string = self.strings.get(&(key1, key2, key3));
opt_string.unwrap_or_revert(&self.env())
}
}

As you can see, a Mapping key can consist of a tuple of values, not limited to a single value.

note

Accessing Odra modules differs from accessing regular values such as strings or numbers.

Firstly, within a Mapping, you don't encapsulate the module with Submodule.

Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules.

AdvancedStorage Contract

The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts.

use odra::{Address, casper_types::U512, Sequence, Mapping};
use odra::prelude::*;
use crate::modules::Token;

#[odra::module]
pub struct AdvancedStorage {
counter: Sequence<u32>,
tokens: Mapping<(String, String), Token>,
}

impl AdvancedStorage {
pub fn current_value(&self) -> u32 {
self.counter.get_current_value()
}

pub fn increment_and_get(&mut self) -> u32 {
self.counter.next_value()
}

pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 {
let token = self.tokens.module(&(token_name, creator));
token.balance_of(&address)
}

pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) {
let mut token = self.tokens.module(&(token_name, creator));
token.mint(amount, to);
}
}

Conclusion

Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are:

  1. Odra offers a Sequence module, enabling contracts to store and increment a single value.
  2. Mappings support composite keys expressed as tuples and can store modules as values.

Understanding these concepts can help developers design and implement more efficient and flexible smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/advanced/attributes/index.html b/docs/docs/next/advanced/attributes/index.html new file mode 100644 index 000000000..253b73905 --- /dev/null +++ b/docs/docs/next/advanced/attributes/index.html @@ -0,0 +1,20 @@ + + + + + +Attributes | Odra + + + + + +
+
Version: next

Attributes

Smart contract developers with Ethereum background are familiar with Solidity's concept of modifiers in Solidity - a feature that +allows developers to embed common checks into function definitions in a readable and reusable manner. +These are essentially prerequisites for function execution.

Odra defines a few attributes that can be applied to functions to equip them with superpowers.

Payable

When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens.

Example

examples/src/contracts/tlw.rs
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U256 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env.revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env()
.emit_event(Deposit {
address: caller,
amount
});
}

If you try to send tokens to a non-payable function, the transaction will be automatically rejected.

Non Reentrant

Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds.

To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts.

They can also use reentrancy guards to block recursive calls to sensitive functions.

In Odra you can just apply the #[odra(non_reentrant)] attribute to your function.

Example

#[odra::module]
pub struct NonReentrantCounter {
counter: Var<u32>
}

#[odra::module]
impl NonReentrantCounter {
#[odra(non_reentrant)]
pub fn count_ref_recursive(&mut self, n: u32) {
if n > 0 {
self.count();
ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1);
}
}
}

impl NonReentrantCounter {
fn count(&mut self) {
let c = self.counter.get_or_default();
self.counter.set(c + 1);
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::{host::{Deployer, NoArgs}, ExecutionError};

#[test]
fn ref_recursion_not_allowed() {
let test_env = odra_test::env();
let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs);

let result = contract.count_ref_recursive(11);
assert_eq!(result, ExecutionError::ReentrantCall.into());
}
}

Mixing attributes

A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. +To apply multiple attributes, you can write:

#[odra(payable, non_reentrant)]
fn deposit() {
// your logic...
}

or

#[odra(payable)]
#[odra(non_reentrant)]
fn deposit() {
// your logic...
}

In both cases attributes order does not matter.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/advanced/building-manually/index.html b/docs/docs/next/advanced/building-manually/index.html new file mode 100644 index 000000000..2b6b4e0a1 --- /dev/null +++ b/docs/docs/next/advanced/building-manually/index.html @@ -0,0 +1,28 @@ + + + + + +Building contracts manually | Odra + + + + + +
+
Version: next

Building contracts manually

cargo odra is a great tool to build and test your contracts, but sometimes +a better control over the parameters that are passed to the cargo +or the compiler is needed.

This is especially useful when the project has multiple features, and there is a need +to switch between them during the building and testing.

Knowing that cargo odra is a simple wrapper around cargo, it is easy to replicate +the same behavior by using cargo directly.

Building the contract manually

To build the contract manually, cargo odra uses the following command:

ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract
info

Odra uses the environment variable ODRA_MODULE to determine which contract to build.

Assuming that project's crate is named my_project, this command will build +the my_contract contract in release mode and generate the wasm file. +The file will be put into the target/wasm32-unknown-unknown/release directory under +the name my_project_build_contract.wasm.

The Odra Framework expects the contracts to be placed in the wasm directory, and +to be named correctly, so the next step would be to move the file:

mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm

Optimizing the contract

To lower the size of the wasm file, cargo odra uses the wasm-strip tool:

wasm-strip wasm/my_contract.wasm

To further optimize the wasm file, the wasm-opt tool is also used.

wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
danger

This step is required, as the wasm file generated by the Rust compiler is not +fully compatible with the Casper execution engine.

Running the tests manually

To run the tests manually, Odra needs to know which backend to use. +To run tests against Casper backend, the following command needs to be used:

ODRA_BACKEND=casper cargo test

Wrapping up

Let's say we want to build the my_contract in debug mode, run the tests against the +casper backend and use the my-own-allocator feature from our my_project project.

To do that, we can use the following set of commands:

ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract
mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm
wasm-strip wasm/my_contract.wasm
wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm
ODRA_BACKEND=casper cargo test --features my-own-allocator
+ + + + \ No newline at end of file diff --git a/docs/docs/next/advanced/delegate/index.html b/docs/docs/next/advanced/delegate/index.html new file mode 100644 index 000000000..8d6a6d7e8 --- /dev/null +++ b/docs/docs/next/advanced/delegate/index.html @@ -0,0 +1,17 @@ + + + + + +Delegate | Odra + + + + + +
+
Version: next

Delegate

Managing boilerplate code can often lead to code that is cumbersome and challenging to comprehend. The Odra library introduces a solution to this issue with its Delegate feature. As the name implies, the Delegate feature permits the delegation of function calls to child modules, effectively minimizing the redundancy of boilerplate code and maintaining a lean and orderly parent module.

The main advantage of this feature is that it allows you to inherit the default behavior of child modules seamlessly, making your contracts more readable.

Overview

To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand.

You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself.

Code Examples

Consider the following basic example for better understanding:

use crate::{erc20::Erc20, ownable::Ownable};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256);
fn approve(&mut self, spender: Address, amount: U256);
fn name(&self) -> String;
fn symbol(&self) -> String;
fn decimals(&self) -> u8;
fn total_supply(&self) -> U256;
fn balance_of(&self, owner: Address) -> U256;
fn allowance(&self, owner: Address, spender: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
fn change_ownership(&mut self, new_owner: Address);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality.

The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities.

Let's take a look at another example.

use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange};
use odra::{
Address, casper_types::U256,
module::SubModule,
prelude::*
};

#[odra::module]
pub struct DeFiPlatform {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>,
exchange: SubModule<Exchange>
}

#[odra::module]
impl DeFiPlatform {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
self.exchange.init(exchange_rate);
}

delegate! {
to self.erc20 {
fn transfer(&mut self, recipient: Address, amount: U256);
fn balance_of(&self, owner: Address) -> U256;
}

to self.ownable {
fn get_owner(&self) -> Address;
}

to self.exchange {
fn swap(&mut self, sender: Address, recipient: Address);
fn set_exchange_rate(&mut self, new_rate: u64);
}
}

pub fn mint(&mut self, address: Address, amount: U256) {
self.ownable.ensure_ownership(self.env().caller());
self.erc20.mint(address, amount);
}
}

In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure.

Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/advanced/storage-layout/index.html b/docs/docs/next/advanced/storage-layout/index.html new file mode 100644 index 000000000..5b61cbd1c --- /dev/null +++ b/docs/docs/next/advanced/storage-layout/index.html @@ -0,0 +1,44 @@ + + + + + +Storage Layout | Odra + + + + + +
+
Version: next

Storage Layout

Odra's innovative modular design necessitates a unique storage layout. This +article explains step-by-step Odra's storage layout.

Casper VM Perspective

The Casper Execution Engine (VM) enables the storage of data in named keys or +dictionaries. However, a smart contract has a limited number of named keys, +making it unsuitable for storing substantial data volumes. Odra resolves this +issue by storing all user-generated data in a dictionary called state. This +dictionary operates as a key-value store, where keys are strings with a maximum +length of 64 characters, and values are arbitrary byte arrays.

Here is an example of what the interface for reading and writing data could look +like:

pub trait CasperStorage {
fn read(key: &str) -> Option<Vec<u8>>;
fn write(key: &str, value: Vec<u8>);
}

Odra Perspective

Odra was conceived with modularity and code reusability in mind. Additionally, +we aimed to streamline storage definition through the struct object. Consider +this straightforward storage definition:

#[odra::module]
pub struct Token {
name: Var<String>,
balances: Mapping<Address, U256>
}

The Token structure contains two fields: name of type String and +balances, which functions as a key-value store with Address as keys and +U256 as values.

The Token module can be reused in another module, as demonstrated in a more +complex example:

#[odra::module]
pub struct Loans {
lenders: SubModule<Token>,
borrowers: SubModule<Token>,
}

The Loans module has two fields: lenders and borrowers, both of which have +the same storage layout as defined by the Token module. Odra guarantees that +lenders and borrowers are stored under distinct keys within the storage +dictionary.

Both Token and Loans serve as examples to show how Odra's storage layout +operates.

Key generation.

Every element of a module (struct) with N elements is associated with an index +ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an +element of a module is another module (SubModule<...>), the associated index +serves as a prefix for the indexes of the inner module.

While this may initially appear complex, it is easily understood through an +example. In the example, indexes are presented as bytes, reflecting the actual +implementation.

Loans {
lenders: Token { // prefix: 0x0001
name: 1, // key: 0x0001_0001
balances: 2 // key: 0x0001_0010
},
borrowers: Token { // prefix: 0x0010
name: 1, // key: 0x0010_0001
balances: 2 // key: 0x0010_0010
}
}

Additionally, it's worth mentioning how Mapping's keys are used in the +storage. They are simply concatenated with the index of the module, as +demonstrated in the example.

For instance, triggering borrowers.balances.get(0x1234abcd) would result in a +key:

0x0001_0001_1234_abcd

Finally, the key must be hashed to fit within the 64-character limit and then +encoded in hexadecimal format.

Value serialization

Before being stored in the storage, each value is serialized into bytes using +the CLType serialization method and subsequently encapsulated with Casper's +Bytes types.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/advanced/using-different-allocator/index.html b/docs/docs/next/advanced/using-different-allocator/index.html new file mode 100644 index 000000000..7352f2e99 --- /dev/null +++ b/docs/docs/next/advanced/using-different-allocator/index.html @@ -0,0 +1,25 @@ + + + + + +Memory allocators | Odra + + + + + +
+
Version: next

Memory allocators

When compiling contracts to wasm, your code needs to be no-std. +This means that instead of using the standard library, the core +crate will be linked to your code. This crate does not contain +a memory allocator.

Happily, Odra automatically enables allocator - from our tests +the one developed by ink! +seems to be the best.

Using a different allocator

If the default allocator does not suit your needs, or you use a crate that +already provides an allocator, you can disable the default allocator by enabling +the disable-allocator feature in the odra dependency in your project:

[dependencies]
odra = { path = "../odra", features = ["disable-allocator"] }

If you want to have a better control over the features that are enabled +during the building and tests, see the next article on building manually.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/backends/casper/index.html b/docs/docs/next/backends/casper/index.html new file mode 100644 index 000000000..a9c165e33 --- /dev/null +++ b/docs/docs/next/backends/casper/index.html @@ -0,0 +1,50 @@ + + + + + +Casper | Odra + + + + + +
+
Version: next

Casper

The Casper backend allows you to compile your contracts into WASM files which can be deployed +onto Casper Blockchain +and lets you to easily run them against Casper's Execution Engine locally.

Contract Env

As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances.

Events

An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've +already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity.

Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed:

  1. __events - a dictionary that stores events' data.
  2. __events_length - the evens count.
  3. __events_ces_version - the version of Casper Event Standard.
  4. __events_schema - a dictionary that stores event schemas.

Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key.

So, Events are nothing different from any other data stored by a contract.

A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event].

note

Don't forget to expose events in the module using #[odra::module(events = [...])].

Payable

The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key.

Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse.

Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. +If under the way something goes wrong with the transfer, the contract reverts.

The transferred amount can be read inside the contract by calling self.env().attached_value().

note

Odra expects the cargo_purse runtime argument to be attached to a contract call. +In case of its absence, the contract_env::attached_value() returns zero.

Revert

In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). +Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User.

Context

Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. +If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack.

The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address.

The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address.

As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, +you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse.

Test Env

Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine.

In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000).

The Test Env internally keeps track of the current block time, error and attached value.

Each test is executed on a fresh instance of the Test Env.

Usage

Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -b +parameter:

cargo odra test -b casper

If you want to just generate a wasm file, simply run:

cargo odra build -b casper

Deploying a contract to Casper network

There would be no point in writing a contract if you couldn't deploy it to the blockchain. +You can do it in two ways: provided by the Casper itself: using the casper-client tool +or using the Odra's Livenet integration.

Let's explore the first option to better understand the process.

note

If you wish, you can skip the following section and jump to the Livenet integration.

WASM arguments

When deploying a new contract you can pass some arguments to it. +Every contract written in Odra expects those arguments to be set:

  • odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.
  • odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.
  • odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable.

Additionally, if required by the contract, you can pass constructor arguments.

When working with the test env via cargo odra or when using +Livenet integration this is handled automatically. However, if you rather use +casper-client directly, you have to pass them manually:

Example: Deploy Counter

To deploy your contract with a constructor using casper-client, you need to pass the above arguments. +Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 5000000000000 \
--session-path ./wasm/counter.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "value:u32:42"

For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'.

Example: Deploy ERC721

Odra comes with a standard ERC721 token implementation. +Clone the main Odra repo and navigate to the modules directory.

Firstly contract needs to be compiled.

cargo odra build -b casper -c erc721_token

It produces the erc721_token.wasm file in the wasm directory.

Now it's time to deploy the contract.

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc721_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string:'MyNFT'" \
--session-arg "symbol:string:'NFT'" \
--session-arg "base_uri:string:'https://example.com/'"

It's done. +The contract is deployed and ready to use. +Your account is the owner of the contract and you can mint and burn tokens. +For more details see the code of the ERC721 module.

To obtain the package hash of the contract search for my_nft key +in your account's named keys.

Example: Deploy ERC1155

The process is similar to the one described in the previous section.

Contract compilation:

cargo odra build -b casper -c erc1155_token

Contract deployment:

casper-client put-deploy \
--node-address [NODE_ADDRESS] \
--chain-name casper-test \
--secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \
--payment-amount 300000000000 \
--session-path ./wasm/erc1155_token.wasm \
--session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \
--session-arg "odra_cfg_allow_key_override:bool:'false'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "odra_cfg_constructor:string:'init'" \

As previously, your account is the owner and can mint and burn tokens. +For more details see the code of the ERC1155 module.

Sending CSPR to a contract

Defining payable entry points is described in Native Token section.

What is happening under the hood is that Odra creates a new cargo_purse argument for each payable +entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. +When a contract adds CSPR to another contract call, Odra handles it for you. +The problem arises when you want to call an entry point and attach CSPR as an account. +The only way of doing that is by executing code in the sessions context, that +top-ups the cargo_purse and then calls the contract.

Odra provides a generic proxy_caller.wasm that does exactly that. +You can build it by yourself from the main Odra repository, or use the proxy_caller.wasm +we maintain.

Using proxy_caller.wasm

To use the proxy_caller.wasm you need to attach the following arguments:

  • contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. +Result of to_bytes on CasperPackageHash.
  • entry_point - String type. The name of the entry point you want to call.
  • args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass +to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.
  • attached_value. U512 type. The amount of CSPR you want to attach to the call.
  • amount. U512 type. Should be the same value as attached_value if not None. +It is a special Casper argument that enables the access to account's main purse.

Currently casper-client doesn't allow building such arguments. +You have to build it using your SDK. See an example in the Tutorial section.

Execution

First thing Odra does with your code, is similar to the one used in OdraVM - +a list of entrypoints is generated, thanks to the #[odra::module] attribute.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/backends/livenet/index.html b/docs/docs/next/backends/livenet/index.html new file mode 100644 index 000000000..51da46818 --- /dev/null +++ b/docs/docs/next/backends/livenet/index.html @@ -0,0 +1,49 @@ + + + + + +Livenet | Odra + + + + + +
+
Version: next

Livenet

The Livenet backend let us deploy and test the contracts on the real blockchain. It can be a local +test node, a testnet or even the mainnet. It is possible and even recommended using the Livenet backend +to handle the deployment of your contracts to the real blockchain.

Furthermore, it is implemented in a similarly to Casper or OdraVM, +however, it uses a real blockchain to deploy contracts and store the state. +This lets us use Odra to deploy and test contracts on a real blockchain, but +on the other hand, it comes with some limitations on what can be done in the tests.

The main differences between Livenet and e.g. CasperVM backend are:

  • Real CSPR tokens are used to deploy and call contracts. This also means that we need to +pay for each contract deployment and each contract call. Of course, we can use the faucet +to get some tokens for testing purposes, but we still need to specify the amount needed +for each action.
  • The contract state is stored on the real blockchain, so we can't just reset the state - +we can redeploy the contract, but we can't remove the old one.
  • Because of the above, we can load the existing contracts and use them in the tests.
  • We have no control over the block time. This means that for example, advance_block_time function +is implemented by waiting for the real time to pass.

This is also a cause for the fact that the Livenet backend cannot be (yet) used for running +the regular Odra tests. Instead, we can create integration tests or binaries which will +use a slightly different workflow to test the contracts.

Setup

To use Livenet backend, we need to provide Odra with some information - the network address, our private +key and the name of the chain we want to use. Optionally, we can add multiple private keys to use +more than one account in our tests. Those values are passed using environment variables. We can use .env +file to store them - let's take a look at an example .env file, created from the .env.sample file from +examples folder:

# Path to the secret key of the account that will be used
# to deploy the contracts.
# We're using .keys folder so we don't accidentally commit
# the secret key to the repository.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777

# Chain name of the network. Known values:
# - integration-test
ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test

# Paths to the secret keys of the additional accounts.
# Main secret key will be 0th account.
ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem
ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem

# If using CSPR.cloud, you can set the auth token here.
# CSPR_CLOUD_AUTH_TOKEN=
note

CSPR.cloud is a service that provides mainnet and testnet Casper nodes on demand.

With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find +a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. +Let's go through the code:

fn main() {
// Similar to the OdraVM backend, we need to initialize
// the environment:
let env = odra_casper_livenet_env::env();

// Most of the for the host env works the same as in the
// OdraVM backend.
let owner = env.caller();
// Addresses are the real addresses on the blockchain,
// so we need to provide them
// if we did not import their secret keys.
let recipient =
"hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840";
let recipient = Address::from_str(recipient).unwrap();

// Arguments for the contract init method.
let name = String::from("Plascoin");
let symbol = String::from("PLS");
let decimals = 10u8;
let initial_supply: U256 = U256::from(10_000);

// The main difference between other backends - we need to specify
// the gas limit for each action.
// The limit will be used for every consecutive action
// until we change it.
env.set_gas(100_000_000_000u64);

// Deploy the contract. The API is the same as in the OdraVM backend.
let init_args = Erc20InitArgs {
name,
symbol,
decimals,
initial_supply: Some(initial_supply)
};
let mut token = Erc20HostRef::deploy(env, init_args);

// We can now use the contract as we would in the OdraVM backend.
println!("Token address: {}", token.address().to_string());

// Uncomment to load existing contract.
// let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
// let address = Address::from_str(address).unwrap();
// We use the Livenet-specific `load` method to load the contract
// that is already deployed.
// let mut token = Erc20Deployer::load(env, address);

// Non-mutable calls are free! Neat, huh? More on that later.
println!("Token name: {}", token.name());

// The next call is mutable, but the cost is lower that the deployment,
// so we change the amount of gas
env.set_gas(3_000_000_000u64);
token.transfer(recipient, U256::from(1000));

println!("Owner's balance: {:?}", token.balance_of(owner));
println!("Recipient's balance: {:?}", token.balance_of(recipient));
}
note

The above example is a rust binary, not a test. Note that it is also added as a section of the +Cargo.toml file:

[bin]
name = "erc20_on_livenet"
path = "src/bin/erc20_on_livenet.rs"
required-features = ["livenet"]
test = false

Usage

To run the above code, we simply need to run the binary with the livenet feature enabled:

cargo run --bin erc20_on_livenet --features=livenet
note

Before executing the binary, make sure you built a wasm file.

A part of a sample output should look like this:

...
💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
🙄 WAIT : Waiting 15s for "65b1a5d21...".
💁 INFO : Deploy "65b1a5d21..." successfully executed.
Owner's balance: 4004
Recipient's balance: 4000

Those logs are a result of the last 4 lines of the above listing. +Each deployment or a call to the blockchain will be noted and will take some time to execute. +We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant +and cost us nothing. How it is possible?

info

You can see the deployment on http://cspr.live/ - the transfer from the example +can be seen here.

How Livenet backend works

All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. +It is possible however to query the state of the blockchain for free.

This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the +node is the current state. This is why the balance_of call was almost instant and free.

Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract +(see Cross Calls), it is executed offline and +node is used for the state query only. However, the Livenet needs to know the connection between the contracts +and the code, so make sure to deploy or load already deployed contracts

Multiple environments

It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, +multiple nodes or even multiple chains.

To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. +Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file +has to be used first. If your integration.env file has a value that IS present in the .env file, it will +override the value from the .env file.

ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet

To sum up - this command will firstly load the integration.env file and then load the missing values from .env file.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/backends/odra-vm/index.html b/docs/docs/next/backends/odra-vm/index.html new file mode 100644 index 000000000..ae1b8b215 --- /dev/null +++ b/docs/docs/next/backends/odra-vm/index.html @@ -0,0 +1,26 @@ + + + + + +OdraVM | Odra + + + + + +
+
Version: next

OdraVM

The OdraVM is a simple implementation of a mock backend with a minimal set of features that allows testing +the code written in Odra without compiling the contract to the target architecture and spinning up the +blockchain.

Thanks to OdraVM tests run a lot faster than other backends. You can even debug the code in real time - +simply use your IDE's debug functionality.

Usage

The OdraVM is the default backend for Odra framework, so each time you run

cargo odra test

You are running your code against it.

Architecture

OdraVM consists of two main parts: the Contract Register and the State.

The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address.

Contracts and Test Env functions can modify the State of the OdraVM.

Contrary to the "real" backend, which holds the whole history of the blockchain, +the OdraVM State holds only the current state of the OdraVM. +Thanks to this and the fact that we do not need the blockchain itself, +OdraVM starts instantly and runs the tests in the native speed.

Execution

When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting +your pub functions into a list of Entrypoints, which are put into a Contract Container. +When the contract is deployed, its Container registered into a Registry under an address. +During the contract call, OdraVM finds an Entrypoint and executes the code.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/backends/what-is-a-backend/index.html b/docs/docs/next/backends/what-is-a-backend/index.html new file mode 100644 index 000000000..3662f9211 --- /dev/null +++ b/docs/docs/next/backends/what-is-a-backend/index.html @@ -0,0 +1,28 @@ + + + + + +What is a backend? | Odra + + + + + +
+
Version: next

What is a backend?

You can think of a backend as a target platform for your smart contract. +This can be a piece of code allowing you to quickly check your code - like OdraVM, +a complete virtual machine, spinning up a blockchain for you - like CasperVM, +or even a real blockchain - when using Livenet backend.

Each backend has to come with two parts that Odra requires - the Contract Env and the Host Env.

Contract Env

The Contract Env is a simple interface that each backend needs to implement, +exposing features of the blockchain from the perspective of the contract.

It gives Odra a set of functions, which allows implementing more complex concepts - +for example, to implement Mapping, +Odra requires some kind of storage integration. +The exact implementation of those functions is a responsibility of a backend, +making Odra and its user free to implement the contract logic, +instead of messing with the blockchain internals.

Other functions from Contract Env include handling transfers, addresses, block time, errors and events.

Host Env

Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with +the backend from the outside world - really useful for implementing tests.

This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, +to the more test-oriented - handling errors, forwarding the block time, etc.

What's next

We will take a look at backends Odra implements in more detail.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/cargo-odra/index.html b/docs/docs/next/basics/cargo-odra/index.html new file mode 100644 index 000000000..c54830936 --- /dev/null +++ b/docs/docs/next/basics/cargo-odra/index.html @@ -0,0 +1,37 @@ + + + + + +Cargo Odra | Odra + + + + + +
+
Version: next

Cargo Odra

If you followed the Installation tutorial properly, +you should already be set up with the Cargo Odra tool. It is an executable that will help you with +managing your smart contracts project, testing and running them with various configurations.

Let's take a look at all the possibilities that Cargo Odra gives you.

Managing projects

Two commands help you create a new project. The first one is cargo odra new. +You need to pass one parameter, namely --name {PROJECT_NAME}:

cargo odra new --name my-project

This creates a new project in the my_project folder and name it my_project. You can see it +for yourself, for example by taking a look into a Cargo.toml file created in your project's folder:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

The project is created using the template located in Odra's main repository. +By default it uses full template, if you want, you can use minimalistic blank by running:

cargo odra new -t blank --name my-project

The third available template is workspace, which creates a workspace with two projects, similar to the one created +with the full template.

By default, the latest release of Odra will be used for the template and as a dependency. +You can pass a source of Odra you want to use, by using -s parameter:

cargo odra new -n my-project -s ../odra # will use local folder of odra
cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release
cargo odra new -n my-project -s 1.1.0 # will use a version released on crates.io

The second way of creating a project is by using init command:

cargo odra init --name my-project

It works in the same way as new, but instead of creating a new folder, it creates a project +in the current, empty directory.

Generating code

If you want to quickly create a new contract code, you can use the generate command:

cargo odra generate -c counter 

This creates a new file src/counter.rs with sample code, add appropriate use and mod sections +to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, +visit Odra.toml.

Testing

The most used command during the development of your project should be this one:

cargo odra test

It runs your tests against Odra's MockVM. It is substantially faster than CasperVM +and implements all the features Odra uses.

When you want to run tests against a "real" VM, just provide the name of the backend using -b +option:

cargo odra test -b casper

In the example above, Cargo Odra builds the project, generates the wasm files, +spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat.

Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. +This is why OdraVM was created and should be your first choice when developing contracts. +Of course, testing all of your code against a blockchain VM is a must in the end.

If you want to run only some of the tests, you can pass arguments to the cargo test command +(which is run in the background obviously):

cargo odra test -- this-will-be-passed-to-cargo-test

If you want to run tests which names contain the word two, you can execute:

cargo odra test -- two

Of course, you can do the same when using the backend:

cargo odra test -b casper -- two

Building code

You can also build the code itself and generate the output contracts without running the tests. +To do so, simply run:

cargo odra build

If the build process finishes successfully, wasm files will be located in wasm folder. +Notice, that this command does not require the -b option.

If you want to build specific contract, you can use -c option:

cargo odra build -c counter # you pass many comma separated contracts

Generating contract schema

If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command:

cargo odra schema 

This generates a schema file in JSON format for all your contracts and places them in the resources folder. +If the resources folder does not exist, it creates the folder for you.

Like with the build command, you can use the -c option to generate a schema for a specific contract.

What's next

In the next section, we will take a look at all the files and directories that cargo odra created +for us and explain their purpose.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/casper-contract-schema/index.html b/docs/docs/next/basics/casper-contract-schema/index.html new file mode 100644 index 000000000..aed125b93 --- /dev/null +++ b/docs/docs/next/basics/casper-contract-schema/index.html @@ -0,0 +1,18 @@ + + + + + +Casper Contract Schema | Odra + + + + + +
+
Version: next

Casper Contract Schema

Working in collaboration with the Casper Association we designed the Casper Contract Schema (CCS). This a standardize description of smart contracts. This is a crucial step enhancing tool development and increasing ecosystem interoperability.

Odra and CCS

There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory.

note

If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema.

src/contract.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(
// the name of the contract, default is the module name
name = "MyContract",
// the version of the contract, default is the version of the crate
version = "0.1.0",
// events that the contract can emit, collected recursively if submodules are used
events = [
Created,
Updated
],
// the error enum the contract can revert with, collected recursively if submodules are used
errors = MyErrors
)]
pub struct MyContract {
name: Var<String>,
owner: Var<Address>,
}

#[odra::module]
impl MyContract {
/// Initializes the contract, sets the name and owner and emits an event
pub fn init(&mut self, name: String, owner: Address) {
self.name.set(name.clone());
self.owner.set(owner.clone());
self.env().emit_event(Created { name });
}

/// Updates the name of the contract and emits an event
pub fn update(&mut self, name: String) {
self.name.set(name.clone());
self.env().emit_event(Updated { name });
}

/// Returns the data of the contract
pub fn get_data(&self) -> Data {
Data {
name: self.name.get_or_default(),
owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner),
}
}
}

// The struct will we visible in the schema in the types section
#[odra::odra_type]
pub struct Data {
name: String,
owner: Address,
}

// The enum variants will we visible in the schema in the errors section
#[odra::odra_error]
pub enum MyErrors {
/// The owner is invalid
InvalidOwner,
/// The name is invalid
InvalidName,
}

// The struct will we visible in the schema in the types and events section
#[odra::event]
pub struct Updated {
name: String,
}

// The struct will we visible in the schema in the types section and events section
#[odra::event]
pub struct Created {
name: String,
}

Generating the Schema

To generate the schema run the following cargo-odra command:

cargo odra schema # or pass -c flag to generate the schema for a specific contract

Schema Output

The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema:

resources/my_contract_schema.json
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "MyContract",
"contract_version": "0.1.0",
"types": [
{
"struct": {
"name": "Created",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
},
{
"struct": {
"name": "Data",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
},
{
"name": "owner",
"description": null,
"ty": "Key"
}
]
}
},
{
"struct": {
"name": "Updated",
"description": null,
"members": [
{
"name": "name",
"description": null,
"ty": "String"
}
]
}
}
],
"errors": [
{
"name": "InvalidName",
"description": "The name is invalid",
"discriminant": 1
},
{
"name": "InvalidOwner",
"description": "The owner is invalid",
"discriminant": 0
}
],
"entry_points": [
{
"name": "update",
"description": "Updates the name of the contract and emits an event",
"is_mutable": true,
"arguments": [
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
}
],
"return_ty": "Unit",
"is_contract_context": true,
"access": "public"
},
{
"name": "get_data",
"description": "Returns the data of the contract",
"is_mutable": false,
"arguments": [],
"return_ty": "Data",
"is_contract_context": true,
"access": "public"
}
],
"events": [
{
"name": "Created",
"ty": "Created"
},
{
"name": "Updated",
"ty": "Updated"
}
],
"call": {
"wasm_file_name": "MyContract.wasm",
"description": "Initializes the contract, sets the name and owner and emits an event",
"arguments": [
{
"name": "odra_cfg_package_hash_key_name",
"description": "The arg name for the package hash key name.",
"ty": "String",
"optional": false
},
{
"name": "odra_cfg_allow_key_override",
"description": "The arg name for the allow key override.",
"ty": "Bool",
"optional": false
},
{
"name": "odra_cfg_is_upgradable",
"description": "The arg name for the contract upgradeability setting.",
"ty": "Bool",
"optional": false
},
{
"name": "name",
"description": null,
"ty": "String",
"optional": false
},
{
"name": "owner",
"description": null,
"ty": "Key",
"optional": false
}
]
}
}

Schema Fields

  • casper_contract_schema_version is the version of the schema. +toolchain is the version of the Rust compiler used to compile the contract.
  • Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.
  • contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.
  • contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.
  • types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.
  • errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.
  • entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.
  • events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.
  • The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments.
+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/communicating-with-host/index.html b/docs/docs/next/basics/communicating-with-host/index.html new file mode 100644 index 000000000..1b9b64b53 --- /dev/null +++ b/docs/docs/next/basics/communicating-with-host/index.html @@ -0,0 +1,21 @@ + + + + + +Host Communication | Odra + + + + + +
+
Version: next

Host Communication

One of the things that your contract will probably do is to query the host for some information - +what is the current time? Who called me? Following example shows how to do this:

examples/src/features/host_functions.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module]
pub struct HostContract {
name: Var<String>,
created_at: Var<u64>,
created_by: Var<Address>
}

#[odra::module]
impl HostContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.created_at.set(self.env().get_block_time());
self.created_by.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}
}

As you can see, we are using self.env(). It is an implementation of Module::env(), autogenerated +by #[odra::module] attribute. The function returns a reference to the ContractEnv (you can read more in +the Backend section). This is a structure that provides access to the host functions and variables.

In this example, we use two of them:

  • get_block_time() - returns the current block time as u64.
  • caller() - returns an Odra Address of the caller (this can be an external caller or another contract).
info

You will learn more functions that Odra exposes from host and types it uses in further articles.

What's next

In the next article, we'll dive into testing your contracts with Odra, so you can check that the code +we presented in fact works!

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/cross-calls/index.html b/docs/docs/next/basics/cross-calls/index.html new file mode 100644 index 000000000..f882b6859 --- /dev/null +++ b/docs/docs/next/basics/cross-calls/index.html @@ -0,0 +1,22 @@ + + + + + +Cross calls | Odra + + + + + +
+
Version: next

Cross calls

To show how to handle calls between contracts, first, let's implement two of them:

examples/src/features/cross_calls.rs
use odra::prelude::*;
use odra::{Address, UnwrapOrRevert, Var};

#[odra::module]
pub struct CrossContract {
pub math_engine: Var<Address>
}

#[odra::module]
impl CrossContract {
pub fn init(&mut self, math_engine_address: Address) {
self.math_engine.set(math_engine_address);
}

pub fn add_using_another(&self) -> u32 {
let math_engine_address = self.math_engine.get().unwrap_or_revert(&self.env());
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)
}
}

#[odra::module]
pub struct MathEngine;

#[odra::module]
impl MathEngine {
pub fn add(&self, n1: u32, n2: u32) -> u32 {
n1 + n2
}
}

MathEngine contract can add two numbers. CrossContract takes an Address in its init function and saves it in +storage for later use. If we deploy the MathEngine first and take note of its address, we can then deploy +CrossContract and use MathEngine to perform complicated calculations for us!

To perform a cross-contact call, we use the {{ModuleName}}ContractRef that was created for us by Odra:

examples/src/features/cross_calls.rs
MathEngineContractRef::new(self.env(), math_engine_address).add(3, 5)

Contract Ref

We mentioned HostRef already in our Testing article - a host side reference to already deployed contract.

In the module context we use a ContractRef instead, to call other contracts.

Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, +by the #[odra::module] attribute.

To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above.

The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module] +impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract.

External Contracts

Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI.

For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of.

Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere.

#[odra::external_contract]
pub trait Adder {
fn add(&self, n1: u32, n2: u32) -> u32;
}

Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call:

AdderContractRef::new(self.env(), address).add(3, 5)

Loading the contract

Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test +our contracts in Livenet backend. We can load the contract using load method on the Deployer:

examples/bin/erc20_on_livenet.rs
fn _load(env: &HostEnv) -> Erc20HostRef {
let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945";
let address = Address::from_str(address).unwrap();
<Erc20HostRef as HostRefLoader>::load(env, address)
}

Testing

Let's see how we can test our cross calls using this knowledge:

examples/src/features/cross_calls.rs
#[cfg(test)]
mod tests {
use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef};
use odra::host::{Deployer, HostRef, NoArgs};

#[test]
fn test_cross_calls() {
let test_env = odra_test::env();
let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs);
let cross_contract = CrossContractHostRef::deploy(
&test_env,
CrossContractInitArgs {
math_engine_address: *math_engine_contract.address()
}
);
assert_eq!(cross_contract.add_using_another(), 8);
}
}

Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize.

#[cfg(test)]
mod tests {
use super::*;
use odra::{Address, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_ext() {
let test_env = odra_test::env();
let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5)
assert_eq!(adder.add(1, 2), 3);
}

fn get_adder_address(test_env: &HostEnv) -> Address {
let contract = MathEngineHostRef::deploy(test_env, NoArgs);
*contract.address()
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/directory-structure/index.html b/docs/docs/next/basics/directory-structure/index.html new file mode 100644 index 000000000..8291ee1a0 --- /dev/null +++ b/docs/docs/next/basics/directory-structure/index.html @@ -0,0 +1,26 @@ + + + + + +Directory structure | Odra + + + + + +
+
Version: next

Directory structure

After creating a new project using Odra and running the tests, you will be presented with the +following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── Odra.toml
├── README.md
├── rust-toolchain
├── src/
│ ├── flipper.rs
│ └── lib.rs
├── bin/
| |── build_contract.rs
| └── build_schema.rs
├── target/
└── wasm/

Cargo.toml

Let's first take a look at Cargo.toml file:

[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "1.1.0"

[dev-dependencies]
odra-test = "1.1.0"

[build-dependencies]
odra-build = "1.1.0"

[[bin]]
name = "sample_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "sample_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also +added as a dev dependency.

Odra.toml

This is the file that holds information about contracts that will be generated when running cargo odra build and +cargo odra test:

[[contracts]]
fqn = "sample::Flipper"

As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to +the contract is located in src/flipper.rs. +More contracts can be added here by hand, or by using cargo odra generate command.

src/

This is the folder where your smart contract files live.

bin/

This is the folder where scripts that will be used to generate code or schemas live. +You don't need to modify those files, they are generated by cargo odra new command and +are used by cargo odra build, cargo odra test and cargo odra schema commands.

target/

Files generated by cargo during the build process are put here.

wasm/

WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files +and deploy them on the blockchain.

What's next

Now, let's take a look at one of the files mentioned above in more detail, +namely the Odra.toml file.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/errors/index.html b/docs/docs/next/basics/errors/index.html new file mode 100644 index 000000000..c79115011 --- /dev/null +++ b/docs/docs/next/basics/errors/index.html @@ -0,0 +1,24 @@ + + + + + +Errors | Odra + + + + + +
+
Version: next

Errors

Odra comes with tools that allow you to throw, handle and test for errors in execution. Take a look at the +following example of a simple owned contract:

examples/src/features/handling_errors.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(errors = Error)]
pub struct OwnedContract {
name: Var<String>,
owner: Var<Address>
}

#[odra::odra_error]
pub enum Error {
OwnerNotSet = 1,
NotAnOwner = 2
}

#[odra::module]
impl OwnedContract {
pub fn init(&mut self, name: String) {
self.name.set(name);
self.owner.set(self.env().caller())
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn owner(&self) -> Address {
self.owner.get_or_revert_with(Error::OwnerNotSet)
}

pub fn change_name(&mut self, name: String) {
let caller = self.env().caller();
if caller != self.owner() {
self.env().revert(Error::NotAnOwner)
}

self.name.set(name);
}
}

Firstly, we are using the #[odra::odra_error] attribute to define our own set of Errors that our contract will +throw. Then, you can use those errors in your code - for example, instead of forcefully unwrapping Options, you can use +unwrap_or_revert_with and pass an error as an argument:

examples/src/features/handling_errors.rs
self.owner.get().unwrap_or_revert_with(Error::OwnerNotSet)

You can also throw the error directly, by using revert:

examples/src/features/handling_errors.rs
self.env().revert(Error::NotAnOwner)

To register errors, add the errors inner attribute to the struct's #[odra::module] attribute and pass the error type as the value. The registered errors will be present in the contract schema.

Defining an error in Odra, you must keep in mind a few rules:

  1. An error should be a field-less enum.
  2. The enum must be annotated with #[odra::odra_error].
  3. Avoid implicit discriminants.
note

In your project you can define as many error enums as you wish, but you must ensure that the discriminants are unique across the project!

Testing errors

Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner:

examples/src/features/handling_errors.rs
#[cfg(test)]
mod tests {
use super::{Error, OwnedContractHostRef, OwnedContractInitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn test_owner_error() {
let test_env = odra_test::env();
let owner = test_env.get_account(0);
let not_an_owner = test_env.get_account(1);

test_env.set_caller(owner);
let init_args = OwnedContractInitArgs {
name: "OwnedContract".to_string()
};
let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args);

test_env.set_caller(not_an_owner);
assert_eq!(
owned_contract.try_change_name("NewName".to_string()),
Err(Error::NotAnOwner.into())
);
}
}

Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult. +OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and +and safe its safe version: try_name, try_owner, try_change_name.

In our example, we are calling try_change_name and expecting an error to be thrown. +For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, +we need to convert our custom error to OdraError using Into::into().

What's next

We will learn how to emit and test events using Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/events/index.html b/docs/docs/next/basics/events/index.html new file mode 100644 index 000000000..adaefcf84 --- /dev/null +++ b/docs/docs/next/basics/events/index.html @@ -0,0 +1,18 @@ + + + + + +Events | Odra + + + + + +
+
Version: next

Events

In the EVM world events are stored as logs within the blockchain's transaction receipts. These logs can be accessed by external applications or other smart contracts to monitor and react to specific events. Casper does not support events natively, however, Odra mimics this feature. Take a look:

examples/src/features/events.rs
use odra::prelude::*;
use odra::Address;

#[odra::module(events = [PartyStarted])]
pub struct PartyContract;

#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64
}

#[odra::module]
impl PartyContract {
pub fn init(&self) {
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});
}
}

We defined a new contract, which emits an event called PartyStarted when the contract is deployed. +To define an event, add the #[odra::event] attribute like this:

examples/src/features/events.rs
#[odra::event]
pub struct PartyStarted {
pub caller: Address,
pub block_time: u64,
}

To emit an event, we use the emit_event function from the ContractEnv, passing the event as an argument:

examples/src/features/events.rs
self.env().emit_event(PartyStarted {
caller: self.env().caller(),
block_time: self.env().get_block_time()
});

To determine all the events at compilation time to register them once the contract is deployed. To register events, add an events inner attribute to the struct's #[odra::module] attribute. The registered events will also be present in the contract schema.

The event collection process is recursive; if your module consists of other modules, and they have already registered their events, you don't need to add them to the parent module.

Testing events

Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted:

examples/src/features/events.rs
use super::{PartyContractHostRef, PartyStarted};
use odra::host::{Deployer, HostEnv, NoArgs};

#[test]
fn test_party() {
let test_env: HostEnv = odra_test::env();
let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs);
test_env.emitted_event(
&party_contract,
&PartyStarted {
caller: test_env.get_account(0),
block_time: 0
}
);
// If you do not want to check the exact event, you can use `emitted` function
test_env.emitted(&party_contract, "PartyStarted");
// You can also check how many events were emitted.
assert_eq!(test_env.events_count(&party_contract), 1);
}

To explore more event testing functions, check the HostEnv documentation.

What's next

Read the next article to learn how to call other contracts from the contract context.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/flipper-internals/index.html b/docs/docs/next/basics/flipper-internals/index.html new file mode 100644 index 000000000..80688f671 --- /dev/null +++ b/docs/docs/next/basics/flipper-internals/index.html @@ -0,0 +1,38 @@ + + + + + +Flipper Internals | Odra + + + + + +
+
Version: next

Flipper Internals

In this article, we take a deep dive into the code shown in the +Flipper example, where we will explain in more detail all +the Odra-specific sections of the code.

flipper.rs
use odra::Var;

Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation +that can be reused between targets. In the above case, we're importing Var, which is responsible +for storing simple values on the blockchain's storage.

Struct

flipper.rs
/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

In Odra, all contracts are also modules, which can be reused between contracts. That's why we need +to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all +the fields of the contract. Those fields can be regular Rust data types, however - those will not +be persisted on the blockchain. They can also be Odra modules - defined in your project or coming +from Odra itself. Finally, to make the data persistent on the blockchain, you can use something like +Var<T> showed above. To learn more about storage interaction, take a look at the +next article.

Impl

flipper.rs
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}
...

Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take all +pub functions from this section and create contract endpoints from them. So, if you wish to have +functions that are not available for calling outside the contract, do not make them public. Alternatively, +you can create a separate impl section without the attribute - all functions defined there, even marked +with pub will be not callable.

The function named init is the constructor of the contract. This function will be limited to only +to a single call, all further calls to it will result in an error. The init function is optional, +if your contract does not need any initialization, you can skip it.

flipper.rs
    ...
/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}
...

The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data +saved there using set function will be persisted in the blockchain.

Tests

flipper.rs
#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
...

You can write tests in any way you prefer and know in Rust. In the example above we are deploying the +contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated +by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, +as the second argument of the deploy function, we pass NoArgs - one of the implementations of +the InitArgs trait provided with the framework.

The contract will be deployed on the VM you chose while running cargo odra test.

What's next

Now let's take a look at the different types of storage that Odra provides and how to use them.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/modules/index.html b/docs/docs/next/basics/modules/index.html new file mode 100644 index 000000000..945a020a6 --- /dev/null +++ b/docs/docs/next/basics/modules/index.html @@ -0,0 +1,21 @@ + + + + + +Modules | Odra + + + + + +
+
Version: next

Modules

Simply put, modules in Odra let you reuse your code between contracts or even projects. Every contract you +write is also a module, thanks to the #[odra::module] attribute. This means that we can easily rewrite our math +example from the previous article, to use a single contract, but still separate our "math" code:

examples/src/features/modules.rs
use crate::features::cross_calls::MathEngine;
use odra::module::SubModule;
use odra::prelude::*;

#[odra::module]
pub struct ModulesContract {
pub math_engine: SubModule<MathEngine>
}

#[odra::module]
impl ModulesContract {
pub fn add_using_module(&self) -> u32 {
self.math_engine.add(3, 5)
}
}
info

To use a module as a component of another module, you need to use the SubModule type. This is a special type +that crates a keyspace (read more in Storage Layout) and provide access to its public methods.

Note that we didn't need to rewrite the MathEngine - we are using the contract from cross calls example as +a module!

info

To see how modules can be used in a real-world scenario, check out the OwnedToken example in the main Odra repository!

Testing

As we don't need to hold addresses, the test is really simple:

examples/src/features/modules.rs
#[cfg(test)]
mod tests {
use super::ModulesContractHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs);
assert_eq!(modules_contract.add_using_module(), 8);
}
}

What's next

We will see how to handle native token transfers.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/native-token/index.html b/docs/docs/next/basics/native-token/index.html new file mode 100644 index 000000000..a49e0e25d --- /dev/null +++ b/docs/docs/next/basics/native-token/index.html @@ -0,0 +1,25 @@ + + + + + +Native token | Odra + + + + + +
+
Version: next

Native token

Different blockchains come with different implementations of their native tokens. Odra wraps it all for you +in easy-to-use code. Let's write a simple example of a public wallet - a contract where anyone can deposit +their funds and anyone can withdraw them:

examples/src/features/native_token.rs
use odra::prelude::*;
use odra::{casper_types::U512, module::Module};

#[odra::module]
pub struct PublicWallet;

#[odra::module]
impl PublicWallet {
#[odra(payable)]
pub fn deposit(&mut self) {}

pub fn withdraw(&mut self, amount: &U512) {
self.env().transfer_tokens(&self.env().caller(), amount);
}
}
danger

The code above works, but is dangerous and unfinished - besides allowing you to lose your funds to anyone, it doesn't make +any checks. To keep the code simple, we skipped the part, where the contract checks if the transfer is +even possible.

To see a more reasonable example, check out examples/src/contracts/tlw.rs in the odra main repository.

You can see a new attribute used here: #[odra(payable)] - it will add all the code needed for a function to +be able to receive the funds. Additionally, we are using a new function from ContractEnv::transfer_tokens(). +It does exactly what you are expecting it to do - it transfers native tokens from the contract to the +specified address.

Testing

To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function - +balance_of:

examples/src/features/native_token.rs
#[cfg(test)]
mod tests {
use super::PublicWalletHostRef;
use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}};

#[test]
fn test_modules() {
let test_env = odra_test::env();
let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs);
assert_eq!(test_env.balance_of(my_contract.address()), U512::zero());

my_contract.with_tokens(U512::from(100)).deposit();
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100));

my_contract.withdraw(U512::from(25));
assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75));
}
}

HostEnv

In a broader context of the host environment (test, livenet), you can also transfer CSPR tokens between accounts:

let env = odra_casper_livenet_env::env();
//let env = odra_test::env();
let (alice, bob) = (env.get_account(0), env.get_account(1));

env.set_caller(alice);
let result = env.transfer_tokens(bob, odra::casper_types::U512::from(100));
+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/odra-toml/index.html b/docs/docs/next/basics/odra-toml/index.html new file mode 100644 index 000000000..bed465aed --- /dev/null +++ b/docs/docs/next/basics/odra-toml/index.html @@ -0,0 +1,23 @@ + + + + + +Odra.toml | Odra + + + + + +
+
Version: next

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts +that Odra will build. Let's take a look at the file structure again:

[[contracts]]
fqn = "sample::Flipper"

The fqn (Fully Qualified Name) is used by the building tools to locate and build the contract. +The last segment of the fqn will be used as the name for your contract - the generated wasm file will +be in the above case named flipper.wasm.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. +To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally +look like this:

[[contracts]]
fqn = "sample::Flipper"

[[contracts]]
fqn = "sample::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous +Flipper contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/storage-interaction/index.html b/docs/docs/next/basics/storage-interaction/index.html new file mode 100644 index 000000000..41c21bfbf --- /dev/null +++ b/docs/docs/next/basics/storage-interaction/index.html @@ -0,0 +1,37 @@ + + + + + +Storage interaction | Odra + + + + + +
+
Version: next

Storage interaction

The Odra framework implements multiple types of data that can be stored on the blockchain. Let's go +through all of them and explain their pros and cons.

Var

The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your +variable in the Var type. Let's look at a "real world" example of a contract that represents a dog:

examples/src/features/storage/variable.rs
use odra::prelude::*;
use odra::Var;

#[odra::module]
pub struct DogContract {
barks: Var<bool>,
weight: Var<u32>,
name: Var<String>,
walks: Var<Vec<u32>>,
}

You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)!

Let's make this contract usable, by providing a constructor and some getter functions:

examples/src/features/storage/variable.rs
#[odra::module]
impl DogContract {
pub fn init(&mut self, barks: bool, weight: u32, name: String) {
self.barks.set(barks);
self.weight.set(weight);
self.name.set(name);
self.walks.set(Vec::<u32>::default());
}

pub fn barks(&self) -> bool {
self.barks.get_or_default()
}

pub fn weight(&self) -> u32 {
self.weight.get_or_default()
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.len() as u32
}

pub fn walks_total_length(&self) -> u32 {
let walks = self.walks.get_or_default();
walks.iter().sum()
}
}

As you can see, you can access the data, by using get_or_default function:

examples/src/features/storage/variable.rs
...
self.barks.get_or_default()
...
note

Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable +doesn't have to be initialized!

To modify the data, use the set() function:

examples/src/features/storage/variable.rs
self.barks.set(barks);

A Var is easy to use and efficient for simple data types. One of its downsides is that it +serializes the data as a whole, so when you're using complex types like Vec or HashMap, +each time you get or set the whole data is read and written to the blockchain storage.

In the example above, if we want to see how many walks our dog had, we would use the function:

examples/src/features/storage/variable.rs
pub fn walks_amount(&self) -> usize {
let walks = self.walks.get_or_default();
walks.len()
}

But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, +especially for larger sets of data.

To tackle this issue following two types were created.

Mapping

The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to +pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that +uses Mapping to store information about our dog's friends and how many times they visited:

examples/src/features/storage/mapping.rs
use odra::prelude::*;
use odra::{Mapping, Var};

#[odra::module]
pub struct DogContract2 {
name: Var<String>,
friends: Mapping<String, u32>,
}

In the example above, our key is a String (it is a name of the friend) and we are storing u32 values +(amount of visits). To read and write values from and into a Mapping we use a similar approach +to the one shown in the Vars section with one difference - we need to pass a key:

examples/src/features/storage/mapping.rs
pub fn visit(&mut self, friend_name: String) {
let visits = self.visits(friend_name.clone());
self.friends.set(&friend_name, visits + 1);
}

pub fn visits(&self, friend_name: String) -> u32 {
self.friends.get_or_default(&friend_name)
}

The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. +The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. +We could implement such behavior by using a numeric type key and saving the length of the set in a +separate variable. Thankfully Odra comes with a prepared solution - the List type.

note

If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with +a Var working together:

core/src/list.rs
use odra::{List, Var};

pub struct List<T> {
values: Mapping<u32, T>,
index: Var<u32>
}

List

Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, +we'll use the list:

examples/src/features/storage/list.rs
use odra::{prelude::*, List, Var};

#[odra::module]
pub struct DogContract3 {
name: Var<String>,
walks: List<u32>,
}

As you can see, the notation is very similar to the Vec. To understand the usage, take a look +at the reimplementation of the functions with an additional function that takes our dog for a walk +(it writes the data to the storage):

examples/src/features/storage/list.rs
#[odra::module]
impl DogContract3 {
pub fn init(&mut self, name: String) {
self.name.set(name);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn walks_amount(&self) -> u32 {
self.walks.len()
}

pub fn walks_total_length(&self) -> u32 {
self.walks.iter().sum()
}

pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}
}

Now, we can know how many walks our dog had without loading the whole vector from the storage. +We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all +the cases for you.

info

All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder.

Custom Types

By default you can store only built-in types like numbers, Options, Results, Strings, Vectors.

Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type:

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}

#[odra_type] is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type. +CLType of a custom type is CLType::Any, except for an unit-only enum, which is CLType::U8.

unit_only_enum.rs
enum Enum {
Foo = 3,
Bar = 2,
Baz = 1,
}
note

Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute .

What's next

In the next article, we'll see how to query the host for information about the world and our contract.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/basics/testing/index.html b/docs/docs/next/basics/testing/index.html new file mode 100644 index 000000000..3683ae382 --- /dev/null +++ b/docs/docs/next/basics/testing/index.html @@ -0,0 +1,32 @@ + + + + + +Testing | Odra + + + + + +
+
Version: next

Testing

Thanks to the Odra framework, you can test your code in any way you are used to. This means you can write +regular Rust unit and integration tests. Have a look at how we test the Dog Contract we created in the +previous article:

examples/src/features/storage/list.rs
use odra::{List, Var};

#[cfg(test)]
mod tests {
use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

#[test]
fn init_test() {
let test_env = odra_test::env();
let init_args = DogContract3InitArgs {
name: "DogContract".to_string()
};
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);
assert_eq!(dog_contract.walks_amount(), 0);
assert_eq!(dog_contract.walks_total_length(), 0);
dog_contract.walk_the_dog(5);
dog_contract.walk_the_dog(10);
assert_eq!(dog_contract.walks_amount(), 2);
assert_eq!(dog_contract.walks_total_length(), 15);
}
}

The first interesting thing you may notice is placed the import section.

use super::{DogContract3HostRef, DogContract3InitArgs};
use odra::{host::Deployer, prelude::*};

We are using super to import the DogContract3HostRef and DogContract3InitArgs from the parent module. +{{ModuleName}}HostRef and {{ModuleName}}InitArgs are types that was generated for us by Odra.

DogContract3HostRef is a reference to the contract that we can use to interact with it (call entrypoints) +and implements HostRef trait.

DogContract3InitArgs is a struct that we use to initialize the contract and implements InitArgs trait. +Considering the contract initialization, there three possible scenarios:

  1. The contract has a constructor with arguments, then Odra creates a struct named {{ModuleName}}InitArgs.
  2. The contract has a constructor with no arguments, then you can use odra::host::NoArgs.
  3. The contract does not have a constructor, then you can use odra::host::NoArgs. +All of those structs implement the odra::host::InitArgs trait, required to conform to the +Deployer::deploy method signature.

The other import is odra::host::Deployer. This is a trait is used to deploy the contract and give us a reference to it.

Let's take a look at the test itself. How to obtain a reference to the contract? +{{ModuleName}}HostRef implements the Deployer trait, which provides the deploy method:

examples/src/features/storage/list.rs
let mut dog_contract = DogContract3HostRef::deploy(&test_env, init_args);

From now on, we can use dog_contract to interact with our deployed contract - in particular, all +pub functions from the impl section that was annotated with the odra::module attribute are available to us:

examples/src/features/storage/list.rs
// Impl
pub fn walk_the_dog(&mut self, length: u32) {
self.walks.push(length);
}

...

// Test
dog_contract.walk_the_dog(5);

HostEnv

Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) +and to configure how the contracts are deployed and called. Let's revisit the example from the previous +article about host communication and implement the tests that prove it works:

examples/src/features/testing.rs
#[cfg(test)]
mod tests {
use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs};
use odra::{host::{Deployer, HostEnv}, prelude::*};

#[test]
fn env() {
let test_env: HostEnv = odra_test::env();
test_env.set_caller(test_env.get_account(0));
let init_args = TestingContractInitArgs {
name: "MyContract".to_string()
};
let testing_contract = TestingContractHostRef::deploy(&test_env, init_args);
let creator = testing_contract.created_by();
test_env.set_caller(test_env.get_account(1));
let init_args = TestingContractInitArgs {
name: "MyContract2".to_string()
};
let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args);
let creator2 = testing_contract2.created_by();
assert_ne!(creator, creator2);
}
}

In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). +Next, we are deploying two instances of the same contract, but we're using HostEnv::set_caller +to change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller() +the function we are calling inside the contract.

HostEnv comes with a set of functions that will let you write better tests:

  • fn set_caller(&self, address: Address) - you've seen it in action just now
  • fn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given address
  • fn advance_block_time(&self, time_diff: u64) - increases the current value of block_time
  • fn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; +by default, you start with the 0-th account
  • fn emitted_event<T: ToBytes + EventInstance, R: Addressable>(&self, contract_address: &R, event: &T) -> bool - verifies if the event was emitted by the contract

Full list of functions can be found in the HostEnv documentation.

What's next

We take a look at how Odra handles errors!

+ + + + \ No newline at end of file diff --git a/docs/docs/next/category/advanced/index.html b/docs/docs/next/category/advanced/index.html new file mode 100644 index 000000000..188d22fa3 --- /dev/null +++ b/docs/docs/next/category/advanced/index.html @@ -0,0 +1,17 @@ + + + + + +Advanced | Odra + + + + + +
+
+ + + + \ No newline at end of file diff --git a/docs/docs/next/category/backends/index.html b/docs/docs/next/category/backends/index.html new file mode 100644 index 000000000..7bad16f6c --- /dev/null +++ b/docs/docs/next/category/backends/index.html @@ -0,0 +1,17 @@ + + + + + +Backends | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/next/category/basics/index.html b/docs/docs/next/category/basics/index.html new file mode 100644 index 000000000..70d2b8c2a --- /dev/null +++ b/docs/docs/next/category/basics/index.html @@ -0,0 +1,17 @@ + + + + + +Basics | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/next/category/examples/index.html b/docs/docs/next/category/examples/index.html new file mode 100644 index 000000000..6f6e65f0d --- /dev/null +++ b/docs/docs/next/category/examples/index.html @@ -0,0 +1,17 @@ + + + + + +Examples | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/next/category/getting-started/index.html b/docs/docs/next/category/getting-started/index.html new file mode 100644 index 000000000..17b0682a1 --- /dev/null +++ b/docs/docs/next/category/getting-started/index.html @@ -0,0 +1,17 @@ + + + + + +Getting started | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/next/category/migrations/index.html b/docs/docs/next/category/migrations/index.html new file mode 100644 index 000000000..669574575 --- /dev/null +++ b/docs/docs/next/category/migrations/index.html @@ -0,0 +1,17 @@ + + + + + +Migrations | Odra + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/next/category/tutorials/index.html b/docs/docs/next/category/tutorials/index.html new file mode 100644 index 000000000..8ebae6dca --- /dev/null +++ b/docs/docs/next/category/tutorials/index.html @@ -0,0 +1,17 @@ + + + + + +Tutorials | Odra + + + + + +
+
Version: next

Tutorials

The theory is good, but the practice is even better. Let's go through a few examples summing up all the Odra concepts.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/examples/odra-examples/index.html b/docs/docs/next/examples/odra-examples/index.html new file mode 100644 index 000000000..ad6d1811d --- /dev/null +++ b/docs/docs/next/examples/odra-examples/index.html @@ -0,0 +1,17 @@ + + + + + +odra-examples | Odra + + + + + +
+
Version: next

odra-examples

Odra repository provides rich source learning materials. We want to ensure you would feel comfortable with the framework from day one and make the learning curve as flat as possible. Are you a Solidity developer? Are you a Casper developer? Are you new to smart contracts development? To learn Odra from its creators, look at the examples in the Odra main repository.

The examples we have prepared demonstrate in "real code" all the concepts you have read in this documentation, from a simple access control module ending up with a wallet where you can lock your native tokens for a certain amount of time.

Don't worry if you find learning solely by reading the code challenging. Go to the Tutorial section, where we will review it together. We will break the code into pieces, leaving no space for further questions.

What's next

Read the next article to learn about reusable Odra components encapsulated in odra-modules.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/examples/using-odra-modules/index.html b/docs/docs/next/examples/using-odra-modules/index.html new file mode 100644 index 000000000..33244e013 --- /dev/null +++ b/docs/docs/next/examples/using-odra-modules/index.html @@ -0,0 +1,21 @@ + + + + + +Using odra-modules | Odra + + + + + +
+
Version: next

Using odra-modules

Besides the Odra framework, you can attach to your project odra-module - a set of plug-and-play modules.

If you followed the Installation guide your Cargo.toml should look like:

Cargo.toml
[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "1.1.0"

[dev-dependencies]
odra-test = "1.1.0"

[build-dependencies]
odra-build = "1.1.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

To use odra-modules, edit your dependency and features sections.

Cargo.toml
[dependencies]
odra = "1.1.0"
odra-modules = "1.1.0"

Now, the only thing left is to add a module to your contract.

Let's write an example of MyToken based on Erc20 module.

use odra::prelude::*;
use odra::{Address, casper_types::U256, module::SubModule};
use odra_modules::erc20::Erc20;

#[odra::module]
pub struct MyToken {
erc20: SubModule<Erc20>
}

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, initial_supply: U256) {
let name = String::from("MyToken");
let symbol = String::from("MT");
let decimals = 9u8;
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: Address, spender: Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: Address, amount: U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: Address, amount: U256) {
self.erc20.approve(spender, amount);
}
}
info

All available modules are placed in the main Odra repository.

Available modules

Odra modules comes with couple of ready-to-use modules and reusable extensions.

Tokens

CEP-18

Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 here.

CEP-78

Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 here.

Erc20

The Erc20 module implements the ERC20 standard.

Erc721

The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework.

The Erc721Token module implements the ERC721Base and additionally uses +the Erc721Metadata and Ownable extensions.

The Erc721Receiver trait lets you implement your own logic for receiving NFTs.

The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules.

Erc1155

The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework.

The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension.

The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules.

Wrapped native token

The WrappedNativeToken module implements the Wrapper for the native token, +it was inspired by the WETH.

Access

AccessControl

This module enables the implementation of role-based access control mechanisms for children +modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API.

Ownable

This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner.

The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using the +transfer_ownership() function.

Ownable2Step

An extension of the Ownable module.

Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions.

Security

Pausable

A module allowing to implement an emergency stop mechanism that can be triggered by any account.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/getting-started/flipper/index.html b/docs/docs/next/getting-started/flipper/index.html new file mode 100644 index 000000000..426963817 --- /dev/null +++ b/docs/docs/next/getting-started/flipper/index.html @@ -0,0 +1,18 @@ + + + + + +Flipper example | Odra + + + + + +
+
Version: next

Flipper example

To quickly start working with Odra, take a look at the following code sample. If you followed the +Installation tutorial, you should have this file already at src/flipper.rs.

For further explanation of how this code works, see Flipper Internals.

Let's flip

flipper.rs
use odra::Var;

/// A module definition. Each module struct consists Vars and Mappings
/// or/and another modules.
#[odra::module]
pub struct Flipper {
/// The module itself does not store the value,
/// it's a proxy that writes/reads value to/from the host.
value: Var<bool>,
}

/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl Flipper {
/// Odra constructor, must be named `init`.
///
/// Initializes the contract with the value of value.
pub fn init(&mut self) {
self.value.set(false);
}

/// Replaces the current value with the passed argument.
pub fn set(&mut self, value: bool) {
self.value.set(value);
}

/// Replaces the current value with the opposite value.
pub fn flip(&mut self) {
self.value.set(!self.get());
}

/// Retrieves value from the storage.
/// If the value has never been set, the default value is returned.
pub fn get(&self) -> bool {
self.value.get_or_default()
}
}

#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};

#[test]
fn flipping() {
let env = odra_test::env();
// To test a module we need to deploy it. Autogenerated `FlipperHostRef`
// implements `Deployer` trait, so we can use it to deploy the module.
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}

#[test]
fn test_two_flippers() {
let env = odra_test::env();
let mut contract1 = FlipperHostRef::deploy(&env, NoArgs);
let contract2 = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract1.get());
assert!(!contract2.get());
contract1.flip();
assert!(contract1.get());
assert!(!contract2.get());
}
}

Testing

To run the tests, execute the following command:

cargo odra test # or add the `-b casper` flag to run tests on the CasperVM

What's next

In the next category of articles, we will go through basic concepts of Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/getting-started/installation/index.html b/docs/docs/next/getting-started/installation/index.html new file mode 100644 index 000000000..ad788fc67 --- /dev/null +++ b/docs/docs/next/getting-started/installation/index.html @@ -0,0 +1,22 @@ + + + + + +Installation | Odra + + + + + +
+
Version: next

Installation

Hello fellow Odra user! This page will guide you through the installation process.

Prerequisites

To start working with Odra, you need to have the following installed on your machine:

  • Rust toolchain installed (see rustup.rs)
  • wasmstrip tool installed (see wabt)

We do not provide exact commands for installing these tools, as they are different for different operating systems. +Please refer to the documentation of the tools themselves.

With Rust toolchain ready, you can add a new target:

rustup target add wasm32-unknown-unknown
note

wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files.

Installing Cargo Odra

Cargo Odra is a helpful tool that will help you to build and test your smart contracts. +It is not required to use Odra, but the documentation will assume that you have it installed.

To install it, simply execute the following command:

cargo install cargo-odra --locked

To check if it was installed correctly and see available commands, type:

cargo odra --help

If everything went fine, we can proceed to the next step.

Creating a new Odra project

To create a new project, simply execute:

cargo odra new --name my-project && cd my_project

This will create a new folder called my_project and initialize Odra there. Cargo Odra +will create a sample contract for you in src directory. You can run the tests of this contract +by executing:

cargo odra test

This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM:

cargo odra test -b casper

Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during +the installation process, feel free to ask for help on our Discord.

What's next?

If you want to see the code that you just tested, continue to the description of Flipper example.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/index.html b/docs/docs/next/index.html new file mode 100644 index 000000000..267aac77c --- /dev/null +++ b/docs/docs/next/index.html @@ -0,0 +1,19 @@ + + + + + +Odra framework | Odra + + + + + +
+
Version: next

Odra framework

Odra is a Rust-based smart contract framework for Casper Network. Odra encourages rapid development and clean, +pragmatic design. Built by experienced developers, takes care of much of the hassle of smart contract +development, enabling you to focus on writing your dapp without reinventing the wheel.

It's free and open source!

What's next

See the Installation and our Flipper example to find out how to start your new project with Odra.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/migrations/to-0.8.0/index.html b/docs/docs/next/migrations/to-0.8.0/index.html new file mode 100644 index 000000000..09d3926e7 --- /dev/null +++ b/docs/docs/next/migrations/to-0.8.0/index.html @@ -0,0 +1,19 @@ + + + + + +Migration guide to v0.8.0 | Odra + + + + + +
+
Version: next

Migration guide to v0.8.0

Odra v0.8.0 introduces several breaking changes that require users to update their smart contracts and tests. This migration guide provides a detailed overview of the changes, along with step-by-step instructions for migrating existing code to the new version.

This guide is intended for developers who have built smart contracts using previous versions of Odra and need to update their code to be compatible with v0.8.0. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant changes in v0.8.0 include:

  • Odra is not a blockchain-agnostic framework anymore. It is now a Casper smart contract framework only.
  • Framework internals redesign.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0.

2. Migration Steps

2.1 Add bin directory

Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory.

You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2. Update Cargo.toml

There a bunch of changes in the Cargo.toml file.

  • You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.
  • Register bins you added in the previous step.
  • Add dev-dependencies section with odra-test crate.
  • Add recommended profiles for release and dev to optimize the build process.

Below you can compare the Cargo.toml file after and before the migration to v0.8.0:

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = "0.8.0"

[dev-dependencies]
odra-test = "0.8.0"

[[bin]]
name = "my_project_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "my_project_build_schema"
path = "bin/build_schema.rs"
test = false

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

2.2. Update Odra.toml

Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required.

[[contracts]]
fqn = "my_project::Flipper"

2.3. Update Smart Contracts

The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make:

2.3.1. Update the use statements to reflect the new module structure.

  • Big integer types are now located in the odra::casper_types module.
  • odra::types::Address is now odra::Address.
  • Variable is now Var.
  • Remove odra::contract_env.
  • Remove odra::types::event::OdraEvent.
  • Remove odra::types::OdraType as it is no longer required.
  • Change odra::types::casper_types::*; to odra::casper_types::*;.

2.3.2. Some type aliases are no longer in use.

  • Balance - use odra::casper_types::U512.
  • BlockTime - use u64.
  • EventData - use odra::casper_types::bytesrepr::Bytes.

2.3.3. Consider import odra::prelude::* in your module files.

2.3.4. Flatten nested Mappings.

// Before
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<Address, Mapping<Address, U256>>
}
// After
#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
...
allowances: Mapping<(Address, Address), U256>
}

2.3.5. Update errors definitions.

execution_error! macro has been replace with OdraError derive macro.

use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.3.6. Update events definitions.

use odra::prelude::*;
use odra::Event;

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

// Emitting the event
self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});

2.3.7. Replace contract_env with self.env() in your modules.

self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes.

  • fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.
  • fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).
  • set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions.
  • fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].
  • fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.
  • fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).
  • fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.
  • functions native_token_metadata() and one_token() have been removed.

2.3.8. Wrap submodules of your module with odra::SubModule<T>.

#[odra::module(events = [Transfer])]
pub struct Erc721Token {
core: SubModule<Erc721Base>,
metadata: SubModule<Erc721MetadataExtension>,
ownable: SubModule<Ownable>
}

2.3.9. Update external contract calls.

However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()).

#[odra::external_contract]
pub trait Token {
fn balance_of(&self, owner: &Address) -> U256;
}

// Usage
TokenContractRef::new(env, token).balance_of(account)

2.3.10. Update constructors.

Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init.

2.3.11. Update UnwrapOrRevert calls.

The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter.

2.3.12. Remove #[odra(using)] attribute from your module definition.

Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required.

2.4. Update Tests

Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make:

2.4.1. Contract deployment.

The way you deploy a contract has changed:

  1. You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.
  2. Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.
  3. If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.
  4. If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function.
// A contract without init args
use super::OwnableHostRef;
use odra::host::{Deployer, HostEnv, HostRef, NoArgs};

let env: HostEnv = odra_test::env();
let ownable = OwnableHostRef::deploy(&env, NoArgs)

// A contract with init args
use super::{Erc20HostRef, Erc20InitArgs};
use odra::host::{Deployer, HostEnv};

let env: HostEnv = odra_test::env();
let init_args = Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
};
let erc20 = Erc20HostRef::deploy(&env, init_args);

2.4.2. Host interactions.

  1. Replace odra::test_env with odra_test::env().
  2. The API of odra::test_env and odra_test::env() are similar, but there are some differences:
    • test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).
    • test_env::token_balance(Address) is now env.balance_of(&Address).
    • functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef.

2.4.3. Testing failing scenarios.

test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result. +try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro.

#[test]
fn transfer_from_error() {
let (env, mut erc20) = setup();

let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

assert_eq!(
erc20.try_transfer_from(owner, recipient, amount),
Err(Error::InsufficientAllowance.into())
);
}

2.4.4. Testing events.

assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. +The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options.

let env: HostEnv = odra_test::env();
let erc20 = Erc20HostRef::deploy(&env, init_args);

...

assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.8.0.

src/erc20.rs
use crate::erc20::errors::Error::*;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address, Event};

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[derive(Event, Eq, PartialEq, Debug)]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
use odra::OdraError;

#[derive(OdraError)]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
use super::{
errors::Error,
events::{Approval, Transfer},
Erc20HostRef, Erc20InitArgs
};
use odra::{
casper_types::U256,
host::{Deployer, HostEnv, HostRef},
prelude::*
};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: Some(INITIAL_SUPPLY.into())
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

// Other tests...
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/next/migrations/to-0.9.0/index.html b/docs/docs/next/migrations/to-0.9.0/index.html new file mode 100644 index 000000000..b0d385bd0 --- /dev/null +++ b/docs/docs/next/migrations/to-0.9.0/index.html @@ -0,0 +1,18 @@ + + + + + +Migration guide to v0.9.0 | Odra + + + + + +
+
Version: next

Migration guide to v0.9.0

This guide is intended for developers who have built smart contracts using version 0.8.0 of Odra and need to update their code to be compatible with v0.9.0. For migration from version 0.7.1 and below, start with the previous guide. It assumes a basic understanding of smart contract development and the Odra framework. If you're new to Odra, we recommend to start your journey with the Getting Started.

The most significant change in 0.9.0 is the way of defining custom elements namely type, events and errors.

1. Prerequisites

1.1. Update cargo-odra

Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command:

cargo install cargo-odra --force --locked

1.2. Review the Changelog

Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0.

2. Migration Steps

2.1 Update build_schema.rs bin

Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project.

2.2 Update smart contract code

The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes.

2.2.1. Update custom types definitions.

#[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute.

use odra::Address;

#[odra::odra_type]
pub struct Dog {
pub name: String,
pub age: u8,
pub owner: Option<Address>
}

2.2.2. Update errors definitions.

#[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. +Error enum should be passed as a parameter to the #[odra::module] attribute.

#[odra::module(events = [/* events go here */], errors = Error)]
pub struct Erc20 {
// fields
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}

2.2.3. Update events definitions.

#[derive(Event)] attribute has been replace with #[odra::event] attribute.

use odra::prelude::*;
use odra::{Address, casper_types::U256};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

3. Code Examples

Here is a complete example of a smart contract after and before the migration to v0.9.0.

src/erc20.rs
use crate::erc20::errors::Error;
use crate::erc20::events::*;
use odra::prelude::*;
use odra::{casper_types::U256, Address, Mapping, Var};

#[odra::module(events = [Approval, Transfer], errors = Error)]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}

#[odra::module]
impl Erc20 {
pub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>
) {
let caller = self.env().caller();
self.symbol.set(symbol);
self.name.set(name);
self.decimals.set(decimals);

if let Some(initial_supply) = initial_supply {
self.total_supply.set(initial_supply);
self.balances.set(&caller, initial_supply);

if !initial_supply.is_zero() {
self.env().emit_event(Transfer {
from: None,
to: Some(caller),
amount: initial_supply
});
}
}
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();

self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();

self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn name(&self) -> String {
self.name.get_or_revert_with(Error::NameNotSet)
}

// Other getter functions...

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.total_supply.add(*amount);
self.balances.add(address, *amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}

pub fn burn(&mut self, address: &Address, amount: &U256) {
if self.balance_of(address) < *amount {
self.env().revert(Error::InsufficientBalance);
}
self.total_supply.subtract(*amount);
self.balances.subtract(address, *amount);

self.env().emit_event(Transfer {
from: Some(*address),
to: None,
amount: *amount
});
}
}

impl Erc20 {
fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
if *amount > self.balances.get_or_default(owner) {
self.env().revert(Error::InsufficientBalance)
}

self.balances.subtract(owner, *amount);
self.balances.add(recipient, *amount);

self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowances.get_or_default(&(*owner, *spender));
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
self.allowances.subtract(&(*owner, *spender), *amount);

self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

pub mod events {
use odra::prelude::*;
use odra::{casper_types::U256, Address};

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}
}

pub mod errors {
#[odra::odra_error]
pub enum Error {
InsufficientBalance = 30_000,
InsufficientAllowance = 30_001,
NameNotSet = 30_002,
SymbolNotSet = 30_003,
DecimalsNotSet = 30_004
}
}

#[cfg(test)]
mod tests {
// nothing changed in the tests
}

4. Troubleshooting

If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments.

5. References

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/access-control/index.html b/docs/docs/next/tutorials/access-control/index.html new file mode 100644 index 000000000..ca4bb89fe --- /dev/null +++ b/docs/docs/next/tutorials/access-control/index.html @@ -0,0 +1,17 @@ + + + + + +Access Control | Odra + + + + + +
+
Version: next

Access Control

In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,

In this article we design and implement a more fine-grained access control layer.

Code

Before we start writing code, we list the functionalities of our access control layer.

  1. A Role type is used across the module.
  2. A Role can be assigned to many Addresses.
  3. Each Role may have a corresponding admin role.
  4. Only an admin can grant/revoke a Role.
  5. A Role can be renounced.
  6. A Role cannot be renounced on someone's behalf.
  7. Each action triggers an event.
  8. Unauthorized access stops contract execution.

Project Structure

access-control
├── src
│ ├── access
│ │ ├── access_control.rs
│ │ ├── events.rs
│ │ └── errors.rs
│ └── lib.rs
|── build.rs
|── Cargo.toml
└── Odra.toml

Events and Errors

There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions.

events.rs
use odra::prelude::*;
use odra::Address;
use super::access_control::Role;

#[odra::event]
pub struct RoleGranted {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleRevoked {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleAdminChanged {
pub role: Role,
pub previous_admin_role: Role,
pub new_admin_role: Role
}
  • L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.
  • L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role.
errors.rs
#[odra::odra_error]
pub enum Error {
MissingRole = 20_000,
RoleRenounceForAnotherAddress = 20_001,
}

Errors definition is straightforward - there are only two invalid states:

  1. An action is triggered by an unauthorized actor.
  2. The caller is attempting to resign the Role on someone's behalf.

Module

Now, we are stepping into the most interesting part: the module definition and implementation.

access_control.rs
use super::events::*;
use super::errors::Error;
use odra::prelude::*;
use odra::{Address, Mapping};

pub type Role = [u8; 32];

pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];

#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]
pub struct AccessControl {
roles: Mapping<(Role, Address), bool>,
role_admin: Mapping<Role, Role>
}

#[odra::module]
impl AccessControl {
pub fn has_role(&self, role: &Role, address: &Address) -> bool {
self.roles.get_or_default(&(*role, *address))
}

pub fn get_role_admin(&self, role: &Role) -> Role {
let admin_role = self.role_admin.get(role);
if let Some(admin) = admin_role {
admin
} else {
DEFAULT_ADMIN_ROLE
}
}

pub fn grant_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_grant_role(role, address);
}

pub fn revoke_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_revoke_role(role, address);
}

pub fn renounce_role(&mut self, role: &Role, address: &Address) {
if address != &self.env().caller() {
self.env().revert(Error::RoleRenounceForAnotherAddress);
}
self.unchecked_revoke_role(role, address);
}
}

impl AccessControl {
pub fn check_role(&self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.env().revert(Error::MissingRole);
}
}

pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {
let previous_admin_role = self.get_role_admin(role);
self.role_admin.set(role, *admin_role);
self.env().emit_event(RoleAdminChanged {
role: *role,
previous_admin_role,
new_admin_role: *admin_role
});
}

pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.roles.set(&(*role, *address), true);
self.env().emit_event(RoleGranted {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}

pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {
if self.has_role(role, address) {
self.roles.set(&(*role, *address), false);
self.env().emit_event(RoleRevoked {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}
}
  • L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.
  • L8 - The default role is an array filled with zeros.
  • L10-L13 - The storage consists of two mappings:
  1. roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.
  2. role_admin - each Role can have a single admin Role.
  • L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.
  • L49 - This is a non-exported block containing helper functions.
  • L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.
  • L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.
  • L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).
  • L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.
  • L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access.
+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/build-deploy-read/index.html b/docs/docs/next/tutorials/build-deploy-read/index.html new file mode 100644 index 000000000..4fe9e89a2 --- /dev/null +++ b/docs/docs/next/tutorials/build-deploy-read/index.html @@ -0,0 +1,17 @@ + + + + + +Build, Deploy and Read the State of a Contract | Odra + + + + + +
+
Version: next

Build, Deploy and Read the State of a Contract

In this guide, we will show the full path from creating a contract, deploying it and reading the state.

We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript.

Before you start, make sure you completed the following steps:

Contract

Let's write a contract with complex storage layout.

The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping.

We will expose two methods:

  1. The constructor init which sets the metadata and the version of the contract.
  2. The method set_data which sets the value of the numeric field and the values of the mapping.
custom_item.rs
use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};

// A custom type with a vector of another custom type
#[odra::odra_type]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[odra::odra_type]
pub struct Price {
value: U256,
}

// The main contract with a version, metadata and a submodule
#[odra::module]
pub struct CustomItem {
version: Var<u32>,
meta: Var<Metadata>,
data: SubModule<Data>
}

#[odra::module]
impl CustomItem {
pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {
let meta = Metadata {
name,
description,
prices: vec![
Price { value: price_1 },
Price { value: price_2 }
]
};
self.meta.set(meta);
self.version.set(self.version.get_or_default() + 1);
}

pub fn set_data(&mut self, value: u32, name: String, name2: String) {
self.data.value.set(value);
self.data.inner.named_values.set(&name, 10);
self.data.inner.named_values.set(&name2, 20);
}
}

// A submodule with a numeric value and another submodule
#[odra::module]
struct Data {
value: Var<u32>,
inner: SubModule<InnerData>,
}

// A submodule with a mapping
#[odra::module]
struct InnerData {
named_values: Mapping<String, u32>,
}

Deploying the contract

First, we need to setup the chain. We will use the NCTL docker image to run a local network.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Next, we need to compile the contract to a Wasm file.

cargo odra build -c custom_item 

Then, we can deploy the contract using the casper-client tool.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key path/to/your/secret_key.pem \
--session-path [PATH_TO_WASM] \
--payment-amount 100000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string='My Name'" \
--session-arg "description:string='My Description'" \
--session-arg "price_1:u256='101'" \
--session-arg "price_2:u256='202'"

Finally, we can call the set_data method to set the values of the contract.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key ./keys/secret_key.pem \
--payment-amount 2000000000 \
--session-hash [DEPLOYED_CONTRACT_HASH] \
--session-entry-point "set_data" \
--session-arg "value:u32:'666'" \
--session-arg "name:string='alice'" \
--session-arg "name2:string='bob'"

Storage Layout

To read the state of the contract, we need to understand the storage layout.

The first step is to calculate the index of the keys.

Storage Layout

CustomItem: prefix: 0x0..._0000_0000_0000 0
version: u32, 0x0..._0000_0000_0001 1
meta: Metadata, 0x0..._0000_0000_0010 2
data: Data: prefix: 0x0..._0000_0000_0011 3
value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1
inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2
named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1

The actual key is obtained as follows:

  1. Convert the index to a big-endian byte array.
  2. Concatenate the index with the mapping data.
  3. Hash the concatenated bytes using blake2b.
  4. Return the hex representation of the hash (the stored key must be utf-8 encoded).

In more detail, the storage layout is described in the Storage Layout article.

Reading the state

main.rs
use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};
use casper_types::{
bytesrepr::{FromBytes, ToBytes},
U256,
};

// replace with your contract hash
const CONTRACT_HASH: &str = "hash-...";
const NODE_ADDRESS: &str = "http://localhost:11101/rpc";
const RPC_ID: &str = "casper-net-1";
const DICTIONARY_NAME: &str = "state";

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

async fn read_state_key(key: String) -> Vec<u8> {
let state_root_hash = casper_client::get_state_root_hash(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
None,
)
.await
.unwrap()
.result
.state_root_hash
.unwrap();

// Read the value from the `state` dictionary.
let result = casper_client::get_dictionary_item(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
state_root_hash,
DictionaryItemIdentifier::ContractNamedKey {
key: CONTRACT_HASH.to_string(),
dictionary_name: DICTIONARY_NAME.to_string(),
dictionary_item_key: key,
},
)
.await
.unwrap()
.result
.stored_value;

// We expect the value to be a CLValue
if let StoredValue::CLValue(cl_value) = result {
// Ignore the first 4 bytes, which are the length of the CLType.
cl_value.inner_bytes()[4..].to_vec()
} else {
vec![]
}
}

async fn metadata() -> Metadata {
// The key for the metadata is 2, and it has no mapping data
let key = key(2, &[]);
let bytes = read_state_key(key).await;

// Read the name and store the remaining bytes
let (name, bytes) = String::from_bytes(&bytes).unwrap();
// Read the description and store the remaining bytes
let (description, bytes) = String::from_bytes(&bytes).unwrap();
// A vector is stored as a u32 size followed by the elements
// Read the size of the vector and store the remaining bytes
let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();

let mut prices = vec![];
// As we know the size of the vector, we can loop over it
for _ in 0..size {
// Read the value and store the remaining bytes
let (value, rem) = U256::from_bytes(&bytes).unwrap();
bytes = rem;
prices.push(Price { value });
}
// Anytime you finish parsing a value, you should check if there are any remaining bytes
// if there are, it means you have a bug in your parsing logic.
// For simplicity, we will ignore the remaining bytes here.
Metadata {
name,
description,
prices
}
}

async fn value() -> u32 {
// The key for the value is (3 << 4) + 1, and it has no mapping data
let key = key((3 << 4) + 1, &[]);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

async fn named_value(name: &str) -> u32 {
// The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes
let mapping_data = name.to_bytes().unwrap();
let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

fn main() {
let runtime = tokio::runtime::Runtime::new().unwrap();
dbg!(runtime.block_on(metadata()));
dbg!(runtime.block_on(value()));
dbg!(runtime.block_on(named_value("alice")));
dbg!(runtime.block_on(named_value("bob")));
}

// The key is a combination of the index and the mapping data
// The algorithm is as follows:
// 1. Convert the index to a big-endian byte array
// 2. Concatenate the index with the mapping data
// 3. Hash the concatenated bytes using blake2b
// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)
fn key(idx: u32, mapping_data: &[u8]) -> String {
let mut key = Vec::new();
key.extend_from_slice(idx.to_be_bytes().as_ref());
key.extend_from_slice(mapping_data);
let hashed_key = blake2b(&key);

hex::encode(&hashed_key)
}

fn blake2b(bytes: &[u8]) -> [u8; 32] {
let mut result = [0u8; 32];
let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32)
.expect("should create hasher");
let _ = std::io::Write::write(&mut hasher, bytes);
blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)
.expect("should copy hash to the result array");
result
}

cargo run
[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {
name: "My Contract",
description: "My Description",
prices: [
Price {
value: 123,
},
Price {
value: 321,
},
],
}
[src/main.rs:117:5] runtime.block_on(value()) = 666
[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20
[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10
+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/cep18/index.html b/docs/docs/next/tutorials/cep18/index.html new file mode 100644 index 000000000..7b84f965a --- /dev/null +++ b/docs/docs/next/tutorials/cep18/index.html @@ -0,0 +1,52 @@ + + + + + +CEP-18 | Odra + + + + + +
+
Version: next

CEP-18

Not so different from ERC-20, the CEP-18 standard describes a fungible +token interface, but for the Casper network. +There are some differences, which will be shown in this tutorial. +The most visible one however, is the compatibility with the Casper Ecosystem.

In our example, we will implement a CEP-18 token with a simple self-governance mechanism. +We will also deploy our token on the Casper network, and interact with it.

danger

This implementation of the governance in this tutorial is by no means +a complete one, and should not be used in production.

Self-governing token

There are many ways to implement a governance mechanism for a token, +each more complex than the other. In our example, we will use a simple +one, where the community of token holders can vote to mint new tokens.

Token implementation

Let's start by creating a new project, choosing a clever name and using +cep18 as our starting template:

cargo odra new --name ourcoin --template cep18

Let's glance at our token code:

src/token.rs
#[odra::module]
pub struct MyToken {
token: SubModule<Cep18>,
}

impl MyToken {
// Delegate all Cep18 functions to the token sub-module.
delegate! {
to self.token {
...
fn name(&self) -> String;
fn symbol(&self) -> String;
...

As we can see, it indeed uses the Cep18 module and delegates +all the methods to it.

The only thing to do is to change the name of the struct to more +appropriate OurToken, run the provided tests using cargo odra test, +and continue with the implementation of the governance.

note

Remember to change the name of the struct and its usages as well as +the struct name in the Odra.toml file!

Governance implementation

Let's go through the process of implementing the governance mechanism. +If we don't want to, we don't have to hide entrypoints from the public responsible +for minting new tokens. By default, minting Modality +is turned off, so any attempt of direct minting will result in an error.

We will however implement a voting mechanism, where the token holders can vote +to mint new tokens.

Voting mechanism

Our voting system will be straightforward:

  1. Anyone with the tokens can propose a new mint.
  2. Anyone with the tokens can vote for the new mint by staking their tokens.
  3. If the majority of the token holders vote for the mint, it is executed.

Storage

We will need to store some additional information about the votes, so let's +add some fields to our token struct:

src/token.rs
#[odra::module]
pub struct OurToken {
/// A sub-module that implements the CEP-18 token standard.
token: SubModule<Cep18>,
/// The proposed mint.
proposed_mint: Var<(Address, U256)>,
/// The list of votes cast in the current vote.
votes: List<Ballot>,
/// Whether a vote is open.
is_vote_open: Var<bool>,
/// The time when the vote ends.
vote_end_time: Var<u64>,
}

/// A ballot cast by a voter.
#[odra::odra_type]
struct Ballot {
voter: Address,
choice: bool,
amount: U256,
}

Notice that proposed_mint contains a tuple containing the address of +the proposer and the amount of tokens to mint. Moreover, we need to keep track if +the vote time has ended, but also if it was already tallied, that's why +we need both is_vote_open and vote_end_time.

We will also use the power of the List +type to store the Ballots.

Proposing a new mint

To implement the endpoint that allows token holders to propose a new mint, +we need to add a new function to our token module:

src/token.rs
/// Proposes a new mint for the contract.
pub fn propose_new_mint(&mut self, account: Address, amount: U256) {
// Only allow proposing a new mint if there is no vote in progress.
if self.is_vote_open().get_or_default() {
self.env().revert(GovernanceError::VoteAlreadyOpen);
}

// Only the token holders can propose a new mint.
if self.balance_of(&self.env().caller()) == U256::zero() {
self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose);
}

// Set the proposed mint.
self.proposed_mint.set((account, amount));
// Open a vote.
self.is_vote_open.set(true);
// Set the vote end time to 10 minutes from now.
self.vote_end_time
.set(self.env().get_block_time() + 60 * 10 * 1000);
}

As a parameters to the function, we pass the address of the account that should be the receiver of +the minted tokens, and the amount.

After some validation, we open the vote by setting the is_vote_open to true, +and setting the vote_end_time to 10 minutes. In real-world scenarios, +the time could be configurable, but for the sake of simplicity, we hardcoded it. +Also, it should be quite longer than 10 minutes, but it will come in handy +when we test it on Livenet.

Voting for the mint

Next, we need an endpoint that will allow us to cast a ballot:

src/token.rs
/// Votes on the proposed mint.
pub fn vote(&mut self, choice: bool, amount: U256) {
// Only allow voting if there is a vote in progress.
self.assert_vote_in_progress();

let voter = self.env().caller();
let contract = self.env().self_address();

// Transfer the voting tokens from the voter to the contract.
self.token
.transfer(&contract, &amount);

// Add the vote to the list.
self.votes.push(Ballot {
voter,
choice,
amount,
});
}

The most interesting thing here is that we are using a mechanism of staking, +where we transfer our tokens to the contract, to show that we really mean it.

The tokens will be locked until the vote is over, and tallied.

Speaking of tallying...

Tallying the votes

The last step is to tally the votes and mint the tokens if the majority +of voters agreed to do so:

src/token.rs
/// Count the votes and perform the action
pub fn tally(&mut self) {
// Only allow tallying the votes once.
if !self.is_vote_open.get_or_default()
{
self.env().revert(GovernanceError::NoVoteInProgress);
}

// Only allow tallying the votes after the vote has ended.
let finish_time = self
.vote_end_time
.get_or_revert_with(GovernanceError::NoVoteInProgress);
if self.env().get_block_time() < finish_time {
self.env().revert(GovernanceError::VoteNotYetEnded);
}

// Count the votes
let mut yes_votes = U256::zero();
let mut no_votes = U256::zero();

let contract = self.env().self_address();

while let Some(vote) = self.votes.pop() {
if vote.choice {
yes_votes += vote.amount;
} else {
no_votes += vote.amount;
}

// Transfer back the voting tokens to the voter.
self.token.raw_transfer(&contract, &vote.voter, &vote.amount);
}

// Perform the action if the vote has passed.
if yes_votes > no_votes {
let (account, amount) = self
.proposed_mint
.get_or_revert_with(GovernanceError::NoVoteInProgress);
self.token.raw_mint(&account, &amount);
}

// Close the vote.
self.is_vote_open.set(false);
}

Notice how we used raw_transfer from the Cep18 module. We used it +to set the sender, so the contract's balance will be used, instead of +the caller's.

Additonally, we used raw_mint to mint the tokens, skipping the security +checks. We have no modality for minting, but even if we had, we don't +have anyone with permissions! The Contract needs to mint the tokens itself.

Testing

Now, we will put our implementation to the test. One unit test, that we can +run both on OdraVM and on the CasperVM.

src/token.rs
#[test]
fn it_works() {
let env = odra_test::env();
let init_args = OurTokenInitArgs {
name: "OurToken".to_string(),
symbol: "OT".to_string(),
decimals: 0,
initial_supply: U256::from(1_000u64),
};

let mut token = OurTokenHostRef::deploy(&env, init_args);

// The deployer, as the only token holder,
// starts a new voting to mint 1000 tokens to account 1.
// There is only 1 token holder, so there is one Ballot cast.
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(1000));

// The tokens should now be staked.
assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());

// Wait for the vote to end.
env.advance_block_time(60 * 11 * 1000);

// Finish the vote.
token.tally();

// The tokens should now be minted.
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));
assert_eq!(token.total_supply(), 3000.into());

// The stake should be returned.
assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));

// Now account 1 can mint new tokens with their voting power...
env.set_caller(env.get_account(1));
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(2000));

// ...Even if the deployer votes against it.
env.set_caller(env.get_account(0));
token.vote(false, U256::from(1000));

env.advance_block_time(60 * 11 * 1000);

token.tally();

// The power of community governance!
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));
}

We can run the test using both methods:

cargo odra test
cargo odra test -b casper

It is all nice and green, but it would be really nice to see it in action.

How about deploying it on the Casper network?

What's next

We will se our token in action, by deploying it on the Casper network, +and using tools from the Casper Ecosystem to interact with it.

Complete code

Here is the complete code of the OurToken module:

src/token.rs
use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var};
use odra_modules::cep18_token::Cep18;

/// A ballot cast by a voter.
#[odra::odra_type]
struct Ballot {
voter: Address,
choice: bool,
amount: U256,
}

/// Errors for the governed token.
#[odra::odra_error]
pub enum GovernanceError {
/// The vote is already in progress.
VoteAlreadyOpen = 0,
/// No vote is in progress.
NoVoteInProgress = 1,
/// Cannot tally votes yet.
VoteNotYetEnded = 2,
/// Vote ended
VoteEnded = 3,
/// Only the token holders can propose a new mint.
OnlyTokenHoldersCanPropose = 4,
}

/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct OurToken {
/// A submodule that implements the CEP-18 token standard.
token: SubModule<Cep18>,
/// The proposed mint.
proposed_mint: Var<(Address, U256)>,
/// The list of votes cast in the current vote.
votes: List<Ballot>,
/// Whether a vote is open.
is_vote_open: Var<bool>,
/// The time when the vote ends.
vote_end_time: Var<u64>,
}
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl OurToken {
/// Initializes the contract with the given metadata and initial supply.
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
// We put the token address as an admin, so it can govern itself. Self-governing token!
self.token
.init(symbol, name, decimals, initial_supply, vec![], vec![], None);
}

// Delegate all Cep18 functions to the token submodule.
delegate! {
to self.token {
/// Admin EntryPoint to manipulate the security access granted to users.
/// One user can only possess one access group badge.
/// Change strength: None > Admin > Minter
/// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an
/// Admin, also if a user is added to Admin and None then they will be removed from having rights.
/// Beware: do not remove the last Admin because that will lock out all admin functionality.
fn change_security(
&mut self,
admin_list: Vec<Address>,
minter_list: Vec<Address>,
none_list: Vec<Address>
);

/// Returns the name of the token.
fn name(&self) -> String;

/// Returns the symbol of the token.
fn symbol(&self) -> String;

/// Returns the number of decimals the token uses.
fn decimals(&self) -> u8;

/// Returns the total supply of the token.
fn total_supply(&self) -> U256;

/// Returns the balance of the given address.
fn balance_of(&self, address: &Address) -> U256;

/// Returns the amount of tokens the owner has allowed the spender to spend.
fn allowance(&self, owner: &Address, spender: &Address) -> U256;

/// Approves the spender to spend the given amount of tokens on behalf of the caller.
fn approve(&mut self, spender: &Address, amount: &U256);

/// Decreases the allowance of the spender by the given amount.
fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256);

/// Increases the allowance of the spender by the given amount.
fn increase_allowance(&mut self, spender: &Address, inc_by: &U256);

/// Transfers tokens from the caller to the recipient.
fn transfer(&mut self, recipient: &Address, amount: &U256);

/// Transfers tokens from the owner to the recipient using the spender's allowance.
fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256);

/// Mints new tokens and assigns them to the given address.
fn mint(&mut self, owner: &Address, amount: &U256);

/// Burns the given amount of tokens from the given address.
fn burn(&mut self, owner: &Address, amount: &U256);
}
}

/// Proposes a new mint for the contract.
pub fn propose_new_mint(&mut self, account: Address, amount: U256) {
// Only allow proposing a new mint if there is no vote in progress.
if self.is_vote_open.get_or_default() {
self.env().revert(GovernanceError::VoteAlreadyOpen);
}

// Only the token holders can propose a new mint.
if self.balance_of(&self.env().caller()) == U256::zero() {
self.env()
.revert(GovernanceError::OnlyTokenHoldersCanPropose);
}

// Set the proposed mint.
self.proposed_mint.set((account, amount));
// Open a vote.
self.is_vote_open.set(true);
// Set the vote end time to 10 minutes from now.
self.vote_end_time
.set(self.env().get_block_time() + 10 * 60 * 1000);
}

/// Votes on the proposed mint.
pub fn vote(&mut self, choice: bool, amount: U256) {
// Only allow voting if there is a vote in progress.
self.assert_vote_in_progress();

let voter = self.env().caller();
let contract = self.env().self_address();

// Transfer the voting tokens from the voter to the contract.
self.token.transfer(&contract, &amount);

// Add the vote to the list.
self.votes.push(Ballot {
voter,
choice,
amount,
});
}

/// Count the votes and perform the action
pub fn tally(&mut self) {
// Only allow tallying the votes once.
if !self.is_vote_open.get_or_default() {
self.env().revert(GovernanceError::NoVoteInProgress);
}

// Only allow tallying the votes after the vote has ended.
let finish_time = self
.vote_end_time
.get_or_revert_with(GovernanceError::NoVoteInProgress);
if self.env().get_block_time() < finish_time {
self.env().revert(GovernanceError::VoteNotYetEnded);
}

// Count the votes
let mut yes_votes = U256::zero();
let mut no_votes = U256::zero();

let contract = self.env().self_address();

while let Some(vote) = self.votes.pop() {
if vote.choice {
yes_votes += vote.amount;
} else {
no_votes += vote.amount;
}

// Transfer back the voting tokens to the voter.
self.token
.raw_transfer(&contract, &vote.voter, &vote.amount);
}

// Perform the action if the vote has passed.
if yes_votes > no_votes {
let (account, amount) = self
.proposed_mint
.get_or_revert_with(GovernanceError::NoVoteInProgress);
self.token.raw_mint(&account, &amount);
}

// Close the vote.
self.is_vote_open.set(false);
}

fn assert_vote_in_progress(&self) {
if !self.is_vote_open.get_or_default() {
self.env().revert(GovernanceError::NoVoteInProgress);
}

let finish_time = self
.vote_end_time
.get_or_revert_with(GovernanceError::NoVoteInProgress);

if self.env().get_block_time() > finish_time {
self.env().revert(GovernanceError::VoteEnded);
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use odra::host::Deployer;

#[test]
fn it_works() {
let env = odra_test::env();
let init_args = OurTokenInitArgs {
name: "OurToken".to_string(),
symbol: "OT".to_string(),
decimals: 0,
initial_supply: U256::from(1_000u64),
};

let mut token = OurTokenHostRef::deploy(&env, init_args);

// The deployer, as the only token holder,
// starts a new voting to mint 1000 tokens to account 1.
// There is only 1 token holder, so there is one Ballot cast.
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(1000));

// The tokens should now be staked.
assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());

// Wait for the vote to end.
env.advance_block_time(60 * 11 * 1000);

// Finish the vote.
token.tally();

// The tokens should now be minted.
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));
assert_eq!(token.total_supply(), 3000.into());

// The stake should be returned.
assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));

// Now account 1 can mint new tokens with their voting power...
env.set_caller(env.get_account(1));
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(2000));

// ...Even if the deployer votes against it.
env.set_caller(env.get_account(0));
token.vote(false, U256::from(1000));

env.advance_block_time(60 * 11 * 1000);

token.tally();

// The power of community governance!
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/deploying-on-casper/index.html b/docs/docs/next/tutorials/deploying-on-casper/index.html new file mode 100644 index 000000000..0b6c31bd8 --- /dev/null +++ b/docs/docs/next/tutorials/deploying-on-casper/index.html @@ -0,0 +1,58 @@ + + + + + +Deploying a Token on Casper Livenet | Odra + + + + + +
+
Version: next

Deploying a Token on Casper Livenet

In this tutorial, we will take the token we created in +the previous one and deploy it on the Livenet Casper network, +using the Odra Livenet backend.

We will also take a look at the tools that Casper Ecosystem +provides to interact with our newly deployed token.

info

Most of this tutorial will work with any Casper contract.

Casper Wallet

We will be using Casper Wallet to do some tasks in this tutorial. +To install it, please follow the instructions on the +official website.

After setting up the wallet, extract the private key of the account +you want to use for our testing. +You can do this by clicking on the Menu > Download account keys.

danger

You are solely responsible for the security of your private keys. +We recommend creating a new account for the testing purposes.

Why do we need the private key? We will use it in Odra to deploy +our contract to the Casper network using Livenet backend.

Getting tokens

To deploy the contract on the Livenet, we need to have some CSPR. +The easiest way to get them is to use the faucet, which will send +us 1000 CSPR for free. Unfortunately, only on the Testnet.

To use the faucet, go to the Casper Testnet Faucet. +Log in using your Casper Wallet account and click on the "Request Tokens" button.

note

One account can request tokens only once. If you run out of tokens, you can +either ask someone in the Casper community to send you some, or simply create a new account +in the wallet.

Now, when we have the tokens, we can deploy the contract. Let's do it using Odra!

Odra Livenet

Odra Livenet is described in detail in the +backends section of this documentation. +We will then briefly describe how to use set it up in this tutorial.

In your contract code, create a new file in the bin folder:

bin/our_token_livenet.rs
//! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial
//! creator.
use std::str::FromStr;

use odra::casper_types::U256;
use odra::host::{Deployer, HostEnv, HostRef, HostRefLoader};
use odra::Address;
use ourcoin::token::{OurTokenHostRef, OurTokenInitArgs};

fn main() {
// Load the Casper livenet environment.
let env = odra_casper_livenet_env::env();

// Caller is the deployer and the owner of the private key.
let owner = env.caller();
// Just some random address...
let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26";
let recipient = Address::from_str(recipient).unwrap();

// Deploy new contract.
let mut token = deploy_our_token(&env);
println!("Token address: {}", token.address().to_string());

// Propose minting new tokens.
env.set_gas(1_000_000_000u64);
token.propose_new_mint(recipient, U256::from(1_000));

// Vote, we are the only voter.
env.set_gas(1_000_000_000u64);
token.vote(true, U256::from(1_000));

// Let's advance the block time by 11 minutes, as
// we set the voting time to 10 minutes.
// OH NO! It is the Livenet, so we need to wait real time...
// Hopefully you are not in a hurry.
env.advance_block_time(11 * 60 * 1000);

// Tally the votes.
env.set_gas(1_500_000_000u64);
token.tally();

// Check the balances.
println!("Owner's balance: {:?}", token.balance_of(&owner));
println!(
"Tutorial creator's balance: {:?}",
token.balance_of(&recipient)
);
}

/// Deploys a contract.
pub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef {
let name = String::from("OurToken");
let symbol = String::from("OT");
let decimals = 0;
let initial_supply = U256::from(1_000);

let init_args = OurTokenInitArgs {
name,
symbol,
decimals,
initial_supply,
};

env.set_gas(300_000_000_000u64);
OurTokenHostRef::deploy(env, init_args)
}

/// Loads a contract. Just in case you need to load an existing contract later...
fn _load_cep18(env: &HostEnv) -> OurTokenHostRef {
let address = "hash-XXXXX";
let address = Address::from_str(address).unwrap();
OurTokenHostRef::load(env, address)
}

In your Cargo.toml file, we need to add a new dependency, a feature and +register the new binary. In the end, it should look like this:

Cargo.toml
[package]
name = "ourcoin"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "1.1.0", features = [], default-features = false }
odra-modules = { version = "1.1.0", features = [], default-features = false }
odra-casper-livenet-env = { version = "1.1.0", optional = true }

[dev-dependencies]
odra-test = { version = "1.1.0", features = [], default-features = false }

[build-dependencies]
odra-build = { version = "1.1.0", features = [], default-features = false }

[features]
default = []
livenet = ["odra-casper-livenet-env"]

[[bin]]
name = "ourcoin_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "ourcoin_build_schema"
path = "bin/build_schema.rs"
test = false

[[bin]]
name = "our_token_livenet"
path = "bin/our_token_livenet.rs"
required-features = ["livenet"]

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

Finally, add the .env file with the following content:

.env
# Path to the secret key of the account that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777

# Chain name of the network.
ODRA_CASPER_LIVENET_CHAIN_NAME=casper-test

Of course, you need to replace the secret key's path +with the path to the secret key file you downloaded from the Casper Wallet.

note

One of the problems you may encounter is that the node you are using +will be down or will not accept your calls. In this case, you will +have to find and use another node IP address.

Now, we will run our code:

cargo run --bin our_token_livenet --features livenet

If everything is set up correctly, you should see the output similar to this:

     Running `target/debug/our_token_livenet`
💁 INFO : Deploying "OurToken".
💁 INFO : Found wasm under "wasm/OurToken.wasm".
🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".
🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".
💁 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed.
💁 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed.

Token address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857

💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint".
🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".
🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".
💁 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed.
💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote".
🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".
🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".
💁 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed.
💁 INFO : advance_block_time called - Waiting for 660000 ms
💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally".
🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".
🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".
💁 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed.

Owner's balance: 1000
Tutorial creator's balance: 1000

Congratulations, your contract is now deployed on the Casper network! +Before we move on, note the address of the token!

We will use it in the next section to interact with the token. In our case it is +hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857.

Cspr.live

The first thing we will do is to explore Casper's network block explorer, +cspr.live. We can put the address of our token in the search bar +to find it.

note

If you deployed your contract on the Testnet, remember to make sure that the Testnet +network is selected in the dropdown menu in the top right corner.

If everything is set up correctly, you should see the contract package's details. +Besides the owner, keys etc., you can also see the contract's metdata, if it +was developed using a standard that cspr.live supports.

Indeed, we can see that it detected that our contract is a CEP-18 token! +We see the name, symbol and total supply. +All the mentions of the contract on the website will use the token name instead +of the contract address.

contract.png

Additionally, on the Token Txs tab, we can see the transactions that happened +with the token. We can see the minting transaction we did in the previous section +and transfers done during the voting process.

transactions.png

If we click on one of the accounts that recieved the tokens, we will go to the +account page. Here, on the Tokens tab, we can see all the tokens that the account +has - and OurToken is one of them!

If you wish, you can check the status of the contract deployed during the development +of this tutorial here.

Transferring Tokens using Casper Wallet

Casper wallet can do much more than just logging in to the faucet, exporting +the private keys and transferring CSPR. It can also interact with the contracts +deployed on the network.

If you deployed the contract and left some OT tokens to yourself, you should see +them in the Casper Wallet window.

You should also be able to transfer them to another account!

wallet.png

Conclusion

We've successfully deployed a token on the Casper network and interacted with it +using the Odra backend and Casper Wallet. We've also learned how to use the +cspr.live block explorer to check the status of your contract.

Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem +provides. Feel free to explore them on casperecosystem.io.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/erc20/index.html b/docs/docs/next/tutorials/erc20/index.html new file mode 100644 index 000000000..13419a64a --- /dev/null +++ b/docs/docs/next/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: next

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • Advanced storage using key-value pairs,
  • Odra types such as Address,
  • Advanced event assertion.

Code

Our module features a considerably more complex storage layout compared to the previous example.

It is designed to store the following data:

  1. Immutable metadata - name, symbol, and decimals.
  2. Total supply.
  3. Balances of individual users.
  4. Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.

Module definition

erc20.rs
use odra::prelude::*;
use odra::{Address, casper_types::U256, Mapping, Var};

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}
  • L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.
  • L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys.

Metadata

erc20.rs
#[odra::module]
impl Erc20 {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let caller = self.env().caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, &initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &U256) {
self.balances.add(address, *amount);
self.total_supply.add(*amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}
}

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L9 - A constructor sets the token metadata and mints the initial supply.
  • L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.
  • L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for:
use odra::UnwrapOrRevert;

let current_balance = self.balances.get(address).unwrap_or_default();
let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());
self.balances.set(address, new_balance);

Core

To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();
self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
self.env().revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowance(owner, spender);
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.set(&(*owner, *spender), new_allowance);
self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 1,
InsufficientAllowance = 2,
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::*;
use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: INITIAL_SUPPLY.into()
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
&erc20,
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
&erc20,
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

#[test]
fn transfer_from_and_approval_work() {
let (env, mut erc20) = setup();

let (owner, recipient, spender) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert!(env.emitted_event(
&erc20,
&Approval {
owner,
spender,
value: approved_amount
}
));

// Spender transfers tokens from Owner to Recipient.
env.set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert!(env.emitted_event(
&erc20,
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
&erc20,
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));
// assert!(env.emitted(erc20.address(), "Transfer"));
}

#[test]
fn transfer_from_error() {
// Given a new instance.
let (env, mut erc20) = setup();

// When the spender's allowance is zero.
let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

// Then transfer fails.
assert_eq!(
erc20.try_transfer_from(&owner, &recipient, &amount),
Err(Error::InsufficientAllowance.into())
);
}
}
  • L146 - Alternatively, if you don't want to check the entire event, you may assert only its type.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/nft/index.html b/docs/docs/next/tutorials/nft/index.html new file mode 100644 index 000000000..9970febf2 --- /dev/null +++ b/docs/docs/next/tutorials/nft/index.html @@ -0,0 +1,17 @@ + + + + + +Ticketing System | Odra + + + + + +
+
Version: next

Ticketing System

Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens.

Our contract will adhere to the CEP-78 standard, which is the standard for NFTs on the Casper blockchain.

Learn more about the CEP-78 standard here.

Ticket Office Contract

Our TicketOffice contract will include the following features:

  • Compliance with the CEP-78 standard.
  • Ownership functionality.
  • Only the owner can issue new event tickets.
  • Users can purchase tickets for events.
  • Tickets are limited to a one-time sale.
  • Public access to view the total income of the TicketOffice.

Setup the project

Creating a new NFT token with Odra is straightforward. Use the cargo odra new command to create a new project with the CEP-78 template:

cargo odra new --name ticket-office --template cep78

Contract implementation

Let's start implementing the TicketOffice contract by modify the code generated from the template.

src/token.rs
use odra::{
args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert
};
use odra_modules::access::Ownable;
use odra_modules::cep78::{
modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode},
token::Cep78,
};

pub type TicketId = u64;

#[odra::odra_type]
pub enum TicketStatus {
Available,
Sold,
}

#[odra::odra_type]
pub struct TicketInfo {
event_name: String,
price: U512,
status: TicketStatus,
}

#[odra::event]
pub struct OnTicketIssue {
ticket_id: TicketId,
event_name: String,
price: U512,
}

#[odra::event]
pub struct OnTicketSell {
ticket_id: TicketId,
buyer: Address,
}

#[odra::odra_error]
pub enum Error {
TicketNotAvailableForSale = 200,
InsufficientFunds = 201,
InvalidTicketId = 202,
TicketDoesNotExist = 203,
}

#[odra::module(
events = [OnTicketIssue, OnTicketSell],
errors = Error
)]
pub struct TicketOffice {
token: SubModule<Cep78>,
ownable: SubModule<Ownable>,
tickets: Mapping<TicketId, TicketInfo>,
}

#[odra::module]
impl TicketOffice {
pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) {
self.ownable.init();
let receipt_name = format!("cep78_{}", collection_name);
self.token.init(
collection_name,
collection_symbol,
total_supply,
OwnershipMode::Transferable,
NFTKind::Digital,
NFTIdentifierMode::Ordinal,
NFTMetadataKind::Raw,
MetadataMutability::Immutable,
receipt_name,
// remaining args are optional and can set to Maybe::None
...
);
}

pub fn issue_ticket(&mut self, event_name: String, price: U512) {
let env = self.env();
let caller = env.caller();
self.ownable.assert_owner(&caller);
// mint a new token
let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None);
let ticket_id: u64 = token_id
.parse()
.map_err(|_| Error::InvalidTicketId)
.unwrap_or_revert(&env);
// store ticket info
self.tickets.set(
&ticket_id,
TicketInfo {
event_name: event_name.clone(),
price,
status: TicketStatus::Available,
},
);
// emit an event
env.emit_event(OnTicketIssue {
ticket_id,
event_name,
price,
});
}

#[odra(payable)]
pub fn buy_ticket(&mut self, ticket_id: TicketId) {
let env = self.env();
let owner = self.ownable.get_owner();
let buyer = env.caller();
let value = env.attached_value();
// only tokens owned by the owner can be sold
if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner {
env.revert(Error::TicketNotAvailableForSale);
}
let mut ticket = self
.tickets
.get(&ticket_id)
.unwrap_or_revert_with(&env, Error::TicketDoesNotExist);
// only available tickets can be sold
if ticket.status != TicketStatus::Available {
env.revert(Error::TicketNotAvailableForSale);
}
// check if the buyer sends enough funds
if value < ticket.price {
env.revert(Error::InsufficientFunds);
}
// transfer csprs to the owner
env.transfer_tokens(&owner, &value);
// transfer the ticket to the buyer
self.token
.transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer);
ticket.status = TicketStatus::Sold;
self.tickets.set(&ticket_id, ticket);

env.emit_event(OnTicketSell { ticket_id, buyer });
}

pub fn balance_of(&self) -> U512 {
self.env().self_balance()
}
}
  • L10-L44 - We define structures and enums that will be used in our contract. TicketStatus enum represents the status of a ticket, TicketInfo struct contains information about a ticket that is written to the storage, TicketId is a type alias for u64. OnTicketIssue and OnTicketSell are events that will be emitted when a ticket is issued or sold.
  • L46-L49 - Register errors and events that will be used in our contract, required to produce a complete contract schema.
  • L51-L53 - TicketOffice module definition. The module contains a Cep78 token, an Ownable module, and a Mapping that stores information about tickets.
  • L58-L74 - The init function has been generated from the template and there is no need to modify it, except the Ownable module initialization.
  • L76-L94 - The issue_ticket function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an OnTicketIssue event.
  • L103 - The payable attribute indicates that the buy_ticket function can receive funds.
  • L104-L134 - The buy_ticket function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an OnTicketSell event.

Lets test the contract. The test scenario will be as follows:

  1. Deploy the contract.
  2. Issue two tickets.
  3. Try to buy a ticket with insufficient funds.
  4. Buy tickets.
  5. Try to buy the same ticket again.
  6. Check the balance of the contract.
src/tests.rs
use odra::{
casper_types::U512,
host::{Deployer, HostRef},
};

use crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs};

#[test]
fn it_works() {
let env = odra_test::env();
let init_args = TicketOfficeInitArgs {
collection_name: "Ticket".to_string(),
collection_symbol: "T".to_string(),
total_supply: 100,
};
let mut contract = TicketOfficeHostRef::deploy(&env, init_args);
contract.issue_ticket("Ev".to_string(), U512::from(100));
contract.issue_ticket("Ev".to_string(), U512::from(50));

let buyer = env.get_account(1);
env.set_caller(buyer);

assert_eq!(
contract
.with_tokens(U512::from(50))
.try_buy_ticket(0),
Err(Error::InsufficientFunds.into())
);

assert_eq!(
contract
.with_tokens(U512::from(100))
.try_buy_ticket(0),
Ok(())
);
assert_eq!(
contract
.with_tokens(U512::from(50))
.try_buy_ticket(1),
Ok(())
);

assert_eq!(
contract
.with_tokens(U512::from(100))
.try_buy_ticket(0),
Err(Error::TicketNotAvailableForSale.into())
);
}

Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with Cep78Error::InvalidTokenOwner because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of.

odra/modules/src/cep78/token78.rs
pub fn transfer(
&mut self,
token_id: Maybe<u64>,
token_hash: Maybe<String>,
source_key: Address,
target_key: Address
) -> TransferReceipt {
...

if !is_owner && !is_approved && !is_operator {
self.revert(CEP78Error::InvalidTokenOwner);
}

...
}

Let's fix it by redesigning our little system.

Redesign

Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary — an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets.

The sequence diagram below illustrates the new flow:

Ticket Operator Contract

As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the cargo odra generate command.

cargo odra generate -c ticket_operator
src/ticket_operator.rs
use crate::token::{TicketId, TicketOfficeContractRef};
use odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var};

#[odra::odra_error]
pub enum Error {
UnknownTicketOffice = 300,
}

#[odra::module(errors = Error)]
pub struct TicketOperator {
ticket_office_address: Var<Address>,
}

#[odra::module]
impl TicketOperator {
pub fn register(&mut self, ticket_office_address: Address) {
self.ticket_office_address.set(ticket_office_address);
}

// now the operator's `buy_ticket` receives funds.
#[odra(payable)]
pub fn buy_ticket(&mut self, ticket_id: TicketId) {
let env = self.env();
let buyer = env.caller();
let value = env.attached_value();
let center = self
.ticket_office_address
.get()
.unwrap_or_revert_with(&env, Error::UnknownTicketOffice);
let mut ticket_contract = TicketOfficeContractRef::new(env, center);
// now and approved entity - the operator - buys the ticket on behalf of the buyer
ticket_contract.buy_ticket(ticket_id, buyer, value);
}

pub fn balance_of(&self) -> U512 {
self.env().self_balance()
}
}
  • L4-L7 - Define errors that will be used in the contract.
  • L9-L13 - Define the TicketOperator module that stores the address of the ticketing office.
  • L16-L18 - The register function sets the address of the ticketing office.
  • L20-L32 - The buy_ticket function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a TicketOfficeContractRef to interact we the TicketOffice contract. Note that, the operator's buy_ticket now receives funds.

Now we need to adjust the TicketOffice contract to use the TicketOperator contract to buy tickets.

src/token.rs
use odra::Var;

...

#[odra::odra_error]
pub enum Error {
...
MissingOperator = 204,
Unauthorized = 205,
}

#[odra::module]
pub struct TicketOffice {
...
operator: Var<Address>,
}

#[odra::module]
impl TicketOffice {
...

pub fn register_operator(&mut self, operator: Address) {
// only the owner can register an operator
let caller = self.env().caller();
self.ownable.assert_owner(&caller);
// store the ticketing center address in the operator contract
TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address());
self.operator.set(operator);
}

pub fn issue_ticket(&mut self, event_name: String, price: U512) {
// minting logic remains the same...
...

// approve the operator to transfer the ticket
let operator = self.operator();
self.token
.approve(operator, Maybe::Some(ticket_id), Maybe::None);

// emit an event
...
}

pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) {
let env = self.env();
let owner = self.ownable.get_owner();
let caller = env.caller();
// make sure the caller is the operator
if !self.is_operator(caller) {
env.revert(Error::Unauthorized);
}

...
// the logic remains the same, except for the csprs transfer
// it is now handled by the operator contract.
// env.transfer_tokens(&owner, &value);
}

#[inline]
fn is_operator(&self, caller: Address) -> bool {
Some(caller) == self.operator.get()
}

#[inline]
fn operator(&self) -> Address {
self.operator
.get()
.unwrap_or_revert_with(&self.env(), Error::MissingOperator)
}
}
  • L15 - the contract stores the operator address.
  • L22-L29 - a new function register_operator allows the owner to register an operator. Also calls the register entry point on the operator contract.
  • L36-38 - modify the issue_ticket function: once a new token is minted, approves the operator to transfer the ticket later.
  • L44-L57 - modify the buy_ticket function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds.
  • We also added two helper functions: is_operator and operator to check if the caller is the operator and get the operator address. Two new errors were added: MissingOperator and Unauthorized.

Now we need to update our tests to create a scenario we presented in the sequence diagram.

src/tests.rs
use odra::{
casper_types::U512,
host::{Deployer, HostRef, NoArgs},
OdraResult,
};

use crate::{
ticket_operator::TicketOperatorHostRef,
token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs},
};

#[test]
fn it_works() {
let env = odra_test::env();
let init_args = TicketOfficeInitArgs {
collection_name: "Ticket".to_string(),
collection_symbol: "T".to_string(),
total_supply: 100,
};
let operator = TicketOperatorHostRef::deploy(&env, NoArgs);
let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args);
ticket_office.register_operator(operator.address().clone());
ticket_office.issue_ticket("Ev".to_string(), U512::from(100));
ticket_office.issue_ticket("Ev".to_string(), U512::from(50));

let buyer = env.get_account(1);
env.set_caller(buyer);

assert_eq!(
buy_ticket(&operator, 0, 50),
Err(Error::InsufficientFunds.into())
);
assert_eq!(buy_ticket(&operator, 0, 100), Ok(()));
assert_eq!(buy_ticket(&operator, 1, 50), Ok(()));
assert_eq!(
buy_ticket(&operator, 0, 100),
Err(Error::TicketNotAvailableForSale.into())
);

assert_eq!(operator.balance_of(), U512::from(150));
}

fn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> {
operator.with_tokens(U512::from(price)).try_buy_ticket(id)
}

Conclusion

In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/odra-solidity/index.html b/docs/docs/next/tutorials/odra-solidity/index.html new file mode 100644 index 000000000..a17f13204 --- /dev/null +++ b/docs/docs/next/tutorials/odra-solidity/index.html @@ -0,0 +1,18 @@ + + + + + +Odra for Solidity developers | Odra + + + + + +
+
Version: next

Odra for Solidity developers

Introduction

Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers.

Prerequisites

To follow this guide, you should have:

  • Knowledge of Solidity.
  • Familiarity with Ethereum and smart contract concepts.
  • Basic understanding of Rust, as Odra is based on it.

Hello World

Let's start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message.

use odra::{prelude::*, Var};

#[odra::module]
pub struct HelloWorld {
greet: Var<String>,
}

#[odra::module]
impl HelloWorld {
pub fn init(&mut self, message: String) {
self.greet.set(message);
}

pub fn get(&self) -> String {
self.greet.get_or_default()
}
}

As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the odra::module attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the HelloWorld struct has a single state variable greet, which stores the greeting message. The module contains two functions: init to set the greeting message and get to retrieve it. +Two key differences are:

  1. Odra does not generate getters for public state variables automatically, so you need to define them explicitly.
  2. To initialize values, you must do it in the init function, which is the contract constructor. You can't assign defaults outside the constructor.

Variable Storage and State Management

Data Types

use core::str::FromStr;
use odra::{
casper_types::{bytesrepr::Bytes, U256},
module::Module,
prelude::*,
Address, UnwrapOrRevert, Var,
};

#[odra::module]
pub struct Primitives {
boo: Var<bool>,
u: Var<u8>, // u8 is the smallest unsigned integer type
u2: Var<U256>, // U256 is the biggest unsigned integer type
i: Var<i32>, // i32 is the smallest signed integer type
i2: Var<i64>, // i64 is the biggest signed integer type
address: Var<Address>,
bytes: Var<Bytes>,
default_boo: Var<bool>,
default_uint: Var<U256>,
default_int: Var<i64>,
default_addr: Var<Address>,
}

#[odra::module]
impl Primitives {
pub fn init(&mut self) {
self.boo.set(true);
self.u.set(1);
self.u2.set(U256::from(456));
self.i.set(-1);
self.i2.set(456);
self.address.set(
Address::from_str(
"hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb",
)
.unwrap_or_revert(&self.env()),
);
self.bytes.set(Bytes::from(vec![0xb5]));

let _min_int = U256::zero();
let _max_int = U256::MAX;
}

// For the types that have default values, we can use the get_or_default method
pub fn get_default_boo(&self) -> bool {
self.default_boo.get_or_default()
}

pub fn get_default_uint(&self) -> U256 {
self.default_uint.get_or_default()
}

pub fn get_default_int(&self) -> i64 {
self.default_int.get_or_default()
}

// Does not compile - Address does not have the default value
pub fn get_default_addr(&self) -> Address {
self.default_addr.get_or_default()
}
}

The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: u8, u16, u32, u64, U128, and U256 for unsigned integers, and i32 and i64 for signed integers.

The Address type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the Address type; the workaround is to use Option<Address>.

The Bytes type is used to store byte arrays.

Values are stored in units called Named Keys and Dictionaries. Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point.

Constants and Immutability

use odra::{casper_types::{account::AccountHash, U256}, Address};

#[odra::module]
pub struct Constants;

#[odra::module]
impl Constants {
pub const MY_UINT: U256 = U256([123, 0, 0, 0]);
pub const MY_ADDRESS: Address = Address::Account(
AccountHash([0u8; 32])
);
}

In Odra, you can define constants using the const keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the immutable keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's immutable keyword.

Variables

use odra::{casper_types::U256, prelude::*, Var};

#[odra::module]
pub struct Variables {
text: Var<String>,
my_uint: Var<U256>,
}

#[odra::module]
impl Variables {
pub fn init(&mut self) {
self.text.set("Hello".to_string());
self.my_uint.set(U256::from(123));
}

pub fn do_something(&self) {
// Local variables
let i = 456;
// Env variables
let timestamp = self.env().get_block_time();
let sender = self.env().caller();
}
}

In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ContractEnv retrieved using the env() function.

Arrays and Mappings

use odra::{casper_types::U256, Address, Mapping};

#[odra::module]
pub struct MappingContract {
my_map: Mapping<Address, Option<U256>>
}

#[odra::module]
impl MappingContract {
pub fn get(&self, addr: Address) -> U256 {
// self.my_map.get(&addr) would return Option<Option<U256>>
// so we use get_or_default instead and unwrap the inner Option
self.my_map.get_or_default(&addr).unwrap_or_default()
}

pub fn set(&mut self, addr: Address, i: U256) {
self.my_map.set(&addr, Some(i));
}

pub fn remove(&mut self, addr: Address) {
self.my_map.set(&addr, None);
}
}

#[odra::module]
pub struct NestedMapping {
my_map: Mapping<(Address, U256), Option<bool>>
}

#[odra::module]
impl NestedMapping {
pub fn get(&self, addr: Address, i: U256) -> bool {
self.my_map.get_or_default(&(addr, i)).unwrap_or_default()
}

pub fn set(&mut self, addr: Address, i: U256, boo: bool) {
self.my_map.set(&(addr, i), Some(boo));
}

pub fn remove(&mut self, addr: Address, i: U256) {
self.my_map.set(&(addr, i), None);
}
}
use odra::{prelude::*, Var};

#[odra::module]
pub struct Array {
// the size of the array must be known at compile time
arr: Var<[u8; 10]>,
vec: Var<Vec<u32>>,
}

#[odra::module]
impl Array {
pub fn init(&mut self) {
self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
self.vec.set(vec![1, 2, 3, 4, 5]);
}

pub fn get_arr(&self) -> [u8; 10] {
self.arr.get_or_default()
}

pub fn push_vec(&mut self, value: u32) {
let mut vec = self.vec.get_or_default();
vec.push(value);
self.vec.set(vec);
}

pub fn pop_vec(&mut self) {
let mut vec = self.vec.get_or_default();
vec.pop();
self.vec.set(vec);
}

pub fn update_arr(&mut self, index: u8, value: u8) {
let mut arr = self.arr.get_or_default();
arr[index as usize] = value;
self.arr.set(arr);
}
}

For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the Var container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a Mapping or List instead of an array or vector to store data.

Custom types

use odra::{prelude::*, Var};

#[odra::odra_type]
#[derive(Default)]
pub enum Status {
#[default]
Pending,
Shipped,
Accepted,
Rejected,
Canceled,
}

#[odra::module]
pub struct Enum {
status: Var<Status>,
}

#[odra::module]
impl Enum {
pub fn get(&self) -> Status {
self.status.get_or_default()
}

pub fn set(&mut self, status: Status) {
self.status.set(status);
}

pub fn cancel(&mut self) {
self.status.set(Status::Canceled);
}

pub fn reset(&mut self) {
self.status.set(Default::default());
}
}

In Odra, custom types are defined using the #[odra::odra_type] attribute. The enum can have a default value specified using the #[default] attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the Default::default() function.

use odra::{prelude::*, List};

#[odra::odra_type]
pub struct Todo {
text: String,
completed: bool,
}

#[odra::module]
pub struct Enum {
// You could also use Var<Vec<Todo>> instead of List<Todo>,
// but List is more efficient for large arrays,
// it loads items lazily.
todos: List<Todo>,
}

#[odra::module]
impl Enum {
pub fn create(&mut self, text: String) {
self.todos.push(Todo {
text,
completed: false,
});
}

pub fn update_text(&mut self, index: u32, text: String) {
if let Some(mut todo) = self.todos.get(index) {
todo.text = text;
self.todos.replace(index, todo);
}
}

pub fn toggle_complete(&mut self, index: u32) {
if let Some(mut todo) = self.todos.get(index) {
todo.completed = !todo.completed;
self.todos.replace(index, todo);
}
}

// Odra does not create getters by default
pub fn get(&self, index: u32) -> Option<Todo> {
self.todos.get(index)
}
}

Similarly to enums, custom structs are defined using the #[odra::odra_type] attribute. The struct can be used to define a list of items in a contract. The list can be created using the List type, which is more efficient for large arrays as it loads items lazily.

Data Location

In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be memory, storage, or calldata. In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., Var, Mapping, List), the data is stored in the contract's storage.

Functions

Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function:

impl Erc20 {
pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.internal_transfer(&self.env().caller(), recipient, amount);
// Transfer logic goes here
}

fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) {
// Internal transfer logic goes here
}
}

Functions can modify contract state and emit events using the ContractEnv function.

View and Pure

use odra::Var;

#[odra::module]
pub struct ViewAndPure {
x: Var<u32>
}

#[odra::module]
impl ViewAndPure {
pub fn add_to_x(&self, y: u32) -> u32 {
self.x.get_or_default() + y
}
}

pub fn add(i: u32, j: u32) -> u32 {
i + j
}

In Odra, you don't need to specify view or pure functions explicitly. All functions are considered view functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be &mut self. If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects.

Modifiers

use odra::Var;

#[odra::module]
pub struct FunctionModifier {
x: Var<u32>,
locked: Var<bool>,
}

#[odra::module]
impl FunctionModifier {
pub fn decrement(&mut self, i: u32) -> u32 {
self.lock();
self.x.set(self.x.get_or_default() - i);

if i > 1 {
self.decrement(i - 1);
}
self.unlock();
}

#[inline]
fn lock(&mut self) {
if self.locked.get_or_default() {
self.env().revert("No reentrancy");
}

self.locked.set(true);
}

#[inline]
fn unlock(&mut self) {
self.locked.set(false);
}
}

In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the lock and unlock functions are called before and after the decrement function, respectively, but they must be called explicitly.

As often as practicable, developers should inline functions by including the body of the function within their code using the #[inline] attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances.

Visibility

Functions and state variables have to declare whether they are accessible by other contracts.

Functions can be declared as:

`pub` inside `#[odra::module]` impl block - any contract/submodule and account can call.
`pub` inside a regular impl block - any submodule can call.
`default/no modifier/private` - only inside the contract that defines the function.

Payable

use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var};

#[odra::module]
pub struct Payable {
owner: Var<Address>,
}

#[odra::module]
impl Payable {
pub fn init(&mut self) {
self.owner.set(self.env().caller());
}

#[odra(payable)]
pub fn deposit(&self) {
}

pub fn not_payable(&self) {
}

pub fn withdraw(&self) {
let amount = self.env().self_balance();
self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount);
}

pub fn transfer(&self, to: Address, amount: U512) {
self.env().transfer_tokens(&to, &amount);
}
}

In Odra, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether.

Selectors

In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector.

contract_addr.call(
abi.encodeWithSignature("transfer(address,uint256)", address, 1234)
)

Odra does not support such a mechanism. You must have access to the contract interface to call a function.

Events and Logging

use odra::{prelude::*, Address};

#[odra::event]
pub struct Log {
sender: Address,
message: String,
}

#[odra::event]
pub struct AnotherLog {}

#[odra::module]
struct Event;

#[odra::module]
impl Event {
pub fn test(&self) {
let env = self.env();
env.emit_event(Log {
sender: env.caller(),
message: "Hello World!".to_string(),
});
env.emit_event(Log {
sender: env.caller(),
message: "Hello Casper!".to_string(),
});
env.emit_event(AnotherLog {});
}
}

In Odra, events are regular structs defined using the #[odra::event] attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's emit_event() function, passing the event struct as an argument.

note

Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the Basics section.

Error Handling

use odra::{prelude::*, casper_types::{U256, U512}};

#[odra::odra_error]
pub enum CustomError {
InsufficientBalance = 1,
InputLowerThanTen = 2,
}

#[odra::module]
pub struct Error;

#[odra::module]
impl Error {
pub fn test_require(&mut self, i: U256) {
if i <= 10.into() {
self.env().revert(CustomError::InputLowerThanTen);
}
}

pub fn execute_external_call(&self, withdraw_amount: U512) {
let balance = self.env().self_balance();
if balance < withdraw_amount {
self.env().revert(CustomError::InsufficientBalance);
}
}
}

In Solidity, there are four ways to handle errors: require, revert, assert, and custom errors. In Odra, there is only one way to revert the execution of a function - by using the env().revert() function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the #[odra::odra_error] attribute. On Casper, an error is only a number, so you can't pass a message with the error.

Composition vs. Inheritance

In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another.

Let's take a look at the difference between inheritance in Solidity and composition in Odra.

use odra::{prelude::*, SubModule};

#[odra::module]
pub struct A;

#[odra::module]
impl A {
pub fn foo(&self) -> String {
"A".to_string()
}
}

#[odra::module]
pub struct B {
a: SubModule<A>
}

#[odra::module]
impl B {
pub fn foo(&self) -> String {
"B".to_string()
}
}

#[odra::module]
pub struct C {
a: SubModule<A>
}

#[odra::module]
impl C {
pub fn foo(&self) -> String {
"C".to_string()
}
}

#[odra::module]
pub struct D {
b: SubModule<B>,
c: SubModule<C>
}

#[odra::module]
impl D {
pub fn foo(&self) -> String {
self.c.foo()
}
}

#[odra::module]
pub struct E {
b: SubModule<B>,
c: SubModule<C>
}

#[odra::module]
impl E {
pub fn foo(&self) -> String {
self.b.foo()
}
}

#[odra::module]
pub struct F {
a: SubModule<A>,
b: SubModule<B>,
}

#[odra::module]
impl F {
pub fn foo(&self) -> String {
self.a.foo()
}
}

Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers.

In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts.

Libraries and Utility

use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var};

mod math {
use odra::casper_types::U256;

pub fn sqrt(y: U256) -> U256 {
let mut z = y;
if y > 3.into() {
let mut x = y / 2 + 1;
while x < z {
z = x;
x = (y / x + x) / 2;
}
} else if y != U256::zero() {
z = U256::one();
}
z
}
}

#[odra::module]
struct TestMath;

#[odra::module]
impl TestMath {
pub fn test_square_root(&self, x: U256) -> U256 {
math::sqrt(x)
}
}

#[odra::odra_error]
enum Error {
EmptyArray = 100,
}

trait Removable {
fn remove(&mut self, index: usize);
}

impl Removable for Var<Vec<U256>> {
fn remove(&mut self, index: usize) {
let env = self.env();
let mut vec = self.get_or_default();
if vec.is_empty() {
env.revert(Error::EmptyArray);
}
vec[index] = vec.pop().unwrap_or_revert(&env);
self.set(vec);
}
}

#[odra::module]
struct TestArray {
arr: Var<Vec<U256>>,
}

#[odra::module]
impl TestArray {
pub fn test_array_remove(&mut self) {
let mut arr = self.arr.get_or_default();
for i in 0..3 {
arr.push(i.into());
}
self.arr.set(arr);

self.arr.remove(1);

let arr = self.arr.get_or_default();
assert_eq!(arr.len(), 2);
assert_eq!(arr[0], 0.into());
assert_eq!(arr[1], 2.into());
}
}

In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the Math library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the TestMath contract calls the sqrt function directly, while the TestArray contract uses the using keyword, which extends the type uint256[] by adding the remove function.

In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the Removable trait for the Var<Vec<U256>> type allows the remove function to be called on a variable that stores a vector of U256 values.

Fallback and Receive Functions

In Solidity, a contract receiving Ether must implement a receive() and/or fallback() function. The receive() function is called when Ether is sent to the contract with no data, while the fallback() function is called when the contract receives Ether with data or when a function that does not exist is called.

Odra does not have a direct equivalent to the receive() and fallback() functions. Instead, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs.

Miscellaneous

Hashing

use odra::{
casper_types::{bytesrepr::ToBytes, U256},
prelude::*,
Address, UnwrapOrRevert, Var,
};

#[odra::module]
pub struct HashFunction;

#[odra::module]
impl HashFunction {
pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] {
let env = self.env();
let mut data = Vec::new();
data.extend(text.to_bytes().unwrap_or_revert(&env));
data.extend(num.to_bytes().unwrap_or_revert(&env));
data.extend(addr.to_bytes().unwrap_or_revert(&env));
env.hash(data)
}
}

#[odra::module]
pub struct GuessTheMagicWord {
answer: Var<[u8; 32]>,
}

#[odra::module]
impl GuessTheMagicWord {
/// Initializes the contract with the magic word hash.
pub fn init(&mut self) {
self.answer.set([
0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84,
0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55,
0xbe, 0xd7, 0x56, 0x08,
]);
}

/// Checks if the `word` is the magic word.
pub fn guess(&self, word: String) -> bool {
let env = self.env();
let hash = env.hash(word.to_bytes().unwrap_or_revert(&env));
hash == self.answer.get_or_default()
}
}

The key difference between the two is that in Solidity, the keccak256 function is used to hash data, while in Odra, the env.hash() function is used, which implements the blake2b algorithm. Both functions take a byte array as input and return a 32-byte hash.

Try-catch

use odra::{module::Module, Address, ContractRef, Var};

#[odra::module]
pub struct Example {
other_contract: Var<Address>,
}

#[odra::module]
impl Example {
pub fn init(&mut self, other_contract: Address) {
self.other_contract.set(other_contract);
}

pub fn execute_external_call(&self) {
if let Some(addr) = self.other_contract.get() {
let result = OtherContractContractRef::new(self.env(), addr).some_function();
match result {
Ok(success) => {
// Code to execute if the external call was successful
}
Err(reason) => {
// Code to execute if the external call failed
}
}
}
}
}

#[odra::module]
pub struct OtherContract;

#[odra::module]
impl OtherContract {
pub fn some_function(&self) -> Result<bool, ()> {
Ok(true)
}
}

In Solidity, try/catch is a feature that allows developers to handle exceptions and errors more gracefully. The try/catch statement allows developers to catch and handle exceptions that occur during external function calls and contract creation.

In Odra, there is no direct equivalent to the try/catch statement in Solidity. However, you can use the Result type to handle errors in a similar way. The Result type is an enum that represents either success (Ok) or failure (Err). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts.

Conclusion

Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development.

Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework.

Read more about the Odra Framework in the Basics and Advanced sections.

Learn by example with our Tutorial series, you will find there a contract you likely familiar with - the Erc20 standard implementation.

If you have any further questions or need clarification on specific topics, feel free to join our Discord!

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/ownable/index.html b/docs/docs/next/tutorials/ownable/index.html new file mode 100644 index 000000000..a89f7aa3f --- /dev/null +++ b/docs/docs/next/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: next

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining a constructor,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

ownable.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(events = [OwnershipChanged])]
pub struct Ownable {
owner: Var<Option<Address>>
}

That was easy, but it is crucial to understand the basics before we move on.

  • L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.
  • L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var.

Init the module

ownable.rs
#[odra::module]
impl Ownable {
pub fn init(&mut self, owner: Address) {
if self.owner.get_or_default().is_some() {
self.env().revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(Some(owner));

self.env().emit_event(OwnershipChanged {
prev_owner: None,
new_owner: owner
});
}
}

#[odra::odra_error]
pub enum Error {
OwnerIsAlreadyInitialized = 1,
}

#[odra::event]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L1 - The impl should be an Odra module, so add #[odra::module].
  • L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.
  • L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.
  • L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument.
  • L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.
  • L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.
  • L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None.

Features implementation

ownable.rs
#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get_or_default().as_ref() {
self.env().revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&self.env().caller());
let current_owner = self.get_owner();
self.owner.set(Some(*new_owner));
self.env().emit_event(OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
});
}

pub fn get_owner(&self) -> Address {
match self.owner.get_or_default() {
Some(owner) => owner,
None => self.env().revert(Error::OwnerIsNotInitialized)
}
}
}

#[odra::odra_error]
pub enum Error {
NotOwner = 1,
OwnerIsAlreadyInitialized = 2,
OwnerIsNotInitialized = 3,
}

The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along.

  • L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.
  • L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.
  • L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead.

Test

ownable.rs
#[cfg(test)]
mod tests {
use super::*;
use odra::host::{Deployer, HostEnv, HostRef};

fn setup() -> (OwnableHostRef, HostEnv, Address) {
let env: HostEnv = odra_test::env();
let init_args = OwnableInitArgs {
owner: env.get_account(0)
};
(OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))
}

#[test]
fn initialization_works() {
let (ownable, env, owner) = setup();
assert_eq!(ownable.get_owner(), owner);

env.emitted_event(
&ownable,
&OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (mut ownable, env, owner) = setup();
let new_owner = env.get_account(1);

env.set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);

env.emitted_event(
&ownable,
&OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (mut ownable, env, _) = setup();
let new_owner = env.get_account(1);
ownable.change_ownership(&new_owner);

assert_eq!(
ownable.try_change_ownership(&new_owner),
Err(Error::NotOwner.into())
);
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.
  • L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one).
  • L14 - It is time to define the first test. As you see, it is a regular Rust test.
  • L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract you want to read events from, followed by an event as you expect it to have occurred.
  • L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.
  • L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/owned-token/index.html b/docs/docs/next/tutorials/owned-token/index.html new file mode 100644 index 000000000..8ea2cac39 --- /dev/null +++ b/docs/docs/next/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: next

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow only the module owner to mint tokens.
  3. Enable the current owner to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};
use odra::prelude::*;
use odra::module::SubModule;

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
...
use odra::{Address, casper_types::U256};
...

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.ownable.ensure_ownership(&self.env().caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L9-L10 - A constructor is an excellent place to initialize both modules at once.
  • L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.
  • L49-L51 - The same is done with the ownable module.
  • L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/pauseable/index.html b/docs/docs/next/tutorials/pauseable/index.html new file mode 100644 index 000000000..31835d509 --- /dev/null +++ b/docs/docs/next/tutorials/pauseable/index.html @@ -0,0 +1,17 @@ + + + + + +Pausable | Odra + + + + + +
+
Version: next

Pausable

The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.

Code

As always, we will start with defining functionalities of our module.

  1. Check the state - is it paused or not.
  2. State guards - a contract should stop execution if is in a state we don't expect.
  3. Switch the state.

Events and Error

There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way.

Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser.

pauseable.rs
use odra::prelude::*;
use odra::Address;

#[odra::odra_error]
pub enum Error {
PausedRequired = 1_000,
UnpausedRequired = 1_001,
}

#[odra::event]
pub struct Paused {
pub account: Address
}

#[odra::event]
pub struct Unpaused {
pub account: Address
}

Module definition

The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused.

pauseable.rs
use odra::Var;
...

#[odra::module(events = [Paused, Unpaused])]
pub struct Pausable {
is_paused: Var<bool>
}

Checks and guards

Now, let's move to state checks and guards.

pauseable.rs
impl Pausable {
pub fn is_paused(&self) -> bool {
self.is_paused.get_or_default()
}

pub fn require_not_paused(&self) {
if self.is_paused() {
self.env().revert(Error::UnpausedRequired);
}
}

pub fn require_paused(&self) {
if !self.is_paused() {
self.env().revert(Error::PausedRequired);
}
}
}
  • L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.
  • L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.
  • L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused.
  • L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused.

Actions

Finally, we will add the ability to switch the module state.

pauseable.rs
impl Pausable {
pub fn pause(&mut self) {
self.require_not_paused();
self.is_paused.set(true);

self.env().emit_event(Paused {
account: self.env().caller()
});
}

pub fn unpause(&mut self) {
self.require_paused();
self.is_paused.set(false);

self.env().emit_event(Unpaused {
account: self.env().caller()
});
}
}

pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused).

Pausable counter

In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused).

pauseable.rs
...
use odra::SubModule;
...

#[odra::module]
pub struct PausableCounter {
value: Var<u32>,
pauseable: SubModule<Pausable>
}

#[odra::module]
impl PausableCounter {
pub fn increment(&mut self) {
self.pauseable.require_not_paused();

let new_value = self.value.get_or_default() + 1;
self.value.set(new_value);
}

pub fn pause(&mut self) {
self.pauseable.pause();
}

pub fn unpause(&mut self) {
self.pauseable.unpause();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::host::{Deployer, NoArgs};

#[test]
fn increment_only_if_unpaused() {
let test_env = odra_test::env();
let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);
contract.increment();
contract.pause();

assert_eq!(
contract.try_increment().unwrap_err(),
Error::UnpausedRequired.into()
);
assert_eq!(contract.get_value(), 1);
}
}

As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!

+ + + + \ No newline at end of file diff --git a/docs/docs/next/tutorials/using-proxy-caller/index.html b/docs/docs/next/tutorials/using-proxy-caller/index.html new file mode 100644 index 000000000..6c092c5fc --- /dev/null +++ b/docs/docs/next/tutorials/using-proxy-caller/index.html @@ -0,0 +1,18 @@ + + + + + +Using Proxy Caller | Odra + + + + + +
+
Version: next

Using Proxy Caller

In this tutorial, we will learn how to use the proxy_caller wasm to call an Odra payable function. The proxy_caller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.

Read more about the proxy_caller here.

Contract

For this tutorial, we will use the TimeLockWallet contract from our examples.

examples/src/contracts/tlw.rs
use odra::prelude::*;
use odra::{casper_types::U512, Address, Mapping, Var};

#[odra::module(errors = Error, events = [Deposit, Withdrawal])]
pub struct TimeLockWallet {
balances: Mapping<Address, U512>,
lock_expiration_map: Mapping<Address, u64>,
lock_duration: Var<u64>
}

#[odra::module]
impl TimeLockWallet {
/// Initializes the contract with the lock duration.
pub fn init(&mut self, lock_duration: u64) {
self.lock_duration.set(lock_duration);
}

/// Deposits the tokens into the contract.
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U512 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env().revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env().emit_event(Deposit {
address: caller,
amount
});
}

/// Withdraws the tokens from the contract.
pub fn withdraw(&mut self, amount: &U512) {
// code omitted for brevity
}

/// Returns the balance of the given account.
pub fn get_balance(&self, address: &Address) -> U512 {
// code omitted for brevity
}

/// Returns the lock duration.
pub fn lock_duration(&self) -> u64 {
// code omitted for brevity
}
}

/// Errors that may occur during the contract execution.
#[odra::odra_error]
pub enum Error {
LockIsNotOver = 1,
CannotLockTwice = 2,
InsufficientBalance = 3
}

/// Deposit event.
#[odra::event]
pub struct Deposit {
pub address: Address,
pub amount: U512
}

/// Withdrawal event.
#[odra::event]
pub struct Withdrawal {
pub address: Address,
pub amount: U512
}

Full code can be found here.

Client

Before we can interact with the node, we need to set it up. We will use the casper-nctl-docker image.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Make sure you have the contract's wasm file and the secret key.

# Build the contract
cargo odra build -c TimeLockWallet
# Extract secret key
docker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem

To interact with the contract, we use the livenet backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case).

Cargo.toml
[package]
name = "odra-examples"
version = "1.1.0"
edition = "2021"

[dependencies]
odra = { path = "../odra", default-features = false }
... # other dependencies
odra-casper-livenet-env = { version = "1.1.0", optional = true }

... # other sections

[features]
default = []
livenet = ["odra-casper-livenet-env"]

... # other sections

[[bin]]
name = "tlw_on_livenet"
path = "bin/tlw_on_livenet.rs"
required-features = ["livenet"]
test = false

... # other sections
examples/bin/tlw_on_livenet.rs
//! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs.
use odra::casper_types::{AsymmetricType, PublicKey, U512};
use odra::host::{Deployer, HostRef};
use odra::Address;
use odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs};

const DEPOSIT: u64 = 100;
const WITHDRAWAL: u64 = 99;
const GAS: u64 = 20u64.pow(9);

fn main() {
let env = odra_casper_livenet_env::env();
let caller = env.get_account(0);

env.set_caller(caller);
env.set_gas(GAS);

let mut contract = TimeLockWalletHostRef::deploy(
&env,
TimeLockWalletInitArgs { lock_duration: 60 * 60 }
);
// Send 100 CSPRs to the contract.
contract
.with_tokens(U512::from(DEPOSIT))
.deposit();

println!("Caller's balance: {:?}", contract.get_balance(&caller));
// Withdraw 99 CSPRs from the contract.
contract.withdraw(&U512::from(WITHDRAWAL));
println!("Remaining balance: {:?}", contract.get_balance(&caller));
}

To run the code, execute the following command:

ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \
ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \
ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \
cargo run --bin tlw_on_livenet --features=livenet
# Sample output
💁 INFO : Deploying "TimeLockWallet".
💁 INFO : Found wasm under "wasm/TimeLockWallet.wasm".
🙄 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558".
💁 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed.
💁 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed.
💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy.
🙄 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3".
💁 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed.
Caller's balance: 100
💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw".
🙄 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e".
💁 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed.
Remaining balance: 1

As observed, the contract was successfully deployed, and the Caller deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR. +The logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity.

Conclusion

In this tutorial, we learned how to use the proxy_caller wasm to make a payable function call. We deployed the TimeLockWallet contract, deposited tokens using the proxy_caller with attached CSPRs, and withdrew them. You got to try it out in both Rust and TypeScript, so you can choose whichever you prefer. Rust code seemed simpler, thanks to the Odra livenet backend making chain interactions easier to handle.

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/access-control/index.html b/docs/docs/tutorials/access-control/index.html new file mode 100644 index 000000000..797a15c35 --- /dev/null +++ b/docs/docs/tutorials/access-control/index.html @@ -0,0 +1,17 @@ + + + + + +Access Control | Odra + + + + + +
+
Version: 1.0.0

Access Control

In a previous tutorial, we introduced the Ownable module, which serves the purpose of securing access to specific contract features. While it establishes a fundamental security layer, there are numerous scenarios where this level of security is insufficient,

In this article we design and implement a more fine-grained access control layer.

Code

Before we start writing code, we list the functionalities of our access control layer.

  1. A Role type is used across the module.
  2. A Role can be assigned to many Addresses.
  3. Each Role may have a corresponding admin role.
  4. Only an admin can grant/revoke a Role.
  5. A Role can be renounced.
  6. A Role cannot be renounced on someone's behalf.
  7. Each action triggers an event.
  8. Unauthorized access stops contract execution.

Project Structure

access-control
├── src
│ ├── access
│ │ ├── access_control.rs
│ │ ├── events.rs
│ │ └── errors.rs
│ └── lib.rs
|── build.rs
|── Cargo.toml
└── Odra.toml

Events and Errors

There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions.

events.rs
use odra::prelude::*;
use odra::Address;
use super::access_control::Role;

#[odra::event]
pub struct RoleGranted {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleRevoked {
pub role: Role,
pub address: Address,
pub sender: Address
}

#[odra::event]
pub struct RoleAdminChanged {
pub role: Role,
pub previous_admin_role: Role,
pub new_admin_role: Role
}
  • L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.
  • L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role.
errors.rs
#[odra::odra_error]
pub enum Error {
MissingRole = 20_000,
RoleRenounceForAnotherAddress = 20_001,
}

Errors definition is straightforward - there are only two invalid states:

  1. An action is triggered by an unauthorized actor.
  2. The caller is attempting to resign the Role on someone's behalf.

Module

Now, we are stepping into the most interesting part: the module definition and implementation.

access_control.rs
use super::events::*;
use super::errors::Error;
use odra::prelude::*;
use odra::{Address, Mapping};

pub type Role = [u8; 32];

pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32];

#[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])]
pub struct AccessControl {
roles: Mapping<(Role, Address), bool>,
role_admin: Mapping<Role, Role>
}

#[odra::module]
impl AccessControl {
pub fn has_role(&self, role: &Role, address: &Address) -> bool {
self.roles.get_or_default(&(*role, *address))
}

pub fn get_role_admin(&self, role: &Role) -> Role {
let admin_role = self.role_admin.get(role);
if let Some(admin) = admin_role {
admin
} else {
DEFAULT_ADMIN_ROLE
}
}

pub fn grant_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_grant_role(role, address);
}

pub fn revoke_role(&mut self, role: &Role, address: &Address) {
self.check_role(&self.get_role_admin(role), &self.env().caller());
self.unchecked_revoke_role(role, address);
}

pub fn renounce_role(&mut self, role: &Role, address: &Address) {
if address != &self.env().caller() {
self.env().revert(Error::RoleRenounceForAnotherAddress);
}
self.unchecked_revoke_role(role, address);
}
}

impl AccessControl {
pub fn check_role(&self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.env().revert(Error::MissingRole);
}
}

pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) {
let previous_admin_role = self.get_role_admin(role);
self.role_admin.set(role, *admin_role);
self.env().emit_event(RoleAdminChanged {
role: *role,
previous_admin_role,
new_admin_role: *admin_role
});
}

pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) {
if !self.has_role(role, address) {
self.roles.set(&(*role, *address), true);
self.env().emit_event(RoleGranted {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}

pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) {
if self.has_role(role, address) {
self.roles.set(&(*role, *address), false);
self.env().emit_event(RoleRevoked {
role: *role,
address: *address,
sender: self.env().caller()
});
}
}
}
  • L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.
  • L8 - The default role is an array filled with zeros.
  • L10-L13 - The storage consists of two mappings:
  1. roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.
  2. role_admin - each Role can have a single admin Role.
  • L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.
  • L49 - This is a non-exported block containing helper functions.
  • L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.
  • L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.
  • L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).
  • L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.
  • L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access.
+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/build-deploy-read/index.html b/docs/docs/tutorials/build-deploy-read/index.html new file mode 100644 index 000000000..9d189f3dd --- /dev/null +++ b/docs/docs/tutorials/build-deploy-read/index.html @@ -0,0 +1,17 @@ + + + + + +Build, Deploy and Read the State of a Contract | Odra + + + + + +
+
Version: 1.0.0

Build, Deploy and Read the State of a Contract

In this guide, we will show the full path from creating a contract, deploying it and reading the state.

We will use a contract with a complex storage layout and show how to deploy it and then read the state of the contract in Rust and TypeScript.

Before you start, make sure you completed the following steps:

Contract

Let's write a contract with complex storage layout.

The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping.

We will expose two methods:

  1. The constructor init which sets the metadata and the version of the contract.
  2. The method set_data which sets the value of the numeric field and the values of the mapping.
custom_item.rs
use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var};

// A custom type with a vector of another custom type
#[odra::odra_type]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[odra::odra_type]
pub struct Price {
value: U256,
}

// The main contract with a version, metadata and a submodule
#[odra::module]
pub struct CustomItem {
version: Var<u32>,
meta: Var<Metadata>,
data: SubModule<Data>
}

#[odra::module]
impl CustomItem {
pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) {
let meta = Metadata {
name,
description,
prices: vec![
Price { value: price_1 },
Price { value: price_2 }
]
};
self.meta.set(meta);
self.version.set(self.version.get_or_default() + 1);
}

pub fn set_data(&mut self, value: u32, name: String, name2: String) {
self.data.value.set(value);
self.data.inner.named_values.set(&name, 10);
self.data.inner.named_values.set(&name2, 20);
}
}

// A submodule with a numeric value and another submodule
#[odra::module]
struct Data {
value: Var<u32>,
inner: SubModule<InnerData>,
}

// A submodule with a mapping
#[odra::module]
struct InnerData {
named_values: Mapping<String, u32>,
}

Deploying the contract

First, we need to setup the chain. We will use the NCTL docker image to run a local network.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Next, we need to compile the contract to a Wasm file.

cargo odra build -c custom_item 

Then, we can deploy the contract using the casper-client tool.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key path/to/your/secret_key.pem \
--session-path [PATH_TO_WASM] \
--payment-amount 100000000000 \
--session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \
--session-arg "odra_cfg_allow_key_override:bool:'true'" \
--session-arg "odra_cfg_is_upgradable:bool:'true'" \
--session-arg "name:string='My Name'" \
--session-arg "description:string='My Description'" \
--session-arg "price_1:u256='101'" \
--session-arg "price_2:u256='202'"

Finally, we can call the set_data method to set the values of the contract.

casper-client put-deploy \
--node-address http://localhost:11101 \
--chain-name casper-net-1 \
--secret-key ./keys/secret_key.pem \
--payment-amount 2000000000 \
--session-hash [DEPLOYED_CONTRACT_HASH] \
--session-entry-point "set_data" \
--session-arg "value:u32:'666'" \
--session-arg "name:string='alice'" \
--session-arg "name2:string='bob'"

Storage Layout

To read the state of the contract, we need to understand the storage layout.

The first step is to calculate the index of the keys.

Storage Layout

CustomItem: prefix: 0x0..._0000_0000_0000 0
version: u32, 0x0..._0000_0000_0001 1
meta: Metadata, 0x0..._0000_0000_0010 2
data: Data: prefix: 0x0..._0000_0000_0011 3
value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1
inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2
named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1

The actual key is obtained as follows:

  1. Convert the index to a big-endian byte array.
  2. Concatenate the index with the mapping data.
  3. Hash the concatenated bytes using blake2b.
  4. Return the hex representation of the hash (the stored key must be utf-8 encoded).

In more detail, the storage layout is described in the Storage Layout article.

Reading the state

main.rs
use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity};
use casper_types::{
bytesrepr::{FromBytes, ToBytes},
U256,
};

// replace with your contract hash
const CONTRACT_HASH: &str = "hash-...";
const NODE_ADDRESS: &str = "http://localhost:11101/rpc";
const RPC_ID: &str = "casper-net-1";
const DICTIONARY_NAME: &str = "state";

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Metadata {
name: String,
description: String,
prices: Vec<Price>,
}

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Price {
value: U256,
}

async fn read_state_key(key: String) -> Vec<u8> {
let state_root_hash = casper_client::get_state_root_hash(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
None,
)
.await
.unwrap()
.result
.state_root_hash
.unwrap();

// Read the value from the `state` dictionary.
let result = casper_client::get_dictionary_item(
RPC_ID.to_string().into(),
NODE_ADDRESS,
Verbosity::Low,
state_root_hash,
DictionaryItemIdentifier::ContractNamedKey {
key: CONTRACT_HASH.to_string(),
dictionary_name: DICTIONARY_NAME.to_string(),
dictionary_item_key: key,
},
)
.await
.unwrap()
.result
.stored_value;

// We expect the value to be a CLValue
if let StoredValue::CLValue(cl_value) = result {
// Ignore the first 4 bytes, which are the length of the CLType.
cl_value.inner_bytes()[4..].to_vec()
} else {
vec![]
}
}

async fn metadata() -> Metadata {
// The key for the metadata is 2, and it has no mapping data
let key = key(2, &[]);
let bytes = read_state_key(key).await;

// Read the name and store the remaining bytes
let (name, bytes) = String::from_bytes(&bytes).unwrap();
// Read the description and store the remaining bytes
let (description, bytes) = String::from_bytes(&bytes).unwrap();
// A vector is stored as a u32 size followed by the elements
// Read the size of the vector and store the remaining bytes
let (size, mut bytes) = u32::from_bytes(&bytes).unwrap();

let mut prices = vec![];
// As we know the size of the vector, we can loop over it
for _ in 0..size {
// Read the value and store the remaining bytes
let (value, rem) = U256::from_bytes(&bytes).unwrap();
bytes = rem;
prices.push(Price { value });
}
// Anytime you finish parsing a value, you should check if there are any remaining bytes
// if there are, it means you have a bug in your parsing logic.
// For simplicity, we will ignore the remaining bytes here.
Metadata {
name,
description,
prices
}
}

async fn value() -> u32 {
// The key for the value is (3 << 4) + 1, and it has no mapping data
let key = key((3 << 4) + 1, &[]);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

async fn named_value(name: &str) -> u32 {
// The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes
let mapping_data = name.to_bytes().unwrap();
let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data);
let bytes = read_state_key(key).await;

// Read the value and ignore the remaining bytes for simplicity
u32::from_bytes(&bytes).unwrap().0
}

fn main() {
let runtime = tokio::runtime::Runtime::new().unwrap();
dbg!(runtime.block_on(metadata()));
dbg!(runtime.block_on(value()));
dbg!(runtime.block_on(named_value("alice")));
dbg!(runtime.block_on(named_value("bob")));
}

// The key is a combination of the index and the mapping data
// The algorithm is as follows:
// 1. Convert the index to a big-endian byte array
// 2. Concatenate the index with the mapping data
// 3. Hash the concatenated bytes using blake2b
// 4. Return the hex representation of the hash (the stored key must be utf-8 encoded)
fn key(idx: u32, mapping_data: &[u8]) -> String {
let mut key = Vec::new();
key.extend_from_slice(idx.to_be_bytes().as_ref());
key.extend_from_slice(mapping_data);
let hashed_key = blake2b(&key);

hex::encode(&hashed_key)
}

fn blake2b(bytes: &[u8]) -> [u8; 32] {
let mut result = [0u8; 32];
let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32)
.expect("should create hasher");
let _ = std::io::Write::write(&mut hasher, bytes);
blake2::digest::VariableOutput::finalize_variable(hasher, &mut result)
.expect("should copy hash to the result array");
result
}

cargo run
[src/main.rs:116:5] runtime.block_on(metadata()) = Metadata {
name: "My Contract",
description: "My Description",
prices: [
Price {
value: 123,
},
Price {
value: 321,
},
],
}
[src/main.rs:117:5] runtime.block_on(value()) = 666
[src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20
[src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10
+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/cep18/index.html b/docs/docs/tutorials/cep18/index.html new file mode 100644 index 000000000..1a2b3c76d --- /dev/null +++ b/docs/docs/tutorials/cep18/index.html @@ -0,0 +1,52 @@ + + + + + +CEP-18 | Odra + + + + + +
+
Version: 1.0.0

CEP-18

Not so different from ERC-20, the CEP-18 standard describes a fungible +token interface, but for the Casper network. +There are some differences, which will be shown in this tutorial. +The most visible one however, is the compatibility with the Casper Ecosystem.

In our example, we will implement a CEP-18 token with a simple self-governance mechanism. +We will also deploy our token on the Casper network, and interact with it.

danger

This implementation of the governance in this tutorial is by no means +a complete one, and should not be used in production.

Self-governing token

There are many ways to implement a governance mechanism for a token, +each more complex than the other. In our example, we will use a simple +one, where the community of token holders can vote to mint new tokens.

Token implementation

Let's start by creating a new project, choosing a clever name and using +cep18 as our starting template:

cargo odra new --name ourcoin --template cep18

Let's glance at our token code:

src/token.rs
#[odra::module]
pub struct MyToken {
token: SubModule<Cep18>,
}

impl MyToken {
// Delegate all Cep18 functions to the token sub-module.
delegate! {
to self.token {
...
fn name(&self) -> String;
fn symbol(&self) -> String;
...

As we can see, it indeed uses the Cep18 module and delegates +all the methods to it.

The only thing to do is to change the name of the struct to more +appropriate OurToken, run the provided tests using cargo odra test, +and continue with the implementation of the governance.

note

Remember to change the name of the struct and its usages as well as +the struct name in the Odra.toml file!

Governance implementation

Let's go through the process of implementing the governance mechanism. +If we don't want to, we don't have to hide entrypoints from the public responsible +for minting new tokens. By default, minting Modality +is turned off, so any attempt of direct minting will result in an error.

We will however implement a voting mechanism, where the token holders can vote +to mint new tokens.

Voting mechanism

Our voting system will be straightforward:

  1. Anyone with the tokens can propose a new mint.
  2. Anyone with the tokens can vote for the new mint by staking their tokens.
  3. If the majority of the token holders vote for the mint, it is executed.

Storage

We will need to store some additional information about the votes, so let's +add some fields to our token struct:

src/token.rs
#[odra::module]
pub struct OurToken {
/// A sub-module that implements the CEP-18 token standard.
token: SubModule<Cep18>,
/// The proposed mint.
proposed_mint: Var<(Address, U256)>,
/// The list of votes cast in the current vote.
votes: List<Ballot>,
/// Whether a vote is open.
is_vote_open: Var<bool>,
/// The time when the vote ends.
vote_end_time: Var<u64>,
}

/// A ballot cast by a voter.
#[odra::odra_type]
struct Ballot {
voter: Address,
choice: bool,
amount: U256,
}

Notice that proposed_mint contains a tuple containing the address of +the proposer and the amount of tokens to mint. Moreover, we need to keep track if +the vote time has ended, but also if it was already tallied, that's why +we need both is_vote_open and vote_end_time.

We will also use the power of the List +type to store the Ballots.

Proposing a new mint

To implement the endpoint that allows token holders to propose a new mint, +we need to add a new function to our token module:

src/token.rs
/// Proposes a new mint for the contract.
pub fn propose_new_mint(&mut self, account: Address, amount: U256) {
// Only allow proposing a new mint if there is no vote in progress.
if self.is_vote_open().get_or_default() {
self.env().revert(GovernanceError::VoteAlreadyOpen);
}

// Only the token holders can propose a new mint.
if self.balance_of(&self.env().caller()) == U256::zero() {
self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose);
}

// Set the proposed mint.
self.proposed_mint.set((account, amount));
// Open a vote.
self.is_vote_open.set(true);
// Set the vote end time to 10 minutes from now.
self.vote_end_time
.set(self.env().get_block_time() + 60 * 10 * 1000);
}

As a parameters to the function, we pass the address of the account that should be the receiver of +the minted tokens, and the amount.

After some validation, we open the vote by setting the is_vote_open to true, +and setting the vote_end_time to 10 minutes. In real-world scenarios, +the time could be configurable, but for the sake of simplicity, we hardcoded it. +Also, it should be quite longer than 10 minutes, but it will come in handy +when we test it on Livenet.

Voting for the mint

Next, we need an endpoint that will allow us to cast a ballot:

src/token.rs
/// Votes on the proposed mint.
pub fn vote(&mut self, choice: bool, amount: U256) {
// Only allow voting if there is a vote in progress.
self.assert_vote_in_progress();

let voter = self.env().caller();
let contract = self.env().self_address();

// Transfer the voting tokens from the voter to the contract.
self.token
.transfer(&contract, &amount);

// Add the vote to the list.
self.votes.push(Ballot {
voter,
choice,
amount,
});
}

The most interesting thing here is that we are using a mechanism of staking, +where we transfer our tokens to the contract, to show that we really mean it.

The tokens will be locked until the vote is over, and tallied.

Speaking of tallying...

Tallying the votes

The last step is to tally the votes and mint the tokens if the majority +of voters agreed to do so:

src/token.rs
/// Count the votes and perform the action
pub fn tally(&mut self) {
// Only allow tallying the votes once.
if !self.is_vote_open.get_or_default()
{
self.env().revert(GovernanceError::NoVoteInProgress);
}

// Only allow tallying the votes after the vote has ended.
let finish_time = self
.vote_end_time
.get_or_revert_with(GovernanceError::NoVoteInProgress);
if self.env().get_block_time() < finish_time {
self.env().revert(GovernanceError::VoteNotYetEnded);
}

// Count the votes
let mut yes_votes = U256::zero();
let mut no_votes = U256::zero();

let contract = self.env().self_address();

while let Some(vote) = self.votes.pop() {
if vote.choice {
yes_votes += vote.amount;
} else {
no_votes += vote.amount;
}

// Transfer back the voting tokens to the voter.
self.token.raw_transfer(&contract, &vote.voter, &vote.amount);
}

// Perform the action if the vote has passed.
if yes_votes > no_votes {
let (account, amount) = self
.proposed_mint
.get_or_revert_with(GovernanceError::NoVoteInProgress);
self.token.raw_mint(&account, &amount);
}

// Close the vote.
self.is_vote_open.set(false);
}

Notice how we used raw_transfer from the Cep18 module. We used it +to set the sender, so the contract's balance will be used, instead of +the caller's.

Additonally, we used raw_mint to mint the tokens, skipping the security +checks. We have no modality for minting, but even if we had, we don't +have anyone with permissions! The Contract needs to mint the tokens itself.

Testing

Now, we will put our implementation to the test. One unit test, that we can +run both on OdraVM and on the CasperVM.

src/token.rs
#[test]
fn it_works() {
let env = odra_test::env();
let init_args = OurTokenInitArgs {
name: "OurToken".to_string(),
symbol: "OT".to_string(),
decimals: 0,
initial_supply: U256::from(1_000u64),
};

let mut token = OurTokenHostRef::deploy(&env, init_args);

// The deployer, as the only token holder,
// starts a new voting to mint 1000 tokens to account 1.
// There is only 1 token holder, so there is one Ballot cast.
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(1000));

// The tokens should now be staked.
assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());

// Wait for the vote to end.
env.advance_block_time(60 * 11 * 1000);

// Finish the vote.
token.tally();

// The tokens should now be minted.
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));
assert_eq!(token.total_supply(), 3000.into());

// The stake should be returned.
assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));

// Now account 1 can mint new tokens with their voting power...
env.set_caller(env.get_account(1));
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(2000));

// ...Even if the deployer votes against it.
env.set_caller(env.get_account(0));
token.vote(false, U256::from(1000));

env.advance_block_time(60 * 11 * 1000);

token.tally();

// The power of community governance!
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));
}

We can run the test using both methods:

cargo odra test
cargo odra test -b casper

It is all nice and green, but it would be really nice to see it in action.

How about deploying it on the Casper network?

What's next

We will se our token in action, by deploying it on the Casper network, +and using tools from the Casper Ecosystem to interact with it.

Complete code

Here is the complete code of the OurToken module:

src/token.rs
use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var};
use odra_modules::cep18_token::Cep18;

/// A ballot cast by a voter.
#[odra::odra_type]
struct Ballot {
voter: Address,
choice: bool,
amount: U256,
}

/// Errors for the governed token.
#[odra::odra_error]
pub enum GovernanceError {
/// The vote is already in progress.
VoteAlreadyOpen = 0,
/// No vote is in progress.
NoVoteInProgress = 1,
/// Cannot tally votes yet.
VoteNotYetEnded = 2,
/// Vote ended
VoteEnded = 3,
/// Only the token holders can propose a new mint.
OnlyTokenHoldersCanPropose = 4,
}

/// A module definition. Each module struct consists of Vars and Mappings
/// or/and other modules.
#[odra::module]
pub struct OurToken {
/// A submodule that implements the CEP-18 token standard.
token: SubModule<Cep18>,
/// The proposed mint.
proposed_mint: Var<(Address, U256)>,
/// The list of votes cast in the current vote.
votes: List<Ballot>,
/// Whether a vote is open.
is_vote_open: Var<bool>,
/// The time when the vote ends.
vote_end_time: Var<u64>,
}
/// Module implementation.
///
/// To generate entrypoints,
/// an implementation block must be marked as #[odra::module].
#[odra::module]
impl OurToken {
/// Initializes the contract with the given metadata and initial supply.
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
// We put the token address as an admin, so it can govern itself. Self-governing token!
self.token
.init(symbol, name, decimals, initial_supply, vec![], vec![], None);
}

// Delegate all Cep18 functions to the token submodule.
delegate! {
to self.token {
/// Admin EntryPoint to manipulate the security access granted to users.
/// One user can only possess one access group badge.
/// Change strength: None > Admin > Minter
/// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an
/// Admin, also if a user is added to Admin and None then they will be removed from having rights.
/// Beware: do not remove the last Admin because that will lock out all admin functionality.
fn change_security(
&mut self,
admin_list: Vec<Address>,
minter_list: Vec<Address>,
none_list: Vec<Address>
);

/// Returns the name of the token.
fn name(&self) -> String;

/// Returns the symbol of the token.
fn symbol(&self) -> String;

/// Returns the number of decimals the token uses.
fn decimals(&self) -> u8;

/// Returns the total supply of the token.
fn total_supply(&self) -> U256;

/// Returns the balance of the given address.
fn balance_of(&self, address: &Address) -> U256;

/// Returns the amount of tokens the owner has allowed the spender to spend.
fn allowance(&self, owner: &Address, spender: &Address) -> U256;

/// Approves the spender to spend the given amount of tokens on behalf of the caller.
fn approve(&mut self, spender: &Address, amount: &U256);

/// Decreases the allowance of the spender by the given amount.
fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256);

/// Increases the allowance of the spender by the given amount.
fn increase_allowance(&mut self, spender: &Address, inc_by: &U256);

/// Transfers tokens from the caller to the recipient.
fn transfer(&mut self, recipient: &Address, amount: &U256);

/// Transfers tokens from the owner to the recipient using the spender's allowance.
fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256);

/// Mints new tokens and assigns them to the given address.
fn mint(&mut self, owner: &Address, amount: &U256);

/// Burns the given amount of tokens from the given address.
fn burn(&mut self, owner: &Address, amount: &U256);
}
}

/// Proposes a new mint for the contract.
pub fn propose_new_mint(&mut self, account: Address, amount: U256) {
// Only allow proposing a new mint if there is no vote in progress.
if self.is_vote_open.get_or_default() {
self.env().revert(GovernanceError::VoteAlreadyOpen);
}

// Only the token holders can propose a new mint.
if self.balance_of(&self.env().caller()) == U256::zero() {
self.env()
.revert(GovernanceError::OnlyTokenHoldersCanPropose);
}

// Set the proposed mint.
self.proposed_mint.set((account, amount));
// Open a vote.
self.is_vote_open.set(true);
// Set the vote end time to 10 minutes from now.
self.vote_end_time
.set(self.env().get_block_time() + 10 * 60 * 1000);
}

/// Votes on the proposed mint.
pub fn vote(&mut self, choice: bool, amount: U256) {
// Only allow voting if there is a vote in progress.
self.assert_vote_in_progress();

let voter = self.env().caller();
let contract = self.env().self_address();

// Transfer the voting tokens from the voter to the contract.
self.token.transfer(&contract, &amount);

// Add the vote to the list.
self.votes.push(Ballot {
voter,
choice,
amount,
});
}

/// Count the votes and perform the action
pub fn tally(&mut self) {
// Only allow tallying the votes once.
if !self.is_vote_open.get_or_default() {
self.env().revert(GovernanceError::NoVoteInProgress);
}

// Only allow tallying the votes after the vote has ended.
let finish_time = self
.vote_end_time
.get_or_revert_with(GovernanceError::NoVoteInProgress);
if self.env().get_block_time() < finish_time {
self.env().revert(GovernanceError::VoteNotYetEnded);
}

// Count the votes
let mut yes_votes = U256::zero();
let mut no_votes = U256::zero();

let contract = self.env().self_address();

while let Some(vote) = self.votes.pop() {
if vote.choice {
yes_votes += vote.amount;
} else {
no_votes += vote.amount;
}

// Transfer back the voting tokens to the voter.
self.token
.raw_transfer(&contract, &vote.voter, &vote.amount);
}

// Perform the action if the vote has passed.
if yes_votes > no_votes {
let (account, amount) = self
.proposed_mint
.get_or_revert_with(GovernanceError::NoVoteInProgress);
self.token.raw_mint(&account, &amount);
}

// Close the vote.
self.is_vote_open.set(false);
}

fn assert_vote_in_progress(&self) {
if !self.is_vote_open.get_or_default() {
self.env().revert(GovernanceError::NoVoteInProgress);
}

let finish_time = self
.vote_end_time
.get_or_revert_with(GovernanceError::NoVoteInProgress);

if self.env().get_block_time() > finish_time {
self.env().revert(GovernanceError::VoteEnded);
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use odra::host::Deployer;

#[test]
fn it_works() {
let env = odra_test::env();
let init_args = OurTokenInitArgs {
name: "OurToken".to_string(),
symbol: "OT".to_string(),
decimals: 0,
initial_supply: U256::from(1_000u64),
};

let mut token = OurTokenHostRef::deploy(&env, init_args);

// The deployer, as the only token holder,
// starts a new voting to mint 1000 tokens to account 1.
// There is only 1 token holder, so there is one Ballot cast.
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(1000));

// The tokens should now be staked.
assert_eq!(token.balance_of(&env.get_account(0)), U256::zero());

// Wait for the vote to end.
env.advance_block_time(60 * 11 * 1000);

// Finish the vote.
token.tally();

// The tokens should now be minted.
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000));
assert_eq!(token.total_supply(), 3000.into());

// The stake should be returned.
assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000));

// Now account 1 can mint new tokens with their voting power...
env.set_caller(env.get_account(1));
token.propose_new_mint(env.get_account(1), U256::from(2000));
token.vote(true, U256::from(2000));

// ...Even if the deployer votes against it.
env.set_caller(env.get_account(0));
token.vote(false, U256::from(1000));

env.advance_block_time(60 * 11 * 1000);

token.tally();

// The power of community governance!
assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000));
}
}
+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/deploying-on-casper/index.html b/docs/docs/tutorials/deploying-on-casper/index.html new file mode 100644 index 000000000..9f512b895 --- /dev/null +++ b/docs/docs/tutorials/deploying-on-casper/index.html @@ -0,0 +1,58 @@ + + + + + +Deploying a Token on Casper Livenet | Odra + + + + + +
+
Version: 1.0.0

Deploying a Token on Casper Livenet

In this tutorial, we will take the token we created in +the previous one and deploy it on the Livenet Casper network, +using the Odra Livenet backend.

We will also take a look at the tools that Casper Ecosystem +provides to interact with our newly deployed token.

info

Most of this tutorial will work with any Casper contract.

Casper Wallet

We will be using Casper Wallet to do some tasks in this tutorial. +To install it, please follow the instructions on the +official website.

After setting up the wallet, extract the private key of the account +you want to use for our testing. +You can do this by clicking on the Menu > Download account keys.

danger

You are solely responsible for the security of your private keys. +We recommend creating a new account for the testing purposes.

Why do we need the private key? We will use it in Odra to deploy +our contract to the Casper network using Livenet backend.

Getting tokens

To deploy the contract on the Livenet, we need to have some CSPR. +The easiest way to get them is to use the faucet, which will send +us 1000 CSPR for free. Unfortunately, only on the Testnet.

To use the faucet, go to the Casper Testnet Faucet. +Log in using your Casper Wallet account and click on the "Request Tokens" button.

note

One account can request tokens only once. If you run out of tokens, you can +either ask someone in the Casper community to send you some, or simply create a new account +in the wallet.

Now, when we have the tokens, we can deploy the contract. Let's do it using Odra!

Odra Livenet

Odra Livenet is described in detail in the +backends section of this documentation. +We will then briefly describe how to use set it up in this tutorial.

In your contract code, create a new file in the bin folder:

bin/our_token_livenet.rs
//! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial
//! creator.
use std::str::FromStr;

use odra::casper_types::U256;
use odra::host::{Deployer, HostEnv, HostRef, HostRefLoader};
use odra::Address;
use ourcoin::token::{OurTokenHostRef, OurTokenInitArgs};

fn main() {
// Load the Casper livenet environment.
let env = odra_casper_livenet_env::env();

// Caller is the deployer and the owner of the private key.
let owner = env.caller();
// Just some random address...
let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26";
let recipient = Address::from_str(recipient).unwrap();

// Deploy new contract.
let mut token = deploy_our_token(&env);
println!("Token address: {}", token.address().to_string());

// Propose minting new tokens.
env.set_gas(1_000_000_000u64);
token.propose_new_mint(recipient, U256::from(1_000));

// Vote, we are the only voter.
env.set_gas(1_000_000_000u64);
token.vote(true, U256::from(1_000));

// Let's advance the block time by 11 minutes, as
// we set the voting time to 10 minutes.
// OH NO! It is the Livenet, so we need to wait real time...
// Hopefully you are not in a hurry.
env.advance_block_time(11 * 60 * 1000);

// Tally the votes.
env.set_gas(1_500_000_000u64);
token.tally();

// Check the balances.
println!("Owner's balance: {:?}", token.balance_of(&owner));
println!(
"Tutorial creator's balance: {:?}",
token.balance_of(&recipient)
);
}

/// Deploys a contract.
pub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef {
let name = String::from("OurToken");
let symbol = String::from("OT");
let decimals = 0;
let initial_supply = U256::from(1_000);

let init_args = OurTokenInitArgs {
name,
symbol,
decimals,
initial_supply,
};

env.set_gas(300_000_000_000u64);
OurTokenHostRef::deploy(env, init_args)
}

/// Loads a contract. Just in case you need to load an existing contract later...
fn _load_cep18(env: &HostEnv) -> OurTokenHostRef {
let address = "hash-XXXXX";
let address = Address::from_str(address).unwrap();
OurTokenHostRef::load(env, address)
}

In your Cargo.toml file, we need to add a new dependency, a feature and +register the new binary. In the end, it should look like this:

Cargo.toml
[package]
name = "ourcoin"
version = "0.1.0"
edition = "2021"

[dependencies]
odra = { version = "1.0.0", features = [], default-features = false }
odra-modules = { version = "1.0.0", features = [], default-features = false }
odra-casper-livenet-env = { version = "1.0.0", optional = true }

[dev-dependencies]
odra-test = { version = "1.0.0", features = [], default-features = false }

[build-dependencies]
odra-build = { version = "1.0.0", features = [], default-features = false }

[features]
default = []
livenet = ["odra-casper-livenet-env"]

[[bin]]
name = "ourcoin_build_contract"
path = "bin/build_contract.rs"
test = false

[[bin]]
name = "ourcoin_build_schema"
path = "bin/build_schema.rs"
test = false

[[bin]]
name = "our_token_livenet"
path = "bin/our_token_livenet.rs"
required-features = ["livenet"]

[profile.release]
codegen-units = 1
lto = true

[profile.dev.package."*"]
opt-level = 3

Finally, add the .env file with the following content:

.env
# Path to the secret key of the account that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem

# RPC address of the node that will be used to deploy the contracts.
ODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777

# Chain name of the network.
ODRA_CASPER_LIVENET_CHAIN_NAME=casper-test

Of course, you need to replace the secret key's path +with the path to the secret key file you downloaded from the Casper Wallet.

note

One of the problems you may encounter is that the node you are using +will be down or will not accept your calls. In this case, you will +have to find and use another node IP address.

Now, we will run our code:

cargo run --bin our_token_livenet --features livenet

If everything is set up correctly, you should see the output similar to this:

     Running `target/debug/our_token_livenet`
💁 INFO : Deploying "OurToken".
💁 INFO : Found wasm under "wasm/OurToken.wasm".
🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".
🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227".
💁 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed.
💁 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed.

Token address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857

💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint".
🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".
🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361".
💁 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed.
💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote".
🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".
🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5".
💁 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed.
💁 INFO : advance_block_time called - Waiting for 660000 ms
💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally".
🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".
🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef".
💁 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed.

Owner's balance: 1000
Tutorial creator's balance: 1000

Congratulations, your contract is now deployed on the Casper network! +Before we move on, note the address of the token!

We will use it in the next section to interact with the token. In our case it is +hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857.

Cspr.live

The first thing we will do is to explore Casper's network block explorer, +cspr.live. We can put the address of our token in the search bar +to find it.

note

If you deployed your contract on the Testnet, remember to make sure that the Testnet +network is selected in the dropdown menu in the top right corner.

If everything is set up correctly, you should see the contract package's details. +Besides the owner, keys etc., you can also see the contract's metdata, if it +was developed using a standard that cspr.live supports.

Indeed, we can see that it detected that our contract is a CEP-18 token! +We see the name, symbol and total supply. +All the mentions of the contract on the website will use the token name instead +of the contract address.

contract.png

Additionally, on the Token Txs tab, we can see the transactions that happened +with the token. We can see the minting transaction we did in the previous section +and transfers done during the voting process.

transactions.png

If we click on one of the accounts that recieved the tokens, we will go to the +account page. Here, on the Tokens tab, we can see all the tokens that the account +has - and OurToken is one of them!

If you wish, you can check the status of the contract deployed during the development +of this tutorial here.

Transferring Tokens using Casper Wallet

Casper wallet can do much more than just logging in to the faucet, exporting +the private keys and transferring CSPR. It can also interact with the contracts +deployed on the network.

If you deployed the contract and left some OT tokens to yourself, you should see +them in the Casper Wallet window.

You should also be able to transfer them to another account!

wallet.png

Conclusion

We've successfully deployed a token on the Casper network and interacted with it +using the Odra backend and Casper Wallet. We've also learned how to use the +cspr.live block explorer to check the status of your contract.

Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem +provides. Feel free to explore them on casperecosystem.io.

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/erc20/index.html b/docs/docs/tutorials/erc20/index.html new file mode 100644 index 000000000..81546ce89 --- /dev/null +++ b/docs/docs/tutorials/erc20/index.html @@ -0,0 +1,17 @@ + + + + + +ERC-20 | Odra + + + + + +
+
Version: 1.0.0

ERC-20

It's time for something that every smart contract developer has done at least once. Let's try to implement Erc20 standard. Of course, we are going to use the Odra Framework.

The ERC-20 standard establishes a uniform specification for fungible tokens. This implies that each token shares attributes that make it indistinguishable from another token of the same type and value.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • Advanced storage using key-value pairs,
  • Odra types such as Address,
  • Advanced event assertion.

Code

Our module features a considerably more complex storage layout compared to the previous example.

It is designed to store the following data:

  1. Immutable metadata - name, symbol, and decimals.
  2. Total supply.
  3. Balances of individual users.
  4. Allowances, essentially indicating who is permitted to spend tokens on behalf of another user.

Module definition

erc20.rs
use odra::prelude::*;
use odra::{Address, casper_types::U256, Mapping, Var};

#[odra::module(events = [Transfer, Approval])]
pub struct Erc20 {
decimals: Var<u8>,
symbol: Var<String>,
name: Var<String>,
total_supply: Var<U256>,
balances: Mapping<Address, U256>,
allowances: Mapping<(Address, Address), U256>
}
  • L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.
  • L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys.

Metadata

erc20.rs
#[odra::module]
impl Erc20 {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let caller = self.env().caller();
self.name.set(name);
self.symbol.set(symbol);
self.decimals.set(decimals);
self.mint(&caller, &initial_supply);
}

pub fn name(&self) -> String {
self.name.get_or_default()
}

pub fn symbol(&self) -> String {
self.symbol.get_or_default()
}

pub fn decimals(&self) -> u8 {
self.decimals.get_or_default()
}

pub fn total_supply(&self) -> U256 {
self.total_supply.get_or_default()
}
}

impl Erc20 {
pub fn mint(&mut self, address: &Address, amount: &U256) {
self.balances.add(address, *amount);
self.total_supply.add(*amount);

self.env().emit_event(Transfer {
from: None,
to: Some(*address),
amount: *amount
});
}
}

#[odra::event]
pub struct Transfer {
pub from: Option<Address>,
pub to: Option<Address>,
pub amount: U256
}
  • L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.
  • L3-L9 - A constructor sets the token metadata and mints the initial supply.
  • L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.
  • L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for:
use odra::UnwrapOrRevert;

let current_balance = self.balances.get(address).unwrap_or_default();
let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env());
self.balances.set(address, new_balance);

Core

To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks.

erc20.rs
#[odra::module]
impl Erc20 {
...

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
let caller = self.env().caller();
self.raw_transfer(&caller, recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let spender = self.env().caller();
self.spend_allowance(owner, &spender, amount);
self.raw_transfer(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
let owner = self.env().caller();
self.allowances.set(&(owner, *spender), *amount);
self.env().emit_event(Approval {
owner,
spender: *spender,
value: *amount
});
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.balances.get_or_default(&address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.allowances.get_or_default(&(*owner, *spender))
}
}

impl Erc20 {
...

fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
let owner_balance = self.balances.get_or_default(&owner);
if *amount > owner_balance {
self.env().revert(Error::InsufficientBalance)
}
self.balances.set(owner, owner_balance - *amount);
self.balances.add(recipient, *amount);
self.env().emit_event(Transfer {
from: Some(*owner),
to: Some(*recipient),
amount: *amount
});
}

fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) {
let allowance = self.allowance(owner, spender);
if allowance < *amount {
self.env().revert(Error::InsufficientAllowance)
}
let new_allowance = allowance - *amount;
self.allowances
.set(&(*owner, *spender), new_allowance);
self.env().emit_event(Approval {
owner: *owner,
spender: *spender,
value: allowance - *amount
});
}
}

#[odra::event]
pub struct Approval {
pub owner: Address,
pub spender: Address,
pub value: U256
}

#[odra::odra_error]
pub enum Error {
InsufficientBalance = 1,
InsufficientAllowance = 2,
}

Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation?

Test

erc20.rs
#[cfg(test)]
pub mod tests {
use super::*;
use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}};

const NAME: &str = "Plascoin";
const SYMBOL: &str = "PLS";
const DECIMALS: u8 = 10;
const INITIAL_SUPPLY: u32 = 10_000;

fn setup() -> (HostEnv, Erc20HostRef) {
let env = odra_test::env();
(
env.clone(),
Erc20HostRef::deploy(
&env,
Erc20InitArgs {
symbol: SYMBOL.to_string(),
name: NAME.to_string(),
decimals: DECIMALS,
initial_supply: INITIAL_SUPPLY.into()
}
)
)
}

#[test]
fn initialization() {
// When deploy a contract with the initial supply.
let (env, erc20) = setup();

// Then the contract has the metadata set.
assert_eq!(erc20.symbol(), SYMBOL.to_string());
assert_eq!(erc20.name(), NAME.to_string());
assert_eq!(erc20.decimals(), DECIMALS);

// Then the total supply is updated.
assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into());

// Then a Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: None,
to: Some(env.get_account(0)),
amount: INITIAL_SUPPLY.into()
}
));
}

#[test]
fn transfer_works() {
// Given a new contract.
let (env, mut erc20) = setup();

// When transfer tokens to a recipient.
let sender = env.get_account(0);
let recipient = env.get_account(1);
let amount = 1_000.into();
erc20.transfer(&recipient, &amount);

// Then the sender balance is deducted.
assert_eq!(
erc20.balance_of(&sender),
U256::from(INITIAL_SUPPLY) - amount
);

// Then the recipient balance is updated.
assert_eq!(erc20.balance_of(&recipient), amount);

// Then Transfer event was emitted.
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(sender),
to: Some(recipient),
amount
}
));
}

#[test]
fn transfer_error() {
// Given a new contract.
let (env, mut erc20) = setup();

// When the transfer amount exceeds the sender balance.
let recipient = env.get_account(1);
let amount = U256::from(INITIAL_SUPPLY) + U256::one();

// Then an error occurs.
assert!(erc20.try_transfer(&recipient, &amount).is_err());
}

#[test]
fn transfer_from_and_approval_work() {
let (env, mut erc20) = setup();

let (owner, recipient, spender) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let approved_amount = 3_000.into();
let transfer_amount = 1_000.into();

assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY));

// Owner approves Spender.
erc20.approve(&spender, &approved_amount);

// Allowance was recorded.
assert_eq!(erc20.allowance(&owner, &spender), approved_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount
}
));

// Spender transfers tokens from Owner to Recipient.
env.set_caller(spender);
erc20.transfer_from(&owner, &recipient, &transfer_amount);

// Tokens are transferred and allowance decremented.
assert_eq!(
erc20.balance_of(&owner),
U256::from(INITIAL_SUPPLY) - transfer_amount
);
assert_eq!(erc20.balance_of(&recipient), transfer_amount);
assert!(env.emitted_event(
erc20.address(),
&Approval {
owner,
spender,
value: approved_amount - transfer_amount
}
));
assert!(env.emitted_event(
erc20.address(),
&Transfer {
from: Some(owner),
to: Some(recipient),
amount: transfer_amount
}
));
// assert!(env.emitted(erc20.address(), "Transfer"));
}

#[test]
fn transfer_from_error() {
// Given a new instance.
let (env, mut erc20) = setup();

// When the spender's allowance is zero.
let (owner, spender, recipient) =
(env.get_account(0), env.get_account(1), env.get_account(2));
let amount = 1_000.into();
env.set_caller(spender);

// Then transfer fails.
assert_eq!(
erc20.try_transfer_from(&owner, &recipient, &amount),
Err(Error::InsufficientAllowance.into())
);
}
}
  • L146 - Alternatively, if you don't want to check the entire event, you may assert only its type.

What's next

Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids.

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/nft/index.html b/docs/docs/tutorials/nft/index.html new file mode 100644 index 000000000..a9e5cccf6 --- /dev/null +++ b/docs/docs/tutorials/nft/index.html @@ -0,0 +1,17 @@ + + + + + +Ticketing System | Odra + + + + + +
+
Version: 1.0.0

Ticketing System

Non-fungible tokens (NFTs) are digital assets that represent ownership of unique items or pieces of content. They are commonly used for digital art, collectibles, in-game items, and other unique assets. In this tutorial, we will create a simple ticketing system based on NFT tokens.

Our contract will adhere to the CEP-78 standard, which is the standard for NFTs on the Casper blockchain.

Learn more about the CEP-78 standard here.

Ticket Office Contract

Our TicketOffice contract will include the following features:

  • Compliance with the CEP-78 standard.
  • Ownership functionality.
  • Only the owner can issue new event tickets.
  • Users can purchase tickets for events.
  • Tickets are limited to a one-time sale.
  • Public access to view the total income of the TicketOffice.

Setup the project

Creating a new NFT token with Odra is straightforward. Use the cargo odra new command to create a new project with the CEP-78 template:

cargo odra new --name ticket-office --template cep78

Contract implementation

Let's start implementing the TicketOffice contract by modify the code generated from the template.

src/token.rs
use odra::{
args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert
};
use odra_modules::access::Ownable;
use odra_modules::cep78::{
modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode},
token::Cep78,
};

pub type TicketId = u64;

#[odra::odra_type]
pub enum TicketStatus {
Available,
Sold,
}

#[odra::odra_type]
pub struct TicketInfo {
event_name: String,
price: U512,
status: TicketStatus,
}

#[odra::event]
pub struct OnTicketIssue {
ticket_id: TicketId,
event_name: String,
price: U512,
}

#[odra::event]
pub struct OnTicketSell {
ticket_id: TicketId,
buyer: Address,
}

#[odra::odra_error]
pub enum Error {
TicketNotAvailableForSale = 200,
InsufficientFunds = 201,
InvalidTicketId = 202,
TicketDoesNotExist = 203,
}

#[odra::module(
events = [OnTicketIssue, OnTicketSell],
errors = Error
)]
pub struct TicketOffice {
token: SubModule<Cep78>,
ownable: SubModule<Ownable>,
tickets: Mapping<TicketId, TicketInfo>,
}

#[odra::module]
impl TicketOffice {
pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) {
self.ownable.init();
let receipt_name = format!("cep78_{}", collection_name);
self.token.init(
collection_name,
collection_symbol,
total_supply,
OwnershipMode::Transferable,
NFTKind::Digital,
NFTIdentifierMode::Ordinal,
NFTMetadataKind::Raw,
MetadataMutability::Immutable,
receipt_name,
// remaining args are optional and can set to Maybe::None
...
);
}

pub fn issue_ticket(&mut self, event_name: String, price: U512) {
let env = self.env();
let caller = env.caller();
self.ownable.assert_owner(&caller);
// mint a new token
let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None);
let ticket_id: u64 = token_id
.parse()
.map_err(|_| Error::InvalidTicketId)
.unwrap_or_revert(&env);
// store ticket info
self.tickets.set(
&ticket_id,
TicketInfo {
event_name: event_name.clone(),
price,
status: TicketStatus::Available,
},
);
// emit an event
env.emit_event(OnTicketIssue {
ticket_id,
event_name,
price,
});
}

#[odra(payable)]
pub fn buy_ticket(&mut self, ticket_id: TicketId) {
let env = self.env();
let owner = self.ownable.get_owner();
let buyer = env.caller();
let value = env.attached_value();
// only tokens owned by the owner can be sold
if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner {
env.revert(Error::TicketNotAvailableForSale);
}
let mut ticket = self
.tickets
.get(&ticket_id)
.unwrap_or_revert_with(&env, Error::TicketDoesNotExist);
// only available tickets can be sold
if ticket.status != TicketStatus::Available {
env.revert(Error::TicketNotAvailableForSale);
}
// check if the buyer sends enough funds
if value < ticket.price {
env.revert(Error::InsufficientFunds);
}
// transfer csprs to the owner
env.transfer_tokens(&owner, &value);
// transfer the ticket to the buyer
self.token
.transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer);
ticket.status = TicketStatus::Sold;
self.tickets.set(&ticket_id, ticket);

env.emit_event(OnTicketSell { ticket_id, buyer });
}

pub fn balance_of(&self) -> U512 {
self.env().self_balance()
}
}
  • L10-L44 - We define structures and enums that will be used in our contract. TicketStatus enum represents the status of a ticket, TicketInfo struct contains information about a ticket that is written to the storage, TicketId is a type alias for u64. OnTicketIssue and OnTicketSell are events that will be emitted when a ticket is issued or sold.
  • L46-L49 - Register errors and events that will be used in our contract, required to produce a complete contract schema.
  • L51-L53 - TicketOffice module definition. The module contains a Cep78 token, an Ownable module, and a Mapping that stores information about tickets.
  • L58-L74 - The init function has been generated from the template and there is no need to modify it, except the Ownable module initialization.
  • L76-L94 - The issue_ticket function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an OnTicketIssue event.
  • L103 - The payable attribute indicates that the buy_ticket function can receive funds.
  • L104-L134 - The buy_ticket function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an OnTicketSell event.

Lets test the contract. The test scenario will be as follows:

  1. Deploy the contract.
  2. Issue two tickets.
  3. Try to buy a ticket with insufficient funds.
  4. Buy tickets.
  5. Try to buy the same ticket again.
  6. Check the balance of the contract.
src/tests.rs
use odra::{
casper_types::U512,
host::{Deployer, HostRef},
};

use crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs};

#[test]
fn it_works() {
let env = odra_test::env();
let init_args = TicketOfficeInitArgs {
collection_name: "Ticket".to_string(),
collection_symbol: "T".to_string(),
total_supply: 100,
};
let mut contract = TicketOfficeHostRef::deploy(&env, init_args);
contract.issue_ticket("Ev".to_string(), U512::from(100));
contract.issue_ticket("Ev".to_string(), U512::from(50));

let buyer = env.get_account(1);
env.set_caller(buyer);

assert_eq!(
contract
.with_tokens(U512::from(50))
.try_buy_ticket(0),
Err(Error::InsufficientFunds.into())
);

assert_eq!(
contract
.with_tokens(U512::from(100))
.try_buy_ticket(0),
Ok(())
);
assert_eq!(
contract
.with_tokens(U512::from(50))
.try_buy_ticket(1),
Ok(())
);

assert_eq!(
contract
.with_tokens(U512::from(100))
.try_buy_ticket(0),
Err(Error::TicketNotAvailableForSale.into())
);
}

Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with Cep78Error::InvalidTokenOwner because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of.

odra/modules/src/cep78/token78.rs
pub fn transfer(
&mut self,
token_id: Maybe<u64>,
token_hash: Maybe<String>,
source_key: Address,
target_key: Address
) -> TransferReceipt {
...

if !is_owner && !is_approved && !is_operator {
self.revert(CEP78Error::InvalidTokenOwner);
}

...
}

Let's fix it by redesigning our little system.

Redesign

Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary — an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets.

The sequence diagram below illustrates the new flow:

Ticket Operator Contract

As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the cargo odra generate command.

cargo odra generate -c ticket_operator
src/ticket_operator.rs
use crate::token::{TicketId, TicketOfficeContractRef};
use odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var};

#[odra::odra_error]
pub enum Error {
UnknownTicketOffice = 300,
}

#[odra::module(errors = Error)]
pub struct TicketOperator {
ticket_office_address: Var<Address>,
}

#[odra::module]
impl TicketOperator {
pub fn register(&mut self, ticket_office_address: Address) {
self.ticket_office_address.set(ticket_office_address);
}

// now the operator's `buy_ticket` receives funds.
#[odra(payable)]
pub fn buy_ticket(&mut self, ticket_id: TicketId) {
let env = self.env();
let buyer = env.caller();
let value = env.attached_value();
let center = self
.ticket_office_address
.get()
.unwrap_or_revert_with(&env, Error::UnknownTicketOffice);
let mut ticket_contract = TicketOfficeContractRef::new(env, center);
// now and approved entity - the operator - buys the ticket on behalf of the buyer
ticket_contract.buy_ticket(ticket_id, buyer, value);
}

pub fn balance_of(&self) -> U512 {
self.env().self_balance()
}
}
  • L4-L7 - Define errors that will be used in the contract.
  • L9-L13 - Define the TicketOperator module that stores the address of the ticketing office.
  • L16-L18 - The register function sets the address of the ticketing office.
  • L20-L32 - The buy_ticket function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a TicketOfficeContractRef to interact we the TicketOffice contract. Note that, the operator's buy_ticket now receives funds.

Now we need to adjust the TicketOffice contract to use the TicketOperator contract to buy tickets.

src/token.rs
use odra::Var;

...

#[odra::odra_error]
pub enum Error {
...
MissingOperator = 204,
Unauthorized = 205,
}

#[odra::module]
pub struct TicketOffice {
...
operator: Var<Address>,
}

#[odra::module]
impl TicketOffice {
...

pub fn register_operator(&mut self, operator: Address) {
// only the owner can register an operator
let caller = self.env().caller();
self.ownable.assert_owner(&caller);
// store the ticketing center address in the operator contract
TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address());
self.operator.set(operator);
}

pub fn issue_ticket(&mut self, event_name: String, price: U512) {
// minting logic remains the same...
...

// approve the operator to transfer the ticket
let operator = self.operator();
self.token
.approve(operator, Maybe::Some(ticket_id), Maybe::None);

// emit an event
...
}

pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) {
let env = self.env();
let owner = self.ownable.get_owner();
let caller = env.caller();
// make sure the caller is the operator
if !self.is_operator(caller) {
env.revert(Error::Unauthorized);
}

...
// the logic remains the same, except for the csprs transfer
// it is now handled by the operator contract.
// env.transfer_tokens(&owner, &value);
}

#[inline]
fn is_operator(&self, caller: Address) -> bool {
Some(caller) == self.operator.get()
}

#[inline]
fn operator(&self) -> Address {
self.operator
.get()
.unwrap_or_revert_with(&self.env(), Error::MissingOperator)
}
}
  • L15 - the contract stores the operator address.
  • L22-L29 - a new function register_operator allows the owner to register an operator. Also calls the register entry point on the operator contract.
  • L36-38 - modify the issue_ticket function: once a new token is minted, approves the operator to transfer the ticket later.
  • L44-L57 - modify the buy_ticket function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds.
  • We also added two helper functions: is_operator and operator to check if the caller is the operator and get the operator address. Two new errors were added: MissingOperator and Unauthorized.

Now we need to update our tests to create a scenario we presented in the sequence diagram.

src/tests.rs
use odra::{
casper_types::U512,
host::{Deployer, HostRef, NoArgs},
OdraResult,
};

use crate::{
ticket_operator::TicketOperatorHostRef,
token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs},
};

#[test]
fn it_works() {
let env = odra_test::env();
let init_args = TicketOfficeInitArgs {
collection_name: "Ticket".to_string(),
collection_symbol: "T".to_string(),
total_supply: 100,
};
let operator = TicketOperatorHostRef::deploy(&env, NoArgs);
let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args);
ticket_office.register_operator(operator.address().clone());
ticket_office.issue_ticket("Ev".to_string(), U512::from(100));
ticket_office.issue_ticket("Ev".to_string(), U512::from(50));

let buyer = env.get_account(1);
env.set_caller(buyer);

assert_eq!(
buy_ticket(&operator, 0, 50),
Err(Error::InsufficientFunds.into())
);
assert_eq!(buy_ticket(&operator, 0, 100), Ok(()));
assert_eq!(buy_ticket(&operator, 1, 50), Ok(()));
assert_eq!(
buy_ticket(&operator, 0, 100),
Err(Error::TicketNotAvailableForSale.into())
);

assert_eq!(operator.balance_of(), U512::from(150));
}

fn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> {
operator.with_tokens(U512::from(price)).try_buy_ticket(id)
}

Conclusion

In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls.

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/odra-solidity/index.html b/docs/docs/tutorials/odra-solidity/index.html new file mode 100644 index 000000000..da8b51acd --- /dev/null +++ b/docs/docs/tutorials/odra-solidity/index.html @@ -0,0 +1,18 @@ + + + + + +Odra for Solidity developers | Odra + + + + + +
+
Version: 1.0.0

Odra for Solidity developers

Introduction

Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers.

Prerequisites

To follow this guide, you should have:

  • Knowledge of Solidity.
  • Familiarity with Ethereum and smart contract concepts.
  • Basic understanding of Rust, as Odra is based on it.

Hello World

Let's start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message.

use odra::{prelude::*, Var};

#[odra::module]
pub struct HelloWorld {
greet: Var<String>,
}

#[odra::module]
impl HelloWorld {
pub fn init(&mut self, message: String) {
self.greet.set(message);
}

pub fn get(&self) -> String {
self.greet.get_or_default()
}
}

As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the odra::module attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the HelloWorld struct has a single state variable greet, which stores the greeting message. The module contains two functions: init to set the greeting message and get to retrieve it. +Two key differences are:

  1. Odra does not generate getters for public state variables automatically, so you need to define them explicitly.
  2. To initialize values, you must do it in the init function, which is the contract constructor. You can't assign defaults outside the constructor.

Variable Storage and State Management

Data Types

use core::str::FromStr;
use odra::{
casper_types::{bytesrepr::Bytes, U256},
module::Module,
prelude::*,
Address, UnwrapOrRevert, Var,
};

#[odra::module]
pub struct Primitives {
boo: Var<bool>,
u: Var<u8>, // u8 is the smallest unsigned integer type
u2: Var<U256>, // U256 is the biggest unsigned integer type
i: Var<i32>, // i32 is the smallest signed integer type
i2: Var<i64>, // i64 is the biggest signed integer type
address: Var<Address>,
bytes: Var<Bytes>,
default_boo: Var<bool>,
default_uint: Var<U256>,
default_int: Var<i64>,
default_addr: Var<Address>,
}

#[odra::module]
impl Primitives {
pub fn init(&mut self) {
self.boo.set(true);
self.u.set(1);
self.u2.set(U256::from(456));
self.i.set(-1);
self.i2.set(456);
self.address.set(
Address::from_str(
"hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb",
)
.unwrap_or_revert(&self.env()),
);
self.bytes.set(Bytes::from(vec![0xb5]));

let _min_int = U256::zero();
let _max_int = U256::MAX;
}

// For the types that have default values, we can use the get_or_default method
pub fn get_default_boo(&self) -> bool {
self.default_boo.get_or_default()
}

pub fn get_default_uint(&self) -> U256 {
self.default_uint.get_or_default()
}

pub fn get_default_int(&self) -> i64 {
self.default_int.get_or_default()
}

// Does not compile - Address does not have the default value
pub fn get_default_addr(&self) -> Address {
self.default_addr.get_or_default()
}
}

The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: u8, u16, u32, u64, U128, and U256 for unsigned integers, and i32 and i64 for signed integers.

The Address type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the Address type; the workaround is to use Option<Address>.

The Bytes type is used to store byte arrays.

Values are stored in units called Named Keys and Dictionaries. Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point.

Constants and Immutability

use odra::{casper_types::{account::AccountHash, U256}, Address};

#[odra::module]
pub struct Constants;

#[odra::module]
impl Constants {
pub const MY_UINT: U256 = U256([123, 0, 0, 0]);
pub const MY_ADDRESS: Address = Address::Account(
AccountHash([0u8; 32])
);
}

In Odra, you can define constants using the const keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the immutable keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's immutable keyword.

Variables

use odra::{casper_types::U256, prelude::*, Var};

#[odra::module]
pub struct Variables {
text: Var<String>,
my_uint: Var<U256>,
}

#[odra::module]
impl Variables {
pub fn init(&mut self) {
self.text.set("Hello".to_string());
self.my_uint.set(U256::from(123));
}

pub fn do_something(&self) {
// Local variables
let i = 456;
// Env variables
let timestamp = self.env().get_block_time();
let sender = self.env().caller();
}
}

In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ContractEnv retrieved using the env() function.

Arrays and Mappings

use odra::{casper_types::U256, Address, Mapping};

#[odra::module]
pub struct MappingContract {
my_map: Mapping<Address, Option<U256>>
}

#[odra::module]
impl MappingContract {
pub fn get(&self, addr: Address) -> U256 {
// self.my_map.get(&addr) would return Option<Option<U256>>
// so we use get_or_default instead and unwrap the inner Option
self.my_map.get_or_default(&addr).unwrap_or_default()
}

pub fn set(&mut self, addr: Address, i: U256) {
self.my_map.set(&addr, Some(i));
}

pub fn remove(&mut self, addr: Address) {
self.my_map.set(&addr, None);
}
}

#[odra::module]
pub struct NestedMapping {
my_map: Mapping<(Address, U256), Option<bool>>
}

#[odra::module]
impl NestedMapping {
pub fn get(&self, addr: Address, i: U256) -> bool {
self.my_map.get_or_default(&(addr, i)).unwrap_or_default()
}

pub fn set(&mut self, addr: Address, i: U256, boo: bool) {
self.my_map.set(&(addr, i), Some(boo));
}

pub fn remove(&mut self, addr: Address, i: U256) {
self.my_map.set(&(addr, i), None);
}
}
use odra::{prelude::*, Var};

#[odra::module]
pub struct Array {
// the size of the array must be known at compile time
arr: Var<[u8; 10]>,
vec: Var<Vec<u32>>,
}

#[odra::module]
impl Array {
pub fn init(&mut self) {
self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
self.vec.set(vec![1, 2, 3, 4, 5]);
}

pub fn get_arr(&self) -> [u8; 10] {
self.arr.get_or_default()
}

pub fn push_vec(&mut self, value: u32) {
let mut vec = self.vec.get_or_default();
vec.push(value);
self.vec.set(vec);
}

pub fn pop_vec(&mut self) {
let mut vec = self.vec.get_or_default();
vec.pop();
self.vec.set(vec);
}

pub fn update_arr(&mut self, index: u8, value: u8) {
let mut arr = self.arr.get_or_default();
arr[index as usize] = value;
self.arr.set(arr);
}
}

For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the Var container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a Mapping or List instead of an array or vector to store data.

Custom types

use odra::{prelude::*, Var};

#[odra::odra_type]
#[derive(Default)]
pub enum Status {
#[default]
Pending,
Shipped,
Accepted,
Rejected,
Canceled,
}

#[odra::module]
pub struct Enum {
status: Var<Status>,
}

#[odra::module]
impl Enum {
pub fn get(&self) -> Status {
self.status.get_or_default()
}

pub fn set(&mut self, status: Status) {
self.status.set(status);
}

pub fn cancel(&mut self) {
self.status.set(Status::Canceled);
}

pub fn reset(&mut self) {
self.status.set(Default::default());
}
}

In Odra, custom types are defined using the #[odra::odra_type] attribute. The enum can have a default value specified using the #[default] attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the Default::default() function.

use odra::{prelude::*, List};

#[odra::odra_type]
pub struct Todo {
text: String,
completed: bool,
}

#[odra::module]
pub struct Enum {
// You could also use Var<Vec<Todo>> instead of List<Todo>,
// but List is more efficient for large arrays,
// it loads items lazily.
todos: List<Todo>,
}

#[odra::module]
impl Enum {
pub fn create(&mut self, text: String) {
self.todos.push(Todo {
text,
completed: false,
});
}

pub fn update_text(&mut self, index: u32, text: String) {
if let Some(mut todo) = self.todos.get(index) {
todo.text = text;
self.todos.replace(index, todo);
}
}

pub fn toggle_complete(&mut self, index: u32) {
if let Some(mut todo) = self.todos.get(index) {
todo.completed = !todo.completed;
self.todos.replace(index, todo);
}
}

// Odra does not create getters by default
pub fn get(&self, index: u32) -> Option<Todo> {
self.todos.get(index)
}
}

Similarly to enums, custom structs are defined using the #[odra::odra_type] attribute. The struct can be used to define a list of items in a contract. The list can be created using the List type, which is more efficient for large arrays as it loads items lazily.

Data Location

In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be memory, storage, or calldata. In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., Var, Mapping, List), the data is stored in the contract's storage.

Functions

Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function:

impl Erc20 {
pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.internal_transfer(&self.env().caller(), recipient, amount);
// Transfer logic goes here
}

fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) {
// Internal transfer logic goes here
}
}

Functions can modify contract state and emit events using the ContractEnv function.

View and Pure

use odra::Var;

#[odra::module]
pub struct ViewAndPure {
x: Var<u32>
}

#[odra::module]
impl ViewAndPure {
pub fn add_to_x(&self, y: u32) -> u32 {
self.x.get_or_default() + y
}
}

pub fn add(i: u32, j: u32) -> u32 {
i + j
}

In Odra, you don't need to specify view or pure functions explicitly. All functions are considered view functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be &mut self. If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects.

Modifiers

use odra::Var;

#[odra::module]
pub struct FunctionModifier {
x: Var<u32>,
locked: Var<bool>,
}

#[odra::module]
impl FunctionModifier {
pub fn decrement(&mut self, i: u32) -> u32 {
self.lock();
self.x.set(self.x.get_or_default() - i);

if i > 1 {
self.decrement(i - 1);
}
self.unlock();
}

#[inline]
fn lock(&mut self) {
if self.locked.get_or_default() {
self.env().revert("No reentrancy");
}

self.locked.set(true);
}

#[inline]
fn unlock(&mut self) {
self.locked.set(false);
}
}

In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the lock and unlock functions are called before and after the decrement function, respectively, but they must be called explicitly.

As often as practicable, developers should inline functions by including the body of the function within their code using the #[inline] attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances.

Visibility

Functions and state variables have to declare whether they are accessible by other contracts.

Functions can be declared as:

`pub` inside `#[odra::module]` impl block - any contract/submodule and account can call.
`pub` inside a regular impl block - any submodule can call.
`default/no modifier/private` - only inside the contract that defines the function.

Payable

use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var};

#[odra::module]
pub struct Payable {
owner: Var<Address>,
}

#[odra::module]
impl Payable {
pub fn init(&mut self) {
self.owner.set(self.env().caller());
}

#[odra(payable)]
pub fn deposit(&self) {
}

pub fn not_payable(&self) {
}

pub fn withdraw(&self) {
let amount = self.env().self_balance();
self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount);
}

pub fn transfer(&self, to: Address, amount: U512) {
self.env().transfer_tokens(&to, &amount);
}
}

In Odra, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether.

Selectors

In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector.

contract_addr.call(
abi.encodeWithSignature("transfer(address,uint256)", address, 1234)
)

Odra does not support such a mechanism. You must have access to the contract interface to call a function.

Events and Logging

use odra::{prelude::*, Address};

#[odra::event]
pub struct Log {
sender: Address,
message: String,
}

#[odra::event]
pub struct AnotherLog {}

#[odra::module]
struct Event;

#[odra::module]
impl Event {
pub fn test(&self) {
let env = self.env();
env.emit_event(Log {
sender: env.caller(),
message: "Hello World!".to_string(),
});
env.emit_event(Log {
sender: env.caller(),
message: "Hello Casper!".to_string(),
});
env.emit_event(AnotherLog {});
}
}

In Odra, events are regular structs defined using the #[odra::event] attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's emit_event() function, passing the event struct as an argument.

note

Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the Basics section.

Error Handling

use odra::{prelude::*, casper_types::{U256, U512}};

#[odra::odra_error]
pub enum CustomError {
InsufficientBalance = 1,
InputLowerThanTen = 2,
}

#[odra::module]
pub struct Error;

#[odra::module]
impl Error {
pub fn test_require(&mut self, i: U256) {
if i <= 10.into() {
self.env().revert(CustomError::InputLowerThanTen);
}
}

pub fn execute_external_call(&self, withdraw_amount: U512) {
let balance = self.env().self_balance();
if balance < withdraw_amount {
self.env().revert(CustomError::InsufficientBalance);
}
}
}

In Solidity, there are four ways to handle errors: require, revert, assert, and custom errors. In Odra, there is only one way to revert the execution of a function - by using the env().revert() function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the #[odra::odra_error] attribute. On Casper, an error is only a number, so you can't pass a message with the error.

Composition vs. Inheritance

In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another.

Let's take a look at the difference between inheritance in Solidity and composition in Odra.

use odra::{prelude::*, SubModule};

#[odra::module]
pub struct A;

#[odra::module]
impl A {
pub fn foo(&self) -> String {
"A".to_string()
}
}

#[odra::module]
pub struct B {
a: SubModule<A>
}

#[odra::module]
impl B {
pub fn foo(&self) -> String {
"B".to_string()
}
}

#[odra::module]
pub struct C {
a: SubModule<A>
}

#[odra::module]
impl C {
pub fn foo(&self) -> String {
"C".to_string()
}
}

#[odra::module]
pub struct D {
b: SubModule<B>,
c: SubModule<C>
}

#[odra::module]
impl D {
pub fn foo(&self) -> String {
self.c.foo()
}
}

#[odra::module]
pub struct E {
b: SubModule<B>,
c: SubModule<C>
}

#[odra::module]
impl E {
pub fn foo(&self) -> String {
self.b.foo()
}
}

#[odra::module]
pub struct F {
a: SubModule<A>,
b: SubModule<B>,
}

#[odra::module]
impl F {
pub fn foo(&self) -> String {
self.a.foo()
}
}

Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers.

In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts.

Libraries and Utility

use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var};

mod math {
use odra::casper_types::U256;

pub fn sqrt(y: U256) -> U256 {
let mut z = y;
if y > 3.into() {
let mut x = y / 2 + 1;
while x < z {
z = x;
x = (y / x + x) / 2;
}
} else if y != U256::zero() {
z = U256::one();
}
z
}
}

#[odra::module]
struct TestMath;

#[odra::module]
impl TestMath {
pub fn test_square_root(&self, x: U256) -> U256 {
math::sqrt(x)
}
}

#[odra::odra_error]
enum Error {
EmptyArray = 100,
}

trait Removable {
fn remove(&mut self, index: usize);
}

impl Removable for Var<Vec<U256>> {
fn remove(&mut self, index: usize) {
let env = self.env();
let mut vec = self.get_or_default();
if vec.is_empty() {
env.revert(Error::EmptyArray);
}
vec[index] = vec.pop().unwrap_or_revert(&env);
self.set(vec);
}
}

#[odra::module]
struct TestArray {
arr: Var<Vec<U256>>,
}

#[odra::module]
impl TestArray {
pub fn test_array_remove(&mut self) {
let mut arr = self.arr.get_or_default();
for i in 0..3 {
arr.push(i.into());
}
self.arr.set(arr);

self.arr.remove(1);

let arr = self.arr.get_or_default();
assert_eq!(arr.len(), 2);
assert_eq!(arr[0], 0.into());
assert_eq!(arr[1], 2.into());
}
}

In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the Math library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the TestMath contract calls the sqrt function directly, while the TestArray contract uses the using keyword, which extends the type uint256[] by adding the remove function.

In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the Removable trait for the Var<Vec<U256>> type allows the remove function to be called on a variable that stores a vector of U256 values.

Fallback and Receive Functions

In Solidity, a contract receiving Ether must implement a receive() and/or fallback() function. The receive() function is called when Ether is sent to the contract with no data, while the fallback() function is called when the contract receives Ether with data or when a function that does not exist is called.

Odra does not have a direct equivalent to the receive() and fallback() functions. Instead, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs.

Miscellaneous

Hashing

use odra::{
casper_types::{bytesrepr::ToBytes, U256},
prelude::*,
Address, UnwrapOrRevert, Var,
};

#[odra::module]
pub struct HashFunction;

#[odra::module]
impl HashFunction {
pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] {
let env = self.env();
let mut data = Vec::new();
data.extend(text.to_bytes().unwrap_or_revert(&env));
data.extend(num.to_bytes().unwrap_or_revert(&env));
data.extend(addr.to_bytes().unwrap_or_revert(&env));
env.hash(data)
}
}

#[odra::module]
pub struct GuessTheMagicWord {
answer: Var<[u8; 32]>,
}

#[odra::module]
impl GuessTheMagicWord {
/// Initializes the contract with the magic word hash.
pub fn init(&mut self) {
self.answer.set([
0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84,
0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55,
0xbe, 0xd7, 0x56, 0x08,
]);
}

/// Checks if the `word` is the magic word.
pub fn guess(&self, word: String) -> bool {
let env = self.env();
let hash = env.hash(word.to_bytes().unwrap_or_revert(&env));
hash == self.answer.get_or_default()
}
}

The key difference between the two is that in Solidity, the keccak256 function is used to hash data, while in Odra, the env.hash() function is used, which implements the blake2b algorithm. Both functions take a byte array as input and return a 32-byte hash.

Try-catch

use odra::{module::Module, Address, ContractRef, Var};

#[odra::module]
pub struct Example {
other_contract: Var<Address>,
}

#[odra::module]
impl Example {
pub fn init(&mut self, other_contract: Address) {
self.other_contract.set(other_contract);
}

pub fn execute_external_call(&self) {
if let Some(addr) = self.other_contract.get() {
let result = OtherContractContractRef::new(self.env(), addr).some_function();
match result {
Ok(success) => {
// Code to execute if the external call was successful
}
Err(reason) => {
// Code to execute if the external call failed
}
}
}
}
}

#[odra::module]
pub struct OtherContract;

#[odra::module]
impl OtherContract {
pub fn some_function(&self) -> Result<bool, ()> {
Ok(true)
}
}

In Solidity, try/catch is a feature that allows developers to handle exceptions and errors more gracefully. The try/catch statement allows developers to catch and handle exceptions that occur during external function calls and contract creation.

In Odra, there is no direct equivalent to the try/catch statement in Solidity. However, you can use the Result type to handle errors in a similar way. The Result type is an enum that represents either success (Ok) or failure (Err). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts.

Conclusion

Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development.

Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework.

Read more about the Odra Framework in the Basics and Advanced sections.

Learn by example with our Tutorial series, you will find there a contract you likely familiar with - the Erc20 standard implementation.

If you have any further questions or need clarification on specific topics, feel free to join our Discord!

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/ownable/index.html b/docs/docs/tutorials/ownable/index.html new file mode 100644 index 000000000..9995462e1 --- /dev/null +++ b/docs/docs/tutorials/ownable/index.html @@ -0,0 +1,17 @@ + + + + + +Ownable | Odra + + + + + +
+
Version: 1.0.0

Ownable

In this tutorial, we will write a simple module that allows us to set its owner. Later, it can be reused to limit access to the contract's critical features.

Framework features

A module we will write in a minute, will help you master a few Odra features:

  • storing a single value,
  • defining a constructor,
  • error handling,
  • defining and emitting events.
  • registering a contact in a test environment,
  • interactions with the test environment,
  • assertions (value, events, errors assertions).

Code

Before we write any code, we define functionalities we would like to implement.

  1. Module has an initializer that should be called once.
  2. Only the current owner can set a new owner.
  3. Read the current owner.
  4. A function that fails if called by a non-owner account.

Define a module

ownable.rs
use odra::prelude::*;
use odra::{Address, Var};

#[odra::module(events = [OwnershipChanged])]
pub struct Ownable {
owner: Var<Option<Address>>
}

That was easy, but it is crucial to understand the basics before we move on.

  • L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.
  • L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var.

Init the module

ownable.rs
#[odra::module]
impl Ownable {
pub fn init(&mut self, owner: Address) {
if self.owner.get_or_default().is_some() {
self.env().revert(Error::OwnerIsAlreadyInitialized)
}

self.owner.set(Some(owner));

self.env().emit_event(OwnershipChanged {
prev_owner: None,
new_owner: owner
});
}
}

#[odra::odra_error]
pub enum Error {
OwnerIsAlreadyInitialized = 1,
}

#[odra::event]
pub struct OwnershipChanged {
pub prev_owner: Option<Address>,
pub new_owner: Address
}

Ok, we have done a couple of things, let's analyze them one by one:

  • L1 - The impl should be an Odra module, so add #[odra::module].
  • L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.
  • L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.
  • L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument.
  • L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.
  • L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.
  • L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None.

Features implementation

ownable.rs
#[odra::module]
impl Ownable {
...

pub fn ensure_ownership(&self, address: &Address) {
if Some(address) != self.owner.get_or_default().as_ref() {
self.env().revert(Error::NotOwner)
}
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ensure_ownership(&self.env().caller());
let current_owner = self.get_owner();
self.owner.set(Some(*new_owner));
self.env().emit_event(OwnershipChanged {
prev_owner: Some(current_owner),
new_owner: *new_owner
});
}

pub fn get_owner(&self) -> Address {
match self.owner.get_or_default() {
Some(owner) => owner,
None => self.env().revert(Error::OwnerIsNotInitialized)
}
}
}

#[odra::odra_error]
pub enum Error {
NotOwner = 1,
OwnerIsAlreadyInitialized = 2,
OwnerIsNotInitialized = 3,
}

The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along.

  • L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.
  • L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.
  • L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead.

Test

ownable.rs
#[cfg(test)]
mod tests {
use super::*;
use odra::host::{Deployer, HostEnv, HostRef};

fn setup() -> (OwnableHostRef, HostEnv, Address) {
let env: HostEnv = odra_test::env();
let init_args = OwnableInitArgs {
owner: env.get_account(0)
};
(OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0))
}

#[test]
fn initialization_works() {
let (ownable, env, owner) = setup();
assert_eq!(ownable.get_owner(), owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: None,
new_owner: owner
}
);
}

#[test]
fn owner_can_change_ownership() {
let (mut ownable, env, owner) = setup();
let new_owner = env.get_account(1);

env.set_caller(owner);
ownable.change_ownership(&new_owner);
assert_eq!(ownable.get_owner(), new_owner);

env.emitted_event(
ownable.address(),
&OwnershipChanged {
prev_owner: Some(owner),
new_owner
}
);
}

#[test]
fn non_owner_cannot_change_ownership() {
let (mut ownable, env, _) = setup();
let new_owner = env.get_account(1);
ownable.change_ownership(&new_owner);

assert_eq!(
ownable.try_change_ownership(&new_owner),
Err(Error::NotOwner.into())
);
}
}
  • L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.
  • L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one).
  • L14 - It is time to define the first test. As you see, it is a regular Rust test.
  • L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract.
    note

    You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract.

  • L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.
  • L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.
  • L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function.
    note

    The caller switch applies only the next contract interaction, the second call will be done as the default account.

  • L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type.

Summary

The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract.

What's next

In the next tutorial we will implement a ERC20 standard.

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/owned-token/index.html b/docs/docs/tutorials/owned-token/index.html new file mode 100644 index 000000000..1917740c4 --- /dev/null +++ b/docs/docs/tutorials/owned-token/index.html @@ -0,0 +1,17 @@ + + + + + +OwnedToken | Odra + + + + + +
+
Version: 1.0.0

OwnedToken

This tutorial shows the great power of the modularization-focused design of the Odra Framework. We are going to use the modules we built in the last two tutorials to build a new one.

Code

What should our module be capable of?

  1. Conform the Erc20 interface.
  2. Allow only the module owner to mint tokens.
  3. Enable the current owner to designate a new owner.

Module definition

Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules.

owned_token.rs
use crate::{erc20::Erc20, ownable::Ownable};
use odra::prelude::*;
use odra::module::SubModule;

#[odra::module]
pub struct OwnedToken {
ownable: SubModule<Ownable>,
erc20: SubModule<Erc20>
}

As you can see, we do not need any storage definition - we just take advantage of the already-defined modules!

Delegation

owned_token.rs
...
use odra::{Address, casper_types::U256};
...

#[odra::module]
impl OwnedToken {
pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) {
let deployer = self.env().caller();
self.ownable.init(deployer);
self.erc20.init(name, symbol, decimals, initial_supply);
}

pub fn name(&self) -> String {
self.erc20.name()
}

pub fn symbol(&self) -> String {
self.erc20.symbol()
}

pub fn decimals(&self) -> u8 {
self.erc20.decimals()
}

pub fn total_supply(&self) -> U256 {
self.erc20.total_supply()
}

pub fn balance_of(&self, address: &Address) -> U256 {
self.erc20.balance_of(address)
}

pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 {
self.erc20.allowance(owner, spender)
}

pub fn transfer(&mut self, recipient: &Address, amount: &U256) {
self.erc20.transfer(recipient, amount);
}

pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) {
self.erc20.transfer_from(owner, recipient, amount);
}

pub fn approve(&mut self, spender: &Address, amount: &U256) {
self.erc20.approve(spender, amount);
}

pub fn get_owner(&self) -> Address {
self.ownable.get_owner()
}

pub fn change_ownership(&mut self, new_owner: &Address) {
self.ownable.change_ownership(new_owner);
}

pub fn mint(&mut self, address: &Address, amount: &U256) {
self.ownable.ensure_ownership(&self.env().caller());
self.erc20.mint(address, amount);
}
}

Easy. However, there are a few worth mentioning subtleness:

  • L9-L10 - A constructor is an excellent place to initialize both modules at once.
  • L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.
  • L49-L51 - The same is done with the ownable module.
  • L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner.

Summary

The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that.

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/pauseable/index.html b/docs/docs/tutorials/pauseable/index.html new file mode 100644 index 000000000..bab716040 --- /dev/null +++ b/docs/docs/tutorials/pauseable/index.html @@ -0,0 +1,17 @@ + + + + + +Pausable | Odra + + + + + +
+
Version: 1.0.0

Pausable

The Pausable module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently.

Code

As always, we will start with defining functionalities of our module.

  1. Check the state - is it paused or not.
  2. State guards - a contract should stop execution if is in a state we don't expect.
  3. Switch the state.

Events and Error

There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way.

Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser.

pauseable.rs
use odra::prelude::*;
use odra::Address;

#[odra::odra_error]
pub enum Error {
PausedRequired = 1_000,
UnpausedRequired = 1_001,
}

#[odra::event]
pub struct Paused {
pub account: Address
}

#[odra::event]
pub struct Unpaused {
pub account: Address
}

Module definition

The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused.

pauseable.rs
use odra::Var;
...

#[odra::module(events = [Paused, Unpaused])]
pub struct Pausable {
is_paused: Var<bool>
}

Checks and guards

Now, let's move to state checks and guards.

pauseable.rs
impl Pausable {
pub fn is_paused(&self) -> bool {
self.is_paused.get_or_default()
}

pub fn require_not_paused(&self) {
if self.is_paused() {
self.env().revert(Error::UnpausedRequired);
}
}

pub fn require_paused(&self) {
if !self.is_paused() {
self.env().revert(Error::PausedRequired);
}
}
}
  • L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.
  • L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.
  • L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused.
  • L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused.

Actions

Finally, we will add the ability to switch the module state.

pauseable.rs
impl Pausable {
pub fn pause(&mut self) {
self.require_not_paused();
self.is_paused.set(true);

self.env().emit_event(Paused {
account: self.env().caller()
});
}

pub fn unpause(&mut self) {
self.require_paused();
self.is_paused.set(false);

self.env().emit_event(Unpaused {
account: self.env().caller()
});
}
}

pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused).

Pausable counter

In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused).

pauseable.rs
...
use odra::SubModule;
...

#[odra::module]
pub struct PausableCounter {
value: Var<u32>,
pauseable: SubModule<Pausable>
}

#[odra::module]
impl PausableCounter {
pub fn increment(&mut self) {
self.pauseable.require_not_paused();

let new_value = self.value.get_or_default() + 1;
self.value.set(new_value);
}

pub fn pause(&mut self) {
self.pauseable.pause();
}

pub fn unpause(&mut self) {
self.pauseable.unpause();
}

pub fn get_value(&self) -> u32 {
self.value.get_or_default()
}
}

#[cfg(test)]
mod test {
use super::*;
use odra::host::{Deployer, NoArgs};

#[test]
fn increment_only_if_unpaused() {
let test_env = odra_test::env();
let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs);
contract.increment();
contract.pause();

assert_eq!(
contract.try_increment().unwrap_err(),
Error::UnpausedRequired.into()
);
assert_eq!(contract.get_value(), 1);
}
}

As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy!

+ + + + \ No newline at end of file diff --git a/docs/docs/tutorials/using-proxy-caller/index.html b/docs/docs/tutorials/using-proxy-caller/index.html new file mode 100644 index 000000000..94e3e36e9 --- /dev/null +++ b/docs/docs/tutorials/using-proxy-caller/index.html @@ -0,0 +1,18 @@ + + + + + +Using Proxy Caller | Odra + + + + + +
+
Version: 1.0.0

Using Proxy Caller

In this tutorial, we will learn how to use the proxy_caller wasm to call an Odra payable function. The proxy_caller is a session code that top-ups the cargo_purse passes it as an argument and then calls the contract. This is useful when you want to call a payable function attaching some CSPRs to the call.

Read more about the proxy_caller here.

Contract

For this tutorial, we will use the TimeLockWallet contract from our examples.

examples/src/contracts/tlw.rs
use odra::prelude::*;
use odra::{casper_types::U512, Address, Mapping, Var};

#[odra::module(errors = Error, events = [Deposit, Withdrawal])]
pub struct TimeLockWallet {
balances: Mapping<Address, U512>,
lock_expiration_map: Mapping<Address, u64>,
lock_duration: Var<u64>
}

#[odra::module]
impl TimeLockWallet {
/// Initializes the contract with the lock duration.
pub fn init(&mut self, lock_duration: u64) {
self.lock_duration.set(lock_duration);
}

/// Deposits the tokens into the contract.
#[odra(payable)]
pub fn deposit(&mut self) {
// Extract values
let caller: Address = self.env().caller();
let amount: U512 = self.env().attached_value();
let current_block_time: u64 = self.env().get_block_time();

// Multiple lock check
if self.balances.get(&caller).is_some() {
self.env().revert(Error::CannotLockTwice)
}

// Update state, emit event
self.balances.set(&caller, amount);
self.lock_expiration_map
.set(&caller, current_block_time + self.lock_duration());
self.env().emit_event(Deposit {
address: caller,
amount
});
}

/// Withdraws the tokens from the contract.
pub fn withdraw(&mut self, amount: &U512) {
// code omitted for brevity
}

/// Returns the balance of the given account.
pub fn get_balance(&self, address: &Address) -> U512 {
// code omitted for brevity
}

/// Returns the lock duration.
pub fn lock_duration(&self) -> u64 {
// code omitted for brevity
}
}

/// Errors that may occur during the contract execution.
#[odra::odra_error]
pub enum Error {
LockIsNotOver = 1,
CannotLockTwice = 2,
InsufficientBalance = 3
}

/// Deposit event.
#[odra::event]
pub struct Deposit {
pub address: Address,
pub amount: U512
}

/// Withdrawal event.
#[odra::event]
pub struct Withdrawal {
pub address: Address,
pub amount: U512
}

Full code can be found here.

Client

Before we can interact with the node, we need to set it up. We will use the casper-nctl-docker image.

docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl

Make sure you have the contract's wasm file and the secret key.

# Build the contract
cargo odra build -c TimeLockWallet
# Extract secret key
docker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem

To interact with the contract, we use the livenet backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case).

Cargo.toml
[package]
name = "odra-examples"
version = "1.0.0"
edition = "2021"

[dependencies]
odra = { path = "../odra", default-features = false }
... # other dependencies
odra-casper-livenet-env = { version = "1.0.0", optional = true }

... # other sections

[features]
default = []
livenet = ["odra-casper-livenet-env"]

... # other sections

[[bin]]
name = "tlw_on_livenet"
path = "bin/tlw_on_livenet.rs"
required-features = ["livenet"]
test = false

... # other sections
examples/bin/tlw_on_livenet.rs
//! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs.
use odra::casper_types::{AsymmetricType, PublicKey, U512};
use odra::host::{Deployer, HostRef};
use odra::Address;
use odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs};

const DEPOSIT: u64 = 100;
const WITHDRAWAL: u64 = 99;
const GAS: u64 = 20u64.pow(9);

fn main() {
let env = odra_casper_livenet_env::env();
let caller = env.get_account(0);

env.set_caller(caller);
env.set_gas(GAS);

let mut contract = TimeLockWalletHostRef::deploy(
&env,
TimeLockWalletInitArgs { lock_duration: 60 * 60 }
);
// Send 100 CSPRs to the contract.
contract
.with_tokens(U512::from(DEPOSIT))
.deposit();

println!("Caller's balance: {:?}", contract.get_balance(&caller));
// Withdraw 99 CSPRs from the contract.
contract.withdraw(&U512::from(WITHDRAWAL));
println!("Remaining balance: {:?}", contract.get_balance(&caller));
}

To run the code, execute the following command:

ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \
ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \
ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \
cargo run --bin tlw_on_livenet --features=livenet
# Sample output
💁 INFO : Deploying "TimeLockWallet".
💁 INFO : Found wasm under "wasm/TimeLockWallet.wasm".
🙄 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558".
💁 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed.
💁 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed.
💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy.
🙄 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3".
💁 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed.
Caller's balance: 100
💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw".
🙄 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e".
💁 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed.
Remaining balance: 1

As observed, the contract was successfully deployed, and the Caller deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR. +The logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity.

Conclusion

In this tutorial, we learned how to use the proxy_caller wasm to make a payable function call. We deployed the TimeLockWallet contract, deposited tokens using the proxy_caller with attached CSPRs, and withdrew them. You got to try it out in both Rust and TypeScript, so you can choose whichever you prefer. Rust code seemed simpler, thanks to the Odra livenet backend making chain interactions easier to handle.

+ + + + \ No newline at end of file diff --git a/docs/iAWriterMonoS-Regular.ttf b/docs/iAWriterMonoS-Regular.ttf new file mode 100644 index 000000000..1308a4c30 Binary files /dev/null and b/docs/iAWriterMonoS-Regular.ttf differ diff --git a/docs/img/docusaurus.png b/docs/img/docusaurus.png new file mode 100644 index 000000000..f458149e3 Binary files /dev/null and b/docs/img/docusaurus.png differ diff --git a/docs/img/favicon.ico b/docs/img/favicon.ico new file mode 100644 index 000000000..41512b62c Binary files /dev/null and b/docs/img/favicon.ico differ diff --git a/docs/img/favicon_old.ico b/docs/img/favicon_old.ico new file mode 100644 index 000000000..f13ae05e9 Binary files /dev/null and b/docs/img/favicon_old.ico differ diff --git a/docs/img/logo.svg b/docs/img/logo.svg new file mode 100644 index 000000000..9db6d0d06 --- /dev/null +++ b/docs/img/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/img/odra-sol.png b/docs/img/odra-sol.png new file mode 100644 index 000000000..caf92bf53 Binary files /dev/null and b/docs/img/odra-sol.png differ diff --git a/docs/img/small_logo_dark.png b/docs/img/small_logo_dark.png new file mode 100644 index 000000000..9246a0266 Binary files /dev/null and b/docs/img/small_logo_dark.png differ diff --git a/docs/img/small_logo_light.png b/docs/img/small_logo_light.png new file mode 100644 index 000000000..30509f903 Binary files /dev/null and b/docs/img/small_logo_light.png differ diff --git a/docs/img/small_logo_old.png b/docs/img/small_logo_old.png new file mode 100644 index 000000000..6820058ba Binary files /dev/null and b/docs/img/small_logo_old.png differ diff --git a/docs/img/undraw_docusaurus_mountain.svg b/docs/img/undraw_docusaurus_mountain.svg new file mode 100644 index 000000000..af961c49a --- /dev/null +++ b/docs/img/undraw_docusaurus_mountain.svg @@ -0,0 +1,171 @@ + + Easy to Use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/img/undraw_docusaurus_react.svg b/docs/img/undraw_docusaurus_react.svg new file mode 100644 index 000000000..94b5cf08f --- /dev/null +++ b/docs/img/undraw_docusaurus_react.svg @@ -0,0 +1,170 @@ + + Powered by React + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/img/undraw_docusaurus_tree.svg b/docs/img/undraw_docusaurus_tree.svg new file mode 100644 index 000000000..d9161d339 --- /dev/null +++ b/docs/img/undraw_docusaurus_tree.svg @@ -0,0 +1,40 @@ + + Focus on What Matters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000..ddeea1b64 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,308 @@ + + + + + + + Odra Project + + + + + + + + + + + + + +
+ + +
+

PROJECTS

+
+
+ +

Odra Framework

+
+
+ High-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design. +
+
+ +
+ +

MVPR DAO

+
+
+ Reusable smart contracts for building DAOs on top of Casper. +
+
+ +
+ +

Awesome Zero Knowledge

+
+
+ Curated list of Zero Knowledge links, mostly focusing on blockchain. +
+
+ +
+ +

ZK Newsletter

+
+
+ Weekly summary of the most important things, which happened in Zero Knowledge world. +
+
+
+ +

MISSION

+
+
+ We bring cutting-edge smart contract development tools to professionals with deadlines. +
+
+
+ Our code is free and open source. +
+
+ +

INFO

+
+
+ See our code on Github
. +
+
+ Read more on our Blog
. +
+
+ Follow us on Twitter
. +
+
+ Join our Discord
. +
+
+ Write us at contact@odra.dev. +
+
+
+
+ + + + diff --git a/docs/lunr-index-1718616732280.json b/docs/lunr-index-1718616732280.json new file mode 100644 index 000000000..90405c599 --- /dev/null +++ b/docs/lunr-index-1718616732280.json @@ -0,0 +1 @@ +{"version":"2.3.9","fields":["title","content","keywords"],"fieldVectors":[["title/0",[0,674.112,1,674.112]],["content/0",[]],["keywords/0",[]],["title/1",[1,555.478,2,812.614,3,98.292]],["content/1",[1,5.74,3,1.741,4,6.584,5,4.507,6,9.133,7,4.22,8,4.974,9,10.211,10,9.368,11,6.013,12,4.027,13,10.211,14,8.397,15,6.252,16,5.973,17,6.527,18,1.799,19,8.244,20,4.28,21,10.211,22,2.983,23,10.211,24,6.998,25,7.164,26,10.211,27,7.955,28,12.816,29,4.987,30,13.624,31,7.78,32,10.211,33,10.211,34,7.554,35,10.211,36,3.976,37,8.397,38,9.368,39,10.211,40,10.211,41,10.211,42,8.397,43,5.35,44,14.85,45,2.397,46,5.293,47,10.211,48,12.592,49,9.368,50,2.934,51,10.211,52,7.554,53,12.212,54,5.47,55,5.976,56,2.716,57,4.614,58,1.17,59,10.211,60,3.677,61,5.668,62,4.729,63,6.711,64,10.211,65,5.815,66,9.368,67,8.812,68,9.368,69,8.397,70,10.211,71,10.211,72,3.677,73,10.211,74,8.397,75,5.47,76,3.319,77,8.812,78,6.998,79,2.248,80,4.08,81,8.066,82,4.578,83,7.347,84,10.211,85,5.976,86,10.211,87,5.35,88,7.79,89,5.083,90,6.355,91,7.164]],["keywords/1",[]],["title/2",[36,466.935,87,628.279]],["content/2",[3,2.03,4,8.77,5,8.005,6,6.465,17,5.073,18,1.398,36,7.063,45,4.257,48,9.787,58,2.337,61,7.551,63,8.939,67,11.739,87,9.503,92,9.64,93,13.602,94,9.323,95,3.634,96,12.479,97,9.123,98,6.197,99,11.186,100,9.543,101,6.409,102,12.479,103,9.323,104,7.851,105,13.602,106,2.09,107,9.452,108,18.138,109,12.431,110,5.073,111,13.602,112,13.602,113,8.939,114,13.602,115,3.556,116,6.771,117,7.287,118,6.706,119,6.644]],["keywords/2",[]],["title/3",[120,1398.897]],["content/3",[3,1.298,8,3.71,11,5.284,20,7.393,36,5.082,56,4.692,68,11.973,72,4.7,85,7.638,94,8.945,107,6.045,116,6.496,120,11.973,121,11.263,122,13.051,123,10.309,124,9.156,125,5.114,126,8.263,127,13.051,128,9.39,129,11.263,130,13.051,131,6.991,132,7.991,133,7.991,134,9.39,135,11.263,136,11.263,137,11.973,138,13.051,139,8.945,140,13.051,141,8.945,142,17.641,143,13.133,144,10.732,145,5.548,146,7.072,147,11.973,148,9.655,149,5.839,150,5.994,151,13.051,152,4.62,153,13.051,154,13.051,155,9.39,156,12.376,157,5.705,158,11.263,159,11.973,160,7.157,161,9.39,162,11.263,163,8.753]],["keywords/3",[]],["title/4",[8,280.871,97,662.709,164,625.674]],["content/4",[]],["keywords/4",[]],["title/5",[97,804.245,164,759.301]],["content/5",[17,5.692,18,1.569,57,6.896,58,1.748,97,10.235,164,9.663,165,15.261,166,15.447,167,14,168,15.261,169,6.098,170,11.643,171,9.498,172,15.261,173,8.579,174,5.832,175,9.062,176,9.83,177,10.235,178,7.91,179,5.761,180,7.996,181,9.199,182,5.98,183,14.919,184,15.261,185,8.932,186,13.17,187,9.929,188,6.788,189,15.261,190,10.459,191,7.91,192,11.29,193,8.369,194,15.261]],["keywords/5",[]],["title/6",[164,759.301,195,947.258]],["content/6",[8,4.459,12,6.186,17,5.85,18,1.612,27,8.403,80,6.268,97,10.52,106,2.41,164,12.601,171,9.763,190,10.751,195,12.391,196,15.686,197,4.947,198,8.602,199,12.9,200,12.9,201,13.537,202,11.967,203,12.391,204,5.288,205,12.9,206,14.722,207,10.751,208,7.591,209,6.438,210,15.686,211,5.714,212,15.686,213,10.751,214,10.751,215,9.455,216,10.52,217,12.9]],["keywords/6",[]],["title/7",[95,407.35]],["content/7",[2,14.184,16,6.937,29,8.424,76,5.606,91,12.1,95,6.096,101,8.126,128,12.41,175,10.241,195,13.624,218,5.36,219,14.184,220,17.247,221,10.396,222,17.247,223,8.67,224,17.247,225,17.247,226,17.247,227,14.184,228,7.079]],["keywords/7",[]],["title/8",[229,1204.507]],["content/8",[100,8.702,106,3.873,115,3.243,152,6.892,164,7.854,183,14.851,190,11.679,191,6.43,195,9.798,206,9.176,207,8.501,213,11.679,214,8.501,229,13.461,230,15.633,231,8.925,232,11.393,233,6.722,234,10.641,235,9.176,236,12.404,237,2.865,238,2.842,239,5.392,240,8.928,241,4.467,242,8.483,243,9.705,244,15.633,245,6.499,246,11.379,247,12.404,248,12.404,249,12.404,250,15.633,251,8.152,252,9.798,253,9.463,254,12.404,255,12.404,256,12.404,257,12.404]],["keywords/8",[]],["title/9",[227,1253.981]],["content/9",[0,7.643,16,3.645,22,2.647,45,3.191,80,3.621,106,3.871,179,3.42,188,4.03,190,6.21,191,4.697,197,2.858,206,6.703,207,6.21,211,4.953,213,6.21,215,5.462,227,13.419,229,10.739,230,8.313,232,5.303,234,9.207,238,2.076,239,3.939,240,4.747,241,3.263,243,9.293,246,8.313,258,3.023,259,4.854,260,2.349,261,9.061,262,7.452,263,7.452,264,9.061,265,9.061,266,4.601,267,9.061,268,9.061,269,9.061,270,5.548,271,5.16,272,9.061,273,3.551,274,9.061,275,9.061,276,9.061,277,9.061,278,11.18,279,9.061,280,9.061,281,15.648,282,9.061,283,9.061,284,9.061,285,5.094,286,14.969,287,8.462,288,9.301,289,9.061,290,9.061,291,9.061,292,8.313,293,4.854,294,9.061,295,9.061,296,9.061,297,7.452,298,9.061,299,9.061,300,9.061,301,5.737,302,9.061,303,9.55,304,5.843,305,5.443,306,16.317,307,9.061,308,9.061,309,9.061,310,12.473,311,9.061,312,9.061,313,9.061,314,8.313,315,9.061,316,9.061,317,9.061]],["keywords/9",[]],["title/10",[207,1045.084]],["content/10",[17,3.407,18,1.871,20,3.828,62,4.231,72,3.289,106,3.849,115,2.388,119,4.461,149,2.669,166,10.805,188,9.102,197,2.881,206,12.13,207,12.478,213,6.261,216,6.126,217,14.972,229,7.216,233,4.95,237,3.787,238,3.756,266,8.325,281,7.883,286,15.042,304,4.898,305,3.047,310,17.886,314,16.702,318,4.128,319,3.603,320,9.135,321,5.009,322,6.126,323,3.289,324,4.267,325,3.557,326,6.758,327,3.884,328,5.272,329,9.135,330,5.272,331,9.597,332,10.119,333,9.135,334,18.205,335,9.135,336,9.135,337,5.424,338,3.718,339,2.318,340,8.38,341,2.758,342,4.839,343,5.889,344,9.135,345,2.839,346,13.678,347,9.135,348,5.593,349,9.135,350,5.175,351,9.135,352,9.135,353,9.135,354,9.135,355,9.135,356,6.573,357,6.003,358,9.135,359,9.135,360,9.135,361,6.003,362,9.135]],["keywords/10",[]],["title/11",[188,533.361,363,537.576]],["content/11",[8,4.653,11,6.628,92,6.96,106,2.515,107,7.582,115,4.28,166,12.931,188,7.281,206,12.11,207,14.011,211,5.963,217,13.462,241,5.895,266,10.38,357,10.758,364,4.411,365,10.979,366,14.127,367,16.37,368,16.37,369,12.11,370,8.149,371,10.979,372,16.37,373,8.229,374,12.11,375,12.931,376,13.462]],["keywords/11",[]],["title/12",[22,445.502]],["content/12",[1,8.521,6,7.205,8,4.309,24,10.389,25,10.634,36,5.902,87,7.942,95,4.049,100,10.634,123,11.974,137,13.906,144,12.466,159,13.906,162,13.082,164,13.62,166,15.38,181,9.137,195,16.992,216,10.166,217,12.466,258,5.056,266,7.696,377,13.082,378,9.434,379,15.158,380,9.001,381,11.564,382,4.978,383,15.158,384,15.158,385,8.214,386,15.158,387,15.158,388,15.158,389,15.158,390,15.158]],["keywords/12",[]],["title/13",[391,1045.084]],["content/13",[8,5.491,90,12.023,97,12.956,110,7.205,164,12.232,391,13.24,392,13.552,393,15.886,394,15.886]],["keywords/13",[]],["title/14",[3,83.583,110,313.386,395,663.743,396,347.262]],["content/14",[]],["keywords/14",[]],["title/15",[395,1204.507]],["content/15",[3,2.109,6,6.062,17,7.366,18,2.03,45,2.994,58,2.262,72,6.255,80,5.097,89,6.349,91,12.185,110,7.908,116,6.349,131,6.833,179,4.815,190,8.742,191,6.612,382,5.704,395,15.601,396,5.271,397,6.01,398,10.489,399,12.755,400,6.476,401,8.554,402,12.755,403,12.755,404,9.731,405,9.436,406,8.405,407,14.284,408,10.489,409,6.062,410,12.755,411,11.702,412,7.081,413,6.543,414,9.436,415,11.702,416,7.178,417,7.81,418,12.755,419,12.755,420,12.755,421,11.008,422,12.755,423,11.702,424,9.731,425,12.755,426,6.01]],["keywords/15",[]],["title/16",[427,1100.131,428,734.248]],["content/16",[3,1.834,11,5.644,31,7.303,45,4.848,58,1.596,76,4.531,91,9.779,95,3.724,115,4.82,123,11.011,144,11.463,150,6.402,157,4.508,175,8.277,191,7.225,214,9.553,270,8.535,323,5.019,382,4.578,395,14.562,404,10.634,405,10.312,406,6.745,414,13.638,427,12.788,428,11.288,429,13.265,430,6.625,431,13.939,432,13.939,433,13.939,434,5.842,435,13.939,436,7.002,437,13.939,438,6.299,439,13.939,440,12.788,441,10.634,442,9.16,443,13.939,444,9.779,445,9.553,446,13.939,447,11.463]],["keywords/16",[]],["title/17",[396,495.593,398,986.166]],["content/17",[3,0.79,17,1.734,18,0.816,25,5.571,45,1.864,56,2.112,57,2.101,58,1.581,100,3.261,106,3.886,107,3.678,110,1.734,115,1.215,145,3.376,152,2.811,157,1.503,179,1.755,188,2.068,191,2.41,197,1.466,237,4.95,238,4.63,260,5.238,304,4.402,338,3.754,339,2.015,340,7.285,341,2.397,345,5.264,350,5.507,356,3.345,366,4.012,395,3.672,396,6.641,398,3.823,407,3.823,409,2.209,415,4.265,428,2.846,436,4.669,438,3.588,448,4.648,449,1.417,450,3.261,451,2.893,452,4.648,453,2.893,454,3.186,455,4.648,456,4.073,457,5.046,458,5.517,459,1.991,460,3.311,461,2.846,462,7.941,463,7.285,464,6.272,465,10.11,466,3.953,467,4.265,468,4.648,469,4.265,470,4.889,471,4.648,472,3.186,473,5.028,474,3.823,475,6.853,476,3.376,477,3.439,478,4.648,479,3.118,480,3.617,481,3.261,482,3.345,483,4.648,484,4.648,485,3.672,486,3.261,487,3.186,488,2.49,489,4.648,490,4.648,491,7.083,492,7.941,493,4.206,494,11.279,495,7.941,496,4.648,497,4.648,498,4.648,499,2.292,500,4.648,501,4.648,502,4.648,503,3.478,504,4.648,505,4.648,506,3.823,507,3.546,508,1.292,509,2.314,510,1.403,511,7.357,512,1.933,513,3.774,514,3.953,515,4.648,516,6.702,517,4.648,518,2.721,519,4.942,520,2.118,521,2.893,522,3.261,523,3.261,524,4.648,525,4.648,526,3.055,527,3.823,528,2.613,529,3.823,530,2.721,531,15.043,532,7.941,533,12.294,534,7.941,535,6,536,7.941,537,7.941,538,7.941,539,2.802,540,4.648,541,4.648,542,4.648,543,2.802,544,6.825,545,4.648,546,2.802,547,4.648,548,2.76,549,2.943]],["keywords/17",[]],["title/18",[22,445.502]],["content/18",[3,1.539,5,6.828,7,8.153,12,6.101,17,5.77,18,1.59,25,10.853,45,5.097,101,7.289,102,14.193,119,7.556,144,12.722,191,8.019,213,10.603,319,6.101,375,12.22,392,10.853,397,9.294,398,16.223,416,6.394,508,4.3,509,7.701,550,15.47,551,12.722,552,7.353,553,15.47,554,12.22,555,15.47,556,15.47,557,15.47,558,15.47,559,15.47,560,15.47]],["keywords/18",[]],["title/19",[3,98.292,143,649.387,561,988.136]],["content/19",[]],["keywords/19",[]],["title/20",[562,1034.893,563,986.166]],["content/20",[1,5.819,3,1.03,5,4.569,6,7.129,7,4.278,8,2.942,11,4.192,17,5.594,18,1.542,20,4.339,30,9.497,31,5.424,37,8.513,45,4.818,49,9.497,50,2.045,72,6.351,89,5.153,109,7.095,162,8.934,169,7.727,175,10.473,179,3.908,187,5.256,208,5.01,211,3.771,239,4.5,241,3.728,245,5.424,321,8.225,382,3.4,423,9.497,562,8.934,564,10.352,565,9.497,566,9.497,567,8.513,568,10.352,569,10.28,570,10.352,571,10.352,572,8.513,573,10.352,574,10.352,575,10.352,576,10.352,577,8.177,578,7.095,579,10.352,580,3.956,581,7.095,582,13.76,583,10.352,584,8.177,585,6.943,586,8.934,587,13.932,588,10.352,589,7.449,590,10.352,591,10.352,592,10.352,593,10.352,594,10.352,595,10.352,596,7.694,597,10.059,598,8.513,599,9.497,600,6.338,601,10.352,602,10.352,603,8.177,604,10.352,605,9.497,606,9.497,607,10.352,608,7.658,609,10.352,610,8.513,611,8.513,612,6.059,613,8.934,614,6.674,615,6.943,616,10.352,617,10.352,618,8.513,619,10.352]],["keywords/20",[]],["title/21",[3,119.285,8,340.857]],["content/21",[3,1.954,6,9.335,7,6.35,8,6.153,18,1.579,37,12.636,38,14.096,55,8.993,80,6.139,103,10.531,169,6.139,241,5.533,250,14.096,342,8.139,605,14.096,620,10.098,621,8.637,622,14.096,623,15.365,624,11.722,625,10.531,626,9.124,627,9.262,628,15.365,629,14.096,630,12.137,631,15.365,632,11.056,633,15.365,634,14.096,635,11.722,636,15.365,637,10.098,638,12.636,639,9.262]],["keywords/21",[]],["title/22",[3,119.285,416,495.593]],["content/22",[0,4.786,3,1.747,5,5.724,6,8.349,15,7.941,16,3.424,17,7.052,18,2.129,19,4.726,24,5.835,25,5.972,27,4.56,28,7.347,31,4.46,37,7.001,45,1.998,50,1.682,54,4.56,57,3.847,58,1.799,60,3.066,65,4.848,66,7.81,81,6.725,82,3.816,92,3.619,100,5.972,104,4.914,106,3.428,110,3.175,119,6.334,155,6.126,161,6.126,169,3.402,175,7.701,178,6.723,179,3.214,193,4.668,237,4.057,238,3.599,252,6.725,260,4.901,321,4.668,337,5.055,338,3.526,339,2.161,341,2.57,342,6.87,345,4.031,350,2.42,370,4.238,385,4.613,416,5.36,438,3.847,450,5.972,459,3.646,466,7.82,467,7.81,475,7.347,476,3.619,480,5.908,481,5.972,482,6.126,486,5.972,510,2.57,552,4.046,569,5.835,580,3.253,599,7.81,615,5.71,621,4.786,624,6.495,626,5.055,640,7.001,641,7.81,642,6.126,643,7.81,644,8.513,645,7.81,646,7.347,647,7.81,648,7.81,649,4.644,650,9.329,651,6.725,652,3.593,653,8.513,654,2.633,655,4.613,656,4.848,657,6.298,658,8.513,659,8.513,660,2.81,661,3.273,662,5.835,663,3.757,664,6.495,665,8.513,666,6.298,667,5.835,668,8.513,669,2.409,670,6.298,671,8.513,672,7.001]],["keywords/22",[]],["title/23",[22,445.502]],["content/23",[10,15.584,20,7.119,45,3.987,46,8.805,65,9.674,79,3.74,80,6.787,83,12.223,92,7.222,110,6.336,201,14.66,218,5.279,258,5.666,585,11.393,627,10.239,673,16.987,674,16.987,675,19.19,676,16.987,677,11.393,678,8.539,679,13.97,680,16.987,681,16.987]],["keywords/23",[]],["title/24",[391,1045.084]],["content/24",[3,2.182,89,10.919,90,11.435,91,12.889,110,6.852,117,9.842,319,7.246,382,6.034,391,12.592,393,15.109,394,15.109,447,15.109,682,11.075]],["keywords/24",[]],["title/25",[3,119.285,416,495.593]],["content/25",[]],["keywords/25",[]],["title/26",[22,350.355,125,469.918]],["content/26",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/26",[]],["title/27",[3,119.285,416,495.593]],["content/27",[]],["keywords/27",[]],["title/28",[22,350.355,125,469.918]],["content/28",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/28",[]],["title/29",[587,947.258,685,947.258]],["content/29",[]],["keywords/29",[]],["title/30",[7,630.183]],["content/30",[7,4.735,18,1.178,45,3.785,56,3.048,57,5.177,72,5.807,95,3.061,106,3.912,107,5.307,150,5.263,152,5.709,179,4.325,208,5.545,214,7.853,232,6.706,234,8.188,287,7.131,440,10.511,535,6.613,587,12.738,686,12.738,687,4.077,688,6.803,689,11.458,690,16.126,691,11.458,692,14.74,693,9.874,694,8.741,695,8.945,696,11.458,697,11.815,698,16.126,699,5.818,700,16.126,701,5.495,702,11.929,703,7.853,704,11.458,705,11.458,706,11.458,707,18.579,708,5.818,709,11.458,710,11.458,711,11.458]],["keywords/30",[]],["title/31",[587,1204.507]],["content/31",[0,3.092,5,4.038,16,3.68,18,1.789,20,2.305,29,4.469,43,2.881,45,3.214,50,2.706,58,1.569,60,1.98,77,4.746,87,2.881,92,2.338,94,3.769,95,1.469,106,3.844,115,2.392,116,2.738,136,4.746,145,3.89,149,1.607,175,3.266,179,2.076,188,6.091,208,2.661,211,3.333,213,3.769,218,1.709,233,4.959,235,4.068,237,2.113,238,3.138,240,2.881,241,1.98,260,1.426,273,3.586,304,4.207,321,3.016,327,4.995,330,3.174,331,3.219,337,3.266,350,2.601,370,2.738,409,4.349,413,2.821,454,10.422,457,2.257,458,1.502,562,4.746,587,12.012,649,3.276,654,2.83,661,2.115,683,2.547,685,4.344,686,7.228,687,2.567,694,4.196,695,2.305,707,5.045,712,5.045,713,5.045,714,3.957,715,2.321,716,6.584,717,2.661,718,2.851,719,3.546,720,3.858,721,5.5,722,5.5,723,3.858,724,5.5,725,5.5,726,5.5,727,9.15,728,9.281,729,9.15,730,4.523,731,5.5,732,8.132,733,5.5,734,5.5,735,5.5,736,5.5,737,5.5,738,5.5,739,1.797,740,3.957,741,5.5,742,5.5,743,5.5,744,5.5,745,5.5,746,7.88,747,5.045,748,5.5,749,5.5,750,8.964,751,5.5,752,13.123,753,5.5,754,5.5,755,5.5,756,5.5,757,5.045,758,8.243,759,5.5,760,4.876,761,13.695,762,3.756,763,2.712,764,9.15,765,9.15,766,9.15,767,9.608,768,9.15,769,9.15,770,9.15,771,5.5,772,6.013,773,9.15,774,9.15,775,7.525,776,2.115,777,5.5,778,2.738,779,5.5,780,9.15,781,5.5,782,5.5,783,5.5,784,5.5,785,5.5,786,5.5,787,5.5,788,5.5,789,5.5,790,5.5,791,5.5,792,5.5,793,8.692,794,3.769,795,5.5,796,4.823,797,5.5,798,5.5,799,3.423,800,5.5,801,4.523,802,5.5,803,3.016,804,5.5,805,5.5,806,5.5,807,5.5,808,9.15,809,7.525,810,5.5,811,5.5,812,5.045,813,5.5]],["keywords/31",[]],["title/32",[685,1204.507]],["content/32",[0,4.974,16,3.559,57,3.998,58,1.842,60,3.186,62,4.098,80,3.535,106,3.892,107,7.45,115,2.313,118,4.362,143,5.814,166,6.989,188,8.993,190,9.152,197,5.651,206,11.899,207,6.064,211,3.223,213,6.064,227,13.227,229,6.989,237,2.043,238,3.685,239,5.804,241,3.186,242,4.404,244,8.117,260,2.294,273,3.467,281,7.635,304,5.759,325,3.445,327,5.677,350,2.515,454,12.279,649,3.168,669,2.504,685,6.989,695,5.597,713,8.117,718,4.586,732,5.254,763,4.362,812,8.117,814,4.852,815,8.848,816,8.848,817,8.848,818,5.039,819,5.934,820,5.704,821,8.848,822,8.848,823,8.848,824,8.848,825,8.848,826,8.848,827,8.848,828,13.354,829,13.354,830,8.848,831,16.084,832,13.354,833,11.524,834,13.354,835,8.848,836,8.848,837,13.354,838,5.719,839,8.848,840,8.848,841,8.848,842,8.848,843,8.848,844,8.848,845,8.848,846,8.848,847,8.848,848,8.848,849,8.848,850,6.75,851,7.635,852,8.848]],["keywords/32",[]],["title/33",[853,965.506]],["content/33",[0,10.081,6,8.524,80,7.166,148,13.267,190,12.291,206,13.267,382,7.1,552,8.524,685,14.166,712,16.452,854,17.934,855,17.934,856,13.682,857,10.81,858,14.748,859,12.291,860,17.934]],["keywords/33",[]],["title/34",[391,1045.084]],["content/34",[90,12.341,110,7.395,391,13.589,392,13.91,393,16.306,394,16.306]],["keywords/34",[]],["title/35",[3,119.285,416,495.593]],["content/35",[]],["keywords/35",[]],["title/36",[22,350.355,125,469.918]],["content/36",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/36",[]],["title/37",[861,1097.182]],["content/37",[]],["keywords/37",[]],["title/38",[3,151.679]],["content/38",[0,5.588,3,2.169,5,6.427,6,9.599,7,7.122,15,6.087,17,7.076,18,1.95,22,2.904,28,8.579,43,5.208,45,3.418,60,5.244,62,4.604,65,9.814,67,8.579,72,3.58,79,2.189,82,4.456,83,7.153,101,4.684,106,1.527,110,5.431,131,5.325,135,8.579,149,2.904,155,7.153,167,9.12,169,6.886,178,5.153,193,5.451,197,3.135,252,7.852,330,5.738,370,4.948,382,3.265,400,5.047,401,9.766,416,7.122,436,3.775,552,4.725,624,7.584,626,5.903,629,9.12,630,11.503,640,8.175,641,9.12,642,7.153,643,9.12,645,9.12,646,8.579,647,9.12,648,9.12,861,7.153,862,9.941,863,9.941,864,7.714,865,8.579,866,9.941,867,8.175,868,9.941,869,8.579,870,3.351,871,12.567,872,5.208,873,7.584,874,8.579,875,7.153,876,5.588,877,9.941,878,9.941,879,9.941,880,4.492,881,9.941,882,7.047,883,9.941,884,6.378,885,9.941,886,9.941,887,6.087,888,8.175,889,8.175,890,5.047,891,6.974,892,8.579]],["keywords/38",[]],["title/39",[861,1097.182]],["content/39",[3,0.501,5,8.336,7,8.226,11,2.038,17,1.877,18,1.331,42,4.139,45,3.395,56,1.339,57,2.274,62,5.997,65,2.866,72,1.812,83,3.621,85,2.946,95,1.344,96,4.617,106,3.701,110,1.877,115,1.316,124,3.531,131,2.696,146,2.727,147,4.617,152,1.782,175,5.044,178,2.609,180,2.637,185,2.946,188,2.238,197,1.587,198,4.658,208,2.435,214,3.449,237,4.219,238,1.153,251,3.307,260,2.202,266,4.313,292,4.617,303,2.946,321,2.76,324,2.351,339,2.797,350,5.192,356,6.112,382,2.79,409,4.037,412,4.715,416,2.08,430,5.239,449,1.534,458,1.374,460,3.511,488,4.55,508,1.399,510,2.565,511,2.094,512,2.068,554,3.975,565,4.617,566,4.617,584,6.71,627,3.034,655,2.727,682,3.034,687,1.1,692,3.975,739,2.775,857,3.034,859,3.449,861,10.407,882,4.111,890,4.313,892,4.343,893,4.139,894,5.033,895,4.617,896,2.155,897,5.033,898,5.033,899,4.343,900,3.621,901,1.998,902,2.794,903,11.174,904,3.082,905,2.794,906,6.284,907,5.477,908,5.033,909,5.033,910,5.033,911,5.033,912,3.187,913,4.343,914,4.139,915,9.064,916,5.033,917,4.139,918,3.082,919,5.033,920,5.033,921,8.495,922,11.022,923,5.033,924,3.375,925,5.033,926,4.972,927,5.033,928,15.689,929,14.464,930,5.033,931,4.139,932,10.228,933,5.033,934,5.033,935,3.132,936,3.132,937,4.343,938,3.723,939,5.033,940,3.84,941,3.84,942,2.794,943,5.033,944,5.582,945,4.343,946,5.033,947,5.033,948,3.84,949,2.866,950,3.132,951,6.986,952,5.033,953,5.033,954,3.531,955,5.033,956,5.033,957,4.139,958,2.679,959,5.033,960,3.375,961,3.082,962,4.139,963,2.866,964,5.033,965,3.082,966,3.082,967,2.08,968,3.531,969,3.531,970,3.84,971,5.033,972,5.033,973,5.033,974,16.699,975,3.132,976,5.697,977,5.033,978,5.033,979,5.033,980,5.033,981,5.033,982,5.033,983,5.033,984,5.033,985,5.033,986,5.033,987,5.033,988,5.033,989,5.033,990,5.033,991,7.331,992,8.874,993,5.033,994,5.033,995,5.033,996,5.033,997,8.495,998,5.033,999,5.033,1000,5.033,1001,8.495,1002,4.603,1003,5.033,1004,5.033,1005,5.033,1006,5.033,1007,5.033,1008,5.033,1009,4.343,1010,8.495,1011,5.033,1012,1.661]],["keywords/39",[]],["title/40",[3,98.292,106,151.806,861,711.003]],["content/40",[3,1.904,5,6.514,7,7.91,18,1.517,31,7.734,45,3.464,60,5.315,62,6.837,65,8.406,76,4.798,79,3.25,89,7.348,119,7.209,131,7.907,177,9.9,179,5.572,241,5.315,303,8.639,321,8.095,454,10.117,508,5.319,582,13.542,634,13.542,672,12.139,861,15.283,892,12.739,901,5.859,903,12.739,1013,12.139,1014,14.761,1015,7.907,1016,14.761,1017,10.356,1018,14.761,1019,5.538,1020,14.761,1021,14.761,1022,12.139,1023,14.761,1024,14.761]],["keywords/40",[]],["title/41",[95,407.35]],["content/41",[]],["keywords/41",[]],["title/42",[472,821.883,1025,821.883]],["content/42",[3,1.846,5,2.539,7,5.819,8,1.635,11,2.329,18,2.134,22,1.681,36,4.723,43,3.014,45,1.35,50,4.015,57,2.599,58,1.785,72,2.071,79,2.671,95,1.537,106,3.824,110,2.145,119,4.639,149,1.681,150,2.642,157,1.86,174,2.198,179,3.585,197,1.814,209,2.361,218,2.952,221,3.467,234,2.921,237,1.329,238,3.226,239,2.5,241,2.071,258,3.168,273,2.254,287,3.58,304,4.343,305,3.168,331,7.099,342,5.031,350,2.7,426,2.71,454,3.943,456,3.722,458,3.312,463,5.277,470,2.037,472,9.65,493,3.047,508,1.599,580,2.198,589,4.139,620,3.78,651,4.544,660,3.135,669,3.984,677,3.858,687,2.075,693,5.815,695,3.98,697,3.642,716,6.834,732,5.639,739,3.103,747,5.277,762,3.898,814,3.154,861,8.728,870,3.202,924,3.858,976,3.858,1012,4.004,1025,10.681,1026,5.752,1027,4.292,1028,9.975,1029,3.154,1030,4.731,1031,4.731,1032,5.752,1033,9.975,1034,5.147,1035,3.193,1036,3.522,1037,5.752,1038,9.497,1039,5.752,1040,5.752,1041,5.752,1042,5.752,1043,5.752,1044,5.752,1045,5.752,1046,5.752,1047,5.752,1048,5.752,1049,5.752,1050,5.752,1051,5.752,1052,5.752,1053,5.752,1054,2.81,1055,9.497,1056,5.752,1057,9.497,1058,5.752,1059,4.255,1060,3.117,1061,5.272,1062,5.752,1063,5.752,1064,5.752,1065,2.158,1066,7.81,1067,4.731,1068,4.191,1069,9.497,1070,5.752,1071,9.497,1072,5.752,1073,2.642,1074,3.276,1075,3.416,1076,5.752,1077,4.255,1078,5.752,1079,5.752,1080,5.277,1081,2.982,1082,2.642,1083,5.752,1084,5.752,1085,5.752,1086,5.752,1087,9.497,1088,5.752,1089,5.752,1090,5.752,1091,9.497,1092,5.752,1093,3.193,1094,5.752,1095,5.147,1096,4.731,1097,3.78,1098,3.943,1099,5.752,1100,5.752,1101,3.047]],["keywords/42",[]],["title/43",[1102,1398.897]],["content/43",[3,1.397,7,4.674,8,4.542,11,2.89,16,2.871,18,2.07,25,7.934,29,3.486,45,2.654,50,3.157,62,3.306,89,3.553,95,1.907,106,3.742,116,3.553,119,3.486,174,2.728,176,3.588,179,2.694,187,3.624,204,2.406,209,2.93,211,2.6,221,4.302,234,3.624,251,4.691,258,3.772,260,2.932,304,2.556,319,2.815,342,3.781,364,4.306,365,7.585,371,4.787,382,2.344,396,2.95,429,5.136,449,2.176,458,3.835,508,1.984,512,1.738,622,6.548,639,8.466,649,2.556,669,3.2,687,2.471,692,11.095,693,4.37,716,8.137,718,3.7,876,6.357,895,6.548,896,3.057,967,4.674,1002,10.911,1012,2.356,1061,3.962,1074,4.065,1102,6.548,1103,3.7,1104,4.787,1105,4.519,1106,5.07,1107,7.138,1108,7.138,1109,7.138,1110,7.138,1111,7.138,1112,11.309,1113,7.138,1114,7.138,1115,7.138,1116,11.309,1117,7.138,1118,7.138,1119,7.138,1120,7.138,1121,7.138,1122,7.138,1123,5.238,1124,7.138,1125,7.138,1126,7.138,1127,6.44,1128,7.138,1129,7.138,1130,4.12,1131,2.89,1132,3.868,1133,3.74,1134,4.602,1135,4.065,1136,7.138,1137,12.695,1138,3.661,1139,7.138,1140,4.602,1141,7.138,1142,7.138,1143,5.28,1144,4.602,1145,5.638,1146,7.138,1147,7.138,1148,7.138,1149,7.138,1150,7.138,1151,4.519,1152,4.602,1153,7.138,1154,7.138,1155,7.138,1156,4.602,1157,3.781,1158,6.817,1159,7.585,1160,5.87,1161,4.178,1162,5.445,1163,7.138,1164,4.691,1165,3.624,1166,7.138,1167,7.138,1168,7.138,1169,7.138,1170,7.138]],["keywords/43",[]],["title/44",[853,965.506]],["content/44",[3,1.677,6,8.013,17,6.288,18,2.322,57,7.619,60,6.071,61,9.359,62,7.809,77,14.55,78,11.555,79,4.585,258,5.624,303,9.868,397,7.944,612,9.868,861,12.131,880,7.619,1171,16.86,1172,16.86,1173,11.828,1174,12.473,1175,11.555,1176,16.86]],["keywords/44",[]],["title/45",[3,119.285,416,495.593]],["content/45",[]],["keywords/45",[]],["title/46",[22,350.355,125,469.918]],["content/46",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/46",[]],["title/47",[3,119.285,416,495.593]],["content/47",[]],["keywords/47",[]],["title/48",[22,350.355,125,469.918]],["content/48",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/48",[]],["title/49",[3,98.292,106,151.806,1177,753.863]],["content/49",[]],["keywords/49",[]],["title/50",[1177,1163.321]],["content/50",[3,1.422,5,6.308,6,6.793,17,6.99,18,1.927,45,3.354,56,3.802,58,1.637,65,8.14,78,9.796,79,3.147,169,8.356,178,7.409,193,7.838,213,9.796,258,6.252,397,6.734,400,7.257,554,11.29,569,9.796,596,7.332,603,16.519,606,17.194,612,8.365,621,8.035,646,12.335,687,3.123,776,5.496,907,9.215,960,9.586,1135,8.14,1177,15.954,1178,13.865,1179,10.904,1180,7.934,1181,14.293,1182,14.293,1183,14.293,1184,13.112]],["keywords/50",[]],["title/51",[45,281.443,1185,746.37]],["content/51",[3,1.606,8,2.068,11,2.946,12,2.87,17,2.714,18,1.92,45,1.708,50,2.81,58,2.013,76,2.365,79,1.602,98,3.315,106,3.851,110,4.282,115,1.902,135,6.279,152,2.576,218,3.568,234,5.83,237,5.117,238,4.28,241,4.135,258,4.744,260,5.255,273,2.851,305,2.427,321,3.99,338,3.121,339,3.61,341,2.197,345,4.42,350,2.068,364,1.961,370,3.622,374,5.383,409,3.458,438,3.288,458,3.135,464,5.747,469,6.675,475,6.279,476,3.093,481,5.104,485,5.747,486,8.055,494,6.675,509,3.622,603,5.747,660,2.402,661,2.798,669,3.249,688,4.32,814,3.99,838,8.001,896,3.116,958,2.295,1068,5.067,1073,3.342,1177,10.851,1186,9.583,1187,5.983,1188,7.276,1189,7.276,1190,7.276,1191,7.546,1192,7.276,1193,7.276,1194,7.276,1195,7.276,1196,13.048,1197,7.276,1198,7.276,1199,5.983,1200,14.816,1201,11.235,1202,5.983,1203,6.818,1204,2.888,1205,7.276,1206,7.276,1207,7.276,1208,7.276,1209,11.482,1210,3.315,1211,11.482,1212,7.276,1213,11.482,1214,7.276,1215,7.276,1216,4.691,1217,3.854,1218,7.276,1219,5.235,1220,4.88,1221,5.104]],["keywords/51",[]],["title/52",[364,410.91]],["content/52",[0,2.651,3,1.045,6,2.242,12,4.895,15,4.923,16,1.897,17,2.999,18,2.086,20,3.37,27,4.307,31,2.471,43,2.471,45,1.887,56,1.255,57,2.131,58,0.921,60,1.698,76,1.533,80,1.885,85,2.761,92,2.005,94,5.51,106,3.788,107,4.867,115,2.747,128,5.785,133,2.888,141,3.233,150,2.166,152,2.846,169,1.885,177,3.163,182,1.848,187,2.395,191,2.445,204,4.184,209,7.3,211,3.828,218,3.858,221,2.843,231,3.394,241,1.698,260,4.419,301,2.986,305,5.057,357,3.1,361,11.689,365,3.163,380,2.801,382,1.549,397,2.222,404,3.598,407,3.879,450,5.64,458,4.857,459,2.02,493,8.573,512,3.391,577,3.726,580,1.802,589,3.394,596,2.419,624,3.598,627,2.843,649,1.689,661,4.773,663,2.082,678,2.371,687,1.03,714,3.394,715,1.991,718,2.445,757,9.64,760,2.862,763,2.325,796,1.936,903,9.068,926,2.761,938,3.489,1002,8.771,1012,2.654,1017,3.309,1080,9.64,1082,4.826,1130,4.641,1132,2.556,1133,6.503,1138,2.419,1177,3.598,1180,2.618,1184,11.387,1185,2.936,1186,5.39,1191,8.157,1210,3.663,1216,3.041,1222,2.843,1223,3.489,1224,4.717,1225,3.041,1226,4.717,1227,1.78,1228,4.07,1229,4.717,1230,4.717,1231,4.717,1232,3.233,1233,4.717,1234,8.04,1235,4.717,1236,4.07,1237,4.717,1238,6.612,1239,4.327,1240,4.717,1241,8.04,1242,8.04,1243,7.372,1244,3.163,1245,4.717,1246,4.717,1247,3.163,1248,4.717,1249,4.717,1250,4.717,1251,12.412,1252,12.777,1253,4.717,1254,3.489,1255,8.04,1256,11.453,1257,10.507,1258,8.04,1259,9.068,1260,4.717,1261,4.717,1262,4.717,1263,8.04,1264,3.1,1265,6.938,1266,4.717,1267,4.717,1268,4.717,1269,4.717,1270,4.717,1271,4.717,1272,4.463,1273,4.717,1274,2.166,1275,4.717,1276,2.471,1277,7.202,1278,4.717,1279,10.507,1280,4.717,1281,9.64,1282,4.717,1283,2.936,1284,4.409,1285,4.717,1286,3.879,1287,4.717,1288,4.717,1289,4.717,1290,4.717,1291,4.717,1292,9.64,1293,4.717,1294,4.717,1295,4.327,1296,4.717,1297,3.394]],["keywords/52",[]],["title/53",[1185,746.37,1298,841.289]],["content/53",[11,4.352,60,3.87,72,3.87,76,3.493,79,2.366,106,2.367,116,5.35,185,6.29,187,5.457,204,7.955,209,7.393,218,3.34,223,5.402,260,6.117,323,3.87,327,4.569,366,9.275,407,8.838,472,7.366,493,5.693,510,5.941,569,7.366,580,4.107,603,8.489,630,8.489,649,3.848,954,7.54,958,4.86,1133,5.631,1165,9.146,1191,10.126,1196,14.136,1200,14.136,1201,12.172,1203,9.15,1238,8.838,1239,9.859,1252,9.859,1256,8.838,1281,9.859,1283,6.689,1292,16.526,1295,14.136,1298,7.54,1299,5.02,1300,7.366,1301,7.95,1302,10.747,1303,9.275,1304,8.605,1305,18.013,1306,10.747,1307,15.409,1308,10.747,1309,10.747,1310,5.513,1311,6.929,1312,5.757,1313,7.95]],["keywords/53",[]],["title/54",[853,965.506]],["content/54",[3,1.88,8,4.115,18,1.943,57,9.508,91,10.156,95,3.867,115,3.785,136,12.493,157,4.682,201,12.493,319,5.709,323,5.213,396,8.696,404,11.044,411,13.281,508,4.023,584,11.435,603,11.435,614,9.333,621,8.138,627,8.726,654,4.477,669,4.096,675,13.281,814,7.938,958,4.566,1015,7.755,1027,6.542,1177,11.044,1185,9.01,1186,7.426,1299,6.762,1300,9.922,1314,14.476,1315,14.476,1316,14.476,1317,14.476,1318,11.905,1319,14.476,1320,12.493,1321,11.044,1322,5.784]],["keywords/54",[]],["title/55",[391,1045.084]],["content/55",[90,12.341,110,7.395,391,13.589,392,13.91,393,16.306,394,16.306]],["keywords/55",[]],["title/56",[3,119.285,416,495.593]],["content/56",[]],["keywords/56",[]],["title/57",[22,350.355,125,469.918]],["content/57",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/57",[]],["title/58",[3,119.285,416,495.593]],["content/58",[]],["keywords/58",[]],["title/59",[22,350.355,125,469.918]],["content/59",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/59",[]],["title/60",[3,119.285,416,495.593]],["content/60",[]],["keywords/60",[]],["title/61",[22,350.355,125,469.918]],["content/61",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/61",[]],["title/62",[3,119.285,416,495.593]],["content/62",[]],["keywords/62",[]],["title/63",[22,350.355,125,469.918]],["content/63",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/63",[]],["title/64",[18,101.574,258,329.615,1323,541.872]],["content/64",[]],["keywords/64",[]],["title/65",[18,101.574,258,329.615,1323,541.872]],["content/65",[3,1.97,18,2.185,22,3.748,58,1.997,62,5.941,143,11.459,176,6.448,197,4.046,209,7.157,258,7.09,378,7.984,380,7.617,409,6.097,416,5.301,512,4.823,656,7.305,669,4.934,682,7.732,701,6.152,708,8.853,714,9.23,763,6.324,819,8.603,887,7.854,1012,6.539,1065,4.813,1130,7.404,1131,7.06,1232,8.792,1323,7.034,1324,9.786,1325,8.999,1326,13.968,1327,9.786,1328,11.07,1329,9.23,1330,9.786,1331,8.43,1332,8.999,1333,13.302,1334,11.07,1335,11.07,1336,8.271,1337,9.786,1338,11.07,1339,8.999]],["keywords/65",[]],["title/66",[18,123.267,703,821.883]],["content/66",[3,1.508,5,6.69,8,4.309,31,10.201,58,2.23,62,7.021,98,6.905,197,4.781,208,7.335,209,10.03,578,10.389,625,13.345,649,5.428,669,4.289,703,10.389,857,9.137,935,12.119,1012,7.101,1187,12.466,1223,11.214,1254,11.214,1339,15.091,1340,10.907,1341,14.855,1342,11.564,1343,11.974]],["keywords/66",[]],["title/67",[50,195.235,211,359.958,1323,541.872]],["content/67",[3,1.756,8,5.018,50,4.555,56,5.696,58,2.453,191,9.15,211,7.801,669,4.995,776,8.234,1065,6.623,1131,7.148,1323,9.68,1344,17.653,1345,13.467]],["keywords/67",[]],["title/68",[1029,657.601,1346,665.681]],["content/68",[8,4.089,36,5.601,50,3.718,58,2.156,157,6.087,209,7.725,211,5.24,218,4.47,258,6.278,323,5.18,625,9.858,660,4.748,669,5.325,701,6.898,714,10.35,776,5.531,820,12.134,887,8.807,935,8.953,966,8.807,1065,5.397,1095,7.795,1131,5.824,1254,10.641,1324,10.974,1325,10.091,1326,13.786,1327,10.974,1331,9.453,1332,10.091,1333,10.974,1337,10.974,1339,15.611,1341,10.974,1342,10.974,1345,10.974,1347,12.413]],["keywords/68",[]],["title/69",[1304,605.3]],["content/69",[]],["keywords/69",[]],["title/70",[1054,744.754]],["content/70",[16,6.781,17,6.288,18,2.14,29,8.235,56,4.485,60,6.071,87,8.833,110,6.288,215,10.163,285,9.478,324,7.875,449,5.139,459,7.22,577,13.318,687,3.683,1054,8.235,1157,8.931,1304,8.265,1348,17.968,1349,13.318,1350,14.55,1351,11.307,1352,9.868]],["keywords/70",[]],["title/71",[95,407.35]],["content/71",[106,3.879,215,8.15,237,3.123,238,3.098,243,7.7,260,3.505,285,7.601,319,5.332,345,4.202,449,4.121,457,7.415,458,4.933,511,5.627,687,2.954,760,4.814,890,6.865,958,4.264,1054,6.604,1123,7.588,1204,5.367,1298,9.485,1322,5.402,1352,7.913,1353,10.68,1354,10.68,1355,6.37,1356,9.729,1357,14.27,1358,9.068,1359,7.913,1360,10.68,1361,11.668,1362,9.267,1363,10.68,1364,10.68,1365,10.68,1366,8.028,1367,11.668,1368,9.267,1369,8.028,1370,8.561,1371,10.68]],["keywords/71",[]],["title/72",[1369,712.065,1372,1034.893]],["content/72",[3,1.44,6,6.881,17,5.399,18,1.943,58,1.658,74,11.905,80,5.784,115,5.501,134,10.416,145,6.155,173,8.138,181,8.726,182,7.406,251,9.514,319,5.709,441,11.044,597,9.709,600,8.864,649,5.183,661,5.566,687,4.597,760,5.154,818,8.244,876,8.138,880,6.542,890,7.35,949,8.244,1276,7.585,1304,5.747,1373,16.31,1374,16.31,1375,12.493,1376,11.435,1377,9.709,1378,9.922,1379,11.435,1380,8.473,1381,12.493,1382,8.596,1383,10.156]],["keywords/72",[]],["title/73",[95,407.35]],["content/73",[18,1.268,50,3.354,58,1.944,106,3.954,152,6.01,188,5.487,237,3.921,238,4.447,273,4.834,288,6.328,338,4.615,339,3.131,341,5.126,345,5.276,350,3.506,697,10.749,809,10.145,814,6.765,838,5.283,1068,5.444,1073,5.666,1186,6.328,1383,8.654,1384,16.751,1385,7.22,1386,10.646,1387,6.463,1388,10.646,1389,10.646,1390,10.646,1391,10.646,1392,10.646,1393,10.646,1394,9.411,1395,8.8,1396,8.876,1397,10.646,1398,6.765,1399,5.283,1400,10.646,1401,10.646,1402,10.646]],["keywords/73",[]],["title/74",[1304,476.025,1403,1034.893]],["content/74",[72,5.769,106,3.745,110,5.975,180,8.394,238,4.621,324,7.483,382,5.261,459,6.861,687,3.5,890,8.134,944,10.528,1054,7.825,1161,11.804,1304,8.762,1352,11.804,1382,9.513,1383,11.239,1404,10.98,1405,12.222,1406,13.826,1407,14.149,1408,12.222]],["keywords/74",[]],["title/75",[552,469.66,654,305.605,1409,517.71]],["content/75",[]],["keywords/75",[]],["title/76",[552,469.66,1410,753.863,1411,512.201]],["content/76",[3,2.153,15,6.549,18,1.847,56,2.845,58,2.058,132,6.549,157,3.459,178,5.544,182,4.191,204,6.056,218,3.324,258,5.122,260,5.779,305,7.219,385,5.796,436,4.062,456,8.148,510,5.928,512,2.604,552,5.084,650,6.351,654,6.43,796,4.39,880,6.939,905,5.937,924,7.173,944,7.029,1019,4.013,1027,6.939,1081,5.544,1082,7.053,1227,4.038,1312,5.73,1409,5.604,1410,8.16,1411,9.312,1412,8.449,1413,9.231,1414,9.231,1415,7.839,1416,8.801,1417,10.092,1418,8.449,1419,10.092,1420,9.231,1421,10.773,1422,7.029,1423,7.173,1424,8.16,1425,9.231,1426,8.449,1427,6.549,1428,6.549]],["keywords/76",[]],["title/77",[552,469.66,654,305.605,1409,517.71]],["content/77",[]],["keywords/77",[]],["title/78",[950,949.064]],["content/78",[3,1.508,12,5.978,72,5.459,79,4.287,106,3.487,133,9.281,237,3.501,260,6.086,305,5.056,337,9.001,339,3.847,654,4.688,663,8.593,664,11.564,687,3.312,950,12.119,976,10.166,1019,5.687,1027,6.85,1127,8.633,1191,12.796,1411,7.857,1415,5.49,1429,10.907,1430,13.082,1431,11.974,1432,13.082,1433,11.564,1434,13.082,1435,13.082]],["keywords/78",[]],["title/79",[456,469.918,1409,628.279]],["content/79",[3,1.324,58,1.838,75,4.721,76,2.865,79,4.227,82,3.951,95,3.557,106,3.514,115,2.304,132,5.396,139,6.04,204,5.409,218,2.739,232,7.793,237,3.706,238,3.05,260,5.434,304,7.727,338,3.619,339,2.237,341,2.661,345,2.739,350,3.784,382,2.894,434,5.58,449,2.686,456,8.457,474,7.248,480,4.015,510,4.02,511,3.668,650,5.233,654,2.726,660,2.909,687,1.925,695,3.694,760,3.138,838,5.702,859,6.04,876,7.485,884,3.86,896,3.774,904,5.396,907,5.682,942,4.892,961,5.396,1027,3.982,1065,3.307,1227,3.327,1284,4.833,1299,4.117,1409,4.617,1419,5.792,1421,6.183,1436,6.962,1437,6.962,1438,7.606,1439,4.475,1440,5.911,1441,8.813,1442,5.485,1443,7.606,1444,5.911,1445,5.312,1446,6.724,1447,4.954,1448,5.396,1449,4.015,1450,7.606,1451,6.724,1452,6.183,1453,7.606,1454,7.606,1455,6.724,1456,7.606,1457,7.606,1458,7.606,1459,7.606,1460,11.49,1461,11.49,1462,7.606,1463,7.606,1464,7.606,1465,5.911,1466,5.312,1467,5.019,1468,5.019,1469,5.792,1470,5.087,1471,7.606,1472,7.606,1473,7.606,1474,7.606,1475,6.341,1476,7.606,1477,5.485]],["keywords/79",[]],["title/80",[18,123.267,1478,914.868]],["content/80",[18,1.184,45,2.703,58,2.143,106,3.81,233,6.241,237,4.939,238,4.65,273,4.513,304,7.657,338,3.131,339,2.923,341,3.477,345,5.03,350,5.319,449,5.704,456,4.513,458,5.109,552,5.474,654,3.562,838,6.931,950,7.168,970,8.786,1123,4.295,1179,8.786,1186,5.907,1449,5.246,1451,8.786,1455,12.347,1478,14.275,1479,9.938,1480,6.315,1481,8.519,1482,9.938,1483,9.938,1484,9.938,1485,9.938,1486,9.938,1487,9.938,1488,9.938,1489,9.938,1490,14.604,1491,9.217,1492,13.967,1493,9.938,1494,9.938,1495,9.938]],["keywords/80",[]],["title/81",[853,965.506]],["content/81",[3,1.92,6,7.109,17,5.578,18,2.197,46,7.753,65,8.518,79,4.251,87,7.836,101,7.047,103,13.23,131,8.012,148,11.065,157,4.837,178,7.753,179,5.646,204,6.508,260,3.877,305,6.439,382,4.912,508,4.157,552,7.109,654,4.626,760,5.325,915,12.3,950,9.309,1027,6.759,1164,9.829,1191,9.829,1409,7.836,1444,10.031,1465,10.031,1496,12.908,1497,6.987,1498,12.908,1499,12.908,1500,9.829]],["keywords/81",[]],["title/82",[654,370.874,1501,682.927]],["content/82",[]],["keywords/82",[]],["title/83",[8,280.871,581,677.243,1502,649.387]],["content/83",[3,1.269,8,3.626,11,5.165,12,5.031,16,5.13,17,4.757,18,1.311,95,3.407,106,2.668,110,4.757,115,3.335,178,6.612,197,4.023,204,7.148,231,9.178,232,7.465,237,2.946,238,3.979,260,5.12,304,4.567,305,6.588,350,3.626,512,4.229,578,8.742,580,4.874,627,7.688,649,4.567,654,3.945,699,6.476,732,10.314,760,4.541,772,8.382,796,8.703,1203,7.574,1466,7.688,1502,8.382,1503,11.905,1504,11.008,1505,9.731,1506,11.008,1507,10.076,1508,7.688,1509,9.731,1510,8.382,1511,9.731,1512,9.731,1513,7.264,1514,6.476,1515,11.008,1516,11.008,1517,11.008,1518,11.008,1519,8.948]],["keywords/83",[]],["title/84",[3,119.285,581,821.883]],["content/84",[3,1.549,34,13.433,45,2.559,54,5.841,79,4.361,95,4.159,106,3.043,145,4.635,179,5.877,204,6.121,237,3.596,260,4.036,304,3.904,305,5.193,318,7.035,322,7.312,324,7.272,338,4.232,339,4.609,382,3.581,401,7.312,430,5.182,449,6.385,458,2.977,509,5.427,510,3.292,512,3.79,518,6.381,519,6.786,615,7.312,654,6.478,687,2.382,739,3.562,763,5.376,902,6.052,905,6.052,931,8.966,963,8.866,1060,5.908,1074,6.209,1103,5.652,1185,6.786,1203,6.474,1310,5.593,1422,7.165,1445,6.572,1468,6.209,1501,8.866,1503,6.572,1520,9.409,1521,7.312,1522,9.409,1523,9.409,1524,9.409,1525,5.841,1526,9.409,1527,9.409,1528,6.676,1529,13.853,1530,11.877,1531,13.436,1532,8.318,1533,9.409]],["keywords/84",[]],["title/85",[197,378.226,204,404.25]],["content/85",[0,5.819,34,7.658,58,1.186,79,4.52,95,4.712,106,3.681,132,9.183,145,6.377,152,6.244,188,4.604,204,7.442,270,6.338,322,6.943,339,2.627,343,6.674,406,5.01,412,11.395,449,4.572,451,12.036,508,2.877,509,5.153,512,3.652,520,4.716,661,3.98,697,9.497,699,5.256,717,5.01,718,5.366,794,7.095,801,8.513,902,5.746,912,6.555,960,6.943,961,6.338,1060,5.61,1103,5.366,1217,5.483,1387,9.241,1422,6.803,1466,6.24,1468,5.895,1509,7.898,1511,7.898,1512,7.898,1529,7.898,1530,7.898,1534,8.934,1535,11.591,1536,6.943,1537,8.934,1538,8.934,1539,6.943,1540,7.898,1541,10.352,1542,10.352,1543,10.352,1544,8.934,1545,10.352,1546,8.934,1547,7.262,1548,8.934,1549,8.934,1550,7.262,1551,8.934,1552,8.934,1553,5.204,1554,8.934,1555,8.934,1556,7.898]],["keywords/85",[]],["title/86",[260,310.858,1557,759.301]],["content/86",[58,2.087,182,7.141,251,11.976,260,4.724,266,9.253,305,6.079,510,5.502,654,5.636,699,9.253,1227,6.879,1469,11.976,1557,13.822,1558,12.222,1559,14.395,1560,15.727]],["keywords/86",[]],["title/87",[716,862.854,820,773.156]],["content/87",[]],["keywords/87",[]],["title/88",[58,113.175,820,637.091,896,423.18]],["content/88",[3,1.904,22,4.313,36,5.748,50,2.916,56,3.926,58,1.691,76,4.798,106,3.577,157,6.869,178,9.921,258,6.385,323,5.315,385,7.999,397,6.955,819,9.9,820,14.49,901,7.598,936,9.187,1019,5.538,1035,10.625,1138,7.572,1323,8.095,1561,12.739,1562,16.518,1563,11.66,1564,12.739,1565,12.739,1566,8.406,1567,8.406,1568,7.348]],["keywords/88",[]],["title/89",[8,433.424]],["content/89",[]],["keywords/89",[]],["title/90",[18,123.267,1569,439.386]],["content/90",[3,1.828,8,5.222,60,6.616,131,9.842,157,5.942,218,5.71,430,8.732,508,5.106,580,7.021,776,8.435,1157,9.732,1301,13.591,1570,15.855,1571,15.855]],["keywords/90",[]],["title/91",[958,480.942]],["content/91",[3,1.856,7,4.735,8,5.756,18,1.918,58,1.847,61,6.36,79,2.523,82,8.365,106,2.477,150,5.263,170,8.741,204,3.862,241,4.126,251,7.53,305,6.224,321,6.283,339,2.908,397,5.398,413,5.877,508,3.184,621,6.441,654,3.544,683,5.307,739,3.744,760,4.079,763,7.951,796,4.703,864,6.069,870,3.862,884,5.018,896,4.907,951,9.422,958,7.762,1061,6.36,1075,6.803,1204,6.401,1220,7.684,1299,5.352,1321,8.741,1440,7.684,1503,9.72,1514,5.818,1568,5.703,1572,9.888,1573,9.051,1574,7.387,1575,7.255,1576,8.741,1577,8.741,1578,9.051,1579,9.888,1580,9.888,1581,9.888,1582,13.917,1583,8.272,1584,8.244,1585,8.741,1586,7.255,1587,6.209]],["keywords/91",[]],["title/92",[1054,744.754]],["content/92",[3,1.983,8,3.145,12,4.363,18,2.407,27,5.927,58,1.267,72,3.984,80,4.421,115,4.113,126,7.005,132,6.774,146,5.996,164,7.005,174,7.619,180,5.797,192,8.185,204,3.73,239,6.838,241,6.592,245,5.797,297,9.098,305,3.691,326,8.185,327,4.704,370,5.507,436,4.202,669,5.18,687,2.417,695,4.637,702,8.185,715,4.67,763,7.756,870,5.303,884,4.845,967,8.705,1029,6.067,1054,5.404,1123,4.126,1130,6.386,1276,5.797,1356,7.961,1380,6.475,1577,8.441,1588,13.576,1589,16.427,1590,8.739,1591,8.441,1592,8.441,1593,7.133,1594,8.441,1595,9.548,1596,9.548,1597,5.354,1598,6.067,1599,8.739,1600,5.927,1601,7.961,1602,8.441,1603,7.005,1604,9.548,1605,9.548]],["keywords/92",[]],["title/93",[1600,816.841]],["content/93",[3,1.77,8,5.057,18,1.829,115,4.652,216,11.932,369,13.162,649,6.371,651,14.054,739,5.813,762,7.303,889,14.632,1396,12.802,1606,10.725,1607,12.482,1608,15.355,1609,15.355,1610,15.355,1611,15.355,1612,15.355]],["keywords/93",[]],["title/94",[655,826.325]],["content/94",[6,6.504,8,3.89,12,5.397,18,2.104,31,7.17,60,6.558,115,5.705,145,7.743,228,5.617,241,4.928,245,7.17,305,6.075,319,7.183,323,4.928,373,6.879,451,11.335,458,5.589,620,8.993,626,8.126,677,9.178,687,3.979,763,6.747,870,4.613,1054,6.684,1217,7.249,1227,5.166,1355,6.448,1589,12.776,1592,10.44,1613,11.81,1614,11.81,1615,11.81,1616,11.81,1617,10.44,1618,15.717,1619,10.124,1620,11.81,1621,15.717,1622,12.776,1623,9.178]],["keywords/94",[]],["title/95",[50,236.931,1569,439.386]],["content/95",[8,3.987,15,8.588,18,1.442,50,4.648,72,5.051,80,5.604,133,8.588,174,7.074,182,5.496,209,5.757,260,3.636,363,6.288,364,3.78,365,9.407,436,5.327,457,5.757,460,4.468,578,9.613,639,8.454,649,7.419,655,7.601,656,7.988,660,4.63,663,6.19,717,6.787,880,6.338,901,5.568,1123,5.231,1127,7.988,1227,6.988,1423,9.407,1429,10.092,1569,6.783,1594,10.7,1603,8.881,1624,12.104,1625,9.217,1626,12.104,1627,7.988,1628,10.7,1629,11.079,1630,12.104,1631,12.104]],["keywords/95",[]],["title/96",[1632,919.143]],["content/96",[3,2.24,8,6.688,50,4.095,197,5.278,209,6.869,211,7.55,234,10.523,258,5.582,323,6.026,325,6.516,406,10.029,512,4.074,669,5.864,776,6.435,1012,5.524,1095,9.069,1633,14.442]],["keywords/96",[]],["title/97",[8,238.838,18,86.373,364,226.432,596,431.021]],["content/97",[8,5.707,18,1.635,31,8.334,54,8.521,58,2.3,75,8.521,101,7.495,110,5.933,119,7.769,169,6.356,179,6.005,218,4.944,228,6.529,241,5.728,363,9.001,364,4.287,621,11.287,715,6.715,884,6.967,936,9.901,1019,5.969,1065,5.969,1132,8.62,1497,7.431,1634,13.728,1635,9.182,1636,7.698,1637,10.669,1638,11.446,1639,13.728]],["keywords/97",[]],["title/98",[209,492.192,327,509.83]],["content/98",[3,1.812,18,2.336,50,2.704,98,6.234,116,6.812,149,3.998,204,6.139,271,7.793,304,4.9,321,7.504,325,7.97,326,10.124,327,8.702,364,4.908,397,6.448,459,5.861,480,8.296,510,6.18,612,8.01,621,7.693,660,4.518,669,3.872,763,6.747,872,7.17,1060,7.416,1130,7.899,1132,7.416,1323,7.504,1370,8.665,1553,6.879,1569,5.014,1597,6.622,1640,15.717,1641,7.504,1642,11.81,1643,10.512,1644,11.81,1645,10.81,1646,11.81,1647,11.81,1648,9.379]],["keywords/98",[]],["title/99",[95,263.974,364,266.281,1186,506.875]],["content/99",[8,5.598,18,1.304,45,2.977,50,2.506,56,4.602,58,1.453,106,3.709,110,4.73,176,6.376,187,8.785,204,4.276,216,8.506,231,9.126,260,4.485,325,6.737,327,7.356,364,4.663,382,4.165,458,3.463,459,5.432,512,3.088,652,5.354,660,4.187,661,4.877,678,6.376,1002,11.464,1060,6.873,1081,6.574,1123,4.73,1132,9.376,1133,6.645,1134,8.177,1135,7.223,1137,13.556,1138,6.506,1140,8.177,1143,9.383,1144,8.177,1186,6.506,1427,7.766,1649,8.898,1650,10.946,1651,10.946,1652,10.946,1653,10.946,1654,10.946]],["keywords/99",[]],["title/100",[95,263.974,364,266.281,1655,693.233]],["content/100",[0,8.403,3,1.75,8,5,18,2.106,20,4.319,45,2.418,50,2.036,56,2.741,58,1.18,76,3.35,79,3.292,80,4.117,82,4.619,85,6.031,106,3.638,174,3.938,176,5.18,187,5.232,204,5.93,208,4.987,209,4.229,214,7.062,234,5.232,239,4.479,258,3.437,288,5.286,364,4.74,370,5.13,382,3.384,449,4.557,458,2.814,470,3.648,508,2.864,512,3.639,669,2.916,708,7.59,719,6.644,904,6.309,1002,11.58,1012,3.402,1123,3.843,1132,5.584,1133,5.399,1134,6.644,1135,5.868,1137,13.498,1138,5.286,1140,6.644,1144,6.644,1553,5.18,1641,5.651,1649,7.229,1655,10.487,1656,8.893,1657,8.893,1658,8.893,1659,8.893,1660,8.893,1661,7.861,1662,8.893,1663,8.893,1664,7.861,1665,8.893,1666,8.893,1667,8.893,1668,6.525,1669,4.987,1670,7.415,1671,5.399,1672,8.14,1673,8.893,1674,7.861]],["keywords/100",[]],["title/101",[95,263.974,364,266.281,1675,693.233]],["content/101",[3,1.255,8,5.581,18,1.772,45,2.96,50,2.492,72,4.542,76,4.1,79,2.777,106,3.747,174,4.82,176,6.34,187,6.404,204,4.252,208,6.103,228,5.177,234,6.404,258,4.207,288,6.47,364,4.645,382,4.142,449,3.845,453,7.85,458,3.444,470,4.465,512,3.071,669,3.569,730,10.372,882,6.103,1002,11.437,1123,4.704,1132,6.835,1133,6.608,1134,8.132,1135,7.183,1137,13.53,1138,6.47,1140,8.132,1144,8.132,1145,9.963,1284,6.916,1636,6.103,1649,8.848,1661,9.622,1664,9.622,1669,6.103,1670,9.075,1671,6.608,1675,8.848,1676,10.884,1677,10.884,1678,10.884]],["keywords/101",[]],["title/102",[18,101.574,215,595.63,373,496.727]],["content/102",[3,2.109,18,2.18,45,2.994,56,3.393,58,1.461,115,5.544,117,6.833,119,9.647,139,8.742,149,3.727,174,4.874,182,4.998,197,4.023,228,5.235,239,5.544,258,4.255,323,4.593,327,5.423,342,10.462,373,9.928,424,9.731,444,8.948,449,3.888,453,7.939,509,6.349,610,10.489,649,4.567,655,6.912,715,5.384,739,4.167,762,5.235,763,6.289,870,4.3,1019,4.786,1029,9.525,1054,8.483,1137,7.81,1157,6.756,1227,4.815,1300,8.742,1423,11.649,1576,9.731,1597,6.172,1602,15.068,1603,8.076,1679,11.008,1680,8.948,1681,11.008,1682,11.008]],["keywords/102",[]],["title/103",[58,137.346,1680,841.289]],["content/103",[8,4.881,18,1.289,56,3.336,58,1.967,115,3.279,119,8.386,178,6.501,188,7.637,239,5.452,258,5.728,259,6.719,260,3.251,266,6.368,304,4.491,323,7.582,325,4.884,327,8.952,342,9.095,373,6.305,430,5.961,434,5.256,436,4.763,442,8.242,499,6.184,510,6.659,512,3.054,663,5.535,699,8.718,876,7.05,1065,4.706,1123,4.678,1132,6.797,1178,9.278,1346,6.962,1491,9.779,1553,6.305,1557,7.941,1589,8.799,1603,10.872,1641,6.878,1674,9.568,1680,8.799,1683,10.824,1684,10.824,1685,14.818,1686,10.824,1687,10.824,1688,10.824,1689,10.824,1690,10.824,1691,10.824,1692,10.824]],["keywords/103",[]],["title/104",[649,545.984]],["content/104",[3,1.843,43,9.705,45,4.347,58,2.122,72,6.67,197,5.842,241,6.67,338,5.036,723,12.995,882,8.964,1274,8.508,1416,8.304,1693,9.923,1694,10.692]],["keywords/104",[]],["title/105",[1693,816.841]],["content/105",[]],["keywords/105",[]],["title/106",[1632,919.143]],["content/106",[3,2.193,45,4.347,50,3.66,80,7.401,211,8.03,416,7.655,669,5.241,776,7.123,901,7.353,1095,10.038,1227,6.992,1693,9.923]],["keywords/106",[]],["title/107",[1695,1315.941]],["content/107",[18,2.287,50,3.718,56,3.826,75,7.705,92,6.115,169,7.52,179,5.43,211,5.24,239,6.252,337,11.175,364,3.876,458,3.927,563,11.829,637,9.453,639,8.67,663,6.348,687,3.142,723,10.091,760,7.922,776,5.531,924,9.647,926,8.419,942,7.985,1075,11.175,1157,7.619,1180,7.985,1416,6.448,1569,5.27,1693,12.691,1696,12.413,1697,10.974,1698,10.091,1699,12.413,1700,12.413]],["keywords/107",[]],["title/108",[649,545.984]],["content/108",[18,2.299,45,3.87,115,4.311,176,8.289,178,8.547,223,8.289,237,3.808,303,9.651,338,4.483,364,4.444,417,10.097,458,4.502,649,5.904,687,3.602,763,8.13,776,6.341,1075,9.791,1274,9.432,1310,10.534,1416,7.392,1567,9.391,1693,11.001,1694,9.518,1701,14.231]],["keywords/108",[]],["title/109",[776,586.326]],["content/109",[]],["keywords/109",[]],["title/110",[18,123.267,1569,439.386]],["content/110",[3,2.03,16,5.471,18,2.238,56,3.618,57,6.147,80,5.435,95,3.634,98,6.197,104,7.851,157,4.399,169,7.247,382,4.467,417,8.329,429,9.787,436,5.166,456,5.33,458,3.714,460,4.333,506,11.186,508,6.302,552,6.465,581,9.323,621,7.646,627,8.199,654,4.207,660,4.49,687,4.458,772,8.939,776,6.974,872,7.127,880,6.147,958,4.29,967,5.622,1061,7.551,1103,7.051,1127,7.746,1161,7.961,1227,5.135,1312,7.287,1569,6.646,1597,6.582,1702,9.543,1703,6.003,1704,11.739]],["keywords/110",[]],["title/111",[242,596.939,1569,439.386]],["content/111",[1,8.88,18,2.055,50,3.949,58,1.809,80,6.312,115,4.13,149,4.615,169,6.312,240,8.276,242,7.863,328,9.117,364,4.257,381,12.051,382,5.188,436,5.999,460,5.032,508,4.39,612,9.245,660,5.214,687,3.451,776,6.074,880,7.138,912,10.002,969,11.082,1061,8.769,1082,7.255,1105,10.002,1222,9.521,1569,7.324,1575,10.002,1597,7.644,1705,13.632]],["keywords/111",[]],["title/112",[22,350.355,125,469.918]],["content/112",[3,1.955,60,7.078,382,6.455,508,5.463,580,7.511,776,7.558,1671,10.298]],["keywords/112",[]],["title/113",[1706,892.464]],["content/113",[]],["keywords/113",[]],["title/114",[1707,1204.507]],["content/114",[3,1.55,18,1.601,19,8.647,58,2.269,75,8.345,79,5.049,101,7.339,157,5.038,400,7.909,426,7.339,436,5.916,508,4.329,642,11.209,687,4.76,907,10.043,1019,5.845,1416,6.983,1637,10.447,1694,12.576,1706,13.857,1708,17.099,1709,14.256,1710,8.991]],["keywords/114",[]],["title/115",[45,281.443,95,320.351]],["content/115",[3,0.843,17,1.873,18,1.611,54,2.69,58,1.795,60,1.808,61,2.788,79,3.451,81,3.967,95,2.94,101,2.366,106,3.7,110,1.873,157,1.624,179,1.896,181,3.027,188,2.233,193,2.754,218,1.561,237,5.234,238,5.106,243,4.828,258,1.675,262,4.13,304,5.611,324,2.346,338,3.515,339,2.152,341,2.56,345,6.033,350,5.188,364,2.285,382,2.784,385,2.721,396,5.343,458,6.086,470,4.577,476,3.605,487,5.811,491,6.632,493,2.66,509,2.5,511,8.277,512,2.064,513,6.145,514,6.436,520,5.013,526,3.3,528,4.766,530,4.962,539,3.027,543,3.027,544,4.707,546,3.027,580,1.919,652,2.12,687,3.424,762,2.061,905,2.788,936,3.125,1065,1.884,1103,2.603,1106,5.796,1123,6.538,1164,3.3,1312,4.542,1318,4.13,1355,3.995,1411,4.395,1445,3.027,1470,2.898,1521,3.368,1566,2.86,1636,2.43,1669,2.43,1694,2.898,1706,9.172,1709,3.613,1711,6.468,1712,6.468,1713,5.368,1714,5.022,1715,4.349,1716,7.231,1717,5.686,1718,6.468,1719,6.702,1720,6.468,1721,6.468,1722,7.317,1723,2.754,1724,3.238,1725,3.368,1726,7.317,1727,3.523,1728,3.125,1729,5.191,1730,7.317,1731,6.468,1732,3.967,1733,7.317,1734,4.334,1735,4.334,1736,4.334,1737,4.334,1738,4.334,1739,4.334,1740,9.496,1741,7.317,1742,4.334,1743,4.334,1744,4.334,1745,4.334,1746,4.334,1747,4.334,1748,4.334,1749,4.334,1750,3.715,1751,4.334,1752,4.334,1753,4.334]],["keywords/115",[]],["title/116",[3,119.285,669,339.318]],["content/116",[]],["keywords/116",[]],["title/117",[36,466.935,1444,804.245]],["content/117",[3,2.236,25,5.755,36,8.881,50,1.621,54,4.394,56,2.182,58,2.53,60,2.954,72,5.529,76,2.667,87,4.298,91,5.755,95,2.191,106,3.016,116,4.083,117,4.394,143,10.09,149,6.567,150,5.79,179,4.759,211,2.988,221,7.599,239,3.566,241,2.954,245,4.298,323,5.529,325,4.909,426,3.865,428,5.023,430,3.899,512,4.978,580,3.135,663,3.62,669,5.785,697,9.722,708,4.165,715,5.321,870,7.295,882,3.97,901,5.004,976,5.502,1012,2.708,1013,6.746,1030,10.367,1034,4.445,1035,4.554,1036,5.023,1131,5.104,1210,5.743,1300,5.622,1311,8.128,1330,6.258,1331,8.285,1641,4.498,1703,3.62,1754,7.079,1755,9.23,1756,6.258,1757,5.289,1758,11.774,1759,4.801,1760,7.079,1761,10.879,1762,5.502,1763,14.87,1764,5.391,1765,7.079,1766,7.079,1767,6.48,1768,8.203,1769,6.258,1770,7.079]],["keywords/117",[]],["title/118",[45,281.443,197,378.226]],["content/118",[3,1.56,18,1.612,45,4.671,58,2.279,149,5.814,197,6.277,228,6.438,288,8.046,323,5.649,382,5.151,669,4.438,762,6.438,864,8.309,870,6.709,1012,7.216,1067,12.9,1068,6.923,1101,11.579,1131,6.351,1186,8.046,1322,6.268,1475,11.287,1771,13.537,1772,13.537,1773,9.763,1774,13.537,1775,11.967]],["keywords/118",[]],["title/119",[50,301.275]],["content/119",[3,2.175,6,6.966,8,4.166,18,1.507,36,5.707,45,2.354,50,4.751,54,5.373,58,2.321,72,3.612,95,2.679,133,6.141,157,3.244,169,4.007,177,6.726,179,6.538,197,3.163,209,4.116,211,7.711,234,7.442,241,3.612,258,3.345,323,6.237,325,5.707,327,4.264,364,2.703,375,7.922,401,6.726,430,4.767,508,2.787,512,3.568,639,6.045,649,3.591,652,4.233,669,6.342,670,7.419,717,4.853,776,5.636,856,11.182,870,3.381,1012,3.311,1017,7.036,1019,3.763,1029,5.5,1095,10.325,1096,8.248,1097,6.591,1131,5.935,1310,5.145,1502,9.632,1505,7.651,1567,5.712,1607,7.036,1693,7.852,1697,7.651,1776,8.655,1777,8.655,1778,8.655,1779,8.655,1780,8.655,1781,8.655,1782,6.35,1783,8.655,1784,8.655]],["keywords/119",[]],["title/120",[45,281.443,258,400.012]],["content/120",[3,1.896,18,2.177,45,3.442,50,2.897,58,1.68,75,7.856,98,6.681,106,2.253,193,8.042,197,4.625,209,7.823,211,6.943,234,7.446,258,7.751,259,7.856,287,9.127,288,9.777,301,9.286,323,5.281,325,5.71,400,7.446,406,7.097,669,5.393,1012,4.841,1131,5.938,1186,7.522,1497,8.903,1636,7.097,1755,7.856,1759,8.583,1785,10.051,1786,9.455,1787,12.656,1788,10.288]],["keywords/120",[]],["title/121",[18,101.574,197,311.663,1583,506.875]],["content/121",[3,1.539,18,2.232,58,2.259,197,6.85,258,5.161,259,8.287,288,7.936,323,5.571,378,9.629,512,3.767,612,9.055,669,4.378,870,5.215,958,4.879,969,10.853,1012,5.107,1131,7.988,1274,7.106,1312,8.287,1497,7.226,1556,11.803,1583,12.119,1755,11.634,1789,12.22,1790,13.839]],["keywords/121",[]],["title/122",[22,350.355,125,469.918]],["content/122",[3,1.889,22,5.549,60,6.839,198,10.415,228,7.795,580,7.258,669,5.374,708,9.643,870,6.402,1012,6.27,1791,16.39]],["keywords/122",[]],["title/123",[1,674.112,242,596.939]],["content/123",[]],["keywords/123",[]],["title/124",[22,350.355,125,469.918]],["content/124",[3,1.873,18,1.936,22,5.502,45,4.42,50,3.721,116,9.375,219,15.488,270,11.531,319,7.428,1568,9.375,1698,13.213,1792,12.377]],["keywords/124",[]],["title/125",[363,683.567]],["content/125",[]],["keywords/125",[]],["title/126",[1793,880.134]],["content/126",[3,0.512,5,2.272,18,1.821,20,2.157,22,1.504,27,2.758,45,1.208,50,3.335,55,3.013,56,3.494,57,2.326,58,2.243,60,1.854,72,1.854,95,3.509,98,2.345,104,2.971,106,3.868,110,1.92,115,2.929,116,2.562,117,2.758,145,3.681,146,2.79,157,1.665,169,2.057,174,5.02,187,4.396,204,5.973,218,2.691,223,2.588,228,2.113,238,1.179,239,4.87,240,5.87,242,2.562,259,2.758,260,2.904,266,4.396,271,2.932,273,3.393,305,1.717,323,1.854,325,2.004,327,2.189,330,2.971,361,8.633,363,3.881,364,4.548,371,3.452,378,3.204,382,2.843,397,2.425,409,2.447,430,4.115,438,3.912,449,2.639,458,4.838,470,1.823,491,4.441,511,2.142,512,3.865,513,4.115,514,4.31,580,1.967,596,4.441,612,3.013,621,2.894,625,3.528,652,2.173,656,4.931,661,1.979,670,3.808,688,3.057,701,2.469,720,3.611,762,2.113,776,6.104,870,1.735,872,2.697,882,2.491,884,3.792,890,2.614,896,2.205,902,2.858,1012,4.837,1019,3.248,1104,3.452,1123,1.92,1133,2.697,1135,8.344,1138,5.747,1165,4.396,1210,2.345,1227,1.943,1243,6.074,1277,5.934,1299,2.405,1369,3.057,1442,3.204,1466,5.219,1497,2.405,1569,4.813,1591,3.927,1693,7.037,1719,4.488,1755,4.638,1759,3.013,1794,2.538,1795,4.443,1796,3.611,1797,4.443,1798,4.443,1799,4.443,1800,4.066,1801,4.443,1802,3.528,1803,4.443,1804,3.927,1805,4.443,1806,4.443,1807,6.23,1808,4.443,1809,3.704,1810,3.452,1811,5.141,1812,4.443,1813,4.066,1814,4.443,1815,4.443,1816,4.443,1817,4.443,1818,4.443,1819,4.066,1820,4.443,1821,4.638,1822,3.383,1823,3.704,1824,4.443,1825,6.839,1826,4.066,1827,4.443,1828,3.927,1829,3.704,1830,4.443,1831,6.23,1832,4.443,1833,4.443,1834,4.443,1835,4.443,1836,3.808,1837,4.066,1838,4.443,1839,4.443,1840,4.443,1841,2.823,1842,4.443,1843,4.443,1844,4.443,1845,3.808,1846,2.858]],["keywords/126",[]],["title/127",[1632,919.143]],["content/127",[11,4.372,15,6.612,16,4.343,29,5.274,45,2.534,56,2.872,60,3.889,76,5.026,80,4.315,95,2.885,106,3.577,115,5.156,124,7.576,145,6.574,157,3.492,169,4.315,178,5.597,181,6.509,182,4.232,188,4.803,209,4.432,211,6.579,245,5.658,287,6.721,301,6.837,363,4.841,364,4.867,371,7.242,385,5.852,406,5.226,580,4.127,649,7.061,652,6.526,657,7.988,669,3.056,682,10.887,701,5.178,872,5.658,884,6.772,926,6.32,967,6.39,1012,3.565,1216,12.714,1220,7.242,1227,4.076,1274,4.96,1283,6.721,1416,4.841,1773,6.721,1807,11.125,1811,6.412,1847,8.238,1848,7.988,1849,9.319,1850,8.238,1851,13.361,1852,15.587,1853,8.53,1854,9.319,1855,9.319,1856,9.319,1857,6.233,1858,8.53,1859,9.319,1860,7.576,1861,9.319,1862,8.238,1863,9.319]],["keywords/127",[]],["title/128",[116,491.885,363,442.97,776,379.955]],["content/128",[8,3.667,16,7.04,18,2.042,29,6.301,43,6.759,45,3.028,56,3.432,58,2.005,76,4.194,104,10.103,115,5.823,146,6.991,169,7.938,181,7.777,191,6.687,240,6.759,363,7.847,364,4.717,371,8.652,397,6.078,413,6.618,438,7.91,450,12.28,507,9.842,614,8.318,649,7.113,663,5.694,687,2.819,760,7.93,776,4.961,818,7.347,1133,9.171,1222,7.777,1243,9.051,1274,8.04,1326,8.478,1411,6.687,1831,9.283,1860,9.051,1862,9.842,1864,11.134,1865,15.106,1866,11.134]],["keywords/128",[]],["title/129",[890,608.874,1867,1199.175]],["content/129",[58,2.021,95,3.486,146,7.072,149,3.813,174,4.987,181,7.867,187,6.626,211,4.754,240,9.243,241,4.7,260,5.549,270,7.991,323,4.7,325,5.082,363,5.85,406,6.315,409,6.203,413,6.694,621,7.336,656,7.432,669,3.693,701,6.258,776,5.018,870,4.399,890,10.869,896,5.589,904,7.991,960,8.753,1012,7.778,1029,7.157,1131,5.284,1133,6.838,1535,8.577,1569,7.843,1625,8.577,1847,9.956,1868,17.246,1869,11.263,1870,11.263,1871,10.732,1872,9.39,1873,11.263,1874,11.263,1875,13.051,1876,9.956,1877,11.263]],["keywords/129",[]],["title/130",[708,608.874,905,665.681]],["content/130",[]],["keywords/130",[]],["title/131",[1034,826.325]],["content/131",[3,2.085,36,4.83,50,4.34,58,1.421,60,4.467,106,3.852,118,6.116,150,7.827,152,4.392,198,6.802,218,3.855,241,4.467,426,5.844,428,7.595,512,4.739,580,4.74,626,7.365,701,8.172,901,4.924,935,7.72,1012,4.095,1034,6.722,1035,10.806,1036,7.595,1138,8.741,1641,6.802,1643,7.159,1757,7.997,1762,8.319,1769,9.463,1841,6.802,1846,9.46,1878,10.705,1879,17.041,1880,12.261,1881,10.705,1882,8.925,1883,10.705,1884,8.925,1885,8.925,1886,8.925,1887,7.26,1888,8.925,1889,8.925]],["keywords/131",[]],["title/132",[1101,807.709]],["content/132",[3,2.167,11,6.308,18,2.434,50,3.078,58,1.784,76,5.064,106,2.393,197,6.249,211,5.675,258,5.196,337,9.25,382,5.116,512,3.793,669,5.606,677,10.447,1012,5.142,1027,7.039,1131,6.308,1223,11.524,1759,9.117,1794,7.68,1841,8.542,1890,13.443,1891,13.9,1892,11.884,1893,13.443,1894,11.884,1895,13.443]],["keywords/132",[]],["title/133",[1098,1045.084]],["content/133",[17,7.461,18,2.056,109,13.71,1012,6.604,1755,10.716]],["keywords/133",[]],["title/134",[701,731.242]],["content/134",[3,2.334,45,3.899,50,3.282,56,4.418,58,2.363,109,11.385,149,4.853,197,6.507,258,5.541,669,6.641,872,8.703,1012,5.484,1131,8.353,1180,9.221,1299,7.759,1583,10.582,1755,8.898,1896,14.336]],["keywords/134",[]],["title/135",[887,933.65]],["content/135",[11,7.89,176,9.795,197,6.146,258,6.5,669,5.513,1012,6.432,1567,11.097,1636,9.429]],["keywords/135",[]],["title/136",[209,625.858]],["content/136",[3,2.015,11,6.533,20,6.762,22,4.714,50,3.188,60,5.81,72,5.81,125,6.323,169,6.447,176,8.111,197,5.089,209,8.315,218,5.015,258,5.382,364,4.348,382,5.299,512,3.928,580,6.166,652,6.811,669,5.732,872,8.454,1012,7.667,1101,8.547,1217,8.547,1671,8.454,1897,13.925]],["keywords/136",[]],["title/137",[460,485.753]],["content/137",[]],["keywords/137",[]],["title/138",[50,236.931,460,382.009]],["content/138",[18,1.137,50,3.939,56,2.943,58,2.413,82,4.96,95,2.956,106,3.727,110,4.126,115,4.113,150,5.082,218,3.438,238,2.535,273,4.335,293,5.927,303,6.475,319,4.363,457,4.541,460,5.832,470,6.481,508,3.075,512,3.83,687,2.417,695,6.593,1068,4.883,1073,5.082,1093,8.733,1130,6.386,1227,4.176,1274,5.082,1398,6.067,1399,4.738,1439,5.618,1449,5.04,1467,6.301,1694,6.386,1821,8.427,1898,9.548,1899,13.576,1900,9.548,1901,9.548,1902,9.548,1903,13.576,1904,8.441,1905,9.548,1906,8.441,1907,9.548,1908,9.548,1909,9.548,1910,9.548,1911,9.548,1912,9.548,1913,9.548,1914,9.548,1915,9.548,1916,7.762,1917,9.548,1918,9.548,1919,9.548,1920,13.576,1921,9.548,1922,9.548,1923,13.576,1924,10.551,1925,9.548]],["keywords/138",[]],["title/139",[22,350.355,125,469.918]],["content/139",[3,1.972,50,3.918,58,2.271,864,10.503,958,6.254,1204,7.871]],["keywords/139",[]],["title/140",[115,313.524,614,773.156]],["content/140",[]],["keywords/140",[]],["title/141",[18,123.267,1926,914.868]],["content/141",[3,0.947,18,2.393,43,4.988,50,2.787,58,1.925,60,3.428,79,3.7,106,2.167,115,4.393,169,3.804,179,3.594,191,4.935,197,3.003,198,5.221,218,2.959,232,5.572,237,3.258,238,2.181,242,4.739,338,2.588,339,2.416,350,2.706,364,4.528,376,7.829,397,7.917,406,4.607,458,5.073,459,4.077,508,3.92,639,5.739,652,4.019,655,7.644,687,3.082,693,5.829,695,3.99,717,4.607,719,6.138,739,4.609,762,5.79,818,8.033,838,7.197,870,3.209,872,4.988,891,6.679,926,5.572,1022,7.829,1081,8.71,1082,4.373,1151,6.028,1173,6.679,1174,7.043,1217,5.043,1304,6.671,1370,6.028,1382,5.653,1514,9.434,1568,4.739,1575,6.028,1598,5.221,1703,4.202,1916,6.679,1927,4.834,1928,7.521,1929,7.521,1930,7.263,1931,7.263,1932,8.216,1933,6.85,1934,8.216,1935,8.216,1936,7.263,1937,7.521,1938,8.216,1939,12.174,1940,8.216,1941,8.216,1942,7.263,1943,7.263,1944,7.263,1945,8.216,1946,8.216,1947,8.216,1948,8.216,1949,8.216,1950,7.829,1951,8.216,1952,8.216]],["keywords/141",[]],["title/142",[18,123.267,240,628.279]],["content/142",[18,2.225,50,3.036,58,2.48,106,3.505,238,3.52,240,11.342,266,7.801,323,5.533,350,4.367,363,6.888,364,5.834,458,5.911,776,5.908,1703,6.781,1811,9.124,1828,11.722,1829,11.056,1936,11.722,1953,13.26,1954,10.531,1955,13.26,1956,13.26,1957,10.305,1958,10.779,1959,13.26,1960,13.26]],["keywords/142",[]],["title/143",[50,301.275]],["content/143",[18,2.083,50,4.319,58,2.321,76,3.26,97,6.726,106,3.835,107,4.645,115,2.622,118,4.945,157,3.244,169,4.007,218,4.555,238,3.968,241,3.612,285,5.638,350,2.851,364,3.95,458,4.002,614,6.466,642,7.216,687,2.191,717,4.853,762,4.116,799,6.242,814,5.5,818,5.712,907,9.45,1068,6.469,1073,6.732,1151,6.35,1227,3.786,1232,6.874,1313,7.419,1395,9.876,1398,8.038,1399,6.277,1480,5.5,1648,6.874,1703,4.426,1821,7.852,1927,7.442,1942,7.651,1944,7.651,1950,8.248,1957,6.726,1961,8.655,1962,12.649,1963,8.655,1964,5.255,1965,8.655,1966,8.655,1967,8.655,1968,8.655,1969,8.655,1970,8.655,1971,10.029,1972,8.655,1973,6.466,1974,8.655,1975,8.655,1976,7.216,1977,6.141,1978,8.655,1979,8.655,1980,8.655,1981,8.655,1982,8.655,1983,8.655,1984,8.655]],["keywords/143",[]],["title/144",[466,596.939,1127,682.927]],["content/144",[]],["keywords/144",[]],["title/145",[1985,1315.941]],["content/145",[3,1.677,45,3.957,57,7.619,58,1.931,146,9.137,169,6.737,180,8.833,259,9.032,260,4.371,305,5.624,330,9.731,417,10.323,461,10.323,508,4.686,652,7.117,654,5.214,887,10.323,1074,9.602,1178,12.473,1346,9.359,1415,6.106,1528,10.323,1607,11.828,1796,11.828,1986,10.011,1987,14.55]],["keywords/145",[]],["title/146",[339,387.005]],["content/146",[0,6.575,3,1.877,5,5.162,16,4.704,18,1.94,36,4.554,56,3.111,58,1.34,60,4.212,75,10.108,79,4.907,106,3.424,146,6.338,169,6.537,192,8.652,237,2.701,242,5.822,260,4.891,305,3.901,318,7.393,338,4.447,339,5.186,370,5.822,374,8.652,382,3.841,456,4.583,461,7.161,466,5.822,510,3.531,580,4.469,652,4.937,654,3.617,718,6.062,739,3.821,760,4.164,796,6.715,864,6.195,872,8.571,942,6.492,963,9.317,1082,5.372,1185,7.279,1227,4.415,1415,4.236,1467,6.661,1528,7.161,1568,5.822,1593,7.541,1598,6.414,1694,6.751,1988,8.415,1989,8.923,1990,8.923,1991,6.751,1992,12.481,1993,10.093,1994,10.093]],["keywords/146",[]],["title/147",[341,460.385]],["content/147",[3,1.373,16,3.719,18,2.015,52,6.841,56,2.46,58,1.059,60,3.33,79,2.036,106,3.793,115,4.318,169,3.695,188,4.113,193,5.071,197,2.917,228,6.779,237,4.23,238,3.784,260,5.329,325,3.601,327,3.931,328,5.337,338,4.49,339,2.347,341,4.987,345,5.133,413,4.743,426,4.357,459,5.912,460,2.946,461,8.452,466,4.603,476,3.931,477,6.841,479,6.202,480,4.213,481,6.487,482,6.654,508,3.836,510,2.792,512,2.251,652,3.903,654,2.86,660,3.053,661,5.308,663,6.092,666,6.841,687,4.654,693,5.662,739,3.021,796,3.795,857,5.574,870,4.653,880,4.179,1015,7.394,1027,4.179,1082,4.247,1185,5.755,1210,6.288,1274,4.247,1433,7.055,1466,5.574,1497,4.319,1575,5.855,1598,9.057,1637,6.202,1638,6.654,1694,7.967,1788,6.487,1933,9.932,1992,7.055,1995,7.98,1996,6.487,1997,7.98,1998,6.487,1999,7.055]],["keywords/147",[]],["title/148",[50,301.275]],["content/148",[3,1.163,5,5.162,18,1.94,45,2.745,50,4.249,56,3.111,58,2.34,72,4.212,79,4.155,95,3.124,106,3.586,110,4.362,115,3.058,191,6.062,197,3.689,211,4.26,238,2.68,245,6.128,273,4.583,325,4.554,327,6.955,338,3.179,364,6.005,416,4.833,459,5.009,461,7.161,508,5.244,652,4.937,662,8.016,669,3.309,687,3.574,715,4.937,1019,4.388,1068,5.162,1073,5.372,1395,9.78,1399,5.009,1404,8.016,1502,7.686,1514,8.307,1569,4.285,1964,6.128,2000,8.923,2001,8.205,2002,12.481,2003,8.923,2004,8.923,2005,8.923,2006,8.923,2007,9.239,2008,10.093,2009,10.093,2010,10.093,2011,10.093]],["keywords/148",[]],["title/149",[22,350.355,125,469.918]],["content/149",[3,1.905,20,8.027,58,2.194,60,6.897,218,5.953,510,5.783,580,7.319,654,5.924,896,8.203,1019,7.187]],["keywords/149",[]],["title/150",[79,335.762]],["content/150",[]],["keywords/150",[]],["title/151",[50,301.275]],["content/151",[50,4.375,56,4.292,57,7.291,58,2.32,106,3.751,238,3.697,337,9.581,458,4.406,799,10.043,1068,7.121,1073,7.411,1222,9.726,1299,7.537,1395,10.501,1398,8.848,1399,6.91,1964,8.454,2012,13.925,2013,13.925,2014,12.31,2015,13.925,2016,13.925,2017,13.925]],["keywords/151",[]],["title/152",[22,350.355,125,469.918]],["content/152",[76,6.502,449,6.098,967,8.267,1157,10.596,1597,9.68]],["keywords/152",[]],["title/153",[1101,807.709]],["content/153",[]],["keywords/153",[]],["title/154",[18,86.373,149,245.494,1323,460.781,1841,460.781]],["content/154",[3,1.518,16,6.138,18,2.419,29,7.454,58,1.748,95,4.077,106,3.004,115,3.99,149,5.713,197,4.813,208,7.385,323,5.496,451,9.498,509,7.597,512,3.715,580,5.832,660,5.038,669,4.318,677,10.235,718,7.91,762,8.026,870,5.145,1012,5.038,1101,8.084,1131,6.179,1186,7.828,1336,9.839,1584,10.981,1891,15.139,1892,11.643,2018,13.17]],["keywords/154",[]],["title/155",[22,350.355,125,469.918]],["content/155",[3,1.873,18,1.936,22,5.502,45,4.42,60,6.782,197,5.94,228,7.73,580,7.197,901,7.476,1301,13.932,1792,12.377,2019,16.253]],["keywords/155",[]],["title/156",[958,480.942]],["content/156",[]],["keywords/156",[]],["title/157",[50,236.931,958,378.226]],["content/157",[18,1.311,46,6.612,50,3.902,54,6.833,58,2.262,61,7.081,106,3.713,152,4.516,233,6.912,238,2.922,319,7.79,323,4.593,370,6.349,382,4.189,400,6.476,457,5.235,687,4.315,958,6.688,960,8.554,1204,7.84,1387,6.683,1395,9.003,1398,6.995,1399,5.462,1635,7.362,1702,8.948,1906,9.731,1927,6.476,1964,6.683,2020,11.232,2021,9.178,2022,11.008,2023,11.008,2024,11.008,2025,11.008,2026,11.008,2027,11.008,2028,11.008,2029,11.702,2030,11.008,2031,11.008,2032,11.702,2033,11.008,2034,11.702]],["keywords/157",[]],["title/158",[22,350.355,125,469.918]],["content/158",[12,7.685,18,2.334,22,5.693,115,5.094,655,10.559,864,10.321,1568,9.699]],["keywords/158",[]],["title/159",[449,365.537,1157,635.204]],["content/159",[]],["keywords/159",[]],["title/160",[50,301.275]],["content/160",[18,1.537,50,4.223,58,2.211,106,3.678,238,3.427,273,5.861,370,7.445,400,7.594,449,4.559,458,4.084,687,3.268,1068,6.601,1073,6.87,1332,10.493,1395,10.006,1398,8.202,1399,6.405,1860,10.493,1927,7.594,1977,9.158,2014,11.411,2020,7.923,2035,12.908,2036,12.908,2037,10.493,2038,12.908,2039,18.447,2040,12.908,2041,12.908,2042,11.065,2043,12.908,2044,12.908]],["keywords/160",[]],["title/161",[654,370.874,1082,550.801]],["content/161",[]],["keywords/161",[]],["title/162",[1415,552.266]],["content/162",[3,0.672,12,2.663,16,2.716,18,1.112,19,3.748,52,4.995,56,2.878,57,3.051,58,2.261,72,2.432,76,4.401,80,2.698,95,2.891,106,3.694,133,4.134,169,4.323,179,2.549,188,3.003,204,2.276,218,3.363,237,4.558,238,4.351,285,3.796,304,3.874,305,2.252,321,3.703,323,2.432,338,2.941,339,1.714,341,2.039,345,2.099,348,4.134,350,5.14,400,3.429,401,4.529,409,5.143,413,3.464,416,2.791,426,3.181,434,2.83,442,4.438,459,2.892,476,2.871,480,4.929,510,5.459,512,2.634,521,4.203,580,2.58,637,8.897,652,2.85,654,4.789,660,4.469,661,2.596,687,3.383,763,3.329,767,4.737,796,8.101,838,7.257,870,2.276,884,2.957,961,4.134,1019,2.534,1027,3.051,1065,2.534,1103,5.609,1164,4.438,1180,3.748,1227,2.549,1346,7.516,1385,3.952,1415,5.608,1497,3.154,1508,4.07,1525,3.617,1557,8.572,1723,3.703,1954,4.628,1986,4.01,1991,3.898,2045,5.827,2046,5.334,2047,6.851,2048,14.623,2049,8.255,2050,9.338,2051,9.338,2052,12.927,2053,5.334,2054,6.425,2055,5.827,2056,5.827,2057,9.338,2058,5.827,2059,5.827,2060,5.827,2061,9.338,2062,5.827,2063,5.827,2064,4.529,2065,8.255,2066,11.684,2067,9.338,2068,5.152,2069,5.827,2070,4.628,2071,4.737,2072,5.827,2073,5.827,2074,5.152,2075,4.628,2076,3.952,2077,5.827,2078,5.827,2079,5.827]],["keywords/162",[]],["title/163",[456,597.534]],["content/163",[3,1.265,12,5.014,18,0.853,53,6.821,56,3.382,58,2.351,60,2.987,72,4.578,76,2.696,80,3.314,94,5.684,95,2.216,99,6.821,106,3.404,110,3.093,116,4.129,152,2.936,179,3.131,204,6.3,218,2.578,228,3.404,237,4.002,238,2.913,260,5.111,304,5.535,305,5.157,321,4.548,325,4.95,338,2.255,339,3.227,345,2.578,350,2.357,370,4.129,385,6.889,400,4.211,405,6.136,408,6.821,409,3.942,412,4.604,434,3.476,456,8.043,508,3.533,510,5.232,512,3.095,580,4.858,652,3.501,654,2.565,660,2.738,687,1.812,739,2.71,796,5.218,838,5.444,858,6.821,859,5.684,876,4.662,882,4.014,884,3.632,896,3.552,1123,4.741,1173,5.819,1385,4.854,1415,6.768,1416,5.699,1424,6.327,1446,9.699,1452,5.819,1510,5.451,1525,4.443,1585,6.327,1698,5.819,1775,13.221,1788,5.819,1794,4.089,1999,6.327,2047,5.252,2071,5.819,2074,6.327,2080,6.327,2081,7.158,2082,7.158,2083,13.341,2084,7.158,2085,6.327,2086,7.158,2087,10.971,2088,7.158,2089,7.158,2090,7.158,2091,7.158,2092,6.551,2093,6.551,2094,6.327,2095,7.158,2096,7.158,2097,7.158,2098,7.158,2099,7.158,2100,7.158]],["keywords/163",[]],["title/164",[1416,683.567]],["content/164",[3,1.444,20,4.148,27,5.302,50,1.955,56,2.633,58,1.134,60,5.227,63,6.504,76,3.217,80,3.955,95,3.878,101,4.663,106,3.716,110,3.691,117,5.302,180,7.605,191,5.13,193,5.427,218,3.076,237,4.866,238,4.619,240,5.185,304,5.197,338,3.946,339,2.512,341,2.988,345,4.511,350,4.886,400,5.025,416,4.09,426,4.663,476,4.208,512,3.534,521,6.16,580,3.782,620,6.504,637,6.504,652,4.178,654,4.489,682,5.966,687,3.171,688,5.877,796,4.062,838,7.361,882,4.789,1416,4.437,1510,9.539,1525,5.302,1597,4.789,1632,5.966,1703,4.368,1723,5.427,1755,5.302,1792,6.504,1876,7.551,2047,9.191,2049,7.551,2052,15.38,2054,8.619,2064,6.638,2065,7.551,2068,7.551,2076,5.793,2101,7.551,2102,12.527,2103,12.527,2104,8.541,2105,7.551,2106,8.541,2107,8.541,2108,8.541,2109,8.541,2110,8.541,2111,8.541,2112,8.541]],["keywords/164",[]],["title/165",[510,362.059,1439,608.874]],["content/165",[15,9.408,58,1.76,106,3.017,188,6.834,232,8.993,237,5.269,304,7.033,305,5.125,339,4.985,470,5.44,488,8.231,508,4.27,510,6.536,512,3.741,520,7,884,6.729,901,6.099,963,8.75,1074,8.75,1227,5.8,1432,18.683,1439,7.801,1440,10.305,1480,8.426,1497,7.177,2047,9.729,2076,8.993,2113,12.636,2114,12.137]],["keywords/165",[]],["title/166",[22,350.355,125,469.918]],["content/166",[18,1.986,22,5.644,76,6.279,242,9.616,450,13.552,1105,12.232,1568,9.616,1792,12.695,1794,9.524]],["keywords/166",[]],["title/167",[50,301.275]],["content/167",[]],["keywords/167",[]],["title/168",[2020,807.709]],["content/168",[1,6.856,3,1.213,18,1.983,22,2.296,45,1.845,46,4.074,50,3.603,58,2.088,92,3.342,94,5.387,95,2.1,106,3.623,110,2.931,115,3.189,116,3.913,132,4.812,145,3.342,174,3.004,179,2.967,188,3.496,190,5.387,207,5.387,218,2.443,221,4.738,233,4.259,238,2.794,242,6.071,243,4.476,260,2.037,328,4.537,350,4.248,364,4.028,370,3.913,429,5.655,430,3.736,438,5.512,445,5.387,457,3.226,458,5.268,480,3.581,508,2.184,512,2.97,528,4.418,652,3.318,655,4.259,657,5.814,660,2.595,663,3.469,687,3.68,688,4.667,695,5.112,697,7.723,717,5.902,719,5.067,740,5.655,901,3.12,936,4.892,958,3.847,1068,3.469,1073,3.61,1165,3.991,1204,3.12,1284,4.31,1387,4.118,1394,5.996,1398,4.31,1399,5.223,1409,4.118,1416,3.523,1490,5.655,1491,4.476,1568,3.913,1569,2.88,1574,5.067,1601,5.655,1715,4.032,1796,5.514,1821,9.023,1973,5.067,2020,9.658,2075,5.387,2101,5.996,2115,6.783,2116,6.783,2117,12.898,2118,6.783,2119,6.783,2120,6.783,2121,10.526,2122,6.783,2123,6.783,2124,6.783,2125,6.783,2126,10.526,2127,6.783,2128,6.783,2129,6.783,2130,6.783,2131,6.783,2132,6.783,2133,6.131,2134,6.783,2135,6.783,2136,6.783,2137,6.209,2138,6.783,2139,6.783,2140,10.526,2141,6.783,2142,6.783,2143,5.271,2144,7.211,2145,6.783,2146,6.783]],["keywords/168",[]],["title/169",[22,350.355,125,469.918]],["content/169",[3,1.99,60,7.204,460,6.372,580,7.644,1597,9.68]],["keywords/169",[]],["title/170",[3,119.285,95,320.351]],["content/170",[]],["keywords/170",[]],["title/171",[22,350.355,125,469.918]],["content/171",[3,2.236,12,7.554,22,5.596,79,4.217,205,15.751,615,12.846,864,10.146,1469,12.587,1568,9.534]],["keywords/171",[]],["title/172",[683,706.254]],["content/172",[]],["keywords/172",[]],["title/173",[2147,1045.084]],["content/173",[3,1.834,5,8.136,17,5.199,18,1.433,31,10.822,46,7.225,56,3.708,58,1.596,76,5.993,85,8.158,92,5.926,116,6.939,149,4.072,200,11.463,208,6.745,209,5.721,650,8.277,683,10.18,762,7.567,884,6.105,887,12.648,896,7.895,1012,4.601,1019,5.23,1065,5.23,1081,7.225,1131,5.644,1203,8.277,1325,12.933,1326,14.445,1427,8.535,1702,9.779,2148,12.364,2149,12.029,2150,12.029,2151,10.634,2152,12.029]],["keywords/173",[]],["title/174",[3,98.292,669,279.603,683,457.672]],["content/174",[3,2.258,17,5.653,18,1.558,22,4.429,31,7.942,46,7.857,50,2.995,58,1.736,62,7.021,76,4.927,87,11.27,98,6.905,258,5.056,319,5.978,406,7.335,426,7.142,510,4.577,649,5.428,669,6.423,683,10.514,954,10.634,1065,5.687,1131,7.884,1232,10.389,1336,9.773,1359,8.872,2153,13.082,2154,13.082,2155,13.082]],["keywords/174",[]],["title/175",[3,83.583,36,327.181,149,245.494,870,283.258]],["content/175",[3,2.269,8,3.585,18,2.018,20,5.286,36,6.711,50,4.366,54,6.756,58,2.249,85,7.382,87,6.608,90,7.85,104,7.28,115,3.297,149,5.737,211,7.153,218,3.92,234,6.404,406,6.103,414,9.33,416,5.212,444,8.848,512,3.071,632,9.075,649,6.172,661,4.85,669,5.972,683,5.842,708,6.404,776,4.85,870,7.115,872,6.608,1031,10.372,1095,6.835,1097,8.289,1098,8.644,1104,8.459,1127,7.183,1219,9.075,1331,11.327,1567,7.183,1636,6.103,1693,6.756,1755,6.756,1773,7.85,2156,9.963]],["keywords/175",[]],["title/176",[22,350.355,125,469.918]],["content/176",[45,4.573,50,3.85,76,6.334,95,5.205,113,12.805,323,7.017,466,9.699,1976,14.02]],["keywords/176",[]],["title/177",[95,320.351,466,596.939]],["content/177",[]],["keywords/177",[]],["title/178",[218,372.686,662,821.883]],["content/178",[0,4.403,3,0.779,18,1.25,50,3.322,56,2.083,58,1.926,75,4.196,79,4.427,106,3.937,197,2.47,237,4.204,238,4.414,242,3.899,260,5.848,273,4.767,305,2.613,318,3.539,325,3.05,327,3.33,338,4.054,339,3.087,341,2.365,345,4.635,350,2.226,364,4.019,456,3.069,459,3.354,461,4.796,466,6.055,476,3.33,477,5.794,479,5.253,480,5.541,481,5.495,482,5.636,486,5.495,508,4.145,509,3.899,512,1.907,608,5.794,654,2.422,660,2.586,661,3.012,662,5.368,663,5.368,666,5.794,667,5.368,695,3.283,880,3.539,901,3.109,942,4.348,1015,6.516,1068,3.457,1073,3.598,1210,3.568,1227,2.957,1274,3.598,1395,8.715,1399,5.209,1415,2.837,1417,5.147,1514,3.977,1569,4.457,1593,5.05,1598,4.295,1964,4.104,1986,4.651,1988,5.636,1989,5.975,1990,5.975,1991,4.521,1998,5.495,2000,5.975,2001,5.495,2002,5.975,2003,11.377,2004,5.975,2005,5.975,2006,5.975,2157,6.759,2158,6.759,2159,6.759,2160,6.759,2161,10.497,2162,6.759,2163,6.759]],["keywords/178",[]],["title/179",[50,301.275]],["content/179",[3,1.798,8,5.138,50,4.602,106,3.337,211,7.914,234,9.179,649,6.473,669,5.115,762,7.42,1065,6.783,1097,11.88,1131,7.32,1221,12.682]],["keywords/179",[]],["title/180",[22,350.355,125,469.918]],["content/180",[3,1.938,22,5.693,27,10.438,552,9.261,902,10.816,1411,10.1,1568,9.699,2164,16.815]],["keywords/180",[]],["title/181",[434,502.581,1566,682.927]],["content/181",[]],["keywords/181",[]],["title/182",[45,357.876]],["content/182",[18,1.601,45,3.656,58,1.784,92,6.623,110,5.81,163,10.447,182,6.104,343,10.043,369,11.524,400,7.909,434,8.304,510,4.703,649,5.578,687,3.403,1165,7.909,1264,13.021,1416,6.983,1566,8.871,1606,9.39,1894,11.884,2165,15.56,2166,13.443,2167,13.443,2168,13.443,2169,13.443,2170,13.443,2171,13.443,2172,13.443,2173,11.884,2174,13.443,2175,13.443]],["keywords/182",[]],["title/183",[36,466.935,905,665.681]],["content/183",[106,4.029,434,8.646,1033,13.661,1034,9.002,1066,13.661,1098,11.385,1101,8.799,1566,9.46,2176,12.673,2177,12.673,2178,12.673]],["keywords/183",[]],["title/184",[460,382.009,958,378.226]],["content/184",[3,0.909,58,2.085,82,4.095,98,4.161,106,3.49,141,6.261,179,3.448,185,5.346,237,5.454,271,5.202,318,4.128,339,4.161,343,5.889,434,3.828,438,4.128,453,8.513,457,3.749,458,5.793,460,4.357,493,7.245,503,4.001,567,7.512,663,4.031,760,3.252,918,10.039,941,6.969,958,5.742,965,10.039,966,10.039,1019,3.427,1074,5.202,1165,9.244,1227,3.448,1264,10.775,1284,5.009,1377,6.126,1378,6.261,1449,4.161,1480,5.009,1586,10.382,2165,15.799,2173,6.969,2177,6.969,2178,6.969,2179,7.883,2180,9.842,2181,10.435,2182,7.216,2183,7.883,2184,6.969,2185,6.969,2186,6.969,2187,6.969,2188,6.969,2189,7.883,2190,7.883,2191,5.506,2192,5.135,2193,7.883,2194,7.883,2195,7.883,2196,7.883,2197,6.573,2198,5.889,2199,7.883,2200,7.883,2201,7.883,2202,7.883,2203,7.216,2204,7.883,2205,6.408,2206,6.261]],["keywords/184",[]],["title/185",[79,335.762]],["content/185",[4,3.054,12,3.182,14,3.895,18,0.487,20,1.985,56,1.26,57,2.14,58,1.599,62,2.194,79,1.043,106,3.812,119,5.148,179,1.788,180,2.482,182,1.856,198,2.597,233,5.712,237,4.504,238,4.082,258,1.58,305,1.58,318,2.14,319,3.182,330,2.734,331,2.772,338,1.288,339,1.202,341,2.436,342,5.583,345,4.722,350,2.293,392,3.323,397,2.232,406,3.905,434,1.985,436,1.799,456,5.954,457,1.944,458,6.245,480,2.158,493,4.274,508,1.316,510,2.436,520,2.158,597,3.177,600,2.9,654,1.465,687,3.32,695,1.985,699,2.405,867,3.895,880,3.646,901,3.203,904,2.9,926,2.772,942,2.629,949,2.697,958,1.494,1027,2.14,1061,2.629,1204,1.88,1227,1.788,1264,6.927,1310,2.43,1322,3.224,1329,3.408,1355,3.802,1369,2.812,1377,3.177,1422,3.113,1449,2.158,1477,2.948,1513,2.697,1587,2.567,1600,2.537,1643,2.734,1794,2.335,1846,2.629,1998,3.323,2133,8.153,2165,15.636,2176,3.613,2180,10.046,2181,6.156,2184,6.156,2185,6.156,2186,6.156,2187,6.156,2188,3.613,2207,4.088,2208,4.088,2209,4.088,2210,6.796,2211,6.963,2212,3.613,2213,8.041,2214,4.088,2215,4.088,2216,9.096,2217,4.088,2218,4.088,2219,4.088,2220,15.927,2221,4.088,2222,4.088,2223,12.049,2224,4.088,2225,4.088,2226,4.088,2227,6.963,2228,9.096,2229,4.088,2230,4.088,2231,6.963,2232,4.088,2233,4.088,2234,4.088,2235,9.096,2236,4.088,2237,4.088,2238,4.088,2239,4.088,2240,4.088,2241,4.088,2242,6.963,2243,4.088,2244,4.088,2245,4.088,2246,3.323,2247,3.408,2248,4.088,2249,4.088,2250,4.088,2251,3.741,2252,3.741,2253,4.088,2254,3.741,2255,3.741,2256,3.246,2257,3.408,2258,3.613,2259,3.741,2260,3.741,2261,4.088,2262,4.088,2263,6.963,2264,4.088,2265,4.088,2266,4.088,2267,4.088,2268,4.088,2269,6.963,2270,4.088,2271,3.613,2272,3.504,2273,4.088,2274,3.741,2275,4.088,2276,4.088,2277,3.613,2278,2.772,2279,4.088,2280,2.663]],["keywords/185",[]],["title/186",[3,98.292,58,113.175,79,217.583]],["content/186",[]],["keywords/186",[]],["title/187",[79,264.052,426,564.994]],["content/187",[3,1.922,58,2.213,79,4.975,85,11.306,370,9.616,615,12.956,2281,14.738,2282,13.552]],["keywords/187",[]],["title/188",[449,464.807]],["content/188",[3,1.708,58,1.967,79,5.228,82,8.777,396,8.092,416,7.096,449,5.234,508,6.48,679,10.314,1060,9.305,1106,9.439,1157,9.095,1161,7.341,1247,11.516,1346,6.962,1514,9.941,1655,12.046,1675,12.046,2021,9.024,2192,7.05,2278,10.05,2282,12.046,2283,14.818,2284,13.1,2285,14.818,2286,10.824,2287,9.907,2288,10.824,2289,14.818,2290,14.818,2291,10.824,2292,10.824,2293,10.824,2294,10.824]],["keywords/188",[]],["title/189",[434,639.068]],["content/189",[55,7.866,58,2.061,62,6.225,79,4.973,157,4.347,163,9.014,174,6.876,175,7.981,178,9.327,179,5.073,434,8.501,470,6.37,508,3.735,661,5.168,687,4.431,699,6.824,720,9.429,818,7.654,888,11.053,924,12.068,967,7.436,1019,5.043,1061,7.461,1074,7.654,1106,8.066,1370,8.51,1405,10.253,1421,9.429,1566,10.247,1636,6.504,1802,9.211,2165,11.825,2210,8.665,2213,10.253,2282,9.429,2295,8.229,2296,11.599,2297,13.727,2298,11.599,2299,11.599,2300,11.599,2301,11.599]],["keywords/189",[]],["title/190",[585,1022.656]],["content/190",[79,4.254,174,7.382,343,12.455,436,7.337,508,5.369,598,15.886,1606,11.644,2295,11.828,2302,11.001]],["keywords/190",[]],["title/191",[1627,682.927,2303,841.289]],["content/191",[]],["keywords/191",[]],["title/192",[1106,683.567]],["content/192",[]],["keywords/192",[]],["title/193",[157,387.826,416,495.593]],["content/193",[3,1.703,50,4.152,61,9.501,79,3.769,87,8.968,110,6.384,157,5.536,260,4.437,293,9.169,305,5.709,460,5.453,958,5.399,1027,7.734,1152,11.035,1204,6.794,2304,13.058,2305,14.771,2306,14.771,2307,14.771,2308,14.771,2309,14.771,2310,14.771,2311,14.771]],["keywords/193",[]],["title/194",[45,357.876]],["content/194",[45,4.048,79,3.798,110,6.433,115,5.52,149,5.039,174,6.591,182,6.759,470,7.475,508,4.793,660,5.694,661,6.632,663,9.318,687,4.613,739,5.635,1272,9.574,1369,10.241,2280,9.695,2312,14.884,2313,14.884]],["keywords/194",[]],["title/195",[79,264.052,739,391.804]],["content/195",[3,1.291,19,7.203,48,9.336,56,3.451,57,5.863,58,2.013,79,3.869,101,6.113,106,3.281,115,3.392,182,5.085,237,2.997,260,3.364,330,7.489,339,4.46,380,7.705,470,4.594,510,5.305,608,9.599,739,5.741,760,4.62,778,6.459,870,4.374,904,7.945,958,5.542,1027,5.863,1106,7.877,1204,5.151,1276,6.798,1304,6.976,1312,6.951,1346,7.203,1382,7.705,1411,6.726,1415,6.364,1449,5.911,1480,7.115,1497,6.061,1501,7.389,1587,9.523,1794,6.397,2148,8.702,2314,8.527,2315,15.201,2316,11.198,2317,11.198,2318,10.25,2319,11.198,2320,9.899,2321,10.25,2322,11.198]],["keywords/195",[]],["title/196",[79,264.052,1210,546.292]],["content/196",[3,0.837,43,4.41,50,1.663,58,0.964,62,3.899,72,4.63,79,2.831,98,3.835,106,3.639,110,3.14,115,4.079,149,2.459,152,2.98,182,5.039,197,2.655,198,4.616,218,2.616,237,4.345,238,1.929,241,4.63,260,2.182,293,4.509,325,5.007,327,5.467,328,4.859,338,2.288,339,3.96,341,3.882,345,2.616,357,5.532,364,2.268,397,3.966,458,3.511,459,3.605,460,4.97,470,7.532,476,3.579,488,4.509,499,6.34,503,6.833,654,2.603,660,6.547,687,3.408,717,4.074,718,4.363,739,4.201,762,3.455,918,7.873,958,2.655,965,7.873,966,7.873,1105,5.33,1106,5.764,1175,5.769,1210,3.835,1272,4.673,1382,4.998,1408,6.422,1440,10.463,1586,5.33,1617,6.422,1668,5.33,1694,4.859,1728,8.003,1786,5.427,1794,4.15,1924,8.624,2198,5.427,2281,6.422,2314,5.532,2315,9.81,2323,8.418,2324,7.265,2325,7.265,2326,7.265,2327,6.422,2328,10.945,2329,6.422,2330,7.265,2331,8.418,2332,8.418,2333,8.418,2334,7.265,2335,7.265,2336,7.265,2337,7.265,2338,8.418,2339,6.923,2340,7.265,2341,7.265,2342,6.649,2343,8.418,2344,7.265,2345,4.363,2346,6.923,2347,6.422,2348,8.418,2349,7.265,2350,6.422]],["keywords/196",[]],["title/197",[157,387.826,508,333.282]],["content/197",[12,5.1,18,0.872,19,4.708,56,2.256,58,1.795,72,3.054,79,1.868,106,3.799,107,3.928,115,3.381,118,4.182,149,3.778,152,3.003,237,4.049,238,3.591,260,2.199,325,3.302,338,2.306,341,2.561,345,2.636,348,7.918,350,4.455,356,9.305,397,3.996,413,4.35,454,5.813,457,3.481,458,4.28,460,4.993,470,6.207,487,5.813,488,4.543,499,4.182,503,5.664,508,4.356,510,3.904,552,4.031,572,6.975,652,5.459,654,2.623,661,3.261,663,5.707,678,4.263,687,4.124,695,5.42,739,2.771,760,3.02,901,3.367,1077,6.274,1106,3.802,1204,3.367,1217,4.492,1322,5.167,1514,4.306,1528,5.193,1547,5.95,1600,6.928,1703,3.743,1727,5.95,1728,9.755,1841,4.651,2070,5.813,2133,6.501,2198,5.468,2280,4.768,2314,5.574,2327,6.47,2328,5.95,2329,6.47,2351,7.319,2352,7.319,2353,7.319,2354,7.319,2355,7.319,2356,7.319,2357,7.319,2358,7.319,2359,7.319,2360,7.319,2361,5.574,2362,7.319,2363,7.319,2364,11.16,2365,7.319,2366,7.319,2367,6.47,2368,9.567,2369,7.319,2370,6.47,2371,7.319,2372,7.319,2373,7.319,2374,7.319,2375,11.16,2376,6.47,2377,7.319,2378,7.319]],["keywords/197",[]],["title/198",[50,301.275]],["content/198",[3,0.485,5,2.154,11,1.976,12,1.925,16,1.963,18,1.919,22,1.426,50,3.564,54,2.614,56,1.298,58,1.885,60,2.98,72,3.88,76,1.586,79,2.373,80,1.95,82,2.188,92,3.519,106,3.555,115,4.717,119,2.384,152,1.728,169,1.95,174,5.9,180,4.336,191,4.29,197,1.539,199,4.013,218,1.517,238,3.255,241,4.571,245,4.336,260,1.265,263,4.013,273,3.243,293,4.433,303,2.856,323,2.98,325,3.223,327,3.519,338,1.327,350,2.352,364,1.315,412,2.709,430,2.319,436,1.853,438,3.74,457,2.003,458,3.88,460,4.043,470,6.804,499,2.406,508,1.356,510,1.473,512,1.188,580,1.865,589,3.511,611,4.013,639,2.942,649,1.747,661,4.143,687,3.941,695,4.516,715,2.06,717,2.362,739,3.521,775,4.013,814,2.676,884,3.625,896,2.09,901,4.277,958,3.399,968,3.424,1019,1.831,1065,1.831,1068,2.154,1073,2.242,1077,3.61,1081,5.586,1082,2.242,1093,2.709,1106,4.831,1130,7.326,1156,5.336,1160,4.013,1204,1.937,1210,3.77,1217,2.585,1225,3.146,1227,4.068,1272,2.709,1274,3.801,1276,2.557,1299,2.28,1304,1.937,1368,5.672,1369,2.898,1382,2.898,1399,3.544,1445,2.942,1467,2.779,1569,6.343,1600,2.614,1625,3.207,1627,2.779,1628,3.723,1636,2.362,1668,3.09,1703,3.652,1728,8.843,1786,3.146,1793,9.498,1804,6.314,1821,4.433,1872,3.511,1904,3.723,1924,3.273,1926,3.723,1927,2.478,1964,2.557,2020,9.556,2246,3.424,2247,3.511,2277,3.723,2280,2.743,2297,3.723,2314,3.207,2328,5.806,2342,3.855,2361,3.207,2367,3.723,2370,3.723,2379,10.953,2380,7.142,2381,5.151,2382,3.723,2383,3.424,2384,4.212,2385,7.142,2386,7.142,2387,7.593,2388,7.142,2389,4.212,2390,4.989,2391,4.212,2392,7.142,2393,4.212,2394,3.511,2395,4.212,2396,4.212,2397,4.212,2398,4.212,2399,4.212,2400,4.212,2401,4.212,2402,4.212,2403,3.723,2404,3.855,2405,4.212,2406,3.723,2407,4.212,2408,4.212,2409,4.212,2410,3.723,2411,4.212,2412,4.212,2413,4.212,2414,4.212,2415,4.212,2416,3.855,2417,4.212,2418,4.212,2419,3.723,2420,3.511,2421,4.212,2422,4.212,2423,4.212,2424,4.212,2425,4.212,2426,4.212]],["keywords/198",[]],["title/199",[2427,1163.321]],["content/199",[18,2.212,50,3.515,58,2.038,76,5.783,79,3.918,85,10.413,364,4.795,382,5.843,678,8.944,739,5.813,776,6.841,1095,9.642,1103,9.222,1106,7.976,1175,12.194,2428,15.355,2429,15.355,2430,14.054]],["keywords/199",[]],["title/200",[22,350.355,125,469.918]],["content/200",[22,5.844,82,8.967,396,8.267,508,5.56,678,10.056]],["keywords/200",[]],["title/201",[157,387.826,416,495.593]],["content/201",[3,1.77,58,2.038,61,9.877,79,3.918,87,9.322,110,6.636,157,5.754,204,5.998,260,4.612,293,9.531,510,5.372,654,5.503,876,10.002,958,5.612,1152,11.471,1409,9.322,2304,13.574,2431,15.355,2432,15.355]],["keywords/201",[]],["title/202",[45,357.876]],["content/202",[65,9.323,79,3.605,95,4.373,157,5.294,202,12.489,305,5.461,382,5.376,449,4.99,509,8.149,512,3.985,513,7.781,654,5.063,772,10.758,778,8.149,796,6.719,900,11.779,914,13.462,957,13.462,1065,6.142,1103,8.485,1156,10.554,1284,8.977,1501,9.323,2191,9.867,2206,11.219,2433,14.127,2434,14.127,2435,14.127,2436,14.127,2437,14.127]],["keywords/202",[]],["title/203",[79,264.052,318,541.885]],["content/203",[3,1.329,7,5.521,56,3.554,58,2.475,80,5.338,106,3.107,128,9.613,145,5.68,160,7.326,204,6.817,237,3.086,241,4.811,260,3.463,305,4.457,339,3.391,396,5.521,436,6.807,456,7.925,458,3.648,473,8.459,510,4.034,512,4.363,513,6.35,514,6.651,516,8.614,518,7.82,519,11.155,551,10.987,870,4.504,944,8.78,967,5.521,1157,7.077,1415,4.839,1449,6.086,1465,8.96,1477,8.315,1480,7.326,1525,9.601,1587,7.24,1703,5.896,1713,8.459,2080,10.193,2438,8.78,2439,9.157,2440,8.78,2441,9.613,2442,9.884,2443,11.53]],["keywords/203",[]],["title/204",[778,759.051]],["content/204",[3,0.831,5,3.687,45,1.961,58,1.779,79,2.815,106,3.835,177,5.604,237,5.128,238,4.53,241,3.009,245,4.378,304,6.229,328,4.823,338,2.271,339,2.121,341,5.253,345,3.973,350,4.945,396,5.284,434,3.502,449,2.547,457,3.429,458,2.281,459,3.578,476,3.552,488,6.849,499,4.119,511,6.463,512,2.034,513,3.971,514,4.159,520,5.824,521,5.2,522,5.862,523,5.862,526,5.491,527,6.871,660,2.758,661,3.213,687,3.393,693,7.828,739,2.73,778,4.159,880,3.776,918,5.116,926,4.89,965,5.116,966,5.116,967,3.453,1123,7.375,1276,4.378,1310,4.286,1355,3.937,1467,4.758,1586,5.29,1598,4.582,1627,4.758,1669,7.515,1719,4.331,1723,4.582,1724,5.387,1725,5.604,1729,5.116,2064,5.604,2105,6.374,2133,4.2,2246,5.862,2303,5.862,2342,6.6,2345,4.331,2438,5.491,2444,7.211,2445,7.211,2446,7.211,2447,7.211,2448,4.961,2449,9.199,2450,6.012,2451,5.29,2452,5.604,2453,8.355,2454,8.355,2455,8.355,2456,8.355,2457,7.211,2458,7.211,2459,7.211,2460,7.211,2461,7.211,2462,11.034,2463,7.211,2464,7.211,2465,7.211,2466,7.211]],["keywords/204",[]],["title/205",[161,1097.182]],["content/205",[7,2.758,20,2.796,24,4.573,45,2.515,58,0.764,89,3.321,106,3.901,107,3.09,149,1.949,152,2.362,157,2.158,160,5.877,171,4.153,193,3.659,218,2.074,237,4.806,238,4.33,260,3.482,270,4.086,321,3.659,338,1.814,339,1.693,341,3.236,345,5.235,350,3.818,396,4.429,436,5.841,457,2.739,458,3.667,460,2.126,470,7.179,491,8.64,503,2.922,508,2.979,511,5.59,528,3.751,529,5.487,530,3.905,535,3.851,539,4.022,543,4.022,544,12.214,546,4.022,548,3.962,549,4.225,552,3.171,687,1.458,688,3.962,803,3.659,876,3.751,918,4.086,949,3.8,965,4.086,966,4.086,967,2.758,1123,8.667,1156,4.302,1355,6.328,1586,4.225,1710,3.851,2133,10.689,2197,4.801,2198,4.302,2438,4.385,2448,10.001,2451,4.225,2467,5.271,2468,5.758,2469,5.758,2470,4.801,2471,4.801,2472,4.475,2473,4.801,2474,4.801,2475,7.711,2476,5.758,2477,4.801,2478,4.801,2479,11.591,2480,5.271,2481,5.758,2482,4.801,2483,4.801,2484,4.801,2485,4.801,2486,5.758,2487,5.271,2488,9.249,2489,5.758,2490,5.758,2491,5.758,2492,5.758]],["keywords/205",[]],["title/206",[50,301.275]],["content/206",[18,1.341,50,3.118,58,0.982,106,3.96,145,4.724,149,3.247,160,2.791,164,3.223,233,6.022,237,1.175,238,3.615,260,2.223,273,5.11,293,2.726,319,2.007,323,1.833,331,7.633,350,1.447,364,1.372,396,6.016,436,4.22,449,3.387,460,1.621,470,5.587,491,8.612,493,5.886,499,2.509,510,1.537,512,2.088,513,4.076,514,6.492,520,2.319,544,8.76,660,1.68,661,3.297,717,2.463,732,5.092,758,3.571,778,2.534,803,2.791,814,2.791,838,2.18,958,3.505,967,6.938,1028,4.186,1068,2.246,1073,2.338,1093,6.169,1123,6.844,1204,3.404,1299,2.377,1322,3.426,1380,2.979,1399,2.18,1447,2.861,1569,5.782,1719,4.445,1793,9.109,1822,3.345,1850,3.883,1927,2.584,1958,3.571,1977,3.116,1996,3.571,2020,4.542,2257,3.662,2280,2.861,2361,3.345,2381,6.916,2383,3.571,2390,7.861,2438,3.345,2472,3.413,2493,3.883,2494,3.883,2495,3.883,2496,3.883,2497,3.662,2498,6.016,2499,6.016,2500,8.478,2501,5.877,2502,3.883,2503,3.883,2504,3.883,2505,3.345,2506,3.883,2507,10.213,2508,10.475,2509,7.796,2510,3.883,2511,3.883,2512,7.796,2513,3.883,2514,5.636,2515,3.883,2516,3.883,2517,9.949,2518,6.542,2519,3.883,2520,6.016,2521,3.883,2522,3.883,2523,3.883,2524,3.883,2525,4.392,2526,6.542,2527,9.949,2528,4.392,2529,11.106,2530,4.392,2531,4.392,2532,4.392,2533,4.392,2534,6.542,2535,6.542,2536,4.392,2537,7.401,2538,4.392,2539,4.02,2540,4.392,2541,4.392,2542,3.883,2543,4.02,2544,4.392,2545,3.883,2546,4.392]],["keywords/206",[]],["title/207",[22,350.355,125,469.918]],["content/207",[79,4.182,179,7.169,218,5.902,396,7.849,870,6.402,891,13.324,1106,8.514,1627,10.816,2278,11.116,2303,13.324,2547,16.39]],["keywords/207",[]],["title/208",[12,288.256,18,75.13,258,243.803,364,196.957,760,260.224]],["content/208",[]],["keywords/208",[]],["title/209",[18,156.743]],["content/209",[18,1.523,58,0.888,106,3.848,110,2.891,113,9.736,150,6.805,152,2.744,179,2.926,218,2.409,237,4.184,238,2.764,239,3.369,260,5.516,266,6.127,304,6.869,305,4.025,338,4.545,339,4.598,341,2.34,345,3.75,456,6.552,459,3.32,476,3.296,509,7.375,510,4.473,511,6.165,512,4.071,654,2.397,660,3.983,778,8.323,796,4.952,803,4.251,838,3.32,918,7.388,962,6.375,963,4.415,965,7.388,966,7.388,1061,4.303,1103,4.018,1210,3.531,1244,12.15,1385,7.062,1415,2.807,1432,6.69,1439,7.522,1447,4.358,1452,5.438,1470,11.561,1477,4.825,1501,4.415,1536,5.199,1553,6.066,1627,4.415,1715,3.976,2054,4.603,2076,4.537,2085,5.914,2094,11.302,2113,9.923,2548,6.69,2549,5.914,2550,6.69,2551,5.914,2552,9.205,2553,9.205,2554,6.69,2555,6.69,2556,10.413,2557,10.413,2558,6.69,2559,6.69,2560,6.69,2561,6.69,2562,6.69,2563,6.69,2564,6.69,2565,6.69,2566,5.914,2567,5.914]],["keywords/209",[]],["title/210",[18,123.267,364,323.151]],["content/210",[3,0.863,8,5.42,18,1.634,22,2.535,31,4.546,56,3.5,58,1.507,106,3.811,115,2.269,119,4.238,152,4.659,176,6.615,187,8.071,204,4.436,208,4.199,209,3.561,211,4.793,241,3.125,258,2.894,260,2.249,266,4.406,288,4.451,342,4.596,364,4.283,458,3.593,512,3.87,596,4.451,660,2.864,669,2.455,718,4.498,850,12.127,1002,12.349,1012,2.864,1123,4.908,1132,8.614,1133,6.894,1135,7.494,1137,14.457,1138,4.451,1140,8.484,1143,6.419,1144,5.595,1145,6.854,1553,4.362,1764,5.702,1793,5.008,2549,6.62,2568,10.394,2569,10.394,2570,6.854,2571,6.854,2572,6.854,2573,6.419,2574,6.854,2575,6.854,2576,6.854,2577,6.854,2578,7.488,2579,11.356,2580,9.468,2581,7.488,2582,7.488,2583,7.488,2584,7.488,2585,7.488,2586,7.488,2587,7.488,2588,7.488,2589,7.488,2590,7.488,2591,6.854,2592,7.488,2593,7.488,2594,7.488,2595,7.488,2596,7.488,2597,7.488]],["keywords/210",[]],["title/211",[654,370.874,1501,682.927]],["content/211",[12,4.342,18,1.132,56,2.928,58,1.261,62,5.099,101,5.187,106,3.056,107,9.214,150,5.057,152,6.464,204,6.154,241,3.965,260,2.854,303,6.444,305,3.672,382,3.616,412,10.135,453,6.852,456,6.143,654,6.153,686,8.697,699,7.96,719,7.098,760,3.92,778,5.48,793,8.145,794,7.546,796,6.434,799,6.852,838,6.714,906,8.145,1065,4.131,1387,10.423,1501,11.329,1535,11.998,1536,7.384,1540,8.399,1550,7.724,1553,5.534,1568,5.48,1671,5.768,1857,12.613,2552,8.399,2553,8.399,2566,8.399,2567,8.399,2598,13.529,2599,9.501,2600,15.677,2601,16.672,2602,15.677,2603,7.724,2604,8.399,2605,9.501,2606,9.501,2607,9.501,2608,8.399]],["keywords/211",[]],["title/212",[12,472.947,760,426.953]],["content/212",[11,1.571,12,5.773,18,0.399,58,1.037,69,3.191,106,3.939,107,4.195,113,8.119,118,1.913,152,3.849,188,6.91,191,2.011,204,5.931,211,1.413,237,1.568,238,3.354,239,1.686,241,1.397,260,4.935,273,4.841,278,5.585,303,2.271,304,3.892,305,4.534,319,1.53,331,6.362,332,5.024,339,1.724,350,3.863,361,2.55,385,2.103,412,5.028,451,2.415,456,4.841,499,1.913,511,2.826,512,3.564,520,1.768,669,1.098,695,1.626,699,10.623,702,2.87,732,7.336,750,2.96,760,1.381,767,6.354,778,6.765,793,2.87,794,2.659,796,5.071,799,2.415,803,2.128,838,4.655,870,1.308,906,2.87,917,5.585,918,4.158,940,2.96,965,4.158,975,2.415,1015,2.078,1065,2.548,1130,2.239,1134,5.839,1161,2.271,1244,9.817,1286,5.585,1340,7.822,1387,2.033,1503,2.339,1510,2.55,1513,2.21,1519,2.722,1550,4.765,1553,6.832,1558,2.602,1627,2.21,1710,8.967,1785,2.659,1811,2.304,1857,8.967,2054,4.033,2076,5.301,2143,2.602,2210,4.379,2212,2.96,2278,2.271,2394,4.887,2406,8.293,2551,2.96,2580,2.792,2601,10.369,2603,2.722,2604,2.96,2608,2.96,2609,3.065,2610,3.348,2611,3.348,2612,3.348,2613,3.065,2614,3.348,2615,3.348,2616,3.348,2617,3.348,2618,3.348,2619,3.348,2620,3.348,2621,5.861,2622,3.348,2623,9.381,2624,3.348,2625,7.816,2626,3.348,2627,5.861,2628,5.861,2629,5.861,2630,3.348,2631,3.348,2632,3.348,2633,3.348,2634,3.348,2635,3.348,2636,3.348,2637,3.348,2638,3.348,2639,3.88,2640,7.816,2641,5.861,2642,3.348,2643,3.348,2644,5.861,2645,3.348,2646,3.348,2647,3.348,2648,5.365,2649,2.602,2650,3.348,2651,7.154,2652,3.348,2653,5.861,2654,3.348,2655,5.861,2656,3.348,2657,3.88,2658,3.348,2659,3.348,2660,3.348,2661,3.348,2662,3.348,2663,3.348,2664,3.065,2665,3.348,2666,3.348,2667,3.348,2668,3.348,2669,3.348,2670,3.348,2671,3.348,2672,5.861,2673,3.348,2674,3.348,2675,5.861,2676,3.348,2677,3.348,2678,3.348,2679,2.792,2680,3.348,2681,3.348,2682,3.348,2683,3.065,2684,3.348,2685,3.348,2686,3.348,2687,3.348,2688,3.348,2689,3.348,2690,3.348,2691,3.348,2692,3.348,2693,3.348]],["keywords/212",[]],["title/213",[3,119.285,416,495.593]],["content/213",[]],["keywords/213",[]],["title/214",[22,350.355,125,469.918]],["content/214",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/214",[]],["title/215",[3,119.285,416,495.593]],["content/215",[]],["keywords/215",[]],["title/216",[22,350.355,125,469.918]],["content/216",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/216",[]],["title/217",[2302,868.391]],["content/217",[]],["keywords/217",[]],["title/218",[45,357.876]],["content/218",[18,1.858,48,13.008,79,3.981,92,7.686,319,7.13,600,11.069,649,6.473,687,3.949,739,5.906,760,8.292,1299,8.444,1606,10.897,2694,10.734,2695,15.601,2696,15.601]],["keywords/218",[]],["title/219",[460,382.009,958,378.226]],["content/219",[3,1.321,58,2.045,82,5.954,106,3.696,174,6.821,179,5.014,237,5.195,318,6.002,337,7.886,339,4.531,458,5.505,460,5.687,503,5.817,715,5.606,739,4.339,918,10.93,958,6.36,965,10.93,966,10.93,1380,7.773,1449,6.05,1480,7.283,1586,11.303,1924,8.907,2198,8.563,2346,10.922,2694,10.6,2697,15.405,2698,15.405,2699,11.462,2700,12.523,2701,11.462,2702,8.266,2703,11.462,2704,11.462]],["keywords/219",[]],["title/220",[79,264.052,318,541.885]],["content/220",[18,1.733,57,7.619,58,1.931,79,3.712,106,3.624,237,3.894,339,4.279,480,7.681,510,5.09,654,5.214,1027,7.619,1415,6.106,1587,9.137,1986,10.011,1991,9.731,2191,10.163,2302,9.602,2320,12.863,2694,12.363,2700,11.828,2702,10.494,2705,12.863]],["keywords/220",[]],["title/221",[319,472.947,600,734.248]],["content/221",[12,4.661,18,2.298,20,4.953,45,2.774,79,2.602,106,3.771,218,3.673,237,4.382,238,4.347,260,3.064,319,6.499,338,3.213,341,4.976,350,3.359,380,7.018,480,5.384,600,7.236,649,5.901,661,4.544,687,3.6,760,6.756,880,5.34,901,4.691,1061,6.56,1175,8.1,1217,6.26,1313,8.743,1415,4.28,1532,9.016,1600,6.331,1606,7.124,1846,6.56,2271,9.016,2302,6.73,2339,9.719,2350,9.016,2694,11.267,2702,7.356,2705,12.573,2706,10.199,2707,10.199,2708,10.199,2709,14.222,2710,10.199,2711,10.199,2712,10.199,2713,8.743,2714,10.199,2715,8.743,2716,10.199,2717,10.199,2718,10.199,2719,10.199]],["keywords/221",[]],["title/222",[1165,774.227]],["content/222",[18,1.415,43,7.214,79,3.032,106,3.809,141,9.437,174,6.988,237,4.223,238,4.189,341,4.157,345,5.683,687,3.008,718,9.478,760,7.31,762,5.651,949,7.841,958,4.343,992,9.437,1204,5.466,1322,5.501,1355,8.615,1625,9.048,2302,7.841,2694,12.191,2700,14.403,2702,8.57,2720,11.882,2721,10.504,2722,11.882,2723,11.882,2724,11.882,2725,10.504,2726,11.882,2727,11.882,2728,11.882,2729,11.882]],["keywords/222",[]],["title/223",[1186,615.129,2302,682.927]],["content/223",[18,2.05,19,5.353,50,3.345,57,4.357,58,2.284,63,6.337,76,3.135,79,3.136,80,3.853,106,3.874,115,3.723,152,5.042,198,5.288,218,2.997,237,4.606,238,4.569,260,3.691,273,3.779,323,3.472,338,3.871,339,2.447,341,2.911,345,5.262,350,2.741,485,7.617,486,9.99,508,2.68,687,2.107,715,4.07,760,3.433,814,5.288,838,4.13,942,5.353,1027,4.357,1068,4.256,1073,4.429,1093,5.353,1186,8.685,1191,6.337,1199,7.93,1201,7.617,1202,7.93,1385,5.644,1395,7.381,1398,5.288,1399,4.13,1415,3.492,1782,6.106,1964,5.052,2302,5.492,2694,5.726,2702,6.002,2721,7.357,2725,7.357,2730,8.322,2731,14.611,2732,8.322,2733,8.322,2734,8.322,2735,8.322,2736,8.322,2737,8.322,2738,8.322,2739,8.322,2740,8.322,2741,8.322,2742,8.322,2743,8.322,2744,8.322,2745,8.322,2746,11.248,2747,8.322]],["keywords/223",[]],["title/224",[3,119.285,416,495.593]],["content/224",[]],["keywords/224",[]],["title/225",[22,350.355,125,469.918]],["content/225",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/225",[]],["title/226",[552,469.66,654,305.605,1409,517.71]],["content/226",[]],["keywords/226",[]],["title/227",[552,469.66,1410,753.863,1411,512.201]],["content/227",[3,2.153,15,6.549,18,1.847,56,2.845,58,2.058,132,6.549,157,3.459,178,5.544,182,4.191,204,6.056,218,3.324,258,5.122,260,5.779,305,7.219,385,5.796,436,4.062,456,8.148,510,5.928,512,2.604,552,5.084,650,6.351,654,6.43,796,4.39,880,6.939,905,5.937,924,7.173,944,7.029,1019,4.013,1027,6.939,1081,5.544,1082,7.053,1227,4.038,1312,5.73,1409,5.604,1410,8.16,1411,9.312,1412,8.449,1413,9.231,1414,9.231,1415,7.839,1416,8.801,1417,10.092,1418,8.449,1419,10.092,1420,9.231,1421,10.773,1422,7.029,1423,7.173,1424,8.16,1425,9.231,1426,8.449,1427,6.549,1428,6.549]],["keywords/227",[]],["title/228",[552,469.66,654,305.605,1409,517.71]],["content/228",[]],["keywords/228",[]],["title/229",[950,949.064]],["content/229",[3,1.468,12,5.822,72,5.315,79,4.215,106,3.665,133,9.038,237,3.409,260,6.036,305,4.924,337,8.765,339,3.746,654,4.565,663,8.447,664,11.261,687,3.225,950,11.913,976,9.9,1019,5.538,1027,6.67,1127,8.406,1191,12.578,1411,7.651,1415,5.346,1429,10.621,1430,12.739,1431,11.66,1433,11.261,1434,12.739,1435,12.739,1558,9.9,2143,9.9,2748,13.542]],["keywords/229",[]],["title/230",[456,469.918,1409,628.279]],["content/230",[3,1.32,58,1.833,75,4.703,76,2.854,79,4.22,82,3.935,95,3.546,106,3.511,115,2.295,132,5.375,139,6.017,204,5.396,218,2.728,232,7.77,237,3.697,238,3.041,260,5.427,304,7.718,338,3.609,339,2.228,341,2.65,345,2.728,350,3.773,382,2.883,434,5.564,449,2.676,456,8.447,474,7.219,480,3.999,510,4.008,511,3.653,650,5.213,654,2.715,660,2.898,687,1.918,695,3.679,760,3.126,838,5.685,859,6.017,876,7.462,884,3.845,896,3.76,904,5.375,907,5.66,942,4.873,961,5.375,1027,3.967,1065,3.294,1227,3.314,1284,4.814,1299,4.101,1304,3.485,1409,4.599,1419,5.769,1421,6.159,1436,6.934,1437,6.934,1438,7.576,1439,4.457,1442,5.464,1443,7.576,1444,5.888,1445,5.292,1446,6.697,1447,4.935,1448,5.375,1449,3.999,1450,7.576,1451,6.697,1452,6.159,1453,7.576,1454,7.576,1455,6.697,1456,7.576,1457,7.576,1458,7.576,1459,7.576,1460,11.456,1461,11.456,1462,7.576,1463,7.576,1464,7.576,1465,5.888,1466,5.292,1467,4.999,1468,4.999,1469,5.769,1470,5.067,1471,7.576,1472,7.576,1473,7.576,1474,7.576,1475,6.317,1476,7.576,1477,5.464,1598,4.814,2749,5.213]],["keywords/230",[]],["title/231",[18,123.267,1478,914.868]],["content/231",[18,1.184,45,2.703,58,2.143,106,3.81,233,6.241,237,4.939,238,4.65,273,4.513,304,7.657,338,3.131,339,2.923,341,3.477,345,5.03,350,5.319,449,5.704,456,4.513,458,5.109,552,5.474,654,3.562,838,6.931,950,7.168,970,8.786,1123,4.295,1179,8.786,1186,5.907,1449,5.246,1451,8.786,1455,12.347,1478,14.275,1479,9.938,1480,6.315,1481,8.519,1482,9.938,1483,9.938,1484,9.938,1485,9.938,1486,9.938,1487,9.938,1488,9.938,1489,9.938,1490,14.604,1491,9.217,1492,13.967,1493,9.938,1494,9.938,1495,9.938]],["keywords/231",[]],["title/232",[853,965.506]],["content/232",[3,1.92,6,7.109,17,5.578,18,2.197,46,7.753,65,8.518,79,4.251,87,7.836,101,7.047,103,13.23,131,8.012,148,11.065,157,4.837,178,7.753,179,5.646,204,6.508,260,3.877,305,6.439,382,4.912,508,4.157,552,7.109,654,4.626,760,5.325,915,12.3,950,9.309,1027,6.759,1164,9.829,1191,9.829,1409,7.836,1444,10.031,1465,10.031,1496,12.908,1497,6.987,1498,12.908,1499,12.908,1500,9.829]],["keywords/232",[]],["title/233",[1304,605.3]],["content/233",[]],["keywords/233",[]],["title/234",[1054,744.754]],["content/234",[16,6.781,17,6.288,18,2.14,29,8.235,56,4.485,60,6.071,87,8.833,110,6.288,215,10.163,285,9.478,324,7.875,449,5.139,459,7.22,577,13.318,687,3.683,1054,8.235,1157,8.931,1304,8.265,1348,17.968,1349,13.318,1350,14.55,1351,11.307,1352,9.868]],["keywords/234",[]],["title/235",[95,407.35]],["content/235",[106,3.879,215,8.15,237,3.123,238,3.098,243,7.7,260,3.505,285,7.601,319,5.332,345,4.202,449,4.121,457,7.415,458,4.933,511,5.627,687,2.954,760,4.814,890,6.865,958,4.264,1054,6.604,1123,7.588,1204,5.367,1298,9.485,1322,5.402,1352,7.913,1353,10.68,1354,10.68,1355,6.37,1356,9.729,1357,14.27,1358,9.068,1359,7.913,1360,10.68,1361,11.668,1362,9.267,1363,10.68,1364,10.68,1365,10.68,1366,8.028,1367,11.668,1368,9.267,1369,8.028,1370,8.561,1371,10.68]],["keywords/235",[]],["title/236",[1369,712.065,1372,1034.893]],["content/236",[3,1.44,6,6.881,17,5.399,18,1.943,58,1.658,74,11.905,80,5.784,115,5.501,134,10.416,145,6.155,173,8.138,181,8.726,182,7.406,251,9.514,319,5.709,441,11.044,597,9.709,600,8.864,649,5.183,661,5.566,687,4.597,760,5.154,818,8.244,876,8.138,880,6.542,890,7.35,949,8.244,1276,7.585,1304,5.747,1373,16.31,1374,16.31,1375,12.493,1376,11.435,1377,9.709,1378,9.922,1379,11.435,1380,8.473,1381,12.493,1382,8.596,1383,10.156]],["keywords/236",[]],["title/237",[95,407.35]],["content/237",[18,1.268,50,3.354,58,1.944,106,3.954,152,6.01,188,5.487,237,3.921,238,4.447,273,4.834,288,6.328,338,4.615,339,3.131,341,5.126,345,5.276,350,3.506,697,10.749,809,10.145,814,6.765,838,5.283,1068,5.444,1073,5.666,1186,6.328,1383,8.654,1384,16.751,1385,7.22,1386,10.646,1387,6.463,1388,10.646,1389,10.646,1390,10.646,1391,10.646,1392,10.646,1393,10.646,1394,9.411,1395,8.8,1396,8.876,1397,10.646,1398,6.765,1399,5.283,1400,10.646,1401,10.646,1402,10.646]],["keywords/237",[]],["title/238",[1304,476.025,1403,1034.893]],["content/238",[72,5.769,106,3.745,110,5.975,180,8.394,238,4.621,324,7.483,382,5.261,459,6.861,687,3.5,890,8.134,944,10.528,1054,7.825,1161,11.804,1304,8.762,1352,11.804,1382,9.513,1383,11.239,1404,10.98,1405,12.222,1406,13.826,1407,14.149,1408,12.222]],["keywords/238",[]],["title/239",[18,101.574,258,329.615,1323,541.872]],["content/239",[]],["keywords/239",[]],["title/240",[18,101.574,258,329.615,1323,541.872]],["content/240",[3,1.97,18,2.185,22,3.748,58,1.997,62,5.941,143,11.459,176,6.448,197,4.046,209,7.157,258,7.09,378,7.984,380,7.617,409,6.097,416,5.301,512,4.823,656,7.305,669,4.934,682,7.732,701,6.152,708,8.853,714,9.23,763,6.324,819,8.603,887,7.854,1012,6.539,1065,4.813,1130,7.404,1131,7.06,1232,8.792,1323,7.034,1324,9.786,1325,8.999,1326,13.968,1327,9.786,1328,11.07,1329,9.23,1330,9.786,1331,8.43,1332,8.999,1333,13.302,1334,11.07,1335,11.07,1336,8.271,1337,9.786,1338,11.07,1339,8.999]],["keywords/240",[]],["title/241",[18,123.267,703,821.883]],["content/241",[3,1.508,5,6.69,8,4.309,31,10.201,58,2.23,62,7.021,98,6.905,197,4.781,208,7.335,209,10.03,578,10.389,625,13.345,649,5.428,669,4.289,703,10.389,857,9.137,935,12.119,1012,7.101,1187,12.466,1223,11.214,1254,11.214,1339,15.091,1340,10.907,1341,14.855,1342,11.564,1343,11.974]],["keywords/241",[]],["title/242",[50,195.235,211,359.958,1323,541.872]],["content/242",[3,1.756,8,5.018,50,4.555,56,5.696,58,2.453,191,9.15,211,7.801,669,4.995,776,8.234,1065,6.623,1095,9.566,1131,7.148,1323,9.68,1345,13.467]],["keywords/242",[]],["title/243",[1029,657.601,1346,665.681]],["content/243",[8,4.089,36,5.601,50,3.718,58,2.156,157,6.087,209,7.725,211,5.24,218,4.47,258,6.278,323,5.18,625,9.858,660,4.748,669,5.325,701,6.898,714,10.35,776,5.531,820,12.134,887,8.807,935,8.953,966,8.807,1065,5.397,1095,7.795,1131,5.824,1254,10.641,1324,10.974,1325,10.091,1326,13.786,1327,10.974,1331,9.453,1332,10.091,1333,10.974,1337,10.974,1339,15.611,1341,10.974,1342,10.974,1345,10.974,1347,12.413]],["keywords/243",[]],["title/244",[1716,1002.099]],["content/244",[]],["keywords/244",[]],["title/245",[45,357.876]],["content/245",[65,10.549,79,4.854,149,5.412,396,7.655,470,8.332,663,8.175,1669,8.964,2750,15.986,2751,15.986,2752,15.986,2753,15.986]],["keywords/245",[]],["title/246",[79,264.052,318,541.885]],["content/246",[56,4.172,58,2.504,60,5.649,76,5.099,79,4.813,106,3.057,115,4.101,218,4.875,237,3.623,318,7.088,338,4.264,339,3.981,396,8.225,397,7.39,654,4.851,739,6.502,1106,8.921,1174,11.604,1449,7.146,1500,10.309,1711,11.967,1712,11.967,1716,13.079,1717,10.52,1718,11.967,2754,11.967,2755,13.537]],["keywords/246",[]],["title/247",[1706,892.464]],["content/247",[16,2.955,19,4.078,29,3.588,56,3.078,58,1.325,61,4.078,79,1.618,106,3.845,237,5.203,238,5.161,241,2.646,304,5.814,324,3.432,338,1.997,341,2.218,345,5.83,350,5.58,364,1.98,378,4.573,385,3.981,396,3.036,406,3.555,430,3.492,457,3.016,458,3.908,459,3.146,470,5.067,476,3.124,487,5.035,491,7.342,511,6.757,512,1.789,513,5.499,514,5.76,520,5.271,526,4.828,528,4.13,530,4.3,539,4.429,543,4.429,544,7.945,546,4.429,661,2.825,1106,5.187,1123,7.586,1217,3.892,1222,4.429,1274,3.375,1297,5.287,1355,3.462,1480,4.029,1547,5.154,1566,4.184,1668,4.652,1669,3.555,1706,4.3,1713,4.652,1716,4.828,1719,5.998,1720,5.605,1721,5.605,1723,4.029,1724,4.737,1725,4.927,1727,5.154,1728,4.573,1729,4.499,1731,5.605,2133,10.519,2258,5.605,2441,5.287,2448,9.642,2754,5.605,2756,6.341,2757,6.341,2758,6.341,2759,6.341,2760,6.341,2761,6.341,2762,6.341,2763,6.341,2764,6.341,2765,5.435,2766,6.341,2767,6.341,2768,6.341,2769,5.804,2770,6.341,2771,6.341,2772,5.804,2773,6.341,2774,6.341,2775,6.341,2776,6.341,2777,6.341]],["keywords/247",[]],["title/248",[2427,1163.321]],["content/248",[3,1.677,17,6.288,18,1.733,19,9.359,36,6.565,50,3.331,56,4.485,65,9.602,78,11.555,79,3.712,139,11.555,155,12.131,157,5.453,221,10.163,416,6.968,618,13.865,635,12.863,718,8.739,949,9.602,1469,11.08,1521,11.307,1887,9.868,2278,9.868,2778,14.55,2779,14.55,2780,13.318]],["keywords/248",[]],["title/249",[716,862.854,820,773.156]],["content/249",[]],["keywords/249",[]],["title/250",[58,113.175,820,637.091,896,423.18]],["content/250",[3,1.904,22,4.313,36,5.748,50,2.916,56,3.926,58,1.691,76,4.798,106,3.577,157,6.869,178,9.921,258,6.385,323,5.315,385,7.999,397,6.955,819,9.9,820,14.49,901,7.598,936,9.187,1019,5.538,1035,10.625,1138,7.572,1323,8.095,1561,12.739,1562,16.518,1563,11.66,1564,12.739,1565,12.739,1566,8.406,1567,8.406,1568,7.348]],["keywords/250",[]],["title/251",[654,370.874,1501,682.927]],["content/251",[]],["keywords/251",[]],["title/252",[8,280.871,581,677.243,1502,649.387]],["content/252",[3,1.269,8,3.626,11,5.165,12,5.031,16,5.13,17,4.757,18,1.311,95,3.407,106,2.668,110,4.757,115,3.335,178,6.612,197,4.023,204,7.148,231,9.178,232,7.465,237,2.946,238,3.979,260,5.12,304,4.567,305,6.588,350,3.626,512,4.229,578,8.742,580,4.874,627,7.688,649,4.567,654,3.945,699,6.476,732,10.314,760,4.541,772,8.382,796,8.703,1203,7.574,1466,7.688,1502,8.382,1503,11.905,1504,11.008,1505,9.731,1506,11.008,1507,10.076,1508,7.688,1509,9.731,1510,8.382,1511,9.731,1512,9.731,1513,7.264,1514,6.476,1515,11.008,1516,11.008,1517,11.008,1518,11.008,1519,8.948]],["keywords/252",[]],["title/253",[3,119.285,581,821.883]],["content/253",[3,1.549,34,13.433,45,2.559,54,5.841,79,4.361,95,4.159,106,3.043,145,4.635,179,5.877,204,6.121,237,3.596,260,4.036,304,3.904,305,5.193,318,7.035,322,7.312,324,7.272,338,4.232,339,4.609,382,3.581,401,7.312,430,5.182,449,6.385,458,2.977,509,5.427,510,3.292,512,3.79,518,6.381,519,6.786,615,7.312,654,6.478,687,2.382,739,3.562,763,5.376,902,6.052,905,6.052,931,8.966,963,8.866,1060,5.908,1074,6.209,1103,5.652,1185,6.786,1203,6.474,1310,5.593,1422,7.165,1445,6.572,1468,6.209,1501,8.866,1503,6.572,1520,9.409,1521,7.312,1522,9.409,1523,9.409,1524,9.409,1525,5.841,1526,9.409,1527,9.409,1528,6.676,1529,13.853,1530,11.877,1531,13.436,1532,8.318,1533,9.409]],["keywords/253",[]],["title/254",[197,378.226,204,404.25]],["content/254",[0,5.819,34,7.658,58,1.186,79,4.52,95,4.712,106,3.681,107,6.947,132,9.183,145,6.377,152,6.244,188,4.604,204,7.442,270,6.338,322,6.943,339,2.627,343,6.674,406,5.01,412,11.395,449,4.572,451,12.036,508,2.877,509,5.153,512,3.652,520,4.716,661,3.98,697,9.497,699,5.256,717,5.01,718,5.366,794,7.095,801,8.513,902,5.746,912,6.555,960,6.943,961,6.338,1060,5.61,1103,5.366,1217,5.483,1387,5.424,1422,6.803,1466,6.24,1468,5.895,1509,7.898,1511,7.898,1512,7.898,1529,7.898,1530,7.898,1534,8.934,1535,11.591,1536,6.943,1537,8.934,1538,8.934,1539,6.943,1540,7.898,1544,8.934,1546,8.934,1547,7.262,1548,8.934,1549,8.934,1550,7.262,1551,8.934,1552,8.934,1553,5.204,1554,8.934,1555,8.934,1556,7.898,2781,9.497,2782,9.497,2783,9.497,2784,9.497]],["keywords/254",[]],["title/255",[260,310.858,1557,759.301]],["content/255",[58,2.087,182,7.141,251,11.976,260,4.724,266,9.253,305,6.079,510,5.502,654,5.636,699,9.253,1227,6.879,1469,11.976,1557,13.822,1558,12.222,1559,14.395,1560,15.727]],["keywords/255",[]],["title/256",[1706,892.464]],["content/256",[]],["keywords/256",[]],["title/257",[1707,1204.507]],["content/257",[3,1.55,18,1.601,19,8.647,58,2.269,75,8.345,79,5.049,101,7.339,157,5.038,400,7.909,426,7.339,436,5.916,508,4.329,642,11.209,687,4.76,907,10.043,1019,5.845,1416,6.983,1637,10.447,1694,12.576,1706,13.857,1708,17.099,1709,14.256,1710,8.991]],["keywords/257",[]],["title/258",[45,281.443,95,320.351]],["content/258",[3,0.871,17,1.947,18,1.643,54,2.796,58,1.831,60,1.88,61,2.897,79,3.52,81,4.123,95,3.023,101,2.459,106,3.72,110,1.947,157,1.688,179,1.97,181,3.146,188,2.321,193,2.862,218,1.622,237,3.692,238,5.15,243,4.988,258,1.741,262,4.292,304,5.724,324,2.438,338,3.603,339,2.223,341,2.644,345,6.115,350,5.268,364,2.36,382,2.876,385,2.828,396,5.477,458,6.137,470,4.692,476,3.724,487,6.003,491,6.798,493,2.765,509,2.598,511,8.382,512,2.132,513,6.299,514,6.597,520,5.155,526,3.43,528,4.924,530,5.126,539,3.146,543,3.146,544,4.862,546,3.146,580,1.994,652,2.203,687,3.492,762,2.142,905,2.897,936,3.248,1065,1.958,1103,2.705,1106,5.941,1123,6.648,1164,3.43,1312,4.692,1318,4.292,1355,4.127,1411,4.54,1445,3.146,1521,3.5,1566,2.972,1636,2.526,1669,2.526,1694,3.013,1706,9.356,1709,3.755,1711,6.682,1712,6.682,1713,5.546,1715,4.493,1716,7.437,1717,5.874,1718,6.682,1719,6.869,1720,6.682,1721,6.682,1722,7.559,1723,2.862,1724,3.365,1725,3.5,1726,7.559,1727,3.662,1728,3.248,1729,5.363,1730,7.559,1731,6.682,1732,4.123,1733,7.559,1734,4.504,1735,4.504,1736,4.504,1737,4.504,1738,4.504,1739,7.559,1740,9.767,1741,7.559,1742,4.504,1743,4.504,1744,4.504,1745,4.504,1746,4.504,1747,4.504,1748,4.504,1749,4.504,1750,3.861,1751,4.504,1752,4.504,1753,4.504]],["keywords/258",[]],["title/259",[1428,605.03,2785,517.71,2786,649.387]],["content/259",[]],["keywords/259",[]],["title/260",[152,424.56,2147,821.883]],["content/260",[]],["keywords/260",[]],["title/261",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/261",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/261",[]],["title/262",[2789,780.553,2790,615.019,2791,677.243]],["content/262",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2786,12.481,2790,11.821,2791,13.017]],["keywords/262",[]],["title/263",[62,457.672,107,457.672,2785,517.71]],["content/263",[]],["keywords/263",[]],["title/264",[701,402.951,708,426.638,762,344.879,2792,663.743]],["content/264",[3,1.864,17,5.331,18,1.469,36,8.643,58,2.147,115,3.737,117,7.656,149,5.476,171,8.896,223,7.185,239,6.212,258,4.768,323,5.147,324,6.676,512,4.563,701,8.988,708,11.27,715,6.033,762,5.866,870,4.818,1012,7.327,1015,7.656,1225,9.215,1703,6.308,1758,11.867,2679,10.284,2793,12.335,2794,12.335,2795,9.586,2796,11.29,2797,16.174,2798,13.865,2799,11.29]],["keywords/264",[]],["title/265",[1034,535.481,1322,394.828,2800,711.003]],["content/265",[3,1.992,50,3.957,106,3.792,118,5.509,143,7.343,150,5.132,152,3.956,157,5.953,182,4.378,228,6.502,235,8.266,258,3.727,271,6.363,428,6.841,438,5.049,512,4.481,626,6.635,638,9.189,701,8.827,703,7.658,901,4.435,935,6.954,1012,5.23,1034,8.585,1035,10.217,1036,6.841,1138,8.126,1156,7.204,1221,7.839,1284,6.127,1299,5.219,1636,5.407,1641,6.127,1643,6.449,1756,8.524,1757,7.204,1841,6.127,1846,8.794,1880,13.244,1882,8.04,1884,8.04,1885,8.04,1886,8.04,1887,6.54,1888,8.04,1889,8.04,2347,8.524,2785,5.854,2786,7.343,2801,9.643,2802,7.204,2803,9.643,2804,9.643,2805,9.643,2806,9.643,2807,6.954,2808,13.672,2809,9.643,2810,9.643]],["keywords/265",[]],["title/266",[1101,523.417,1322,394.828,2800,711.003]],["content/266",[3,1.813,18,1.873,98,8.302,106,2.8,438,8.235,512,4.437,669,5.157,948,13.903,1012,6.016,1101,9.653,1891,12.785,2795,12.222,2807,11.343,2811,14.395,2812,15.727,2813,15.727]],["keywords/266",[]],["title/267",[17,313.386,18,86.373,1322,335.742,2814,725.149]],["content/267",[11,1.797,16,1.785,17,1.655,18,1.508,20,7.537,55,4.466,56,2.03,58,2.183,79,3.457,98,3.476,106,3.618,115,3.511,116,2.209,131,2.377,145,1.887,149,2.933,150,2.038,157,1.435,160,4.185,161,3.193,182,1.739,185,2.597,204,2.573,237,4.003,238,4.12,241,1.598,253,3.386,259,2.377,260,2.602,318,5.386,330,2.562,332,8.818,339,3.025,350,4.926,396,3.154,416,1.834,430,3.627,434,1.86,436,2.898,438,5.386,449,1.353,456,2.99,458,3.667,459,4.299,460,3.198,464,6.028,465,3.65,470,1.571,473,2.81,488,4.088,499,2.188,503,1.944,510,3.031,511,3.176,512,1.858,518,4.466,519,2.762,520,2.022,528,2.495,548,2.635,549,2.81,656,2.527,687,2.193,695,1.86,715,3.221,717,2.148,732,2.635,778,2.209,818,5.717,873,3.386,882,2.148,893,3.65,905,4.236,918,2.717,949,2.527,958,3.166,965,2.717,966,2.717,967,4.926,968,3.113,976,9.007,1002,2.405,1012,1.465,1015,4.088,1035,2.464,1081,3.956,1106,1.989,1123,4.446,1127,2.527,1203,2.635,1204,1.762,1210,2.022,1274,2.038,1284,2.434,1304,3.029,1311,2.861,1322,6.274,1346,2.464,1366,4.531,1440,2.976,1445,2.675,1448,2.717,1449,3.476,1470,2.562,1477,2.762,1503,2.675,1514,2.253,1519,3.113,1539,2.976,1558,5.118,1586,2.81,1587,5.44,1632,2.675,1694,4.405,1710,2.562,1717,2.976,1759,2.597,1924,2.976,1930,3.386,1931,3.386,1943,3.386,1957,2.976,2133,2.231,2143,5.118,2151,3.386,2197,3.193,2198,2.861,2284,3.386,2345,2.3,2376,3.386,2451,2.81,2452,2.976,2603,3.113,2795,6.733,2802,7.685,2807,7.419,2815,3.386,2816,3.83,2817,6.586,2818,3.83,2819,3.83,2820,3.83,2821,3.83,2822,3.83,2823,3.83,2824,3.83,2825,3.83,2826,3.83,2827,3.83,2828,3.83,2829,3.83,2830,3.83,2831,3.83,2832,3.83,2833,3.83,2834,3.83,2835,3.042,2836,3.042,2837,3.042,2838,3.042,2839,3.042,2840,3.042,2841,3.042,2842,3.042,2843,3.83,2844,3.83,2845,3.283,2846,3.83,2847,3.83,2848,3.83,2849,6.586,2850,3.83,2851,3.83,2852,3.83,2853,3.83,2854,3.83,2855,3.83,2856,3.83,2857,3.83,2858,3.83,2859,6.586,2860,3.83,2861,6.586,2862,3.83,2863,6.586,2864,3.83,2865,6.028,2866,3.83,2867,6.586,2868,3.83,2869,3.83,2870,6.586,2871,3.83,2872,3.83,2873,3.83,2874,3.83,2875,3.83,2876,3.83,2877,3.83,2878,3.83,2879,3.83,2880,3.83,2881,3.83,2882,3.83,2883,6.586,2884,3.83,2885,3.83,2886,3.83,2887,3.83,2888,3.83,2889,3.83,2890,3.83,2891,3.83,2892,3.83,2893,3.83,2894,3.83,2895,3.283]],["keywords/267",[]],["title/268",[50,195.235,1322,394.828,2896,852.766]],["content/268",[5,2.668,11,2.448,16,2.432,17,2.255,18,1.865,20,4.146,46,3.134,50,3.162,55,7.35,56,2.632,58,2.413,82,2.71,98,2.754,106,3.648,115,2.587,149,2.891,157,1.955,193,3.315,238,1.385,242,3.01,245,5.183,259,3.239,260,1.567,273,2.369,285,3.399,293,8.574,319,2.384,325,2.354,327,4.206,364,3.91,396,5.19,426,2.848,436,2.296,438,6.557,442,6.502,470,3.503,491,5.075,508,2.75,510,1.825,512,1.472,513,2.874,514,4.925,544,5.492,687,2.743,695,2.534,715,5.301,717,2.926,762,2.481,796,2.481,882,2.926,890,3.07,896,2.589,958,4.577,1002,8.674,1015,3.239,1035,3.356,1082,2.777,1093,5.492,1106,2.71,1123,4.684,1204,3.927,1210,6.611,1272,5.492,1322,3.953,1395,5.128,1399,6.854,1442,3.763,1497,2.824,1514,3.07,1535,6.502,1539,4.055,1569,5.317,1574,3.898,1635,3.49,1694,5.711,1703,2.668,1719,3.134,1793,3.49,1821,6.727,1822,6.502,1916,6.941,1927,5.023,1964,5.183,1996,4.241,2001,4.241,2020,9.609,2071,4.241,2280,5.562,2361,3.973,2381,3.763,2382,4.612,2390,3.644,2403,4.612,2410,4.612,2419,4.612,2420,4.35,2498,4.241,2499,4.241,2507,6.941,2508,7.119,2509,4.241,2512,4.241,2520,4.241,2526,4.612,2527,4.612,2529,7.548,2534,4.612,2535,4.612,2542,4.612,2545,4.612,2802,8.096,2807,7.816,2815,4.612,2897,5.217,2898,5.217,2899,5.217,2900,5.217,2901,8.538,2902,5.217,2903,5.217,2904,5.217,2905,5.217,2906,4.612,2907,8.538,2908,5.217,2909,8.538,2910,5.217,2911,5.217,2912,5.217,2913,5.217,2914,5.217,2915,5.217,2916,5.217,2917,5.217,2918,5.217,2919,5.217,2920,5.217,2921,5.217,2922,5.217,2923,5.217,2924,5.217,2925,5.217]],["keywords/268",[]],["title/269",[45,231.913,95,263.974,118,487.186]],["content/269",[3,0.334,11,1.358,17,1.251,18,1.155,50,2.219,58,1.741,95,0.896,106,3.952,145,4.164,149,1.745,160,3.275,173,1.886,182,1.314,233,3.236,237,4.636,238,4.134,260,2.093,273,2.34,304,2.89,331,5.733,338,0.912,339,2.049,341,1.803,345,4.477,348,2.054,350,2.784,364,0.904,396,5.146,436,3.72,449,1.022,456,1.314,457,2.451,458,3.685,460,2.572,470,5.381,473,2.124,488,3.199,491,7.797,493,4.276,499,4.829,503,1.469,511,3.36,512,2.385,513,4.656,514,6.198,516,2.163,518,1.963,519,3.717,520,2.721,521,2.088,522,2.353,523,2.353,530,1.963,535,3.447,539,2.022,543,2.022,544,9.764,546,2.022,548,1.992,549,2.124,660,1.107,661,2.296,687,0.733,732,3.546,758,2.353,778,1.67,803,1.839,814,1.839,838,1.436,918,3.657,958,3.089,965,3.657,966,3.657,967,5.578,975,2.088,1068,3.563,1073,1.541,1093,1.862,1123,8.475,1204,2.371,1210,1.528,1322,2.386,1355,4.615,1362,2.299,1380,1.963,1399,1.436,1415,1.215,1447,3.357,1449,2.721,1525,3.199,1569,3.589,1586,3.782,1587,1.818,1713,2.124,1715,1.721,1719,6.454,1723,1.839,1729,2.054,1793,5.654,1822,3.925,1823,2.413,1927,1.703,1958,4.19,1977,2.054,2020,3.164,2133,8.589,2197,2.413,2198,2.163,2381,2.088,2383,2.353,2390,3.6,2439,2.299,2440,2.204,2448,8.015,2449,2.413,2450,2.413,2451,6.202,2452,4.005,2470,2.413,2471,2.413,2472,2.25,2473,2.413,2474,2.413,2475,4.297,2477,4.297,2478,2.413,2482,2.413,2483,2.413,2484,2.413,2485,2.413,2493,2.559,2494,2.559,2495,2.559,2496,2.559,2497,2.413,2498,4.19,2499,4.19,2500,4.556,2501,4.093,2502,2.559,2503,2.559,2504,2.559,2505,2.204,2506,2.559,2507,4.19,2508,4.297,2509,4.19,2510,2.559,2511,2.559,2512,2.353,2513,2.559,2514,2.204,2515,2.559,2516,2.559,2517,4.556,2518,2.559,2519,2.559,2520,2.353,2521,2.559,2522,2.559,2523,2.559,2524,2.559,2785,1.757,2786,2.204,2807,2.088,2835,2.299,2836,2.299,2837,2.299,2838,2.299,2839,2.299,2840,2.299,2841,2.299,2842,2.299,2906,2.559,2926,2.65,2927,2.65,2928,2.65,2929,2.65,2930,2.65,2931,2.65,2932,2.481,2933,2.895,2934,2.481,2935,2.65,2936,5.154,2937,2.65,2938,2.65,2939,2.65,2940,2.65,2941,2.895,2942,2.65,2943,2.895,2944,2.895]],["keywords/269",[]],["title/270",[1857,692.162,2945,947.258]],["content/270",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/270",[]],["title/271",[1081,621.593,1151,759.301]],["content/271",[2952,16.234,2953,16.234]],["keywords/271",[]],["title/272",[1693,816.841]],["content/272",[]],["keywords/272",[]],["title/273",[1632,919.143]],["content/273",[3,2.193,45,4.347,50,3.66,80,7.401,211,8.03,416,7.655,669,5.241,776,7.123,901,7.353,1095,10.038,1227,6.992,1693,9.923]],["keywords/273",[]],["title/274",[1695,1315.941]],["content/274",[18,2.287,50,3.718,56,3.826,75,7.705,92,6.115,169,7.52,179,5.43,211,5.24,239,6.252,337,11.175,364,3.876,458,3.927,563,11.829,637,9.453,639,8.67,663,6.348,687,3.142,723,10.091,760,7.922,776,5.531,924,9.647,926,8.419,942,7.985,1075,11.175,1157,7.619,1180,7.985,1416,6.448,1569,5.27,1693,12.691,1696,12.413,1697,10.974,1698,10.091,1699,12.413,1700,12.413]],["keywords/274",[]],["title/275",[649,545.984]],["content/275",[18,2.299,45,3.87,115,4.311,176,8.289,178,8.547,223,8.289,237,3.808,303,9.651,338,4.483,364,4.444,417,10.097,458,4.502,649,5.904,687,3.602,763,8.13,776,6.341,1075,9.791,1274,9.432,1304,6.546,1310,10.534,1416,7.392,1567,9.391,1693,11.001,1701,14.231]],["keywords/275",[]],["title/276",[363,683.567]],["content/276",[]],["keywords/276",[]],["title/277",[1793,880.134]],["content/277",[3,0.492,5,2.182,8,1.405,11,2.002,18,1.79,20,2.072,22,1.445,27,2.649,45,1.16,50,3.272,55,2.894,56,3.405,57,2.234,58,2.266,60,1.78,72,1.78,95,3.42,98,2.252,104,2.854,106,3.864,110,1.844,115,2.844,116,2.461,117,2.649,145,3.558,146,2.679,157,1.599,169,1.976,174,4.892,187,4.249,204,5.869,218,2.601,223,2.485,228,2.029,238,1.133,239,4.729,240,5.7,242,2.461,259,2.649,260,2.82,266,4.249,271,2.816,273,3.279,305,1.649,323,1.78,325,1.925,327,2.102,330,2.854,361,8.412,363,3.751,364,4.462,365,3.316,371,3.316,378,3.077,382,2.748,397,2.33,409,2.35,430,3.977,438,3.781,449,3.316,458,4.754,470,1.751,491,4.293,511,2.058,512,3.785,513,3.977,514,4.166,580,1.889,596,4.293,612,2.894,621,2.779,625,3.389,652,2.087,656,4.766,660,1.632,661,1.901,670,3.658,688,2.936,701,2.371,720,3.469,762,2.029,776,5.977,870,1.667,872,2.59,882,2.393,884,4.765,890,2.51,896,2.117,902,2.745,1012,4.726,1019,4.082,1104,3.316,1123,1.844,1133,4.384,1135,8.153,1138,5.581,1165,4.249,1210,2.252,1227,1.866,1243,5.871,1277,5.735,1299,2.31,1369,2.936,1442,3.077,1466,5.044,1497,2.31,1569,4.69,1591,3.772,1693,6.857,1719,4.338,1755,4.483,1759,2.894,1794,2.438,1795,4.267,1796,3.469,1797,4.267,1798,4.267,1799,4.267,1800,3.906,1801,4.267,1802,3.389,1803,4.267,1804,3.772,1805,4.267,1806,4.267,1807,6.021,1808,4.267,1809,3.558,1810,3.316,1811,4.969,1812,4.267,1813,3.906,1814,4.267,1815,4.267,1816,4.267,1817,4.267,1818,4.267,1819,3.906,1820,4.267,1821,4.483,1822,3.249,1823,3.558,1824,4.267,1825,6.61,1826,3.906,1827,4.267,1828,3.772,1829,3.558,1830,4.267,1831,6.021,1832,4.267,1833,4.267,1834,4.267,1835,4.267,1836,3.658,1837,3.906,1838,4.267,1839,4.267,1840,4.267,1841,2.711,1842,4.267,1843,4.267,1844,4.267,1845,3.658,1846,2.745,1871,4.066,2954,8.368,2955,4.944,2956,4.944,2957,4.267,2958,4.944]],["keywords/277",[]],["title/278",[1632,919.143]],["content/278",[11,4.372,15,6.612,16,4.343,29,5.274,45,2.534,56,2.872,60,3.889,76,5.026,80,4.315,95,2.885,106,3.577,115,5.156,124,7.576,145,6.574,157,3.492,169,4.315,178,5.597,181,6.509,182,4.232,188,4.803,209,4.432,211,6.579,245,5.658,287,6.721,301,6.837,363,4.841,364,4.867,371,7.242,385,5.852,406,5.226,580,4.127,649,7.061,652,6.526,657,7.988,669,3.056,682,10.887,701,5.178,872,5.658,884,6.772,926,6.32,967,6.39,1012,3.565,1216,12.714,1220,7.242,1227,4.076,1274,4.96,1283,6.721,1416,4.841,1773,6.721,1807,11.125,1811,6.412,1847,8.238,1848,7.988,1849,9.319,1850,8.238,1851,13.361,1852,15.587,1853,8.53,1854,9.319,1855,9.319,1856,9.319,1857,6.233,1858,8.53,1859,9.319,1860,7.576,1861,9.319,1862,8.238,1863,9.319]],["keywords/278",[]],["title/279",[116,491.885,363,442.97,776,379.955]],["content/279",[8,3.667,16,7.04,18,2.042,29,6.301,43,6.759,45,3.028,56,3.432,58,2.005,76,4.194,104,10.103,115,5.823,146,6.991,169,7.938,181,7.777,191,6.687,240,6.759,363,7.847,364,4.717,371,8.652,397,6.078,413,6.618,438,7.91,450,12.28,507,9.842,614,8.318,649,7.113,663,5.694,687,2.819,760,7.93,776,4.961,818,7.347,1133,9.171,1222,7.777,1243,9.051,1274,8.04,1326,8.478,1411,6.687,1831,9.283,1860,9.051,1862,9.842,1864,11.134,1865,15.106,1866,11.134]],["keywords/279",[]],["title/280",[656,682.927,890,608.874]],["content/280",[58,2.021,95,3.486,146,7.072,149,3.813,174,4.987,181,7.867,187,6.626,211,4.754,240,9.243,241,4.7,260,5.549,270,7.991,323,4.7,325,5.082,363,5.85,406,6.315,409,6.203,413,6.694,621,7.336,656,7.432,669,3.693,701,6.258,776,5.018,870,4.399,890,10.869,896,5.589,904,7.991,960,8.753,1012,7.778,1029,7.157,1131,5.284,1133,6.838,1535,8.577,1569,7.843,1625,8.577,1847,9.956,1848,9.655,1868,17.246,1869,11.263,1870,11.263,1871,10.732,1872,9.39,1873,11.263,1874,11.263,1876,9.956,1877,11.263]],["keywords/280",[]],["title/281",[8,433.424]],["content/281",[]],["keywords/281",[]],["title/282",[18,123.267,1569,439.386]],["content/282",[3,1.828,8,5.222,60,6.616,131,9.842,157,5.942,218,5.71,430,8.732,508,5.106,580,7.021,776,8.435,1157,9.732,1301,13.591,1570,15.855,1571,15.855]],["keywords/282",[]],["title/283",[958,480.942]],["content/283",[3,1.856,7,4.735,8,5.756,18,1.918,58,1.847,61,6.36,79,2.523,82,8.365,106,2.477,150,5.263,170,8.741,204,3.862,241,4.126,251,7.53,305,6.224,321,6.283,339,2.908,397,5.398,413,5.877,508,3.184,621,6.441,654,3.544,683,5.307,739,3.744,760,4.079,763,7.951,796,4.703,864,6.069,870,3.862,884,5.018,896,4.907,951,9.422,958,7.762,1061,6.36,1075,6.803,1204,6.401,1220,7.684,1299,5.352,1321,8.741,1440,7.684,1503,9.72,1514,5.818,1568,5.703,1572,9.888,1573,9.051,1574,7.387,1575,7.255,1576,8.741,1577,8.741,1578,9.051,1579,9.888,1580,9.888,1581,9.888,1582,13.917,1583,8.272,1584,8.244,1585,8.741,1587,6.209,2345,5.939]],["keywords/283",[]],["title/284",[1054,744.754]],["content/284",[3,1.983,8,3.145,12,4.363,18,2.407,27,5.927,58,1.267,72,3.984,80,4.421,115,4.113,126,7.005,132,6.774,146,5.996,164,7.005,174,7.619,180,5.797,192,8.185,204,3.73,239,6.838,241,6.592,245,5.797,297,9.098,305,3.691,326,8.185,327,4.704,370,5.507,436,4.202,669,5.18,687,2.417,695,4.637,702,8.185,715,4.67,763,7.756,870,5.303,884,4.845,967,8.705,1029,6.067,1054,5.404,1123,4.126,1130,6.386,1276,5.797,1356,7.961,1380,6.475,1577,8.441,1588,13.576,1589,16.427,1590,8.739,1591,8.441,1592,8.441,1593,7.133,1594,8.441,1595,9.548,1596,9.548,1597,5.354,1598,6.067,1599,8.739,1600,5.927,1601,7.961,1602,8.441,1603,7.005,1604,9.548,1605,9.548]],["keywords/284",[]],["title/285",[1600,816.841]],["content/285",[3,1.77,8,5.057,18,1.829,115,4.652,216,11.932,369,13.162,649,6.371,651,14.054,739,5.813,762,7.303,889,14.632,1396,12.802,1606,10.725,1607,12.482,1608,15.355,1609,15.355,1610,15.355,1611,15.355,1612,15.355]],["keywords/285",[]],["title/286",[655,826.325]],["content/286",[6,6.504,8,3.89,12,5.397,18,2.104,31,7.17,60,6.558,115,5.705,145,7.743,228,5.617,241,4.928,245,7.17,305,6.075,319,7.183,323,4.928,373,6.879,451,11.335,458,5.589,620,8.993,626,8.126,677,9.178,687,3.979,763,6.747,870,4.613,1054,6.684,1217,7.249,1227,5.166,1355,6.448,1589,12.776,1592,10.44,1613,11.81,1614,11.81,1615,11.81,1616,11.81,1617,10.44,1618,15.717,1619,10.124,1620,11.81,1621,15.717,1622,12.776,1623,9.178]],["keywords/286",[]],["title/287",[50,236.931,1569,439.386]],["content/287",[8,3.987,15,8.588,18,1.442,50,4.648,72,5.051,80,5.604,133,8.588,174,7.074,182,5.496,209,5.757,260,3.636,363,6.288,364,3.78,365,9.407,436,5.327,457,5.757,460,4.468,578,9.613,639,8.454,649,7.419,655,7.601,656,7.988,660,4.63,663,6.19,717,6.787,880,6.338,901,5.568,1123,5.231,1127,7.988,1227,6.988,1423,9.407,1429,10.092,1569,6.783,1594,10.7,1603,8.881,1624,12.104,1625,9.217,1626,12.104,1627,7.988,1628,10.7,1629,11.079,1630,12.104,1631,12.104]],["keywords/287",[]],["title/288",[1632,919.143]],["content/288",[3,2.24,8,6.688,50,4.095,197,5.278,209,6.869,211,7.55,234,10.523,258,5.582,323,6.026,325,6.516,406,10.029,512,4.074,669,5.864,776,6.435,1012,5.524,1095,9.069,1633,14.442]],["keywords/288",[]],["title/289",[8,238.838,18,86.373,364,226.432,596,431.021]],["content/289",[8,5.707,18,1.635,31,8.334,54,8.521,58,2.3,75,8.521,101,7.495,110,5.933,119,7.769,169,6.356,179,6.005,218,4.944,228,6.529,241,5.728,363,9.001,364,4.287,621,11.287,715,6.715,884,6.967,936,9.901,1019,5.969,1065,5.969,1132,8.62,1497,7.431,1634,13.728,1635,9.182,1636,7.698,1637,10.669,1638,11.446,1639,13.728]],["keywords/289",[]],["title/290",[209,492.192,327,509.83]],["content/290",[3,1.812,18,2.336,50,2.704,98,6.234,116,6.812,149,3.998,204,6.139,271,7.793,304,4.9,321,7.504,325,7.97,326,10.124,327,8.702,364,4.908,397,6.448,459,5.861,480,8.296,510,6.18,612,8.01,621,7.693,660,4.518,669,3.872,763,6.747,872,7.17,1060,7.416,1130,7.899,1132,7.416,1323,7.504,1370,8.665,1553,6.879,1569,5.014,1597,6.622,1640,15.717,1641,7.504,1642,11.81,1643,10.512,1644,11.81,1645,10.81,1646,11.81,1647,11.81,1648,9.379]],["keywords/290",[]],["title/291",[95,263.974,364,266.281,1186,506.875]],["content/291",[8,5.598,18,1.304,45,2.977,50,2.506,56,4.602,58,1.453,106,3.709,110,4.73,176,6.376,187,8.785,204,4.276,216,8.506,231,9.126,260,4.485,325,6.737,327,7.356,364,4.663,382,4.165,458,3.463,459,5.432,512,3.088,652,5.354,660,4.187,661,4.877,678,6.376,1002,11.464,1060,6.873,1081,6.574,1123,4.73,1132,9.376,1133,6.645,1134,8.177,1135,7.223,1137,13.556,1138,6.506,1140,8.177,1143,9.383,1144,8.177,1186,6.506,1427,7.766,1649,8.898,1650,10.946,1651,10.946,1652,10.946,1653,10.946,1654,10.946]],["keywords/291",[]],["title/292",[95,263.974,364,266.281,1655,693.233]],["content/292",[0,8.403,3,1.75,8,5,18,2.106,20,4.319,45,2.418,50,2.036,56,2.741,58,1.18,76,3.35,79,3.292,80,4.117,82,4.619,85,6.031,106,3.638,174,3.938,176,5.18,187,5.232,204,5.93,208,4.987,209,4.229,214,7.062,234,5.232,239,4.479,258,3.437,288,5.286,364,4.74,370,5.13,382,3.384,449,4.557,458,2.814,470,3.648,508,2.864,512,3.639,669,2.916,708,7.59,719,6.644,904,6.309,1002,11.58,1012,3.402,1123,3.843,1132,5.584,1133,5.399,1134,6.644,1135,5.868,1137,13.498,1138,5.286,1140,6.644,1144,6.644,1553,5.18,1641,5.651,1649,7.229,1655,10.487,1656,8.893,1657,8.893,1658,8.893,1659,8.893,1660,8.893,1661,7.861,1662,8.893,1663,8.893,1664,7.861,1665,8.893,1666,8.893,1667,8.893,1668,6.525,1669,4.987,1670,7.415,1671,5.399,1672,8.14,1673,8.893,1674,7.861]],["keywords/292",[]],["title/293",[95,263.974,364,266.281,1675,693.233]],["content/293",[3,1.255,8,5.581,18,1.772,45,2.96,50,2.492,72,4.542,76,4.1,79,2.777,106,3.747,174,4.82,176,6.34,187,6.404,204,4.252,208,6.103,228,5.177,234,6.404,258,4.207,288,6.47,364,4.645,382,4.142,449,3.845,453,7.85,458,3.444,470,4.465,512,3.071,669,3.569,730,10.372,882,6.103,1002,11.437,1123,4.704,1132,6.835,1133,6.608,1134,8.132,1135,7.183,1137,13.53,1138,6.47,1140,8.132,1144,8.132,1145,9.963,1284,6.916,1636,6.103,1649,8.848,1661,9.622,1664,9.622,1669,6.103,1670,9.075,1671,6.608,1675,8.848,1676,10.884,1677,10.884,1678,10.884]],["keywords/293",[]],["title/294",[18,101.574,215,595.63,373,496.727]],["content/294",[3,2.109,18,2.18,45,2.994,56,3.393,58,1.461,115,5.544,117,6.833,119,9.647,139,8.742,149,3.727,174,4.874,182,4.998,197,4.023,228,5.235,239,5.544,258,4.255,323,4.593,327,5.423,342,10.462,373,9.928,424,9.731,444,8.948,449,3.888,453,7.939,509,6.349,610,10.489,649,4.567,655,6.912,715,5.384,739,4.167,762,5.235,763,6.289,870,4.3,1019,4.786,1029,9.525,1054,8.483,1137,7.81,1157,6.756,1227,4.815,1300,8.742,1423,11.649,1576,9.731,1597,6.172,1602,15.068,1603,8.076,1679,11.008,1680,8.948,1681,11.008,1682,11.008]],["keywords/294",[]],["title/295",[58,137.346,1680,841.289]],["content/295",[8,4.807,18,1.261,56,3.263,58,1.937,76,3.988,95,3.278,115,3.208,119,8.26,178,6.36,188,7.522,228,5.036,239,5.333,258,5.642,259,6.572,260,3.18,266,6.229,304,4.393,323,7.512,325,4.777,327,8.869,342,8.959,373,6.167,430,5.831,434,5.142,436,4.66,442,8.063,499,6.049,510,6.607,512,2.987,663,5.415,678,6.167,699,8.587,876,6.897,1065,4.603,1123,4.576,1132,6.649,1178,9.076,1346,6.811,1491,9.632,1553,6.167,1557,7.768,1589,8.607,1603,10.709,1641,6.728,1674,9.36,1680,8.607,1683,10.588,1684,10.588,1685,14.596,1686,10.588,1687,10.588,1688,10.588,1689,10.588,1690,10.588,1691,10.588,1692,10.588]],["keywords/295",[]],["title/296",[649,545.984]],["content/296",[3,1.843,43,9.705,45,4.347,58,2.122,72,6.67,197,5.842,241,6.67,338,5.036,723,12.995,882,8.964,1274,8.508,1304,7.353,1416,8.304,1693,9.923]],["keywords/296",[]],["title/297",[3,119.285,669,339.318]],["content/297",[]],["keywords/297",[]],["title/298",[36,466.935,1444,804.245]],["content/298",[3,2.236,25,5.755,36,8.881,50,1.621,54,4.394,56,2.182,58,2.53,60,2.954,72,5.529,76,2.667,87,4.298,91,5.755,95,2.191,106,3.016,116,4.083,117,4.394,143,10.09,149,6.567,150,5.79,179,4.759,211,2.988,221,7.599,239,3.566,241,2.954,245,4.298,323,5.529,325,4.909,426,3.865,428,5.023,430,3.899,512,4.978,580,3.135,663,3.62,669,5.785,697,9.722,708,4.165,715,5.321,870,7.295,882,3.97,901,5.004,976,5.502,1012,2.708,1013,6.746,1030,10.367,1034,4.445,1035,4.554,1036,5.023,1131,5.104,1210,5.743,1300,5.622,1311,8.128,1330,6.258,1331,8.285,1641,4.498,1703,3.62,1754,7.079,1755,9.23,1756,6.258,1757,5.289,1758,11.774,1759,4.801,1760,7.079,1761,10.879,1762,5.502,1763,14.87,1764,5.391,1765,7.079,1766,7.079,1767,6.48,1769,6.258,1770,7.079,2959,8.203]],["keywords/298",[]],["title/299",[45,281.443,197,378.226]],["content/299",[3,1.56,18,1.612,45,4.671,58,2.279,149,5.814,197,6.277,228,6.438,288,8.046,323,5.649,382,5.151,669,4.438,762,6.438,864,8.309,870,6.709,1012,7.216,1067,12.9,1068,6.923,1101,11.579,1131,6.351,1186,8.046,1322,6.268,1475,11.287,1771,13.537,1772,13.537,1773,9.763,1774,13.537,1775,11.967]],["keywords/299",[]],["title/300",[50,301.275]],["content/300",[3,2.175,6,6.966,8,4.166,18,1.507,36,5.707,45,2.354,50,4.751,54,5.373,58,2.321,72,3.612,95,2.679,133,6.141,157,3.244,169,4.007,177,6.726,179,6.538,197,3.163,209,4.116,211,7.711,234,7.442,241,3.612,258,3.345,323,6.237,325,5.707,327,4.264,364,2.703,375,7.922,401,6.726,430,4.767,508,2.787,512,3.568,639,6.045,649,3.591,652,4.233,669,6.342,670,7.419,717,4.853,776,5.636,856,11.182,870,3.381,1012,3.311,1017,7.036,1019,3.763,1029,5.5,1095,10.325,1096,8.248,1097,6.591,1131,5.935,1310,5.145,1502,9.632,1505,7.651,1567,5.712,1607,7.036,1693,7.852,1697,7.651,1776,8.655,1777,8.655,1778,8.655,1779,8.655,1780,8.655,1781,8.655,1782,6.35,1783,8.655,1784,8.655]],["keywords/300",[]],["title/301",[45,281.443,258,400.012]],["content/301",[3,1.896,18,2.177,45,3.442,50,2.897,58,1.68,75,7.856,98,6.681,106,2.253,193,8.042,197,4.625,209,7.823,211,6.943,234,7.446,258,7.751,259,7.856,287,9.127,288,9.777,301,9.286,323,5.281,325,5.71,400,7.446,406,7.097,669,5.393,1012,4.841,1131,5.938,1186,7.522,1497,8.903,1636,7.097,1755,7.856,1759,8.583,1785,10.051,1786,9.455,1787,12.656,1788,10.288]],["keywords/301",[]],["title/302",[18,101.574,197,311.663,1583,506.875]],["content/302",[3,1.539,18,2.232,58,2.259,197,6.85,258,5.161,259,8.287,288,7.936,323,5.571,378,9.629,512,3.767,612,9.055,669,4.378,870,5.215,958,4.879,969,10.853,1012,5.107,1131,7.988,1274,7.106,1312,8.287,1497,7.226,1556,11.803,1583,12.119,1755,11.634,1789,12.22,1790,13.839]],["keywords/302",[]],["title/303",[22,350.355,125,469.918]],["content/303",[3,1.889,22,5.549,60,6.839,198,10.415,228,7.795,580,7.258,669,5.374,708,9.643,870,6.402,1012,6.27,1791,16.39]],["keywords/303",[]],["title/304",[776,586.326]],["content/304",[]],["keywords/304",[]],["title/305",[18,123.267,1569,439.386]],["content/305",[3,2.03,16,5.471,18,2.238,56,3.618,57,6.147,80,5.435,95,3.634,98,6.197,104,7.851,157,4.399,169,7.247,382,4.467,417,8.329,429,9.787,436,5.166,456,5.33,458,3.714,460,4.333,506,11.186,508,6.302,552,6.465,581,9.323,621,7.646,627,8.199,654,4.207,660,4.49,687,4.458,772,8.939,776,6.974,872,7.127,880,6.147,958,4.29,967,5.622,1061,7.551,1103,7.051,1127,7.746,1161,7.961,1227,5.135,1312,7.287,1569,6.646,1597,6.582,1702,9.543,1703,6.003,1704,11.739]],["keywords/305",[]],["title/306",[242,596.939,1569,439.386]],["content/306",[1,8.88,18,2.055,50,3.949,58,1.809,80,6.312,115,4.13,149,4.615,169,6.312,240,8.276,242,7.863,328,9.117,364,4.257,381,12.051,382,5.188,436,5.999,460,5.032,508,4.39,612,9.245,660,5.214,687,3.451,776,6.074,880,7.138,912,10.002,969,11.082,1061,8.769,1082,7.255,1105,10.002,1222,9.521,1569,7.324,1575,10.002,1597,7.644,1705,13.632]],["keywords/306",[]],["title/307",[22,350.355,125,469.918]],["content/307",[3,1.955,60,7.078,382,6.455,508,5.463,580,7.511,776,7.558,1671,10.298]],["keywords/307",[]],["title/308",[1,674.112,242,596.939]],["content/308",[]],["keywords/308",[]],["title/309",[22,350.355,125,469.918]],["content/309",[3,1.873,18,1.936,22,5.502,45,4.42,50,3.721,116,9.375,219,15.488,270,11.531,319,7.428,1568,9.375,1698,13.213,1792,12.377]],["keywords/309",[]],["title/310",[708,608.874,905,665.681]],["content/310",[]],["keywords/310",[]],["title/311",[1034,826.325]],["content/311",[3,2.16,36,4.675,50,4.29,58,1.375,60,4.324,106,3.855,118,5.92,150,7.653,152,4.251,198,6.584,218,3.732,241,4.324,258,5.558,426,5.657,428,7.352,512,4.659,580,4.588,626,7.13,701,7.991,901,4.766,935,7.473,1012,3.964,1034,6.507,1035,11.474,1036,7.352,1138,8.547,1641,6.584,1643,6.931,1757,7.742,1762,8.053,1769,9.16,1841,6.584,1846,9.25,1878,10.362,1880,11.989,1881,10.362,1882,8.64,1883,10.362,1884,8.64,1885,8.64,1886,8.64,1887,7.028,1888,8.64,1889,8.64,2960,16.514]],["keywords/311",[]],["title/312",[1101,807.709]],["content/312",[3,2.167,11,6.308,18,2.434,50,3.078,58,1.784,76,5.064,106,2.393,197,6.249,211,5.675,258,5.196,337,9.25,382,5.116,512,3.793,669,5.606,677,10.447,1012,5.142,1027,7.039,1131,6.308,1223,11.524,1759,9.117,1794,7.68,1841,8.542,1890,13.443,1891,13.9,1892,11.884,1893,13.443,1894,11.884,1895,13.443]],["keywords/312",[]],["title/313",[1098,1045.084]],["content/313",[17,7.461,18,2.056,109,13.71,1012,6.604,1755,10.716]],["keywords/313",[]],["title/314",[701,731.242]],["content/314",[3,2.334,45,3.899,50,3.282,56,4.418,58,2.363,109,11.385,149,4.853,197,6.507,258,5.541,669,6.641,872,8.703,1012,5.484,1131,8.353,1180,9.221,1299,7.759,1583,10.582,1755,8.898,1896,14.336]],["keywords/314",[]],["title/315",[887,933.65]],["content/315",[11,7.89,176,9.795,197,6.146,258,6.5,669,5.513,1012,6.432,1567,11.097,1636,9.429]],["keywords/315",[]],["title/316",[209,625.858]],["content/316",[3,2.015,11,6.533,20,6.762,22,4.714,50,3.188,60,5.81,72,5.81,125,6.323,169,6.447,176,8.111,197,5.089,209,8.315,218,5.015,258,5.382,364,4.348,382,5.299,512,3.928,580,6.166,652,6.811,669,5.732,872,8.454,1012,7.667,1101,8.547,1217,8.547,1671,8.454,1897,13.925]],["keywords/316",[]],["title/317",[460,485.753]],["content/317",[]],["keywords/317",[]],["title/318",[50,236.931,460,382.009]],["content/318",[18,1.143,50,3.948,56,2.957,58,2.289,82,4.984,95,2.97,106,3.731,110,4.147,115,4.127,150,5.107,218,3.455,238,2.547,273,4.357,293,5.956,303,6.507,319,4.385,457,4.563,460,5.847,470,6.499,508,3.09,512,3.844,687,2.429,695,6.616,1068,4.907,1073,5.107,1093,8.763,1130,6.417,1227,4.197,1274,5.107,1398,6.097,1399,4.762,1439,5.645,1467,6.332,1694,6.417,1715,5.703,1821,8.457,1898,9.595,1899,13.624,1900,9.595,1901,9.595,1902,9.595,1903,13.624,1905,9.595,1906,8.482,1907,9.595,1908,9.595,1909,9.595,1910,9.595,1911,9.595,1912,9.595,1913,9.595,1914,9.595,1915,9.595,1916,7.8,1917,9.595,1918,9.595,1919,9.595,1920,13.624,1921,9.595,1922,9.595,1923,13.624,1924,10.588,1925,9.595,2961,10.2]],["keywords/318",[]],["title/319",[22,350.355,125,469.918]],["content/319",[3,1.972,50,3.918,58,2.271,864,10.503,958,6.254,1204,7.871]],["keywords/319",[]],["title/320",[8,280.871,18,101.574,1583,506.875]],["content/320",[]],["keywords/320",[]],["title/321",[3,119.285,2962,986.166]],["content/321",[3,1.064,18,1.941,36,2.59,43,3.486,56,1.77,58,2.057,79,2.952,106,3.906,128,4.787,150,6.157,197,2.098,228,6.903,237,4.533,238,3.071,252,5.255,304,6.022,318,3.006,338,2.907,339,4.791,341,2.009,345,3.323,350,1.891,426,3.134,441,8.157,458,2.919,460,5.358,470,6.359,476,2.828,503,5.871,510,4.047,512,5.553,660,2.196,661,2.558,695,2.788,708,3.378,796,6.301,819,4.462,870,3.604,884,2.914,901,4.244,958,6.389,1036,4.073,1075,3.95,1179,5.075,1204,5.321,1220,4.462,1304,4.244,1321,5.075,1322,5.356,1415,2.409,1419,7.026,1449,3.031,1470,6.171,1480,3.648,1525,3.564,1583,9.214,1600,3.564,1710,3.84,1790,4.667,2064,4.462,2203,8.446,2345,5.542,2368,4.922,2749,3.95,2962,5.471,2963,6.103,2964,5.471,2965,5.471,2966,6.103,2967,5.471,2968,9.809,2969,9.809,2970,4.56,2971,9.809,2972,6.103,2973,6.103,2974,6.103,2975,6.103,2976,6.103,2977,6.103,2978,12.625,2979,3.486,2980,6.103,2981,6.103]],["keywords/321",[]],["title/322",[197,378.226,1583,615.129]],["content/322",[3,2.151,18,1.843,106,2.755,197,6.819,211,6.533,259,9.607,288,9.199,325,6.983,669,6.118,1065,6.729,1131,7.262,1221,12.581,1583,11.906]],["keywords/322",[]],["title/323",[287,746.37,1583,615.129]],["content/323",[11,2.347,18,1.454,95,1.549,106,3.965,152,3.384,197,3.015,204,3.222,426,2.731,436,2.202,470,3.384,512,4.101,660,1.914,708,2.943,796,2.379,1002,6.609,1012,1.914,1036,3.549,1204,3.794,1259,20.352,1310,2.974,1387,3.037,1553,2.914,1583,6.256,1641,3.179,1643,7.039,1645,4.579,1789,4.579,1790,4.067,1794,2.858,1846,9.888,2683,4.579,2967,4.767,2982,5.318,2983,5.318,2984,5.318,2985,5.318,2986,5.318,2987,5.318,2988,5.318,2989,5.318,2990,5.318,2991,5.318,2992,5.318,2993,5.318,2994,17.111,2995,5.318,2996,5.318,2997,5.318,2998,5.318,2999,11.188,3000,11.188,3001,20.714,3002,11.188,3003,19.089,3004,15.451,3005,8.768,3006,8.768,3007,8.768,3008,11.188,3009,5.318,3010,5.318,3011,14.357,3012,8.768,3013,8.768,3014,5.318,3015,5.318,3016,5.318,3017,5.318,3018,8.768,3019,8.768,3020,11.188,3021,15.451,3022,8.768,3023,5.318,3024,8.768,3025,8.768,3026,8.768,3027,5.318,3028,5.318,3029,5.318,3030,5.318,3031,5.318,3032,5.318,3033,5.318,3034,5.318,3035,5.318,3036,5.318,3037,5.318,3038,8.768,3039,5.318,3040,5.318]],["keywords/323",[]],["title/324",[963,682.927,1583,615.129]],["content/324",[3,0.88,4,8.61,5,3.905,18,2.221,46,4.586,58,1.013,79,3.542,113,12.638,115,4.684,117,4.74,119,4.321,131,7.153,150,8.229,208,6.462,209,3.631,228,3.631,241,3.186,260,3.462,271,5.039,327,8.176,328,5.107,339,3.389,342,4.687,364,2.384,434,3.708,459,3.789,460,4.254,503,7.044,510,4.856,512,5.11,649,3.168,655,4.795,660,5.31,663,5.893,687,4.201,695,3.708,739,5.255,740,6.366,901,5.301,958,4.212,1012,4.408,1019,3.32,1034,7.236,1204,3.512,1210,4.031,1227,6.763,1228,7.635,1276,4.635,1312,10.301,1416,9.409,1436,6.989,1437,6.989,1439,4.492,1468,7.605,1497,4.133,1539,5.934,1671,4.635,1831,6.366,1858,6.989,2278,5.178,2368,6.545,2994,10.982,3041,8.117,3042,8.117,3043,8.117,3044,8.117,3045,8.117,3046,8.117,3047,8.117,3048,8.117,3049,8.117,3050,8.117,3051,8.117,3052,8.117,3053,8.117,3054,8.117,3055,8.117,3056,8.117,3057,8.117,3058,8.117]],["keywords/324",[]],["title/325",[115,313.524,614,773.156]],["content/325",[]],["keywords/325",[]],["title/326",[18,123.267,1926,914.868]],["content/326",[3,0.951,18,2.395,43,5.009,50,2.796,58,1.929,60,3.443,79,3.709,106,2.174,115,4.404,169,3.82,179,3.609,191,4.956,197,3.016,198,5.243,218,2.971,232,5.596,237,3.268,238,2.19,242,4.759,338,2.599,339,2.427,350,2.718,364,4.54,376,7.863,397,7.937,406,4.627,458,5.084,459,4.095,508,3.933,639,5.763,652,4.036,655,7.668,687,3.091,693,5.854,695,4.007,717,4.627,719,6.164,739,4.623,762,5.808,818,8.059,838,7.214,870,3.223,872,5.009,891,6.708,926,5.596,1022,7.863,1081,8.732,1082,4.392,1151,6.054,1173,6.708,1174,7.073,1217,5.064,1304,6.687,1370,6.054,1382,5.677,1514,9.454,1568,4.759,1575,6.054,1598,5.243,1703,4.22,1916,6.708,1927,4.855,1928,7.553,1929,7.553,1930,7.294,1931,7.294,1932,8.251,1933,6.88,1934,8.251,1935,8.251,1936,7.294,1937,7.553,1938,8.251,1939,12.212,1940,8.251,1941,8.251,1942,7.294,1943,7.294,1944,7.294,1945,8.251,1946,8.251,1947,8.251,1948,8.251,1949,8.251,1951,8.251,1952,8.251]],["keywords/326",[]],["title/327",[18,123.267,240,628.279]],["content/327",[18,2.225,50,3.036,58,2.48,106,3.505,238,3.52,240,11.342,266,7.801,323,5.533,350,4.367,363,6.888,364,5.834,458,5.911,776,5.908,1703,6.781,1811,9.124,1828,11.722,1829,11.056,1936,11.722,1953,13.26,1954,10.531,1955,13.26,1956,13.26,1957,10.305,1958,10.779,1959,13.26,1960,13.26]],["keywords/327",[]],["title/328",[50,301.275]],["content/328",[18,2.087,50,4.325,58,2.326,76,3.275,97,6.756,106,3.837,107,4.666,115,2.634,118,4.967,157,3.258,169,4.025,218,4.57,238,3.979,241,3.628,285,5.663,350,2.863,364,3.963,458,4.015,614,6.495,642,7.249,687,2.201,717,4.875,762,4.135,799,6.27,814,5.524,818,5.737,907,9.481,1068,6.49,1073,6.754,1151,6.379,1227,3.803,1232,6.905,1313,7.453,1395,9.897,1398,8.064,1399,6.297,1480,5.524,1648,6.905,1703,4.446,1927,7.466,1942,7.686,1944,7.686,1950,8.285,1957,6.756,1961,8.694,1962,12.69,1963,8.694,1964,5.278,1965,8.694,1966,8.694,1967,8.694,1968,8.694,1969,8.694,1970,8.694,1972,8.694,1973,6.495,1974,8.694,1975,8.694,1976,7.249,1977,6.168,1978,8.694,1979,8.694,1980,8.694,1981,8.694,1982,8.694,1983,8.694,1984,8.694,3059,9.242,3060,9.242]],["keywords/328",[]],["title/329",[958,480.942]],["content/329",[]],["keywords/329",[]],["title/330",[50,236.931,958,378.226]],["content/330",[18,1.319,46,6.649,50,3.914,54,6.872,58,2.269,61,7.121,106,3.718,152,4.542,233,6.951,238,2.939,319,7.812,323,4.619,370,6.385,382,4.213,400,6.513,457,5.265,687,4.328,958,6.704,960,8.603,1204,7.863,1387,6.721,1395,9.038,1398,7.034,1399,5.494,1635,7.404,1702,8.999,1906,9.786,1964,6.721,2020,11.258,2021,9.23,2022,11.07,2023,11.07,2024,11.07,2025,11.07,2026,11.07,2027,11.07,2028,11.07,2030,11.07,2031,11.07,2033,11.07,3061,12.828,3062,12.828,3063,12.828]],["keywords/330",[]],["title/331",[22,350.355,125,469.918]],["content/331",[12,7.685,18,2.334,22,5.693,115,5.094,655,10.559,864,10.321,1568,9.699]],["keywords/331",[]],["title/332",[466,596.939,1127,682.927]],["content/332",[]],["keywords/332",[]],["title/333",[1985,1315.941]],["content/333",[3,1.677,45,3.957,57,7.619,58,1.931,146,9.137,169,6.737,180,8.833,259,9.032,260,4.371,305,5.624,330,9.731,417,10.323,461,10.323,508,4.686,652,7.117,654,5.214,887,10.323,1074,9.602,1178,12.473,1346,9.359,1415,6.106,1528,10.323,1607,11.828,1796,11.828,1986,10.011,1987,14.55]],["keywords/333",[]],["title/334",[339,387.005]],["content/334",[0,6.575,3,1.877,5,5.162,16,4.704,18,1.94,36,4.554,56,3.111,58,1.34,60,4.212,75,10.108,79,4.907,106,3.424,146,6.338,169,6.537,192,8.652,237,2.701,242,5.822,260,4.891,305,3.901,318,7.393,338,4.447,339,5.186,370,5.822,374,8.652,382,3.841,456,4.583,461,7.161,466,5.822,510,3.531,580,4.469,652,4.937,654,3.617,718,6.062,739,3.821,760,4.164,796,6.715,864,6.195,872,8.571,942,6.492,963,9.317,1082,5.372,1185,7.279,1227,4.415,1304,4.643,1415,4.236,1467,6.661,1528,7.161,1568,5.822,1593,7.541,1598,6.414,1988,8.415,1989,8.923,1990,8.923,1991,6.751,1992,12.481,1993,10.093,1994,10.093]],["keywords/334",[]],["title/335",[341,460.385]],["content/335",[3,1.373,16,3.719,18,2.015,52,6.841,56,2.46,58,1.059,60,3.33,79,2.036,106,3.793,115,4.318,169,3.695,188,4.113,193,5.071,197,2.917,228,6.779,237,4.23,238,3.784,260,5.329,325,3.601,327,3.931,328,5.337,338,4.49,339,2.347,341,4.987,345,5.133,413,4.743,426,4.357,459,5.912,460,2.946,461,8.452,466,4.603,476,3.931,477,6.841,479,6.202,480,4.213,481,6.487,482,6.654,508,3.836,510,2.792,512,2.251,652,3.903,654,2.86,660,3.053,661,5.308,663,6.092,666,6.841,687,4.654,693,5.662,739,3.021,796,3.795,857,5.574,870,4.653,880,4.179,1015,7.394,1027,4.179,1082,4.247,1185,5.755,1210,6.288,1274,4.247,1304,5.48,1433,7.055,1466,5.574,1497,4.319,1575,5.855,1598,9.057,1637,6.202,1638,6.654,1788,6.487,1933,9.932,1992,7.055,1995,7.98,1996,6.487,1997,7.98,1998,6.487,1999,7.055]],["keywords/335",[]],["title/336",[50,301.275]],["content/336",[3,1.163,5,5.162,18,1.94,45,2.745,50,4.249,56,3.111,58,2.34,72,4.212,79,4.155,95,3.124,106,3.586,110,4.362,115,3.058,191,6.062,197,3.689,211,4.26,238,2.68,245,6.128,273,4.583,325,4.554,327,6.955,338,3.179,364,6.005,416,4.833,459,5.009,461,7.161,508,5.244,652,4.937,662,8.016,669,3.309,687,3.574,715,4.937,1019,4.388,1068,5.162,1073,5.372,1395,9.78,1399,5.009,1404,8.016,1502,7.686,1514,8.307,1569,4.285,1964,6.128,2000,8.923,2001,8.205,2002,12.481,2003,8.923,2004,8.923,2005,8.923,2006,8.923,2007,9.239,2008,10.093,2009,10.093,2010,10.093,2011,10.093]],["keywords/336",[]],["title/337",[22,350.355,125,469.918]],["content/337",[3,1.905,20,8.027,58,2.194,60,6.897,218,5.953,510,5.783,580,7.319,654,5.924,896,8.203,1019,7.187]],["keywords/337",[]],["title/338",[1101,807.709]],["content/338",[]],["keywords/338",[]],["title/339",[18,86.373,149,245.494,1323,460.781,1841,460.781]],["content/339",[3,1.518,16,6.138,18,2.419,29,7.454,58,1.748,95,4.077,106,3.004,115,3.99,149,5.713,197,4.813,208,7.385,323,5.496,451,9.498,509,7.597,512,3.715,580,5.832,660,5.038,669,4.318,677,10.235,718,7.91,762,8.026,870,5.145,1012,5.038,1101,8.084,1131,6.179,1186,7.828,1336,9.839,1584,10.981,1891,15.139,1892,11.643,2018,13.17]],["keywords/339",[]],["title/340",[22,350.355,125,469.918]],["content/340",[3,1.873,18,1.936,22,5.502,45,4.42,60,6.782,197,5.94,228,7.73,580,7.197,901,7.476,1301,13.932,1792,12.377,2019,16.253]],["keywords/340",[]],["title/341",[79,335.762]],["content/341",[]],["keywords/341",[]],["title/342",[50,301.275]],["content/342",[50,4.375,56,4.292,57,7.291,58,2.32,106,3.751,238,3.697,337,9.581,458,4.406,799,10.043,1068,7.121,1073,7.411,1222,9.726,1299,7.537,1395,10.501,1398,8.848,1399,6.91,1964,8.454,2012,13.925,2013,13.925,2014,12.31,2015,13.925,2016,13.925,2017,13.925]],["keywords/342",[]],["title/343",[22,350.355,125,469.918]],["content/343",[76,6.502,449,6.098,967,8.267,1157,10.596,1597,9.68]],["keywords/343",[]],["title/344",[449,365.537,1157,635.204]],["content/344",[]],["keywords/344",[]],["title/345",[50,301.275]],["content/345",[18,1.537,50,4.223,58,2.211,106,3.678,238,3.427,273,5.861,370,7.445,400,7.594,449,4.559,458,4.084,687,3.268,1068,6.601,1073,6.87,1332,10.493,1395,10.006,1398,8.202,1399,6.405,1860,10.493,1927,7.594,1977,9.158,2014,11.411,2020,7.923,2035,12.908,2036,12.908,2037,10.493,2038,12.908,2039,18.447,2040,12.908,2041,12.908,2042,11.065,2043,12.908,2044,12.908]],["keywords/345",[]],["title/346",[2020,807.709]],["content/346",[50,3.306,106,3.615,146,9.069,174,6.395,188,7.443,242,8.33,363,7.502,373,8.412,449,5.101,655,9.069,656,9.53,967,6.916,1399,7.167,1569,7.594,1809,12.041,2381,10.416,2390,10.087,3064,16.735,3065,16.735,3066,16.735,3067,16.735,3068,16.735,3069,16.735]],["keywords/346",[]],["title/347",[50,301.275]],["content/347",[]],["keywords/347",[]],["title/348",[2020,807.709]],["content/348",[1,6.819,3,1.207,18,1.978,22,2.28,45,1.832,46,4.046,50,3.591,58,2.082,92,3.318,94,5.35,95,2.085,106,3.618,110,2.911,115,3.172,116,3.885,132,4.779,145,3.318,174,2.983,179,2.946,188,3.472,190,5.35,207,5.35,218,2.426,221,4.705,233,4.23,238,2.779,242,6.039,243,4.445,260,2.023,328,4.505,350,4.23,364,4.01,370,3.885,429,5.616,430,3.71,438,5.482,445,5.35,457,3.204,458,5.253,480,3.556,508,2.169,512,2.954,528,4.388,652,3.295,655,4.23,657,5.774,660,2.577,663,3.445,687,3.666,688,4.635,695,5.084,697,7.681,717,5.871,719,5.032,740,5.616,901,3.098,936,4.858,958,3.826,1068,3.445,1073,3.585,1165,3.963,1204,3.098,1284,4.28,1387,4.089,1394,5.955,1398,4.28,1399,5.195,1409,4.089,1416,3.499,1490,5.616,1491,4.445,1568,3.885,1569,2.86,1574,5.032,1601,5.616,1715,4.004,1796,5.476,1821,8.99,1973,5.032,2020,9.627,2075,5.35,2101,5.955,2115,6.736,2116,6.736,2117,12.842,2118,6.736,2119,6.736,2120,6.736,2121,10.469,2122,6.736,2123,6.736,2124,6.736,2125,6.736,2126,10.469,2127,6.736,2128,6.736,2129,6.736,2130,6.736,2131,6.736,2132,6.736,2133,3.924,2134,6.736,2135,6.736,2136,6.736,2137,6.166,2138,6.736,2139,6.736,2140,10.469,2141,6.736,2142,6.736,2143,5.235,2145,6.736,2146,6.736,3070,7.805,3071,7.805,3072,7.805,3073,7.805]],["keywords/348",[]],["title/349",[22,350.355,125,469.918]],["content/349",[3,1.99,60,7.204,460,6.372,580,7.644,1597,9.68]],["keywords/349",[]],["title/350",[654,370.874,1082,550.801]],["content/350",[]],["keywords/350",[]],["title/351",[1415,552.266]],["content/351",[3,0.668,12,2.647,16,2.7,18,1.107,19,3.726,52,4.966,56,2.864,57,3.033,58,2.327,72,2.417,76,4.383,80,2.682,95,2.877,106,3.691,133,4.11,169,4.303,179,2.534,188,2.985,204,2.263,218,3.347,237,4.548,238,4.341,285,3.773,304,3.856,305,2.239,321,3.681,323,2.417,338,2.927,339,1.704,341,2.027,345,2.086,348,4.11,350,5.126,400,3.408,401,4.502,409,5.118,413,3.443,416,2.774,426,3.162,434,2.813,442,4.411,459,2.875,476,2.854,480,4.906,510,5.445,512,2.622,521,4.178,580,2.565,637,8.862,652,2.833,654,4.772,660,4.451,661,2.581,687,3.371,763,3.309,767,4.709,796,8.083,838,7.235,870,2.263,884,2.94,961,4.11,1019,2.518,1027,3.033,1065,2.518,1103,5.582,1164,4.411,1180,3.726,1227,2.534,1346,7.486,1385,3.929,1415,5.589,1449,3.058,1497,3.135,1508,4.046,1525,3.596,1557,8.538,1723,3.681,1954,4.6,1986,3.986,1991,3.874,2045,5.793,2046,5.302,2047,6.818,2048,14.579,2049,8.215,2050,9.293,2051,9.293,2052,12.888,2053,5.302,2054,6.394,2055,5.793,2056,5.793,2057,9.293,2058,5.793,2059,5.793,2060,5.793,2061,9.293,2062,5.793,2063,5.793,2064,4.502,2065,8.215,2066,11.637,2067,9.293,2068,5.121,2069,5.793,2070,4.6,2071,4.709,2072,5.793,2073,5.793,2074,5.121,2075,4.6,2076,3.929,2077,5.793,2078,5.793,2079,5.793]],["keywords/351",[]],["title/352",[456,597.534]],["content/352",[3,1.258,12,4.986,18,0.846,53,6.771,56,3.363,58,2.42,60,2.965,72,4.552,76,2.676,80,3.29,94,5.643,95,2.199,99,6.771,106,3.398,110,3.071,116,4.098,152,2.915,179,3.108,204,6.279,218,2.559,228,3.379,237,3.987,238,2.896,260,5.096,304,5.51,305,5.133,321,4.515,325,4.922,338,2.238,339,3.208,345,2.559,350,2.34,370,4.098,385,6.851,400,4.18,405,6.091,408,6.771,409,3.913,412,4.57,434,3.451,456,8.022,508,3.513,510,5.212,512,3.078,580,4.831,652,3.475,654,2.546,660,2.718,687,1.799,739,2.69,796,5.189,838,5.414,858,6.771,859,5.643,876,4.628,882,3.984,884,3.606,896,3.526,1123,4.715,1173,5.776,1385,4.819,1415,6.746,1416,5.667,1424,6.281,1446,9.645,1449,3.751,1452,5.776,1510,5.411,1525,4.41,1585,6.281,1698,5.776,1775,13.171,1788,5.776,1794,4.059,1999,6.281,2047,5.213,2071,5.776,2074,6.281,2080,6.281,2081,7.105,2082,7.105,2083,13.28,2084,7.105,2085,6.281,2086,7.105,2087,10.91,2088,7.105,2089,7.105,2090,7.105,2091,7.105,2092,6.504,2093,6.504,2094,6.281,2095,7.105,2096,7.105,2097,7.105,2098,7.105,2099,7.105,2100,7.105]],["keywords/352",[]],["title/353",[1416,683.567]],["content/353",[3,1.425,20,4.076,27,5.21,50,1.922,56,2.587,58,1.641,60,5.161,63,6.392,76,3.162,80,3.886,95,3.828,101,4.583,106,3.705,110,3.627,117,5.21,180,7.508,191,5.042,193,5.334,218,3.023,237,4.836,238,4.586,240,5.096,304,5.131,338,3.896,339,2.469,341,2.937,345,4.454,350,4.837,400,4.938,416,4.02,426,4.583,476,4.135,512,3.489,521,6.054,580,3.717,620,6.392,637,6.392,652,4.105,654,4.432,682,5.863,687,3.131,688,5.775,796,3.992,838,7.287,882,4.707,1415,3.523,1416,6.424,1510,9.418,1525,5.21,1597,4.707,1632,5.863,1703,4.292,1723,5.334,1755,5.21,1792,6.392,1876,7.42,2047,9.074,2049,7.42,2052,15.27,2054,8.509,2064,6.523,2065,7.42,2068,7.42,2076,5.693,2101,7.42,2102,12.367,2103,12.367,2104,8.394,2105,7.42,2106,8.394,2107,8.394,2108,8.394,2109,8.394,2110,8.394,2111,8.394,2112,8.394,3074,6.158]],["keywords/353",[]],["title/354",[510,362.059,1439,608.874]],["content/354",[15,7.274,45,2.788,58,1.361,76,3.862,106,3.6,107,5.503,118,5.858,152,4.206,188,5.284,197,3.747,218,3.692,232,6.953,237,4.752,304,5.922,305,3.963,339,4.829,470,4.206,488,6.364,503,9.011,508,4.597,510,6.762,512,4.027,520,5.412,762,4.876,884,5.203,901,4.716,963,9.42,1074,6.766,1227,4.485,1304,6.566,1351,7.968,1439,9.661,1497,5.55,1557,7.523,1583,6.094,1598,6.515,1887,6.953,2047,10.473,2076,6.953,2114,9.385,2749,11.299,2964,9.77,3075,7.808,3076,10.899,3077,10.899,3078,10.899,3079,10.899,3080,10.899,3081,10.899,3082,10.899,3083,9.77,3084,10.899]],["keywords/354",[]],["title/355",[22,350.355,125,469.918]],["content/355",[18,1.986,22,5.644,76,6.279,242,9.616,450,13.552,1105,12.232,1568,9.616,1792,12.695,1794,9.524]],["keywords/355",[]],["title/356",[3,119.285,95,320.351]],["content/356",[]],["keywords/356",[]],["title/357",[22,350.355,125,469.918]],["content/357",[3,2.236,12,7.554,22,5.596,79,4.217,205,15.751,615,12.846,864,10.146,1469,12.587,1568,9.534]],["keywords/357",[]],["title/358",[683,706.254]],["content/358",[]],["keywords/358",[]],["title/359",[2147,1045.084]],["content/359",[3,1.834,5,8.136,17,5.199,18,1.433,31,10.822,46,7.225,56,3.708,58,1.596,76,5.993,85,8.158,92,5.926,116,6.939,149,4.072,200,11.463,208,6.745,209,5.721,650,8.277,683,10.18,762,7.567,884,6.105,887,12.648,896,7.895,1012,4.601,1019,5.23,1065,5.23,1081,7.225,1131,5.644,1203,8.277,1325,12.933,1326,14.445,1427,8.535,1702,9.779,2148,12.364,2149,12.029,2150,12.029,2151,10.634,2152,12.029]],["keywords/359",[]],["title/360",[3,98.292,669,279.603,683,457.672]],["content/360",[3,2.258,17,5.653,18,1.558,22,4.429,31,7.942,46,7.857,50,2.995,58,1.736,62,7.021,76,4.927,87,11.27,98,6.905,258,5.056,319,5.978,406,7.335,426,7.142,510,4.577,649,5.428,669,6.423,683,10.514,954,10.634,1065,5.687,1131,7.884,1232,10.389,1336,9.773,1359,8.872,2153,13.082,2154,13.082,2155,13.082]],["keywords/360",[]],["title/361",[3,83.583,36,327.181,149,245.494,870,283.258]],["content/361",[3,2.269,8,3.585,18,2.018,20,5.286,36,6.711,50,4.366,54,6.756,58,2.249,85,7.382,87,6.608,90,7.85,104,7.28,115,3.297,149,5.737,211,7.153,218,3.92,234,6.404,406,6.103,414,9.33,416,5.212,444,8.848,512,3.071,632,9.075,649,6.172,661,4.85,669,5.972,683,5.842,708,6.404,776,4.85,870,7.115,872,6.608,1031,10.372,1095,6.835,1097,8.289,1098,8.644,1104,8.459,1127,7.183,1219,9.075,1331,11.327,1567,7.183,1636,6.103,1693,6.756,1755,6.756,1773,7.85,2156,9.963]],["keywords/361",[]],["title/362",[22,350.355,125,469.918]],["content/362",[45,4.573,50,3.85,76,6.334,95,5.205,113,12.805,323,7.017,466,9.699,1976,14.02]],["keywords/362",[]],["title/363",[3,98.292,58,113.175,79,217.583]],["content/363",[]],["keywords/363",[]],["title/364",[79,264.052,426,564.994]],["content/364",[3,1.922,58,2.213,79,4.975,85,11.306,370,9.616,615,12.956,2281,14.738,2282,13.552]],["keywords/364",[]],["title/365",[449,464.807]],["content/365",[3,1.458,8,4.166,11,5.935,12,5.781,58,1.984,79,4.935,82,9.801,156,10.283,158,8.655,373,5.042,382,4.813,396,7.874,416,6.057,449,5.28,508,6.076,569,10.045,627,6.045,679,14.244,683,4.645,869,8.655,1060,7.943,1106,8.541,1157,7.764,1158,12.76,1159,12.778,1161,5.87,1247,9.83,1346,5.567,1439,5.092,1514,8.795,1655,12.152,1675,10.283,2021,7.216,2192,5.638,2272,7.419,2278,8.578,2282,10.283,2283,12.649,2284,11.182,2285,12.649,2286,8.655,2287,11.578,2288,8.655,2289,12.649,2290,12.649,2291,8.655,2292,8.655,2293,8.655,2294,8.655,3085,13.709,3086,9.201]],["keywords/365",[]],["title/366",[434,639.068]],["content/366",[55,7.866,58,2.061,62,6.225,79,4.973,157,4.347,163,9.014,174,6.876,175,7.981,178,9.327,179,5.073,434,8.501,470,6.37,508,3.735,661,5.168,687,4.431,699,6.824,720,9.429,818,7.654,888,11.053,924,12.068,967,7.436,1019,5.043,1061,7.461,1074,7.654,1106,8.066,1370,8.51,1405,10.253,1421,9.429,1566,10.247,1636,6.504,1802,9.211,2165,11.825,2210,8.665,2213,10.253,2282,9.429,2295,8.229,2296,11.599,2297,13.727,2298,11.599,2299,11.599,2300,11.599,2301,11.599]],["keywords/366",[]],["title/367",[585,1022.656]],["content/367",[79,4.254,174,7.382,343,12.455,436,7.337,508,5.369,598,15.886,1606,11.644,2295,11.828,2302,11.001]],["keywords/367",[]],["title/368",[95,320.351,466,596.939]],["content/368",[]],["keywords/368",[]],["title/369",[218,372.686,662,821.883]],["content/369",[0,4.403,3,0.779,18,1.25,50,3.322,56,2.083,58,1.926,75,4.196,79,4.427,106,3.937,197,2.47,237,4.204,238,4.414,242,3.899,260,5.848,273,4.767,305,2.613,318,3.539,325,3.05,327,3.33,338,4.054,339,3.087,341,2.365,345,4.635,350,2.226,364,4.019,456,3.069,459,3.354,461,4.796,466,6.055,476,3.33,477,5.794,479,5.253,480,5.541,481,5.495,482,5.636,486,5.495,508,4.145,509,3.899,512,1.907,608,5.794,654,2.422,660,2.586,661,3.012,662,5.368,663,5.368,666,5.794,667,5.368,695,3.283,880,3.539,901,3.109,942,4.348,1015,6.516,1068,3.457,1073,3.598,1210,3.568,1227,2.957,1274,3.598,1395,8.715,1399,5.209,1415,2.837,1417,5.147,1514,3.977,1569,4.457,1593,5.05,1598,4.295,1964,4.104,1986,4.651,1988,5.636,1989,5.975,1990,5.975,1991,4.521,1998,5.495,2000,5.975,2001,5.495,2002,5.975,2003,11.377,2004,5.975,2005,5.975,2006,5.975,2157,6.759,2158,6.759,2159,6.759,2160,6.759,2161,10.497,2162,6.759,2163,6.759]],["keywords/369",[]],["title/370",[50,301.275]],["content/370",[3,1.798,8,5.138,50,4.602,106,3.337,211,7.914,234,9.179,649,6.473,669,5.115,762,7.42,1065,6.783,1097,11.88,1131,7.32,1221,12.682]],["keywords/370",[]],["title/371",[22,350.355,125,469.918]],["content/371",[3,1.938,22,5.693,27,10.438,552,9.261,902,10.816,1411,10.1,1568,9.699,2164,16.815]],["keywords/371",[]],["title/372",[434,502.581,1566,682.927]],["content/372",[]],["keywords/372",[]],["title/373",[45,357.876]],["content/373",[18,1.601,45,3.656,58,1.784,92,6.623,110,5.81,163,10.447,182,6.104,343,10.043,369,11.524,400,7.909,434,8.304,510,4.703,649,5.578,687,3.403,1165,7.909,1264,13.021,1416,6.983,1566,8.871,1606,9.39,1894,11.884,2165,15.56,2166,13.443,2167,13.443,2168,13.443,2169,13.443,2170,13.443,2171,13.443,2172,13.443,2173,11.884,2174,13.443,2175,13.443]],["keywords/373",[]],["title/374",[36,466.935,905,665.681]],["content/374",[106,4.029,434,8.646,1033,13.661,1034,9.002,1066,13.661,1098,11.385,1101,8.799,1566,9.46,2176,12.673,2177,12.673,2178,12.673]],["keywords/374",[]],["title/375",[460,382.009,958,378.226]],["content/375",[3,0.955,58,1.934,82,4.304,98,4.374,106,3.533,141,6.581,179,3.625,185,5.62,237,5.508,271,5.468,318,4.339,339,4.286,343,6.191,434,4.024,438,4.339,453,8.835,457,3.941,458,5.888,460,4.522,493,7.519,503,4.205,567,7.896,663,4.238,760,3.419,941,7.325,958,5.327,1019,3.603,1074,5.468,1165,9.473,1227,3.625,1264,11.099,1284,5.265,1377,6.44,1378,6.581,1449,4.374,2165,15.936,2173,7.325,2177,7.325,2178,7.325,2179,8.286,2180,10.214,2181,10.83,2182,7.585,2183,8.286,2184,7.325,2185,7.325,2186,7.325,2187,7.325,2188,7.325,2189,8.286,2190,8.286,2191,5.788,2192,5.398,2193,8.286,2194,8.286,2195,8.286,2196,8.286,2199,8.286,2200,8.286,2201,8.286,2202,8.286,2203,7.585,2204,8.286,2205,6.736,2206,6.581,2345,8.754,2979,5.031,3075,6.31]],["keywords/375",[]],["title/376",[79,335.762]],["content/376",[4,3.06,12,3.188,14,3.903,18,0.488,20,1.989,56,1.262,57,2.145,58,1.601,62,2.198,79,1.045,106,3.812,119,5.156,179,1.792,180,2.487,182,1.86,198,2.603,233,5.721,237,4.507,238,4.086,258,1.583,305,1.583,318,2.145,319,3.188,330,2.74,331,2.778,338,1.29,339,1.205,341,2.44,342,5.592,345,4.728,350,2.298,392,3.33,397,2.236,406,3.912,434,1.989,436,1.803,456,5.961,457,1.948,458,6.206,480,2.162,493,4.282,508,1.319,510,2.44,520,2.162,597,3.183,600,2.906,654,1.468,687,3.323,695,1.989,699,2.41,867,3.903,880,3.653,901,3.209,904,2.906,926,2.778,942,2.635,949,2.703,958,1.497,1027,2.145,1061,2.635,1204,1.884,1227,1.792,1264,6.938,1310,2.435,1322,3.23,1329,3.415,1355,3.808,1369,2.818,1377,3.183,1422,3.119,1449,2.162,1477,2.954,1480,2.603,1513,2.703,1587,2.572,1600,2.543,1643,2.74,1794,2.34,1846,2.635,1998,3.33,2133,8.161,2165,15.641,2176,3.621,2180,10.059,2181,6.167,2184,6.167,2185,6.167,2186,6.167,2187,6.167,2188,3.621,2207,4.096,2208,4.096,2210,6.806,2211,6.976,2212,3.621,2213,8.054,2214,4.096,2215,4.096,2216,9.111,2217,4.096,2218,4.096,2219,4.096,2220,15.94,2221,4.096,2222,4.096,2223,12.064,2224,4.096,2225,4.096,2226,4.096,2227,6.976,2228,9.111,2229,4.096,2230,4.096,2231,6.976,2232,4.096,2233,4.096,2234,4.096,2235,9.111,2236,4.096,2237,4.096,2238,4.096,2239,4.096,2240,4.096,2241,4.096,2242,6.976,2243,4.096,2244,4.096,2245,4.096,2246,3.33,2247,3.415,2248,4.096,2249,4.096,2250,4.096,2251,3.749,2252,3.749,2253,4.096,2254,3.749,2255,3.749,2256,3.253,2257,3.415,2258,3.621,2259,3.749,2260,3.749,2261,4.096,2262,4.096,2263,6.976,2264,4.096,2265,4.096,2266,4.096,2267,4.096,2268,4.096,2269,6.976,2270,4.096,2271,3.621,2272,3.511,2273,4.096,2274,3.749,2275,4.096,2276,4.096,2277,3.621,2278,2.778,2279,4.096,2280,2.668]],["keywords/376",[]],["title/377",[1428,605.03,2785,517.71,3087,753.863]],["content/377",[]],["keywords/377",[]],["title/378",[152,424.56,2147,821.883]],["content/378",[]],["keywords/378",[]],["title/379",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/379",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/379",[]],["title/380",[2789,780.553,2790,615.019,2791,677.243]],["content/380",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2790,11.821,2791,13.017,3087,14.489]],["keywords/380",[]],["title/381",[62,457.672,107,457.672,2785,517.71]],["content/381",[]],["keywords/381",[]],["title/382",[701,402.951,1322,335.742,2792,663.743,2798,621.606]],["content/382",[3,1.98,8,4.459,18,2.046,36,8.511,58,1.797,82,7.032,117,8.403,149,4.583,197,4.947,223,7.885,239,6.818,323,5.649,324,7.327,512,4.845,708,7.964,715,6.621,762,6.438,1012,7.216,1015,8.403,1225,10.113,1322,6.268,1583,10.208,1758,12.601,2679,11.287,2798,11.604,2799,12.391,3088,14.39]],["keywords/382",[]],["title/383",[17,272.593,18,75.13,45,171.537,1322,292.038,2800,525.901]],["content/383",[11,3.871,17,3.566,18,0.983,27,5.122,45,2.244,58,1.929,106,3.792,228,3.924,237,5.305,239,4.156,304,3.423,318,7.612,325,3.723,338,2.599,339,4.276,396,3.951,438,6.394,460,6.629,470,3.385,488,9.024,503,6.197,510,4.272,511,3.979,512,2.328,520,4.356,548,5.677,549,6.054,715,4.036,739,3.124,902,5.307,958,5.313,963,5.445,967,3.951,1015,9.024,1065,3.587,1123,3.566,1304,8.548,1311,6.164,1322,6.731,1428,5.854,1439,7.185,1449,4.356,1480,5.243,1586,6.054,1587,5.181,1713,6.054,2047,6.054,2113,7.863,2114,7.553,2198,6.164,2345,7.335,2749,8.403,2835,6.553,2836,6.553,2837,6.553,2838,6.553,2839,6.553,2840,6.553,2841,6.553,2842,6.553,2951,6.412,2979,7.414,3075,6.283,3089,8.771,3090,8.771,3091,15.455,3092,8.771,3093,8.771]],["keywords/383",[]],["title/384",[45,231.913,95,263.974,118,487.186]],["content/384",[11,1.938,17,1.785,18,0.492,50,1.609,58,1.75,95,1.279,106,3.938,145,2.035,160,4.465,173,2.691,182,1.876,237,5.092,238,4.246,260,2.754,304,3.804,338,1.301,339,2.696,341,2.458,345,5.334,348,2.931,350,3.02,396,4.39,436,4.76,438,2.163,456,1.876,457,3.342,458,4.451,460,3.993,470,6.336,473,3.031,488,4.361,491,7.207,499,5.238,503,2.096,511,4.421,512,1.982,513,3.87,514,4.053,516,3.086,518,2.802,519,5.067,520,2.181,521,2.979,522,3.358,523,3.358,530,2.802,535,4.699,539,2.885,543,2.885,544,11.105,546,2.885,548,2.842,549,3.031,687,1.046,958,1.51,967,3.365,975,2.979,1068,4.688,1073,2.199,1123,8.738,1210,2.181,1220,3.21,1355,5.905,1362,3.281,1415,1.734,1447,4.577,1449,3.709,1525,4.361,1587,2.594,1719,6.497,1723,2.625,1729,2.931,1823,3.444,2133,9.839,2345,4.22,2439,3.281,2440,3.146,2448,9.68,2449,3.444,2450,3.444,2451,7.936,2452,5.46,2470,3.444,2471,3.444,2472,3.21,2473,3.444,2474,3.444,2475,5.858,2477,5.858,2478,3.444,2480,6.431,2482,3.444,2483,3.444,2484,3.444,2485,3.444,2487,3.781,2785,2.508,2835,3.281,2836,3.281,2837,3.281,2838,3.281,2839,3.281,2840,3.281,2841,3.281,2842,3.281,2926,3.781,2927,3.781,2928,3.781,2929,3.781,2930,3.781,2931,3.781,2932,3.541,2934,3.541,2935,3.781,2937,3.781,2938,3.781,2939,3.781,2940,3.781,2942,3.781,2979,2.508,3087,3.652,3094,4.391,3095,4.391]],["keywords/384",[]],["title/385",[1857,692.162,2945,947.258]],["content/385",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/385",[]],["title/386",[1081,621.593,1151,759.301]],["content/386",[2952,16.234,2953,16.234]],["keywords/386",[]],["title/387",[12,288.256,18,75.13,258,243.803,364,196.957,760,260.224]],["content/387",[]],["keywords/387",[]],["title/388",[18,156.743]],["content/388",[18,1.554,58,0.916,106,3.861,110,2.983,113,9.932,150,6.942,152,2.832,179,3.02,218,2.486,237,4.245,238,2.833,239,3.477,260,5.568,266,6.278,304,6.958,305,4.124,338,4.622,339,4.665,341,2.415,345,3.843,456,6.663,459,3.426,476,3.401,509,7.523,510,4.563,511,6.29,512,4.14,654,2.474,660,4.082,778,8.464,796,5.075,803,4.387,838,3.426,962,6.578,963,4.556,1061,4.441,1103,4.146,1210,3.644,1244,12.328,1385,7.237,1415,2.897,1439,7.674,1447,4.497,1452,5.612,1470,11.695,1477,4.979,1501,4.556,1536,5.365,1627,4.556,1715,4.103,2054,4.75,2076,4.682,2085,6.103,2094,11.53,2548,6.903,2549,6.103,2550,6.903,2551,6.103,2552,9.433,2553,9.433,2554,6.903,2555,6.903,2556,10.67,2557,10.67,2558,6.903,2559,6.903,2560,6.903,2561,6.903,2562,6.903,2563,6.903,2564,6.903,2565,6.903,2566,6.103,2567,6.103,2749,7.342]],["keywords/388",[]],["title/389",[18,123.267,364,323.151]],["content/389",[3,0.877,8,5.457,18,1.649,22,2.575,31,4.617,56,3.541,58,1.525,106,3.803,115,2.304,119,4.304,152,4.714,176,6.693,187,8.147,204,4.488,208,4.265,209,3.617,211,4.85,241,3.174,258,2.94,260,2.285,266,4.475,288,4.521,342,4.668,364,4.324,458,3.635,512,3.907,596,4.521,660,2.909,669,2.494,718,4.568,850,12.242,1002,12.2,1012,2.909,1123,4.966,1132,8.695,1133,6.976,1135,7.582,1137,14.357,1138,4.521,1140,8.584,1143,6.52,1144,5.682,1553,4.43,1764,5.792,1793,5.087,2549,6.724,2568,10.517,2569,10.517,2570,6.962,2571,6.962,2572,6.962,2573,6.52,2574,6.962,2575,6.962,2576,6.962,2577,6.962,2578,7.606,2579,11.49,2580,9.58,2581,7.606,2582,7.606,2583,7.606,2584,7.606,2585,7.606,2586,7.606,2587,7.606,2588,7.606,2589,7.606,2590,7.606,2591,6.962,2592,7.606,2593,7.606,2594,7.606,2595,7.606,2596,7.606,2597,7.606]],["keywords/389",[]],["title/390",[654,370.874,1501,682.927]],["content/390",[12,4.429,18,1.154,56,2.987,58,1.286,62,5.201,101,5.291,106,3.083,107,8.548,118,9.896,150,5.158,152,6.534,204,6.222,241,4.044,260,2.911,303,6.572,305,3.746,382,3.688,412,10.245,453,6.989,456,6.23,654,6.207,686,8.87,699,8.072,719,7.24,760,3.998,778,5.59,793,8.307,794,7.696,796,6.525,799,6.989,838,6.809,906,8.307,1065,4.213,1387,5.883,1501,11.43,1535,12.129,1536,7.531,1540,8.567,1550,7.878,1553,5.645,1568,5.59,1671,5.883,1857,11.585,2552,8.567,2553,8.567,2566,8.567,2567,8.567,2598,9.691,2599,9.691,2601,15.312,2603,7.878,2604,8.567,2605,9.691,2606,9.691,2607,9.691,2608,8.567,3096,10.302,3097,10.302,3098,10.302,3099,10.302,3100,10.302]],["keywords/390",[]],["title/391",[12,472.947,760,426.953]],["content/391",[11,1.555,12,5.741,18,0.395,58,1.029,69,3.158,106,3.943,107,4.999,113,8.066,118,4.43,152,4.345,188,6.874,191,1.991,204,5.906,211,1.399,237,1.554,238,3.335,239,1.669,241,1.383,260,4.917,273,4.809,278,5.535,303,2.248,304,3.864,305,4.506,319,1.515,331,6.316,332,4.979,339,1.708,350,3.84,361,2.524,385,2.081,412,4.988,451,2.39,456,4.809,499,1.893,511,2.801,512,3.544,520,1.749,669,1.087,695,1.609,699,10.594,702,2.841,732,7.288,750,2.93,760,1.367,767,6.303,778,6.725,793,2.841,794,2.632,796,5.037,799,2.39,803,2.106,838,4.622,870,1.295,906,2.841,917,5.535,918,4.121,940,2.93,965,4.121,975,2.39,1015,2.057,1065,2.525,1130,2.217,1134,5.793,1161,2.248,1244,9.763,1286,5.535,1340,7.765,1503,2.315,1510,2.524,1513,2.187,1519,2.694,1550,4.722,1553,6.791,1558,2.575,1627,2.187,1710,8.921,1785,2.632,1811,2.28,1857,8.921,2054,3.997,2076,5.259,2143,2.575,2210,4.339,2212,2.93,2278,2.248,2394,4.843,2406,8.233,2551,2.93,2580,2.763,2601,10.306,2603,2.694,2604,2.93,2608,2.93,2609,3.033,2610,3.314,2611,3.314,2612,3.314,2613,3.033,2614,3.314,2615,3.314,2616,3.314,2617,3.314,2618,3.314,2619,3.314,2620,3.314,2621,5.809,2622,3.314,2623,9.314,2624,3.314,2625,7.754,2626,3.314,2627,5.809,2628,5.809,2629,5.809,2630,3.314,2631,3.314,2632,3.314,2633,3.314,2634,3.314,2635,3.314,2636,3.314,2637,3.314,2638,3.314,2640,7.754,2641,5.809,2642,3.314,2643,3.314,2644,5.809,2645,3.314,2646,3.314,2647,3.314,2648,5.317,2649,2.575,2650,3.314,2651,7.097,2652,3.314,2653,5.809,2654,3.314,2655,5.809,2656,3.314,2658,3.314,2659,3.314,2660,3.314,2661,3.314,2662,3.314,2663,3.314,2664,3.033,2665,3.314,2666,3.314,2667,3.314,2668,3.314,2669,3.314,2670,3.314,2671,3.314,2672,5.809,2673,3.314,2674,3.314,2675,5.809,2676,3.314,2677,3.314,2678,3.314,2679,2.763,2680,3.314,2681,3.314,2682,3.314,2683,3.033,2684,3.314,2685,3.314,2686,3.314,2687,3.314,2688,3.314,2689,3.314,2690,3.314,2691,3.314,2692,3.314,2693,3.314,3101,3.523,3102,3.523]],["keywords/391",[]],["title/392",[8,238.838,363,376.679,364,226.432,449,256.132]],["content/392",[]],["keywords/392",[]],["title/393",[8,340.857,3103,759.301]],["content/393",[3,1.413,8,5.305,18,1.46,50,3.688,56,3.778,58,2.536,149,4.149,174,7.967,198,7.788,203,11.219,204,7.464,285,7.984,323,5.114,350,4.037,363,6.367,364,3.827,417,8.696,585,9.525,596,7.285,660,4.688,678,7.139,683,6.578,776,5.461,870,4.788,1029,7.788,1065,5.329,1277,14.288,1343,11.219,1427,8.696,2347,10.835,3103,11.818,3104,13.029,3105,13.029,3106,13.029,3107,10.835,3108,11.68,3109,11.68,3110,13.029]],["keywords/393",[]],["title/394",[449,365.537,589,862.854]],["content/394",[1,7.74,3,1.37,8,5.836,18,1.88,20,5.77,27,7.376,56,3.662,58,2.505,72,4.958,89,6.854,104,7.947,149,4.023,174,7.846,211,5.016,215,11.022,218,4.279,363,6.172,364,4.928,365,12.263,373,9.192,406,6.663,414,10.186,449,6.258,507,10.504,715,5.812,870,4.641,884,6.03,1272,7.643,1283,8.57,1937,10.876,2404,10.876,3103,11.578,3107,10.504,3111,16.884,3112,9.437,3113,11.323,3114,12.631,3115,12.631,3116,12.631]],["keywords/394",[]],["title/395",[3,119.285,363,537.576]],["content/395",[3,1.2,8,3.429,18,1.595,20,2.392,22,0.931,45,1.34,46,1.653,50,1.864,56,2.51,58,1.85,72,1.148,76,1.036,79,0.702,80,3.096,98,1.452,106,3.953,115,2.838,118,1.572,145,4.615,149,3.524,150,5.541,152,1.129,156,2.237,157,5.406,174,1.218,180,4.06,182,1.249,187,1.619,204,2.612,209,1.309,211,2.823,218,0.991,223,1.603,228,2.343,237,0.736,238,1.775,239,1.386,240,4.06,258,1.904,273,1.249,287,1.984,301,5.975,319,1.257,350,1.622,361,5.092,363,6.282,364,4.642,380,1.893,428,1.952,444,2.237,445,2.185,449,3.677,453,3.552,457,1.309,458,4.044,470,2.021,491,2.928,509,1.587,512,3.191,513,2.713,514,2.841,580,1.218,596,2.928,612,1.866,626,1.893,649,3.379,656,1.816,660,2.558,669,0.902,678,3.895,682,9.735,701,5.205,718,1.653,720,2.237,762,2.343,763,1.572,803,1.748,856,2.432,870,1.075,875,2.294,880,1.441,882,1.543,884,2.5,901,4.309,913,2.751,935,1.984,954,2.237,1012,3.115,1015,1.708,1029,3.13,1034,3.093,1035,5.238,1036,1.952,1065,1.196,1075,1.893,1082,1.464,1104,2.138,1133,4.06,1135,4.413,1138,6.188,1152,3.68,1216,12.368,1219,2.294,1274,3.559,1277,2.185,1336,2.055,1387,1.67,1404,2.185,1409,1.67,1490,2.294,1497,1.489,1553,1.603,1569,3.457,1641,1.748,1643,3.294,1669,2.762,1671,1.67,1719,2.958,1755,1.708,1757,2.055,1782,2.019,1800,2.518,1807,2.294,1809,2.294,1810,2.138,1811,7.163,1813,2.518,1821,3.057,1825,2.518,1826,2.518,1829,2.294,1837,2.518,1845,2.358,1846,6.696,1851,10.366,1853,2.518,1880,2.294,1882,2.294,1884,2.294,1885,2.294,1886,2.294,1887,1.866,1888,2.294,1889,2.294,1927,1.619,1957,3.828,1964,1.67,2020,1.689,2960,9.367,3075,2.095,3103,2.019,3109,2.622,3112,5.311,3117,2.925,3118,2.925,3119,2.925,3120,2.185,3121,2.925,3122,2.622,3123,2.925,3124,2.925,3125,4.354,3126,2.925,3127,2.925,3128,2.925,3129,5.236,3130,2.925,3131,7.109,3132,4.744,3133,2.432,3134,2.432,3135,2.432,3136,2.925,3137,2.925,3138,2.925,3139,2.925,3140,2.294,3141,2.432,3142,2.925,3143,2.432,3144,2.925,3145,2.925,3146,2.925,3147,5.236,3148,2.925,3149,2.925,3150,5.236,3151,2.925,3152,2.925,3153,2.925,3154,2.925,3155,2.925,3156,2.925,3157,2.925,3158,2.925,3159,2.622,3160,2.622,3161,2.925,3162,2.925,3163,2.925,3164,2.925,3165,2.925,3166,2.925,3167,2.925,3168,2.622,3169,2.925,3170,2.925,3171,2.925,3172,2.925,3173,2.925,3174,2.925,3175,7.109,3176,8.657,3177,5.236,3178,2.925,3179,7.109,3180,2.925,3181,7.109,3182,2.925,3183,2.925,3184,2.925,3185,2.925,3186,7.109,3187,2.925]],["keywords/395",[]],["title/396",[3188,1163.321]],["content/396",[6,7.082,11,6.033,16,4.126,18,2.193,27,5.495,29,5.01,43,5.374,58,1.706,72,5.365,76,7.156,82,4.598,131,5.495,174,6.705,176,5.156,203,8.103,204,3.458,216,6.879,223,5.156,228,4.21,241,3.694,319,4.046,364,4.015,365,9.992,424,7.826,449,6.875,458,4.068,470,3.632,512,3.627,513,4.875,596,7.643,660,3.386,678,5.156,880,4.635,884,4.492,954,7.196,967,4.239,969,7.196,992,7.03,1025,7.03,1029,5.625,1060,5.559,1158,6.183,1159,6.879,1217,5.433,1256,8.436,1276,5.374,1284,5.625,1297,7.381,1298,10.453,1336,6.613,1423,6.879,1567,8.485,1584,7.381,1635,5.921,1636,4.964,1637,6.879,1668,6.495,1669,4.964,1671,5.374,1672,8.103,1703,4.527,1750,7.588,1872,7.381,2501,7.03,2505,6.741,3083,8.436,3107,7.826,3108,8.436,3120,7.03,3132,6.281,3188,7.826,3189,9.41,3190,9.41,3191,9.41,3192,9.41,3193,9.41,3194,9.41,3195,13.669,3196,9.41,3197,9.41]],["keywords/396",[]],["title/397",[8,207.749,58,83.711,449,222.791,967,302.059,3103,462.786]],["content/397",[8,5.864,18,2.121,76,5.4,174,6.348,204,5.6,364,5.559,373,8.35,382,5.455,449,5.063,509,8.269,596,8.521,624,12.673,967,8.526,991,14.336,1082,7.63,1277,11.385,1283,10.339,1300,11.385,2259,13.122,3103,13.063,3111,13.661,3198,15.239,3199,15.239]],["keywords/397",[]],["title/398",[853,965.506]],["content/398",[3,1.997,8,6.568,18,1.635,31,8.334,58,2.3,61,8.83,104,9.182,301,10.072,319,6.274,364,4.287,449,4.849,569,10.903,596,8.16,632,11.446,776,6.117,864,8.426,865,17.328,880,7.188,1019,5.969,1025,10.903,1082,7.307,1635,11.589,3103,12.713,3188,15.318,3200,14.594]],["keywords/398",[]],["title/399",[1428,605.03,2785,517.71,2786,649.387]],["content/399",[]],["keywords/399",[]],["title/400",[152,424.56,2147,821.883]],["content/400",[]],["keywords/400",[]],["title/401",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/401",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/401",[]],["title/402",[2789,780.553,2790,615.019,2791,677.243]],["content/402",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2786,12.481,2790,11.821,2791,13.017]],["keywords/402",[]],["title/403",[62,457.672,107,457.672,2785,517.71]],["content/403",[]],["keywords/403",[]],["title/404",[701,402.951,708,426.638,762,344.879,2792,663.743]],["content/404",[3,1.864,17,5.331,18,1.469,36,8.643,58,2.147,115,3.737,117,7.656,149,5.476,171,8.896,223,7.185,239,6.212,258,4.768,323,5.147,324,6.676,512,4.563,701,8.988,708,11.27,715,6.033,762,5.866,870,4.818,1012,7.327,1015,7.656,1225,9.215,1703,6.308,1758,11.867,2679,10.284,2793,12.335,2794,12.335,2795,9.586,2796,11.29,2797,16.174,2798,13.865,2799,11.29]],["keywords/404",[]],["title/405",[1034,535.481,1322,394.828,2800,711.003]],["content/405",[3,1.992,50,3.957,106,3.792,118,5.509,143,7.343,150,5.132,152,3.956,157,5.953,182,4.378,228,6.502,235,8.266,258,3.727,271,6.363,428,6.841,438,5.049,512,4.481,626,6.635,638,9.189,701,8.827,703,7.658,901,4.435,935,6.954,1012,5.23,1034,8.585,1035,10.217,1036,6.841,1138,8.126,1156,7.204,1221,7.839,1284,6.127,1299,5.219,1636,5.407,1641,6.127,1643,6.449,1756,8.524,1757,7.204,1841,6.127,1846,8.794,1880,13.244,1882,8.04,1884,8.04,1885,8.04,1886,8.04,1887,6.54,1888,8.04,1889,8.04,2347,8.524,2785,5.854,2786,7.343,2801,9.643,2802,7.204,2803,9.643,2804,9.643,2805,9.643,2806,9.643,2807,6.954,2808,13.672,2809,9.643,2810,9.643]],["keywords/405",[]],["title/406",[1101,523.417,1322,394.828,2800,711.003]],["content/406",[3,1.813,18,1.873,98,8.302,106,2.8,438,8.235,512,4.437,669,5.157,948,13.903,1012,6.016,1101,9.653,1891,12.785,2795,12.222,2807,11.343,2811,14.395,2812,15.727,2813,15.727]],["keywords/406",[]],["title/407",[17,313.386,18,86.373,1322,335.742,2814,725.149]],["content/407",[11,1.797,16,1.785,17,1.655,18,1.508,20,7.537,55,4.466,56,2.03,58,2.183,79,3.457,98,3.476,106,3.618,115,3.511,116,2.209,131,2.377,145,1.887,149,2.933,150,2.038,157,1.435,160,4.185,161,3.193,182,1.739,185,2.597,204,2.573,237,4.003,238,4.12,241,1.598,253,3.386,259,2.377,260,2.602,318,5.386,330,2.562,332,8.818,339,3.025,350,4.926,396,3.154,416,1.834,430,3.627,434,1.86,436,2.898,438,5.386,449,1.353,456,2.99,458,3.667,459,4.299,460,3.198,464,6.028,465,3.65,470,1.571,473,2.81,488,4.088,499,2.188,503,1.944,510,3.031,511,3.176,512,1.858,518,4.466,519,2.762,520,2.022,528,2.495,548,2.635,549,2.81,656,2.527,687,2.193,695,1.86,715,3.221,717,2.148,732,2.635,778,2.209,818,5.717,873,3.386,882,2.148,893,3.65,905,4.236,918,2.717,949,2.527,958,3.166,965,2.717,966,2.717,967,4.926,968,3.113,976,9.007,1002,2.405,1012,1.465,1015,4.088,1035,2.464,1081,3.956,1106,1.989,1123,4.446,1127,2.527,1203,2.635,1204,1.762,1210,2.022,1274,2.038,1284,2.434,1304,3.029,1311,2.861,1322,6.274,1346,2.464,1366,4.531,1440,2.976,1445,2.675,1448,2.717,1449,3.476,1470,2.562,1477,2.762,1503,2.675,1514,2.253,1519,3.113,1539,2.976,1558,5.118,1586,2.81,1587,5.44,1632,2.675,1694,4.405,1710,2.562,1717,2.976,1759,2.597,1924,2.976,1930,3.386,1931,3.386,1943,3.386,1957,2.976,2133,2.231,2143,5.118,2151,3.386,2197,3.193,2198,2.861,2284,3.386,2345,2.3,2376,3.386,2451,2.81,2452,2.976,2603,3.113,2795,6.733,2802,7.685,2807,7.419,2815,3.386,2816,3.83,2817,6.586,2818,3.83,2819,3.83,2820,3.83,2821,3.83,2822,3.83,2823,3.83,2824,3.83,2825,3.83,2826,3.83,2827,3.83,2828,3.83,2829,3.83,2830,3.83,2831,3.83,2832,3.83,2833,3.83,2834,3.83,2835,3.042,2836,3.042,2837,3.042,2838,3.042,2839,3.042,2840,3.042,2841,3.042,2842,3.042,2843,3.83,2844,3.83,2845,3.283,2846,3.83,2847,3.83,2848,3.83,2849,6.586,2850,3.83,2851,3.83,2852,3.83,2853,3.83,2854,3.83,2855,3.83,2856,3.83,2857,3.83,2858,3.83,2859,6.586,2860,3.83,2861,6.586,2862,3.83,2863,6.586,2864,3.83,2865,6.028,2866,3.83,2867,6.586,2868,3.83,2869,3.83,2870,6.586,2871,3.83,2872,3.83,2873,3.83,2874,3.83,2875,3.83,2876,3.83,2877,3.83,2878,3.83,2879,3.83,2880,3.83,2881,3.83,2882,3.83,2883,6.586,2884,3.83,2885,3.83,2886,3.83,2887,3.83,2888,3.83,2889,3.83,2890,3.83,2891,3.83,2892,3.83,2893,3.83,2894,3.83,2895,3.283]],["keywords/407",[]],["title/408",[50,195.235,1322,394.828,2896,852.766]],["content/408",[5,2.668,11,2.448,16,2.432,17,2.255,18,1.865,20,4.146,46,3.134,50,3.162,55,7.35,56,2.632,58,2.413,82,2.71,98,2.754,106,3.648,115,2.587,149,2.891,157,1.955,193,3.315,238,1.385,242,3.01,245,5.183,259,3.239,260,1.567,273,2.369,285,3.399,293,8.574,319,2.384,325,2.354,327,4.206,364,3.91,396,5.19,426,2.848,436,2.296,438,6.557,442,6.502,470,3.503,491,5.075,508,2.75,510,1.825,512,1.472,513,2.874,514,4.925,544,5.492,687,2.743,695,2.534,715,5.301,717,2.926,762,2.481,796,2.481,882,2.926,890,3.07,896,2.589,958,4.577,1002,8.674,1015,3.239,1035,3.356,1082,2.777,1093,5.492,1106,2.71,1123,4.684,1204,3.927,1210,6.611,1272,5.492,1322,3.953,1395,5.128,1399,6.854,1442,3.763,1497,2.824,1514,3.07,1535,6.502,1539,4.055,1569,5.317,1574,3.898,1635,3.49,1694,5.711,1703,2.668,1719,3.134,1793,3.49,1821,6.727,1822,6.502,1916,6.941,1927,5.023,1964,5.183,1996,4.241,2001,4.241,2020,9.609,2071,4.241,2280,5.562,2361,3.973,2381,3.763,2382,4.612,2390,3.644,2403,4.612,2410,4.612,2419,4.612,2420,4.35,2498,4.241,2499,4.241,2507,6.941,2508,7.119,2509,4.241,2512,4.241,2520,4.241,2526,4.612,2527,4.612,2529,7.548,2534,4.612,2535,4.612,2542,4.612,2545,4.612,2802,8.096,2807,7.816,2815,4.612,2897,5.217,2898,5.217,2899,5.217,2900,5.217,2901,8.538,2902,5.217,2903,5.217,2904,5.217,2905,5.217,2906,4.612,2907,8.538,2908,5.217,2909,8.538,2910,5.217,2911,5.217,2912,5.217,2913,5.217,2914,5.217,2915,5.217,2916,5.217,2917,5.217,2918,5.217,2919,5.217,2920,5.217,2921,5.217,2922,5.217,2923,5.217,2924,5.217,2925,5.217]],["keywords/408",[]],["title/409",[45,231.913,95,263.974,118,487.186]],["content/409",[3,0.334,11,1.358,17,1.251,18,1.155,50,2.219,58,1.741,95,0.896,106,3.952,145,4.164,149,1.745,160,3.275,173,1.886,182,1.314,233,3.236,237,4.636,238,4.134,260,2.093,273,2.34,304,2.89,331,5.733,338,0.912,339,2.049,341,1.803,345,4.477,348,2.054,350,2.784,364,0.904,396,5.146,436,3.72,449,1.022,456,1.314,457,2.451,458,3.685,460,2.572,470,5.381,473,2.124,488,3.199,491,7.797,493,4.276,499,4.829,503,1.469,511,3.36,512,2.385,513,4.656,514,6.198,516,2.163,518,1.963,519,3.717,520,2.721,521,2.088,522,2.353,523,2.353,530,1.963,535,3.447,539,2.022,543,2.022,544,9.764,546,2.022,548,1.992,549,2.124,660,1.107,661,2.296,687,0.733,732,3.546,758,2.353,778,1.67,803,1.839,814,1.839,838,1.436,918,3.657,958,3.089,965,3.657,966,3.657,967,5.578,975,2.088,1068,3.563,1073,1.541,1093,1.862,1123,8.475,1204,2.371,1210,1.528,1322,2.386,1355,4.615,1362,2.299,1380,1.963,1399,1.436,1415,1.215,1447,3.357,1449,2.721,1525,3.199,1569,3.589,1586,3.782,1587,1.818,1713,2.124,1715,1.721,1719,6.454,1723,1.839,1729,2.054,1793,5.654,1822,3.925,1823,2.413,1927,1.703,1958,4.19,1977,2.054,2020,3.164,2133,8.589,2197,2.413,2198,2.163,2381,2.088,2383,2.353,2390,3.6,2439,2.299,2440,2.204,2448,8.015,2449,2.413,2450,2.413,2451,6.202,2452,4.005,2470,2.413,2471,2.413,2472,2.25,2473,2.413,2474,2.413,2475,4.297,2477,4.297,2478,2.413,2482,2.413,2483,2.413,2484,2.413,2485,2.413,2493,2.559,2494,2.559,2495,2.559,2496,2.559,2497,2.413,2498,4.19,2499,4.19,2500,4.556,2501,4.093,2502,2.559,2503,2.559,2504,2.559,2505,2.204,2506,2.559,2507,4.19,2508,4.297,2509,4.19,2510,2.559,2511,2.559,2512,2.353,2513,2.559,2514,2.204,2515,2.559,2516,2.559,2517,4.556,2518,2.559,2519,2.559,2520,2.353,2521,2.559,2522,2.559,2523,2.559,2524,2.559,2785,1.757,2786,2.204,2807,2.088,2835,2.299,2836,2.299,2837,2.299,2838,2.299,2839,2.299,2840,2.299,2841,2.299,2842,2.299,2906,2.559,2926,2.65,2927,2.65,2928,2.65,2929,2.65,2930,2.65,2931,2.65,2932,2.481,2933,2.895,2934,2.481,2935,2.65,2936,5.154,2937,2.65,2938,2.65,2939,2.65,2940,2.65,2941,2.895,2942,2.65,2943,2.895,2944,2.895]],["keywords/409",[]],["title/410",[1857,692.162,2945,947.258]],["content/410",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/410",[]],["title/411",[1081,621.593,1151,759.301]],["content/411",[2952,16.234,2953,16.234]],["keywords/411",[]],["title/412",[1158,722.84,1159,804.245]],["content/412",[]],["keywords/412",[]],["title/413",[345,307.098,449,301.208,3201,625.674]],["content/413",[1,9.923,57,7.977,58,2.022,72,6.357,95,4.716,149,5.157,382,5.797,400,8.963,449,7.027,508,4.906,715,7.451,1103,9.15,1227,6.664,1669,8.542,2295,10.809,3132,10.809,3201,11.177,3202,12.099]],["keywords/413",[]],["title/414",[449,365.537,508,333.282]],["content/414",[3,1.593,36,4.416,43,5.942,45,2.662,50,3.163,58,2.125,76,3.687,79,3.526,92,6.807,106,3.558,149,4.678,211,4.132,218,4.976,237,2.619,238,3.668,266,5.759,304,5.733,338,3.083,339,5.117,341,3.424,350,4.551,382,3.725,438,7.235,449,5.657,508,3.152,512,5.177,584,8.959,669,4.53,687,2.478,870,3.824,884,4.967,1012,3.744,1019,4.256,1101,6.008,1225,7.313,1297,8.161,1475,8.161,1632,6.837,1706,10.861,1723,6.22,1724,7.313,1750,8.391,1758,10.138,1976,8.161,3120,7.774,3201,7.182,3203,10.405,3204,15.381,3205,10.405,3206,10.405,3207,7.454,3208,14.689,3209,8.653,3210,9.327,3211,7.774]],["keywords/414",[]],["title/415",[508,333.282,3201,759.301]],["content/415",[27,8.462,126,10.002,149,5.84,188,7.026,218,4.909,323,5.688,417,9.672,449,6.685,460,5.032,508,5.556,693,9.672,901,6.27,902,8.769,1274,7.255,1299,9.337,1636,7.644,1669,11.154,2205,11.082,2295,12.239,2746,12.478,3132,12.239,3201,10.002,3202,10.826,3212,14.491,3213,14.491]],["keywords/415",[]],["title/416",[2295,734.248,3132,734.248]],["content/416",[4,2.6,11,1.633,18,1.429,20,1.69,22,1.178,24,6.396,43,2.113,50,0.797,56,3.697,58,1.592,62,1.868,63,2.65,75,2.16,79,2.055,80,4.462,82,1.808,106,3.841,121,3.48,124,2.829,133,2.469,145,1.715,149,4.626,156,12.123,174,3.566,185,4.111,218,1.253,237,2.579,238,2.138,273,2.753,305,2.343,319,1.59,324,1.884,325,2.735,338,1.096,339,2.369,345,3.934,350,1.146,363,1.808,370,2.007,374,2.983,385,2.185,392,2.829,397,1.9,413,2.069,436,5.279,449,6.287,458,3.049,480,3.2,493,2.136,508,1.952,511,3.884,535,2.328,585,2.705,649,1.444,650,2.395,654,1.247,660,4.179,663,1.78,687,1.535,688,2.395,740,2.902,746,6.259,762,3.83,803,6.123,937,3.48,963,2.297,967,3.857,1017,6.547,1074,2.297,1104,2.705,1105,2.553,1123,5.906,1152,6.017,1158,2.431,1159,2.705,1165,3.567,1185,2.51,1222,2.431,1272,2.239,1276,2.113,1299,1.884,1310,3.603,1311,2.6,1355,1.9,1358,2.705,1359,2.36,1416,3.149,1429,2.902,1442,2.51,1465,2.705,1619,5.197,1622,6.547,1638,2.902,1643,2.328,1669,9.841,1703,1.78,1782,7.07,1786,4.529,1794,1.988,1819,3.186,1933,5.054,1991,2.328,2192,2.267,2295,2.469,2514,4.616,2649,2.705,2651,3.186,2749,2.395,2795,2.705,2965,3.316,3112,2.764,3120,2.764,3132,14.056,3133,11.4,3140,2.902,3141,11.4,3202,6.396,3204,3.077,3207,7.338,3209,3.077,3210,3.316,3211,2.764,3214,6.444,3215,3.7,3216,5.359,3217,3.7,3218,6.444,3219,7.675,3220,3.316,3221,3.316,3222,3.316,3223,7.675,3224,9.183,3225,3.077,3226,8.519,3227,3.7,3228,3.077,3229,3.7,3230,3.316,3231,5.777,3232,3.7,3233,3.316,3234,3.316,3235,3.7,3236,3.316,3237,3.316,3238,3.316,3239,3.316,3240,3.7,3241,3.7,3242,3.7,3243,3.316,3244,3.316,3245,3.7,3246,3.316,3247,3.7,3248,5.777,3249,3.316,3250,3.316,3251,3.316,3252,5.777,3253,5.777,3254,3.316,3255,7.675,3256,7.675,3257,3.316,3258,3.316,3259,3.316,3260,5.777,3261,3.7,3262,3.316,3263,3.316,3264,3.316,3265,3.316,3266,3.316,3267,3.7,3268,3.316,3269,3.7,3270,3.7,3271,3.7,3272,3.7]],["keywords/416",[]],["title/417",[50,301.275]],["content/417",[1,4.916,3,1.317,8,3.762,20,7.464,50,3.977,58,1.002,72,4.766,76,2.843,92,3.718,106,3.815,123,10.455,149,3.867,152,5.654,174,5.058,176,4.396,211,4.822,234,4.44,238,2.003,266,4.44,273,3.427,324,6.183,364,4.304,413,4.486,449,6.373,508,2.43,512,2.129,513,4.156,514,4.353,596,4.486,669,3.745,695,3.665,746,5.865,1095,4.739,1097,5.747,1165,4.44,1216,5.638,1222,5.271,1387,4.581,1399,3.745,1569,3.204,1622,6.135,1669,7.728,1693,4.684,1719,4.533,1782,5.537,1785,5.993,1821,7.09,1836,11.814,1887,5.118,3112,10.946,3125,6.671,3132,11.714,3134,10.098,3135,10.098,3143,10.098,3201,5.537,3202,9.072,3207,5.747,3216,10.098,3226,6.671,3228,10.098,3273,6.292,3274,7.191,3275,7.191,3276,7.191,3277,7.191,3278,10.885,3279,14.646,3280,10.885,3281,10.885,3282,10.885,3283,7.191,3284,7.191,3285,7.191,3286,7.191,3287,7.191,3288,7.191,3289,8.022]],["keywords/417",[]],["title/418",[22,350.355,125,469.918]],["content/418",[8,6.359,31,9.95,58,2.175,364,5.118,449,5.789,569,13.017,596,9.742,1082,8.723,1165,9.643,3290,17.423]],["keywords/418",[]],["title/419",[45,281.443,173,674.112]],["content/419",[1,1.441,4,1.653,11,1.038,18,0.957,20,3.351,24,3.212,45,0.602,50,0.926,58,1.198,63,1.685,72,2.331,75,1.373,79,2.05,80,1.873,82,1.149,89,1.276,92,1.09,95,0.685,106,3.922,107,1.188,118,1.264,124,1.799,145,1.09,149,3.35,152,2.831,156,8.044,160,1.406,163,1.72,173,1.441,174,3.055,176,1.289,185,2.743,197,0.809,202,3.575,232,1.501,233,6.698,237,2.415,238,4.211,273,2.536,304,2.863,318,1.159,324,1.198,325,0.998,338,1.759,339,1.643,341,0.774,345,5.283,350,3.944,364,1.263,397,1.208,413,1.315,434,1.964,436,4.694,438,2.118,449,6.117,456,1.005,457,1.923,458,3.375,460,0.817,470,3.702,476,1.09,480,2.135,491,4.102,499,3.191,503,1.123,508,1.799,511,4.772,512,1.947,513,3.076,514,3.98,520,2.135,526,1.685,528,1.441,530,1.501,535,1.48,539,1.545,543,1.545,544,6.861,546,1.545,585,1.72,660,1.547,661,1.802,663,1.132,687,1.024,695,4.805,746,5.362,762,1.052,772,5.255,778,1.276,803,2.57,814,1.406,871,2.213,880,1.159,891,1.799,942,1.423,967,3.304,975,1.596,992,1.757,1017,4.541,1068,1.132,1073,1.178,1095,1.389,1123,6.34,1152,1.653,1158,1.545,1159,1.72,1165,2.379,1216,1.653,1227,0.968,1264,8.123,1272,1.423,1274,2.153,1355,1.208,1358,3.143,1359,1.501,1366,1.522,1387,2.455,1399,1.098,1415,1.697,1416,2.901,1447,1.441,1470,3.736,1569,0.939,1598,1.406,1619,3.467,1622,4.541,1629,2.025,1669,7.027,1670,1.845,1706,2.743,1715,1.315,1719,3.355,1723,1.406,1724,1.653,1725,1.72,1729,1.57,1782,5.895,1785,1.757,1821,2.51,1836,4.788,1841,2.57,1857,1.48,1904,1.956,1988,1.845,1991,1.48,2054,2.783,2133,7.3,2137,2.025,2180,1.845,2206,1.757,2448,6.808,2501,3.212,2505,1.685,2514,3.08,2543,2.025,2649,1.72,2749,1.522,2802,3.021,2934,1.897,2979,1.343,3112,5.48,3120,4.436,3125,1.956,3132,12.619,3133,7.978,3134,3.575,3135,3.575,3140,1.845,3141,4.938,3143,3.575,3201,5.063,3202,5.48,3204,1.956,3207,1.685,3209,1.956,3211,4.436,3216,3.575,3219,3.854,3220,2.109,3221,2.109,3222,2.109,3223,2.109,3224,5.323,3225,1.956,3226,4.938,3228,3.575,3230,2.109,3231,6.575,3233,2.109,3234,2.109,3236,2.109,3237,2.109,3238,2.109,3239,2.109,3243,2.109,3244,2.109,3246,2.109,3248,3.854,3249,2.109,3250,5.323,3251,3.854,3252,6.575,3253,5.323,3254,2.109,3255,5.323,3256,5.323,3257,2.109,3258,2.109,3259,2.109,3260,3.854,3262,2.109,3263,2.109,3264,2.109,3265,2.109,3266,2.109,3273,1.845,3274,2.109,3275,2.109,3276,2.109,3277,2.109,3278,3.854,3279,6.575,3280,3.854,3281,3.854,3282,3.854,3283,2.109,3284,2.109,3285,2.109,3286,2.109,3287,2.109,3288,2.109,3291,2.352,3292,2.352,3293,2.352,3294,2.352,3295,2.352,3296,2.352,3297,2.352,3298,2.352,3299,2.352,3300,2.352,3301,4.299,3302,4.299,3303,2.352,3304,2.352,3305,2.352,3306,5.938,3307,2.352,3308,2.352,3309,2.352,3310,2.352,3311,2.352,3312,2.352,3313,2.352,3314,2.352,3315,2.352,3316,2.352,3317,2.352,3318,2.352]],["keywords/419",[]],["title/420",[1627,682.927,2303,841.289]],["content/420",[]],["keywords/420",[]],["title/421",[157,387.826,416,495.593]],["content/421",[3,1.77,58,2.038,61,9.877,79,3.918,87,9.322,110,6.636,157,5.754,204,5.998,260,4.612,293,9.531,510,5.372,654,5.503,876,10.002,958,5.612,1152,11.471,1409,9.322,2304,13.574,2431,15.355,2432,15.355]],["keywords/421",[]],["title/422",[45,357.876]],["content/422",[65,9.323,79,3.605,95,4.373,157,5.294,202,12.489,305,5.461,382,5.376,449,4.99,509,8.149,512,3.985,513,7.781,654,5.063,772,10.758,778,8.149,796,6.719,900,11.779,914,13.462,957,13.462,1065,6.142,1103,8.485,1156,10.554,1284,8.977,1501,9.323,2191,9.867,2206,11.219,2433,14.127,2434,14.127,2435,14.127,2436,14.127,2437,14.127]],["keywords/422",[]],["title/423",[79,264.052,318,541.885]],["content/423",[3,1.329,7,5.521,56,3.554,58,2.475,80,5.338,106,3.107,128,9.613,145,5.68,160,7.326,204,6.817,237,3.086,241,4.811,260,3.463,305,4.457,339,3.391,396,5.521,436,6.807,456,7.925,458,3.648,473,8.459,510,4.034,512,4.363,513,6.35,514,6.651,516,8.614,518,7.82,519,11.155,551,10.987,870,4.504,944,8.78,967,5.521,1157,7.077,1415,4.839,1449,6.086,1465,8.96,1477,8.315,1480,7.326,1525,9.601,1587,7.24,1703,5.896,1713,8.459,2080,10.193,2438,8.78,2439,9.157,2440,8.78,2441,9.613,2442,9.884,2443,11.53]],["keywords/423",[]],["title/424",[778,759.051]],["content/424",[3,0.853,5,3.786,45,2.013,58,1.494,79,2.872,106,3.82,177,5.753,237,5.163,238,4.577,241,3.089,245,4.494,304,6.315,328,4.951,338,2.332,339,2.177,341,5.325,345,4.054,350,5.013,396,5.391,434,3.595,449,2.615,457,3.521,458,2.342,459,3.674,476,3.647,488,6.988,499,4.229,511,6.569,512,2.088,513,4.077,514,4.27,520,5.942,521,5.339,522,6.018,523,6.018,526,5.637,527,7.054,660,2.832,661,3.298,687,3.448,693,7.987,739,2.803,778,4.27,880,3.876,926,5.021,967,3.545,1123,7.452,1276,4.494,1310,4.4,1355,4.042,1467,4.885,1598,4.704,1627,4.885,1669,7.638,1719,4.446,1723,4.704,1724,5.531,1725,5.753,1729,5.252,2064,5.753,2105,6.544,2133,4.312,2303,6.018,2345,4.446,2438,5.637,2444,7.403,2445,7.403,2446,7.403,2447,7.403,2448,5.094,2449,9.386,2450,6.172,2451,5.432,2452,5.753,2457,7.403,2458,7.403,2459,7.403,2460,7.403,2461,7.403,2462,11.257,2463,7.403,2464,7.403,2465,7.403,2466,7.403,2713,6.346,2769,6.776,3319,7.87,3320,7.87,3321,7.87,3322,7.87]],["keywords/424",[]],["title/425",[161,1097.182]],["content/425",[7,2.807,20,2.847,24,4.656,45,2.552,89,3.382,106,3.902,107,3.146,149,1.985,152,2.405,157,2.197,160,5.962,171,4.228,193,3.725,218,2.111,237,4.832,238,4.362,260,3.524,270,4.159,321,3.725,338,1.847,339,1.724,341,3.283,345,5.282,350,3.864,396,4.493,436,5.901,457,2.788,458,3.712,460,2.164,470,7.222,491,8.718,503,2.975,508,3.022,511,5.657,528,3.819,529,5.587,530,3.976,535,3.921,539,4.095,543,4.095,544,12.269,546,4.095,548,4.034,549,4.301,552,3.229,687,1.484,688,4.034,803,3.725,876,3.819,949,3.869,967,2.807,1123,8.697,1156,4.38,1355,6.404,1710,3.921,2133,10.744,2345,3.521,2438,4.464,2448,10.092,2451,4.301,2467,5.366,2468,5.863,2469,5.863,2470,4.888,2471,4.888,2472,4.556,2473,4.888,2474,4.888,2475,7.823,2476,5.863,2477,4.888,2478,4.888,2479,11.731,2480,5.366,2481,5.863,2482,4.888,2483,4.888,2484,4.888,2485,4.888,2486,5.863,2487,5.366,2488,9.383,2489,5.863,2490,5.863,2491,5.863,2492,5.863,2979,3.559]],["keywords/425",[]],["title/426",[50,301.275]],["content/426",[18,1.341,50,3.118,58,0.982,106,3.96,145,4.724,149,3.247,160,2.791,164,3.223,233,6.022,237,1.175,238,3.615,260,2.223,273,5.11,293,2.726,319,2.007,323,1.833,331,7.633,350,1.447,364,1.372,396,6.016,436,4.22,449,3.387,460,1.621,470,5.587,491,8.612,493,5.886,499,2.509,510,1.537,512,2.088,513,4.076,514,6.492,520,2.319,544,8.76,660,1.68,661,3.297,717,2.463,732,5.092,758,3.571,778,2.534,803,2.791,814,2.791,838,2.18,958,3.505,967,6.938,1028,4.186,1068,2.246,1073,2.338,1093,6.169,1123,6.844,1204,3.404,1299,2.377,1322,3.426,1380,2.979,1399,2.18,1447,2.861,1569,5.782,1719,4.445,1793,9.109,1822,3.345,1850,3.883,1927,2.584,1958,3.571,1977,3.116,1996,3.571,2020,4.542,2257,3.662,2280,2.861,2361,3.345,2381,6.916,2383,3.571,2390,7.861,2438,3.345,2472,3.413,2493,3.883,2494,3.883,2495,3.883,2496,3.883,2497,3.662,2498,6.016,2499,6.016,2500,8.478,2501,5.877,2502,3.883,2503,3.883,2504,3.883,2505,3.345,2506,3.883,2507,10.213,2509,7.796,2510,3.883,2511,3.883,2512,7.796,2513,3.883,2514,5.636,2515,3.883,2516,3.883,2517,9.949,2518,6.542,2519,3.883,2520,6.016,2521,3.883,2522,3.883,2523,3.883,2524,3.883,2525,4.392,2526,6.542,2527,9.949,2528,4.392,2529,11.106,2530,4.392,2531,4.392,2532,4.392,2533,4.392,2534,6.542,2535,6.542,2536,4.392,2537,7.401,2538,4.392,2539,4.02,2540,4.392,2541,4.392,2542,3.883,2543,4.02,2544,4.392,2545,3.883,2546,4.392,3323,14.557]],["keywords/426",[]],["title/427",[22,350.355,125,469.918]],["content/427",[79,4.182,179,7.169,218,5.902,396,7.849,870,6.402,891,13.324,1106,8.514,1627,10.816,2278,11.116,2303,13.324,2547,16.39]],["keywords/427",[]],["title/428",[1106,683.567]],["content/428",[]],["keywords/428",[]],["title/429",[157,387.826,416,495.593]],["content/429",[3,1.703,50,4.152,61,9.501,79,3.769,87,8.968,110,6.384,157,5.536,260,4.437,293,9.169,305,5.709,460,5.453,958,5.399,1027,7.734,1152,11.035,1204,6.794,2304,13.058,2305,14.771,2306,14.771,2307,14.771,2308,14.771,2309,14.771,2310,14.771,2311,14.771]],["keywords/429",[]],["title/430",[45,357.876]],["content/430",[45,4.048,79,3.798,110,6.433,115,5.52,149,5.039,174,6.591,182,6.759,470,7.475,508,4.793,660,5.694,661,6.632,663,9.318,687,4.613,739,5.635,1272,9.574,1369,10.241,2280,9.695,2312,14.884,2313,14.884]],["keywords/430",[]],["title/431",[79,264.052,739,391.804]],["content/431",[3,1.291,19,7.203,48,9.336,56,3.451,57,5.863,58,2.013,79,3.869,101,6.113,106,3.281,115,3.392,182,5.085,237,2.997,260,3.364,330,7.489,339,4.46,380,7.705,470,4.594,510,5.305,608,9.599,739,5.741,760,4.62,778,6.459,870,4.374,904,7.945,958,5.542,1027,5.863,1106,7.877,1204,5.151,1276,6.798,1304,6.976,1312,6.951,1346,7.203,1382,7.705,1411,6.726,1415,6.364,1449,5.911,1480,7.115,1497,6.061,1501,7.389,1587,9.523,1794,6.397,2148,8.702,2314,8.527,2315,15.201,2316,11.198,2317,11.198,2318,10.25,2319,11.198,2320,9.899,2321,10.25,2322,11.198]],["keywords/431",[]],["title/432",[79,264.052,1210,546.292]],["content/432",[3,0.891,43,4.691,62,4.147,72,4.852,79,2.967,98,4.079,106,3.614,110,3.339,115,4.235,149,2.616,152,3.17,182,5.28,197,2.824,198,4.91,218,2.782,237,4.464,238,2.051,241,4.852,260,2.321,293,4.796,325,5.246,327,5.728,328,5.168,338,2.434,339,4.112,341,4.068,345,2.782,357,5.884,364,2.413,397,4.218,458,3.679,459,3.834,460,5.161,470,7.677,476,3.806,488,4.796,499,6.643,503,7.095,654,2.769,660,6.704,687,3.539,717,4.333,718,4.641,739,4.402,762,3.675,958,2.824,1105,5.669,1106,6.04,1175,6.136,1210,4.079,1272,4.97,1304,3.554,1382,5.316,1408,6.83,1617,6.83,1668,5.669,1728,8.386,1786,5.772,1794,4.414,2246,6.281,2255,7.072,2281,6.83,2314,5.884,2315,10.279,2324,7.727,2325,7.727,2326,7.727,2327,6.83,2328,11.365,2329,6.83,2334,7.727,2335,7.727,2336,7.727,2337,7.727,2340,7.727,2341,7.727,2345,6.984,2349,7.727,2350,6.83,2713,6.623,2715,6.623,2979,7.059,3324,8.214,3325,8.214,3326,8.214,3327,8.214,3328,8.214,3329,8.214,3330,8.214]],["keywords/432",[]],["title/433",[157,387.826,508,333.282]],["content/433",[12,5.1,18,0.872,19,4.708,56,2.256,58,1.795,72,3.054,79,1.868,106,3.799,107,3.928,115,3.381,118,4.182,149,3.778,152,3.003,237,4.049,238,3.591,260,2.199,325,3.302,338,2.306,341,2.561,345,2.636,348,7.918,350,4.455,356,9.305,397,3.996,413,4.35,454,5.813,457,3.481,458,4.28,460,4.993,470,6.207,487,5.813,488,4.543,499,4.182,503,5.664,508,4.356,510,3.904,552,4.031,572,6.975,652,5.459,654,2.623,661,3.261,663,5.707,678,4.263,687,4.124,695,5.42,739,2.771,760,3.02,901,3.367,1077,6.274,1106,3.802,1204,3.367,1217,4.492,1322,5.167,1514,4.306,1528,5.193,1547,5.95,1600,6.928,1703,3.743,1727,5.95,1728,9.755,1841,4.651,2070,5.813,2133,6.501,2280,4.768,2314,5.574,2327,6.47,2328,5.95,2329,6.47,2351,7.319,2352,7.319,2353,7.319,2354,7.319,2355,7.319,2356,7.319,2357,7.319,2358,7.319,2359,7.319,2360,7.319,2361,5.574,2362,7.319,2363,7.319,2364,11.16,2365,7.319,2366,7.319,2367,6.47,2368,9.567,2369,7.319,2370,6.47,2371,7.319,2372,7.319,2373,7.319,2374,7.319,2375,11.16,2376,6.47,2377,7.319,2378,7.319,2979,4.444]],["keywords/433",[]],["title/434",[50,301.275]],["content/434",[3,0.486,5,2.158,11,1.98,12,1.929,16,1.967,18,1.921,22,1.429,50,3.568,54,2.62,56,1.301,58,1.887,60,2.986,72,3.887,76,1.59,79,2.377,80,1.954,82,2.192,92,3.525,106,3.556,115,4.721,119,2.389,152,1.732,169,1.954,174,5.906,180,4.344,191,4.298,197,1.543,199,4.022,218,1.52,238,3.259,241,4.577,245,4.344,260,1.268,263,4.022,273,3.249,293,4.442,303,2.862,323,2.986,325,3.228,327,3.525,338,1.33,350,2.357,364,1.318,412,2.715,430,2.325,436,1.857,438,3.747,457,2.007,458,3.47,460,4.049,470,6.809,499,2.411,508,1.359,510,1.477,512,1.191,580,1.869,589,3.519,611,4.022,639,2.948,649,1.751,661,4.15,687,3.945,695,4.523,715,2.064,717,2.367,739,3.526,775,4.022,814,2.682,884,3.631,896,2.094,901,4.284,958,3.404,968,3.431,1019,1.835,1065,1.835,1068,2.158,1073,2.246,1077,3.618,1081,5.594,1082,2.246,1093,2.715,1106,4.838,1130,7.336,1156,5.346,1160,4.022,1204,1.941,1210,3.777,1217,2.591,1225,3.153,1227,4.074,1272,2.715,1274,3.808,1276,2.562,1299,2.284,1304,1.941,1368,5.683,1369,2.904,1382,2.904,1399,3.551,1445,2.948,1467,2.785,1569,6.349,1600,2.62,1625,3.214,1627,2.785,1628,3.731,1636,2.367,1668,3.097,1703,3.659,1728,8.855,1786,3.153,1793,9.508,1804,6.326,1821,4.442,1872,3.519,1904,3.731,1924,3.28,1926,3.731,1927,2.483,1964,2.562,2020,9.564,2246,3.431,2247,3.519,2277,3.731,2280,2.749,2297,3.731,2314,3.214,2328,5.817,2342,3.863,2361,3.214,2367,3.731,2370,3.731,2379,10.969,2380,7.155,2381,5.161,2382,3.731,2383,3.431,2384,4.221,2385,7.155,2386,7.155,2388,7.155,2389,4.221,2390,4.998,2391,4.221,2392,7.155,2393,4.221,2394,3.519,2395,4.221,2396,4.221,2397,4.221,2398,4.221,2399,4.221,2400,4.221,2401,4.221,2402,4.221,2403,3.731,2404,3.863,2405,4.221,2406,3.731,2407,4.221,2408,4.221,2409,4.221,2410,3.731,2411,4.221,2412,4.221,2413,4.221,2414,4.221,2415,4.221,2416,3.863,2417,4.221,2418,4.221,2419,3.731,2420,3.519,2421,4.221,2422,4.221,2423,4.221,2424,4.221,2425,4.221,2426,4.221,3331,8.291]],["keywords/434",[]],["title/435",[2427,1163.321]],["content/435",[18,2.212,50,3.515,58,2.038,76,5.783,79,3.918,85,10.413,364,4.795,382,5.843,678,8.944,739,5.813,776,6.841,1095,9.642,1103,9.222,1106,7.976,1175,12.194,2428,15.355,2429,15.355,2430,14.054]],["keywords/435",[]],["title/436",[22,350.355,125,469.918]],["content/436",[22,5.844,82,8.967,396,8.267,508,5.56,678,10.056]],["keywords/436",[]],["title/437",[650,712.065,3332,759.301]],["content/437",[]],["keywords/437",[]],["title/438",[18,101.574,3332,625.674,3333,753.863]],["content/438",[18,1.72,72,6.026,80,6.687,149,4.889,157,5.412,434,7.014,470,5.925,958,5.278,1059,12.38,1065,6.279,1158,10.087,1312,8.965,1466,10.087,1508,10.087,2505,10.998,3085,12.041,3332,10.596,3334,15.811,3335,15.352,3336,15.352,3337,15.352,3338,15.352,3339,12.767,3340,15.352,3341,15.352,3342,15.352]],["keywords/438",[]],["title/439",[36,466.935,1793,692.162]],["content/439",[3,2.255,36,6.614,58,1.946,149,6.911,449,5.178,512,4.136,669,5.919,870,7.051,1074,9.674,1131,6.878,1158,10.239,1758,13.244,2287,13.418,3085,12.223,3332,10.756,3333,12.96,3343,13.97]],["keywords/439",[]],["title/440",[18,123.267,508,333.282]],["content/440",[3,0.581,18,1.68,45,0.768,50,1.9,56,0.87,58,1.524,79,2.118,92,1.391,98,1.49,106,3.863,134,6.92,145,1.391,149,2.312,160,1.794,173,1.839,179,1.235,197,1.842,214,2.242,215,5.797,218,1.815,237,3.904,238,2.809,241,1.178,243,5.477,245,1.714,260,1.514,273,2.289,293,3.129,304,3.955,305,2.639,318,1.478,319,2.304,321,1.794,338,1.588,339,2.803,341,0.988,345,3.433,350,1.66,357,3.838,364,0.882,373,1.644,413,1.678,426,3.728,430,1.555,436,1.242,449,3.737,456,2.289,457,1.343,458,2.626,460,3.064,470,4.34,476,1.391,503,4.212,508,0.909,510,1.763,516,5.101,528,1.839,535,1.888,650,1.943,654,1.012,660,1.08,682,1.972,687,2.907,718,1.696,739,1.069,905,1.816,958,3.484,961,2.003,967,4.565,975,2.036,1002,1.773,1025,6.591,1054,1.598,1065,1.227,1075,1.943,1093,5.339,1106,3.547,1180,3.242,1203,1.943,1204,3.818,1210,1.49,1244,7.408,1304,1.299,1310,2.996,1322,1.307,1351,2.194,1352,1.915,1366,3.468,1399,1.401,1442,2.036,1448,2.003,1470,1.888,1481,4.321,1491,5.477,1497,1.528,1508,3.521,1569,2.899,1600,1.752,1623,2.194,1669,2.826,1710,1.888,1715,1.678,1717,2.194,1758,3.698,1794,3.901,1810,3.917,1821,3.129,1927,1.661,1977,2.003,2021,2.354,2042,2.42,2156,4.614,2191,1.972,2192,1.839,2205,2.295,2247,2.354,2280,3.283,2345,3.027,2390,1.972,2394,4.203,2441,2.354,2648,2.584,2749,3.468,2765,2.42,2895,2.42,2979,1.714,3113,2.69,3207,2.15,3211,2.242,3273,2.354,3332,12.44,3334,7.337,3339,2.496,3343,2.69,3344,3.001,3345,3.001,3346,3.001,3347,3.001,3348,3.001,3349,3.001,3350,3.001,3351,3.001,3352,3.001,3353,9.084,3354,7.258,3355,7.258,3356,7.258,3357,9.084,3358,8.823,3359,10.082,3360,8.823,3361,13.901,3362,3.001,3363,3.001,3364,3.001,3365,3.001,3366,3.001,3367,3.001,3368,3.001,3369,3.001,3370,3.001,3371,3.001,3372,3.001,3373,7.909,3374,6.507,3375,3.001,3376,5.358,3377,3.001,3378,3.001,3379,3.001,3380,3.001,3381,3.001,3382,3.001,3383,3.001,3384,7.909,3385,2.69,3386,2.69,3387,7.258,3388,3.001,3389,3.001,3390,3.001,3391,3.001,3392,3.001,3393,3.001,3394,3.001,3395,3.001,3396,5.358,3397,3.001,3398,2.69,3399,2.69,3400,3.001,3401,3.001,3402,5.358,3403,3.001,3404,2.69,3405,3.001,3406,5.358,3407,7.258,3408,3.001,3409,3.001,3410,2.69,3411,2.69,3412,3.001,3413,3.001,3414,3.001,3415,3.001,3416,3.001,3417,3.001,3418,3.001,3419,3.001,3420,3.001,3421,3.001,3422,3.001,3423,3.001,3424,3.001,3425,2.69,3426,3.001,3427,6.507,3428,3.001,3429,3.001,3430,3.001,3431,3.001,3432,5.358,3433,6.507,3434,5.358,3435,3.001,3436,3.001,3437,2.69,3438,3.001,3439,3.001,3440,4.803,3441,2.69,3442,2.69,3443,2.354,3444,3.001,3445,5.358,3446,2.69,3447,2.69,3448,5.358,3449,7.258,3450,2.69,3451,5.358,3452,3.001,3453,2.69,3454,3.001,3455,3.001,3456,3.001,3457,3.001,3458,3.001,3459,3.001,3460,3.001,3461,3.001,3462,3.001,3463,3.001,3464,3.001,3465,3.001,3466,2.69,3467,3.001,3468,2.69,3469,3.001]],["keywords/440",[]],["title/441",[2895,1128.04]],["content/441",[3,0.84,16,1.428,18,1.742,20,5.842,29,1.734,50,1.241,56,2.246,58,1.791,79,0.782,106,3.855,115,1.642,119,1.734,134,4.519,149,3.766,152,1.257,160,5.596,171,2.209,179,2.371,197,1.981,235,2.626,237,3.771,238,3.741,243,2.022,260,2.189,270,2.173,273,2.461,288,1.821,304,1.271,305,2.817,319,2.477,338,2.296,339,1.594,341,1.896,342,1.88,345,4.006,350,2.901,357,4.127,373,3.157,381,2.708,406,1.718,417,2.173,430,2.985,436,1.348,449,1.082,457,5.291,458,4.627,460,3.715,470,2.99,480,1.617,503,2.751,516,2.289,528,1.995,660,1.172,669,1.777,672,2.919,687,3.045,739,2.052,819,2.381,870,2.847,884,1.555,950,5.257,958,1.12,967,4.82,1075,6.06,1082,1.63,1093,3.486,1131,1.437,1161,3.676,1173,2.49,1180,3.486,1203,12.528,1204,1.409,1238,2.919,1244,4.212,1247,2.381,1272,1.971,1322,1.418,1351,2.381,1352,2.078,1355,1.672,1366,3.729,1377,4.212,1387,4.425,1395,3.255,1399,1.52,1415,1.286,1419,2.333,1442,2.209,1448,2.173,1481,2.626,1491,4.81,1569,3.095,1597,1.718,1623,2.381,1648,2.433,1669,3.039,1710,3.625,1715,1.821,1810,4.212,1821,3.364,1841,3.444,1927,1.802,1977,2.173,1986,2.108,2037,2.49,2042,2.626,2192,3.53,2206,5.789,2251,2.804,2254,2.804,2260,2.804,2274,2.804,2318,2.804,2330,3.063,2344,3.063,2390,2.14,2420,2.554,2765,2.626,2772,2.804,2932,2.626,2970,4.304,2979,3.29,3207,2.333,3211,2.433,3273,2.554,3332,12.163,3333,7.786,3334,7.786,3339,2.708,3353,8.393,3357,2.919,3359,5.165,3361,12.207,3373,2.919,3374,2.919,3384,2.919,3385,2.919,3386,2.919,3398,5.165,3399,2.919,3404,2.919,3410,2.919,3411,2.919,3425,2.919,3427,8.393,3433,8.393,3437,2.919,3440,5.165,3441,2.919,3442,2.919,3443,6.077,3446,2.919,3447,2.919,3450,2.919,3453,2.919,3466,2.919,3470,3.257,3471,7.748,3472,3.257,3473,3.257,3474,3.257,3475,3.257,3476,3.257,3477,7.748,3478,3.257,3479,3.257,3480,2.919,3481,9.362,3482,7.748,3483,3.257,3484,3.257,3485,5.762,3486,7.748,3487,3.257,3488,3.257,3489,3.257,3490,3.257,3491,3.257,3492,3.257,3493,3.257,3494,3.257,3495,5.762,3496,3.257,3497,3.257,3498,3.257,3499,3.257,3500,3.257,3501,3.257,3502,5.762,3503,3.257,3504,3.257,3505,3.257,3506,3.257,3507,5.165,3508,3.257,3509,3.257,3510,3.257,3511,3.257,3512,3.257,3513,3.257,3514,3.257,3515,3.257,3516,3.257,3517,3.257,3518,3.257,3519,3.257,3520,3.257,3521,3.257,3522,3.257,3523,3.257,3524,3.257,3525,3.257,3526,5.762,3527,5.762,3528,5.762,3529,5.762,3530,3.257,3531,3.257,3532,3.257,3533,3.257,3534,3.257,3535,3.257]],["keywords/441",[]],["title/442",[853,965.506]],["content/442",[3,1.703,18,1.759,57,7.734,58,1.96,79,3.769,82,7.673,115,4.475,157,5.536,322,11.479,460,5.453,614,11.035,650,10.163,678,8.604,687,3.739,870,5.77,958,5.399,1054,8.36,1158,10.317,1312,9.169,1428,10.48,1732,13.52,2278,10.018,3085,12.316,3332,10.838]],["keywords/442",[]],["title/443",[1716,1002.099]],["content/443",[]],["keywords/443",[]],["title/444",[45,357.876]],["content/444",[65,10.549,79,4.854,149,5.412,396,7.655,470,8.332,663,8.175,1669,8.964,2750,15.986,2751,15.986,2752,15.986,2753,15.986]],["keywords/444",[]],["title/445",[79,264.052,318,541.885]],["content/445",[56,4.172,58,2.504,60,5.649,76,5.099,79,4.813,106,3.057,115,4.101,218,4.875,237,3.623,318,7.088,338,4.264,339,3.981,396,8.225,397,7.39,654,4.851,739,6.502,1106,8.921,1174,11.604,1449,7.146,1500,10.309,1711,11.967,1712,11.967,1716,13.079,1717,10.52,1718,11.967,2754,11.967,2755,13.537]],["keywords/445",[]],["title/446",[1706,892.464]],["content/446",[16,2.955,19,4.078,29,3.588,56,3.078,58,1.325,61,4.078,79,1.618,106,3.845,237,5.203,238,5.161,241,2.646,304,5.814,324,3.432,338,1.997,341,2.218,345,5.83,350,5.58,364,1.98,378,4.573,385,3.981,396,3.036,406,3.555,430,3.492,457,3.016,458,3.908,459,3.146,470,5.067,476,3.124,487,5.035,491,7.342,511,6.757,512,1.789,513,5.499,514,5.76,520,5.271,526,4.828,528,4.13,530,4.3,539,4.429,543,4.429,544,7.945,546,4.429,661,2.825,1106,5.187,1123,7.586,1217,3.892,1222,4.429,1274,3.375,1297,5.287,1355,3.462,1480,4.029,1547,5.154,1566,4.184,1668,4.652,1669,3.555,1706,4.3,1713,4.652,1716,4.828,1719,5.998,1720,5.605,1721,5.605,1723,4.029,1724,4.737,1725,4.927,1727,5.154,1728,4.573,1729,4.499,1731,5.605,2133,10.519,2258,5.605,2441,5.287,2448,9.642,2754,5.605,2756,6.341,2757,6.341,2758,6.341,2759,6.341,2760,6.341,2761,6.341,2762,6.341,2763,6.341,2764,6.341,2765,5.435,2766,6.341,2767,6.341,2768,6.341,2769,5.804,2770,6.341,2771,6.341,2772,5.804,2773,6.341,2774,6.341,2775,6.341,2776,6.341,2777,6.341]],["keywords/446",[]],["title/447",[2427,1163.321]],["content/447",[3,1.677,17,6.288,18,1.733,19,9.359,36,6.565,50,3.331,56,4.485,65,9.602,78,11.555,79,3.712,139,11.555,155,12.131,157,5.453,221,10.163,416,6.968,618,13.865,635,12.863,718,8.739,949,9.602,1469,11.08,1521,11.307,1887,9.868,2278,9.868,2778,14.55,2779,14.55,2780,13.318]],["keywords/447",[]],["title/448",[3,119.285,416,495.593]],["content/448",[]],["keywords/448",[]],["title/449",[22,350.355,125,469.918]],["content/449",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/449",[]],["title/450",[2302,868.391]],["content/450",[]],["keywords/450",[]],["title/451",[45,357.876]],["content/451",[18,1.858,48,13.008,79,3.981,92,7.686,319,7.13,600,11.069,649,6.473,687,3.949,739,5.906,760,8.292,1299,8.444,1606,10.897,2694,10.734,2695,15.601,2696,15.601]],["keywords/451",[]],["title/452",[460,382.009,958,378.226]],["content/452",[3,1.387,58,2.111,82,6.249,106,3.736,174,7.045,179,5.262,237,5.279,318,6.299,337,8.277,339,4.679,458,5.64,460,5.873,503,6.105,715,5.884,739,4.554,958,5.815,1380,8.158,1449,6.35,2345,9.556,2346,11.463,2694,10.947,2697,15.91,2698,15.91,2699,12.029,2700,12.933,2701,12.029,2702,8.676,2703,12.029,2704,12.029,2979,7.303,3075,9.16]],["keywords/452",[]],["title/453",[79,264.052,318,541.885]],["content/453",[18,1.733,57,7.619,58,1.931,79,3.712,106,3.624,237,3.894,339,4.279,480,7.681,510,5.09,654,5.214,1027,7.619,1415,6.106,1587,9.137,1986,10.011,1991,9.731,2191,10.163,2302,9.602,2320,12.863,2694,12.363,2700,11.828,2702,10.494,2705,12.863]],["keywords/453",[]],["title/454",[319,472.947,600,734.248]],["content/454",[12,4.661,18,2.298,20,4.953,45,2.774,79,2.602,106,3.771,218,3.673,237,4.382,238,4.347,260,3.064,319,6.499,338,3.213,341,4.976,350,3.359,380,7.018,480,5.384,600,7.236,649,5.901,661,4.544,687,3.6,760,6.756,880,5.34,901,4.691,1061,6.56,1175,8.1,1217,6.26,1313,8.743,1415,4.28,1532,9.016,1600,6.331,1606,7.124,1846,6.56,2271,9.016,2302,6.73,2339,9.719,2350,9.016,2694,11.267,2702,7.356,2705,12.573,2706,10.199,2707,10.199,2708,10.199,2709,14.222,2710,10.199,2711,10.199,2712,10.199,2713,8.743,2714,10.199,2715,8.743,2716,10.199,2717,10.199,2718,10.199,2719,10.199]],["keywords/454",[]],["title/455",[1165,774.227]],["content/455",[18,1.415,43,7.214,79,3.032,106,3.809,141,9.437,174,6.988,237,4.223,238,4.189,341,4.157,345,5.683,687,3.008,718,9.478,760,7.31,762,5.651,949,7.841,958,4.343,992,9.437,1204,5.466,1322,5.501,1355,8.615,1625,9.048,2302,7.841,2694,12.191,2700,14.403,2702,8.57,2720,11.882,2721,10.504,2722,11.882,2723,11.882,2724,11.882,2725,10.504,2726,11.882,2727,11.882,2728,11.882,2729,11.882]],["keywords/455",[]],["title/456",[1186,615.129,2302,682.927]],["content/456",[18,2.05,19,5.353,50,3.345,57,4.357,58,2.284,63,6.337,76,3.135,79,3.136,80,3.853,106,3.874,115,3.723,152,5.042,198,5.288,218,2.997,237,4.606,238,4.569,260,3.691,273,3.779,323,3.472,338,3.871,339,2.447,341,2.911,345,5.262,350,2.741,485,7.617,486,9.99,508,2.68,687,2.107,715,4.07,760,3.433,814,5.288,838,4.13,942,5.353,1027,4.357,1068,4.256,1073,4.429,1093,5.353,1186,8.685,1191,6.337,1199,7.93,1201,7.617,1202,7.93,1385,5.644,1395,7.381,1398,5.288,1399,4.13,1415,3.492,1782,6.106,1964,5.052,2302,5.492,2694,5.726,2702,6.002,2721,7.357,2725,7.357,2730,8.322,2731,14.611,2732,8.322,2733,8.322,2734,8.322,2735,8.322,2736,8.322,2737,8.322,2738,8.322,2739,8.322,2740,8.322,2741,8.322,2742,8.322,2743,8.322,2744,8.322,2745,8.322,2746,11.248,2747,8.322]],["keywords/456",[]],["title/457",[552,469.66,654,305.605,1409,517.71]],["content/457",[]],["keywords/457",[]],["title/458",[552,469.66,1410,753.863,1411,512.201]],["content/458",[3,2.153,15,6.549,18,1.847,56,2.845,58,2.058,132,6.549,157,3.459,178,5.544,182,4.191,204,6.056,218,3.324,258,5.122,260,5.779,305,7.219,385,5.796,436,4.062,456,8.148,510,5.928,512,2.604,552,5.084,650,6.351,654,6.43,796,4.39,880,6.939,905,5.937,924,7.173,944,7.029,1019,4.013,1027,6.939,1081,5.544,1082,7.053,1227,4.038,1312,5.73,1409,5.604,1410,8.16,1411,9.312,1412,8.449,1413,9.231,1414,9.231,1415,7.839,1416,8.801,1417,10.092,1418,8.449,1419,10.092,1420,9.231,1421,10.773,1422,7.029,1423,7.173,1424,8.16,1425,9.231,1426,8.449,1427,6.549,1428,6.549]],["keywords/458",[]],["title/459",[552,469.66,654,305.605,1409,517.71]],["content/459",[]],["keywords/459",[]],["title/460",[950,949.064]],["content/460",[3,1.468,12,5.822,72,5.315,79,4.215,106,3.665,133,9.038,237,3.409,260,6.036,305,4.924,337,8.765,339,3.746,654,4.565,663,8.447,664,11.261,687,3.225,950,11.913,976,9.9,1019,5.538,1027,6.67,1127,8.406,1191,12.578,1411,7.651,1415,5.346,1429,10.621,1430,12.739,1431,11.66,1433,11.261,1434,12.739,1435,12.739,1558,9.9,2143,9.9,2748,13.542]],["keywords/460",[]],["title/461",[456,469.918,1409,628.279]],["content/461",[3,1.32,58,1.833,75,4.703,76,2.854,79,4.22,82,3.935,95,3.546,106,3.511,115,2.295,132,5.375,139,6.017,204,5.396,218,2.728,232,7.77,237,3.697,238,3.041,260,5.427,304,7.718,338,3.609,339,2.228,341,2.65,345,2.728,350,3.773,382,2.883,434,5.564,449,2.676,456,8.447,474,7.219,480,3.999,510,4.008,511,3.653,650,5.213,654,2.715,660,2.898,687,1.918,695,3.679,760,3.126,838,5.685,859,6.017,876,7.462,884,3.845,896,3.76,904,5.375,907,5.66,942,4.873,961,5.375,1027,3.967,1065,3.294,1227,3.314,1284,4.814,1299,4.101,1304,3.485,1409,4.599,1419,5.769,1421,6.159,1436,6.934,1437,6.934,1438,7.576,1439,4.457,1442,5.464,1443,7.576,1444,5.888,1445,5.292,1446,6.697,1447,4.935,1448,5.375,1449,3.999,1450,7.576,1451,6.697,1452,6.159,1453,7.576,1454,7.576,1455,6.697,1456,7.576,1457,7.576,1458,7.576,1459,7.576,1460,11.456,1461,11.456,1462,7.576,1463,7.576,1464,7.576,1465,5.888,1466,5.292,1467,4.999,1468,4.999,1469,5.769,1470,5.067,1471,7.576,1472,7.576,1473,7.576,1474,7.576,1475,6.317,1476,7.576,1477,5.464,1598,4.814,2749,5.213]],["keywords/461",[]],["title/462",[18,123.267,1478,914.868]],["content/462",[18,1.184,45,2.703,58,2.143,106,3.81,233,6.241,237,4.939,238,4.65,273,4.513,304,7.657,338,3.131,339,2.923,341,3.477,345,5.03,350,5.319,449,5.704,456,4.513,458,5.109,552,5.474,654,3.562,838,6.931,950,7.168,970,8.786,1123,4.295,1179,8.786,1186,5.907,1449,5.246,1451,8.786,1455,12.347,1478,14.275,1479,9.938,1480,6.315,1481,8.519,1482,9.938,1483,9.938,1484,9.938,1485,9.938,1486,9.938,1487,9.938,1488,9.938,1489,9.938,1490,14.604,1491,9.217,1492,13.967,1493,9.938,1494,9.938,1495,9.938]],["keywords/462",[]],["title/463",[853,965.506]],["content/463",[3,1.92,6,7.109,17,5.578,18,2.197,46,7.753,65,8.518,79,4.251,87,7.836,101,7.047,103,13.23,131,8.012,148,11.065,157,4.837,178,7.753,179,5.646,204,6.508,260,3.877,305,6.439,382,4.912,508,4.157,552,7.109,654,4.626,760,5.325,915,12.3,950,9.309,1027,6.759,1164,9.829,1191,9.829,1409,7.836,1444,10.031,1465,10.031,1496,12.908,1497,6.987,1498,12.908,1499,12.908,1500,9.829]],["keywords/463",[]],["title/464",[18,101.574,258,329.615,1323,541.872]],["content/464",[]],["keywords/464",[]],["title/465",[18,101.574,258,329.615,1323,541.872]],["content/465",[3,1.97,18,2.185,22,3.748,58,1.997,62,5.941,143,11.459,176,6.448,197,4.046,209,7.157,258,7.09,378,7.984,380,7.617,409,6.097,416,5.301,512,4.823,656,7.305,669,4.934,682,7.732,701,6.152,708,8.853,714,9.23,763,6.324,819,8.603,887,7.854,1012,6.539,1065,4.813,1130,7.404,1131,7.06,1232,8.792,1323,7.034,1324,9.786,1325,8.999,1326,13.968,1327,9.786,1328,11.07,1329,9.23,1330,9.786,1331,8.43,1332,8.999,1333,13.302,1334,11.07,1335,11.07,1336,8.271,1337,9.786,1338,11.07,1339,8.999]],["keywords/465",[]],["title/466",[18,123.267,703,821.883]],["content/466",[3,1.508,5,6.69,8,4.309,31,10.201,58,2.23,62,7.021,98,6.905,197,4.781,208,7.335,209,10.03,578,10.389,625,13.345,649,5.428,669,4.289,703,10.389,857,9.137,935,12.119,1012,7.101,1187,12.466,1223,11.214,1254,11.214,1339,15.091,1340,10.907,1341,14.855,1342,11.564,1343,11.974]],["keywords/466",[]],["title/467",[50,195.235,211,359.958,1323,541.872]],["content/467",[3,1.756,8,5.018,50,4.555,56,5.696,58,2.453,191,9.15,211,7.801,669,4.995,776,8.234,1065,6.623,1095,9.566,1131,7.148,1323,9.68,1345,13.467]],["keywords/467",[]],["title/468",[1029,657.601,1346,665.681]],["content/468",[8,4.089,36,5.601,50,3.718,58,2.156,157,6.087,209,7.725,211,5.24,218,4.47,258,6.278,323,5.18,625,9.858,660,4.748,669,5.325,701,6.898,714,10.35,776,5.531,820,12.134,887,8.807,935,8.953,966,8.807,1065,5.397,1095,7.795,1131,5.824,1254,10.641,1324,10.974,1325,10.091,1326,13.786,1327,10.974,1331,9.453,1332,10.091,1333,10.974,1337,10.974,1339,15.611,1341,10.974,1342,10.974,1345,10.974,1347,12.413]],["keywords/468",[]],["title/469",[1304,605.3]],["content/469",[]],["keywords/469",[]],["title/470",[1054,744.754]],["content/470",[16,6.781,17,6.288,18,2.14,29,8.235,56,4.485,60,6.071,87,8.833,110,6.288,215,10.163,285,9.478,324,7.875,449,5.139,459,7.22,577,13.318,687,3.683,1054,8.235,1157,8.931,1304,8.265,1348,17.968,1349,13.318,1350,14.55,1351,11.307,1352,9.868]],["keywords/470",[]],["title/471",[95,407.35]],["content/471",[106,3.879,215,8.15,237,3.123,238,3.098,243,7.7,260,3.505,285,7.601,319,5.332,345,4.202,449,4.121,457,7.415,458,4.933,511,5.627,687,2.954,760,4.814,890,6.865,958,4.264,1054,6.604,1123,7.588,1204,5.367,1298,9.485,1322,5.402,1352,7.913,1353,10.68,1354,10.68,1355,6.37,1356,9.729,1357,14.27,1358,9.068,1359,7.913,1360,10.68,1361,11.668,1362,9.267,1363,10.68,1364,10.68,1365,10.68,1366,8.028,1367,11.668,1368,9.267,1369,8.028,1370,8.561,1371,10.68]],["keywords/471",[]],["title/472",[1369,712.065,1372,1034.893]],["content/472",[3,1.44,6,6.881,17,5.399,18,1.943,58,1.658,74,11.905,80,5.784,115,5.501,134,10.416,145,6.155,173,8.138,181,8.726,182,7.406,251,9.514,319,5.709,441,11.044,597,9.709,600,8.864,649,5.183,661,5.566,687,4.597,760,5.154,818,8.244,876,8.138,880,6.542,890,7.35,949,8.244,1276,7.585,1304,5.747,1373,16.31,1374,16.31,1375,12.493,1376,11.435,1377,9.709,1378,9.922,1379,11.435,1380,8.473,1381,12.493,1382,8.596,1383,10.156]],["keywords/472",[]],["title/473",[95,407.35]],["content/473",[18,1.268,50,3.354,58,1.944,106,3.954,152,6.01,188,5.487,237,3.921,238,4.447,273,4.834,288,6.328,338,4.615,339,3.131,341,5.126,345,5.276,350,3.506,697,10.749,809,10.145,814,6.765,838,5.283,1068,5.444,1073,5.666,1186,6.328,1383,8.654,1384,16.751,1385,7.22,1386,10.646,1387,6.463,1388,10.646,1389,10.646,1390,10.646,1391,10.646,1392,10.646,1393,10.646,1394,9.411,1395,8.8,1396,8.876,1397,10.646,1398,6.765,1399,5.283,1400,10.646,1401,10.646,1402,10.646]],["keywords/473",[]],["title/474",[1304,476.025,1403,1034.893]],["content/474",[72,5.769,106,3.745,110,5.975,180,8.394,238,4.621,324,7.483,382,5.261,459,6.861,687,3.5,890,8.134,944,10.528,1054,7.825,1161,11.804,1304,8.762,1352,11.804,1382,9.513,1383,11.239,1404,10.98,1405,12.222,1406,13.826,1407,14.149,1408,12.222]],["keywords/474",[]],["title/475",[58,113.175,457,405.573,1593,637.091]],["content/475",[]],["keywords/475",[]],["title/476",[18,156.743]],["content/476",[11,2.89,18,1.79,45,3.75,58,1.609,95,1.907,106,3.945,107,3.306,118,3.519,145,4.808,152,2.527,174,2.728,221,4.302,233,3.868,237,5.167,238,3.99,243,7.999,260,1.85,285,4.012,319,2.815,338,1.94,339,3.565,341,2.155,345,4.365,350,3.214,445,4.892,449,3.447,456,2.797,457,4.642,458,5.498,460,4.474,476,3.035,503,3.126,518,6.619,548,4.238,649,2.556,661,2.745,678,3.588,695,4.74,760,2.541,890,3.624,958,5.04,1123,6.91,1204,2.833,1322,2.852,1352,4.178,1353,5.638,1354,5.638,1355,3.363,1356,5.136,1357,8.933,1358,4.787,1359,8.22,1360,5.638,1362,4.892,1363,5.638,1364,5.638,1365,5.638,1378,10.951,1380,4.178,1407,11.209,1415,2.585,1449,3.252,1491,9.099,1567,4.065,2037,5.007,2133,3.588,2345,5.862,2979,3.74,3225,5.445,3480,5.87,3536,10.715,3537,6.548,3538,6.548,3539,6.548,3540,9.3,3541,10.375,3542,6.548,3543,6.548,3544,6.548,3545,6.548,3546,6.548,3547,12.885,3548,12.885,3549,6.548,3550,6.548,3551,6.548,3552,6.548]],["keywords/476",[]],["title/477",[1132,826.325]],["content/477",[3,1.047,8,2.991,16,1.901,18,1.896,29,2.308,45,2.47,50,1.591,56,1.257,58,1.738,98,2.153,106,3.918,109,3.239,110,1.763,115,2.751,145,5.929,150,3.699,152,3.726,157,3.404,180,2.476,182,1.852,187,2.4,204,2.715,209,3.306,211,3.834,215,2.849,228,4.319,238,1.083,239,2.054,243,5.993,258,2.687,273,1.852,285,2.657,287,2.942,288,4.131,301,7.87,331,6.159,350,1.343,361,5.293,363,5.572,364,4.599,373,7.01,413,2.425,428,2.894,430,2.246,436,1.795,445,3.239,449,1.441,457,4.319,512,2.562,596,2.425,649,4.451,660,1.56,669,2.279,682,10.286,701,3.862,763,2.33,776,1.817,850,8.029,901,3.197,902,4.471,1012,1.56,1019,1.773,1029,2.592,1034,2.561,1035,4.471,1065,1.773,1082,4.834,1131,1.914,1133,4.22,1135,4.587,1138,4.131,1216,9.786,1243,3.316,1265,4.079,1274,3.699,1276,5.514,1283,2.942,1378,7.213,1407,8.72,1418,3.734,1491,2.692,1497,2.208,1553,4.049,1559,3.734,1563,3.734,1569,2.951,1593,5.193,1641,2.592,1643,2.728,1707,3.734,1710,2.728,1757,3.047,1764,3.106,1773,2.942,1809,3.401,1811,6.249,1845,3.497,1846,4.471,1848,3.497,1851,7.785,1927,2.4,1964,2.476,2191,2.849,2272,3.497,2321,3.734,2381,2.942,2467,3.734,2497,3.401,2568,6.362,2569,8.313,2570,3.734,2571,3.734,2572,6.362,2573,3.497,2574,3.734,2575,3.734,2576,3.734,2577,3.734,2580,3.401,2591,3.734,2609,3.734,2960,6.951,3075,3.106,3140,5.795,3159,6.623,3160,3.887,3168,3.887,3268,3.887,3443,7.572,3536,3.606,3540,3.887,3553,4.336,3554,4.336,3555,4.336,3556,4.336,3557,4.336,3558,4.336,3559,4.336,3560,4.336,3561,4.336,3562,4.336,3563,4.336,3564,4.336,3565,4.336,3566,4.336,3567,4.336,3568,7.389,3569,9.655,3570,4.336,3571,4.336,3572,4.336,3573,4.336,3574,4.336,3575,4.336,3576,7.389,3577,4.336,3578,4.336,3579,4.336,3580,4.336,3581,4.336,3582,4.336,3583,4.336,3584,7.389,3585,9.655,3586,4.336,3587,7.389,3588,4.336,3589,7.389,3590,4.336,3591,3.887,3592,4.336,3593,4.336]],["keywords/477",[]],["title/478",[853,965.506]],["content/478",[3,1.518,5,8.63,16,7.866,18,1.569,45,3.582,58,2.24,89,7.597,115,3.99,187,7.749,209,6.264,324,7.128,363,6.841,364,4.112,373,7.671,449,4.652,678,7.671,687,3.334,723,10.706,776,5.868,864,8.084,1054,7.454,1082,7.01,1225,9.839,1236,13.17,1368,10.459,1407,10.706,1597,7.385,1603,9.663,2007,12.055,3536,11.643,3591,12.55,3594,17.94,3595,14,3596,14,3597,14,3598,14]],["keywords/478",[]],["title/479",[1706,892.464]],["content/479",[]],["keywords/479",[]],["title/480",[1707,1204.507]],["content/480",[3,1.55,18,1.601,19,8.647,58,2.269,75,8.345,79,5.049,101,7.339,157,5.038,400,7.909,426,7.339,436,5.916,508,4.329,642,11.209,687,4.76,907,10.043,1019,5.845,1416,6.983,1637,10.447,1694,12.576,1706,13.857,1708,17.099,1709,14.256,1710,8.991]],["keywords/480",[]],["title/481",[45,281.443,95,320.351]],["content/481",[3,0.871,17,1.947,18,1.643,54,2.796,58,1.831,60,1.88,61,2.897,79,3.52,81,4.123,95,3.023,101,2.459,106,3.72,110,1.947,157,1.688,179,1.97,181,3.146,188,2.321,193,2.862,218,1.622,237,3.692,238,5.15,243,4.988,258,1.741,262,4.292,304,5.724,324,2.438,338,3.603,339,2.223,341,2.644,345,6.115,350,5.268,364,2.36,382,2.876,385,2.828,396,5.477,458,6.137,470,4.692,476,3.724,487,6.003,491,6.798,493,2.765,509,2.598,511,8.382,512,2.132,513,6.299,514,6.597,520,5.155,526,3.43,528,4.924,530,5.126,539,3.146,543,3.146,544,4.862,546,3.146,580,1.994,652,2.203,687,3.492,762,2.142,905,2.897,936,3.248,1065,1.958,1103,2.705,1106,5.941,1123,6.648,1164,3.43,1312,4.692,1318,4.292,1355,4.127,1411,4.54,1445,3.146,1521,3.5,1566,2.972,1636,2.526,1669,2.526,1694,3.013,1706,9.356,1709,3.755,1711,6.682,1712,6.682,1713,5.546,1715,4.493,1716,7.437,1717,5.874,1718,6.682,1719,6.869,1720,6.682,1721,6.682,1722,7.559,1723,2.862,1724,3.365,1725,3.5,1726,7.559,1727,3.662,1728,3.248,1729,5.363,1730,7.559,1731,6.682,1732,4.123,1733,7.559,1734,4.504,1735,4.504,1736,4.504,1737,4.504,1738,4.504,1739,7.559,1740,9.767,1741,7.559,1742,4.504,1743,4.504,1744,4.504,1745,4.504,1746,4.504,1747,4.504,1748,4.504,1749,4.504,1750,3.861,1751,4.504,1752,4.504,1753,4.504]],["keywords/481",[]],["title/482",[654,370.874,1501,682.927]],["content/482",[]],["keywords/482",[]],["title/483",[8,280.871,581,677.243,1502,649.387]],["content/483",[3,1.269,8,3.626,11,5.165,12,5.031,16,5.13,17,4.757,18,1.311,95,3.407,106,2.668,110,4.757,115,3.335,178,6.612,197,4.023,204,7.148,231,9.178,232,7.465,237,2.946,238,3.979,260,5.12,304,4.567,305,6.588,350,3.626,512,4.229,578,8.742,580,4.874,627,7.688,649,4.567,654,3.945,699,6.476,732,10.314,760,4.541,772,8.382,796,8.703,1203,7.574,1466,7.688,1502,8.382,1503,11.905,1504,11.008,1505,9.731,1506,11.008,1507,10.076,1508,7.688,1509,9.731,1510,8.382,1511,9.731,1512,9.731,1513,7.264,1514,6.476,1515,11.008,1516,11.008,1517,11.008,1518,11.008,1519,8.948]],["keywords/483",[]],["title/484",[3,119.285,581,821.883]],["content/484",[3,1.549,34,13.433,45,2.559,54,5.841,79,4.361,95,4.159,106,3.043,145,4.635,179,5.877,204,6.121,237,3.596,260,4.036,304,3.904,305,5.193,318,7.035,322,7.312,324,7.272,338,4.232,339,4.609,382,3.581,401,7.312,430,5.182,449,6.385,458,2.977,509,5.427,510,3.292,512,3.79,518,6.381,519,6.786,615,7.312,654,6.478,687,2.382,739,3.562,763,5.376,902,6.052,905,6.052,931,8.966,963,8.866,1060,5.908,1074,6.209,1103,5.652,1185,6.786,1203,6.474,1310,5.593,1422,7.165,1445,6.572,1468,6.209,1501,8.866,1503,6.572,1520,9.409,1521,7.312,1522,9.409,1523,9.409,1524,9.409,1525,5.841,1526,9.409,1527,9.409,1528,6.676,1529,13.853,1530,11.877,1531,13.436,1532,8.318,1533,9.409]],["keywords/484",[]],["title/485",[197,378.226,204,404.25]],["content/485",[0,5.819,34,7.658,58,1.186,79,4.52,95,4.712,106,3.681,107,6.947,132,9.183,145,6.377,152,6.244,188,4.604,204,7.442,270,6.338,322,6.943,339,2.627,343,6.674,406,5.01,412,11.395,449,4.572,451,12.036,508,2.877,509,5.153,512,3.652,520,4.716,661,3.98,697,9.497,699,5.256,717,5.01,718,5.366,794,7.095,801,8.513,902,5.746,912,6.555,960,6.943,961,6.338,1060,5.61,1103,5.366,1217,5.483,1387,5.424,1422,6.803,1466,6.24,1468,5.895,1509,7.898,1511,7.898,1512,7.898,1529,7.898,1530,7.898,1534,8.934,1535,11.591,1536,6.943,1537,8.934,1538,8.934,1539,6.943,1540,7.898,1544,8.934,1546,8.934,1547,7.262,1548,8.934,1549,8.934,1550,7.262,1551,8.934,1552,8.934,1553,5.204,1554,8.934,1555,8.934,1556,7.898,2781,9.497,2782,9.497,2783,9.497,2784,9.497]],["keywords/485",[]],["title/486",[260,310.858,1557,759.301]],["content/486",[58,2.087,182,7.141,251,11.976,260,4.724,266,9.253,305,6.079,510,5.502,654,5.636,699,9.253,1227,6.879,1469,11.976,1557,13.822,1558,12.222,1559,14.395,1560,15.727]],["keywords/486",[]],["title/487",[716,862.854,820,773.156]],["content/487",[]],["keywords/487",[]],["title/488",[58,113.175,820,637.091,896,423.18]],["content/488",[3,1.904,22,4.313,36,5.748,50,2.916,56,3.926,58,1.691,76,4.798,106,3.577,157,6.869,178,9.921,258,6.385,323,5.315,385,7.999,397,6.955,819,9.9,820,14.49,901,7.598,936,9.187,1019,5.538,1035,10.625,1138,7.572,1323,8.095,1561,12.739,1562,16.518,1563,11.66,1564,12.739,1565,12.739,1566,8.406,1567,8.406,1568,7.348]],["keywords/488",[]],["title/489",[1693,816.841]],["content/489",[]],["keywords/489",[]],["title/490",[1632,919.143]],["content/490",[3,2.193,45,4.347,50,3.66,80,7.401,211,8.03,416,7.655,669,5.241,776,7.123,901,7.353,1095,10.038,1227,6.992,1693,9.923]],["keywords/490",[]],["title/491",[1695,1315.941]],["content/491",[18,2.287,50,3.718,56,3.826,75,7.705,92,6.115,169,7.52,179,5.43,211,5.24,239,6.252,337,11.175,364,3.876,458,3.927,563,11.829,637,9.453,639,8.67,663,6.348,687,3.142,723,10.091,760,7.922,776,5.531,924,9.647,926,8.419,942,7.985,1075,11.175,1157,7.619,1180,7.985,1416,6.448,1569,5.27,1693,12.691,1696,12.413,1697,10.974,1698,10.091,1699,12.413,1700,12.413]],["keywords/491",[]],["title/492",[649,545.984]],["content/492",[18,2.299,45,3.87,115,4.311,176,8.289,178,8.547,223,8.289,237,3.808,303,9.651,338,4.483,364,4.444,417,10.097,458,4.502,649,5.904,687,3.602,763,8.13,776,6.341,1075,9.791,1274,9.432,1304,6.546,1310,10.534,1416,7.392,1567,9.391,1693,11.001,1701,14.231]],["keywords/492",[]],["title/493",[8,433.424]],["content/493",[]],["keywords/493",[]],["title/494",[18,123.267,1569,439.386]],["content/494",[3,1.828,8,5.222,60,6.616,131,9.842,157,5.942,218,5.71,430,8.732,508,5.106,580,7.021,776,8.435,1157,9.732,1301,13.591,1570,15.855,1571,15.855]],["keywords/494",[]],["title/495",[958,480.942]],["content/495",[3,1.856,7,4.735,8,5.756,18,1.918,58,1.847,61,6.36,79,2.523,82,8.365,106,2.477,150,5.263,170,8.741,204,3.862,241,4.126,251,7.53,305,6.224,321,6.283,339,2.908,397,5.398,413,5.877,508,3.184,621,6.441,654,3.544,683,5.307,739,3.744,760,4.079,763,7.951,796,4.703,864,6.069,870,3.862,884,5.018,896,4.907,951,9.422,958,7.762,1061,6.36,1075,6.803,1204,6.401,1220,7.684,1299,5.352,1321,8.741,1440,7.684,1503,9.72,1514,5.818,1568,5.703,1572,9.888,1573,9.051,1574,7.387,1575,7.255,1576,8.741,1577,8.741,1578,9.051,1579,9.888,1580,9.888,1581,9.888,1582,13.917,1583,8.272,1584,8.244,1585,8.741,1587,6.209,2345,5.939]],["keywords/495",[]],["title/496",[1054,744.754]],["content/496",[3,1.983,8,3.145,12,4.363,18,2.407,27,5.927,58,1.267,72,3.984,80,4.421,115,4.113,126,7.005,132,6.774,146,5.996,164,7.005,174,7.619,180,5.797,192,8.185,204,3.73,239,6.838,241,6.592,245,5.797,297,9.098,305,3.691,326,8.185,327,4.704,370,5.507,436,4.202,669,5.18,687,2.417,695,4.637,702,8.185,715,4.67,763,7.756,870,5.303,884,4.845,967,8.705,1029,6.067,1054,5.404,1123,4.126,1130,6.386,1276,5.797,1356,7.961,1380,6.475,1577,8.441,1588,13.576,1589,16.427,1590,8.739,1591,8.441,1592,8.441,1593,7.133,1594,8.441,1595,9.548,1596,9.548,1597,5.354,1598,6.067,1599,8.739,1600,5.927,1601,7.961,1602,8.441,1603,7.005,1604,9.548,1605,9.548]],["keywords/496",[]],["title/497",[1600,816.841]],["content/497",[3,1.77,8,5.057,18,1.829,115,4.652,216,11.932,369,13.162,649,6.371,651,14.054,739,5.813,762,7.303,889,14.632,1396,12.802,1606,10.725,1607,12.482,1608,15.355,1609,15.355,1610,15.355,1611,15.355,1612,15.355]],["keywords/497",[]],["title/498",[655,826.325]],["content/498",[6,6.504,8,3.89,12,5.397,18,2.104,31,7.17,60,6.558,115,5.705,145,7.743,228,5.617,241,4.928,245,7.17,305,6.075,319,7.183,323,4.928,373,6.879,451,11.335,458,5.589,620,8.993,626,8.126,677,9.178,687,3.979,763,6.747,870,4.613,1054,6.684,1217,7.249,1227,5.166,1355,6.448,1589,12.776,1592,10.44,1613,11.81,1614,11.81,1615,11.81,1616,11.81,1617,10.44,1618,15.717,1619,10.124,1620,11.81,1621,15.717,1622,12.776,1623,9.178]],["keywords/498",[]],["title/499",[50,236.931,1569,439.386]],["content/499",[8,3.987,15,8.588,18,1.442,50,4.648,72,5.051,80,5.604,133,8.588,174,7.074,182,5.496,209,5.757,260,3.636,363,6.288,364,3.78,365,9.407,436,5.327,457,5.757,460,4.468,578,9.613,639,8.454,649,7.419,655,7.601,656,7.988,660,4.63,663,6.19,717,6.787,880,6.338,901,5.568,1123,5.231,1127,7.988,1227,6.988,1423,9.407,1429,10.092,1569,6.783,1594,10.7,1603,8.881,1624,12.104,1625,9.217,1626,12.104,1627,7.988,1628,10.7,1629,11.079,1630,12.104,1631,12.104]],["keywords/499",[]],["title/500",[1632,919.143]],["content/500",[3,2.24,8,6.688,50,4.095,197,5.278,209,6.869,211,7.55,234,10.523,258,5.582,323,6.026,325,6.516,406,10.029,512,4.074,669,5.864,776,6.435,1012,5.524,1095,9.069,1633,14.442]],["keywords/500",[]],["title/501",[8,238.838,18,86.373,364,226.432,596,431.021]],["content/501",[8,5.707,18,1.635,31,8.334,54,8.521,58,2.3,75,8.521,101,7.495,110,5.933,119,7.769,169,6.356,179,6.005,218,4.944,228,6.529,241,5.728,363,9.001,364,4.287,621,11.287,715,6.715,884,6.967,936,9.901,1019,5.969,1065,5.969,1132,8.62,1497,7.431,1634,13.728,1635,9.182,1636,7.698,1637,10.669,1638,11.446,1639,13.728]],["keywords/501",[]],["title/502",[209,492.192,327,509.83]],["content/502",[3,1.812,18,2.336,50,2.704,98,6.234,116,6.812,149,3.998,204,6.139,271,7.793,304,4.9,321,7.504,325,7.97,326,10.124,327,8.702,364,4.908,397,6.448,459,5.861,480,8.296,510,6.18,612,8.01,621,7.693,660,4.518,669,3.872,763,6.747,872,7.17,1060,7.416,1130,7.899,1132,7.416,1323,7.504,1370,8.665,1553,6.879,1569,5.014,1597,6.622,1640,15.717,1641,7.504,1642,11.81,1643,10.512,1644,11.81,1645,10.81,1646,11.81,1647,11.81,1648,9.379]],["keywords/502",[]],["title/503",[95,263.974,364,266.281,1186,506.875]],["content/503",[8,5.598,18,1.304,45,2.977,50,2.506,56,4.602,58,1.453,106,3.709,110,4.73,176,6.376,187,8.785,204,4.276,216,8.506,231,9.126,260,4.485,325,6.737,327,7.356,364,4.663,382,4.165,458,3.463,459,5.432,512,3.088,652,5.354,660,4.187,661,4.877,678,6.376,1002,11.464,1060,6.873,1081,6.574,1123,4.73,1132,9.376,1133,6.645,1134,8.177,1135,7.223,1137,13.556,1138,6.506,1140,8.177,1143,9.383,1144,8.177,1186,6.506,1427,7.766,1649,8.898,1650,10.946,1651,10.946,1652,10.946,1653,10.946,1654,10.946]],["keywords/503",[]],["title/504",[95,263.974,364,266.281,1655,693.233]],["content/504",[0,8.403,3,1.75,8,5,18,2.106,20,4.319,45,2.418,50,2.036,56,2.741,58,1.18,76,3.35,79,3.292,80,4.117,82,4.619,85,6.031,106,3.638,174,3.938,176,5.18,187,5.232,204,5.93,208,4.987,209,4.229,214,7.062,234,5.232,239,4.479,258,3.437,288,5.286,364,4.74,370,5.13,382,3.384,449,4.557,458,2.814,470,3.648,508,2.864,512,3.639,669,2.916,708,7.59,719,6.644,904,6.309,1002,11.58,1012,3.402,1123,3.843,1132,5.584,1133,5.399,1134,6.644,1135,5.868,1137,13.498,1138,5.286,1140,6.644,1144,6.644,1553,5.18,1641,5.651,1649,7.229,1655,10.487,1656,8.893,1657,8.893,1658,8.893,1659,8.893,1660,8.893,1661,7.861,1662,8.893,1663,8.893,1664,7.861,1665,8.893,1666,8.893,1667,8.893,1668,6.525,1669,4.987,1670,7.415,1671,5.399,1672,8.14,1673,8.893,1674,7.861]],["keywords/504",[]],["title/505",[95,263.974,364,266.281,1675,693.233]],["content/505",[3,1.255,8,5.581,18,1.772,45,2.96,50,2.492,72,4.542,76,4.1,79,2.777,106,3.747,174,4.82,176,6.34,187,6.404,204,4.252,208,6.103,228,5.177,234,6.404,258,4.207,288,6.47,364,4.645,382,4.142,449,3.845,453,7.85,458,3.444,470,4.465,512,3.071,669,3.569,730,10.372,882,6.103,1002,11.437,1123,4.704,1132,6.835,1133,6.608,1134,8.132,1135,7.183,1137,13.53,1138,6.47,1140,8.132,1144,8.132,1145,9.963,1284,6.916,1636,6.103,1649,8.848,1661,9.622,1664,9.622,1669,6.103,1670,9.075,1671,6.608,1675,8.848,1676,10.884,1677,10.884,1678,10.884]],["keywords/505",[]],["title/506",[18,101.574,215,595.63,373,496.727]],["content/506",[3,2.109,18,2.18,45,2.994,56,3.393,58,1.461,115,5.544,117,6.833,119,9.647,139,8.742,149,3.727,174,4.874,182,4.998,197,4.023,228,5.235,239,5.544,258,4.255,323,4.593,327,5.423,342,10.462,373,9.928,424,9.731,444,8.948,449,3.888,453,7.939,509,6.349,610,10.489,649,4.567,655,6.912,715,5.384,739,4.167,762,5.235,763,6.289,870,4.3,1019,4.786,1029,9.525,1054,8.483,1137,7.81,1157,6.756,1227,4.815,1300,8.742,1423,11.649,1576,9.731,1597,6.172,1602,15.068,1603,8.076,1679,11.008,1680,8.948,1681,11.008,1682,11.008]],["keywords/506",[]],["title/507",[58,137.346,1680,841.289]],["content/507",[8,4.807,18,1.261,56,3.263,58,1.937,76,3.988,95,3.278,115,3.208,119,8.26,178,6.36,188,7.522,228,5.036,239,5.333,258,5.642,259,6.572,260,3.18,266,6.229,304,4.393,323,7.512,325,4.777,327,8.869,342,8.959,373,6.167,430,5.831,434,5.142,436,4.66,442,8.063,499,6.049,510,6.607,512,2.987,663,5.415,678,6.167,699,8.587,876,6.897,1065,4.603,1123,4.576,1132,6.649,1178,9.076,1346,6.811,1491,9.632,1553,6.167,1557,7.768,1589,8.607,1603,10.709,1641,6.728,1674,9.36,1680,8.607,1683,10.588,1684,10.588,1685,14.596,1686,10.588,1687,10.588,1688,10.588,1689,10.588,1690,10.588,1691,10.588,1692,10.588]],["keywords/507",[]],["title/508",[649,545.984]],["content/508",[3,1.843,43,9.705,45,4.347,58,2.122,72,6.67,197,5.842,241,6.67,338,5.036,723,12.995,882,8.964,1274,8.508,1304,7.353,1416,8.304,1693,9.923]],["keywords/508",[]],["title/509",[776,586.326]],["content/509",[]],["keywords/509",[]],["title/510",[18,123.267,1569,439.386]],["content/510",[3,2.03,16,5.471,18,2.238,56,3.618,57,6.147,80,5.435,95,3.634,98,6.197,104,7.851,157,4.399,169,7.247,382,4.467,417,8.329,429,9.787,436,5.166,456,5.33,458,3.714,460,4.333,506,11.186,508,6.302,552,6.465,581,9.323,621,7.646,627,8.199,654,4.207,660,4.49,687,4.458,772,8.939,776,6.974,872,7.127,880,6.147,958,4.29,967,5.622,1061,7.551,1103,7.051,1127,7.746,1161,7.961,1227,5.135,1312,7.287,1569,6.646,1597,6.582,1702,9.543,1703,6.003,1704,11.739]],["keywords/510",[]],["title/511",[242,596.939,1569,439.386]],["content/511",[1,8.88,18,2.055,50,3.949,58,1.809,80,6.312,115,4.13,149,4.615,169,6.312,240,8.276,242,7.863,328,9.117,364,4.257,381,12.051,382,5.188,436,5.999,460,5.032,508,4.39,612,9.245,660,5.214,687,3.451,776,6.074,880,7.138,912,10.002,969,11.082,1061,8.769,1082,7.255,1105,10.002,1222,9.521,1569,7.324,1575,10.002,1597,7.644,1705,13.632]],["keywords/511",[]],["title/512",[22,350.355,125,469.918]],["content/512",[3,1.955,60,7.078,382,6.455,508,5.463,580,7.511,776,7.558,1671,10.298]],["keywords/512",[]],["title/513",[363,683.567]],["content/513",[]],["keywords/513",[]],["title/514",[1793,880.134]],["content/514",[3,0.512,5,2.272,18,1.821,20,2.157,22,1.504,27,2.758,45,1.208,50,3.335,55,3.013,56,3.494,57,2.326,58,2.243,60,1.854,72,1.854,95,3.509,98,2.345,104,2.971,106,3.868,110,1.92,115,2.929,116,2.562,117,2.758,145,3.681,146,2.79,157,1.665,169,2.057,174,5.02,187,4.396,204,5.973,218,2.691,223,2.588,228,2.113,238,1.179,239,4.87,240,5.87,242,2.562,259,2.758,260,2.904,266,4.396,271,2.932,273,3.393,305,1.717,323,1.854,325,2.004,327,2.189,330,2.971,361,8.633,363,3.881,364,4.548,371,3.452,378,3.204,382,2.843,397,2.425,409,2.447,430,4.115,438,3.912,449,2.639,458,4.838,470,1.823,491,4.441,511,2.142,512,3.865,513,4.115,514,4.31,580,1.967,596,4.441,612,3.013,621,2.894,625,3.528,652,2.173,656,4.931,661,1.979,670,3.808,688,3.057,701,2.469,720,3.611,762,2.113,776,6.104,870,1.735,872,2.697,882,2.491,884,3.792,890,2.614,896,2.205,902,2.858,1012,4.837,1019,3.248,1104,3.452,1123,1.92,1133,2.697,1135,8.344,1138,5.747,1165,4.396,1210,2.345,1227,1.943,1243,6.074,1277,5.934,1299,2.405,1369,3.057,1442,3.204,1466,5.219,1497,2.405,1569,4.813,1591,3.927,1693,7.037,1719,4.488,1755,4.638,1759,3.013,1794,2.538,1795,4.443,1796,3.611,1797,4.443,1798,4.443,1799,4.443,1800,4.066,1801,4.443,1802,3.528,1803,4.443,1804,3.927,1805,4.443,1806,4.443,1807,6.23,1808,4.443,1809,3.704,1810,3.452,1811,5.141,1812,4.443,1813,4.066,1814,4.443,1815,4.443,1816,4.443,1817,4.443,1818,4.443,1819,4.066,1820,4.443,1821,4.638,1822,3.383,1823,3.704,1824,4.443,1825,6.839,1826,4.066,1827,4.443,1828,3.927,1829,3.704,1830,4.443,1831,6.23,1832,4.443,1833,4.443,1834,4.443,1835,4.443,1836,3.808,1837,4.066,1838,4.443,1839,4.443,1840,4.443,1841,2.823,1842,4.443,1843,4.443,1844,4.443,1845,3.808,1846,2.858]],["keywords/514",[]],["title/515",[1632,919.143]],["content/515",[11,4.372,15,6.612,16,4.343,29,5.274,45,2.534,56,2.872,60,3.889,76,5.026,80,4.315,95,2.885,106,3.577,115,5.156,124,7.576,145,6.574,157,3.492,169,4.315,178,5.597,181,6.509,182,4.232,188,4.803,209,4.432,211,6.579,245,5.658,287,6.721,301,6.837,363,4.841,364,4.867,371,7.242,385,5.852,406,5.226,580,4.127,649,7.061,652,6.526,657,7.988,669,3.056,682,10.887,701,5.178,872,5.658,884,6.772,926,6.32,967,6.39,1012,3.565,1216,12.714,1220,7.242,1227,4.076,1274,4.96,1283,6.721,1416,4.841,1773,6.721,1807,11.125,1811,6.412,1847,8.238,1848,7.988,1849,9.319,1850,8.238,1851,13.361,1852,15.587,1853,8.53,1854,9.319,1855,9.319,1856,9.319,1857,6.233,1858,8.53,1859,9.319,1860,7.576,1861,9.319,1862,8.238,1863,9.319]],["keywords/515",[]],["title/516",[116,491.885,363,442.97,776,379.955]],["content/516",[8,3.667,16,7.04,18,2.042,29,6.301,43,6.759,45,3.028,56,3.432,58,2.005,76,4.194,104,10.103,115,5.823,146,6.991,169,7.938,181,7.777,191,6.687,240,6.759,363,7.847,364,4.717,371,8.652,397,6.078,413,6.618,438,7.91,450,12.28,507,9.842,614,8.318,649,7.113,663,5.694,687,2.819,760,7.93,776,4.961,818,7.347,1133,9.171,1222,7.777,1243,9.051,1274,8.04,1326,8.478,1411,6.687,1831,9.283,1860,9.051,1862,9.842,1864,11.134,1865,15.106,1866,11.134]],["keywords/516",[]],["title/517",[656,682.927,890,608.874]],["content/517",[58,2.021,95,3.486,146,7.072,149,3.813,174,4.987,181,7.867,187,6.626,211,4.754,240,9.243,241,4.7,260,5.549,270,7.991,323,4.7,325,5.082,363,5.85,406,6.315,409,6.203,413,6.694,621,7.336,656,7.432,669,3.693,701,6.258,776,5.018,870,4.399,890,10.869,896,5.589,904,7.991,960,8.753,1012,7.778,1029,7.157,1131,5.284,1133,6.838,1535,8.577,1569,7.843,1625,8.577,1847,9.956,1848,9.655,1868,17.246,1869,11.263,1870,11.263,1871,10.732,1872,9.39,1873,11.263,1874,11.263,1876,9.956,1877,11.263]],["keywords/517",[]],["title/518",[3,119.285,669,339.318]],["content/518",[]],["keywords/518",[]],["title/519",[36,466.935,1444,804.245]],["content/519",[3,2.236,25,5.755,36,8.881,50,1.621,54,4.394,56,2.182,58,2.53,60,2.954,72,5.529,76,2.667,87,4.298,91,5.755,95,2.191,106,3.016,116,4.083,117,4.394,143,10.09,149,6.567,150,5.79,179,4.759,211,2.988,221,7.599,239,3.566,241,2.954,245,4.298,323,5.529,325,4.909,426,3.865,428,5.023,430,3.899,512,4.978,580,3.135,663,3.62,669,5.785,697,9.722,708,4.165,715,5.321,870,7.295,882,3.97,901,5.004,976,5.502,1012,2.708,1013,6.746,1030,10.367,1034,4.445,1035,4.554,1036,5.023,1131,5.104,1210,5.743,1300,5.622,1311,8.128,1330,6.258,1331,8.285,1641,4.498,1703,3.62,1754,7.079,1755,9.23,1756,6.258,1757,5.289,1758,11.774,1759,4.801,1760,7.079,1761,10.879,1762,5.502,1763,14.87,1764,5.391,1765,7.079,1766,7.079,1767,6.48,1769,6.258,1770,7.079,3599,8.203]],["keywords/519",[]],["title/520",[45,281.443,197,378.226]],["content/520",[3,1.56,18,1.612,45,4.671,58,2.279,149,5.814,197,6.277,228,6.438,288,8.046,323,5.649,382,5.151,669,4.438,762,6.438,864,8.309,870,6.709,1012,7.216,1067,12.9,1068,6.923,1101,11.579,1131,6.351,1186,8.046,1322,6.268,1475,11.287,1771,13.537,1772,13.537,1773,9.763,1774,13.537,1775,11.967]],["keywords/520",[]],["title/521",[50,301.275]],["content/521",[3,2.175,6,6.966,8,4.166,18,1.507,36,5.707,45,2.354,50,4.751,54,5.373,58,2.321,72,3.612,95,2.679,133,6.141,157,3.244,169,4.007,177,6.726,179,6.538,197,3.163,209,4.116,211,7.711,234,7.442,241,3.612,258,3.345,323,6.237,325,5.707,327,4.264,364,2.703,375,7.922,401,6.726,430,4.767,508,2.787,512,3.568,639,6.045,649,3.591,652,4.233,669,6.342,670,7.419,717,4.853,776,5.636,856,11.182,870,3.381,1012,3.311,1017,7.036,1019,3.763,1029,5.5,1095,10.325,1096,8.248,1097,6.591,1131,5.935,1310,5.145,1502,9.632,1505,7.651,1567,5.712,1607,7.036,1693,7.852,1697,7.651,1776,8.655,1777,8.655,1778,8.655,1779,8.655,1780,8.655,1781,8.655,1782,6.35,1783,8.655,1784,8.655]],["keywords/521",[]],["title/522",[45,281.443,258,400.012]],["content/522",[3,1.896,18,2.177,45,3.442,50,2.897,58,1.68,75,7.856,98,6.681,106,2.253,193,8.042,197,4.625,209,7.823,211,6.943,234,7.446,258,7.751,259,7.856,287,9.127,288,9.777,301,9.286,323,5.281,325,5.71,400,7.446,406,7.097,669,5.393,1012,4.841,1131,5.938,1186,7.522,1497,8.903,1636,7.097,1755,7.856,1759,8.583,1785,10.051,1786,9.455,1787,12.656,1788,10.288]],["keywords/522",[]],["title/523",[18,101.574,197,311.663,1583,506.875]],["content/523",[3,1.539,18,2.232,58,2.259,197,6.85,258,5.161,259,8.287,288,7.936,323,5.571,378,9.629,512,3.767,612,9.055,669,4.378,870,5.215,958,4.879,969,10.853,1012,5.107,1131,7.988,1274,7.106,1312,8.287,1497,7.226,1556,11.803,1583,12.119,1755,11.634,1789,12.22,1790,13.839]],["keywords/523",[]],["title/524",[22,350.355,125,469.918]],["content/524",[3,1.889,22,5.549,60,6.839,198,10.415,228,7.795,580,7.258,669,5.374,708,9.643,870,6.402,1012,6.27,1791,16.39]],["keywords/524",[]],["title/525",[1,674.112,242,596.939]],["content/525",[]],["keywords/525",[]],["title/526",[22,350.355,125,469.918]],["content/526",[3,1.873,18,1.936,22,5.502,45,4.42,50,3.721,116,9.375,219,15.488,270,11.531,319,7.428,1568,9.375,1698,13.213,1792,12.377]],["keywords/526",[]],["title/527",[708,608.874,905,665.681]],["content/527",[]],["keywords/527",[]],["title/528",[1034,826.325]],["content/528",[3,2.16,36,4.675,50,4.29,58,1.375,60,4.324,106,3.855,118,5.92,150,7.653,152,4.251,198,6.584,218,3.732,241,4.324,258,5.558,426,5.657,428,7.352,512,4.659,580,4.588,626,7.13,701,7.991,901,4.766,935,7.473,1012,3.964,1034,6.507,1035,11.474,1036,7.352,1138,8.547,1641,6.584,1643,6.931,1757,7.742,1762,8.053,1769,9.16,1841,6.584,1846,9.25,1878,10.362,1880,11.989,1881,10.362,1882,8.64,1883,10.362,1884,8.64,1885,8.64,1886,8.64,1887,7.028,1888,8.64,1889,8.64,3600,16.514]],["keywords/528",[]],["title/529",[1101,807.709]],["content/529",[3,2.167,11,6.308,18,2.434,50,3.078,58,1.784,76,5.064,106,2.393,197,6.249,211,5.675,258,5.196,337,9.25,382,5.116,512,3.793,669,5.606,677,10.447,1012,5.142,1027,7.039,1131,6.308,1223,11.524,1759,9.117,1794,7.68,1841,8.542,1890,13.443,1891,13.9,1892,11.884,1893,13.443,1894,11.884,1895,13.443]],["keywords/529",[]],["title/530",[1098,1045.084]],["content/530",[17,7.461,18,2.056,109,13.71,1012,6.604,1755,10.716]],["keywords/530",[]],["title/531",[701,731.242]],["content/531",[3,2.334,45,3.899,50,3.282,56,4.418,58,2.363,109,11.385,149,4.853,197,6.507,258,5.541,669,6.641,872,8.703,1012,5.484,1131,8.353,1180,9.221,1299,7.759,1583,10.582,1755,8.898,1896,14.336]],["keywords/531",[]],["title/532",[887,933.65]],["content/532",[11,7.89,176,9.795,197,6.146,258,6.5,669,5.513,1012,6.432,1567,11.097,1636,9.429]],["keywords/532",[]],["title/533",[209,625.858]],["content/533",[3,2.015,11,6.533,20,6.762,22,4.714,50,3.188,60,5.81,72,5.81,125,6.323,169,6.447,176,8.111,197,5.089,209,8.315,218,5.015,258,5.382,364,4.348,382,5.299,512,3.928,580,6.166,652,6.811,669,5.732,872,8.454,1012,7.667,1101,8.547,1217,8.547,1671,8.454,1897,13.925]],["keywords/533",[]],["title/534",[115,313.524,614,773.156]],["content/534",[]],["keywords/534",[]],["title/535",[18,123.267,1926,914.868]],["content/535",[3,0.951,18,2.395,43,5.009,50,2.796,58,1.929,60,3.443,79,3.709,106,2.174,115,4.404,169,3.82,179,3.609,191,4.956,197,3.016,198,5.243,218,2.971,232,5.596,237,3.268,238,2.19,242,4.759,338,2.599,339,2.427,350,2.718,364,4.54,376,7.863,397,7.937,406,4.627,458,5.084,459,4.095,508,3.933,639,5.763,652,4.036,655,7.668,687,3.091,693,5.854,695,4.007,717,4.627,719,6.164,739,4.623,762,5.808,818,8.059,838,7.214,870,3.223,872,5.009,891,6.708,926,5.596,1022,7.863,1081,8.732,1082,4.392,1151,6.054,1173,6.708,1174,7.073,1217,5.064,1304,6.687,1370,6.054,1382,5.677,1514,9.454,1568,4.759,1575,6.054,1598,5.243,1703,4.22,1916,6.708,1927,4.855,1928,7.553,1929,7.553,1930,7.294,1931,7.294,1932,8.251,1933,6.88,1934,8.251,1935,8.251,1936,7.294,1937,7.553,1938,8.251,1939,12.212,1940,8.251,1941,8.251,1942,7.294,1943,7.294,1944,7.294,1945,8.251,1946,8.251,1947,8.251,1948,8.251,1949,8.251,1951,8.251,1952,8.251]],["keywords/535",[]],["title/536",[18,123.267,240,628.279]],["content/536",[18,2.225,50,3.036,58,2.48,106,3.505,238,3.52,240,11.342,266,7.801,323,5.533,350,4.367,363,6.888,364,5.834,458,5.911,776,5.908,1703,6.781,1811,9.124,1828,11.722,1829,11.056,1936,11.722,1953,13.26,1954,10.531,1955,13.26,1956,13.26,1957,10.305,1958,10.779,1959,13.26,1960,13.26]],["keywords/536",[]],["title/537",[50,301.275]],["content/537",[18,2.087,50,4.325,58,2.326,76,3.275,97,6.756,106,3.837,107,4.666,115,2.634,118,4.967,157,3.258,169,4.025,218,4.57,238,3.979,241,3.628,285,5.663,350,2.863,364,3.963,458,4.015,614,6.495,642,7.249,687,2.201,717,4.875,762,4.135,799,6.27,814,5.524,818,5.737,907,9.481,1068,6.49,1073,6.754,1151,6.379,1227,3.803,1232,6.905,1313,7.453,1395,9.897,1398,8.064,1399,6.297,1480,5.524,1648,6.905,1703,4.446,1927,7.466,1942,7.686,1944,7.686,1950,8.285,1957,6.756,1961,8.694,1962,12.69,1963,8.694,1964,5.278,1965,8.694,1966,8.694,1967,8.694,1968,8.694,1969,8.694,1970,8.694,1972,8.694,1973,6.495,1974,8.694,1975,8.694,1976,7.249,1977,6.168,1978,8.694,1979,8.694,1980,8.694,1981,8.694,1982,8.694,1983,8.694,1984,8.694,3059,9.242,3060,9.242]],["keywords/537",[]],["title/538",[8,280.871,18,101.574,1583,506.875]],["content/538",[]],["keywords/538",[]],["title/539",[3,119.285,2962,986.166]],["content/539",[3,1.064,18,1.941,36,2.59,43,3.486,56,1.77,58,2.057,79,2.952,106,3.906,128,4.787,150,6.157,197,2.098,228,6.903,237,4.533,238,3.071,252,5.255,304,6.022,318,3.006,338,2.907,339,4.791,341,2.009,345,3.323,350,1.891,426,3.134,441,8.157,458,2.919,460,5.358,470,6.359,476,2.828,503,5.871,510,4.047,512,5.553,660,2.196,661,2.558,695,2.788,708,3.378,796,6.301,819,4.462,870,3.604,884,2.914,901,4.244,958,6.389,1036,4.073,1075,3.95,1179,5.075,1204,5.321,1220,4.462,1304,4.244,1321,5.075,1322,5.356,1415,2.409,1419,7.026,1449,3.031,1470,6.171,1480,3.648,1525,3.564,1583,9.214,1600,3.564,1710,3.84,1790,4.667,2064,4.462,2203,8.446,2345,5.542,2368,4.922,2749,3.95,2962,5.471,2963,6.103,2964,5.471,2965,5.471,2966,6.103,2967,5.471,2968,9.809,2969,9.809,2970,4.56,2971,9.809,2972,6.103,2973,6.103,2974,6.103,2975,6.103,2976,6.103,2977,6.103,2978,12.625,2979,3.486,2980,6.103,2981,6.103]],["keywords/539",[]],["title/540",[197,378.226,1583,615.129]],["content/540",[3,2.151,18,1.843,106,2.755,197,6.819,211,6.533,259,9.607,288,9.199,325,6.983,669,6.118,1065,6.729,1131,7.262,1221,12.581,1583,11.906]],["keywords/540",[]],["title/541",[287,746.37,1583,615.129]],["content/541",[11,2.347,18,1.454,95,1.549,106,3.965,152,3.384,197,3.015,204,3.222,426,2.731,436,2.202,470,3.384,512,4.101,660,1.914,708,2.943,796,2.379,1002,6.609,1012,1.914,1036,3.549,1204,3.794,1259,20.352,1310,2.974,1387,3.037,1553,2.914,1583,6.256,1641,3.179,1643,7.039,1645,4.579,1789,4.579,1790,4.067,1794,2.858,1846,9.888,2683,4.579,2967,4.767,2982,5.318,2983,5.318,2984,5.318,2985,5.318,2986,5.318,2987,5.318,2988,5.318,2989,5.318,2990,5.318,2991,5.318,2992,5.318,2993,5.318,2994,17.111,2995,5.318,2996,5.318,2997,5.318,2998,5.318,2999,11.188,3000,11.188,3001,20.714,3002,11.188,3003,19.089,3004,15.451,3005,8.768,3006,8.768,3007,8.768,3008,11.188,3009,5.318,3010,5.318,3011,14.357,3012,8.768,3013,8.768,3014,5.318,3015,5.318,3016,5.318,3017,5.318,3018,8.768,3019,8.768,3020,11.188,3021,15.451,3022,8.768,3023,5.318,3024,8.768,3025,8.768,3026,8.768,3027,5.318,3028,5.318,3029,5.318,3030,5.318,3031,5.318,3032,5.318,3033,5.318,3034,5.318,3035,5.318,3036,5.318,3037,5.318,3038,8.768,3039,5.318,3040,5.318]],["keywords/541",[]],["title/542",[963,682.927,1583,615.129]],["content/542",[3,0.88,4,8.61,5,3.905,18,2.221,46,4.586,58,1.013,79,3.542,113,12.638,115,4.684,117,4.74,119,4.321,131,7.153,150,8.229,208,6.462,209,3.631,228,3.631,241,3.186,260,3.462,271,5.039,327,8.176,328,5.107,339,3.389,342,4.687,364,2.384,434,3.708,459,3.789,460,4.254,503,7.044,510,4.856,512,5.11,649,3.168,655,4.795,660,5.31,663,5.893,687,4.201,695,3.708,739,5.255,740,6.366,901,5.301,958,4.212,1012,4.408,1019,3.32,1034,7.236,1204,3.512,1210,4.031,1227,6.763,1228,7.635,1276,4.635,1312,10.301,1416,9.409,1436,6.989,1437,6.989,1439,4.492,1468,7.605,1497,4.133,1539,5.934,1671,4.635,1831,6.366,1858,6.989,2278,5.178,2368,6.545,2994,10.982,3041,8.117,3042,8.117,3043,8.117,3044,8.117,3045,8.117,3046,8.117,3047,8.117,3048,8.117,3049,8.117,3050,8.117,3051,8.117,3052,8.117,3053,8.117,3054,8.117,3055,8.117,3056,8.117,3057,8.117,3058,8.117]],["keywords/542",[]],["title/543",[460,485.753]],["content/543",[]],["keywords/543",[]],["title/544",[50,236.931,460,382.009]],["content/544",[18,1.143,50,3.948,56,2.957,58,2.289,82,4.984,95,2.97,106,3.731,110,4.147,115,4.127,150,5.107,218,3.455,238,2.547,273,4.357,293,5.956,303,6.507,319,4.385,457,4.563,460,5.847,470,6.499,508,3.09,512,3.844,687,2.429,695,6.616,1068,4.907,1073,5.107,1093,8.763,1130,6.417,1227,4.197,1274,5.107,1398,6.097,1399,4.762,1439,5.645,1467,6.332,1694,6.417,1715,5.703,1821,8.457,1898,9.595,1899,13.624,1900,9.595,1901,9.595,1902,9.595,1903,13.624,1905,9.595,1906,8.482,1907,9.595,1908,9.595,1909,9.595,1910,9.595,1911,9.595,1912,9.595,1913,9.595,1914,9.595,1915,9.595,1916,7.8,1917,9.595,1918,9.595,1919,9.595,1920,13.624,1921,9.595,1922,9.595,1923,13.624,1924,10.588,1925,9.595,2961,10.2]],["keywords/544",[]],["title/545",[22,350.355,125,469.918]],["content/545",[3,1.972,50,3.918,58,2.271,864,10.503,958,6.254,1204,7.871]],["keywords/545",[]],["title/546",[958,480.942]],["content/546",[]],["keywords/546",[]],["title/547",[50,236.931,958,378.226]],["content/547",[18,1.311,46,6.612,50,3.902,54,6.833,58,2.262,61,7.081,106,3.713,152,4.516,233,6.912,238,2.922,319,7.79,323,4.593,370,6.349,382,4.189,400,6.476,457,5.235,687,4.315,958,6.688,960,8.554,1204,7.84,1387,6.683,1395,9.003,1398,6.995,1399,5.462,1635,7.362,1702,8.948,1906,9.731,1927,6.476,1964,6.683,2020,11.232,2021,9.178,2022,11.008,2023,11.008,2024,11.008,2025,11.008,2026,11.008,2027,11.008,2028,11.008,2029,11.702,2030,11.008,2031,11.008,2032,11.702,2033,11.008,2034,11.702]],["keywords/547",[]],["title/548",[22,350.355,125,469.918]],["content/548",[12,7.685,18,2.334,22,5.693,115,5.094,655,10.559,864,10.321,1568,9.699]],["keywords/548",[]],["title/549",[466,596.939,1127,682.927]],["content/549",[]],["keywords/549",[]],["title/550",[1985,1315.941]],["content/550",[3,1.677,45,3.957,57,7.619,58,1.931,146,9.137,169,6.737,180,8.833,259,9.032,260,4.371,305,5.624,330,9.731,417,10.323,461,10.323,508,4.686,652,7.117,654,5.214,887,10.323,1074,9.602,1178,12.473,1346,9.359,1415,6.106,1528,10.323,1607,11.828,1796,11.828,1986,10.011,1987,14.55]],["keywords/550",[]],["title/551",[339,387.005]],["content/551",[0,6.575,3,1.877,5,5.162,16,4.704,18,1.94,36,4.554,56,3.111,58,1.34,60,4.212,75,10.108,79,4.907,106,3.424,146,6.338,169,6.537,192,8.652,237,2.701,242,5.822,260,4.891,305,3.901,318,7.393,338,4.447,339,5.186,370,5.822,374,8.652,382,3.841,456,4.583,461,7.161,466,5.822,510,3.531,580,4.469,652,4.937,654,3.617,718,6.062,739,3.821,760,4.164,796,6.715,864,6.195,872,8.571,942,6.492,963,9.317,1082,5.372,1185,7.279,1227,4.415,1304,4.643,1415,4.236,1467,6.661,1528,7.161,1568,5.822,1593,7.541,1598,6.414,1988,8.415,1989,8.923,1990,8.923,1991,6.751,1992,12.481,1993,10.093,1994,10.093]],["keywords/551",[]],["title/552",[341,460.385]],["content/552",[3,1.373,16,3.719,18,2.015,52,6.841,56,2.46,58,1.059,60,3.33,79,2.036,106,3.793,115,4.318,169,3.695,188,4.113,193,5.071,197,2.917,228,6.779,237,4.23,238,3.784,260,5.329,325,3.601,327,3.931,328,5.337,338,4.49,339,2.347,341,4.987,345,5.133,413,4.743,426,4.357,459,5.912,460,2.946,461,8.452,466,4.603,476,3.931,477,6.841,479,6.202,480,4.213,481,6.487,482,6.654,508,3.836,510,2.792,512,2.251,652,3.903,654,2.86,660,3.053,661,5.308,663,6.092,666,6.841,687,4.654,693,5.662,739,3.021,796,3.795,857,5.574,870,4.653,880,4.179,1015,7.394,1027,4.179,1082,4.247,1185,5.755,1210,6.288,1274,4.247,1304,5.48,1433,7.055,1466,5.574,1497,4.319,1575,5.855,1598,9.057,1637,6.202,1638,6.654,1788,6.487,1933,9.932,1992,7.055,1995,7.98,1996,6.487,1997,7.98,1998,6.487,1999,7.055]],["keywords/552",[]],["title/553",[50,301.275]],["content/553",[3,1.163,5,5.162,18,1.94,45,2.745,50,4.249,56,3.111,58,2.34,72,4.212,79,4.155,95,3.124,106,3.586,110,4.362,115,3.058,191,6.062,197,3.689,211,4.26,238,2.68,245,6.128,273,4.583,325,4.554,327,6.955,338,3.179,364,6.005,416,4.833,459,5.009,461,7.161,508,5.244,652,4.937,662,8.016,669,3.309,687,3.574,715,4.937,1019,4.388,1068,5.162,1073,5.372,1395,9.78,1399,5.009,1404,8.016,1502,7.686,1514,8.307,1569,4.285,1964,6.128,2000,8.923,2001,8.205,2002,12.481,2003,8.923,2004,8.923,2005,8.923,2006,8.923,2007,9.239,2008,10.093,2009,10.093,2010,10.093,2011,10.093]],["keywords/553",[]],["title/554",[22,350.355,125,469.918]],["content/554",[3,1.905,20,8.027,58,2.194,60,6.897,218,5.953,510,5.783,580,7.319,654,5.924,896,8.203,1019,7.187]],["keywords/554",[]],["title/555",[79,335.762]],["content/555",[]],["keywords/555",[]],["title/556",[50,301.275]],["content/556",[50,4.375,56,4.292,57,7.291,58,2.32,106,3.751,238,3.697,337,9.581,458,4.406,799,10.043,1068,7.121,1073,7.411,1222,9.726,1299,7.537,1395,10.501,1398,8.848,1399,6.91,1964,8.454,2012,13.925,2013,13.925,2014,12.31,2015,13.925,2016,13.925,2017,13.925]],["keywords/556",[]],["title/557",[22,350.355,125,469.918]],["content/557",[76,6.502,449,6.098,967,8.267,1157,10.596,1597,9.68]],["keywords/557",[]],["title/558",[1101,807.709]],["content/558",[]],["keywords/558",[]],["title/559",[18,86.373,149,245.494,1323,460.781,1841,460.781]],["content/559",[3,1.518,16,6.138,18,2.419,29,7.454,58,1.748,95,4.077,106,3.004,115,3.99,149,5.713,197,4.813,208,7.385,323,5.496,451,9.498,509,7.597,512,3.715,580,5.832,660,5.038,669,4.318,677,10.235,718,7.91,762,8.026,870,5.145,1012,5.038,1101,8.084,1131,6.179,1186,7.828,1336,9.839,1584,10.981,1891,15.139,1892,11.643,2018,13.17]],["keywords/559",[]],["title/560",[22,350.355,125,469.918]],["content/560",[3,1.873,18,1.936,22,5.502,45,4.42,60,6.782,197,5.94,228,7.73,580,7.197,901,7.476,1301,13.932,1792,12.377,2019,16.253]],["keywords/560",[]],["title/561",[449,365.537,1157,635.204]],["content/561",[]],["keywords/561",[]],["title/562",[50,301.275]],["content/562",[18,1.537,50,4.223,58,2.211,106,3.678,238,3.427,273,5.861,370,7.445,400,7.594,449,4.559,458,4.084,687,3.268,1068,6.601,1073,6.87,1332,10.493,1395,10.006,1398,8.202,1399,6.405,1860,10.493,1927,7.594,1977,9.158,2014,11.411,2020,7.923,2035,12.908,2036,12.908,2037,10.493,2038,12.908,2039,18.447,2040,12.908,2041,12.908,2042,11.065,2043,12.908,2044,12.908]],["keywords/562",[]],["title/563",[50,301.275]],["content/563",[]],["keywords/563",[]],["title/564",[2020,807.709]],["content/564",[1,6.856,3,1.213,18,1.983,22,2.296,45,1.845,46,4.074,50,3.603,58,2.088,92,3.342,94,5.387,95,2.1,106,3.623,110,2.931,115,3.189,116,3.913,132,4.812,145,3.342,174,3.004,179,2.967,188,3.496,190,5.387,207,5.387,218,2.443,221,4.738,233,4.259,238,2.794,242,6.071,243,4.476,260,2.037,328,4.537,350,4.248,364,4.028,370,3.913,429,5.655,430,3.736,438,5.512,445,5.387,457,3.226,458,5.268,480,3.581,508,2.184,512,2.97,528,4.418,652,3.318,655,4.259,657,5.814,660,2.595,663,3.469,687,3.68,688,4.667,695,5.112,697,7.723,717,5.902,719,5.067,740,5.655,901,3.12,936,4.892,958,3.847,1068,3.469,1073,3.61,1165,3.991,1204,3.12,1284,4.31,1387,4.118,1394,5.996,1398,4.31,1399,5.223,1409,4.118,1416,3.523,1490,5.655,1491,4.476,1568,3.913,1569,2.88,1574,5.067,1601,5.655,1715,4.032,1796,5.514,1821,9.023,1973,5.067,2020,9.658,2075,5.387,2101,5.996,2115,6.783,2116,6.783,2117,12.898,2118,6.783,2119,6.783,2120,6.783,2121,10.526,2122,6.783,2123,6.783,2124,6.783,2125,6.783,2126,10.526,2127,6.783,2128,6.783,2129,6.783,2130,6.783,2131,6.783,2132,6.783,2133,6.131,2134,6.783,2135,6.783,2136,6.783,2137,6.209,2138,6.783,2139,6.783,2140,10.526,2141,6.783,2142,6.783,2143,5.271,2144,7.211,2145,6.783,2146,6.783]],["keywords/564",[]],["title/565",[22,350.355,125,469.918]],["content/565",[3,1.99,60,7.204,460,6.372,580,7.644,1597,9.68]],["keywords/565",[]],["title/566",[654,370.874,1082,550.801]],["content/566",[]],["keywords/566",[]],["title/567",[1415,552.266]],["content/567",[3,0.668,12,2.647,16,2.7,18,1.107,19,3.726,52,4.966,56,2.864,57,3.033,58,2.327,72,2.417,76,4.383,80,2.682,95,2.877,106,3.691,133,4.11,169,4.303,179,2.534,188,2.985,204,2.263,218,3.347,237,4.548,238,4.341,285,3.773,304,3.856,305,2.239,321,3.681,323,2.417,338,2.927,339,1.704,341,2.027,345,2.086,348,4.11,350,5.126,400,3.408,401,4.502,409,5.118,413,3.443,416,2.774,426,3.162,434,2.813,442,4.411,459,2.875,476,2.854,480,4.906,510,5.445,512,2.622,521,4.178,580,2.565,637,8.862,652,2.833,654,4.772,660,4.451,661,2.581,687,3.371,763,3.309,767,4.709,796,8.083,838,7.235,870,2.263,884,2.94,961,4.11,1019,2.518,1027,3.033,1065,2.518,1103,5.582,1164,4.411,1180,3.726,1227,2.534,1346,7.486,1385,3.929,1415,5.589,1449,3.058,1497,3.135,1508,4.046,1525,3.596,1557,8.538,1723,3.681,1954,4.6,1986,3.986,1991,3.874,2045,5.793,2046,5.302,2047,6.818,2048,14.579,2049,8.215,2050,9.293,2051,9.293,2052,12.888,2053,5.302,2054,6.394,2055,5.793,2056,5.793,2057,9.293,2058,5.793,2059,5.793,2060,5.793,2061,9.293,2062,5.793,2063,5.793,2064,4.502,2065,8.215,2066,11.637,2067,9.293,2068,5.121,2069,5.793,2070,4.6,2071,4.709,2072,5.793,2073,5.793,2074,5.121,2075,4.6,2076,3.929,2077,5.793,2078,5.793,2079,5.793]],["keywords/567",[]],["title/568",[456,597.534]],["content/568",[3,1.258,12,4.986,18,0.846,53,6.771,56,3.363,58,2.42,60,2.965,72,4.552,76,2.676,80,3.29,94,5.643,95,2.199,99,6.771,106,3.398,110,3.071,116,4.098,152,2.915,179,3.108,204,6.279,218,2.559,228,3.379,237,3.987,238,2.896,260,5.096,304,5.51,305,5.133,321,4.515,325,4.922,338,2.238,339,3.208,345,2.559,350,2.34,370,4.098,385,6.851,400,4.18,405,6.091,408,6.771,409,3.913,412,4.57,434,3.451,456,8.022,508,3.513,510,5.212,512,3.078,580,4.831,652,3.475,654,2.546,660,2.718,687,1.799,739,2.69,796,5.189,838,5.414,858,6.771,859,5.643,876,4.628,882,3.984,884,3.606,896,3.526,1123,4.715,1173,5.776,1385,4.819,1415,6.746,1416,5.667,1424,6.281,1446,9.645,1449,3.751,1452,5.776,1510,5.411,1525,4.41,1585,6.281,1698,5.776,1775,13.171,1788,5.776,1794,4.059,1999,6.281,2047,5.213,2071,5.776,2074,6.281,2080,6.281,2081,7.105,2082,7.105,2083,13.28,2084,7.105,2085,6.281,2086,7.105,2087,10.91,2088,7.105,2089,7.105,2090,7.105,2091,7.105,2092,6.504,2093,6.504,2094,6.281,2095,7.105,2096,7.105,2097,7.105,2098,7.105,2099,7.105,2100,7.105]],["keywords/568",[]],["title/569",[1416,683.567]],["content/569",[3,1.425,20,4.076,27,5.21,50,1.922,56,2.587,58,1.641,60,5.161,63,6.392,76,3.162,80,3.886,95,3.828,101,4.583,106,3.705,110,3.627,117,5.21,180,7.508,191,5.042,193,5.334,218,3.023,237,4.836,238,4.586,240,5.096,304,5.131,338,3.896,339,2.469,341,2.937,345,4.454,350,4.837,400,4.938,416,4.02,426,4.583,476,4.135,512,3.489,521,6.054,580,3.717,620,6.392,637,6.392,652,4.105,654,4.432,682,5.863,687,3.131,688,5.775,796,3.992,838,7.287,882,4.707,1415,3.523,1416,6.424,1510,9.418,1525,5.21,1597,4.707,1632,5.863,1703,4.292,1723,5.334,1755,5.21,1792,6.392,1876,7.42,2047,9.074,2049,7.42,2052,15.27,2054,8.509,2064,6.523,2065,7.42,2068,7.42,2076,5.693,2101,7.42,2102,12.367,2103,12.367,2104,8.394,2105,7.42,2106,8.394,2107,8.394,2108,8.394,2109,8.394,2110,8.394,2111,8.394,2112,8.394,3074,6.158]],["keywords/569",[]],["title/570",[510,362.059,1439,608.874]],["content/570",[15,7.274,45,2.788,58,1.361,76,3.862,106,3.6,107,5.503,118,5.858,152,4.206,188,5.284,197,3.747,218,3.692,232,6.953,237,4.752,304,5.922,305,3.963,339,4.829,470,4.206,488,6.364,503,9.011,508,4.597,510,6.762,512,4.027,520,5.412,762,4.876,884,5.203,901,4.716,963,9.42,1074,6.766,1227,4.485,1304,6.566,1351,7.968,1439,9.661,1497,5.55,1557,7.523,1583,6.094,1598,6.515,1887,6.953,2047,10.473,2076,6.953,2114,9.385,2749,11.299,2964,9.77,3075,7.808,3076,10.899,3077,10.899,3078,10.899,3079,10.899,3080,10.899,3081,10.899,3082,10.899,3083,9.77,3084,10.899]],["keywords/570",[]],["title/571",[22,350.355,125,469.918]],["content/571",[18,1.986,22,5.644,76,6.279,242,9.616,450,13.552,1105,12.232,1568,9.616,1792,12.695,1794,9.524]],["keywords/571",[]],["title/572",[3,119.285,95,320.351]],["content/572",[]],["keywords/572",[]],["title/573",[22,350.355,125,469.918]],["content/573",[3,2.236,12,7.554,22,5.596,79,4.217,205,15.751,615,12.846,864,10.146,1469,12.587,1568,9.534]],["keywords/573",[]],["title/574",[683,706.254]],["content/574",[]],["keywords/574",[]],["title/575",[2147,1045.084]],["content/575",[3,1.834,5,8.136,17,5.199,18,1.433,31,10.822,46,7.225,56,3.708,58,1.596,76,5.993,85,8.158,92,5.926,116,6.939,149,4.072,200,11.463,208,6.745,209,5.721,650,8.277,683,10.18,762,7.567,884,6.105,887,12.648,896,7.895,1012,4.601,1019,5.23,1065,5.23,1081,7.225,1131,5.644,1203,8.277,1325,12.933,1326,14.445,1427,8.535,1702,9.779,2148,12.364,2149,12.029,2150,12.029,2151,10.634,2152,12.029]],["keywords/575",[]],["title/576",[3,98.292,669,279.603,683,457.672]],["content/576",[3,2.258,17,5.653,18,1.558,22,4.429,31,7.942,46,7.857,50,2.995,58,1.736,62,7.021,76,4.927,87,11.27,98,6.905,258,5.056,319,5.978,406,7.335,426,7.142,510,4.577,649,5.428,669,6.423,683,10.514,954,10.634,1065,5.687,1131,7.884,1232,10.389,1336,9.773,1359,8.872,2153,13.082,2154,13.082,2155,13.082]],["keywords/576",[]],["title/577",[3,83.583,36,327.181,149,245.494,870,283.258]],["content/577",[3,2.269,8,3.585,18,2.018,20,5.286,36,6.711,50,4.366,54,6.756,58,2.249,85,7.382,87,6.608,90,7.85,104,7.28,115,3.297,149,5.737,211,7.153,218,3.92,234,6.404,406,6.103,414,9.33,416,5.212,444,8.848,512,3.071,632,9.075,649,6.172,661,4.85,669,5.972,683,5.842,708,6.404,776,4.85,870,7.115,872,6.608,1031,10.372,1095,6.835,1097,8.289,1098,8.644,1104,8.459,1127,7.183,1219,9.075,1331,11.327,1567,7.183,1636,6.103,1693,6.756,1755,6.756,1773,7.85,2156,9.963]],["keywords/577",[]],["title/578",[22,350.355,125,469.918]],["content/578",[45,4.573,50,3.85,76,6.334,95,5.205,113,12.805,323,7.017,466,9.699,1976,14.02]],["keywords/578",[]],["title/579",[3,98.292,58,113.175,79,217.583]],["content/579",[]],["keywords/579",[]],["title/580",[79,264.052,426,564.994]],["content/580",[3,1.922,58,2.213,79,4.975,85,11.306,370,9.616,615,12.956,2281,14.738,2282,13.552]],["keywords/580",[]],["title/581",[449,464.807]],["content/581",[3,1.458,8,4.166,11,5.935,12,5.781,58,1.984,79,4.935,82,9.801,156,10.283,158,8.655,373,5.042,382,4.813,396,7.874,416,6.057,449,5.28,508,6.076,569,10.045,627,6.045,679,14.244,683,4.645,869,8.655,1060,7.943,1106,8.541,1157,7.764,1158,12.76,1159,12.778,1161,5.87,1247,9.83,1346,5.567,1439,5.092,1514,8.795,1655,12.152,1675,10.283,2021,7.216,2192,5.638,2272,7.419,2278,8.578,2282,10.283,2283,12.649,2284,11.182,2285,12.649,2286,8.655,2287,11.578,2288,8.655,2289,12.649,2290,12.649,2291,8.655,2292,8.655,2293,8.655,2294,8.655,3085,13.709,3086,9.201]],["keywords/581",[]],["title/582",[434,639.068]],["content/582",[55,7.866,58,2.061,62,6.225,79,4.973,157,4.347,163,9.014,174,6.876,175,7.981,178,9.327,179,5.073,434,8.501,470,6.37,508,3.735,661,5.168,687,4.431,699,6.824,720,9.429,818,7.654,888,11.053,924,12.068,967,7.436,1019,5.043,1061,7.461,1074,7.654,1106,8.066,1370,8.51,1405,10.253,1421,9.429,1566,10.247,1636,6.504,1802,9.211,2165,11.825,2210,8.665,2213,10.253,2282,9.429,2295,8.229,2296,11.599,2297,13.727,2298,11.599,2299,11.599,2300,11.599,2301,11.599]],["keywords/582",[]],["title/583",[585,1022.656]],["content/583",[79,4.254,174,7.382,343,12.455,436,7.337,508,5.369,598,15.886,1606,11.644,2295,11.828,2302,11.001]],["keywords/583",[]],["title/584",[95,320.351,466,596.939]],["content/584",[]],["keywords/584",[]],["title/585",[218,372.686,662,821.883]],["content/585",[0,4.403,3,0.779,18,1.25,50,3.322,56,2.083,58,1.926,75,4.196,79,4.427,106,3.937,197,2.47,237,4.204,238,4.414,242,3.899,260,5.848,273,4.767,305,2.613,318,3.539,325,3.05,327,3.33,338,4.054,339,3.087,341,2.365,345,4.635,350,2.226,364,4.019,456,3.069,459,3.354,461,4.796,466,6.055,476,3.33,477,5.794,479,5.253,480,5.541,481,5.495,482,5.636,486,5.495,508,4.145,509,3.899,512,1.907,608,5.794,654,2.422,660,2.586,661,3.012,662,5.368,663,5.368,666,5.794,667,5.368,695,3.283,880,3.539,901,3.109,942,4.348,1015,6.516,1068,3.457,1073,3.598,1210,3.568,1227,2.957,1274,3.598,1395,8.715,1399,5.209,1415,2.837,1417,5.147,1514,3.977,1569,4.457,1593,5.05,1598,4.295,1964,4.104,1986,4.651,1988,5.636,1989,5.975,1990,5.975,1991,4.521,1998,5.495,2000,5.975,2001,5.495,2002,5.975,2003,11.377,2004,5.975,2005,5.975,2006,5.975,2157,6.759,2158,6.759,2159,6.759,2160,6.759,2161,10.497,2162,6.759,2163,6.759]],["keywords/585",[]],["title/586",[50,301.275]],["content/586",[3,1.798,8,5.138,50,4.602,106,3.337,211,7.914,234,9.179,649,6.473,669,5.115,762,7.42,1065,6.783,1097,11.88,1131,7.32,1221,12.682]],["keywords/586",[]],["title/587",[22,350.355,125,469.918]],["content/587",[3,1.938,22,5.693,27,10.438,552,9.261,902,10.816,1411,10.1,1568,9.699,2164,16.815]],["keywords/587",[]],["title/588",[434,502.581,1566,682.927]],["content/588",[]],["keywords/588",[]],["title/589",[45,357.876]],["content/589",[18,1.601,45,3.656,58,1.784,92,6.623,110,5.81,163,10.447,182,6.104,343,10.043,369,11.524,400,7.909,434,8.304,510,4.703,649,5.578,687,3.403,1165,7.909,1264,13.021,1416,6.983,1566,8.871,1606,9.39,1894,11.884,2165,15.56,2166,13.443,2167,13.443,2168,13.443,2169,13.443,2170,13.443,2171,13.443,2172,13.443,2173,11.884,2174,13.443,2175,13.443]],["keywords/589",[]],["title/590",[36,466.935,905,665.681]],["content/590",[106,4.029,434,8.646,1033,13.661,1034,9.002,1066,13.661,1098,11.385,1101,8.799,1566,9.46,2176,12.673,2177,12.673,2178,12.673]],["keywords/590",[]],["title/591",[460,382.009,958,378.226]],["content/591",[3,0.955,58,1.934,82,4.304,98,4.374,106,3.533,141,6.581,179,3.625,185,5.62,237,5.508,271,5.468,318,4.339,339,4.286,343,6.191,434,4.024,438,4.339,453,8.835,457,3.941,458,5.888,460,4.522,493,7.519,503,4.205,567,7.896,663,4.238,760,3.419,941,7.325,958,5.327,1019,3.603,1074,5.468,1165,9.473,1227,3.625,1264,11.099,1284,5.265,1377,6.44,1378,6.581,1449,4.374,2165,15.936,2173,7.325,2177,7.325,2178,7.325,2179,8.286,2180,10.214,2181,10.83,2182,7.585,2183,8.286,2184,7.325,2185,7.325,2186,7.325,2187,7.325,2188,7.325,2189,8.286,2190,8.286,2191,5.788,2192,5.398,2193,8.286,2194,8.286,2195,8.286,2196,8.286,2199,8.286,2200,8.286,2201,8.286,2202,8.286,2203,7.585,2204,8.286,2205,6.736,2206,6.581,2345,8.754,2979,5.031,3075,6.31]],["keywords/591",[]],["title/592",[79,335.762]],["content/592",[4,3.06,12,3.188,14,3.903,18,0.488,20,1.989,56,1.262,57,2.145,58,1.601,62,2.198,79,1.045,106,3.812,119,5.156,179,1.792,180,2.487,182,1.86,198,2.603,233,5.721,237,4.507,238,4.086,258,1.583,305,1.583,318,2.145,319,3.188,330,2.74,331,2.778,338,1.29,339,1.205,341,2.44,342,5.592,345,4.728,350,2.298,392,3.33,397,2.236,406,3.912,434,1.989,436,1.803,456,5.961,457,1.948,458,6.206,480,2.162,493,4.282,508,1.319,510,2.44,520,2.162,597,3.183,600,2.906,654,1.468,687,3.323,695,1.989,699,2.41,867,3.903,880,3.653,901,3.209,904,2.906,926,2.778,942,2.635,949,2.703,958,1.497,1027,2.145,1061,2.635,1204,1.884,1227,1.792,1264,6.938,1310,2.435,1322,3.23,1329,3.415,1355,3.808,1369,2.818,1377,3.183,1422,3.119,1449,2.162,1477,2.954,1480,2.603,1513,2.703,1587,2.572,1600,2.543,1643,2.74,1794,2.34,1846,2.635,1998,3.33,2133,8.161,2165,15.641,2176,3.621,2180,10.059,2181,6.167,2184,6.167,2185,6.167,2186,6.167,2187,6.167,2188,3.621,2207,4.096,2208,4.096,2210,6.806,2211,6.976,2212,3.621,2213,8.054,2214,4.096,2215,4.096,2216,9.111,2217,4.096,2218,4.096,2219,4.096,2220,15.94,2221,4.096,2222,4.096,2223,12.064,2224,4.096,2225,4.096,2226,4.096,2227,6.976,2228,9.111,2229,4.096,2230,4.096,2231,6.976,2232,4.096,2233,4.096,2234,4.096,2235,9.111,2236,4.096,2237,4.096,2238,4.096,2239,4.096,2240,4.096,2241,4.096,2242,6.976,2243,4.096,2244,4.096,2245,4.096,2246,3.33,2247,3.415,2248,4.096,2249,4.096,2250,4.096,2251,3.749,2252,3.749,2253,4.096,2254,3.749,2255,3.749,2256,3.253,2257,3.415,2258,3.621,2259,3.749,2260,3.749,2261,4.096,2262,4.096,2263,6.976,2264,4.096,2265,4.096,2266,4.096,2267,4.096,2268,4.096,2269,6.976,2270,4.096,2271,3.621,2272,3.511,2273,4.096,2274,3.749,2275,4.096,2276,4.096,2277,3.621,2278,2.778,2279,4.096,2280,2.668]],["keywords/592",[]],["title/593",[3,98.292,6,469.66,7,408.376]],["content/593",[]],["keywords/593",[]],["title/594",[3601,1398.897]],["content/594",[3,1.797,5,5.967,6,10.321,7,8.408,8,3.843,17,6.738,18,1.857,65,10.288,95,3.612,100,9.485,149,3.95,175,8.028,182,5.298,204,4.558,239,5.877,370,6.73,377,11.668,378,8.415,404,10.315,416,7.466,580,5.167,596,6.936,620,8.885,626,8.028,640,11.119,678,6.797,715,5.707,864,7.162,873,10.315,874,11.668,896,5.79,902,7.505,992,9.267,1019,5.073,1411,7.008,1412,10.68,1428,8.279,1574,8.717,1671,7.084,1954,9.267,1973,8.717,2811,10.68,3602,12.404,3603,12.404,3604,12.404,3605,12.404,3606,11.119,3607,12.404,3608,11.119]],["keywords/594",[]],["title/595",[2147,1045.084]],["content/595",[3,1.873,5,8.312,17,7.024,18,1.936,97,12.631,101,8.873,170,14.368,175,11.183,1065,7.066,1428,11.531,3609,17.278,3610,17.278]],["keywords/595",[]],["title/596",[2,986.166,1105,759.301]],["content/596",[3,1.871,7,4.037,17,3.643,18,1.934,45,4.004,56,3.824,57,4.414,58,1.119,79,3.756,92,4.153,95,2.61,106,3.418,163,6.551,179,5.427,197,3.081,204,3.293,218,3.036,237,3.94,238,3.294,260,2.532,304,5.148,305,4.796,322,6.551,324,4.563,328,5.638,338,4.637,339,4.775,341,2.949,345,3.036,348,5.981,350,2.777,382,3.208,409,8.108,459,6.157,472,12.894,476,4.153,508,2.715,660,3.225,661,3.756,667,6.695,687,3.727,693,5.981,739,5.573,760,6.074,870,3.293,896,4.183,901,3.878,970,7.452,1027,4.414,1065,3.665,1210,6.549,1276,7.532,1304,3.878,1310,7.374,1370,6.185,1411,5.063,1415,3.538,1417,6.42,1525,5.233,1786,6.298,2046,7.716,2613,7.716,2715,7.226,3074,6.185,3611,8.033,3612,18.395,3613,4.91,3614,15.65,3615,8.962,3616,8.962,3617,8.033,3618,8.962,3619,7.452]],["keywords/596",[]],["title/597",[409,399.375,654,259.871,760,299.166,1444,563.534]],["content/597",[]],["keywords/597",[]],["title/598",[510,362.059,796,492.192]],["content/598",[3,1.727,7,2.931,18,0.729,58,2.218,106,3.755,115,1.854,119,5.496,152,2.511,174,2.71,183,5.411,185,4.151,204,2.391,208,3.432,237,4.267,238,3.978,243,4.039,253,15.327,260,4.127,266,3.601,305,3.754,338,3.059,339,1.8,341,2.141,342,5.96,345,2.204,350,4.526,409,3.371,426,3.342,458,5.288,476,3.015,480,3.231,488,3.799,510,6.401,511,6.626,512,1.727,520,5.126,699,7.102,746,4.757,838,3.037,896,3.037,901,4.467,912,7.125,961,4.343,1019,2.661,1060,3.844,1165,3.601,1227,2.677,1415,2.569,1448,4.343,1468,6.408,1503,4.275,1513,4.039,1715,3.638,1764,4.661,1811,4.212,1887,4.151,1991,6.495,2070,4.861,2092,8.889,2256,4.861,2439,4.861,2440,7.395,2951,4.757,2970,7.712,3613,3.565,3617,5.833,3620,6.507,3621,6.507,3622,6.507,3623,8.585,3624,5.833,3625,6.507,3626,10.323,3627,12.832,3628,6.507,3629,6.507,3630,10.323,3631,12.832,3632,6.507,3633,10.323,3634,12.832,3635,6.507,3636,6.507,3637,6.507,3638,6.507,3639,6.507,3640,6.507,3641,6.507,3642,6.507,3643,6.507,3644,6.507,3645,6.507,3646,6.507,3647,6.507,3648,6.507,3649,6.507,3650,6.507,3651,6.507,3652,6.507,3653,6.507,3654,6.507,3655,6.507,3656,6.507,3657,6.507,3658,6.507,3659,6.507,3660,6.507,3661,6.507,3662,6.507,3663,6.507,3664,6.507,3665,5.833]],["keywords/598",[]],["title/599",[900,862.854,3666,986.166]],["content/599",[3,1.276,7,5.301,58,2.269,106,3.415,131,6.872,188,5.705,208,6.208,237,4.575,260,4.52,331,11.594,338,4.74,339,3.256,341,3.873,409,6.097,458,4.761,459,5.494,460,4.086,510,5.264,511,7.256,660,4.235,688,7.617,739,4.191,857,7.732,900,14.253,1272,7.121,1312,6.872,1387,10.378,1439,6.513,2182,10.133,2205,8.999,2210,8.271,2442,9.49,3613,6.448,3666,18.279,3667,11.768,3668,10.549,3669,11.768,3670,11.768,3671,11.768,3672,11.768,3673,15.112,3674,11.768,3675,8.792]],["keywords/599",[]],["title/600",[409,724.753]],["content/600",[3,1.463,7,4.163,18,1.036,58,2.326,79,2.218,106,3.697,119,7.182,141,6.905,169,6.939,183,7.686,185,5.896,237,4.01,238,3.369,305,4.905,318,4.552,338,3.997,339,2.557,341,3.042,342,7.789,345,3.131,409,11.533,426,6.928,434,6.163,476,4.283,493,5.336,510,3.042,552,4.788,620,6.621,687,3.794,717,4.875,760,6.183,882,4.875,896,4.314,926,5.896,1019,3.78,1165,5.115,1227,3.803,1355,4.746,1358,6.756,1415,3.649,1417,6.621,1447,5.663,1468,10.873,1525,5.397,1569,5.388,1578,13.717,1715,5.168,1764,12.547,1794,4.967,2440,6.621,2845,7.453,2951,6.756,3613,5.064,3665,8.285,3668,8.285,3676,7.686,3677,9.242,3678,9.242,3679,9.242,3680,9.242,3681,9.242,3682,7.686]],["keywords/600",[]],["title/601",[456,469.918,1513,682.927]],["content/601",[0,3.502,3,0.62,7,2.575,12,2.457,27,3.337,58,1.862,72,2.243,80,2.489,106,3.863,107,4.696,118,4.999,180,3.264,186,5.376,208,3.015,237,5.066,238,4.773,260,3.323,273,5.024,305,3.382,324,2.91,338,4.738,339,3.254,341,3.871,345,5.952,350,3.644,400,3.163,412,3.458,421,5.376,456,3.973,458,5.017,473,3.945,476,2.649,479,6.799,480,4.619,499,4.999,510,1.881,511,7.253,518,3.646,520,5.84,667,6.949,695,2.611,767,4.37,796,4.161,799,3.877,803,5.56,833,5.376,838,2.668,851,5.376,936,3.877,1027,2.815,1151,6.419,1303,5.376,1310,3.196,1340,7.295,1346,3.458,1415,3.672,1416,2.793,1419,4.094,1447,3.502,1497,2.91,1513,10.906,1536,4.178,1703,4.474,1802,4.27,1857,5.852,1887,3.646,2053,4.921,2054,8.772,2070,4.27,2075,4.27,2076,3.646,2257,4.482,3074,3.945,3468,5.123,3613,5.096,3624,5.123,3683,9.301,3684,9.301,3685,5.715,3686,14.333,3687,5.715,3688,5.715,3689,5.715,3690,9.301,3691,5.715,3692,8.337,3693,9.301,3694,5.715,3695,5.715,3696,5.715,3697,9.301,3698,5.715,3699,8.337,3700,5.123,3701,5.715,3702,5.715,3703,5.715,3704,5.715,3705,8.337,3706,5.715,3707,9.301,3708,5.715,3709,9.301,3710,5.715,3711,5.715,3712,5.715,3713,5.715,3714,5.123,3715,5.715,3716,5.715,3717,5.123]],["keywords/601",[]],["title/602",[510,362.059,1439,608.874]],["content/602",[3,1.061,18,1.096,58,2.431,106,3.893,173,5.996,237,4.994,238,4.492,240,5.588,260,3.468,271,3.778,304,4.79,338,4.166,339,4.262,341,3.22,345,5.575,348,4.061,350,3.032,382,3.503,409,3.153,412,7.426,479,4.449,480,3.022,503,8.588,510,3.22,660,4.416,667,7.31,687,2.33,739,4.371,752,5.724,760,2.362,838,5.729,870,3.596,901,6.666,1025,11.509,1164,7.01,1304,5.31,1371,5.24,1404,4.546,1415,2.402,1416,7.528,1417,4.359,1439,5.416,1440,4.449,1513,6.074,1514,3.368,1575,4.2,1590,8.426,1703,2.927,1846,3.682,2749,9.1,3074,6.754,3613,5.362,3676,12.812,3717,8.772,3718,6.085,3719,6.085,3720,6.085,3721,6.085,3722,6.085,3723,6.085,3724,6.085,3725,6.085,3726,6.085,3727,6.085,3728,6.085,3729,6.085,3730,16.456,3731,6.085,3732,9.785,3733,11.002,3734,6.085,3735,6.085,3736,6.085,3737,9.785,3738,12.273,3739,6.085,3740,9.785,3741,6.085,3742,9.785,3743,6.085]],["keywords/602",[]],["title/603",[796,492.192,1759,701.858]],["content/603",[3,1.617,7,6.716,305,6.788,330,9.38,434,6.811,456,6.369,552,7.724,586,14.025,654,6.871,716,11.694,739,5.31,796,9.842,1082,7.465,1276,8.515,1329,11.694,1415,5.886,1416,7.285,1759,13.004,1767,12.838,3623,12.399,3744,13.365,3745,12.399]],["keywords/603",[]],["title/604",[687,333.132]],["content/604",[3,1.321,11,7.228,18,1.835,58,1.521,95,3.548,106,3.696,119,6.487,237,3.067,238,4.09,341,5.39,342,7.035,345,5.548,396,5.489,491,10.343,493,7.035,530,7.773,687,4.71,739,4.339,760,4.729,880,6.002,958,4.189,967,8.333,1123,7.52,1127,10.166,1161,10.448,1180,7.373,1204,5.272,1468,7.564,1599,14.101,2133,10.136,2448,10.6,2845,9.825,3746,12.184,3747,12.184,3748,12.184]],["keywords/604",[]],["title/605",[694,914.868,1059,887.122]],["content/605",[3,1.182,5,5.243,12,6.523,18,1.221,56,3.16,58,1.361,106,3.703,115,3.106,193,6.515,237,4.394,238,3.789,241,4.278,271,6.766,323,4.278,338,4.496,339,3.015,341,3.587,345,3.692,350,4.701,442,7.808,597,7.968,687,4.726,694,12.619,739,3.882,760,6.775,838,9.263,870,4.005,901,4.716,975,7.394,1059,12.236,1180,10.563,1299,5.55,1311,10.664,1385,6.953,1445,7.161,1467,6.766,1928,9.385,1986,7.055,2192,6.679,2649,7.968,3613,5.972,3745,9.064,3749,15.174,3750,9.064,3751,10.899,3752,13.602,3753,10.899,3754,10.899,3755,15.174]],["keywords/605",[]],["title/606",[1180,846.462]],["content/606",[3,1.025,6,4.898,8,2.929,45,3.508,58,1.712,95,2.753,106,3.742,115,3.908,126,6.525,152,5.292,169,4.117,182,5.858,185,6.031,198,5.651,209,4.229,237,3.452,238,4.03,239,4.479,338,4.064,339,2.615,341,3.111,345,5.467,350,4.249,460,3.283,649,3.69,652,4.35,655,5.584,664,7.861,687,4.816,739,3.367,838,6.402,948,7.861,1161,6.031,1165,5.232,1180,5.72,1304,4.09,1312,5.52,1359,8.749,1379,8.14,1385,6.031,1468,5.868,1703,4.548,1790,7.229,1986,6.119,1991,5.948,2252,8.14,2442,7.623,2539,8.14,3507,15.869,3608,8.474,3613,5.18,3675,7.062,3745,7.861,3750,7.861,3756,13.714,3757,9.453,3758,9.453,3759,9.453,3760,9.453,3761,9.453,3762,9.453,3763,9.453,3764,9.453,3765,9.453,3766,9.453,3767,9.453,3768,9.453,3769,9.453,3770,9.453,3771,9.453,3772,9.453,3773,8.474,3774,9.453,3775,9.453]],["keywords/606",[]],["title/607",[2978,1253.981]],["content/607",[4,10.478,18,2.092,115,5.321,174,6.21,237,4.7,338,4.418,341,6.144,409,7.724,434,6.811,687,4.854,739,5.31,760,5.786,880,9.196,1467,9.255,1470,9.38,1601,15.987,3613,8.17,3682,15.526,3776,14.909,3777,14.909,3778,14.909]],["keywords/607",[]],["title/608",[1054,744.754]],["content/608",[3,1.227,7,5.098,58,1.944,106,3.87,237,5.233,238,5.023,338,4.615,339,3.131,341,3.725,345,3.834,373,6.201,458,4.635,470,4.367,476,5.245,687,4.241,739,5.547,1054,9.48,1123,6.332,1304,4.897,1352,9.936,1396,8.876,1415,4.468,1491,7.025,1623,8.273,1715,6.328,2037,8.654,2191,7.436,2192,9.543,2514,11.157,2970,8.455,3613,6.201,3673,9.411,3779,11.317,3780,11.317,3781,11.317,3782,11.317,3783,11.317,3784,11.317,3785,11.317,3786,9.411]],["keywords/608",[]],["title/609",[728,1204.507]],["content/609",[3,1.665,7,6.916,18,1.72,106,2.571,115,6.152,131,8.965,241,6.026,271,9.53,434,7.014,458,4.569,627,10.087,687,5.141,699,8.497,728,13.219,876,9.407,1857,9.659,2295,10.247,3744,13.762,3787,15.352,3788,15.352,3789,15.352]],["keywords/609",[]],["title/610",[958,378.226,1283,746.37]],["content/610",[3,1.797,7,4.463,8,3.069,12,4.259,58,2.259,106,3.743,131,5.785,157,3.492,187,5.483,228,4.432,237,4.171,238,2.474,304,3.867,325,4.205,327,4.591,338,4.203,339,5.511,341,3.26,382,3.546,458,4.222,472,12.379,493,9.567,510,4.668,687,2.359,739,3.528,884,4.729,890,5.483,958,7.213,963,6.15,1157,5.72,1204,6.138,1283,9.623,1304,4.287,1310,5.539,1366,6.412,1411,5.597,1439,5.483,1467,6.15,1569,3.957,1573,8.53,1810,10.37,2345,9.362,2416,8.53,2957,9.319,3074,6.837,3611,12.715,3613,5.428,3623,8.238,3790,9.907,3791,9.907,3792,14.185,3793,9.907,3794,9.907,3795,9.907,3796,9.907,3797,9.907]],["keywords/610",[]],["title/611",[460,382.009,1597,580.309]],["content/611",[3,1.111,7,4.618,8,3.176,42,9.189,58,2.108,60,4.024,72,4.024,98,5.09,106,3.816,107,5.175,145,6.735,152,3.956,232,6.54,237,4.625,238,3.63,293,5.985,325,4.351,327,4.75,338,4.307,339,2.836,341,3.374,345,3.473,460,7.35,472,7.658,503,4.894,510,4.783,511,4.65,535,9.144,548,6.635,649,5.672,687,4.375,715,6.687,739,3.651,1304,4.435,1439,5.673,1491,9.022,1597,5.407,1600,8.487,1606,6.735,1623,7.494,2979,8.3,3074,7.075,3613,5.617,3619,8.524,3798,10.251,3799,10.251,3800,10.251,3801,10.251,3802,10.251,3803,10.251,3804,9.189,3805,14.534,3806,10.251,3807,10.251]],["keywords/611",[]],["title/612",[932,780.553,1500,649.387,3808,906.523]],["content/612",[3,1.302,5,4.588,6,4.941,7,6.218,18,2.114,45,3.073,58,1.5,60,2.314,72,4.715,78,4.404,87,3.366,100,4.508,106,3.817,115,1.68,126,4.068,131,3.442,146,7.095,148,4.753,155,4.623,175,3.815,180,3.366,218,1.997,234,8.389,237,4.95,238,4.05,266,3.262,288,7.717,304,6.33,324,3.001,338,5.827,339,4.918,341,5.338,350,5.025,382,3.414,405,4.753,509,5.175,580,2.455,613,5.545,715,2.712,739,2.099,859,4.404,882,3.109,890,6.648,896,4.452,902,3.567,932,15.812,941,7.931,942,3.567,944,6.832,945,5.545,949,3.659,1019,2.411,1027,2.903,1065,2.411,1103,3.33,1227,2.425,1376,5.075,1468,5.92,1470,3.709,1500,9.887,1507,5.075,1508,3.873,1521,4.309,1528,6.365,1703,2.836,1709,4.623,1802,4.404,1954,4.404,2093,5.075,2430,5.075,2573,7.69,2649,4.309,2865,8.212,3074,4.068,3613,3.23,3675,4.404,3809,9.537,3810,5.894,3811,9.537,3812,16.219,3813,5.894,3814,12.011,3815,5.894,3816,5.894,3817,12.011,3818,9.537,3819,5.894,3820,5.894,3821,9.537,3822,5.894,3823,5.894,3824,5.894,3825,5.894,3826,5.894,3827,5.894]],["keywords/612",[]],["title/613",[83,862.854,907,773.156]],["content/613",[3,0.615,7,4.162,18,1.511,45,1.45,58,1.854,79,2.807,83,11.649,106,3.909,107,5.904,115,2.633,152,2.187,157,1.998,213,4.234,237,2.944,238,3.709,260,1.602,273,5.761,305,2.061,324,2.886,338,3.996,339,2.556,341,3.849,345,3.962,350,3.623,409,4.786,412,5.59,436,2.347,451,3.845,460,1.968,503,2.706,508,2.799,510,4.438,511,6.738,535,3.566,554,7.955,626,3.669,627,3.724,652,2.608,660,2.04,687,4,692,4.88,715,2.608,739,3.29,746,4.144,758,4.334,760,2.2,882,6.169,890,3.137,896,2.646,1009,5.332,1019,2.318,1068,4.444,1310,5.166,1366,3.669,1415,2.238,1447,3.473,1448,3.783,1513,5.735,1514,7.464,1528,3.783,1569,2.264,1648,4.234,1715,3.169,1773,3.845,1841,3.388,2054,3.669,2075,6.902,2076,3.616,2192,3.473,2796,4.88,2802,11.194,2979,3.237,3122,5.081,3443,4.446,3613,3.106,3619,7.683,3673,7.683,3682,4.714,3692,8.282,3699,10.483,3705,8.282,3714,5.081,3733,5.081,3750,13.968,3752,13.314,3786,4.714,3828,9.239,3829,5.668,3830,14.852,3831,5.668,3832,11.694,3833,5.668,3834,5.668,3835,5.668,3836,11.694,3837,5.668,3838,5.668,3839,5.668,3840,5.668,3841,5.668,3842,5.668,3843,11.694,3844,5.668,3845,5.668,3846,5.668,3847,5.668,3848,5.668,3849,5.668,3850,5.668,3851,5.668,3852,5.668,3853,5.668,3854,5.668,3855,5.668]],["keywords/613",[]],["title/614",[687,215.878,2192,555.478,3856,812.614]],["content/614",[3,1.508,7,6.265,18,2.211,115,5.624,126,9.598,373,7.62,508,4.213,612,8.872,687,5.339,739,4.953,796,7.992,1304,6.017,1349,11.974,1352,8.872,1703,6.69,2191,9.137,2192,13.507,3675,10.389,3786,16.411,3856,17.69,3857,13.906]],["keywords/614",[]],["title/615",[3858,1398.897]],["content/615",[]],["keywords/615",[]],["title/616",[1553,766.522]],["content/616",[3,1.301,7,3.559,18,0.885,58,1.812,60,3.101,106,3.791,129,7.431,146,4.666,177,11.851,179,3.25,204,2.903,237,4.389,238,3.625,273,3.374,304,4.684,319,3.396,324,4.022,338,4.804,339,3.32,341,3.95,345,2.676,350,3.719,454,5.902,458,3.572,476,3.661,480,3.923,508,2.393,511,5.444,520,3.923,661,3.311,687,3.456,695,3.609,699,6.642,750,6.569,796,5.369,896,3.688,940,6.569,1366,7.768,1415,3.119,1431,6.802,1448,5.272,1513,4.904,1553,9.553,1569,4.793,1715,4.417,2210,8.435,2664,6.802,2780,10.334,3613,4.329,3676,6.569,3686,7.081,3700,7.081,3859,7.9,3860,12.002,3861,7.9,3862,7.9,3863,7.9,3864,7.9,3865,7.9,3866,12.002,3867,7.9,3868,7.9,3869,7.9,3870,7.9,3871,7.9,3872,7.9,3873,7.9,3874,7.9,3875,7.9,3876,7.9,3877,7.9,3878,7.9,3879,7.9,3880,7.9,3881,7.9,3882,7.9,3883,7.9,3884,7.9,3885,7.9,3886,7.9,3887,7.9,3888,7.9,3889,7.9,3890,7.9,3891,7.9,3892,7.9,3893,7.9,3894,7.9,3895,7.9,3896,7.9,3897,7.9,3898,7.9,3899,7.9,3900,7.9,3901,7.9,3902,7.9,3903,7.9,3904,7.9,3905,7.9]],["keywords/616",[]],["title/617",[1368,821.883,3906,986.166]],["content/617",[3,0.88,6,6.347,7,5.519,18,0.909,45,3.775,58,1.842,95,3.567,106,3.848,115,4.205,126,5.602,157,2.861,175,5.254,188,8.993,237,4.441,238,3.685,338,4.87,339,3.389,341,4.032,345,2.75,350,5.092,356,9.608,357,5.814,382,2.906,436,5.072,458,3.646,460,5.124,476,3.762,503,3.875,510,4.856,637,5.814,649,5.759,687,1.933,715,5.637,818,9.16,882,4.282,896,3.789,961,5.417,968,11.284,1298,6.207,1351,8.956,1380,7.816,1415,3.204,1567,5.039,1597,8.67,1600,4.74,1929,6.989,2209,7.635,2280,4.974,2970,6.064,3613,4.448,3675,6.064,3773,7.276,3804,7.276,3906,7.276,3907,12.251,3908,8.117,3909,8.117,3910,8.117,3911,8.117,3912,8.117,3913,8.117,3914,12.251,3915,8.117,3916,12.251,3917,8.117,3918,8.117,3919,8.117,3920,14.756,3921,8.117,3922,8.117,3923,8.117,3924,8.117]],["keywords/617",[]],["title/618",[853,965.506]],["content/618",[3,2.22,6,6.167,7,5.362,8,3.688,12,5.117,17,4.839,18,1.806,20,5.438,45,3.045,56,3.451,78,8.893,82,5.817,90,8.076,95,3.466,101,6.113,104,7.489,110,4.839,157,4.196,169,5.185,221,7.821,223,6.523,228,5.326,239,5.64,259,6.951,382,5.771,391,8.893,396,5.362,416,8.235,447,10.671,460,4.133,508,3.606,597,8.702,630,10.25,632,9.336,635,9.899,661,4.989,678,6.523,857,7.821,864,9.308,896,5.557,899,11.198,905,7.203,1019,4.868,1219,9.336,1320,11.198,1409,9.207,1411,6.726,1426,10.25,1500,8.527,1574,8.366,1597,6.279,1635,7.489,1773,8.076,3606,10.671,3925,11.904,3926,11.904]],["keywords/618",[]],["title/619",[1428,605.03,2785,517.71,3087,753.863]],["content/619",[]],["keywords/619",[]],["title/620",[152,424.56,2147,821.883]],["content/620",[]],["keywords/620",[]],["title/621",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/621",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/621",[]],["title/622",[2789,780.553,2790,615.019,2791,677.243]],["content/622",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2790,11.821,2791,13.017,3087,14.489]],["keywords/622",[]],["title/623",[62,457.672,107,457.672,2785,517.71]],["content/623",[]],["keywords/623",[]],["title/624",[701,402.951,1322,335.742,2792,663.743,2798,621.606]],["content/624",[3,1.98,8,4.459,18,2.046,36,8.511,58,1.797,82,7.032,117,8.403,149,4.583,197,4.947,223,7.885,239,6.818,323,5.649,324,7.327,512,4.845,708,7.964,715,6.621,762,6.438,1012,7.216,1015,8.403,1225,10.113,1322,6.268,1583,10.208,1758,12.601,2679,11.287,2798,11.604,2799,12.391,3088,14.39]],["keywords/624",[]],["title/625",[17,272.593,18,75.13,45,171.537,1322,292.038,2800,525.901]],["content/625",[11,3.871,17,3.566,18,0.983,27,5.122,45,2.244,58,1.929,106,3.792,228,3.924,237,5.305,239,4.156,304,3.423,318,7.612,325,3.723,338,2.599,339,4.276,396,3.951,438,6.394,460,6.629,470,3.385,488,9.024,503,6.197,510,4.272,511,3.979,512,2.328,520,4.356,548,5.677,549,6.054,715,4.036,739,3.124,902,5.307,958,5.313,963,5.445,967,3.951,1015,9.024,1065,3.587,1123,3.566,1304,8.548,1311,6.164,1322,6.731,1428,5.854,1439,7.185,1449,4.356,1480,5.243,1586,6.054,1587,5.181,1713,6.054,2047,6.054,2113,7.863,2114,7.553,2198,6.164,2345,7.335,2749,8.403,2835,6.553,2836,6.553,2837,6.553,2838,6.553,2839,6.553,2840,6.553,2841,6.553,2842,6.553,2951,6.412,2979,7.414,3075,6.283,3089,8.771,3090,8.771,3091,15.455,3092,8.771,3093,8.771]],["keywords/625",[]],["title/626",[45,231.913,95,263.974,118,487.186]],["content/626",[11,1.938,17,1.785,18,0.492,50,1.609,58,1.75,95,1.279,106,3.938,145,2.035,160,4.465,173,2.691,182,1.876,237,5.092,238,4.246,260,2.754,304,3.804,338,1.301,339,2.696,341,2.458,345,5.334,348,2.931,350,3.02,396,4.39,436,4.76,438,2.163,456,1.876,457,3.342,458,4.451,460,3.993,470,6.336,473,3.031,488,4.361,491,7.207,499,5.238,503,2.096,511,4.421,512,1.982,513,3.87,514,4.053,516,3.086,518,2.802,519,5.067,520,2.181,521,2.979,522,3.358,523,3.358,530,2.802,535,4.699,539,2.885,543,2.885,544,11.105,546,2.885,548,2.842,549,3.031,687,1.046,958,1.51,967,3.365,975,2.979,1068,4.688,1073,2.199,1123,8.738,1210,2.181,1220,3.21,1355,5.905,1362,3.281,1415,1.734,1447,4.577,1449,3.709,1525,4.361,1587,2.594,1719,6.497,1723,2.625,1729,2.931,1823,3.444,2133,9.839,2345,4.22,2439,3.281,2440,3.146,2448,9.68,2449,3.444,2450,3.444,2451,7.936,2452,5.46,2470,3.444,2471,3.444,2472,3.21,2473,3.444,2474,3.444,2475,5.858,2477,5.858,2478,3.444,2480,6.431,2482,3.444,2483,3.444,2484,3.444,2485,3.444,2487,3.781,2785,2.508,2835,3.281,2836,3.281,2837,3.281,2838,3.281,2839,3.281,2840,3.281,2841,3.281,2842,3.281,2926,3.781,2927,3.781,2928,3.781,2929,3.781,2930,3.781,2931,3.781,2932,3.541,2934,3.541,2935,3.781,2937,3.781,2938,3.781,2939,3.781,2940,3.781,2942,3.781,2979,2.508,3087,3.652,3094,4.391,3095,4.391]],["keywords/626",[]],["title/627",[1857,692.162,2945,947.258]],["content/627",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/627",[]],["title/628",[1081,621.593,1151,759.301]],["content/628",[2952,16.234,2953,16.234]],["keywords/628",[]],["title/629",[8,238.838,363,376.679,364,226.432,449,256.132]],["content/629",[]],["keywords/629",[]],["title/630",[8,340.857,3103,759.301]],["content/630",[3,1.413,8,5.305,18,1.46,50,3.688,56,3.778,58,2.536,149,4.149,174,7.967,198,7.788,203,11.219,204,7.464,285,7.984,323,5.114,350,4.037,363,6.367,364,3.827,417,8.696,585,9.525,596,7.285,660,4.688,678,7.139,683,6.578,776,5.461,870,4.788,1029,7.788,1065,5.329,1277,14.288,1343,11.219,1427,8.696,2347,10.835,3103,11.818,3104,13.029,3105,13.029,3106,13.029,3107,10.835,3108,11.68,3109,11.68,3110,13.029]],["keywords/630",[]],["title/631",[449,365.537,589,862.854]],["content/631",[1,7.74,3,1.37,8,5.836,18,1.88,20,5.77,27,7.376,56,3.662,58,2.505,72,4.958,89,6.854,104,7.947,149,4.023,174,7.846,211,5.016,215,11.022,218,4.279,363,6.172,364,4.928,365,12.263,373,9.192,406,6.663,414,10.186,449,6.258,507,10.504,715,5.812,870,4.641,884,6.03,1272,7.643,1283,8.57,1937,10.876,2404,10.876,3103,11.578,3107,10.504,3111,16.884,3112,9.437,3113,11.323,3114,12.631,3115,12.631,3116,12.631]],["keywords/631",[]],["title/632",[3,119.285,363,537.576]],["content/632",[3,1.2,8,3.429,18,1.595,20,2.392,22,0.931,45,1.34,46,1.653,50,1.864,56,2.51,58,1.85,72,1.148,76,1.036,79,0.702,80,3.096,98,1.452,106,3.953,115,2.838,118,1.572,145,4.615,149,3.524,150,5.541,152,1.129,156,2.237,157,5.406,174,1.218,180,4.06,182,1.249,187,1.619,204,2.612,209,1.309,211,2.823,218,0.991,223,1.603,228,2.343,237,0.736,238,1.775,239,1.386,240,4.06,258,1.904,273,1.249,287,1.984,301,5.975,319,1.257,350,1.622,361,5.092,363,6.282,364,4.642,380,1.893,428,1.952,444,2.237,445,2.185,449,3.677,453,3.552,457,1.309,458,4.044,470,2.021,491,2.928,509,1.587,512,3.191,513,2.713,514,2.841,580,1.218,596,2.928,612,1.866,626,1.893,649,3.379,656,1.816,660,2.558,669,0.902,678,3.895,682,9.735,701,5.205,718,1.653,720,2.237,762,2.343,763,1.572,803,1.748,856,2.432,870,1.075,875,2.294,880,1.441,882,1.543,884,2.5,901,4.309,913,2.751,935,1.984,954,2.237,1012,3.115,1015,1.708,1029,3.13,1034,3.093,1035,5.238,1036,1.952,1065,1.196,1075,1.893,1082,1.464,1104,2.138,1133,4.06,1135,4.413,1138,6.188,1152,3.68,1216,12.368,1219,2.294,1274,3.559,1277,2.185,1336,2.055,1387,1.67,1404,2.185,1409,1.67,1490,2.294,1497,1.489,1553,1.603,1569,3.457,1641,1.748,1643,3.294,1669,2.762,1671,1.67,1719,2.958,1755,1.708,1757,2.055,1782,2.019,1800,2.518,1807,2.294,1809,2.294,1810,2.138,1811,7.163,1813,2.518,1821,3.057,1825,2.518,1826,2.518,1829,2.294,1837,2.518,1845,2.358,1846,6.696,1851,10.366,1853,2.518,1880,2.294,1882,2.294,1884,2.294,1885,2.294,1886,2.294,1887,1.866,1888,2.294,1889,2.294,1927,1.619,1957,3.828,1964,1.67,2020,1.689,3075,2.095,3103,2.019,3109,2.622,3112,5.311,3117,2.925,3118,2.925,3119,2.925,3120,2.185,3121,2.925,3122,2.622,3123,2.925,3124,2.925,3125,4.354,3126,2.925,3127,2.925,3128,2.925,3129,5.236,3130,2.925,3131,7.109,3132,4.744,3133,2.432,3134,2.432,3135,2.432,3136,2.925,3137,2.925,3138,2.925,3139,2.925,3140,2.294,3141,2.432,3142,2.925,3143,2.432,3144,2.925,3145,2.925,3146,2.925,3147,5.236,3148,2.925,3149,2.925,3150,5.236,3151,2.925,3152,2.925,3153,2.925,3154,2.925,3155,2.925,3156,2.925,3157,2.925,3158,2.925,3159,2.622,3160,2.622,3161,2.925,3162,2.925,3163,2.925,3164,2.925,3165,2.925,3166,2.925,3167,2.925,3168,2.622,3169,2.925,3170,2.925,3171,2.925,3172,2.925,3173,2.925,3174,2.925,3175,7.109,3176,8.657,3177,5.236,3178,2.925,3179,7.109,3180,2.925,3181,7.109,3182,2.925,3183,2.925,3184,2.925,3185,2.925,3186,7.109,3187,2.925,3600,9.367]],["keywords/632",[]],["title/633",[3188,1163.321]],["content/633",[6,7.082,11,6.033,16,4.126,18,2.193,27,5.495,29,5.01,43,5.374,58,1.706,72,5.365,76,7.156,82,4.598,131,5.495,174,6.705,176,5.156,203,8.103,204,3.458,216,6.879,223,5.156,228,4.21,241,3.694,319,4.046,364,4.015,365,9.992,424,7.826,449,6.875,458,4.068,470,3.632,512,3.627,513,4.875,596,7.643,660,3.386,678,5.156,880,4.635,884,4.492,954,7.196,967,4.239,969,7.196,992,7.03,1025,7.03,1029,5.625,1060,5.559,1158,6.183,1159,6.879,1217,5.433,1256,8.436,1276,5.374,1284,5.625,1297,7.381,1298,10.453,1336,6.613,1423,6.879,1567,8.485,1584,7.381,1635,5.921,1636,4.964,1637,6.879,1668,6.495,1669,4.964,1671,5.374,1672,8.103,1703,4.527,1750,7.588,1872,7.381,2501,7.03,2505,6.741,3083,8.436,3107,7.826,3108,8.436,3120,7.03,3132,6.281,3188,7.826,3189,9.41,3190,9.41,3191,9.41,3192,9.41,3193,9.41,3194,9.41,3195,13.669,3196,9.41,3197,9.41]],["keywords/633",[]],["title/634",[8,207.749,58,83.711,449,222.791,967,302.059,3103,462.786]],["content/634",[8,5.864,18,2.121,76,5.4,174,6.348,204,5.6,364,5.559,373,8.35,382,5.455,449,5.063,509,8.269,596,8.521,624,12.673,967,8.526,991,14.336,1082,7.63,1277,11.385,1283,10.339,1300,11.385,2259,13.122,3103,13.063,3111,13.661,3198,15.239,3199,15.239]],["keywords/634",[]],["title/635",[853,965.506]],["content/635",[3,1.997,8,6.568,18,1.635,31,8.334,58,2.3,61,8.83,104,9.182,301,10.072,319,6.274,364,4.287,449,4.849,569,10.903,596,8.16,632,11.446,776,6.117,864,8.426,865,17.328,880,7.188,1019,5.969,1025,10.903,1082,7.307,1635,11.589,3103,12.713,3188,15.318,3200,14.594]],["keywords/635",[]],["title/636",[1428,605.03,2785,517.71,2786,649.387]],["content/636",[]],["keywords/636",[]],["title/637",[152,424.56,2147,821.883]],["content/637",[]],["keywords/637",[]],["title/638",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/638",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/638",[]],["title/639",[2789,780.553,2790,615.019,2791,677.243]],["content/639",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2786,12.481,2790,11.821,2791,13.017]],["keywords/639",[]],["title/640",[62,457.672,107,457.672,2785,517.71]],["content/640",[]],["keywords/640",[]],["title/641",[701,402.951,708,426.638,762,344.879,2792,663.743]],["content/641",[3,1.864,17,5.331,18,1.469,36,8.643,58,2.147,115,3.737,117,7.656,149,5.476,171,8.896,223,7.185,239,6.212,258,4.768,323,5.147,324,6.676,512,4.563,701,8.988,708,11.27,715,6.033,762,5.866,870,4.818,1012,7.327,1015,7.656,1225,9.215,1703,6.308,1758,11.867,2679,10.284,2793,12.335,2794,12.335,2795,9.586,2796,11.29,2797,16.174,2798,13.865,2799,11.29]],["keywords/641",[]],["title/642",[1034,535.481,1322,394.828,2800,711.003]],["content/642",[3,1.992,50,3.957,106,3.792,118,5.509,143,7.343,150,5.132,152,3.956,157,5.953,182,4.378,228,6.502,235,8.266,258,3.727,271,6.363,428,6.841,438,5.049,512,4.481,626,6.635,638,9.189,701,8.827,703,7.658,901,4.435,935,6.954,1012,5.23,1034,8.585,1035,10.217,1036,6.841,1138,8.126,1156,7.204,1221,7.839,1284,6.127,1299,5.219,1636,5.407,1641,6.127,1643,6.449,1756,8.524,1757,7.204,1841,6.127,1846,8.794,1880,13.244,1882,8.04,1884,8.04,1885,8.04,1886,8.04,1887,6.54,1888,8.04,1889,8.04,2347,8.524,2785,5.854,2786,7.343,2801,9.643,2802,7.204,2803,9.643,2804,9.643,2805,9.643,2806,9.643,2807,6.954,2808,13.672,2809,9.643,2810,9.643]],["keywords/642",[]],["title/643",[1101,523.417,1322,394.828,2800,711.003]],["content/643",[3,1.813,18,1.873,98,8.302,106,2.8,438,8.235,512,4.437,669,5.157,948,13.903,1012,6.016,1101,9.653,1891,12.785,2795,12.222,2807,11.343,2811,14.395,2812,15.727,2813,15.727]],["keywords/643",[]],["title/644",[17,313.386,18,86.373,1322,335.742,2814,725.149]],["content/644",[11,1.797,16,1.785,17,1.655,18,1.508,20,7.537,55,4.466,56,2.03,58,2.183,79,3.457,98,3.476,106,3.618,115,3.511,116,2.209,131,2.377,145,1.887,149,2.933,150,2.038,157,1.435,160,4.185,161,3.193,182,1.739,185,2.597,204,2.573,237,4.003,238,4.12,241,1.598,253,3.386,259,2.377,260,2.602,318,5.386,330,2.562,332,8.818,339,3.025,350,4.926,396,3.154,416,1.834,430,3.627,434,1.86,436,2.898,438,5.386,449,1.353,456,2.99,458,3.667,459,4.299,460,3.198,464,6.028,465,3.65,470,1.571,473,2.81,488,4.088,499,2.188,503,1.944,510,3.031,511,3.176,512,1.858,518,4.466,519,2.762,520,2.022,528,2.495,548,2.635,549,2.81,656,2.527,687,2.193,695,1.86,715,3.221,717,2.148,732,2.635,778,2.209,818,5.717,873,3.386,882,2.148,893,3.65,905,4.236,918,2.717,949,2.527,958,3.166,965,2.717,966,2.717,967,4.926,968,3.113,976,9.007,1002,2.405,1012,1.465,1015,4.088,1035,2.464,1081,3.956,1106,1.989,1123,4.446,1127,2.527,1203,2.635,1204,1.762,1210,2.022,1274,2.038,1284,2.434,1304,3.029,1311,2.861,1322,6.274,1346,2.464,1366,4.531,1440,2.976,1445,2.675,1448,2.717,1449,3.476,1470,2.562,1477,2.762,1503,2.675,1514,2.253,1519,3.113,1539,2.976,1558,5.118,1586,2.81,1587,5.44,1632,2.675,1694,4.405,1710,2.562,1717,2.976,1759,2.597,1924,2.976,1930,3.386,1931,3.386,1943,3.386,1957,2.976,2133,2.231,2143,5.118,2151,3.386,2197,3.193,2198,2.861,2284,3.386,2345,2.3,2376,3.386,2451,2.81,2452,2.976,2603,3.113,2795,6.733,2802,7.685,2807,7.419,2815,3.386,2816,3.83,2817,6.586,2818,3.83,2819,3.83,2820,3.83,2821,3.83,2822,3.83,2823,3.83,2824,3.83,2825,3.83,2826,3.83,2827,3.83,2828,3.83,2829,3.83,2830,3.83,2831,3.83,2832,3.83,2833,3.83,2834,3.83,2835,3.042,2836,3.042,2837,3.042,2838,3.042,2839,3.042,2840,3.042,2841,3.042,2842,3.042,2843,3.83,2844,3.83,2845,3.283,2846,3.83,2847,3.83,2848,3.83,2849,6.586,2850,3.83,2851,3.83,2852,3.83,2853,3.83,2854,3.83,2855,3.83,2856,3.83,2857,3.83,2858,3.83,2859,6.586,2860,3.83,2861,6.586,2862,3.83,2863,6.586,2864,3.83,2865,6.028,2866,3.83,2867,6.586,2868,3.83,2869,3.83,2870,6.586,2871,3.83,2872,3.83,2873,3.83,2874,3.83,2875,3.83,2876,3.83,2877,3.83,2878,3.83,2879,3.83,2880,3.83,2881,3.83,2882,3.83,2883,6.586,2884,3.83,2885,3.83,2886,3.83,2887,3.83,2888,3.83,2889,3.83,2890,3.83,2891,3.83,2892,3.83,2893,3.83,2894,3.83,2895,3.283]],["keywords/644",[]],["title/645",[50,195.235,1322,394.828,2896,852.766]],["content/645",[5,2.668,11,2.448,16,2.432,17,2.255,18,1.865,20,4.146,46,3.134,50,3.162,55,7.35,56,2.632,58,2.413,82,2.71,98,2.754,106,3.648,115,2.587,149,2.891,157,1.955,193,3.315,238,1.385,242,3.01,245,5.183,259,3.239,260,1.567,273,2.369,285,3.399,293,8.574,319,2.384,325,2.354,327,4.206,364,3.91,396,5.19,426,2.848,436,2.296,438,6.557,442,6.502,470,3.503,491,5.075,508,2.75,510,1.825,512,1.472,513,2.874,514,4.925,544,5.492,687,2.743,695,2.534,715,5.301,717,2.926,762,2.481,796,2.481,882,2.926,890,3.07,896,2.589,958,4.577,1002,8.674,1015,3.239,1035,3.356,1082,2.777,1093,5.492,1106,2.71,1123,4.684,1204,3.927,1210,6.611,1272,5.492,1322,3.953,1395,5.128,1399,6.854,1442,3.763,1497,2.824,1514,3.07,1535,6.502,1539,4.055,1569,5.317,1574,3.898,1635,3.49,1694,5.711,1703,2.668,1719,3.134,1793,3.49,1821,6.727,1822,6.502,1916,6.941,1927,5.023,1964,5.183,1996,4.241,2001,4.241,2020,9.609,2071,4.241,2280,5.562,2361,3.973,2381,3.763,2382,4.612,2390,3.644,2403,4.612,2410,4.612,2419,4.612,2420,4.35,2498,4.241,2499,4.241,2507,6.941,2508,7.119,2509,4.241,2512,4.241,2520,4.241,2526,4.612,2527,4.612,2529,7.548,2534,4.612,2535,4.612,2542,4.612,2545,4.612,2802,8.096,2807,7.816,2815,4.612,2897,5.217,2898,5.217,2899,5.217,2900,5.217,2901,8.538,2902,5.217,2903,5.217,2904,5.217,2905,5.217,2906,4.612,2907,8.538,2908,5.217,2909,8.538,2910,5.217,2911,5.217,2912,5.217,2913,5.217,2914,5.217,2915,5.217,2916,5.217,2917,5.217,2918,5.217,2919,5.217,2920,5.217,2921,5.217,2922,5.217,2923,5.217,2924,5.217,2925,5.217]],["keywords/645",[]],["title/646",[45,231.913,95,263.974,118,487.186]],["content/646",[3,0.334,11,1.358,17,1.251,18,1.155,50,2.219,58,1.741,95,0.896,106,3.952,145,4.164,149,1.745,160,3.275,173,1.886,182,1.314,233,3.236,237,4.636,238,4.134,260,2.093,273,2.34,304,2.89,331,5.733,338,0.912,339,2.049,341,1.803,345,4.477,348,2.054,350,2.784,364,0.904,396,5.146,436,3.72,449,1.022,456,1.314,457,2.451,458,3.685,460,2.572,470,5.381,473,2.124,488,3.199,491,7.797,493,4.276,499,4.829,503,1.469,511,3.36,512,2.385,513,4.656,514,6.198,516,2.163,518,1.963,519,3.717,520,2.721,521,2.088,522,2.353,523,2.353,530,1.963,535,3.447,539,2.022,543,2.022,544,9.764,546,2.022,548,1.992,549,2.124,660,1.107,661,2.296,687,0.733,732,3.546,758,2.353,778,1.67,803,1.839,814,1.839,838,1.436,918,3.657,958,3.089,965,3.657,966,3.657,967,5.578,975,2.088,1068,3.563,1073,1.541,1093,1.862,1123,8.475,1204,2.371,1210,1.528,1322,2.386,1355,4.615,1362,2.299,1380,1.963,1399,1.436,1415,1.215,1447,3.357,1449,2.721,1525,3.199,1569,3.589,1586,3.782,1587,1.818,1713,2.124,1715,1.721,1719,6.454,1723,1.839,1729,2.054,1793,5.654,1822,3.925,1823,2.413,1927,1.703,1958,4.19,1977,2.054,2020,3.164,2133,8.589,2197,2.413,2198,2.163,2381,2.088,2383,2.353,2390,3.6,2439,2.299,2440,2.204,2448,8.015,2449,2.413,2450,2.413,2451,6.202,2452,4.005,2470,2.413,2471,2.413,2472,2.25,2473,2.413,2474,2.413,2475,4.297,2477,4.297,2478,2.413,2482,2.413,2483,2.413,2484,2.413,2485,2.413,2493,2.559,2494,2.559,2495,2.559,2496,2.559,2497,2.413,2498,4.19,2499,4.19,2500,4.556,2501,4.093,2502,2.559,2503,2.559,2504,2.559,2505,2.204,2506,2.559,2507,4.19,2508,4.297,2509,4.19,2510,2.559,2511,2.559,2512,2.353,2513,2.559,2514,2.204,2515,2.559,2516,2.559,2517,4.556,2518,2.559,2519,2.559,2520,2.353,2521,2.559,2522,2.559,2523,2.559,2524,2.559,2785,1.757,2786,2.204,2807,2.088,2835,2.299,2836,2.299,2837,2.299,2838,2.299,2839,2.299,2840,2.299,2841,2.299,2842,2.299,2906,2.559,2926,2.65,2927,2.65,2928,2.65,2929,2.65,2930,2.65,2931,2.65,2932,2.481,2933,2.895,2934,2.481,2935,2.65,2936,5.154,2937,2.65,2938,2.65,2939,2.65,2940,2.65,2941,2.895,2942,2.65,2943,2.895,2944,2.895]],["keywords/646",[]],["title/647",[1857,692.162,2945,947.258]],["content/647",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/647",[]],["title/648",[1081,621.593,1151,759.301]],["content/648",[2952,16.234,2953,16.234]],["keywords/648",[]],["title/649",[1158,722.84,1159,804.245]],["content/649",[]],["keywords/649",[]],["title/650",[345,307.098,449,301.208,3201,625.674]],["content/650",[1,9.923,57,7.977,58,2.022,72,6.357,95,4.716,149,5.157,382,5.797,400,8.963,449,7.027,508,4.906,715,7.451,1103,9.15,1227,6.664,1669,8.542,2295,10.809,3132,10.809,3201,11.177,3202,12.099]],["keywords/650",[]],["title/651",[449,365.537,508,333.282]],["content/651",[3,1.593,36,4.416,43,5.942,45,2.662,50,3.163,58,2.125,76,3.687,79,3.526,92,6.807,106,3.558,149,4.678,211,4.132,218,4.976,237,2.619,238,3.668,266,5.759,304,5.733,338,3.083,339,5.117,341,3.424,350,4.551,382,3.725,438,7.235,449,5.657,508,3.152,512,5.177,584,8.959,669,4.53,687,2.478,870,3.824,884,4.967,1012,3.744,1019,4.256,1101,6.008,1225,7.313,1297,8.161,1475,8.161,1632,6.837,1706,10.861,1723,6.22,1724,7.313,1750,8.391,1758,10.138,1976,8.161,3120,7.774,3201,7.182,3203,10.405,3204,15.381,3205,10.405,3206,10.405,3207,7.454,3208,14.689,3209,8.653,3210,9.327,3211,7.774]],["keywords/651",[]],["title/652",[508,333.282,3201,759.301]],["content/652",[27,8.462,126,10.002,149,5.84,188,7.026,218,4.909,323,5.688,417,9.672,449,6.685,460,5.032,508,5.556,693,9.672,901,6.27,902,8.769,1274,7.255,1299,9.337,1636,7.644,1669,11.154,2205,11.082,2295,12.239,2746,12.478,3132,12.239,3201,10.002,3202,10.826,3212,14.491,3213,14.491]],["keywords/652",[]],["title/653",[2295,734.248,3132,734.248]],["content/653",[4,2.6,11,1.633,18,1.429,20,1.69,22,1.178,24,6.396,43,2.113,50,0.797,56,3.697,58,1.592,62,1.868,63,2.65,75,2.16,79,2.055,80,4.462,82,1.808,106,3.841,121,3.48,124,2.829,133,2.469,145,1.715,149,4.626,156,12.123,174,3.566,185,4.111,218,1.253,237,2.579,238,2.138,273,2.753,305,2.343,319,1.59,324,1.884,325,2.735,338,1.096,339,2.369,345,3.934,350,1.146,363,1.808,370,2.007,374,2.983,385,2.185,392,2.829,397,1.9,413,2.069,436,5.279,449,6.287,458,3.049,480,3.2,493,2.136,508,1.952,511,3.884,535,2.328,585,2.705,649,1.444,650,2.395,654,1.247,660,4.179,663,1.78,687,1.535,688,2.395,740,2.902,746,6.259,762,3.83,803,6.123,937,3.48,963,2.297,967,3.857,1017,6.547,1074,2.297,1104,2.705,1105,2.553,1123,5.906,1152,6.017,1158,2.431,1159,2.705,1165,3.567,1185,2.51,1222,2.431,1272,2.239,1276,2.113,1299,1.884,1310,3.603,1311,2.6,1355,1.9,1358,2.705,1359,2.36,1416,3.149,1429,2.902,1442,2.51,1465,2.705,1619,5.197,1622,6.547,1638,2.902,1643,2.328,1669,9.841,1703,1.78,1782,7.07,1786,4.529,1794,1.988,1819,3.186,1933,5.054,1991,2.328,2192,2.267,2295,2.469,2514,4.616,2649,2.705,2651,3.186,2749,2.395,2795,2.705,2965,3.316,3112,2.764,3120,2.764,3132,14.056,3133,11.4,3140,2.902,3141,11.4,3202,6.396,3204,3.077,3207,7.338,3209,3.077,3210,3.316,3211,2.764,3214,6.444,3215,3.7,3216,5.359,3217,3.7,3218,6.444,3219,7.675,3220,3.316,3221,3.316,3222,3.316,3223,7.675,3224,9.183,3225,3.077,3226,8.519,3227,3.7,3228,3.077,3229,3.7,3230,3.316,3231,5.777,3232,3.7,3233,3.316,3234,3.316,3235,3.7,3236,3.316,3237,3.316,3238,3.316,3239,3.316,3240,3.7,3241,3.7,3242,3.7,3243,3.316,3244,3.316,3245,3.7,3246,3.316,3247,3.7,3248,5.777,3249,3.316,3250,3.316,3251,3.316,3252,5.777,3253,5.777,3254,3.316,3255,7.675,3256,7.675,3257,3.316,3258,3.316,3259,3.316,3260,5.777,3261,3.7,3262,3.316,3263,3.316,3264,3.316,3265,3.316,3266,3.316,3267,3.7,3268,3.316,3269,3.7,3270,3.7,3271,3.7,3272,3.7]],["keywords/653",[]],["title/654",[50,301.275]],["content/654",[1,4.916,3,1.317,8,3.762,20,7.464,50,3.977,58,1.002,72,4.766,76,2.843,92,3.718,106,3.815,123,10.455,149,3.867,152,5.654,174,5.058,176,4.396,211,4.822,234,4.44,238,2.003,266,4.44,273,3.427,324,6.183,364,4.304,413,4.486,449,6.373,508,2.43,512,2.129,513,4.156,514,4.353,596,4.486,669,3.745,695,3.665,746,5.865,1095,4.739,1097,5.747,1165,4.44,1216,5.638,1222,5.271,1387,4.581,1399,3.745,1569,3.204,1622,6.135,1669,7.728,1693,4.684,1719,4.533,1782,5.537,1785,5.993,1821,7.09,1836,11.814,1887,5.118,3112,10.946,3125,6.671,3132,11.714,3134,10.098,3135,10.098,3143,10.098,3201,5.537,3202,9.072,3207,5.747,3216,10.098,3226,6.671,3228,10.098,3273,6.292,3274,7.191,3275,7.191,3276,7.191,3277,7.191,3278,10.885,3279,14.646,3280,10.885,3281,10.885,3282,10.885,3283,7.191,3284,7.191,3285,7.191,3286,7.191,3287,7.191,3288,7.191,3289,8.022]],["keywords/654",[]],["title/655",[22,350.355,125,469.918]],["content/655",[8,6.359,31,9.95,58,2.175,364,5.118,449,5.789,569,13.017,596,9.742,1082,8.723,1165,9.643,3290,17.423]],["keywords/655",[]],["title/656",[45,281.443,173,674.112]],["content/656",[1,1.441,4,1.653,11,1.038,18,0.957,20,3.351,24,3.212,45,0.602,50,0.926,58,1.198,63,1.685,72,2.331,75,1.373,79,2.05,80,1.873,82,1.149,89,1.276,92,1.09,95,0.685,106,3.922,107,1.188,118,1.264,124,1.799,145,1.09,149,3.35,152,2.831,156,8.044,160,1.406,163,1.72,173,1.441,174,3.055,176,1.289,185,2.743,197,0.809,202,3.575,232,1.501,233,6.698,237,2.415,238,4.211,273,2.536,304,2.863,318,1.159,324,1.198,325,0.998,338,1.759,339,1.643,341,0.774,345,5.283,350,3.944,364,1.263,397,1.208,413,1.315,434,1.964,436,4.694,438,2.118,449,6.117,456,1.005,457,1.923,458,3.375,460,0.817,470,3.702,476,1.09,480,2.135,491,4.102,499,3.191,503,1.123,508,1.799,511,4.772,512,1.947,513,3.076,514,3.98,520,2.135,526,1.685,528,1.441,530,1.501,535,1.48,539,1.545,543,1.545,544,6.861,546,1.545,585,1.72,660,1.547,661,1.802,663,1.132,687,1.024,695,4.805,746,5.362,762,1.052,772,5.255,778,1.276,803,2.57,814,1.406,871,2.213,880,1.159,891,1.799,942,1.423,967,3.304,975,1.596,992,1.757,1017,4.541,1068,1.132,1073,1.178,1095,1.389,1123,6.34,1152,1.653,1158,1.545,1159,1.72,1165,2.379,1216,1.653,1227,0.968,1264,8.123,1272,1.423,1274,2.153,1355,1.208,1358,3.143,1359,1.501,1366,1.522,1387,2.455,1399,1.098,1415,1.697,1416,2.901,1447,1.441,1470,3.736,1569,0.939,1598,1.406,1619,3.467,1622,4.541,1629,2.025,1669,7.027,1670,1.845,1706,2.743,1715,1.315,1719,3.355,1723,1.406,1724,1.653,1725,1.72,1729,1.57,1782,5.895,1785,1.757,1821,2.51,1836,4.788,1841,2.57,1857,1.48,1904,1.956,1988,1.845,1991,1.48,2054,2.783,2133,7.3,2137,2.025,2180,1.845,2206,1.757,2448,6.808,2501,3.212,2505,1.685,2514,3.08,2543,2.025,2649,1.72,2749,1.522,2802,3.021,2934,1.897,2979,1.343,3112,5.48,3120,4.436,3125,1.956,3132,12.619,3133,7.978,3134,3.575,3135,3.575,3140,1.845,3141,4.938,3143,3.575,3201,5.063,3202,5.48,3204,1.956,3207,1.685,3209,1.956,3211,4.436,3216,3.575,3219,3.854,3220,2.109,3221,2.109,3222,2.109,3223,2.109,3224,5.323,3225,1.956,3226,4.938,3228,3.575,3230,2.109,3231,6.575,3233,2.109,3234,2.109,3236,2.109,3237,2.109,3238,2.109,3239,2.109,3243,2.109,3244,2.109,3246,2.109,3248,3.854,3249,2.109,3250,5.323,3251,3.854,3252,6.575,3253,5.323,3254,2.109,3255,5.323,3256,5.323,3257,2.109,3258,2.109,3259,2.109,3260,3.854,3262,2.109,3263,2.109,3264,2.109,3265,2.109,3266,2.109,3273,1.845,3274,2.109,3275,2.109,3276,2.109,3277,2.109,3278,3.854,3279,6.575,3280,3.854,3281,3.854,3282,3.854,3283,2.109,3284,2.109,3285,2.109,3286,2.109,3287,2.109,3288,2.109,3291,2.352,3292,2.352,3293,2.352,3294,2.352,3295,2.352,3296,2.352,3297,2.352,3298,2.352,3299,2.352,3300,2.352,3301,4.299,3302,4.299,3303,2.352,3304,2.352,3305,2.352,3306,5.938,3307,2.352,3308,2.352,3309,2.352,3310,2.352,3311,2.352,3312,2.352,3313,2.352,3314,2.352,3315,2.352,3316,2.352,3317,2.352,3318,2.352]],["keywords/656",[]],["title/657",[12,288.256,18,75.13,258,243.803,364,196.957,760,260.224]],["content/657",[]],["keywords/657",[]],["title/658",[18,156.743]],["content/658",[18,1.554,58,0.916,106,3.861,110,2.983,113,9.932,150,6.942,152,2.832,179,3.02,218,2.486,237,4.245,238,2.833,239,3.477,260,5.568,266,6.278,304,6.958,305,4.124,338,4.622,339,4.665,341,2.415,345,3.843,456,6.663,459,3.426,476,3.401,509,7.523,510,4.563,511,6.29,512,4.14,654,2.474,660,4.082,778,8.464,796,5.075,803,4.387,838,3.426,962,6.578,963,4.556,1061,4.441,1103,4.146,1210,3.644,1244,12.328,1385,7.237,1415,2.897,1439,7.674,1447,4.497,1452,5.612,1470,11.695,1477,4.979,1501,4.556,1536,5.365,1627,4.556,1715,4.103,2054,4.75,2076,4.682,2085,6.103,2094,11.53,2548,6.903,2549,6.103,2550,6.903,2551,6.103,2552,9.433,2553,9.433,2554,6.903,2555,6.903,2556,10.67,2557,10.67,2558,6.903,2559,6.903,2560,6.903,2561,6.903,2562,6.903,2563,6.903,2564,6.903,2565,6.903,2566,6.103,2567,6.103,2749,7.342]],["keywords/658",[]],["title/659",[18,123.267,364,323.151]],["content/659",[3,0.877,8,5.457,18,1.649,22,2.575,31,4.617,56,3.541,58,1.525,106,3.803,115,2.304,119,4.304,152,4.714,176,6.693,187,8.147,204,4.488,208,4.265,209,3.617,211,4.85,241,3.174,258,2.94,260,2.285,266,4.475,288,4.521,342,4.668,364,4.324,458,3.635,512,3.907,596,4.521,660,2.909,669,2.494,718,4.568,850,12.242,1002,12.2,1012,2.909,1123,4.966,1132,8.695,1133,6.976,1135,7.582,1137,14.357,1138,4.521,1140,8.584,1143,6.52,1144,5.682,1553,4.43,1764,5.792,1793,5.087,2549,6.724,2568,10.517,2569,10.517,2570,6.962,2571,6.962,2572,6.962,2573,6.52,2574,6.962,2575,6.962,2576,6.962,2577,6.962,2578,7.606,2579,11.49,2580,9.58,2581,7.606,2582,7.606,2583,7.606,2584,7.606,2585,7.606,2586,7.606,2587,7.606,2588,7.606,2589,7.606,2590,7.606,2591,6.962,2592,7.606,2593,7.606,2594,7.606,2595,7.606,2596,7.606,2597,7.606]],["keywords/659",[]],["title/660",[654,370.874,1501,682.927]],["content/660",[12,4.429,18,1.154,56,2.987,58,1.286,62,5.201,101,5.291,106,3.083,107,8.548,118,9.896,150,5.158,152,6.534,204,6.222,241,4.044,260,2.911,303,6.572,305,3.746,382,3.688,412,10.245,453,6.989,456,6.23,654,6.207,686,8.87,699,8.072,719,7.24,760,3.998,778,5.59,793,8.307,794,7.696,796,6.525,799,6.989,838,6.809,906,8.307,1065,4.213,1387,5.883,1501,11.43,1535,12.129,1536,7.531,1540,8.567,1550,7.878,1553,5.645,1568,5.59,1671,5.883,1857,11.585,2552,8.567,2553,8.567,2566,8.567,2567,8.567,2598,9.691,2599,9.691,2601,15.312,2603,7.878,2604,8.567,2605,9.691,2606,9.691,2607,9.691,2608,8.567,3096,10.302,3097,10.302,3098,10.302,3099,10.302,3100,10.302]],["keywords/660",[]],["title/661",[12,472.947,760,426.953]],["content/661",[11,1.555,12,5.741,18,0.395,58,1.029,69,3.158,106,3.943,107,4.999,113,8.066,118,4.43,152,4.345,188,6.874,191,1.991,204,5.906,211,1.399,237,1.554,238,3.335,239,1.669,241,1.383,260,4.917,273,4.809,278,5.535,303,2.248,304,3.864,305,4.506,319,1.515,331,6.316,332,4.979,339,1.708,350,3.84,361,2.524,385,2.081,412,4.988,451,2.39,456,4.809,499,1.893,511,2.801,512,3.544,520,1.749,669,1.087,695,1.609,699,10.594,702,2.841,732,7.288,750,2.93,760,1.367,767,6.303,778,6.725,793,2.841,794,2.632,796,5.037,799,2.39,803,2.106,838,4.622,870,1.295,906,2.841,917,5.535,918,4.121,940,2.93,965,4.121,975,2.39,1015,2.057,1065,2.525,1130,2.217,1134,5.793,1161,2.248,1244,9.763,1286,5.535,1340,7.765,1503,2.315,1510,2.524,1513,2.187,1519,2.694,1550,4.722,1553,6.791,1558,2.575,1627,2.187,1710,8.921,1785,2.632,1811,2.28,1857,8.921,2054,3.997,2076,5.259,2143,2.575,2210,4.339,2212,2.93,2278,2.248,2394,4.843,2406,8.233,2551,2.93,2580,2.763,2601,10.306,2603,2.694,2604,2.93,2608,2.93,2609,3.033,2610,3.314,2611,3.314,2612,3.314,2613,3.033,2614,3.314,2615,3.314,2616,3.314,2617,3.314,2618,3.314,2619,3.314,2620,3.314,2621,5.809,2622,3.314,2623,9.314,2624,3.314,2625,7.754,2626,3.314,2627,5.809,2628,5.809,2629,5.809,2630,3.314,2631,3.314,2632,3.314,2633,3.314,2634,3.314,2635,3.314,2636,3.314,2637,3.314,2638,3.314,2640,7.754,2641,5.809,2642,3.314,2643,3.314,2644,5.809,2645,3.314,2646,3.314,2647,3.314,2648,5.317,2649,2.575,2650,3.314,2651,7.097,2652,3.314,2653,5.809,2654,3.314,2655,5.809,2656,3.314,2658,3.314,2659,3.314,2660,3.314,2661,3.314,2662,3.314,2663,3.314,2664,3.033,2665,3.314,2666,3.314,2667,3.314,2668,3.314,2669,3.314,2670,3.314,2671,3.314,2672,5.809,2673,3.314,2674,3.314,2675,5.809,2676,3.314,2677,3.314,2678,3.314,2679,2.763,2680,3.314,2681,3.314,2682,3.314,2683,3.033,2684,3.314,2685,3.314,2686,3.314,2687,3.314,2688,3.314,2689,3.314,2690,3.314,2691,3.314,2692,3.314,2693,3.314,3101,3.523,3102,3.523]],["keywords/661",[]],["title/662",[1627,682.927,2303,841.289]],["content/662",[]],["keywords/662",[]],["title/663",[157,387.826,416,495.593]],["content/663",[3,1.77,58,2.038,61,9.877,79,3.918,87,9.322,110,6.636,157,5.754,204,5.998,260,4.612,293,9.531,510,5.372,654,5.503,876,10.002,958,5.612,1152,11.471,1409,9.322,2304,13.574,2431,15.355,2432,15.355]],["keywords/663",[]],["title/664",[45,357.876]],["content/664",[65,9.323,79,3.605,95,4.373,157,5.294,202,12.489,305,5.461,382,5.376,449,4.99,509,8.149,512,3.985,513,7.781,654,5.063,772,10.758,778,8.149,796,6.719,900,11.779,914,13.462,957,13.462,1065,6.142,1103,8.485,1156,10.554,1284,8.977,1501,9.323,2191,9.867,2206,11.219,2433,14.127,2434,14.127,2435,14.127,2436,14.127,2437,14.127]],["keywords/664",[]],["title/665",[79,264.052,318,541.885]],["content/665",[3,1.329,7,5.521,56,3.554,58,2.475,80,5.338,106,3.107,128,9.613,145,5.68,160,7.326,204,6.817,237,3.086,241,4.811,260,3.463,305,4.457,339,3.391,396,5.521,436,6.807,456,7.925,458,3.648,473,8.459,510,4.034,512,4.363,513,6.35,514,6.651,516,8.614,518,7.82,519,11.155,551,10.987,870,4.504,944,8.78,967,5.521,1157,7.077,1415,4.839,1449,6.086,1465,8.96,1477,8.315,1480,7.326,1525,9.601,1587,7.24,1703,5.896,1713,8.459,2080,10.193,2438,8.78,2439,9.157,2440,8.78,2441,9.613,2442,9.884,2443,11.53]],["keywords/665",[]],["title/666",[778,759.051]],["content/666",[3,0.853,5,3.786,45,2.013,58,1.494,79,2.872,106,3.82,177,5.753,237,5.163,238,4.577,241,3.089,245,4.494,304,6.315,328,4.951,338,2.332,339,2.177,341,5.325,345,4.054,350,5.013,396,5.391,434,3.595,449,2.615,457,3.521,458,2.342,459,3.674,476,3.647,488,6.988,499,4.229,511,6.569,512,2.088,513,4.077,514,4.27,520,5.942,521,5.339,522,6.018,523,6.018,526,5.637,527,7.054,660,2.832,661,3.298,687,3.448,693,7.987,739,2.803,778,4.27,880,3.876,926,5.021,967,3.545,1123,7.452,1276,4.494,1310,4.4,1355,4.042,1467,4.885,1598,4.704,1627,4.885,1669,7.638,1719,4.446,1723,4.704,1724,5.531,1725,5.753,1729,5.252,2064,5.753,2105,6.544,2133,4.312,2303,6.018,2345,4.446,2438,5.637,2444,7.403,2445,7.403,2446,7.403,2447,7.403,2448,5.094,2449,9.386,2450,6.172,2451,5.432,2452,5.753,2457,7.403,2458,7.403,2459,7.403,2460,7.403,2461,7.403,2462,11.257,2463,7.403,2464,7.403,2465,7.403,2466,7.403,2713,6.346,2769,6.776,3319,7.87,3320,7.87,3321,7.87,3322,7.87]],["keywords/666",[]],["title/667",[161,1097.182]],["content/667",[7,2.807,20,2.847,24,4.656,45,2.552,89,3.382,106,3.902,107,3.146,149,1.985,152,2.405,157,2.197,160,5.962,171,4.228,193,3.725,218,2.111,237,4.832,238,4.362,260,3.524,270,4.159,321,3.725,338,1.847,339,1.724,341,3.283,345,5.282,350,3.864,396,4.493,436,5.901,457,2.788,458,3.712,460,2.164,470,7.222,491,8.718,503,2.975,508,3.022,511,5.657,528,3.819,529,5.587,530,3.976,535,3.921,539,4.095,543,4.095,544,12.269,546,4.095,548,4.034,549,4.301,552,3.229,687,1.484,688,4.034,803,3.725,876,3.819,949,3.869,967,2.807,1123,8.697,1156,4.38,1355,6.404,1710,3.921,2133,10.744,2345,3.521,2438,4.464,2448,10.092,2451,4.301,2467,5.366,2468,5.863,2469,5.863,2470,4.888,2471,4.888,2472,4.556,2473,4.888,2474,4.888,2475,7.823,2476,5.863,2477,4.888,2478,4.888,2479,11.731,2480,5.366,2481,5.863,2482,4.888,2483,4.888,2484,4.888,2485,4.888,2486,5.863,2487,5.366,2488,9.383,2489,5.863,2490,5.863,2491,5.863,2492,5.863,2979,3.559]],["keywords/667",[]],["title/668",[50,301.275]],["content/668",[18,1.341,50,3.118,58,0.982,106,3.96,145,4.724,149,3.247,160,2.791,164,3.223,233,6.022,237,1.175,238,3.615,260,2.223,273,5.11,293,2.726,319,2.007,323,1.833,331,7.633,350,1.447,364,1.372,396,6.016,436,4.22,449,3.387,460,1.621,470,5.587,491,8.612,493,5.886,499,2.509,510,1.537,512,2.088,513,4.076,514,6.492,520,2.319,544,8.76,660,1.68,661,3.297,717,2.463,732,5.092,758,3.571,778,2.534,803,2.791,814,2.791,838,2.18,958,3.505,967,6.938,1028,4.186,1068,2.246,1073,2.338,1093,6.169,1123,6.844,1204,3.404,1299,2.377,1322,3.426,1380,2.979,1399,2.18,1447,2.861,1569,5.782,1719,4.445,1793,9.109,1822,3.345,1850,3.883,1927,2.584,1958,3.571,1977,3.116,1996,3.571,2020,4.542,2257,3.662,2280,2.861,2361,3.345,2381,6.916,2383,3.571,2390,7.861,2438,3.345,2472,3.413,2493,3.883,2494,3.883,2495,3.883,2496,3.883,2497,3.662,2498,6.016,2499,6.016,2500,8.478,2501,5.877,2502,3.883,2503,3.883,2504,3.883,2505,3.345,2506,3.883,2507,10.213,2508,10.475,2509,7.796,2510,3.883,2511,3.883,2512,7.796,2513,3.883,2514,5.636,2515,3.883,2516,3.883,2517,9.949,2518,6.542,2519,3.883,2520,6.016,2521,3.883,2522,3.883,2523,3.883,2524,3.883,2525,4.392,2526,6.542,2527,9.949,2528,4.392,2529,11.106,2530,4.392,2531,4.392,2532,4.392,2533,4.392,2534,6.542,2535,6.542,2536,4.392,2537,7.401,2538,4.392,2539,4.02,2540,4.392,2541,4.392,2542,3.883,2543,4.02,2544,4.392,2545,3.883,2546,4.392]],["keywords/668",[]],["title/669",[22,350.355,125,469.918]],["content/669",[79,4.182,179,7.169,218,5.902,396,7.849,870,6.402,891,13.324,1106,8.514,1627,10.816,2278,11.116,2303,13.324,2547,16.39]],["keywords/669",[]],["title/670",[1716,1002.099]],["content/670",[]],["keywords/670",[]],["title/671",[45,357.876]],["content/671",[65,10.549,79,4.854,149,5.412,396,7.655,470,8.332,663,8.175,1669,8.964,2750,15.986,2751,15.986,2752,15.986,2753,15.986]],["keywords/671",[]],["title/672",[79,264.052,318,541.885]],["content/672",[56,4.172,58,2.504,60,5.649,76,5.099,79,4.813,106,3.057,115,4.101,218,4.875,237,3.623,318,7.088,338,4.264,339,3.981,396,8.225,397,7.39,654,4.851,739,6.502,1106,8.921,1174,11.604,1449,7.146,1500,10.309,1711,11.967,1712,11.967,1716,13.079,1717,10.52,1718,11.967,2754,11.967,2755,13.537]],["keywords/672",[]],["title/673",[1706,892.464]],["content/673",[16,2.955,19,4.078,29,3.588,56,3.078,58,1.325,61,4.078,79,1.618,106,3.845,237,5.203,238,5.161,241,2.646,304,5.814,324,3.432,338,1.997,341,2.218,345,5.83,350,5.58,364,1.98,378,4.573,385,3.981,396,3.036,406,3.555,430,3.492,457,3.016,458,3.908,459,3.146,470,5.067,476,3.124,487,5.035,491,7.342,511,6.757,512,1.789,513,5.499,514,5.76,520,5.271,526,4.828,528,4.13,530,4.3,539,4.429,543,4.429,544,7.945,546,4.429,661,2.825,1106,5.187,1123,7.586,1217,3.892,1222,4.429,1274,3.375,1297,5.287,1355,3.462,1480,4.029,1547,5.154,1566,4.184,1668,4.652,1669,3.555,1706,4.3,1713,4.652,1716,4.828,1719,5.998,1720,5.605,1721,5.605,1723,4.029,1724,4.737,1725,4.927,1727,5.154,1728,4.573,1729,4.499,1731,5.605,2133,10.519,2258,5.605,2441,5.287,2448,9.642,2754,5.605,2756,6.341,2757,6.341,2758,6.341,2759,6.341,2760,6.341,2761,6.341,2762,6.341,2763,6.341,2764,6.341,2765,5.435,2766,6.341,2767,6.341,2768,6.341,2769,5.804,2770,6.341,2771,6.341,2772,5.804,2773,6.341,2774,6.341,2775,6.341,2776,6.341,2777,6.341]],["keywords/673",[]],["title/674",[2427,1163.321]],["content/674",[3,1.677,17,6.288,18,1.733,19,9.359,36,6.565,50,3.331,56,4.485,65,9.602,78,11.555,79,3.712,139,11.555,155,12.131,157,5.453,221,10.163,416,6.968,618,13.865,635,12.863,718,8.739,949,9.602,1469,11.08,1521,11.307,1887,9.868,2278,9.868,2778,14.55,2779,14.55,2780,13.318]],["keywords/674",[]],["title/675",[1106,683.567]],["content/675",[]],["keywords/675",[]],["title/676",[157,387.826,416,495.593]],["content/676",[3,1.703,50,4.152,61,9.501,79,3.769,87,8.968,110,6.384,157,5.536,260,4.437,293,9.169,305,5.709,460,5.453,958,5.399,1027,7.734,1152,11.035,1204,6.794,2304,13.058,2305,14.771,2306,14.771,2307,14.771,2308,14.771,2309,14.771,2310,14.771,2311,14.771]],["keywords/676",[]],["title/677",[45,357.876]],["content/677",[45,4.048,79,3.798,110,6.433,115,5.52,149,5.039,174,6.591,182,6.759,470,7.475,508,4.793,660,5.694,661,6.632,663,9.318,687,4.613,739,5.635,1272,9.574,1369,10.241,2280,9.695,2312,14.884,2313,14.884]],["keywords/677",[]],["title/678",[79,264.052,739,391.804]],["content/678",[3,1.291,19,7.203,48,9.336,56,3.451,57,5.863,58,2.013,79,3.869,101,6.113,106,3.281,115,3.392,182,5.085,237,2.997,260,3.364,330,7.489,339,4.46,380,7.705,470,4.594,510,5.305,608,9.599,739,5.741,760,4.62,778,6.459,870,4.374,904,7.945,958,5.542,1027,5.863,1106,7.877,1204,5.151,1276,6.798,1304,6.976,1312,6.951,1346,7.203,1382,7.705,1411,6.726,1415,6.364,1449,5.911,1480,7.115,1497,6.061,1501,7.389,1587,9.523,1794,6.397,2148,8.702,2314,8.527,2315,15.201,2316,11.198,2317,11.198,2318,10.25,2319,11.198,2320,9.899,2321,10.25,2322,11.198]],["keywords/678",[]],["title/679",[79,264.052,1210,546.292]],["content/679",[3,0.891,43,4.691,62,4.147,72,4.852,79,2.967,98,4.079,106,3.614,110,3.339,115,4.235,149,2.616,152,3.17,182,5.28,197,2.824,198,4.91,218,2.782,237,4.464,238,2.051,241,4.852,260,2.321,293,4.796,325,5.246,327,5.728,328,5.168,338,2.434,339,4.112,341,4.068,345,2.782,357,5.884,364,2.413,397,4.218,458,3.679,459,3.834,460,5.161,470,7.677,476,3.806,488,4.796,499,6.643,503,7.095,654,2.769,660,6.704,687,3.539,717,4.333,718,4.641,739,4.402,762,3.675,958,2.824,1105,5.669,1106,6.04,1175,6.136,1210,4.079,1272,4.97,1304,3.554,1382,5.316,1408,6.83,1617,6.83,1668,5.669,1728,8.386,1786,5.772,1794,4.414,2246,6.281,2255,7.072,2281,6.83,2314,5.884,2315,10.279,2324,7.727,2325,7.727,2326,7.727,2327,6.83,2328,11.365,2329,6.83,2334,7.727,2335,7.727,2336,7.727,2337,7.727,2340,7.727,2341,7.727,2345,6.984,2349,7.727,2350,6.83,2713,6.623,2715,6.623,2979,7.059,3324,8.214,3325,8.214,3326,8.214,3327,8.214,3328,8.214,3329,8.214,3330,8.214]],["keywords/679",[]],["title/680",[157,387.826,508,333.282]],["content/680",[12,5.1,18,0.872,19,4.708,56,2.256,58,1.795,72,3.054,79,1.868,106,3.799,107,3.928,115,3.381,118,4.182,149,3.778,152,3.003,237,4.049,238,3.591,260,2.199,325,3.302,338,2.306,341,2.561,345,2.636,348,7.918,350,4.455,356,9.305,397,3.996,413,4.35,454,5.813,457,3.481,458,4.28,460,4.993,470,6.207,487,5.813,488,4.543,499,4.182,503,5.664,508,4.356,510,3.904,552,4.031,572,6.975,652,5.459,654,2.623,661,3.261,663,5.707,678,4.263,687,4.124,695,5.42,739,2.771,760,3.02,901,3.367,1077,6.274,1106,3.802,1204,3.367,1217,4.492,1322,5.167,1514,4.306,1528,5.193,1547,5.95,1600,6.928,1703,3.743,1727,5.95,1728,9.755,1841,4.651,2070,5.813,2133,6.501,2280,4.768,2314,5.574,2327,6.47,2328,5.95,2329,6.47,2351,7.319,2352,7.319,2353,7.319,2354,7.319,2355,7.319,2356,7.319,2357,7.319,2358,7.319,2359,7.319,2360,7.319,2361,5.574,2362,7.319,2363,7.319,2364,11.16,2365,7.319,2366,7.319,2367,6.47,2368,9.567,2369,7.319,2370,6.47,2371,7.319,2372,7.319,2373,7.319,2374,7.319,2375,11.16,2376,6.47,2377,7.319,2378,7.319,2979,4.444]],["keywords/680",[]],["title/681",[50,301.275]],["content/681",[3,0.485,5,2.154,11,1.976,12,1.925,16,1.963,18,1.919,22,1.426,50,3.564,54,2.614,56,1.298,58,1.885,60,2.98,72,3.88,76,1.586,79,2.373,80,1.95,82,2.188,92,3.519,106,3.555,115,4.717,119,2.384,152,1.728,169,1.95,174,5.9,180,4.336,191,4.29,197,1.539,199,4.013,218,1.517,238,3.255,241,4.571,245,4.336,260,1.265,263,4.013,273,3.243,293,4.433,303,2.856,323,2.98,325,3.223,327,3.519,338,1.327,350,2.352,364,1.315,412,2.709,430,2.319,436,1.853,438,3.74,457,2.003,458,3.88,460,4.043,470,6.804,499,2.406,508,1.356,510,1.473,512,1.188,580,1.865,589,3.511,611,4.013,639,2.942,649,1.747,661,4.143,687,3.941,695,4.516,715,2.06,717,2.362,739,3.521,775,4.013,814,2.676,884,3.625,896,2.09,901,4.277,958,3.399,968,3.424,1019,1.831,1065,1.831,1068,2.154,1073,2.242,1077,3.61,1081,5.586,1082,2.242,1093,2.709,1106,4.831,1130,7.326,1156,5.336,1160,4.013,1204,1.937,1210,3.77,1217,2.585,1225,3.146,1227,4.068,1272,2.709,1274,3.801,1276,2.557,1299,2.28,1304,1.937,1368,5.672,1369,2.898,1382,2.898,1399,3.544,1445,2.942,1467,2.779,1569,6.343,1600,2.614,1625,3.207,1627,2.779,1628,3.723,1636,2.362,1668,3.09,1703,3.652,1728,8.843,1786,3.146,1793,9.498,1804,6.314,1821,4.433,1872,3.511,1904,3.723,1924,3.273,1926,3.723,1927,2.478,1964,2.557,2020,9.556,2246,3.424,2247,3.511,2277,3.723,2280,2.743,2297,3.723,2314,3.207,2328,5.806,2342,3.855,2361,3.207,2367,3.723,2370,3.723,2379,10.953,2380,7.142,2381,5.151,2382,3.723,2383,3.424,2384,4.212,2385,7.142,2386,7.142,2387,7.593,2388,7.142,2389,4.212,2390,4.989,2391,4.212,2392,7.142,2393,4.212,2394,3.511,2395,4.212,2396,4.212,2397,4.212,2398,4.212,2399,4.212,2400,4.212,2401,4.212,2402,4.212,2403,3.723,2404,3.855,2405,4.212,2406,3.723,2407,4.212,2408,4.212,2409,4.212,2410,3.723,2411,4.212,2412,4.212,2413,4.212,2414,4.212,2415,4.212,2416,3.855,2417,4.212,2418,4.212,2419,3.723,2420,3.511,2421,4.212,2422,4.212,2423,4.212,2424,4.212,2425,4.212,2426,4.212]],["keywords/681",[]],["title/682",[2427,1163.321]],["content/682",[18,2.212,50,3.515,58,2.038,76,5.783,79,3.918,85,10.413,364,4.795,382,5.843,678,8.944,739,5.813,776,6.841,1095,9.642,1103,9.222,1106,7.976,1175,12.194,2428,15.355,2429,15.355,2430,14.054]],["keywords/682",[]],["title/683",[22,350.355,125,469.918]],["content/683",[22,5.844,82,8.967,396,8.267,508,5.56,678,10.056]],["keywords/683",[]],["title/684",[650,712.065,3332,759.301]],["content/684",[]],["keywords/684",[]],["title/685",[18,101.574,3332,625.674,3333,753.863]],["content/685",[18,1.72,72,6.026,80,6.687,149,4.889,157,5.412,434,7.014,470,5.925,958,5.278,1059,12.38,1065,6.279,1158,10.087,1312,8.965,1466,10.087,1508,10.087,2505,10.998,3085,12.041,3332,10.596,3334,15.811,3335,15.352,3336,15.352,3337,15.352,3338,15.352,3339,12.767,3340,15.352,3341,15.352,3342,15.352]],["keywords/685",[]],["title/686",[36,466.935,1793,692.162]],["content/686",[3,2.255,36,6.614,58,1.946,149,6.911,449,5.178,512,4.136,669,5.919,870,7.051,1074,9.674,1131,6.878,1158,10.239,1758,13.244,2287,13.418,3085,12.223,3332,10.756,3333,12.96,3343,13.97]],["keywords/686",[]],["title/687",[18,123.267,508,333.282]],["content/687",[3,0.581,18,1.68,45,0.768,50,1.9,56,0.87,58,1.524,79,2.118,92,1.391,98,1.49,106,3.863,134,6.92,145,1.391,149,2.312,160,1.794,173,1.839,179,1.235,197,1.842,214,2.242,215,5.797,218,1.815,237,3.904,238,2.809,241,1.178,243,5.477,245,1.714,260,1.514,273,2.289,293,3.129,304,3.955,305,2.639,318,1.478,319,2.304,321,1.794,338,1.588,339,2.803,341,0.988,345,3.433,350,1.66,357,3.838,364,0.882,373,1.644,413,1.678,426,3.728,430,1.555,436,1.242,449,3.737,456,2.289,457,1.343,458,2.626,460,3.064,470,4.34,476,1.391,503,4.212,508,0.909,510,1.763,516,5.101,528,1.839,535,1.888,650,1.943,654,1.012,660,1.08,682,1.972,687,2.907,718,1.696,739,1.069,905,1.816,958,3.484,961,2.003,967,4.565,975,2.036,1002,1.773,1025,6.591,1054,1.598,1065,1.227,1075,1.943,1093,5.339,1106,3.547,1180,3.242,1203,1.943,1204,3.818,1210,1.49,1244,7.408,1304,1.299,1310,2.996,1322,1.307,1351,2.194,1352,1.915,1366,3.468,1399,1.401,1442,2.036,1448,2.003,1470,1.888,1481,4.321,1491,5.477,1497,1.528,1508,3.521,1569,2.899,1600,1.752,1623,2.194,1669,2.826,1710,1.888,1715,1.678,1717,2.194,1758,3.698,1794,3.901,1810,3.917,1821,3.129,1927,1.661,1977,2.003,2021,2.354,2042,2.42,2156,4.614,2191,1.972,2192,1.839,2205,2.295,2247,2.354,2280,3.283,2345,3.027,2390,1.972,2394,4.203,2441,2.354,2648,2.584,2749,3.468,2765,2.42,2895,2.42,2979,1.714,3113,2.69,3207,2.15,3211,2.242,3273,2.354,3332,12.44,3334,7.337,3339,2.496,3343,2.69,3344,3.001,3345,3.001,3346,3.001,3347,3.001,3348,3.001,3349,3.001,3350,3.001,3351,3.001,3352,3.001,3353,9.084,3354,7.258,3355,7.258,3356,7.258,3357,9.084,3358,8.823,3359,10.082,3360,8.823,3361,13.901,3362,3.001,3363,3.001,3364,3.001,3365,3.001,3366,3.001,3367,3.001,3368,3.001,3369,3.001,3370,3.001,3371,3.001,3372,3.001,3373,7.909,3374,6.507,3375,3.001,3376,5.358,3377,3.001,3378,3.001,3379,3.001,3380,3.001,3381,3.001,3382,3.001,3383,3.001,3384,7.909,3385,2.69,3386,2.69,3387,7.258,3388,3.001,3389,3.001,3390,3.001,3391,3.001,3392,3.001,3393,3.001,3394,3.001,3395,3.001,3396,5.358,3397,3.001,3398,2.69,3399,2.69,3400,3.001,3401,3.001,3402,5.358,3403,3.001,3404,2.69,3405,3.001,3406,5.358,3407,7.258,3408,3.001,3409,3.001,3410,2.69,3411,2.69,3412,3.001,3413,3.001,3414,3.001,3415,3.001,3416,3.001,3417,3.001,3418,3.001,3419,3.001,3420,3.001,3421,3.001,3422,3.001,3423,3.001,3424,3.001,3425,2.69,3426,3.001,3427,6.507,3428,3.001,3429,3.001,3430,3.001,3431,3.001,3432,5.358,3433,6.507,3434,5.358,3435,3.001,3436,3.001,3437,2.69,3438,3.001,3439,3.001,3440,4.803,3441,2.69,3442,2.69,3443,2.354,3444,3.001,3445,5.358,3446,2.69,3447,2.69,3448,5.358,3449,7.258,3450,2.69,3451,5.358,3452,3.001,3453,2.69,3454,3.001,3455,3.001,3456,3.001,3457,3.001,3458,3.001,3459,3.001,3460,3.001,3461,3.001,3462,3.001,3463,3.001,3464,3.001,3465,3.001,3466,2.69,3467,3.001,3468,2.69,3469,3.001]],["keywords/687",[]],["title/688",[2895,1128.04]],["content/688",[3,0.84,16,1.428,18,1.742,20,5.842,29,1.734,50,1.241,56,2.246,58,1.791,79,0.782,106,3.855,115,1.642,119,1.734,134,4.519,149,3.766,152,1.257,160,5.596,171,2.209,179,2.371,197,1.981,235,2.626,237,3.771,238,3.741,243,2.022,260,2.189,270,2.173,273,2.461,288,1.821,304,1.271,305,2.817,319,2.477,338,2.296,339,1.594,341,1.896,342,1.88,345,4.006,350,2.901,357,4.127,373,3.157,381,2.708,406,1.718,417,2.173,430,2.985,436,1.348,449,1.082,457,5.291,458,4.627,460,3.715,470,2.99,480,1.617,503,2.751,516,2.289,528,1.995,660,1.172,669,1.777,672,2.919,687,3.045,739,2.052,819,2.381,870,2.847,884,1.555,950,5.257,958,1.12,967,4.82,1075,6.06,1082,1.63,1093,3.486,1131,1.437,1161,3.676,1173,2.49,1180,3.486,1203,12.528,1204,1.409,1238,2.919,1244,4.212,1247,2.381,1272,1.971,1322,1.418,1351,2.381,1352,2.078,1355,1.672,1366,3.729,1377,4.212,1387,4.425,1395,3.255,1399,1.52,1415,1.286,1419,2.333,1442,2.209,1448,2.173,1481,2.626,1491,4.81,1569,3.095,1597,1.718,1623,2.381,1648,2.433,1669,3.039,1710,3.625,1715,1.821,1810,4.212,1821,3.364,1841,3.444,1927,1.802,1977,2.173,1986,2.108,2037,2.49,2042,2.626,2192,3.53,2206,5.789,2251,2.804,2254,2.804,2260,2.804,2274,2.804,2318,2.804,2330,3.063,2344,3.063,2390,2.14,2420,2.554,2765,2.626,2772,2.804,2932,2.626,2970,4.304,2979,3.29,3207,2.333,3211,2.433,3273,2.554,3332,12.163,3333,7.786,3334,7.786,3339,2.708,3353,8.393,3357,2.919,3359,5.165,3361,12.207,3373,2.919,3374,2.919,3384,2.919,3385,2.919,3386,2.919,3398,5.165,3399,2.919,3404,2.919,3410,2.919,3411,2.919,3425,2.919,3427,8.393,3433,8.393,3437,2.919,3440,5.165,3441,2.919,3442,2.919,3443,6.077,3446,2.919,3447,2.919,3450,2.919,3453,2.919,3466,2.919,3470,3.257,3471,7.748,3472,3.257,3473,3.257,3474,3.257,3475,3.257,3476,3.257,3477,7.748,3478,3.257,3479,3.257,3480,2.919,3481,9.362,3482,7.748,3483,3.257,3484,3.257,3485,5.762,3486,7.748,3487,3.257,3488,3.257,3489,3.257,3490,3.257,3491,3.257,3492,3.257,3493,3.257,3494,3.257,3495,5.762,3496,3.257,3497,3.257,3498,3.257,3499,3.257,3500,3.257,3501,3.257,3502,5.762,3503,3.257,3504,3.257,3505,3.257,3506,3.257,3507,5.165,3508,3.257,3509,3.257,3510,3.257,3511,3.257,3512,3.257,3513,3.257,3514,3.257,3515,3.257,3516,3.257,3517,3.257,3518,3.257,3519,3.257,3520,3.257,3521,3.257,3522,3.257,3523,3.257,3524,3.257,3525,3.257,3526,5.762,3527,5.762,3528,5.762,3529,5.762,3530,3.257,3531,3.257,3532,3.257,3533,3.257,3534,3.257,3535,3.257]],["keywords/688",[]],["title/689",[853,965.506]],["content/689",[3,1.703,18,1.759,57,7.734,58,1.96,79,3.769,82,7.673,115,4.475,157,5.536,322,11.479,460,5.453,614,11.035,650,10.163,678,8.604,687,3.739,870,5.77,958,5.399,1054,8.36,1158,10.317,1312,9.169,1428,10.48,1732,13.52,2278,10.018,3085,12.316,3332,10.838]],["keywords/689",[]],["title/690",[2302,868.391]],["content/690",[]],["keywords/690",[]],["title/691",[45,357.876]],["content/691",[18,1.858,48,13.008,79,3.981,92,7.686,319,7.13,600,11.069,649,6.473,687,3.949,739,5.906,760,8.292,1299,8.444,1606,10.897,2694,10.734,2695,15.601,2696,15.601]],["keywords/691",[]],["title/692",[460,382.009,958,378.226]],["content/692",[3,1.387,58,2.111,82,6.249,106,3.736,174,7.045,179,5.262,237,5.279,318,6.299,337,8.277,339,4.679,458,5.64,460,5.873,503,6.105,715,5.884,739,4.554,958,5.815,1380,8.158,1449,6.35,2345,9.556,2346,11.463,2694,10.947,2697,15.91,2698,15.91,2699,12.029,2700,12.933,2701,12.029,2702,8.676,2703,12.029,2704,12.029,2979,7.303,3075,9.16]],["keywords/692",[]],["title/693",[79,264.052,318,541.885]],["content/693",[18,1.733,57,7.619,58,1.931,79,3.712,106,3.624,237,3.894,339,4.279,480,7.681,510,5.09,654,5.214,1027,7.619,1415,6.106,1587,9.137,1986,10.011,1991,9.731,2191,10.163,2302,9.602,2320,12.863,2694,12.363,2700,11.828,2702,10.494,2705,12.863]],["keywords/693",[]],["title/694",[319,472.947,600,734.248]],["content/694",[12,4.661,18,2.298,20,4.953,45,2.774,79,2.602,106,3.771,218,3.673,237,4.382,238,4.347,260,3.064,319,6.499,338,3.213,341,4.976,350,3.359,380,7.018,480,5.384,600,7.236,649,5.901,661,4.544,687,3.6,760,6.756,880,5.34,901,4.691,1061,6.56,1175,8.1,1217,6.26,1313,8.743,1415,4.28,1532,9.016,1600,6.331,1606,7.124,1846,6.56,2271,9.016,2302,6.73,2339,9.719,2350,9.016,2694,11.267,2702,7.356,2705,12.573,2706,10.199,2707,10.199,2708,10.199,2709,14.222,2710,10.199,2711,10.199,2712,10.199,2713,8.743,2714,10.199,2715,8.743,2716,10.199,2717,10.199,2718,10.199,2719,10.199]],["keywords/694",[]],["title/695",[1165,774.227]],["content/695",[18,1.415,43,7.214,79,3.032,106,3.809,141,9.437,174,6.988,237,4.223,238,4.189,341,4.157,345,5.683,687,3.008,718,9.478,760,7.31,762,5.651,949,7.841,958,4.343,992,9.437,1204,5.466,1322,5.501,1355,8.615,1625,9.048,2302,7.841,2694,12.191,2700,14.403,2702,8.57,2720,11.882,2721,10.504,2722,11.882,2723,11.882,2724,11.882,2725,10.504,2726,11.882,2727,11.882,2728,11.882,2729,11.882]],["keywords/695",[]],["title/696",[1186,615.129,2302,682.927]],["content/696",[18,2.05,19,5.353,50,3.345,57,4.357,58,2.284,63,6.337,76,3.135,79,3.136,80,3.853,106,3.874,115,3.723,152,5.042,198,5.288,218,2.997,237,4.606,238,4.569,260,3.691,273,3.779,323,3.472,338,3.871,339,2.447,341,2.911,345,5.262,350,2.741,485,7.617,486,9.99,508,2.68,687,2.107,715,4.07,760,3.433,814,5.288,838,4.13,942,5.353,1027,4.357,1068,4.256,1073,4.429,1093,5.353,1186,8.685,1191,6.337,1199,7.93,1201,7.617,1202,7.93,1385,5.644,1395,7.381,1398,5.288,1399,4.13,1415,3.492,1782,6.106,1964,5.052,2302,5.492,2694,5.726,2702,6.002,2721,7.357,2725,7.357,2730,8.322,2731,14.611,2732,8.322,2733,8.322,2734,8.322,2735,8.322,2736,8.322,2737,8.322,2738,8.322,2739,8.322,2740,8.322,2741,8.322,2742,8.322,2743,8.322,2744,8.322,2745,8.322,2746,11.248,2747,8.322]],["keywords/696",[]],["title/697",[58,113.175,457,405.573,1593,637.091]],["content/697",[]],["keywords/697",[]],["title/698",[18,156.743]],["content/698",[11,2.89,18,1.79,45,3.75,58,1.609,95,1.907,106,3.945,107,3.306,118,3.519,145,4.808,152,2.527,174,2.728,221,4.302,233,3.868,237,5.167,238,3.99,243,7.999,260,1.85,285,4.012,319,2.815,338,1.94,339,3.565,341,2.155,345,4.365,350,3.214,445,4.892,449,3.447,456,2.797,457,4.642,458,5.498,460,4.474,476,3.035,503,3.126,518,6.619,548,4.238,649,2.556,661,2.745,678,3.588,695,4.74,760,2.541,890,3.624,958,5.04,1123,6.91,1204,2.833,1322,2.852,1352,4.178,1353,5.638,1354,5.638,1355,3.363,1356,5.136,1357,8.933,1358,4.787,1359,8.22,1360,5.638,1362,4.892,1363,5.638,1364,5.638,1365,5.638,1378,10.951,1380,4.178,1407,11.209,1415,2.585,1449,3.252,1491,9.099,1567,4.065,2037,5.007,2133,3.588,2345,5.862,2979,3.74,3225,5.445,3480,5.87,3536,10.715,3537,6.548,3538,6.548,3539,6.548,3540,9.3,3541,10.375,3542,6.548,3543,6.548,3544,6.548,3545,6.548,3546,6.548,3547,12.885,3548,12.885,3549,6.548,3550,6.548,3551,6.548,3552,6.548]],["keywords/698",[]],["title/699",[1132,826.325]],["content/699",[3,1.047,8,2.991,16,1.901,18,1.896,29,2.308,45,2.47,50,1.591,56,1.257,58,1.738,98,2.153,106,3.918,109,3.239,110,1.763,115,2.751,145,5.929,150,3.699,152,3.726,157,3.404,180,2.476,182,1.852,187,2.4,204,2.715,209,3.306,211,3.834,215,2.849,228,4.319,238,1.083,239,2.054,243,5.993,258,2.687,273,1.852,285,2.657,287,2.942,288,4.131,301,7.87,331,6.159,350,1.343,361,5.293,363,5.572,364,4.599,373,7.01,413,2.425,428,2.894,430,2.246,436,1.795,445,3.239,449,1.441,457,4.319,512,2.562,596,2.425,649,4.451,660,1.56,669,2.279,682,10.286,701,3.862,763,2.33,776,1.817,850,8.029,901,3.197,902,4.471,1012,1.56,1019,1.773,1029,2.592,1034,2.561,1035,4.471,1065,1.773,1082,4.834,1131,1.914,1133,4.22,1135,4.587,1138,4.131,1216,9.786,1243,3.316,1265,4.079,1274,3.699,1276,5.514,1283,2.942,1378,7.213,1407,8.72,1418,3.734,1491,2.692,1497,2.208,1553,4.049,1559,3.734,1563,3.734,1569,2.951,1593,5.193,1641,2.592,1643,2.728,1707,3.734,1710,2.728,1757,3.047,1764,3.106,1773,2.942,1809,3.401,1811,6.249,1845,3.497,1846,4.471,1848,3.497,1851,7.785,1927,2.4,1964,2.476,2191,2.849,2272,3.497,2321,3.734,2381,2.942,2467,3.734,2497,3.401,2568,6.362,2569,8.313,2570,3.734,2571,3.734,2572,6.362,2573,3.497,2574,3.734,2575,3.734,2576,3.734,2577,3.734,2580,3.401,2591,3.734,2609,3.734,3075,3.106,3140,5.795,3159,6.623,3160,3.887,3168,3.887,3268,3.887,3443,7.572,3536,3.606,3540,3.887,3553,4.336,3554,4.336,3555,4.336,3556,4.336,3557,4.336,3558,4.336,3559,4.336,3560,4.336,3561,4.336,3562,4.336,3563,4.336,3564,4.336,3565,4.336,3566,4.336,3567,4.336,3568,7.389,3569,9.655,3570,4.336,3571,4.336,3572,4.336,3573,4.336,3574,4.336,3575,4.336,3576,7.389,3577,4.336,3578,4.336,3579,4.336,3580,4.336,3581,4.336,3582,4.336,3583,4.336,3584,7.389,3585,9.655,3586,4.336,3587,7.389,3588,4.336,3589,7.389,3590,4.336,3591,3.887,3592,4.336,3593,4.336,3600,6.951]],["keywords/699",[]],["title/700",[853,965.506]],["content/700",[3,1.518,5,8.63,16,7.866,18,1.569,45,3.582,58,2.24,89,7.597,115,3.99,187,7.749,209,6.264,324,7.128,363,6.841,364,4.112,373,7.671,449,4.652,678,7.671,687,3.334,723,10.706,776,5.868,864,8.084,1054,7.454,1082,7.01,1225,9.839,1236,13.17,1368,10.459,1407,10.706,1597,7.385,1603,9.663,2007,12.055,3536,11.643,3591,12.55,3594,17.94,3595,14,3596,14,3597,14,3598,14]],["keywords/700",[]],["title/701",[3,98.292,6,469.66,7,408.376]],["content/701",[]],["keywords/701",[]],["title/702",[3601,1398.897]],["content/702",[3,1.797,5,5.967,6,10.321,7,8.408,8,3.843,17,6.738,18,1.857,65,10.288,95,3.612,100,9.485,149,3.95,175,8.028,182,5.298,204,4.558,239,5.877,370,6.73,377,11.668,378,8.415,404,10.315,416,7.466,580,5.167,596,6.936,620,8.885,626,8.028,640,11.119,678,6.797,715,5.707,864,7.162,873,10.315,874,11.668,896,5.79,902,7.505,992,9.267,1019,5.073,1411,7.008,1412,10.68,1428,8.279,1574,8.717,1671,7.084,1954,9.267,1973,8.717,2811,10.68,3602,12.404,3603,12.404,3604,12.404,3605,12.404,3606,11.119,3607,12.404,3608,11.119]],["keywords/702",[]],["title/703",[2147,1045.084]],["content/703",[3,1.873,5,8.312,17,7.024,18,1.936,97,12.631,101,8.873,170,14.368,175,11.183,1065,7.066,1428,11.531,3609,17.278,3610,17.278]],["keywords/703",[]],["title/704",[2,986.166,1105,759.301]],["content/704",[3,1.871,7,4.037,17,3.643,18,1.934,45,4.004,56,3.824,57,4.414,58,1.119,79,3.756,92,4.153,95,2.61,106,3.418,163,6.551,179,5.427,197,3.081,204,3.293,218,3.036,237,3.94,238,3.294,260,2.532,304,5.148,305,4.796,322,6.551,324,4.563,328,5.638,338,4.637,339,4.775,341,2.949,345,3.036,348,5.981,350,2.777,382,3.208,409,8.108,459,6.157,472,12.894,476,4.153,508,2.715,660,3.225,661,3.756,667,6.695,687,3.727,693,5.981,739,5.573,760,6.074,870,3.293,896,4.183,901,3.878,970,7.452,1027,4.414,1065,3.665,1210,6.549,1276,7.532,1304,3.878,1310,7.374,1370,6.185,1411,5.063,1415,3.538,1417,6.42,1525,5.233,1786,6.298,2046,7.716,2613,7.716,2715,7.226,3074,6.185,3611,8.033,3612,18.395,3613,4.91,3614,15.65,3615,8.962,3616,8.962,3617,8.033,3618,8.962,3619,7.452]],["keywords/704",[]],["title/705",[409,399.375,654,259.871,760,299.166,1444,563.534]],["content/705",[]],["keywords/705",[]],["title/706",[510,362.059,796,492.192]],["content/706",[3,1.727,7,2.931,18,0.729,58,2.218,106,3.755,115,1.854,119,5.496,152,2.511,174,2.71,183,5.411,185,4.151,204,2.391,208,3.432,237,4.267,238,3.978,243,4.039,253,15.327,260,4.127,266,3.601,305,3.754,338,3.059,339,1.8,341,2.141,342,5.96,345,2.204,350,4.526,409,3.371,426,3.342,458,5.288,476,3.015,480,3.231,488,3.799,510,6.401,511,6.626,512,1.727,520,5.126,699,7.102,746,4.757,838,3.037,896,3.037,901,4.467,912,7.125,961,4.343,1019,2.661,1060,3.844,1165,3.601,1227,2.677,1415,2.569,1448,4.343,1468,6.408,1503,4.275,1513,4.039,1715,3.638,1764,4.661,1811,4.212,1887,4.151,1991,6.495,2070,4.861,2092,8.889,2256,4.861,2439,4.861,2440,7.395,2951,4.757,2970,7.712,3613,3.565,3617,5.833,3620,6.507,3621,6.507,3622,6.507,3623,8.585,3624,5.833,3625,6.507,3626,10.323,3627,12.832,3628,6.507,3629,6.507,3630,10.323,3631,12.832,3632,6.507,3633,10.323,3634,12.832,3635,6.507,3636,6.507,3637,6.507,3638,6.507,3639,6.507,3640,6.507,3641,6.507,3642,6.507,3643,6.507,3644,6.507,3645,6.507,3646,6.507,3647,6.507,3648,6.507,3649,6.507,3650,6.507,3651,6.507,3652,6.507,3653,6.507,3654,6.507,3655,6.507,3656,6.507,3657,6.507,3658,6.507,3659,6.507,3660,6.507,3661,6.507,3662,6.507,3663,6.507,3664,6.507,3665,5.833]],["keywords/706",[]],["title/707",[900,862.854,3666,986.166]],["content/707",[3,1.276,7,5.301,58,2.269,106,3.415,131,6.872,188,5.705,208,6.208,237,4.575,260,4.52,331,11.594,338,4.74,339,3.256,341,3.873,409,6.097,458,4.761,459,5.494,460,4.086,510,5.264,511,7.256,660,4.235,688,7.617,739,4.191,857,7.732,900,14.253,1272,7.121,1312,6.872,1387,10.378,1439,6.513,2182,10.133,2205,8.999,2210,8.271,2442,9.49,3613,6.448,3666,18.279,3667,11.768,3668,10.549,3669,11.768,3670,11.768,3671,11.768,3672,11.768,3673,15.112,3674,11.768,3675,8.792]],["keywords/707",[]],["title/708",[409,724.753]],["content/708",[3,1.463,7,4.163,18,1.036,58,2.326,79,2.218,106,3.697,119,7.182,141,6.905,169,6.939,183,7.686,185,5.896,237,4.01,238,3.369,305,4.905,318,4.552,338,3.997,339,2.557,341,3.042,342,7.789,345,3.131,409,11.533,426,6.928,434,6.163,476,4.283,493,5.336,510,3.042,552,4.788,620,6.621,687,3.794,717,4.875,760,6.183,882,4.875,896,4.314,926,5.896,1019,3.78,1165,5.115,1227,3.803,1355,4.746,1358,6.756,1415,3.649,1417,6.621,1447,5.663,1468,10.873,1525,5.397,1569,5.388,1578,13.717,1715,5.168,1764,12.547,1794,4.967,2440,6.621,2845,7.453,2951,6.756,3613,5.064,3665,8.285,3668,8.285,3676,7.686,3677,9.242,3678,9.242,3679,9.242,3680,9.242,3681,9.242,3682,7.686]],["keywords/708",[]],["title/709",[456,469.918,1513,682.927]],["content/709",[0,3.502,3,0.62,7,2.575,12,2.457,27,3.337,58,1.862,72,2.243,80,2.489,106,3.863,107,4.696,118,4.999,180,3.264,186,5.376,208,3.015,237,5.066,238,4.773,260,3.323,273,5.024,305,3.382,324,2.91,338,4.738,339,3.254,341,3.871,345,5.952,350,3.644,400,3.163,412,3.458,421,5.376,456,3.973,458,5.017,473,3.945,476,2.649,479,6.799,480,4.619,499,4.999,510,1.881,511,7.253,518,3.646,520,5.84,667,6.949,695,2.611,767,4.37,796,4.161,799,3.877,803,5.56,833,5.376,838,2.668,851,5.376,936,3.877,1027,2.815,1151,6.419,1303,5.376,1310,3.196,1340,7.295,1346,3.458,1415,3.672,1416,2.793,1419,4.094,1447,3.502,1497,2.91,1513,10.906,1536,4.178,1703,4.474,1802,4.27,1857,5.852,1887,3.646,2053,4.921,2054,8.772,2070,4.27,2075,4.27,2076,3.646,2257,4.482,3074,3.945,3468,5.123,3613,5.096,3624,5.123,3683,9.301,3684,9.301,3685,5.715,3686,14.333,3687,5.715,3688,5.715,3689,5.715,3690,9.301,3691,5.715,3692,8.337,3693,9.301,3694,5.715,3695,5.715,3696,5.715,3697,9.301,3698,5.715,3699,8.337,3700,5.123,3701,5.715,3702,5.715,3703,5.715,3704,5.715,3705,8.337,3706,5.715,3707,9.301,3708,5.715,3709,9.301,3710,5.715,3711,5.715,3712,5.715,3713,5.715,3714,5.123,3715,5.715,3716,5.715,3717,5.123]],["keywords/709",[]],["title/710",[510,362.059,1439,608.874]],["content/710",[3,1.061,18,1.096,58,2.431,106,3.893,173,5.996,237,4.994,238,4.492,240,5.588,260,3.468,271,3.778,304,4.79,338,4.166,339,4.262,341,3.22,345,5.575,348,4.061,350,3.032,382,3.503,409,3.153,412,7.426,479,4.449,480,3.022,503,8.588,510,3.22,660,4.416,667,7.31,687,2.33,739,4.371,752,5.724,760,2.362,838,5.729,870,3.596,901,6.666,1025,11.509,1164,7.01,1304,5.31,1371,5.24,1404,4.546,1415,2.402,1416,7.528,1417,4.359,1439,5.416,1440,4.449,1513,6.074,1514,3.368,1575,4.2,1590,8.426,1703,2.927,1846,3.682,2749,9.1,3074,6.754,3613,5.362,3676,12.812,3717,8.772,3718,6.085,3719,6.085,3720,6.085,3721,6.085,3722,6.085,3723,6.085,3724,6.085,3725,6.085,3726,6.085,3727,6.085,3728,6.085,3729,6.085,3730,16.456,3731,6.085,3732,9.785,3733,11.002,3734,6.085,3735,6.085,3736,6.085,3737,9.785,3738,12.273,3739,6.085,3740,9.785,3741,6.085,3742,9.785,3743,6.085]],["keywords/710",[]],["title/711",[796,492.192,1759,701.858]],["content/711",[3,1.617,7,6.716,305,6.788,330,9.38,434,6.811,456,6.369,552,7.724,586,14.025,654,6.871,716,11.694,739,5.31,796,9.842,1082,7.465,1276,8.515,1329,11.694,1415,5.886,1416,7.285,1759,13.004,1767,12.838,3623,12.399,3744,13.365,3745,12.399]],["keywords/711",[]],["title/712",[687,333.132]],["content/712",[3,1.321,11,7.228,18,1.835,58,1.521,95,3.548,106,3.696,119,6.487,237,3.067,238,4.09,341,5.39,342,7.035,345,5.548,396,5.489,491,10.343,493,7.035,530,7.773,687,4.71,739,4.339,760,4.729,880,6.002,958,4.189,967,8.333,1123,7.52,1127,10.166,1161,10.448,1180,7.373,1204,5.272,1468,7.564,1599,14.101,2133,10.136,2448,10.6,2845,9.825,3746,12.184,3747,12.184,3748,12.184]],["keywords/712",[]],["title/713",[694,914.868,1059,887.122]],["content/713",[3,1.182,5,5.243,12,6.523,18,1.221,56,3.16,58,1.361,106,3.703,115,3.106,193,6.515,237,4.394,238,3.789,241,4.278,271,6.766,323,4.278,338,4.496,339,3.015,341,3.587,345,3.692,350,4.701,442,7.808,597,7.968,687,4.726,694,12.619,739,3.882,760,6.775,838,9.263,870,4.005,901,4.716,975,7.394,1059,12.236,1180,10.563,1299,5.55,1311,10.664,1385,6.953,1445,7.161,1467,6.766,1928,9.385,1986,7.055,2192,6.679,2649,7.968,3613,5.972,3745,9.064,3749,15.174,3750,9.064,3751,10.899,3752,13.602,3753,10.899,3754,10.899,3755,15.174]],["keywords/713",[]],["title/714",[1180,846.462]],["content/714",[3,1.025,6,4.898,8,2.929,45,3.508,58,1.712,95,2.753,106,3.742,115,3.908,126,6.525,152,5.292,169,4.117,182,5.858,185,6.031,198,5.651,209,4.229,237,3.452,238,4.03,239,4.479,338,4.064,339,2.615,341,3.111,345,5.467,350,4.249,460,3.283,649,3.69,652,4.35,655,5.584,664,7.861,687,4.816,739,3.367,838,6.402,948,7.861,1161,6.031,1165,5.232,1180,5.72,1304,4.09,1312,5.52,1359,8.749,1379,8.14,1385,6.031,1468,5.868,1703,4.548,1790,7.229,1986,6.119,1991,5.948,2252,8.14,2442,7.623,2539,8.14,3507,15.869,3608,8.474,3613,5.18,3675,7.062,3745,7.861,3750,7.861,3756,13.714,3757,9.453,3758,9.453,3759,9.453,3760,9.453,3761,9.453,3762,9.453,3763,9.453,3764,9.453,3765,9.453,3766,9.453,3767,9.453,3768,9.453,3769,9.453,3770,9.453,3771,9.453,3772,9.453,3773,8.474,3774,9.453,3775,9.453]],["keywords/714",[]],["title/715",[2978,1253.981]],["content/715",[4,10.478,18,2.092,115,5.321,174,6.21,237,4.7,338,4.418,341,6.144,409,7.724,434,6.811,687,4.854,739,5.31,760,5.786,880,9.196,1467,9.255,1470,9.38,1601,15.987,3613,8.17,3682,15.526,3776,14.909,3777,14.909,3778,14.909]],["keywords/715",[]],["title/716",[1054,744.754]],["content/716",[3,1.227,7,5.098,58,1.944,106,3.87,237,5.233,238,5.023,338,4.615,339,3.131,341,3.725,345,3.834,373,6.201,458,4.635,470,4.367,476,5.245,687,4.241,739,5.547,1054,9.48,1123,6.332,1304,4.897,1352,9.936,1396,8.876,1415,4.468,1491,7.025,1623,8.273,1715,6.328,2037,8.654,2191,7.436,2192,9.543,2514,11.157,2970,8.455,3613,6.201,3673,9.411,3779,11.317,3780,11.317,3781,11.317,3782,11.317,3783,11.317,3784,11.317,3785,11.317,3786,9.411]],["keywords/716",[]],["title/717",[728,1204.507]],["content/717",[3,1.665,7,6.916,18,1.72,106,2.571,115,6.152,131,8.965,241,6.026,271,9.53,434,7.014,458,4.569,627,10.087,687,5.141,699,8.497,728,13.219,876,9.407,1857,9.659,2295,10.247,3744,13.762,3787,15.352,3788,15.352,3789,15.352]],["keywords/717",[]],["title/718",[958,378.226,1283,746.37]],["content/718",[3,1.797,7,4.463,8,3.069,12,4.259,58,2.259,106,3.743,131,5.785,157,3.492,187,5.483,228,4.432,237,4.171,238,2.474,304,3.867,325,4.205,327,4.591,338,4.203,339,5.511,341,3.26,382,3.546,458,4.222,472,12.379,493,9.567,510,4.668,687,2.359,739,3.528,884,4.729,890,5.483,958,7.213,963,6.15,1157,5.72,1204,6.138,1283,9.623,1304,4.287,1310,5.539,1366,6.412,1411,5.597,1439,5.483,1467,6.15,1569,3.957,1573,8.53,1810,10.37,2345,9.362,2416,8.53,2957,9.319,3074,6.837,3611,12.715,3613,5.428,3623,8.238,3790,9.907,3791,9.907,3792,14.185,3793,9.907,3794,9.907,3795,9.907,3796,9.907,3797,9.907]],["keywords/718",[]],["title/719",[460,382.009,1597,580.309]],["content/719",[3,1.111,7,4.618,8,3.176,42,9.189,58,2.108,60,4.024,72,4.024,98,5.09,106,3.816,107,5.175,145,6.735,152,3.956,232,6.54,237,4.625,238,3.63,293,5.985,325,4.351,327,4.75,338,4.307,339,2.836,341,3.374,345,3.473,460,7.35,472,7.658,503,4.894,510,4.783,511,4.65,535,9.144,548,6.635,649,5.672,687,4.375,715,6.687,739,3.651,1304,4.435,1439,5.673,1491,9.022,1597,5.407,1600,8.487,1606,6.735,1623,7.494,2979,8.3,3074,7.075,3613,5.617,3619,8.524,3798,10.251,3799,10.251,3800,10.251,3801,10.251,3802,10.251,3803,10.251,3804,9.189,3805,14.534,3806,10.251,3807,10.251]],["keywords/719",[]],["title/720",[932,780.553,1500,649.387,3808,906.523]],["content/720",[3,1.302,5,4.588,6,4.941,7,6.218,18,2.114,45,3.073,58,1.5,60,2.314,72,4.715,78,4.404,87,3.366,100,4.508,106,3.817,115,1.68,126,4.068,131,3.442,146,7.095,148,4.753,155,4.623,175,3.815,180,3.366,218,1.997,234,8.389,237,4.95,238,4.05,266,3.262,288,7.717,304,6.33,324,3.001,338,5.827,339,4.918,341,5.338,350,5.025,382,3.414,405,4.753,509,5.175,580,2.455,613,5.545,715,2.712,739,2.099,859,4.404,882,3.109,890,6.648,896,4.452,902,3.567,932,15.812,941,7.931,942,3.567,944,6.832,945,5.545,949,3.659,1019,2.411,1027,2.903,1065,2.411,1103,3.33,1227,2.425,1376,5.075,1468,5.92,1470,3.709,1500,9.887,1507,5.075,1508,3.873,1521,4.309,1528,6.365,1703,2.836,1709,4.623,1802,4.404,1954,4.404,2093,5.075,2430,5.075,2573,7.69,2649,4.309,2865,8.212,3074,4.068,3613,3.23,3675,4.404,3809,9.537,3810,5.894,3811,9.537,3812,16.219,3813,5.894,3814,12.011,3815,5.894,3816,5.894,3817,12.011,3818,9.537,3819,5.894,3820,5.894,3821,9.537,3822,5.894,3823,5.894,3824,5.894,3825,5.894,3826,5.894,3827,5.894]],["keywords/720",[]],["title/721",[83,862.854,907,773.156]],["content/721",[3,0.615,7,4.162,18,1.511,45,1.45,58,1.854,79,2.807,83,11.649,106,3.909,107,5.904,115,2.633,152,2.187,157,1.998,213,4.234,237,2.944,238,3.709,260,1.602,273,5.761,305,2.061,324,2.886,338,3.996,339,2.556,341,3.849,345,3.962,350,3.623,409,4.786,412,5.59,436,2.347,451,3.845,460,1.968,503,2.706,508,2.799,510,4.438,511,6.738,535,3.566,554,7.955,626,3.669,627,3.724,652,2.608,660,2.04,687,4,692,4.88,715,2.608,739,3.29,746,4.144,758,4.334,760,2.2,882,6.169,890,3.137,896,2.646,1009,5.332,1019,2.318,1068,4.444,1310,5.166,1366,3.669,1415,2.238,1447,3.473,1448,3.783,1513,5.735,1514,7.464,1528,3.783,1569,2.264,1648,4.234,1715,3.169,1773,3.845,1841,3.388,2054,3.669,2075,6.902,2076,3.616,2192,3.473,2796,4.88,2802,11.194,2979,3.237,3122,5.081,3443,4.446,3613,3.106,3619,7.683,3673,7.683,3682,4.714,3692,8.282,3699,10.483,3705,8.282,3714,5.081,3733,5.081,3750,13.968,3752,13.314,3786,4.714,3828,9.239,3829,5.668,3830,14.852,3831,5.668,3832,11.694,3833,5.668,3834,5.668,3835,5.668,3836,11.694,3837,5.668,3838,5.668,3839,5.668,3840,5.668,3841,5.668,3842,5.668,3843,11.694,3844,5.668,3845,5.668,3846,5.668,3847,5.668,3848,5.668,3849,5.668,3850,5.668,3851,5.668,3852,5.668,3853,5.668,3854,5.668,3855,5.668]],["keywords/721",[]],["title/722",[687,215.878,2192,555.478,3856,812.614]],["content/722",[3,1.508,7,6.265,18,2.211,115,5.624,126,9.598,373,7.62,508,4.213,612,8.872,687,5.339,739,4.953,796,7.992,1304,6.017,1349,11.974,1352,8.872,1703,6.69,2191,9.137,2192,13.507,3675,10.389,3786,16.411,3856,17.69,3857,13.906]],["keywords/722",[]],["title/723",[3858,1398.897]],["content/723",[]],["keywords/723",[]],["title/724",[1553,766.522]],["content/724",[3,1.301,7,3.559,18,0.885,58,1.812,60,3.101,106,3.791,129,7.431,146,4.666,177,11.851,179,3.25,204,2.903,237,4.389,238,3.625,273,3.374,304,4.684,319,3.396,324,4.022,338,4.804,339,3.32,341,3.95,345,2.676,350,3.719,454,5.902,458,3.572,476,3.661,480,3.923,508,2.393,511,5.444,520,3.923,661,3.311,687,3.456,695,3.609,699,6.642,750,6.569,796,5.369,896,3.688,940,6.569,1366,7.768,1415,3.119,1431,6.802,1448,5.272,1513,4.904,1553,9.553,1569,4.793,1715,4.417,2210,8.435,2664,6.802,2780,10.334,3613,4.329,3676,6.569,3686,7.081,3700,7.081,3859,7.9,3860,12.002,3861,7.9,3862,7.9,3863,7.9,3864,7.9,3865,7.9,3866,12.002,3867,7.9,3868,7.9,3869,7.9,3870,7.9,3871,7.9,3872,7.9,3873,7.9,3874,7.9,3875,7.9,3876,7.9,3877,7.9,3878,7.9,3879,7.9,3880,7.9,3881,7.9,3882,7.9,3883,7.9,3884,7.9,3885,7.9,3886,7.9,3887,7.9,3888,7.9,3889,7.9,3890,7.9,3891,7.9,3892,7.9,3893,7.9,3894,7.9,3895,7.9,3896,7.9,3897,7.9,3898,7.9,3899,7.9,3900,7.9,3901,7.9,3902,7.9,3903,7.9,3904,7.9,3905,7.9]],["keywords/724",[]],["title/725",[1368,821.883,3906,986.166]],["content/725",[3,0.88,6,6.347,7,5.519,18,0.909,45,3.775,58,1.842,95,3.567,106,3.848,115,4.205,126,5.602,157,2.861,175,5.254,188,8.993,237,4.441,238,3.685,338,4.87,339,3.389,341,4.032,345,2.75,350,5.092,356,9.608,357,5.814,382,2.906,436,5.072,458,3.646,460,5.124,476,3.762,503,3.875,510,4.856,637,5.814,649,5.759,687,1.933,715,5.637,818,9.16,882,4.282,896,3.789,961,5.417,968,11.284,1298,6.207,1351,8.956,1380,7.816,1415,3.204,1567,5.039,1597,8.67,1600,4.74,1929,6.989,2209,7.635,2280,4.974,2970,6.064,3613,4.448,3675,6.064,3773,7.276,3804,7.276,3906,7.276,3907,12.251,3908,8.117,3909,8.117,3910,8.117,3911,8.117,3912,8.117,3913,8.117,3914,12.251,3915,8.117,3916,12.251,3917,8.117,3918,8.117,3919,8.117,3920,14.756,3921,8.117,3922,8.117,3923,8.117,3924,8.117]],["keywords/725",[]],["title/726",[853,965.506]],["content/726",[3,2.22,6,6.167,7,5.362,8,3.688,12,5.117,17,4.839,18,1.806,20,5.438,45,3.045,56,3.451,78,8.893,82,5.817,90,8.076,95,3.466,101,6.113,104,7.489,110,4.839,157,4.196,169,5.185,221,7.821,223,6.523,228,5.326,239,5.64,259,6.951,382,5.771,391,8.893,396,5.362,416,8.235,447,10.671,460,4.133,508,3.606,597,8.702,630,10.25,632,9.336,635,9.899,661,4.989,678,6.523,857,7.821,864,9.308,896,5.557,899,11.198,905,7.203,1019,4.868,1219,9.336,1320,11.198,1409,9.207,1411,6.726,1426,10.25,1500,8.527,1574,8.366,1597,6.279,1635,7.489,1773,8.076,3606,10.671,3925,11.904,3926,11.904]],["keywords/726",[]]],"invertedIndex":[["",{"_index":106,"title":{"40":{"position":[[5,1]]},"49":{"position":[[5,1]]}},"content":{"2":{"position":[[300,1]]},"6":{"position":[[257,2]]},"8":{"position":[[169,1],[254,1],[256,2],[306,1],[321,2],[372,1],[387,2],[455,2],[460,2],[465,2],[470,1],[508,1],[510,2],[587,1],[671,1]]},"9":{"position":[[115,1],[117,2],[149,1],[166,1],[172,2],[250,1],[371,1],[470,2],[638,2],[687,1],[755,2],[809,1],[813,1],[829,1],[921,2],[980,3],[1015,2],[1153,2],[1156,2],[1216,1],[1330,2],[1384,1],[1489,2],[1550,1],[1653,1]]},"10":{"position":[[52,1],[384,2],[447,1],[518,1],[590,1],[639,2],[735,1],[769,1],[801,1],[803,2],[896,1],[909,1],[970,1],[972,2],[1028,1],[1099,1],[1101,1],[1103,2],[1258,1],[1271,1],[1343,1],[1451,1],[1453,1]]},"11":{"position":[[173,2]]},"17":{"position":[[446,1],[595,1],[626,1],[685,1],[733,1],[774,1],[799,1],[828,1],[922,1],[963,1],[993,1],[1051,1],[1070,1],[1139,1],[1152,1],[1194,1],[1259,1],[1387,1],[1389,1],[1471,1],[1528,1],[1530,1],[1549,1],[1566,1],[1627,1],[1629,1],[1972,1],[2191,1],[2220,1],[2327,1],[2503,1],[2547,1],[2584,1],[2642,1],[2685,1],[2744,1],[2755,1],[2798,1],[2856,1],[2924,1],[2976,1],[3068,1],[3078,1],[3157,1],[3170,1],[3213,1],[3271,1],[3324,1],[3403,1],[3455,1],[3479,1],[3533,1],[3625,1],[3691,1],[3754,1],[3766,1],[3840,1],[3915,1],[3968,1],[3970,1],[3989,1],[4006,1],[4068,1],[4070,1]]},"22":{"position":[[1109,1],[1140,1],[1171,1],[1227,1],[1252,1],[1281,1],[1312,1],[1347,1],[1377,1],[1379,1]]},"30":{"position":[[187,1],[254,1],[265,1],[270,1],[327,1],[344,1],[356,1],[363,1],[389,1],[409,1],[411,1],[413,1],[478,1],[485,1],[501,1],[514,1],[528,1],[553,1],[577,1],[659,1]]},"31":{"position":[[498,2],[590,1],[656,2],[659,2],[751,1],[792,1],[794,2],[901,1],[903,2],[943,1],[978,1],[995,1],[1316,2],[1319,2],[1375,1],[1394,2],[1548,1],[1664,1],[1666,2],[1669,2],[1842,1],[1939,2],[1942,2],[1945,2],[1982,1],[2039,1],[2102,1],[2167,1],[2203,1],[2280,2],[2327,2],[2380,1],[2635,2],[2638,2],[2696,2],[2744,2],[2794,1],[3180,1],[3191,1],[3290,1],[3415,1],[3445,1],[3456,1],[3619,1],[3744,1]]},"32":{"position":[[376,1],[396,1],[422,1],[481,1],[550,1],[614,1],[777,1],[832,1],[836,1],[920,1],[1019,1],[1085,1],[1104,1],[1147,1],[1149,2],[1185,1],[1241,1],[1296,2],[1393,2],[1428,1],[1453,2],[1520,2],[1573,1],[1670,1],[1673,1],[1751,1],[1755,1],[1821,1]]},"38":{"position":[[137,3]]},"39":{"position":[[579,2],[682,1],[835,1],[2004,1],[2075,1],[2388,1],[2399,1],[2416,1],[2440,1],[2455,1],[2468,1],[2487,1],[2509,1],[2528,1],[2650,1],[2664,1],[2722,1],[2736,1],[2795,1],[2802,1],[2810,1],[2821,1],[2864,2],[2871,1],[2898,1],[2925,1],[2996,1],[3001,1],[3009,1],[3018,1],[3082,1],[3139,3],[3143,1],[3145,1]]},"42":{"position":[[462,1],[464,1],[474,1],[504,1],[528,1],[571,1],[641,1],[689,1],[791,1],[874,2],[954,1],[1051,1],[1071,1],[1104,1],[1114,1],[1190,1],[1219,1],[1221,1],[2108,1],[2110,2],[2174,1],[2193,1],[2395,1],[2434,1],[2449,1],[2549,2],[2552,1],[2571,1],[2593,1],[2624,1],[2686,3],[2694,1],[2696,3],[2707,1],[2709,3],[2732,1],[2734,3],[2746,3],[2759,3],[2774,3]]},"43":{"position":[[134,2],[137,3],[141,2],[218,1],[374,1],[376,1],[442,1],[468,1],[566,1],[600,1],[602,1],[755,1],[801,1],[887,1],[1023,1],[1058,1],[1090,1],[1194,1],[1262,1],[1325,1],[1388,1],[1439,1],[1494,1],[1541,1]]},"51":{"position":[[508,1],[541,1],[572,1],[627,1],[689,1],[698,3],[702,1],[736,1],[752,1],[797,1],[809,1],[854,1],[921,1],[987,1],[1034,1],[1074,1],[1104,1],[1106,1],[1119,1],[1194,1],[1258,1],[1299,1],[1317,1],[1319,1],[1344,1],[1380,1],[1394,1],[1460,1],[1485,1],[1503,1],[1590,1],[1592,1]]},"52":{"position":[[588,2],[656,2],[700,2],[708,1],[724,1],[756,2],[862,2],[870,1],[886,1],[897,1],[913,1],[979,1],[1045,1],[1170,1],[1184,1],[1264,1],[1266,1],[1286,1],[1298,5],[1304,1],[1352,1],[1392,1],[1462,1],[1476,1],[1545,1],[1565,1],[1653,1],[2230,1],[2238,1],[2265,1],[2342,3],[3005,3],[3211,1],[3219,1],[3257,1],[3282,1],[3303,1],[3374,3],[4598,3],[4848,1],[4856,1],[4903,1],[5012,3],[6362,3],[6543,1],[6551,1]]},"53":{"position":[[243,3],[993,3]]},"71":{"position":[[77,1],[79,2],[117,1],[157,1],[216,1],[247,2],[314,1],[356,1],[358,2],[488,1],[544,1],[570,3],[574,1]]},"73":{"position":[[47,1],[73,1],[116,1],[191,1],[205,1],[311,1],[313,1],[315,1],[342,1],[368,1],[376,1],[428,1],[434,1],[436,1],[460,1],[569,1],[584,1],[621,1],[693,1],[787,1],[789,1]]},"74":{"position":[[192,1],[194,2],[211,1],[270,1],[272,2],[289,1]]},"78":{"position":[[220,1],[226,1],[237,1],[259,1]]},"79":{"position":[[701,1],[800,1],[832,1],[834,3],[904,1],[957,1],[1031,1],[1046,1],[1063,1],[1153,1],[1155,1]]},"80":{"position":[[256,1],[336,1],[359,1],[403,1],[438,1],[490,1],[518,1],[619,1],[631,1],[712,1],[801,1],[817,1],[891,1],[893,1]]},"83":{"position":[[562,1],[669,1]]},"84":{"position":[[231,1],[297,1],[577,1],[647,1]]},"85":{"position":[[476,1],[493,1],[495,2],[522,2],[554,2],[574,2],[594,1],[596,2],[623,2],[655,2],[675,1],[677,1]]},"88":{"position":[[246,1],[248,1],[255,1],[287,1],[321,1]]},"91":{"position":[[969,1],[971,8]]},"99":{"position":[[234,1],[266,1],[293,1],[342,1],[375,1],[412,1],[501,1],[569,1],[632,1]]},"100":{"position":[[328,1],[360,1],[387,1],[436,1],[468,1],[510,1],[585,1],[654,1],[717,1],[765,1],[813,1]]},"101":{"position":[[182,1],[214,1],[241,1],[290,1],[322,1],[365,1],[443,1],[512,1],[575,1],[638,1]]},"115":{"position":[[189,2],[230,1],[297,1],[331,1],[426,1],[441,1],[550,1],[562,1],[578,1],[1083,1],[1101,1],[1206,1],[1208,1],[1269,1],[1357,1],[1359,1],[1991,2],[2034,1],[2138,1],[2174,1],[2289,1],[2304,1],[2448,1],[2460,1],[2476,1],[2601,1],[2619,1],[2664,1],[2683,1],[2806,1],[2808,1],[2869,1],[2957,1],[2959,1]]},"117":{"position":[[379,1],[412,1],[440,1],[1009,1],[1087,1],[1188,1]]},"120":{"position":[[372,1]]},"126":{"position":[[428,1],[486,1],[513,1],[572,1],[665,1],[782,1],[825,1],[894,1],[949,1],[1336,1],[1338,2],[1394,2],[1422,1],[1456,2],[1513,2],[1542,1],[1558,2],[1613,2],[1643,2],[1700,1],[1799,1],[1840,2],[1892,1],[1941,1],[1987,1],[2020,1],[2042,2],[2109,2],[2143,2],[2198,2],[2254,2],[2338,1],[2354,1],[2417,2],[2434,1],[2474,2],[2610,2],[2650,2],[2665,1],[2750,2],[2765,1],[2804,2],[2870,2],[2899,2],[2916,1],[2953,2],[3067,2],[3139,2],[3397,1],[3527,1],[3563,1],[3623,1],[3652,1]]},"127":{"position":[[259,3],[263,2],[271,1],[350,2],[358,1],[402,2],[410,1],[454,2],[462,1]]},"131":{"position":[[59,1],[88,1],[116,1],[155,1],[204,1],[237,1],[278,1],[319,1],[340,1],[379,1],[418,1],[458,1],[466,1],[519,1]]},"132":{"position":[[147,1]]},"138":{"position":[[187,1],[332,1],[347,1],[377,1],[421,1],[490,1],[514,1],[560,2],[586,1],[786,2],[789,1],[791,1]]},"141":{"position":[[1255,1],[1304,1]]},"142":{"position":[[312,1],[326,1],[423,1],[520,1]]},"143":{"position":[[124,1],[278,1],[293,1],[338,1],[404,1],[428,1],[483,2],[505,1],[614,1],[616,1],[974,1],[1068,1],[1083,1],[1113,1],[1224,1],[1285,1],[1300,1],[1367,1],[1369,1]]},"146":{"position":[[11,3],[85,3],[146,1],[148,3],[196,3],[279,1]]},"147":{"position":[[11,3],[38,3],[42,3],[71,3],[163,1],[165,3],[187,3],[191,3],[272,1],[297,1],[299,3],[1014,3],[1018,3],[1114,1],[1139,1],[1141,3],[1224,1],[1255,1],[1257,3]]},"148":{"position":[[34,1],[130,1],[140,1],[160,2],[233,2],[321,1],[433,1],[435,3]]},"151":{"position":[[119,1],[218,1],[233,1],[274,1],[383,1],[385,1]]},"154":{"position":[[333,1],[381,1]]},"157":{"position":[[274,1],[298,1],[337,1],[460,1],[509,1],[511,2],[514,2],[663,2],[779,1]]},"160":{"position":[[172,1],[299,1],[314,1],[354,1],[713,1],[715,1]]},"162":{"position":[[370,1],[479,1],[762,1],[831,1],[947,1],[984,1],[1014,1],[1051,1],[1082,1],[1120,1],[1149,1],[1192,1],[1204,1],[1254,1],[1303,1],[1315,1],[1365,1],[1367,1],[1487,3],[1519,3],[2213,1],[2225,1],[2268,1]]},"163":{"position":[[401,1],[465,1],[836,1],[849,1],[927,1],[933,1],[991,1],[1039,1],[1628,1],[1683,1]]},"164":{"position":[[194,1],[245,1],[550,1],[593,1],[616,1],[654,1],[683,1],[726,1],[745,1],[794,1],[820,1],[870,1],[897,1],[899,1]]},"165":{"position":[[244,1],[310,1]]},"168":{"position":[[354,1],[505,1],[529,1],[609,1],[635,1],[678,2],[702,1],[774,1],[867,1],[893,1],[937,2],[962,1],[1035,1],[1100,1],[1102,1],[2057,1]]},"178":{"position":[[26,3],[97,3],[160,1],[162,3],[210,3],[293,1],[295,3],[322,3],[326,3],[355,3],[447,1],[449,3],[493,3],[497,3],[578,1],[603,1],[605,3],[701,1],[726,1],[728,3],[811,1],[842,1],[844,3],[882,3],[983,1],[1013,1],[1015,1],[1040,1],[1136,1],[1146,1],[1166,2],[1239,2],[1327,1],[1439,1],[1472,1],[1482,1],[1520,1],[1578,1],[1747,1],[1749,1]]},"179":{"position":[[65,1],[78,1]]},"183":{"position":[[15,3],[23,1],[25,3],[36,1],[38,1],[40,3],[62,1],[64,1],[66,3],[80,1],[82,1],[84,3],[98,1],[100,3],[111,3],[124,3],[139,3]]},"184":{"position":[[334,1],[394,1],[458,1],[518,1],[587,1],[661,1],[1019,1],[1033,1],[1073,1],[1083,1]]},"185":{"position":[[243,1],[290,1],[325,1],[399,1],[484,1],[521,1],[601,1],[653,1],[716,1],[733,1],[781,1],[794,1],[802,1],[809,1],[830,1],[832,1],[907,1],[1026,1],[1102,1],[1222,1],[1300,1],[1313,2],[1341,1],[1400,1],[1445,1],[1447,1],[1468,1],[1539,1],[1574,1],[1615,1],[1617,1],[1696,1],[1722,1],[1830,1],[1894,3],[1898,1],[1983,1],[2018,1],[2100,1],[2162,3],[2166,1],[2168,1],[2254,1],[2288,1],[2371,1],[2433,3],[2437,1],[2439,1],[2441,1]]},"195":{"position":[[81,1],[123,1],[165,1],[333,1]]},"196":{"position":[[11,3],[45,3],[78,1],[123,1],[166,1],[220,1],[290,1],[327,3],[331,1],[333,1],[371,1],[399,1],[404,1],[473,1],[537,1]]},"197":{"position":[[40,1],[42,3],[104,1],[123,2],[163,1],[200,1],[202,1],[268,1],[337,1],[430,1],[487,3],[491,1],[535,1],[571,1],[657,1],[659,1],[661,1],[699,1],[710,1],[741,1],[768,1],[773,1]]},"198":{"position":[[34,1],[148,1],[167,1],[201,1],[219,1],[247,2],[329,1],[365,1],[393,1],[504,1],[541,1],[543,2],[546,1],[588,1],[620,1],[645,1],[836,1],[873,1],[875,2],[878,1],[927,1],[955,1],[980,1],[1130,2],[1133,1],[1135,1]]},"203":{"position":[[108,1],[150,1],[352,1]]},"204":{"position":[[9,3],[30,3],[61,1],[156,1],[169,1],[312,1],[350,1],[379,1],[419,1],[450,1],[488,1],[521,1],[565,1],[602,1],[604,1],[617,1],[688,1],[790,1],[840,3],[844,1],[846,1],[907,1],[990,1],[1544,1],[1610,1]]},"205":{"position":[[228,3],[280,1],[282,3],[361,1],[374,1],[448,1],[551,1],[565,1],[684,1],[758,1],[770,1],[878,1],[921,3],[925,1],[990,1],[1035,1],[1120,1],[1178,1],[1180,1],[1193,1],[1195,3],[1295,1],[1315,1],[1389,1],[1437,1],[1560,1],[1620,3],[1624,1],[1723,1],[1739,1],[1799,1],[1849,1],[1869,1],[1985,1],[2048,3],[2052,1],[2054,1],[2115,1],[2175,1],[2213,1],[2235,1],[2262,1],[2267,1]]},"206":{"position":[[36,1],[141,1],[188,1],[226,1],[258,1],[309,1],[319,1],[339,1],[400,1],[512,1],[514,1],[516,1],[518,1],[548,1],[550,2],[618,1],[629,2],[804,2],[898,2],[994,1],[1068,1],[1070,3],[1074,1],[1104,1],[1106,2],[1152,1],[1163,2],[1214,1],[1250,1],[1283,1],[1344,2],[1463,2],[1466,2],[1562,2],[1656,1],[1706,1],[1708,3],[1712,1],[1742,1],[1744,2],[1790,1],[1801,2],[1871,1],[1904,1],[1933,1],[1948,2],[2040,1],[2087,1],[2110,1],[2153,1],[2237,1],[2273,1],[2359,2],[2437,2],[2594,1],[2635,1],[2637,3],[2641,2],[2790,2],[2930,2],[3054,1],[3113,1],[3115,3],[3177,1],[3243,1],[3245,3],[3249,2],[3313,1],[3348,1],[3350,2],[3396,1],[3407,2],[3480,1],[3555,1],[3596,2],[3739,2],[3742,1],[3744,1]]},"209":{"position":[[470,2],[592,1],[655,1],[722,1],[737,1],[739,2],[839,1],[921,1],[955,1],[1049,1],[1060,1],[1071,1],[1112,1],[1129,2],[1138,1],[1155,1],[1157,1],[1159,2],[1230,1],[1236,1],[1310,1],[1439,1],[1441,1],[1443,2],[1529,1],[1589,1],[1591,2],[1654,1],[1698,1]]},"210":{"position":[[376,1],[416,1],[444,1],[487,1],[519,1],[551,1],[646,1],[714,1],[777,1],[840,1],[890,1],[954,1],[1001,1],[1150,1],[1190,1],[1218,1],[1255,1],[1285,1],[1327,1],[1372,1],[1416,1],[1464,1]]},"211":{"position":[[374,1],[442,1],[518,1],[534,1]]},"212":{"position":[[166,2],[169,2],[234,1],[287,1],[352,1],[412,1],[491,1],[554,1],[611,1],[626,1],[685,1],[707,1],[808,1],[863,2],[921,1],[1076,1],[1182,2],[1185,1],[1227,2],[1304,1],[1313,1],[1315,2],[1417,1],[1424,1],[1433,1],[1435,1],[1472,1],[1474,2],[1543,1],[1572,1],[1601,2],[1666,1],[1709,2],[1788,1],[1831,2],[1892,2],[1975,1],[2030,1],[2040,2],[2115,1],[2117,2],[2182,1],[2229,1],[2254,1],[2262,3],[2266,1],[2268,2],[2357,2],[2421,2],[2490,1],[2518,1],[2520,1],[2549,1],[2551,2],[2594,1],[2634,1],[2674,1],[2703,2],[2806,1],[2855,1],[2857,2],[2907,1],[2983,1],[3019,1],[3041,1],[3088,1],[3117,2],[3220,1],[3232,1],[3246,1],[3468,1],[3470,2],[3532,2],[3564,2],[3615,2],[3665,2],[3713,2],[3855,1],[3869,1],[3986,1],[4036,1],[4082,1],[4099,1],[4127,1],[4248,1],[4438,1],[4499,1],[4510,1],[4592,1],[4600,1],[4614,2],[4623,1],[4637,2],[4640,2],[4643,1],[4691,1],[4766,1],[4838,1]]},"219":{"position":[[329,1],[346,1],[372,1],[381,1],[440,1],[463,1],[524,1],[547,1]]},"220":{"position":[[140,3],[166,1],[209,1],[238,1]]},"221":{"position":[[71,1],[112,1],[146,1],[185,1],[207,1],[253,1],[255,1],[290,1],[313,1],[357,1],[359,1],[361,1]]},"222":{"position":[[88,1],[118,1],[202,1],[233,3],[237,1],[269,1],[352,1],[383,3],[387,1],[389,1]]},"223":{"position":[[287,3],[312,3],[359,1],[421,1],[460,1],[494,1],[547,1],[577,1],[609,1],[639,1],[665,1],[697,1],[725,1],[765,1],[795,1],[797,1],[821,1],[913,1],[928,1],[965,1],[1144,2],[1184,1],[1186,1]]},"229":{"position":[[220,1],[226,1],[236,1],[248,1],[258,1],[280,1]]},"230":{"position":[[718,1],[817,1],[849,1],[851,3],[921,1],[974,1],[1048,1],[1063,1],[1080,1],[1170,1],[1172,1]]},"231":{"position":[[256,1],[336,1],[359,1],[403,1],[438,1],[490,1],[518,1],[619,1],[631,1],[712,1],[801,1],[817,1],[891,1],[893,1]]},"235":{"position":[[77,1],[79,2],[117,1],[157,1],[216,1],[247,2],[314,1],[356,1],[358,2],[488,1],[544,1],[570,3],[574,1]]},"237":{"position":[[47,1],[73,1],[116,1],[191,1],[205,1],[311,1],[313,1],[315,1],[342,1],[368,1],[376,1],[428,1],[434,1],[436,1],[460,1],[569,1],[584,1],[621,1],[693,1],[787,1],[789,1]]},"238":{"position":[[192,1],[194,2],[211,1],[270,1],[272,2],[289,1]]},"246":{"position":[[241,1],[308,1]]},"247":{"position":[[15,3],[60,3],[96,1],[191,1],[206,1],[315,1],[353,1],[373,1],[413,1],[435,1],[473,1],[497,1],[541,1],[569,1],[634,1],[667,1],[752,1],[791,1],[868,1],[910,1],[1013,1],[1067,1],[1141,1],[1180,1],[1224,1],[1251,1],[1317,1],[1361,1],[1432,1],[1525,1],[1527,1]]},"250":{"position":[[246,1],[248,1],[255,1],[287,1],[321,1]]},"252":{"position":[[562,1],[669,1]]},"253":{"position":[[231,1],[297,1],[577,1],[647,1]]},"254":{"position":[[476,1],[493,1],[495,2],[522,2],[554,2],[574,2],[594,1],[596,2],[623,2],[655,2],[675,1],[677,1]]},"258":{"position":[[179,2],[220,1],[287,1],[321,1],[416,1],[431,1],[540,1],[552,1],[568,1],[1037,1],[1055,1],[1152,1],[1154,1],[1215,1],[1303,1],[1305,1],[1937,2],[1980,1],[2084,1],[2120,1],[2235,1],[2250,1],[2394,1],[2406,1],[2422,1],[2539,1],[2557,1],[2598,1],[2617,1],[2732,1],[2734,1],[2795,1],[2883,1],[2885,1]]},"265":{"position":[[457,1],[490,1],[518,1],[557,1],[606,1],[639,1],[684,1],[725,1],[746,1],[789,1],[828,1],[868,1],[876,1],[929,1]]},"266":{"position":[[143,1]]},"267":{"position":[[877,2],[909,1],[951,1],[953,3],[1022,1],[1024,2],[1055,1],[1097,1],[1099,3],[1155,1],[1329,1],[1351,1],[1383,1],[1404,1],[1427,1],[1452,1],[1461,1],[1607,1],[1690,1],[1692,2],[1745,1],[1795,3],[2212,1],[2286,1],[2713,1],[2821,1],[2938,1],[3321,1],[3359,1],[3482,1],[3879,1],[3939,1],[3941,2]]},"268":{"position":[[832,2],[962,1],[994,1],[1037,2],[1162,1],[1196,1],[1212,1],[1330,2],[1343,1],[2388,1],[2411,1],[2454,1],[2529,1],[2674,2],[2677,1],[3023,1],[3053,1],[3098,3],[3160,1],[3219,1],[3221,3],[3283,1],[3349,1],[3351,3]]},"269":{"position":[[276,1],[318,1],[520,1],[549,1],[658,1],[660,1],[673,1],[799,1],[816,1],[934,1],[967,1],[1022,3],[1026,1],[1028,1],[1030,1],[1107,1],[1120,1],[1194,1],[1297,1],[1311,1],[1430,1],[1504,1],[1516,1],[1624,1],[1667,3],[1671,1],[1709,1],[1752,1],[1754,2],[1866,1],[1924,1],[1995,1],[2097,1],[2147,3],[2151,1],[2222,1],[2265,1],[2307,1],[2419,1],[2469,3],[2473,1],[2475,1],[2488,1],[2586,1],[2640,1],[2681,1],[2793,1],[2853,3],[2857,1],[2956,1],[2972,1],[3057,1],[3100,1],[3193,1],[3256,3],[3260,1],[3262,1],[3279,1],[3410,1],[3493,1],[3554,1],[3614,1],[3616,1],[3633,1],[3692,1],[3714,1],[3746,1],[3767,1],[3790,1],[3815,1],[3824,1],[3826,1],[3851,1],[3939,2],[4021,2],[4045,1],[4092,1],[4130,1],[4162,1],[4213,1],[4223,1],[4243,1],[4304,1],[4422,1],[4424,1],[4426,1],[4428,1],[4458,1],[4460,2],[4528,1],[4539,2],[4714,2],[4808,2],[4904,1],[4978,1],[4980,3],[4984,1],[5014,1],[5016,2],[5062,1],[5073,2],[5124,1],[5160,1],[5193,1],[5254,2],[5373,2],[5376,2],[5472,2],[5566,1],[5616,1],[5618,3],[5622,1],[5652,1],[5654,2],[5700,1],[5711,2],[5781,1],[5814,1],[5843,1],[5858,2],[5950,1],[5952,2],[5970,1]]},"277":{"position":[[428,1],[486,1],[513,1],[572,1],[665,1],[782,1],[825,1],[894,1],[949,1],[1086,1],[1142,1],[1504,1],[1506,2],[1562,2],[1590,1],[1624,2],[1681,2],[1710,1],[1726,2],[1781,2],[1811,2],[1868,1],[1967,1],[2008,2],[2060,1],[2109,1],[2155,1],[2188,1],[2210,2],[2277,2],[2311,2],[2366,2],[2422,2],[2506,1],[2522,1],[2585,2],[2602,1],[2642,2],[2778,2],[2818,2],[2833,1],[2918,2],[2933,1],[2972,2],[3038,2],[3067,2],[3084,1],[3121,2],[3235,2],[3307,2],[3565,1],[3695,1],[3731,1],[3791,1],[3820,1]]},"278":{"position":[[259,3],[263,2],[271,1],[350,2],[358,1],[402,2],[410,1],[454,2],[462,1]]},"283":{"position":[[967,1],[969,8]]},"291":{"position":[[234,1],[266,1],[293,1],[342,1],[375,1],[412,1],[501,1],[569,1],[632,1]]},"292":{"position":[[328,1],[360,1],[387,1],[436,1],[468,1],[510,1],[585,1],[654,1],[717,1],[765,1],[813,1]]},"293":{"position":[[182,1],[214,1],[241,1],[290,1],[322,1],[365,1],[443,1],[512,1],[575,1],[638,1]]},"298":{"position":[[379,1],[412,1],[440,1],[1009,1],[1087,1],[1188,1]]},"301":{"position":[[372,1]]},"311":{"position":[[59,1],[88,1],[116,1],[155,1],[204,1],[256,1],[289,1],[330,1],[371,1],[392,1],[431,1],[470,1],[510,1],[518,1],[571,1]]},"312":{"position":[[147,1]]},"318":{"position":[[187,1],[324,1],[339,1],[369,1],[413,1],[482,1],[506,1],[552,2],[578,1],[778,2],[781,1],[783,1]]},"321":{"position":[[517,2],[578,1],[604,2],[680,1],[701,2],[791,1],[793,1],[812,2],[815,2],[915,1],[926,2],[951,1],[1005,1],[1039,1],[1041,3],[1171,1],[1263,1],[1270,3],[1274,1],[1276,3],[1375,1],[1436,1],[1443,3],[1447,1],[1449,3],[1524,1],[1531,1],[1629,1],[1631,1],[1633,1],[1635,2],[1735,1],[1767,1],[1769,2],[1880,1],[1882,3],[1921,3],[1958,1],[1960,2],[2070,1],[2086,1],[2088,2],[2206,1],[2222,1]]},"322":{"position":[[79,1]]},"323":{"position":[[225,1],[375,3],[556,1],[558,1],[580,1],[673,1],[675,1],[779,1],[781,1],[783,1],[785,2],[788,1],[810,1],[900,1],[902,1],[1006,2],[1009,1],[1111,1],[1113,1],[1115,1],[1117,2],[1120,1],[1142,1],[1235,1],[1237,1],[1341,1],[1343,1],[1345,1],[1347,1],[1349,2],[1372,1],[1374,1],[1505,2],[1508,1],[1641,1],[1643,2],[1672,1],[1674,1],[1857,1],[1859,1],[1992,1],[1994,2],[2116,2],[2119,1],[2286,3],[2409,1],[2411,2],[2434,1],[2436,1],[2513,2],[2516,1],[2593,1],[2595,2],[2616,1],[2805,1],[2807,1],[3017,2],[3020,1],[3222,2],[3225,1],[3435,2],[3438,1],[3571,2],[3574,1],[3705,1],[3707,1],[3709,1],[3711,1]]},"326":{"position":[[1255,1],[1304,1]]},"327":{"position":[[312,1],[326,1],[423,1],[520,1]]},"328":{"position":[[124,1],[278,1],[293,1],[338,1],[409,1],[478,1],[533,1],[535,2],[589,1],[591,1],[949,1],[1043,1],[1058,1],[1088,1],[1199,1],[1260,1],[1275,1],[1342,1],[1344,1]]},"330":{"position":[[265,1],[289,1],[328,1],[446,1],[495,1],[497,2],[500,2],[644,2],[755,1]]},"334":{"position":[[11,3],[85,3],[146,1],[148,3],[196,3],[279,1]]},"335":{"position":[[11,3],[38,3],[42,3],[71,3],[163,1],[165,3],[187,3],[191,3],[272,1],[297,1],[299,3],[1022,3],[1026,3],[1122,1],[1147,1],[1149,3],[1232,1],[1263,1],[1265,3]]},"336":{"position":[[34,1],[130,1],[140,1],[160,2],[233,2],[321,1],[433,1],[435,3]]},"339":{"position":[[333,1],[381,1]]},"342":{"position":[[119,1],[218,1],[233,1],[274,1],[383,1],[385,1]]},"345":{"position":[[172,1],[299,1],[314,1],[354,1],[713,1],[715,1]]},"346":{"position":[[122,1],[166,1],[203,1],[281,1]]},"348":{"position":[[354,1],[505,1],[529,1],[609,1],[635,1],[678,2],[702,1],[774,1],[867,1],[893,1],[937,2],[962,1],[1035,1],[1100,1],[1102,1],[2057,1]]},"351":{"position":[[407,1],[516,1],[784,1],[853,1],[969,1],[1006,1],[1036,1],[1073,1],[1104,1],[1142,1],[1171,1],[1214,1],[1226,1],[1276,1],[1325,1],[1337,1],[1387,1],[1389,1],[1509,3],[1541,3],[2235,1],[2247,1],[2290,1]]},"352":{"position":[[423,1],[487,1],[858,1],[871,1],[949,1],[955,1],[1013,1],[1061,1],[1650,1],[1705,1]]},"353":{"position":[[229,1],[280,1],[585,1],[628,1],[651,1],[689,1],[718,1],[761,1],[780,1],[829,1],[855,1],[905,1],[932,1],[934,1]]},"354":{"position":[[282,1],[348,1],[605,1],[611,1],[620,1],[629,1],[634,1],[734,1]]},"369":{"position":[[26,3],[97,3],[160,1],[162,3],[210,3],[293,1],[295,3],[322,3],[326,3],[355,3],[447,1],[449,3],[493,3],[497,3],[578,1],[603,1],[605,3],[701,1],[726,1],[728,3],[811,1],[842,1],[844,3],[882,3],[983,1],[1013,1],[1015,1],[1040,1],[1136,1],[1146,1],[1166,2],[1239,2],[1327,1],[1439,1],[1472,1],[1482,1],[1520,1],[1578,1],[1747,1],[1749,1]]},"370":{"position":[[65,1],[78,1]]},"374":{"position":[[15,3],[23,1],[25,3],[36,1],[38,1],[40,3],[62,1],[64,1],[66,3],[80,1],[82,1],[84,3],[98,1],[100,3],[111,3],[124,3],[139,3]]},"375":{"position":[[301,1],[361,1],[401,1],[461,1],[506,1],[580,1],[916,1],[930,1],[970,1],[980,1]]},"376":{"position":[[227,1],[274,1],[309,1],[383,1],[468,1],[505,1],[585,1],[637,1],[700,1],[717,1],[765,1],[778,1],[786,1],[793,1],[814,1],[816,1],[891,1],[1010,1],[1086,1],[1206,1],[1284,1],[1297,2],[1325,1],[1384,1],[1429,1],[1431,1],[1452,1],[1523,1],[1558,1],[1599,1],[1601,1],[1680,1],[1706,1],[1814,1],[1878,3],[1882,1],[1967,1],[2002,1],[2084,1],[2146,3],[2150,1],[2152,1],[2238,1],[2272,1],[2355,1],[2417,3],[2421,1],[2423,1],[2425,1]]},"383":{"position":[[368,1],[434,1],[666,1],[668,3],[687,4],[699,1],[726,1],[728,2],[738,1],[775,1],[797,1],[829,1],[850,1],[873,1],[898,1],[907,1],[1129,1],[1212,1]]},"384":{"position":[[273,1],[304,1],[331,1],[533,1],[562,1],[671,1],[673,1],[686,1],[812,1],[829,1],[947,1],[980,1],[1035,3],[1039,1],[1041,1],[1043,1],[1120,1],[1133,1],[1207,1],[1310,1],[1324,1],[1443,1],[1517,1],[1529,1],[1637,1],[1680,3],[1684,1],[1722,1],[1772,1],[1774,2],[1886,1],[1944,1],[2015,1],[2117,1],[2167,3],[2171,1],[2242,1],[2285,1],[2334,1],[2446,1],[2496,3],[2500,1],[2502,1],[2515,1],[2613,1],[2667,1],[2715,1],[2827,1],[2887,3],[2891,1],[2990,1],[3006,1],[3091,1],[3141,1],[3234,1],[3297,3],[3301,1],[3303,1],[3320,1],[3420,1],[3503,1],[3540,1],[3600,1],[3602,1],[3619,1],[3656,1],[3678,1],[3710,1],[3731,1],[3754,1],[3779,1],[3788,1],[3790,1],[3815,1],[3817,2],[3849,1]]},"388":{"position":[[460,2],[553,1],[616,1],[654,1],[669,1],[671,2],[771,1],[853,1],[887,1],[981,1],[992,1],[1003,1],[1044,1],[1061,2],[1070,1],[1087,1],[1089,1],[1091,2],[1162,1],[1168,1],[1242,1],[1371,1],[1373,1],[1375,2],[1461,1],[1521,1],[1523,2],[1586,1],[1630,1]]},"389":{"position":[[376,1],[416,1],[444,1],[487,1],[519,1],[551,1],[646,1],[714,1],[777,1],[827,1],[891,1],[938,1],[1087,1],[1127,1],[1155,1],[1192,1],[1222,1],[1264,1],[1309,1],[1353,1],[1401,1]]},"390":{"position":[[361,1],[428,1],[492,1],[508,1]]},"391":{"position":[[166,2],[169,2],[234,1],[287,1],[352,1],[412,1],[491,1],[554,1],[611,1],[626,1],[685,1],[707,1],[808,1],[863,2],[921,1],[1076,1],[1182,2],[1185,1],[1227,2],[1304,1],[1313,1],[1315,2],[1417,1],[1424,1],[1433,1],[1435,1],[1472,1],[1474,2],[1543,1],[1572,1],[1601,2],[1666,1],[1709,2],[1788,1],[1831,2],[1892,2],[1975,1],[2030,1],[2040,2],[2115,1],[2117,2],[2182,1],[2229,1],[2254,1],[2262,3],[2266,1],[2268,2],[2357,2],[2421,2],[2490,1],[2518,1],[2520,1],[2549,1],[2551,2],[2594,1],[2634,1],[2655,1],[2680,1],[2709,2],[2812,1],[2861,1],[2863,2],[2914,1],[2931,1],[2995,1],[3031,1],[3054,1],[3071,1],[3106,1],[3135,2],[3238,1],[3250,1],[3264,1],[3486,1],[3488,2],[3550,2],[3582,2],[3633,2],[3683,2],[3731,2],[3873,1],[3887,1],[4004,1],[4054,1],[4100,1],[4117,1],[4145,1],[4266,1],[4456,1],[4517,1],[4528,1],[4610,1],[4618,1],[4632,2],[4641,1],[4655,2],[4658,2],[4661,1],[4709,1],[4784,1],[4856,1]]},"395":{"position":[[236,3],[333,3],[546,1],[548,2],[596,1],[630,2],[700,1],[716,2],[761,1],[860,1],[901,2],[939,1],[1039,2],[1155,2],[1255,2],[1305,2],[1346,2],[1407,2],[1470,1],[1475,1],[1484,2],[1550,2],[1737,2],[1740,1],[1742,3],[1831,1],[1842,1],[1891,1],[1936,1],[1960,1],[1995,1],[2014,1],[2056,2],[2132,1],[2134,3],[2272,1],[2286,1],[2324,1],[2399,1],[2563,1],[2593,1],[2621,1],[2660,1],[2662,1],[2672,1],[2702,1],[2704,3],[2725,1],[2733,1],[2748,1],[2750,1],[2760,1],[2790,1],[2792,3],[2813,1],[2821,1],[2847,1],[2849,1],[2859,1],[2889,1],[2896,1],[2927,1],[2929,1],[2939,1],[2969,1],[2971,3],[2992,1],[3000,1],[3034,1],[3036,1],[3046,1],[3076,1],[3078,3],[3099,1],[3107,1],[3128,1],[3130,2],[3141,1],[3194,1],[3236,1],[3277,1],[3298,1],[3338,1],[3377,1],[3398,1],[3435,1],[3492,1],[3548,1],[3556,1],[3609,1],[3674,1],[3841,1],[3970,1],[4560,2],[4568,1],[4602,2],[4610,1],[4661,2],[4669,1],[4765,2],[4773,1],[4869,2],[4877,1],[4986,2],[4994,1],[5182,2],[5190,1],[5328,2],[5336,1],[5432,2],[5440,1],[5536,2],[5544,1],[5653,2],[5661,1],[5787,2],[5795,1],[5891,2],[5899,1],[5995,2],[6003,1],[6112,2],[6120,1],[6172,2],[6180,1],[6307,2],[6315,1],[6411,2],[6419,1],[6515,2],[6523,1]]},"405":{"position":[[457,1],[490,1],[518,1],[557,1],[606,1],[639,1],[684,1],[725,1],[746,1],[789,1],[828,1],[868,1],[876,1],[929,1]]},"406":{"position":[[143,1]]},"407":{"position":[[877,2],[909,1],[951,1],[953,3],[1022,1],[1024,2],[1055,1],[1097,1],[1099,3],[1155,1],[1329,1],[1351,1],[1383,1],[1404,1],[1427,1],[1452,1],[1461,1],[1607,1],[1690,1],[1692,2],[1745,1],[1795,3],[2212,1],[2286,1],[2713,1],[2821,1],[2938,1],[3321,1],[3359,1],[3482,1],[3879,1],[3939,1],[3941,2]]},"408":{"position":[[832,2],[962,1],[994,1],[1037,2],[1162,1],[1196,1],[1212,1],[1330,2],[1343,1],[2388,1],[2411,1],[2454,1],[2529,1],[2674,2],[2677,1],[3023,1],[3053,1],[3098,3],[3160,1],[3219,1],[3221,3],[3283,1],[3349,1],[3351,3]]},"409":{"position":[[276,1],[318,1],[520,1],[549,1],[658,1],[660,1],[673,1],[799,1],[816,1],[934,1],[967,1],[1022,3],[1026,1],[1028,1],[1030,1],[1107,1],[1120,1],[1194,1],[1297,1],[1311,1],[1430,1],[1504,1],[1516,1],[1624,1],[1667,3],[1671,1],[1709,1],[1752,1],[1754,2],[1866,1],[1924,1],[1995,1],[2097,1],[2147,3],[2151,1],[2222,1],[2265,1],[2307,1],[2419,1],[2469,3],[2473,1],[2475,1],[2488,1],[2586,1],[2640,1],[2681,1],[2793,1],[2853,3],[2857,1],[2956,1],[2972,1],[3057,1],[3100,1],[3193,1],[3256,3],[3260,1],[3262,1],[3279,1],[3410,1],[3493,1],[3554,1],[3614,1],[3616,1],[3633,1],[3692,1],[3714,1],[3746,1],[3767,1],[3790,1],[3815,1],[3824,1],[3826,1],[3851,1],[3939,2],[4021,2],[4045,1],[4092,1],[4130,1],[4162,1],[4213,1],[4223,1],[4243,1],[4304,1],[4422,1],[4424,1],[4426,1],[4428,1],[4458,1],[4460,2],[4528,1],[4539,2],[4714,2],[4808,2],[4904,1],[4978,1],[4980,3],[4984,1],[5014,1],[5016,2],[5062,1],[5073,2],[5124,1],[5160,1],[5193,1],[5254,2],[5373,2],[5376,2],[5472,2],[5566,1],[5616,1],[5618,3],[5622,1],[5652,1],[5654,2],[5700,1],[5711,2],[5781,1],[5814,1],[5843,1],[5858,2],[5950,1],[5952,2],[5970,1]]},"414":{"position":[[232,1],[265,1],[280,1],[282,2],[349,1],[365,1],[367,3],[439,3]]},"416":{"position":[[405,1],[407,3],[498,3],[564,3],[639,3],[698,3],[762,1],[764,3],[827,1],[873,1],[1370,3],[1483,1],[1485,2],[1593,1],[1648,1],[1650,2],[1745,2],[1761,1],[1827,1],[1829,2],[1898,2],[1943,2],[2044,1],[2049,1],[2054,1],[2063,1],[2628,3],[2715,1],[2717,2],[2812,1],[2848,1],[2877,2],[2989,2],[3041,1],[3066,3],[3070,1],[3447,3],[3518,1],[3520,2],[3598,1],[3654,1],[3656,2],[3731,1],[3857,1],[3912,1],[3914,2],[3951,1],[3984,1],[4013,1],[4063,1],[4082,1],[4099,1],[4111,2],[4127,1],[4134,1],[4145,2],[4161,1],[4163,2],[4287,1],[4289,2],[4362,1],[4386,1],[4512,1],[4514,2],[4563,1]]},"417":{"position":[[151,1],[161,1],[195,1],[214,1],[343,2],[360,1],[408,2],[451,2],[508,2],[668,2],[773,2],[828,1],[833,1],[842,2],[877,2],[1033,2],[1139,2],[1337,2],[1481,1],[1486,1],[1510,2],[1621,1]]},"419":{"position":[[176,3],[239,1],[285,1],[287,3],[367,1],[369,3],[422,1],[427,3],[472,1],[477,3],[521,1],[526,3],[551,1],[556,3],[634,1],[639,1],[641,3],[715,3],[777,1],[779,3],[869,3],[935,3],[1010,3],[1069,3],[1133,1],[1135,3],[1162,3],[1166,3],[1195,3],[1288,1],[1290,3],[1456,1],[1458,2],[1626,1],[1628,2],[1694,1],[1710,1],[1712,3],[1785,3],[1839,3],[1888,3],[1989,3],[2088,3],[2311,2],[2314,3],[2382,3],[2454,3],[2538,3],[2620,3],[2726,3],[2883,3],[3038,3],[3183,3],[3327,3],[3454,3],[3636,3],[3760,3],[3885,1],[3887,1],[3889,3],[4002,1],[4004,2],[4110,1],[4165,1],[4167,2],[4262,2],[4278,1],[4345,1],[4347,2],[4416,2],[4461,2],[4562,1],[4567,1],[4572,1],[4581,1],[4583,3],[4670,1],[4672,2],[4767,1],[4803,1],[4832,2],[4943,2],[4995,1],[5020,3],[5024,1],[5026,3],[5097,1],[5099,2],[5177,1],[5233,1],[5235,2],[5310,1],[5436,1],[5491,1],[5493,2],[5530,1],[5563,1],[5592,1],[5642,1],[5661,1],[5678,1],[5690,2],[5706,1],[5713,1],[5724,2],[5740,1],[5742,2],[5867,1],[5869,2],[5942,1],[5966,1],[6092,1],[6094,2],[6143,1],[6183,1],[6224,1],[6280,1],[6298,1],[6424,1],[6473,1],[6475,1],[6477,1],[6502,1],[6566,1],[6576,1],[6610,1],[6629,1],[6758,2],[6775,1],[6823,2],[6866,2],[6923,2],[7083,2],[7188,2],[7243,1],[7248,1],[7257,2],[7292,2],[7448,2],[7554,2],[7752,2],[7896,1],[7901,1],[7925,2],[8036,1],[8038,1]]},"423":{"position":[[108,1],[150,1],[352,1]]},"424":{"position":[[36,1],[131,1],[144,1],[287,1],[325,1],[354,1],[394,1],[425,1],[463,1],[496,1],[540,1],[577,1],[579,1],[592,1],[663,1],[765,1],[815,3],[819,1],[821,1],[858,1],[941,1],[1494,1],[1560,1]]},"425":{"position":[[255,1],[257,3],[336,1],[349,1],[423,1],[526,1],[540,1],[659,1],[733,1],[745,1],[853,1],[896,3],[900,1],[965,1],[1010,1],[1095,1],[1153,1],[1155,1],[1168,1],[1170,3],[1270,1],[1290,1],[1364,1],[1412,1],[1535,1],[1595,3],[1599,1],[1698,1],[1714,1],[1774,1],[1824,1],[1844,1],[1960,1],[2023,3],[2027,1],[2029,1],[2066,1],[2126,1],[2163,1],[2185,1],[2212,1],[2217,1]]},"426":{"position":[[36,1],[141,1],[188,1],[226,1],[258,1],[309,1],[319,1],[339,1],[400,1],[512,1],[514,1],[516,1],[518,1],[548,1],[550,2],[618,1],[629,2],[804,2],[898,2],[989,1],[1063,1],[1065,3],[1069,1],[1099,1],[1101,2],[1147,1],[1158,2],[1209,1],[1245,1],[1278,1],[1339,2],[1458,2],[1461,2],[1557,2],[1646,1],[1696,1],[1698,3],[1702,1],[1732,1],[1734,2],[1780,1],[1791,2],[1861,1],[1894,1],[1923,1],[1938,2],[2030,1],[2077,1],[2100,1],[2143,1],[2227,1],[2263,1],[2349,2],[2427,2],[2579,1],[2620,1],[2622,3],[2626,2],[2775,2],[2915,2],[3034,1],[3093,1],[3095,3],[3152,1],[3218,1],[3220,3],[3224,2],[3288,1],[3323,1],[3325,2],[3371,1],[3382,2],[3455,1],[3530,1],[3571,2],[3714,2],[3717,1],[3719,1]]},"431":{"position":[[81,1],[123,1],[165,1],[333,1]]},"432":{"position":[[40,1],[85,1],[128,1],[182,1],[252,1],[289,3],[293,1],[295,1],[332,1],[360,1],[365,1],[410,1],[474,1]]},"433":{"position":[[40,1],[42,3],[104,1],[123,2],[163,1],[200,1],[202,1],[268,1],[337,1],[430,1],[487,3],[491,1],[535,1],[571,1],[657,1],[659,1],[661,1],[698,1],[709,1],[740,1],[767,1],[772,1]]},"434":{"position":[[34,1],[148,1],[167,1],[201,1],[219,1],[247,2],[329,1],[365,1],[393,1],[499,1],[536,1],[538,2],[541,1],[583,1],[615,1],[640,1],[826,1],[863,1],[865,2],[868,1],[917,1],[945,1],[970,1],[1120,2],[1123,1],[1125,1]]},"440":{"position":[[213,2],[386,2],[407,1],[455,1],[474,1],[517,1],[574,1],[616,1],[672,1],[713,1],[752,1],[789,1],[817,1],[842,1],[865,1],[891,1],[898,1],[923,1],[963,1],[971,2],[998,1],[1112,1],[1148,1],[1248,1],[1288,1],[1547,2],[1605,3],[1609,2],[1612,1],[1682,1],[1692,1],[1717,1],[1773,2],[1814,1],[1899,1],[1985,2],[2051,1],[2125,2],[2128,2],[2131,2],[2177,1],[2209,3],[2213,1],[2286,1],[2296,1],[2320,1],[2358,1],[2384,1],[2408,2],[2514,2],[2523,1],[2571,1],[2588,1],[2686,2],[2741,2],[2768,1],[2816,1],[2818,2],[2886,1],[2926,1],[2928,2],[3004,2],[3127,1],[3219,1],[3238,3],[3242,1],[3284,1],[3312,1],[3314,1],[4862,2],[4957,1],[4967,1],[5001,1],[5024,1],[5140,2],[5160,1],[5357,1],[5509,2],[5590,2],[5670,2],[5789,2],[5792,1],[6372,1],[6396,1],[6398,3],[6463,1],[6509,1],[6511,3],[6515,1]]},"441":{"position":[[86,1],[707,1],[729,1],[736,1],[760,1],[796,1],[841,1],[879,1],[944,1],[1001,1],[1003,2],[1125,1],[1135,1],[1159,1],[1185,1],[1220,1],[1343,1],[1388,2],[1524,1],[1566,1],[1594,1],[1596,1],[2256,3],[2295,1],[2297,3],[2317,1],[2337,1],[2344,1],[2386,1],[2388,3],[2422,1],[2458,1],[2460,3],[2523,1],[2525,2],[2579,1],[2642,2],[2824,1],[2894,1],[2896,2],[2933,3],[2937,2],[2997,1],[3084,2],[3101,3],[3105,1],[3190,1],[3200,1],[3224,1],[3263,1],[3279,2],[3348,1],[3383,1],[3385,3],[3389,2],[3450,2],[3497,2],[3545,1],[3611,1],[3626,2],[3649,1],[3698,1],[3785,1],[3787,1],[4628,2],[4757,2],[4782,1],[4792,1],[4826,1],[4849,1],[4965,2],[4981,1],[5054,1],[5326,1],[5454,2],[5658,2],[5713,1],[5820,1],[5881,1]]},"445":{"position":[[241,1],[308,1]]},"446":{"position":[[15,3],[60,3],[96,1],[191,1],[206,1],[315,1],[353,1],[373,1],[413,1],[435,1],[473,1],[497,1],[541,1],[569,1],[634,1],[667,1],[752,1],[791,1],[868,1],[910,1],[1013,1],[1067,1],[1141,1],[1180,1],[1224,1],[1251,1],[1317,1],[1361,1],[1432,1],[1525,1],[1527,1]]},"452":{"position":[[308,1],[325,1],[351,1],[360,1],[395,1],[418,1],[455,1],[478,1]]},"453":{"position":[[140,3],[166,1],[209,1],[238,1]]},"454":{"position":[[71,1],[112,1],[146,1],[185,1],[207,1],[253,1],[255,1],[290,1],[313,1],[357,1],[359,1],[361,1]]},"455":{"position":[[88,1],[118,1],[202,1],[233,3],[237,1],[269,1],[352,1],[383,3],[387,1],[389,1]]},"456":{"position":[[287,3],[312,3],[359,1],[421,1],[460,1],[494,1],[547,1],[577,1],[609,1],[639,1],[665,1],[697,1],[725,1],[765,1],[795,1],[797,1],[821,1],[913,1],[928,1],[965,1],[1144,2],[1184,1],[1186,1]]},"460":{"position":[[220,1],[226,1],[236,1],[248,1],[258,1],[280,1]]},"461":{"position":[[718,1],[817,1],[849,1],[851,3],[921,1],[974,1],[1048,1],[1063,1],[1080,1],[1170,1],[1172,1]]},"462":{"position":[[256,1],[336,1],[359,1],[403,1],[438,1],[490,1],[518,1],[619,1],[631,1],[712,1],[801,1],[817,1],[891,1],[893,1]]},"471":{"position":[[77,1],[79,2],[117,1],[157,1],[216,1],[247,2],[314,1],[356,1],[358,2],[488,1],[544,1],[570,3],[574,1]]},"473":{"position":[[47,1],[73,1],[116,1],[191,1],[205,1],[311,1],[313,1],[315,1],[342,1],[368,1],[376,1],[428,1],[434,1],[436,1],[460,1],[569,1],[584,1],[621,1],[693,1],[787,1],[789,1]]},"474":{"position":[[192,1],[194,2],[211,1],[270,1],[272,2],[289,1]]},"476":{"position":[[207,1],[223,1],[275,1],[397,1],[435,1],[437,3],[537,1],[578,1],[580,3],[670,1],[672,2],[710,1],[750,1],[809,1],[840,2],[907,1],[951,1],[953,2],[1083,1],[1138,1],[1164,3],[1168,1],[1170,3],[1264,1],[1266,2],[1294,1],[1296,3],[1406,1],[1408,2],[1436,1],[1438,3],[1511,1],[1513,2],[1541,1],[1543,1],[1545,3],[1637,1],[1653,1],[1674,1],[1699,1],[1703,1],[1705,3],[1758,1],[1799,1],[1801,3],[1860,1],[1901,1]]},"477":{"position":[[274,1],[330,1],[739,1],[775,1],[803,1],[842,1],[844,1],[851,1],[891,1],[899,1],[901,3],[905,1],[950,1],[952,1],[962,1],[992,1],[999,1],[1001,3],[1005,1],[1041,1],[1043,2],[1054,1],[1094,3],[1098,1],[1128,1],[1162,1],[1216,1],[1245,1],[1253,3],[1257,1],[1305,3],[1635,1],[1664,1],[1685,1],[1711,1],[1721,1],[1766,1],[1847,1],[1913,1],[1933,1],[1938,1],[1940,2],[1943,2],[2114,2],[2284,1],[2396,1],[2454,1],[2500,1],[2552,1],[2568,2],[2576,1],[2616,2],[2624,1],[2681,2],[2689,1],[2785,2],[2793,1],[2902,2],[2910,1],[3013,2],[3021,1],[3164,2],[3172,1],[3268,2],[3276,1],[3407,2],[3415,1],[3545,2],[3553,1],[3649,2],[3657,1]]},"481":{"position":[[179,2],[220,1],[287,1],[321,1],[416,1],[431,1],[540,1],[552,1],[568,1],[1037,1],[1055,1],[1152,1],[1154,1],[1215,1],[1303,1],[1305,1],[1937,2],[1980,1],[2084,1],[2120,1],[2235,1],[2250,1],[2394,1],[2406,1],[2422,1],[2539,1],[2557,1],[2598,1],[2617,1],[2732,1],[2734,1],[2795,1],[2883,1],[2885,1]]},"483":{"position":[[562,1],[669,1]]},"484":{"position":[[231,1],[297,1],[577,1],[647,1]]},"485":{"position":[[476,1],[493,1],[495,2],[522,2],[554,2],[574,2],[594,1],[596,2],[623,2],[655,2],[675,1],[677,1]]},"488":{"position":[[246,1],[248,1],[255,1],[287,1],[321,1]]},"495":{"position":[[967,1],[969,8]]},"503":{"position":[[234,1],[266,1],[293,1],[342,1],[375,1],[412,1],[501,1],[569,1],[632,1]]},"504":{"position":[[328,1],[360,1],[387,1],[436,1],[468,1],[510,1],[585,1],[654,1],[717,1],[765,1],[813,1]]},"505":{"position":[[182,1],[214,1],[241,1],[290,1],[322,1],[365,1],[443,1],[512,1],[575,1],[638,1]]},"514":{"position":[[428,1],[486,1],[513,1],[572,1],[665,1],[782,1],[825,1],[894,1],[949,1],[1336,1],[1338,2],[1394,2],[1422,1],[1456,2],[1513,2],[1542,1],[1558,2],[1613,2],[1643,2],[1700,1],[1799,1],[1840,2],[1892,1],[1941,1],[1987,1],[2020,1],[2042,2],[2109,2],[2143,2],[2198,2],[2254,2],[2338,1],[2354,1],[2417,2],[2434,1],[2474,2],[2610,2],[2650,2],[2665,1],[2750,2],[2765,1],[2804,2],[2870,2],[2899,2],[2916,1],[2953,2],[3067,2],[3139,2],[3397,1],[3527,1],[3563,1],[3623,1],[3652,1]]},"515":{"position":[[259,3],[263,2],[271,1],[350,2],[358,1],[402,2],[410,1],[454,2],[462,1]]},"519":{"position":[[379,1],[412,1],[440,1],[1009,1],[1087,1],[1188,1]]},"522":{"position":[[372,1]]},"528":{"position":[[59,1],[88,1],[116,1],[155,1],[204,1],[256,1],[289,1],[330,1],[371,1],[392,1],[431,1],[470,1],[510,1],[518,1],[571,1]]},"529":{"position":[[147,1]]},"535":{"position":[[1255,1],[1304,1]]},"536":{"position":[[312,1],[326,1],[423,1],[520,1]]},"537":{"position":[[124,1],[278,1],[293,1],[338,1],[409,1],[478,1],[533,1],[535,2],[589,1],[591,1],[949,1],[1043,1],[1058,1],[1088,1],[1199,1],[1260,1],[1275,1],[1342,1],[1344,1]]},"539":{"position":[[517,2],[578,1],[604,2],[680,1],[701,2],[791,1],[793,1],[812,2],[815,2],[915,1],[926,2],[951,1],[1005,1],[1039,1],[1041,3],[1171,1],[1263,1],[1270,3],[1274,1],[1276,3],[1375,1],[1436,1],[1443,3],[1447,1],[1449,3],[1524,1],[1531,1],[1629,1],[1631,1],[1633,1],[1635,2],[1735,1],[1767,1],[1769,2],[1880,1],[1882,3],[1921,3],[1958,1],[1960,2],[2070,1],[2086,1],[2088,2],[2206,1],[2222,1]]},"540":{"position":[[79,1]]},"541":{"position":[[225,1],[375,3],[556,1],[558,1],[580,1],[673,1],[675,1],[779,1],[781,1],[783,1],[785,2],[788,1],[810,1],[900,1],[902,1],[1006,2],[1009,1],[1111,1],[1113,1],[1115,1],[1117,2],[1120,1],[1142,1],[1235,1],[1237,1],[1341,1],[1343,1],[1345,1],[1347,1],[1349,2],[1372,1],[1374,1],[1505,2],[1508,1],[1641,1],[1643,2],[1672,1],[1674,1],[1857,1],[1859,1],[1992,1],[1994,2],[2116,2],[2119,1],[2286,3],[2409,1],[2411,2],[2434,1],[2436,1],[2513,2],[2516,1],[2593,1],[2595,2],[2616,1],[2805,1],[2807,1],[3017,2],[3020,1],[3222,2],[3225,1],[3435,2],[3438,1],[3571,2],[3574,1],[3705,1],[3707,1],[3709,1],[3711,1]]},"544":{"position":[[187,1],[324,1],[339,1],[369,1],[413,1],[482,1],[506,1],[552,2],[578,1],[778,2],[781,1],[783,1]]},"547":{"position":[[274,1],[298,1],[337,1],[460,1],[509,1],[511,2],[514,2],[663,2],[779,1]]},"551":{"position":[[11,3],[85,3],[146,1],[148,3],[196,3],[279,1]]},"552":{"position":[[11,3],[38,3],[42,3],[71,3],[163,1],[165,3],[187,3],[191,3],[272,1],[297,1],[299,3],[1022,3],[1026,3],[1122,1],[1147,1],[1149,3],[1232,1],[1263,1],[1265,3]]},"553":{"position":[[34,1],[130,1],[140,1],[160,2],[233,2],[321,1],[433,1],[435,3]]},"556":{"position":[[119,1],[218,1],[233,1],[274,1],[383,1],[385,1]]},"559":{"position":[[333,1],[381,1]]},"562":{"position":[[172,1],[299,1],[314,1],[354,1],[713,1],[715,1]]},"564":{"position":[[354,1],[505,1],[529,1],[609,1],[635,1],[678,2],[702,1],[774,1],[867,1],[893,1],[937,2],[962,1],[1035,1],[1100,1],[1102,1],[2057,1]]},"567":{"position":[[407,1],[516,1],[784,1],[853,1],[969,1],[1006,1],[1036,1],[1073,1],[1104,1],[1142,1],[1171,1],[1214,1],[1226,1],[1276,1],[1325,1],[1337,1],[1387,1],[1389,1],[1509,3],[1541,3],[2235,1],[2247,1],[2290,1]]},"568":{"position":[[423,1],[487,1],[858,1],[871,1],[949,1],[955,1],[1013,1],[1061,1],[1650,1],[1705,1]]},"569":{"position":[[229,1],[280,1],[585,1],[628,1],[651,1],[689,1],[718,1],[761,1],[780,1],[829,1],[855,1],[905,1],[932,1],[934,1]]},"570":{"position":[[282,1],[348,1],[605,1],[611,1],[620,1],[629,1],[634,1],[734,1]]},"585":{"position":[[26,3],[97,3],[160,1],[162,3],[210,3],[293,1],[295,3],[322,3],[326,3],[355,3],[447,1],[449,3],[493,3],[497,3],[578,1],[603,1],[605,3],[701,1],[726,1],[728,3],[811,1],[842,1],[844,3],[882,3],[983,1],[1013,1],[1015,1],[1040,1],[1136,1],[1146,1],[1166,2],[1239,2],[1327,1],[1439,1],[1472,1],[1482,1],[1520,1],[1578,1],[1747,1],[1749,1]]},"586":{"position":[[65,1],[78,1]]},"590":{"position":[[15,3],[23,1],[25,3],[36,1],[38,1],[40,3],[62,1],[64,1],[66,3],[80,1],[82,1],[84,3],[98,1],[100,3],[111,3],[124,3],[139,3]]},"591":{"position":[[301,1],[361,1],[401,1],[461,1],[506,1],[580,1],[916,1],[930,1],[970,1],[980,1]]},"592":{"position":[[227,1],[274,1],[309,1],[383,1],[468,1],[505,1],[585,1],[637,1],[700,1],[717,1],[765,1],[778,1],[786,1],[793,1],[814,1],[816,1],[891,1],[1010,1],[1086,1],[1206,1],[1284,1],[1297,2],[1325,1],[1384,1],[1429,1],[1431,1],[1452,1],[1523,1],[1558,1],[1599,1],[1601,1],[1680,1],[1706,1],[1814,1],[1878,3],[1882,1],[1967,1],[2002,1],[2084,1],[2146,3],[2150,1],[2152,1],[2238,1],[2272,1],[2355,1],[2417,3],[2421,1],[2423,1],[2425,1]]},"596":{"position":[[243,1],[271,1],[305,1],[351,1],[378,1],[415,1],[445,1],[447,1]]},"598":{"position":[[147,2],[188,1],[230,2],[295,2],[359,2],[422,2],[642,1],[676,1],[705,1],[926,1],[964,2],[1021,1],[1050,1],[1063,1],[1065,2],[1190,1],[1226,1],[1274,1],[1311,1],[1357,1],[1393,1],[1395,2],[1506,1],[1543,1],[1545,1]]},"599":{"position":[[147,1],[173,1],[227,1],[270,2],[273,1]]},"600":{"position":[[99,1],[152,1],[185,1],[214,1],[297,1],[330,1],[332,2],[357,1],[364,2],[395,1],[437,1],[460,1],[462,1]]},"601":{"position":[[106,1],[159,1],[198,1],[248,1],[250,2],[326,2],[448,1],[500,1],[539,1],[585,1],[621,1],[623,1],[666,1],[727,1],[764,1],[823,1],[888,1],[951,1],[997,1],[1052,1],[1093,1],[1095,1],[1173,1],[1175,2],[1288,1],[1317,1],[1346,1],[1430,1],[1473,1],[1501,1],[1546,1],[1560,1],[1625,1],[1657,1],[1671,1],[1730,1],[1787,1],[1801,1],[1850,1],[1878,1],[1880,1]]},"602":{"position":[[96,1],[157,1],[191,1],[220,1],[248,1],[285,1],[316,1],[360,1],[387,1],[418,1],[455,1],[485,1],[524,1],[526,1],[1010,1],[1043,1],[1077,1],[1079,2],[1157,2],[1205,2],[1256,1],[1284,1],[1329,1],[1352,1],[1378,3],[1382,1],[1444,1],[1468,1],[1492,1],[1504,1],[1545,1],[1547,1],[1599,1],[1623,1],[1647,1],[1664,1],[1716,1],[1718,1],[1720,2],[1822,1],[1846,1],[1848,1]]},"604":{"position":[[139,1],[216,1],[287,2],[315,1],[419,1],[421,2],[458,1],[460,1]]},"605":{"position":[[67,1],[87,1],[122,1],[169,1],[195,1],[199,1],[201,1],[240,1],[244,1],[248,1]]},"606":{"position":[[72,1],[118,1],[158,1],[210,1],[278,1],[303,1],[320,1],[355,1],[389,1],[437,1],[462,1],[499,1],[525,1],[527,1]]},"608":{"position":[[122,1],[151,1],[182,1],[211,1],[250,1],[295,1],[297,1],[329,1],[331,1],[360,1],[373,1],[508,1],[564,1],[616,1],[618,1]]},"609":{"position":[[236,1]]},"610":{"position":[[76,1],[112,1],[151,2],[211,1],[236,1],[246,1],[279,1],[350,3],[373,1],[445,3],[475,4],[480,1],[482,1]]},"611":{"position":[[106,1],[128,1],[151,1],[156,1],[219,1],[265,1],[288,1],[341,1],[343,1],[408,1],[422,1],[483,1],[538,1],[540,1],[542,1]]},"612":{"position":[[515,1],[552,1],[580,1],[582,1],[613,1],[637,1],[662,1],[699,1],[727,1],[729,1],[760,1],[784,1],[809,1],[846,1],[874,1],[876,1],[907,1],[954,1],[979,1],[1016,1],[1031,1],[1033,1],[1064,1],[1111,1],[1136,1],[1173,1],[1188,1],[1190,1],[1221,1],[1269,1],[1294,1],[1331,1],[1346,1],[1348,1]]},"613":{"position":[[87,1],[151,1],[163,1],[187,1],[199,1],[203,1],[207,1],[227,1],[231,1],[238,1],[243,1],[247,1],[252,1],[257,1],[259,1],[271,2],[287,1],[291,1],[306,1],[310,1],[312,1],[377,1],[434,1],[450,1],[452,1],[485,1],[498,1],[505,1],[523,1],[565,1],[613,1],[654,1],[664,1],[690,1],[733,1],[766,1],[779,1],[834,1],[836,1],[871,1],[906,1],[939,1],[981,1],[995,1],[1038,1],[1060,1],[1109,1],[1224,1],[1226,1]]},"616":{"position":[[109,2],[187,1],[267,1],[277,1],[304,1],[503,1],[505,1],[552,1],[583,1],[624,1],[626,3],[708,1],[920,3],[924,1],[926,3],[1019,1],[1029,1],[1052,1],[1113,2],[1145,1],[1147,1]]},"617":{"position":[[103,1],[141,1],[172,1],[226,1],[269,1],[311,1],[331,1],[359,1],[372,1],[452,1],[472,1],[474,2],[529,1],[549,1],[551,2],[598,1],[600,1],[602,1],[604,1],[606,1],[685,1],[748,1],[759,1],[761,1]]},"625":{"position":[[368,1],[434,1],[666,1],[668,3],[687,4],[699,1],[726,1],[728,2],[738,1],[775,1],[797,1],[829,1],[850,1],[873,1],[898,1],[907,1],[1129,1],[1212,1]]},"626":{"position":[[273,1],[304,1],[331,1],[533,1],[562,1],[671,1],[673,1],[686,1],[812,1],[829,1],[947,1],[980,1],[1035,3],[1039,1],[1041,1],[1043,1],[1120,1],[1133,1],[1207,1],[1310,1],[1324,1],[1443,1],[1517,1],[1529,1],[1637,1],[1680,3],[1684,1],[1722,1],[1772,1],[1774,2],[1886,1],[1944,1],[2015,1],[2117,1],[2167,3],[2171,1],[2242,1],[2285,1],[2334,1],[2446,1],[2496,3],[2500,1],[2502,1],[2515,1],[2613,1],[2667,1],[2715,1],[2827,1],[2887,3],[2891,1],[2990,1],[3006,1],[3091,1],[3141,1],[3234,1],[3297,3],[3301,1],[3303,1],[3320,1],[3420,1],[3503,1],[3540,1],[3600,1],[3602,1],[3619,1],[3656,1],[3678,1],[3710,1],[3731,1],[3754,1],[3779,1],[3788,1],[3790,1],[3815,1],[3817,2],[3849,1]]},"632":{"position":[[236,3],[333,3],[546,1],[548,2],[596,1],[630,2],[700,1],[716,2],[761,1],[860,1],[901,2],[939,1],[1039,2],[1155,2],[1255,2],[1305,2],[1346,2],[1407,2],[1470,1],[1475,1],[1484,2],[1550,2],[1737,2],[1740,1],[1742,3],[1831,1],[1842,1],[1891,1],[1936,1],[1960,1],[1995,1],[2014,1],[2056,2],[2132,1],[2134,3],[2272,1],[2286,1],[2324,1],[2399,1],[2563,1],[2593,1],[2621,1],[2660,1],[2662,1],[2672,1],[2702,1],[2704,3],[2725,1],[2733,1],[2748,1],[2750,1],[2760,1],[2790,1],[2792,3],[2813,1],[2821,1],[2847,1],[2849,1],[2859,1],[2889,1],[2896,1],[2927,1],[2929,1],[2939,1],[2969,1],[2971,3],[2992,1],[3000,1],[3034,1],[3036,1],[3046,1],[3076,1],[3078,3],[3099,1],[3107,1],[3128,1],[3130,2],[3141,1],[3194,1],[3236,1],[3277,1],[3298,1],[3338,1],[3377,1],[3398,1],[3435,1],[3492,1],[3548,1],[3556,1],[3609,1],[3674,1],[3841,1],[3970,1],[4560,2],[4568,1],[4602,2],[4610,1],[4661,2],[4669,1],[4765,2],[4773,1],[4869,2],[4877,1],[4986,2],[4994,1],[5182,2],[5190,1],[5328,2],[5336,1],[5432,2],[5440,1],[5536,2],[5544,1],[5653,2],[5661,1],[5787,2],[5795,1],[5891,2],[5899,1],[5995,2],[6003,1],[6112,2],[6120,1],[6172,2],[6180,1],[6307,2],[6315,1],[6411,2],[6419,1],[6515,2],[6523,1]]},"642":{"position":[[457,1],[490,1],[518,1],[557,1],[606,1],[639,1],[684,1],[725,1],[746,1],[789,1],[828,1],[868,1],[876,1],[929,1]]},"643":{"position":[[143,1]]},"644":{"position":[[877,2],[909,1],[951,1],[953,3],[1022,1],[1024,2],[1055,1],[1097,1],[1099,3],[1155,1],[1329,1],[1351,1],[1383,1],[1404,1],[1427,1],[1452,1],[1461,1],[1607,1],[1690,1],[1692,2],[1745,1],[1795,3],[2212,1],[2286,1],[2713,1],[2821,1],[2938,1],[3321,1],[3359,1],[3482,1],[3879,1],[3939,1],[3941,2]]},"645":{"position":[[832,2],[962,1],[994,1],[1037,2],[1162,1],[1196,1],[1212,1],[1330,2],[1343,1],[2388,1],[2411,1],[2454,1],[2529,1],[2674,2],[2677,1],[3023,1],[3053,1],[3098,3],[3160,1],[3219,1],[3221,3],[3283,1],[3349,1],[3351,3]]},"646":{"position":[[276,1],[318,1],[520,1],[549,1],[658,1],[660,1],[673,1],[799,1],[816,1],[934,1],[967,1],[1022,3],[1026,1],[1028,1],[1030,1],[1107,1],[1120,1],[1194,1],[1297,1],[1311,1],[1430,1],[1504,1],[1516,1],[1624,1],[1667,3],[1671,1],[1709,1],[1752,1],[1754,2],[1866,1],[1924,1],[1995,1],[2097,1],[2147,3],[2151,1],[2222,1],[2265,1],[2307,1],[2419,1],[2469,3],[2473,1],[2475,1],[2488,1],[2586,1],[2640,1],[2681,1],[2793,1],[2853,3],[2857,1],[2956,1],[2972,1],[3057,1],[3100,1],[3193,1],[3256,3],[3260,1],[3262,1],[3279,1],[3410,1],[3493,1],[3554,1],[3614,1],[3616,1],[3633,1],[3692,1],[3714,1],[3746,1],[3767,1],[3790,1],[3815,1],[3824,1],[3826,1],[3851,1],[3939,2],[4021,2],[4045,1],[4092,1],[4130,1],[4162,1],[4213,1],[4223,1],[4243,1],[4304,1],[4422,1],[4424,1],[4426,1],[4428,1],[4458,1],[4460,2],[4528,1],[4539,2],[4714,2],[4808,2],[4904,1],[4978,1],[4980,3],[4984,1],[5014,1],[5016,2],[5062,1],[5073,2],[5124,1],[5160,1],[5193,1],[5254,2],[5373,2],[5376,2],[5472,2],[5566,1],[5616,1],[5618,3],[5622,1],[5652,1],[5654,2],[5700,1],[5711,2],[5781,1],[5814,1],[5843,1],[5858,2],[5950,1],[5952,2],[5970,1]]},"651":{"position":[[232,1],[265,1],[280,1],[282,2],[349,1],[365,1],[367,3],[439,3]]},"653":{"position":[[405,1],[407,3],[498,3],[564,3],[639,3],[698,3],[762,1],[764,3],[827,1],[873,1],[1370,3],[1483,1],[1485,2],[1593,1],[1648,1],[1650,2],[1745,2],[1761,1],[1827,1],[1829,2],[1898,2],[1943,2],[2044,1],[2049,1],[2054,1],[2063,1],[2628,3],[2715,1],[2717,2],[2812,1],[2848,1],[2877,2],[2989,2],[3041,1],[3066,3],[3070,1],[3447,3],[3518,1],[3520,2],[3598,1],[3654,1],[3656,2],[3731,1],[3857,1],[3912,1],[3914,2],[3951,1],[3984,1],[4013,1],[4063,1],[4082,1],[4099,1],[4111,2],[4127,1],[4134,1],[4145,2],[4161,1],[4163,2],[4287,1],[4289,2],[4362,1],[4386,1],[4512,1],[4514,2],[4563,1]]},"654":{"position":[[151,1],[161,1],[195,1],[214,1],[343,2],[360,1],[408,2],[451,2],[508,2],[668,2],[773,2],[828,1],[833,1],[842,2],[877,2],[1033,2],[1139,2],[1337,2],[1481,1],[1486,1],[1510,2],[1621,1]]},"656":{"position":[[176,3],[239,1],[285,1],[287,3],[367,1],[369,3],[422,1],[427,3],[472,1],[477,3],[521,1],[526,3],[551,1],[556,3],[634,1],[639,1],[641,3],[715,3],[777,1],[779,3],[869,3],[935,3],[1010,3],[1069,3],[1133,1],[1135,3],[1162,3],[1166,3],[1195,3],[1288,1],[1290,3],[1456,1],[1458,2],[1626,1],[1628,2],[1694,1],[1710,1],[1712,3],[1785,3],[1839,3],[1888,3],[1989,3],[2088,3],[2311,2],[2314,3],[2382,3],[2454,3],[2538,3],[2620,3],[2726,3],[2883,3],[3038,3],[3183,3],[3327,3],[3454,3],[3636,3],[3760,3],[3885,1],[3887,1],[3889,3],[4002,1],[4004,2],[4110,1],[4165,1],[4167,2],[4262,2],[4278,1],[4345,1],[4347,2],[4416,2],[4461,2],[4562,1],[4567,1],[4572,1],[4581,1],[4583,3],[4670,1],[4672,2],[4767,1],[4803,1],[4832,2],[4943,2],[4995,1],[5020,3],[5024,1],[5026,3],[5097,1],[5099,2],[5177,1],[5233,1],[5235,2],[5310,1],[5436,1],[5491,1],[5493,2],[5530,1],[5563,1],[5592,1],[5642,1],[5661,1],[5678,1],[5690,2],[5706,1],[5713,1],[5724,2],[5740,1],[5742,2],[5867,1],[5869,2],[5942,1],[5966,1],[6092,1],[6094,2],[6143,1],[6183,1],[6224,1],[6280,1],[6298,1],[6424,1],[6473,1],[6475,1],[6477,1],[6502,1],[6566,1],[6576,1],[6610,1],[6629,1],[6758,2],[6775,1],[6823,2],[6866,2],[6923,2],[7083,2],[7188,2],[7243,1],[7248,1],[7257,2],[7292,2],[7448,2],[7554,2],[7752,2],[7896,1],[7901,1],[7925,2],[8036,1],[8038,1]]},"658":{"position":[[460,2],[553,1],[616,1],[654,1],[669,1],[671,2],[771,1],[853,1],[887,1],[981,1],[992,1],[1003,1],[1044,1],[1061,2],[1070,1],[1087,1],[1089,1],[1091,2],[1162,1],[1168,1],[1242,1],[1371,1],[1373,1],[1375,2],[1461,1],[1521,1],[1523,2],[1586,1],[1630,1]]},"659":{"position":[[376,1],[416,1],[444,1],[487,1],[519,1],[551,1],[646,1],[714,1],[777,1],[827,1],[891,1],[938,1],[1087,1],[1127,1],[1155,1],[1192,1],[1222,1],[1264,1],[1309,1],[1353,1],[1401,1]]},"660":{"position":[[361,1],[428,1],[492,1],[508,1]]},"661":{"position":[[166,2],[169,2],[234,1],[287,1],[352,1],[412,1],[491,1],[554,1],[611,1],[626,1],[685,1],[707,1],[808,1],[863,2],[921,1],[1076,1],[1182,2],[1185,1],[1227,2],[1304,1],[1313,1],[1315,2],[1417,1],[1424,1],[1433,1],[1435,1],[1472,1],[1474,2],[1543,1],[1572,1],[1601,2],[1666,1],[1709,2],[1788,1],[1831,2],[1892,2],[1975,1],[2030,1],[2040,2],[2115,1],[2117,2],[2182,1],[2229,1],[2254,1],[2262,3],[2266,1],[2268,2],[2357,2],[2421,2],[2490,1],[2518,1],[2520,1],[2549,1],[2551,2],[2594,1],[2634,1],[2655,1],[2680,1],[2709,2],[2812,1],[2861,1],[2863,2],[2914,1],[2931,1],[2995,1],[3031,1],[3054,1],[3071,1],[3106,1],[3135,2],[3238,1],[3250,1],[3264,1],[3486,1],[3488,2],[3550,2],[3582,2],[3633,2],[3683,2],[3731,2],[3873,1],[3887,1],[4004,1],[4054,1],[4100,1],[4117,1],[4145,1],[4266,1],[4456,1],[4517,1],[4528,1],[4610,1],[4618,1],[4632,2],[4641,1],[4655,2],[4658,2],[4661,1],[4709,1],[4784,1],[4856,1]]},"665":{"position":[[108,1],[150,1],[352,1]]},"666":{"position":[[36,1],[131,1],[144,1],[287,1],[325,1],[354,1],[394,1],[425,1],[463,1],[496,1],[540,1],[577,1],[579,1],[592,1],[663,1],[765,1],[815,3],[819,1],[821,1],[858,1],[941,1],[1494,1],[1560,1]]},"667":{"position":[[255,1],[257,3],[336,1],[349,1],[423,1],[526,1],[540,1],[659,1],[733,1],[745,1],[853,1],[896,3],[900,1],[965,1],[1010,1],[1095,1],[1153,1],[1155,1],[1168,1],[1170,3],[1270,1],[1290,1],[1364,1],[1412,1],[1535,1],[1595,3],[1599,1],[1698,1],[1714,1],[1774,1],[1824,1],[1844,1],[1960,1],[2023,3],[2027,1],[2029,1],[2066,1],[2126,1],[2163,1],[2185,1],[2212,1],[2217,1]]},"668":{"position":[[36,1],[141,1],[188,1],[226,1],[258,1],[309,1],[319,1],[339,1],[400,1],[512,1],[514,1],[516,1],[518,1],[548,1],[550,2],[618,1],[629,2],[804,2],[898,2],[994,1],[1068,1],[1070,3],[1074,1],[1104,1],[1106,2],[1152,1],[1163,2],[1214,1],[1250,1],[1283,1],[1344,2],[1463,2],[1466,2],[1562,2],[1656,1],[1706,1],[1708,3],[1712,1],[1742,1],[1744,2],[1790,1],[1801,2],[1871,1],[1904,1],[1933,1],[1948,2],[2040,1],[2087,1],[2110,1],[2153,1],[2237,1],[2273,1],[2359,2],[2437,2],[2594,1],[2635,1],[2637,3],[2641,2],[2790,2],[2930,2],[3054,1],[3113,1],[3115,3],[3177,1],[3243,1],[3245,3],[3249,2],[3313,1],[3348,1],[3350,2],[3396,1],[3407,2],[3480,1],[3555,1],[3596,2],[3739,2],[3742,1],[3744,1]]},"672":{"position":[[241,1],[308,1]]},"673":{"position":[[15,3],[60,3],[96,1],[191,1],[206,1],[315,1],[353,1],[373,1],[413,1],[435,1],[473,1],[497,1],[541,1],[569,1],[634,1],[667,1],[752,1],[791,1],[868,1],[910,1],[1013,1],[1067,1],[1141,1],[1180,1],[1224,1],[1251,1],[1317,1],[1361,1],[1432,1],[1525,1],[1527,1]]},"678":{"position":[[81,1],[123,1],[165,1],[333,1]]},"679":{"position":[[40,1],[85,1],[128,1],[182,1],[252,1],[289,3],[293,1],[295,1],[332,1],[360,1],[365,1],[410,1],[474,1]]},"680":{"position":[[40,1],[42,3],[104,1],[123,2],[163,1],[200,1],[202,1],[268,1],[337,1],[430,1],[487,3],[491,1],[535,1],[571,1],[657,1],[659,1],[661,1],[698,1],[709,1],[740,1],[767,1],[772,1]]},"681":{"position":[[34,1],[148,1],[167,1],[201,1],[219,1],[247,2],[329,1],[365,1],[393,1],[504,1],[541,1],[543,2],[546,1],[588,1],[620,1],[645,1],[836,1],[873,1],[875,2],[878,1],[927,1],[955,1],[980,1],[1130,2],[1133,1],[1135,1]]},"687":{"position":[[213,2],[386,2],[407,1],[455,1],[474,1],[517,1],[574,1],[616,1],[672,1],[713,1],[752,1],[789,1],[817,1],[842,1],[865,1],[891,1],[898,1],[923,1],[963,1],[971,2],[998,1],[1112,1],[1148,1],[1248,1],[1288,1],[1547,2],[1605,3],[1609,2],[1612,1],[1682,1],[1692,1],[1717,1],[1773,2],[1814,1],[1899,1],[1985,2],[2051,1],[2125,2],[2128,2],[2131,2],[2177,1],[2209,3],[2213,1],[2286,1],[2296,1],[2320,1],[2358,1],[2384,1],[2408,2],[2514,2],[2523,1],[2571,1],[2588,1],[2686,2],[2741,2],[2768,1],[2816,1],[2818,2],[2886,1],[2926,1],[2928,2],[3004,2],[3127,1],[3219,1],[3238,3],[3242,1],[3284,1],[3312,1],[3314,1],[4862,2],[4957,1],[4967,1],[5001,1],[5024,1],[5140,2],[5160,1],[5357,1],[5509,2],[5590,2],[5670,2],[5789,2],[5792,1],[6372,1],[6396,1],[6398,3],[6463,1],[6509,1],[6511,3],[6515,1]]},"688":{"position":[[86,1],[707,1],[729,1],[736,1],[760,1],[796,1],[841,1],[879,1],[944,1],[1001,1],[1003,2],[1125,1],[1135,1],[1159,1],[1185,1],[1220,1],[1343,1],[1388,2],[1524,1],[1566,1],[1594,1],[1596,1],[2256,3],[2295,1],[2297,3],[2317,1],[2337,1],[2344,1],[2386,1],[2388,3],[2422,1],[2458,1],[2460,3],[2523,1],[2525,2],[2579,1],[2642,2],[2824,1],[2894,1],[2896,2],[2933,3],[2937,2],[2997,1],[3084,2],[3101,3],[3105,1],[3190,1],[3200,1],[3224,1],[3263,1],[3279,2],[3348,1],[3383,1],[3385,3],[3389,2],[3450,2],[3497,2],[3545,1],[3611,1],[3626,2],[3649,1],[3698,1],[3785,1],[3787,1],[4628,2],[4757,2],[4782,1],[4792,1],[4826,1],[4849,1],[4965,2],[4981,1],[5054,1],[5326,1],[5454,2],[5658,2],[5713,1],[5820,1],[5881,1]]},"692":{"position":[[308,1],[325,1],[351,1],[360,1],[395,1],[418,1],[455,1],[478,1]]},"693":{"position":[[140,3],[166,1],[209,1],[238,1]]},"694":{"position":[[71,1],[112,1],[146,1],[185,1],[207,1],[253,1],[255,1],[290,1],[313,1],[357,1],[359,1],[361,1]]},"695":{"position":[[88,1],[118,1],[202,1],[233,3],[237,1],[269,1],[352,1],[383,3],[387,1],[389,1]]},"696":{"position":[[287,3],[312,3],[359,1],[421,1],[460,1],[494,1],[547,1],[577,1],[609,1],[639,1],[665,1],[697,1],[725,1],[765,1],[795,1],[797,1],[821,1],[913,1],[928,1],[965,1],[1144,2],[1184,1],[1186,1]]},"698":{"position":[[207,1],[223,1],[275,1],[397,1],[435,1],[437,3],[537,1],[578,1],[580,3],[670,1],[672,2],[710,1],[750,1],[809,1],[840,2],[907,1],[951,1],[953,2],[1083,1],[1138,1],[1164,3],[1168,1],[1170,3],[1264,1],[1266,2],[1294,1],[1296,3],[1406,1],[1408,2],[1436,1],[1438,3],[1511,1],[1513,2],[1541,1],[1543,1],[1545,3],[1637,1],[1653,1],[1674,1],[1699,1],[1703,1],[1705,3],[1758,1],[1799,1],[1801,3],[1860,1],[1901,1]]},"699":{"position":[[274,1],[330,1],[739,1],[775,1],[803,1],[842,1],[844,1],[851,1],[891,1],[899,1],[901,3],[905,1],[950,1],[952,1],[962,1],[992,1],[999,1],[1001,3],[1005,1],[1041,1],[1043,2],[1054,1],[1094,3],[1098,1],[1128,1],[1162,1],[1216,1],[1245,1],[1253,3],[1257,1],[1305,3],[1635,1],[1664,1],[1685,1],[1711,1],[1721,1],[1766,1],[1847,1],[1913,1],[1933,1],[1938,1],[1940,2],[1943,2],[2114,2],[2284,1],[2396,1],[2454,1],[2500,1],[2552,1],[2568,2],[2576,1],[2616,2],[2624,1],[2681,2],[2689,1],[2785,2],[2793,1],[2902,2],[2910,1],[3013,2],[3021,1],[3164,2],[3172,1],[3268,2],[3276,1],[3407,2],[3415,1],[3545,2],[3553,1],[3649,2],[3657,1]]},"704":{"position":[[243,1],[271,1],[305,1],[351,1],[378,1],[415,1],[445,1],[447,1]]},"706":{"position":[[147,2],[188,1],[230,2],[295,2],[359,2],[422,2],[642,1],[676,1],[705,1],[926,1],[964,2],[1021,1],[1050,1],[1063,1],[1065,2],[1190,1],[1226,1],[1274,1],[1311,1],[1357,1],[1393,1],[1395,2],[1506,1],[1543,1],[1545,1]]},"707":{"position":[[147,1],[173,1],[227,1],[270,2],[273,1]]},"708":{"position":[[99,1],[152,1],[185,1],[214,1],[297,1],[330,1],[332,2],[357,1],[364,2],[395,1],[437,1],[460,1],[462,1]]},"709":{"position":[[106,1],[159,1],[198,1],[248,1],[250,2],[326,2],[448,1],[500,1],[539,1],[585,1],[621,1],[623,1],[666,1],[727,1],[764,1],[823,1],[888,1],[951,1],[997,1],[1052,1],[1093,1],[1095,1],[1173,1],[1175,2],[1288,1],[1317,1],[1346,1],[1430,1],[1473,1],[1501,1],[1546,1],[1560,1],[1625,1],[1657,1],[1671,1],[1730,1],[1787,1],[1801,1],[1850,1],[1878,1],[1880,1]]},"710":{"position":[[96,1],[157,1],[191,1],[220,1],[248,1],[285,1],[316,1],[360,1],[387,1],[418,1],[455,1],[485,1],[524,1],[526,1],[1010,1],[1043,1],[1077,1],[1079,2],[1157,2],[1205,2],[1256,1],[1284,1],[1329,1],[1352,1],[1378,3],[1382,1],[1444,1],[1468,1],[1492,1],[1504,1],[1545,1],[1547,1],[1599,1],[1623,1],[1647,1],[1664,1],[1716,1],[1718,1],[1720,2],[1822,1],[1846,1],[1848,1]]},"712":{"position":[[139,1],[216,1],[287,2],[315,1],[419,1],[421,2],[458,1],[460,1]]},"713":{"position":[[67,1],[87,1],[122,1],[169,1],[195,1],[199,1],[201,1],[240,1],[244,1],[248,1]]},"714":{"position":[[72,1],[118,1],[158,1],[210,1],[278,1],[303,1],[320,1],[355,1],[389,1],[437,1],[462,1],[499,1],[525,1],[527,1]]},"716":{"position":[[122,1],[151,1],[182,1],[211,1],[250,1],[295,1],[297,1],[329,1],[331,1],[360,1],[373,1],[508,1],[564,1],[616,1],[618,1]]},"717":{"position":[[236,1]]},"718":{"position":[[76,1],[112,1],[151,2],[211,1],[236,1],[246,1],[279,1],[350,3],[373,1],[445,3],[475,4],[480,1],[482,1]]},"719":{"position":[[106,1],[128,1],[151,1],[156,1],[219,1],[265,1],[288,1],[341,1],[343,1],[408,1],[422,1],[483,1],[538,1],[540,1],[542,1]]},"720":{"position":[[515,1],[552,1],[580,1],[582,1],[613,1],[637,1],[662,1],[699,1],[727,1],[729,1],[760,1],[784,1],[809,1],[846,1],[874,1],[876,1],[907,1],[954,1],[979,1],[1016,1],[1031,1],[1033,1],[1064,1],[1111,1],[1136,1],[1173,1],[1188,1],[1190,1],[1221,1],[1269,1],[1294,1],[1331,1],[1346,1],[1348,1]]},"721":{"position":[[87,1],[151,1],[163,1],[187,1],[199,1],[203,1],[207,1],[227,1],[231,1],[238,1],[243,1],[247,1],[252,1],[257,1],[259,1],[271,2],[287,1],[291,1],[306,1],[310,1],[312,1],[377,1],[434,1],[450,1],[452,1],[485,1],[498,1],[505,1],[523,1],[565,1],[613,1],[654,1],[664,1],[690,1],[733,1],[766,1],[779,1],[834,1],[836,1],[871,1],[906,1],[939,1],[981,1],[995,1],[1038,1],[1060,1],[1109,1],[1224,1],[1226,1]]},"724":{"position":[[109,2],[187,1],[267,1],[277,1],[304,1],[503,1],[505,1],[552,1],[583,1],[624,1],[626,3],[708,1],[920,3],[924,1],[926,3],[1019,1],[1029,1],[1052,1],[1113,2],[1145,1],[1147,1]]},"725":{"position":[[103,1],[141,1],[172,1],[226,1],[269,1],[311,1],[331,1],[359,1],[372,1],[452,1],[472,1],[474,2],[529,1],[549,1],[551,2],[598,1],[600,1],[602,1],[604,1],[606,1],[685,1],[748,1],[759,1],[761,1]]}},"keywords":{}}],["0",{"_index":1387,"title":{},"content":{"73":{"position":[[203,1]]},"85":{"position":[[92,1],[519,2],[620,2]]},"157":{"position":[[507,1]]},"168":{"position":[[2014,1]]},"211":{"position":[[188,1],[226,1],[376,1],[536,1]]},"212":{"position":[[2596,2]]},"237":{"position":[[203,1]]},"254":{"position":[[92,1]]},"323":{"position":[[1639,1]]},"330":{"position":[[493,1]]},"348":{"position":[[2014,1]]},"390":{"position":[[188,1]]},"395":{"position":[[1938,2]]},"417":{"position":[[302,2]]},"419":{"position":[[424,2],[6717,2]]},"441":{"position":[[5409,2],[5494,2],[5604,2]]},"473":{"position":[[203,1]]},"485":{"position":[[92,1]]},"541":{"position":[[1639,1]]},"547":{"position":[[507,1]]},"564":{"position":[[2014,1]]},"599":{"position":[[186,2],[189,2],[192,4]]},"632":{"position":[[1938,2]]},"654":{"position":[[302,2]]},"656":{"position":[[424,2],[6717,2]]},"660":{"position":[[188,1]]},"688":{"position":[[5409,2],[5494,2],[5604,2]]},"707":{"position":[[186,2],[189,2],[192,4]]}},"keywords":{}}],["0..3",{"_index":3845,"title":{},"content":{"613":{"position":[[1033,4]]},"721":{"position":[[1033,4]]}},"keywords":{}}],["0..size",{"_index":2643,"title":{},"content":{"212":{"position":[[2107,7]]},"391":{"position":[[2107,7]]},"661":{"position":[[2107,7]]}},"keywords":{}}],["0.025ujunox",{"_index":1245,"title":{},"content":{"52":{"position":[[778,11]]}},"keywords":{}}],["0.2.0",{"_index":561,"title":{"19":{"position":[[5,5]]}},"content":{},"keywords":{}}],["0.8.0",{"_index":2793,"title":{},"content":{"264":{"position":[[5,5]]},"404":{"position":[[5,5]]},"641":{"position":[[5,5]]}},"keywords":{}}],["0.8.0prev",{"_index":2807,"title":{},"content":{"265":{"position":[[432,9]]},"266":{"position":[[115,9]]},"267":{"position":[[1262,9],[1499,9],[3289,9],[3826,9]]},"268":{"position":[[822,9],[2345,9],[2996,9]]},"269":{"position":[[89,9]]},"405":{"position":[[432,9]]},"406":{"position":[[115,9]]},"407":{"position":[[1262,9],[1499,9],[3289,9],[3826,9]]},"408":{"position":[[822,9],[2345,9],[2996,9]]},"409":{"position":[[89,9]]},"642":{"position":[[432,9]]},"643":{"position":[[115,9]]},"644":{"position":[[1262,9],[1499,9],[3289,9],[3826,9]]},"645":{"position":[[822,9],[2345,9],[2996,9]]},"646":{"position":[[89,9]]}},"keywords":{}}],["0.8.1",{"_index":1768,"title":{},"content":{"117":{"position":[[1182,5]]}},"keywords":{}}],["0.8.19",{"_index":1050,"title":{},"content":{"42":{"position":[[922,8]]}},"keywords":{}}],["0.9.0",{"_index":3088,"title":{},"content":{"382":{"position":[[5,5]]},"624":{"position":[[5,5]]}},"keywords":{}}],["0.9.00.8.0",{"_index":3091,"title":{},"content":{"383":{"position":[[304,10],[633,10],[1020,10]]},"625":{"position":[[304,10],[633,10],[1020,10]]}},"keywords":{}}],["0.9.0prev",{"_index":3094,"title":{},"content":{"384":{"position":[[89,9]]},"626":{"position":[[89,9]]}},"keywords":{}}],["0.into",{"_index":3850,"title":{},"content":{"613":{"position":[[1183,10]]},"721":{"position":[[1183,10]]}},"keywords":{}}],["001",{"_index":435,"title":{},"content":{"16":{"position":[[165,4]]}},"keywords":{}}],["01",{"_index":2990,"title":{},"content":{"323":{"position":[[340,2]]},"541":{"position":[[340,2]]}},"keywords":{}}],["0th",{"_index":1804,"title":{},"content":{"126":{"position":[[975,3]]},"198":{"position":[[3055,3],[3215,3]]},"277":{"position":[[975,3]]},"434":{"position":[[3037,3],[3197,3]]},"514":{"position":[[975,3]]},"681":{"position":[[3055,3],[3215,3]]}},"keywords":{}}],["0u8",{"_index":2212,"title":{},"content":{"185":{"position":[[292,5]]},"212":{"position":[[4101,5]]},"376":{"position":[[276,5]]},"391":{"position":[[4119,5]]},"592":{"position":[[276,5]]},"661":{"position":[[4119,5]]}},"keywords":{}}],["0x0..._0000_0000_0000",{"_index":2598,"title":{},"content":{"211":{"position":[[166,21],[204,21]]},"390":{"position":[[166,21]]},"660":{"position":[[166,21]]}},"keywords":{}}],["0x0..._0000_0000_0001",{"_index":2599,"title":{},"content":{"211":{"position":[[244,21]]},"390":{"position":[[204,21]]},"660":{"position":[[204,21]]}},"keywords":{}}],["0x0..._0000_0000_0010",{"_index":3096,"title":{},"content":{"390":{"position":[[244,21]]},"660":{"position":[[244,21]]}},"keywords":{}}],["0x0..._0000_0000_0011",{"_index":3097,"title":{},"content":{"390":{"position":[[288,21]]},"660":{"position":[[288,21]]}},"keywords":{}}],["0x0..._0000_0010_0000",{"_index":2600,"title":{},"content":{"211":{"position":[[288,21],[337,21]]}},"keywords":{}}],["0x0..._0000_0011_0001",{"_index":3098,"title":{},"content":{"390":{"position":[[324,21]]},"660":{"position":[[324,21]]}},"keywords":{}}],["0x0..._0000_0011_0010",{"_index":3099,"title":{},"content":{"390":{"position":[[391,21]]},"660":{"position":[[391,21]]}},"keywords":{}}],["0x0..._0010_0001_0000",{"_index":2602,"title":{},"content":{"211":{"position":[[404,21],[480,21]]}},"keywords":{}}],["0x0..._0011_0010_0001",{"_index":3100,"title":{},"content":{"390":{"position":[[454,21]]},"660":{"position":[[454,21]]}},"keywords":{}}],["0x0000",{"_index":1541,"title":{},"content":{"85":{"position":[[506,6]]}},"keywords":{}}],["0x0000_0000",{"_index":1542,"title":{},"content":{"85":{"position":[[530,11]]}},"keywords":{}}],["0x0000_0001",{"_index":1543,"title":{},"content":{"85":{"position":[[562,11]]}},"keywords":{}}],["0x0001",{"_index":1544,"title":{},"content":{"85":{"position":[[607,6]]},"254":{"position":[[506,6]]},"485":{"position":[[506,6]]}},"keywords":{}}],["0x0001_0000",{"_index":1545,"title":{},"content":{"85":{"position":[[631,11]]}},"keywords":{}}],["0x0001_0001",{"_index":1546,"title":{},"content":{"85":{"position":[[663,11]]},"254":{"position":[[530,11]]},"485":{"position":[[530,11]]}},"keywords":{}}],["0x0001_0001_1234_abcd",{"_index":1552,"title":{},"content":{"85":{"position":[[933,21]]},"254":{"position":[[933,21]]},"485":{"position":[[933,21]]}},"keywords":{}}],["0x0001_0010",{"_index":2781,"title":{},"content":{"254":{"position":[[562,11]]},"485":{"position":[[562,11]]}},"keywords":{}}],["0x0010",{"_index":2782,"title":{},"content":{"254":{"position":[[607,6]]},"485":{"position":[[607,6]]}},"keywords":{}}],["0x0010_0001",{"_index":2783,"title":{},"content":{"254":{"position":[[631,11]]},"485":{"position":[[631,11]]}},"keywords":{}}],["0x0010_0010",{"_index":2784,"title":{},"content":{"254":{"position":[[663,11]]},"485":{"position":[[663,11]]}},"keywords":{}}],["0x06",{"_index":3876,"title":{},"content":{"616":{"position":[[770,5]]},"724":{"position":[[770,5]]}},"keywords":{}}],["0x07",{"_index":3879,"title":{},"content":{"616":{"position":[[788,5]]},"724":{"position":[[788,5]]}},"keywords":{}}],["0x08",{"_index":3900,"title":{},"content":{"616":{"position":[[914,5]]},"724":{"position":[[914,5]]}},"keywords":{}}],["0x0b",{"_index":3873,"title":{},"content":{"616":{"position":[[752,5]]},"724":{"position":[[752,5]]}},"keywords":{}}],["0x10",{"_index":764,"title":{},"content":{"31":{"position":[[1424,4],[2292,4]]}},"keywords":{}}],["0x15",{"_index":3871,"title":{},"content":{"616":{"position":[[740,5]]},"724":{"position":[[740,5]]}},"keywords":{}}],["0x19",{"_index":3885,"title":{},"content":{"616":{"position":[[824,5]]},"724":{"position":[[824,5]]}},"keywords":{}}],["0x1e",{"_index":3887,"title":{},"content":{"616":{"position":[[836,5]]},"724":{"position":[[836,5]]}},"keywords":{}}],["0x22",{"_index":3881,"title":{},"content":{"616":{"position":[[800,5]]},"724":{"position":[[800,5]]}},"keywords":{}}],["0x42",{"_index":3883,"title":{},"content":{"616":{"position":[[812,5]]},"724":{"position":[[812,5]]}},"keywords":{}}],["0x45",{"_index":3889,"title":{},"content":{"616":{"position":[[848,5]]},"724":{"position":[[848,5]]}},"keywords":{}}],["0x4a",{"_index":3893,"title":{},"content":{"616":{"position":[[872,5]]},"724":{"position":[[872,5]]}},"keywords":{}}],["0x50",{"_index":3890,"title":{},"content":{"616":{"position":[[854,5]]},"724":{"position":[[854,5]]}},"keywords":{}}],["0x55",{"_index":3896,"title":{},"content":{"616":{"position":[[890,5]]},"724":{"position":[[890,5]]}},"keywords":{}}],["0x56",{"_index":3899,"title":{},"content":{"616":{"position":[[908,5]]},"724":{"position":[[908,5]]}},"keywords":{}}],["0x61",{"_index":3888,"title":{},"content":{"616":{"position":[[842,5]]},"724":{"position":[[842,5]]}},"keywords":{}}],["0x67",{"_index":3870,"title":{},"content":{"616":{"position":[[734,5]]},"724":{"position":[[734,5]]}},"keywords":{}}],["0x68",{"_index":3878,"title":{},"content":{"616":{"position":[[782,5]]},"724":{"position":[[782,5]]}},"keywords":{}}],["0x6b",{"_index":3886,"title":{},"content":{"616":{"position":[[830,5]]},"724":{"position":[[830,5]]}},"keywords":{}}],["0x70",{"_index":3892,"title":{},"content":{"616":{"position":[[866,5]]},"724":{"position":[[866,5]]}},"keywords":{}}],["0x81",{"_index":3884,"title":{},"content":{"616":{"position":[[818,5]]},"724":{"position":[[818,5]]}},"keywords":{}}],["0x84",{"_index":3882,"title":{},"content":{"616":{"position":[[806,5]]},"724":{"position":[[806,5]]}},"keywords":{}}],["0x86",{"_index":3869,"title":{},"content":{"616":{"position":[[728,5]]},"724":{"position":[[728,5]]}},"keywords":{}}],["0x89",{"_index":3880,"title":{},"content":{"616":{"position":[[794,5]]},"724":{"position":[[794,5]]}},"keywords":{}}],["0x96",{"_index":3874,"title":{},"content":{"616":{"position":[[758,5]]},"724":{"position":[[758,5]]}},"keywords":{}}],["0xa5",{"_index":3891,"title":{},"content":{"616":{"position":[[860,5]]},"724":{"position":[[860,5]]}},"keywords":{}}],["0xa7",{"_index":3895,"title":{},"content":{"616":{"position":[[884,5]]},"724":{"position":[[884,5]]}},"keywords":{}}],["0xb0",{"_index":3894,"title":{},"content":{"616":{"position":[[878,5]]},"724":{"position":[[878,5]]}},"keywords":{}}],["0xbb",{"_index":3872,"title":{},"content":{"616":{"position":[[746,5]]},"724":{"position":[[746,5]]}},"keywords":{}}],["0xbe",{"_index":3897,"title":{},"content":{"616":{"position":[[896,5]]},"724":{"position":[[896,5]]}},"keywords":{}}],["0xd7",{"_index":3898,"title":{},"content":{"616":{"position":[[902,5]]},"724":{"position":[[902,5]]}},"keywords":{}}],["0xe0",{"_index":3877,"title":{},"content":{"616":{"position":[[776,5]]},"724":{"position":[[776,5]]}},"keywords":{}}],["0xf0",{"_index":773,"title":{},"content":{"31":{"position":[[1685,4],[2316,4]]}},"keywords":{}}],["0xf1",{"_index":3875,"title":{},"content":{"616":{"position":[[764,5]]},"724":{"position":[[764,5]]}},"keywords":{}}],["1",{"_index":152,"title":{"260":{"position":[[0,2]]},"378":{"position":[[0,2]]},"400":{"position":[[0,2]]},"620":{"position":[[0,2]]},"637":{"position":[[0,2]]}},"content":{"3":{"position":[[497,1]]},"8":{"position":[[422,1],[458,1],[468,1]]},"17":{"position":[[1596,2],[4034,2]]},"30":{"position":[[341,2],[386,2]]},"39":{"position":[[2867,3]]},"51":{"position":[[811,2]]},"52":{"position":[[3344,1],[6512,1]]},"73":{"position":[[307,3],[430,3]]},"85":{"position":[[99,2],[552,1],[653,1]]},"131":{"position":[[460,1]]},"157":{"position":[[775,3]]},"163":{"position":[[929,3]]},"196":{"position":[[401,2]]},"197":{"position":[[712,2]]},"198":{"position":[[3131,1]]},"205":{"position":[[2237,2]]},"209":{"position":[[1232,3]]},"210":{"position":[[442,1],[1216,1]]},"211":{"position":[[266,1],[444,2],[520,2]]},"212":{"position":[[1505,2],[2909,2],[3043,2],[3567,2]]},"223":{"position":[[579,2],[1180,3]]},"237":{"position":[[307,3],[430,3]]},"254":{"position":[[99,2],[519,2],[620,2]]},"265":{"position":[[870,1]]},"311":{"position":[[512,1]]},"323":{"position":[[271,2],[1503,1]]},"330":{"position":[[751,3]]},"352":{"position":[[951,3]]},"354":{"position":[[631,2]]},"388":{"position":[[1164,3]]},"389":{"position":[[442,1],[1153,1]]},"390":{"position":[[226,1],[363,1],[510,1]]},"391":{"position":[[2596,2],[2657,2],[2933,2],[3073,2],[3585,2]]},"395":{"position":[[3550,1]]},"405":{"position":[[870,1]]},"417":{"position":[[505,2],[525,1],[1154,1]]},"419":{"position":[[474,2],[6920,2],[6940,1],[7569,1]]},"425":{"position":[[2187,2]]},"432":{"position":[[362,2]]},"433":{"position":[[711,2]]},"434":{"position":[[3113,1]]},"441":{"position":[[5549,2]]},"456":{"position":[[579,2],[1180,3]]},"473":{"position":[[307,3],[430,3]]},"476":{"position":[[1655,2]]},"477":{"position":[[2498,1],[3785,1],[3969,1]]},"485":{"position":[[99,2],[519,2],[620,2]]},"528":{"position":[[512,1]]},"541":{"position":[[271,2],[1503,1]]},"547":{"position":[[775,3]]},"568":{"position":[[951,3]]},"570":{"position":[[631,2]]},"598":{"position":[[784,3]]},"606":{"position":[[276,1],[299,3]]},"611":{"position":[[130,2]]},"613":{"position":[[209,2]]},"632":{"position":[[3550,1]]},"642":{"position":[[870,1]]},"654":{"position":[[505,2],[525,1],[1154,1]]},"656":{"position":[[474,2],[6920,2],[6940,1],[7569,1]]},"658":{"position":[[1164,3]]},"659":{"position":[[442,1],[1153,1]]},"660":{"position":[[226,1],[363,1],[510,1]]},"661":{"position":[[2596,2],[2657,2],[2933,2],[3073,2],[3585,2]]},"667":{"position":[[2187,2]]},"679":{"position":[[362,2]]},"680":{"position":[[711,2]]},"681":{"position":[[3131,1]]},"688":{"position":[[5549,2]]},"696":{"position":[[579,2],[1180,3]]},"698":{"position":[[1655,2]]},"699":{"position":[[2498,1],[3785,1],[3969,1]]},"706":{"position":[[784,3]]},"714":{"position":[[276,1],[299,3]]},"719":{"position":[[130,2]]},"721":{"position":[[209,2]]}},"keywords":{}}],["1"",{"_index":2620,"title":{},"content":{"212":{"position":[[371,8]]},"391":{"position":[[371,8]]},"661":{"position":[[371,8]]}},"keywords":{}}],["1.0.0",{"_index":3599,"title":{},"content":{"519":{"position":[[1182,5]]}},"keywords":{}}],["1.1",{"_index":2787,"title":{"261":{"position":[[0,4]]},"379":{"position":[[0,4]]},"401":{"position":[[0,4]]},"621":{"position":[[0,4]]},"638":{"position":[[0,4]]}},"content":{},"keywords":{}}],["1.1.0",{"_index":2959,"title":{},"content":{"298":{"position":[[1182,5]]}},"keywords":{}}],["1.2",{"_index":2789,"title":{"262":{"position":[[0,4]]},"380":{"position":[[0,4]]},"402":{"position":[[0,4]]},"622":{"position":[[0,4]]},"639":{"position":[[0,4]]}},"content":{},"keywords":{}}],["1.29",{"_index":1169,"title":{},"content":{"43":{"position":[[2066,4]]}},"keywords":{}}],["1.3",{"_index":1248,"title":{},"content":{"52":{"position":[[818,3]]}},"keywords":{}}],["1.36",{"_index":1170,"title":{},"content":{"43":{"position":[[2071,4]]}},"keywords":{}}],["1.77.0",{"_index":2986,"title":{},"content":{"323":{"position":[[309,6]]},"541":{"position":[[309,6]]}},"keywords":{}}],["1/secret_key.pem"",{"_index":3558,"title":{},"content":{"477":{"position":[[453,22]]},"699":{"position":[[453,22]]}},"keywords":{}}],["1/users/us",{"_index":3557,"title":{},"content":{"477":{"position":[[440,12]]},"699":{"position":[[440,12]]}},"keywords":{}}],["10",{"_index":803,"title":{},"content":{"31":{"position":[[3105,2]]},"205":{"position":[[2341,3]]},"206":{"position":[[228,3]]},"209":{"position":[[1384,4]]},"212":{"position":[[4840,2]]},"269":{"position":[[4132,3]]},"388":{"position":[[1316,4]]},"391":{"position":[[4858,2]]},"395":{"position":[[1334,2]]},"409":{"position":[[4132,3]]},"416":{"position":[[1971,2],[2051,2],[2310,2],[2465,2]]},"419":{"position":[[4489,2],[4564,2]]},"425":{"position":[[2291,3]]},"426":{"position":[[228,3]]},"601":{"position":[[1389,5],[1469,3]]},"632":{"position":[[1334,2]]},"646":{"position":[[4132,3]]},"653":{"position":[[1971,2],[2051,2],[2310,2],[2465,2]]},"656":{"position":[[4489,2],[4564,2]]},"658":{"position":[[1316,4]]},"661":{"position":[[4858,2]]},"667":{"position":[[2291,3]]},"668":{"position":[[228,3]]},"709":{"position":[[1389,5],[1469,3]]}},"keywords":{}}],["10.into",{"_index":3802,"title":{},"content":{"611":{"position":[[278,9]]},"719":{"position":[[278,9]]}},"keywords":{}}],["100",{"_index":3443,"title":{},"content":{"440":{"position":[[5135,4]]},"441":{"position":[[4960,4],[5497,5],[5607,5]]},"477":{"position":[[1637,4],[1951,3],[3403,3]]},"613":{"position":[[500,4]]},"687":{"position":[[5135,4]]},"688":{"position":[[4960,4],[5497,5],[5607,5]]},"699":{"position":[[1637,4],[1951,3],[3403,3]]},"721":{"position":[[500,4]]}},"keywords":{}}],["1000",{"_index":3112,"title":{},"content":{"394":{"position":[[135,4]]},"395":{"position":[[1477,6],[6649,4],[6682,4]]},"416":{"position":[[2056,6]]},"417":{"position":[[482,4],[835,6],[1488,6]]},"419":{"position":[[4574,6],[6897,4],[7250,6],[7903,6]]},"631":{"position":[[135,4]]},"632":{"position":[[1477,6],[6649,4],[6682,4]]},"653":{"position":[[2056,6]]},"654":{"position":[[482,4],[835,6],[1488,6]]},"656":{"position":[[4574,6],[6897,4],[7250,6],[7903,6]]}},"keywords":{}}],["100000000000",{"_index":2583,"title":{},"content":{"210":{"position":[[538,12]]},"389":{"position":[[538,12]]},"659":{"position":[[538,12]]}},"keywords":{}}],["100_000_000_000_000_000",{"_index":1630,"title":{},"content":{"95":{"position":[[342,26]]},"287":{"position":[[342,26]]},"499":{"position":[[342,26]]}},"keywords":{}}],["10]>",{"_index":3701,"title":{},"content":{"601":{"position":[[1247,8]]},"709":{"position":[[1247,8]]}},"keywords":{}}],["10_000",{"_index":2495,"title":{},"content":{"206":{"position":[[260,7]]},"269":{"position":[[4164,7]]},"409":{"position":[[4164,7]]},"426":{"position":[[260,7]]},"646":{"position":[[4164,7]]},"668":{"position":[[260,7]]}},"keywords":{}}],["10u8",{"_index":1816,"title":{},"content":{"126":{"position":[[1989,5]]},"277":{"position":[[2157,5]]},"514":{"position":[[1989,5]]}},"keywords":{}}],["11",{"_index":3135,"title":{},"content":{"395":{"position":[[1290,2]]},"417":{"position":[[830,2],[1483,2]]},"419":{"position":[[7245,2],[7898,2]]},"632":{"position":[[1290,2]]},"654":{"position":[[830,2],[1483,2]]},"656":{"position":[[7245,2],[7898,2]]}},"keywords":{}}],["11101:11101",{"_index":2574,"title":{},"content":{"210":{"position":[[133,11]]},"389":{"position":[[133,11]]},"477":{"position":[[142,11]]},"659":{"position":[[133,11]]},"699":{"position":[[142,11]]}},"keywords":{}}],["123",{"_index":2685,"title":{},"content":{"212":{"position":[[4609,4]]},"391":{"position":[[4627,4]]},"661":{"position":[[4627,4]]}},"keywords":{}}],["1234",{"_index":3789,"title":{},"content":{"609":{"position":[[230,5]]},"717":{"position":[[230,5]]}},"keywords":{}}],["130000000000",{"_index":1141,"title":{},"content":{"43":{"position":[[1077,12]]}},"keywords":{}}],["14101:14101",{"_index":2575,"title":{},"content":{"210":{"position":[[148,11]]},"389":{"position":[[148,11]]},"477":{"position":[[157,11]]},"659":{"position":[[148,11]]},"699":{"position":[[157,11]]}},"keywords":{}}],["143.87",{"_index":1167,"title":{},"content":{"43":{"position":[[2044,6]]}},"keywords":{}}],["15",{"_index":1851,"title":{},"content":{"127":{"position":[[368,3],[420,3],[772,2]]},"278":{"position":[[368,3],[420,3],[772,2]]},"395":{"position":[[4679,3],[4783,3],[5346,3],[5450,3],[5805,3],[5909,3],[6325,3],[6429,3]]},"477":{"position":[[2699,3],[3182,3],[3563,3]]},"515":{"position":[[368,3],[420,3],[772,2]]},"632":{"position":[[4679,3],[4783,3],[5346,3],[5450,3],[5805,3],[5909,3],[6325,3],[6429,3]]},"699":{"position":[[2699,3],[3182,3],[3563,3]]}},"keywords":{}}],["16).unwrap",{"_index":849,"title":{},"content":{"32":{"position":[[1657,12]]}},"keywords":{}}],["17",{"_index":263,"title":{},"content":{"9":{"position":[[151,3]]},"198":{"position":[[2238,2]]},"434":{"position":[[2228,2]]},"681":{"position":[[2238,2]]}},"keywords":{}}],["18",{"_index":1159,"title":{"412":{"position":[[4,2]]},"649":{"position":[[4,2]]}},"content":{"43":{"position":[[1843,2],[2030,2]]},"365":{"position":[[4,3],[34,2],[42,3],[167,2]]},"396":{"position":[[584,2]]},"416":{"position":[[448,2]]},"419":{"position":[[819,2]]},"581":{"position":[[4,3],[34,2],[42,3],[167,2]]},"633":{"position":[[584,2]]},"653":{"position":[[448,2]]},"656":{"position":[[819,2]]}},"keywords":{}}],["18101:18101",{"_index":2576,"title":{},"content":{"210":{"position":[[163,11]]},"389":{"position":[[163,11]]},"477":{"position":[[172,11]]},"659":{"position":[[163,11]]},"699":{"position":[[172,11]]}},"keywords":{}}],["19",{"_index":2412,"title":{},"content":{"198":{"position":[[3136,2]]},"434":{"position":[[3118,2]]},"681":{"position":[[3136,2]]}},"keywords":{}}],["1_000",{"_index":2703,"title":{},"content":{"219":{"position":[[348,6]]},"452":{"position":[[327,6]]},"692":{"position":[[327,6]]}},"keywords":{}}],["1_000.into",{"_index":2512,"title":{},"content":{"206":{"position":[[1285,13],[2275,13],[3557,13]]},"268":{"position":[[2531,13]]},"269":{"position":[[5195,13]]},"408":{"position":[[2531,13]]},"409":{"position":[[5195,13]]},"426":{"position":[[1280,13],[2265,13],[3532,13]]},"645":{"position":[[2531,13]]},"646":{"position":[[5195,13]]},"668":{"position":[[1285,13],[2275,13],[3557,13]]}},"keywords":{}}],["1_001",{"_index":2704,"title":{},"content":{"219":{"position":[[374,6]]},"452":{"position":[[353,6]]},"692":{"position":[[353,6]]}},"keywords":{}}],["1a8ba520e980c5abcbcfa6f62d68b6bb82e780544605de4dd5c6b1c5e966441b",{"_index":1282,"title":{},"content":{"52":{"position":[[3017,64]]}},"keywords":{}}],["2",{"_index":107,"title":{"263":{"position":[[0,2]]},"381":{"position":[[0,2]]},"403":{"position":[[0,2]]},"623":{"position":[[0,2]]},"640":{"position":[[0,2]]}},"content":{"2":{"position":[[302,1],[494,1],[558,1]]},"3":{"position":[[499,1]]},"11":{"position":[[158,1]]},"17":{"position":[[1624,2],[4065,2]]},"30":{"position":[[405,3]]},"32":{"position":[[834,1],[1729,2],[1753,1]]},"52":{"position":[[6487,1],[6661,1],[6713,2]]},"143":{"position":[[1216,3]]},"197":{"position":[[743,2]]},"205":{"position":[[2264,2]]},"211":{"position":[[310,2],[359,2],[426,3],[502,3]]},"212":{"position":[[2579,2],[2891,3],[3618,2]]},"254":{"position":[[552,1],[653,1]]},"328":{"position":[[1191,3]]},"354":{"position":[[622,2]]},"390":{"position":[[266,1],[430,1],[494,2]]},"391":{"position":[[1505,2],[2916,2],[3056,2],[3636,2]]},"419":{"position":[[523,2]]},"425":{"position":[[2214,2]]},"433":{"position":[[742,2]]},"476":{"position":[[1676,2]]},"485":{"position":[[552,1],[653,1]]},"537":{"position":[[1191,3]]},"570":{"position":[[622,2]]},"601":{"position":[[1365,2],[1416,2]]},"611":{"position":[[153,2]]},"613":{"position":[[205,1],[254,2],[1160,3]]},"656":{"position":[[523,2]]},"660":{"position":[[266,1],[430,1],[494,2]]},"661":{"position":[[1505,2],[2916,2],[3056,2],[3636,2]]},"667":{"position":[[2214,2]]},"680":{"position":[[742,2]]},"698":{"position":[[1676,2]]},"709":{"position":[[1365,2],[1416,2]]},"719":{"position":[[153,2]]},"721":{"position":[[205,1],[254,2],[1160,3]]}},"keywords":{}}],["2)"",{"_index":830,"title":{},"content":{"32":{"position":[[593,10]]}},"keywords":{}}],["2.1",{"_index":2792,"title":{"264":{"position":[[0,3]]},"382":{"position":[[0,3]]},"404":{"position":[[0,3]]},"624":{"position":[[0,3]]},"641":{"position":[[0,3]]}},"content":{},"keywords":{}}],["2.2",{"_index":2800,"title":{"265":{"position":[[0,4]]},"266":{"position":[[0,4]]},"383":{"position":[[0,3]]},"405":{"position":[[0,4]]},"406":{"position":[[0,4]]},"625":{"position":[[0,3]]},"642":{"position":[[0,4]]},"643":{"position":[[0,4]]}},"content":{},"keywords":{}}],["2.2.1",{"_index":3090,"title":{},"content":{"383":{"position":[[181,6]]},"625":{"position":[[181,6]]}},"keywords":{}}],["2.2.2",{"_index":3092,"title":{},"content":{"383":{"position":[[437,6]]},"625":{"position":[[437,6]]}},"keywords":{}}],["2.2.3",{"_index":3093,"title":{},"content":{"383":{"position":[[910,6]]},"625":{"position":[[910,6]]}},"keywords":{}}],["2.3",{"_index":2814,"title":{"267":{"position":[[0,4]]},"407":{"position":[[0,4]]},"644":{"position":[[0,4]]}},"content":{},"keywords":{}}],["2.3.1",{"_index":2816,"title":{},"content":{"267":{"position":[[236,6]]},"407":{"position":[[236,6]]},"644":{"position":[[236,6]]}},"keywords":{}}],["2.3.10",{"_index":2888,"title":{},"content":{"267":{"position":[[4005,7]]},"407":{"position":[[4005,7]]},"644":{"position":[[4005,7]]}},"keywords":{}}],["2.3.11",{"_index":2890,"title":{},"content":{"267":{"position":[[4147,7]]},"407":{"position":[[4147,7]]},"644":{"position":[[4147,7]]}},"keywords":{}}],["2.3.12",{"_index":2893,"title":{},"content":{"267":{"position":[[4291,7]]},"407":{"position":[[4291,7]]},"644":{"position":[[4291,7]]}},"keywords":{}}],["2.3.2",{"_index":2826,"title":{},"content":{"267":{"position":[[620,6]]},"407":{"position":[[620,6]]},"644":{"position":[[620,6]]}},"keywords":{}}],["2.3.3",{"_index":2831,"title":{},"content":{"267":{"position":[[781,6]]},"407":{"position":[[781,6]]},"644":{"position":[[781,6]]}},"keywords":{}}],["2.3.4",{"_index":2832,"title":{},"content":{"267":{"position":[[844,6]]},"407":{"position":[[844,6]]},"644":{"position":[[844,6]]}},"keywords":{}}],["2.3.5",{"_index":2834,"title":{},"content":{"267":{"position":[[1158,6]]},"407":{"position":[[1158,6]]},"644":{"position":[[1158,6]]}},"keywords":{}}],["2.3.6",{"_index":2843,"title":{},"content":{"267":{"position":[[1464,6]]},"407":{"position":[[1464,6]]},"644":{"position":[[1464,6]]}},"keywords":{}}],["2.3.7",{"_index":2844,"title":{},"content":{"267":{"position":[[1800,6]]},"407":{"position":[[1800,6]]},"644":{"position":[[1800,6]]}},"keywords":{}}],["2.3.8",{"_index":2878,"title":{},"content":{"267":{"position":[[3219,6]]},"407":{"position":[[3219,6]]},"644":{"position":[[3219,6]]}},"keywords":{}}],["2.3.9",{"_index":2882,"title":{},"content":{"267":{"position":[[3485,6]]},"407":{"position":[[3485,6]]},"644":{"position":[[3485,6]]}},"keywords":{}}],["2.4",{"_index":2896,"title":{"268":{"position":[[0,4]]},"408":{"position":[[0,4]]},"645":{"position":[[0,4]]}},"content":{},"keywords":{}}],["2.4.1",{"_index":2897,"title":{},"content":{"268":{"position":[[229,6]]},"408":{"position":[[229,6]]},"645":{"position":[[229,6]]}},"keywords":{}}],["2.4.2",{"_index":2908,"title":{},"content":{"268":{"position":[[1389,6]]},"408":{"position":[[1389,6]]},"645":{"position":[[1389,6]]}},"keywords":{}}],["2.4.3",{"_index":2920,"title":{},"content":{"268":{"position":[[2025,6]]},"408":{"position":[[2025,6]]},"645":{"position":[[2025,6]]}},"keywords":{}}],["2.4.4",{"_index":2924,"title":{},"content":{"268":{"position":[[2680,6]]},"408":{"position":[[2680,6]]},"645":{"position":[[2680,6]]}},"keywords":{}}],["2.into",{"_index":3852,"title":{},"content":{"613":{"position":[[1213,10]]},"721":{"position":[[1213,10]]}},"keywords":{}}],["20",{"_index":1627,"title":{"191":{"position":[[4,2]]},"420":{"position":[[4,2]]},"662":{"position":[[4,2]]}},"content":{"95":{"position":[[267,2]]},"198":{"position":[[3164,2]]},"204":{"position":[[1078,2]]},"207":{"position":[[77,2]]},"209":{"position":[[1434,4]]},"212":{"position":[[4768,2]]},"287":{"position":[[267,2]]},"388":{"position":[[1366,4]]},"391":{"position":[[4786,2]]},"424":{"position":[[1029,2]]},"427":{"position":[[77,2]]},"434":{"position":[[3146,2]]},"499":{"position":[[267,2]]},"658":{"position":[[1366,4]]},"661":{"position":[[4786,2]]},"666":{"position":[[1029,2]]},"669":{"position":[[77,2]]},"681":{"position":[[3164,2]]}},"keywords":{}}],["200",{"_index":3363,"title":{},"content":{"440":{"position":[[819,4]]},"687":{"position":[[819,4]]}},"keywords":{}}],["2000000000",{"_index":2592,"title":{},"content":{"210":{"position":[[1274,10]]},"389":{"position":[[1211,10]]},"659":{"position":[[1211,10]]}},"keywords":{}}],["201",{"_index":3365,"title":{},"content":{"440":{"position":[[844,4]]},"687":{"position":[[844,4]]}},"keywords":{}}],["202",{"_index":3367,"title":{},"content":{"440":{"position":[[867,4]]},"687":{"position":[[867,4]]}},"keywords":{}}],["2024",{"_index":2989,"title":{},"content":{"323":{"position":[[335,4]]},"541":{"position":[[335,4]]}},"keywords":{}}],["2025",{"_index":559,"title":{},"content":{"18":{"position":[[428,4]]}},"keywords":{}}],["203",{"_index":3369,"title":{},"content":{"440":{"position":[[893,4]]},"687":{"position":[[893,4]]}},"keywords":{}}],["204",{"_index":3496,"title":{},"content":{"441":{"position":[[2319,4]]},"688":{"position":[[2319,4]]}},"keywords":{}}],["205",{"_index":3497,"title":{},"content":{"441":{"position":[[2339,4]]},"688":{"position":[[2339,4]]}},"keywords":{}}],["20_000",{"_index":2200,"title":{},"content":{"184":{"position":[[1035,7]]},"375":{"position":[[932,7]]},"591":{"position":[[932,7]]}},"keywords":{}}],["20_001",{"_index":2202,"title":{},"content":{"184":{"position":[[1075,7]]},"375":{"position":[[972,7]]},"591":{"position":[[972,7]]}},"keywords":{}}],["20u64.pow(9",{"_index":3570,"title":{},"content":{"477":{"position":[[1687,13]]},"699":{"position":[[1687,13]]}},"keywords":{}}],["23",{"_index":264,"title":{},"content":{"9":{"position":[[168,3]]}},"keywords":{}}],["2324",{"_index":372,"title":{},"content":{"11":{"position":[[217,4]]}},"keywords":{}}],["25",{"_index":2409,"title":{},"content":{"198":{"position":[[2649,2]]},"434":{"position":[[2639,2]]},"681":{"position":[[2649,2]]}},"keywords":{}}],["25)"",{"_index":2991,"title":{},"content":{"323":{"position":[[343,10]]},"541":{"position":[[343,10]]}},"keywords":{}}],["256",{"_index":801,"title":{},"content":{"31":{"position":[[3044,3]]},"85":{"position":[[140,3]]},"254":{"position":[[140,3]]},"485":{"position":[[140,3]]}},"keywords":{}}],["26",{"_index":2333,"title":{},"content":{"196":{"position":[[800,2]]}},"keywords":{}}],["286",{"_index":1285,"title":{},"content":{"52":{"position":[[3340,3]]}},"keywords":{}}],["2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"",{"_index":1812,"title":{},"content":{"126":{"position":[[1713,71]]},"277":{"position":[[1881,71]]},"514":{"position":[[1713,71]]}},"keywords":{}}],["3",{"_index":118,"title":{"269":{"position":[[0,2]]},"384":{"position":[[0,2]]},"409":{"position":[[0,2]]},"626":{"position":[[0,2]]},"646":{"position":[[0,2]]}},"content":{"2":{"position":[[563,1]]},"32":{"position":[[1823,1]]},"131":{"position":[[521,1]]},"143":{"position":[[1220,3]]},"197":{"position":[[770,2]]},"212":{"position":[[3668,2]]},"265":{"position":[[931,1]]},"311":{"position":[[573,1]]},"328":{"position":[[1195,3]]},"354":{"position":[[613,2]]},"390":{"position":[[310,1],[346,2],[413,2],[476,3]]},"391":{"position":[[2579,2],[2897,4],[3686,2]]},"395":{"position":[[3611,1]]},"405":{"position":[[931,1]]},"419":{"position":[[553,2]]},"433":{"position":[[769,2]]},"476":{"position":[[1701,1]]},"528":{"position":[[573,1]]},"537":{"position":[[1195,3]]},"570":{"position":[[613,2]]},"601":{"position":[[1368,2],[1419,2]]},"632":{"position":[[3611,1]]},"642":{"position":[[931,1]]},"656":{"position":[[553,2]]},"660":{"position":[[310,1],[346,2],[413,2],[476,3]]},"661":{"position":[[2579,2],[2897,4],[3686,2]]},"680":{"position":[[769,2]]},"698":{"position":[[1701,1]]},"709":{"position":[[1368,2],[1419,2]]}},"keywords":{}}],["3.into",{"_index":3831,"title":{},"content":{"613":{"position":[[178,8]]},"721":{"position":[[178,8]]}},"keywords":{}}],["300",{"_index":3479,"title":{},"content":{"441":{"position":[[731,4]]},"688":{"position":[[731,4]]}},"keywords":{}}],["3000.into",{"_index":3284,"title":{},"content":{"417":{"position":[[1019,13]]},"419":{"position":[[7434,13]]},"654":{"position":[[1019,13]]},"656":{"position":[[7434,13]]}},"keywords":{}}],["300000000000",{"_index":1661,"title":{},"content":{"100":{"position":[[455,12]]},"101":{"position":[[309,12]]},"292":{"position":[[455,12]]},"293":{"position":[[309,12]]},"504":{"position":[[455,12]]},"505":{"position":[[309,12]]}},"keywords":{}}],["30_000",{"_index":2835,"title":{},"content":{"267":{"position":[[1353,7]]},"269":{"position":[[3716,7]]},"383":{"position":[[799,7]]},"384":{"position":[[3680,7]]},"407":{"position":[[1353,7]]},"409":{"position":[[3716,7]]},"625":{"position":[[799,7]]},"626":{"position":[[3680,7]]},"644":{"position":[[1353,7]]},"646":{"position":[[3716,7]]}},"keywords":{}}],["30_001",{"_index":2836,"title":{},"content":{"267":{"position":[[1385,7]]},"269":{"position":[[3748,7]]},"383":{"position":[[831,7]]},"384":{"position":[[3712,7]]},"407":{"position":[[1385,7]]},"409":{"position":[[3748,7]]},"625":{"position":[[831,7]]},"626":{"position":[[3712,7]]},"644":{"position":[[1385,7]]},"646":{"position":[[3748,7]]}},"keywords":{}}],["30_002",{"_index":2838,"title":{},"content":{"267":{"position":[[1406,7]]},"269":{"position":[[3769,7]]},"383":{"position":[[852,7]]},"384":{"position":[[3733,7]]},"407":{"position":[[1406,7]]},"409":{"position":[[3769,7]]},"625":{"position":[[852,7]]},"626":{"position":[[3733,7]]},"644":{"position":[[1406,7]]},"646":{"position":[[3769,7]]}},"keywords":{}}],["30_003",{"_index":2840,"title":{},"content":{"267":{"position":[[1429,7]]},"269":{"position":[[3792,7]]},"383":{"position":[[875,7]]},"384":{"position":[[3756,7]]},"407":{"position":[[1429,7]]},"409":{"position":[[3792,7]]},"625":{"position":[[875,7]]},"626":{"position":[[3756,7]]},"644":{"position":[[1429,7]]},"646":{"position":[[3792,7]]}},"keywords":{}}],["30_004",{"_index":2842,"title":{},"content":{"267":{"position":[[1454,6]]},"269":{"position":[[3817,6]]},"383":{"position":[[900,6]]},"384":{"position":[[3781,6]]},"407":{"position":[[1454,6]]},"409":{"position":[[3817,6]]},"625":{"position":[[900,6]]},"626":{"position":[[3781,6]]},"644":{"position":[[1454,6]]},"646":{"position":[[3817,6]]}},"keywords":{}}],["32",{"_index":2210,"title":{},"content":{"185":{"position":[[250,4],[298,4],[2509,2]]},"189":{"position":[[146,2]]},"212":{"position":[[4078,3],[4107,4]]},"366":{"position":[[146,2]]},"376":{"position":[[234,4],[282,4],[2493,2]]},"391":{"position":[[4096,3],[4125,4]]},"582":{"position":[[146,2]]},"592":{"position":[[234,4],[282,4],[2493,2]]},"599":{"position":[[265,4]]},"616":{"position":[[263,3],[1394,2]]},"661":{"position":[[4096,3],[4125,4]]},"707":{"position":[[265,4]]},"724":{"position":[[263,3],[1394,2]]}},"keywords":{}}],["321",{"_index":2686,"title":{},"content":{"212":{"position":[[4632,4]]},"391":{"position":[[4650,4]]},"661":{"position":[[4650,4]]}},"keywords":{}}],["32]>",{"_index":3867,"title":{},"content":{"616":{"position":[[574,8]]},"724":{"position":[[574,8]]}},"keywords":{}}],["32].fn",{"_index":2862,"title":{},"content":{"267":{"position":[[2646,6]]},"407":{"position":[[2646,6]]},"644":{"position":[[2646,6]]}},"keywords":{}}],["37",{"_index":804,"title":{},"content":{"31":{"position":[[3112,2]]}},"keywords":{}}],["38",{"_index":3516,"title":{},"content":{"441":{"position":[[3987,2]]},"688":{"position":[[3987,2]]}},"keywords":{}}],["3_000.into",{"_index":2528,"title":{},"content":{"206":{"position":[[2239,13]]},"426":{"position":[[2229,13]]},"668":{"position":[[2239,13]]}},"keywords":{}}],["4",{"_index":1857,"title":{"270":{"position":[[0,2]]},"385":{"position":[[0,2]]},"410":{"position":[[0,2]]},"627":{"position":[[0,2]]},"647":{"position":[[0,2]]}},"content":{"127":{"position":[[604,1]]},"211":{"position":[[322,2],[371,2],[439,2],[456,1],[515,2],[532,1]]},"212":{"position":[[1335,1],[2591,2],[2651,2],[2904,2],[2921,2],[3038,2],[3055,2],[3716,2]]},"278":{"position":[[604,1]]},"390":{"position":[[358,2],[425,2],[489,2],[506,1]]},"391":{"position":[[1335,1],[2591,2],[2652,2],[2911,2],[2928,2],[3051,2],[3068,2],[3734,2]]},"419":{"position":[[636,2]]},"515":{"position":[[604,1]]},"601":{"position":[[1371,2],[1422,2]]},"609":{"position":[[50,1]]},"656":{"position":[[636,2]]},"660":{"position":[[358,2],[425,2],[489,2],[506,1]]},"661":{"position":[[1335,1],[2591,2],[2652,2],[2911,2],[2928,2],[3051,2],[3068,2],[3734,2]]},"709":{"position":[[1371,2],[1422,2]]},"717":{"position":[[50,1]]}},"keywords":{}}],["4000",{"_index":1856,"title":{},"content":{"127":{"position":[[562,4]]},"278":{"position":[[562,4]]},"515":{"position":[[562,4]]}},"keywords":{}}],["4004",{"_index":1854,"title":{},"content":{"127":{"position":[[536,4]]},"278":{"position":[[536,4]]},"515":{"position":[[536,4]]}},"keywords":{}}],["456",{"_index":3680,"title":{},"content":{"600":{"position":[[359,4]]},"708":{"position":[[359,4]]}},"keywords":{}}],["48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26"",{"_index":3127,"title":{},"content":{"395":{"position":[[774,71]]},"632":{"position":[[774,71]]}},"keywords":{}}],["5",{"_index":1151,"title":{"271":{"position":[[0,2]]},"386":{"position":[[0,2]]},"411":{"position":[[0,2]]},"628":{"position":[[0,2]]},"648":{"position":[[0,2]]}},"content":{"43":{"position":[[1617,1]]},"141":{"position":[[1594,2]]},"143":{"position":[[1189,2]]},"326":{"position":[[1557,2]]},"328":{"position":[[1164,2]]},"535":{"position":[[1557,2]]},"537":{"position":[[1164,2]]},"601":{"position":[[1374,2],[1425,4]]},"709":{"position":[[1374,2],[1425,4]]}},"keywords":{}}],["50",{"_index":3528,"title":{},"content":{"441":{"position":[[5412,4],[5552,4]]},"688":{"position":[[5412,4],[5552,4]]}},"keywords":{}}],["5000000000000",{"_index":1650,"title":{},"content":{"99":{"position":[[361,13]]},"291":{"position":[[361,13]]},"503":{"position":[[361,13]]}},"keywords":{}}],["52",{"_index":805,"title":{},"content":{"31":{"position":[[3125,3]]}},"keywords":{}}],["52141844321b8321da71d073d4fa0865e73c3940153373ca7ef832d15bc3c2b2",{"_index":1295,"title":{},"content":{"52":{"position":[[6374,64]]},"53":{"position":[[117,64],[1005,64]]}},"keywords":{}}],["55",{"_index":2415,"title":{},"content":{"198":{"position":[[3429,2]]},"434":{"position":[[3411,2]]},"681":{"position":[[3429,2]]}},"keywords":{}}],["565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857",{"_index":3177,"title":{},"content":{"395":{"position":[[5117,64],[6893,65]]},"632":{"position":[[5117,64],[6893,65]]}},"keywords":{}}],["565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857"",{"_index":3176,"title":{},"content":{"395":{"position":[[5016,70],[5211,70],[5682,70],[6201,70]]},"632":{"position":[[5016,70],[5211,70],[5682,70],[6201,70]]}},"keywords":{}}],["5bd5d214e",{"_index":2988,"title":{},"content":{"323":{"position":[[324,10]]},"541":{"position":[[324,10]]}},"keywords":{}}],["6",{"_index":1303,"title":{},"content":{"53":{"position":[[241,1]]},"601":{"position":[[1377,2]]},"709":{"position":[[1377,2]]}},"keywords":{}}],["6"",{"_index":1240,"title":{},"content":{"52":{"position":[[680,7]]}},"keywords":{}}],["60",{"_index":3140,"title":{},"content":{"395":{"position":[[1472,2]]},"416":{"position":[[2046,2]]},"419":{"position":[[4569,2]]},"477":{"position":[[1930,2],[1935,2]]},"632":{"position":[[1472,2]]},"653":{"position":[[2046,2]]},"656":{"position":[[4569,2]]},"699":{"position":[[1930,2],[1935,2]]}},"keywords":{}}],["61047ff4000000000000000000000000000000000000000000000000000000000000000ai",{"_index":797,"title":{},"content":{"31":{"position":[[2910,74]]}},"keywords":{}}],["64",{"_index":1511,"title":{},"content":{"83":{"position":[[398,2]]},"85":{"position":[[1006,2]]},"252":{"position":[[398,2]]},"254":{"position":[[1006,2]]},"483":{"position":[[398,2]]},"485":{"position":[[1006,2]]}},"keywords":{}}],["660000",{"_index":3183,"title":{},"content":{"395":{"position":[[6162,6]]},"632":{"position":[[6162,6]]}},"keywords":{}}],["666",{"_index":2689,"title":{},"content":{"212":{"position":[[4693,3]]},"391":{"position":[[4711,3]]},"661":{"position":[[4711,3]]}},"keywords":{}}],["7",{"_index":833,"title":{},"content":{"32":{"position":[[830,1],[1749,1]]},"601":{"position":[[1380,2]]},"709":{"position":[[1380,2]]}},"keywords":{}}],["78",{"_index":3085,"title":{},"content":{"365":{"position":[[180,3],[210,2],[218,3],[348,2]]},"438":{"position":[[87,2]]},"439":{"position":[[123,2]]},"442":{"position":[[69,2]]},"581":{"position":[[180,3],[210,2],[218,3],[348,2]]},"685":{"position":[[87,2]]},"686":{"position":[[123,2]]},"689":{"position":[[69,2]]}},"keywords":{}}],["8",{"_index":799,"title":{},"content":{"31":{"position":[[3031,1]]},"143":{"position":[[610,3]]},"151":{"position":[[379,3]]},"211":{"position":[[779,1]]},"212":{"position":[[3789,1]]},"328":{"position":[[585,3]]},"342":{"position":[[379,3]]},"390":{"position":[[753,1]]},"391":{"position":[[3807,1]]},"537":{"position":[[585,3]]},"556":{"position":[[379,3]]},"601":{"position":[[1383,2]]},"660":{"position":[[753,1]]},"661":{"position":[[3807,1]]},"709":{"position":[[1383,2]]}},"keywords":{}}],["8dc53f95805349c3763cf4af9527cab2aebec77b240efd3801c61231d8748f26",{"_index":1290,"title":{},"content":{"52":{"position":[[4610,64]]}},"keywords":{}}],["9",{"_index":851,"title":{},"content":{"32":{"position":[[1757,1]]},"601":{"position":[[1386,2]]},"709":{"position":[[1386,2]]}},"keywords":{}}],["93.37",{"_index":1168,"title":{},"content":{"43":{"position":[[2051,5]]}},"keywords":{}}],["99",{"_index":3569,"title":{},"content":{"477":{"position":[[1666,3],[2126,2],[3907,2]]},"699":{"position":[[1666,3],[2126,2],[3907,2]]}},"keywords":{}}],["_",{"_index":2394,"title":{},"content":{"198":{"position":[[952,2]]},"212":{"position":[[2102,1],[4246,1]]},"391":{"position":[[2102,1],[4264,1]]},"434":{"position":[[942,2]]},"440":{"position":[[1797,3],[1801,2]]},"661":{"position":[[2102,1],[4264,1]]},"681":{"position":[[952,2]]},"687":{"position":[[1797,3],[1801,2]]}},"keywords":{}}],["__contract_main_purs",{"_index":1592,"title":{},"content":{"92":{"position":[[226,21]]},"94":{"position":[[682,22]]},"284":{"position":[[226,21]]},"286":{"position":[[682,22]]},"496":{"position":[[226,21]]},"498":{"position":[[682,22]]}},"keywords":{}}],["__event",{"_index":1579,"title":{},"content":{"91":{"position":[[342,8]]},"283":{"position":[[342,8]]},"495":{"position":[[342,8]]}},"keywords":{}}],["__events_schema",{"_index":1582,"title":{},"content":{"91":{"position":[[486,15],[661,15]]},"283":{"position":[[486,15],[661,15]]},"495":{"position":[[486,15],[661,15]]}},"keywords":{}}],["_contract_address",{"_index":1305,"title":{},"content":{"53":{"position":[[284,17],[585,17],[737,17]]}},"keywords":{}}],["_load(env",{"_index":1956,"title":{},"content":{"142":{"position":[[268,10]]},"327":{"position":[[268,10]]},"536":{"position":[[268,10]]}},"keywords":{}}],["_load_cep18(env",{"_index":3155,"title":{},"content":{"395":{"position":[[2219,16]]},"632":{"position":[[2219,16]]}},"keywords":{}}],["_max_int",{"_index":3651,"title":{},"content":{"598":{"position":[[1041,8]]},"706":{"position":[[1041,8]]}},"keywords":{}}],["_min_int",{"_index":3650,"title":{},"content":{"598":{"position":[[1012,8]]},"706":{"position":[[1012,8]]}},"keywords":{}}],["_mint(account",{"_index":1125,"title":{},"content":{"43":{"position":[[444,14]]}},"keywords":{}}],["_update(address",{"_index":1126,"title":{},"content":{"43":{"position":[[479,15]]}},"keywords":{}}],["a.checked_mul(b).expect("integ",{"_index":255,"title":{},"content":{"8":{"position":[[589,37]]}},"keywords":{}}],["abi",{"_index":1939,"title":{},"content":{"141":{"position":[[888,4],[1034,3]]},"326":{"position":[[888,4],[1034,3]]},"535":{"position":[[888,4],[1034,3]]}},"keywords":{}}],["abi.encodewithsignature("transfer(address,uint256)"",{"_index":3788,"title":{},"content":{"609":{"position":[[158,62]]},"717":{"position":[[158,62]]}},"keywords":{}}],["abil",{"_index":2720,"title":{},"content":{"222":{"position":[[25,7]]},"455":{"position":[[25,7]]},"695":{"position":[[25,7]]}},"keywords":{}}],["abov",{"_index":652,"title":{},"content":{"22":{"position":[[559,5]]},"99":{"position":[[85,5]]},"115":{"position":[[1597,5]]},"119":{"position":[[376,6]]},"126":{"position":[[3409,5]]},"127":{"position":[[11,5],[619,5]]},"136":{"position":[[205,5]]},"141":{"position":[[480,6]]},"145":{"position":[[175,5]]},"146":{"position":[[794,6]]},"147":{"position":[[1276,5]]},"148":{"position":[[515,5]]},"162":{"position":[[2048,6]]},"163":{"position":[[483,6]]},"164":{"position":[[1134,5]]},"168":{"position":[[1117,6]]},"197":{"position":[[780,5],[1109,5]]},"258":{"position":[[1543,5]]},"277":{"position":[[3577,5]]},"278":{"position":[[11,5],[619,5]]},"291":{"position":[[85,5]]},"300":{"position":[[376,6]]},"316":{"position":[[205,5]]},"326":{"position":[[480,6]]},"333":{"position":[[175,5]]},"334":{"position":[[798,6]]},"335":{"position":[[1284,5]]},"336":{"position":[[515,5]]},"348":{"position":[[1117,6]]},"351":{"position":[[2070,6]]},"352":{"position":[[505,6]]},"353":{"position":[[1169,5]]},"433":{"position":[[779,5],[1108,5]]},"481":{"position":[[1543,5]]},"503":{"position":[[85,5]]},"514":{"position":[[3409,5]]},"515":{"position":[[11,5],[619,5]]},"521":{"position":[[376,6]]},"533":{"position":[[205,5]]},"535":{"position":[[480,6]]},"550":{"position":[[175,5]]},"551":{"position":[[798,6]]},"552":{"position":[[1284,5]]},"553":{"position":[[515,5]]},"564":{"position":[[1117,6]]},"567":{"position":[[2070,6]]},"568":{"position":[[505,6]]},"569":{"position":[[1169,5]]},"606":{"position":[[722,6]]},"613":{"position":[[1359,6]]},"680":{"position":[[779,5],[1108,5]]},"714":{"position":[[722,6]]},"721":{"position":[[1359,6]]}},"keywords":{}}],["absenc",{"_index":1604,"title":{},"content":{"92":{"position":[[930,8]]},"284":{"position":[[930,8]]},"496":{"position":[[930,8]]}},"keywords":{}}],["abstract",{"_index":651,"title":{},"content":{"22":{"position":[[515,11]]},"42":{"position":[[1665,13]]},"93":{"position":[[111,11]]},"285":{"position":[[111,11]]},"497":{"position":[[111,11]]}},"keywords":{}}],["accept",{"_index":1404,"title":{},"content":{"74":{"position":[[15,6]]},"148":{"position":[[719,6]]},"238":{"position":[[15,6]]},"336":{"position":[[719,6]]},"395":{"position":[[4271,6]]},"474":{"position":[[15,6]]},"553":{"position":[[719,6]]},"602":{"position":[[127,9]]},"632":{"position":[[4271,6]]},"710":{"position":[[127,9]]}},"keywords":{}}],["accept_ownership",{"_index":2301,"title":{},"content":{"189":{"position":[[683,18]]},"366":{"position":[[683,18]]},"582":{"position":[[683,18]]}},"keywords":{}}],["access",{"_index":434,"title":{"181":{"position":[[0,6]]},"189":{"position":[[0,7]]},"366":{"position":[[0,7]]},"372":{"position":[[0,6]]},"582":{"position":[[0,7]]},"588":{"position":[[0,6]]}},"content":{"16":{"position":[[127,6]]},"79":{"position":[[1258,9],[1294,9]]},"103":{"position":[[663,6]]},"162":{"position":[[1394,6]]},"163":{"position":[[33,6]]},"182":{"position":[[65,6],[364,6]]},"183":{"position":[[0,6],[29,6]]},"184":{"position":[[790,6]]},"185":{"position":[[4002,7]]},"189":{"position":[[68,6],[271,6],[317,6]]},"204":{"position":[[1376,10]]},"230":{"position":[[1275,9],[1311,9]]},"267":{"position":[[1889,6]]},"295":{"position":[[663,6]]},"324":{"position":[[1194,6]]},"351":{"position":[[1416,6]]},"352":{"position":[[33,6]]},"366":{"position":[[68,6],[271,6],[317,6]]},"373":{"position":[[65,6],[364,6]]},"374":{"position":[[0,6],[29,6]]},"375":{"position":[[709,6]]},"376":{"position":[[3986,7]]},"407":{"position":[[1889,6]]},"419":{"position":[[1760,6],[1819,6]]},"424":{"position":[[1326,10]]},"438":{"position":[[250,6]]},"461":{"position":[[1275,9],[1311,9]]},"507":{"position":[[663,6]]},"542":{"position":[[1194,6]]},"567":{"position":[[1416,6]]},"568":{"position":[[33,6]]},"582":{"position":[[68,6],[271,6],[317,6]]},"589":{"position":[[65,6],[364,6]]},"590":{"position":[[0,6],[29,6]]},"591":{"position":[[709,6]]},"592":{"position":[[3986,7]]},"600":{"position":[[622,10],[1148,8]]},"603":{"position":[[110,9]]},"607":{"position":[[63,10]]},"609":{"position":[[293,6]]},"644":{"position":[[1889,6]]},"656":{"position":[[1760,6],[1819,6]]},"666":{"position":[[1326,10]]},"685":{"position":[[250,6]]},"708":{"position":[[622,10],[1148,8]]},"711":{"position":[[110,9]]},"715":{"position":[[63,10]]},"717":{"position":[[293,6]]}},"keywords":{}}],["access_control.r",{"_index":2176,"title":{},"content":{"183":{"position":[[44,17]]},"185":{"position":[[95,17]]},"374":{"position":[[44,17]]},"376":{"position":[[95,17]]},"590":{"position":[[44,17]]},"592":{"position":[[95,17]]}},"keywords":{}}],["accesscontrol",{"_index":2213,"title":{},"content":{"185":{"position":[[385,13],[507,13],[1454,13]]},"189":{"position":[[0,14]]},"366":{"position":[[0,14]]},"376":{"position":[[369,13],[491,13],[1438,13]]},"582":{"position":[[0,14]]},"592":{"position":[[369,13],[491,13],[1438,13]]}},"keywords":{}}],["accident",{"_index":1797,"title":{},"content":{"126":{"position":[[552,12]]},"277":{"position":[[552,12]]},"514":{"position":[[552,12]]}},"keywords":{}}],["accordingli",{"_index":1774,"title":{},"content":{"118":{"position":[[255,12]]},"299":{"position":[[255,12]]},"520":{"position":[[255,12]]}},"keywords":{}}],["account",{"_index":174,"title":{},"content":{"5":{"position":[[124,7]]},"42":{"position":[[2080,8]]},"43":{"position":[[400,8]]},"92":{"position":[[300,7],[423,7],[472,7],[573,7]]},"95":{"position":[[281,9],[296,7]]},"100":{"position":[[940,7]]},"101":{"position":[[661,7]]},"102":{"position":[[411,8]]},"126":{"position":[[217,7],[460,7],[939,9],[979,8]]},"129":{"position":[[130,9]]},"168":{"position":[[1728,7]]},"189":{"position":[[354,8],[387,7]]},"190":{"position":[[98,8]]},"194":{"position":[[247,8]]},"198":{"position":[[2117,7],[3059,8],[3095,8],[3219,8],[3416,8],[3449,7]]},"219":{"position":[[446,8],[530,8]]},"222":{"position":[[204,8],[354,8]]},"277":{"position":[[217,7],[460,7],[939,9],[979,8]]},"280":{"position":[[130,9]]},"284":{"position":[[300,7],[423,7],[472,7],[573,7]]},"287":{"position":[[281,9],[296,7]]},"292":{"position":[[940,7]]},"293":{"position":[[661,7]]},"294":{"position":[[411,8]]},"346":{"position":[[104,9]]},"348":{"position":[[1728,7]]},"366":{"position":[[354,8],[387,7]]},"367":{"position":[[98,8]]},"393":{"position":[[196,7],[291,7],[406,7]]},"394":{"position":[[275,7],[344,7],[500,7]]},"395":{"position":[[3706,7]]},"396":{"position":[[975,8],[1028,7],[1102,7]]},"397":{"position":[[349,8]]},"416":{"position":[[1451,8],[2126,7],[4368,9]]},"417":{"position":[[497,7],[1146,7]]},"419":{"position":[[3970,8],[5948,9],[6912,7],[7561,7]]},"430":{"position":[[247,8]]},"434":{"position":[[2107,7],[3041,8],[3077,8],[3201,8],[3398,8],[3431,7]]},"452":{"position":[[401,8],[461,8]]},"455":{"position":[[204,8],[354,8]]},"476":{"position":[[1333,8]]},"496":{"position":[[300,7],[423,7],[472,7],[573,7]]},"499":{"position":[[281,9],[296,7]]},"504":{"position":[[940,7]]},"505":{"position":[[661,7]]},"506":{"position":[[411,8]]},"514":{"position":[[217,7],[460,7],[939,9],[979,8]]},"517":{"position":[[130,9]]},"564":{"position":[[1728,7]]},"582":{"position":[[354,8],[387,7]]},"583":{"position":[[98,8]]},"598":{"position":[[1805,7]]},"607":{"position":[[208,7]]},"630":{"position":[[196,7],[291,7],[406,7]]},"631":{"position":[[275,7],[344,7],[500,7]]},"632":{"position":[[3706,7]]},"633":{"position":[[975,8],[1028,7],[1102,7]]},"634":{"position":[[349,8]]},"653":{"position":[[1451,8],[2126,7],[4368,9]]},"654":{"position":[[497,7],[1146,7]]},"656":{"position":[[3970,8],[5948,9],[6912,7],[7561,7]]},"677":{"position":[[247,8]]},"681":{"position":[[2117,7],[3059,8],[3095,8],[3219,8],[3416,8],[3449,7]]},"692":{"position":[[401,8],[461,8]]},"695":{"position":[[204,8],[354,8]]},"698":{"position":[[1333,8]]},"706":{"position":[[1805,7]]},"715":{"position":[[208,7]]}},"keywords":{}}],["account'",{"_index":1674,"title":{},"content":{"100":{"position":[[1136,9]]},"103":{"position":[[673,9]]},"292":{"position":[[1136,9]]},"295":{"position":[[673,9]]},"504":{"position":[[1136,9]]},"507":{"position":[[673,9]]}},"keywords":{}}],["accountfn",{"_index":2141,"title":{},"content":{"168":{"position":[[2019,9]]},"348":{"position":[[2019,9]]},"564":{"position":[[2019,9]]}},"keywords":{}}],["accounthash([0u8",{"_index":3672,"title":{},"content":{"599":{"position":[[247,17]]},"707":{"position":[[247,17]]}},"keywords":{}}],["accountid",{"_index":1055,"title":{},"content":{"42":{"position":[[1061,9],[1143,10]]}},"keywords":{}}],["accounts.l33",{"_index":2413,"title":{},"content":{"198":{"position":[[3167,12]]},"434":{"position":[[3149,12]]},"681":{"position":[[3167,12]]}},"keywords":{}}],["accur",{"_index":403,"title":{},"content":{"15":{"position":[[126,8]]}},"keywords":{}}],["achiev",{"_index":613,"title":{},"content":{"20":{"position":[[956,9]]},"612":{"position":[[1889,8]]},"720":{"position":[[1889,8]]}},"keywords":{}}],["act",{"_index":3473,"title":{},"content":{"441":{"position":[[372,3]]},"688":{"position":[[372,3]]}},"keywords":{}}],["action",{"_index":1165,"title":{"222":{"position":[[0,8]]},"455":{"position":[[0,8]]},"695":{"position":[[0,8]]}},"content":{"43":{"position":[[2019,6]]},"53":{"position":[[408,6],[681,6],[1173,6]]},"126":{"position":[[2135,7],[2191,6]]},"168":{"position":[[1625,6]]},"182":{"position":[[326,6]]},"184":{"position":[[16,7],[170,8],[705,8],[1163,6]]},"277":{"position":[[2303,7],[2359,6]]},"348":{"position":[[1625,6]]},"373":{"position":[[326,6]]},"375":{"position":[[16,7],[170,8],[624,8],[1060,6]]},"416":{"position":[[3483,6],[4304,6]]},"417":{"position":[[1774,7]]},"418":{"position":[[24,7]]},"419":{"position":[[5062,6],[5884,6]]},"514":{"position":[[2135,7],[2191,6]]},"564":{"position":[[1625,6]]},"589":{"position":[[326,6]]},"591":{"position":[[16,7],[170,8],[624,8],[1060,6]]},"598":{"position":[[2160,7]]},"600":{"position":[[1065,7]]},"606":{"position":[[658,7]]},"653":{"position":[[3483,6],[4304,6]]},"654":{"position":[[1774,7]]},"655":{"position":[[24,7]]},"656":{"position":[[5062,6],[5884,6]]},"706":{"position":[[2160,7]]},"708":{"position":[[1065,7]]},"714":{"position":[[658,7]]}},"keywords":{}}],["activ",{"_index":3593,"title":{},"content":{"477":{"position":[[4139,9]]},"699":{"position":[[4139,9]]}},"keywords":{}}],["actor.th",{"_index":2204,"title":{},"content":{"184":{"position":[[1202,9]]},"375":{"position":[[1099,9]]},"591":{"position":[[1099,9]]}},"keywords":{}}],["actual",{"_index":1540,"title":{},"content":{"85":{"position":[[447,6]]},"211":{"position":[[543,6]]},"254":{"position":[[447,6]]},"390":{"position":[[517,6]]},"485":{"position":[[447,6]]},"660":{"position":[[517,6]]}},"keywords":{}}],["ad",{"_index":1841,"title":{"154":{"position":[[0,6]]},"339":{"position":[[0,6]]},"559":{"position":[[0,6]]}},"content":{"126":{"position":[[3474,5]]},"131":{"position":[[646,5]]},"132":{"position":[[331,5]]},"197":{"position":[[1052,6]]},"265":{"position":[[195,5]]},"277":{"position":[[3642,5]]},"311":{"position":[[698,5]]},"312":{"position":[[331,5]]},"405":{"position":[[195,5]]},"419":{"position":[[1941,5],[2018,5]]},"433":{"position":[[1051,6]]},"441":{"position":[[4262,5],[4404,6]]},"514":{"position":[[3474,5]]},"528":{"position":[[698,5]]},"529":{"position":[[331,5]]},"613":{"position":[[1688,6]]},"642":{"position":[[195,5]]},"656":{"position":[[1941,5],[2018,5]]},"680":{"position":[[1051,6]]},"688":{"position":[[4262,5],[4404,6]]},"721":{"position":[[1688,6]]}},"keywords":{}}],["add",{"_index":762,"title":{"264":{"position":[[4,3]]},"404":{"position":[[4,3]]},"641":{"position":[[4,3]]}},"content":{"31":{"position":[[1397,3],[1672,3]]},"42":{"position":[[268,3],[1683,4]]},"93":{"position":[[97,4]]},"102":{"position":[[272,4]]},"115":{"position":[[1663,4]]},"118":{"position":[[174,3]]},"126":{"position":[[170,3]]},"141":{"position":[[1164,5],[1184,4]]},"143":{"position":[[909,5]]},"154":{"position":[[55,3],[110,3]]},"173":{"position":[[372,3],[404,3]]},"179":{"position":[[70,3]]},"196":{"position":[[651,3]]},"222":{"position":[[17,3]]},"258":{"position":[[1609,4]]},"264":{"position":[[193,3]]},"268":{"position":[[2878,4]]},"277":{"position":[[170,3]]},"285":{"position":[[97,4]]},"294":{"position":[[272,4]]},"299":{"position":[[174,3]]},"326":{"position":[[1164,5],[1184,4]]},"328":{"position":[[884,5]]},"339":{"position":[[55,3],[110,3]]},"354":{"position":[[156,3]]},"359":{"position":[[372,3],[404,3]]},"370":{"position":[[70,3]]},"382":{"position":[[11,4]]},"395":{"position":[[2438,3],[3623,3]]},"404":{"position":[[193,3]]},"408":{"position":[[2878,4]]},"416":{"position":[[319,3],[1317,3],[2992,3]]},"419":{"position":[[4946,3]]},"432":{"position":[[588,3]]},"455":{"position":[[17,3]]},"481":{"position":[[1609,4]]},"497":{"position":[[97,4]]},"506":{"position":[[272,4]]},"514":{"position":[[170,3]]},"520":{"position":[[174,3]]},"535":{"position":[[1164,5],[1184,4]]},"537":{"position":[[884,5]]},"559":{"position":[[55,3],[110,3]]},"570":{"position":[[156,3]]},"575":{"position":[[372,3],[404,3]]},"586":{"position":[[70,3]]},"624":{"position":[[11,4]]},"632":{"position":[[2438,3],[3623,3]]},"641":{"position":[[193,3]]},"645":{"position":[[2878,4]]},"653":{"position":[[319,3],[1317,3],[2992,3]]},"656":{"position":[[4946,3]]},"679":{"position":[[588,3]]},"695":{"position":[[17,3]]}},"keywords":{}}],["add(&self",{"_index":1945,"title":{},"content":{"141":{"position":[[1260,14]]},"326":{"position":[[1260,14]]},"535":{"position":[[1260,14]]}},"keywords":{}}],["add(i",{"_index":3754,"title":{},"content":{"605":{"position":[[210,6]]},"713":{"position":[[210,6]]}},"keywords":{}}],["add(uint256",{"_index":691,"title":{},"content":{"30":{"position":[[198,11]]}},"keywords":{}}],["add_to_x(&self",{"_index":3751,"title":{},"content":{"605":{"position":[[131,19]]},"713":{"position":[[131,19]]}},"keywords":{}}],["adder",{"_index":1944,"title":{},"content":{"141":{"position":[[1249,5]]},"143":{"position":[[1107,5]]},"326":{"position":[[1249,5]]},"328":{"position":[[1082,5]]},"535":{"position":[[1249,5]]},"537":{"position":[[1082,5]]}},"keywords":{}}],["addercontractref",{"_index":1948,"title":{},"content":{"141":{"position":[[1348,16]]},"326":{"position":[[1348,16]]},"535":{"position":[[1348,16]]}},"keywords":{}}],["addercontractref::new(self.env",{"_index":1951,"title":{},"content":{"141":{"position":[[1544,33]]},"326":{"position":[[1507,33]]},"535":{"position":[[1507,33]]}},"keywords":{}}],["adderhostref",{"_index":1949,"title":{},"content":{"141":{"position":[[1377,12]]},"326":{"position":[[1377,12]]},"535":{"position":[[1377,12]]}},"keywords":{}}],["adderhostref::new(&test_env",{"_index":1979,"title":{},"content":{"143":{"position":[[1115,32]]},"328":{"position":[[1090,32]]},"537":{"position":[[1090,32]]}},"keywords":{}}],["addit",{"_index":688,"title":{},"content":{"30":{"position":[[96,8]]},"51":{"position":[[1896,10]]},"126":{"position":[[928,10]]},"164":{"position":[[391,10]]},"168":{"position":[[19,10]]},"205":{"position":[[199,10]]},"277":{"position":[[928,10]]},"348":{"position":[[19,10]]},"353":{"position":[[426,10]]},"416":{"position":[[270,10]]},"425":{"position":[[199,10]]},"514":{"position":[[928,10]]},"564":{"position":[[19,10]]},"569":{"position":[[426,10]]},"599":{"position":[[410,8]]},"653":{"position":[[270,10]]},"667":{"position":[[199,10]]},"707":{"position":[[410,8]]}},"keywords":{}}],["addition",{"_index":1060,"title":{},"content":{"42":{"position":[[1303,13]]},"84":{"position":[[65,13]]},"85":{"position":[[680,13]]},"98":{"position":[[479,13]]},"99":{"position":[[102,13]]},"188":{"position":[[203,12],[599,12]]},"253":{"position":[[65,13]]},"254":{"position":[[680,13]]},"270":{"position":[[257,13]]},"290":{"position":[[479,13]]},"291":{"position":[[102,13]]},"365":{"position":[[560,12],[956,12]]},"385":{"position":[[257,13]]},"396":{"position":[[742,13]]},"410":{"position":[[257,13]]},"484":{"position":[[65,13]]},"485":{"position":[[680,13]]},"502":{"position":[[479,13]]},"503":{"position":[[102,13]]},"581":{"position":[[560,12],[956,12]]},"598":{"position":[[2055,13]]},"627":{"position":[[257,13]]},"633":{"position":[[742,13]]},"647":{"position":[[257,13]]},"706":{"position":[[2055,13]]}},"keywords":{}}],["addition_work",{"_index":811,"title":{},"content":{"31":{"position":[[3428,16]]}},"keywords":{}}],["additon",{"_index":3269,"title":{},"content":{"416":{"position":[[4716,12]]},"653":{"position":[[4716,12]]}},"keywords":{}}],["addr",{"_index":3686,"title":{},"content":{"601":{"position":[[222,5],[476,5],[570,5],[788,5],[916,5],[1028,5]]},"616":{"position":[[237,5]]},"709":{"position":[[222,5],[476,5],[570,5],[788,5],[916,5],[1028,5]]},"724":{"position":[[237,5]]}},"keywords":{}}],["addr).some_funct",{"_index":3912,"title":{},"content":{"617":{"position":[[416,22]]},"725":{"position":[[416,22]]}},"keywords":{}}],["address",{"_index":458,"title":{},"content":{"17":{"position":[[288,8],[574,9],[676,8],[1117,8],[1429,8],[1449,8],[2172,9],[2622,8],[2722,8],[3122,8],[3135,8],[3732,8],[3877,8],[3895,8]]},"31":{"position":[[1429,8]]},"39":{"position":[[1816,7]]},"42":{"position":[[130,7],[1053,7],[2100,7]]},"43":{"position":[[290,7],[501,7],[945,7]]},"51":{"position":[[978,8],[1250,7]]},"52":{"position":[[940,7],[1372,7],[1424,7],[1464,11],[1598,8],[1641,11],[4737,7],[4867,7],[6562,7]]},"71":{"position":[[109,7],[546,8]]},"80":{"position":[[590,8],[599,8],[792,8]]},"84":{"position":[[416,7]]},"94":{"position":[[145,8],[340,8],[469,8]]},"99":{"position":[[243,7]]},"100":{"position":[[337,7]]},"101":{"position":[[191,7]]},"107":{"position":[[160,8]]},"108":{"position":[[261,8]]},"110":{"position":[[571,10]]},"115":{"position":[[120,8],[622,8],[689,8],[709,8],[772,8],[988,8],[1044,8],[1062,8],[1137,8],[1196,9],[1237,8],[1246,8],[1932,8],[2520,8],[2580,8],[2655,8],[2720,8],[2740,9],[2837,8],[2846,8]]},"126":{"position":[[84,8],[671,7],[1561,9],[1584,9],[2561,8],[2657,7],[2757,7],[2943,9]]},"141":{"position":[[452,8],[461,9],[672,7],[1463,8]]},"142":{"position":[[318,7],[415,7],[511,8]]},"143":{"position":[[842,8],[1277,7]]},"151":{"position":[[25,10]]},"160":{"position":[[54,8]]},"168":{"position":[[1338,7],[1587,8],[1596,8],[1665,8],[1903,7],[1929,7]]},"184":{"position":[[356,8],[365,8],[386,7],[480,8],[489,8],[510,7],[747,9]]},"185":{"position":[[210,8],[426,9],[567,8],[642,10],[884,8],[1016,9],[1079,8],[1212,9],[1277,8],[1305,7],[1435,9],[1516,8],[1565,8],[1960,8],[2009,8],[2048,10],[2115,8],[2124,9],[2231,8],[2279,8],[2318,10],[2386,8],[2395,9],[2868,8],[3291,8]]},"196":{"position":[[114,8],[529,7]]},"197":{"position":[[81,8],[527,7],[1001,8]]},"198":{"position":[[139,8],[1385,9],[1782,7],[2100,7],[2915,7]]},"203":{"position":[[333,9]]},"204":{"position":[[646,8]]},"205":{"position":[[956,8],[2128,8],[2150,8]]},"210":{"position":[[385,7],[1159,7]]},"219":{"position":[[196,7],[455,7],[539,7]]},"231":{"position":[[590,8],[599,8],[792,8]]},"235":{"position":[[109,7],[546,8]]},"247":{"position":[[600,8],[1216,7],[1390,8]]},"253":{"position":[[416,7]]},"258":{"position":[[120,8],[608,8],[671,8],[691,8],[750,8],[946,8],[998,8],[1016,8],[1087,8],[1142,9],[1183,8],[1192,8],[1878,8],[2462,8],[2518,8],[2589,8],[2650,8],[2670,9],[2763,8],[2772,8]]},"267":{"position":[[1136,9],[2963,8],[3109,8],[3118,8],[3783,8]]},"269":{"position":[[230,8],[501,9],[1953,8],[2180,8],[3334,8],[3567,8],[3589,8]]},"274":{"position":[[160,8]]},"275":{"position":[[265,8]]},"277":{"position":[[84,8],[671,7],[1729,9],[1752,9],[2729,8],[2825,7],[2925,7],[3111,9]]},"286":{"position":[[145,8],[340,8],[469,8]]},"291":{"position":[[243,7]]},"292":{"position":[[337,7]]},"293":{"position":[[191,7]]},"305":{"position":[[571,10]]},"321":{"position":[[1162,8],[1758,8]]},"326":{"position":[[452,8],[461,9],[672,7],[1463,8]]},"327":{"position":[[318,7],[415,7],[511,8]]},"328":{"position":[[817,8],[1252,7]]},"342":{"position":[[25,10]]},"345":{"position":[[54,8]]},"348":{"position":[[1338,7],[1587,8],[1596,8],[1665,8],[1903,7],[1929,7]]},"375":{"position":[[323,8],[332,8],[353,7],[423,8],[432,8],[453,7],[666,9]]},"376":{"position":[[410,9],[551,8],[626,10],[868,8],[1000,9],[1063,8],[1196,9],[1261,8],[1289,7],[1419,9],[1500,8],[1549,8],[1944,8],[1993,8],[2032,10],[2099,8],[2108,9],[2215,8],[2263,8],[2302,10],[2370,8],[2379,9],[2852,8],[3275,8]]},"384":{"position":[[227,8],[514,9],[1973,8],[2200,8],[3375,9],[3553,8],[3575,8]]},"389":{"position":[[385,7],[1096,7]]},"395":{"position":[[736,10],[990,8],[2278,7],[2316,7],[2390,8],[3847,7],[4350,8],[5103,8],[6786,7]]},"396":{"position":[[99,7],[732,8]]},"407":{"position":[[1136,9],[2963,8],[3109,8],[3118,8],[3783,8]]},"409":{"position":[[230,8],[501,9],[1953,8],[2180,8],[3334,8],[3567,8],[3589,8]]},"416":{"position":[[836,8],[934,7],[1460,8],[2111,7]]},"419":{"position":[[106,8],[248,8],[1478,7],[2657,8],[2691,8],[3687,8],[3812,8],[3979,8]]},"423":{"position":[[333,9]]},"424":{"position":[[621,8]]},"425":{"position":[[931,8],[2079,8],[2101,8]]},"432":{"position":[[76,8],[466,7]]},"433":{"position":[[81,8],[527,7],[1000,8]]},"434":{"position":[[139,8],[1375,9],[1772,7],[2090,7]]},"440":{"position":[[169,8],[743,8],[6343,8],[6364,7]]},"441":{"position":[[641,8],[935,8],[1713,7],[1786,7],[1913,8],[2514,8],[2672,7],[3168,8],[3591,8],[3690,7],[4375,8]]},"446":{"position":[[600,8],[1216,7],[1390,8]]},"452":{"position":[[196,7],[410,7],[470,7]]},"462":{"position":[[590,8],[599,8],[792,8]]},"471":{"position":[[109,7],[546,8]]},"476":{"position":[[161,8],[702,7],[1140,8],[1372,8],[1764,8],[1773,8],[1866,8],[1875,8]]},"481":{"position":[[120,8],[608,8],[671,8],[691,8],[750,8],[946,8],[998,8],[1016,8],[1087,8],[1142,9],[1183,8],[1192,8],[1878,8],[2462,8],[2518,8],[2589,8],[2650,8],[2670,9],[2763,8],[2772,8]]},"484":{"position":[[416,7]]},"491":{"position":[[160,8]]},"492":{"position":[[265,8]]},"498":{"position":[[145,8],[340,8],[469,8]]},"503":{"position":[[243,7]]},"504":{"position":[[337,7]]},"505":{"position":[[191,7]]},"510":{"position":[[571,10]]},"514":{"position":[[84,8],[671,7],[1561,9],[1584,9],[2561,8],[2657,7],[2757,7],[2943,9]]},"535":{"position":[[452,8],[461,9],[672,7],[1463,8]]},"536":{"position":[[318,7],[415,7],[511,8]]},"537":{"position":[[817,8],[1252,7]]},"539":{"position":[[1162,8],[1758,8]]},"556":{"position":[[25,10]]},"562":{"position":[[54,8]]},"564":{"position":[[1338,7],[1587,8],[1596,8],[1665,8],[1903,7],[1929,7]]},"591":{"position":[[323,8],[332,8],[353,7],[423,8],[432,8],[453,7],[666,9]]},"592":{"position":[[410,9],[551,8],[626,10],[868,8],[1000,9],[1063,8],[1196,9],[1261,8],[1289,7],[1419,9],[1500,8],[1549,8],[1944,8],[1993,8],[2032,10],[2099,8],[2108,9],[2215,8],[2263,8],[2302,10],[2370,8],[2379,9],[2852,8],[3275,8]]},"598":{"position":[[117,8],[464,8],[1417,7],[1498,7],[1763,7],[1826,10],[1885,7]]},"599":{"position":[[68,9],[219,7]]},"601":{"position":[[44,8],[228,8],[482,8],[576,8],[794,8],[922,8],[1034,8]]},"608":{"position":[[56,8],[541,8]]},"609":{"position":[[221,8]]},"610":{"position":[[36,9],[86,8]]},"616":{"position":[[79,8],[243,8]]},"617":{"position":[[40,8],[217,8]]},"626":{"position":[[227,8],[514,9],[1973,8],[2200,8],[3375,9],[3553,8],[3575,8]]},"632":{"position":[[736,10],[990,8],[2278,7],[2316,7],[2390,8],[3847,7],[4350,8],[5103,8],[6786,7]]},"633":{"position":[[99,7],[732,8]]},"644":{"position":[[1136,9],[2963,8],[3109,8],[3118,8],[3783,8]]},"646":{"position":[[230,8],[501,9],[1953,8],[2180,8],[3334,8],[3567,8],[3589,8]]},"653":{"position":[[836,8],[934,7],[1460,8],[2111,7]]},"656":{"position":[[106,8],[248,8],[1478,7],[2657,8],[2691,8],[3687,8],[3812,8],[3979,8]]},"659":{"position":[[385,7],[1096,7]]},"665":{"position":[[333,9]]},"666":{"position":[[621,8]]},"667":{"position":[[931,8],[2079,8],[2101,8]]},"673":{"position":[[600,8],[1216,7],[1390,8]]},"679":{"position":[[76,8],[466,7]]},"680":{"position":[[81,8],[527,7],[1000,8]]},"681":{"position":[[139,8],[1385,9],[1782,7],[2100,7],[2915,7]]},"687":{"position":[[169,8],[743,8],[6343,8],[6364,7]]},"688":{"position":[[641,8],[935,8],[1713,7],[1786,7],[1913,8],[2514,8],[2672,7],[3168,8],[3591,8],[3690,7],[4375,8]]},"692":{"position":[[196,7],[410,7],[470,7]]},"698":{"position":[[161,8],[702,7],[1140,8],[1372,8],[1764,8],[1773,8],[1866,8],[1875,8]]},"706":{"position":[[117,8],[464,8],[1417,7],[1498,7],[1763,7],[1826,10],[1885,7]]},"707":{"position":[[68,9],[219,7]]},"709":{"position":[[44,8],[228,8],[482,8],[576,8],[794,8],[922,8],[1034,8]]},"716":{"position":[[56,8],[541,8]]},"717":{"position":[[221,8]]},"718":{"position":[[36,9],[86,8]]},"724":{"position":[[79,8],[243,8]]},"725":{"position":[[40,8],[217,8]]}},"keywords":{}}],["address).add(3",{"_index":1952,"title":{},"content":{"141":{"position":[[1578,15]]},"326":{"position":[[1541,15]]},"535":{"position":[[1541,15]]}},"keywords":{}}],["address,advanc",{"_index":2432,"title":{},"content":{"201":{"position":[[136,16]]},"421":{"position":[[136,16]]},"663":{"position":[[136,16]]}},"keywords":{}}],["address.execut",{"_index":1273,"title":{},"content":{"52":{"position":[[2056,15]]}},"keywords":{}}],["address.l22",{"_index":3513,"title":{},"content":{"441":{"position":[[3829,11]]},"688":{"position":[[3829,11]]}},"keywords":{}}],["address.role_admin",{"_index":2253,"title":{},"content":{"185":{"position":[[2723,18]]},"376":{"position":[[2707,18]]},"592":{"position":[[2707,18]]}},"keywords":{}}],["address::account",{"_index":3671,"title":{},"content":{"599":{"position":[[229,17]]},"707":{"position":[[229,17]]}},"keywords":{}}],["address::from_str",{"_index":3646,"title":{},"content":{"598":{"position":[[824,18]]},"706":{"position":[[824,18]]}},"keywords":{}}],["address::from_str(address).unwrap",{"_index":1829,"title":{},"content":{"126":{"position":[[2767,36]]},"142":{"position":[[425,36]]},"277":{"position":[[2935,36]]},"327":{"position":[[425,36]]},"395":{"position":[[2326,36]]},"514":{"position":[[2767,36]]},"536":{"position":[[425,36]]},"632":{"position":[[2326,36]]}},"keywords":{}}],["address::from_str(recipient).unwrap",{"_index":1813,"title":{},"content":{"126":{"position":[[1801,38]]},"277":{"position":[[1969,38]]},"395":{"position":[[862,38]]},"514":{"position":[[1801,38]]},"632":{"position":[[862,38]]}},"keywords":{}}],["addressable>(&self",{"_index":3072,"title":{},"content":{"348":{"position":[[2077,26]]}},"keywords":{}}],["addresses.each",{"_index":2167,"title":{},"content":{"182":{"position":[[156,14]]},"373":{"position":[[156,14]]},"589":{"position":[[156,14]]}},"keywords":{}}],["addressfn",{"_index":2134,"title":{},"content":{"168":{"position":[[1762,9]]},"348":{"position":[[1762,9]]},"564":{"position":[[1762,9]]}},"keywords":{}}],["adjust",{"_index":1247,"title":{},"content":{"52":{"position":[[807,10]]},"188":{"position":[[117,8],[511,8]]},"270":{"position":[[507,12]]},"365":{"position":[[474,8],[868,8]]},"385":{"position":[[507,12]]},"410":{"position":[[507,12]]},"441":{"position":[[2144,6]]},"581":{"position":[[474,8],[868,8]]},"627":{"position":[[507,12]]},"647":{"position":[[507,12]]},"688":{"position":[[2144,6]]}},"keywords":{}}],["admin",{"_index":1264,"title":{},"content":{"52":{"position":[[1356,5]]},"182":{"position":[[201,5],[220,5]]},"184":{"position":[[102,5],[865,5],[940,5]]},"185":{"position":[[796,5],[2772,5],[3839,5]]},"373":{"position":[[201,5],[220,5]]},"375":{"position":[[102,5],[784,5],[859,5]]},"376":{"position":[[780,5],[2756,5],[3823,5]]},"419":{"position":[[1492,6],[1716,5],[1870,5],[1966,6],[1993,6],[2027,5],[2123,5],[2160,5]]},"589":{"position":[[201,5],[220,5]]},"591":{"position":[[102,5],[784,5],[859,5]]},"592":{"position":[[780,5],[2756,5],[3823,5]]},"656":{"position":[[1492,6],[1716,5],[1870,5],[1966,6],[1993,6],[2027,5],[2123,5],[2160,5]]}},"keywords":{}}],["admin_list",{"_index":3305,"title":{},"content":{"419":{"position":[[2216,11]]},"656":{"position":[[2216,11]]}},"keywords":{}}],["admin_rol",{"_index":2223,"title":{},"content":{"185":{"position":[[722,10],[783,10],[1673,11],[1777,13],[1882,11]]},"376":{"position":[[706,10],[767,10],[1657,11],[1761,13],[1866,11]]},"592":{"position":[[706,10],[767,10],[1657,11],[1761,13],[1866,11]]}},"keywords":{}}],["advanc",{"_index":1409,"title":{"75":{"position":[[0,8]]},"77":{"position":[[0,8]]},"79":{"position":[[0,8]]},"226":{"position":[[0,8]]},"228":{"position":[[0,8]]},"230":{"position":[[0,8]]},"457":{"position":[[0,8]]},"459":{"position":[[0,8]]},"461":{"position":[[0,8]]}},"content":{"76":{"position":[[25,8]]},"79":{"position":[[291,8]]},"81":{"position":[[0,8]]},"168":{"position":[[1974,8]]},"201":{"position":[[78,8]]},"227":{"position":[[25,8]]},"230":{"position":[[308,8]]},"232":{"position":[[0,8]]},"348":{"position":[[1974,8]]},"395":{"position":[[1264,7]]},"421":{"position":[[78,8]]},"458":{"position":[[25,8]]},"461":{"position":[[308,8]]},"463":{"position":[[0,8]]},"564":{"position":[[1974,8]]},"618":{"position":[[354,8],[480,8]]},"632":{"position":[[1264,7]]},"663":{"position":[[78,8]]},"726":{"position":[[354,8],[480,8]]}},"keywords":{}}],["advance_block_tim",{"_index":3182,"title":{},"content":{"395":{"position":[[6122,18]]},"632":{"position":[[6122,18]]}},"keywords":{}}],["advance_block_time(&self",{"_index":2135,"title":{},"content":{"168":{"position":[[1772,29]]},"348":{"position":[[1772,29]]},"564":{"position":[[1772,29]]}},"keywords":{}}],["advancedstorag",{"_index":1478,"title":{"80":{"position":[[0,15]]},"231":{"position":[[0,15]]},"462":{"position":[[0,15]]}},"content":{"80":{"position":[[37,15],[240,15],[343,15]]},"231":{"position":[[37,15],[240,15],[343,15]]},"462":{"position":[[37,15],[240,15],[343,15]]}},"keywords":{}}],["advantag",{"_index":1174,"title":{},"content":{"44":{"position":[[115,9]]},"141":{"position":[[1060,9]]},"246":{"position":[[380,9]]},"326":{"position":[[1060,9]]},"445":{"position":[[380,9]]},"535":{"position":[[1060,9]]},"672":{"position":[[380,9]]}},"keywords":{}}],["afraid",{"_index":59,"title":{},"content":{"1":{"position":[[788,6]]}},"keywords":{}}],["ag",{"_index":2114,"title":{},"content":{"165":{"position":[[268,4]]},"354":{"position":[[306,4]]},"383":{"position":[[392,4]]},"570":{"position":[[306,4]]},"625":{"position":[[392,4]]}},"keywords":{}}],["again",{"_index":1344,"title":{},"content":{"67":{"position":[[81,6]]}},"keywords":{}}],["again.check",{"_index":3436,"title":{},"content":{"440":{"position":[[4749,11]]},"687":{"position":[[4749,11]]}},"keywords":{}}],["against",{"_index":1095,"title":{},"content":{"42":{"position":[[2578,7],[2653,7]]},"68":{"position":[[72,7]]},"96":{"position":[[66,7]]},"106":{"position":[[118,7]]},"119":{"position":[[117,7],[250,7],[516,7],[751,7]]},"175":{"position":[[386,7]]},"199":{"position":[[48,7]]},"242":{"position":[[81,7]]},"243":{"position":[[72,7]]},"273":{"position":[[118,7]]},"288":{"position":[[66,7]]},"300":{"position":[[117,7],[250,7],[516,7],[751,7]]},"361":{"position":[[386,7]]},"417":{"position":[[1370,7]]},"419":{"position":[[7785,7]]},"435":{"position":[[48,7]]},"467":{"position":[[81,7]]},"468":{"position":[[72,7]]},"490":{"position":[[118,7]]},"500":{"position":[[66,7]]},"521":{"position":[[117,7],[250,7],[516,7],[751,7]]},"577":{"position":[[386,7]]},"654":{"position":[[1370,7]]},"656":{"position":[[7785,7]]},"682":{"position":[[48,7]]}},"keywords":{}}],["agnost",{"_index":886,"title":{},"content":{"38":{"position":[[896,9]]}},"keywords":{}}],["ago",{"_index":564,"title":{},"content":{"20":{"position":[[17,3]]}},"keywords":{}}],["agre",{"_index":3247,"title":{},"content":{"416":{"position":[[3417,6]]},"653":{"position":[[3417,6]]}},"keywords":{}}],["ahead",{"_index":201,"title":{},"content":{"6":{"position":[[101,5]]},"23":{"position":[[285,5]]},"54":{"position":[[183,5]]}},"keywords":{}}],["ai",{"_index":398,"title":{"17":{"position":[[9,3]]}},"content":{"15":{"position":[[27,2]]},"17":{"position":[[20,2]]},"18":{"position":[[0,2],[161,2]]}},"keywords":{}}],["aim",{"_index":1522,"title":{},"content":{"84":{"position":[[82,5]]},"253":{"position":[[82,5]]},"484":{"position":[[82,5]]}},"keywords":{}}],["algorithm",{"_index":940,"title":{},"content":{"39":{"position":[[1157,9]]},"212":{"position":[[3539,9]]},"391":{"position":[[3557,9]]},"616":{"position":[[1328,10]]},"661":{"position":[[3557,9]]},"724":{"position":[[1328,10]]}},"keywords":{}}],["alia",{"_index":2247,"title":{},"content":{"185":{"position":[[2497,5]]},"198":{"position":[[3709,5]]},"376":{"position":[[2481,5]]},"434":{"position":[[3691,5]]},"440":{"position":[[3551,5]]},"592":{"position":[[2481,5]]},"681":{"position":[[3709,5]]},"687":{"position":[[3551,5]]}},"keywords":{}}],["alias",{"_index":2827,"title":{},"content":{"267":{"position":[[637,7]]},"407":{"position":[[637,7]]},"644":{"position":[[637,7]]}},"keywords":{}}],["alic",{"_index":3065,"title":{},"content":{"346":{"position":[[190,7]]}},"keywords":{}}],["alik",{"_index":1231,"title":{},"content":{"52":{"position":[[332,6]]}},"keywords":{}}],["alloc",{"_index":820,"title":{"87":{"position":[[7,10]]},"88":{"position":[[18,10]]},"249":{"position":[[7,10]]},"250":{"position":[[18,10]]},"487":{"position":[[7,10]]},"488":{"position":[[18,10]]}},"content":{"32":{"position":[[228,6]]},"68":{"position":[[118,9],[568,9]]},"88":{"position":[[15,9],[95,10],[134,9],[168,9]]},"243":{"position":[[118,9],[568,9]]},"250":{"position":[[15,9],[95,10],[134,9],[168,9]]},"468":{"position":[[118,9],[568,9]]},"488":{"position":[[15,9],[95,10],[134,9],[168,9]]}},"keywords":{}}],["alloc::{string::str",{"_index":821,"title":{},"content":{"32":{"position":[[239,24]]}},"keywords":{}}],["allocator"",{"_index":1565,"title":{},"content":{"88":{"position":[[304,16]]},"250":{"position":[[304,16]]},"488":{"position":[[304,16]]}},"keywords":{}}],["allow",{"_index":436,"title":{},"content":{"16":{"position":[[173,6],[386,6]]},"17":{"position":[[2142,8],[3316,7],[3460,7],[3673,7]]},"38":{"position":[[1019,8]]},"76":{"position":[[801,6]]},"92":{"position":[[269,5]]},"95":{"position":[[17,6]]},"103":{"position":[[727,5]]},"110":{"position":[[191,6]]},"111":{"position":[[76,6]]},"114":{"position":[[103,6]]},"185":{"position":[[3177,7]]},"190":{"position":[[19,8]]},"198":{"position":[[1468,6]]},"203":{"position":[[300,11],[527,6]]},"205":{"position":[[1729,9],[1776,9],[1871,9],[2028,9]]},"206":{"position":[[2440,9],[2820,9],[3429,9]]},"227":{"position":[[801,6]]},"257":{"position":[[103,6]]},"267":{"position":[[957,11],[1103,11]]},"268":{"position":[[2833,5]]},"269":{"position":[[468,11],[2962,9],[3034,9],[3236,9]]},"284":{"position":[[269,5]]},"287":{"position":[[17,6]]},"295":{"position":[[727,5]]},"305":{"position":[[191,6]]},"306":{"position":[[76,6]]},"323":{"position":[[3133,5]]},"367":{"position":[[19,8]]},"376":{"position":[[3161,7]]},"384":{"position":[[481,11],[2996,9],[3068,9],[3277,9]]},"407":{"position":[[957,11],[1103,11]]},"408":{"position":[[2833,5]]},"409":{"position":[[468,11],[2962,9],[3034,9],[3236,9]]},"416":{"position":[[1262,6],[1493,5],[2588,5],[2725,5],[3528,5],[3664,5]]},"419":{"position":[[2773,7],[3056,9],[3201,9],[3527,10],[4012,5],[4680,5],[5107,5],[5243,5]]},"423":{"position":[[300,11],[527,6]]},"425":{"position":[[1704,9],[1751,9],[1846,9],[2003,9]]},"426":{"position":[[2430,9],[2805,9],[3404,9]]},"434":{"position":[[1458,6]]},"440":{"position":[[4105,6]]},"441":{"position":[[3880,6]]},"458":{"position":[[801,6]]},"477":{"position":[[584,6]]},"480":{"position":[[103,6]]},"496":{"position":[[269,5]]},"499":{"position":[[17,6]]},"507":{"position":[[727,5]]},"510":{"position":[[191,6]]},"511":{"position":[[76,6]]},"541":{"position":[[3133,5]]},"583":{"position":[[19,8]]},"592":{"position":[[3161,7]]},"613":{"position":[[2149,6]]},"617":{"position":[[805,6],[896,6]]},"626":{"position":[[481,11],[2996,9],[3068,9],[3277,9]]},"644":{"position":[[957,11],[1103,11]]},"645":{"position":[[2833,5]]},"646":{"position":[[468,11],[2962,9],[3034,9],[3236,9]]},"653":{"position":[[1262,6],[1493,5],[2588,5],[2725,5],[3528,5],[3664,5]]},"656":{"position":[[2773,7],[3056,9],[3201,9],[3527,10],[4012,5],[4680,5],[5107,5],[5243,5]]},"665":{"position":[[300,11],[527,6]]},"667":{"position":[[1704,9],[1751,9],[1846,9],[2003,9]]},"668":{"position":[[2440,9],[2820,9],[3429,9]]},"681":{"position":[[1468,6]]},"687":{"position":[[4105,6]]},"688":{"position":[[3880,6]]},"699":{"position":[[584,6]]},"721":{"position":[[2149,6]]},"725":{"position":[[805,6],[896,6]]}},"keywords":{}}],["allowance(&self",{"_index":546,"title":{},"content":{"17":{"position":[[3849,20]]},"115":{"position":[[1016,20]]},"205":{"position":[[1044,20]]},"247":{"position":[[676,20]]},"258":{"position":[[970,20]]},"269":{"position":[[1790,20]]},"384":{"position":[[1810,20]]},"409":{"position":[[1790,20]]},"419":{"position":[[2806,20]]},"425":{"position":[[1019,20]]},"446":{"position":[[676,20]]},"481":{"position":[[970,20]]},"626":{"position":[[1810,20]]},"646":{"position":[[1790,20]]},"656":{"position":[[2806,20]]},"667":{"position":[[1019,20]]},"673":{"position":[[676,20]]}},"keywords":{}}],["allpub",{"_index":1995,"title":{},"content":{"147":{"position":[[401,6]]},"335":{"position":[[405,6]]},"552":{"position":[[405,6]]}},"keywords":{}}],["along",{"_index":572,"title":{},"content":{"20":{"position":[[100,5]]},"197":{"position":[[899,6]]},"433":{"position":[[898,6]]},"680":{"position":[[898,6]]}},"keywords":{}}],["alongsid",{"_index":2111,"title":{},"content":{"164":{"position":[[1150,9]]},"353":{"position":[[1185,9]]},"569":{"position":[[1185,9]]}},"keywords":{}}],["alreadi",{"_index":397,"title":{},"content":{"15":{"position":[[7,7]]},"18":{"position":[[3,7],[199,7]]},"44":{"position":[[43,7]]},"50":{"position":[[202,7]]},"52":{"position":[[352,7]]},"88":{"position":[[75,7]]},"91":{"position":[[95,7]]},"98":{"position":[[350,7]]},"126":{"position":[[2881,7]]},"128":{"position":[[752,7]]},"141":{"position":[[21,7],[79,7],[801,7]]},"185":{"position":[[3645,7]]},"196":{"position":[[1123,8]]},"197":{"position":[[832,7]]},"246":{"position":[[397,7]]},"250":{"position":[[75,7]]},"277":{"position":[[3049,7]]},"279":{"position":[[752,7]]},"283":{"position":[[95,7]]},"290":{"position":[[350,7]]},"326":{"position":[[21,7],[79,7],[801,7]]},"376":{"position":[[3629,7]]},"416":{"position":[[1071,7]]},"419":{"position":[[385,7]]},"432":{"position":[[1066,8]]},"433":{"position":[[831,7]]},"445":{"position":[[397,7]]},"488":{"position":[[75,7]]},"495":{"position":[[95,7]]},"502":{"position":[[350,7]]},"514":{"position":[[2881,7]]},"516":{"position":[[752,7]]},"535":{"position":[[21,7],[79,7],[801,7]]},"592":{"position":[[3629,7]]},"653":{"position":[[1071,7]]},"656":{"position":[[385,7]]},"672":{"position":[[397,7]]},"679":{"position":[[1066,8]]},"680":{"position":[[831,7]]}},"keywords":{}}],["alter",{"_index":2182,"title":{},"content":{"184":{"position":[[89,8]]},"375":{"position":[[89,8]]},"591":{"position":[[89,8]]},"599":{"position":[[570,5]]},"707":{"position":[[570,5]]}},"keywords":{}}],["altern",{"_index":1996,"title":{},"content":{"147":{"position":[[593,14]]},"206":{"position":[[3754,14]]},"268":{"position":[[2883,11]]},"335":{"position":[[597,14]]},"408":{"position":[[2883,11]]},"426":{"position":[[3729,14]]},"552":{"position":[[597,14]]},"645":{"position":[[2883,11]]},"668":{"position":[[3754,14]]}},"keywords":{}}],["although",{"_index":1974,"title":{},"content":{"143":{"position":[[774,8]]},"328":{"position":[[749,8]]},"537":{"position":[[749,8]]}},"keywords":{}}],["alway",{"_index":48,"title":{},"content":{"1":{"position":[[626,6],[769,7],[1139,6]]},"2":{"position":[[196,6]]},"195":{"position":[[763,6]]},"218":{"position":[[3,7]]},"431":{"position":[[763,6]]},"451":{"position":[[3,7]]},"678":{"position":[[763,6]]},"691":{"position":[[3,7]]}},"keywords":{}}],["amaz",{"_index":854,"title":{},"content":{"33":{"position":[[4,7]]}},"keywords":{}}],["ambigu",{"_index":946,"title":{},"content":{"39":{"position":[[1269,9]]}},"keywords":{}}],["amount",{"_index":1123,"title":{},"content":{"43":{"position":[[417,7],[459,8],[1070,6]]},"71":{"position":[[144,7],[417,8],[563,6]]},"80":{"position":[[774,7]]},"92":{"position":[[750,6]]},"95":{"position":[[326,6]]},"99":{"position":[[354,6]]},"100":{"position":[[448,6]]},"101":{"position":[[302,6]]},"103":{"position":[[493,6]]},"115":{"position":[[631,7],[718,7],[781,7],[1255,7],[1348,8],[2529,7],[2855,7],[2948,8]]},"126":{"position":[[3159,6]]},"163":{"position":[[569,7],[1144,6]]},"204":{"position":[[669,7],[717,9],[824,7],[832,7],[977,7],[1457,10]]},"205":{"position":[[342,7],[439,8],[532,7],[630,8],[675,8],[739,7],[837,9],[913,7],[1276,7],[1362,7],[1480,9],[1519,9],[1604,7],[1612,7],[1704,7],[1791,7],[1883,8],[2040,7]]},"206":{"position":[[1038,7],[1276,6],[1456,6],[1553,8],[1699,6],[1822,6],[1897,6],[3219,7],[3548,6]]},"210":{"position":[[531,6],[1267,6]]},"231":{"position":[[774,7]]},"235":{"position":[[144,7],[417,8],[563,6]]},"247":{"position":[[849,7],[901,8],[994,7],[1058,8],[1122,7],[1171,8],[1413,7],[1516,8]]},"258":{"position":[[617,7],[700,7],[759,7],[1201,7],[1294,8],[2471,7],[2781,7],[2874,8]]},"267":{"position":[[1677,7],[1779,7],[1787,7],[3018,7]]},"268":{"position":[[2522,6],[2624,8],[3325,7]]},"269":{"position":[[999,7],[1088,7],[1185,8],[1278,7],[1376,8],[1421,8],[1485,7],[1583,9],[1659,7],[1976,7],[2056,9],[2131,7],[2139,7],[2203,7],[2257,7],[2378,9],[2453,7],[2461,7],[2567,7],[2591,7],[2713,9],[2752,9],[2837,7],[2845,7],[2937,7],[3049,7],[3152,9],[3248,7],[3480,7],[4948,7],[5186,6],[5366,6],[5463,8],[5609,6],[5732,6],[5807,6]]},"277":{"position":[[3327,6]]},"284":{"position":[[750,6]]},"287":{"position":[[326,6]]},"291":{"position":[[354,6]]},"292":{"position":[[448,6]]},"293":{"position":[[302,6]]},"295":{"position":[[493,6]]},"352":{"position":[[591,7],[1166,6]]},"383":{"position":[[1199,7]]},"384":{"position":[[1012,7],[1101,7],[1198,8],[1291,7],[1389,8],[1434,8],[1498,7],[1596,9],[1672,7],[1996,7],[2076,9],[2151,7],[2159,7],[2223,7],[2277,7],[2405,9],[2480,7],[2488,7],[2594,7],[2618,7],[2747,9],[2786,9],[2871,7],[2879,7],[2971,7],[3083,7],[3193,9],[3289,7],[3490,7]]},"389":{"position":[[531,6],[1204,6]]},"407":{"position":[[1677,7],[1779,7],[1787,7],[3018,7]]},"408":{"position":[[2522,6],[2624,8],[3325,7]]},"409":{"position":[[999,7],[1088,7],[1185,8],[1278,7],[1376,8],[1421,8],[1485,7],[1583,9],[1659,7],[1976,7],[2056,9],[2131,7],[2139,7],[2203,7],[2257,7],[2378,9],[2453,7],[2461,7],[2567,7],[2591,7],[2713,9],[2752,9],[2837,7],[2845,7],[2937,7],[3049,7],[3152,9],[3248,7],[3480,7],[4948,7],[5186,6],[5366,6],[5463,8],[5609,6],[5732,6],[5807,6]]},"416":{"position":[[859,7],[966,6],[1469,7],[1888,9],[2192,7],[2701,7],[3058,7],[4378,7]]},"419":{"position":[[271,7],[2742,6],[2927,6],[3018,7],[3094,7],[3239,7],[3434,7],[3616,7],[3740,7],[3780,6],[3865,7],[3988,7],[4406,9],[4656,7],[5012,7],[5958,7]]},"424":{"position":[[644,7],[692,9],[799,7],[807,7],[928,7],[1407,10]]},"425":{"position":[[317,7],[414,8],[507,7],[605,8],[650,8],[714,7],[812,9],[888,7],[1251,7],[1337,7],[1455,9],[1494,9],[1579,7],[1587,7],[1679,7],[1766,7],[1858,8],[2015,7]]},"426":{"position":[[1033,7],[1271,6],[1451,6],[1548,8],[1689,6],[1812,6],[1887,6],[3194,7],[3523,6]]},"446":{"position":[[849,7],[901,8],[994,7],[1058,8],[1122,7],[1171,8],[1413,7],[1516,8]]},"462":{"position":[[774,7]]},"471":{"position":[[144,7],[417,8],[563,6]]},"476":{"position":[[737,7],[1012,8],[1157,6],[1245,7],[1786,7],[1888,7]]},"481":{"position":[[617,7],[700,7],[759,7],[1201,7],[1294,8],[2471,7],[2781,7],[2874,8]]},"496":{"position":[[750,6]]},"499":{"position":[[326,6]]},"503":{"position":[[354,6]]},"504":{"position":[[448,6]]},"505":{"position":[[302,6]]},"507":{"position":[[493,6]]},"514":{"position":[[3159,6]]},"568":{"position":[[591,7],[1166,6]]},"604":{"position":[[197,7],[278,8],[400,7]]},"608":{"position":[[366,6],[550,7]]},"625":{"position":[[1199,7]]},"626":{"position":[[1012,7],[1101,7],[1198,8],[1291,7],[1389,8],[1434,8],[1498,7],[1596,9],[1672,7],[1996,7],[2076,9],[2151,7],[2159,7],[2223,7],[2277,7],[2405,9],[2480,7],[2488,7],[2594,7],[2618,7],[2747,9],[2786,9],[2871,7],[2879,7],[2971,7],[3083,7],[3193,9],[3289,7],[3490,7]]},"644":{"position":[[1677,7],[1779,7],[1787,7],[3018,7]]},"645":{"position":[[2522,6],[2624,8],[3325,7]]},"646":{"position":[[999,7],[1088,7],[1185,8],[1278,7],[1376,8],[1421,8],[1485,7],[1583,9],[1659,7],[1976,7],[2056,9],[2131,7],[2139,7],[2203,7],[2257,7],[2378,9],[2453,7],[2461,7],[2567,7],[2591,7],[2713,9],[2752,9],[2837,7],[2845,7],[2937,7],[3049,7],[3152,9],[3248,7],[3480,7],[4948,7],[5186,6],[5366,6],[5463,8],[5609,6],[5732,6],[5807,6]]},"653":{"position":[[859,7],[966,6],[1469,7],[1888,9],[2192,7],[2701,7],[3058,7],[4378,7]]},"656":{"position":[[271,7],[2742,6],[2927,6],[3018,7],[3094,7],[3239,7],[3434,7],[3616,7],[3740,7],[3780,6],[3865,7],[3988,7],[4406,9],[4656,7],[5012,7],[5958,7]]},"659":{"position":[[531,6],[1204,6]]},"666":{"position":[[644,7],[692,9],[799,7],[807,7],[928,7],[1407,10]]},"667":{"position":[[317,7],[414,8],[507,7],[605,8],[650,8],[714,7],[812,9],[888,7],[1251,7],[1337,7],[1455,9],[1494,9],[1579,7],[1587,7],[1679,7],[1766,7],[1858,8],[2015,7]]},"668":{"position":[[1038,7],[1276,6],[1456,6],[1553,8],[1699,6],[1822,6],[1897,6],[3219,7],[3548,6]]},"673":{"position":[[849,7],[901,8],[994,7],[1058,8],[1122,7],[1171,8],[1413,7],[1516,8]]},"698":{"position":[[737,7],[1012,8],[1157,6],[1245,7],[1786,7],[1888,7]]},"712":{"position":[[197,7],[278,8],[400,7]]},"716":{"position":[[366,6],[550,7]]}},"keywords":{}}],["amp",{"_index":278,"title":{},"content":{"9":{"position":[[488,5],[652,5]]},"212":{"position":[[1552,9],[2654,9]]},"391":{"position":[[1552,9],[2660,9]]},"661":{"position":[[1552,9],[2660,9]]}},"keywords":{}}],["amp;&",{"_index":2156,"title":{},"content":{"175":{"position":[[74,10]]},"361":{"position":[[74,10]]},"440":{"position":[[6415,10],[6439,10]]},"577":{"position":[[74,10]]},"687":{"position":[[6415,10],[6439,10]]}},"keywords":{}}],["amp;[u32",{"_index":334,"title":{},"content":{"10":{"position":[[507,10],[579,10],[1193,11],[1211,11]]}},"keywords":{}}],["amp;[u8",{"_index":332,"title":{},"content":{"10":{"position":[[437,9],[1234,10]]},"212":{"position":[[3831,10],[4056,10]]},"267":{"position":[[2065,10],[2154,10],[2231,10],[2316,10]]},"391":{"position":[[3849,10],[4074,10]]},"407":{"position":[[2065,10],[2154,10],[2231,10],[2316,10]]},"644":{"position":[[2065,10],[2154,10],[2231,10],[2316,10]]},"661":{"position":[[3849,10],[4074,10]]}},"keywords":{}}],["amp;address",{"_index":2133,"title":{},"content":{"168":{"position":[[1674,13],[2106,13]]},"185":{"position":[[576,13],[893,13],[1088,13],[1286,13],[1525,13],[1969,13],[2240,13]]},"197":{"position":[[90,13],[254,13]]},"204":{"position":[[655,13]]},"205":{"position":[[328,13],[493,13],[518,13],[725,13],[965,13],[1072,13],[1095,13],[1237,13],[1262,13],[1667,13],[1690,13]]},"247":{"position":[[609,13],[704,13],[727,13],[835,13],[955,13],[980,13],[1108,13],[1303,13],[1399,13]]},"267":{"position":[[3913,13]]},"269":{"position":[[1074,13],[1239,13],[1264,13],[1471,13],[1818,13],[1841,13],[1962,13],[2189,13],[2528,13],[2553,13],[2900,13],[2923,13]]},"348":{"position":[[1674,13]]},"376":{"position":[[560,13],[877,13],[1072,13],[1270,13],[1509,13],[1953,13],[2224,13]]},"384":{"position":[[1087,13],[1252,13],[1277,13],[1484,13],[1838,13],[1861,13],[1982,13],[2209,13],[2555,13],[2580,13],[2934,13],[2957,13]]},"407":{"position":[[3913,13]]},"409":{"position":[[1074,13],[1239,13],[1264,13],[1471,13],[1818,13],[1841,13],[1962,13],[2189,13],[2528,13],[2553,13],[2900,13],[2923,13]]},"419":{"position":[[2700,13],[2834,13],[2857,13],[3004,13],[3148,13],[3293,13],[3420,13],[3577,13],[3602,13],[3726,13],[3851,13]]},"424":{"position":[[630,13]]},"425":{"position":[[303,13],[468,13],[493,13],[700,13],[940,13],[1047,13],[1070,13],[1212,13],[1237,13],[1642,13],[1665,13]]},"433":{"position":[[90,13],[254,13]]},"446":{"position":[[609,13],[704,13],[727,13],[835,13],[955,13],[980,13],[1108,13],[1303,13],[1399,13]]},"476":{"position":[[1381,13]]},"564":{"position":[[1674,13],[2106,13]]},"592":{"position":[[560,13],[877,13],[1072,13],[1270,13],[1509,13],[1953,13],[2224,13]]},"604":{"position":[[183,13],[361,13],[386,13]]},"626":{"position":[[1087,13],[1252,13],[1277,13],[1484,13],[1838,13],[1861,13],[1982,13],[2209,13],[2555,13],[2580,13],[2934,13],[2957,13]]},"644":{"position":[[3913,13]]},"646":{"position":[[1074,13],[1239,13],[1264,13],[1471,13],[1818,13],[1841,13],[1962,13],[2189,13],[2528,13],[2553,13],[2900,13],[2923,13]]},"656":{"position":[[2700,13],[2834,13],[2857,13],[3004,13],[3148,13],[3293,13],[3420,13],[3577,13],[3602,13],[3726,13],[3851,13]]},"666":{"position":[[630,13]]},"667":{"position":[[303,13],[468,13],[493,13],[700,13],[940,13],[1047,13],[1070,13],[1212,13],[1237,13],[1642,13],[1665,13]]},"673":{"position":[[609,13],[704,13],[727,13],[835,13],[955,13],[980,13],[1108,13],[1303,13],[1399,13]]},"680":{"position":[[90,13],[254,13]]},"698":{"position":[[1381,13]]},"712":{"position":[[183,13],[361,13],[386,13]]}},"keywords":{}}],["amp;amount",{"_index":2514,"title":{},"content":{"206":{"position":[[1330,13],[3684,13]]},"269":{"position":[[5240,13]]},"409":{"position":[[5240,13]]},"416":{"position":[[2975,13],[4498,13]]},"419":{"position":[[4929,13],[6078,13]]},"426":{"position":[[1325,13],[3659,13]]},"608":{"position":[[494,13],[602,13]]},"646":{"position":[[5240,13]]},"653":{"position":[[2975,13],[4498,13]]},"656":{"position":[[4929,13],[6078,13]]},"668":{"position":[[1330,13],[3684,13]]},"716":{"position":[[494,13],[602,13]]}},"keywords":{}}],["amp;amount).is_err",{"_index":2524,"title":{},"content":{"206":{"position":[[2016,23]]},"269":{"position":[[5926,23]]},"409":{"position":[[5926,23]]},"426":{"position":[[2006,23]]},"646":{"position":[[5926,23]]},"668":{"position":[[2016,23]]}},"keywords":{}}],["amp;approv",{"_index":2534,"title":{},"content":{"206":{"position":[[2580,13],[3040,13]]},"268":{"position":[[3146,13]]},"408":{"position":[[3146,13]]},"426":{"position":[[2565,13],[3020,13]]},"645":{"position":[[3146,13]]},"668":{"position":[[2580,13],[3040,13]]}},"keywords":{}}],["amp;approved_amount",{"_index":2532,"title":{},"content":{"206":{"position":[[2414,22]]},"426":{"position":[[2404,22]]},"668":{"position":[[2414,22]]}},"keywords":{}}],["amp;backend",{"_index":782,"title":{},"content":{"31":{"position":[[2136,14]]}},"keywords":{}}],["amp;config",{"_index":780,"title":{},"content":{"31":{"position":[[2078,13],[2248,12]]}},"keywords":{}}],["amp;env",{"_index":2497,"title":{},"content":{"206":{"position":[[376,9]]},"269":{"position":[[4280,9]]},"409":{"position":[[4280,9]]},"426":{"position":[[376,9]]},"477":{"position":[[1880,9]]},"646":{"position":[[4280,9]]},"668":{"position":[[376,9]]},"699":{"position":[[1880,9]]}},"keywords":{}}],["amp;erc20",{"_index":3323,"title":{},"content":{"426":{"position":[[963,11],[1620,11],[2553,11],[3008,11],[3126,11]]}},"keywords":{}}],["amp;express",{"_index":973,"title":{},"content":{"39":{"position":[[2290,16]]}},"keywords":{}}],["amp;hostenv",{"_index":1957,"title":{},"content":{"142":{"position":[[279,13]]},"143":{"position":[[1257,13]]},"267":{"position":[[4254,12]]},"327":{"position":[[279,13]]},"328":{"position":[[1232,13]]},"395":{"position":[[1795,13],[2236,13]]},"407":{"position":[[4254,12]]},"536":{"position":[[279,13]]},"537":{"position":[[1232,13]]},"632":{"position":[[1795,13],[2236,13]]},"644":{"position":[[4254,12]]}},"keywords":{}}],["amp;include!("../../data/journal"",{"_index":336,"title":{},"content":{"10":{"position":[[592,46]]}},"keywords":{}}],["amp;include!("../../data/method"",{"_index":333,"title":{},"content":{"10":{"position":[[449,45]]}},"keywords":{}}],["amp;include!("../../data/seal"",{"_index":335,"title":{},"content":{"10":{"position":[[520,43]]}},"keywords":{}}],["amp;initial_suppli",{"_index":2445,"title":{},"content":{"204":{"position":[[290,21]]},"424":{"position":[[265,21]]},"666":{"position":[[265,21]]}},"keywords":{}}],["amp;journ",{"_index":309,"title":{},"content":{"9":{"position":[[1315,14]]}},"keywords":{}}],["amp;mapping_data",{"_index":2658,"title":{},"content":{"212":{"position":[[3058,19]]},"391":{"position":[[3076,19]]},"661":{"position":[[3076,19]]}},"keywords":{}}],["amp;mut",{"_index":975,"title":{},"content":{"39":{"position":[[2312,8]]},"212":{"position":[[4355,8]]},"269":{"position":[[564,8]]},"384":{"position":[[577,8]]},"391":{"position":[[4373,8]]},"409":{"position":[[564,8]]},"419":{"position":[[2201,8]]},"440":{"position":[[6255,8]]},"605":{"position":[[516,8]]},"626":{"position":[[577,8]]},"646":{"position":[[564,8]]},"656":{"position":[[2201,8]]},"661":{"position":[[4373,8]]},"687":{"position":[[6255,8]]},"713":{"position":[[516,8]]}},"keywords":{}}],["amp;own",{"_index":3331,"title":{},"content":{"434":{"position":[[463,13],[790,13]]}},"keywords":{}}],["amp;ownershipchang",{"_index":2388,"title":{},"content":{"198":{"position":[[482,21],[814,21]]},"434":{"position":[[477,21],[804,21]]},"681":{"position":[[482,21],[814,21]]}},"keywords":{}}],["amp;party_contract",{"_index":3061,"title":{},"content":{"330":{"position":[[407,20]]}},"keywords":{}}],["amp;partystart",{"_index":2030,"title":{},"content":{"157":{"position":[[442,17]]},"330":{"position":[[428,17]]},"547":{"position":[[442,17]]}},"keywords":{}}],["amp;precompil",{"_index":785,"title":{},"content":{"31":{"position":[[2261,18]]}},"keywords":{}}],["amp;r",{"_index":3073,"title":{},"content":{"348":{"position":[[2122,7]]}},"keywords":{}}],["amp;recipi",{"_index":2537,"title":{},"content":{"206":{"position":[[2751,15],[3668,15]]},"426":{"position":[[2736,15],[3643,15]]},"668":{"position":[[2751,15],[3668,15]]}},"keywords":{}}],["amp;result",{"_index":317,"title":{},"content":{"9":{"position":[[1639,13]]}},"keywords":{}}],["amp;rol",{"_index":2220,"title":{},"content":{"185":{"position":[[556,10],[694,10],[873,10],[1068,10],[1266,10],[1505,10],[1662,10],[1685,10],[1949,10],[2220,10]]},"376":{"position":[[540,10],[678,10],[857,10],[1052,10],[1250,10],[1489,10],[1646,10],[1669,10],[1933,10],[2204,10]]},"592":{"position":[[540,10],[678,10],[857,10],[1052,10],[1250,10],[1489,10],[1646,10],[1669,10],[1933,10],[2204,10]]}},"keywords":{}}],["amp;runtimearg",{"_index":2872,"title":{},"content":{"267":{"position":[[3000,17]]},"407":{"position":[[3000,17]]},"644":{"position":[[3000,17]]}},"keywords":{}}],["amp;seal",{"_index":313,"title":{},"content":{"9":{"position":[[1477,11]]}},"keywords":{}}],["amp;seal).verify(method_id",{"_index":355,"title":{},"content":{"10":{"position":[[1300,29]]}},"keywords":{}}],["amp;self",{"_index":1458,"title":{},"content":{"79":{"position":[[982,10]]},"230":{"position":[[999,10]]},"461":{"position":[[999,10]]}},"keywords":{}}],["amp;self.env().cal",{"_index":2228,"title":{},"content":{"185":{"position":[[957,26],[1152,26],[1316,24]]},"376":{"position":[[941,26],[1136,26],[1300,24]]},"592":{"position":[[941,26],[1136,26],[1300,24]]}},"keywords":{}}],["amp;spend",{"_index":2472,"title":{},"content":{"205":{"position":[[616,13]]},"206":{"position":[[2503,14]]},"269":{"position":[[1362,13]]},"384":{"position":[[1375,13]]},"409":{"position":[[1362,13]]},"425":{"position":[[591,13]]},"426":{"position":[[2493,14]]},"626":{"position":[[1375,13]]},"646":{"position":[[1362,13]]},"667":{"position":[[591,13]]},"668":{"position":[[2503,14]]}},"keywords":{}}],["amp;str",{"_index":732,"title":{},"content":{"31":{"position":[[581,8],[728,9],[861,9],[878,9]]},"32":{"position":[[1127,9]]},"42":{"position":[[562,8],[632,8]]},"83":{"position":[[577,9],[636,9]]},"206":{"position":[[132,8],[179,8]]},"212":{"position":[[225,8],[278,8],[343,8],[403,8],[2835,9]]},"252":{"position":[[577,9],[636,9]]},"267":{"position":[[2984,9]]},"269":{"position":[[4036,8],[4083,8]]},"391":{"position":[[225,8],[278,8],[343,8],[403,8],[2841,9]]},"407":{"position":[[2984,9]]},"409":{"position":[[4036,8],[4083,8]]},"426":{"position":[[132,8],[179,8]]},"483":{"position":[[577,9],[636,9]]},"644":{"position":[[2984,9]]},"646":{"position":[[4036,8],[4083,8]]},"661":{"position":[[225,8],[278,8],[343,8],[403,8],[2841,9]]},"668":{"position":[[132,8],[179,8]]}},"keywords":{}}],["amp;t",{"_index":2146,"title":{},"content":{"168":{"position":[[2127,7]]},"348":{"position":[[2137,7]]},"564":{"position":[[2127,7]]}},"keywords":{}}],["amp;test_env",{"_index":3060,"title":{},"content":{"328":{"position":[[441,14]]},"537":{"position":[[441,14]]}},"keywords":{}}],["amp;ticket_id",{"_index":3394,"title":{},"content":{"440":{"position":[[2024,15]]},"687":{"position":[[2024,15]]}},"keywords":{}}],["amp;ticketoperatorhostref",{"_index":3533,"title":{},"content":{"441":{"position":[[5739,27]]},"688":{"position":[[5739,27]]}},"keywords":{}}],["amp;transf",{"_index":2509,"title":{},"content":{"206":{"position":[[980,13],[1642,13],[3163,13]]},"268":{"position":[[3269,13]]},"269":{"position":[[4890,13],[5552,13]]},"408":{"position":[[3269,13]]},"409":{"position":[[4890,13],[5552,13]]},"426":{"position":[[975,13],[1632,13],[3138,13]]},"645":{"position":[[3269,13]]},"646":{"position":[[4890,13],[5552,13]]},"668":{"position":[[980,13],[1642,13],[3163,13]]}},"keywords":{}}],["amp;transfer_amount",{"_index":2538,"title":{},"content":{"206":{"position":[[2767,22]]},"426":{"position":[[2752,22]]},"668":{"position":[[2767,22]]}},"keywords":{}}],["amp;u256",{"_index":2448,"title":{},"content":{"204":{"position":[[677,10]]},"205":{"position":[[350,10],[540,10],[747,10],[1284,10],[1712,10]]},"247":{"position":[[857,10],[1002,10],[1130,10],[1421,10]]},"269":{"position":[[1096,10],[1286,10],[1493,10],[1984,10],[2211,10],[2575,10],[2945,10]]},"384":{"position":[[1109,10],[1299,10],[1506,10],[2004,10],[2231,10],[2602,10],[2979,10]]},"409":{"position":[[1096,10],[1286,10],[1493,10],[1984,10],[2211,10],[2575,10],[2945,10]]},"419":{"position":[[3026,11],[3171,11],[3315,11],[3442,11],[3624,11],[3748,11],[3873,11]]},"424":{"position":[[652,10]]},"425":{"position":[[325,10],[515,10],[722,10],[1259,10],[1687,10]]},"446":{"position":[[857,10],[1002,10],[1130,10],[1421,10]]},"604":{"position":[[205,10],[408,10]]},"626":{"position":[[1109,10],[1299,10],[1506,10],[2004,10],[2231,10],[2602,10],[2979,10]]},"646":{"position":[[1096,10],[1286,10],[1493,10],[1984,10],[2211,10],[2575,10],[2945,10]]},"656":{"position":[[3026,11],[3171,11],[3315,11],[3442,11],[3624,11],[3748,11],[3873,11]]},"666":{"position":[[652,10]]},"667":{"position":[[325,10],[515,10],[722,10],[1259,10],[1687,10]]},"673":{"position":[[857,10],[1002,10],[1130,10],[1421,10]]},"712":{"position":[[205,10],[408,10]]}},"keywords":{}}],["amp;u512",{"_index":3546,"title":{},"content":{"476":{"position":[[1253,10]]},"698":{"position":[[1253,10]]}},"keywords":{}}],["amp;valu",{"_index":3411,"title":{},"content":{"440":{"position":[[2991,12]]},"441":{"position":[[3532,12]]},"687":{"position":[[2991,12]]},"688":{"position":[[3532,12]]}},"keywords":{}}],["amp;vote.amount",{"_index":3263,"title":{},"content":{"416":{"position":[[4268,18]]},"419":{"position":[[5848,18]]},"653":{"position":[[4268,18]]},"656":{"position":[[5848,18]]}},"keywords":{}}],["amp;vote.vot",{"_index":3262,"title":{},"content":{"416":{"position":[[4251,16]]},"419":{"position":[[5831,16]]},"653":{"position":[[4251,16]]},"656":{"position":[[5831,16]]}},"keywords":{}}],["analog",{"_index":1022,"title":{},"content":{"40":{"position":[[381,7]]},"141":{"position":[[1307,11]]},"326":{"position":[[1307,11]]},"535":{"position":[[1307,11]]}},"keywords":{}}],["analysi",{"_index":911,"title":{},"content":{"39":{"position":[[460,8]]}},"keywords":{}}],["analyz",{"_index":1617,"title":{},"content":{"94":{"position":[[192,7]]},"196":{"position":[[583,7]]},"286":{"position":[[192,7]]},"432":{"position":[[520,7]]},"498":{"position":[[192,7]]},"679":{"position":[[520,7]]}},"keywords":{}}],["and/or",{"_index":3857,"title":{},"content":{"614":{"position":[[67,6]]},"722":{"position":[[67,6]]}},"keywords":{}}],["andbal",{"_index":1526,"title":{},"content":{"84":{"position":[[361,12]]},"253":{"position":[[361,12]]},"484":{"position":[[361,12]]}},"keywords":{}}],["andcargo",{"_index":1890,"title":{},"content":{"132":{"position":[[109,8]]},"312":{"position":[[109,8]]},"529":{"position":[[109,8]]}},"keywords":{}}],["andu256",{"_index":1527,"title":{},"content":{"84":{"position":[[432,7]]},"253":{"position":[[432,7]]},"484":{"position":[[432,7]]}},"keywords":{}}],["annot",{"_index":2715,"title":{},"content":{"221":{"position":[[482,9]]},"432":{"position":[[1399,9]]},"454":{"position":[[482,9]]},"596":{"position":[[632,9]]},"679":{"position":[[1399,9]]},"694":{"position":[[482,9]]},"704":{"position":[[632,9]]}},"keywords":{}}],["anoth",{"_index":509,"title":{},"content":{"17":{"position":[[1721,7]]},"18":{"position":[[217,7]]},"51":{"position":[[269,7]]},"84":{"position":[[485,7]]},"85":{"position":[[183,7]]},"102":{"position":[[285,7]]},"115":{"position":[[1838,7]]},"154":{"position":[[114,7]]},"178":{"position":[[108,7]]},"202":{"position":[[312,7]]},"209":{"position":[[137,7],[504,7],[1483,7]]},"253":{"position":[[485,7]]},"254":{"position":[[183,7]]},"258":{"position":[[1784,7]]},"294":{"position":[[285,7]]},"339":{"position":[[114,7]]},"369":{"position":[[108,7]]},"388":{"position":[[137,7],[494,7],[1415,7]]},"395":{"position":[[4334,7]]},"397":{"position":[[341,7]]},"422":{"position":[[312,7]]},"481":{"position":[[1784,7]]},"484":{"position":[[485,7]]},"485":{"position":[[183,7]]},"506":{"position":[[285,7]]},"559":{"position":[[114,7]]},"585":{"position":[[108,7]]},"612":{"position":[[312,8],[2032,8]]},"632":{"position":[[4334,7]]},"634":{"position":[[341,7]]},"658":{"position":[[137,7],[494,7],[1415,7]]},"664":{"position":[[312,7]]},"720":{"position":[[312,8],[2032,8]]}},"keywords":{}}],["anotherlog",{"_index":3790,"title":{},"content":{"610":{"position":[[140,10]]},"718":{"position":[[140,10]]}},"keywords":{}}],["answer",{"_index":129,"title":{},"content":{"3":{"position":[[121,7]]},"616":{"position":[[554,7]]},"724":{"position":[[554,7]]}},"keywords":{}}],["anymor",{"_index":2801,"title":{},"content":{"265":{"position":[[88,7]]},"405":{"position":[[88,7]]},"642":{"position":[[88,7]]}},"keywords":{}}],["anyon",{"_index":3214,"title":{},"content":{"416":{"position":[[43,6],[4863,6]]},"653":{"position":[[43,6],[4863,6]]}},"keywords":{}}],["anytim",{"_index":2647,"title":{},"content":{"212":{"position":[[2271,7]]},"391":{"position":[[2271,7]]},"661":{"position":[[2271,7]]}},"keywords":{}}],["api",{"_index":55,"title":{},"content":{"1":{"position":[[729,3]]},"21":{"position":[[99,4]]},"126":{"position":[[2282,3]]},"189":{"position":[[218,4]]},"267":{"position":[[155,4],[1962,3]]},"268":{"position":[[152,4],[1465,3],[2821,3]]},"270":{"position":[[379,5]]},"277":{"position":[[2450,3]]},"366":{"position":[[218,4]]},"385":{"position":[[379,5]]},"407":{"position":[[155,4],[1962,3]]},"408":{"position":[[152,4],[1465,3],[2821,3]]},"410":{"position":[[379,5]]},"514":{"position":[[2282,3]]},"582":{"position":[[218,4]]},"627":{"position":[[379,5]]},"644":{"position":[[155,4],[1962,3]]},"645":{"position":[[152,4],[1465,3],[2821,3]]},"647":{"position":[[379,5]]}},"keywords":{}}],["apierror::us",{"_index":1612,"title":{},"content":{"93":{"position":[[221,15]]},"285":{"position":[[221,15]]},"497":{"position":[[221,15]]}},"keywords":{}}],["appear",{"_index":1537,"title":{},"content":{"85":{"position":[[324,6]]},"254":{"position":[[324,6]]},"485":{"position":[[324,6]]}},"keywords":{}}],["appli",{"_index":1382,"title":{},"content":{"72":{"position":[[462,5]]},"74":{"position":[[105,5]]},"141":{"position":[[980,7]]},"195":{"position":[[305,5]]},"196":{"position":[[989,7]]},"198":{"position":[[3328,7]]},"236":{"position":[[462,5]]},"238":{"position":[[105,5]]},"326":{"position":[[980,7]]},"431":{"position":[[305,5]]},"432":{"position":[[934,7]]},"434":{"position":[[3310,7]]},"472":{"position":[[462,5]]},"474":{"position":[[105,5]]},"535":{"position":[[980,7]]},"678":{"position":[[305,5]]},"679":{"position":[[934,7]]},"681":{"position":[[3328,7]]}},"keywords":{}}],["applic",{"_index":3076,"title":{},"content":{"354":{"position":[[367,10]]},"570":{"position":[[367,10]]}},"keywords":{}}],["approach",{"_index":859,"title":{},"content":{"33":{"position":[[179,8]]},"39":{"position":[[927,8]]},"79":{"position":[[374,8]]},"163":{"position":[[655,8]]},"230":{"position":[[391,8]]},"352":{"position":[[677,8]]},"461":{"position":[[391,8]]},"568":{"position":[[677,8]]},"612":{"position":[[2046,8]]},"720":{"position":[[2046,8]]}},"keywords":{}}],["appropri",{"_index":1475,"title":{},"content":{"79":{"position":[[1554,11]]},"118":{"position":[[178,11]]},"230":{"position":[[1571,11]]},"299":{"position":[[178,11]]},"414":{"position":[[593,11]]},"461":{"position":[[1571,11]]},"520":{"position":[[178,11]]},"651":{"position":[[593,11]]}},"keywords":{}}],["approv",{"_index":160,"title":{},"content":{"3":{"position":[[630,8]]},"203":{"position":[[121,11]]},"205":{"position":[[115,8],[2106,8]]},"206":{"position":[[2368,8]]},"267":{"position":[[911,10],[1057,10]]},"269":{"position":[[278,10],[3545,8]]},"384":{"position":[[275,10],[3531,8]]},"407":{"position":[[911,10],[1057,10]]},"409":{"position":[[278,10],[3545,8]]},"419":{"position":[[2887,8]]},"423":{"position":[[121,11]]},"425":{"position":[[115,8],[2057,8]]},"426":{"position":[[2358,8]]},"440":{"position":[[6163,8]]},"441":{"position":[[188,8],[1399,8],[2940,7],[4054,8]]},"626":{"position":[[275,10],[3531,8]]},"644":{"position":[[911,10],[1057,10]]},"646":{"position":[[278,10],[3545,8]]},"656":{"position":[[2887,8]]},"665":{"position":[[121,11]]},"667":{"position":[[115,8],[2057,8]]},"668":{"position":[[2368,8]]},"687":{"position":[[6163,8]]},"688":{"position":[[188,8],[1399,8],[2940,7],[4054,8]]}},"keywords":{}}],["approve(&mut",{"_index":543,"title":{},"content":{"17":{"position":[[3700,16]]},"115":{"position":[[740,16]]},"205":{"position":[[693,16]]},"247":{"position":[[1076,16]]},"258":{"position":[[718,16]]},"269":{"position":[[1439,16]]},"384":{"position":[[1452,16]]},"409":{"position":[[1439,16]]},"419":{"position":[[2972,16]]},"425":{"position":[[668,16]]},"446":{"position":[[1076,16]]},"481":{"position":[[718,16]]},"626":{"position":[[1452,16]]},"646":{"position":[[1439,16]]},"656":{"position":[[2972,16]]},"667":{"position":[[668,16]]},"673":{"position":[[1076,16]]}},"keywords":{}}],["approve(oper",{"_index":3503,"title":{},"content":{"441":{"position":[[3027,18]]},"688":{"position":[[3027,18]]}},"keywords":{}}],["approved_amount",{"_index":2527,"title":{},"content":{"206":{"position":[[2221,15],[2518,17],[2619,15],[3079,15]]},"268":{"position":[[3185,15]]},"408":{"position":[[3185,15]]},"426":{"position":[[2211,15],[2508,17],[2604,15],[3059,15]]},"645":{"position":[[3185,15]]},"668":{"position":[[2221,15],[2518,17],[2619,15],[3079,15]]}},"keywords":{}}],["approxim",{"_index":151,"title":{},"content":{"3":{"position":[[477,13]]}},"keywords":{}}],["arbitrari",{"_index":231,"title":{},"content":{"8":{"position":[[106,9]]},"52":{"position":[[238,9]]},"83":{"position":[[428,9]]},"99":{"position":[[168,9]]},"252":{"position":[[428,9]]},"291":{"position":[[168,9]]},"483":{"position":[[428,9]]},"503":{"position":[[168,9]]}},"keywords":{}}],["architectur",{"_index":1695,"title":{"107":{"position":[[0,13]]},"274":{"position":[[0,13]]},"491":{"position":[[0,13]]}},"content":{},"keywords":{}}],["arg",{"_index":1002,"title":{},"content":{"39":{"position":[[2919,5],[2967,5]]},"43":{"position":[[1102,3],[1206,3],[1274,3],[1337,3],[1400,3],[1451,3],[1506,3],[1553,3]]},"52":{"position":[[1196,4],[1488,4],[1665,4],[2232,5],[3213,5],[4850,5],[6545,5]]},"99":{"position":[[424,3],[513,3],[581,3],[644,3]]},"100":{"position":[[522,3],[597,3],[666,3],[729,3],[777,3],[825,3]]},"101":{"position":[[377,3],[455,3],[524,3],[587,3]]},"210":{"position":[[563,3],[658,3],[726,3],[789,3],[852,3],[902,3],[966,3],[1013,3],[1384,3],[1428,3],[1476,3]]},"267":{"position":[[2994,5]]},"268":{"position":[[356,5],[601,5],[712,5],[859,4],[1061,4]]},"291":{"position":[[424,3],[513,3],[581,3],[644,3]]},"292":{"position":[[522,3],[597,3],[666,3],[729,3],[777,3],[825,3]]},"293":{"position":[[377,3],[455,3],[524,3],[587,3]]},"323":{"position":[[2906,3],[3116,3],[3316,3]]},"389":{"position":[[563,3],[658,3],[726,3],[789,3],[839,3],[903,3],[950,3],[1321,3],[1365,3],[1413,3]]},"407":{"position":[[2994,5]]},"408":{"position":[[356,5],[601,5],[712,5],[859,4],[1061,4]]},"440":{"position":[[1560,4]]},"503":{"position":[[424,3],[513,3],[581,3],[644,3]]},"504":{"position":[[522,3],[597,3],[666,3],[729,3],[777,3],[825,3]]},"505":{"position":[[377,3],[455,3],[524,3],[587,3]]},"541":{"position":[[2906,3],[3116,3],[3316,3]]},"644":{"position":[[2994,5]]},"645":{"position":[[356,5],[601,5],[712,5],[859,4],[1061,4]]},"659":{"position":[[563,3],[658,3],[726,3],[789,3],[839,3],[903,3],[950,3],[1321,3],[1365,3],[1413,3]]},"687":{"position":[[1560,4]]}},"keywords":{}}],["args::mayb",{"_index":3344,"title":{},"content":{"440":{"position":[[124,12]]},"687":{"position":[[124,12]]}},"keywords":{}}],["argument",{"_index":327,"title":{"98":{"position":[[5,10]]},"290":{"position":[[5,10]]},"502":{"position":[[5,10]]}},"content":{"10":{"position":[[322,9]]},"31":{"position":[[234,9],[2887,10],[3057,9]]},"32":{"position":[[90,9],[1320,9]]},"53":{"position":[[1321,9]]},"92":{"position":[[871,8]]},"98":{"position":[[48,9],[110,9],[547,10]]},"99":{"position":[[91,10],[143,9]]},"102":{"position":[[140,8]]},"103":{"position":[[62,10],[340,9],[637,8],[747,10]]},"119":{"position":[[853,9]]},"126":{"position":[[1843,9]]},"147":{"position":[[1065,9]]},"148":{"position":[[730,10],[755,8]]},"178":{"position":[[652,9]]},"196":{"position":[[1212,9],[1265,8]]},"198":{"position":[[1945,8],[2887,9]]},"268":{"position":[[655,8],[789,8]]},"277":{"position":[[2011,9]]},"284":{"position":[[871,8]]},"290":{"position":[[48,9],[110,9],[547,10]]},"291":{"position":[[91,10],[143,9]]},"294":{"position":[[140,8]]},"295":{"position":[[62,10],[340,9],[637,8],[747,10]]},"300":{"position":[[853,9]]},"324":{"position":[[1102,10],[1597,10],[1614,9],[1664,9],[1690,10]]},"335":{"position":[[1073,9]]},"336":{"position":[[730,10],[755,8]]},"369":{"position":[[652,9]]},"408":{"position":[[655,8],[789,8]]},"432":{"position":[[1155,9],[1207,8]]},"434":{"position":[[1935,8],[2877,9]]},"496":{"position":[[871,8]]},"502":{"position":[[48,9],[110,9],[547,10]]},"503":{"position":[[91,10],[143,9]]},"506":{"position":[[140,8]]},"507":{"position":[[62,10],[340,9],[637,8],[747,10]]},"514":{"position":[[1843,9]]},"521":{"position":[[853,9]]},"542":{"position":[[1102,10],[1597,10],[1614,9],[1664,9],[1690,10]]},"552":{"position":[[1073,9]]},"553":{"position":[[730,10],[755,8]]},"585":{"position":[[652,9]]},"610":{"position":[[755,9]]},"611":{"position":[[788,8]]},"645":{"position":[[655,8],[789,8]]},"679":{"position":[[1155,9],[1207,8]]},"681":{"position":[[1945,8],[2887,9]]},"718":{"position":[[755,9]]},"719":{"position":[[788,8]]}},"keywords":{}}],["aris",{"_index":610,"title":{},"content":{"20":{"position":[[914,6]]},"102":{"position":[[345,6]]},"294":{"position":[[345,6]]},"506":{"position":[[345,6]]}},"keywords":{}}],["around",{"_index":653,"title":{},"content":{"22":{"position":[[583,7]]}},"keywords":{}}],["arr",{"_index":3699,"title":{},"content":{"601":{"position":[[1230,4],[1797,3]]},"613":{"position":[[873,4],[991,3],[1105,3]]},"709":{"position":[[1230,4],[1797,3]]},"721":{"position":[[873,4],[991,3],[1105,3]]}},"keywords":{}}],["arr.push(i.into",{"_index":3846,"title":{},"content":{"613":{"position":[[1040,19]]},"721":{"position":[[1040,19]]}},"keywords":{}}],["arr[index",{"_index":3713,"title":{},"content":{"601":{"position":[[1830,9]]},"709":{"position":[[1830,9]]}},"keywords":{}}],["array",{"_index":1513,"title":{"601":{"position":[[0,6]]},"709":{"position":[[0,6]]}},"content":{"83":{"position":[[443,7]]},"185":{"position":[[2551,5]]},"212":{"position":[[3609,5]]},"252":{"position":[[443,7]]},"376":{"position":[[2535,5]]},"391":{"position":[[3627,5]]},"483":{"position":[[443,7]]},"592":{"position":[[2535,5]]},"598":{"position":[[1984,7]]},"601":{"position":[[1167,5],[1194,5],[1311,5],[1969,6],[1991,7],[2094,5],[2165,7],[2232,5]]},"602":{"position":[[1197,7],[2081,6]]},"613":{"position":[[1426,5],[1489,6]]},"616":{"position":[[1366,5]]},"661":{"position":[[3627,5]]},"706":{"position":[[1984,7]]},"709":{"position":[[1167,5],[1194,5],[1311,5],[1969,6],[1991,7],[2094,5],[2165,7],[2232,5]]},"710":{"position":[[1197,7],[2081,6]]},"721":{"position":[[1426,5],[1489,6]]},"724":{"position":[[1366,5]]}},"keywords":{}}],["array"",{"_index":2680,"title":{},"content":{"212":{"position":[[4417,13]]},"391":{"position":[[4435,13]]},"661":{"position":[[4435,13]]}},"keywords":{}}],["array.concaten",{"_index":2605,"title":{},"content":{"211":{"position":[[617,17]]},"390":{"position":[[591,17]]},"660":{"position":[[591,17]]}},"keywords":{}}],["array.l8",{"_index":2248,"title":{},"content":{"185":{"position":[[2517,8]]},"376":{"position":[[2501,8]]},"592":{"position":[[2501,8]]}},"keywords":{}}],["articl",{"_index":1568,"title":{},"content":{"88":{"position":[[440,7]]},"91":{"position":[[127,8]]},"124":{"position":[[12,8]]},"141":{"position":[[44,7]]},"146":{"position":[[865,8]]},"158":{"position":[[14,7]]},"166":{"position":[[12,8]]},"168":{"position":[[220,7]]},"171":{"position":[[14,7]]},"180":{"position":[[24,9]]},"211":{"position":[[861,8]]},"250":{"position":[[440,7]]},"283":{"position":[[127,8]]},"309":{"position":[[12,8]]},"326":{"position":[[44,7]]},"331":{"position":[[14,7]]},"334":{"position":[[869,8]]},"348":{"position":[[220,7]]},"355":{"position":[[12,8]]},"357":{"position":[[14,7]]},"371":{"position":[[24,9]]},"390":{"position":[[835,8]]},"488":{"position":[[440,7]]},"495":{"position":[[127,8]]},"526":{"position":[[12,8]]},"535":{"position":[[44,7]]},"548":{"position":[[14,7]]},"551":{"position":[[869,8]]},"564":{"position":[[220,7]]},"571":{"position":[[12,8]]},"573":{"position":[[14,7]]},"587":{"position":[[24,9]]},"660":{"position":[[835,8]]}},"keywords":{}}],["ask",{"_index":414,"title":{},"content":{"15":{"position":[[335,5]]},"16":{"position":[[209,3],[475,3]]},"175":{"position":[[604,3]]},"361":{"position":[[604,3]]},"394":{"position":[[423,3]]},"577":{"position":[[604,3]]},"631":{"position":[[423,3]]}},"keywords":{}}],["asref<[u8]>>(input",{"_index":2860,"title":{},"content":{"267":{"position":[[2529,28]]},"407":{"position":[[2529,28]]},"644":{"position":[[2529,28]]}},"keywords":{}}],["assert",{"_index":293,"title":{},"content":{"9":{"position":[[933,9]]},"138":{"position":[[1122,11]]},"193":{"position":[[285,12]]},"196":{"position":[[840,6]]},"198":{"position":[[2378,10],[2761,6]]},"201":{"position":[[159,10]]},"206":{"position":[[3822,6]]},"268":{"position":[[2168,6],[2296,6],[2786,6],[2842,6],[2903,6]]},"318":{"position":[[1114,11]]},"408":{"position":[[2168,6],[2296,6],[2786,6],[2842,6],[2903,6]]},"421":{"position":[[159,10]]},"426":{"position":[[3797,6]]},"429":{"position":[[285,12]]},"432":{"position":[[778,6]]},"434":{"position":[[2368,10],[2751,6]]},"440":{"position":[[5837,9],[5938,9]]},"544":{"position":[[1114,11]]},"611":{"position":[[613,7]]},"645":{"position":[[2168,6],[2296,6],[2786,6],[2842,6],[2903,6]]},"663":{"position":[[159,10]]},"668":{"position":[[3822,6]]},"676":{"position":[[285,12]]},"679":{"position":[[778,6]]},"681":{"position":[[2378,10],[2761,6]]},"687":{"position":[[5837,9],[5938,9]]},"719":{"position":[[613,7]]}},"keywords":{}}],["assert!(!contract.get",{"_index":2004,"title":{},"content":{"148":{"position":[[365,25]]},"178":{"position":[[1371,25]]},"336":{"position":[[365,25]]},"369":{"position":[[1371,25]]},"553":{"position":[[365,25]]},"585":{"position":[[1371,25]]}},"keywords":{}}],["assert!(!contract1.get",{"_index":2160,"title":{},"content":{"178":{"position":[[1622,26]]},"369":{"position":[[1622,26]]},"585":{"position":[[1622,26]]}},"keywords":{}}],["assert!(!contract2.get",{"_index":2161,"title":{},"content":{"178":{"position":[[1649,26],[1720,26]]},"369":{"position":[[1649,26],[1720,26]]},"585":{"position":[[1649,26],[1720,26]]}},"keywords":{}}],["assert!(contract.get",{"_index":2006,"title":{},"content":{"148":{"position":[[408,24]]},"178":{"position":[[1414,24]]},"336":{"position":[[408,24]]},"369":{"position":[[1414,24]]},"553":{"position":[[408,24]]},"585":{"position":[[1414,24]]}},"keywords":{}}],["assert!(contract1.get",{"_index":2163,"title":{},"content":{"178":{"position":[[1694,25]]},"369":{"position":[[1694,25]]},"585":{"position":[[1694,25]]}},"keywords":{}}],["assert!(env.emitted(erc20.address",{"_index":2541,"title":{},"content":{"206":{"position":[[3252,36]]},"426":{"position":[[3227,36]]},"668":{"position":[[3252,36]]}},"keywords":{}}],["assert!(env.emitted_ev",{"_index":2507,"title":{},"content":{"206":{"position":[[936,26],[1598,26],[2536,26],[2996,26],[3119,26]]},"268":{"position":[[3102,26],[3225,26]]},"269":{"position":[[4846,26],[5508,26]]},"408":{"position":[[3102,26],[3225,26]]},"409":{"position":[[4846,26],[5508,26]]},"426":{"position":[[936,26],[1593,26],[2526,26],[2981,26],[3099,26]]},"645":{"position":[[3102,26],[3225,26]]},"646":{"position":[[4846,26],[5508,26]]},"668":{"position":[[936,26],[1598,26],[2536,26],[2996,26],[3119,26]]}},"keywords":{}}],["assert!(erc20.try_transfer(&recipi",{"_index":2523,"title":{},"content":{"206":{"position":[[1973,42]]},"269":{"position":[[5883,42]]},"409":{"position":[[5883,42]]},"426":{"position":[[1963,42]]},"646":{"position":[[5883,42]]},"668":{"position":[[1973,42]]}},"keywords":{}}],["assert!(exit_reason",{"_index":791,"title":{},"content":{"31":{"position":[[2676,19]]}},"keywords":{}}],["assert!(receipt.verify(evm_calc_id).is_ok",{"_index":846,"title":{},"content":{"32":{"position":[[1474,45]]}},"keywords":{}}],["assert_eq",{"_index":1093,"title":{},"content":{"42":{"position":[[2485,11]]},"138":{"position":[[679,11],[1158,10]]},"198":{"position":[[1044,11]]},"206":{"position":[[1384,11],[2843,11],[3620,11]]},"223":{"position":[[1062,11]]},"268":{"position":[[2327,10],[2570,11]]},"269":{"position":[[5294,11]]},"318":{"position":[[671,11],[1150,10]]},"408":{"position":[[2327,10],[2570,11]]},"409":{"position":[[5294,11]]},"426":{"position":[[1379,11],[2828,11],[3595,11]]},"434":{"position":[[1034,11]]},"440":{"position":[[5402,11],[5512,11],[5593,11],[5673,11]]},"441":{"position":[[5371,11],[5566,11]]},"456":{"position":[[1062,11]]},"544":{"position":[[671,11],[1150,10]]},"645":{"position":[[2327,10],[2570,11]]},"646":{"position":[[5294,11]]},"668":{"position":[[1384,11],[2843,11],[3620,11]]},"681":{"position":[[1044,11]]},"687":{"position":[[5402,11],[5512,11],[5593,11],[5673,11]]},"688":{"position":[[5371,11],[5566,11]]},"696":{"position":[[1062,11]]}},"keywords":{}}],["assert_eq!("hello".to_str",{"_index":1090,"title":{},"content":{"42":{"position":[[2314,41]]}},"keywords":{}}],["assert_eq!(10",{"_index":1212,"title":{},"content":{"51":{"position":[[1423,14]]}},"keywords":{}}],["assert_eq!(11",{"_index":1215,"title":{},"content":{"51":{"position":[[1553,14]]}},"keywords":{}}],["assert_eq!(adder.add(1",{"_index":1981,"title":{},"content":{"143":{"position":[[1192,23]]},"328":{"position":[[1167,23]]},"537":{"position":[[1167,23]]}},"keywords":{}}],["assert_eq!(arr.len",{"_index":3848,"title":{},"content":{"613":{"position":[[1138,21]]},"721":{"position":[[1138,21]]}},"keywords":{}}],["assert_eq!(arr[0",{"_index":3849,"title":{},"content":{"613":{"position":[[1164,18]]},"721":{"position":[[1164,18]]}},"keywords":{}}],["assert_eq!(arr[1",{"_index":3851,"title":{},"content":{"613":{"position":[[1194,18]]},"721":{"position":[[1194,18]]}},"keywords":{}}],["assert_eq!(buy_ticket(&oper",{"_index":3529,"title":{},"content":{"441":{"position":[[5457,36],[5512,36]]},"688":{"position":[[5457,36],[5512,36]]}},"keywords":{}}],["assert_eq!(contract.get_valu",{"_index":2745,"title":{},"content":{"223":{"position":[[1147,32]]},"456":{"position":[[1147,32]]},"696":{"position":[[1147,32]]}},"keywords":{}}],["assert_eq!(cross_contract.add_using_anoth",{"_index":1972,"title":{},"content":{"143":{"position":[[563,46]]},"328":{"position":[[538,46]]},"537":{"position":[[538,46]]}},"keywords":{}}],["assert_eq!(erc20.allowance(&own",{"_index":2533,"title":{},"content":{"206":{"position":[[2464,38]]},"426":{"position":[[2454,38]]},"668":{"position":[[2464,38]]}},"keywords":{}}],["assert_eq!(erc20.balance_of(&own",{"_index":2530,"title":{},"content":{"206":{"position":[[2289,40]]},"426":{"position":[[2279,40]]},"668":{"position":[[2289,40]]}},"keywords":{}}],["assert_eq!(erc20.balance_of(&recipi",{"_index":2518,"title":{},"content":{"206":{"position":[[1508,44],[2933,44]]},"269":{"position":[[5418,44]]},"409":{"position":[[5418,44]]},"426":{"position":[[1503,44],[2918,44]]},"646":{"position":[[5418,44]]},"668":{"position":[[1508,44],[2933,44]]}},"keywords":{}}],["assert_eq!(erc20.decim",{"_index":2504,"title":{},"content":{"206":{"position":[[764,28]]},"269":{"position":[[4674,28]]},"409":{"position":[[4674,28]]},"426":{"position":[[764,28]]},"646":{"position":[[4674,28]]},"668":{"position":[[764,28]]}},"keywords":{}}],["assert_eq!(erc20.nam",{"_index":2503,"title":{},"content":{"206":{"position":[[720,24]]},"269":{"position":[[4630,24]]},"409":{"position":[[4630,24]]},"426":{"position":[[720,24]]},"646":{"position":[[4630,24]]},"668":{"position":[[720,24]]}},"keywords":{}}],["assert_eq!(erc20.symbol",{"_index":2502,"title":{},"content":{"206":{"position":[[672,26]]},"269":{"position":[[4582,26]]},"409":{"position":[[4582,26]]},"426":{"position":[[672,26]]},"646":{"position":[[4582,26]]},"668":{"position":[[672,26]]}},"keywords":{}}],["assert_eq!(erc20.total_suppli",{"_index":2506,"title":{},"content":{"206":{"position":[[841,32]]},"269":{"position":[[4751,32]]},"409":{"position":[[4751,32]]},"426":{"position":[[841,32]]},"646":{"position":[[4751,32]]},"668":{"position":[[841,32]]}},"keywords":{}}],["assert_eq!(modules_contract.add_using_modul",{"_index":2017,"title":{},"content":{"151":{"position":[[331,47]]},"342":{"position":[[331,47]]},"556":{"position":[[331,47]]}},"keywords":{}}],["assert_eq!(operator.balance_of",{"_index":3530,"title":{},"content":{"441":{"position":[[5661,33]]},"688":{"position":[[5661,33]]}},"keywords":{}}],["assert_eq!(ownable.get_own",{"_index":2385,"title":{},"content":{"198":{"position":[[404,31],[732,31]]},"434":{"position":[[404,31],[727,31]]},"681":{"position":[[404,31],[732,31]]}},"keywords":{}}],["assert_eq!(result",{"_index":809,"title":{},"content":{"31":{"position":[[3317,18],[3646,18]]},"73":{"position":[[729,18]]},"237":{"position":[[729,18]]},"473":{"position":[[729,18]]}},"keywords":{}}],["assert_eq!(test_env.balance_of(my_contract.address",{"_index":2039,"title":{},"content":{"160":{"position":[[408,54],[530,54],[641,54]]},"345":{"position":[[408,54],[530,54],[641,54]]},"562":{"position":[[408,54],[530,54],[641,54]]}},"keywords":{}}],["assert_eq!(test_env.events_count(&party_contract",{"_index":3063,"title":{},"content":{"330":{"position":[[696,54]]}},"keywords":{}}],["assert_eq!(test_env.events_count(party_contract.address",{"_index":2034,"title":{},"content":{"157":{"position":[[715,59]]},"547":{"position":[[715,59]]}},"keywords":{}}],["assert_eq!(token.balance_of(&env.get_account(0",{"_index":3280,"title":{},"content":{"417":{"position":[[704,53],[1066,53]]},"419":{"position":[[7119,53],[7481,53]]},"654":{"position":[[704,53],[1066,53]]},"656":{"position":[[7119,53],[7481,53]]}},"keywords":{}}],["assert_eq!(token.balance_of(&env.get_account(1",{"_index":3282,"title":{},"content":{"417":{"position":[[913,53],[1548,53]]},"419":{"position":[[7328,53],[7963,53]]},"654":{"position":[[913,53],[1548,53]]},"656":{"position":[[7328,53],[7963,53]]}},"keywords":{}}],["assert_eq!(token.total_suppli",{"_index":3283,"title":{},"content":{"417":{"position":[[986,32]]},"419":{"position":[[7401,32]]},"654":{"position":[[986,32]]},"656":{"position":[[7401,32]]}},"keywords":{}}],["assert_ev",{"_index":2925,"title":{},"content":{"268":{"position":[[2704,14]]},"408":{"position":[[2704,14]]},"645":{"position":[[2704,14]]}},"keywords":{}}],["assert_ne!(cr",{"_index":2128,"title":{},"content":{"168":{"position":[[1069,19]]},"348":{"position":[[1069,19]]},"564":{"position":[[1069,19]]}},"keywords":{}}],["assert_vote_in_progress(&self",{"_index":3317,"title":{},"content":{"419":{"position":[[6148,34]]},"656":{"position":[[6148,34]]}},"keywords":{}}],["assign",{"_index":163,"title":{},"content":{"3":{"position":[[687,6]]},"182":{"position":[[139,8]]},"189":{"position":[[438,8]]},"366":{"position":[[438,8]]},"373":{"position":[[139,8]]},"419":{"position":[[3661,7]]},"582":{"position":[[438,8]]},"589":{"position":[[139,8]]},"596":{"position":[[1219,6]]},"656":{"position":[[3661,7]]},"704":{"position":[[1219,6]]}},"keywords":{}}],["assist",{"_index":2947,"title":{},"content":{"270":{"position":[[330,6]]},"385":{"position":[[330,6]]},"410":{"position":[[330,6]]},"627":{"position":[[330,6]]},"647":{"position":[[330,6]]}},"keywords":{}}],["associ",{"_index":132,"title":{},"content":{"3":{"position":[[184,11]]},"76":{"position":[[645,11]]},"79":{"position":[[66,10]]},"85":{"position":[[54,10],[226,10]]},"92":{"position":[[61,10]]},"168":{"position":[[1736,10]]},"227":{"position":[[645,11]]},"230":{"position":[[66,10]]},"254":{"position":[[54,10],[226,10]]},"284":{"position":[[61,10]]},"348":{"position":[[1736,10]]},"458":{"position":[[645,11]]},"461":{"position":[[66,10]]},"485":{"position":[[54,10],[226,10]]},"496":{"position":[[61,10]]},"564":{"position":[[1736,10]]}},"keywords":{}}],["assum",{"_index":1232,"title":{},"content":{"52":{"position":[[339,8]]},"65":{"position":[[272,8]]},"143":{"position":[[866,8]]},"174":{"position":[[147,6]]},"240":{"position":[[272,8]]},"328":{"position":[[841,8]]},"360":{"position":[[147,6]]},"465":{"position":[[272,8]]},"537":{"position":[[841,8]]},"576":{"position":[[147,6]]}},"keywords":{}}],["ast",{"_index":1010,"title":{},"content":{"39":{"position":[[3215,4],[3258,4]]}},"keywords":{}}],["async",{"_index":2623,"title":{},"content":{"212":{"position":[[628,5],[1437,5],[2522,5],[2808,5]]},"391":{"position":[[628,5],[1437,5],[2522,5],[2814,5]]},"661":{"position":[[628,5],[1437,5],[2522,5],[2814,5]]}},"keywords":{}}],["attach",{"_index":1603,"title":{},"content":{"92":{"position":[[886,8]]},"95":{"position":[[442,8]]},"102":{"position":[[393,6]]},"103":{"position":[[41,6],[520,6]]},"284":{"position":[[886,8]]},"287":{"position":[[442,8]]},"294":{"position":[[393,6]]},"295":{"position":[[41,6],[520,6]]},"478":{"position":[[181,8]]},"496":{"position":[[886,8]]},"499":{"position":[[442,8]]},"506":{"position":[[393,6]]},"507":{"position":[[41,6],[520,6]]},"700":{"position":[[181,8]]}},"keywords":{}}],["attached_valu",{"_index":1691,"title":{},"content":{"103":{"position":[[586,14]]},"295":{"position":[[586,14]]},"507":{"position":[[586,14]]}},"keywords":{}}],["attack",{"_index":1374,"title":{},"content":{"72":{"position":[[11,7],[221,8]]},"236":{"position":[[11,7],[221,8]]},"472":{"position":[[11,7],[221,8]]}},"keywords":{}}],["attempt",{"_index":2205,"title":{},"content":{"184":{"position":[[1222,10]]},"375":{"position":[[1119,10]]},"415":{"position":[[228,7]]},"440":{"position":[[6104,8]]},"591":{"position":[[1119,10]]},"599":{"position":[[558,8]]},"652":{"position":[[228,7]]},"687":{"position":[[6104,8]]},"707":{"position":[[558,8]]}},"keywords":{}}],["attribut",{"_index":1304,"title":{"69":{"position":[[0,10]]},"74":{"position":[[7,11]]},"233":{"position":[[0,10]]},"238":{"position":[[7,11]]},"469":{"position":[[0,10]]},"474":{"position":[[7,11]]}},"content":{"53":{"position":[[265,11],[389,11],[566,11],[718,11],[1138,9],[1255,11]]},"70":{"position":[[131,9],[223,9]]},"72":{"position":[[495,9]]},"74":{"position":[[36,10],[120,11],[306,10]]},"141":{"position":[[302,10],[944,10],[960,9]]},"195":{"position":[[356,9],[384,9]]},"198":{"position":[[1834,9]]},"230":{"position":[[273,10]]},"234":{"position":[[131,9],[223,9]]},"236":{"position":[[495,9]]},"238":{"position":[[36,10],[120,11],[306,10]]},"267":{"position":[[4060,9],[4321,9]]},"275":{"position":[[56,9]]},"296":{"position":[[143,10]]},"321":{"position":[[121,10],[323,10]]},"326":{"position":[[302,10],[944,10],[960,9]]},"334":{"position":[[425,10]]},"335":{"position":[[379,10],[663,9]]},"354":{"position":[[179,10],[724,9]]},"383":{"position":[[242,9],[293,10],[493,9],[545,10],[622,10],[962,9],[1009,10]]},"407":{"position":[[4060,9],[4321,9]]},"431":{"position":[[356,9],[384,9]]},"432":{"position":[[921,9]]},"434":{"position":[[1824,9]]},"440":{"position":[[4266,9]]},"461":{"position":[[273,10]]},"470":{"position":[[131,9],[223,9]]},"472":{"position":[[495,9]]},"474":{"position":[[36,10],[120,11],[306,10]]},"492":{"position":[[56,9]]},"508":{"position":[[143,10]]},"535":{"position":[[302,10],[944,10],[960,9]]},"539":{"position":[[121,10],[323,10]]},"551":{"position":[[425,10]]},"552":{"position":[[379,10],[663,9]]},"570":{"position":[[179,10],[724,9]]},"596":{"position":[[664,10]]},"602":{"position":[[592,10],[668,9],[1927,10]]},"606":{"position":[[997,10]]},"608":{"position":[[682,9]]},"610":{"position":[[554,10]]},"611":{"position":[[893,10]]},"614":{"position":[[453,9]]},"625":{"position":[[242,9],[293,10],[493,9],[545,10],[622,10],[962,9],[1009,10]]},"644":{"position":[[4060,9],[4321,9]]},"678":{"position":[[356,9],[384,9]]},"679":{"position":[[921,9]]},"681":{"position":[[1834,9]]},"687":{"position":[[4266,9]]},"704":{"position":[[664,10]]},"710":{"position":[[592,10],[668,9],[1927,10]]},"714":{"position":[[997,10]]},"716":{"position":[[682,9]]},"718":{"position":[[554,10]]},"719":{"position":[[893,10]]},"722":{"position":[[453,9]]}},"keywords":{}}],["attribute.contract_vers",{"_index":3048,"title":{},"content":{"324":{"position":[[333,26]]},"542":{"position":[[333,26]]}},"keywords":{}}],["attribute.l10",{"_index":3330,"title":{},"content":{"432":{"position":[[1429,13]]},"679":{"position":[[1429,13]]}},"keywords":{}}],["attribute.typ",{"_index":3051,"title":{},"content":{"324":{"position":[[493,15]]},"542":{"position":[[493,15]]}},"keywords":{}}],["audit",{"_index":681,"title":{},"content":{"23":{"position":[[270,5]]}},"keywords":{}}],["auth",{"_index":2955,"title":{},"content":{"277":{"position":[[1125,4]]}},"keywords":{}}],["author",{"_index":3044,"title":{},"content":{"324":{"position":[[142,8]]},"542":{"position":[[142,8]]}},"keywords":{}}],["auto",{"_index":1246,"title":{},"content":{"52":{"position":[[796,4]]}},"keywords":{}}],["autogener",{"_index":2001,"title":{},"content":{"148":{"position":[[202,13]]},"178":{"position":[[1208,13]]},"268":{"position":[[738,13]]},"336":{"position":[[202,13]]},"369":{"position":[[1208,13]]},"408":{"position":[[738,13]]},"553":{"position":[[202,13]]},"585":{"position":[[1208,13]]},"645":{"position":[[738,13]]}},"keywords":{}}],["automat",{"_index":1370,"title":{},"content":{"71":{"position":[[654,13]]},"98":{"position":[[653,14]]},"141":{"position":[[264,14]]},"189":{"position":[[424,13]]},"235":{"position":[[654,13]]},"290":{"position":[[653,14]]},"326":{"position":[[264,14]]},"366":{"position":[[424,13]]},"471":{"position":[[654,13]]},"502":{"position":[[653,14]]},"535":{"position":[[264,14]]},"582":{"position":[[424,13]]},"596":{"position":[[1062,14]]},"704":{"position":[[1062,14]]}},"keywords":{}}],["avail",{"_index":426,"title":{"187":{"position":[[0,9]]},"364":{"position":[[0,9]]},"580":{"position":[[0,9]]}},"content":{"15":{"position":[[631,9]]},"42":{"position":[[2802,9]]},"114":{"position":[[353,9]]},"117":{"position":[[680,9]]},"131":{"position":[[582,9]]},"147":{"position":[[524,9]]},"162":{"position":[[37,9]]},"164":{"position":[[1175,9]]},"174":{"position":[[317,9]]},"257":{"position":[[353,9]]},"268":{"position":[[2977,9]]},"298":{"position":[[680,9]]},"311":{"position":[[634,9]]},"321":{"position":[[222,9]]},"323":{"position":[[29,9]]},"335":{"position":[[528,9]]},"351":{"position":[[37,9]]},"353":{"position":[[1210,9]]},"360":{"position":[[317,9]]},"408":{"position":[[2977,9]]},"440":{"position":[[457,10],[2694,9],[4393,9]]},"480":{"position":[[353,9]]},"519":{"position":[[680,9]]},"528":{"position":[[634,9]]},"539":{"position":[[222,9]]},"541":{"position":[[29,9]]},"552":{"position":[[528,9]]},"567":{"position":[[37,9]]},"569":{"position":[[1210,9]]},"576":{"position":[[317,9]]},"598":{"position":[[2089,9]]},"600":{"position":[[733,9],[994,9]]},"645":{"position":[[2977,9]]},"687":{"position":[[457,10],[2694,9],[4393,9]]},"706":{"position":[[2089,9]]},"708":{"position":[[733,9],[994,9]]}},"keywords":{}}],["avoid",{"_index":3716,"title":{},"content":{"601":{"position":[[2146,5]]},"709":{"position":[[2146,5]]}},"keywords":{}}],["await",{"_index":2629,"title":{},"content":{"212":{"position":[[810,6],[1187,6]]},"391":{"position":[[810,6],[1187,6]]},"661":{"position":[[810,6],[1187,6]]}},"keywords":{}}],["awar",{"_index":421,"title":{},"content":{"15":{"position":[[466,5]]},"601":{"position":[[2064,5]]},"709":{"position":[[2064,5]]}},"keywords":{}}],["awesom",{"_index":388,"title":{},"content":{"12":{"position":[[310,7]]}},"keywords":{}}],["b",{"_index":234,"title":{},"content":{"8":{"position":[[136,1],[171,1],[365,2],[463,1]]},"9":{"position":[[76,1],[159,2],[494,1],[815,2]]},"30":{"position":[[221,2],[267,2]]},"42":{"position":[[2615,1]]},"43":{"position":[[878,1]]},"51":{"position":[[1715,1],[1934,1]]},"96":{"position":[[128,1],[210,1]]},"100":{"position":[[177,1]]},"101":{"position":[[109,1]]},"119":{"position":[[351,1],[1159,1]]},"120":{"position":[[271,1]]},"175":{"position":[[447,1]]},"179":{"position":[[80,1]]},"288":{"position":[[128,1],[210,1]]},"292":{"position":[[177,1]]},"293":{"position":[[109,1]]},"300":{"position":[[351,1],[1159,1]]},"301":{"position":[[271,1]]},"361":{"position":[[447,1]]},"370":{"position":[[80,1]]},"417":{"position":[[1697,1]]},"500":{"position":[[128,1],[210,1]]},"504":{"position":[[177,1]]},"505":{"position":[[109,1]]},"521":{"position":[[351,1],[1159,1]]},"522":{"position":[[271,1]]},"577":{"position":[[447,1]]},"586":{"position":[[80,1]]},"612":{"position":[[611,1],[660,1],[909,2],[1066,2],[1246,2]]},"654":{"position":[[1697,1]]},"720":{"position":[[611,1],[660,1],[909,2],[1066,2],[1246,2]]}},"keywords":{}}],["back",{"_index":63,"title":{},"content":{"1":{"position":[[815,4]]},"2":{"position":[[269,5]]},"164":{"position":[[6,4]]},"223":{"position":[[1354,4]]},"353":{"position":[[6,4]]},"416":{"position":[[4175,4]]},"419":{"position":[[5754,4]]},"456":{"position":[[1354,4]]},"569":{"position":[[6,4]]},"653":{"position":[[4175,4]]},"656":{"position":[[5754,4]]},"696":{"position":[[1354,4]]}},"keywords":{}}],["backend",{"_index":776,"title":{"109":{"position":[[10,8]]},"128":{"position":[[12,7]]},"279":{"position":[[12,7]]},"304":{"position":[[10,8]]},"509":{"position":[[10,8]]},"516":{"position":[[12,7]]}},"content":{"31":{"position":[[1974,7]]},"50":{"position":[[448,8]]},"67":{"position":[[52,7],[95,8]]},"68":{"position":[[91,7]]},"90":{"position":[[18,8],[34,7]]},"96":{"position":[[19,7]]},"106":{"position":[[26,7]]},"107":{"position":[[271,8]]},"108":{"position":[[16,7]]},"110":{"position":[[49,7],[387,8]]},"111":{"position":[[110,7]]},"112":{"position":[[23,8]]},"119":{"position":[[310,7],[1133,8]]},"126":{"position":[[15,8],[1363,8],[1523,8],[2079,8],[2315,8],[2531,8]]},"128":{"position":[[214,7]]},"129":{"position":[[61,8]]},"142":{"position":[[163,8]]},"175":{"position":[[401,8]]},"199":{"position":[[68,8]]},"242":{"position":[[52,7],[96,8]]},"243":{"position":[[91,7]]},"273":{"position":[[26,7]]},"274":{"position":[[271,8]]},"275":{"position":[[16,7]]},"277":{"position":[[15,8],[1531,8],[1691,8],[2247,8],[2483,8],[2699,8]]},"279":{"position":[[214,7]]},"280":{"position":[[61,8]]},"282":{"position":[[18,8],[34,7]]},"288":{"position":[[19,7]]},"300":{"position":[[310,7],[1133,8]]},"305":{"position":[[49,7],[387,8]]},"306":{"position":[[110,7]]},"307":{"position":[[23,8]]},"327":{"position":[[163,8]]},"361":{"position":[[401,8]]},"393":{"position":[[554,8]]},"398":{"position":[[96,7]]},"435":{"position":[[68,8]]},"467":{"position":[[52,7],[96,8]]},"468":{"position":[[91,7]]},"477":{"position":[[572,8]]},"478":{"position":[[360,7]]},"490":{"position":[[26,7]]},"491":{"position":[[271,8]]},"492":{"position":[[16,7]]},"494":{"position":[[18,8],[34,7]]},"500":{"position":[[19,7]]},"510":{"position":[[49,7],[387,8]]},"511":{"position":[[110,7]]},"512":{"position":[[23,8]]},"514":{"position":[[15,8],[1363,8],[1523,8],[2079,8],[2315,8],[2531,8]]},"516":{"position":[[214,7]]},"517":{"position":[[61,8]]},"521":{"position":[[310,7],[1133,8]]},"536":{"position":[[163,8]]},"577":{"position":[[401,8]]},"630":{"position":[[554,8]]},"635":{"position":[[96,7]]},"682":{"position":[[68,8]]},"699":{"position":[[572,8]]},"700":{"position":[[360,7]]}},"keywords":{}}],["background",{"_index":1783,"title":{},"content":{"119":{"position":[[910,10]]},"300":{"position":[[910,10]]},"521":{"position":[[910,10]]}},"keywords":{}}],["badg",{"_index":3300,"title":{},"content":{"419":{"position":[[1832,6]]},"656":{"position":[[1832,6]]}},"keywords":{}}],["balanc",{"_index":145,"title":{},"content":{"3":{"position":[[400,7]]},"17":{"position":[[1758,8],[2102,9]]},"31":{"position":[[1570,8],[1864,8]]},"72":{"position":[[300,7]]},"84":{"position":[[258,9]]},"85":{"position":[[542,9],[643,9]]},"94":{"position":[[586,8],[648,7]]},"126":{"position":[[3272,8],[3346,8]]},"127":{"position":[[527,8],[553,8]]},"168":{"position":[[1713,7]]},"203":{"position":[[260,9]]},"206":{"position":[[1363,7],[1488,7],[1848,8]]},"236":{"position":[[300,7]]},"253":{"position":[[258,9]]},"254":{"position":[[542,9],[643,9]]},"267":{"position":[[668,7]]},"269":{"position":[[428,9],[5273,7],[5398,7],[5758,8]]},"277":{"position":[[3440,8],[3514,8]]},"278":{"position":[[527,8],[553,8]]},"286":{"position":[[586,8],[648,7]]},"348":{"position":[[1713,7]]},"384":{"position":[[441,9]]},"395":{"position":[[1563,9],[1596,8],[1683,8],[6640,8],[6673,8]]},"407":{"position":[[668,7]]},"409":{"position":[[428,9],[5273,7],[5398,7],[5758,8]]},"416":{"position":[[4669,7]]},"419":{"position":[[2636,7]]},"423":{"position":[[260,9]]},"426":{"position":[[1358,7],[1483,7],[1838,8]]},"440":{"position":[[4765,7]]},"472":{"position":[[300,7]]},"476":{"position":[[277,9],[1312,7]]},"477":{"position":[[2057,8],[2227,8],[3394,8],[3776,8],[3958,7]]},"484":{"position":[[258,9]]},"485":{"position":[[542,9],[643,9]]},"498":{"position":[[586,8],[648,7]]},"514":{"position":[[3272,8],[3346,8]]},"515":{"position":[[527,8],[553,8]]},"564":{"position":[[1713,7]]},"611":{"position":[[414,7],[454,7]]},"626":{"position":[[441,9]]},"632":{"position":[[1563,9],[1596,8],[1683,8],[6640,8],[6673,8]]},"644":{"position":[[668,7]]},"646":{"position":[[428,9],[5273,7],[5398,7],[5758,8]]},"653":{"position":[[4669,7]]},"656":{"position":[[2636,7]]},"665":{"position":[[260,9]]},"668":{"position":[[1363,7],[1488,7],[1848,8]]},"687":{"position":[[4765,7]]},"698":{"position":[[277,9],[1312,7]]},"699":{"position":[[2057,8],[2227,8],[3394,8],[3776,8],[3958,7]]},"719":{"position":[[414,7],[454,7]]}},"keywords":{}}],["balance_of",{"_index":1860,"title":{},"content":{"127":{"position":[[807,10]]},"128":{"position":[[396,10]]},"160":{"position":[[99,11]]},"278":{"position":[[807,10]]},"279":{"position":[[396,10]]},"345":{"position":[[99,11]]},"515":{"position":[[807,10]]},"516":{"position":[[396,10]]},"562":{"position":[[99,11]]}},"keywords":{}}],["balance_of(&mut",{"_index":1489,"title":{},"content":{"80":{"position":[[527,19]]},"231":{"position":[[527,19]]},"462":{"position":[[527,19]]}},"keywords":{}}],["balance_of(&self",{"_index":528,"title":{},"content":{"17":{"position":[[2593,21]]},"115":{"position":[[959,21],[2551,21]]},"168":{"position":[[1643,21]]},"205":{"position":[[934,21]]},"247":{"position":[[578,21]]},"258":{"position":[[917,21],[2489,21]]},"267":{"position":[[3884,21]]},"348":{"position":[[1643,21]]},"407":{"position":[[3884,21]]},"419":{"position":[[2669,21]]},"425":{"position":[[909,21]]},"440":{"position":[[3251,21]]},"441":{"position":[[1533,21]]},"446":{"position":[[578,21]]},"481":{"position":[[917,21],[2489,21]]},"564":{"position":[[1643,21]]},"644":{"position":[[3884,21]]},"656":{"position":[[2669,21]]},"667":{"position":[[909,21]]},"673":{"position":[[578,21]]},"687":{"position":[[3251,21]]},"688":{"position":[[1533,21]]}},"keywords":{}}],["ballot",{"_index":3226,"title":{},"content":{"416":{"position":[[770,6],[820,6],[1200,8],[2607,7]]},"417":{"position":[[557,6]]},"419":{"position":[[182,6],[232,6],[6972,6]]},"653":{"position":[[770,6],[820,6],[1200,8],[2607,7]]},"654":{"position":[[557,6]]},"656":{"position":[[182,6],[232,6],[6972,6]]}},"keywords":{}}],["bar",{"_index":3083,"title":{},"content":{"354":{"position":[[616,3]]},"396":{"position":[[134,3]]},"570":{"position":[[616,3]]},"633":{"position":[[134,3]]}},"keywords":{}}],["bark",{"_index":2050,"title":{},"content":{"162":{"position":[[372,6],[791,6]]},"351":{"position":[[409,6],[813,6]]},"567":{"position":[[409,6],[813,6]]}},"keywords":{}}],["barks(&self",{"_index":2060,"title":{},"content":{"162":{"position":[[956,16]]},"351":{"position":[[978,16]]},"567":{"position":[[978,16]]}},"keywords":{}}],["base",{"_index":175,"title":{},"content":{"5":{"position":[[132,5]]},"7":{"position":[[103,5]]},"16":{"position":[[88,5]]},"20":{"position":[[455,5],[597,5],[644,5]]},"22":{"position":[[401,5],[749,5]]},"31":{"position":[[336,5]]},"39":{"position":[[776,5],[1413,5]]},"189":{"position":[[62,5]]},"366":{"position":[[62,5]]},"582":{"position":[[62,5]]},"594":{"position":[[86,5]]},"595":{"position":[[155,5]]},"612":{"position":[[1561,4]]},"617":{"position":[[1327,5]]},"702":{"position":[[86,5]]},"703":{"position":[[155,5]]},"720":{"position":[[1561,4]]},"725":{"position":[[1327,5]]}},"keywords":{}}],["basic",{"_index":1411,"title":{"76":{"position":[[10,5]]},"227":{"position":[[10,5]]},"458":{"position":[[10,5]]}},"content":{"76":{"position":[[61,5],[109,5],[945,5]]},"78":{"position":[[26,5]]},"115":{"position":[[23,5],[1611,9]]},"128":{"position":[[441,10]]},"180":{"position":[[53,5]]},"195":{"position":[[219,6]]},"227":{"position":[[61,5],[109,5],[945,5]]},"229":{"position":[[26,5]]},"258":{"position":[[23,5],[1557,9]]},"279":{"position":[[441,10]]},"371":{"position":[[53,5]]},"431":{"position":[[219,6]]},"458":{"position":[[61,5],[109,5],[945,5]]},"460":{"position":[[26,5]]},"481":{"position":[[23,5],[1557,9]]},"516":{"position":[[441,10]]},"587":{"position":[[53,5]]},"594":{"position":[[304,6]]},"596":{"position":[[110,5]]},"610":{"position":[[950,6]]},"618":{"position":[[469,6]]},"678":{"position":[[219,6]]},"702":{"position":[[304,6]]},"704":{"position":[[110,5]]},"718":{"position":[[950,6]]},"726":{"position":[[469,6]]}},"keywords":{}}],["battl",{"_index":84,"title":{},"content":{"1":{"position":[[1063,6]]}},"keywords":{}}],["battlefield",{"_index":1224,"title":{},"content":{"52":{"position":[[83,11]]}},"keywords":{}}],["battleship",{"_index":383,"title":{},"content":{"12":{"position":[[163,10]]}},"keywords":{}}],["baz",{"_index":3084,"title":{},"content":{"354":{"position":[[625,3]]},"570":{"position":[[625,3]]}},"keywords":{}}],["be",{"_index":251,"title":{},"content":{"8":{"position":[[539,5]]},"39":{"position":[[57,5]]},"43":{"position":[[1884,5]]},"72":{"position":[[76,5]]},"86":{"position":[[7,5]]},"91":{"position":[[325,5]]},"236":{"position":[[76,5]]},"255":{"position":[[7,5]]},"283":{"position":[[325,5]]},"472":{"position":[[76,5]]},"486":{"position":[[7,5]]},"495":{"position":[[325,5]]}},"keywords":{}}],["beauti",{"_index":1218,"title":{},"content":{"51":{"position":[[1643,6]]}},"keywords":{}}],["becom",{"_index":81,"title":{},"content":{"1":{"position":[[1001,6]]},"22":{"position":[[339,6]]},"115":{"position":[[3106,7]]},"258":{"position":[[3032,7]]},"481":{"position":[[3032,7]]}},"keywords":{}}],["befor",{"_index":182,"title":{},"content":{"5":{"position":[[220,7]]},"52":{"position":[[432,6]]},"72":{"position":[[104,6],[321,6]]},"76":{"position":[[0,6]]},"86":{"position":[[0,6]]},"95":{"position":[[51,6]]},"102":{"position":[[227,6]]},"127":{"position":[[148,6]]},"182":{"position":[[0,6]]},"185":{"position":[[3106,6]]},"194":{"position":[[0,6]]},"195":{"position":[[226,6]]},"196":{"position":[[805,6],[866,6]]},"227":{"position":[[0,6]]},"236":{"position":[[104,6],[321,6]]},"255":{"position":[[0,6]]},"261":{"position":[[0,6]]},"262":{"position":[[0,6]]},"265":{"position":[[400,6]]},"267":{"position":[[880,6]]},"269":{"position":[[57,6]]},"278":{"position":[[148,6]]},"287":{"position":[[51,6]]},"294":{"position":[[227,6]]},"373":{"position":[[0,6]]},"376":{"position":[[3090,6]]},"379":{"position":[[0,6]]},"380":{"position":[[0,6]]},"384":{"position":[[57,6]]},"395":{"position":[[6758,6]]},"401":{"position":[[0,6]]},"402":{"position":[[0,6]]},"405":{"position":[[400,6]]},"407":{"position":[[880,6]]},"409":{"position":[[57,6]]},"430":{"position":[[0,6]]},"431":{"position":[[226,6]]},"432":{"position":[[743,6],[804,6]]},"458":{"position":[[0,6]]},"472":{"position":[[104,6],[321,6]]},"477":{"position":[[0,6]]},"486":{"position":[[0,6]]},"499":{"position":[[51,6]]},"506":{"position":[[227,6]]},"515":{"position":[[148,6]]},"589":{"position":[[0,6]]},"592":{"position":[[3090,6]]},"594":{"position":[[414,6]]},"606":{"position":[[666,6],[770,6]]},"621":{"position":[[0,6]]},"622":{"position":[[0,6]]},"626":{"position":[[57,6]]},"632":{"position":[[6758,6]]},"638":{"position":[[0,6]]},"639":{"position":[[0,6]]},"642":{"position":[[400,6]]},"644":{"position":[[880,6]]},"646":{"position":[[57,6]]},"677":{"position":[[0,6]]},"678":{"position":[[226,6]]},"679":{"position":[[743,6],[804,6]]},"699":{"position":[[0,6]]},"702":{"position":[[414,6]]},"714":{"position":[[666,6],[770,6]]}},"keywords":{}}],["begin",{"_index":1973,"title":{},"content":{"143":{"position":[[629,6]]},"168":{"position":[[1131,9]]},"261":{"position":[[11,5]]},"328":{"position":[[604,6]]},"348":{"position":[[1131,9]]},"379":{"position":[[11,5]]},"401":{"position":[[11,5]]},"537":{"position":[[604,6]]},"564":{"position":[[1131,9]]},"594":{"position":[[490,10]]},"621":{"position":[[11,5]]},"638":{"position":[[11,5]]},"702":{"position":[[490,10]]}},"keywords":{}}],["behalf",{"_index":2206,"title":{},"content":{"184":{"position":[[1265,7]]},"202":{"position":[[302,6]]},"375":{"position":[[1162,7]]},"419":{"position":[[2947,6]]},"422":{"position":[[302,6]]},"441":{"position":[[146,6],[1451,6],[1869,6]]},"591":{"position":[[1162,7]]},"656":{"position":[[2947,6]]},"664":{"position":[[302,6]]},"688":{"position":[[146,6],[1451,6],[1869,6]]}},"keywords":{}}],["behalf.each",{"_index":2174,"title":{},"content":{"182":{"position":[[314,11]]},"373":{"position":[[314,11]]},"589":{"position":[[314,11]]}},"keywords":{}}],["behavior",{"_index":2093,"title":{},"content":{"163":{"position":[[1273,8]]},"352":{"position":[[1295,8]]},"568":{"position":[[1295,8]]},"612":{"position":[[202,8]]},"720":{"position":[[202,8]]}},"keywords":{}}],["behind",{"_index":1595,"title":{},"content":{"92":{"position":[[538,6]]},"284":{"position":[[538,6]]},"496":{"position":[[538,6]]}},"keywords":{}}],["believ",{"_index":66,"title":{},"content":{"1":{"position":[[847,7]]},"22":{"position":[[684,7]]}},"keywords":{}}],["below",{"_index":235,"title":{},"content":{"8":{"position":[[138,5]]},"31":{"position":[[2818,5]]},"265":{"position":[[348,5]]},"405":{"position":[[348,5]]},"441":{"position":[[260,5]]},"642":{"position":[[348,5]]},"688":{"position":[[260,5]]}},"keywords":{}}],["benchmark",{"_index":722,"title":{},"content":{"31":{"position":[[355,9]]}},"keywords":{}}],["bend",{"_index":448,"title":{},"content":{"17":{"position":[[15,4]]}},"keywords":{}}],["benefici",{"_index":1443,"title":{},"content":{"79":{"position":[[386,10]]},"230":{"position":[[403,10]]},"461":{"position":[[403,10]]}},"keywords":{}}],["besid",{"_index":1584,"title":{},"content":{"91":{"position":[[544,7]]},"154":{"position":[[0,7]]},"283":{"position":[[544,7]]},"339":{"position":[[0,7]]},"396":{"position":[[388,7]]},"495":{"position":[[544,7]]},"559":{"position":[[0,7]]},"633":{"position":[[388,7]]}},"keywords":{}}],["best",{"_index":30,"title":{},"content":{"1":{"position":[[329,4],[707,4]]},"20":{"position":[[374,4]]}},"keywords":{}}],["better",{"_index":936,"title":{},"content":{"39":{"position":[[1011,7]]},"88":{"position":[[346,6]]},"97":{"position":[[253,6]]},"115":{"position":[[41,6]]},"168":{"position":[[1548,6]]},"250":{"position":[[346,6]]},"258":{"position":[[41,6]]},"289":{"position":[[253,6]]},"348":{"position":[[1548,6]]},"481":{"position":[[41,6]]},"488":{"position":[[346,6]]},"501":{"position":[[253,6]]},"564":{"position":[[1548,6]]},"601":{"position":[[2136,6]]},"709":{"position":[[2136,6]]}},"keywords":{}}],["between",{"_index":146,"title":{},"content":{"3":{"position":[[408,7]]},"39":{"position":[[892,7]]},"92":{"position":[[412,7]]},"126":{"position":[[2065,7]]},"128":{"position":[[685,7]]},"129":{"position":[[113,7]]},"145":{"position":[[151,7]]},"146":{"position":[[343,7]]},"277":{"position":[[2233,7]]},"279":{"position":[[685,7]]},"280":{"position":[[113,7]]},"284":{"position":[[412,7]]},"333":{"position":[[151,7]]},"334":{"position":[[343,7]]},"346":{"position":[[96,7]]},"496":{"position":[[412,7]]},"514":{"position":[[2065,7]]},"516":{"position":[[685,7]]},"517":{"position":[[113,7]]},"550":{"position":[[151,7]]},"551":{"position":[[343,7]]},"612":{"position":[[88,7],[357,7],[2138,7]]},"616":{"position":[[1169,7]]},"720":{"position":[[88,7],[357,7],[2138,7]]},"724":{"position":[[1169,7]]}},"keywords":{}}],["bewar",{"_index":3303,"title":{},"content":{"419":{"position":[[2092,7]]},"656":{"position":[[2092,7]]}},"keywords":{}}],["beyond",{"_index":560,"title":{},"content":{"18":{"position":[[437,7]]}},"keywords":{}}],["big",{"_index":2603,"title":{},"content":{"211":{"position":[[601,3]]},"212":{"position":[[3593,3]]},"267":{"position":[[307,3]]},"390":{"position":[[575,3]]},"391":{"position":[[3611,3]]},"407":{"position":[[307,3]]},"644":{"position":[[307,3]]},"660":{"position":[[575,3]]},"661":{"position":[[3611,3]]}},"keywords":{}}],["bigger",{"_index":1176,"title":{},"content":{"44":{"position":[[257,6]]}},"keywords":{}}],["biggest",{"_index":2092,"title":{},"content":{"163":{"position":[[1046,7]]},"352":{"position":[[1068,7]]},"568":{"position":[[1068,7]]},"598":{"position":[[310,7],[436,7]]},"706":{"position":[[310,7],[436,7]]}},"keywords":{}}],["bin",{"_index":701,"title":{"134":{"position":[[0,5]]},"264":{"position":[[8,3]]},"314":{"position":[[0,5]]},"382":{"position":[[27,4]]},"404":{"position":[[8,3]]},"531":{"position":[[0,5]]},"624":{"position":[[27,4]]},"641":{"position":[[8,3]]}},"content":{"30":{"position":[[489,3]]},"65":{"position":[[151,3]]},"68":{"position":[[289,3]]},"126":{"position":[[3516,5]]},"127":{"position":[[102,3]]},"129":{"position":[[596,3]]},"131":{"position":[[224,7],[327,7]]},"240":{"position":[[151,3]]},"243":{"position":[[289,3]]},"264":{"position":[[157,3],[252,3]]},"265":{"position":[[186,4],[626,7],[733,7]]},"277":{"position":[[3684,5]]},"278":{"position":[[102,3]]},"280":{"position":[[596,3]]},"311":{"position":[[276,7],[379,7]]},"395":{"position":[[199,3],[3181,7],[3285,7],[3385,7],[4398,3]]},"404":{"position":[[157,3],[252,3]]},"405":{"position":[[186,4],[626,7],[733,7]]},"465":{"position":[[151,3]]},"468":{"position":[[289,3]]},"477":{"position":[[1115,7],[2514,3]]},"514":{"position":[[3516,5]]},"515":{"position":[[102,3]]},"517":{"position":[[596,3]]},"528":{"position":[[276,7],[379,7]]},"632":{"position":[[199,3],[3181,7],[3285,7],[3385,7],[4398,3]]},"641":{"position":[[157,3],[252,3]]},"642":{"position":[[186,4],[626,7],[733,7]]},"699":{"position":[[1115,7],[2514,3]]}},"keywords":{}}],["bin/bash",{"_index":3553,"title":{},"content":{"477":{"position":[[370,9]]},"699":{"position":[[370,9]]}},"keywords":{}}],["bin/our_token_livenet.r",{"_index":3119,"title":{},"content":{"395":{"position":[[211,24]]},"632":{"position":[[211,24]]}},"keywords":{}}],["binari",{"_index":1807,"title":{},"content":{"126":{"position":[[1201,6],[3433,7]]},"127":{"position":[[49,6],[169,7]]},"277":{"position":[[1369,6],[3601,7]]},"278":{"position":[[49,6],[169,7]]},"395":{"position":[[2491,7]]},"514":{"position":[[1201,6],[3433,7]]},"515":{"position":[[49,6],[169,7]]},"632":{"position":[[2491,7]]}},"keywords":{}}],["bind",{"_index":618,"title":{},"content":{"20":{"position":[[1080,4]]},"248":{"position":[[279,8]]},"447":{"position":[[279,8]]},"674":{"position":[[279,8]]}},"keywords":{}}],["binding.l10",{"_index":2338,"title":{},"content":{"196":{"position":[[1079,11]]}},"keywords":{}}],["binding.l4",{"_index":3326,"title":{},"content":{"432":{"position":[[1024,10]]},"679":{"position":[[1024,10]]}},"keywords":{}}],["birch",{"_index":725,"title":{},"content":{"31":{"position":[[394,5]]}},"keywords":{}}],["bit",{"_index":562,"title":{"20":{"position":[[2,3]]}},"content":{"20":{"position":[[1023,3]]},"31":{"position":[[3048,3]]}},"keywords":{}}],["blake2::digest::variableoutput>::new(32",{"_index":2674,"title":{},"content":{"212":{"position":[[4155,43]]},"391":{"position":[[4173,43]]},"661":{"position":[[4173,43]]}},"keywords":{}}],["blake2::digest::variableoutput::finalize_variable(hash",{"_index":2678,"title":{},"content":{"212":{"position":[[4297,57]]},"391":{"position":[[4315,57]]},"661":{"position":[[4315,57]]}},"keywords":{}}],["blake2b",{"_index":2664,"title":{},"content":{"212":{"position":[[3705,7]]},"391":{"position":[[3723,7]]},"616":{"position":[[1320,7]]},"661":{"position":[[3723,7]]},"724":{"position":[[1320,7]]}},"keywords":{}}],["blake2b(&key",{"_index":2669,"title":{},"content":{"212":{"position":[[3988,18]]},"391":{"position":[[4006,18]]},"661":{"position":[[4006,18]]}},"keywords":{}}],["blake2b(byt",{"_index":2671,"title":{},"content":{"212":{"position":[[4041,14]]},"391":{"position":[[4059,14]]},"661":{"position":[[4059,14]]}},"keywords":{}}],["blake2b.return",{"_index":2607,"title":{},"content":{"211":{"position":[[701,14]]},"390":{"position":[[675,14]]},"660":{"position":[[675,14]]}},"keywords":{}}],["blank",{"_index":1030,"title":{},"content":{"42":{"position":[[229,5]]},"117":{"position":[[609,5],[645,5]]},"298":{"position":[[609,5],[645,5]]},"519":{"position":[[609,5],[645,5]]}},"keywords":{}}],["block",{"_index":880,"title":{},"content":{"38":{"position":[[746,5]]},"44":{"position":[[246,5]]},"72":{"position":[[395,5]]},"76":{"position":[[470,5],[780,7]]},"95":{"position":[[420,5]]},"110":{"position":[[582,5]]},"111":{"position":[[356,5]]},"147":{"position":[[93,5]]},"178":{"position":[[377,5]]},"185":{"position":[[2932,5],[3008,5]]},"204":{"position":[[1013,6]]},"221":{"position":[[469,5]]},"227":{"position":[[470,5],[780,7]]},"236":{"position":[[395,5]]},"287":{"position":[[420,5]]},"305":{"position":[[582,5]]},"306":{"position":[[356,5]]},"335":{"position":[[93,5]]},"369":{"position":[[377,5]]},"376":{"position":[[2916,5],[2992,5]]},"395":{"position":[[1276,5]]},"396":{"position":[[58,5]]},"398":{"position":[[167,5]]},"419":{"position":[[1217,5]]},"424":{"position":[[964,6]]},"454":{"position":[[469,5]]},"458":{"position":[[470,5],[780,7]]},"472":{"position":[[395,5]]},"499":{"position":[[420,5]]},"510":{"position":[[582,5]]},"511":{"position":[[356,5]]},"552":{"position":[[93,5]]},"585":{"position":[[377,5]]},"592":{"position":[[2916,5],[2992,5]]},"604":{"position":[[79,6]]},"607":{"position":[[173,5],[254,5]]},"632":{"position":[[1276,5]]},"633":{"position":[[58,5]]},"635":{"position":[[167,5]]},"656":{"position":[[1217,5]]},"666":{"position":[[964,6]]},"694":{"position":[[469,5]]},"712":{"position":[[79,6]]},"715":{"position":[[173,5],[254,5]]}},"keywords":{}}],["block"",{"_index":1250,"title":{},"content":{"52":{"position":[[839,11]]}},"keywords":{}}],["block_base_fee_per_ga",{"_index":759,"title":{},"content":{"31":{"position":[[1278,23]]}},"keywords":{}}],["block_coinbas",{"_index":753,"title":{},"content":{"31":{"position":[[1107,15]]}},"keywords":{}}],["block_difficulti",{"_index":755,"title":{},"content":{"31":{"position":[[1180,17]]}},"keywords":{}}],["block_gas_limit",{"_index":756,"title":{},"content":{"31":{"position":[[1218,16]]}},"keywords":{}}],["block_hash",{"_index":749,"title":{},"content":{"31":{"position":[[1047,13]]}},"keywords":{}}],["block_numb",{"_index":751,"title":{},"content":{"31":{"position":[[1073,13]]}},"keywords":{}}],["block_tim",{"_index":2031,"title":{},"content":{"157":{"position":[[495,11]]},"330":{"position":[[481,11]]},"547":{"position":[[495,11]]}},"keywords":{}}],["block_timefn",{"_index":2138,"title":{},"content":{"168":{"position":[[1851,12]]},"348":{"position":[[1851,12]]},"564":{"position":[[1851,12]]}},"keywords":{}}],["block_timestamp",{"_index":754,"title":{},"content":{"31":{"position":[[1143,16]]}},"keywords":{}}],["blockchain",{"_index":169,"title":{},"content":{"5":{"position":[[68,12]]},"20":{"position":[[226,10],[461,10],[603,10],[650,11]]},"21":{"position":[[15,10]]},"22":{"position":[[407,12]]},"38":{"position":[[885,10],[948,11],[1006,12]]},"50":{"position":[[71,10],[219,11],[472,11]]},"52":{"position":[[532,10]]},"97":{"position":[[79,11]]},"107":{"position":[[317,11],[442,10]]},"110":{"position":[[102,10],[487,10]]},"111":{"position":[[219,10]]},"119":{"position":[[761,10]]},"126":{"position":[[1601,11]]},"127":{"position":[[667,10]]},"128":{"position":[[46,10],[155,10],[270,10]]},"136":{"position":[[128,11]]},"141":{"position":[[827,11]]},"143":{"position":[[665,11]]},"145":{"position":[[87,11]]},"146":{"position":[[596,11],[736,11]]},"147":{"position":[[1422,11]]},"162":{"position":[[133,10],[2013,10]]},"198":{"position":[[2601,10]]},"274":{"position":[[317,11],[442,10]]},"277":{"position":[[1769,11]]},"278":{"position":[[667,10]]},"279":{"position":[[46,10],[155,10],[270,10]]},"289":{"position":[[79,11]]},"300":{"position":[[761,10]]},"305":{"position":[[102,10],[487,10]]},"306":{"position":[[219,10]]},"316":{"position":[[128,11]]},"326":{"position":[[827,11]]},"328":{"position":[[640,11]]},"333":{"position":[[87,11]]},"334":{"position":[[600,11],[740,11]]},"335":{"position":[[1430,11]]},"351":{"position":[[133,10],[2035,10]]},"434":{"position":[[2591,10]]},"491":{"position":[[317,11],[442,10]]},"501":{"position":[[79,11]]},"510":{"position":[[102,10],[487,10]]},"511":{"position":[[219,10]]},"514":{"position":[[1601,11]]},"515":{"position":[[667,10]]},"516":{"position":[[46,10],[155,10],[270,10]]},"521":{"position":[[761,10]]},"533":{"position":[[128,11]]},"535":{"position":[[827,11]]},"537":{"position":[[640,11]]},"550":{"position":[[87,11]]},"551":{"position":[[600,11],[740,11]]},"552":{"position":[[1430,11]]},"567":{"position":[[133,10],[2035,10]]},"600":{"position":[[603,10],[709,10],[838,11]]},"606":{"position":[[1044,10]]},"618":{"position":[[274,10]]},"681":{"position":[[2601,10]]},"708":{"position":[[603,10],[709,10],[838,11]]},"714":{"position":[[1044,10]]},"726":{"position":[[274,10]]}},"keywords":{}}],["blockchain'",{"_index":1987,"title":{},"content":{"145":{"position":[[262,12]]},"333":{"position":[[262,12]]},"550":{"position":[[262,12]]}},"keywords":{}}],["blog",{"_index":13,"title":{},"content":{"1":{"position":[[120,4]]}},"keywords":{}}],["blow",{"_index":402,"title":{},"content":{"15":{"position":[[114,7]]}},"keywords":{}}],["bob",{"_index":3066,"title":{},"content":{"346":{"position":[[198,4]]}},"keywords":{}}],["bodi",{"_index":3770,"title":{},"content":{"606":{"position":[[938,4]]},"714":{"position":[[938,4]]}},"keywords":{}}],["boo",{"_index":3624,"title":{},"content":{"598":{"position":[[190,4]]},"601":{"position":[[940,4]]},"706":{"position":[[190,4]]},"709":{"position":[[940,4]]}},"keywords":{}}],["bool",{"_index":480,"title":{},"content":{"17":{"position":[[768,5],[958,4]]},"22":{"position":[[1221,5],[1342,4]]},"79":{"position":[[215,5]]},"98":{"position":[[275,4],[414,4]]},"147":{"position":[[1108,5]]},"162":{"position":[[798,5],[979,4]]},"168":{"position":[[2141,4]]},"178":{"position":[[695,5],[978,4]]},"185":{"position":[[596,4]]},"220":{"position":[[66,5]]},"221":{"position":[[107,4]]},"230":{"position":[[215,5]]},"290":{"position":[[275,4],[414,4]]},"335":{"position":[[1116,5]]},"348":{"position":[[2151,4]]},"351":{"position":[[820,5],[1001,4]]},"369":{"position":[[695,5],[978,4]]},"376":{"position":[[580,4]]},"416":{"position":[[853,5],[2695,5]]},"419":{"position":[[265,5],[4650,5]]},"441":{"position":[[3606,4]]},"453":{"position":[[66,5]]},"454":{"position":[[107,4]]},"461":{"position":[[215,5]]},"502":{"position":[[275,4],[414,4]]},"552":{"position":[[1116,5]]},"564":{"position":[[2141,4]]},"567":{"position":[[820,5],[1001,4]]},"585":{"position":[[695,5],[978,4]]},"592":{"position":[[580,4]]},"598":{"position":[[1185,4]]},"601":{"position":[[818,4],[945,5]]},"602":{"position":[[1037,5]]},"616":{"position":[[1014,4]]},"653":{"position":[[853,5],[2695,5]]},"656":{"position":[[265,5],[4650,5]]},"688":{"position":[[3606,4]]},"693":{"position":[[66,5]]},"694":{"position":[[107,4]]},"706":{"position":[[1185,4]]},"709":{"position":[[818,4],[945,5]]},"710":{"position":[[1037,5]]},"724":{"position":[[1014,4]]}},"keywords":{}}],["bool>",{"_index":2215,"title":{},"content":{"185":{"position":[[436,9]]},"376":{"position":[[420,9]]},"592":{"position":[[420,9]]}},"keywords":{}}],["boolean",{"_index":659,"title":{},"content":{"22":{"position":[[886,7]]}},"keywords":{}}],["boption",{"_index":1778,"title":{},"content":{"119":{"position":[[325,8]]},"300":{"position":[[325,8]]},"521":{"position":[[325,8]]}},"keywords":{}}],["borrow",{"_index":34,"title":{},"content":{"1":{"position":[[366,8]]},"84":{"position":[[612,10],[695,10],[813,9]]},"85":{"position":[[577,10]]},"253":{"position":[[612,10],[695,10],[813,9]]},"254":{"position":[[577,10]]},"484":{"position":[[612,10],[695,10],[813,9]]},"485":{"position":[[577,10]]}},"keywords":{}}],["borrowers.balances.get(0x1234abcd",{"_index":1551,"title":{},"content":{"85":{"position":[[875,34]]},"254":{"position":[[875,34]]},"485":{"position":[[875,34]]}},"keywords":{}}],["both",{"_index":324,"title":{},"content":{"10":{"position":[[267,4]]},"39":{"position":[[96,4]]},"70":{"position":[[71,4]]},"74":{"position":[[295,4]]},"84":{"position":[[706,4],[885,4]]},"115":{"position":[[1463,4]]},"234":{"position":[[71,4]]},"238":{"position":[[295,4]]},"247":{"position":[[1649,4]]},"253":{"position":[[706,4],[885,4]]},"258":{"position":[[1409,4]]},"264":{"position":[[468,4]]},"382":{"position":[[281,4]]},"404":{"position":[[468,4]]},"416":{"position":[[1107,4]]},"417":{"position":[[80,4],[1650,4]]},"419":{"position":[[1950,4]]},"446":{"position":[[1649,4]]},"470":{"position":[[71,4]]},"474":{"position":[[295,4]]},"478":{"position":[[241,4]]},"481":{"position":[[1409,4]]},"484":{"position":[[706,4],[885,4]]},"596":{"position":[[627,4]]},"601":{"position":[[1999,4]]},"612":{"position":[[1369,4]]},"613":{"position":[[1496,4]]},"616":{"position":[[1339,4]]},"624":{"position":[[281,4]]},"641":{"position":[[468,4]]},"653":{"position":[[1107,4]]},"654":{"position":[[80,4],[1650,4]]},"656":{"position":[[1950,4]]},"673":{"position":[[1649,4]]},"700":{"position":[[241,4]]},"704":{"position":[[627,4]]},"709":{"position":[[1999,4]]},"720":{"position":[[1369,4]]},"721":{"position":[[1496,4]]},"724":{"position":[[1339,4]]}},"keywords":{}}],["box",{"_index":425,"title":{},"content":{"15":{"position":[[605,4]]}},"keywords":{}}],["bparamet",{"_index":1633,"title":{},"content":{"96":{"position":[[99,11]]},"288":{"position":[[99,11]]},"500":{"position":[[99,11]]}},"keywords":{}}],["branch",{"_index":1766,"title":{},"content":{"117":{"position":[[1105,7]]},"298":{"position":[[1105,7]]},"519":{"position":[[1105,7]]}},"keywords":{}}],["breviti",{"_index":3548,"title":{},"content":{"476":{"position":[[1286,7],[1428,7],[1533,7]]},"698":{"position":[[1286,7],[1428,7],[1533,7]]}},"keywords":{}}],["bridg",{"_index":368,"title":{},"content":{"11":{"position":[[142,9]]}},"keywords":{}}],["briefli",{"_index":3118,"title":{},"content":{"395":{"position":[[95,7]]},"632":{"position":[[95,7]]}},"keywords":{}}],["bring",{"_index":37,"title":{},"content":{"1":{"position":[[407,5]]},"20":{"position":[[1049,5]]},"21":{"position":[[330,5]]},"22":{"position":[[700,5]]}},"keywords":{}}],["broadcast",{"_index":1249,"title":{},"content":{"52":{"position":[[824,9]]}},"keywords":{}}],["broader",{"_index":3064,"title":{},"content":{"346":{"position":[[5,7]]}},"keywords":{}}],["btreemap::new",{"_index":761,"title":{},"content":{"31":{"position":[[1377,16],[1610,16],[1904,16],[2169,16]]}},"keywords":{}}],["bug",{"_index":2650,"title":{},"content":{"212":{"position":[[2394,3]]},"391":{"position":[[2394,3]]},"661":{"position":[[2394,3]]}},"keywords":{}}],["build",{"_index":258,"title":{"64":{"position":[[0,8]]},"65":{"position":[[0,8]]},"120":{"position":[[0,8]]},"208":{"position":[[0,6]]},"239":{"position":[[0,8]]},"240":{"position":[[0,8]]},"301":{"position":[[0,8]]},"387":{"position":[[0,6]]},"464":{"position":[[0,8]]},"465":{"position":[[0,8]]},"522":{"position":[[0,8]]},"657":{"position":[[0,6]]}},"content":{"9":{"position":[[39,5]]},"12":{"position":[[118,8]]},"23":{"position":[[197,8]]},"42":{"position":[[436,6],[2626,5]]},"43":{"position":[[841,5],[1642,5]]},"44":{"position":[[237,8]]},"50":{"position":[[42,8],[210,8]]},"51":{"position":[[1708,5],[1785,5],[1861,8]]},"65":{"position":[[3,5],[101,5],[265,6],[341,5]]},"68":{"position":[[21,5],[249,5]]},"76":{"position":[[461,8],[771,8]]},"88":{"position":[[407,8],[451,8]]},"96":{"position":[[203,5]]},"100":{"position":[[170,5]]},"101":{"position":[[102,5]]},"102":{"position":[[625,5]]},"103":{"position":[[733,8],[770,5]]},"115":{"position":[[1737,5]]},"119":{"position":[[394,6]]},"120":{"position":[[13,5],[129,5],[143,5],[296,5],[355,5]]},"121":{"position":[[344,5]]},"132":{"position":[[103,5]]},"134":{"position":[[195,6]]},"135":{"position":[[36,5]]},"136":{"position":[[35,5]]},"174":{"position":[[51,5]]},"185":{"position":[[2923,8]]},"210":{"position":[[266,5]]},"227":{"position":[[461,8],[771,8]]},"240":{"position":[[3,5],[101,5],[265,6],[341,5]]},"243":{"position":[[21,5],[249,5]]},"250":{"position":[[407,8],[451,8]]},"258":{"position":[[1683,5]]},"264":{"position":[[35,5]]},"265":{"position":[[333,5]]},"288":{"position":[[203,5]]},"292":{"position":[[170,5]]},"293":{"position":[[102,5]]},"294":{"position":[[625,5]]},"295":{"position":[[733,8],[770,5]]},"300":{"position":[[394,6]]},"301":{"position":[[13,5],[129,5],[143,5],[296,5],[355,5]]},"302":{"position":[[344,5]]},"311":{"position":[[224,6],[250,5]]},"312":{"position":[[103,5]]},"314":{"position":[[195,6]]},"315":{"position":[[36,5]]},"316":{"position":[[35,5]]},"360":{"position":[[51,5]]},"376":{"position":[[2907,8]]},"389":{"position":[[266,5]]},"395":{"position":[[3002,6],[3028,5]]},"404":{"position":[[35,5]]},"405":{"position":[[333,5]]},"458":{"position":[[461,8],[771,8]]},"465":{"position":[[3,5],[101,5],[265,6],[341,5]]},"468":{"position":[[21,5],[249,5]]},"477":{"position":[[276,5],[306,5]]},"481":{"position":[[1683,5]]},"488":{"position":[[407,8],[451,8]]},"500":{"position":[[203,5]]},"504":{"position":[[170,5]]},"505":{"position":[[102,5]]},"506":{"position":[[625,5]]},"507":{"position":[[733,8],[770,5]]},"521":{"position":[[394,6]]},"522":{"position":[[13,5],[129,5],[143,5],[296,5],[355,5]]},"523":{"position":[[344,5]]},"528":{"position":[[224,6],[250,5]]},"529":{"position":[[103,5]]},"531":{"position":[[195,6]]},"532":{"position":[[36,5]]},"533":{"position":[[35,5]]},"576":{"position":[[51,5]]},"592":{"position":[[2907,8]]},"632":{"position":[[3002,6],[3028,5]]},"641":{"position":[[35,5]]},"642":{"position":[[333,5]]},"659":{"position":[[266,5]]},"699":{"position":[[276,5],[306,5]]}},"keywords":{}}],["build.r",{"_index":1033,"title":{},"content":{"42":{"position":[[317,8],[531,8],[2750,8]]},"183":{"position":[[115,8]]},"374":{"position":[[115,8]]},"590":{"position":[[115,8]]}},"keywords":{}}],["build_contract.r",{"_index":2797,"title":{},"content":{"264":{"position":[[201,17],[284,17]]},"404":{"position":[[201,17],[284,17]]},"641":{"position":[[201,17],[284,17]]}},"keywords":{}}],["build_schema.r",{"_index":2798,"title":{"382":{"position":[[11,15]]},"624":{"position":[[11,15]]}},"content":{"264":{"position":[[223,15],[306,15]]},"382":{"position":[[120,15]]},"404":{"position":[[223,15],[306,15]]},"624":{"position":[[120,15]]},"641":{"position":[[223,15],[306,15]]}},"keywords":{}}],["builder_casp",{"_index":2794,"title":{},"content":{"264":{"position":[[62,15]]},"404":{"position":[[62,15]]},"641":{"position":[[62,15]]}},"keywords":{}}],["built",{"_index":15,"title":{},"content":{"1":{"position":[[139,5]]},"22":{"position":[[120,5],[577,5]]},"38":{"position":[[980,5]]},"52":{"position":[[13,5],[271,5]]},"76":{"position":[[735,5]]},"95":{"position":[[109,5]]},"127":{"position":[[191,5]]},"165":{"position":[[30,5]]},"227":{"position":[[735,5]]},"278":{"position":[[191,5]]},"287":{"position":[[109,5]]},"354":{"position":[[30,5]]},"458":{"position":[[735,5]]},"499":{"position":[[109,5]]},"515":{"position":[[191,5]]},"570":{"position":[[30,5]]}},"keywords":{}}],["bunch",{"_index":638,"title":{},"content":{"21":{"position":[[344,5]]},"265":{"position":[[8,5]]},"405":{"position":[[8,5]]},"642":{"position":[[8,5]]}},"keywords":{}}],["burn",{"_index":1670,"title":{},"content":{"100":{"position":[[998,4]]},"101":{"position":[[699,4]]},"292":{"position":[[998,4]]},"293":{"position":[[699,4]]},"419":{"position":[[3764,5]]},"504":{"position":[[998,4]]},"505":{"position":[[699,4]]},"656":{"position":[[3764,5]]}},"keywords":{}}],["burn(&mut",{"_index":2934,"title":{},"content":{"269":{"position":[[2160,13]]},"384":{"position":[[2180,13]]},"409":{"position":[[2160,13]]},"419":{"position":[[3824,13]]},"626":{"position":[[2180,13]]},"646":{"position":[[2160,13]]},"656":{"position":[[3824,13]]}},"keywords":{}}],["burnabl",{"_index":1107,"title":{},"content":{"43":{"position":[[85,8]]}},"keywords":{}}],["butterfli",{"_index":1270,"title":{},"content":{"52":{"position":[[1882,9]]}},"keywords":{}}],["button",{"_index":3116,"title":{},"content":{"394":{"position":[[327,7]]},"631":{"position":[[327,7]]}},"keywords":{}}],["buy",{"_index":3433,"title":{},"content":{"440":{"position":[[4673,3],[4729,3],[5902,3]]},"441":{"position":[[128,6],[1432,4],[1852,4],[2215,3]]},"687":{"position":[[4673,3],[4729,3],[5902,3]]},"688":{"position":[[128,6],[1432,4],[1852,4],[2215,3]]}},"keywords":{}}],["buy_ticket",{"_index":3427,"title":{},"content":{"440":{"position":[[4295,10],[4349,10],[6023,10]]},"441":{"position":[[1025,12],[1832,10],[2098,10],[4126,10]]},"687":{"position":[[4295,10],[4349,10],[6023,10]]},"688":{"position":[[1025,12],[1832,10],[2098,10],[4126,10]]}},"keywords":{}}],["buy_ticket(&mut",{"_index":3398,"title":{},"content":{"440":{"position":[[2239,19]]},"441":{"position":[[1078,19],[3114,19]]},"687":{"position":[[2239,19]]},"688":{"position":[[1078,19],[3114,19]]}},"keywords":{}}],["buy_ticket(&oper",{"_index":3527,"title":{},"content":{"441":{"position":[[5383,25],[5578,25]]},"688":{"position":[[5383,25],[5578,25]]}},"keywords":{}}],["buy_ticket(oper",{"_index":3532,"title":{},"content":{"441":{"position":[[5718,20]]},"688":{"position":[[5718,20]]}},"keywords":{}}],["buyer",{"_index":3361,"title":{},"content":{"440":{"position":[[736,6],[2352,5],[2834,5],[3034,5],[3105,7],[3232,5],[4420,5],[4478,6],[5351,5],[5868,5],[5970,5],[6098,5]]},"441":{"position":[[8,5],[160,6],[1153,5],[1465,5],[1509,6],[1883,5],[3161,6],[5320,5]]},"687":{"position":[[736,6],[2352,5],[2834,5],[3034,5],[3105,7],[3232,5],[4420,5],[4478,6],[5351,5],[5868,5],[5970,5],[6098,5]]},"688":{"position":[[8,5],[160,6],[1153,5],[1465,5],[1509,6],[1883,5],[3161,6],[5320,5]]}},"keywords":{}}],["byte",{"_index":699,"title":{},"content":{"30":{"position":[[449,4]]},"83":{"position":[[438,4]]},"85":{"position":[[425,6]]},"86":{"position":[[66,5]]},"103":{"position":[[288,5],[451,5]]},"185":{"position":[[2512,4]]},"189":{"position":[[149,5]]},"211":{"position":[[612,4],[689,5]]},"212":{"position":[[1337,6],[1566,5],[1642,5],[1659,6],[1757,5],[1781,6],[1947,5],[1968,6],[2159,5],[2223,5],[2351,5],[2469,5],[2668,5],[2746,5],[2960,5],[3082,5],[3160,5],[3604,4],[3693,5],[4289,7]]},"252":{"position":[[438,4]]},"254":{"position":[[425,6]]},"255":{"position":[[66,5]]},"295":{"position":[[288,5],[451,5]]},"366":{"position":[[149,5]]},"376":{"position":[[2496,4]]},"390":{"position":[[586,4],[663,5]]},"391":{"position":[[1337,6],[1566,5],[1642,5],[1659,6],[1757,5],[1781,6],[1947,5],[1968,6],[2159,5],[2223,5],[2351,5],[2469,5],[2674,5],[2752,5],[2972,5],[3100,5],[3178,5],[3622,4],[3711,5],[4307,7]]},"483":{"position":[[438,4]]},"485":{"position":[[425,6]]},"486":{"position":[[66,5]]},"507":{"position":[[288,5],[451,5]]},"582":{"position":[[149,5]]},"592":{"position":[[2496,4]]},"598":{"position":[[493,6],[1951,5],[1979,4]]},"609":{"position":[[52,5]]},"616":{"position":[[1361,4],[1397,4]]},"660":{"position":[[586,4],[663,5]]},"661":{"position":[[1337,6],[1566,5],[1642,5],[1659,6],[1757,5],[1781,6],[1947,5],[1968,6],[2159,5],[2223,5],[2351,5],[2469,5],[2674,5],[2752,5],[2972,5],[3100,5],[3178,5],[3622,4],[3711,5],[4307,7]]},"706":{"position":[[493,6],[1951,5],[1979,4]]},"717":{"position":[[52,5]]},"724":{"position":[[1361,4],[1397,4]]}},"keywords":{}}],["bytecod",{"_index":707,"title":{},"content":{"30":{"position":[[568,8],[623,8],[639,8],[664,9]]},"31":{"position":[[163,8]]}},"keywords":{}}],["bytecode/calculator.sol",{"_index":690,"title":{},"content":{"30":{"position":[[143,23],[579,23]]}},"keywords":{}}],["bytesarray(32",{"_index":1684,"title":{},"content":{"103":{"position":[[97,14]]},"295":{"position":[[97,14]]},"507":{"position":[[97,14]]}},"keywords":{}}],["bytesrepr::{frombyt",{"_index":2615,"title":{},"content":{"212":{"position":[[127,22]]},"391":{"position":[[127,22]]},"661":{"position":[[127,22]]}},"keywords":{}}],["c",{"_index":288,"title":{},"content":{"9":{"position":[[798,2],[807,1],[822,2],[1011,3]]},"73":{"position":[[374,1]]},"100":{"position":[[187,1]]},"101":{"position":[[119,1]]},"118":{"position":[[106,1]]},"120":{"position":[[334,1],[362,1]]},"121":{"position":[[376,1]]},"210":{"position":[[273,1]]},"237":{"position":[[374,1]]},"292":{"position":[[187,1]]},"293":{"position":[[119,1]]},"299":{"position":[[106,1]]},"301":{"position":[[334,1],[362,1]]},"302":{"position":[[376,1]]},"322":{"position":[[90,1]]},"389":{"position":[[273,1]]},"441":{"position":[[501,1]]},"473":{"position":[[374,1]]},"477":{"position":[[313,1],[381,1]]},"504":{"position":[[187,1]]},"505":{"position":[[119,1]]},"520":{"position":[[106,1]]},"522":{"position":[[334,1],[362,1]]},"523":{"position":[[376,1]]},"540":{"position":[[90,1]]},"612":{"position":[[758,1],[807,1],[932,2],[1089,2]]},"659":{"position":[[273,1]]},"688":{"position":[[501,1]]},"699":{"position":[[313,1],[381,1]]},"720":{"position":[[758,1],[807,1],[932,2],[1089,2]]}},"keywords":{}}],["c3",{"_index":928,"title":{},"content":{"39":{"position":[[838,2],[1090,2],[1140,2],[1501,2],[1558,2],[3212,2]]}},"keywords":{}}],["calcul",{"_index":686,"title":{},"content":{"30":{"position":[[57,10],[176,10]]},"31":{"position":[[526,10],[666,10]]},"211":{"position":[[98,9]]},"390":{"position":[[98,9]]},"660":{"position":[[98,9]]}},"keywords":{}}],["calculator.add(7",{"_index":829,"title":{},"content":{"32":{"position":[[575,17],[1711,17]]}},"keywords":{}}],["calculator.bin",{"_index":710,"title":{},"content":{"30":{"position":[[674,14]]}},"keywords":{}}],["calculator.fibonacci(4",{"_index":852,"title":{},"content":{"32":{"position":[[1767,23]]}},"keywords":{}}],["calculator.fibonacci(4)"",{"_index":835,"title":{},"content":{"32":{"position":[[878,31]]}},"keywords":{}}],["calculator.sol",{"_index":711,"title":{},"content":{"30":{"position":[[697,14]]}},"keywords":{}}],["calculator_evm_program",{"_index":731,"title":{},"content":{"31":{"position":[[557,23]]}},"keywords":{}}],["call",{"_index":115,"title":{"140":{"position":[[6,5]]},"325":{"position":[[6,5]]},"534":{"position":[[6,5]]}},"content":{"2":{"position":[[447,4]]},"8":{"position":[[30,6]]},"10":{"position":[[806,7]]},"11":{"position":[[38,6]]},"16":{"position":[[29,6],[97,6]]},"17":{"position":[[1744,6]]},"31":{"position":[[211,4],[2283,4]]},"32":{"position":[[502,7]]},"39":{"position":[[1363,6]]},"51":{"position":[[264,4]]},"52":{"position":[[287,6],[2004,5],[2074,4]]},"54":{"position":[[277,5]]},"72":{"position":[[82,6],[328,7],[411,5]]},"79":{"position":[[1484,4]]},"83":{"position":[[289,6]]},"92":{"position":[[792,7],[909,5]]},"93":{"position":[[64,4]]},"94":{"position":[[118,6],[204,4],[414,4],[599,4]]},"102":{"position":[[234,7],[302,5],[369,4],[531,5]]},"103":{"position":[[163,5]]},"108":{"position":[[290,5]]},"111":{"position":[[273,7]]},"126":{"position":[[1236,5],[2968,5],[3079,4]]},"127":{"position":[[273,7],[655,4],[757,4],[799,7]]},"128":{"position":[[4,5],[228,5],[407,4],[513,4],[561,7]]},"138":{"position":[[1057,7],[1192,4]]},"141":{"position":[[161,4],[370,4],[1501,5]]},"143":{"position":[[36,5]]},"147":{"position":[[538,7],[849,5],[867,5]]},"148":{"position":[[583,6]]},"154":{"position":[[248,6]]},"158":{"position":[[38,4]]},"168":{"position":[[168,7],[1457,7]]},"175":{"position":[[130,6]]},"194":{"position":[[121,6],[225,6]]},"195":{"position":[[286,6]]},"196":{"position":[[1135,4],[1303,4],[1576,4]]},"197":{"position":[[1381,6],[1616,4]]},"198":{"position":[[1270,4],[1481,4],[1694,7],[2705,7],[2812,4],[2845,4],[3264,4],[3383,4],[3528,4]]},"210":{"position":[[1065,4]]},"223":{"position":[[100,6],[1253,4]]},"230":{"position":[[1501,4]]},"236":{"position":[[82,6],[328,7],[411,5]]},"246":{"position":[[22,6]]},"252":{"position":[[289,6]]},"264":{"position":[[150,6]]},"267":{"position":[[3127,5],[3517,7],[3602,4],[3733,4],[4177,7]]},"268":{"position":[[2141,4],[2214,4]]},"275":{"position":[[294,5]]},"277":{"position":[[1404,5],[3136,5],[3247,4]]},"278":{"position":[[273,7],[655,4],[757,4],[799,7]]},"279":{"position":[[4,5],[228,5],[407,4],[513,4],[561,7]]},"284":{"position":[[792,7],[909,5]]},"285":{"position":[[64,4]]},"286":{"position":[[118,6],[204,4],[414,4],[599,4]]},"294":{"position":[[234,7],[302,5],[369,4],[531,5]]},"295":{"position":[[163,5]]},"306":{"position":[[273,7]]},"318":{"position":[[1049,7],[1184,4]]},"324":{"position":[[933,6],[1154,6],[1346,4],[1401,4]]},"326":{"position":[[161,4],[370,4],[1501,5]]},"328":{"position":[[36,5]]},"331":{"position":[[38,4]]},"335":{"position":[[542,7],[857,5],[875,5]]},"336":{"position":[[583,6]]},"339":{"position":[[248,6]]},"348":{"position":[[168,7],[1457,7]]},"361":{"position":[[130,6]]},"389":{"position":[[1002,4]]},"395":{"position":[[4283,6],[5192,7],[5663,7],[6141,6],[6182,7]]},"404":{"position":[[150,6]]},"407":{"position":[[3127,5],[3517,7],[3602,4],[3733,4],[4177,7]]},"408":{"position":[[2141,4],[2214,4]]},"430":{"position":[[121,6],[225,6]]},"431":{"position":[[286,6]]},"432":{"position":[[1078,4],[1245,4],[1454,4]]},"433":{"position":[[1380,6],[1615,4]]},"434":{"position":[[1260,4],[1471,4],[1684,7],[2695,7],[2802,4],[2835,4],[3246,4],[3365,4],[3510,4]]},"441":{"position":[[1948,4],[3927,5]]},"442":{"position":[[217,6]]},"445":{"position":[[22,6]]},"456":{"position":[[100,6],[1253,4]]},"461":{"position":[[1501,4]]},"472":{"position":[[82,6],[328,7],[411,5]]},"477":{"position":[[3023,7],[3417,7],[4055,4]]},"478":{"position":[[89,5]]},"483":{"position":[[289,6]]},"492":{"position":[[294,5]]},"496":{"position":[[792,7],[909,5]]},"497":{"position":[[64,4]]},"498":{"position":[[118,6],[204,4],[414,4],[599,4]]},"506":{"position":[[234,7],[302,5],[369,4],[531,5]]},"507":{"position":[[163,5]]},"511":{"position":[[273,7]]},"514":{"position":[[1236,5],[2968,5],[3079,4]]},"515":{"position":[[273,7],[655,4],[757,4],[799,7]]},"516":{"position":[[4,5],[228,5],[407,4],[513,4],[561,7]]},"535":{"position":[[161,4],[370,4],[1501,5]]},"537":{"position":[[36,5]]},"542":{"position":[[933,6],[1154,6],[1346,4],[1401,4]]},"544":{"position":[[1049,7],[1184,4]]},"548":{"position":[[38,4]]},"552":{"position":[[542,7],[857,5],[875,5]]},"553":{"position":[[583,6]]},"559":{"position":[[248,6]]},"564":{"position":[[168,7],[1457,7]]},"577":{"position":[[130,6]]},"598":{"position":[[2019,6]]},"605":{"position":[[474,7]]},"606":{"position":[[763,6],[842,6]]},"607":{"position":[[220,5],[280,5]]},"609":{"position":[[32,7],[96,5],[110,6],[329,4]]},"612":{"position":[[1495,6]]},"613":{"position":[[1565,5],[2182,6]]},"614":{"position":[[121,6],[210,6],[302,7]]},"617":{"position":[[509,4],[586,4],[981,5]]},"632":{"position":[[4283,6],[5192,7],[5663,7],[6141,6],[6182,7]]},"641":{"position":[[150,6]]},"644":{"position":[[3127,5],[3517,7],[3602,4],[3733,4],[4177,7]]},"645":{"position":[[2141,4],[2214,4]]},"659":{"position":[[1002,4]]},"672":{"position":[[22,6]]},"677":{"position":[[121,6],[225,6]]},"678":{"position":[[286,6]]},"679":{"position":[[1078,4],[1245,4],[1454,4]]},"680":{"position":[[1380,6],[1615,4]]},"681":{"position":[[1270,4],[1481,4],[1694,7],[2705,7],[2812,4],[2845,4],[3264,4],[3383,4],[3528,4]]},"688":{"position":[[1948,4],[3927,5]]},"689":{"position":[[217,6]]},"696":{"position":[[100,6],[1253,4]]},"699":{"position":[[3023,7],[3417,7],[4055,4]]},"700":{"position":[[89,5]]},"706":{"position":[[2019,6]]},"713":{"position":[[474,7]]},"714":{"position":[[763,6],[842,6]]},"715":{"position":[[220,5],[280,5]]},"717":{"position":[[32,7],[96,5],[110,6],[329,4]]},"720":{"position":[[1495,6]]},"721":{"position":[[1565,5],[2182,6]]},"722":{"position":[[121,6],[210,6],[302,7]]},"725":{"position":[[509,4],[586,4],[981,5]]}},"keywords":{}}],["call.amount",{"_index":1690,"title":{},"content":{"103":{"position":[[534,12]]},"295":{"position":[[534,12]]},"507":{"position":[[534,12]]}},"keywords":{}}],["call.arg",{"_index":1687,"title":{},"content":{"103":{"position":[[276,9]]},"295":{"position":[[276,9]]},"507":{"position":[[276,9]]}},"keywords":{}}],["call_contract<t",{"_index":2870,"title":{},"content":{"267":{"position":[[2910,19],[3064,19]]},"407":{"position":[[2910,19],[3064,19]]},"644":{"position":[[2910,19],[3064,19]]}},"keywords":{}}],["callabl",{"_index":1997,"title":{},"content":{"147":{"position":[[729,9]]},"335":{"position":[[737,9]]},"552":{"position":[[737,9]]}},"keywords":{}}],["calldata",{"_index":3744,"title":{},"content":{"603":{"position":[[165,9]]},"609":{"position":[[61,8]]},"711":{"position":[[165,9]]},"717":{"position":[[61,8]]}},"keywords":{}}],["calldef",{"_index":2874,"title":{},"content":{"267":{"position":[[3133,8]]},"407":{"position":[[3133,8]]},"644":{"position":[[3133,8]]}},"keywords":{}}],["caller",{"_index":457,"title":{"475":{"position":[[12,6]]},"697":{"position":[[12,6]]}},"content":{"17":{"position":[[278,9],[3163,6],[3366,9],[3664,8]]},"31":{"position":[[1724,7]]},"71":{"position":[[101,7],[555,7]]},"95":{"position":[[224,6]]},"138":{"position":[[99,6]]},"157":{"position":[[462,7]]},"168":{"position":[[1322,6]]},"184":{"position":[[1212,6]]},"185":{"position":[[3167,6]]},"197":{"position":[[1197,7]]},"198":{"position":[[3314,6]]},"204":{"position":[[162,6]]},"205":{"position":[[367,6]]},"235":{"position":[[101,7],[555,7]]},"247":{"position":[[1947,6]]},"269":{"position":[[666,6],[1113,6]]},"287":{"position":[[224,6]]},"318":{"position":[[99,6]]},"330":{"position":[[448,7]]},"348":{"position":[[1322,6]]},"375":{"position":[[1109,6]]},"376":{"position":[[3151,6]]},"384":{"position":[[679,6],[1126,6]]},"395":{"position":[[633,6]]},"409":{"position":[[666,6],[1113,6]]},"419":{"position":[[2961,7],[3357,6]]},"424":{"position":[[137,6]]},"425":{"position":[[342,6]]},"433":{"position":[[1196,7]]},"434":{"position":[[3296,6]]},"440":{"position":[[1710,6]]},"441":{"position":[[2572,6],[3256,6],[3296,6],[3583,7],[4160,6],[4331,6]]},"446":{"position":[[1947,6]]},"471":{"position":[[101,7],[555,7]]},"476":{"position":[[694,7],[1149,7]]},"477":{"position":[[1759,6],[3848,6],[3891,6]]},"499":{"position":[[224,6]]},"544":{"position":[[99,6]]},"547":{"position":[[462,7]]},"564":{"position":[[1322,6]]},"591":{"position":[[1109,6]]},"592":{"position":[[3151,6]]},"626":{"position":[[679,6],[1126,6]]},"632":{"position":[[633,6]]},"646":{"position":[[666,6],[1113,6]]},"656":{"position":[[2961,7],[3357,6]]},"666":{"position":[[137,6]]},"667":{"position":[[342,6]]},"673":{"position":[[1947,6]]},"680":{"position":[[1196,7]]},"681":{"position":[[3314,6]]},"687":{"position":[[1710,6]]},"688":{"position":[[2572,6],[3256,6],[3296,6],[3583,7],[4160,6],[4331,6]]},"698":{"position":[[694,7],[1149,7]]},"699":{"position":[[1759,6],[3848,6],[3891,6]]}},"keywords":{}}],["caller'",{"_index":3268,"title":{},"content":{"416":{"position":[[4706,9]]},"477":{"position":[[3385,8]]},"653":{"position":[[4706,9]]},"699":{"position":[[3385,8]]}},"keywords":{}}],["callercurr",{"_index":879,"title":{},"content":{"38":{"position":[[732,13]]}},"keywords":{}}],["callstack",{"_index":1620,"title":{},"content":{"94":{"position":[[286,9]]},"286":{"position":[[286,9]]},"498":{"position":[[286,9]]}},"keywords":{}}],["can't",{"_index":3619,"title":{},"content":{"596":{"position":[[1213,5]]},"611":{"position":[[949,5]]},"613":{"position":[[1281,5],[1319,5]]},"704":{"position":[[1213,5]]},"719":{"position":[[949,5]]},"721":{"position":[[1281,5],[1319,5]]}},"keywords":{}}],["cancel",{"_index":3721,"title":{},"content":{"602":{"position":[[147,9]]},"710":{"position":[[147,9]]}},"keywords":{}}],["cancel(&mut",{"_index":3725,"title":{},"content":{"602":{"position":[[396,15]]},"710":{"position":[[396,15]]}},"keywords":{}}],["candid",{"_index":1182,"title":{},"content":{"50":{"position":[[426,9]]}},"keywords":{}}],["cannotlocktwic",{"_index":3552,"title":{},"content":{"476":{"position":[[1658,15]]},"698":{"position":[[1658,15]]}},"keywords":{}}],["cap",{"_index":1108,"title":{},"content":{"43":{"position":[[98,6]]}},"keywords":{}}],["cap_",{"_index":1117,"title":{},"content":{"43":{"position":[[284,5]]}},"keywords":{}}],["capabl",{"_index":2750,"title":{},"content":{"245":{"position":[[26,7]]},"444":{"position":[[26,7]]},"671":{"position":[[26,7]]}},"keywords":{}}],["cappederc20",{"_index":1102,"title":{"43":{"position":[[0,12]]}},"content":{"43":{"position":[[40,11]]}},"keywords":{}}],["captur",{"_index":2416,"title":{},"content":{"198":{"position":[[3509,7]]},"434":{"position":[[3491,7]]},"610":{"position":[[839,8]]},"681":{"position":[[3509,7]]},"718":{"position":[[839,8]]}},"keywords":{}}],["care",{"_index":252,"title":{},"content":{"8":{"position":[[545,7]]},"22":{"position":[[162,4]]},"38":{"position":[[150,4]]},"321":{"position":[[99,4]]},"539":{"position":[[99,4]]}},"keywords":{}}],["carefulli",{"_index":2948,"title":{},"content":{"270":{"position":[[396,9]]},"385":{"position":[[396,9]]},"410":{"position":[[396,9]]},"627":{"position":[[396,9]]},"647":{"position":[[396,9]]}},"keywords":{}}],["cargo",{"_index":669,"title":{"116":{"position":[[0,5]]},"174":{"position":[[11,5]]},"261":{"position":[[12,5]]},"297":{"position":[[0,5]]},"360":{"position":[[11,5]]},"379":{"position":[[12,5]]},"401":{"position":[[12,5]]},"518":{"position":[[0,5]]},"576":{"position":[[11,5]]},"621":{"position":[[12,5]]},"638":{"position":[[12,5]]}},"content":{"22":{"position":[[1409,5]]},"32":{"position":[[1675,5]]},"42":{"position":[[189,5],[201,5],[2555,5],[2598,5]]},"43":{"position":[[814,5],[861,5]]},"51":{"position":[[1685,5],[1697,5]]},"54":{"position":[[462,5]]},"65":{"position":[[32,5],[95,5]]},"66":{"position":[[36,5]]},"67":{"position":[[164,5]]},"68":{"position":[[243,5],[539,5]]},"92":{"position":[[366,5],[487,5],[605,5]]},"96":{"position":[[111,5],[192,5]]},"98":{"position":[[593,5]]},"100":{"position":[[159,5]]},"101":{"position":[[91,5]]},"106":{"position":[[75,5]]},"117":{"position":[[61,5],[139,5],[627,5],[969,5],[1041,5],[1150,5],[1295,5]]},"118":{"position":[[85,5]]},"119":{"position":[[81,5],[334,5],[383,5],[870,5],[933,5],[975,5],[1063,5],[1142,5]]},"120":{"position":[[118,5],[344,5]]},"121":{"position":[[132,5]]},"122":{"position":[[79,5]]},"127":{"position":[[90,5]]},"129":{"position":[[584,5]]},"132":{"position":[[92,5],[363,5]]},"134":{"position":[[145,5],[184,5],[202,5],[222,5]]},"135":{"position":[[19,5]]},"136":{"position":[[24,5],[45,5]]},"148":{"position":[[947,5]]},"154":{"position":[[18,5]]},"174":{"position":[[0,5],[235,5],[249,5],[343,5]]},"175":{"position":[[41,5],[175,5],[295,5],[430,5]]},"179":{"position":[[49,5]]},"210":{"position":[[255,5]]},"212":{"position":[[4440,5]]},"240":{"position":[[32,5],[95,5]]},"241":{"position":[[36,5]]},"242":{"position":[[165,5]]},"243":{"position":[[243,5],[539,5]]},"261":{"position":[[90,5],[165,5],[179,5]]},"266":{"position":[[22,5]]},"273":{"position":[[75,5]]},"278":{"position":[[90,5]]},"280":{"position":[[584,5]]},"284":{"position":[[366,5],[487,5],[605,5]]},"288":{"position":[[111,5],[192,5]]},"290":{"position":[[593,5]]},"292":{"position":[[159,5]]},"293":{"position":[[91,5]]},"298":{"position":[[61,5],[139,5],[627,5],[969,5],[1041,5],[1150,5],[1295,5]]},"299":{"position":[[85,5]]},"300":{"position":[[81,5],[334,5],[383,5],[870,5],[933,5],[975,5],[1063,5],[1142,5]]},"301":{"position":[[118,5],[344,5]]},"302":{"position":[[132,5]]},"303":{"position":[[79,5]]},"312":{"position":[[92,5],[363,5]]},"314":{"position":[[145,5],[184,5],[202,5],[222,5]]},"315":{"position":[[19,5]]},"316":{"position":[[24,5],[45,5]]},"322":{"position":[[41,5],[61,5]]},"336":{"position":[[947,5]]},"339":{"position":[[18,5]]},"360":{"position":[[0,5],[235,5],[249,5],[343,5]]},"361":{"position":[[41,5],[175,5],[295,5],[430,5]]},"370":{"position":[[49,5]]},"379":{"position":[[90,5],[165,5],[179,5]]},"389":{"position":[[255,5]]},"391":{"position":[[4458,5]]},"395":{"position":[[4386,5]]},"401":{"position":[[90,5],[165,5],[179,5]]},"406":{"position":[[22,5]]},"414":{"position":[[104,5],[644,5]]},"417":{"position":[[1664,5],[1680,5]]},"439":{"position":[[63,5],[136,5]]},"441":{"position":[[451,5],[480,5]]},"465":{"position":[[32,5],[95,5]]},"466":{"position":[[36,5]]},"467":{"position":[[165,5]]},"468":{"position":[[243,5],[539,5]]},"477":{"position":[[295,5],[2502,5]]},"490":{"position":[[75,5]]},"496":{"position":[[366,5],[487,5],[605,5]]},"500":{"position":[[111,5],[192,5]]},"502":{"position":[[593,5]]},"504":{"position":[[159,5]]},"505":{"position":[[91,5]]},"515":{"position":[[90,5]]},"517":{"position":[[584,5]]},"519":{"position":[[61,5],[139,5],[627,5],[969,5],[1041,5],[1150,5],[1295,5]]},"520":{"position":[[85,5]]},"521":{"position":[[81,5],[334,5],[383,5],[870,5],[933,5],[975,5],[1063,5],[1142,5]]},"522":{"position":[[118,5],[344,5]]},"523":{"position":[[132,5]]},"524":{"position":[[79,5]]},"529":{"position":[[92,5],[363,5]]},"531":{"position":[[145,5],[184,5],[202,5],[222,5]]},"532":{"position":[[19,5]]},"533":{"position":[[24,5],[45,5]]},"540":{"position":[[41,5],[61,5]]},"553":{"position":[[947,5]]},"559":{"position":[[18,5]]},"576":{"position":[[0,5],[235,5],[249,5],[343,5]]},"577":{"position":[[41,5],[175,5],[295,5],[430,5]]},"586":{"position":[[49,5]]},"621":{"position":[[90,5],[165,5],[179,5]]},"632":{"position":[[4386,5]]},"638":{"position":[[90,5],[165,5],[179,5]]},"643":{"position":[[22,5]]},"651":{"position":[[104,5],[644,5]]},"654":{"position":[[1664,5],[1680,5]]},"659":{"position":[[255,5]]},"661":{"position":[[4458,5]]},"686":{"position":[[63,5],[136,5]]},"688":{"position":[[451,5],[480,5]]},"699":{"position":[[295,5],[2502,5]]}},"keywords":{}}],["cargo.toml",{"_index":1034,"title":{"131":{"position":[[0,11]]},"265":{"position":[[12,11]]},"311":{"position":[[0,11]]},"405":{"position":[[12,11]]},"528":{"position":[[0,11]]},"642":{"position":[[12,11]]}},"content":{"42":{"position":[[425,10],[2763,10]]},"117":{"position":[[314,10]]},"131":{"position":[[27,10]]},"183":{"position":[[128,10]]},"265":{"position":[[32,10],[374,10]]},"298":{"position":[[314,10]]},"311":{"position":[[27,10]]},"324":{"position":[[211,10],[440,10]]},"374":{"position":[[128,10]]},"395":{"position":[[2410,10],[2537,10]]},"405":{"position":[[32,10],[374,10]]},"477":{"position":[[713,10]]},"519":{"position":[[314,10]]},"528":{"position":[[27,10]]},"542":{"position":[[211,10],[440,10]]},"590":{"position":[[128,10]]},"632":{"position":[[2410,10],[2537,10]]},"642":{"position":[[32,10],[374,10]]},"699":{"position":[[713,10]]}},"keywords":{}}],["cargo_purs",{"_index":1602,"title":{},"content":{"92":{"position":[[851,11]]},"102":{"position":[[128,11],[183,11],[510,11]]},"284":{"position":[[851,11]]},"294":{"position":[[128,11],[183,11],[510,11]]},"496":{"position":[[851,11]]},"506":{"position":[[128,11],[183,11],[510,11]]}},"keywords":{}}],["case",{"_index":180,"title":{},"content":{"5":{"position":[[201,5]]},"39":{"position":[[1242,5]]},"74":{"position":[[300,5]]},"92":{"position":[[918,4]]},"145":{"position":[[181,5]]},"164":{"position":[[63,5],[1103,5]]},"185":{"position":[[3734,4]]},"198":{"position":[[1153,4],[3802,5]]},"238":{"position":[[300,5]]},"284":{"position":[[918,4]]},"333":{"position":[[181,5]]},"353":{"position":[[63,5],[1138,5]]},"376":{"position":[[3718,4]]},"395":{"position":[[2164,4],[4298,5],[6878,4]]},"434":{"position":[[1143,4],[3784,5]]},"474":{"position":[[300,5]]},"477":{"position":[[706,6]]},"496":{"position":[[918,4]]},"550":{"position":[[181,5]]},"569":{"position":[[63,5],[1138,5]]},"592":{"position":[[3718,4]]},"601":{"position":[[2181,6]]},"612":{"position":[[1597,4]]},"632":{"position":[[2164,4],[4298,5],[6878,4]]},"681":{"position":[[1153,4],[3802,5]]},"699":{"position":[[706,6]]},"709":{"position":[[2181,6]]},"720":{"position":[[1597,4]]}},"keywords":{}}],["casper",{"_index":8,"title":{"4":{"position":[[18,6]]},"21":{"position":[[9,7]]},"83":{"position":[[0,6]]},"89":{"position":[[0,6]]},"97":{"position":[[24,6]]},"252":{"position":[[0,6]]},"281":{"position":[[0,6]]},"289":{"position":[[24,6]]},"320":{"position":[[0,6]]},"392":{"position":[[21,6]]},"393":{"position":[[0,6]]},"397":{"position":[[26,6]]},"483":{"position":[[0,6]]},"493":{"position":[[0,6]]},"501":{"position":[[24,6]]},"538":{"position":[[0,6]]},"629":{"position":[[21,6]]},"630":{"position":[[0,6]]},"634":{"position":[[26,6]]}},"content":{"1":{"position":[[58,6],[188,6],[1030,6]]},"3":{"position":[[177,6]]},"6":{"position":[[250,6]]},"11":{"position":[[124,7]]},"12":{"position":[[47,6]]},"13":{"position":[[32,7]]},"20":{"position":[[804,7]]},"21":{"position":[[58,7],[83,6],[367,7]]},"42":{"position":[[2617,6]]},"43":{"position":[[689,6],[880,6],[913,6],[983,6]]},"51":{"position":[[1885,7]]},"54":{"position":[[32,6]]},"66":{"position":[[361,6]]},"67":{"position":[[88,6]]},"68":{"position":[[84,6]]},"83":{"position":[[4,6]]},"90":{"position":[[27,6]]},"91":{"position":[[41,6],[240,6],[463,6],[814,6]]},"92":{"position":[[253,6]]},"93":{"position":[[3,7]]},"94":{"position":[[0,6]]},"95":{"position":[[129,6]]},"96":{"position":[[12,6],[38,7],[130,6],[212,6]]},"97":{"position":[[134,6],[159,6]]},"99":{"position":[[49,6],[209,6],[281,6]]},"100":{"position":[[179,6],[303,6],[375,6]]},"101":{"position":[[111,6],[157,6],[229,6]]},"103":{"position":[[630,6],[705,6]]},"119":{"position":[[353,6],[1161,6]]},"128":{"position":[[39,6]]},"175":{"position":[[449,6]]},"179":{"position":[[82,7]]},"210":{"position":[[331,6],[351,6],[431,6],[1125,6],[1205,6]]},"241":{"position":[[361,6]]},"242":{"position":[[89,6]]},"243":{"position":[[84,6]]},"252":{"position":[[4,6]]},"277":{"position":[[1231,6]]},"279":{"position":[[39,6]]},"282":{"position":[[27,6]]},"283":{"position":[[41,6],[240,6],[463,6],[814,6]]},"284":{"position":[[253,6]]},"285":{"position":[[3,7]]},"286":{"position":[[0,6]]},"287":{"position":[[129,6]]},"288":{"position":[[12,6],[38,7],[130,6],[212,6]]},"289":{"position":[[134,6],[159,6]]},"291":{"position":[[49,6],[209,6],[281,6]]},"292":{"position":[[179,6],[303,6],[375,6]]},"293":{"position":[[111,6],[157,6],[229,6]]},"295":{"position":[[630,6],[705,6]]},"300":{"position":[[353,6],[1161,6]]},"361":{"position":[[449,6]]},"365":{"position":[[8,6],[184,6]]},"370":{"position":[[82,7]]},"382":{"position":[[71,6]]},"389":{"position":[[331,6],[351,6],[431,6],[1062,6],[1142,6]]},"393":{"position":[[17,6],[525,6]]},"394":{"position":[[220,6],[261,6],[442,6]]},"395":{"position":[[279,6],[560,6],[2828,6],[3155,6],[4157,6],[6742,6]]},"397":{"position":[[0,6],[275,6]]},"398":{"position":[[43,6],[108,6],[240,6],[291,6]]},"417":{"position":[[1699,6],[1812,6]]},"418":{"position":[[55,6],[96,6]]},"466":{"position":[[361,6]]},"467":{"position":[[89,6]]},"468":{"position":[[84,6]]},"477":{"position":[[76,6],[931,6],[1068,6]]},"483":{"position":[[4,6]]},"494":{"position":[[27,6]]},"495":{"position":[[41,6],[240,6],[463,6],[814,6]]},"496":{"position":[[253,6]]},"497":{"position":[[3,7]]},"498":{"position":[[0,6]]},"499":{"position":[[129,6]]},"500":{"position":[[12,6],[38,7],[130,6],[212,6]]},"501":{"position":[[134,6],[159,6]]},"503":{"position":[[49,6],[209,6],[281,6]]},"504":{"position":[[179,6],[303,6],[375,6]]},"505":{"position":[[111,6],[157,6],[229,6]]},"507":{"position":[[630,6],[705,6]]},"516":{"position":[[39,6]]},"521":{"position":[[353,6],[1161,6]]},"577":{"position":[[449,6]]},"581":{"position":[[8,6],[184,6]]},"586":{"position":[[82,7]]},"594":{"position":[[247,6]]},"606":{"position":[[1037,6]]},"610":{"position":[[857,6]]},"611":{"position":[[907,7]]},"618":{"position":[[267,6]]},"624":{"position":[[71,6]]},"630":{"position":[[17,6],[525,6]]},"631":{"position":[[220,6],[261,6],[442,6]]},"632":{"position":[[279,6],[560,6],[2828,6],[3155,6],[4157,6],[6742,6]]},"634":{"position":[[0,6],[275,6]]},"635":{"position":[[43,6],[108,6],[240,6],[291,6]]},"654":{"position":[[1699,6],[1812,6]]},"655":{"position":[[55,6],[96,6]]},"659":{"position":[[331,6],[351,6],[431,6],[1062,6],[1142,6]]},"699":{"position":[[76,6],[931,6],[1068,6]]},"702":{"position":[[247,6]]},"714":{"position":[[1037,6]]},"718":{"position":[[857,6]]},"719":{"position":[[907,7]]},"726":{"position":[[267,6]]}},"keywords":{}}],["casper!".to_str",{"_index":3794,"title":{},"content":{"610":{"position":[[418,26]]},"718":{"position":[[418,26]]}},"keywords":{}}],["casper'",{"_index":216,"title":{},"content":{"6":{"position":[[321,8]]},"10":{"position":[[103,8]]},"12":{"position":[[242,8]]},"93":{"position":[[212,8]]},"99":{"position":[[724,8]]},"285":{"position":[[212,8]]},"291":{"position":[[724,8]]},"396":{"position":[[41,8]]},"497":{"position":[[212,8]]},"503":{"position":[[724,8]]},"633":{"position":[[41,8]]}},"keywords":{}}],["casper'sbyt",{"_index":1560,"title":{},"content":{"86":{"position":[[145,13]]},"255":{"position":[[145,13]]},"486":{"position":[[145,13]]}},"keywords":{}}],["casper.ad",{"_index":386,"title":{},"content":{"12":{"position":[[195,13]]}},"keywords":{}}],["casper_client::get_dictionary_item",{"_index":2630,"title":{},"content":{"212":{"position":[[923,35]]},"391":{"position":[[923,35]]},"661":{"position":[[923,35]]}},"keywords":{}}],["casper_client::get_state_root_hash",{"_index":2626,"title":{},"content":{"212":{"position":[[709,35]]},"391":{"position":[[709,35]]},"661":{"position":[[709,35]]}},"keywords":{}}],["casper_client::{rpcs::dictionaryitemidentifi",{"_index":2611,"title":{},"content":{"212":{"position":[[27,47]]},"391":{"position":[[27,47]]},"661":{"position":[[27,47]]}},"keywords":{}}],["casper_contract_schema_vers",{"_index":3041,"title":{},"content":{"324":{"position":[[0,30]]},"542":{"position":[[0,30]]}},"keywords":{}}],["casper_typ",{"_index":2614,"title":{},"content":{"212":{"position":[[111,15]]},"391":{"position":[[111,15]]},"661":{"position":[[111,15]]}},"keywords":{}}],["casper_types::u256",{"_index":1713,"title":{},"content":{"115":{"position":[[129,19],[1941,19]]},"203":{"position":[[51,19]]},"247":{"position":[[39,20]]},"258":{"position":[[129,19],[1887,19]]},"269":{"position":[[3954,19]]},"383":{"position":[[1073,20]]},"409":{"position":[[3954,19]]},"423":{"position":[[51,19]]},"446":{"position":[[39,20]]},"481":{"position":[[129,19],[1887,19]]},"625":{"position":[[1073,20]]},"646":{"position":[[3954,19]]},"665":{"position":[[51,19]]},"673":{"position":[[39,20]]}},"keywords":{}}],["casper_types::u512",{"_index":1481,"title":{},"content":{"80":{"position":[[124,19]]},"231":{"position":[[124,19]]},"440":{"position":[[137,19],[4815,19]]},"441":{"position":[[4561,19]]},"462":{"position":[[124,19]]},"687":{"position":[[137,19],[4815,19]]},"688":{"position":[[4561,19]]}},"keywords":{}}],["casper_types::{bytesrepr::byt",{"_index":3621,"title":{},"content":{"598":{"position":[[49,32]]},"706":{"position":[[49,32]]}},"keywords":{}}],["casper_types::{bytesrepr::tobyt",{"_index":3859,"title":{},"content":{"616":{"position":[[25,34]]},"724":{"position":[[25,34]]}},"keywords":{}}],["casper_types::{u256",{"_index":3798,"title":{},"content":{"611":{"position":[[36,20]]},"719":{"position":[[36,20]]}},"keywords":{}}],["casperecosystem.io",{"_index":3200,"title":{},"content":{"398":{"position":[[347,19]]},"635":{"position":[[347,19]]}},"keywords":{}}],["casperlab",{"_index":571,"title":{},"content":{"20":{"position":[[88,11]]}},"keywords":{}}],["casperpackagehash.entry_point",{"_index":1686,"title":{},"content":{"103":{"position":[[191,29]]},"295":{"position":[[191,29]]},"507":{"position":[[191,29]]}},"keywords":{}}],["casperstorag",{"_index":1515,"title":{},"content":{"83":{"position":[[548,13]]},"252":{"position":[[548,13]]},"483":{"position":[[548,13]]}},"keywords":{}}],["caspervm",{"_index":1097,"title":{},"content":{"42":{"position":[[2661,8]]},"119":{"position":[[448,8]]},"175":{"position":[[420,9]]},"179":{"position":[[115,8]]},"300":{"position":[[448,8]]},"361":{"position":[[420,9]]},"370":{"position":[[115,8]]},"417":{"position":[[106,9]]},"521":{"position":[[448,8]]},"577":{"position":[[420,9]]},"586":{"position":[[115,8]]},"654":{"position":[[106,9]]}},"keywords":{}}],["caspervmand",{"_index":1777,"title":{},"content":{"119":{"position":[[172,11]]},"300":{"position":[[172,11]]},"521":{"position":[[172,11]]}},"keywords":{}}],["cast",{"_index":1622,"title":{},"content":{"94":{"position":[[328,5],[457,5]]},"286":{"position":[[328,5],[457,5]]},"416":{"position":[[586,4],[777,4],[2600,4]]},"417":{"position":[[564,5]]},"419":{"position":[[189,4],[957,4],[6979,5]]},"498":{"position":[[328,5],[457,5]]},"653":{"position":[[586,4],[777,4],[2600,4]]},"654":{"position":[[564,5]]},"656":{"position":[[189,4],[957,4],[6979,5]]}},"keywords":{}}],["catch",{"_index":3906,"title":{"617":{"position":[[4,6]]},"725":{"position":[[4,6]]}},"content":{"617":{"position":[[917,5]]},"725":{"position":[[917,5]]}},"keywords":{}}],["categori",{"_index":2164,"title":{},"content":{"180":{"position":[[12,8]]},"371":{"position":[[12,8]]},"587":{"position":[[12,8]]}},"keywords":{}}],["caveat",{"_index":2055,"title":{},"content":{"162":{"position":[[575,9]]},"351":{"position":[[612,9]]},"567":{"position":[[612,9]]}},"keywords":{}}],["cc",{"_index":2962,"title":{"321":{"position":[[9,4]]},"539":{"position":[[9,4]]}},"content":{"321":{"position":[[46,3]]},"539":{"position":[[46,3]]}},"keywords":{}}],["cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e"",{"_index":3585,"title":{},"content":{"477":{"position":[[2932,70],[3042,70],[3436,70]]},"699":{"position":[[2932,70],[3042,70],[3436,70]]}},"keywords":{}}],["cd",{"_index":1031,"title":{},"content":{"42":{"position":[[235,2]]},"175":{"position":[[85,2]]},"361":{"position":[[85,2]]},"577":{"position":[[85,2]]}},"keywords":{}}],["center",{"_index":3486,"title":{},"content":{"441":{"position":[[1213,6],[1379,8],[2665,6]]},"688":{"position":[[1213,6],[1379,8],[2665,6]]}},"keywords":{}}],["cep",{"_index":1158,"title":{"412":{"position":[[0,3]]},"649":{"position":[[0,3]]}},"content":{"43":{"position":[[1839,3],[2026,3]]},"365":{"position":[[0,3],[37,4],[163,3],[176,3],[213,4],[344,3]]},"396":{"position":[[580,3]]},"416":{"position":[[444,3]]},"419":{"position":[[815,3]]},"438":{"position":[[83,3]]},"439":{"position":[[119,3]]},"442":{"position":[[65,3]]},"581":{"position":[[0,3],[37,4],[163,3],[176,3],[213,4],[344,3]]},"633":{"position":[[580,3]]},"653":{"position":[[444,3]]},"656":{"position":[[815,3]]},"685":{"position":[[83,3]]},"686":{"position":[[119,3]]},"689":{"position":[[65,3]]}},"keywords":{}}],["cep18",{"_index":3204,"title":{},"content":{"414":{"position":[[72,5],[145,5],[298,5],[478,5]]},"416":{"position":[[4607,5]]},"419":{"position":[[1644,5]]},"651":{"position":[[72,5],[145,5],[298,5],[478,5]]},"653":{"position":[[4607,5]]},"656":{"position":[[1644,5]]}},"keywords":{}}],["cep78",{"_index":3343,"title":{},"content":{"439":{"position":[[183,5]]},"440":{"position":[[3844,5]]},"686":{"position":[[183,5]]},"687":{"position":[[3844,5]]}},"keywords":{}}],["cep78error::invalidtokenown",{"_index":3456,"title":{},"content":{"440":{"position":[[6056,29]]},"687":{"position":[[6056,29]]}},"keywords":{}}],["certain",{"_index":2252,"title":{},"content":{"185":{"position":[[2688,7]]},"376":{"position":[[2672,7]]},"592":{"position":[[2672,7]]},"606":{"position":[[650,7]]},"714":{"position":[[650,7]]}},"keywords":{}}],["cfg(test",{"_index":1073,"title":{},"content":{"42":{"position":[[1552,12]]},"51":{"position":[[1321,12]]},"73":{"position":[[438,12]]},"138":{"position":[[164,12]]},"143":{"position":[[101,12],[951,12]]},"148":{"position":[[11,12]]},"151":{"position":[[96,12]]},"160":{"position":[[149,12]]},"168":{"position":[[331,12]]},"178":{"position":[[1017,12]]},"198":{"position":[[11,12]]},"206":{"position":[[9,12]]},"223":{"position":[[799,12]]},"237":{"position":[[438,12]]},"269":{"position":[[3828,12]]},"318":{"position":[[164,12]]},"328":{"position":[[101,12],[926,12]]},"336":{"position":[[11,12]]},"342":{"position":[[96,12]]},"345":{"position":[[149,12]]},"348":{"position":[[331,12]]},"369":{"position":[[1017,12]]},"384":{"position":[[3792,12]]},"409":{"position":[[3828,12]]},"419":{"position":[[6479,12]]},"426":{"position":[[9,12]]},"434":{"position":[[11,12]]},"456":{"position":[[799,12]]},"473":{"position":[[438,12]]},"537":{"position":[[101,12],[926,12]]},"544":{"position":[[164,12]]},"553":{"position":[[11,12]]},"556":{"position":[[96,12]]},"562":{"position":[[149,12]]},"564":{"position":[[331,12]]},"585":{"position":[[1017,12]]},"626":{"position":[[3792,12]]},"646":{"position":[[3828,12]]},"656":{"position":[[6479,12]]},"668":{"position":[[9,12]]},"681":{"position":[[11,12]]},"696":{"position":[[799,12]]}},"keywords":{}}],["chain",{"_index":187,"title":{},"content":{"5":{"position":[[290,5],[320,5]]},"20":{"position":[[977,5]]},"43":{"position":[[972,5]]},"52":{"position":[[667,5]]},"53":{"position":[[228,5]]},"99":{"position":[[270,5],[745,5]]},"100":{"position":[[364,5]]},"101":{"position":[[218,5]]},"126":{"position":[[129,5],[784,5]]},"129":{"position":[[172,7]]},"210":{"position":[[28,6],[420,5],[1194,5]]},"277":{"position":[[129,5],[784,5]]},"280":{"position":[[172,7]]},"291":{"position":[[270,5],[745,5]]},"292":{"position":[[364,5]]},"293":{"position":[[218,5]]},"389":{"position":[[28,6],[420,5],[1131,5]]},"395":{"position":[[3972,5]]},"477":{"position":[[4133,5]]},"478":{"position":[[375,5]]},"503":{"position":[[270,5],[745,5]]},"504":{"position":[[364,5]]},"505":{"position":[[218,5]]},"514":{"position":[[129,5],[784,5]]},"517":{"position":[[172,7]]},"610":{"position":[[820,5]]},"632":{"position":[[3972,5]]},"659":{"position":[[28,6],[420,5],[1131,5]]},"699":{"position":[[4133,5]]},"700":{"position":[[375,5]]},"718":{"position":[[820,5]]}},"keywords":{}}],["chain_id",{"_index":757,"title":{},"content":{"31":{"position":[[1255,9]]},"52":{"position":[[647,8],[726,8],[888,8]]}},"keywords":{}}],["chanc",{"_index":609,"title":{},"content":{"20":{"position":[[904,6]]}},"keywords":{}}],["chang",{"_index":438,"title":{},"content":{"16":{"position":[[217,8]]},"17":{"position":[[142,8],[1689,7]]},"22":{"position":[[1004,6]]},"51":{"position":[[1921,7]]},"126":{"position":[[2210,6],[3148,6]]},"128":{"position":[[88,6],[246,6]]},"168":{"position":[[1311,6],[1384,7]]},"184":{"position":[[876,7]]},"198":{"position":[[3243,6],[3466,6]]},"262":{"position":[[19,8],[90,7]]},"265":{"position":[[17,7]]},"266":{"position":[[11,7]]},"267":{"position":[[106,7],[204,7],[2020,8],[3614,8]]},"268":{"position":[[90,8],[103,7],[197,7],[292,8]]},"277":{"position":[[2378,6],[3316,6]]},"279":{"position":[[88,6],[246,6]]},"348":{"position":[[1311,6],[1384,7]]},"375":{"position":[[795,7]]},"380":{"position":[[19,8],[90,7]]},"383":{"position":[[9,7],[172,8]]},"384":{"position":[[3828,7]]},"402":{"position":[[19,8],[90,7]]},"405":{"position":[[17,7]]},"406":{"position":[[11,7]]},"407":{"position":[[106,7],[204,7],[2020,8],[3614,8]]},"408":{"position":[[90,8],[103,7],[197,7],[292,8]]},"414":{"position":[[555,6],[734,6]]},"419":{"position":[[1843,6],[1892,6]]},"434":{"position":[[3225,6],[3448,6]]},"514":{"position":[[2210,6],[3148,6]]},"516":{"position":[[88,6],[246,6]]},"564":{"position":[[1311,6],[1384,7]]},"591":{"position":[[795,7]]},"622":{"position":[[19,8],[90,7]]},"625":{"position":[[9,7],[172,8]]},"626":{"position":[[3828,7]]},"639":{"position":[[19,8],[90,7]]},"642":{"position":[[17,7]]},"643":{"position":[[11,7]]},"644":{"position":[[106,7],[204,7],[2020,8],[3614,8]]},"645":{"position":[[90,8],[103,7],[197,7],[292,8]]},"651":{"position":[[555,6],[734,6]]},"656":{"position":[[1843,6],[1892,6]]},"681":{"position":[[3243,6],[3466,6]]}},"keywords":{}}],["change_nam",{"_index":1919,"title":{},"content":{"138":{"position":[[952,12]]},"318":{"position":[[944,12]]},"544":{"position":[[944,12]]}},"keywords":{}}],["change_ownership",{"_index":2370,"title":{},"content":{"197":{"position":[[1136,18]]},"198":{"position":[[1543,19]]},"433":{"position":[[1135,18]]},"434":{"position":[[1533,19]]},"680":{"position":[[1135,18]]},"681":{"position":[[1543,19]]}},"keywords":{}}],["change_ownership(&mut",{"_index":1727,"title":{},"content":{"115":{"position":[[1153,25]]},"197":{"position":[[211,25]]},"247":{"position":[[1260,25]]},"258":{"position":[[1099,25]]},"433":{"position":[[211,25]]},"446":{"position":[[1260,25]]},"481":{"position":[[1099,25]]},"673":{"position":[[1260,25]]},"680":{"position":[[211,25]]}},"keywords":{}}],["change_secur",{"_index":3304,"title":{},"content":{"419":{"position":[[2184,16]]},"656":{"position":[[2184,16]]}},"keywords":{}}],["changelog",{"_index":2791,"title":{"262":{"position":[[16,10]]},"380":{"position":[[16,10]]},"402":{"position":[[16,10]]},"622":{"position":[[16,10]]},"639":{"position":[[16,10]]}},"content":{"262":{"position":[[62,9]]},"380":{"position":[[62,9]]},"402":{"position":[[62,9]]},"622":{"position":[[62,9]]},"639":{"position":[[62,9]]}},"keywords":{}}],["changelogodra",{"_index":2952,"title":{},"content":{"271":{"position":[[0,13]]},"386":{"position":[[0,13]]},"411":{"position":[[0,13]]},"628":{"position":[[0,13]]},"648":{"position":[[0,13]]}},"keywords":{}}],["char",{"_index":800,"title":{},"content":{"31":{"position":[[3033,6]]}},"keywords":{}}],["charact",{"_index":1512,"title":{},"content":{"83":{"position":[[401,11]]},"85":{"position":[[1009,9]]},"252":{"position":[[401,11]]},"254":{"position":[[1009,9]]},"483":{"position":[[401,11]]},"485":{"position":[[1009,9]]}},"keywords":{}}],["chatgpt",{"_index":415,"title":{},"content":{"15":{"position":[[341,8]]},"17":{"position":[[1632,7]]}},"keywords":{}}],["check",{"_index":319,"title":{"221":{"position":[[0,6]]},"454":{"position":[[0,6]]},"694":{"position":[[0,6]]}},"content":{"10":{"position":[[127,6]]},"18":{"position":[[81,7]]},"24":{"position":[[0,5]]},"43":{"position":[[613,5]]},"54":{"position":[[421,5]]},"71":{"position":[[264,5]]},"72":{"position":[[308,6]]},"94":{"position":[[108,5],[637,6]]},"124":{"position":[[82,5]]},"138":{"position":[[61,5]]},"157":{"position":[[539,5],[679,5],[823,5]]},"174":{"position":[[273,5]]},"185":{"position":[[2811,5],[3713,5]]},"206":{"position":[[3790,5]]},"212":{"position":[[2318,5]]},"218":{"position":[[70,5]]},"221":{"position":[[25,6],[568,6]]},"235":{"position":[[264,5]]},"236":{"position":[[308,6]]},"268":{"position":[[2930,5]]},"286":{"position":[[108,5],[637,6]]},"309":{"position":[[82,5]]},"318":{"position":[[61,5]]},"330":{"position":[[525,5],[660,5],[799,5]]},"360":{"position":[[273,5]]},"376":{"position":[[2795,5],[3697,5]]},"391":{"position":[[2318,5]]},"395":{"position":[[1553,5]]},"396":{"position":[[1166,5]]},"398":{"position":[[185,5]]},"408":{"position":[[2930,5]]},"416":{"position":[[4788,7]]},"426":{"position":[[3765,5]]},"440":{"position":[[2821,5],[4369,6]]},"441":{"position":[[4147,5],[4318,5]]},"451":{"position":[[70,5]]},"454":{"position":[[25,6],[568,6]]},"471":{"position":[[264,5]]},"472":{"position":[[308,6]]},"476":{"position":[[857,5]]},"498":{"position":[[108,5],[637,6]]},"526":{"position":[[82,5]]},"544":{"position":[[61,5]]},"547":{"position":[[539,5],[679,5],[823,5]]},"576":{"position":[[273,5]]},"592":{"position":[[2795,5],[3697,5]]},"616":{"position":[[930,6]]},"632":{"position":[[1553,5]]},"633":{"position":[[1166,5]]},"635":{"position":[[185,5]]},"645":{"position":[[2930,5]]},"653":{"position":[[4788,7]]},"661":{"position":[[2318,5]]},"668":{"position":[[3790,5]]},"687":{"position":[[2821,5],[4369,6]]},"688":{"position":[[4147,5],[4318,5]]},"691":{"position":[[70,5]]},"694":{"position":[[25,6],[568,6]]},"698":{"position":[[857,5]]},"724":{"position":[[930,6]]}},"keywords":{}}],["check_rol",{"_index":2263,"title":{},"content":{"185":{"position":[[3056,12],[3931,12]]},"376":{"position":[[3040,12],[3915,12]]},"592":{"position":[[3040,12],[3915,12]]}},"keywords":{}}],["check_role(&self",{"_index":2234,"title":{},"content":{"185":{"position":[[1477,21]]},"376":{"position":[[1461,21]]},"592":{"position":[[1461,21]]}},"keywords":{}}],["cherri",{"_index":1737,"title":{},"content":{"115":{"position":[[1767,6]]},"258":{"position":[[1713,6]]},"481":{"position":[[1713,6]]}},"keywords":{}}],["child",{"_index":1708,"title":{},"content":{"114":{"position":[[164,5],[304,5]]},"257":{"position":[[164,5],[304,5]]},"480":{"position":[[164,5],[304,5]]}},"keywords":{}}],["children",{"_index":2296,"title":{},"content":{"189":{"position":[[98,8]]},"366":{"position":[[98,8]]},"582":{"position":[[98,8]]}},"keywords":{}}],["choic",{"_index":1017,"title":{},"content":{"40":{"position":[[187,6]]},"52":{"position":[[248,7]]},"119":{"position":[[681,6]]},"300":{"position":[[681,6]]},"416":{"position":[[845,7],[2687,7],[3050,7]]},"419":{"position":[[257,7],[4642,7],[5004,7]]},"521":{"position":[[681,6]]},"653":{"position":[[845,7],[2687,7],[3050,7]]},"656":{"position":[[257,7],[4642,7],[5004,7]]}},"keywords":{}}],["choos",{"_index":1225,"title":{},"content":{"52":{"position":[[101,6]]},"198":{"position":[[2089,6]]},"264":{"position":[[388,6]]},"382":{"position":[[201,6]]},"404":{"position":[[388,6]]},"414":{"position":[[39,8]]},"434":{"position":[[2079,6]]},"478":{"position":[[278,6]]},"624":{"position":[[201,6]]},"641":{"position":[[388,6]]},"651":{"position":[[39,8]]},"681":{"position":[[2089,6]]},"700":{"position":[[278,6]]}},"keywords":{}}],["chose",{"_index":2011,"title":{},"content":{"148":{"position":[[927,5]]},"336":{"position":[[927,5]]},"553":{"position":[[927,5]]}},"keywords":{}}],["citi",{"_index":601,"title":{},"content":{"20":{"position":[[768,6]]}},"keywords":{}}],["citizen",{"_index":1572,"title":{},"content":{"91":{"position":[[30,7]]},"283":{"position":[[30,7]]},"495":{"position":[[30,7]]}},"keywords":{}}],["cl_value.inner_bytes()[4..].to_vec",{"_index":2638,"title":{},"content":{"212":{"position":[[1380,36]]},"391":{"position":[[1380,36]]},"661":{"position":[[1380,36]]}},"keywords":{}}],["clarif",{"_index":3926,"title":{},"content":{"618":{"position":[[677,13]]},"726":{"position":[[677,13]]}},"keywords":{}}],["class",{"_index":951,"title":{},"content":{"39":{"position":[[1426,5],[1465,7]]},"91":{"position":[[24,5]]},"283":{"position":[[24,5]]},"495":{"position":[[24,5]]}},"keywords":{}}],["clean",{"_index":642,"title":{},"content":{"22":{"position":[[95,6]]},"38":{"position":[[113,6]]},"114":{"position":[[236,5]]},"143":{"position":[[643,5]]},"257":{"position":[[236,5]]},"328":{"position":[[618,5]]},"480":{"position":[[236,5]]},"537":{"position":[[618,5]]}},"keywords":{}}],["cleaner",{"_index":1753,"title":{},"content":{"115":{"position":[[3286,8]]},"258":{"position":[[3212,8]]},"481":{"position":[[3212,8]]}},"keywords":{}}],["clever",{"_index":3203,"title":{},"content":{"414":{"position":[[50,6]]},"651":{"position":[[50,6]]}},"keywords":{}}],["cli",{"_index":668,"title":{},"content":{"22":{"position":[[1400,3]]}},"keywords":{}}],["click",{"_index":3107,"title":{},"content":{"393":{"position":[[256,8]]},"394":{"position":[[287,5]]},"396":{"position":[[955,5]]},"630":{"position":[[256,8]]},"631":{"position":[[287,5]]},"633":{"position":[[955,5]]}},"keywords":{}}],["client",{"_index":1132,"title":{"477":{"position":[[0,7]]},"699":{"position":[[0,7]]}},"content":{"43":{"position":[[920,6]]},"52":{"position":[[261,6]]},"97":{"position":[[166,6]]},"98":{"position":[[701,6]]},"99":{"position":[[56,7],[216,6]]},"100":{"position":[[310,6]]},"101":{"position":[[164,6]]},"103":{"position":[[712,6]]},"210":{"position":[[338,6],[358,6],[1132,6]]},"289":{"position":[[166,6]]},"290":{"position":[[701,6]]},"291":{"position":[[56,7],[216,6]]},"292":{"position":[[310,6]]},"293":{"position":[[164,6]]},"295":{"position":[[712,6]]},"389":{"position":[[338,6],[358,6],[1069,6]]},"501":{"position":[[166,6]]},"502":{"position":[[701,6]]},"503":{"position":[[56,7],[216,6]]},"504":{"position":[[310,6]]},"505":{"position":[[164,6]]},"507":{"position":[[712,6]]},"659":{"position":[[338,6],[358,6],[1069,6]]}},"keywords":{}}],["clone",{"_index":1656,"title":{},"content":{"100":{"position":[[56,5]]},"292":{"position":[[56,5]]},"504":{"position":[[56,5]]}},"keywords":{}}],["close",{"_index":3265,"title":{},"content":{"416":{"position":[[4517,5]]},"419":{"position":[[6097,5]]},"653":{"position":[[4517,5]]},"656":{"position":[[6097,5]]}},"keywords":{}}],["closer",{"_index":1301,"title":{},"content":{"53":{"position":[[67,6]]},"90":{"position":[[126,6]]},"155":{"position":[[34,6]]},"282":{"position":[[126,6]]},"340":{"position":[[34,6]]},"494":{"position":[[126,6]]},"560":{"position":[[34,6]]}},"keywords":{}}],["cltype",{"_index":1558,"title":{},"content":{"86":{"position":[[82,6]]},"212":{"position":[[1372,7]]},"229":{"position":[[250,7]]},"255":{"position":[[82,6]]},"267":{"position":[[2204,7],[2930,7]]},"391":{"position":[[1372,7]]},"407":{"position":[[2204,7],[2930,7]]},"460":{"position":[[250,7]]},"486":{"position":[[82,6]]},"644":{"position":[[2204,7],[2930,7]]},"661":{"position":[[1372,7]]}},"keywords":{}}],["cltype::ani",{"_index":3079,"title":{},"content":{"354":{"position":[[513,12]]},"570":{"position":[[513,12]]}},"keywords":{}}],["cltype::u8",{"_index":3080,"title":{},"content":{"354":{"position":[[565,11]]},"570":{"position":[[565,11]]}},"keywords":{}}],["cltyped>(&self",{"_index":2854,"title":{},"content":{"267":{"position":[[2288,22]]},"407":{"position":[[2288,22]]},"644":{"position":[[2288,22]]}},"keywords":{}}],["clvalu",{"_index":2636,"title":{},"content":{"212":{"position":[[1258,7]]},"391":{"position":[[1258,7]]},"661":{"position":[[1258,7]]}},"keywords":{}}],["code",{"_index":45,"title":{"51":{"position":[[13,5]]},"115":{"position":[[0,4]]},"118":{"position":[[11,5]]},"120":{"position":[[9,5]]},"182":{"position":[[0,5]]},"194":{"position":[[0,5]]},"202":{"position":[[0,5]]},"218":{"position":[[0,5]]},"245":{"position":[[0,5]]},"258":{"position":[[0,4]]},"269":{"position":[[3,4]]},"299":{"position":[[11,5]]},"301":{"position":[[9,5]]},"373":{"position":[[0,5]]},"383":{"position":[[26,5]]},"384":{"position":[[3,4]]},"409":{"position":[[3,4]]},"419":{"position":[[9,5]]},"422":{"position":[[0,5]]},"430":{"position":[[0,5]]},"444":{"position":[[0,5]]},"451":{"position":[[0,5]]},"481":{"position":[[0,4]]},"520":{"position":[[11,5]]},"522":{"position":[[9,5]]},"589":{"position":[[0,5]]},"625":{"position":[[26,5]]},"626":{"position":[[3,4]]},"646":{"position":[[3,4]]},"656":{"position":[[9,5]]},"664":{"position":[[0,5]]},"671":{"position":[[0,5]]},"677":{"position":[[0,5]]},"691":{"position":[[0,5]]}},"content":{"1":{"position":[[563,4]]},"2":{"position":[[318,7],[510,7]]},"9":{"position":[[302,4],[722,4]]},"15":{"position":[[34,5]]},"16":{"position":[[147,4],[200,4],[407,4]]},"17":{"position":[[172,4],[189,4]]},"18":{"position":[[73,5],[130,5],[337,4]]},"20":{"position":[[412,4],[572,4],[826,4],[983,4],[1075,4]]},"22":{"position":[[782,4]]},"23":{"position":[[265,4]]},"30":{"position":[[43,5],[454,5]]},"31":{"position":[[299,5],[328,4],[1627,5],[1921,5]]},"38":{"position":[[1147,4],[1162,5]]},"39":{"position":[[339,5],[485,5],[1727,4],[1742,5],[3161,4]]},"40":{"position":[[147,4]]},"42":{"position":[[1860,4]]},"43":{"position":[[156,4],[639,4]]},"50":{"position":[[353,5]]},"51":{"position":[[1907,5]]},"52":{"position":[[3094,4],[3221,4]]},"80":{"position":[[10,4]]},"84":{"position":[[39,4]]},"99":{"position":[[751,6]]},"100":{"position":[[1036,4]]},"101":{"position":[[737,4]]},"102":{"position":[[463,4]]},"104":{"position":[[32,5]]},"106":{"position":[[113,4]]},"108":{"position":[[340,5]]},"118":{"position":[[45,5],[168,5]]},"119":{"position":[[746,4]]},"120":{"position":[[23,4]]},"124":{"position":[[97,4]]},"126":{"position":[[1320,5]]},"127":{"position":[[17,5]]},"128":{"position":[[715,5]]},"134":{"position":[[63,4]]},"145":{"position":[[66,4]]},"148":{"position":[[621,4]]},"155":{"position":[[53,4]]},"168":{"position":[[1112,4]]},"176":{"position":[[23,4]]},"182":{"position":[[24,5]]},"194":{"position":[[20,5]]},"204":{"position":[[1359,5]]},"205":{"position":[[2287,4],[2328,5]]},"221":{"position":[[702,4]]},"231":{"position":[[10,4]]},"253":{"position":[[39,4]]},"262":{"position":[[33,5]]},"273":{"position":[[113,4]]},"275":{"position":[[344,5]]},"277":{"position":[[1488,5]]},"278":{"position":[[17,5]]},"279":{"position":[[715,5]]},"291":{"position":[[751,6]]},"292":{"position":[[1036,4]]},"293":{"position":[[737,4]]},"294":{"position":[[463,4]]},"296":{"position":[[32,5]]},"299":{"position":[[45,5],[168,5]]},"300":{"position":[[746,4]]},"301":{"position":[[23,4]]},"309":{"position":[[97,4]]},"314":{"position":[[63,4]]},"333":{"position":[[66,4]]},"336":{"position":[[621,4]]},"340":{"position":[[53,4]]},"348":{"position":[[1112,4]]},"354":{"position":[[467,4]]},"362":{"position":[[23,4]]},"373":{"position":[[24,5]]},"380":{"position":[[33,5]]},"383":{"position":[[39,4]]},"395":{"position":[[168,5],[4380,5]]},"402":{"position":[[33,5]]},"414":{"position":[[178,5]]},"419":{"position":[[21,4]]},"424":{"position":[[1309,5]]},"425":{"position":[[2237,4],[2278,5]]},"430":{"position":[[20,5]]},"440":{"position":[[65,4]]},"454":{"position":[[702,4]]},"462":{"position":[[10,4]]},"476":{"position":[[1269,4],[1411,4],[1516,4],[1909,4]]},"477":{"position":[[604,4],[640,5],[2297,5]]},"478":{"position":[[312,4]]},"484":{"position":[[39,4]]},"490":{"position":[[113,4]]},"492":{"position":[[344,5]]},"503":{"position":[[751,6]]},"504":{"position":[[1036,4]]},"505":{"position":[[737,4]]},"506":{"position":[[463,4]]},"508":{"position":[[32,5]]},"514":{"position":[[1320,5]]},"515":{"position":[[17,5]]},"516":{"position":[[715,5]]},"520":{"position":[[45,5],[168,5]]},"521":{"position":[[746,4]]},"522":{"position":[[23,4]]},"526":{"position":[[97,4]]},"531":{"position":[[63,4]]},"550":{"position":[[66,4]]},"553":{"position":[[621,4]]},"560":{"position":[[53,4]]},"564":{"position":[[1112,4]]},"570":{"position":[[467,4]]},"578":{"position":[[23,4]]},"589":{"position":[[24,5]]},"596":{"position":[[82,4],[484,4],[532,5]]},"606":{"position":[[972,4],[1026,6]]},"612":{"position":[[55,4],[1736,4],[2105,4]]},"613":{"position":[[1354,4]]},"617":{"position":[[477,4],[554,4],[1322,4]]},"618":{"position":[[327,4]]},"622":{"position":[[33,5]]},"625":{"position":[[39,4]]},"632":{"position":[[168,5],[4380,5]]},"639":{"position":[[33,5]]},"651":{"position":[[178,5]]},"656":{"position":[[21,4]]},"666":{"position":[[1309,5]]},"667":{"position":[[2237,4],[2278,5]]},"677":{"position":[[20,5]]},"687":{"position":[[65,4]]},"694":{"position":[[702,4]]},"698":{"position":[[1269,4],[1411,4],[1516,4],[1909,4]]},"699":{"position":[[604,4],[640,5],[2297,5]]},"700":{"position":[[312,4]]},"704":{"position":[[82,4],[484,4],[532,5]]},"714":{"position":[[972,4],[1026,6]]},"720":{"position":[[55,4],[1736,4],[2105,4]]},"721":{"position":[[1354,4]]},"725":{"position":[[477,4],[554,4],[1322,4]]},"726":{"position":[[327,4]]}},"keywords":{}}],["code,text",{"_index":452,"title":{},"content":{"17":{"position":[[102,9]]}},"keywords":{}}],["code_id",{"_index":1257,"title":{},"content":{"52":{"position":[[1108,7],[1172,11],[3157,7]]}},"keywords":{}}],["codebas",{"_index":674,"title":{},"content":{"23":{"position":[[43,8]]}},"keywords":{}}],["codegen",{"_index":1886,"title":{},"content":{"131":{"position":[[444,7]]},"265":{"position":[[854,7]]},"311":{"position":[[496,7]]},"395":{"position":[[3534,7]]},"405":{"position":[[854,7]]},"528":{"position":[[496,7]]},"632":{"position":[[3534,7]]},"642":{"position":[[854,7]]}},"keywords":{}}],["codesuccessfulli",{"_index":1153,"title":{},"content":{"43":{"position":[[1681,16]]}},"keywords":{}}],["codex",{"_index":433,"title":{},"content":{"16":{"position":[[104,6]]}},"keywords":{}}],["codey",{"_index":222,"title":{},"content":{"7":{"position":[[65,7]]}},"keywords":{}}],["collect",{"_index":1419,"title":{},"content":{"76":{"position":[[402,11],[827,10]]},"79":{"position":[[413,10]]},"227":{"position":[[402,11],[827,10]]},"230":{"position":[[430,10]]},"321":{"position":[[739,9],[863,9]]},"441":{"position":[[4240,7]]},"458":{"position":[[402,11],[827,10]]},"461":{"position":[[430,10]]},"539":{"position":[[739,9],[863,9]]},"601":{"position":[[1897,10]]},"688":{"position":[[4240,7]]},"709":{"position":[[1897,10]]}},"keywords":{}}],["collection_nam",{"_index":3373,"title":{},"content":{"440":{"position":[[1177,16],[1320,17],[1355,16],[5026,16]]},"441":{"position":[[4851,16]]},"687":{"position":[[1177,16],[1320,17],[1355,16],[5026,16]]},"688":{"position":[[4851,16]]}},"keywords":{}}],["collection_symbol",{"_index":3374,"title":{},"content":{"440":{"position":[[1202,18],[1372,18],[5075,18]]},"441":{"position":[[4900,18]]},"687":{"position":[[1202,18],[1372,18],[5075,18]]},"688":{"position":[[4900,18]]}},"keywords":{}}],["combin",{"_index":2278,"title":{},"content":{"185":{"position":[[3916,11]]},"188":{"position":[[382,11],[668,11]]},"207":{"position":[[45,7]]},"212":{"position":[[3486,11]]},"248":{"position":[[234,9]]},"324":{"position":[[1630,11]]},"365":{"position":[[739,11],[1025,11]]},"376":{"position":[[3900,11]]},"391":{"position":[[3504,11]]},"427":{"position":[[45,7]]},"442":{"position":[[113,7]]},"447":{"position":[[234,9]]},"542":{"position":[[1630,11]]},"581":{"position":[[739,11],[1025,11]]},"592":{"position":[[3900,11]]},"661":{"position":[[3504,11]]},"669":{"position":[[45,7]]},"674":{"position":[[234,9]]},"689":{"position":[[113,7]]}},"keywords":{}}],["come",{"_index":370,"title":{},"content":{"11":{"position":[[168,4]]},"22":{"position":[[1385,5]]},"31":{"position":[[311,5]]},"38":{"position":[[1187,5]]},"51":{"position":[[1658,5]]},"92":{"position":[[331,5]]},"100":{"position":[[5,5]]},"146":{"position":[[667,6]]},"157":{"position":[[15,5]]},"160":{"position":[[76,5]]},"163":{"position":[[1383,5]]},"168":{"position":[[1494,5]]},"187":{"position":[[13,5]]},"284":{"position":[[331,5]]},"292":{"position":[[5,5]]},"330":{"position":[[15,5]]},"334":{"position":[[671,6]]},"345":{"position":[[76,5]]},"348":{"position":[[1494,5]]},"352":{"position":[[1405,5]]},"364":{"position":[[13,5]]},"416":{"position":[[2489,4]]},"496":{"position":[[331,5]]},"504":{"position":[[5,5]]},"547":{"position":[[15,5]]},"551":{"position":[[671,6]]},"562":{"position":[[76,5]]},"564":{"position":[[1494,5]]},"568":{"position":[[1405,5]]},"580":{"position":[[13,5]]},"594":{"position":[[127,4]]},"653":{"position":[[2489,4]]},"702":{"position":[[127,4]]}},"keywords":{}}],["comma",{"_index":1787,"title":{},"content":{"120":{"position":[[388,5]]},"301":{"position":[[388,5]]},"522":{"position":[[388,5]]}},"keywords":{}}],["command",{"_index":1131,"title":{},"content":{"43":{"position":[[830,7]]},"65":{"position":[[62,8],[328,7]]},"67":{"position":[[118,7]]},"68":{"position":[[209,9]]},"117":{"position":[[4,8],[1286,8]]},"118":{"position":[[76,8]]},"119":{"position":[[14,7],[881,7]]},"120":{"position":[[241,7]]},"121":{"position":[[123,8],[350,8]]},"129":{"position":[[653,7]]},"132":{"position":[[383,8]]},"134":{"position":[[160,7],[240,9]]},"154":{"position":[[38,8]]},"173":{"position":[[186,8]]},"174":{"position":[[226,8],[327,9]]},"179":{"position":[[40,8]]},"240":{"position":[[62,8],[328,7]]},"242":{"position":[[119,7]]},"243":{"position":[[209,9]]},"261":{"position":[[156,8]]},"280":{"position":[[654,7]]},"298":{"position":[[4,8],[1286,8]]},"299":{"position":[[76,8]]},"300":{"position":[[14,7],[881,7]]},"301":{"position":[[241,7]]},"302":{"position":[[123,8],[350,8]]},"312":{"position":[[383,8]]},"314":{"position":[[160,7],[240,9]]},"322":{"position":[[52,8]]},"339":{"position":[[38,8]]},"359":{"position":[[186,8]]},"360":{"position":[[226,8],[327,9]]},"370":{"position":[[40,8]]},"379":{"position":[[156,8]]},"401":{"position":[[156,8]]},"439":{"position":[[78,7]]},"441":{"position":[[471,8]]},"465":{"position":[[62,8],[328,7]]},"467":{"position":[[119,7]]},"468":{"position":[[209,9]]},"477":{"position":[[2325,8]]},"517":{"position":[[654,7]]},"519":{"position":[[4,8],[1286,8]]},"520":{"position":[[76,8]]},"521":{"position":[[14,7],[881,7]]},"522":{"position":[[241,7]]},"523":{"position":[[123,8],[350,8]]},"529":{"position":[[383,8]]},"531":{"position":[[160,7],[240,9]]},"540":{"position":[[52,8]]},"559":{"position":[[38,8]]},"575":{"position":[[186,8]]},"576":{"position":[[226,8],[327,9]]},"586":{"position":[[40,8]]},"621":{"position":[[156,8]]},"638":{"position":[[156,8]]},"686":{"position":[[78,7]]},"688":{"position":[[471,8]]},"699":{"position":[[2325,8]]}},"keywords":{}}],["commit",{"_index":1798,"title":{},"content":{"126":{"position":[[565,6]]},"277":{"position":[[565,6]]},"514":{"position":[[565,6]]}},"keywords":{}}],["common",{"_index":2815,"title":{},"content":{"267":{"position":[[197,6]]},"268":{"position":[[190,6]]},"407":{"position":[[197,6]]},"408":{"position":[[190,6]]},"644":{"position":[[197,6]]},"645":{"position":[[190,6]]}},"keywords":{}}],["commun",{"_index":1,"title":{"0":{"position":[[19,10]]},"1":{"position":[[11,10]]},"123":{"position":[[5,13]]},"308":{"position":[[5,13]]},"525":{"position":[[5,13]]}},"content":{"1":{"position":[[293,9]]},"12":{"position":[[92,9]]},"20":{"position":[[736,11]]},"111":{"position":[[87,13]]},"168":{"position":[[59,11],[239,13]]},"306":{"position":[[87,13]]},"348":{"position":[[59,11],[239,13]]},"394":{"position":[[449,9]]},"413":{"position":[[155,9]]},"417":{"position":[[1526,9]]},"419":{"position":[[7941,9]]},"511":{"position":[[87,13]]},"564":{"position":[[59,11],[239,13]]},"631":{"position":[[449,9]]},"650":{"position":[[155,9]]},"654":{"position":[[1526,9]]},"656":{"position":[[7941,9]]}},"keywords":{}}],["compar",{"_index":1156,"title":{},"content":{"43":{"position":[[1779,7]]},"198":{"position":[[2389,9],[3876,7]]},"202":{"position":[[63,8]]},"205":{"position":[[2275,7]]},"265":{"position":[[362,7]]},"405":{"position":[[362,7]]},"422":{"position":[[63,8]]},"425":{"position":[[2225,7]]},"434":{"position":[[2379,9],[3858,7]]},"642":{"position":[[362,7]]},"664":{"position":[[63,8]]},"667":{"position":[[2225,7]]},"681":{"position":[[2389,9],[3876,7]]}},"keywords":{}}],["comparison",{"_index":622,"title":{},"content":{"21":{"position":[[69,10]]},"43":{"position":[[1962,10]]}},"keywords":{}}],["compat",{"_index":1187,"title":{},"content":{"51":{"position":[[64,11]]},"66":{"position":[[341,10]]},"241":{"position":[[341,10]]},"466":{"position":[[341,10]]}},"keywords":{}}],["compil",{"_index":208,"title":{},"content":{"6":{"position":[[205,8]]},"20":{"position":[[696,8]]},"30":{"position":[[431,8]]},"31":{"position":[[517,8]]},"39":{"position":[[3361,9]]},"66":{"position":[[319,8]]},"100":{"position":[[149,9]]},"101":{"position":[[78,12]]},"154":{"position":[[80,8]]},"173":{"position":[[501,7]]},"210":{"position":[[218,7]]},"241":{"position":[[319,8]]},"270":{"position":[[417,11]]},"292":{"position":[[149,9]]},"293":{"position":[[78,12]]},"324":{"position":[[97,8],[114,7]]},"339":{"position":[[80,8]]},"359":{"position":[[501,7]]},"385":{"position":[[417,11]]},"389":{"position":[[218,7]]},"410":{"position":[[417,11]]},"466":{"position":[[319,8]]},"504":{"position":[[149,9]]},"505":{"position":[[78,12]]},"542":{"position":[[97,8],[114,7]]},"559":{"position":[[80,8]]},"575":{"position":[[501,7]]},"598":{"position":[[1407,7]]},"599":{"position":[[599,7]]},"601":{"position":[[1217,7]]},"627":{"position":[[417,11]]},"647":{"position":[[417,11]]},"659":{"position":[[218,7]]},"706":{"position":[[1407,7]]},"707":{"position":[[599,7]]},"709":{"position":[[1217,7]]}},"keywords":{}}],["complet",{"_index":173,"title":{"419":{"position":[[0,8]]},"656":{"position":[[0,8]]}},"content":{"5":{"position":[[114,9]]},"72":{"position":[[136,10]]},"236":{"position":[[136,10]]},"269":{"position":[[10,8]]},"270":{"position":[[42,10]]},"384":{"position":[[10,8]]},"385":{"position":[[42,10]]},"409":{"position":[[10,8]]},"410":{"position":[[42,10]]},"419":{"position":[[12,8]]},"440":{"position":[[3755,8]]},"472":{"position":[[136,10]]},"602":{"position":[[1026,10],[1360,10]]},"626":{"position":[[10,8]]},"627":{"position":[[42,10]]},"646":{"position":[[10,8]]},"647":{"position":[[42,10]]},"656":{"position":[[12,8]]},"687":{"position":[[3755,8]]},"710":{"position":[[1026,10],[1360,10]]}},"keywords":{}}],["complex",{"_index":1103,"title":{},"content":{"43":{"position":[[7,8]]},"84":{"position":[[527,7]]},"85":{"position":[[331,8]]},"110":{"position":[[216,7]]},"115":{"position":[[1748,7]]},"162":{"position":[[526,7],[1911,7]]},"199":{"position":[[207,7]]},"202":{"position":[[40,7]]},"209":{"position":[[28,7]]},"253":{"position":[[527,7]]},"254":{"position":[[331,8]]},"258":{"position":[[1694,7]]},"305":{"position":[[216,7]]},"351":{"position":[[563,7],[1933,7]]},"388":{"position":[[28,7]]},"413":{"position":[[79,7]]},"422":{"position":[[40,7]]},"435":{"position":[[207,7]]},"481":{"position":[[1694,7]]},"484":{"position":[[527,7]]},"485":{"position":[[331,8]]},"510":{"position":[[216,7]]},"567":{"position":[[563,7],[1933,7]]},"612":{"position":[[1728,7]]},"650":{"position":[[79,7]]},"658":{"position":[[28,7]]},"664":{"position":[[40,7]]},"682":{"position":[[207,7]]},"720":{"position":[[1728,7]]}},"keywords":{}}],["complianc",{"_index":3335,"title":{},"content":{"438":{"position":[[63,10]]},"685":{"position":[[63,10]]}},"keywords":{}}],["compon",{"_index":205,"title":{},"content":{"6":{"position":[[161,9]]},"171":{"position":[[51,10]]},"357":{"position":[[51,10]]},"573":{"position":[[51,10]]}},"keywords":{}}],["compos",{"_index":2430,"title":{},"content":{"199":{"position":[[192,7]]},"435":{"position":[[192,7]]},"612":{"position":[[1992,8]]},"682":{"position":[[192,7]]},"720":{"position":[[1992,8]]}},"keywords":{}}],["composit",{"_index":1500,"title":{"612":{"position":[[0,11]]},"720":{"position":[[0,11]]}},"content":{"81":{"position":[[231,9]]},"232":{"position":[[231,9]]},"246":{"position":[[50,11]]},"445":{"position":[[50,11]]},"463":{"position":[[231,9]]},"612":{"position":[[167,12],[254,11],[393,11],[1920,12]]},"618":{"position":[[181,11]]},"672":{"position":[[50,11]]},"720":{"position":[[167,12],[254,11],[393,11],[1920,12]]},"726":{"position":[[181,11]]}},"keywords":{}}],["compound",{"_index":551,"title":{},"content":{"18":{"position":[[114,8]]},"203":{"position":[[594,8]]},"423":{"position":[[594,8]]},"665":{"position":[[594,8]]}},"keywords":{}}],["comprehens",{"_index":2467,"title":{},"content":{"205":{"position":[[10,13]]},"425":{"position":[[10,13]]},"477":{"position":[[4100,13]]},"667":{"position":[[10,13]]},"699":{"position":[[4100,13]]}},"keywords":{}}],["compris",{"_index":1437,"title":{},"content":{"79":{"position":[[148,9]]},"230":{"position":[[148,9]]},"324":{"position":[[509,9]]},"461":{"position":[[148,9]]},"542":{"position":[[509,9]]}},"keywords":{}}],["compromis",{"_index":1735,"title":{},"content":{"115":{"position":[[1562,12]]},"258":{"position":[[1508,12]]},"481":{"position":[[1508,12]]}},"keywords":{}}],["comput",{"_index":183,"title":{},"content":{"5":{"position":[[228,11],[274,11]]},"8":{"position":[[158,8],[197,12],[513,7]]},"598":{"position":[[2171,12]]},"600":{"position":[[1076,12]]},"706":{"position":[[2171,12]]},"708":{"position":[[1076,12]]}},"keywords":{}}],["concaten",{"_index":1550,"title":{},"content":{"85":{"position":[[775,12]]},"211":{"position":[[676,12]]},"212":{"position":[[3621,11],[3680,12]]},"254":{"position":[[775,12]]},"390":{"position":[[650,12]]},"391":{"position":[[3639,11],[3698,12]]},"485":{"position":[[775,12]]},"660":{"position":[[650,12]]},"661":{"position":[[3639,11],[3698,12]]}},"keywords":{}}],["concatin",{"_index":798,"title":{},"content":{"31":{"position":[[2985,13]]}},"keywords":{}}],["conceiv",{"_index":1520,"title":{},"content":{"84":{"position":[[9,9]]},"253":{"position":[[9,9]]},"484":{"position":[[9,9]]}},"keywords":{}}],["concept",{"_index":552,"title":{"75":{"position":[[17,8]]},"76":{"position":[[16,9]]},"77":{"position":[[17,9]]},"226":{"position":[[17,8]]},"227":{"position":[[16,9]]},"228":{"position":[[17,9]]},"457":{"position":[[17,8]]},"458":{"position":[[16,9]]},"459":{"position":[[17,9]]}},"content":{"18":{"position":[[188,7]]},"22":{"position":[[537,8]]},"33":{"position":[[67,8]]},"38":{"position":[[662,8]]},"76":{"position":[[75,8]]},"80":{"position":[[94,9]]},"81":{"position":[[319,8]]},"110":{"position":[[224,8]]},"180":{"position":[[59,8]]},"197":{"position":[[815,8]]},"205":{"position":[[160,9]]},"227":{"position":[[75,8]]},"231":{"position":[[94,9]]},"232":{"position":[[319,8]]},"305":{"position":[[224,8]]},"371":{"position":[[59,8]]},"425":{"position":[[160,9]]},"433":{"position":[[814,8]]},"458":{"position":[[75,8]]},"462":{"position":[[94,9]]},"463":{"position":[[319,8]]},"510":{"position":[[224,8]]},"587":{"position":[[59,8]]},"600":{"position":[[873,9]]},"603":{"position":[[43,7]]},"667":{"position":[[160,9]]},"680":{"position":[[814,8]]},"708":{"position":[[873,9]]},"711":{"position":[[43,7]]}},"keywords":{}}],["concepts.bas",{"_index":3610,"title":{},"content":{"595":{"position":[[106,14]]},"703":{"position":[[106,14]]}},"keywords":{}}],["concern",{"_index":2179,"title":{},"content":{"184":{"position":[[46,10]]},"375":{"position":[[46,10]]},"591":{"position":[[46,10]]}},"keywords":{}}],["conclus",{"_index":853,"title":{"33":{"position":[[0,11]]},"44":{"position":[[0,11]]},"54":{"position":[[0,11]]},"81":{"position":[[0,11]]},"232":{"position":[[0,11]]},"398":{"position":[[0,11]]},"442":{"position":[[0,11]]},"463":{"position":[[0,11]]},"478":{"position":[[0,11]]},"618":{"position":[[0,11]]},"635":{"position":[[0,11]]},"689":{"position":[[0,11]]},"700":{"position":[[0,11]]},"726":{"position":[[0,11]]}},"content":{},"keywords":{}}],["condit",{"_index":986,"title":{},"content":{"39":{"position":[[2511,10]]}},"keywords":{}}],["conduct",{"_index":909,"title":{},"content":{"39":{"position":[[445,7]]}},"keywords":{}}],["config",{"_index":741,"title":{},"content":{"31":{"position":[[936,6]]}},"keywords":{}}],["config::istanbul",{"_index":742,"title":{},"content":{"31":{"position":[[945,19]]}},"keywords":{}}],["configur",{"_index":740,"title":{},"content":{"31":{"position":[[917,14]]},"168":{"position":[[123,9]]},"324":{"position":[[1650,13]]},"348":{"position":[[123,9]]},"416":{"position":[[2365,13]]},"542":{"position":[[1650,13]]},"564":{"position":[[123,9]]},"653":{"position":[[2365,13]]}},"keywords":{}}],["conflict",{"_index":947,"title":{},"content":{"39":{"position":[[1282,9]]}},"keywords":{}}],["conform",{"_index":2751,"title":{},"content":{"245":{"position":[[38,7]]},"444":{"position":[[38,7]]},"671":{"position":[[38,7]]}},"keywords":{}}],["congratul",{"_index":1219,"title":{},"content":{"51":{"position":[[1743,16]]},"175":{"position":[[457,16]]},"361":{"position":[[457,16]]},"395":{"position":[[6688,16]]},"577":{"position":[[457,16]]},"618":{"position":[[0,16]]},"632":{"position":[[6688,16]]},"726":{"position":[[0,16]]}},"keywords":{}}],["connect",{"_index":1866,"title":{},"content":{"128":{"position":[[674,10]]},"279":{"position":[[674,10]]},"516":{"position":[[674,10]]}},"keywords":{}}],["consecut",{"_index":1818,"title":{},"content":{"126":{"position":[[2179,11]]},"277":{"position":[[2347,11]]},"514":{"position":[[2179,11]]}},"keywords":{}}],["consid",{"_index":1445,"title":{},"content":{"79":{"position":[[477,8]]},"84":{"position":[[148,8]]},"115":{"position":[[0,8]]},"198":{"position":[[2622,10]]},"230":{"position":[[494,8]]},"253":{"position":[[148,8]]},"258":{"position":[[0,8]]},"267":{"position":[[788,8]]},"407":{"position":[[788,8]]},"434":{"position":[[2612,10]]},"461":{"position":[[494,8]]},"481":{"position":[[0,8]]},"484":{"position":[[148,8]]},"605":{"position":[[339,10]]},"644":{"position":[[788,8]]},"681":{"position":[[2622,10]]},"713":{"position":[[339,10]]}},"keywords":{}}],["consider",{"_index":2433,"title":{},"content":{"202":{"position":[[22,12]]},"422":{"position":[[22,12]]},"664":{"position":[[22,12]]}},"keywords":{}}],["consist",{"_index":942,"title":{},"content":{"39":{"position":[[1185,10]]},"79":{"position":[[1192,7]]},"107":{"position":[[7,8]]},"146":{"position":[[55,8]]},"178":{"position":[[70,8]]},"185":{"position":[[2597,8]]},"223":{"position":[[137,8]]},"230":{"position":[[1209,7]]},"274":{"position":[[7,8]]},"334":{"position":[[55,8]]},"369":{"position":[[70,8]]},"376":{"position":[[2581,8]]},"419":{"position":[[685,8]]},"456":{"position":[[137,8]]},"461":{"position":[[1209,7]]},"491":{"position":[[7,8]]},"551":{"position":[[55,8]]},"585":{"position":[[70,8]]},"592":{"position":[[2581,8]]},"612":{"position":[[1650,10]]},"656":{"position":[[685,8]]},"696":{"position":[[137,8]]},"720":{"position":[[1650,10]]}},"keywords":{}}],["const",{"_index":331,"title":{},"content":{"10":{"position":[[420,5],[495,5],[564,5]]},"31":{"position":[[551,5]]},"42":{"position":[[540,5],[608,5],[2074,5]]},"185":{"position":[[259,5]]},"206":{"position":[[120,5],[165,5],[207,5],[232,5]]},"212":{"position":[[204,5],[258,5],[329,5],[380,5]]},"269":{"position":[[4024,5],[4069,5],[4111,5],[4136,5]]},"376":{"position":[[243,5]]},"391":{"position":[[204,5],[258,5],[329,5],[380,5]]},"409":{"position":[[4024,5],[4069,5],[4111,5],[4136,5]]},"426":{"position":[[120,5],[165,5],[207,5],[232,5]]},"477":{"position":[[1616,5],[1642,5],[1670,5]]},"592":{"position":[[243,5]]},"599":{"position":[[153,5],[201,5],[320,5]]},"646":{"position":[[4024,5],[4069,5],[4111,5],[4136,5]]},"661":{"position":[[204,5],[258,5],[329,5],[380,5]]},"668":{"position":[[120,5],[165,5],[207,5],[232,5]]},"699":{"position":[[1616,5],[1642,5],[1670,5]]},"707":{"position":[[153,5],[201,5],[320,5]]}},"keywords":{}}],["constant",{"_index":3666,"title":{"599":{"position":[[0,9]]},"707":{"position":[[0,9]]}},"content":{"599":{"position":[[105,10],[137,9],[300,9],[335,9],[422,10]]},"707":{"position":[[105,10],[137,9],[300,9],[335,9],[422,10]]}},"keywords":{}}],["construct",{"_index":353,"title":{},"content":{"10":{"position":[[1134,10]]}},"keywords":{}}],["constructed."",{"_index":277,"title":{},"content":{"9":{"position":[[448,21]]}},"keywords":{}}],["constructor",{"_index":459,"title":{},"content":{"17":{"position":[[297,12]]},"22":{"position":[[920,11]]},"52":{"position":[[1992,11]]},"70":{"position":[[184,12]]},"74":{"position":[[71,11]]},"98":{"position":[[535,11]]},"99":{"position":[[31,11]]},"141":{"position":[[379,11]]},"147":{"position":[[174,12],[770,11]]},"148":{"position":[[694,11]]},"162":{"position":[[633,11]]},"178":{"position":[[458,12]]},"196":{"position":[[699,12]]},"204":{"position":[[1101,11]]},"209":{"position":[[210,11]]},"234":{"position":[[184,12]]},"238":{"position":[[71,11]]},"247":{"position":[[1601,11]]},"267":{"position":[[4020,14],[4079,11],[4111,11]]},"290":{"position":[[535,11]]},"291":{"position":[[31,11]]},"324":{"position":[[1678,11]]},"326":{"position":[[379,11]]},"335":{"position":[[174,12],[778,11]]},"336":{"position":[[694,11]]},"351":{"position":[[670,11]]},"369":{"position":[[458,12]]},"388":{"position":[[210,11]]},"407":{"position":[[4020,14],[4079,11],[4111,11]]},"424":{"position":[[1051,11]]},"432":{"position":[[636,12]]},"446":{"position":[[1601,11]]},"470":{"position":[[184,12]]},"474":{"position":[[71,11]]},"502":{"position":[[535,11]]},"503":{"position":[[31,11]]},"535":{"position":[[379,11]]},"542":{"position":[[1678,11]]},"552":{"position":[[174,12],[778,11]]},"553":{"position":[[694,11]]},"567":{"position":[[670,11]]},"585":{"position":[[458,12]]},"596":{"position":[[1196,12],[1247,12]]},"599":{"position":[[537,12]]},"644":{"position":[[4020,14],[4079,11],[4111,11]]},"658":{"position":[[210,11]]},"666":{"position":[[1051,11]]},"673":{"position":[[1601,11]]},"679":{"position":[[636,12]]},"704":{"position":[[1196,12],[1247,12]]},"707":{"position":[[537,12]]}},"keywords":{}}],["constructor'",{"_index":3058,"title":{},"content":{"324":{"position":[[1526,13]]},"542":{"position":[[1526,13]]}},"keywords":{}}],["constructor(str",{"_index":1114,"title":{},"content":{"43":{"position":[[220,18]]}},"keywords":{}}],["constructor,error",{"_index":2306,"title":{},"content":{"193":{"position":[[112,17]]},"429":{"position":[[112,17]]},"676":{"position":[[112,17]]}},"keywords":{}}],["constructor.l7",{"_index":2400,"title":{},"content":{"198":{"position":[[1603,14]]},"434":{"position":[[1593,14]]},"681":{"position":[[1603,14]]}},"keywords":{}}],["constructorspay",{"_index":877,"title":{},"content":{"38":{"position":[[680,19]]}},"keywords":{}}],["consult",{"_index":105,"title":{},"content":{"2":{"position":[[289,10]]}},"keywords":{}}],["consum",{"_index":1009,"title":{},"content":{"39":{"position":[[3188,9]]},"613":{"position":[[1515,8]]},"721":{"position":[[1515,8]]}},"keywords":{}}],["contact",{"_index":2309,"title":{},"content":{"193":{"position":[[182,7]]},"429":{"position":[[182,7]]},"676":{"position":[[182,7]]}},"keywords":{}}],["contact@odra.dev",{"_index":394,"title":{},"content":{"13":{"position":[[85,17]]},"24":{"position":[[159,17]]},"34":{"position":[[57,17]]},"55":{"position":[[57,17]]}},"keywords":{}}],["contain",{"_index":1310,"title":{},"content":{"53":{"position":[[1148,10]]},"84":{"position":[[320,8]]},"108":{"position":[[169,10],[215,9]]},"119":{"position":[[1024,7]]},"185":{"position":[[3014,10]]},"204":{"position":[[1040,8]]},"253":{"position":[[320,8]]},"275":{"position":[[173,10],[219,9]]},"300":{"position":[[1024,7]]},"323":{"position":[[98,8]]},"376":{"position":[[2998,10]]},"416":{"position":[[902,8],[919,10]]},"424":{"position":[[991,8]]},"440":{"position":[[3464,8],[3833,8]]},"484":{"position":[[320,8]]},"492":{"position":[[173,10],[219,9]]},"521":{"position":[[1024,7]]},"541":{"position":[[98,8]]},"592":{"position":[[2998,10]]},"596":{"position":[[686,8],[898,8]]},"601":{"position":[[2025,10]]},"610":{"position":[[586,7]]},"613":{"position":[[1383,8],[1867,7]]},"653":{"position":[[902,8],[919,10]]},"666":{"position":[[991,8]]},"687":{"position":[[3464,8],[3833,8]]},"704":{"position":[[686,8],[898,8]]},"709":{"position":[[2025,10]]},"718":{"position":[[586,7]]},"721":{"position":[[1383,8],[1867,7]]}},"keywords":{}}],["content",{"_index":3165,"title":{},"content":{"395":{"position":[[3660,8]]},"632":{"position":[[3660,8]]}},"keywords":{}}],["context",{"_index":655,"title":{"94":{"position":[[0,8]]},"286":{"position":[[0,8]]},"498":{"position":[[0,8]]}},"content":{"22":{"position":[[647,8]]},"39":{"position":[[513,7]]},"95":{"position":[[200,7]]},"102":{"position":[[484,8]]},"141":{"position":[[120,7],[1486,7]]},"158":{"position":[[77,8]]},"168":{"position":[[107,8]]},"287":{"position":[[200,7]]},"294":{"position":[[484,8]]},"324":{"position":[[1177,8]]},"326":{"position":[[120,7],[1486,7]]},"331":{"position":[[77,8]]},"346":{"position":[[13,7]]},"348":{"position":[[107,8]]},"499":{"position":[[200,7]]},"506":{"position":[[484,8]]},"535":{"position":[[120,7],[1486,7]]},"542":{"position":[[1177,8]]},"548":{"position":[[77,8]]},"564":{"position":[[107,8]]},"606":{"position":[[1015,7]]},"714":{"position":[[1015,7]]}},"keywords":{}}],["continu",{"_index":1976,"title":{},"content":{"143":{"position":[[857,8]]},"176":{"position":[[50,8]]},"328":{"position":[[832,8]]},"362":{"position":[[50,8]]},"414":{"position":[[665,8]]},"537":{"position":[[832,8]]},"578":{"position":[[50,8]]},"651":{"position":[[665,8]]}},"keywords":{}}],["contract",{"_index":18,"title":{"64":{"position":[[9,9]]},"65":{"position":[[13,8]]},"66":{"position":[[15,9]]},"80":{"position":[[16,9]]},"90":{"position":[[0,8]]},"97":{"position":[[12,8]]},"102":{"position":[[18,9]]},"110":{"position":[[0,8]]},"121":{"position":[[11,8]]},"141":{"position":[[0,8]]},"142":{"position":[[12,9]]},"154":{"position":[[13,8]]},"208":{"position":[[38,8]]},"209":{"position":[[0,9]]},"210":{"position":[[14,9]]},"231":{"position":[[16,9]]},"239":{"position":[[9,9]]},"240":{"position":[[13,8]]},"241":{"position":[[15,9]]},"267":{"position":[[18,10]]},"282":{"position":[[0,8]]},"289":{"position":[[12,8]]},"294":{"position":[[18,9]]},"302":{"position":[[11,8]]},"305":{"position":[[0,8]]},"320":{"position":[[7,8]]},"326":{"position":[[0,8]]},"327":{"position":[[12,9]]},"339":{"position":[[13,8]]},"383":{"position":[[17,8]]},"387":{"position":[[38,8]]},"388":{"position":[[0,9]]},"389":{"position":[[14,9]]},"407":{"position":[[18,10]]},"438":{"position":[[14,9]]},"440":{"position":[[0,8]]},"462":{"position":[[16,9]]},"464":{"position":[[9,9]]},"465":{"position":[[13,8]]},"466":{"position":[[15,9]]},"476":{"position":[[0,9]]},"494":{"position":[[0,8]]},"501":{"position":[[12,8]]},"506":{"position":[[18,9]]},"510":{"position":[[0,8]]},"523":{"position":[[11,8]]},"535":{"position":[[0,8]]},"536":{"position":[[12,9]]},"538":{"position":[[7,8]]},"559":{"position":[[13,8]]},"625":{"position":[[17,8]]},"644":{"position":[[18,10]]},"657":{"position":[[38,8]]},"658":{"position":[[0,9]]},"659":{"position":[[14,9]]},"685":{"position":[[14,9]]},"687":{"position":[[0,8]]},"698":{"position":[[0,9]]}},"content":{"1":{"position":[[164,8],[432,8],[1043,10]]},"2":{"position":[[571,10]]},"5":{"position":[[144,10]]},"6":{"position":[[336,8]]},"10":{"position":[[118,8],[254,8],[309,8],[651,8]]},"15":{"position":[[246,9],[410,10],[511,10]]},"17":{"position":[[1735,8],[1818,8]]},"18":{"position":[[29,10]]},"20":{"position":[[200,10],[263,8]]},"21":{"position":[[90,8]]},"22":{"position":[[27,8],[198,8],[362,8],[428,8],[761,9],[863,9],[905,8]]},"30":{"position":[[167,8]]},"31":{"position":[[177,8],[220,8],[537,9],[811,10],[1405,8],[1715,8],[2297,8]]},"38":{"position":[[45,8],[186,8],[480,8],[1049,9]]},"39":{"position":[[504,8],[615,8],[2098,10],[3337,8]]},"40":{"position":[[303,8]]},"42":{"position":[[76,8],[365,8],[814,9],[931,8],[1228,8],[1727,9],[1764,9],[1783,8],[1943,9],[2000,9],[2184,8],[2440,8]]},"43":{"position":[[52,9],[111,9],[161,8],[671,8],[774,8],[1709,8],[1817,8],[1874,9]]},"44":{"position":[[146,8],[222,9],[264,9]]},"50":{"position":[[20,8],[288,8]]},"51":{"position":[[38,8],[164,8],[251,8],[277,8],[1810,9],[1872,8]]},"52":{"position":[[68,9],[165,8],[1099,8],[1620,8],[1781,8],[1831,8],[1950,9],[2019,8],[3201,9],[3305,8],[3331,8],[4691,8],[4858,8],[6553,8]]},"54":{"position":[[128,8],[268,8]]},"65":{"position":[[13,8],[253,8],[363,8],[572,9]]},"70":{"position":[[21,9],[107,9]]},"72":{"position":[[28,9],[345,10]]},"73":{"position":[[612,8]]},"76":{"position":[[185,8],[256,9],[559,9]]},"80":{"position":[[53,8]]},"81":{"position":[[68,8],[166,9],[403,10]]},"83":{"position":[[109,8]]},"91":{"position":[[313,8],[577,8],[747,9]]},"92":{"position":[[26,8],[79,9],[150,8],[313,9],[437,9],[581,8],[716,8],[780,8],[900,8]]},"93":{"position":[[136,8]]},"94":{"position":[[129,8],[537,8],[577,8]]},"95":{"position":[[41,9]]},"97":{"position":[[37,8]]},"98":{"position":[[21,8],[71,8],[221,8],[438,8],[512,9]]},"99":{"position":[[15,8]]},"100":{"position":[[128,8],[293,9],[896,8],[968,8],[1097,8]]},"101":{"position":[[69,8],[136,8]]},"102":{"position":[[246,9],[263,8],[293,8],[541,9]]},"103":{"position":[[142,8]]},"107":{"position":[[39,8],[76,8],[107,9],[169,9]]},"108":{"position":[[160,8],[189,8],[281,8]]},"110":{"position":[[4,8],[141,9],[443,8],[530,8]]},"111":{"position":[[17,8],[285,10]]},"114":{"position":[[40,9]]},"115":{"position":[[1378,8],[1520,8],[1756,10],[2983,9],[3097,8],[3329,10]]},"118":{"position":[[36,8]]},"119":{"position":[[479,9],[704,10]]},"120":{"position":[[59,9],[311,9],[404,9]]},"121":{"position":[[90,9],[208,9],[421,9]]},"124":{"position":[[50,9]]},"126":{"position":[[502,10],[723,10],[1223,8],[1861,8],[2268,9],[2496,8],[2640,9],[2861,8]]},"128":{"position":[[541,8],[697,9],[769,9]]},"132":{"position":[[46,9],[129,13],[210,9],[270,8],[314,9]]},"133":{"position":[[36,8]]},"138":{"position":[[1183,8]]},"141":{"position":[[96,9],[172,10],[340,8],[544,8],[687,9],[706,9],[733,9],[791,9],[872,8],[1129,9],[1150,8]]},"142":{"position":[[44,8],[142,9],[188,8]]},"143":{"position":[[685,9],[725,9],[764,9],[886,8],[1291,8]]},"146":{"position":[[295,9],[351,10],[496,9]]},"147":{"position":[[211,8],[447,8],[558,9],[789,9],[943,8]]},"148":{"position":[[312,8],[542,8],[887,8]]},"154":{"position":[[65,8],[122,13],[239,8],[315,13],[363,13]]},"155":{"position":[[116,9]]},"157":{"position":[[93,8]]},"158":{"position":[[49,9],[68,8]]},"160":{"position":[[37,8]]},"162":{"position":[[257,8],[601,8]]},"163":{"position":[[188,9]]},"166":{"position":[[93,9]]},"168":{"position":[[98,8],[141,9],[1263,9],[1369,9],[1476,9],[2189,8]]},"173":{"position":[[520,9]]},"174":{"position":[[77,10]]},"175":{"position":[[207,8],[272,8],[502,9]]},"178":{"position":[[517,8],[1318,8]]},"182":{"position":[[377,8]]},"185":{"position":[[3304,8]]},"197":{"position":[[1660,8]]},"198":{"position":[[1415,8],[1753,8],[2450,9],[2536,9],[2635,9],[2661,9],[2830,9],[2906,8],[3350,8],[3822,8]]},"199":{"position":[[126,9],[215,9]]},"206":{"position":[[567,8],[641,8],[1121,9],[1759,9]]},"209":{"position":[[14,8],[56,8],[751,8]]},"210":{"position":[[230,8],[312,8],[1115,9]]},"211":{"position":[[25,9]]},"212":{"position":[[190,8]]},"218":{"position":[[125,8]]},"220":{"position":[[92,8]]},"221":{"position":[[442,9],[579,8],[728,8],[817,8],[893,8],[919,8]]},"222":{"position":[[452,8]]},"223":{"position":[[38,9],[91,8],[128,8],[227,8],[956,8]]},"227":{"position":[[185,8],[256,9],[559,9]]},"231":{"position":[[53,8]]},"232":{"position":[[68,8],[166,9],[403,10]]},"234":{"position":[[21,9],[107,9]]},"236":{"position":[[28,9],[345,10]]},"237":{"position":[[612,8]]},"240":{"position":[[13,8],[253,8],[363,8],[572,9]]},"248":{"position":[[65,10]]},"252":{"position":[[109,8]]},"257":{"position":[[40,9]]},"258":{"position":[[1324,8],[1466,8],[1702,10],[2909,9],[3023,8],[3255,10]]},"264":{"position":[[47,10]]},"266":{"position":[[125,13]]},"267":{"position":[[10,9],[172,10],[1900,8],[3508,8],[3563,8],[3650,8]]},"268":{"position":[[31,10],[236,8],[279,8],[574,8],[694,8],[837,8],[1042,8]]},"269":{"position":[[38,8],[4477,8],[4551,8],[5031,9],[5669,9]]},"274":{"position":[[39,8],[76,8],[107,9],[169,9]]},"275":{"position":[[164,8],[193,8],[285,8]]},"277":{"position":[[502,10],[723,10],[1391,8],[2029,8],[2436,9],[2664,8],[2808,9],[3029,8]]},"279":{"position":[[541,8],[697,9],[769,9]]},"283":{"position":[[313,8],[577,8],[747,9]]},"284":{"position":[[26,8],[79,9],[150,8],[313,9],[437,9],[581,8],[716,8],[780,8],[900,8]]},"285":{"position":[[136,8]]},"286":{"position":[[129,8],[537,8],[577,8]]},"287":{"position":[[41,9]]},"289":{"position":[[37,8]]},"290":{"position":[[21,8],[71,8],[221,8],[438,8],[512,9]]},"291":{"position":[[15,8]]},"292":{"position":[[128,8],[293,9],[896,8],[968,8],[1097,8]]},"293":{"position":[[69,8],[136,8]]},"294":{"position":[[246,9],[263,8],[293,8],[541,9]]},"295":{"position":[[142,8]]},"299":{"position":[[36,8]]},"300":{"position":[[479,9],[704,10]]},"301":{"position":[[59,9],[311,9],[404,9]]},"302":{"position":[[90,9],[208,9],[421,9]]},"305":{"position":[[4,8],[141,9],[443,8],[530,8]]},"306":{"position":[[17,8],[285,10]]},"309":{"position":[[50,9]]},"312":{"position":[[46,9],[129,13],[210,9],[270,8],[314,9]]},"313":{"position":[[36,8]]},"318":{"position":[[1175,8]]},"321":{"position":[[536,9],[626,9],[720,8],[837,8],[1061,9],[1304,8],[1477,8]]},"322":{"position":[[135,8]]},"323":{"position":[[137,9],[1769,8],[2722,9],[3333,8]]},"324":{"position":[[260,8],[387,9],[573,9],[760,9],[902,8],[1168,8],[1243,8],[1436,8]]},"326":{"position":[[96,9],[172,10],[340,8],[544,8],[687,9],[706,9],[733,9],[791,9],[872,8],[1129,9],[1150,8]]},"327":{"position":[[44,8],[142,9],[188,8]]},"328":{"position":[[660,9],[700,9],[739,9],[861,8],[1266,8]]},"330":{"position":[[93,8]]},"331":{"position":[[49,9],[68,8]]},"334":{"position":[[295,9],[351,10],[500,9]]},"335":{"position":[[211,8],[451,8],[562,9],[797,9],[951,8]]},"336":{"position":[[312,8],[542,8],[887,8]]},"339":{"position":[[65,8],[122,13],[239,8],[315,13],[363,13]]},"340":{"position":[[116,9]]},"345":{"position":[[37,8]]},"348":{"position":[[98,8],[141,9],[1263,9],[1369,9],[1476,9],[2199,8]]},"351":{"position":[[257,8],[638,8]]},"352":{"position":[[188,9]]},"355":{"position":[[93,9]]},"359":{"position":[[520,9]]},"360":{"position":[[77,10]]},"361":{"position":[[207,8],[272,8],[502,9]]},"369":{"position":[[517,8],[1318,8]]},"373":{"position":[[377,8]]},"376":{"position":[[3288,8]]},"382":{"position":[[53,8],[78,8]]},"383":{"position":[[30,8]]},"384":{"position":[[38,8]]},"388":{"position":[[14,8],[56,8],[683,8]]},"389":{"position":[[230,8],[312,8],[1052,9]]},"390":{"position":[[25,9]]},"391":{"position":[[190,8]]},"393":{"position":[[509,8]]},"394":{"position":[[14,8],[571,9]]},"395":{"position":[[159,8],[263,8],[915,9],[1756,9],[2146,9],[2198,8],[3746,10],[3899,10],[4996,8],[6710,8]]},"396":{"position":[[176,8],[360,8],[566,8],[660,8],[723,8],[1190,8]]},"397":{"position":[[147,9],[202,8]]},"398":{"position":[[210,9]]},"404":{"position":[[47,10]]},"406":{"position":[[125,13]]},"407":{"position":[[10,9],[172,10],[1900,8],[3508,8],[3563,8],[3650,8]]},"408":{"position":[[31,10],[236,8],[279,8],[574,8],[694,8],[837,8],[1042,8]]},"409":{"position":[[38,8],[4477,8],[4551,8],[5031,9],[5669,9]]},"416":{"position":[[1402,9],[2839,8],[2929,9],[3186,9],[4004,8],[4892,8]]},"419":{"position":[[1310,8],[3921,9],[4794,8],[4884,9],[5583,8]]},"426":{"position":[[567,8],[641,8],[1116,9],[1749,9]]},"433":{"position":[[1659,8]]},"434":{"position":[[1405,8],[1743,8],[2440,9],[2526,9],[2625,9],[2651,9],[2820,9],[2896,8],[3332,8],[3804,8]]},"435":{"position":[[126,9],[215,9]]},"438":{"position":[[17,8]]},"440":{"position":[[42,8],[3383,9],[3723,9],[3764,8],[4580,9],[4780,9],[5151,8],[5414,8],[5524,8],[5605,8],[5685,8]]},"441":{"position":[[308,9],[358,8],[433,9],[1977,9],[2062,9],[2168,8],[2203,8],[2696,8],[3487,9],[3800,8],[4212,8]]},"442":{"position":[[208,8]]},"447":{"position":[[65,10]]},"451":{"position":[[125,8]]},"453":{"position":[[92,8]]},"454":{"position":[[442,9],[579,8],[728,8],[817,8],[893,8],[919,8]]},"455":{"position":[[452,8]]},"456":{"position":[[38,9],[91,8],[128,8],[227,8],[956,8]]},"458":{"position":[[185,8],[256,9],[559,9]]},"462":{"position":[[53,8]]},"463":{"position":[[68,8],[166,9],[403,10]]},"465":{"position":[[13,8],[253,8],[363,8],[572,9]]},"470":{"position":[[21,9],[107,9]]},"472":{"position":[[28,9],[345,10]]},"473":{"position":[[612,8]]},"476":{"position":[[50,8],[457,8],[613,9],[1204,9],[1582,8]]},"477":{"position":[[286,8],[543,9],[1368,9],[1838,8],[1968,9],[1978,8],[2144,9],[2912,8],[3804,8],[3925,9]]},"478":{"position":[[126,9]]},"480":{"position":[[40,9]]},"481":{"position":[[1324,8],[1466,8],[1702,10],[2909,9],[3023,8],[3255,10]]},"483":{"position":[[109,8]]},"491":{"position":[[39,8],[76,8],[107,9],[169,9]]},"492":{"position":[[164,8],[193,8],[285,8]]},"495":{"position":[[313,8],[577,8],[747,9]]},"496":{"position":[[26,8],[79,9],[150,8],[313,9],[437,9],[581,8],[716,8],[780,8],[900,8]]},"497":{"position":[[136,8]]},"498":{"position":[[129,8],[537,8],[577,8]]},"499":{"position":[[41,9]]},"501":{"position":[[37,8]]},"502":{"position":[[21,8],[71,8],[221,8],[438,8],[512,9]]},"503":{"position":[[15,8]]},"504":{"position":[[128,8],[293,9],[896,8],[968,8],[1097,8]]},"505":{"position":[[69,8],[136,8]]},"506":{"position":[[246,9],[263,8],[293,8],[541,9]]},"507":{"position":[[142,8]]},"510":{"position":[[4,8],[141,9],[443,8],[530,8]]},"511":{"position":[[17,8],[285,10]]},"514":{"position":[[502,10],[723,10],[1223,8],[1861,8],[2268,9],[2496,8],[2640,9],[2861,8]]},"516":{"position":[[541,8],[697,9],[769,9]]},"520":{"position":[[36,8]]},"521":{"position":[[479,9],[704,10]]},"522":{"position":[[59,9],[311,9],[404,9]]},"523":{"position":[[90,9],[208,9],[421,9]]},"526":{"position":[[50,9]]},"529":{"position":[[46,9],[129,13],[210,9],[270,8],[314,9]]},"530":{"position":[[36,8]]},"535":{"position":[[96,9],[172,10],[340,8],[544,8],[687,9],[706,9],[733,9],[791,9],[872,8],[1129,9],[1150,8]]},"536":{"position":[[44,8],[142,9],[188,8]]},"537":{"position":[[660,9],[700,9],[739,9],[861,8],[1266,8]]},"539":{"position":[[536,9],[626,9],[720,8],[837,8],[1061,9],[1304,8],[1477,8]]},"540":{"position":[[135,8]]},"541":{"position":[[137,9],[1769,8],[2722,9],[3333,8]]},"542":{"position":[[260,8],[387,9],[573,9],[760,9],[902,8],[1168,8],[1243,8],[1436,8]]},"544":{"position":[[1175,8]]},"547":{"position":[[93,8]]},"548":{"position":[[49,9],[68,8]]},"551":{"position":[[295,9],[351,10],[500,9]]},"552":{"position":[[211,8],[451,8],[562,9],[797,9],[951,8]]},"553":{"position":[[312,8],[542,8],[887,8]]},"559":{"position":[[65,8],[122,13],[239,8],[315,13],[363,13]]},"560":{"position":[[116,9]]},"562":{"position":[[37,8]]},"564":{"position":[[98,8],[141,9],[1263,9],[1369,9],[1476,9],[2189,8]]},"567":{"position":[[257,8],[638,8]]},"568":{"position":[[188,9]]},"571":{"position":[[93,9]]},"575":{"position":[[520,9]]},"576":{"position":[[77,10]]},"577":{"position":[[207,8],[272,8],[502,9]]},"585":{"position":[[517,8],[1318,8]]},"589":{"position":[[377,8]]},"592":{"position":[[3288,8]]},"594":{"position":[[98,8],[229,9]]},"595":{"position":[[97,8]]},"596":{"position":[[50,8],[122,8],[550,8],[1187,8]]},"598":{"position":[[1817,8]]},"600":{"position":[[661,9]]},"602":{"position":[[759,9],[1992,9]]},"604":{"position":[[5,9],[484,8]]},"605":{"position":[[399,8]]},"607":{"position":[[83,10],[334,8]]},"609":{"position":[[307,8]]},"612":{"position":[[96,10],[223,10],[269,9],[296,8],[1420,8],[1458,10],[1566,9],[1938,8],[1975,9],[2146,10]]},"613":{"position":[[1267,9],[1556,8],[1619,8],[1944,10]]},"614":{"position":[[15,8],[154,8],[226,8]]},"616":{"position":[[646,8]]},"617":{"position":[[991,8]]},"618":{"position":[[74,9],[564,8]]},"624":{"position":[[53,8],[78,8]]},"625":{"position":[[30,8]]},"626":{"position":[[38,8]]},"630":{"position":[[509,8]]},"631":{"position":[[14,8],[571,9]]},"632":{"position":[[159,8],[263,8],[915,9],[1756,9],[2146,9],[2198,8],[3746,10],[3899,10],[4996,8],[6710,8]]},"633":{"position":[[176,8],[360,8],[566,8],[660,8],[723,8],[1190,8]]},"634":{"position":[[147,9],[202,8]]},"635":{"position":[[210,9]]},"641":{"position":[[47,10]]},"643":{"position":[[125,13]]},"644":{"position":[[10,9],[172,10],[1900,8],[3508,8],[3563,8],[3650,8]]},"645":{"position":[[31,10],[236,8],[279,8],[574,8],[694,8],[837,8],[1042,8]]},"646":{"position":[[38,8],[4477,8],[4551,8],[5031,9],[5669,9]]},"653":{"position":[[1402,9],[2839,8],[2929,9],[3186,9],[4004,8],[4892,8]]},"656":{"position":[[1310,8],[3921,9],[4794,8],[4884,9],[5583,8]]},"658":{"position":[[14,8],[56,8],[683,8]]},"659":{"position":[[230,8],[312,8],[1052,9]]},"660":{"position":[[25,9]]},"661":{"position":[[190,8]]},"668":{"position":[[567,8],[641,8],[1121,9],[1759,9]]},"674":{"position":[[65,10]]},"680":{"position":[[1659,8]]},"681":{"position":[[1415,8],[1753,8],[2450,9],[2536,9],[2635,9],[2661,9],[2830,9],[2906,8],[3350,8],[3822,8]]},"682":{"position":[[126,9],[215,9]]},"685":{"position":[[17,8]]},"687":{"position":[[42,8],[3383,9],[3723,9],[3764,8],[4580,9],[4780,9],[5151,8],[5414,8],[5524,8],[5605,8],[5685,8]]},"688":{"position":[[308,9],[358,8],[433,9],[1977,9],[2062,9],[2168,8],[2203,8],[2696,8],[3487,9],[3800,8],[4212,8]]},"689":{"position":[[208,8]]},"691":{"position":[[125,8]]},"693":{"position":[[92,8]]},"694":{"position":[[442,9],[579,8],[728,8],[817,8],[893,8],[919,8]]},"695":{"position":[[452,8]]},"696":{"position":[[38,9],[91,8],[128,8],[227,8],[956,8]]},"698":{"position":[[50,8],[457,8],[613,9],[1204,9],[1582,8]]},"699":{"position":[[286,8],[543,9],[1368,9],[1838,8],[1968,9],[1978,8],[2144,9],[2912,8],[3804,8],[3925,9]]},"700":{"position":[[126,9]]},"702":{"position":[[98,8],[229,9]]},"703":{"position":[[97,8]]},"704":{"position":[[50,8],[122,8],[550,8],[1187,8]]},"706":{"position":[[1817,8]]},"708":{"position":[[661,9]]},"710":{"position":[[759,9],[1992,9]]},"712":{"position":[[5,9],[484,8]]},"713":{"position":[[399,8]]},"715":{"position":[[83,10],[334,8]]},"717":{"position":[[307,8]]},"720":{"position":[[96,10],[223,10],[269,9],[296,8],[1420,8],[1458,10],[1566,9],[1938,8],[1975,9],[2146,10]]},"721":{"position":[[1267,9],[1556,8],[1619,8],[1944,10]]},"722":{"position":[[15,8],[154,8],[226,8]]},"724":{"position":[[646,8]]},"725":{"position":[[991,8]]},"726":{"position":[[74,9],[564,8]]}},"keywords":{}}],["contract"",{"_index":2683,"title":{},"content":{"212":{"position":[[4527,15]]},"323":{"position":[[2216,15]]},"391":{"position":[[4545,15]]},"541":{"position":[[2216,15]]},"661":{"position":[[4545,15]]}},"keywords":{}}],["contract'",{"_index":1276,"title":{},"content":{"52":{"position":[[2134,10]]},"72":{"position":[[279,10]]},"92":{"position":[[515,10]]},"195":{"position":[[514,10]]},"198":{"position":[[3646,10]]},"204":{"position":[[1267,10]]},"236":{"position":[[279,10]]},"284":{"position":[[515,10]]},"324":{"position":[[1390,10]]},"396":{"position":[[439,10]]},"416":{"position":[[4658,10]]},"424":{"position":[[1217,10]]},"431":{"position":[[514,10]]},"434":{"position":[[3628,10]]},"472":{"position":[[279,10]]},"477":{"position":[[233,10],[3947,10],[4013,10]]},"496":{"position":[[515,10]]},"542":{"position":[[1390,10]]},"596":{"position":[[699,10],[756,10]]},"603":{"position":[[328,10]]},"633":{"position":[[439,10]]},"653":{"position":[[4658,10]]},"666":{"position":[[1217,10]]},"678":{"position":[[514,10]]},"681":{"position":[[3646,10]]},"699":{"position":[[233,10],[3947,10],[4013,10]]},"704":{"position":[[699,10],[756,10]]},"711":{"position":[[328,10]]}},"keywords":{}}],["contract.address",{"_index":1984,"title":{},"content":{"143":{"position":[[1347,19]]},"328":{"position":[[1322,19]]},"537":{"position":[[1322,19]]}},"keywords":{}}],["contract.count_ref_recursive(11",{"_index":1401,"title":{},"content":{"73":{"position":[[695,33]]},"237":{"position":[[695,33]]},"473":{"position":[[695,33]]}},"keywords":{}}],["contract.field",{"_index":3043,"title":{},"content":{"324":{"position":[[126,15]]},"542":{"position":[[126,15]]}},"keywords":{}}],["contract.flip",{"_index":2005,"title":{},"content":{"148":{"position":[[391,16]]},"178":{"position":[[1397,16]]},"336":{"position":[[391,16]]},"369":{"position":[[1397,16]]},"553":{"position":[[391,16]]},"585":{"position":[[1397,16]]}},"keywords":{}}],["contract.get_balance(&cal",{"_index":3576,"title":{},"content":{"477":{"position":[[2078,35],[2248,35]]},"699":{"position":[[2078,35],[2248,35]]}},"keywords":{}}],["contract.get_status(some(account",{"_index":1091,"title":{},"content":{"42":{"position":[[2356,38],[2512,36]]}},"keywords":{}}],["contract.incr",{"_index":2741,"title":{},"content":{"223":{"position":[[1022,21]]},"456":{"position":[[1022,21]]},"696":{"position":[[1022,21]]}},"keywords":{}}],["contract.issu",{"_index":3431,"title":{},"content":{"440":{"position":[[4639,14]]},"687":{"position":[[4639,14]]}},"keywords":{}}],["contract.issue_ticket("ev".to_str",{"_index":3445,"title":{},"content":{"440":{"position":[[5212,49],[5280,49]]},"687":{"position":[[5212,49],[5280,49]]}},"keywords":{}}],["contract.l17",{"_index":3325,"title":{},"content":{"432":{"position":[[724,12]]},"679":{"position":[[724,12]]}},"keywords":{}}],["contract.l23",{"_index":2332,"title":{},"content":{"196":{"position":[[787,12]]}},"keywords":{}}],["contract.l36",{"_index":3515,"title":{},"content":{"441":{"position":[[3974,12]]},"688":{"position":[[3974,12]]}},"keywords":{}}],["contract.l9",{"_index":3492,"title":{},"content":{"441":{"position":[[1646,11]]},"688":{"position":[[1646,11]]}},"keywords":{}}],["contract.paus",{"_index":2742,"title":{},"content":{"223":{"position":[[1044,17]]},"456":{"position":[[1044,17]]},"696":{"position":[[1044,17]]}},"keywords":{}}],["contract.set_status("hello".to_str",{"_index":1089,"title":{},"content":{"42":{"position":[[2262,51]]}},"keywords":{}}],["contract.th",{"_index":2548,"title":{},"content":{"209":{"position":[[274,12]]},"388":{"position":[[274,12]]},"658":{"position":[[274,12]]}},"keywords":{}}],["contract.try_increment().unwrap_err",{"_index":2743,"title":{},"content":{"223":{"position":[[1074,38]]},"456":{"position":[[1074,38]]},"696":{"position":[[1074,38]]}},"keywords":{}}],["contract.withdraw(&u512::from(withdraw",{"_index":3577,"title":{},"content":{"477":{"position":[[2154,47]]},"699":{"position":[[2154,47]]}},"keywords":{}}],["contract/submodul",{"_index":3776,"title":{},"content":{"607":{"position":[[185,18]]},"715":{"position":[[185,18]]}},"keywords":{}}],["contract1",{"_index":2158,"title":{},"content":{"178":{"position":[[1510,9]]},"369":{"position":[[1510,9]]},"585":{"position":[[1510,9]]}},"keywords":{}}],["contract1.flip",{"_index":2162,"title":{},"content":{"178":{"position":[[1676,17]]},"369":{"position":[[1676,17]]},"585":{"position":[[1676,17]]}},"keywords":{}}],["contract2",{"_index":2159,"title":{},"content":{"178":{"position":[[1568,9]]},"369":{"position":[[1568,9]]},"585":{"position":[[1568,9]]}},"keywords":{}}],["contract@odra.devwith",{"_index":112,"title":{},"content":{"2":{"position":[[369,21]]}},"keywords":{}}],["contract_addr.cal",{"_index":3787,"title":{},"content":{"609":{"position":[[138,19]]},"717":{"position":[[138,19]]}},"keywords":{}}],["contract_address",{"_index":2145,"title":{},"content":{"168":{"position":[[2088,17]]},"348":{"position":[[2104,17]]},"564":{"position":[[2088,17]]}},"keywords":{}}],["contract_env",{"_index":464,"title":{},"content":{"17":{"position":[[370,13],[1892,13]]},"51":{"position":[[418,14]]},"267":{"position":[[1815,12],[1993,12]]},"407":{"position":[[1815,12],[1993,12]]},"644":{"position":[[1815,12],[1993,12]]}},"keywords":{}}],["contract_env::attached_valu",{"_index":1605,"title":{},"content":{"92":{"position":[[943,30]]},"284":{"position":[[943,30]]},"496":{"position":[[943,30]]}},"keywords":{}}],["contract_env::cal",{"_index":494,"title":{},"content":{"17":{"position":[[1154,23],[2757,23],[3172,23],[3768,23]]},"51":{"position":[[888,22]]}},"keywords":{}}],["contract_env::revert(error::insufficientallow",{"_index":541,"title":{},"content":{"17":{"position":[[3481,51]]}},"keywords":{}}],["contract_env::revert(error::insufficientbal",{"_index":536,"title":{},"content":{"17":{"position":[[2926,49],[3405,49]]}},"keywords":{}}],["contract_env::revert(error::messagealreadydefin",{"_index":498,"title":{},"content":{"17":{"position":[[1275,51]]}},"keywords":{}}],["contract_hash",{"_index":2616,"title":{},"content":{"212":{"position":[[210,14]]},"391":{"position":[[210,14]]},"661":{"position":[[210,14]]}},"keywords":{}}],["contract_hash.to_str",{"_index":2632,"title":{},"content":{"212":{"position":[[1083,26]]},"391":{"position":[[1083,26]]},"661":{"position":[[1083,26]]}},"keywords":{}}],["contract_nam",{"_index":1258,"title":{},"content":{"52":{"position":[[1129,14],[1314,19]]}},"keywords":{}}],["contract_package_hash",{"_index":1683,"title":{},"content":{"103":{"position":[[73,21]]},"295":{"position":[[73,21]]},"507":{"position":[[73,21]]}},"keywords":{}}],["contract_wasm",{"_index":1139,"title":{},"content":{"43":{"position":[[1040,17]]}},"keywords":{}}],["contractdefinit",{"_index":919,"title":{},"content":{"39":{"position":[[663,18]]}},"keywords":{}}],["contractenv",{"_index":2845,"title":{},"content":{"267":{"position":[[1945,12]]},"407":{"position":[[1945,12]]},"600":{"position":[[1178,11]]},"604":{"position":[[525,11]]},"644":{"position":[[1945,12]]},"708":{"position":[[1178,11]]},"712":{"position":[[525,11]]}},"keywords":{}}],["contractenv::cal",{"_index":2371,"title":{},"content":{"197":{"position":[[1215,21]]},"433":{"position":[[1214,21]]},"680":{"position":[[1214,21]]}},"keywords":{}}],["contractenv::emit_ev",{"_index":2349,"title":{},"content":{"196":{"position":[[1581,25]]},"432":{"position":[[1459,25]]},"679":{"position":[[1459,25]]}},"keywords":{}}],["contractenv::revert",{"_index":2340,"title":{},"content":{"196":{"position":[[1140,21]]},"432":{"position":[[1083,21]]},"679":{"position":[[1083,21]]}},"keywords":{}}],["contractinfo",{"_index":983,"title":{},"content":{"39":{"position":[[2442,12]]}},"keywords":{}}],["contractref",{"_index":1929,"title":{},"content":{"141":{"position":[[137,11]]},"326":{"position":[[137,11]]},"535":{"position":[[137,11]]},"617":{"position":[[49,12]]},"725":{"position":[[49,12]]}},"keywords":{}}],["contractti",{"_index":923,"title":{},"content":{"39":{"position":[[738,11]]}},"keywords":{}}],["contrari",{"_index":1696,"title":{},"content":{"107":{"position":[[238,8]]},"274":{"position":[[238,8]]},"491":{"position":[[238,8]]}},"keywords":{}}],["contrast",{"_index":3827,"title":{},"content":{"612":{"position":[[1807,9]]},"720":{"position":[[1807,9]]}},"keywords":{}}],["control",{"_index":1566,"title":{"181":{"position":[[7,7]]},"372":{"position":[[7,7]]},"588":{"position":[[7,7]]}},"content":{"88":{"position":[[353,7]]},"115":{"position":[[1673,7]]},"182":{"position":[[72,7]]},"183":{"position":[[7,7]]},"189":{"position":[[75,7],[278,7]]},"247":{"position":[[1892,7]]},"250":{"position":[[353,7]]},"258":{"position":[[1619,7]]},"366":{"position":[[75,7],[278,7]]},"373":{"position":[[72,7]]},"374":{"position":[[7,7]]},"446":{"position":[[1892,7]]},"481":{"position":[[1619,7]]},"488":{"position":[[353,7]]},"582":{"position":[[75,7],[278,7]]},"589":{"position":[[72,7]]},"590":{"position":[[7,7]]},"673":{"position":[[1892,7]]}},"keywords":{}}],["conveni",{"_index":2397,"title":{},"content":{"198":{"position":[[1210,12]]},"434":{"position":[[1200,12]]},"681":{"position":[[1210,12]]}},"keywords":{}}],["convert",{"_index":303,"title":{},"content":{"9":{"position":[[1159,7],[1333,7],[1492,7]]},"39":{"position":[[1707,10]]},"40":{"position":[[129,9]]},"44":{"position":[[159,7]]},"108":{"position":[[81,10]]},"138":{"position":[[1230,7]]},"198":{"position":[[3936,8]]},"211":{"position":[[578,7]]},"212":{"position":[[3570,7]]},"275":{"position":[[85,10]]},"318":{"position":[[1222,7]]},"390":{"position":[[552,7]]},"391":{"position":[[3588,7]]},"434":{"position":[[3918,8]]},"492":{"position":[[85,10]]},"544":{"position":[[1222,7]]},"660":{"position":[[552,7]]},"661":{"position":[[3588,7]]},"681":{"position":[[3936,8]]}},"keywords":{}}],["copi",{"_index":2679,"title":{},"content":{"212":{"position":[[4393,4]]},"264":{"position":[[433,4]]},"382":{"position":[[246,4]]},"391":{"position":[[4411,4]]},"404":{"position":[[433,4]]},"624":{"position":[[246,4]]},"641":{"position":[[433,4]]},"661":{"position":[[4411,4]]}},"keywords":{}}],["copil",{"_index":432,"title":{},"content":{"16":{"position":[[77,7]]}},"keywords":{}}],["copilot",{"_index":399,"title":{},"content":{"15":{"position":[[47,7]]}},"keywords":{}}],["core",{"_index":161,"title":{"205":{"position":[[0,5]]},"425":{"position":[[0,5]]},"667":{"position":[[0,5]]}},"content":{"3":{"position":[[646,4]]},"22":{"position":[[532,4]]},"267":{"position":[[3361,5]]},"407":{"position":[[3361,5]]},"644":{"position":[[3361,5]]}},"keywords":{}}],["core/src/list.r",{"_index":2096,"title":{},"content":{"163":{"position":[[1563,16]]},"352":{"position":[[1585,16]]},"568":{"position":[[1585,16]]}},"keywords":{}}],["core::str::fromstr",{"_index":3620,"title":{},"content":{"598":{"position":[[17,19]]},"706":{"position":[[17,19]]}},"keywords":{}}],["corner",{"_index":3191,"title":{},"content":{"396":{"position":[[298,7]]},"633":{"position":[[298,7]]}},"keywords":{}}],["correct",{"_index":320,"title":{},"content":{"10":{"position":[[138,12]]}},"keywords":{}}],["correctli",{"_index":1336,"title":{},"content":{"65":{"position":[[634,10]]},"154":{"position":[[187,10]]},"174":{"position":[[299,9]]},"240":{"position":[[634,10]]},"339":{"position":[[187,10]]},"360":{"position":[[299,9]]},"395":{"position":[[4464,10]]},"396":{"position":[[330,10]]},"465":{"position":[[634,10]]},"559":{"position":[[187,10]]},"576":{"position":[[299,9]]},"632":{"position":[[4464,10]]},"633":{"position":[[330,10]]}},"keywords":{}}],["correspond",{"_index":1894,"title":{},"content":{"132":{"position":[[251,11]]},"182":{"position":[[187,13]]},"312":{"position":[[251,11]]},"373":{"position":[[187,13]]},"529":{"position":[[251,11]]},"589":{"position":[[187,13]]}},"keywords":{}}],["cosmo",{"_index":603,"title":{},"content":{"20":{"position":[[788,7]]},"50":{"position":[[64,6],[162,6],[240,6]]},"51":{"position":[[1717,6]]},"53":{"position":[[1091,6]]},"54":{"position":[[49,6]]}},"keywords":{}}],["cosmwasm",{"_index":1177,"title":{"49":{"position":[[7,8]]},"50":{"position":[[0,9]]}},"content":{"50":{"position":[[0,8],[273,8],[532,9]]},"51":{"position":[[55,8],[1617,9],[1801,8]]},"52":{"position":[[1772,8]]},"54":{"position":[[330,8]]}},"keywords":{}}],["cosmwasm.wasm.v1.msgexecutecontract",{"_index":1306,"title":{},"content":{"53":{"position":[[422,36]]}},"keywords":{}}],["cost",{"_index":371,"title":{},"content":{"11":{"position":[[180,4]]},"43":{"position":[[1791,5]]},"126":{"position":[[3104,4]]},"127":{"position":[[841,4]]},"128":{"position":[[57,4]]},"277":{"position":[[3272,4]]},"278":{"position":[[841,4]]},"279":{"position":[[57,4]]},"514":{"position":[[3104,4]]},"515":{"position":[[841,4]]},"516":{"position":[[57,4]]}},"keywords":{}}],["couldn't",{"_index":1634,"title":{},"content":{"97":{"position":[[53,8]]},"289":{"position":[[53,8]]},"501":{"position":[[53,8]]}},"keywords":{}}],["count",{"_index":3248,"title":{},"content":{"416":{"position":[[3451,5],[3917,5]]},"419":{"position":[[5030,5],[5496,5]]},"653":{"position":[[3451,5],[3917,5]]},"656":{"position":[[5030,5],[5496,5]]}},"keywords":{}}],["count(&mut",{"_index":1391,"title":{},"content":{"73":{"position":[[347,14]]},"237":{"position":[[347,14]]},"473":{"position":[[347,14]]}},"keywords":{}}],["count.__events_ces_vers",{"_index":1581,"title":{},"content":{"91":{"position":[[419,26]]},"283":{"position":[[419,26]]},"495":{"position":[[419,26]]}},"keywords":{}}],["count_ref_recursive(&mut",{"_index":1386,"title":{},"content":{"73":{"position":[[148,28]]},"237":{"position":[[148,28]]},"473":{"position":[[148,28]]}},"keywords":{}}],["counter",{"_index":1186,"title":{"99":{"position":[[16,8]]},"223":{"position":[[9,8]]},"291":{"position":[[16,8]]},"456":{"position":[[9,8]]},"503":{"position":[[16,8]]},"696":{"position":[[9,8]]}},"content":{"51":{"position":[[24,7],[304,8],[500,7],[564,7],[1386,7],[1495,7]]},"52":{"position":[[3259,7],[4839,8],[6696,7]]},"54":{"position":[[120,7]]},"73":{"position":[[49,8]]},"80":{"position":[[258,8]]},"99":{"position":[[200,8]]},"118":{"position":[[108,7]]},"120":{"position":[[364,7]]},"154":{"position":[[255,8]]},"223":{"position":[[188,7],[1278,7],[1313,8]]},"231":{"position":[[258,8]]},"237":{"position":[[49,8]]},"291":{"position":[[200,8]]},"299":{"position":[[108,7]]},"301":{"position":[[364,7]]},"339":{"position":[[255,8]]},"456":{"position":[[188,7],[1278,7],[1313,8]]},"462":{"position":[[258,8]]},"473":{"position":[[49,8]]},"503":{"position":[[200,8]]},"520":{"position":[[108,7]]},"522":{"position":[[364,7]]},"559":{"position":[[255,8]]},"696":{"position":[[188,7],[1278,7],[1313,8]]}},"keywords":{}}],["counter"",{"_index":1287,"title":{},"content":{"52":{"position":[[3360,13]]}},"keywords":{}}],["counter.get_valu",{"_index":1213,"title":{},"content":{"51":{"position":[[1438,21],[1568,21]]}},"keywords":{}}],["counter.incr",{"_index":1214,"title":{},"content":{"51":{"position":[[1532,20]]}},"keywords":{}}],["counter.r",{"_index":1192,"title":{},"content":{"51":{"position":[[350,10]]}},"keywords":{}}],["counter.wasm",{"_index":1278,"title":{},"content":{"52":{"position":[[2324,12]]}},"keywords":{}}],["counter_address",{"_index":1206,"title":{},"content":{"51":{"position":[[961,16]]}},"keywords":{}}],["counterdeployer::init(10",{"_index":1211,"title":{},"content":{"51":{"position":[[1396,26],[1505,26]]}},"keywords":{}}],["counterref::at(counter_address).incr",{"_index":1207,"title":{},"content":{"51":{"position":[[989,44]]}},"keywords":{}}],["coupl",{"_index":2281,"title":{},"content":{"187":{"position":[[24,6]]},"196":{"position":[[559,6]]},"364":{"position":[[24,6]]},"432":{"position":[[496,6]]},"580":{"position":[[24,6]]},"679":{"position":[[496,6]]}},"keywords":{}}],["cours",{"_index":856,"title":{},"content":{"33":{"position":[[38,7]]},"119":{"position":[[718,7],[1090,7]]},"300":{"position":[[718,7],[1090,7]]},"395":{"position":[[4046,7]]},"521":{"position":[[718,7],[1090,7]]},"632":{"position":[[4046,7]]}},"keywords":{}}],["crate",{"_index":819,"title":{},"content":{"32":{"position":[[222,5]]},"65":{"position":[[296,5]]},"88":{"position":[[64,5]]},"240":{"position":[[296,5]]},"250":{"position":[[64,5]]},"321":{"position":[[666,5]]},"441":{"position":[[4635,8]]},"465":{"position":[[296,5]]},"488":{"position":[[64,5]]},"539":{"position":[[666,5]]},"688":{"position":[[4635,8]]}},"keywords":{}}],["crate.add",{"_index":2805,"title":{},"content":{"265":{"position":[[266,9]]},"405":{"position":[[266,9]]},"642":{"position":[[266,9]]}},"keywords":{}}],["crate::erc20::errors::error",{"_index":2927,"title":{},"content":{"269":{"position":[[116,31]]},"384":{"position":[[116,28]]},"409":{"position":[[116,31]]},"626":{"position":[[116,28]]},"646":{"position":[[116,31]]}},"keywords":{}}],["crate::erc20::ev",{"_index":2928,"title":{},"content":{"269":{"position":[[152,24]]},"384":{"position":[[149,24]]},"409":{"position":[[152,24]]},"626":{"position":[[149,24]]},"646":{"position":[[152,24]]}},"keywords":{}}],["crate::features::testing::{testingcontracthostref",{"_index":2116,"title":{},"content":{"168":{"position":[[360,50]]},"348":{"position":[[360,50]]},"564":{"position":[[360,50]]}},"keywords":{}}],["crate::flipper::flipperhostref",{"_index":2000,"title":{},"content":{"148":{"position":[[40,31]]},"178":{"position":[[1046,31]]},"336":{"position":[[40,31]]},"369":{"position":[[1046,31]]},"553":{"position":[[40,31]]},"585":{"position":[[1046,31]]}},"keywords":{}}],["crate::modules::token",{"_index":1482,"title":{},"content":{"80":{"position":[[190,22]]},"231":{"position":[[190,22]]},"462":{"position":[[190,22]]}},"keywords":{}}],["crate::owned_token::ownedtoken",{"_index":1450,"title":{},"content":{"79":{"position":[[633,31]]},"230":{"position":[[650,31]]},"461":{"position":[[650,31]]}},"keywords":{}}],["crate::token::{error",{"_index":3438,"title":{},"content":{"440":{"position":[[4869,21]]},"687":{"position":[[4869,21]]}},"keywords":{}}],["crate::token::{ticketid",{"_index":3476,"title":{},"content":{"441":{"position":[[547,24]]},"688":{"position":[[547,24]]}},"keywords":{}}],["crate::{erc20::erc20",{"_index":1711,"title":{},"content":{"115":{"position":[[67,21],[1859,21]]},"246":{"position":[[111,21]]},"258":{"position":[[67,21],[1805,21]]},"445":{"position":[[111,21]]},"481":{"position":[[67,21],[1805,21]]},"672":{"position":[[111,21]]}},"keywords":{}}],["crates.io",{"_index":1769,"title":{},"content":{"117":{"position":[[1221,9]]},"131":{"position":[[595,10]]},"298":{"position":[[1221,9]]},"311":{"position":[[647,10]]},"519":{"position":[[1221,9]]},"528":{"position":[[647,10]]}},"keywords":{}}],["creat",{"_index":870,"title":{"175":{"position":[[0,8]]},"361":{"position":[[0,8]]},"577":{"position":[[0,8]]}},"content":{"38":{"position":[[434,8]]},"42":{"position":[[30,6],[296,6]]},"91":{"position":[[266,7]]},"92":{"position":[[102,7],[197,7]]},"94":{"position":[[546,7]]},"102":{"position":[[114,7]]},"117":{"position":[[22,6],[178,7],[330,7],[475,7],[719,7],[777,7],[1250,8],[1378,8],[1404,7]]},"118":{"position":[[23,6],[122,7]]},"119":{"position":[[648,7]]},"121":{"position":[[302,7]]},"122":{"position":[[90,7]]},"126":{"position":[[372,7]]},"129":{"position":[[199,6]]},"141":{"position":[[1336,7]]},"147":{"position":[[440,6],[616,6]]},"154":{"position":[[226,6]]},"162":{"position":[[2457,8]]},"175":{"position":[[3,6],[110,6],[191,6],[495,6]]},"195":{"position":[[270,6]]},"203":{"position":[[585,6]]},"207":{"position":[[63,6]]},"212":{"position":[[4220,6]]},"264":{"position":[[127,6]]},"277":{"position":[[372,7]]},"280":{"position":[[199,6]]},"283":{"position":[[266,7]]},"284":{"position":[[102,7],[197,7]]},"286":{"position":[[546,7]]},"294":{"position":[[114,7]]},"298":{"position":[[22,6],[178,7],[330,7],[475,7],[719,7],[777,7],[1250,8],[1378,8],[1404,7]]},"299":{"position":[[23,6],[122,7]]},"300":{"position":[[648,7]]},"302":{"position":[[302,7]]},"303":{"position":[[90,7]]},"321":{"position":[[795,8],[2198,7]]},"326":{"position":[[1336,7]]},"335":{"position":[[444,6],[620,6]]},"339":{"position":[[226,6]]},"351":{"position":[[2479,8]]},"361":{"position":[[3,6],[110,6],[191,6],[495,6]]},"391":{"position":[[4238,6]]},"393":{"position":[[391,8]]},"394":{"position":[[487,6]]},"395":{"position":[[174,6]]},"404":{"position":[[127,6]]},"414":{"position":[[15,8]]},"423":{"position":[[585,6]]},"427":{"position":[[63,6]]},"431":{"position":[[270,6]]},"439":{"position":[[0,8],[89,6]]},"441":{"position":[[417,6],[1997,6],[4480,6]]},"442":{"position":[[21,7]]},"495":{"position":[[266,7]]},"496":{"position":[[102,7],[197,7]]},"498":{"position":[[546,7]]},"506":{"position":[[114,7]]},"514":{"position":[[372,7]]},"517":{"position":[[199,6]]},"519":{"position":[[22,6],[178,7],[330,7],[475,7],[719,7],[777,7],[1250,8],[1378,8],[1404,7]]},"520":{"position":[[23,6],[122,7]]},"521":{"position":[[648,7]]},"523":{"position":[[302,7]]},"524":{"position":[[90,7]]},"535":{"position":[[1336,7]]},"539":{"position":[[795,8],[2198,7]]},"552":{"position":[[444,6],[620,6]]},"559":{"position":[[226,6]]},"567":{"position":[[2479,8]]},"577":{"position":[[3,6],[110,6],[191,6],[495,6]]},"596":{"position":[[580,6]]},"602":{"position":[[1737,6],[2018,7]]},"605":{"position":[[546,6]]},"630":{"position":[[391,8]]},"631":{"position":[[487,6]]},"632":{"position":[[174,6]]},"641":{"position":[[127,6]]},"651":{"position":[[15,8]]},"661":{"position":[[4238,6]]},"665":{"position":[[585,6]]},"669":{"position":[[63,6]]},"678":{"position":[[270,6]]},"686":{"position":[[0,8],[89,6]]},"688":{"position":[[417,6],[1997,6],[4480,6]]},"689":{"position":[[21,7]]},"704":{"position":[[580,6]]},"710":{"position":[[1737,6],[2018,7]]},"713":{"position":[[546,6]]}},"keywords":{}}],["create(&mut",{"_index":3734,"title":{},"content":{"602":{"position":[[1293,15]]},"710":{"position":[[1293,15]]}},"keywords":{}}],["creation",{"_index":3922,"title":{},"content":{"617":{"position":[[1000,9]]},"725":{"position":[[1000,9]]}},"keywords":{}}],["creativ",{"_index":636,"title":{},"content":{"21":{"position":[[315,10]]}},"keywords":{}}],["creator",{"_index":1490,"title":{},"content":{"80":{"position":[[573,8],[670,10],[757,8],[856,10]]},"168":{"position":[[766,7]]},"231":{"position":[[573,8],[670,10],[757,8],[856,10]]},"348":{"position":[[766,7]]},"395":{"position":[[337,8]]},"462":{"position":[[573,8],[670,10],[757,8],[856,10]]},"564":{"position":[[766,7]]},"632":{"position":[[337,8]]}},"keywords":{}}],["creator'",{"_index":3147,"title":{},"content":{"395":{"position":[[1673,9],[6663,9]]},"632":{"position":[[1673,9],[6663,9]]}},"keywords":{}}],["creator2",{"_index":2126,"title":{},"content":{"168":{"position":[[1026,8],[1089,10]]},"348":{"position":[[1026,8],[1089,10]]},"564":{"position":[[1026,8],[1089,10]]}},"keywords":{}}],["cross",{"_index":614,"title":{"140":{"position":[[0,5]]},"325":{"position":[[0,5]]},"534":{"position":[[0,5]]}},"content":{"20":{"position":[[971,5]]},"54":{"position":[[262,5]]},"128":{"position":[[555,5]]},"143":{"position":[[30,5]]},"279":{"position":[[555,5]]},"328":{"position":[[30,5]]},"442":{"position":[[202,5]]},"516":{"position":[[555,5]]},"537":{"position":[[30,5]]},"689":{"position":[[202,5]]}},"keywords":{}}],["cross_contract",{"_index":1970,"title":{},"content":{"143":{"position":[[490,14]]},"328":{"position":[[394,14]]},"537":{"position":[[394,14]]}},"keywords":{}}],["cross_increment(&mut",{"_index":1205,"title":{},"content":{"51":{"position":[[930,24]]}},"keywords":{}}],["crosscontracthostref::deploy",{"_index":3059,"title":{},"content":{"328":{"position":[[411,29]]},"537":{"position":[[411,29]]}},"keywords":{}}],["crosscontracthostref::deploy(&test_env",{"_index":1971,"title":{},"content":{"143":{"position":[[507,43]]}},"keywords":{}}],["crosscontractinitarg",{"_index":1962,"title":{},"content":{"143":{"position":[[160,22],[406,21]]},"328":{"position":[[160,22],[456,21]]},"537":{"position":[[160,22],[456,21]]}},"keywords":{}}],["crucial",{"_index":2317,"title":{},"content":{"195":{"position":[[193,7]]},"431":{"position":[[193,7]]},"678":{"position":[[193,7]]}},"keywords":{}}],["cspr",{"_index":373,"title":{"102":{"position":[[8,4]]},"294":{"position":[[8,4]]},"506":{"position":[[8,4]]}},"content":{"11":{"position":[[222,5]]},"94":{"position":[[526,5]]},"102":{"position":[[222,4],[277,4],[400,4]]},"103":{"position":[[503,4]]},"286":{"position":[[526,5]]},"294":{"position":[[222,4],[277,4],[400,4]]},"295":{"position":[[503,4]]},"346":{"position":[[84,4]]},"365":{"position":[[78,4]]},"394":{"position":[[60,5],[140,4]]},"397":{"position":[[111,5]]},"440":{"position":[[2940,5]]},"441":{"position":[[3435,5],[4200,4]]},"477":{"position":[[1410,6],[1955,5],[2129,5],[3910,5],[3971,5]]},"478":{"position":[[190,6]]},"498":{"position":[[526,5]]},"506":{"position":[[222,4],[277,4],[400,4]]},"507":{"position":[[503,4]]},"581":{"position":[[78,4]]},"608":{"position":[[734,6]]},"614":{"position":[[505,6]]},"631":{"position":[[60,5],[140,4]]},"634":{"position":[[111,5]]},"687":{"position":[[2940,5]]},"688":{"position":[[3435,5],[4200,4]]},"699":{"position":[[1410,6],[1955,5],[2129,5],[3910,5],[3971,5]]},"700":{"position":[[190,6]]},"716":{"position":[[734,6]]},"722":{"position":[[505,6]]}},"keywords":{}}],["cspr.cloud",{"_index":2954,"title":{},"content":{"277":{"position":[[1097,11],[1173,10]]}},"keywords":{}}],["cspr.live",{"_index":3188,"title":{"396":{"position":[[0,10]]},"633":{"position":[[0,10]]}},"content":{"396":{"position":[[501,9]]},"398":{"position":[[157,9],[226,9]]},"633":{"position":[[501,9]]},"635":{"position":[[157,9],[226,9]]}},"keywords":{}}],["cspr_cloud_auth_token",{"_index":2956,"title":{},"content":{"277":{"position":[[1144,22]]}},"keywords":{}}],["ctx",{"_index":974,"title":{},"content":{"39":{"position":[[2307,4],[2574,5],[2695,5],[2767,5],[2835,6],[2973,5],[3053,6]]}},"keywords":{}}],["cumbersom",{"_index":1615,"title":{},"content":{"94":{"position":[[67,10]]},"286":{"position":[[67,10]]},"498":{"position":[[67,10]]}},"keywords":{}}],["current",{"_index":663,"title":{},"content":{"22":{"position":[[1025,7]]},"52":{"position":[[6688,7]]},"78":{"position":[[163,7],[345,7]]},"95":{"position":[[412,7]]},"103":{"position":[[695,9]]},"107":{"position":[[361,7]]},"117":{"position":[[1429,8]]},"128":{"position":[[365,7]]},"147":{"position":[[1035,7],[1158,7]]},"168":{"position":[[1834,7]]},"178":{"position":[[622,7],[745,7]]},"184":{"position":[[932,7]]},"194":{"position":[[143,7],[186,7]]},"197":{"position":[[944,7],[1189,7]]},"229":{"position":[[163,7],[366,7]]},"245":{"position":[[120,7]]},"274":{"position":[[361,7]]},"279":{"position":[[365,7]]},"287":{"position":[[412,7]]},"295":{"position":[[695,9]]},"298":{"position":[[1429,8]]},"324":{"position":[[637,9],[1009,9]]},"335":{"position":[[1043,7],[1166,7]]},"348":{"position":[[1834,7]]},"369":{"position":[[622,7],[745,7]]},"375":{"position":[[851,7]]},"416":{"position":[[598,7]]},"419":{"position":[[969,7]]},"430":{"position":[[143,7],[186,7]]},"433":{"position":[[943,7],[1188,7]]},"444":{"position":[[120,7]]},"460":{"position":[[163,7],[366,7]]},"491":{"position":[[361,7]]},"499":{"position":[[412,7]]},"507":{"position":[[695,9]]},"516":{"position":[[365,7]]},"519":{"position":[[1429,8]]},"542":{"position":[[637,9],[1009,9]]},"552":{"position":[[1043,7],[1166,7]]},"564":{"position":[[1834,7]]},"585":{"position":[[622,7],[745,7]]},"591":{"position":[[851,7]]},"653":{"position":[[598,7]]},"656":{"position":[[969,7]]},"671":{"position":[[120,7]]},"677":{"position":[[143,7],[186,7]]},"680":{"position":[[943,7],[1188,7]]}},"keywords":{}}],["current'",{"_index":1063,"title":{},"content":{"42":{"position":[[1359,9]]}},"keywords":{}}],["current_bal",{"_index":2460,"title":{},"content":{"204":{"position":[[1528,15]]},"424":{"position":[[1478,15]]},"666":{"position":[[1478,15]]}},"keywords":{}}],["current_balance).unwrap_or_revert(&self.env",{"_index":2465,"title":{},"content":{"204":{"position":[[1677,51]]},"424":{"position":[[1627,51]]},"666":{"position":[[1627,51]]}},"keywords":{}}],["current_block_tim",{"_index":1357,"title":{},"content":{"71":{"position":[[192,19],[469,18]]},"235":{"position":[[192,19],[469,18]]},"471":{"position":[[192,19],[469,18]]},"476":{"position":[[785,19],[1064,18]]},"698":{"position":[[785,19],[1064,18]]}},"keywords":{}}],["current_msg",{"_index":495,"title":{},"content":{"17":{"position":[[1182,11],[1247,11]]}},"keywords":{}}],["current_own",{"_index":2356,"title":{},"content":{"197":{"position":[[323,13]]},"433":{"position":[[323,13]]},"680":{"position":[[323,13]]}},"keywords":{}}],["current_value(&self",{"_index":1485,"title":{},"content":{"80":{"position":[[368,24]]},"231":{"position":[[368,24]]},"462":{"position":[[368,24]]}},"keywords":{}}],["curv",{"_index":874,"title":{},"content":{"38":{"position":[[595,5]]},"594":{"position":[[609,6]]},"702":{"position":[[609,6]]}},"keywords":{}}],["custom",{"_index":1439,"title":{"165":{"position":[[0,6]]},"354":{"position":[[0,6]]},"570":{"position":[[0,6]]},"602":{"position":[[0,6]]},"710":{"position":[[0,6]]}},"content":{"79":{"position":[[226,6]]},"138":{"position":[[1242,6]]},"165":{"position":[[108,6]]},"209":{"position":[[97,6],[475,6],[512,6]]},"230":{"position":[[226,6]]},"318":{"position":[[1234,6]]},"324":{"position":[[529,6]]},"354":{"position":[[108,6],[498,6],[647,6]]},"365":{"position":[[91,6]]},"383":{"position":[[79,6],[195,6]]},"388":{"position":[[97,6],[465,6],[502,6]]},"461":{"position":[[226,6]]},"542":{"position":[[529,6]]},"544":{"position":[[1234,6]]},"570":{"position":[[108,6],[498,6],[647,6]]},"581":{"position":[[91,6]]},"599":{"position":[[393,6]]},"602":{"position":[[538,6],[1871,6]]},"610":{"position":[[650,6]]},"611":{"position":[[625,6]]},"625":{"position":[[79,6],[195,6]]},"658":{"position":[[97,6],[465,6],[502,6]]},"707":{"position":[[393,6]]},"710":{"position":[[538,6],[1871,6]]},"718":{"position":[[650,6]]},"719":{"position":[[625,6]]}},"keywords":{}}],["custom_item",{"_index":2578,"title":{},"content":{"210":{"position":[[275,11]]},"389":{"position":[[275,11]]},"659":{"position":[[275,11]]}},"keywords":{}}],["custom_item.r",{"_index":2550,"title":{},"content":{"209":{"position":[[376,14]]},"388":{"position":[[376,14]]},"658":{"position":[[376,14]]}},"keywords":{}}],["customerror",{"_index":3799,"title":{},"content":{"611":{"position":[[94,11]]},"719":{"position":[[94,11]]}},"keywords":{}}],["customitem",{"_index":2552,"title":{},"content":{"209":{"position":[[828,10],[944,10]]},"211":{"position":[[146,11]]},"388":{"position":[[760,10],[876,10]]},"390":{"position":[[146,11]]},"658":{"position":[[760,10],[876,10]]},"660":{"position":[[146,11]]}},"keywords":{}}],["cut",{"_index":38,"title":{},"content":{"1":{"position":[[413,7]]},"21":{"position":[[115,4]]}},"keywords":{}}],["d",{"_index":2573,"title":{},"content":{"210":{"position":[[128,1]]},"389":{"position":[[128,1]]},"477":{"position":[[137,1]]},"612":{"position":[[905,1],[977,1]]},"659":{"position":[[128,1]]},"699":{"position":[[137,1]]},"720":{"position":[[905,1],[977,1]]}},"keywords":{}}],["d26fcbd210..."",{"_index":1849,"title":{},"content":{"127":{"position":[[292,19]]},"278":{"position":[[292,19]]},"515":{"position":[[292,19]]}},"keywords":{}}],["d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"",{"_index":1828,"title":{},"content":{"126":{"position":[[2678,71]]},"142":{"position":[[339,71]]},"277":{"position":[[2846,71]]},"327":{"position":[[339,71]]},"514":{"position":[[2678,71]]},"536":{"position":[[339,71]]}},"keywords":{}}],["d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb"",{"_index":3647,"title":{},"content":{"598":{"position":[[854,71]]},"706":{"position":[[854,71]]}},"keywords":{}}],["danger",{"_index":1343,"title":{},"content":{"66":{"position":[[250,6]]},"241":{"position":[[250,6]]},"393":{"position":[[305,6]]},"466":{"position":[[250,6]]},"630":{"position":[[305,6]]}},"keywords":{}}],["dao",{"_index":593,"title":{},"content":{"20":{"position":[[520,3]]}},"keywords":{}}],["dapp",{"_index":646,"title":{},"content":{"22":{"position":[[258,4]]},"38":{"position":[[246,4]]},"50":{"position":[[51,5]]}},"keywords":{}}],["data",{"_index":796,"title":{"598":{"position":[[0,4]]},"603":{"position":[[0,4]]},"706":{"position":[[0,4]]},"711":{"position":[[0,4]]}},"content":{"31":{"position":[[2834,4],[3186,4],[3451,4]]},"52":{"position":[[6655,5]]},"76":{"position":[[288,4]]},"83":{"position":[[56,4],[199,4],[268,4],[516,4]]},"91":{"position":[[730,4]]},"146":{"position":[[539,4],[713,4]]},"147":{"position":[[1361,4]]},"162":{"position":[[88,4],[515,5],[1405,5],[1672,5],[1814,4],[1873,4],[1981,4],[2405,5]]},"163":{"position":[[40,4],[1154,4]]},"164":{"position":[[456,4]]},"202":{"position":[[135,5]]},"209":{"position":[[893,5],[1524,4]]},"211":{"position":[[268,5],[274,5]]},"212":{"position":[[1530,4],[2621,4],[2940,4],[3527,4],[3660,4]]},"227":{"position":[[288,4]]},"252":{"position":[[56,4],[199,4],[268,4],[516,4]]},"268":{"position":[[1921,4]]},"283":{"position":[[730,4]]},"321":{"position":[[1465,4],[1519,4],[1526,4],[1730,4]]},"323":{"position":[[2204,4]]},"334":{"position":[[543,4],[717,4]]},"335":{"position":[[1369,4]]},"351":{"position":[[88,4],[552,5],[1427,5],[1694,5],[1836,4],[1895,4],[2003,4],[2427,5]]},"352":{"position":[[40,4],[1176,4]]},"353":{"position":[[491,4]]},"388":{"position":[[825,5],[1456,4]]},"390":{"position":[[268,5],[274,5]]},"391":{"position":[[1530,4],[2621,4],[2952,4],[3545,4],[3678,4]]},"408":{"position":[[1921,4]]},"422":{"position":[[135,5]]},"458":{"position":[[288,4]]},"483":{"position":[[56,4],[199,4],[268,4],[516,4]]},"495":{"position":[[730,4]]},"539":{"position":[[1465,4],[1519,4],[1526,4],[1730,4]]},"541":{"position":[[2204,4]]},"551":{"position":[[543,4],[717,4]]},"552":{"position":[[1369,4]]},"567":{"position":[[88,4],[552,5],[1427,5],[1694,5],[1836,4],[1895,4],[2003,4],[2427,5]]},"568":{"position":[[40,4],[1176,4]]},"569":{"position":[[491,4]]},"601":{"position":[[1911,4],[2257,5]]},"603":{"position":[[13,4],[77,4],[124,4],[184,4],[306,4]]},"614":{"position":[[171,5],[255,4]]},"616":{"position":[[299,4],[1245,5]]},"645":{"position":[[1921,4]]},"658":{"position":[[825,5],[1456,4]]},"660":{"position":[[268,5],[274,5]]},"661":{"position":[[1530,4],[2621,4],[2952,4],[3545,4],[3678,4]]},"664":{"position":[[135,5]]},"709":{"position":[[1911,4],[2257,5]]},"711":{"position":[[13,4],[77,4],[124,4],[184,4],[306,4]]},"722":{"position":[[171,5],[255,4]]},"724":{"position":[[299,4],[1245,5]]}},"keywords":{}}],["data.__events_length",{"_index":1580,"title":{},"content":{"91":{"position":[[386,20]]},"283":{"position":[[386,20]]},"495":{"position":[[386,20]]}},"keywords":{}}],["data.extend(addr.to_bytes().unwrap_or_revert(&env",{"_index":3864,"title":{},"content":{"616":{"position":[[431,56]]},"724":{"position":[[431,56]]}},"keywords":{}}],["data.extend(num.to_bytes().unwrap_or_revert(&env",{"_index":3863,"title":{},"content":{"616":{"position":[[375,55]]},"724":{"position":[[375,55]]}},"keywords":{}}],["data.extend(text.to_bytes().unwrap_or_revert(&env",{"_index":3862,"title":{},"content":{"616":{"position":[[318,56]]},"724":{"position":[[318,56]]}},"keywords":{}}],["data.hash",{"_index":2606,"title":{},"content":{"211":{"position":[[662,9]]},"390":{"position":[[636,9]]},"660":{"position":[[636,9]]}},"keywords":{}}],["davinci",{"_index":427,"title":{"16":{"position":[[0,7]]}},"content":{"16":{"position":[[152,7]]}},"keywords":{}}],["day",{"_index":868,"title":{},"content":{"38":{"position":[[406,3]]}},"keywords":{}}],["dbg!(runtime.block_on(metadata",{"_index":2660,"title":{},"content":{"212":{"position":[[3289,35]]},"391":{"position":[[3307,35]]},"661":{"position":[[3307,35]]}},"keywords":{}}],["dbg!(runtime.block_on(named_value("alice"",{"_index":2662,"title":{},"content":{"212":{"position":[[3358,55]]},"391":{"position":[[3376,55]]},"661":{"position":[[3376,55]]}},"keywords":{}}],["dbg!(runtime.block_on(named_value("bob"",{"_index":2663,"title":{},"content":{"212":{"position":[[3414,53]]},"391":{"position":[[3432,53]]},"661":{"position":[[3432,53]]}},"keywords":{}}],["dbg!(runtime.block_on(valu",{"_index":2661,"title":{},"content":{"212":{"position":[[3325,32]]},"391":{"position":[[3343,32]]},"661":{"position":[[3343,32]]}},"keywords":{}}],["deadlin",{"_index":41,"title":{},"content":{"1":{"position":[[481,10]]}},"keywords":{}}],["debug",{"_index":966,"title":{},"content":{"39":{"position":[[1976,7]]},"68":{"position":[[46,5]]},"184":{"position":[[303,7],[427,7],[551,7]]},"196":{"position":[[422,6],[1517,6]]},"204":{"position":[[879,7]]},"205":{"position":[[2087,7]]},"209":{"position":[[543,6],[676,6]]},"219":{"position":[[414,7],[496,7]]},"243":{"position":[[46,5]]},"267":{"position":[[1579,7]]},"269":{"position":[[3382,7],[3526,7]]},"407":{"position":[[1579,7]]},"409":{"position":[[3382,7],[3526,7]]},"468":{"position":[[46,5]]},"644":{"position":[[1579,7]]},"646":{"position":[[3382,7],[3526,7]]}},"keywords":{}}],["debugg",{"_index":1781,"title":{},"content":{"119":{"position":[[615,9]]},"300":{"position":[[615,9]]},"521":{"position":[[615,9]]}},"keywords":{}}],["decim",{"_index":514,"title":{},"content":{"17":{"position":[[2036,9],[2293,9]]},"115":{"position":[[390,9],[523,9],[2233,9],[2386,9]]},"126":{"position":[[1978,8],[2370,9]]},"203":{"position":[[152,9]]},"204":{"position":[[120,9]]},"206":{"position":[[213,9],[454,9],[464,9],[793,10]]},"247":{"position":[[155,9],[288,9]]},"258":{"position":[[380,9],[513,9],[2179,9],[2332,9]]},"268":{"position":[[1266,9],[1276,9]]},"269":{"position":[[320,9],[609,9],[4117,9],[4358,9],[4368,9],[4703,10]]},"277":{"position":[[2146,8],[2538,9]]},"384":{"position":[[333,9],[622,9]]},"395":{"position":[[1927,8],[2030,9]]},"408":{"position":[[1266,9],[1276,9]]},"409":{"position":[[320,9],[609,9],[4117,9],[4358,9],[4368,9],[4703,10]]},"417":{"position":[[292,9]]},"419":{"position":[[1420,9],[1577,9],[2480,8],[6707,9]]},"423":{"position":[[152,9]]},"424":{"position":[[95,9]]},"426":{"position":[[213,9],[454,9],[464,9],[793,10]]},"446":{"position":[[155,9],[288,9]]},"481":{"position":[[380,9],[513,9],[2179,9],[2332,9]]},"514":{"position":[[1978,8],[2370,9]]},"626":{"position":[[333,9],[622,9]]},"632":{"position":[[1927,8],[2030,9]]},"645":{"position":[[1266,9],[1276,9]]},"646":{"position":[[320,9],[609,9],[4117,9],[4358,9],[4368,9],[4703,10]]},"654":{"position":[[292,9]]},"656":{"position":[[1420,9],[1577,9],[2480,8],[6707,9]]},"665":{"position":[[152,9]]},"666":{"position":[[95,9]]},"668":{"position":[[213,9],[454,9],[464,9],[793,10]]},"673":{"position":[[155,9],[288,9]]}},"keywords":{}}],["decimals(&self",{"_index":1725,"title":{},"content":{"115":{"position":[[879,19]]},"204":{"position":[[459,19]]},"247":{"position":[[444,19]]},"258":{"position":[[845,19]]},"419":{"position":[[2508,19]]},"424":{"position":[[434,19]]},"446":{"position":[[444,19]]},"481":{"position":[[845,19]]},"656":{"position":[[2508,19]]},"666":{"position":[[434,19]]},"673":{"position":[[444,19]]}},"keywords":{}}],["decimals.tot",{"_index":2434,"title":{},"content":{"202":{"position":[[180,14]]},"422":{"position":[[180,14]]},"664":{"position":[[180,14]]}},"keywords":{}}],["decimalsnotset",{"_index":2841,"title":{},"content":{"267":{"position":[[1437,14]]},"269":{"position":[[3800,14]]},"383":{"position":[[883,14]]},"384":{"position":[[3764,14]]},"407":{"position":[[1437,14]]},"409":{"position":[[3800,14]]},"625":{"position":[[883,14]]},"626":{"position":[[3764,14]]},"644":{"position":[[1437,14]]},"646":{"position":[[3800,14]]}},"keywords":{}}],["declar",{"_index":3682,"title":{},"content":{"600":{"position":[[781,9]]},"607":{"position":[[38,7],[111,8]]},"613":{"position":[[1287,7]]},"708":{"position":[[781,9]]},"715":{"position":[[38,7],[111,8]]},"721":{"position":[[1287,7]]}},"keywords":{}}],["decr_bi",{"_index":3311,"title":{},"content":{"419":{"position":[[3162,8]]},"656":{"position":[[3162,8]]}},"keywords":{}}],["decreas",{"_index":3309,"title":{},"content":{"419":{"position":[[3042,9]]},"656":{"position":[[3042,9]]}},"keywords":{}}],["decrease_allowance(&mut",{"_index":3310,"title":{},"content":{"419":{"position":[[3105,27]]},"656":{"position":[[3105,27]]}},"keywords":{}}],["decrement",{"_index":2539,"title":{},"content":{"206":{"position":[[2830,12]]},"426":{"position":[[2815,12]]},"606":{"position":[[791,9]]},"668":{"position":[[2830,12]]},"714":{"position":[[791,9]]}},"keywords":{}}],["decrement(&mut",{"_index":3757,"title":{},"content":{"606":{"position":[[167,18]]},"714":{"position":[[167,18]]}},"keywords":{}}],["dedic",{"_index":579,"title":{},"content":{"20":{"position":[[181,9]]}},"keywords":{}}],["deduct",{"_index":2515,"title":{},"content":{"206":{"position":[[1374,9]]},"269":{"position":[[5284,9]]},"409":{"position":[[5284,9]]},"426":{"position":[[1369,9]]},"646":{"position":[[5284,9]]},"668":{"position":[[1374,9]]}},"keywords":{}}],["default",{"_index":901,"title":{},"content":{"39":{"position":[[174,8]]},"40":{"position":[[251,7]]},"88":{"position":[[7,7],[126,7]]},"95":{"position":[[318,7]]},"106":{"position":[[18,7]]},"117":{"position":[[540,7],[812,8]]},"131":{"position":[[527,8]]},"155":{"position":[[88,7]]},"165":{"position":[[3,7]]},"168":{"position":[[1986,8]]},"178":{"position":[[923,7]]},"185":{"position":[[2532,7],[3883,7]]},"197":{"position":[[1593,7]]},"198":{"position":[[2139,7],[3200,7],[3408,7]]},"221":{"position":[[646,7]]},"250":{"position":[[7,7],[126,7]]},"265":{"position":[[130,7]]},"273":{"position":[[18,7]]},"287":{"position":[[318,7]]},"298":{"position":[[540,7],[812,8]]},"311":{"position":[[579,8]]},"321":{"position":[[546,7],[636,7]]},"324":{"position":[[274,7],[397,10]]},"340":{"position":[[88,7]]},"348":{"position":[[1986,8]]},"354":{"position":[[3,7]]},"369":{"position":[[923,7]]},"376":{"position":[[2516,7],[3867,7]]},"395":{"position":[[2708,7],[2796,7],[2975,7],[3082,7],[3120,7]]},"405":{"position":[[130,7]]},"415":{"position":[[181,8]]},"433":{"position":[[1592,7]]},"434":{"position":[[2129,7],[3182,7],[3390,7]]},"454":{"position":[[646,7]]},"477":{"position":[[874,7],[1033,7]]},"488":{"position":[[7,7],[126,7]]},"490":{"position":[[18,7]]},"499":{"position":[[318,7]]},"519":{"position":[[540,7],[812,8]]},"528":{"position":[[579,8]]},"539":{"position":[[546,7],[636,7]]},"542":{"position":[[274,7],[397,10]]},"560":{"position":[[88,7]]},"564":{"position":[[1986,8]]},"570":{"position":[[3,7]]},"585":{"position":[[923,7]]},"592":{"position":[[2516,7],[3867,7]]},"596":{"position":[[1226,8]]},"598":{"position":[[1092,7],[1443,7]]},"602":{"position":[[98,10],[623,7],[657,10],[698,7],[1755,7]]},"605":{"position":[[368,8]]},"632":{"position":[[2708,7],[2796,7],[2975,7],[3082,7],[3120,7]]},"642":{"position":[[130,7]]},"652":{"position":[[181,8]]},"680":{"position":[[1592,7]]},"681":{"position":[[2139,7],[3200,7],[3408,7]]},"694":{"position":[[646,7]]},"699":{"position":[[874,7],[1033,7]]},"704":{"position":[[1226,8]]},"706":{"position":[[1092,7],[1443,7]]},"710":{"position":[[98,10],[623,7],[657,10],[698,7],[1755,7]]},"713":{"position":[[368,8]]}},"keywords":{}}],["default/no",{"_index":3777,"title":{},"content":{"607":{"position":[[286,11]]},"715":{"position":[[286,11]]}},"keywords":{}}],["default/zero",{"_index":3663,"title":{},"content":{"598":{"position":[[1858,12]]},"706":{"position":[[1858,12]]}},"keywords":{}}],["default::default",{"_index":752,"title":{},"content":{"31":{"position":[[1087,19],[1123,19],[1160,19],[1198,19],[1235,19]]},"602":{"position":[[903,18]]},"710":{"position":[[903,18]]}},"keywords":{}}],["default_addr",{"_index":3639,"title":{},"content":{"598":{"position":[[608,13]]},"706":{"position":[[608,13]]}},"keywords":{}}],["default_admin_rol",{"_index":2211,"title":{},"content":{"185":{"position":[[265,19],[811,18]]},"376":{"position":[[249,19],[795,18]]},"592":{"position":[[249,19],[795,18]]}},"keywords":{}}],["default_boo",{"_index":3636,"title":{},"content":{"598":{"position":[[518,12]]},"706":{"position":[[518,12]]}},"keywords":{}}],["default_int",{"_index":3638,"title":{},"content":{"598":{"position":[[579,12]]},"706":{"position":[[579,12]]}},"keywords":{}}],["default_uint",{"_index":3637,"title":{},"content":{"598":{"position":[[548,13]]},"706":{"position":[[548,13]]}},"keywords":{}}],["defi",{"_index":592,"title":{},"content":{"20":{"position":[[511,4]]}},"keywords":{}}],["defin",{"_index":739,"title":{"195":{"position":[[0,6]]},"431":{"position":[[0,6]]},"678":{"position":[[0,6]]}},"content":{"31":{"position":[[906,6]]},"39":{"position":[[1396,7],[1477,8]]},"42":{"position":[[335,6],[1417,6]]},"84":{"position":[[752,7]]},"91":{"position":[[803,7]]},"93":{"position":[[165,8]]},"102":{"position":[[0,8]]},"141":{"position":[[1010,7],[1106,7]]},"146":{"position":[[640,7]]},"147":{"position":[[681,7]]},"163":{"position":[[68,6]]},"194":{"position":[[29,6]]},"195":{"position":[[575,7],[606,6]]},"196":{"position":[[924,7],[1422,6]]},"197":{"position":[[1101,7]]},"198":{"position":[[1231,7],[1494,7],[2173,6]]},"199":{"position":[[60,7]]},"204":{"position":[[1059,7]]},"218":{"position":[[30,8]]},"219":{"position":[[75,6]]},"246":{"position":[[6,6],[405,7]]},"253":{"position":[[752,7]]},"283":{"position":[[803,7]]},"285":{"position":[[165,8]]},"294":{"position":[[0,8]]},"324":{"position":[[554,7],[741,7],[1311,7]]},"326":{"position":[[1010,7],[1106,7]]},"334":{"position":[[644,7]]},"335":{"position":[[689,7]]},"352":{"position":[[68,6]]},"383":{"position":[[70,8]]},"424":{"position":[[1010,7]]},"430":{"position":[[29,6]]},"431":{"position":[[575,7],[606,6]]},"432":{"position":[[862,7],[1364,6]]},"433":{"position":[[1100,7]]},"434":{"position":[[1221,7],[1484,7],[2163,6]]},"435":{"position":[[60,7]]},"440":{"position":[[3330,6]]},"441":{"position":[[1607,6],[1664,6]]},"445":{"position":[[6,6],[405,7]]},"451":{"position":[[30,8]]},"452":{"position":[[75,6]]},"484":{"position":[[752,7]]},"495":{"position":[[803,7]]},"497":{"position":[[165,8]]},"506":{"position":[[0,8]]},"535":{"position":[[1010,7],[1106,7]]},"542":{"position":[[554,7],[741,7],[1311,7]]},"551":{"position":[[644,7]]},"552":{"position":[[689,7]]},"568":{"position":[[68,6]]},"596":{"position":[[541,6],[744,7],[1092,6]]},"599":{"position":[[293,6]]},"602":{"position":[[555,7],[1890,7],[1964,6]]},"603":{"position":[[216,8]]},"604":{"position":[[15,6]]},"605":{"position":[[612,6]]},"606":{"position":[[620,6]]},"607":{"position":[[348,7]]},"608":{"position":[[638,6],[785,6]]},"610":{"position":[[521,7]]},"611":{"position":[[842,6]]},"612":{"position":[[1950,7]]},"613":{"position":[[1794,7],[2020,8]]},"614":{"position":[[409,6]]},"625":{"position":[[70,8]]},"666":{"position":[[1010,7]]},"672":{"position":[[6,6],[405,7]]},"677":{"position":[[29,6]]},"678":{"position":[[575,7],[606,6]]},"679":{"position":[[862,7],[1364,6]]},"680":{"position":[[1100,7]]},"681":{"position":[[1231,7],[1494,7],[2173,6]]},"682":{"position":[[60,7]]},"687":{"position":[[3330,6]]},"688":{"position":[[1607,6],[1664,6]]},"691":{"position":[[30,8]]},"692":{"position":[[75,6]]},"704":{"position":[[541,6],[744,7],[1092,6]]},"707":{"position":[[293,6]]},"710":{"position":[[555,7],[1890,7],[1964,6]]},"711":{"position":[[216,8]]},"712":{"position":[[15,6]]},"713":{"position":[[612,6]]},"714":{"position":[[620,6]]},"715":{"position":[[348,7]]},"716":{"position":[[638,6],[785,6]]},"718":{"position":[[521,7]]},"719":{"position":[[842,6]]},"720":{"position":[[1950,7]]},"721":{"position":[[1794,7],[2020,8]]},"722":{"position":[[409,6]]}},"keywords":{}}],["definit",{"_index":318,"title":{"203":{"position":[[7,11]]},"220":{"position":[[7,11]]},"246":{"position":[[7,11]]},"423":{"position":[[7,11]]},"445":{"position":[[7,11]]},"453":{"position":[[7,11]]},"665":{"position":[[7,11]]},"672":{"position":[[7,11]]},"693":{"position":[[7,11]]}},"content":{"10":{"position":[[82,10]]},"84":{"position":[[110,10],[186,11]]},"146":{"position":[[24,11],[446,10]]},"178":{"position":[[39,11]]},"184":{"position":[[1093,10]]},"185":{"position":[[64,10]]},"219":{"position":[[118,10]]},"246":{"position":[[354,10]]},"253":{"position":[[110,10],[186,11]]},"267":{"position":[[1179,13],[1485,13],[3537,10],[4348,12]]},"321":{"position":[[338,10]]},"334":{"position":[[24,11],[450,10]]},"369":{"position":[[39,11]]},"375":{"position":[[990,10]]},"376":{"position":[[64,10]]},"383":{"position":[[208,13],[458,13],[931,13]]},"407":{"position":[[1179,13],[1485,13],[3537,10],[4348,12]]},"419":{"position":[[654,11]]},"440":{"position":[[3810,11]]},"445":{"position":[[354,10]]},"452":{"position":[[118,10]]},"484":{"position":[[110,10],[186,11]]},"539":{"position":[[338,10]]},"551":{"position":[[24,11],[450,10]]},"585":{"position":[[39,11]]},"591":{"position":[[990,10]]},"592":{"position":[[64,10]]},"600":{"position":[[958,11]]},"625":{"position":[[208,13],[458,13],[931,13]]},"644":{"position":[[1179,13],[1485,13],[3537,10],[4348,12]]},"656":{"position":[[654,11]]},"672":{"position":[[354,10]]},"687":{"position":[[3810,11]]},"692":{"position":[[118,10]]},"708":{"position":[[958,11]]}},"keywords":{}}],["defiplatform",{"_index":1740,"title":{},"content":{"115":{"position":[[2021,12],[2161,12],[2970,12]]},"258":{"position":[[1967,12],[2107,12],[2896,12]]},"481":{"position":[[1967,12],[2107,12],[2896,12]]}},"keywords":{}}],["deleg",{"_index":1706,"title":{"113":{"position":[[0,8]]},"247":{"position":[[0,11]]},"256":{"position":[[0,8]]},"446":{"position":[[0,11]]},"479":{"position":[[0,8]]},"673":{"position":[[0,11]]}},"content":{"114":{"position":[[15,8],[58,9],[148,8],[192,9],[274,8]]},"115":{"position":[[552,9],[1431,8],[1486,9],[1723,10],[2450,9],[3045,10]]},"247":{"position":[[1747,8]]},"257":{"position":[[15,8],[58,9],[148,8],[192,9],[274,8]]},"258":{"position":[[542,9],[1377,8],[1432,9],[1669,10],[2396,9],[2971,10]]},"414":{"position":[[285,8],[339,9],[495,9]]},"419":{"position":[[1631,8],[1684,9]]},"446":{"position":[[1747,8]]},"480":{"position":[[15,8],[58,9],[148,8],[192,9],[274,8]]},"481":{"position":[[542,9],[1377,8],[1432,9],[1669,10],[2396,9],[2971,10]]},"651":{"position":[[285,8],[339,9],[495,9]]},"656":{"position":[[1631,8],[1684,9]]},"673":{"position":[[1747,8]]}},"keywords":{}}],["delet",{"_index":3729,"title":{},"content":{"602":{"position":[[861,8]]},"710":{"position":[[861,8]]}},"keywords":{}}],["delv",{"_index":1412,"title":{},"content":{"76":{"position":[[10,5]]},"227":{"position":[[10,5]]},"458":{"position":[[10,5]]},"594":{"position":[[424,5]]},"702":{"position":[[424,5]]}},"keywords":{}}],["demand",{"_index":2958,"title":{},"content":{"277":{"position":[[1247,7]]}},"keywords":{}}],["demonstr",{"_index":322,"title":{},"content":{"10":{"position":[[184,14]]},"84":{"position":[[504,12]]},"85":{"position":[[821,12]]},"253":{"position":[[504,12]]},"254":{"position":[[821,12]]},"442":{"position":[[93,12]]},"484":{"position":[[504,12]]},"485":{"position":[[821,12]]},"596":{"position":[[95,12]]},"689":{"position":[[93,12]]},"704":{"position":[[95,12]]}},"keywords":{}}],["denot",{"_index":3049,"title":{},"content":{"324":{"position":[[360,7]]},"542":{"position":[[360,7]]}},"keywords":{}}],["depend",{"_index":1035,"title":{},"content":{"42":{"position":[[443,13]]},"88":{"position":[[198,10],[226,14]]},"117":{"position":[[887,11]]},"131":{"position":[[135,14],[180,13],[661,11]]},"250":{"position":[[198,10],[226,14]]},"265":{"position":[[230,12],[537,14],[582,13]]},"267":{"position":[[119,6]]},"268":{"position":[[116,6]]},"298":{"position":[[887,11]]},"311":{"position":[[135,14],[180,13],[231,13],[713,11]]},"395":{"position":[[2448,11],[2640,14],[2903,13],[3009,13]]},"405":{"position":[[230,12],[537,14],[582,13]]},"407":{"position":[[119,6]]},"408":{"position":[[116,6]]},"477":{"position":[[822,14],[913,12]]},"488":{"position":[[198,10],[226,14]]},"519":{"position":[[887,11]]},"528":{"position":[[135,14],[180,13],[231,13],[713,11]]},"632":{"position":[[2448,11],[2640,14],[2903,13],[3009,13]]},"642":{"position":[[230,12],[537,14],[582,13]]},"644":{"position":[[119,6]]},"645":{"position":[[116,6]]},"699":{"position":[[822,14],[913,12]]}},"keywords":{}}],["dependency.regist",{"_index":2803,"title":{},"content":{"265":{"position":[[166,19]]},"405":{"position":[[166,19]]},"642":{"position":[[166,19]]}},"keywords":{}}],["deploy",{"_index":364,"title":{"52":{"position":[[0,7]]},"97":{"position":[[0,9]]},"99":{"position":[[9,6]]},"100":{"position":[[9,6]]},"101":{"position":[[9,6]]},"208":{"position":[[7,6]]},"210":{"position":[[0,9]]},"289":{"position":[[0,9]]},"291":{"position":[[9,6]]},"292":{"position":[[9,6]]},"293":{"position":[[9,6]]},"387":{"position":[[7,6]]},"389":{"position":[[0,9]]},"392":{"position":[[0,9]]},"501":{"position":[[0,9]]},"503":{"position":[[9,6]]},"504":{"position":[[9,6]]},"505":{"position":[[9,6]]},"629":{"position":[[0,9]]},"657":{"position":[[7,6]]},"659":{"position":[[0,9]]}},"content":{"11":{"position":[[7,8]]},"43":{"position":[[650,10],[889,6],[931,6],[1698,6]]},"51":{"position":[[1371,8]]},"95":{"position":[[62,6]]},"97":{"position":[[62,6]]},"98":{"position":[[5,9],[455,8]]},"99":{"position":[[3,6],[227,6]]},"100":{"position":[[282,6],[321,6],[908,8]]},"101":{"position":[[145,11],[175,6]]},"107":{"position":[[117,8]]},"108":{"position":[[201,9]]},"111":{"position":[[237,9]]},"115":{"position":[[432,8],[2295,8]]},"119":{"position":[[467,7]]},"126":{"position":[[491,6],[712,6],[1145,6],[1213,7],[2257,6],[2889,9],[3127,11]]},"127":{"position":[[464,6],[639,10],[899,10]]},"128":{"position":[[737,6],[760,8]]},"136":{"position":[[109,6]]},"141":{"position":[[87,8],[809,8],[1436,8]]},"142":{"position":[[35,8],[64,9],[222,9]]},"143":{"position":[[695,9],[744,6]]},"148":{"position":[[191,6],[247,10],[285,6],[528,9],[771,6],[904,8]]},"168":{"position":[[155,8],[1227,9],[1355,9]]},"178":{"position":[[1197,6],[1253,10],[1291,6]]},"196":{"position":[[745,6]]},"198":{"position":[[2568,6]]},"199":{"position":[[101,8]]},"206":{"position":[[558,6]]},"210":{"position":[[301,6],[369,6],[1143,6]]},"247":{"position":[[197,8]]},"258":{"position":[[422,8],[2241,8]]},"268":{"position":[[245,12],[270,6],[671,6],[805,6]]},"269":{"position":[[4468,6]]},"274":{"position":[[117,8]]},"275":{"position":[[205,9]]},"277":{"position":[[491,6],[712,6],[1313,6],[1381,7],[2425,6],[3057,9],[3295,11]]},"278":{"position":[[464,6],[639,10],[899,10]]},"279":{"position":[[737,6],[760,8]]},"287":{"position":[[62,6]]},"289":{"position":[[62,6]]},"290":{"position":[[5,9],[455,8]]},"291":{"position":[[3,6],[227,6]]},"292":{"position":[[282,6],[321,6],[908,8]]},"293":{"position":[[145,11],[175,6]]},"300":{"position":[[467,7]]},"306":{"position":[[237,9]]},"316":{"position":[[109,6]]},"324":{"position":[[1445,11]]},"326":{"position":[[87,8],[809,8],[1436,8]]},"327":{"position":[[35,8],[64,9],[222,9]]},"328":{"position":[[670,9],[719,6]]},"336":{"position":[[191,6],[247,10],[285,6],[528,9],[771,6],[904,8]]},"348":{"position":[[155,8],[1227,9],[1355,9]]},"369":{"position":[[1197,6],[1253,10],[1291,6]]},"389":{"position":[[301,6],[369,6],[1080,6]]},"393":{"position":[[498,6]]},"394":{"position":[[3,6],[560,6]]},"395":{"position":[[240,7],[647,8],[904,6],[1746,7],[3735,6],[3888,6],[4570,9],[4879,6],[5087,9],[5546,6],[6005,6],[6525,6],[6726,8]]},"396":{"position":[[162,8],[1199,8]]},"397":{"position":[[157,8],[189,8]]},"398":{"position":[[19,8]]},"408":{"position":[[245,12],[270,6],[671,6],[805,6]]},"409":{"position":[[4468,6]]},"417":{"position":[[415,9],[1355,8],[1792,9]]},"418":{"position":[[35,9]]},"419":{"position":[[6830,9],[7770,8]]},"426":{"position":[[558,6]]},"432":{"position":[[682,6]]},"434":{"position":[[2558,6]]},"435":{"position":[[101,8]]},"440":{"position":[[4628,6]]},"446":{"position":[[197,8]]},"477":{"position":[[1309,7],[2578,9],[2795,6],[3003,9],[3278,6],[3659,6],[3830,9],[3994,6]]},"478":{"position":[[98,8]]},"481":{"position":[[422,8],[2241,8]]},"491":{"position":[[117,8]]},"492":{"position":[[205,9]]},"499":{"position":[[62,6]]},"501":{"position":[[62,6]]},"502":{"position":[[5,9],[455,8]]},"503":{"position":[[3,6],[227,6]]},"504":{"position":[[282,6],[321,6],[908,8]]},"505":{"position":[[145,11],[175,6]]},"511":{"position":[[237,9]]},"514":{"position":[[491,6],[712,6],[1145,6],[1213,7],[2257,6],[2889,9],[3127,11]]},"515":{"position":[[464,6],[639,10],[899,10]]},"516":{"position":[[737,6],[760,8]]},"521":{"position":[[467,7]]},"533":{"position":[[109,6]]},"535":{"position":[[87,8],[809,8],[1436,8]]},"536":{"position":[[35,8],[64,9],[222,9]]},"537":{"position":[[670,9],[719,6]]},"542":{"position":[[1445,11]]},"553":{"position":[[191,6],[247,10],[285,6],[528,9],[771,6],[904,8]]},"564":{"position":[[155,8],[1227,9],[1355,9]]},"585":{"position":[[1197,6],[1253,10],[1291,6]]},"630":{"position":[[498,6]]},"631":{"position":[[3,6],[560,6]]},"632":{"position":[[240,7],[647,8],[904,6],[1746,7],[3735,6],[3888,6],[4570,9],[4879,6],[5087,9],[5546,6],[6005,6],[6525,6],[6726,8]]},"633":{"position":[[162,8],[1199,8]]},"634":{"position":[[157,8],[189,8]]},"635":{"position":[[19,8]]},"645":{"position":[[245,12],[270,6],[671,6],[805,6]]},"646":{"position":[[4468,6]]},"654":{"position":[[415,9],[1355,8],[1792,9]]},"655":{"position":[[35,9]]},"656":{"position":[[6830,9],[7770,8]]},"659":{"position":[[301,6],[369,6],[1080,6]]},"668":{"position":[[558,6]]},"673":{"position":[[197,8]]},"679":{"position":[[682,6]]},"681":{"position":[[2568,6]]},"682":{"position":[[101,8]]},"687":{"position":[[4628,6]]},"699":{"position":[[1309,7],[2578,9],[2795,6],[3003,9],[3278,6],[3659,6],[3830,9],[3994,6]]},"700":{"position":[[98,8]]}},"keywords":{}}],["deploy_our_token(&env",{"_index":3128,"title":{},"content":{"395":{"position":[[941,27]]},"632":{"position":[[941,27]]}},"keywords":{}}],["deploy_our_token(env",{"_index":3149,"title":{},"content":{"395":{"position":[[1773,21]]},"632":{"position":[[1773,21]]}},"keywords":{}}],["deployed_contract_hash",{"_index":2593,"title":{},"content":{"210":{"position":[[1302,24]]},"389":{"position":[[1239,24]]},"659":{"position":[[1239,24]]}},"keywords":{}}],["deployer.th",{"_index":1188,"title":{},"content":{"51":{"position":[[173,12]]}},"keywords":{}}],["deployer::deploy",{"_index":2008,"title":{},"content":{"148":{"position":[[557,16]]},"336":{"position":[[557,16]]},"553":{"position":[[557,16]]}},"keywords":{}}],["deposit",{"_index":1407,"title":{},"content":{"74":{"position":[[182,9],[260,9]]},"238":{"position":[[182,9],[260,9]]},"474":{"position":[[182,9],[260,9]]},"476":{"position":[[225,9],[584,8],[1709,7],[1750,7]]},"477":{"position":[[1383,8],[1622,8],[2021,11],[3855,9]]},"478":{"position":[[136,9]]},"698":{"position":[[225,9],[584,8],[1709,7],[1750,7]]},"699":{"position":[[1383,8],[1622,8],[2021,11],[3855,9]]},"700":{"position":[[136,9]]}},"keywords":{}}],["deposit(&mut",{"_index":1354,"title":{},"content":{"71":{"position":[[54,16]]},"235":{"position":[[54,16]]},"471":{"position":[[54,16]]},"476":{"position":[[647,16]]},"698":{"position":[[647,16]]}},"keywords":{}}],["deposit(&self",{"_index":3780,"title":{},"content":{"608":{"position":[[276,18]]},"716":{"position":[[276,18]]}},"keywords":{}}],["depth",{"_index":1654,"title":{},"content":{"99":{"position":[[688,5]]},"291":{"position":[[688,5]]},"503":{"position":[[688,5]]}},"keywords":{}}],["deriv",{"_index":1440,"title":{},"content":{"79":{"position":[[238,7]]},"91":{"position":[[856,6]]},"165":{"position":[[156,6]]},"196":{"position":[[973,6],[1462,6],[1510,6]]},"267":{"position":[[1248,6]]},"283":{"position":[[856,6]]},"407":{"position":[[1248,6]]},"495":{"position":[[856,6]]},"602":{"position":[[681,7]]},"644":{"position":[[1248,6]]},"710":{"position":[[681,7]]}},"keywords":{}}],["derive(debug",{"_index":917,"title":{},"content":{"39":{"position":[[624,15]]},"212":{"position":[[433,15],[556,15]]},"391":{"position":[[433,15],[556,15]]},"661":{"position":[[433,15],[556,15]]}},"keywords":{}}],["derive(default",{"_index":3718,"title":{},"content":{"602":{"position":[[61,18]]},"710":{"position":[[61,18]]}},"keywords":{}}],["derive(ev",{"_index":1586,"title":{},"content":{"91":{"position":[[874,17]]},"184":{"position":[[272,15],[396,15],[520,15]]},"196":{"position":[[406,15]]},"204":{"position":[[848,15]]},"205":{"position":[[2056,15]]},"219":{"position":[[383,15],[465,15]]},"267":{"position":[[1548,15]]},"269":{"position":[[3351,15],[3495,15]]},"383":{"position":[[945,16]]},"407":{"position":[[1548,15]]},"409":{"position":[[3351,15],[3495,15]]},"625":{"position":[[945,16]]},"644":{"position":[[1548,15]]},"646":{"position":[[3351,15],[3495,15]]}},"keywords":{}}],["derive(odra::ev",{"_index":1209,"title":{},"content":{"51":{"position":[[1147,22],[1260,22]]}},"keywords":{}}],["derive(odraerror",{"_index":2198,"title":{},"content":{"184":{"position":[[983,20]]},"196":{"position":[[335,20]]},"197":{"position":[[663,20]]},"205":{"position":[[2177,20]]},"219":{"position":[[293,20]]},"267":{"position":[[1293,20]]},"269":{"position":[[3656,20]]},"383":{"position":[[472,20]]},"407":{"position":[[1293,20]]},"409":{"position":[[3656,20]]},"625":{"position":[[472,20]]},"644":{"position":[[1293,20]]},"646":{"position":[[3656,20]]}},"keywords":{}}],["derive(odratyp",{"_index":2113,"title":{},"content":{"165":{"position":[[209,19]]},"209":{"position":[[524,18],[657,18]]},"383":{"position":[[222,19]]},"625":{"position":[[222,19]]}},"keywords":{}}],["derive(partialeq",{"_index":964,"title":{},"content":{"39":{"position":[[1952,19]]}},"keywords":{}}],["describ",{"_index":453,"title":{},"content":{"17":{"position":[[117,9]]},"101":{"position":[[34,9]]},"102":{"position":[[33,9]]},"184":{"position":[[676,8],[850,10]]},"211":{"position":[[829,9]]},"293":{"position":[[34,9]]},"294":{"position":[[33,9]]},"375":{"position":[[595,8],[769,10]]},"390":{"position":[[803,9]]},"395":{"position":[[16,9],[103,8]]},"505":{"position":[[34,9]]},"506":{"position":[[33,9]]},"591":{"position":[[595,8],[769,10]]},"632":{"position":[[16,9],[103,8]]},"660":{"position":[[803,9]]}},"keywords":{}}],["descript",{"_index":113,"title":{},"content":{"2":{"position":[[399,11]]},"176":{"position":[[66,11]]},"209":{"position":[[608,12],[998,12],[1079,12]]},"212":{"position":[[507,12],[1721,11],[1767,13],[2498,12],[4543,12]]},"324":{"position":[[620,11],[798,11],[992,11],[1498,11],[1540,12]]},"362":{"position":[[66,11]]},"388":{"position":[[569,12],[930,12],[1011,12]]},"391":{"position":[[507,12],[1721,11],[1767,13],[2498,12],[4561,12]]},"542":{"position":[[620,11],[798,11],[992,11],[1498,11],[1540,12]]},"578":{"position":[[66,11]]},"658":{"position":[[569,12],[930,12],[1011,12]]},"661":{"position":[[507,12],[1721,11],[1767,13],[2498,12],[4561,12]]}},"keywords":{}}],["description"",{"_index":2684,"title":{},"content":{"212":{"position":[[4565,18]]},"391":{"position":[[4583,18]]},"661":{"position":[[4583,18]]}},"keywords":{}}],["description'"",{"_index":2588,"title":{},"content":{"210":{"position":[[935,18]]},"389":{"position":[[872,18]]},"659":{"position":[[872,18]]}},"keywords":{}}],["deseri",{"_index":3077,"title":{},"content":{"354":{"position":[[440,15]]},"570":{"position":[[440,15]]}},"keywords":{}}],["deserialize."",{"_index":291,"title":{},"content":{"9":{"position":[[900,20]]}},"keywords":{}}],["design",{"_index":65,"title":{},"content":{"1":{"position":[[836,7]]},"22":{"position":[[112,7]]},"23":{"position":[[121,9]]},"38":{"position":[[130,6],[562,8],[910,6]]},"39":{"position":[[63,8]]},"40":{"position":[[3,7]]},"50":{"position":[[109,8]]},"81":{"position":[[348,6]]},"202":{"position":[[103,8]]},"232":{"position":[[348,6]]},"245":{"position":[[137,9]]},"248":{"position":[[44,6]]},"422":{"position":[[103,8]]},"444":{"position":[[137,9]]},"447":{"position":[[44,6]]},"463":{"position":[[348,6]]},"594":{"position":[[183,8],[552,6]]},"664":{"position":[[103,8]]},"671":{"position":[[137,9]]},"674":{"position":[[44,6]]},"702":{"position":[[183,8],[552,6]]}},"keywords":{}}],["despit",{"_index":895,"title":{},"content":{"39":{"position":[[49,7]]},"43":{"position":[[1862,7]]}},"keywords":{}}],["dest_file_path",{"_index":1038,"title":{},"content":{"42":{"position":[[546,15],[774,16]]}},"keywords":{}}],["detail",{"_index":1671,"title":{},"content":{"100":{"position":[[1020,7]]},"101":{"position":[[721,7]]},"112":{"position":[[56,7]]},"136":{"position":[[219,7]]},"211":{"position":[[799,7]]},"270":{"position":[[235,8]]},"292":{"position":[[1020,7]]},"293":{"position":[[721,7]]},"307":{"position":[[56,7]]},"316":{"position":[[219,7]]},"324":{"position":[[1368,7]]},"385":{"position":[[235,8]]},"390":{"position":[[773,7]]},"395":{"position":[[29,6]]},"396":{"position":[[379,8]]},"410":{"position":[[235,8]]},"504":{"position":[[1020,7]]},"505":{"position":[[721,7]]},"512":{"position":[[56,7]]},"533":{"position":[[219,7]]},"542":{"position":[[1368,7]]},"594":{"position":[[439,8]]},"627":{"position":[[235,8]]},"632":{"position":[[29,6]]},"633":{"position":[[379,8]]},"647":{"position":[[235,8]]},"660":{"position":[[773,7]]},"702":{"position":[[439,8]]}},"keywords":{}}],["detect",{"_index":3194,"title":{},"content":{"396":{"position":[[548,8]]},"633":{"position":[[548,8]]}},"keywords":{}}],["determin",{"_index":1329,"title":{},"content":{"65":{"position":[[237,9]]},"185":{"position":[[2820,9]]},"240":{"position":[[237,9]]},"376":{"position":[[2804,9]]},"465":{"position":[[237,9]]},"592":{"position":[[2804,9]]},"603":{"position":[[56,10]]},"711":{"position":[[56,10]]}},"keywords":{}}],["dev",{"_index":1880,"title":{},"content":{"131":{"position":[[175,4],[657,3]]},"265":{"position":[[226,3],[313,3],[577,4]]},"311":{"position":[[175,4],[709,3]]},"395":{"position":[[2898,4]]},"405":{"position":[[226,3],[313,3],[577,4]]},"528":{"position":[[175,4],[709,3]]},"632":{"position":[[2898,4]]},"642":{"position":[[226,3],[313,3],[577,4]]}},"keywords":{}}],["develop",{"_index":6,"title":{"593":{"position":[[18,10]]},"701":{"position":[[18,10]]}},"content":{"1":{"position":[[23,10],[43,9],[173,11],[441,11]]},"2":{"position":[[23,9]]},"12":{"position":[[297,7]]},"15":{"position":[[80,11]]},"20":{"position":[[272,9],[726,9]]},"21":{"position":[[120,11],[196,9]]},"22":{"position":[[79,11],[141,11],[207,12],[729,11]]},"33":{"position":[[93,11]]},"38":{"position":[[97,11],[195,12],[387,12],[489,10],[628,9]]},"44":{"position":[[26,12]]},"50":{"position":[[183,10]]},"52":{"position":[[174,11]]},"72":{"position":[[230,10]]},"81":{"position":[[337,10]]},"94":{"position":[[14,10]]},"119":{"position":[[33,11],[693,10]]},"232":{"position":[[337,10]]},"236":{"position":[[230,10]]},"286":{"position":[[14,10]]},"300":{"position":[[33,11],[693,10]]},"396":{"position":[[469,9],[1219,11]]},"463":{"position":[[337,10]]},"472":{"position":[[230,10]]},"498":{"position":[[14,10]]},"521":{"position":[[33,11],[693,10]]},"594":{"position":[[22,10],[107,12],[208,11],[640,11]]},"606":{"position":[[886,10]]},"612":{"position":[[13,10],[1792,11]]},"617":{"position":[[812,10],[903,10]]},"618":{"position":[[285,12]]},"633":{"position":[[469,9],[1219,11]]},"702":{"position":[[22,10],[107,12],[208,11],[640,11]]},"714":{"position":[[886,10]]},"720":{"position":[[13,10],[1792,11]]},"725":{"position":[[812,10],[903,10]]},"726":{"position":[[285,12]]}},"keywords":{}}],["diagram",{"_index":3471,"title":{},"content":{"441":{"position":[[252,7],[343,8],[4527,8]]},"688":{"position":[[252,7],[343,8],[4527,8]]}},"keywords":{}}],["dictionari",{"_index":1503,"title":{},"content":{"83":{"position":[[78,13],[278,10],[308,10]]},"84":{"position":[[873,11]]},"91":{"position":[[355,10],[506,10]]},"212":{"position":[[898,11]]},"252":{"position":[[78,13],[278,10],[308,10]]},"253":{"position":[[873,11]]},"267":{"position":[[2401,10]]},"283":{"position":[[355,10],[506,10]]},"391":{"position":[[898,11]]},"407":{"position":[[2401,10]]},"483":{"position":[[78,13],[278,10],[308,10]]},"484":{"position":[[873,11]]},"495":{"position":[[355,10],[506,10]]},"598":{"position":[[2041,13]]},"644":{"position":[[2401,10]]},"661":{"position":[[898,11]]},"706":{"position":[[2041,13]]}},"keywords":{}}],["dictionary_item_key",{"_index":2634,"title":{},"content":{"212":{"position":[[1156,20]]},"391":{"position":[[1156,20]]},"661":{"position":[[1156,20]]}},"keywords":{}}],["dictionary_nam",{"_index":2621,"title":{},"content":{"212":{"position":[[386,16],[1110,16]]},"391":{"position":[[386,16],[1110,16]]},"661":{"position":[[386,16],[1110,16]]}},"keywords":{}}],["dictionary_name.to_str",{"_index":2633,"title":{},"content":{"212":{"position":[[1127,28]]},"391":{"position":[[1127,28]]},"661":{"position":[[1127,28]]}},"keywords":{}}],["dictionaryitemidentifier::contractnamedkey",{"_index":2631,"title":{},"content":{"212":{"position":[[1033,42]]},"391":{"position":[[1033,42]]},"661":{"position":[[1033,42]]}},"keywords":{}}],["differ",{"_index":896,"title":{"88":{"position":[[8,9]]},"250":{"position":[[8,9]]},"488":{"position":[[8,9]]}},"content":{"39":{"position":[[76,9]]},"43":{"position":[[1890,9]]},"51":{"position":[[1846,9]]},"79":{"position":[[1281,7]]},"91":{"position":[[705,9]]},"126":{"position":[[2054,10]]},"129":{"position":[[229,9]]},"149":{"position":[[29,9]]},"163":{"position":[[710,10]]},"173":{"position":[[235,9],[249,9]]},"198":{"position":[[3085,9]]},"230":{"position":[[1298,7]]},"268":{"position":[[1540,12]]},"277":{"position":[[2222,10]]},"280":{"position":[[229,9]]},"283":{"position":[[705,9]]},"337":{"position":[[29,9]]},"352":{"position":[[732,10]]},"359":{"position":[[235,9],[249,9]]},"408":{"position":[[1540,12]]},"434":{"position":[[3067,9]]},"461":{"position":[[1298,7]]},"495":{"position":[[705,9]]},"514":{"position":[[2054,10]]},"517":{"position":[[229,9]]},"554":{"position":[[29,9]]},"568":{"position":[[732,10]]},"575":{"position":[[235,9],[249,9]]},"594":{"position":[[368,11]]},"596":{"position":[[987,11]]},"598":{"position":[[1595,9]]},"600":{"position":[[897,12]]},"612":{"position":[[139,9],[346,10]]},"613":{"position":[[1527,9]]},"616":{"position":[[1158,10]]},"617":{"position":[[1312,9]]},"618":{"position":[[45,11]]},"645":{"position":[[1540,12]]},"681":{"position":[[3085,9]]},"702":{"position":[[368,11]]},"704":{"position":[[987,11]]},"706":{"position":[[1595,9]]},"708":{"position":[[897,12]]},"720":{"position":[[139,9],[346,10]]},"721":{"position":[[1527,9]]},"724":{"position":[[1158,10]]},"725":{"position":[[1312,9]]},"726":{"position":[[45,11]]}},"keywords":{}}],["dir",{"_index":706,"title":{},"content":{"30":{"position":[[564,3]]}},"keywords":{}}],["direct",{"_index":126,"title":{},"content":{"3":{"position":[[76,9]]},"92":{"position":[[275,6]]},"284":{"position":[[275,6]]},"415":{"position":[[239,6]]},"496":{"position":[[275,6]]},"606":{"position":[[551,6]]},"612":{"position":[[1838,6]]},"614":{"position":[[331,6]]},"617":{"position":[[1031,6]]},"652":{"position":[[239,6]]},"714":{"position":[[551,6]]},"720":{"position":[[1838,6]]},"722":{"position":[[331,6]]},"725":{"position":[[1031,6]]}},"keywords":{}}],["directli",{"_index":1648,"title":{},"content":{"98":{"position":[[708,9]]},"143":{"position":[[792,8]]},"290":{"position":[[708,9]]},"328":{"position":[[767,8]]},"441":{"position":[[39,9]]},"502":{"position":[[708,9]]},"537":{"position":[[767,8]]},"613":{"position":[[1589,9]]},"688":{"position":[[39,9]]},"721":{"position":[[1589,9]]}},"keywords":{}}],["directori",{"_index":708,"title":{"130":{"position":[[0,9]]},"264":{"position":[[12,10]]},"310":{"position":[[0,9]]},"404":{"position":[[12,10]]},"527":{"position":[[0,9]]},"641":{"position":[[12,10]]}},"content":{"30":{"position":[[648,10]]},"65":{"position":[[484,9],[607,10]]},"100":{"position":[[109,10],[254,10]]},"117":{"position":[[1444,10]]},"122":{"position":[[62,11]]},"175":{"position":[[231,10]]},"240":{"position":[[484,9],[607,10]]},"264":{"position":[[78,9],[140,9],[256,10],[341,9]]},"292":{"position":[[109,10],[254,10]]},"298":{"position":[[1444,10]]},"303":{"position":[[62,11]]},"321":{"position":[[249,10]]},"323":{"position":[[56,10]]},"361":{"position":[[231,10]]},"382":{"position":[[154,9]]},"404":{"position":[[78,9],[140,9],[256,10],[341,9]]},"465":{"position":[[484,9],[607,10]]},"504":{"position":[[109,10],[254,10]]},"519":{"position":[[1444,10]]},"524":{"position":[[62,11]]},"539":{"position":[[249,10]]},"541":{"position":[[56,10]]},"577":{"position":[[231,10]]},"624":{"position":[[154,9]]},"641":{"position":[[78,9],[140,9],[256,10],[341,9]]}},"keywords":{}}],["dirti",{"_index":1026,"title":{},"content":{"42":{"position":[[20,5]]}},"keywords":{}}],["disabl",{"_index":1562,"title":{},"content":{"88":{"position":[[114,7],[160,7]]},"250":{"position":[[114,7],[160,7]]},"488":{"position":[[114,7],[160,7]]}},"keywords":{}}],["discord",{"_index":90,"title":{},"content":{"1":{"position":[[1165,7]]},"13":{"position":[[49,8]]},"24":{"position":[[123,8]]},"34":{"position":[[21,8]]},"55":{"position":[[21,8]]},"175":{"position":[[624,8]]},"270":{"position":[[118,7]]},"361":{"position":[[624,8]]},"385":{"position":[[118,7]]},"410":{"position":[[118,7]]},"577":{"position":[[624,8]]},"618":{"position":[[733,8]]},"627":{"position":[[118,7]]},"647":{"position":[[118,7]]},"726":{"position":[[733,8]]}},"keywords":{}}],["discriminant.entry_point",{"_index":3053,"title":{},"content":{"324":{"position":[[863,25]]},"542":{"position":[[863,25]]}},"keywords":{}}],["discuss",{"_index":159,"title":{},"content":{"3":{"position":[[616,9]]},"12":{"position":[[109,8]]}},"keywords":{}}],["disk",{"_index":306,"title":{},"content":{"9":{"position":[[1198,5],[1369,5],[1533,5]]}},"keywords":{}}],["dislik",{"_index":863,"title":{},"content":{"38":{"position":[[323,7]]}},"keywords":{}}],["display",{"_index":3592,"title":{},"content":{"477":{"position":[[3986,7]]},"699":{"position":[[3986,7]]}},"keywords":{}}],["distinct",{"_index":931,"title":{},"content":{"39":{"position":[[879,12]]},"84":{"position":[[840,8]]},"253":{"position":[[840,8]]},"484":{"position":[[840,8]]}},"keywords":{}}],["dive",{"_index":219,"title":{},"content":{"7":{"position":[[6,4]]},"124":{"position":[[27,4]]},"309":{"position":[[27,4]]},"526":{"position":[[27,4]]}},"keywords":{}}],["django",{"_index":35,"title":{},"content":{"1":{"position":[[384,6]]}},"keywords":{}}],["do",{"_index":1679,"title":{},"content":{"102":{"position":[[436,5]]},"294":{"position":[[436,5]]},"506":{"position":[[436,5]]}},"keywords":{}}],["do_something(&self",{"_index":3679,"title":{},"content":{"600":{"position":[[306,23]]},"708":{"position":[[306,23]]}},"keywords":{}}],["doc",{"_index":96,"title":{},"content":{"2":{"position":[[109,4]]},"39":{"position":[[688,4]]}},"keywords":{}}],["docker",{"_index":2569,"title":{},"content":{"210":{"position":[[56,6],[93,6]]},"389":{"position":[[56,6],[93,6]]},"477":{"position":[[88,6],[102,6],[351,6]]},"659":{"position":[[56,6],[93,6]]},"699":{"position":[[88,6],[102,6],[351,6]]}},"keywords":{}}],["document",{"_index":46,"title":{},"content":{"1":{"position":[[572,13]]},"23":{"position":[[156,13]]},"81":{"position":[[112,8]]},"157":{"position":[[841,14]]},"168":{"position":[[2249,14]]},"173":{"position":[[298,13]]},"174":{"position":[[128,13]]},"232":{"position":[[112,8]]},"268":{"position":[[2948,13]]},"270":{"position":[[161,14],[212,13]]},"324":{"position":[[841,15]]},"330":{"position":[[817,14]]},"348":{"position":[[2259,14]]},"359":{"position":[[298,13]]},"360":{"position":[[128,13]]},"385":{"position":[[161,14],[212,13]]},"395":{"position":[[67,14]]},"408":{"position":[[2948,13]]},"410":{"position":[[161,14],[212,13]]},"463":{"position":[[112,8]]},"542":{"position":[[841,15]]},"547":{"position":[[841,14]]},"564":{"position":[[2249,14]]},"575":{"position":[[298,13]]},"576":{"position":[[128,13]]},"627":{"position":[[161,14],[212,13]]},"632":{"position":[[67,14]]},"645":{"position":[[2948,13]]},"647":{"position":[[161,14],[212,13]]}},"keywords":{}}],["documentationdocs.rsexampl",{"_index":2953,"title":{},"content":{"271":{"position":[[14,28]]},"386":{"position":[[14,28]]},"411":{"position":[[14,28]]},"628":{"position":[[14,28]]},"648":{"position":[[14,28]]}},"keywords":{}}],["doesn't",{"_index":442,"title":{},"content":{"16":{"position":[[305,7]]},"103":{"position":[[719,7]]},"162":{"position":[[1626,7]]},"268":{"position":[[583,7],[2825,7]]},"295":{"position":[[719,7]]},"351":{"position":[[1648,7]]},"408":{"position":[[583,7],[2825,7]]},"507":{"position":[[719,7]]},"567":{"position":[[1648,7]]},"605":{"position":[[574,7]]},"645":{"position":[[583,7],[2825,7]]},"713":{"position":[[574,7]]}},"keywords":{}}],["dog",{"_index":2047,"title":{},"content":{"162":{"position":[[284,4],[2092,3]]},"163":{"position":[[184,3]]},"164":{"position":[[426,3],[938,3]]},"165":{"position":[[240,3]]},"351":{"position":[[284,4],[2114,3]]},"352":{"position":[[184,3]]},"353":{"position":[[461,3],[973,3]]},"354":{"position":[[219,3],[278,3]]},"383":{"position":[[364,3]]},"567":{"position":[[284,4],[2114,3]]},"568":{"position":[[184,3]]},"569":{"position":[[461,3],[973,3]]},"570":{"position":[[219,3],[278,3]]},"625":{"position":[[364,3]]}},"keywords":{}}],["dog'",{"_index":2082,"title":{},"content":{"163":{"position":[[247,5]]},"352":{"position":[[247,5]]},"568":{"position":[[247,5]]}},"keywords":{}}],["dogcontract",{"_index":2049,"title":{},"content":{"162":{"position":[[358,11],[750,11]]},"164":{"position":[[18,11]]},"351":{"position":[[395,11],[772,11]]},"353":{"position":[[18,11]]},"567":{"position":[[395,11],[772,11]]},"569":{"position":[[18,11]]}},"keywords":{}}],["dogcontract2",{"_index":2084,"title":{},"content":{"163":{"position":[[388,12]]},"352":{"position":[[410,12]]},"568":{"position":[[410,12]]}},"keywords":{}}],["dogcontract3",{"_index":2103,"title":{},"content":{"164":{"position":[[181,12],[537,12]]},"353":{"position":[[216,12],[572,12]]},"569":{"position":[[216,12],[572,12]]}},"keywords":{}}],["don't",{"_index":1299,"title":{},"content":{"53":{"position":[[14,5]]},"54":{"position":[[438,6]]},"79":{"position":[[1378,5]]},"91":{"position":[[897,5]]},"126":{"position":[[546,5]]},"134":{"position":[[89,5]]},"151":{"position":[[6,5]]},"198":{"position":[[2322,5]]},"206":{"position":[[3776,5]]},"218":{"position":[[176,5]]},"230":{"position":[[1395,5]]},"265":{"position":[[53,5]]},"270":{"position":[[81,5]]},"277":{"position":[[546,5]]},"283":{"position":[[895,5]]},"314":{"position":[[89,5]]},"342":{"position":[[6,5]]},"385":{"position":[[81,5]]},"405":{"position":[[53,5]]},"410":{"position":[[81,5]]},"415":{"position":[[77,5],[95,5]]},"416":{"position":[[4852,5]]},"426":{"position":[[3751,5]]},"434":{"position":[[2312,5]]},"451":{"position":[[176,5]]},"461":{"position":[[1395,5]]},"495":{"position":[[895,5]]},"514":{"position":[[546,5]]},"531":{"position":[[89,5]]},"556":{"position":[[6,5]]},"605":{"position":[[264,5]]},"627":{"position":[[81,5]]},"642":{"position":[[53,5]]},"647":{"position":[[81,5]]},"652":{"position":[[77,5],[95,5]]},"653":{"position":[[4852,5]]},"668":{"position":[[3776,5]]},"681":{"position":[[2322,5]]},"691":{"position":[[176,5]]},"713":{"position":[[264,5]]}},"keywords":{}}],["done",{"_index":1668,"title":{},"content":{"100":{"position":[[886,5]]},"196":{"position":[[552,4]]},"198":{"position":[[3396,4]]},"247":{"position":[[1803,4]]},"292":{"position":[[886,5]]},"396":{"position":[[916,4]]},"432":{"position":[[489,4]]},"434":{"position":[[3378,4]]},"446":{"position":[[1803,4]]},"504":{"position":[[886,5]]},"633":{"position":[[916,4]]},"673":{"position":[[1803,4]]},"679":{"position":[[489,4]]},"681":{"position":[[3396,4]]}},"keywords":{}}],["down",{"_index":913,"title":{},"content":{"39":{"position":[[521,4]]},"395":{"position":[[4254,4]]},"632":{"position":[[4254,4]]}},"keywords":{}}],["download",{"_index":3109,"title":{},"content":{"393":{"position":[[282,8]]},"395":{"position":[[4137,10]]},"630":{"position":[[282,8]]},"632":{"position":[[4137,10]]}},"keywords":{}}],["downsid",{"_index":2072,"title":{},"content":{"162":{"position":[[1837,9]]},"351":{"position":[[1859,9]]},"567":{"position":[[1859,9]]}},"keywords":{}}],["dropdown",{"_index":3190,"title":{},"content":{"396":{"position":[[267,8]]},"633":{"position":[[267,8]]}},"keywords":{}}],["due",{"_index":948,"title":{},"content":{"39":{"position":[[1292,3]]},"266":{"position":[[0,3]]},"406":{"position":[[0,3]]},"606":{"position":[[1139,3]]},"643":{"position":[[0,3]]},"714":{"position":[[1139,3]]}},"keywords":{}}],["durat",{"_index":3541,"title":{},"content":{"476":{"position":[[480,9],[1459,9]]},"698":{"position":[[480,9],[1459,9]]}},"keywords":{}}],["dure",{"_index":1567,"title":{},"content":{"88":{"position":[[396,6]]},"108":{"position":[[270,6]]},"119":{"position":[[22,6]]},"135":{"position":[[25,6]]},"175":{"position":[[558,6]]},"250":{"position":[[396,6]]},"275":{"position":[[274,6]]},"300":{"position":[[22,6]]},"315":{"position":[[25,6]]},"361":{"position":[[558,6]]},"396":{"position":[[921,6],[1208,6]]},"476":{"position":[[1571,6]]},"488":{"position":[[396,6]]},"492":{"position":[[274,6]]},"521":{"position":[[22,6]]},"532":{"position":[[25,6]]},"577":{"position":[[558,6]]},"617":{"position":[[956,6]]},"633":{"position":[[921,6],[1208,6]]},"698":{"position":[[1571,6]]},"725":{"position":[[956,6]]}},"keywords":{}}],["dynam",{"_index":3715,"title":{},"content":{"601":{"position":[[1961,7]]},"709":{"position":[[1961,7]]}},"keywords":{}}],["e",{"_index":2865,"title":{},"content":{"267":{"position":[[2704,2],[2782,2]]},"407":{"position":[[2704,2],[2782,2]]},"612":{"position":[[1062,1],[1134,1]]},"644":{"position":[[2704,2],[2782,2]]},"720":{"position":[[1062,1],[1134,1]]}},"keywords":{}}],["e.g",{"_index":1767,"title":{},"content":{"117":{"position":[[1113,4]]},"298":{"position":[[1113,4]]},"519":{"position":[[1113,4]]},"603":{"position":[[274,6]]},"711":{"position":[[274,6]]}},"keywords":{}}],["each",{"_index":1227,"title":{},"content":{"52":{"position":[[256,4]]},"76":{"position":[[508,4]]},"79":{"position":[[436,4]]},"86":{"position":[[36,4]]},"94":{"position":[[532,4]]},"95":{"position":[[291,4],[458,4]]},"102":{"position":[[153,4]]},"106":{"position":[[57,4]]},"110":{"position":[[44,4]]},"126":{"position":[[2130,4]]},"127":{"position":[[634,4]]},"138":{"position":[[794,4]]},"143":{"position":[[619,4]]},"146":{"position":[[36,4]]},"162":{"position":[[1946,4]]},"165":{"position":[[318,4]]},"178":{"position":[[51,4]]},"184":{"position":[[156,4]]},"185":{"position":[[2744,4]]},"198":{"position":[[1143,4],[1301,4],[3641,4]]},"227":{"position":[[508,4]]},"230":{"position":[[453,4]]},"255":{"position":[[36,4]]},"273":{"position":[[57,4]]},"277":{"position":[[2298,4]]},"278":{"position":[[634,4]]},"286":{"position":[[532,4]]},"287":{"position":[[291,4],[458,4]]},"294":{"position":[[153,4]]},"305":{"position":[[44,4]]},"318":{"position":[[786,4]]},"324":{"position":[[583,4],[770,4],[958,4],[1262,4]]},"328":{"position":[[594,4]]},"334":{"position":[[36,4]]},"351":{"position":[[1968,4]]},"354":{"position":[[642,4]]},"369":{"position":[[51,4]]},"375":{"position":[[156,4]]},"376":{"position":[[2728,4]]},"413":{"position":[[69,4]]},"419":{"position":[[666,4]]},"434":{"position":[[1133,4],[1291,4],[3623,4]]},"458":{"position":[[508,4]]},"461":{"position":[[453,4]]},"486":{"position":[[36,4]]},"490":{"position":[[57,4]]},"498":{"position":[[532,4]]},"499":{"position":[[291,4],[458,4]]},"506":{"position":[[153,4]]},"510":{"position":[[44,4]]},"514":{"position":[[2130,4]]},"515":{"position":[[634,4]]},"537":{"position":[[594,4]]},"542":{"position":[[583,4],[770,4],[958,4],[1262,4]]},"544":{"position":[[786,4]]},"551":{"position":[[36,4]]},"567":{"position":[[1968,4]]},"570":{"position":[[642,4]]},"585":{"position":[[51,4]]},"591":{"position":[[156,4]]},"592":{"position":[[2728,4]]},"598":{"position":[[2204,4]]},"600":{"position":[[1109,4]]},"612":{"position":[[1933,4]]},"650":{"position":[[69,4]]},"656":{"position":[[666,4]]},"681":{"position":[[1143,4],[1301,4],[3641,4]]},"706":{"position":[[2204,4]]},"708":{"position":[[1109,4]]},"720":{"position":[[1933,4]]}},"keywords":{}}],["earli",{"_index":1171,"title":{},"content":{"44":{"position":[[11,5]]}},"keywords":{}}],["earlier",{"_index":3055,"title":{},"content":{"324":{"position":[[1302,8]]},"542":{"position":[[1302,8]]}},"keywords":{}}],["eas",{"_index":3086,"title":{},"content":{"365":{"position":[[261,4]]},"581":{"position":[[261,4]]}},"keywords":{}}],["easi",{"_index":19,"title":{},"content":{"1":{"position":[[195,5],[756,4]]},"22":{"position":[[1434,4]]},"114":{"position":[[246,4]]},"162":{"position":[[1777,4]]},"195":{"position":[[177,5]]},"197":{"position":[[879,4]]},"223":{"position":[[1363,5]]},"247":{"position":[[1530,5]]},"248":{"position":[[175,4]]},"257":{"position":[[246,4]]},"351":{"position":[[1799,4]]},"431":{"position":[[177,5]]},"433":{"position":[[878,4]]},"446":{"position":[[1530,5]]},"447":{"position":[[175,4]]},"456":{"position":[[1363,5]]},"480":{"position":[[246,4]]},"567":{"position":[[1799,4]]},"673":{"position":[[1530,5]]},"674":{"position":[[175,4]]},"678":{"position":[[177,5]]},"680":{"position":[[878,4]]},"696":{"position":[[1363,5]]}},"keywords":{}}],["easier",{"_index":1236,"title":{},"content":{"52":{"position":[[548,7]]},"478":{"position":[[394,6]]},"700":{"position":[[394,6]]}},"keywords":{}}],["easiest",{"_index":2404,"title":{},"content":{"198":{"position":[[2041,7]]},"394":{"position":[[70,7]]},"434":{"position":[[2031,7]]},"631":{"position":[[70,7]]},"681":{"position":[[2041,7]]}},"keywords":{}}],["easili",{"_index":960,"title":{},"content":{"39":{"position":[[1857,6]]},"50":{"position":[[254,6]]},"85":{"position":[[346,6]]},"129":{"position":[[99,6]]},"157":{"position":[[57,6]]},"254":{"position":[[346,6]]},"280":{"position":[[99,6]]},"330":{"position":[[57,6]]},"485":{"position":[[346,6]]},"517":{"position":[[99,6]]},"547":{"position":[[57,6]]}},"keywords":{}}],["ecosystem",{"_index":569,"title":{},"content":{"20":{"position":[[68,9],[237,10]]},"22":{"position":[[828,10]]},"50":{"position":[[82,10]]},"53":{"position":[[1098,10]]},"365":{"position":[[15,9],[191,9]]},"398":{"position":[[298,9]]},"418":{"position":[[103,9]]},"581":{"position":[[15,9],[191,9]]},"635":{"position":[[298,9]]},"655":{"position":[[103,9]]}},"keywords":{}}],["edg",{"_index":39,"title":{},"content":{"1":{"position":[[421,4]]}},"keywords":{}}],["edit",{"_index":428,"title":{"16":{"position":[[8,5]]}},"content":{"16":{"position":[[36,5],[160,4]]},"17":{"position":[[64,4]]},"117":{"position":[[432,7]]},"131":{"position":[[108,7]]},"265":{"position":[[510,7]]},"298":{"position":[[432,7]]},"311":{"position":[[108,7]]},"395":{"position":[[2613,7]]},"405":{"position":[[510,7]]},"477":{"position":[[795,7]]},"519":{"position":[[432,7]]},"528":{"position":[[108,7]]},"632":{"position":[[2613,7]]},"642":{"position":[[510,7]]},"699":{"position":[[795,7]]}},"keywords":{}}],["effect",{"_index":597,"title":{},"content":{"20":{"position":[[555,6],[885,6]]},"72":{"position":[[264,7]]},"185":{"position":[[3692,6]]},"236":{"position":[[264,7]]},"376":{"position":[[3676,6]]},"472":{"position":[[264,7]]},"592":{"position":[[3676,6]]},"605":{"position":[[666,8]]},"618":{"position":[[218,11]]},"713":{"position":[[666,8]]},"726":{"position":[[218,11]]}},"keywords":{}}],["effici",{"_index":1164,"title":{},"content":{"43":{"position":[[2007,11]]},"81":{"position":[[374,9]]},"115":{"position":[[3300,10]]},"162":{"position":[[1793,9]]},"232":{"position":[[374,9]]},"258":{"position":[[3226,10]]},"351":{"position":[[1815,9]]},"463":{"position":[[374,9]]},"481":{"position":[[3226,10]]},"567":{"position":[[1815,9]]},"602":{"position":[[1177,9],[2061,9]]},"710":{"position":[[1177,9],[2061,9]]}},"keywords":{}}],["element",{"_index":451,"title":{},"content":{"17":{"position":[[85,9]]},"85":{"position":[[6,7],[42,8],[144,9],[160,7]]},"94":{"position":[[271,7],[399,7]]},"154":{"position":[[136,8]]},"212":{"position":[[1883,8]]},"254":{"position":[[6,7],[42,8],[144,9],[160,7]]},"286":{"position":[[271,7],[399,7]]},"339":{"position":[[136,8]]},"391":{"position":[[1883,8]]},"485":{"position":[[6,7],[42,8],[144,9],[160,7]]},"498":{"position":[[271,7],[399,7]]},"559":{"position":[[136,8]]},"613":{"position":[[1473,7]]},"661":{"position":[[1883,8]]},"721":{"position":[[1473,7]]}},"keywords":{}}],["else'",{"_index":1938,"title":{},"content":{"141":{"position":[[784,6]]},"326":{"position":[[784,6]]},"535":{"position":[[784,6]]}},"keywords":{}}],["email",{"_index":111,"title":{},"content":{"2":{"position":[[360,5]]}},"keywords":{}}],["embed",{"_index":3811,"title":{},"content":{"612":{"position":[[282,9],[2004,9]]},"720":{"position":[[282,9],[2004,9]]}},"keywords":{}}],["emerg",{"_index":598,"title":{},"content":{"20":{"position":[[562,7]]},"190":{"position":[[44,9]]},"367":{"position":[[44,9]]},"583":{"position":[[44,9]]}},"keywords":{}}],["emit",{"_index":1204,"title":{},"content":{"51":{"position":[[911,9]]},"71":{"position":[[375,4]]},"91":{"position":[[148,4],[586,5]]},"139":{"position":[[21,4]]},"157":{"position":[[106,8],[574,9],[706,8]]},"168":{"position":[[2174,7]]},"185":{"position":[[3427,5]]},"193":{"position":[[152,8]]},"195":{"position":[[467,7]]},"197":{"position":[[1276,4]]},"198":{"position":[[2749,8]]},"206":{"position":[[927,8],[1589,8]]},"222":{"position":[[561,5]]},"235":{"position":[[375,4]]},"267":{"position":[[1695,8]]},"268":{"position":[[2797,7],[2914,7]]},"269":{"position":[[4837,8],[5499,8]]},"283":{"position":[[148,4],[586,5]]},"319":{"position":[[21,4]]},"321":{"position":[[733,5],[1099,5],[1317,5]]},"323":{"position":[[1782,5],[2760,5]]},"324":{"position":[[1256,5]]},"330":{"position":[[106,8],[560,9],[687,8]]},"348":{"position":[[2184,7]]},"376":{"position":[[3411,5]]},"407":{"position":[[1695,8]]},"408":{"position":[[2797,7],[2914,7]]},"409":{"position":[[4837,8],[5499,8]]},"426":{"position":[[927,8],[1584,8]]},"429":{"position":[[152,8]]},"431":{"position":[[467,7]]},"433":{"position":[[1275,4]]},"434":{"position":[[2739,8]]},"440":{"position":[[2134,4],[3621,7],[4218,5],[4537,5]]},"441":{"position":[[3087,4]]},"455":{"position":[[561,5]]},"471":{"position":[[375,4]]},"476":{"position":[[970,4]]},"495":{"position":[[148,4],[586,5]]},"539":{"position":[[733,5],[1099,5],[1317,5]]},"541":{"position":[[1782,5],[2760,5]]},"542":{"position":[[1256,5]]},"545":{"position":[[21,4]]},"547":{"position":[[106,8],[574,9],[706,8]]},"564":{"position":[[2174,7]]},"592":{"position":[[3411,5]]},"604":{"position":[[503,4]]},"610":{"position":[[672,4],[801,4]]},"644":{"position":[[1695,8]]},"645":{"position":[[2797,7],[2914,7]]},"646":{"position":[[4837,8],[5499,8]]},"668":{"position":[[927,8],[1589,8]]},"676":{"position":[[152,8]]},"678":{"position":[[467,7]]},"680":{"position":[[1275,4]]},"681":{"position":[[2749,8]]},"687":{"position":[[2134,4],[3621,7],[4218,5],[4537,5]]},"688":{"position":[[3087,4]]},"695":{"position":[[561,5]]},"698":{"position":[[970,4]]},"712":{"position":[[503,4]]},"718":{"position":[[672,4],[801,4]]}},"keywords":{}}],["emit_ev",{"_index":3797,"title":{},"content":{"610":{"position":[[701,12]]},"718":{"position":[[701,12]]}},"keywords":{}}],["emit_event<t",{"_index":2867,"title":{},"content":{"267":{"position":[[2796,16],[2857,16]]},"407":{"position":[[2796,16],[2857,16]]},"644":{"position":[[2796,16],[2857,16]]}},"keywords":{}}],["emit_event(deposit",{"_index":1367,"title":{},"content":{"71":{"position":[[524,19]]},"235":{"position":[[524,19]]},"471":{"position":[[524,19]]}},"keywords":{}}],["emitted_event<t",{"_index":2142,"title":{},"content":{"168":{"position":[[2029,19]]},"348":{"position":[[2029,19]]},"564":{"position":[[2029,19]]}},"keywords":{}}],["emphas",{"_index":897,"title":{},"content":{"39":{"position":[[111,9]]}},"keywords":{}}],["empti",{"_index":1770,"title":{},"content":{"117":{"position":[[1438,5]]},"298":{"position":[[1438,5]]},"519":{"position":[[1438,5]]}},"keywords":{}}],["emptyarray",{"_index":3835,"title":{},"content":{"613":{"position":[[487,10]]},"721":{"position":[[487,10]]}},"keywords":{}}],["enabl",{"_index":178,"title":{},"content":{"5":{"position":[[185,7]]},"22":{"position":[[220,8],[775,6]]},"38":{"position":[[208,8]]},"39":{"position":[[431,7]]},"50":{"position":[[174,8]]},"76":{"position":[[249,6]]},"81":{"position":[[157,8]]},"83":{"position":[[33,7]]},"88":{"position":[[147,8],[388,7]]},"103":{"position":[[651,7]]},"108":{"position":[[27,8]]},"127":{"position":[[81,8]]},"189":{"position":[[27,7],[299,7]]},"227":{"position":[[249,6]]},"232":{"position":[[157,8]]},"250":{"position":[[147,8],[388,7]]},"252":{"position":[[33,7]]},"275":{"position":[[27,8]]},"278":{"position":[[81,8]]},"295":{"position":[[651,7]]},"366":{"position":[[27,7],[299,7]]},"458":{"position":[[249,6]]},"463":{"position":[[157,8]]},"483":{"position":[[33,7]]},"488":{"position":[[147,8],[388,7]]},"492":{"position":[[27,8]]},"507":{"position":[[651,7]]},"515":{"position":[[81,8]]},"582":{"position":[[27,7],[299,7]]}},"keywords":{}}],["encapsul",{"_index":1469,"title":{},"content":{"79":{"position":[[1384,11]]},"86":{"position":[[127,12]]},"171":{"position":[[62,12]]},"230":{"position":[[1401,11]]},"248":{"position":[[84,11]]},"255":{"position":[[127,12]]},"357":{"position":[[62,12]]},"447":{"position":[[84,11]]},"461":{"position":[[1401,11]]},"486":{"position":[[127,12]]},"573":{"position":[[62,12]]},"674":{"position":[[84,11]]}},"keywords":{}}],["encod",{"_index":794,"title":{},"content":{"31":{"position":[[2758,7]]},"85":{"position":[[1034,7]]},"211":{"position":[[781,9]]},"212":{"position":[[3791,8]]},"254":{"position":[[1034,7]]},"390":{"position":[[755,9]]},"391":{"position":[[3809,8]]},"485":{"position":[[1034,7]]},"660":{"position":[[755,9]]},"661":{"position":[[3809,8]]}},"keywords":{}}],["encount",{"_index":875,"title":{},"content":{"38":{"position":[[643,9]]},"270":{"position":[[7,9]]},"385":{"position":[[7,9]]},"395":{"position":[[4205,9]]},"410":{"position":[[7,9]]},"627":{"position":[[7,9]]},"632":{"position":[[4205,9]]},"647":{"position":[[7,9]]}},"keywords":{}}],["encourag",{"_index":155,"title":{},"content":{"3":{"position":[[534,10]]},"22":{"position":[[62,10]]},"38":{"position":[[80,10]]},"248":{"position":[[19,10]]},"447":{"position":[[19,10]]},"612":{"position":[[239,10]]},"674":{"position":[[19,10]]},"720":{"position":[[239,10]]}},"keywords":{}}],["end",{"_index":1782,"title":{},"content":{"119":{"position":[[792,4]]},"223":{"position":[[7,4]]},"300":{"position":[[792,4]]},"395":{"position":[[2506,4]]},"416":{"position":[[725,5],[1045,6],[1959,3],[3708,6]]},"417":{"position":[[797,4]]},"419":{"position":[[535,5],[1096,5],[4477,3],[5287,6],[7212,4]]},"456":{"position":[[7,4]]},"521":{"position":[[792,4]]},"632":{"position":[[2506,4]]},"653":{"position":[[725,5],[1045,6],[1959,3],[3708,6]]},"654":{"position":[[797,4]]},"656":{"position":[[535,5],[1096,5],[4477,3],[5287,6],[7212,4]]},"696":{"position":[[7,4]]}},"keywords":{}}],["endian",{"_index":2604,"title":{},"content":{"211":{"position":[[605,6]]},"212":{"position":[[3597,6]]},"390":{"position":[[579,6]]},"391":{"position":[[3615,6]]},"660":{"position":[[579,6]]},"661":{"position":[[3615,6]]}},"keywords":{}}],["endless",{"_index":1751,"title":{},"content":{"115":{"position":[[3223,7]]},"258":{"position":[[3149,7]]},"481":{"position":[[3149,7]]}},"keywords":{}}],["endpoint",{"_index":1933,"title":{},"content":{"141":{"position":[[527,9]]},"147":{"position":[[456,9],[1266,9]]},"326":{"position":[[527,9]]},"335":{"position":[[460,9],[1274,9]]},"416":{"position":[[1248,8],[2569,8]]},"535":{"position":[[527,9]]},"552":{"position":[[460,9],[1274,9]]},"653":{"position":[[1248,8],[2569,8]]}},"keywords":{}}],["engin",{"_index":578,"title":{},"content":{"20":{"position":[[164,11]]},"66":{"position":[[378,7]]},"83":{"position":[[21,6]]},"95":{"position":[[146,7]]},"241":{"position":[[378,7]]},"252":{"position":[[21,6]]},"287":{"position":[[146,7]]},"466":{"position":[[378,7]]},"483":{"position":[[21,6]]},"499":{"position":[[146,7]]}},"keywords":{}}],["enhanc",{"_index":158,"title":{},"content":{"3":{"position":[[578,12]]},"365":{"position":[[228,8]]},"581":{"position":[[228,8]]}},"keywords":{}}],["enough",{"_index":3407,"title":{},"content":{"440":{"position":[[2846,6],[4432,6],[5982,6]]},"687":{"position":[[2846,6],[4432,6],[5982,6]]}},"keywords":{}}],["ensur",{"_index":949,"title":{},"content":{"39":{"position":[[1324,7]]},"72":{"position":[[248,6]]},"185":{"position":[[3151,6]]},"205":{"position":[[3,6]]},"222":{"position":[[441,6]]},"236":{"position":[[248,6]]},"248":{"position":[[150,8]]},"267":{"position":[[4095,6]]},"376":{"position":[[3135,6]]},"407":{"position":[[4095,6]]},"425":{"position":[[3,6]]},"447":{"position":[[150,8]]},"455":{"position":[[441,6]]},"472":{"position":[[248,6]]},"592":{"position":[[3135,6]]},"612":{"position":[[1641,6]]},"644":{"position":[[4095,6]]},"667":{"position":[[3,6]]},"674":{"position":[[150,8]]},"695":{"position":[[441,6]]},"720":{"position":[[1641,6]]}},"keywords":{}}],["ensure_ownership",{"_index":2367,"title":{},"content":{"197":{"position":[[915,18]]},"198":{"position":[[1523,19]]},"433":{"position":[[914,18]]},"434":{"position":[[1513,19]]},"680":{"position":[[914,18]]},"681":{"position":[[1523,19]]}},"keywords":{}}],["ensure_ownership(&self",{"_index":2351,"title":{},"content":{"197":{"position":[[53,27]]},"433":{"position":[[53,27]]},"680":{"position":[[53,27]]}},"keywords":{}}],["enter",{"_index":21,"title":{},"content":{"1":{"position":[[212,8]]}},"keywords":{}}],["enthusiast",{"_index":9,"title":{},"content":{"1":{"position":[[65,10]]}},"keywords":{}}],["entir",{"_index":2257,"title":{},"content":{"185":{"position":[[2965,6]]},"206":{"position":[[3800,6]]},"376":{"position":[[2949,6]]},"426":{"position":[[3775,6]]},"592":{"position":[[2949,6]]},"601":{"position":[[2087,6]]},"668":{"position":[[3800,6]]},"709":{"position":[[2087,6]]}},"keywords":{}}],["entiti",{"_index":3490,"title":{},"content":{"441":{"position":[[1408,6]]},"688":{"position":[[1408,6]]}},"keywords":{}}],["entri",{"_index":342,"title":{},"content":{"10":{"position":[[819,5]]},"21":{"position":[[161,5]]},"22":{"position":[[623,5],[969,5]]},"42":{"position":[[1329,5],[1804,5]]},"43":{"position":[[1943,5]]},"102":{"position":[[17,5],[166,5],[377,5]]},"103":{"position":[[252,5],[374,5]]},"185":{"position":[[2894,5],[3790,5],[3968,5]]},"210":{"position":[[1339,5]]},"294":{"position":[[17,5],[166,5],[377,5]]},"295":{"position":[[252,5],[374,5]]},"324":{"position":[[963,5]]},"376":{"position":[[2878,5],[3774,5],[3952,5]]},"389":{"position":[[1276,5]]},"441":{"position":[[3946,5]]},"506":{"position":[[17,5],[166,5],[377,5]]},"507":{"position":[[252,5],[374,5]]},"542":{"position":[[963,5]]},"592":{"position":[[2878,5],[3774,5],[3952,5]]},"598":{"position":[[2110,5],[2209,5]]},"600":{"position":[[1015,5],[1114,5]]},"604":{"position":[[28,5]]},"659":{"position":[[1276,5]]},"688":{"position":[[3946,5]]},"706":{"position":[[2110,5],[2209,5]]},"708":{"position":[[1015,5],[1114,5]]},"712":{"position":[[28,5]]}},"keywords":{}}],["entrypoint",{"_index":1274,"title":{},"content":{"52":{"position":[[2082,10]]},"104":{"position":[[87,11]]},"108":{"position":[[126,12],[312,10]]},"121":{"position":[[54,12]]},"127":{"position":[[317,10]]},"128":{"position":[[13,11],[459,10]]},"138":{"position":[[926,12]]},"147":{"position":[[58,12]]},"178":{"position":[[342,12]]},"198":{"position":[[1502,12],[3657,11]]},"247":{"position":[[1692,11]]},"267":{"position":[[2972,11]]},"275":{"position":[[130,12],[316,10]]},"278":{"position":[[317,10]]},"279":{"position":[[13,11],[459,10]]},"296":{"position":[[87,11]]},"302":{"position":[[54,12]]},"318":{"position":[[918,12]]},"335":{"position":[[58,12]]},"369":{"position":[[342,12]]},"395":{"position":[[5287,10],[5758,10],[6277,10]]},"407":{"position":[[2972,11]]},"415":{"position":[[114,11]]},"419":{"position":[[1182,12],[1722,10]]},"434":{"position":[[1492,12],[3639,11]]},"446":{"position":[[1692,11]]},"477":{"position":[[3118,10],[3512,10]]},"492":{"position":[[130,12],[316,10]]},"508":{"position":[[87,11]]},"515":{"position":[[317,10]]},"516":{"position":[[13,11],[459,10]]},"523":{"position":[[54,12]]},"544":{"position":[[918,12]]},"552":{"position":[[58,12]]},"585":{"position":[[342,12]]},"632":{"position":[[5287,10],[5758,10],[6277,10]]},"644":{"position":[[2972,11]]},"652":{"position":[[114,11]]},"656":{"position":[[1182,12],[1722,10]]},"673":{"position":[[1692,11]]},"681":{"position":[[1502,12],[3657,11]]},"699":{"position":[[3118,10],[3512,10]]}},"keywords":{}}],["entrypoint.l2",{"_index":2716,"title":{},"content":{"221":{"position":[[540,13]]},"454":{"position":[[540,13]]},"694":{"position":[[540,13]]}},"keywords":{}}],["enum",{"_index":503,"title":{},"content":{"17":{"position":[[1555,4],[3995,4]]},"184":{"position":[[1008,4]]},"196":{"position":[[360,4],[941,5],[1004,5]]},"197":{"position":[[688,4],[1044,4]]},"205":{"position":[[2202,4]]},"219":{"position":[[318,4]]},"267":{"position":[[1318,4]]},"269":{"position":[[3681,4]]},"321":{"position":[[828,4],[1776,4],[1866,4]]},"324":{"position":[[548,5],[598,4],[735,5]]},"354":{"position":[[405,6],[550,5],[595,4],[600,4]]},"375":{"position":[[905,4]]},"383":{"position":[[562,4],[764,4]]},"384":{"position":[[3645,4]]},"407":{"position":[[1318,4]]},"409":{"position":[[3681,4]]},"419":{"position":[[346,4]]},"425":{"position":[[2152,4]]},"432":{"position":[[321,4],[879,5],[949,5]]},"433":{"position":[[687,4],[1043,4]]},"440":{"position":[[437,4],[778,4],[3352,5],[3406,4]]},"441":{"position":[[696,4],[2284,4]]},"452":{"position":[[297,4]]},"476":{"position":[[1626,4]]},"539":{"position":[[828,4],[1776,4],[1866,4]]},"542":{"position":[[548,5],[598,4],[735,5]]},"570":{"position":[[405,6],[550,5],[595,4],[600,4]]},"591":{"position":[[905,4]]},"602":{"position":[[84,4],[186,4],[243,4],[607,4],[717,4],[1072,4],[1279,4],[1864,6]]},"611":{"position":[[89,4]]},"613":{"position":[[474,4]]},"617":{"position":[[1183,4]]},"625":{"position":[[562,4],[764,4]]},"626":{"position":[[3645,4]]},"644":{"position":[[1318,4]]},"646":{"position":[[3681,4]]},"656":{"position":[[346,4]]},"667":{"position":[[2152,4]]},"679":{"position":[[321,4],[879,5],[949,5]]},"680":{"position":[[687,4],[1043,4]]},"687":{"position":[[437,4],[778,4],[3352,5],[3406,4]]},"688":{"position":[[696,4],[2284,4]]},"692":{"position":[[297,4]]},"698":{"position":[[1626,4]]},"710":{"position":[[84,4],[186,4],[243,4],[607,4],[717,4],[1072,4],[1279,4],[1864,6]]},"719":{"position":[[89,4]]},"721":{"position":[[474,4]]},"725":{"position":[[1183,4]]}},"keywords":{}}],["env",{"_index":1569,"title":{"90":{"position":[[9,4]]},"95":{"position":[[5,4]]},"110":{"position":[[9,4]]},"111":{"position":[[5,4]]},"282":{"position":[[9,4]]},"287":{"position":[[5,4]]},"305":{"position":[[9,4]]},"306":{"position":[[5,4]]},"494":{"position":[[9,4]]},"499":{"position":[[5,4]]},"510":{"position":[[9,4]]},"511":{"position":[[5,4]]}},"content":{"95":{"position":[[378,3],[512,4]]},"98":{"position":[[585,3]]},"107":{"position":[[188,3]]},"110":{"position":[[13,3],[539,3]]},"111":{"position":[[26,4],[40,3]]},"126":{"position":[[303,4],[361,4],[1418,3],[1484,3]]},"129":{"position":[[212,4],[490,4],[537,4],[742,4]]},"148":{"position":[[136,3]]},"168":{"position":[[499,5]]},"178":{"position":[[1142,3],[1478,3]]},"198":{"position":[[154,4],[381,4],[608,4],[947,4],[1770,4],[2336,4],[2804,4],[2817,5]]},"206":{"position":[[315,3],[605,5],[1135,5],[1773,5],[2093,5],[3379,5]]},"268":{"position":[[949,4],[1149,4],[2394,5],[3010,4]]},"269":{"position":[[4219,3],[4515,5],[5045,5],[5683,5]]},"274":{"position":[[188,3]]},"277":{"position":[[303,4],[361,4],[1586,3],[1652,3]]},"280":{"position":[[212,4],[490,4],[537,4],[743,4]]},"287":{"position":[[378,3],[512,4]]},"290":{"position":[[585,3]]},"305":{"position":[[13,3],[539,3]]},"306":{"position":[[26,4],[40,3]]},"336":{"position":[[136,3]]},"346":{"position":[[118,3],[162,3]]},"348":{"position":[[499,5]]},"369":{"position":[[1142,3],[1478,3]]},"395":{"position":[[592,3],[2843,3],[3631,4],[3669,4]]},"408":{"position":[[949,4],[1149,4],[2394,5],[3010,4]]},"409":{"position":[[4219,3],[4515,5],[5045,5],[5683,5]]},"417":{"position":[[157,3]]},"419":{"position":[[6572,3]]},"426":{"position":[[315,3],[605,5],[1130,5],[1763,5],[2083,5],[3354,5]]},"434":{"position":[[154,4],[381,4],[603,4],[937,4],[1760,4],[2326,4],[2794,4],[2807,5]]},"440":{"position":[[1688,3],[2292,3],[4963,3]]},"441":{"position":[[1131,3],[3196,3],[4788,3]]},"477":{"position":[[946,3],[1717,3]]},"491":{"position":[[188,3]]},"499":{"position":[[378,3],[512,4]]},"502":{"position":[[585,3]]},"510":{"position":[[13,3],[539,3]]},"511":{"position":[[26,4],[40,3]]},"514":{"position":[[303,4],[361,4],[1418,3],[1484,3]]},"517":{"position":[[212,4],[490,4],[537,4],[743,4]]},"553":{"position":[[136,3]]},"564":{"position":[[499,5]]},"585":{"position":[[1142,3],[1478,3]]},"600":{"position":[[367,3],[1210,5]]},"610":{"position":[[242,3]]},"613":{"position":[[660,3]]},"616":{"position":[[273,3],[1025,3]]},"632":{"position":[[592,3],[2843,3],[3631,4],[3669,4]]},"645":{"position":[[949,4],[1149,4],[2394,5],[3010,4]]},"646":{"position":[[4219,3],[4515,5],[5045,5],[5683,5]]},"654":{"position":[[157,3]]},"656":{"position":[[6572,3]]},"668":{"position":[[315,3],[605,5],[1135,5],[1773,5],[2093,5],[3379,5]]},"681":{"position":[[154,4],[381,4],[608,4],[947,4],[1770,4],[2336,4],[2804,4],[2817,5]]},"687":{"position":[[1688,3],[2292,3],[4963,3]]},"688":{"position":[[1131,3],[3196,3],[4788,3]]},"699":{"position":[[946,3],[1717,3]]},"708":{"position":[[367,3],[1210,5]]},"718":{"position":[[242,3]]},"721":{"position":[[660,3]]},"724":{"position":[[273,3],[1025,3]]}},"keywords":{}}],["env"",{"_index":3160,"title":{},"content":{"395":{"position":[[3170,10]]},"477":{"position":[[1083,10]]},"632":{"position":[[3170,10]]},"699":{"position":[[1083,10]]}},"keywords":{}}],["env'",{"_index":3796,"title":{},"content":{"610":{"position":[[695,5]]},"718":{"position":[[695,5]]}},"keywords":{}}],["env().revert",{"_index":3807,"title":{},"content":{"611":{"position":[[724,14]]},"719":{"position":[[724,14]]}},"keywords":{}}],["env.advance_block_time(11",{"_index":3139,"title":{},"content":{"395":{"position":[[1444,25]]},"632":{"position":[[1444,25]]}},"keywords":{}}],["env.advance_block_time(60",{"_index":3281,"title":{},"content":{"417":{"position":[[802,25],[1455,25]]},"419":{"position":[[7217,25],[7870,25]]},"654":{"position":[[802,25],[1455,25]]},"656":{"position":[[7217,25],[7870,25]]}},"keywords":{}}],["env.advance_block_time(u64).test_env::token_balance(address",{"_index":2912,"title":{},"content":{"268":{"position":[[1603,60]]},"408":{"position":[[1603,60]]},"645":{"position":[[1603,60]]}},"keywords":{}}],["env.attached_valu",{"_index":3399,"title":{},"content":{"440":{"position":[[2386,21]]},"441":{"position":[[1187,21]]},"687":{"position":[[2386,21]]},"688":{"position":[[1187,21]]}},"keywords":{}}],["env.balance_of(&address).funct",{"_index":2913,"title":{},"content":{"268":{"position":[[1671,38]]},"408":{"position":[[1671,38]]},"645":{"position":[[1671,38]]}},"keywords":{}}],["env.cal",{"_index":1810,"title":{},"content":{"126":{"position":[[1544,13]]},"277":{"position":[[1712,13]]},"395":{"position":[[702,13]]},"440":{"position":[[1719,13],[2360,13]]},"441":{"position":[[1161,13],[3265,13]]},"514":{"position":[[1544,13]]},"610":{"position":[[289,13],[383,13]]},"632":{"position":[[702,13]]},"687":{"position":[[1719,13],[2360,13]]},"688":{"position":[[1161,13],[3265,13]]},"718":{"position":[[289,13],[383,13]]}},"keywords":{}}],["env.clon",{"_index":2383,"title":{},"content":{"198":{"position":[[296,12]]},"206":{"position":[[341,12]]},"269":{"position":[[4245,12]]},"409":{"position":[[4245,12]]},"426":{"position":[[341,12]]},"434":{"position":[[296,12]]},"646":{"position":[[4245,12]]},"668":{"position":[[341,12]]},"681":{"position":[[296,12]]}},"keywords":{}}],["env.emit_event(anotherlog",{"_index":3795,"title":{},"content":{"610":{"position":[[449,25]]},"718":{"position":[[449,25]]}},"keywords":{}}],["env.emit_event(log",{"_index":3792,"title":{},"content":{"610":{"position":[[260,18],[354,18]]},"718":{"position":[[260,18],[354,18]]}},"keywords":{}}],["env.emit_event(onticketissu",{"_index":3397,"title":{},"content":{"440":{"position":[[2148,28]]},"687":{"position":[[2148,28]]}},"keywords":{}}],["env.emit_event(onticketsel",{"_index":3415,"title":{},"content":{"440":{"position":[[3191,27]]},"687":{"position":[[3191,27]]}},"keywords":{}}],["env.emitted_ev",{"_index":2386,"title":{},"content":{"198":{"position":[[444,18],[776,18]]},"434":{"position":[[444,18],[771,18]]},"681":{"position":[[444,18],[776,18]]}},"keywords":{}}],["env.get_account(0",{"_index":2381,"title":{},"content":{"198":{"position":[[228,18],[309,19]]},"206":{"position":[[1216,19],[2155,20],[3482,20]]},"268":{"position":[[2456,20]]},"269":{"position":[[5126,19]]},"346":{"position":[[205,20]]},"408":{"position":[[2456,20]]},"409":{"position":[[5126,19]]},"426":{"position":[[1211,19],[2145,20],[3457,20]]},"434":{"position":[[228,18],[309,19]]},"477":{"position":[[1768,19]]},"645":{"position":[[2456,20]]},"646":{"position":[[5126,19]]},"668":{"position":[[1216,19],[2155,20],[3482,20]]},"681":{"position":[[228,18],[309,19]]},"699":{"position":[[1768,19]]}},"keywords":{}}],["env.get_account(1",{"_index":2390,"title":{},"content":{"198":{"position":[[647,19],[982,19]]},"206":{"position":[[1252,19],[1873,19],[2176,19],[3503,19]]},"268":{"position":[[2477,19]]},"269":{"position":[[5162,19],[5783,19]]},"346":{"position":[[226,20]]},"408":{"position":[[2477,19]]},"409":{"position":[[5162,19],[5783,19]]},"426":{"position":[[1247,19],[1863,19],[2166,19],[3478,19]]},"434":{"position":[[642,19],[972,19]]},"440":{"position":[[5359,19]]},"441":{"position":[[5328,19]]},"645":{"position":[[2477,19]]},"646":{"position":[[5162,19],[5783,19]]},"668":{"position":[[1252,19],[1873,19],[2176,19],[3503,19]]},"681":{"position":[[647,19],[982,19]]},"687":{"position":[[5359,19]]},"688":{"position":[[5328,19]]}},"keywords":{}}],["env.get_account(2",{"_index":2526,"title":{},"content":{"206":{"position":[[2196,20],[3523,20]]},"268":{"position":[[2497,20]]},"408":{"position":[[2497,20]]},"426":{"position":[[2186,20],[3498,20]]},"645":{"position":[[2497,20]]},"668":{"position":[[2196,20],[3523,20]]}},"keywords":{}}],["env.hash",{"_index":3905,"title":{},"content":{"616":{"position":[[1270,10]]},"724":{"position":[[1270,10]]}},"keywords":{}}],["env.hash(data",{"_index":3865,"title":{},"content":{"616":{"position":[[488,14]]},"724":{"position":[[488,14]]}},"keywords":{}}],["env.hash(word.to_bytes().unwrap_or_revert(&env",{"_index":3902,"title":{},"content":{"616":{"position":[[1054,53]]},"724":{"position":[[1054,53]]}},"keywords":{}}],["env.revert(error::emptyarray",{"_index":3839,"title":{},"content":{"613":{"position":[[735,30]]},"721":{"position":[[735,30]]}},"keywords":{}}],["env.revert(error::insufficientfund",{"_index":3409,"title":{},"content":{"440":{"position":[[2888,37]]},"687":{"position":[[2888,37]]}},"keywords":{}}],["env.revert(error::ticketnotavailableforsal",{"_index":3402,"title":{},"content":{"440":{"position":[[2525,45],[2770,45]]},"687":{"position":[[2525,45],[2770,45]]}},"keywords":{}}],["env.revert(error::unauthor",{"_index":3506,"title":{},"content":{"441":{"position":[[3350,32]]},"688":{"position":[[3350,32]]}},"keywords":{}}],["env.sampl",{"_index":1795,"title":{},"content":{"126":{"position":[[389,11]]},"277":{"position":[[389,11]]},"514":{"position":[[389,11]]}},"keywords":{}}],["env.set_caller(alic",{"_index":3067,"title":{},"content":{"346":{"position":[[247,22]]}},"keywords":{}}],["env.set_caller(buy",{"_index":3447,"title":{},"content":{"440":{"position":[[5379,22]]},"441":{"position":[[5348,22]]},"687":{"position":[[5379,22]]},"688":{"position":[[5348,22]]}},"keywords":{}}],["env.set_caller(cal",{"_index":3571,"title":{},"content":{"477":{"position":[[1788,23]]},"699":{"position":[[1788,23]]}},"keywords":{}}],["env.set_caller(env.get_account(0",{"_index":3286,"title":{},"content":{"417":{"position":[[1382,35]]},"419":{"position":[[7797,35]]},"654":{"position":[[1382,35]]},"656":{"position":[[7797,35]]}},"keywords":{}}],["env.set_caller(env.get_account(1",{"_index":3285,"title":{},"content":{"417":{"position":[[1203,35]]},"419":{"position":[[7618,35]]},"654":{"position":[[1203,35]]},"656":{"position":[[7618,35]]}},"keywords":{}}],["env.set_caller(own",{"_index":2391,"title":{},"content":{"198":{"position":[[667,22]]},"434":{"position":[[662,22]]},"681":{"position":[[667,22]]}},"keywords":{}}],["env.set_caller(spend",{"_index":2535,"title":{},"content":{"206":{"position":[[2694,24],[3571,24]]},"268":{"position":[[2545,24]]},"408":{"position":[[2545,24]]},"426":{"position":[[2679,24],[3546,24]]},"645":{"position":[[2545,24]]},"668":{"position":[[2694,24],[3571,24]]}},"keywords":{}}],["env.set_gas(100_000_000_000u64",{"_index":1820,"title":{},"content":{"126":{"position":[[2221,32]]},"277":{"position":[[2389,32]]},"514":{"position":[[2221,32]]}},"keywords":{}}],["env.set_gas(1_000_000_000u64",{"_index":3129,"title":{},"content":{"395":{"position":[[1070,30],[1187,30]]},"632":{"position":[[1070,30],[1187,30]]}},"keywords":{}}],["env.set_gas(1_500_000_000u64",{"_index":3142,"title":{},"content":{"395":{"position":[[1504,30]]},"632":{"position":[[1504,30]]}},"keywords":{}}],["env.set_gas(300_000_000_000u64",{"_index":3153,"title":{},"content":{"395":{"position":[[2059,32]]},"632":{"position":[[2059,32]]}},"keywords":{}}],["env.set_gas(3_000_000_000u64",{"_index":1834,"title":{},"content":{"126":{"position":[[3173,30]]},"277":{"position":[[3341,30]]},"514":{"position":[[3173,30]]}},"keywords":{}}],["env.set_gas(ga",{"_index":3572,"title":{},"content":{"477":{"position":[[1812,17]]},"699":{"position":[[1812,17]]}},"keywords":{}}],["env.transfer_tokens(&own",{"_index":3410,"title":{},"content":{"440":{"position":[[2959,31]]},"441":{"position":[[3500,31]]},"687":{"position":[[2959,31]]},"688":{"position":[[3500,31]]}},"keywords":{}}],["env.transfer_tokens(bob",{"_index":3068,"title":{},"content":{"346":{"position":[[283,24]]}},"keywords":{}}],["env::commit(&product",{"_index":257,"title":{},"content":{"8":{"position":[[644,26]]}},"keywords":{}}],["env::commit(&result",{"_index":826,"title":{},"content":{"32":{"position":[[455,25]]}},"keywords":{}}],["env::read",{"_index":244,"title":{},"content":{"8":{"position":[[308,12],[374,12]]},"32":{"position":[[398,12]]}},"keywords":{}}],["enviro",{"_index":1867,"title":{"129":{"position":[[9,12]]}},"content":{},"keywords":{}}],["environ",{"_index":656,"title":{"280":{"position":[[9,13]]},"517":{"position":[[9,13]]}},"content":{"22":{"position":[[668,12]]},"65":{"position":[[201,11]]},"95":{"position":[[5,11]]},"126":{"position":[[269,11],[1401,12]]},"129":{"position":[[32,12]]},"240":{"position":[[201,11]]},"267":{"position":[[1909,12]]},"277":{"position":[[269,11],[1569,12]]},"280":{"position":[[32,12]]},"287":{"position":[[5,11]]},"346":{"position":[[33,11]]},"395":{"position":[[575,12]]},"407":{"position":[[1909,12]]},"465":{"position":[[201,11]]},"499":{"position":[[5,11]]},"514":{"position":[[269,11],[1401,12]]},"517":{"position":[[32,12]]},"632":{"position":[[575,12]]},"644":{"position":[[1909,12]]}},"keywords":{}}],["environment,assert",{"_index":2311,"title":{},"content":{"193":{"position":[[239,22]]},"429":{"position":[[239,22]]},"676":{"position":[[239,22]]}},"keywords":{}}],["environment,interact",{"_index":2310,"title":{},"content":{"193":{"position":[[200,24]]},"429":{"position":[[200,24]]},"676":{"position":[[200,24]]}},"keywords":{}}],["eq",{"_index":965,"title":{},"content":{"39":{"position":[[1972,3]]},"184":{"position":[[299,3],[423,3],[547,3]]},"196":{"position":[[440,4],[1538,2]]},"204":{"position":[[875,3]]},"205":{"position":[[2083,3]]},"209":{"position":[[561,3],[694,3]]},"212":{"position":[[460,3],[583,3]]},"219":{"position":[[410,3],[492,3]]},"267":{"position":[[1564,3]]},"269":{"position":[[3367,3],[3511,3]]},"391":{"position":[[460,3],[583,3]]},"407":{"position":[[1564,3]]},"409":{"position":[[3367,3],[3511,3]]},"644":{"position":[[1564,3]]},"646":{"position":[[3367,3],[3511,3]]},"661":{"position":[[460,3],[583,3]]}},"keywords":{}}],["equal",{"_index":1296,"title":{},"content":{"52":{"position":[[6478,5]]}},"keywords":{}}],["equip",{"_index":1613,"title":{},"content":{"94":{"position":[[7,6]]},"286":{"position":[[7,6]]},"498":{"position":[[7,6]]}},"keywords":{}}],["equival",{"_index":3675,"title":{},"content":{"599":{"position":[[641,10]]},"606":{"position":[[558,10]]},"612":{"position":[[1845,10]]},"614":{"position":[[338,10]]},"617":{"position":[[1038,10]]},"707":{"position":[[641,10]]},"714":{"position":[[558,10]]},"720":{"position":[[1845,10]]},"722":{"position":[[338,10]]},"725":{"position":[[1038,10]]}},"keywords":{}}],["erc",{"_index":2303,"title":{"191":{"position":[[0,3]]},"420":{"position":[[0,3]]},"662":{"position":[[0,3]]}},"content":{"204":{"position":[[1074,3]]},"207":{"position":[[73,3]]},"424":{"position":[[1025,3]]},"427":{"position":[[73,3]]},"666":{"position":[[1025,3]]},"669":{"position":[[73,3]]}},"keywords":{}}],["erc1155",{"_index":1675,"title":{"101":{"position":[[16,8]]},"293":{"position":[[16,8]]},"505":{"position":[[16,8]]}},"content":{"101":{"position":[[749,7]]},"188":{"position":[[446,8],[493,7]]},"293":{"position":[[749,7]]},"365":{"position":[[803,8],[850,7]]},"505":{"position":[[749,7]]},"581":{"position":[[803,8],[850,7]]}},"keywords":{}}],["erc1155_token",{"_index":1676,"title":{},"content":{"101":{"position":[[121,13]]},"293":{"position":[[121,13]]},"505":{"position":[[121,13]]}},"keywords":{}}],["erc1155bas",{"_index":2289,"title":{},"content":{"188":{"position":[[459,11],[583,11]]},"365":{"position":[[816,11],[940,11]]},"581":{"position":[[816,11],[940,11]]}},"keywords":{}}],["erc1155token",{"_index":2290,"title":{},"content":{"188":{"position":[[548,12],[683,12]]},"365":{"position":[[905,12],[1040,12]]},"581":{"position":[[905,12],[1040,12]]}},"keywords":{}}],["erc20",{"_index":396,"title":{"14":{"position":[[14,5]]},"17":{"position":[[0,5]]}},"content":{"15":{"position":[[234,5]]},"17":{"position":[[36,5],[221,5],[1655,5],[1751,6],[1812,5],[1966,5],[2214,5]]},"43":{"position":[[70,5]]},"54":{"position":[[39,5],[56,5],[94,5]]},"115":{"position":[[267,6],[1409,5],[2071,6],[3004,6]]},"188":{"position":[[0,6],[11,5],[39,5]]},"200":{"position":[[41,5]]},"203":{"position":[[144,5]]},"204":{"position":[[55,5],[611,5]]},"205":{"position":[[274,5],[1187,5]]},"206":{"position":[[611,6],[1145,6],[1783,6],[2103,6],[3389,6]]},"207":{"position":[[32,6]]},"245":{"position":[[50,5]]},"246":{"position":[[77,5],[278,6]]},"247":{"position":[[1768,5]]},"258":{"position":[[257,6],[1355,5],[2017,6],[2930,6]]},"267":{"position":[[945,5],[1091,5]]},"268":{"position":[[1337,5],[2404,6],[3047,5]]},"269":{"position":[[312,5],[543,5],[2482,5],[4521,6],[5055,6],[5693,6]]},"365":{"position":[[127,5],[357,6],[368,5],[396,5]]},"383":{"position":[[720,5]]},"384":{"position":[[325,5],[556,5],[2509,5]]},"407":{"position":[[945,5],[1091,5]]},"408":{"position":[[1337,5],[2404,6],[3047,5]]},"409":{"position":[[312,5],[543,5],[2482,5],[4521,6],[5055,6],[5693,6]]},"423":{"position":[[144,5]]},"424":{"position":[[30,5],[586,5]]},"425":{"position":[[249,5],[1162,5]]},"426":{"position":[[611,6],[1140,6],[1773,6],[2093,6],[3364,6]]},"427":{"position":[[32,6]]},"436":{"position":[[41,5]]},"444":{"position":[[50,5]]},"445":{"position":[[77,5],[278,6]]},"446":{"position":[[1768,5]]},"481":{"position":[[257,6],[1355,5],[2017,6],[2930,6]]},"581":{"position":[[127,5],[357,6],[368,5],[396,5]]},"604":{"position":[[133,5]]},"618":{"position":[[604,5]]},"625":{"position":[[720,5]]},"626":{"position":[[325,5],[556,5],[2509,5]]},"644":{"position":[[945,5],[1091,5]]},"645":{"position":[[1337,5],[2404,6],[3047,5]]},"646":{"position":[[312,5],[543,5],[2482,5],[4521,6],[5055,6],[5693,6]]},"665":{"position":[[144,5]]},"666":{"position":[[30,5],[586,5]]},"667":{"position":[[249,5],[1162,5]]},"668":{"position":[[611,6],[1145,6],[1783,6],[2103,6],[3389,6]]},"669":{"position":[[32,6]]},"671":{"position":[[50,5]]},"672":{"position":[[77,5],[278,6]]},"673":{"position":[[1768,5]]},"683":{"position":[[41,5]]},"712":{"position":[[133,5]]},"726":{"position":[[604,5]]}},"keywords":{}}],["erc20(name_",{"_index":1119,"title":{},"content":{"43":{"position":[[312,12]]}},"keywords":{}}],["erc20.address",{"_index":2508,"title":{},"content":{"206":{"position":[[963,16],[1625,16],[2563,16],[3023,16],[3146,16]]},"268":{"position":[[3129,16],[3252,16]]},"269":{"position":[[4873,16],[5535,16]]},"408":{"position":[[3129,16],[3252,16]]},"409":{"position":[[4873,16],[5535,16]]},"645":{"position":[[3129,16],[3252,16]]},"646":{"position":[[4873,16],[5535,16]]},"668":{"position":[[963,16],[1625,16],[2563,16],[3023,16],[3146,16]]}},"keywords":{}}],["erc20.approve(&spend",{"_index":2531,"title":{},"content":{"206":{"position":[[2386,27]]},"426":{"position":[[2376,27]]},"668":{"position":[[2386,27]]}},"keywords":{}}],["erc20.balance_of(&own",{"_index":2540,"title":{},"content":{"206":{"position":[[2855,29]]},"426":{"position":[[2840,29]]},"668":{"position":[[2855,29]]}},"keywords":{}}],["erc20.balance_of(&send",{"_index":2516,"title":{},"content":{"206":{"position":[[1396,30]]},"269":{"position":[[5306,30]]},"409":{"position":[[5306,30]]},"426":{"position":[[1391,30]]},"646":{"position":[[5306,30]]},"668":{"position":[[1396,30]]}},"keywords":{}}],["erc20.r",{"_index":2438,"title":{},"content":{"203":{"position":[[0,8]]},"204":{"position":[[0,8]]},"205":{"position":[[219,8]]},"206":{"position":[[0,8]]},"423":{"position":[[0,8]]},"424":{"position":[[0,8]]},"425":{"position":[[219,8]]},"426":{"position":[[0,8]]},"665":{"position":[[0,8]]},"666":{"position":[[0,8]]},"667":{"position":[[219,8]]},"668":{"position":[[0,8]]}},"keywords":{}}],["erc20.transfer(&recipi",{"_index":2513,"title":{},"content":{"206":{"position":[[1299,30]]},"269":{"position":[[5209,30]]},"409":{"position":[[5209,30]]},"426":{"position":[[1294,30]]},"646":{"position":[[5209,30]]},"668":{"position":[[1299,30]]}},"keywords":{}}],["erc20.transfer_from(&own",{"_index":2536,"title":{},"content":{"206":{"position":[[2719,31]]},"426":{"position":[[2704,31]]},"668":{"position":[[2719,31]]}},"keywords":{}}],["erc20.try_transfer_from(&own",{"_index":2544,"title":{},"content":{"206":{"position":[[3632,35]]},"426":{"position":[[3607,35]]},"668":{"position":[[3632,35]]}},"keywords":{}}],["erc20.try_transfer_from(own",{"_index":2923,"title":{},"content":{"268":{"position":[[2582,30]]},"408":{"position":[[2582,30]]},"645":{"position":[[2582,30]]}},"keywords":{}}],["erc20_on_livenet",{"_index":1847,"title":{},"content":{"127":{"position":[[106,16]]},"129":{"position":[[600,16]]},"278":{"position":[[106,16]]},"280":{"position":[[600,16]]},"515":{"position":[[106,16]]},"517":{"position":[[600,16]]}},"keywords":{}}],["erc20_on_livenet.r",{"_index":1808,"title":{},"content":{"126":{"position":[[1273,19]]},"277":{"position":[[1441,19]]},"514":{"position":[[1273,19]]}},"keywords":{}}],["erc20burn",{"_index":1113,"title":{},"content":{"43":{"position":[[195,14]]}},"keywords":{}}],["erc20cap",{"_index":1112,"title":{},"content":{"43":{"position":[[182,12],[553,12]]}},"keywords":{}}],["erc20capped(cap_",{"_index":1120,"title":{},"content":{"43":{"position":[[334,17]]}},"keywords":{}}],["erc20deployer::load(env",{"_index":1830,"title":{},"content":{"126":{"position":[[2918,24]]},"277":{"position":[[3086,24]]},"514":{"position":[[2918,24]]}},"keywords":{}}],["erc20hostref",{"_index":1958,"title":{},"content":{"142":{"position":[[299,12]]},"206":{"position":[[295,13]]},"269":{"position":[[3911,13],[4199,13]]},"327":{"position":[[299,12]]},"409":{"position":[[3911,13],[4199,13]]},"426":{"position":[[295,13]]},"536":{"position":[[299,12]]},"646":{"position":[[3911,13],[4199,13]]},"668":{"position":[[295,13]]}},"keywords":{}}],["erc20hostref::deploy",{"_index":2496,"title":{},"content":{"206":{"position":[[354,21]]},"269":{"position":[[4258,21]]},"409":{"position":[[4258,21]]},"426":{"position":[[354,21]]},"646":{"position":[[4258,21]]},"668":{"position":[[354,21]]}},"keywords":{}}],["erc20hostref::deploy(&env",{"_index":2907,"title":{},"content":{"268":{"position":[[1345,30],[3055,30]]},"408":{"position":[[1345,30],[3055,30]]},"645":{"position":[[1345,30],[3055,30]]}},"keywords":{}}],["erc20hostref::deploy(env",{"_index":1824,"title":{},"content":{"126":{"position":[[2436,25]]},"277":{"position":[[2604,25]]},"514":{"position":[[2436,25]]}},"keywords":{}}],["erc20initarg",{"_index":1822,"title":{},"content":{"126":{"position":[[2340,13]]},"206":{"position":[[386,13]]},"268":{"position":[[1092,15],[1198,13]]},"269":{"position":[[3925,13],[4290,13]]},"277":{"position":[[2508,13]]},"408":{"position":[[1092,15],[1198,13]]},"409":{"position":[[3925,13],[4290,13]]},"426":{"position":[[386,13]]},"514":{"position":[[2340,13]]},"645":{"position":[[1092,15],[1198,13]]},"646":{"position":[[3925,13],[4290,13]]},"668":{"position":[[386,13]]}},"keywords":{}}],["erc721",{"_index":1655,"title":{"100":{"position":[[16,7]]},"292":{"position":[[16,7]]},"504":{"position":[[16,7]]}},"content":{"100":{"position":[[27,6],[1048,6]]},"188":{"position":[[55,7],[100,6]]},"292":{"position":[[27,6],[1048,6]]},"365":{"position":[[307,6],[412,7],[457,6]]},"504":{"position":[[27,6],[1048,6]]},"581":{"position":[[307,6],[412,7],[457,6]]}},"keywords":{}}],["erc721_token",{"_index":1659,"title":{},"content":{"100":{"position":[[189,12]]},"292":{"position":[[189,12]]},"504":{"position":[[189,12]]}},"keywords":{}}],["erc721_token.wasm",{"_index":1660,"title":{},"content":{"100":{"position":[[219,17]]},"292":{"position":[[219,17]]},"504":{"position":[[219,17]]}},"keywords":{}}],["erc721bas",{"_index":2283,"title":{},"content":{"188":{"position":[[67,10],[188,10]]},"365":{"position":[[424,10],[545,10]]},"581":{"position":[[424,10],[545,10]]}},"keywords":{}}],["erc721metadata",{"_index":2285,"title":{},"content":{"188":{"position":[[225,14],[410,14]]},"365":{"position":[[582,14],[767,14]]},"581":{"position":[[582,14],[767,14]]}},"keywords":{}}],["erc721receiv",{"_index":2286,"title":{},"content":{"188":{"position":[[268,14]]},"365":{"position":[[625,14]]},"581":{"position":[[625,14]]}},"keywords":{}}],["erc721token",{"_index":2284,"title":{},"content":{"188":{"position":[[154,11],[397,12]]},"267":{"position":[[3347,11]]},"365":{"position":[[511,11],[754,12]]},"407":{"position":[[3347,11]]},"581":{"position":[[511,11],[754,12]]},"644":{"position":[[3347,11]]}},"keywords":{}}],["err",{"_index":3924,"title":{},"content":{"617":{"position":[[1235,6]]},"725":{"position":[[1235,6]]}},"keywords":{}}],["err(err",{"_index":359,"title":{},"content":{"10":{"position":[[1388,8]]}},"keywords":{}}],["err(error::insufficientallowance.into",{"_index":2545,"title":{},"content":{"206":{"position":[[3698,40]]},"268":{"position":[[2633,40]]},"408":{"position":[[2633,40]]},"426":{"position":[[3673,40]]},"645":{"position":[[2633,40]]},"668":{"position":[[3698,40]]}},"keywords":{}}],["err(error::insufficientfunds.into",{"_index":3450,"title":{},"content":{"440":{"position":[[5472,36]]},"441":{"position":[[5417,36]]},"687":{"position":[[5472,36]]},"688":{"position":[[5417,36]]}},"keywords":{}}],["err(error::notanowner.into",{"_index":1915,"title":{},"content":{"138":{"position":[[756,29]]},"318":{"position":[[748,29]]},"544":{"position":[[748,29]]}},"keywords":{}}],["err(error::notowner.into",{"_index":2396,"title":{},"content":{"198":{"position":[[1102,27]]},"434":{"position":[[1092,27]]},"681":{"position":[[1102,27]]}},"keywords":{}}],["err(error::ticketnotavailableforsale.into",{"_index":3453,"title":{},"content":{"440":{"position":[[5744,44]]},"441":{"position":[[5613,44]]},"687":{"position":[[5744,44]]},"688":{"position":[[5613,44]]}},"keywords":{}}],["err(reason",{"_index":3915,"title":{},"content":{"617":{"position":[[531,11]]},"725":{"position":[[531,11]]}},"keywords":{}}],["err.to_str",{"_index":362,"title":{},"content":{"10":{"position":[[1434,16]]}},"keywords":{}}],["error",{"_index":460,"title":{"137":{"position":[[0,6]]},"138":{"position":[[8,7]]},"184":{"position":[[11,7]]},"219":{"position":[[11,6]]},"317":{"position":[[0,6]]},"318":{"position":[[8,7]]},"375":{"position":[[11,7]]},"452":{"position":[[11,6]]},"543":{"position":[[0,6]]},"544":{"position":[[8,7]]},"591":{"position":[[11,7]]},"611":{"position":[[0,5]]},"692":{"position":[[11,6]]},"719":{"position":[[0,5]]}},"content":{"17":{"position":[[314,7],[1560,5],[4000,5]]},"39":{"position":[[2132,7],[2522,5],[2567,6]]},"95":{"position":[[432,5]]},"110":{"position":[[594,6]]},"111":{"position":[[333,7]]},"138":{"position":[[74,5],[1098,5],[1249,5]]},"147":{"position":[[897,6]]},"169":{"position":[[35,7]]},"184":{"position":[[1013,5],[1086,6]]},"193":{"position":[[278,6]]},"196":{"position":[[365,5],[886,5],[935,5]]},"197":{"position":[[693,5],[1038,5],[1444,5]]},"198":{"position":[[3521,6],[3866,6],[3888,6],[3949,5]]},"205":{"position":[[2207,5]]},"206":{"position":[[1959,5]]},"219":{"position":[[15,6],[323,5]]},"267":{"position":[[1172,6],[1323,5],[2775,6]]},"269":{"position":[[3626,6],[3686,5],[5869,5]]},"270":{"position":[[429,6]]},"287":{"position":[[432,5]]},"305":{"position":[[594,6]]},"306":{"position":[[333,7]]},"318":{"position":[[74,5],[1090,5],[1241,5]]},"321":{"position":[[302,6],[377,6],[822,5],[908,6],[1827,6]]},"324":{"position":[[729,5],[775,5]]},"335":{"position":[[905,6]]},"349":{"position":[[35,7]]},"375":{"position":[[910,5],[983,6]]},"383":{"position":[[104,7],[451,6],[556,5],[692,6],[701,7],[769,5]]},"384":{"position":[[297,6],[306,7],[3612,6],[3650,5]]},"385":{"position":[[429,6]]},"407":{"position":[[1172,6],[1323,5],[2775,6]]},"409":{"position":[[3626,6],[3686,5],[5869,5]]},"410":{"position":[[429,6]]},"415":{"position":[[272,6]]},"419":{"position":[[291,6]]},"425":{"position":[[2157,5]]},"426":{"position":[[1949,5]]},"429":{"position":[[278,6]]},"432":{"position":[[326,5],[824,5],[873,5]]},"433":{"position":[[692,5],[1037,5],[1443,5]]},"434":{"position":[[3503,6],[3848,6],[3870,6],[3931,5]]},"440":{"position":[[783,5],[956,6],[965,5],[3680,6]]},"441":{"position":[[701,5],[762,7],[1614,6],[2289,5],[4392,6]]},"442":{"position":[[171,7]]},"452":{"position":[[15,6],[302,5]]},"476":{"position":[[209,6],[1549,6],[1631,5]]},"499":{"position":[[432,5]]},"510":{"position":[[594,6]]},"511":{"position":[[333,7]]},"539":{"position":[[302,6],[377,6],[822,5],[908,6],[1827,6]]},"542":{"position":[[729,5],[775,5]]},"544":{"position":[[74,5],[1090,5],[1241,5]]},"552":{"position":[[905,6]]},"565":{"position":[[35,7]]},"591":{"position":[[910,5],[983,6]]},"599":{"position":[[607,6]]},"606":{"position":[[1132,6]]},"611":{"position":[[185,6],[213,5],[588,7],[632,7],[771,5],[852,5],[918,5],[979,6]]},"613":{"position":[[479,5]]},"617":{"position":[[848,6],[1136,6],[1374,5]]},"618":{"position":[[157,5]]},"625":{"position":[[104,7],[451,6],[556,5],[692,6],[701,7],[769,5]]},"626":{"position":[[297,6],[306,7],[3612,6],[3650,5]]},"627":{"position":[[429,6]]},"644":{"position":[[1172,6],[1323,5],[2775,6]]},"646":{"position":[[3626,6],[3686,5],[5869,5]]},"647":{"position":[[429,6]]},"652":{"position":[[272,6]]},"656":{"position":[[291,6]]},"667":{"position":[[2157,5]]},"668":{"position":[[1959,5]]},"676":{"position":[[278,6]]},"679":{"position":[[326,5],[824,5],[873,5]]},"680":{"position":[[692,5],[1037,5],[1443,5]]},"681":{"position":[[3521,6],[3866,6],[3888,6],[3949,5]]},"687":{"position":[[783,5],[956,6],[965,5],[3680,6]]},"688":{"position":[[701,5],[762,7],[1614,6],[2289,5],[4392,6]]},"689":{"position":[[171,7]]},"692":{"position":[[15,6],[302,5]]},"698":{"position":[[209,6],[1549,6],[1631,5]]},"707":{"position":[[607,6]]},"714":{"position":[[1132,6]]},"719":{"position":[[185,6],[213,5],[588,7],[632,7],[771,5],[852,5],[918,5],[979,6]]},"721":{"position":[[479,5]]},"725":{"position":[[848,6],[1136,6],[1374,5]]},"726":{"position":[[157,5]]}},"keywords":{}}],["error::into",{"_index":2426,"title":{},"content":{"198":{"position":[[3906,13]]},"434":{"position":[[3888,13]]},"681":{"position":[[3906,13]]}},"keywords":{}}],["error::invalidticketid",{"_index":3391,"title":{},"content":{"440":{"position":[[1932,23]]},"687":{"position":[[1932,23]]}},"keywords":{}}],["error::missingoper",{"_index":3512,"title":{},"content":{"441":{"position":[[3761,23]]},"688":{"position":[[3761,23]]}},"keywords":{}}],["error::missingrole.l56",{"_index":2264,"title":{},"content":{"185":{"position":[[3326,22]]},"376":{"position":[[3310,22]]},"592":{"position":[[3310,22]]}},"keywords":{}}],["error::notown",{"_index":2425,"title":{},"content":{"198":{"position":[[3850,15]]},"434":{"position":[[3832,15]]},"681":{"position":[[3850,15]]}},"keywords":{}}],["error::ownerisalreadyiniti",{"_index":2341,"title":{},"content":{"196":{"position":[[1179,32]]},"432":{"position":[[1122,32]]},"679":{"position":[[1122,32]]}},"keywords":{}}],["error::revert(some(condit",{"_index":987,"title":{},"content":{"39":{"position":[[2536,30]]}},"keywords":{}}],["error::ticketdoesnotexist",{"_index":3405,"title":{},"content":{"440":{"position":[[2658,27]]},"687":{"position":[[2658,27]]}},"keywords":{}}],["error::unknownticketoffic",{"_index":3487,"title":{},"content":{"441":{"position":[[1290,28]]},"688":{"position":[[1290,28]]}},"keywords":{}}],["error::unpausedrequired.into",{"_index":2744,"title":{},"content":{"223":{"position":[[1113,30]]},"456":{"position":[[1113,30]]},"696":{"position":[[1113,30]]}},"keywords":{}}],["errors.r",{"_index":2178,"title":{},"content":{"183":{"position":[[88,9]]},"184":{"position":[[952,9]]},"374":{"position":[[88,9]]},"375":{"position":[[871,9]]},"590":{"position":[[88,9]]},"591":{"position":[[871,9]]}},"keywords":{}}],["errors::error",{"_index":2943,"title":{},"content":{"269":{"position":[[3866,14]]},"409":{"position":[[3866,14]]},"646":{"position":[[3866,14]]}},"keywords":{}}],["especi",{"_index":1954,"title":{},"content":{"142":{"position":[[99,10]]},"162":{"position":[[2375,10]]},"327":{"position":[[99,10]]},"351":{"position":[[2397,10]]},"536":{"position":[[99,10]]},"567":{"position":[[2397,10]]},"594":{"position":[[616,10]]},"612":{"position":[[1763,10]]},"702":{"position":[[616,10]]},"720":{"position":[[1763,10]]}},"keywords":{}}],["essenti",{"_index":957,"title":{},"content":{"39":{"position":[[1691,9]]},"202":{"position":[[243,11]]},"422":{"position":[[243,11]]},"664":{"position":[[243,11]]}},"keywords":{}}],["establish",{"_index":941,"title":{},"content":{"39":{"position":[[1173,9]]},"184":{"position":[[121,9]]},"375":{"position":[[121,9]]},"591":{"position":[[121,9]]},"612":{"position":[[64,9],[2114,9]]},"720":{"position":[[64,9],[2114,9]]}},"keywords":{}}],["etc",{"_index":969,"title":{},"content":{"39":{"position":[[2174,4]]},"111":{"position":[[368,4]]},"121":{"position":[[75,5]]},"302":{"position":[[75,5]]},"306":{"position":[[368,4]]},"396":{"position":[[412,5]]},"511":{"position":[[368,4]]},"523":{"position":[[75,5]]},"633":{"position":[[412,5]]}},"keywords":{}}],["ether",{"_index":3786,"title":{},"content":{"608":{"position":[[819,6]]},"613":{"position":[[1333,6]]},"614":{"position":[[34,5],[133,5],[244,5]]},"716":{"position":[[819,6]]},"721":{"position":[[1333,6]]},"722":{"position":[[34,5],[133,5],[244,5]]}},"keywords":{}}],["ethereum",{"_index":170,"title":{},"content":{"5":{"position":[[87,8]]},"91":{"position":[[56,9]]},"283":{"position":[[56,9]]},"495":{"position":[[56,9]]},"595":{"position":[[78,8]]},"703":{"position":[[78,8]]}},"keywords":{}}],["even",{"_index":413,"title":{},"content":{"15":{"position":[[330,4]]},"31":{"position":[[75,4]]},"91":{"position":[[413,5]]},"128":{"position":[[68,4]]},"129":{"position":[[158,4]]},"147":{"position":[[696,4]]},"162":{"position":[[521,4]]},"197":{"position":[[1683,4]]},"279":{"position":[[68,4]]},"280":{"position":[[158,4]]},"283":{"position":[[413,5]]},"335":{"position":[[704,4]]},"351":{"position":[[558,4]]},"416":{"position":[[4833,4]]},"417":{"position":[[1340,7]]},"419":{"position":[[7755,7]]},"433":{"position":[[1682,4]]},"440":{"position":[[5954,4]]},"477":{"position":[[4034,4]]},"495":{"position":[[413,5]]},"516":{"position":[[68,4]]},"517":{"position":[[158,4]]},"552":{"position":[[704,4]]},"567":{"position":[[558,4]]},"653":{"position":[[4833,4]]},"654":{"position":[[1340,7]]},"656":{"position":[[7755,7]]},"680":{"position":[[1682,4]]},"687":{"position":[[5954,4]]},"699":{"position":[[4034,4]]}},"keywords":{}}],["event",{"_index":958,"title":{"91":{"position":[[0,7]]},"156":{"position":[[0,6]]},"157":{"position":[[8,7]]},"184":{"position":[[0,6]]},"219":{"position":[[0,6]]},"283":{"position":[[0,7]]},"329":{"position":[[0,6]]},"330":{"position":[[8,7]]},"375":{"position":[[0,6]]},"452":{"position":[[0,6]]},"495":{"position":[[0,7]]},"546":{"position":[[0,6]]},"547":{"position":[[8,7]]},"591":{"position":[[0,6]]},"610":{"position":[[0,6]]},"692":{"position":[[0,6]]},"718":{"position":[[0,6]]}},"content":{"39":{"position":[[1772,6],[1779,5]]},"51":{"position":[[1112,6]]},"53":{"position":[[255,7],[1306,5]]},"54":{"position":[[250,7]]},"71":{"position":[[380,5]]},"91":{"position":[[3,5],[120,6],[156,6],[247,5],[378,7],[470,5],[529,5],[566,6],[609,6],[686,6],[775,5],[821,5],[920,6]]},"110":{"position":[[605,7]]},"121":{"position":[[67,7]]},"139":{"position":[[35,6]]},"157":{"position":[[73,6],[555,6],[694,6],[798,5]]},"168":{"position":[[2120,6],[2164,5]]},"184":{"position":[[145,6],[231,7],[718,6],[844,5]]},"185":{"position":[[3622,7]]},"193":{"position":[[270,7]]},"195":{"position":[[377,6],[447,6]]},"196":{"position":[[1432,5]]},"198":{"position":[[2730,5],[2940,6],[2968,5]]},"201":{"position":[[153,5]]},"206":{"position":[[917,5],[1579,5],[3807,6]]},"219":{"position":[[111,6],[174,6],[274,6]]},"222":{"position":[[567,6]]},"235":{"position":[[380,5]]},"267":{"position":[[1478,6],[1708,5],[2897,6]]},"268":{"position":[[2695,8],[2805,7],[2858,6],[2922,7]]},"269":{"position":[[3272,6],[3343,7],[4827,5],[5489,5]]},"283":{"position":[[3,5],[120,6],[156,6],[247,5],[378,7],[470,5],[529,5],[566,6],[609,6],[686,6],[775,5],[821,5],[918,6]]},"302":{"position":[[67,7]]},"305":{"position":[[605,7]]},"319":{"position":[[35,6]]},"321":{"position":[[148,6],[291,6],[388,6],[704,6],[784,6],[1108,5],[1326,5],[2021,6],[2157,6]]},"324":{"position":[[1227,6],[1267,5]]},"330":{"position":[[73,6],[541,6],[675,6],[774,5]]},"348":{"position":[[2130,6],[2174,5]]},"375":{"position":[[145,6],[637,6],[763,5]]},"376":{"position":[[3606,7]]},"383":{"position":[[93,6],[672,6],[924,6]]},"384":{"position":[[3313,6]]},"407":{"position":[[1478,6],[1708,5],[2897,6]]},"408":{"position":[[2695,8],[2805,7],[2858,6],[2922,7]]},"409":{"position":[[3272,6],[3343,7],[4827,5],[5489,5]]},"421":{"position":[[153,5]]},"426":{"position":[[917,5],[1574,5],[3782,6]]},"429":{"position":[[270,7]]},"431":{"position":[[377,6],[447,6]]},"432":{"position":[[1374,5]]},"434":{"position":[[2720,5],[2922,6],[2950,5]]},"438":{"position":[[152,5]]},"440":{"position":[[916,6],[2142,5],[3601,6],[3691,6],[4559,6]]},"441":{"position":[[3095,5]]},"442":{"position":[[163,7]]},"452":{"position":[[111,6],[174,6]]},"455":{"position":[[567,6]]},"471":{"position":[[380,5]]},"476":{"position":[[216,6],[975,5],[1717,6],[1816,6]]},"495":{"position":[[3,5],[120,6],[156,6],[247,5],[378,7],[470,5],[529,5],[566,6],[609,6],[686,6],[775,5],[821,5],[918,6]]},"510":{"position":[[605,7]]},"523":{"position":[[67,7]]},"539":{"position":[[148,6],[291,6],[388,6],[704,6],[784,6],[1108,5],[1326,5],[2021,6],[2157,6]]},"542":{"position":[[1227,6],[1267,5]]},"545":{"position":[[35,6]]},"547":{"position":[[73,6],[555,6],[694,6],[798,5]]},"564":{"position":[[2120,6],[2164,5]]},"591":{"position":[[145,6],[637,6],[763,5]]},"592":{"position":[[3606,7]]},"604":{"position":[[508,6]]},"610":{"position":[[177,6],[205,5],[494,6],[569,5],[680,6],[736,5],[770,6],[881,6]]},"625":{"position":[[93,6],[672,6],[924,6]]},"626":{"position":[[3313,6]]},"644":{"position":[[1478,6],[1708,5],[2897,6]]},"645":{"position":[[2695,8],[2805,7],[2858,6],[2922,7]]},"646":{"position":[[3272,6],[3343,7],[4827,5],[5489,5]]},"663":{"position":[[153,5]]},"668":{"position":[[917,5],[1579,5],[3807,6]]},"676":{"position":[[270,7]]},"678":{"position":[[377,6],[447,6]]},"679":{"position":[[1374,5]]},"681":{"position":[[2730,5],[2940,6],[2968,5]]},"685":{"position":[[152,5]]},"687":{"position":[[916,6],[2142,5],[3601,6],[3691,6],[4559,6]]},"688":{"position":[[3095,5]]},"689":{"position":[[163,7]]},"692":{"position":[[111,6],[174,6]]},"695":{"position":[[567,6]]},"698":{"position":[[216,6],[975,5],[1717,6],[1816,6]]},"712":{"position":[[508,6]]},"718":{"position":[[177,6],[205,5],[494,6],[569,5],[680,6],[736,5],[770,6],[881,6]]}},"keywords":{}}],["event"",{"_index":3018,"title":{},"content":{"323":{"position":[[1791,12],[2769,12]]},"541":{"position":[[1791,12],[2769,12]]}},"keywords":{}}],["event.l103",{"_index":3426,"title":{},"content":{"440":{"position":[[4241,10]]},"687":{"position":[[4241,10]]}},"keywords":{}}],["event.l66",{"_index":2267,"title":{},"content":{"185":{"position":[[3454,9]]},"376":{"position":[[3438,9]]},"592":{"position":[[3438,9]]}},"keywords":{}}],["event.th",{"_index":3056,"title":{},"content":{"324":{"position":[[1336,9]]},"542":{"position":[[1336,9]]}},"keywords":{}}],["event.unauthor",{"_index":2175,"title":{},"content":{"182":{"position":[[345,18]]},"373":{"position":[[345,18]]},"589":{"position":[[345,18]]}},"keywords":{}}],["event::odraev",{"_index":1194,"title":{},"content":{"51":{"position":[[389,18]]}},"keywords":{}}],["event_nam",{"_index":3357,"title":{},"content":{"440":{"position":[[519,11],[639,11],[1649,11],[2053,11],[2190,11]]},"441":{"position":[[2861,11]]},"687":{"position":[[519,11],[639,11],[1649,11],[2053,11],[2190,11]]},"688":{"position":[[2861,11]]}},"keywords":{}}],["event_name.clon",{"_index":3395,"title":{},"content":{"440":{"position":[[2065,19]]},"687":{"position":[[2065,19]]}},"keywords":{}}],["eventinst",{"_index":3070,"title":{},"content":{"348":{"position":[[2059,14]]}},"keywords":{}}],["eventinstance>(&self",{"_index":2144,"title":{},"content":{"168":{"position":[[2059,28]]},"564":{"position":[[2059,28]]}},"keywords":{}}],["events.r",{"_index":2177,"title":{},"content":{"183":{"position":[[70,9]]},"184":{"position":[[179,9]]},"374":{"position":[[70,9]]},"375":{"position":[[179,9]]},"590":{"position":[[70,9]]},"591":{"position":[[179,9]]}},"keywords":{}}],["events.regist",{"_index":2308,"title":{},"content":{"193":{"position":[[161,18]]},"429":{"position":[[161,18]]},"676":{"position":[[161,18]]}},"keywords":{}}],["events.ticket",{"_index":3340,"title":{},"content":{"438":{"position":[[197,14]]},"685":{"position":[[197,14]]}},"keywords":{}}],["events::{approv",{"_index":2944,"title":{},"content":{"269":{"position":[[3881,18]]},"409":{"position":[[3881,18]]},"646":{"position":[[3881,18]]}},"keywords":{}}],["eventsregist",{"_index":981,"title":{},"content":{"39":{"position":[[2401,14]]}},"keywords":{}}],["everyon",{"_index":154,"title":{},"content":{"3":{"position":[[522,8]]}},"keywords":{}}],["everyth",{"_index":954,"title":{},"content":{"39":{"position":[[1615,10]]},"53":{"position":[[1383,10]]},"174":{"position":[[365,10]]},"360":{"position":[[365,10]]},"395":{"position":[[4443,10]]},"396":{"position":[[309,10]]},"576":{"position":[[365,10]]},"632":{"position":[[4443,10]]},"633":{"position":[[309,10]]}},"keywords":{}}],["evm",{"_index":587,"title":{"29":{"position":[[0,3]]},"31":{"position":[[0,4]]}},"content":{"20":{"position":[[451,3],[593,3],[640,3]]},"30":{"position":[[532,3],[619,3]]},"31":{"position":[[4,3],[144,4],[476,3],[913,3],[3129,3]]}},"keywords":{}}],["evm'",{"_index":727,"title":{},"content":{"31":{"position":[[445,5],[1347,5]]}},"keywords":{}}],["evm_calc_id).unwrap",{"_index":842,"title":{},"content":{"32":{"position":[[1273,22]]}},"keywords":{}}],["evm_runner::run_calc_contract",{"_index":823,"title":{},"content":{"32":{"position":[[298,30]]}},"keywords":{}}],["exact",{"_index":1702,"title":{},"content":{"110":{"position":[[322,5]]},"157":{"position":[[549,5]]},"173":{"position":[[180,5]]},"305":{"position":[[322,5]]},"330":{"position":[[535,5]]},"359":{"position":[[180,5]]},"510":{"position":[[322,5]]},"547":{"position":[[549,5]]},"575":{"position":[[180,5]]}},"keywords":{}}],["exactli",{"_index":1681,"title":{},"content":{"102":{"position":[[603,7]]},"294":{"position":[[603,7]]},"506":{"position":[[603,7]]}},"keywords":{}}],["exampl",{"_index":95,"title":{"7":{"position":[[0,8]]},"41":{"position":[[0,9]]},"71":{"position":[[0,8]]},"73":{"position":[[0,8]]},"99":{"position":[[0,8]]},"100":{"position":[[0,8]]},"101":{"position":[[0,8]]},"115":{"position":[[5,9]]},"170":{"position":[[5,8]]},"177":{"position":[[8,7]]},"235":{"position":[[0,8]]},"237":{"position":[[0,8]]},"258":{"position":[[5,9]]},"269":{"position":[[8,9]]},"291":{"position":[[0,8]]},"292":{"position":[[0,8]]},"293":{"position":[[0,8]]},"356":{"position":[[5,8]]},"368":{"position":[[8,7]]},"384":{"position":[[8,9]]},"409":{"position":[[8,9]]},"471":{"position":[[0,8]]},"473":{"position":[[0,8]]},"481":{"position":[[5,9]]},"503":{"position":[[0,8]]},"504":{"position":[[0,8]]},"505":{"position":[[0,8]]},"572":{"position":[[5,8]]},"584":{"position":[[8,7]]},"626":{"position":[[8,9]]},"646":{"position":[[8,9]]}},"content":{"2":{"position":[[96,8]]},"7":{"position":[[20,7],[57,7],[232,8]]},"12":{"position":[[132,9]]},"16":{"position":[[235,8]]},"30":{"position":[[6,8]]},"31":{"position":[[2902,7]]},"39":{"position":[[1752,8]]},"42":{"position":[[2794,7]]},"43":{"position":[[27,7]]},"54":{"position":[[208,7]]},"61":{"position":[[37,7]]},"63":{"position":[[37,7]]},"79":{"position":[[103,9],[500,8]]},"83":{"position":[[462,7]]},"84":{"position":[[535,8],[915,8]]},"85":{"position":[[375,8],[391,8],[841,8]]},"110":{"position":[[239,8]]},"115":{"position":[[29,7],[1603,7],[1846,8]]},"117":{"position":[[282,7]]},"119":{"position":[[368,7]]},"126":{"position":[[353,7],[411,8],[1170,9],[3415,7]]},"127":{"position":[[955,7]]},"129":{"position":[[252,8]]},"138":{"position":[[1041,8]]},"148":{"position":[[507,7]]},"154":{"position":[[202,8]]},"162":{"position":[[244,7],[2040,7]]},"163":{"position":[[475,7]]},"164":{"position":[[30,7],[1140,9]]},"168":{"position":[[194,7]]},"176":{"position":[[89,8]]},"202":{"position":[[88,8]]},"214":{"position":[[37,7]]},"216":{"position":[[37,7]]},"225":{"position":[[37,7]]},"230":{"position":[[103,9],[517,8]]},"252":{"position":[[462,7]]},"253":{"position":[[535,8],[915,8]]},"254":{"position":[[375,8],[391,8],[841,8]]},"258":{"position":[[29,7],[1549,7],[1792,8]]},"269":{"position":[[19,7]]},"270":{"position":[[275,8],[318,8]]},"277":{"position":[[353,7],[411,8],[1338,9],[3583,7]]},"278":{"position":[[955,7]]},"280":{"position":[[252,8]]},"295":{"position":[[802,7]]},"298":{"position":[[282,7]]},"300":{"position":[[368,7]]},"305":{"position":[[239,8]]},"318":{"position":[[1033,8]]},"323":{"position":[[158,7]]},"336":{"position":[[507,7]]},"339":{"position":[[202,8]]},"348":{"position":[[194,7]]},"351":{"position":[[244,7],[2062,7]]},"352":{"position":[[497,7]]},"353":{"position":[[30,7],[1175,9]]},"362":{"position":[[89,8]]},"384":{"position":[[19,7]]},"385":{"position":[[275,8],[318,8]]},"409":{"position":[[19,7]]},"410":{"position":[[275,8],[318,8]]},"413":{"position":[[110,8]]},"419":{"position":[[1919,8]]},"422":{"position":[[88,8]]},"449":{"position":[[37,7]]},"461":{"position":[[103,9],[517,8]]},"476":{"position":[[68,9]]},"481":{"position":[[29,7],[1549,7],[1792,8]]},"483":{"position":[[462,7]]},"484":{"position":[[535,8],[915,8]]},"485":{"position":[[375,8],[391,8],[841,8]]},"507":{"position":[[802,7]]},"510":{"position":[[239,8]]},"514":{"position":[[353,7],[411,8],[1170,9],[3415,7]]},"515":{"position":[[955,7]]},"517":{"position":[[252,8]]},"519":{"position":[[282,7]]},"521":{"position":[[368,7]]},"541":{"position":[[158,7]]},"544":{"position":[[1033,8]]},"553":{"position":[[507,7]]},"559":{"position":[[202,8]]},"564":{"position":[[194,7]]},"567":{"position":[[244,7],[2062,7]]},"568":{"position":[[497,7]]},"569":{"position":[[30,7],[1175,9]]},"578":{"position":[[89,8]]},"594":{"position":[[404,9]]},"596":{"position":[[786,8]]},"604":{"position":[[96,7]]},"606":{"position":[[714,7]]},"617":{"position":[[95,7],[164,7]]},"618":{"position":[[508,7]]},"626":{"position":[[19,7]]},"627":{"position":[[275,8],[318,8]]},"646":{"position":[[19,7]]},"647":{"position":[[275,8],[318,8]]},"650":{"position":[[110,8]]},"656":{"position":[[1919,8]]},"664":{"position":[[88,8]]},"698":{"position":[[68,9]]},"702":{"position":[[404,9]]},"704":{"position":[[786,8]]},"712":{"position":[[96,7]]},"714":{"position":[[714,7]]},"725":{"position":[[95,7],[164,7]]},"726":{"position":[[508,7]]}},"keywords":{}}],["examples"",{"_index":3560,"title":{},"content":{"477":{"position":[[752,14]]},"699":{"position":[[752,14]]}},"keywords":{}}],["examples.simpl",{"_index":51,"title":{},"content":{"1":{"position":[[656,19]]}},"keywords":{}}],["examples/bin/erc20_on_livenet.r",{"_index":1955,"title":{},"content":{"142":{"position":[[232,32]]},"327":{"position":[[232,32]]},"536":{"position":[[232,32]]}},"keywords":{}}],["examples/bin/tlw_on_livenet.r",{"_index":3563,"title":{},"content":{"477":{"position":[[1274,30]]},"699":{"position":[[1274,30]]}},"keywords":{}}],["examples/src/contracts/tlw.r",{"_index":1353,"title":{},"content":{"71":{"position":[[0,29]]},"235":{"position":[[0,29]]},"471":{"position":[[0,29]]},"476":{"position":[[78,29]]},"698":{"position":[[78,29]]}},"keywords":{}}],["examples/src/featur",{"_index":2112,"title":{},"content":{"164":{"position":[[1215,22]]},"353":{"position":[[1250,22]]},"569":{"position":[[1250,22]]}},"keywords":{}}],["examples/src/features/cross_calls.r",{"_index":1950,"title":{},"content":{"141":{"position":[[1507,36]]},"143":{"position":[[64,36]]},"328":{"position":[[64,36]]},"537":{"position":[[64,36]]}},"keywords":{}}],["examples/src/features/events.r",{"_index":2022,"title":{},"content":{"157":{"position":[[115,31]]},"330":{"position":[[115,31]]},"547":{"position":[[115,31]]}},"keywords":{}}],["examples/src/features/handling_errors.r",{"_index":1900,"title":{},"content":{"138":{"position":[[123,40]]},"318":{"position":[[123,40]]},"544":{"position":[[123,40]]}},"keywords":{}}],["examples/src/features/modules.r",{"_index":2012,"title":{},"content":{"151":{"position":[[63,32]]},"342":{"position":[[63,32]]},"556":{"position":[[63,32]]}},"keywords":{}}],["examples/src/features/native_token.r",{"_index":2035,"title":{},"content":{"160":{"position":[[111,37]]},"345":{"position":[[111,37]]},"562":{"position":[[111,37]]}},"keywords":{}}],["examples/src/features/storage/list.r",{"_index":2102,"title":{},"content":{"164":{"position":[[116,37],[478,37]]},"353":{"position":[[116,37],[513,37]]},"569":{"position":[[116,37],[513,37]]}},"keywords":{}}],["examples/src/features/storage/mapping.r",{"_index":1446,"title":{},"content":{"79":{"position":[[509,40]]},"163":{"position":[[294,40],[746,40]]},"230":{"position":[[526,40]]},"352":{"position":[[294,40],[768,40]]},"461":{"position":[[526,40]]},"568":{"position":[[294,40],[768,40]]}},"keywords":{}}],["examples/src/features/storage/variable.r",{"_index":2048,"title":{},"content":{"162":{"position":[[289,41],[672,41],[1445,41],[1702,41],[2128,41]]},"351":{"position":[[289,41],[709,41],[1467,41],[1724,41],[2150,41]]},"567":{"position":[[289,41],[709,41],[1467,41],[1724,41],[2150,41]]}},"keywords":{}}],["examples/src/features/testing.r",{"_index":2115,"title":{},"content":{"168":{"position":[[298,32]]},"348":{"position":[[298,32]]},"564":{"position":[[298,32]]}},"keywords":{}}],["exampleto",{"_index":684,"title":{},"content":{"26":{"position":[[37,9]]},"28":{"position":[[37,9]]},"36":{"position":[[37,9]]},"46":{"position":[[37,9]]},"48":{"position":[[37,9]]},"57":{"position":[[37,9]]},"59":{"position":[[37,9]]}},"keywords":{}}],["exce",{"_index":2522,"title":{},"content":{"206":{"position":[[1829,7]]},"269":{"position":[[5739,7]]},"409":{"position":[[5739,7]]},"426":{"position":[[1819,7]]},"646":{"position":[[5739,7]]},"668":{"position":[[1829,7]]}},"keywords":{}}],["exceed",{"_index":3774,"title":{},"content":{"606":{"position":[[1146,9]]},"714":{"position":[[1146,9]]}},"keywords":{}}],["excel",{"_index":2770,"title":{},"content":{"247":{"position":[[1619,9]]},"446":{"position":[[1619,9]]},"673":{"position":[[1619,9]]}},"keywords":{}}],["except",{"_index":1351,"title":{},"content":{"70":{"position":[[171,6]]},"234":{"position":[[171,6]]},"354":{"position":[[526,6]]},"440":{"position":[[4028,6]]},"441":{"position":[[3420,6]]},"470":{"position":[[171,6]]},"570":{"position":[[526,6]]},"617":{"position":[[833,10],[934,10]]},"687":{"position":[[4028,6]]},"688":{"position":[[3420,6]]},"725":{"position":[[833,10],[934,10]]}},"keywords":{}}],["exchang",{"_index":1741,"title":{},"content":{"115":{"position":[[2102,9],[3024,8]]},"258":{"position":[[2048,9],[2950,8]]},"481":{"position":[[2048,9],[2950,8]]}},"keywords":{}}],["exchange::exchang",{"_index":1738,"title":{},"content":{"115":{"position":[[1899,20]]},"258":{"position":[[1845,20]]},"481":{"position":[[1845,20]]}},"keywords":{}}],["exchange_r",{"_index":1743,"title":{},"content":{"115":{"position":[[2269,14]]},"258":{"position":[[2215,14]]},"481":{"position":[[2215,14]]}},"keywords":{}}],["exclus",{"_index":1405,"title":{},"content":{"74":{"position":[[56,9]]},"189":{"position":[[307,9]]},"238":{"position":[[56,9]]},"366":{"position":[[307,9]]},"474":{"position":[[56,9]]},"582":{"position":[[307,9]]}},"keywords":{}}],["exec",{"_index":1265,"title":{},"content":{"52":{"position":[[1409,4],[4928,4]]},"477":{"position":[[358,4]]},"699":{"position":[[358,4]]}},"keywords":{}}],["exec_flag",{"_index":1251,"title":{},"content":{"52":{"position":[[851,10],[1079,14],[1394,14],[1567,14]]}},"keywords":{}}],["execut",{"_index":649,"title":{"104":{"position":[[0,10]]},"108":{"position":[[0,10]]},"275":{"position":[[0,10]]},"296":{"position":[[0,10]]},"492":{"position":[[0,10]]},"508":{"position":[[0,10]]}},"content":{"22":{"position":[[463,8],[637,9]]},"31":{"position":[[2655,9],[2803,7]]},"32":{"position":[[1396,7]]},"43":{"position":[[806,7]]},"52":{"position":[[1454,7]]},"53":{"position":[[379,7]]},"66":{"position":[[368,9]]},"72":{"position":[[123,9]]},"83":{"position":[[11,9]]},"93":{"position":[[27,9]]},"95":{"position":[[136,9],[190,9],[471,8]]},"102":{"position":[[453,9]]},"108":{"position":[[327,8]]},"119":{"position":[[1054,8]]},"127":{"position":[[155,9],[509,9],[719,8],[786,8]]},"128":{"position":[[25,8],[292,8],[575,8]]},"174":{"position":[[204,7]]},"175":{"position":[[32,8],[284,10]]},"179":{"position":[[18,7]]},"182":{"position":[[386,10]]},"198":{"position":[[3784,10]]},"218":{"position":[[146,9]]},"221":{"position":[[710,8],[902,9]]},"236":{"position":[[123,9]]},"241":{"position":[[368,9]]},"252":{"position":[[11,9]]},"275":{"position":[[331,8]]},"278":{"position":[[155,9],[509,9],[719,8],[786,8]]},"279":{"position":[[25,8],[292,8],[575,8]]},"285":{"position":[[27,9]]},"287":{"position":[[136,9],[190,9],[471,8]]},"294":{"position":[[453,9]]},"300":{"position":[[1054,8]]},"324":{"position":[[1422,8]]},"360":{"position":[[204,7]]},"361":{"position":[[32,8],[284,10]]},"370":{"position":[[18,7]]},"373":{"position":[[386,10]]},"395":{"position":[[4976,9],[5643,9],[6102,9],[6622,9]]},"416":{"position":[[224,9]]},"434":{"position":[[3766,10]]},"451":{"position":[[146,9]]},"454":{"position":[[710,8],[902,9]]},"466":{"position":[[368,9]]},"472":{"position":[[123,9]]},"476":{"position":[[1591,10]]},"477":{"position":[[2303,7],[2892,9],[3375,9],[3756,9]]},"483":{"position":[[11,9]]},"492":{"position":[[331,8]]},"497":{"position":[[27,9]]},"499":{"position":[[136,9],[190,9],[471,8]]},"506":{"position":[[453,9]]},"515":{"position":[[155,9],[509,9],[719,8],[786,8]]},"516":{"position":[[25,8],[292,8],[575,8]]},"521":{"position":[[1054,8]]},"542":{"position":[[1422,8]]},"576":{"position":[[204,7]]},"577":{"position":[[32,8],[284,10]]},"586":{"position":[[18,7]]},"589":{"position":[[386,10]]},"606":{"position":[[1094,8]]},"611":{"position":[[685,9],[811,9]]},"617":{"position":[[485,7],[562,7],[1304,7]]},"632":{"position":[[4976,9],[5643,9],[6102,9],[6622,9]]},"653":{"position":[[224,9]]},"681":{"position":[[3784,10]]},"691":{"position":[[146,9]]},"694":{"position":[[710,8],[902,9]]},"698":{"position":[[1591,10]]},"699":{"position":[[2303,7],[2892,9],[3375,9],[3756,9]]},"714":{"position":[[1094,8]]},"719":{"position":[[685,9],[811,9]]},"725":{"position":[[485,7],[562,7],[1304,7]]}},"keywords":{}}],["execute_external_call(&self",{"_index":3804,"title":{},"content":{"611":{"position":[[352,32]]},"617":{"position":[[278,32]]},"719":{"position":[[352,32]]},"725":{"position":[[278,32]]}},"keywords":{}}],["execution_error",{"_index":465,"title":{},"content":{"17":{"position":[[393,17],[1532,16],[1915,16],[3972,16]]},"267":{"position":[[1193,16]]},"407":{"position":[[1193,16]]},"644":{"position":[[1193,16]]}},"keywords":{}}],["executionerror",{"_index":1396,"title":{},"content":{"73":{"position":[[513,16]]},"93":{"position":[[145,15]]},"237":{"position":[[513,16]]},"285":{"position":[[145,15]]},"473":{"position":[[513,16]]},"497":{"position":[[145,15]]},"608":{"position":[[65,15]]},"716":{"position":[[65,15]]}},"keywords":{}}],["executionerror::reentrantcall.into",{"_index":1402,"title":{},"content":{"73":{"position":[[748,38]]},"237":{"position":[[748,38]]},"473":{"position":[[748,38]]}},"keywords":{}}],["executor",{"_index":775,"title":{},"content":{"31":{"position":[[1960,9],[2194,8]]},"198":{"position":[[3254,9]]},"434":{"position":[[3236,9]]},"681":{"position":[[3254,9]]}},"keywords":{}}],["executor.transact_cal",{"_index":787,"title":{},"content":{"31":{"position":[[2382,23]]}},"keywords":{}}],["exist",{"_index":612,"title":{},"content":{"20":{"position":[[946,6]]},"44":{"position":[[131,8]]},"50":{"position":[[344,8]]},"98":{"position":[[358,7]]},"111":{"position":[[260,8]]},"121":{"position":[[292,6]]},"126":{"position":[[2631,8]]},"277":{"position":[[2799,8]]},"290":{"position":[[358,7]]},"302":{"position":[[292,6]]},"306":{"position":[[260,8]]},"395":{"position":[[2189,8]]},"502":{"position":[[358,7]]},"511":{"position":[[260,8]]},"514":{"position":[[2631,8]]},"523":{"position":[[292,6]]},"614":{"position":[[293,5]]},"632":{"position":[[2189,8]]},"722":{"position":[[293,5]]}},"keywords":{}}],["exit_reason",{"_index":786,"title":{},"content":{"31":{"position":[[2358,13]]}},"keywords":{}}],["exitreason::succeed(exitsucceed::return",{"_index":792,"title":{},"content":{"31":{"position":[[2699,44]]}},"keywords":{}}],["expand",{"_index":3604,"title":{},"content":{"594":{"position":[[55,6]]},"702":{"position":[[55,6]]}},"keywords":{}}],["expect",{"_index":1130,"title":{},"content":{"43":{"position":[[792,8]]},"52":{"position":[[6452,9],[6675,8]]},"65":{"position":[[560,7]]},"92":{"position":[[839,7]]},"98":{"position":[[96,7]]},"138":{"position":[[1085,9]]},"198":{"position":[[2719,6],[2981,6],[3487,6],[3811,6]]},"212":{"position":[[1233,6]]},"240":{"position":[[560,7]]},"284":{"position":[[839,7]]},"290":{"position":[[96,7]]},"318":{"position":[[1077,9]]},"391":{"position":[[1233,6]]},"434":{"position":[[2709,6],[2963,6],[3469,6],[3793,6]]},"465":{"position":[[560,7]]},"496":{"position":[[839,7]]},"502":{"position":[[96,7]]},"544":{"position":[[1077,9]]},"661":{"position":[[1233,6]]},"681":{"position":[[2719,6],[2981,6],[3487,6],[3811,6]]}},"keywords":{}}],["expect("journ",{"_index":290,"title":{},"content":{"9":{"position":[[864,21]]}},"keywords":{}}],["expect("method",{"_index":269,"title":{},"content":{"9":{"position":[[281,20]]}},"keywords":{}}],["expect("prov",{"_index":276,"title":{},"content":{"9":{"position":[[417,20]]}},"keywords":{}}],["expect("should",{"_index":2675,"title":{},"content":{"212":{"position":[[4199,20],[4372,20]]},"391":{"position":[[4217,20],[4390,20]]},"661":{"position":[[4217,20],[4390,20]]}},"keywords":{}}],["expect("valid",{"_index":283,"title":{},"content":{"9":{"position":[[702,19]]}},"keywords":{}}],["expect.switch",{"_index":2696,"title":{},"content":{"218":{"position":[[182,13]]},"451":{"position":[[182,13]]},"691":{"position":[[182,13]]}},"keywords":{}}],["expens",{"_index":186,"title":{},"content":{"5":{"position":[[264,9]]},"601":{"position":[[2117,10]]},"709":{"position":[[2117,10]]}},"keywords":{}}],["experi",{"_index":1320,"title":{},"content":{"54":{"position":[[397,10]]},"618":{"position":[[298,10]]},"726":{"position":[[298,10]]}},"keywords":{}}],["experienc",{"_index":644,"title":{},"content":{"22":{"position":[[129,11]]}},"keywords":{}}],["expertis",{"_index":390,"title":{},"content":{"12":{"position":[[354,10]]}},"keywords":{}}],["explain",{"_index":1791,"title":{},"content":{"122":{"position":[[109,7]]},"303":{"position":[[109,7]]},"524":{"position":[[109,7]]}},"keywords":{}}],["explicitli",{"_index":3745,"title":{},"content":{"603":{"position":[[205,10]]},"605":{"position":[[309,11]]},"606":{"position":[[849,11]]},"711":{"position":[[205,10]]},"713":{"position":[[309,11]]},"714":{"position":[[849,11]]}},"keywords":{}}],["explicitly.to",{"_index":3618,"title":{},"content":{"596":{"position":[[1104,13]]},"704":{"position":[[1104,13]]}},"keywords":{}}],["exploit",{"_index":1375,"title":{},"content":{"72":{"position":[[38,7]]},"236":{"position":[[38,7]]},"472":{"position":[[38,7]]}},"keywords":{}}],["explor",{"_index":1635,"title":{},"content":{"97":{"position":[[225,7]]},"157":{"position":[[785,7]]},"268":{"position":[[2965,7]]},"270":{"position":[[129,7]]},"289":{"position":[[225,7]]},"330":{"position":[[761,7]]},"385":{"position":[[129,7]]},"396":{"position":[[33,7]]},"398":{"position":[[173,8],[331,7]]},"408":{"position":[[2965,7]]},"410":{"position":[[129,7]]},"501":{"position":[[225,7]]},"547":{"position":[[785,7]]},"618":{"position":[[341,7]]},"627":{"position":[[129,7]]},"633":{"position":[[33,7]]},"635":{"position":[[173,8],[331,7]]},"645":{"position":[[2965,7]]},"647":{"position":[[129,7]]},"726":{"position":[[341,7]]}},"keywords":{}}],["explorer,cspr.l",{"_index":3189,"title":{},"content":{"396":{"position":[[64,19]]},"633":{"position":[[64,19]]}},"keywords":{}}],["export",{"_index":2259,"title":{},"content":{"185":{"position":[[2999,8]]},"376":{"position":[[2983,8]]},"397":{"position":[[67,9]]},"592":{"position":[[2983,8]]},"634":{"position":[[67,9]]}},"keywords":{}}],["expos",{"_index":1061,"title":{},"content":{"42":{"position":[[1317,7],[1792,7]]},"43":{"position":[[1935,7]]},"91":{"position":[[913,6]]},"110":{"position":[[77,8]]},"111":{"position":[[44,7]]},"185":{"position":[[2886,7]]},"189":{"position":[[194,7]]},"209":{"position":[[186,6]]},"221":{"position":[[529,6]]},"283":{"position":[[911,6]]},"305":{"position":[[77,8]]},"306":{"position":[[44,7]]},"366":{"position":[[194,7]]},"376":{"position":[[2870,7]]},"388":{"position":[[186,6]]},"454":{"position":[[529,6]]},"495":{"position":[[911,6]]},"510":{"position":[[77,8]]},"511":{"position":[[44,7]]},"582":{"position":[[194,7]]},"592":{"position":[[2870,7]]},"658":{"position":[[186,6]]},"694":{"position":[[529,6]]}},"keywords":{}}],["expr",{"_index":997,"title":{},"content":{"39":{"position":[[2797,4],[2816,4]]}},"keywords":{}}],["express",{"_index":915,"title":{},"content":{"39":{"position":[[540,12],[2204,10],[2476,10]]},"81":{"position":[[246,9]]},"232":{"position":[[246,9]]},"463":{"position":[[246,9]]}},"keywords":{}}],["expression::add",{"_index":990,"title":{},"content":{"39":{"position":[[2634,15]]}},"keywords":{}}],["expression::boolliteral(b",{"_index":1007,"title":{},"content":{"39":{"position":[[3084,26]]}},"keywords":{}}],["expression::externalcal",{"_index":1000,"title":{},"content":{"39":{"position":[[2873,24]]}},"keywords":{}}],["expression::incr",{"_index":996,"title":{},"content":{"39":{"position":[[2773,21]]}},"keywords":{}}],["expression::requir",{"_index":985,"title":{},"content":{"39":{"position":[[2489,19]]}},"keywords":{}}],["expression::subtract",{"_index":994,"title":{},"content":{"39":{"position":[[2701,20]]}},"keywords":{}}],["expression::typ",{"_index":1004,"title":{},"content":{"39":{"position":[[2979,16]]}},"keywords":{}}],["expression::zeroaddress",{"_index":988,"title":{},"content":{"39":{"position":[[2580,23]]}},"keywords":{}}],["extend",{"_index":3855,"title":{},"content":{"613":{"position":[[1658,7]]},"721":{"position":[[1658,7]]}},"keywords":{}}],["extens",{"_index":2282,"title":{},"content":{"187":{"position":[[68,11]]},"188":{"position":[[252,11],[629,10]]},"189":{"position":[[565,9]]},"364":{"position":[[68,11]]},"365":{"position":[[609,11],[986,10]]},"366":{"position":[[565,9]]},"580":{"position":[[68,11]]},"581":{"position":[[609,11],[986,10]]},"582":{"position":[[565,9]]}},"keywords":{}}],["extern",{"_index":818,"title":{},"content":{"32":{"position":[[215,6]]},"72":{"position":[[336,8]]},"128":{"position":[[532,8]]},"141":{"position":[[697,8],[1120,8]]},"143":{"position":[[716,8]]},"189":{"position":[[209,8]]},"236":{"position":[[336,8]]},"267":{"position":[[3499,8],[3554,8],[3641,8]]},"279":{"position":[[532,8]]},"326":{"position":[[697,8],[1120,8]]},"328":{"position":[[691,8]]},"366":{"position":[[209,8]]},"407":{"position":[[3499,8],[3554,8],[3641,8]]},"472":{"position":[[336,8]]},"516":{"position":[[532,8]]},"535":{"position":[[697,8],[1120,8]]},"537":{"position":[[691,8]]},"582":{"position":[[209,8]]},"617":{"position":[[500,8],[577,8],[963,8]]},"644":{"position":[[3499,8],[3554,8],[3641,8]]},"725":{"position":[[500,8],[577,8],[963,8]]}},"keywords":{}}],["externalcallsregist",{"_index":982,"title":{},"content":{"39":{"position":[[2418,21]]}},"keywords":{}}],["extra",{"_index":1610,"title":{},"content":{"93":{"position":[[105,5]]},"285":{"position":[[105,5]]},"497":{"position":[[105,5]]}},"keywords":{}}],["extract",{"_index":285,"title":{},"content":{"9":{"position":[[758,7]]},"70":{"position":[[88,9]]},"71":{"position":[[82,7]]},"143":{"position":[[830,7]]},"162":{"position":[[2296,7]]},"234":{"position":[[88,9]]},"235":{"position":[[82,7]]},"268":{"position":[[1909,7]]},"328":{"position":[[805,7]]},"351":{"position":[[2318,7]]},"393":{"position":[[165,7]]},"408":{"position":[[1909,7]]},"470":{"position":[[88,9]]},"471":{"position":[[82,7]]},"476":{"position":[[675,7]]},"477":{"position":[[332,7]]},"537":{"position":[[805,7]]},"567":{"position":[[2318,7]]},"630":{"position":[[165,7]]},"645":{"position":[[1909,7]]},"698":{"position":[[675,7]]},"699":{"position":[[332,7]]}},"keywords":{}}],["extrem",{"_index":2320,"title":{},"content":{"195":{"position":[[645,9]]},"220":{"position":[[22,9]]},"431":{"position":[[645,9]]},"453":{"position":[[22,9]]},"678":{"position":[[645,9]]},"693":{"position":[[22,9]]}},"keywords":{}}],["f",{"_index":3821,"title":{},"content":{"612":{"position":[[1219,1],[1292,1]]},"720":{"position":[[1219,1],[1292,1]]}},"keywords":{}}],["fact",{"_index":1698,"title":{},"content":{"107":{"position":[[413,4]]},"124":{"position":[[118,4]]},"163":{"position":[[1508,4]]},"274":{"position":[[413,4]]},"309":{"position":[[118,4]]},"352":{"position":[[1530,4]]},"491":{"position":[[413,4]]},"526":{"position":[[118,4]]},"568":{"position":[[1530,4]]}},"keywords":{}}],["factor",{"_index":230,"title":{},"content":{"8":{"position":[[92,7],[441,8]]},"9":{"position":[[969,7]]}},"keywords":{}}],["factors"",{"_index":249,"title":{},"content":{"8":{"position":[[493,14]]}},"keywords":{}}],["fail",{"_index":2280,"title":{},"content":{"185":{"position":[[3981,4]]},"194":{"position":[[216,5]]},"197":{"position":[[1678,4]]},"198":{"position":[[3500,5]]},"206":{"position":[[3613,6]]},"268":{"position":[[2040,7],[2241,5]]},"376":{"position":[[3965,4]]},"408":{"position":[[2040,7],[2241,5]]},"426":{"position":[[3588,6]]},"430":{"position":[[216,5]]},"433":{"position":[[1677,4]]},"434":{"position":[[3482,5]]},"440":{"position":[[5819,7],[5948,5]]},"592":{"position":[[3965,4]]},"617":{"position":[[591,6]]},"645":{"position":[[2040,7],[2241,5]]},"668":{"position":[[3613,6]]},"677":{"position":[[216,5]]},"680":{"position":[[1677,4]]},"681":{"position":[[3500,5]]},"687":{"position":[[5819,7],[5948,5]]},"725":{"position":[[591,6]]}},"keywords":{}}],["failur",{"_index":3923,"title":{},"content":{"617":{"position":[[1227,7]]},"725":{"position":[[1227,7]]}},"keywords":{}}],["fallback",{"_index":3856,"title":{"614":{"position":[[0,8]]},"722":{"position":[[0,8]]}},"content":{"614":{"position":[[74,10],[187,10],[370,10]]},"722":{"position":[[74,10],[187,10],[370,10]]}},"keywords":{}}],["fals",{"_index":1846,"title":{},"content":{"126":{"position":[[3654,5]]},"131":{"position":[[321,5],[420,5]]},"185":{"position":[[2329,7]]},"221":{"position":[[660,7]]},"265":{"position":[[727,5],[830,5]]},"277":{"position":[[3822,5]]},"311":{"position":[[373,5],[472,5]]},"323":{"position":[[1986,5],[2256,6],[3011,5],[3216,5],[3429,5],[3565,5],[3699,5]]},"376":{"position":[[2313,7]]},"395":{"position":[[2727,5],[2815,5],[2994,5],[3101,5],[3279,5],[3379,5]]},"405":{"position":[[727,5],[830,5]]},"454":{"position":[[660,7]]},"477":{"position":[[893,5],[1247,5]]},"514":{"position":[[3654,5]]},"528":{"position":[[373,5],[472,5]]},"541":{"position":[[1986,5],[2256,6],[3011,5],[3216,5],[3429,5],[3565,5],[3699,5]]},"592":{"position":[[2313,7]]},"602":{"position":[[1371,6]]},"632":{"position":[[2727,5],[2815,5],[2994,5],[3101,5],[3279,5],[3379,5]]},"642":{"position":[[727,5],[830,5]]},"694":{"position":[[660,7]]},"699":{"position":[[893,5],[1247,5]]},"710":{"position":[[1371,6]]}},"keywords":{}}],["famili",{"_index":956,"title":{},"content":{"39":{"position":[[1644,7]]}},"keywords":{}}],["familiar",{"_index":630,"title":{},"content":{"21":{"position":[[226,8]]},"38":{"position":[[516,8],[653,8]]},"53":{"position":[[1082,8]]},"618":{"position":[[584,8]]},"726":{"position":[[584,8]]}},"keywords":{}}],["famousflipp",{"_index":2019,"title":{},"content":{"155":{"position":[[102,13]]},"340":{"position":[[102,13]]},"560":{"position":[[102,13]]}},"keywords":{}}],["fantast",{"_index":1291,"title":{},"content":{"52":{"position":[[4676,10]]}},"keywords":{}}],["far",{"_index":410,"title":{},"content":{"15":{"position":[[296,3]]}},"keywords":{}}],["fascin",{"_index":595,"title":{},"content":{"20":{"position":[[535,11]]}},"keywords":{}}],["fast",{"_index":70,"title":{},"content":{"1":{"position":[[883,4]]}},"keywords":{}}],["faster",{"_index":1776,"title":{},"content":{"119":{"position":[[160,6]]},"300":{"position":[[160,6]]},"521":{"position":[[160,6]]}},"keywords":{}}],["faucet",{"_index":3111,"title":{},"content":{"394":{"position":[[108,7],[202,7],[235,7]]},"397":{"position":[[59,7]]},"631":{"position":[[108,7],[202,7],[235,7]]},"634":{"position":[[59,7]]}},"keywords":{}}],["featur",{"_index":157,"title":{"193":{"position":[[10,9]]},"197":{"position":[[0,8]]},"201":{"position":[[10,9]]},"421":{"position":[[10,9]]},"429":{"position":[[10,9]]},"433":{"position":[[0,8]]},"663":{"position":[[10,9]]},"676":{"position":[[10,9]]},"680":{"position":[[0,8]]}},"content":{"3":{"position":[[567,7],[666,7]]},"16":{"position":[[454,8]]},"17":{"position":[[212,8]]},"42":{"position":[[495,8]]},"54":{"position":[[227,8]]},"68":{"position":[[128,7],[552,8]]},"76":{"position":[[34,9]]},"81":{"position":[[17,8]]},"88":{"position":[[178,7],[278,8],[370,8]]},"90":{"position":[[66,9]]},"110":{"position":[[86,8]]},"114":{"position":[[24,7]]},"115":{"position":[[3263,8]]},"119":{"position":[[203,8]]},"126":{"position":[[3614,8]]},"127":{"position":[[73,7]]},"143":{"position":[[895,9]]},"189":{"position":[[286,7]]},"193":{"position":[[68,9]]},"201":{"position":[[68,9]]},"202":{"position":[[11,8]]},"205":{"position":[[69,8]]},"227":{"position":[[34,9]]},"232":{"position":[[17,8]]},"243":{"position":[[128,7],[552,8]]},"248":{"position":[[96,8]]},"250":{"position":[[178,7],[278,8],[370,8]]},"257":{"position":[[24,7]]},"258":{"position":[[3189,8]]},"265":{"position":[[79,8],[109,8],[138,8]]},"267":{"position":[[142,8]]},"268":{"position":[[139,8]]},"270":{"position":[[366,8]]},"277":{"position":[[3782,8]]},"278":{"position":[[73,7]]},"282":{"position":[[66,9]]},"300":{"position":[[203,8]]},"305":{"position":[[86,8]]},"328":{"position":[[870,9]]},"366":{"position":[[286,7]]},"385":{"position":[[366,8]]},"395":{"position":[[2462,7],[2693,8],[2716,8],[2781,8],[2804,8],[2960,8],[2983,8],[3067,8],[3090,8],[3109,10],[3483,8],[4422,8]]},"405":{"position":[[79,8],[109,8],[138,8]]},"407":{"position":[[142,8]]},"408":{"position":[[139,8]]},"410":{"position":[[366,8]]},"421":{"position":[[68,9]]},"422":{"position":[[11,8]]},"425":{"position":[[69,8]]},"429":{"position":[[68,9]]},"438":{"position":[[53,9]]},"442":{"position":[[134,9]]},"447":{"position":[[96,8]]},"458":{"position":[[34,9]]},"463":{"position":[[17,8]]},"468":{"position":[[128,7],[552,8]]},"477":{"position":[[882,8],[1022,10],[1207,8]]},"480":{"position":[[24,7]]},"481":{"position":[[3189,8]]},"488":{"position":[[178,7],[278,8],[370,8]]},"494":{"position":[[66,9]]},"510":{"position":[[86,8]]},"514":{"position":[[3614,8]]},"515":{"position":[[73,7]]},"521":{"position":[[203,8]]},"537":{"position":[[870,9]]},"582":{"position":[[286,7]]},"610":{"position":[[915,8]]},"613":{"position":[[1748,9]]},"617":{"position":[[792,7]]},"618":{"position":[[363,9]]},"627":{"position":[[366,8]]},"632":{"position":[[2462,7],[2693,8],[2716,8],[2781,8],[2804,8],[2960,8],[2983,8],[3067,8],[3090,8],[3109,10],[3483,8],[4422,8]]},"642":{"position":[[79,8],[109,8],[138,8]]},"644":{"position":[[142,8]]},"645":{"position":[[139,8]]},"647":{"position":[[366,8]]},"663":{"position":[[68,9]]},"664":{"position":[[11,8]]},"667":{"position":[[69,8]]},"674":{"position":[[96,8]]},"676":{"position":[[68,9]]},"685":{"position":[[53,9]]},"689":{"position":[[134,9]]},"699":{"position":[[882,8],[1022,10],[1207,8]]},"718":{"position":[[915,8]]},"721":{"position":[[1748,9]]},"725":{"position":[[792,7]]},"726":{"position":[[363,9]]}},"keywords":{}}],["features=liven",{"_index":1875,"title":{},"content":{"129":{"position":[[619,15]]}},"keywords":{}}],["features=livenet",{"_index":1848,"title":{},"content":{"127":{"position":[[125,16]]},"278":{"position":[[125,16]]},"280":{"position":[[619,16]]},"477":{"position":[[2535,16]]},"515":{"position":[[125,16]]},"517":{"position":[[619,16]]},"699":{"position":[[2535,16]]}},"keywords":{}}],["feedback",{"_index":68,"title":{},"content":{"1":{"position":[[864,8]]},"3":{"position":[[4,8]]}},"keywords":{}}],["feel",{"_index":632,"title":{},"content":{"21":{"position":[[268,4]]},"175":{"position":[[591,4]]},"361":{"position":[[591,4]]},"398":{"position":[[318,4]]},"577":{"position":[[591,4]]},"618":{"position":[[711,4]]},"635":{"position":[[318,4]]},"726":{"position":[[711,4]]}},"keywords":{}}],["few",{"_index":61,"title":{},"content":{"1":{"position":[[805,3]]},"2":{"position":[[92,3]]},"44":{"position":[[84,3]]},"91":{"position":[[276,3]]},"115":{"position":[[1789,3]]},"157":{"position":[[28,3]]},"193":{"position":[[59,3]]},"201":{"position":[[59,3]]},"247":{"position":[[1557,3]]},"258":{"position":[[1735,3]]},"283":{"position":[[276,3]]},"330":{"position":[[28,3]]},"398":{"position":[[265,3]]},"421":{"position":[[59,3]]},"429":{"position":[[59,3]]},"446":{"position":[[1557,3]]},"481":{"position":[[1735,3]]},"495":{"position":[[276,3]]},"547":{"position":[[28,3]]},"635":{"position":[[265,3]]},"663":{"position":[[59,3]]},"673":{"position":[[1557,3]]},"676":{"position":[[59,3]]}},"keywords":{}}],["ffi.support",{"_index":387,"title":{},"content":{"12":{"position":[[251,14]]}},"keywords":{}}],["fibonacci",{"_index":440,"title":{},"content":{"16":{"position":[[259,9]]},"30":{"position":[[125,9]]}},"keywords":{}}],["fibonacci(10",{"_index":802,"title":{},"content":{"31":{"position":[[3078,14]]}},"keywords":{}}],["fibonacci(4",{"_index":837,"title":{},"content":{"32":{"position":[[1072,12],[1808,12]]}},"keywords":{}}],["fibonacci(n",{"_index":698,"title":{},"content":{"30":{"position":[[372,11],[391,11]]}},"keywords":{}}],["fibonacci(uint256",{"_index":696,"title":{},"content":{"30":{"position":[[281,17]]}},"keywords":{}}],["fibonacci_work",{"_index":806,"title":{},"content":{"31":{"position":[[3162,17]]}},"keywords":{}}],["field",{"_index":963,"title":{"324":{"position":[[7,7]]},"542":{"position":[[7,7]]}},"content":{"39":{"position":[[1929,7]]},"84":{"position":[[333,7],[675,7]]},"146":{"position":[[482,6],[512,6]]},"165":{"position":[[323,5]]},"209":{"position":[[339,5]]},"253":{"position":[[333,7],[675,7]]},"334":{"position":[[486,6],[516,6]]},"354":{"position":[[387,5],[660,5]]},"383":{"position":[[731,6]]},"388":{"position":[[339,5]]},"416":{"position":[[328,6]]},"484":{"position":[[333,7],[675,7]]},"551":{"position":[[486,6],[516,6]]},"570":{"position":[[387,5],[660,5]]},"610":{"position":[[603,7]]},"625":{"position":[[731,6]]},"653":{"position":[[328,6]]},"658":{"position":[[339,5]]},"718":{"position":[[603,7]]}},"keywords":{}}],["file",{"_index":1012,"title":{},"content":{"39":{"position":[[3299,5]]},"42":{"position":[[1433,5],[1580,4],[2639,4]]},"43":{"position":[[1655,4]]},"52":{"position":[[26,5],[2259,5]]},"65":{"position":[[410,5],[420,4],[683,5]]},"66":{"position":[[30,5],[136,5],[292,4]]},"96":{"position":[[174,5]]},"100":{"position":[[237,4]]},"117":{"position":[[325,4]]},"118":{"position":[[136,4],[250,4],[298,5]]},"119":{"position":[[433,6]]},"120":{"position":[[185,5]]},"121":{"position":[[175,4]]},"122":{"position":[[52,5]]},"126":{"position":[[308,4],[366,5],[401,4],[1293,5],[3510,5]]},"127":{"position":[[204,5]]},"129":{"position":[[217,4],[399,4],[450,4],[495,5],[542,5],[699,4],[747,5]]},"131":{"position":[[38,5]]},"132":{"position":[[12,4]]},"133":{"position":[[45,5]]},"134":{"position":[[116,6]]},"135":{"position":[[0,5]]},"136":{"position":[[5,5],[99,5],[189,5],[248,5]]},"154":{"position":[[279,4]]},"173":{"position":[[538,6]]},"210":{"position":[[249,5]]},"240":{"position":[[410,5],[420,4],[683,5]]},"241":{"position":[[30,5],[136,5],[292,4]]},"264":{"position":[[239,5],[322,5],[442,5],[473,6]]},"265":{"position":[[43,5],[385,4]]},"266":{"position":[[48,4]]},"267":{"position":[[836,7]]},"277":{"position":[[308,4],[366,5],[401,4],[1461,5],[3678,5]]},"278":{"position":[[204,5]]},"280":{"position":[[217,4],[399,4],[450,4],[495,5],[542,5],[700,4],[748,5]]},"288":{"position":[[174,5]]},"292":{"position":[[237,4]]},"298":{"position":[[325,4]]},"299":{"position":[[136,4],[250,4],[298,5]]},"300":{"position":[[433,6]]},"301":{"position":[[185,5]]},"302":{"position":[[175,4]]},"303":{"position":[[52,5]]},"311":{"position":[[38,5]]},"312":{"position":[[12,4]]},"313":{"position":[[45,5]]},"314":{"position":[[116,6]]},"315":{"position":[[0,5]]},"316":{"position":[[5,5],[99,5],[189,5],[248,5]]},"323":{"position":[[88,4]]},"324":{"position":[[451,5],[1490,5]]},"339":{"position":[[279,4]]},"359":{"position":[[538,6]]},"382":{"position":[[136,4],[255,5],[286,6]]},"389":{"position":[[249,5]]},"395":{"position":[[187,4],[2421,5],[3636,4],[4128,4]]},"404":{"position":[[239,5],[322,5],[442,5],[473,6]]},"405":{"position":[[43,5],[385,4]]},"406":{"position":[[48,4]]},"407":{"position":[[836,7]]},"414":{"position":[[823,5]]},"465":{"position":[[410,5],[420,4],[683,5]]},"466":{"position":[[30,5],[136,5],[292,4]]},"477":{"position":[[249,4]]},"500":{"position":[[174,5]]},"504":{"position":[[237,4]]},"514":{"position":[[308,4],[366,5],[401,4],[1293,5],[3510,5]]},"515":{"position":[[204,5]]},"517":{"position":[[217,4],[399,4],[450,4],[495,5],[542,5],[700,4],[748,5]]},"519":{"position":[[325,4]]},"520":{"position":[[136,4],[250,4],[298,5]]},"521":{"position":[[433,6]]},"522":{"position":[[185,5]]},"523":{"position":[[175,4]]},"524":{"position":[[52,5]]},"528":{"position":[[38,5]]},"529":{"position":[[12,4]]},"530":{"position":[[45,5]]},"531":{"position":[[116,6]]},"532":{"position":[[0,5]]},"533":{"position":[[5,5],[99,5],[189,5],[248,5]]},"541":{"position":[[88,4]]},"542":{"position":[[451,5],[1490,5]]},"559":{"position":[[279,4]]},"575":{"position":[[538,6]]},"624":{"position":[[136,4],[255,5],[286,6]]},"632":{"position":[[187,4],[2421,5],[3636,4],[4128,4]]},"641":{"position":[[239,5],[322,5],[442,5],[473,6]]},"642":{"position":[[43,5],[385,4]]},"643":{"position":[[48,4]]},"644":{"position":[[836,7]]},"651":{"position":[[823,5]]},"659":{"position":[[249,5]]},"699":{"position":[[249,4]]}},"keywords":{}}],["file.contract_nam",{"_index":3046,"title":{},"content":{"324":{"position":[[222,18]]},"542":{"position":[[222,18]]}},"keywords":{}}],["fill",{"_index":2249,"title":{},"content":{"185":{"position":[[2557,6]]},"376":{"position":[[2541,6]]},"592":{"position":[[2541,6]]}},"keywords":{}}],["final",{"_index":718,"title":{},"content":{"31":{"position":[[202,8]]},"32":{"position":[[488,5]]},"43":{"position":[[1767,8]]},"52":{"position":[[6440,8]]},"85":{"position":[[956,8]]},"146":{"position":[[692,8]]},"154":{"position":[[291,7]]},"196":{"position":[[1567,8]]},"210":{"position":[[1049,8]]},"222":{"position":[[0,8],[553,7]]},"248":{"position":[[193,8]]},"254":{"position":[[956,8]]},"334":{"position":[[696,8]]},"339":{"position":[[291,7]]},"389":{"position":[[986,8]]},"395":{"position":[[3614,8]]},"432":{"position":[[1445,8]]},"440":{"position":[[4485,8]]},"447":{"position":[[193,8]]},"455":{"position":[[0,8],[553,7]]},"485":{"position":[[956,8]]},"551":{"position":[[696,8]]},"559":{"position":[[291,7]]},"632":{"position":[[3614,8]]},"659":{"position":[[986,8]]},"674":{"position":[[193,8]]},"679":{"position":[[1445,8]]},"687":{"position":[[4485,8]]},"695":{"position":[[0,8],[553,7]]}},"keywords":{}}],["find",{"_index":223,"title":{},"content":{"7":{"position":[[77,4]]},"26":{"position":[[47,4]]},"28":{"position":[[47,4]]},"36":{"position":[[47,4]]},"46":{"position":[[47,4]]},"48":{"position":[[47,4]]},"53":{"position":[[1274,4]]},"57":{"position":[[47,4]]},"59":{"position":[[47,4]]},"61":{"position":[[48,4]]},"63":{"position":[[48,4]]},"108":{"position":[[303,5]]},"126":{"position":[[1187,4]]},"214":{"position":[[48,4]]},"216":{"position":[[48,4]]},"225":{"position":[[48,4]]},"264":{"position":[[275,4]]},"275":{"position":[[307,5]]},"277":{"position":[[1355,4]]},"382":{"position":[[103,4]]},"395":{"position":[[4321,4]]},"396":{"position":[[141,4]]},"404":{"position":[[275,4]]},"449":{"position":[[48,4]]},"492":{"position":[[307,5]]},"514":{"position":[[1187,4]]},"618":{"position":[[551,4]]},"624":{"position":[[103,4]]},"632":{"position":[[4321,4]]},"633":{"position":[[141,4]]},"641":{"position":[[275,4]]},"726":{"position":[[551,4]]}},"keywords":{}}],["fine",{"_index":2154,"title":{},"content":{"174":{"position":[[381,5]]},"360":{"position":[[381,5]]},"576":{"position":[[381,5]]}},"keywords":{}}],["finish",{"_index":1785,"title":{},"content":{"120":{"position":[[157,8]]},"212":{"position":[[2283,6]]},"301":{"position":[[157,8]]},"391":{"position":[[2283,6]]},"417":{"position":[[845,6]]},"419":{"position":[[7260,6]]},"522":{"position":[[157,8]]},"654":{"position":[[845,6]]},"656":{"position":[[7260,6]]},"661":{"position":[[2283,6]]}},"keywords":{}}],["finish_tim",{"_index":3252,"title":{},"content":{"416":{"position":[[3719,11],[3845,11]]},"419":{"position":[[5298,11],[5424,11],[6286,11],[6412,11]]},"653":{"position":[[3719,11],[3845,11]]},"656":{"position":[[5298,11],[5424,11],[6286,11],[6412,11]]}},"keywords":{}}],["first",{"_index":241,"title":{},"content":{"8":{"position":[[268,5]]},"9":{"position":[[175,6]]},"11":{"position":[[88,5]]},"20":{"position":[[323,5]]},"21":{"position":[[9,5]]},"31":{"position":[[3024,6]]},"32":{"position":[[21,5]]},"40":{"position":[[396,5]]},"42":{"position":[[250,5]]},"51":{"position":[[343,6],[1795,5]]},"52":{"position":[[1763,6]]},"91":{"position":[[18,5]]},"92":{"position":[[4,5],[128,5],[447,6]]},"94":{"position":[[265,5]]},"97":{"position":[[237,5]]},"104":{"position":[[0,5]]},"117":{"position":[[48,5]]},"119":{"position":[[675,5]]},"129":{"position":[[419,6]]},"131":{"position":[[6,5]]},"143":{"position":[[738,5]]},"196":{"position":[[1405,5],[1680,5]]},"198":{"position":[[1282,5],[2111,5],[2184,5],[2881,5]]},"203":{"position":[[369,5]]},"204":{"position":[[1002,5]]},"210":{"position":[[0,6]]},"211":{"position":[[81,5]]},"212":{"position":[[1329,5]]},"247":{"position":[[1909,6]]},"267":{"position":[[4274,5]]},"280":{"position":[[419,6]]},"283":{"position":[[18,5]]},"284":{"position":[[4,5],[128,5],[447,6]]},"286":{"position":[[265,5]]},"289":{"position":[[237,5]]},"296":{"position":[[0,5]]},"298":{"position":[[48,5]]},"300":{"position":[[675,5]]},"311":{"position":[[6,5]]},"324":{"position":[[815,5]]},"328":{"position":[[713,5]]},"389":{"position":[[0,6]]},"390":{"position":[[81,5]]},"391":{"position":[[1329,5]]},"396":{"position":[[4,5]]},"407":{"position":[[4274,5]]},"423":{"position":[[369,5]]},"424":{"position":[[953,5]]},"432":{"position":[[1347,5],[1558,5]]},"434":{"position":[[1272,5],[2101,5],[2174,5],[2871,5]]},"440":{"position":[[5831,5]]},"446":{"position":[[1909,6]]},"495":{"position":[[18,5]]},"496":{"position":[[4,5],[128,5],[447,6]]},"498":{"position":[[265,5]]},"501":{"position":[[237,5]]},"508":{"position":[[0,5]]},"517":{"position":[[419,6]]},"519":{"position":[[48,5]]},"521":{"position":[[675,5]]},"528":{"position":[[6,5]]},"537":{"position":[[713,5]]},"542":{"position":[[815,5]]},"605":{"position":[[458,5]]},"609":{"position":[[44,5]]},"633":{"position":[[4,5]]},"644":{"position":[[4274,5]]},"659":{"position":[[0,6]]},"660":{"position":[[81,5]]},"661":{"position":[[1329,5]]},"665":{"position":[[369,5]]},"666":{"position":[[953,5]]},"673":{"position":[[1909,6]]},"679":{"position":[[1347,5],[1558,5]]},"681":{"position":[[1282,5],[2111,5],[2184,5],[2881,5]]},"687":{"position":[[5831,5]]},"713":{"position":[[458,5]]},"717":{"position":[[44,5]]}},"keywords":{}}],["first.guest",{"_index":226,"title":{},"content":{"7":{"position":[[180,11]]}},"keywords":{}}],["firstli",{"_index":904,"title":{},"content":{"39":{"position":[[272,8]]},"79":{"position":[[1347,8]]},"100":{"position":[[120,7]]},"129":{"position":[[666,7]]},"185":{"position":[[2449,8]]},"195":{"position":[[250,8]]},"230":{"position":[[1364,8]]},"280":{"position":[[667,7]]},"292":{"position":[[120,7]]},"376":{"position":[[2433,8]]},"431":{"position":[[250,8]]},"461":{"position":[[1364,8]]},"504":{"position":[[120,7]]},"517":{"position":[[667,7]]},"592":{"position":[[2433,8]]},"678":{"position":[[250,8]]}},"keywords":{}}],["fit",{"_index":1554,"title":{},"content":{"85":{"position":[[991,3]]},"254":{"position":[[991,3]]},"485":{"position":[[991,3]]}},"keywords":{}}],["fix",{"_index":3468,"title":{},"content":{"440":{"position":[[6524,3]]},"601":{"position":[[1980,5]]},"687":{"position":[[6524,3]]},"709":{"position":[[1980,5]]}},"keywords":{}}],["flag",{"_index":1221,"title":{},"content":{"51":{"position":[[1936,5]]},"179":{"position":[[90,4]]},"265":{"position":[[147,4]]},"322":{"position":[[92,4]]},"370":{"position":[[90,4]]},"405":{"position":[[147,4]]},"540":{"position":[[92,4]]},"586":{"position":[[90,4]]},"642":{"position":[[147,4]]}},"keywords":{}}],["flatten",{"_index":873,"title":{},"content":{"38":{"position":[[574,7]]},"267":{"position":[[851,7]]},"407":{"position":[[851,7]]},"594":{"position":[[587,8]]},"644":{"position":[[851,7]]},"702":{"position":[[587,8]]}},"keywords":{}}],["flexibl",{"_index":148,"title":{},"content":{"3":{"position":[[435,12]]},"33":{"position":[[155,8]]},"81":{"position":[[388,8]]},"232":{"position":[[388,8]]},"463":{"position":[[388,8]]},"612":{"position":[[2071,8]]},"720":{"position":[[2071,8]]}},"keywords":{}}],["flip",{"_index":662,"title":{"178":{"position":[[6,5]]},"369":{"position":[[6,5]]},"585":{"position":[[6,5]]}},"content":{"22":{"position":[[983,6]]},"148":{"position":[[119,10]]},"178":{"position":[[1125,10]]},"336":{"position":[[119,10]]},"369":{"position":[[1125,10]]},"553":{"position":[[119,10]]},"585":{"position":[[1125,10]]}},"keywords":{}}],["flip(&mut",{"_index":482,"title":{},"content":{"17":{"position":[[808,13]]},"22":{"position":[[1261,13]]},"147":{"position":[[1204,13]]},"178":{"position":[[791,13]]},"335":{"position":[[1212,13]]},"369":{"position":[[791,13]]},"552":{"position":[[1212,13]]},"585":{"position":[[791,13]]}},"keywords":{}}],["flipper",{"_index":466,"title":{"144":{"position":[[0,7]]},"177":{"position":[[0,7]]},"332":{"position":[[0,7]]},"368":{"position":[[0,7]]},"549":{"position":[[0,7]]},"584":{"position":[[0,7]]}},"content":{"17":{"position":[[438,7],[618,7]]},"22":{"position":[[855,7],[1101,7],[1163,7]]},"26":{"position":[[29,7]]},"28":{"position":[[29,7]]},"36":{"position":[[29,7]]},"46":{"position":[[29,7]]},"48":{"position":[[29,7]]},"57":{"position":[[29,7]]},"59":{"position":[[29,7]]},"61":{"position":[[29,7]]},"63":{"position":[[29,7]]},"146":{"position":[[138,7]]},"147":{"position":[[155,7]]},"176":{"position":[[81,7]]},"178":{"position":[[152,7],[439,7]]},"214":{"position":[[29,7]]},"216":{"position":[[29,7]]},"225":{"position":[[29,7]]},"334":{"position":[[138,7]]},"335":{"position":[[155,7]]},"362":{"position":[[81,7]]},"369":{"position":[[152,7],[439,7]]},"449":{"position":[[29,7]]},"551":{"position":[[138,7]]},"552":{"position":[[155,7]]},"578":{"position":[[81,7]]},"585":{"position":[[152,7],[439,7]]}},"keywords":{}}],["flipper.r",{"_index":461,"title":{},"content":{"17":{"position":[[322,10]]},"145":{"position":[[0,10]]},"146":{"position":[[0,10]]},"147":{"position":[[0,10],[1003,10]]},"148":{"position":[[0,10]]},"178":{"position":[[0,10]]},"333":{"position":[[0,10]]},"334":{"position":[[0,10]]},"335":{"position":[[0,10],[1011,10]]},"336":{"position":[[0,10]]},"369":{"position":[[0,10]]},"550":{"position":[[0,10]]},"551":{"position":[[0,10]]},"552":{"position":[[0,10],[1011,10]]},"553":{"position":[[0,10]]},"585":{"position":[[0,10]]}},"keywords":{}}],["flipperhostref",{"_index":2002,"title":{},"content":{"148":{"position":[[216,16],[593,14]]},"178":{"position":[[1222,16]]},"336":{"position":[[216,16],[593,14]]},"369":{"position":[[1222,16]]},"553":{"position":[[216,16],[593,14]]},"585":{"position":[[1222,16]]}},"keywords":{}}],["flipperhostref::deploy(&env",{"_index":2003,"title":{},"content":{"148":{"position":[[323,32]]},"178":{"position":[[1329,32],[1522,32],[1580,32]]},"336":{"position":[[323,32]]},"369":{"position":[[1329,32],[1522,32],[1580,32]]},"553":{"position":[[323,32]]},"585":{"position":[[1329,32],[1522,32],[1580,32]]}},"keywords":{}}],["flips_count",{"_index":468,"title":{},"content":{"17":{"position":[[477,12]]}},"keywords":{}}],["flow",{"_index":672,"title":{},"content":{"22":{"position":[[1502,7]]},"40":{"position":[[471,4]]},"441":{"position":[[286,5]]},"688":{"position":[[286,5]]}},"keywords":{}}],["fn",{"_index":238,"title":{},"content":{"8":{"position":[[244,2]]},"9":{"position":[[105,2]]},"10":{"position":[[871,2],[994,2],[1174,2]]},"17":{"position":[[646,2],[739,2],[805,2],[928,2],[999,2],[1076,2],[1395,2],[2240,2],[2509,2],[2590,2],[2691,2],[3084,2],[3697,2],[3846,2]]},"22":{"position":[[1191,2],[1258,2],[1318,2]]},"31":{"position":[[700,2],[841,2],[3159,2],[3425,2]]},"32":{"position":[[366,2],[540,2],[1106,2]]},"39":{"position":[[2260,2]]},"42":{"position":[[679,2],[2089,4],[2153,2],[2405,2]]},"51":{"position":[[592,2],[708,2],[927,2],[1040,2],[1368,2],[1470,2]]},"71":{"position":[[51,2]]},"73":{"position":[[145,2],[344,2],[538,2]]},"74":{"position":[[179,2],[257,2]]},"79":{"position":[[842,2],[963,2]]},"80":{"position":[[365,2],[444,2],[524,2],[718,2]]},"83":{"position":[[564,2],[622,2]]},"115":{"position":[[337,2],[584,2],[650,2],[737,2],[800,2],[837,2],[876,2],[913,2],[956,2],[1013,2],[1107,2],[1150,2],[1214,2],[2180,2],[2482,2],[2548,2],[2625,2],[2689,2],[2754,2],[2814,2]]},"126":{"position":[[1326,2]]},"138":{"position":[[310,2]]},"141":{"position":[[1257,2]]},"142":{"position":[[265,2]]},"143":{"position":[[256,2],[1054,2],[1226,2]]},"147":{"position":[[249,2],[1079,2],[1201,2]]},"148":{"position":[[116,2]]},"151":{"position":[[200,2]]},"157":{"position":[[258,2]]},"160":{"position":[[281,2]]},"162":{"position":[[768,2],[953,2],[1020,2],[1088,2],[1155,2],[1260,2],[2174,2]]},"163":{"position":[[791,2],[939,2]]},"164":{"position":[[556,2],[622,2],[689,2],[751,2],[826,2]]},"168":{"position":[[496,2],[1562,2]]},"178":{"position":[[555,2],[666,2],[788,2],[954,2],[1122,2],[1449,2]]},"185":{"position":[[527,2],[659,2],[838,2],[1032,2],[1228,2],[1474,2],[1623,2],[1904,2],[2174,2]]},"196":{"position":[[84,2]]},"197":{"position":[[50,2],[208,2],[497,2]]},"198":{"position":[[96,2],[339,2],[556,2],[888,2],[1342,2]]},"204":{"position":[[67,2],[318,2],[385,2],[456,2],[527,2],[623,2]]},"205":{"position":[[290,2],[454,2],[690,2],[931,2],[1041,2],[1199,2],[1626,2]]},"206":{"position":[[268,2],[528,2],[1084,2],[1722,2],[2050,2],[3323,2]]},"209":{"position":[[961,2],[1242,2]]},"212":{"position":[[634,2],[1443,2],[2528,2],[2814,2],[3222,2],[3800,2],[4038,2]]},"221":{"position":[[77,2],[152,2],[261,2]]},"222":{"position":[[94,2],[243,2]]},"223":{"position":[[466,2],[615,2],[671,2],[731,2],[881,2]]},"230":{"position":[[859,2],[980,2]]},"231":{"position":[[365,2],[444,2],[524,2],[718,2]]},"235":{"position":[[51,2]]},"237":{"position":[[145,2],[344,2],[538,2]]},"238":{"position":[[179,2],[257,2]]},"247":{"position":[[102,2],[321,2],[379,2],[441,2],[503,2],[575,2],[673,2],[797,2],[916,2],[1073,2],[1186,2],[1257,2],[1367,2]]},"252":{"position":[[564,2],[622,2]]},"258":{"position":[[327,2],[570,2],[632,2],[715,2],[774,2],[807,2],[842,2],[875,2],[914,2],[967,2],[1057,2],[1096,2],[1160,2],[2126,2],[2424,2],[2486,2],[2559,2],[2619,2],[2680,2],[2740,2]]},"267":{"position":[[2029,2],[2105,2],[2259,2],[2515,2],[2588,2],[2722,2],[2791,4],[2854,2],[3061,2],[3881,2]]},"268":{"position":[[2363,2]]},"269":{"position":[[555,2],[1036,2],[1200,2],[1436,2],[1677,2],[1787,2],[1930,2],[2157,2],[2490,2],[2859,2],[4172,2],[4438,2],[4994,2],[5632,2]]},"277":{"position":[[1494,2]]},"318":{"position":[[302,2]]},"321":{"position":[[1118,2],[1336,2],[1490,2]]},"326":{"position":[[1257,2]]},"327":{"position":[[265,2]]},"328":{"position":[[256,2],[1029,2],[1201,2]]},"330":{"position":[[249,2]]},"335":{"position":[[249,2],[1087,2],[1209,2]]},"336":{"position":[[116,2]]},"342":{"position":[[200,2]]},"345":{"position":[[281,2]]},"348":{"position":[[496,2],[1562,2]]},"351":{"position":[[790,2],[975,2],[1042,2],[1110,2],[1177,2],[1282,2],[2196,2]]},"352":{"position":[[813,2],[961,2]]},"353":{"position":[[591,2],[657,2],[724,2],[786,2],[861,2]]},"369":{"position":[[555,2],[666,2],[788,2],[954,2],[1122,2],[1449,2]]},"376":{"position":[[511,2],[643,2],[822,2],[1016,2],[1212,2],[1458,2],[1607,2],[1888,2],[2158,2]]},"384":{"position":[[568,2],[1049,2],[1213,2],[1449,2],[1690,2],[1807,2],[1950,2],[2177,2],[2517,2],[2893,2]]},"388":{"position":[[893,2],[1174,2]]},"391":{"position":[[634,2],[1443,2],[2528,2],[2820,2],[3240,2],[3818,2],[4056,2]]},"395":{"position":[[536,2],[1770,2],[2216,2]]},"407":{"position":[[2029,2],[2105,2],[2259,2],[2515,2],[2588,2],[2722,2],[2791,4],[2854,2],[3061,2],[3881,2]]},"408":{"position":[[2363,2]]},"409":{"position":[[555,2],[1036,2],[1200,2],[1436,2],[1677,2],[1787,2],[1930,2],[2157,2],[2490,2],[2859,2],[4172,2],[4438,2],[4994,2],[5632,2]]},"414":{"position":[[371,2],[404,2]]},"416":{"position":[[1416,2],[2664,2],[3494,2]]},"417":{"position":[[137,2]]},"419":{"position":[[1367,2],[2181,2],[2349,2],[2419,2],[2505,2],[2581,2],[2666,2],[2803,2],[2969,2],[3102,2],[3247,2],[3382,2],[3538,2],[3696,2],[3821,2],[3935,2],[4619,2],[5073,2],[6145,2],[6552,2]]},"424":{"position":[[42,2],[293,2],[360,2],[431,2],[502,2],[598,2]]},"425":{"position":[[265,2],[429,2],[665,2],[906,2],[1016,2],[1174,2],[1601,2]]},"426":{"position":[[268,2],[528,2],[1079,2],[1712,2],[2040,2],[3298,2]]},"432":{"position":[[46,2]]},"433":{"position":[[50,2],[208,2],[497,2]]},"434":{"position":[[96,2],[339,2],[551,2],[878,2],[1332,2]]},"440":{"position":[[1154,2],[1618,2],[2236,2],[3248,2],[4943,2],[6242,2]]},"441":{"position":[[885,2],[1075,2],[1530,2],[2468,2],[2830,2],[3111,2],[3557,2],[3661,2],[4768,2],[5715,2]]},"446":{"position":[[102,2],[321,2],[379,2],[441,2],[503,2],[575,2],[673,2],[797,2],[916,2],[1073,2],[1186,2],[1257,2],[1367,2]]},"454":{"position":[[77,2],[152,2],[261,2]]},"455":{"position":[[94,2],[243,2]]},"456":{"position":[[466,2],[615,2],[671,2],[731,2],[881,2]]},"461":{"position":[[859,2],[980,2]]},"462":{"position":[[365,2],[444,2],[524,2],[718,2]]},"471":{"position":[[51,2]]},"473":{"position":[[145,2],[344,2],[538,2]]},"474":{"position":[[179,2],[257,2]]},"476":{"position":[[494,2],[644,2],[1218,2],[1346,2],[1473,2]]},"477":{"position":[[1701,2]]},"481":{"position":[[327,2],[570,2],[632,2],[715,2],[774,2],[807,2],[842,2],[875,2],[914,2],[967,2],[1057,2],[1096,2],[1160,2],[2126,2],[2424,2],[2486,2],[2559,2],[2619,2],[2680,2],[2740,2]]},"483":{"position":[[564,2],[622,2]]},"514":{"position":[[1326,2]]},"535":{"position":[[1257,2]]},"536":{"position":[[265,2]]},"537":{"position":[[256,2],[1029,2],[1201,2]]},"539":{"position":[[1118,2],[1336,2],[1490,2]]},"544":{"position":[[302,2]]},"547":{"position":[[258,2]]},"552":{"position":[[249,2],[1087,2],[1209,2]]},"553":{"position":[[116,2]]},"556":{"position":[[200,2]]},"562":{"position":[[281,2]]},"564":{"position":[[496,2],[1562,2]]},"567":{"position":[[790,2],[975,2],[1042,2],[1110,2],[1177,2],[1282,2],[2196,2]]},"568":{"position":[[813,2],[961,2]]},"569":{"position":[[591,2],[657,2],[724,2],[786,2],[861,2]]},"585":{"position":[[555,2],[666,2],[788,2],[954,2],[1122,2],[1449,2]]},"592":{"position":[[511,2],[643,2],[822,2],[1016,2],[1212,2],[1458,2],[1607,2],[1888,2],[2158,2]]},"596":{"position":[[311,2],[384,2]]},"598":{"position":[[682,2],[1149,2],[1232,2],[1317,2],[1461,2]]},"600":{"position":[[191,2],[303,2]]},"601":{"position":[[204,2],[454,2],[545,2],[770,2],[894,2],[1003,2],[1323,2],[1436,2],[1507,2],[1631,2],[1736,2]]},"602":{"position":[[254,2],[322,2],[393,2],[461,2],[1290,2],[1388,2],[1553,2],[1767,2]]},"604":{"position":[[145,2],[317,2]]},"605":{"position":[[128,2],[207,2]]},"606":{"position":[[164,2],[332,2],[474,2]]},"608":{"position":[[188,2],[273,2],[303,2],[337,2],[514,2]]},"610":{"position":[[217,2]]},"611":{"position":[[225,2],[349,2]]},"612":{"position":[[521,2],[668,2],[815,2],[985,2],[1142,2],[1300,2]]},"613":{"position":[[123,2],[383,2],[525,2],[615,2],[945,2]]},"616":{"position":[[193,2],[685,2],[974,2]]},"617":{"position":[[178,2],[275,2],[691,2]]},"626":{"position":[[568,2],[1049,2],[1213,2],[1449,2],[1690,2],[1807,2],[1950,2],[2177,2],[2517,2],[2893,2]]},"632":{"position":[[536,2],[1770,2],[2216,2]]},"644":{"position":[[2029,2],[2105,2],[2259,2],[2515,2],[2588,2],[2722,2],[2791,4],[2854,2],[3061,2],[3881,2]]},"645":{"position":[[2363,2]]},"646":{"position":[[555,2],[1036,2],[1200,2],[1436,2],[1677,2],[1787,2],[1930,2],[2157,2],[2490,2],[2859,2],[4172,2],[4438,2],[4994,2],[5632,2]]},"651":{"position":[[371,2],[404,2]]},"653":{"position":[[1416,2],[2664,2],[3494,2]]},"654":{"position":[[137,2]]},"656":{"position":[[1367,2],[2181,2],[2349,2],[2419,2],[2505,2],[2581,2],[2666,2],[2803,2],[2969,2],[3102,2],[3247,2],[3382,2],[3538,2],[3696,2],[3821,2],[3935,2],[4619,2],[5073,2],[6145,2],[6552,2]]},"658":{"position":[[893,2],[1174,2]]},"661":{"position":[[634,2],[1443,2],[2528,2],[2820,2],[3240,2],[3818,2],[4056,2]]},"666":{"position":[[42,2],[293,2],[360,2],[431,2],[502,2],[598,2]]},"667":{"position":[[265,2],[429,2],[665,2],[906,2],[1016,2],[1174,2],[1601,2]]},"668":{"position":[[268,2],[528,2],[1084,2],[1722,2],[2050,2],[3323,2]]},"673":{"position":[[102,2],[321,2],[379,2],[441,2],[503,2],[575,2],[673,2],[797,2],[916,2],[1073,2],[1186,2],[1257,2],[1367,2]]},"679":{"position":[[46,2]]},"680":{"position":[[50,2],[208,2],[497,2]]},"681":{"position":[[96,2],[339,2],[556,2],[888,2],[1342,2]]},"687":{"position":[[1154,2],[1618,2],[2236,2],[3248,2],[4943,2],[6242,2]]},"688":{"position":[[885,2],[1075,2],[1530,2],[2468,2],[2830,2],[3111,2],[3557,2],[3661,2],[4768,2],[5715,2]]},"694":{"position":[[77,2],[152,2],[261,2]]},"695":{"position":[[94,2],[243,2]]},"696":{"position":[[466,2],[615,2],[671,2],[731,2],[881,2]]},"698":{"position":[[494,2],[644,2],[1218,2],[1346,2],[1473,2]]},"699":{"position":[[1701,2]]},"704":{"position":[[311,2],[384,2]]},"706":{"position":[[682,2],[1149,2],[1232,2],[1317,2],[1461,2]]},"708":{"position":[[191,2],[303,2]]},"709":{"position":[[204,2],[454,2],[545,2],[770,2],[894,2],[1003,2],[1323,2],[1436,2],[1507,2],[1631,2],[1736,2]]},"710":{"position":[[254,2],[322,2],[393,2],[461,2],[1290,2],[1388,2],[1553,2],[1767,2]]},"712":{"position":[[145,2],[317,2]]},"713":{"position":[[128,2],[207,2]]},"714":{"position":[[164,2],[332,2],[474,2]]},"716":{"position":[[188,2],[273,2],[303,2],[337,2],[514,2]]},"718":{"position":[[217,2]]},"719":{"position":[[225,2],[349,2]]},"720":{"position":[[521,2],[668,2],[815,2],[985,2],[1142,2],[1300,2]]},"721":{"position":[[123,2],[383,2],[525,2],[615,2],[945,2]]},"724":{"position":[[193,2],[685,2],[974,2]]},"725":{"position":[[178,2],[275,2],[691,2]]}},"keywords":{}}],["fn_name",{"_index":1001,"title":{},"content":{"39":{"position":[[2910,8],[2958,8]]}},"keywords":{}}],["fncontext",{"_index":984,"title":{},"content":{"39":{"position":[[2457,10]]}},"keywords":{}}],["focu",{"_index":28,"title":{},"content":{"1":{"position":[[280,5],[527,5]]},"22":{"position":[[236,5]]},"38":{"position":[[224,5]]}},"keywords":{}}],["focus",{"_index":869,"title":{},"content":{"38":{"position":[[423,7]]},"365":{"position":[[250,7]]},"581":{"position":[[250,7]]}},"keywords":{}}],["folder",{"_index":1755,"title":{},"content":{"117":{"position":[[218,6],[356,7],[1026,6],[1393,7]]},"120":{"position":[[215,7]]},"121":{"position":[[251,7],[276,6],[314,6]]},"126":{"position":[[420,7],[533,6]]},"133":{"position":[[12,6]]},"134":{"position":[[12,6]]},"164":{"position":[[1238,7]]},"175":{"position":[[123,6]]},"277":{"position":[[420,7],[533,6]]},"298":{"position":[[218,6],[356,7],[1026,6],[1393,7]]},"301":{"position":[[215,7]]},"302":{"position":[[251,7],[276,6],[314,6]]},"313":{"position":[[12,6]]},"314":{"position":[[12,6]]},"353":{"position":[[1273,7]]},"361":{"position":[[123,6]]},"395":{"position":[[203,7]]},"514":{"position":[[420,7],[533,6]]},"519":{"position":[[218,6],[356,7],[1026,6],[1393,7]]},"522":{"position":[[215,7]]},"523":{"position":[[251,7],[276,6],[314,6]]},"530":{"position":[[12,6]]},"531":{"position":[[12,6]]},"569":{"position":[[1273,7]]},"577":{"position":[[123,6]]},"632":{"position":[[203,7]]}},"keywords":{}}],["follow",{"_index":1065,"title":{},"content":{"42":{"position":[[1400,10]]},"65":{"position":[[52,9]]},"67":{"position":[[108,9]]},"68":{"position":[[192,9]]},"79":{"position":[[490,9]]},"97":{"position":[[319,9]]},"103":{"position":[[52,9]]},"115":{"position":[[13,9]]},"162":{"position":[[2432,9]]},"173":{"position":[[49,9]]},"174":{"position":[[216,9]]},"179":{"position":[[30,9]]},"198":{"position":[[2953,8]]},"202":{"position":[[125,9]]},"211":{"position":[[569,8]]},"212":{"position":[[1867,8],[3555,8]]},"230":{"position":[[507,9]]},"240":{"position":[[52,9]]},"242":{"position":[[109,9]]},"243":{"position":[[192,9]]},"258":{"position":[[13,9]]},"261":{"position":[[146,9]]},"289":{"position":[[319,9]]},"295":{"position":[[52,9]]},"322":{"position":[[31,9]]},"351":{"position":[[2454,9]]},"359":{"position":[[49,9]]},"360":{"position":[[216,9]]},"370":{"position":[[30,9]]},"379":{"position":[[146,9]]},"383":{"position":[[116,9]]},"390":{"position":[[543,8]]},"391":{"position":[[1867,8],[3573,8]]},"393":{"position":[[88,6]]},"395":{"position":[[3650,9]]},"401":{"position":[[146,9]]},"422":{"position":[[125,9]]},"434":{"position":[[2935,8]]},"438":{"position":[[43,9]]},"440":{"position":[[4619,8]]},"461":{"position":[[507,9]]},"465":{"position":[[52,9]]},"467":{"position":[[109,9]]},"468":{"position":[[192,9]]},"477":{"position":[[2315,9]]},"481":{"position":[[13,9]]},"501":{"position":[[319,9]]},"507":{"position":[[52,9]]},"540":{"position":[[31,9]]},"567":{"position":[[2454,9]]},"575":{"position":[[49,9]]},"576":{"position":[[216,9]]},"586":{"position":[[30,9]]},"595":{"position":[[3,6]]},"596":{"position":[[72,9]]},"612":{"position":[[130,6]]},"621":{"position":[[146,9]]},"625":{"position":[[116,9]]},"630":{"position":[[88,6]]},"632":{"position":[[3650,9]]},"638":{"position":[[146,9]]},"660":{"position":[[543,8]]},"661":{"position":[[1867,8],[3573,8]]},"664":{"position":[[125,9]]},"681":{"position":[[2953,8]]},"685":{"position":[[43,9]]},"687":{"position":[[4619,8]]},"699":{"position":[[2315,9]]},"703":{"position":[[3,6]]},"704":{"position":[[72,9]]},"720":{"position":[[130,6]]}},"keywords":{}}],["foo",{"_index":3082,"title":{},"content":{"354":{"position":[[607,3]]},"570":{"position":[[607,3]]}},"keywords":{}}],["foo(&self",{"_index":3812,"title":{},"content":{"612":{"position":[[524,14],[671,14],[818,14],[988,14],[1145,14],[1303,14]]},"720":{"position":[[524,14],[671,14],[818,14],[988,14],[1145,14],[1303,14]]}},"keywords":{}}],["forc",{"_index":2788,"title":{},"content":{"261":{"position":[[192,5]]},"379":{"position":[[192,5]]},"401":{"position":[[192,5]]},"621":{"position":[[192,5]]},"638":{"position":[[192,5]]}},"keywords":{}}],["forget",{"_index":1321,"title":{},"content":{"54":{"position":[[445,6]]},"91":{"position":[[903,6]]},"283":{"position":[[901,6]]},"321":{"position":[[272,6]]},"495":{"position":[[901,6]]},"539":{"position":[[272,6]]}},"keywords":{}}],["fork",{"_index":591,"title":{},"content":{"20":{"position":[[502,5]]}},"keywords":{}}],["form",{"_index":577,"title":{},"content":{"20":{"position":[[154,6]]},"52":{"position":[[3123,4]]},"70":{"position":[[264,4]]},"234":{"position":[[264,4]]},"470":{"position":[[264,4]]}},"keywords":{}}],["format",{"_index":1556,"title":{},"content":{"85":{"position":[[1057,7]]},"121":{"position":[[188,6]]},"254":{"position":[[1057,7]]},"302":{"position":[[188,6]]},"485":{"position":[[1057,7]]},"523":{"position":[[188,6]]}},"keywords":{}}],["format!("cep78_{}"",{"_index":3377,"title":{},"content":{"440":{"position":[[1290,29]]},"687":{"position":[[1290,29]]}},"keywords":{}}],["format!("error",{"_index":360,"title":{},"content":{"10":{"position":[[1403,20]]}},"keywords":{}}],["former",{"_index":2883,"title":{},"content":{"267":{"position":[[3694,7],[3792,7]]},"407":{"position":[[3694,7],[3792,7]]},"644":{"position":[[3694,7],[3792,7]]}},"keywords":{}}],["forward",{"_index":381,"title":{},"content":{"12":{"position":[[79,8]]},"111":{"position":[[341,10]]},"306":{"position":[[341,10]]},"441":{"position":[[1935,8]]},"511":{"position":[[341,10]]},"688":{"position":[[1935,8]]}},"keywords":{}}],["found",{"_index":445,"title":{},"content":{"16":{"position":[[362,5]]},"168":{"position":[[2228,5]]},"348":{"position":[[2238,5]]},"395":{"position":[[4612,5]]},"476":{"position":[[1921,5]]},"477":{"position":[[2626,5]]},"564":{"position":[[2228,5]]},"632":{"position":[[4612,5]]},"698":{"position":[[1921,5]]},"699":{"position":[[2626,5]]}},"keywords":{}}],["four",{"_index":42,"title":{},"content":{"1":{"position":[[536,4]]},"39":{"position":[[236,4]]},"611":{"position":[[568,4]]},"719":{"position":[[568,4]]}},"keywords":{}}],["fqn",{"_index":1891,"title":{},"content":{"132":{"position":[[143,3],[224,3]]},"154":{"position":[[176,3],[329,3],[377,3]]},"266":{"position":[[139,3]]},"312":{"position":[[143,3],[224,3]]},"339":{"position":[[176,3],[329,3],[377,3]]},"406":{"position":[[139,3]]},"529":{"position":[[143,3],[224,3]]},"559":{"position":[[176,3],[329,3],[377,3]]},"643":{"position":[[139,3]]}},"keywords":{}}],["framework",{"_index":416,"title":{"22":{"position":[[5,10]]},"25":{"position":[[5,9]]},"27":{"position":[[5,9]]},"35":{"position":[[5,9]]},"45":{"position":[[5,9]]},"47":{"position":[[5,9]]},"56":{"position":[[5,9]]},"58":{"position":[[5,9]]},"60":{"position":[[5,9]]},"62":{"position":[[5,9]]},"193":{"position":[[0,9]]},"201":{"position":[[0,9]]},"213":{"position":[[5,9]]},"215":{"position":[[5,9]]},"224":{"position":[[5,9]]},"421":{"position":[[0,9]]},"429":{"position":[[0,9]]},"448":{"position":[[5,9]]},"663":{"position":[[0,9]]},"676":{"position":[[0,9]]}},"content":{"15":{"position":[[382,9],[483,9]]},"18":{"position":[[265,10]]},"22":{"position":[[36,9],[371,9]]},"38":{"position":[[54,9],[549,9],[858,9]]},"39":{"position":[[393,10]]},"65":{"position":[[550,9]]},"106":{"position":[[43,10]]},"148":{"position":[[872,10]]},"162":{"position":[[59,10]]},"164":{"position":[[1065,9]]},"175":{"position":[[523,10]]},"188":{"position":[[139,10],[533,10]]},"240":{"position":[[550,9]]},"248":{"position":[[9,9]]},"267":{"position":[[91,10]]},"273":{"position":[[43,10]]},"336":{"position":[[872,10]]},"351":{"position":[[59,10]]},"353":{"position":[[1100,9]]},"361":{"position":[[523,10]]},"365":{"position":[[496,10],[890,10]]},"407":{"position":[[91,10]]},"447":{"position":[[9,9]]},"465":{"position":[[550,9]]},"490":{"position":[[43,10]]},"553":{"position":[[872,10]]},"567":{"position":[[59,10]]},"569":{"position":[[1100,9]]},"577":{"position":[[523,10]]},"581":{"position":[[496,10],[890,10]]},"594":{"position":[[173,9],[563,9]]},"618":{"position":[[98,10],[416,10],[452,9]]},"644":{"position":[[91,10]]},"674":{"position":[[9,9]]},"702":{"position":[[173,9],[563,9]]},"726":{"position":[[98,10],[416,10],[452,9]]}},"keywords":{}}],["framework/sdk",{"_index":1016,"title":{},"content":{"40":{"position":[[165,13]]}},"keywords":{}}],["free",{"_index":104,"title":{},"content":{"2":{"position":[[284,4]]},"22":{"position":[[299,4]]},"110":{"position":[[421,4]]},"126":{"position":[[2978,5]]},"128":{"position":[[170,5],[435,5]]},"175":{"position":[[596,4]]},"277":{"position":[[3146,5]]},"279":{"position":[[170,5],[435,5]]},"305":{"position":[[421,4]]},"361":{"position":[[596,4]]},"394":{"position":[[149,5]]},"398":{"position":[[323,4]]},"510":{"position":[[421,4]]},"514":{"position":[[2978,5]]},"516":{"position":[[170,5],[435,5]]},"577":{"position":[[596,4]]},"618":{"position":[[716,4]]},"631":{"position":[[149,5]]},"635":{"position":[[323,4]]},"726":{"position":[[716,4]]}},"keywords":{}}],["freeli",{"_index":1624,"title":{},"content":{"95":{"position":[[176,6]]},"287":{"position":[[176,6]]},"499":{"position":[[176,6]]}},"keywords":{}}],["freez",{"_index":2747,"title":{},"content":{"223":{"position":[[1302,6]]},"456":{"position":[[1302,6]]},"696":{"position":[[1302,6]]}},"keywords":{}}],["fresh",{"_index":1631,"title":{},"content":{"95":{"position":[[485,5]]},"287":{"position":[[485,5]]},"499":{"position":[[485,5]]}},"keywords":{}}],["friend",{"_index":2083,"title":{},"content":{"163":{"position":[[253,7],[428,8],[531,7]]},"352":{"position":[[253,7],[450,8],[553,7]]},"568":{"position":[[253,7],[450,8],[553,7]]}},"keywords":{}}],["friend_nam",{"_index":2087,"title":{},"content":{"163":{"position":[[815,12],[960,12]]},"352":{"position":[[837,12],[982,12]]},"568":{"position":[[837,12],[982,12]]}},"keywords":{}}],["friendli",{"_index":628,"title":{},"content":{"21":{"position":[[206,8]]}},"keywords":{}}],["from_bal",{"_index":531,"title":{},"content":{"17":{"position":[[2785,12],[2900,12],[3007,12],[3200,12],[3379,12],[3564,12]]}},"keywords":{}}],["from_slice(&receipt.journ",{"_index":289,"title":{},"content":{"9":{"position":[[831,32]]}},"keywords":{}}],["from_slice(receipt.journal.as_slice()).unwrap",{"_index":847,"title":{},"content":{"32":{"position":[[1575,48]]}},"keywords":{}}],["frombyt",{"_index":2748,"title":{},"content":{"229":{"position":[[238,9]]},"460":{"position":[[238,9]]}},"keywords":{}}],["frombytes>(&self",{"_index":2849,"title":{},"content":{"267":{"position":[[2124,24],[3084,24]]},"407":{"position":[[2124,24],[3084,24]]},"644":{"position":[[2124,24],[3084,24]]}},"keywords":{}}],["frombytes>(address",{"_index":2871,"title":{},"content":{"267":{"position":[[2940,22]]},"407":{"position":[[2940,22]]},"644":{"position":[[2940,22]]}},"keywords":{}}],["frombytes>(key",{"_index":2847,"title":{},"content":{"267":{"position":[[2046,18]]},"407":{"position":[[2046,18]]},"644":{"position":[[2046,18]]}},"keywords":{}}],["full",{"_index":221,"title":{},"content":{"7":{"position":[[52,4]]},"42":{"position":[[2789,4]]},"43":{"position":[[627,4]]},"52":{"position":[[560,4]]},"117":{"position":[[556,4],[794,4]]},"168":{"position":[[2198,4]]},"248":{"position":[[216,4]]},"298":{"position":[[556,4],[794,4]]},"348":{"position":[[2208,4]]},"447":{"position":[[216,4]]},"476":{"position":[[1904,4]]},"519":{"position":[[556,4],[794,4]]},"564":{"position":[[2198,4]]},"618":{"position":[[389,4]]},"674":{"position":[[216,4]]},"698":{"position":[[1904,4]]},"726":{"position":[[389,4]]}},"keywords":{}}],["fulli",{"_index":1223,"title":{},"content":{"52":{"position":[[51,5]]},"66":{"position":[[335,5]]},"132":{"position":[[228,6]]},"241":{"position":[[335,5]]},"312":{"position":[[228,6]]},"466":{"position":[[335,5]]},"529":{"position":[[228,6]]}},"keywords":{}}],["fun",{"_index":1233,"title":{},"content":{"52":{"position":[[418,3]]}},"keywords":{}}],["function",{"_index":687,"title":{"604":{"position":[[0,10]]},"614":{"position":[[21,10]]},"712":{"position":[[0,10]]},"722":{"position":[[21,10]]}},"content":{"30":{"position":[[77,10],[189,8],[272,8]]},"31":{"position":[[451,8],[2865,8],[3006,8]]},"39":{"position":[[2151,10]]},"42":{"position":[[995,8],[1116,8]]},"43":{"position":[[378,8],[470,8]]},"50":{"position":[[297,13]]},"52":{"position":[[57,10]]},"70":{"position":[[161,9]]},"71":{"position":[[620,9]]},"72":{"position":[[67,8],[430,10],[513,9]]},"74":{"position":[[2,8]]},"78":{"position":[[291,9]]},"79":{"position":[[1474,9]]},"84":{"position":[[380,9]]},"92":{"position":[[624,8]]},"94":{"position":[[246,8],[373,8]]},"107":{"position":[[192,9]]},"108":{"position":[[101,9]]},"110":{"position":[[174,10],[352,9],[515,9]]},"111":{"position":[[61,9]]},"114":{"position":[[126,9],[283,9],[335,9]]},"115":{"position":[[1448,9],[1578,14],[1632,15],[1800,16],[3056,9],[3130,13]]},"128":{"position":[[470,8]]},"138":{"position":[[850,9]]},"141":{"position":[[644,9],[1170,8]]},"143":{"position":[[915,8]]},"147":{"position":[[408,9],[501,9],[671,9],[743,8],[804,8],[913,8],[1388,8]]},"148":{"position":[[574,8],[778,9]]},"157":{"position":[[32,9],[584,8],[812,10]]},"160":{"position":[[89,8]]},"162":{"position":[[661,10],[1435,9],[1692,9],[2118,9]]},"163":{"position":[[1098,13]]},"164":{"position":[[373,9],[402,8]]},"168":{"position":[[30,9],[1441,8],[1514,9],[2211,9]]},"182":{"position":[[42,15]]},"185":{"position":[[3069,8],[3096,9],[3217,8],[3376,8],[3525,9],[3546,9]]},"189":{"position":[[338,9],[538,9],[702,10]]},"194":{"position":[[36,15],[202,8]]},"196":{"position":[[685,8],[1162,8],[1652,9]]},"197":{"position":[[1092,8],[1237,9],[1325,9],[1532,8],[1642,9]]},"198":{"position":[[1251,9],[1724,8],[1992,9],[2261,9],[2687,8],[3295,9],[3627,9],[3677,9],[3920,9]]},"204":{"position":[[1049,9],[1233,9],[1314,8]]},"205":{"position":[[24,14]]},"218":{"position":[[39,15]]},"221":{"position":[[773,8],[872,8]]},"222":{"position":[[414,9]]},"223":{"position":[[1244,8]]},"229":{"position":[[312,9]]},"230":{"position":[[1491,9]]},"234":{"position":[[161,9]]},"235":{"position":[[620,9]]},"236":{"position":[[67,8],[430,10],[513,9]]},"238":{"position":[[2,8]]},"253":{"position":[[380,9]]},"257":{"position":[[126,9],[283,9],[335,9]]},"258":{"position":[[1394,9],[1524,14],[1578,15],[1746,16],[2982,9],[3056,13]]},"267":{"position":[[2504,10],[4123,8],[4189,9]]},"268":{"position":[[812,9],[2150,8],[2221,8]]},"269":{"position":[[1770,12]]},"274":{"position":[[192,9]]},"275":{"position":[[105,9]]},"279":{"position":[[470,8]]},"284":{"position":[[624,8]]},"286":{"position":[[246,8],[373,8]]},"305":{"position":[[174,10],[352,9],[515,9]]},"306":{"position":[[61,9]]},"318":{"position":[[842,9]]},"324":{"position":[[911,9],[1071,8],[1142,8],[1406,9],[1572,10]]},"326":{"position":[[644,9],[1170,8]]},"328":{"position":[[890,8]]},"330":{"position":[[32,9],[570,8],[788,10]]},"335":{"position":[[412,9],[505,9],[679,9],[751,8],[812,8],[921,8],[1396,8]]},"336":{"position":[[574,8],[778,9]]},"345":{"position":[[89,8]]},"348":{"position":[[30,9],[1441,8],[1514,9],[2221,9]]},"351":{"position":[[698,10],[1457,9],[1714,9],[2140,9]]},"352":{"position":[[1120,13]]},"353":{"position":[[408,9],[437,8]]},"366":{"position":[[338,9],[538,9],[702,10]]},"373":{"position":[[42,15]]},"376":{"position":[[3053,8],[3080,9],[3201,8],[3360,8],[3509,9],[3530,9]]},"384":{"position":[[1790,12]]},"407":{"position":[[2504,10],[4123,8],[4189,9]]},"408":{"position":[[812,9],[2150,8],[2221,8]]},"409":{"position":[[1770,12]]},"414":{"position":[[304,9]]},"416":{"position":[[1327,8],[2089,9]]},"419":{"position":[[1650,9],[2166,14]]},"424":{"position":[[1000,9],[1183,9],[1264,8]]},"425":{"position":[[24,14]]},"430":{"position":[[36,15],[202,8]]},"432":{"position":[[622,8],[1105,8],[1530,9]]},"433":{"position":[[1091,8],[1236,9],[1324,9],[1531,8],[1641,9]]},"434":{"position":[[1241,9],[1714,8],[1982,9],[2251,9],[2677,8],[3277,9],[3609,9],[3659,9],[3902,9]]},"440":{"position":[[3947,8],[4096,8],[4149,8],[4306,8],[4360,8],[4498,8],[6034,8]]},"441":{"position":[[1768,8],[1843,8],[1926,8],[3853,8],[4016,9],[4137,9],[4279,10]]},"442":{"position":[[187,10]]},"451":{"position":[[39,15]]},"454":{"position":[[773,8],[872,8]]},"455":{"position":[[414,9]]},"456":{"position":[[1244,8]]},"460":{"position":[[312,9]]},"461":{"position":[[1491,9]]},"470":{"position":[[161,9]]},"471":{"position":[[620,9]]},"472":{"position":[[67,8],[430,10],[513,9]]},"474":{"position":[[2,8]]},"478":{"position":[[80,8]]},"480":{"position":[[126,9],[283,9],[335,9]]},"481":{"position":[[1394,9],[1524,14],[1578,15],[1746,16],[2982,9],[3056,13]]},"484":{"position":[[380,9]]},"491":{"position":[[192,9]]},"492":{"position":[[105,9]]},"496":{"position":[[624,8]]},"498":{"position":[[246,8],[373,8]]},"510":{"position":[[174,10],[352,9],[515,9]]},"511":{"position":[[61,9]]},"516":{"position":[[470,8]]},"535":{"position":[[644,9],[1170,8]]},"537":{"position":[[890,8]]},"542":{"position":[[911,9],[1071,8],[1142,8],[1406,9],[1572,10]]},"544":{"position":[[842,9]]},"547":{"position":[[32,9],[584,8],[812,10]]},"552":{"position":[[412,9],[505,9],[679,9],[751,8],[812,8],[921,8],[1396,8]]},"553":{"position":[[574,8],[778,9]]},"562":{"position":[[89,8]]},"564":{"position":[[30,9],[1441,8],[1514,9],[2211,9]]},"567":{"position":[[698,10],[1457,9],[1714,9],[2140,9]]},"568":{"position":[[1120,13]]},"569":{"position":[[408,9],[437,8]]},"582":{"position":[[338,9],[538,9],[702,10]]},"589":{"position":[[42,15]]},"592":{"position":[[3053,8],[3080,9],[3201,8],[3360,8],[3509,9],[3530,9]]},"596":{"position":[[767,10],[911,10],[1164,9]]},"600":{"position":[[640,9],[754,8],[1216,9]]},"602":{"position":[[830,10],[922,9]]},"604":{"position":[[53,9],[118,9],[463,9],[537,9]]},"605":{"position":[[299,9],[325,9],[355,9],[560,8],[640,8]]},"606":{"position":[[583,8],[627,9],[691,8],[749,9],[801,9],[911,9],[950,8]]},"607":{"position":[[0,9],[94,9],[360,9]]},"608":{"position":[[647,8],[713,8],[792,9]]},"609":{"position":[[20,8],[84,8],[119,8],[336,9]]},"610":{"position":[[714,9]]},"611":{"position":[[700,8],[739,9],[753,8],[828,9]]},"613":{"position":[[1406,9],[1451,8],[1580,8],[1706,9],[1875,10],[2038,9],[2167,8]]},"614":{"position":[[85,9],[109,8],[198,8],[270,8],[381,10],[418,8],[484,8]]},"616":{"position":[[1220,8],[1281,8],[1344,9]]},"617":{"position":[[972,8]]},"626":{"position":[[1790,12]]},"644":{"position":[[2504,10],[4123,8],[4189,9]]},"645":{"position":[[812,9],[2150,8],[2221,8]]},"646":{"position":[[1770,12]]},"651":{"position":[[304,9]]},"653":{"position":[[1327,8],[2089,9]]},"656":{"position":[[1650,9],[2166,14]]},"666":{"position":[[1000,9],[1183,9],[1264,8]]},"667":{"position":[[24,14]]},"677":{"position":[[36,15],[202,8]]},"679":{"position":[[622,8],[1105,8],[1530,9]]},"680":{"position":[[1091,8],[1236,9],[1324,9],[1531,8],[1641,9]]},"681":{"position":[[1251,9],[1724,8],[1992,9],[2261,9],[2687,8],[3295,9],[3627,9],[3677,9],[3920,9]]},"687":{"position":[[3947,8],[4096,8],[4149,8],[4306,8],[4360,8],[4498,8],[6034,8]]},"688":{"position":[[1768,8],[1843,8],[1926,8],[3853,8],[4016,9],[4137,9],[4279,10]]},"689":{"position":[[187,10]]},"691":{"position":[[39,15]]},"694":{"position":[[773,8],[872,8]]},"695":{"position":[[414,9]]},"696":{"position":[[1244,8]]},"700":{"position":[[80,8]]},"704":{"position":[[767,10],[911,10],[1164,9]]},"708":{"position":[[640,9],[754,8],[1216,9]]},"710":{"position":[[830,10],[922,9]]},"712":{"position":[[53,9],[118,9],[463,9],[537,9]]},"713":{"position":[[299,9],[325,9],[355,9],[560,8],[640,8]]},"714":{"position":[[583,8],[627,9],[691,8],[749,9],[801,9],[911,9],[950,8]]},"715":{"position":[[0,9],[94,9],[360,9]]},"716":{"position":[[647,8],[713,8],[792,9]]},"717":{"position":[[20,8],[84,8],[119,8],[336,9]]},"718":{"position":[[714,9]]},"719":{"position":[[700,8],[739,9],[753,8],[828,9]]},"721":{"position":[[1406,9],[1451,8],[1580,8],[1706,9],[1875,10],[2038,9],[2167,8]]},"722":{"position":[[85,9],[109,8],[198,8],[270,8],[381,10],[418,8],[484,8]]},"724":{"position":[[1220,8],[1281,8],[1344,9]]},"725":{"position":[[972,8]]}},"keywords":{}}],["function.if",{"_index":2901,"title":{},"content":{"268":{"position":[[558,11],[678,11]]},"408":{"position":[[558,11],[678,11]]},"645":{"position":[[558,11],[678,11]]}},"keywords":{}}],["functionality.onli",{"_index":3337,"title":{},"content":{"438":{"position":[[109,18]]},"685":{"position":[[109,18]]}},"keywords":{}}],["functionmodifi",{"_index":3756,"title":{},"content":{"606":{"position":[[55,16],[141,16]]},"714":{"position":[[55,16],[141,16]]}},"keywords":{}}],["functions.l50",{"_index":2261,"title":{},"content":{"185":{"position":[[3032,13]]},"376":{"position":[[3016,13]]},"592":{"position":[[3016,13]]}},"keywords":{}}],["functionsmappingsrevertscurr",{"_index":878,"title":{},"content":{"38":{"position":[[700,31]]}},"keywords":{}}],["fund",{"_index":134,"title":{},"content":{"3":{"position":[[236,7]]},"72":{"position":[[198,6]]},"236":{"position":[[198,6]]},"440":{"position":[[2853,5],[4439,6],[5893,5],[5989,5]]},"441":{"position":[[1047,6],[2122,6]]},"472":{"position":[[198,6]]},"687":{"position":[[2853,5],[4439,6],[5893,5],[5989,5]]},"688":{"position":[[1047,6],[2122,6]]}},"keywords":{}}],["fundament",{"_index":1420,"title":{},"content":{"76":{"position":[[449,11]]},"227":{"position":[[449,11]]},"458":{"position":[[449,11]]}},"keywords":{}}],["funds.buy",{"_index":3435,"title":{},"content":{"440":{"position":[[4704,9]]},"687":{"position":[[4704,9]]}},"keywords":{}}],["funds.l104",{"_index":3428,"title":{},"content":{"440":{"position":[[4327,10]]},"687":{"position":[[4327,10]]}},"keywords":{}}],["funds.w",{"_index":3519,"title":{},"content":{"441":{"position":[[4248,8]]},"688":{"position":[[4248,8]]}},"keywords":{}}],["further",{"_index":857,"title":{},"content":{"33":{"position":[[85,7]]},"39":{"position":[[411,7]]},"66":{"position":[[110,7]]},"147":{"position":[[859,7]]},"241":{"position":[[110,7]]},"270":{"position":[[21,7]]},"335":{"position":[[867,7]]},"385":{"position":[[21,7]]},"410":{"position":[[21,7]]},"466":{"position":[[110,7]]},"552":{"position":[[867,7]]},"599":{"position":[[550,7]]},"618":{"position":[[651,7]]},"627":{"position":[[21,7]]},"647":{"position":[[21,7]]},"707":{"position":[[550,7]]},"726":{"position":[[651,7]]}},"keywords":{}}],["futur",{"_index":142,"title":{},"content":{"3":{"position":[[370,6],[711,6]]}},"keywords":{}}],["ga",{"_index":1243,"title":{},"content":{"52":{"position":[[767,3],[792,3],[803,3]]},"126":{"position":[[2116,3],[3169,3]]},"128":{"position":[[62,3]]},"277":{"position":[[2284,3],[3337,3]]},"279":{"position":[[62,3]]},"477":{"position":[[1676,4]]},"514":{"position":[[2116,3],[3169,3]]},"516":{"position":[[62,3]]},"699":{"position":[[1676,4]]}},"keywords":{}}],["gain",{"_index":389,"title":{},"content":{"12":{"position":[[342,4]]}},"keywords":{}}],["game",{"_index":137,"title":{},"content":{"3":{"position":[[261,5]]},"12":{"position":[[174,4]]}},"keywords":{}}],["gas_pric",{"_index":745,"title":{},"content":{"31":{"position":[[997,10]]}},"keywords":{}}],["gener",{"_index":197,"title":{"85":{"position":[[4,12]]},"118":{"position":[[0,10]]},"121":{"position":[[0,10]]},"254":{"position":[[4,12]]},"299":{"position":[[0,10]]},"302":{"position":[[0,10]]},"322":{"position":[[0,10]]},"485":{"position":[[4,12]]},"520":{"position":[[0,10]]},"523":{"position":[[0,10]]},"540":{"position":[[0,10]]}},"content":{"6":{"position":[[50,7]]},"9":{"position":[[658,8]]},"10":{"position":[[206,7]]},"17":{"position":[[1835,9]]},"32":{"position":[[819,10],[1061,10],[1738,10],[1797,10]]},"38":{"position":[[313,9]]},"39":{"position":[[383,9]]},"42":{"position":[[406,9]]},"65":{"position":[[392,8]]},"66":{"position":[[297,9]]},"83":{"position":[[258,9]]},"96":{"position":[[158,8]]},"102":{"position":[[567,7]]},"104":{"position":[[102,10]]},"118":{"position":[[67,8],[96,8]]},"119":{"position":[[414,9]]},"120":{"position":[[39,8]]},"121":{"position":[[15,8],[156,9],[388,8]]},"132":{"position":[[69,9],[374,8]]},"134":{"position":[[54,8],[132,9]]},"135":{"position":[[6,9]]},"136":{"position":[[11,9]]},"141":{"position":[[254,9]]},"147":{"position":[[49,8]]},"148":{"position":[[626,9]]},"154":{"position":[[29,8]]},"155":{"position":[[67,9]]},"178":{"position":[[333,8]]},"196":{"position":[[1013,10]]},"198":{"position":[[1434,9]]},"240":{"position":[[392,8]]},"241":{"position":[[297,9]]},"252":{"position":[[258,9]]},"288":{"position":[[158,8]]},"294":{"position":[[567,7]]},"296":{"position":[[102,10]]},"299":{"position":[[67,8],[96,8]]},"300":{"position":[[414,9]]},"301":{"position":[[39,8]]},"302":{"position":[[15,8],[156,9],[388,8]]},"312":{"position":[[69,9],[374,8]]},"314":{"position":[[54,8],[132,9]]},"315":{"position":[[6,9]]},"316":{"position":[[11,9]]},"321":{"position":[[200,9]]},"322":{"position":[[3,8],[100,8]]},"323":{"position":[[4,9],[173,9]]},"326":{"position":[[254,9]]},"335":{"position":[[49,8]]},"336":{"position":[[626,9]]},"339":{"position":[[29,8]]},"340":{"position":[[67,9]]},"354":{"position":[[415,9]]},"369":{"position":[[333,8]]},"382":{"position":[[42,10]]},"419":{"position":[[1173,8]]},"432":{"position":[[958,10]]},"434":{"position":[[1424,9]]},"440":{"position":[[70,9],[3965,9]]},"441":{"position":[[462,8],[491,8]]},"465":{"position":[[392,8]]},"466":{"position":[[297,9]]},"483":{"position":[[258,9]]},"500":{"position":[[158,8]]},"506":{"position":[[567,7]]},"508":{"position":[[102,10]]},"520":{"position":[[67,8],[96,8]]},"521":{"position":[[414,9]]},"522":{"position":[[39,8]]},"523":{"position":[[15,8],[156,9],[388,8]]},"529":{"position":[[69,9],[374,8]]},"531":{"position":[[54,8],[132,9]]},"532":{"position":[[6,9]]},"533":{"position":[[11,9]]},"535":{"position":[[254,9]]},"539":{"position":[[200,9]]},"540":{"position":[[3,8],[100,8]]},"541":{"position":[[4,9],[173,9]]},"552":{"position":[[49,8]]},"553":{"position":[[626,9]]},"559":{"position":[[29,8]]},"560":{"position":[[67,9]]},"570":{"position":[[415,9]]},"585":{"position":[[333,8]]},"596":{"position":[[1018,8]]},"624":{"position":[[42,10]]},"656":{"position":[[1173,8]]},"679":{"position":[[958,10]]},"681":{"position":[[1434,9]]},"687":{"position":[[70,9],[3965,9]]},"688":{"position":[[462,8],[491,8]]},"704":{"position":[[1018,8]]}},"keywords":{}}],["get",{"_index":589,"title":{"394":{"position":[[0,7]]},"631":{"position":[[0,7]]}},"content":{"20":{"position":[[484,4]]},"42":{"position":[[1959,4]]},"52":{"position":[[2048,4]]},"198":{"position":[[1660,7]]},"434":{"position":[[1650,7]]},"681":{"position":[[1660,7]]}},"keywords":{}}],["get(&self",{"_index":667,"title":{},"content":{"22":{"position":[[1321,14]]},"178":{"position":[[957,14]]},"369":{"position":[[957,14]]},"585":{"position":[[957,14]]},"596":{"position":[[387,14]]},"601":{"position":[[207,14],[773,14]]},"602":{"position":[[257,14],[1770,14]]},"704":{"position":[[387,14]]},"709":{"position":[[207,14],[773,14]]},"710":{"position":[[257,14],[1770,14]]}},"keywords":{}}],["get(&ticket_id",{"_index":3403,"title":{},"content":{"440":{"position":[[2604,20]]},"687":{"position":[[2604,20]]}},"keywords":{}}],["get_account(&self",{"_index":2139,"title":{},"content":{"168":{"position":[[1864,22]]},"348":{"position":[[1864,22]]},"564":{"position":[[1864,22]]}},"keywords":{}}],["get_adder_address(&test_env)).add(3",{"_index":1980,"title":{},"content":{"143":{"position":[[1148,40]]},"328":{"position":[[1123,40]]},"537":{"position":[[1123,40]]}},"keywords":{}}],["get_adder_address(test_env",{"_index":1982,"title":{},"content":{"143":{"position":[[1229,27]]},"328":{"position":[[1204,27]]},"537":{"position":[[1204,27]]}},"keywords":{}}],["get_arr(&self",{"_index":3704,"title":{},"content":{"601":{"position":[[1439,18]]},"709":{"position":[[1439,18]]}},"keywords":{}}],["get_balance(&self",{"_index":3549,"title":{},"content":{"476":{"position":[[1349,22]]},"698":{"position":[[1349,22]]}},"keywords":{}}],["get_current_valu",{"_index":1434,"title":{},"content":{"78":{"position":[[301,17]]},"229":{"position":[[322,17]]},"460":{"position":[[322,17]]}},"keywords":{}}],["get_data(&self",{"_index":2976,"title":{},"content":{"321":{"position":[[1493,19]]},"539":{"position":[[1493,19]]}},"keywords":{}}],["get_default_addr(&self",{"_index":3659,"title":{},"content":{"598":{"position":[[1464,27]]},"706":{"position":[[1464,27]]}},"keywords":{}}],["get_default_boo(&self",{"_index":3653,"title":{},"content":{"598":{"position":[[1152,26]]},"706":{"position":[[1152,26]]}},"keywords":{}}],["get_default_int(&self",{"_index":3657,"title":{},"content":{"598":{"position":[[1320,26]]},"706":{"position":[[1320,26]]}},"keywords":{}}],["get_default_uint(&self",{"_index":3655,"title":{},"content":{"598":{"position":[[1235,27]]},"706":{"position":[[1235,27]]}},"keywords":{}}],["get_dict_valu",{"_index":2856,"title":{},"content":{"267":{"position":[[2358,16]]},"407":{"position":[[2358,16]]},"644":{"position":[[2358,16]]}},"keywords":{}}],["get_messag",{"_index":1079,"title":{},"content":{"42":{"position":[[1836,14]]}},"keywords":{}}],["get_message(&self",{"_index":501,"title":{},"content":{"17":{"position":[[1398,22]]}},"keywords":{}}],["get_nonexistent_messag",{"_index":1092,"title":{},"content":{"42":{"position":[[2408,25]]}},"keywords":{}}],["get_or_default",{"_index":2070,"title":{},"content":{"162":{"position":[[1420,14]]},"197":{"position":[[1625,16]]},"351":{"position":[[1442,14]]},"433":{"position":[[1624,16]]},"567":{"position":[[1442,14]]},"598":{"position":[[1123,14]]},"601":{"position":[[339,14]]},"680":{"position":[[1624,16]]},"706":{"position":[[1123,14]]},"709":{"position":[[339,14]]}},"keywords":{}}],["get_or_revert_with(governanceerror::novoteinprogress",{"_index":3253,"title":{},"content":{"416":{"position":[[3753,55],[4408,55]]},"419":{"position":[[5332,55],[5988,55],[6320,55]]},"653":{"position":[[3753,55],[4408,55]]},"656":{"position":[[5332,55],[5988,55],[6320,55]]}},"keywords":{}}],["get_own",{"_index":2399,"title":{},"content":{"198":{"position":[[1563,12]]},"434":{"position":[[1553,12]]},"681":{"position":[[1563,12]]}},"keywords":{}}],["get_owner(&self",{"_index":487,"title":{},"content":{"17":{"position":[[1002,20]]},"115":{"position":[[1110,20],[2628,20]]},"197":{"position":[[500,20]]},"247":{"position":[[1189,20]]},"258":{"position":[[1060,20],[2562,20]]},"433":{"position":[[500,20]]},"446":{"position":[[1189,20]]},"481":{"position":[[1060,20],[2562,20]]},"673":{"position":[[1189,20]]},"680":{"position":[[500,20]]}},"keywords":{}}],["get_role_admin",{"_index":2275,"title":{},"content":{"185":{"position":[[3773,16]]},"376":{"position":[[3757,16]]},"592":{"position":[[3757,16]]}},"keywords":{}}],["get_role_admin(&self",{"_index":2222,"title":{},"content":{"185":{"position":[[662,25]]},"376":{"position":[[646,25]]},"592":{"position":[[646,25]]}},"keywords":{}}],["get_string_api",{"_index":1457,"title":{},"content":{"79":{"position":[[966,15]]},"230":{"position":[[983,15]]},"461":{"position":[[983,15]]}},"keywords":{}}],["get_value<t",{"_index":2848,"title":{},"content":{"267":{"position":[[2108,15]]},"407":{"position":[[2108,15]]},"644":{"position":[[2108,15]]}},"keywords":{}}],["get_value(&self",{"_index":485,"title":{},"content":{"17":{"position":[[931,20]]},"51":{"position":[[1043,20]]},"223":{"position":[[734,20]]},"456":{"position":[[734,20]]},"696":{"position":[[734,20]]}},"keywords":{}}],["get_var",{"_index":2858,"title":{},"content":{"267":{"position":[[2494,9]]},"407":{"position":[[2494,9]]},"644":{"position":[[2494,9]]}},"keywords":{}}],["get_var<t",{"_index":2846,"title":{},"content":{"267":{"position":[[2032,13]]},"407":{"position":[[2032,13]]},"644":{"position":[[2032,13]]}},"keywords":{}}],["getstatu",{"_index":1064,"title":{},"content":{"42":{"position":[[1389,10]]}},"keywords":{}}],["getstatus(address",{"_index":1058,"title":{},"content":{"42":{"position":[[1125,17]]}},"keywords":{}}],["getter",{"_index":348,"title":{},"content":{"10":{"position":[[982,7]]},"162":{"position":[[654,6]]},"197":{"position":[[1318,6],[1371,6]]},"269":{"position":[[1763,6]]},"351":{"position":[[691,6]]},"384":{"position":[[1783,6]]},"409":{"position":[[1763,6]]},"433":{"position":[[1317,6],[1370,6]]},"567":{"position":[[691,6]]},"596":{"position":[[1027,7]]},"602":{"position":[[1744,7]]},"626":{"position":[[1783,6]]},"646":{"position":[[1763,6]]},"680":{"position":[[1317,6],[1370,6]]},"704":{"position":[[1027,7]]},"710":{"position":[[1744,7]]}},"keywords":{}}],["github",{"_index":91,"title":{},"content":{"1":{"position":[[1176,7]]},"7":{"position":[[89,7]]},"15":{"position":[[40,6],[644,7]]},"16":{"position":[[70,6]]},"24":{"position":[[19,6]]},"54":{"position":[[431,6]]},"117":{"position":[[1098,6]]},"298":{"position":[[1098,6]]},"519":{"position":[[1098,6]]}},"keywords":{}}],["give",{"_index":429,"title":{},"content":{"16":{"position":[[7,5],[118,5]]},"43":{"position":[[1973,5]]},"110":{"position":[[154,5]]},"168":{"position":[[5,5]]},"305":{"position":[[154,5]]},"348":{"position":[[5,5]]},"510":{"position":[[154,5]]},"564":{"position":[[5,5]]}},"keywords":{}}],["given",{"_index":233,"title":{},"content":{"8":{"position":[[124,5]]},"10":{"position":[[27,5]]},"31":{"position":[[683,5],[828,5]]},"80":{"position":[[4,5]]},"157":{"position":[[87,5]]},"168":{"position":[[1756,5]]},"185":{"position":[[2717,5],[2862,5],[3856,5]]},"206":{"position":[[1109,5],[1747,5],[3353,5]]},"231":{"position":[[4,5]]},"269":{"position":[[5019,5],[5657,5]]},"330":{"position":[[87,5]]},"348":{"position":[[1756,5]]},"376":{"position":[[2701,5],[2846,5],[3840,5]]},"409":{"position":[[5019,5],[5657,5]]},"419":{"position":[[1328,5],[2651,5],[2921,5],[3088,5],[3233,5],[3681,5],[3774,5],[3806,5]]},"426":{"position":[[1104,5],[1737,5],[3328,5]]},"462":{"position":[[4,5]]},"476":{"position":[[1327,5]]},"547":{"position":[[87,5]]},"564":{"position":[[1756,5]]},"592":{"position":[[2701,5],[2846,5],[3840,5]]},"646":{"position":[[5019,5],[5657,5]]},"656":{"position":[[1328,5],[2651,5],[2921,5],[3088,5],[3233,5],[3681,5],[3774,5],[3806,5]]},"668":{"position":[[1109,5],[1747,5],[3353,5]]},"698":{"position":[[1327,5]]}},"keywords":{}}],["glanc",{"_index":3206,"title":{},"content":{"414":{"position":[[158,6]]},"651":{"position":[[158,6]]}},"keywords":{}}],["global",{"_index":1578,"title":{},"content":{"91":{"position":[[293,6]]},"283":{"position":[[293,6]]},"495":{"position":[[293,6]]},"600":{"position":[[551,6],[791,6],[1127,6]]},"708":{"position":[[551,6],[791,6],[1127,6]]}},"keywords":{}}],["go",{"_index":27,"title":{},"content":{"1":{"position":[[271,5],[518,5]]},"6":{"position":[[98,2]]},"22":{"position":[[350,2]]},"52":{"position":[[442,3],[1759,3]]},"92":{"position":[[460,2]]},"126":{"position":[[1305,2]]},"164":{"position":[[0,5]]},"180":{"position":[[42,2]]},"277":{"position":[[1473,2]]},"284":{"position":[[460,2]]},"353":{"position":[[0,5]]},"371":{"position":[[42,2]]},"383":{"position":[[679,2]]},"394":{"position":[[210,2]]},"396":{"position":[[1018,2]]},"415":{"position":[[6,2]]},"496":{"position":[[460,2]]},"514":{"position":[[1305,2]]},"569":{"position":[[0,5]]},"587":{"position":[[42,2]]},"601":{"position":[[2107,2]]},"625":{"position":[[679,2]]},"631":{"position":[[210,2]]},"633":{"position":[[1018,2]]},"652":{"position":[[6,2]]},"709":{"position":[[2107,2]]}},"keywords":{}}],["goal",{"_index":100,"title":{},"content":{"2":{"position":[[207,5]]},"8":{"position":[[63,4]]},"12":{"position":[[57,5]]},"17":{"position":[[4,4]]},"22":{"position":[[328,4]]},"594":{"position":[[540,4]]},"612":{"position":[[1906,5]]},"702":{"position":[[540,4]]},"720":{"position":[[1906,5]]}},"keywords":{}}],["goe",{"_index":1599,"title":{},"content":{"92":{"position":[[682,4]]},"284":{"position":[[682,4]]},"496":{"position":[[682,4]]},"604":{"position":[[305,4],[448,4]]},"712":{"position":[[305,4],[448,4]]}},"keywords":{}}],["good",{"_index":144,"title":{},"content":{"3":{"position":[[395,4]]},"12":{"position":[[16,4]]},"16":{"position":[[481,4]]},"18":{"position":[[409,4]]}},"keywords":{}}],["govern",{"_index":3201,"title":{"413":{"position":[[5,9]]},"415":{"position":[[0,10]]},"650":{"position":[[5,9]]},"652":{"position":[[0,10]]}},"content":{"413":{"position":[[35,10]]},"414":{"position":[[705,11]]},"415":{"position":[[49,10]]},"417":{"position":[[1536,11]]},"419":{"position":[[306,8],[1509,6],[1529,9],[7951,11]]},"650":{"position":[[35,10]]},"651":{"position":[[705,11]]},"652":{"position":[[49,10]]},"654":{"position":[[1536,11]]},"656":{"position":[[306,8],[1509,6],[1529,9],[7951,11]]}},"keywords":{}}],["governanceerror",{"_index":3292,"title":{},"content":{"419":{"position":[[351,15]]},"656":{"position":[[351,15]]}},"keywords":{}}],["grab",{"_index":1897,"title":{},"content":{"136":{"position":[[83,4]]},"316":{"position":[[83,4]]},"533":{"position":[[83,4]]}},"keywords":{}}],["gracefulli",{"_index":3921,"title":{},"content":{"617":{"position":[[860,11]]},"725":{"position":[[860,11]]}},"keywords":{}}],["grant",{"_index":2180,"title":{},"content":{"184":{"position":[[65,9],[689,5]]},"185":{"position":[[2704,7],[2849,7],[3123,7],[3276,7],[3653,8]]},"375":{"position":[[65,9],[608,5]]},"376":{"position":[[2688,7],[2833,7],[3107,7],[3260,7],[3637,8]]},"419":{"position":[[1767,7]]},"591":{"position":[[65,9],[608,5]]},"592":{"position":[[2688,7],[2833,7],[3107,7],[3260,7],[3637,8]]},"656":{"position":[[1767,7]]}},"keywords":{}}],["grant/revok",{"_index":2169,"title":{},"content":{"182":{"position":[[230,12]]},"373":{"position":[[230,12]]},"589":{"position":[[230,12]]}},"keywords":{}}],["grant_role(&mut",{"_index":2226,"title":{},"content":{"185":{"position":[[841,19]]},"376":{"position":[[825,19]]},"592":{"position":[[825,19]]}},"keywords":{}}],["great",{"_index":404,"title":{},"content":{"15":{"position":[[154,5]]},"16":{"position":[[18,5]]},"52":{"position":[[3083,6]]},"54":{"position":[[15,5]]},"594":{"position":[[456,5]]},"702":{"position":[[456,5]]}},"keywords":{}}],["greatli",{"_index":623,"title":{},"content":{"21":{"position":[[107,7]]}},"keywords":{}}],["green",{"_index":3289,"title":{},"content":{"417":{"position":[[1726,6]]},"654":{"position":[[1726,6]]}},"keywords":{}}],["greet",{"_index":3612,"title":{},"content":{"596":{"position":[[145,8],[245,6],[845,6],[869,8],[938,8]]},"704":{"position":[[145,8],[245,6],[845,6],[869,8],[938,8]]}},"keywords":{}}],["grep",{"_index":1253,"title":{},"content":{"52":{"position":[[981,4]]}},"keywords":{}}],["group",{"_index":871,"title":{},"content":{"38":{"position":[[465,5],[610,6]]},"419":{"position":[[1826,5]]},"656":{"position":[[1826,5]]}},"keywords":{}}],["gt",{"_index":350,"title":{},"content":{"10":{"position":[[1016,4],[1246,4],[1352,5],[1397,5]]},"17":{"position":[[953,4],[1024,4],[1269,5],[1332,5],[1459,4],[1590,5],[1618,5],[2537,4],[2632,4],[3905,4],[4028,5],[4059,5]]},"22":{"position":[[1337,4]]},"31":{"position":[[739,4],[889,4]]},"32":{"position":[[1138,4]]},"39":{"position":[[2325,4],[2530,5],[2604,5],[2666,5],[2738,5],[2804,5],[2927,5],[3003,5],[3111,5]]},"42":{"position":[[972,5],[2095,4]]},"51":{"position":[[1065,4]]},"73":{"position":[[198,4]]},"79":{"position":[[894,4],[1034,4]]},"80":{"position":[[394,4],[481,4],[609,4]]},"83":{"position":[[588,4]]},"115":{"position":[[820,4],[859,4],[900,4],[941,4],[998,4],[1072,4],[1132,4],[2590,4],[2650,4]]},"141":{"position":[[1294,4]]},"142":{"position":[[294,4]]},"143":{"position":[[1272,4]]},"162":{"position":[[974,4],[1042,4],[1108,4],[1183,4],[1294,4],[2202,4]]},"163":{"position":[[982,4]]},"164":{"position":[[642,4],[717,4],[785,4]]},"168":{"position":[[1689,4],[1898,4],[2136,4]]},"178":{"position":[[973,4]]},"185":{"position":[[591,4],[706,4]]},"197":{"position":[[522,4],[585,5],[603,5]]},"198":{"position":[[108,4],[1354,4]]},"204":{"position":[[338,4],[407,4],[480,4],[555,4]]},"205":{"position":[[980,4],[1110,4],[1370,4]]},"206":{"position":[[280,4]]},"212":{"position":[[666,4],[1458,4],[2540,4],[2846,4],[3843,4],[4068,4]]},"221":{"position":[[102,4]]},"223":{"position":[[756,4]]},"230":{"position":[[911,4],[1051,4]]},"231":{"position":[[394,4],[481,4],[609,4]]},"237":{"position":[[198,4]]},"247":{"position":[[341,4],[401,4],[465,4],[531,4],[624,4],[742,4],[1211,4]]},"252":{"position":[[588,4]]},"258":{"position":[[794,4],[829,4],[866,4],[903,4],[956,4],[1026,4],[1082,4],[2528,4],[2584,4]]},"267":{"position":[[2077,4],[2166,4],[2562,4],[2636,4],[2708,4],[2786,4],[3047,4],[3143,4],[3928,4]]},"269":{"position":[[1697,4],[1856,4],[2599,4],[4184,4]]},"321":{"position":[[1514,4]]},"326":{"position":[[1294,4]]},"327":{"position":[[294,4]]},"328":{"position":[[1247,4]]},"348":{"position":[[1689,4],[1898,4],[2146,4]]},"351":{"position":[[996,4],[1064,4],[1130,4],[1205,4],[1316,4],[2224,4]]},"352":{"position":[[1004,4]]},"353":{"position":[[677,4],[752,4],[820,4]]},"369":{"position":[[973,4]]},"376":{"position":[[575,4],[690,4]]},"384":{"position":[[1710,4],[1876,4],[2626,4]]},"391":{"position":[[666,4],[1458,4],[2540,4],[2852,4],[3861,4],[4086,4]]},"393":{"position":[[277,4]]},"395":{"position":[[1810,4],[2251,4]]},"407":{"position":[[2077,4],[2166,4],[2562,4],[2636,4],[2708,4],[2786,4],[3047,4],[3143,4],[3928,4]]},"409":{"position":[[1697,4],[1856,4],[2599,4],[4184,4]]},"414":{"position":[[391,4],[426,4]]},"416":{"position":[[4348,4]]},"419":{"position":[[1865,4],[1876,4],[2369,4],[2441,4],[2529,4],[2609,4],[2715,4],[2872,4],[5928,4],[6407,4]]},"424":{"position":[[313,4],[382,4],[455,4],[530,4]]},"425":{"position":[[955,4],[1085,4],[1345,4]]},"426":{"position":[[280,4]]},"433":{"position":[[522,4],[585,5],[603,5]]},"434":{"position":[[108,4],[1344,4]]},"440":{"position":[[3274,4],[6375,4]]},"441":{"position":[[1556,4],[3601,4],[3685,4],[5794,4]]},"446":{"position":[[341,4],[401,4],[465,4],[531,4],[624,4],[742,4],[1211,4]]},"454":{"position":[[102,4]]},"456":{"position":[[756,4]]},"461":{"position":[[911,4],[1051,4]]},"462":{"position":[[394,4],[481,4],[609,4]]},"473":{"position":[[198,4]]},"476":{"position":[[1396,4],[1502,4]]},"477":{"position":[[476,4]]},"481":{"position":[[794,4],[829,4],[866,4],[903,4],[956,4],[1026,4],[1082,4],[2528,4],[2584,4]]},"483":{"position":[[588,4]]},"535":{"position":[[1294,4]]},"536":{"position":[[294,4]]},"537":{"position":[[1247,4]]},"539":{"position":[[1514,4]]},"564":{"position":[[1689,4],[1898,4],[2136,4]]},"567":{"position":[[996,4],[1064,4],[1130,4],[1205,4],[1316,4],[2224,4]]},"568":{"position":[[1004,4]]},"569":{"position":[[677,4],[752,4],[820,4]]},"585":{"position":[[973,4]]},"592":{"position":[[575,4],[690,4]]},"596":{"position":[[403,4]]},"598":{"position":[[1180,4],[1264,4],[1348,4],[1493,4]]},"601":{"position":[[238,4],[813,4],[1459,4]]},"602":{"position":[[273,4],[1798,4]]},"605":{"position":[[160,4],[231,4]]},"606":{"position":[[201,4],[271,4]]},"612":{"position":[[540,4],[687,4],[834,4],[1004,4],[1161,4],[1319,4]]},"613":{"position":[[141,4],[173,4],[424,4]]},"616":{"position":[[253,4],[1009,4]]},"617":{"position":[[466,5],[543,5],[720,4],[741,6]]},"626":{"position":[[1710,4],[1876,4],[2626,4]]},"630":{"position":[[277,4]]},"632":{"position":[[1810,4],[2251,4]]},"644":{"position":[[2077,4],[2166,4],[2562,4],[2636,4],[2708,4],[2786,4],[3047,4],[3143,4],[3928,4]]},"646":{"position":[[1697,4],[1856,4],[2599,4],[4184,4]]},"651":{"position":[[391,4],[426,4]]},"653":{"position":[[4348,4]]},"656":{"position":[[1865,4],[1876,4],[2369,4],[2441,4],[2529,4],[2609,4],[2715,4],[2872,4],[5928,4],[6407,4]]},"661":{"position":[[666,4],[1458,4],[2540,4],[2852,4],[3861,4],[4086,4]]},"666":{"position":[[313,4],[382,4],[455,4],[530,4]]},"667":{"position":[[955,4],[1085,4],[1345,4]]},"668":{"position":[[280,4]]},"673":{"position":[[341,4],[401,4],[465,4],[531,4],[624,4],[742,4],[1211,4]]},"680":{"position":[[522,4],[585,5],[603,5]]},"681":{"position":[[108,4],[1354,4]]},"687":{"position":[[3274,4],[6375,4]]},"688":{"position":[[1556,4],[3601,4],[3685,4],[5794,4]]},"694":{"position":[[102,4]]},"696":{"position":[[756,4]]},"698":{"position":[[1396,4],[1502,4]]},"699":{"position":[[476,4]]},"704":{"position":[[403,4]]},"706":{"position":[[1180,4],[1264,4],[1348,4],[1493,4]]},"709":{"position":[[238,4],[813,4],[1459,4]]},"710":{"position":[[273,4],[1798,4]]},"713":{"position":[[160,4],[231,4]]},"714":{"position":[[201,4],[271,4]]},"720":{"position":[[540,4],[687,4],[834,4],[1004,4],[1161,4],[1319,4]]},"721":{"position":[[141,4],[173,4],[424,4]]},"724":{"position":[[253,4],[1009,4]]},"725":{"position":[[466,5],[543,5],[720,4],[741,6]]}},"keywords":{}}],["guarante",{"_index":1532,"title":{},"content":{"84":{"position":[[786,10]]},"221":{"position":[[688,9]]},"253":{"position":[[786,10]]},"454":{"position":[[688,9]]},"484":{"position":[[786,10]]},"694":{"position":[[688,9]]}},"keywords":{}}],["guard",{"_index":600,"title":{"221":{"position":[[11,7]]},"454":{"position":[[11,7]]},"694":{"position":[[11,7]]}},"content":{"20":{"position":[[760,7]]},"72":{"position":[[385,6]]},"185":{"position":[[3090,5]]},"218":{"position":[[114,6]]},"221":{"position":[[36,7]]},"236":{"position":[[385,6]]},"376":{"position":[[3074,5]]},"451":{"position":[[114,6]]},"454":{"position":[[36,7]]},"472":{"position":[[385,6]]},"592":{"position":[[3074,5]]},"691":{"position":[[114,6]]},"694":{"position":[[36,7]]}},"keywords":{}}],["guess(&self",{"_index":3901,"title":{},"content":{"616":{"position":[[977,16]]},"724":{"position":[[977,16]]}},"keywords":{}}],["guessthemagicword",{"_index":3866,"title":{},"content":{"616":{"position":[[534,17],[606,17]]},"724":{"position":[[534,17],[606,17]]}},"keywords":{}}],["guest",{"_index":229,"title":{"8":{"position":[[0,6]]}},"content":{"8":{"position":[[39,5],[144,5]]},"9":{"position":[[21,5],[503,6]]},"10":{"position":[[68,5]]},"32":{"position":[[31,5]]}},"keywords":{}}],["guid",{"_index":1428,"title":{"259":{"position":[[10,5]]},"377":{"position":[[10,5]]},"399":{"position":[[10,5]]},"619":{"position":[[10,5]]},"636":{"position":[[10,5]]}},"content":{"76":{"position":[[936,5]]},"227":{"position":[[936,5]]},"383":{"position":[[140,5]]},"442":{"position":[[87,5]]},"458":{"position":[[936,5]]},"594":{"position":[[282,5]]},"595":{"position":[[15,6]]},"625":{"position":[[140,5]]},"689":{"position":[[87,5]]},"702":{"position":[[282,5]]},"703":{"position":[[15,6]]}},"keywords":{}}],["h160::default",{"_index":748,"title":{},"content":{"31":{"position":[[1030,16]]}},"keywords":{}}],["h160::from_str("0x1000000000000000000000000000000000000000"",{"_index":766,"title":{},"content":{"31":{"position":[[1452,70],[2488,70]]}},"keywords":{}}],["h160::from_str("0xf000000000000000000000000000000000000000"",{"_index":774,"title":{},"content":{"31":{"position":[[1746,70],[2406,70]]}},"keywords":{}}],["halt",{"_index":2424,"title":{},"content":{"198":{"position":[[3772,7]]},"434":{"position":[[3754,7]]},"681":{"position":[[3772,7]]}},"keywords":{}}],["hand",{"_index":677,"title":{},"content":{"23":{"position":[[79,5]]},"42":{"position":[[14,5]]},"94":{"position":[[176,4]]},"132":{"position":[[345,5]]},"154":{"position":[[92,5]]},"286":{"position":[[176,4]]},"312":{"position":[[345,5]]},"339":{"position":[[92,5]]},"498":{"position":[[176,4]]},"529":{"position":[[345,5]]},"559":{"position":[[92,5]]}},"keywords":{}}],["handi",{"_index":3242,"title":{},"content":{"416":{"position":[[2497,5]]},"653":{"position":[[2497,5]]}},"keywords":{}}],["handl",{"_index":1597,"title":{"611":{"position":[[6,9]]},"719":{"position":[[6,9]]}},"content":{"92":{"position":[[562,7]]},"98":{"position":[[645,7]]},"102":{"position":[[313,7]]},"110":{"position":[[551,8]]},"111":{"position":[[324,8]]},"152":{"position":[[19,6]]},"164":{"position":[[1088,6]]},"169":{"position":[[27,7]]},"284":{"position":[[562,7]]},"290":{"position":[[645,7]]},"294":{"position":[[313,7]]},"305":{"position":[[551,8]]},"306":{"position":[[324,8]]},"343":{"position":[[19,6]]},"349":{"position":[[27,7]]},"353":{"position":[[1123,6]]},"441":{"position":[[3463,7]]},"478":{"position":[[404,7]]},"496":{"position":[[562,7]]},"502":{"position":[[645,7]]},"506":{"position":[[313,7]]},"510":{"position":[[551,8]]},"511":{"position":[[324,8]]},"557":{"position":[[19,6]]},"565":{"position":[[27,7]]},"569":{"position":[[1123,6]]},"611":{"position":[[581,6]]},"617":{"position":[[826,6],[927,6],[1129,6],[1277,6]]},"618":{"position":[[163,9]]},"688":{"position":[[3463,7]]},"700":{"position":[[404,7]]},"719":{"position":[[581,6]]},"725":{"position":[[826,6],[927,6],[1129,6],[1277,6]]},"726":{"position":[[163,9]]}},"keywords":{}}],["handling,defin",{"_index":2307,"title":{},"content":{"193":{"position":[[130,17]]},"429":{"position":[[130,17]]},"676":{"position":[[130,17]]}},"keywords":{}}],["happen",{"_index":424,"title":{},"content":{"15":{"position":[[560,6]]},"102":{"position":[[76,9]]},"294":{"position":[[76,9]]},"396":{"position":[[811,8]]},"506":{"position":[[76,9]]},"633":{"position":[[811,8]]}},"keywords":{}}],["happi",{"_index":10,"title":{},"content":{"1":{"position":[[83,5]]},"23":{"position":[[92,5]]}},"keywords":{}}],["hard",{"_index":102,"title":{},"content":{"2":{"position":[[242,4]]},"18":{"position":[[389,4]]}},"keywords":{}}],["hardcod",{"_index":3241,"title":{},"content":{"416":{"position":[[2414,9]]},"653":{"position":[[2414,9]]}},"keywords":{}}],["has_role(&self",{"_index":2219,"title":{},"content":{"185":{"position":[[530,19]]},"376":{"position":[[514,19]]},"592":{"position":[[514,19]]}},"keywords":{}}],["hash",{"_index":1553,"title":{"616":{"position":[[0,8]]},"724":{"position":[[0,8]]}},"content":{"85":{"position":[[981,6]]},"98":{"position":[[209,4]]},"100":{"position":[[1085,4]]},"103":{"position":[[130,4]]},"209":{"position":[[565,6],[698,6]]},"210":{"position":[[1297,4]]},"211":{"position":[[746,4]]},"212":{"position":[[199,4],[464,6],[587,6],[3671,4],[3756,4],[4398,4]]},"254":{"position":[[981,6]]},"290":{"position":[[209,4]]},"292":{"position":[[1085,4]]},"295":{"position":[[130,4]]},"323":{"position":[[2931,4]]},"389":{"position":[[1234,4]]},"390":{"position":[[720,4]]},"391":{"position":[[199,4],[464,6],[587,6],[3689,4],[3774,4],[4416,4]]},"395":{"position":[[5112,4]]},"477":{"position":[[4001,7],[4024,5]]},"485":{"position":[[981,6]]},"502":{"position":[[209,4]]},"504":{"position":[[1085,4]]},"507":{"position":[[130,4]]},"541":{"position":[[2931,4]]},"616":{"position":[[675,5],[1047,4],[1108,4],[1240,4],[1402,5]]},"632":{"position":[[5112,4]]},"659":{"position":[[1234,4]]},"660":{"position":[[720,4]]},"661":{"position":[[199,4],[464,6],[587,6],[3689,4],[3774,4],[4416,4]]},"699":{"position":[[4001,7],[4024,5]]},"724":{"position":[[675,5],[1047,4],[1108,4],[1240,4],[1402,5]]}},"keywords":{}}],["hash<t",{"_index":2859,"title":{},"content":{"267":{"position":[[2518,10],[2591,10]]},"407":{"position":[[2518,10],[2591,10]]},"644":{"position":[[2518,10],[2591,10]]}},"keywords":{}}],["hash(&self",{"_index":3861,"title":{},"content":{"616":{"position":[[196,15]]},"724":{"position":[[196,15]]}},"keywords":{}}],["hashed_key",{"_index":2668,"title":{},"content":{"212":{"position":[[3975,10]]},"391":{"position":[[3993,10]]},"661":{"position":[[3993,10]]}},"keywords":{}}],["hasher",{"_index":2672,"title":{},"content":{"212":{"position":[[4120,6],[4281,7]]},"391":{"position":[[4138,6],[4299,7]]},"661":{"position":[[4138,6],[4299,7]]}},"keywords":{}}],["hasher"",{"_index":2676,"title":{},"content":{"212":{"position":[[4227,14]]},"391":{"position":[[4245,14]]},"661":{"position":[[4245,14]]}},"keywords":{}}],["hashfunct",{"_index":3860,"title":{},"content":{"616":{"position":[[139,13],[174,12]]},"724":{"position":[[139,13],[174,12]]}},"keywords":{}}],["hashmap",{"_index":2074,"title":{},"content":{"162":{"position":[[1937,8]]},"163":{"position":[[1117,7]]},"351":{"position":[[1959,8]]},"352":{"position":[[1139,7]]},"567":{"position":[[1959,8]]},"568":{"position":[[1139,7]]}},"keywords":{}}],["hasn't",{"_index":411,"title":{},"content":{"15":{"position":[[307,6]]},"54":{"position":[[351,6]]}},"keywords":{}}],["hassl",{"_index":645,"title":{},"content":{"22":{"position":[[182,6]]},"38":{"position":[[170,6]]}},"keywords":{}}],["have",{"_index":891,"title":{},"content":{"38":{"position":[[1068,6]]},"141":{"position":[[1453,6]]},"207":{"position":[[0,6]]},"326":{"position":[[1453,6]]},"419":{"position":[[2073,6]]},"427":{"position":[[0,6]]},"535":{"position":[[1453,6]]},"656":{"position":[[2073,6]]},"669":{"position":[[0,6]]}},"keywords":{}}],["header",{"_index":1985,"title":{"145":{"position":[[0,7]]},"333":{"position":[[0,7]]},"550":{"position":[[0,7]]}},"content":{},"keywords":{}}],["hello",{"_index":2,"title":{"1":{"position":[[0,5]]},"596":{"position":[[0,5]]},"704":{"position":[[0,5]]}},"content":{"7":{"position":[[124,6]]}},"keywords":{}}],["helloworld",{"_index":3614,"title":{},"content":{"596":{"position":[[232,10],[294,10],[799,10]]},"704":{"position":[[232,10],[294,10],[799,10]]}},"keywords":{}}],["help",{"_index":87,"title":{"2":{"position":[[8,4]]}},"content":{"1":{"position":[[1121,4]]},"2":{"position":[[117,4],[456,4]]},"12":{"position":[[292,4]]},"31":{"position":[[404,7]]},"70":{"position":[[141,5]]},"81":{"position":[[332,4]]},"117":{"position":[[13,4]]},"174":{"position":[[16,7],[39,4],[356,4]]},"175":{"position":[[612,4]]},"193":{"position":[[41,4]]},"201":{"position":[[41,4]]},"232":{"position":[[332,4]]},"234":{"position":[[141,5]]},"298":{"position":[[13,4]]},"360":{"position":[[16,7],[39,4],[356,4]]},"361":{"position":[[612,4]]},"421":{"position":[[41,4]]},"429":{"position":[[41,4]]},"463":{"position":[[332,4]]},"470":{"position":[[141,5]]},"519":{"position":[[13,4]]},"576":{"position":[[16,7],[39,4],[356,4]]},"577":{"position":[[612,4]]},"612":{"position":[[1632,5]]},"663":{"position":[[41,4]]},"676":{"position":[[41,4]]},"720":{"position":[[1632,5]]}},"keywords":{}}],["helper",{"_index":2260,"title":{},"content":{"185":{"position":[[3025,6]]},"376":{"position":[[3009,6]]},"441":{"position":[[4272,6]]},"592":{"position":[[3009,6]]},"688":{"position":[[4272,6]]}},"keywords":{}}],["henc",{"_index":2350,"title":{},"content":{"196":{"position":[[1662,6]]},"221":{"position":[[514,5]]},"432":{"position":[[1540,6]]},"454":{"position":[[514,5]]},"679":{"position":[[1540,6]]},"694":{"position":[[514,5]]}},"keywords":{}}],["here",{"_index":11,"title":{},"content":{"1":{"position":[[101,5],[1113,4]]},"3":{"position":[[136,4]]},"11":{"position":[[160,4]]},"16":{"position":[[292,5]]},"20":{"position":[[721,4]]},"39":{"position":[[2179,4]]},"42":{"position":[[2812,5]]},"43":{"position":[[644,5]]},"51":{"position":[[1634,4]]},"53":{"position":[[1279,4]]},"83":{"position":[[451,4]]},"127":{"position":[[975,5]]},"132":{"position":[[337,4]]},"135":{"position":[[58,5]]},"136":{"position":[[69,5]]},"198":{"position":[[2494,4]]},"212":{"position":[[2475,5]]},"252":{"position":[[451,4]]},"267":{"position":[[183,4]]},"268":{"position":[[176,4]]},"269":{"position":[[0,4]]},"277":{"position":[[1136,5]]},"278":{"position":[[975,5]]},"312":{"position":[[337,4]]},"315":{"position":[[58,5]]},"316":{"position":[[69,5]]},"323":{"position":[[147,4]]},"365":{"position":[[170,5],[351,5]]},"383":{"position":[[682,4]]},"384":{"position":[[0,4]]},"391":{"position":[[2475,5]]},"396":{"position":[[1042,5],[1248,5]]},"407":{"position":[[183,4]]},"408":{"position":[[176,4]]},"409":{"position":[[0,4]]},"416":{"position":[[3100,4]]},"419":{"position":[[0,4]]},"434":{"position":[[2484,4]]},"476":{"position":[[1927,5]]},"483":{"position":[[451,4]]},"515":{"position":[[975,5]]},"529":{"position":[[337,4]]},"532":{"position":[[58,5]]},"533":{"position":[[69,5]]},"541":{"position":[[147,4]]},"581":{"position":[[170,5],[351,5]]},"604":{"position":[[310,4],[453,4]]},"625":{"position":[[682,4]]},"626":{"position":[[0,4]]},"633":{"position":[[1042,5],[1248,5]]},"644":{"position":[[183,4]]},"645":{"position":[[176,4]]},"646":{"position":[[0,4]]},"653":{"position":[[3100,4]]},"656":{"position":[[0,4]]},"661":{"position":[[2475,5]]},"681":{"position":[[2494,4]]},"698":{"position":[[1927,5]]},"712":{"position":[[310,4],[453,4]]}},"keywords":{}}],["here'",{"_index":3746,"title":{},"content":{"604":{"position":[[86,6]]},"712":{"position":[[86,6]]}},"keywords":{}}],["hesit",{"_index":2946,"title":{},"content":{"270":{"position":[[87,8]]},"385":{"position":[[87,8]]},"410":{"position":[[87,8]]},"627":{"position":[[87,8]]},"647":{"position":[[87,8]]}},"keywords":{}}],["hex",{"_index":793,"title":{},"content":{"31":{"position":[[2754,3],[3098,3],[3118,3]]},"211":{"position":[[720,3]]},"212":{"position":[[3730,3]]},"390":{"position":[[694,3]]},"391":{"position":[[3748,3]]},"660":{"position":[[694,3]]},"661":{"position":[[3748,3]]}},"keywords":{}}],["hex::decode(input).unwrap",{"_index":788,"title":{},"content":{"31":{"position":[[2584,28]]}},"keywords":{}}],["hex::decode(program).unwrap",{"_index":771,"title":{},"content":{"31":{"position":[[1633,30]]}},"keywords":{}}],["hex::encode(&hashed_key",{"_index":2670,"title":{},"content":{"212":{"position":[[4007,28]]},"391":{"position":[[4025,28]]},"661":{"position":[[4025,28]]}},"keywords":{}}],["hex::encode(result",{"_index":795,"title":{},"content":{"31":{"position":[[2774,19]]}},"keywords":{}}],["hexadecim",{"_index":1555,"title":{},"content":{"85":{"position":[[1045,11]]},"254":{"position":[[1045,11]]},"485":{"position":[[1045,11]]}},"keywords":{}}],["hi",{"_index":3602,"title":{},"content":{"594":{"position":[[0,3]]},"702":{"position":[[0,3]]}},"keywords":{}}],["hide",{"_index":3212,"title":{},"content":{"415":{"position":[[109,4]]},"652":{"position":[[109,4]]}},"keywords":{}}],["hierarchi",{"_index":952,"title":{},"content":{"39":{"position":[[1432,9]]}},"keywords":{}}],["high",{"_index":640,"title":{},"content":{"22":{"position":[[10,4]]},"38":{"position":[[28,4]]},"594":{"position":[[162,4]]},"702":{"position":[[162,4]]}},"keywords":{}}],["highest",{"_index":47,"title":{},"content":{"1":{"position":[[601,7]]}},"keywords":{}}],["highli",{"_index":2346,"title":{},"content":{"196":{"position":[[1490,6]]},"219":{"position":[[132,6]]},"452":{"position":[[132,6]]},"692":{"position":[[132,6]]}},"keywords":{}}],["highlight",{"_index":3607,"title":{},"content":{"594":{"position":[[351,12]]},"702":{"position":[[351,12]]}},"keywords":{}}],["hindranc",{"_index":1571,"title":{},"content":{"90":{"position":[[166,11]]},"282":{"position":[[166,11]]},"494":{"position":[[166,11]]}},"keywords":{}}],["histori",{"_index":563,"title":{"20":{"position":[[9,8]]}},"content":{"107":{"position":[[302,7]]},"274":{"position":[[302,7]]},"491":{"position":[[302,7]]}},"keywords":{}}],["hold",{"_index":337,"title":{},"content":{"10":{"position":[[660,5]]},"22":{"position":[[878,5]]},"31":{"position":[[2848,4]]},"78":{"position":[[126,5]]},"107":{"position":[[286,5],[346,5]]},"132":{"position":[[22,5]]},"151":{"position":[[20,4]]},"219":{"position":[[181,5]]},"229":{"position":[[126,5]]},"274":{"position":[[286,5],[346,5]]},"312":{"position":[[22,5]]},"342":{"position":[[20,4]]},"452":{"position":[[181,5]]},"460":{"position":[[126,5]]},"491":{"position":[[286,5],[346,5]]},"529":{"position":[[22,5]]},"556":{"position":[[20,4]]},"692":{"position":[[181,5]]}},"keywords":{}}],["holder",{"_index":3202,"title":{},"content":{"413":{"position":[[174,7]]},"415":{"position":[[341,7]]},"416":{"position":[[191,7],[1275,7],[1668,7]]},"417":{"position":[[443,7],[533,7]]},"419":{"position":[[575,7],[4185,7],[6858,7],[6948,7]]},"650":{"position":[[174,7]]},"652":{"position":[[341,7]]},"653":{"position":[[191,7],[1275,7],[1668,7]]},"654":{"position":[[443,7],[533,7]]},"656":{"position":[[575,7],[4185,7],[6858,7],[6948,7]]}},"keywords":{}}],["home",{"_index":633,"title":{},"content":{"21":{"position":[[281,5]]}},"keywords":{}}],["home/casper/casp",{"_index":3555,"title":{},"content":{"477":{"position":[[393,19]]},"699":{"position":[[393,19]]}},"keywords":{}}],["homepag",{"_index":3045,"title":{},"content":{"324":{"position":[[167,8]]},"542":{"position":[[167,8]]}},"keywords":{}}],["honest",{"_index":673,"title":{},"content":{"23":{"position":[[9,7]]}},"keywords":{}}],["hood",{"_index":1576,"title":{},"content":{"91":{"position":[[213,5]]},"102":{"position":[[96,4]]},"283":{"position":[[213,5]]},"294":{"position":[[96,4]]},"495":{"position":[[213,5]]},"506":{"position":[[96,4]]}},"keywords":{}}],["hope",{"_index":634,"title":{},"content":{"21":{"position":[[290,4]]},"40":{"position":[[365,4]]}},"keywords":{}}],["hopefulli",{"_index":3137,"title":{},"content":{"395":{"position":[[1410,9]]},"632":{"position":[[1410,9]]}},"keywords":{}}],["horizon",{"_index":3605,"title":{},"content":{"594":{"position":[[67,8]]},"702":{"position":[[67,8]]}},"keywords":{}}],["host",{"_index":242,"title":{"111":{"position":[[0,4]]},"123":{"position":[[0,4]]},"306":{"position":[[0,4]]},"308":{"position":[[0,4]]},"511":{"position":[[0,4]]},"525":{"position":[[0,4]]}},"content":{"8":{"position":[[290,4],[356,4]]},"32":{"position":[[1698,4]]},"111":{"position":[[35,4]]},"126":{"position":[[1479,4]]},"141":{"position":[[56,4]]},"146":{"position":[[249,5]]},"166":{"position":[[48,4]]},"168":{"position":[[80,4],[234,4]]},"178":{"position":[[263,5]]},"268":{"position":[[1396,4]]},"277":{"position":[[1647,4]]},"306":{"position":[[35,4]]},"326":{"position":[[56,4]]},"334":{"position":[[249,5]]},"346":{"position":[[28,4]]},"348":{"position":[[80,4],[234,4]]},"355":{"position":[[48,4]]},"369":{"position":[[263,5]]},"408":{"position":[[1396,4]]},"511":{"position":[[35,4]]},"514":{"position":[[1479,4]]},"535":{"position":[[56,4]]},"551":{"position":[[249,5]]},"564":{"position":[[80,4],[234,4]]},"571":{"position":[[48,4]]},"585":{"position":[[263,5]]},"645":{"position":[[1396,4]]}},"keywords":{}}],["host/src/main.r",{"_index":827,"title":{},"content":{"32":{"position":[[523,16]]}},"keywords":{}}],["host::{deploy",{"_index":1977,"title":{},"content":{"143":{"position":[[1010,16]]},"160":{"position":[[237,16]]},"206":{"position":[[83,16]]},"269":{"position":[[3974,16]]},"328":{"position":[[985,16]]},"345":{"position":[[237,16]]},"409":{"position":[[3974,16]]},"426":{"position":[[83,16]]},"440":{"position":[[4835,16]]},"441":{"position":[[4581,16]]},"537":{"position":[[985,16]]},"562":{"position":[[237,16]]},"646":{"position":[[3974,16]]},"668":{"position":[[83,16]]},"687":{"position":[[4835,16]]},"688":{"position":[[4581,16]]}},"keywords":{}}],["hostenv",{"_index":2020,"title":{"168":{"position":[[0,8]]},"346":{"position":[[0,8]]},"348":{"position":[[0,8]]},"564":{"position":[[0,8]]}},"content":{"157":{"position":[[7,7],[223,8],[290,7],[833,7]]},"160":{"position":[[68,7]]},"168":{"position":[[465,9],[521,7],[1173,7],[1486,7],[2241,7]]},"198":{"position":[[77,8],[130,8],[159,7],[1376,8],[1683,7],[2077,8],[2784,8],[3145,7],[3605,7]]},"206":{"position":[[100,8],[285,9]]},"268":{"position":[[479,7],[918,8],[954,7],[1135,9],[1154,7],[2940,7],[3015,7]]},"269":{"position":[[3991,8],[4189,9]]},"330":{"position":[[7,7],[223,8],[281,7],[809,7]]},"345":{"position":[[68,7]]},"348":{"position":[[465,9],[521,7],[1173,7],[1486,7],[2251,7]]},"395":{"position":[[426,8]]},"408":{"position":[[479,7],[918,8],[954,7],[1135,9],[1154,7],[2940,7],[3015,7]]},"409":{"position":[[3991,8],[4189,9]]},"426":{"position":[[100,8],[285,9]]},"434":{"position":[[77,8],[130,8],[159,7],[1366,8],[1673,7],[2067,8],[2774,8],[3127,7],[3587,7]]},"547":{"position":[[7,7],[223,8],[290,7],[833,7]]},"562":{"position":[[68,7]]},"564":{"position":[[465,9],[521,7],[1173,7],[1486,7],[2241,7]]},"632":{"position":[[426,8]]},"645":{"position":[[479,7],[918,8],[954,7],[1135,9],[1154,7],[2940,7],[3015,7]]},"646":{"position":[[3991,8],[4189,9]]},"668":{"position":[[100,8],[285,9]]},"681":{"position":[[77,8],[130,8],[159,7],[1376,8],[1683,7],[2077,8],[2784,8],[3145,7],[3605,7]]}},"keywords":{}}],["hostenv::change_ownership",{"_index":2418,"title":{},"content":{"198":{"position":[[3576,28]]},"434":{"position":[[3558,28]]},"681":{"position":[[3576,28]]}},"keywords":{}}],["hostenv::emitted_ev",{"_index":2410,"title":{},"content":{"198":{"position":[[2850,23]]},"268":{"position":[[2758,24]]},"408":{"position":[[2758,24]]},"434":{"position":[[2840,23]]},"645":{"position":[[2758,24]]},"681":{"position":[[2850,23]]}},"keywords":{}}],["hostenv::set_cal",{"_index":2414,"title":{},"content":{"198":{"position":[[3273,21]]},"434":{"position":[[3255,21]]},"681":{"position":[[3273,21]]}},"keywords":{}}],["hostenv::set_callerto",{"_index":2129,"title":{},"content":{"168":{"position":[[1289,21]]},"348":{"position":[[1289,21]]},"564":{"position":[[1289,21]]}},"keywords":{}}],["hostenv::try_change_ownership",{"_index":2417,"title":{},"content":{"198":{"position":[[3533,31]]},"434":{"position":[[3515,31]]},"681":{"position":[[3533,31]]}},"keywords":{}}],["hostref",{"_index":1927,"title":{},"content":{"141":{"position":[[13,7]]},"143":{"position":[[230,8],[1027,8]]},"157":{"position":[[232,8]]},"160":{"position":[[254,8]]},"198":{"position":[[86,9]]},"206":{"position":[[109,10]]},"268":{"position":[[927,8],[1968,7]]},"269":{"position":[[4000,9]]},"326":{"position":[[13,7]]},"328":{"position":[[230,8],[1002,8]]},"345":{"position":[[254,8]]},"395":{"position":[[435,8]]},"408":{"position":[[927,8],[1968,7]]},"409":{"position":[[4000,9]]},"426":{"position":[[109,10]]},"434":{"position":[[86,9]]},"440":{"position":[[4852,9]]},"441":{"position":[[4598,8]]},"477":{"position":[[1503,9]]},"535":{"position":[[13,7]]},"537":{"position":[[230,8],[1002,8]]},"547":{"position":[[232,8]]},"562":{"position":[[254,8]]},"632":{"position":[[435,8]]},"645":{"position":[[927,8],[1968,7]]},"646":{"position":[[4000,9]]},"668":{"position":[[109,10]]},"681":{"position":[[86,9]]},"687":{"position":[[4852,9]]},"688":{"position":[[4598,8]]},"699":{"position":[[1503,9]]}},"keywords":{}}],["hostref::last_cal",{"_index":2918,"title":{},"content":{"268":{"position":[[1884,20]]},"408":{"position":[[1884,20]]},"645":{"position":[[1884,20]]}},"keywords":{}}],["hostrefload",{"_index":3123,"title":{},"content":{"395":{"position":[[444,15]]},"632":{"position":[[444,15]]}},"keywords":{}}],["hostrefloader>::load(env",{"_index":1960,"title":{},"content":{"142":{"position":[[482,28]]},"327":{"position":[[482,28]]},"536":{"position":[[482,28]]}},"keywords":{}}],["hot",{"_index":676,"title":{},"content":{"23":{"position":[[61,4]]}},"keywords":{}}],["hour",{"_index":108,"title":{},"content":{"2":{"position":[[304,5],[496,5]]}},"keywords":{}}],["http://cspr.live",{"_index":1863,"title":{},"content":{"127":{"position":[[913,17]]},"278":{"position":[[913,17]]},"515":{"position":[[913,17]]}},"keywords":{}}],["http://localhost:11101",{"_index":2579,"title":{},"content":{"210":{"position":[[393,22],[1167,22]]},"389":{"position":[[393,22],[1104,22]]},"659":{"position":[[393,22],[1104,22]]}},"keywords":{}}],["https://rpc.uni.juno.deuslabs.fi:443",{"_index":1302,"title":{},"content":{"53":{"position":[[189,36]]}},"keywords":{}}],["https://rpc.uni.juno.deuslabs.fi:443"",{"_index":1237,"title":{},"content":{"52":{"position":[[604,42]]}},"keywords":{}}],["huge",{"_index":77,"title":{},"content":{"1":{"position":[[953,4]]},"31":{"position":[[371,4]]},"44":{"position":[[63,4]]}},"keywords":{}}],["huh",{"_index":1832,"title":{},"content":{"126":{"position":[[2990,4]]},"277":{"position":[[3158,4]]},"514":{"position":[[2990,4]]}},"keywords":{}}],["hurri",{"_index":3138,"title":{},"content":{"395":{"position":[[1437,6]]},"632":{"position":[[1437,6]]}},"keywords":{}}],["i'd",{"_index":196,"title":{},"content":{"6":{"position":[[0,3]]}},"keywords":{}}],["i)).unwrap_or_default",{"_index":3696,"title":{},"content":{"601":{"position":[[864,23]]},"709":{"position":[[864,23]]}},"keywords":{}}],["i.",{"_index":246,"title":{},"content":{"8":{"position":[[424,5]]},"9":{"position":[[785,5]]}},"keywords":{}}],["i2",{"_index":3632,"title":{},"content":{"598":{"position":[[402,3]]},"706":{"position":[[402,3]]}},"keywords":{}}],["i32",{"_index":3630,"title":{},"content":{"598":{"position":[[362,3],[1726,3]]},"706":{"position":[[362,3],[1726,3]]}},"keywords":{}}],["i64",{"_index":3634,"title":{},"content":{"598":{"position":[[425,3],[1353,3],[1734,3]]},"706":{"position":[[425,3],[1353,3],[1734,3]]}},"keywords":{}}],["id",{"_index":1238,"title":{},"content":{"52":{"position":[[673,2],[3226,2]]},"53":{"position":[[234,2]]},"441":{"position":[[5767,3]]},"688":{"position":[[5767,3]]}},"keywords":{}}],["identifi",{"_index":924,"title":{},"content":{"39":{"position":[[760,11]]},"42":{"position":[[890,11]]},"76":{"position":[[529,10]]},"107":{"position":[[143,10]]},"189":{"position":[[126,10],[155,11]]},"227":{"position":[[529,10]]},"274":{"position":[[143,10]]},"366":{"position":[[126,10],[155,11]]},"458":{"position":[[529,10]]},"491":{"position":[[143,10]]},"582":{"position":[[126,10],[155,11]]}},"keywords":{}}],["idiom",{"_index":1588,"title":{},"content":{"92":{"position":[[15,5],[356,5]]},"284":{"position":[[15,5],[356,5]]},"496":{"position":[[15,5],[356,5]]}},"keywords":{}}],["ignor",{"_index":2406,"title":{},"content":{"198":{"position":[[2347,6]]},"212":{"position":[[1318,6],[2448,6],[2725,6],[3139,6]]},"391":{"position":[[1318,6],[2448,6],[2731,6],[3157,6]]},"434":{"position":[[2337,6]]},"661":{"position":[[1318,6],[2448,6],[2731,6],[3157,6]]},"681":{"position":[[2347,6]]}},"keywords":{}}],["illustr",{"_index":3472,"title":{},"content":{"441":{"position":[[266,11]]},"688":{"position":[[266,11]]}},"keywords":{}}],["imag",{"_index":2570,"title":{},"content":{"210":{"position":[[63,5]]},"389":{"position":[[63,5]]},"477":{"position":[[95,6]]},"659":{"position":[[63,5]]},"699":{"position":[[95,6]]}},"keywords":{}}],["imagin",{"_index":558,"title":{},"content":{"18":{"position":[[397,7]]}},"keywords":{}}],["immut",{"_index":900,"title":{"599":{"position":[[14,13]]},"707":{"position":[[14,13]]}},"content":{"39":{"position":[[158,12]]},"202":{"position":[[141,9]]},"422":{"position":[[141,9]]},"599":{"position":[[349,9],[460,9],[666,9]]},"664":{"position":[[141,9]]},"707":{"position":[[349,9],[460,9],[666,9]]}},"keywords":{}}],["impl",{"_index":341,"title":{"147":{"position":[[0,5]]},"335":{"position":[[0,5]]},"552":{"position":[[0,5]]}},"content":{"10":{"position":[[787,4]]},"17":{"position":[[613,4],[2209,4]]},"22":{"position":[[1158,4]]},"51":{"position":[[559,4]]},"73":{"position":[[91,4],[317,4]]},"79":{"position":[[818,4]]},"80":{"position":[[338,4]]},"115":{"position":[[315,4],[2156,4]]},"147":{"position":[[150,4],[341,4],[634,4]]},"162":{"position":[[745,4]]},"164":{"position":[[532,4]]},"178":{"position":[[434,4]]},"185":{"position":[[502,4],[1449,4]]},"196":{"position":[[65,4],[617,4]]},"197":{"position":[[27,4]]},"204":{"position":[[50,4],[606,4],[1008,4],[1183,4]]},"205":{"position":[[269,4],[1182,4]]},"209":{"position":[[939,4]]},"221":{"position":[[57,4],[464,4]]},"222":{"position":[[74,4]]},"223":{"position":[[439,4]]},"230":{"position":[[835,4]]},"231":{"position":[[338,4]]},"237":{"position":[[91,4],[317,4]]},"247":{"position":[[80,4]]},"258":{"position":[[305,4],[2102,4]]},"269":{"position":[[538,4],[2477,4]]},"321":{"position":[[1023,4]]},"335":{"position":[[150,4],[341,4],[638,4]]},"351":{"position":[[767,4]]},"353":{"position":[[567,4]]},"369":{"position":[[434,4]]},"376":{"position":[[486,4],[1433,4]]},"384":{"position":[[551,4],[2504,4]]},"388":{"position":[[871,4]]},"409":{"position":[[538,4],[2477,4]]},"414":{"position":[[267,4]]},"419":{"position":[[1274,4]]},"424":{"position":[[25,4],[581,4],[959,4],[1133,4]]},"425":{"position":[[244,4],[1157,4]]},"432":{"position":[[27,4],[554,4]]},"433":{"position":[[27,4]]},"440":{"position":[[1130,4]]},"441":{"position":[[859,4],[2440,4]]},"446":{"position":[[80,4]]},"454":{"position":[[57,4],[464,4]]},"455":{"position":[[74,4]]},"456":{"position":[[439,4]]},"461":{"position":[[835,4]]},"462":{"position":[[338,4]]},"473":{"position":[[91,4],[317,4]]},"476":{"position":[[415,4]]},"481":{"position":[[305,4],[2102,4]]},"539":{"position":[[1023,4]]},"552":{"position":[[150,4],[341,4],[638,4]]},"567":{"position":[[767,4]]},"569":{"position":[[567,4]]},"585":{"position":[[434,4]]},"592":{"position":[[486,4],[1433,4]]},"596":{"position":[[289,4]]},"598":{"position":[[660,4]]},"599":{"position":[[132,4]]},"600":{"position":[[170,4]]},"601":{"position":[[177,4],[745,4],[1306,4]]},"602":{"position":[[238,4],[1274,4]]},"604":{"position":[[74,4],[128,4]]},"605":{"position":[[105,4]]},"606":{"position":[[136,4]]},"607":{"position":[[168,4],[249,4]]},"608":{"position":[[169,4]]},"610":{"position":[[200,4]]},"611":{"position":[[208,4]]},"612":{"position":[[508,4],[655,4],[802,4],[972,4],[1129,4],[1287,4]]},"613":{"position":[[363,4],[567,4],[924,4]]},"616":{"position":[[169,4],[601,4]]},"617":{"position":[[159,4],[666,4]]},"626":{"position":[[551,4],[2504,4]]},"646":{"position":[[538,4],[2477,4]]},"651":{"position":[[267,4]]},"656":{"position":[[1274,4]]},"658":{"position":[[871,4]]},"666":{"position":[[25,4],[581,4],[959,4],[1133,4]]},"667":{"position":[[244,4],[1157,4]]},"673":{"position":[[80,4]]},"679":{"position":[[27,4],[554,4]]},"680":{"position":[[27,4]]},"687":{"position":[[1130,4]]},"688":{"position":[[859,4],[2440,4]]},"694":{"position":[[57,4],[464,4]]},"695":{"position":[[74,4]]},"696":{"position":[[439,4]]},"698":{"position":[[415,4]]},"704":{"position":[[289,4]]},"706":{"position":[[660,4]]},"707":{"position":[[132,4]]},"708":{"position":[[170,4]]},"709":{"position":[[177,4],[745,4],[1306,4]]},"710":{"position":[[238,4],[1274,4]]},"712":{"position":[[74,4],[128,4]]},"713":{"position":[[105,4]]},"714":{"position":[[136,4]]},"715":{"position":[[168,4],[249,4]]},"716":{"position":[[169,4]]},"718":{"position":[[200,4]]},"719":{"position":[[208,4]]},"720":{"position":[[508,4],[655,4],[802,4],[972,4],[1129,4],[1287,4]]},"721":{"position":[[363,4],[567,4],[924,4]]},"724":{"position":[[169,4],[601,4]]},"725":{"position":[[159,4],[666,4]]}},"keywords":{}}],["implement",{"_index":508,"title":{"197":{"position":[[9,15]]},"414":{"position":[[6,15]]},"415":{"position":[[11,15]]},"433":{"position":[[9,15]]},"440":{"position":[[9,15]]},"651":{"position":[[6,15]]},"652":{"position":[[11,15]]},"680":{"position":[[9,15]]},"687":{"position":[[9,15]]}},"content":{"17":{"position":[[1711,9]]},"18":{"position":[[176,9]]},"39":{"position":[[1536,14]]},"40":{"position":[[222,15],[259,14]]},"42":{"position":[[800,9]]},"43":{"position":[[1846,15]]},"54":{"position":[[100,15]]},"81":{"position":[[359,9]]},"85":{"position":[[454,15]]},"90":{"position":[[47,9]]},"91":{"position":[[786,9]]},"100":{"position":[[40,15]]},"110":{"position":[[66,10],[198,12],[251,9],[328,14],[429,9]]},"111":{"position":[[161,12]]},"112":{"position":[[37,10]]},"114":{"position":[[379,11]]},"119":{"position":[[184,10]]},"138":{"position":[[907,10]]},"141":{"position":[[501,10],[1422,9]]},"145":{"position":[[117,14]]},"147":{"position":[[22,15],[78,14]]},"148":{"position":[[236,10],[679,10],[816,15]]},"163":{"position":[[1258,9],[1465,14]]},"165":{"position":[[95,12]]},"168":{"position":[[257,9]]},"178":{"position":[[306,15],[362,14],[1242,10]]},"185":{"position":[[79,15]]},"188":{"position":[[24,10],[85,10],[173,10],[298,9],[478,10],[568,10],[769,10]]},"189":{"position":[[39,14]]},"190":{"position":[[31,9]]},"194":{"position":[[69,10]]},"197":{"position":[[786,14],[1155,15],[1578,10]]},"198":{"position":[[1844,10]]},"200":{"position":[[29,9]]},"205":{"position":[[45,9],[2369,15]]},"223":{"position":[[74,9]]},"232":{"position":[[359,9]]},"254":{"position":[[454,15]]},"257":{"position":[[379,11]]},"268":{"position":[[431,10],[1987,11]]},"282":{"position":[[47,9]]},"283":{"position":[[786,9]]},"292":{"position":[[40,15]]},"300":{"position":[[184,10]]},"305":{"position":[[66,10],[198,12],[251,9],[328,14],[429,9]]},"306":{"position":[[161,12]]},"307":{"position":[[37,10]]},"318":{"position":[[899,10]]},"326":{"position":[[501,10],[1422,9]]},"333":{"position":[[117,14]]},"335":{"position":[[22,15],[78,14]]},"336":{"position":[[236,10],[679,10],[816,15]]},"348":{"position":[[257,9]]},"352":{"position":[[1280,9],[1487,14]]},"354":{"position":[[95,12],[207,9]]},"365":{"position":[[381,10],[442,10],[530,10],[655,9],[835,10],[925,10],[1126,10]]},"366":{"position":[[39,14]]},"367":{"position":[[31,9]]},"369":{"position":[[306,15],[362,14],[1242,10]]},"376":{"position":[[79,15]]},"408":{"position":[[431,10],[1987,11]]},"413":{"position":[[23,9]]},"414":{"position":[[683,14]]},"415":{"position":[[32,12],[295,9]]},"416":{"position":[[429,10],[1234,9]]},"417":{"position":[[21,14]]},"419":{"position":[[800,10],[1146,15],[1202,14]]},"425":{"position":[[45,9],[2319,15]]},"430":{"position":[[69,10]]},"433":{"position":[[785,14],[1154,15],[1577,10]]},"434":{"position":[[1834,10]]},"436":{"position":[[29,9]]},"440":{"position":[[12,12]]},"456":{"position":[[74,9]]},"463":{"position":[[359,9]]},"480":{"position":[[379,11]]},"485":{"position":[[454,15]]},"494":{"position":[[47,9]]},"495":{"position":[[786,9]]},"504":{"position":[[40,15]]},"510":{"position":[[66,10],[198,12],[251,9],[328,14],[429,9]]},"511":{"position":[[161,12]]},"512":{"position":[[37,10]]},"521":{"position":[[184,10]]},"535":{"position":[[501,10],[1422,9]]},"544":{"position":[[899,10]]},"550":{"position":[[117,14]]},"552":{"position":[[22,15],[78,14]]},"553":{"position":[[236,10],[679,10],[816,15]]},"564":{"position":[[257,9]]},"568":{"position":[[1280,9],[1487,14]]},"570":{"position":[[95,12],[207,9]]},"581":{"position":[[381,10],[442,10],[530,10],[655,9],[835,10],[925,10],[1126,10]]},"582":{"position":[[39,14]]},"583":{"position":[[31,9]]},"585":{"position":[[306,15],[362,14],[1242,10]]},"592":{"position":[[79,15]]},"596":{"position":[[600,9]]},"613":{"position":[[2065,10],[2076,12]]},"614":{"position":[[45,9]]},"616":{"position":[[1305,10]]},"618":{"position":[[619,15]]},"645":{"position":[[431,10],[1987,11]]},"650":{"position":[[23,9]]},"651":{"position":[[683,14]]},"652":{"position":[[32,12],[295,9]]},"653":{"position":[[429,10],[1234,9]]},"654":{"position":[[21,14]]},"656":{"position":[[800,10],[1146,15],[1202,14]]},"667":{"position":[[45,9],[2319,15]]},"677":{"position":[[69,10]]},"680":{"position":[[785,14],[1154,15],[1577,10]]},"681":{"position":[[1844,10]]},"683":{"position":[[29,9]]},"687":{"position":[[12,12]]},"696":{"position":[[74,9]]},"704":{"position":[[600,9]]},"721":{"position":[[2065,10],[2076,12]]},"722":{"position":[[45,9]]},"724":{"position":[[1305,10]]},"726":{"position":[[619,15]]}},"keywords":{}}],["import",{"_index":330,"title":{},"content":{"10":{"position":[[387,6]]},"31":{"position":[[34,9]]},"38":{"position":[[826,9]]},"126":{"position":[[1660,6]]},"145":{"position":[[193,9]]},"185":{"position":[[2913,9]]},"195":{"position":[[704,9]]},"267":{"position":[[797,6]]},"277":{"position":[[1828,6]]},"333":{"position":[[193,9]]},"376":{"position":[[2897,9]]},"407":{"position":[[797,6]]},"431":{"position":[[704,9]]},"514":{"position":[[1660,6]]},"550":{"position":[[193,9]]},"592":{"position":[[2897,9]]},"603":{"position":[[33,9]]},"644":{"position":[[797,6]]},"678":{"position":[[704,9]]},"711":{"position":[[33,9]]}},"keywords":{}}],["improv",{"_index":858,"title":{},"content":{"33":{"position":[[114,9]]},"163":{"position":[[1054,11]]},"352":{"position":[[1076,11]]},"568":{"position":[[1076,11]]}},"keywords":{}}],["inc_bi",{"_index":3313,"title":{},"content":{"419":{"position":[[3307,7]]},"656":{"position":[[3307,7]]}},"keywords":{}}],["includ",{"_index":1312,"title":{},"content":{"53":{"position":[[1238,8]]},"76":{"position":[[203,9]]},"110":{"position":[[543,7]]},"115":{"position":[[1387,8],[2996,7]]},"121":{"position":[[33,10]]},"195":{"position":[[493,8]]},"227":{"position":[[203,9]]},"258":{"position":[[1333,8],[2922,7]]},"302":{"position":[[33,10]]},"305":{"position":[[543,7]]},"324":{"position":[[603,8],[781,8],[975,8],[1273,8],[1460,8]]},"431":{"position":[[493,8]]},"438":{"position":[[31,7]]},"442":{"position":[[144,9]]},"458":{"position":[[203,9]]},"481":{"position":[[1333,8],[2922,7]]},"510":{"position":[[543,7]]},"523":{"position":[[33,10]]},"542":{"position":[[603,8],[781,8],[975,8],[1273,8],[1460,8]]},"599":{"position":[[383,9]]},"606":{"position":[[924,9]]},"678":{"position":[[493,8]]},"685":{"position":[[31,7]]},"689":{"position":[[144,9]]},"707":{"position":[[383,9]]},"714":{"position":[[924,9]]}},"keywords":{}}],["include_str",{"_index":733,"title":{},"content":{"31":{"position":[[592,13]]}},"keywords":{}}],["incom",{"_index":3342,"title":{},"content":{"438":{"position":[[275,6]]},"685":{"position":[[275,6]]}},"keywords":{}}],["incorpor",{"_index":1179,"title":{},"content":{"50":{"position":[[261,11]]},"80":{"position":[[67,12]]},"231":{"position":[[67,12]]},"321":{"position":[[407,12]]},"462":{"position":[[67,12]]},"539":{"position":[[407,12]]}},"keywords":{}}],["increas",{"_index":2137,"title":{},"content":{"168":{"position":[[1820,9]]},"348":{"position":[[1820,9]]},"419":{"position":[[3187,9]]},"564":{"position":[[1820,9]]},"656":{"position":[[3187,9]]}},"keywords":{}}],["increase_allowance(&mut",{"_index":3312,"title":{},"content":{"419":{"position":[[3250,27]]},"656":{"position":[[3250,27]]}},"keywords":{}}],["increment",{"_index":1191,"title":{},"content":{"51":{"position":[[290,9],[1473,11]]},"52":{"position":[[1414,9],[4825,9],[4933,9],[6521,11]]},"53":{"position":[[695,9],[1180,11]]},"78":{"position":[[101,12],[363,9]]},"81":{"position":[[189,9]]},"223":{"position":[[208,11]]},"229":{"position":[[101,12],[384,9]]},"232":{"position":[[189,9]]},"456":{"position":[[208,11]]},"460":{"position":[[101,12],[384,9]]},"463":{"position":[[189,9]]},"696":{"position":[[208,11]]}},"keywords":{}}],["increment(&mut",{"_index":1199,"title":{},"content":{"51":{"position":[[711,18]]},"223":{"position":[[469,18]]},"456":{"position":[[469,18]]},"696":{"position":[[469,18]]}},"keywords":{}}],["increment_and_get(&mut",{"_index":1487,"title":{},"content":{"80":{"position":[[447,26]]},"231":{"position":[[447,26]]},"462":{"position":[[447,26]]}},"keywords":{}}],["increment_only_if_unpaus",{"_index":2739,"title":{},"content":{"223":{"position":[[884,28]]},"456":{"position":[[884,28]]},"696":{"position":[[884,28]]}},"keywords":{}}],["incremented.th",{"_index":1189,"title":{},"content":{"51":{"position":[[199,15]]}},"keywords":{}}],["inde",{"_index":1297,"title":{},"content":{"52":{"position":[[6664,7]]},"247":{"position":[[1964,6]]},"396":{"position":[[521,7]]},"414":{"position":[[462,6]]},"446":{"position":[[1964,6]]},"633":{"position":[[521,7]]},"651":{"position":[[462,6]]},"673":{"position":[[1964,6]]}},"keywords":{}}],["index",{"_index":412,"title":{},"content":{"15":{"position":[[314,7]]},"39":{"position":[[1802,7],[1824,7]]},"85":{"position":[[73,5],[237,5],[270,7],[400,7],[797,5]]},"163":{"position":[[1661,6]]},"198":{"position":[[3120,5]]},"211":{"position":[[112,5],[590,5],[639,5]]},"212":{"position":[[3505,5],[3582,5],[3637,5]]},"254":{"position":[[73,5],[237,5],[270,7],[400,7],[797,5]]},"352":{"position":[[1683,6]]},"390":{"position":[[112,5],[564,5],[613,5]]},"391":{"position":[[3523,5],[3600,5],[3655,5]]},"434":{"position":[[3102,5]]},"485":{"position":[[73,5],[237,5],[270,7],[400,7],[797,5]]},"568":{"position":[[1683,6]]},"601":{"position":[[1765,6]]},"602":{"position":[[1418,6],[1587,6],[1785,6]]},"613":{"position":[[550,6],[640,6]]},"660":{"position":[[112,5],[564,5],[613,5]]},"661":{"position":[[3523,5],[3600,5],[3655,5]]},"681":{"position":[[3120,5]]},"709":{"position":[[1765,6]]},"710":{"position":[[1418,6],[1587,6],[1785,6]]},"721":{"position":[[550,6],[640,6]]}},"keywords":{}}],["indic",{"_index":2191,"title":{},"content":{"184":{"position":[[757,10]]},"202":{"position":[[255,10]]},"220":{"position":[[77,9]]},"375":{"position":[[676,10]]},"422":{"position":[[255,10]]},"440":{"position":[[4276,9]]},"453":{"position":[[77,9]]},"477":{"position":[[4039,8]]},"591":{"position":[[676,10]]},"608":{"position":[[695,8]]},"614":{"position":[[466,8]]},"664":{"position":[[255,10]]},"687":{"position":[[4276,9]]},"693":{"position":[[77,9]]},"699":{"position":[[4039,8]]},"716":{"position":[[695,8]]},"722":{"position":[[466,8]]}},"keywords":{}}],["individu",{"_index":914,"title":{},"content":{"39":{"position":[[529,10]]},"202":{"position":[[214,10]]},"422":{"position":[[214,10]]},"664":{"position":[[214,10]]}},"keywords":{}}],["ineffici",{"_index":2077,"title":{},"content":{"162":{"position":[[2362,12]]},"351":{"position":[[2384,12]]},"567":{"position":[[2384,12]]}},"keywords":{}}],["inexperienc",{"_index":3826,"title":{},"content":{"612":{"position":[[1778,13]]},"720":{"position":[[1778,13]]}},"keywords":{}}],["info",{"_index":682,"title":{},"content":{"24":{"position":[[46,4]]},"39":{"position":[[1108,4]]},"65":{"position":[[182,4]]},"127":{"position":[[266,4],[457,4],[878,4]]},"164":{"position":[[1118,4]]},"240":{"position":[[182,4]]},"278":{"position":[[266,4],[457,4],[878,4]]},"353":{"position":[[1153,4]]},"395":{"position":[[4563,4],[4605,4],[4872,4],[4989,4],[5185,4],[5539,4],[5656,4],[5998,4],[6115,4],[6175,4],[6518,4]]},"440":{"position":[[2001,4]]},"465":{"position":[[182,4]]},"477":{"position":[[2571,4],[2619,4],[2788,4],[2905,4],[3016,4],[3271,4],[3410,4],[3652,4]]},"515":{"position":[[266,4],[457,4],[878,4]]},"569":{"position":[[1153,4]]},"632":{"position":[[4563,4],[4605,4],[4872,4],[4989,4],[5185,4],[5539,4],[5656,4],[5998,4],[6115,4],[6175,4],[6518,4]]},"687":{"position":[[2001,4]]},"699":{"position":[[2571,4],[2619,4],[2788,4],[2905,4],[3016,4],[3271,4],[3410,4],[3652,4]]}},"keywords":{}}],["inform",{"_index":1794,"title":{},"content":{"126":{"position":[[58,11]]},"132":{"position":[[28,11]]},"163":{"position":[[225,11]]},"166":{"position":[[57,11]]},"185":{"position":[[2660,11]]},"195":{"position":[[410,7]]},"196":{"position":[[1375,6]]},"270":{"position":[[244,12]]},"277":{"position":[[58,11]]},"312":{"position":[[28,11]]},"323":{"position":[[115,11]]},"352":{"position":[[225,11]]},"355":{"position":[[57,11]]},"376":{"position":[[2644,11]]},"385":{"position":[[244,12]]},"410":{"position":[[244,12]]},"416":{"position":[[281,11]]},"431":{"position":[[410,7]]},"432":{"position":[[1317,6]]},"440":{"position":[[3473,11],[3902,11],[4184,11]]},"514":{"position":[[58,11]]},"529":{"position":[[28,11]]},"541":{"position":[[115,11]]},"568":{"position":[[225,11]]},"571":{"position":[[57,11]]},"592":{"position":[[2644,11]]},"600":{"position":[[816,11]]},"627":{"position":[[244,12]]},"647":{"position":[[244,12]]},"653":{"position":[[281,11]]},"678":{"position":[[410,7]]},"679":{"position":[[1317,6]]},"687":{"position":[[3473,11],[3902,11],[4184,11]]},"708":{"position":[[816,11]]}},"keywords":{}}],["inherit",{"_index":932,"title":{"612":{"position":[[16,12]]},"720":{"position":[[16,12]]}},"content":{"39":{"position":[[939,12],[1073,11],[1308,12],[1341,9]]},"612":{"position":[[34,11],[191,10],[365,11],[1394,12],[1433,7],[1580,9],[1614,12],[1704,11],[1863,11]]},"720":{"position":[[34,11],[191,10],[365,11],[1394,12],[1433,7],[1580,9],[1614,12],[1704,11],[1863,11]]}},"keywords":{}}],["init",{"_index":1210,"title":{"196":{"position":[[0,4]]},"432":{"position":[[0,4]]},"679":{"position":[[0,4]]}},"content":{"51":{"position":[[1294,4]]},"52":{"position":[[1094,4],[3326,4]]},"117":{"position":[[1281,4],[1306,4]]},"126":{"position":[[1870,4]]},"147":{"position":[[758,4],[908,4]]},"178":{"position":[[485,7]]},"196":{"position":[[680,4]]},"198":{"position":[[1584,7],[2680,6]]},"209":{"position":[[222,4]]},"267":{"position":[[4141,5]]},"268":{"position":[[596,4],[707,4],[854,4],[1056,4]]},"269":{"position":[[558,5]]},"277":{"position":[[2038,4]]},"298":{"position":[[1281,4],[1306,4]]},"324":{"position":[[1567,4]]},"335":{"position":[[766,4],[916,4]]},"369":{"position":[[485,7]]},"384":{"position":[[571,5]]},"388":{"position":[[222,4]]},"407":{"position":[[4141,5]]},"408":{"position":[[596,4],[707,4],[854,4],[1056,4]]},"409":{"position":[[558,5]]},"432":{"position":[[617,4]]},"434":{"position":[[1574,7],[2670,6]]},"440":{"position":[[3942,4]]},"514":{"position":[[1870,4]]},"519":{"position":[[1281,4],[1306,4]]},"542":{"position":[[1567,4]]},"552":{"position":[[766,4],[916,4]]},"585":{"position":[[485,7]]},"596":{"position":[[922,4],[1159,4]]},"626":{"position":[[571,5]]},"644":{"position":[[4141,5]]},"645":{"position":[[596,4],[707,4],[854,4],[1056,4]]},"646":{"position":[[558,5]]},"658":{"position":[[222,4]]},"679":{"position":[[617,4]]},"681":{"position":[[1584,7],[2680,6]]},"687":{"position":[[3942,4]]},"704":{"position":[[922,4],[1159,4]]}},"keywords":{}}],["init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"",{"_index":1289,"title":{},"content":{"52":{"position":[[4347,250]]}},"keywords":{}}],["init(&mut",{"_index":476,"title":{},"content":{"17":{"position":[[649,13],[2243,13]]},"22":{"position":[[1194,13]]},"51":{"position":[[595,13]]},"115":{"position":[[340,13],[2183,13]]},"147":{"position":[[252,13]]},"162":{"position":[[771,13]]},"164":{"position":[[559,13]]},"178":{"position":[[558,13]]},"196":{"position":[[87,13]]},"204":{"position":[[70,13]]},"209":{"position":[[964,13]]},"247":{"position":[[105,13]]},"258":{"position":[[330,13],[2129,13]]},"321":{"position":[[1121,13]]},"335":{"position":[[252,13]]},"351":{"position":[[793,13]]},"353":{"position":[[594,13]]},"369":{"position":[[558,13]]},"388":{"position":[[896,13]]},"419":{"position":[[1370,13]]},"424":{"position":[[45,13]]},"432":{"position":[[49,13]]},"440":{"position":[[1157,13]]},"446":{"position":[[105,13]]},"476":{"position":[[497,13]]},"481":{"position":[[330,13],[2129,13]]},"539":{"position":[[1121,13]]},"552":{"position":[[252,13]]},"567":{"position":[[793,13]]},"569":{"position":[[594,13]]},"585":{"position":[[558,13]]},"596":{"position":[[314,13]]},"598":{"position":[[685,13]]},"600":{"position":[[194,13]]},"601":{"position":[[1326,13]]},"608":{"position":[[191,13]]},"616":{"position":[[688,13]]},"617":{"position":[[181,13]]},"656":{"position":[[1370,13]]},"658":{"position":[[896,13]]},"666":{"position":[[45,13]]},"673":{"position":[[105,13]]},"679":{"position":[[49,13]]},"687":{"position":[[1157,13]]},"698":{"position":[[497,13]]},"704":{"position":[[314,13]]},"706":{"position":[[685,13]]},"708":{"position":[[194,13]]},"709":{"position":[[1326,13]]},"716":{"position":[[191,13]]},"724":{"position":[[688,13]]},"725":{"position":[[181,13]]}},"keywords":{}}],["init(symbol",{"_index":3298,"title":{},"content":{"419":{"position":[[1557,13]]},"656":{"position":[[1557,13]]}},"keywords":{}}],["init_arg",{"_index":1821,"title":{},"content":{"126":{"position":[[2328,9],[2462,11]]},"138":{"position":[[480,9],[632,11]]},"143":{"position":[[394,9],[551,11]]},"168":{"position":[[599,9],[750,11],[857,9],[1010,11]]},"198":{"position":[[191,9],[284,11]]},"268":{"position":[[1186,9],[1376,11],[3086,11]]},"277":{"position":[[2496,9],[2630,11]]},"318":{"position":[[472,9],[624,11]]},"348":{"position":[[599,9],[750,11],[857,9],[1010,11]]},"395":{"position":[[1985,9],[2121,10]]},"408":{"position":[[1186,9],[1376,11],[3086,11]]},"417":{"position":[[185,9],[396,11]]},"419":{"position":[[6600,9],[6811,11]]},"434":{"position":[[191,9],[284,11]]},"440":{"position":[[4991,9],[5200,11]]},"441":{"position":[[4816,9],[5098,11]]},"514":{"position":[[2328,9],[2462,11]]},"544":{"position":[[472,9],[624,11]]},"564":{"position":[[599,9],[750,11],[857,9],[1010,11]]},"632":{"position":[[1985,9],[2121,10]]},"645":{"position":[[1186,9],[1376,11],[3086,11]]},"654":{"position":[[185,9],[396,11]]},"656":{"position":[[6600,9],[6811,11]]},"681":{"position":[[191,9],[284,11]]},"687":{"position":[[4991,9],[5200,11]]},"688":{"position":[[4816,9],[5098,11]]}},"keywords":{}}],["initarg",{"_index":2010,"title":{},"content":{"148":{"position":[[839,8]]},"336":{"position":[[839,8]]},"553":{"position":[[839,8]]}},"keywords":{}}],["initi",{"_index":661,"title":{},"content":{"22":{"position":[[946,7]]},"31":{"position":[[1322,11]]},"51":{"position":[[136,7]]},"52":{"position":[[3186,10],[3267,7],[4709,11],[6494,7]]},"72":{"position":[[115,7]]},"85":{"position":[[314,9]]},"99":{"position":[[178,7]]},"126":{"position":[[1383,10]]},"147":{"position":[[195,11],[970,15]]},"162":{"position":[[1645,12]]},"175":{"position":[[152,10]]},"178":{"position":[[501,11]]},"189":{"position":[[400,9]]},"194":{"position":[[94,11]]},"197":{"position":[[1708,12]]},"198":{"position":[[1179,14],[1795,7],[3034,7]]},"204":{"position":[[1151,7]]},"206":{"position":[[531,16],[585,7]]},"221":{"position":[[629,12]]},"236":{"position":[[115,7]]},"247":{"position":[[1638,10]]},"254":{"position":[[314,9]]},"269":{"position":[[4441,16],[4495,7]]},"277":{"position":[[1551,10]]},"291":{"position":[[178,7]]},"321":{"position":[[1045,11]]},"335":{"position":[[195,11],[978,15]]},"351":{"position":[[1667,12]]},"361":{"position":[[152,10]]},"366":{"position":[[400,9]]},"369":{"position":[[501,11]]},"409":{"position":[[4441,16],[4495,7]]},"419":{"position":[[1294,11],[1347,7]]},"424":{"position":[[1101,7]]},"426":{"position":[[531,16],[585,7]]},"430":{"position":[[94,11]]},"433":{"position":[[1707,12]]},"434":{"position":[[1169,14],[1785,7],[3016,7]]},"446":{"position":[[1638,10]]},"454":{"position":[[629,12]]},"472":{"position":[[115,7]]},"476":{"position":[[441,11]]},"485":{"position":[[314,9]]},"503":{"position":[[178,7]]},"514":{"position":[[1383,10]]},"539":{"position":[[1045,11]]},"552":{"position":[[195,11],[978,15]]},"567":{"position":[[1667,12]]},"577":{"position":[[152,10]]},"582":{"position":[[400,9]]},"585":{"position":[[501,11]]},"596":{"position":[[1118,10]]},"616":{"position":[[630,11]]},"618":{"position":[[141,15]]},"646":{"position":[[4441,16],[4495,7]]},"656":{"position":[[1294,11],[1347,7]]},"666":{"position":[[1101,7]]},"668":{"position":[[531,16],[585,7]]},"673":{"position":[[1638,10]]},"677":{"position":[[94,11]]},"680":{"position":[[1707,12]]},"681":{"position":[[1179,14],[1795,7],[3034,7]]},"694":{"position":[[629,12]]},"698":{"position":[[441,11]]},"704":{"position":[[1118,10]]},"724":{"position":[[630,11]]},"726":{"position":[[141,15]]}},"keywords":{}}],["initial_suppli",{"_index":1719,"title":{},"content":{"115":{"position":[[404,15],[533,16],[2247,15],[2396,16]]},"126":{"position":[[1999,15],[2380,15]]},"204":{"position":[[134,15]]},"206":{"position":[[238,15],[474,15]]},"247":{"position":[[169,15],[298,16]]},"258":{"position":[[394,15],[523,16],[2193,15],[2342,16]]},"268":{"position":[[1286,15]]},"269":{"position":[[623,15],[801,14],[888,16],[1007,14],[4142,15],[4378,15]]},"277":{"position":[[2167,15],[2548,15]]},"384":{"position":[[636,15],[814,14],[901,16],[1020,14]]},"395":{"position":[[1945,14],[2040,15]]},"408":{"position":[[1286,15]]},"409":{"position":[[623,15],[801,14],[888,16],[1007,14],[4142,15],[4378,15]]},"417":{"position":[[305,15]]},"419":{"position":[[1434,15],[1587,15],[6720,15]]},"424":{"position":[[109,15]]},"426":{"position":[[238,15],[474,15]]},"446":{"position":[[169,15],[298,16]]},"481":{"position":[[394,15],[523,16],[2193,15],[2342,16]]},"514":{"position":[[1999,15],[2380,15]]},"626":{"position":[[636,15],[814,14],[901,16],[1020,14]]},"632":{"position":[[1945,14],[2040,15]]},"645":{"position":[[1286,15]]},"646":{"position":[[623,15],[801,14],[888,16],[1007,14],[4142,15],[4378,15]]},"654":{"position":[[305,15]]},"656":{"position":[[1434,15],[1587,15],[6720,15]]},"666":{"position":[[109,15]]},"668":{"position":[[238,15],[474,15]]},"673":{"position":[[169,15],[298,16]]}},"keywords":{}}],["initial_supply.into",{"_index":2500,"title":{},"content":{"206":{"position":[[490,21],[874,23],[1046,21]]},"269":{"position":[[4784,23],[4956,21]]},"409":{"position":[[4784,23],[4956,21]]},"426":{"position":[[490,21],[874,23],[1041,21]]},"646":{"position":[[4784,23],[4956,21]]},"668":{"position":[[490,21],[874,23],[1046,21]]}},"keywords":{}}],["initial_supply.is_zero",{"_index":2931,"title":{},"content":{"269":{"position":[[908,25]]},"384":{"position":[[921,25]]},"409":{"position":[[908,25]]},"626":{"position":[[921,25]]},"646":{"position":[[908,25]]}},"keywords":{}}],["initialization.l76",{"_index":3423,"title":{},"content":{"440":{"position":[[4054,18]]},"687":{"position":[[4054,18]]}},"keywords":{}}],["initialization_work",{"_index":2384,"title":{},"content":{"198":{"position":[[342,22]]},"434":{"position":[[342,22]]},"681":{"position":[[342,22]]}},"keywords":{}}],["initialown",{"_index":1118,"title":{},"content":{"43":{"position":[[298,13]]}},"keywords":{}}],["ink",{"_index":631,"title":{},"content":{"21":{"position":[[250,4]]}},"keywords":{}}],["inlin",{"_index":3507,"title":{},"content":{"441":{"position":[[3547,9],[3651,9]]},"606":{"position":[[322,9],[464,9],[904,6],[987,9]]},"688":{"position":[[3547,9],[3651,9]]},"714":{"position":[[322,9],[464,9],[904,6],[987,9]]}},"keywords":{}}],["inner",{"_index":1536,"title":{},"content":{"85":{"position":[[285,5]]},"209":{"position":[[1554,6]]},"211":{"position":[[378,6]]},"254":{"position":[[285,5]]},"388":{"position":[[1486,6]]},"390":{"position":[[365,6]]},"485":{"position":[[285,5]]},"601":{"position":[[377,5]]},"658":{"position":[[1486,6]]},"660":{"position":[[365,6]]},"709":{"position":[[377,5]]}},"keywords":{}}],["innerdata",{"_index":2566,"title":{},"content":{"209":{"position":[[1644,9]]},"211":{"position":[[385,10]]},"388":{"position":[[1576,9]]},"390":{"position":[[372,10]]},"658":{"position":[[1576,9]]},"660":{"position":[[372,10]]}},"keywords":{}}],["input",{"_index":454,"title":{},"content":{"17":{"position":[[159,5]]},"31":{"position":[[689,6],[785,6],[834,6],[871,6],[2338,5]]},"32":{"position":[[382,6],[608,5],[914,5],[1308,5]]},"40":{"position":[[116,5]]},"42":{"position":[[346,5]]},"197":{"position":[[995,5]]},"433":{"position":[[994,5]]},"616":{"position":[[1375,5]]},"680":{"position":[[994,5]]},"724":{"position":[[1375,5]]}},"keywords":{}}],["inputlowerthanten",{"_index":3800,"title":{},"content":{"611":{"position":[[133,17]]},"719":{"position":[[133,17]]}},"keywords":{}}],["insid",{"_index":1601,"title":{},"content":{"92":{"position":[[769,6]]},"168":{"position":[[1465,6]]},"284":{"position":[[769,6]]},"348":{"position":[[1465,6]]},"496":{"position":[[769,6]]},"564":{"position":[[1465,6]]},"607":{"position":[[143,6],[232,6],[323,6]]},"715":{"position":[[143,6],[232,6],[323,6]]}},"keywords":{}}],["insight",{"_index":1162,"title":{},"content":{"43":{"position":[[1987,7]]},"270":{"position":[[479,8]]},"385":{"position":[[479,8]]},"410":{"position":[[479,8]]},"627":{"position":[[479,8]]},"647":{"position":[[479,8]]}},"keywords":{}}],["inspir",{"_index":679,"title":{},"content":{"23":{"position":[[226,8]]},"188":{"position":[[821,8]]},"365":{"position":[[111,8],[291,8],[1178,8]]},"581":{"position":[[111,8],[291,8],[1178,8]]}},"keywords":{}}],["instal",{"_index":683,"title":{"172":{"position":[[0,12]]},"174":{"position":[[0,10]]},"358":{"position":[[0,12]]},"360":{"position":[[0,10]]},"574":{"position":[[0,12]]},"576":{"position":[[0,10]]}},"content":{"26":{"position":[[8,12]]},"28":{"position":[[8,12]]},"31":{"position":[[190,7]]},"36":{"position":[[8,12]]},"46":{"position":[[8,12]]},"48":{"position":[[8,12]]},"57":{"position":[[8,12]]},"59":{"position":[[8,12]]},"61":{"position":[[8,12]]},"63":{"position":[[8,12]]},"91":{"position":[[331,10]]},"173":{"position":[[59,9],[101,9],[141,9],[199,10]]},"174":{"position":[[171,10],[185,7],[241,7],[289,9]]},"175":{"position":[[569,12]]},"214":{"position":[[8,12]]},"216":{"position":[[8,12]]},"225":{"position":[[8,12]]},"261":{"position":[[54,9],[120,7],[171,7]]},"283":{"position":[[331,10]]},"359":{"position":[[59,9],[101,9],[141,9],[199,10]]},"360":{"position":[[171,10],[185,7],[241,7],[289,9]]},"361":{"position":[[569,12]]},"365":{"position":[[277,13]]},"379":{"position":[[54,9],[120,7],[171,7]]},"393":{"position":[[69,7]]},"401":{"position":[[54,9],[120,7],[171,7]]},"449":{"position":[[8,12]]},"495":{"position":[[331,10]]},"575":{"position":[[59,9],[101,9],[141,9],[199,10]]},"576":{"position":[[171,10],[185,7],[241,7],[289,9]]},"577":{"position":[[569,12]]},"581":{"position":[[277,13]]},"621":{"position":[[54,9],[120,7],[171,7]]},"630":{"position":[[69,7]]},"638":{"position":[[54,9],[120,7],[171,7]]}},"keywords":{}}],["instanc",{"_index":717,"title":{},"content":{"31":{"position":[[132,8]]},"85":{"position":[[854,9]]},"95":{"position":[[491,8]]},"119":{"position":[[457,9]]},"141":{"position":[[326,8]]},"143":{"position":[[649,8]]},"168":{"position":[[1181,8],[1241,9]]},"196":{"position":[[1636,8]]},"198":{"position":[[1671,8]]},"206":{"position":[[3365,9]]},"254":{"position":[[854,9]]},"267":{"position":[[4378,8]]},"268":{"position":[[1958,9]]},"287":{"position":[[491,8]]},"300":{"position":[[457,9]]},"326":{"position":[[326,8]]},"328":{"position":[[624,8]]},"348":{"position":[[1181,8],[1241,9]]},"407":{"position":[[4378,8]]},"408":{"position":[[1958,9]]},"426":{"position":[[3340,9]]},"432":{"position":[[1514,8]]},"434":{"position":[[1661,8]]},"485":{"position":[[854,9]]},"499":{"position":[[491,8]]},"521":{"position":[[457,9]]},"535":{"position":[[326,8]]},"537":{"position":[[624,8]]},"564":{"position":[[1181,8],[1241,9]]},"600":{"position":[[1166,8]]},"644":{"position":[[4378,8]]},"645":{"position":[[1958,9]]},"668":{"position":[[3365,9]]},"679":{"position":[[1514,8]]},"681":{"position":[[1671,8]]},"708":{"position":[[1166,8]]}},"keywords":{}}],["instant",{"_index":1862,"title":{},"content":{"127":{"position":[[829,7]]},"128":{"position":[[423,7]]},"278":{"position":[[829,7]]},"279":{"position":[[423,7]]},"515":{"position":[[829,7]]},"516":{"position":[[423,7]]}},"keywords":{}}],["instanti",{"_index":1080,"title":{},"content":{"42":{"position":[[1929,11]]},"52":{"position":[[1158,11],[1960,11],[2031,13]]}},"keywords":{}}],["instantli",{"_index":1699,"title":{},"content":{"107":{"position":[[475,9]]},"274":{"position":[[475,9]]},"491":{"position":[[475,9]]}},"keywords":{}}],["instead",{"_index":1703,"title":{},"content":{"110":{"position":[[459,7]]},"117":{"position":[[1367,7]]},"141":{"position":[[149,8]]},"142":{"position":[[53,7]]},"143":{"position":[[813,8]]},"164":{"position":[[80,7]]},"197":{"position":[[1861,8]]},"198":{"position":[[3565,7],[3747,7]]},"203":{"position":[[568,8]]},"264":{"position":[[107,8]]},"268":{"position":[[362,7]]},"298":{"position":[[1367,7]]},"305":{"position":[[459,7]]},"326":{"position":[[149,8]]},"327":{"position":[[53,7]]},"328":{"position":[[788,8]]},"353":{"position":[[80,7]]},"396":{"position":[[708,7]]},"404":{"position":[[107,8]]},"408":{"position":[[362,7]]},"416":{"position":[[4691,7]]},"423":{"position":[[568,8]]},"433":{"position":[[1860,8]]},"434":{"position":[[3547,7],[3729,7]]},"510":{"position":[[459,7]]},"519":{"position":[[1367,7]]},"535":{"position":[[149,8]]},"536":{"position":[[53,7]]},"537":{"position":[[788,8]]},"569":{"position":[[80,7]]},"601":{"position":[[354,7],[2218,7]]},"602":{"position":[[1128,7]]},"606":{"position":[[603,8]]},"612":{"position":[[180,7]]},"614":{"position":[[392,8]]},"633":{"position":[[708,7]]},"641":{"position":[[107,8]]},"645":{"position":[[362,7]]},"653":{"position":[[4691,7]]},"665":{"position":[[568,8]]},"680":{"position":[[1860,8]]},"681":{"position":[[3565,7],[3747,7]]},"709":{"position":[[354,7],[2218,7]]},"710":{"position":[[1128,7]]},"714":{"position":[[603,8]]},"720":{"position":[[180,7]]},"722":{"position":[[392,8]]}},"keywords":{}}],["instruct",{"_index":3105,"title":{},"content":{"393":{"position":[[99,12]]},"630":{"position":[[99,12]]}},"keywords":{}}],["insuffici",{"_index":3434,"title":{},"content":{"440":{"position":[[4691,12],[5880,12]]},"687":{"position":[[4691,12],[5880,12]]}},"keywords":{}}],["insufficientallow",{"_index":549,"title":{},"content":{"17":{"position":[[4037,21]]},"205":{"position":[[2240,21]]},"267":{"position":[[1361,21]]},"269":{"position":[[3724,21]]},"383":{"position":[[807,21]]},"384":{"position":[[3688,21]]},"407":{"position":[[1361,21]]},"409":{"position":[[3724,21]]},"425":{"position":[[2190,21]]},"625":{"position":[[807,21]]},"626":{"position":[[3688,21]]},"644":{"position":[[1361,21]]},"646":{"position":[[3724,21]]},"667":{"position":[[2190,21]]}},"keywords":{}}],["insufficientbal",{"_index":548,"title":{},"content":{"17":{"position":[[4008,19]]},"205":{"position":[[2215,19]]},"267":{"position":[[1331,19]]},"269":{"position":[[3694,19]]},"383":{"position":[[777,19]]},"384":{"position":[[3658,19]]},"407":{"position":[[1331,19]]},"409":{"position":[[3694,19]]},"425":{"position":[[2165,19]]},"476":{"position":[[1679,19]]},"611":{"position":[[108,19]]},"625":{"position":[[777,19]]},"626":{"position":[[3658,19]]},"644":{"position":[[1331,19]]},"646":{"position":[[3694,19]]},"667":{"position":[[2165,19]]},"698":{"position":[[1679,19]]},"719":{"position":[[108,19]]}},"keywords":{}}],["insufficientfund",{"_index":3364,"title":{},"content":{"440":{"position":[[824,17]]},"687":{"position":[[824,17]]}},"keywords":{}}],["integ",{"_index":253,"title":{},"content":{"8":{"position":[[558,7]]},"267":{"position":[[311,7]]},"407":{"position":[[311,7]]},"598":{"position":[[261,7],[327,7],[389,7],[451,7],[1561,7],[1650,7],[1712,9],[1749,9]]},"644":{"position":[[311,7]]},"706":{"position":[[261,7],[327,7],[389,7],[451,7],[1561,7],[1650,7],[1712,9],[1749,9]]}},"keywords":{}}],["integr",{"_index":621,"title":{},"content":{"21":{"position":[[34,10]]},"22":{"position":[[479,10]]},"50":{"position":[[142,10]]},"54":{"position":[[339,11]]},"91":{"position":[[224,10]]},"97":{"position":[[206,12],[361,12]]},"98":{"position":[[625,11]]},"110":{"position":[[305,12]]},"126":{"position":[[829,11]]},"129":{"position":[[360,11]]},"277":{"position":[[829,11]]},"280":{"position":[[360,11]]},"283":{"position":[[224,10]]},"289":{"position":[[206,12],[361,12]]},"290":{"position":[[625,11]]},"305":{"position":[[305,12]]},"495":{"position":[[224,10]]},"501":{"position":[[206,12],[361,12]]},"502":{"position":[[625,11]]},"510":{"position":[[305,12]]},"514":{"position":[[829,11]]},"517":{"position":[[360,11]]}},"keywords":{}}],["integration.env",{"_index":1868,"title":{},"content":{"129":{"position":[[261,15],[434,15],[683,15]]},"280":{"position":[[261,15],[434,15],[684,15]]},"517":{"position":[[261,15],[434,15],[684,15]]}},"keywords":{}}],["intend",{"_index":1313,"title":{},"content":{"53":{"position":[[1404,9]]},"143":{"position":[[932,6]]},"221":{"position":[[414,8]]},"328":{"position":[[907,6]]},"454":{"position":[[414,8]]},"537":{"position":[[907,6]]},"694":{"position":[[414,8]]}},"keywords":{}}],["intention",{"_index":885,"title":{},"content":{"38":{"position":[[871,13]]}},"keywords":{}}],["interact",{"_index":1082,"title":{"161":{"position":[[8,11]]},"350":{"position":[[8,11]]},"566":{"position":[[8,11]]}},"content":{"42":{"position":[[1982,8]]},"52":{"position":[[372,8],[510,12],[1934,8]]},"76":{"position":[[123,12],[168,11]]},"111":{"position":[[198,11]]},"141":{"position":[[760,8]]},"146":{"position":[[829,12]]},"147":{"position":[[1298,8]]},"198":{"position":[[3359,12]]},"227":{"position":[[123,12],[168,11]]},"268":{"position":[[1401,14]]},"306":{"position":[[198,11]]},"326":{"position":[[760,8]]},"334":{"position":[[833,12]]},"335":{"position":[[1306,8]]},"395":{"position":[[6846,8]]},"397":{"position":[[129,8]]},"398":{"position":[[62,10]]},"408":{"position":[[1401,14]]},"418":{"position":[[116,8]]},"434":{"position":[[3341,12]]},"441":{"position":[[2033,8]]},"458":{"position":[[123,12],[168,11]]},"477":{"position":[[14,8],[525,8],[653,9]]},"478":{"position":[[381,12]]},"511":{"position":[[198,11]]},"535":{"position":[[760,8]]},"551":{"position":[[833,12]]},"552":{"position":[[1306,8]]},"603":{"position":[[238,11]]},"632":{"position":[[6846,8]]},"634":{"position":[[129,8]]},"635":{"position":[[62,10]]},"645":{"position":[[1401,14]]},"655":{"position":[[116,8]]},"681":{"position":[[3359,12]]},"688":{"position":[[2033,8]]},"699":{"position":[[14,8],[525,8],[653,9]]},"700":{"position":[[381,12]]},"711":{"position":[[238,11]]}},"keywords":{}}],["interchang",{"_index":2407,"title":{},"content":{"198":{"position":[[2515,15]]},"434":{"position":[[2505,15]]},"681":{"position":[[2515,15]]}},"keywords":{}}],["interest",{"_index":392,"title":{},"content":{"13":{"position":[[0,10]]},"18":{"position":[[141,11]]},"34":{"position":[[0,11]]},"55":{"position":[[0,11]]},"185":{"position":[[35,11]]},"376":{"position":[[35,11]]},"416":{"position":[[3082,11]]},"592":{"position":[[35,11]]},"653":{"position":[[3082,11]]}},"keywords":{}}],["interfac",{"_index":627,"title":{},"content":{"21":{"position":[[183,9]]},"23":{"position":[[107,10]]},"39":{"position":[[2109,11]]},"52":{"position":[[319,9]]},"54":{"position":[[319,10]]},"83":{"position":[[482,9]]},"110":{"position":[[29,9]]},"252":{"position":[[482,9]]},"305":{"position":[[29,9]]},"365":{"position":[[60,9]]},"483":{"position":[[482,9]]},"510":{"position":[[29,9]]},"581":{"position":[[60,9]]},"609":{"position":[[316,9]]},"613":{"position":[[1977,10]]},"717":{"position":[[316,9]]},"721":{"position":[[1977,10]]}},"keywords":{}}],["interface.allow",{"_index":2752,"title":{},"content":{"245":{"position":[[56,15]]},"444":{"position":[[56,15]]},"671":{"position":[[56,15]]}},"keywords":{}}],["interface.l29",{"_index":3321,"title":{},"content":{"424":{"position":[[1235,13]]},"666":{"position":[[1235,13]]}},"keywords":{}}],["interface.l34",{"_index":2455,"title":{},"content":{"204":{"position":[[1285,13]]}},"keywords":{}}],["intermediari",{"_index":3470,"title":{},"content":{"441":{"position":[[73,12]]},"688":{"position":[[73,12]]}},"keywords":{}}],["intern",{"_index":1127,"title":{"144":{"position":[[8,9]]},"332":{"position":[[8,9]]},"549":{"position":[[8,9]]}},"content":{"43":{"position":[[528,8],[1916,8]]},"78":{"position":[[114,11]]},"95":{"position":[[382,10]]},"110":{"position":[[498,10]]},"175":{"position":[[345,8]]},"229":{"position":[[114,11]]},"267":{"position":[[2463,10]]},"287":{"position":[[382,10]]},"305":{"position":[[498,10]]},"361":{"position":[[345,8]]},"407":{"position":[[2463,10]]},"460":{"position":[[114,11]]},"499":{"position":[[382,10]]},"510":{"position":[[498,10]]},"577":{"position":[[345,8]]},"604":{"position":[[44,8],[424,8]]},"644":{"position":[[2463,10]]},"712":{"position":[[44,8],[424,8]]}},"keywords":{}}],["internal_transfer(&mut",{"_index":3748,"title":{},"content":{"604":{"position":[[320,26]]},"712":{"position":[[320,26]]}},"keywords":{}}],["into<executionerror>>(error",{"_index":2864,"title":{},"content":{"267":{"position":[[2666,37]]},"407":{"position":[[2666,37]]},"644":{"position":[[2666,37]]}},"keywords":{}}],["into<odra::odraerror>",{"_index":2337,"title":{},"content":{"196":{"position":[[1051,27]]},"432":{"position":[[996,27]]},"679":{"position":[[996,27]]}},"keywords":{}}],["into<odraerror>>(&self",{"_index":2866,"title":{},"content":{"267":{"position":[[2738,36]]},"407":{"position":[[2738,36]]},"644":{"position":[[2738,36]]}},"keywords":{}}],["into::into",{"_index":1925,"title":{},"content":{"138":{"position":[[1274,13]]},"318":{"position":[[1266,13]]},"544":{"position":[[1266,13]]}},"keywords":{}}],["intro",{"_index":2714,"title":{},"content":{"221":{"position":[[389,6]]},"454":{"position":[[389,6]]},"694":{"position":[[389,6]]}},"keywords":{}}],["introduc",{"_index":171,"title":{},"content":{"5":{"position":[[96,10]]},"6":{"position":[[12,9]]},"205":{"position":[[142,9]]},"262":{"position":[[98,10]]},"264":{"position":[[11,10]]},"380":{"position":[[98,10]]},"402":{"position":[[98,10]]},"404":{"position":[[11,10]]},"425":{"position":[[142,9]]},"441":{"position":[[60,9]]},"622":{"position":[[98,10]]},"639":{"position":[[98,10]]},"641":{"position":[[11,10]]},"667":{"position":[[142,9]]},"688":{"position":[[60,9]]}},"keywords":{}}],["introduct",{"_index":3601,"title":{"594":{"position":[[0,13]]},"702":{"position":[[0,13]]}},"content":{},"keywords":{}}],["invalid",{"_index":2203,"title":{},"content":{"184":{"position":[[1144,7]]},"321":{"position":[[1899,7],[1937,7]]},"375":{"position":[[1041,7]]},"539":{"position":[[1899,7],[1937,7]]},"591":{"position":[[1041,7]]}},"keywords":{}}],["invalid"",{"_index":3012,"title":{},"content":{"323":{"position":[[1462,14],[1598,14]]},"541":{"position":[[1462,14],[1598,14]]}},"keywords":{}}],["invalidnam",{"_index":2981,"title":{},"content":{"321":{"position":[[1945,12]]},"539":{"position":[[1945,12]]}},"keywords":{}}],["invalidown",{"_index":2980,"title":{},"content":{"321":{"position":[[1907,13]]},"539":{"position":[[1907,13]]}},"keywords":{}}],["invalidticketid",{"_index":3366,"title":{},"content":{"440":{"position":[[849,15]]},"687":{"position":[[849,15]]}},"keywords":{}}],["ip",{"_index":3170,"title":{},"content":{"395":{"position":[[4347,2]]},"632":{"position":[[4347,2]]}},"keywords":{}}],["is_approv",{"_index":3465,"title":{},"content":{"440":{"position":[[6426,12]]},"687":{"position":[[6426,12]]}},"keywords":{}}],["is_oper",{"_index":3466,"title":{},"content":{"440":{"position":[[6450,12]]},"441":{"position":[[4290,11]]},"687":{"position":[[6450,12]]},"688":{"position":[[4290,11]]}},"keywords":{}}],["is_operator(&self",{"_index":3508,"title":{},"content":{"441":{"position":[[3560,22]]},"688":{"position":[[3560,22]]}},"keywords":{}}],["is_own",{"_index":3464,"title":{},"content":{"440":{"position":[[6405,9]]},"687":{"position":[[6405,9]]}},"keywords":{}}],["is_paus",{"_index":2705,"title":{},"content":{"220":{"position":[[211,10]]},"221":{"position":[[556,11],[606,9]]},"453":{"position":[[211,10]]},"454":{"position":[[556,11],[606,9]]},"693":{"position":[[211,10]]},"694":{"position":[[556,11],[606,9]]}},"keywords":{}}],["is_paused(&self",{"_index":2706,"title":{},"content":{"221":{"position":[[80,20]]},"454":{"position":[[80,20]]},"694":{"position":[[80,20]]}},"keywords":{}}],["is_vote_open",{"_index":3223,"title":{},"content":{"416":{"position":[[667,13],[1112,12],[2255,12]]},"419":{"position":[[1038,13]]},"653":{"position":[[667,13],[1112,12],[2255,12]]},"656":{"position":[[1038,13]]}},"keywords":{}}],["ish",{"_index":2492,"title":{},"content":{"205":{"position":[[2358,3]]},"425":{"position":[[2308,3]]},"667":{"position":[[2308,3]]}},"keywords":{}}],["ishash",{"_index":3187,"title":{},"content":{"395":{"position":[[6886,6]]},"632":{"position":[[6886,6]]}},"keywords":{}}],["isn't",{"_index":671,"title":{},"content":{"22":{"position":[[1470,5]]}},"keywords":{}}],["isol",{"_index":2779,"title":{},"content":{"248":{"position":[[139,10]]},"447":{"position":[[139,10]]},"674":{"position":[[139,10]]}},"keywords":{}}],["issu",{"_index":1508,"title":{},"content":{"83":{"position":[[232,5]]},"162":{"position":[[2426,5]]},"252":{"position":[[232,5]]},"270":{"position":[[29,6]]},"351":{"position":[[2448,5]]},"385":{"position":[[29,6]]},"410":{"position":[[29,6]]},"438":{"position":[[142,5]]},"440":{"position":[[3646,6],[4125,5]]},"483":{"position":[[232,5]]},"567":{"position":[[2448,5]]},"612":{"position":[[1755,7]]},"627":{"position":[[29,6]]},"647":{"position":[[29,6]]},"685":{"position":[[142,5]]},"687":{"position":[[3646,6],[4125,5]]},"720":{"position":[[1755,7]]}},"keywords":{}}],["issue_ticket",{"_index":3425,"title":{},"content":{"440":{"position":[[4083,12]]},"441":{"position":[[4003,12]]},"687":{"position":[[4083,12]]},"688":{"position":[[4003,12]]}},"keywords":{}}],["issue_ticket(&mut",{"_index":3385,"title":{},"content":{"440":{"position":[[1621,21]]},"441":{"position":[[2833,21]]},"687":{"position":[[1621,21]]},"688":{"position":[[2833,21]]}},"keywords":{}}],["istanbul",{"_index":705,"title":{},"content":{"30":{"position":[[544,8]]}},"keywords":{}}],["it!"",{"_index":295,"title":{},"content":{"9":{"position":[[1000,10]]}},"keywords":{}}],["it'",{"_index":0,"title":{"0":{"position":[[0,4]]}},"content":{"9":{"position":[[0,4],[1043,4]]},"22":{"position":[[294,4]]},"31":{"position":[[282,4]]},"32":{"position":[[0,4]]},"33":{"position":[[46,4]]},"38":{"position":[[821,4]]},"52":{"position":[[4812,4]]},"85":{"position":[[694,4]]},"100":{"position":[[269,4],[881,4]]},"146":{"position":[[200,4]]},"178":{"position":[[214,4]]},"254":{"position":[[694,4]]},"292":{"position":[[269,4],[881,4]]},"334":{"position":[[200,4]]},"369":{"position":[[214,4]]},"485":{"position":[[694,4]]},"504":{"position":[[269,4],[881,4]]},"551":{"position":[[200,4]]},"585":{"position":[[214,4]]},"601":{"position":[[2131,4]]},"709":{"position":[[2131,4]]}},"keywords":{}}],["it'll",{"_index":1235,"title":{},"content":{"52":{"position":[[495,5]]}},"keywords":{}}],["it.l19",{"_index":2194,"title":{},"content":{"184":{"position":[[827,6]]},"375":{"position":[[746,6]]},"591":{"position":[[746,6]]}},"keywords":{}}],["it_work",{"_index":3273,"title":{},"content":{"417":{"position":[[140,10]]},"419":{"position":[[6555,10]]},"440":{"position":[[4946,10]]},"441":{"position":[[4771,10]]},"654":{"position":[[140,10]]},"656":{"position":[[6555,10]]},"687":{"position":[[4946,10]]},"688":{"position":[[4771,10]]}},"keywords":{}}],["item",{"_index":3733,"title":{},"content":{"602":{"position":[[1217,5],[1981,5],[2100,5]]},"613":{"position":[[1903,5]]},"710":{"position":[[1217,5],[1981,5],[2100,5]]},"721":{"position":[[1903,5]]}},"keywords":{}}],["iter",{"_index":1424,"title":{},"content":{"76":{"position":[[860,8]]},"163":{"position":[[1227,7]]},"227":{"position":[[860,8]]},"352":{"position":[[1249,7]]},"458":{"position":[[860,8]]},"568":{"position":[[1249,7]]}},"keywords":{}}],["iterations.reus",{"_index":71,"title":{},"content":{"1":{"position":[[888,22]]}},"keywords":{}}],["itself",{"_index":75,"title":{},"content":{"1":{"position":[[936,7]]},"79":{"position":[[361,7]]},"97":{"position":[[141,7]]},"107":{"position":[[453,7]]},"114":{"position":[[412,7]]},"120":{"position":[[28,6]]},"146":{"position":[[163,6],[457,7],[684,7]]},"178":{"position":[[177,6]]},"230":{"position":[[378,7]]},"257":{"position":[[412,7]]},"274":{"position":[[453,7]]},"289":{"position":[[141,7]]},"301":{"position":[[28,6]]},"334":{"position":[[163,6],[461,7],[688,7]]},"369":{"position":[[177,6]]},"416":{"position":[[4926,7]]},"419":{"position":[[1516,7]]},"461":{"position":[[378,7]]},"480":{"position":[[412,7]]},"491":{"position":[[453,7]]},"501":{"position":[[141,7]]},"522":{"position":[[28,6]]},"551":{"position":[[163,6],[461,7],[688,7]]},"585":{"position":[[177,6]]},"653":{"position":[[4926,7]]},"656":{"position":[[1516,7]]}},"keywords":{}}],["j",{"_index":3755,"title":{},"content":{"605":{"position":[[222,2],[246,1]]},"713":{"position":[[222,2],[246,1]]}},"keywords":{}}],["job",{"_index":32,"title":{},"content":{"1":{"position":[[347,4]]}},"keywords":{}}],["join",{"_index":391,"title":{"13":{"position":[[0,4]]},"24":{"position":[[0,4]]},"34":{"position":[[0,4]]},"55":{"position":[[0,4]]}},"content":{"13":{"position":[[40,4]]},"24":{"position":[[114,4]]},"34":{"position":[[12,4]]},"55":{"position":[[12,4]]},"618":{"position":[[724,4]]},"726":{"position":[[724,4]]}},"keywords":{}}],["journal",{"_index":286,"title":{},"content":{"9":{"position":[[766,7],[1167,7],[1208,7]]},"10":{"position":[[43,8],[281,7],[570,8]]}},"keywords":{}}],["journey",{"_index":26,"title":{},"content":{"1":{"position":[[255,8]]}},"keywords":{}}],["json",{"_index":1789,"title":{},"content":{"121":{"position":[[183,4]]},"302":{"position":[[183,4]]},"323":{"position":[[83,4]]},"523":{"position":[[183,4]]},"541":{"position":[[83,4]]}},"keywords":{}}],["jump",{"_index":1639,"title":{},"content":{"97":{"position":[[341,4]]},"289":{"position":[[341,4]]},"501":{"position":[[341,4]]}},"keywords":{}}],["juno",{"_index":1184,"title":{},"content":{"50":{"position":[[514,4]]},"52":{"position":[[108,4],[189,4],[386,4],[989,6]]}},"keywords":{}}],["juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g",{"_index":1292,"title":{},"content":{"52":{"position":[[4747,64],[4943,63],[6591,63]]},"53":{"position":[[309,63],[610,63],[762,63]]}},"keywords":{}}],["juno1le848rjac00nezzq46v5unxujaltdf270vhtfh",{"_index":1307,"title":{},"content":{"53":{"position":[[506,43],[925,43]]}},"keywords":{}}],["junod",{"_index":1252,"title":{},"content":{"52":{"position":[[954,5],[1025,5],[1144,5],[1440,5],[1607,5]]},"53":{"position":[[106,5]]}},"keywords":{}}],["justfil",{"_index":1234,"title":{},"content":{"52":{"position":[[485,9],[574,8]]}},"keywords":{}}],["keccak256",{"_index":3904,"title":{},"content":{"616":{"position":[[1210,9]]},"724":{"position":[[1210,9]]}},"keywords":{}}],["keep",{"_index":133,"title":{},"content":{"3":{"position":[[228,4]]},"52":{"position":[[449,4]]},"78":{"position":[[144,5]]},"95":{"position":[[393,5]]},"119":{"position":[[541,4]]},"162":{"position":[[1529,4]]},"229":{"position":[[144,5]]},"287":{"position":[[393,5]]},"300":{"position":[[541,4]]},"351":{"position":[[1551,4]]},"416":{"position":[[1013,4]]},"460":{"position":[[144,5]]},"499":{"position":[[393,5]]},"521":{"position":[[541,4]]},"567":{"position":[[1551,4]]},"653":{"position":[[1013,4]]}},"keywords":{}}],["kept",{"_index":866,"title":{},"content":{"38":{"position":[[358,4]]}},"keywords":{}}],["key",{"_index":204,"title":{"85":{"position":[[0,3]]},"254":{"position":[[0,3]]},"485":{"position":[[0,3]]}},"content":{"6":{"position":[[157,3]]},"43":{"position":[[1004,3]]},"52":{"position":[[960,4],[2303,4],[3298,4],[4919,3]]},"53":{"position":[[279,4],[403,4],[461,4],[487,4],[580,4],[676,4],[732,4],[828,4],[866,4],[904,4]]},"76":{"position":[[606,3],[667,4],[724,4]]},"79":{"position":[[24,3],[59,3],[1184,3]]},"81":{"position":[[88,3],[241,4]]},"83":{"position":[[70,4],[148,5],[333,3],[356,4]]},"84":{"position":[[395,3],[427,4],[849,4]]},"85":{"position":[[525,4],[557,4],[626,4],[658,4],[730,4],[928,4],[969,3]]},"91":{"position":[[677,4]]},"92":{"position":[[248,4]]},"98":{"position":[[181,3],[302,3]]},"99":{"position":[[304,3]]},"100":{"position":[[398,3],[1124,3],[1152,5]]},"101":{"position":[[252,3]]},"126":{"position":[[105,3],[191,4],[449,3],[527,5],[585,3],[916,4],[963,3],[1680,5]]},"162":{"position":[[122,3]]},"163":{"position":[[48,3],[120,3],[494,3],[741,4],[1306,3]]},"201":{"position":[[101,3]]},"203":{"position":[[398,3],[603,3],[624,5]]},"210":{"position":[[455,3],[1229,3]]},"211":{"position":[[125,5],[550,3],[763,3]]},"212":{"position":[[1078,4],[1177,4],[1481,3],[1539,3],[2558,3],[2630,3],[2864,3],[3015,3],[3477,3],[3773,3],[3865,3]]},"227":{"position":[[606,3],[667,4],[724,4]]},"230":{"position":[[24,3],[59,3],[1201,3]]},"232":{"position":[[88,3],[241,4]]},"252":{"position":[[70,4],[148,5],[333,3],[356,4]]},"253":{"position":[[395,3],[427,4],[849,4]]},"254":{"position":[[525,4],[557,4],[626,4],[658,4],[730,4],[928,4],[969,3]]},"267":{"position":[[2149,4],[2311,4]]},"277":{"position":[[105,3],[191,4],[449,3],[527,5],[585,3],[916,4],[963,3],[1848,5]]},"283":{"position":[[677,4]]},"284":{"position":[[248,4]]},"290":{"position":[[181,3],[302,3]]},"291":{"position":[[304,3]]},"292":{"position":[[398,3],[1124,3],[1152,5]]},"293":{"position":[[252,3]]},"323":{"position":[[2936,3],[3139,3]]},"351":{"position":[[122,3]]},"352":{"position":[[48,3],[120,3],[516,3],[763,4],[1328,3]]},"389":{"position":[[455,3],[1166,3]]},"390":{"position":[[125,5],[524,3],[737,3]]},"391":{"position":[[1078,4],[1177,4],[1481,3],[1539,3],[2558,3],[2630,3],[2870,3],[3027,3],[3495,3],[3791,3],[3883,3]]},"393":{"position":[[185,3],[299,5],[372,5],[467,4]]},"395":{"position":[[685,4],[3695,3],[4124,3]]},"396":{"position":[[407,4]]},"397":{"position":[[89,4]]},"407":{"position":[[2149,4],[2311,4]]},"421":{"position":[[101,3]]},"423":{"position":[[398,3],[603,3],[624,5]]},"458":{"position":[[606,3],[667,4],[724,4]]},"461":{"position":[[24,3],[59,3],[1201,3]]},"463":{"position":[[88,3],[241,4]]},"477":{"position":[[269,4],[347,3]]},"483":{"position":[[70,4],[148,5],[333,3],[356,4]]},"484":{"position":[[395,3],[427,4],[849,4]]},"485":{"position":[[525,4],[557,4],[626,4],[658,4],[730,4],[928,4],[969,3]]},"495":{"position":[[677,4]]},"496":{"position":[[248,4]]},"502":{"position":[[181,3],[302,3]]},"503":{"position":[[304,3]]},"504":{"position":[[398,3],[1124,3],[1152,5]]},"505":{"position":[[252,3]]},"514":{"position":[[105,3],[191,4],[449,3],[527,5],[585,3],[916,4],[963,3],[1680,5]]},"541":{"position":[[2936,3],[3139,3]]},"567":{"position":[[122,3]]},"568":{"position":[[48,3],[120,3],[516,3],[763,4],[1328,3]]},"594":{"position":[[364,3]]},"596":{"position":[[983,3]]},"598":{"position":[[2032,4]]},"616":{"position":[[1154,3]]},"630":{"position":[[185,3],[299,5],[372,5],[467,4]]},"632":{"position":[[685,4],[3695,3],[4124,3]]},"633":{"position":[[407,4]]},"634":{"position":[[89,4]]},"644":{"position":[[2149,4],[2311,4]]},"659":{"position":[[455,3],[1166,3]]},"660":{"position":[[125,5],[524,3],[737,3]]},"661":{"position":[[1078,4],[1177,4],[1481,3],[1539,3],[2558,3],[2630,3],[2870,3],[3027,3],[3495,3],[3791,3],[3883,3]]},"663":{"position":[[101,3]]},"665":{"position":[[398,3],[603,3],[624,5]]},"699":{"position":[[269,4],[347,3]]},"702":{"position":[[364,3]]},"704":{"position":[[983,3]]},"706":{"position":[[2032,4]]},"724":{"position":[[1154,3]]}},"keywords":{}}],["key'",{"_index":3169,"title":{},"content":{"395":{"position":[[4085,5]]},"632":{"position":[[4085,5]]}},"keywords":{}}],["key((((3",{"_index":3102,"title":{},"content":{"391":{"position":[[3033,8]]},"661":{"position":[[3033,8]]}},"keywords":{}}],["key(((2",{"_index":2657,"title":{},"content":{"212":{"position":[[3021,7]]}},"keywords":{}}],["key((3",{"_index":3101,"title":{},"content":{"391":{"position":[[2636,6]]},"661":{"position":[[2636,6]]}},"keywords":{}}],["key(1",{"_index":2639,"title":{},"content":{"212":{"position":[[1545,6]]}},"keywords":{}}],["key(2",{"_index":2652,"title":{},"content":{"212":{"position":[[2636,5]]},"391":{"position":[[1545,6]]},"661":{"position":[[1545,6]]}},"keywords":{}}],["key(idx",{"_index":2665,"title":{},"content":{"212":{"position":[[3803,8]]},"391":{"position":[[3821,8]]},"661":{"position":[[3821,8]]}},"keywords":{}}],["key.extend_from_slice(idx.to_be_bytes().as_ref",{"_index":2666,"title":{},"content":{"212":{"position":[[3883,50]]},"391":{"position":[[3901,50]]},"661":{"position":[[3901,50]]}},"keywords":{}}],["key.extend_from_slice(mapping_data",{"_index":2667,"title":{},"content":{"212":{"position":[[3934,36]]},"391":{"position":[[3952,36]]},"661":{"position":[[3952,36]]}},"keywords":{}}],["key1",{"_index":1459,"title":{},"content":{"79":{"position":[[993,5]]},"230":{"position":[[1010,5]]},"461":{"position":[[1010,5]]}},"keywords":{}}],["key2",{"_index":1460,"title":{},"content":{"79":{"position":[[1007,5],[1094,5]]},"230":{"position":[[1024,5],[1111,5]]},"461":{"position":[[1024,5],[1111,5]]}},"keywords":{}}],["key3",{"_index":1461,"title":{},"content":{"79":{"position":[[1018,5],[1100,7]]},"230":{"position":[[1035,5],[1117,7]]},"461":{"position":[[1035,5],[1117,7]]}},"keywords":{}}],["keys/secret_key.pem",{"_index":2591,"title":{},"content":{"210":{"position":[[1233,21]]},"389":{"position":[[1170,21]]},"477":{"position":[[2376,19]]},"659":{"position":[[1170,21]]},"699":{"position":[[2376,19]]}},"keywords":{}}],["keyword",{"_index":3673,"title":{},"content":{"599":{"position":[[326,8],[470,8],[676,8]]},"608":{"position":[[766,7]]},"613":{"position":[[1643,8],[1786,7]]},"707":{"position":[[326,8],[470,8],[676,8]]},"716":{"position":[[766,7]]},"721":{"position":[[1643,8],[1786,7]]}},"keywords":{}}],["kind",{"_index":506,"title":{},"content":{"17":{"position":[[1672,4]]},"110":{"position":[[289,4]]},"305":{"position":[[289,4]]},"510":{"position":[[289,4]]}},"keywords":{}}],["knew",{"_index":553,"title":{},"content":{"18":{"position":[[207,4]]}},"keywords":{}}],["know",{"_index":191,"title":{},"content":{"5":{"position":[[375,4]]},"8":{"position":[[83,4]]},"9":{"position":[[960,4]]},"15":{"position":[[360,4]]},"16":{"position":[[313,4]]},"17":{"position":[[1640,5]]},"18":{"position":[[96,5]]},"52":{"position":[[360,4]]},"67":{"position":[[41,4]]},"128":{"position":[[665,4]]},"141":{"position":[[857,4]]},"148":{"position":[[486,4]]},"164":{"position":[[914,4]]},"198":{"position":[[2412,4],[3025,4]]},"212":{"position":[[2049,4]]},"242":{"position":[[41,4]]},"279":{"position":[[665,4]]},"326":{"position":[[857,4]]},"336":{"position":[[486,4]]},"353":{"position":[[949,4]]},"391":{"position":[[2049,4]]},"434":{"position":[[2402,4],[3007,4]]},"467":{"position":[[41,4]]},"516":{"position":[[665,4]]},"535":{"position":[[857,4]]},"553":{"position":[[486,4]]},"569":{"position":[[949,4]]},"661":{"position":[[2049,4]]},"681":{"position":[[2412,4],[3025,4]]}},"keywords":{}}],["knowledg",{"_index":97,"title":{"4":{"position":[[5,9]]},"5":{"position":[[5,10]]}},"content":{"2":{"position":[[144,9]]},"5":{"position":[[24,9]]},"6":{"position":[[71,9]]},"13":{"position":[[19,9]]},"143":{"position":[[53,10]]},"328":{"position":[[53,10]]},"537":{"position":[[53,10]]},"595":{"position":[[39,9]]},"703":{"position":[[39,9]]}},"keywords":{}}],["known",{"_index":1802,"title":{},"content":{"126":{"position":[[811,5]]},"189":{"position":[[363,5]]},"277":{"position":[[811,5]]},"366":{"position":[[363,5]]},"514":{"position":[[811,5]]},"582":{"position":[[363,5]]},"601":{"position":[[1208,5]]},"612":{"position":[[158,5]]},"709":{"position":[[1208,5]]},"720":{"position":[[158,5]]}},"keywords":{}}],["krzysztof",{"_index":573,"title":{},"content":{"20":{"position":[[111,9]]}},"keywords":{}}],["kuba",{"_index":575,"title":{},"content":{"20":{"position":[[135,4]]}},"keywords":{}}],["l1",{"_index":2713,"title":{},"content":{"221":{"position":[[364,2]]},"424":{"position":[[944,2]]},"432":{"position":[[545,2]]},"454":{"position":[[364,2]]},"666":{"position":[[944,2]]},"679":{"position":[[545,2]]},"694":{"position":[[364,2]]}},"keywords":{}}],["l10",{"_index":2441,"title":{},"content":{"203":{"position":[[355,3]]},"247":{"position":[[1593,3]]},"423":{"position":[[355,3]]},"440":{"position":[[3317,3]]},"446":{"position":[[1593,3]]},"665":{"position":[[355,3]]},"673":{"position":[[1593,3]]},"687":{"position":[[3317,3]]}},"keywords":{}}],["l11",{"_index":2401,"title":{},"content":{"198":{"position":[[1618,3]]},"434":{"position":[[1608,3]]},"681":{"position":[[1618,3]]}},"keywords":{}}],["l12",{"_index":2339,"title":{},"content":{"196":{"position":[[1091,3]]},"221":{"position":[[837,3]]},"454":{"position":[[837,3]]},"694":{"position":[[837,3]]}},"keywords":{}}],["l13",{"_index":2251,"title":{},"content":{"185":{"position":[[2579,3]]},"376":{"position":[[2563,3]]},"441":{"position":[[1658,3]]},"592":{"position":[[2563,3]]},"688":{"position":[[1658,3]]}},"keywords":{}}],["l134",{"_index":3429,"title":{},"content":{"440":{"position":[[4338,4]]},"687":{"position":[[4338,4]]}},"keywords":{}}],["l14",{"_index":2342,"title":{},"content":{"196":{"position":[[1222,3]]},"198":{"position":[[2153,3]]},"204":{"position":[[1093,3]]},"434":{"position":[[2143,3]]},"681":{"position":[[2153,3]]}},"keywords":{}}],["l146",{"_index":2546,"title":{},"content":{"206":{"position":[[3747,4]]},"426":{"position":[[3722,4]]},"668":{"position":[[3747,4]]}},"keywords":{}}],["l15",{"_index":2772,"title":{},"content":{"247":{"position":[[1674,3]]},"441":{"position":[[3790,3]]},"446":{"position":[[1674,3]]},"673":{"position":[[1674,3]]},"688":{"position":[[3790,3]]}},"keywords":{}}],["l17",{"_index":2190,"title":{},"content":{"184":{"position":[[667,3]]},"375":{"position":[[586,3]]},"591":{"position":[[586,3]]}},"keywords":{}}],["l18",{"_index":2254,"title":{},"content":{"185":{"position":[[2784,3]]},"376":{"position":[[2768,3]]},"441":{"position":[[1749,3]]},"592":{"position":[[2768,3]]},"688":{"position":[[1749,3]]}},"keywords":{}}],["l19",{"_index":2408,"title":{},"content":{"198":{"position":[[2645,3]]},"434":{"position":[[2635,3]]},"681":{"position":[[2645,3]]}},"keywords":{}}],["l20",{"_index":2255,"title":{},"content":{"185":{"position":[[2788,3]]},"376":{"position":[[2772,3]]},"432":{"position":[[737,3]]},"592":{"position":[[2772,3]]},"679":{"position":[[737,3]]}},"keywords":{}}],["l24",{"_index":2195,"title":{},"content":{"184":{"position":[[834,3]]},"375":{"position":[[753,3]]},"591":{"position":[[753,3]]}},"keywords":{}}],["l26",{"_index":3329,"title":{},"content":{"432":{"position":[[1271,3]]},"679":{"position":[[1271,3]]}},"keywords":{}}],["l29",{"_index":2274,"title":{},"content":{"185":{"position":[[3763,3]]},"376":{"position":[[3747,3]]},"441":{"position":[[3841,3]]},"592":{"position":[[3747,3]]},"688":{"position":[[3841,3]]}},"keywords":{}}],["l32",{"_index":2344,"title":{},"content":{"196":{"position":[[1329,3]]},"441":{"position":[[1822,3]]},"688":{"position":[[1822,3]]}},"keywords":{}}],["l38",{"_index":3322,"title":{},"content":{"424":{"position":[[1249,3]]},"666":{"position":[[1249,3]]}},"keywords":{}}],["l4",{"_index":2318,"title":{},"content":{"195":{"position":[[245,2]]},"431":{"position":[[245,2]]},"441":{"position":[[1599,2]]},"678":{"position":[[245,2]]},"688":{"position":[[1599,2]]}},"keywords":{}}],["l43",{"_index":2456,"title":{},"content":{"204":{"position":[[1299,3]]}},"keywords":{}}],["l44",{"_index":3416,"title":{},"content":{"440":{"position":[[3321,3]]},"687":{"position":[[3321,3]]}},"keywords":{}}],["l46",{"_index":2277,"title":{},"content":{"185":{"position":[[3900,3]]},"198":{"position":[[3425,3]]},"376":{"position":[[3884,3]]},"434":{"position":[[3407,3]]},"592":{"position":[[3884,3]]},"681":{"position":[[3425,3]]}},"keywords":{}}],["l49",{"_index":3418,"title":{},"content":{"440":{"position":[[3665,3]]},"687":{"position":[[3665,3]]}},"keywords":{}}],["l5",{"_index":2189,"title":{},"content":{"184":{"position":[[664,2]]},"375":{"position":[[583,2]]},"591":{"position":[[583,2]]}},"keywords":{}}],["l51",{"_index":2774,"title":{},"content":{"247":{"position":[[1785,3]]},"446":{"position":[[1785,3]]},"673":{"position":[[1785,3]]}},"keywords":{}}],["l53",{"_index":3420,"title":{},"content":{"440":{"position":[[3784,3]]},"687":{"position":[[3784,3]]}},"keywords":{}}],["l54",{"_index":2262,"title":{},"content":{"185":{"position":[[3046,3]]},"376":{"position":[[3030,3]]},"592":{"position":[[3030,3]]}},"keywords":{}}],["l57",{"_index":3518,"title":{},"content":{"441":{"position":[[4109,3]]},"688":{"position":[[4109,3]]}},"keywords":{}}],["l6",{"_index":2246,"title":{},"content":{"185":{"position":[[2444,2]]},"198":{"position":[[1138,2]]},"204":{"position":[[993,2]]},"376":{"position":[[2428,2]]},"432":{"position":[[1035,2]]},"434":{"position":[[1128,2]]},"592":{"position":[[2428,2]]},"679":{"position":[[1035,2]]},"681":{"position":[[1138,2]]}},"keywords":{}}],["l60",{"_index":2776,"title":{},"content":{"247":{"position":[[1836,3]]},"446":{"position":[[1836,3]]},"673":{"position":[[1836,3]]}},"keywords":{}}],["l64",{"_index":2265,"title":{},"content":{"185":{"position":[[3349,3]]},"376":{"position":[[3333,3]]},"592":{"position":[[3333,3]]}},"keywords":{}}],["l7",{"_index":2330,"title":{},"content":{"196":{"position":[[608,2]]},"441":{"position":[[1602,2]]},"688":{"position":[[1602,2]]}},"keywords":{}}],["l7,l31",{"_index":2366,"title":{},"content":{"197":{"position":[[906,6]]},"433":{"position":[[905,6]]},"680":{"position":[[905,6]]}},"keywords":{}}],["l74",{"_index":3422,"title":{},"content":{"440":{"position":[[3932,3]]},"687":{"position":[[3932,3]]}},"keywords":{}}],["l8",{"_index":3327,"title":{},"content":{"432":{"position":[[1165,2]]},"679":{"position":[[1165,2]]}},"keywords":{}}],["l86",{"_index":2268,"title":{},"content":{"185":{"position":[[3464,3]]},"376":{"position":[[3448,3]]},"592":{"position":[[3448,3]]}},"keywords":{}}],["l9",{"_index":2769,"title":{},"content":{"247":{"position":[[1590,2]]},"424":{"position":[[1044,2]]},"446":{"position":[[1590,2]]},"666":{"position":[[1044,2]]},"673":{"position":[[1590,2]]}},"keywords":{}}],["l94",{"_index":3424,"title":{},"content":{"440":{"position":[[4073,3]]},"687":{"position":[[4073,3]]}},"keywords":{}}],["label",{"_index":1263,"title":{},"content":{"52":{"position":[[1308,5],[3314,6]]}},"keywords":{}}],["lalrpop",{"_index":908,"title":{},"content":{"39":{"position":[[359,7]]}},"keywords":{}}],["languag",{"_index":554,"title":{},"content":{"18":{"position":[[237,8]]},"39":{"position":[[101,9]]},"50":{"position":[[388,9]]},"613":{"position":[[1733,8],[2009,10]]},"721":{"position":[[1733,8],[2009,10]]}},"keywords":{}}],["larg",{"_index":3717,"title":{},"content":{"601":{"position":[[2159,5]]},"602":{"position":[[1191,5],[2075,5]]},"709":{"position":[[2159,5]]},"710":{"position":[[1191,5],[2075,5]]}},"keywords":{}}],["larger",{"_index":2078,"title":{},"content":{"162":{"position":[[2390,6]]},"351":{"position":[[2412,6]]},"567":{"position":[[2412,6]]}},"keywords":{}}],["largest",{"_index":167,"title":{},"content":{"5":{"position":[[46,7]]},"38":{"position":[[457,7]]}},"keywords":{}}],["larva",{"_index":1268,"title":{},"content":{"52":{"position":[[1852,5]]}},"keywords":{}}],["last",{"_index":124,"title":{},"content":{"3":{"position":[[59,5]]},"39":{"position":[[3170,4]]},"127":{"position":[[599,4]]},"278":{"position":[[599,4]]},"416":{"position":[[3339,4]]},"419":{"position":[[2118,4]]},"515":{"position":[[599,4]]},"653":{"position":[[3339,4]]},"656":{"position":[[2118,4]]}},"keywords":{}}],["lastli",{"_index":1077,"title":{},"content":{"42":{"position":[[1703,7]]},"197":{"position":[[1308,7]]},"198":{"position":[[2002,7]]},"433":{"position":[[1307,7]]},"434":{"position":[[1992,7]]},"680":{"position":[[1307,7]]},"681":{"position":[[2002,7]]}},"keywords":{}}],["later",{"_index":720,"title":{},"content":{"31":{"position":[[317,6]]},"126":{"position":[[3008,6]]},"189":{"position":[[499,5]]},"277":{"position":[[3176,6]]},"366":{"position":[[499,5]]},"395":{"position":[[2207,8]]},"514":{"position":[[3008,6]]},"582":{"position":[[499,5]]},"632":{"position":[[2207,8]]}},"keywords":{}}],["later.l44",{"_index":3517,"title":{},"content":{"441":{"position":[[4099,9]]},"688":{"position":[[4099,9]]}},"keywords":{}}],["later.l6",{"_index":2319,"title":{},"content":{"195":{"position":[[583,8]]},"431":{"position":[[583,8]]},"678":{"position":[[583,8]]}},"keywords":{}}],["latest",{"_index":1762,"title":{},"content":{"117":{"position":[[825,6]]},"131":{"position":[[562,6]]},"261":{"position":[[68,6]]},"298":{"position":[[825,6]]},"311":{"position":[[614,6]]},"379":{"position":[[68,6]]},"401":{"position":[[68,6]]},"519":{"position":[[825,6]]},"528":{"position":[[614,6]]},"621":{"position":[[68,6]]},"638":{"position":[[68,6]]}},"keywords":{}}],["layer",{"_index":369,"title":{},"content":{"11":{"position":[[152,5]]},"93":{"position":[[123,5]]},"182":{"position":[[80,6]]},"285":{"position":[[123,5]]},"373":{"position":[[80,6]]},"497":{"position":[[123,5]]},"589":{"position":[[80,6]]}},"keywords":{}}],["layout",{"_index":1501,"title":{"82":{"position":[[8,6]]},"211":{"position":[[8,7]]},"251":{"position":[[8,6]]},"390":{"position":[[8,7]]},"482":{"position":[[8,6]]},"660":{"position":[[8,7]]}},"content":{"84":{"position":[[742,6],[951,6]]},"195":{"position":[[617,6]]},"202":{"position":[[56,6]]},"209":{"position":[[44,7]]},"211":{"position":[[69,7],[139,6],[819,6],[854,6]]},"253":{"position":[[742,6],[951,6]]},"388":{"position":[[44,7]]},"390":{"position":[[69,7],[139,6],[793,6],[828,6]]},"422":{"position":[[56,6]]},"431":{"position":[[617,6]]},"484":{"position":[[742,6],[951,6]]},"658":{"position":[[44,7]]},"660":{"position":[[69,7],[139,6],[793,6],[828,6]]},"664":{"position":[[56,6]]},"678":{"position":[[617,6]]}},"keywords":{}}],["lazili",{"_index":1590,"title":{},"content":{"92":{"position":[[110,6]]},"284":{"position":[[110,6]]},"496":{"position":[[110,6]]},"602":{"position":[[1223,7],[2106,7]]},"710":{"position":[[1223,7],[2106,7]]}},"keywords":{}}],["lead",{"_index":1376,"title":{},"content":{"72":{"position":[[147,7]]},"236":{"position":[[147,7]]},"472":{"position":[[147,7]]},"612":{"position":[[1720,4]]},"720":{"position":[[1720,4]]}},"keywords":{}}],["leader",{"_index":570,"title":{},"content":{"20":{"position":[[78,6]]}},"keywords":{}}],["learn",{"_index":864,"title":{},"content":{"38":{"position":[[331,8],[586,8]]},"91":{"position":[[103,7]]},"118":{"position":[[271,5]]},"139":{"position":[[8,5]]},"146":{"position":[[804,5]]},"158":{"position":[[25,5]]},"171":{"position":[[25,5]]},"283":{"position":[[103,7]]},"299":{"position":[[271,5]]},"319":{"position":[[8,5]]},"331":{"position":[[25,5]]},"334":{"position":[[808,5]]},"357":{"position":[[25,5]]},"398":{"position":[[134,7]]},"478":{"position":[[21,7]]},"495":{"position":[[103,7]]},"520":{"position":[[271,5]]},"545":{"position":[[8,5]]},"548":{"position":[[25,5]]},"551":{"position":[[808,5]]},"573":{"position":[[25,5]]},"594":{"position":[[600,8]]},"618":{"position":[[28,7],[499,5]]},"635":{"position":[[134,7]]},"700":{"position":[[21,7]]},"702":{"position":[[600,8]]},"726":{"position":[[28,7],[499,5]]}},"keywords":{}}],["leav",{"_index":2321,"title":{},"content":{"195":{"position":[[736,5]]},"431":{"position":[[736,5]]},"477":{"position":[[3935,7]]},"678":{"position":[[736,5]]},"699":{"position":[[3935,7]]}},"keywords":{}}],["left",{"_index":991,"title":{},"content":{"39":{"position":[[2652,5],[2724,5]]},"397":{"position":[[215,4]]},"634":{"position":[[215,4]]}},"keywords":{}}],["lender",{"_index":1530,"title":{},"content":{"84":{"position":[[579,8],[683,7]]},"85":{"position":[[478,8]]},"253":{"position":[[579,8],[683,7]]},"254":{"position":[[478,8]]},"484":{"position":[[579,8],[683,7]]},"485":{"position":[[478,8]]}},"keywords":{}}],["length",{"_index":1510,"title":{},"content":{"83":{"position":[[388,6]]},"163":{"position":[[1325,6]]},"164":{"position":[[857,7],[1027,6]]},"212":{"position":[[1358,6]]},"252":{"position":[[388,6]]},"352":{"position":[[1347,6]]},"353":{"position":[[892,7],[1062,6]]},"391":{"position":[[1358,6]]},"483":{"position":[[388,6]]},"568":{"position":[[1347,6]]},"569":{"position":[[892,7],[1062,6]]},"661":{"position":[[1358,6]]}},"keywords":{}}],["let",{"_index":2021,"title":{},"content":{"157":{"position":[[48,4]]},"188":{"position":[[289,4]]},"330":{"position":[[48,4]]},"365":{"position":[[646,4]]},"440":{"position":[[4566,4]]},"547":{"position":[[48,4]]},"581":{"position":[[646,4]]},"687":{"position":[[4566,4]]}},"keywords":{}}],["let'",{"_index":218,"title":{"178":{"position":[[0,5]]},"369":{"position":[[0,5]]},"585":{"position":[[0,5]]}},"content":{"7":{"position":[[0,5]]},"23":{"position":[[0,5]]},"31":{"position":[[2797,5]]},"42":{"position":[[0,5],[1411,5]]},"51":{"position":[[316,5],[1675,5]]},"52":{"position":[[95,5],[400,5],[469,5],[2157,5]]},"53":{"position":[[54,5]]},"68":{"position":[[0,5]]},"76":{"position":[[44,5]]},"79":{"position":[[471,5]]},"90":{"position":[[113,5]]},"97":{"position":[[219,5]]},"115":{"position":[[1817,5]]},"126":{"position":[[329,5],[1299,5]]},"131":{"position":[[0,5]]},"136":{"position":[[157,5]]},"138":{"position":[[32,5]]},"141":{"position":[[1074,5]]},"143":{"position":[[0,5],[851,5]]},"149":{"position":[[4,5]]},"162":{"position":[[205,5],[585,5]]},"163":{"position":[[149,5]]},"164":{"position":[[40,5]]},"168":{"position":[[176,5]]},"175":{"position":[[410,5]]},"196":{"position":[[577,5]]},"198":{"position":[[2774,5]]},"205":{"position":[[39,5]]},"207":{"position":[[39,5]]},"209":{"position":[[0,5]]},"221":{"position":[[5,5]]},"223":{"position":[[12,5]]},"227":{"position":[[44,5]]},"230":{"position":[[488,5]]},"243":{"position":[[0,5]]},"246":{"position":[[0,5]]},"258":{"position":[[1763,5]]},"277":{"position":[[329,5],[1467,5]]},"282":{"position":[[113,5]]},"289":{"position":[[219,5]]},"311":{"position":[[0,5]]},"316":{"position":[[157,5]]},"318":{"position":[[32,5]]},"326":{"position":[[1074,5]]},"328":{"position":[[0,5],[826,5]]},"337":{"position":[[4,5]]},"348":{"position":[[176,5]]},"351":{"position":[[205,5],[622,5]]},"352":{"position":[[149,5]]},"353":{"position":[[40,5]]},"354":{"position":[[190,5]]},"361":{"position":[[410,5]]},"388":{"position":[[0,5]]},"394":{"position":[[581,5]]},"395":{"position":[[1258,5]]},"414":{"position":[[0,5],[152,5]]},"415":{"position":[[0,5]]},"416":{"position":[[313,5]]},"425":{"position":[[39,5]]},"427":{"position":[[39,5]]},"432":{"position":[[514,5]]},"434":{"position":[[2764,5]]},"440":{"position":[[0,5],[6518,5]]},"445":{"position":[[0,5]]},"454":{"position":[[5,5]]},"456":{"position":[[12,5]]},"458":{"position":[[44,5]]},"461":{"position":[[488,5]]},"468":{"position":[[0,5]]},"481":{"position":[[1763,5]]},"494":{"position":[[113,5]]},"501":{"position":[[219,5]]},"514":{"position":[[329,5],[1299,5]]},"528":{"position":[[0,5]]},"533":{"position":[[157,5]]},"535":{"position":[[1074,5]]},"537":{"position":[[0,5],[826,5]]},"544":{"position":[[32,5]]},"554":{"position":[[4,5]]},"564":{"position":[[176,5]]},"567":{"position":[[205,5],[622,5]]},"568":{"position":[[149,5]]},"569":{"position":[[40,5]]},"570":{"position":[[190,5]]},"577":{"position":[[410,5]]},"596":{"position":[[0,5]]},"612":{"position":[[321,5]]},"631":{"position":[[581,5]]},"632":{"position":[[1258,5]]},"651":{"position":[[0,5],[152,5]]},"652":{"position":[[0,5]]},"653":{"position":[[313,5]]},"658":{"position":[[0,5]]},"667":{"position":[[39,5]]},"669":{"position":[[39,5]]},"672":{"position":[[0,5]]},"679":{"position":[[514,5]]},"681":{"position":[[2774,5]]},"687":{"position":[[0,5],[6518,5]]},"694":{"position":[[5,5]]},"696":{"position":[[12,5]]},"704":{"position":[[0,5]]},"720":{"position":[[321,5]]}},"keywords":{}}],["let’",{"_index":658,"title":{},"content":{"22":{"position":[[839,5]]}},"keywords":{}}],["level",{"_index":626,"title":{},"content":{"21":{"position":[[167,6]]},"22":{"position":[[15,5]]},"38":{"position":[[33,5]]},"94":{"position":[[39,5]]},"131":{"position":[[513,5]]},"265":{"position":[[923,5]]},"286":{"position":[[39,5]]},"311":{"position":[[565,5]]},"395":{"position":[[3603,5]]},"405":{"position":[[923,5]]},"498":{"position":[[39,5]]},"528":{"position":[[565,5]]},"594":{"position":[[167,5]]},"613":{"position":[[1742,5]]},"632":{"position":[[3603,5]]},"642":{"position":[[923,5]]},"702":{"position":[[167,5]]},"721":{"position":[[1742,5]]}},"keywords":{}}],["level.ev",{"_index":3054,"title":{},"content":{"324":{"position":[[1201,12]]},"542":{"position":[[1201,12]]}},"keywords":{}}],["leverag",{"_index":1752,"title":{},"content":{"115":{"position":[[3247,10]]},"258":{"position":[[3173,10]]},"481":{"position":[[3173,10]]}},"keywords":{}}],["lib.r",{"_index":1066,"title":{},"content":{"42":{"position":[[1426,6],[2700,6]]},"183":{"position":[[104,6]]},"374":{"position":[[104,6]]},"590":{"position":[[104,6]]}},"keywords":{}}],["librari",{"_index":83,"title":{"613":{"position":[[0,9]]},"721":{"position":[[0,9]]}},"content":{"1":{"position":[[1019,7]]},"23":{"position":[[218,7]]},"38":{"position":[[774,7]]},"39":{"position":[[2121,10]]},"613":{"position":[[1242,9],[1375,7],[1432,7],[1501,9],[1834,7]]},"721":{"position":[[1242,9],[1375,7],[1432,7],[1501,9],[1834,7]]}},"keywords":{}}],["licens",{"_index":1047,"title":{},"content":{"42":{"position":[[882,7]]}},"keywords":{}}],["like",{"_index":73,"title":{},"content":{"1":{"position":[[920,5]]}},"keywords":{}}],["likevar<t>",{"_index":1993,"title":{},"content":{"146":{"position":[[770,16]]},"334":{"position":[[774,16]]},"551":{"position":[[774,16]]}},"keywords":{}}],["limit",{"_index":1466,"title":{},"content":{"79":{"position":[[1226,7]]},"83":{"position":[[124,7]]},"85":{"position":[[1019,5]]},"126":{"position":[[2120,5],[2150,5]]},"147":{"position":[[821,7]]},"230":{"position":[[1243,7]]},"252":{"position":[[124,7]]},"254":{"position":[[1019,5]]},"277":{"position":[[2288,5],[2318,5]]},"335":{"position":[[829,7]]},"438":{"position":[[216,7]]},"461":{"position":[[1243,7]]},"483":{"position":[[124,7]]},"485":{"position":[[1019,5]]},"514":{"position":[[2120,5],[2150,5]]},"552":{"position":[[829,7]]},"685":{"position":[[216,7]]}},"keywords":{}}],["line",{"_index":1858,"title":{},"content":{"127":{"position":[[606,5]]},"278":{"position":[[606,5]]},"324":{"position":[[821,4]]},"515":{"position":[[606,5]]},"542":{"position":[[821,4]]}},"keywords":{}}],["linear",{"_index":929,"title":{},"content":{"39":{"position":[[841,13],[1093,14],[1143,13],[1504,14],[1561,13]]}},"keywords":{}}],["linearization"",{"_index":3825,"title":{},"content":{"612":{"position":[[1511,19]]},"720":{"position":[[1511,19]]}},"keywords":{}}],["list",{"_index":1416,"title":{"164":{"position":[[0,5]]},"353":{"position":[[0,5]]},"569":{"position":[[0,5]]}},"content":{"76":{"position":[[231,5],[373,4],[729,5],[788,4]]},"104":{"position":[[79,4]]},"107":{"position":[[99,4]]},"108":{"position":[[118,4]]},"114":{"position":[[117,4]]},"127":{"position":[[625,8]]},"163":{"position":[[1420,4],[1460,4]]},"164":{"position":[[110,5]]},"168":{"position":[[2203,4]]},"182":{"position":[[33,4]]},"227":{"position":[[231,5],[373,4],[729,5],[788,4]]},"257":{"position":[[117,4]]},"274":{"position":[[99,4]]},"275":{"position":[[122,4]]},"278":{"position":[[625,8]]},"296":{"position":[[79,4]]},"324":{"position":[[521,4],[693,4],[721,4],[894,4],[1094,4],[1219,4],[1589,4]]},"348":{"position":[[2213,4]]},"352":{"position":[[1442,4],[1482,4]]},"353":{"position":[[110,5],[177,5]]},"373":{"position":[[33,4]]},"416":{"position":[[572,4],[3012,5]]},"419":{"position":[[115,5],[943,4],[4966,5]]},"458":{"position":[[231,5],[373,4],[729,5],[788,4]]},"480":{"position":[[117,4]]},"491":{"position":[[99,4]]},"492":{"position":[[122,4]]},"508":{"position":[[79,4]]},"515":{"position":[[625,8]]},"542":{"position":[[521,4],[693,4],[721,4],[894,4],[1094,4],[1219,4],[1589,4]]},"564":{"position":[[2203,4]]},"568":{"position":[[1442,4],[1482,4]]},"569":{"position":[[110,5],[177,5]]},"589":{"position":[[33,4]]},"601":{"position":[[2213,4]]},"602":{"position":[[968,6],[1164,4],[1973,4],[2006,4],[2036,4]]},"603":{"position":[[295,6]]},"653":{"position":[[572,4],[3012,5]]},"656":{"position":[[115,5],[943,4],[4966,5]]},"709":{"position":[[2213,4]]},"710":{"position":[[968,6],[1164,4],[1973,4],[2006,4],[2036,4]]},"711":{"position":[[295,6]]}},"keywords":{}}],["list<ballot>",{"_index":3222,"title":{},"content":{"416":{"position":[[619,19]]},"419":{"position":[[990,19]]},"653":{"position":[[619,19]]},"656":{"position":[[990,19]]}},"keywords":{}}],["list<t>",{"_index":2098,"title":{},"content":{"163":{"position":[[1614,13]]},"352":{"position":[[1636,13]]},"568":{"position":[[1636,13]]}},"keywords":{}}],["list<todo>",{"_index":3732,"title":{},"content":{"602":{"position":[[1139,17],[1238,17]]},"710":{"position":[[1139,17],[1238,17]]}},"keywords":{}}],["list<u32>",{"_index":2104,"title":{},"content":{"164":{"position":[[228,16]]},"353":{"position":[[263,16]]},"569":{"position":[[263,16]]}},"keywords":{}}],["listtyp",{"_index":3229,"title":{},"content":{"416":{"position":[[1178,8]]},"653":{"position":[[1178,8]]}},"keywords":{}}],["liter",{"_index":1150,"title":{},"content":{"43":{"position":[[1604,9]]}},"keywords":{}}],["littl",{"_index":3469,"title":{},"content":{"440":{"position":[[6550,6]]},"687":{"position":[[6550,6]]}},"keywords":{}}],["live",{"_index":109,"title":{},"content":{"2":{"position":[[313,4],[505,4]]},"20":{"position":[[748,4]]},"133":{"position":[[51,5]]},"134":{"position":[[79,5]]},"313":{"position":[[51,5]]},"314":{"position":[[79,5]]},"477":{"position":[[672,4]]},"530":{"position":[[51,5]]},"531":{"position":[[79,5]]},"699":{"position":[[672,4]]}},"keywords":{}}],["livenet",{"_index":363,"title":{"11":{"position":[[0,7]]},"125":{"position":[[0,7]]},"128":{"position":[[4,7]]},"276":{"position":[[0,7]]},"279":{"position":[[4,7]]},"392":{"position":[[28,7]]},"395":{"position":[[5,8]]},"513":{"position":[[0,7]]},"516":{"position":[[4,7]]},"629":{"position":[[28,7]]},"632":{"position":[[5,8]]}},"content":{"95":{"position":[[94,8]]},"97":{"position":[[198,7],[353,7]]},"126":{"position":[[7,7],[2818,7]]},"127":{"position":[[65,7]]},"128":{"position":[[206,7],[648,7]]},"129":{"position":[[53,7]]},"142":{"position":[[155,7]]},"277":{"position":[[7,7],[2986,7]]},"278":{"position":[[65,7]]},"279":{"position":[[206,7],[648,7]]},"280":{"position":[[53,7]]},"287":{"position":[[94,8]]},"289":{"position":[[198,7],[353,7]]},"327":{"position":[[155,7]]},"346":{"position":[[52,9]]},"393":{"position":[[546,7]]},"394":{"position":[[30,8]]},"395":{"position":[[5,7],[286,7],[567,7],[1366,8],[2835,7],[3133,7],[3162,7],[4431,7]]},"416":{"position":[[2522,8]]},"477":{"position":[[564,7],[938,7],[1046,7],[1075,7]]},"478":{"position":[[352,7]]},"499":{"position":[[94,8]]},"501":{"position":[[198,7],[353,7]]},"514":{"position":[[7,7],[2818,7]]},"515":{"position":[[65,7]]},"516":{"position":[[206,7],[648,7]]},"517":{"position":[[53,7]]},"536":{"position":[[155,7]]},"630":{"position":[[546,7]]},"631":{"position":[[30,8]]},"632":{"position":[[5,7],[286,7],[567,7],[1366,8],[2835,7],[3133,7],[3162,7],[4431,7]]},"653":{"position":[[2522,8]]},"699":{"position":[[564,7],[938,7],[1046,7],[1075,7]]},"700":{"position":[[352,7]]}},"keywords":{}}],["load",{"_index":240,"title":{"142":{"position":[[0,7]]},"327":{"position":[[0,7]]},"536":{"position":[[0,7]]}},"content":{"8":{"position":[[259,4],[324,4]]},"9":{"position":[[202,7]]},"31":{"position":[[501,4]]},"111":{"position":[[252,7]]},"126":{"position":[[2626,4],[2835,6],[2852,4]]},"128":{"position":[[747,4]]},"129":{"position":[[674,4],[713,4]]},"142":{"position":[[26,4],[179,4],[203,4]]},"164":{"position":[[954,7]]},"277":{"position":[[2794,4],[3003,6],[3020,4]]},"279":{"position":[[747,4]]},"280":{"position":[[675,4],[714,4]]},"306":{"position":[[252,7]]},"327":{"position":[[26,4],[179,4],[203,4]]},"353":{"position":[[989,7]]},"395":{"position":[[551,4],[2138,5],[2181,4]]},"511":{"position":[[252,7]]},"514":{"position":[[2626,4],[2835,6],[2852,4]]},"516":{"position":[[747,4]]},"517":{"position":[[675,4],[714,4]]},"536":{"position":[[26,4],[179,4],[203,4]]},"569":{"position":[[989,7]]},"602":{"position":[[1211,5],[2094,5]]},"632":{"position":[[551,4],[2138,5],[2181,4]]},"710":{"position":[[1211,5],[2094,5]]}},"keywords":{}}],["loan",{"_index":1529,"title":{},"content":{"84":{"position":[[571,5],[654,5],[900,5]]},"85":{"position":[[470,5]]},"253":{"position":[[571,5],[654,5],[900,5]]},"254":{"position":[[470,5]]},"484":{"position":[[571,5],[654,5],[900,5]]},"485":{"position":[[470,5]]}},"keywords":{}}],["loc",{"_index":921,"title":{},"content":{"39":{"position":[[720,4],[725,4]]}},"keywords":{}}],["local",{"_index":1764,"title":{},"content":{"117":{"position":[[1020,5]]},"210":{"position":[[78,5]]},"298":{"position":[[1020,5]]},"389":{"position":[[78,5]]},"477":{"position":[[688,5]]},"519":{"position":[[1020,5]]},"598":{"position":[[2069,5]]},"600":{"position":[[335,5],[530,5],[671,5],[974,5]]},"659":{"position":[[78,5]]},"699":{"position":[[688,5]]},"706":{"position":[[2069,5]]},"708":{"position":[[335,5],[530,5],[671,5],[974,5]]}},"keywords":{}}],["locat",{"_index":1759,"title":{"603":{"position":[[5,9]]},"711":{"position":[[5,9]]}},"content":{"117":{"position":[[502,7]]},"120":{"position":[[199,7]]},"126":{"position":[[1258,7]]},"132":{"position":[[282,7]]},"267":{"position":[[333,7]]},"277":{"position":[[1426,7]]},"298":{"position":[[502,7]]},"301":{"position":[[199,7]]},"312":{"position":[[282,7]]},"407":{"position":[[333,7]]},"514":{"position":[[1258,7]]},"519":{"position":[[502,7]]},"522":{"position":[[199,7]]},"529":{"position":[[282,7]]},"603":{"position":[[18,8],[129,8],[189,8]]},"644":{"position":[[333,7]]},"711":{"position":[[18,8],[129,8],[189,8]]}},"keywords":{}}],["lock",{"_index":1359,"title":{},"content":{"71":{"position":[[259,4]]},"174":{"position":[[262,6]]},"235":{"position":[[259,4]]},"261":{"position":[[200,6]]},"360":{"position":[[262,6]]},"379":{"position":[[200,6]]},"401":{"position":[[200,6]]},"416":{"position":[[3247,6]]},"419":{"position":[[2147,4]]},"471":{"position":[[259,4]]},"476":{"position":[[475,4],[852,4],[1454,4]]},"576":{"position":[[262,6]]},"606":{"position":[[93,7],[733,4]]},"621":{"position":[[200,6]]},"638":{"position":[[200,6]]},"653":{"position":[[3247,6]]},"656":{"position":[[2147,4]]},"698":{"position":[[475,4],[852,4],[1454,4]]},"714":{"position":[[93,7],[733,4]]}},"keywords":{}}],["lock(&mut",{"_index":3762,"title":{},"content":{"606":{"position":[[335,13]]},"714":{"position":[[335,13]]}},"keywords":{}}],["lock_dur",{"_index":3540,"title":{},"content":{"476":{"position":[[367,14],[517,14]]},"477":{"position":[[1915,14]]},"698":{"position":[[367,14],[517,14]]},"699":{"position":[[1915,14]]}},"keywords":{}}],["lock_duration(&self",{"_index":3550,"title":{},"content":{"476":{"position":[[1476,24]]},"698":{"position":[[1476,24]]}},"keywords":{}}],["lock_expiration_map",{"_index":3538,"title":{},"content":{"476":{"position":[[317,20]]},"698":{"position":[[317,20]]}},"keywords":{}}],["lockisnotov",{"_index":3551,"title":{},"content":{"476":{"position":[[1639,13]]},"698":{"position":[[1639,13]]}},"keywords":{}}],["log",{"_index":1283,"title":{"610":{"position":[[11,8]]},"718":{"position":[[11,8]]}},"content":{"52":{"position":[[3132,4]]},"53":{"position":[[247,5]]},"127":{"position":[[574,4]]},"278":{"position":[[574,4]]},"394":{"position":[[243,3]]},"397":{"position":[[41,7]]},"477":{"position":[[3981,4]]},"515":{"position":[[574,4]]},"610":{"position":[[72,3],[806,4]]},"631":{"position":[[243,3]]},"634":{"position":[[41,7]]},"699":{"position":[[3981,4]]},"718":{"position":[[72,3],[806,4]]}},"keywords":{}}],["logic",{"_index":1161,"title":{},"content":{"43":{"position":[[1925,5]]},"74":{"position":[[202,8],[280,8]]},"110":{"position":[[452,6]]},"188":{"position":[[317,5]]},"212":{"position":[[2414,6]]},"238":{"position":[[202,8],[280,8]]},"305":{"position":[[452,6]]},"365":{"position":[[674,5]]},"391":{"position":[[2414,6]]},"441":{"position":[[2907,5],[3396,5]]},"474":{"position":[[202,8],[280,8]]},"510":{"position":[[452,6]]},"581":{"position":[[674,5]]},"604":{"position":[[299,5],[442,5]]},"606":{"position":[[700,6]]},"661":{"position":[[2414,6]]},"688":{"position":[[2907,5],[3396,5]]},"712":{"position":[[299,5],[442,5]]},"714":{"position":[[700,6]]}},"keywords":{}}],["long",{"_index":136,"title":{},"content":{"3":{"position":[[256,4]]},"31":{"position":[[3052,4]]},"54":{"position":[[173,4]]}},"keywords":{}}],["longer",{"_index":2795,"title":{},"content":{"264":{"position":[[94,6]]},"266":{"position":[[98,6]]},"267":{"position":[[540,6],[652,6],[4405,6]]},"404":{"position":[[94,6]]},"406":{"position":[[98,6]]},"407":{"position":[[540,6],[652,6],[4405,6]]},"416":{"position":[[2453,6]]},"641":{"position":[[94,6]]},"643":{"position":[[98,6]]},"644":{"position":[[540,6],[652,6],[4405,6]]},"653":{"position":[[2453,6]]}},"keywords":{}}],["look",{"_index":580,"title":{},"content":{"20":{"position":[[211,7]]},"22":{"position":[[845,4]]},"42":{"position":[[1865,5]]},"52":{"position":[[2170,4]]},"53":{"position":[[74,4]]},"83":{"position":[[527,4]]},"90":{"position":[[133,4]]},"112":{"position":[[15,4]]},"115":{"position":[[1830,4]]},"117":{"position":[[302,4]]},"122":{"position":[[36,4]]},"126":{"position":[[342,4]]},"127":{"position":[[243,4]]},"131":{"position":[[19,4]]},"136":{"position":[[170,4]]},"146":{"position":[[849,4]]},"149":{"position":[[17,4]]},"154":{"position":[[299,4]]},"155":{"position":[[41,4]]},"162":{"position":[[211,4]]},"163":{"position":[[155,4],[1450,4]]},"164":{"position":[[337,4]]},"169":{"position":[[10,4]]},"198":{"position":[[1319,4]]},"252":{"position":[[527,4]]},"258":{"position":[[1776,4]]},"277":{"position":[[342,4]]},"278":{"position":[[243,4]]},"282":{"position":[[133,4]]},"298":{"position":[[302,4]]},"303":{"position":[[36,4]]},"307":{"position":[[15,4]]},"311":{"position":[[19,4]]},"316":{"position":[[170,4]]},"334":{"position":[[853,4]]},"337":{"position":[[17,4]]},"339":{"position":[[299,4]]},"340":{"position":[[41,4]]},"349":{"position":[[10,4]]},"351":{"position":[[211,4]]},"352":{"position":[[155,4],[1472,4]]},"353":{"position":[[372,4]]},"395":{"position":[[2521,4]]},"434":{"position":[[1309,4]]},"481":{"position":[[1776,4]]},"483":{"position":[[527,4]]},"494":{"position":[[133,4]]},"512":{"position":[[15,4]]},"514":{"position":[[342,4]]},"515":{"position":[[243,4]]},"519":{"position":[[302,4]]},"524":{"position":[[36,4]]},"528":{"position":[[19,4]]},"533":{"position":[[170,4]]},"551":{"position":[[853,4]]},"554":{"position":[[17,4]]},"559":{"position":[[299,4]]},"560":{"position":[[41,4]]},"565":{"position":[[10,4]]},"567":{"position":[[211,4]]},"568":{"position":[[155,4],[1472,4]]},"569":{"position":[[372,4]]},"594":{"position":[[44,7]]},"612":{"position":[[334,4]]},"632":{"position":[[2521,4]]},"681":{"position":[[1319,4]]},"702":{"position":[[44,7]]},"720":{"position":[[334,4]]}},"keywords":{}}],["loop",{"_index":69,"title":{},"content":{"1":{"position":[[873,5]]},"212":{"position":[[2085,4]]},"391":{"position":[[2085,4]]},"661":{"position":[[2085,4]]}},"keywords":{}}],["lose",{"_index":2193,"title":{},"content":{"184":{"position":[[784,5]]},"375":{"position":[[703,5]]},"591":{"position":[[703,5]]}},"keywords":{}}],["lot",{"_index":375,"title":{},"content":{"11":{"position":[[237,4]]},"18":{"position":[[57,3]]},"119":{"position":[[569,3]]},"300":{"position":[[569,3]]},"521":{"position":[[569,3]]}},"keywords":{}}],["low",{"_index":1614,"title":{},"content":{"94":{"position":[[35,3]]},"286":{"position":[[35,3]]},"498":{"position":[[35,3]]}},"keywords":{}}],["lower",{"_index":625,"title":{},"content":{"21":{"position":[[155,5]]},"66":{"position":[[3,5],[193,8]]},"68":{"position":[[463,8]]},"126":{"position":[[3112,5]]},"241":{"position":[[3,5],[193,8]]},"243":{"position":[[463,8]]},"277":{"position":[[3280,5]]},"466":{"position":[[3,5],[193,8]]},"468":{"position":[[463,8]]},"514":{"position":[[3112,5]]}},"keywords":{}}],["ls",{"_index":709,"title":{},"content":{"30":{"position":[[661,2]]}},"keywords":{}}],["lt",{"_index":535,"title":{},"content":{"17":{"position":[[2913,4],[3392,4],[3468,4]]},"30":{"position":[[335,5]]},"205":{"position":[[1786,4]]},"269":{"position":[[2252,4],[3044,4]]},"384":{"position":[[2272,4],[3078,4]]},"409":{"position":[[2252,4],[3044,4]]},"416":{"position":[[3840,4]]},"419":{"position":[[5419,4]]},"425":{"position":[[1761,4]]},"440":{"position":[[2868,4]]},"611":{"position":[[272,5],[462,4]]},"613":{"position":[[220,4]]},"626":{"position":[[2272,4],[3078,4]]},"646":{"position":[[2252,4],[3044,4]]},"653":{"position":[[3840,4]]},"656":{"position":[[5419,4]]},"667":{"position":[[1761,4]]},"687":{"position":[[2868,4]]},"719":{"position":[[272,5],[462,4]]},"721":{"position":[[220,4]]}},"keywords":{}}],["lt;<",{"_index":2601,"title":{},"content":{"211":{"position":[[313,8],[362,8],[430,8],[447,8],[506,8],[523,8]]},"212":{"position":[[2582,8],[2642,8],[2895,8],[2912,8],[3029,8],[3046,8]]},"390":{"position":[[349,8],[416,8],[480,8],[497,8]]},"391":{"position":[[2582,8],[2643,8],[2902,8],[2919,8],[3042,8],[3059,8]]},"660":{"position":[[349,8],[416,8],[480,8],[497,8]]},"661":{"position":[[2582,8],[2643,8],[2902,8],[2919,8],[3042,8],[3059,8]]}},"keywords":{}}],["lt;blake2::blake2bvar",{"_index":2673,"title":{},"content":{"212":{"position":[[4129,22]]},"391":{"position":[[4147,22]]},"661":{"position":[[4147,22]]}},"keywords":{}}],["lt;erc20hostref",{"_index":1959,"title":{},"content":{"142":{"position":[[462,16]]},"327":{"position":[[462,16]]},"536":{"position":[[462,16]]}},"keywords":{}}],["lt;init",{"_index":1197,"title":{},"content":{"51":{"position":[[652,8]]}},"keywords":{}}],["lt;u256",{"_index":2463,"title":{},"content":{"204":{"position":[[1612,8]]},"424":{"position":[[1562,8]]},"666":{"position":[[1562,8]]}},"keywords":{}}],["lto",{"_index":1888,"title":{},"content":{"131":{"position":[[462,3]]},"265":{"position":[[872,3]]},"311":{"position":[[514,3]]},"395":{"position":[[3552,3]]},"405":{"position":[[872,3]]},"528":{"position":[[514,3]]},"632":{"position":[[3552,3]]},"642":{"position":[[872,3]]}},"keywords":{}}],["luckili",{"_index":443,"title":{},"content":{"16":{"position":[[324,7]]}},"keywords":{}}],["machin",{"_index":200,"title":{},"content":{"6":{"position":[[89,8]]},"173":{"position":[[77,8]]},"359":{"position":[[77,8]]},"575":{"position":[[77,8]]}},"keywords":{}}],["maciej",{"_index":565,"title":{},"content":{"20":{"position":[[21,6]]},"39":{"position":[[1594,6]]}},"keywords":{}}],["macro",{"_index":1694,"title":{},"content":{"104":{"position":[[143,6]]},"108":{"position":[[56,5]]},"114":{"position":[[68,5],[97,5],[202,6]]},"115":{"position":[[1496,6]]},"138":{"position":[[1169,6]]},"146":{"position":[[425,6]]},"147":{"position":[[379,6],[659,5]]},"196":{"position":[[980,5]]},"257":{"position":[[68,5],[97,5],[202,6]]},"258":{"position":[[1442,6]]},"267":{"position":[[1210,5],[1255,6]]},"268":{"position":[[2338,6],[2719,5]]},"318":{"position":[[1161,6]]},"407":{"position":[[1210,5],[1255,6]]},"408":{"position":[[2338,6],[2719,5]]},"480":{"position":[[68,5],[97,5],[202,6]]},"481":{"position":[[1442,6]]},"544":{"position":[[1161,6]]},"644":{"position":[[1210,5],[1255,6]]},"645":{"position":[[2338,6],[2719,5]]}},"keywords":{}}],["made",{"_index":2272,"title":{},"content":{"185":{"position":[[3722,4]]},"365":{"position":[[98,4]]},"376":{"position":[[3706,4]]},"477":{"position":[[4064,4]]},"581":{"position":[[98,4]]},"592":{"position":[[3706,4]]},"699":{"position":[[4064,4]]}},"keywords":{}}],["magic",{"_index":2780,"title":{},"content":{"248":{"position":[[273,5]]},"447":{"position":[[273,5]]},"616":{"position":[[664,5],[958,5]]},"674":{"position":[[273,5]]},"724":{"position":[[664,5],[958,5]]}},"keywords":{}}],["main",{"_index":239,"title":{},"content":{"8":{"position":[[247,6]]},"9":{"position":[[108,6]]},"20":{"position":[[925,4]]},"32":{"position":[[369,6],[543,6]]},"42":{"position":[[682,6]]},"92":{"position":[[35,4],[526,4]]},"100":{"position":[[66,4]]},"102":{"position":[[655,4]]},"103":{"position":[[683,4]]},"107":{"position":[[23,4]]},"117":{"position":[[520,4]]},"126":{"position":[[951,4],[1329,6],[2049,4]]},"209":{"position":[[746,4]]},"212":{"position":[[3225,6]]},"264":{"position":[[363,4]]},"274":{"position":[[23,4]]},"277":{"position":[[951,4],[1497,6],[2217,4]]},"284":{"position":[[35,4],[526,4]]},"292":{"position":[[66,4]]},"294":{"position":[[655,4]]},"295":{"position":[[683,4]]},"298":{"position":[[520,4]]},"382":{"position":[[176,4]]},"383":{"position":[[4,4]]},"388":{"position":[[678,4]]},"391":{"position":[[3243,6]]},"395":{"position":[[539,6]]},"404":{"position":[[363,4]]},"477":{"position":[[1704,6]]},"491":{"position":[[23,4]]},"496":{"position":[[35,4],[526,4]]},"504":{"position":[[66,4]]},"506":{"position":[[655,4]]},"507":{"position":[[683,4]]},"514":{"position":[[951,4],[1329,6],[2049,4]]},"519":{"position":[[520,4]]},"594":{"position":[[535,4]]},"606":{"position":[[686,4]]},"618":{"position":[[40,4]]},"624":{"position":[[176,4]]},"625":{"position":[[4,4]]},"632":{"position":[[539,6]]},"641":{"position":[[363,4]]},"658":{"position":[[678,4]]},"661":{"position":[[3243,6]]},"699":{"position":[[1704,6]]},"702":{"position":[[535,4]]},"714":{"position":[[686,4]]},"726":{"position":[[40,4]]}},"keywords":{}}],["main.r",{"_index":2610,"title":{},"content":{"212":{"position":[[15,7]]},"391":{"position":[[15,7]]},"661":{"position":[[15,7]]}},"keywords":{}}],["mainnet",{"_index":1871,"title":{},"content":{"129":{"position":[[375,7]]},"277":{"position":[[1211,7]]},"280":{"position":[[375,7]]},"517":{"position":[[375,7]]}},"keywords":{}}],["mainnet.env",{"_index":1869,"title":{},"content":{"129":{"position":[[281,12]]},"280":{"position":[[281,12]]},"517":{"position":[[281,12]]}},"keywords":{}}],["maintain",{"_index":139,"title":{},"content":{"3":{"position":[[336,8]]},"79":{"position":[[441,11]]},"102":{"position":[[708,9]]},"230":{"position":[[458,11]]},"248":{"position":[[183,9]]},"294":{"position":[[708,9]]},"447":{"position":[[183,9]]},"461":{"position":[[458,11]]},"506":{"position":[[708,9]]},"674":{"position":[[183,9]]}},"keywords":{}}],["major",{"_index":3218,"title":{},"content":{"416":{"position":[[169,8],[3398,8]]},"653":{"position":[[169,8],[3398,8]]}},"keywords":{}}],["make",{"_index":16,"title":{},"content":{"1":{"position":[[153,4],[307,4]]},"7":{"position":[[152,4]]},"9":{"position":[[185,4]]},"22":{"position":[[1425,5]]},"31":{"position":[[431,4],[2641,4]]},"32":{"position":[[1152,4]]},"43":{"position":[[760,4]]},"52":{"position":[[501,4]]},"70":{"position":[[43,4]]},"83":{"position":[[154,6]]},"110":{"position":[[396,6]]},"127":{"position":[[177,4]]},"128":{"position":[[506,4],[724,4]]},"146":{"position":[[704,4]]},"147":{"position":[[575,4]]},"154":{"position":[[157,4]]},"162":{"position":[[591,4]]},"198":{"position":[[2362,4]]},"234":{"position":[[43,4]]},"247":{"position":[[1933,4]]},"252":{"position":[[154,6]]},"261":{"position":[[40,4]]},"267":{"position":[[230,5]]},"268":{"position":[[223,5]]},"278":{"position":[[177,4]]},"279":{"position":[[506,4],[724,4]]},"305":{"position":[[396,6]]},"334":{"position":[[708,4]]},"335":{"position":[[579,4]]},"339":{"position":[[157,4]]},"351":{"position":[[628,4]]},"379":{"position":[[40,4]]},"396":{"position":[[213,4]]},"401":{"position":[[40,4]]},"407":{"position":[[230,5]]},"408":{"position":[[223,5]]},"434":{"position":[[2352,4]]},"441":{"position":[[3282,4]]},"446":{"position":[[1933,4]]},"470":{"position":[[43,4]]},"477":{"position":[[210,4]]},"478":{"position":[[65,4],[368,6]]},"483":{"position":[[154,6]]},"510":{"position":[[396,6]]},"515":{"position":[[177,4]]},"516":{"position":[[506,4],[724,4]]},"551":{"position":[[708,4]]},"552":{"position":[[579,4]]},"559":{"position":[[157,4]]},"567":{"position":[[628,4]]},"621":{"position":[[40,4]]},"633":{"position":[[213,4]]},"638":{"position":[[40,4]]},"644":{"position":[[230,5]]},"645":{"position":[[223,5]]},"673":{"position":[[1933,4]]},"681":{"position":[[2362,4]]},"688":{"position":[[3282,4]]},"699":{"position":[[210,4]]},"700":{"position":[[65,4],[368,6]]}},"keywords":{}}],["makesoftware/casp",{"_index":2577,"title":{},"content":{"210":{"position":[[175,19]]},"389":{"position":[[175,19]]},"477":{"position":[[184,19]]},"659":{"position":[[175,19]]},"699":{"position":[[184,19]]}},"keywords":{}}],["manag",{"_index":1444,"title":{"117":{"position":[[0,8]]},"298":{"position":[[0,8]]},"519":{"position":[[0,8]]},"597":{"position":[[27,11]]},"705":{"position":[[27,11]]}},"content":{"79":{"position":[[402,8]]},"81":{"position":[[59,8]]},"230":{"position":[[419,8]]},"232":{"position":[[59,8]]},"461":{"position":[[419,8]]},"463":{"position":[[59,8]]}},"keywords":{}}],["mani",{"_index":400,"title":{},"content":{"15":{"position":[[92,4]]},"38":{"position":[[1078,4]]},"50":{"position":[[467,4]]},"114":{"position":[[299,4]]},"120":{"position":[[383,4]]},"157":{"position":[[689,4]]},"160":{"position":[[23,4]]},"162":{"position":[[2077,4]]},"163":{"position":[[269,4]]},"164":{"position":[[923,4]]},"182":{"position":[[151,4]]},"257":{"position":[[299,4]]},"301":{"position":[[383,4]]},"330":{"position":[[670,4]]},"345":{"position":[[23,4]]},"351":{"position":[[2099,4]]},"352":{"position":[[269,4]]},"353":{"position":[[958,4]]},"373":{"position":[[151,4]]},"413":{"position":[[10,4]]},"480":{"position":[[299,4]]},"522":{"position":[[383,4]]},"547":{"position":[[689,4]]},"562":{"position":[[23,4]]},"567":{"position":[[2099,4]]},"568":{"position":[[269,4]]},"569":{"position":[[958,4]]},"589":{"position":[[151,4]]},"601":{"position":[[2176,4]]},"650":{"position":[[10,4]]},"709":{"position":[[2176,4]]}},"keywords":{}}],["manipul",{"_index":3299,"title":{},"content":{"419":{"position":[[1736,10]]},"656":{"position":[[1736,10]]}},"keywords":{}}],["manner",{"_index":1418,"title":{},"content":{"76":{"position":[[309,7]]},"227":{"position":[[309,7]]},"458":{"position":[[309,7]]},"477":{"position":[[621,6]]},"699":{"position":[[621,6]]}},"keywords":{}}],["manual",{"_index":1323,"title":{"64":{"position":[[19,8]]},"65":{"position":[[22,9]]},"67":{"position":[[18,9]]},"154":{"position":[[22,9]]},"239":{"position":[[19,8]]},"240":{"position":[[22,9]]},"242":{"position":[[18,9]]},"339":{"position":[[22,9]]},"464":{"position":[[19,8]]},"465":{"position":[[22,9]]},"467":{"position":[[18,9]]},"559":{"position":[[22,9]]}},"content":{"65":{"position":[[22,9]]},"67":{"position":[[17,9]]},"88":{"position":[[460,9]]},"98":{"position":[[740,9]]},"240":{"position":[[22,9]]},"242":{"position":[[17,9]]},"250":{"position":[[460,9]]},"290":{"position":[[740,9]]},"465":{"position":[[22,9]]},"467":{"position":[[17,9]]},"488":{"position":[[460,9]]},"502":{"position":[[740,9]]}},"keywords":{}}],["map",{"_index":456,"title":{"79":{"position":[[9,8]]},"163":{"position":[[0,8]]},"230":{"position":[[9,8]]},"352":{"position":[[0,8]]},"461":{"position":[[9,8]]},"568":{"position":[[0,8]]},"601":{"position":[[11,9]]},"709":{"position":[[11,9]]}},"content":{"17":{"position":[[269,8],[384,8],[1906,8]]},"42":{"position":[[106,7],[1250,7]]},"76":{"position":[[218,8],[382,7],[569,8],[578,7],[763,7]]},"79":{"position":[[11,7],[130,7],[333,7],[581,8],[692,8],[823,8],[1176,7],[1365,8]]},"80":{"position":[[154,9]]},"110":{"position":[[261,8]]},"146":{"position":[[76,8]]},"163":{"position":[[4,7],[77,8],[208,7],[630,7],[1131,8],[1240,8],[1526,7]]},"178":{"position":[[88,8]]},"185":{"position":[[219,9],[2613,9],[2640,7],[3242,8],[3415,7],[3578,7]]},"203":{"position":[[71,8],[443,8],[541,8]]},"209":{"position":[[169,8],[367,8],[434,8],[1613,7]]},"211":{"position":[[472,7],[654,7]]},"212":{"position":[[1522,7],[2613,7],[2932,7],[3519,7],[3652,7]]},"227":{"position":[[218,8],[382,7],[569,8],[578,7],[763,7]]},"230":{"position":[[11,7],[130,7],[350,7],[598,8],[709,8],[840,8],[1193,7],[1382,8]]},"231":{"position":[[154,9]]},"267":{"position":[[866,10],[2449,7]]},"269":{"position":[[239,8]]},"305":{"position":[[261,8]]},"334":{"position":[[76,8]]},"352":{"position":[[4,7],[77,8],[208,7],[652,7],[1153,8],[1262,8],[1548,7]]},"369":{"position":[[88,8]]},"376":{"position":[[203,9],[2597,9],[2624,7],[3226,8],[3399,7],[3562,7]]},"384":{"position":[[236,8]]},"388":{"position":[[169,8],[367,8],[434,8],[1545,7]]},"390":{"position":[[446,7],[628,7]]},"391":{"position":[[1522,7],[2613,7],[2944,7],[3537,7],[3670,7]]},"407":{"position":[[866,10],[2449,7]]},"409":{"position":[[239,8]]},"419":{"position":[[706,8]]},"423":{"position":[[71,8],[443,8],[541,8]]},"440":{"position":[[178,8],[3882,7]]},"458":{"position":[[218,8],[382,7],[569,8],[578,7],[763,7]]},"461":{"position":[[11,7],[130,7],[350,7],[598,8],[709,8],[840,8],[1193,7],[1382,8]]},"462":{"position":[[154,9]]},"476":{"position":[[170,8]]},"510":{"position":[[261,8]]},"551":{"position":[[76,8]]},"568":{"position":[[4,7],[77,8],[208,7],[652,7],[1153,8],[1262,8],[1548,7]]},"585":{"position":[[88,8]]},"592":{"position":[[203,9],[2597,9],[2624,7],[3226,8],[3399,7],[3562,7]]},"601":{"position":[[53,9],[2202,7]]},"603":{"position":[[286,8]]},"626":{"position":[[236,8]]},"644":{"position":[[866,10],[2449,7]]},"646":{"position":[[239,8]]},"656":{"position":[[706,8]]},"658":{"position":[[169,8],[367,8],[434,8],[1545,7]]},"660":{"position":[[446,7],[628,7]]},"661":{"position":[[1522,7],[2613,7],[2944,7],[3537,7],[3670,7]]},"665":{"position":[[71,8],[443,8],[541,8]]},"687":{"position":[[178,8],[3882,7]]},"698":{"position":[[170,8]]},"709":{"position":[[53,9],[2202,7]]},"711":{"position":[[286,8]]}},"keywords":{}}],["map_err(|_",{"_index":3390,"title":{},"content":{"440":{"position":[[1919,12]]},"687":{"position":[[1919,12]]}},"keywords":{}}],["mapping<(address",{"_index":473,"title":{},"content":{"17":{"position":[[553,20],[2151,20]]},"203":{"position":[[312,20]]},"267":{"position":[[1115,20]]},"269":{"position":[[480,20]]},"384":{"position":[[493,20]]},"407":{"position":[[1115,20]]},"409":{"position":[[480,20]]},"423":{"position":[[312,20]]},"601":{"position":[[676,20]]},"626":{"position":[[493,20]]},"644":{"position":[[1115,20]]},"646":{"position":[[480,20]]},"665":{"position":[[312,20]]},"709":{"position":[[676,20]]}},"keywords":{}}],["mapping<(rol",{"_index":2214,"title":{},"content":{"185":{"position":[[408,17]]},"376":{"position":[[392,17]]},"592":{"position":[[392,17]]}},"keywords":{}}],["mapping<(str",{"_index":1451,"title":{},"content":{"79":{"position":[[712,19]]},"80":{"position":[[296,19]]},"230":{"position":[[729,19]]},"231":{"position":[[296,19]]},"461":{"position":[[729,19]]},"462":{"position":[[296,19]]}},"keywords":{}}],["mapping<address",{"_index":518,"title":{},"content":{"17":{"position":[[2112,19]]},"84":{"position":[[268,19]]},"203":{"position":[[270,19]]},"253":{"position":[[268,19]]},"267":{"position":[[969,19],[989,19]]},"269":{"position":[[438,19]]},"384":{"position":[[451,19]]},"407":{"position":[[969,19],[989,19]]},"409":{"position":[[438,19]]},"423":{"position":[[270,19]]},"476":{"position":[[287,19],[338,19]]},"484":{"position":[[268,19]]},"601":{"position":[[116,19]]},"626":{"position":[[451,19]]},"644":{"position":[[969,19],[989,19]]},"646":{"position":[[438,19]]},"665":{"position":[[270,19]]},"698":{"position":[[287,19],[338,19]]},"709":{"position":[[116,19]]}},"keywords":{}}],["mapping<rol",{"_index":2217,"title":{},"content":{"185":{"position":[[458,16]]},"376":{"position":[[442,16]]},"592":{"position":[[442,16]]}},"keywords":{}}],["mapping<str",{"_index":1452,"title":{},"content":{"79":{"position":[[766,18]]},"163":{"position":[[437,18]]},"209":{"position":[[1670,18]]},"230":{"position":[[783,18]]},"352":{"position":[[459,18]]},"388":{"position":[[1602,18]]},"461":{"position":[[783,18]]},"568":{"position":[[459,18]]},"658":{"position":[[1602,18]]}},"keywords":{}}],["mapping<ticketid",{"_index":3371,"title":{},"content":{"440":{"position":[[1075,20]]},"687":{"position":[[1075,20]]}},"keywords":{}}],["mapping<u32",{"_index":2099,"title":{},"content":{"163":{"position":[[1638,15]]},"352":{"position":[[1660,15]]},"568":{"position":[[1660,15]]}},"keywords":{}}],["mapping'",{"_index":1548,"title":{},"content":{"85":{"position":[[720,9]]},"254":{"position":[[720,9]]},"485":{"position":[[720,9]]}},"keywords":{}}],["mapping(address",{"_index":1052,"title":{},"content":{"42":{"position":[[956,15]]}},"keywords":{}}],["mapping.l11",{"_index":2443,"title":{},"content":{"203":{"position":[[499,11]]},"423":{"position":[[499,11]]},"665":{"position":[[499,11]]}},"keywords":{}}],["mapping::get",{"_index":1472,"title":{},"content":{"79":{"position":[[1459,14]]},"230":{"position":[[1476,14]]},"461":{"position":[[1476,14]]}},"keywords":{}}],["mapping::modul",{"_index":1473,"title":{},"content":{"79":{"position":[[1489,18]]},"230":{"position":[[1506,18]]},"461":{"position":[[1506,18]]}},"keywords":{}}],["mapping_data",{"_index":2655,"title":{},"content":{"212":{"position":[[2970,12],[3817,13]]},"391":{"position":[[2982,12],[3835,13]]},"661":{"position":[[2982,12],[3835,13]]}},"keywords":{}}],["mappingcontract",{"_index":3683,"title":{},"content":{"601":{"position":[[90,15],[182,15]]},"709":{"position":[[90,15],[182,15]]}},"keywords":{}}],["mark",{"_index":1598,"title":{},"content":{"92":{"position":[[636,6]]},"141":{"position":[[560,6]]},"146":{"position":[[384,4]]},"147":{"position":[[107,6],[332,4],[701,6]]},"178":{"position":[[391,6]]},"204":{"position":[[1020,6]]},"230":{"position":[[238,6]]},"284":{"position":[[636,6]]},"326":{"position":[[560,6]]},"334":{"position":[[384,4]]},"335":{"position":[[107,6],[332,4],[709,6]]},"354":{"position":[[689,6]]},"369":{"position":[[391,6]]},"419":{"position":[[1231,6]]},"424":{"position":[[971,6]]},"461":{"position":[[238,6]]},"496":{"position":[[636,6]]},"535":{"position":[[560,6]]},"551":{"position":[[384,4]]},"552":{"position":[[107,6],[332,4],[709,6]]},"570":{"position":[[689,6]]},"585":{"position":[[391,6]]},"656":{"position":[[1231,6]]},"666":{"position":[[971,6]]}},"keywords":{}}],["master",{"_index":2304,"title":{},"content":{"193":{"position":[[50,6]]},"201":{"position":[[50,6]]},"421":{"position":[[50,6]]},"429":{"position":[[50,6]]},"663":{"position":[[50,6]]},"676":{"position":[[50,6]]}},"keywords":{}}],["match",{"_index":356,"title":{},"content":{"10":{"position":[[1330,5]]},"17":{"position":[[1241,5]]},"39":{"position":[[144,9],[2470,5]]},"197":{"position":[[537,5],[985,5]]},"433":{"position":[[537,5],[984,5]]},"617":{"position":[[439,5],[1258,5]]},"680":{"position":[[537,5],[984,5]]},"725":{"position":[[439,5],[1258,5]]}},"keywords":{}}],["math",{"_index":3828,"title":{},"content":{"613":{"position":[[82,4],[1370,4]]},"721":{"position":[[82,4],[1370,4]]}},"keywords":{}}],["math::add(left",{"_index":993,"title":{},"content":{"39":{"position":[[2672,15]]}},"keywords":{}}],["math::sqrt(x",{"_index":3834,"title":{},"content":{"613":{"position":[[436,13]]},"721":{"position":[[436,13]]}},"keywords":{}}],["math::sub(left",{"_index":995,"title":{},"content":{"39":{"position":[[2744,15]]}},"keywords":{}}],["math_engine_address",{"_index":1968,"title":{},"content":{"143":{"position":[[430,20]]},"328":{"position":[[480,20]]},"537":{"position":[[480,20]]}},"keywords":{}}],["math_engine_contract",{"_index":1966,"title":{},"content":{"143":{"position":[[317,20]]},"328":{"position":[[317,20]]},"537":{"position":[[317,20]]}},"keywords":{}}],["math_engine_contract.address",{"_index":1969,"title":{},"content":{"143":{"position":[[451,31]]},"328":{"position":[[501,31]]},"537":{"position":[[501,31]]}},"keywords":{}}],["mathengin",{"_index":1942,"title":{},"content":{"141":{"position":[[1092,10]]},"143":{"position":[[753,10]]},"326":{"position":[[1092,10]]},"328":{"position":[[728,10]]},"535":{"position":[[1092,10]]},"537":{"position":[[728,10]]}},"keywords":{}}],["mathenginehostref",{"_index":1963,"title":{},"content":{"143":{"position":[[183,19]]},"328":{"position":[[183,19]]},"537":{"position":[[183,19]]}},"keywords":{}}],["mathenginehostref::deploy(&test_env",{"_index":1967,"title":{},"content":{"143":{"position":[[340,40]]},"328":{"position":[[340,40]]},"537":{"position":[[340,40]]}},"keywords":{}}],["mathenginehostref::deploy(test_env",{"_index":1983,"title":{},"content":{"143":{"position":[[1302,35]]},"328":{"position":[[1277,35]]},"537":{"position":[[1277,35]]}},"keywords":{}}],["matter",{"_index":1408,"title":{},"content":{"74":{"position":[[332,7]]},"196":{"position":[[717,7]]},"238":{"position":[[332,7]]},"432":{"position":[[654,7]]},"474":{"position":[[332,7]]},"679":{"position":[[654,7]]}},"keywords":{}}],["maximum",{"_index":1509,"title":{},"content":{"83":{"position":[[380,7]]},"85":{"position":[[129,7]]},"252":{"position":[[380,7]]},"254":{"position":[[129,7]]},"483":{"position":[[380,7]]},"485":{"position":[[129,7]]}},"keywords":{}}],["mayb",{"_index":557,"title":{},"content":{"18":{"position":[[354,5]]}},"keywords":{}}],["maybe<string>",{"_index":3460,"title":{},"content":{"440":{"position":[[6310,20]]},"687":{"position":[[6310,20]]}},"keywords":{}}],["maybe<u64>",{"_index":3458,"title":{},"content":{"440":{"position":[[6280,17]]},"687":{"position":[[6280,17]]}},"keywords":{}}],["maybe::non",{"_index":3384,"title":{},"content":{"440":{"position":[[1593,11],[1866,13],[2501,12],[3085,12]]},"441":{"position":[[3070,13]]},"687":{"position":[[1593,11],[1866,13],[2501,12],[3085,12]]},"688":{"position":[[3070,13]]}},"keywords":{}}],["maybe::some(ticket_id",{"_index":3504,"title":{},"content":{"441":{"position":[[3046,23]]},"688":{"position":[[3046,23]]}},"keywords":{}}],["mean",{"_index":2649,"title":{},"content":{"212":{"position":[[2377,5]]},"391":{"position":[[2377,5]]},"416":{"position":[[3219,4]]},"419":{"position":[[1908,7]]},"605":{"position":[[377,7]]},"612":{"position":[[1412,5]]},"653":{"position":[[3219,4]]},"656":{"position":[[1908,7]]},"661":{"position":[[2377,5]]},"713":{"position":[[377,7]]},"720":{"position":[[1412,5]]}},"keywords":{}}],["mechan",{"_index":2295,"title":{"416":{"position":[[7,10]]},"653":{"position":[[7,10]]}},"content":{"189":{"position":[[83,10]]},"190":{"position":[[59,9]]},"366":{"position":[[83,10]]},"367":{"position":[[59,9]]},"413":{"position":[[46,9]]},"415":{"position":[[60,10],[314,10]]},"416":{"position":[[3128,9]]},"582":{"position":[[83,10]]},"583":{"position":[[59,9]]},"609":{"position":[[268,10]]},"650":{"position":[[46,9]]},"652":{"position":[[60,10],[314,10]]},"653":{"position":[[3128,9]]},"717":{"position":[[268,10]]}},"keywords":{}}],["members.error",{"_index":3052,"title":{},"content":{"324":{"position":[[701,14]]},"542":{"position":[[701,14]]}},"keywords":{}}],["memori",{"_index":716,"title":{"87":{"position":[[0,6]]},"249":{"position":[[0,6]]},"487":{"position":[[0,6]]}},"content":{"31":{"position":[[125,6],[1353,7]]},"42":{"position":[[1021,6],[1182,7]]},"43":{"position":[[239,6],[260,6]]},"603":{"position":[[145,7]]},"711":{"position":[[145,7]]}},"keywords":{}}],["memoryaccount",{"_index":768,"title":{},"content":{"31":{"position":[[1534,13],[1828,13]]}},"keywords":{}}],["memorybackend::new(&vicin",{"_index":777,"title":{},"content":{"31":{"position":[[1984,33]]}},"keywords":{}}],["memorystackstate::new(metadata",{"_index":781,"title":{},"content":{"31":{"position":[[2104,31]]}},"keywords":{}}],["memoryvicin",{"_index":744,"title":{},"content":{"31":{"position":[[980,14]]}},"keywords":{}}],["mention",{"_index":1217,"title":{},"content":{"51":{"position":[[1607,9]]},"85":{"position":[[705,10]]},"94":{"position":[[481,9]]},"136":{"position":[[195,9]]},"141":{"position":[[3,9]]},"197":{"position":[[1500,10]]},"198":{"position":[[3185,10]]},"221":{"position":[[372,9]]},"247":{"position":[[1567,10]]},"254":{"position":[[705,10]]},"286":{"position":[[481,9]]},"316":{"position":[[195,9]]},"326":{"position":[[3,9]]},"396":{"position":[[644,8]]},"433":{"position":[[1499,10]]},"434":{"position":[[3167,10]]},"446":{"position":[[1567,10]]},"454":{"position":[[372,9]]},"485":{"position":[[705,10]]},"498":{"position":[[481,9]]},"533":{"position":[[195,9]]},"535":{"position":[[3,9]]},"633":{"position":[[644,8]]},"673":{"position":[[1567,10]]},"680":{"position":[[1499,10]]},"681":{"position":[[3185,10]]},"694":{"position":[[372,9]]}},"keywords":{}}],["menu",{"_index":3108,"title":{},"content":{"393":{"position":[[272,4]]},"396":{"position":[[276,4]]},"630":{"position":[[272,4]]},"633":{"position":[[276,4]]}},"keywords":{}}],["merg",{"_index":1736,"title":{},"content":{"115":{"position":[[1621,6]]},"258":{"position":[[1567,6]]},"481":{"position":[[1567,6]]}},"keywords":{}}],["mess",{"_index":1704,"title":{},"content":{"110":{"position":[[470,7]]},"305":{"position":[[470,7]]},"510":{"position":[[470,7]]}},"keywords":{}}],["messag",{"_index":472,"title":{"42":{"position":[[7,8]]}},"content":{"17":{"position":[[543,9]]},"42":{"position":[[150,8],[1280,7],[1376,8],[2678,7]]},"53":{"position":[[556,7]]},"596":{"position":[[154,8],[334,8],[878,8],[947,7]]},"610":{"position":[[95,8],[303,8],[397,8]]},"611":{"position":[[962,7]]},"704":{"position":[[154,8],[334,8],[878,8],[947,7]]},"718":{"position":[[95,8],[303,8],[397,8]]},"719":{"position":[[962,7]]}},"keywords":{}}],["messagealreadydefin",{"_index":504,"title":{},"content":{"17":{"position":[[1568,21]]}},"keywords":{}}],["meta",{"_index":2553,"title":{},"content":{"209":{"position":[[866,5],[1055,4]]},"211":{"position":[[228,5]]},"388":{"position":[[798,5],[987,4]]},"390":{"position":[[228,5]]},"658":{"position":[[798,5],[987,4]]},"660":{"position":[[228,5]]}},"keywords":{}}],["metadata",{"_index":778,"title":{"204":{"position":[[0,9]]},"424":{"position":[[0,9]]},"666":{"position":[[0,9]]}},"content":{"31":{"position":[[2030,8]]},"195":{"position":[[525,9]]},"202":{"position":[[151,8]]},"204":{"position":[[1128,8]]},"206":{"position":[[658,8]]},"209":{"position":[[242,8],[583,8],[776,8],[1062,8]]},"211":{"position":[[234,9]]},"212":{"position":[[482,8],[1446,10],[1463,8],[1493,8],[2481,8],[4501,8]]},"267":{"position":[[3396,9]]},"269":{"position":[[4568,8]]},"388":{"position":[[242,8],[544,8],[708,8],[994,8]]},"390":{"position":[[234,9]]},"391":{"position":[[482,8],[1446,10],[1463,8],[1493,8],[2481,8],[4519,8]]},"407":{"position":[[3396,9]]},"409":{"position":[[4568,8]]},"419":{"position":[[1334,8]]},"422":{"position":[[151,8]]},"424":{"position":[[1078,8]]},"426":{"position":[[658,8]]},"431":{"position":[[525,9]]},"644":{"position":[[3396,9]]},"646":{"position":[[4568,8]]},"656":{"position":[[1334,8]]},"658":{"position":[[242,8],[544,8],[708,8],[994,8]]},"660":{"position":[[234,9]]},"661":{"position":[[482,8],[1446,10],[1463,8],[1493,8],[2481,8],[4519,8]]},"664":{"position":[[151,8]]},"666":{"position":[[1078,8]]},"668":{"position":[[658,8]]},"678":{"position":[[525,9]]}},"keywords":{}}],["metadatamutability::immut",{"_index":3383,"title":{},"content":{"440":{"position":[[1502,30]]},"687":{"position":[[1502,30]]}},"keywords":{}}],["metdata",{"_index":3193,"title":{},"content":{"396":{"position":[[450,8]]},"633":{"position":[[450,8]]}},"keywords":{}}],["method",{"_index":266,"title":{},"content":{"9":{"position":[[225,7]]},"10":{"position":[[93,9],[412,7],[1123,7]]},"11":{"position":[[56,7],[207,6]]},"12":{"position":[[232,6]]},"39":{"position":[[1221,6],[1351,7]]},"86":{"position":[[103,6]]},"103":{"position":[[431,6]]},"126":{"position":[[1875,7],[2842,6]]},"142":{"position":[[208,6]]},"209":{"position":[[197,8],[287,6]]},"210":{"position":[[1083,6]]},"255":{"position":[[103,6]]},"277":{"position":[[2043,7],[3010,6]]},"295":{"position":[[431,6]]},"327":{"position":[[208,6]]},"388":{"position":[[197,8],[287,6]]},"389":{"position":[[1020,6]]},"414":{"position":[[513,7]]},"417":{"position":[[1655,8]]},"486":{"position":[[103,6]]},"507":{"position":[[431,6]]},"514":{"position":[[1875,7],[2842,6]]},"536":{"position":[[208,6]]},"598":{"position":[[1138,6]]},"612":{"position":[[1661,6]]},"651":{"position":[[513,7]]},"654":{"position":[[1655,8]]},"658":{"position":[[197,8],[287,6]]},"659":{"position":[[1020,6]]},"706":{"position":[[1138,6]]},"720":{"position":[[1661,6]]}},"keywords":{}}],["method_cod",{"_index":839,"title":{},"content":{"32":{"position":[[1173,11]]}},"keywords":{}}],["method_id",{"_index":314,"title":{},"content":{"9":{"position":[[1500,9]]},"10":{"position":[[223,9],[426,10],[933,11],[1223,10]]}},"keywords":{}}],["methods/guest/src/bin/evm_calc.r",{"_index":816,"title":{},"content":{"32":{"position":[[158,33]]}},"keywords":{}}],["methods/guest/src/multiply.r",{"_index":236,"title":{},"content":{"8":{"position":[[210,29]]}},"keywords":{}}],["michael",{"_index":724,"title":{},"content":{"31":{"position":[[386,7]]}},"keywords":{}}],["migrat",{"_index":2785,"title":{"259":{"position":[[0,9]]},"263":{"position":[[3,9]]},"377":{"position":[[0,9]]},"381":{"position":[[3,9]]},"399":{"position":[[0,9]]},"403":{"position":[[3,9]]},"619":{"position":[[0,9]]},"623":{"position":[[3,9]]},"636":{"position":[[0,9]]},"640":{"position":[[3,9]]}},"content":{"261":{"position":[[21,9]]},"265":{"position":[[411,9]]},"269":{"position":[[68,9]]},"270":{"position":[[57,9]]},"379":{"position":[[21,9]]},"384":{"position":[[68,9]]},"385":{"position":[[57,9]]},"401":{"position":[[21,9]]},"405":{"position":[[411,9]]},"409":{"position":[[68,9]]},"410":{"position":[[57,9]]},"621":{"position":[[21,9]]},"626":{"position":[[68,9]]},"627":{"position":[[57,9]]},"638":{"position":[[21,9]]},"642":{"position":[[411,9]]},"646":{"position":[[68,9]]},"647":{"position":[[57,9]]}},"keywords":{}}],["mimic",{"_index":1573,"title":{},"content":{"91":{"position":[[74,6]]},"283":{"position":[[74,6]]},"495":{"position":[[74,6]]},"610":{"position":[[903,6]]},"718":{"position":[[903,6]]}},"keywords":{}}],["mind",{"_index":401,"title":{},"content":{"15":{"position":[[109,4]]},"38":{"position":[[371,4],[503,4]]},"84":{"position":[[59,5]]},"119":{"position":[[549,4]]},"162":{"position":[[1537,4]]},"253":{"position":[[59,5]]},"300":{"position":[[549,4]]},"351":{"position":[[1559,4]]},"484":{"position":[[59,5]]},"521":{"position":[[549,4]]},"567":{"position":[[1559,4]]}},"keywords":{}}],["mindblow",{"_index":855,"title":{},"content":{"33":{"position":[[16,11]]}},"keywords":{}}],["minim",{"_index":99,"title":{},"content":{"2":{"position":[[178,8]]},"163":{"position":[[1199,8]]},"352":{"position":[[1221,8]]},"568":{"position":[[1221,8]]}},"keywords":{}}],["minimalist",{"_index":1760,"title":{},"content":{"117":{"position":[[596,12]]},"298":{"position":[[596,12]]},"519":{"position":[[596,12]]}},"keywords":{}}],["mint",{"_index":1669,"title":{},"content":{"100":{"position":[[989,4]]},"101":{"position":[[690,4]]},"115":{"position":[[1690,7]]},"204":{"position":[[1141,5],[1309,4],[1405,6]]},"245":{"position":[[97,4]]},"247":{"position":[[1842,7]]},"258":{"position":[[1636,7]]},"292":{"position":[[989,4]]},"293":{"position":[[690,4]]},"395":{"position":[[298,5],[1050,7]]},"396":{"position":[[851,7]]},"413":{"position":[[194,4]]},"415":{"position":[[158,7],[190,7],[246,7],[361,4]]},"416":{"position":[[133,4],[212,5],[515,5],[986,5],[1225,5],[1300,5],[1389,4],[1515,4],[1694,5],[1849,5],[2169,6],[2546,5],[2654,5],[3375,4],[4749,4],[4820,8],[4910,4]]},"417":{"position":[[477,4],[905,7],[1160,4]]},"419":{"position":[[601,5],[886,5],[3640,5],[3908,4],[4034,4],[4211,5],[4367,5],[4609,5],[6892,4],[7320,7],[7575,4]]},"424":{"position":[[1091,5],[1259,4],[1355,6]]},"440":{"position":[[1776,4],[4158,5]]},"441":{"position":[[2899,7],[4046,7]]},"444":{"position":[[97,4]]},"446":{"position":[[1842,7]]},"481":{"position":[[1636,7]]},"504":{"position":[[989,4]]},"505":{"position":[[690,4]]},"632":{"position":[[298,5],[1050,7]]},"633":{"position":[[851,7]]},"650":{"position":[[194,4]]},"652":{"position":[[158,7],[190,7],[246,7],[361,4]]},"653":{"position":[[133,4],[212,5],[515,5],[986,5],[1225,5],[1300,5],[1389,4],[1515,4],[1694,5],[1849,5],[2169,6],[2546,5],[2654,5],[3375,4],[4749,4],[4820,8],[4910,4]]},"654":{"position":[[477,4],[905,7],[1160,4]]},"656":{"position":[[601,5],[886,5],[3640,5],[3908,4],[4034,4],[4211,5],[4367,5],[4609,5],[6892,4],[7320,7],[7575,4]]},"666":{"position":[[1091,5],[1259,4],[1355,6]]},"671":{"position":[[97,4]]},"673":{"position":[[1842,7]]},"687":{"position":[[1776,4],[4158,5]]},"688":{"position":[[2899,7],[4046,7]]}},"keywords":{}}],["mint(&mut",{"_index":1729,"title":{},"content":{"115":{"position":[[1217,13],[2817,13]]},"204":{"position":[[626,13]]},"247":{"position":[[1370,13]]},"258":{"position":[[1163,13],[2743,13]]},"269":{"position":[[1933,13]]},"384":{"position":[[1953,13]]},"409":{"position":[[1933,13]]},"419":{"position":[[3699,13]]},"424":{"position":[[601,13]]},"446":{"position":[[1370,13]]},"481":{"position":[[1163,13],[2743,13]]},"626":{"position":[[1953,13]]},"646":{"position":[[1933,13]]},"656":{"position":[[3699,13]]},"666":{"position":[[601,13]]},"673":{"position":[[1370,13]]}},"keywords":{}}],["mint(&self",{"_index":1494,"title":{},"content":{"80":{"position":[[721,15]]},"231":{"position":[[721,15]]},"462":{"position":[[721,15]]}},"keywords":{}}],["mint(address",{"_index":1122,"title":{},"content":{"43":{"position":[[387,12]]}},"keywords":{}}],["mint.anyon",{"_index":3215,"title":{},"content":{"416":{"position":[[84,11]]},"653":{"position":[[84,11]]}},"keywords":{}}],["minter",{"_index":3302,"title":{},"content":{"419":{"position":[[1881,6],[1955,6]]},"656":{"position":[[1881,6],[1955,6]]}},"keywords":{}}],["minter_list",{"_index":3307,"title":{},"content":{"419":{"position":[[2248,12]]},"656":{"position":[[2248,12]]}},"keywords":{}}],["minut",{"_index":1152,"title":{},"content":{"43":{"position":[[1619,7]]},"193":{"position":[[28,7]]},"201":{"position":[[28,7]]},"395":{"position":[[1293,8],[1337,8]]},"416":{"position":[[1974,7],[2313,8],[2468,8]]},"419":{"position":[[4492,7]]},"421":{"position":[[28,7]]},"429":{"position":[[28,7]]},"632":{"position":[[1293,8],[1337,8]]},"653":{"position":[[1974,7],[2313,8],[2468,8]]},"656":{"position":[[4492,7]]},"663":{"position":[[28,7]]},"676":{"position":[[28,7]]}},"keywords":{}}],["mirror",{"_index":2271,"title":{},"content":{"185":{"position":[[3539,6]]},"221":{"position":[[865,6]]},"376":{"position":[[3523,6]]},"454":{"position":[[865,6]]},"592":{"position":[[3523,6]]},"694":{"position":[[865,6]]}},"keywords":{}}],["miscellan",{"_index":3858,"title":{"615":{"position":[[0,14]]},"723":{"position":[[0,14]]}},"content":{},"keywords":{}}],["miss",{"_index":1877,"title":{},"content":{"129":{"position":[[722,7]]},"280":{"position":[[723,7]]},"517":{"position":[[723,7]]}},"keywords":{}}],["missingoper",{"_index":3495,"title":{},"content":{"441":{"position":[[2301,15],[4411,15]]},"688":{"position":[[2301,15],[4411,15]]}},"keywords":{}}],["missingrol",{"_index":2199,"title":{},"content":{"184":{"position":[[1021,11]]},"375":{"position":[[918,11]]},"591":{"position":[[918,11]]}},"keywords":{}}],["mit",{"_index":1048,"title":{},"content":{"42":{"position":[[902,3]]}},"keywords":{}}],["mix",{"_index":1403,"title":{"74":{"position":[[0,6]]},"238":{"position":[[0,6]]},"474":{"position":[[0,6]]}},"content":{},"keywords":{}}],["mock",{"_index":2730,"title":{},"content":{"223":{"position":[[86,4]]},"456":{"position":[[86,4]]},"696":{"position":[[86,4]]}},"keywords":{}}],["mockvm",{"_index":1096,"title":{},"content":{"42":{"position":[[2586,6]]},"119":{"position":[[132,7]]},"300":{"position":[[132,7]]},"521":{"position":[[132,7]]}},"keywords":{}}],["mod",{"_index":1068,"title":{},"content":{"42":{"position":[[1450,3],[1565,3]]},"51":{"position":[[1108,3],[1334,3]]},"73":{"position":[[451,3]]},"118":{"position":[[198,3]]},"138":{"position":[[177,3]]},"143":{"position":[[114,3],[964,3]]},"148":{"position":[[24,3]]},"151":{"position":[[109,3]]},"160":{"position":[[162,3]]},"168":{"position":[[344,3]]},"178":{"position":[[1030,3]]},"198":{"position":[[24,3]]},"206":{"position":[[26,3]]},"223":{"position":[[812,3]]},"237":{"position":[[451,3]]},"269":{"position":[[3268,3],[3622,3],[3841,3]]},"299":{"position":[[198,3]]},"318":{"position":[[177,3]]},"328":{"position":[[114,3],[939,3]]},"336":{"position":[[24,3]]},"342":{"position":[[109,3]]},"345":{"position":[[162,3]]},"348":{"position":[[344,3]]},"369":{"position":[[1030,3]]},"384":{"position":[[3309,3],[3608,3],[3805,3]]},"409":{"position":[[3268,3],[3622,3],[3841,3]]},"419":{"position":[[6492,3]]},"426":{"position":[[26,3]]},"434":{"position":[[24,3]]},"456":{"position":[[812,3]]},"473":{"position":[[451,3]]},"520":{"position":[[198,3]]},"537":{"position":[[114,3],[939,3]]},"544":{"position":[[177,3]]},"553":{"position":[[24,3]]},"556":{"position":[[109,3]]},"562":{"position":[[162,3]]},"564":{"position":[[344,3]]},"585":{"position":[[1030,3]]},"613":{"position":[[78,3],[1782,3]]},"626":{"position":[[3309,3],[3608,3],[3805,3]]},"646":{"position":[[3268,3],[3622,3],[3841,3]]},"656":{"position":[[6492,3]]},"668":{"position":[[26,3]]},"681":{"position":[[24,3]]},"696":{"position":[[812,3]]},"721":{"position":[[78,3],[1782,3]]}},"keywords":{}}],["modal",{"_index":3271,"title":{},"content":{"416":{"position":[[4807,8]]},"653":{"position":[[4807,8]]}},"keywords":{}}],["modalities::{metadatamut",{"_index":3347,"title":{},"content":{"440":{"position":[[278,32]]},"687":{"position":[[278,32]]}},"keywords":{}}],["modalityi",{"_index":3213,"title":{},"content":{"415":{"position":[[198,10]]},"652":{"position":[[198,10]]}},"keywords":{}}],["mode",{"_index":714,"title":{},"content":{"31":{"position":[[92,5]]},"52":{"position":[[834,4]]},"65":{"position":[[383,4]]},"68":{"position":[[52,5]]},"240":{"position":[[383,4]]},"243":{"position":[[52,5]]},"465":{"position":[[383,4]]},"468":{"position":[[52,5]]}},"keywords":{}}],["model",{"_index":405,"title":{},"content":{"15":{"position":[[181,6]]},"16":{"position":[[141,5]]},"163":{"position":[[1092,5]]},"352":{"position":[[1114,5]]},"568":{"position":[[1114,5]]},"612":{"position":[[1875,6]]},"720":{"position":[[1875,6]]}},"keywords":{}}],["modif",{"_index":2773,"title":{},"content":{"247":{"position":[[1720,13]]},"446":{"position":[[1720,13]]},"673":{"position":[[1720,13]]}},"keywords":{}}],["modifi",{"_index":1180,"title":{"606":{"position":[[0,10]]},"714":{"position":[[0,10]]}},"content":{"50":{"position":[[331,6]]},"52":{"position":[[2098,8]]},"107":{"position":[[206,6]]},"134":{"position":[[103,6]]},"162":{"position":[[1661,6]]},"274":{"position":[[206,6]]},"314":{"position":[[103,6]]},"351":{"position":[[1683,6]]},"440":{"position":[[54,6],[4017,6]]},"441":{"position":[[3992,6],[4115,6]]},"491":{"position":[[206,6]]},"531":{"position":[[103,6]]},"567":{"position":[[1683,6]]},"604":{"position":[[477,6]]},"605":{"position":[[422,6],[436,6],[590,6]]},"606":{"position":[[592,10]]},"687":{"position":[[54,6],[4017,6]]},"688":{"position":[[3992,6],[4115,6]]},"712":{"position":[[477,6]]},"713":{"position":[[422,6],[436,6],[590,6]]},"714":{"position":[[592,10]]}},"keywords":{}}],["modifier/priv",{"_index":3778,"title":{},"content":{"607":{"position":[[298,17]]},"715":{"position":[[298,17]]}},"keywords":{}}],["modul",{"_index":79,"title":{"150":{"position":[[0,7]]},"185":{"position":[[0,7]]},"186":{"position":[[11,7]]},"187":{"position":[[10,8]]},"195":{"position":[[9,7]]},"196":{"position":[[9,7]]},"203":{"position":[[0,6]]},"220":{"position":[[0,6]]},"246":{"position":[[0,6]]},"341":{"position":[[0,7]]},"363":{"position":[[11,7]]},"364":{"position":[[10,8]]},"376":{"position":[[0,7]]},"423":{"position":[[0,6]]},"431":{"position":[[9,7]]},"432":{"position":[[9,7]]},"445":{"position":[[0,6]]},"453":{"position":[[0,6]]},"555":{"position":[[0,7]]},"579":{"position":[[11,7]]},"580":{"position":[[10,8]]},"592":{"position":[[0,7]]},"665":{"position":[[0,6]]},"672":{"position":[[0,6]]},"678":{"position":[[9,7]]},"679":{"position":[[9,7]]},"693":{"position":[[0,6]]}},"content":{"1":{"position":[[976,8]]},"23":{"position":[[210,7]]},"38":{"position":[[767,6]]},"40":{"position":[[355,7]]},"42":{"position":[[399,6],[1637,7],[1695,7]]},"44":{"position":[[183,7],[195,6]]},"50":{"position":[[123,6]]},"51":{"position":[[336,6]]},"53":{"position":[[466,6]]},"78":{"position":[[32,6],[275,6]]},"79":{"position":[[354,6],[427,8],[1273,7],[1400,6],[1587,8]]},"81":{"position":[[149,7],[280,7]]},"84":{"position":[[461,6],[493,7],[660,6],[773,7]]},"85":{"position":[[19,6],[173,6],[191,6],[291,7],[810,7]]},"91":{"position":[[934,6]]},"100":{"position":[[101,7],[1055,7]]},"101":{"position":[[757,7]]},"114":{"position":[[170,8],[221,6],[310,7],[405,6]]},"115":{"position":[[1400,8],[1468,7],[1651,7],[1793,6],[3033,8],[3077,8]]},"141":{"position":[[113,6],[1322,8],[1479,6]]},"146":{"position":[[17,6],[41,6],[102,8],[156,6],[314,8],[630,7]]},"147":{"position":[[15,6]]},"148":{"position":[[173,6],[296,7],[672,6]]},"171":{"position":[[83,8]]},"178":{"position":[[32,6],[56,6],[116,8],[170,6],[299,6],[1179,6],[1302,7]]},"185":{"position":[[57,6]]},"187":{"position":[[5,7],[47,7]]},"188":{"position":[[17,6],[78,6],[166,6],[437,8],[471,6],[561,6],[708,8],[762,6]]},"189":{"position":[[20,6],[107,8],[237,6],[414,6],[590,7]]},"190":{"position":[[12,6]]},"193":{"position":[[2,6]]},"194":{"position":[[80,6]]},"195":{"position":[[482,6],[631,7]]},"196":{"position":[[640,7],[764,6]]},"197":{"position":[[1408,7]]},"198":{"position":[[2014,6],[2508,6],[2579,6]]},"199":{"position":[[12,6]]},"201":{"position":[[2,6]]},"202":{"position":[[4,6]]},"204":{"position":[[1032,7],[1203,7]]},"207":{"position":[[11,8]]},"218":{"position":[[62,7]]},"220":{"position":[[4,6]]},"221":{"position":[[400,6]]},"222":{"position":[[47,6]]},"223":{"position":[[26,6],[176,7]]},"229":{"position":[[32,6],[296,6]]},"230":{"position":[[371,6],[444,8],[1290,7],[1417,6],[1604,8]]},"232":{"position":[[149,7],[280,7]]},"245":{"position":[[16,6],[81,6]]},"246":{"position":[[15,6],[83,8],[413,8]]},"247":{"position":[[1654,7]]},"248":{"position":[[244,8]]},"253":{"position":[[461,6],[493,7],[660,6],[773,7]]},"254":{"position":[[19,6],[173,6],[191,6],[291,7],[810,7]]},"257":{"position":[[170,8],[221,6],[310,7],[405,6]]},"258":{"position":[[1346,8],[1414,7],[1597,7],[1739,6],[2959,8],[3003,8]]},"267":{"position":[[288,6],[829,6],[1852,9],[3250,6],[4341,6],[4392,6],[4441,6]]},"283":{"position":[[932,6]]},"292":{"position":[[101,7],[1055,7]]},"293":{"position":[[757,7]]},"321":{"position":[[140,7],[316,6],[561,6]]},"324":{"position":[[289,6],[326,6],[486,6]]},"326":{"position":[[113,6],[1322,8],[1479,6]]},"334":{"position":[[17,6],[41,6],[102,8],[156,6],[314,8],[634,7]]},"335":{"position":[[15,6]]},"336":{"position":[[173,6],[296,7],[672,6]]},"357":{"position":[[83,8]]},"364":{"position":[[5,7],[47,7]]},"365":{"position":[[374,6],[435,6],[523,6],[794,8],[828,6],[918,6],[1065,8],[1119,6]]},"366":{"position":[[20,6],[107,8],[237,6],[414,6],[590,7]]},"367":{"position":[[12,6]]},"369":{"position":[[32,6],[56,6],[116,8],[170,6],[299,6],[1179,6],[1302,7]]},"376":{"position":[[57,6]]},"395":{"position":[[2740,7]]},"407":{"position":[[288,6],[829,6],[1852,9],[3250,6],[4341,6],[4392,6],[4441,6]]},"414":{"position":[[331,7],[484,6]]},"416":{"position":[[417,6],[1349,7],[4613,7]]},"419":{"position":[[42,7],[647,6],[671,6],[732,8],[1139,6]]},"421":{"position":[[2,6]]},"422":{"position":[[4,6]]},"424":{"position":[[983,7],[1153,7]]},"427":{"position":[[11,8]]},"429":{"position":[[2,6]]},"430":{"position":[[80,6]]},"431":{"position":[[482,6],[631,7]]},"432":{"position":[[577,7],[701,6]]},"433":{"position":[[1407,7]]},"434":{"position":[[2004,6],[2498,6],[2569,6]]},"435":{"position":[[12,6]]},"440":{"position":[[3803,6],[3826,6],[3868,7],[4047,6]]},"441":{"position":[[1690,6]]},"442":{"position":[[154,8]]},"444":{"position":[[16,6],[81,6]]},"445":{"position":[[15,6],[83,8],[413,8]]},"446":{"position":[[1654,7]]},"447":{"position":[[244,8]]},"451":{"position":[[62,7]]},"453":{"position":[[4,6]]},"454":{"position":[[400,6]]},"455":{"position":[[47,6]]},"456":{"position":[[26,6],[176,7]]},"460":{"position":[[32,6],[296,6]]},"461":{"position":[[371,6],[444,8],[1290,7],[1417,6],[1604,8]]},"463":{"position":[[149,7],[280,7]]},"480":{"position":[[170,8],[221,6],[310,7],[405,6]]},"481":{"position":[[1346,8],[1414,7],[1597,7],[1739,6],[2959,8],[3003,8]]},"484":{"position":[[461,6],[493,7],[660,6],[773,7]]},"485":{"position":[[19,6],[173,6],[191,6],[291,7],[810,7]]},"495":{"position":[[932,6]]},"504":{"position":[[101,7],[1055,7]]},"505":{"position":[[757,7]]},"535":{"position":[[113,6],[1322,8],[1479,6]]},"539":{"position":[[140,7],[316,6],[561,6]]},"542":{"position":[[289,6],[326,6],[486,6]]},"551":{"position":[[17,6],[41,6],[102,8],[156,6],[314,8],[634,7]]},"552":{"position":[[15,6]]},"553":{"position":[[173,6],[296,7],[672,6]]},"573":{"position":[[83,8]]},"580":{"position":[[5,7],[47,7]]},"581":{"position":[[374,6],[435,6],[523,6],[794,8],[828,6],[918,6],[1065,8],[1119,6]]},"582":{"position":[[20,6],[107,8],[237,6],[414,6],[590,7]]},"583":{"position":[[12,6]]},"585":{"position":[[32,6],[56,6],[116,8],[170,6],[299,6],[1179,6],[1302,7]]},"592":{"position":[[57,6]]},"596":{"position":[[612,6],[737,6],[891,6]]},"600":{"position":[[951,6]]},"613":{"position":[[1758,7],[1804,7],[1855,7]]},"632":{"position":[[2740,7]]},"644":{"position":[[288,6],[829,6],[1852,9],[3250,6],[4341,6],[4392,6],[4441,6]]},"651":{"position":[[331,7],[484,6]]},"653":{"position":[[417,6],[1349,7],[4613,7]]},"656":{"position":[[42,7],[647,6],[671,6],[732,8],[1139,6]]},"663":{"position":[[2,6]]},"664":{"position":[[4,6]]},"666":{"position":[[983,7],[1153,7]]},"669":{"position":[[11,8]]},"671":{"position":[[16,6],[81,6]]},"672":{"position":[[15,6],[83,8],[413,8]]},"673":{"position":[[1654,7]]},"674":{"position":[[244,8]]},"676":{"position":[[2,6]]},"677":{"position":[[80,6]]},"678":{"position":[[482,6],[631,7]]},"679":{"position":[[577,7],[701,6]]},"680":{"position":[[1407,7]]},"681":{"position":[[2014,6],[2508,6],[2579,6]]},"682":{"position":[[12,6]]},"687":{"position":[[3803,6],[3826,6],[3868,7],[4047,6]]},"688":{"position":[[1690,6]]},"689":{"position":[[154,8]]},"691":{"position":[[62,7]]},"693":{"position":[[4,6]]},"694":{"position":[[400,6]]},"695":{"position":[[47,6]]},"696":{"position":[[26,6],[176,7]]},"704":{"position":[[612,6],[737,6],[891,6]]},"708":{"position":[[951,6]]},"721":{"position":[[1758,7],[1804,7],[1855,7]]}},"keywords":{}}],["modular",{"_index":1521,"title":{},"content":{"84":{"position":[[24,10]]},"115":{"position":[[3315,7]]},"248":{"position":[[32,11]]},"253":{"position":[[24,10]]},"258":{"position":[[3241,7]]},"447":{"position":[[32,11]]},"481":{"position":[[3241,7]]},"484":{"position":[[24,10]]},"612":{"position":[[2084,7]]},"674":{"position":[[32,11]]},"720":{"position":[[2084,7]]}},"keywords":{}}],["module.a",{"_index":2166,"title":{},"content":{"182":{"position":[[118,8]]},"373":{"position":[[118,8]]},"589":{"position":[[118,8]]}},"keywords":{}}],["module.l49",{"_index":2258,"title":{},"content":{"185":{"position":[[2972,10]]},"247":{"position":[[1774,10]]},"376":{"position":[[2956,10]]},"446":{"position":[[1774,10]]},"592":{"position":[[2956,10]]},"673":{"position":[[1774,10]]}},"keywords":{}}],["module.l57",{"_index":2775,"title":{},"content":{"247":{"position":[[1825,10]]},"446":{"position":[[1825,10]]},"673":{"position":[[1825,10]]}},"keywords":{}}],["module.odra::types::address",{"_index":2818,"title":{},"content":{"267":{"position":[[367,27]]},"407":{"position":[[367,27]]},"644":{"position":[[367,27]]}},"keywords":{}}],["module::modul",{"_index":3622,"title":{},"content":{"598":{"position":[[89,15]]},"706":{"position":[[89,15]]}},"keywords":{}}],["module::submodul",{"_index":1739,"title":{},"content":{"115":{"position":[[1961,18]]},"258":{"position":[[149,18],[1907,18]]},"481":{"position":[[149,18],[1907,18]]}},"keywords":{}}],["module::{modul",{"_index":1714,"title":{},"content":{"115":{"position":[[149,16]]}},"keywords":{}}],["modulename}}contractref",{"_index":1930,"title":{},"content":{"141":{"position":[[225,25]]},"267":{"position":[[3668,25]]},"326":{"position":[[225,25]]},"407":{"position":[[3668,25]]},"535":{"position":[[225,25]]},"644":{"position":[[3668,25]]}},"keywords":{}}],["modulename}}contractref::address",{"_index":1935,"title":{},"content":{"141":{"position":[[607,36]]},"326":{"position":[[607,36]]},"535":{"position":[[607,36]]}},"keywords":{}}],["modulename}}contractref::new(env",{"_index":1931,"title":{},"content":{"141":{"position":[[393,35]]},"267":{"position":[[3747,35]]},"326":{"position":[[393,35]]},"407":{"position":[[3747,35]]},"535":{"position":[[393,35]]},"644":{"position":[[3747,35]]}},"keywords":{}}],["modulename}}deployer::init",{"_index":2899,"title":{},"content":{"268":{"position":[[373,31]]},"408":{"position":[[373,31]]},"645":{"position":[[373,31]]}},"keywords":{}}],["modulename}}hostref",{"_index":1916,"title":{},"content":{"138":{"position":[[799,21]]},"141":{"position":[[198,22]]},"268":{"position":[[409,21],[2002,22]]},"318":{"position":[[791,21]]},"326":{"position":[[198,22]]},"408":{"position":[[409,21],[2002,22]]},"535":{"position":[[198,22]]},"544":{"position":[[791,21]]},"645":{"position":[[409,21],[2002,22]]}},"keywords":{}}],["modulename}}hostref::deploy(&env",{"_index":2898,"title":{},"content":{"268":{"position":[[316,39]]},"408":{"position":[[316,39]]},"645":{"position":[[316,39]]}},"keywords":{}}],["modulename}}initarg",{"_index":2903,"title":{},"content":{"268":{"position":[[752,22]]},"408":{"position":[[752,22]]},"645":{"position":[[752,22]]}},"keywords":{}}],["modulename}}ref",{"_index":2884,"title":{},"content":{"267":{"position":[[3702,18]]},"407":{"position":[[3702,18]]},"644":{"position":[[3702,18]]}},"keywords":{}}],["modulename}}ref::at",{"_index":2885,"title":{},"content":{"267":{"position":[[3800,25]]},"407":{"position":[[3800,25]]},"644":{"position":[[3800,25]]}},"keywords":{}}],["modules_contract",{"_index":2015,"title":{},"content":{"151":{"position":[[257,16]]},"342":{"position":[[257,16]]},"556":{"position":[[257,16]]}},"keywords":{}}],["modulescontracthostref::deploy(&test_env",{"_index":2016,"title":{},"content":{"151":{"position":[[276,45]]},"342":{"position":[[276,45]]},"556":{"position":[[276,45]]}},"keywords":{}}],["money",{"_index":1348,"title":{},"content":{"70":{"position":[[58,5],[251,5]]},"234":{"position":[[58,5],[251,5]]},"470":{"position":[[58,5],[251,5]]}},"keywords":{}}],["month",{"_index":153,"title":{},"content":{"3":{"position":[[501,6]]}},"keywords":{}}],["more",{"_index":382,"title":{},"content":{"12":{"position":[[127,4]]},"15":{"position":[[66,4],[75,4]]},"16":{"position":[[230,4]]},"20":{"position":[[0,4]]},"24":{"position":[[41,4]]},"33":{"position":[[150,4],[191,4]]},"38":{"position":[[811,4]]},"39":{"position":[[1001,5],[1028,4]]},"43":{"position":[[2,4]]},"52":{"position":[[148,4]]},"74":{"position":[[22,4]]},"79":{"position":[[286,4]]},"81":{"position":[[369,4]]},"84":{"position":[[522,4]]},"99":{"position":[[680,4]]},"100":{"position":[[1015,4]]},"101":{"position":[[716,4]]},"110":{"position":[[211,4]]},"111":{"position":[[303,4]]},"112":{"position":[[51,4]]},"115":{"position":[[1743,4],[3295,4]]},"118":{"position":[[277,4]]},"126":{"position":[[203,4],[2995,4]]},"132":{"position":[[309,4]]},"136":{"position":[[214,4]]},"146":{"position":[[810,4]]},"157":{"position":[[793,4]]},"199":{"position":[[202,4]]},"202":{"position":[[35,4]]},"211":{"position":[[794,4]]},"230":{"position":[[303,4]]},"232":{"position":[[369,4]]},"238":{"position":[[22,4]]},"253":{"position":[[522,4]]},"258":{"position":[[1689,4],[3221,4]]},"270":{"position":[[230,4]]},"277":{"position":[[203,4],[3163,4]]},"291":{"position":[[680,4]]},"292":{"position":[[1015,4]]},"293":{"position":[[716,4]]},"299":{"position":[[277,4]]},"305":{"position":[[211,4]]},"306":{"position":[[303,4]]},"307":{"position":[[51,4]]},"312":{"position":[[309,4]]},"316":{"position":[[214,4]]},"330":{"position":[[769,4]]},"334":{"position":[[814,4]]},"365":{"position":[[148,4],[329,4]]},"385":{"position":[[230,4]]},"390":{"position":[[768,4]]},"397":{"position":[[26,4]]},"410":{"position":[[230,4]]},"413":{"position":[[74,4]]},"414":{"position":[[588,4]]},"422":{"position":[[35,4]]},"435":{"position":[[202,4]]},"461":{"position":[[303,4]]},"463":{"position":[[369,4]]},"474":{"position":[[22,4]]},"481":{"position":[[1689,4],[3221,4]]},"484":{"position":[[522,4]]},"503":{"position":[[680,4]]},"504":{"position":[[1015,4]]},"505":{"position":[[716,4]]},"510":{"position":[[211,4]]},"511":{"position":[[303,4]]},"512":{"position":[[51,4]]},"514":{"position":[[203,4],[2995,4]]},"520":{"position":[[277,4]]},"529":{"position":[[309,4]]},"533":{"position":[[214,4]]},"547":{"position":[[793,4]]},"551":{"position":[[814,4]]},"581":{"position":[[148,4],[329,4]]},"596":{"position":[[501,4]]},"602":{"position":[[1172,4],[2056,4]]},"610":{"position":[[929,4]]},"612":{"position":[[1453,4],[2066,4]]},"617":{"position":[[855,4]]},"618":{"position":[[349,4],[432,4]]},"627":{"position":[[230,4]]},"634":{"position":[[26,4]]},"647":{"position":[[230,4]]},"650":{"position":[[74,4]]},"651":{"position":[[588,4]]},"660":{"position":[[768,4]]},"664":{"position":[[35,4]]},"682":{"position":[[202,4]]},"704":{"position":[[501,4]]},"710":{"position":[[1172,4],[2056,4]]},"718":{"position":[[929,4]]},"720":{"position":[[1453,4],[2066,4]]},"725":{"position":[[855,4]]},"726":{"position":[[349,4],[432,4]]}},"keywords":{}}],["moreov",{"_index":3227,"title":{},"content":{"416":{"position":[[992,9]]},"653":{"position":[[992,9]]}},"keywords":{}}],["morph",{"_index":1269,"title":{},"content":{"52":{"position":[[1869,5]]}},"keywords":{}}],["mote",{"_index":1594,"title":{},"content":{"92":{"position":[[454,5]]},"95":{"position":[[336,5]]},"284":{"position":[[454,5]]},"287":{"position":[[336,5]]},"496":{"position":[[454,5]]},"499":{"position":[[336,5]]}},"keywords":{}}],["motto",{"_index":33,"title":{},"content":{"1":{"position":[[356,5]]}},"keywords":{}}],["move",{"_index":380,"title":{},"content":{"12":{"position":[[67,6]]},"52":{"position":[[406,4]]},"65":{"position":[[674,4]]},"195":{"position":[[236,4]]},"221":{"position":[[11,4]]},"240":{"position":[[674,4]]},"262":{"position":[[11,4]]},"380":{"position":[[11,4]]},"395":{"position":[[6768,4]]},"402":{"position":[[11,4]]},"431":{"position":[[236,4]]},"454":{"position":[[11,4]]},"465":{"position":[[674,4]]},"622":{"position":[[11,4]]},"632":{"position":[[6768,4]]},"639":{"position":[[11,4]]},"678":{"position":[[236,4]]},"694":{"position":[[11,4]]}},"keywords":{}}],["ms",{"_index":3184,"title":{},"content":{"395":{"position":[[6169,2]]},"632":{"position":[[6169,2]]}},"keywords":{}}],["msg",{"_index":492,"title":{},"content":{"17":{"position":[[1126,4],[1382,4]]}},"keywords":{}}],["msg.sender",{"_index":1056,"title":{},"content":{"42":{"position":[[1073,11]]}},"keywords":{}}],["much",{"_index":624,"title":{},"content":{"21":{"position":[[150,4]]},"22":{"position":[[170,4]]},"38":{"position":[[158,4]]},"52":{"position":[[543,4]]},"397":{"position":[[21,4]]},"634":{"position":[[21,4]]}},"keywords":{}}],["multipl",{"_index":890,"title":{"129":{"position":[[0,8]]},"280":{"position":[[0,8]]},"517":{"position":[[0,8]]}},"content":{"38":{"position":[[997,8]]},"39":{"position":[[1064,8],[1299,8]]},"71":{"position":[[250,8]]},"72":{"position":[[89,8]]},"74":{"position":[[111,8]]},"126":{"position":[[174,8]]},"129":{"position":[[23,8],[121,8],[140,8],[163,8]]},"235":{"position":[[250,8]]},"236":{"position":[[89,8]]},"238":{"position":[[111,8]]},"268":{"position":[[2849,8]]},"277":{"position":[[174,8]]},"280":{"position":[[23,8],[121,8],[140,8],[163,8]]},"408":{"position":[[2849,8]]},"471":{"position":[[250,8]]},"472":{"position":[[89,8]]},"474":{"position":[[111,8]]},"476":{"position":[[843,8]]},"514":{"position":[[174,8]]},"517":{"position":[[23,8],[121,8],[140,8],[163,8]]},"610":{"position":[[594,8]]},"612":{"position":[[1385,8],[1605,8],[1695,8]]},"613":{"position":[[1935,8]]},"645":{"position":[[2849,8]]},"698":{"position":[[843,8]]},"718":{"position":[[594,8]]},"720":{"position":[[1385,8],[1605,8],[1695,8]]},"721":{"position":[[1935,8]]}},"keywords":{}}],["multipli",{"_index":265,"title":{},"content":{"9":{"position":[[214,10]]}},"keywords":{}}],["multiply!exampl",{"_index":225,"title":{},"content":{"7":{"position":[[131,17]]}},"keywords":{}}],["multiply_id",{"_index":275,"title":{},"content":{"9":{"position":[[404,12]]}},"keywords":{}}],["multiply_src",{"_index":267,"title":{},"content":{"9":{"position":[[237,12]]}},"keywords":{}}],["mut",{"_index":273,"title":{},"content":{"9":{"position":[[360,3]]},"31":{"position":[[1365,3],[2190,3]]},"32":{"position":[[1230,3]]},"42":{"position":[[2180,3]]},"51":{"position":[[1491,3]]},"73":{"position":[[608,3]]},"80":{"position":[[807,3]]},"126":{"position":[[2424,3],[2906,3]]},"138":{"position":[[567,3]]},"148":{"position":[[308,3]]},"160":{"position":[[338,3]]},"178":{"position":[[1314,3],[1506,3]]},"198":{"position":[[594,4],[933,4]]},"206":{"position":[[1141,3],[1779,3],[2099,3],[3385,3]]},"212":{"position":[[1964,3],[2019,3],[3861,3],[4088,3],[4116,3]]},"223":{"position":[[952,3]]},"231":{"position":[[807,3]]},"237":{"position":[[608,3]]},"268":{"position":[[2400,3]]},"269":{"position":[[5051,3],[5689,3]]},"277":{"position":[[2592,3],[3074,3]]},"318":{"position":[[559,3]]},"336":{"position":[[308,3]]},"345":{"position":[[338,3]]},"369":{"position":[[1314,3],[1506,3]]},"391":{"position":[[1964,3],[2019,3],[3879,3],[4106,3],[4134,3]]},"395":{"position":[[929,3]]},"408":{"position":[[2400,3]]},"409":{"position":[[5051,3],[5689,3]]},"416":{"position":[[3937,3],[3971,3]]},"417":{"position":[[350,3]]},"419":{"position":[[5516,3],[5550,3],[6765,3]]},"426":{"position":[[1136,3],[1769,3],[2089,3],[3360,3]]},"434":{"position":[[589,4],[923,4]]},"440":{"position":[[2577,3],[5147,3]]},"441":{"position":[[1323,3],[5036,3]]},"456":{"position":[[952,3]]},"462":{"position":[[807,3]]},"473":{"position":[[608,3]]},"477":{"position":[[1834,3]]},"514":{"position":[[2424,3],[2906,3]]},"544":{"position":[[559,3]]},"553":{"position":[[308,3]]},"562":{"position":[[338,3]]},"585":{"position":[[1314,3],[1506,3]]},"601":{"position":[[1552,3],[1663,3],[1793,3]]},"613":{"position":[[157,3],[193,3],[682,3],[987,3]]},"616":{"position":[[295,3]]},"632":{"position":[[929,3]]},"645":{"position":[[2400,3]]},"646":{"position":[[5051,3],[5689,3]]},"653":{"position":[[3937,3],[3971,3]]},"654":{"position":[[350,3]]},"656":{"position":[[5516,3],[5550,3],[6765,3]]},"661":{"position":[[1964,3],[2019,3],[3879,3],[4106,3],[4134,3]]},"668":{"position":[[1141,3],[1779,3],[2099,3],[3385,3]]},"681":{"position":[[594,4],[933,4]]},"687":{"position":[[2577,3],[5147,3]]},"688":{"position":[[1323,3],[5036,3]]},"696":{"position":[[952,3]]},"699":{"position":[[1834,3]]},"709":{"position":[[1552,3],[1663,3],[1793,3]]},"721":{"position":[[157,3],[193,3],[682,3],[987,3]]},"724":{"position":[[295,3]]}},"keywords":{}}],["mutabl",{"_index":1831,"title":{},"content":{"126":{"position":[[2960,7],[3087,8]]},"128":{"position":[[486,7]]},"277":{"position":[[3128,7],[3255,8]]},"279":{"position":[[486,7]]},"324":{"position":[[1083,8]]},"514":{"position":[[2960,7],[3087,8]]},"516":{"position":[[486,7]]},"542":{"position":[[1083,8]]}},"keywords":{}}],["mv",{"_index":1337,"title":{},"content":{"65":{"position":[[689,2]]},"68":{"position":[[319,2]]},"240":{"position":[[689,2]]},"243":{"position":[[319,2]]},"465":{"position":[[689,2]]},"468":{"position":[[319,2]]}},"keywords":{}}],["my_address",{"_index":3670,"title":{},"content":{"599":{"position":[[207,11]]},"707":{"position":[[207,11]]}},"keywords":{}}],["my_contract",{"_index":1332,"title":{},"content":{"65":{"position":[[351,11]]},"68":{"position":[[31,11]]},"160":{"position":[[342,11]]},"240":{"position":[[351,11]]},"243":{"position":[[31,11]]},"345":{"position":[[342,11]]},"465":{"position":[[351,11]]},"468":{"position":[[31,11]]},"562":{"position":[[342,11]]}},"keywords":{}}],["my_contract.with_tokens(u512::from(100)).deposit",{"_index":2041,"title":{},"content":{"160":{"position":[[478,51]]},"345":{"position":[[478,51]]},"562":{"position":[[478,51]]}},"keywords":{}}],["my_contract.withdraw(u512::from(25",{"_index":2043,"title":{},"content":{"160":{"position":[[603,37]]},"345":{"position":[[603,37]]},"562":{"position":[[603,37]]}},"keywords":{}}],["my_map",{"_index":3684,"title":{},"content":{"601":{"position":[[108,7],[668,7]]},"709":{"position":[[108,7],[668,7]]}},"keywords":{}}],["my_nft",{"_index":1673,"title":{},"content":{"100":{"position":[[1117,6]]},"292":{"position":[[1117,6]]},"504":{"position":[[1117,6]]}},"keywords":{}}],["my_project",{"_index":1331,"title":{},"content":{"65":{"position":[[311,11]]},"68":{"position":[[145,10]]},"117":{"position":[[207,10],[237,11]]},"175":{"position":[[88,10],[137,10]]},"240":{"position":[[311,11]]},"243":{"position":[[145,10]]},"298":{"position":[[207,10],[237,11]]},"361":{"position":[[88,10],[137,10]]},"465":{"position":[[311,11]]},"468":{"position":[[145,10]]},"519":{"position":[[207,10],[237,11]]},"577":{"position":[[88,10],[137,10]]}},"keywords":{}}],["my_project_build_contract",{"_index":1327,"title":{},"content":{"65":{"position":[[155,25]]},"68":{"position":[[293,25]]},"240":{"position":[[155,25]]},"243":{"position":[[293,25]]},"465":{"position":[[155,25]]},"468":{"position":[[293,25]]}},"keywords":{}}],["my_project_build_contract.wasm",{"_index":1335,"title":{},"content":{"65":{"position":[[509,31]]},"240":{"position":[[509,31]]},"465":{"position":[[509,31]]}},"keywords":{}}],["my_uint",{"_index":3668,"title":{},"content":{"599":{"position":[[159,8]]},"600":{"position":[[126,8]]},"707":{"position":[[159,8]]},"708":{"position":[[126,8]]}},"keywords":{}}],["mycontract",{"_index":2969,"title":{},"content":{"321":{"position":[[940,10],[1028,10]]},"539":{"position":[[940,10],[1028,10]]}},"keywords":{}}],["myerror",{"_index":2968,"title":{},"content":{"321":{"position":[[917,8],[1871,8]]},"539":{"position":[[917,8],[1871,8]]}},"keywords":{}}],["mynctl",{"_index":2572,"title":{},"content":{"210":{"position":[[120,6]]},"389":{"position":[[120,6]]},"477":{"position":[[129,6],[363,6]]},"659":{"position":[[120,6]]},"699":{"position":[[129,6],[363,6]]}},"keywords":{}}],["mytoken",{"_index":3208,"title":{},"content":{"414":{"position":[[224,7],[272,7]]},"651":{"position":[[224,7],[272,7]]}},"keywords":{}}],["n",{"_index":697,"title":{},"content":{"30":{"position":[[299,2],[332,2],[353,2]]},"42":{"position":[[217,1]]},"73":{"position":[[183,2],[196,1]]},"85":{"position":[[40,1],[97,1]]},"117":{"position":[[985,1],[1057,1],[1166,1]]},"168":{"position":[[1887,2],[1924,1]]},"237":{"position":[[183,2],[196,1]]},"254":{"position":[[40,1],[97,1]]},"298":{"position":[[985,1],[1057,1],[1166,1]]},"348":{"position":[[1887,2],[1924,1]]},"473":{"position":[[183,2],[196,1]]},"485":{"position":[[40,1],[97,1]]},"519":{"position":[[985,1],[1057,1],[1166,1]]},"564":{"position":[[1887,2],[1924,1]]}},"keywords":{}}],["n1",{"_index":1946,"title":{},"content":{"141":{"position":[[1275,3]]},"326":{"position":[[1275,3]]},"535":{"position":[[1275,3]]}},"keywords":{}}],["n2",{"_index":1947,"title":{},"content":{"141":{"position":[[1284,3]]},"326":{"position":[[1284,3]]},"535":{"position":[[1284,3]]}},"keywords":{}}],["name",{"_index":512,"title":{},"content":{"17":{"position":[[1974,5],[2263,5]]},"39":{"position":[[754,5],[1914,5]]},"43":{"position":[[978,4]]},"52":{"position":[[948,5],[970,8],[2271,4],[3284,5],[4905,5]]},"65":{"position":[[305,5],[504,4],[628,5]]},"76":{"position":[[547,4]]},"83":{"position":[[64,5],[142,5]]},"84":{"position":[[233,5],[341,4]]},"85":{"position":[[513,5],[614,5]]},"96":{"position":[[0,4]]},"99":{"position":[[276,4]]},"100":{"position":[[370,4],[1146,5]]},"101":{"position":[[224,4]]},"103":{"position":[[240,4]]},"115":{"position":[[360,5],[2203,5]]},"117":{"position":[[109,6],[118,4],[156,4],[229,4],[374,4],[653,4],[1313,4]]},"119":{"position":[[298,4],[1018,5]]},"121":{"position":[[48,5]]},"126":{"position":[[117,4],[790,4],[1887,4],[2356,5],[3036,5],[3522,4]]},"131":{"position":[[54,4],[232,4],[335,4]]},"132":{"position":[[245,5]]},"136":{"position":[[227,6]]},"138":{"position":[[516,5],[939,5]]},"147":{"position":[[752,5]]},"154":{"position":[[145,4]]},"162":{"position":[[420,5],[817,5]]},"163":{"position":[[403,5],[519,4]]},"164":{"position":[[196,5],[579,5]]},"165":{"position":[[250,5]]},"168":{"position":[[637,5],[895,5]]},"175":{"position":[[58,4]]},"178":{"position":[[479,5]]},"198":{"position":[[1515,7]]},"202":{"position":[[162,5]]},"203":{"position":[[204,5],[456,4]]},"204":{"position":[[90,5]]},"206":{"position":[[126,5],[430,5]]},"209":{"position":[[594,5],[984,5],[1073,5],[1281,5]]},"210":{"position":[[115,4],[426,4],[1200,4]]},"212":{"position":[[493,5],[1613,4],[1652,6],[2492,5],[2876,5],[2952,4],[4512,5]]},"227":{"position":[[547,4]]},"240":{"position":[[305,5],[504,4],[628,5]]},"247":{"position":[[125,5]]},"252":{"position":[[64,5],[142,5]]},"253":{"position":[[233,5],[341,4]]},"254":{"position":[[513,5],[614,5]]},"258":{"position":[[350,5],[2149,5]]},"264":{"position":[[509,6],[525,4]]},"265":{"position":[[452,4],[634,4],[741,4]]},"266":{"position":[[78,4]]},"267":{"position":[[3662,5],[4135,5]]},"268":{"position":[[1242,5]]},"269":{"position":[[372,5],[595,5],[4030,5],[4334,5]]},"277":{"position":[[117,4],[790,4],[2055,4],[2524,5],[3204,5],[3690,4]]},"288":{"position":[[0,4]]},"291":{"position":[[276,4]]},"292":{"position":[[370,4],[1146,5]]},"293":{"position":[[224,4]]},"295":{"position":[[240,4]]},"298":{"position":[[109,6],[118,4],[156,4],[229,4],[374,4],[653,4],[1313,4]]},"300":{"position":[[298,4],[1018,5]]},"302":{"position":[[48,5]]},"311":{"position":[[54,4],[284,4],[387,4]]},"312":{"position":[[245,5]]},"316":{"position":[[227,6]]},"318":{"position":[[508,5],[931,5]]},"321":{"position":[[132,7],[524,4],[568,4],[573,4],[953,5],[1080,4],[1141,5],[1265,4],[1292,4],[1361,5],[1438,4],[1533,5],[1737,5],[1929,4],[2072,5],[2208,5]]},"323":{"position":[[1454,4],[1757,4],[2741,4],[2910,4],[3120,4],[3320,4]]},"324":{"position":[[248,4],[296,5],[614,5],[792,5],[986,5],[1284,4],[1473,4]]},"335":{"position":[[760,5]]},"339":{"position":[[145,4]]},"348":{"position":[[637,5],[895,5]]},"351":{"position":[[457,5],[839,5]]},"352":{"position":[[425,5],[541,4]]},"353":{"position":[[231,5],[614,5]]},"354":{"position":[[288,5],[381,5]]},"361":{"position":[[58,4]]},"369":{"position":[[479,5]]},"382":{"position":[[322,6],[338,4]]},"383":{"position":[[374,5]]},"384":{"position":[[385,5],[608,5]]},"388":{"position":[[555,5],[916,5],[1005,5],[1213,5]]},"389":{"position":[[115,4],[426,4],[1137,4]]},"391":{"position":[[493,5],[1613,4],[1652,6],[2492,5],[2882,5],[2964,4],[4530,5]]},"395":{"position":[[1837,4],[2016,5],[2558,4],[3189,4],[3293,4],[3393,4],[3978,4]]},"396":{"position":[[605,5],[703,4]]},"404":{"position":[[509,6],[525,4]]},"405":{"position":[[452,4],[634,4],[741,4]]},"406":{"position":[[78,4]]},"407":{"position":[[3662,5],[4135,5]]},"408":{"position":[[1242,5]]},"409":{"position":[[372,5],[595,5],[4030,5],[4334,5]]},"414":{"position":[[57,4],[121,4],[566,4],[745,4],[801,4]]},"417":{"position":[[216,5]]},"419":{"position":[[1390,5],[1571,5],[2330,4],[6631,5]]},"422":{"position":[[162,5]]},"423":{"position":[[204,5],[456,4]]},"424":{"position":[[65,5]]},"426":{"position":[[126,5],[430,5]]},"434":{"position":[[1505,7]]},"439":{"position":[[153,4]]},"446":{"position":[[125,5]]},"458":{"position":[[547,4]]},"465":{"position":[[305,5],[504,4],[628,5]]},"477":{"position":[[124,4],[734,4],[1123,4]]},"481":{"position":[[350,5],[2149,5]]},"483":{"position":[[64,5],[142,5]]},"484":{"position":[[233,5],[341,4]]},"485":{"position":[[513,5],[614,5]]},"500":{"position":[[0,4]]},"503":{"position":[[276,4]]},"504":{"position":[[370,4],[1146,5]]},"505":{"position":[[224,4]]},"507":{"position":[[240,4]]},"514":{"position":[[117,4],[790,4],[1887,4],[2356,5],[3036,5],[3522,4]]},"519":{"position":[[109,6],[118,4],[156,4],[229,4],[374,4],[653,4],[1313,4]]},"521":{"position":[[298,4],[1018,5]]},"523":{"position":[[48,5]]},"528":{"position":[[54,4],[284,4],[387,4]]},"529":{"position":[[245,5]]},"533":{"position":[[227,6]]},"539":{"position":[[132,7],[524,4],[568,4],[573,4],[953,5],[1080,4],[1141,5],[1265,4],[1292,4],[1361,5],[1438,4],[1533,5],[1737,5],[1929,4],[2072,5],[2208,5]]},"541":{"position":[[1454,4],[1757,4],[2741,4],[2910,4],[3120,4],[3320,4]]},"542":{"position":[[248,4],[296,5],[614,5],[792,5],[986,5],[1284,4],[1473,4]]},"544":{"position":[[508,5],[931,5]]},"552":{"position":[[760,5]]},"559":{"position":[[145,4]]},"564":{"position":[[637,5],[895,5]]},"567":{"position":[[457,5],[839,5]]},"568":{"position":[[425,5],[541,4]]},"569":{"position":[[231,5],[614,5]]},"570":{"position":[[288,5],[381,5]]},"577":{"position":[[58,4]]},"585":{"position":[[479,5]]},"598":{"position":[[2026,5]]},"624":{"position":[[322,6],[338,4]]},"625":{"position":[[374,5]]},"626":{"position":[[385,5],[608,5]]},"632":{"position":[[1837,4],[2016,5],[2558,4],[3189,4],[3293,4],[3393,4],[3978,4]]},"633":{"position":[[605,5],[703,4]]},"641":{"position":[[509,6],[525,4]]},"642":{"position":[[452,4],[634,4],[741,4]]},"643":{"position":[[78,4]]},"644":{"position":[[3662,5],[4135,5]]},"645":{"position":[[1242,5]]},"646":{"position":[[372,5],[595,5],[4030,5],[4334,5]]},"651":{"position":[[57,4],[121,4],[566,4],[745,4],[801,4]]},"654":{"position":[[216,5]]},"656":{"position":[[1390,5],[1571,5],[2330,4],[6631,5]]},"658":{"position":[[555,5],[916,5],[1005,5],[1213,5]]},"659":{"position":[[115,4],[426,4],[1137,4]]},"661":{"position":[[493,5],[1613,4],[1652,6],[2492,5],[2882,5],[2964,4],[4530,5]]},"664":{"position":[[162,5]]},"665":{"position":[[204,5],[456,4]]},"666":{"position":[[65,5]]},"668":{"position":[[126,5],[430,5]]},"673":{"position":[[125,5]]},"681":{"position":[[1515,7]]},"686":{"position":[[153,4]]},"699":{"position":[[124,4],[734,4],[1123,4]]},"706":{"position":[[2026,5]]}},"keywords":{}}],["name'"",{"_index":2586,"title":{},"content":{"210":{"position":[[878,11]]},"389":{"position":[[815,11]]},"659":{"position":[[815,11]]}},"keywords":{}}],["name(&self",{"_index":1723,"title":{},"content":{"115":{"position":[[803,15]]},"162":{"position":[[1091,15]]},"164":{"position":[[625,15]]},"204":{"position":[[321,15]]},"247":{"position":[[324,15]]},"258":{"position":[[777,15]]},"269":{"position":[[1680,15]]},"351":{"position":[[1113,15]]},"353":{"position":[[660,15]]},"384":{"position":[[1693,15]]},"409":{"position":[[1680,15]]},"414":{"position":[[374,15]]},"419":{"position":[[2352,15]]},"424":{"position":[[296,15]]},"446":{"position":[[324,15]]},"481":{"position":[[777,15]]},"567":{"position":[[1113,15]]},"569":{"position":[[660,15]]},"626":{"position":[[1693,15]]},"646":{"position":[[1680,15]]},"651":{"position":[[374,15]]},"656":{"position":[[2352,15]]},"666":{"position":[[296,15]]},"673":{"position":[[324,15]]}},"keywords":{}}],["name."",{"_index":3035,"title":{},"content":{"323":{"position":[[2940,12]]},"541":{"position":[[2940,12]]}},"keywords":{}}],["name.to_bytes().unwrap",{"_index":2656,"title":{},"content":{"212":{"position":[[2985,25]]},"391":{"position":[[2997,25]]},"661":{"position":[[2997,25]]}},"keywords":{}}],["name.to_str",{"_index":2499,"title":{},"content":{"206":{"position":[[436,17],[745,18]]},"268":{"position":[[1248,17]]},"269":{"position":[[4340,17],[4655,18]]},"408":{"position":[[1248,17]]},"409":{"position":[[4340,17],[4655,18]]},"426":{"position":[[436,17],[745,18]]},"645":{"position":[[1248,17]]},"646":{"position":[[4340,17],[4655,18]]},"668":{"position":[[436,17],[745,18]]}},"keywords":{}}],["name2",{"_index":2561,"title":{},"content":{"209":{"position":[[1295,6]]},"388":{"position":[[1227,6]]},"658":{"position":[[1227,6]]}},"keywords":{}}],["name_",{"_index":1115,"title":{},"content":{"43":{"position":[[246,6]]}},"keywords":{}}],["named_valu",{"_index":2567,"title":{},"content":{"209":{"position":[[1656,13]]},"211":{"position":[[458,13]]},"388":{"position":[[1588,13]]},"390":{"position":[[432,13]]},"658":{"position":[[1588,13]]},"660":{"position":[[432,13]]}},"keywords":{}}],["named_value(nam",{"_index":2654,"title":{},"content":{"212":{"position":[[2817,17]]},"391":{"position":[[2823,17]]},"661":{"position":[[2823,17]]}},"keywords":{}}],["namenotset",{"_index":2837,"title":{},"content":{"267":{"position":[[1393,10]]},"269":{"position":[[3756,10]]},"383":{"position":[[839,10]]},"384":{"position":[[3720,10]]},"407":{"position":[[1393,10]]},"409":{"position":[[3756,10]]},"625":{"position":[[839,10]]},"626":{"position":[[3720,10]]},"644":{"position":[[1393,10]]},"646":{"position":[[3756,10]]}},"keywords":{}}],["namespac",{"_index":1476,"title":{},"content":{"79":{"position":[[1566,9]]},"230":{"position":[[1583,9]]},"461":{"position":[[1583,9]]}},"keywords":{}}],["nativ",{"_index":1157,"title":{"159":{"position":[[0,6]]},"344":{"position":[[0,6]]},"561":{"position":[[0,6]]}},"content":{"43":{"position":[[1832,6]]},"70":{"position":[[272,6]]},"90":{"position":[[97,6]]},"102":{"position":[[46,6]]},"107":{"position":[[511,6]]},"152":{"position":[[26,6]]},"188":{"position":[[725,6],[800,6]]},"203":{"position":[[487,6]]},"234":{"position":[[272,6]]},"274":{"position":[[511,6]]},"282":{"position":[[97,6]]},"294":{"position":[[46,6]]},"343":{"position":[[26,6]]},"365":{"position":[[1082,6],[1157,6]]},"423":{"position":[[487,6]]},"470":{"position":[[272,6]]},"491":{"position":[[511,6]]},"494":{"position":[[97,6]]},"506":{"position":[[46,6]]},"557":{"position":[[26,6]]},"581":{"position":[[1082,6],[1157,6]]},"610":{"position":[[888,9]]},"665":{"position":[[487,6]]},"718":{"position":[[888,9]]}},"keywords":{}}],["native_token_metadata",{"_index":2876,"title":{},"content":{"267":{"position":[[3160,23]]},"407":{"position":[[3160,23]]},"644":{"position":[[3160,23]]}},"keywords":{}}],["natur",{"_index":1044,"title":{},"content":{"42":{"position":[[824,10]]}},"keywords":{}}],["navig",{"_index":1658,"title":{},"content":{"100":{"position":[[85,8]]},"292":{"position":[[85,8]]},"504":{"position":[[85,8]]}},"keywords":{}}],["nctl",{"_index":2568,"title":{},"content":{"210":{"position":[[51,4],[195,4]]},"389":{"position":[[51,4],[195,4]]},"477":{"position":[[83,4],[204,4]]},"659":{"position":[[51,4],[195,4]]},"699":{"position":[[83,4],[204,4]]}},"keywords":{}}],["near",{"_index":605,"title":{},"content":{"20":{"position":[[816,5]]},"21":{"position":[[258,4]]}},"keywords":{}}],["nearli",{"_index":1861,"title":{},"content":{"127":{"position":[[822,6]]},"278":{"position":[[822,6]]},"515":{"position":[[822,6]]}},"keywords":{}}],["neat",{"_index":670,"title":{},"content":{"22":{"position":[[1453,4]]},"119":{"position":[[535,5]]},"126":{"position":[[2984,5]]},"277":{"position":[[3152,5]]},"300":{"position":[[535,5]]},"514":{"position":[[2984,5]]},"521":{"position":[[535,5]]}},"keywords":{}}],["necessari",{"_index":2951,"title":{},"content":{"270":{"position":[[497,9]]},"383":{"position":[[162,9]]},"385":{"position":[[497,9]]},"410":{"position":[[497,9]]},"598":{"position":[[2150,9]]},"600":{"position":[[1055,9]]},"625":{"position":[[162,9]]},"627":{"position":[[497,9]]},"647":{"position":[[497,9]]},"706":{"position":[[2150,9]]},"708":{"position":[[1055,9]]}},"keywords":{}}],["need",{"_index":56,"title":{},"content":{"1":{"position":[[733,5]]},"3":{"position":[[514,7],[605,4]]},"17":{"position":[[75,5],[240,4]]},"30":{"position":[[419,5]]},"39":{"position":[[284,4]]},"50":{"position":[[323,4]]},"52":{"position":[[1790,5]]},"67":{"position":[[32,5],[126,5]]},"70":{"position":[[35,4]]},"76":{"position":[[882,4]]},"88":{"position":[[44,6]]},"99":{"position":[[68,4],[120,4]]},"100":{"position":[[137,5]]},"102":{"position":[[195,5]]},"103":{"position":[[33,4]]},"107":{"position":[[433,4]]},"110":{"position":[[57,5]]},"117":{"position":[[81,4]]},"126":{"position":[[27,4],[1375,4],[1622,4],[2093,4]]},"127":{"position":[[33,4]]},"128":{"position":[[656,5]]},"134":{"position":[[95,4]]},"138":{"position":[[1222,4]]},"146":{"position":[[376,4]]},"147":{"position":[[961,4]]},"148":{"position":[[183,4]]},"151":{"position":[[12,4]]},"162":{"position":[[1596,4],[2288,4]]},"163":{"position":[[90,4],[726,4]]},"164":{"position":[[1000,4]]},"173":{"position":[[32,4]]},"178":{"position":[[1189,4]]},"185":{"position":[[2461,4]]},"195":{"position":[[262,4]]},"197":{"position":[[1019,4]]},"198":{"position":[[2021,5]]},"203":{"position":[[384,4]]},"210":{"position":[[10,4],[210,4]]},"211":{"position":[[38,4]]},"227":{"position":[[882,4]]},"234":{"position":[[35,4]]},"242":{"position":[[32,5],[127,5]]},"246":{"position":[[337,4]]},"247":{"position":[[1711,4],[1882,4]]},"248":{"position":[[264,4]]},"250":{"position":[[44,6]]},"267":{"position":[[36,4],[222,4]]},"268":{"position":[[49,4],[215,4]]},"274":{"position":[[433,4]]},"277":{"position":[[27,4],[1543,4],[1790,4],[2261,4]]},"278":{"position":[[33,4]]},"279":{"position":[[656,5]]},"291":{"position":[[68,4],[120,4]]},"292":{"position":[[137,5]]},"294":{"position":[[195,5]]},"295":{"position":[[33,4]]},"298":{"position":[[81,4]]},"305":{"position":[[57,5]]},"314":{"position":[[95,4]]},"318":{"position":[[1214,4]]},"321":{"position":[[28,4]]},"334":{"position":[[376,4]]},"335":{"position":[[969,4]]},"336":{"position":[[183,4]]},"342":{"position":[[12,4]]},"351":{"position":[[1618,4],[2310,4]]},"352":{"position":[[90,4],[748,4]]},"353":{"position":[[1035,4]]},"359":{"position":[[32,4]]},"369":{"position":[[1189,4]]},"376":{"position":[[2445,4]]},"389":{"position":[[10,4],[210,4]]},"390":{"position":[[38,4]]},"393":{"position":[[450,4]]},"394":{"position":[[42,4]]},"395":{"position":[[1381,4],[2173,4],[2430,4],[4058,4]]},"407":{"position":[[36,4],[222,4]]},"408":{"position":[[49,4],[215,4]]},"416":{"position":[[251,4],[1005,4],[1102,4],[1309,4],[2561,4],[4901,5]]},"423":{"position":[[384,4]]},"431":{"position":[[262,4]]},"433":{"position":[[1018,4]]},"434":{"position":[[2011,5]]},"440":{"position":[[4009,4]]},"441":{"position":[[52,4],[2136,4],[4452,4]]},"445":{"position":[[337,4]]},"446":{"position":[[1711,4],[1882,4]]},"447":{"position":[[264,4]]},"458":{"position":[[882,4]]},"467":{"position":[[32,5],[127,5]]},"470":{"position":[[35,4]]},"477":{"position":[[41,4]]},"488":{"position":[[44,6]]},"491":{"position":[[433,4]]},"503":{"position":[[68,4],[120,4]]},"504":{"position":[[137,5]]},"506":{"position":[[195,5]]},"507":{"position":[[33,4]]},"510":{"position":[[57,5]]},"514":{"position":[[27,4],[1375,4],[1622,4],[2093,4]]},"515":{"position":[[33,4]]},"516":{"position":[[656,5]]},"519":{"position":[[81,4]]},"531":{"position":[[95,4]]},"539":{"position":[[28,4]]},"544":{"position":[[1214,4]]},"551":{"position":[[376,4]]},"552":{"position":[[969,4]]},"553":{"position":[[183,4]]},"556":{"position":[[12,4]]},"567":{"position":[[1618,4],[2310,4]]},"568":{"position":[[90,4],[748,4]]},"569":{"position":[[1035,4]]},"575":{"position":[[32,4]]},"585":{"position":[[1189,4]]},"592":{"position":[[2445,4]]},"596":{"position":[[572,4],[1084,4]]},"605":{"position":[[270,4]]},"618":{"position":[[672,4]]},"630":{"position":[[450,4]]},"631":{"position":[[42,4]]},"632":{"position":[[1381,4],[2173,4],[2430,4],[4058,4]]},"644":{"position":[[36,4],[222,4]]},"645":{"position":[[49,4],[215,4]]},"653":{"position":[[251,4],[1005,4],[1102,4],[1309,4],[2561,4],[4901,5]]},"659":{"position":[[10,4],[210,4]]},"660":{"position":[[38,4]]},"665":{"position":[[384,4]]},"672":{"position":[[337,4]]},"673":{"position":[[1711,4],[1882,4]]},"674":{"position":[[264,4]]},"678":{"position":[[262,4]]},"680":{"position":[[1018,4]]},"681":{"position":[[2021,5]]},"687":{"position":[[4009,4]]},"688":{"position":[[52,4],[2136,4],[4452,4]]},"699":{"position":[[41,4]]},"704":{"position":[[572,4],[1084,4]]},"713":{"position":[[270,4]]},"726":{"position":[[672,4]]}},"keywords":{}}],["nest",{"_index":1477,"title":{},"content":{"79":{"position":[[1580,6]]},"185":{"position":[[2633,6]]},"203":{"position":[[534,6]]},"209":{"position":[[104,6]]},"230":{"position":[[1597,6]]},"267":{"position":[[859,6]]},"376":{"position":[[2617,6]]},"388":{"position":[[104,6]]},"407":{"position":[[859,6]]},"423":{"position":[[534,6]]},"461":{"position":[[1597,6]]},"592":{"position":[[2617,6]]},"644":{"position":[[859,6]]},"658":{"position":[[104,6]]},"665":{"position":[[534,6]]}},"keywords":{}}],["nestedmap",{"_index":3693,"title":{},"content":{"601":{"position":[[652,13],[750,13]]},"709":{"position":[[652,13],[750,13]]}},"keywords":{}}],["net",{"_index":2580,"title":{},"content":{"210":{"position":[[438,3],[1212,3]]},"212":{"position":[[367,3]]},"389":{"position":[[438,3],[1149,3]]},"391":{"position":[[367,3]]},"477":{"position":[[2494,3]]},"659":{"position":[[438,3],[1149,3]]},"661":{"position":[[367,3]]},"699":{"position":[[2494,3]]}},"keywords":{}}],["network",{"_index":596,"title":{"97":{"position":[[31,8]]},"289":{"position":[[31,8]]},"501":{"position":[[31,8]]}},"content":{"20":{"position":[[547,7],[877,7]]},"50":{"position":[[505,8]]},"52":{"position":[[113,7]]},"126":{"position":[[76,7],[802,8]]},"210":{"position":[[84,8]]},"277":{"position":[[76,7],[802,8]]},"389":{"position":[[84,8]]},"393":{"position":[[532,7]]},"395":{"position":[[3990,8],[6749,8]]},"396":{"position":[[50,7],[240,7]]},"397":{"position":[[173,8]]},"398":{"position":[[50,7]]},"417":{"position":[[1819,8]]},"418":{"position":[[62,8]]},"477":{"position":[[677,7]]},"514":{"position":[[76,7],[802,8]]},"594":{"position":[[254,8]]},"630":{"position":[[532,7]]},"632":{"position":[[3990,8],[6749,8]]},"633":{"position":[[50,7],[240,7]]},"634":{"position":[[173,8]]},"635":{"position":[[50,7]]},"654":{"position":[[1819,8]]},"655":{"position":[[62,8]]},"659":{"position":[[84,8]]},"699":{"position":[[677,7]]},"702":{"position":[[254,8]]}},"keywords":{}}],["never",{"_index":608,"title":{},"content":{"20":{"position":[[892,5]]},"178":{"position":[[903,5]]},"195":{"position":[[730,5]]},"369":{"position":[[903,5]]},"431":{"position":[[730,5]]},"585":{"position":[[903,5]]},"678":{"position":[[730,5]]}},"keywords":{}}],["new",{"_index":149,"title":{"154":{"position":[[9,3]]},"175":{"position":[[11,3]]},"339":{"position":[[9,3]]},"361":{"position":[[11,3]]},"559":{"position":[[9,3]]},"577":{"position":[[11,3]]}},"content":{"3":{"position":[[464,3],[558,3],[591,3]]},"10":{"position":[[1145,3]]},"26":{"position":[[74,3]]},"28":{"position":[[74,3]]},"31":{"position":[[1676,3]]},"36":{"position":[[74,3]]},"38":{"position":[[340,3]]},"42":{"position":[[212,3]]},"46":{"position":[[74,3]]},"48":{"position":[[74,3]]},"57":{"position":[[74,3]]},"59":{"position":[[74,3]]},"61":{"position":[[75,3]]},"63":{"position":[[75,3]]},"98":{"position":[[17,3]]},"102":{"position":[[124,3]]},"111":{"position":[[247,4]]},"117":{"position":[[31,3],[72,4],[150,3],[188,3],[638,3],[980,3],[1052,3],[1138,3],[1161,3],[1358,4],[1389,3]]},"118":{"position":[[32,3],[132,3]]},"129":{"position":[[208,3]]},"134":{"position":[[156,3]]},"154":{"position":[[61,3],[235,3]]},"173":{"position":[[378,3]]},"175":{"position":[[12,3],[52,3],[119,3]]},"194":{"position":[[167,3]]},"196":{"position":[[821,3]]},"197":{"position":[[1061,3],[1440,3]]},"205":{"position":[[156,3]]},"206":{"position":[[1117,3],[1755,3],[3361,3]]},"214":{"position":[[75,3]]},"216":{"position":[[75,3]]},"225":{"position":[[75,3]]},"245":{"position":[[149,3]]},"264":{"position":[[24,3],[136,3]]},"267":{"position":[[72,3],[284,3],[1878,3]]},"268":{"position":[[2203,3],[2817,3]]},"269":{"position":[[5027,3],[5665,3]]},"270":{"position":[[362,3]]},"280":{"position":[[208,3]]},"290":{"position":[[17,3]]},"294":{"position":[[124,3]]},"298":{"position":[[31,3],[72,4],[150,3],[188,3],[638,3],[980,3],[1052,3],[1138,3],[1161,3],[1358,4],[1389,3]]},"299":{"position":[[32,3],[132,3]]},"306":{"position":[[247,4]]},"314":{"position":[[156,3]]},"339":{"position":[[61,3],[235,3]]},"359":{"position":[[378,3]]},"361":{"position":[[12,3],[52,3],[119,3]]},"382":{"position":[[18,3]]},"385":{"position":[[362,3]]},"393":{"position":[[402,3]]},"394":{"position":[[496,3]]},"395":{"position":[[183,3],[250,3],[911,3],[1058,3],[2444,3],[2487,3]]},"404":{"position":[[24,3],[136,3]]},"407":{"position":[[72,3],[284,3],[1878,3]]},"408":{"position":[[2203,3],[2817,3]]},"409":{"position":[[5027,3],[5665,3]]},"410":{"position":[[362,3]]},"413":{"position":[[199,3]]},"414":{"position":[[26,3],[115,3]]},"415":{"position":[[166,3],[366,3]]},"416":{"position":[[80,3],[129,3],[1221,3],[1296,3],[1323,3],[1385,3],[1511,3],[1690,3]]},"417":{"position":[[463,3],[1165,3]]},"419":{"position":[[597,3],[3646,3],[3904,3],[4030,3],[4207,3],[6878,3],[7580,3]]},"425":{"position":[[156,3]]},"426":{"position":[[1112,3],[1745,3],[3336,3]]},"430":{"position":[[167,3]]},"432":{"position":[[759,3]]},"433":{"position":[[1060,3],[1439,3]]},"438":{"position":[[148,3]]},"439":{"position":[[11,3],[74,3],[98,3],[147,3]]},"440":{"position":[[1783,3],[4133,3],[4166,3]]},"441":{"position":[[282,3],[354,3],[429,3],[3849,3],[4033,3],[4388,3]]},"444":{"position":[[149,3]]},"449":{"position":[[75,3]]},"502":{"position":[[17,3]]},"506":{"position":[[124,3]]},"511":{"position":[[247,4]]},"517":{"position":[[208,3]]},"519":{"position":[[31,3],[72,4],[150,3],[188,3],[638,3],[980,3],[1052,3],[1138,3],[1161,3],[1358,4],[1389,3]]},"520":{"position":[[32,3],[132,3]]},"531":{"position":[[156,3]]},"559":{"position":[[61,3],[235,3]]},"575":{"position":[[378,3]]},"577":{"position":[[12,3],[52,3],[119,3]]},"594":{"position":[[462,4]]},"624":{"position":[[18,3]]},"627":{"position":[[362,3]]},"630":{"position":[[402,3]]},"631":{"position":[[496,3]]},"632":{"position":[[183,3],[250,3],[911,3],[1058,3],[2444,3],[2487,3]]},"641":{"position":[[24,3],[136,3]]},"644":{"position":[[72,3],[284,3],[1878,3]]},"645":{"position":[[2203,3],[2817,3]]},"646":{"position":[[5027,3],[5665,3]]},"647":{"position":[[362,3]]},"650":{"position":[[199,3]]},"651":{"position":[[26,3],[115,3]]},"652":{"position":[[166,3],[366,3]]},"653":{"position":[[80,3],[129,3],[1221,3],[1296,3],[1323,3],[1385,3],[1511,3],[1690,3]]},"654":{"position":[[463,3],[1165,3]]},"656":{"position":[[597,3],[3646,3],[3904,3],[4030,3],[4207,3],[6878,3],[7580,3]]},"667":{"position":[[156,3]]},"668":{"position":[[1117,3],[1755,3],[3361,3]]},"671":{"position":[[149,3]]},"677":{"position":[[167,3]]},"679":{"position":[[759,3]]},"680":{"position":[[1060,3],[1439,3]]},"685":{"position":[[148,3]]},"686":{"position":[[11,3],[74,3],[98,3],[147,3]]},"687":{"position":[[1783,3],[4133,3],[4166,3]]},"688":{"position":[[282,3],[354,3],[429,3],[3849,3],[4033,3],[4388,3]]},"702":{"position":[[462,4]]}},"keywords":{}}],["new_admin_rol",{"_index":2188,"title":{},"content":{"184":{"position":[[640,15]]},"185":{"position":[[1866,15]]},"375":{"position":[[559,15]]},"376":{"position":[[1850,15]]},"591":{"position":[[559,15]]},"592":{"position":[[1850,15]]}},"keywords":{}}],["new_allow",{"_index":2488,"title":{},"content":{"205":{"position":[[1855,13],[1938,15]]},"425":{"position":[[1830,13],[1913,15]]},"667":{"position":[[1830,13],[1913,15]]}},"keywords":{}}],["new_bal",{"_index":2462,"title":{},"content":{"204":{"position":[[1598,11],[1756,13]]},"424":{"position":[[1548,11],[1706,13]]},"666":{"position":[[1548,11],[1706,13]]}},"keywords":{}}],["new_own",{"_index":1728,"title":{},"content":{"115":{"position":[[1185,10]]},"196":{"position":[[310,10],[518,10]]},"197":{"position":[[243,10],[465,10],[476,10]]},"198":{"position":[[524,10],[635,9],[764,11],[863,9],[970,9]]},"247":{"position":[[1292,10]]},"258":{"position":[[1131,10]]},"432":{"position":[[272,10],[455,10]]},"433":{"position":[[243,10],[465,10],[476,10]]},"434":{"position":[[519,10],[630,9],[759,11],[853,9],[960,9]]},"446":{"position":[[1292,10]]},"481":{"position":[[1131,10]]},"673":{"position":[[1292,10]]},"679":{"position":[[272,10],[455,10]]},"680":{"position":[[243,10],[465,10],[476,10]]},"681":{"position":[[524,10],[635,9],[764,11],[863,9],[970,9]]}},"keywords":{}}],["new_rat",{"_index":1748,"title":{},"content":{"115":{"position":[[2790,9]]},"258":{"position":[[2716,9]]},"481":{"position":[[2716,9]]}},"keywords":{}}],["new_valu",{"_index":1201,"title":{},"content":{"51":{"position":[[787,9],[867,10],[1220,10]]},"53":{"position":[[871,9],[1342,9]]},"223":{"position":[[537,9]]},"456":{"position":[[537,9]]},"696":{"position":[[537,9]]}},"keywords":{}}],["newcom",{"_index":1616,"title":{},"content":{"94":{"position":[[82,10]]},"286":{"position":[[82,10]]},"498":{"position":[[82,10]]}},"keywords":{}}],["next",{"_index":22,"title":{"12":{"position":[[5,5]]},"18":{"position":[[8,6]]},"23":{"position":[[5,5]]},"26":{"position":[[7,5]]},"28":{"position":[[7,5]]},"36":{"position":[[7,5]]},"46":{"position":[[7,5]]},"48":{"position":[[7,5]]},"57":{"position":[[7,5]]},"59":{"position":[[7,5]]},"61":{"position":[[7,5]]},"63":{"position":[[7,5]]},"112":{"position":[[7,5]]},"122":{"position":[[7,5]]},"124":{"position":[[7,5]]},"139":{"position":[[7,5]]},"149":{"position":[[7,5]]},"152":{"position":[[7,5]]},"155":{"position":[[7,5]]},"158":{"position":[[7,5]]},"166":{"position":[[7,5]]},"169":{"position":[[7,5]]},"171":{"position":[[7,5]]},"176":{"position":[[7,6]]},"180":{"position":[[7,5]]},"200":{"position":[[7,5]]},"207":{"position":[[7,5]]},"214":{"position":[[7,5]]},"216":{"position":[[7,5]]},"225":{"position":[[7,5]]},"303":{"position":[[7,5]]},"307":{"position":[[7,5]]},"309":{"position":[[7,5]]},"319":{"position":[[7,5]]},"331":{"position":[[7,5]]},"337":{"position":[[7,5]]},"340":{"position":[[7,5]]},"343":{"position":[[7,5]]},"349":{"position":[[7,5]]},"355":{"position":[[7,5]]},"357":{"position":[[7,5]]},"362":{"position":[[7,6]]},"371":{"position":[[7,5]]},"418":{"position":[[7,5]]},"427":{"position":[[7,5]]},"436":{"position":[[7,5]]},"449":{"position":[[7,5]]},"512":{"position":[[7,5]]},"524":{"position":[[7,5]]},"526":{"position":[[7,5]]},"545":{"position":[[7,5]]},"548":{"position":[[7,5]]},"554":{"position":[[7,5]]},"557":{"position":[[7,5]]},"560":{"position":[[7,5]]},"565":{"position":[[7,5]]},"571":{"position":[[7,5]]},"573":{"position":[[7,5]]},"578":{"position":[[7,6]]},"587":{"position":[[7,5]]},"655":{"position":[[7,5]]},"669":{"position":[[7,5]]},"683":{"position":[[7,5]]}},"content":{"1":{"position":[[225,4]]},"9":{"position":[[473,4]]},"38":{"position":[[1114,4]]},"42":{"position":[[794,5]]},"65":{"position":[[652,4]]},"88":{"position":[[435,4]]},"122":{"position":[[7,4]]},"124":{"position":[[7,4]]},"126":{"position":[[3074,4]]},"136":{"position":[[147,4]]},"155":{"position":[[7,4]]},"158":{"position":[[9,4]]},"166":{"position":[[7,4]]},"168":{"position":[[1214,5]]},"171":{"position":[[9,4]]},"174":{"position":[[409,4]]},"180":{"position":[[7,4]]},"198":{"position":[[3345,4]]},"200":{"position":[[7,4]]},"210":{"position":[[201,5]]},"240":{"position":[[652,4]]},"250":{"position":[[435,4]]},"277":{"position":[[3242,4]]},"303":{"position":[[7,4]]},"309":{"position":[[7,4]]},"316":{"position":[[147,4]]},"331":{"position":[[9,4]]},"340":{"position":[[7,4]]},"348":{"position":[[1214,5]]},"355":{"position":[[7,4]]},"357":{"position":[[9,4]]},"360":{"position":[[409,4]]},"371":{"position":[[7,4]]},"389":{"position":[[201,5]]},"395":{"position":[[6830,4]]},"416":{"position":[[2552,5]]},"434":{"position":[[3327,4]]},"436":{"position":[[7,4]]},"465":{"position":[[652,4]]},"488":{"position":[[435,4]]},"514":{"position":[[3074,4]]},"524":{"position":[[7,4]]},"526":{"position":[[7,4]]},"533":{"position":[[147,4]]},"548":{"position":[[9,4]]},"560":{"position":[[7,4]]},"564":{"position":[[1214,5]]},"571":{"position":[[7,4]]},"573":{"position":[[9,4]]},"576":{"position":[[409,4]]},"587":{"position":[[7,4]]},"632":{"position":[[6830,4]]},"653":{"position":[[2552,5]]},"659":{"position":[[201,5]]},"681":{"position":[[3345,4]]},"683":{"position":[[7,4]]}},"keywords":{}}],["next_valu",{"_index":1435,"title":{},"content":{"78":{"position":[[323,10]]},"229":{"position":[[344,10]]},"460":{"position":[[344,10]]}},"keywords":{}}],["nft",{"_index":2287,"title":{},"content":{"188":{"position":[[337,5]]},"365":{"position":[[237,3],[694,5]]},"439":{"position":[[15,3]]},"581":{"position":[[237,3],[694,5]]},"686":{"position":[[15,3]]}},"keywords":{}}],["nftidentifiermod",{"_index":3348,"title":{},"content":{"440":{"position":[[311,18]]},"687":{"position":[[311,18]]}},"keywords":{}}],["nftidentifiermode::ordin",{"_index":3381,"title":{},"content":{"440":{"position":[[1452,27]]},"687":{"position":[[1452,27]]}},"keywords":{}}],["nftkind",{"_index":3349,"title":{},"content":{"440":{"position":[[330,8]]},"687":{"position":[[330,8]]}},"keywords":{}}],["nftkind::digit",{"_index":3380,"title":{},"content":{"440":{"position":[[1434,17]]},"687":{"position":[[1434,17]]}},"keywords":{}}],["nftmetadatakind",{"_index":3350,"title":{},"content":{"440":{"position":[[339,16]]},"687":{"position":[[339,16]]}},"keywords":{}}],["nftmetadatakind::raw",{"_index":3382,"title":{},"content":{"440":{"position":[[1480,21]]},"687":{"position":[[1480,21]]}},"keywords":{}}],["nice",{"_index":123,"title":{},"content":{"3":{"position":[[41,5]]},"12":{"position":[[158,4]]},"16":{"position":[[370,4]]},"417":{"position":[[1717,4],[1756,4]]},"654":{"position":[[1717,4],[1756,4]]}},"keywords":{}}],["nightli",{"_index":2987,"title":{},"content":{"323":{"position":[[316,7]]},"541":{"position":[[316,7]]}},"keywords":{}}],["no_main",{"_index":817,"title":{},"content":{"32":{"position":[[192,11]]}},"keywords":{}}],["no_std",{"_index":713,"title":{},"content":{"31":{"position":[[85,6]]},"32":{"position":[[204,10]]}},"keywords":{}}],["no_vot",{"_index":3256,"title":{},"content":{"416":{"position":[[3975,8],[4136,8],[4353,8]]},"419":{"position":[[5554,8],[5715,8],[5933,8]]},"653":{"position":[[3975,8],[4136,8],[4353,8]]},"656":{"position":[[5554,8],[5715,8],[5933,8]]}},"keywords":{}}],["noarg",{"_index":1395,"title":{},"content":{"73":{"position":[[504,8],[673,8]]},"143":{"position":[[239,8],[381,8],[1036,9],[1338,8]]},"148":{"position":[[99,8],[356,8],[796,6]]},"151":{"position":[[183,8],[322,8]]},"157":{"position":[[241,8],[383,8]]},"160":{"position":[[263,9],[399,8]]},"178":{"position":[[1105,8],[1362,8],[1555,8],[1613,8]]},"223":{"position":[[864,8],[1013,8]]},"237":{"position":[[504,8],[673,8]]},"268":{"position":[[936,8],[1029,7]]},"328":{"position":[[239,8],[381,8],[1011,9],[1313,8]]},"330":{"position":[[232,8],[374,8]]},"336":{"position":[[99,8],[356,8],[796,6]]},"342":{"position":[[183,8],[322,8]]},"345":{"position":[[263,9],[399,8]]},"369":{"position":[[1105,8],[1362,8],[1555,8],[1613,8]]},"408":{"position":[[936,8],[1029,7]]},"441":{"position":[[4607,8],[5023,8]]},"456":{"position":[[864,8],[1013,8]]},"473":{"position":[[504,8],[673,8]]},"537":{"position":[[239,8],[381,8],[1011,9],[1313,8]]},"547":{"position":[[241,8],[383,8]]},"553":{"position":[[99,8],[356,8],[796,6]]},"556":{"position":[[183,8],[322,8]]},"562":{"position":[[263,9],[399,8]]},"585":{"position":[[1105,8],[1362,8],[1555,8],[1613,8]]},"645":{"position":[[936,8],[1029,7]]},"688":{"position":[[4607,8],[5023,8]]},"696":{"position":[[864,8],[1013,8]]}},"keywords":{}}],["node",{"_index":1133,"title":{},"content":{"43":{"position":[[940,4]]},"52":{"position":[[583,4],[599,4],[703,4],[865,4]]},"53":{"position":[[184,4]]},"99":{"position":[[238,4]]},"100":{"position":[[332,4]]},"101":{"position":[[186,4]]},"126":{"position":[[686,4]]},"128":{"position":[[353,4],[596,4]]},"129":{"position":[[149,5]]},"210":{"position":[[380,4],[1154,4]]},"277":{"position":[[686,4],[1238,5]]},"279":{"position":[[353,4],[596,4]]},"280":{"position":[[149,5]]},"291":{"position":[[238,4]]},"292":{"position":[[332,4]]},"293":{"position":[[186,4]]},"389":{"position":[[380,4],[1091,4]]},"395":{"position":[[3862,4],[4227,4],[4342,4]]},"477":{"position":[[32,5],[694,4]]},"503":{"position":[[238,4]]},"504":{"position":[[332,4]]},"505":{"position":[[186,4]]},"514":{"position":[[686,4]]},"516":{"position":[[353,4],[596,4]]},"517":{"position":[[149,5]]},"632":{"position":[[3862,4],[4227,4],[4342,4]]},"659":{"position":[[380,4],[1091,4]]},"699":{"position":[[32,5],[694,4]]}},"keywords":{}}],["node/utils/nctl/assets/net",{"_index":3556,"title":{},"content":{"477":{"position":[[413,26]]},"699":{"position":[[413,26]]}},"keywords":{}}],["node_address",{"_index":1134,"title":{},"content":{"43":{"position":[[953,16]]},"99":{"position":[[251,14]]},"100":{"position":[[345,14]]},"101":{"position":[[199,14]]},"212":{"position":[[264,13],[772,13],[986,13]]},"291":{"position":[[251,14]]},"292":{"position":[[345,14]]},"293":{"position":[[199,14]]},"391":{"position":[[264,13],[772,13],[986,13]]},"503":{"position":[[251,14]]},"504":{"position":[[345,14]]},"505":{"position":[[199,14]]},"661":{"position":[[264,13],[772,13],[986,13]]}},"keywords":{}}],["non",{"_index":1369,"title":{"72":{"position":[[0,3]]},"236":{"position":[[0,3]]},"472":{"position":[[0,3]]}},"content":{"71":{"position":[[608,3]]},"126":{"position":[[2956,3]]},"185":{"position":[[2995,3]]},"194":{"position":[[237,3]]},"198":{"position":[[3439,3]]},"235":{"position":[[608,3]]},"277":{"position":[[3124,3]]},"376":{"position":[[2979,3]]},"430":{"position":[[237,3]]},"434":{"position":[[3421,3]]},"471":{"position":[[608,3]]},"514":{"position":[[2956,3]]},"592":{"position":[[2979,3]]},"677":{"position":[[237,3]]},"681":{"position":[[3439,3]]}},"keywords":{}}],["non_owner_cannot_change_ownership",{"_index":2393,"title":{},"content":{"198":{"position":[[891,35]]},"434":{"position":[[881,35]]},"681":{"position":[[891,35]]}},"keywords":{}}],["non_reentr",{"_index":1406,"title":{},"content":{"74":{"position":[[163,15]]},"238":{"position":[[163,15]]},"474":{"position":[[163,15]]}},"keywords":{}}],["nonc",{"_index":769,"title":{},"content":{"31":{"position":[[1550,6],[1844,6]]}},"keywords":{}}],["none",{"_index":499,"title":{},"content":{"17":{"position":[[1327,4]]},"103":{"position":[[608,5]]},"196":{"position":[[304,5],[1724,5]]},"197":{"position":[[598,4]]},"198":{"position":[[518,5]]},"204":{"position":[[798,5]]},"206":{"position":[[1002,5]]},"212":{"position":[[802,5]]},"267":{"position":[[1753,5]]},"269":{"position":[[975,5],[2105,5],[2447,5],[4912,5]]},"295":{"position":[[608,5]]},"384":{"position":[[988,5],[2125,5],[2474,5]]},"391":{"position":[[802,5]]},"407":{"position":[[1753,5]]},"409":{"position":[[975,5],[2105,5],[2447,5],[4912,5]]},"419":{"position":[[1619,6],[1860,4],[2037,4]]},"424":{"position":[[773,5]]},"426":{"position":[[997,5]]},"432":{"position":[[266,5],[1602,5]]},"433":{"position":[[598,4]]},"434":{"position":[[513,5]]},"507":{"position":[[608,5]]},"601":{"position":[[614,6],[1086,6]]},"626":{"position":[[988,5],[2125,5],[2474,5]]},"644":{"position":[[1753,5]]},"646":{"position":[[975,5],[2105,5],[2447,5],[4912,5]]},"656":{"position":[[1619,6],[1860,4],[2037,4]]},"661":{"position":[[802,5]]},"666":{"position":[[773,5]]},"668":{"position":[[1002,5]]},"679":{"position":[[266,5],[1602,5]]},"680":{"position":[[598,4]]},"681":{"position":[[518,5]]},"709":{"position":[[614,6],[1086,6]]}},"keywords":{}}],["none_list",{"_index":3308,"title":{},"content":{"419":{"position":[[2281,10]]},"656":{"position":[[2281,10]]}},"keywords":{}}],["nonreentrantcount",{"_index":1384,"title":{},"content":{"73":{"position":[[27,19],[96,19],[322,19]]},"237":{"position":[[27,19],[96,19],[322,19]]},"473":{"position":[[27,19],[96,19],[322,19]]}},"keywords":{}}],["nonreentrantcounterhostref::deploy(&test_env",{"_index":1400,"title":{},"content":{"73":{"position":[[623,49]]},"237":{"position":[[623,49]]},"473":{"position":[[623,49]]}},"keywords":{}}],["nontrivi",{"_index":247,"title":{},"content":{"8":{"position":[[430,10]]}},"keywords":{}}],["normal",{"_index":2732,"title":{},"content":{"223":{"position":[[244,6]]},"456":{"position":[[244,6]]},"696":{"position":[[244,6]]}},"keywords":{}}],["not.stat",{"_index":2695,"title":{},"content":{"218":{"position":[[104,9]]},"451":{"position":[[104,9]]},"691":{"position":[[104,9]]}},"keywords":{}}],["not_an_own",{"_index":1907,"title":{},"content":{"138":{"position":[[408,12]]},"318":{"position":[[400,12]]},"544":{"position":[[400,12]]}},"keywords":{}}],["not_payable(&self",{"_index":3781,"title":{},"content":{"608":{"position":[[306,22]]},"716":{"position":[[306,22]]}},"keywords":{}}],["notabl",{"_index":930,"title":{},"content":{"39":{"position":[[871,7]]}},"keywords":{}}],["notanmessagesend",{"_index":505,"title":{},"content":{"17":{"position":[[1599,18]]}},"keywords":{}}],["notat",{"_index":2105,"title":{},"content":{"164":{"position":[[268,8]]},"204":{"position":[[1421,8]]},"353":{"position":[[303,8]]},"424":{"position":[[1371,8]]},"569":{"position":[[303,8]]},"666":{"position":[[1371,8]]}},"keywords":{}}],["note",{"_index":884,"title":{},"content":{"38":{"position":[[816,4],[839,4]]},"79":{"position":[[1253,4]]},"91":{"position":[[892,4]]},"92":{"position":[[829,4]]},"97":{"position":[[284,4]]},"126":{"position":[[3400,4],[3453,4]]},"127":{"position":[[143,4],[686,5]]},"162":{"position":[[1524,4]]},"163":{"position":[[1431,4]]},"165":{"position":[[313,4]]},"173":{"position":[[432,4]]},"198":{"position":[[2460,4],[3305,4]]},"230":{"position":[[1270,4]]},"277":{"position":[[1168,4],[3568,4],[3621,4]]},"278":{"position":[[143,4],[686,5]]},"283":{"position":[[890,4]]},"284":{"position":[[829,4]]},"289":{"position":[[284,4]]},"321":{"position":[[260,4]]},"351":{"position":[[1546,4]]},"352":{"position":[[1453,4]]},"354":{"position":[[637,4]]},"359":{"position":[[432,4]]},"394":{"position":[[335,4]]},"395":{"position":[[4172,4],[6777,4]]},"396":{"position":[[150,4]]},"414":{"position":[[717,4]]},"434":{"position":[[2450,4],[3287,4]]},"441":{"position":[[2072,4]]},"461":{"position":[[1270,4]]},"495":{"position":[[890,4]]},"496":{"position":[[829,4]]},"501":{"position":[[284,4]]},"514":{"position":[[3400,4],[3453,4]]},"515":{"position":[[143,4],[686,5]]},"539":{"position":[[260,4]]},"567":{"position":[[1546,4]]},"568":{"position":[[1453,4]]},"570":{"position":[[637,4]]},"575":{"position":[[432,4]]},"610":{"position":[[765,4]]},"631":{"position":[[335,4]]},"632":{"position":[[4172,4],[6777,4]]},"633":{"position":[[150,4]]},"651":{"position":[[717,4]]},"681":{"position":[[2460,4],[3305,4]]},"688":{"position":[[2072,4]]},"718":{"position":[[765,4]]}},"keywords":{}}],["noth",{"_index":1220,"title":{},"content":{"51":{"position":[[1838,7]]},"91":{"position":[[697,7]]},"127":{"position":[[849,8]]},"278":{"position":[[849,8]]},"283":{"position":[[697,7]]},"321":{"position":[[16,7]]},"384":{"position":[[3820,7]]},"495":{"position":[[697,7]]},"515":{"position":[[849,8]]},"539":{"position":[[16,7]]},"626":{"position":[[3820,7]]}},"keywords":{}}],["notic",{"_index":1786,"title":{},"content":{"120":{"position":[[223,7]]},"196":{"position":[[947,6]]},"198":{"position":[[2478,8]]},"301":{"position":[[223,7]]},"416":{"position":[[876,6],[4566,6]]},"432":{"position":[[885,6]]},"434":{"position":[[2468,8]]},"522":{"position":[[223,7]]},"596":{"position":[[466,8]]},"653":{"position":[[876,6],[4566,6]]},"679":{"position":[[885,6]]},"681":{"position":[[2478,8]]},"704":{"position":[[466,8]]}},"keywords":{}}],["notown",{"_index":2363,"title":{},"content":{"197":{"position":[[701,8]]},"433":{"position":[[700,8]]},"680":{"position":[[700,8]]}},"keywords":{}}],["notowner.l11",{"_index":2369,"title":{},"content":{"197":{"position":[[1073,12]]},"433":{"position":[[1072,12]]},"680":{"position":[[1072,12]]}},"keywords":{}}],["novoteinprogress",{"_index":3294,"title":{},"content":{"419":{"position":[[455,16]]},"656":{"position":[[455,16]]}},"keywords":{}}],["now",{"_index":20,"title":{},"content":{"1":{"position":[[201,3]]},"3":{"position":[[114,3],[328,4]]},"10":{"position":[[0,3]]},"20":{"position":[[379,4]]},"23":{"position":[[131,3]]},"31":{"position":[[277,4]]},"52":{"position":[[2152,4],[3149,3]]},"100":{"position":[[265,3]]},"126":{"position":[[2484,3]]},"136":{"position":[[152,4]]},"149":{"position":[[0,3]]},"164":{"position":[[902,4]]},"175":{"position":[[474,3]]},"185":{"position":[[0,4]]},"205":{"position":[[2270,4]]},"221":{"position":[[0,4]]},"267":{"position":[[329,3],[398,3],[428,3],[2101,3],[2255,3],[2584,3],[2718,3],[2850,3],[3057,3],[4242,3]]},"268":{"position":[[1599,3],[1667,3]]},"277":{"position":[[2652,3]]},"292":{"position":[[265,3]]},"316":{"position":[[152,4]]},"337":{"position":[[0,3]]},"353":{"position":[[937,4]]},"361":{"position":[[474,3]]},"376":{"position":[[0,4]]},"394":{"position":[[523,4]]},"395":{"position":[[4359,4],[6722,3]]},"407":{"position":[[329,3],[398,3],[428,3],[2101,3],[2255,3],[2584,3],[2718,3],[2850,3],[3057,3],[4242,3]]},"408":{"position":[[1599,3],[1667,3]]},"416":{"position":[[1987,4]]},"417":{"position":[[0,4],[689,3],[898,3],[1142,3]]},"419":{"position":[[4505,4],[7104,3],[7313,3],[7557,3]]},"425":{"position":[[2220,4]]},"441":{"position":[[1006,3],[1391,3],[2109,3],[2129,3],[3459,3],[4223,3],[4445,3]]},"454":{"position":[[0,4]]},"504":{"position":[[265,3]]},"514":{"position":[[2484,3]]},"533":{"position":[[152,4]]},"554":{"position":[[0,3]]},"569":{"position":[[937,4]]},"577":{"position":[[474,3]]},"592":{"position":[[0,4]]},"618":{"position":[[24,3]]},"631":{"position":[[523,4]]},"632":{"position":[[4359,4],[6722,3]]},"644":{"position":[[329,3],[398,3],[428,3],[2101,3],[2255,3],[2584,3],[2718,3],[2850,3],[3057,3],[4242,3]]},"645":{"position":[[1599,3],[1667,3]]},"653":{"position":[[1987,4]]},"654":{"position":[[0,4],[689,3],[898,3],[1142,3]]},"656":{"position":[[4505,4],[7104,3],[7313,3],[7557,3]]},"667":{"position":[[2220,4]]},"688":{"position":[[1006,3],[1391,3],[2109,3],[2129,3],[3459,3],[4223,3],[4445,3]]},"694":{"position":[[0,4]]},"726":{"position":[[24,3]]}},"keywords":{}}],["nowfn",{"_index":2132,"title":{},"content":{"168":{"position":[[1637,5]]},"348":{"position":[[1637,5]]},"564":{"position":[[1637,5]]}},"keywords":{}}],["nth",{"_index":689,"title":{},"content":{"30":{"position":[[121,3]]}},"keywords":{}}],["null",{"_index":2994,"title":{},"content":{"323":{"position":[[403,5],[431,5],[646,5],[738,5],[873,5],[965,5],[1073,5],[1208,5],[1300,5],[1922,5],[3501,5],[3638,5]]},"324":{"position":[[680,6],[1052,6]]},"541":{"position":[[403,5],[431,5],[646,5],[738,5],[873,5],[965,5],[1073,5],[1208,5],[1300,5],[1922,5],[3501,5],[3638,5]]},"542":{"position":[[680,6],[1052,6]]}},"keywords":{}}],["num",{"_index":1431,"title":{},"content":{"78":{"position":[[216,3]]},"229":{"position":[[216,3]]},"460":{"position":[[216,3]]},"616":{"position":[[226,4]]},"724":{"position":[[226,4]]}},"keywords":{}}],["number",{"_index":232,"title":{},"content":{"8":{"position":[[116,7],[274,6],[340,6]]},"9":{"position":[[129,8]]},"30":{"position":[[135,7]]},"79":{"position":[[196,7],[1338,8]]},"83":{"position":[[132,6]]},"141":{"position":[[1193,7]]},"165":{"position":[[50,8]]},"230":{"position":[[196,7],[1355,8]]},"252":{"position":[[132,6]]},"326":{"position":[[1193,7]]},"354":{"position":[[50,8]]},"419":{"position":[[2470,6]]},"461":{"position":[[196,7],[1355,8]]},"483":{"position":[[132,6]]},"535":{"position":[[1193,7]]},"570":{"position":[[50,8]]},"611":{"position":[[934,7]]},"656":{"position":[[2470,6]]},"719":{"position":[[934,7]]}},"keywords":{}}],["numer",{"_index":2094,"title":{},"content":{"163":{"position":[[1293,7]]},"209":{"position":[[80,7],[331,7],[1465,7]]},"352":{"position":[[1315,7]]},"388":{"position":[[80,7],[331,7],[1397,7]]},"568":{"position":[[1315,7]]},"658":{"position":[[80,7],[331,7],[1397,7]]}},"keywords":{}}],["nysa",{"_index":861,"title":{"37":{"position":[[0,4]]},"39":{"position":[[0,5]]},"40":{"position":[[0,4]]}},"content":{"38":{"position":[[1182,4]]},"39":{"position":[[183,4],[345,4],[1519,4],[1652,4],[3220,4]]},"40":{"position":[[11,4],[432,4],[451,4]]},"42":{"position":[[272,4],[419,5],[457,4]]},"44":{"position":[[0,4]]}},"keywords":{}}],["nysa'",{"_index":1163,"title":{},"content":{"43":{"position":[[2000,6]]}},"keywords":{}}],["nysa/src/parser/odra/expr/mod.r",{"_index":971,"title":{},"content":{"39":{"position":[[2223,32]]}},"keywords":{}}],["nysa::builder::generate_file::<&str",{"_index":1042,"title":{},"content":{"42":{"position":[[691,43]]}},"keywords":{}}],["nysa::odraparser>(source_file_path",{"_index":1043,"title":{},"content":{"42":{"position":[[735,38]]}},"keywords":{}}],["nysadeploy",{"_index":1166,"title":{},"content":{"43":{"position":[[2033,10]]}},"keywords":{}}],["o",{"_index":1254,"title":{},"content":{"52":{"position":[[987,1]]},"66":{"position":[[225,1]]},"68":{"position":[[495,1]]},"241":{"position":[[225,1]]},"243":{"position":[[495,1]]},"466":{"position":[[225,1]]},"468":{"position":[[495,1]]}},"keywords":{}}],["object",{"_index":1524,"title":{},"content":{"84":{"position":[[140,7]]},"253":{"position":[[140,7]]},"484":{"position":[[140,7]]}},"keywords":{}}],["observ",{"_index":3590,"title":{},"content":{"477":{"position":[[3790,9]]},"699":{"position":[[3790,9]]}},"keywords":{}}],["obtain",{"_index":719,"title":{},"content":{"31":{"position":[[248,6]]},"100":{"position":[[1066,6]]},"141":{"position":[[316,6]]},"168":{"position":[[1161,9]]},"211":{"position":[[557,8]]},"292":{"position":[[1066,6]]},"326":{"position":[[316,6]]},"348":{"position":[[1161,9]]},"390":{"position":[[531,8]]},"504":{"position":[[1066,6]]},"535":{"position":[[316,6]]},"564":{"position":[[1161,9]]},"660":{"position":[[531,8]]}},"keywords":{}}],["obvious",{"_index":1784,"title":{},"content":{"119":{"position":[[921,11]]},"300":{"position":[[921,11]]},"521":{"position":[[921,11]]}},"keywords":{}}],["occur",{"_index":1380,"title":{},"content":{"72":{"position":[[315,5]]},"92":{"position":[[159,7]]},"206":{"position":[[1965,7]]},"219":{"position":[[31,6]]},"236":{"position":[[315,5]]},"269":{"position":[[5875,7]]},"284":{"position":[[159,7]]},"409":{"position":[[5875,7]]},"426":{"position":[[1955,7]]},"452":{"position":[[31,6]]},"472":{"position":[[315,5]]},"476":{"position":[[1565,5]]},"496":{"position":[[159,7]]},"617":{"position":[[950,5],[1380,6]]},"646":{"position":[[5875,7]]},"668":{"position":[[1965,7]]},"692":{"position":[[31,6]]},"698":{"position":[[1565,5]]},"725":{"position":[[950,5],[1380,6]]}},"keywords":{}}],["occurred.l31",{"_index":2411,"title":{},"content":{"198":{"position":[[2999,12]]},"434":{"position":[[2981,12]]},"681":{"position":[[2999,12]]}},"keywords":{}}],["odra",{"_index":3,"title":{"1":{"position":[[6,4]]},"14":{"position":[[23,4]]},"19":{"position":[[0,4]]},"21":{"position":[[0,4]]},"22":{"position":[[0,4]]},"25":{"position":[[0,4]]},"27":{"position":[[0,4]]},"35":{"position":[[0,4]]},"38":{"position":[[0,5]]},"40":{"position":[[7,5]]},"45":{"position":[[0,4]]},"47":{"position":[[0,4]]},"49":{"position":[[0,4]]},"56":{"position":[[0,4]]},"58":{"position":[[0,4]]},"60":{"position":[[0,4]]},"62":{"position":[[0,4]]},"84":{"position":[[0,4]]},"116":{"position":[[6,4]]},"170":{"position":[[0,4]]},"174":{"position":[[17,5]]},"175":{"position":[[15,4]]},"186":{"position":[[6,4]]},"213":{"position":[[0,4]]},"215":{"position":[[0,4]]},"224":{"position":[[0,4]]},"253":{"position":[[0,4]]},"261":{"position":[[18,5]]},"297":{"position":[[6,4]]},"321":{"position":[[0,4]]},"356":{"position":[[0,4]]},"360":{"position":[[17,5]]},"361":{"position":[[15,4]]},"363":{"position":[[6,4]]},"379":{"position":[[18,5]]},"395":{"position":[[0,4]]},"401":{"position":[[18,5]]},"448":{"position":[[0,4]]},"484":{"position":[[0,4]]},"518":{"position":[[6,4]]},"539":{"position":[[0,4]]},"572":{"position":[[0,4]]},"576":{"position":[[17,5]]},"577":{"position":[[15,4]]},"579":{"position":[[6,4]]},"593":{"position":[[0,4]]},"621":{"position":[[18,5]]},"632":{"position":[[0,4]]},"638":{"position":[[18,5]]},"701":{"position":[[0,4]]}},"content":{"1":{"position":[[145,4],[317,4],[971,4]]},"2":{"position":[[61,4],[170,4],[482,5]]},"3":{"position":[[562,4]]},"15":{"position":[[322,5],[377,4],[478,4],[571,4]]},"16":{"position":[[318,5],[466,4]]},"17":{"position":[[54,5],[1830,4]]},"18":{"position":[[345,5]]},"20":{"position":[[941,4]]},"21":{"position":[[50,4],[178,4]]},"22":{"position":[[0,4],[451,4],[1415,4],[1446,5]]},"24":{"position":[[14,4],[81,5]]},"26":{"position":[[91,5]]},"28":{"position":[[91,5]]},"36":{"position":[[91,5]]},"38":{"position":[[18,4],[282,4],[443,4],[544,4],[853,4],[972,4],[1157,4]]},"39":{"position":[[1639,4]]},"40":{"position":[[350,4],[481,5]]},"42":{"position":[[195,5],[207,4],[394,4],[1660,4],[1778,4],[1886,4],[2561,4],[2604,4]]},"43":{"position":[[820,4],[867,4],[1812,4]]},"44":{"position":[[178,4]]},"46":{"position":[[91,5]]},"48":{"position":[[91,5]]},"50":{"position":[[443,4]]},"51":{"position":[[331,4],[1653,4],[1691,5],[1703,4]]},"52":{"position":[[2337,4],[3346,4],[5007,4]]},"54":{"position":[[89,4],[468,4]]},"57":{"position":[[91,5]]},"59":{"position":[[91,5]]},"61":{"position":[[92,5]]},"63":{"position":[[92,5]]},"65":{"position":[[38,4],[187,4],[545,4]]},"66":{"position":[[42,4]]},"67":{"position":[[27,4]]},"72":{"position":[[444,4]]},"76":{"position":[[87,5],[136,4],[439,4],[589,4],[796,4],[962,5]]},"78":{"position":[[16,4]]},"79":{"position":[[3,5],[1268,4]]},"81":{"position":[[29,4],[126,4]]},"83":{"position":[[213,4]]},"84":{"position":[[0,4],[781,4]]},"88":{"position":[[193,4],[241,4]]},"90":{"position":[[145,4]]},"91":{"position":[[69,4],[139,4],[219,4]]},"92":{"position":[[10,4],[326,4],[557,4],[834,4]]},"93":{"position":[[92,4]]},"96":{"position":[[30,4],[117,4],[198,4]]},"98":{"position":[[91,4],[599,4]]},"100":{"position":[[0,4],[71,4],[165,4]]},"101":{"position":[[97,4]]},"102":{"position":[[109,4],[308,4],[551,4],[660,4]]},"104":{"position":[[12,4]]},"106":{"position":[[38,4],[81,4]]},"110":{"position":[[160,4],[270,4],[403,4]]},"112":{"position":[[32,4]]},"114":{"position":[[86,5]]},"115":{"position":[[112,7],[1924,7]]},"117":{"position":[[67,4],[145,4],[633,4],[843,4],[924,4],[975,4],[1001,7],[1036,4],[1047,4],[1156,4],[1301,4]]},"118":{"position":[[91,4]]},"119":{"position":[[87,4],[212,4],[340,4],[389,4],[939,4],[1069,4],[1148,4]]},"120":{"position":[[124,4],[350,4]]},"121":{"position":[[138,4]]},"122":{"position":[[85,4]]},"124":{"position":[[65,5]]},"126":{"position":[[43,4]]},"131":{"position":[[150,4],[194,4],[569,4],[628,4]]},"132":{"position":[[98,4],[118,4],[369,4]]},"134":{"position":[[151,4],[190,4],[208,4],[228,4]]},"136":{"position":[[30,4],[51,4]]},"139":{"position":[[48,5]]},"141":{"position":[[1331,4]]},"145":{"position":[[51,4]]},"146":{"position":[[285,5],[625,4],[679,4]]},"147":{"position":[[169,4],[386,4]]},"148":{"position":[[953,4]]},"149":{"position":[[61,4]]},"154":{"position":[[24,4]]},"155":{"position":[[80,4]]},"162":{"position":[[54,4]]},"163":{"position":[[1378,4],[1483,5]]},"164":{"position":[[1060,4],[1192,4]]},"168":{"position":[[0,4],[1966,4]]},"169":{"position":[[22,4]]},"171":{"position":[[46,4],[78,4]]},"173":{"position":[[22,5],[493,4]]},"174":{"position":[[6,4],[114,5],[255,4],[349,4]]},"175":{"position":[[47,4],[163,4],[181,4],[301,4],[436,4],[518,4]]},"178":{"position":[[453,4]]},"179":{"position":[[55,4]]},"180":{"position":[[71,5]]},"184":{"position":[[140,4]]},"187":{"position":[[0,4]]},"188":{"position":[[134,4],[528,4]]},"193":{"position":[[63,4]]},"195":{"position":[[422,4]]},"196":{"position":[[635,4]]},"198":{"position":[[1447,5]]},"201":{"position":[[63,4]]},"203":{"position":[[513,4]]},"204":{"position":[[1198,4]]},"210":{"position":[[261,4]]},"214":{"position":[[92,5]]},"216":{"position":[[92,5]]},"219":{"position":[[101,4]]},"225":{"position":[[92,5]]},"227":{"position":[[87,5],[136,4],[439,4],[589,4],[796,4],[962,5]]},"229":{"position":[[16,4]]},"230":{"position":[[3,5],[1285,4]]},"232":{"position":[[29,4],[126,4]]},"236":{"position":[[444,4]]},"240":{"position":[[38,4],[187,4],[545,4]]},"241":{"position":[[42,4]]},"242":{"position":[[27,4]]},"248":{"position":[[4,4]]},"250":{"position":[[193,4],[241,4]]},"252":{"position":[[213,4]]},"253":{"position":[[0,4],[781,4]]},"257":{"position":[[86,5]]},"258":{"position":[[112,7],[1870,7]]},"261":{"position":[[96,4],[185,4]]},"264":{"position":[[0,4],[358,4]]},"265":{"position":[[161,4],[256,4],[552,4],[596,4]]},"266":{"position":[[28,5]]},"269":{"position":[[3946,7]]},"273":{"position":[[38,4],[81,4]]},"277":{"position":[[43,4]]},"282":{"position":[[145,4]]},"283":{"position":[[69,4],[139,4],[219,4]]},"284":{"position":[[10,4],[326,4],[557,4],[834,4]]},"285":{"position":[[92,4]]},"288":{"position":[[30,4],[117,4],[198,4]]},"290":{"position":[[91,4],[599,4]]},"292":{"position":[[0,4],[71,4],[165,4]]},"293":{"position":[[97,4]]},"294":{"position":[[109,4],[308,4],[551,4],[660,4]]},"296":{"position":[[12,4]]},"298":{"position":[[67,4],[145,4],[633,4],[843,4],[924,4],[975,4],[1001,7],[1036,4],[1047,4],[1156,4],[1301,4]]},"299":{"position":[[91,4]]},"300":{"position":[[87,4],[212,4],[340,4],[389,4],[939,4],[1069,4],[1148,4]]},"301":{"position":[[124,4],[350,4]]},"302":{"position":[[138,4]]},"303":{"position":[[85,4]]},"305":{"position":[[160,4],[270,4],[403,4]]},"307":{"position":[[32,4]]},"309":{"position":[[65,5]]},"311":{"position":[[150,4],[194,4],[245,4],[621,4],[680,4]]},"312":{"position":[[98,4],[118,4],[369,4]]},"314":{"position":[[151,4],[190,4],[208,4],[228,4]]},"316":{"position":[[30,4],[51,4]]},"319":{"position":[[48,5]]},"321":{"position":[[58,4],[116,4]]},"322":{"position":[[47,4],[67,4]]},"324":{"position":[[1645,4]]},"326":{"position":[[1331,4]]},"333":{"position":[[51,4]]},"334":{"position":[[285,5],[629,4],[683,4]]},"335":{"position":[[169,4],[390,4]]},"336":{"position":[[953,4]]},"337":{"position":[[61,4]]},"339":{"position":[[24,4]]},"340":{"position":[[80,4]]},"348":{"position":[[0,4],[1966,4]]},"349":{"position":[[22,4]]},"351":{"position":[[54,4]]},"352":{"position":[[1400,4],[1505,5]]},"353":{"position":[[1095,4],[1227,4]]},"357":{"position":[[46,4],[78,4]]},"359":{"position":[[22,5],[493,4]]},"360":{"position":[[6,4],[114,5],[255,4],[349,4]]},"361":{"position":[[47,4],[163,4],[181,4],[301,4],[436,4],[518,4]]},"364":{"position":[[0,4]]},"365":{"position":[[491,4],[885,4]]},"369":{"position":[[453,4]]},"370":{"position":[[55,4]]},"371":{"position":[[71,5]]},"375":{"position":[[140,4]]},"379":{"position":[[96,4],[185,4]]},"382":{"position":[[0,4],[171,4]]},"389":{"position":[[261,4]]},"393":{"position":[[490,4]]},"394":{"position":[[599,5]]},"395":{"position":[[0,4],[2655,4],[2735,4],[2823,4],[2917,4],[3023,4]]},"398":{"position":[[91,4],[220,5]]},"401":{"position":[[96,4],[185,4]]},"404":{"position":[[0,4],[358,4]]},"405":{"position":[[161,4],[256,4],[552,4],[596,4]]},"406":{"position":[[28,5]]},"409":{"position":[[3946,7]]},"414":{"position":[[110,4],[650,4]]},"417":{"position":[[1670,4],[1686,4]]},"421":{"position":[[63,4]]},"423":{"position":[[513,4]]},"424":{"position":[[1148,4]]},"429":{"position":[[63,4]]},"431":{"position":[[422,4]]},"432":{"position":[[572,4]]},"434":{"position":[[1437,5]]},"439":{"position":[[30,4],[69,4],[142,4]]},"440":{"position":[[116,7],[4807,7]]},"441":{"position":[[457,4],[486,4],[4553,7]]},"442":{"position":[[129,4]]},"447":{"position":[[4,4]]},"449":{"position":[[92,5]]},"452":{"position":[[101,4]]},"458":{"position":[[87,5],[136,4],[439,4],[589,4],[796,4],[962,5]]},"460":{"position":[[16,4]]},"461":{"position":[[3,5],[1285,4]]},"463":{"position":[[29,4],[126,4]]},"465":{"position":[[38,4],[187,4],[545,4]]},"466":{"position":[[42,4]]},"467":{"position":[[27,4]]},"472":{"position":[[444,4]]},"477":{"position":[[301,4],[837,4],[926,4]]},"478":{"position":[[347,4]]},"480":{"position":[[86,5]]},"481":{"position":[[112,7],[1870,7]]},"483":{"position":[[213,4]]},"484":{"position":[[0,4],[781,4]]},"488":{"position":[[193,4],[241,4]]},"490":{"position":[[38,4],[81,4]]},"494":{"position":[[145,4]]},"495":{"position":[[69,4],[139,4],[219,4]]},"496":{"position":[[10,4],[326,4],[557,4],[834,4]]},"497":{"position":[[92,4]]},"500":{"position":[[30,4],[117,4],[198,4]]},"502":{"position":[[91,4],[599,4]]},"504":{"position":[[0,4],[71,4],[165,4]]},"505":{"position":[[97,4]]},"506":{"position":[[109,4],[308,4],[551,4],[660,4]]},"508":{"position":[[12,4]]},"510":{"position":[[160,4],[270,4],[403,4]]},"512":{"position":[[32,4]]},"514":{"position":[[43,4]]},"519":{"position":[[67,4],[145,4],[633,4],[843,4],[924,4],[975,4],[1001,7],[1036,4],[1047,4],[1156,4],[1301,4]]},"520":{"position":[[91,4]]},"521":{"position":[[87,4],[212,4],[340,4],[389,4],[939,4],[1069,4],[1148,4]]},"522":{"position":[[124,4],[350,4]]},"523":{"position":[[138,4]]},"524":{"position":[[85,4]]},"526":{"position":[[65,5]]},"528":{"position":[[150,4],[194,4],[245,4],[621,4],[680,4]]},"529":{"position":[[98,4],[118,4],[369,4]]},"531":{"position":[[151,4],[190,4],[208,4],[228,4]]},"533":{"position":[[30,4],[51,4]]},"535":{"position":[[1331,4]]},"539":{"position":[[58,4],[116,4]]},"540":{"position":[[47,4],[67,4]]},"542":{"position":[[1645,4]]},"545":{"position":[[48,5]]},"550":{"position":[[51,4]]},"551":{"position":[[285,5],[629,4],[683,4]]},"552":{"position":[[169,4],[390,4]]},"553":{"position":[[953,4]]},"554":{"position":[[61,4]]},"559":{"position":[[24,4]]},"560":{"position":[[80,4]]},"564":{"position":[[0,4],[1966,4]]},"565":{"position":[[22,4]]},"567":{"position":[[54,4]]},"568":{"position":[[1400,4],[1505,5]]},"569":{"position":[[1095,4],[1227,4]]},"573":{"position":[[46,4],[78,4]]},"575":{"position":[[22,5],[493,4]]},"576":{"position":[[6,4],[114,5],[255,4],[349,4]]},"577":{"position":[[47,4],[163,4],[181,4],[301,4],[436,4],[518,4]]},"580":{"position":[[0,4]]},"581":{"position":[[491,4],[885,4]]},"585":{"position":[[453,4]]},"586":{"position":[[55,4]]},"587":{"position":[[71,5]]},"591":{"position":[[140,4]]},"594":{"position":[[152,4],[345,5]]},"595":{"position":[[147,4]]},"596":{"position":[[62,5],[479,4],[562,5],[1004,4]]},"598":{"position":[[41,7],[1578,4],[1620,4],[1779,4],[1840,5]]},"599":{"position":[[279,5]]},"600":{"position":[[850,4],[913,5]]},"601":{"position":[[1934,4]]},"602":{"position":[[532,5],[1723,4]]},"603":{"position":[[178,5]]},"604":{"position":[[0,4]]},"605":{"position":[[254,5]]},"606":{"position":[[533,5]]},"608":{"position":[[624,5]]},"609":{"position":[[239,4]]},"610":{"position":[[488,5],[657,4],[898,4]]},"611":{"position":[[643,5]]},"612":{"position":[[116,4],[234,4],[408,5]]},"613":{"position":[[1719,5]]},"614":{"position":[[310,4]]},"616":{"position":[[17,7],[1260,5]]},"617":{"position":[[1013,5]]},"618":{"position":[[93,4],[204,5],[258,4],[411,4],[447,4]]},"621":{"position":[[96,4],[185,4]]},"624":{"position":[[0,4],[171,4]]},"630":{"position":[[490,4]]},"631":{"position":[[599,5]]},"632":{"position":[[0,4],[2655,4],[2735,4],[2823,4],[2917,4],[3023,4]]},"635":{"position":[[91,4],[220,5]]},"638":{"position":[[96,4],[185,4]]},"641":{"position":[[0,4],[358,4]]},"642":{"position":[[161,4],[256,4],[552,4],[596,4]]},"643":{"position":[[28,5]]},"646":{"position":[[3946,7]]},"651":{"position":[[110,4],[650,4]]},"654":{"position":[[1670,4],[1686,4]]},"659":{"position":[[261,4]]},"663":{"position":[[63,4]]},"665":{"position":[[513,4]]},"666":{"position":[[1148,4]]},"674":{"position":[[4,4]]},"676":{"position":[[63,4]]},"678":{"position":[[422,4]]},"679":{"position":[[572,4]]},"681":{"position":[[1447,5]]},"686":{"position":[[30,4],[69,4],[142,4]]},"687":{"position":[[116,7],[4807,7]]},"688":{"position":[[457,4],[486,4],[4553,7]]},"689":{"position":[[129,4]]},"692":{"position":[[101,4]]},"699":{"position":[[301,4],[837,4],[926,4]]},"700":{"position":[[347,4]]},"702":{"position":[[152,4],[345,5]]},"703":{"position":[[147,4]]},"704":{"position":[[62,5],[479,4],[562,5],[1004,4]]},"706":{"position":[[41,7],[1578,4],[1620,4],[1779,4],[1840,5]]},"707":{"position":[[279,5]]},"708":{"position":[[850,4],[913,5]]},"709":{"position":[[1934,4]]},"710":{"position":[[532,5],[1723,4]]},"711":{"position":[[178,5]]},"712":{"position":[[0,4]]},"713":{"position":[[254,5]]},"714":{"position":[[533,5]]},"716":{"position":[[624,5]]},"717":{"position":[[239,4]]},"718":{"position":[[488,5],[657,4],[898,4]]},"719":{"position":[[643,5]]},"720":{"position":[[116,4],[234,4],[408,5]]},"721":{"position":[[1719,5]]},"722":{"position":[[310,4]]},"724":{"position":[[17,7],[1260,5]]},"725":{"position":[[1013,5]]},"726":{"position":[[93,4],[204,5],[258,4],[411,4],[447,4]]}},"keywords":{}}],["odra'",{"_index":54,"title":{},"content":{"1":{"position":[[722,6]]},"22":{"position":[[321,6]]},"84":{"position":[[936,6]]},"97":{"position":[[191,6]]},"115":{"position":[[3236,7]]},"117":{"position":[[513,6]]},"119":{"position":[[125,6]]},"157":{"position":[[0,6]]},"175":{"position":[[338,6]]},"198":{"position":[[1811,6]]},"253":{"position":[[936,6]]},"258":{"position":[[3162,7]]},"289":{"position":[[191,6]]},"298":{"position":[[513,6]]},"300":{"position":[[125,6]]},"330":{"position":[[0,6]]},"361":{"position":[[338,6]]},"434":{"position":[[1801,6]]},"481":{"position":[[3162,7]]},"484":{"position":[[936,6]]},"501":{"position":[[191,6]]},"519":{"position":[[513,6]]},"521":{"position":[[125,6]]},"547":{"position":[[0,6]]},"577":{"position":[[338,6]]},"681":{"position":[[1811,6]]}},"keywords":{}}],["odra(init",{"_index":475,"title":{},"content":{"17":{"position":[[628,13],[2222,13]]},"22":{"position":[[1173,13]]},"51":{"position":[[574,13]]}},"keywords":{}}],["odra(non_reentr",{"_index":1383,"title":{},"content":{"72":{"position":[[472,22]]},"73":{"position":[[118,22]]},"74":{"position":[[234,22]]},"236":{"position":[[472,22]]},"237":{"position":[[118,22]]},"238":{"position":[[234,22]]},"472":{"position":[[472,22]]},"473":{"position":[[118,22]]},"474":{"position":[[234,22]]}},"keywords":{}}],["odra(pay",{"_index":1352,"title":{},"content":{"70":{"position":[[206,16]]},"71":{"position":[[30,16]]},"74":{"position":[[147,15],[217,16]]},"234":{"position":[[206,16]]},"235":{"position":[[30,16]]},"238":{"position":[[147,15],[217,16]]},"440":{"position":[[2215,16]]},"441":{"position":[[1054,16]]},"470":{"position":[[206,16]]},"471":{"position":[[30,16]]},"474":{"position":[[147,15],[217,16]]},"476":{"position":[[623,16]]},"608":{"position":[[252,16],[665,16]]},"614":{"position":[[436,16]]},"687":{"position":[[2215,16]]},"688":{"position":[[1054,16]]},"698":{"position":[[623,16]]},"716":{"position":[[252,16],[665,16]]},"722":{"position":[[436,16]]}},"keywords":{}}],["odra(us",{"_index":2894,"title":{},"content":{"267":{"position":[[4306,14]]},"407":{"position":[[4306,14]]},"644":{"position":[[4306,14]]}},"keywords":{}}],["odra.toml",{"_index":1101,"title":{"132":{"position":[[0,10]]},"153":{"position":[[0,9]]},"266":{"position":[[12,10]]},"312":{"position":[[0,10]]},"338":{"position":[[0,9]]},"406":{"position":[[12,10]]},"529":{"position":[[0,10]]},"558":{"position":[[0,9]]},"643":{"position":[[12,10]]}},"content":{"42":{"position":[[2778,9]]},"118":{"position":[[240,9],[288,9],[310,10]]},"136":{"position":[[238,9]]},"154":{"position":[[269,9]]},"183":{"position":[[143,9]]},"266":{"position":[[38,9]]},"299":{"position":[[240,9],[288,9],[310,10]]},"316":{"position":[[238,9]]},"339":{"position":[[269,9]]},"374":{"position":[[143,9]]},"406":{"position":[[38,9]]},"414":{"position":[[813,9]]},"520":{"position":[[240,9],[288,9],[310,10]]},"533":{"position":[[238,9]]},"559":{"position":[[269,9]]},"590":{"position":[[143,9]]},"643":{"position":[[38,9]]},"651":{"position":[[813,9]]}},"keywords":{}}],["odra/modules/src/cep78/token78.r",{"_index":3457,"title":{},"content":{"440":{"position":[[6204,33]]},"687":{"position":[[6204,33]]}},"keywords":{}}],["odra/rust",{"_index":3674,"title":{},"content":{"599":{"position":[[614,9]]},"707":{"position":[[614,9]]}},"keywords":{}}],["odra::address",{"_index":3075,"title":{},"content":{"354":{"position":[[233,14]]},"375":{"position":[[215,14]]},"383":{"position":[[319,14]]},"395":{"position":[[464,14]]},"452":{"position":[[258,14]]},"477":{"position":[[1517,14]]},"570":{"position":[[233,14]]},"591":{"position":[[215,14]]},"625":{"position":[[319,14]]},"632":{"position":[[464,14]]},"692":{"position":[[258,14]]},"699":{"position":[[1517,14]]}},"keywords":{}}],["odra::address.vari",{"_index":2819,"title":{},"content":{"267":{"position":[[402,22]]},"407":{"position":[[402,22]]},"644":{"position":[[402,22]]}},"keywords":{}}],["odra::casper_typ",{"_index":2817,"title":{},"content":{"267":{"position":[[348,18],[596,23]]},"407":{"position":[[348,18],[596,23]]},"644":{"position":[[348,18],[596,23]]}},"keywords":{}}],["odra::casper_types::bytesrepr::byt",{"_index":2830,"title":{},"content":{"267":{"position":[[743,37]]},"407":{"position":[[743,37]]},"644":{"position":[[743,37]]}},"keywords":{}}],["odra::casper_types::u256",{"_index":3122,"title":{},"content":{"395":{"position":[[373,25]]},"613":{"position":[[93,25]]},"632":{"position":[[373,25]]},"721":{"position":[[93,25]]}},"keywords":{}}],["odra::casper_types::u512.blocktim",{"_index":2828,"title":{},"content":{"267":{"position":[[682,34]]},"407":{"position":[[682,34]]},"644":{"position":[[682,34]]}},"keywords":{}}],["odra::casper_types::u512::from(100",{"_index":3069,"title":{},"content":{"346":{"position":[[308,37]]}},"keywords":{}}],["odra::casper_types::{asymmetrictyp",{"_index":3565,"title":{},"content":{"477":{"position":[[1421,36]]},"699":{"position":[[1421,36]]}},"keywords":{}}],["odra::contract_env.remov",{"_index":2821,"title":{},"content":{"267":{"position":[[443,25]]},"407":{"position":[[443,25]]},"644":{"position":[[443,25]]}},"keywords":{}}],["odra::contractcallresult",{"_index":2919,"title":{},"content":{"268":{"position":[[1933,24]]},"408":{"position":[[1933,24]]},"645":{"position":[[1933,24]]}},"keywords":{}}],["odra::contractenv::caller()th",{"_index":2130,"title":{},"content":{"168":{"position":[[1410,30]]},"348":{"position":[[1410,30]]},"564":{"position":[[1410,30]]}},"keywords":{}}],["odra::ev",{"_index":2345,"title":{},"content":{"196":{"position":[[1474,12]]},"204":{"position":[[17,12]]},"267":{"position":[[1535,12]]},"283":{"position":[[874,15]]},"321":{"position":[[2036,14],[2172,14]]},"375":{"position":[[263,14],[363,14],[463,14]]},"383":{"position":[[994,14],[1094,14]]},"384":{"position":[[3385,14],[3505,14]]},"407":{"position":[[1535,12]]},"424":{"position":[[823,14]]},"425":{"position":[[2031,14]]},"432":{"position":[[367,14],[1414,14]]},"440":{"position":[[576,14],[674,14]]},"452":{"position":[[362,14],[420,14]]},"476":{"position":[[1724,14],[1823,14]]},"495":{"position":[[874,15]]},"539":{"position":[[2036,14],[2172,14]]},"591":{"position":[[263,14],[363,14],[463,14]]},"610":{"position":[[46,14],[114,14],[539,14]]},"625":{"position":[[994,14],[1094,14]]},"626":{"position":[[3385,14],[3505,14]]},"644":{"position":[[1535,12]]},"666":{"position":[[823,14]]},"667":{"position":[[2031,14]]},"679":{"position":[[367,14],[1414,14]]},"687":{"position":[[576,14],[674,14]]},"692":{"position":[[362,14],[420,14]]},"698":{"position":[[1724,14],[1823,14]]},"718":{"position":[[46,14],[114,14],[539,14]]}},"keywords":{}}],["odra::external_contract",{"_index":1943,"title":{},"content":{"141":{"position":[[1212,26]]},"267":{"position":[[3836,26]]},"326":{"position":[[1212,26]]},"407":{"position":[[3836,26]]},"535":{"position":[[1212,26]]},"644":{"position":[[3836,26]]}},"keywords":{}}],["odra::host::deploy",{"_index":1904,"title":{},"content":{"138":{"position":[[258,21]]},"198":{"position":[[1857,20]]},"419":{"position":[[6522,21]]},"434":{"position":[[1847,20]]},"656":{"position":[[6522,21]]},"681":{"position":[[1857,20]]}},"keywords":{}}],["odra::host::deployer.instanti",{"_index":2900,"title":{},"content":{"268":{"position":[[442,32]]},"408":{"position":[[442,32]]},"645":{"position":[[442,32]]}},"keywords":{}}],["odra::host::deployer::deploy",{"_index":2403,"title":{},"content":{"198":{"position":[[1961,30]]},"268":{"position":[[527,30]]},"408":{"position":[[527,30]]},"434":{"position":[[1951,30]]},"645":{"position":[[527,30]]},"681":{"position":[[1961,30]]}},"keywords":{}}],["odra::host::noarg",{"_index":2902,"title":{},"content":{"268":{"position":[[622,18]]},"408":{"position":[[622,18]]},"645":{"position":[[622,18]]}},"keywords":{}}],["odra::host::{deploy",{"_index":1964,"title":{},"content":{"143":{"position":[[207,22]]},"148":{"position":[[76,22]]},"151":{"position":[[160,22]]},"157":{"position":[[200,22]]},"178":{"position":[[1082,22]]},"198":{"position":[[54,22]]},"223":{"position":[[841,22]]},"268":{"position":[[895,22],[1112,22]]},"328":{"position":[[207,22]]},"330":{"position":[[200,22]]},"336":{"position":[[76,22]]},"342":{"position":[[160,22]]},"369":{"position":[[1082,22]]},"395":{"position":[[403,22]]},"408":{"position":[[895,22],[1112,22]]},"434":{"position":[[54,22]]},"456":{"position":[[841,22]]},"477":{"position":[[1480,22]]},"537":{"position":[[207,22]]},"547":{"position":[[200,22]]},"553":{"position":[[76,22]]},"556":{"position":[[160,22]]},"585":{"position":[[1082,22]]},"632":{"position":[[403,22]]},"645":{"position":[[895,22],[1112,22]]},"681":{"position":[[54,22]]},"696":{"position":[[841,22]]},"699":{"position":[[1480,22]]}},"keywords":{}}],["odra::init",{"_index":2889,"title":{},"content":{"267":{"position":[[4046,13]]},"407":{"position":[[4046,13]]},"644":{"position":[[4046,13]]}},"keywords":{}}],["odra::modul",{"_index":338,"title":{},"content":{"10":{"position":[[699,15],[771,15]]},"17":{"position":[[245,13],[411,15],[597,15],[1939,15],[2193,15]]},"22":{"position":[[1074,15],[1142,15]]},"51":{"position":[[473,15],[543,15]]},"73":{"position":[[0,15],[75,15]]},"79":{"position":[[665,15],[802,15]]},"80":{"position":[[213,15]]},"84":{"position":[[198,15],[544,15]]},"104":{"position":[[127,15]]},"108":{"position":[[40,15]]},"115":{"position":[[192,15],[299,15],[1994,15],[2140,15]]},"141":{"position":[[286,15]]},"146":{"position":[[111,15],[409,15]]},"147":{"position":[[117,16],[134,15],[363,15]]},"148":{"position":[[643,16]]},"162":{"position":[[331,15],[729,15]]},"163":{"position":[[361,15]]},"164":{"position":[[154,15],[516,15]]},"178":{"position":[[125,15],[401,16],[418,15]]},"185":{"position":[[486,15]]},"196":{"position":[[49,15]]},"197":{"position":[[11,15]]},"198":{"position":[[1818,15]]},"204":{"position":[[34,15]]},"205":{"position":[[253,15]]},"209":{"position":[[801,15],[923,15],[1501,15],[1621,15]]},"221":{"position":[[497,12]]},"223":{"position":[[316,15],[423,15]]},"230":{"position":[[682,15],[819,15]]},"231":{"position":[[213,15]]},"237":{"position":[[0,15],[75,15]]},"246":{"position":[[203,15]]},"247":{"position":[[64,15]]},"253":{"position":[[198,15],[544,15]]},"258":{"position":[[182,15],[289,15],[1940,15],[2086,15]]},"269":{"position":[[522,15]]},"275":{"position":[[40,15]]},"296":{"position":[[127,15]]},"321":{"position":[[501,15],[1007,15]]},"326":{"position":[[286,15]]},"334":{"position":[[111,15],[409,15]]},"335":{"position":[[117,16],[134,15],[363,15]]},"336":{"position":[[643,16]]},"351":{"position":[[368,15],[751,15]]},"352":{"position":[[383,15]]},"353":{"position":[[189,15],[551,15]]},"369":{"position":[[125,15],[401,16],[418,15]]},"376":{"position":[[470,15]]},"383":{"position":[[606,15]]},"384":{"position":[[535,15]]},"388":{"position":[[733,15],[855,15],[1433,15],[1553,15]]},"409":{"position":[[522,15]]},"414":{"position":[[197,15]]},"416":{"position":[[369,15]]},"419":{"position":[[741,15],[1241,16],[1258,15]]},"424":{"position":[[9,15]]},"425":{"position":[[228,15]]},"432":{"position":[[11,15]]},"433":{"position":[[11,15]]},"434":{"position":[[1808,15]]},"440":{"position":[[900,15],[1114,15]]},"441":{"position":[[843,15],[2346,15],[2424,15]]},"445":{"position":[[203,15]]},"446":{"position":[[64,15]]},"454":{"position":[[497,12]]},"456":{"position":[[316,15],[423,15]]},"461":{"position":[[682,15],[819,15]]},"462":{"position":[[213,15]]},"473":{"position":[[0,15],[75,15]]},"476":{"position":[[399,15]]},"481":{"position":[[182,15],[289,15],[1940,15],[2086,15]]},"484":{"position":[[198,15],[544,15]]},"492":{"position":[[40,15]]},"508":{"position":[[127,15]]},"535":{"position":[[286,15]]},"539":{"position":[[501,15],[1007,15]]},"551":{"position":[[111,15],[409,15]]},"552":{"position":[[117,16],[134,15],[363,15]]},"553":{"position":[[643,16]]},"567":{"position":[[368,15],[751,15]]},"568":{"position":[[383,15]]},"569":{"position":[[189,15],[551,15]]},"585":{"position":[[125,15],[401,16],[418,15]]},"592":{"position":[[470,15]]},"596":{"position":[[205,15],[273,15],[651,12]]},"598":{"position":[[150,15],[644,15]]},"599":{"position":[[78,15],[116,15]]},"600":{"position":[[62,15],[154,15]]},"601":{"position":[[63,15],[161,15],[625,15],[729,15],[1140,15],[1290,15]]},"602":{"position":[[159,15],[222,15],[1045,15],[1258,15]]},"605":{"position":[[28,15],[89,15]]},"606":{"position":[[28,15],[120,15]]},"607":{"position":[[150,17]]},"608":{"position":[[87,15],[153,15]]},"610":{"position":[[154,15],[184,15]]},"611":{"position":[[158,15],[192,15]]},"612":{"position":[[462,15],[492,15],[584,15],[639,15],[731,15],[786,15],[878,15],[956,15],[1035,15],[1113,15],[1192,15],[1271,15]]},"613":{"position":[[314,15],[347,15],[838,15],[908,15]]},"616":{"position":[[112,15],[153,15],[507,15],[585,15]]},"617":{"position":[[68,15],[143,15],[608,15],[650,15]]},"625":{"position":[[606,15]]},"626":{"position":[[535,15]]},"646":{"position":[[522,15]]},"651":{"position":[[197,15]]},"653":{"position":[[369,15]]},"656":{"position":[[741,15],[1241,16],[1258,15]]},"658":{"position":[[733,15],[855,15],[1433,15],[1553,15]]},"666":{"position":[[9,15]]},"667":{"position":[[228,15]]},"672":{"position":[[203,15]]},"673":{"position":[[64,15]]},"679":{"position":[[11,15]]},"680":{"position":[[11,15]]},"681":{"position":[[1818,15]]},"687":{"position":[[900,15],[1114,15]]},"688":{"position":[[843,15],[2346,15],[2424,15]]},"694":{"position":[[497,12]]},"696":{"position":[[316,15],[423,15]]},"698":{"position":[[399,15]]},"704":{"position":[[205,15],[273,15],[651,12]]},"706":{"position":[[150,15],[644,15]]},"707":{"position":[[78,15],[116,15]]},"708":{"position":[[62,15],[154,15]]},"709":{"position":[[63,15],[161,15],[625,15],[729,15],[1140,15],[1290,15]]},"710":{"position":[[159,15],[222,15],[1045,15],[1258,15]]},"713":{"position":[[28,15],[89,15]]},"714":{"position":[[28,15],[120,15]]},"715":{"position":[[150,17]]},"716":{"position":[[87,15],[153,15]]},"718":{"position":[[154,15],[184,15]]},"719":{"position":[[158,15],[192,15]]},"720":{"position":[[462,15],[492,15],[584,15],[639,15],[731,15],[786,15],[878,15],[956,15],[1035,15],[1113,15],[1192,15],[1271,15]]},"721":{"position":[[314,15],[347,15],[838,15],[908,15]]},"724":{"position":[[112,15],[153,15],[507,15],[585,15]]},"725":{"position":[[68,15],[143,15],[608,15],[650,15]]}},"keywords":{}}],["odra::module(error",{"_index":3480,"title":{},"content":{"441":{"position":[[738,21]]},"476":{"position":[[185,21]]},"688":{"position":[[738,21]]},"698":{"position":[[185,21]]}},"keywords":{}}],["odra::module(ev",{"_index":1587,"title":{},"content":{"91":{"position":[[947,21]]},"185":{"position":[[303,21]]},"195":{"position":[[59,21],[311,21]]},"203":{"position":[[86,21]]},"220":{"position":[[144,21]]},"267":{"position":[[887,21],[1033,21],[3299,21]]},"269":{"position":[[254,21]]},"283":{"position":[[945,21]]},"376":{"position":[[287,21]]},"383":{"position":[[644,21]]},"384":{"position":[[251,21]]},"407":{"position":[[887,21],[1033,21],[3299,21]]},"409":{"position":[[254,21]]},"423":{"position":[[86,21]]},"431":{"position":[[59,21],[311,21]]},"453":{"position":[[144,21]]},"495":{"position":[[945,21]]},"592":{"position":[[287,21]]},"625":{"position":[[644,21]]},"626":{"position":[[251,21]]},"644":{"position":[[887,21],[1033,21],[3299,21]]},"646":{"position":[[254,21]]},"665":{"position":[[86,21]]},"678":{"position":[[59,21],[311,21]]},"693":{"position":[[144,21]]}},"keywords":{}}],["odra::module::submodul",{"_index":2755,"title":{},"content":{"246":{"position":[[178,24]]},"445":{"position":[[178,24]]},"672":{"position":[[178,24]]}},"keywords":{}}],["odra::module].l3",{"_index":3324,"title":{},"content":{"432":{"position":[[592,18]]},"679":{"position":[[592,18]]}},"keywords":{}}],["odra::module].l9",{"_index":2331,"title":{},"content":{"196":{"position":[[655,18]]}},"keywords":{}}],["odra::module]impl",{"_index":1934,"title":{},"content":{"141":{"position":[[577,21]]},"326":{"position":[[577,21]]},"535":{"position":[[577,21]]}},"keywords":{}}],["odra::odra_error",{"_index":2979,"title":{},"content":{"321":{"position":[[1842,19]]},"375":{"position":[[881,19]]},"383":{"position":[[525,19],[740,19]]},"384":{"position":[[3621,19]]},"419":{"position":[[322,19]]},"425":{"position":[[2128,19]]},"432":{"position":[[297,19],[901,19]]},"433":{"position":[[663,19]]},"440":{"position":[[754,19]]},"441":{"position":[[672,19],[2260,19]]},"452":{"position":[[273,19]]},"476":{"position":[[1602,19]]},"539":{"position":[[1842,19]]},"591":{"position":[[881,19]]},"611":{"position":[[65,19],[873,19]]},"613":{"position":[[454,19]]},"625":{"position":[[525,19],[740,19]]},"626":{"position":[[3621,19]]},"656":{"position":[[322,19]]},"667":{"position":[[2128,19]]},"679":{"position":[[297,19],[901,19]]},"680":{"position":[[663,19]]},"687":{"position":[[754,19]]},"688":{"position":[[672,19],[2260,19]]},"692":{"position":[[273,19]]},"698":{"position":[[1602,19]]},"719":{"position":[[65,19],[873,19]]},"721":{"position":[[454,19]]}},"keywords":{}}],["odra::odra_typ",{"_index":2749,"title":{},"content":{"230":{"position":[[254,18]]},"321":{"position":[[1700,18]]},"354":{"position":[[160,18],[248,18],[705,18]]},"383":{"position":[[274,18],[334,18]]},"388":{"position":[[514,18],[618,18]]},"416":{"position":[[794,18]]},"419":{"position":[[206,18]]},"440":{"position":[[414,18],[476,18]]},"461":{"position":[[254,18]]},"539":{"position":[[1700,18]]},"570":{"position":[[160,18],[248,18],[705,18]]},"602":{"position":[[42,18],[573,18],[975,18],[1908,18]]},"625":{"position":[[274,18],[334,18]]},"653":{"position":[[794,18]]},"656":{"position":[[206,18]]},"658":{"position":[[514,18],[618,18]]},"687":{"position":[[414,18],[476,18]]},"710":{"position":[[42,18],[573,18],[975,18],[1908,18]]}},"keywords":{}}],["odra::odraerror",{"_index":2197,"title":{},"content":{"184":{"position":[[966,16]]},"205":{"position":[[236,16]]},"267":{"position":[[1276,16]]},"269":{"position":[[3639,16]]},"407":{"position":[[1276,16]]},"409":{"position":[[3639,16]]},"644":{"position":[[1276,16]]},"646":{"position":[[3639,16]]}},"keywords":{}}],["odra::odratyp",{"_index":1441,"title":{},"content":{"79":{"position":[[251,15]]}},"keywords":{}}],["odra::prelud",{"_index":1449,"title":{},"content":{"79":{"position":[[611,17]]},"80":{"position":[[168,17]]},"138":{"position":[[284,17]]},"184":{"position":[[193,17]]},"185":{"position":[[165,17]]},"195":{"position":[[15,17]]},"203":{"position":[[13,17]]},"219":{"position":[[236,17]]},"230":{"position":[[628,17]]},"231":{"position":[[168,17]]},"246":{"position":[[156,17]]},"267":{"position":[[804,16],[1513,17]]},"269":{"position":[[181,17],[3285,17]]},"321":{"position":[[457,17]]},"351":{"position":[[335,17]]},"352":{"position":[[339,17]]},"375":{"position":[[193,17]]},"376":{"position":[[165,17]]},"383":{"position":[[1035,17]]},"384":{"position":[[178,17],[3326,17]]},"407":{"position":[[804,16],[1513,17]]},"409":{"position":[[181,17],[3285,17]]},"423":{"position":[[13,17]]},"431":{"position":[[15,17]]},"445":{"position":[[156,17]]},"452":{"position":[[236,17]]},"461":{"position":[[628,17]]},"462":{"position":[[168,17]]},"476":{"position":[[112,17]]},"539":{"position":[[457,17]]},"567":{"position":[[335,17]]},"568":{"position":[[339,17]]},"591":{"position":[[193,17]]},"592":{"position":[[165,17]]},"625":{"position":[[1035,17]]},"626":{"position":[[178,17],[3326,17]]},"644":{"position":[[804,16],[1513,17]]},"646":{"position":[[181,17],[3285,17]]},"665":{"position":[[13,17]]},"672":{"position":[[156,17]]},"678":{"position":[[15,17]]},"692":{"position":[[236,17]]},"698":{"position":[[112,17]]}},"keywords":{}}],["odra::submodul",{"_index":2733,"title":{},"content":{"223":{"position":[[295,16]]},"456":{"position":[[295,16]]},"696":{"position":[[295,16]]}},"keywords":{}}],["odra::submodule<t>",{"_index":2879,"title":{},"content":{"267":{"position":[[3262,26]]},"407":{"position":[[3262,26]]},"644":{"position":[[3262,26]]}},"keywords":{}}],["odra::test_env",{"_index":2909,"title":{},"content":{"268":{"position":[[1424,14],[1472,14]]},"408":{"position":[[1424,14],[1472,14]]},"645":{"position":[[1424,14],[1472,14]]}},"keywords":{}}],["odra::test_env::get_account(1",{"_index":1085,"title":{},"content":{"42":{"position":[[2113,31]]}},"keywords":{}}],["odra::types::address",{"_index":1208,"title":{},"content":{"51":{"position":[[1125,21]]}},"keywords":{}}],["odra::types::casper_typ",{"_index":2825,"title":{},"content":{"267":{"position":[[563,29]]},"407":{"position":[[563,29]]},"644":{"position":[[563,29]]}},"keywords":{}}],["odra::types::event::odraevent.remov",{"_index":2822,"title":{},"content":{"267":{"position":[[469,36]]},"407":{"position":[[469,36]]},"644":{"position":[[469,36]]}},"keywords":{}}],["odra::types::odratyp",{"_index":2823,"title":{},"content":{"267":{"position":[[506,21]]},"407":{"position":[[506,21]]},"644":{"position":[[506,21]]}},"keywords":{}}],["odra::unwraporrevert",{"_index":2459,"title":{},"content":{"204":{"position":[[1502,21]]},"424":{"position":[[1452,21]]},"666":{"position":[[1452,21]]}},"keywords":{}}],["odra::var",{"_index":1986,"title":{},"content":{"145":{"position":[[15,10]]},"162":{"position":[[718,10]]},"178":{"position":[[15,10]]},"220":{"position":[[129,10]]},"333":{"position":[[15,10]]},"351":{"position":[[357,10]]},"369":{"position":[[15,10]]},"441":{"position":[[2245,10]]},"453":{"position":[[129,10]]},"550":{"position":[[15,10]]},"567":{"position":[[357,10]]},"585":{"position":[[15,10]]},"605":{"position":[[17,10]]},"606":{"position":[[17,10]]},"688":{"position":[[2245,10]]},"693":{"position":[[129,10]]},"713":{"position":[[17,10]]},"714":{"position":[[17,10]]}},"keywords":{}}],["odra::vari",{"_index":665,"title":{},"content":{"22":{"position":[[1058,15]]}},"keywords":{}}],["odra::{address",{"_index":1480,"title":{},"content":{"80":{"position":[[108,15]]},"143":{"position":[[994,15]]},"165":{"position":[[182,15]]},"184":{"position":[[215,15]]},"195":{"position":[[37,15]]},"203":{"position":[[35,15]]},"219":{"position":[[258,15]]},"231":{"position":[[108,15]]},"247":{"position":[[23,15]]},"321":{"position":[[479,15]]},"328":{"position":[[969,15]]},"376":{"position":[[187,15]]},"383":{"position":[[1057,15]]},"423":{"position":[[35,15]]},"431":{"position":[[37,15]]},"446":{"position":[[23,15]]},"462":{"position":[[108,15]]},"537":{"position":[[969,15]]},"539":{"position":[[479,15]]},"592":{"position":[[187,15]]},"625":{"position":[[1057,15]]},"665":{"position":[[35,15]]},"673":{"position":[[23,15]]},"678":{"position":[[37,15]]}},"keywords":{}}],["odra::{casper_types::u256",{"_index":1447,"title":{},"content":{"79":{"position":[[554,26]]},"206":{"position":[[56,26]]},"209":{"position":[[395,26]]},"230":{"position":[[571,26]]},"269":{"position":[[203,26],[3307,26]]},"384":{"position":[[200,26],[3348,26]]},"388":{"position":[[395,26]]},"409":{"position":[[203,26],[3307,26]]},"419":{"position":[[67,26]]},"426":{"position":[[56,26]]},"461":{"position":[[571,26]]},"600":{"position":[[17,26]]},"601":{"position":[[17,26]]},"613":{"position":[[17,26]]},"626":{"position":[[200,26],[3348,26]]},"646":{"position":[[203,26],[3307,26]]},"656":{"position":[[67,26]]},"658":{"position":[[395,26]]},"668":{"position":[[56,26]]},"708":{"position":[[17,26]]},"709":{"position":[[17,26]]},"721":{"position":[[17,26]]}},"keywords":{}}],["odra::{casper_types::u512",{"_index":2037,"title":{},"content":{"160":{"position":[[210,26]]},"345":{"position":[[210,26]]},"441":{"position":[[602,26]]},"476":{"position":[[134,26]]},"562":{"position":[[210,26]]},"608":{"position":[[17,26]]},"688":{"position":[[602,26]]},"698":{"position":[[134,26]]},"716":{"position":[[17,26]]}},"keywords":{}}],["odra::{casper_types::{account::accounthash",{"_index":3667,"title":{},"content":{"599":{"position":[[17,43]]},"707":{"position":[[17,43]]}},"keywords":{}}],["odra::{ev",{"_index":2323,"title":{},"content":{"196":{"position":[[19,13]]}},"keywords":{}}],["odra::{host::deploy",{"_index":2961,"title":{},"content":{"318":{"position":[[258,22]]},"544":{"position":[[258,22]]}},"keywords":{}}],["odra::{host::{deploy",{"_index":1394,"title":{},"content":{"73":{"position":[[480,23]]},"168":{"position":[[441,23]]},"237":{"position":[[480,23]]},"348":{"position":[[441,23]]},"473":{"position":[[480,23]]},"564":{"position":[[441,23]]}},"keywords":{}}],["odra::{list",{"_index":2097,"title":{},"content":{"163":{"position":[[1584,12]]},"352":{"position":[[1606,12]]},"568":{"position":[[1606,12]]}},"keywords":{}}],["odra::{map",{"_index":408,"title":{},"content":{"15":{"position":[[263,15]]},"163":{"position":[[339,15]]},"352":{"position":[[361,15]]},"568":{"position":[[361,15]]}},"keywords":{}}],["odra::{module::modul",{"_index":2209,"title":{},"content":{"185":{"position":[[187,22]]},"617":{"position":[[17,22]]},"725":{"position":[[17,22]]}},"keywords":{}}],["odra::{prelud",{"_index":3074,"title":{},"content":{"353":{"position":[[158,18]]},"569":{"position":[[158,18]]},"596":{"position":[[180,18]]},"601":{"position":[[1115,18]]},"602":{"position":[[17,18],[949,18]]},"610":{"position":[[17,18]]},"611":{"position":[[17,18]]},"612":{"position":[[431,18]]},"704":{"position":[[180,18]]},"709":{"position":[[1115,18]]},"710":{"position":[[17,18],[949,18]]},"718":{"position":[[17,18]]},"719":{"position":[[17,18]]},"720":{"position":[[431,18]]}},"keywords":{}}],["odra::{test_env",{"_index":1084,"title":{},"content":{"42":{"position":[[2026,16]]}},"keywords":{}}],["odra::{types::{address",{"_index":1193,"title":{},"content":{"51":{"position":[[365,23]]}},"keywords":{}}],["odra::{vari",{"_index":462,"title":{},"content":{"17":{"position":[[337,16],[1859,16]]}},"keywords":{}}],["odra:external_contract",{"_index":1940,"title":{},"content":{"141":{"position":[[918,25]]},"326":{"position":[[918,25]]},"535":{"position":[[918,25]]}},"keywords":{}}],["odra_backend=casp",{"_index":1345,"title":{},"content":{"67":{"position":[[144,19]]},"68":{"position":[[519,19]]},"242":{"position":[[145,19]]},"243":{"position":[[519,19]]},"467":{"position":[[145,19]]},"468":{"position":[[519,19]]}},"keywords":{}}],["odra_casper_livenet_chain_name=casp",{"_index":3168,"title":{},"content":{"395":{"position":[[3999,37]]},"477":{"position":[[2456,37]]},"632":{"position":[[3999,37]]},"699":{"position":[[2456,37]]}},"keywords":{}}],["odra_casper_livenet_chain_name=integr",{"_index":1803,"title":{},"content":{"126":{"position":[[846,42]]},"277":{"position":[[846,42]]},"514":{"position":[[846,42]]}},"keywords":{}}],["odra_casper_livenet_env",{"_index":1870,"title":{},"content":{"129":{"position":[[309,23]]},"280":{"position":[[309,23]]},"517":{"position":[[309,23]]}},"keywords":{}}],["odra_casper_livenet_env::env",{"_index":1809,"title":{},"content":{"126":{"position":[[1424,31]]},"277":{"position":[[1592,31]]},"346":{"position":[[124,31]]},"395":{"position":[[598,31]]},"477":{"position":[[1723,31]]},"514":{"position":[[1424,31]]},"632":{"position":[[598,31]]},"699":{"position":[[1723,31]]}},"keywords":{}}],["odra_casper_livenet_env=integr",{"_index":1874,"title":{},"content":{"129":{"position":[[548,35]]},"280":{"position":[[548,35]]},"517":{"position":[[548,35]]}},"keywords":{}}],["odra_casper_livenet_key_1=.keys/secret_key_1.pem",{"_index":1805,"title":{},"content":{"126":{"position":[[988,48]]},"277":{"position":[[988,48]]},"514":{"position":[[988,48]]}},"keywords":{}}],["odra_casper_livenet_key_2=.keys/secret_key_2.pem",{"_index":1806,"title":{},"content":{"126":{"position":[[1037,48]]},"277":{"position":[[1037,48]]},"514":{"position":[[1037,48]]}},"keywords":{}}],["odra_casper_livenet_node_address=http://138.201.80.141:7777",{"_index":3167,"title":{},"content":{"395":{"position":[[3910,59]]},"632":{"position":[[3910,59]]}},"keywords":{}}],["odra_casper_livenet_node_address=http://localhost:11101",{"_index":3580,"title":{},"content":{"477":{"position":[[2398,55]]},"699":{"position":[[2398,55]]}},"keywords":{}}],["odra_casper_livenet_node_address=localhost:7777",{"_index":1801,"title":{},"content":{"126":{"position":[[734,47]]},"277":{"position":[[734,47]]},"514":{"position":[[734,47]]}},"keywords":{}}],["odra_casper_livenet_secret_key_path=.keys/secret_key.pem",{"_index":1799,"title":{},"content":{"126":{"position":[[608,56]]},"277":{"position":[[608,56]]},"514":{"position":[[608,56]]}},"keywords":{}}],["odra_casper_livenet_secret_key_path=.nod",{"_index":3579,"title":{},"content":{"477":{"position":[[2334,41]]},"699":{"position":[[2334,41]]}},"keywords":{}}],["odra_casper_livenet_secret_key_path=folder_with_your_secret_key/secret_key_file.pem",{"_index":3166,"title":{},"content":{"395":{"position":[[3757,83]]},"632":{"position":[[3757,83]]}},"keywords":{}}],["odra_cfg_package_hash_key_nam",{"_index":1640,"title":{},"content":{"98":{"position":[[131,30],[319,30]]},"290":{"position":[[131,30],[319,30]]},"502":{"position":[[131,30],[319,30]]}},"keywords":{}}],["odra_error",{"_index":2963,"title":{},"content":{"321":{"position":[[155,10]]},"539":{"position":[[155,10]]}},"keywords":{}}],["odra_examples::contracts::tlw::timelockwallet",{"_index":3564,"title":{},"content":{"477":{"position":[[1320,47]]},"699":{"position":[[1320,47]]}},"keywords":{}}],["odra_examples::contracts::tlw::{timelockwallethostref",{"_index":3567,"title":{},"content":{"477":{"position":[[1536,54]]},"699":{"position":[[1536,54]]}},"keywords":{}}],["odra_modul",{"_index":1328,"title":{},"content":{"65":{"position":[[222,11]]},"240":{"position":[[222,11]]},"465":{"position":[[222,11]]}},"keywords":{}}],["odra_module=my_contract",{"_index":1324,"title":{},"content":{"65":{"position":[[71,23]]},"68":{"position":[[219,23]]},"240":{"position":[[71,23]]},"243":{"position":[[219,23]]},"465":{"position":[[71,23]]},"468":{"position":[[219,23]]}},"keywords":{}}],["odra_modules::access::own",{"_index":3345,"title":{},"content":{"440":{"position":[[220,30]]},"687":{"position":[[220,30]]}},"keywords":{}}],["odra_modules::cep18_token::cep18",{"_index":3291,"title":{},"content":{"419":{"position":[[142,33]]},"656":{"position":[[142,33]]}},"keywords":{}}],["odra_modules::cep78",{"_index":3346,"title":{},"content":{"440":{"position":[[255,22]]},"687":{"position":[[255,22]]}},"keywords":{}}],["odra_test::env",{"_index":1399,"title":{},"content":{"73":{"position":[[586,17]]},"138":{"position":[[349,17]]},"143":{"position":[[295,17],[1085,17]]},"148":{"position":[[142,17]]},"151":{"position":[[235,17]]},"157":{"position":[[300,17]]},"160":{"position":[[316,17]]},"168":{"position":[[531,17],[1196,17]]},"178":{"position":[[1148,17],[1484,17]]},"198":{"position":[[169,17],[1702,17]]},"206":{"position":[[321,17]]},"223":{"position":[[930,17]]},"237":{"position":[[586,17]]},"268":{"position":[[493,17],[964,17],[1164,17],[1491,16],[3025,17]]},"269":{"position":[[4225,17]]},"318":{"position":[[341,17]]},"328":{"position":[[295,17],[1060,17]]},"330":{"position":[[291,17]]},"336":{"position":[[142,17]]},"342":{"position":[[235,17]]},"345":{"position":[[316,17]]},"346":{"position":[[168,17]]},"348":{"position":[[531,17],[1196,17]]},"369":{"position":[[1148,17],[1484,17]]},"408":{"position":[[493,17],[964,17],[1164,17],[1491,16],[3025,17]]},"409":{"position":[[4225,17]]},"417":{"position":[[163,17]]},"419":{"position":[[6578,17]]},"426":{"position":[[321,17]]},"434":{"position":[[169,17],[1692,17]]},"440":{"position":[[4969,17]]},"441":{"position":[[4794,17]]},"456":{"position":[[930,17]]},"473":{"position":[[586,17]]},"537":{"position":[[295,17],[1060,17]]},"544":{"position":[[341,17]]},"547":{"position":[[300,17]]},"553":{"position":[[142,17]]},"556":{"position":[[235,17]]},"562":{"position":[[316,17]]},"564":{"position":[[531,17],[1196,17]]},"585":{"position":[[1148,17],[1484,17]]},"645":{"position":[[493,17],[964,17],[1164,17],[1491,16],[3025,17]]},"646":{"position":[[4225,17]]},"654":{"position":[[163,17]]},"656":{"position":[[6578,17]]},"668":{"position":[[321,17]]},"681":{"position":[[169,17],[1702,17]]},"687":{"position":[[4969,17]]},"688":{"position":[[4794,17]]},"696":{"position":[[930,17]]}},"keywords":{}}],["odra_test::env().th",{"_index":2910,"title":{},"content":{"268":{"position":[[1444,20]]},"408":{"position":[[1444,20]]},"645":{"position":[[1444,20]]}},"keywords":{}}],["odra_typ",{"_index":2964,"title":{},"content":{"321":{"position":[[170,10]]},"354":{"position":[[351,12]]},"539":{"position":[[170,10]]},"570":{"position":[[351,12]]}},"keywords":{}}],["odraerror",{"_index":1924,"title":{},"content":{"138":{"position":[[1208,10],[1258,9]]},"196":{"position":[[33,11],[963,9]]},"198":{"position":[[3964,9]]},"219":{"position":[[281,11]]},"267":{"position":[[1238,9]]},"318":{"position":[[1200,10],[1250,9]]},"407":{"position":[[1238,9]]},"434":{"position":[[3946,9]]},"544":{"position":[[1200,10],[1250,9]]},"644":{"position":[[1238,9]]},"681":{"position":[[3964,9]]}},"keywords":{}}],["odraerror>",{"_index":2422,"title":{},"content":{"198":{"position":[[3732,14]]},"434":{"position":[[3714,14]]},"681":{"position":[[3732,14]]}},"keywords":{}}],["odraevent>(ev",{"_index":2868,"title":{},"content":{"267":{"position":[[2823,20]]},"407":{"position":[[2823,20]]},"644":{"position":[[2823,20]]}},"keywords":{}}],["odraevent>::emit(init",{"_index":1198,"title":{},"content":{"51":{"position":[[664,24]]}},"keywords":{}}],["odrapars",{"_index":1020,"title":{},"content":{"40":{"position":[[277,11]]}},"keywords":{}}],["odraresult",{"_index":2420,"title":{},"content":{"198":{"position":[[3694,10]]},"268":{"position":[[2260,10]]},"408":{"position":[[2260,10]]},"434":{"position":[[3676,10]]},"441":{"position":[[4616,11]]},"645":{"position":[[2260,10]]},"681":{"position":[[3694,10]]},"688":{"position":[[4616,11]]}},"keywords":{}}],["odraresult<()>",{"_index":3534,"title":{},"content":{"441":{"position":[[5799,20]]},"688":{"position":[[5799,20]]}},"keywords":{}}],["odraresult.ownedcontracthostref",{"_index":1918,"title":{},"content":{"138":{"position":[[875,31]]},"318":{"position":[[867,31]]},"544":{"position":[[867,31]]}},"keywords":{}}],["odrasolid",{"_index":3613,"title":{},"content":{"596":{"position":[[163,12]]},"598":{"position":[[0,12]]},"599":{"position":[[0,12]]},"600":{"position":[[0,12]]},"601":{"position":[[0,12],[1098,12]]},"602":{"position":[[0,12],[932,12]]},"605":{"position":[[0,12]]},"606":{"position":[[0,12]]},"607":{"position":[[124,12]]},"608":{"position":[[0,12]]},"610":{"position":[[0,12]]},"611":{"position":[[0,12]]},"612":{"position":[[414,12]]},"613":{"position":[[0,12]]},"616":{"position":[[0,12]]},"617":{"position":[[0,12]]},"704":{"position":[[163,12]]},"706":{"position":[[0,12]]},"707":{"position":[[0,12]]},"708":{"position":[[0,12]]},"709":{"position":[[0,12],[1098,12]]},"710":{"position":[[0,12],[932,12]]},"713":{"position":[[0,12]]},"714":{"position":[[0,12]]},"715":{"position":[[124,12]]},"716":{"position":[[0,12]]},"718":{"position":[[0,12]]},"719":{"position":[[0,12]]},"720":{"position":[[414,12]]},"721":{"position":[[0,12]]},"724":{"position":[[0,12]]},"725":{"position":[[0,12]]}},"keywords":{}}],["odratyp",{"_index":1432,"title":{},"content":{"78":{"position":[[228,8]]},"165":{"position":[[168,9],[198,10],[355,9]]},"209":{"position":[[443,9]]}},"keywords":{}}],["odravm",{"_index":1693,"title":{"105":{"position":[[0,6]]},"272":{"position":[[0,6]]},"489":{"position":[[0,6]]}},"content":{"104":{"position":[[68,6]]},"106":{"position":[[4,6]]},"107":{"position":[[0,6],[135,7],[230,7],[333,6],[382,7],[461,6]]},"108":{"position":[[9,6],[296,6]]},"119":{"position":[[585,6],[637,6]]},"126":{"position":[[1356,6],[1516,6],[2308,6],[2524,6]]},"175":{"position":[[354,7]]},"273":{"position":[[4,6]]},"274":{"position":[[0,6],[135,7],[230,7],[333,6],[382,7],[461,6]]},"275":{"position":[[9,6],[300,6]]},"277":{"position":[[1524,6],[1684,6],[2476,6],[2692,6]]},"296":{"position":[[68,6]]},"300":{"position":[[585,6],[637,6]]},"361":{"position":[[354,7]]},"417":{"position":[[88,6]]},"490":{"position":[[4,6]]},"491":{"position":[[0,6],[135,7],[230,7],[333,6],[382,7],[461,6]]},"492":{"position":[[9,6],[300,6]]},"508":{"position":[[68,6]]},"514":{"position":[[1356,6],[1516,6],[2308,6],[2524,6]]},"521":{"position":[[585,6],[637,6]]},"577":{"position":[[354,7]]},"654":{"position":[[88,6]]}},"keywords":{}}],["offer",{"_index":103,"title":{},"content":{"2":{"position":[[278,5]]},"21":{"position":[[141,6]]},"81":{"position":[[34,5],[131,6]]},"232":{"position":[[34,5],[131,6]]},"270":{"position":[[295,6]]},"385":{"position":[[295,6]]},"410":{"position":[[295,6]]},"463":{"position":[[34,5],[131,6]]},"627":{"position":[[295,6]]},"647":{"position":[[295,6]]}},"keywords":{}}],["offic",{"_index":3333,"title":{"438":{"position":[[7,6]]},"685":{"position":[[7,6]]}},"content":{"439":{"position":[[165,6]]},"441":{"position":[[211,6],[406,7],[1906,6],[1970,6]]},"686":{"position":[[165,6]]},"688":{"position":[[211,6],[406,7],[1906,6],[1970,6]]}},"keywords":{}}],["office.l16",{"_index":3493,"title":{},"content":{"441":{"position":[[1738,10]]},"688":{"position":[[1738,10]]}},"keywords":{}}],["office.l20",{"_index":3494,"title":{},"content":{"441":{"position":[[1811,10]]},"688":{"position":[[1811,10]]}},"keywords":{}}],["offlin",{"_index":1865,"title":{},"content":{"128":{"position":[[301,7],[584,7]]},"279":{"position":[[301,7],[584,7]]},"516":{"position":[[301,7],[584,7]]}},"keywords":{}}],["oh",{"_index":3136,"title":{},"content":{"395":{"position":[[1349,2]]},"632":{"position":[[1349,2]]}},"keywords":{}}],["ok",{"_index":357,"title":{},"content":{"10":{"position":[[1345,6]]},"11":{"position":[[79,3]]},"52":{"position":[[1739,3]]},"196":{"position":[[540,3]]},"432":{"position":[[477,3]]},"440":{"position":[[5583,6],[5663,6]]},"441":{"position":[[5503,8],[5557,8]]},"617":{"position":[[1219,4]]},"679":{"position":[[477,3]]},"687":{"position":[[5583,6],[5663,6]]},"688":{"position":[[5503,8],[5557,8]]},"725":{"position":[[1219,4]]}},"keywords":{}}],["ok(parse_quote!(#b",{"_index":1008,"title":{},"content":{"39":{"position":[[3117,21]]}},"keywords":{}}],["ok(parse_quote!(#expr",{"_index":999,"title":{},"content":{"39":{"position":[[2842,21]]}},"keywords":{}}],["ok(parse_quote!(#ti",{"_index":1006,"title":{},"content":{"39":{"position":[[3060,21]]}},"keywords":{}}],["ok(parse_quote!(non",{"_index":989,"title":{},"content":{"39":{"position":[[2610,23]]}},"keywords":{}}],["ok(success",{"_index":3913,"title":{},"content":{"617":{"position":[[454,11]]},"725":{"position":[[454,11]]}},"keywords":{}}],["ok(tru",{"_index":3919,"title":{},"content":{"617":{"position":[[750,8]]},"725":{"position":[[750,8]]}},"keywords":{}}],["okay",{"_index":1898,"title":{},"content":{"138":{"position":[[0,5]]},"318":{"position":[[0,5]]},"544":{"position":[[0,5]]}},"keywords":{}}],["old_valu",{"_index":1200,"title":{},"content":{"51":{"position":[[742,9],[799,9],[856,10],[1200,10]]},"53":{"position":[[833,9],[1331,10]]}},"keywords":{}}],["omit",{"_index":3547,"title":{},"content":{"476":{"position":[[1274,7],[1416,7],[1521,7]]},"698":{"position":[[1274,7],[1416,7],[1521,7]]}},"keywords":{}}],["on",{"_index":72,"title":{},"content":{"1":{"position":[[916,3]]},"3":{"position":[[700,3]]},"10":{"position":[[156,3]]},"15":{"position":[[163,3],[433,3]]},"20":{"position":[[329,3],[589,3],[843,3]]},"30":{"position":[[88,3],[109,3]]},"38":{"position":[[410,4]]},"39":{"position":[[855,3]]},"42":{"position":[[846,4]]},"53":{"position":[[82,3]]},"74":{"position":[[32,3]]},"78":{"position":[[222,3]]},"92":{"position":[[387,3]]},"95":{"position":[[256,3]]},"101":{"position":[[30,3]]},"104":{"position":[[56,3]]},"117":{"position":[[54,3],[94,3],[773,3]]},"119":{"position":[[76,4]]},"126":{"position":[[213,3]]},"136":{"position":[[178,3]]},"148":{"position":[[805,3]]},"162":{"position":[[1826,3]]},"163":{"position":[[671,3],[706,3]]},"196":{"position":[[596,3],[603,4]]},"197":{"position":[[1490,3]]},"198":{"position":[[2064,3],[2147,5],[2726,3]]},"229":{"position":[[222,3]]},"238":{"position":[[32,3]]},"277":{"position":[[213,3]]},"284":{"position":[[387,3]]},"287":{"position":[[256,3]]},"293":{"position":[[30,3]]},"296":{"position":[[56,3]]},"298":{"position":[[54,3],[94,3],[773,3]]},"300":{"position":[[76,4]]},"316":{"position":[[178,3]]},"336":{"position":[[805,3]]},"351":{"position":[[1848,3]]},"352":{"position":[[693,3],[728,3]]},"394":{"position":[[340,3]]},"395":{"position":[[4177,3]]},"396":{"position":[[964,3],[1132,3]]},"413":{"position":[[140,4]]},"417":{"position":[[49,3],[553,3]]},"419":{"position":[[1789,3],[1815,3],[6968,3]]},"432":{"position":[[533,3],[540,4]]},"433":{"position":[[1489,3]]},"434":{"position":[[2054,3],[2137,5],[2716,3]]},"438":{"position":[[229,3]]},"460":{"position":[[222,3]]},"474":{"position":[[32,3]]},"496":{"position":[[387,3]]},"499":{"position":[[256,3]]},"505":{"position":[[30,3]]},"508":{"position":[[56,3]]},"514":{"position":[[213,3]]},"519":{"position":[[54,3],[94,3],[773,3]]},"521":{"position":[[76,4]]},"533":{"position":[[178,3]]},"553":{"position":[[805,3]]},"567":{"position":[[1848,3]]},"568":{"position":[[693,3],[728,3]]},"601":{"position":[[2103,3]]},"611":{"position":[[663,3]]},"612":{"position":[[292,3],[1446,3],[2014,3]]},"631":{"position":[[340,3]]},"632":{"position":[[4177,3]]},"633":{"position":[[964,3],[1132,3]]},"650":{"position":[[140,4]]},"654":{"position":[[49,3],[553,3]]},"656":{"position":[[1789,3],[1815,3],[6968,3]]},"679":{"position":[[533,3],[540,4]]},"680":{"position":[[1489,3]]},"681":{"position":[[2064,3],[2147,5],[2726,3]]},"685":{"position":[[229,3]]},"709":{"position":[[2103,3]]},"719":{"position":[[663,3]]},"720":{"position":[[292,3],[1446,3],[2014,3]]}},"keywords":{}}],["onc",{"_index":1272,"title":{},"content":{"52":{"position":[[2010,4],[6536,6]]},"194":{"position":[[128,5]]},"196":{"position":[[1335,4]]},"198":{"position":[[2560,4]]},"268":{"position":[[0,4],[2868,5]]},"394":{"position":[[376,5]]},"408":{"position":[[0,4],[2868,5]]},"416":{"position":[[3553,5]]},"419":{"position":[[5132,5]]},"430":{"position":[[128,5]]},"432":{"position":[[1277,4]]},"434":{"position":[[2550,4]]},"441":{"position":[[4026,4]]},"599":{"position":[[524,5]]},"631":{"position":[[376,5]]},"645":{"position":[[0,4],[2868,5]]},"653":{"position":[[3553,5]]},"656":{"position":[[5132,5]]},"677":{"position":[[128,5]]},"679":{"position":[[1277,4]]},"681":{"position":[[2560,4]]},"688":{"position":[[4026,4]]},"707":{"position":[[524,5]]}},"keywords":{}}],["once.l13",{"_index":2771,"title":{},"content":{"247":{"position":[[1665,8]]},"446":{"position":[[1665,8]]},"673":{"position":[[1665,8]]}},"keywords":{}}],["one_token",{"_index":2877,"title":{},"content":{"267":{"position":[[3188,11]]},"407":{"position":[[3188,11]]},"644":{"position":[[3188,11]]}},"keywords":{}}],["onlyown",{"_index":1124,"title":{},"content":{"43":{"position":[[432,9]]}},"keywords":{}}],["onlytokenholderscanpropos",{"_index":3297,"title":{},"content":{"419":{"position":[[607,26]]},"656":{"position":[[607,26]]}},"keywords":{}}],["onticketissu",{"_index":3358,"title":{},"content":{"440":{"position":[[602,13],[925,15],[3566,13],[4227,13]]},"687":{"position":[[602,13],[925,15],[3566,13],[4227,13]]}},"keywords":{}}],["onticketsel",{"_index":3360,"title":{},"content":{"440":{"position":[[700,12],[941,14],[3584,12],[4546,12]]},"687":{"position":[[700,12],[941,14],[3584,12],[4546,12]]}},"keywords":{}}],["onto",{"_index":639,"title":{},"content":{"21":{"position":[[362,4]]},"43":{"position":[[680,4],[896,4],[1718,4]]},"95":{"position":[[74,4]]},"107":{"position":[[126,4]]},"119":{"position":[[489,4]]},"141":{"position":[[818,4]]},"198":{"position":[[2586,4]]},"274":{"position":[[126,4]]},"287":{"position":[[74,4]]},"300":{"position":[[489,4]]},"326":{"position":[[818,4]]},"434":{"position":[[2576,4]]},"491":{"position":[[126,4]]},"499":{"position":[[74,4]]},"521":{"position":[[489,4]]},"535":{"position":[[818,4]]},"681":{"position":[[2586,4]]}},"keywords":{}}],["open",{"_index":24,"title":{},"content":{"1":{"position":[[243,4]]},"12":{"position":[[318,4]]},"22":{"position":[[308,4]]},"205":{"position":[[2314,4]]},"416":{"position":[[661,5],[1901,4],[2226,4]]},"419":{"position":[[1032,5],[4419,4]]},"425":{"position":[[2264,4]]},"653":{"position":[[661,5],[1901,4],[2226,4]]},"656":{"position":[[1032,5],[4419,4]]},"667":{"position":[[2264,4]]}},"keywords":{}}],["openai",{"_index":395,"title":{"14":{"position":[[0,6]]},"15":{"position":[[0,7]]}},"content":{"15":{"position":[[0,6],[174,6],[300,6]]},"16":{"position":[[0,6],[111,6]]},"17":{"position":[[1848,6]]}},"keywords":{}}],["openzeppelin",{"_index":680,"title":{},"content":{"23":{"position":[[238,13]]}},"keywords":{}}],["openzeppelin)and",{"_index":883,"title":{},"content":{"38":{"position":[[794,16]]}},"keywords":{}}],["oper",{"_index":1203,"title":{},"content":{"51":{"position":[[878,9],[1240,9]]},"53":{"position":[[909,8],[1356,9]]},"83":{"position":[[319,8]]},"84":{"position":[[958,9]]},"173":{"position":[[259,9]]},"252":{"position":[[319,8]]},"253":{"position":[[958,9]]},"267":{"position":[[2412,10]]},"359":{"position":[[259,9]]},"407":{"position":[[2412,10]]},"440":{"position":[[6191,8]]},"441":{"position":[[91,8],[171,8],[299,8],[382,8],[1421,8],[2392,9],[2504,9],[2559,8],[2687,8],[2952,8],[2988,8],[3310,8],[3478,8],[3820,8],[3912,9],[3965,8],[4067,8],[4174,9],[4231,8],[4306,8],[4345,8],[4366,8],[4972,8]]},"483":{"position":[[319,8]]},"484":{"position":[[958,9]]},"575":{"position":[[259,9]]},"644":{"position":[[2412,10]]},"687":{"position":[[6191,8]]},"688":{"position":[[91,8],[171,8],[299,8],[382,8],[1421,8],[2392,9],[2504,9],[2559,8],[2687,8],[2952,8],[2988,8],[3310,8],[3478,8],[3820,8],[3912,9],[3965,8],[4067,8],[4174,9],[4231,8],[4306,8],[4345,8],[4366,8],[4972,8]]}},"keywords":{}}],["operator'",{"_index":3485,"title":{},"content":{"441":{"position":[[1014,10],[2087,10]]},"688":{"position":[[1014,10],[2087,10]]}},"keywords":{}}],["operator(&self",{"_index":3510,"title":{},"content":{"441":{"position":[[3664,19]]},"688":{"position":[[3664,19]]}},"keywords":{}}],["operator).register(self.env().self_address",{"_index":3500,"title":{},"content":{"441":{"position":[[2748,46]]},"688":{"position":[[2748,46]]}},"keywords":{}}],["operator.with_tokens(u512::from(price)).try_buy_ticket(id",{"_index":3535,"title":{},"content":{"441":{"position":[[5822,58]]},"688":{"position":[[5822,58]]}},"keywords":{}}],["opinion",{"_index":165,"title":{},"content":{"5":{"position":[[6,8]]}},"keywords":{}}],["opposit",{"_index":1998,"title":{},"content":{"147":{"position":[[1181,8]]},"178":{"position":[[768,8]]},"185":{"position":[[3704,8]]},"335":{"position":[[1189,8]]},"369":{"position":[[768,8]]},"376":{"position":[[3688,8]]},"552":{"position":[[1189,8]]},"585":{"position":[[768,8]]},"592":{"position":[[3688,8]]}},"keywords":{}}],["opt",{"_index":935,"title":{},"content":{"39":{"position":[[988,4]]},"66":{"position":[[151,3],[179,3]]},"68":{"position":[[449,3]]},"131":{"position":[[509,3]]},"241":{"position":[[151,3],[179,3]]},"243":{"position":[[449,3]]},"265":{"position":[[919,3]]},"311":{"position":[[561,3]]},"395":{"position":[[3599,3]]},"405":{"position":[[919,3]]},"466":{"position":[[151,3],[179,3]]},"468":{"position":[[449,3]]},"528":{"position":[[561,3]]},"632":{"position":[[3599,3]]},"642":{"position":[[919,3]]}},"keywords":{}}],["opt_str",{"_index":1462,"title":{},"content":{"79":{"position":[[1052,10]]},"230":{"position":[[1069,10]]},"461":{"position":[[1069,10]]}},"keywords":{}}],["opt_string.unwrap_or_revert(&self.env",{"_index":1464,"title":{},"content":{"79":{"position":[[1108,44]]},"230":{"position":[[1125,44]]},"461":{"position":[[1125,44]]}},"keywords":{}}],["optim",{"_index":703,"title":{"66":{"position":[[0,10]]},"241":{"position":[[0,10]]},"466":{"position":[[0,10]]}},"content":{"30":{"position":[[505,8]]},"66":{"position":[[118,8]]},"241":{"position":[[118,8]]},"265":{"position":[[320,8]]},"405":{"position":[[320,8]]},"466":{"position":[[118,8]]},"642":{"position":[[320,8]]}},"keywords":{}}],["option",{"_index":1497,"title":{},"content":{"81":{"position":[[47,7]]},"97":{"position":[[243,6]]},"120":{"position":[[273,7],[336,7]]},"121":{"position":[[378,6]]},"126":{"position":[[151,11]]},"147":{"position":[[925,9]]},"162":{"position":[[1577,6]]},"165":{"position":[[59,8]]},"195":{"position":[[397,8]]},"232":{"position":[[47,7]]},"268":{"position":[[2987,8]]},"277":{"position":[[151,11]]},"289":{"position":[[243,6]]},"301":{"position":[[273,7],[336,7]]},"302":{"position":[[378,6]]},"324":{"position":[[180,8]]},"335":{"position":[[933,9]]},"351":{"position":[[1599,6]]},"354":{"position":[[59,8]]},"395":{"position":[[2880,8]]},"408":{"position":[[2987,8]]},"431":{"position":[[397,8]]},"440":{"position":[[1569,8]]},"463":{"position":[[47,7]]},"477":{"position":[[983,8]]},"501":{"position":[[243,6]]},"514":{"position":[[151,11]]},"522":{"position":[[273,7],[336,7]]},"523":{"position":[[378,6]]},"542":{"position":[[180,8]]},"552":{"position":[[933,9]]},"567":{"position":[[1599,6]]},"570":{"position":[[59,8]]},"601":{"position":[[383,6]]},"632":{"position":[[2880,8]]},"645":{"position":[[2987,8]]},"678":{"position":[[397,8]]},"687":{"position":[[1569,8]]},"699":{"position":[[983,8]]},"709":{"position":[[383,6]]}},"keywords":{}}],["option<address>",{"_index":488,"title":{},"content":{"17":{"position":[[1029,21]]},"39":{"position":[[2012,22],[2039,22]]},"165":{"position":[[288,21]]},"196":{"position":[[491,22]]},"197":{"position":[[1745,21]]},"204":{"position":[[919,22],[950,22]]},"267":{"position":[[1619,22],[1650,22]]},"269":{"position":[[3422,22],[3453,22]]},"354":{"position":[[326,21]]},"383":{"position":[[412,21],[1141,22],[1172,22]]},"384":{"position":[[3432,22],[3463,22]]},"407":{"position":[[1619,22],[1650,22]]},"409":{"position":[[3422,22],[3453,22]]},"424":{"position":[[870,22],[901,22]]},"432":{"position":[[428,22]]},"433":{"position":[[1744,21]]},"570":{"position":[[326,21]]},"598":{"position":[[1924,22]]},"625":{"position":[[412,21],[1141,22],[1172,22]]},"626":{"position":[[3432,22],[3463,22]]},"644":{"position":[[1619,22],[1650,22]]},"646":{"position":[[3422,22],[3453,22]]},"666":{"position":[[870,22],[901,22]]},"679":{"position":[[428,22]]},"680":{"position":[[1744,21]]},"706":{"position":[[1924,22]]}},"keywords":{}}],["option<bool>>",{"_index":3694,"title":{},"content":{"601":{"position":[[704,22]]},"709":{"position":[[704,22]]}},"keywords":{}}],["option<option<address>>",{"_index":2377,"title":{},"content":{"197":{"position":[[1795,36]]},"433":{"position":[[1794,36]]},"680":{"position":[[1794,36]]}},"keywords":{}}],["option<option<u256>>",{"_index":3688,"title":{},"content":{"601":{"position":[[293,32]]},"709":{"position":[[293,32]]}},"keywords":{}}],["option<t>",{"_index":2376,"title":{},"content":{"197":{"position":[[1549,16]]},"267":{"position":[[2082,15]]},"407":{"position":[[2082,15]]},"433":{"position":[[1548,16]]},"644":{"position":[[2082,15]]},"680":{"position":[[1548,16]]}},"keywords":{}}],["option<t>.fn",{"_index":2850,"title":{},"content":{"267":{"position":[[2171,18]]},"407":{"position":[[2171,18]]},"644":{"position":[[2171,18]]}},"keywords":{}}],["option<todo>",{"_index":3743,"title":{},"content":{"602":{"position":[[1803,18]]},"710":{"position":[[1803,18]]}},"keywords":{}}],["option<u256>",{"_index":2929,"title":{},"content":{"269":{"position":[[639,18]]},"384":{"position":[[652,18]]},"409":{"position":[[639,18]]},"626":{"position":[[652,18]]},"646":{"position":[[639,18]]}},"keywords":{}}],["option<u256>>",{"_index":3685,"title":{},"content":{"601":{"position":[[136,22]]},"709":{"position":[[136,22]]}},"keywords":{}}],["option<u512>",{"_index":2873,"title":{},"content":{"267":{"position":[[3026,19]]},"407":{"position":[[3026,19]]},"644":{"position":[[3026,19]]}},"keywords":{}}],["option<vec<u8>>",{"_index":1517,"title":{},"content":{"83":{"position":[[593,28]]},"252":{"position":[[593,28]]},"483":{"position":[[593,28]]}},"keywords":{}}],["or/and",{"_index":1988,"title":{},"content":{"146":{"position":[[89,6]]},"178":{"position":[[101,6]]},"334":{"position":[[89,6]]},"369":{"position":[[101,6]]},"419":{"position":[[719,6]]},"551":{"position":[[89,6]]},"585":{"position":[[101,6]]},"656":{"position":[[719,6]]}},"keywords":{}}],["order",{"_index":944,"title":{},"content":{"39":{"position":[[1212,5],[1450,5]]},"74":{"position":[[317,5]]},"76":{"position":[[819,7]]},"203":{"position":[[418,5]]},"227":{"position":[[819,7]]},"238":{"position":[[317,5]]},"423":{"position":[[418,5]]},"458":{"position":[[819,7]]},"474":{"position":[[317,5]]},"612":{"position":[[1546,5],[1679,6]]},"665":{"position":[[418,5]]},"720":{"position":[[1546,5],[1679,6]]}},"keywords":{}}],["orient",{"_index":1705,"title":{},"content":{"111":{"position":[[313,8]]},"306":{"position":[[313,8]]},"511":{"position":[[313,8]]}},"keywords":{}}],["origin",{"_index":747,"title":{},"content":{"31":{"position":[[1022,7]]},"42":{"position":[[1746,8]]}},"keywords":{}}],["osmosi",{"_index":1183,"title":{},"content":{"50":{"position":[[489,8]]}},"keywords":{}}],["ot",{"_index":3198,"title":{},"content":{"397":{"position":[[225,2]]},"634":{"position":[[225,2]]}},"keywords":{}}],["other",{"_index":2336,"title":{},"content":{"196":{"position":[[1030,7]]},"432":{"position":[[975,7]]},"679":{"position":[[975,7]]}},"keywords":{}}],["other_contract",{"_index":3907,"title":{},"content":{"617":{"position":[[105,15],[201,15]]},"725":{"position":[[105,15],[201,15]]}},"keywords":{}}],["othercontract",{"_index":3916,"title":{},"content":{"617":{"position":[[635,14],[671,13]]},"725":{"position":[[635,14],[671,13]]}},"keywords":{}}],["othercontractcontractref::new(self.env",{"_index":3911,"title":{},"content":{"617":{"position":[[374,41]]},"725":{"position":[[374,41]]}},"keywords":{}}],["otherwis",{"_index":2335,"title":{},"content":{"196":{"position":[[892,10]]},"432":{"position":[[830,10]]},"679":{"position":[[830,10]]}},"keywords":{}}],["our_token_livenet",{"_index":3171,"title":{},"content":{"395":{"position":[[4402,17]]},"632":{"position":[[4402,17]]}},"keywords":{}}],["ourcoin",{"_index":3205,"title":{},"content":{"414":{"position":[[126,7]]},"651":{"position":[[126,7]]}},"keywords":{}}],["ourcoin::token::{ourtokenhostref",{"_index":3124,"title":{},"content":{"395":{"position":[[483,33]]},"632":{"position":[[483,33]]}},"keywords":{}}],["ourselv",{"_index":1953,"title":{},"content":{"142":{"position":[[80,10]]},"327":{"position":[[80,10]]},"536":{"position":[[80,10]]}},"keywords":{}}],["ourtoken",{"_index":3120,"title":{},"content":{"395":{"position":[[254,8]]},"396":{"position":[[1120,8]]},"414":{"position":[[605,9]]},"416":{"position":[[396,8]]},"419":{"position":[[33,8],[768,8],[1279,8]]},"632":{"position":[[254,8]]},"633":{"position":[[1120,8]]},"651":{"position":[[605,9]]},"653":{"position":[[396,8]]},"656":{"position":[[33,8],[768,8],[1279,8]]}},"keywords":{}}],["ourtokenhostref",{"_index":3150,"title":{},"content":{"395":{"position":[[1815,15],[2256,15]]},"632":{"position":[[1815,15],[2256,15]]}},"keywords":{}}],["ourtokenhostref::deploy(&env",{"_index":3277,"title":{},"content":{"417":{"position":[[362,33]]},"419":{"position":[[6777,33]]},"654":{"position":[[362,33]]},"656":{"position":[[6777,33]]}},"keywords":{}}],["ourtokenhostref::deploy(env",{"_index":3154,"title":{},"content":{"395":{"position":[[2092,28]]},"632":{"position":[[2092,28]]}},"keywords":{}}],["ourtokenhostref::load(env",{"_index":3157,"title":{},"content":{"395":{"position":[[2363,26]]},"632":{"position":[[2363,26]]}},"keywords":{}}],["ourtokeninitarg",{"_index":3125,"title":{},"content":{"395":{"position":[[517,18],[1997,16]]},"417":{"position":[[197,16]]},"419":{"position":[[6612,16]]},"632":{"position":[[517,18],[1997,16]]},"654":{"position":[[197,16]]},"656":{"position":[[6612,16]]}},"keywords":{}}],["out",{"_index":89,"title":{},"content":{"1":{"position":[[1152,3]]},"15":{"position":[[594,3]]},"20":{"position":[[477,3]]},"24":{"position":[[6,3],[74,3]]},"26":{"position":[[52,3]]},"28":{"position":[[52,3]]},"36":{"position":[[52,3]]},"40":{"position":[[343,3]]},"43":{"position":[[619,3]]},"46":{"position":[[52,3]]},"48":{"position":[[52,3]]},"57":{"position":[[52,3]]},"59":{"position":[[52,3]]},"61":{"position":[[53,3]]},"63":{"position":[[53,3]]},"205":{"position":[[2334,3]]},"214":{"position":[[53,3]]},"216":{"position":[[53,3]]},"225":{"position":[[53,3]]},"270":{"position":[[105,3]]},"385":{"position":[[105,3]]},"394":{"position":[[393,3]]},"410":{"position":[[105,3]]},"419":{"position":[[2152,3]]},"425":{"position":[[2284,3]]},"449":{"position":[[53,3]]},"478":{"position":[[234,3]]},"627":{"position":[[105,3]]},"631":{"position":[[393,3]]},"647":{"position":[[105,3]]},"656":{"position":[[2152,3]]},"667":{"position":[[2284,3]]},"700":{"position":[[234,3]]}},"keywords":{}}],["outlin",{"_index":379,"title":{},"content":{"12":{"position":[[30,7]]}},"keywords":{}}],["output",{"_index":287,"title":{"323":{"position":[[7,7]]},"541":{"position":[[7,7]]}},"content":{"9":{"position":[[791,6],[886,6]]},"30":{"position":[[557,6]]},"42":{"position":[[382,6]]},"120":{"position":[[52,6]]},"127":{"position":[[229,6]]},"278":{"position":[[229,6]]},"301":{"position":[[52,6]]},"395":{"position":[[4494,6]]},"477":{"position":[[2561,6]]},"515":{"position":[[229,6]]},"522":{"position":[[52,6]]},"632":{"position":[[4494,6]]},"699":{"position":[[2561,6]]}},"keywords":{}}],["outsid",{"_index":328,"title":{},"content":{"10":{"position":[[341,8]]},"111":{"position":[[127,7]]},"147":{"position":[[546,7]]},"168":{"position":[[85,8]]},"196":{"position":[[1386,7]]},"204":{"position":[[1396,8]]},"306":{"position":[[127,7]]},"324":{"position":[[949,8]]},"335":{"position":[[550,7]]},"348":{"position":[[85,8]]},"424":{"position":[[1346,8]]},"432":{"position":[[1328,7]]},"511":{"position":[[127,7]]},"542":{"position":[[949,8]]},"552":{"position":[[550,7]]},"564":{"position":[[85,8]]},"596":{"position":[[1235,7]]},"666":{"position":[[1346,8]]},"679":{"position":[[1328,7]]},"704":{"position":[[1235,7]]}},"keywords":{}}],["over",{"_index":385,"title":{},"content":{"12":{"position":[[187,4]]},"22":{"position":[[527,4]]},"76":{"position":[[869,5]]},"88":{"position":[[361,4]]},"115":{"position":[[1681,4]]},"127":{"position":[[767,4]]},"163":{"position":[[1066,4],[1235,4]]},"212":{"position":[[2090,4]]},"227":{"position":[[869,5]]},"247":{"position":[[1900,4]]},"250":{"position":[[361,4]]},"258":{"position":[[1627,4]]},"278":{"position":[[767,4]]},"352":{"position":[[1088,4],[1257,4]]},"391":{"position":[[2090,4]]},"416":{"position":[[3272,5]]},"446":{"position":[[1900,4]]},"458":{"position":[[869,5]]},"481":{"position":[[1627,4]]},"488":{"position":[[361,4]]},"515":{"position":[[767,4]]},"568":{"position":[[1088,4],[1257,4]]},"653":{"position":[[3272,5]]},"661":{"position":[[2090,4]]},"673":{"position":[[1900,4]]}},"keywords":{}}],["overcom",{"_index":1570,"title":{},"content":{"90":{"position":[[150,9]]},"282":{"position":[[150,9]]},"494":{"position":[[150,9]]}},"keywords":{}}],["overflow",{"_index":254,"title":{},"content":{"8":{"position":[[566,8]]}},"keywords":{}}],["overflow"",{"_index":256,"title":{},"content":{"8":{"position":[[627,16]]}},"keywords":{}}],["overflowingadd>::overflowing_add(current_bal",{"_index":2464,"title":{},"content":{"204":{"position":[[1624,52]]},"424":{"position":[[1574,52]]},"666":{"position":[[1574,52]]}},"keywords":{}}],["overhead",{"_index":3772,"title":{},"content":{"606":{"position":[[1082,8]]},"714":{"position":[[1082,8]]}},"keywords":{}}],["overrid",{"_index":1873,"title":{},"content":{"129":{"position":[[509,8]]},"280":{"position":[[509,8]]},"517":{"position":[[509,8]]}},"keywords":{}}],["overridden",{"_index":3050,"title":{},"content":{"324":{"position":[[468,10]]},"542":{"position":[[468,10]]}},"keywords":{}}],["override(erc20",{"_index":1128,"title":{},"content":{"43":{"position":[[537,15]]}},"keywords":{}}],["override."",{"_index":3037,"title":{},"content":{"323":{"position":[[3143,16]]},"541":{"position":[[3143,16]]}},"keywords":{}}],["overriden",{"_index":3047,"title":{},"content":{"324":{"position":[[309,9]]},"542":{"position":[[309,9]]}},"keywords":{}}],["overview",{"_index":1707,"title":{"114":{"position":[[0,9]]},"257":{"position":[[0,9]]},"480":{"position":[[0,9]]}},"content":{"477":{"position":[[4114,8]]},"699":{"position":[[4114,8]]}},"keywords":{}}],["overwrit",{"_index":704,"title":{},"content":{"30":{"position":[[518,9]]}},"keywords":{}}],["overwritten.odra_cfg_is_upgrad",{"_index":1644,"title":{},"content":{"98":{"position":[[377,34]]},"290":{"position":[[377,34]]},"502":{"position":[[377,34]]}},"keywords":{}}],["own",{"_index":3400,"title":{},"content":{"440":{"position":[[2423,5]]},"687":{"position":[[2423,5]]}},"keywords":{}}],["ownabl",{"_index":1106,"title":{"192":{"position":[[0,7]]},"428":{"position":[[0,7]]},"675":{"position":[[0,7]]}},"content":{"43":{"position":[[76,8],[210,7]]},"115":{"position":[[232,8],[1419,8],[2036,8],[3011,8]]},"188":{"position":[[244,7],[429,7],[621,7],[700,7]]},"189":{"position":[[223,8],[582,7]]},"195":{"position":[[115,7],[293,7]]},"196":{"position":[[70,7],[756,7]]},"197":{"position":[[32,7]]},"198":{"position":[[371,9],[599,8],[938,8]]},"199":{"position":[[4,7]]},"207":{"position":[[20,7]]},"246":{"position":[[65,7],[243,8]]},"247":{"position":[[1817,7],[1922,7]]},"258":{"position":[[222,8],[1365,8],[1982,8],[2937,8]]},"267":{"position":[[3448,8]]},"268":{"position":[[986,7]]},"365":{"position":[[601,7],[786,7],[978,7],[1057,7]]},"366":{"position":[[223,8],[582,7]]},"407":{"position":[[3448,8]]},"408":{"position":[[986,7]]},"427":{"position":[[20,7]]},"431":{"position":[[115,7],[293,7]]},"432":{"position":[[32,7],[693,7]]},"433":{"position":[[32,7]]},"434":{"position":[[371,9],[594,8],[928,8]]},"435":{"position":[[4,7]]},"440":{"position":[[1031,8],[3860,7],[4039,7]]},"445":{"position":[[65,7],[243,8]]},"446":{"position":[[1817,7],[1922,7]]},"481":{"position":[[222,8],[1365,8],[1982,8],[2937,8]]},"581":{"position":[[601,7],[786,7],[978,7],[1057,7]]},"582":{"position":[[223,8],[582,7]]},"644":{"position":[[3448,8]]},"645":{"position":[[986,7]]},"669":{"position":[[20,7]]},"672":{"position":[[65,7],[243,8]]},"673":{"position":[[1817,7],[1922,7]]},"678":{"position":[[115,7],[293,7]]},"679":{"position":[[32,7],[693,7]]},"680":{"position":[[32,7]]},"681":{"position":[[371,9],[599,8],[938,8]]},"682":{"position":[[4,7]]},"687":{"position":[[1031,8],[3860,7],[4039,7]]}},"keywords":{}}],["ownable(initialown",{"_index":1121,"title":{},"content":{"43":{"position":[[352,21]]}},"keywords":{}}],["ownable.address",{"_index":2387,"title":{},"content":{"198":{"position":[[463,18],[795,18]]},"681":{"position":[[463,18],[795,18]]}},"keywords":{}}],["ownable.change_ownership(&new_own",{"_index":2392,"title":{},"content":{"198":{"position":[[690,41],[1002,41]]},"434":{"position":[[685,41],[992,41]]},"681":{"position":[[690,41],[1002,41]]}},"keywords":{}}],["ownable.r",{"_index":2314,"title":{},"content":{"195":{"position":[[0,10]]},"196":{"position":[[0,10]]},"197":{"position":[[0,10]]},"198":{"position":[[0,10]]},"431":{"position":[[0,10]]},"432":{"position":[[0,10]]},"433":{"position":[[0,10]]},"434":{"position":[[0,10]]},"678":{"position":[[0,10]]},"679":{"position":[[0,10]]},"680":{"position":[[0,10]]},"681":{"position":[[0,10]]}},"keywords":{}}],["ownable.try_change_ownership(&new_own",{"_index":2395,"title":{},"content":{"198":{"position":[[1056,45]]},"434":{"position":[[1046,45]]},"681":{"position":[[1056,45]]}},"keywords":{}}],["ownable2step",{"_index":2299,"title":{},"content":{"189":{"position":[[548,13]]},"366":{"position":[[548,13]]},"582":{"position":[[548,13]]}},"keywords":{}}],["ownable::own",{"_index":1712,"title":{},"content":{"115":{"position":[[89,18],[1881,17]]},"246":{"position":[[133,18]]},"258":{"position":[[89,18],[1827,17]]},"445":{"position":[[133,18]]},"481":{"position":[[89,18],[1827,17]]},"672":{"position":[[133,18]]}},"keywords":{}}],["ownablehostref",{"_index":2379,"title":{},"content":{"198":{"position":[[113,16],[1359,16],[1395,14],[1882,15]]},"434":{"position":[[113,16],[1349,16],[1385,14],[1872,15]]},"681":{"position":[[113,16],[1359,16],[1395,14],[1882,15]]}},"keywords":{}}],["ownablehostref::deploy(&env",{"_index":2382,"title":{},"content":{"198":{"position":[[250,33]]},"268":{"position":[[996,32]]},"408":{"position":[[996,32]]},"434":{"position":[[250,33]]},"645":{"position":[[996,32]]},"681":{"position":[[250,33]]}},"keywords":{}}],["ownableinitarg",{"_index":2380,"title":{},"content":{"198":{"position":[[203,15],[1902,15]]},"434":{"position":[[203,15],[1892,15]]},"681":{"position":[[203,15],[1902,15]]}},"keywords":{}}],["owned_contract",{"_index":1911,"title":{},"content":{"138":{"position":[[571,14]]},"318":{"position":[[563,14]]},"544":{"position":[[563,14]]}},"keywords":{}}],["owned_contract.try_change_name("newname".to_str",{"_index":1914,"title":{},"content":{"138":{"position":[[691,64]]},"318":{"position":[[683,64]]},"544":{"position":[[683,64]]}},"keywords":{}}],["owned_token.r",{"_index":2754,"title":{},"content":{"246":{"position":[[92,14]]},"247":{"position":[[0,14]]},"445":{"position":[[92,14]]},"446":{"position":[[0,14]]},"672":{"position":[[92,14]]},"673":{"position":[[0,14]]}},"keywords":{}}],["ownedcontracthostref",{"_index":1902,"title":{},"content":{"138":{"position":[[208,21]]},"318":{"position":[[208,21]]},"544":{"position":[[208,21]]}},"keywords":{}}],["ownedcontracthostref::deploy(&test_env",{"_index":1912,"title":{},"content":{"138":{"position":[[588,43]]},"318":{"position":[[580,43]]},"544":{"position":[[580,43]]}},"keywords":{}}],["ownedcontractinitarg",{"_index":1903,"title":{},"content":{"138":{"position":[[230,23],[492,21]]},"318":{"position":[[230,23],[484,21]]},"544":{"position":[[230,23],[484,21]]}},"keywords":{}}],["ownederc1155",{"_index":2291,"title":{},"content":{"188":{"position":[[644,12]]},"365":{"position":[[1001,12]]},"581":{"position":[[1001,12]]}},"keywords":{}}],["ownederc721withmetadata",{"_index":2288,"title":{},"content":{"188":{"position":[[347,23]]},"365":{"position":[[704,23]]},"581":{"position":[[704,23]]}},"keywords":{}}],["ownedtoken",{"_index":1716,"title":{"244":{"position":[[0,10]]},"443":{"position":[[0,10]]},"670":{"position":[[0,10]]}},"content":{"115":{"position":[[219,10],[320,10],[1367,10]]},"246":{"position":[[29,10],[230,10]]},"247":{"position":[[85,10]]},"258":{"position":[[209,10],[310,10],[1313,10]]},"445":{"position":[[29,10],[230,10]]},"446":{"position":[[85,10]]},"481":{"position":[[209,10],[310,10],[1313,10]]},"672":{"position":[[29,10],[230,10]]},"673":{"position":[[85,10]]}},"keywords":{}}],["ownedtoken>",{"_index":1453,"title":{},"content":{"79":{"position":[[785,14]]},"230":{"position":[[802,14]]},"461":{"position":[[802,14]]}},"keywords":{}}],["owner",{"_index":470,"title":{},"content":{"17":{"position":[[511,6],[669,6],[2615,6],[3760,5],[3870,6]]},"42":{"position":[[1296,6]]},"100":{"position":[[955,5]]},"101":{"position":[[676,5]]},"115":{"position":[[682,6],[981,6],[1037,6],[2573,6]]},"126":{"position":[[1536,5]]},"138":{"position":[[116,6],[371,5],[945,6]]},"165":{"position":[[281,6]]},"189":{"position":[[376,6],[454,6]]},"194":{"position":[[151,5],[241,5]]},"195":{"position":[[125,6]]},"196":{"position":[[107,6],[321,5],[825,6],[860,5],[1104,5],[1246,5],[1344,5],[1686,6]]},"197":{"position":[[591,6],[952,5],[1344,5],[1728,5]]},"198":{"position":[[221,6],[386,6],[436,7],[535,5],[613,6],[1803,7],[2030,6],[2282,5],[2403,5],[3042,5],[3443,5]]},"205":{"position":[[486,6],[764,5],[880,6],[1065,6],[1230,6],[1660,6],[1987,6],[1994,7],[2121,6]]},"206":{"position":[[2125,7],[2362,5],[2596,6],[2674,5],[3056,6],[3452,7]]},"245":{"position":[[88,5],[128,5],[153,6]]},"247":{"position":[[697,6],[948,6],[1975,6]]},"258":{"position":[[664,6],[939,6],[991,6],[2511,6]]},"267":{"position":[[3906,6]]},"268":{"position":[[2426,7],[3162,6]]},"269":{"position":[[1232,6],[1510,5],[1626,6],[1811,6],[2521,6],[2893,6],[3195,6],[3202,7],[3560,6]]},"277":{"position":[[1704,5]]},"292":{"position":[[955,5]]},"293":{"position":[[676,5]]},"318":{"position":[[116,6],[363,5],[937,6]]},"321":{"position":[[978,6],[1089,5],[1155,6],[1567,6],[1751,6],[1890,5]]},"323":{"position":[[1589,5],[2750,5]]},"354":{"position":[[319,6]]},"366":{"position":[[376,6],[454,6]]},"383":{"position":[[405,6]]},"384":{"position":[[1245,6],[1523,5],[1639,6],[1831,6],[2548,6],[2927,6],[3236,6],[3243,7],[3546,6]]},"395":{"position":[[664,5],[694,5]]},"396":{"position":[[400,6]]},"407":{"position":[[3906,6]]},"408":{"position":[[2426,7],[3162,6]]},"409":{"position":[[1232,6],[1510,5],[1626,6],[1811,6],[2521,6],[2893,6],[3195,6],[3202,7],[3560,6]]},"419":{"position":[[2763,5],[2827,6],[3484,5],[3570,6],[3719,6],[3844,6]]},"425":{"position":[[461,6],[739,5],[855,6],[1040,6],[1205,6],[1635,6],[1962,6],[1969,7],[2072,6]]},"426":{"position":[[2115,7],[2352,5],[2581,6],[2659,5],[3036,6],[3427,7]]},"430":{"position":[[151,5],[241,5]]},"431":{"position":[[125,6]]},"432":{"position":[[69,6],[283,5],[763,6],[798,5],[1047,5],[1188,5],[1286,5],[1564,6]]},"433":{"position":[[591,6],[951,5],[1343,5],[1727,5]]},"434":{"position":[[221,6],[386,6],[436,7],[530,5],[608,6],[1793,7],[2020,6],[2272,5],[2393,5],[3024,5],[3425,5]]},"438":{"position":[[132,5]]},"440":{"position":[[2314,5],[2436,5],[2517,5],[2953,5],[3098,6],[4116,5]]},"441":{"position":[[2537,5],[3218,5],[3891,5]]},"444":{"position":[[88,5],[128,5],[153,6]]},"446":{"position":[[697,6],[948,6],[1975,6]]},"481":{"position":[[664,6],[939,6],[991,6],[2511,6]]},"504":{"position":[[955,5]]},"505":{"position":[[676,5]]},"514":{"position":[[1536,5]]},"539":{"position":[[978,6],[1089,5],[1155,6],[1567,6],[1751,6],[1890,5]]},"541":{"position":[[1589,5],[2750,5]]},"544":{"position":[[116,6],[363,5],[937,6]]},"570":{"position":[[319,6]]},"582":{"position":[[376,6],[454,6]]},"608":{"position":[[124,6]]},"625":{"position":[[405,6]]},"626":{"position":[[1245,6],[1523,5],[1639,6],[1831,6],[2548,6],[2927,6],[3236,6],[3243,7],[3546,6]]},"632":{"position":[[664,5],[694,5]]},"633":{"position":[[400,6]]},"644":{"position":[[3906,6]]},"645":{"position":[[2426,7],[3162,6]]},"646":{"position":[[1232,6],[1510,5],[1626,6],[1811,6],[2521,6],[2893,6],[3195,6],[3202,7],[3560,6]]},"656":{"position":[[2763,5],[2827,6],[3484,5],[3570,6],[3719,6],[3844,6]]},"667":{"position":[[461,6],[739,5],[855,6],[1040,6],[1205,6],[1635,6],[1962,6],[1969,7],[2072,6]]},"668":{"position":[[2125,7],[2362,5],[2596,6],[2674,5],[3056,6],[3452,7]]},"671":{"position":[[88,5],[128,5],[153,6]]},"673":{"position":[[697,6],[948,6],[1975,6]]},"677":{"position":[[151,5],[241,5]]},"678":{"position":[[125,6]]},"679":{"position":[[69,6],[283,5],[763,6],[798,5],[1047,5],[1188,5],[1286,5],[1564,6]]},"680":{"position":[[591,6],[951,5],[1343,5],[1727,5]]},"681":{"position":[[221,6],[386,6],[436,7],[535,5],[613,6],[1803,7],[2030,6],[2282,5],[2403,5],[3042,5],[3443,5]]},"685":{"position":[[132,5]]},"687":{"position":[[2314,5],[2436,5],[2517,5],[2953,5],[3098,6],[4116,5]]},"688":{"position":[[2537,5],[3218,5],[3891,5]]},"716":{"position":[[124,6]]}},"keywords":{}}],["owner'",{"_index":1853,"title":{},"content":{"127":{"position":[[519,7]]},"278":{"position":[[519,7]]},"395":{"position":[[6632,7]]},"515":{"position":[[519,7]]},"632":{"position":[[6632,7]]}},"keywords":{}}],["owner.a",{"_index":2313,"title":{},"content":{"194":{"position":[[194,7]]},"430":{"position":[[194,7]]},"677":{"position":[[194,7]]}},"keywords":{}}],["owner.read",{"_index":2312,"title":{},"content":{"194":{"position":[[171,10]]},"430":{"position":[[171,10]]},"677":{"position":[[171,10]]}},"keywords":{}}],["owner_bal",{"_index":2479,"title":{},"content":{"205":{"position":[[1301,13],[1375,13],[1464,13]]},"425":{"position":[[1276,13],[1350,13],[1439,13]]},"667":{"position":[[1276,13],[1350,13],[1439,13]]}},"keywords":{}}],["owner_can_change_ownership",{"_index":2389,"title":{},"content":{"198":{"position":[[559,28]]},"434":{"position":[[554,28]]},"681":{"position":[[559,28]]}},"keywords":{}}],["ownerisalreadyiniti",{"_index":2329,"title":{},"content":{"196":{"position":[[373,25]]},"197":{"position":[[715,25]]},"432":{"position":[[334,25]]},"433":{"position":[[714,25]]},"679":{"position":[[334,25]]},"680":{"position":[[714,25]]}},"keywords":{}}],["ownerisnotiniti",{"_index":2364,"title":{},"content":{"197":{"position":[[746,21],[1458,22]]},"433":{"position":[[745,21],[1457,22]]},"680":{"position":[[745,21],[1457,22]]}},"keywords":{}}],["ownership",{"_index":2297,"title":{},"content":{"189":{"position":[[470,9],[598,9]]},"198":{"position":[[3473,10]]},"366":{"position":[[470,9],[598,9]]},"434":{"position":[[3455,10]]},"582":{"position":[[470,9],[598,9]]},"681":{"position":[[3473,10]]}},"keywords":{}}],["ownershipchang",{"_index":2315,"title":{},"content":{"195":{"position":[[83,20],[335,20],[535,16]]},"196":{"position":[[456,16],[1619,16]]},"431":{"position":[[83,20],[335,20],[535,16]]},"432":{"position":[[393,16],[1497,16]]},"678":{"position":[[83,20],[335,20],[535,16]]},"679":{"position":[[393,16],[1497,16]]}},"keywords":{}}],["ownershipchanged.l21,l33",{"_index":2372,"title":{},"content":{"197":{"position":[[1281,24]]},"433":{"position":[[1280,24]]},"680":{"position":[[1280,24]]}},"keywords":{}}],["ownershipmod",{"_index":3351,"title":{},"content":{"440":{"position":[[356,15]]},"687":{"position":[[356,15]]}},"keywords":{}}],["ownershipmode::transfer",{"_index":3379,"title":{},"content":{"440":{"position":[[1405,28]]},"687":{"position":[[1405,28]]}},"keywords":{}}],["p",{"_index":850,"title":{},"content":{"32":{"position":[[1696,1]]},"210":{"position":[[131,1],[146,1],[161,1]]},"389":{"position":[[131,1],[146,1],[161,1]]},"477":{"position":[[140,1],[155,1],[170,1]]},"659":{"position":[[131,1],[146,1],[161,1]]},"699":{"position":[[140,1],[155,1],[170,1]]}},"keywords":{}}],["packag",{"_index":1641,"title":{},"content":{"98":{"position":[[201,7]]},"100":{"position":[[1077,7]]},"103":{"position":[[122,7]]},"117":{"position":[[364,9]]},"131":{"position":[[44,9]]},"265":{"position":[[442,9]]},"290":{"position":[[201,7]]},"292":{"position":[[1077,7]]},"295":{"position":[[122,7]]},"298":{"position":[[364,9]]},"311":{"position":[[44,9]]},"323":{"position":[[2923,7]]},"395":{"position":[[2548,9]]},"405":{"position":[[442,9]]},"477":{"position":[[724,9]]},"502":{"position":[[201,7]]},"504":{"position":[[1077,7]]},"507":{"position":[[122,7]]},"519":{"position":[[364,9]]},"528":{"position":[[44,9]]},"541":{"position":[[2923,7]]},"632":{"position":[[2548,9]]},"642":{"position":[[442,9]]},"699":{"position":[[724,9]]}},"keywords":{}}],["package'",{"_index":3192,"title":{},"content":{"396":{"position":[[369,9]]},"633":{"position":[[369,9]]}},"keywords":{}}],["page",{"_index":3197,"title":{},"content":{"396":{"position":[[1036,5]]},"633":{"position":[[1036,5]]}},"keywords":{}}],["pair",{"_index":2080,"title":{},"content":{"163":{"position":[[58,6]]},"203":{"position":[[408,6]]},"352":{"position":[[58,6]]},"423":{"position":[[408,6]]},"568":{"position":[[58,6]]},"665":{"position":[[408,6]]}},"keywords":{}}],["pairs,odra",{"_index":2431,"title":{},"content":{"201":{"position":[[111,10]]},"421":{"position":[[111,10]]},"663":{"position":[[111,10]]}},"keywords":{}}],["panic",{"_index":296,"title":{},"content":{"9":{"position":[[1034,5]]}},"keywords":{}}],["panic!("trivi",{"_index":248,"title":{},"content":{"8":{"position":[[472,20]]}},"keywords":{}}],["panick",{"_index":2423,"title":{},"content":{"198":{"position":[[3758,9]]},"434":{"position":[[3740,9]]},"681":{"position":[[3758,9]]}},"keywords":{}}],["paradigm",{"_index":3810,"title":{},"content":{"612":{"position":[[149,8]]},"720":{"position":[[149,8]]}},"keywords":{}}],["paragraph",{"_index":1023,"title":{},"content":{"40":{"position":[[406,10]]}},"keywords":{}}],["paramet",{"_index":1311,"title":{},"content":{"53":{"position":[[1212,11]]},"117":{"position":[[98,10],[958,10]]},"267":{"position":[[4280,10]]},"298":{"position":[[98,10],[958,10]]},"383":{"position":[[589,9]]},"407":{"position":[[4280,10]]},"416":{"position":[[2071,10]]},"519":{"position":[[98,10],[958,10]]},"605":{"position":[[464,9],[495,10]]},"625":{"position":[[589,9]]},"644":{"position":[[4280,10]]},"653":{"position":[[2071,10]]},"713":{"position":[[464,9],[495,10]]}},"keywords":{}}],["paraphras",{"_index":616,"title":{},"content":{"20":{"position":[[1010,10]]}},"keywords":{}}],["parent",{"_index":1709,"title":{},"content":{"114":{"position":[[214,6],[398,6]]},"115":{"position":[[3090,6]]},"257":{"position":[[214,6],[398,6]]},"258":{"position":[[3016,6]]},"480":{"position":[[214,6],[398,6]]},"481":{"position":[[3016,6]]},"612":{"position":[[216,6]]},"720":{"position":[[216,6]]}},"keywords":{}}],["pars",{"_index":2648,"title":{},"content":{"212":{"position":[[2290,7],[2406,7]]},"391":{"position":[[2290,7],[2406,7]]},"440":{"position":[[1910,8]]},"661":{"position":[[2290,7],[2406,7]]},"687":{"position":[[1910,8]]}},"keywords":{}}],["parse<t>(express",{"_index":972,"title":{},"content":{"39":{"position":[[2263,26]]}},"keywords":{}}],["parse(expr",{"_index":998,"title":{},"content":{"39":{"position":[[2823,11]]}},"keywords":{}}],["parse_ext_call(vari",{"_index":1003,"title":{},"content":{"39":{"position":[[2933,24]]}},"keywords":{}}],["parser",{"_index":903,"title":{},"content":{"39":{"position":[[265,6],[376,6],[1657,6],[2215,7]]},"40":{"position":[[215,6]]},"52":{"position":[[1201,6],[1493,6],[1670,6]]}},"keywords":{}}],["parser/src/pt.r",{"_index":916,"title":{},"content":{"39":{"position":[[562,16]]}},"keywords":{}}],["parsererror>",{"_index":978,"title":{},"content":{"39":{"position":[[2351,15]]}},"keywords":{}}],["part",{"_index":926,"title":{},"content":{"39":{"position":[[803,6],[1701,5]]},"52":{"position":[[422,5]]},"107":{"position":[[28,6]]},"127":{"position":[[212,4]]},"141":{"position":[[1022,4]]},"185":{"position":[[47,5]]},"204":{"position":[[1255,4]]},"274":{"position":[[28,6]]},"278":{"position":[[212,4]]},"326":{"position":[[1022,4]]},"376":{"position":[[47,5]]},"424":{"position":[[1205,4]]},"491":{"position":[[28,6]]},"515":{"position":[[212,4]]},"535":{"position":[[1022,4]]},"592":{"position":[[47,5]]},"600":{"position":[[941,4]]},"666":{"position":[[1205,4]]},"708":{"position":[[941,4]]}},"keywords":{}}],["partialeq",{"_index":918,"title":{},"content":{"39":{"position":[[640,11]]},"184":{"position":[[288,10],[412,10],[536,10]]},"196":{"position":[[429,10],[1524,9]]},"204":{"position":[[864,10]]},"205":{"position":[[2072,10]]},"209":{"position":[[550,10],[683,10]]},"212":{"position":[[449,10],[572,10]]},"219":{"position":[[399,10],[481,10]]},"267":{"position":[[1568,10]]},"269":{"position":[[3371,10],[3515,10]]},"391":{"position":[[449,10],[572,10]]},"407":{"position":[[1568,10]]},"409":{"position":[[3371,10],[3515,10]]},"644":{"position":[[1568,10]]},"646":{"position":[[3371,10],[3515,10]]},"661":{"position":[[449,10],[572,10]]}},"keywords":{}}],["particular",{"_index":888,"title":{},"content":{"38":{"position":[[937,10]]},"189":{"position":[[327,10]]},"366":{"position":[[327,10]]},"582":{"position":[[327,10]]}},"keywords":{}}],["party_contract",{"_index":2026,"title":{},"content":{"157":{"position":[[322,14]]},"330":{"position":[[313,14]]},"547":{"position":[[322,14]]}},"keywords":{}}],["party_contract.address",{"_index":2029,"title":{},"content":{"157":{"position":[[416,25]]},"547":{"position":[[416,25]]}},"keywords":{}}],["partycontracthostref::deploy(&test_env",{"_index":2027,"title":{},"content":{"157":{"position":[[339,43]]},"330":{"position":[[330,43]]},"547":{"position":[[339,43]]}},"keywords":{}}],["partystart",{"_index":2024,"title":{},"content":{"157":{"position":[[181,14]]},"330":{"position":[[181,14]]},"547":{"position":[[181,14]]}},"keywords":{}}],["pass",{"_index":325,"title":{},"content":{"10":{"position":[[295,6]]},"32":{"position":[[100,6]]},"96":{"position":[[85,4]]},"98":{"position":[[38,4],[530,4],[730,4]]},"99":{"position":[[76,4],[128,4]]},"103":{"position":[[362,4]]},"117":{"position":[[89,4],[907,4]]},"119":{"position":[[848,4],[965,6]]},"120":{"position":[[378,4]]},"126":{"position":[[256,6]]},"129":{"position":[[300,4]]},"147":{"position":[[1058,6]]},"148":{"position":[[791,4]]},"163":{"position":[[98,4],[734,4]]},"178":{"position":[[645,6]]},"196":{"position":[[1252,6],[1607,7]]},"197":{"position":[[1174,4]]},"198":{"position":[[1926,4],[2897,4]]},"268":{"position":[[729,4]]},"277":{"position":[[256,6]]},"280":{"position":[[300,4]]},"288":{"position":[[85,4]]},"290":{"position":[[38,4],[530,4],[730,4]]},"291":{"position":[[76,4],[128,4]]},"295":{"position":[[362,4]]},"298":{"position":[[89,4],[907,4]]},"300":{"position":[[848,4],[965,6]]},"301":{"position":[[378,4]]},"322":{"position":[[84,4]]},"335":{"position":[[1066,6]]},"336":{"position":[[791,4]]},"352":{"position":[[98,4],[756,4]]},"369":{"position":[[645,6]]},"383":{"position":[[577,6]]},"408":{"position":[[729,4]]},"416":{"position":[[2102,4],[4327,7]]},"419":{"position":[[5907,7]]},"432":{"position":[[1194,6],[1485,7]]},"433":{"position":[[1173,4]]},"434":{"position":[[1916,4],[2887,4]]},"500":{"position":[[85,4]]},"502":{"position":[[38,4],[530,4],[730,4]]},"503":{"position":[[76,4],[128,4]]},"507":{"position":[[362,4]]},"514":{"position":[[256,6]]},"517":{"position":[[300,4]]},"519":{"position":[[89,4],[907,4]]},"521":{"position":[[848,4],[965,6]]},"522":{"position":[[378,4]]},"540":{"position":[[84,4]]},"552":{"position":[[1066,6]]},"553":{"position":[[791,4]]},"568":{"position":[[98,4],[756,4]]},"585":{"position":[[645,6]]},"610":{"position":[[724,7]]},"611":{"position":[[955,4]]},"625":{"position":[[577,6]]},"645":{"position":[[729,4]]},"653":{"position":[[2102,4],[4327,7]]},"656":{"position":[[5907,7]]},"679":{"position":[[1194,6],[1485,7]]},"680":{"position":[[1173,4]]},"681":{"position":[[1926,4],[2897,4]]},"718":{"position":[[724,7]]},"719":{"position":[[955,4]]}},"keywords":{}}],["past",{"_index":437,"title":{},"content":{"16":{"position":[[187,5]]}},"keywords":{}}],["path",{"_index":1138,"title":{},"content":{"43":{"position":[[1035,4]]},"52":{"position":[[2244,4]]},"88":{"position":[[250,4]]},"99":{"position":[[387,4]]},"100":{"position":[[480,4]]},"101":{"position":[[334,4]]},"126":{"position":[[430,4],[896,5],[3558,4]]},"131":{"position":[[273,4],[374,4]]},"210":{"position":[[499,4]]},"250":{"position":[[250,4]]},"265":{"position":[[679,4],[784,4]]},"277":{"position":[[430,4],[896,5],[3726,4]]},"291":{"position":[[387,4]]},"292":{"position":[[480,4]]},"293":{"position":[[334,4]]},"311":{"position":[[325,4],[426,4]]},"389":{"position":[[499,4]]},"395":{"position":[[3231,4],[3333,4],[3430,4],[3676,4],[4091,4],[4105,4]]},"405":{"position":[[679,4],[784,4]]},"477":{"position":[[846,4],[1157,4]]},"488":{"position":[[250,4]]},"503":{"position":[[387,4]]},"504":{"position":[[480,4]]},"505":{"position":[[334,4]]},"514":{"position":[[430,4],[896,5],[3558,4]]},"528":{"position":[[325,4],[426,4]]},"632":{"position":[[3231,4],[3333,4],[3430,4],[3676,4],[4091,4],[4105,4]]},"642":{"position":[[679,4],[784,4]]},"659":{"position":[[499,4]]},"699":{"position":[[846,4],[1157,4]]}},"keywords":{}}],["path."",{"_index":272,"title":{},"content":{"9":{"position":[[342,13]]}},"keywords":{}}],["path/to/your/secret_key.pem",{"_index":2581,"title":{},"content":{"210":{"position":[[459,27]]},"389":{"position":[[459,27]]},"659":{"position":[[459,27]]}},"keywords":{}}],["path_to_wasm",{"_index":2582,"title":{},"content":{"210":{"position":[[504,14]]},"389":{"position":[[504,14]]},"659":{"position":[[504,14]]}},"keywords":{}}],["path_to_your_key]/secret_key.pem",{"_index":1649,"title":{},"content":{"99":{"position":[[308,33]]},"100":{"position":[[402,33]]},"101":{"position":[[256,33]]},"291":{"position":[[308,33]]},"292":{"position":[[402,33]]},"293":{"position":[[256,33]]},"503":{"position":[[308,33]]},"504":{"position":[[402,33]]},"505":{"position":[[256,33]]}},"keywords":{}}],["pattern",{"_index":899,"title":{},"content":{"39":{"position":[[136,7]]},"618":{"position":[[193,7]]},"726":{"position":[[193,7]]}},"keywords":{}}],["paus",{"_index":2694,"title":{},"content":{"218":{"position":[[94,6]]},"219":{"position":[[154,6],[433,6]]},"220":{"position":[[104,7],[168,8]]},"221":{"position":[[744,7],[829,7],[935,7]]},"222":{"position":[[392,7],[494,8],[507,6]]},"223":{"position":[[265,8]]},"451":{"position":[[94,6]]},"452":{"position":[[154,6],[388,6]]},"453":{"position":[[104,7],[168,8]]},"454":{"position":[[744,7],[829,7],[935,7]]},"455":{"position":[[392,7],[494,8],[507,6]]},"456":{"position":[[265,8]]},"691":{"position":[[94,6]]},"692":{"position":[[154,6],[388,6]]},"693":{"position":[[104,7],[168,8]]},"694":{"position":[[744,7],[829,7],[935,7]]},"695":{"position":[[392,7],[494,8],[507,6]]},"696":{"position":[[265,8]]}},"keywords":{}}],["pausabl",{"_index":2302,"title":{"217":{"position":[[0,8]]},"223":{"position":[[0,8]]},"450":{"position":[[0,8]]},"456":{"position":[[0,8]]},"690":{"position":[[0,8]]},"696":{"position":[[0,8]]}},"content":{"190":{"position":[[0,9]]},"220":{"position":[[200,8]]},"221":{"position":[[62,8]]},"222":{"position":[[79,8]]},"223":{"position":[[167,8]]},"367":{"position":[[0,9]]},"453":{"position":[[200,8]]},"454":{"position":[[62,8]]},"455":{"position":[[79,8]]},"456":{"position":[[167,8]]},"583":{"position":[[0,9]]},"693":{"position":[[200,8]]},"694":{"position":[[62,8]]},"695":{"position":[[79,8]]},"696":{"position":[[167,8]]}},"keywords":{}}],["pausablecount",{"_index":2731,"title":{},"content":{"223":{"position":[[107,16],[343,15],[444,15]]},"456":{"position":[[107,16],[343,15],[444,15]]},"696":{"position":[[107,16],[343,15],[444,15]]}},"keywords":{}}],["pausablecounterhostref::deploy(&test_env",{"_index":2740,"title":{},"content":{"223":{"position":[[967,45]]},"456":{"position":[[967,45]]},"696":{"position":[[967,45]]}},"keywords":{}}],["pause(&mut",{"_index":2721,"title":{},"content":{"222":{"position":[[97,14]]},"223":{"position":[[618,14]]},"455":{"position":[[97,14]]},"456":{"position":[[618,14]]},"695":{"position":[[97,14]]},"696":{"position":[[618,14]]}},"keywords":{}}],["pauseabl",{"_index":2734,"title":{},"content":{"223":{"position":[[384,10]]},"456":{"position":[[384,10]]},"696":{"position":[[384,10]]}},"keywords":{}}],["pauseable.r",{"_index":2702,"title":{},"content":{"219":{"position":[[219,12]]},"220":{"position":[[112,12]]},"221":{"position":[[44,12]]},"222":{"position":[[61,12]]},"223":{"position":[[274,12]]},"452":{"position":[[219,12]]},"453":{"position":[[112,12]]},"454":{"position":[[44,12]]},"455":{"position":[[61,12]]},"456":{"position":[[274,12]]},"692":{"position":[[219,12]]},"693":{"position":[[112,12]]},"694":{"position":[[44,12]]},"695":{"position":[[61,12]]},"696":{"position":[[274,12]]}},"keywords":{}}],["paused/unpaus",{"_index":2729,"title":{},"content":{"222":{"position":[[574,18]]},"455":{"position":[[574,18]]},"695":{"position":[[574,18]]}},"keywords":{}}],["pausedrequir",{"_index":2697,"title":{},"content":{"219":{"position":[[38,15],[331,14]]},"452":{"position":[[38,15],[310,14]]},"692":{"position":[[38,15],[310,14]]}},"keywords":{}}],["pauser",{"_index":2701,"title":{},"content":{"219":{"position":[[211,7]]},"452":{"position":[[211,7]]},"692":{"position":[[211,7]]}},"keywords":{}}],["payabl",{"_index":1054,"title":{"70":{"position":[[0,8]]},"92":{"position":[[0,8]]},"234":{"position":[[0,8]]},"284":{"position":[[0,8]]},"470":{"position":[[0,8]]},"496":{"position":[[0,8]]},"608":{"position":[[0,8]]},"716":{"position":[[0,8]]}},"content":{"42":{"position":[[1043,7]]},"70":{"position":[[121,9]]},"71":{"position":[[612,7]]},"74":{"position":[[93,8]]},"92":{"position":[[646,8]]},"94":{"position":[[498,9]]},"102":{"position":[[9,7],[158,7]]},"234":{"position":[[121,9]]},"235":{"position":[[612,7]]},"238":{"position":[[93,8]]},"284":{"position":[[646,8]]},"286":{"position":[[498,9]]},"294":{"position":[[9,7],[158,7]]},"440":{"position":[[4258,7]]},"442":{"position":[[179,7]]},"470":{"position":[[121,9]]},"471":{"position":[[612,7]]},"474":{"position":[[93,8]]},"478":{"position":[[72,7]]},"496":{"position":[[646,8]]},"498":{"position":[[498,9]]},"506":{"position":[[9,7],[158,7]]},"608":{"position":[[114,7],[174,7],[758,7]]},"687":{"position":[[4258,7]]},"689":{"position":[[179,7]]},"700":{"position":[[72,7]]},"716":{"position":[[114,7],[174,7],[758,7]]}},"keywords":{}}],["payment",{"_index":1140,"title":{},"content":{"43":{"position":[[1062,7]]},"99":{"position":[[346,7]]},"100":{"position":[[440,7]]},"101":{"position":[[294,7]]},"210":{"position":[[523,7],[1259,7]]},"291":{"position":[[346,7]]},"292":{"position":[[440,7]]},"293":{"position":[[294,7]]},"389":{"position":[[523,7],[1196,7]]},"503":{"position":[[346,7]]},"504":{"position":[[440,7]]},"505":{"position":[[294,7]]},"659":{"position":[[523,7],[1196,7]]}},"keywords":{}}],["pend",{"_index":3719,"title":{},"content":{"602":{"position":[[109,8]]},"710":{"position":[[109,8]]}},"keywords":{}}],["peopl",{"_index":629,"title":{},"content":{"21":{"position":[[219,6]]},"38":{"position":[[306,6]]}},"keywords":{}}],["perfect",{"_index":1181,"title":{},"content":{"50":{"position":[[418,7]]}},"keywords":{}}],["perform",{"_index":185,"title":{},"content":{"5":{"position":[[256,7]]},"39":{"position":[[188,8]]},"53":{"position":[[1163,9]]},"184":{"position":[[36,9]]},"267":{"position":[[2433,9]]},"375":{"position":[[36,9]]},"407":{"position":[[2433,9]]},"416":{"position":[[3471,7],[4292,7]]},"419":{"position":[[5050,7],[5872,7]]},"591":{"position":[[36,9]]},"598":{"position":[[2142,7]]},"600":{"position":[[1047,7]]},"606":{"position":[[642,7]]},"644":{"position":[[2433,9]]},"653":{"position":[[3471,7],[4292,7]]},"656":{"position":[[5050,7],[5872,7]]},"706":{"position":[[2142,7]]},"708":{"position":[[1047,7]]},"714":{"position":[[642,7]]}},"keywords":{}}],["permiss",{"_index":3272,"title":{},"content":{"416":{"position":[[4875,12]]},"653":{"position":[[4875,12]]}},"keywords":{}}],["permit",{"_index":2437,"title":{},"content":{"202":{"position":[[273,9]]},"422":{"position":[[273,9]]},"664":{"position":[[273,9]]}},"keywords":{}}],["persist",{"_index":1992,"title":{},"content":{"146":{"position":[[579,9],[718,10]]},"147":{"position":[[1405,9]]},"334":{"position":[[583,9],[722,10]]},"335":{"position":[[1413,9]]},"551":{"position":[[583,9],[722,10]]},"552":{"position":[[1413,9]]}},"keywords":{}}],["perspect",{"_index":581,"title":{"83":{"position":[[10,12]]},"84":{"position":[[5,12]]},"252":{"position":[[10,12]]},"253":{"position":[[5,12]]},"483":{"position":[[10,12]]},"484":{"position":[[5,12]]}},"content":{"20":{"position":[[282,11]]},"110":{"position":[[122,11]]},"305":{"position":[[122,11]]},"510":{"position":[[122,11]]}},"keywords":{}}],["phase",{"_index":23,"title":{},"content":{"1":{"position":[[230,5]]}},"keywords":{}}],["pick",{"_index":262,"title":{},"content":{"9":{"position":[[120,4]]},"115":{"position":[[1774,7]]},"258":{"position":[[1720,7]]},"481":{"position":[[1720,7]]}},"keywords":{}}],["piec",{"_index":2009,"title":{},"content":{"148":{"position":[[612,5]]},"336":{"position":[[612,5]]},"553":{"position":[[612,5]]}},"keywords":{}}],["pipelin",{"_index":1014,"title":{},"content":{"40":{"position":[[64,8]]}},"keywords":{}}],["place",{"_index":378,"title":{},"content":{"12":{"position":[[21,5]]},"65":{"position":[[588,6]]},"121":{"position":[[222,6]]},"126":{"position":[[1112,6]]},"240":{"position":[[588,6]]},"247":{"position":[[1629,5]]},"277":{"position":[[1280,6]]},"302":{"position":[[222,6]]},"446":{"position":[[1629,5]]},"465":{"position":[[588,6]]},"514":{"position":[[1112,6]]},"523":{"position":[[222,6]]},"594":{"position":[[145,6]]},"673":{"position":[[1629,5]]},"702":{"position":[[145,6]]}},"keywords":{}}],["plain",{"_index":962,"title":{},"content":{"39":{"position":[[1885,5]]},"209":{"position":[[74,5]]},"388":{"position":[[74,5]]},"658":{"position":[[74,5]]}},"keywords":{}}],["plan",{"_index":140,"title":{},"content":{"3":{"position":[[345,5]]}},"keywords":{}}],["plascoin",{"_index":1111,"title":{},"content":{"43":{"position":[[170,8]]}},"keywords":{}}],["plascoin.sol",{"_index":1109,"title":{},"content":{"43":{"position":[[121,12]]}},"keywords":{}}],["platform",{"_index":606,"title":{},"content":{"20":{"position":[[847,8]]},"50":{"position":[[29,8],[97,8]]}},"keywords":{}}],["play",{"_index":135,"title":{},"content":{"3":{"position":[[247,4]]},"38":{"position":[[1198,5]]},"51":{"position":[[1669,5]]}},"keywords":{}}],["pleas",{"_index":1427,"title":{},"content":{"76":{"position":[[916,6]]},"99":{"position":[[704,6]]},"173":{"position":[[278,6]]},"227":{"position":[[916,6]]},"270":{"position":[[74,6]]},"291":{"position":[[704,6]]},"359":{"position":[[278,6]]},"385":{"position":[[74,6]]},"393":{"position":[[81,6]]},"410":{"position":[[74,6]]},"458":{"position":[[916,6]]},"503":{"position":[[704,6]]},"575":{"position":[[278,6]]},"627":{"position":[[74,6]]},"630":{"position":[[81,6]]},"647":{"position":[[74,6]]}},"keywords":{}}],["pobiarżyn",{"_index":574,"title":{},"content":{"20":{"position":[[121,9]]}},"keywords":{}}],["poc",{"_index":1315,"title":{},"content":{"54":{"position":[[147,4]]}},"keywords":{}}],["point",{"_index":119,"title":{},"content":{"2":{"position":[[613,5]]},"10":{"position":[[825,5]]},"18":{"position":[[284,6]]},"22":{"position":[[629,7],[975,7]]},"40":{"position":[[425,6]]},"42":{"position":[[1335,7],[1810,7]]},"43":{"position":[[1949,7]]},"97":{"position":[[18,5]]},"102":{"position":[[23,6],[172,6],[383,5]]},"103":{"position":[[258,5],[380,6]]},"185":{"position":[[2900,5],[3796,5],[3974,6]]},"198":{"position":[[1637,5]]},"210":{"position":[[1345,5]]},"289":{"position":[[18,5]]},"294":{"position":[[23,6],[172,6],[383,5]]},"295":{"position":[[258,5],[380,6]]},"324":{"position":[[969,5]]},"376":{"position":[[2884,5],[3780,5],[3958,6]]},"389":{"position":[[1282,5]]},"434":{"position":[[1627,5]]},"441":{"position":[[3952,5]]},"501":{"position":[[18,5]]},"506":{"position":[[23,6],[172,6],[383,5]]},"507":{"position":[[258,5],[380,6]]},"542":{"position":[[969,5]]},"592":{"position":[[2884,5],[3780,5],[3958,6]]},"598":{"position":[[2116,6],[2215,6]]},"600":{"position":[[1021,6],[1120,6]]},"604":{"position":[[34,5]]},"659":{"position":[[1282,5]]},"681":{"position":[[1637,5]]},"688":{"position":[[3952,5]]},"706":{"position":[[2116,6],[2215,6]]},"708":{"position":[[1021,6],[1120,6]]},"712":{"position":[[34,5]]}},"keywords":{}}],["polkadot",{"_index":602,"title":{},"content":{"20":{"position":[[778,9]]}},"keywords":{}}],["pop",{"_index":588,"title":{},"content":{"20":{"position":[[472,4]]}},"keywords":{}}],["pop_vec(&mut",{"_index":3710,"title":{},"content":{"601":{"position":[[1634,16]]},"709":{"position":[[1634,16]]}},"keywords":{}}],["popul",{"_index":590,"title":{},"content":{"20":{"position":[[489,9]]}},"keywords":{}}],["port",{"_index":384,"title":{},"content":{"12":{"position":[[182,4]]}},"keywords":{}}],["portabl",{"_index":607,"title":{},"content":{"20":{"position":[[863,9]]}},"keywords":{}}],["posit",{"_index":568,"title":{},"content":{"20":{"position":[[56,8]]}},"keywords":{}}],["possess",{"_index":1629,"title":{},"content":{"95":{"position":[[304,9]]},"287":{"position":[[304,9]]},"419":{"position":[[1807,7]]},"499":{"position":[[304,9]]},"656":{"position":[[1807,7]]}},"keywords":{}}],["possibl",{"_index":181,"title":{},"content":{"5":{"position":[[211,8]]},"12":{"position":[[38,8]]},"72":{"position":[[50,11]]},"115":{"position":[[3205,13]]},"127":{"position":[[868,9]]},"128":{"position":[[112,8]]},"129":{"position":[[6,8]]},"236":{"position":[[50,11]]},"258":{"position":[[3131,13]]},"278":{"position":[[868,9]]},"279":{"position":[[112,8]]},"280":{"position":[[6,8]]},"472":{"position":[[50,11]]},"481":{"position":[[3131,13]]},"515":{"position":[[868,9]]},"516":{"position":[[112,8]]},"517":{"position":[[6,8]]}},"keywords":{}}],["post",{"_index":14,"title":{},"content":{"1":{"position":[[125,5]]},"185":{"position":[[3590,4]]},"376":{"position":[[3574,4]]},"592":{"position":[[3574,4]]}},"keywords":{}}],["potenti",{"_index":78,"title":{},"content":{"1":{"position":[[958,9]]},"44":{"position":[[68,10]]},"50":{"position":[[404,11]]},"248":{"position":[[221,9]]},"447":{"position":[[221,9]]},"612":{"position":[[1745,9]]},"618":{"position":[[394,9]]},"674":{"position":[[221,9]]},"720":{"position":[[1745,9]]},"726":{"position":[[394,9]]}},"keywords":{}}],["power",{"_index":3228,"title":{},"content":{"416":{"position":[[1165,5]]},"417":{"position":[[1194,8],[1517,5]]},"419":{"position":[[7609,8],[7932,5]]},"653":{"position":[[1165,5]]},"654":{"position":[[1194,8],[1517,5]]},"656":{"position":[[7609,8],[7932,5]]}},"keywords":{}}],["powerhous",{"_index":1749,"title":{},"content":{"115":{"position":[[3116,10]]},"258":{"position":[[3042,10]]},"481":{"position":[[3042,10]]}},"keywords":{}}],["practic",{"_index":3608,"title":{},"content":{"594":{"position":[[394,9]]},"606":{"position":[[873,12]]},"702":{"position":[[394,9]]},"714":{"position":[[873,12]]}},"keywords":{}}],["pragma",{"_index":1049,"title":{},"content":{"42":{"position":[[906,6]]}},"keywords":{}}],["pragmat",{"_index":643,"title":{},"content":{"22":{"position":[[102,9]]},"38":{"position":[[120,9]]}},"keywords":{}}],["precompil",{"_index":783,"title":{},"content":{"31":{"position":[[2155,11]]}},"keywords":{}}],["predefin",{"_index":1628,"title":{},"content":{"95":{"position":[[270,10]]},"198":{"position":[[3153,10]]},"287":{"position":[[270,10]]},"434":{"position":[[3135,10]]},"499":{"position":[[270,10]]},"681":{"position":[[3153,10]]}},"keywords":{}}],["predict",{"_index":147,"title":{},"content":{"3":{"position":[[416,14]]},"39":{"position":[[1375,11]]}},"keywords":{}}],["prefer",{"_index":2007,"title":{},"content":{"148":{"position":[[475,6]]},"336":{"position":[[475,6]]},"478":{"position":[[299,7]]},"553":{"position":[[475,6]]},"700":{"position":[[299,7]]}},"keywords":{}}],["prefix",{"_index":1535,"title":{},"content":{"85":{"position":[[255,6],[498,7],[599,7]]},"129":{"position":[[239,6]]},"211":{"position":[[158,7],[280,7],[396,7]]},"254":{"position":[[255,6],[498,7],[599,7]]},"268":{"position":[[2131,6],[2191,6]]},"280":{"position":[[239,6]]},"390":{"position":[[158,7],[280,7],[383,7]]},"408":{"position":[[2131,6],[2191,6]]},"485":{"position":[[255,6],[498,7],[599,7]]},"517":{"position":[[239,6]]},"645":{"position":[[2131,6],[2191,6]]},"660":{"position":[[158,7],[280,7],[383,7]]}},"keywords":{}}],["prelud",{"_index":1715,"title":{},"content":{"115":{"position":[[178,10],[1980,10]]},"168":{"position":[[475,12]]},"209":{"position":[[422,11]]},"258":{"position":[[168,10],[1926,10]]},"269":{"position":[[4010,10]]},"318":{"position":[[281,12]]},"348":{"position":[[475,12]]},"388":{"position":[[422,11]]},"409":{"position":[[4010,10]]},"419":{"position":[[94,11]]},"440":{"position":[[157,11]]},"441":{"position":[[629,11]]},"481":{"position":[[168,10],[1926,10]]},"544":{"position":[[281,12]]},"564":{"position":[[475,12]]},"598":{"position":[[105,11]]},"600":{"position":[[44,11]]},"608":{"position":[[44,11]]},"613":{"position":[[44,11]]},"616":{"position":[[67,11]]},"646":{"position":[[4010,10]]},"656":{"position":[[94,11]]},"658":{"position":[[422,11]]},"687":{"position":[[157,11]]},"688":{"position":[[629,11]]},"706":{"position":[[105,11]]},"708":{"position":[[44,11]]},"716":{"position":[[44,11]]},"721":{"position":[[44,11]]},"724":{"position":[[67,11]]}},"keywords":{}}],["prepar",{"_index":94,"title":{},"content":{"2":{"position":[[81,8]]},"3":{"position":[[300,8]]},"31":{"position":[[1948,7]]},"52":{"position":[[475,7],[2220,9]]},"163":{"position":[[1396,8]]},"168":{"position":[[1946,8]]},"348":{"position":[[1946,8]]},"352":{"position":[[1418,8]]},"564":{"position":[[1946,8]]},"568":{"position":[[1418,8]]}},"keywords":{}}],["prerequisit",{"_index":2147,"title":{"173":{"position":[[0,14]]},"260":{"position":[[3,14]]},"359":{"position":[[0,14]]},"378":{"position":[[3,14]]},"400":{"position":[[3,14]]},"575":{"position":[[0,14]]},"595":{"position":[[0,14]]},"620":{"position":[[3,14]]},"637":{"position":[[3,14]]},"703":{"position":[[0,14]]}},"content":{},"keywords":{}}],["present",{"_index":270,"title":{},"content":{"9":{"position":[[317,7]]},"16":{"position":[[438,7]]},"85":{"position":[[412,9]]},"124":{"position":[[105,9]]},"129":{"position":[[475,7]]},"205":{"position":[[178,7]]},"254":{"position":[[412,9]]},"280":{"position":[[475,7]]},"309":{"position":[[105,9]]},"425":{"position":[[178,7]]},"441":{"position":[[4501,9]]},"485":{"position":[[412,9]]},"517":{"position":[[475,7]]},"526":{"position":[[105,9]]},"667":{"position":[[178,7]]},"688":{"position":[[4501,9]]}},"keywords":{}}],["pretend",{"_index":1941,"title":{},"content":{"141":{"position":[[1080,7]]},"326":{"position":[[1080,7]]},"535":{"position":[[1080,7]]}},"keywords":{}}],["pretti",{"_index":1607,"title":{},"content":{"93":{"position":[[37,6]]},"119":{"position":[[528,6]]},"145":{"position":[[27,6]]},"285":{"position":[[37,6]]},"300":{"position":[[528,6]]},"333":{"position":[[27,6]]},"497":{"position":[[37,6]]},"521":{"position":[[528,6]]},"550":{"position":[[27,6]]}},"keywords":{}}],["prev_own",{"_index":2328,"title":{},"content":{"196":{"position":[[292,11],[479,11],[1704,10]]},"197":{"position":[[432,11]]},"198":{"position":[[506,11],[838,11]]},"432":{"position":[[254,11],[416,11],[1582,10]]},"433":{"position":[[432,11]]},"434":{"position":[[501,11],[828,11]]},"679":{"position":[[254,11],[416,11],[1582,10]]},"680":{"position":[[432,11]]},"681":{"position":[[506,11],[838,11]]}},"keywords":{}}],["prevent",{"_index":1379,"title":{},"content":{"72":{"position":[[208,7]]},"236":{"position":[[208,7]]},"472":{"position":[[208,7]]},"606":{"position":[[1112,8]]},"714":{"position":[[1112,8]]}},"keywords":{}}],["previou",{"_index":1284,"title":{},"content":{"52":{"position":[[3244,8],[4890,8]]},"79":{"position":[[94,8]]},"101":{"position":[[51,8]]},"168":{"position":[[211,8]]},"184":{"position":[[915,8]]},"202":{"position":[[79,8]]},"230":{"position":[[94,8]]},"265":{"position":[[208,8]]},"267":{"position":[[1984,8]]},"293":{"position":[[51,8]]},"348":{"position":[[211,8]]},"375":{"position":[[834,8]]},"396":{"position":[[885,8]]},"405":{"position":[[208,8]]},"407":{"position":[[1984,8]]},"422":{"position":[[79,8]]},"461":{"position":[[94,8]]},"505":{"position":[[51,8]]},"564":{"position":[[211,8]]},"591":{"position":[[834,8]]},"633":{"position":[[885,8]]},"642":{"position":[[208,8]]},"644":{"position":[[1984,8]]},"664":{"position":[[79,8]]}},"keywords":{}}],["previous",{"_index":730,"title":{},"content":{"31":{"position":[[506,10]]},"101":{"position":[[644,11]]},"293":{"position":[[644,11]]},"505":{"position":[[644,11]]}},"keywords":{}}],["previous_admin_rol",{"_index":2187,"title":{},"content":{"184":{"position":[[609,20]]},"185":{"position":[[1702,19],[1845,20]]},"375":{"position":[[528,20]]},"376":{"position":[[1686,19],[1829,20]]},"591":{"position":[[528,20]]},"592":{"position":[[1686,19],[1829,20]]}},"keywords":{}}],["price",{"_index":1244,"title":{},"content":{"52":{"position":[[771,6]]},"209":{"position":[[629,7],[716,5],[1092,7],[1106,5],[1132,5]]},"212":{"position":[[528,7],[605,5],[2023,6],[2511,6],[4584,7],[4594,5],[4617,5]]},"388":{"position":[[590,7],[648,5],[1024,7],[1038,5],[1064,5]]},"391":{"position":[[528,7],[605,5],[2023,6],[2511,6],[4602,7],[4612,5],[4635,5]]},"440":{"position":[[539,6],[659,6],[1669,6],[2085,6],[2202,6]]},"441":{"position":[[2881,6],[5781,6]]},"658":{"position":[[590,7],[648,5],[1024,7],[1038,5],[1064,5]]},"661":{"position":[[528,7],[605,5],[2023,6],[2511,6],[4602,7],[4612,5],[4635,5]]},"687":{"position":[[539,6],[659,6],[1669,6],[2085,6],[2202,6]]},"688":{"position":[[2881,6],[5781,6]]}},"keywords":{}}],["price_1",{"_index":2556,"title":{},"content":{"209":{"position":[[1019,8],[1121,7]]},"388":{"position":[[951,8],[1053,7]]},"658":{"position":[[951,8],[1053,7]]}},"keywords":{}}],["price_2",{"_index":2557,"title":{},"content":{"209":{"position":[[1034,8],[1147,7]]},"388":{"position":[[966,8],[1079,7]]},"658":{"position":[[966,8],[1079,7]]}},"keywords":{}}],["prices.push(pric",{"_index":2646,"title":{},"content":{"212":{"position":[[2236,17]]},"391":{"position":[[2236,17]]},"661":{"position":[[2236,17]]}},"keywords":{}}],["primari",{"_index":939,"title":{},"content":{"39":{"position":[[1117,7]]}},"keywords":{}}],["primit",{"_index":3623,"title":{},"content":{"598":{"position":[[177,10],[665,10]]},"603":{"position":[[263,10]]},"610":{"position":[[636,10]]},"706":{"position":[[177,10],[665,10]]},"711":{"position":[[263,10]]},"718":{"position":[[636,10]]}},"keywords":{}}],["principl",{"_index":1864,"title":{},"content":{"128":{"position":[[181,9]]},"279":{"position":[[181,9]]},"516":{"position":[[181,9]]}},"keywords":{}}],["print",{"_index":292,"title":{},"content":{"9":{"position":[[924,5]]},"39":{"position":[[3148,8]]}},"keywords":{}}],["println",{"_index":3145,"title":{},"content":{"395":{"position":[[1648,9]]},"632":{"position":[[1648,9]]}},"keywords":{}}],["println!("caller'",{"_index":3575,"title":{},"content":{"477":{"position":[[2033,23]]},"699":{"position":[[2033,23]]}},"keywords":{}}],["println!("i",{"_index":294,"title":{},"content":{"9":{"position":[[943,16]]}},"keywords":{}}],["println!("owner'",{"_index":1837,"title":{},"content":{"126":{"position":[[3249,22]]},"277":{"position":[[3417,22]]},"395":{"position":[[1573,22]]},"514":{"position":[[3249,22]]},"632":{"position":[[1573,22]]}},"keywords":{}}],["println!("proof",{"_index":832,"title":{},"content":{"32":{"position":[[798,20],[1040,20]]}},"keywords":{}}],["println!("prov",{"_index":828,"title":{},"content":{"32":{"position":[[552,22],[855,22]]}},"keywords":{}}],["println!("recipient'",{"_index":1839,"title":{},"content":{"126":{"position":[[3319,26]]},"277":{"position":[[3487,26]]},"514":{"position":[[3319,26]]}},"keywords":{}}],["println!("remain",{"_index":3578,"title":{},"content":{"477":{"position":[[2202,24]]},"699":{"position":[[2202,24]]}},"keywords":{}}],["println!("token",{"_index":1825,"title":{},"content":{"126":{"position":[[2540,20],[3015,20]]},"277":{"position":[[2708,20],[3183,20]]},"395":{"position":[[969,20]]},"514":{"position":[[2540,20],[3015,20]]},"632":{"position":[[969,20]]}},"keywords":{}}],["privat",{"_index":1277,"title":{},"content":{"52":{"position":[[2295,7],[3290,7],[4911,7]]},"126":{"position":[[97,7],[183,7]]},"277":{"position":[[97,7],[183,7]]},"393":{"position":[[177,7],[364,7],[459,7]]},"395":{"position":[[677,7]]},"397":{"position":[[81,7]]},"514":{"position":[[97,7],[183,7]]},"630":{"position":[[177,7],[364,7],[459,7]]},"632":{"position":[[677,7]]},"634":{"position":[[81,7]]}},"keywords":{}}],["problem",{"_index":444,"title":{},"content":{"16":{"position":[[346,8]]},"102":{"position":[[337,7]]},"175":{"position":[[549,8]]},"294":{"position":[[337,7]]},"361":{"position":[[549,8]]},"395":{"position":[[4188,8]]},"506":{"position":[[337,7]]},"577":{"position":[[549,8]]},"632":{"position":[[4188,8]]}},"keywords":{}}],["proce",{"_index":2155,"title":{},"content":{"174":{"position":[[394,7]]},"360":{"position":[[394,7]]},"576":{"position":[[394,7]]}},"keywords":{}}],["process",{"_index":1636,"title":{},"content":{"97":{"position":[[275,8]]},"101":{"position":[[4,7]]},"115":{"position":[[1698,8]]},"120":{"position":[[149,7]]},"135":{"position":[[42,7]]},"175":{"position":[[582,8]]},"189":{"position":[[641,7]]},"198":{"position":[[1194,8]]},"258":{"position":[[1644,8]]},"261":{"position":[[31,8]]},"265":{"position":[[339,8]]},"289":{"position":[[275,8]]},"293":{"position":[[4,7]]},"301":{"position":[[149,7]]},"315":{"position":[[42,7]]},"361":{"position":[[582,8]]},"366":{"position":[[641,7]]},"379":{"position":[[31,8]]},"396":{"position":[[939,8]]},"401":{"position":[[31,8]]},"405":{"position":[[339,8]]},"415":{"position":[[21,7]]},"434":{"position":[[1184,8]]},"481":{"position":[[1644,8]]},"501":{"position":[[275,8]]},"505":{"position":[[4,7]]},"522":{"position":[[149,7]]},"532":{"position":[[42,7]]},"577":{"position":[[582,8]]},"582":{"position":[[641,7]]},"621":{"position":[[31,8]]},"633":{"position":[[939,8]]},"638":{"position":[[31,8]]},"642":{"position":[[339,8]]},"652":{"position":[[21,7]]},"681":{"position":[[1194,8]]}},"keywords":{}}],["processed"",{"_index":352,"title":{},"content":{"10":{"position":[[1081,17]]}},"keywords":{}}],["produc",{"_index":214,"title":{},"content":{"6":{"position":[[291,7]]},"8":{"position":[[177,8]]},"16":{"position":[[393,9]]},"30":{"position":[[607,8]]},"39":{"position":[[3225,8]]},"100":{"position":[[206,8]]},"292":{"position":[[206,8]]},"440":{"position":[[3745,7]]},"504":{"position":[[206,8]]},"687":{"position":[[3745,7]]}},"keywords":{}}],["product",{"_index":250,"title":{},"content":{"8":{"position":[[525,7],[579,7]]},"21":{"position":[[353,8]]}},"keywords":{}}],["profession",{"_index":40,"title":{},"content":{"1":{"position":[[462,13]]}},"keywords":{}}],["profil",{"_index":2806,"title":{},"content":{"265":{"position":[[288,8]]},"405":{"position":[[288,8]]},"642":{"position":[[288,8]]}},"keywords":{}}],["profile.dev.package."*"",{"_index":1889,"title":{},"content":{"131":{"position":[[473,35]]},"265":{"position":[[883,35]]},"311":{"position":[[525,35]]},"395":{"position":[[3563,35]]},"405":{"position":[[883,35]]},"528":{"position":[[525,35]]},"632":{"position":[[3563,35]]},"642":{"position":[[883,35]]}},"keywords":{}}],["profile.releas",{"_index":1885,"title":{},"content":{"131":{"position":[[426,17]]},"265":{"position":[[836,17]]},"311":{"position":[[478,17]]},"395":{"position":[[3516,17]]},"405":{"position":[[836,17]]},"528":{"position":[[478,17]]},"632":{"position":[[3516,17]]},"642":{"position":[[836,17]]}},"keywords":{}}],["program",{"_index":213,"title":{},"content":{"6":{"position":[[282,8]]},"8":{"position":[[4,7],[150,7]]},"9":{"position":[[27,7]]},"10":{"position":[[74,7]]},"18":{"position":[[225,11]]},"31":{"position":[[803,7]]},"32":{"position":[[37,8]]},"50":{"position":[[376,11]]},"613":{"position":[[1997,11]]},"721":{"position":[[1997,11]]}},"keywords":{}}],["progress",{"_index":3231,"title":{},"content":{"416":{"position":[[1543,9],[2760,9]]},"419":{"position":[[396,9],[445,9],[4062,9],[4715,9]]},"653":{"position":[[1543,9],[2760,9]]},"656":{"position":[[396,9],[445,9],[4062,9],[4715,9]]}},"keywords":{}}],["project",{"_index":36,"title":{"2":{"position":[[23,8]]},"117":{"position":[[9,9]]},"175":{"position":[[20,8]]},"183":{"position":[[0,7]]},"298":{"position":[[9,9]]},"361":{"position":[[20,8]]},"374":{"position":[[0,7]]},"439":{"position":[[10,8]]},"519":{"position":[[9,9]]},"577":{"position":[[20,8]]},"590":{"position":[[0,7]]},"686":{"position":[[10,8]]}},"content":{"1":{"position":[[391,8]]},"2":{"position":[[419,8],[628,8]]},"3":{"position":[[205,8]]},"12":{"position":[[330,7]]},"26":{"position":[[78,7]]},"28":{"position":[[78,7]]},"36":{"position":[[78,7]]},"42":{"position":[[51,8],[173,8],[284,7]]},"46":{"position":[[78,7]]},"48":{"position":[[78,7]]},"57":{"position":[[78,7]]},"59":{"position":[[78,7]]},"61":{"position":[[79,7]]},"63":{"position":[[79,7]]},"68":{"position":[[156,8]]},"88":{"position":[[217,8]]},"117":{"position":[[35,8],[164,7],[192,7],[464,7],[661,7],[748,9],[990,7],[1062,7],[1171,7],[1261,7],[1321,7],[1414,7]]},"119":{"position":[[53,7],[405,8]]},"131":{"position":[[541,7]]},"146":{"position":[[656,7]]},"175":{"position":[[16,8],[66,7]]},"214":{"position":[[79,7]]},"216":{"position":[[79,7]]},"225":{"position":[[79,7]]},"243":{"position":[[156,8]]},"248":{"position":[[164,7]]},"250":{"position":[[217,8]]},"264":{"position":[[181,7],[456,8],[499,9],[538,8]]},"298":{"position":[[35,8],[164,7],[192,7],[464,7],[661,7],[748,9],[990,7],[1062,7],[1171,7],[1261,7],[1321,7],[1414,7]]},"300":{"position":[[53,7],[405,8]]},"311":{"position":[[593,7]]},"321":{"position":[[63,8]]},"334":{"position":[[660,7]]},"361":{"position":[[16,8],[66,7]]},"382":{"position":[[269,8],[312,9],[351,8]]},"404":{"position":[[181,7],[456,8],[499,9],[538,8]]},"414":{"position":[[30,8]]},"439":{"position":[[102,7]]},"447":{"position":[[164,7]]},"449":{"position":[[79,7]]},"468":{"position":[[156,8]]},"488":{"position":[[217,8]]},"519":{"position":[[35,8],[164,7],[192,7],[464,7],[661,7],[748,9],[990,7],[1062,7],[1171,7],[1261,7],[1321,7],[1414,7]]},"521":{"position":[[53,7],[405,8]]},"528":{"position":[[593,7]]},"539":{"position":[[63,8]]},"551":{"position":[[660,7]]},"577":{"position":[[16,8],[66,7]]},"624":{"position":[[269,8],[312,9],[351,8]]},"641":{"position":[[181,7],[456,8],[499,9],[538,8]]},"651":{"position":[[30,8]]},"674":{"position":[[164,7]]},"686":{"position":[[102,7]]}},"keywords":{}}],["project'",{"_index":1330,"title":{},"content":{"65":{"position":[[286,9]]},"117":{"position":[[346,9]]},"240":{"position":[[286,9]]},"298":{"position":[[346,9]]},"465":{"position":[[286,9]]},"519":{"position":[[346,9]]}},"keywords":{}}],["project?point",{"_index":127,"title":{},"content":{"3":{"position":[[93,13]]}},"keywords":{}}],["project_nam",{"_index":1754,"title":{},"content":{"117":{"position":[[123,15]]},"298":{"position":[[123,15]]},"519":{"position":[[123,15]]}},"keywords":{}}],["promis",{"_index":860,"title":{},"content":{"33":{"position":[[201,10]]}},"keywords":{}}],["proof",{"_index":206,"title":{},"content":{"6":{"position":[[178,5],[299,6]]},"8":{"position":[[188,5]]},"9":{"position":[[49,5]]},"10":{"position":[[37,5],[398,5],[847,5]]},"11":{"position":[[102,5]]},"32":{"position":[[1467,6],[1732,5],[1791,5]]},"33":{"position":[[58,5]]}},"keywords":{}}],["proof.anonym",{"_index":189,"title":{},"content":{"5":{"position":[[335,15]]}},"keywords":{}}],["proper",{"_index":1591,"title":{},"content":{"92":{"position":[[169,6]]},"126":{"position":[[1096,6]]},"277":{"position":[[1264,6]]},"284":{"position":[[169,6]]},"496":{"position":[[169,6]]},"514":{"position":[[1096,6]]}},"keywords":{}}],["properti",{"_index":2812,"title":{},"content":{"266":{"position":[[83,8]]},"406":{"position":[[83,8]]},"643":{"position":[[83,8]]}},"keywords":{}}],["propos",{"_index":156,"title":{},"content":{"3":{"position":[[548,7],[595,9]]},"365":{"position":[[25,8],[201,8]]},"395":{"position":[[1042,7]]},"416":{"position":[[70,7],[506,8],[949,8],[1209,9],[1286,7],[1374,8],[1499,9],[1680,7],[1840,8],[2645,8]]},"419":{"position":[[587,7],[877,8],[3893,8],[4018,9],[4197,7],[4358,8],[4600,8]]},"581":{"position":[[25,8],[201,8]]},"632":{"position":[[1042,7]]},"653":{"position":[[70,7],[506,8],[949,8],[1209,9],[1286,7],[1374,8],[1499,9],[1680,7],[1840,8],[2645,8]]},"656":{"position":[[587,7],[877,8],[3893,8],[4018,9],[4197,7],[4358,8],[4600,8]]}},"keywords":{}}],["propose_new_mint(&mut",{"_index":3230,"title":{},"content":{"416":{"position":[[1419,25]]},"419":{"position":[[3938,25]]},"653":{"position":[[1419,25]]},"656":{"position":[[3938,25]]}},"keywords":{}}],["proposed_mint",{"_index":3219,"title":{},"content":{"416":{"position":[[521,14],[888,13],[4393,14]]},"419":{"position":[[892,14],[5973,14]]},"653":{"position":[[521,14],[888,13],[4393,14]]},"656":{"position":[[892,14],[5973,14]]}},"keywords":{}}],["protocol",{"_index":594,"title":{},"content":{"20":{"position":[[524,10]]}},"keywords":{}}],["provable."",{"_index":284,"title":{},"content":{"9":{"position":[[737,17]]}},"keywords":{}}],["prove",{"_index":190,"title":{},"content":{"5":{"position":[[359,5]]},"6":{"position":[[272,5]]},"8":{"position":[[19,7],[74,5]]},"9":{"position":[[994,5]]},"15":{"position":[[15,6]]},"32":{"position":[[1703,7],[1759,7]]},"33":{"position":[[128,7]]},"168":{"position":[[282,5]]},"348":{"position":[[282,5]]},"564":{"position":[[282,5]]}},"keywords":{}}],["proven",{"_index":300,"title":{},"content":{"9":{"position":[[1111,6]]}},"keywords":{}}],["prover",{"_index":227,"title":{"9":{"position":[[0,7]]}},"content":{"7":{"position":[[196,6]]},"9":{"position":[[194,7],[364,6],[645,6]]},"32":{"position":[[1161,7],[1234,6],[1408,7]]}},"keywords":{}}],["prover.add_input_u32_slice(to_vec(&a).unwrap().as_slic",{"_index":279,"title":{},"content":{"9":{"position":[[510,63]]}},"keywords":{}}],["prover.add_input_u32_slice(to_vec(&b).unwrap().as_slic",{"_index":280,"title":{},"content":{"9":{"position":[[574,63]]}},"keywords":{}}],["prover.add_input_u32_slice(to_vec(input).unwrap().as_slic",{"_index":844,"title":{},"content":{"32":{"position":[[1330,62]]}},"keywords":{}}],["prover.run",{"_index":282,"title":{},"content":{"9":{"position":[[689,12]]}},"keywords":{}}],["prover.run().unwrap",{"_index":845,"title":{},"content":{"32":{"position":[[1430,22]]}},"keywords":{}}],["prover/src/main.r",{"_index":261,"title":{},"content":{"9":{"position":[[86,18]]}},"keywords":{}}],["prover::new(&method_cod",{"_index":841,"title":{},"content":{"32":{"position":[[1243,29]]}},"keywords":{}}],["prover::new(&multiply_src",{"_index":274,"title":{},"content":{"9":{"position":[[373,30]]}},"keywords":{}}],["provid",{"_index":1019,"title":{},"content":{"40":{"position":[[205,7]]},"76":{"position":[[141,8]]},"78":{"position":[[282,8]]},"88":{"position":[[83,8]]},"97":{"position":[[118,8]]},"102":{"position":[[556,8]]},"114":{"position":[[74,8]]},"119":{"position":[[286,7]]},"126":{"position":[[35,7],[1630,7]]},"148":{"position":[[854,8]]},"149":{"position":[[66,8]]},"162":{"position":[[621,9]]},"173":{"position":[[172,7]]},"184":{"position":[[805,8]]},"189":{"position":[[244,8]]},"198":{"position":[[3613,8]]},"227":{"position":[[141,8]]},"229":{"position":[[303,8]]},"250":{"position":[[83,8]]},"257":{"position":[[74,8]]},"270":{"position":[[462,7]]},"277":{"position":[[35,7],[1202,8],[1798,7]]},"289":{"position":[[118,8]]},"294":{"position":[[556,8]]},"300":{"position":[[286,7]]},"324":{"position":[[1359,8]]},"336":{"position":[[854,8]]},"337":{"position":[[66,8]]},"351":{"position":[[658,9]]},"359":{"position":[[172,7]]},"366":{"position":[[244,8]]},"375":{"position":[[724,8]]},"385":{"position":[[462,7]]},"398":{"position":[[308,9]]},"410":{"position":[[462,7]]},"414":{"position":[[623,8]]},"434":{"position":[[3595,8]]},"458":{"position":[[141,8]]},"460":{"position":[[303,8]]},"477":{"position":[[4088,9]]},"480":{"position":[[74,8]]},"488":{"position":[[83,8]]},"501":{"position":[[118,8]]},"506":{"position":[[556,8]]},"514":{"position":[[35,7],[1630,7]]},"521":{"position":[[286,7]]},"542":{"position":[[1359,8]]},"553":{"position":[[854,8]]},"554":{"position":[[66,8]]},"567":{"position":[[658,9]]},"575":{"position":[[172,7]]},"582":{"position":[[244,8]]},"591":{"position":[[724,8]]},"594":{"position":[[384,9]]},"598":{"position":[[1625,8]]},"600":{"position":[[808,7]]},"612":{"position":[[2055,8]]},"613":{"position":[[1440,8]]},"618":{"position":[[318,8]]},"627":{"position":[[462,7]]},"635":{"position":[[308,9]]},"647":{"position":[[462,7]]},"651":{"position":[[623,8]]},"681":{"position":[[3613,8]]},"699":{"position":[[4088,9]]},"702":{"position":[[384,9]]},"706":{"position":[[1625,8]]},"708":{"position":[[808,7]]},"720":{"position":[[2055,8]]},"721":{"position":[[1440,8]]},"726":{"position":[[318,8]]}},"keywords":{}}],["proxi",{"_index":1593,"title":{"475":{"position":[[6,5]]},"697":{"position":[[6,5]]}},"content":{"92":{"position":[[406,5]]},"146":{"position":[[207,5]]},"178":{"position":[[221,5]]},"284":{"position":[[406,5]]},"334":{"position":[[207,5]]},"369":{"position":[[221,5]]},"477":{"position":[[3157,6],[4081,6]]},"496":{"position":[[406,5]]},"551":{"position":[[207,5]]},"585":{"position":[[221,5]]},"699":{"position":[[3157,6],[4081,6]]}},"keywords":{}}],["proxy_cal",{"_index":3594,"title":{},"content":{"478":{"position":[[44,12],[163,12]]},"700":{"position":[[44,12],[163,12]]}},"keywords":{}}],["proxy_caller.wasm",{"_index":1680,"title":{"103":{"position":[[6,18]]},"295":{"position":[[6,18]]},"507":{"position":[[6,18]]}},"content":{"102":{"position":[[575,17]]},"103":{"position":[[11,17]]},"294":{"position":[[575,17]]},"295":{"position":[[11,17]]},"506":{"position":[[575,17]]},"507":{"position":[[11,17]]}},"keywords":{}}],["proxy_caller.wasmw",{"_index":1682,"title":{},"content":{"102":{"position":[[688,19]]},"294":{"position":[[688,19]]},"506":{"position":[[688,19]]}},"keywords":{}}],["pub",{"_index":237,"title":{},"content":{"8":{"position":[[240,3]]},"10":{"position":[[715,3],[867,3],[990,3]]},"17":{"position":[[427,3],[642,3],[735,3],[801,3],[924,3],[995,3],[1072,3],[1391,3],[1551,3],[1955,3],[2236,3],[2505,3],[2586,3],[2687,3],[3080,3],[3693,3],[3842,3],[3991,3]]},"22":{"position":[[1090,3],[1187,3],[1254,3],[1314,3]]},"31":{"position":[[547,3],[696,3]]},"32":{"position":[[362,3]]},"39":{"position":[[652,3],[684,3],[716,3],[730,3],[750,3],[772,3],[799,3],[1984,3],[2256,3]]},"42":{"position":[[1470,3]]},"51":{"position":[[489,3],[510,3],[588,3],[704,3],[923,3],[1036,3],[1170,3],[1196,3],[1216,3],[1236,3],[1283,3],[1301,3]]},"71":{"position":[[47,3]]},"73":{"position":[[16,3],[141,3]]},"78":{"position":[[178,3]]},"79":{"position":[[681,3],[838,3],[959,3]]},"80":{"position":[[229,3],[361,3],[440,3],[520,3],[714,3]]},"83":{"position":[[538,3]]},"84":{"position":[[214,3],[560,3]]},"108":{"position":[[97,3]]},"115":{"position":[[208,3],[333,3],[580,3],[646,3],[733,3],[796,3],[833,3],[872,3],[909,3],[952,3],[1009,3],[1103,3],[1146,3],[1210,3],[2010,3],[2176,3],[2478,3],[2544,3],[2621,3],[2685,3],[2750,3],[2810,3]]},"141":{"position":[[570,3],[1239,3]]},"146":{"position":[[127,3]]},"147":{"position":[[245,3],[713,3],[1075,3],[1197,3]]},"162":{"position":[[347,3],[764,3],[949,3],[1016,3],[1084,3],[1151,3],[1256,3],[2170,3]]},"163":{"position":[[377,3],[787,3],[935,3],[1603,3]]},"164":{"position":[[170,3],[552,3],[618,3],[685,3],[747,3],[822,3]]},"165":{"position":[[229,3],[246,3],[264,3],[277,3]]},"178":{"position":[[141,3],[551,3],[662,3],[784,3],[950,3]]},"184":{"position":[[311,3],[336,3],[352,3],[374,3],[435,3],[460,3],[476,3],[498,3],[559,3],[589,3],[605,3],[636,3],[1004,3]]},"185":{"position":[[229,3],[255,3],[374,3],[523,3],[655,3],[834,3],[1028,3],[1224,3],[1470,3],[1619,3],[1900,3],[2170,3]]},"195":{"position":[[104,3]]},"196":{"position":[[80,3],[356,3],[445,3],[475,3],[514,3]]},"197":{"position":[[46,3],[204,3],[493,3],[684,3]]},"203":{"position":[[133,3]]},"204":{"position":[[63,3],[314,3],[381,3],[452,3],[523,3],[619,3],[887,3],[909,3],[942,3],[973,3]]},"205":{"position":[[286,3],[450,3],[686,3],[927,3],[1037,3],[2095,3],[2117,3],[2137,3],[2159,3],[2198,3]]},"206":{"position":[[22,3]]},"209":{"position":[[572,3],[705,3],[817,3],[957,3],[1238,3]]},"212":{"position":[[471,3],[594,3]]},"219":{"position":[[314,3],[422,3],[442,3],[504,3],[526,3]]},"220":{"position":[[189,3]]},"221":{"position":[[73,3],[148,3],[257,3]]},"222":{"position":[[90,3],[239,3]]},"223":{"position":[[332,3],[462,3],[611,3],[667,3],[727,3]]},"229":{"position":[[178,3]]},"230":{"position":[[698,3],[855,3],[976,3]]},"231":{"position":[[229,3],[361,3],[440,3],[520,3],[714,3]]},"235":{"position":[[47,3]]},"237":{"position":[[16,3],[141,3]]},"246":{"position":[[219,3]]},"247":{"position":[[98,3],[317,3],[375,3],[437,3],[499,3],[571,3],[669,3],[793,3],[912,3],[1069,3],[1182,3],[1253,3],[1363,3]]},"252":{"position":[[538,3]]},"253":{"position":[[214,3],[560,3]]},"258":{"position":[[198,3],[323,3],[1156,3],[1956,3],[2122,3],[2736,3]]},"267":{"position":[[934,3],[1080,3],[1314,3],[1587,3],[1609,3],[1642,3],[1673,3],[3336,3],[3863,3]]},"269":{"position":[[301,3],[551,3],[1032,3],[1196,3],[1432,3],[1673,3],[1783,3],[1926,3],[2153,3],[3264,3],[3390,3],[3412,3],[3445,3],[3476,3],[3534,3],[3556,3],[3576,3],[3598,3],[3618,3],[3677,3]]},"275":{"position":[[101,3]]},"321":{"position":[[929,3],[1114,3],[1332,3],[1486,3],[1719,3],[1862,3],[2051,3],[2187,3]]},"326":{"position":[[570,3],[1239,3]]},"334":{"position":[[127,3]]},"335":{"position":[[245,3],[721,3],[1083,3],[1205,3]]},"351":{"position":[[384,3],[786,3],[971,3],[1038,3],[1106,3],[1173,3],[1278,3],[2192,3]]},"352":{"position":[[399,3],[809,3],[957,3],[1625,3]]},"353":{"position":[[205,3],[587,3],[653,3],[720,3],[782,3],[857,3]]},"354":{"position":[[267,3],[284,3],[302,3],[315,3]]},"369":{"position":[[141,3],[551,3],[662,3],[784,3],[950,3]]},"375":{"position":[[278,3],[303,3],[319,3],[341,3],[378,3],[403,3],[419,3],[441,3],[478,3],[508,3],[524,3],[555,3],[901,3]]},"376":{"position":[[213,3],[239,3],[358,3],[507,3],[639,3],[818,3],[1012,3],[1208,3],[1454,3],[1603,3],[1884,3],[2154,3]]},"383":{"position":[[353,3],[370,3],[388,3],[401,3],[709,3],[760,3],[1109,3],[1131,3],[1164,3],[1195,3]]},"384":{"position":[[314,3],[564,3],[1045,3],[1209,3],[1445,3],[1686,3],[1803,3],[1946,3],[2173,3],[3305,3],[3400,3],[3422,3],[3455,3],[3486,3],[3520,3],[3542,3],[3562,3],[3584,3],[3604,3],[3641,3]]},"388":{"position":[[533,3],[637,3],[749,3],[889,3],[1170,3]]},"391":{"position":[[471,3],[594,3]]},"395":{"position":[[1766,3]]},"407":{"position":[[934,3],[1080,3],[1314,3],[1587,3],[1609,3],[1642,3],[1673,3],[3336,3],[3863,3]]},"409":{"position":[[301,3],[551,3],[1032,3],[1196,3],[1432,3],[1673,3],[1783,3],[1926,3],[2153,3],[3264,3],[3390,3],[3412,3],[3445,3],[3476,3],[3534,3],[3556,3],[3576,3],[3598,3],[3618,3],[3677,3]]},"414":{"position":[[213,3]]},"416":{"position":[[385,3],[1412,3],[2660,3],[3490,3]]},"419":{"position":[[342,3],[757,3],[1363,3],[3931,3],[4615,3],[5069,3]]},"423":{"position":[[133,3]]},"424":{"position":[[38,3],[289,3],[356,3],[427,3],[498,3],[594,3],[838,3],[860,3],[893,3],[924,3]]},"425":{"position":[[261,3],[425,3],[661,3],[902,3],[1012,3],[2046,3],[2068,3],[2088,3],[2110,3],[2148,3]]},"426":{"position":[[22,3]]},"431":{"position":[[104,3]]},"432":{"position":[[42,3],[317,3],[382,3],[412,3],[451,3]]},"433":{"position":[[46,3],[204,3],[493,3],[683,3]]},"440":{"position":[[389,3],[433,3],[495,3],[591,3],[689,3],[774,3],[974,3],[1150,3],[1614,3],[2232,3],[3244,3],[6238,3]]},"441":{"position":[[692,3],[770,3],[881,3],[1071,3],[1526,3],[2280,3],[2362,3],[2464,3],[2826,3],[3107,3]]},"445":{"position":[[219,3]]},"446":{"position":[[98,3],[317,3],[375,3],[437,3],[499,3],[571,3],[669,3],[793,3],[912,3],[1069,3],[1182,3],[1253,3],[1363,3]]},"452":{"position":[[293,3],[377,3],[397,3],[435,3],[457,3]]},"453":{"position":[[189,3]]},"454":{"position":[[73,3],[148,3],[257,3]]},"455":{"position":[[90,3],[239,3]]},"456":{"position":[[332,3],[462,3],[611,3],[667,3],[727,3]]},"460":{"position":[[178,3]]},"461":{"position":[[698,3],[855,3],[976,3]]},"462":{"position":[[229,3],[361,3],[440,3],[520,3],[714,3]]},"471":{"position":[[47,3]]},"473":{"position":[[16,3],[141,3]]},"476":{"position":[[249,3],[490,3],[640,3],[1214,3],[1342,3],[1469,3],[1622,3],[1739,3],[1760,3],[1782,3],[1838,3],[1862,3],[1884,3]]},"481":{"position":[[198,3],[323,3],[1156,3],[1956,3],[2122,3],[2736,3]]},"483":{"position":[[538,3]]},"484":{"position":[[214,3],[560,3]]},"492":{"position":[[101,3]]},"535":{"position":[[570,3],[1239,3]]},"539":{"position":[[929,3],[1114,3],[1332,3],[1486,3],[1719,3],[1862,3],[2051,3],[2187,3]]},"551":{"position":[[127,3]]},"552":{"position":[[245,3],[721,3],[1083,3],[1205,3]]},"567":{"position":[[384,3],[786,3],[971,3],[1038,3],[1106,3],[1173,3],[1278,3],[2192,3]]},"568":{"position":[[399,3],[809,3],[957,3],[1625,3]]},"569":{"position":[[205,3],[587,3],[653,3],[720,3],[782,3],[857,3]]},"570":{"position":[[267,3],[284,3],[302,3],[315,3]]},"585":{"position":[[141,3],[551,3],[662,3],[784,3],[950,3]]},"591":{"position":[[278,3],[303,3],[319,3],[341,3],[378,3],[403,3],[419,3],[441,3],[478,3],[508,3],[524,3],[555,3],[901,3]]},"592":{"position":[[213,3],[239,3],[358,3],[507,3],[639,3],[818,3],[1012,3],[1208,3],[1454,3],[1603,3],[1884,3],[2154,3]]},"596":{"position":[[221,3],[307,3],[380,3]]},"598":{"position":[[166,3],[678,3],[1145,3],[1228,3],[1313,3],[1457,3]]},"599":{"position":[[94,3],[149,3],[197,3]]},"600":{"position":[[78,3],[187,3],[299,3]]},"601":{"position":[[79,3],[200,3],[450,3],[541,3],[641,3],[766,3],[890,3],[999,3],[1156,3],[1319,3],[1432,3],[1503,3],[1627,3],[1732,3]]},"602":{"position":[[80,3],[175,3],[250,3],[318,3],[389,3],[457,3],[994,3],[1061,3],[1286,3],[1384,3],[1549,3],[1763,3]]},"604":{"position":[[141,3]]},"605":{"position":[[44,3],[124,3],[203,3]]},"606":{"position":[[44,3],[160,3]]},"607":{"position":[[137,5],[226,5]]},"608":{"position":[[103,3],[184,3],[269,3],[299,3],[333,3],[510,3]]},"610":{"position":[[61,3],[129,3],[213,3]]},"611":{"position":[[85,3],[174,3],[221,3],[345,3]]},"612":{"position":[[478,3],[517,3],[600,3],[664,3],[747,3],[811,3],[894,3],[981,3],[1051,3],[1138,3],[1208,3],[1296,3]]},"613":{"position":[[119,3],[379,3],[941,3]]},"616":{"position":[[128,3],[189,3],[523,3],[681,3],[970,3]]},"617":{"position":[[84,3],[174,3],[271,3],[624,3],[687,3]]},"625":{"position":[[353,3],[370,3],[388,3],[401,3],[709,3],[760,3],[1109,3],[1131,3],[1164,3],[1195,3]]},"626":{"position":[[314,3],[564,3],[1045,3],[1209,3],[1445,3],[1686,3],[1803,3],[1946,3],[2173,3],[3305,3],[3400,3],[3422,3],[3455,3],[3486,3],[3520,3],[3542,3],[3562,3],[3584,3],[3604,3],[3641,3]]},"632":{"position":[[1766,3]]},"644":{"position":[[934,3],[1080,3],[1314,3],[1587,3],[1609,3],[1642,3],[1673,3],[3336,3],[3863,3]]},"646":{"position":[[301,3],[551,3],[1032,3],[1196,3],[1432,3],[1673,3],[1783,3],[1926,3],[2153,3],[3264,3],[3390,3],[3412,3],[3445,3],[3476,3],[3534,3],[3556,3],[3576,3],[3598,3],[3618,3],[3677,3]]},"651":{"position":[[213,3]]},"653":{"position":[[385,3],[1412,3],[2660,3],[3490,3]]},"656":{"position":[[342,3],[757,3],[1363,3],[3931,3],[4615,3],[5069,3]]},"658":{"position":[[533,3],[637,3],[749,3],[889,3],[1170,3]]},"661":{"position":[[471,3],[594,3]]},"665":{"position":[[133,3]]},"666":{"position":[[38,3],[289,3],[356,3],[427,3],[498,3],[594,3],[838,3],[860,3],[893,3],[924,3]]},"667":{"position":[[261,3],[425,3],[661,3],[902,3],[1012,3],[2046,3],[2068,3],[2088,3],[2110,3],[2148,3]]},"668":{"position":[[22,3]]},"672":{"position":[[219,3]]},"673":{"position":[[98,3],[317,3],[375,3],[437,3],[499,3],[571,3],[669,3],[793,3],[912,3],[1069,3],[1182,3],[1253,3],[1363,3]]},"678":{"position":[[104,3]]},"679":{"position":[[42,3],[317,3],[382,3],[412,3],[451,3]]},"680":{"position":[[46,3],[204,3],[493,3],[683,3]]},"687":{"position":[[389,3],[433,3],[495,3],[591,3],[689,3],[774,3],[974,3],[1150,3],[1614,3],[2232,3],[3244,3],[6238,3]]},"688":{"position":[[692,3],[770,3],[881,3],[1071,3],[1526,3],[2280,3],[2362,3],[2464,3],[2826,3],[3107,3]]},"692":{"position":[[293,3],[377,3],[397,3],[435,3],[457,3]]},"693":{"position":[[189,3]]},"694":{"position":[[73,3],[148,3],[257,3]]},"695":{"position":[[90,3],[239,3]]},"696":{"position":[[332,3],[462,3],[611,3],[667,3],[727,3]]},"698":{"position":[[249,3],[490,3],[640,3],[1214,3],[1342,3],[1469,3],[1622,3],[1739,3],[1760,3],[1782,3],[1838,3],[1862,3],[1884,3]]},"704":{"position":[[221,3],[307,3],[380,3]]},"706":{"position":[[166,3],[678,3],[1145,3],[1228,3],[1313,3],[1457,3]]},"707":{"position":[[94,3],[149,3],[197,3]]},"708":{"position":[[78,3],[187,3],[299,3]]},"709":{"position":[[79,3],[200,3],[450,3],[541,3],[641,3],[766,3],[890,3],[999,3],[1156,3],[1319,3],[1432,3],[1503,3],[1627,3],[1732,3]]},"710":{"position":[[80,3],[175,3],[250,3],[318,3],[389,3],[457,3],[994,3],[1061,3],[1286,3],[1384,3],[1549,3],[1763,3]]},"712":{"position":[[141,3]]},"713":{"position":[[44,3],[124,3],[203,3]]},"714":{"position":[[44,3],[160,3]]},"715":{"position":[[137,5],[226,5]]},"716":{"position":[[103,3],[184,3],[269,3],[299,3],[333,3],[510,3]]},"718":{"position":[[61,3],[129,3],[213,3]]},"719":{"position":[[85,3],[174,3],[221,3],[345,3]]},"720":{"position":[[478,3],[517,3],[600,3],[664,3],[747,3],[811,3],[894,3],[981,3],[1051,3],[1138,3],[1208,3],[1296,3]]},"721":{"position":[[119,3],[379,3],[941,3]]},"724":{"position":[[128,3],[189,3],[523,3],[681,3],[970,3]]},"725":{"position":[[84,3],[174,3],[271,3],[624,3],[687,3]]}},"keywords":{}}],["public",{"_index":693,"title":{},"content":{"30":{"position":[[224,6],[302,6]]},"42":{"position":[[1036,6],[1154,6]]},"43":{"position":[[425,6]]},"141":{"position":[[520,6]]},"147":{"position":[[585,7]]},"204":{"position":[[1278,6],[1326,7]]},"326":{"position":[[520,6]]},"335":{"position":[[589,7]]},"415":{"position":[[135,6]]},"424":{"position":[[1228,6],[1276,7]]},"535":{"position":[[520,6]]},"552":{"position":[[589,7]]},"596":{"position":[[1039,6]]},"652":{"position":[[135,6]]},"666":{"position":[[1228,6],[1276,7]]},"704":{"position":[[1039,6]]}},"keywords":{}}],["publickey",{"_index":3566,"title":{},"content":{"477":{"position":[[1458,10]]},"699":{"position":[[1458,10]]}},"keywords":{}}],["publicwallethostref::deploy(&test_env",{"_index":2038,"title":{},"content":{"160":{"position":[[356,42]]},"345":{"position":[[356,42]]},"562":{"position":[[356,42]]}},"keywords":{}}],["publish",{"_index":1319,"title":{},"content":{"54":{"position":[[363,9]]}},"keywords":{}}],["purchas",{"_index":3339,"title":{},"content":{"438":{"position":[[176,8]]},"440":{"position":[[5998,8]]},"441":{"position":[[21,8]]},"685":{"position":[[176,8]]},"687":{"position":[[5998,8]]},"688":{"position":[[21,8]]}},"keywords":{}}],["pure",{"_index":694,"title":{"605":{"position":[[9,5]]},"713":{"position":[[9,5]]}},"content":{"30":{"position":[[231,4]]},"31":{"position":[[61,4]]},"605":{"position":[[294,4],[555,4]]},"713":{"position":[[294,4],[555,4]]}},"keywords":{}}],["purpos",{"_index":198,"title":{},"content":{"6":{"position":[[58,7]]},"39":{"position":[[86,9],[1125,7]]},"122":{"position":[[123,8]]},"131":{"position":[[618,9]]},"141":{"position":[[902,8]]},"185":{"position":[[3204,8]]},"196":{"position":[[912,8]]},"223":{"position":[[57,8]]},"303":{"position":[[123,8]]},"311":{"position":[[670,9]]},"326":{"position":[[902,8]]},"376":{"position":[[3188,8]]},"393":{"position":[[430,9]]},"432":{"position":[[850,8]]},"456":{"position":[[57,8]]},"524":{"position":[[123,8]]},"528":{"position":[[670,9]]},"535":{"position":[[902,8]]},"592":{"position":[[3188,8]]},"606":{"position":[[1055,9]]},"630":{"position":[[430,9]]},"679":{"position":[[850,8]]},"696":{"position":[[57,8]]},"714":{"position":[[1055,9]]}},"keywords":{}}],["purpose.l16",{"_index":2348,"title":{},"content":{"196":{"position":[[1553,11]]}},"keywords":{}}],["purs",{"_index":1589,"title":{},"content":{"92":{"position":[[40,6],[55,5],[93,5],[187,5],[372,6],[400,5],[493,5],[531,6],[611,5]]},"94":{"position":[[558,6],[663,5]]},"103":{"position":[[688,6]]},"284":{"position":[[40,6],[55,5],[93,5],[187,5],[372,6],[400,5],[493,5],[531,6],[611,5]]},"286":{"position":[[558,6],[663,5]]},"295":{"position":[[688,6]]},"496":{"position":[[40,6],[55,5],[93,5],[187,5],[372,6],[400,5],[493,5],[531,6],[611,5]]},"498":{"position":[[558,6],[663,5]]},"507":{"position":[[688,6]]}},"keywords":{}}],["push",{"_index":843,"title":{},"content":{"32":{"position":[[1299,4]]}},"keywords":{}}],["push_vec(&mut",{"_index":3706,"title":{},"content":{"601":{"position":[[1510,17]]},"709":{"position":[[1510,17]]}},"keywords":{}}],["put",{"_index":176,"title":{},"content":{"5":{"position":[[158,3],[300,3]]},"43":{"position":[[927,3]]},"65":{"position":[[433,3]]},"99":{"position":[[223,3]]},"100":{"position":[[317,3]]},"101":{"position":[[171,3]]},"108":{"position":[[149,3]]},"135":{"position":[[54,3]]},"136":{"position":[[65,3]]},"210":{"position":[[365,3],[1139,3]]},"240":{"position":[[433,3]]},"275":{"position":[[153,3]]},"291":{"position":[[223,3]]},"292":{"position":[[317,3]]},"293":{"position":[[171,3]]},"315":{"position":[[54,3]]},"316":{"position":[[65,3]]},"389":{"position":[[365,3],[1076,3]]},"396":{"position":[[91,3]]},"417":{"position":[[13,3]]},"419":{"position":[[1464,3]]},"465":{"position":[[433,3]]},"492":{"position":[[153,3]]},"503":{"position":[[223,3]]},"504":{"position":[[317,3]]},"505":{"position":[[171,3]]},"532":{"position":[[54,3]]},"533":{"position":[[65,3]]},"633":{"position":[[91,3]]},"654":{"position":[[13,3]]},"656":{"position":[[1464,3]]},"659":{"position":[[365,3],[1076,3]]}},"keywords":{}}],["płaskonka",{"_index":576,"title":{},"content":{"20":{"position":[[140,10]]}},"keywords":{}}],["q",{"_index":407,"title":{},"content":{"15":{"position":[[221,2],[350,2]]},"17":{"position":[[1708,2]]},"52":{"position":[[1613,1]]},"53":{"position":[[112,1]]}},"keywords":{}}],["qualifi",{"_index":1893,"title":{},"content":{"132":{"position":[[235,9]]},"312":{"position":[[235,9]]},"529":{"position":[[235,9]]}},"keywords":{}}],["qualiti",{"_index":44,"title":{},"content":{"1":{"position":[[549,7],[609,8]]}},"keywords":{}}],["queri",{"_index":450,"title":{},"content":{"17":{"position":[[69,5]]},"22":{"position":[[1015,5]]},"52":{"position":[[1582,5],[6575,5]]},"128":{"position":[[132,5],[623,5]]},"166":{"position":[[38,5]]},"279":{"position":[[132,5],[623,5]]},"355":{"position":[[38,5]]},"516":{"position":[[132,5],[623,5]]},"571":{"position":[[38,5]]}},"keywords":{}}],["query_flag",{"_index":1241,"title":{},"content":{"52":{"position":[[688,11],[1722,15]]}},"keywords":{}}],["question",{"_index":447,"title":{},"content":{"16":{"position":[[486,9]]},"24":{"position":[[103,10]]},"618":{"position":[[659,9]]},"726":{"position":[[659,9]]}},"keywords":{}}],["quick",{"_index":1226,"title":{},"content":{"52":{"position":[[204,5]]}},"keywords":{}}],["quickli",{"_index":1771,"title":{},"content":{"118":{"position":[[15,7]]},"299":{"position":[[15,7]]},"520":{"position":[[15,7]]}},"keywords":{}}],["quit",{"_index":121,"title":{},"content":{"3":{"position":[[20,5]]},"416":{"position":[[2447,5]]},"653":{"position":[[2447,5]]}},"keywords":{}}],["quot",{"_index":361,"title":{},"content":{"10":{"position":[[1424,9]]},"52":{"position":[[591,6],[659,6],[710,6],[717,6],[759,6],[872,6],[879,6],[899,6],[906,6]]},"126":{"position":[[2570,9],[3042,9],[3281,11],[3355,11]]},"212":{"position":[[247,10]]},"277":{"position":[[2738,9],[3210,9],[3449,11],[3523,11]]},"391":{"position":[[247,10]]},"395":{"position":[[999,9],[1605,11],[1692,11]]},"477":{"position":[[2066,11],[2236,11]]},"514":{"position":[[2570,9],[3042,9],[3281,11],[3355,11]]},"632":{"position":[[999,9],[1605,11],[1692,11]]},"661":{"position":[[247,10]]},"699":{"position":[[2066,11],[2236,11]]}},"keywords":{}}],["quot;".to_str",{"_index":3389,"title":{},"content":{"440":{"position":[[1840,25]]},"687":{"position":[[1840,25]]}},"keywords":{}}],["quot;../../bytecode/calculator.bin",{"_index":734,"title":{},"content":{"31":{"position":[[606,35]]}},"keywords":{}}],["quot;../odra"",{"_index":1563,"title":{},"content":{"88":{"position":[[257,20]]},"250":{"position":[[257,20]]},"477":{"position":[[853,20]]},"488":{"position":[[257,20]]},"699":{"position":[[853,20]]}},"keywords":{}}],["quot;0.1.0"",{"_index":1036,"title":{},"content":{"42":{"position":[[476,18]]},"117":{"position":[[414,17]]},"131":{"position":[[90,17]]},"265":{"position":[[492,17]]},"298":{"position":[[414,17]]},"311":{"position":[[90,17]]},"321":{"position":[[682,18]]},"323":{"position":[[518,18]]},"395":{"position":[[2595,17]]},"405":{"position":[[492,17]]},"519":{"position":[[414,17]]},"528":{"position":[[90,17]]},"539":{"position":[[682,18]]},"541":{"position":[[518,18]]},"632":{"position":[[2595,17]]},"642":{"position":[[492,17]]}},"keywords":{}}],["quot;0.8.0"",{"_index":2808,"title":{},"content":{"265":{"position":[[559,17],[608,17]]},"405":{"position":[[559,17],[608,17]]},"642":{"position":[[559,17],[608,17]]}},"keywords":{}}],["quot;0.8.1"",{"_index":1879,"title":{},"content":{"131":{"position":[[157,17],[206,17]]}},"keywords":{}}],["quot;0000000000000000000000000000000000000000000000000000000000000009"",{"_index":813,"title":{},"content":{"31":{"position":[[3665,78]]}},"keywords":{}}],["quot;0000000000000000000000000000000000000000000000000000000000000037"",{"_index":810,"title":{},"content":{"31":{"position":[[3336,78]]}},"keywords":{}}],["quot;1"",{"_index":1308,"title":{},"content":{"53":{"position":[[850,13]]}},"keywords":{}}],["quot;1.0.0"",{"_index":3600,"title":{},"content":{"528":{"position":[[157,17],[206,17],[258,17]]},"632":{"position":[[2674,18],[2762,18],[2861,18],[2941,18],[3048,18]]},"699":{"position":[[777,17],[964,18]]}},"keywords":{}}],["quot;1.1.0"",{"_index":2960,"title":{},"content":{"311":{"position":[[157,17],[206,17],[258,17]]},"395":{"position":[[2674,18],[2762,18],[2861,18],[2941,18],[3048,18]]},"477":{"position":[[777,17],[964,18]]}},"keywords":{}}],["quot;2"",{"_index":1309,"title":{},"content":{"53":{"position":[[888,13]]}},"keywords":{}}],["quot;2021"",{"_index":1757,"title":{},"content":{"117":{"position":[[442,16]]},"131":{"position":[[118,16]]},"265":{"position":[[520,16]]},"298":{"position":[[442,16]]},"311":{"position":[[118,16]]},"395":{"position":[[2623,16]]},"405":{"position":[[520,16]]},"477":{"position":[[805,16]]},"519":{"position":[[442,16]]},"528":{"position":[[118,16]]},"632":{"position":[[2623,16]]},"642":{"position":[[520,16]]},"699":{"position":[[805,16]]}},"keywords":{}}],["quot;223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef"",{"_index":3186,"title":{},"content":{"395":{"position":[[6333,77],[6437,77],[6532,76]]},"632":{"position":[[6333,77],[6437,77],[6532,76]]}},"keywords":{}}],["quot;2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361"",{"_index":3179,"title":{},"content":{"395":{"position":[[5354,77],[5458,77],[5553,76]]},"632":{"position":[[5354,77],[5458,77],[5553,76]]}},"keywords":{}}],["quot;57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e"",{"_index":3589,"title":{},"content":{"477":{"position":[[3571,77],[3666,76]]},"699":{"position":[[3571,77],[3666,76]]}},"keywords":{}}],["quot;61047ff40000000000000000000000000000000000000000000000000000000000000004"",{"_index":836,"title":{},"content":{"32":{"position":[[922,85]]}},"keywords":{}}],["quot;61047ff4000000000000000000000000000000000000000000000000000000000000000a"",{"_index":807,"title":{},"content":{"31":{"position":[[3193,85]]}},"keywords":{}}],["quot;65b1a5d21..."",{"_index":1852,"title":{},"content":{"127":{"position":[[376,25],[428,25],[471,24]]},"278":{"position":[[376,25],[428,25],[471,24]]},"515":{"position":[[376,25],[428,25],[471,24]]}},"keywords":{}}],["quot;74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558"",{"_index":3584,"title":{},"content":{"477":{"position":[[2707,77],[2802,76]]},"699":{"position":[[2707,77],[2802,76]]}},"keywords":{}}],["quot;771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002"",{"_index":812,"title":{},"content":{"31":{"position":[[3458,149]]},"32":{"position":[[616,149]]}},"keywords":{}}],["quot;a".to_str",{"_index":3813,"title":{},"content":{"612":{"position":[[554,25]]},"720":{"position":[[554,25]]}},"keywords":{}}],["quot;aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5"",{"_index":3181,"title":{},"content":{"395":{"position":[[5813,77],[5917,77],[6012,76]]},"632":{"position":[[5813,77],[5917,77],[6012,76]]}},"keywords":{}}],["quot;access"",{"_index":3025,"title":{},"content":{"323":{"position":[[2077,19],[2370,19]]},"541":{"position":[[2077,19],[2370,19]]}},"keywords":{}}],["quot;args"",{"_index":1261,"title":{},"content":{"52":{"position":[[1246,17]]}},"keywords":{}}],["quot;arguments"",{"_index":3020,"title":{},"content":{"323":{"position":[[1834,22],[2263,22],[2782,22]]},"541":{"position":[[1834,22],[2263,22],[2782,22]]}},"keywords":{}}],["quot;authors"",{"_index":2992,"title":{},"content":{"323":{"position":[[354,20]]},"541":{"position":[[354,20]]}},"keywords":{}}],["quot;b".to_str",{"_index":3815,"title":{},"content":{"612":{"position":[[701,25]]},"720":{"position":[[701,25]]}},"keywords":{}}],["quot;base_uri:string:'https://example.com/'"",{"_index":1667,"title":{},"content":{"100":{"position":[[829,50]]},"292":{"position":[[829,50]]},"504":{"position":[[829,50]]}},"keywords":{}}],["quot;bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3"",{"_index":3587,"title":{},"content":{"477":{"position":[[3190,77],[3285,76]]},"699":{"position":[[3190,77],[3285,76]]}},"keywords":{}}],["quot;bin/build_contract.rs"",{"_index":1882,"title":{},"content":{"131":{"position":[[280,33]]},"265":{"position":[[686,33]]},"311":{"position":[[332,33]]},"395":{"position":[[3238,33]]},"405":{"position":[[686,33]]},"528":{"position":[[332,33]]},"632":{"position":[[3238,33]]},"642":{"position":[[686,33]]}},"keywords":{}}],["quot;bin/build_schema.rs"",{"_index":1884,"title":{},"content":{"131":{"position":[[381,31]]},"265":{"position":[[791,31]]},"311":{"position":[[433,31]]},"395":{"position":[[3340,31]]},"405":{"position":[[791,31]]},"528":{"position":[[433,31]]},"632":{"position":[[3340,31]]},"642":{"position":[[791,31]]}},"keywords":{}}],["quot;bin/our_token_livenet.rs"",{"_index":3164,"title":{},"content":{"395":{"position":[[3437,36]]},"632":{"position":[[3437,36]]}},"keywords":{}}],["quot;bin/tlw_on_livenet.rs"",{"_index":3562,"title":{},"content":{"477":{"position":[[1164,33]]},"699":{"position":[[1164,33]]}},"keywords":{}}],["quot;bool"",{"_index":3038,"title":{},"content":{"323":{"position":[[3176,17],[3389,17]]},"541":{"position":[[3176,17],[3389,17]]}},"keywords":{}}],["quot;builder"",{"_index":1037,"title":{},"content":{"42":{"position":[[506,21]]}},"keywords":{}}],["quot;c".to_str",{"_index":3816,"title":{},"content":{"612":{"position":[[848,25]]},"720":{"position":[[848,25]]}},"keywords":{}}],["quot;c3",{"_index":3824,"title":{},"content":{"612":{"position":[[1502,8]]},"720":{"position":[[1502,8]]}},"keywords":{}}],["quot;call"",{"_index":3030,"title":{},"content":{"323":{"position":[[2598,17]]},"541":{"position":[[2598,17]]}},"keywords":{}}],["quot;cap:u256='{{cap}}'"",{"_index":1148,"title":{},"content":{"43":{"position":[[1510,30]]}},"keywords":{}}],["quot;casp",{"_index":2619,"title":{},"content":{"212":{"position":[[354,12]]},"391":{"position":[[354,12]]},"661":{"position":[[354,12]]}},"keywords":{}}],["quot;casper_contract_schema_version"",{"_index":2983,"title":{},"content":{"323":{"position":[[227,43]]},"541":{"position":[[227,43]]}},"keywords":{}}],["quot;cat",{"_index":3554,"title":{},"content":{"477":{"position":[[383,9]]},"699":{"position":[[383,9]]}},"keywords":{}}],["quot;cod",{"_index":299,"title":{},"content":{"9":{"position":[[1091,10]]}},"keywords":{}}],["quot;contract_name"",{"_index":2996,"title":{},"content":{"323":{"position":[[437,26]]},"541":{"position":[[437,26]]}},"keywords":{}}],["quot;contract_version"",{"_index":2997,"title":{},"content":{"323":{"position":[[488,29]]},"541":{"position":[[488,29]]}},"keywords":{}}],["quot;created"",{"_index":3000,"title":{},"content":{"323":{"position":[[600,20],[2456,20],[2493,19]]},"541":{"position":[[600,20],[2456,20],[2493,19]]}},"keywords":{}}],["quot;data"",{"_index":3005,"title":{},"content":{"323":{"position":[[830,17],[2313,17]]},"541":{"position":[[830,17],[2313,17]]}},"keywords":{}}],["quot;deposit"",{"_index":3586,"title":{},"content":{"477":{"position":[[3129,19]]},"699":{"position":[[3129,19]]}},"keywords":{}}],["quot;description"",{"_index":3001,"title":{},"content":{"323":{"position":[[621,24],[713,24],[848,24],[940,24],[1048,24],[1183,24],[1275,24],[1419,24],[1554,24],[1714,24],[1897,24],[2161,24],[2675,24],[2871,24],[3081,24],[3281,24],[3476,24],[3613,24]]},"541":{"position":[[621,24],[713,24],[848,24],[940,24],[1048,24],[1183,24],[1275,24],[1419,24],[1554,24],[1714,24],[1897,24],[2161,24],[2675,24],[2871,24],[3081,24],[3281,24],[3476,24],[3613,24]]}},"keywords":{}}],["quot;description:string='mi",{"_index":2587,"title":{},"content":{"210":{"position":[[906,28]]},"389":{"position":[[843,28]]},"659":{"position":[[843,28]]}},"keywords":{}}],["quot;dis",{"_index":1564,"title":{},"content":{"88":{"position":[[289,14]]},"250":{"position":[[289,14]]},"488":{"position":[[289,14]]}},"keywords":{}}],["quot;discriminant"",{"_index":3013,"title":{},"content":{"323":{"position":[[1477,25],[1613,25]]},"541":{"position":[[1477,25],[1613,25]]}},"keywords":{}}],["quot;e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227"",{"_index":3175,"title":{},"content":{"395":{"position":[[4687,77],[4791,77],[4886,76]]},"632":{"position":[[4687,77],[4791,77],[4886,76]]}},"keywords":{}}],["quot;entry_points"",{"_index":3015,"title":{},"content":{"323":{"position":[[1646,25]]},"541":{"position":[[1646,25]]}},"keywords":{}}],["quot;erc20_on_livenet"",{"_index":1843,"title":{},"content":{"126":{"position":[[3529,28]]},"277":{"position":[[3697,28]]},"514":{"position":[[3529,28]]}},"keywords":{}}],["quot;errors"",{"_index":3009,"title":{},"content":{"323":{"position":[[1352,19]]},"541":{"position":[[1352,19]]}},"keywords":{}}],["quot;events"",{"_index":3029,"title":{},"content":{"323":{"position":[[2414,19]]},"541":{"position":[[2414,19]]}},"keywords":{}}],["quot;events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.msgexecutecontract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm",{"_index":1293,"title":{},"content":{"52":{"position":[[5025,888]]}},"keywords":{}}],["quot;events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.msginstantiatecontract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm",{"_index":1288,"title":{},"content":{"52":{"position":[[3387,959]]}},"keywords":{}}],["quot;events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.msgstorecode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"",{"_index":1280,"title":{},"content":{"52":{"position":[[2355,649]]}},"keywords":{}}],["quot;get_data"",{"_index":3027,"title":{},"content":{"323":{"position":[[2139,21]]},"541":{"position":[[2139,21]]}},"keywords":{}}],["quot;get_value"",{"_index":1267,"title":{},"content":{"52":{"position":[[1697,24]]}},"keywords":{}}],["quot;hash",{"_index":1811,"title":{},"content":{"126":{"position":[[1702,10],[2667,10]]},"127":{"position":[[281,10]]},"142":{"position":[[328,10]]},"212":{"position":[[236,10]]},"277":{"position":[[1870,10],[2835,10]]},"278":{"position":[[281,10]]},"327":{"position":[[328,10]]},"391":{"position":[[236,10]]},"395":{"position":[[763,10],[2288,10],[5005,10],[5200,10],[5671,10],[6190,10]]},"477":{"position":[[2921,10],[3031,10],[3425,10]]},"514":{"position":[[1702,10],[2667,10]]},"515":{"position":[[281,10]]},"536":{"position":[[328,10]]},"598":{"position":[[843,10]]},"632":{"position":[[763,10],[2288,10],[5005,10],[5200,10],[5671,10],[6190,10]]},"661":{"position":[[236,10]]},"699":{"position":[[2921,10],[3031,10],[3425,10]]},"706":{"position":[[843,10]]}},"keywords":{}}],["quot;hello",{"_index":3611,"title":{},"content":{"596":{"position":[[26,11]]},"610":{"position":[[312,11],[406,11]]},"704":{"position":[[26,11]]},"718":{"position":[[312,11],[406,11]]}},"keywords":{}}],["quot;homepage"",{"_index":2995,"title":{},"content":{"323":{"position":[[409,21]]},"541":{"position":[[409,21]]}},"keywords":{}}],["quot;http://localhost:11101/rpc"",{"_index":2617,"title":{},"content":{"212":{"position":[[289,39]]},"391":{"position":[[289,39]]},"661":{"position":[[289,39]]}},"keywords":{}}],["quot;increment"",{"_index":1266,"title":{},"content":{"52":{"position":[[1520,24]]}},"keywords":{}}],["quot;init"",{"_index":1260,"title":{},"content":{"52":{"position":[[1228,17]]}},"keywords":{}}],["quot;initi",{"_index":3033,"title":{},"content":{"323":{"position":[[2700,17]]},"541":{"position":[[2700,17]]}},"keywords":{}}],["quot;initial_owner:opt_key='{{owner}}'"",{"_index":1149,"title":{},"content":{"43":{"position":[[1557,45]]}},"keywords":{}}],["quot;invalidname"",{"_index":3010,"title":{},"content":{"323":{"position":[[1394,24]]},"541":{"position":[[1394,24]]}},"keywords":{}}],["quot;invalidowner"",{"_index":3014,"title":{},"content":{"323":{"position":[[1528,25]]},"541":{"position":[[1528,25]]}},"keywords":{}}],["quot;is_contract_context"",{"_index":3024,"title":{},"content":{"323":{"position":[[2038,32],[2331,32]]},"541":{"position":[[2038,32],[2331,32]]}},"keywords":{}}],["quot;is_mutable"",{"_index":3019,"title":{},"content":{"323":{"position":[[1804,23],[2232,23]]},"541":{"position":[[1804,23],[2232,23]]}},"keywords":{}}],["quot;key"",{"_index":3007,"title":{},"content":{"323":{"position":[[1095,15],[3660,16]]},"541":{"position":[[1095,15],[3660,16]]}},"keywords":{}}],["quot;livenet"",{"_index":1845,"title":{},"content":{"126":{"position":[[3625,21]]},"277":{"position":[[3793,21]]},"395":{"position":[[3494,21]]},"477":{"position":[[1218,21]]},"514":{"position":[[3625,21]]},"632":{"position":[[3494,21]]},"699":{"position":[[1218,21]]}},"keywords":{}}],["quot;members"",{"_index":3002,"title":{},"content":{"323":{"position":[[652,20],[879,20],[1214,20]]},"541":{"position":[[652,20],[879,20],[1214,20]]}},"keywords":{}}],["quot;mi",{"_index":1286,"title":{},"content":{"52":{"position":[[3351,8]]},"212":{"position":[[4518,8],[4556,8]]},"391":{"position":[[4536,8],[4574,8]]},"661":{"position":[[4536,8],[4574,8]]}},"keywords":{}}],["quot;my_project"",{"_index":1756,"title":{},"content":{"117":{"position":[[381,22]]},"265":{"position":[[459,22]]},"298":{"position":[[381,22]]},"405":{"position":[[459,22]]},"519":{"position":[[381,22]]},"642":{"position":[[459,22]]}},"keywords":{}}],["quot;my_project::flipper"",{"_index":2813,"title":{},"content":{"266":{"position":[[145,31]]},"406":{"position":[[145,31]]},"643":{"position":[[145,31]]}},"keywords":{}}],["quot;my_project_build_contract"",{"_index":2809,"title":{},"content":{"265":{"position":[[641,37]]},"405":{"position":[[641,37]]},"642":{"position":[[641,37]]}},"keywords":{}}],["quot;my_project_build_schema"",{"_index":2810,"title":{},"content":{"265":{"position":[[748,35]]},"405":{"position":[[748,35]]},"642":{"position":[[748,35]]}},"keywords":{}}],["quot;mycontract"",{"_index":2967,"title":{},"content":{"321":{"position":[[580,23]]},"323":{"position":[[464,23]]},"539":{"position":[[580,23]]},"541":{"position":[[464,23]]}},"keywords":{}}],["quot;mycontract".to_str",{"_index":2119,"title":{},"content":{"168":{"position":[[643,34]]},"348":{"position":[[643,34]]},"564":{"position":[[643,34]]}},"keywords":{}}],["quot;mycontract.wasm"",{"_index":3032,"title":{},"content":{"323":{"position":[[2646,28]]},"541":{"position":[[2646,28]]}},"keywords":{}}],["quot;mycontract2".to_str",{"_index":2124,"title":{},"content":{"168":{"position":[[901,35]]},"348":{"position":[[901,35]]},"564":{"position":[[901,35]]}},"keywords":{}}],["quot;name"",{"_index":1259,"title":{},"content":{"52":{"position":[[1208,19],[1500,19],[1677,19]]},"323":{"position":[[582,17],[677,17],[695,17],[812,17],[904,17],[922,17],[1011,17],[1144,17],[1239,17],[1257,17],[1376,17],[1510,17],[1676,17],[1861,17],[1879,17],[2121,17],[2438,17],[2518,17],[2809,17],[3022,17],[3227,17],[3440,17],[3458,17],[3576,17]]},"541":{"position":[[582,17],[677,17],[695,17],[812,17],[904,17],[922,17],[1011,17],[1144,17],[1239,17],[1257,17],[1376,17],[1510,17],[1676,17],[1861,17],[1879,17],[2121,17],[2438,17],[2518,17],[2809,17],[3022,17],[3227,17],[3440,17],[3458,17],[3576,17]]}},"keywords":{}}],["quot;name2:string='bob'"",{"_index":2597,"title":{},"content":{"210":{"position":[[1480,30]]},"389":{"position":[[1417,30]]},"659":{"position":[[1417,30]]}},"keywords":{}}],["quot;name:string:'mynft'"",{"_index":1665,"title":{},"content":{"100":{"position":[[733,31]]},"292":{"position":[[733,31]]},"504":{"position":[[733,31]]}},"keywords":{}}],["quot;name:string='alice'"",{"_index":2596,"title":{},"content":{"210":{"position":[[1432,31]]},"389":{"position":[[1369,31]]},"659":{"position":[[1369,31]]}},"keywords":{}}],["quot;name:string='mi",{"_index":2585,"title":{},"content":{"210":{"position":[[856,21]]},"389":{"position":[[793,21]]},"659":{"position":[[793,21]]}},"keywords":{}}],["quot;name:string='{{name}}'"",{"_index":1146,"title":{},"content":{"43":{"position":[[1404,34]]}},"keywords":{}}],["quot;odra",{"_index":3159,"title":{},"content":{"395":{"position":[[3143,11]]},"477":{"position":[[741,10],[1056,11]]},"632":{"position":[[3143,11]]},"699":{"position":[[741,10],[1056,11]]}},"keywords":{}}],["quot;odra_cfg_allow_key_override"",{"_index":3036,"title":{},"content":{"323":{"position":[[3040,40]]},"541":{"position":[[3040,40]]}},"keywords":{}}],["quot;odra_cfg_allow_key_override:bool:'false'"",{"_index":1664,"title":{},"content":{"100":{"position":[[601,52]]},"101":{"position":[[459,52]]},"292":{"position":[[601,52]]},"293":{"position":[[459,52]]},"504":{"position":[[601,52]]},"505":{"position":[[459,52]]}},"keywords":{}}],["quot;odra_cfg_allow_key_override:bool:'true'"",{"_index":1143,"title":{},"content":{"43":{"position":[[1210,51]]},"99":{"position":[[517,51]]},"210":{"position":[[662,51]]},"291":{"position":[[517,51]]},"389":{"position":[[662,51]]},"503":{"position":[[517,51]]},"659":{"position":[[662,51]]}},"keywords":{}}],["quot;odra_cfg_constructor:string:'init'"",{"_index":1145,"title":{},"content":{"43":{"position":[[1341,46]]},"101":{"position":[[591,46]]},"210":{"position":[[793,46]]},"293":{"position":[[591,46]]},"505":{"position":[[591,46]]}},"keywords":{}}],["quot;odra_cfg_is_upgradable"",{"_index":3039,"title":{},"content":{"323":{"position":[[3245,35]]},"541":{"position":[[3245,35]]}},"keywords":{}}],["quot;odra_cfg_is_upgradable:bool:'true'"",{"_index":1144,"title":{},"content":{"43":{"position":[[1278,46]]},"99":{"position":[[585,46]]},"100":{"position":[[670,46]]},"101":{"position":[[528,46]]},"210":{"position":[[730,46]]},"291":{"position":[[585,46]]},"292":{"position":[[670,46]]},"293":{"position":[[528,46]]},"389":{"position":[[730,46]]},"503":{"position":[[585,46]]},"504":{"position":[[670,46]]},"505":{"position":[[528,46]]},"659":{"position":[[730,46]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name"",{"_index":3034,"title":{},"content":{"323":{"position":[[2827,43]]},"541":{"position":[[2827,43]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'counter_package_hash'"",{"_index":1652,"title":{},"content":{"99":{"position":[[428,72]]},"291":{"position":[[428,72]]},"503":{"position":[[428,72]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'my_nft'"",{"_index":1663,"title":{},"content":{"100":{"position":[[526,58]]},"292":{"position":[[526,58]]},"504":{"position":[[526,58]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'my_tokens'"",{"_index":1678,"title":{},"content":{"101":{"position":[[381,61]]},"293":{"position":[[381,61]]},"505":{"position":[[381,61]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'test_contract_package_hash'"",{"_index":2584,"title":{},"content":{"210":{"position":[[567,78]]},"389":{"position":[[567,78]]},"659":{"position":[[567,78]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'{{contract_package_hash_named_key}}'"",{"_index":1142,"title":{},"content":{"43":{"position":[[1106,87]]}},"keywords":{}}],["quot;on",{"_index":617,"title":{},"content":{"20":{"position":[[1036,9]]}},"keywords":{}}],["quot;optional"",{"_index":3021,"title":{},"content":{"323":{"position":[[1964,21],[2989,21],[3194,21],[3407,21],[3543,21],[3677,21]]},"541":{"position":[[1964,21],[2989,21],[3194,21],[3407,21],[3543,21],[3677,21]]}},"keywords":{}}],["quot;ot".to_str",{"_index":3275,"title":{},"content":{"417":{"position":[[264,27]]},"419":{"position":[[6679,27]]},"654":{"position":[[264,27]]},"656":{"position":[[6679,27]]}},"keywords":{}}],["quot;our_token_livenet"",{"_index":3163,"title":{},"content":{"395":{"position":[[3400,29]]},"632":{"position":[[3400,29]]}},"keywords":{}}],["quot;ourcoin"",{"_index":3158,"title":{},"content":{"395":{"position":[[2565,19]]},"632":{"position":[[2565,19]]}},"keywords":{}}],["quot;ourcoin_build_contract"",{"_index":3161,"title":{},"content":{"395":{"position":[[3196,34]]},"632":{"position":[[3196,34]]}},"keywords":{}}],["quot;ourcoin_build_schema"",{"_index":3162,"title":{},"content":{"395":{"position":[[3300,32]]},"632":{"position":[[3300,32]]}},"keywords":{}}],["quot;ourtoken"",{"_index":3173,"title":{},"content":{"395":{"position":[[4580,21]]},"632":{"position":[[4580,21]]}},"keywords":{}}],["quot;ourtoken".to_str",{"_index":3274,"title":{},"content":{"417":{"position":[[222,33]]},"419":{"position":[[6637,33]]},"654":{"position":[[222,33]]},"656":{"position":[[6637,33]]}},"keywords":{}}],["quot;ownedcontract".to_str",{"_index":1910,"title":{},"content":{"138":{"position":[[522,37]]},"318":{"position":[[514,37]]},"544":{"position":[[514,37]]}},"keywords":{}}],["quot;owner"",{"_index":3006,"title":{},"content":{"323":{"position":[[1029,18],[3594,18]]},"541":{"position":[[1029,18],[3594,18]]}},"keywords":{}}],["quot;partystarted"",{"_index":2033,"title":{},"content":{"157":{"position":[[636,26]]},"330":{"position":[[617,26]]},"547":{"position":[[636,26]]}},"keywords":{}}],["quot;plascoin"",{"_index":2493,"title":{},"content":{"206":{"position":[[143,21]]},"269":{"position":[[4047,21]]},"409":{"position":[[4047,21]]},"426":{"position":[[143,21]]},"646":{"position":[[4047,21]]},"668":{"position":[[143,21]]}},"keywords":{}}],["quot;pls"",{"_index":2494,"title":{},"content":{"206":{"position":[[190,16]]},"269":{"position":[[4094,16]]},"409":{"position":[[4094,16]]},"426":{"position":[[190,16]]},"646":{"position":[[4094,16]]},"668":{"position":[[190,16]]}},"keywords":{}}],["quot;price_1:u256='101'"",{"_index":2589,"title":{},"content":{"210":{"position":[[970,30]]},"389":{"position":[[907,30]]},"659":{"position":[[907,30]]}},"keywords":{}}],["quot;price_2:u256='202'"",{"_index":2590,"title":{},"content":{"210":{"position":[[1017,30]]},"389":{"position":[[954,30]]},"659":{"position":[[954,30]]}},"keywords":{}}],["quot;propose_new_mint"",{"_index":3178,"title":{},"content":{"395":{"position":[[5298,29]]},"632":{"position":[[5298,29]]}},"keywords":{}}],["quot;public"",{"_index":3026,"title":{},"content":{"323":{"position":[[2097,18],[2390,18]]},"541":{"position":[[2097,18],[2390,18]]}},"keywords":{}}],["quot;real",{"_index":2045,"title":{},"content":{"162":{"position":[[221,10]]},"351":{"position":[[221,10]]},"567":{"position":[[221,10]]}},"keywords":{}}],["quot;real"",{"_index":1697,"title":{},"content":{"107":{"position":[[254,16]]},"119":{"position":[[260,16]]},"274":{"position":[[254,16]]},"300":{"position":[[260,16]]},"491":{"position":[[254,16]]},"521":{"position":[[260,16]]}},"keywords":{}}],["quot;repository"",{"_index":2993,"title":{},"content":{"323":{"position":[[379,23]]},"541":{"position":[[379,23]]}},"keywords":{}}],["quot;request",{"_index":3114,"title":{},"content":{"394":{"position":[[300,13]]},"631":{"position":[[300,13]]}},"keywords":{}}],["quot;return",{"_index":3028,"title":{},"content":{"323":{"position":[[2186,13]]},"541":{"position":[[2186,13]]}},"keywords":{}}],["quot;return_ty"",{"_index":3022,"title":{},"content":{"323":{"position":[[1997,22],[2290,22]]},"541":{"position":[[1997,22],[2290,22]]}},"keywords":{}}],["quot;rustc",{"_index":2985,"title":{},"content":{"323":{"position":[[297,11]]},"541":{"position":[[297,11]]}},"keywords":{}}],["quot;sample"",{"_index":1878,"title":{},"content":{"131":{"position":[[61,18]]},"311":{"position":[[61,18]]},"528":{"position":[[61,18]]}},"keywords":{}}],["quot;sample::counter"",{"_index":2018,"title":{},"content":{"154":{"position":[[383,27]]},"339":{"position":[[383,27]]},"559":{"position":[[383,27]]}},"keywords":{}}],["quot;sample::flipper"",{"_index":1892,"title":{},"content":{"132":{"position":[[149,27]]},"154":{"position":[[335,27]]},"312":{"position":[[149,27]]},"339":{"position":[[335,27]]},"529":{"position":[[149,27]]},"559":{"position":[[335,27]]}},"keywords":{}}],["quot;sample_build_contract"",{"_index":1881,"title":{},"content":{"131":{"position":[[239,33]]},"311":{"position":[[291,33]]},"528":{"position":[[291,33]]}},"keywords":{}}],["quot;sample_build_schema"",{"_index":1883,"title":{},"content":{"131":{"position":[[342,31]]},"311":{"position":[[394,31]]},"528":{"position":[[394,31]]}},"keywords":{}}],["quot;set_data"",{"_index":2594,"title":{},"content":{"210":{"position":[[1351,20]]},"389":{"position":[[1288,20]]},"659":{"position":[[1288,20]]}},"keywords":{}}],["quot;src/bin/erc20_on_livenet.rs"",{"_index":1844,"title":{},"content":{"126":{"position":[[3565,39]]},"277":{"position":[[3733,39]]},"514":{"position":[[3565,39]]}},"keywords":{}}],["quot;src/status_message.rs"",{"_index":1039,"title":{},"content":{"42":{"position":[[573,34]]}},"keywords":{}}],["quot;src/status_message.sol"",{"_index":1041,"title":{},"content":{"42":{"position":[[643,35]]}},"keywords":{}}],["quot;state"",{"_index":2622,"title":{},"content":{"212":{"position":[[414,18]]},"391":{"position":[[414,18]]},"661":{"position":[[414,18]]}},"keywords":{}}],["quot;string"",{"_index":3004,"title":{},"content":{"323":{"position":[[760,18],[987,18],[1322,18],[1944,19],[2969,19],[3523,19]]},"541":{"position":[[760,18],[987,18],[1322,18],[1944,19],[2969,19],[3523,19]]}},"keywords":{}}],["quot;struct"",{"_index":2999,"title":{},"content":{"323":{"position":[[560,19],[790,19],[1122,19]]},"541":{"position":[[560,19],[790,19],[1122,19]]}},"keywords":{}}],["quot;symbol:string:'nft'"",{"_index":1666,"title":{},"content":{"100":{"position":[[781,31]]},"292":{"position":[[781,31]]},"504":{"position":[[781,31]]}},"keywords":{}}],["quot;symbol:string='{{symbol}}'"",{"_index":1147,"title":{},"content":{"43":{"position":[[1455,38]]}},"keywords":{}}],["quot;t".to_str",{"_index":3442,"title":{},"content":{"440":{"position":[[5094,26]]},"441":{"position":[[4919,26]]},"687":{"position":[[5094,26]]},"688":{"position":[[4919,26]]}},"keywords":{}}],["quot;tally"",{"_index":3185,"title":{},"content":{"395":{"position":[[6288,18]]},"632":{"position":[[6288,18]]}},"keywords":{}}],["quot;th",{"_index":3011,"title":{},"content":{"323":{"position":[[1444,9],[1579,9],[2896,9],[3106,9],[3306,9]]},"541":{"position":[[1444,9],[1579,9],[2896,9],[3106,9],[3306,9]]}},"keywords":{}}],["quot;ticket".to_str",{"_index":3441,"title":{},"content":{"440":{"position":[[5043,31]]},"441":{"position":[[4868,31]]},"687":{"position":[[5043,31]]},"688":{"position":[[4868,31]]}},"keywords":{}}],["quot;timelockwallet"",{"_index":3582,"title":{},"content":{"477":{"position":[[2588,27]]},"699":{"position":[[2588,27]]}},"keywords":{}}],["quot;tlw_on_livenet"",{"_index":3561,"title":{},"content":{"477":{"position":[[1130,26]]},"699":{"position":[[1130,26]]}},"keywords":{}}],["quot;toolchain"",{"_index":2984,"title":{},"content":{"323":{"position":[[274,22]]},"541":{"position":[[274,22]]}},"keywords":{}}],["quot;transfer"",{"_index":1850,"title":{},"content":{"127":{"position":[[328,21]]},"206":{"position":[[3289,23]]},"278":{"position":[[328,21]]},"426":{"position":[[3264,23]]},"515":{"position":[[328,21]]},"668":{"position":[[3289,23]]}},"keywords":{}}],["quot;tutori",{"_index":3146,"title":{},"content":{"395":{"position":[[1658,14]]},"632":{"position":[[1658,14]]}},"keywords":{}}],["quot;ty"",{"_index":3003,"title":{},"content":{"323":{"position":[[744,15],[971,15],[1079,15],[1306,15],[1928,15],[2477,15],[2557,15],[2953,15],[3160,15],[3373,15],[3507,15],[3644,15]]},"541":{"position":[[744,15],[971,15],[1079,15],[1306,15],[1928,15],[2477,15],[2557,15],[2953,15],[3160,15],[3373,15],[3507,15],[3644,15]]}},"keywords":{}}],["quot;types"",{"_index":2998,"title":{},"content":{"323":{"position":[[537,18]]},"541":{"position":[[537,18]]}},"keywords":{}}],["quot;unit"",{"_index":3023,"title":{},"content":{"323":{"position":[[2020,17]]},"541":{"position":[[2020,17]]}},"keywords":{}}],["quot;upd",{"_index":3017,"title":{},"content":{"323":{"position":[[1739,13]]},"541":{"position":[[1739,13]]}},"keywords":{}}],["quot;update"",{"_index":3016,"title":{},"content":{"323":{"position":[[1694,19]]},"541":{"position":[[1694,19]]}},"keywords":{}}],["quot;updated"",{"_index":3008,"title":{},"content":{"323":{"position":[[1162,20],[2536,20],[2573,19]]},"541":{"position":[[1162,20],[2536,20],[2573,19]]}},"keywords":{}}],["quot;value"",{"_index":1262,"title":{},"content":{"52":{"position":[[1268,17]]}},"keywords":{}}],["quot;value:u32:'666'"",{"_index":2595,"title":{},"content":{"210":{"position":[[1388,27]]},"389":{"position":[[1325,27]]},"659":{"position":[[1325,27]]}},"keywords":{}}],["quot;value:u32:42"",{"_index":1653,"title":{},"content":{"99":{"position":[[648,24]]},"291":{"position":[[648,24]]},"503":{"position":[[648,24]]}},"keywords":{}}],["quot;vote"",{"_index":3180,"title":{},"content":{"395":{"position":[[5769,17]]},"632":{"position":[[5769,17]]}},"keywords":{}}],["quot;wasm/ourtoken.wasm"",{"_index":3174,"title":{},"content":{"395":{"position":[[4629,31]]},"632":{"position":[[4629,31]]}},"keywords":{}}],["quot;wasm/timelockwallet.wasm"",{"_index":3583,"title":{},"content":{"477":{"position":[[2643,37]]},"699":{"position":[[2643,37]]}},"keywords":{}}],["quot;wasm_file_name"",{"_index":3031,"title":{},"content":{"323":{"position":[[2618,27]]},"541":{"position":[[2618,27]]}},"keywords":{}}],["quot;withdraw"",{"_index":3588,"title":{},"content":{"477":{"position":[[3523,21]]},"699":{"position":[[3523,21]]}},"keywords":{}}],["r",{"_index":3071,"title":{},"content":{"348":{"position":[[2074,2]]}},"keywords":{}}],["rais",{"_index":2334,"title":{},"content":{"196":{"position":[[877,5]]},"432":{"position":[[815,5]]},"679":{"position":[[815,5]]}},"keywords":{}}],["random",{"_index":3126,"title":{},"content":{"395":{"position":[[729,6]]},"632":{"position":[[729,6]]}},"keywords":{}}],["rang",{"_index":912,"title":{},"content":{"39":{"position":[[491,7]]},"85":{"position":[[79,7]]},"111":{"position":[[186,6]]},"254":{"position":[[79,7]]},"270":{"position":[[309,5]]},"306":{"position":[[186,6]]},"385":{"position":[[309,5]]},"410":{"position":[[309,5]]},"485":{"position":[[79,7]]},"511":{"position":[[186,6]]},"598":{"position":[[1552,5],[1641,5]]},"627":{"position":[[309,5]]},"647":{"position":[[309,5]]},"706":{"position":[[1552,5],[1641,5]]}},"keywords":{}}],["rapid",{"_index":641,"title":{},"content":{"22":{"position":[[73,5]]},"38":{"position":[[91,5]]}},"keywords":{}}],["raw",{"_index":2322,"title":{},"content":{"195":{"position":[[744,3]]},"431":{"position":[[744,3]]},"678":{"position":[[744,3]]}},"keywords":{}}],["raw_log",{"_index":1279,"title":{},"content":{"52":{"position":[[2346,8],[3378,8],[5016,8]]}},"keywords":{}}],["raw_mint",{"_index":3270,"title":{},"content":{"416":{"position":[[4737,8]]},"653":{"position":[[4737,8]]}},"keywords":{}}],["raw_transf",{"_index":3267,"title":{},"content":{"416":{"position":[[4585,12]]},"653":{"position":[[4585,12]]}},"keywords":{}}],["raw_transfer(&contract",{"_index":3316,"title":{},"content":{"419":{"position":[[5802,28]]},"656":{"position":[[5802,28]]}},"keywords":{}}],["raw_transfer(&mut",{"_index":2478,"title":{},"content":{"205":{"position":[[1202,21]]},"269":{"position":[[2493,21]]},"384":{"position":[[2520,21]]},"409":{"position":[[2493,21]]},"425":{"position":[[1177,21]]},"626":{"position":[[2520,21]]},"646":{"position":[[2493,21]]},"667":{"position":[[1177,21]]}},"keywords":{}}],["rc<contractenv>",{"_index":1932,"title":{},"content":{"141":{"position":[[429,22]]},"326":{"position":[[429,22]]},"535":{"position":[[429,22]]}},"keywords":{}}],["reach",{"_index":88,"title":{},"content":{"1":{"position":[[1146,5]]},"270":{"position":[[99,5]]},"385":{"position":[[99,5]]},"410":{"position":[[99,5]]},"627":{"position":[[99,5]]},"647":{"position":[[99,5]]}},"keywords":{}}],["read",{"_index":12,"title":{"208":{"position":[[18,4]]},"212":{"position":[[0,7]]},"387":{"position":[[18,4]]},"391":{"position":[[0,7]]},"657":{"position":[[18,4]]},"661":{"position":[[0,7]]}},"content":{"1":{"position":[[107,7]]},"6":{"position":[[122,7]]},"18":{"position":[[50,4]]},"51":{"position":[[225,4]]},"52":{"position":[[143,4],[194,4],[2125,4],[3144,4]]},"78":{"position":[[93,4]]},"83":{"position":[[496,7]]},"92":{"position":[[764,4]]},"94":{"position":[[568,4]]},"158":{"position":[[0,4]]},"162":{"position":[[1989,4]]},"163":{"position":[[592,4],[1174,4]]},"171":{"position":[[0,4]]},"185":{"position":[[3226,5],[3802,5]]},"197":{"position":[[934,5],[1335,4]]},"198":{"position":[[2935,4]]},"211":{"position":[[3,4]]},"212":{"position":[[866,4],[1604,4],[1712,4],[1895,4],[2120,4],[2706,4],[3120,4]]},"221":{"position":[[782,5]]},"229":{"position":[[93,4]]},"252":{"position":[[496,7]]},"284":{"position":[[764,4]]},"286":{"position":[[568,4]]},"331":{"position":[[0,4]]},"351":{"position":[[2011,4]]},"352":{"position":[[614,4],[1196,4]]},"357":{"position":[[0,4]]},"365":{"position":[[143,4],[324,4]]},"376":{"position":[[3210,5],[3786,5]]},"390":{"position":[[3,4]]},"391":{"position":[[866,4],[1604,4],[1712,4],[1895,4],[2120,4],[2712,4],[3138,4]]},"433":{"position":[[933,5],[1334,4]]},"434":{"position":[[2917,4]]},"454":{"position":[[782,5]]},"460":{"position":[[93,4]]},"483":{"position":[[496,7]]},"496":{"position":[[764,4]]},"498":{"position":[[568,4]]},"548":{"position":[[0,4]]},"567":{"position":[[2011,4]]},"568":{"position":[[614,4],[1196,4]]},"573":{"position":[[0,4]]},"581":{"position":[[143,4],[324,4]]},"592":{"position":[[3210,5],[3786,5]]},"601":{"position":[[2075,7]]},"605":{"position":[[394,4],[582,4]]},"610":{"position":[[924,4]]},"618":{"position":[[427,4]]},"660":{"position":[[3,4]]},"661":{"position":[[866,4],[1604,4],[1712,4],[1895,4],[2120,4],[2712,4],[3138,4]]},"680":{"position":[[933,5],[1334,4]]},"681":{"position":[[2935,4]]},"694":{"position":[[782,5]]},"709":{"position":[[2075,7]]},"713":{"position":[[394,4],[582,4]]},"718":{"position":[[924,4]]},"726":{"position":[[427,4]]}},"keywords":{}}],["read(key",{"_index":1516,"title":{},"content":{"83":{"position":[[567,9]]},"252":{"position":[[567,9]]},"483":{"position":[[567,9]]}},"keywords":{}}],["read_state_key(key",{"_index":2624,"title":{},"content":{"212":{"position":[[637,19]]},"391":{"position":[[637,19]]},"661":{"position":[[637,19]]}},"keywords":{}}],["read_state_key(key).await",{"_index":2640,"title":{},"content":{"212":{"position":[[1574,26],[2676,26],[3090,26]]},"391":{"position":[[1574,26],[2682,26],[3108,26]]},"661":{"position":[[1574,26],[2682,26],[3108,26]]}},"keywords":{}}],["readabl",{"_index":1318,"title":{},"content":{"54":{"position":[[310,8]]},"115":{"position":[[3164,11]]},"258":{"position":[[3090,11]]},"481":{"position":[[3090,11]]}},"keywords":{}}],["readi",{"_index":85,"title":{},"content":{"1":{"position":[[1081,5]]},"3":{"position":[[677,6]]},"39":{"position":[[3349,5]]},"52":{"position":[[1750,5]]},"100":{"position":[[921,5]]},"173":{"position":[[357,6]]},"175":{"position":[[486,5]]},"187":{"position":[[34,5]]},"199":{"position":[[22,6]]},"292":{"position":[[921,5]]},"359":{"position":[[357,6]]},"361":{"position":[[486,5]]},"364":{"position":[[34,5]]},"435":{"position":[[22,6]]},"504":{"position":[[921,5]]},"575":{"position":[[357,6]]},"577":{"position":[[486,5]]},"580":{"position":[[34,5]]},"682":{"position":[[22,6]]}},"keywords":{}}],["real",{"_index":1104,"title":{},"content":{"43":{"position":[[16,4]]},"126":{"position":[[1579,4]]},"175":{"position":[[396,4]]},"277":{"position":[[1747,4]]},"361":{"position":[[396,4]]},"395":{"position":[[1394,4]]},"416":{"position":[[2325,4]]},"514":{"position":[[1579,4]]},"577":{"position":[[396,4]]},"632":{"position":[[1394,4]]},"653":{"position":[[2325,4]]}},"keywords":{}}],["realli",{"_index":1222,"title":{},"content":{"52":{"position":[[42,6]]},"111":{"position":[[143,6]]},"128":{"position":[[285,6]]},"151":{"position":[[48,6]]},"247":{"position":[[1954,6]]},"279":{"position":[[285,6]]},"306":{"position":[[143,6]]},"342":{"position":[[48,6]]},"416":{"position":[[3212,6]]},"417":{"position":[[1749,6]]},"446":{"position":[[1954,6]]},"511":{"position":[[143,6]]},"516":{"position":[[285,6]]},"556":{"position":[[48,6]]},"653":{"position":[[3212,6]]},"654":{"position":[[1749,6]]},"673":{"position":[[1954,6]]}},"keywords":{}}],["realm",{"_index":1413,"title":{},"content":{"76":{"position":[[100,5]]},"227":{"position":[[100,5]]},"458":{"position":[[100,5]]}},"keywords":{}}],["reason",{"_index":611,"title":{},"content":{"20":{"position":[[930,6]]},"198":{"position":[[2550,6]]},"434":{"position":[[2540,6]]},"681":{"position":[[2550,6]]}},"keywords":{}}],["recap",{"_index":1410,"title":{"76":{"position":[[0,5]]},"227":{"position":[[0,5]]},"458":{"position":[[0,5]]}},"content":{"76":{"position":[[50,5]]},"227":{"position":[[50,5]]},"458":{"position":[[50,5]]}},"keywords":{}}],["receipt",{"_index":281,"title":{},"content":{"9":{"position":[[667,7],[679,7],[777,7],[1025,8]]},"10":{"position":[[1149,7]]},"32":{"position":[[1420,7]]}},"keywords":{}}],["receipt.verify(multiply_id).expect",{"_index":298,"title":{},"content":{"9":{"position":[[1055,35]]}},"keywords":{}}],["receipt::new(&journ",{"_index":354,"title":{},"content":{"10":{"position":[[1273,26]]}},"keywords":{}}],["receipt_nam",{"_index":3376,"title":{},"content":{"440":{"position":[[1275,12],[1533,13]]},"687":{"position":[[1275,12],[1533,13]]}},"keywords":{}}],["receiv",{"_index":2192,"title":{"614":{"position":[[13,7]]},"722":{"position":[[13,7]]}},"content":{"184":{"position":[[772,8]]},"188":{"position":[[327,9]]},"365":{"position":[[684,9]]},"375":{"position":[[691,8]]},"416":{"position":[[2153,8]]},"440":{"position":[[4319,7]]},"441":{"position":[[1038,8],[2113,8]]},"581":{"position":[[684,9]]},"591":{"position":[[691,8]]},"605":{"position":[[486,8]]},"608":{"position":[[726,7],[811,7]]},"613":{"position":[[1325,7]]},"614":{"position":[[24,9],[57,9],[99,9],[235,8],[356,9],[497,7]]},"653":{"position":[[2153,8]]},"687":{"position":[[4319,7]]},"688":{"position":[[1038,8],[2113,8]]},"713":{"position":[[486,8]]},"716":{"position":[[726,7],[811,7]]},"721":{"position":[[1325,7]]},"722":{"position":[[24,9],[57,9],[99,9],[235,8],[356,9],[497,7]]}},"keywords":{}}],["reciev",{"_index":3196,"title":{},"content":{"396":{"position":[[989,8]]},"633":{"position":[[989,8]]}},"keywords":{}}],["recipi",{"_index":491,"title":{},"content":{"17":{"position":[[1106,10],[1228,12],[1370,11],[1438,10],[1516,11]]},"115":{"position":[[611,10],[698,10],[2509,10],[2729,10]]},"126":{"position":[[1690,9],[1789,9]]},"205":{"position":[[317,10],[428,10],[507,10],[664,10],[1251,10]]},"206":{"position":[[1192,10],[1240,9],[1478,9],[1861,9],[2133,10],[2683,10],[3469,10]]},"247":{"position":[[824,10],[969,10],[1047,10]]},"258":{"position":[[597,10],[680,10],[2451,10],[2659,10]]},"268":{"position":[[2443,10],[2613,10]]},"269":{"position":[[1063,10],[1174,10],[1253,10],[1410,10],[2542,10],[5102,10],[5150,9],[5388,9],[5771,9]]},"277":{"position":[[1858,9],[1957,9]]},"384":{"position":[[1076,10],[1187,10],[1266,10],[1423,10],[2569,10]]},"395":{"position":[[751,9],[850,9]]},"408":{"position":[[2443,10],[2613,10]]},"409":{"position":[[1063,10],[1174,10],[1253,10],[1410,10],[2542,10],[5102,10],[5150,9],[5388,9],[5771,9]]},"419":{"position":[[3371,10],[3409,10],[3497,9],[3591,10]]},"425":{"position":[[292,10],[403,10],[482,10],[639,10],[1226,10]]},"426":{"position":[[1187,10],[1235,9],[1473,9],[1851,9],[2123,10],[2668,10],[3444,10]]},"446":{"position":[[824,10],[969,10],[1047,10]]},"481":{"position":[[597,10],[680,10],[2451,10],[2659,10]]},"514":{"position":[[1690,9],[1789,9]]},"604":{"position":[[172,10],[267,10],[375,10]]},"626":{"position":[[1076,10],[1187,10],[1266,10],[1423,10],[2569,10]]},"632":{"position":[[751,9],[850,9]]},"645":{"position":[[2443,10],[2613,10]]},"646":{"position":[[1063,10],[1174,10],[1253,10],[1410,10],[2542,10],[5102,10],[5150,9],[5388,9],[5771,9]]},"656":{"position":[[3371,10],[3409,10],[3497,9],[3591,10]]},"667":{"position":[[292,10],[403,10],[482,10],[639,10],[1226,10]]},"668":{"position":[[1192,10],[1240,9],[1478,9],[1861,9],[2133,10],[2683,10],[3469,10]]},"673":{"position":[[824,10],[969,10],[1047,10]]},"712":{"position":[[172,10],[267,10],[375,10]]}},"keywords":{}}],["recipient'",{"_index":1855,"title":{},"content":{"127":{"position":[[541,11]]},"278":{"position":[[541,11]]},"515":{"position":[[541,11]]}},"keywords":{}}],["recommend",{"_index":2347,"title":{},"content":{"196":{"position":[[1497,9]]},"265":{"position":[[276,11]]},"393":{"position":[[381,9]]},"405":{"position":[[276,11]]},"630":{"position":[[381,9]]},"642":{"position":[[276,11]]}},"keywords":{}}],["record",{"_index":1028,"title":{},"content":{"42":{"position":[[117,7],[986,8],[1258,7]]},"206":{"position":[[2454,9]]},"426":{"position":[[2444,9]]},"668":{"position":[[2454,9]]}},"keywords":{}}],["records[accountid",{"_index":1057,"title":{},"content":{"42":{"position":[[1085,18],[1199,19]]}},"keywords":{}}],["recurs",{"_index":441,"title":{},"content":{"16":{"position":[[274,9]]},"72":{"position":[[401,9]]},"236":{"position":[[401,9]]},"321":{"position":[[749,11],[873,11]]},"472":{"position":[[401,9]]},"539":{"position":[[749,11],[873,11]]}},"keywords":{}}],["redesign",{"_index":2895,"title":{"441":{"position":[[0,9]]},"688":{"position":[[0,9]]}},"content":{"267":{"position":[[4425,8]]},"407":{"position":[[4425,8]]},"440":{"position":[[6534,11]]},"644":{"position":[[4425,8]]},"687":{"position":[[6534,11]]}},"keywords":{}}],["reduc",{"_index":3771,"title":{},"content":{"606":{"position":[[1070,7]]},"714":{"position":[[1070,7]]}},"keywords":{}}],["reentranc",{"_index":1373,"title":{},"content":{"72":{"position":[[0,10],[374,10]]},"236":{"position":[[0,10],[374,10]]},"472":{"position":[[0,10],[374,10]]}},"keywords":{}}],["reentrancy"",{"_index":3765,"title":{},"content":{"606":{"position":[[418,18]]},"714":{"position":[[418,18]]}},"keywords":{}}],["reentrancymockref::new(self.env",{"_index":1389,"title":{},"content":{"73":{"position":[[221,34]]},"237":{"position":[[221,34]]},"473":{"position":[[221,34]]}},"keywords":{}}],["reentrant",{"_index":1372,"title":{"72":{"position":[[4,10]]},"236":{"position":[[4,10]]},"472":{"position":[[4,10]]}},"content":{},"keywords":{}}],["reexport",{"_index":1076,"title":{},"content":{"42":{"position":[[1645,9]]}},"keywords":{}}],["ref",{"_index":1926,"title":{"141":{"position":[[9,4]]},"326":{"position":[[9,4]]},"535":{"position":[[9,4]]}},"content":{"198":{"position":[[1762,4]]},"434":{"position":[[1752,4]]},"681":{"position":[[1762,4]]}},"keywords":{}}],["ref_recursion_not_allow",{"_index":1397,"title":{},"content":{"73":{"position":[[541,27]]},"237":{"position":[[541,27]]},"473":{"position":[[541,27]]}},"keywords":{}}],["refer",{"_index":1081,"title":{"271":{"position":[[3,11]]},"386":{"position":[[3,11]]},"411":{"position":[[3,11]]},"628":{"position":[[3,11]]},"648":{"position":[[3,11]]}},"content":{"42":{"position":[[1969,9]]},"76":{"position":[[923,5]]},"99":{"position":[[711,5]]},"141":{"position":[[66,9],[349,10],[491,9]]},"173":{"position":[[285,5]]},"198":{"position":[[1424,9],[1458,9],[2294,9]]},"227":{"position":[[923,5]]},"267":{"position":[[1932,9],[3625,9]]},"270":{"position":[[189,5]]},"291":{"position":[[711,5]]},"326":{"position":[[66,9],[349,10],[491,9]]},"359":{"position":[[285,5]]},"385":{"position":[[189,5]]},"407":{"position":[[1932,9],[3625,9]]},"410":{"position":[[189,5]]},"434":{"position":[[1414,9],[1448,9],[2284,9]]},"458":{"position":[[923,5]]},"503":{"position":[[711,5]]},"535":{"position":[[66,9],[349,10],[491,9]]},"575":{"position":[[285,5]]},"627":{"position":[[189,5]]},"644":{"position":[[1932,9],[3625,9]]},"647":{"position":[[189,5]]},"681":{"position":[[1424,9],[1458,9],[2294,9]]}},"keywords":{}}],["reflect",{"_index":1539,"title":{},"content":{"85":{"position":[[432,10]]},"254":{"position":[[432,10]]},"267":{"position":[[272,7]]},"268":{"position":[[78,7]]},"324":{"position":[[1510,11]]},"407":{"position":[[272,7]]},"408":{"position":[[78,7]]},"485":{"position":[[432,10]]},"542":{"position":[[1510,11]]},"644":{"position":[[272,7]]},"645":{"position":[[78,7]]}},"keywords":{}}],["refresh",{"_index":1425,"title":{},"content":{"76":{"position":[[889,9]]},"227":{"position":[[889,9]]},"458":{"position":[[889,9]]}},"keywords":{}}],["regard",{"_index":3057,"title":{},"content":{"324":{"position":[[1376,9]]},"542":{"position":[[1376,9]]}},"keywords":{}}],["regist",{"_index":1075,"title":{},"content":{"42":{"position":[[1605,9]]},"91":{"position":[[596,10]]},"107":{"position":[[48,8],[85,8]]},"108":{"position":[[225,10]]},"274":{"position":[[48,8],[85,8]]},"275":{"position":[[229,10]]},"283":{"position":[[596,10]]},"321":{"position":[[282,8]]},"395":{"position":[[2474,8]]},"440":{"position":[[3671,8]]},"441":{"position":[[1759,8],[2547,8],[3900,8],[3937,8]]},"491":{"position":[[48,8],[85,8]]},"492":{"position":[[229,10]]},"495":{"position":[[596,10]]},"539":{"position":[[282,8]]},"632":{"position":[[2474,8]]},"687":{"position":[[3671,8]]},"688":{"position":[[1759,8],[2547,8],[3900,8],[3937,8]]}},"keywords":{}}],["register(&mut",{"_index":3483,"title":{},"content":{"441":{"position":[[888,17]]},"688":{"position":[[888,17]]}},"keywords":{}}],["register_oper",{"_index":3514,"title":{},"content":{"441":{"position":[[3862,17]]},"688":{"position":[[3862,17]]}},"keywords":{}}],["register_operator(&mut",{"_index":3498,"title":{},"content":{"441":{"position":[[2471,26]]},"688":{"position":[[2471,26]]}},"keywords":{}}],["registri",{"_index":1701,"title":{},"content":{"108":{"position":[[243,8]]},"275":{"position":[[247,8]]},"492":{"position":[[247,8]]}},"keywords":{}}],["regular",{"_index":1467,"title":{},"content":{"79":{"position":[[1304,7]]},"138":{"position":[[918,7]]},"146":{"position":[[526,7]]},"198":{"position":[[2216,7]]},"204":{"position":[[1346,7]]},"230":{"position":[[1321,7]]},"318":{"position":[[910,7]]},"334":{"position":[[530,7]]},"424":{"position":[[1296,7]]},"434":{"position":[[2206,7]]},"461":{"position":[[1321,7]]},"544":{"position":[[910,7]]},"551":{"position":[[530,7]]},"605":{"position":[[627,7]]},"607":{"position":[[241,7]]},"610":{"position":[[505,7]]},"666":{"position":[[1296,7]]},"681":{"position":[[2216,7]]},"713":{"position":[[627,7]]},"715":{"position":[[241,7]]},"718":{"position":[[505,7]]}},"keywords":{}}],["reimplement",{"_index":2106,"title":{},"content":{"164":{"position":[[349,16]]},"353":{"position":[[384,16]]},"569":{"position":[[384,16]]}},"keywords":{}}],["reinvent",{"_index":647,"title":{},"content":{"22":{"position":[[271,11]]},"38":{"position":[[259,11]]}},"keywords":{}}],["reject",{"_index":1371,"title":{},"content":{"71":{"position":[[668,9]]},"235":{"position":[[668,9]]},"471":{"position":[[668,9]]},"602":{"position":[[137,9]]},"710":{"position":[[137,9]]}},"keywords":{}}],["relat",{"_index":3089,"title":{},"content":{"383":{"position":[[48,7]]},"625":{"position":[[48,7]]}},"keywords":{}}],["relationship",{"_index":3809,"title":{},"content":{"612":{"position":[[74,13],[2124,13]]},"720":{"position":[[74,13],[2124,13]]}},"keywords":{}}],["releas",{"_index":143,"title":{"19":{"position":[[11,8]]}},"content":{"3":{"position":[[377,9],[456,7],[718,9]]},"32":{"position":[[1687,7]]},"65":{"position":[[109,7],[375,7]]},"117":{"position":[[832,7],[1142,7],[1209,8]]},"240":{"position":[[109,7],[375,7]]},"265":{"position":[[301,7]]},"298":{"position":[[832,7],[1142,7],[1209,8]]},"405":{"position":[[301,7]]},"465":{"position":[[109,7],[375,7]]},"519":{"position":[[832,7],[1142,7],[1209,8]]},"642":{"position":[[301,7]]}},"keywords":{}}],["release/0.9.0",{"_index":1765,"title":{},"content":{"117":{"position":[[1073,13]]},"298":{"position":[[1073,13]]},"519":{"position":[[1073,13]]}},"keywords":{}}],["reli",{"_index":2365,"title":{},"content":{"197":{"position":[[801,6]]},"433":{"position":[[800,6]]},"680":{"position":[[800,6]]}},"keywords":{}}],["rem",{"_index":2644,"title":{},"content":{"212":{"position":[[2177,4],[2231,4]]},"391":{"position":[[2177,4],[2231,4]]},"661":{"position":[[2177,4],[2231,4]]}},"keywords":{}}],["remain",{"_index":1710,"title":{},"content":{"114":{"position":[[228,7]]},"205":{"position":[[59,9]]},"212":{"position":[[1632,9],[1747,9],[1937,9],[2149,9],[2341,9],[2459,9],[2736,9],[3150,9]]},"257":{"position":[[228,7]]},"267":{"position":[[3572,7]]},"321":{"position":[[349,7]]},"391":{"position":[[1632,9],[1747,9],[1937,9],[2149,9],[2341,9],[2459,9],[2742,9],[3168,9]]},"407":{"position":[[3572,7]]},"425":{"position":[[59,9]]},"440":{"position":[[1550,9]]},"441":{"position":[[2913,7],[3402,7]]},"477":{"position":[[3766,9]]},"480":{"position":[[228,7]]},"539":{"position":[[349,7]]},"644":{"position":[[3572,7]]},"661":{"position":[[1632,9],[1747,9],[1937,9],[2149,9],[2341,9],[2459,9],[2742,9],[3168,9]]},"667":{"position":[[59,9]]},"687":{"position":[[1550,9]]},"688":{"position":[[2913,7],[3402,7]]},"699":{"position":[[3766,9]]}},"keywords":{}}],["remark",{"_index":2469,"title":{},"content":{"205":{"position":[[210,8]]},"425":{"position":[[210,8]]},"667":{"position":[[210,8]]}},"keywords":{}}],["rememb",{"_index":1750,"title":{},"content":{"115":{"position":[[3191,9]]},"258":{"position":[[3117,9]]},"396":{"position":[[201,8]]},"414":{"position":[[722,8]]},"481":{"position":[[3117,9]]},"633":{"position":[[201,8]]},"651":{"position":[[722,8]]}},"keywords":{}}],["remind",{"_index":862,"title":{},"content":{"38":{"position":[[8,9]]}},"keywords":{}}],["remov",{"_index":2802,"title":{},"content":{"265":{"position":[[98,6]]},"267":{"position":[[2384,8],[3210,8],[4035,6],[4299,6]]},"268":{"position":[[1860,8],[2098,8],[2734,8]]},"405":{"position":[[98,6]]},"407":{"position":[[2384,8],[3210,8],[4035,6],[4299,6]]},"408":{"position":[[1860,8],[2098,8],[2734,8]]},"419":{"position":[[2060,7],[2107,6]]},"613":{"position":[[513,9],[572,9],[1463,6],[1699,6],[2093,9],[2160,6]]},"642":{"position":[[98,6]]},"644":{"position":[[2384,8],[3210,8],[4035,6],[4299,6]]},"645":{"position":[[1860,8],[2098,8],[2734,8]]},"656":{"position":[[2060,7],[2107,6]]},"721":{"position":[[513,9],[572,9],[1463,6],[1699,6],[2093,9],[2160,6]]}},"keywords":{}}],["remove(&mut",{"_index":3692,"title":{},"content":{"601":{"position":[[548,15],[1006,15]]},"613":{"position":[[528,15],[618,15]]},"709":{"position":[[548,15],[1006,15]]},"721":{"position":[[528,15],[618,15]]}},"keywords":{}}],["renounc",{"_index":2172,"title":{},"content":{"182":{"position":[[291,9]]},"373":{"position":[[291,9]]},"589":{"position":[[291,9]]}},"keywords":{}}],["renounce_role(&mut",{"_index":2232,"title":{},"content":{"185":{"position":[[1231,22]]},"376":{"position":[[1215,22]]},"592":{"position":[[1215,22]]}},"keywords":{}}],["renounced.a",{"_index":2171,"title":{},"content":{"182":{"position":[[264,11]]},"373":{"position":[[264,11]]},"589":{"position":[[264,11]]}},"keywords":{}}],["repeat",{"_index":74,"title":{},"content":{"1":{"position":[[929,6]]},"72":{"position":[[162,8]]},"236":{"position":[[162,8]]},"472":{"position":[[162,8]]}},"keywords":{}}],["replac",{"_index":1015,"title":{},"content":{"40":{"position":[[76,12]]},"54":{"position":[[24,7]]},"147":{"position":[[1022,8],[1145,8]]},"178":{"position":[[609,8],[732,8]]},"212":{"position":[[172,7]]},"264":{"position":[[491,7]]},"267":{"position":[[1225,7],[1807,7]]},"268":{"position":[[1416,7]]},"335":{"position":[[1030,8],[1153,8]]},"369":{"position":[[609,8],[732,8]]},"382":{"position":[[304,7]]},"383":{"position":[[261,7],[512,7],[981,7]]},"391":{"position":[[172,7]]},"395":{"position":[[4066,7]]},"404":{"position":[[491,7]]},"407":{"position":[[1225,7],[1807,7]]},"408":{"position":[[1416,7]]},"552":{"position":[[1030,8],[1153,8]]},"585":{"position":[[609,8],[732,8]]},"624":{"position":[[304,7]]},"625":{"position":[[261,7],[512,7],[981,7]]},"632":{"position":[[4066,7]]},"641":{"position":[[491,7]]},"644":{"position":[[1225,7],[1807,7]]},"645":{"position":[[1416,7]]},"661":{"position":[[172,7]]}},"keywords":{}}],["repo",{"_index":1657,"title":{},"content":{"100":{"position":[[76,4]]},"292":{"position":[[76,4]]},"504":{"position":[[76,4]]}},"keywords":{}}],["repositori",{"_index":117,"title":{},"content":{"2":{"position":[[542,10]]},"24":{"position":[[26,10]]},"102":{"position":[[665,11]]},"117":{"position":[[525,11]]},"126":{"position":[[596,11]]},"164":{"position":[[1197,10]]},"264":{"position":[[368,11]]},"270":{"position":[[284,10]]},"277":{"position":[[596,11]]},"294":{"position":[[665,11]]},"298":{"position":[[525,11]]},"324":{"position":[[151,11]]},"353":{"position":[[1232,10]]},"382":{"position":[[181,11]]},"385":{"position":[[284,10]]},"404":{"position":[[368,11]]},"410":{"position":[[284,10]]},"506":{"position":[[665,11]]},"514":{"position":[[596,11]]},"519":{"position":[[525,11]]},"542":{"position":[[151,11]]},"569":{"position":[[1232,10]]},"624":{"position":[[181,11]]},"627":{"position":[[284,10]]},"641":{"position":[[368,11]]},"647":{"position":[[284,10]]}},"keywords":{}}],["repres",{"_index":961,"title":{},"content":{"39":{"position":[[1867,11]]},"79":{"position":[[341,10]]},"85":{"position":[[102,11]]},"162":{"position":[[271,10]]},"230":{"position":[[358,10]]},"254":{"position":[[102,11]]},"351":{"position":[[271,10]]},"440":{"position":[[3411,10]]},"461":{"position":[[358,10]]},"485":{"position":[[102,11]]},"567":{"position":[[271,10]]},"598":{"position":[[1795,9]]},"617":{"position":[[1193,10]]},"687":{"position":[[3411,10]]},"706":{"position":[[1795,9]]},"725":{"position":[[1193,10]]}},"keywords":{}}],["represent",{"_index":906,"title":{},"content":{"39":{"position":[[312,14],[586,14]]},"211":{"position":[[724,14]]},"212":{"position":[[3734,14]]},"390":{"position":[[698,14]]},"391":{"position":[[3752,14]]},"660":{"position":[[698,14]]},"661":{"position":[[3752,14]]}},"keywords":{}}],["request",{"_index":507,"title":{},"content":{"17":{"position":[[1677,7]]},"128":{"position":[[334,9]]},"279":{"position":[[334,9]]},"394":{"position":[[356,7]]},"516":{"position":[[334,9]]},"631":{"position":[[356,7]]}},"keywords":{}}],["requir",{"_index":98,"title":{},"content":{"2":{"position":[[154,8]]},"51":{"position":[[89,13]]},"66":{"position":[[270,9]]},"98":{"position":[[496,8]]},"110":{"position":[[275,8]]},"120":{"position":[[258,7]]},"126":{"position":[[3605,8]]},"174":{"position":[[98,8]]},"184":{"position":[[884,8]]},"196":{"position":[[1042,8]]},"241":{"position":[[270,9]]},"266":{"position":[[105,9]]},"267":{"position":[[4246,7],[4467,9]]},"268":{"position":[[511,8]]},"277":{"position":[[3773,8]]},"290":{"position":[[496,8]]},"301":{"position":[[258,7]]},"305":{"position":[[275,8]]},"360":{"position":[[98,8]]},"375":{"position":[[803,8]]},"395":{"position":[[3474,8]]},"406":{"position":[[105,9]]},"407":{"position":[[4246,7],[4467,9]]},"408":{"position":[[511,8]]},"432":{"position":[[987,8]]},"440":{"position":[[3733,8]]},"466":{"position":[[270,9]]},"477":{"position":[[1198,8]]},"502":{"position":[[496,8]]},"510":{"position":[[275,8]]},"514":{"position":[[3605,8]]},"522":{"position":[[258,7]]},"576":{"position":[[98,8]]},"591":{"position":[[803,8]]},"611":{"position":[[596,8]]},"632":{"position":[[3474,8]]},"643":{"position":[[105,9]]},"644":{"position":[[4246,7],[4467,9]]},"645":{"position":[[511,8]]},"679":{"position":[[987,8]]},"687":{"position":[[3733,8]]},"699":{"position":[[1198,8]]},"719":{"position":[[596,8]]}},"keywords":{}}],["require_not_paus",{"_index":2718,"title":{},"content":{"221":{"position":[[752,20]]},"454":{"position":[[752,20]]},"694":{"position":[[752,20]]}},"keywords":{}}],["require_not_paused(&self",{"_index":2708,"title":{},"content":{"221":{"position":[[155,29]]},"454":{"position":[[155,29]]},"694":{"position":[[155,29]]}},"keywords":{}}],["require_paus",{"_index":2719,"title":{},"content":{"221":{"position":[[843,16]]},"454":{"position":[[843,16]]},"694":{"position":[[843,16]]}},"keywords":{}}],["require_paused(&self",{"_index":2711,"title":{},"content":{"221":{"position":[[264,25]]},"454":{"position":[[264,25]]},"694":{"position":[[264,25]]}},"keywords":{}}],["required.chang",{"_index":2824,"title":{},"content":{"267":{"position":[[547,15]]},"407":{"position":[[547,15]]},"644":{"position":[[547,15]]}},"keywords":{}}],["reset(&mut",{"_index":3727,"title":{},"content":{"602":{"position":[[464,14]]},"710":{"position":[[464,14]]}},"keywords":{}}],["resign",{"_index":567,"title":{},"content":{"20":{"position":[[38,8]]},"184":{"position":[[1236,6]]},"375":{"position":[[1133,6]]},"591":{"position":[[1133,6]]}},"keywords":{}}],["resolut",{"_index":945,"title":{},"content":{"39":{"position":[[1228,10]]},"612":{"position":[[1668,10]]},"720":{"position":[[1668,10]]}},"keywords":{}}],["resolv",{"_index":1507,"title":{},"content":{"83":{"position":[[218,8]]},"252":{"position":[[218,8]]},"483":{"position":[[218,8]]},"612":{"position":[[1534,7]]},"720":{"position":[[1534,7]]}},"keywords":{}}],["resourc",{"_index":1790,"title":{},"content":{"121":{"position":[[241,9],[266,9]]},"302":{"position":[[241,9],[266,9]]},"321":{"position":[[239,9]]},"323":{"position":[[46,9]]},"523":{"position":[[241,9],[266,9]]},"539":{"position":[[239,9]]},"541":{"position":[[46,9]]},"606":{"position":[[1156,8]]},"714":{"position":[[1156,8]]}},"keywords":{}}],["resources/my_contract_schema.json",{"_index":2982,"title":{},"content":{"323":{"position":[[191,33]]},"541":{"position":[[191,33]]}},"keywords":{}}],["respect",{"_index":664,"title":{},"content":{"22":{"position":[[1040,13]]},"78":{"position":[[383,13]]},"229":{"position":[[404,13]]},"460":{"position":[[404,13]]},"606":{"position":[[811,13]]},"714":{"position":[[811,13]]}},"keywords":{}}],["respons",{"_index":417,"title":{},"content":{"15":{"position":[[421,8]]},"108":{"position":[[65,11]]},"110":{"position":[[367,14]]},"145":{"position":[[217,11]]},"275":{"position":[[69,11]]},"305":{"position":[[367,14]]},"333":{"position":[[217,11]]},"393":{"position":[[327,11]]},"415":{"position":[[142,11]]},"441":{"position":[[112,11]]},"492":{"position":[[69,11]]},"510":{"position":[[367,14]]},"550":{"position":[[217,11]]},"630":{"position":[[327,11]]},"652":{"position":[[142,11]]},"688":{"position":[[112,11]]}},"keywords":{}}],["rest",{"_index":1110,"title":{},"content":{"43":{"position":[[144,4]]}},"keywords":{}}],["result",{"_index":188,"title":{"11":{"position":[[8,8]]}},"content":{"5":{"position":[[308,6]]},"9":{"position":[[1543,6]]},"10":{"position":[[668,6],[737,7],[902,6],[975,6],[1264,6],[1336,6]]},"11":{"position":[[68,6]]},"17":{"position":[[1804,7]]},"31":{"position":[[259,6],[2372,7],[3283,6],[3612,6]]},"32":{"position":[[150,7],[415,6],[770,6],[1012,6],[1530,6],[1558,7]]},"39":{"position":[[3202,9]]},"73":{"position":[[686,6]]},"85":{"position":[[916,6]]},"103":{"position":[[169,6],[412,6]]},"115":{"position":[[1508,7]]},"127":{"position":[[585,6]]},"147":{"position":[[884,6]]},"162":{"position":[[1564,6]]},"165":{"position":[[68,8]]},"168":{"position":[[1396,6]]},"212":{"position":[[827,7],[914,6],[1204,7],[1306,6],[4092,6],[4364,7],[4410,6],[4431,6]]},"237":{"position":[[686,6]]},"254":{"position":[[916,6]]},"258":{"position":[[1454,7]]},"278":{"position":[[585,6]]},"295":{"position":[[169,6],[412,6]]},"335":{"position":[[892,6]]},"346":{"position":[[274,6]]},"348":{"position":[[1396,6]]},"351":{"position":[[1586,6]]},"354":{"position":[[68,8]]},"391":{"position":[[827,7],[914,6],[1204,7],[1306,6],[4110,6],[4382,7],[4428,6],[4449,6]]},"415":{"position":[[259,6]]},"473":{"position":[[686,6]]},"481":{"position":[[1454,7]]},"485":{"position":[[916,6]]},"507":{"position":[[169,6],[412,6]]},"515":{"position":[[585,6]]},"552":{"position":[[892,6]]},"564":{"position":[[1396,6]]},"567":{"position":[[1586,6]]},"570":{"position":[[68,8]]},"599":{"position":[[587,6]]},"617":{"position":[[365,6],[445,6],[1114,6],[1165,6],[1288,6],[1340,7]]},"652":{"position":[[259,6]]},"661":{"position":[[827,7],[914,6],[1204,7],[1306,6],[4110,6],[4382,7],[4428,6],[4449,6]]},"707":{"position":[[587,6]]},"725":{"position":[[365,6],[445,6],[1114,6],[1165,6],[1288,6],[1340,7]]}},"keywords":{}}],["result<bool",{"_index":3918,"title":{},"content":{"617":{"position":[[725,15]]},"725":{"position":[[725,15]]}},"keywords":{}}],["result<syn::expr",{"_index":977,"title":{},"content":{"39":{"position":[[2330,20]]}},"keywords":{}}],["result<t",{"_index":2421,"title":{},"content":{"198":{"position":[[3719,12]]},"434":{"position":[[3701,12]]},"681":{"position":[[3719,12]]}},"keywords":{}}],["result(&self",{"_index":349,"title":{},"content":{"10":{"position":[[997,17]]}},"keywords":{}}],["result.try_",{"_index":2922,"title":{},"content":{"268":{"position":[[2179,11]]},"408":{"position":[[2179,11]]},"645":{"position":[[2179,11]]}},"keywords":{}}],["result}"",{"_index":834,"title":{},"content":{"32":{"position":[[838,16],[1087,16]]}},"keywords":{}}],["retain",{"_index":1733,"title":{},"content":{"115":{"position":[[1529,7],[3150,9]]},"258":{"position":[[1475,7],[3076,9]]},"481":{"position":[[1475,7],[3076,9]]}},"keywords":{}}],["rethink",{"_index":64,"title":{},"content":{"1":{"position":[[824,7]]}},"keywords":{}}],["retriev",{"_index":1417,"title":{},"content":{"76":{"position":[[279,8],[704,9]]},"178":{"position":[[848,9]]},"227":{"position":[[279,8],[704,9]]},"369":{"position":[[848,9]]},"458":{"position":[[279,8],[704,9]]},"585":{"position":[[848,9]]},"596":{"position":[[966,8]]},"600":{"position":[[1190,9]]},"602":{"position":[[798,9]]},"704":{"position":[[966,8]]},"708":{"position":[[1190,9]]},"710":{"position":[[798,9]]}},"keywords":{}}],["return",{"_index":695,"title":{},"content":{"30":{"position":[[236,7],[256,6],[309,7],[346,6],[365,6]]},"31":{"position":[[2747,6]]},"32":{"position":[[138,7],[1523,6]]},"42":{"position":[[1166,7],[1192,6]]},"79":{"position":[[1514,7]]},"92":{"position":[[974,7]]},"138":{"position":[[865,6],[1197,7]]},"141":{"position":[[660,7]]},"168":{"position":[[1701,7],[1913,7]]},"178":{"position":[[940,9]]},"185":{"position":[[3871,7]]},"197":{"position":[[1541,7],[1788,6]]},"198":{"position":[[1733,7],[2432,8],[3687,6]]},"212":{"position":[[3719,6]]},"230":{"position":[[1531,7]]},"267":{"position":[[1922,7]]},"268":{"position":[[2250,7]]},"284":{"position":[[974,7]]},"318":{"position":[[857,6],[1189,7]]},"321":{"position":[[1453,7]]},"324":{"position":[[1117,6]]},"326":{"position":[[660,7]]},"348":{"position":[[1701,7],[1913,7]]},"369":{"position":[[940,9]]},"376":{"position":[[3855,7]]},"391":{"position":[[3737,6]]},"407":{"position":[[1922,7]]},"408":{"position":[[2250,7]]},"417":{"position":[[1056,9]]},"419":{"position":[[2318,7],[2386,7],[2458,7],[2542,7],[2624,7],[2730,7],[7471,9]]},"433":{"position":[[1540,7],[1787,6]]},"434":{"position":[[1723,7],[2422,8],[3669,6]]},"461":{"position":[[1531,7]]},"476":{"position":[[1300,7],[1442,7]]},"496":{"position":[[974,7]]},"535":{"position":[[660,7]]},"539":{"position":[[1453,7]]},"542":{"position":[[1117,6]]},"544":{"position":[[857,6],[1189,7]]},"564":{"position":[[1701,7],[1913,7]]},"585":{"position":[[940,9]]},"592":{"position":[[3855,7]]},"601":{"position":[[286,6]]},"616":{"position":[[1385,6]]},"644":{"position":[[1922,7]]},"645":{"position":[[2250,7]]},"654":{"position":[[1056,9]]},"656":{"position":[[2318,7],[2386,7],[2458,7],[2542,7],[2624,7],[2730,7],[7471,9]]},"661":{"position":[[3737,6]]},"680":{"position":[[1540,7],[1787,6]]},"681":{"position":[[1733,7],[2432,8],[3687,6]]},"698":{"position":[[1300,7],[1442,7]]},"709":{"position":[[286,6]]},"724":{"position":[[1385,6]]}},"keywords":{}}],["returned.l6",{"_index":2717,"title":{},"content":{"221":{"position":[[671,11]]},"454":{"position":[[671,11]]},"694":{"position":[[671,11]]}},"keywords":{}}],["reus",{"_index":1528,"title":{},"content":{"84":{"position":[[475,6]]},"145":{"position":[[144,6]]},"146":{"position":[[336,6]]},"197":{"position":[[1122,6]]},"253":{"position":[[475,6]]},"333":{"position":[[144,6]]},"334":{"position":[[336,6]]},"433":{"position":[[1121,6]]},"484":{"position":[[475,6]]},"550":{"position":[[144,6]]},"551":{"position":[[336,6]]},"612":{"position":[[49,5],[2099,5]]},"613":{"position":[[1921,6]]},"680":{"position":[[1121,6]]},"720":{"position":[[49,5],[2099,5]]},"721":{"position":[[1921,6]]}},"keywords":{}}],["reusabl",{"_index":615,"title":{},"content":{"20":{"position":[[988,12]]},"22":{"position":[[787,11]]},"84":{"position":[[44,11]]},"171":{"position":[[37,8]]},"187":{"position":[[59,8]]},"253":{"position":[[44,11]]},"357":{"position":[[37,8]]},"364":{"position":[[59,8]]},"484":{"position":[[44,11]]},"573":{"position":[[37,8]]},"580":{"position":[[59,8]]}},"keywords":{}}],["reveal",{"_index":194,"title":{},"content":{"5":{"position":[[398,9]]}},"keywords":{}}],["revert",{"_index":1600,"title":{"93":{"position":[[0,7]]},"285":{"position":[[0,7]]},"497":{"position":[[0,7]]}},"content":{"92":{"position":[[725,8]]},"185":{"position":[[3313,7]]},"197":{"position":[[962,7],[1426,6]]},"198":{"position":[[3834,6]]},"221":{"position":[[802,7]]},"284":{"position":[[725,8]]},"321":{"position":[[850,6]]},"376":{"position":[[3297,7]]},"433":{"position":[[961,7],[1425,6]]},"434":{"position":[[3816,6]]},"440":{"position":[[6043,7]]},"454":{"position":[[802,7]]},"496":{"position":[[725,8]]},"539":{"position":[[850,6]]},"592":{"position":[[3297,7]]},"611":{"position":[[605,7],[674,6]]},"617":{"position":[[1421,8]]},"680":{"position":[[961,7],[1425,6]]},"681":{"position":[[3834,6]]},"687":{"position":[[6043,7]]},"694":{"position":[[802,7]]},"719":{"position":[[605,7],[674,6]]},"725":{"position":[[1421,8]]}},"keywords":{}}],["revert<",{"_index":2863,"title":{},"content":{"267":{"position":[[2653,12],[2725,12]]},"407":{"position":[[2653,12],[2725,12]]},"644":{"position":[[2653,12],[2725,12]]}},"keywords":{}}],["revert(governanceerror::onlytokenholderscanpropos",{"_index":3314,"title":{},"content":{"419":{"position":[[4291,53]]},"656":{"position":[[4291,53]]}},"keywords":{}}],["review",{"_index":2790,"title":{"262":{"position":[[5,6]]},"380":{"position":[[5,6]]},"402":{"position":[[5,6]]},"622":{"position":[[5,6]]},"639":{"position":[[5,6]]}},"content":{"262":{"position":[[48,9]]},"270":{"position":[[406,6]]},"380":{"position":[[48,9]]},"385":{"position":[[406,6]]},"402":{"position":[[48,9]]},"410":{"position":[[406,6]]},"622":{"position":[[48,9]]},"627":{"position":[[406,6]]},"639":{"position":[[48,9]]},"647":{"position":[[406,6]]}},"keywords":{}}],["revisit",{"_index":2101,"title":{},"content":{"164":{"position":[[46,7]]},"168":{"position":[[182,7]]},"348":{"position":[[182,7]]},"353":{"position":[[46,7]]},"564":{"position":[[182,7]]},"569":{"position":[[46,7]]}},"keywords":{}}],["revok",{"_index":2181,"title":{},"content":{"184":{"position":[[75,9],[698,6]]},"185":{"position":[[3134,8],[3742,8]]},"375":{"position":[[75,9],[617,6]]},"376":{"position":[[3118,8],[3726,8]]},"591":{"position":[[75,9],[617,6]]},"592":{"position":[[3118,8],[3726,8]]}},"keywords":{}}],["revoke_role(&mut",{"_index":2230,"title":{},"content":{"185":{"position":[[1035,20]]},"376":{"position":[[1019,20]]},"592":{"position":[[1019,20]]}},"keywords":{}}],["revolut",{"_index":168,"title":{},"content":{"5":{"position":[[54,10]]}},"keywords":{}}],["rewrit",{"_index":439,"title":{},"content":{"16":{"position":[[249,9]]}},"keywords":{}}],["right",{"_index":992,"title":{},"content":{"39":{"position":[[2658,5],[2688,6],[2730,5],[2760,6]]},"222":{"position":[[468,5]]},"396":{"position":[[292,5]]},"419":{"position":[[2080,7]]},"455":{"position":[[468,5]]},"594":{"position":[[139,5]]},"633":{"position":[[292,5]]},"656":{"position":[[2080,7]]},"695":{"position":[[468,5]]},"702":{"position":[[139,5]]}},"keywords":{}}],["risc",{"_index":195,"title":{"6":{"position":[[0,4]]}},"content":{"6":{"position":[[29,4]]},"7":{"position":[[112,4]]},"8":{"position":[[48,4]]},"12":{"position":[[142,4],[209,4],[266,4]]}},"keywords":{}}],["risc0",{"_index":685,"title":{"29":{"position":[[7,5]]},"32":{"position":[[0,6]]}},"content":{"31":{"position":[[305,5]]},"32":{"position":[[14,6]]},"33":{"position":[[108,5]]}},"keywords":{}}],["risc0_zkvm::guest::entry!(main",{"_index":824,"title":{},"content":{"32":{"position":[[329,32]]}},"keywords":{}}],["risc0_zkvm::guest::{env",{"_index":822,"title":{},"content":{"32":{"position":[[268,25]]}},"keywords":{}}],["river",{"_index":1024,"title":{},"content":{"40":{"position":[[441,5]]}},"keywords":{}}],["rm",{"_index":2571,"title":{},"content":{"210":{"position":[[106,2]]},"389":{"position":[[106,2]]},"477":{"position":[[115,2]]},"659":{"position":[[106,2]]},"699":{"position":[[115,2]]}},"keywords":{}}],["road",{"_index":1316,"title":{},"content":{"54":{"position":[[178,4]]}},"keywords":{}}],["roadmap",{"_index":120,"title":{"3":{"position":[[0,8]]}},"content":{"3":{"position":[[313,8]]}},"keywords":{}}],["robust",{"_index":1496,"title":{},"content":{"81":{"position":[[40,6]]},"232":{"position":[[40,6]]},"463":{"position":[[40,6]]}},"keywords":{}}],["role",{"_index":2165,"title":{},"content":{"182":{"position":[[89,4],[127,4],[171,4],[252,4],[276,4]]},"184":{"position":[[59,5],[108,5],[340,5],[346,5],[464,5],[470,5],[593,5],[599,5],[630,5],[656,4],[737,5],[871,4],[905,5],[946,5],[1247,4]]},"185":{"position":[[238,4],[285,4],[401,6],[550,5],[688,5],[711,4],[867,5],[1062,5],[1260,5],[1499,5],[1656,5],[1832,5],[1838,6],[1943,5],[2102,5],[2108,6],[2214,5],[2373,5],[2379,6],[2470,4],[2540,4],[2623,5],[2696,4],[2749,4],[2778,5],[2835,4],[3115,4],[3236,5],[3258,4],[3572,5],[3637,4],[3845,4],[3862,5]]},"189":{"position":[[57,4],[116,5]]},"366":{"position":[[57,4],[116,5]]},"373":{"position":[[89,4],[127,4],[171,4],[252,4],[276,4]]},"375":{"position":[[59,5],[108,5],[307,5],[313,5],[407,5],[413,5],[512,5],[518,5],[549,5],[575,4],[656,5],[790,4],[824,5],[865,5],[1144,4]]},"376":{"position":[[222,4],[269,4],[385,6],[534,5],[672,5],[695,4],[851,5],[1046,5],[1244,5],[1483,5],[1640,5],[1816,5],[1822,6],[1927,5],[2086,5],[2092,6],[2198,5],[2357,5],[2363,6],[2454,4],[2524,4],[2607,5],[2680,4],[2733,4],[2762,5],[2819,4],[3099,4],[3220,5],[3242,4],[3556,5],[3621,4],[3829,4],[3846,5]]},"582":{"position":[[57,4],[116,5]]},"589":{"position":[[89,4],[127,4],[171,4],[252,4],[276,4]]},"591":{"position":[[59,5],[108,5],[307,5],[313,5],[407,5],[413,5],[512,5],[518,5],[549,5],[575,4],[656,5],[790,4],[824,5],[865,5],[1144,4]]},"592":{"position":[[222,4],[269,4],[385,6],[534,5],[672,5],[695,4],[851,5],[1046,5],[1244,5],[1483,5],[1640,5],[1816,5],[1822,6],[1927,5],[2086,5],[2092,6],[2198,5],[2357,5],[2363,6],[2454,4],[2524,4],[2607,5],[2680,4],[2733,4],[2762,5],[2819,4],[3099,4],[3220,5],[3242,4],[3556,5],[3621,4],[3829,4],[3846,5]]}},"keywords":{}}],["role>",{"_index":2218,"title":{},"content":{"185":{"position":[[475,8]]},"376":{"position":[[459,8]]},"592":{"position":[[459,8]]}},"keywords":{}}],["role).l22",{"_index":2273,"title":{},"content":{"185":{"position":[[3753,9]]},"376":{"position":[[3737,9]]},"592":{"position":[[3737,9]]}},"keywords":{}}],["role.a",{"_index":2170,"title":{},"content":{"182":{"position":[[245,6]]},"373":{"position":[[245,6]]},"589":{"position":[[245,6]]}},"keywords":{}}],["role.l31",{"_index":2276,"title":{},"content":{"185":{"position":[[3891,8]]},"376":{"position":[[3875,8]]},"592":{"position":[[3875,8]]}},"keywords":{}}],["role.onli",{"_index":2168,"title":{},"content":{"182":{"position":[[207,9]]},"373":{"position":[[207,9]]},"589":{"position":[[207,9]]}},"keywords":{}}],["role_admin",{"_index":2216,"title":{},"content":{"185":{"position":[[446,11],[3404,10],[3812,11]]},"376":{"position":[[430,11],[3388,10],[3796,11]]},"592":{"position":[[430,11],[3388,10],[3796,11]]}},"keywords":{}}],["roleadminchang",{"_index":2186,"title":{},"content":{"184":{"position":[[570,16]]},"185":{"position":[[327,18],[3437,16]]},"375":{"position":[[489,16]]},"376":{"position":[[311,18],[3421,16]]},"591":{"position":[[489,16]]},"592":{"position":[[311,18],[3421,16]]}},"keywords":{}}],["rolegr",{"_index":2184,"title":{},"content":{"184":{"position":[[322,11]]},"185":{"position":[[346,12],[3595,11]]},"375":{"position":[[289,11]]},"376":{"position":[[330,12],[3579,11]]},"591":{"position":[[289,11]]},"592":{"position":[[330,12],[3579,11]]}},"keywords":{}}],["rolerenounceforanotheraddress",{"_index":2201,"title":{},"content":{"184":{"position":[[1043,29]]},"375":{"position":[[940,29]]},"591":{"position":[[940,29]]}},"keywords":{}}],["rolerevok",{"_index":2185,"title":{},"content":{"184":{"position":[[446,11]]},"185":{"position":[[359,14],[3610,11]]},"375":{"position":[[389,11]]},"376":{"position":[[343,14],[3594,11]]},"591":{"position":[[389,11]]},"592":{"position":[[343,14],[3594,11]]}},"keywords":{}}],["root",{"_index":2796,"title":{},"content":{"264":{"position":[[168,4]]},"404":{"position":[[168,4]]},"613":{"position":[[1401,4]]},"641":{"position":[[168,4]]},"721":{"position":[[1401,4]]}},"keywords":{}}],["rpc",{"_index":1800,"title":{},"content":{"126":{"position":[[667,3]]},"277":{"position":[[667,3]]},"395":{"position":[[3843,3]]},"514":{"position":[[667,3]]},"632":{"position":[[3843,3]]}},"keywords":{}}],["rpc_id",{"_index":2618,"title":{},"content":{"212":{"position":[[335,7]]},"391":{"position":[[335,7]]},"661":{"position":[[335,7]]}},"keywords":{}}],["rpc_id.to_string().into",{"_index":2627,"title":{},"content":{"212":{"position":[[745,26],[959,26]]},"391":{"position":[[745,26],[959,26]]},"661":{"position":[[745,26],[959,26]]}},"keywords":{}}],["rudimentari",{"_index":1032,"title":{},"content":{"42":{"position":[[305,11]]}},"keywords":{}}],["run",{"_index":211,"title":{"67":{"position":[[0,7]]},"242":{"position":[[0,7]]},"467":{"position":[[0,7]]}},"content":{"6":{"position":[[240,3]]},"9":{"position":[[13,3],[641,3]]},"11":{"position":[[188,7]]},"20":{"position":[[621,3]]},"31":{"position":[[662,3],[797,3]]},"32":{"position":[[1681,3]]},"43":{"position":[[851,3]]},"52":{"position":[[1192,3],[1484,3],[1661,3]]},"67":{"position":[[3,3],[71,3]]},"68":{"position":[[58,3]]},"96":{"position":[[52,3],[187,4]]},"106":{"position":[[71,3],[100,7]]},"107":{"position":[[489,4]]},"117":{"position":[[618,8]]},"119":{"position":[[101,4],[240,3],[501,4],[812,3],[899,3],[1002,3]]},"120":{"position":[[77,7],[113,4]]},"127":{"position":[[3,3],[41,3],[96,3]]},"129":{"position":[[590,3]]},"132":{"position":[[84,7]]},"148":{"position":[[939,7]]},"175":{"position":[[250,3],[322,3],[370,3]]},"179":{"position":[[3,3],[98,3]]},"210":{"position":[[72,3],[100,3]]},"212":{"position":[[4446,3]]},"242":{"position":[[3,3],[71,3]]},"243":{"position":[[58,3]]},"261":{"position":[[134,7]]},"273":{"position":[[71,3],[100,7]]},"274":{"position":[[489,4]]},"278":{"position":[[3,3],[41,3],[96,3]]},"280":{"position":[[590,3]]},"288":{"position":[[52,3],[187,4]]},"298":{"position":[[618,8]]},"300":{"position":[[101,4],[240,3],[501,4],[812,3],[899,3],[1002,3]]},"301":{"position":[[77,7],[113,4]]},"312":{"position":[[84,7]]},"322":{"position":[[23,3]]},"336":{"position":[[939,7]]},"361":{"position":[[250,3],[322,3],[370,3]]},"370":{"position":[[3,3],[98,3]]},"379":{"position":[[134,7]]},"389":{"position":[[72,3],[100,3]]},"391":{"position":[[4464,3]]},"394":{"position":[[389,3]]},"395":{"position":[[4372,3],[4392,3],[4519,7]]},"401":{"position":[[134,7]]},"414":{"position":[[615,3]]},"417":{"position":[[76,3],[1631,3]]},"467":{"position":[[3,3],[71,3]]},"468":{"position":[[58,3]]},"477":{"position":[[109,3],[2289,3],[2508,3]]},"490":{"position":[[71,3],[100,7]]},"491":{"position":[[489,4]]},"500":{"position":[[52,3],[187,4]]},"515":{"position":[[3,3],[41,3],[96,3]]},"517":{"position":[[590,3]]},"519":{"position":[[618,8]]},"521":{"position":[[101,4],[240,3],[501,4],[812,3],[899,3],[1002,3]]},"522":{"position":[[77,7],[113,4]]},"529":{"position":[[84,7]]},"540":{"position":[[23,3]]},"553":{"position":[[939,7]]},"577":{"position":[[250,3],[322,3],[370,3]]},"586":{"position":[[3,3],[98,3]]},"621":{"position":[[134,7]]},"631":{"position":[[389,3]]},"632":{"position":[[4372,3],[4392,3],[4519,7]]},"638":{"position":[[134,7]]},"651":{"position":[[615,3]]},"654":{"position":[[76,3],[1631,3]]},"659":{"position":[[72,3],[100,3]]},"661":{"position":[[4464,3]]},"699":{"position":[[109,3],[2289,3],[2508,3]]}},"keywords":{}}],["run_calc_contract(&input",{"_index":825,"title":{},"content":{"32":{"position":[[424,30]]}},"keywords":{}}],["run_calc_contract(data",{"_index":808,"title":{},"content":{"31":{"position":[[3292,24],[3621,24]]}},"keywords":{}}],["run_calc_contract(input",{"_index":736,"title":{},"content":{"31":{"position":[[703,24]]}},"keywords":{}}],["run_calc_contractand",{"_index":815,"title":{},"content":{"32":{"position":[[117,20]]}},"keywords":{}}],["run_evm(calculator_evm_program",{"_index":737,"title":{},"content":{"31":{"position":[[753,31]]}},"keywords":{}}],["run_evm(program",{"_index":738,"title":{},"content":{"31":{"position":[[844,16]]}},"keywords":{}}],["run_prover(input",{"_index":831,"title":{},"content":{"32":{"position":[[779,18],[1021,18],[1109,17]]}},"keywords":{}}],["runner/src/lib.r",{"_index":729,"title":{},"content":{"31":{"position":[[480,17],[3133,17]]}},"keywords":{}}],["runtim",{"_index":702,"title":{},"content":{"30":{"position":[[493,7],[689,7]]},"92":{"position":[[863,7]]},"212":{"position":[[3238,7]]},"284":{"position":[[863,7]]},"391":{"position":[[3256,7]]},"496":{"position":[[863,7]]},"661":{"position":[[3256,7]]}},"keywords":{}}],["runtime"",{"_index":735,"title":{},"content":{"31":{"position":[[642,13]]}},"keywords":{}}],["runtime.block_on(metadata",{"_index":2682,"title":{},"content":{"212":{"position":[[4470,28]]},"391":{"position":[[4488,28]]},"661":{"position":[[4488,28]]}},"keywords":{}}],["runtime.block_on(named_value("alice"",{"_index":2691,"title":{},"content":{"212":{"position":[[4717,48]]},"391":{"position":[[4735,48]]},"661":{"position":[[4735,48]]}},"keywords":{}}],["runtime.block_on(named_value("bob"",{"_index":2693,"title":{},"content":{"212":{"position":[[4791,46]]},"391":{"position":[[4809,46]]},"661":{"position":[[4809,46]]}},"keywords":{}}],["runtime.block_on(valu",{"_index":2688,"title":{},"content":{"212":{"position":[[4665,25]]},"391":{"position":[[4683,25]]},"661":{"position":[[4683,25]]}},"keywords":{}}],["runtime::get_call_stack",{"_index":1621,"title":{},"content":{"94":{"position":[[296,27],[425,27]]},"286":{"position":[[296,27],[425,27]]},"498":{"position":[[296,27],[425,27]]}},"keywords":{}}],["runtime::revert",{"_index":1609,"title":{},"content":{"93":{"position":[[73,18]]},"285":{"position":[[73,18]]},"497":{"position":[[73,18]]}},"keywords":{}}],["runtimearg",{"_index":1688,"title":{},"content":{"103":{"position":[[319,11]]},"295":{"position":[[319,11]]},"507":{"position":[[319,11]]}},"keywords":{}}],["rust",{"_index":5,"title":{},"content":{"1":{"position":[[18,4]]},"2":{"position":[[18,4],[139,4]]},"18":{"position":[[260,4]]},"20":{"position":[[685,4]]},"22":{"position":[[50,5],[744,4]]},"31":{"position":[[66,4],[294,4]]},"38":{"position":[[68,5],[1062,5]]},"39":{"position":[[13,4],[209,4],[307,4],[371,4],[900,4],[952,4],[1578,4],[1737,4],[1891,4],[3326,4]]},"40":{"position":[[142,4]]},"42":{"position":[[1632,4]]},"50":{"position":[[371,4]]},"66":{"position":[[314,4]]},"126":{"position":[[3428,4]]},"146":{"position":[[534,4]]},"148":{"position":[[494,5]]},"173":{"position":[[86,4],[342,4]]},"198":{"position":[[2224,4]]},"204":{"position":[[1354,4]]},"241":{"position":[[314,4]]},"268":{"position":[[2322,4]]},"277":{"position":[[3596,4]]},"324":{"position":[[92,4]]},"334":{"position":[[538,4]]},"336":{"position":[[494,5]]},"359":{"position":[[86,4],[342,4]]},"408":{"position":[[2322,4]]},"424":{"position":[[1304,4]]},"434":{"position":[[2214,4]]},"466":{"position":[[314,4]]},"478":{"position":[[246,4],[307,4]]},"514":{"position":[[3428,4]]},"542":{"position":[[92,4]]},"551":{"position":[[538,4]]},"553":{"position":[[494,5]]},"575":{"position":[[86,4],[342,4]]},"594":{"position":[[81,4]]},"595":{"position":[[138,5]]},"605":{"position":[[635,4]]},"612":{"position":[[125,4],[1817,4]]},"645":{"position":[[2322,4]]},"666":{"position":[[1304,4]]},"681":{"position":[[2224,4]]},"700":{"position":[[246,4],[307,4]]},"702":{"position":[[81,4]]},"703":{"position":[[138,5]]},"713":{"position":[[635,4]]},"720":{"position":[[125,4],[1817,4]]}},"keywords":{}}],["rusttypescript",{"_index":2609,"title":{},"content":{"212":{"position":[[0,14]]},"391":{"position":[[0,14]]},"477":{"position":[[507,14]]},"661":{"position":[[0,14]]},"699":{"position":[[507,14]]}},"keywords":{}}],["rustup",{"_index":2152,"title":{},"content":{"173":{"position":[[390,6]]},"359":{"position":[[390,6]]},"575":{"position":[[390,6]]}},"keywords":{}}],["rustup.rs)wasmstrip",{"_index":2149,"title":{},"content":{"173":{"position":[[116,19]]},"359":{"position":[[116,19]]},"575":{"position":[[116,19]]}},"keywords":{}}],["s",{"_index":1763,"title":{},"content":{"117":{"position":[[956,1],[999,1],[1071,1],[1180,1]]},"298":{"position":[[956,1],[999,1],[1071,1],[1180,1]]},"519":{"position":[[956,1],[999,1],[1071,1],[1180,1]]}},"keywords":{}}],["safe",{"_index":1920,"title":{},"content":{"138":{"position":[[973,4],[982,4]]},"318":{"position":[[965,4],[974,4]]},"544":{"position":[[965,4],[974,4]]}},"keywords":{}}],["sake",{"_index":3240,"title":{},"content":{"416":{"position":[[2391,4]]},"653":{"position":[[2391,4]]}},"keywords":{}}],["sale",{"_index":3430,"title":{},"content":{"440":{"position":[[4407,5]]},"687":{"position":[[4407,5]]}},"keywords":{}}],["sale.publ",{"_index":3341,"title":{},"content":{"438":{"position":[[238,11]]},"685":{"position":[[238,11]]}},"keywords":{}}],["same",{"_index":430,"title":{},"content":{"16":{"position":[[54,4]]},"39":{"position":[[1909,4],[1924,4],[2082,4]]},"84":{"position":[[729,4]]},"90":{"position":[[61,4]]},"103":{"position":[[572,4]]},"117":{"position":[[1346,4]]},"119":{"position":[[1113,4]]},"126":{"position":[[1498,4],[2293,4]]},"168":{"position":[[1258,4]]},"198":{"position":[[1174,4]]},"247":{"position":[[1795,4]]},"253":{"position":[[729,4]]},"267":{"position":[[3584,5],[4373,4]]},"277":{"position":[[1666,4],[2461,4]]},"282":{"position":[[61,4]]},"295":{"position":[[572,4]]},"298":{"position":[[1346,4]]},"300":{"position":[[1113,4]]},"348":{"position":[[1258,4]]},"407":{"position":[[3584,5],[4373,4]]},"434":{"position":[[1164,4]]},"440":{"position":[[4737,4]]},"441":{"position":[[2925,7],[3414,5]]},"446":{"position":[[1795,4]]},"477":{"position":[[616,4]]},"484":{"position":[[729,4]]},"494":{"position":[[61,4]]},"507":{"position":[[572,4]]},"514":{"position":[[1498,4],[2293,4]]},"519":{"position":[[1346,4]]},"521":{"position":[[1113,4]]},"564":{"position":[[1258,4]]},"644":{"position":[[3584,5],[4373,4]]},"673":{"position":[[1795,4]]},"681":{"position":[[1174,4]]},"687":{"position":[[4737,4]]},"688":{"position":[[2925,7],[3414,5]]},"699":{"position":[[616,4]]}},"keywords":{}}],["sampl",{"_index":1773,"title":{},"content":{"118":{"position":[[161,6]]},"127":{"position":[[222,6]]},"175":{"position":[[200,6]]},"278":{"position":[[222,6]]},"299":{"position":[[161,6]]},"361":{"position":[[200,6]]},"477":{"position":[[2554,6]]},"515":{"position":[[222,6]]},"520":{"position":[[161,6]]},"577":{"position":[[200,6]]},"613":{"position":[[1347,6]]},"618":{"position":[[332,8]]},"699":{"position":[[2554,6]]},"721":{"position":[[1347,6]]},"726":{"position":[[332,8]]}},"keywords":{}}],["save",{"_index":1999,"title":{},"content":{"147":{"position":[[1366,5]]},"163":{"position":[[1314,6]]},"335":{"position":[[1374,5]]},"352":{"position":[[1336,6]]},"552":{"position":[[1374,5]]},"568":{"position":[[1336,6]]}},"keywords":{}}],["scale",{"_index":184,"title":{},"content":{"5":{"position":[[240,7]]}},"keywords":{}}],["scenario",{"_index":1442,"title":{},"content":{"79":{"position":[[300,9]]},"126":{"position":[[1152,10]]},"230":{"position":[[317,9]]},"268":{"position":[[2048,11]]},"277":{"position":[[1320,10]]},"408":{"position":[[2048,11]]},"416":{"position":[[2336,10]]},"440":{"position":[[4599,8]]},"441":{"position":[[4489,8]]},"461":{"position":[[317,9]]},"514":{"position":[[1152,10]]},"645":{"position":[[2048,11]]},"653":{"position":[[2336,10]]},"687":{"position":[[4599,8]]},"688":{"position":[[4489,8]]}},"keywords":{}}],["scene",{"_index":1596,"title":{},"content":{"92":{"position":[[549,7]]},"284":{"position":[[549,7]]},"496":{"position":[[549,7]]}},"keywords":{}}],["schedul",{"_index":114,"title":{},"content":{"2":{"position":[[436,8]]}},"keywords":{}}],["schema",{"_index":1583,"title":{"121":{"position":[[20,7]]},"302":{"position":[[20,7]]},"320":{"position":[[16,6]]},"322":{"position":[[15,7]]},"323":{"position":[[0,6]]},"324":{"position":[[0,6]]},"523":{"position":[[20,7]]},"538":{"position":[[16,6]]},"540":{"position":[[15,7]]},"541":{"position":[[0,6]]},"542":{"position":[[0,6]]}},"content":{"91":{"position":[[535,8],[616,7]]},"121":{"position":[[26,6],[116,6],[143,6],[168,6],[399,6]]},"134":{"position":[[71,7],[233,6]]},"283":{"position":[[535,8],[616,7]]},"302":{"position":[[26,6],[116,6],[143,6],[168,6],[399,6]]},"314":{"position":[[71,7],[233,6]]},"321":{"position":[[185,6],[429,7],[1672,6],[1813,6],[1997,6],[2125,6]]},"322":{"position":[[16,6],[72,6],[113,6]]},"323":{"position":[[14,6],[71,6],[183,7]]},"354":{"position":[[460,6]]},"382":{"position":[[62,6],[87,7]]},"495":{"position":[[535,8],[616,7]]},"523":{"position":[[26,6],[116,6],[143,6],[168,6],[399,6]]},"531":{"position":[[71,7],[233,6]]},"539":{"position":[[185,6],[429,7],[1672,6],[1813,6],[1997,6],[2125,6]]},"540":{"position":[[16,6],[72,6],[113,6]]},"541":{"position":[[14,6],[71,6],[183,7]]},"570":{"position":[[460,6]]},"624":{"position":[[62,6],[87,7]]}},"keywords":{}}],["schema.l51",{"_index":3419,"title":{},"content":{"440":{"position":[[3773,10]]},"687":{"position":[[3773,10]]}},"keywords":{}}],["schema.toolchain",{"_index":3042,"title":{},"content":{"324":{"position":[[53,16]]},"542":{"position":[[53,16]]}},"keywords":{}}],["scope",{"_index":3665,"title":{},"content":{"598":{"position":[[2195,5]]},"600":{"position":[[1100,5]]},"706":{"position":[[2195,5]]},"708":{"position":[[1100,5]]}},"keywords":{}}],["script",{"_index":1896,"title":{},"content":{"134":{"position":[[25,7]]},"314":{"position":[[25,7]]},"531":{"position":[[25,7]]}},"keywords":{}}],["sdk",{"_index":1178,"title":{},"content":{"50":{"position":[[169,4],[247,3]]},"103":{"position":[[790,4]]},"145":{"position":[[99,4]]},"295":{"position":[[790,4]]},"333":{"position":[[99,4]]},"507":{"position":[[790,4]]},"550":{"position":[[99,4]]}},"keywords":{}}],["se",{"_index":3290,"title":{},"content":{"418":{"position":[[8,2]]},"655":{"position":[[8,2]]}},"keywords":{}}],["seal",{"_index":310,"title":{},"content":{"9":{"position":[[1341,4],[1379,4]]},"10":{"position":[[54,5],[272,4],[501,5],[927,5],[1205,5]]}},"keywords":{}}],["search",{"_index":1672,"title":{},"content":{"100":{"position":[[1106,6]]},"292":{"position":[[1106,6]]},"396":{"position":[[127,6]]},"504":{"position":[[1106,6]]},"633":{"position":[[127,6]]}},"keywords":{}}],["second",{"_index":245,"title":{},"content":{"8":{"position":[[333,6]]},"20":{"position":[[666,6]]},"92":{"position":[[349,6]]},"94":{"position":[[392,6]]},"117":{"position":[[1236,6]]},"127":{"position":[[775,7]]},"148":{"position":[[748,6]]},"198":{"position":[[1938,6],[3376,6]]},"204":{"position":[[1176,6]]},"268":{"position":[[648,6],[782,6]]},"278":{"position":[[775,7]]},"284":{"position":[[349,6]]},"286":{"position":[[392,6]]},"298":{"position":[[1236,6]]},"336":{"position":[[748,6]]},"408":{"position":[[648,6],[782,6]]},"424":{"position":[[1126,6]]},"434":{"position":[[1928,6],[3358,6]]},"440":{"position":[[5931,6]]},"496":{"position":[[349,6]]},"498":{"position":[[392,6]]},"515":{"position":[[775,7]]},"519":{"position":[[1236,6]]},"553":{"position":[[748,6]]},"645":{"position":[[648,6],[782,6]]},"666":{"position":[[1126,6]]},"681":{"position":[[1938,6],[3376,6]]},"687":{"position":[[5931,6]]}},"keywords":{}}],["secondli",{"_index":1471,"title":{},"content":{"79":{"position":[[1423,9]]},"230":{"position":[[1440,9]]},"461":{"position":[[1440,9]]}},"keywords":{}}],["secret",{"_index":1135,"title":{},"content":{"43":{"position":[[997,6]]},"50":{"position":[[498,6]]},"99":{"position":[[297,6]]},"100":{"position":[[391,6]]},"101":{"position":[[245,6]]},"126":{"position":[[442,6],[578,6],[909,6],[956,6],[1673,6]]},"210":{"position":[[448,6],[1222,6]]},"277":{"position":[[442,6],[578,6],[909,6],[956,6],[1841,6]]},"291":{"position":[[297,6]]},"292":{"position":[[391,6]]},"293":{"position":[[245,6]]},"389":{"position":[[448,6],[1159,6]]},"395":{"position":[[3688,6],[4078,6],[4117,6]]},"477":{"position":[[262,6],[340,6]]},"503":{"position":[[297,6]]},"504":{"position":[[391,6]]},"505":{"position":[[245,6]]},"514":{"position":[[442,6],[578,6],[909,6],[956,6],[1673,6]]},"632":{"position":[[3688,6],[4078,6],[4117,6]]},"659":{"position":[[448,6],[1159,6]]},"699":{"position":[[262,6],[340,6]]}},"keywords":{}}],["secret_key",{"_index":1136,"title":{},"content":{"43":{"position":[[1008,14]]}},"keywords":{}}],["section",{"_index":228,"title":{},"content":{"7":{"position":[[203,8]]},"94":{"position":[[508,8]]},"97":{"position":[[329,7]]},"101":{"position":[[60,8]]},"102":{"position":[[59,8]]},"118":{"position":[[202,8]]},"122":{"position":[[12,8]]},"126":{"position":[[3485,7]]},"147":{"position":[[346,7],[428,7],[639,7]]},"155":{"position":[[12,8]]},"163":{"position":[[693,7]]},"265":{"position":[[118,7],[243,7]]},"270":{"position":[[147,8]]},"277":{"position":[[3653,7]]},"286":{"position":[[508,8]]},"289":{"position":[[329,7]]},"293":{"position":[[60,8]]},"294":{"position":[[59,8]]},"295":{"position":[[826,8]]},"299":{"position":[[202,8]]},"303":{"position":[[12,8]]},"321":{"position":[[1692,7],[1834,7],[2028,7],[2145,7],[2164,7]]},"324":{"position":[[1351,7]]},"335":{"position":[[346,7],[432,7],[643,7]]},"340":{"position":[[12,8]]},"352":{"position":[[715,7]]},"383":{"position":[[126,8]]},"385":{"position":[[147,8]]},"395":{"position":[[51,7],[6835,7]]},"396":{"position":[[894,7]]},"405":{"position":[[118,7],[243,7]]},"410":{"position":[[147,8]]},"477":{"position":[[1013,8],[1106,8],[1265,8]]},"498":{"position":[[508,8]]},"501":{"position":[[329,7]]},"505":{"position":[[60,8]]},"506":{"position":[[59,8]]},"507":{"position":[[826,8]]},"514":{"position":[[3485,7]]},"520":{"position":[[202,8]]},"524":{"position":[[12,8]]},"539":{"position":[[1692,7],[1834,7],[2028,7],[2145,7],[2164,7]]},"542":{"position":[[1351,7]]},"552":{"position":[[346,7],[432,7],[643,7]]},"560":{"position":[[12,8]]},"568":{"position":[[715,7]]},"610":{"position":[[957,8]]},"618":{"position":[[489,9]]},"625":{"position":[[126,8]]},"627":{"position":[[147,8]]},"632":{"position":[[51,7],[6835,7]]},"633":{"position":[[894,7]]},"642":{"position":[[118,7],[243,7]]},"647":{"position":[[147,8]]},"699":{"position":[[1013,8],[1106,8],[1265,8]]},"718":{"position":[[957,8]]},"726":{"position":[[489,9]]}},"keywords":{}}],["secur",{"_index":585,"title":{"190":{"position":[[0,9]]},"367":{"position":[[0,9]]},"583":{"position":[[0,9]]}},"content":{"20":{"position":[[421,8]]},"23":{"position":[[256,8]]},"393":{"position":[[347,8]]},"416":{"position":[[4779,8]]},"419":{"position":[[1751,8]]},"630":{"position":[[347,8]]},"653":{"position":[[4779,8]]},"656":{"position":[[1751,8]]}},"keywords":{}}],["see",{"_index":76,"title":{},"content":{"1":{"position":[[947,3]]},"7":{"position":[[31,3]]},"16":{"position":[[226,3]]},"26":{"position":[[0,3]]},"28":{"position":[[0,3]]},"36":{"position":[[0,3]]},"40":{"position":[[374,3]]},"46":{"position":[[0,3]]},"48":{"position":[[0,3]]},"51":{"position":[[1827,4]]},"52":{"position":[[556,3]]},"53":{"position":[[1117,3]]},"57":{"position":[[0,3]]},"59":{"position":[[0,3]]},"61":{"position":[[0,3]]},"63":{"position":[[0,3]]},"79":{"position":[[1169,4]]},"88":{"position":[[427,3]]},"100":{"position":[[1028,3]]},"101":{"position":[[729,3]]},"117":{"position":[[257,3]]},"127":{"position":[[735,3],[891,3]]},"128":{"position":[[550,4]]},"132":{"position":[[188,4]]},"143":{"position":[[6,3]]},"152":{"position":[[8,3]]},"162":{"position":[[490,3],[1381,4],[2069,3]]},"163":{"position":[[1496,3]]},"164":{"position":[[259,4]]},"166":{"position":[[27,3]]},"173":{"position":[[111,4],[151,4]]},"174":{"position":[[313,3]]},"176":{"position":[[15,3]]},"198":{"position":[[2203,4]]},"199":{"position":[[171,3]]},"214":{"position":[[0,3]]},"216":{"position":[[0,3]]},"223":{"position":[[1195,3]]},"225":{"position":[[0,3]]},"230":{"position":[[1186,4]]},"246":{"position":[[322,4]]},"250":{"position":[[427,3]]},"278":{"position":[[735,3],[891,3]]},"279":{"position":[[550,4]]},"292":{"position":[[1028,3]]},"293":{"position":[[729,3]]},"295":{"position":[[795,3]]},"298":{"position":[[257,3]]},"312":{"position":[[188,4]]},"328":{"position":[[6,3]]},"343":{"position":[[8,3]]},"351":{"position":[[527,3],[1403,4],[2091,3]]},"352":{"position":[[1518,3]]},"353":{"position":[[294,4]]},"354":{"position":[[196,3]]},"355":{"position":[[27,3]]},"359":{"position":[[111,4],[151,4]]},"360":{"position":[[313,3]]},"362":{"position":[[15,3]]},"395":{"position":[[4486,3]]},"396":{"position":[[352,3],[431,3],[536,3],[597,3],[785,3],[843,3],[1074,3]]},"397":{"position":[[259,3]]},"414":{"position":[[454,4]]},"417":{"position":[[1764,3]]},"434":{"position":[[2193,4]]},"435":{"position":[[171,3]]},"445":{"position":[[322,4]]},"449":{"position":[[0,3]]},"456":{"position":[[1195,3]]},"461":{"position":[[1186,4]]},"488":{"position":[[427,3]]},"504":{"position":[[1028,3]]},"505":{"position":[[729,3]]},"507":{"position":[[795,3]]},"515":{"position":[[735,3],[891,3]]},"516":{"position":[[550,4]]},"519":{"position":[[257,3]]},"529":{"position":[[188,4]]},"537":{"position":[[6,3]]},"557":{"position":[[8,3]]},"567":{"position":[[527,3],[1403,4],[2091,3]]},"568":{"position":[[1518,3]]},"569":{"position":[[294,4]]},"570":{"position":[[196,3]]},"571":{"position":[[27,3]]},"575":{"position":[[111,4],[151,4]]},"576":{"position":[[313,3]]},"578":{"position":[[15,3]]},"632":{"position":[[4486,3]]},"633":{"position":[[352,3],[431,3],[536,3],[597,3],[785,3],[843,3],[1074,3]]},"634":{"position":[[259,3]]},"651":{"position":[[454,4]]},"654":{"position":[[1764,3]]},"672":{"position":[[322,4]]},"681":{"position":[[2203,4]]},"682":{"position":[[171,3]]},"696":{"position":[[1195,3]]}},"keywords":{}}],["seem",{"_index":3597,"title":{},"content":{"478":{"position":[[317,6]]},"700":{"position":[[317,6]]}},"keywords":{}}],["seen",{"_index":657,"title":{},"content":{"22":{"position":[[815,4]]},"127":{"position":[[970,4]]},"168":{"position":[[1614,4]]},"278":{"position":[[970,4]]},"348":{"position":[[1614,4]]},"515":{"position":[[970,4]]},"564":{"position":[[1614,4]]}},"keywords":{}}],["select",{"_index":1872,"title":{},"content":{"129":{"position":[[386,6]]},"198":{"position":[[3076,6]]},"280":{"position":[[386,6]]},"396":{"position":[[251,8]]},"434":{"position":[[3058,6]]},"517":{"position":[[386,6]]},"633":{"position":[[251,8]]},"681":{"position":[[3076,6]]}},"keywords":{}}],["selector",{"_index":728,"title":{"609":{"position":[[0,10]]},"717":{"position":[[0,10]]}},"content":{"31":{"position":[[460,9],[2874,8],[3015,8]]},"609":{"position":[[128,9]]},"717":{"position":[[128,9]]}},"keywords":{}}],["self",{"_index":345,"title":{"413":{"position":[[0,4]]},"650":{"position":[[0,4]]}},"content":{"10":{"position":[[890,5]]},"17":{"position":[[663,5],[755,5],[822,5],[1100,5],[2257,5],[2712,5],[3110,5],[3717,5]]},"22":{"position":[[1208,5],[1275,5]]},"51":{"position":[[609,5],[730,5],[955,5]]},"71":{"position":[[71,5]]},"73":{"position":[[177,5],[362,5]]},"79":{"position":[[867,5]]},"80":{"position":[[474,5],[547,5]]},"115":{"position":[[354,5],[605,5],[676,5],[757,5],[1179,5],[1231,5],[2197,5],[2503,5],[2706,5],[2784,5],[2831,5]]},"147":{"position":[[266,5],[1095,5],[1218,5]]},"162":{"position":[[785,5]]},"163":{"position":[[809,5]]},"164":{"position":[[573,5],[851,5]]},"178":{"position":[[572,5],[682,5],[805,5]]},"185":{"position":[[861,5],[1056,5],[1254,5],[1650,5],[1937,5],[2208,5]]},"196":{"position":[[101,5]]},"197":{"position":[[237,5]]},"204":{"position":[[84,5],[640,5]]},"205":{"position":[[311,5],[480,5],[710,5],[1224,5],[1654,5]]},"209":{"position":[[978,5],[1263,5]]},"222":{"position":[[112,5],[263,5]]},"223":{"position":[[488,5],[633,5],[691,5]]},"230":{"position":[[884,5]]},"231":{"position":[[474,5],[547,5]]},"235":{"position":[[71,5]]},"237":{"position":[[177,5],[362,5]]},"247":{"position":[[119,5],[818,5],[942,5],[1093,5],[1286,5],[1384,5]]},"258":{"position":[[344,5],[591,5],[658,5],[735,5],[1125,5],[1177,5],[2143,5],[2445,5],[2636,5],[2710,5],[2757,5]]},"269":{"position":[[573,5],[1057,5],[1226,5],[1456,5],[1947,5],[2174,5],[2515,5],[2887,5]]},"321":{"position":[[1135,5],[1355,5]]},"335":{"position":[[266,5],[1103,5],[1226,5]]},"351":{"position":[[807,5]]},"352":{"position":[[831,5]]},"353":{"position":[[608,5],[886,5]]},"369":{"position":[[572,5],[682,5],[805,5]]},"376":{"position":[[845,5],[1040,5],[1238,5],[1634,5],[1921,5],[2192,5]]},"384":{"position":[[586,5],[1070,5],[1239,5],[1469,5],[1967,5],[2194,5],[2542,5],[2921,5]]},"388":{"position":[[910,5],[1195,5]]},"409":{"position":[[573,5],[1057,5],[1226,5],[1456,5],[1947,5],[2174,5],[2515,5],[2887,5]]},"416":{"position":[[1445,5],[2681,5],[3512,5],[3733,4],[4388,4]]},"419":{"position":[[1384,5],[1524,4],[2210,5],[2989,5],[3133,5],[3278,5],[3403,5],[3564,5],[3713,5],[3838,5],[3964,5],[4636,5],[5091,5],[5312,4],[5968,4],[6300,4]]},"424":{"position":[[59,5],[615,5]]},"425":{"position":[[286,5],[455,5],[685,5],[1199,5],[1629,5]]},"432":{"position":[[63,5]]},"433":{"position":[[237,5]]},"440":{"position":[[1171,5],[1643,5],[2259,5],[2590,4],[6264,5]]},"441":{"position":[[906,5],[1098,5],[1222,4],[2498,5],[2855,5],[3134,5]]},"446":{"position":[[119,5],[818,5],[942,5],[1093,5],[1286,5],[1384,5]]},"455":{"position":[[112,5],[263,5]]},"456":{"position":[[488,5],[633,5],[691,5]]},"461":{"position":[[884,5]]},"462":{"position":[[474,5],[547,5]]},"471":{"position":[[71,5]]},"473":{"position":[[177,5],[362,5]]},"476":{"position":[[511,5],[664,5],[1239,5]]},"481":{"position":[[344,5],[591,5],[658,5],[735,5],[1125,5],[1177,5],[2143,5],[2445,5],[2636,5],[2710,5],[2757,5]]},"539":{"position":[[1135,5],[1355,5]]},"552":{"position":[[266,5],[1103,5],[1226,5]]},"567":{"position":[[807,5]]},"568":{"position":[[831,5]]},"569":{"position":[[608,5],[886,5]]},"585":{"position":[[572,5],[682,5],[805,5]]},"592":{"position":[[845,5],[1040,5],[1238,5],[1634,5],[1921,5],[2192,5]]},"596":{"position":[[328,5]]},"598":{"position":[[699,5]]},"600":{"position":[[208,5]]},"601":{"position":[[470,5],[564,5],[910,5],[1022,5],[1340,5],[1528,5],[1651,5],[1759,5]]},"602":{"position":[[338,5],[412,5],[479,5],[1309,5],[1412,5],[1581,5]]},"604":{"position":[[166,5],[347,5]]},"605":{"position":[[525,5]]},"606":{"position":[[186,5],[349,5],[493,5]]},"608":{"position":[[205,5]]},"611":{"position":[[250,5]]},"613":{"position":[[544,5],[634,5],[975,5]]},"616":{"position":[[702,5]]},"617":{"position":[[195,5]]},"626":{"position":[[586,5],[1070,5],[1239,5],[1469,5],[1967,5],[2194,5],[2542,5],[2921,5]]},"646":{"position":[[573,5],[1057,5],[1226,5],[1456,5],[1947,5],[2174,5],[2515,5],[2887,5]]},"653":{"position":[[1445,5],[2681,5],[3512,5],[3733,4],[4388,4]]},"656":{"position":[[1384,5],[1524,4],[2210,5],[2989,5],[3133,5],[3278,5],[3403,5],[3564,5],[3713,5],[3838,5],[3964,5],[4636,5],[5091,5],[5312,4],[5968,4],[6300,4]]},"658":{"position":[[910,5],[1195,5]]},"666":{"position":[[59,5],[615,5]]},"667":{"position":[[286,5],[455,5],[685,5],[1199,5],[1629,5]]},"673":{"position":[[119,5],[818,5],[942,5],[1093,5],[1286,5],[1384,5]]},"679":{"position":[[63,5]]},"680":{"position":[[237,5]]},"687":{"position":[[1171,5],[1643,5],[2259,5],[2590,4],[6264,5]]},"688":{"position":[[906,5],[1098,5],[1222,4],[2498,5],[2855,5],[3134,5]]},"695":{"position":[[112,5],[263,5]]},"696":{"position":[[488,5],[633,5],[691,5]]},"698":{"position":[[511,5],[664,5],[1239,5]]},"704":{"position":[[328,5]]},"706":{"position":[[699,5]]},"708":{"position":[[208,5]]},"709":{"position":[[470,5],[564,5],[910,5],[1022,5],[1340,5],[1528,5],[1651,5],[1759,5]]},"710":{"position":[[338,5],[412,5],[479,5],[1309,5],[1412,5],[1581,5]]},"712":{"position":[[166,5],[347,5]]},"713":{"position":[[525,5]]},"714":{"position":[[186,5],[349,5],[493,5]]},"716":{"position":[[205,5]]},"719":{"position":[[250,5]]},"721":{"position":[[544,5],[634,5],[975,5]]},"724":{"position":[[702,5]]},"725":{"position":[[195,5]]}},"keywords":{}}],["self.a.foo",{"_index":3822,"title":{},"content":{"612":{"position":[[1333,12]]},"720":{"position":[[1333,12]]}},"keywords":{}}],["self.address.set",{"_index":3645,"title":{},"content":{"598":{"position":[[806,17]]},"706":{"position":[[806,17]]}},"keywords":{}}],["self.allow",{"_index":2489,"title":{},"content":{"205":{"position":[[1892,15]]},"425":{"position":[[1867,15]]},"667":{"position":[[1867,15]]}},"keywords":{}}],["self.allowance(own",{"_index":2486,"title":{},"content":{"205":{"position":[[1741,21]]},"425":{"position":[[1716,21]]},"667":{"position":[[1716,21]]}},"keywords":{}}],["self.allowances.get_or_default(&(*own",{"_index":2477,"title":{},"content":{"205":{"position":[[1122,44]]},"269":{"position":[[1868,44],[2974,44]]},"384":{"position":[[1888,44],[3008,44]]},"409":{"position":[[1868,44],[2974,44]]},"425":{"position":[[1097,44]]},"626":{"position":[[1888,44],[3008,44]]},"646":{"position":[[1868,44],[2974,44]]},"667":{"position":[[1097,44]]}},"keywords":{}}],["self.allowances.set(&(own",{"_index":2474,"title":{},"content":{"205":{"position":[[793,32]]},"269":{"position":[[1539,32]]},"384":{"position":[[1552,32]]},"409":{"position":[[1539,32]]},"425":{"position":[[768,32]]},"626":{"position":[[1552,32]]},"646":{"position":[[1539,32]]},"667":{"position":[[768,32]]}},"keywords":{}}],["self.allowances.subtract(&(*own",{"_index":2942,"title":{},"content":{"269":{"position":[[3102,38]]},"384":{"position":[[3143,38]]},"409":{"position":[[3102,38]]},"626":{"position":[[3143,38]]},"646":{"position":[[3102,38]]}},"keywords":{}}],["self.allowed.get_or_default(&(from",{"_index":540,"title":{},"content":{"17":{"position":[[3326,39]]}},"keywords":{}}],["self.allowed.get_or_default(&(own",{"_index":547,"title":{},"content":{"17":{"position":[[3917,40]]}},"keywords":{}}],["self.allowed.set(&(from",{"_index":542,"title":{},"content":{"17":{"position":[[3635,28]]}},"keywords":{}}],["self.allowed.set(&(own",{"_index":545,"title":{},"content":{"17":{"position":[[3792,29]]}},"keywords":{}}],["self.answer.get_or_default",{"_index":3903,"title":{},"content":{"616":{"position":[[1116,28]]},"724":{"position":[[1116,28]]}},"keywords":{}}],["self.answer.set",{"_index":3868,"title":{},"content":{"616":{"position":[[710,17]]},"724":{"position":[[710,17]]}},"keywords":{}}],["self.arr.get_or_default",{"_index":3705,"title":{},"content":{"601":{"position":[[1475,25],[1803,26]]},"613":{"position":[[997,26],[1111,26]]},"709":{"position":[[1475,25],[1803,26]]},"721":{"position":[[997,26],[1111,26]]}},"keywords":{}}],["self.arr.remove(1",{"_index":3847,"title":{},"content":{"613":{"position":[[1081,19]]},"721":{"position":[[1081,19]]}},"keywords":{}}],["self.arr.set([1",{"_index":3702,"title":{},"content":{"601":{"position":[[1348,16]]},"709":{"position":[[1348,16]]}},"keywords":{}}],["self.arr.set(arr",{"_index":3714,"title":{},"content":{"601":{"position":[[1859,18]]},"613":{"position":[[1062,18]]},"709":{"position":[[1859,18]]},"721":{"position":[[1062,18]]}},"keywords":{}}],["self.assert_vote_in_progress",{"_index":3244,"title":{},"content":{"416":{"position":[[2770,31]]},"419":{"position":[[4725,31]]},"653":{"position":[[2770,31]]},"656":{"position":[[4725,31]]}},"keywords":{}}],["self.b.foo",{"_index":3820,"title":{},"content":{"612":{"position":[[1175,12]]},"720":{"position":[[1175,12]]}},"keywords":{}}],["self.balance_of(&self.env().cal",{"_index":3234,"title":{},"content":{"416":{"position":[[1703,41]]},"419":{"position":[[4220,41]]},"653":{"position":[[1703,41]]},"656":{"position":[[4220,41]]}},"keywords":{}}],["self.balance_of(address",{"_index":2935,"title":{},"content":{"269":{"position":[[2227,24]]},"384":{"position":[[2247,24]]},"409":{"position":[[2227,24]]},"626":{"position":[[2247,24]]},"646":{"position":[[2227,24]]}},"keywords":{}}],["self.balances.add(address",{"_index":2449,"title":{},"content":{"204":{"position":[[690,26],[1430,26]]},"269":{"position":[[2029,26]]},"384":{"position":[[2049,26]]},"409":{"position":[[2029,26]]},"424":{"position":[[665,26],[1380,26]]},"626":{"position":[[2049,26]]},"646":{"position":[[2029,26]]},"666":{"position":[[665,26],[1380,26]]}},"keywords":{}}],["self.balances.add(recipi",{"_index":2482,"title":{},"content":{"205":{"position":[[1490,28]]},"269":{"position":[[2723,28]]},"384":{"position":[[2757,28]]},"409":{"position":[[2723,28]]},"425":{"position":[[1465,28]]},"626":{"position":[[2757,28]]},"646":{"position":[[2723,28]]},"667":{"position":[[1465,28]]}},"keywords":{}}],["self.balances.get(&caller).is_som",{"_index":1360,"title":{},"content":{"71":{"position":[[273,40]]},"235":{"position":[[273,40]]},"471":{"position":[[273,40]]},"476":{"position":[[866,40]]},"698":{"position":[[866,40]]}},"keywords":{}}],["self.balances.get(address).unwrap_or_default",{"_index":2461,"title":{},"content":{"204":{"position":[[1546,47]]},"424":{"position":[[1496,47]]},"666":{"position":[[1496,47]]}},"keywords":{}}],["self.balances.get_or_default(&address",{"_index":2476,"title":{},"content":{"205":{"position":[[992,42]]},"425":{"position":[[967,42]]},"667":{"position":[[967,42]]}},"keywords":{}}],["self.balances.get_or_default(&from",{"_index":532,"title":{},"content":{"17":{"position":[[2800,40],[3215,40]]}},"keywords":{}}],["self.balances.get_or_default(&own",{"_index":529,"title":{},"content":{"17":{"position":[[2644,40]]},"205":{"position":[[1317,41]]},"425":{"position":[[1292,41]]},"667":{"position":[[1292,41]]}},"keywords":{}}],["self.balances.get_or_default(&to",{"_index":534,"title":{},"content":{"17":{"position":[[2858,38],[3273,38]]}},"keywords":{}}],["self.balances.get_or_default(own",{"_index":2939,"title":{},"content":{"269":{"position":[[2604,35]]},"384":{"position":[[2631,35]]},"409":{"position":[[2604,35]]},"626":{"position":[[2631,35]]},"646":{"position":[[2604,35]]}},"keywords":{}}],["self.balances.set(&cal",{"_index":1362,"title":{},"content":{"71":{"position":[[386,30]]},"235":{"position":[[386,30]]},"269":{"position":[[857,30]]},"384":{"position":[[870,30]]},"409":{"position":[[857,30]]},"471":{"position":[[386,30]]},"476":{"position":[[981,30]]},"626":{"position":[[870,30]]},"646":{"position":[[857,30]]},"698":{"position":[[981,30]]}},"keywords":{}}],["self.balances.set(&contract_env::cal",{"_index":525,"title":{},"content":{"17":{"position":[[2441,46]]}},"keywords":{}}],["self.balances.set(&from",{"_index":537,"title":{},"content":{"17":{"position":[[2978,28],[3535,28]]}},"keywords":{}}],["self.balances.set(&to",{"_index":538,"title":{},"content":{"17":{"position":[[3030,26],[3587,26]]}},"keywords":{}}],["self.balances.set(address",{"_index":2466,"title":{},"content":{"204":{"position":[[1729,26]]},"424":{"position":[[1679,26]]},"666":{"position":[[1679,26]]}},"keywords":{}}],["self.balances.set(own",{"_index":2481,"title":{},"content":{"205":{"position":[[1439,24]]},"425":{"position":[[1414,24]]},"667":{"position":[[1414,24]]}},"keywords":{}}],["self.balances.subtract(address",{"_index":2938,"title":{},"content":{"269":{"position":[[2346,31]]},"384":{"position":[[2373,31]]},"409":{"position":[[2346,31]]},"626":{"position":[[2373,31]]},"646":{"position":[[2346,31]]}},"keywords":{}}],["self.balances.subtract(own",{"_index":2940,"title":{},"content":{"269":{"position":[[2683,29]]},"384":{"position":[[2717,29]]},"409":{"position":[[2683,29]]},"626":{"position":[[2717,29]]},"646":{"position":[[2683,29]]}},"keywords":{}}],["self.barks.get_or_default",{"_index":2061,"title":{},"content":{"162":{"position":[[986,27],[1491,27]]},"351":{"position":[[1008,27],[1513,27]]},"567":{"position":[[1008,27],[1513,27]]}},"keywords":{}}],["self.barks.set(bark",{"_index":2057,"title":{},"content":{"162":{"position":[[833,22],[1744,22]]},"351":{"position":[[855,22],[1766,22]]},"567":{"position":[[855,22],[1766,22]]}},"keywords":{}}],["self.boo.set(tru",{"_index":3640,"title":{},"content":{"598":{"position":[[707,19]]},"706":{"position":[[707,19]]}},"keywords":{}}],["self.bytes.set(bytes::from(vec![0xb5",{"_index":3649,"title":{},"content":{"598":{"position":[[967,40]]},"706":{"position":[[967,40]]}},"keywords":{}}],["self.c.foo",{"_index":3819,"title":{},"content":{"612":{"position":[[1018,12]]},"720":{"position":[[1018,12]]}},"keywords":{}}],["self.check_role(&self.get_role_admin(rol",{"_index":2227,"title":{},"content":{"185":{"position":[[909,47],[1104,47]]},"376":{"position":[[893,47],[1088,47]]},"592":{"position":[[893,47],[1088,47]]}},"keywords":{}}],["self.count",{"_index":1388,"title":{},"content":{"73":{"position":[[207,13]]},"237":{"position":[[207,13]]},"473":{"position":[[207,13]]}},"keywords":{}}],["self.counter.get_current_valu",{"_index":1486,"title":{},"content":{"80":{"position":[[405,32]]},"231":{"position":[[405,32]]},"462":{"position":[[405,32]]}},"keywords":{}}],["self.counter.get_or_default",{"_index":1392,"title":{},"content":{"73":{"position":[[378,30]]},"237":{"position":[[378,30]]},"473":{"position":[[378,30]]}},"keywords":{}}],["self.counter.next_valu",{"_index":1488,"title":{},"content":{"80":{"position":[[492,25]]},"231":{"position":[[492,25]]},"462":{"position":[[492,25]]}},"keywords":{}}],["self.counter.set(c",{"_index":1393,"title":{},"content":{"73":{"position":[[409,18]]},"237":{"position":[[409,18]]},"473":{"position":[[409,18]]}},"keywords":{}}],["self.data.inner.named_values.set(&nam",{"_index":2563,"title":{},"content":{"209":{"position":[[1340,43]]},"388":{"position":[[1272,43]]},"658":{"position":[[1272,43]]}},"keywords":{}}],["self.data.inner.named_values.set(&name2",{"_index":2564,"title":{},"content":{"209":{"position":[[1389,44]]},"388":{"position":[[1321,44]]},"658":{"position":[[1321,44]]}},"keywords":{}}],["self.data.value.set(valu",{"_index":2562,"title":{},"content":{"209":{"position":[[1312,27]]},"388":{"position":[[1244,27]]},"658":{"position":[[1244,27]]}},"keywords":{}}],["self.decimals.get_or_default",{"_index":2447,"title":{},"content":{"204":{"position":[[490,30]]},"424":{"position":[[465,30]]},"666":{"position":[[465,30]]}},"keywords":{}}],["self.decimals.set(decim",{"_index":523,"title":{},"content":{"17":{"position":[[2375,28]]},"204":{"position":[[238,28]]},"269":{"position":[[742,28]]},"384":{"position":[[755,28]]},"409":{"position":[[742,28]]},"424":{"position":[[213,28]]},"626":{"position":[[755,28]]},"646":{"position":[[742,28]]},"666":{"position":[[213,28]]}},"keywords":{}}],["self.decrement(i",{"_index":3760,"title":{},"content":{"606":{"position":[[280,16]]},"714":{"position":[[280,16]]}},"keywords":{}}],["self.default_addr.get_or_default",{"_index":3660,"title":{},"content":{"598":{"position":[[1508,34]]},"706":{"position":[[1508,34]]}},"keywords":{}}],["self.default_boo.get_or_default",{"_index":3654,"title":{},"content":{"598":{"position":[[1192,33]]},"706":{"position":[[1192,33]]}},"keywords":{}}],["self.default_int.get_or_default",{"_index":3658,"title":{},"content":{"598":{"position":[[1359,33]]},"706":{"position":[[1359,33]]}},"keywords":{}}],["self.default_uint.get_or_default",{"_index":3656,"title":{},"content":{"598":{"position":[[1276,34]]},"706":{"position":[[1276,34]]}},"keywords":{}}],["self.ensure_ownership(&self.env().cal",{"_index":2355,"title":{},"content":{"197":{"position":[[270,48]]},"433":{"position":[[270,48]]},"680":{"position":[[270,48]]}},"keywords":{}}],["self.env",{"_index":1366,"title":{},"content":{"71":{"position":[[513,10]]},"235":{"position":[[513,10]]},"267":{"position":[[1833,10],[1862,10]]},"407":{"position":[[1833,10],[1862,10]]},"419":{"position":[[4280,10]]},"440":{"position":[[1694,11],[2298,11]]},"441":{"position":[[1137,11],[3202,11]]},"471":{"position":[[513,10]]},"610":{"position":[[248,11]]},"613":{"position":[[666,11]]},"616":{"position":[[279,11],[1031,11]]},"644":{"position":[[1833,10],[1862,10]]},"656":{"position":[[4280,10]]},"687":{"position":[[1694,11],[2298,11]]},"688":{"position":[[1137,11],[3202,11]]},"718":{"position":[[248,11]]},"721":{"position":[[666,11]]},"724":{"position":[[279,11],[1031,11]]}},"keywords":{}}],["self.env().attached_valu",{"_index":1356,"title":{},"content":{"71":{"position":[[159,28]]},"92":{"position":[[800,28]]},"235":{"position":[[159,28]]},"284":{"position":[[800,28]]},"471":{"position":[[159,28]]},"476":{"position":[[752,28]]},"496":{"position":[[800,28]]},"698":{"position":[[752,28]]}},"keywords":{}}],["self.env().cal",{"_index":1355,"title":{},"content":{"71":{"position":[[119,20]]},"94":{"position":[[353,19]]},"115":{"position":[[443,20],[2306,20]]},"185":{"position":[[2142,19],[2413,19]]},"204":{"position":[[171,20]]},"205":{"position":[[376,20],[567,20],[772,20]]},"222":{"position":[[213,19],[363,19]]},"235":{"position":[[119,20]]},"247":{"position":[[208,20]]},"258":{"position":[[433,20],[2252,20]]},"269":{"position":[[675,20],[1122,20],[1313,20],[1518,20]]},"286":{"position":[[353,19]]},"376":{"position":[[2126,19],[2397,19]]},"384":{"position":[[688,20],[1135,20],[1326,20],[1531,20]]},"409":{"position":[[675,20],[1122,20],[1313,20],[1518,20]]},"416":{"position":[[2814,20]]},"419":{"position":[[4769,20]]},"424":{"position":[[146,20]]},"425":{"position":[[351,20],[542,20],[747,20]]},"441":{"position":[[2581,20]]},"446":{"position":[[208,20]]},"455":{"position":[[213,19],[363,19]]},"471":{"position":[[119,20]]},"476":{"position":[[712,20]]},"481":{"position":[[433,20],[2252,20]]},"498":{"position":[[353,19]]},"592":{"position":[[2126,19],[2397,19]]},"600":{"position":[[439,20]]},"626":{"position":[[688,20],[1135,20],[1326,20],[1531,20]]},"646":{"position":[[675,20],[1122,20],[1313,20],[1518,20]]},"653":{"position":[[2814,20]]},"656":{"position":[[4769,20]]},"666":{"position":[[146,20]]},"667":{"position":[[351,20],[542,20],[747,20]]},"673":{"position":[[208,20]]},"688":{"position":[[2581,20]]},"695":{"position":[[213,19],[363,19]]},"698":{"position":[[712,20]]},"708":{"position":[[439,20]]}},"keywords":{}}],["self.env().emit_event(approv",{"_index":2475,"title":{},"content":{"205":{"position":[[847,30],[1954,30]]},"269":{"position":[[1593,30],[3162,30]]},"384":{"position":[[1606,30],[3203,30]]},"409":{"position":[[1593,30],[3162,30]]},"425":{"position":[[822,30],[1929,30]]},"626":{"position":[[1606,30],[3203,30]]},"646":{"position":[[1593,30],[3162,30]]},"667":{"position":[[822,30],[1929,30]]}},"keywords":{}}],["self.env().emit_event(cr",{"_index":2973,"title":{},"content":{"321":{"position":[[1233,29]]},"539":{"position":[[1233,29]]}},"keywords":{}}],["self.env().emit_event(deposit",{"_index":3544,"title":{},"content":{"476":{"position":[[1108,29]]},"698":{"position":[[1108,29]]}},"keywords":{}}],["self.env().emit_event(ownershipchang",{"_index":2327,"title":{},"content":{"196":{"position":[[251,38]]},"197":{"position":[[391,38]]},"432":{"position":[[213,38]]},"433":{"position":[[391,38]]},"679":{"position":[[213,38]]},"680":{"position":[[391,38]]}},"keywords":{}}],["self.env().emit_event(paus",{"_index":2724,"title":{},"content":{"222":{"position":[[173,28]]},"455":{"position":[[173,28]]},"695":{"position":[[173,28]]}},"keywords":{}}],["self.env().emit_event(roleadminchang",{"_index":2240,"title":{},"content":{"185":{"position":[[1791,38]]},"376":{"position":[[1775,38]]},"592":{"position":[[1775,38]]}},"keywords":{}}],["self.env().emit_event(rolegr",{"_index":2243,"title":{},"content":{"185":{"position":[[2066,33]]},"376":{"position":[[2050,33]]},"592":{"position":[[2050,33]]}},"keywords":{}}],["self.env().emit_event(rolerevok",{"_index":2245,"title":{},"content":{"185":{"position":[[2337,33]]},"376":{"position":[[2321,33]]},"592":{"position":[[2321,33]]}},"keywords":{}}],["self.env().emit_event(transf",{"_index":2451,"title":{},"content":{"204":{"position":[[759,30]]},"205":{"position":[[1529,30]]},"267":{"position":[[1714,30]]},"269":{"position":[[936,30],[2066,30],[2388,30],[2762,30]]},"384":{"position":[[949,30],[2086,30],[2415,30],[2796,30]]},"407":{"position":[[1714,30]]},"409":{"position":[[936,30],[2066,30],[2388,30],[2762,30]]},"424":{"position":[[734,30]]},"425":{"position":[[1504,30]]},"626":{"position":[[949,30],[2086,30],[2415,30],[2796,30]]},"644":{"position":[[1714,30]]},"646":{"position":[[936,30],[2066,30],[2388,30],[2762,30]]},"666":{"position":[[734,30]]},"667":{"position":[[1504,30]]}},"keywords":{}}],["self.env().emit_event(unpaus",{"_index":2728,"title":{},"content":{"222":{"position":[[321,30]]},"455":{"position":[[321,30]]},"695":{"position":[[321,30]]}},"keywords":{}}],["self.env().emit_event(upd",{"_index":2975,"title":{},"content":{"321":{"position":[[1406,29]]},"539":{"position":[[1406,29]]}},"keywords":{}}],["self.env().get_block_tim",{"_index":1358,"title":{},"content":{"71":{"position":[[218,28]]},"235":{"position":[[218,28]]},"416":{"position":[[3812,27]]},"419":{"position":[[5391,27],[6379,27]]},"471":{"position":[[218,28]]},"476":{"position":[[811,28]]},"600":{"position":[[397,28]]},"653":{"position":[[3812,27]]},"656":{"position":[[5391,27],[6379,27]]},"698":{"position":[[811,28]]},"708":{"position":[[397,28]]}},"keywords":{}}],["self.env().revert("no",{"_index":3764,"title":{},"content":{"606":{"position":[[391,26]]},"714":{"position":[[391,26]]}},"keywords":{}}],["self.env().revert(customerror::inputlowerthanten",{"_index":3803,"title":{},"content":{"611":{"position":[[290,50]]},"719":{"position":[[290,50]]}},"keywords":{}}],["self.env().revert(customerror::insufficientbal",{"_index":3806,"title":{},"content":{"611":{"position":[[485,52]]},"719":{"position":[[485,52]]}},"keywords":{}}],["self.env().revert(error::cannotlocktwic",{"_index":3543,"title":{},"content":{"476":{"position":[[909,41]]},"698":{"position":[[909,41]]}},"keywords":{}}],["self.env().revert(error::insufficientallow",{"_index":2487,"title":{},"content":{"205":{"position":[[1801,47]]},"384":{"position":[[3093,47]]},"425":{"position":[[1776,47]]},"626":{"position":[[3093,47]]},"667":{"position":[[1776,47]]}},"keywords":{}}],["self.env().revert(error::insufficientbal",{"_index":2480,"title":{},"content":{"205":{"position":[[1391,45]]},"384":{"position":[[2287,46],[2669,45]]},"425":{"position":[[1366,45]]},"626":{"position":[[2287,46],[2669,45]]},"667":{"position":[[1366,45]]}},"keywords":{}}],["self.env().revert(error::missingrol",{"_index":2236,"title":{},"content":{"185":{"position":[[1576,38]]},"376":{"position":[[1560,38]]},"592":{"position":[[1560,38]]}},"keywords":{}}],["self.env().revert(error::notown",{"_index":2354,"title":{},"content":{"197":{"position":[[165,34]]},"433":{"position":[[165,34]]},"680":{"position":[[165,34]]}},"keywords":{}}],["self.env().revert(error::ownerisalreadyiniti",{"_index":2325,"title":{},"content":{"196":{"position":[[168,51]]},"432":{"position":[[130,51]]},"679":{"position":[[130,51]]}},"keywords":{}}],["self.env().revert(error::ownerisnotiniti",{"_index":2362,"title":{},"content":{"197":{"position":[[609,47]]},"433":{"position":[[609,47]]},"680":{"position":[[609,47]]}},"keywords":{}}],["self.env().revert(error::pausedrequir",{"_index":2712,"title":{},"content":{"221":{"position":[[315,41]]},"454":{"position":[[315,41]]},"694":{"position":[[315,41]]}},"keywords":{}}],["self.env().revert(error::rolerenounceforanotheraddress",{"_index":2233,"title":{},"content":{"185":{"position":[[1343,56]]},"376":{"position":[[1327,56]]},"592":{"position":[[1327,56]]}},"keywords":{}}],["self.env().revert(error::unpausedrequir",{"_index":2710,"title":{},"content":{"221":{"position":[[209,43]]},"454":{"position":[[209,43]]},"694":{"position":[[209,43]]}},"keywords":{}}],["self.env().revert(governanceerror::novoteinprogress",{"_index":3251,"title":{},"content":{"416":{"position":[[3600,53]]},"419":{"position":[[5179,53],[6226,53]]},"653":{"position":[[3600,53]]},"656":{"position":[[5179,53],[6226,53]]}},"keywords":{}}],["self.env().revert(governanceerror::onlytokenholderscanpropos",{"_index":3235,"title":{},"content":{"416":{"position":[[1763,63]]},"653":{"position":[[1763,63]]}},"keywords":{}}],["self.env().revert(governanceerror::votealreadyopen",{"_index":3233,"title":{},"content":{"416":{"position":[[1595,52]]},"419":{"position":[[4112,52]]},"653":{"position":[[1595,52]]},"656":{"position":[[4112,52]]}},"keywords":{}}],["self.env().revert(governanceerror::voteend",{"_index":3318,"title":{},"content":{"419":{"position":[[6426,46]]},"656":{"position":[[6426,46]]}},"keywords":{}}],["self.env().revert(governanceerror::votenotyetend",{"_index":3254,"title":{},"content":{"416":{"position":[[3859,52]]},"419":{"position":[[5438,52]]},"653":{"position":[[3859,52]]},"656":{"position":[[5438,52]]}},"keywords":{}}],["self.env().revert(insufficientallow",{"_index":2941,"title":{},"content":{"269":{"position":[[3059,40]]},"409":{"position":[[3059,40]]},"646":{"position":[[3059,40]]}},"keywords":{}}],["self.env().revert(insufficientbal",{"_index":2936,"title":{},"content":{"269":{"position":[[2267,39],[2642,38]]},"409":{"position":[[2267,39],[2642,38]]},"646":{"position":[[2267,39],[2642,38]]}},"keywords":{}}],["self.env().self_address",{"_index":1619,"title":{},"content":{"94":{"position":[[220,25]]},"286":{"position":[[220,25]]},"416":{"position":[[2850,26],[4015,26]]},"419":{"position":[[4805,26],[5594,26]]},"498":{"position":[[220,25]]},"653":{"position":[[2850,26],[4015,26]]},"656":{"position":[[4805,26],[5594,26]]}},"keywords":{}}],["self.env().self_address()).count_ref_recursive(n",{"_index":1390,"title":{},"content":{"73":{"position":[[256,48]]},"237":{"position":[[256,48]]},"473":{"position":[[256,48]]}},"keywords":{}}],["self.env().self_bal",{"_index":1623,"title":{},"content":{"94":{"position":[[604,26]]},"286":{"position":[[604,26]]},"440":{"position":[[3286,25]]},"441":{"position":[[1568,25]]},"498":{"position":[[604,26]]},"608":{"position":[[375,26]]},"611":{"position":[[424,26]]},"687":{"position":[[3286,25]]},"688":{"position":[[1568,25]]},"716":{"position":[[375,26]]},"719":{"position":[[424,26]]}},"keywords":{}}],["self.env().transfer_tokens(&self.owner.get_or_revert_with(executionerror::unwraperror",{"_index":3783,"title":{},"content":{"608":{"position":[[402,91]]},"716":{"position":[[402,91]]}},"keywords":{}}],["self.env().transfer_tokens(&to",{"_index":3785,"title":{},"content":{"608":{"position":[[566,35]]},"716":{"position":[[566,35]]}},"keywords":{}}],["self.env.revert(error::cannotlocktwic",{"_index":1361,"title":{},"content":{"71":{"position":[[316,39]]},"235":{"position":[[316,39]]},"471":{"position":[[316,39]]}},"keywords":{}}],["self.erc20",{"_index":1722,"title":{},"content":{"115":{"position":[[567,10],[2465,10]]},"258":{"position":[[557,10],[2411,10]]},"481":{"position":[[557,10],[2411,10]]}},"keywords":{}}],["self.erc20.allowance(own",{"_index":2761,"title":{},"content":{"247":{"position":[[754,27]]},"446":{"position":[[754,27]]},"673":{"position":[[754,27]]}},"keywords":{}}],["self.erc20.approve(spend",{"_index":2764,"title":{},"content":{"247":{"position":[[1143,27]]},"446":{"position":[[1143,27]]},"673":{"position":[[1143,27]]}},"keywords":{}}],["self.erc20.balance_of(address",{"_index":2760,"title":{},"content":{"247":{"position":[[636,30]]},"446":{"position":[[636,30]]},"673":{"position":[[636,30]]}},"keywords":{}}],["self.erc20.decim",{"_index":2758,"title":{},"content":{"247":{"position":[[475,21]]},"446":{"position":[[475,21]]},"673":{"position":[[475,21]]}},"keywords":{}}],["self.erc20.init(nam",{"_index":1721,"title":{},"content":{"115":{"position":[[493,21],[2356,21]]},"247":{"position":[[258,21]]},"258":{"position":[[483,21],[2302,21]]},"446":{"position":[[258,21]]},"481":{"position":[[483,21],[2302,21]]},"673":{"position":[[258,21]]}},"keywords":{}}],["self.erc20.mint(address",{"_index":1731,"title":{},"content":{"115":{"position":[[1323,24],[2923,24]]},"247":{"position":[[1491,24]]},"258":{"position":[[1269,24],[2849,24]]},"446":{"position":[[1491,24]]},"481":{"position":[[1269,24],[2849,24]]},"673":{"position":[[1491,24]]}},"keywords":{}}],["self.erc20.nam",{"_index":2756,"title":{},"content":{"247":{"position":[[355,17]]},"446":{"position":[[355,17]]},"673":{"position":[[355,17]]}},"keywords":{}}],["self.erc20.symbol",{"_index":2757,"title":{},"content":{"247":{"position":[[415,19]]},"446":{"position":[[415,19]]},"673":{"position":[[415,19]]}},"keywords":{}}],["self.erc20.total_suppli",{"_index":2759,"title":{},"content":{"247":{"position":[[543,25]]},"446":{"position":[[543,25]]},"673":{"position":[[543,25]]}},"keywords":{}}],["self.erc20.transfer(recipi",{"_index":2762,"title":{},"content":{"247":{"position":[[870,30]]},"446":{"position":[[870,30]]},"673":{"position":[[870,30]]}},"keywords":{}}],["self.erc20.transfer_from(own",{"_index":2763,"title":{},"content":{"247":{"position":[[1015,31]]},"446":{"position":[[1015,31]]},"673":{"position":[[1015,31]]}},"keywords":{}}],["self.exchang",{"_index":1745,"title":{},"content":{"115":{"position":[[2669,13]]},"258":{"position":[[2603,13]]},"481":{"position":[[2603,13]]}},"keywords":{}}],["self.exchange.init(exchange_r",{"_index":1744,"title":{},"content":{"115":{"position":[[2413,34]]},"258":{"position":[[2359,34]]},"481":{"position":[[2359,34]]}},"keywords":{}}],["self.flips_count.set(self.flips_count.get_or_default",{"_index":484,"title":{},"content":{"17":{"position":[[865,56]]}},"keywords":{}}],["self.friends.get_or_default(&friend_nam",{"_index":2091,"title":{},"content":{"163":{"position":[[993,45]]},"352":{"position":[[1015,45]]},"568":{"position":[[1015,45]]}},"keywords":{}}],["self.friends.set(&friend_nam",{"_index":2089,"title":{},"content":{"163":{"position":[[885,34]]},"352":{"position":[[907,34]]},"568":{"position":[[907,34]]}},"keywords":{}}],["self.get_or_default",{"_index":3837,"title":{},"content":{"613":{"position":[[692,22]]},"721":{"position":[[692,22]]}},"keywords":{}}],["self.get_own",{"_index":2357,"title":{},"content":{"197":{"position":[[339,17]]},"433":{"position":[[339,17]]},"680":{"position":[[339,17]]}},"keywords":{}}],["self.get_role_admin(rol",{"_index":2238,"title":{},"content":{"185":{"position":[[1724,26]]},"376":{"position":[[1708,26]]},"592":{"position":[[1708,26]]}},"keywords":{}}],["self.greet.get_or_default",{"_index":3616,"title":{},"content":{"596":{"position":[[417,27]]},"704":{"position":[[417,27]]}},"keywords":{}}],["self.greet.set(messag",{"_index":3615,"title":{},"content":{"596":{"position":[[353,24]]},"704":{"position":[[353,24]]}},"keywords":{}}],["self.has_role(rol",{"_index":2235,"title":{},"content":{"185":{"position":[[1544,20],[1988,20],[2259,19]]},"376":{"position":[[1528,20],[1972,20],[2243,19]]},"592":{"position":[[1528,20],[1972,20],[2243,19]]}},"keywords":{}}],["self.i.set",{"_index":3643,"title":{},"content":{"598":{"position":[[772,11]]},"706":{"position":[[772,11]]}},"keywords":{}}],["self.i2.set(456",{"_index":3644,"title":{},"content":{"598":{"position":[[788,17]]},"706":{"position":[[788,17]]}},"keywords":{}}],["self.internal_transfer(&self.env().cal",{"_index":3747,"title":{},"content":{"604":{"position":[[218,48]]},"712":{"position":[[218,48]]}},"keywords":{}}],["self.is_operator(cal",{"_index":3505,"title":{},"content":{"441":{"position":[[3322,25]]},"688":{"position":[[3322,25]]}},"keywords":{}}],["self.is_paus",{"_index":2709,"title":{},"content":{"221":{"position":[[190,16],[295,17]]},"454":{"position":[[190,16],[295,17]]},"694":{"position":[[190,16],[295,17]]}},"keywords":{}}],["self.is_paused.get_or_default",{"_index":2707,"title":{},"content":{"221":{"position":[[114,31]]},"454":{"position":[[114,31]]},"694":{"position":[[114,31]]}},"keywords":{}}],["self.is_paused.set(fals",{"_index":2727,"title":{},"content":{"222":{"position":[[294,26]]},"455":{"position":[[294,26]]},"695":{"position":[[294,26]]}},"keywords":{}}],["self.is_paused.set(tru",{"_index":2723,"title":{},"content":{"222":{"position":[[147,25]]},"455":{"position":[[147,25]]},"695":{"position":[[147,25]]}},"keywords":{}}],["self.is_vote_open().get_or_default",{"_index":3232,"title":{},"content":{"416":{"position":[[1556,36]]},"653":{"position":[[1556,36]]}},"keywords":{}}],["self.is_vote_open.get_or_default",{"_index":3250,"title":{},"content":{"416":{"position":[[3562,35]]},"419":{"position":[[4075,34],[5141,35],[6188,35]]},"653":{"position":[[3562,35]]},"656":{"position":[[4075,34],[5141,35],[6188,35]]}},"keywords":{}}],["self.is_vote_open.set(fals",{"_index":3266,"title":{},"content":{"416":{"position":[[4533,29]]},"419":{"position":[[6113,29]]},"653":{"position":[[4533,29]]},"656":{"position":[[6113,29]]}},"keywords":{}}],["self.is_vote_open.set(tru",{"_index":3237,"title":{},"content":{"416":{"position":[[1914,28]]},"419":{"position":[[4432,28]]},"653":{"position":[[1914,28]]},"656":{"position":[[4432,28]]}},"keywords":{}}],["self.lock",{"_index":3758,"title":{},"content":{"606":{"position":[[212,12]]},"714":{"position":[[212,12]]}},"keywords":{}}],["self.lock_dur",{"_index":1365,"title":{},"content":{"71":{"position":[[490,22]]},"235":{"position":[[490,22]]},"471":{"position":[[490,22]]},"476":{"position":[[1085,22]]},"698":{"position":[[1085,22]]}},"keywords":{}}],["self.lock_duration.set(lock_dur",{"_index":3542,"title":{},"content":{"476":{"position":[[539,38]]},"698":{"position":[[539,38]]}},"keywords":{}}],["self.lock_expiration_map",{"_index":1363,"title":{},"content":{"71":{"position":[[426,24]]},"235":{"position":[[426,24]]},"471":{"position":[[426,24]]},"476":{"position":[[1021,24]]},"698":{"position":[[1021,24]]}},"keywords":{}}],["self.locked.get_or_default",{"_index":3763,"title":{},"content":{"606":{"position":[[360,28]]},"714":{"position":[[360,28]]}},"keywords":{}}],["self.locked.set(fals",{"_index":3768,"title":{},"content":{"606":{"position":[[501,23]]},"714":{"position":[[501,23]]}},"keywords":{}}],["self.locked.set(tru",{"_index":3766,"title":{},"content":{"606":{"position":[[439,22]]},"714":{"position":[[439,22]]}},"keywords":{}}],["self.messages.get(&(send",{"_index":496,"title":{},"content":{"17":{"position":[[1196,31]]}},"keywords":{}}],["self.messages.get_or_default(&(send",{"_index":502,"title":{},"content":{"17":{"position":[[1473,42]]}},"keywords":{}}],["self.messages.set(&(send",{"_index":500,"title":{},"content":{"17":{"position":[[1338,31]]}},"keywords":{}}],["self.meta.set(meta",{"_index":2558,"title":{},"content":{"209":{"position":[[1162,20]]},"388":{"position":[[1094,20]]},"658":{"position":[[1094,20]]}},"keywords":{}}],["self.mint(&cal",{"_index":2444,"title":{},"content":{"204":{"position":[[267,22]]},"424":{"position":[[242,22]]},"666":{"position":[[242,22]]}},"keywords":{}}],["self.my_map.get(&addr",{"_index":3687,"title":{},"content":{"601":{"position":[[253,26]]},"709":{"position":[[253,26]]}},"keywords":{}}],["self.my_map.get_or_default(&(addr",{"_index":3695,"title":{},"content":{"601":{"position":[[825,38]]},"709":{"position":[[825,38]]}},"keywords":{}}],["self.my_map.get_or_default(&addr).unwrap_or_default",{"_index":3689,"title":{},"content":{"601":{"position":[[390,57]]},"709":{"position":[[390,57]]}},"keywords":{}}],["self.my_map.set(&(addr",{"_index":3697,"title":{},"content":{"601":{"position":[[953,27],[1054,27]]},"709":{"position":[[953,27],[1054,27]]}},"keywords":{}}],["self.my_map.set(&addr",{"_index":3690,"title":{},"content":{"601":{"position":[[502,26],[587,26]]},"709":{"position":[[502,26],[587,26]]}},"keywords":{}}],["self.my_uint.set(u256::from(123",{"_index":3678,"title":{},"content":{"600":{"position":[[262,34]]},"708":{"position":[[262,34]]}},"keywords":{}}],["self.name.get_or_default",{"_index":2064,"title":{},"content":{"162":{"position":[[1122,26]]},"164":{"position":[[656,26]]},"204":{"position":[[352,26]]},"321":{"position":[[1539,27]]},"351":{"position":[[1144,26]]},"353":{"position":[[691,26]]},"424":{"position":[[327,26]]},"539":{"position":[[1539,27]]},"567":{"position":[[1144,26]]},"569":{"position":[[691,26]]},"666":{"position":[[327,26]]}},"keywords":{}}],["self.name.get_or_revert_with(error::namenotset",{"_index":3095,"title":{},"content":{"384":{"position":[[1724,47]]},"626":{"position":[[1724,47]]}},"keywords":{}}],["self.name.get_or_revert_with(namenotset",{"_index":2933,"title":{},"content":{"269":{"position":[[1711,40]]},"409":{"position":[[1711,40]]},"646":{"position":[[1711,40]]}},"keywords":{}}],["self.name.set(nam",{"_index":521,"title":{},"content":{"17":{"position":[[2329,20]]},"162":{"position":[[881,20]]},"164":{"position":[[595,20]]},"204":{"position":[[192,20]]},"269":{"position":[[721,20]]},"351":{"position":[[903,20]]},"353":{"position":[[630,20]]},"384":{"position":[[734,20]]},"409":{"position":[[721,20]]},"424":{"position":[[167,20]]},"567":{"position":[[903,20]]},"569":{"position":[[630,20]]},"626":{"position":[[734,20]]},"646":{"position":[[721,20]]},"666":{"position":[[167,20]]}},"keywords":{}}],["self.name.set(name.clon",{"_index":2971,"title":{},"content":{"321":{"position":[[1173,28],[1377,28]]},"539":{"position":[[1173,28],[1377,28]]}},"keywords":{}}],["self.oper",{"_index":3502,"title":{},"content":{"441":{"position":[[2999,16],[3700,13]]},"688":{"position":[[2999,16],[3700,13]]}},"keywords":{}}],["self.operator.get",{"_index":3509,"title":{},"content":{"441":{"position":[[3629,19]]},"688":{"position":[[3629,19]]}},"keywords":{}}],["self.operator.set(oper",{"_index":3501,"title":{},"content":{"441":{"position":[[2795,28]]},"688":{"position":[[2795,28]]}},"keywords":{}}],["self.other_contract.get",{"_index":3910,"title":{},"content":{"617":{"position":[[333,25]]},"725":{"position":[[333,25]]}},"keywords":{}}],["self.other_contract.set(other_contract",{"_index":3908,"title":{},"content":{"617":{"position":[[228,40]]},"725":{"position":[[228,40]]}},"keywords":{}}],["self.own",{"_index":1726,"title":{},"content":{"115":{"position":[[1088,12],[2606,12]]},"258":{"position":[[1042,12],[2544,12]]},"481":{"position":[[1042,12],[2544,12]]}},"keywords":{}}],["self.ownable.assert_owner(&cal",{"_index":3386,"title":{},"content":{"440":{"position":[[1733,39]]},"441":{"position":[[2602,39]]},"687":{"position":[[1733,39]]},"688":{"position":[[2602,39]]}},"keywords":{}}],["self.ownable.change_ownership(new_own",{"_index":2766,"title":{},"content":{"247":{"position":[[1319,41]]},"446":{"position":[[1319,41]]},"673":{"position":[[1319,41]]}},"keywords":{}}],["self.ownable.ensure_ownership(&self.env().cal",{"_index":2767,"title":{},"content":{"247":{"position":[[1434,56]]},"446":{"position":[[1434,56]]},"673":{"position":[[1434,56]]}},"keywords":{}}],["self.ownable.ensure_ownership(self.env().cal",{"_index":1730,"title":{},"content":{"115":{"position":[[1271,51],[2871,51]]},"258":{"position":[[1217,51],[2797,51]]},"481":{"position":[[1217,51],[2797,51]]}},"keywords":{}}],["self.ownable.get_own",{"_index":2765,"title":{},"content":{"247":{"position":[[1226,24]]},"440":{"position":[[2322,25]]},"441":{"position":[[3226,25]]},"446":{"position":[[1226,24]]},"673":{"position":[[1226,24]]},"687":{"position":[[2322,25]]},"688":{"position":[[3226,25]]}},"keywords":{}}],["self.ownable.init",{"_index":3375,"title":{},"content":{"440":{"position":[[1250,20]]},"687":{"position":[[1250,20]]}},"keywords":{}}],["self.ownable.init(deploy",{"_index":1720,"title":{},"content":{"115":{"position":[[464,28],[2327,28]]},"247":{"position":[[229,28]]},"258":{"position":[[454,28],[2273,28]]},"446":{"position":[[229,28]]},"481":{"position":[[454,28],[2273,28]]},"673":{"position":[[229,28]]}},"keywords":{}}],["self.owner.get",{"_index":489,"title":{},"content":{"17":{"position":[[1053,16]]}},"keywords":{}}],["self.owner.get_or_default",{"_index":2360,"title":{},"content":{"197":{"position":[[543,27]]},"433":{"position":[[543,27]]},"680":{"position":[[543,27]]}},"keywords":{}}],["self.owner.get_or_default().as_ref",{"_index":2353,"title":{},"content":{"197":{"position":[[126,36]]},"433":{"position":[[126,36]]},"680":{"position":[[126,36]]}},"keywords":{}}],["self.owner.get_or_default().is_som",{"_index":2324,"title":{},"content":{"196":{"position":[[128,37]]},"432":{"position":[[90,37]]},"679":{"position":[[90,37]]}},"keywords":{}}],["self.owner.get_or_revert_with(myerrors::invalidown",{"_index":2977,"title":{},"content":{"321":{"position":[[1574,54]]},"539":{"position":[[1574,54]]}},"keywords":{}}],["self.owner.set(own",{"_index":478,"title":{},"content":{"17":{"position":[[710,22]]}},"keywords":{}}],["self.owner.set(owner.clon",{"_index":2972,"title":{},"content":{"321":{"position":[[1202,30]]},"539":{"position":[[1202,30]]}},"keywords":{}}],["self.owner.set(self.env().cal",{"_index":3779,"title":{},"content":{"608":{"position":[[213,36]]},"716":{"position":[[213,36]]}},"keywords":{}}],["self.owner.set(some(*new_own",{"_index":2358,"title":{},"content":{"197":{"position":[[357,33]]},"433":{"position":[[357,33]]},"680":{"position":[[357,33]]}},"keywords":{}}],["self.owner.set(some(own",{"_index":2326,"title":{},"content":{"196":{"position":[[222,28]]},"432":{"position":[[184,28]]},"679":{"position":[[184,28]]}},"keywords":{}}],["self.pauseable.paus",{"_index":2737,"title":{},"content":{"223":{"position":[[641,23]]},"456":{"position":[[641,23]]},"696":{"position":[[641,23]]}},"keywords":{}}],["self.pauseable.require_not_paus",{"_index":2736,"title":{},"content":{"223":{"position":[[496,36]]},"456":{"position":[[496,36]]},"696":{"position":[[496,36]]}},"keywords":{}}],["self.pauseable.unpaus",{"_index":2738,"title":{},"content":{"223":{"position":[[699,25]]},"456":{"position":[[699,25]]},"696":{"position":[[699,25]]}},"keywords":{}}],["self.proposed_mint.set((account",{"_index":3236,"title":{},"content":{"416":{"position":[[1855,32]]},"419":{"position":[[4373,32]]},"653":{"position":[[1855,32]]},"656":{"position":[[4373,32]]}},"keywords":{}}],["self.raw_transfer(&cal",{"_index":2470,"title":{},"content":{"205":{"position":[[397,30]]},"269":{"position":[[1143,30]]},"384":{"position":[[1156,30]]},"409":{"position":[[1143,30]]},"425":{"position":[[372,30]]},"626":{"position":[[1156,30]]},"646":{"position":[[1143,30]]},"667":{"position":[[372,30]]}},"keywords":{}}],["self.raw_transfer(own",{"_index":2473,"title":{},"content":{"205":{"position":[[639,24]]},"269":{"position":[[1385,24]]},"384":{"position":[[1398,24]]},"409":{"position":[[1385,24]]},"425":{"position":[[614,24]]},"626":{"position":[[1398,24]]},"646":{"position":[[1385,24]]},"667":{"position":[[614,24]]}},"keywords":{}}],["self.require_not_paus",{"_index":2722,"title":{},"content":{"222":{"position":[[120,26]]},"455":{"position":[[120,26]]},"695":{"position":[[120,26]]}},"keywords":{}}],["self.require_paus",{"_index":2726,"title":{},"content":{"222":{"position":[[271,22]]},"455":{"position":[[271,22]]},"695":{"position":[[271,22]]}},"keywords":{}}],["self.result.get().unwrap_or(string::from("not",{"_index":351,"title":{},"content":{"10":{"position":[[1030,50]]}},"keywords":{}}],["self.result.set(result",{"_index":347,"title":{},"content":{"10":{"position":[[945,24]]}},"keywords":{}}],["self.revert(cep78error::invalidtokenown",{"_index":3467,"title":{},"content":{"440":{"position":[[6465,43]]},"687":{"position":[[6465,43]]}},"keywords":{}}],["self.role_admin.get(rol",{"_index":2224,"title":{},"content":{"185":{"position":[[735,26]]},"376":{"position":[[719,26]]},"592":{"position":[[719,26]]}},"keywords":{}}],["self.role_admin.set(rol",{"_index":2239,"title":{},"content":{"185":{"position":[[1751,25]]},"376":{"position":[[1735,25]]},"592":{"position":[[1735,25]]}},"keywords":{}}],["self.roles.get_or_default(&(*rol",{"_index":2221,"title":{},"content":{"185":{"position":[[603,38]]},"376":{"position":[[587,38]]},"592":{"position":[[587,38]]}},"keywords":{}}],["self.roles.set(&(*rol",{"_index":2242,"title":{},"content":{"185":{"position":[[2020,27],[2290,27]]},"376":{"position":[[2004,27],[2274,27]]},"592":{"position":[[2004,27],[2274,27]]}},"keywords":{}}],["self.set(vec",{"_index":3842,"title":{},"content":{"613":{"position":[[819,14]]},"721":{"position":[[819,14]]}},"keywords":{}}],["self.spend_allowance(own",{"_index":2471,"title":{},"content":{"205":{"position":[[588,27]]},"269":{"position":[[1334,27]]},"384":{"position":[[1347,27]]},"409":{"position":[[1334,27]]},"425":{"position":[[563,27]]},"626":{"position":[[1347,27]]},"646":{"position":[[1334,27]]},"667":{"position":[[563,27]]}},"keywords":{}}],["self.status.get_or_default",{"_index":3723,"title":{},"content":{"602":{"position":[[287,28]]},"710":{"position":[[287,28]]}},"keywords":{}}],["self.status.set(default::default",{"_index":3728,"title":{},"content":{"602":{"position":[[487,36]]},"710":{"position":[[487,36]]}},"keywords":{}}],["self.status.set(statu",{"_index":3724,"title":{},"content":{"602":{"position":[[362,24]]},"710":{"position":[[362,24]]}},"keywords":{}}],["self.status.set(status::cancel",{"_index":3726,"title":{},"content":{"602":{"position":[[420,34]]},"710":{"position":[[420,34]]}},"keywords":{}}],["self.strings.get(&(key1",{"_index":1463,"title":{},"content":{"79":{"position":[[1065,28]]},"230":{"position":[[1082,28]]},"461":{"position":[[1082,28]]}},"keywords":{}}],["self.symbol.get_or_default",{"_index":2446,"title":{},"content":{"204":{"position":[[421,28]]},"424":{"position":[[396,28]]},"666":{"position":[[396,28]]}},"keywords":{}}],["self.symbol.set(symbol",{"_index":522,"title":{},"content":{"17":{"position":[[2350,24]]},"204":{"position":[[213,24]]},"269":{"position":[[696,24]]},"384":{"position":[[709,24]]},"409":{"position":[[696,24]]},"424":{"position":[[188,24]]},"626":{"position":[[709,24]]},"646":{"position":[[696,24]]},"666":{"position":[[188,24]]}},"keywords":{}}],["self.text.set("hello".to_str",{"_index":3677,"title":{},"content":{"600":{"position":[[216,45]]},"708":{"position":[[216,45]]}},"keywords":{}}],["self.ticket_office_address.set(ticket_office_address",{"_index":3484,"title":{},"content":{"441":{"position":[[946,54]]},"688":{"position":[[946,54]]}},"keywords":{}}],["self.tickets.set",{"_index":3393,"title":{},"content":{"440":{"position":[[2006,17]]},"687":{"position":[[2006,17]]}},"keywords":{}}],["self.tickets.set(&ticket_id",{"_index":3414,"title":{},"content":{"440":{"position":[[3149,32]]},"687":{"position":[[3149,32]]}},"keywords":{}}],["self.todos.get(index",{"_index":3738,"title":{},"content":{"602":{"position":[[1470,21],[1625,21],[1824,21]]},"710":{"position":[[1470,21],[1625,21],[1824,21]]}},"keywords":{}}],["self.todos.push(todo",{"_index":3735,"title":{},"content":{"602":{"position":[[1331,20]]},"710":{"position":[[1331,20]]}},"keywords":{}}],["self.todos.replace(index",{"_index":3740,"title":{},"content":{"602":{"position":[[1512,25],[1683,25]]},"710":{"position":[[1512,25],[1683,25]]}},"keywords":{}}],["self.token",{"_index":3211,"title":{},"content":{"414":{"position":[[354,10]]},"416":{"position":[[2939,10]]},"419":{"position":[[1546,10],[1699,10],[5791,10]]},"440":{"position":[[3040,10]]},"441":{"position":[[3016,10]]},"651":{"position":[[354,10]]},"653":{"position":[[2939,10]]},"656":{"position":[[1546,10],[1699,10],[5791,10]]},"687":{"position":[[3040,10]]},"688":{"position":[[3016,10]]}},"keywords":{}}],["self.token.init",{"_index":3378,"title":{},"content":{"440":{"position":[[1338,16]]},"687":{"position":[[1338,16]]}},"keywords":{}}],["self.token.mint(cal",{"_index":3388,"title":{},"content":{"440":{"position":[[1816,23]]},"687":{"position":[[1816,23]]}},"keywords":{}}],["self.token.owner_of(maybe::some(ticket_id",{"_index":3401,"title":{},"content":{"440":{"position":[[2457,43]]},"687":{"position":[[2457,43]]}},"keywords":{}}],["self.token.raw_mint(&account",{"_index":3264,"title":{},"content":{"416":{"position":[[4464,33]]},"419":{"position":[[6044,33]]},"653":{"position":[[4464,33]]},"656":{"position":[[6044,33]]}},"keywords":{}}],["self.token.raw_transfer(&contract",{"_index":3261,"title":{},"content":{"416":{"position":[[4212,38]]},"653":{"position":[[4212,38]]}},"keywords":{}}],["self.token.transfer(&contract",{"_index":3315,"title":{},"content":{"419":{"position":[[4894,34]]},"656":{"position":[[4894,34]]}},"keywords":{}}],["self.tokens.module(&(token_nam",{"_index":1492,"title":{},"content":{"80":{"position":[[633,36],[819,36]]},"231":{"position":[[633,36],[819,36]]},"462":{"position":[[633,36],[819,36]]}},"keywords":{}}],["self.tokens.module(&token_name).total_suppli",{"_index":1456,"title":{},"content":{"79":{"position":[[906,50]]},"230":{"position":[[923,50]]},"461":{"position":[[923,50]]}},"keywords":{}}],["self.total_supply.add(*amount",{"_index":2450,"title":{},"content":{"204":{"position":[[727,31]]},"269":{"position":[[1997,31]]},"384":{"position":[[2017,31]]},"409":{"position":[[1997,31]]},"424":{"position":[[702,31]]},"626":{"position":[[2017,31]]},"646":{"position":[[1997,31]]},"666":{"position":[[702,31]]}},"keywords":{}}],["self.total_supply.get_or_default",{"_index":527,"title":{},"content":{"17":{"position":[[2549,34]]},"204":{"position":[[567,34]]},"424":{"position":[[542,34]]},"666":{"position":[[542,34]]}},"keywords":{}}],["self.total_supply.set(initial_suppli",{"_index":2930,"title":{},"content":{"269":{"position":[[818,38]]},"384":{"position":[[831,38]]},"409":{"position":[[818,38]]},"626":{"position":[[831,38]]},"646":{"position":[[818,38]]}},"keywords":{}}],["self.total_supply.set(total_suppli",{"_index":524,"title":{},"content":{"17":{"position":[[2404,36]]}},"keywords":{}}],["self.total_supply.subtract(*amount",{"_index":2937,"title":{},"content":{"269":{"position":[[2309,36]]},"384":{"position":[[2336,36]]},"409":{"position":[[2309,36]]},"626":{"position":[[2336,36]]},"646":{"position":[[2309,36]]}},"keywords":{}}],["self.u.set(1",{"_index":3641,"title":{},"content":{"598":{"position":[[727,14]]},"706":{"position":[[727,14]]}},"keywords":{}}],["self.u2.set(u256::from(456",{"_index":3642,"title":{},"content":{"598":{"position":[[742,29]]},"706":{"position":[[742,29]]}},"keywords":{}}],["self.unchecked_grant_role(rol",{"_index":2229,"title":{},"content":{"185":{"position":[[984,31]]},"376":{"position":[[968,31]]},"592":{"position":[[968,31]]}},"keywords":{}}],["self.unchecked_revoke_role(rol",{"_index":2231,"title":{},"content":{"185":{"position":[[1179,32],[1402,32]]},"376":{"position":[[1163,32],[1386,32]]},"592":{"position":[[1163,32],[1386,32]]}},"keywords":{}}],["self.unlock",{"_index":3761,"title":{},"content":{"606":{"position":[[305,14]]},"714":{"position":[[305,14]]}},"keywords":{}}],["self.value.get_or_default",{"_index":486,"title":{},"content":{"17":{"position":[[965,27]]},"22":{"position":[[1349,27]]},"51":{"position":[[754,28],[1076,27]]},"178":{"position":[[985,27]]},"223":{"position":[[549,27],[767,27]]},"369":{"position":[[985,27]]},"456":{"position":[[549,27],[767,27]]},"585":{"position":[[985,27]]},"696":{"position":[[549,27],[767,27]]}},"keywords":{}}],["self.value.set(!self.get",{"_index":666,"title":{},"content":{"22":{"position":[[1283,28]]},"147":{"position":[[1226,28]]},"178":{"position":[[813,28]]},"335":{"position":[[1234,28]]},"369":{"position":[[813,28]]},"552":{"position":[[1234,28]]},"585":{"position":[[813,28]]}},"keywords":{}}],["self.value.set(!self.get_valu",{"_index":483,"title":{},"content":{"17":{"position":[[830,34]]}},"keywords":{}}],["self.value.set(fals",{"_index":477,"title":{},"content":{"17":{"position":[[687,22]]},"147":{"position":[[274,22]]},"178":{"position":[[580,22]]},"335":{"position":[[274,22]]},"369":{"position":[[580,22]]},"552":{"position":[[274,22]]},"585":{"position":[[580,22]]}},"keywords":{}}],["self.value.set(new_valu",{"_index":1202,"title":{},"content":{"51":{"position":[[814,26]]},"223":{"position":[[582,26]]},"456":{"position":[[582,26]]},"696":{"position":[[582,26]]}},"keywords":{}}],["self.value.set(valu",{"_index":481,"title":{},"content":{"17":{"position":[[776,22]]},"22":{"position":[[1229,22]]},"51":{"position":[[629,22]]},"147":{"position":[[1116,22]]},"178":{"position":[[703,22]]},"335":{"position":[[1124,22]]},"369":{"position":[[703,22]]},"552":{"position":[[1124,22]]},"585":{"position":[[703,22]]}},"keywords":{}}],["self.vec.get_or_default",{"_index":3707,"title":{},"content":{"601":{"position":[[1562,26],[1673,26]]},"709":{"position":[[1562,26],[1673,26]]}},"keywords":{}}],["self.vec.set(vec",{"_index":3709,"title":{},"content":{"601":{"position":[[1606,18],[1711,18]]},"709":{"position":[[1606,18],[1711,18]]}},"keywords":{}}],["self.vec.set(vec![1",{"_index":3703,"title":{},"content":{"601":{"position":[[1395,20]]},"709":{"position":[[1395,20]]}},"keywords":{}}],["self.version.set(self.version.get_or_default",{"_index":2559,"title":{},"content":{"209":{"position":[[1183,46]]},"388":{"position":[[1115,46]]},"658":{"position":[[1115,46]]}},"keywords":{}}],["self.visits(friend_name.clon",{"_index":2088,"title":{},"content":{"163":{"position":[[851,33]]},"352":{"position":[[873,33]]},"568":{"position":[[873,33]]}},"keywords":{}}],["self.vote_end_tim",{"_index":3238,"title":{},"content":{"416":{"position":[[1992,18]]},"419":{"position":[[4510,18]]},"653":{"position":[[1992,18]]},"656":{"position":[[4510,18]]}},"keywords":{}}],["self.votes.pop",{"_index":3258,"title":{},"content":{"416":{"position":[[4065,16]]},"419":{"position":[[5644,16]]},"653":{"position":[[4065,16]]},"656":{"position":[[5644,16]]}},"keywords":{}}],["self.votes.push(ballot",{"_index":3246,"title":{},"content":{"416":{"position":[[3018,22]]},"419":{"position":[[4972,22]]},"653":{"position":[[3018,22]]},"656":{"position":[[4972,22]]}},"keywords":{}}],["self.walks.get_or_default",{"_index":2066,"title":{},"content":{"162":{"position":[[1206,28],[1317,28],[2227,28]]},"351":{"position":[[1228,28],[1339,28],[2249,28]]},"567":{"position":[[1228,28],[1339,28],[2249,28]]}},"keywords":{}}],["self.walks.iter().sum",{"_index":2108,"title":{},"content":{"164":{"position":[[796,23]]},"353":{"position":[[831,23]]},"569":{"position":[[831,23]]}},"keywords":{}}],["self.walks.len",{"_index":2107,"title":{},"content":{"164":{"position":[[728,16]]},"353":{"position":[[763,16]]},"569":{"position":[[763,16]]}},"keywords":{}}],["self.walks.push(length",{"_index":2110,"title":{},"content":{"164":{"position":[[872,24]]},"353":{"position":[[907,24]]},"569":{"position":[[907,24]]}},"keywords":{}}],["self.walks.set(vec::<u32>::default",{"_index":2059,"title":{},"content":{"162":{"position":[[902,44]]},"351":{"position":[[924,44]]},"567":{"position":[[924,44]]}},"keywords":{}}],["self.weight.get_or_default",{"_index":2063,"title":{},"content":{"162":{"position":[[1053,28]]},"351":{"position":[[1075,28]]},"567":{"position":[[1075,28]]}},"keywords":{}}],["self.weight.set(weight",{"_index":2058,"title":{},"content":{"162":{"position":[[856,24]]},"351":{"position":[[878,24]]},"567":{"position":[[878,24]]}},"keywords":{}}],["self.x.get_or_default",{"_index":3753,"title":{},"content":{"605":{"position":[[171,23]]},"713":{"position":[[171,23]]}},"keywords":{}}],["self.x.set(self.x.get_or_default",{"_index":3759,"title":{},"content":{"606":{"position":[[225,34]]},"714":{"position":[[225,34]]}},"keywords":{}}],["self::events::{init",{"_index":1195,"title":{},"content":{"51":{"position":[[437,20]]}},"keywords":{}}],["send",{"_index":215,"title":{"102":{"position":[[0,7]]},"294":{"position":[[0,7]]},"506":{"position":[[0,7]]}},"content":{"6":{"position":[[310,4]]},"9":{"position":[[481,4]]},"70":{"position":[[237,4]]},"71":{"position":[[591,4]]},"234":{"position":[[237,4]]},"235":{"position":[[591,4]]},"394":{"position":[[127,4],[462,4]]},"440":{"position":[[2840,5],[4426,5],[5874,5],[5976,5]]},"470":{"position":[[237,4]]},"471":{"position":[[591,4]]},"477":{"position":[[1946,4]]},"631":{"position":[[127,4],[462,4]]},"687":{"position":[[2840,5],[4426,5],[5874,5],[5976,5]]},"699":{"position":[[1946,4]]}},"keywords":{}}],["sender",{"_index":493,"title":{},"content":{"17":{"position":[[1145,6],[1421,7]]},"42":{"position":[[1369,6]]},"52":{"position":[[1017,7],[1068,10],[1122,6],[1341,10],[1380,11],[1432,7],[1554,10]]},"53":{"position":[[492,6]]},"115":{"position":[[2712,7]]},"184":{"position":[[378,7],[502,7]]},"185":{"position":[[2134,7],[2405,7]]},"206":{"position":[[1207,6],[1356,6],[1841,6]]},"258":{"position":[[2642,7]]},"269":{"position":[[5117,6],[5266,6],[5751,6]]},"375":{"position":[[345,7],[445,7]]},"376":{"position":[[2118,7],[2389,7]]},"409":{"position":[[5117,6],[5266,6],[5751,6]]},"416":{"position":[[4643,7]]},"426":{"position":[[1202,6],[1351,6],[1831,6]]},"481":{"position":[[2642,7]]},"591":{"position":[[345,7],[445,7]]},"592":{"position":[[2118,7],[2389,7]]},"600":{"position":[[430,6]]},"604":{"position":[[353,7]]},"610":{"position":[[78,7],[281,7],[375,7]]},"646":{"position":[[5117,6],[5266,6],[5751,6]]},"653":{"position":[[4643,7]]},"668":{"position":[[1207,6],[1356,6],[1841,6]]},"708":{"position":[[430,6]]},"712":{"position":[[353,7]]},"718":{"position":[[78,7],[281,7],[375,7]]}},"keywords":{}}],["sensit",{"_index":1381,"title":{},"content":{"72":{"position":[[420,9]]},"236":{"position":[[420,9]]},"472":{"position":[[420,9]]}},"keywords":{}}],["sent",{"_index":1349,"title":{},"content":{"70":{"position":[[76,4]]},"234":{"position":[[76,4]]},"470":{"position":[[76,4]]},"614":{"position":[[142,4]]},"722":{"position":[[142,4]]}},"keywords":{}}],["sentenc",{"_index":418,"title":{},"content":{"15":{"position":[[437,9]]}},"keywords":{}}],["separ",{"_index":1788,"title":{},"content":{"120":{"position":[[394,9]]},"147":{"position":[[625,8]]},"163":{"position":[[1348,8]]},"301":{"position":[[394,9]]},"335":{"position":[[629,8]]},"352":{"position":[[1370,8]]},"522":{"position":[[394,9]]},"552":{"position":[[629,8]]},"568":{"position":[[1370,8]]}},"keywords":{}}],["sequenc",{"_index":950,"title":{"78":{"position":[[0,9]]},"229":{"position":[[0,9]]},"460":{"position":[[0,9]]}},"content":{"39":{"position":[[1404,8]]},"78":{"position":[[4,8],[266,8]]},"80":{"position":[[144,9]]},"81":{"position":[[140,8]]},"229":{"position":[[4,8],[287,8]]},"231":{"position":[[144,9]]},"232":{"position":[[140,8]]},"441":{"position":[[243,8],[334,8],[4518,8]]},"460":{"position":[[4,8],[287,8]]},"462":{"position":[[144,9]]},"463":{"position":[[140,8]]},"688":{"position":[[243,8],[334,8],[4518,8]]}},"keywords":{}}],["sequence<t>",{"_index":1430,"title":{},"content":{"78":{"position":[[189,17]]},"229":{"position":[[189,17]]},"460":{"position":[[189,17]]}},"keywords":{}}],["sequence<u32>",{"_index":1483,"title":{},"content":{"80":{"position":[[267,20]]},"231":{"position":[[267,20]]},"462":{"position":[[267,20]]}},"keywords":{}}],["serde_json::to_string(&receipt.journal).unwrap",{"_index":307,"title":{},"content":{"9":{"position":[[1218,53]]}},"keywords":{}}],["serde_json::to_string(&receipt.seal).unwrap",{"_index":311,"title":{},"content":{"9":{"position":[[1386,50]]}},"keywords":{}}],["serde_json::to_string(multiply_id).unwrap",{"_index":315,"title":{},"content":{"9":{"position":[[1552,44]]}},"keywords":{}}],["seri",{"_index":3925,"title":{},"content":{"618":{"position":[[534,7]]},"726":{"position":[[534,7]]}},"keywords":{}}],["serial",{"_index":1557,"title":{"86":{"position":[[6,14]]},"255":{"position":[[6,14]]},"486":{"position":[[6,14]]}},"content":{"86":{"position":[[50,10],[89,13]]},"103":{"position":[[308,10]]},"162":{"position":[[73,10],[1858,10],[2314,10]]},"255":{"position":[[50,10],[89,13]]},"295":{"position":[[308,10]]},"351":{"position":[[73,10],[1880,10],[2336,10]]},"354":{"position":[[425,14]]},"486":{"position":[[50,10],[89,13]]},"507":{"position":[[308,10]]},"567":{"position":[[73,10],[1880,10],[2336,10]]},"570":{"position":[[425,14]]}},"keywords":{}}],["serializ",{"_index":1438,"title":{},"content":{"79":{"position":[[169,12]]},"230":{"position":[[169,12]]},"461":{"position":[[169,12]]}},"keywords":{}}],["serv",{"_index":1422,"title":{},"content":{"76":{"position":[[594,6]]},"84":{"position":[[906,5]]},"85":{"position":[[243,6]]},"185":{"position":[[3078,6]]},"227":{"position":[[594,6]]},"253":{"position":[[906,5]]},"254":{"position":[[243,6]]},"376":{"position":[[3062,6]]},"458":{"position":[[594,6]]},"484":{"position":[[906,5]]},"485":{"position":[[243,6]]},"592":{"position":[[3062,6]]}},"keywords":{}}],["servic",{"_index":2957,"title":{},"content":{"277":{"position":[[1189,7]]},"610":{"position":[[826,8]]},"718":{"position":[[826,8]]}},"keywords":{}}],["session",{"_index":1137,"title":{},"content":{"43":{"position":[[1027,7],[1094,7],[1198,7],[1266,7],[1329,7],[1392,7],[1443,7],[1498,7],[1545,7]]},"99":{"position":[[379,7],[416,7],[505,7],[573,7],[636,7]]},"100":{"position":[[472,7],[514,7],[589,7],[658,7],[721,7],[769,7],[817,7]]},"101":{"position":[[326,7],[369,7],[447,7],[516,7],[579,7]]},"102":{"position":[[475,8]]},"210":{"position":[[491,7],[555,7],[650,7],[718,7],[781,7],[844,7],[894,7],[958,7],[1005,7],[1289,7],[1331,7],[1376,7],[1420,7],[1468,7]]},"291":{"position":[[379,7],[416,7],[505,7],[573,7],[636,7]]},"292":{"position":[[472,7],[514,7],[589,7],[658,7],[721,7],[769,7],[817,7]]},"293":{"position":[[326,7],[369,7],[447,7],[516,7],[579,7]]},"294":{"position":[[475,8]]},"389":{"position":[[491,7],[555,7],[650,7],[718,7],[781,7],[831,7],[895,7],[942,7],[1226,7],[1268,7],[1313,7],[1357,7],[1405,7]]},"503":{"position":[[379,7],[416,7],[505,7],[573,7],[636,7]]},"504":{"position":[[472,7],[514,7],[589,7],[658,7],[721,7],[769,7],[817,7]]},"505":{"position":[[326,7],[369,7],[447,7],[516,7],[579,7]]},"506":{"position":[[475,8]]},"659":{"position":[[491,7],[555,7],[650,7],[718,7],[781,7],[831,7],[895,7],[942,7],[1226,7],[1268,7],[1313,7],[1357,7],[1405,7]]}},"keywords":{}}],["set",{"_index":660,"title":{},"content":{"22":{"position":[[937,4]]},"42":{"position":[[162,3],[1353,5]]},"51":{"position":[[153,3]]},"68":{"position":[[202,3]]},"79":{"position":[[1545,4]]},"95":{"position":[[211,7]]},"98":{"position":[[126,4]]},"99":{"position":[[159,4]]},"110":{"position":[[167,3]]},"111":{"position":[[54,3]]},"147":{"position":[[1384,3]]},"154":{"position":[[183,3]]},"162":{"position":[[1686,5],[1967,3],[2397,4]]},"163":{"position":[[1339,3]]},"168":{"position":[[1507,3]]},"178":{"position":[[914,4]]},"194":{"position":[[161,3]]},"196":{"position":[[815,3],[1119,3],[1312,5],[1353,4],[1672,3],[1696,3]]},"204":{"position":[[1113,4]]},"206":{"position":[[667,4]]},"209":{"position":[[233,4],[309,4]]},"210":{"position":[[1093,3]]},"230":{"position":[[1562,4]]},"243":{"position":[[202,3]]},"269":{"position":[[4577,4]]},"277":{"position":[[1117,3]]},"287":{"position":[[211,7]]},"290":{"position":[[126,4]]},"291":{"position":[[159,4]]},"305":{"position":[[167,3]]},"306":{"position":[[54,3]]},"321":{"position":[[1071,4]]},"323":{"position":[[2732,4]]},"324":{"position":[[200,3],[673,3],[1045,3]]},"335":{"position":[[1392,3]]},"339":{"position":[[183,3]]},"348":{"position":[[1507,3]]},"351":{"position":[[1708,5],[1989,3],[2419,4]]},"352":{"position":[[1361,3]]},"369":{"position":[[914,4]]},"388":{"position":[[233,4],[309,4]]},"389":{"position":[[1030,3]]},"393":{"position":[[142,7]]},"395":{"position":[[123,3],[1311,3],[4457,3]]},"396":{"position":[[323,3]]},"409":{"position":[[4577,4]]},"416":{"position":[[1832,3],[1946,3],[2243,7],[2281,7],[4635,3]]},"419":{"position":[[4350,3],[4464,3]]},"424":{"position":[[1063,4]]},"426":{"position":[[667,4]]},"430":{"position":[[161,3]]},"432":{"position":[[753,3],[1062,3],[1254,5],[1295,4],[1550,3],[1574,3]]},"440":{"position":[[1586,3]]},"441":{"position":[[1777,4]]},"461":{"position":[[1562,4]]},"468":{"position":[[202,3]]},"477":{"position":[[49,3]]},"499":{"position":[[211,7]]},"502":{"position":[[126,4]]},"503":{"position":[[159,4]]},"510":{"position":[[167,3]]},"511":{"position":[[54,3]]},"539":{"position":[[1071,4]]},"541":{"position":[[2732,4]]},"542":{"position":[[200,3],[673,3],[1045,3]]},"552":{"position":[[1392,3]]},"559":{"position":[[183,3]]},"564":{"position":[[1507,3]]},"567":{"position":[[1708,5],[1989,3],[2419,4]]},"568":{"position":[[1361,3]]},"585":{"position":[[914,4]]},"596":{"position":[[930,3]]},"599":{"position":[[496,3]]},"602":{"position":[[790,3],[818,3],[889,3]]},"613":{"position":[[2031,3]]},"630":{"position":[[142,7]]},"632":{"position":[[123,3],[1311,3],[4457,3]]},"633":{"position":[[323,3]]},"646":{"position":[[4577,4]]},"653":{"position":[[1832,3],[1946,3],[2243,7],[2281,7],[4635,3]]},"656":{"position":[[4350,3],[4464,3]]},"658":{"position":[[233,4],[309,4]]},"659":{"position":[[1030,3]]},"666":{"position":[[1063,4]]},"668":{"position":[[667,4]]},"677":{"position":[[161,3]]},"679":{"position":[[753,3],[1062,3],[1254,5],[1295,4],[1550,3],[1574,3]]},"687":{"position":[[1586,3]]},"688":{"position":[[1777,4]]},"699":{"position":[[49,3]]},"704":{"position":[[930,3]]},"707":{"position":[[496,3]]},"710":{"position":[[790,3],[818,3],[889,3]]},"721":{"position":[[2031,3]]}},"keywords":{}}],["set(&(*own",{"_index":2490,"title":{},"content":{"205":{"position":[[1908,18]]},"425":{"position":[[1883,18]]},"667":{"position":[[1883,18]]}},"keywords":{}}],["set(&cal",{"_index":1364,"title":{},"content":{"71":{"position":[[451,17]]},"235":{"position":[[451,17]]},"471":{"position":[[451,17]]},"476":{"position":[[1046,17]]},"698":{"position":[[1046,17]]}},"keywords":{}}],["set(&mut",{"_index":479,"title":{},"content":{"17":{"position":[[742,12]]},"147":{"position":[[1082,12]]},"178":{"position":[[669,12]]},"335":{"position":[[1090,12]]},"369":{"position":[[669,12]]},"552":{"position":[[1090,12]]},"585":{"position":[[669,12]]},"601":{"position":[[457,12],[897,12]]},"602":{"position":[[325,12]]},"709":{"position":[[457,12],[897,12]]},"710":{"position":[[325,12]]}},"keywords":{}}],["set(self.env().get_block_tim",{"_index":3239,"title":{},"content":{"416":{"position":[[2011,32]]},"419":{"position":[[4529,32]]},"653":{"position":[[2011,32]]},"656":{"position":[[4529,32]]}},"keywords":{}}],["set_admin_rol",{"_index":2266,"title":{},"content":{"185":{"position":[[3359,16]]},"376":{"position":[[3343,16]]},"592":{"position":[[3343,16]]}},"keywords":{}}],["set_admin_role(&mut",{"_index":2237,"title":{},"content":{"185":{"position":[[1626,23]]},"376":{"position":[[1610,23]]},"592":{"position":[[1610,23]]}},"keywords":{}}],["set_caller(&self",{"_index":2131,"title":{},"content":{"168":{"position":[[1565,21]]},"348":{"position":[[1565,21]]},"564":{"position":[[1565,21]]}},"keywords":{}}],["set_data",{"_index":2549,"title":{},"content":{"209":{"position":[[294,8]]},"210":{"position":[[1074,8]]},"388":{"position":[[294,8]]},"389":{"position":[[1011,8]]},"658":{"position":[[294,8]]},"659":{"position":[[1011,8]]}},"keywords":{}}],["set_data(&mut",{"_index":2560,"title":{},"content":{"209":{"position":[[1245,17]]},"388":{"position":[[1177,17]]},"658":{"position":[[1177,17]]}},"keywords":{}}],["set_exchange_rate(&mut",{"_index":1747,"title":{},"content":{"115":{"position":[[2757,26]]},"258":{"position":[[2683,26]]},"481":{"position":[[2683,26]]}},"keywords":{}}],["set_get_messag",{"_index":1086,"title":{},"content":{"42":{"position":[[2156,17]]}},"keywords":{}}],["set_messag",{"_index":1078,"title":{},"content":{"42":{"position":[[1818,13]]}},"keywords":{}}],["set_message(&mut",{"_index":490,"title":{},"content":{"17":{"position":[[1079,20]]}},"keywords":{}}],["set_value<t",{"_index":2853,"title":{},"content":{"267":{"position":[[2262,15]]},"407":{"position":[[2262,15]]},"644":{"position":[[2262,15]]}},"keywords":{}}],["set_var",{"_index":2857,"title":{},"content":{"267":{"position":[[2480,9]]},"407":{"position":[[2480,9]]},"644":{"position":[[2480,9]]}},"keywords":{}}],["set_var<t",{"_index":2851,"title":{},"content":{"267":{"position":[[2190,13]]},"407":{"position":[[2190,13]]},"644":{"position":[[2190,13]]}},"keywords":{}}],["setstatu",{"_index":1062,"title":{},"content":{"42":{"position":[[1343,9]]}},"keywords":{}}],["setstatus(str",{"_index":1053,"title":{},"content":{"42":{"position":[[1004,16]]}},"keywords":{}}],["setting."",{"_index":3040,"title":{},"content":{"323":{"position":[[3357,15]]},"541":{"position":[[3357,15]]}},"keywords":{}}],["setup",{"_index":1793,"title":{"126":{"position":[[0,6]]},"277":{"position":[[0,6]]},"439":{"position":[[0,5]]},"514":{"position":[[0,6]]},"686":{"position":[[0,5]]}},"content":{"198":{"position":[[99,7],[395,8],[622,8],[957,8],[1243,7],[1345,7],[2253,7]]},"206":{"position":[[271,7],[620,8],[1154,8],[1792,8],[2112,8],[3398,8]]},"210":{"position":[[18,5]]},"268":{"position":[[2413,8]]},"269":{"position":[[4175,7],[4530,8],[5064,8],[5702,8]]},"389":{"position":[[18,5]]},"408":{"position":[[2413,8]]},"409":{"position":[[4175,7],[4530,8],[5064,8],[5702,8]]},"426":{"position":[[271,7],[620,8],[1149,8],[1782,8],[2102,8],[3373,8]]},"434":{"position":[[99,7],[395,8],[617,8],[947,8],[1233,7],[1335,7],[2243,7]]},"645":{"position":[[2413,8]]},"646":{"position":[[4175,7],[4530,8],[5064,8],[5702,8]]},"659":{"position":[[18,5]]},"668":{"position":[[271,7],[620,8],[1154,8],[1792,8],[2112,8],[3398,8]]},"681":{"position":[[99,7],[395,8],[622,8],[957,8],[1243,7],[1345,7],[2253,7]]}},"keywords":{}}],["sever",{"_index":1414,"title":{},"content":{"76":{"position":[[150,7]]},"227":{"position":[[150,7]]},"458":{"position":[[150,7]]}},"keywords":{}}],["share",{"_index":893,"title":{},"content":{"39":{"position":[[18,5]]},"267":{"position":[[4361,7]]},"407":{"position":[[4361,7]]},"644":{"position":[[4361,7]]}},"keywords":{}}],["ship",{"_index":3720,"title":{},"content":{"602":{"position":[[118,8]]},"710":{"position":[[118,8]]}},"keywords":{}}],["short",{"_index":67,"title":{},"content":{"1":{"position":[[858,5]]},"2":{"position":[[393,5]]},"38":{"position":[[2,5]]}},"keywords":{}}],["show",{"_index":1185,"title":{"51":{"position":[[0,4]]},"53":{"position":[[0,4]]}},"content":{"52":{"position":[[965,4]]},"54":{"position":[[216,5]]},"84":{"position":[[927,4]]},"146":{"position":[[787,6]]},"147":{"position":[[1282,4]]},"253":{"position":[[927,4]]},"334":{"position":[[791,6]]},"335":{"position":[[1290,4]]},"416":{"position":[[3199,4]]},"484":{"position":[[927,4]]},"551":{"position":[[791,6]]},"552":{"position":[[1290,4]]},"653":{"position":[[3199,4]]}},"keywords":{}}],["showcas",{"_index":1479,"title":{},"content":{"80":{"position":[[23,9]]},"231":{"position":[[23,9]]},"462":{"position":[[23,9]]}},"keywords":{}}],["shown",{"_index":1173,"title":{},"content":{"44":{"position":[[55,5]]},"141":{"position":[[474,5]]},"163":{"position":[[675,5]]},"326":{"position":[[474,5]]},"352":{"position":[[697,5]]},"441":{"position":[[321,5]]},"535":{"position":[[474,5]]},"568":{"position":[[697,5]]},"688":{"position":[[321,5]]}},"keywords":{}}],["side",{"_index":1928,"title":{},"content":{"141":{"position":[[61,4]]},"326":{"position":[[61,4]]},"535":{"position":[[61,4]]},"605":{"position":[[661,4]]},"713":{"position":[[661,4]]}},"keywords":{}}],["sign",{"_index":3631,"title":{},"content":{"598":{"position":[[382,6],[444,6],[1742,6]]},"706":{"position":[[382,6],[444,6],[1742,6]]}},"keywords":{}}],["signatur",{"_index":2398,"title":{},"content":{"198":{"position":[[1331,10]]},"434":{"position":[[1321,10]]},"681":{"position":[[1331,10]]}},"keywords":{}}],["signext",{"_index":1342,"title":{},"content":{"66":{"position":[[185,7]]},"68":{"position":[[455,7]]},"241":{"position":[[185,7]]},"243":{"position":[[455,7]]},"466":{"position":[[185,7]]},"468":{"position":[[455,7]]}},"keywords":{}}],["similar",{"_index":882,"title":{},"content":{"38":{"position":[[782,8],[1083,13]]},"39":{"position":[[36,12],[1937,7]]},"101":{"position":[[15,7]]},"104":{"position":[[41,7]]},"117":{"position":[[758,7]]},"126":{"position":[[1341,7]]},"163":{"position":[[647,7]]},"164":{"position":[[285,7]]},"267":{"position":[[1969,7]]},"268":{"position":[[1512,8]]},"277":{"position":[[1509,7]]},"293":{"position":[[15,7]]},"296":{"position":[[41,7]]},"298":{"position":[[758,7]]},"352":{"position":[[669,7]]},"353":{"position":[[320,7]]},"395":{"position":[[4501,7]]},"407":{"position":[[1969,7]]},"408":{"position":[[1512,8]]},"505":{"position":[[15,7]]},"508":{"position":[[41,7]]},"514":{"position":[[1341,7]]},"519":{"position":[[758,7]]},"568":{"position":[[669,7]]},"569":{"position":[[320,7]]},"600":{"position":[[865,7]]},"612":{"position":[[1898,7]]},"613":{"position":[[1256,7],[1821,7],[1966,7]]},"617":{"position":[[1148,7]]},"632":{"position":[[4501,7]]},"644":{"position":[[1969,7]]},"645":{"position":[[1512,8]]},"708":{"position":[[865,7]]},"720":{"position":[[1898,7]]},"721":{"position":[[1256,7],[1821,7],[1966,7]]},"725":{"position":[[1148,7]]}},"keywords":{}}],["similarli",{"_index":1575,"title":{},"content":{"91":{"position":[[163,10]]},"111":{"position":[[0,9]]},"141":{"position":[[183,9]]},"147":{"position":[[304,9]]},"283":{"position":[[163,10]]},"306":{"position":[[0,9]]},"326":{"position":[[183,9]]},"335":{"position":[[304,9]]},"495":{"position":[[163,10]]},"511":{"position":[[0,9]]},"535":{"position":[[183,9]]},"552":{"position":[[304,9]]},"602":{"position":[[1851,9]]},"710":{"position":[[1851,9]]}},"keywords":{}}],["simpl",{"_index":57,"title":{},"content":{"1":{"position":[[745,6]]},"5":{"position":[[168,6]]},"17":{"position":[[1700,7]]},"22":{"position":[[1462,7]]},"30":{"position":[[27,6]]},"32":{"position":[[58,7]]},"39":{"position":[[241,6]]},"42":{"position":[[44,6]]},"44":{"position":[[88,6]]},"52":{"position":[[461,7]]},"54":{"position":[[75,6],[201,6],[303,6]]},"110":{"position":[[22,6]]},"126":{"position":[[1194,6]]},"145":{"position":[[241,6]]},"151":{"position":[[55,7]]},"162":{"position":[[1807,6]]},"185":{"position":[[2804,6]]},"195":{"position":[[655,6]]},"220":{"position":[[32,6]]},"223":{"position":[[1217,6]]},"277":{"position":[[1362,6]]},"305":{"position":[[22,6]]},"333":{"position":[[241,6]]},"342":{"position":[[55,7]]},"351":{"position":[[1829,6]]},"376":{"position":[[2788,6]]},"413":{"position":[[133,6]]},"431":{"position":[[655,6]]},"442":{"position":[[31,6]]},"453":{"position":[[32,6]]},"456":{"position":[[1217,6]]},"510":{"position":[[22,6]]},"514":{"position":[[1194,6]]},"550":{"position":[[241,6]]},"556":{"position":[[55,7]]},"567":{"position":[[1829,6]]},"592":{"position":[[2788,6]]},"596":{"position":[[19,6]]},"650":{"position":[[133,6]]},"678":{"position":[[655,6]]},"689":{"position":[[31,6]]},"693":{"position":[[32,6]]},"696":{"position":[[1217,6]]},"704":{"position":[[19,6]]}},"keywords":{}}],["simpler",{"_index":3598,"title":{},"content":{"478":{"position":[[324,8]]},"700":{"position":[[324,8]]}},"keywords":{}}],["simplest",{"_index":52,"title":{},"content":{"1":{"position":[[682,8]]},"147":{"position":[[1316,8]]},"162":{"position":[[15,8]]},"335":{"position":[[1324,8]]},"351":{"position":[[15,8]]},"552":{"position":[[1324,8]]},"567":{"position":[[15,8]]}},"keywords":{}}],["simpli",{"_index":406,"title":{},"content":{"15":{"position":[[194,6],[610,6]]},"16":{"position":[[423,6]]},"85":{"position":[[768,6]]},"96":{"position":[[78,6],[180,6]]},"120":{"position":[[106,6]]},"127":{"position":[[26,6]]},"129":{"position":[[192,6]]},"141":{"position":[[363,6]]},"174":{"position":[[197,6]]},"175":{"position":[[25,6]]},"185":{"position":[[2487,6],[3385,6]]},"247":{"position":[[1740,6]]},"254":{"position":[[768,6]]},"278":{"position":[[26,6]]},"280":{"position":[[192,6]]},"288":{"position":[[78,6],[180,6]]},"301":{"position":[[106,6]]},"326":{"position":[[363,6]]},"360":{"position":[[197,6]]},"361":{"position":[[25,6]]},"376":{"position":[[2471,6],[3369,6]]},"394":{"position":[[480,6]]},"441":{"position":[[1990,6]]},"446":{"position":[[1740,6]]},"485":{"position":[[768,6]]},"500":{"position":[[78,6],[180,6]]},"515":{"position":[[26,6]]},"517":{"position":[[192,6]]},"522":{"position":[[106,6]]},"535":{"position":[[363,6]]},"576":{"position":[[197,6]]},"577":{"position":[[25,6]]},"592":{"position":[[2471,6],[3369,6]]},"631":{"position":[[480,6]]},"673":{"position":[[1740,6]]},"688":{"position":[[1990,6]]}},"keywords":{}}],["simplic",{"_index":2651,"title":{},"content":{"212":{"position":[[2428,11],[2756,10],[3170,10]]},"391":{"position":[[2428,11],[2762,10],[3188,10]]},"416":{"position":[[2399,11]]},"653":{"position":[[2399,11]]},"661":{"position":[[2428,11],[2762,10],[3188,10]]}},"keywords":{}}],["simplifi",{"_index":2811,"title":{},"content":{"266":{"position":[[62,11]]},"406":{"position":[[62,11]]},"594":{"position":[[195,8]]},"643":{"position":[[62,11]]},"702":{"position":[[195,8]]}},"keywords":{}}],["simul",{"_index":953,"title":{},"content":{"39":{"position":[[1490,10]]}},"keywords":{}}],["singl",{"_index":1027,"title":{},"content":{"42":{"position":[[99,6],[1243,6]]},"54":{"position":[[82,6]]},"76":{"position":[[349,6],[493,6]]},"78":{"position":[[53,6]]},"79":{"position":[[1239,6]]},"81":{"position":[[201,6]]},"132":{"position":[[203,6]]},"147":{"position":[[842,6]]},"162":{"position":[[115,6]]},"185":{"position":[[2765,6]]},"193":{"position":[[88,6]]},"195":{"position":[[671,6]]},"220":{"position":[[47,6]]},"223":{"position":[[1237,6]]},"227":{"position":[[349,6],[493,6]]},"229":{"position":[[53,6]]},"230":{"position":[[1256,6]]},"232":{"position":[[201,6]]},"312":{"position":[[203,6]]},"335":{"position":[[850,6]]},"351":{"position":[[115,6]]},"376":{"position":[[2749,6]]},"429":{"position":[[88,6]]},"431":{"position":[[671,6]]},"453":{"position":[[47,6]]},"456":{"position":[[1237,6]]},"458":{"position":[[349,6],[493,6]]},"460":{"position":[[53,6]]},"461":{"position":[[1256,6]]},"463":{"position":[[201,6]]},"529":{"position":[[203,6]]},"552":{"position":[[850,6]]},"567":{"position":[[115,6]]},"592":{"position":[[2749,6]]},"596":{"position":[[823,6]]},"601":{"position":[[1921,6]]},"612":{"position":[[1374,6]]},"676":{"position":[[88,6]]},"678":{"position":[[671,6]]},"693":{"position":[[47,6]]},"696":{"position":[[1237,6]]},"704":{"position":[[823,6]]},"709":{"position":[[1921,6]]},"720":{"position":[[1374,6]]}},"keywords":{}}],["size",{"_index":1340,"title":{},"content":{"66":{"position":[[13,4]]},"212":{"position":[[1862,4],[1904,4],[1957,6],[2058,4]]},"241":{"position":[[13,4]]},"391":{"position":[[1862,4],[1904,4],[1957,6],[2058,4]]},"466":{"position":[[13,4]]},"601":{"position":[[1182,4],[1986,4]]},"661":{"position":[[1862,4],[1904,4],[1957,6],[2058,4]]},"709":{"position":[[1182,4],[1986,4]]}},"keywords":{}}],["skip",{"_index":1638,"title":{},"content":{"97":{"position":[[310,4]]},"147":{"position":[[994,4]]},"289":{"position":[[310,4]]},"335":{"position":[[1002,4]]},"416":{"position":[[4766,8]]},"501":{"position":[[310,4]]},"552":{"position":[[1002,4]]},"653":{"position":[[4766,8]]}},"keywords":{}}],["slightli",{"_index":3617,"title":{},"content":{"596":{"position":[[492,8]]},"598":{"position":[[1586,8]]},"704":{"position":[[492,8]]},"706":{"position":[[1586,8]]}},"keywords":{}}],["slower",{"_index":1780,"title":{},"content":{"119":{"position":[[573,6]]},"300":{"position":[[573,6]]},"521":{"position":[[573,6]]}},"keywords":{}}],["smaller",{"_index":2778,"title":{},"content":{"248":{"position":[[108,7]]},"447":{"position":[[108,7]]},"674":{"position":[[108,7]]}},"keywords":{}}],["smallest",{"_index":3626,"title":{},"content":{"598":{"position":[[243,8],[373,8]]},"706":{"position":[[243,8],[373,8]]}},"keywords":{}}],["smart",{"_index":17,"title":{"267":{"position":[[12,5]]},"383":{"position":[[11,5]]},"407":{"position":[[12,5]]},"625":{"position":[[11,5]]},"644":{"position":[[12,5]]}},"content":{"1":{"position":[[158,5],[426,5],[1037,5]]},"2":{"position":[[565,5]]},"5":{"position":[[138,5]]},"6":{"position":[[330,5]]},"10":{"position":[[112,5]]},"15":{"position":[[240,5],[404,5],[505,5]]},"17":{"position":[[1729,5]]},"18":{"position":[[23,5]]},"20":{"position":[[194,5],[257,5]]},"22":{"position":[[21,5],[192,5],[356,5],[422,5],[755,5]]},"38":{"position":[[39,5],[180,5],[474,5],[1043,5]]},"39":{"position":[[3331,5]]},"44":{"position":[[140,5]]},"50":{"position":[[14,5],[282,5]]},"51":{"position":[[32,5]]},"52":{"position":[[159,5],[1635,5]]},"70":{"position":[[15,5]]},"72":{"position":[[22,5]]},"81":{"position":[[397,5]]},"83":{"position":[[103,5]]},"115":{"position":[[3323,5]]},"133":{"position":[[30,5]]},"173":{"position":[[514,5]]},"174":{"position":[[71,5]]},"232":{"position":[[397,5]]},"234":{"position":[[15,5]]},"236":{"position":[[22,5]]},"248":{"position":[[59,5]]},"252":{"position":[[103,5]]},"258":{"position":[[3249,5]]},"264":{"position":[[41,5]]},"267":{"position":[[4,5]]},"268":{"position":[[25,5]]},"269":{"position":[[32,5]]},"313":{"position":[[30,5]]},"359":{"position":[[514,5]]},"360":{"position":[[71,5]]},"383":{"position":[[24,5]]},"384":{"position":[[32,5]]},"404":{"position":[[41,5]]},"407":{"position":[[4,5]]},"408":{"position":[[25,5]]},"409":{"position":[[32,5]]},"447":{"position":[[59,5]]},"463":{"position":[[397,5]]},"470":{"position":[[15,5]]},"472":{"position":[[22,5]]},"481":{"position":[[3249,5]]},"483":{"position":[[103,5]]},"530":{"position":[[30,5]]},"575":{"position":[[514,5]]},"576":{"position":[[71,5]]},"594":{"position":[[92,5],[223,5]]},"595":{"position":[[91,5]]},"596":{"position":[[116,5]]},"618":{"position":[[68,5]]},"625":{"position":[[24,5]]},"626":{"position":[[32,5]]},"641":{"position":[[41,5]]},"644":{"position":[[4,5]]},"645":{"position":[[25,5]]},"646":{"position":[[32,5]]},"674":{"position":[[59,5]]},"702":{"position":[[92,5],[223,5]]},"703":{"position":[[91,5]]},"704":{"position":[[116,5]]},"726":{"position":[[68,5]]}},"keywords":{}}],["snippet",{"_index":970,"title":{},"content":{"39":{"position":[[2189,7]]},"80":{"position":[[15,7]]},"231":{"position":[[15,7]]},"462":{"position":[[15,7]]},"596":{"position":[[87,7]]},"704":{"position":[[87,7]]}},"keywords":{}}],["solana",{"_index":604,"title":{},"content":{"20":{"position":[[796,7]]}},"keywords":{}}],["solc",{"_index":700,"title":{},"content":{"30":{"position":[[460,4],[480,4]]}},"keywords":{}}],["sold",{"_index":3355,"title":{},"content":{"440":{"position":[[468,5],[2449,4],[2719,4]]},"687":{"position":[[468,5],[2449,4],[2719,4]]}},"keywords":{}}],["sold.l46",{"_index":3417,"title":{},"content":{"440":{"position":[[3656,8]]},"687":{"position":[[3656,8]]}},"keywords":{}}],["sole",{"_index":3110,"title":{},"content":{"393":{"position":[[320,6]]},"630":{"position":[[320,6]]}},"keywords":{}}],["solid",{"_index":7,"title":{"30":{"position":[[0,9]]},"593":{"position":[[9,8]]},"701":{"position":[[9,8]]}},"content":{"1":{"position":[[34,8]]},"18":{"position":[[64,8],[328,8]]},"20":{"position":[[336,9]]},"21":{"position":[[240,9]]},"30":{"position":[[34,8]]},"38":{"position":[[530,9],[619,8],[1138,8]]},"39":{"position":[[0,8],[197,8],[256,8],[330,8],[476,8],[553,8],[606,8],[909,8],[979,8],[1046,8],[1718,8],[1763,8]]},"40":{"position":[[107,8],[323,8]]},"42":{"position":[[356,8],[837,8],[913,8],[1755,8]]},"43":{"position":[[1665,8],[1800,8]]},"91":{"position":[[193,9]]},"203":{"position":[[553,8]]},"205":{"position":[[2349,8]]},"283":{"position":[[193,9]]},"423":{"position":[[553,8]]},"425":{"position":[[2299,8]]},"495":{"position":[[193,9]]},"594":{"position":[[13,8],[333,8],[631,8]]},"596":{"position":[[523,8]]},"598":{"position":[[1610,9]]},"599":{"position":[[433,8]]},"600":{"position":[[468,8]]},"601":{"position":[[2042,9]]},"603":{"position":[[3,9]]},"608":{"position":[[744,9]]},"609":{"position":[[3,9]]},"610":{"position":[[780,8]]},"611":{"position":[[548,9]]},"612":{"position":[[3,9],[380,8],[1351,8],[1469,8]]},"613":{"position":[[1232,9],[1845,9]]},"614":{"position":[[3,9]]},"616":{"position":[[1196,9]]},"617":{"position":[[767,9],[1079,9]]},"618":{"position":[[246,8]]},"665":{"position":[[553,8]]},"667":{"position":[[2299,8]]},"702":{"position":[[13,8],[333,8],[631,8]]},"704":{"position":[[523,8]]},"706":{"position":[[1610,9]]},"707":{"position":[[433,8]]},"708":{"position":[[468,8]]},"709":{"position":[[2042,9]]},"711":{"position":[[3,9]]},"716":{"position":[[744,9]]},"717":{"position":[[3,9]]},"718":{"position":[[780,8]]},"719":{"position":[[548,9]]},"720":{"position":[[3,9],[380,8],[1351,8],[1469,8]]},"721":{"position":[[1232,9],[1845,9]]},"722":{"position":[[3,9]]},"724":{"position":[[1196,9]]},"725":{"position":[[767,9],[1079,9]]},"726":{"position":[[246,8]]}},"keywords":{}}],["solidity'",{"_index":2442,"title":{},"content":{"203":{"position":[[476,10]]},"423":{"position":[[476,10]]},"599":{"position":[[655,10]]},"606":{"position":[[572,10]]},"665":{"position":[[476,10]]},"707":{"position":[[655,10]]},"714":{"position":[[572,10]]}},"keywords":{}}],["solidity.familiar",{"_index":3609,"title":{},"content":{"595":{"position":[[52,20]]},"703":{"position":[[52,20]]}},"keywords":{}}],["solut",{"_index":53,"title":{},"content":{"1":{"position":[[691,8],[712,9]]},"163":{"position":[[1405,8]]},"352":{"position":[[1427,8]]},"568":{"position":[[1427,8]]}},"keywords":{}}],["some(*address",{"_index":2452,"title":{},"content":{"204":{"position":[[808,15]]},"267":{"position":[[1763,15]]},"269":{"position":[[2115,15],[2427,15]]},"384":{"position":[[2135,15],[2454,15]]},"407":{"position":[[1763,15]]},"409":{"position":[[2115,15],[2427,15]]},"424":{"position":[[783,15]]},"626":{"position":[[2135,15],[2454,15]]},"644":{"position":[[1763,15]]},"646":{"position":[[2115,15],[2427,15]]},"666":{"position":[[783,15]]}},"keywords":{}}],["some(*own",{"_index":2483,"title":{},"content":{"205":{"position":[[1568,13]]},"269":{"position":[[2801,13]]},"384":{"position":[[2835,13]]},"409":{"position":[[2801,13]]},"425":{"position":[[1543,13]]},"626":{"position":[[2835,13]]},"646":{"position":[[2801,13]]},"667":{"position":[[1543,13]]}},"keywords":{}}],["some(*recipi",{"_index":2484,"title":{},"content":{"205":{"position":[[1586,17]]},"269":{"position":[[2819,17]]},"384":{"position":[[2853,17]]},"409":{"position":[[2819,17]]},"425":{"position":[[1561,17]]},"626":{"position":[[2853,17]]},"646":{"position":[[2819,17]]},"667":{"position":[[1561,17]]}},"keywords":{}}],["some(_",{"_index":497,"title":{},"content":{"17":{"position":[[1261,7]]}},"keywords":{}}],["some(addr",{"_index":3909,"title":{},"content":{"617":{"position":[[320,10]]},"725":{"position":[[320,10]]}},"keywords":{}}],["some(address",{"_index":2352,"title":{},"content":{"197":{"position":[[109,13]]},"433":{"position":[[109,13]]},"680":{"position":[[109,13]]}},"keywords":{}}],["some(admin",{"_index":2225,"title":{},"content":{"185":{"position":[[769,11]]},"376":{"position":[[753,11]]},"592":{"position":[[753,11]]}},"keywords":{}}],["some(boo",{"_index":3698,"title":{},"content":{"601":{"position":[[985,11]]},"709":{"position":[[985,11]]}},"keywords":{}}],["some(cal",{"_index":2932,"title":{},"content":{"269":{"position":[[985,13]]},"384":{"position":[[998,13]]},"409":{"position":[[985,13]]},"441":{"position":[[3613,12]]},"626":{"position":[[998,13]]},"646":{"position":[[985,13]]},"688":{"position":[[3613,12]]}},"keywords":{}}],["some(current_own",{"_index":2359,"title":{},"content":{"197":{"position":[[444,20]]},"433":{"position":[[444,20]]},"680":{"position":[[444,20]]}},"keywords":{}}],["some(env.get_account(0",{"_index":2510,"title":{},"content":{"206":{"position":[[1012,25]]},"269":{"position":[[4922,25]]},"409":{"position":[[4922,25]]},"426":{"position":[[1007,25]]},"646":{"position":[[4922,25]]},"668":{"position":[[1012,25]]}},"keywords":{}}],["some(i",{"_index":3691,"title":{},"content":{"601":{"position":[[529,9]]},"709":{"position":[[529,9]]}},"keywords":{}}],["some(initial_suppli",{"_index":1823,"title":{},"content":{"126":{"position":[[2396,20]]},"269":{"position":[[778,20]]},"277":{"position":[[2564,20]]},"384":{"position":[[791,20]]},"409":{"position":[[778,20]]},"514":{"position":[[2396,20]]},"626":{"position":[[791,20]]},"646":{"position":[[778,20]]}},"keywords":{}}],["some(initial_supply.into",{"_index":2906,"title":{},"content":{"268":{"position":[[1302,27]]},"269":{"position":[[4394,27]]},"408":{"position":[[1302,27]]},"409":{"position":[[4394,27]]},"645":{"position":[[1302,27]]},"646":{"position":[[4394,27]]}},"keywords":{}}],["some(mut",{"_index":3737,"title":{},"content":{"602":{"position":[[1453,8],[1608,8]]},"710":{"position":[[1453,8],[1608,8]]}},"keywords":{}}],["some(own",{"_index":2361,"title":{},"content":{"197":{"position":[[573,11]]},"198":{"position":[[850,12]]},"206":{"position":[[3185,12]]},"268":{"position":[[3291,12]]},"408":{"position":[[3291,12]]},"426":{"position":[[3160,12]]},"433":{"position":[[573,11]]},"434":{"position":[[840,12]]},"645":{"position":[[3291,12]]},"668":{"position":[[3185,12]]},"680":{"position":[[573,11]]},"681":{"position":[[850,12]]}},"keywords":{}}],["some(recipi",{"_index":2520,"title":{},"content":{"206":{"position":[[1682,16],[3202,16]]},"268":{"position":[[3308,16]]},"269":{"position":[[5592,16]]},"408":{"position":[[3308,16]]},"409":{"position":[[5592,16]]},"426":{"position":[[1672,16],[3177,16]]},"645":{"position":[[3308,16]]},"646":{"position":[[5592,16]]},"668":{"position":[[1682,16],[3202,16]]}},"keywords":{}}],["some(send",{"_index":2519,"title":{},"content":{"206":{"position":[[1664,13]]},"269":{"position":[[5574,13]]},"409":{"position":[[5574,13]]},"426":{"position":[[1654,13]]},"646":{"position":[[5574,13]]},"668":{"position":[[1664,13]]}},"keywords":{}}],["some(vot",{"_index":3257,"title":{},"content":{"416":{"position":[[4052,10]]},"419":{"position":[[5631,10]]},"653":{"position":[[4052,10]]},"656":{"position":[[5631,10]]}},"keywords":{}}],["some_function(&self",{"_index":3917,"title":{},"content":{"617":{"position":[[694,24]]},"725":{"position":[[694,24]]}},"keywords":{}}],["someon",{"_index":1937,"title":{},"content":{"141":{"position":[[776,7]]},"326":{"position":[[776,7]]},"394":{"position":[[427,7]]},"535":{"position":[[776,7]]},"631":{"position":[[427,7]]}},"keywords":{}}],["someone'",{"_index":2173,"title":{},"content":{"182":{"position":[[304,9]]},"184":{"position":[[1255,9]]},"373":{"position":[[304,9]]},"375":{"position":[[1152,9]]},"589":{"position":[[304,9]]},"591":{"position":[[1152,9]]}},"keywords":{}}],["someth",{"_index":192,"title":{},"content":{"5":{"position":[[380,9]]},"92":{"position":[[672,9]]},"146":{"position":[[760,9]]},"284":{"position":[[672,9]]},"334":{"position":[[764,9]]},"496":{"position":[[672,9]]},"551":{"position":[[764,9]]}},"keywords":{}}],["sometim",{"_index":1936,"title":{},"content":{"141":{"position":[[716,9]]},"142":{"position":[[0,9]]},"326":{"position":[[716,9]]},"327":{"position":[[0,9]]},"535":{"position":[[716,9]]},"536":{"position":[[0,9]]}},"keywords":{}}],["somewher",{"_index":376,"title":{},"content":{"11":{"position":[[263,10]]},"141":{"position":[[1201,10]]},"326":{"position":[[1201,10]]},"535":{"position":[[1201,10]]}},"keywords":{}}],["soon",{"_index":422,"title":{},"content":{"15":{"position":[[533,4]]}},"keywords":{}}],["sooo",{"_index":210,"title":{},"content":{"6":{"position":[[225,7]]}},"keywords":{}}],["sorri",{"_index":1271,"title":{},"content":{"52":{"position":[[1892,6]]}},"keywords":{}}],["sourc",{"_index":25,"title":{},"content":{"1":{"position":[[248,6]]},"12":{"position":[[323,6]]},"17":{"position":[[95,6],[165,6]]},"18":{"position":[[123,6]]},"22":{"position":[[313,7]]},"43":{"position":[[632,6],[1674,6]]},"117":{"position":[[914,6]]},"298":{"position":[[914,6]]},"519":{"position":[[914,6]]}},"keywords":{}}],["source_file_path",{"_index":1040,"title":{},"content":{"42":{"position":[[614,17]]}},"keywords":{}}],["source_key",{"_index":3461,"title":{},"content":{"440":{"position":[[6331,11]]},"687":{"position":[[6331,11]]}},"keywords":{}}],["spdx",{"_index":1046,"title":{},"content":{"42":{"position":[[877,4]]}},"keywords":{}}],["speak",{"_index":937,"title":{},"content":{"39":{"position":[[1019,8]]},"416":{"position":[[3291,8]]},"653":{"position":[[3291,8]]}},"keywords":{}}],["special",{"_index":1692,"title":{},"content":{"103":{"position":[[622,7]]},"295":{"position":[[622,7]]},"507":{"position":[[622,7]]}},"keywords":{}}],["specif",{"_index":259,"title":{},"content":{"9":{"position":[[61,8]]},"103":{"position":[[393,8]]},"120":{"position":[[302,8]]},"121":{"position":[[412,8]]},"126":{"position":[[2826,8]]},"145":{"position":[[78,8]]},"267":{"position":[[133,8]]},"268":{"position":[[130,8]]},"277":{"position":[[2994,8]]},"295":{"position":[[393,8]]},"301":{"position":[[302,8]]},"302":{"position":[[412,8]]},"322":{"position":[[126,8]]},"333":{"position":[[78,8]]},"407":{"position":[[133,8]]},"408":{"position":[[130,8]]},"507":{"position":[[393,8]]},"514":{"position":[[2826,8]]},"522":{"position":[[302,8]]},"523":{"position":[[412,8]]},"540":{"position":[[126,8]]},"550":{"position":[[78,8]]},"618":{"position":[[694,8]]},"644":{"position":[[133,8]]},"645":{"position":[[130,8]]},"726":{"position":[[694,8]]}},"keywords":{}}],["specifi",{"_index":271,"title":{},"content":{"9":{"position":[[332,9]]},"98":{"position":[[306,9]]},"126":{"position":[[2101,7]]},"184":{"position":[[725,7]]},"265":{"position":[[67,7]]},"277":{"position":[[2269,7]]},"290":{"position":[[306,9]]},"324":{"position":[[423,9]]},"375":{"position":[[644,7]]},"405":{"position":[[67,7]]},"502":{"position":[[306,9]]},"514":{"position":[[2101,7]]},"542":{"position":[[423,9]]},"591":{"position":[[644,7]]},"602":{"position":[[637,9]]},"605":{"position":[[278,7]]},"609":{"position":[[70,7]]},"642":{"position":[[67,7]]},"710":{"position":[[637,9]]},"713":{"position":[[278,7]]},"717":{"position":[[70,7]]}},"keywords":{}}],["speed",{"_index":1700,"title":{},"content":{"107":{"position":[[518,6]]},"274":{"position":[[518,6]]},"491":{"position":[[518,6]]}},"keywords":{}}],["spend",{"_index":202,"title":{},"content":{"6":{"position":[[111,5]]},"202":{"position":[[286,5]]},"419":{"position":[[2796,6],[2911,5]]},"422":{"position":[[286,5]]},"656":{"position":[[2796,6],[2911,5]]},"664":{"position":[[286,5]]}},"keywords":{}}],["spend_allowance(&mut",{"_index":2485,"title":{},"content":{"205":{"position":[[1629,24]]},"269":{"position":[[2862,24]]},"384":{"position":[[2896,24]]},"409":{"position":[[2862,24]]},"425":{"position":[[1604,24]]},"626":{"position":[[2896,24]]},"646":{"position":[[2862,24]]},"667":{"position":[[1604,24]]}},"keywords":{}}],["spender",{"_index":544,"title":{},"content":{"17":{"position":[[3723,8],[3822,9],[3886,8],[3958,9]]},"115":{"position":[[763,8],[1053,8]]},"205":{"position":[[557,7],[716,8],[826,10],[887,8],[896,9],[1086,8],[1167,10],[1681,8],[1763,9],[1927,10],[2002,8],[2011,9],[2141,8]]},"206":{"position":[[2144,8],[2377,8],[2603,8],[2644,7],[3063,8],[3460,8]]},"247":{"position":[[718,8],[782,8],[1099,8]]},"258":{"position":[[741,8],[1007,8]]},"268":{"position":[[2434,8],[3169,8]]},"269":{"position":[[1303,7],[1462,8],[1572,10],[1633,8],[1642,9],[1832,8],[1913,10],[2914,8],[3019,11],[3141,10],[3210,8],[3219,9],[3580,8]]},"384":{"position":[[1316,7],[1475,8],[1585,10],[1646,8],[1655,9],[1852,8],[1933,10],[2948,8],[3053,11],[3182,10],[3251,8],[3260,9],[3566,8]]},"408":{"position":[[2434,8],[3169,8]]},"409":{"position":[[1303,7],[1462,8],[1572,10],[1633,8],[1642,9],[1832,8],[1913,10],[2914,8],[3019,11],[3141,10],[3210,8],[3219,9],[3580,8]]},"419":{"position":[[2785,7],[2848,8],[2900,7],[2995,8],[3073,7],[3139,8],[3218,7],[3284,8]]},"425":{"position":[[532,7],[691,8],[801,10],[862,8],[871,9],[1061,8],[1142,10],[1656,8],[1738,9],[1902,10],[1977,8],[1986,9],[2092,8]]},"426":{"position":[[2134,8],[2367,8],[2588,8],[2629,7],[3043,8],[3435,8]]},"446":{"position":[[718,8],[782,8],[1099,8]]},"481":{"position":[[741,8],[1007,8]]},"626":{"position":[[1316,7],[1475,8],[1585,10],[1646,8],[1655,9],[1852,8],[1933,10],[2948,8],[3053,11],[3182,10],[3251,8],[3260,9],[3566,8]]},"645":{"position":[[2434,8],[3169,8]]},"646":{"position":[[1303,7],[1462,8],[1572,10],[1633,8],[1642,9],[1832,8],[1913,10],[2914,8],[3019,11],[3141,10],[3210,8],[3219,9],[3580,8]]},"656":{"position":[[2785,7],[2848,8],[2900,7],[2995,8],[3073,7],[3139,8],[3218,7],[3284,8]]},"667":{"position":[[532,7],[691,8],[801,10],[862,8],[871,9],[1061,8],[1142,10],[1656,8],[1738,9],[1902,10],[1977,8],[1986,9],[2092,8]]},"668":{"position":[[2144,8],[2377,8],[2603,8],[2644,7],[3063,8],[3460,8]]},"673":{"position":[[718,8],[782,8],[1099,8]]}},"keywords":{}}],["spender'",{"_index":2543,"title":{},"content":{"206":{"position":[[3419,9]]},"419":{"position":[[3517,9]]},"426":{"position":[[3394,9]]},"656":{"position":[[3517,9]]},"668":{"position":[[3419,9]]}},"keywords":{}}],["spin",{"_index":1779,"title":{},"content":{"119":{"position":[[440,4]]},"300":{"position":[[440,4]]},"521":{"position":[[440,4]]}},"keywords":{}}],["split",{"_index":1021,"title":{},"content":{"40":{"position":[[336,6]]}},"keywords":{}}],["sputnik",{"_index":726,"title":{},"content":{"31":{"position":[[417,8]]}},"keywords":{}}],["sputnik'",{"_index":721,"title":{},"content":{"31":{"position":[[345,9]]}},"keywords":{}}],["sputnikvm",{"_index":712,"title":{},"content":{"31":{"position":[[18,10]]},"33":{"position":[[164,9]]}},"keywords":{}}],["sqrt",{"_index":3854,"title":{},"content":{"613":{"position":[[1575,4]]},"721":{"position":[[1575,4]]}},"keywords":{}}],["sqrt(i",{"_index":3829,"title":{},"content":{"613":{"position":[[126,7]]},"721":{"position":[[126,7]]}},"keywords":{}}],["squar",{"_index":3853,"title":{},"content":{"613":{"position":[[1394,6]]},"721":{"position":[[1394,6]]}},"keywords":{}}],["src",{"_index":1098,"title":{"133":{"position":[[0,5]]},"313":{"position":[[0,5]]},"530":{"position":[[0,5]]}},"content":{"42":{"position":[[2690,3]]},"175":{"position":[[227,3]]},"183":{"position":[[19,3]]},"361":{"position":[[227,3]]},"374":{"position":[[19,3]]},"577":{"position":[[227,3]]},"590":{"position":[[19,3]]}},"keywords":{}}],["src/contract.r",{"_index":2966,"title":{},"content":{"321":{"position":[[437,15]]},"539":{"position":[[437,15]]}},"keywords":{}}],["src/counter.r",{"_index":1772,"title":{},"content":{"118":{"position":[[141,14]]},"299":{"position":[[141,14]]},"520":{"position":[[141,14]]}},"keywords":{}}],["src/erc20.r",{"_index":2926,"title":{},"content":{"269":{"position":[[99,12]]},"384":{"position":[[99,12]]},"409":{"position":[[99,12]]},"626":{"position":[[99,12]]},"646":{"position":[[99,12]]}},"keywords":{}}],["src/flipper.r",{"_index":1895,"title":{},"content":{"132":{"position":[[293,15]]},"312":{"position":[[293,15]]},"529":{"position":[[293,15]]}},"keywords":{}}],["src/lib.r",{"_index":1067,"title":{},"content":{"42":{"position":[[1439,10]]},"118":{"position":[[214,10]]},"299":{"position":[[214,10]]},"520":{"position":[[214,10]]}},"keywords":{}}],["src/main.rs:116:5",{"_index":2681,"title":{},"content":{"212":{"position":[[4450,19]]},"391":{"position":[[4468,19]]},"661":{"position":[[4468,19]]}},"keywords":{}}],["src/main.rs:117:5",{"_index":2687,"title":{},"content":{"212":{"position":[[4645,19]]},"391":{"position":[[4663,19]]},"661":{"position":[[4663,19]]}},"keywords":{}}],["src/main.rs:118:5",{"_index":2690,"title":{},"content":{"212":{"position":[[4697,19]]},"391":{"position":[[4715,19]]},"661":{"position":[[4715,19]]}},"keywords":{}}],["src/main.rs:119:5",{"_index":2692,"title":{},"content":{"212":{"position":[[4771,19]]},"391":{"position":[[4789,19]]},"661":{"position":[[4789,19]]}},"keywords":{}}],["src/status_message.sol",{"_index":1045,"title":{},"content":{"42":{"position":[[851,22]]}},"keywords":{}}],["src/test.r",{"_index":1083,"title":{},"content":{"42":{"position":[[2010,11]]}},"keywords":{}}],["src/tests.r",{"_index":3437,"title":{},"content":{"440":{"position":[[4790,12]]},"441":{"position":[[4536,12]]},"687":{"position":[[4790,12]]},"688":{"position":[[4536,12]]}},"keywords":{}}],["src/ticket_operator.r",{"_index":3475,"title":{},"content":{"441":{"position":[[520,22]]},"688":{"position":[[520,22]]}},"keywords":{}}],["src/token.r",{"_index":3207,"title":{},"content":{"414":{"position":[[184,12]]},"416":{"position":[[356,12],[1357,12],[2615,12],[3434,12]]},"417":{"position":[[116,12]]},"419":{"position":[[50,12]]},"440":{"position":[[99,12]]},"441":{"position":[[2228,12]]},"651":{"position":[[184,12]]},"653":{"position":[[356,12],[1357,12],[2615,12],[3434,12]]},"654":{"position":[[116,12]]},"656":{"position":[[50,12]]},"687":{"position":[[99,12]]},"688":{"position":[[2228,12]]}},"keywords":{}}],["stack",{"_index":1618,"title":{},"content":{"94":{"position":[[209,6],[419,5]]},"286":{"position":[[209,6],[419,5]]},"498":{"position":[[209,6],[419,5]]}},"keywords":{}}],["stackexecutor::new_with_precompiles(st",{"_index":784,"title":{},"content":{"31":{"position":[[2205,42]]}},"keywords":{}}],["stacksubstatemetadata::new(u64::max",{"_index":779,"title":{},"content":{"31":{"position":[[2041,36]]}},"keywords":{}}],["stage",{"_index":1172,"title":{},"content":{"44":{"position":[[17,5]]}},"keywords":{}}],["stake",{"_index":3216,"title":{},"content":{"416":{"position":[[141,7],[3141,8]]},"417":{"position":[[696,7],[1040,5]]},"419":{"position":[[7111,7],[7455,5]]},"653":{"position":[[141,7],[3141,8]]},"654":{"position":[[696,7],[1040,5]]},"656":{"position":[[7111,7],[7455,5]]}},"keywords":{}}],["standalon",{"_index":1175,"title":{},"content":{"44":{"position":[[211,10]]},"196":{"position":[[776,10]]},"199":{"position":[[115,10]]},"221":{"position":[[431,10]]},"432":{"position":[[713,10]]},"435":{"position":[[115,10]]},"454":{"position":[[431,10]]},"679":{"position":[[713,10]]},"682":{"position":[[115,10]]},"694":{"position":[[431,10]]}},"keywords":{}}],["standard",{"_index":82,"title":{},"content":{"1":{"position":[[1010,8]]},"22":{"position":[[706,15]]},"38":{"position":[[758,8]]},"79":{"position":[[160,8]]},"91":{"position":[[253,8],[476,9],[827,9]]},"100":{"position":[[18,8]]},"138":{"position":[[1149,8]]},"184":{"position":[[131,8]]},"188":{"position":[[45,9],[107,9],[501,9]]},"198":{"position":[[2369,8]]},"200":{"position":[[47,9]]},"219":{"position":[[92,8]]},"230":{"position":[[160,8]]},"268":{"position":[[2313,8]]},"283":{"position":[[253,8],[476,9],[827,9]]},"292":{"position":[[18,8]]},"318":{"position":[[1141,8]]},"365":{"position":[[51,8],[133,9],[241,8],[314,9],[402,9],[464,9],[858,9]]},"375":{"position":[[131,8]]},"382":{"position":[[22,12]]},"396":{"position":[[487,8]]},"408":{"position":[[2313,8]]},"416":{"position":[[457,9]]},"419":{"position":[[828,9]]},"434":{"position":[[2359,8]]},"436":{"position":[[47,9]]},"442":{"position":[[72,9]]},"452":{"position":[[92,8]]},"461":{"position":[[160,8]]},"495":{"position":[[253,8],[476,9],[827,9]]},"504":{"position":[[18,8]]},"544":{"position":[[1141,8]]},"581":{"position":[[51,8],[133,9],[241,8],[314,9],[402,9],[464,9],[858,9]]},"591":{"position":[[131,8]]},"618":{"position":[[610,8]]},"624":{"position":[[22,12]]},"633":{"position":[[487,8]]},"645":{"position":[[2313,8]]},"653":{"position":[[457,9]]},"656":{"position":[[828,9]]},"681":{"position":[[2369,8]]},"683":{"position":[[47,9]]},"689":{"position":[[72,9]]},"692":{"position":[[92,8]]},"726":{"position":[[610,8]]}},"keywords":{}}],["standard.l3",{"_index":3319,"title":{},"content":{"424":{"position":[[1032,11]]},"666":{"position":[[1032,11]]}},"keywords":{}}],["standard.l8",{"_index":2453,"title":{},"content":{"204":{"position":[[1081,11]]}},"keywords":{}}],["standard.ownership",{"_index":3336,"title":{},"content":{"438":{"position":[[90,18]]},"685":{"position":[[90,18]]}},"keywords":{}}],["start",{"_index":92,"title":{},"content":{"2":{"position":[[49,5],[130,8],[250,6],[469,7],[604,8]]},"11":{"position":[[257,5]]},"22":{"position":[[1496,5]]},"23":{"position":[[29,9]]},"26":{"position":[[63,5]]},"28":{"position":[[63,5]]},"31":{"position":[[113,5]]},"36":{"position":[[63,5]]},"46":{"position":[[63,5]]},"48":{"position":[[63,5]]},"52":{"position":[[210,5]]},"57":{"position":[[63,5]]},"59":{"position":[[63,5]]},"61":{"position":[[64,5]]},"63":{"position":[[64,5]]},"107":{"position":[[468,6]]},"168":{"position":[[1999,5]]},"173":{"position":[[3,5]]},"182":{"position":[[10,5]]},"198":{"position":[[1158,6],[1628,8]]},"214":{"position":[[64,5]]},"216":{"position":[[64,5]]},"218":{"position":[[19,5]]},"225":{"position":[[64,5]]},"262":{"position":[[39,5]]},"274":{"position":[[468,6]]},"348":{"position":[[1999,5]]},"359":{"position":[[3,5]]},"373":{"position":[[10,5]]},"380":{"position":[[39,5]]},"402":{"position":[[39,5]]},"414":{"position":[[6,5],[85,8]]},"417":{"position":[[454,6]]},"419":{"position":[[6869,6]]},"434":{"position":[[1148,6],[1618,8]]},"440":{"position":[[6,5]]},"449":{"position":[[64,5]]},"451":{"position":[[19,5]]},"491":{"position":[[468,6]]},"564":{"position":[[1999,5]]},"575":{"position":[[3,5]]},"589":{"position":[[10,5]]},"596":{"position":[[6,5]]},"622":{"position":[[39,5]]},"639":{"position":[[39,5]]},"651":{"position":[[6,5],[85,8]]},"654":{"position":[[454,6]]},"656":{"position":[[6869,6]]},"681":{"position":[[1158,6],[1628,8]]},"687":{"position":[[6,5]]},"691":{"position":[[19,5]]},"704":{"position":[[6,5]]}},"keywords":{}}],["state",{"_index":760,"title":{"208":{"position":[[27,5]]},"212":{"position":[[12,6]]},"387":{"position":[[27,5]]},"391":{"position":[[12,6]]},"597":{"position":[[21,5]]},"657":{"position":[[27,5]]},"661":{"position":[[12,6]]},"705":{"position":[[21,5]]}},"content":{"31":{"position":[[1338,5],[1369,5],[2018,7],[2096,5]]},"52":{"position":[[1629,5],[2145,6]]},"71":{"position":[[368,6]]},"72":{"position":[[290,5]]},"79":{"position":[[464,6]]},"81":{"position":[[77,6]]},"83":{"position":[[296,6]]},"91":{"position":[[300,5]]},"107":{"position":[[65,6],[217,5],[340,5],[369,5]]},"128":{"position":[[99,6],[142,5],[257,5],[373,6],[617,5]]},"146":{"position":[[468,5]]},"184":{"position":[[1152,7]]},"195":{"position":[[678,5]]},"197":{"position":[[1266,5]]},"211":{"position":[[12,5]]},"212":{"position":[[890,7]]},"218":{"position":[[80,5],[167,5],[200,6]]},"221":{"position":[[19,5],[588,6],[792,5]]},"222":{"position":[[54,6],[474,5],[542,6]]},"223":{"position":[[251,5]]},"230":{"position":[[481,6]]},"232":{"position":[[77,6]]},"235":{"position":[[368,6]]},"236":{"position":[[290,5]]},"252":{"position":[[296,6]]},"274":{"position":[[65,6],[217,5],[340,5],[369,5]]},"279":{"position":[[99,6],[142,5],[257,5],[373,6],[617,5]]},"283":{"position":[[300,5]]},"334":{"position":[[472,5]]},"375":{"position":[[1049,7]]},"390":{"position":[[12,5]]},"391":{"position":[[890,7]]},"431":{"position":[[678,5]]},"433":{"position":[[1265,5]]},"451":{"position":[[80,5],[167,5],[200,6]]},"454":{"position":[[19,5],[588,6],[792,5]]},"455":{"position":[[54,6],[474,5],[542,6]]},"456":{"position":[[251,5]]},"461":{"position":[[481,6]]},"463":{"position":[[77,6]]},"471":{"position":[[368,6]]},"472":{"position":[[290,5]]},"476":{"position":[[963,6]]},"483":{"position":[[296,6]]},"491":{"position":[[65,6],[217,5],[340,5],[369,5]]},"495":{"position":[[300,5]]},"516":{"position":[[99,6],[142,5],[257,5],[373,6],[617,5]]},"551":{"position":[[472,5]]},"591":{"position":[[1049,7]]},"596":{"position":[[710,5],[830,5],[1046,5]]},"600":{"position":[[513,5],[569,5],[919,5]]},"602":{"position":[[739,5]]},"604":{"position":[[493,5]]},"605":{"position":[[408,5],[447,6],[597,6]]},"607":{"position":[[14,5]]},"613":{"position":[[1299,5]]},"660":{"position":[[12,5]]},"661":{"position":[[890,7]]},"678":{"position":[[678,5]]},"680":{"position":[[1265,5]]},"691":{"position":[[80,5],[167,5],[200,6]]},"694":{"position":[[19,5],[588,6],[792,5]]},"695":{"position":[[54,6],[474,5],[542,6]]},"696":{"position":[[251,5]]},"698":{"position":[[963,6]]},"704":{"position":[[710,5],[830,5],[1046,5]]},"708":{"position":[[513,5],[569,5],[919,5]]},"710":{"position":[[739,5]]},"712":{"position":[[493,5]]},"713":{"position":[[408,5],[447,6],[597,6]]},"715":{"position":[[14,5]]},"721":{"position":[[1299,5]]}},"keywords":{}}],["state.insert",{"_index":765,"title":{},"content":{"31":{"position":[[1438,13],[1732,13]]}},"keywords":{}}],["state.queri",{"_index":1275,"title":{},"content":{"52":{"position":[[2111,11]]}},"keywords":{}}],["state_root_hash",{"_index":2625,"title":{},"content":{"212":{"position":[[691,15],[835,16],[1016,16]]},"391":{"position":[[691,15],[835,16],[1016,16]]},"661":{"position":[[691,15],[835,16],[1016,16]]}},"keywords":{}}],["statement",{"_index":968,"title":{},"content":{"39":{"position":[[2162,11]]},"198":{"position":[[1288,9]]},"267":{"position":[[258,10]]},"407":{"position":[[258,10]]},"434":{"position":[[1278,9]]},"617":{"position":[[886,9],[1066,9],[1264,9]]},"644":{"position":[[258,10]]},"681":{"position":[[1288,9]]},"725":{"position":[[886,9],[1066,9],[1264,9]]}},"keywords":{}}],["static",{"_index":910,"title":{},"content":{"39":{"position":[[453,6]]}},"keywords":{}}],["statu",{"_index":1025,"title":{"42":{"position":[[0,6]]}},"content":{"42":{"position":[[219,6],[238,6],[1028,7],[1106,7],[2671,6]]},"396":{"position":[[1176,6]]},"398":{"position":[[195,6]]},"440":{"position":[[552,7],[2092,7],[3426,6],[4526,6]]},"602":{"position":[[89,6],[193,7],[278,6],[344,7],[352,7]]},"633":{"position":[[1176,6]]},"635":{"position":[[195,6]]},"687":{"position":[[552,7],[2092,7],[3426,6],[4526,6]]},"710":{"position":[[89,6],[193,7],[278,6],[344,7],[352,7]]}},"keywords":{}}],["status_messag",{"_index":1069,"title":{},"content":{"42":{"position":[[1454,15],[1617,14]]}},"keywords":{}}],["status_message.sol",{"_index":1099,"title":{},"content":{"42":{"position":[[2713,18]]}},"keywords":{}}],["status_message::{statusmessag",{"_index":1070,"title":{},"content":{"42":{"position":[[1478,31]]}},"keywords":{}}],["statusmessag",{"_index":1051,"title":{},"content":{"42":{"position":[[940,13]]}},"keywords":{}}],["statusmessagedeploy",{"_index":1071,"title":{},"content":{"42":{"position":[[1510,22],[1904,21]]}},"keywords":{}}],["statusmessagedeployer::default",{"_index":1087,"title":{},"content":{"42":{"position":[[2195,33],[2451,33]]}},"keywords":{}}],["statusmessageref",{"_index":1072,"title":{},"content":{"42":{"position":[[1533,18]]}},"keywords":{}}],["stay",{"_index":955,"title":{},"content":{"39":{"position":[[1626,5]]}},"keywords":{}}],["stay.w",{"_index":130,"title":{},"content":{"3":{"position":[[144,7]]}},"keywords":{}}],["std::fs::read(evm_calc_path).unwrap",{"_index":840,"title":{},"content":{"32":{"position":[[1187,38]]}},"keywords":{}}],["std::fs::read(multiply_path",{"_index":268,"title":{},"content":{"9":{"position":[[252,28]]}},"keywords":{}}],["std::io::write::write(&mut",{"_index":2677,"title":{},"content":{"212":{"position":[[4250,30]]},"391":{"position":[[4268,30]]},"661":{"position":[[4268,30]]}},"keywords":{}}],["std::str::fromstr",{"_index":3121,"title":{},"content":{"395":{"position":[[350,18]]},"632":{"position":[[350,18]]}},"keywords":{}}],["step",{"_index":62,"title":{"263":{"position":[[13,6]]},"381":{"position":[[13,6]]},"403":{"position":[[13,6]]},"623":{"position":[[13,6]]},"640":{"position":[[13,6]]}},"content":{"1":{"position":[[809,5]]},"10":{"position":[[21,5]]},"32":{"position":[[494,4]]},"38":{"position":[[1119,4]]},"39":{"position":[[248,6],[419,6],[1679,4],[3175,4]]},"40":{"position":[[50,4]]},"43":{"position":[[740,5]]},"44":{"position":[[95,6]]},"65":{"position":[[657,4]]},"66":{"position":[[262,4]]},"174":{"position":[[414,5]]},"185":{"position":[[12,8]]},"189":{"position":[[636,4]]},"196":{"position":[[1411,4]]},"211":{"position":[[87,4]]},"240":{"position":[[657,4]]},"241":{"position":[[262,4]]},"270":{"position":[[67,6]]},"360":{"position":[[414,5]]},"366":{"position":[[636,4]]},"376":{"position":[[12,8]]},"385":{"position":[[67,6]]},"390":{"position":[[87,4]]},"410":{"position":[[67,6]]},"416":{"position":[[3344,4]]},"432":{"position":[[1353,4]]},"465":{"position":[[657,4]]},"466":{"position":[[262,4]]},"576":{"position":[[414,5]]},"582":{"position":[[636,4]]},"592":{"position":[[12,8]]},"627":{"position":[[67,6]]},"647":{"position":[[67,6]]},"653":{"position":[[3344,4]]},"660":{"position":[[87,4]]},"679":{"position":[[1353,4]]}},"keywords":{}}],["step.add",{"_index":2804,"title":{},"content":{"265":{"position":[[217,8]]},"405":{"position":[[217,8]]},"642":{"position":[[217,8]]}},"keywords":{}}],["steroid",{"_index":2547,"title":{},"content":{"207":{"position":[[83,9]]},"427":{"position":[[83,9]]},"669":{"position":[[83,9]]}},"keywords":{}}],["still",{"_index":675,"title":{},"content":{"23":{"position":[[55,5],[279,5]]},"54":{"position":[[165,5]]}},"keywords":{}}],["stop",{"_index":1606,"title":{},"content":{"93":{"position":[[18,4]]},"182":{"position":[[371,5]]},"190":{"position":[[54,4]]},"218":{"position":[[141,4]]},"221":{"position":[[883,5]]},"285":{"position":[[18,4]]},"367":{"position":[[54,4]]},"373":{"position":[[371,5]]},"451":{"position":[[141,4]]},"454":{"position":[[883,5]]},"497":{"position":[[18,4]]},"583":{"position":[[54,4]]},"589":{"position":[[371,5]]},"611":{"position":[[801,5]]},"691":{"position":[[141,4]]},"694":{"position":[[883,5]]},"719":{"position":[[801,5]]}},"keywords":{}}],["storag",{"_index":654,"title":{"75":{"position":[[9,7]]},"77":{"position":[[9,7]]},"82":{"position":[[0,7]]},"161":{"position":[[0,7]]},"211":{"position":[[0,7]]},"226":{"position":[[9,7]]},"228":{"position":[[9,7]]},"251":{"position":[[0,7]]},"350":{"position":[[0,7]]},"390":{"position":[[0,7]]},"457":{"position":[[9,7]]},"459":{"position":[[9,7]]},"482":{"position":[[0,7]]},"566":{"position":[[0,7]]},"597":{"position":[[9,7]]},"660":{"position":[[0,7]]},"705":{"position":[[9,7]]}},"content":{"22":{"position":[[614,8]]},"31":{"position":[[1601,8],[1895,8]]},"54":{"position":[[241,8]]},"76":{"position":[[67,7],[115,7],[194,8],[616,7],[951,7]]},"78":{"position":[[73,7]]},"79":{"position":[[34,7]]},"80":{"position":[[86,7]]},"81":{"position":[[9,7]]},"83":{"position":[[45,7]]},"84":{"position":[[102,7],[178,7],[734,7],[865,7],[943,7]]},"86":{"position":[[27,8]]},"91":{"position":[[643,7]]},"110":{"position":[[297,7]]},"145":{"position":[[275,8]]},"146":{"position":[[821,7]]},"147":{"position":[[1333,7]]},"149":{"position":[[48,7]]},"162":{"position":[[24,7],[144,8],[2024,8],[2341,8]]},"163":{"position":[[1188,7]]},"164":{"position":[[468,9],[988,8]]},"178":{"position":[[873,8]]},"185":{"position":[[2589,7]]},"196":{"position":[[1281,8]]},"197":{"position":[[1355,8]]},"201":{"position":[[87,7]]},"202":{"position":[[48,7]]},"209":{"position":[[36,7]]},"211":{"position":[[61,7],[131,7],[811,7],[846,7]]},"220":{"position":[[11,7]]},"227":{"position":[[67,7],[115,7],[194,8],[616,7],[951,7]]},"229":{"position":[[73,7]]},"230":{"position":[[34,7]]},"231":{"position":[[86,7]]},"232":{"position":[[9,7]]},"246":{"position":[[346,7]]},"252":{"position":[[45,7]]},"253":{"position":[[102,7],[178,7],[734,7],[865,7],[943,7]]},"255":{"position":[[27,8]]},"283":{"position":[[643,7]]},"305":{"position":[[297,7]]},"333":{"position":[[275,8]]},"334":{"position":[[825,7]]},"335":{"position":[[1341,7]]},"337":{"position":[[48,7]]},"351":{"position":[[24,7],[144,8],[2046,8],[2363,8]]},"352":{"position":[[1210,7]]},"353":{"position":[[503,9],[1023,8]]},"369":{"position":[[873,8]]},"376":{"position":[[2573,7]]},"388":{"position":[[36,7]]},"390":{"position":[[61,7],[131,7],[785,7],[820,7]]},"416":{"position":[[234,8]]},"421":{"position":[[87,7]]},"422":{"position":[[48,7]]},"432":{"position":[[1223,8]]},"433":{"position":[[1354,8]]},"440":{"position":[[3523,8]]},"445":{"position":[[346,7]]},"453":{"position":[[11,7]]},"458":{"position":[[67,7],[115,7],[194,8],[616,7],[951,7]]},"460":{"position":[[73,7]]},"461":{"position":[[34,7]]},"462":{"position":[[86,7]]},"463":{"position":[[9,7]]},"483":{"position":[[45,7]]},"484":{"position":[[102,7],[178,7],[734,7],[865,7],[943,7]]},"486":{"position":[[27,8]]},"495":{"position":[[643,7]]},"510":{"position":[[297,7]]},"550":{"position":[[275,8]]},"551":{"position":[[825,7]]},"552":{"position":[[1341,7]]},"554":{"position":[[48,7]]},"567":{"position":[[24,7],[144,8],[2046,8],[2363,8]]},"568":{"position":[[1210,7]]},"569":{"position":[[503,9],[1023,8]]},"585":{"position":[[873,8]]},"592":{"position":[[2573,7]]},"603":{"position":[[153,8],[255,7],[339,8]]},"653":{"position":[[234,8]]},"658":{"position":[[36,7]]},"660":{"position":[[61,7],[131,7],[785,7],[820,7]]},"663":{"position":[[87,7]]},"664":{"position":[[48,7]]},"672":{"position":[[346,7]]},"679":{"position":[[1223,8]]},"680":{"position":[[1354,8]]},"687":{"position":[[3523,8]]},"693":{"position":[[11,7]]},"711":{"position":[[153,8],[255,7],[339,8]]}},"keywords":{}}],["storage.th",{"_index":1190,"title":{},"content":{"51":{"position":[[239,11]]}},"keywords":{}}],["storageinfo",{"_index":979,"title":{},"content":{"39":{"position":[[2376,11]]}},"keywords":{}}],["store",{"_index":305,"title":{},"content":{"9":{"position":[[1189,5],[1360,5],[1524,5]]},"10":{"position":[[239,6]]},"42":{"position":[[90,6],[1271,6]]},"51":{"position":[[113,5]]},"52":{"position":[[996,5],[1039,5],[1802,7],[2285,5],[2313,5],[3115,7]]},"76":{"position":[[269,5],[341,5],[396,5],[485,7],[635,6],[808,7]]},"78":{"position":[[44,6]]},"81":{"position":[[179,5],[274,5]]},"83":{"position":[[179,7],[241,7],[343,6]]},"84":{"position":[[405,5],[827,6]]},"86":{"position":[[13,6]]},"91":{"position":[[371,6],[522,6],[735,6]]},"92":{"position":[[209,6]]},"94":{"position":[[520,5],[669,6]]},"126":{"position":[[316,5]]},"145":{"position":[[233,7]]},"146":{"position":[[179,5]]},"162":{"position":[[97,6]]},"163":{"position":[[23,5],[219,5],[550,7]]},"165":{"position":[[19,5]]},"178":{"position":[[193,5]]},"185":{"position":[[2653,6]]},"193":{"position":[[78,7]]},"202":{"position":[[115,5]]},"203":{"position":[[392,5]]},"209":{"position":[[65,6],[160,6]]},"211":{"position":[[756,6]]},"212":{"position":[[1622,5],[1737,5],[1846,6],[1927,5],[2139,5],[3766,6]]},"227":{"position":[[269,5],[341,5],[396,5],[485,7],[635,6],[808,7]]},"229":{"position":[[44,6]]},"232":{"position":[[179,5],[274,5]]},"252":{"position":[[179,7],[241,7],[343,6]]},"253":{"position":[[405,5],[827,6]]},"255":{"position":[[13,6]]},"277":{"position":[[316,5]]},"283":{"position":[[371,6],[522,6],[735,6]]},"284":{"position":[[209,6]]},"286":{"position":[[520,5],[669,6]]},"333":{"position":[[233,7]]},"334":{"position":[[179,5]]},"351":{"position":[[97,6]]},"352":{"position":[[23,5],[219,5],[572,7]]},"354":{"position":[[19,5]]},"369":{"position":[[193,5]]},"376":{"position":[[2637,6]]},"388":{"position":[[65,6],[160,6]]},"390":{"position":[[730,6]]},"391":{"position":[[1622,5],[1737,5],[1846,6],[1927,5],[2139,5],[3784,6]]},"416":{"position":[[259,5],[1190,5]]},"422":{"position":[[115,5]]},"423":{"position":[[392,5]]},"429":{"position":[[78,7]]},"440":{"position":[[1988,5],[3895,6],[4177,6]]},"441":{"position":[[1702,6],[2645,5],[3809,6]]},"458":{"position":[[269,5],[341,5],[396,5],[485,7],[635,6],[808,7]]},"460":{"position":[[44,6]]},"463":{"position":[[179,5],[274,5]]},"483":{"position":[[179,7],[241,7],[343,6]]},"484":{"position":[[405,5],[827,6]]},"486":{"position":[[13,6]]},"495":{"position":[[371,6],[522,6],[735,6]]},"496":{"position":[[209,6]]},"498":{"position":[[520,5],[669,6]]},"514":{"position":[[316,5]]},"550":{"position":[[233,7]]},"551":{"position":[[179,5]]},"567":{"position":[[97,6]]},"568":{"position":[[23,5],[219,5],[572,7]]},"570":{"position":[[19,5]]},"585":{"position":[[193,5]]},"592":{"position":[[2637,6]]},"596":{"position":[[136,6],[858,6]]},"598":{"position":[[1973,5],[2003,6]]},"600":{"position":[[589,6],[695,6]]},"601":{"position":[[1887,7],[2251,5]]},"603":{"position":[[85,6],[314,6]]},"613":{"position":[[2208,6]]},"653":{"position":[[259,5],[1190,5]]},"658":{"position":[[65,6],[160,6]]},"660":{"position":[[730,6]]},"661":{"position":[[1622,5],[1737,5],[1846,6],[1927,5],[2139,5],[3784,6]]},"664":{"position":[[115,5]]},"665":{"position":[[392,5]]},"676":{"position":[[78,7]]},"687":{"position":[[1988,5],[3895,6],[4177,6]]},"688":{"position":[[1702,6],[2645,5],[3809,6]]},"704":{"position":[[136,6],[858,6]]},"706":{"position":[[1973,5],[2003,6]]},"708":{"position":[[589,6],[695,6]]},"709":{"position":[[1887,7],[2251,5]]},"711":{"position":[[85,6],[314,6]]},"721":{"position":[[2208,6]]}},"keywords":{}}],["stored.odra_cfg_allow_key_overrid",{"_index":1642,"title":{},"content":{"98":{"position":[[238,34]]},"290":{"position":[[238,34]]},"502":{"position":[[238,34]]}},"keywords":{}}],["stored_valu",{"_index":2635,"title":{},"content":{"212":{"position":[[1212,14]]},"391":{"position":[[1212,14]]},"661":{"position":[[1212,14]]}},"keywords":{}}],["storedvalue::clvalue(cl_valu",{"_index":2637,"title":{},"content":{"212":{"position":[[1273,30]]},"391":{"position":[[1273,30]]},"661":{"position":[[1273,30]]}},"keywords":{}}],["straightforward",{"_index":1074,"title":{},"content":{"42":{"position":[[1588,16]]},"43":{"position":[[707,16]]},"84":{"position":[[162,15]]},"145":{"position":[[34,16]]},"165":{"position":[[124,16]]},"184":{"position":[[1107,15]]},"189":{"position":[[255,15]]},"253":{"position":[[162,15]]},"333":{"position":[[34,16]]},"354":{"position":[[124,16]]},"366":{"position":[[255,15]]},"375":{"position":[[1004,15]]},"416":{"position":[[26,16]]},"439":{"position":[[38,16]]},"484":{"position":[[162,15]]},"550":{"position":[[34,16]]},"570":{"position":[[124,16]]},"582":{"position":[[255,15]]},"591":{"position":[[1004,15]]},"653":{"position":[[26,16]]},"686":{"position":[[38,16]]}},"keywords":{}}],["straightforwardli",{"_index":1608,"title":{},"content":{"93":{"position":[[44,17]]},"285":{"position":[[44,17]]},"497":{"position":[[44,17]]}},"keywords":{}}],["stranger",{"_index":3603,"title":{},"content":{"594":{"position":[[4,8]]},"702":{"position":[[4,8]]}},"keywords":{}}],["stream",{"_index":1011,"title":{},"content":{"39":{"position":[[3242,6]]}},"keywords":{}}],["streamlin",{"_index":1523,"title":{},"content":{"84":{"position":[[91,10]]},"253":{"position":[[91,10]]},"484":{"position":[[91,10]]}},"keywords":{}}],["strength",{"_index":3301,"title":{},"content":{"419":{"position":[[1850,9],[1899,8]]},"656":{"position":[[1850,9],[1899,8]]}},"keywords":{}}],["string",{"_index":304,"title":{},"content":{"9":{"position":[[1178,6],[1349,6],[1513,6]]},"10":{"position":[[1021,6],[1251,6]]},"17":{"position":[[1131,7],[1464,6],[2269,7],[2285,7]]},"31":{"position":[[744,6],[894,6],[2766,7]]},"32":{"position":[[77,6],[389,6],[1566,6]]},"42":{"position":[[143,6],[978,7],[1174,7]]},"43":{"position":[[253,6]]},"79":{"position":[[204,7],[703,8],[737,8],[885,7],[999,7],[1024,6],[1039,6],[1327,7]]},"80":{"position":[[316,8],[565,7],[582,7],[749,7],[766,7]]},"83":{"position":[[365,7]]},"84":{"position":[[354,6]]},"98":{"position":[[164,6]]},"103":{"position":[[223,6]]},"115":{"position":[[366,7],[382,7],[825,7],[864,7],[2209,7],[2225,7]]},"162":{"position":[[823,7],[1113,6]]},"163":{"position":[[503,6],[828,7],[973,7]]},"164":{"position":[[585,7],[647,6]]},"165":{"position":[[77,8],[256,7]]},"204":{"position":[[96,7],[112,7],[343,6],[412,6]]},"209":{"position":[[600,7],[621,7],[990,7],[1011,7],[1287,7],[1302,7]]},"212":{"position":[[499,7],[520,7],[657,7],[3848,6]]},"230":{"position":[[204,7],[720,8],[754,8],[902,7],[1016,7],[1041,6],[1056,6],[1344,7]]},"231":{"position":[[316,8],[565,7],[582,7],[749,7],[766,7]]},"247":{"position":[[131,7],[147,7],[346,6],[406,6]]},"252":{"position":[[365,7]]},"253":{"position":[[354,6]]},"258":{"position":[[356,7],[372,7],[799,7],[834,7],[2155,7],[2171,7]]},"269":{"position":[[587,7],[601,7],[1702,6]]},"290":{"position":[[164,6]]},"295":{"position":[[223,6]]},"321":{"position":[[1147,7],[1367,7],[1743,7],[2078,7],[2214,7]]},"351":{"position":[[845,7],[1135,6]]},"352":{"position":[[525,6],[850,7],[995,7]]},"353":{"position":[[620,7],[682,6]]},"354":{"position":[[77,8],[294,7]]},"383":{"position":[[380,7]]},"384":{"position":[[600,7],[614,7],[1715,6]]},"388":{"position":[[561,7],[582,7],[922,7],[943,7],[1219,7],[1234,7]]},"391":{"position":[[499,7],[520,7],[657,7],[3866,6]]},"409":{"position":[[587,7],[601,7],[1702,6]]},"414":{"position":[[396,7],[431,7]]},"419":{"position":[[1396,7],[1412,7],[2374,7],[2446,7]]},"424":{"position":[[71,7],[87,7],[318,6],[387,6]]},"440":{"position":[[531,7],[651,7],[1194,7],[1221,7],[1661,7]]},"441":{"position":[[2873,7]]},"446":{"position":[[131,7],[147,7],[346,6],[406,6]]},"461":{"position":[[204,7],[720,8],[754,8],[902,7],[1016,7],[1041,6],[1056,6],[1344,7]]},"462":{"position":[[316,8],[565,7],[582,7],[749,7],[766,7]]},"481":{"position":[[356,7],[372,7],[799,7],[834,7],[2155,7],[2171,7]]},"483":{"position":[[365,7]]},"484":{"position":[[354,6]]},"502":{"position":[[164,6]]},"507":{"position":[[223,6]]},"539":{"position":[[1147,7],[1367,7],[1743,7],[2078,7],[2214,7]]},"567":{"position":[[845,7],[1135,6]]},"568":{"position":[[525,6],[850,7],[995,7]]},"569":{"position":[[620,7],[682,6]]},"570":{"position":[[77,8],[294,7]]},"596":{"position":[[343,7],[408,6]]},"602":{"position":[[1018,7],[1321,7],[1436,7]]},"610":{"position":[[104,7]]},"612":{"position":[[545,6],[692,6],[839,6],[1009,6],[1166,6],[1324,6]]},"616":{"position":[[218,7],[1000,7]]},"625":{"position":[[380,7]]},"626":{"position":[[600,7],[614,7],[1715,6]]},"646":{"position":[[587,7],[601,7],[1702,6]]},"651":{"position":[[396,7],[431,7]]},"656":{"position":[[1396,7],[1412,7],[2374,7],[2446,7]]},"658":{"position":[[561,7],[582,7],[922,7],[943,7],[1219,7],[1234,7]]},"661":{"position":[[499,7],[520,7],[657,7],[3866,6]]},"666":{"position":[[71,7],[87,7],[318,6],[387,6]]},"673":{"position":[[131,7],[147,7],[346,6],[406,6]]},"687":{"position":[[531,7],[651,7],[1194,7],[1221,7],[1661,7]]},"688":{"position":[[2873,7]]},"704":{"position":[[343,7],[408,6]]},"710":{"position":[[1018,7],[1321,7],[1436,7]]},"718":{"position":[[104,7]]},"720":{"position":[[545,6],[692,6],[839,6],[1009,6],[1166,6],[1324,6]]},"724":{"position":[[218,7],[1000,7]]}},"keywords":{}}],["string>",{"_index":474,"title":{},"content":{"17":{"position":[[584,10]]},"79":{"position":[[746,11]]},"230":{"position":[[763,11]]},"461":{"position":[[763,11]]}},"keywords":{}}],["string::from("ok"",{"_index":358,"title":{},"content":{"10":{"position":[[1358,29]]}},"keywords":{}}],["string::from("ot"",{"_index":3152,"title":{},"content":{"395":{"position":[[1893,29]]},"632":{"position":[[1893,29]]}},"keywords":{}}],["string::from("ourtoken"",{"_index":3151,"title":{},"content":{"395":{"position":[[1844,35]]},"632":{"position":[[1844,35]]}},"keywords":{}}],["string::from("plascoin"",{"_index":1814,"title":{},"content":{"126":{"position":[[1894,35]]},"277":{"position":[[2062,35]]},"514":{"position":[[1894,35]]}},"keywords":{}}],["string::from("pls"",{"_index":1815,"title":{},"content":{"126":{"position":[[1943,30]]},"277":{"position":[[2111,30]]},"514":{"position":[[1943,30]]}},"keywords":{}}],["string::from_bytes(&bytes).unwrap",{"_index":2641,"title":{},"content":{"212":{"position":[[1668,40],[1790,40]]},"391":{"position":[[1668,40],[1790,40]]},"661":{"position":[[1668,40],[1790,40]]}},"keywords":{}}],["string::new",{"_index":1094,"title":{},"content":{"42":{"position":[[2497,14]]}},"keywords":{}}],["strip",{"_index":1341,"title":{},"content":{"66":{"position":[[61,5],[78,5]]},"68":{"position":[[416,5]]},"241":{"position":[[61,5],[78,5]]},"243":{"position":[[416,5]]},"466":{"position":[[61,5],[78,5]]},"468":{"position":[[416,5]]}},"keywords":{}}],["strong",{"_index":898,"title":{},"content":{"39":{"position":[[121,6]]}},"keywords":{}}],["struct",{"_index":339,"title":{"146":{"position":[[0,7]]},"334":{"position":[[0,7]]},"551":{"position":[[0,7]]}},"content":{"10":{"position":[[719,6]]},"17":{"position":[[431,6],[1959,6]]},"22":{"position":[[1094,6]]},"39":{"position":[[656,6],[1896,6],[1988,6]]},"51":{"position":[[493,6],[1174,6],[1287,6]]},"73":{"position":[[20,6]]},"78":{"position":[[182,6]]},"79":{"position":[[685,6]]},"80":{"position":[[233,6]]},"84":{"position":[[133,6],[218,6],[564,6]]},"85":{"position":[[26,8]]},"91":{"position":[[759,6]]},"115":{"position":[[212,6],[2014,6]]},"141":{"position":[[1365,6]]},"146":{"position":[[48,6],[131,6],[393,6],[439,6]]},"147":{"position":[[321,7]]},"162":{"position":[[351,6]]},"163":{"position":[[381,6],[1607,6]]},"164":{"position":[[174,6]]},"165":{"position":[[233,6],[337,6]]},"178":{"position":[[63,6],[145,6]]},"184":{"position":[[315,6],[439,6],[563,6]]},"185":{"position":[[378,6]]},"195":{"position":[[108,6],[279,6]]},"196":{"position":[[449,6],[1438,7],[1450,6]]},"203":{"position":[[137,6]]},"204":{"position":[[891,6]]},"205":{"position":[[2099,6]]},"209":{"position":[[576,6],[709,6],[821,6],[1517,6],[1637,6]]},"212":{"position":[[475,6],[598,6]]},"219":{"position":[[426,6],[508,6]]},"220":{"position":[[193,6]]},"223":{"position":[[336,6]]},"229":{"position":[[182,6]]},"230":{"position":[[702,6]]},"231":{"position":[[233,6]]},"237":{"position":[[20,6]]},"246":{"position":[[223,6]]},"253":{"position":[[133,6],[218,6],[564,6]]},"254":{"position":[[26,8]]},"258":{"position":[[202,6],[1960,6]]},"267":{"position":[[938,6],[1084,6],[1591,6],[3340,6]]},"269":{"position":[[305,6],[3394,6],[3538,6]]},"283":{"position":[[759,6]]},"321":{"position":[[933,6],[1642,6],[1723,6],[1967,6],[2055,6],[2095,6],[2191,6]]},"324":{"position":[[536,7],[588,6]]},"326":{"position":[[1365,6]]},"334":{"position":[[48,6],[131,6],[393,6],[443,6]]},"335":{"position":[[321,7]]},"351":{"position":[[388,6]]},"352":{"position":[[403,6],[1629,6]]},"353":{"position":[[209,6]]},"354":{"position":[[271,6],[393,7],[674,6]]},"369":{"position":[[63,6],[145,6]]},"375":{"position":[[282,6],[382,6],[482,6]]},"376":{"position":[[362,6]]},"383":{"position":[[357,6],[713,6],[1113,6]]},"384":{"position":[[318,6],[3404,6],[3524,6]]},"388":{"position":[[537,6],[641,6],[753,6],[1449,6],[1569,6]]},"391":{"position":[[475,6],[598,6]]},"407":{"position":[[938,6],[1084,6],[1591,6],[3340,6]]},"409":{"position":[[305,6],[3394,6],[3538,6]]},"414":{"position":[[217,6],[578,6],[757,6],[794,6]]},"416":{"position":[[348,7],[389,6],[813,6]]},"419":{"position":[[225,6],[678,6],[761,6]]},"423":{"position":[[137,6]]},"424":{"position":[[842,6]]},"425":{"position":[[2050,6]]},"431":{"position":[[108,6],[279,6]]},"432":{"position":[[386,6],[1380,7],[1392,6]]},"440":{"position":[[499,6],[595,6],[693,6],[978,6],[3457,6]]},"441":{"position":[[774,6],[2366,6]]},"445":{"position":[[223,6]]},"452":{"position":[[381,6],[439,6]]},"453":{"position":[[193,6]]},"456":{"position":[[336,6]]},"460":{"position":[[182,6]]},"461":{"position":[[702,6]]},"462":{"position":[[233,6]]},"473":{"position":[[20,6]]},"476":{"position":[[253,6],[1743,6],[1842,6]]},"481":{"position":[[202,6],[1960,6]]},"484":{"position":[[133,6],[218,6],[564,6]]},"485":{"position":[[26,8]]},"495":{"position":[[759,6]]},"535":{"position":[[1365,6]]},"539":{"position":[[933,6],[1642,6],[1723,6],[1967,6],[2055,6],[2095,6],[2191,6]]},"542":{"position":[[536,7],[588,6]]},"551":{"position":[[48,6],[131,6],[393,6],[443,6]]},"552":{"position":[[321,7]]},"567":{"position":[[388,6]]},"568":{"position":[[403,6],[1629,6]]},"569":{"position":[[209,6]]},"570":{"position":[[271,6],[393,7],[674,6]]},"585":{"position":[[63,6],[145,6]]},"591":{"position":[[282,6],[382,6],[482,6]]},"592":{"position":[[362,6]]},"596":{"position":[[225,6],[589,6],[679,6],[810,6]]},"598":{"position":[[170,6]]},"599":{"position":[[98,6]]},"600":{"position":[[82,6]]},"601":{"position":[[83,6],[645,6],[1160,6]]},"602":{"position":[[179,6],[998,6],[1065,6],[1878,7],[1942,6]]},"605":{"position":[[48,6]]},"606":{"position":[[48,6]]},"608":{"position":[[107,6]]},"610":{"position":[[65,6],[133,6],[170,6],[513,7],[575,6],[742,6]]},"611":{"position":[[178,6]]},"612":{"position":[[482,6],[604,6],[751,6],[898,6],[1055,6],[1212,6],[1963,7],[2018,6]]},"613":{"position":[[330,6],[854,6]]},"616":{"position":[[132,6],[527,6]]},"617":{"position":[[88,6],[628,6]]},"625":{"position":[[357,6],[713,6],[1113,6]]},"626":{"position":[[318,6],[3404,6],[3524,6]]},"644":{"position":[[938,6],[1084,6],[1591,6],[3340,6]]},"646":{"position":[[305,6],[3394,6],[3538,6]]},"651":{"position":[[217,6],[578,6],[757,6],[794,6]]},"653":{"position":[[348,7],[389,6],[813,6]]},"656":{"position":[[225,6],[678,6],[761,6]]},"658":{"position":[[537,6],[641,6],[753,6],[1449,6],[1569,6]]},"661":{"position":[[475,6],[598,6]]},"665":{"position":[[137,6]]},"666":{"position":[[842,6]]},"667":{"position":[[2050,6]]},"672":{"position":[[223,6]]},"678":{"position":[[108,6],[279,6]]},"679":{"position":[[386,6],[1380,7],[1392,6]]},"687":{"position":[[499,6],[595,6],[693,6],[978,6],[3457,6]]},"688":{"position":[[774,6],[2366,6]]},"692":{"position":[[381,6],[439,6]]},"693":{"position":[[193,6]]},"696":{"position":[[336,6]]},"698":{"position":[[253,6],[1743,6],[1842,6]]},"704":{"position":[[225,6],[589,6],[679,6],[810,6]]},"706":{"position":[[170,6]]},"707":{"position":[[98,6]]},"708":{"position":[[82,6]]},"709":{"position":[[83,6],[645,6],[1160,6]]},"710":{"position":[[179,6],[998,6],[1065,6],[1878,7],[1942,6]]},"713":{"position":[[48,6]]},"714":{"position":[[48,6]]},"716":{"position":[[107,6]]},"718":{"position":[[65,6],[133,6],[170,6],[513,7],[575,6],[742,6]]},"719":{"position":[[178,6]]},"720":{"position":[[482,6],[604,6],[751,6],[898,6],[1055,6],[1212,6],[1963,7],[2018,6]]},"721":{"position":[[330,6],[854,6]]},"724":{"position":[[132,6],[527,6]]},"725":{"position":[[88,6],[628,6]]}},"keywords":{}}],["structur",{"_index":905,"title":{"130":{"position":[[10,9]]},"183":{"position":[[8,10]]},"310":{"position":[[10,9]]},"374":{"position":[[8,10]]},"527":{"position":[[10,9]]},"590":{"position":[[8,10]]}},"content":{"39":{"position":[[296,10]]},"76":{"position":[[298,10]]},"84":{"position":[[310,9]]},"115":{"position":[[3180,10]]},"227":{"position":[[298,10]]},"253":{"position":[[310,9]]},"258":{"position":[[3106,10]]},"267":{"position":[[295,11],[4448,9]]},"407":{"position":[[295,11],[4448,9]]},"440":{"position":[[3337,10]]},"458":{"position":[[298,10]]},"481":{"position":[[3106,10]]},"484":{"position":[[310,9]]},"618":{"position":[[130,10]]},"644":{"position":[[295,11],[4448,9]]},"687":{"position":[[3337,10]]},"726":{"position":[[130,10]]}},"keywords":{}}],["style",{"_index":420,"title":{},"content":{"15":{"position":[[456,6]]}},"keywords":{}}],["sub",{"_index":3210,"title":{},"content":{"414":{"position":[[327,3]]},"416":{"position":[[413,3]]},"651":{"position":[[327,3]]},"653":{"position":[[413,3]]}},"keywords":{}}],["subject",{"_index":2196,"title":{},"content":{"184":{"position":[[897,7]]},"375":{"position":[[816,7]]},"591":{"position":[[816,7]]}},"keywords":{}}],["submodul",{"_index":1470,"title":{},"content":{"79":{"position":[[1412,10]]},"115":{"position":[[166,11]]},"209":{"position":[[122,9],[145,9],[453,10],[791,9],[1448,9],[1491,9],[1596,9]]},"230":{"position":[[1429,10]]},"267":{"position":[[3231,10]]},"321":{"position":[[764,10],[888,10]]},"388":{"position":[[122,9],[145,9],[443,10],[723,9],[1380,9],[1423,9],[1528,9]]},"407":{"position":[[3231,10]]},"419":{"position":[[121,10],[785,9],[1673,10]]},"440":{"position":[[187,10]]},"461":{"position":[[1429,10]]},"539":{"position":[[764,10],[888,10]]},"607":{"position":[[266,9]]},"612":{"position":[[450,11]]},"644":{"position":[[3231,10]]},"656":{"position":[[121,10],[785,9],[1673,10]]},"658":{"position":[[122,9],[145,9],[443,10],[723,9],[1380,9],[1423,9],[1528,9]]},"687":{"position":[[187,10]]},"715":{"position":[[266,9]]},"720":{"position":[[450,11]]}},"keywords":{}}],["submodule<...>",{"_index":1534,"title":{},"content":{"85":{"position":[[198,23]]},"254":{"position":[[198,23]]},"485":{"position":[[198,23]]}},"keywords":{}}],["submodule<a>",{"_index":3814,"title":{},"content":{"612":{"position":[[618,18],[765,18],[1226,19]]},"720":{"position":[[618,18],[765,18],[1226,19]]}},"keywords":{}}],["submodule<b>",{"_index":3817,"title":{},"content":{"612":{"position":[[912,19],[1069,19],[1249,19]]},"720":{"position":[[912,19],[1069,19],[1249,19]]}},"keywords":{}}],["submodule<c>",{"_index":3818,"title":{},"content":{"612":{"position":[[935,18],[1092,18]]},"720":{"position":[[935,18],[1092,18]]}},"keywords":{}}],["submodule<cep18>",{"_index":3209,"title":{},"content":{"414":{"position":[[241,23]]},"416":{"position":[[474,23]]},"419":{"position":[[845,23]]},"651":{"position":[[241,23]]},"653":{"position":[[474,23]]},"656":{"position":[[845,23]]}},"keywords":{}}],["submodule<cep78>",{"_index":3370,"title":{},"content":{"440":{"position":[[1007,23]]},"687":{"position":[[1007,23]]}},"keywords":{}}],["submodule<data>",{"_index":2555,"title":{},"content":{"209":{"position":[[899,21]]},"388":{"position":[[831,21]]},"658":{"position":[[831,21]]}},"keywords":{}}],["submodule<erc20>",{"_index":1718,"title":{},"content":{"115":{"position":[[274,22],[2078,23]]},"246":{"position":[[285,22]]},"258":{"position":[[264,22],[2024,23]]},"445":{"position":[[285,22]]},"481":{"position":[[264,22],[2024,23]]},"672":{"position":[[285,22]]}},"keywords":{}}],["submodule<erc721base>",{"_index":2880,"title":{},"content":{"267":{"position":[[3367,28]]},"407":{"position":[[3367,28]]},"644":{"position":[[3367,28]]}},"keywords":{}}],["submodule<erc721metadataextension>",{"_index":2881,"title":{},"content":{"267":{"position":[[3406,41]]},"407":{"position":[[3406,41]]},"644":{"position":[[3406,41]]}},"keywords":{}}],["submodule<exchange>",{"_index":1742,"title":{},"content":{"115":{"position":[[2112,25]]},"258":{"position":[[2058,25]]},"481":{"position":[[2058,25]]}},"keywords":{}}],["submodule<innerdata>",{"_index":2565,"title":{},"content":{"209":{"position":[[1561,27]]},"388":{"position":[[1493,27]]},"658":{"position":[[1493,27]]}},"keywords":{}}],["submodule<ownable>",{"_index":1717,"title":{},"content":{"115":{"position":[[241,25],[2045,25]]},"246":{"position":[[252,25]]},"258":{"position":[[231,25],[1991,25]]},"267":{"position":[[3457,24]]},"407":{"position":[[3457,24]]},"440":{"position":[[1040,25]]},"445":{"position":[[252,25]]},"481":{"position":[[231,25],[1991,25]]},"644":{"position":[[3457,24]]},"672":{"position":[[252,25]]},"687":{"position":[[1040,25]]}},"keywords":{}}],["submodule<pausable>",{"_index":2735,"title":{},"content":{"223":{"position":[[395,25]]},"456":{"position":[[395,25]]},"696":{"position":[[395,25]]}},"keywords":{}}],["submodule<t>",{"_index":1474,"title":{},"content":{"79":{"position":[[1522,18]]},"230":{"position":[[1539,18]]},"461":{"position":[[1539,18]]}},"keywords":{}}],["submodule<token>",{"_index":1531,"title":{},"content":{"84":{"position":[[588,23],[623,23]]},"253":{"position":[[588,23],[623,23]]},"484":{"position":[[588,23],[623,23]]}},"keywords":{}}],["subsequ",{"_index":1559,"title":{},"content":{"86":{"position":[[114,12]]},"255":{"position":[[114,12]]},"477":{"position":[[3873,13]]},"486":{"position":[[114,12]]},"699":{"position":[[3873,13]]}},"keywords":{}}],["substanti",{"_index":1505,"title":{},"content":{"83":{"position":[[187,11]]},"119":{"position":[[146,13]]},"252":{"position":[[187,11]]},"300":{"position":[[146,13]]},"483":{"position":[[187,11]]},"521":{"position":[[146,13]]}},"keywords":{}}],["subtl",{"_index":2768,"title":{},"content":{"247":{"position":[[1578,11]]},"446":{"position":[[1578,11]]},"673":{"position":[[1578,11]]}},"keywords":{}}],["subtleti",{"_index":2374,"title":{},"content":{"197":{"position":[[1511,9]]},"433":{"position":[[1510,9]]},"680":{"position":[[1510,9]]}},"keywords":{}}],["succe",{"_index":3454,"title":{},"content":{"440":{"position":[[5847,8]]},"687":{"position":[[5847,8]]}},"keywords":{}}],["succeed",{"_index":790,"title":{},"content":{"31":{"position":[[2665,10]]}},"keywords":{}}],["success",{"_index":3914,"title":{},"content":{"617":{"position":[[518,10],[1211,7]]},"725":{"position":[[518,10],[1211,7]]}},"keywords":{}}],["successfulli",{"_index":301,"title":{},"content":{"9":{"position":[[1125,12]]},"52":{"position":[[3102,12]]},"120":{"position":[[166,13]]},"127":{"position":[[496,12]]},"278":{"position":[[496,12]]},"301":{"position":[[166,13]]},"395":{"position":[[4963,12],[5630,12],[6089,12],[6609,12]]},"398":{"position":[[6,12]]},"477":{"position":[[2879,12],[3362,12],[3743,12],[3817,12]]},"515":{"position":[[496,12]]},"522":{"position":[[166,13]]},"632":{"position":[[4963,12],[5630,12],[6089,12],[6609,12]]},"635":{"position":[[6,12]]},"699":{"position":[[2879,12],[3362,12],[3743,12],[3817,12]]}},"keywords":{}}],["succinct",{"_index":1734,"title":{},"content":{"115":{"position":[[1541,12]]},"258":{"position":[[1487,12]]},"481":{"position":[[1487,12]]}},"keywords":{}}],["such",{"_index":876,"title":{},"content":{"38":{"position":[[671,4]]},"43":{"position":[[664,4],[1957,4]]},"72":{"position":[[216,4]]},"79":{"position":[[187,5],[1319,4]]},"103":{"position":[[742,4]]},"163":{"position":[[1268,4]]},"201":{"position":[[128,4]]},"205":{"position":[[78,4]]},"230":{"position":[[187,5],[1336,4]]},"236":{"position":[[216,4]]},"295":{"position":[[742,4]]},"352":{"position":[[1290,4]]},"421":{"position":[[128,4]]},"425":{"position":[[78,4]]},"461":{"position":[[187,5],[1336,4]]},"472":{"position":[[216,4]]},"507":{"position":[[742,4]]},"568":{"position":[[1290,4]]},"609":{"position":[[261,4]]},"663":{"position":[[128,4]]},"667":{"position":[[78,4]]},"717":{"position":[[261,4]]}},"keywords":{}}],["sugar",{"_index":2458,"title":{},"content":{"204":{"position":[[1487,5]]},"424":{"position":[[1437,5]]},"666":{"position":[[1437,5]]}},"keywords":{}}],["suit",{"_index":1561,"title":{},"content":{"88":{"position":[[34,4]]},"250":{"position":[[34,4]]},"488":{"position":[[34,4]]}},"keywords":{}}],["sum",{"_index":1876,"title":{},"content":{"129":{"position":[[639,3]]},"164":{"position":[[1019,3]]},"280":{"position":[[640,3]]},"353":{"position":[[1054,3]]},"517":{"position":[[640,3]]},"569":{"position":[[1054,3]]}},"keywords":{}}],["summari",{"_index":2427,"title":{"199":{"position":[[0,8]]},"248":{"position":[[0,8]]},"435":{"position":[[0,8]]},"447":{"position":[[0,8]]},"674":{"position":[[0,8]]},"682":{"position":[[0,8]]}},"content":{},"keywords":{}}],["super",{"_index":814,"title":{},"content":{"32":{"position":[[52,5]]},"42":{"position":[[2064,9]]},"51":{"position":[[1350,9]]},"54":{"position":[[69,5]]},"73":{"position":[[466,9]]},"143":{"position":[[980,9]]},"198":{"position":[[40,9]]},"206":{"position":[[42,9]]},"223":{"position":[[827,9]]},"237":{"position":[[466,9]]},"269":{"position":[[3857,8]]},"328":{"position":[[955,9]]},"409":{"position":[[3857,8]]},"419":{"position":[[6508,9]]},"426":{"position":[[42,9]]},"434":{"position":[[40,9]]},"456":{"position":[[827,9]]},"473":{"position":[[466,9]]},"537":{"position":[[955,9]]},"646":{"position":[[3857,8]]},"656":{"position":[[6508,9]]},"668":{"position":[[42,9]]},"681":{"position":[[40,9]]},"696":{"position":[[827,9]]}},"keywords":{}}],["super._update(from",{"_index":1129,"title":{},"content":{"43":{"position":[[568,19]]}},"keywords":{}}],["super::access_control::rol",{"_index":2183,"title":{},"content":{"184":{"position":[[243,28]]},"375":{"position":[[234,28]]},"591":{"position":[[234,28]]}},"keywords":{}}],["super::errors::error",{"_index":2208,"title":{},"content":{"185":{"position":[[139,21]]},"376":{"position":[[139,21]]},"592":{"position":[[139,21]]}},"keywords":{}}],["super::ev",{"_index":2207,"title":{},"content":{"185":{"position":[[117,17]]},"376":{"position":[[117,17]]},"592":{"position":[[117,17]]}},"keywords":{}}],["super::modulescontracthostref",{"_index":2013,"title":{},"content":{"151":{"position":[[125,30]]},"342":{"position":[[125,30]]},"556":{"position":[[125,30]]}},"keywords":{}}],["super::ownablehostref",{"_index":2904,"title":{},"content":{"268":{"position":[[868,22]]},"408":{"position":[[868,22]]},"645":{"position":[[868,22]]}},"keywords":{}}],["super::publicwallethostref",{"_index":2036,"title":{},"content":{"160":{"position":[[178,27]]},"345":{"position":[[178,27]]},"562":{"position":[[178,27]]}},"keywords":{}}],["super::{crosscontracthostref",{"_index":1961,"title":{},"content":{"143":{"position":[[130,29]]},"328":{"position":[[130,29]]},"537":{"position":[[130,29]]}},"keywords":{}}],["super::{erc20hostref",{"_index":2905,"title":{},"content":{"268":{"position":[[1070,21]]},"408":{"position":[[1070,21]]},"645":{"position":[[1070,21]]}},"keywords":{}}],["super::{error",{"_index":1901,"title":{},"content":{"138":{"position":[[193,14]]},"318":{"position":[[193,14]]},"544":{"position":[[193,14]]}},"keywords":{}}],["super::{partycontracthostref",{"_index":2023,"title":{},"content":{"157":{"position":[[151,29]]},"330":{"position":[[151,29]]},"547":{"position":[[151,29]]}},"keywords":{}}],["suppli",{"_index":2501,"title":{},"content":{"206":{"position":[[593,7],[822,6]]},"269":{"position":[[4503,7],[4732,6]]},"396":{"position":[[628,7]]},"409":{"position":[[4503,7],[4732,6]]},"419":{"position":[[1355,7],[2560,6]]},"426":{"position":[[593,7],[822,6]]},"633":{"position":[[628,7]]},"646":{"position":[[4503,7],[4732,6]]},"656":{"position":[[1355,7],[2560,6]]},"668":{"position":[[593,7],[822,6]]}},"keywords":{}}],["supply.bal",{"_index":2435,"title":{},"content":{"202":{"position":[[195,15]]},"422":{"position":[[195,15]]},"664":{"position":[[195,15]]}},"keywords":{}}],["supply.l28",{"_index":3320,"title":{},"content":{"424":{"position":[[1109,10]]},"666":{"position":[[1109,10]]}},"keywords":{}}],["supply.l33",{"_index":2454,"title":{},"content":{"204":{"position":[[1159,10]]}},"keywords":{}}],["support",{"_index":131,"title":{},"content":{"3":{"position":[[160,7]]},"15":{"position":[[584,9]]},"38":{"position":[[989,7]]},"39":{"position":[[1055,8]]},"40":{"position":[[152,10]]},"81":{"position":[[223,7]]},"90":{"position":[[104,8]]},"232":{"position":[[223,7]]},"267":{"position":[[4412,10]]},"282":{"position":[[104,8]]},"324":{"position":[[647,10],[1019,10]]},"396":{"position":[[511,9]]},"407":{"position":[[4412,10]]},"463":{"position":[[223,7]]},"494":{"position":[[104,8]]},"542":{"position":[[647,10],[1019,10]]},"599":{"position":[[447,8]]},"609":{"position":[[253,7]]},"610":{"position":[[873,7]]},"612":{"position":[[1360,8]]},"633":{"position":[[511,9]]},"644":{"position":[[4412,10]]},"707":{"position":[[447,8]]},"717":{"position":[[253,7]]},"718":{"position":[[873,7]]},"720":{"position":[[1360,8]]}},"keywords":{}}],["sure",{"_index":29,"title":{},"content":{"1":{"position":[[312,4]]},"7":{"position":[[157,4]]},"31":{"position":[[436,4],[2646,4]]},"43":{"position":[[765,4]]},"70":{"position":[[48,4]]},"127":{"position":[[182,4]]},"128":{"position":[[729,4]]},"154":{"position":[[162,4]]},"234":{"position":[[48,4]]},"247":{"position":[[1938,4]]},"261":{"position":[[45,4]]},"270":{"position":[[388,4]]},"278":{"position":[[182,4]]},"279":{"position":[[729,4]]},"339":{"position":[[162,4]]},"379":{"position":[[45,4]]},"385":{"position":[[388,4]]},"396":{"position":[[218,4]]},"401":{"position":[[45,4]]},"410":{"position":[[388,4]]},"441":{"position":[[3287,4]]},"446":{"position":[[1938,4]]},"470":{"position":[[48,4]]},"477":{"position":[[215,4]]},"515":{"position":[[182,4]]},"516":{"position":[[729,4]]},"559":{"position":[[162,4]]},"621":{"position":[[45,4]]},"627":{"position":[[388,4]]},"633":{"position":[[218,4]]},"638":{"position":[[45,4]]},"647":{"position":[[388,4]]},"673":{"position":[[1938,4]]},"688":{"position":[[3287,4]]},"699":{"position":[[215,4]]}},"keywords":{}}],["swap(&mut",{"_index":1746,"title":{},"content":{"115":{"position":[[2692,13]]},"258":{"position":[[2622,13]]},"481":{"position":[[2622,13]]}},"keywords":{}}],["switch",{"_index":1625,"title":{},"content":{"95":{"position":[[183,6]]},"129":{"position":[[106,6]]},"198":{"position":[[3321,6]]},"222":{"position":[[36,6]]},"280":{"position":[[106,6]]},"287":{"position":[[183,6]]},"434":{"position":[[3303,6]]},"455":{"position":[[36,6]]},"499":{"position":[[183,6]]},"517":{"position":[[106,6]]},"681":{"position":[[3321,6]]},"695":{"position":[[36,6]]}},"keywords":{}}],["symbol",{"_index":513,"title":{},"content":{"17":{"position":[[2004,7],[2277,7]]},"115":{"position":[[374,7],[515,7],[2217,7],[2378,7]]},"126":{"position":[[1934,6],[2362,7]]},"202":{"position":[[168,7]]},"203":{"position":[[177,7]]},"204":{"position":[[104,7]]},"206":{"position":[[171,7],[402,7]]},"247":{"position":[[139,7],[280,7]]},"258":{"position":[[364,7],[505,7],[2163,7],[2324,7]]},"268":{"position":[[1214,7]]},"269":{"position":[[345,7],[579,7],[4075,7],[4306,7]]},"277":{"position":[[2102,6],[2530,7]]},"384":{"position":[[358,7],[592,7]]},"395":{"position":[[1884,6],[2022,7]]},"396":{"position":[[611,6]]},"408":{"position":[[1214,7]]},"409":{"position":[[345,7],[579,7],[4075,7],[4306,7]]},"417":{"position":[[256,7]]},"419":{"position":[[1404,7],[2398,6],[6671,7]]},"422":{"position":[[168,7]]},"423":{"position":[[177,7]]},"424":{"position":[[79,7]]},"426":{"position":[[171,7],[402,7]]},"446":{"position":[[139,7],[280,7]]},"481":{"position":[[364,7],[505,7],[2163,7],[2324,7]]},"514":{"position":[[1934,6],[2362,7]]},"626":{"position":[[358,7],[592,7]]},"632":{"position":[[1884,6],[2022,7]]},"633":{"position":[[611,6]]},"645":{"position":[[1214,7]]},"646":{"position":[[345,7],[579,7],[4075,7],[4306,7]]},"654":{"position":[[256,7]]},"656":{"position":[[1404,7],[2398,6],[6671,7]]},"664":{"position":[[168,7]]},"665":{"position":[[177,7]]},"666":{"position":[[79,7]]},"668":{"position":[[171,7],[402,7]]},"673":{"position":[[139,7],[280,7]]}},"keywords":{}}],["symbol(&self",{"_index":1724,"title":{},"content":{"115":{"position":[[840,17]]},"204":{"position":[[388,17]]},"247":{"position":[[382,17]]},"258":{"position":[[810,17]]},"414":{"position":[[407,17]]},"419":{"position":[[2422,17]]},"424":{"position":[[363,17]]},"446":{"position":[[382,17]]},"481":{"position":[[810,17]]},"651":{"position":[[407,17]]},"656":{"position":[[2422,17]]},"666":{"position":[[363,17]]},"673":{"position":[[382,17]]}},"keywords":{}}],["symbol.to_str",{"_index":2498,"title":{},"content":{"206":{"position":[[410,19],[699,20]]},"268":{"position":[[1222,19]]},"269":{"position":[[4314,19],[4609,20]]},"408":{"position":[[1222,19]]},"409":{"position":[[4314,19],[4609,20]]},"426":{"position":[[410,19],[699,20]]},"645":{"position":[[1222,19]]},"646":{"position":[[4314,19],[4609,20]]},"668":{"position":[[410,19],[699,20]]}},"keywords":{}}],["symbol_",{"_index":1116,"title":{},"content":{"43":{"position":[[267,8],[325,8]]}},"keywords":{}}],["symbolnotset",{"_index":2839,"title":{},"content":{"267":{"position":[[1414,12]]},"269":{"position":[[3777,12]]},"383":{"position":[[860,12]]},"384":{"position":[[3741,12]]},"407":{"position":[[1414,12]]},"409":{"position":[[3777,12]]},"625":{"position":[[860,12]]},"626":{"position":[[3741,12]]},"644":{"position":[[1414,12]]},"646":{"position":[[3777,12]]}},"keywords":{}}],["syntact",{"_index":2457,"title":{},"content":{"204":{"position":[[1477,9]]},"424":{"position":[[1427,9]]},"666":{"position":[[1427,9]]}},"keywords":{}}],["syntax",{"_index":894,"title":{},"content":{"39":{"position":[[29,6]]}},"keywords":{}}],["system",{"_index":650,"title":{"437":{"position":[[10,6]]},"684":{"position":[[10,6]]}},"content":{"22":{"position":[[490,8],[565,7],[606,7]]},"76":{"position":[[624,7]]},"79":{"position":[[42,6]]},"173":{"position":[[269,8]]},"227":{"position":[[624,7]]},"230":{"position":[[42,6]]},"359":{"position":[[269,8]]},"416":{"position":[[11,6]]},"440":{"position":[[6557,7]]},"442":{"position":[[48,6]]},"458":{"position":[[624,7]]},"461":{"position":[[42,6]]},"575":{"position":[[269,8]]},"653":{"position":[[11,6]]},"687":{"position":[[6557,7]]},"689":{"position":[[48,6]]}},"keywords":{}}],["systemat",{"_index":138,"title":{},"content":{"3":{"position":[[270,11]]}},"keywords":{}}],["t",{"_index":976,"title":{},"content":{"39":{"position":[[2321,2],[2373,2]]},"42":{"position":[[227,1]]},"78":{"position":[[213,2]]},"117":{"position":[[643,1]]},"229":{"position":[[213,2]]},"267":{"position":[[2249,2],[2558,2],[2632,2],[2844,2],[3052,1]]},"298":{"position":[[643,1]]},"407":{"position":[[2249,2],[2558,2],[2632,2],[2844,2],[3052,1]]},"460":{"position":[[213,2]]},"519":{"position":[[643,1]]},"644":{"position":[[2249,2],[2558,2],[2632,2],[2844,2],[3052,1]]}},"keywords":{}}],["t>",{"_index":2100,"title":{},"content":{"163":{"position":[[1654,6]]},"352":{"position":[[1676,6]]},"568":{"position":[[1676,6]]}},"keywords":{}}],["t).fn",{"_index":2869,"title":{},"content":{"267":{"position":[[2904,5]]},"407":{"position":[[2904,5]]},"644":{"position":[[2904,5]]}},"keywords":{}}],["t).set_dict_valu",{"_index":2855,"title":{},"content":{"267":{"position":[[2334,19]]},"407":{"position":[[2334,19]]},"644":{"position":[[2334,19]]}},"keywords":{}}],["t.function",{"_index":2875,"title":{},"content":{"267":{"position":[[3148,11]]},"407":{"position":[[3148,11]]},"644":{"position":[[3148,11]]}},"keywords":{}}],["tab",{"_index":3195,"title":{},"content":{"396":{"position":[[773,4],[1062,4]]},"633":{"position":[[773,4],[1062,4]]}},"keywords":{}}],["tackl",{"_index":2079,"title":{},"content":{"162":{"position":[[2414,6]]},"351":{"position":[[2436,6]]},"567":{"position":[[2436,6]]}},"keywords":{}}],["take",{"_index":60,"title":{},"content":{"1":{"position":[[798,4]]},"22":{"position":[[156,5]]},"31":{"position":[[154,4]]},"32":{"position":[[69,5]]},"38":{"position":[[144,5],[1105,4]]},"40":{"position":[[295,5]]},"44":{"position":[[110,4]]},"52":{"position":[[2163,4]]},"53":{"position":[[60,4]]},"70":{"position":[[246,4]]},"90":{"position":[[119,4]]},"94":{"position":[[255,5],[382,5]]},"112":{"position":[[8,4]]},"115":{"position":[[1823,4]]},"117":{"position":[[293,6]]},"122":{"position":[[29,4]]},"126":{"position":[[335,4]]},"127":{"position":[[701,4]]},"131":{"position":[[12,4]]},"136":{"position":[[163,4]]},"141":{"position":[[1055,4]]},"146":{"position":[[842,4]]},"147":{"position":[[396,4]]},"149":{"position":[[10,4]]},"155":{"position":[[27,4]]},"163":{"position":[[1443,4]]},"164":{"position":[[330,4],[416,5]]},"169":{"position":[[3,4]]},"198":{"position":[[1312,4],[2059,4]]},"234":{"position":[[246,4]]},"246":{"position":[[375,4]]},"258":{"position":[[1769,4]]},"277":{"position":[[335,4]]},"278":{"position":[[701,4]]},"282":{"position":[[119,4]]},"286":{"position":[[255,5],[382,5]]},"298":{"position":[[293,6]]},"303":{"position":[[29,4]]},"307":{"position":[[8,4]]},"311":{"position":[[12,4]]},"316":{"position":[[163,4]]},"326":{"position":[[1055,4]]},"334":{"position":[[846,4]]},"335":{"position":[[400,4]]},"337":{"position":[[10,4]]},"340":{"position":[[27,4]]},"349":{"position":[[3,4]]},"352":{"position":[[1465,4]]},"353":{"position":[[365,4],[451,5]]},"434":{"position":[[1302,4],[2049,4]]},"445":{"position":[[375,4]]},"470":{"position":[[246,4]]},"481":{"position":[[1769,4]]},"494":{"position":[[119,4]]},"498":{"position":[[255,5],[382,5]]},"512":{"position":[[8,4]]},"514":{"position":[[335,4]]},"515":{"position":[[701,4]]},"519":{"position":[[293,6]]},"524":{"position":[[29,4]]},"528":{"position":[[12,4]]},"533":{"position":[[163,4]]},"535":{"position":[[1055,4]]},"551":{"position":[[846,4]]},"552":{"position":[[400,4]]},"554":{"position":[[10,4]]},"560":{"position":[[27,4]]},"565":{"position":[[3,4]]},"568":{"position":[[1465,4]]},"569":{"position":[[365,4],[451,5]]},"611":{"position":[[762,5]]},"612":{"position":[[327,4]]},"616":{"position":[[1354,4]]},"672":{"position":[[375,4]]},"681":{"position":[[1312,4],[2059,4]]},"719":{"position":[[762,5]]},"720":{"position":[[327,4]]},"724":{"position":[[1354,4]]}},"keywords":{}}],["takeaway",{"_index":1498,"title":{},"content":{"81":{"position":[[92,9]]},"232":{"position":[[92,9]]},"463":{"position":[[92,9]]}},"keywords":{}}],["taken",{"_index":128,"title":{},"content":{"3":{"position":[[107,6]]},"7":{"position":[[216,5]]},"52":{"position":[[3229,5],[4875,5]]},"203":{"position":[[464,5]]},"321":{"position":[[93,5]]},"423":{"position":[[464,5]]},"539":{"position":[[93,5]]},"665":{"position":[[464,5]]}},"keywords":{}}],["talli",{"_index":3141,"title":{},"content":{"395":{"position":[[1487,5]]},"416":{"position":[[1079,8],[3282,8],[3303,11],[3315,8],[3355,5],[3534,8],[3670,8]]},"419":{"position":[[488,5],[5113,8],[5249,8]]},"632":{"position":[[1487,5]]},"653":{"position":[[1079,8],[3282,8],[3303,11],[3315,8],[3355,5],[3534,8],[3670,8]]},"656":{"position":[[488,5],[5113,8],[5249,8]]}},"keywords":{}}],["tally(&mut",{"_index":3249,"title":{},"content":{"416":{"position":[[3497,14]]},"419":{"position":[[5076,14]]},"653":{"position":[[3497,14]]},"656":{"position":[[5076,14]]}},"keywords":{}}],["target",{"_index":887,"title":{"135":{"position":[[0,8]]},"315":{"position":[[0,8]]},"532":{"position":[[0,8]]}},"content":{"38":{"position":[[926,6]]},"65":{"position":[[119,6]]},"68":{"position":[[257,6]]},"145":{"position":[[159,8]]},"173":{"position":[[382,7],[397,6],[465,6]]},"240":{"position":[[119,6]]},"243":{"position":[[257,6]]},"333":{"position":[[159,8]]},"359":{"position":[[382,7],[397,6],[465,6]]},"465":{"position":[[119,6]]},"468":{"position":[[257,6]]},"550":{"position":[[159,8]]},"575":{"position":[[382,7],[397,6],[465,6]]}},"keywords":{}}],["target/debug/our_token_livenet",{"_index":3172,"title":{},"content":{"395":{"position":[[4527,32]]},"632":{"position":[[4527,32]]}},"keywords":{}}],["target/wasm32",{"_index":1333,"title":{},"content":{"65":{"position":[[446,13],[692,13]]},"68":{"position":[[322,13]]},"240":{"position":[[446,13],[692,13]]},"243":{"position":[[322,13]]},"465":{"position":[[446,13],[692,13]]},"468":{"position":[[322,13]]}},"keywords":{}}],["target_key",{"_index":3462,"title":{},"content":{"440":{"position":[[6352,11]]},"687":{"position":[[6352,11]]}},"keywords":{}}],["task",{"_index":3104,"title":{},"content":{"393":{"position":[[42,5]]},"630":{"position":[[42,5]]}},"keywords":{}}],["team",{"_index":162,"title":{},"content":{"3":{"position":[[651,5]]},"12":{"position":[[276,5]]},"20":{"position":[[176,4]]}},"keywords":{}}],["technic",{"_index":938,"title":{},"content":{"39":{"position":[[1033,12]]},"52":{"position":[[1810,11]]},"270":{"position":[[202,9]]},"385":{"position":[[202,9]]},"410":{"position":[[202,9]]},"627":{"position":[[202,9]]},"647":{"position":[[202,9]]}},"keywords":{}}],["techniqu",{"_index":3823,"title":{},"content":{"612":{"position":[[1485,9]]},"720":{"position":[[1485,9]]}},"keywords":{}}],["technolog",{"_index":431,"title":{},"content":{"16":{"position":[[59,10]]}},"keywords":{}}],["templat",{"_index":1758,"title":{},"content":{"117":{"position":[[493,8],[561,9],[690,8],[799,9],[869,8]]},"264":{"position":[[331,9],[404,8]]},"298":{"position":[[493,8],[561,9],[690,8],[799,9],[869,8]]},"382":{"position":[[144,9],[217,8]]},"404":{"position":[[331,9],[404,8]]},"414":{"position":[[94,9],[136,8]]},"439":{"position":[[126,9],[174,8]]},"440":{"position":[[89,9],[3984,8]]},"519":{"position":[[493,8],[561,9],[690,8],[799,9],[869,8]]},"624":{"position":[[144,9],[217,8]]},"641":{"position":[[331,9],[404,8]]},"651":{"position":[[94,9],[136,8]]},"686":{"position":[[126,9],[174,8]]},"687":{"position":[[89,9],[3984,8]]}},"keywords":{}}],["term",{"_index":1160,"title":{},"content":{"43":{"position":[[1903,5]]},"198":{"position":[[2503,4]]},"434":{"position":[[2493,4]]},"681":{"position":[[2503,4]]}},"keywords":{}}],["test",{"_index":50,"title":{"67":{"position":[[12,5]]},"95":{"position":[[0,4]]},"119":{"position":[[0,8]]},"138":{"position":[[0,7]]},"143":{"position":[[0,8]]},"148":{"position":[[0,6]]},"151":{"position":[[0,8]]},"157":{"position":[[0,7]]},"160":{"position":[[0,8]]},"167":{"position":[[0,7]]},"179":{"position":[[0,8]]},"198":{"position":[[0,5]]},"206":{"position":[[0,5]]},"242":{"position":[[12,5]]},"268":{"position":[[12,6]]},"287":{"position":[[0,4]]},"300":{"position":[[0,8]]},"318":{"position":[[0,7]]},"328":{"position":[[0,8]]},"330":{"position":[[0,7]]},"336":{"position":[[0,6]]},"342":{"position":[[0,8]]},"345":{"position":[[0,8]]},"347":{"position":[[0,7]]},"370":{"position":[[0,8]]},"408":{"position":[[12,6]]},"417":{"position":[[0,8]]},"426":{"position":[[0,5]]},"434":{"position":[[0,5]]},"467":{"position":[[12,5]]},"499":{"position":[[0,4]]},"521":{"position":[[0,8]]},"537":{"position":[[0,8]]},"544":{"position":[[0,7]]},"547":{"position":[[0,7]]},"553":{"position":[[0,6]]},"556":{"position":[[0,8]]},"562":{"position":[[0,8]]},"563":{"position":[[0,7]]},"586":{"position":[[0,8]]},"645":{"position":[[12,6]]},"654":{"position":[[0,8]]},"668":{"position":[[0,5]]},"681":{"position":[[0,5]]}},"content":{"1":{"position":[[646,5],[1070,6]]},"20":{"position":[[405,6]]},"22":{"position":[[660,7]]},"31":{"position":[[365,5],[2824,5],[3151,7],[3417,7]]},"42":{"position":[[1569,5],[1690,4],[1718,4],[1855,4],[1891,5],[2145,7],[2397,7],[2566,4],[2573,4],[2609,4],[2648,4]]},"43":{"position":[[825,4],[855,5],[872,4],[990,4]]},"51":{"position":[[1338,5],[1360,7],[1462,7]]},"67":{"position":[[11,5],[75,5],[170,4]]},"68":{"position":[[66,5],[545,4]]},"73":{"position":[[455,4],[530,7]]},"88":{"position":[[420,6]]},"95":{"position":[[0,4],[31,4],[162,5],[373,4],[463,4],[507,4]]},"96":{"position":[[60,5],[122,4]]},"98":{"position":[[580,4]]},"99":{"position":[[288,4]]},"100":{"position":[[382,4]]},"101":{"position":[[236,4]]},"106":{"position":[[86,4]]},"107":{"position":[[183,4],[498,5]]},"111":{"position":[[174,6],[308,4]]},"117":{"position":[[1133,4]]},"119":{"position":[[92,4],[111,5],[244,5],[345,4],[510,5],[726,7],[833,6],[876,4],[944,4],[981,4],[1006,5],[1074,4],[1153,4]]},"120":{"position":[[89,6]]},"124":{"position":[[37,7]]},"126":{"position":[[232,6],[841,4],[889,4],[1136,5],[1250,4],[3447,5],[3647,4]]},"131":{"position":[[199,4],[314,4],[413,4],[610,7],[633,4]]},"132":{"position":[[123,5]]},"134":{"position":[[213,4]]},"136":{"position":[[56,4]]},"138":{"position":[[20,7],[46,4],[181,5],[302,7]]},"139":{"position":[[30,4]]},"141":{"position":[[36,7],[1404,6]]},"142":{"position":[[133,4]]},"143":{"position":[[21,4],[118,5],[248,7],[624,4],[708,4],[968,5],[1046,7]]},"148":{"position":[[28,5],[108,7],[166,4],[454,5],[958,5]]},"151":{"position":[[40,4],[113,5],[192,7]]},"157":{"position":[[64,4],[250,7],[804,7]]},"160":{"position":[[14,4],[166,5],[273,7]]},"164":{"position":[[1164,6]]},"168":{"position":[[271,5],[348,5],[488,7],[1148,5],[1555,6]]},"174":{"position":[[61,4]]},"175":{"position":[[258,5],[306,4],[326,5],[380,5],[441,4]]},"176":{"position":[[42,7]]},"178":{"position":[[1034,5],[1114,7],[1172,4],[1441,7]]},"179":{"position":[[11,6],[60,4],[102,5]]},"193":{"position":[[195,4],[234,4]]},"196":{"position":[[1545,7]]},"198":{"position":[[28,5],[331,7],[548,7],[880,7],[1148,4],[1306,5],[1652,4],[2190,5],[2313,5]]},"199":{"position":[[40,4]]},"206":{"position":[[30,5],[520,7],[1076,7],[1714,7],[2042,7],[3315,7]]},"223":{"position":[[816,4],[873,7],[1206,5]]},"237":{"position":[[455,4],[530,7]]},"242":{"position":[[11,5],[75,5],[171,4]]},"243":{"position":[[66,5],[545,4]]},"248":{"position":[[126,4]]},"250":{"position":[[420,6]]},"265":{"position":[[261,4],[601,4],[720,4],[823,4]]},"268":{"position":[[69,5],[169,6],[2032,7],[2355,7],[2687,7]]},"269":{"position":[[3845,5],[4430,7],[4986,7],[5624,7],[5961,8]]},"273":{"position":[[86,4]]},"274":{"position":[[183,4],[498,5]]},"277":{"position":[[232,6],[841,4],[889,4],[1304,5],[1418,4],[3615,5],[3815,4]]},"287":{"position":[[0,4],[31,4],[162,5],[373,4],[463,4],[507,4]]},"288":{"position":[[60,5],[122,4]]},"290":{"position":[[580,4]]},"291":{"position":[[288,4]]},"292":{"position":[[382,4]]},"293":{"position":[[236,4]]},"298":{"position":[[1133,4]]},"300":{"position":[[92,4],[111,5],[244,5],[345,4],[510,5],[726,7],[833,6],[876,4],[944,4],[981,4],[1006,5],[1074,4],[1153,4]]},"301":{"position":[[89,6]]},"306":{"position":[[174,6],[308,4]]},"309":{"position":[[37,7]]},"311":{"position":[[199,4],[366,4],[465,4],[662,7],[685,4]]},"312":{"position":[[123,5]]},"314":{"position":[[213,4]]},"316":{"position":[[56,4]]},"318":{"position":[[20,7],[46,4],[181,5],[294,7]]},"319":{"position":[[30,4]]},"326":{"position":[[36,7],[1404,6]]},"327":{"position":[[133,4]]},"328":{"position":[[21,4],[118,5],[248,7],[599,4],[683,4],[943,5],[1021,7]]},"330":{"position":[[64,4],[241,7],[780,7]]},"336":{"position":[[28,5],[108,7],[166,4],[454,5],[958,5]]},"342":{"position":[[40,4],[113,5],[192,7]]},"345":{"position":[[14,4],[166,5],[273,7]]},"346":{"position":[[45,6]]},"348":{"position":[[271,5],[348,5],[488,7],[1148,5],[1555,6]]},"353":{"position":[[1199,6]]},"360":{"position":[[61,4]]},"361":{"position":[[258,5],[306,4],[326,5],[380,5],[441,4]]},"362":{"position":[[42,7]]},"369":{"position":[[1034,5],[1114,7],[1172,4],[1441,7]]},"370":{"position":[[11,6],[60,4],[102,5]]},"384":{"position":[[3809,5],[3843,5]]},"393":{"position":[[228,8],[422,7]]},"395":{"position":[[2922,4],[3272,4],[3372,4],[4037,4]]},"405":{"position":[[261,4],[601,4],[720,4],[823,4]]},"408":{"position":[[69,5],[169,6],[2032,7],[2355,7],[2687,7]]},"409":{"position":[[3845,5],[4430,7],[4986,7],[5624,7],[5961,8]]},"414":{"position":[[632,5],[655,5]]},"416":{"position":[[2511,4]]},"417":{"position":[[43,5],[58,5],[129,7],[1639,4],[1675,4],[1691,4]]},"419":{"position":[[6496,5],[6544,7]]},"426":{"position":[[30,5],[520,7],[1071,7],[1704,7],[2032,7],[3290,7]]},"429":{"position":[[195,4],[234,4]]},"434":{"position":[[28,5],[331,7],[543,7],[870,7],[1138,4],[1296,5],[1642,4],[2180,5],[2303,5]]},"435":{"position":[[40,4]]},"440":{"position":[[4571,4],[4594,4],[4935,7],[5814,4]]},"441":{"position":[[4471,5],[4760,7]]},"447":{"position":[[126,4]]},"456":{"position":[[816,4],[873,7],[1206,5]]},"467":{"position":[[11,5],[75,5],[171,4]]},"468":{"position":[[66,5],[545,4]]},"473":{"position":[[455,4],[530,7]]},"477":{"position":[[635,4],[1240,4]]},"488":{"position":[[420,6]]},"490":{"position":[[86,4]]},"491":{"position":[[183,4],[498,5]]},"499":{"position":[[0,4],[31,4],[162,5],[373,4],[463,4],[507,4]]},"500":{"position":[[60,5],[122,4]]},"502":{"position":[[580,4]]},"503":{"position":[[288,4]]},"504":{"position":[[382,4]]},"505":{"position":[[236,4]]},"511":{"position":[[174,6],[308,4]]},"514":{"position":[[232,6],[841,4],[889,4],[1136,5],[1250,4],[3447,5],[3647,4]]},"519":{"position":[[1133,4]]},"521":{"position":[[92,4],[111,5],[244,5],[345,4],[510,5],[726,7],[833,6],[876,4],[944,4],[981,4],[1006,5],[1074,4],[1153,4]]},"522":{"position":[[89,6]]},"526":{"position":[[37,7]]},"528":{"position":[[199,4],[366,4],[465,4],[662,7],[685,4]]},"529":{"position":[[123,5]]},"531":{"position":[[213,4]]},"533":{"position":[[56,4]]},"535":{"position":[[36,7],[1404,6]]},"536":{"position":[[133,4]]},"537":{"position":[[21,4],[118,5],[248,7],[599,4],[683,4],[943,5],[1021,7]]},"544":{"position":[[20,7],[46,4],[181,5],[294,7]]},"545":{"position":[[30,4]]},"547":{"position":[[64,4],[250,7],[804,7]]},"553":{"position":[[28,5],[108,7],[166,4],[454,5],[958,5]]},"556":{"position":[[40,4],[113,5],[192,7]]},"562":{"position":[[14,4],[166,5],[273,7]]},"564":{"position":[[271,5],[348,5],[488,7],[1148,5],[1555,6]]},"569":{"position":[[1199,6]]},"576":{"position":[[61,4]]},"577":{"position":[[258,5],[306,4],[326,5],[380,5],[441,4]]},"578":{"position":[[42,7]]},"585":{"position":[[1034,5],[1114,7],[1172,4],[1441,7]]},"586":{"position":[[11,6],[60,4],[102,5]]},"626":{"position":[[3809,5],[3843,5]]},"630":{"position":[[228,8],[422,7]]},"632":{"position":[[2922,4],[3272,4],[3372,4],[4037,4]]},"642":{"position":[[261,4],[601,4],[720,4],[823,4]]},"645":{"position":[[69,5],[169,6],[2032,7],[2355,7],[2687,7]]},"646":{"position":[[3845,5],[4430,7],[4986,7],[5624,7],[5961,8]]},"651":{"position":[[632,5],[655,5]]},"653":{"position":[[2511,4]]},"654":{"position":[[43,5],[58,5],[129,7],[1639,4],[1675,4],[1691,4]]},"656":{"position":[[6496,5],[6544,7]]},"668":{"position":[[30,5],[520,7],[1076,7],[1714,7],[2042,7],[3315,7]]},"674":{"position":[[126,4]]},"676":{"position":[[195,4],[234,4]]},"681":{"position":[[28,5],[331,7],[548,7],[880,7],[1148,4],[1306,5],[1652,4],[2190,5],[2313,5]]},"682":{"position":[[40,4]]},"687":{"position":[[4571,4],[4594,4],[4935,7],[5814,4]]},"688":{"position":[[4471,5],[4760,7]]},"696":{"position":[[816,4],[873,7],[1206,5]]},"699":{"position":[[635,4],[1240,4]]}},"keywords":{}}],["test(&self",{"_index":3791,"title":{},"content":{"610":{"position":[[220,15]]},"718":{"position":[[220,15]]}},"keywords":{}}],["test.l16",{"_index":2405,"title":{},"content":{"198":{"position":[[2229,8]]},"434":{"position":[[2219,8]]},"681":{"position":[[2229,8]]}},"keywords":{}}],["test.r",{"_index":1100,"title":{},"content":{"42":{"position":[[2738,7]]}},"keywords":{}}],["test_array_remove(&mut",{"_index":3844,"title":{},"content":{"613":{"position":[[948,26]]},"721":{"position":[[948,26]]}},"keywords":{}}],["test_cross_cal",{"_index":1965,"title":{},"content":{"143":{"position":[[259,18]]},"328":{"position":[[259,18]]},"537":{"position":[[259,18]]}},"keywords":{}}],["test_env",{"_index":1398,"title":{},"content":{"73":{"position":[[575,8]]},"138":{"position":[[338,8]]},"143":{"position":[[284,8],[1074,8]]},"151":{"position":[[224,8]]},"157":{"position":[[280,9]]},"160":{"position":[[305,8]]},"168":{"position":[[511,9]]},"223":{"position":[[919,8]]},"237":{"position":[[575,8]]},"318":{"position":[[330,8]]},"328":{"position":[[284,8],[1049,8]]},"330":{"position":[[271,9]]},"342":{"position":[[224,8]]},"345":{"position":[[305,8]]},"348":{"position":[[511,9]]},"456":{"position":[[919,8]]},"473":{"position":[[575,8]]},"537":{"position":[[284,8],[1049,8]]},"544":{"position":[[330,8]]},"547":{"position":[[280,9]]},"556":{"position":[[224,8]]},"562":{"position":[[305,8]]},"564":{"position":[[511,9]]},"696":{"position":[[919,8]]}},"keywords":{}}],["test_env.emitted(&party_contract",{"_index":3062,"title":{},"content":{"330":{"position":[[579,37]]}},"keywords":{}}],["test_env.emitted(party_contract.address",{"_index":2032,"title":{},"content":{"157":{"position":[[593,42]]},"547":{"position":[[593,42]]}},"keywords":{}}],["test_env.emitted_ev",{"_index":2028,"title":{},"content":{"157":{"position":[[392,23]]},"330":{"position":[[383,23]]},"547":{"position":[[392,23]]}},"keywords":{}}],["test_env.get_account(0",{"_index":1906,"title":{},"content":{"138":{"position":[[379,24]]},"157":{"position":[[470,24]]},"318":{"position":[[371,24]]},"330":{"position":[[456,24]]},"544":{"position":[[371,24]]},"547":{"position":[[470,24]]}},"keywords":{}}],["test_env.get_account(1",{"_index":1908,"title":{},"content":{"138":{"position":[[423,24]]},"318":{"position":[[415,24]]},"544":{"position":[[415,24]]}},"keywords":{}}],["test_env.set_caller(not_an_own",{"_index":1913,"title":{},"content":{"138":{"position":[[644,34]]},"318":{"position":[[636,34]]},"544":{"position":[[636,34]]}},"keywords":{}}],["test_env.set_caller(own",{"_index":1909,"title":{},"content":{"138":{"position":[[448,27]]},"318":{"position":[[440,27]]},"544":{"position":[[440,27]]}},"keywords":{}}],["test_env.set_caller(test_env.get_account(0",{"_index":2118,"title":{},"content":{"168":{"position":[[549,45]]},"348":{"position":[[549,45]]},"564":{"position":[[549,45]]}},"keywords":{}}],["test_env.set_caller(test_env.get_account(1",{"_index":2123,"title":{},"content":{"168":{"position":[[807,45]]},"348":{"position":[[807,45]]},"564":{"position":[[807,45]]}},"keywords":{}}],["test_env::advance_block_time_by(blocktim",{"_index":2911,"title":{},"content":{"268":{"position":[[1553,42]]},"408":{"position":[[1553,42]]},"645":{"position":[[1553,42]]}},"keywords":{}}],["test_env::assert_except",{"_index":2921,"title":{},"content":{"268":{"position":[[2060,28]]},"408":{"position":[[2060,28]]},"645":{"position":[[2060,28]]}},"keywords":{}}],["test_env::gas_report",{"_index":2917,"title":{},"content":{"268":{"position":[[1827,22]]},"408":{"position":[[1827,22]]},"645":{"position":[[1827,22]]}},"keywords":{}}],["test_env::last_call_contract_gas_cost",{"_index":2914,"title":{},"content":{"268":{"position":[[1710,40]]},"408":{"position":[[1710,40]]},"645":{"position":[[1710,40]]}},"keywords":{}}],["test_env::last_call_contract_gas_us",{"_index":2915,"title":{},"content":{"268":{"position":[[1751,40]]},"408":{"position":[[1751,40]]},"645":{"position":[[1751,40]]}},"keywords":{}}],["test_env::set_cal",{"_index":1626,"title":{},"content":{"95":{"position":[[231,24]]},"287":{"position":[[231,24]]},"499":{"position":[[231,24]]}},"keywords":{}}],["test_env::set_caller(account",{"_index":1088,"title":{},"content":{"42":{"position":[[2229,32]]}},"keywords":{}}],["test_env::total_gas_used(address",{"_index":2916,"title":{},"content":{"268":{"position":[[1792,34]]},"408":{"position":[[1792,34]]},"645":{"position":[[1792,34]]}},"keywords":{}}],["test_ext",{"_index":1978,"title":{},"content":{"143":{"position":[[1057,10]]},"328":{"position":[[1032,10]]},"537":{"position":[[1032,10]]}},"keywords":{}}],["test_modul",{"_index":2014,"title":{},"content":{"151":{"position":[[203,14]]},"160":{"position":[[284,14]]},"342":{"position":[[203,14]]},"345":{"position":[[284,14]]},"556":{"position":[[203,14]]},"562":{"position":[[284,14]]}},"keywords":{}}],["test_owner_error",{"_index":1905,"title":{},"content":{"138":{"position":[[313,18]]},"318":{"position":[[305,18]]},"544":{"position":[[305,18]]}},"keywords":{}}],["test_parti",{"_index":2025,"title":{},"content":{"157":{"position":[[261,12]]},"330":{"position":[[252,12]]},"547":{"position":[[261,12]]}},"keywords":{}}],["test_require(&mut",{"_index":3801,"title":{},"content":{"611":{"position":[[228,21]]},"719":{"position":[[228,21]]}},"keywords":{}}],["test_square_root(&self",{"_index":3833,"title":{},"content":{"613":{"position":[[386,27]]},"721":{"position":[[386,27]]}},"keywords":{}}],["test_two_flipp",{"_index":2157,"title":{},"content":{"178":{"position":[[1452,19]]},"369":{"position":[[1452,19]]},"585":{"position":[[1452,19]]}},"keywords":{}}],["testarray",{"_index":3843,"title":{},"content":{"613":{"position":[[861,9],[929,9],[1609,9]]},"721":{"position":[[861,9],[929,9],[1609,9]]}},"keywords":{}}],["testing_contract",{"_index":2120,"title":{},"content":{"168":{"position":[[685,16]]},"348":{"position":[[685,16]]},"564":{"position":[[685,16]]}},"keywords":{}}],["testing_contract.created_bi",{"_index":2122,"title":{},"content":{"168":{"position":[[776,30]]},"348":{"position":[[776,30]]},"564":{"position":[[776,30]]}},"keywords":{}}],["testing_contract2",{"_index":2125,"title":{},"content":{"168":{"position":[[944,17]]},"348":{"position":[[944,17]]},"564":{"position":[[944,17]]}},"keywords":{}}],["testing_contract2.created_bi",{"_index":2127,"title":{},"content":{"168":{"position":[[1037,31]]},"348":{"position":[[1037,31]]},"564":{"position":[[1037,31]]}},"keywords":{}}],["testingcontracthostref::deploy(&test_env",{"_index":2121,"title":{},"content":{"168":{"position":[[704,45],[964,45]]},"348":{"position":[[704,45],[964,45]]},"564":{"position":[[704,45],[964,45]]}},"keywords":{}}],["testingcontractinitarg",{"_index":2117,"title":{},"content":{"168":{"position":[[411,25],[611,23],[869,23]]},"348":{"position":[[411,25],[611,23],[869,23]]},"564":{"position":[[411,25],[611,23],[869,23]]}},"keywords":{}}],["testmath",{"_index":3832,"title":{},"content":{"613":{"position":[[337,9],[368,8],[1547,8]]},"721":{"position":[[337,9],[368,8],[1547,8]]}},"keywords":{}}],["testnet",{"_index":365,"title":{},"content":{"11":{"position":[[26,7]]},"43":{"position":[[696,7],[905,7]]},"52":{"position":[[391,8]]},"95":{"position":[[83,7]]},"277":{"position":[[1223,7]]},"287":{"position":[[83,7]]},"394":{"position":[[182,8],[227,7]]},"396":{"position":[[192,8],[232,7]]},"499":{"position":[[83,7]]},"631":{"position":[[182,8],[227,7]]},"633":{"position":[[192,8],[232,7]]}},"keywords":{}}],["testnet,mint",{"_index":1154,"title":{},"content":{"43":{"position":[[1723,12]]}},"keywords":{}}],["text",{"_index":3676,"title":{},"content":{"600":{"position":[[101,5]]},"602":{"position":[[1012,5],[1315,5],[1354,5],[1430,5],[1506,5]]},"616":{"position":[[212,5]]},"708":{"position":[[101,5]]},"710":{"position":[[1012,5],[1315,5],[1354,5],[1430,5],[1506,5]]},"724":{"position":[[212,5]]}},"keywords":{}}],["th",{"_index":2140,"title":{},"content":{"168":{"position":[[1926,2],[2016,2]]},"348":{"position":[[1926,2],[2016,2]]},"564":{"position":[[1926,2],[2016,2]]}},"keywords":{}}],["thank",{"_index":723,"title":{},"content":{"31":{"position":[[376,6]]},"104":{"position":[[113,6]]},"107":{"position":[[390,6]]},"274":{"position":[[390,6]]},"296":{"position":[[113,6]]},"478":{"position":[[333,6]]},"491":{"position":[[390,6]]},"508":{"position":[[113,6]]},"700":{"position":[[333,6]]}},"keywords":{}}],["thankfulli",{"_index":1585,"title":{},"content":{"91":{"position":[[837,10]]},"163":{"position":[[1367,10]]},"283":{"position":[[837,10]]},"352":{"position":[[1389,10]]},"495":{"position":[[837,10]]},"568":{"position":[[1389,10]]}},"keywords":{}}],["that'",{"_index":374,"title":{},"content":{"11":{"position":[[228,6]]},"51":{"position":[[1732,6]]},"146":{"position":[[362,6]]},"334":{"position":[[362,6]]},"416":{"position":[[1088,6]]},"551":{"position":[[362,6]]},"653":{"position":[[1088,6]]}},"keywords":{}}],["thatlend",{"_index":1533,"title":{},"content":{"84":{"position":[[797,11]]},"253":{"position":[[797,11]]},"484":{"position":[[797,11]]}},"keywords":{}}],["thebackend",{"_index":3117,"title":{},"content":{"395":{"position":[[39,11]]},"632":{"position":[[39,11]]}},"keywords":{}}],["thecargo.toml",{"_index":1842,"title":{},"content":{"126":{"position":[[3496,13]]},"277":{"position":[[3664,13]]},"514":{"position":[[3496,13]]}},"keywords":{}}],["them."",{"_index":619,"title":{},"content":{"20":{"position":[[1085,11]]}},"keywords":{}}],["themselv",{"_index":2151,"title":{},"content":{"173":{"position":[[325,11]]},"267":{"position":[[20,10]]},"359":{"position":[[325,11]]},"407":{"position":[[20,10]]},"575":{"position":[[325,11]]},"644":{"position":[[20,10]]}},"keywords":{}}],["thenext",{"_index":1994,"title":{},"content":{"146":{"position":[[857,7]]},"334":{"position":[[861,7]]},"551":{"position":[[861,7]]}},"keywords":{}}],["theoffici",{"_index":3106,"title":{},"content":{"393":{"position":[[115,11]]},"630":{"position":[[115,11]]}},"keywords":{}}],["theoret",{"_index":2428,"title":{},"content":{"199":{"position":[[77,13]]},"435":{"position":[[77,13]]},"682":{"position":[[77,13]]}},"keywords":{}}],["thestorag",{"_index":1549,"title":{},"content":{"85":{"position":[[747,11]]},"254":{"position":[[747,11]]},"485":{"position":[[747,11]]}},"keywords":{}}],["thetransfer_ownership",{"_index":2298,"title":{},"content":{"189":{"position":[[514,23]]},"366":{"position":[[514,23]]},"582":{"position":[[514,23]]}},"keywords":{}}],["thing",{"_index":43,"title":{},"content":{"1":{"position":[[541,7]]},"31":{"position":[[2857,7]]},"38":{"position":[[344,7]]},"42":{"position":[[256,5]]},"52":{"position":[[454,6]]},"104":{"position":[[6,5]]},"128":{"position":[[320,5]]},"141":{"position":[[848,5]]},"196":{"position":[[569,7]]},"222":{"position":[[433,7]]},"279":{"position":[[320,5]]},"296":{"position":[[6,5]]},"321":{"position":[[81,5]]},"326":{"position":[[848,5]]},"396":{"position":[[10,5]]},"414":{"position":[[537,5]]},"416":{"position":[[3094,5]]},"432":{"position":[[506,7]]},"455":{"position":[[433,7]]},"508":{"position":[[6,5]]},"516":{"position":[[320,5]]},"535":{"position":[[848,5]]},"539":{"position":[[81,5]]},"633":{"position":[[10,5]]},"651":{"position":[[537,5]]},"653":{"position":[[3094,5]]},"679":{"position":[[506,7]]},"695":{"position":[[433,7]]}},"keywords":{}}],["think",{"_index":377,"title":{},"content":{"12":{"position":[[2,5]]},"594":{"position":[[514,8]]},"702":{"position":[[514,8]]}},"keywords":{}}],["third",{"_index":1013,"title":{},"content":{"40":{"position":[[44,5]]},"117":{"position":[[674,5]]},"298":{"position":[[674,5]]},"519":{"position":[[674,5]]}},"keywords":{}}],["those",{"_index":872,"title":{},"content":{"38":{"position":[[510,5]]},"98":{"position":[[104,5]]},"110":{"position":[[346,5]]},"126":{"position":[[239,5]]},"127":{"position":[[568,5]]},"134":{"position":[[110,5]]},"136":{"position":[[88,5]]},"141":{"position":[[553,6]]},"146":{"position":[[506,5],[561,5]]},"175":{"position":[[374,5]]},"277":{"position":[[239,5]]},"278":{"position":[[568,5]]},"290":{"position":[[104,5]]},"305":{"position":[[346,5]]},"314":{"position":[[110,5]]},"316":{"position":[[88,5]]},"326":{"position":[[553,6]]},"334":{"position":[[510,5],[565,5]]},"361":{"position":[[374,5]]},"502":{"position":[[104,5]]},"510":{"position":[[346,5]]},"514":{"position":[[239,5]]},"515":{"position":[[568,5]]},"531":{"position":[[110,5]]},"533":{"position":[[88,5]]},"535":{"position":[[553,6]]},"551":{"position":[[510,5],[565,5]]},"577":{"position":[[374,5]]}},"keywords":{}}],["though",{"_index":3455,"title":{},"content":{"440":{"position":[[5959,6]]},"687":{"position":[[5959,6]]}},"keywords":{}}],["three",{"_index":141,"title":{},"content":{"3":{"position":[[364,5]]},"52":{"position":[[1920,5]]},"184":{"position":[[10,5]]},"222":{"position":[[427,5]]},"375":{"position":[[10,5]]},"455":{"position":[[427,5]]},"591":{"position":[[10,5]]},"600":{"position":[[487,5]]},"695":{"position":[[427,5]]},"708":{"position":[[487,5]]}},"keywords":{}}],["thrive",{"_index":583,"title":{},"content":{"20":{"position":[[352,7]]}},"keywords":{}}],["through",{"_index":902,"title":{},"content":{"39":{"position":[[228,7]]},"84":{"position":[[121,7]]},"85":{"position":[[364,7]]},"126":{"position":[[1308,7]]},"180":{"position":[[45,7]]},"253":{"position":[[121,7]]},"254":{"position":[[364,7]]},"277":{"position":[[1476,7]]},"371":{"position":[[45,7]]},"383":{"position":[[150,7]]},"415":{"position":[[9,7]]},"477":{"position":[[3149,7],[4069,7]]},"484":{"position":[[121,7]]},"485":{"position":[[364,7]]},"514":{"position":[[1308,7]]},"587":{"position":[[45,7]]},"594":{"position":[[292,7]]},"612":{"position":[[1912,7]]},"625":{"position":[[150,7]]},"652":{"position":[[9,7]]},"699":{"position":[[3149,7],[4069,7]]},"702":{"position":[[292,7]]},"720":{"position":[[1912,7]]}},"keywords":{}}],["throughout",{"_index":867,"title":{},"content":{"38":{"position":[[376,10]]},"185":{"position":[[2950,10]]},"376":{"position":[[2934,10]]},"592":{"position":[[2934,10]]}},"keywords":{}}],["thrown",{"_index":1899,"title":{},"content":{"138":{"position":[[83,6],[1110,7]]},"318":{"position":[[83,6],[1102,7]]},"544":{"position":[[83,6],[1102,7]]}},"keywords":{}}],["thx",{"_index":933,"title":{},"content":{"39":{"position":[[966,4]]}},"keywords":{}}],["ticket",{"_index":3332,"title":{"437":{"position":[[0,9]]},"438":{"position":[[0,6]]},"684":{"position":[[0,9]]},"685":{"position":[[0,6]]}},"content":{"438":{"position":[[185,7]]},"439":{"position":[[158,6]]},"440":{"position":[[1066,8],[1994,6],[2581,6],[2595,8],[2704,7],[3020,6],[3182,8],[3438,7],[3493,6],[3636,6],[4137,7],[4206,7],[4383,6],[4464,6],[4519,6],[4679,6],[4742,6],[5910,7],[6011,7]]},"441":{"position":[[32,6],[135,7],[204,6],[230,8],[292,6],[399,6],[1441,6],[1728,9],[1801,9],[1859,6],[1899,6],[1960,9],[2219,8],[2655,9],[2977,6],[4092,6]]},"442":{"position":[[38,9]]},"685":{"position":[[185,7]]},"686":{"position":[[158,6]]},"687":{"position":[[1066,8],[1994,6],[2581,6],[2595,8],[2704,7],[3020,6],[3182,8],[3438,7],[3493,6],[3636,6],[4137,7],[4206,7],[4383,6],[4464,6],[4519,6],[4679,6],[4742,6],[5910,7],[6011,7]]},"688":{"position":[[32,6],[135,7],[204,6],[230,8],[292,6],[399,6],[1441,6],[1728,9],[1801,9],[1859,6],[1899,6],[1960,9],[2219,8],[2655,9],[2977,6],[4092,6]]},"689":{"position":[[38,9]]}},"keywords":{}}],["ticket.pric",{"_index":3408,"title":{},"content":{"440":{"position":[[2873,12]]},"687":{"position":[[2873,12]]}},"keywords":{}}],["ticket.statu",{"_index":3406,"title":{},"content":{"440":{"position":[[2727,13],[3113,13]]},"687":{"position":[[2727,13],[3113,13]]}},"keywords":{}}],["ticket_contract",{"_index":3488,"title":{},"content":{"441":{"position":[[1327,15]]},"688":{"position":[[1327,15]]}},"keywords":{}}],["ticket_contract.buy_ticket(ticket_id",{"_index":3491,"title":{},"content":{"441":{"position":[[1471,37]]},"688":{"position":[[1471,37]]}},"keywords":{}}],["ticket_id",{"_index":3359,"title":{},"content":{"440":{"position":[[618,10],[715,10],[1884,10],[2179,10],[2265,10],[3221,10]]},"441":{"position":[[1104,10],[3140,10]]},"687":{"position":[[618,10],[715,10],[1884,10],[2179,10],[2265,10],[3221,10]]},"688":{"position":[[1104,10],[3140,10]]}},"keywords":{}}],["ticket_offic",{"_index":3523,"title":{},"content":{"441":{"position":[[5040,13]]},"688":{"position":[[5040,13]]}},"keywords":{}}],["ticket_office.issue_ticket("ev".to_str",{"_index":3526,"title":{},"content":{"441":{"position":[[5171,54],[5244,54]]},"688":{"position":[[5171,54],[5244,54]]}},"keywords":{}}],["ticket_office.register_operator(operator.address().clon",{"_index":3525,"title":{},"content":{"441":{"position":[[5110,60]]},"688":{"position":[[5110,60]]}},"keywords":{}}],["ticket_office_address",{"_index":3482,"title":{},"content":{"441":{"position":[[798,22],[912,22],[1227,22]]},"688":{"position":[[798,22],[912,22],[1227,22]]}},"keywords":{}}],["ticket_oper",{"_index":3474,"title":{},"content":{"441":{"position":[[503,15]]},"688":{"position":[[503,15]]}},"keywords":{}}],["ticket_operator::ticketoperatorhostref",{"_index":3520,"title":{},"content":{"441":{"position":[[4644,39]]},"688":{"position":[[4644,39]]}},"keywords":{}}],["ticketdoesnotexist",{"_index":3368,"title":{},"content":{"440":{"position":[[872,18]]},"687":{"position":[[872,18]]}},"keywords":{}}],["ticketid",{"_index":3353,"title":{},"content":{"440":{"position":[[398,8],[629,9],[726,9],[2276,9],[3532,8]]},"441":{"position":[[1115,9],[3151,9],[4699,9],[5771,9]]},"687":{"position":[[398,8],[629,9],[726,9],[2276,9],[3532,8]]},"688":{"position":[[1115,9],[3151,9],[4699,9],[5771,9]]}},"keywords":{}}],["ticketinfo",{"_index":3356,"title":{},"content":{"440":{"position":[[506,10],[2040,10],[3446,10]]},"687":{"position":[[506,10],[2040,10],[3446,10]]}},"keywords":{}}],["ticketinfo>",{"_index":3372,"title":{},"content":{"440":{"position":[[1096,15]]},"687":{"position":[[1096,15]]}},"keywords":{}}],["ticketnotavailableforsal",{"_index":3362,"title":{},"content":{"440":{"position":[[791,25]]},"687":{"position":[[791,25]]}},"keywords":{}}],["ticketoffic",{"_index":3334,"title":{},"content":{"438":{"position":[[4,12],[289,13]]},"440":{"position":[[29,12],[985,12],[1135,12],[3790,12]]},"441":{"position":[[2049,12],[2155,12],[2373,12],[2445,12]]},"685":{"position":[[4,12],[289,13]]},"687":{"position":[[29,12],[985,12],[1135,12],[3790,12]]},"688":{"position":[[2049,12],[2155,12],[2373,12],[2445,12]]}},"keywords":{}}],["ticketofficecontractref",{"_index":3477,"title":{},"content":{"441":{"position":[[572,25],[2006,23],[4709,24]]},"688":{"position":[[572,25],[2006,23],[4709,24]]}},"keywords":{}}],["ticketofficecontractref::deploy(&env",{"_index":3524,"title":{},"content":{"441":{"position":[[5056,41]]},"688":{"position":[[5056,41]]}},"keywords":{}}],["ticketofficecontractref::new(env",{"_index":3489,"title":{},"content":{"441":{"position":[[1345,33]]},"688":{"position":[[1345,33]]}},"keywords":{}}],["ticketofficehostref",{"_index":3439,"title":{},"content":{"440":{"position":[[4891,20]]},"687":{"position":[[4891,20]]}},"keywords":{}}],["ticketofficehostref::deploy(&env",{"_index":3444,"title":{},"content":{"440":{"position":[[5162,37]]},"687":{"position":[[5162,37]]}},"keywords":{}}],["ticketofficeinitarg",{"_index":3440,"title":{},"content":{"440":{"position":[[4912,22],[5003,20]]},"441":{"position":[[4734,22],[4828,20]]},"687":{"position":[[4912,22],[5003,20]]},"688":{"position":[[4734,22],[4828,20]]}},"keywords":{}}],["ticketoper",{"_index":3481,"title":{},"content":{"441":{"position":[[781,14],[864,14],[1675,14],[2188,14]]},"688":{"position":[[781,14],[864,14],[1675,14],[2188,14]]}},"keywords":{}}],["ticketoperatorcontractref::new(self.env",{"_index":3499,"title":{},"content":{"441":{"position":[[2705,42]]},"688":{"position":[[2705,42]]}},"keywords":{}}],["ticketoperatorhostref::deploy(&env",{"_index":3522,"title":{},"content":{"441":{"position":[[4983,39]]},"688":{"position":[[4983,39]]}},"keywords":{}}],["tickets.l58",{"_index":3421,"title":{},"content":{"440":{"position":[[3920,11]]},"687":{"position":[[3920,11]]}},"keywords":{}}],["tickets.tri",{"_index":3432,"title":{},"content":{"440":{"position":[[4658,11],[4714,11]]},"687":{"position":[[4658,11],[4714,11]]}},"keywords":{}}],["tickets.us",{"_index":3338,"title":{},"content":{"438":{"position":[[158,13]]},"685":{"position":[[158,13]]}},"keywords":{}}],["ticketstatu",{"_index":3354,"title":{},"content":{"440":{"position":[[442,12],[560,13],[3393,12]]},"687":{"position":[[442,12],[560,13],[3393,12]]}},"keywords":{}}],["ticketstatus::avail",{"_index":3396,"title":{},"content":{"440":{"position":[[2100,24],[2744,23]]},"687":{"position":[[2100,24],[2744,23]]}},"keywords":{}}],["ticketstatus::sold",{"_index":3413,"title":{},"content":{"440":{"position":[[3129,19]]},"687":{"position":[[3129,19]]}},"keywords":{}}],["time",{"_index":80,"title":{},"content":{"1":{"position":[[988,5]]},"6":{"position":[[117,4]]},"9":{"position":[[5,4]]},"15":{"position":[[97,5]]},"21":{"position":[[132,4]]},"23":{"position":[[142,4]]},"32":{"position":[[5,4]]},"33":{"position":[[136,4]]},"52":{"position":[[4817,4]]},"72":{"position":[[98,5]]},"92":{"position":[[391,4]]},"95":{"position":[[426,5]]},"100":{"position":[[274,4]]},"106":{"position":[[62,4]]},"110":{"position":[[588,5]]},"111":{"position":[[362,5]]},"127":{"position":[[711,4]]},"162":{"position":[[1951,4]]},"163":{"position":[[274,5]]},"164":{"position":[[74,5]]},"198":{"position":[[2165,4]]},"203":{"position":[[375,5]]},"223":{"position":[[1326,4]]},"236":{"position":[[98,5]]},"273":{"position":[[62,4]]},"278":{"position":[[711,4]]},"284":{"position":[[391,4]]},"287":{"position":[[426,5]]},"292":{"position":[[274,4]]},"305":{"position":[[588,5]]},"306":{"position":[[362,5]]},"351":{"position":[[1973,4]]},"352":{"position":[[274,5]]},"353":{"position":[[74,5]]},"395":{"position":[[1282,4],[1326,4],[1399,7]]},"416":{"position":[[706,4],[1036,4],[1963,4],[2351,4]]},"419":{"position":[[1077,4],[4481,4]]},"423":{"position":[[375,5]]},"434":{"position":[[2155,4]]},"438":{"position":[[233,4]]},"456":{"position":[[1326,4]]},"472":{"position":[[98,5]]},"490":{"position":[[62,4]]},"496":{"position":[[391,4]]},"499":{"position":[[426,5]]},"504":{"position":[[274,4]]},"510":{"position":[[588,5]]},"511":{"position":[[362,5]]},"515":{"position":[[711,4]]},"567":{"position":[[1973,4]]},"568":{"position":[[274,5]]},"569":{"position":[[74,5]]},"601":{"position":[[1225,4]]},"632":{"position":[[1282,4],[1326,4],[1399,7]]},"653":{"position":[[706,4],[1036,4],[1963,4],[2351,4]]},"656":{"position":[[1077,4],[4481,4]]},"665":{"position":[[375,5]]},"681":{"position":[[2165,4]]},"685":{"position":[[233,4]]},"696":{"position":[[1326,4]]},"709":{"position":[[1225,4]]}},"keywords":{}}],["time_diff",{"_index":2136,"title":{},"content":{"168":{"position":[[1802,10]]},"348":{"position":[[1802,10]]},"564":{"position":[[1802,10]]}},"keywords":{}}],["timea",{"_index":881,"title":{},"content":{"38":{"position":[[752,5]]}},"keywords":{}}],["timelockwallet",{"_index":3536,"title":{},"content":{"476":{"position":[[35,14],[260,14],[420,14]]},"477":{"position":[[315,14]]},"478":{"position":[[111,14]]},"698":{"position":[[35,14],[260,14],[420,14]]},"699":{"position":[[315,14]]},"700":{"position":[[111,14]]}},"keywords":{}}],["timelockwallethostref::deploy",{"_index":3573,"title":{},"content":{"477":{"position":[[1849,30]]},"699":{"position":[[1849,30]]}},"keywords":{}}],["timelockwalletinitarg",{"_index":3568,"title":{},"content":{"477":{"position":[[1591,24],[1890,22]]},"699":{"position":[[1591,24],[1890,22]]}},"keywords":{}}],["timestamp",{"_index":3681,"title":{},"content":{"600":{"position":[[385,9]]},"708":{"position":[[385,9]]}},"keywords":{}}],["tlw_on_livenet",{"_index":3581,"title":{},"content":{"477":{"position":[[2518,14]]},"699":{"position":[[2518,14]]}},"keywords":{}}],["to/from",{"_index":1990,"title":{},"content":{"146":{"position":[[237,7]]},"178":{"position":[[251,7]]},"334":{"position":[[237,7]]},"369":{"position":[[251,7]]},"551":{"position":[[237,7]]},"585":{"position":[[251,7]]}},"keywords":{}}],["to_bal",{"_index":533,"title":{},"content":{"17":{"position":[[2845,10],[3057,10],[3260,10],[3614,10]]}},"keywords":{}}],["to_byt",{"_index":1685,"title":{},"content":{"103":{"position":[[179,8],[422,8]]},"295":{"position":[[179,8],[422,8]]},"507":{"position":[[179,8],[422,8]]}},"keywords":{}}],["tobyt",{"_index":2143,"title":{},"content":{"168":{"position":[[2049,7]]},"212":{"position":[[150,9]]},"229":{"position":[[228,7]]},"267":{"position":[[2278,7],[2813,7]]},"348":{"position":[[2049,7]]},"391":{"position":[[150,9]]},"407":{"position":[[2278,7],[2813,7]]},"460":{"position":[[228,7]]},"564":{"position":[[2049,7]]},"644":{"position":[[2278,7],[2813,7]]},"661":{"position":[[150,9]]}},"keywords":{}}],["tobytes>(&self",{"_index":2861,"title":{},"content":{"267":{"position":[[2602,22],[2874,22]]},"407":{"position":[[2602,22],[2874,22]]},"644":{"position":[[2602,22],[2874,22]]}},"keywords":{}}],["tobytes>(key",{"_index":2852,"title":{},"content":{"267":{"position":[[2214,16]]},"407":{"position":[[2214,16]]},"644":{"position":[[2214,16]]}},"keywords":{}}],["today",{"_index":93,"title":{},"content":{"2":{"position":[[66,6]]}},"keywords":{}}],["todo",{"_index":3730,"title":{},"content":{"602":{"position":[[1005,4],[1231,6],[1462,5],[1538,6],[1617,5],[1709,6]]},"710":{"position":[[1005,4],[1231,6],[1462,5],[1538,6],[1617,5],[1709,6]]}},"keywords":{}}],["todo.complet",{"_index":3742,"title":{},"content":{"602":{"position":[[1649,14],[1666,16]]},"710":{"position":[[1649,14],[1666,16]]}},"keywords":{}}],["todo.text",{"_index":3739,"title":{},"content":{"602":{"position":[[1494,9]]},"710":{"position":[[1494,9]]}},"keywords":{}}],["togeth",{"_index":2095,"title":{},"content":{"163":{"position":[[1553,9]]},"352":{"position":[[1575,9]]},"568":{"position":[[1575,9]]}},"keywords":{}}],["toggle_complete(&mut",{"_index":3741,"title":{},"content":{"602":{"position":[[1556,24]]},"710":{"position":[[1556,24]]}},"keywords":{}}],["token",{"_index":449,"title":{"159":{"position":[[7,5]]},"188":{"position":[[0,7]]},"344":{"position":[[7,5]]},"365":{"position":[[0,7]]},"392":{"position":[[12,5]]},"394":{"position":[[8,7]]},"397":{"position":[[13,6]]},"413":{"position":[[15,6]]},"414":{"position":[[0,5]]},"561":{"position":[[7,5]]},"581":{"position":[[0,7]]},"629":{"position":[[12,5]]},"631":{"position":[[8,7]]},"634":{"position":[[13,6]]},"650":{"position":[[15,6]]},"651":{"position":[[0,5]]}},"content":{"17":{"position":[[42,5]]},"39":{"position":[[3236,5]]},"43":{"position":[[105,5]]},"70":{"position":[[279,7]]},"71":{"position":[[596,6]]},"79":{"position":[[758,7]]},"80":{"position":[[288,7],[625,5],[811,5]]},"84":{"position":[[225,5],[304,5],[455,5],[767,5],[890,5]]},"85":{"position":[[487,5],[588,5]]},"100":{"position":[[34,5],[1003,7]]},"101":{"position":[[704,7]]},"102":{"position":[[53,5]]},"126":{"position":[[2428,5],[2910,5]]},"152":{"position":[[33,5]]},"160":{"position":[[28,6]]},"188":{"position":[[732,6],[807,6]]},"202":{"position":[[292,6]]},"204":{"position":[[1122,5]]},"206":{"position":[[1180,6],[2662,6],[2793,6]]},"230":{"position":[[775,7]]},"231":{"position":[[288,7],[625,5],[811,5]]},"234":{"position":[[279,7]]},"235":{"position":[[596,6]]},"253":{"position":[[225,5],[304,5],[455,5],[767,5],[890,5]]},"254":{"position":[[487,5],[588,5]]},"267":{"position":[[3873,5]]},"269":{"position":[[5090,6]]},"277":{"position":[[1130,5],[2596,5],[3078,5]]},"292":{"position":[[34,5],[1003,7]]},"293":{"position":[[704,7]]},"294":{"position":[[53,5]]},"343":{"position":[[33,5]]},"345":{"position":[[28,6]]},"346":{"position":[[89,6]]},"365":{"position":[[103,7],[1089,6],[1164,6]]},"394":{"position":[[364,6],[400,7],[545,7]]},"395":{"position":[[309,6],[933,5],[1062,7],[5097,5],[6801,6],[6864,6]]},"396":{"position":[[114,5],[587,6],[697,5],[763,5],[829,6],[1002,7],[1055,6],[1086,6]]},"397":{"position":[[228,6]]},"398":{"position":[[30,5]]},"407":{"position":[[3873,5]]},"409":{"position":[[5090,6]]},"413":{"position":[[62,6],[168,5],[203,7]]},"414":{"position":[[172,5],[234,6],[321,5]]},"415":{"position":[[170,7],[335,5],[370,7]]},"416":{"position":[[59,6],[105,6],[185,5],[342,5],[451,5],[467,6],[976,6],[1269,5],[1343,5],[1662,5],[2176,7],[2900,6],[3172,6],[3232,6],[3384,6],[4191,6],[4758,7],[4919,6]]},"417":{"position":[[354,5],[437,5],[487,6],[527,5],[675,6],[884,6],[1169,6]]},"418":{"position":[[15,5]]},"419":{"position":[[315,6],[569,5],[822,5],[838,6],[1472,5],[1539,6],[1667,5],[2342,6],[2412,6],[2493,5],[2574,6],[2752,6],[2937,6],[3341,6],[3468,6],[3650,6],[3790,6],[4179,5],[4855,6],[5770,6],[6769,5],[6852,5],[6902,6],[6942,5],[7090,6],[7299,6],[7584,6]]},"422":{"position":[[292,6]]},"424":{"position":[[1072,5]]},"426":{"position":[[1175,6],[2647,6],[2778,6]]},"439":{"position":[[19,5]]},"440":{"position":[[1000,6],[1787,5],[2416,6],[3850,6],[4170,6],[6127,5]]},"441":{"position":[[4037,5]]},"461":{"position":[[775,7]]},"462":{"position":[[288,7],[625,5],[811,5]]},"470":{"position":[[279,7]]},"471":{"position":[[596,6]]},"476":{"position":[[597,6],[1188,6]]},"477":{"position":[[3865,7]]},"478":{"position":[[146,6]]},"484":{"position":[[225,5],[304,5],[455,5],[767,5],[890,5]]},"485":{"position":[[487,5],[588,5]]},"504":{"position":[[34,5],[1003,7]]},"505":{"position":[[704,7]]},"506":{"position":[[53,5]]},"514":{"position":[[2428,5],[2910,5]]},"557":{"position":[[33,5]]},"562":{"position":[[28,6]]},"581":{"position":[[103,7],[1089,6],[1164,6]]},"631":{"position":[[364,6],[400,7],[545,7]]},"632":{"position":[[309,6],[933,5],[1062,7],[5097,5],[6801,6],[6864,6]]},"633":{"position":[[114,5],[587,6],[697,5],[763,5],[829,6],[1002,7],[1055,6],[1086,6]]},"634":{"position":[[228,6]]},"635":{"position":[[30,5]]},"644":{"position":[[3873,5]]},"646":{"position":[[5090,6]]},"650":{"position":[[62,6],[168,5],[203,7]]},"651":{"position":[[172,5],[234,6],[321,5]]},"652":{"position":[[170,7],[335,5],[370,7]]},"653":{"position":[[59,6],[105,6],[185,5],[342,5],[451,5],[467,6],[976,6],[1269,5],[1343,5],[1662,5],[2176,7],[2900,6],[3172,6],[3232,6],[3384,6],[4191,6],[4758,7],[4919,6]]},"654":{"position":[[354,5],[437,5],[487,6],[527,5],[675,6],[884,6],[1169,6]]},"655":{"position":[[15,5]]},"656":{"position":[[315,6],[569,5],[822,5],[838,6],[1472,5],[1539,6],[1667,5],[2342,6],[2412,6],[2493,5],[2574,6],[2752,6],[2937,6],[3341,6],[3468,6],[3650,6],[3790,6],[4179,5],[4855,6],[5770,6],[6769,5],[6852,5],[6902,6],[6942,5],[7090,6],[7299,6],[7584,6]]},"664":{"position":[[292,6]]},"666":{"position":[[1072,5]]},"668":{"position":[[1180,6],[2662,6],[2793,6]]},"686":{"position":[[19,5]]},"687":{"position":[[1000,6],[1787,5],[2416,6],[3850,6],[4170,6],[6127,5]]},"688":{"position":[[4037,5]]},"698":{"position":[[597,6],[1188,6]]},"699":{"position":[[3865,7]]},"700":{"position":[[146,6]]}},"keywords":{}}],["token>",{"_index":1484,"title":{},"content":{"80":{"position":[[325,10]]},"231":{"position":[[325,10]]},"462":{"position":[[325,10]]}},"keywords":{}}],["token).balance_of(account",{"_index":2887,"title":{},"content":{"267":{"position":[[3977,26]]},"407":{"position":[[3977,26]]},"644":{"position":[[3977,26]]}},"keywords":{}}],["token.address().to_str",{"_index":1826,"title":{},"content":{"126":{"position":[[2580,29]]},"277":{"position":[[2748,29]]},"395":{"position":[[1009,29]]},"514":{"position":[[2580,29]]},"632":{"position":[[1009,29]]}},"keywords":{}}],["token.balance_of(&address",{"_index":1493,"title":{},"content":{"80":{"position":[[681,30]]},"231":{"position":[[681,30]]},"462":{"position":[[681,30]]}},"keywords":{}}],["token.balance_of(&own",{"_index":3144,"title":{},"content":{"395":{"position":[[1617,30]]},"632":{"position":[[1617,30]]}},"keywords":{}}],["token.balance_of(&recipi",{"_index":3148,"title":{},"content":{"395":{"position":[[1704,32]]},"632":{"position":[[1704,32]]}},"keywords":{}}],["token.balance_of(own",{"_index":1838,"title":{},"content":{"126":{"position":[[3293,25]]},"277":{"position":[[3461,25]]},"514":{"position":[[3293,25]]}},"keywords":{}}],["token.balance_of(recipi",{"_index":1840,"title":{},"content":{"126":{"position":[[3367,29]]},"277":{"position":[[3535,29]]},"514":{"position":[[3367,29]]}},"keywords":{}}],["token.mint(amount",{"_index":1495,"title":{},"content":{"80":{"position":[[867,18]]},"231":{"position":[[867,18]]},"462":{"position":[[867,18]]}},"keywords":{}}],["token.nam",{"_index":1833,"title":{},"content":{"126":{"position":[[3052,14]]},"277":{"position":[[3220,14]]},"514":{"position":[[3052,14]]}},"keywords":{}}],["token.propose_new_mint(env.get_account(1",{"_index":3278,"title":{},"content":{"417":{"position":[[570,42],[1239,42]]},"419":{"position":[[6985,42],[7654,42]]},"654":{"position":[[570,42],[1239,42]]},"656":{"position":[[6985,42],[7654,42]]}},"keywords":{}}],["token.propose_new_mint(recipi",{"_index":3130,"title":{},"content":{"395":{"position":[[1101,33]]},"632":{"position":[[1101,33]]}},"keywords":{}}],["token.t",{"_index":3143,"title":{},"content":{"395":{"position":[[1535,14]]},"417":{"position":[[862,14],[1495,14]]},"419":{"position":[[7277,14],[7910,14]]},"632":{"position":[[1535,14]]},"654":{"position":[[862,14],[1495,14]]},"656":{"position":[[7277,14],[7910,14]]}},"keywords":{}}],["token.transfer(recipi",{"_index":1835,"title":{},"content":{"126":{"position":[[3204,25]]},"277":{"position":[[3372,25]]},"514":{"position":[[3204,25]]}},"keywords":{}}],["token.vote(fals",{"_index":3287,"title":{},"content":{"417":{"position":[[1418,17]]},"419":{"position":[[7833,17]]},"654":{"position":[[1418,17]]},"656":{"position":[[7833,17]]}},"keywords":{}}],["token.vote(tru",{"_index":3134,"title":{},"content":{"395":{"position":[[1218,16]]},"417":{"position":[[632,16],[1301,16]]},"419":{"position":[[7047,16],[7716,16]]},"632":{"position":[[1218,16]]},"654":{"position":[[632,16],[1301,16]]},"656":{"position":[[7047,16],[7716,16]]}},"keywords":{}}],["token::cep78",{"_index":3352,"title":{},"content":{"440":{"position":[[372,13]]},"687":{"position":[[372,13]]}},"keywords":{}}],["token::{error",{"_index":3521,"title":{},"content":{"441":{"position":[[4684,14]]},"688":{"position":[[4684,14]]}},"keywords":{}}],["token_hash",{"_index":3459,"title":{},"content":{"440":{"position":[[6298,11]]},"687":{"position":[[6298,11]]}},"keywords":{}}],["token_id",{"_index":3387,"title":{},"content":{"440":{"position":[[1804,9],[1901,8],[6270,9]]},"687":{"position":[[1804,9],[1901,8],[6270,9]]}},"keywords":{}}],["token_nam",{"_index":1455,"title":{},"content":{"79":{"position":[[873,11]]},"80":{"position":[[553,11],[737,11]]},"230":{"position":[[890,11]]},"231":{"position":[[553,11],[737,11]]},"461":{"position":[[890,11]]},"462":{"position":[[553,11],[737,11]]}},"keywords":{}}],["tokencontractref::new(env",{"_index":2886,"title":{},"content":{"267":{"position":[[3950,26]]},"407":{"position":[[3950,26]]},"644":{"position":[[3950,26]]}},"keywords":{}}],["tokens"",{"_index":3115,"title":{},"content":{"394":{"position":[[314,12]]},"631":{"position":[[314,12]]}},"keywords":{}}],["tokens,and",{"_index":1155,"title":{},"content":{"43":{"position":[[1741,10]]}},"keywords":{}}],["tokens.en",{"_index":2753,"title":{},"content":{"245":{"position":[[102,13]]},"444":{"position":[[102,13]]},"671":{"position":[[102,13]]}},"keywords":{}}],["tokens.if",{"_index":3217,"title":{},"content":{"416":{"position":[[155,9]]},"653":{"position":[[155,9]]}},"keywords":{}}],["tokio::runtime::runtime::new().unwrap",{"_index":2659,"title":{},"content":{"212":{"position":[[3248,40]]},"391":{"position":[[3266,40]]},"661":{"position":[[3266,40]]}},"keywords":{}}],["toler",{"_index":3775,"title":{},"content":{"606":{"position":[[1165,11]]},"714":{"position":[[1165,11]]}},"keywords":{}}],["ton",{"_index":49,"title":{},"content":{"1":{"position":[[638,4]]},"20":{"position":[[393,3]]}},"keywords":{}}],["took",{"_index":1859,"title":{},"content":{"127":{"position":[[762,4]]},"278":{"position":[[762,4]]},"515":{"position":[[762,4]]}},"keywords":{}}],["tool",{"_index":31,"title":{},"content":{"1":{"position":[[334,4],[453,5]]},"16":{"position":[[24,4]]},"20":{"position":[[430,8]]},"22":{"position":[[1404,4]]},"40":{"position":[[31,5]]},"52":{"position":[[2201,5]]},"66":{"position":[[67,5],[155,4]]},"94":{"position":[[45,8]]},"97":{"position":[[173,4]]},"173":{"position":[[136,4],[216,6],[319,5]]},"174":{"position":[[24,4]]},"210":{"position":[[345,5]]},"241":{"position":[[67,5],[155,4]]},"286":{"position":[[45,8]]},"289":{"position":[[173,4]]},"359":{"position":[[136,4],[216,6],[319,5]]},"360":{"position":[[24,4]]},"389":{"position":[[345,5]]},"398":{"position":[[276,5]]},"418":{"position":[[81,5]]},"466":{"position":[[67,5],[155,4]]},"498":{"position":[[45,8]]},"501":{"position":[[173,4]]},"575":{"position":[[136,4],[216,6],[319,5]]},"576":{"position":[[24,4]]},"635":{"position":[[276,5]]},"655":{"position":[[81,5]]},"659":{"position":[[345,5]]}},"keywords":{}}],["toolchain",{"_index":2148,"title":{},"content":{"173":{"position":[[91,9],[347,9]]},"195":{"position":[[427,9]]},"261":{"position":[[101,10]]},"359":{"position":[[91,9],[347,9]]},"379":{"position":[[101,10]]},"401":{"position":[[101,10]]},"431":{"position":[[427,9]]},"575":{"position":[[91,9],[347,9]]},"621":{"position":[[101,10]]},"638":{"position":[[101,10]]},"678":{"position":[[427,9]]}},"keywords":{}}],["top",{"_index":1423,"title":{},"content":{"76":{"position":[[744,3]]},"95":{"position":[[118,3]]},"102":{"position":[[207,3],[498,3]]},"227":{"position":[[744,3]]},"287":{"position":[[118,3]]},"294":{"position":[[207,3],[498,3]]},"396":{"position":[[288,3]]},"458":{"position":[[744,3]]},"499":{"position":[[118,3]]},"506":{"position":[[207,3],[498,3]]},"633":{"position":[[288,3]]}},"keywords":{}}],["topic",{"_index":1426,"title":{},"content":{"76":{"position":[[908,7]]},"227":{"position":[[908,7]]},"458":{"position":[[908,7]]},"618":{"position":[[703,7]]},"726":{"position":[[703,7]]}},"keywords":{}}],["total",{"_index":2505,"title":{},"content":{"206":{"position":[[816,5]]},"269":{"position":[[4726,5]]},"396":{"position":[[622,5]]},"409":{"position":[[4726,5]]},"419":{"position":[[2554,5]]},"426":{"position":[[816,5]]},"438":{"position":[[269,5]]},"633":{"position":[[622,5]]},"646":{"position":[[4726,5]]},"656":{"position":[[2554,5]]},"668":{"position":[[816,5]]},"685":{"position":[[269,5]]}},"keywords":{}}],["total_suppli",{"_index":516,"title":{},"content":{"17":{"position":[[2066,13],[2307,13],[2488,14]]},"203":{"position":[[229,13]]},"269":{"position":[[397,13]]},"384":{"position":[[410,13]]},"409":{"position":[[397,13]]},"423":{"position":[[229,13]]},"440":{"position":[[1229,13],[1391,13],[5121,13]]},"441":{"position":[[4946,13]]},"626":{"position":[[410,13]]},"646":{"position":[[397,13]]},"665":{"position":[[229,13]]},"687":{"position":[[1229,13],[1391,13],[5121,13]]},"688":{"position":[[4946,13]]}},"keywords":{}}],["total_supply(&mut",{"_index":1454,"title":{},"content":{"79":{"position":[[845,21]]},"230":{"position":[[862,21]]},"461":{"position":[[862,21]]}},"keywords":{}}],["total_supply(&self",{"_index":526,"title":{},"content":{"17":{"position":[[2512,23]]},"115":{"position":[[916,23]]},"204":{"position":[[530,23]]},"247":{"position":[[506,23]]},"258":{"position":[[878,23]]},"419":{"position":[[2584,23]]},"424":{"position":[[505,23]]},"446":{"position":[[506,23]]},"481":{"position":[[878,23]]},"656":{"position":[[2584,23]]},"666":{"position":[[505,23]]},"673":{"position":[[506,23]]}},"keywords":{}}],["track",{"_index":1429,"title":{},"content":{"78":{"position":[[150,5]]},"95":{"position":[[399,5]]},"229":{"position":[[150,5]]},"287":{"position":[[399,5]]},"416":{"position":[[1018,5]]},"460":{"position":[[150,5]]},"499":{"position":[[399,5]]},"653":{"position":[[1018,5]]}},"keywords":{}}],["trait",{"_index":1514,"title":{},"content":{"83":{"position":[[542,5]]},"91":{"position":[[796,6]]},"141":{"position":[[993,6],[1004,5],[1243,5],[1445,7]]},"148":{"position":[[258,6],[848,5]]},"178":{"position":[[1264,6]]},"188":{"position":[[283,5],[371,5],[657,5]]},"197":{"position":[[1601,6]]},"252":{"position":[[542,5]]},"267":{"position":[[3867,5]]},"268":{"position":[[1981,5]]},"283":{"position":[[796,6]]},"326":{"position":[[993,6],[1004,5],[1243,5],[1445,7]]},"336":{"position":[[258,6],[848,5]]},"365":{"position":[[640,5],[728,5],[1014,5]]},"369":{"position":[[1264,6]]},"407":{"position":[[3867,5]]},"408":{"position":[[1981,5]]},"433":{"position":[[1600,6]]},"483":{"position":[[542,5]]},"495":{"position":[[796,6]]},"535":{"position":[[993,6],[1004,5],[1243,5],[1445,7]]},"553":{"position":[[258,6],[848,5]]},"581":{"position":[[640,5],[728,5],[1014,5]]},"585":{"position":[[1264,6]]},"602":{"position":[[706,6]]},"613":{"position":[[507,5],[1770,7],[1955,6],[2103,5]]},"644":{"position":[[3867,5]]},"645":{"position":[[1981,5]]},"680":{"position":[[1600,6]]},"710":{"position":[[706,6]]},"721":{"position":[[507,5],[1770,7],[1955,6],[2103,5]]}},"keywords":{}}],["transact",{"_index":1298,"title":{"53":{"position":[[13,12]]}},"content":{"53":{"position":[[92,13]]},"71":{"position":[[634,11]]},"235":{"position":[[634,11]]},"396":{"position":[[793,12],[859,11]]},"471":{"position":[[634,11]]},"617":{"position":[[1409,11]]},"633":{"position":[[793,12],[859,11]]},"725":{"position":[[1409,11]]}},"keywords":{}}],["transaction_default",{"_index":1242,"title":{},"content":{"52":{"position":[[735,20],[915,20]]}},"keywords":{}}],["transfer",{"_index":967,"title":{"397":{"position":[[0,12]]},"634":{"position":[[0,12]]}},"content":{"39":{"position":[[1995,8]]},"43":{"position":[[1752,8],[2057,8]]},"92":{"position":[[134,8],[282,9],[590,8],[702,9],[738,11]]},"110":{"position":[[560,10]]},"127":{"position":[[748,8],[937,8]]},"152":{"position":[[39,10]]},"189":{"position":[[487,11],[615,11]]},"203":{"position":[[110,10]]},"204":{"position":[[898,8]]},"205":{"position":[[86,9]]},"206":{"position":[[908,8],[1171,8],[1570,8],[1813,8],[2652,9],[2804,11],[3604,8]]},"267":{"position":[[922,11],[1068,11],[1598,8],[3323,12]]},"269":{"position":[[289,11],[3401,8],[3900,10],[4818,8],[5081,8],[5480,8],[5723,8]]},"278":{"position":[[748,8],[937,8]]},"284":{"position":[[134,8],[282,9],[590,8],[702,9],[738,11]]},"305":{"position":[[560,10]]},"343":{"position":[[39,10]]},"346":{"position":[[75,8]]},"366":{"position":[[487,11],[615,11]]},"383":{"position":[[1120,8]]},"384":{"position":[[286,10],[3411,8]]},"396":{"position":[[906,9]]},"397":{"position":[[98,12],[324,8]]},"407":{"position":[[922,11],[1068,11],[1598,8],[3323,12]]},"409":{"position":[[289,11],[3401,8],[3900,10],[4818,8],[5081,8],[5480,8],[5723,8]]},"416":{"position":[[2880,8],[3159,8],[4166,8]]},"419":{"position":[[3331,9],[3458,9],[4835,8],[5745,8]]},"423":{"position":[[110,10]]},"424":{"position":[[849,8]]},"425":{"position":[[86,9]]},"426":{"position":[[908,8],[1166,8],[1565,8],[1803,8],[2637,9],[2789,11],[3579,8]]},"440":{"position":[[2931,8],[3007,8],[4450,9],[6116,8],[6245,9]]},"441":{"position":[[221,8],[2964,8],[3441,8],[4079,8],[4191,8]]},"496":{"position":[[134,8],[282,9],[590,8],[702,9],[738,11]]},"510":{"position":[[560,10]]},"515":{"position":[[748,8],[937,8]]},"557":{"position":[[39,10]]},"582":{"position":[[487,11],[615,11]]},"604":{"position":[[109,8],[290,8],[433,8]]},"625":{"position":[[1120,8]]},"626":{"position":[[286,10],[3411,8]]},"633":{"position":[[906,9]]},"634":{"position":[[98,12],[324,8]]},"644":{"position":[[922,11],[1068,11],[1598,8],[3323,12]]},"646":{"position":[[289,11],[3401,8],[3900,10],[4818,8],[5081,8],[5480,8],[5723,8]]},"653":{"position":[[2880,8],[3159,8],[4166,8]]},"656":{"position":[[3331,9],[3458,9],[4835,8],[5745,8]]},"665":{"position":[[110,10]]},"666":{"position":[[849,8]]},"667":{"position":[[86,9]]},"668":{"position":[[908,8],[1171,8],[1570,8],[1813,8],[2652,9],[2804,11],[3604,8]]},"687":{"position":[[2931,8],[3007,8],[4450,9],[6116,8],[6245,9]]},"688":{"position":[[221,8],[2964,8],[3441,8],[4079,8],[4191,8]]},"712":{"position":[[109,8],[290,8],[433,8]]}},"keywords":{}}],["transfer(&contract",{"_index":3245,"title":{},"content":{"416":{"position":[[2950,24]]},"653":{"position":[[2950,24]]}},"keywords":{}}],["transfer(&mut",{"_index":530,"title":{},"content":{"17":{"position":[[2694,17]]},"115":{"position":[[587,17],[2485,17]]},"205":{"position":[[293,17]]},"247":{"position":[[800,17]]},"258":{"position":[[573,17],[2427,17]]},"269":{"position":[[1039,17]]},"384":{"position":[[1052,17]]},"409":{"position":[[1039,17]]},"419":{"position":[[3385,17]]},"425":{"position":[[268,17]]},"446":{"position":[[800,17]]},"481":{"position":[[573,17],[2427,17]]},"604":{"position":[[148,17]]},"626":{"position":[[1052,17]]},"646":{"position":[[1039,17]]},"656":{"position":[[3385,17]]},"667":{"position":[[268,17]]},"673":{"position":[[800,17]]},"712":{"position":[[148,17]]}},"keywords":{}}],["transfer(&self",{"_index":3784,"title":{},"content":{"608":{"position":[[517,19]]},"716":{"position":[[517,19]]}},"keywords":{}}],["transfer(address",{"_index":959,"title":{},"content":{"39":{"position":[[1785,16]]}},"keywords":{}}],["transfer(maybe::some(ticket_id",{"_index":3412,"title":{},"content":{"440":{"position":[[3051,33]]},"687":{"position":[[3051,33]]}},"keywords":{}}],["transfer_amount",{"_index":2529,"title":{},"content":{"206":{"position":[[2257,15],[2914,15],[2978,17],[3097,15],[3227,15]]},"268":{"position":[[3203,15],[3333,15]]},"408":{"position":[[3203,15],[3333,15]]},"426":{"position":[[2247,15],[2899,15],[2963,17],[3077,15],[3202,15]]},"645":{"position":[[3203,15],[3333,15]]},"668":{"position":[[2257,15],[2914,15],[2978,17],[3097,15],[3227,15]]}},"keywords":{}}],["transfer_error",{"_index":2521,"title":{},"content":{"206":{"position":[[1725,16]]},"269":{"position":[[5635,16]]},"409":{"position":[[5635,16]]},"426":{"position":[[1715,16]]},"646":{"position":[[5635,16]]},"668":{"position":[[1725,16]]}},"keywords":{}}],["transfer_from",{"_index":2468,"title":{},"content":{"205":{"position":[[96,14]]},"425":{"position":[[96,14]]},"667":{"position":[[96,14]]}},"keywords":{}}],["transfer_from(&mut",{"_index":539,"title":{},"content":{"17":{"position":[[3087,22]]},"115":{"position":[[653,22]]},"205":{"position":[[457,22]]},"247":{"position":[[919,22]]},"258":{"position":[[635,22]]},"269":{"position":[[1203,22]]},"384":{"position":[[1216,22]]},"409":{"position":[[1203,22]]},"419":{"position":[[3541,22]]},"425":{"position":[[432,22]]},"446":{"position":[[919,22]]},"481":{"position":[[635,22]]},"626":{"position":[[1216,22]]},"646":{"position":[[1203,22]]},"656":{"position":[[3541,22]]},"667":{"position":[[432,22]]},"673":{"position":[[919,22]]}},"keywords":{}}],["transfer_from_and_approval_work",{"_index":2525,"title":{},"content":{"206":{"position":[[2053,33]]},"426":{"position":[[2043,33]]},"668":{"position":[[2053,33]]}},"keywords":{}}],["transfer_from_error",{"_index":2542,"title":{},"content":{"206":{"position":[[3326,21]]},"268":{"position":[[2366,21]]},"408":{"position":[[2366,21]]},"426":{"position":[[3301,21]]},"645":{"position":[[2366,21]]},"668":{"position":[[3326,21]]}},"keywords":{}}],["transfer_ownership",{"_index":2300,"title":{},"content":{"189":{"position":[[658,20]]},"366":{"position":[[658,20]]},"582":{"position":[[658,20]]}},"keywords":{}}],["transfer_work",{"_index":2511,"title":{},"content":{"206":{"position":[[1087,16]]},"269":{"position":[[4997,16]]},"409":{"position":[[4997,16]]},"426":{"position":[[1082,16]]},"646":{"position":[[4997,16]]},"668":{"position":[[1087,16]]}},"keywords":{}}],["transferreceipt",{"_index":3463,"title":{},"content":{"440":{"position":[[6380,15]]},"687":{"position":[[6380,15]]}},"keywords":{}}],["transform",{"_index":1611,"title":{},"content":{"93":{"position":[[195,11]]},"285":{"position":[[195,11]]},"497":{"position":[[195,11]]}},"keywords":{}}],["transit",{"_index":3606,"title":{},"content":{"594":{"position":[[314,13]]},"618":{"position":[[230,10]]},"702":{"position":[[314,13]]},"726":{"position":[[230,10]]}},"keywords":{}}],["translat",{"_index":556,"title":{},"content":{"18":{"position":[[310,9]]}},"keywords":{}}],["transpil",{"_index":892,"title":{},"content":{"38":{"position":[[1128,9]]},"39":{"position":[[214,13]]},"40":{"position":[[460,10]]}},"keywords":{}}],["tri",{"_index":1368,"title":{"617":{"position":[[0,3]]},"725":{"position":[[0,3]]}},"content":{"71":{"position":[[584,3]]},"198":{"position":[[3457,5],[3673,3]]},"235":{"position":[[584,3]]},"434":{"position":[[3439,5],[3655,3]]},"471":{"position":[[584,3]]},"478":{"position":[[227,3]]},"681":{"position":[[3457,5],[3673,3]]},"700":{"position":[[227,3]]}},"keywords":{}}],["trick",{"_index":446,"title":{},"content":{"16":{"position":[[375,5]]}},"keywords":{}}],["trigger",{"_index":343,"title":{},"content":{"10":{"position":[[831,8]]},"85":{"position":[[864,10]]},"182":{"position":[[333,8]]},"184":{"position":[[1173,9]]},"190":{"position":[[81,9]]},"254":{"position":[[864,10]]},"367":{"position":[[81,9]]},"373":{"position":[[333,8]]},"375":{"position":[[1070,9]]},"485":{"position":[[864,10]]},"583":{"position":[[81,9]]},"589":{"position":[[333,8]]},"591":{"position":[[1070,9]]}},"keywords":{}}],["tripl",{"_index":2402,"title":{},"content":{"198":{"position":[[1743,7]]},"434":{"position":[[1733,7]]},"681":{"position":[[1743,7]]}},"keywords":{}}],["troubleshoot",{"_index":2945,"title":{"270":{"position":[[3,16]]},"385":{"position":[[3,16]]},"410":{"position":[[3,16]]},"627":{"position":[[3,16]]},"647":{"position":[[3,16]]}},"content":{},"keywords":{}}],["true",{"_index":1643,"title":{},"content":{"98":{"position":[[289,4],[428,5]]},"131":{"position":[[468,4]]},"185":{"position":[[2059,6]]},"265":{"position":[[878,4]]},"290":{"position":[[289,4],[428,5]]},"311":{"position":[[520,4]]},"323":{"position":[[1828,5],[2071,5],[2364,5]]},"376":{"position":[[2043,6]]},"395":{"position":[[2891,4],[3558,4]]},"405":{"position":[[878,4]]},"416":{"position":[[2271,5]]},"477":{"position":[[994,4]]},"502":{"position":[[289,4],[428,5]]},"528":{"position":[[520,4]]},"541":{"position":[[1828,5],[2071,5],[2364,5]]},"592":{"position":[[2043,6]]},"632":{"position":[[2891,4],[3558,4]]},"642":{"position":[[878,4]]},"653":{"position":[[2271,5]]},"699":{"position":[[994,4]]}},"keywords":{}}],["trustless",{"_index":367,"title":{},"content":{"11":{"position":[[132,9]]}},"keywords":{}}],["try/catch",{"_index":3920,"title":{},"content":{"617":{"position":[[777,9],[876,9],[1056,9]]},"725":{"position":[[777,9],[876,9],[1056,9]]}},"keywords":{}}],["try_",{"_index":2419,"title":{},"content":{"198":{"position":[[3622,4]]},"268":{"position":[[2126,4]]},"408":{"position":[[2126,4]]},"434":{"position":[[3604,4]]},"645":{"position":[[2126,4]]},"681":{"position":[[3622,4]]}},"keywords":{}}],["try_buy_ticket(0",{"_index":3449,"title":{},"content":{"440":{"position":[[5452,19],[5563,19],[5724,19]]},"687":{"position":[[5452,19],[5563,19],[5724,19]]}},"keywords":{}}],["try_buy_ticket(1",{"_index":3452,"title":{},"content":{"440":{"position":[[5643,19]]},"687":{"position":[[5643,19]]}},"keywords":{}}],["try_change_nam",{"_index":1923,"title":{},"content":{"138":{"position":[[1017,16],[1065,15]]},"318":{"position":[[1009,16],[1057,15]]},"544":{"position":[[1009,16],[1057,15]]}},"keywords":{}}],["try_nam",{"_index":1921,"title":{},"content":{"138":{"position":[[996,9]]},"318":{"position":[[988,9]]},"544":{"position":[[988,9]]}},"keywords":{}}],["try_own",{"_index":1922,"title":{},"content":{"138":{"position":[[1006,10]]},"318":{"position":[[998,10]]},"544":{"position":[[998,10]]}},"keywords":{}}],["try_{{entry_point_nam",{"_index":1917,"title":{},"content":{"138":{"position":[[825,24]]},"318":{"position":[[817,24]]},"544":{"position":[[817,24]]}},"keywords":{}}],["tupl",{"_index":1465,"title":{},"content":{"79":{"position":[[1205,5]]},"81":{"position":[[259,6]]},"203":{"position":[[615,5]]},"230":{"position":[[1222,5]]},"232":{"position":[[259,6]]},"416":{"position":[[913,5]]},"423":{"position":[[615,5]]},"461":{"position":[[1222,5]]},"463":{"position":[[259,6]]},"653":{"position":[[913,5]]},"665":{"position":[[615,5]]}},"keywords":{}}],["ture",{"_index":172,"title":{},"content":{"5":{"position":[[107,6]]}},"keywords":{}}],["turn",{"_index":2746,"title":{},"content":{"223":{"position":[[1265,4],[1346,4]]},"415":{"position":[[209,6]]},"456":{"position":[[1265,4],[1346,4]]},"652":{"position":[[209,6]]},"696":{"position":[[1265,4],[1346,4]]}},"keywords":{}}],["tutori",{"_index":678,"title":{},"content":{"23":{"position":[[174,10]]},"52":{"position":[[216,10]]},"99":{"position":[[694,9]]},"197":{"position":[[853,9]]},"199":{"position":[[152,9]]},"200":{"position":[[12,8]]},"291":{"position":[[694,9]]},"295":{"position":[[817,8]]},"393":{"position":[[56,9]]},"395":{"position":[[141,9],[324,8],[6654,8]]},"396":{"position":[[1239,8]]},"433":{"position":[[852,9]]},"435":{"position":[[152,9]]},"436":{"position":[[12,8]]},"442":{"position":[[8,9]]},"476":{"position":[[9,9]]},"478":{"position":[[8,9]]},"503":{"position":[[694,9]]},"507":{"position":[[817,8]]},"594":{"position":[[268,8]]},"618":{"position":[[525,8]]},"630":{"position":[[56,9]]},"632":{"position":[[141,9],[324,8],[6654,8]]},"633":{"position":[[1239,8]]},"680":{"position":[[852,9]]},"682":{"position":[[152,9]]},"683":{"position":[[12,8]]},"689":{"position":[[8,9]]},"698":{"position":[[9,9]]},"700":{"position":[[8,9]]},"702":{"position":[[268,8]]},"726":{"position":[[525,8]]}},"keywords":{}}],["twitter",{"_index":393,"title":{},"content":{"13":{"position":[[62,7]]},"24":{"position":[[136,7]]},"34":{"position":[[34,7]]},"55":{"position":[[34,7]]}},"keywords":{}}],["two",{"_index":179,"title":{},"content":{"5":{"position":[[193,3]]},"9":{"position":[[125,3]]},"15":{"position":[[547,4]]},"17":{"position":[[81,3]]},"20":{"position":[[304,3]]},"22":{"position":[[965,3]]},"30":{"position":[[73,3]]},"31":{"position":[[2853,3]]},"40":{"position":[[402,3]]},"42":{"position":[[1325,3],[1800,3]]},"43":{"position":[[736,3]]},"81":{"position":[[84,3]]},"84":{"position":[[329,3],[671,3]]},"97":{"position":[[108,3]]},"107":{"position":[[19,3]]},"115":{"position":[[1396,3]]},"117":{"position":[[0,3],[744,3]]},"119":{"position":[[1041,4],[1082,3],[1171,3]]},"141":{"position":[[1189,3]]},"162":{"position":[[2442,3]]},"163":{"position":[[103,3]]},"168":{"position":[[1237,3]]},"184":{"position":[[1140,3]]},"185":{"position":[[2609,3]]},"189":{"position":[[632,3]]},"207":{"position":[[7,3]]},"209":{"position":[[193,3]]},"219":{"position":[[11,3]]},"232":{"position":[[84,3]]},"253":{"position":[[329,3],[671,3]]},"258":{"position":[[1342,3]]},"274":{"position":[[19,3]]},"289":{"position":[[108,3]]},"298":{"position":[[0,3],[744,3]]},"300":{"position":[[1041,4],[1082,3],[1171,3]]},"326":{"position":[[1189,3]]},"348":{"position":[[1237,3]]},"351":{"position":[[2464,3]]},"352":{"position":[[103,3]]},"366":{"position":[[632,3]]},"375":{"position":[[1037,3]]},"376":{"position":[[2593,3]]},"388":{"position":[[193,3]]},"427":{"position":[[7,3]]},"440":{"position":[[4654,3]]},"441":{"position":[[4268,3],[4384,3]]},"452":{"position":[[11,3]]},"463":{"position":[[84,3]]},"481":{"position":[[1342,3]]},"484":{"position":[[329,3],[671,3]]},"491":{"position":[[19,3]]},"501":{"position":[[108,3]]},"519":{"position":[[0,3],[744,3]]},"521":{"position":[[1041,4],[1082,3],[1171,3]]},"535":{"position":[[1189,3]]},"564":{"position":[[1237,3]]},"567":{"position":[[2464,3]]},"568":{"position":[[103,3]]},"582":{"position":[[632,3]]},"591":{"position":[[1037,3]]},"592":{"position":[[2593,3]]},"596":{"position":[[907,3],[979,3]]},"616":{"position":[[1181,3]]},"658":{"position":[[193,3]]},"669":{"position":[[7,3]]},"687":{"position":[[4654,3]]},"688":{"position":[[4268,3],[4384,3]]},"692":{"position":[[11,3]]},"704":{"position":[[907,3],[979,3]]},"724":{"position":[[1181,3]]}},"keywords":{}}],["tx",{"_index":1256,"title":{},"content":{"52":{"position":[[1031,2],[1150,2],[1446,2],[3253,3],[4899,3]]},"53":{"position":[[114,2]]},"396":{"position":[[769,3]]},"633":{"position":[[769,3]]}},"keywords":{}}],["txhash",{"_index":1281,"title":{},"content":{"52":{"position":[[3009,7],[4602,7],[6366,7]]},"53":{"position":[[997,7]]}},"keywords":{}}],["ty",{"_index":922,"title":{},"content":{"39":{"position":[[734,3],[2998,2],[3015,2]]}},"keywords":{}}],["ty::parse_plain_type_from_ty(ti",{"_index":1005,"title":{},"content":{"39":{"position":[[3020,32]]}},"keywords":{}}],["type",{"_index":510,"title":{"165":{"position":[[7,6]]},"354":{"position":[[7,6]]},"570":{"position":[[7,6]]},"598":{"position":[[5,6]]},"602":{"position":[[7,6]]},"706":{"position":[[5,6]]},"710":{"position":[[7,6]]}},"content":{"17":{"position":[[1780,4]]},"22":{"position":[[601,4]]},"39":{"position":[[128,7],[1945,6]]},"53":{"position":[[373,5],[550,5],[705,5],[969,5]]},"76":{"position":[[158,5],[243,5],[325,4],[390,5]]},"79":{"position":[[182,4],[233,4]]},"84":{"position":[[349,4]]},"86":{"position":[[159,6]]},"98":{"position":[[171,5],[280,5],[419,5]]},"103":{"position":[[112,5],[230,5],[294,5],[483,5],[552,5]]},"146":{"position":[[544,6]]},"147":{"position":[[1325,4]]},"149":{"position":[[39,5]]},"162":{"position":[[32,4],[199,5],[534,5],[1819,6],[1919,5],[2446,5]]},"163":{"position":[[124,4],[143,5],[1301,4],[1425,5]]},"165":{"position":[[39,5],[115,5],[146,4]]},"174":{"position":[[337,5]]},"182":{"position":[[94,4]]},"185":{"position":[[233,4],[2475,5]]},"195":{"position":[[557,4],[748,5]]},"197":{"position":[[1573,4],[1740,4]]},"198":{"position":[[3974,5]]},"201":{"position":[[122,5]]},"203":{"position":[[494,4]]},"206":{"position":[[3838,5]]},"209":{"position":[[111,4],[482,4],[519,4]]},"220":{"position":[[61,4]]},"227":{"position":[[158,5],[243,5],[325,4],[390,5]]},"230":{"position":[[182,4],[233,4]]},"253":{"position":[[349,4]]},"255":{"position":[[159,6]]},"267":{"position":[[319,5],[632,4],[2457,5]]},"268":{"position":[[2271,5]]},"290":{"position":[[171,5],[280,5],[419,5]]},"295":{"position":[[112,5],[230,5],[294,5],[483,5],[552,5]]},"321":{"position":[[1686,5],[2011,5],[2139,5]]},"324":{"position":[[1124,5],[1297,4],[1322,6]]},"334":{"position":[[548,6]]},"335":{"position":[[1333,4]]},"337":{"position":[[39,5]]},"351":{"position":[[32,4],[199,5],[571,5],[1841,6],[1941,5],[2468,5]]},"352":{"position":[[124,4],[143,5],[1323,4],[1447,5]]},"354":{"position":[[39,5],[115,5],[146,4],[223,5],[505,4],[654,5]]},"360":{"position":[[337,5]]},"373":{"position":[[94,4]]},"376":{"position":[[217,4],[2459,5]]},"383":{"position":[[86,6],[202,5]]},"388":{"position":[[111,4],[472,4],[509,4]]},"407":{"position":[[319,5],[632,4],[2457,5]]},"408":{"position":[[2271,5]]},"421":{"position":[[122,5]]},"423":{"position":[[494,4]]},"426":{"position":[[3813,5]]},"431":{"position":[[557,4],[748,5]]},"433":{"position":[[1572,4],[1739,4]]},"434":{"position":[[3956,5]]},"440":{"position":[[393,4],[3546,4]]},"453":{"position":[[61,4]]},"458":{"position":[[158,5],[243,5],[325,4],[390,5]]},"461":{"position":[[182,4],[233,4]]},"484":{"position":[[349,4]]},"486":{"position":[[159,6]]},"502":{"position":[[171,5],[280,5],[419,5]]},"507":{"position":[[112,5],[230,5],[294,5],[483,5],[552,5]]},"539":{"position":[[1686,5],[2011,5],[2139,5]]},"542":{"position":[[1124,5],[1297,4],[1322,6]]},"551":{"position":[[548,6]]},"552":{"position":[[1333,4]]},"554":{"position":[[39,5]]},"567":{"position":[[32,4],[199,5],[571,5],[1841,6],[1941,5],[2468,5]]},"568":{"position":[[124,4],[143,5],[1323,4],[1447,5]]},"570":{"position":[[39,5],[115,5],[146,4],[223,5],[505,4],[654,5]]},"576":{"position":[[337,5]]},"589":{"position":[[94,4]]},"592":{"position":[[217,4],[2459,5]]},"598":{"position":[[269,4],[335,4],[397,4],[459,4],[1076,5],[1569,5],[1658,6],[1771,4],[1893,5],[1957,4]]},"599":{"position":[[377,5],[400,6]]},"600":{"position":[[493,5]]},"601":{"position":[[1952,4]]},"602":{"position":[[545,5],[2041,5]]},"610":{"position":[[631,4],[662,6]]},"611":{"position":[[777,4],[858,4]]},"613":{"position":[[1670,4],[1886,6],[2055,4],[2144,4]]},"617":{"position":[[1121,4],[1172,4],[1295,4]]},"625":{"position":[[86,6],[202,5]]},"644":{"position":[[319,5],[632,4],[2457,5]]},"645":{"position":[[2271,5]]},"658":{"position":[[111,4],[472,4],[509,4]]},"663":{"position":[[122,5]]},"665":{"position":[[494,4]]},"668":{"position":[[3838,5]]},"678":{"position":[[557,4],[748,5]]},"680":{"position":[[1572,4],[1739,4]]},"681":{"position":[[3974,5]]},"687":{"position":[[393,4],[3546,4]]},"693":{"position":[[61,4]]},"706":{"position":[[269,4],[335,4],[397,4],[459,4],[1076,5],[1569,5],[1658,6],[1771,4],[1893,5],[1957,4]]},"707":{"position":[[377,5],[400,6]]},"708":{"position":[[493,5]]},"709":{"position":[[1952,4]]},"710":{"position":[[545,5],[2041,5]]},"718":{"position":[[631,4],[662,6]]},"719":{"position":[[777,4],[858,4]]},"721":{"position":[[1670,4],[1886,6],[2055,4],[2144,4]]},"725":{"position":[[1121,4],[1172,4],[1295,4]]}},"keywords":{}}],["type.attached_valu",{"_index":1689,"title":{},"content":{"103":{"position":[[457,20]]},"295":{"position":[[457,20]]},"507":{"position":[[457,20]]}},"keywords":{}}],["type.cltyp",{"_index":3078,"title":{},"content":{"354":{"position":[[481,11]]},"570":{"position":[[481,11]]}},"keywords":{}}],["typeinfo",{"_index":980,"title":{},"content":{"39":{"position":[[2390,8]]}},"keywords":{}}],["types::address",{"_index":463,"title":{},"content":{"17":{"position":[[354,15],[1876,15]]},"42":{"position":[[2043,16]]}},"keywords":{}}],["types::storedvalu",{"_index":2612,"title":{},"content":{"212":{"position":[[75,19]]},"391":{"position":[[75,19]]},"661":{"position":[[75,19]]}},"keywords":{}}],["typescript",{"_index":3595,"title":{},"content":{"478":{"position":[[255,11]]},"700":{"position":[[255,11]]}},"keywords":{}}],["typic",{"_index":1436,"title":{},"content":{"79":{"position":[[138,9]]},"230":{"position":[[138,9]]},"324":{"position":[[1553,9]]},"461":{"position":[[138,9]]},"542":{"position":[[1553,9]]}},"keywords":{}}],["u",{"_index":3625,"title":{},"content":{"598":{"position":[[212,2]]},"706":{"position":[[212,2]]}},"keywords":{}}],["u128",{"_index":3662,"title":{},"content":{"598":{"position":[[1684,5]]},"706":{"position":[[1684,5]]}},"keywords":{}}],["u16",{"_index":3661,"title":{},"content":{"598":{"position":[[1669,4]]},"706":{"position":[[1669,4]]}},"keywords":{}}],["u2",{"_index":3628,"title":{},"content":{"598":{"position":[[274,3]]},"706":{"position":[[274,3]]}},"keywords":{}}],["u256",{"_index":511,"title":{},"content":{"17":{"position":[[1785,5],[1932,6],[2321,5],[2542,4],[2637,4],[2738,5],[3151,5],[3748,5],[3910,4]]},"39":{"position":[[2069,5]]},"71":{"position":[[152,4]]},"79":{"position":[[899,4]]},"115":{"position":[[420,5],[639,6],[726,6],[789,6],[946,5],[1003,5],[1077,5],[1263,5],[2263,5],[2537,6],[2595,5],[2863,5]]},"126":{"position":[[2015,4]]},"204":{"position":[[150,5],[560,4],[985,4]]},"205":{"position":[[985,4],[1115,4],[2170,4]]},"209":{"position":[[731,5],[1028,5],[1043,5]]},"212":{"position":[[160,5],[620,5]]},"230":{"position":[[916,4]]},"235":{"position":[[152,4]]},"247":{"position":[[185,5],[536,4],[629,4],[747,4]]},"258":{"position":[[410,5],[625,6],[708,6],[767,6],[908,5],[961,5],[1031,5],[1209,5],[2209,5],[2479,6],[2533,5],[2789,5]]},"267":{"position":[[1685,4],[3933,5]]},"269":{"position":[[1861,4],[3488,4],[3609,4]]},"277":{"position":[[2183,4]]},"383":{"position":[[1207,4]]},"384":{"position":[[1881,4],[3498,4],[3595,4]]},"388":{"position":[[663,5],[960,5],[975,5]]},"391":{"position":[[160,5],[620,5]]},"407":{"position":[[1685,4],[3933,5]]},"409":{"position":[[1861,4],[3488,4],[3609,4]]},"416":{"position":[[867,5],[1477,5],[2709,5]]},"419":{"position":[[279,5],[1450,5],[2614,5],[2720,5],[2877,5],[3996,5],[4664,5]]},"424":{"position":[[125,5],[535,4],[936,4]]},"425":{"position":[[960,4],[1090,4],[2121,4]]},"446":{"position":[[185,5],[536,4],[629,4],[747,4]]},"461":{"position":[[916,4]]},"471":{"position":[[152,4]]},"481":{"position":[[410,5],[625,6],[708,6],[767,6],[908,5],[961,5],[1031,5],[1209,5],[2209,5],[2479,6],[2533,5],[2789,5]]},"514":{"position":[[2015,4]]},"598":{"position":[[82,6],[298,4],[1269,4],[1694,4]]},"599":{"position":[[61,6],[168,4]]},"601":{"position":[[243,4],[494,5],[697,6],[806,5],[934,5],[1046,5]]},"611":{"position":[[259,5]]},"613":{"position":[[134,5],[146,4],[417,5],[429,4],[2227,4]]},"616":{"position":[[60,6],[231,5]]},"625":{"position":[[1207,4]]},"626":{"position":[[1881,4],[3498,4],[3595,4]]},"644":{"position":[[1685,4],[3933,5]]},"646":{"position":[[1861,4],[3488,4],[3609,4]]},"653":{"position":[[867,5],[1477,5],[2709,5]]},"656":{"position":[[279,5],[1450,5],[2614,5],[2720,5],[2877,5],[3996,5],[4664,5]]},"658":{"position":[[663,5],[960,5],[975,5]]},"661":{"position":[[160,5],[620,5]]},"666":{"position":[[125,5],[535,4],[936,4]]},"667":{"position":[[960,4],[1090,4],[2121,4]]},"673":{"position":[[185,5],[536,4],[629,4],[747,4]]},"706":{"position":[[82,6],[298,4],[1269,4],[1694,4]]},"707":{"position":[[61,6],[168,4]]},"709":{"position":[[243,4],[494,5],[697,6],[806,5],[934,5],[1046,5]]},"719":{"position":[[259,5]]},"721":{"position":[[134,5],[146,4],[417,5],[429,4],[2227,4]]},"724":{"position":[[60,6],[231,5]]}},"keywords":{}}],["u256>",{"_index":519,"title":{},"content":{"17":{"position":[[2132,9],[2182,8]]},"84":{"position":[[288,8]]},"203":{"position":[[290,9],[343,8]]},"253":{"position":[[288,8]]},"267":{"position":[[1146,8]]},"269":{"position":[[458,9],[511,8]]},"384":{"position":[[471,9],[524,8]]},"407":{"position":[[1146,8]]},"409":{"position":[[458,9],[511,8]]},"423":{"position":[[290,9],[343,8]]},"484":{"position":[[288,8]]},"626":{"position":[[471,9],[524,8]]},"644":{"position":[[1146,8]]},"646":{"position":[[458,9],[511,8]]},"665":{"position":[[290,9],[343,8]]}},"keywords":{}}],["u256>>",{"_index":2833,"title":{},"content":{"267":{"position":[[1009,12]]},"407":{"position":[[1009,12]]},"644":{"position":[[1009,12]]}},"keywords":{}}],["u256([123",{"_index":3669,"title":{},"content":{"599":{"position":[[175,10]]},"707":{"position":[[175,10]]}},"keywords":{}}],["u256)>",{"_index":3221,"title":{},"content":{"416":{"position":[[553,10]]},"419":{"position":[[924,10]]},"653":{"position":[[553,10]]},"656":{"position":[[924,10]]}},"keywords":{}}],["u256::from(1000",{"_index":1836,"title":{},"content":{"126":{"position":[[3230,18]]},"277":{"position":[[3398,18]]},"417":{"position":[[649,18],[1120,18],[1436,18]]},"419":{"position":[[7064,18],[7535,18],[7851,18]]},"514":{"position":[[3230,18]]},"654":{"position":[[649,18],[1120,18],[1436,18]]},"656":{"position":[[7064,18],[7535,18],[7851,18]]}},"keywords":{}}],["u256::from(10000000",{"_index":770,"title":{},"content":{"31":{"position":[[1579,21],[1873,21]]}},"keywords":{}}],["u256::from(10_000",{"_index":1817,"title":{},"content":{"126":{"position":[[2022,19]]},"277":{"position":[[2190,19]]},"514":{"position":[[2022,19]]}},"keywords":{}}],["u256::from(1_000",{"_index":3131,"title":{},"content":{"395":{"position":[[1135,19],[1235,19],[1962,18]]},"632":{"position":[[1135,19],[1235,19],[1962,18]]}},"keywords":{}}],["u256::from(1_000u64",{"_index":3276,"title":{},"content":{"417":{"position":[[321,21]]},"419":{"position":[[6736,21]]},"654":{"position":[[321,21]]},"656":{"position":[[6736,21]]}},"keywords":{}}],["u256::from(2000",{"_index":3279,"title":{},"content":{"417":{"position":[[613,18],[967,18],[1282,18],[1318,18]]},"419":{"position":[[7028,18],[7382,18],[7697,18],[7733,18]]},"654":{"position":[[613,18],[967,18],[1282,18],[1318,18]]},"656":{"position":[[7028,18],[7382,18],[7697,18],[7733,18]]}},"keywords":{}}],["u256::from(4000",{"_index":3288,"title":{},"content":{"417":{"position":[[1602,18]]},"419":{"position":[[8017,18]]},"654":{"position":[[1602,18]]},"656":{"position":[[8017,18]]}},"keywords":{}}],["u256::from(initial_suppli",{"_index":2517,"title":{},"content":{"206":{"position":[[1427,26],[1906,26],[2330,28],[2885,26]]},"269":{"position":[[5337,26],[5816,26]]},"409":{"position":[[5337,26],[5816,26]]},"426":{"position":[[1422,26],[1896,26],[2320,28],[2870,26]]},"646":{"position":[[5337,26],[5816,26]]},"668":{"position":[[1427,26],[1906,26],[2330,28],[2885,26]]}},"keywords":{}}],["u256::from_bytes(&bytes).unwrap",{"_index":2645,"title":{},"content":{"212":{"position":[[2184,38]]},"391":{"position":[[2184,38]]},"661":{"position":[[2184,38]]}},"keywords":{}}],["u256::max",{"_index":3652,"title":{},"content":{"598":{"position":[[1052,10]]},"706":{"position":[[1052,10]]}},"keywords":{}}],["u256::on",{"_index":758,"title":{},"content":{"31":{"position":[[1265,12],[1557,12],[1851,12]]},"206":{"position":[[1935,12]]},"269":{"position":[[5845,12]]},"409":{"position":[[5845,12]]},"426":{"position":[[1925,12]]},"613":{"position":[[293,12]]},"646":{"position":[[5845,12]]},"668":{"position":[[1935,12]]},"721":{"position":[[293,12]]}},"keywords":{}}],["u256::zero",{"_index":746,"title":{},"content":{"31":{"position":[[1008,13],[1302,13],[2570,13]]},"416":{"position":[[1748,12],[3953,13],[3986,13]]},"417":{"position":[[758,14]]},"419":{"position":[[4265,12],[5532,13],[5565,13],[7173,14]]},"598":{"position":[[1023,13]]},"613":{"position":[[274,12]]},"653":{"position":[[1748,12],[3953,13],[3986,13]]},"654":{"position":[[758,14]]},"656":{"position":[[4265,12],[5532,13],[5565,13],[7173,14]]},"706":{"position":[[1023,13]]},"721":{"position":[[274,12]]}},"keywords":{}}],["u32",{"_index":838,"title":{},"content":{"32":{"position":[[1143,3],[1543,3]]},"51":{"position":[[121,3],[622,4],[1070,3],[1211,4],[1231,4],[1312,4]]},"73":{"position":[[186,4]]},"79":{"position":[[732,4],[1013,4]]},"80":{"position":[[399,3],[486,3]]},"141":{"position":[[1279,4],[1288,4],[1299,4]]},"162":{"position":[[812,4],[1047,3],[1188,3],[1250,3],[1299,3]]},"163":{"position":[[558,3],[987,3]]},"164":{"position":[[722,3],[790,3],[865,4]]},"206":{"position":[[254,3]]},"209":{"position":[[1276,4]]},"211":{"position":[[199,4],[332,4]]},"212":{"position":[[1858,3],[2545,3],[2851,3],[3812,4]]},"223":{"position":[[761,3]]},"230":{"position":[[749,4],[1030,4]]},"231":{"position":[[399,3],[486,3]]},"237":{"position":[[186,4]]},"269":{"position":[[4158,3]]},"326":{"position":[[1279,4],[1288,4],[1299,4]]},"351":{"position":[[834,4],[1069,3],[1210,3],[1272,3],[1321,3]]},"352":{"position":[[580,3],[1009,3]]},"353":{"position":[[757,3],[825,3],[900,4]]},"388":{"position":[[1208,4]]},"390":{"position":[[199,4],[319,4]]},"391":{"position":[[1858,3],[2545,3],[2857,3],[3830,4]]},"409":{"position":[[4158,3]]},"426":{"position":[[254,3]]},"456":{"position":[[761,3]]},"461":{"position":[[749,4],[1030,4]]},"462":{"position":[[399,3],[486,3]]},"473":{"position":[[186,4]]},"535":{"position":[[1279,4],[1288,4],[1299,4]]},"567":{"position":[[834,4],[1069,3],[1210,3],[1272,3],[1321,3]]},"568":{"position":[[580,3],[1009,3]]},"569":{"position":[[757,3],[825,3],[900,4]]},"598":{"position":[[1674,4]]},"601":{"position":[[1541,4]]},"602":{"position":[[1425,4],[1594,4],[1792,4]]},"605":{"position":[[154,4],[165,3],[217,4],[225,4],[236,3]]},"606":{"position":[[195,4],[206,3]]},"646":{"position":[[4158,3]]},"658":{"position":[[1208,4]]},"660":{"position":[[199,4],[319,4]]},"661":{"position":[[1858,3],[2545,3],[2857,3],[3830,4]]},"668":{"position":[[254,3]]},"696":{"position":[[761,3]]},"706":{"position":[[1674,4]]},"709":{"position":[[1541,4]]},"710":{"position":[[1425,4],[1594,4],[1792,4]]},"713":{"position":[[154,4],[165,3],[217,4],[225,4],[236,3]]},"714":{"position":[[195,4],[206,3]]}},"keywords":{}}],["u32>",{"_index":2085,"title":{},"content":{"163":{"position":[[456,8]]},"209":{"position":[[1689,8]]},"352":{"position":[[478,8]]},"388":{"position":[[1621,8]]},"568":{"position":[[478,8]]},"658":{"position":[[1621,8]]}},"keywords":{}}],["u32::from_bytes(&bytes).unwrap",{"_index":2642,"title":{},"content":{"212":{"position":[[1977,37]]},"391":{"position":[[1977,37]]},"661":{"position":[[1977,37]]}},"keywords":{}}],["u32::from_bytes(&bytes).unwrap().0",{"_index":2653,"title":{},"content":{"212":{"position":[[2767,38],[3181,38]]},"391":{"position":[[2773,38],[3199,38]]},"661":{"position":[[2773,38],[3199,38]]}},"keywords":{}}],["u32::from_str_radix(&result",{"_index":848,"title":{},"content":{"32":{"position":[[1624,32]]}},"keywords":{}}],["u512",{"_index":1491,"title":{},"content":{"80":{"position":[[614,4],[782,5]]},"103":{"position":[[478,4],[547,4]]},"168":{"position":[[1694,4]]},"231":{"position":[[614,4],[782,5]]},"295":{"position":[[478,4],[547,4]]},"348":{"position":[[1694,4]]},"440":{"position":[[546,5],[666,5],[1676,5],[3279,4]]},"441":{"position":[[1561,4],[2888,5],[3184,5]]},"462":{"position":[[614,4],[782,5]]},"476":{"position":[[745,4],[1401,4],[1794,4],[1896,4]]},"477":{"position":[[1469,6]]},"507":{"position":[[478,4],[547,4]]},"564":{"position":[[1694,4]]},"608":{"position":[[558,5]]},"611":{"position":[[57,7],[402,5]]},"687":{"position":[[546,5],[666,5],[1676,5],[3279,4]]},"688":{"position":[[1561,4],[2888,5],[3184,5]]},"698":{"position":[[745,4],[1401,4],[1794,4],[1896,4]]},"699":{"position":[[1469,6]]},"716":{"position":[[558,5]]},"719":{"position":[[57,7],[402,5]]}},"keywords":{}}],["u512>",{"_index":3537,"title":{},"content":{"476":{"position":[[307,9]]},"698":{"position":[[307,9]]}},"keywords":{}}],["u512::from(100",{"_index":2042,"title":{},"content":{"160":{"position":[[585,17]]},"345":{"position":[[585,17]]},"440":{"position":[[5262,17]]},"441":{"position":[[5226,17]]},"562":{"position":[[585,17]]},"687":{"position":[[5262,17]]},"688":{"position":[[5226,17]]}},"keywords":{}}],["u512::from(150",{"_index":3531,"title":{},"content":{"441":{"position":[[5695,17]]},"688":{"position":[[5695,17]]}},"keywords":{}}],["u512::from(50",{"_index":3446,"title":{},"content":{"440":{"position":[[5330,16]]},"441":{"position":[[5299,16]]},"687":{"position":[[5330,16]]},"688":{"position":[[5299,16]]}},"keywords":{}}],["u512::from(75",{"_index":2044,"title":{},"content":{"160":{"position":[[696,16]]},"345":{"position":[[696,16]]},"562":{"position":[[696,16]]}},"keywords":{}}],["u512::zero",{"_index":2040,"title":{},"content":{"160":{"position":[[463,14]]},"345":{"position":[[463,14]]},"562":{"position":[[463,14]]}},"keywords":{}}],["u64",{"_index":243,"title":{},"content":{"8":{"position":[[302,3],[368,3]]},"9":{"position":[[145,3],[162,3],[825,3]]},"71":{"position":[[212,3]]},"115":{"position":[[2284,4],[2800,5]]},"168":{"position":[[1813,4]]},"235":{"position":[[212,3]]},"258":{"position":[[2230,4],[2726,5]]},"348":{"position":[[1813,4]]},"440":{"position":[[409,4],[1243,4],[1895,3],[3561,4]]},"441":{"position":[[5788,4]]},"471":{"position":[[212,3]]},"476":{"position":[[532,4],[805,3],[1507,3]]},"477":{"position":[[1631,3],[1660,3],[1681,3]]},"481":{"position":[[2230,4],[2726,5]]},"564":{"position":[[1813,4]]},"598":{"position":[[1679,4]]},"687":{"position":[[409,4],[1243,4],[1895,3],[3561,4]]},"688":{"position":[[5788,4]]},"698":{"position":[[532,4],[805,3],[1507,3]]},"699":{"position":[[1631,3],[1660,3],[1681,3]]},"706":{"position":[[1679,4]]}},"keywords":{}}],["u64>",{"_index":3539,"title":{},"content":{"476":{"position":[[358,8]]},"698":{"position":[[358,8]]}},"keywords":{}}],["u64.eventdata",{"_index":2829,"title":{},"content":{"267":{"position":[[723,13]]},"407":{"position":[[723,13]]},"644":{"position":[[723,13]]}},"keywords":{}}],["u64::max",{"_index":789,"title":{},"content":{"31":{"position":[[2613,9]]}},"keywords":{}}],["u8",{"_index":520,"title":{},"content":{"17":{"position":[[2303,3]]},"85":{"position":[[119,2]]},"115":{"position":[[400,3],[905,3],[2243,3]]},"165":{"position":[[273,3]]},"185":{"position":[[245,4]]},"204":{"position":[[130,3],[485,2]]},"206":{"position":[[223,2]]},"212":{"position":[[4073,4]]},"247":{"position":[[165,3],[470,2]]},"254":{"position":[[119,2]]},"258":{"position":[[390,3],[871,3],[2189,3]]},"267":{"position":[[2641,4]]},"269":{"position":[[619,3],[4127,2]]},"354":{"position":[[311,3]]},"376":{"position":[[229,4]]},"383":{"position":[[397,3]]},"384":{"position":[[632,3]]},"391":{"position":[[4091,4]]},"407":{"position":[[2641,4]]},"409":{"position":[[619,3],[4127,2]]},"419":{"position":[[1430,3],[2534,3]]},"424":{"position":[[105,3],[460,2]]},"426":{"position":[[223,2]]},"446":{"position":[[165,3],[470,2]]},"481":{"position":[[390,3],[871,3],[2189,3]]},"485":{"position":[[119,2]]},"570":{"position":[[311,3]]},"592":{"position":[[229,4]]},"598":{"position":[[233,2],[1665,3]]},"601":{"position":[[1464,4],[1772,3],[1783,3]]},"616":{"position":[[258,4]]},"625":{"position":[[397,3]]},"626":{"position":[[632,3]]},"644":{"position":[[2641,4]]},"646":{"position":[[619,3],[4127,2]]},"656":{"position":[[1430,3],[2534,3]]},"661":{"position":[[4091,4]]},"666":{"position":[[105,3],[460,2]]},"668":{"position":[[223,2]]},"673":{"position":[[165,3],[470,2]]},"706":{"position":[[233,2],[1665,3]]},"709":{"position":[[1464,4],[1772,3],[1783,3]]},"724":{"position":[[258,4]]}},"keywords":{}}],["uint256",{"_index":692,"title":{},"content":{"30":{"position":[[213,7],[244,9],[317,9]]},"39":{"position":[[1836,7]]},"43":{"position":[[276,7],[409,7],[513,7]]},"613":{"position":[[1675,9]]},"721":{"position":[[1675,9]]}},"keywords":{}}],["ultim",{"_index":889,"title":{},"content":{"38":{"position":[[960,11]]},"93":{"position":[[180,10]]},"285":{"position":[[180,10]]},"497":{"position":[[180,10]]}},"keywords":{}}],["unambigu",{"_index":943,"title":{},"content":{"39":{"position":[[1200,11]]}},"keywords":{}}],["unauthor",{"_index":1377,"title":{},"content":{"72":{"position":[[171,12]]},"184":{"position":[[1189,12]]},"185":{"position":[[3989,12]]},"236":{"position":[[171,12]]},"375":{"position":[[1086,12]]},"376":{"position":[[3973,12]]},"441":{"position":[[2324,12],[4431,13]]},"472":{"position":[[171,12]]},"591":{"position":[[1086,12]]},"592":{"position":[[3973,12]]},"688":{"position":[[2324,12],[4431,13]]}},"keywords":{}}],["unchecked_*_rol",{"_index":2279,"title":{},"content":{"185":{"position":[[3948,19]]},"376":{"position":[[3932,19]]},"592":{"position":[[3932,19]]}},"keywords":{}}],["unchecked_grant_rol",{"_index":2269,"title":{},"content":{"185":{"position":[[3474,22],[3662,22]]},"376":{"position":[[3458,22],[3646,22]]},"592":{"position":[[3458,22],[3646,22]]}},"keywords":{}}],["unchecked_grant_role(&mut",{"_index":2241,"title":{},"content":{"185":{"position":[[1907,29]]},"376":{"position":[[1891,29]]},"592":{"position":[[1891,29]]}},"keywords":{}}],["unchecked_revoke_rol",{"_index":2270,"title":{},"content":{"185":{"position":[[3501,23]]},"376":{"position":[[3485,23]]},"592":{"position":[[3485,23]]}},"keywords":{}}],["unchecked_revoke_role(&mut",{"_index":2244,"title":{},"content":{"185":{"position":[[2177,30]]},"376":{"position":[[2161,30]]},"592":{"position":[[2161,30]]}},"keywords":{}}],["uncom",{"_index":1827,"title":{},"content":{"126":{"position":[[2613,9]]},"277":{"position":[[2781,9]]},"514":{"position":[[2613,9]]}},"keywords":{}}],["uncompl",{"_index":2699,"title":{},"content":{"219":{"position":[[139,14]]},"452":{"position":[[139,14]]},"692":{"position":[[139,14]]}},"keywords":{}}],["uncondit",{"_index":2777,"title":{},"content":{"247":{"position":[[1864,14]]},"446":{"position":[[1864,14]]},"673":{"position":[[1864,14]]}},"keywords":{}}],["under",{"_index":763,"title":{},"content":{"31":{"position":[[1414,5]]},"32":{"position":[[513,5]]},"52":{"position":[[2276,5]]},"65":{"position":[[494,5]]},"84":{"position":[[834,5]]},"91":{"position":[[203,5],[651,5]]},"92":{"position":[[216,5],[658,5]]},"94":{"position":[[676,5]]},"98":{"position":[[185,5]]},"102":{"position":[[86,5]]},"108":{"position":[[252,5]]},"162":{"position":[[107,5]]},"240":{"position":[[494,5]]},"253":{"position":[[834,5]]},"275":{"position":[[256,5]]},"283":{"position":[[203,5],[651,5]]},"284":{"position":[[216,5],[658,5]]},"286":{"position":[[676,5]]},"290":{"position":[[185,5]]},"294":{"position":[[86,5]]},"351":{"position":[[107,5]]},"395":{"position":[[4623,5]]},"465":{"position":[[494,5]]},"477":{"position":[[2637,5]]},"484":{"position":[[834,5]]},"492":{"position":[[256,5]]},"495":{"position":[[203,5],[651,5]]},"496":{"position":[[216,5],[658,5]]},"498":{"position":[[676,5]]},"502":{"position":[[185,5]]},"506":{"position":[[86,5]]},"567":{"position":[[107,5]]},"632":{"position":[[4623,5]]},"699":{"position":[[2637,5]]}},"keywords":{}}],["understand",{"_index":101,"title":{},"content":{"2":{"position":[[220,10]]},"7":{"position":[[166,10]]},"18":{"position":[[11,11]]},"38":{"position":[[287,13]]},"81":{"position":[[299,13]]},"97":{"position":[[260,10]]},"114":{"position":[[254,11]]},"115":{"position":[[48,14]]},"164":{"position":[[308,10]]},"195":{"position":[[204,10]]},"211":{"position":[[46,10]]},"232":{"position":[[299,13]]},"257":{"position":[[254,11]]},"258":{"position":[[48,14]]},"262":{"position":[[75,10]]},"270":{"position":[[344,13]]},"289":{"position":[[260,10]]},"353":{"position":[[343,10]]},"380":{"position":[[75,10]]},"385":{"position":[[344,13]]},"390":{"position":[[46,10]]},"402":{"position":[[75,10]]},"410":{"position":[[344,13]]},"431":{"position":[[204,10]]},"463":{"position":[[299,13]]},"480":{"position":[[254,11]]},"481":{"position":[[48,14]]},"501":{"position":[[260,10]]},"569":{"position":[[343,10]]},"595":{"position":[[121,13]]},"618":{"position":[[112,13]]},"622":{"position":[[75,10]]},"627":{"position":[[344,13]]},"639":{"position":[[75,10]]},"647":{"position":[[344,13]]},"660":{"position":[[46,10]]},"678":{"position":[[204,10]]},"703":{"position":[[121,13]]},"726":{"position":[[112,13]]}},"keywords":{}}],["understood",{"_index":1538,"title":{},"content":{"85":{"position":[[353,10]]},"254":{"position":[[353,10]]},"485":{"position":[[353,10]]}},"keywords":{}}],["unexpect",{"_index":3773,"title":{},"content":{"606":{"position":[[1121,10]]},"617":{"position":[[1363,10]]},"714":{"position":[[1121,10]]},"725":{"position":[[1363,10]]}},"keywords":{}}],["unfortun",{"_index":3113,"title":{},"content":{"394":{"position":[[155,14]]},"440":{"position":[[5795,14]]},"631":{"position":[[155,14]]},"687":{"position":[[5795,14]]}},"keywords":{}}],["uni",{"_index":1239,"title":{},"content":{"52":{"position":[[676,3]]},"53":{"position":[[237,3]]}},"keywords":{}}],["unifi",{"_index":1317,"title":{},"content":{"54":{"position":[[290,7]]}},"keywords":{}}],["uniniti",{"_index":2373,"title":{},"content":{"197":{"position":[[1394,13]]},"433":{"position":[[1393,13]]},"680":{"position":[[1393,13]]}},"keywords":{}}],["uniqu",{"_index":1421,"title":{},"content":{"76":{"position":[[520,8],[660,6]]},"79":{"position":[[457,6]]},"189":{"position":[[183,6]]},"227":{"position":[[520,8],[660,6]]},"230":{"position":[[474,6]]},"366":{"position":[[183,6]]},"458":{"position":[[520,8],[660,6]]},"461":{"position":[[474,6]]},"582":{"position":[[183,6]]}},"keywords":{}}],["uniswap",{"_index":550,"title":{},"content":{"18":{"position":[[102,7]]}},"keywords":{}}],["unit",{"_index":1887,"title":{},"content":{"131":{"position":[[452,5]]},"248":{"position":[[116,5]]},"265":{"position":[[862,5]]},"311":{"position":[[504,5]]},"354":{"position":[[540,4]]},"395":{"position":[[3542,5]]},"405":{"position":[[862,5]]},"417":{"position":[[53,4]]},"447":{"position":[[116,5]]},"528":{"position":[[504,5]]},"570":{"position":[[540,4]]},"598":{"position":[[2013,5]]},"601":{"position":[[1928,5]]},"632":{"position":[[3542,5]]},"642":{"position":[[862,5]]},"654":{"position":[[53,4]]},"674":{"position":[[116,5]]},"706":{"position":[[2013,5]]},"709":{"position":[[1928,5]]}},"keywords":{}}],["unit_only_enum.r",{"_index":3081,"title":{},"content":{"354":{"position":[[577,17]]},"570":{"position":[[577,17]]}},"keywords":{}}],["univers",{"_index":582,"title":{},"content":{"20":{"position":[[308,10],[673,8]]},"40":{"position":[[21,9]]}},"keywords":{}}],["unknown",{"_index":1326,"title":{},"content":{"65":{"position":[[133,7],[141,7],[460,7],[706,7]]},"68":{"position":[[271,7],[279,7],[336,7]]},"128":{"position":[[524,7]]},"173":{"position":[[415,7],[423,7],[444,7],[452,7]]},"240":{"position":[[133,7],[141,7],[460,7],[706,7]]},"243":{"position":[[271,7],[279,7],[336,7]]},"279":{"position":[[524,7]]},"359":{"position":[[415,7],[423,7],[444,7],[452,7]]},"465":{"position":[[133,7],[141,7],[460,7],[706,7]]},"468":{"position":[[271,7],[279,7],[336,7]]},"516":{"position":[[524,7]]},"575":{"position":[[415,7],[423,7],[444,7],[452,7]]}},"keywords":{}}],["unknown/debug/my_project_build_contract.wasm",{"_index":1347,"title":{},"content":{"68":{"position":[[344,44]]},"243":{"position":[[344,44]]},"468":{"position":[[344,44]]}},"keywords":{}}],["unknown/releas",{"_index":1334,"title":{},"content":{"65":{"position":[[468,15]]},"240":{"position":[[468,15]]},"465":{"position":[[468,15]]}},"keywords":{}}],["unknown/release/my_project_build_contract.wasm",{"_index":1338,"title":{},"content":{"65":{"position":[[714,46]]},"240":{"position":[[714,46]]},"465":{"position":[[714,46]]}},"keywords":{}}],["unknownticketoffic",{"_index":3478,"title":{},"content":{"441":{"position":[[709,19]]},"688":{"position":[[709,19]]}},"keywords":{}}],["unleash",{"_index":635,"title":{},"content":{"21":{"position":[[303,7]]},"248":{"position":[[202,7]]},"447":{"position":[[202,7]]},"618":{"position":[[377,7]]},"674":{"position":[[202,7]]},"726":{"position":[[377,7]]}},"keywords":{}}],["unless",{"_index":1018,"title":{},"content":{"40":{"position":[[194,6]]}},"keywords":{}}],["unlock",{"_index":3769,"title":{},"content":{"606":{"position":[[742,6]]},"714":{"position":[[742,6]]}},"keywords":{}}],["unlock(&mut",{"_index":3767,"title":{},"content":{"606":{"position":[[477,15]]},"714":{"position":[[477,15]]}},"keywords":{}}],["unpaus",{"_index":2700,"title":{},"content":{"219":{"position":[[165,8],[515,8]]},"220":{"position":[[177,11]]},"222":{"position":[[404,9],[480,9],[518,11]]},"452":{"position":[[165,8],[446,8]]},"453":{"position":[[177,11]]},"455":{"position":[[404,9],[480,9],[518,11]]},"692":{"position":[[165,8],[446,8]]},"693":{"position":[[177,11]]},"695":{"position":[[404,9],[480,9],[518,11]]}},"keywords":{}}],["unpause(&mut",{"_index":2725,"title":{},"content":{"222":{"position":[[246,16]]},"223":{"position":[[674,16]]},"455":{"position":[[246,16]]},"456":{"position":[[674,16]]},"695":{"position":[[246,16]]},"696":{"position":[[674,16]]}},"keywords":{}}],["unpausedrequir",{"_index":2698,"title":{},"content":{"219":{"position":[[54,17],[355,16]]},"452":{"position":[[54,17],[334,16]]},"692":{"position":[[54,17],[334,16]]}},"keywords":{}}],["unseen",{"_index":555,"title":{},"content":{"18":{"position":[[253,6]]}},"keywords":{}}],["unsign",{"_index":3627,"title":{},"content":{"598":{"position":[[252,8],[318,8],[1703,8]]},"706":{"position":[[252,8],[318,8],[1703,8]]}},"keywords":{}}],["unsuit",{"_index":1504,"title":{},"content":{"83":{"position":[[164,10]]},"252":{"position":[[164,10]]},"483":{"position":[[164,10]]}},"keywords":{}}],["until",{"_index":1819,"title":{},"content":{"126":{"position":[[2201,5]]},"277":{"position":[[2369,5]]},"416":{"position":[[3254,5]]},"514":{"position":[[2201,5]]},"653":{"position":[[3254,5]]}},"keywords":{}}],["unwrap",{"_index":767,"title":{},"content":{"31":{"position":[[1523,10],[1817,10],[2477,10],[2559,10]]},"162":{"position":[[1604,6]]},"212":{"position":[[817,9],[852,10],[1194,9]]},"351":{"position":[[1626,6]]},"391":{"position":[[817,9],[852,10],[1194,9]]},"567":{"position":[[1626,6]]},"601":{"position":[[366,6]]},"661":{"position":[[817,9],[852,10],[1194,9]]},"709":{"position":[[366,6]]}},"keywords":{}}],["unwrap_or_revert",{"_index":2891,"title":{},"content":{"267":{"position":[[4199,16]]},"407":{"position":[[4199,16]]},"644":{"position":[[4199,16]]}},"keywords":{}}],["unwrap_or_revert(&env",{"_index":3392,"title":{},"content":{"440":{"position":[[1956,28]]},"687":{"position":[[1956,28]]}},"keywords":{}}],["unwrap_or_revert(&self.env",{"_index":3648,"title":{},"content":{"598":{"position":[[928,35]]},"706":{"position":[[928,35]]}},"keywords":{}}],["unwrap_or_revert_with",{"_index":2892,"title":{},"content":{"267":{"position":[[4220,21]]},"407":{"position":[[4220,21]]},"644":{"position":[[4220,21]]}},"keywords":{}}],["unwrap_or_revert_with(&env",{"_index":3404,"title":{},"content":{"440":{"position":[[2625,32]]},"441":{"position":[[1257,32]]},"687":{"position":[[2625,32]]},"688":{"position":[[1257,32]]}},"keywords":{}}],["unwrap_or_revert_with(&self.env",{"_index":3511,"title":{},"content":{"441":{"position":[[3721,39]]},"688":{"position":[[3721,39]]}},"keywords":{}}],["unwraporrevert",{"_index":1448,"title":{},"content":{"79":{"position":[[590,16]]},"230":{"position":[[607,16]]},"267":{"position":[[4162,14]]},"407":{"position":[[4162,14]]},"440":{"position":[[198,14]]},"441":{"position":[[650,15]]},"461":{"position":[[607,16]]},"598":{"position":[[126,15]]},"613":{"position":[[56,15]]},"616":{"position":[[88,15]]},"644":{"position":[[4162,14]]},"687":{"position":[[198,14]]},"688":{"position":[[650,15]]},"706":{"position":[[126,15]]},"721":{"position":[[56,15]]},"724":{"position":[[88,15]]}},"keywords":{}}],["up",{"_index":1029,"title":{"68":{"position":[[9,3]]},"243":{"position":[[9,3]]},"468":{"position":[[9,3]]}},"content":{"42":{"position":[[166,2]]},"92":{"position":[[337,2]]},"102":{"position":[[211,5],[502,3]]},"119":{"position":[[445,2]]},"129":{"position":[[643,2]]},"280":{"position":[[644,2]]},"284":{"position":[[337,2]]},"294":{"position":[[211,5],[502,3]]},"300":{"position":[[445,2]]},"393":{"position":[[150,2]]},"395":{"position":[[130,2],[4461,2]]},"396":{"position":[[327,2]]},"477":{"position":[[56,3]]},"496":{"position":[[337,2]]},"506":{"position":[[211,5],[502,3]]},"517":{"position":[[644,2]]},"521":{"position":[[445,2]]},"630":{"position":[[150,2]]},"632":{"position":[[130,2],[4461,2]]},"633":{"position":[[327,2]]},"699":{"position":[[56,3]]}},"keywords":{}}],["upcom",{"_index":2429,"title":{},"content":{"199":{"position":[[143,8]]},"435":{"position":[[143,8]]},"682":{"position":[[143,8]]}},"keywords":{}}],["updat",{"_index":1322,"title":{"261":{"position":[[5,6]]},"265":{"position":[[5,6]]},"266":{"position":[[5,6]]},"267":{"position":[[5,6]]},"268":{"position":[[5,6]]},"379":{"position":[[5,6]]},"382":{"position":[[4,6]]},"383":{"position":[[4,6]]},"401":{"position":[[5,6]]},"405":{"position":[[5,6]]},"406":{"position":[[5,6]]},"407":{"position":[[5,6]]},"408":{"position":[[5,6]]},"621":{"position":[[5,6]]},"624":{"position":[[4,6]]},"625":{"position":[[4,6]]},"638":{"position":[[5,6]]},"642":{"position":[[5,6]]},"643":{"position":[[5,6]]},"644":{"position":[[5,6]]},"645":{"position":[[5,6]]}},"content":{"54":{"position":[[455,6]]},"71":{"position":[[361,6]]},"118":{"position":[[229,6]]},"185":{"position":[[3392,7],[3561,6]]},"197":{"position":[[1027,6],[1255,6]]},"206":{"position":[[832,8],[1499,8]]},"222":{"position":[[530,7]]},"235":{"position":[[361,6]]},"267":{"position":[[47,7],[243,6],[1165,6],[1471,6],[3492,6],[4013,6],[4155,6]]},"268":{"position":[[12,7],[57,6]]},"269":{"position":[[4742,8],[5409,8]]},"299":{"position":[[229,6]]},"321":{"position":[[804,7],[1280,7],[2062,7]]},"376":{"position":[[3376,7],[3545,6]]},"382":{"position":[[112,7]]},"383":{"position":[[188,6],[444,6],[917,6]]},"407":{"position":[[47,7],[243,6],[1165,6],[1471,6],[3492,6],[4013,6],[4155,6]]},"408":{"position":[[12,7],[57,6]]},"409":{"position":[[4742,8],[5409,8]]},"426":{"position":[[832,8],[1494,8]]},"433":{"position":[[1026,6],[1254,6]]},"440":{"position":[[4507,7]]},"441":{"position":[[4460,6]]},"455":{"position":[[530,7]]},"471":{"position":[[361,6]]},"476":{"position":[[956,6]]},"520":{"position":[[229,6]]},"539":{"position":[[804,7],[1280,7],[2062,7]]},"592":{"position":[[3376,7],[3545,6]]},"624":{"position":[[112,7]]},"625":{"position":[[188,6],[444,6],[917,6]]},"644":{"position":[[47,7],[243,6],[1165,6],[1471,6],[3492,6],[4013,6],[4155,6]]},"645":{"position":[[12,7],[57,6]]},"646":{"position":[[4742,8],[5409,8]]},"668":{"position":[[832,8],[1499,8]]},"680":{"position":[[1026,6],[1254,6]]},"687":{"position":[[4507,7]]},"688":{"position":[[4460,6]]},"695":{"position":[[530,7]]},"698":{"position":[[956,6]]}},"keywords":{}}],["update(&mut",{"_index":2974,"title":{},"content":{"321":{"position":[[1339,15]]},"539":{"position":[[1339,15]]}},"keywords":{}}],["update_arr(&mut",{"_index":3712,"title":{},"content":{"601":{"position":[[1739,19]]},"709":{"position":[[1739,19]]}},"keywords":{}}],["update_text(&mut",{"_index":3736,"title":{},"content":{"602":{"position":[[1391,20]]},"710":{"position":[[1391,20]]}},"keywords":{}}],["upgrad",{"_index":1645,"title":{},"content":{"98":{"position":[[467,11]]},"290":{"position":[[467,11]]},"323":{"position":[[3342,14]]},"502":{"position":[[467,11]]},"541":{"position":[[3342,14]]}},"keywords":{}}],["upon",{"_index":1228,"title":{},"content":{"52":{"position":[[277,4]]},"324":{"position":[[1431,4]]},"542":{"position":[[1431,4]]}},"keywords":{}}],["uref",{"_index":1577,"title":{},"content":{"91":{"position":[[280,5]]},"92":{"position":[[176,4]]},"283":{"position":[[280,5]]},"284":{"position":[[176,4]]},"495":{"position":[[280,5]]},"496":{"position":[[176,4]]}},"keywords":{}}],["us",{"_index":58,"title":{"88":{"position":[[0,5]]},"103":{"position":[[0,5]]},"186":{"position":[[0,5]]},"250":{"position":[[0,5]]},"295":{"position":[[0,5]]},"363":{"position":[[0,5]]},"397":{"position":[[20,5]]},"475":{"position":[[0,5]]},"488":{"position":[[0,5]]},"507":{"position":[[0,5]]},"579":{"position":[[0,5]]},"634":{"position":[[20,5]]},"697":{"position":[[0,5]]}},"content":{"1":{"position":[[764,4]]},"2":{"position":[[55,5],[166,3],[595,3]]},"5":{"position":[[197,3]]},"15":{"position":[[58,4],[259,3],[447,3]]},"16":{"position":[[45,4]]},"17":{"position":[[48,5],[199,4],[233,4],[333,3],[1855,3]]},"22":{"position":[[445,5],[1054,3],[1442,3]]},"31":{"position":[[10,4],[1703,4],[2306,5],[2330,3]]},"32":{"position":[[235,3],[264,3],[294,3]]},"42":{"position":[[185,3],[1474,3],[1900,3],[2022,3],[2060,3]]},"50":{"position":[[362,4]]},"51":{"position":[[361,3],[433,3],[1121,3],[1346,3],[1681,3]]},"52":{"position":[[2191,5],[3179,3]]},"65":{"position":[[43,4],[192,4]]},"66":{"position":[[47,4],[168,5]]},"67":{"position":[[63,4],[138,5]]},"68":{"position":[[103,3],[184,3]]},"72":{"position":[[370,3]]},"73":{"position":[[462,3],[476,3]]},"76":{"position":[[333,4],[476,4],[714,5]]},"79":{"position":[[550,3],[607,3],[629,3]]},"80":{"position":[[104,3],[164,3],[186,3]]},"85":{"position":[[739,4]]},"86":{"position":[[72,5]]},"88":{"position":[[58,3]]},"91":{"position":[[868,5],[941,5]]},"92":{"position":[[396,3]]},"97":{"position":[[149,5],[181,5]]},"99":{"position":[[43,5]]},"100":{"position":[[930,4]]},"102":{"position":[[680,3]]},"103":{"position":[[3,3],[779,5]]},"104":{"position":[[60,4]]},"111":{"position":[[150,6]]},"114":{"position":[[50,3],[182,5]]},"115":{"position":[[63,3],[108,3],[1476,5],[1719,3],[1855,3],[1920,3]]},"117":{"position":[[483,5],[551,4],[592,3],[856,4],[941,4],[949,5],[1016,3],[1094,3],[1195,3],[1275,5]]},"118":{"position":[[59,3],[190,3]]},"119":{"position":[[9,4],[217,5],[318,5],[607,3],[1123,5]]},"120":{"position":[[329,3]]},"121":{"position":[[108,3],[367,3]]},"126":{"position":[[3,3],[146,4],[199,3],[263,5],[299,3],[481,4],[521,5],[704,4],[2164,4],[2488,3],[2810,3]]},"128":{"position":[[194,4],[604,4]]},"129":{"position":[[78,6],[414,4]]},"131":{"position":[[554,3]]},"132":{"position":[[357,5]]},"134":{"position":[[46,4],[176,4]]},"138":{"position":[[189,3],[254,3],[280,3],[1141,5],[1268,5]]},"139":{"position":[[42,5]]},"141":{"position":[[131,3],[914,3],[1396,4]]},"142":{"position":[[16,6],[110,6],[197,5]]},"143":{"position":[[42,5],[126,3],[203,3],[976,3],[990,3]]},"145":{"position":[[11,3]]},"146":{"position":[[756,3]]},"147":{"position":[[1378,5]]},"148":{"position":[[36,3],[72,3],[275,3],[551,5]]},"149":{"position":[[86,3]]},"151":{"position":[[121,3],[156,3]]},"154":{"position":[[8,5]]},"157":{"position":[[147,3],[196,3],[570,3]]},"160":{"position":[[174,3],[206,3]]},"162":{"position":[[156,3],[714,3],[1414,5],[1547,5],[1678,3],[1785,3],[1905,5],[2110,3]]},"163":{"position":[[15,4],[203,4],[335,3],[641,3],[1125,5],[1285,5],[1580,3]]},"164":{"position":[[102,3]]},"165":{"position":[[178,3]]},"168":{"position":[[52,3],[356,3],[437,3],[1190,5],[1283,5]]},"173":{"position":[[485,4]]},"174":{"position":[[110,3]]},"175":{"position":[[332,5],[416,3],[512,5]]},"178":{"position":[[11,3],[1042,3],[1078,3],[1281,3]]},"182":{"position":[[102,4]]},"184":{"position":[[189,3],[211,3],[239,3],[962,3]]},"185":{"position":[[113,3],[135,3],[161,3],[183,3],[2945,4]]},"187":{"position":[[43,3]]},"188":{"position":[[216,4],[612,4]]},"189":{"position":[[508,5],[652,5]]},"195":{"position":[[11,3],[33,3]]},"196":{"position":[[15,3]]},"197":{"position":[[840,4],[1205,5],[1835,3]]},"198":{"position":[[36,3],[50,3],[2243,5],[2328,3],[2490,3],[2780,3],[3898,3]]},"199":{"position":[[182,3]]},"201":{"position":[[95,5]]},"203":{"position":[[9,3],[31,3],[439,3],[607,5]]},"204":{"position":[[13,3],[1412,4],[1498,3]]},"205":{"position":[[232,3]]},"206":{"position":[[38,3],[52,3]]},"209":{"position":[[391,3]]},"210":{"position":[[43,3],[321,5]]},"211":{"position":[[695,5]]},"212":{"position":[[23,3],[107,3],[3699,5]]},"219":{"position":[[232,3],[254,3]]},"220":{"position":[[125,3]]},"223":{"position":[[18,3],[291,3],[823,3],[837,3],[1229,5]]},"227":{"position":[[333,4],[476,4],[714,5]]},"230":{"position":[[567,3],[624,3],[646,3]]},"231":{"position":[[104,3],[164,3],[186,3]]},"236":{"position":[[370,3]]},"237":{"position":[[462,3],[476,3]]},"240":{"position":[[43,4],[192,4]]},"241":{"position":[[47,4],[168,5]]},"242":{"position":[[63,4],[139,5]]},"243":{"position":[[103,3],[184,3]]},"246":{"position":[[107,3],[152,3],[174,3]]},"247":{"position":[[19,3],[1916,5]]},"250":{"position":[[58,3]]},"254":{"position":[[739,4]]},"255":{"position":[[72,5]]},"257":{"position":[[50,3],[182,5]]},"258":{"position":[[63,3],[108,3],[1422,5],[1665,3],[1801,3],[1866,3]]},"264":{"position":[[101,5],[425,3]]},"267":{"position":[[160,4],[254,3],[662,5],[678,3],[719,3],[739,3],[1272,3],[1509,3],[1531,3],[2443,5],[2474,5],[3741,5]]},"268":{"position":[[157,4],[312,3],[487,5],[618,3],[864,3],[891,3],[1066,3],[1108,3],[1880,3],[2118,3],[2303,5],[2754,3]]},"269":{"position":[[112,3],[148,3],[177,3],[199,3],[3281,3],[3303,3],[3635,3],[3853,3],[3942,3]]},"277":{"position":[[3,3],[146,4],[199,3],[263,5],[299,3],[481,4],[521,5],[704,4],[1091,5],[2332,4],[2656,3],[2978,3]]},"279":{"position":[[194,4],[604,4]]},"280":{"position":[[78,6],[414,4]]},"283":{"position":[[868,5],[939,5]]},"284":{"position":[[396,3]]},"289":{"position":[[149,5],[181,5]]},"291":{"position":[[43,5]]},"292":{"position":[[930,4]]},"294":{"position":[[680,3]]},"295":{"position":[[3,3],[779,5]]},"296":{"position":[[60,4]]},"298":{"position":[[483,5],[551,4],[592,3],[856,4],[941,4],[949,5],[1016,3],[1094,3],[1195,3],[1275,5]]},"299":{"position":[[59,3],[190,3]]},"300":{"position":[[9,4],[217,5],[318,5],[607,3],[1123,5]]},"301":{"position":[[329,3]]},"302":{"position":[[108,3],[367,3]]},"306":{"position":[[150,6]]},"311":{"position":[[606,3]]},"312":{"position":[[357,5]]},"314":{"position":[[46,4],[176,4]]},"318":{"position":[[189,3],[254,3],[1133,5],[1260,5]]},"319":{"position":[[42,5]]},"321":{"position":[[42,3],[110,5],[453,3],[475,3],[779,4],[903,4]]},"324":{"position":[[106,4]]},"326":{"position":[[131,3],[914,3],[1396,4]]},"327":{"position":[[16,6],[110,6],[197,5]]},"328":{"position":[[42,5],[126,3],[203,3],[951,3],[965,3]]},"330":{"position":[[147,3],[196,3],[556,3]]},"333":{"position":[[11,3]]},"334":{"position":[[760,3]]},"335":{"position":[[1386,5]]},"336":{"position":[[36,3],[72,3],[275,3],[551,5]]},"337":{"position":[[86,3]]},"339":{"position":[[8,5]]},"342":{"position":[[121,3],[156,3]]},"345":{"position":[[174,3],[206,3]]},"348":{"position":[[52,3],[356,3],[437,3],[1190,5],[1283,5]]},"351":{"position":[[156,3],[331,3],[353,3],[1436,5],[1569,5],[1700,3],[1807,3],[1927,5],[2132,3]]},"352":{"position":[[15,4],[203,4],[335,3],[357,3],[663,3],[1147,5],[1307,5],[1602,3]]},"353":{"position":[[102,3],[154,3]]},"354":{"position":[[229,3]]},"359":{"position":[[485,4]]},"360":{"position":[[110,3]]},"361":{"position":[[332,5],[416,3],[512,5]]},"364":{"position":[[43,3]]},"365":{"position":[[269,3],[573,4],[969,4]]},"366":{"position":[[508,5],[652,5]]},"369":{"position":[[11,3],[1042,3],[1078,3],[1281,3]]},"373":{"position":[[102,4]]},"375":{"position":[[189,3],[211,3],[230,3]]},"376":{"position":[[113,3],[135,3],[161,3],[183,3],[2929,4]]},"382":{"position":[[238,3]]},"383":{"position":[[315,3],[1031,3],[1053,3]]},"384":{"position":[[112,3],[145,3],[174,3],[196,3],[3322,3],[3344,3]]},"388":{"position":[[391,3]]},"389":{"position":[[43,3],[321,5]]},"390":{"position":[[669,5]]},"391":{"position":[[23,3],[107,3],[3717,5]]},"393":{"position":[[11,5],[216,3],[480,3],[540,5]]},"394":{"position":[[100,3],[194,3],[250,5],[593,5]]},"395":{"position":[[119,3],[346,3],[369,3],[399,3],[460,3],[479,3],[3727,4],[3880,4],[4240,5],[4330,3],[6816,3]]},"396":{"position":[[479,5],[689,3]]},"398":{"position":[[81,5],[149,3]]},"404":{"position":[[101,5],[425,3]]},"407":{"position":[[160,4],[254,3],[662,5],[678,3],[719,3],[739,3],[1272,3],[1509,3],[1531,3],[2443,5],[2474,5],[3741,5]]},"408":{"position":[[157,4],[312,3],[487,5],[618,3],[864,3],[891,3],[1066,3],[1108,3],[1880,3],[2118,3],[2303,5],[2754,3]]},"409":{"position":[[112,3],[148,3],[177,3],[199,3],[3281,3],[3303,3],[3635,3],[3853,3],[3942,3]]},"413":{"position":[[127,3]]},"414":{"position":[[66,5],[469,4],[638,5]]},"416":{"position":[[1157,3],[3120,5],[4580,4],[4624,4],[4685,5],[4732,4]]},"417":{"position":[[1644,5]]},"418":{"position":[[75,5]]},"419":{"position":[[63,3],[138,3],[2499,5],[3507,5],[6504,3],[6518,3]]},"421":{"position":[[95,5]]},"423":{"position":[[9,3],[31,3],[439,3],[607,5]]},"424":{"position":[[1362,4],[1448,3]]},"426":{"position":[[38,3],[52,3]]},"431":{"position":[[11,3],[33,3]]},"433":{"position":[[839,4],[1204,5],[1834,3]]},"434":{"position":[[36,3],[50,3],[2233,5],[2318,3],[2480,3],[2770,3],[3880,3]]},"435":{"position":[[182,3]]},"439":{"position":[[55,3]]},"440":{"position":[[112,3],[216,3],[251,3],[3371,4],[3711,4],[4803,3],[4865,3]]},"441":{"position":[[443,3],[543,3],[598,3],[1634,4],[1889,5],[2180,3],[2241,3],[4549,3],[4631,3]]},"442":{"position":[[55,5]]},"445":{"position":[[107,3],[152,3],[174,3]]},"446":{"position":[[19,3],[1916,5]]},"452":{"position":[[232,3],[254,3]]},"453":{"position":[[125,3]]},"456":{"position":[[18,3],[291,3],[823,3],[837,3],[1229,5]]},"458":{"position":[[333,4],[476,4],[714,5]]},"461":{"position":[[567,3],[624,3],[646,3]]},"462":{"position":[[104,3],[164,3],[186,3]]},"465":{"position":[[43,4],[192,4]]},"466":{"position":[[47,4],[168,5]]},"467":{"position":[[63,4],[139,5]]},"468":{"position":[[103,3],[184,3]]},"472":{"position":[[370,3]]},"473":{"position":[[462,3],[476,3]]},"476":{"position":[[27,3],[108,3],[130,3]]},"477":{"position":[[68,3],[556,3],[1417,3],[1476,3],[1513,3],[1532,3]]},"478":{"position":[[36,3],[153,5]]},"480":{"position":[[50,3],[182,5]]},"481":{"position":[[63,3],[108,3],[1422,5],[1665,3],[1801,3],[1866,3]]},"485":{"position":[[739,4]]},"486":{"position":[[72,5]]},"488":{"position":[[58,3]]},"495":{"position":[[868,5],[939,5]]},"496":{"position":[[396,3]]},"501":{"position":[[149,5],[181,5]]},"503":{"position":[[43,5]]},"504":{"position":[[930,4]]},"506":{"position":[[680,3]]},"507":{"position":[[3,3],[779,5]]},"508":{"position":[[60,4]]},"511":{"position":[[150,6]]},"514":{"position":[[3,3],[146,4],[199,3],[263,5],[299,3],[481,4],[521,5],[704,4],[2164,4],[2488,3],[2810,3]]},"516":{"position":[[194,4],[604,4]]},"517":{"position":[[78,6],[414,4]]},"519":{"position":[[483,5],[551,4],[592,3],[856,4],[941,4],[949,5],[1016,3],[1094,3],[1195,3],[1275,5]]},"520":{"position":[[59,3],[190,3]]},"521":{"position":[[9,4],[217,5],[318,5],[607,3],[1123,5]]},"522":{"position":[[329,3]]},"523":{"position":[[108,3],[367,3]]},"528":{"position":[[606,3]]},"529":{"position":[[357,5]]},"531":{"position":[[46,4],[176,4]]},"535":{"position":[[131,3],[914,3],[1396,4]]},"536":{"position":[[16,6],[110,6],[197,5]]},"537":{"position":[[42,5],[126,3],[203,3],[951,3],[965,3]]},"539":{"position":[[42,3],[110,5],[453,3],[475,3],[779,4],[903,4]]},"542":{"position":[[106,4]]},"544":{"position":[[189,3],[254,3],[1133,5],[1260,5]]},"545":{"position":[[42,5]]},"547":{"position":[[147,3],[196,3],[570,3]]},"550":{"position":[[11,3]]},"551":{"position":[[760,3]]},"552":{"position":[[1386,5]]},"553":{"position":[[36,3],[72,3],[275,3],[551,5]]},"554":{"position":[[86,3]]},"556":{"position":[[121,3],[156,3]]},"559":{"position":[[8,5]]},"562":{"position":[[174,3],[206,3]]},"564":{"position":[[52,3],[356,3],[437,3],[1190,5],[1283,5]]},"567":{"position":[[156,3],[331,3],[353,3],[1436,5],[1569,5],[1700,3],[1807,3],[1927,5],[2132,3]]},"568":{"position":[[15,4],[203,4],[335,3],[357,3],[663,3],[1147,5],[1307,5],[1602,3]]},"569":{"position":[[102,3],[154,3]]},"570":{"position":[[229,3]]},"575":{"position":[[485,4]]},"576":{"position":[[110,3]]},"577":{"position":[[332,5],[416,3],[512,5]]},"580":{"position":[[43,3]]},"581":{"position":[[269,3],[573,4],[969,4]]},"582":{"position":[[508,5],[652,5]]},"585":{"position":[[11,3],[1042,3],[1078,3],[1281,3]]},"589":{"position":[[102,4]]},"591":{"position":[[189,3],[211,3],[230,3]]},"592":{"position":[[113,3],[135,3],[161,3],[183,3],[2929,4]]},"596":{"position":[[176,3]]},"598":{"position":[[13,3],[37,3],[1115,3],[1787,4],[1920,3],[1965,4],[2134,4]]},"599":{"position":[[13,3],[310,5],[488,4]]},"600":{"position":[[13,3],[855,4],[1039,4],[1157,5],[1200,5]]},"601":{"position":[[13,3],[335,3],[1111,3],[1939,4],[2196,3]]},"602":{"position":[[13,3],[563,5],[647,5],[729,4],[808,5],[893,5],[945,3],[1097,3],[1898,5],[1956,4],[2026,5]]},"604":{"position":[[515,5]]},"605":{"position":[[13,3]]},"606":{"position":[[13,3],[977,5]]},"608":{"position":[[13,3],[777,4]]},"610":{"position":[[13,3],[529,5],[687,3],[793,4]]},"611":{"position":[[13,3],[714,5],[863,5]]},"612":{"position":[[30,3],[427,3],[1478,4]]},"613":{"position":[[13,3],[89,3],[1628,4],[1637,5],[1729,3]]},"616":{"position":[[13,3],[1232,4],[1293,5]]},"617":{"position":[[13,3],[1106,3],[1250,3]]},"624":{"position":[[238,3]]},"625":{"position":[[315,3],[1031,3],[1053,3]]},"626":{"position":[[112,3],[145,3],[174,3],[196,3],[3322,3],[3344,3]]},"630":{"position":[[11,5],[216,3],[480,3],[540,5]]},"631":{"position":[[100,3],[194,3],[250,5],[593,5]]},"632":{"position":[[119,3],[346,3],[369,3],[399,3],[460,3],[479,3],[3727,4],[3880,4],[4240,5],[4330,3],[6816,3]]},"633":{"position":[[479,5],[689,3]]},"635":{"position":[[81,5],[149,3]]},"641":{"position":[[101,5],[425,3]]},"644":{"position":[[160,4],[254,3],[662,5],[678,3],[719,3],[739,3],[1272,3],[1509,3],[1531,3],[2443,5],[2474,5],[3741,5]]},"645":{"position":[[157,4],[312,3],[487,5],[618,3],[864,3],[891,3],[1066,3],[1108,3],[1880,3],[2118,3],[2303,5],[2754,3]]},"646":{"position":[[112,3],[148,3],[177,3],[199,3],[3281,3],[3303,3],[3635,3],[3853,3],[3942,3]]},"650":{"position":[[127,3]]},"651":{"position":[[66,5],[469,4],[638,5]]},"653":{"position":[[1157,3],[3120,5],[4580,4],[4624,4],[4685,5],[4732,4]]},"654":{"position":[[1644,5]]},"655":{"position":[[75,5]]},"656":{"position":[[63,3],[138,3],[2499,5],[3507,5],[6504,3],[6518,3]]},"658":{"position":[[391,3]]},"659":{"position":[[43,3],[321,5]]},"660":{"position":[[669,5]]},"661":{"position":[[23,3],[107,3],[3717,5]]},"663":{"position":[[95,5]]},"665":{"position":[[9,3],[31,3],[439,3],[607,5]]},"666":{"position":[[1362,4],[1448,3]]},"668":{"position":[[38,3],[52,3]]},"672":{"position":[[107,3],[152,3],[174,3]]},"673":{"position":[[19,3],[1916,5]]},"678":{"position":[[11,3],[33,3]]},"680":{"position":[[839,4],[1204,5],[1834,3]]},"681":{"position":[[36,3],[50,3],[2243,5],[2328,3],[2490,3],[2780,3],[3898,3]]},"682":{"position":[[182,3]]},"686":{"position":[[55,3]]},"687":{"position":[[112,3],[216,3],[251,3],[3371,4],[3711,4],[4803,3],[4865,3]]},"688":{"position":[[443,3],[543,3],[598,3],[1634,4],[1889,5],[2180,3],[2241,3],[4549,3],[4631,3]]},"689":{"position":[[55,5]]},"692":{"position":[[232,3],[254,3]]},"693":{"position":[[125,3]]},"696":{"position":[[18,3],[291,3],[823,3],[837,3],[1229,5]]},"698":{"position":[[27,3],[108,3],[130,3]]},"699":{"position":[[68,3],[556,3],[1417,3],[1476,3],[1513,3],[1532,3]]},"700":{"position":[[36,3],[153,5]]},"704":{"position":[[176,3]]},"706":{"position":[[13,3],[37,3],[1115,3],[1787,4],[1920,3],[1965,4],[2134,4]]},"707":{"position":[[13,3],[310,5],[488,4]]},"708":{"position":[[13,3],[855,4],[1039,4],[1157,5],[1200,5]]},"709":{"position":[[13,3],[335,3],[1111,3],[1939,4],[2196,3]]},"710":{"position":[[13,3],[563,5],[647,5],[729,4],[808,5],[893,5],[945,3],[1097,3],[1898,5],[1956,4],[2026,5]]},"712":{"position":[[515,5]]},"713":{"position":[[13,3]]},"714":{"position":[[13,3],[977,5]]},"716":{"position":[[13,3],[777,4]]},"718":{"position":[[13,3],[529,5],[687,3],[793,4]]},"719":{"position":[[13,3],[714,5],[863,5]]},"720":{"position":[[30,3],[427,3],[1478,4]]},"721":{"position":[[13,3],[89,3],[1628,4],[1637,5],[1729,3]]},"724":{"position":[[13,3],[1232,4],[1293,5]]},"725":{"position":[[13,3],[1106,3],[1250,3]]}},"keywords":{}}],["usabl",{"_index":2056,"title":{},"content":{"162":{"position":[[610,7]]},"351":{"position":[[647,7]]},"567":{"position":[[647,7]]}},"keywords":{}}],["usag",{"_index":1632,"title":{"96":{"position":[[0,6]]},"106":{"position":[[0,6]]},"127":{"position":[[0,6]]},"273":{"position":[[0,6]]},"278":{"position":[[0,6]]},"288":{"position":[[0,6]]},"490":{"position":[[0,6]]},"500":{"position":[[0,6]]},"515":{"position":[[0,6]]}},"content":{"164":{"position":[[323,6]]},"267":{"position":[[3944,5]]},"353":{"position":[[358,6]]},"407":{"position":[[3944,5]]},"414":{"position":[[772,6]]},"569":{"position":[[358,6]]},"644":{"position":[[3944,5]]},"651":{"position":[[772,6]]}},"keywords":{}}],["use.commun",{"_index":86,"title":{},"content":{"1":{"position":[[1090,13]]}},"keywords":{}}],["usecasp",{"_index":1647,"title":{},"content":{"98":{"position":[[691,9]]},"290":{"position":[[691,9]]},"502":{"position":[[691,9]]}},"keywords":{}}],["user",{"_index":772,"title":{},"content":{"31":{"position":[[1680,4],[2321,5]]},"83":{"position":[[253,4]]},"110":{"position":[[416,4]]},"202":{"position":[[320,5]]},"252":{"position":[[253,4]]},"305":{"position":[[416,4]]},"419":{"position":[[1778,6],[1793,4],[1933,4],[2010,4]]},"422":{"position":[[320,5]]},"483":{"position":[[253,4]]},"510":{"position":[[416,4]]},"656":{"position":[[1778,6],[1793,4],[1933,4],[2010,4]]},"664":{"position":[[320,5]]}},"keywords":{}}],["users.allow",{"_index":2436,"title":{},"content":{"202":{"position":[[225,17]]},"422":{"position":[[225,17]]},"664":{"position":[[225,17]]}},"keywords":{}}],["usinglivenet",{"_index":1646,"title":{},"content":{"98":{"position":[[612,12]]},"290":{"position":[[612,12]]},"502":{"position":[[612,12]]}},"keywords":{}}],["usiz",{"_index":2075,"title":{},"content":{"162":{"position":[[2207,5]]},"168":{"position":[[1890,6]]},"348":{"position":[[1890,6]]},"351":{"position":[[2229,5]]},"564":{"position":[[1890,6]]},"567":{"position":[[2229,5]]},"601":{"position":[[1843,6]]},"613":{"position":[[557,7],[647,6]]},"709":{"position":[[1843,6]]},"721":{"position":[[557,7],[647,6]]}},"keywords":{}}],["utf",{"_index":2608,"title":{},"content":{"211":{"position":[[775,3]]},"212":{"position":[[3785,3]]},"390":{"position":[[749,3]]},"391":{"position":[[3803,3]]},"660":{"position":[[749,3]]},"661":{"position":[[3803,3]]}},"keywords":{}}],["util",{"_index":907,"title":{"613":{"position":[[14,8]]},"721":{"position":[[14,8]]}},"content":{"39":{"position":[[350,8],[1524,8]]},"50":{"position":[[524,7]]},"79":{"position":[[1445,9]]},"114":{"position":[[3,7]]},"143":{"position":[[801,7],[942,8]]},"230":{"position":[[1462,9]]},"257":{"position":[[3,7]]},"328":{"position":[[776,7],[917,8]]},"461":{"position":[[1462,9]]},"480":{"position":[[3,7]]},"537":{"position":[[776,7],[917,8]]}},"keywords":{}}],["v0.8.0",{"_index":2786,"title":{"259":{"position":[[19,6]]},"399":{"position":[[19,6]]},"636":{"position":[[19,6]]}},"content":{"262":{"position":[[112,7]]},"265":{"position":[[424,7]]},"269":{"position":[[81,7]]},"402":{"position":[[112,7]]},"405":{"position":[[424,7]]},"409":{"position":[[81,7]]},"639":{"position":[[112,7]]},"642":{"position":[[424,7]]},"646":{"position":[[81,7]]}},"keywords":{}}],["v0.9.0",{"_index":3087,"title":{"377":{"position":[[19,6]]},"619":{"position":[[19,6]]}},"content":{"380":{"position":[[112,7]]},"384":{"position":[[81,7]]},"622":{"position":[[112,7]]},"626":{"position":[[81,7]]}},"keywords":{}}],["valid",{"_index":2965,"title":{},"content":{"321":{"position":[[357,6]]},"416":{"position":[[2211,11]]},"539":{"position":[[357,6]]},"653":{"position":[[2211,11]]}},"keywords":{}}],["valu",{"_index":260,"title":{"86":{"position":[[0,5]]},"255":{"position":[[0,5]]},"486":{"position":[[0,5]]}},"content":{"9":{"position":[[78,7]]},"17":{"position":[[448,6],[761,6],[2731,6],[2918,5],[3022,7],[3070,7],[3144,6],[3397,5],[3473,5],[3579,7],[3627,7],[3683,7],[3741,6],[3832,7]]},"22":{"position":[[894,6],[954,6],[1033,6],[1111,6],[1214,6]]},"31":{"position":[[266,6]]},"32":{"position":[[1547,6]]},"39":{"position":[[1844,7],[2062,6]]},"43":{"position":[[521,6],[592,7]]},"51":{"position":[[125,6],[144,5],[186,5],[215,5],[514,6],[615,6],[691,6],[1305,6]]},"52":{"position":[[1116,5],[1288,9],[1592,5],[3275,6],[6466,5],[6502,5],[6585,5],[6704,5]]},"53":{"position":[[302,6],[415,6],[473,6],[499,6],[603,6],[688,6],[755,6],[843,6],[881,6],[918,6]]},"71":{"position":[[90,6]]},"76":{"position":[[356,6],[417,7],[500,7],[610,5],[675,7],[691,5],[841,6]]},"78":{"position":[[60,5],[171,6],[239,6],[353,5],[377,5]]},"79":{"position":[[28,5],[84,6],[117,5],[320,5],[1214,7],[1246,6],[1312,6]]},"81":{"position":[[291,7]]},"83":{"position":[[337,5],[417,6],[646,6]]},"84":{"position":[[399,5],[443,7]]},"86":{"position":[[41,5]]},"95":{"position":[[451,6]]},"99":{"position":[[137,5],[186,5]]},"103":{"position":[[577,5]]},"126":{"position":[[245,6],[817,7],[1103,5]]},"129":{"position":[[347,5],[461,5],[522,5],[730,6]]},"145":{"position":[[248,6]]},"146":{"position":[[189,6],[231,5],[255,6]]},"147":{"position":[[229,5],[238,6],[1043,5],[1101,6],[1166,5],[1190,6]]},"163":{"position":[[52,5],[107,6],[137,5],[562,6],[607,6],[1630,7]]},"168":{"position":[[1842,5]]},"178":{"position":[[203,6],[245,5],[269,6],[535,5],[544,6],[630,5],[688,6],[753,5],[777,6],[858,5],[893,5],[931,5]]},"193":{"position":[[262,7]]},"195":{"position":[[684,6]]},"196":{"position":[[1715,5]]},"197":{"position":[[1695,5]]},"198":{"position":[[2426,5]]},"201":{"position":[[105,5]]},"203":{"position":[[402,5]]},"205":{"position":[[906,6],[2021,6],[2163,6]]},"206":{"position":[[2612,6],[3072,6]]},"209":{"position":[[88,6],[318,5],[353,6],[724,6],[1114,6],[1140,6],[1269,6],[1473,5],[1531,6]]},"210":{"position":[[1101,6]]},"211":{"position":[[325,6]]},"212":{"position":[[613,6],[875,5],[1244,5],[2129,5],[2169,7],[2256,5],[2300,6],[2531,7],[2570,5],[2715,5],[2882,5],[3129,5],[4602,6],[4625,6]]},"221":{"position":[[654,5]]},"223":{"position":[[155,5],[361,6]]},"227":{"position":[[356,6],[417,7],[500,7],[610,5],[675,7],[691,5],[841,6]]},"229":{"position":[[60,5],[171,6],[260,6],[374,5],[398,5]]},"230":{"position":[[28,5],[84,6],[117,5],[337,5],[1231,7],[1263,6],[1329,6]]},"232":{"position":[[291,7]]},"235":{"position":[[90,6]]},"252":{"position":[[337,5],[417,6],[646,6]]},"253":{"position":[[399,5],[443,7]]},"255":{"position":[[41,5]]},"267":{"position":[[2242,6],[2327,6],[2625,6]]},"268":{"position":[[3178,6]]},"269":{"position":[[1652,6],[3229,6],[3602,6]]},"277":{"position":[[245,6],[817,7],[1271,5]]},"280":{"position":[[347,5],[461,5],[522,5],[731,6]]},"287":{"position":[[451,6]]},"291":{"position":[[137,5],[186,5]]},"295":{"position":[[577,5]]},"324":{"position":[[667,5],[1039,5]]},"333":{"position":[[248,6]]},"334":{"position":[[189,6],[231,5],[255,6]]},"335":{"position":[[229,5],[238,6],[1051,5],[1109,6],[1174,5],[1198,6]]},"348":{"position":[[1842,5]]},"352":{"position":[[52,5],[107,6],[137,5],[584,6],[629,6],[1652,7]]},"369":{"position":[[203,6],[245,5],[269,6],[535,5],[544,6],[630,5],[688,6],[753,5],[777,6],[858,5],[893,5],[931,5]]},"384":{"position":[[1665,6],[3270,6],[3588,6]]},"388":{"position":[[88,6],[318,5],[353,6],[656,6],[1046,6],[1072,6],[1201,6],[1405,5],[1463,6]]},"389":{"position":[[1038,6]]},"390":{"position":[[312,6]]},"391":{"position":[[613,6],[875,5],[1244,5],[2129,5],[2169,7],[2256,5],[2300,6],[2531,7],[2570,5],[2721,5],[2888,5],[3147,5],[4620,6],[4643,6]]},"407":{"position":[[2242,6],[2327,6],[2625,6]]},"408":{"position":[[3178,6]]},"409":{"position":[[1652,6],[3229,6],[3602,6]]},"421":{"position":[[105,5]]},"423":{"position":[[402,5]]},"425":{"position":[[881,6],[1996,6],[2114,6]]},"426":{"position":[[2597,6],[3052,6]]},"429":{"position":[[262,7]]},"431":{"position":[[684,6]]},"432":{"position":[[1593,5]]},"433":{"position":[[1694,5]]},"434":{"position":[[2416,5]]},"440":{"position":[[2378,5],[2862,5]]},"441":{"position":[[1179,5],[1516,7],[3177,6]]},"454":{"position":[[654,5]]},"456":{"position":[[155,5],[361,6]]},"458":{"position":[[356,6],[417,7],[500,7],[610,5],[675,7],[691,5],[841,6]]},"460":{"position":[[60,5],[171,6],[260,6],[374,5],[398,5]]},"461":{"position":[[28,5],[84,6],[117,5],[337,5],[1231,7],[1263,6],[1329,6]]},"463":{"position":[[291,7]]},"471":{"position":[[90,6]]},"476":{"position":[[683,6]]},"483":{"position":[[337,5],[417,6],[646,6]]},"484":{"position":[[399,5],[443,7]]},"486":{"position":[[41,5]]},"499":{"position":[[451,6]]},"503":{"position":[[137,5],[186,5]]},"507":{"position":[[577,5]]},"514":{"position":[[245,6],[817,7],[1103,5]]},"517":{"position":[[347,5],[461,5],[522,5],[731,6]]},"542":{"position":[[667,5],[1039,5]]},"550":{"position":[[248,6]]},"551":{"position":[[189,6],[231,5],[255,6]]},"552":{"position":[[229,5],[238,6],[1051,5],[1109,6],[1174,5],[1198,6]]},"564":{"position":[[1842,5]]},"568":{"position":[[52,5],[107,6],[137,5],[584,6],[629,6],[1652,7]]},"585":{"position":[[203,6],[245,5],[269,6],[535,5],[544,6],[630,5],[688,6],[753,5],[777,6],[858,5],[893,5],[931,5]]},"596":{"position":[[1129,7]]},"598":{"position":[[1100,7],[1451,5],[1871,5],[1992,6]]},"599":{"position":[[504,5],[581,5]]},"601":{"position":[[1534,6],[1776,6],[1852,6]]},"602":{"position":[[631,5],[777,5],[845,5]]},"613":{"position":[[2232,7]]},"626":{"position":[[1665,6],[3270,6],[3588,6]]},"644":{"position":[[2242,6],[2327,6],[2625,6]]},"645":{"position":[[3178,6]]},"646":{"position":[[1652,6],[3229,6],[3602,6]]},"658":{"position":[[88,6],[318,5],[353,6],[656,6],[1046,6],[1072,6],[1201,6],[1405,5],[1463,6]]},"659":{"position":[[1038,6]]},"660":{"position":[[312,6]]},"661":{"position":[[613,6],[875,5],[1244,5],[2129,5],[2169,7],[2256,5],[2300,6],[2531,7],[2570,5],[2721,5],[2888,5],[3147,5],[4620,6],[4643,6]]},"663":{"position":[[105,5]]},"665":{"position":[[402,5]]},"667":{"position":[[881,6],[1996,6],[2114,6]]},"668":{"position":[[2612,6],[3072,6]]},"676":{"position":[[262,7]]},"678":{"position":[[684,6]]},"679":{"position":[[1593,5]]},"680":{"position":[[1694,5]]},"681":{"position":[[2426,5]]},"687":{"position":[[2378,5],[2862,5]]},"688":{"position":[[1179,5],[1516,7],[3177,6]]},"694":{"position":[[654,5]]},"696":{"position":[[155,5],[361,6]]},"698":{"position":[[683,6]]},"704":{"position":[[1129,7]]},"706":{"position":[[1100,7],[1451,5],[1871,5],[1992,6]]},"707":{"position":[[504,5],[581,5]]},"709":{"position":[[1534,6],[1776,6],[1852,6]]},"710":{"position":[[631,5],[777,5],[845,5]]},"721":{"position":[[2232,7]]}},"keywords":{}}],["valuabl",{"_index":2950,"title":{},"content":{"270":{"position":[[470,8]]},"385":{"position":[[470,8]]},"410":{"position":[[470,8]]},"627":{"position":[[470,8]]},"647":{"position":[[470,8]]}},"keywords":{}}],["value,defin",{"_index":2305,"title":{},"content":{"193":{"position":[[95,14]]},"429":{"position":[[95,14]]},"676":{"position":[[95,14]]}},"keywords":{}}],["value.map",{"_index":1499,"title":{},"content":{"81":{"position":[[208,14]]},"232":{"position":[[208,14]]},"463":{"position":[[208,14]]}},"keywords":{}}],["valueupd",{"_index":1196,"title":{},"content":{"51":{"position":[[458,14],[841,12],[1181,12]]},"53":{"position":[[980,12],[1293,12]]}},"keywords":{}}],["valueupdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"",{"_index":1294,"title":{},"content":{"52":{"position":[[5914,447]]}},"keywords":{}}],["var",{"_index":1415,"title":{"162":{"position":[[0,4]]},"351":{"position":[[0,4]]},"567":{"position":[[0,4]]}},"content":{"76":{"position":[[213,4],[321,3],[425,4],[432,3],[513,3],[755,3]]},"78":{"position":[[134,3]]},"145":{"position":[[203,4]]},"146":{"position":[[67,4]]},"162":{"position":[[4,3],[195,3],[498,3],[1770,3]]},"163":{"position":[[355,5],[688,4],[1073,3],[1541,3],[1597,5]]},"178":{"position":[[79,4]]},"195":{"position":[[53,5],[783,4]]},"203":{"position":[[80,5]]},"209":{"position":[[464,5]]},"220":{"position":[[54,3]]},"221":{"position":[[602,3]]},"223":{"position":[[151,3]]},"227":{"position":[[213,4],[321,3],[425,4],[432,3],[513,3],[755,3]]},"229":{"position":[[134,3]]},"269":{"position":[[248,5]]},"321":{"position":[[495,5]]},"333":{"position":[[203,4]]},"334":{"position":[[67,4]]},"351":{"position":[[4,3],[195,3],[535,3],[1792,3]]},"352":{"position":[[377,5],[710,4],[1095,3],[1563,3],[1619,5]]},"353":{"position":[[183,5]]},"369":{"position":[[79,4]]},"384":{"position":[[245,5]]},"388":{"position":[[454,5]]},"409":{"position":[[248,5]]},"419":{"position":[[132,5],[697,4]]},"423":{"position":[[80,5]]},"431":{"position":[[53,5],[783,4]]},"441":{"position":[[666,5]]},"453":{"position":[[54,3]]},"454":{"position":[[602,3]]},"456":{"position":[[151,3]]},"458":{"position":[[213,4],[321,3],[425,4],[432,3],[513,3],[755,3]]},"460":{"position":[[134,3]]},"476":{"position":[[179,5]]},"539":{"position":[[495,5]]},"550":{"position":[[203,4]]},"551":{"position":[[67,4]]},"567":{"position":[[4,3],[195,3],[535,3],[1792,3]]},"568":{"position":[[377,5],[710,4],[1095,3],[1563,3],[1619,5]]},"569":{"position":[[183,5]]},"585":{"position":[[79,4]]},"596":{"position":[[199,5]]},"598":{"position":[[142,4]]},"600":{"position":[[56,5]]},"601":{"position":[[1134,5],[2021,3]]},"602":{"position":[[36,5]]},"603":{"position":[[281,4]]},"608":{"position":[[81,5]]},"613":{"position":[[72,5]]},"616":{"position":[[104,4]]},"617":{"position":[[62,5]]},"626":{"position":[[245,5]]},"646":{"position":[[248,5]]},"656":{"position":[[132,5],[697,4]]},"658":{"position":[[454,5]]},"665":{"position":[[80,5]]},"678":{"position":[[53,5],[783,4]]},"688":{"position":[[666,5]]},"693":{"position":[[54,3]]},"694":{"position":[[602,3]]},"696":{"position":[[151,3]]},"698":{"position":[[179,5]]},"704":{"position":[[199,5]]},"706":{"position":[[142,4]]},"708":{"position":[[56,5]]},"709":{"position":[[1134,5],[2021,3]]},"710":{"position":[[36,5]]},"711":{"position":[[281,4]]},"716":{"position":[[81,5]]},"721":{"position":[[72,5]]},"724":{"position":[[104,4]]},"725":{"position":[[62,5]]}},"keywords":{}}],["var<(address",{"_index":3220,"title":{},"content":{"416":{"position":[[536,16]]},"419":{"position":[[907,16]]},"653":{"position":[[536,16]]},"656":{"position":[[907,16]]}},"keywords":{}}],["var<[u8",{"_index":3700,"title":{},"content":{"601":{"position":[[1235,11]]},"616":{"position":[[562,11]]},"709":{"position":[[1235,11]]},"724":{"position":[[562,11]]}},"keywords":{}}],["var<address>",{"_index":2970,"title":{},"content":{"321":{"position":[[985,19]]},"441":{"position":[[821,19],[2402,19]]},"539":{"position":[[985,19]]},"598":{"position":[[473,19],[622,19]]},"608":{"position":[[131,19]]},"617":{"position":[[121,19]]},"688":{"position":[[821,19],[2402,19]]},"706":{"position":[[473,19],[622,19]]},"716":{"position":[[131,19]]},"725":{"position":[[121,19]]}},"keywords":{}}],["var<bool>",{"_index":1991,"title":{},"content":{"146":{"position":[[262,16]]},"162":{"position":[[379,16]]},"178":{"position":[[276,16]]},"220":{"position":[[222,15]]},"334":{"position":[[262,16]]},"351":{"position":[[416,16]]},"369":{"position":[[276,16]]},"416":{"position":[[681,16]]},"419":{"position":[[1052,16]]},"453":{"position":[[222,15]]},"551":{"position":[[262,16]]},"567":{"position":[[416,16]]},"585":{"position":[[276,16]]},"598":{"position":[[195,16],[531,16]]},"606":{"position":[[101,16]]},"653":{"position":[[681,16]]},"656":{"position":[[1052,16]]},"693":{"position":[[222,15]]},"706":{"position":[[195,16],[531,16]]},"714":{"position":[[101,16]]}},"keywords":{}}],["var<bytes>",{"_index":3635,"title":{},"content":{"598":{"position":[[500,17]]},"706":{"position":[[500,17]]}},"keywords":{}}],["var<i32>",{"_index":3629,"title":{},"content":{"598":{"position":[[343,15]]},"706":{"position":[[343,15]]}},"keywords":{}}],["var<i64>",{"_index":3633,"title":{},"content":{"598":{"position":[[406,15],[592,15]]},"706":{"position":[[406,15],[592,15]]}},"keywords":{}}],["var<metadata>",{"_index":2554,"title":{},"content":{"209":{"position":[[872,20]]},"388":{"position":[[804,20]]},"658":{"position":[[804,20]]}},"keywords":{}}],["var<option<address>>",{"_index":2316,"title":{},"content":{"195":{"position":[[132,32]]},"431":{"position":[[132,32]]},"678":{"position":[[132,32]]}},"keywords":{}}],["var<status>",{"_index":3722,"title":{},"content":{"602":{"position":[[201,18]]},"710":{"position":[[201,18]]}},"keywords":{}}],["var<string>",{"_index":1525,"title":{},"content":{"84":{"position":[[239,18]]},"162":{"position":[[426,18]]},"163":{"position":[[409,18]]},"164":{"position":[[202,18]]},"203":{"position":[[185,18],[210,18]]},"253":{"position":[[239,18]]},"269":{"position":[[353,18],[378,18]]},"321":{"position":[[959,18]]},"351":{"position":[[463,18]]},"352":{"position":[[431,18]]},"353":{"position":[[237,18]]},"384":{"position":[[366,18],[391,18]]},"409":{"position":[[353,18],[378,18]]},"423":{"position":[[185,18],[210,18]]},"484":{"position":[[239,18]]},"539":{"position":[[959,18]]},"567":{"position":[[463,18]]},"568":{"position":[[431,18]]},"569":{"position":[[237,18]]},"596":{"position":[[252,18]]},"600":{"position":[[107,18]]},"626":{"position":[[366,18],[391,18]]},"646":{"position":[[353,18],[378,18]]},"665":{"position":[[185,18],[210,18]]},"704":{"position":[[252,18]]},"708":{"position":[[107,18]]}},"keywords":{}}],["var<t>",{"_index":1433,"title":{},"content":{"78":{"position":[[246,12]]},"147":{"position":[[1343,13]]},"229":{"position":[[267,12]]},"335":{"position":[[1351,13]]},"460":{"position":[[267,12]]},"552":{"position":[[1351,13]]}},"keywords":{}}],["var<u256>",{"_index":2440,"title":{},"content":{"203":{"position":[[243,16]]},"269":{"position":[[411,16]]},"384":{"position":[[424,16]]},"409":{"position":[[411,16]]},"423":{"position":[[243,16]]},"598":{"position":[[278,16],[562,16]]},"600":{"position":[[135,16]]},"626":{"position":[[424,16]]},"646":{"position":[[411,16]]},"665":{"position":[[243,16]]},"706":{"position":[[278,16],[562,16]]},"708":{"position":[[135,16]]}},"keywords":{}}],["var<u32>",{"_index":1385,"title":{},"content":{"73":{"position":[[58,14]]},"162":{"position":[[404,15]]},"163":{"position":[[1668,14]]},"209":{"position":[[850,15],[1538,15]]},"223":{"position":[[368,15]]},"237":{"position":[[58,14]]},"351":{"position":[[441,15]]},"352":{"position":[[1690,14]]},"388":{"position":[[782,15],[1470,15]]},"456":{"position":[[368,15]]},"473":{"position":[[58,14]]},"567":{"position":[[441,15]]},"568":{"position":[[1690,14]]},"605":{"position":[[72,14]]},"606":{"position":[[77,15]]},"658":{"position":[[782,15],[1470,15]]},"696":{"position":[[368,15]]},"713":{"position":[[72,14]]},"714":{"position":[[77,15]]}},"keywords":{}}],["var<u64>",{"_index":3225,"title":{},"content":{"416":{"position":[[746,15]]},"419":{"position":[[1117,15]]},"476":{"position":[[382,14]]},"653":{"position":[[746,15]]},"656":{"position":[[1117,15]]},"698":{"position":[[382,14]]}},"keywords":{}}],["var<u8>",{"_index":2439,"title":{},"content":{"203":{"position":[[162,14]]},"269":{"position":[[330,14]]},"384":{"position":[[343,14]]},"409":{"position":[[330,14]]},"423":{"position":[[162,14]]},"598":{"position":[[215,14]]},"626":{"position":[[343,14]]},"646":{"position":[[330,14]]},"665":{"position":[[162,14]]},"706":{"position":[[215,14]]}},"keywords":{}}],["var<vec<todo>>",{"_index":3731,"title":{},"content":{"602":{"position":[[1101,26]]},"710":{"position":[[1101,26]]}},"keywords":{}}],["var<vec<u256>>",{"_index":3836,"title":{},"content":{"613":{"position":[[586,26],[878,27],[2117,26]]},"721":{"position":[[586,26],[878,27],[2117,26]]}},"keywords":{}}],["var<vec<u32>>",{"_index":2053,"title":{},"content":{"162":{"position":[[452,26]]},"351":{"position":[[489,26]]},"567":{"position":[[489,26]]},"601":{"position":[[1261,26]]},"709":{"position":[[1261,26]]}},"keywords":{}}],["var.l22",{"_index":3328,"title":{},"content":{"432":{"position":[[1263,7]]},"679":{"position":[[1263,7]]}},"keywords":{}}],["var.l28",{"_index":2343,"title":{},"content":{"196":{"position":[[1321,7]]}},"keywords":{}}],["var.remov",{"_index":2820,"title":{},"content":{"267":{"position":[[432,10]]},"407":{"position":[[432,10]]},"644":{"position":[[432,10]]}},"keywords":{}}],["var::get",{"_index":2375,"title":{},"content":{"197":{"position":[[1521,10],[1771,10]]},"433":{"position":[[1520,10],[1770,10]]},"680":{"position":[[1520,10],[1770,10]]}},"keywords":{}}],["var::get_or_default",{"_index":2378,"title":{},"content":{"197":{"position":[[1839,21]]},"433":{"position":[[1838,21]]},"680":{"position":[[1838,21]]}},"keywords":{}}],["variabl",{"_index":409,"title":{"597":{"position":[[0,8]]},"600":{"position":[[0,10]]},"705":{"position":[[0,8]]},"708":{"position":[[0,10]]}},"content":{"15":{"position":[[279,12]]},"17":{"position":[[259,9]]},"31":{"position":[[2344,9],[2839,8]]},"39":{"position":[[2140,10],[2900,9]]},"51":{"position":[[408,9]]},"65":{"position":[[213,8]]},"126":{"position":[[281,10]]},"129":{"position":[[333,8]]},"162":{"position":[[179,8],[1617,8]]},"163":{"position":[[1357,9]]},"240":{"position":[[213,8]]},"277":{"position":[[281,10]]},"280":{"position":[[333,8]]},"351":{"position":[[179,8],[1639,8]]},"352":{"position":[[1379,9]]},"465":{"position":[[213,8]]},"514":{"position":[[281,10]]},"517":{"position":[[333,8]]},"567":{"position":[[179,8],[1639,8]]},"568":{"position":[[1379,9]]},"596":{"position":[[716,10],[836,8],[1052,9]]},"598":{"position":[[2075,9]]},"599":{"position":[[515,8]]},"600":{"position":[[89,9],[175,9],[341,9],[371,9],[502,10],[519,10],[536,10],[558,10],[575,9],[677,9],[798,9],[925,9],[980,9],[1134,9]]},"602":{"position":[[745,8]]},"607":{"position":[[20,9]]},"613":{"position":[[1305,9],[2194,8]]},"704":{"position":[[716,10],[836,8],[1052,9]]},"706":{"position":[[2075,9]]},"707":{"position":[[515,8]]},"708":{"position":[[89,9],[175,9],[341,9],[371,9],[502,10],[519,10],[536,10],[558,10],[575,9],[677,9],[798,9],[925,9],[980,9],[1134,9]]},"710":{"position":[[745,8]]},"715":{"position":[[20,9]]},"721":{"position":[[1305,9],[2194,8]]}},"keywords":{}}],["variable<address>",{"_index":471,"title":{},"content":{"17":{"position":[[518,24]]}},"keywords":{}}],["variable<bool>",{"_index":467,"title":{},"content":{"17":{"position":[[455,21]]},"22":{"position":[[1118,21]]}},"keywords":{}}],["variable<string>",{"_index":340,"title":{},"content":{"10":{"position":[[745,23]]},"17":{"position":[[1980,23],[2012,23]]}},"keywords":{}}],["variable<u256>",{"_index":517,"title":{},"content":{"17":{"position":[[2080,21]]}},"keywords":{}}],["variable<u32>",{"_index":469,"title":{},"content":{"17":{"position":[[490,20]]},"51":{"position":[[521,19]]}},"keywords":{}}],["variable<u8>",{"_index":515,"title":{},"content":{"17":{"position":[[2046,19]]}},"keywords":{}}],["variant",{"_index":2368,"title":{},"content":{"197":{"position":[[1065,7],[1450,7]]},"321":{"position":[[1781,8]]},"324":{"position":[[833,7]]},"433":{"position":[[1064,7],[1449,7]]},"539":{"position":[[1781,8]]},"542":{"position":[[833,7]]},"680":{"position":[[1064,7],[1449,7]]}},"keywords":{}}],["variat",{"_index":2081,"title":{},"content":{"163":{"position":[[167,9]]},"352":{"position":[[167,9]]},"568":{"position":[[167,9]]}},"keywords":{}}],["variou",{"_index":1732,"title":{},"content":{"115":{"position":[[1440,7]]},"258":{"position":[[1386,7]]},"442":{"position":[[121,7]]},"481":{"position":[[1386,7]]},"689":{"position":[[121,7]]}},"keywords":{}}],["vec",{"_index":2054,"title":{},"content":{"162":{"position":[[545,3],[1930,3]]},"164":{"position":[[91,4],[300,4]]},"209":{"position":[[1100,5]]},"212":{"position":[[1426,6],[2032,7]]},"351":{"position":[[582,3],[1952,3]]},"353":{"position":[[91,4],[335,4]]},"388":{"position":[[1032,5]]},"391":{"position":[[1426,6],[2032,7]]},"419":{"position":[[1603,7],[1611,7]]},"567":{"position":[[582,3],[1952,3]]},"569":{"position":[[91,4],[335,4]]},"601":{"position":[[1256,4],[1556,3],[1667,3],[1948,3]]},"613":{"position":[[686,3]]},"656":{"position":[[1603,7],[1611,7]]},"658":{"position":[[1032,5]]},"661":{"position":[[1426,6],[2032,7]]},"709":{"position":[[1256,4],[1556,3],[1667,3],[1948,3]]},"721":{"position":[[686,3]]}},"keywords":{}}],["vec<address>",{"_index":3306,"title":{},"content":{"419":{"position":[[2228,19],[2261,19],[2292,18]]},"656":{"position":[[2228,19],[2261,19],[2292,18]]}},"keywords":{}}],["vec<base>",{"_index":925,"title":{},"content":{"39":{"position":[[782,16]]}},"keywords":{}}],["vec<contractpart>",{"_index":927,"title":{},"content":{"39":{"position":[[810,24]]}},"keywords":{}}],["vec<doccomment>",{"_index":920,"title":{},"content":{"39":{"position":[[693,22]]}},"keywords":{}}],["vec<price>",{"_index":2551,"title":{},"content":{"209":{"position":[[637,17]]},"212":{"position":[[536,17]]},"388":{"position":[[598,17]]},"391":{"position":[[536,17]]},"658":{"position":[[598,17]]},"661":{"position":[[536,17]]}},"keywords":{}}],["vec<u8>",{"_index":1519,"title":{},"content":{"83":{"position":[[653,15]]},"212":{"position":[[671,13]]},"252":{"position":[[653,15]]},"267":{"position":[[2567,13]]},"391":{"position":[[671,13]]},"407":{"position":[[2567,13]]},"483":{"position":[[653,15]]},"644":{"position":[[2567,13]]},"661":{"position":[[671,13]]}},"keywords":{}}],["vec.is_empti",{"_index":3838,"title":{},"content":{"613":{"position":[[718,14]]},"721":{"position":[[718,14]]}},"keywords":{}}],["vec.pop",{"_index":3711,"title":{},"content":{"601":{"position":[[1700,10]]},"709":{"position":[[1700,10]]}},"keywords":{}}],["vec.pop().unwrap_or_revert(&env",{"_index":3841,"title":{},"content":{"613":{"position":[[781,37]]},"721":{"position":[[781,37]]}},"keywords":{}}],["vec.push(valu",{"_index":3708,"title":{},"content":{"601":{"position":[[1589,16]]},"709":{"position":[[1589,16]]}},"keywords":{}}],["vec::new",{"_index":750,"title":{},"content":{"31":{"position":[[1061,11],[1927,11],[2623,11]]},"212":{"position":[[3871,11]]},"391":{"position":[[3889,11]]},"616":{"position":[[306,11]]},"661":{"position":[[3889,11]]},"724":{"position":[[306,11]]}},"keywords":{}}],["vec[index",{"_index":3840,"title":{},"content":{"613":{"position":[[768,10]]},"721":{"position":[[768,10]]}},"keywords":{}}],["vector",{"_index":2076,"title":{},"content":{"162":{"position":[[2325,6]]},"164":{"position":[[972,6]]},"165":{"position":[[86,8]]},"209":{"position":[[494,6]]},"212":{"position":[[1836,6],[1916,6],[2070,7]]},"351":{"position":[[2347,6]]},"353":{"position":[[1007,6]]},"354":{"position":[[86,8]]},"388":{"position":[[484,6]]},"391":{"position":[[1836,6],[1916,6],[2070,7]]},"567":{"position":[[2347,6]]},"569":{"position":[[1007,6]]},"570":{"position":[[86,8]]},"601":{"position":[[2241,6]]},"613":{"position":[[2217,6]]},"658":{"position":[[484,6]]},"661":{"position":[[1836,6],[1916,6],[2070,7]]},"709":{"position":[[2241,6]]},"721":{"position":[[2217,6]]}},"keywords":{}}],["verbos",{"_index":2613,"title":{},"content":{"212":{"position":[[95,11]]},"391":{"position":[[95,11]]},"596":{"position":[[506,7]]},"661":{"position":[[95,11]]},"704":{"position":[[506,7]]}},"keywords":{}}],["verbosity::low",{"_index":2628,"title":{},"content":{"212":{"position":[[786,15],[1000,15]]},"391":{"position":[[786,15],[1000,15]]},"661":{"position":[[786,15],[1000,15]]}},"keywords":{}}],["veri",{"_index":620,"title":{},"content":{"21":{"position":[[4,4]]},"42":{"position":[[39,4]]},"94":{"position":[[30,4]]},"164":{"position":[[280,4]]},"286":{"position":[[30,4]]},"353":{"position":[[315,4]]},"498":{"position":[[30,4]]},"569":{"position":[[315,4]]},"594":{"position":[[485,4]]},"600":{"position":[[860,4]]},"702":{"position":[[485,4]]},"708":{"position":[[860,4]]}},"keywords":{}}],["verif",{"_index":217,"title":{},"content":{"6":{"position":[[349,13]]},"10":{"position":[[8,12],[685,13],[853,13],[1110,12]]},"11":{"position":[[108,12]]},"12":{"position":[[219,12]]}},"keywords":{}}],["verifi",{"_index":207,"title":{"10":{"position":[[0,9]]}},"content":{"6":{"position":[[184,8]]},"8":{"position":[[390,6]]},"9":{"position":[[1018,6]]},"10":{"position":[[642,8],[726,8],[792,8],[1161,8]]},"11":{"position":[[49,6],[200,6]]},"32":{"position":[[1456,6]]},"168":{"position":[[2148,8]]},"348":{"position":[[2158,8]]},"564":{"position":[[2148,8]]}},"keywords":{}}],["verifier/src/verifier_contract.r",{"_index":329,"title":{},"content":{"10":{"position":[[350,33]]}},"keywords":{}}],["verify(&mut",{"_index":344,"title":{},"content":{"10":{"position":[[874,15]]}},"keywords":{}}],["verify(journ",{"_index":346,"title":{},"content":{"10":{"position":[[911,15],[1177,15]]}},"keywords":{}}],["verify."",{"_index":302,"title":{},"content":{"9":{"position":[[1138,14]]}},"keywords":{}}],["version",{"_index":150,"title":{},"content":{"3":{"position":[[468,8]]},"16":{"position":[[284,7]]},"30":{"position":[[536,7]]},"42":{"position":[[466,7]]},"52":{"position":[[565,8]]},"91":{"position":[[452,7]]},"117":{"position":[[404,7],[1201,7]]},"131":{"position":[[80,7],[574,7]]},"138":{"position":[[987,8]]},"209":{"position":[[259,7],[767,8],[841,8]]},"211":{"position":[[190,8]]},"261":{"position":[[75,7]]},"265":{"position":[[482,7]]},"267":{"position":[[76,7]]},"283":{"position":[[452,7]]},"298":{"position":[[404,7],[1201,7]]},"311":{"position":[[80,7],[626,7]]},"318":{"position":[[979,8]]},"321":{"position":[[611,7],[651,7],[672,7]]},"324":{"position":[[38,7],[77,7],[372,7],[415,7]]},"379":{"position":[[75,7]]},"388":{"position":[[259,7],[699,8],[773,8]]},"390":{"position":[[190,8]]},"395":{"position":[[2585,7],[2664,7],[2752,7],[2851,7],[2931,7],[3038,7]]},"401":{"position":[[75,7]]},"405":{"position":[[482,7]]},"407":{"position":[[76,7]]},"477":{"position":[[767,7],[954,7]]},"495":{"position":[[452,7]]},"519":{"position":[[404,7],[1201,7]]},"528":{"position":[[80,7],[626,7]]},"539":{"position":[[611,7],[651,7],[672,7]]},"542":{"position":[[38,7],[77,7],[372,7],[415,7]]},"544":{"position":[[979,8]]},"621":{"position":[[75,7]]},"632":{"position":[[2585,7],[2664,7],[2752,7],[2851,7],[2931,7],[3038,7]]},"638":{"position":[[75,7]]},"642":{"position":[[482,7]]},"644":{"position":[[76,7]]},"658":{"position":[[259,7],[699,8],[773,8]]},"660":{"position":[[190,8]]},"699":{"position":[[767,7],[954,7]]}},"keywords":{}}],["via",{"_index":326,"title":{},"content":{"10":{"position":[[318,3]]},"92":{"position":[[599,3]]},"98":{"position":[[589,3]]},"284":{"position":[[599,3]]},"290":{"position":[[589,3]]},"496":{"position":[[599,3]]},"502":{"position":[[589,3]]}},"keywords":{}}],["vicin",{"_index":743,"title":{},"content":{"31":{"position":[[969,8]]}},"keywords":{}}],["view",{"_index":1059,"title":{"605":{"position":[[0,4]]},"713":{"position":[[0,4]]}},"content":{"42":{"position":[[1161,4]]},"438":{"position":[[260,4]]},"605":{"position":[[286,4],[350,4]]},"685":{"position":[[260,4]]},"713":{"position":[[286,4],[350,4]]}},"keywords":{}}],["viewandpur",{"_index":3749,"title":{},"content":{"605":{"position":[[55,11],[110,11]]},"713":{"position":[[55,11],[110,11]]}},"keywords":{}}],["virtual",{"_index":199,"title":{},"content":{"6":{"position":[[81,7]]},"198":{"position":[[2593,7]]},"434":{"position":[[2583,7]]},"681":{"position":[[2593,7]]}},"keywords":{}}],["visibl",{"_index":2978,"title":{"607":{"position":[[0,11]]},"715":{"position":[[0,11]]}},"content":{"321":{"position":[[1657,7],[1798,7],[1982,7],[2110,7]]},"539":{"position":[[1657,7],[1798,7],[1982,7],[2110,7]]}},"keywords":{}}],["visit",{"_index":1775,"title":{},"content":{"118":{"position":[[304,5]]},"163":{"position":[[285,8],[580,8],[842,6],[920,6]]},"299":{"position":[[304,5]]},"352":{"position":[[285,8],[602,8],[864,6],[942,6]]},"520":{"position":[[304,5]]},"568":{"position":[[285,8],[602,8],[864,6],[942,6]]}},"keywords":{}}],["visit(&mut",{"_index":2086,"title":{},"content":{"163":{"position":[[794,14]]},"352":{"position":[[816,14]]},"568":{"position":[[816,14]]}},"keywords":{}}],["visits(&self",{"_index":2090,"title":{},"content":{"163":{"position":[[942,17]]},"352":{"position":[[964,17]]},"568":{"position":[[964,17]]}},"keywords":{}}],["vm",{"_index":1502,"title":{"83":{"position":[[7,2]]},"252":{"position":[[7,2]]},"483":{"position":[[7,2]]}},"content":{"83":{"position":[[28,4]]},"119":{"position":[[277,3],[772,2]]},"148":{"position":[[920,2]]},"252":{"position":[[28,4]]},"300":{"position":[[277,3],[772,2]]},"336":{"position":[[920,2]]},"483":{"position":[[28,4]]},"521":{"position":[[277,3],[772,2]]},"553":{"position":[[920,2]]}},"keywords":{}}],["volum",{"_index":1506,"title":{},"content":{"83":{"position":[[204,8]]},"252":{"position":[[204,8]]},"483":{"position":[[204,8]]}},"keywords":{}}],["vote",{"_index":3132,"title":{"416":{"position":[[0,6]]},"653":{"position":[[0,6]]}},"content":{"395":{"position":[[1158,5],[1319,6],[1497,6]]},"396":{"position":[[932,6]]},"413":{"position":[[186,4]]},"415":{"position":[[307,6],[353,4]]},"416":{"position":[[4,6],[116,4],[199,4],[303,6],[580,5],[606,5],[612,6],[653,4],[720,4],[1031,4],[1535,4],[1908,5],[1954,4],[2235,4],[2531,6],[2632,5],[2731,6],[2752,4],[2893,6],[3000,4],[3264,4],[3328,6],[3365,5],[3461,5],[3547,5],[3683,5],[3699,4],[3927,5],[4184,6],[4318,4],[4527,5]]},"417":{"position":[[467,6],[789,4],[856,5],[1187,6],[1364,5]]},"419":{"position":[[377,4],[434,4],[494,5],[530,4],[951,5],[977,5],[983,6],[1024,4],[1091,4],[4054,4],[4426,5],[4472,4],[4587,5],[4686,6],[4707,4],[4848,6],[4954,4],[5040,5],[5126,5],[5262,5],[5278,4],[5506,5],[5763,6],[5898,4],[6107,5],[6882,6],[7204,4],[7271,5],[7602,6],[7779,5]]},"632":{"position":[[1158,5],[1319,6],[1497,6]]},"633":{"position":[[932,6]]},"650":{"position":[[186,4]]},"652":{"position":[[307,6],[353,4]]},"653":{"position":[[4,6],[116,4],[199,4],[303,6],[580,5],[606,5],[612,6],[653,4],[720,4],[1031,4],[1535,4],[1908,5],[1954,4],[2235,4],[2531,6],[2632,5],[2731,6],[2752,4],[2893,6],[3000,4],[3264,4],[3328,6],[3365,5],[3461,5],[3547,5],[3683,5],[3699,4],[3927,5],[4184,6],[4318,4],[4527,5]]},"654":{"position":[[467,6],[789,4],[856,5],[1187,6],[1364,5]]},"656":{"position":[[377,4],[434,4],[494,5],[530,4],[951,5],[977,5],[983,6],[1024,4],[1091,4],[4054,4],[4426,5],[4472,4],[4587,5],[4686,6],[4707,4],[4848,6],[4954,4],[5040,5],[5126,5],[5262,5],[5278,4],[5506,5],[5763,6],[5898,4],[6107,5],[6882,6],[7204,4],[7271,5],[7602,6],[7779,5]]}},"keywords":{}}],["vote(&mut",{"_index":3243,"title":{},"content":{"416":{"position":[[2667,13]]},"419":{"position":[[4622,13]]},"653":{"position":[[2667,13]]},"656":{"position":[[4622,13]]}},"keywords":{}}],["vote.amount",{"_index":3260,"title":{},"content":{"416":{"position":[[4114,12],[4148,12]]},"419":{"position":[[5693,12],[5727,12]]},"653":{"position":[[4114,12],[4148,12]]},"656":{"position":[[5693,12],[5727,12]]}},"keywords":{}}],["vote.choic",{"_index":3259,"title":{},"content":{"416":{"position":[[4087,11]]},"419":{"position":[[5666,11]]},"653":{"position":[[4087,11]]},"656":{"position":[[5666,11]]}},"keywords":{}}],["vote_end_tim",{"_index":3224,"title":{},"content":{"416":{"position":[[731,14],[1129,14],[2293,13],[3738,14]]},"419":{"position":[[1102,14],[5317,14],[6305,14]]},"653":{"position":[[731,14],[1129,14],[2293,13],[3738,14]]},"656":{"position":[[1102,14],[5317,14],[6305,14]]}},"keywords":{}}],["votealreadyopen",{"_index":3293,"title":{},"content":{"419":{"position":[[406,15]]},"656":{"position":[[406,15]]}},"keywords":{}}],["voteend",{"_index":3296,"title":{},"content":{"419":{"position":[[541,9]]},"656":{"position":[[541,9]]}},"keywords":{}}],["votenotyetend",{"_index":3295,"title":{},"content":{"419":{"position":[[505,15]]},"656":{"position":[[505,15]]}},"keywords":{}}],["voter",{"_index":3133,"title":{},"content":{"395":{"position":[[1180,6]]},"416":{"position":[[787,6],[829,6],[2806,5],[2916,5],[3043,6],[3410,6],[4205,6]]},"419":{"position":[[199,6],[241,6],[4761,5],[4871,5],[4997,6],[5784,6]]},"632":{"position":[[1180,6]]},"653":{"position":[[787,6],[829,6],[2806,5],[2916,5],[3043,6],[3410,6],[4205,6]]},"656":{"position":[[199,6],[241,6],[4761,5],[4871,5],[4997,6],[5784,6]]}},"keywords":{}}],["vs",{"_index":3808,"title":{"612":{"position":[[12,3]]},"720":{"position":[[12,3]]}},"content":{},"keywords":{}}],["wabt",{"_index":2150,"title":{},"content":{"173":{"position":[[156,5]]},"359":{"position":[[156,5]]},"575":{"position":[[156,5]]}},"keywords":{}}],["wait",{"_index":1216,"title":{},"content":{"51":{"position":[[1599,5]]},"52":{"position":[[1858,7]]},"127":{"position":[[353,4],[360,7],[405,4],[412,7]]},"278":{"position":[[353,4],[360,7],[405,4],[412,7]]},"395":{"position":[[1389,4],[4664,4],[4671,7],[4768,4],[4775,7],[5331,4],[5338,7],[5435,4],[5442,7],[5790,4],[5797,7],[5894,4],[5901,7],[6150,7],[6310,4],[6317,7],[6414,4],[6421,7]]},"417":{"position":[[776,4]]},"419":{"position":[[7191,4]]},"477":{"position":[[2684,4],[2691,7],[3167,4],[3174,7],[3548,4],[3555,7]]},"515":{"position":[[353,4],[360,7],[405,4],[412,7]]},"632":{"position":[[1389,4],[4664,4],[4671,7],[4768,4],[4775,7],[5331,4],[5338,7],[5435,4],[5442,7],[5790,4],[5797,7],[5894,4],[5901,7],[6150,7],[6310,4],[6317,7],[6414,4],[6421,7]]},"654":{"position":[[776,4]]},"656":{"position":[[7191,4]]},"699":{"position":[[2684,4],[2691,7],[3167,4],[3174,7],[3548,4],[3555,7]]}},"keywords":{}}],["walk",{"_index":2052,"title":{},"content":{"162":{"position":[[445,6],[1198,5],[1309,5],[2082,5],[2219,5]]},"164":{"position":[[58,4],[221,6],[436,4],[928,5],[1045,6]]},"351":{"position":[[482,6],[1220,5],[1331,5],[2104,5],[2241,5]]},"353":{"position":[[58,4],[256,6],[471,4],[963,5],[1080,6]]},"567":{"position":[[482,6],[1220,5],[1331,5],[2104,5],[2241,5]]},"569":{"position":[[58,4],[256,6],[471,4],[963,5],[1080,6]]}},"keywords":{}}],["walk_the_dog(&mut",{"_index":2109,"title":{},"content":{"164":{"position":[[829,21]]},"353":{"position":[[864,21]]},"569":{"position":[[864,21]]}},"keywords":{}}],["walks.iter().sum",{"_index":2069,"title":{},"content":{"162":{"position":[[1346,18]]},"351":{"position":[[1368,18]]},"567":{"position":[[1368,18]]}},"keywords":{}}],["walks.len",{"_index":2067,"title":{},"content":{"162":{"position":[[1235,11],[2256,11]]},"351":{"position":[[1257,11],[2278,11]]},"567":{"position":[[1257,11],[2278,11]]}},"keywords":{}}],["walks_amount(&self",{"_index":2065,"title":{},"content":{"162":{"position":[[1158,23],[2177,23]]},"164":{"position":[[692,23]]},"351":{"position":[[1180,23],[2199,23]]},"353":{"position":[[727,23]]},"567":{"position":[[1180,23],[2199,23]]},"569":{"position":[[727,23]]}},"keywords":{}}],["walks_total_length(&self",{"_index":2068,"title":{},"content":{"162":{"position":[[1263,29]]},"164":{"position":[[754,29]]},"351":{"position":[[1285,29]]},"353":{"position":[[789,29]]},"567":{"position":[[1285,29]]},"569":{"position":[[789,29]]}},"keywords":{}}],["wallet",{"_index":3103,"title":{"393":{"position":[[7,7]]},"397":{"position":[[33,7]]},"630":{"position":[[7,7]]},"634":{"position":[[33,7]]}},"content":{"393":{"position":[[24,6],[157,7]]},"394":{"position":[[268,6],[515,7]]},"395":{"position":[[4164,7]]},"397":{"position":[[7,6],[282,6]]},"398":{"position":[[115,7],[247,6]]},"630":{"position":[[24,6],[157,7]]},"631":{"position":[[268,6],[515,7]]},"632":{"position":[[4164,7]]},"634":{"position":[[7,6],[282,6]]},"635":{"position":[[115,7],[247,6]]}},"keywords":{}}],["want",{"_index":323,"title":{},"content":{"10":{"position":[[218,4]]},"16":{"position":[[414,5]]},"53":{"position":[[20,4]]},"54":{"position":[[389,4]]},"68":{"position":[[13,4]]},"88":{"position":[[331,4]]},"94":{"position":[[100,4]]},"96":{"position":[[145,4]]},"102":{"position":[[361,4]]},"103":{"position":[[155,4],[268,4],[354,4],[512,4]]},"117":{"position":[[578,5],[933,4],[1125,4]]},"118":{"position":[[7,4]]},"119":{"position":[[232,4],[804,4],[994,4]]},"120":{"position":[[288,4]]},"121":{"position":[[7,4]]},"126":{"position":[[138,4]]},"129":{"position":[[91,4]]},"142":{"position":[[125,4]]},"154":{"position":[[218,4]]},"157":{"position":[[531,4]]},"162":{"position":[[2061,4]]},"176":{"position":[[7,4]]},"198":{"position":[[2927,4],[3235,4]]},"206":{"position":[[3782,4]]},"223":{"position":[[1334,4]]},"243":{"position":[[13,4]]},"250":{"position":[[331,4]]},"264":{"position":[[417,4]]},"277":{"position":[[138,4]]},"280":{"position":[[91,4]]},"286":{"position":[[100,4]]},"288":{"position":[[145,4]]},"294":{"position":[[361,4]]},"295":{"position":[[155,4],[268,4],[354,4],[512,4]]},"298":{"position":[[578,5],[933,4],[1125,4]]},"299":{"position":[[7,4]]},"300":{"position":[[232,4],[804,4],[994,4]]},"301":{"position":[[288,4]]},"302":{"position":[[7,4]]},"327":{"position":[[125,4]]},"330":{"position":[[517,4]]},"339":{"position":[[218,4]]},"351":{"position":[[2083,4]]},"362":{"position":[[7,4]]},"382":{"position":[[230,4]]},"393":{"position":[[208,4]]},"404":{"position":[[417,4]]},"415":{"position":[[83,4]]},"426":{"position":[[3757,4]]},"434":{"position":[[2909,4],[3217,4]]},"456":{"position":[[1334,4]]},"468":{"position":[[13,4]]},"488":{"position":[[331,4]]},"498":{"position":[[100,4]]},"500":{"position":[[145,4]]},"506":{"position":[[361,4]]},"507":{"position":[[155,4],[268,4],[354,4],[512,4]]},"514":{"position":[[138,4]]},"517":{"position":[[91,4]]},"519":{"position":[[578,5],[933,4],[1125,4]]},"520":{"position":[[7,4]]},"521":{"position":[[232,4],[804,4],[994,4]]},"522":{"position":[[288,4]]},"523":{"position":[[7,4]]},"536":{"position":[[125,4]]},"547":{"position":[[531,4]]},"559":{"position":[[218,4]]},"567":{"position":[[2083,4]]},"578":{"position":[[7,4]]},"605":{"position":[[538,4]]},"624":{"position":[[230,4]]},"630":{"position":[[208,4]]},"641":{"position":[[417,4]]},"652":{"position":[[83,4]]},"668":{"position":[[3782,4]]},"681":{"position":[[2927,4],[3235,4]]},"696":{"position":[[1334,4]]},"713":{"position":[[538,4]]}},"keywords":{}}],["warn",{"_index":2949,"title":{},"content":{"270":{"position":[[440,9]]},"385":{"position":[[440,9]]},"410":{"position":[[440,9]]},"627":{"position":[[440,9]]},"647":{"position":[[440,9]]}},"keywords":{}}],["was:it'",{"_index":122,"title":{},"content":{"3":{"position":[[32,8]]}},"keywords":{}}],["wasm",{"_index":209,"title":{"98":{"position":[[0,4]]},"136":{"position":[[0,6]]},"290":{"position":[[0,4]]},"316":{"position":[[0,6]]},"502":{"position":[[0,4]]},"533":{"position":[[0,6]]}},"content":{"6":{"position":[[219,5]]},"42":{"position":[[2634,4]]},"43":{"position":[[1650,4]]},"52":{"position":[[21,4],[294,4],[1002,4],[1034,4],[1153,4],[1449,4],[1615,4],[2254,4],[2319,4]]},"53":{"position":[[480,4],[711,4],[975,4]]},"65":{"position":[[405,4],[602,4]]},"66":{"position":[[25,4],[56,4],[73,4],[131,4],[146,4],[174,4],[287,4]]},"68":{"position":[[411,4],[444,4]]},"95":{"position":[[36,4]]},"96":{"position":[[169,4]]},"100":{"position":[[249,4]]},"119":{"position":[[428,4]]},"120":{"position":[[180,4],[210,4]]},"127":{"position":[[199,4]]},"136":{"position":[[0,4],[94,4]]},"173":{"position":[[533,4]]},"210":{"position":[[244,4]]},"240":{"position":[[405,4],[602,4]]},"241":{"position":[[25,4],[56,4],[73,4],[131,4],[146,4],[174,4],[287,4]]},"243":{"position":[[411,4],[444,4]]},"278":{"position":[[199,4]]},"287":{"position":[[36,4]]},"288":{"position":[[169,4]]},"292":{"position":[[249,4]]},"300":{"position":[[428,4]]},"301":{"position":[[180,4],[210,4]]},"316":{"position":[[0,4],[94,4]]},"324":{"position":[[1485,4]]},"359":{"position":[[533,4]]},"389":{"position":[[244,4]]},"395":{"position":[[4618,4]]},"465":{"position":[[405,4],[602,4]]},"466":{"position":[[25,4],[56,4],[73,4],[131,4],[146,4],[174,4],[287,4]]},"468":{"position":[[411,4],[444,4]]},"477":{"position":[[244,4],[2632,4]]},"478":{"position":[[57,4]]},"499":{"position":[[36,4]]},"500":{"position":[[169,4]]},"504":{"position":[[249,4]]},"515":{"position":[[199,4]]},"521":{"position":[[428,4]]},"522":{"position":[[180,4],[210,4]]},"533":{"position":[[0,4],[94,4]]},"542":{"position":[[1485,4]]},"575":{"position":[[533,4]]},"606":{"position":[[1103,4]]},"632":{"position":[[4618,4]]},"659":{"position":[[244,4]]},"699":{"position":[[244,4],[2632,4]]},"700":{"position":[[57,4]]},"714":{"position":[[1103,4]]}},"keywords":{}}],["wasm/counter.wasm",{"_index":1651,"title":{},"content":{"99":{"position":[[392,19]]},"291":{"position":[[392,19]]},"503":{"position":[[392,19]]}},"keywords":{}}],["wasm/erc1155_token.wasm",{"_index":1677,"title":{},"content":{"101":{"position":[[339,25]]},"293":{"position":[[339,25]]},"505":{"position":[[339,25]]}},"keywords":{}}],["wasm/erc721_token.wasm",{"_index":1662,"title":{},"content":{"100":{"position":[[485,24]]},"292":{"position":[[485,24]]},"504":{"position":[[485,24]]}},"keywords":{}}],["wasm/my_contract.wasm",{"_index":1339,"title":{},"content":{"65":{"position":[[761,21]]},"66":{"position":[[84,21],[202,21],[227,21]]},"68":{"position":[[389,21],[422,21],[472,21],[497,21]]},"240":{"position":[[761,21]]},"241":{"position":[[84,21],[202,21],[227,21]]},"243":{"position":[[389,21],[422,21],[472,21],[497,21]]},"465":{"position":[[761,21]]},"466":{"position":[[84,21],[202,21],[227,21]]},"468":{"position":[[389,21],[422,21],[472,21],[497,21]]}},"keywords":{}}],["wasm32",{"_index":1325,"title":{},"content":{"65":{"position":[[126,6]]},"68":{"position":[[264,6]]},"173":{"position":[[408,6],[437,6]]},"240":{"position":[[126,6]]},"243":{"position":[[264,6]]},"359":{"position":[[408,6],[437,6]]},"465":{"position":[[126,6]]},"468":{"position":[[264,6]]},"575":{"position":[[408,6],[437,6]]}},"keywords":{}}],["wasm_path",{"_index":1255,"title":{},"content":{"52":{"position":[[1007,9],[1047,13]]}},"keywords":{}}],["wasmd",{"_index":1230,"title":{},"content":{"52":{"position":[[304,6]]}},"keywords":{}}],["way",{"_index":715,"title":{},"content":{"31":{"position":[[103,3]]},"52":{"position":[[1926,4]]},"92":{"position":[[668,3]]},"97":{"position":[[112,5]]},"102":{"position":[[429,3]]},"117":{"position":[[1243,3],[1351,3]]},"148":{"position":[[467,3]]},"198":{"position":[[2049,3]]},"219":{"position":[[106,4]]},"223":{"position":[[1224,4]]},"264":{"position":[[28,3]]},"267":{"position":[[1882,3],[3594,3]]},"268":{"position":[[262,3],[2207,3],[2895,4]]},"284":{"position":[[668,3]]},"289":{"position":[[112,5]]},"294":{"position":[[429,3]]},"298":{"position":[[1243,3],[1351,3]]},"336":{"position":[[467,3]]},"382":{"position":[[35,3]]},"383":{"position":[[63,3]]},"394":{"position":[[78,3]]},"404":{"position":[[28,3]]},"407":{"position":[[1882,3],[3594,3]]},"408":{"position":[[262,3],[2207,3],[2895,4]]},"413":{"position":[[15,4]]},"434":{"position":[[2039,3]]},"452":{"position":[[106,4]]},"456":{"position":[[1224,4]]},"496":{"position":[[668,3]]},"501":{"position":[[112,5]]},"506":{"position":[[429,3]]},"519":{"position":[[1243,3],[1351,3]]},"553":{"position":[[467,3]]},"594":{"position":[[578,3]]},"611":{"position":[[573,4],[667,3]]},"612":{"position":[[2092,3]]},"613":{"position":[[1537,5]]},"617":{"position":[[1156,4],[1394,4]]},"624":{"position":[[35,3]]},"625":{"position":[[63,3]]},"631":{"position":[[78,3]]},"641":{"position":[[28,3]]},"644":{"position":[[1882,3],[3594,3]]},"645":{"position":[[262,3],[2207,3],[2895,4]]},"650":{"position":[[15,4]]},"681":{"position":[[2049,3]]},"692":{"position":[[106,4]]},"696":{"position":[[1224,4]]},"702":{"position":[[578,3]]},"719":{"position":[[573,4],[667,3]]},"720":{"position":[[2092,3]]},"721":{"position":[[1537,5]]},"725":{"position":[[1156,4],[1394,4]]}},"keywords":{}}],["we'll",{"_index":1792,"title":{},"content":{"124":{"position":[[21,5]]},"155":{"position":[[21,5]]},"164":{"position":[[96,5]]},"166":{"position":[[21,5]]},"309":{"position":[[21,5]]},"340":{"position":[[21,5]]},"353":{"position":[[96,5]]},"355":{"position":[[21,5]]},"526":{"position":[[21,5]]},"560":{"position":[[21,5]]},"569":{"position":[[96,5]]},"571":{"position":[[21,5]]}},"keywords":{}}],["we'r",{"_index":1796,"title":{},"content":{"126":{"position":[[515,5]]},"145":{"position":[[187,5]]},"168":{"position":[[1277,5]]},"277":{"position":[[515,5]]},"333":{"position":[[187,5]]},"348":{"position":[[1277,5]]},"514":{"position":[[515,5]]},"550":{"position":[[187,5]]},"564":{"position":[[1277,5]]}},"keywords":{}}],["we'v",{"_index":865,"title":{},"content":{"38":{"position":[[352,5]]},"398":{"position":[[0,5],[123,5]]},"635":{"position":[[0,5],[123,5]]}},"keywords":{}}],["webassembl",{"_index":599,"title":{},"content":{"20":{"position":[[708,12]]},"22":{"position":[[389,11]]}},"keywords":{}}],["websit",{"_index":203,"title":{},"content":{"6":{"position":[[136,8]]},"393":{"position":[[127,8]]},"396":{"position":[[676,7]]},"630":{"position":[[127,8]]},"633":{"position":[[676,7]]}},"keywords":{}}],["weight",{"_index":2051,"title":{},"content":{"162":{"position":[[396,7],[804,7]]},"351":{"position":[[433,7],[826,7]]},"567":{"position":[[433,7],[826,7]]}},"keywords":{}}],["weight(&self",{"_index":2062,"title":{},"content":{"162":{"position":[[1023,17]]},"351":{"position":[[1045,17]]},"567":{"position":[[1045,17]]}},"keywords":{}}],["well",{"_index":584,"title":{},"content":{"20":{"position":[[400,4]]},"39":{"position":[[291,4],[1391,4]]},"54":{"position":[[476,6]]},"414":{"position":[[782,4]]},"651":{"position":[[782,4]]}},"keywords":{}}],["went",{"_index":2153,"title":{},"content":{"174":{"position":[[376,4]]},"360":{"position":[[376,4]]},"576":{"position":[[376,4]]}},"keywords":{}}],["weth",{"_index":2294,"title":{},"content":{"188":{"position":[[837,5]]},"365":{"position":[[1194,5]]},"581":{"position":[[1194,5]]}},"keywords":{}}],["what'",{"_index":125,"title":{"26":{"position":[[0,6]]},"28":{"position":[[0,6]]},"36":{"position":[[0,6]]},"46":{"position":[[0,6]]},"48":{"position":[[0,6]]},"57":{"position":[[0,6]]},"59":{"position":[[0,6]]},"61":{"position":[[0,6]]},"63":{"position":[[0,6]]},"112":{"position":[[0,6]]},"122":{"position":[[0,6]]},"124":{"position":[[0,6]]},"139":{"position":[[0,6]]},"149":{"position":[[0,6]]},"152":{"position":[[0,6]]},"155":{"position":[[0,6]]},"158":{"position":[[0,6]]},"166":{"position":[[0,6]]},"169":{"position":[[0,6]]},"171":{"position":[[0,6]]},"176":{"position":[[0,6]]},"180":{"position":[[0,6]]},"200":{"position":[[0,6]]},"207":{"position":[[0,6]]},"214":{"position":[[0,6]]},"216":{"position":[[0,6]]},"225":{"position":[[0,6]]},"303":{"position":[[0,6]]},"307":{"position":[[0,6]]},"309":{"position":[[0,6]]},"319":{"position":[[0,6]]},"331":{"position":[[0,6]]},"337":{"position":[[0,6]]},"340":{"position":[[0,6]]},"343":{"position":[[0,6]]},"349":{"position":[[0,6]]},"355":{"position":[[0,6]]},"357":{"position":[[0,6]]},"362":{"position":[[0,6]]},"371":{"position":[[0,6]]},"418":{"position":[[0,6]]},"427":{"position":[[0,6]]},"436":{"position":[[0,6]]},"449":{"position":[[0,6]]},"512":{"position":[[0,6]]},"524":{"position":[[0,6]]},"526":{"position":[[0,6]]},"545":{"position":[[0,6]]},"548":{"position":[[0,6]]},"554":{"position":[[0,6]]},"557":{"position":[[0,6]]},"560":{"position":[[0,6]]},"565":{"position":[[0,6]]},"571":{"position":[[0,6]]},"573":{"position":[[0,6]]},"578":{"position":[[0,6]]},"587":{"position":[[0,6]]},"655":{"position":[[0,6]]},"669":{"position":[[0,6]]},"683":{"position":[[0,6]]}},"content":{"3":{"position":[[65,6]]},"136":{"position":[[140,6]]},"316":{"position":[[140,6]]},"533":{"position":[[140,6]]}},"keywords":{}}],["whatev",{"_index":2799,"title":{},"content":{"264":{"position":[[395,8]]},"382":{"position":[[208,8]]},"404":{"position":[[395,8]]},"624":{"position":[[208,8]]},"641":{"position":[[395,8]]}},"keywords":{}}],["wheel",{"_index":648,"title":{},"content":{"22":{"position":[[287,6]]},"38":{"position":[[275,6]]}},"keywords":{}}],["whenev",{"_index":586,"title":{},"content":{"20":{"position":[[439,8]]},"603":{"position":[[229,8]]},"711":{"position":[[229,8]]}},"keywords":{}}],["wherea",{"_index":934,"title":{},"content":{"39":{"position":[[971,7]]}},"keywords":{}}],["whether",{"_index":4,"title":{},"content":{"1":{"position":[[0,7]]},"2":{"position":[[0,7]]},"185":{"position":[[2678,7]]},"324":{"position":[[1059,7],[1130,7]]},"376":{"position":[[2662,7]]},"416":{"position":[[643,7]]},"419":{"position":[[1014,7]]},"542":{"position":[[1059,7],[1130,7]]},"592":{"position":[[2662,7]]},"607":{"position":[[46,7]]},"653":{"position":[[643,7]]},"656":{"position":[[1014,7]]},"715":{"position":[[46,7]]}},"keywords":{}}],["whichev",{"_index":3596,"title":{},"content":{"478":{"position":[[285,9]]},"700":{"position":[[285,9]]}},"keywords":{}}],["whole",{"_index":637,"title":{},"content":{"21":{"position":[[338,5]]},"107":{"position":[[296,5]]},"162":{"position":[[1883,6],[1975,5],[2308,5]]},"164":{"position":[[966,5]]},"274":{"position":[[296,5]]},"351":{"position":[[1905,6],[1997,5],[2330,5]]},"353":{"position":[[1001,5]]},"491":{"position":[[296,5]]},"567":{"position":[[1905,6],[1997,5],[2330,5]]},"569":{"position":[[1001,5]]},"617":{"position":[[1403,5]]},"725":{"position":[[1403,5]]}},"keywords":{}}],["wide",{"_index":2256,"title":{},"content":{"185":{"position":[[2938,6]]},"270":{"position":[[304,4]]},"376":{"position":[[2922,6]]},"385":{"position":[[304,4]]},"410":{"position":[[304,4]]},"592":{"position":[[2922,6]]},"598":{"position":[[1636,4]]},"627":{"position":[[304,4]]},"647":{"position":[[304,4]]},"706":{"position":[[1636,4]]}},"keywords":{}}],["window",{"_index":3199,"title":{},"content":{"397":{"position":[[289,7]]},"634":{"position":[[289,7]]}},"keywords":{}}],["wish",{"_index":1637,"title":{},"content":{"97":{"position":[[296,5]]},"114":{"position":[[140,4]]},"147":{"position":[[488,4]]},"257":{"position":[[140,4]]},"289":{"position":[[296,5]]},"335":{"position":[[492,4]]},"396":{"position":[[1152,5]]},"480":{"position":[[140,4]]},"501":{"position":[[296,5]]},"552":{"position":[[492,4]]},"633":{"position":[[1152,5]]}},"keywords":{}}],["wit",{"_index":1350,"title":{},"content":{"70":{"position":[[147,3]]},"234":{"position":[[147,3]]},"470":{"position":[[147,3]]}},"keywords":{}}],["with_tokens(u512::from(100",{"_index":3451,"title":{},"content":{"440":{"position":[[5533,29],[5694,29]]},"687":{"position":[[5533,29],[5694,29]]}},"keywords":{}}],["with_tokens(u512::from(50",{"_index":3448,"title":{},"content":{"440":{"position":[[5423,28],[5614,28]]},"687":{"position":[[5423,28],[5614,28]]}},"keywords":{}}],["with_tokens(u512::from(deposit",{"_index":3574,"title":{},"content":{"477":{"position":[[1987,33]]},"699":{"position":[[1987,33]]}},"keywords":{}}],["withdraw",{"_index":1378,"title":{},"content":{"72":{"position":[[184,10]]},"184":{"position":[[817,9]]},"236":{"position":[[184,10]]},"375":{"position":[[736,9]]},"472":{"position":[[184,10]]},"476":{"position":[[235,13],[1174,9],[1805,10],[1849,10]]},"477":{"position":[[1396,8],[1648,11],[2117,8]]},"591":{"position":[[736,9]]},"698":{"position":[[235,13],[1174,9],[1805,10],[1849,10]]},"699":{"position":[[1396,8],[1648,11],[2117,8]]}},"keywords":{}}],["withdraw(&mut",{"_index":3545,"title":{},"content":{"476":{"position":[[1221,17]]},"698":{"position":[[1221,17]]}},"keywords":{}}],["withdraw(&self",{"_index":3782,"title":{},"content":{"608":{"position":[[340,19]]},"716":{"position":[[340,19]]}},"keywords":{}}],["withdraw_amount",{"_index":3805,"title":{},"content":{"611":{"position":[[385,16],[467,15]]},"719":{"position":[[385,16],[467,15]]}},"keywords":{}}],["withdrew",{"_index":3591,"title":{},"content":{"477":{"position":[[3898,8]]},"478":{"position":[[201,8]]},"699":{"position":[[3898,8]]},"700":{"position":[[201,8]]}},"keywords":{}}],["within",{"_index":1468,"title":{},"content":{"79":{"position":[[1356,6]]},"84":{"position":[[854,6]]},"85":{"position":[[995,6]]},"230":{"position":[[1373,6]]},"253":{"position":[[854,6]]},"254":{"position":[[995,6]]},"324":{"position":[[562,6],[749,6]]},"461":{"position":[[1373,6]]},"484":{"position":[[854,6]]},"485":{"position":[[995,6]]},"542":{"position":[[562,6],[749,6]]},"598":{"position":[[2099,6],[2184,6]]},"600":{"position":[[650,6],[743,6],[1004,6],[1089,6]]},"604":{"position":[[63,6]]},"606":{"position":[[959,6]]},"612":{"position":[[305,6],[2025,6]]},"706":{"position":[[2099,6],[2184,6]]},"708":{"position":[[650,6],[743,6],[1004,6],[1089,6]]},"712":{"position":[[63,6]]},"714":{"position":[[959,6]]},"720":{"position":[[305,6],[2025,6]]}},"keywords":{}}],["without",{"_index":193,"title":{},"content":{"5":{"position":[[390,7]]},"22":{"position":[[263,7]]},"38":{"position":[[251,7]]},"50":{"position":[[311,7]]},"115":{"position":[[1554,7]]},"120":{"position":[[69,7]]},"147":{"position":[[647,7]]},"164":{"position":[[946,7]]},"205":{"position":[[191,7]]},"258":{"position":[[1500,7]]},"268":{"position":[[846,7]]},"301":{"position":[[69,7]]},"335":{"position":[[651,7]]},"353":{"position":[[981,7]]},"408":{"position":[[846,7]]},"425":{"position":[[191,7]]},"481":{"position":[[1500,7]]},"522":{"position":[[69,7]]},"552":{"position":[[651,7]]},"569":{"position":[[981,7]]},"605":{"position":[[649,7]]},"645":{"position":[[846,7]]},"667":{"position":[[191,7]]},"713":{"position":[[649,7]]}},"keywords":{}}],["won't",{"_index":1975,"title":{},"content":{"143":{"position":[[786,5]]},"328":{"position":[[761,5]]},"537":{"position":[[761,5]]}},"keywords":{}}],["word",{"_index":177,"title":{},"content":{"5":{"position":[[175,6]]},"40":{"position":[[98,6]]},"52":{"position":[[1983,6]]},"119":{"position":[[1036,4]]},"204":{"position":[[1220,6]]},"300":{"position":[[1036,4]]},"424":{"position":[[1170,6]]},"521":{"position":[[1036,4]]},"616":{"position":[[670,4],[944,6],[964,5],[994,5]]},"666":{"position":[[1170,6]]},"724":{"position":[[670,4],[944,6],[964,5],[994,5]]}},"keywords":{}}],["work",{"_index":116,"title":{"128":{"position":[[20,6]]},"279":{"position":[[20,6]]},"516":{"position":[[20,6]]}},"content":{"2":{"position":[[534,7]]},"3":{"position":[[286,5]]},"15":{"position":[[201,4]]},"31":{"position":[[470,5]]},"43":{"position":[[783,5]]},"53":{"position":[[1394,6]]},"98":{"position":[[563,7]]},"117":{"position":[[1333,5]]},"124":{"position":[[123,6]]},"126":{"position":[[1488,5]]},"163":{"position":[[1545,7]]},"168":{"position":[[291,6]]},"173":{"position":[[9,7]]},"267":{"position":[[58,4]]},"277":{"position":[[1656,5]]},"290":{"position":[[563,7]]},"298":{"position":[[1333,5]]},"309":{"position":[[123,6]]},"348":{"position":[[291,6]]},"352":{"position":[[1567,7]]},"359":{"position":[[9,7]]},"407":{"position":[[58,4]]},"502":{"position":[[563,7]]},"514":{"position":[[1488,5]]},"519":{"position":[[1333,5]]},"526":{"position":[[123,6]]},"564":{"position":[[291,6]]},"568":{"position":[[1567,7]]},"575":{"position":[[9,7]]},"644":{"position":[[58,4]]}},"keywords":{}}],["workaround",{"_index":3664,"title":{},"content":{"598":{"position":[[1903,10]]},"706":{"position":[[1903,10]]}},"keywords":{}}],["works.th",{"_index":220,"title":{},"content":{"7":{"position":[[42,9]]}},"keywords":{}}],["workspac",{"_index":1761,"title":{},"content":{"117":{"position":[[702,10],[729,9]]},"298":{"position":[[702,10],[729,9]]},"519":{"position":[[702,10],[729,9]]}},"keywords":{}}],["world",{"_index":1105,"title":{"596":{"position":[[6,6]]},"704":{"position":[[6,6]]}},"content":{"43":{"position":[[21,5]]},"111":{"position":[[135,5]]},"166":{"position":[[79,5]]},"196":{"position":[[1394,6]]},"306":{"position":[[135,5]]},"355":{"position":[[79,5]]},"416":{"position":[[2330,5]]},"432":{"position":[[1336,6]]},"511":{"position":[[135,5]]},"571":{"position":[[79,5]]},"653":{"position":[[2330,5]]},"679":{"position":[[1336,6]]}},"keywords":{}}],["world!".to_str",{"_index":3793,"title":{},"content":{"610":{"position":[[324,25]]},"718":{"position":[[324,25]]}},"keywords":{}}],["world"",{"_index":2046,"title":{},"content":{"162":{"position":[[232,11]]},"351":{"position":[[232,11]]},"567":{"position":[[232,11]]},"596":{"position":[[38,11]]},"704":{"position":[[38,11]]}},"keywords":{}}],["worth",{"_index":1547,"title":{},"content":{"85":{"position":[[699,5]]},"197":{"position":[[1494,5]]},"247":{"position":[[1561,5]]},"254":{"position":[[699,5]]},"433":{"position":[[1493,5]]},"446":{"position":[[1561,5]]},"485":{"position":[[699,5]]},"673":{"position":[[1561,5]]},"680":{"position":[[1493,5]]}},"keywords":{}}],["wouldn't",{"_index":1314,"title":{},"content":{"54":{"position":[[0,8]]}},"keywords":{}}],["wow",{"_index":366,"title":{},"content":{"11":{"position":[[83,4]]},"17":{"position":[[4073,4]]},"53":{"position":[[1366,4]]}},"keywords":{}}],["wrap",{"_index":1346,"title":{"68":{"position":[[0,8]]},"243":{"position":[[0,8]]},"468":{"position":[[0,8]]}},"content":{"103":{"position":[[438,7]]},"145":{"position":[[56,5]]},"162":{"position":[[169,4],[502,8],[556,7]]},"188":{"position":[[717,7]]},"195":{"position":[[770,4]]},"267":{"position":[[3226,4]]},"295":{"position":[[438,7]]},"333":{"position":[[56,5]]},"351":{"position":[[169,4],[539,8],[593,7]]},"365":{"position":[[1074,7]]},"407":{"position":[[3226,4]]},"431":{"position":[[770,4]]},"507":{"position":[[438,7]]},"550":{"position":[[56,5]]},"567":{"position":[[169,4],[539,8],[593,7]]},"581":{"position":[[1074,7]]},"601":{"position":[[2004,7]]},"644":{"position":[[3226,4]]},"678":{"position":[[770,4]]},"709":{"position":[[2004,7]]}},"keywords":{}}],["wrappednativetoken",{"_index":2292,"title":{},"content":{"188":{"position":[[743,18]]},"365":{"position":[[1100,18]]},"581":{"position":[[1100,18]]}},"keywords":{}}],["wrapper",{"_index":2293,"title":{},"content":{"188":{"position":[[784,7]]},"365":{"position":[[1141,7]]},"581":{"position":[[1141,7]]}},"keywords":{}}],["write",{"_index":110,"title":{"14":{"position":[[7,6]]}},"content":{"2":{"position":[[348,5]]},"13":{"position":[[73,5]]},"15":{"position":[[212,8],[224,5],[396,7],[497,7]]},"17":{"position":[[26,5]]},"22":{"position":[[245,7]]},"23":{"position":[[150,5]]},"24":{"position":[[147,5]]},"34":{"position":[[45,5]]},"38":{"position":[[233,7],[1032,7]]},"39":{"position":[[3285,5]]},"42":{"position":[[68,5]]},"51":{"position":[[16,5],[322,5]]},"55":{"position":[[45,5]]},"70":{"position":[[5,7]]},"74":{"position":[[140,6]]},"83":{"position":[[508,7]]},"97":{"position":[[27,7]]},"99":{"position":[[733,8]]},"115":{"position":[[3280,5]]},"126":{"position":[[1126,5]]},"138":{"position":[[38,5]]},"148":{"position":[[448,5]]},"163":{"position":[[601,5]]},"164":{"position":[[445,6]]},"168":{"position":[[1542,5]]},"182":{"position":[[16,7]]},"193":{"position":[[17,5]]},"194":{"position":[[10,5]]},"196":{"position":[[1236,5]]},"201":{"position":[[17,5]]},"209":{"position":[[6,5]]},"234":{"position":[[5,7]]},"238":{"position":[[140,6]]},"252":{"position":[[508,7]]},"258":{"position":[[3206,5]]},"277":{"position":[[1294,5]]},"289":{"position":[[27,7]]},"291":{"position":[[733,8]]},"318":{"position":[[38,5]]},"336":{"position":[[448,5]]},"348":{"position":[[1542,5]]},"352":{"position":[[623,5]]},"353":{"position":[[480,6]]},"373":{"position":[[16,7]]},"388":{"position":[[6,5]]},"421":{"position":[[17,5]]},"429":{"position":[[17,5]]},"430":{"position":[[10,5]]},"432":{"position":[[1178,5]]},"470":{"position":[[5,7]]},"474":{"position":[[140,6]]},"477":{"position":[[594,5]]},"481":{"position":[[3206,5]]},"483":{"position":[[508,7]]},"501":{"position":[[27,7]]},"503":{"position":[[733,8]]},"514":{"position":[[1126,5]]},"544":{"position":[[38,5]]},"553":{"position":[[448,5]]},"564":{"position":[[1542,5]]},"568":{"position":[[623,5]]},"569":{"position":[[480,6]]},"589":{"position":[[16,7]]},"618":{"position":[[60,7]]},"658":{"position":[[6,5]]},"663":{"position":[[17,5]]},"676":{"position":[[17,5]]},"677":{"position":[[10,5]]},"679":{"position":[[1178,5]]},"699":{"position":[[594,5]]},"726":{"position":[[60,7]]}},"keywords":{}}],["write(key",{"_index":1518,"title":{},"content":{"83":{"position":[[625,10]]},"252":{"position":[[625,10]]},"483":{"position":[[625,10]]}},"keywords":{}}],["write_to_file("../data/journal"",{"_index":308,"title":{},"content":{"9":{"position":[[1272,42]]}},"keywords":{}}],["write_to_file("../data/method"",{"_index":316,"title":{},"content":{"9":{"position":[[1597,41]]}},"keywords":{}}],["write_to_file("../data/seal"",{"_index":312,"title":{},"content":{"9":{"position":[[1437,39]]}},"keywords":{}}],["writes/read",{"_index":1989,"title":{},"content":{"146":{"position":[[218,12]]},"178":{"position":[[232,12]]},"334":{"position":[[218,12]]},"369":{"position":[[232,12]]},"551":{"position":[[218,12]]},"585":{"position":[[232,12]]}},"keywords":{}}],["written",{"_index":321,"title":{},"content":{"10":{"position":[[163,7]]},"20":{"position":[[577,7],[831,7]]},"22":{"position":[[437,7]]},"31":{"position":[[50,7]]},"39":{"position":[[1583,7]]},"40":{"position":[[312,7]]},"51":{"position":[[1773,7]]},"91":{"position":[[628,7]]},"98":{"position":[[80,7]]},"162":{"position":[[1998,7]]},"163":{"position":[[1159,7]]},"205":{"position":[[2300,8]]},"283":{"position":[[628,7]]},"290":{"position":[[80,7]]},"351":{"position":[[2020,7]]},"352":{"position":[[1181,7]]},"425":{"position":[[2250,8]]},"440":{"position":[[3508,7]]},"495":{"position":[[628,7]]},"502":{"position":[[80,7]]},"567":{"position":[[2020,7]]},"568":{"position":[[1181,7]]},"667":{"position":[[2250,8]]},"687":{"position":[[3508,7]]}},"keywords":{}}],["wrong",{"_index":297,"title":{},"content":{"9":{"position":[[1048,6]]},"92":{"position":[[687,5]]},"284":{"position":[[687,5]]},"496":{"position":[[687,5]]}},"keywords":{}}],["wrote",{"_index":455,"title":{},"content":{"17":{"position":[[179,5]]}},"keywords":{}}],["x",{"_index":3750,"title":{},"content":{"605":{"position":[[69,2]]},"606":{"position":[[74,2]]},"613":{"position":[[197,1],[218,1],[233,2],[236,1],[245,1],[249,2],[414,2]]},"713":{"position":[[69,2]]},"714":{"position":[[74,2]]},"721":{"position":[[197,1],[218,1],[233,2],[236,1],[245,1],[249,2],[414,2]]}},"keywords":{}}],["xxxxx"",{"_index":3156,"title":{},"content":{"395":{"position":[[2299,12]]},"632":{"position":[[2299,12]]}},"keywords":{}}],["y",{"_index":3752,"title":{},"content":{"605":{"position":[[151,2],[197,1]]},"613":{"position":[[165,2],[171,1],[201,1],[240,2],[269,1]]},"713":{"position":[[151,2],[197,1]]},"721":{"position":[[165,2],[171,1],[201,1],[240,2],[269,1]]}},"keywords":{}}],["ye",{"_index":212,"title":{},"content":{"6":{"position":[[260,4]]}},"keywords":{}}],["year",{"_index":423,"title":{},"content":{"15":{"position":[[538,5]]},"20":{"position":[[12,4]]}},"keywords":{}}],["yes_vot",{"_index":3255,"title":{},"content":{"416":{"position":[[3941,9],[4101,9],[4338,9]]},"419":{"position":[[5520,9],[5680,9],[5918,9]]},"653":{"position":[[3941,9],[4101,9],[4338,9]]},"656":{"position":[[5520,9],[5680,9],[5918,9]]}},"keywords":{}}],["yoda",{"_index":419,"title":{},"content":{"15":{"position":[[451,4]]}},"keywords":{}}],["you'll",{"_index":2071,"title":{},"content":{"162":{"position":[[1589,6]]},"163":{"position":[[1489,6]]},"268":{"position":[[42,6]]},"351":{"position":[[1611,6]]},"352":{"position":[[1511,6]]},"408":{"position":[[42,6]]},"567":{"position":[[1611,6]]},"568":{"position":[[1511,6]]},"645":{"position":[[42,6]]}},"keywords":{}}],["you'r",{"_index":2073,"title":{},"content":{"162":{"position":[[1898,6]]},"351":{"position":[[1920,6]]},"567":{"position":[[1920,6]]}},"keywords":{}}],["you'v",{"_index":1574,"title":{},"content":{"91":{"position":[[88,6]]},"168":{"position":[[1607,6]]},"268":{"position":[[5,6]]},"283":{"position":[[88,6]]},"348":{"position":[[1607,6]]},"408":{"position":[[5,6]]},"495":{"position":[[88,6]]},"564":{"position":[[1607,6]]},"594":{"position":[[120,6]]},"618":{"position":[[17,6]]},"645":{"position":[[5,6]]},"702":{"position":[[120,6]]},"726":{"position":[[17,6]]}},"keywords":{}}],["your/path/secret_key.pem",{"_index":3559,"title":{},"content":{"477":{"position":[[481,24]]},"699":{"position":[[481,24]]}},"keywords":{}}],["yourself",{"_index":1300,"title":{},"content":{"53":{"position":[[41,9]]},"54":{"position":[[411,9]]},"102":{"position":[[637,8]]},"117":{"position":[[268,9]]},"294":{"position":[[637,8]]},"298":{"position":[[268,9]]},"397":{"position":[[238,9]]},"506":{"position":[[637,8]]},"519":{"position":[[268,9]]},"634":{"position":[[238,9]]}},"keywords":{}}],["z",{"_index":3830,"title":{},"content":{"613":{"position":[[161,1],[225,1],[229,1],[289,1],[308,1]]},"721":{"position":[[161,1],[225,1],[229,1],[289,1],[308,1]]}},"keywords":{}}],["zeppelin",{"_index":2491,"title":{},"content":{"205":{"position":[[2319,8]]},"425":{"position":[[2269,8]]},"667":{"position":[[2269,8]]}},"keywords":{}}],["zero",{"_index":164,"title":{"4":{"position":[[0,4]]},"5":{"position":[[0,4]]},"6":{"position":[[5,5]]}},"content":{"5":{"position":[[19,4]]},"6":{"position":[[34,5],[66,4]]},"8":{"position":[[53,5]]},"12":{"position":[[147,4],[214,4],[271,4]]},"13":{"position":[[14,4]]},"92":{"position":[[982,5]]},"206":{"position":[[3442,5]]},"284":{"position":[[982,5]]},"426":{"position":[[3417,5]]},"496":{"position":[[982,5]]},"668":{"position":[[3442,5]]}},"keywords":{}}],["zero'",{"_index":224,"title":{},"content":{"7":{"position":[[117,6]]}},"keywords":{}}],["zeros.l10",{"_index":2250,"title":{},"content":{"185":{"position":[[2569,9]]},"376":{"position":[[2553,9]]},"592":{"position":[[2553,9]]}},"keywords":{}}],["zieliński",{"_index":566,"title":{},"content":{"20":{"position":[[28,9]]},"39":{"position":[[1601,10]]}},"keywords":{}}],["zk",{"_index":166,"title":{},"content":{"5":{"position":[[34,4],[182,2]]},"10":{"position":[[682,2],[844,2]]},"11":{"position":[[99,2]]},"12":{"position":[[54,2],[351,2]]},"32":{"position":[[519,3]]}},"keywords":{}}],["zone",{"_index":1229,"title":{},"content":{"52":{"position":[[299,4]]}},"keywords":{}}]],"pipeline":["stemmer"]} \ No newline at end of file diff --git a/docs/lunr-index.json b/docs/lunr-index.json new file mode 100644 index 000000000..90405c599 --- /dev/null +++ b/docs/lunr-index.json @@ -0,0 +1 @@ +{"version":"2.3.9","fields":["title","content","keywords"],"fieldVectors":[["title/0",[0,674.112,1,674.112]],["content/0",[]],["keywords/0",[]],["title/1",[1,555.478,2,812.614,3,98.292]],["content/1",[1,5.74,3,1.741,4,6.584,5,4.507,6,9.133,7,4.22,8,4.974,9,10.211,10,9.368,11,6.013,12,4.027,13,10.211,14,8.397,15,6.252,16,5.973,17,6.527,18,1.799,19,8.244,20,4.28,21,10.211,22,2.983,23,10.211,24,6.998,25,7.164,26,10.211,27,7.955,28,12.816,29,4.987,30,13.624,31,7.78,32,10.211,33,10.211,34,7.554,35,10.211,36,3.976,37,8.397,38,9.368,39,10.211,40,10.211,41,10.211,42,8.397,43,5.35,44,14.85,45,2.397,46,5.293,47,10.211,48,12.592,49,9.368,50,2.934,51,10.211,52,7.554,53,12.212,54,5.47,55,5.976,56,2.716,57,4.614,58,1.17,59,10.211,60,3.677,61,5.668,62,4.729,63,6.711,64,10.211,65,5.815,66,9.368,67,8.812,68,9.368,69,8.397,70,10.211,71,10.211,72,3.677,73,10.211,74,8.397,75,5.47,76,3.319,77,8.812,78,6.998,79,2.248,80,4.08,81,8.066,82,4.578,83,7.347,84,10.211,85,5.976,86,10.211,87,5.35,88,7.79,89,5.083,90,6.355,91,7.164]],["keywords/1",[]],["title/2",[36,466.935,87,628.279]],["content/2",[3,2.03,4,8.77,5,8.005,6,6.465,17,5.073,18,1.398,36,7.063,45,4.257,48,9.787,58,2.337,61,7.551,63,8.939,67,11.739,87,9.503,92,9.64,93,13.602,94,9.323,95,3.634,96,12.479,97,9.123,98,6.197,99,11.186,100,9.543,101,6.409,102,12.479,103,9.323,104,7.851,105,13.602,106,2.09,107,9.452,108,18.138,109,12.431,110,5.073,111,13.602,112,13.602,113,8.939,114,13.602,115,3.556,116,6.771,117,7.287,118,6.706,119,6.644]],["keywords/2",[]],["title/3",[120,1398.897]],["content/3",[3,1.298,8,3.71,11,5.284,20,7.393,36,5.082,56,4.692,68,11.973,72,4.7,85,7.638,94,8.945,107,6.045,116,6.496,120,11.973,121,11.263,122,13.051,123,10.309,124,9.156,125,5.114,126,8.263,127,13.051,128,9.39,129,11.263,130,13.051,131,6.991,132,7.991,133,7.991,134,9.39,135,11.263,136,11.263,137,11.973,138,13.051,139,8.945,140,13.051,141,8.945,142,17.641,143,13.133,144,10.732,145,5.548,146,7.072,147,11.973,148,9.655,149,5.839,150,5.994,151,13.051,152,4.62,153,13.051,154,13.051,155,9.39,156,12.376,157,5.705,158,11.263,159,11.973,160,7.157,161,9.39,162,11.263,163,8.753]],["keywords/3",[]],["title/4",[8,280.871,97,662.709,164,625.674]],["content/4",[]],["keywords/4",[]],["title/5",[97,804.245,164,759.301]],["content/5",[17,5.692,18,1.569,57,6.896,58,1.748,97,10.235,164,9.663,165,15.261,166,15.447,167,14,168,15.261,169,6.098,170,11.643,171,9.498,172,15.261,173,8.579,174,5.832,175,9.062,176,9.83,177,10.235,178,7.91,179,5.761,180,7.996,181,9.199,182,5.98,183,14.919,184,15.261,185,8.932,186,13.17,187,9.929,188,6.788,189,15.261,190,10.459,191,7.91,192,11.29,193,8.369,194,15.261]],["keywords/5",[]],["title/6",[164,759.301,195,947.258]],["content/6",[8,4.459,12,6.186,17,5.85,18,1.612,27,8.403,80,6.268,97,10.52,106,2.41,164,12.601,171,9.763,190,10.751,195,12.391,196,15.686,197,4.947,198,8.602,199,12.9,200,12.9,201,13.537,202,11.967,203,12.391,204,5.288,205,12.9,206,14.722,207,10.751,208,7.591,209,6.438,210,15.686,211,5.714,212,15.686,213,10.751,214,10.751,215,9.455,216,10.52,217,12.9]],["keywords/6",[]],["title/7",[95,407.35]],["content/7",[2,14.184,16,6.937,29,8.424,76,5.606,91,12.1,95,6.096,101,8.126,128,12.41,175,10.241,195,13.624,218,5.36,219,14.184,220,17.247,221,10.396,222,17.247,223,8.67,224,17.247,225,17.247,226,17.247,227,14.184,228,7.079]],["keywords/7",[]],["title/8",[229,1204.507]],["content/8",[100,8.702,106,3.873,115,3.243,152,6.892,164,7.854,183,14.851,190,11.679,191,6.43,195,9.798,206,9.176,207,8.501,213,11.679,214,8.501,229,13.461,230,15.633,231,8.925,232,11.393,233,6.722,234,10.641,235,9.176,236,12.404,237,2.865,238,2.842,239,5.392,240,8.928,241,4.467,242,8.483,243,9.705,244,15.633,245,6.499,246,11.379,247,12.404,248,12.404,249,12.404,250,15.633,251,8.152,252,9.798,253,9.463,254,12.404,255,12.404,256,12.404,257,12.404]],["keywords/8",[]],["title/9",[227,1253.981]],["content/9",[0,7.643,16,3.645,22,2.647,45,3.191,80,3.621,106,3.871,179,3.42,188,4.03,190,6.21,191,4.697,197,2.858,206,6.703,207,6.21,211,4.953,213,6.21,215,5.462,227,13.419,229,10.739,230,8.313,232,5.303,234,9.207,238,2.076,239,3.939,240,4.747,241,3.263,243,9.293,246,8.313,258,3.023,259,4.854,260,2.349,261,9.061,262,7.452,263,7.452,264,9.061,265,9.061,266,4.601,267,9.061,268,9.061,269,9.061,270,5.548,271,5.16,272,9.061,273,3.551,274,9.061,275,9.061,276,9.061,277,9.061,278,11.18,279,9.061,280,9.061,281,15.648,282,9.061,283,9.061,284,9.061,285,5.094,286,14.969,287,8.462,288,9.301,289,9.061,290,9.061,291,9.061,292,8.313,293,4.854,294,9.061,295,9.061,296,9.061,297,7.452,298,9.061,299,9.061,300,9.061,301,5.737,302,9.061,303,9.55,304,5.843,305,5.443,306,16.317,307,9.061,308,9.061,309,9.061,310,12.473,311,9.061,312,9.061,313,9.061,314,8.313,315,9.061,316,9.061,317,9.061]],["keywords/9",[]],["title/10",[207,1045.084]],["content/10",[17,3.407,18,1.871,20,3.828,62,4.231,72,3.289,106,3.849,115,2.388,119,4.461,149,2.669,166,10.805,188,9.102,197,2.881,206,12.13,207,12.478,213,6.261,216,6.126,217,14.972,229,7.216,233,4.95,237,3.787,238,3.756,266,8.325,281,7.883,286,15.042,304,4.898,305,3.047,310,17.886,314,16.702,318,4.128,319,3.603,320,9.135,321,5.009,322,6.126,323,3.289,324,4.267,325,3.557,326,6.758,327,3.884,328,5.272,329,9.135,330,5.272,331,9.597,332,10.119,333,9.135,334,18.205,335,9.135,336,9.135,337,5.424,338,3.718,339,2.318,340,8.38,341,2.758,342,4.839,343,5.889,344,9.135,345,2.839,346,13.678,347,9.135,348,5.593,349,9.135,350,5.175,351,9.135,352,9.135,353,9.135,354,9.135,355,9.135,356,6.573,357,6.003,358,9.135,359,9.135,360,9.135,361,6.003,362,9.135]],["keywords/10",[]],["title/11",[188,533.361,363,537.576]],["content/11",[8,4.653,11,6.628,92,6.96,106,2.515,107,7.582,115,4.28,166,12.931,188,7.281,206,12.11,207,14.011,211,5.963,217,13.462,241,5.895,266,10.38,357,10.758,364,4.411,365,10.979,366,14.127,367,16.37,368,16.37,369,12.11,370,8.149,371,10.979,372,16.37,373,8.229,374,12.11,375,12.931,376,13.462]],["keywords/11",[]],["title/12",[22,445.502]],["content/12",[1,8.521,6,7.205,8,4.309,24,10.389,25,10.634,36,5.902,87,7.942,95,4.049,100,10.634,123,11.974,137,13.906,144,12.466,159,13.906,162,13.082,164,13.62,166,15.38,181,9.137,195,16.992,216,10.166,217,12.466,258,5.056,266,7.696,377,13.082,378,9.434,379,15.158,380,9.001,381,11.564,382,4.978,383,15.158,384,15.158,385,8.214,386,15.158,387,15.158,388,15.158,389,15.158,390,15.158]],["keywords/12",[]],["title/13",[391,1045.084]],["content/13",[8,5.491,90,12.023,97,12.956,110,7.205,164,12.232,391,13.24,392,13.552,393,15.886,394,15.886]],["keywords/13",[]],["title/14",[3,83.583,110,313.386,395,663.743,396,347.262]],["content/14",[]],["keywords/14",[]],["title/15",[395,1204.507]],["content/15",[3,2.109,6,6.062,17,7.366,18,2.03,45,2.994,58,2.262,72,6.255,80,5.097,89,6.349,91,12.185,110,7.908,116,6.349,131,6.833,179,4.815,190,8.742,191,6.612,382,5.704,395,15.601,396,5.271,397,6.01,398,10.489,399,12.755,400,6.476,401,8.554,402,12.755,403,12.755,404,9.731,405,9.436,406,8.405,407,14.284,408,10.489,409,6.062,410,12.755,411,11.702,412,7.081,413,6.543,414,9.436,415,11.702,416,7.178,417,7.81,418,12.755,419,12.755,420,12.755,421,11.008,422,12.755,423,11.702,424,9.731,425,12.755,426,6.01]],["keywords/15",[]],["title/16",[427,1100.131,428,734.248]],["content/16",[3,1.834,11,5.644,31,7.303,45,4.848,58,1.596,76,4.531,91,9.779,95,3.724,115,4.82,123,11.011,144,11.463,150,6.402,157,4.508,175,8.277,191,7.225,214,9.553,270,8.535,323,5.019,382,4.578,395,14.562,404,10.634,405,10.312,406,6.745,414,13.638,427,12.788,428,11.288,429,13.265,430,6.625,431,13.939,432,13.939,433,13.939,434,5.842,435,13.939,436,7.002,437,13.939,438,6.299,439,13.939,440,12.788,441,10.634,442,9.16,443,13.939,444,9.779,445,9.553,446,13.939,447,11.463]],["keywords/16",[]],["title/17",[396,495.593,398,986.166]],["content/17",[3,0.79,17,1.734,18,0.816,25,5.571,45,1.864,56,2.112,57,2.101,58,1.581,100,3.261,106,3.886,107,3.678,110,1.734,115,1.215,145,3.376,152,2.811,157,1.503,179,1.755,188,2.068,191,2.41,197,1.466,237,4.95,238,4.63,260,5.238,304,4.402,338,3.754,339,2.015,340,7.285,341,2.397,345,5.264,350,5.507,356,3.345,366,4.012,395,3.672,396,6.641,398,3.823,407,3.823,409,2.209,415,4.265,428,2.846,436,4.669,438,3.588,448,4.648,449,1.417,450,3.261,451,2.893,452,4.648,453,2.893,454,3.186,455,4.648,456,4.073,457,5.046,458,5.517,459,1.991,460,3.311,461,2.846,462,7.941,463,7.285,464,6.272,465,10.11,466,3.953,467,4.265,468,4.648,469,4.265,470,4.889,471,4.648,472,3.186,473,5.028,474,3.823,475,6.853,476,3.376,477,3.439,478,4.648,479,3.118,480,3.617,481,3.261,482,3.345,483,4.648,484,4.648,485,3.672,486,3.261,487,3.186,488,2.49,489,4.648,490,4.648,491,7.083,492,7.941,493,4.206,494,11.279,495,7.941,496,4.648,497,4.648,498,4.648,499,2.292,500,4.648,501,4.648,502,4.648,503,3.478,504,4.648,505,4.648,506,3.823,507,3.546,508,1.292,509,2.314,510,1.403,511,7.357,512,1.933,513,3.774,514,3.953,515,4.648,516,6.702,517,4.648,518,2.721,519,4.942,520,2.118,521,2.893,522,3.261,523,3.261,524,4.648,525,4.648,526,3.055,527,3.823,528,2.613,529,3.823,530,2.721,531,15.043,532,7.941,533,12.294,534,7.941,535,6,536,7.941,537,7.941,538,7.941,539,2.802,540,4.648,541,4.648,542,4.648,543,2.802,544,6.825,545,4.648,546,2.802,547,4.648,548,2.76,549,2.943]],["keywords/17",[]],["title/18",[22,445.502]],["content/18",[3,1.539,5,6.828,7,8.153,12,6.101,17,5.77,18,1.59,25,10.853,45,5.097,101,7.289,102,14.193,119,7.556,144,12.722,191,8.019,213,10.603,319,6.101,375,12.22,392,10.853,397,9.294,398,16.223,416,6.394,508,4.3,509,7.701,550,15.47,551,12.722,552,7.353,553,15.47,554,12.22,555,15.47,556,15.47,557,15.47,558,15.47,559,15.47,560,15.47]],["keywords/18",[]],["title/19",[3,98.292,143,649.387,561,988.136]],["content/19",[]],["keywords/19",[]],["title/20",[562,1034.893,563,986.166]],["content/20",[1,5.819,3,1.03,5,4.569,6,7.129,7,4.278,8,2.942,11,4.192,17,5.594,18,1.542,20,4.339,30,9.497,31,5.424,37,8.513,45,4.818,49,9.497,50,2.045,72,6.351,89,5.153,109,7.095,162,8.934,169,7.727,175,10.473,179,3.908,187,5.256,208,5.01,211,3.771,239,4.5,241,3.728,245,5.424,321,8.225,382,3.4,423,9.497,562,8.934,564,10.352,565,9.497,566,9.497,567,8.513,568,10.352,569,10.28,570,10.352,571,10.352,572,8.513,573,10.352,574,10.352,575,10.352,576,10.352,577,8.177,578,7.095,579,10.352,580,3.956,581,7.095,582,13.76,583,10.352,584,8.177,585,6.943,586,8.934,587,13.932,588,10.352,589,7.449,590,10.352,591,10.352,592,10.352,593,10.352,594,10.352,595,10.352,596,7.694,597,10.059,598,8.513,599,9.497,600,6.338,601,10.352,602,10.352,603,8.177,604,10.352,605,9.497,606,9.497,607,10.352,608,7.658,609,10.352,610,8.513,611,8.513,612,6.059,613,8.934,614,6.674,615,6.943,616,10.352,617,10.352,618,8.513,619,10.352]],["keywords/20",[]],["title/21",[3,119.285,8,340.857]],["content/21",[3,1.954,6,9.335,7,6.35,8,6.153,18,1.579,37,12.636,38,14.096,55,8.993,80,6.139,103,10.531,169,6.139,241,5.533,250,14.096,342,8.139,605,14.096,620,10.098,621,8.637,622,14.096,623,15.365,624,11.722,625,10.531,626,9.124,627,9.262,628,15.365,629,14.096,630,12.137,631,15.365,632,11.056,633,15.365,634,14.096,635,11.722,636,15.365,637,10.098,638,12.636,639,9.262]],["keywords/21",[]],["title/22",[3,119.285,416,495.593]],["content/22",[0,4.786,3,1.747,5,5.724,6,8.349,15,7.941,16,3.424,17,7.052,18,2.129,19,4.726,24,5.835,25,5.972,27,4.56,28,7.347,31,4.46,37,7.001,45,1.998,50,1.682,54,4.56,57,3.847,58,1.799,60,3.066,65,4.848,66,7.81,81,6.725,82,3.816,92,3.619,100,5.972,104,4.914,106,3.428,110,3.175,119,6.334,155,6.126,161,6.126,169,3.402,175,7.701,178,6.723,179,3.214,193,4.668,237,4.057,238,3.599,252,6.725,260,4.901,321,4.668,337,5.055,338,3.526,339,2.161,341,2.57,342,6.87,345,4.031,350,2.42,370,4.238,385,4.613,416,5.36,438,3.847,450,5.972,459,3.646,466,7.82,467,7.81,475,7.347,476,3.619,480,5.908,481,5.972,482,6.126,486,5.972,510,2.57,552,4.046,569,5.835,580,3.253,599,7.81,615,5.71,621,4.786,624,6.495,626,5.055,640,7.001,641,7.81,642,6.126,643,7.81,644,8.513,645,7.81,646,7.347,647,7.81,648,7.81,649,4.644,650,9.329,651,6.725,652,3.593,653,8.513,654,2.633,655,4.613,656,4.848,657,6.298,658,8.513,659,8.513,660,2.81,661,3.273,662,5.835,663,3.757,664,6.495,665,8.513,666,6.298,667,5.835,668,8.513,669,2.409,670,6.298,671,8.513,672,7.001]],["keywords/22",[]],["title/23",[22,445.502]],["content/23",[10,15.584,20,7.119,45,3.987,46,8.805,65,9.674,79,3.74,80,6.787,83,12.223,92,7.222,110,6.336,201,14.66,218,5.279,258,5.666,585,11.393,627,10.239,673,16.987,674,16.987,675,19.19,676,16.987,677,11.393,678,8.539,679,13.97,680,16.987,681,16.987]],["keywords/23",[]],["title/24",[391,1045.084]],["content/24",[3,2.182,89,10.919,90,11.435,91,12.889,110,6.852,117,9.842,319,7.246,382,6.034,391,12.592,393,15.109,394,15.109,447,15.109,682,11.075]],["keywords/24",[]],["title/25",[3,119.285,416,495.593]],["content/25",[]],["keywords/25",[]],["title/26",[22,350.355,125,469.918]],["content/26",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/26",[]],["title/27",[3,119.285,416,495.593]],["content/27",[]],["keywords/27",[]],["title/28",[22,350.355,125,469.918]],["content/28",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/28",[]],["title/29",[587,947.258,685,947.258]],["content/29",[]],["keywords/29",[]],["title/30",[7,630.183]],["content/30",[7,4.735,18,1.178,45,3.785,56,3.048,57,5.177,72,5.807,95,3.061,106,3.912,107,5.307,150,5.263,152,5.709,179,4.325,208,5.545,214,7.853,232,6.706,234,8.188,287,7.131,440,10.511,535,6.613,587,12.738,686,12.738,687,4.077,688,6.803,689,11.458,690,16.126,691,11.458,692,14.74,693,9.874,694,8.741,695,8.945,696,11.458,697,11.815,698,16.126,699,5.818,700,16.126,701,5.495,702,11.929,703,7.853,704,11.458,705,11.458,706,11.458,707,18.579,708,5.818,709,11.458,710,11.458,711,11.458]],["keywords/30",[]],["title/31",[587,1204.507]],["content/31",[0,3.092,5,4.038,16,3.68,18,1.789,20,2.305,29,4.469,43,2.881,45,3.214,50,2.706,58,1.569,60,1.98,77,4.746,87,2.881,92,2.338,94,3.769,95,1.469,106,3.844,115,2.392,116,2.738,136,4.746,145,3.89,149,1.607,175,3.266,179,2.076,188,6.091,208,2.661,211,3.333,213,3.769,218,1.709,233,4.959,235,4.068,237,2.113,238,3.138,240,2.881,241,1.98,260,1.426,273,3.586,304,4.207,321,3.016,327,4.995,330,3.174,331,3.219,337,3.266,350,2.601,370,2.738,409,4.349,413,2.821,454,10.422,457,2.257,458,1.502,562,4.746,587,12.012,649,3.276,654,2.83,661,2.115,683,2.547,685,4.344,686,7.228,687,2.567,694,4.196,695,2.305,707,5.045,712,5.045,713,5.045,714,3.957,715,2.321,716,6.584,717,2.661,718,2.851,719,3.546,720,3.858,721,5.5,722,5.5,723,3.858,724,5.5,725,5.5,726,5.5,727,9.15,728,9.281,729,9.15,730,4.523,731,5.5,732,8.132,733,5.5,734,5.5,735,5.5,736,5.5,737,5.5,738,5.5,739,1.797,740,3.957,741,5.5,742,5.5,743,5.5,744,5.5,745,5.5,746,7.88,747,5.045,748,5.5,749,5.5,750,8.964,751,5.5,752,13.123,753,5.5,754,5.5,755,5.5,756,5.5,757,5.045,758,8.243,759,5.5,760,4.876,761,13.695,762,3.756,763,2.712,764,9.15,765,9.15,766,9.15,767,9.608,768,9.15,769,9.15,770,9.15,771,5.5,772,6.013,773,9.15,774,9.15,775,7.525,776,2.115,777,5.5,778,2.738,779,5.5,780,9.15,781,5.5,782,5.5,783,5.5,784,5.5,785,5.5,786,5.5,787,5.5,788,5.5,789,5.5,790,5.5,791,5.5,792,5.5,793,8.692,794,3.769,795,5.5,796,4.823,797,5.5,798,5.5,799,3.423,800,5.5,801,4.523,802,5.5,803,3.016,804,5.5,805,5.5,806,5.5,807,5.5,808,9.15,809,7.525,810,5.5,811,5.5,812,5.045,813,5.5]],["keywords/31",[]],["title/32",[685,1204.507]],["content/32",[0,4.974,16,3.559,57,3.998,58,1.842,60,3.186,62,4.098,80,3.535,106,3.892,107,7.45,115,2.313,118,4.362,143,5.814,166,6.989,188,8.993,190,9.152,197,5.651,206,11.899,207,6.064,211,3.223,213,6.064,227,13.227,229,6.989,237,2.043,238,3.685,239,5.804,241,3.186,242,4.404,244,8.117,260,2.294,273,3.467,281,7.635,304,5.759,325,3.445,327,5.677,350,2.515,454,12.279,649,3.168,669,2.504,685,6.989,695,5.597,713,8.117,718,4.586,732,5.254,763,4.362,812,8.117,814,4.852,815,8.848,816,8.848,817,8.848,818,5.039,819,5.934,820,5.704,821,8.848,822,8.848,823,8.848,824,8.848,825,8.848,826,8.848,827,8.848,828,13.354,829,13.354,830,8.848,831,16.084,832,13.354,833,11.524,834,13.354,835,8.848,836,8.848,837,13.354,838,5.719,839,8.848,840,8.848,841,8.848,842,8.848,843,8.848,844,8.848,845,8.848,846,8.848,847,8.848,848,8.848,849,8.848,850,6.75,851,7.635,852,8.848]],["keywords/32",[]],["title/33",[853,965.506]],["content/33",[0,10.081,6,8.524,80,7.166,148,13.267,190,12.291,206,13.267,382,7.1,552,8.524,685,14.166,712,16.452,854,17.934,855,17.934,856,13.682,857,10.81,858,14.748,859,12.291,860,17.934]],["keywords/33",[]],["title/34",[391,1045.084]],["content/34",[90,12.341,110,7.395,391,13.589,392,13.91,393,16.306,394,16.306]],["keywords/34",[]],["title/35",[3,119.285,416,495.593]],["content/35",[]],["keywords/35",[]],["title/36",[22,350.355,125,469.918]],["content/36",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/36",[]],["title/37",[861,1097.182]],["content/37",[]],["keywords/37",[]],["title/38",[3,151.679]],["content/38",[0,5.588,3,2.169,5,6.427,6,9.599,7,7.122,15,6.087,17,7.076,18,1.95,22,2.904,28,8.579,43,5.208,45,3.418,60,5.244,62,4.604,65,9.814,67,8.579,72,3.58,79,2.189,82,4.456,83,7.153,101,4.684,106,1.527,110,5.431,131,5.325,135,8.579,149,2.904,155,7.153,167,9.12,169,6.886,178,5.153,193,5.451,197,3.135,252,7.852,330,5.738,370,4.948,382,3.265,400,5.047,401,9.766,416,7.122,436,3.775,552,4.725,624,7.584,626,5.903,629,9.12,630,11.503,640,8.175,641,9.12,642,7.153,643,9.12,645,9.12,646,8.579,647,9.12,648,9.12,861,7.153,862,9.941,863,9.941,864,7.714,865,8.579,866,9.941,867,8.175,868,9.941,869,8.579,870,3.351,871,12.567,872,5.208,873,7.584,874,8.579,875,7.153,876,5.588,877,9.941,878,9.941,879,9.941,880,4.492,881,9.941,882,7.047,883,9.941,884,6.378,885,9.941,886,9.941,887,6.087,888,8.175,889,8.175,890,5.047,891,6.974,892,8.579]],["keywords/38",[]],["title/39",[861,1097.182]],["content/39",[3,0.501,5,8.336,7,8.226,11,2.038,17,1.877,18,1.331,42,4.139,45,3.395,56,1.339,57,2.274,62,5.997,65,2.866,72,1.812,83,3.621,85,2.946,95,1.344,96,4.617,106,3.701,110,1.877,115,1.316,124,3.531,131,2.696,146,2.727,147,4.617,152,1.782,175,5.044,178,2.609,180,2.637,185,2.946,188,2.238,197,1.587,198,4.658,208,2.435,214,3.449,237,4.219,238,1.153,251,3.307,260,2.202,266,4.313,292,4.617,303,2.946,321,2.76,324,2.351,339,2.797,350,5.192,356,6.112,382,2.79,409,4.037,412,4.715,416,2.08,430,5.239,449,1.534,458,1.374,460,3.511,488,4.55,508,1.399,510,2.565,511,2.094,512,2.068,554,3.975,565,4.617,566,4.617,584,6.71,627,3.034,655,2.727,682,3.034,687,1.1,692,3.975,739,2.775,857,3.034,859,3.449,861,10.407,882,4.111,890,4.313,892,4.343,893,4.139,894,5.033,895,4.617,896,2.155,897,5.033,898,5.033,899,4.343,900,3.621,901,1.998,902,2.794,903,11.174,904,3.082,905,2.794,906,6.284,907,5.477,908,5.033,909,5.033,910,5.033,911,5.033,912,3.187,913,4.343,914,4.139,915,9.064,916,5.033,917,4.139,918,3.082,919,5.033,920,5.033,921,8.495,922,11.022,923,5.033,924,3.375,925,5.033,926,4.972,927,5.033,928,15.689,929,14.464,930,5.033,931,4.139,932,10.228,933,5.033,934,5.033,935,3.132,936,3.132,937,4.343,938,3.723,939,5.033,940,3.84,941,3.84,942,2.794,943,5.033,944,5.582,945,4.343,946,5.033,947,5.033,948,3.84,949,2.866,950,3.132,951,6.986,952,5.033,953,5.033,954,3.531,955,5.033,956,5.033,957,4.139,958,2.679,959,5.033,960,3.375,961,3.082,962,4.139,963,2.866,964,5.033,965,3.082,966,3.082,967,2.08,968,3.531,969,3.531,970,3.84,971,5.033,972,5.033,973,5.033,974,16.699,975,3.132,976,5.697,977,5.033,978,5.033,979,5.033,980,5.033,981,5.033,982,5.033,983,5.033,984,5.033,985,5.033,986,5.033,987,5.033,988,5.033,989,5.033,990,5.033,991,7.331,992,8.874,993,5.033,994,5.033,995,5.033,996,5.033,997,8.495,998,5.033,999,5.033,1000,5.033,1001,8.495,1002,4.603,1003,5.033,1004,5.033,1005,5.033,1006,5.033,1007,5.033,1008,5.033,1009,4.343,1010,8.495,1011,5.033,1012,1.661]],["keywords/39",[]],["title/40",[3,98.292,106,151.806,861,711.003]],["content/40",[3,1.904,5,6.514,7,7.91,18,1.517,31,7.734,45,3.464,60,5.315,62,6.837,65,8.406,76,4.798,79,3.25,89,7.348,119,7.209,131,7.907,177,9.9,179,5.572,241,5.315,303,8.639,321,8.095,454,10.117,508,5.319,582,13.542,634,13.542,672,12.139,861,15.283,892,12.739,901,5.859,903,12.739,1013,12.139,1014,14.761,1015,7.907,1016,14.761,1017,10.356,1018,14.761,1019,5.538,1020,14.761,1021,14.761,1022,12.139,1023,14.761,1024,14.761]],["keywords/40",[]],["title/41",[95,407.35]],["content/41",[]],["keywords/41",[]],["title/42",[472,821.883,1025,821.883]],["content/42",[3,1.846,5,2.539,7,5.819,8,1.635,11,2.329,18,2.134,22,1.681,36,4.723,43,3.014,45,1.35,50,4.015,57,2.599,58,1.785,72,2.071,79,2.671,95,1.537,106,3.824,110,2.145,119,4.639,149,1.681,150,2.642,157,1.86,174,2.198,179,3.585,197,1.814,209,2.361,218,2.952,221,3.467,234,2.921,237,1.329,238,3.226,239,2.5,241,2.071,258,3.168,273,2.254,287,3.58,304,4.343,305,3.168,331,7.099,342,5.031,350,2.7,426,2.71,454,3.943,456,3.722,458,3.312,463,5.277,470,2.037,472,9.65,493,3.047,508,1.599,580,2.198,589,4.139,620,3.78,651,4.544,660,3.135,669,3.984,677,3.858,687,2.075,693,5.815,695,3.98,697,3.642,716,6.834,732,5.639,739,3.103,747,5.277,762,3.898,814,3.154,861,8.728,870,3.202,924,3.858,976,3.858,1012,4.004,1025,10.681,1026,5.752,1027,4.292,1028,9.975,1029,3.154,1030,4.731,1031,4.731,1032,5.752,1033,9.975,1034,5.147,1035,3.193,1036,3.522,1037,5.752,1038,9.497,1039,5.752,1040,5.752,1041,5.752,1042,5.752,1043,5.752,1044,5.752,1045,5.752,1046,5.752,1047,5.752,1048,5.752,1049,5.752,1050,5.752,1051,5.752,1052,5.752,1053,5.752,1054,2.81,1055,9.497,1056,5.752,1057,9.497,1058,5.752,1059,4.255,1060,3.117,1061,5.272,1062,5.752,1063,5.752,1064,5.752,1065,2.158,1066,7.81,1067,4.731,1068,4.191,1069,9.497,1070,5.752,1071,9.497,1072,5.752,1073,2.642,1074,3.276,1075,3.416,1076,5.752,1077,4.255,1078,5.752,1079,5.752,1080,5.277,1081,2.982,1082,2.642,1083,5.752,1084,5.752,1085,5.752,1086,5.752,1087,9.497,1088,5.752,1089,5.752,1090,5.752,1091,9.497,1092,5.752,1093,3.193,1094,5.752,1095,5.147,1096,4.731,1097,3.78,1098,3.943,1099,5.752,1100,5.752,1101,3.047]],["keywords/42",[]],["title/43",[1102,1398.897]],["content/43",[3,1.397,7,4.674,8,4.542,11,2.89,16,2.871,18,2.07,25,7.934,29,3.486,45,2.654,50,3.157,62,3.306,89,3.553,95,1.907,106,3.742,116,3.553,119,3.486,174,2.728,176,3.588,179,2.694,187,3.624,204,2.406,209,2.93,211,2.6,221,4.302,234,3.624,251,4.691,258,3.772,260,2.932,304,2.556,319,2.815,342,3.781,364,4.306,365,7.585,371,4.787,382,2.344,396,2.95,429,5.136,449,2.176,458,3.835,508,1.984,512,1.738,622,6.548,639,8.466,649,2.556,669,3.2,687,2.471,692,11.095,693,4.37,716,8.137,718,3.7,876,6.357,895,6.548,896,3.057,967,4.674,1002,10.911,1012,2.356,1061,3.962,1074,4.065,1102,6.548,1103,3.7,1104,4.787,1105,4.519,1106,5.07,1107,7.138,1108,7.138,1109,7.138,1110,7.138,1111,7.138,1112,11.309,1113,7.138,1114,7.138,1115,7.138,1116,11.309,1117,7.138,1118,7.138,1119,7.138,1120,7.138,1121,7.138,1122,7.138,1123,5.238,1124,7.138,1125,7.138,1126,7.138,1127,6.44,1128,7.138,1129,7.138,1130,4.12,1131,2.89,1132,3.868,1133,3.74,1134,4.602,1135,4.065,1136,7.138,1137,12.695,1138,3.661,1139,7.138,1140,4.602,1141,7.138,1142,7.138,1143,5.28,1144,4.602,1145,5.638,1146,7.138,1147,7.138,1148,7.138,1149,7.138,1150,7.138,1151,4.519,1152,4.602,1153,7.138,1154,7.138,1155,7.138,1156,4.602,1157,3.781,1158,6.817,1159,7.585,1160,5.87,1161,4.178,1162,5.445,1163,7.138,1164,4.691,1165,3.624,1166,7.138,1167,7.138,1168,7.138,1169,7.138,1170,7.138]],["keywords/43",[]],["title/44",[853,965.506]],["content/44",[3,1.677,6,8.013,17,6.288,18,2.322,57,7.619,60,6.071,61,9.359,62,7.809,77,14.55,78,11.555,79,4.585,258,5.624,303,9.868,397,7.944,612,9.868,861,12.131,880,7.619,1171,16.86,1172,16.86,1173,11.828,1174,12.473,1175,11.555,1176,16.86]],["keywords/44",[]],["title/45",[3,119.285,416,495.593]],["content/45",[]],["keywords/45",[]],["title/46",[22,350.355,125,469.918]],["content/46",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/46",[]],["title/47",[3,119.285,416,495.593]],["content/47",[]],["keywords/47",[]],["title/48",[22,350.355,125,469.918]],["content/48",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/48",[]],["title/49",[3,98.292,106,151.806,1177,753.863]],["content/49",[]],["keywords/49",[]],["title/50",[1177,1163.321]],["content/50",[3,1.422,5,6.308,6,6.793,17,6.99,18,1.927,45,3.354,56,3.802,58,1.637,65,8.14,78,9.796,79,3.147,169,8.356,178,7.409,193,7.838,213,9.796,258,6.252,397,6.734,400,7.257,554,11.29,569,9.796,596,7.332,603,16.519,606,17.194,612,8.365,621,8.035,646,12.335,687,3.123,776,5.496,907,9.215,960,9.586,1135,8.14,1177,15.954,1178,13.865,1179,10.904,1180,7.934,1181,14.293,1182,14.293,1183,14.293,1184,13.112]],["keywords/50",[]],["title/51",[45,281.443,1185,746.37]],["content/51",[3,1.606,8,2.068,11,2.946,12,2.87,17,2.714,18,1.92,45,1.708,50,2.81,58,2.013,76,2.365,79,1.602,98,3.315,106,3.851,110,4.282,115,1.902,135,6.279,152,2.576,218,3.568,234,5.83,237,5.117,238,4.28,241,4.135,258,4.744,260,5.255,273,2.851,305,2.427,321,3.99,338,3.121,339,3.61,341,2.197,345,4.42,350,2.068,364,1.961,370,3.622,374,5.383,409,3.458,438,3.288,458,3.135,464,5.747,469,6.675,475,6.279,476,3.093,481,5.104,485,5.747,486,8.055,494,6.675,509,3.622,603,5.747,660,2.402,661,2.798,669,3.249,688,4.32,814,3.99,838,8.001,896,3.116,958,2.295,1068,5.067,1073,3.342,1177,10.851,1186,9.583,1187,5.983,1188,7.276,1189,7.276,1190,7.276,1191,7.546,1192,7.276,1193,7.276,1194,7.276,1195,7.276,1196,13.048,1197,7.276,1198,7.276,1199,5.983,1200,14.816,1201,11.235,1202,5.983,1203,6.818,1204,2.888,1205,7.276,1206,7.276,1207,7.276,1208,7.276,1209,11.482,1210,3.315,1211,11.482,1212,7.276,1213,11.482,1214,7.276,1215,7.276,1216,4.691,1217,3.854,1218,7.276,1219,5.235,1220,4.88,1221,5.104]],["keywords/51",[]],["title/52",[364,410.91]],["content/52",[0,2.651,3,1.045,6,2.242,12,4.895,15,4.923,16,1.897,17,2.999,18,2.086,20,3.37,27,4.307,31,2.471,43,2.471,45,1.887,56,1.255,57,2.131,58,0.921,60,1.698,76,1.533,80,1.885,85,2.761,92,2.005,94,5.51,106,3.788,107,4.867,115,2.747,128,5.785,133,2.888,141,3.233,150,2.166,152,2.846,169,1.885,177,3.163,182,1.848,187,2.395,191,2.445,204,4.184,209,7.3,211,3.828,218,3.858,221,2.843,231,3.394,241,1.698,260,4.419,301,2.986,305,5.057,357,3.1,361,11.689,365,3.163,380,2.801,382,1.549,397,2.222,404,3.598,407,3.879,450,5.64,458,4.857,459,2.02,493,8.573,512,3.391,577,3.726,580,1.802,589,3.394,596,2.419,624,3.598,627,2.843,649,1.689,661,4.773,663,2.082,678,2.371,687,1.03,714,3.394,715,1.991,718,2.445,757,9.64,760,2.862,763,2.325,796,1.936,903,9.068,926,2.761,938,3.489,1002,8.771,1012,2.654,1017,3.309,1080,9.64,1082,4.826,1130,4.641,1132,2.556,1133,6.503,1138,2.419,1177,3.598,1180,2.618,1184,11.387,1185,2.936,1186,5.39,1191,8.157,1210,3.663,1216,3.041,1222,2.843,1223,3.489,1224,4.717,1225,3.041,1226,4.717,1227,1.78,1228,4.07,1229,4.717,1230,4.717,1231,4.717,1232,3.233,1233,4.717,1234,8.04,1235,4.717,1236,4.07,1237,4.717,1238,6.612,1239,4.327,1240,4.717,1241,8.04,1242,8.04,1243,7.372,1244,3.163,1245,4.717,1246,4.717,1247,3.163,1248,4.717,1249,4.717,1250,4.717,1251,12.412,1252,12.777,1253,4.717,1254,3.489,1255,8.04,1256,11.453,1257,10.507,1258,8.04,1259,9.068,1260,4.717,1261,4.717,1262,4.717,1263,8.04,1264,3.1,1265,6.938,1266,4.717,1267,4.717,1268,4.717,1269,4.717,1270,4.717,1271,4.717,1272,4.463,1273,4.717,1274,2.166,1275,4.717,1276,2.471,1277,7.202,1278,4.717,1279,10.507,1280,4.717,1281,9.64,1282,4.717,1283,2.936,1284,4.409,1285,4.717,1286,3.879,1287,4.717,1288,4.717,1289,4.717,1290,4.717,1291,4.717,1292,9.64,1293,4.717,1294,4.717,1295,4.327,1296,4.717,1297,3.394]],["keywords/52",[]],["title/53",[1185,746.37,1298,841.289]],["content/53",[11,4.352,60,3.87,72,3.87,76,3.493,79,2.366,106,2.367,116,5.35,185,6.29,187,5.457,204,7.955,209,7.393,218,3.34,223,5.402,260,6.117,323,3.87,327,4.569,366,9.275,407,8.838,472,7.366,493,5.693,510,5.941,569,7.366,580,4.107,603,8.489,630,8.489,649,3.848,954,7.54,958,4.86,1133,5.631,1165,9.146,1191,10.126,1196,14.136,1200,14.136,1201,12.172,1203,9.15,1238,8.838,1239,9.859,1252,9.859,1256,8.838,1281,9.859,1283,6.689,1292,16.526,1295,14.136,1298,7.54,1299,5.02,1300,7.366,1301,7.95,1302,10.747,1303,9.275,1304,8.605,1305,18.013,1306,10.747,1307,15.409,1308,10.747,1309,10.747,1310,5.513,1311,6.929,1312,5.757,1313,7.95]],["keywords/53",[]],["title/54",[853,965.506]],["content/54",[3,1.88,8,4.115,18,1.943,57,9.508,91,10.156,95,3.867,115,3.785,136,12.493,157,4.682,201,12.493,319,5.709,323,5.213,396,8.696,404,11.044,411,13.281,508,4.023,584,11.435,603,11.435,614,9.333,621,8.138,627,8.726,654,4.477,669,4.096,675,13.281,814,7.938,958,4.566,1015,7.755,1027,6.542,1177,11.044,1185,9.01,1186,7.426,1299,6.762,1300,9.922,1314,14.476,1315,14.476,1316,14.476,1317,14.476,1318,11.905,1319,14.476,1320,12.493,1321,11.044,1322,5.784]],["keywords/54",[]],["title/55",[391,1045.084]],["content/55",[90,12.341,110,7.395,391,13.589,392,13.91,393,16.306,394,16.306]],["keywords/55",[]],["title/56",[3,119.285,416,495.593]],["content/56",[]],["keywords/56",[]],["title/57",[22,350.355,125,469.918]],["content/57",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/57",[]],["title/58",[3,119.285,416,495.593]],["content/58",[]],["keywords/58",[]],["title/59",[22,350.355,125,469.918]],["content/59",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,149,5.596,223,9.628,466,9.534,683,8.871,684,14.169]],["keywords/59",[]],["title/60",[3,119.285,416,495.593]],["content/60",[]],["keywords/60",[]],["title/61",[22,350.355,125,469.918]],["content/61",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/61",[]],["title/62",[3,119.285,416,495.593]],["content/62",[]],["keywords/62",[]],["title/63",[22,350.355,125,469.918]],["content/63",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/63",[]],["title/64",[18,101.574,258,329.615,1323,541.872]],["content/64",[]],["keywords/64",[]],["title/65",[18,101.574,258,329.615,1323,541.872]],["content/65",[3,1.97,18,2.185,22,3.748,58,1.997,62,5.941,143,11.459,176,6.448,197,4.046,209,7.157,258,7.09,378,7.984,380,7.617,409,6.097,416,5.301,512,4.823,656,7.305,669,4.934,682,7.732,701,6.152,708,8.853,714,9.23,763,6.324,819,8.603,887,7.854,1012,6.539,1065,4.813,1130,7.404,1131,7.06,1232,8.792,1323,7.034,1324,9.786,1325,8.999,1326,13.968,1327,9.786,1328,11.07,1329,9.23,1330,9.786,1331,8.43,1332,8.999,1333,13.302,1334,11.07,1335,11.07,1336,8.271,1337,9.786,1338,11.07,1339,8.999]],["keywords/65",[]],["title/66",[18,123.267,703,821.883]],["content/66",[3,1.508,5,6.69,8,4.309,31,10.201,58,2.23,62,7.021,98,6.905,197,4.781,208,7.335,209,10.03,578,10.389,625,13.345,649,5.428,669,4.289,703,10.389,857,9.137,935,12.119,1012,7.101,1187,12.466,1223,11.214,1254,11.214,1339,15.091,1340,10.907,1341,14.855,1342,11.564,1343,11.974]],["keywords/66",[]],["title/67",[50,195.235,211,359.958,1323,541.872]],["content/67",[3,1.756,8,5.018,50,4.555,56,5.696,58,2.453,191,9.15,211,7.801,669,4.995,776,8.234,1065,6.623,1131,7.148,1323,9.68,1344,17.653,1345,13.467]],["keywords/67",[]],["title/68",[1029,657.601,1346,665.681]],["content/68",[8,4.089,36,5.601,50,3.718,58,2.156,157,6.087,209,7.725,211,5.24,218,4.47,258,6.278,323,5.18,625,9.858,660,4.748,669,5.325,701,6.898,714,10.35,776,5.531,820,12.134,887,8.807,935,8.953,966,8.807,1065,5.397,1095,7.795,1131,5.824,1254,10.641,1324,10.974,1325,10.091,1326,13.786,1327,10.974,1331,9.453,1332,10.091,1333,10.974,1337,10.974,1339,15.611,1341,10.974,1342,10.974,1345,10.974,1347,12.413]],["keywords/68",[]],["title/69",[1304,605.3]],["content/69",[]],["keywords/69",[]],["title/70",[1054,744.754]],["content/70",[16,6.781,17,6.288,18,2.14,29,8.235,56,4.485,60,6.071,87,8.833,110,6.288,215,10.163,285,9.478,324,7.875,449,5.139,459,7.22,577,13.318,687,3.683,1054,8.235,1157,8.931,1304,8.265,1348,17.968,1349,13.318,1350,14.55,1351,11.307,1352,9.868]],["keywords/70",[]],["title/71",[95,407.35]],["content/71",[106,3.879,215,8.15,237,3.123,238,3.098,243,7.7,260,3.505,285,7.601,319,5.332,345,4.202,449,4.121,457,7.415,458,4.933,511,5.627,687,2.954,760,4.814,890,6.865,958,4.264,1054,6.604,1123,7.588,1204,5.367,1298,9.485,1322,5.402,1352,7.913,1353,10.68,1354,10.68,1355,6.37,1356,9.729,1357,14.27,1358,9.068,1359,7.913,1360,10.68,1361,11.668,1362,9.267,1363,10.68,1364,10.68,1365,10.68,1366,8.028,1367,11.668,1368,9.267,1369,8.028,1370,8.561,1371,10.68]],["keywords/71",[]],["title/72",[1369,712.065,1372,1034.893]],["content/72",[3,1.44,6,6.881,17,5.399,18,1.943,58,1.658,74,11.905,80,5.784,115,5.501,134,10.416,145,6.155,173,8.138,181,8.726,182,7.406,251,9.514,319,5.709,441,11.044,597,9.709,600,8.864,649,5.183,661,5.566,687,4.597,760,5.154,818,8.244,876,8.138,880,6.542,890,7.35,949,8.244,1276,7.585,1304,5.747,1373,16.31,1374,16.31,1375,12.493,1376,11.435,1377,9.709,1378,9.922,1379,11.435,1380,8.473,1381,12.493,1382,8.596,1383,10.156]],["keywords/72",[]],["title/73",[95,407.35]],["content/73",[18,1.268,50,3.354,58,1.944,106,3.954,152,6.01,188,5.487,237,3.921,238,4.447,273,4.834,288,6.328,338,4.615,339,3.131,341,5.126,345,5.276,350,3.506,697,10.749,809,10.145,814,6.765,838,5.283,1068,5.444,1073,5.666,1186,6.328,1383,8.654,1384,16.751,1385,7.22,1386,10.646,1387,6.463,1388,10.646,1389,10.646,1390,10.646,1391,10.646,1392,10.646,1393,10.646,1394,9.411,1395,8.8,1396,8.876,1397,10.646,1398,6.765,1399,5.283,1400,10.646,1401,10.646,1402,10.646]],["keywords/73",[]],["title/74",[1304,476.025,1403,1034.893]],["content/74",[72,5.769,106,3.745,110,5.975,180,8.394,238,4.621,324,7.483,382,5.261,459,6.861,687,3.5,890,8.134,944,10.528,1054,7.825,1161,11.804,1304,8.762,1352,11.804,1382,9.513,1383,11.239,1404,10.98,1405,12.222,1406,13.826,1407,14.149,1408,12.222]],["keywords/74",[]],["title/75",[552,469.66,654,305.605,1409,517.71]],["content/75",[]],["keywords/75",[]],["title/76",[552,469.66,1410,753.863,1411,512.201]],["content/76",[3,2.153,15,6.549,18,1.847,56,2.845,58,2.058,132,6.549,157,3.459,178,5.544,182,4.191,204,6.056,218,3.324,258,5.122,260,5.779,305,7.219,385,5.796,436,4.062,456,8.148,510,5.928,512,2.604,552,5.084,650,6.351,654,6.43,796,4.39,880,6.939,905,5.937,924,7.173,944,7.029,1019,4.013,1027,6.939,1081,5.544,1082,7.053,1227,4.038,1312,5.73,1409,5.604,1410,8.16,1411,9.312,1412,8.449,1413,9.231,1414,9.231,1415,7.839,1416,8.801,1417,10.092,1418,8.449,1419,10.092,1420,9.231,1421,10.773,1422,7.029,1423,7.173,1424,8.16,1425,9.231,1426,8.449,1427,6.549,1428,6.549]],["keywords/76",[]],["title/77",[552,469.66,654,305.605,1409,517.71]],["content/77",[]],["keywords/77",[]],["title/78",[950,949.064]],["content/78",[3,1.508,12,5.978,72,5.459,79,4.287,106,3.487,133,9.281,237,3.501,260,6.086,305,5.056,337,9.001,339,3.847,654,4.688,663,8.593,664,11.564,687,3.312,950,12.119,976,10.166,1019,5.687,1027,6.85,1127,8.633,1191,12.796,1411,7.857,1415,5.49,1429,10.907,1430,13.082,1431,11.974,1432,13.082,1433,11.564,1434,13.082,1435,13.082]],["keywords/78",[]],["title/79",[456,469.918,1409,628.279]],["content/79",[3,1.324,58,1.838,75,4.721,76,2.865,79,4.227,82,3.951,95,3.557,106,3.514,115,2.304,132,5.396,139,6.04,204,5.409,218,2.739,232,7.793,237,3.706,238,3.05,260,5.434,304,7.727,338,3.619,339,2.237,341,2.661,345,2.739,350,3.784,382,2.894,434,5.58,449,2.686,456,8.457,474,7.248,480,4.015,510,4.02,511,3.668,650,5.233,654,2.726,660,2.909,687,1.925,695,3.694,760,3.138,838,5.702,859,6.04,876,7.485,884,3.86,896,3.774,904,5.396,907,5.682,942,4.892,961,5.396,1027,3.982,1065,3.307,1227,3.327,1284,4.833,1299,4.117,1409,4.617,1419,5.792,1421,6.183,1436,6.962,1437,6.962,1438,7.606,1439,4.475,1440,5.911,1441,8.813,1442,5.485,1443,7.606,1444,5.911,1445,5.312,1446,6.724,1447,4.954,1448,5.396,1449,4.015,1450,7.606,1451,6.724,1452,6.183,1453,7.606,1454,7.606,1455,6.724,1456,7.606,1457,7.606,1458,7.606,1459,7.606,1460,11.49,1461,11.49,1462,7.606,1463,7.606,1464,7.606,1465,5.911,1466,5.312,1467,5.019,1468,5.019,1469,5.792,1470,5.087,1471,7.606,1472,7.606,1473,7.606,1474,7.606,1475,6.341,1476,7.606,1477,5.485]],["keywords/79",[]],["title/80",[18,123.267,1478,914.868]],["content/80",[18,1.184,45,2.703,58,2.143,106,3.81,233,6.241,237,4.939,238,4.65,273,4.513,304,7.657,338,3.131,339,2.923,341,3.477,345,5.03,350,5.319,449,5.704,456,4.513,458,5.109,552,5.474,654,3.562,838,6.931,950,7.168,970,8.786,1123,4.295,1179,8.786,1186,5.907,1449,5.246,1451,8.786,1455,12.347,1478,14.275,1479,9.938,1480,6.315,1481,8.519,1482,9.938,1483,9.938,1484,9.938,1485,9.938,1486,9.938,1487,9.938,1488,9.938,1489,9.938,1490,14.604,1491,9.217,1492,13.967,1493,9.938,1494,9.938,1495,9.938]],["keywords/80",[]],["title/81",[853,965.506]],["content/81",[3,1.92,6,7.109,17,5.578,18,2.197,46,7.753,65,8.518,79,4.251,87,7.836,101,7.047,103,13.23,131,8.012,148,11.065,157,4.837,178,7.753,179,5.646,204,6.508,260,3.877,305,6.439,382,4.912,508,4.157,552,7.109,654,4.626,760,5.325,915,12.3,950,9.309,1027,6.759,1164,9.829,1191,9.829,1409,7.836,1444,10.031,1465,10.031,1496,12.908,1497,6.987,1498,12.908,1499,12.908,1500,9.829]],["keywords/81",[]],["title/82",[654,370.874,1501,682.927]],["content/82",[]],["keywords/82",[]],["title/83",[8,280.871,581,677.243,1502,649.387]],["content/83",[3,1.269,8,3.626,11,5.165,12,5.031,16,5.13,17,4.757,18,1.311,95,3.407,106,2.668,110,4.757,115,3.335,178,6.612,197,4.023,204,7.148,231,9.178,232,7.465,237,2.946,238,3.979,260,5.12,304,4.567,305,6.588,350,3.626,512,4.229,578,8.742,580,4.874,627,7.688,649,4.567,654,3.945,699,6.476,732,10.314,760,4.541,772,8.382,796,8.703,1203,7.574,1466,7.688,1502,8.382,1503,11.905,1504,11.008,1505,9.731,1506,11.008,1507,10.076,1508,7.688,1509,9.731,1510,8.382,1511,9.731,1512,9.731,1513,7.264,1514,6.476,1515,11.008,1516,11.008,1517,11.008,1518,11.008,1519,8.948]],["keywords/83",[]],["title/84",[3,119.285,581,821.883]],["content/84",[3,1.549,34,13.433,45,2.559,54,5.841,79,4.361,95,4.159,106,3.043,145,4.635,179,5.877,204,6.121,237,3.596,260,4.036,304,3.904,305,5.193,318,7.035,322,7.312,324,7.272,338,4.232,339,4.609,382,3.581,401,7.312,430,5.182,449,6.385,458,2.977,509,5.427,510,3.292,512,3.79,518,6.381,519,6.786,615,7.312,654,6.478,687,2.382,739,3.562,763,5.376,902,6.052,905,6.052,931,8.966,963,8.866,1060,5.908,1074,6.209,1103,5.652,1185,6.786,1203,6.474,1310,5.593,1422,7.165,1445,6.572,1468,6.209,1501,8.866,1503,6.572,1520,9.409,1521,7.312,1522,9.409,1523,9.409,1524,9.409,1525,5.841,1526,9.409,1527,9.409,1528,6.676,1529,13.853,1530,11.877,1531,13.436,1532,8.318,1533,9.409]],["keywords/84",[]],["title/85",[197,378.226,204,404.25]],["content/85",[0,5.819,34,7.658,58,1.186,79,4.52,95,4.712,106,3.681,132,9.183,145,6.377,152,6.244,188,4.604,204,7.442,270,6.338,322,6.943,339,2.627,343,6.674,406,5.01,412,11.395,449,4.572,451,12.036,508,2.877,509,5.153,512,3.652,520,4.716,661,3.98,697,9.497,699,5.256,717,5.01,718,5.366,794,7.095,801,8.513,902,5.746,912,6.555,960,6.943,961,6.338,1060,5.61,1103,5.366,1217,5.483,1387,9.241,1422,6.803,1466,6.24,1468,5.895,1509,7.898,1511,7.898,1512,7.898,1529,7.898,1530,7.898,1534,8.934,1535,11.591,1536,6.943,1537,8.934,1538,8.934,1539,6.943,1540,7.898,1541,10.352,1542,10.352,1543,10.352,1544,8.934,1545,10.352,1546,8.934,1547,7.262,1548,8.934,1549,8.934,1550,7.262,1551,8.934,1552,8.934,1553,5.204,1554,8.934,1555,8.934,1556,7.898]],["keywords/85",[]],["title/86",[260,310.858,1557,759.301]],["content/86",[58,2.087,182,7.141,251,11.976,260,4.724,266,9.253,305,6.079,510,5.502,654,5.636,699,9.253,1227,6.879,1469,11.976,1557,13.822,1558,12.222,1559,14.395,1560,15.727]],["keywords/86",[]],["title/87",[716,862.854,820,773.156]],["content/87",[]],["keywords/87",[]],["title/88",[58,113.175,820,637.091,896,423.18]],["content/88",[3,1.904,22,4.313,36,5.748,50,2.916,56,3.926,58,1.691,76,4.798,106,3.577,157,6.869,178,9.921,258,6.385,323,5.315,385,7.999,397,6.955,819,9.9,820,14.49,901,7.598,936,9.187,1019,5.538,1035,10.625,1138,7.572,1323,8.095,1561,12.739,1562,16.518,1563,11.66,1564,12.739,1565,12.739,1566,8.406,1567,8.406,1568,7.348]],["keywords/88",[]],["title/89",[8,433.424]],["content/89",[]],["keywords/89",[]],["title/90",[18,123.267,1569,439.386]],["content/90",[3,1.828,8,5.222,60,6.616,131,9.842,157,5.942,218,5.71,430,8.732,508,5.106,580,7.021,776,8.435,1157,9.732,1301,13.591,1570,15.855,1571,15.855]],["keywords/90",[]],["title/91",[958,480.942]],["content/91",[3,1.856,7,4.735,8,5.756,18,1.918,58,1.847,61,6.36,79,2.523,82,8.365,106,2.477,150,5.263,170,8.741,204,3.862,241,4.126,251,7.53,305,6.224,321,6.283,339,2.908,397,5.398,413,5.877,508,3.184,621,6.441,654,3.544,683,5.307,739,3.744,760,4.079,763,7.951,796,4.703,864,6.069,870,3.862,884,5.018,896,4.907,951,9.422,958,7.762,1061,6.36,1075,6.803,1204,6.401,1220,7.684,1299,5.352,1321,8.741,1440,7.684,1503,9.72,1514,5.818,1568,5.703,1572,9.888,1573,9.051,1574,7.387,1575,7.255,1576,8.741,1577,8.741,1578,9.051,1579,9.888,1580,9.888,1581,9.888,1582,13.917,1583,8.272,1584,8.244,1585,8.741,1586,7.255,1587,6.209]],["keywords/91",[]],["title/92",[1054,744.754]],["content/92",[3,1.983,8,3.145,12,4.363,18,2.407,27,5.927,58,1.267,72,3.984,80,4.421,115,4.113,126,7.005,132,6.774,146,5.996,164,7.005,174,7.619,180,5.797,192,8.185,204,3.73,239,6.838,241,6.592,245,5.797,297,9.098,305,3.691,326,8.185,327,4.704,370,5.507,436,4.202,669,5.18,687,2.417,695,4.637,702,8.185,715,4.67,763,7.756,870,5.303,884,4.845,967,8.705,1029,6.067,1054,5.404,1123,4.126,1130,6.386,1276,5.797,1356,7.961,1380,6.475,1577,8.441,1588,13.576,1589,16.427,1590,8.739,1591,8.441,1592,8.441,1593,7.133,1594,8.441,1595,9.548,1596,9.548,1597,5.354,1598,6.067,1599,8.739,1600,5.927,1601,7.961,1602,8.441,1603,7.005,1604,9.548,1605,9.548]],["keywords/92",[]],["title/93",[1600,816.841]],["content/93",[3,1.77,8,5.057,18,1.829,115,4.652,216,11.932,369,13.162,649,6.371,651,14.054,739,5.813,762,7.303,889,14.632,1396,12.802,1606,10.725,1607,12.482,1608,15.355,1609,15.355,1610,15.355,1611,15.355,1612,15.355]],["keywords/93",[]],["title/94",[655,826.325]],["content/94",[6,6.504,8,3.89,12,5.397,18,2.104,31,7.17,60,6.558,115,5.705,145,7.743,228,5.617,241,4.928,245,7.17,305,6.075,319,7.183,323,4.928,373,6.879,451,11.335,458,5.589,620,8.993,626,8.126,677,9.178,687,3.979,763,6.747,870,4.613,1054,6.684,1217,7.249,1227,5.166,1355,6.448,1589,12.776,1592,10.44,1613,11.81,1614,11.81,1615,11.81,1616,11.81,1617,10.44,1618,15.717,1619,10.124,1620,11.81,1621,15.717,1622,12.776,1623,9.178]],["keywords/94",[]],["title/95",[50,236.931,1569,439.386]],["content/95",[8,3.987,15,8.588,18,1.442,50,4.648,72,5.051,80,5.604,133,8.588,174,7.074,182,5.496,209,5.757,260,3.636,363,6.288,364,3.78,365,9.407,436,5.327,457,5.757,460,4.468,578,9.613,639,8.454,649,7.419,655,7.601,656,7.988,660,4.63,663,6.19,717,6.787,880,6.338,901,5.568,1123,5.231,1127,7.988,1227,6.988,1423,9.407,1429,10.092,1569,6.783,1594,10.7,1603,8.881,1624,12.104,1625,9.217,1626,12.104,1627,7.988,1628,10.7,1629,11.079,1630,12.104,1631,12.104]],["keywords/95",[]],["title/96",[1632,919.143]],["content/96",[3,2.24,8,6.688,50,4.095,197,5.278,209,6.869,211,7.55,234,10.523,258,5.582,323,6.026,325,6.516,406,10.029,512,4.074,669,5.864,776,6.435,1012,5.524,1095,9.069,1633,14.442]],["keywords/96",[]],["title/97",[8,238.838,18,86.373,364,226.432,596,431.021]],["content/97",[8,5.707,18,1.635,31,8.334,54,8.521,58,2.3,75,8.521,101,7.495,110,5.933,119,7.769,169,6.356,179,6.005,218,4.944,228,6.529,241,5.728,363,9.001,364,4.287,621,11.287,715,6.715,884,6.967,936,9.901,1019,5.969,1065,5.969,1132,8.62,1497,7.431,1634,13.728,1635,9.182,1636,7.698,1637,10.669,1638,11.446,1639,13.728]],["keywords/97",[]],["title/98",[209,492.192,327,509.83]],["content/98",[3,1.812,18,2.336,50,2.704,98,6.234,116,6.812,149,3.998,204,6.139,271,7.793,304,4.9,321,7.504,325,7.97,326,10.124,327,8.702,364,4.908,397,6.448,459,5.861,480,8.296,510,6.18,612,8.01,621,7.693,660,4.518,669,3.872,763,6.747,872,7.17,1060,7.416,1130,7.899,1132,7.416,1323,7.504,1370,8.665,1553,6.879,1569,5.014,1597,6.622,1640,15.717,1641,7.504,1642,11.81,1643,10.512,1644,11.81,1645,10.81,1646,11.81,1647,11.81,1648,9.379]],["keywords/98",[]],["title/99",[95,263.974,364,266.281,1186,506.875]],["content/99",[8,5.598,18,1.304,45,2.977,50,2.506,56,4.602,58,1.453,106,3.709,110,4.73,176,6.376,187,8.785,204,4.276,216,8.506,231,9.126,260,4.485,325,6.737,327,7.356,364,4.663,382,4.165,458,3.463,459,5.432,512,3.088,652,5.354,660,4.187,661,4.877,678,6.376,1002,11.464,1060,6.873,1081,6.574,1123,4.73,1132,9.376,1133,6.645,1134,8.177,1135,7.223,1137,13.556,1138,6.506,1140,8.177,1143,9.383,1144,8.177,1186,6.506,1427,7.766,1649,8.898,1650,10.946,1651,10.946,1652,10.946,1653,10.946,1654,10.946]],["keywords/99",[]],["title/100",[95,263.974,364,266.281,1655,693.233]],["content/100",[0,8.403,3,1.75,8,5,18,2.106,20,4.319,45,2.418,50,2.036,56,2.741,58,1.18,76,3.35,79,3.292,80,4.117,82,4.619,85,6.031,106,3.638,174,3.938,176,5.18,187,5.232,204,5.93,208,4.987,209,4.229,214,7.062,234,5.232,239,4.479,258,3.437,288,5.286,364,4.74,370,5.13,382,3.384,449,4.557,458,2.814,470,3.648,508,2.864,512,3.639,669,2.916,708,7.59,719,6.644,904,6.309,1002,11.58,1012,3.402,1123,3.843,1132,5.584,1133,5.399,1134,6.644,1135,5.868,1137,13.498,1138,5.286,1140,6.644,1144,6.644,1553,5.18,1641,5.651,1649,7.229,1655,10.487,1656,8.893,1657,8.893,1658,8.893,1659,8.893,1660,8.893,1661,7.861,1662,8.893,1663,8.893,1664,7.861,1665,8.893,1666,8.893,1667,8.893,1668,6.525,1669,4.987,1670,7.415,1671,5.399,1672,8.14,1673,8.893,1674,7.861]],["keywords/100",[]],["title/101",[95,263.974,364,266.281,1675,693.233]],["content/101",[3,1.255,8,5.581,18,1.772,45,2.96,50,2.492,72,4.542,76,4.1,79,2.777,106,3.747,174,4.82,176,6.34,187,6.404,204,4.252,208,6.103,228,5.177,234,6.404,258,4.207,288,6.47,364,4.645,382,4.142,449,3.845,453,7.85,458,3.444,470,4.465,512,3.071,669,3.569,730,10.372,882,6.103,1002,11.437,1123,4.704,1132,6.835,1133,6.608,1134,8.132,1135,7.183,1137,13.53,1138,6.47,1140,8.132,1144,8.132,1145,9.963,1284,6.916,1636,6.103,1649,8.848,1661,9.622,1664,9.622,1669,6.103,1670,9.075,1671,6.608,1675,8.848,1676,10.884,1677,10.884,1678,10.884]],["keywords/101",[]],["title/102",[18,101.574,215,595.63,373,496.727]],["content/102",[3,2.109,18,2.18,45,2.994,56,3.393,58,1.461,115,5.544,117,6.833,119,9.647,139,8.742,149,3.727,174,4.874,182,4.998,197,4.023,228,5.235,239,5.544,258,4.255,323,4.593,327,5.423,342,10.462,373,9.928,424,9.731,444,8.948,449,3.888,453,7.939,509,6.349,610,10.489,649,4.567,655,6.912,715,5.384,739,4.167,762,5.235,763,6.289,870,4.3,1019,4.786,1029,9.525,1054,8.483,1137,7.81,1157,6.756,1227,4.815,1300,8.742,1423,11.649,1576,9.731,1597,6.172,1602,15.068,1603,8.076,1679,11.008,1680,8.948,1681,11.008,1682,11.008]],["keywords/102",[]],["title/103",[58,137.346,1680,841.289]],["content/103",[8,4.881,18,1.289,56,3.336,58,1.967,115,3.279,119,8.386,178,6.501,188,7.637,239,5.452,258,5.728,259,6.719,260,3.251,266,6.368,304,4.491,323,7.582,325,4.884,327,8.952,342,9.095,373,6.305,430,5.961,434,5.256,436,4.763,442,8.242,499,6.184,510,6.659,512,3.054,663,5.535,699,8.718,876,7.05,1065,4.706,1123,4.678,1132,6.797,1178,9.278,1346,6.962,1491,9.779,1553,6.305,1557,7.941,1589,8.799,1603,10.872,1641,6.878,1674,9.568,1680,8.799,1683,10.824,1684,10.824,1685,14.818,1686,10.824,1687,10.824,1688,10.824,1689,10.824,1690,10.824,1691,10.824,1692,10.824]],["keywords/103",[]],["title/104",[649,545.984]],["content/104",[3,1.843,43,9.705,45,4.347,58,2.122,72,6.67,197,5.842,241,6.67,338,5.036,723,12.995,882,8.964,1274,8.508,1416,8.304,1693,9.923,1694,10.692]],["keywords/104",[]],["title/105",[1693,816.841]],["content/105",[]],["keywords/105",[]],["title/106",[1632,919.143]],["content/106",[3,2.193,45,4.347,50,3.66,80,7.401,211,8.03,416,7.655,669,5.241,776,7.123,901,7.353,1095,10.038,1227,6.992,1693,9.923]],["keywords/106",[]],["title/107",[1695,1315.941]],["content/107",[18,2.287,50,3.718,56,3.826,75,7.705,92,6.115,169,7.52,179,5.43,211,5.24,239,6.252,337,11.175,364,3.876,458,3.927,563,11.829,637,9.453,639,8.67,663,6.348,687,3.142,723,10.091,760,7.922,776,5.531,924,9.647,926,8.419,942,7.985,1075,11.175,1157,7.619,1180,7.985,1416,6.448,1569,5.27,1693,12.691,1696,12.413,1697,10.974,1698,10.091,1699,12.413,1700,12.413]],["keywords/107",[]],["title/108",[649,545.984]],["content/108",[18,2.299,45,3.87,115,4.311,176,8.289,178,8.547,223,8.289,237,3.808,303,9.651,338,4.483,364,4.444,417,10.097,458,4.502,649,5.904,687,3.602,763,8.13,776,6.341,1075,9.791,1274,9.432,1310,10.534,1416,7.392,1567,9.391,1693,11.001,1694,9.518,1701,14.231]],["keywords/108",[]],["title/109",[776,586.326]],["content/109",[]],["keywords/109",[]],["title/110",[18,123.267,1569,439.386]],["content/110",[3,2.03,16,5.471,18,2.238,56,3.618,57,6.147,80,5.435,95,3.634,98,6.197,104,7.851,157,4.399,169,7.247,382,4.467,417,8.329,429,9.787,436,5.166,456,5.33,458,3.714,460,4.333,506,11.186,508,6.302,552,6.465,581,9.323,621,7.646,627,8.199,654,4.207,660,4.49,687,4.458,772,8.939,776,6.974,872,7.127,880,6.147,958,4.29,967,5.622,1061,7.551,1103,7.051,1127,7.746,1161,7.961,1227,5.135,1312,7.287,1569,6.646,1597,6.582,1702,9.543,1703,6.003,1704,11.739]],["keywords/110",[]],["title/111",[242,596.939,1569,439.386]],["content/111",[1,8.88,18,2.055,50,3.949,58,1.809,80,6.312,115,4.13,149,4.615,169,6.312,240,8.276,242,7.863,328,9.117,364,4.257,381,12.051,382,5.188,436,5.999,460,5.032,508,4.39,612,9.245,660,5.214,687,3.451,776,6.074,880,7.138,912,10.002,969,11.082,1061,8.769,1082,7.255,1105,10.002,1222,9.521,1569,7.324,1575,10.002,1597,7.644,1705,13.632]],["keywords/111",[]],["title/112",[22,350.355,125,469.918]],["content/112",[3,1.955,60,7.078,382,6.455,508,5.463,580,7.511,776,7.558,1671,10.298]],["keywords/112",[]],["title/113",[1706,892.464]],["content/113",[]],["keywords/113",[]],["title/114",[1707,1204.507]],["content/114",[3,1.55,18,1.601,19,8.647,58,2.269,75,8.345,79,5.049,101,7.339,157,5.038,400,7.909,426,7.339,436,5.916,508,4.329,642,11.209,687,4.76,907,10.043,1019,5.845,1416,6.983,1637,10.447,1694,12.576,1706,13.857,1708,17.099,1709,14.256,1710,8.991]],["keywords/114",[]],["title/115",[45,281.443,95,320.351]],["content/115",[3,0.843,17,1.873,18,1.611,54,2.69,58,1.795,60,1.808,61,2.788,79,3.451,81,3.967,95,2.94,101,2.366,106,3.7,110,1.873,157,1.624,179,1.896,181,3.027,188,2.233,193,2.754,218,1.561,237,5.234,238,5.106,243,4.828,258,1.675,262,4.13,304,5.611,324,2.346,338,3.515,339,2.152,341,2.56,345,6.033,350,5.188,364,2.285,382,2.784,385,2.721,396,5.343,458,6.086,470,4.577,476,3.605,487,5.811,491,6.632,493,2.66,509,2.5,511,8.277,512,2.064,513,6.145,514,6.436,520,5.013,526,3.3,528,4.766,530,4.962,539,3.027,543,3.027,544,4.707,546,3.027,580,1.919,652,2.12,687,3.424,762,2.061,905,2.788,936,3.125,1065,1.884,1103,2.603,1106,5.796,1123,6.538,1164,3.3,1312,4.542,1318,4.13,1355,3.995,1411,4.395,1445,3.027,1470,2.898,1521,3.368,1566,2.86,1636,2.43,1669,2.43,1694,2.898,1706,9.172,1709,3.613,1711,6.468,1712,6.468,1713,5.368,1714,5.022,1715,4.349,1716,7.231,1717,5.686,1718,6.468,1719,6.702,1720,6.468,1721,6.468,1722,7.317,1723,2.754,1724,3.238,1725,3.368,1726,7.317,1727,3.523,1728,3.125,1729,5.191,1730,7.317,1731,6.468,1732,3.967,1733,7.317,1734,4.334,1735,4.334,1736,4.334,1737,4.334,1738,4.334,1739,4.334,1740,9.496,1741,7.317,1742,4.334,1743,4.334,1744,4.334,1745,4.334,1746,4.334,1747,4.334,1748,4.334,1749,4.334,1750,3.715,1751,4.334,1752,4.334,1753,4.334]],["keywords/115",[]],["title/116",[3,119.285,669,339.318]],["content/116",[]],["keywords/116",[]],["title/117",[36,466.935,1444,804.245]],["content/117",[3,2.236,25,5.755,36,8.881,50,1.621,54,4.394,56,2.182,58,2.53,60,2.954,72,5.529,76,2.667,87,4.298,91,5.755,95,2.191,106,3.016,116,4.083,117,4.394,143,10.09,149,6.567,150,5.79,179,4.759,211,2.988,221,7.599,239,3.566,241,2.954,245,4.298,323,5.529,325,4.909,426,3.865,428,5.023,430,3.899,512,4.978,580,3.135,663,3.62,669,5.785,697,9.722,708,4.165,715,5.321,870,7.295,882,3.97,901,5.004,976,5.502,1012,2.708,1013,6.746,1030,10.367,1034,4.445,1035,4.554,1036,5.023,1131,5.104,1210,5.743,1300,5.622,1311,8.128,1330,6.258,1331,8.285,1641,4.498,1703,3.62,1754,7.079,1755,9.23,1756,6.258,1757,5.289,1758,11.774,1759,4.801,1760,7.079,1761,10.879,1762,5.502,1763,14.87,1764,5.391,1765,7.079,1766,7.079,1767,6.48,1768,8.203,1769,6.258,1770,7.079]],["keywords/117",[]],["title/118",[45,281.443,197,378.226]],["content/118",[3,1.56,18,1.612,45,4.671,58,2.279,149,5.814,197,6.277,228,6.438,288,8.046,323,5.649,382,5.151,669,4.438,762,6.438,864,8.309,870,6.709,1012,7.216,1067,12.9,1068,6.923,1101,11.579,1131,6.351,1186,8.046,1322,6.268,1475,11.287,1771,13.537,1772,13.537,1773,9.763,1774,13.537,1775,11.967]],["keywords/118",[]],["title/119",[50,301.275]],["content/119",[3,2.175,6,6.966,8,4.166,18,1.507,36,5.707,45,2.354,50,4.751,54,5.373,58,2.321,72,3.612,95,2.679,133,6.141,157,3.244,169,4.007,177,6.726,179,6.538,197,3.163,209,4.116,211,7.711,234,7.442,241,3.612,258,3.345,323,6.237,325,5.707,327,4.264,364,2.703,375,7.922,401,6.726,430,4.767,508,2.787,512,3.568,639,6.045,649,3.591,652,4.233,669,6.342,670,7.419,717,4.853,776,5.636,856,11.182,870,3.381,1012,3.311,1017,7.036,1019,3.763,1029,5.5,1095,10.325,1096,8.248,1097,6.591,1131,5.935,1310,5.145,1502,9.632,1505,7.651,1567,5.712,1607,7.036,1693,7.852,1697,7.651,1776,8.655,1777,8.655,1778,8.655,1779,8.655,1780,8.655,1781,8.655,1782,6.35,1783,8.655,1784,8.655]],["keywords/119",[]],["title/120",[45,281.443,258,400.012]],["content/120",[3,1.896,18,2.177,45,3.442,50,2.897,58,1.68,75,7.856,98,6.681,106,2.253,193,8.042,197,4.625,209,7.823,211,6.943,234,7.446,258,7.751,259,7.856,287,9.127,288,9.777,301,9.286,323,5.281,325,5.71,400,7.446,406,7.097,669,5.393,1012,4.841,1131,5.938,1186,7.522,1497,8.903,1636,7.097,1755,7.856,1759,8.583,1785,10.051,1786,9.455,1787,12.656,1788,10.288]],["keywords/120",[]],["title/121",[18,101.574,197,311.663,1583,506.875]],["content/121",[3,1.539,18,2.232,58,2.259,197,6.85,258,5.161,259,8.287,288,7.936,323,5.571,378,9.629,512,3.767,612,9.055,669,4.378,870,5.215,958,4.879,969,10.853,1012,5.107,1131,7.988,1274,7.106,1312,8.287,1497,7.226,1556,11.803,1583,12.119,1755,11.634,1789,12.22,1790,13.839]],["keywords/121",[]],["title/122",[22,350.355,125,469.918]],["content/122",[3,1.889,22,5.549,60,6.839,198,10.415,228,7.795,580,7.258,669,5.374,708,9.643,870,6.402,1012,6.27,1791,16.39]],["keywords/122",[]],["title/123",[1,674.112,242,596.939]],["content/123",[]],["keywords/123",[]],["title/124",[22,350.355,125,469.918]],["content/124",[3,1.873,18,1.936,22,5.502,45,4.42,50,3.721,116,9.375,219,15.488,270,11.531,319,7.428,1568,9.375,1698,13.213,1792,12.377]],["keywords/124",[]],["title/125",[363,683.567]],["content/125",[]],["keywords/125",[]],["title/126",[1793,880.134]],["content/126",[3,0.512,5,2.272,18,1.821,20,2.157,22,1.504,27,2.758,45,1.208,50,3.335,55,3.013,56,3.494,57,2.326,58,2.243,60,1.854,72,1.854,95,3.509,98,2.345,104,2.971,106,3.868,110,1.92,115,2.929,116,2.562,117,2.758,145,3.681,146,2.79,157,1.665,169,2.057,174,5.02,187,4.396,204,5.973,218,2.691,223,2.588,228,2.113,238,1.179,239,4.87,240,5.87,242,2.562,259,2.758,260,2.904,266,4.396,271,2.932,273,3.393,305,1.717,323,1.854,325,2.004,327,2.189,330,2.971,361,8.633,363,3.881,364,4.548,371,3.452,378,3.204,382,2.843,397,2.425,409,2.447,430,4.115,438,3.912,449,2.639,458,4.838,470,1.823,491,4.441,511,2.142,512,3.865,513,4.115,514,4.31,580,1.967,596,4.441,612,3.013,621,2.894,625,3.528,652,2.173,656,4.931,661,1.979,670,3.808,688,3.057,701,2.469,720,3.611,762,2.113,776,6.104,870,1.735,872,2.697,882,2.491,884,3.792,890,2.614,896,2.205,902,2.858,1012,4.837,1019,3.248,1104,3.452,1123,1.92,1133,2.697,1135,8.344,1138,5.747,1165,4.396,1210,2.345,1227,1.943,1243,6.074,1277,5.934,1299,2.405,1369,3.057,1442,3.204,1466,5.219,1497,2.405,1569,4.813,1591,3.927,1693,7.037,1719,4.488,1755,4.638,1759,3.013,1794,2.538,1795,4.443,1796,3.611,1797,4.443,1798,4.443,1799,4.443,1800,4.066,1801,4.443,1802,3.528,1803,4.443,1804,3.927,1805,4.443,1806,4.443,1807,6.23,1808,4.443,1809,3.704,1810,3.452,1811,5.141,1812,4.443,1813,4.066,1814,4.443,1815,4.443,1816,4.443,1817,4.443,1818,4.443,1819,4.066,1820,4.443,1821,4.638,1822,3.383,1823,3.704,1824,4.443,1825,6.839,1826,4.066,1827,4.443,1828,3.927,1829,3.704,1830,4.443,1831,6.23,1832,4.443,1833,4.443,1834,4.443,1835,4.443,1836,3.808,1837,4.066,1838,4.443,1839,4.443,1840,4.443,1841,2.823,1842,4.443,1843,4.443,1844,4.443,1845,3.808,1846,2.858]],["keywords/126",[]],["title/127",[1632,919.143]],["content/127",[11,4.372,15,6.612,16,4.343,29,5.274,45,2.534,56,2.872,60,3.889,76,5.026,80,4.315,95,2.885,106,3.577,115,5.156,124,7.576,145,6.574,157,3.492,169,4.315,178,5.597,181,6.509,182,4.232,188,4.803,209,4.432,211,6.579,245,5.658,287,6.721,301,6.837,363,4.841,364,4.867,371,7.242,385,5.852,406,5.226,580,4.127,649,7.061,652,6.526,657,7.988,669,3.056,682,10.887,701,5.178,872,5.658,884,6.772,926,6.32,967,6.39,1012,3.565,1216,12.714,1220,7.242,1227,4.076,1274,4.96,1283,6.721,1416,4.841,1773,6.721,1807,11.125,1811,6.412,1847,8.238,1848,7.988,1849,9.319,1850,8.238,1851,13.361,1852,15.587,1853,8.53,1854,9.319,1855,9.319,1856,9.319,1857,6.233,1858,8.53,1859,9.319,1860,7.576,1861,9.319,1862,8.238,1863,9.319]],["keywords/127",[]],["title/128",[116,491.885,363,442.97,776,379.955]],["content/128",[8,3.667,16,7.04,18,2.042,29,6.301,43,6.759,45,3.028,56,3.432,58,2.005,76,4.194,104,10.103,115,5.823,146,6.991,169,7.938,181,7.777,191,6.687,240,6.759,363,7.847,364,4.717,371,8.652,397,6.078,413,6.618,438,7.91,450,12.28,507,9.842,614,8.318,649,7.113,663,5.694,687,2.819,760,7.93,776,4.961,818,7.347,1133,9.171,1222,7.777,1243,9.051,1274,8.04,1326,8.478,1411,6.687,1831,9.283,1860,9.051,1862,9.842,1864,11.134,1865,15.106,1866,11.134]],["keywords/128",[]],["title/129",[890,608.874,1867,1199.175]],["content/129",[58,2.021,95,3.486,146,7.072,149,3.813,174,4.987,181,7.867,187,6.626,211,4.754,240,9.243,241,4.7,260,5.549,270,7.991,323,4.7,325,5.082,363,5.85,406,6.315,409,6.203,413,6.694,621,7.336,656,7.432,669,3.693,701,6.258,776,5.018,870,4.399,890,10.869,896,5.589,904,7.991,960,8.753,1012,7.778,1029,7.157,1131,5.284,1133,6.838,1535,8.577,1569,7.843,1625,8.577,1847,9.956,1868,17.246,1869,11.263,1870,11.263,1871,10.732,1872,9.39,1873,11.263,1874,11.263,1875,13.051,1876,9.956,1877,11.263]],["keywords/129",[]],["title/130",[708,608.874,905,665.681]],["content/130",[]],["keywords/130",[]],["title/131",[1034,826.325]],["content/131",[3,2.085,36,4.83,50,4.34,58,1.421,60,4.467,106,3.852,118,6.116,150,7.827,152,4.392,198,6.802,218,3.855,241,4.467,426,5.844,428,7.595,512,4.739,580,4.74,626,7.365,701,8.172,901,4.924,935,7.72,1012,4.095,1034,6.722,1035,10.806,1036,7.595,1138,8.741,1641,6.802,1643,7.159,1757,7.997,1762,8.319,1769,9.463,1841,6.802,1846,9.46,1878,10.705,1879,17.041,1880,12.261,1881,10.705,1882,8.925,1883,10.705,1884,8.925,1885,8.925,1886,8.925,1887,7.26,1888,8.925,1889,8.925]],["keywords/131",[]],["title/132",[1101,807.709]],["content/132",[3,2.167,11,6.308,18,2.434,50,3.078,58,1.784,76,5.064,106,2.393,197,6.249,211,5.675,258,5.196,337,9.25,382,5.116,512,3.793,669,5.606,677,10.447,1012,5.142,1027,7.039,1131,6.308,1223,11.524,1759,9.117,1794,7.68,1841,8.542,1890,13.443,1891,13.9,1892,11.884,1893,13.443,1894,11.884,1895,13.443]],["keywords/132",[]],["title/133",[1098,1045.084]],["content/133",[17,7.461,18,2.056,109,13.71,1012,6.604,1755,10.716]],["keywords/133",[]],["title/134",[701,731.242]],["content/134",[3,2.334,45,3.899,50,3.282,56,4.418,58,2.363,109,11.385,149,4.853,197,6.507,258,5.541,669,6.641,872,8.703,1012,5.484,1131,8.353,1180,9.221,1299,7.759,1583,10.582,1755,8.898,1896,14.336]],["keywords/134",[]],["title/135",[887,933.65]],["content/135",[11,7.89,176,9.795,197,6.146,258,6.5,669,5.513,1012,6.432,1567,11.097,1636,9.429]],["keywords/135",[]],["title/136",[209,625.858]],["content/136",[3,2.015,11,6.533,20,6.762,22,4.714,50,3.188,60,5.81,72,5.81,125,6.323,169,6.447,176,8.111,197,5.089,209,8.315,218,5.015,258,5.382,364,4.348,382,5.299,512,3.928,580,6.166,652,6.811,669,5.732,872,8.454,1012,7.667,1101,8.547,1217,8.547,1671,8.454,1897,13.925]],["keywords/136",[]],["title/137",[460,485.753]],["content/137",[]],["keywords/137",[]],["title/138",[50,236.931,460,382.009]],["content/138",[18,1.137,50,3.939,56,2.943,58,2.413,82,4.96,95,2.956,106,3.727,110,4.126,115,4.113,150,5.082,218,3.438,238,2.535,273,4.335,293,5.927,303,6.475,319,4.363,457,4.541,460,5.832,470,6.481,508,3.075,512,3.83,687,2.417,695,6.593,1068,4.883,1073,5.082,1093,8.733,1130,6.386,1227,4.176,1274,5.082,1398,6.067,1399,4.738,1439,5.618,1449,5.04,1467,6.301,1694,6.386,1821,8.427,1898,9.548,1899,13.576,1900,9.548,1901,9.548,1902,9.548,1903,13.576,1904,8.441,1905,9.548,1906,8.441,1907,9.548,1908,9.548,1909,9.548,1910,9.548,1911,9.548,1912,9.548,1913,9.548,1914,9.548,1915,9.548,1916,7.762,1917,9.548,1918,9.548,1919,9.548,1920,13.576,1921,9.548,1922,9.548,1923,13.576,1924,10.551,1925,9.548]],["keywords/138",[]],["title/139",[22,350.355,125,469.918]],["content/139",[3,1.972,50,3.918,58,2.271,864,10.503,958,6.254,1204,7.871]],["keywords/139",[]],["title/140",[115,313.524,614,773.156]],["content/140",[]],["keywords/140",[]],["title/141",[18,123.267,1926,914.868]],["content/141",[3,0.947,18,2.393,43,4.988,50,2.787,58,1.925,60,3.428,79,3.7,106,2.167,115,4.393,169,3.804,179,3.594,191,4.935,197,3.003,198,5.221,218,2.959,232,5.572,237,3.258,238,2.181,242,4.739,338,2.588,339,2.416,350,2.706,364,4.528,376,7.829,397,7.917,406,4.607,458,5.073,459,4.077,508,3.92,639,5.739,652,4.019,655,7.644,687,3.082,693,5.829,695,3.99,717,4.607,719,6.138,739,4.609,762,5.79,818,8.033,838,7.197,870,3.209,872,4.988,891,6.679,926,5.572,1022,7.829,1081,8.71,1082,4.373,1151,6.028,1173,6.679,1174,7.043,1217,5.043,1304,6.671,1370,6.028,1382,5.653,1514,9.434,1568,4.739,1575,6.028,1598,5.221,1703,4.202,1916,6.679,1927,4.834,1928,7.521,1929,7.521,1930,7.263,1931,7.263,1932,8.216,1933,6.85,1934,8.216,1935,8.216,1936,7.263,1937,7.521,1938,8.216,1939,12.174,1940,8.216,1941,8.216,1942,7.263,1943,7.263,1944,7.263,1945,8.216,1946,8.216,1947,8.216,1948,8.216,1949,8.216,1950,7.829,1951,8.216,1952,8.216]],["keywords/141",[]],["title/142",[18,123.267,240,628.279]],["content/142",[18,2.225,50,3.036,58,2.48,106,3.505,238,3.52,240,11.342,266,7.801,323,5.533,350,4.367,363,6.888,364,5.834,458,5.911,776,5.908,1703,6.781,1811,9.124,1828,11.722,1829,11.056,1936,11.722,1953,13.26,1954,10.531,1955,13.26,1956,13.26,1957,10.305,1958,10.779,1959,13.26,1960,13.26]],["keywords/142",[]],["title/143",[50,301.275]],["content/143",[18,2.083,50,4.319,58,2.321,76,3.26,97,6.726,106,3.835,107,4.645,115,2.622,118,4.945,157,3.244,169,4.007,218,4.555,238,3.968,241,3.612,285,5.638,350,2.851,364,3.95,458,4.002,614,6.466,642,7.216,687,2.191,717,4.853,762,4.116,799,6.242,814,5.5,818,5.712,907,9.45,1068,6.469,1073,6.732,1151,6.35,1227,3.786,1232,6.874,1313,7.419,1395,9.876,1398,8.038,1399,6.277,1480,5.5,1648,6.874,1703,4.426,1821,7.852,1927,7.442,1942,7.651,1944,7.651,1950,8.248,1957,6.726,1961,8.655,1962,12.649,1963,8.655,1964,5.255,1965,8.655,1966,8.655,1967,8.655,1968,8.655,1969,8.655,1970,8.655,1971,10.029,1972,8.655,1973,6.466,1974,8.655,1975,8.655,1976,7.216,1977,6.141,1978,8.655,1979,8.655,1980,8.655,1981,8.655,1982,8.655,1983,8.655,1984,8.655]],["keywords/143",[]],["title/144",[466,596.939,1127,682.927]],["content/144",[]],["keywords/144",[]],["title/145",[1985,1315.941]],["content/145",[3,1.677,45,3.957,57,7.619,58,1.931,146,9.137,169,6.737,180,8.833,259,9.032,260,4.371,305,5.624,330,9.731,417,10.323,461,10.323,508,4.686,652,7.117,654,5.214,887,10.323,1074,9.602,1178,12.473,1346,9.359,1415,6.106,1528,10.323,1607,11.828,1796,11.828,1986,10.011,1987,14.55]],["keywords/145",[]],["title/146",[339,387.005]],["content/146",[0,6.575,3,1.877,5,5.162,16,4.704,18,1.94,36,4.554,56,3.111,58,1.34,60,4.212,75,10.108,79,4.907,106,3.424,146,6.338,169,6.537,192,8.652,237,2.701,242,5.822,260,4.891,305,3.901,318,7.393,338,4.447,339,5.186,370,5.822,374,8.652,382,3.841,456,4.583,461,7.161,466,5.822,510,3.531,580,4.469,652,4.937,654,3.617,718,6.062,739,3.821,760,4.164,796,6.715,864,6.195,872,8.571,942,6.492,963,9.317,1082,5.372,1185,7.279,1227,4.415,1415,4.236,1467,6.661,1528,7.161,1568,5.822,1593,7.541,1598,6.414,1694,6.751,1988,8.415,1989,8.923,1990,8.923,1991,6.751,1992,12.481,1993,10.093,1994,10.093]],["keywords/146",[]],["title/147",[341,460.385]],["content/147",[3,1.373,16,3.719,18,2.015,52,6.841,56,2.46,58,1.059,60,3.33,79,2.036,106,3.793,115,4.318,169,3.695,188,4.113,193,5.071,197,2.917,228,6.779,237,4.23,238,3.784,260,5.329,325,3.601,327,3.931,328,5.337,338,4.49,339,2.347,341,4.987,345,5.133,413,4.743,426,4.357,459,5.912,460,2.946,461,8.452,466,4.603,476,3.931,477,6.841,479,6.202,480,4.213,481,6.487,482,6.654,508,3.836,510,2.792,512,2.251,652,3.903,654,2.86,660,3.053,661,5.308,663,6.092,666,6.841,687,4.654,693,5.662,739,3.021,796,3.795,857,5.574,870,4.653,880,4.179,1015,7.394,1027,4.179,1082,4.247,1185,5.755,1210,6.288,1274,4.247,1433,7.055,1466,5.574,1497,4.319,1575,5.855,1598,9.057,1637,6.202,1638,6.654,1694,7.967,1788,6.487,1933,9.932,1992,7.055,1995,7.98,1996,6.487,1997,7.98,1998,6.487,1999,7.055]],["keywords/147",[]],["title/148",[50,301.275]],["content/148",[3,1.163,5,5.162,18,1.94,45,2.745,50,4.249,56,3.111,58,2.34,72,4.212,79,4.155,95,3.124,106,3.586,110,4.362,115,3.058,191,6.062,197,3.689,211,4.26,238,2.68,245,6.128,273,4.583,325,4.554,327,6.955,338,3.179,364,6.005,416,4.833,459,5.009,461,7.161,508,5.244,652,4.937,662,8.016,669,3.309,687,3.574,715,4.937,1019,4.388,1068,5.162,1073,5.372,1395,9.78,1399,5.009,1404,8.016,1502,7.686,1514,8.307,1569,4.285,1964,6.128,2000,8.923,2001,8.205,2002,12.481,2003,8.923,2004,8.923,2005,8.923,2006,8.923,2007,9.239,2008,10.093,2009,10.093,2010,10.093,2011,10.093]],["keywords/148",[]],["title/149",[22,350.355,125,469.918]],["content/149",[3,1.905,20,8.027,58,2.194,60,6.897,218,5.953,510,5.783,580,7.319,654,5.924,896,8.203,1019,7.187]],["keywords/149",[]],["title/150",[79,335.762]],["content/150",[]],["keywords/150",[]],["title/151",[50,301.275]],["content/151",[50,4.375,56,4.292,57,7.291,58,2.32,106,3.751,238,3.697,337,9.581,458,4.406,799,10.043,1068,7.121,1073,7.411,1222,9.726,1299,7.537,1395,10.501,1398,8.848,1399,6.91,1964,8.454,2012,13.925,2013,13.925,2014,12.31,2015,13.925,2016,13.925,2017,13.925]],["keywords/151",[]],["title/152",[22,350.355,125,469.918]],["content/152",[76,6.502,449,6.098,967,8.267,1157,10.596,1597,9.68]],["keywords/152",[]],["title/153",[1101,807.709]],["content/153",[]],["keywords/153",[]],["title/154",[18,86.373,149,245.494,1323,460.781,1841,460.781]],["content/154",[3,1.518,16,6.138,18,2.419,29,7.454,58,1.748,95,4.077,106,3.004,115,3.99,149,5.713,197,4.813,208,7.385,323,5.496,451,9.498,509,7.597,512,3.715,580,5.832,660,5.038,669,4.318,677,10.235,718,7.91,762,8.026,870,5.145,1012,5.038,1101,8.084,1131,6.179,1186,7.828,1336,9.839,1584,10.981,1891,15.139,1892,11.643,2018,13.17]],["keywords/154",[]],["title/155",[22,350.355,125,469.918]],["content/155",[3,1.873,18,1.936,22,5.502,45,4.42,60,6.782,197,5.94,228,7.73,580,7.197,901,7.476,1301,13.932,1792,12.377,2019,16.253]],["keywords/155",[]],["title/156",[958,480.942]],["content/156",[]],["keywords/156",[]],["title/157",[50,236.931,958,378.226]],["content/157",[18,1.311,46,6.612,50,3.902,54,6.833,58,2.262,61,7.081,106,3.713,152,4.516,233,6.912,238,2.922,319,7.79,323,4.593,370,6.349,382,4.189,400,6.476,457,5.235,687,4.315,958,6.688,960,8.554,1204,7.84,1387,6.683,1395,9.003,1398,6.995,1399,5.462,1635,7.362,1702,8.948,1906,9.731,1927,6.476,1964,6.683,2020,11.232,2021,9.178,2022,11.008,2023,11.008,2024,11.008,2025,11.008,2026,11.008,2027,11.008,2028,11.008,2029,11.702,2030,11.008,2031,11.008,2032,11.702,2033,11.008,2034,11.702]],["keywords/157",[]],["title/158",[22,350.355,125,469.918]],["content/158",[12,7.685,18,2.334,22,5.693,115,5.094,655,10.559,864,10.321,1568,9.699]],["keywords/158",[]],["title/159",[449,365.537,1157,635.204]],["content/159",[]],["keywords/159",[]],["title/160",[50,301.275]],["content/160",[18,1.537,50,4.223,58,2.211,106,3.678,238,3.427,273,5.861,370,7.445,400,7.594,449,4.559,458,4.084,687,3.268,1068,6.601,1073,6.87,1332,10.493,1395,10.006,1398,8.202,1399,6.405,1860,10.493,1927,7.594,1977,9.158,2014,11.411,2020,7.923,2035,12.908,2036,12.908,2037,10.493,2038,12.908,2039,18.447,2040,12.908,2041,12.908,2042,11.065,2043,12.908,2044,12.908]],["keywords/160",[]],["title/161",[654,370.874,1082,550.801]],["content/161",[]],["keywords/161",[]],["title/162",[1415,552.266]],["content/162",[3,0.672,12,2.663,16,2.716,18,1.112,19,3.748,52,4.995,56,2.878,57,3.051,58,2.261,72,2.432,76,4.401,80,2.698,95,2.891,106,3.694,133,4.134,169,4.323,179,2.549,188,3.003,204,2.276,218,3.363,237,4.558,238,4.351,285,3.796,304,3.874,305,2.252,321,3.703,323,2.432,338,2.941,339,1.714,341,2.039,345,2.099,348,4.134,350,5.14,400,3.429,401,4.529,409,5.143,413,3.464,416,2.791,426,3.181,434,2.83,442,4.438,459,2.892,476,2.871,480,4.929,510,5.459,512,2.634,521,4.203,580,2.58,637,8.897,652,2.85,654,4.789,660,4.469,661,2.596,687,3.383,763,3.329,767,4.737,796,8.101,838,7.257,870,2.276,884,2.957,961,4.134,1019,2.534,1027,3.051,1065,2.534,1103,5.609,1164,4.438,1180,3.748,1227,2.549,1346,7.516,1385,3.952,1415,5.608,1497,3.154,1508,4.07,1525,3.617,1557,8.572,1723,3.703,1954,4.628,1986,4.01,1991,3.898,2045,5.827,2046,5.334,2047,6.851,2048,14.623,2049,8.255,2050,9.338,2051,9.338,2052,12.927,2053,5.334,2054,6.425,2055,5.827,2056,5.827,2057,9.338,2058,5.827,2059,5.827,2060,5.827,2061,9.338,2062,5.827,2063,5.827,2064,4.529,2065,8.255,2066,11.684,2067,9.338,2068,5.152,2069,5.827,2070,4.628,2071,4.737,2072,5.827,2073,5.827,2074,5.152,2075,4.628,2076,3.952,2077,5.827,2078,5.827,2079,5.827]],["keywords/162",[]],["title/163",[456,597.534]],["content/163",[3,1.265,12,5.014,18,0.853,53,6.821,56,3.382,58,2.351,60,2.987,72,4.578,76,2.696,80,3.314,94,5.684,95,2.216,99,6.821,106,3.404,110,3.093,116,4.129,152,2.936,179,3.131,204,6.3,218,2.578,228,3.404,237,4.002,238,2.913,260,5.111,304,5.535,305,5.157,321,4.548,325,4.95,338,2.255,339,3.227,345,2.578,350,2.357,370,4.129,385,6.889,400,4.211,405,6.136,408,6.821,409,3.942,412,4.604,434,3.476,456,8.043,508,3.533,510,5.232,512,3.095,580,4.858,652,3.501,654,2.565,660,2.738,687,1.812,739,2.71,796,5.218,838,5.444,858,6.821,859,5.684,876,4.662,882,4.014,884,3.632,896,3.552,1123,4.741,1173,5.819,1385,4.854,1415,6.768,1416,5.699,1424,6.327,1446,9.699,1452,5.819,1510,5.451,1525,4.443,1585,6.327,1698,5.819,1775,13.221,1788,5.819,1794,4.089,1999,6.327,2047,5.252,2071,5.819,2074,6.327,2080,6.327,2081,7.158,2082,7.158,2083,13.341,2084,7.158,2085,6.327,2086,7.158,2087,10.971,2088,7.158,2089,7.158,2090,7.158,2091,7.158,2092,6.551,2093,6.551,2094,6.327,2095,7.158,2096,7.158,2097,7.158,2098,7.158,2099,7.158,2100,7.158]],["keywords/163",[]],["title/164",[1416,683.567]],["content/164",[3,1.444,20,4.148,27,5.302,50,1.955,56,2.633,58,1.134,60,5.227,63,6.504,76,3.217,80,3.955,95,3.878,101,4.663,106,3.716,110,3.691,117,5.302,180,7.605,191,5.13,193,5.427,218,3.076,237,4.866,238,4.619,240,5.185,304,5.197,338,3.946,339,2.512,341,2.988,345,4.511,350,4.886,400,5.025,416,4.09,426,4.663,476,4.208,512,3.534,521,6.16,580,3.782,620,6.504,637,6.504,652,4.178,654,4.489,682,5.966,687,3.171,688,5.877,796,4.062,838,7.361,882,4.789,1416,4.437,1510,9.539,1525,5.302,1597,4.789,1632,5.966,1703,4.368,1723,5.427,1755,5.302,1792,6.504,1876,7.551,2047,9.191,2049,7.551,2052,15.38,2054,8.619,2064,6.638,2065,7.551,2068,7.551,2076,5.793,2101,7.551,2102,12.527,2103,12.527,2104,8.541,2105,7.551,2106,8.541,2107,8.541,2108,8.541,2109,8.541,2110,8.541,2111,8.541,2112,8.541]],["keywords/164",[]],["title/165",[510,362.059,1439,608.874]],["content/165",[15,9.408,58,1.76,106,3.017,188,6.834,232,8.993,237,5.269,304,7.033,305,5.125,339,4.985,470,5.44,488,8.231,508,4.27,510,6.536,512,3.741,520,7,884,6.729,901,6.099,963,8.75,1074,8.75,1227,5.8,1432,18.683,1439,7.801,1440,10.305,1480,8.426,1497,7.177,2047,9.729,2076,8.993,2113,12.636,2114,12.137]],["keywords/165",[]],["title/166",[22,350.355,125,469.918]],["content/166",[18,1.986,22,5.644,76,6.279,242,9.616,450,13.552,1105,12.232,1568,9.616,1792,12.695,1794,9.524]],["keywords/166",[]],["title/167",[50,301.275]],["content/167",[]],["keywords/167",[]],["title/168",[2020,807.709]],["content/168",[1,6.856,3,1.213,18,1.983,22,2.296,45,1.845,46,4.074,50,3.603,58,2.088,92,3.342,94,5.387,95,2.1,106,3.623,110,2.931,115,3.189,116,3.913,132,4.812,145,3.342,174,3.004,179,2.967,188,3.496,190,5.387,207,5.387,218,2.443,221,4.738,233,4.259,238,2.794,242,6.071,243,4.476,260,2.037,328,4.537,350,4.248,364,4.028,370,3.913,429,5.655,430,3.736,438,5.512,445,5.387,457,3.226,458,5.268,480,3.581,508,2.184,512,2.97,528,4.418,652,3.318,655,4.259,657,5.814,660,2.595,663,3.469,687,3.68,688,4.667,695,5.112,697,7.723,717,5.902,719,5.067,740,5.655,901,3.12,936,4.892,958,3.847,1068,3.469,1073,3.61,1165,3.991,1204,3.12,1284,4.31,1387,4.118,1394,5.996,1398,4.31,1399,5.223,1409,4.118,1416,3.523,1490,5.655,1491,4.476,1568,3.913,1569,2.88,1574,5.067,1601,5.655,1715,4.032,1796,5.514,1821,9.023,1973,5.067,2020,9.658,2075,5.387,2101,5.996,2115,6.783,2116,6.783,2117,12.898,2118,6.783,2119,6.783,2120,6.783,2121,10.526,2122,6.783,2123,6.783,2124,6.783,2125,6.783,2126,10.526,2127,6.783,2128,6.783,2129,6.783,2130,6.783,2131,6.783,2132,6.783,2133,6.131,2134,6.783,2135,6.783,2136,6.783,2137,6.209,2138,6.783,2139,6.783,2140,10.526,2141,6.783,2142,6.783,2143,5.271,2144,7.211,2145,6.783,2146,6.783]],["keywords/168",[]],["title/169",[22,350.355,125,469.918]],["content/169",[3,1.99,60,7.204,460,6.372,580,7.644,1597,9.68]],["keywords/169",[]],["title/170",[3,119.285,95,320.351]],["content/170",[]],["keywords/170",[]],["title/171",[22,350.355,125,469.918]],["content/171",[3,2.236,12,7.554,22,5.596,79,4.217,205,15.751,615,12.846,864,10.146,1469,12.587,1568,9.534]],["keywords/171",[]],["title/172",[683,706.254]],["content/172",[]],["keywords/172",[]],["title/173",[2147,1045.084]],["content/173",[3,1.834,5,8.136,17,5.199,18,1.433,31,10.822,46,7.225,56,3.708,58,1.596,76,5.993,85,8.158,92,5.926,116,6.939,149,4.072,200,11.463,208,6.745,209,5.721,650,8.277,683,10.18,762,7.567,884,6.105,887,12.648,896,7.895,1012,4.601,1019,5.23,1065,5.23,1081,7.225,1131,5.644,1203,8.277,1325,12.933,1326,14.445,1427,8.535,1702,9.779,2148,12.364,2149,12.029,2150,12.029,2151,10.634,2152,12.029]],["keywords/173",[]],["title/174",[3,98.292,669,279.603,683,457.672]],["content/174",[3,2.258,17,5.653,18,1.558,22,4.429,31,7.942,46,7.857,50,2.995,58,1.736,62,7.021,76,4.927,87,11.27,98,6.905,258,5.056,319,5.978,406,7.335,426,7.142,510,4.577,649,5.428,669,6.423,683,10.514,954,10.634,1065,5.687,1131,7.884,1232,10.389,1336,9.773,1359,8.872,2153,13.082,2154,13.082,2155,13.082]],["keywords/174",[]],["title/175",[3,83.583,36,327.181,149,245.494,870,283.258]],["content/175",[3,2.269,8,3.585,18,2.018,20,5.286,36,6.711,50,4.366,54,6.756,58,2.249,85,7.382,87,6.608,90,7.85,104,7.28,115,3.297,149,5.737,211,7.153,218,3.92,234,6.404,406,6.103,414,9.33,416,5.212,444,8.848,512,3.071,632,9.075,649,6.172,661,4.85,669,5.972,683,5.842,708,6.404,776,4.85,870,7.115,872,6.608,1031,10.372,1095,6.835,1097,8.289,1098,8.644,1104,8.459,1127,7.183,1219,9.075,1331,11.327,1567,7.183,1636,6.103,1693,6.756,1755,6.756,1773,7.85,2156,9.963]],["keywords/175",[]],["title/176",[22,350.355,125,469.918]],["content/176",[45,4.573,50,3.85,76,6.334,95,5.205,113,12.805,323,7.017,466,9.699,1976,14.02]],["keywords/176",[]],["title/177",[95,320.351,466,596.939]],["content/177",[]],["keywords/177",[]],["title/178",[218,372.686,662,821.883]],["content/178",[0,4.403,3,0.779,18,1.25,50,3.322,56,2.083,58,1.926,75,4.196,79,4.427,106,3.937,197,2.47,237,4.204,238,4.414,242,3.899,260,5.848,273,4.767,305,2.613,318,3.539,325,3.05,327,3.33,338,4.054,339,3.087,341,2.365,345,4.635,350,2.226,364,4.019,456,3.069,459,3.354,461,4.796,466,6.055,476,3.33,477,5.794,479,5.253,480,5.541,481,5.495,482,5.636,486,5.495,508,4.145,509,3.899,512,1.907,608,5.794,654,2.422,660,2.586,661,3.012,662,5.368,663,5.368,666,5.794,667,5.368,695,3.283,880,3.539,901,3.109,942,4.348,1015,6.516,1068,3.457,1073,3.598,1210,3.568,1227,2.957,1274,3.598,1395,8.715,1399,5.209,1415,2.837,1417,5.147,1514,3.977,1569,4.457,1593,5.05,1598,4.295,1964,4.104,1986,4.651,1988,5.636,1989,5.975,1990,5.975,1991,4.521,1998,5.495,2000,5.975,2001,5.495,2002,5.975,2003,11.377,2004,5.975,2005,5.975,2006,5.975,2157,6.759,2158,6.759,2159,6.759,2160,6.759,2161,10.497,2162,6.759,2163,6.759]],["keywords/178",[]],["title/179",[50,301.275]],["content/179",[3,1.798,8,5.138,50,4.602,106,3.337,211,7.914,234,9.179,649,6.473,669,5.115,762,7.42,1065,6.783,1097,11.88,1131,7.32,1221,12.682]],["keywords/179",[]],["title/180",[22,350.355,125,469.918]],["content/180",[3,1.938,22,5.693,27,10.438,552,9.261,902,10.816,1411,10.1,1568,9.699,2164,16.815]],["keywords/180",[]],["title/181",[434,502.581,1566,682.927]],["content/181",[]],["keywords/181",[]],["title/182",[45,357.876]],["content/182",[18,1.601,45,3.656,58,1.784,92,6.623,110,5.81,163,10.447,182,6.104,343,10.043,369,11.524,400,7.909,434,8.304,510,4.703,649,5.578,687,3.403,1165,7.909,1264,13.021,1416,6.983,1566,8.871,1606,9.39,1894,11.884,2165,15.56,2166,13.443,2167,13.443,2168,13.443,2169,13.443,2170,13.443,2171,13.443,2172,13.443,2173,11.884,2174,13.443,2175,13.443]],["keywords/182",[]],["title/183",[36,466.935,905,665.681]],["content/183",[106,4.029,434,8.646,1033,13.661,1034,9.002,1066,13.661,1098,11.385,1101,8.799,1566,9.46,2176,12.673,2177,12.673,2178,12.673]],["keywords/183",[]],["title/184",[460,382.009,958,378.226]],["content/184",[3,0.909,58,2.085,82,4.095,98,4.161,106,3.49,141,6.261,179,3.448,185,5.346,237,5.454,271,5.202,318,4.128,339,4.161,343,5.889,434,3.828,438,4.128,453,8.513,457,3.749,458,5.793,460,4.357,493,7.245,503,4.001,567,7.512,663,4.031,760,3.252,918,10.039,941,6.969,958,5.742,965,10.039,966,10.039,1019,3.427,1074,5.202,1165,9.244,1227,3.448,1264,10.775,1284,5.009,1377,6.126,1378,6.261,1449,4.161,1480,5.009,1586,10.382,2165,15.799,2173,6.969,2177,6.969,2178,6.969,2179,7.883,2180,9.842,2181,10.435,2182,7.216,2183,7.883,2184,6.969,2185,6.969,2186,6.969,2187,6.969,2188,6.969,2189,7.883,2190,7.883,2191,5.506,2192,5.135,2193,7.883,2194,7.883,2195,7.883,2196,7.883,2197,6.573,2198,5.889,2199,7.883,2200,7.883,2201,7.883,2202,7.883,2203,7.216,2204,7.883,2205,6.408,2206,6.261]],["keywords/184",[]],["title/185",[79,335.762]],["content/185",[4,3.054,12,3.182,14,3.895,18,0.487,20,1.985,56,1.26,57,2.14,58,1.599,62,2.194,79,1.043,106,3.812,119,5.148,179,1.788,180,2.482,182,1.856,198,2.597,233,5.712,237,4.504,238,4.082,258,1.58,305,1.58,318,2.14,319,3.182,330,2.734,331,2.772,338,1.288,339,1.202,341,2.436,342,5.583,345,4.722,350,2.293,392,3.323,397,2.232,406,3.905,434,1.985,436,1.799,456,5.954,457,1.944,458,6.245,480,2.158,493,4.274,508,1.316,510,2.436,520,2.158,597,3.177,600,2.9,654,1.465,687,3.32,695,1.985,699,2.405,867,3.895,880,3.646,901,3.203,904,2.9,926,2.772,942,2.629,949,2.697,958,1.494,1027,2.14,1061,2.629,1204,1.88,1227,1.788,1264,6.927,1310,2.43,1322,3.224,1329,3.408,1355,3.802,1369,2.812,1377,3.177,1422,3.113,1449,2.158,1477,2.948,1513,2.697,1587,2.567,1600,2.537,1643,2.734,1794,2.335,1846,2.629,1998,3.323,2133,8.153,2165,15.636,2176,3.613,2180,10.046,2181,6.156,2184,6.156,2185,6.156,2186,6.156,2187,6.156,2188,3.613,2207,4.088,2208,4.088,2209,4.088,2210,6.796,2211,6.963,2212,3.613,2213,8.041,2214,4.088,2215,4.088,2216,9.096,2217,4.088,2218,4.088,2219,4.088,2220,15.927,2221,4.088,2222,4.088,2223,12.049,2224,4.088,2225,4.088,2226,4.088,2227,6.963,2228,9.096,2229,4.088,2230,4.088,2231,6.963,2232,4.088,2233,4.088,2234,4.088,2235,9.096,2236,4.088,2237,4.088,2238,4.088,2239,4.088,2240,4.088,2241,4.088,2242,6.963,2243,4.088,2244,4.088,2245,4.088,2246,3.323,2247,3.408,2248,4.088,2249,4.088,2250,4.088,2251,3.741,2252,3.741,2253,4.088,2254,3.741,2255,3.741,2256,3.246,2257,3.408,2258,3.613,2259,3.741,2260,3.741,2261,4.088,2262,4.088,2263,6.963,2264,4.088,2265,4.088,2266,4.088,2267,4.088,2268,4.088,2269,6.963,2270,4.088,2271,3.613,2272,3.504,2273,4.088,2274,3.741,2275,4.088,2276,4.088,2277,3.613,2278,2.772,2279,4.088,2280,2.663]],["keywords/185",[]],["title/186",[3,98.292,58,113.175,79,217.583]],["content/186",[]],["keywords/186",[]],["title/187",[79,264.052,426,564.994]],["content/187",[3,1.922,58,2.213,79,4.975,85,11.306,370,9.616,615,12.956,2281,14.738,2282,13.552]],["keywords/187",[]],["title/188",[449,464.807]],["content/188",[3,1.708,58,1.967,79,5.228,82,8.777,396,8.092,416,7.096,449,5.234,508,6.48,679,10.314,1060,9.305,1106,9.439,1157,9.095,1161,7.341,1247,11.516,1346,6.962,1514,9.941,1655,12.046,1675,12.046,2021,9.024,2192,7.05,2278,10.05,2282,12.046,2283,14.818,2284,13.1,2285,14.818,2286,10.824,2287,9.907,2288,10.824,2289,14.818,2290,14.818,2291,10.824,2292,10.824,2293,10.824,2294,10.824]],["keywords/188",[]],["title/189",[434,639.068]],["content/189",[55,7.866,58,2.061,62,6.225,79,4.973,157,4.347,163,9.014,174,6.876,175,7.981,178,9.327,179,5.073,434,8.501,470,6.37,508,3.735,661,5.168,687,4.431,699,6.824,720,9.429,818,7.654,888,11.053,924,12.068,967,7.436,1019,5.043,1061,7.461,1074,7.654,1106,8.066,1370,8.51,1405,10.253,1421,9.429,1566,10.247,1636,6.504,1802,9.211,2165,11.825,2210,8.665,2213,10.253,2282,9.429,2295,8.229,2296,11.599,2297,13.727,2298,11.599,2299,11.599,2300,11.599,2301,11.599]],["keywords/189",[]],["title/190",[585,1022.656]],["content/190",[79,4.254,174,7.382,343,12.455,436,7.337,508,5.369,598,15.886,1606,11.644,2295,11.828,2302,11.001]],["keywords/190",[]],["title/191",[1627,682.927,2303,841.289]],["content/191",[]],["keywords/191",[]],["title/192",[1106,683.567]],["content/192",[]],["keywords/192",[]],["title/193",[157,387.826,416,495.593]],["content/193",[3,1.703,50,4.152,61,9.501,79,3.769,87,8.968,110,6.384,157,5.536,260,4.437,293,9.169,305,5.709,460,5.453,958,5.399,1027,7.734,1152,11.035,1204,6.794,2304,13.058,2305,14.771,2306,14.771,2307,14.771,2308,14.771,2309,14.771,2310,14.771,2311,14.771]],["keywords/193",[]],["title/194",[45,357.876]],["content/194",[45,4.048,79,3.798,110,6.433,115,5.52,149,5.039,174,6.591,182,6.759,470,7.475,508,4.793,660,5.694,661,6.632,663,9.318,687,4.613,739,5.635,1272,9.574,1369,10.241,2280,9.695,2312,14.884,2313,14.884]],["keywords/194",[]],["title/195",[79,264.052,739,391.804]],["content/195",[3,1.291,19,7.203,48,9.336,56,3.451,57,5.863,58,2.013,79,3.869,101,6.113,106,3.281,115,3.392,182,5.085,237,2.997,260,3.364,330,7.489,339,4.46,380,7.705,470,4.594,510,5.305,608,9.599,739,5.741,760,4.62,778,6.459,870,4.374,904,7.945,958,5.542,1027,5.863,1106,7.877,1204,5.151,1276,6.798,1304,6.976,1312,6.951,1346,7.203,1382,7.705,1411,6.726,1415,6.364,1449,5.911,1480,7.115,1497,6.061,1501,7.389,1587,9.523,1794,6.397,2148,8.702,2314,8.527,2315,15.201,2316,11.198,2317,11.198,2318,10.25,2319,11.198,2320,9.899,2321,10.25,2322,11.198]],["keywords/195",[]],["title/196",[79,264.052,1210,546.292]],["content/196",[3,0.837,43,4.41,50,1.663,58,0.964,62,3.899,72,4.63,79,2.831,98,3.835,106,3.639,110,3.14,115,4.079,149,2.459,152,2.98,182,5.039,197,2.655,198,4.616,218,2.616,237,4.345,238,1.929,241,4.63,260,2.182,293,4.509,325,5.007,327,5.467,328,4.859,338,2.288,339,3.96,341,3.882,345,2.616,357,5.532,364,2.268,397,3.966,458,3.511,459,3.605,460,4.97,470,7.532,476,3.579,488,4.509,499,6.34,503,6.833,654,2.603,660,6.547,687,3.408,717,4.074,718,4.363,739,4.201,762,3.455,918,7.873,958,2.655,965,7.873,966,7.873,1105,5.33,1106,5.764,1175,5.769,1210,3.835,1272,4.673,1382,4.998,1408,6.422,1440,10.463,1586,5.33,1617,6.422,1668,5.33,1694,4.859,1728,8.003,1786,5.427,1794,4.15,1924,8.624,2198,5.427,2281,6.422,2314,5.532,2315,9.81,2323,8.418,2324,7.265,2325,7.265,2326,7.265,2327,6.422,2328,10.945,2329,6.422,2330,7.265,2331,8.418,2332,8.418,2333,8.418,2334,7.265,2335,7.265,2336,7.265,2337,7.265,2338,8.418,2339,6.923,2340,7.265,2341,7.265,2342,6.649,2343,8.418,2344,7.265,2345,4.363,2346,6.923,2347,6.422,2348,8.418,2349,7.265,2350,6.422]],["keywords/196",[]],["title/197",[157,387.826,508,333.282]],["content/197",[12,5.1,18,0.872,19,4.708,56,2.256,58,1.795,72,3.054,79,1.868,106,3.799,107,3.928,115,3.381,118,4.182,149,3.778,152,3.003,237,4.049,238,3.591,260,2.199,325,3.302,338,2.306,341,2.561,345,2.636,348,7.918,350,4.455,356,9.305,397,3.996,413,4.35,454,5.813,457,3.481,458,4.28,460,4.993,470,6.207,487,5.813,488,4.543,499,4.182,503,5.664,508,4.356,510,3.904,552,4.031,572,6.975,652,5.459,654,2.623,661,3.261,663,5.707,678,4.263,687,4.124,695,5.42,739,2.771,760,3.02,901,3.367,1077,6.274,1106,3.802,1204,3.367,1217,4.492,1322,5.167,1514,4.306,1528,5.193,1547,5.95,1600,6.928,1703,3.743,1727,5.95,1728,9.755,1841,4.651,2070,5.813,2133,6.501,2198,5.468,2280,4.768,2314,5.574,2327,6.47,2328,5.95,2329,6.47,2351,7.319,2352,7.319,2353,7.319,2354,7.319,2355,7.319,2356,7.319,2357,7.319,2358,7.319,2359,7.319,2360,7.319,2361,5.574,2362,7.319,2363,7.319,2364,11.16,2365,7.319,2366,7.319,2367,6.47,2368,9.567,2369,7.319,2370,6.47,2371,7.319,2372,7.319,2373,7.319,2374,7.319,2375,11.16,2376,6.47,2377,7.319,2378,7.319]],["keywords/197",[]],["title/198",[50,301.275]],["content/198",[3,0.485,5,2.154,11,1.976,12,1.925,16,1.963,18,1.919,22,1.426,50,3.564,54,2.614,56,1.298,58,1.885,60,2.98,72,3.88,76,1.586,79,2.373,80,1.95,82,2.188,92,3.519,106,3.555,115,4.717,119,2.384,152,1.728,169,1.95,174,5.9,180,4.336,191,4.29,197,1.539,199,4.013,218,1.517,238,3.255,241,4.571,245,4.336,260,1.265,263,4.013,273,3.243,293,4.433,303,2.856,323,2.98,325,3.223,327,3.519,338,1.327,350,2.352,364,1.315,412,2.709,430,2.319,436,1.853,438,3.74,457,2.003,458,3.88,460,4.043,470,6.804,499,2.406,508,1.356,510,1.473,512,1.188,580,1.865,589,3.511,611,4.013,639,2.942,649,1.747,661,4.143,687,3.941,695,4.516,715,2.06,717,2.362,739,3.521,775,4.013,814,2.676,884,3.625,896,2.09,901,4.277,958,3.399,968,3.424,1019,1.831,1065,1.831,1068,2.154,1073,2.242,1077,3.61,1081,5.586,1082,2.242,1093,2.709,1106,4.831,1130,7.326,1156,5.336,1160,4.013,1204,1.937,1210,3.77,1217,2.585,1225,3.146,1227,4.068,1272,2.709,1274,3.801,1276,2.557,1299,2.28,1304,1.937,1368,5.672,1369,2.898,1382,2.898,1399,3.544,1445,2.942,1467,2.779,1569,6.343,1600,2.614,1625,3.207,1627,2.779,1628,3.723,1636,2.362,1668,3.09,1703,3.652,1728,8.843,1786,3.146,1793,9.498,1804,6.314,1821,4.433,1872,3.511,1904,3.723,1924,3.273,1926,3.723,1927,2.478,1964,2.557,2020,9.556,2246,3.424,2247,3.511,2277,3.723,2280,2.743,2297,3.723,2314,3.207,2328,5.806,2342,3.855,2361,3.207,2367,3.723,2370,3.723,2379,10.953,2380,7.142,2381,5.151,2382,3.723,2383,3.424,2384,4.212,2385,7.142,2386,7.142,2387,7.593,2388,7.142,2389,4.212,2390,4.989,2391,4.212,2392,7.142,2393,4.212,2394,3.511,2395,4.212,2396,4.212,2397,4.212,2398,4.212,2399,4.212,2400,4.212,2401,4.212,2402,4.212,2403,3.723,2404,3.855,2405,4.212,2406,3.723,2407,4.212,2408,4.212,2409,4.212,2410,3.723,2411,4.212,2412,4.212,2413,4.212,2414,4.212,2415,4.212,2416,3.855,2417,4.212,2418,4.212,2419,3.723,2420,3.511,2421,4.212,2422,4.212,2423,4.212,2424,4.212,2425,4.212,2426,4.212]],["keywords/198",[]],["title/199",[2427,1163.321]],["content/199",[18,2.212,50,3.515,58,2.038,76,5.783,79,3.918,85,10.413,364,4.795,382,5.843,678,8.944,739,5.813,776,6.841,1095,9.642,1103,9.222,1106,7.976,1175,12.194,2428,15.355,2429,15.355,2430,14.054]],["keywords/199",[]],["title/200",[22,350.355,125,469.918]],["content/200",[22,5.844,82,8.967,396,8.267,508,5.56,678,10.056]],["keywords/200",[]],["title/201",[157,387.826,416,495.593]],["content/201",[3,1.77,58,2.038,61,9.877,79,3.918,87,9.322,110,6.636,157,5.754,204,5.998,260,4.612,293,9.531,510,5.372,654,5.503,876,10.002,958,5.612,1152,11.471,1409,9.322,2304,13.574,2431,15.355,2432,15.355]],["keywords/201",[]],["title/202",[45,357.876]],["content/202",[65,9.323,79,3.605,95,4.373,157,5.294,202,12.489,305,5.461,382,5.376,449,4.99,509,8.149,512,3.985,513,7.781,654,5.063,772,10.758,778,8.149,796,6.719,900,11.779,914,13.462,957,13.462,1065,6.142,1103,8.485,1156,10.554,1284,8.977,1501,9.323,2191,9.867,2206,11.219,2433,14.127,2434,14.127,2435,14.127,2436,14.127,2437,14.127]],["keywords/202",[]],["title/203",[79,264.052,318,541.885]],["content/203",[3,1.329,7,5.521,56,3.554,58,2.475,80,5.338,106,3.107,128,9.613,145,5.68,160,7.326,204,6.817,237,3.086,241,4.811,260,3.463,305,4.457,339,3.391,396,5.521,436,6.807,456,7.925,458,3.648,473,8.459,510,4.034,512,4.363,513,6.35,514,6.651,516,8.614,518,7.82,519,11.155,551,10.987,870,4.504,944,8.78,967,5.521,1157,7.077,1415,4.839,1449,6.086,1465,8.96,1477,8.315,1480,7.326,1525,9.601,1587,7.24,1703,5.896,1713,8.459,2080,10.193,2438,8.78,2439,9.157,2440,8.78,2441,9.613,2442,9.884,2443,11.53]],["keywords/203",[]],["title/204",[778,759.051]],["content/204",[3,0.831,5,3.687,45,1.961,58,1.779,79,2.815,106,3.835,177,5.604,237,5.128,238,4.53,241,3.009,245,4.378,304,6.229,328,4.823,338,2.271,339,2.121,341,5.253,345,3.973,350,4.945,396,5.284,434,3.502,449,2.547,457,3.429,458,2.281,459,3.578,476,3.552,488,6.849,499,4.119,511,6.463,512,2.034,513,3.971,514,4.159,520,5.824,521,5.2,522,5.862,523,5.862,526,5.491,527,6.871,660,2.758,661,3.213,687,3.393,693,7.828,739,2.73,778,4.159,880,3.776,918,5.116,926,4.89,965,5.116,966,5.116,967,3.453,1123,7.375,1276,4.378,1310,4.286,1355,3.937,1467,4.758,1586,5.29,1598,4.582,1627,4.758,1669,7.515,1719,4.331,1723,4.582,1724,5.387,1725,5.604,1729,5.116,2064,5.604,2105,6.374,2133,4.2,2246,5.862,2303,5.862,2342,6.6,2345,4.331,2438,5.491,2444,7.211,2445,7.211,2446,7.211,2447,7.211,2448,4.961,2449,9.199,2450,6.012,2451,5.29,2452,5.604,2453,8.355,2454,8.355,2455,8.355,2456,8.355,2457,7.211,2458,7.211,2459,7.211,2460,7.211,2461,7.211,2462,11.034,2463,7.211,2464,7.211,2465,7.211,2466,7.211]],["keywords/204",[]],["title/205",[161,1097.182]],["content/205",[7,2.758,20,2.796,24,4.573,45,2.515,58,0.764,89,3.321,106,3.901,107,3.09,149,1.949,152,2.362,157,2.158,160,5.877,171,4.153,193,3.659,218,2.074,237,4.806,238,4.33,260,3.482,270,4.086,321,3.659,338,1.814,339,1.693,341,3.236,345,5.235,350,3.818,396,4.429,436,5.841,457,2.739,458,3.667,460,2.126,470,7.179,491,8.64,503,2.922,508,2.979,511,5.59,528,3.751,529,5.487,530,3.905,535,3.851,539,4.022,543,4.022,544,12.214,546,4.022,548,3.962,549,4.225,552,3.171,687,1.458,688,3.962,803,3.659,876,3.751,918,4.086,949,3.8,965,4.086,966,4.086,967,2.758,1123,8.667,1156,4.302,1355,6.328,1586,4.225,1710,3.851,2133,10.689,2197,4.801,2198,4.302,2438,4.385,2448,10.001,2451,4.225,2467,5.271,2468,5.758,2469,5.758,2470,4.801,2471,4.801,2472,4.475,2473,4.801,2474,4.801,2475,7.711,2476,5.758,2477,4.801,2478,4.801,2479,11.591,2480,5.271,2481,5.758,2482,4.801,2483,4.801,2484,4.801,2485,4.801,2486,5.758,2487,5.271,2488,9.249,2489,5.758,2490,5.758,2491,5.758,2492,5.758]],["keywords/205",[]],["title/206",[50,301.275]],["content/206",[18,1.341,50,3.118,58,0.982,106,3.96,145,4.724,149,3.247,160,2.791,164,3.223,233,6.022,237,1.175,238,3.615,260,2.223,273,5.11,293,2.726,319,2.007,323,1.833,331,7.633,350,1.447,364,1.372,396,6.016,436,4.22,449,3.387,460,1.621,470,5.587,491,8.612,493,5.886,499,2.509,510,1.537,512,2.088,513,4.076,514,6.492,520,2.319,544,8.76,660,1.68,661,3.297,717,2.463,732,5.092,758,3.571,778,2.534,803,2.791,814,2.791,838,2.18,958,3.505,967,6.938,1028,4.186,1068,2.246,1073,2.338,1093,6.169,1123,6.844,1204,3.404,1299,2.377,1322,3.426,1380,2.979,1399,2.18,1447,2.861,1569,5.782,1719,4.445,1793,9.109,1822,3.345,1850,3.883,1927,2.584,1958,3.571,1977,3.116,1996,3.571,2020,4.542,2257,3.662,2280,2.861,2361,3.345,2381,6.916,2383,3.571,2390,7.861,2438,3.345,2472,3.413,2493,3.883,2494,3.883,2495,3.883,2496,3.883,2497,3.662,2498,6.016,2499,6.016,2500,8.478,2501,5.877,2502,3.883,2503,3.883,2504,3.883,2505,3.345,2506,3.883,2507,10.213,2508,10.475,2509,7.796,2510,3.883,2511,3.883,2512,7.796,2513,3.883,2514,5.636,2515,3.883,2516,3.883,2517,9.949,2518,6.542,2519,3.883,2520,6.016,2521,3.883,2522,3.883,2523,3.883,2524,3.883,2525,4.392,2526,6.542,2527,9.949,2528,4.392,2529,11.106,2530,4.392,2531,4.392,2532,4.392,2533,4.392,2534,6.542,2535,6.542,2536,4.392,2537,7.401,2538,4.392,2539,4.02,2540,4.392,2541,4.392,2542,3.883,2543,4.02,2544,4.392,2545,3.883,2546,4.392]],["keywords/206",[]],["title/207",[22,350.355,125,469.918]],["content/207",[79,4.182,179,7.169,218,5.902,396,7.849,870,6.402,891,13.324,1106,8.514,1627,10.816,2278,11.116,2303,13.324,2547,16.39]],["keywords/207",[]],["title/208",[12,288.256,18,75.13,258,243.803,364,196.957,760,260.224]],["content/208",[]],["keywords/208",[]],["title/209",[18,156.743]],["content/209",[18,1.523,58,0.888,106,3.848,110,2.891,113,9.736,150,6.805,152,2.744,179,2.926,218,2.409,237,4.184,238,2.764,239,3.369,260,5.516,266,6.127,304,6.869,305,4.025,338,4.545,339,4.598,341,2.34,345,3.75,456,6.552,459,3.32,476,3.296,509,7.375,510,4.473,511,6.165,512,4.071,654,2.397,660,3.983,778,8.323,796,4.952,803,4.251,838,3.32,918,7.388,962,6.375,963,4.415,965,7.388,966,7.388,1061,4.303,1103,4.018,1210,3.531,1244,12.15,1385,7.062,1415,2.807,1432,6.69,1439,7.522,1447,4.358,1452,5.438,1470,11.561,1477,4.825,1501,4.415,1536,5.199,1553,6.066,1627,4.415,1715,3.976,2054,4.603,2076,4.537,2085,5.914,2094,11.302,2113,9.923,2548,6.69,2549,5.914,2550,6.69,2551,5.914,2552,9.205,2553,9.205,2554,6.69,2555,6.69,2556,10.413,2557,10.413,2558,6.69,2559,6.69,2560,6.69,2561,6.69,2562,6.69,2563,6.69,2564,6.69,2565,6.69,2566,5.914,2567,5.914]],["keywords/209",[]],["title/210",[18,123.267,364,323.151]],["content/210",[3,0.863,8,5.42,18,1.634,22,2.535,31,4.546,56,3.5,58,1.507,106,3.811,115,2.269,119,4.238,152,4.659,176,6.615,187,8.071,204,4.436,208,4.199,209,3.561,211,4.793,241,3.125,258,2.894,260,2.249,266,4.406,288,4.451,342,4.596,364,4.283,458,3.593,512,3.87,596,4.451,660,2.864,669,2.455,718,4.498,850,12.127,1002,12.349,1012,2.864,1123,4.908,1132,8.614,1133,6.894,1135,7.494,1137,14.457,1138,4.451,1140,8.484,1143,6.419,1144,5.595,1145,6.854,1553,4.362,1764,5.702,1793,5.008,2549,6.62,2568,10.394,2569,10.394,2570,6.854,2571,6.854,2572,6.854,2573,6.419,2574,6.854,2575,6.854,2576,6.854,2577,6.854,2578,7.488,2579,11.356,2580,9.468,2581,7.488,2582,7.488,2583,7.488,2584,7.488,2585,7.488,2586,7.488,2587,7.488,2588,7.488,2589,7.488,2590,7.488,2591,6.854,2592,7.488,2593,7.488,2594,7.488,2595,7.488,2596,7.488,2597,7.488]],["keywords/210",[]],["title/211",[654,370.874,1501,682.927]],["content/211",[12,4.342,18,1.132,56,2.928,58,1.261,62,5.099,101,5.187,106,3.056,107,9.214,150,5.057,152,6.464,204,6.154,241,3.965,260,2.854,303,6.444,305,3.672,382,3.616,412,10.135,453,6.852,456,6.143,654,6.153,686,8.697,699,7.96,719,7.098,760,3.92,778,5.48,793,8.145,794,7.546,796,6.434,799,6.852,838,6.714,906,8.145,1065,4.131,1387,10.423,1501,11.329,1535,11.998,1536,7.384,1540,8.399,1550,7.724,1553,5.534,1568,5.48,1671,5.768,1857,12.613,2552,8.399,2553,8.399,2566,8.399,2567,8.399,2598,13.529,2599,9.501,2600,15.677,2601,16.672,2602,15.677,2603,7.724,2604,8.399,2605,9.501,2606,9.501,2607,9.501,2608,8.399]],["keywords/211",[]],["title/212",[12,472.947,760,426.953]],["content/212",[11,1.571,12,5.773,18,0.399,58,1.037,69,3.191,106,3.939,107,4.195,113,8.119,118,1.913,152,3.849,188,6.91,191,2.011,204,5.931,211,1.413,237,1.568,238,3.354,239,1.686,241,1.397,260,4.935,273,4.841,278,5.585,303,2.271,304,3.892,305,4.534,319,1.53,331,6.362,332,5.024,339,1.724,350,3.863,361,2.55,385,2.103,412,5.028,451,2.415,456,4.841,499,1.913,511,2.826,512,3.564,520,1.768,669,1.098,695,1.626,699,10.623,702,2.87,732,7.336,750,2.96,760,1.381,767,6.354,778,6.765,793,2.87,794,2.659,796,5.071,799,2.415,803,2.128,838,4.655,870,1.308,906,2.87,917,5.585,918,4.158,940,2.96,965,4.158,975,2.415,1015,2.078,1065,2.548,1130,2.239,1134,5.839,1161,2.271,1244,9.817,1286,5.585,1340,7.822,1387,2.033,1503,2.339,1510,2.55,1513,2.21,1519,2.722,1550,4.765,1553,6.832,1558,2.602,1627,2.21,1710,8.967,1785,2.659,1811,2.304,1857,8.967,2054,4.033,2076,5.301,2143,2.602,2210,4.379,2212,2.96,2278,2.271,2394,4.887,2406,8.293,2551,2.96,2580,2.792,2601,10.369,2603,2.722,2604,2.96,2608,2.96,2609,3.065,2610,3.348,2611,3.348,2612,3.348,2613,3.065,2614,3.348,2615,3.348,2616,3.348,2617,3.348,2618,3.348,2619,3.348,2620,3.348,2621,5.861,2622,3.348,2623,9.381,2624,3.348,2625,7.816,2626,3.348,2627,5.861,2628,5.861,2629,5.861,2630,3.348,2631,3.348,2632,3.348,2633,3.348,2634,3.348,2635,3.348,2636,3.348,2637,3.348,2638,3.348,2639,3.88,2640,7.816,2641,5.861,2642,3.348,2643,3.348,2644,5.861,2645,3.348,2646,3.348,2647,3.348,2648,5.365,2649,2.602,2650,3.348,2651,7.154,2652,3.348,2653,5.861,2654,3.348,2655,5.861,2656,3.348,2657,3.88,2658,3.348,2659,3.348,2660,3.348,2661,3.348,2662,3.348,2663,3.348,2664,3.065,2665,3.348,2666,3.348,2667,3.348,2668,3.348,2669,3.348,2670,3.348,2671,3.348,2672,5.861,2673,3.348,2674,3.348,2675,5.861,2676,3.348,2677,3.348,2678,3.348,2679,2.792,2680,3.348,2681,3.348,2682,3.348,2683,3.065,2684,3.348,2685,3.348,2686,3.348,2687,3.348,2688,3.348,2689,3.348,2690,3.348,2691,3.348,2692,3.348,2693,3.348]],["keywords/212",[]],["title/213",[3,119.285,416,495.593]],["content/213",[]],["keywords/213",[]],["title/214",[22,350.355,125,469.918]],["content/214",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/214",[]],["title/215",[3,119.285,416,495.593]],["content/215",[]],["keywords/215",[]],["title/216",[22,350.355,125,469.918]],["content/216",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/216",[]],["title/217",[2302,868.391]],["content/217",[]],["keywords/217",[]],["title/218",[45,357.876]],["content/218",[18,1.858,48,13.008,79,3.981,92,7.686,319,7.13,600,11.069,649,6.473,687,3.949,739,5.906,760,8.292,1299,8.444,1606,10.897,2694,10.734,2695,15.601,2696,15.601]],["keywords/218",[]],["title/219",[460,382.009,958,378.226]],["content/219",[3,1.321,58,2.045,82,5.954,106,3.696,174,6.821,179,5.014,237,5.195,318,6.002,337,7.886,339,4.531,458,5.505,460,5.687,503,5.817,715,5.606,739,4.339,918,10.93,958,6.36,965,10.93,966,10.93,1380,7.773,1449,6.05,1480,7.283,1586,11.303,1924,8.907,2198,8.563,2346,10.922,2694,10.6,2697,15.405,2698,15.405,2699,11.462,2700,12.523,2701,11.462,2702,8.266,2703,11.462,2704,11.462]],["keywords/219",[]],["title/220",[79,264.052,318,541.885]],["content/220",[18,1.733,57,7.619,58,1.931,79,3.712,106,3.624,237,3.894,339,4.279,480,7.681,510,5.09,654,5.214,1027,7.619,1415,6.106,1587,9.137,1986,10.011,1991,9.731,2191,10.163,2302,9.602,2320,12.863,2694,12.363,2700,11.828,2702,10.494,2705,12.863]],["keywords/220",[]],["title/221",[319,472.947,600,734.248]],["content/221",[12,4.661,18,2.298,20,4.953,45,2.774,79,2.602,106,3.771,218,3.673,237,4.382,238,4.347,260,3.064,319,6.499,338,3.213,341,4.976,350,3.359,380,7.018,480,5.384,600,7.236,649,5.901,661,4.544,687,3.6,760,6.756,880,5.34,901,4.691,1061,6.56,1175,8.1,1217,6.26,1313,8.743,1415,4.28,1532,9.016,1600,6.331,1606,7.124,1846,6.56,2271,9.016,2302,6.73,2339,9.719,2350,9.016,2694,11.267,2702,7.356,2705,12.573,2706,10.199,2707,10.199,2708,10.199,2709,14.222,2710,10.199,2711,10.199,2712,10.199,2713,8.743,2714,10.199,2715,8.743,2716,10.199,2717,10.199,2718,10.199,2719,10.199]],["keywords/221",[]],["title/222",[1165,774.227]],["content/222",[18,1.415,43,7.214,79,3.032,106,3.809,141,9.437,174,6.988,237,4.223,238,4.189,341,4.157,345,5.683,687,3.008,718,9.478,760,7.31,762,5.651,949,7.841,958,4.343,992,9.437,1204,5.466,1322,5.501,1355,8.615,1625,9.048,2302,7.841,2694,12.191,2700,14.403,2702,8.57,2720,11.882,2721,10.504,2722,11.882,2723,11.882,2724,11.882,2725,10.504,2726,11.882,2727,11.882,2728,11.882,2729,11.882]],["keywords/222",[]],["title/223",[1186,615.129,2302,682.927]],["content/223",[18,2.05,19,5.353,50,3.345,57,4.357,58,2.284,63,6.337,76,3.135,79,3.136,80,3.853,106,3.874,115,3.723,152,5.042,198,5.288,218,2.997,237,4.606,238,4.569,260,3.691,273,3.779,323,3.472,338,3.871,339,2.447,341,2.911,345,5.262,350,2.741,485,7.617,486,9.99,508,2.68,687,2.107,715,4.07,760,3.433,814,5.288,838,4.13,942,5.353,1027,4.357,1068,4.256,1073,4.429,1093,5.353,1186,8.685,1191,6.337,1199,7.93,1201,7.617,1202,7.93,1385,5.644,1395,7.381,1398,5.288,1399,4.13,1415,3.492,1782,6.106,1964,5.052,2302,5.492,2694,5.726,2702,6.002,2721,7.357,2725,7.357,2730,8.322,2731,14.611,2732,8.322,2733,8.322,2734,8.322,2735,8.322,2736,8.322,2737,8.322,2738,8.322,2739,8.322,2740,8.322,2741,8.322,2742,8.322,2743,8.322,2744,8.322,2745,8.322,2746,11.248,2747,8.322]],["keywords/223",[]],["title/224",[3,119.285,416,495.593]],["content/224",[]],["keywords/224",[]],["title/225",[22,350.355,125,469.918]],["content/225",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/225",[]],["title/226",[552,469.66,654,305.605,1409,517.71]],["content/226",[]],["keywords/226",[]],["title/227",[552,469.66,1410,753.863,1411,512.201]],["content/227",[3,2.153,15,6.549,18,1.847,56,2.845,58,2.058,132,6.549,157,3.459,178,5.544,182,4.191,204,6.056,218,3.324,258,5.122,260,5.779,305,7.219,385,5.796,436,4.062,456,8.148,510,5.928,512,2.604,552,5.084,650,6.351,654,6.43,796,4.39,880,6.939,905,5.937,924,7.173,944,7.029,1019,4.013,1027,6.939,1081,5.544,1082,7.053,1227,4.038,1312,5.73,1409,5.604,1410,8.16,1411,9.312,1412,8.449,1413,9.231,1414,9.231,1415,7.839,1416,8.801,1417,10.092,1418,8.449,1419,10.092,1420,9.231,1421,10.773,1422,7.029,1423,7.173,1424,8.16,1425,9.231,1426,8.449,1427,6.549,1428,6.549]],["keywords/227",[]],["title/228",[552,469.66,654,305.605,1409,517.71]],["content/228",[]],["keywords/228",[]],["title/229",[950,949.064]],["content/229",[3,1.468,12,5.822,72,5.315,79,4.215,106,3.665,133,9.038,237,3.409,260,6.036,305,4.924,337,8.765,339,3.746,654,4.565,663,8.447,664,11.261,687,3.225,950,11.913,976,9.9,1019,5.538,1027,6.67,1127,8.406,1191,12.578,1411,7.651,1415,5.346,1429,10.621,1430,12.739,1431,11.66,1433,11.261,1434,12.739,1435,12.739,1558,9.9,2143,9.9,2748,13.542]],["keywords/229",[]],["title/230",[456,469.918,1409,628.279]],["content/230",[3,1.32,58,1.833,75,4.703,76,2.854,79,4.22,82,3.935,95,3.546,106,3.511,115,2.295,132,5.375,139,6.017,204,5.396,218,2.728,232,7.77,237,3.697,238,3.041,260,5.427,304,7.718,338,3.609,339,2.228,341,2.65,345,2.728,350,3.773,382,2.883,434,5.564,449,2.676,456,8.447,474,7.219,480,3.999,510,4.008,511,3.653,650,5.213,654,2.715,660,2.898,687,1.918,695,3.679,760,3.126,838,5.685,859,6.017,876,7.462,884,3.845,896,3.76,904,5.375,907,5.66,942,4.873,961,5.375,1027,3.967,1065,3.294,1227,3.314,1284,4.814,1299,4.101,1304,3.485,1409,4.599,1419,5.769,1421,6.159,1436,6.934,1437,6.934,1438,7.576,1439,4.457,1442,5.464,1443,7.576,1444,5.888,1445,5.292,1446,6.697,1447,4.935,1448,5.375,1449,3.999,1450,7.576,1451,6.697,1452,6.159,1453,7.576,1454,7.576,1455,6.697,1456,7.576,1457,7.576,1458,7.576,1459,7.576,1460,11.456,1461,11.456,1462,7.576,1463,7.576,1464,7.576,1465,5.888,1466,5.292,1467,4.999,1468,4.999,1469,5.769,1470,5.067,1471,7.576,1472,7.576,1473,7.576,1474,7.576,1475,6.317,1476,7.576,1477,5.464,1598,4.814,2749,5.213]],["keywords/230",[]],["title/231",[18,123.267,1478,914.868]],["content/231",[18,1.184,45,2.703,58,2.143,106,3.81,233,6.241,237,4.939,238,4.65,273,4.513,304,7.657,338,3.131,339,2.923,341,3.477,345,5.03,350,5.319,449,5.704,456,4.513,458,5.109,552,5.474,654,3.562,838,6.931,950,7.168,970,8.786,1123,4.295,1179,8.786,1186,5.907,1449,5.246,1451,8.786,1455,12.347,1478,14.275,1479,9.938,1480,6.315,1481,8.519,1482,9.938,1483,9.938,1484,9.938,1485,9.938,1486,9.938,1487,9.938,1488,9.938,1489,9.938,1490,14.604,1491,9.217,1492,13.967,1493,9.938,1494,9.938,1495,9.938]],["keywords/231",[]],["title/232",[853,965.506]],["content/232",[3,1.92,6,7.109,17,5.578,18,2.197,46,7.753,65,8.518,79,4.251,87,7.836,101,7.047,103,13.23,131,8.012,148,11.065,157,4.837,178,7.753,179,5.646,204,6.508,260,3.877,305,6.439,382,4.912,508,4.157,552,7.109,654,4.626,760,5.325,915,12.3,950,9.309,1027,6.759,1164,9.829,1191,9.829,1409,7.836,1444,10.031,1465,10.031,1496,12.908,1497,6.987,1498,12.908,1499,12.908,1500,9.829]],["keywords/232",[]],["title/233",[1304,605.3]],["content/233",[]],["keywords/233",[]],["title/234",[1054,744.754]],["content/234",[16,6.781,17,6.288,18,2.14,29,8.235,56,4.485,60,6.071,87,8.833,110,6.288,215,10.163,285,9.478,324,7.875,449,5.139,459,7.22,577,13.318,687,3.683,1054,8.235,1157,8.931,1304,8.265,1348,17.968,1349,13.318,1350,14.55,1351,11.307,1352,9.868]],["keywords/234",[]],["title/235",[95,407.35]],["content/235",[106,3.879,215,8.15,237,3.123,238,3.098,243,7.7,260,3.505,285,7.601,319,5.332,345,4.202,449,4.121,457,7.415,458,4.933,511,5.627,687,2.954,760,4.814,890,6.865,958,4.264,1054,6.604,1123,7.588,1204,5.367,1298,9.485,1322,5.402,1352,7.913,1353,10.68,1354,10.68,1355,6.37,1356,9.729,1357,14.27,1358,9.068,1359,7.913,1360,10.68,1361,11.668,1362,9.267,1363,10.68,1364,10.68,1365,10.68,1366,8.028,1367,11.668,1368,9.267,1369,8.028,1370,8.561,1371,10.68]],["keywords/235",[]],["title/236",[1369,712.065,1372,1034.893]],["content/236",[3,1.44,6,6.881,17,5.399,18,1.943,58,1.658,74,11.905,80,5.784,115,5.501,134,10.416,145,6.155,173,8.138,181,8.726,182,7.406,251,9.514,319,5.709,441,11.044,597,9.709,600,8.864,649,5.183,661,5.566,687,4.597,760,5.154,818,8.244,876,8.138,880,6.542,890,7.35,949,8.244,1276,7.585,1304,5.747,1373,16.31,1374,16.31,1375,12.493,1376,11.435,1377,9.709,1378,9.922,1379,11.435,1380,8.473,1381,12.493,1382,8.596,1383,10.156]],["keywords/236",[]],["title/237",[95,407.35]],["content/237",[18,1.268,50,3.354,58,1.944,106,3.954,152,6.01,188,5.487,237,3.921,238,4.447,273,4.834,288,6.328,338,4.615,339,3.131,341,5.126,345,5.276,350,3.506,697,10.749,809,10.145,814,6.765,838,5.283,1068,5.444,1073,5.666,1186,6.328,1383,8.654,1384,16.751,1385,7.22,1386,10.646,1387,6.463,1388,10.646,1389,10.646,1390,10.646,1391,10.646,1392,10.646,1393,10.646,1394,9.411,1395,8.8,1396,8.876,1397,10.646,1398,6.765,1399,5.283,1400,10.646,1401,10.646,1402,10.646]],["keywords/237",[]],["title/238",[1304,476.025,1403,1034.893]],["content/238",[72,5.769,106,3.745,110,5.975,180,8.394,238,4.621,324,7.483,382,5.261,459,6.861,687,3.5,890,8.134,944,10.528,1054,7.825,1161,11.804,1304,8.762,1352,11.804,1382,9.513,1383,11.239,1404,10.98,1405,12.222,1406,13.826,1407,14.149,1408,12.222]],["keywords/238",[]],["title/239",[18,101.574,258,329.615,1323,541.872]],["content/239",[]],["keywords/239",[]],["title/240",[18,101.574,258,329.615,1323,541.872]],["content/240",[3,1.97,18,2.185,22,3.748,58,1.997,62,5.941,143,11.459,176,6.448,197,4.046,209,7.157,258,7.09,378,7.984,380,7.617,409,6.097,416,5.301,512,4.823,656,7.305,669,4.934,682,7.732,701,6.152,708,8.853,714,9.23,763,6.324,819,8.603,887,7.854,1012,6.539,1065,4.813,1130,7.404,1131,7.06,1232,8.792,1323,7.034,1324,9.786,1325,8.999,1326,13.968,1327,9.786,1328,11.07,1329,9.23,1330,9.786,1331,8.43,1332,8.999,1333,13.302,1334,11.07,1335,11.07,1336,8.271,1337,9.786,1338,11.07,1339,8.999]],["keywords/240",[]],["title/241",[18,123.267,703,821.883]],["content/241",[3,1.508,5,6.69,8,4.309,31,10.201,58,2.23,62,7.021,98,6.905,197,4.781,208,7.335,209,10.03,578,10.389,625,13.345,649,5.428,669,4.289,703,10.389,857,9.137,935,12.119,1012,7.101,1187,12.466,1223,11.214,1254,11.214,1339,15.091,1340,10.907,1341,14.855,1342,11.564,1343,11.974]],["keywords/241",[]],["title/242",[50,195.235,211,359.958,1323,541.872]],["content/242",[3,1.756,8,5.018,50,4.555,56,5.696,58,2.453,191,9.15,211,7.801,669,4.995,776,8.234,1065,6.623,1095,9.566,1131,7.148,1323,9.68,1345,13.467]],["keywords/242",[]],["title/243",[1029,657.601,1346,665.681]],["content/243",[8,4.089,36,5.601,50,3.718,58,2.156,157,6.087,209,7.725,211,5.24,218,4.47,258,6.278,323,5.18,625,9.858,660,4.748,669,5.325,701,6.898,714,10.35,776,5.531,820,12.134,887,8.807,935,8.953,966,8.807,1065,5.397,1095,7.795,1131,5.824,1254,10.641,1324,10.974,1325,10.091,1326,13.786,1327,10.974,1331,9.453,1332,10.091,1333,10.974,1337,10.974,1339,15.611,1341,10.974,1342,10.974,1345,10.974,1347,12.413]],["keywords/243",[]],["title/244",[1716,1002.099]],["content/244",[]],["keywords/244",[]],["title/245",[45,357.876]],["content/245",[65,10.549,79,4.854,149,5.412,396,7.655,470,8.332,663,8.175,1669,8.964,2750,15.986,2751,15.986,2752,15.986,2753,15.986]],["keywords/245",[]],["title/246",[79,264.052,318,541.885]],["content/246",[56,4.172,58,2.504,60,5.649,76,5.099,79,4.813,106,3.057,115,4.101,218,4.875,237,3.623,318,7.088,338,4.264,339,3.981,396,8.225,397,7.39,654,4.851,739,6.502,1106,8.921,1174,11.604,1449,7.146,1500,10.309,1711,11.967,1712,11.967,1716,13.079,1717,10.52,1718,11.967,2754,11.967,2755,13.537]],["keywords/246",[]],["title/247",[1706,892.464]],["content/247",[16,2.955,19,4.078,29,3.588,56,3.078,58,1.325,61,4.078,79,1.618,106,3.845,237,5.203,238,5.161,241,2.646,304,5.814,324,3.432,338,1.997,341,2.218,345,5.83,350,5.58,364,1.98,378,4.573,385,3.981,396,3.036,406,3.555,430,3.492,457,3.016,458,3.908,459,3.146,470,5.067,476,3.124,487,5.035,491,7.342,511,6.757,512,1.789,513,5.499,514,5.76,520,5.271,526,4.828,528,4.13,530,4.3,539,4.429,543,4.429,544,7.945,546,4.429,661,2.825,1106,5.187,1123,7.586,1217,3.892,1222,4.429,1274,3.375,1297,5.287,1355,3.462,1480,4.029,1547,5.154,1566,4.184,1668,4.652,1669,3.555,1706,4.3,1713,4.652,1716,4.828,1719,5.998,1720,5.605,1721,5.605,1723,4.029,1724,4.737,1725,4.927,1727,5.154,1728,4.573,1729,4.499,1731,5.605,2133,10.519,2258,5.605,2441,5.287,2448,9.642,2754,5.605,2756,6.341,2757,6.341,2758,6.341,2759,6.341,2760,6.341,2761,6.341,2762,6.341,2763,6.341,2764,6.341,2765,5.435,2766,6.341,2767,6.341,2768,6.341,2769,5.804,2770,6.341,2771,6.341,2772,5.804,2773,6.341,2774,6.341,2775,6.341,2776,6.341,2777,6.341]],["keywords/247",[]],["title/248",[2427,1163.321]],["content/248",[3,1.677,17,6.288,18,1.733,19,9.359,36,6.565,50,3.331,56,4.485,65,9.602,78,11.555,79,3.712,139,11.555,155,12.131,157,5.453,221,10.163,416,6.968,618,13.865,635,12.863,718,8.739,949,9.602,1469,11.08,1521,11.307,1887,9.868,2278,9.868,2778,14.55,2779,14.55,2780,13.318]],["keywords/248",[]],["title/249",[716,862.854,820,773.156]],["content/249",[]],["keywords/249",[]],["title/250",[58,113.175,820,637.091,896,423.18]],["content/250",[3,1.904,22,4.313,36,5.748,50,2.916,56,3.926,58,1.691,76,4.798,106,3.577,157,6.869,178,9.921,258,6.385,323,5.315,385,7.999,397,6.955,819,9.9,820,14.49,901,7.598,936,9.187,1019,5.538,1035,10.625,1138,7.572,1323,8.095,1561,12.739,1562,16.518,1563,11.66,1564,12.739,1565,12.739,1566,8.406,1567,8.406,1568,7.348]],["keywords/250",[]],["title/251",[654,370.874,1501,682.927]],["content/251",[]],["keywords/251",[]],["title/252",[8,280.871,581,677.243,1502,649.387]],["content/252",[3,1.269,8,3.626,11,5.165,12,5.031,16,5.13,17,4.757,18,1.311,95,3.407,106,2.668,110,4.757,115,3.335,178,6.612,197,4.023,204,7.148,231,9.178,232,7.465,237,2.946,238,3.979,260,5.12,304,4.567,305,6.588,350,3.626,512,4.229,578,8.742,580,4.874,627,7.688,649,4.567,654,3.945,699,6.476,732,10.314,760,4.541,772,8.382,796,8.703,1203,7.574,1466,7.688,1502,8.382,1503,11.905,1504,11.008,1505,9.731,1506,11.008,1507,10.076,1508,7.688,1509,9.731,1510,8.382,1511,9.731,1512,9.731,1513,7.264,1514,6.476,1515,11.008,1516,11.008,1517,11.008,1518,11.008,1519,8.948]],["keywords/252",[]],["title/253",[3,119.285,581,821.883]],["content/253",[3,1.549,34,13.433,45,2.559,54,5.841,79,4.361,95,4.159,106,3.043,145,4.635,179,5.877,204,6.121,237,3.596,260,4.036,304,3.904,305,5.193,318,7.035,322,7.312,324,7.272,338,4.232,339,4.609,382,3.581,401,7.312,430,5.182,449,6.385,458,2.977,509,5.427,510,3.292,512,3.79,518,6.381,519,6.786,615,7.312,654,6.478,687,2.382,739,3.562,763,5.376,902,6.052,905,6.052,931,8.966,963,8.866,1060,5.908,1074,6.209,1103,5.652,1185,6.786,1203,6.474,1310,5.593,1422,7.165,1445,6.572,1468,6.209,1501,8.866,1503,6.572,1520,9.409,1521,7.312,1522,9.409,1523,9.409,1524,9.409,1525,5.841,1526,9.409,1527,9.409,1528,6.676,1529,13.853,1530,11.877,1531,13.436,1532,8.318,1533,9.409]],["keywords/253",[]],["title/254",[197,378.226,204,404.25]],["content/254",[0,5.819,34,7.658,58,1.186,79,4.52,95,4.712,106,3.681,107,6.947,132,9.183,145,6.377,152,6.244,188,4.604,204,7.442,270,6.338,322,6.943,339,2.627,343,6.674,406,5.01,412,11.395,449,4.572,451,12.036,508,2.877,509,5.153,512,3.652,520,4.716,661,3.98,697,9.497,699,5.256,717,5.01,718,5.366,794,7.095,801,8.513,902,5.746,912,6.555,960,6.943,961,6.338,1060,5.61,1103,5.366,1217,5.483,1387,5.424,1422,6.803,1466,6.24,1468,5.895,1509,7.898,1511,7.898,1512,7.898,1529,7.898,1530,7.898,1534,8.934,1535,11.591,1536,6.943,1537,8.934,1538,8.934,1539,6.943,1540,7.898,1544,8.934,1546,8.934,1547,7.262,1548,8.934,1549,8.934,1550,7.262,1551,8.934,1552,8.934,1553,5.204,1554,8.934,1555,8.934,1556,7.898,2781,9.497,2782,9.497,2783,9.497,2784,9.497]],["keywords/254",[]],["title/255",[260,310.858,1557,759.301]],["content/255",[58,2.087,182,7.141,251,11.976,260,4.724,266,9.253,305,6.079,510,5.502,654,5.636,699,9.253,1227,6.879,1469,11.976,1557,13.822,1558,12.222,1559,14.395,1560,15.727]],["keywords/255",[]],["title/256",[1706,892.464]],["content/256",[]],["keywords/256",[]],["title/257",[1707,1204.507]],["content/257",[3,1.55,18,1.601,19,8.647,58,2.269,75,8.345,79,5.049,101,7.339,157,5.038,400,7.909,426,7.339,436,5.916,508,4.329,642,11.209,687,4.76,907,10.043,1019,5.845,1416,6.983,1637,10.447,1694,12.576,1706,13.857,1708,17.099,1709,14.256,1710,8.991]],["keywords/257",[]],["title/258",[45,281.443,95,320.351]],["content/258",[3,0.871,17,1.947,18,1.643,54,2.796,58,1.831,60,1.88,61,2.897,79,3.52,81,4.123,95,3.023,101,2.459,106,3.72,110,1.947,157,1.688,179,1.97,181,3.146,188,2.321,193,2.862,218,1.622,237,3.692,238,5.15,243,4.988,258,1.741,262,4.292,304,5.724,324,2.438,338,3.603,339,2.223,341,2.644,345,6.115,350,5.268,364,2.36,382,2.876,385,2.828,396,5.477,458,6.137,470,4.692,476,3.724,487,6.003,491,6.798,493,2.765,509,2.598,511,8.382,512,2.132,513,6.299,514,6.597,520,5.155,526,3.43,528,4.924,530,5.126,539,3.146,543,3.146,544,4.862,546,3.146,580,1.994,652,2.203,687,3.492,762,2.142,905,2.897,936,3.248,1065,1.958,1103,2.705,1106,5.941,1123,6.648,1164,3.43,1312,4.692,1318,4.292,1355,4.127,1411,4.54,1445,3.146,1521,3.5,1566,2.972,1636,2.526,1669,2.526,1694,3.013,1706,9.356,1709,3.755,1711,6.682,1712,6.682,1713,5.546,1715,4.493,1716,7.437,1717,5.874,1718,6.682,1719,6.869,1720,6.682,1721,6.682,1722,7.559,1723,2.862,1724,3.365,1725,3.5,1726,7.559,1727,3.662,1728,3.248,1729,5.363,1730,7.559,1731,6.682,1732,4.123,1733,7.559,1734,4.504,1735,4.504,1736,4.504,1737,4.504,1738,4.504,1739,7.559,1740,9.767,1741,7.559,1742,4.504,1743,4.504,1744,4.504,1745,4.504,1746,4.504,1747,4.504,1748,4.504,1749,4.504,1750,3.861,1751,4.504,1752,4.504,1753,4.504]],["keywords/258",[]],["title/259",[1428,605.03,2785,517.71,2786,649.387]],["content/259",[]],["keywords/259",[]],["title/260",[152,424.56,2147,821.883]],["content/260",[]],["keywords/260",[]],["title/261",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/261",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/261",[]],["title/262",[2789,780.553,2790,615.019,2791,677.243]],["content/262",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2786,12.481,2790,11.821,2791,13.017]],["keywords/262",[]],["title/263",[62,457.672,107,457.672,2785,517.71]],["content/263",[]],["keywords/263",[]],["title/264",[701,402.951,708,426.638,762,344.879,2792,663.743]],["content/264",[3,1.864,17,5.331,18,1.469,36,8.643,58,2.147,115,3.737,117,7.656,149,5.476,171,8.896,223,7.185,239,6.212,258,4.768,323,5.147,324,6.676,512,4.563,701,8.988,708,11.27,715,6.033,762,5.866,870,4.818,1012,7.327,1015,7.656,1225,9.215,1703,6.308,1758,11.867,2679,10.284,2793,12.335,2794,12.335,2795,9.586,2796,11.29,2797,16.174,2798,13.865,2799,11.29]],["keywords/264",[]],["title/265",[1034,535.481,1322,394.828,2800,711.003]],["content/265",[3,1.992,50,3.957,106,3.792,118,5.509,143,7.343,150,5.132,152,3.956,157,5.953,182,4.378,228,6.502,235,8.266,258,3.727,271,6.363,428,6.841,438,5.049,512,4.481,626,6.635,638,9.189,701,8.827,703,7.658,901,4.435,935,6.954,1012,5.23,1034,8.585,1035,10.217,1036,6.841,1138,8.126,1156,7.204,1221,7.839,1284,6.127,1299,5.219,1636,5.407,1641,6.127,1643,6.449,1756,8.524,1757,7.204,1841,6.127,1846,8.794,1880,13.244,1882,8.04,1884,8.04,1885,8.04,1886,8.04,1887,6.54,1888,8.04,1889,8.04,2347,8.524,2785,5.854,2786,7.343,2801,9.643,2802,7.204,2803,9.643,2804,9.643,2805,9.643,2806,9.643,2807,6.954,2808,13.672,2809,9.643,2810,9.643]],["keywords/265",[]],["title/266",[1101,523.417,1322,394.828,2800,711.003]],["content/266",[3,1.813,18,1.873,98,8.302,106,2.8,438,8.235,512,4.437,669,5.157,948,13.903,1012,6.016,1101,9.653,1891,12.785,2795,12.222,2807,11.343,2811,14.395,2812,15.727,2813,15.727]],["keywords/266",[]],["title/267",[17,313.386,18,86.373,1322,335.742,2814,725.149]],["content/267",[11,1.797,16,1.785,17,1.655,18,1.508,20,7.537,55,4.466,56,2.03,58,2.183,79,3.457,98,3.476,106,3.618,115,3.511,116,2.209,131,2.377,145,1.887,149,2.933,150,2.038,157,1.435,160,4.185,161,3.193,182,1.739,185,2.597,204,2.573,237,4.003,238,4.12,241,1.598,253,3.386,259,2.377,260,2.602,318,5.386,330,2.562,332,8.818,339,3.025,350,4.926,396,3.154,416,1.834,430,3.627,434,1.86,436,2.898,438,5.386,449,1.353,456,2.99,458,3.667,459,4.299,460,3.198,464,6.028,465,3.65,470,1.571,473,2.81,488,4.088,499,2.188,503,1.944,510,3.031,511,3.176,512,1.858,518,4.466,519,2.762,520,2.022,528,2.495,548,2.635,549,2.81,656,2.527,687,2.193,695,1.86,715,3.221,717,2.148,732,2.635,778,2.209,818,5.717,873,3.386,882,2.148,893,3.65,905,4.236,918,2.717,949,2.527,958,3.166,965,2.717,966,2.717,967,4.926,968,3.113,976,9.007,1002,2.405,1012,1.465,1015,4.088,1035,2.464,1081,3.956,1106,1.989,1123,4.446,1127,2.527,1203,2.635,1204,1.762,1210,2.022,1274,2.038,1284,2.434,1304,3.029,1311,2.861,1322,6.274,1346,2.464,1366,4.531,1440,2.976,1445,2.675,1448,2.717,1449,3.476,1470,2.562,1477,2.762,1503,2.675,1514,2.253,1519,3.113,1539,2.976,1558,5.118,1586,2.81,1587,5.44,1632,2.675,1694,4.405,1710,2.562,1717,2.976,1759,2.597,1924,2.976,1930,3.386,1931,3.386,1943,3.386,1957,2.976,2133,2.231,2143,5.118,2151,3.386,2197,3.193,2198,2.861,2284,3.386,2345,2.3,2376,3.386,2451,2.81,2452,2.976,2603,3.113,2795,6.733,2802,7.685,2807,7.419,2815,3.386,2816,3.83,2817,6.586,2818,3.83,2819,3.83,2820,3.83,2821,3.83,2822,3.83,2823,3.83,2824,3.83,2825,3.83,2826,3.83,2827,3.83,2828,3.83,2829,3.83,2830,3.83,2831,3.83,2832,3.83,2833,3.83,2834,3.83,2835,3.042,2836,3.042,2837,3.042,2838,3.042,2839,3.042,2840,3.042,2841,3.042,2842,3.042,2843,3.83,2844,3.83,2845,3.283,2846,3.83,2847,3.83,2848,3.83,2849,6.586,2850,3.83,2851,3.83,2852,3.83,2853,3.83,2854,3.83,2855,3.83,2856,3.83,2857,3.83,2858,3.83,2859,6.586,2860,3.83,2861,6.586,2862,3.83,2863,6.586,2864,3.83,2865,6.028,2866,3.83,2867,6.586,2868,3.83,2869,3.83,2870,6.586,2871,3.83,2872,3.83,2873,3.83,2874,3.83,2875,3.83,2876,3.83,2877,3.83,2878,3.83,2879,3.83,2880,3.83,2881,3.83,2882,3.83,2883,6.586,2884,3.83,2885,3.83,2886,3.83,2887,3.83,2888,3.83,2889,3.83,2890,3.83,2891,3.83,2892,3.83,2893,3.83,2894,3.83,2895,3.283]],["keywords/267",[]],["title/268",[50,195.235,1322,394.828,2896,852.766]],["content/268",[5,2.668,11,2.448,16,2.432,17,2.255,18,1.865,20,4.146,46,3.134,50,3.162,55,7.35,56,2.632,58,2.413,82,2.71,98,2.754,106,3.648,115,2.587,149,2.891,157,1.955,193,3.315,238,1.385,242,3.01,245,5.183,259,3.239,260,1.567,273,2.369,285,3.399,293,8.574,319,2.384,325,2.354,327,4.206,364,3.91,396,5.19,426,2.848,436,2.296,438,6.557,442,6.502,470,3.503,491,5.075,508,2.75,510,1.825,512,1.472,513,2.874,514,4.925,544,5.492,687,2.743,695,2.534,715,5.301,717,2.926,762,2.481,796,2.481,882,2.926,890,3.07,896,2.589,958,4.577,1002,8.674,1015,3.239,1035,3.356,1082,2.777,1093,5.492,1106,2.71,1123,4.684,1204,3.927,1210,6.611,1272,5.492,1322,3.953,1395,5.128,1399,6.854,1442,3.763,1497,2.824,1514,3.07,1535,6.502,1539,4.055,1569,5.317,1574,3.898,1635,3.49,1694,5.711,1703,2.668,1719,3.134,1793,3.49,1821,6.727,1822,6.502,1916,6.941,1927,5.023,1964,5.183,1996,4.241,2001,4.241,2020,9.609,2071,4.241,2280,5.562,2361,3.973,2381,3.763,2382,4.612,2390,3.644,2403,4.612,2410,4.612,2419,4.612,2420,4.35,2498,4.241,2499,4.241,2507,6.941,2508,7.119,2509,4.241,2512,4.241,2520,4.241,2526,4.612,2527,4.612,2529,7.548,2534,4.612,2535,4.612,2542,4.612,2545,4.612,2802,8.096,2807,7.816,2815,4.612,2897,5.217,2898,5.217,2899,5.217,2900,5.217,2901,8.538,2902,5.217,2903,5.217,2904,5.217,2905,5.217,2906,4.612,2907,8.538,2908,5.217,2909,8.538,2910,5.217,2911,5.217,2912,5.217,2913,5.217,2914,5.217,2915,5.217,2916,5.217,2917,5.217,2918,5.217,2919,5.217,2920,5.217,2921,5.217,2922,5.217,2923,5.217,2924,5.217,2925,5.217]],["keywords/268",[]],["title/269",[45,231.913,95,263.974,118,487.186]],["content/269",[3,0.334,11,1.358,17,1.251,18,1.155,50,2.219,58,1.741,95,0.896,106,3.952,145,4.164,149,1.745,160,3.275,173,1.886,182,1.314,233,3.236,237,4.636,238,4.134,260,2.093,273,2.34,304,2.89,331,5.733,338,0.912,339,2.049,341,1.803,345,4.477,348,2.054,350,2.784,364,0.904,396,5.146,436,3.72,449,1.022,456,1.314,457,2.451,458,3.685,460,2.572,470,5.381,473,2.124,488,3.199,491,7.797,493,4.276,499,4.829,503,1.469,511,3.36,512,2.385,513,4.656,514,6.198,516,2.163,518,1.963,519,3.717,520,2.721,521,2.088,522,2.353,523,2.353,530,1.963,535,3.447,539,2.022,543,2.022,544,9.764,546,2.022,548,1.992,549,2.124,660,1.107,661,2.296,687,0.733,732,3.546,758,2.353,778,1.67,803,1.839,814,1.839,838,1.436,918,3.657,958,3.089,965,3.657,966,3.657,967,5.578,975,2.088,1068,3.563,1073,1.541,1093,1.862,1123,8.475,1204,2.371,1210,1.528,1322,2.386,1355,4.615,1362,2.299,1380,1.963,1399,1.436,1415,1.215,1447,3.357,1449,2.721,1525,3.199,1569,3.589,1586,3.782,1587,1.818,1713,2.124,1715,1.721,1719,6.454,1723,1.839,1729,2.054,1793,5.654,1822,3.925,1823,2.413,1927,1.703,1958,4.19,1977,2.054,2020,3.164,2133,8.589,2197,2.413,2198,2.163,2381,2.088,2383,2.353,2390,3.6,2439,2.299,2440,2.204,2448,8.015,2449,2.413,2450,2.413,2451,6.202,2452,4.005,2470,2.413,2471,2.413,2472,2.25,2473,2.413,2474,2.413,2475,4.297,2477,4.297,2478,2.413,2482,2.413,2483,2.413,2484,2.413,2485,2.413,2493,2.559,2494,2.559,2495,2.559,2496,2.559,2497,2.413,2498,4.19,2499,4.19,2500,4.556,2501,4.093,2502,2.559,2503,2.559,2504,2.559,2505,2.204,2506,2.559,2507,4.19,2508,4.297,2509,4.19,2510,2.559,2511,2.559,2512,2.353,2513,2.559,2514,2.204,2515,2.559,2516,2.559,2517,4.556,2518,2.559,2519,2.559,2520,2.353,2521,2.559,2522,2.559,2523,2.559,2524,2.559,2785,1.757,2786,2.204,2807,2.088,2835,2.299,2836,2.299,2837,2.299,2838,2.299,2839,2.299,2840,2.299,2841,2.299,2842,2.299,2906,2.559,2926,2.65,2927,2.65,2928,2.65,2929,2.65,2930,2.65,2931,2.65,2932,2.481,2933,2.895,2934,2.481,2935,2.65,2936,5.154,2937,2.65,2938,2.65,2939,2.65,2940,2.65,2941,2.895,2942,2.65,2943,2.895,2944,2.895]],["keywords/269",[]],["title/270",[1857,692.162,2945,947.258]],["content/270",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/270",[]],["title/271",[1081,621.593,1151,759.301]],["content/271",[2952,16.234,2953,16.234]],["keywords/271",[]],["title/272",[1693,816.841]],["content/272",[]],["keywords/272",[]],["title/273",[1632,919.143]],["content/273",[3,2.193,45,4.347,50,3.66,80,7.401,211,8.03,416,7.655,669,5.241,776,7.123,901,7.353,1095,10.038,1227,6.992,1693,9.923]],["keywords/273",[]],["title/274",[1695,1315.941]],["content/274",[18,2.287,50,3.718,56,3.826,75,7.705,92,6.115,169,7.52,179,5.43,211,5.24,239,6.252,337,11.175,364,3.876,458,3.927,563,11.829,637,9.453,639,8.67,663,6.348,687,3.142,723,10.091,760,7.922,776,5.531,924,9.647,926,8.419,942,7.985,1075,11.175,1157,7.619,1180,7.985,1416,6.448,1569,5.27,1693,12.691,1696,12.413,1697,10.974,1698,10.091,1699,12.413,1700,12.413]],["keywords/274",[]],["title/275",[649,545.984]],["content/275",[18,2.299,45,3.87,115,4.311,176,8.289,178,8.547,223,8.289,237,3.808,303,9.651,338,4.483,364,4.444,417,10.097,458,4.502,649,5.904,687,3.602,763,8.13,776,6.341,1075,9.791,1274,9.432,1304,6.546,1310,10.534,1416,7.392,1567,9.391,1693,11.001,1701,14.231]],["keywords/275",[]],["title/276",[363,683.567]],["content/276",[]],["keywords/276",[]],["title/277",[1793,880.134]],["content/277",[3,0.492,5,2.182,8,1.405,11,2.002,18,1.79,20,2.072,22,1.445,27,2.649,45,1.16,50,3.272,55,2.894,56,3.405,57,2.234,58,2.266,60,1.78,72,1.78,95,3.42,98,2.252,104,2.854,106,3.864,110,1.844,115,2.844,116,2.461,117,2.649,145,3.558,146,2.679,157,1.599,169,1.976,174,4.892,187,4.249,204,5.869,218,2.601,223,2.485,228,2.029,238,1.133,239,4.729,240,5.7,242,2.461,259,2.649,260,2.82,266,4.249,271,2.816,273,3.279,305,1.649,323,1.78,325,1.925,327,2.102,330,2.854,361,8.412,363,3.751,364,4.462,365,3.316,371,3.316,378,3.077,382,2.748,397,2.33,409,2.35,430,3.977,438,3.781,449,3.316,458,4.754,470,1.751,491,4.293,511,2.058,512,3.785,513,3.977,514,4.166,580,1.889,596,4.293,612,2.894,621,2.779,625,3.389,652,2.087,656,4.766,660,1.632,661,1.901,670,3.658,688,2.936,701,2.371,720,3.469,762,2.029,776,5.977,870,1.667,872,2.59,882,2.393,884,4.765,890,2.51,896,2.117,902,2.745,1012,4.726,1019,4.082,1104,3.316,1123,1.844,1133,4.384,1135,8.153,1138,5.581,1165,4.249,1210,2.252,1227,1.866,1243,5.871,1277,5.735,1299,2.31,1369,2.936,1442,3.077,1466,5.044,1497,2.31,1569,4.69,1591,3.772,1693,6.857,1719,4.338,1755,4.483,1759,2.894,1794,2.438,1795,4.267,1796,3.469,1797,4.267,1798,4.267,1799,4.267,1800,3.906,1801,4.267,1802,3.389,1803,4.267,1804,3.772,1805,4.267,1806,4.267,1807,6.021,1808,4.267,1809,3.558,1810,3.316,1811,4.969,1812,4.267,1813,3.906,1814,4.267,1815,4.267,1816,4.267,1817,4.267,1818,4.267,1819,3.906,1820,4.267,1821,4.483,1822,3.249,1823,3.558,1824,4.267,1825,6.61,1826,3.906,1827,4.267,1828,3.772,1829,3.558,1830,4.267,1831,6.021,1832,4.267,1833,4.267,1834,4.267,1835,4.267,1836,3.658,1837,3.906,1838,4.267,1839,4.267,1840,4.267,1841,2.711,1842,4.267,1843,4.267,1844,4.267,1845,3.658,1846,2.745,1871,4.066,2954,8.368,2955,4.944,2956,4.944,2957,4.267,2958,4.944]],["keywords/277",[]],["title/278",[1632,919.143]],["content/278",[11,4.372,15,6.612,16,4.343,29,5.274,45,2.534,56,2.872,60,3.889,76,5.026,80,4.315,95,2.885,106,3.577,115,5.156,124,7.576,145,6.574,157,3.492,169,4.315,178,5.597,181,6.509,182,4.232,188,4.803,209,4.432,211,6.579,245,5.658,287,6.721,301,6.837,363,4.841,364,4.867,371,7.242,385,5.852,406,5.226,580,4.127,649,7.061,652,6.526,657,7.988,669,3.056,682,10.887,701,5.178,872,5.658,884,6.772,926,6.32,967,6.39,1012,3.565,1216,12.714,1220,7.242,1227,4.076,1274,4.96,1283,6.721,1416,4.841,1773,6.721,1807,11.125,1811,6.412,1847,8.238,1848,7.988,1849,9.319,1850,8.238,1851,13.361,1852,15.587,1853,8.53,1854,9.319,1855,9.319,1856,9.319,1857,6.233,1858,8.53,1859,9.319,1860,7.576,1861,9.319,1862,8.238,1863,9.319]],["keywords/278",[]],["title/279",[116,491.885,363,442.97,776,379.955]],["content/279",[8,3.667,16,7.04,18,2.042,29,6.301,43,6.759,45,3.028,56,3.432,58,2.005,76,4.194,104,10.103,115,5.823,146,6.991,169,7.938,181,7.777,191,6.687,240,6.759,363,7.847,364,4.717,371,8.652,397,6.078,413,6.618,438,7.91,450,12.28,507,9.842,614,8.318,649,7.113,663,5.694,687,2.819,760,7.93,776,4.961,818,7.347,1133,9.171,1222,7.777,1243,9.051,1274,8.04,1326,8.478,1411,6.687,1831,9.283,1860,9.051,1862,9.842,1864,11.134,1865,15.106,1866,11.134]],["keywords/279",[]],["title/280",[656,682.927,890,608.874]],["content/280",[58,2.021,95,3.486,146,7.072,149,3.813,174,4.987,181,7.867,187,6.626,211,4.754,240,9.243,241,4.7,260,5.549,270,7.991,323,4.7,325,5.082,363,5.85,406,6.315,409,6.203,413,6.694,621,7.336,656,7.432,669,3.693,701,6.258,776,5.018,870,4.399,890,10.869,896,5.589,904,7.991,960,8.753,1012,7.778,1029,7.157,1131,5.284,1133,6.838,1535,8.577,1569,7.843,1625,8.577,1847,9.956,1848,9.655,1868,17.246,1869,11.263,1870,11.263,1871,10.732,1872,9.39,1873,11.263,1874,11.263,1876,9.956,1877,11.263]],["keywords/280",[]],["title/281",[8,433.424]],["content/281",[]],["keywords/281",[]],["title/282",[18,123.267,1569,439.386]],["content/282",[3,1.828,8,5.222,60,6.616,131,9.842,157,5.942,218,5.71,430,8.732,508,5.106,580,7.021,776,8.435,1157,9.732,1301,13.591,1570,15.855,1571,15.855]],["keywords/282",[]],["title/283",[958,480.942]],["content/283",[3,1.856,7,4.735,8,5.756,18,1.918,58,1.847,61,6.36,79,2.523,82,8.365,106,2.477,150,5.263,170,8.741,204,3.862,241,4.126,251,7.53,305,6.224,321,6.283,339,2.908,397,5.398,413,5.877,508,3.184,621,6.441,654,3.544,683,5.307,739,3.744,760,4.079,763,7.951,796,4.703,864,6.069,870,3.862,884,5.018,896,4.907,951,9.422,958,7.762,1061,6.36,1075,6.803,1204,6.401,1220,7.684,1299,5.352,1321,8.741,1440,7.684,1503,9.72,1514,5.818,1568,5.703,1572,9.888,1573,9.051,1574,7.387,1575,7.255,1576,8.741,1577,8.741,1578,9.051,1579,9.888,1580,9.888,1581,9.888,1582,13.917,1583,8.272,1584,8.244,1585,8.741,1587,6.209,2345,5.939]],["keywords/283",[]],["title/284",[1054,744.754]],["content/284",[3,1.983,8,3.145,12,4.363,18,2.407,27,5.927,58,1.267,72,3.984,80,4.421,115,4.113,126,7.005,132,6.774,146,5.996,164,7.005,174,7.619,180,5.797,192,8.185,204,3.73,239,6.838,241,6.592,245,5.797,297,9.098,305,3.691,326,8.185,327,4.704,370,5.507,436,4.202,669,5.18,687,2.417,695,4.637,702,8.185,715,4.67,763,7.756,870,5.303,884,4.845,967,8.705,1029,6.067,1054,5.404,1123,4.126,1130,6.386,1276,5.797,1356,7.961,1380,6.475,1577,8.441,1588,13.576,1589,16.427,1590,8.739,1591,8.441,1592,8.441,1593,7.133,1594,8.441,1595,9.548,1596,9.548,1597,5.354,1598,6.067,1599,8.739,1600,5.927,1601,7.961,1602,8.441,1603,7.005,1604,9.548,1605,9.548]],["keywords/284",[]],["title/285",[1600,816.841]],["content/285",[3,1.77,8,5.057,18,1.829,115,4.652,216,11.932,369,13.162,649,6.371,651,14.054,739,5.813,762,7.303,889,14.632,1396,12.802,1606,10.725,1607,12.482,1608,15.355,1609,15.355,1610,15.355,1611,15.355,1612,15.355]],["keywords/285",[]],["title/286",[655,826.325]],["content/286",[6,6.504,8,3.89,12,5.397,18,2.104,31,7.17,60,6.558,115,5.705,145,7.743,228,5.617,241,4.928,245,7.17,305,6.075,319,7.183,323,4.928,373,6.879,451,11.335,458,5.589,620,8.993,626,8.126,677,9.178,687,3.979,763,6.747,870,4.613,1054,6.684,1217,7.249,1227,5.166,1355,6.448,1589,12.776,1592,10.44,1613,11.81,1614,11.81,1615,11.81,1616,11.81,1617,10.44,1618,15.717,1619,10.124,1620,11.81,1621,15.717,1622,12.776,1623,9.178]],["keywords/286",[]],["title/287",[50,236.931,1569,439.386]],["content/287",[8,3.987,15,8.588,18,1.442,50,4.648,72,5.051,80,5.604,133,8.588,174,7.074,182,5.496,209,5.757,260,3.636,363,6.288,364,3.78,365,9.407,436,5.327,457,5.757,460,4.468,578,9.613,639,8.454,649,7.419,655,7.601,656,7.988,660,4.63,663,6.19,717,6.787,880,6.338,901,5.568,1123,5.231,1127,7.988,1227,6.988,1423,9.407,1429,10.092,1569,6.783,1594,10.7,1603,8.881,1624,12.104,1625,9.217,1626,12.104,1627,7.988,1628,10.7,1629,11.079,1630,12.104,1631,12.104]],["keywords/287",[]],["title/288",[1632,919.143]],["content/288",[3,2.24,8,6.688,50,4.095,197,5.278,209,6.869,211,7.55,234,10.523,258,5.582,323,6.026,325,6.516,406,10.029,512,4.074,669,5.864,776,6.435,1012,5.524,1095,9.069,1633,14.442]],["keywords/288",[]],["title/289",[8,238.838,18,86.373,364,226.432,596,431.021]],["content/289",[8,5.707,18,1.635,31,8.334,54,8.521,58,2.3,75,8.521,101,7.495,110,5.933,119,7.769,169,6.356,179,6.005,218,4.944,228,6.529,241,5.728,363,9.001,364,4.287,621,11.287,715,6.715,884,6.967,936,9.901,1019,5.969,1065,5.969,1132,8.62,1497,7.431,1634,13.728,1635,9.182,1636,7.698,1637,10.669,1638,11.446,1639,13.728]],["keywords/289",[]],["title/290",[209,492.192,327,509.83]],["content/290",[3,1.812,18,2.336,50,2.704,98,6.234,116,6.812,149,3.998,204,6.139,271,7.793,304,4.9,321,7.504,325,7.97,326,10.124,327,8.702,364,4.908,397,6.448,459,5.861,480,8.296,510,6.18,612,8.01,621,7.693,660,4.518,669,3.872,763,6.747,872,7.17,1060,7.416,1130,7.899,1132,7.416,1323,7.504,1370,8.665,1553,6.879,1569,5.014,1597,6.622,1640,15.717,1641,7.504,1642,11.81,1643,10.512,1644,11.81,1645,10.81,1646,11.81,1647,11.81,1648,9.379]],["keywords/290",[]],["title/291",[95,263.974,364,266.281,1186,506.875]],["content/291",[8,5.598,18,1.304,45,2.977,50,2.506,56,4.602,58,1.453,106,3.709,110,4.73,176,6.376,187,8.785,204,4.276,216,8.506,231,9.126,260,4.485,325,6.737,327,7.356,364,4.663,382,4.165,458,3.463,459,5.432,512,3.088,652,5.354,660,4.187,661,4.877,678,6.376,1002,11.464,1060,6.873,1081,6.574,1123,4.73,1132,9.376,1133,6.645,1134,8.177,1135,7.223,1137,13.556,1138,6.506,1140,8.177,1143,9.383,1144,8.177,1186,6.506,1427,7.766,1649,8.898,1650,10.946,1651,10.946,1652,10.946,1653,10.946,1654,10.946]],["keywords/291",[]],["title/292",[95,263.974,364,266.281,1655,693.233]],["content/292",[0,8.403,3,1.75,8,5,18,2.106,20,4.319,45,2.418,50,2.036,56,2.741,58,1.18,76,3.35,79,3.292,80,4.117,82,4.619,85,6.031,106,3.638,174,3.938,176,5.18,187,5.232,204,5.93,208,4.987,209,4.229,214,7.062,234,5.232,239,4.479,258,3.437,288,5.286,364,4.74,370,5.13,382,3.384,449,4.557,458,2.814,470,3.648,508,2.864,512,3.639,669,2.916,708,7.59,719,6.644,904,6.309,1002,11.58,1012,3.402,1123,3.843,1132,5.584,1133,5.399,1134,6.644,1135,5.868,1137,13.498,1138,5.286,1140,6.644,1144,6.644,1553,5.18,1641,5.651,1649,7.229,1655,10.487,1656,8.893,1657,8.893,1658,8.893,1659,8.893,1660,8.893,1661,7.861,1662,8.893,1663,8.893,1664,7.861,1665,8.893,1666,8.893,1667,8.893,1668,6.525,1669,4.987,1670,7.415,1671,5.399,1672,8.14,1673,8.893,1674,7.861]],["keywords/292",[]],["title/293",[95,263.974,364,266.281,1675,693.233]],["content/293",[3,1.255,8,5.581,18,1.772,45,2.96,50,2.492,72,4.542,76,4.1,79,2.777,106,3.747,174,4.82,176,6.34,187,6.404,204,4.252,208,6.103,228,5.177,234,6.404,258,4.207,288,6.47,364,4.645,382,4.142,449,3.845,453,7.85,458,3.444,470,4.465,512,3.071,669,3.569,730,10.372,882,6.103,1002,11.437,1123,4.704,1132,6.835,1133,6.608,1134,8.132,1135,7.183,1137,13.53,1138,6.47,1140,8.132,1144,8.132,1145,9.963,1284,6.916,1636,6.103,1649,8.848,1661,9.622,1664,9.622,1669,6.103,1670,9.075,1671,6.608,1675,8.848,1676,10.884,1677,10.884,1678,10.884]],["keywords/293",[]],["title/294",[18,101.574,215,595.63,373,496.727]],["content/294",[3,2.109,18,2.18,45,2.994,56,3.393,58,1.461,115,5.544,117,6.833,119,9.647,139,8.742,149,3.727,174,4.874,182,4.998,197,4.023,228,5.235,239,5.544,258,4.255,323,4.593,327,5.423,342,10.462,373,9.928,424,9.731,444,8.948,449,3.888,453,7.939,509,6.349,610,10.489,649,4.567,655,6.912,715,5.384,739,4.167,762,5.235,763,6.289,870,4.3,1019,4.786,1029,9.525,1054,8.483,1137,7.81,1157,6.756,1227,4.815,1300,8.742,1423,11.649,1576,9.731,1597,6.172,1602,15.068,1603,8.076,1679,11.008,1680,8.948,1681,11.008,1682,11.008]],["keywords/294",[]],["title/295",[58,137.346,1680,841.289]],["content/295",[8,4.807,18,1.261,56,3.263,58,1.937,76,3.988,95,3.278,115,3.208,119,8.26,178,6.36,188,7.522,228,5.036,239,5.333,258,5.642,259,6.572,260,3.18,266,6.229,304,4.393,323,7.512,325,4.777,327,8.869,342,8.959,373,6.167,430,5.831,434,5.142,436,4.66,442,8.063,499,6.049,510,6.607,512,2.987,663,5.415,678,6.167,699,8.587,876,6.897,1065,4.603,1123,4.576,1132,6.649,1178,9.076,1346,6.811,1491,9.632,1553,6.167,1557,7.768,1589,8.607,1603,10.709,1641,6.728,1674,9.36,1680,8.607,1683,10.588,1684,10.588,1685,14.596,1686,10.588,1687,10.588,1688,10.588,1689,10.588,1690,10.588,1691,10.588,1692,10.588]],["keywords/295",[]],["title/296",[649,545.984]],["content/296",[3,1.843,43,9.705,45,4.347,58,2.122,72,6.67,197,5.842,241,6.67,338,5.036,723,12.995,882,8.964,1274,8.508,1304,7.353,1416,8.304,1693,9.923]],["keywords/296",[]],["title/297",[3,119.285,669,339.318]],["content/297",[]],["keywords/297",[]],["title/298",[36,466.935,1444,804.245]],["content/298",[3,2.236,25,5.755,36,8.881,50,1.621,54,4.394,56,2.182,58,2.53,60,2.954,72,5.529,76,2.667,87,4.298,91,5.755,95,2.191,106,3.016,116,4.083,117,4.394,143,10.09,149,6.567,150,5.79,179,4.759,211,2.988,221,7.599,239,3.566,241,2.954,245,4.298,323,5.529,325,4.909,426,3.865,428,5.023,430,3.899,512,4.978,580,3.135,663,3.62,669,5.785,697,9.722,708,4.165,715,5.321,870,7.295,882,3.97,901,5.004,976,5.502,1012,2.708,1013,6.746,1030,10.367,1034,4.445,1035,4.554,1036,5.023,1131,5.104,1210,5.743,1300,5.622,1311,8.128,1330,6.258,1331,8.285,1641,4.498,1703,3.62,1754,7.079,1755,9.23,1756,6.258,1757,5.289,1758,11.774,1759,4.801,1760,7.079,1761,10.879,1762,5.502,1763,14.87,1764,5.391,1765,7.079,1766,7.079,1767,6.48,1769,6.258,1770,7.079,2959,8.203]],["keywords/298",[]],["title/299",[45,281.443,197,378.226]],["content/299",[3,1.56,18,1.612,45,4.671,58,2.279,149,5.814,197,6.277,228,6.438,288,8.046,323,5.649,382,5.151,669,4.438,762,6.438,864,8.309,870,6.709,1012,7.216,1067,12.9,1068,6.923,1101,11.579,1131,6.351,1186,8.046,1322,6.268,1475,11.287,1771,13.537,1772,13.537,1773,9.763,1774,13.537,1775,11.967]],["keywords/299",[]],["title/300",[50,301.275]],["content/300",[3,2.175,6,6.966,8,4.166,18,1.507,36,5.707,45,2.354,50,4.751,54,5.373,58,2.321,72,3.612,95,2.679,133,6.141,157,3.244,169,4.007,177,6.726,179,6.538,197,3.163,209,4.116,211,7.711,234,7.442,241,3.612,258,3.345,323,6.237,325,5.707,327,4.264,364,2.703,375,7.922,401,6.726,430,4.767,508,2.787,512,3.568,639,6.045,649,3.591,652,4.233,669,6.342,670,7.419,717,4.853,776,5.636,856,11.182,870,3.381,1012,3.311,1017,7.036,1019,3.763,1029,5.5,1095,10.325,1096,8.248,1097,6.591,1131,5.935,1310,5.145,1502,9.632,1505,7.651,1567,5.712,1607,7.036,1693,7.852,1697,7.651,1776,8.655,1777,8.655,1778,8.655,1779,8.655,1780,8.655,1781,8.655,1782,6.35,1783,8.655,1784,8.655]],["keywords/300",[]],["title/301",[45,281.443,258,400.012]],["content/301",[3,1.896,18,2.177,45,3.442,50,2.897,58,1.68,75,7.856,98,6.681,106,2.253,193,8.042,197,4.625,209,7.823,211,6.943,234,7.446,258,7.751,259,7.856,287,9.127,288,9.777,301,9.286,323,5.281,325,5.71,400,7.446,406,7.097,669,5.393,1012,4.841,1131,5.938,1186,7.522,1497,8.903,1636,7.097,1755,7.856,1759,8.583,1785,10.051,1786,9.455,1787,12.656,1788,10.288]],["keywords/301",[]],["title/302",[18,101.574,197,311.663,1583,506.875]],["content/302",[3,1.539,18,2.232,58,2.259,197,6.85,258,5.161,259,8.287,288,7.936,323,5.571,378,9.629,512,3.767,612,9.055,669,4.378,870,5.215,958,4.879,969,10.853,1012,5.107,1131,7.988,1274,7.106,1312,8.287,1497,7.226,1556,11.803,1583,12.119,1755,11.634,1789,12.22,1790,13.839]],["keywords/302",[]],["title/303",[22,350.355,125,469.918]],["content/303",[3,1.889,22,5.549,60,6.839,198,10.415,228,7.795,580,7.258,669,5.374,708,9.643,870,6.402,1012,6.27,1791,16.39]],["keywords/303",[]],["title/304",[776,586.326]],["content/304",[]],["keywords/304",[]],["title/305",[18,123.267,1569,439.386]],["content/305",[3,2.03,16,5.471,18,2.238,56,3.618,57,6.147,80,5.435,95,3.634,98,6.197,104,7.851,157,4.399,169,7.247,382,4.467,417,8.329,429,9.787,436,5.166,456,5.33,458,3.714,460,4.333,506,11.186,508,6.302,552,6.465,581,9.323,621,7.646,627,8.199,654,4.207,660,4.49,687,4.458,772,8.939,776,6.974,872,7.127,880,6.147,958,4.29,967,5.622,1061,7.551,1103,7.051,1127,7.746,1161,7.961,1227,5.135,1312,7.287,1569,6.646,1597,6.582,1702,9.543,1703,6.003,1704,11.739]],["keywords/305",[]],["title/306",[242,596.939,1569,439.386]],["content/306",[1,8.88,18,2.055,50,3.949,58,1.809,80,6.312,115,4.13,149,4.615,169,6.312,240,8.276,242,7.863,328,9.117,364,4.257,381,12.051,382,5.188,436,5.999,460,5.032,508,4.39,612,9.245,660,5.214,687,3.451,776,6.074,880,7.138,912,10.002,969,11.082,1061,8.769,1082,7.255,1105,10.002,1222,9.521,1569,7.324,1575,10.002,1597,7.644,1705,13.632]],["keywords/306",[]],["title/307",[22,350.355,125,469.918]],["content/307",[3,1.955,60,7.078,382,6.455,508,5.463,580,7.511,776,7.558,1671,10.298]],["keywords/307",[]],["title/308",[1,674.112,242,596.939]],["content/308",[]],["keywords/308",[]],["title/309",[22,350.355,125,469.918]],["content/309",[3,1.873,18,1.936,22,5.502,45,4.42,50,3.721,116,9.375,219,15.488,270,11.531,319,7.428,1568,9.375,1698,13.213,1792,12.377]],["keywords/309",[]],["title/310",[708,608.874,905,665.681]],["content/310",[]],["keywords/310",[]],["title/311",[1034,826.325]],["content/311",[3,2.16,36,4.675,50,4.29,58,1.375,60,4.324,106,3.855,118,5.92,150,7.653,152,4.251,198,6.584,218,3.732,241,4.324,258,5.558,426,5.657,428,7.352,512,4.659,580,4.588,626,7.13,701,7.991,901,4.766,935,7.473,1012,3.964,1034,6.507,1035,11.474,1036,7.352,1138,8.547,1641,6.584,1643,6.931,1757,7.742,1762,8.053,1769,9.16,1841,6.584,1846,9.25,1878,10.362,1880,11.989,1881,10.362,1882,8.64,1883,10.362,1884,8.64,1885,8.64,1886,8.64,1887,7.028,1888,8.64,1889,8.64,2960,16.514]],["keywords/311",[]],["title/312",[1101,807.709]],["content/312",[3,2.167,11,6.308,18,2.434,50,3.078,58,1.784,76,5.064,106,2.393,197,6.249,211,5.675,258,5.196,337,9.25,382,5.116,512,3.793,669,5.606,677,10.447,1012,5.142,1027,7.039,1131,6.308,1223,11.524,1759,9.117,1794,7.68,1841,8.542,1890,13.443,1891,13.9,1892,11.884,1893,13.443,1894,11.884,1895,13.443]],["keywords/312",[]],["title/313",[1098,1045.084]],["content/313",[17,7.461,18,2.056,109,13.71,1012,6.604,1755,10.716]],["keywords/313",[]],["title/314",[701,731.242]],["content/314",[3,2.334,45,3.899,50,3.282,56,4.418,58,2.363,109,11.385,149,4.853,197,6.507,258,5.541,669,6.641,872,8.703,1012,5.484,1131,8.353,1180,9.221,1299,7.759,1583,10.582,1755,8.898,1896,14.336]],["keywords/314",[]],["title/315",[887,933.65]],["content/315",[11,7.89,176,9.795,197,6.146,258,6.5,669,5.513,1012,6.432,1567,11.097,1636,9.429]],["keywords/315",[]],["title/316",[209,625.858]],["content/316",[3,2.015,11,6.533,20,6.762,22,4.714,50,3.188,60,5.81,72,5.81,125,6.323,169,6.447,176,8.111,197,5.089,209,8.315,218,5.015,258,5.382,364,4.348,382,5.299,512,3.928,580,6.166,652,6.811,669,5.732,872,8.454,1012,7.667,1101,8.547,1217,8.547,1671,8.454,1897,13.925]],["keywords/316",[]],["title/317",[460,485.753]],["content/317",[]],["keywords/317",[]],["title/318",[50,236.931,460,382.009]],["content/318",[18,1.143,50,3.948,56,2.957,58,2.289,82,4.984,95,2.97,106,3.731,110,4.147,115,4.127,150,5.107,218,3.455,238,2.547,273,4.357,293,5.956,303,6.507,319,4.385,457,4.563,460,5.847,470,6.499,508,3.09,512,3.844,687,2.429,695,6.616,1068,4.907,1073,5.107,1093,8.763,1130,6.417,1227,4.197,1274,5.107,1398,6.097,1399,4.762,1439,5.645,1467,6.332,1694,6.417,1715,5.703,1821,8.457,1898,9.595,1899,13.624,1900,9.595,1901,9.595,1902,9.595,1903,13.624,1905,9.595,1906,8.482,1907,9.595,1908,9.595,1909,9.595,1910,9.595,1911,9.595,1912,9.595,1913,9.595,1914,9.595,1915,9.595,1916,7.8,1917,9.595,1918,9.595,1919,9.595,1920,13.624,1921,9.595,1922,9.595,1923,13.624,1924,10.588,1925,9.595,2961,10.2]],["keywords/318",[]],["title/319",[22,350.355,125,469.918]],["content/319",[3,1.972,50,3.918,58,2.271,864,10.503,958,6.254,1204,7.871]],["keywords/319",[]],["title/320",[8,280.871,18,101.574,1583,506.875]],["content/320",[]],["keywords/320",[]],["title/321",[3,119.285,2962,986.166]],["content/321",[3,1.064,18,1.941,36,2.59,43,3.486,56,1.77,58,2.057,79,2.952,106,3.906,128,4.787,150,6.157,197,2.098,228,6.903,237,4.533,238,3.071,252,5.255,304,6.022,318,3.006,338,2.907,339,4.791,341,2.009,345,3.323,350,1.891,426,3.134,441,8.157,458,2.919,460,5.358,470,6.359,476,2.828,503,5.871,510,4.047,512,5.553,660,2.196,661,2.558,695,2.788,708,3.378,796,6.301,819,4.462,870,3.604,884,2.914,901,4.244,958,6.389,1036,4.073,1075,3.95,1179,5.075,1204,5.321,1220,4.462,1304,4.244,1321,5.075,1322,5.356,1415,2.409,1419,7.026,1449,3.031,1470,6.171,1480,3.648,1525,3.564,1583,9.214,1600,3.564,1710,3.84,1790,4.667,2064,4.462,2203,8.446,2345,5.542,2368,4.922,2749,3.95,2962,5.471,2963,6.103,2964,5.471,2965,5.471,2966,6.103,2967,5.471,2968,9.809,2969,9.809,2970,4.56,2971,9.809,2972,6.103,2973,6.103,2974,6.103,2975,6.103,2976,6.103,2977,6.103,2978,12.625,2979,3.486,2980,6.103,2981,6.103]],["keywords/321",[]],["title/322",[197,378.226,1583,615.129]],["content/322",[3,2.151,18,1.843,106,2.755,197,6.819,211,6.533,259,9.607,288,9.199,325,6.983,669,6.118,1065,6.729,1131,7.262,1221,12.581,1583,11.906]],["keywords/322",[]],["title/323",[287,746.37,1583,615.129]],["content/323",[11,2.347,18,1.454,95,1.549,106,3.965,152,3.384,197,3.015,204,3.222,426,2.731,436,2.202,470,3.384,512,4.101,660,1.914,708,2.943,796,2.379,1002,6.609,1012,1.914,1036,3.549,1204,3.794,1259,20.352,1310,2.974,1387,3.037,1553,2.914,1583,6.256,1641,3.179,1643,7.039,1645,4.579,1789,4.579,1790,4.067,1794,2.858,1846,9.888,2683,4.579,2967,4.767,2982,5.318,2983,5.318,2984,5.318,2985,5.318,2986,5.318,2987,5.318,2988,5.318,2989,5.318,2990,5.318,2991,5.318,2992,5.318,2993,5.318,2994,17.111,2995,5.318,2996,5.318,2997,5.318,2998,5.318,2999,11.188,3000,11.188,3001,20.714,3002,11.188,3003,19.089,3004,15.451,3005,8.768,3006,8.768,3007,8.768,3008,11.188,3009,5.318,3010,5.318,3011,14.357,3012,8.768,3013,8.768,3014,5.318,3015,5.318,3016,5.318,3017,5.318,3018,8.768,3019,8.768,3020,11.188,3021,15.451,3022,8.768,3023,5.318,3024,8.768,3025,8.768,3026,8.768,3027,5.318,3028,5.318,3029,5.318,3030,5.318,3031,5.318,3032,5.318,3033,5.318,3034,5.318,3035,5.318,3036,5.318,3037,5.318,3038,8.768,3039,5.318,3040,5.318]],["keywords/323",[]],["title/324",[963,682.927,1583,615.129]],["content/324",[3,0.88,4,8.61,5,3.905,18,2.221,46,4.586,58,1.013,79,3.542,113,12.638,115,4.684,117,4.74,119,4.321,131,7.153,150,8.229,208,6.462,209,3.631,228,3.631,241,3.186,260,3.462,271,5.039,327,8.176,328,5.107,339,3.389,342,4.687,364,2.384,434,3.708,459,3.789,460,4.254,503,7.044,510,4.856,512,5.11,649,3.168,655,4.795,660,5.31,663,5.893,687,4.201,695,3.708,739,5.255,740,6.366,901,5.301,958,4.212,1012,4.408,1019,3.32,1034,7.236,1204,3.512,1210,4.031,1227,6.763,1228,7.635,1276,4.635,1312,10.301,1416,9.409,1436,6.989,1437,6.989,1439,4.492,1468,7.605,1497,4.133,1539,5.934,1671,4.635,1831,6.366,1858,6.989,2278,5.178,2368,6.545,2994,10.982,3041,8.117,3042,8.117,3043,8.117,3044,8.117,3045,8.117,3046,8.117,3047,8.117,3048,8.117,3049,8.117,3050,8.117,3051,8.117,3052,8.117,3053,8.117,3054,8.117,3055,8.117,3056,8.117,3057,8.117,3058,8.117]],["keywords/324",[]],["title/325",[115,313.524,614,773.156]],["content/325",[]],["keywords/325",[]],["title/326",[18,123.267,1926,914.868]],["content/326",[3,0.951,18,2.395,43,5.009,50,2.796,58,1.929,60,3.443,79,3.709,106,2.174,115,4.404,169,3.82,179,3.609,191,4.956,197,3.016,198,5.243,218,2.971,232,5.596,237,3.268,238,2.19,242,4.759,338,2.599,339,2.427,350,2.718,364,4.54,376,7.863,397,7.937,406,4.627,458,5.084,459,4.095,508,3.933,639,5.763,652,4.036,655,7.668,687,3.091,693,5.854,695,4.007,717,4.627,719,6.164,739,4.623,762,5.808,818,8.059,838,7.214,870,3.223,872,5.009,891,6.708,926,5.596,1022,7.863,1081,8.732,1082,4.392,1151,6.054,1173,6.708,1174,7.073,1217,5.064,1304,6.687,1370,6.054,1382,5.677,1514,9.454,1568,4.759,1575,6.054,1598,5.243,1703,4.22,1916,6.708,1927,4.855,1928,7.553,1929,7.553,1930,7.294,1931,7.294,1932,8.251,1933,6.88,1934,8.251,1935,8.251,1936,7.294,1937,7.553,1938,8.251,1939,12.212,1940,8.251,1941,8.251,1942,7.294,1943,7.294,1944,7.294,1945,8.251,1946,8.251,1947,8.251,1948,8.251,1949,8.251,1951,8.251,1952,8.251]],["keywords/326",[]],["title/327",[18,123.267,240,628.279]],["content/327",[18,2.225,50,3.036,58,2.48,106,3.505,238,3.52,240,11.342,266,7.801,323,5.533,350,4.367,363,6.888,364,5.834,458,5.911,776,5.908,1703,6.781,1811,9.124,1828,11.722,1829,11.056,1936,11.722,1953,13.26,1954,10.531,1955,13.26,1956,13.26,1957,10.305,1958,10.779,1959,13.26,1960,13.26]],["keywords/327",[]],["title/328",[50,301.275]],["content/328",[18,2.087,50,4.325,58,2.326,76,3.275,97,6.756,106,3.837,107,4.666,115,2.634,118,4.967,157,3.258,169,4.025,218,4.57,238,3.979,241,3.628,285,5.663,350,2.863,364,3.963,458,4.015,614,6.495,642,7.249,687,2.201,717,4.875,762,4.135,799,6.27,814,5.524,818,5.737,907,9.481,1068,6.49,1073,6.754,1151,6.379,1227,3.803,1232,6.905,1313,7.453,1395,9.897,1398,8.064,1399,6.297,1480,5.524,1648,6.905,1703,4.446,1927,7.466,1942,7.686,1944,7.686,1950,8.285,1957,6.756,1961,8.694,1962,12.69,1963,8.694,1964,5.278,1965,8.694,1966,8.694,1967,8.694,1968,8.694,1969,8.694,1970,8.694,1972,8.694,1973,6.495,1974,8.694,1975,8.694,1976,7.249,1977,6.168,1978,8.694,1979,8.694,1980,8.694,1981,8.694,1982,8.694,1983,8.694,1984,8.694,3059,9.242,3060,9.242]],["keywords/328",[]],["title/329",[958,480.942]],["content/329",[]],["keywords/329",[]],["title/330",[50,236.931,958,378.226]],["content/330",[18,1.319,46,6.649,50,3.914,54,6.872,58,2.269,61,7.121,106,3.718,152,4.542,233,6.951,238,2.939,319,7.812,323,4.619,370,6.385,382,4.213,400,6.513,457,5.265,687,4.328,958,6.704,960,8.603,1204,7.863,1387,6.721,1395,9.038,1398,7.034,1399,5.494,1635,7.404,1702,8.999,1906,9.786,1964,6.721,2020,11.258,2021,9.23,2022,11.07,2023,11.07,2024,11.07,2025,11.07,2026,11.07,2027,11.07,2028,11.07,2030,11.07,2031,11.07,2033,11.07,3061,12.828,3062,12.828,3063,12.828]],["keywords/330",[]],["title/331",[22,350.355,125,469.918]],["content/331",[12,7.685,18,2.334,22,5.693,115,5.094,655,10.559,864,10.321,1568,9.699]],["keywords/331",[]],["title/332",[466,596.939,1127,682.927]],["content/332",[]],["keywords/332",[]],["title/333",[1985,1315.941]],["content/333",[3,1.677,45,3.957,57,7.619,58,1.931,146,9.137,169,6.737,180,8.833,259,9.032,260,4.371,305,5.624,330,9.731,417,10.323,461,10.323,508,4.686,652,7.117,654,5.214,887,10.323,1074,9.602,1178,12.473,1346,9.359,1415,6.106,1528,10.323,1607,11.828,1796,11.828,1986,10.011,1987,14.55]],["keywords/333",[]],["title/334",[339,387.005]],["content/334",[0,6.575,3,1.877,5,5.162,16,4.704,18,1.94,36,4.554,56,3.111,58,1.34,60,4.212,75,10.108,79,4.907,106,3.424,146,6.338,169,6.537,192,8.652,237,2.701,242,5.822,260,4.891,305,3.901,318,7.393,338,4.447,339,5.186,370,5.822,374,8.652,382,3.841,456,4.583,461,7.161,466,5.822,510,3.531,580,4.469,652,4.937,654,3.617,718,6.062,739,3.821,760,4.164,796,6.715,864,6.195,872,8.571,942,6.492,963,9.317,1082,5.372,1185,7.279,1227,4.415,1304,4.643,1415,4.236,1467,6.661,1528,7.161,1568,5.822,1593,7.541,1598,6.414,1988,8.415,1989,8.923,1990,8.923,1991,6.751,1992,12.481,1993,10.093,1994,10.093]],["keywords/334",[]],["title/335",[341,460.385]],["content/335",[3,1.373,16,3.719,18,2.015,52,6.841,56,2.46,58,1.059,60,3.33,79,2.036,106,3.793,115,4.318,169,3.695,188,4.113,193,5.071,197,2.917,228,6.779,237,4.23,238,3.784,260,5.329,325,3.601,327,3.931,328,5.337,338,4.49,339,2.347,341,4.987,345,5.133,413,4.743,426,4.357,459,5.912,460,2.946,461,8.452,466,4.603,476,3.931,477,6.841,479,6.202,480,4.213,481,6.487,482,6.654,508,3.836,510,2.792,512,2.251,652,3.903,654,2.86,660,3.053,661,5.308,663,6.092,666,6.841,687,4.654,693,5.662,739,3.021,796,3.795,857,5.574,870,4.653,880,4.179,1015,7.394,1027,4.179,1082,4.247,1185,5.755,1210,6.288,1274,4.247,1304,5.48,1433,7.055,1466,5.574,1497,4.319,1575,5.855,1598,9.057,1637,6.202,1638,6.654,1788,6.487,1933,9.932,1992,7.055,1995,7.98,1996,6.487,1997,7.98,1998,6.487,1999,7.055]],["keywords/335",[]],["title/336",[50,301.275]],["content/336",[3,1.163,5,5.162,18,1.94,45,2.745,50,4.249,56,3.111,58,2.34,72,4.212,79,4.155,95,3.124,106,3.586,110,4.362,115,3.058,191,6.062,197,3.689,211,4.26,238,2.68,245,6.128,273,4.583,325,4.554,327,6.955,338,3.179,364,6.005,416,4.833,459,5.009,461,7.161,508,5.244,652,4.937,662,8.016,669,3.309,687,3.574,715,4.937,1019,4.388,1068,5.162,1073,5.372,1395,9.78,1399,5.009,1404,8.016,1502,7.686,1514,8.307,1569,4.285,1964,6.128,2000,8.923,2001,8.205,2002,12.481,2003,8.923,2004,8.923,2005,8.923,2006,8.923,2007,9.239,2008,10.093,2009,10.093,2010,10.093,2011,10.093]],["keywords/336",[]],["title/337",[22,350.355,125,469.918]],["content/337",[3,1.905,20,8.027,58,2.194,60,6.897,218,5.953,510,5.783,580,7.319,654,5.924,896,8.203,1019,7.187]],["keywords/337",[]],["title/338",[1101,807.709]],["content/338",[]],["keywords/338",[]],["title/339",[18,86.373,149,245.494,1323,460.781,1841,460.781]],["content/339",[3,1.518,16,6.138,18,2.419,29,7.454,58,1.748,95,4.077,106,3.004,115,3.99,149,5.713,197,4.813,208,7.385,323,5.496,451,9.498,509,7.597,512,3.715,580,5.832,660,5.038,669,4.318,677,10.235,718,7.91,762,8.026,870,5.145,1012,5.038,1101,8.084,1131,6.179,1186,7.828,1336,9.839,1584,10.981,1891,15.139,1892,11.643,2018,13.17]],["keywords/339",[]],["title/340",[22,350.355,125,469.918]],["content/340",[3,1.873,18,1.936,22,5.502,45,4.42,60,6.782,197,5.94,228,7.73,580,7.197,901,7.476,1301,13.932,1792,12.377,2019,16.253]],["keywords/340",[]],["title/341",[79,335.762]],["content/341",[]],["keywords/341",[]],["title/342",[50,301.275]],["content/342",[50,4.375,56,4.292,57,7.291,58,2.32,106,3.751,238,3.697,337,9.581,458,4.406,799,10.043,1068,7.121,1073,7.411,1222,9.726,1299,7.537,1395,10.501,1398,8.848,1399,6.91,1964,8.454,2012,13.925,2013,13.925,2014,12.31,2015,13.925,2016,13.925,2017,13.925]],["keywords/342",[]],["title/343",[22,350.355,125,469.918]],["content/343",[76,6.502,449,6.098,967,8.267,1157,10.596,1597,9.68]],["keywords/343",[]],["title/344",[449,365.537,1157,635.204]],["content/344",[]],["keywords/344",[]],["title/345",[50,301.275]],["content/345",[18,1.537,50,4.223,58,2.211,106,3.678,238,3.427,273,5.861,370,7.445,400,7.594,449,4.559,458,4.084,687,3.268,1068,6.601,1073,6.87,1332,10.493,1395,10.006,1398,8.202,1399,6.405,1860,10.493,1927,7.594,1977,9.158,2014,11.411,2020,7.923,2035,12.908,2036,12.908,2037,10.493,2038,12.908,2039,18.447,2040,12.908,2041,12.908,2042,11.065,2043,12.908,2044,12.908]],["keywords/345",[]],["title/346",[2020,807.709]],["content/346",[50,3.306,106,3.615,146,9.069,174,6.395,188,7.443,242,8.33,363,7.502,373,8.412,449,5.101,655,9.069,656,9.53,967,6.916,1399,7.167,1569,7.594,1809,12.041,2381,10.416,2390,10.087,3064,16.735,3065,16.735,3066,16.735,3067,16.735,3068,16.735,3069,16.735]],["keywords/346",[]],["title/347",[50,301.275]],["content/347",[]],["keywords/347",[]],["title/348",[2020,807.709]],["content/348",[1,6.819,3,1.207,18,1.978,22,2.28,45,1.832,46,4.046,50,3.591,58,2.082,92,3.318,94,5.35,95,2.085,106,3.618,110,2.911,115,3.172,116,3.885,132,4.779,145,3.318,174,2.983,179,2.946,188,3.472,190,5.35,207,5.35,218,2.426,221,4.705,233,4.23,238,2.779,242,6.039,243,4.445,260,2.023,328,4.505,350,4.23,364,4.01,370,3.885,429,5.616,430,3.71,438,5.482,445,5.35,457,3.204,458,5.253,480,3.556,508,2.169,512,2.954,528,4.388,652,3.295,655,4.23,657,5.774,660,2.577,663,3.445,687,3.666,688,4.635,695,5.084,697,7.681,717,5.871,719,5.032,740,5.616,901,3.098,936,4.858,958,3.826,1068,3.445,1073,3.585,1165,3.963,1204,3.098,1284,4.28,1387,4.089,1394,5.955,1398,4.28,1399,5.195,1409,4.089,1416,3.499,1490,5.616,1491,4.445,1568,3.885,1569,2.86,1574,5.032,1601,5.616,1715,4.004,1796,5.476,1821,8.99,1973,5.032,2020,9.627,2075,5.35,2101,5.955,2115,6.736,2116,6.736,2117,12.842,2118,6.736,2119,6.736,2120,6.736,2121,10.469,2122,6.736,2123,6.736,2124,6.736,2125,6.736,2126,10.469,2127,6.736,2128,6.736,2129,6.736,2130,6.736,2131,6.736,2132,6.736,2133,3.924,2134,6.736,2135,6.736,2136,6.736,2137,6.166,2138,6.736,2139,6.736,2140,10.469,2141,6.736,2142,6.736,2143,5.235,2145,6.736,2146,6.736,3070,7.805,3071,7.805,3072,7.805,3073,7.805]],["keywords/348",[]],["title/349",[22,350.355,125,469.918]],["content/349",[3,1.99,60,7.204,460,6.372,580,7.644,1597,9.68]],["keywords/349",[]],["title/350",[654,370.874,1082,550.801]],["content/350",[]],["keywords/350",[]],["title/351",[1415,552.266]],["content/351",[3,0.668,12,2.647,16,2.7,18,1.107,19,3.726,52,4.966,56,2.864,57,3.033,58,2.327,72,2.417,76,4.383,80,2.682,95,2.877,106,3.691,133,4.11,169,4.303,179,2.534,188,2.985,204,2.263,218,3.347,237,4.548,238,4.341,285,3.773,304,3.856,305,2.239,321,3.681,323,2.417,338,2.927,339,1.704,341,2.027,345,2.086,348,4.11,350,5.126,400,3.408,401,4.502,409,5.118,413,3.443,416,2.774,426,3.162,434,2.813,442,4.411,459,2.875,476,2.854,480,4.906,510,5.445,512,2.622,521,4.178,580,2.565,637,8.862,652,2.833,654,4.772,660,4.451,661,2.581,687,3.371,763,3.309,767,4.709,796,8.083,838,7.235,870,2.263,884,2.94,961,4.11,1019,2.518,1027,3.033,1065,2.518,1103,5.582,1164,4.411,1180,3.726,1227,2.534,1346,7.486,1385,3.929,1415,5.589,1449,3.058,1497,3.135,1508,4.046,1525,3.596,1557,8.538,1723,3.681,1954,4.6,1986,3.986,1991,3.874,2045,5.793,2046,5.302,2047,6.818,2048,14.579,2049,8.215,2050,9.293,2051,9.293,2052,12.888,2053,5.302,2054,6.394,2055,5.793,2056,5.793,2057,9.293,2058,5.793,2059,5.793,2060,5.793,2061,9.293,2062,5.793,2063,5.793,2064,4.502,2065,8.215,2066,11.637,2067,9.293,2068,5.121,2069,5.793,2070,4.6,2071,4.709,2072,5.793,2073,5.793,2074,5.121,2075,4.6,2076,3.929,2077,5.793,2078,5.793,2079,5.793]],["keywords/351",[]],["title/352",[456,597.534]],["content/352",[3,1.258,12,4.986,18,0.846,53,6.771,56,3.363,58,2.42,60,2.965,72,4.552,76,2.676,80,3.29,94,5.643,95,2.199,99,6.771,106,3.398,110,3.071,116,4.098,152,2.915,179,3.108,204,6.279,218,2.559,228,3.379,237,3.987,238,2.896,260,5.096,304,5.51,305,5.133,321,4.515,325,4.922,338,2.238,339,3.208,345,2.559,350,2.34,370,4.098,385,6.851,400,4.18,405,6.091,408,6.771,409,3.913,412,4.57,434,3.451,456,8.022,508,3.513,510,5.212,512,3.078,580,4.831,652,3.475,654,2.546,660,2.718,687,1.799,739,2.69,796,5.189,838,5.414,858,6.771,859,5.643,876,4.628,882,3.984,884,3.606,896,3.526,1123,4.715,1173,5.776,1385,4.819,1415,6.746,1416,5.667,1424,6.281,1446,9.645,1449,3.751,1452,5.776,1510,5.411,1525,4.41,1585,6.281,1698,5.776,1775,13.171,1788,5.776,1794,4.059,1999,6.281,2047,5.213,2071,5.776,2074,6.281,2080,6.281,2081,7.105,2082,7.105,2083,13.28,2084,7.105,2085,6.281,2086,7.105,2087,10.91,2088,7.105,2089,7.105,2090,7.105,2091,7.105,2092,6.504,2093,6.504,2094,6.281,2095,7.105,2096,7.105,2097,7.105,2098,7.105,2099,7.105,2100,7.105]],["keywords/352",[]],["title/353",[1416,683.567]],["content/353",[3,1.425,20,4.076,27,5.21,50,1.922,56,2.587,58,1.641,60,5.161,63,6.392,76,3.162,80,3.886,95,3.828,101,4.583,106,3.705,110,3.627,117,5.21,180,7.508,191,5.042,193,5.334,218,3.023,237,4.836,238,4.586,240,5.096,304,5.131,338,3.896,339,2.469,341,2.937,345,4.454,350,4.837,400,4.938,416,4.02,426,4.583,476,4.135,512,3.489,521,6.054,580,3.717,620,6.392,637,6.392,652,4.105,654,4.432,682,5.863,687,3.131,688,5.775,796,3.992,838,7.287,882,4.707,1415,3.523,1416,6.424,1510,9.418,1525,5.21,1597,4.707,1632,5.863,1703,4.292,1723,5.334,1755,5.21,1792,6.392,1876,7.42,2047,9.074,2049,7.42,2052,15.27,2054,8.509,2064,6.523,2065,7.42,2068,7.42,2076,5.693,2101,7.42,2102,12.367,2103,12.367,2104,8.394,2105,7.42,2106,8.394,2107,8.394,2108,8.394,2109,8.394,2110,8.394,2111,8.394,2112,8.394,3074,6.158]],["keywords/353",[]],["title/354",[510,362.059,1439,608.874]],["content/354",[15,7.274,45,2.788,58,1.361,76,3.862,106,3.6,107,5.503,118,5.858,152,4.206,188,5.284,197,3.747,218,3.692,232,6.953,237,4.752,304,5.922,305,3.963,339,4.829,470,4.206,488,6.364,503,9.011,508,4.597,510,6.762,512,4.027,520,5.412,762,4.876,884,5.203,901,4.716,963,9.42,1074,6.766,1227,4.485,1304,6.566,1351,7.968,1439,9.661,1497,5.55,1557,7.523,1583,6.094,1598,6.515,1887,6.953,2047,10.473,2076,6.953,2114,9.385,2749,11.299,2964,9.77,3075,7.808,3076,10.899,3077,10.899,3078,10.899,3079,10.899,3080,10.899,3081,10.899,3082,10.899,3083,9.77,3084,10.899]],["keywords/354",[]],["title/355",[22,350.355,125,469.918]],["content/355",[18,1.986,22,5.644,76,6.279,242,9.616,450,13.552,1105,12.232,1568,9.616,1792,12.695,1794,9.524]],["keywords/355",[]],["title/356",[3,119.285,95,320.351]],["content/356",[]],["keywords/356",[]],["title/357",[22,350.355,125,469.918]],["content/357",[3,2.236,12,7.554,22,5.596,79,4.217,205,15.751,615,12.846,864,10.146,1469,12.587,1568,9.534]],["keywords/357",[]],["title/358",[683,706.254]],["content/358",[]],["keywords/358",[]],["title/359",[2147,1045.084]],["content/359",[3,1.834,5,8.136,17,5.199,18,1.433,31,10.822,46,7.225,56,3.708,58,1.596,76,5.993,85,8.158,92,5.926,116,6.939,149,4.072,200,11.463,208,6.745,209,5.721,650,8.277,683,10.18,762,7.567,884,6.105,887,12.648,896,7.895,1012,4.601,1019,5.23,1065,5.23,1081,7.225,1131,5.644,1203,8.277,1325,12.933,1326,14.445,1427,8.535,1702,9.779,2148,12.364,2149,12.029,2150,12.029,2151,10.634,2152,12.029]],["keywords/359",[]],["title/360",[3,98.292,669,279.603,683,457.672]],["content/360",[3,2.258,17,5.653,18,1.558,22,4.429,31,7.942,46,7.857,50,2.995,58,1.736,62,7.021,76,4.927,87,11.27,98,6.905,258,5.056,319,5.978,406,7.335,426,7.142,510,4.577,649,5.428,669,6.423,683,10.514,954,10.634,1065,5.687,1131,7.884,1232,10.389,1336,9.773,1359,8.872,2153,13.082,2154,13.082,2155,13.082]],["keywords/360",[]],["title/361",[3,83.583,36,327.181,149,245.494,870,283.258]],["content/361",[3,2.269,8,3.585,18,2.018,20,5.286,36,6.711,50,4.366,54,6.756,58,2.249,85,7.382,87,6.608,90,7.85,104,7.28,115,3.297,149,5.737,211,7.153,218,3.92,234,6.404,406,6.103,414,9.33,416,5.212,444,8.848,512,3.071,632,9.075,649,6.172,661,4.85,669,5.972,683,5.842,708,6.404,776,4.85,870,7.115,872,6.608,1031,10.372,1095,6.835,1097,8.289,1098,8.644,1104,8.459,1127,7.183,1219,9.075,1331,11.327,1567,7.183,1636,6.103,1693,6.756,1755,6.756,1773,7.85,2156,9.963]],["keywords/361",[]],["title/362",[22,350.355,125,469.918]],["content/362",[45,4.573,50,3.85,76,6.334,95,5.205,113,12.805,323,7.017,466,9.699,1976,14.02]],["keywords/362",[]],["title/363",[3,98.292,58,113.175,79,217.583]],["content/363",[]],["keywords/363",[]],["title/364",[79,264.052,426,564.994]],["content/364",[3,1.922,58,2.213,79,4.975,85,11.306,370,9.616,615,12.956,2281,14.738,2282,13.552]],["keywords/364",[]],["title/365",[449,464.807]],["content/365",[3,1.458,8,4.166,11,5.935,12,5.781,58,1.984,79,4.935,82,9.801,156,10.283,158,8.655,373,5.042,382,4.813,396,7.874,416,6.057,449,5.28,508,6.076,569,10.045,627,6.045,679,14.244,683,4.645,869,8.655,1060,7.943,1106,8.541,1157,7.764,1158,12.76,1159,12.778,1161,5.87,1247,9.83,1346,5.567,1439,5.092,1514,8.795,1655,12.152,1675,10.283,2021,7.216,2192,5.638,2272,7.419,2278,8.578,2282,10.283,2283,12.649,2284,11.182,2285,12.649,2286,8.655,2287,11.578,2288,8.655,2289,12.649,2290,12.649,2291,8.655,2292,8.655,2293,8.655,2294,8.655,3085,13.709,3086,9.201]],["keywords/365",[]],["title/366",[434,639.068]],["content/366",[55,7.866,58,2.061,62,6.225,79,4.973,157,4.347,163,9.014,174,6.876,175,7.981,178,9.327,179,5.073,434,8.501,470,6.37,508,3.735,661,5.168,687,4.431,699,6.824,720,9.429,818,7.654,888,11.053,924,12.068,967,7.436,1019,5.043,1061,7.461,1074,7.654,1106,8.066,1370,8.51,1405,10.253,1421,9.429,1566,10.247,1636,6.504,1802,9.211,2165,11.825,2210,8.665,2213,10.253,2282,9.429,2295,8.229,2296,11.599,2297,13.727,2298,11.599,2299,11.599,2300,11.599,2301,11.599]],["keywords/366",[]],["title/367",[585,1022.656]],["content/367",[79,4.254,174,7.382,343,12.455,436,7.337,508,5.369,598,15.886,1606,11.644,2295,11.828,2302,11.001]],["keywords/367",[]],["title/368",[95,320.351,466,596.939]],["content/368",[]],["keywords/368",[]],["title/369",[218,372.686,662,821.883]],["content/369",[0,4.403,3,0.779,18,1.25,50,3.322,56,2.083,58,1.926,75,4.196,79,4.427,106,3.937,197,2.47,237,4.204,238,4.414,242,3.899,260,5.848,273,4.767,305,2.613,318,3.539,325,3.05,327,3.33,338,4.054,339,3.087,341,2.365,345,4.635,350,2.226,364,4.019,456,3.069,459,3.354,461,4.796,466,6.055,476,3.33,477,5.794,479,5.253,480,5.541,481,5.495,482,5.636,486,5.495,508,4.145,509,3.899,512,1.907,608,5.794,654,2.422,660,2.586,661,3.012,662,5.368,663,5.368,666,5.794,667,5.368,695,3.283,880,3.539,901,3.109,942,4.348,1015,6.516,1068,3.457,1073,3.598,1210,3.568,1227,2.957,1274,3.598,1395,8.715,1399,5.209,1415,2.837,1417,5.147,1514,3.977,1569,4.457,1593,5.05,1598,4.295,1964,4.104,1986,4.651,1988,5.636,1989,5.975,1990,5.975,1991,4.521,1998,5.495,2000,5.975,2001,5.495,2002,5.975,2003,11.377,2004,5.975,2005,5.975,2006,5.975,2157,6.759,2158,6.759,2159,6.759,2160,6.759,2161,10.497,2162,6.759,2163,6.759]],["keywords/369",[]],["title/370",[50,301.275]],["content/370",[3,1.798,8,5.138,50,4.602,106,3.337,211,7.914,234,9.179,649,6.473,669,5.115,762,7.42,1065,6.783,1097,11.88,1131,7.32,1221,12.682]],["keywords/370",[]],["title/371",[22,350.355,125,469.918]],["content/371",[3,1.938,22,5.693,27,10.438,552,9.261,902,10.816,1411,10.1,1568,9.699,2164,16.815]],["keywords/371",[]],["title/372",[434,502.581,1566,682.927]],["content/372",[]],["keywords/372",[]],["title/373",[45,357.876]],["content/373",[18,1.601,45,3.656,58,1.784,92,6.623,110,5.81,163,10.447,182,6.104,343,10.043,369,11.524,400,7.909,434,8.304,510,4.703,649,5.578,687,3.403,1165,7.909,1264,13.021,1416,6.983,1566,8.871,1606,9.39,1894,11.884,2165,15.56,2166,13.443,2167,13.443,2168,13.443,2169,13.443,2170,13.443,2171,13.443,2172,13.443,2173,11.884,2174,13.443,2175,13.443]],["keywords/373",[]],["title/374",[36,466.935,905,665.681]],["content/374",[106,4.029,434,8.646,1033,13.661,1034,9.002,1066,13.661,1098,11.385,1101,8.799,1566,9.46,2176,12.673,2177,12.673,2178,12.673]],["keywords/374",[]],["title/375",[460,382.009,958,378.226]],["content/375",[3,0.955,58,1.934,82,4.304,98,4.374,106,3.533,141,6.581,179,3.625,185,5.62,237,5.508,271,5.468,318,4.339,339,4.286,343,6.191,434,4.024,438,4.339,453,8.835,457,3.941,458,5.888,460,4.522,493,7.519,503,4.205,567,7.896,663,4.238,760,3.419,941,7.325,958,5.327,1019,3.603,1074,5.468,1165,9.473,1227,3.625,1264,11.099,1284,5.265,1377,6.44,1378,6.581,1449,4.374,2165,15.936,2173,7.325,2177,7.325,2178,7.325,2179,8.286,2180,10.214,2181,10.83,2182,7.585,2183,8.286,2184,7.325,2185,7.325,2186,7.325,2187,7.325,2188,7.325,2189,8.286,2190,8.286,2191,5.788,2192,5.398,2193,8.286,2194,8.286,2195,8.286,2196,8.286,2199,8.286,2200,8.286,2201,8.286,2202,8.286,2203,7.585,2204,8.286,2205,6.736,2206,6.581,2345,8.754,2979,5.031,3075,6.31]],["keywords/375",[]],["title/376",[79,335.762]],["content/376",[4,3.06,12,3.188,14,3.903,18,0.488,20,1.989,56,1.262,57,2.145,58,1.601,62,2.198,79,1.045,106,3.812,119,5.156,179,1.792,180,2.487,182,1.86,198,2.603,233,5.721,237,4.507,238,4.086,258,1.583,305,1.583,318,2.145,319,3.188,330,2.74,331,2.778,338,1.29,339,1.205,341,2.44,342,5.592,345,4.728,350,2.298,392,3.33,397,2.236,406,3.912,434,1.989,436,1.803,456,5.961,457,1.948,458,6.206,480,2.162,493,4.282,508,1.319,510,2.44,520,2.162,597,3.183,600,2.906,654,1.468,687,3.323,695,1.989,699,2.41,867,3.903,880,3.653,901,3.209,904,2.906,926,2.778,942,2.635,949,2.703,958,1.497,1027,2.145,1061,2.635,1204,1.884,1227,1.792,1264,6.938,1310,2.435,1322,3.23,1329,3.415,1355,3.808,1369,2.818,1377,3.183,1422,3.119,1449,2.162,1477,2.954,1480,2.603,1513,2.703,1587,2.572,1600,2.543,1643,2.74,1794,2.34,1846,2.635,1998,3.33,2133,8.161,2165,15.641,2176,3.621,2180,10.059,2181,6.167,2184,6.167,2185,6.167,2186,6.167,2187,6.167,2188,3.621,2207,4.096,2208,4.096,2210,6.806,2211,6.976,2212,3.621,2213,8.054,2214,4.096,2215,4.096,2216,9.111,2217,4.096,2218,4.096,2219,4.096,2220,15.94,2221,4.096,2222,4.096,2223,12.064,2224,4.096,2225,4.096,2226,4.096,2227,6.976,2228,9.111,2229,4.096,2230,4.096,2231,6.976,2232,4.096,2233,4.096,2234,4.096,2235,9.111,2236,4.096,2237,4.096,2238,4.096,2239,4.096,2240,4.096,2241,4.096,2242,6.976,2243,4.096,2244,4.096,2245,4.096,2246,3.33,2247,3.415,2248,4.096,2249,4.096,2250,4.096,2251,3.749,2252,3.749,2253,4.096,2254,3.749,2255,3.749,2256,3.253,2257,3.415,2258,3.621,2259,3.749,2260,3.749,2261,4.096,2262,4.096,2263,6.976,2264,4.096,2265,4.096,2266,4.096,2267,4.096,2268,4.096,2269,6.976,2270,4.096,2271,3.621,2272,3.511,2273,4.096,2274,3.749,2275,4.096,2276,4.096,2277,3.621,2278,2.778,2279,4.096,2280,2.668]],["keywords/376",[]],["title/377",[1428,605.03,2785,517.71,3087,753.863]],["content/377",[]],["keywords/377",[]],["title/378",[152,424.56,2147,821.883]],["content/378",[]],["keywords/378",[]],["title/379",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/379",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/379",[]],["title/380",[2789,780.553,2790,615.019,2791,677.243]],["content/380",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2790,11.821,2791,13.017,3087,14.489]],["keywords/380",[]],["title/381",[62,457.672,107,457.672,2785,517.71]],["content/381",[]],["keywords/381",[]],["title/382",[701,402.951,1322,335.742,2792,663.743,2798,621.606]],["content/382",[3,1.98,8,4.459,18,2.046,36,8.511,58,1.797,82,7.032,117,8.403,149,4.583,197,4.947,223,7.885,239,6.818,323,5.649,324,7.327,512,4.845,708,7.964,715,6.621,762,6.438,1012,7.216,1015,8.403,1225,10.113,1322,6.268,1583,10.208,1758,12.601,2679,11.287,2798,11.604,2799,12.391,3088,14.39]],["keywords/382",[]],["title/383",[17,272.593,18,75.13,45,171.537,1322,292.038,2800,525.901]],["content/383",[11,3.871,17,3.566,18,0.983,27,5.122,45,2.244,58,1.929,106,3.792,228,3.924,237,5.305,239,4.156,304,3.423,318,7.612,325,3.723,338,2.599,339,4.276,396,3.951,438,6.394,460,6.629,470,3.385,488,9.024,503,6.197,510,4.272,511,3.979,512,2.328,520,4.356,548,5.677,549,6.054,715,4.036,739,3.124,902,5.307,958,5.313,963,5.445,967,3.951,1015,9.024,1065,3.587,1123,3.566,1304,8.548,1311,6.164,1322,6.731,1428,5.854,1439,7.185,1449,4.356,1480,5.243,1586,6.054,1587,5.181,1713,6.054,2047,6.054,2113,7.863,2114,7.553,2198,6.164,2345,7.335,2749,8.403,2835,6.553,2836,6.553,2837,6.553,2838,6.553,2839,6.553,2840,6.553,2841,6.553,2842,6.553,2951,6.412,2979,7.414,3075,6.283,3089,8.771,3090,8.771,3091,15.455,3092,8.771,3093,8.771]],["keywords/383",[]],["title/384",[45,231.913,95,263.974,118,487.186]],["content/384",[11,1.938,17,1.785,18,0.492,50,1.609,58,1.75,95,1.279,106,3.938,145,2.035,160,4.465,173,2.691,182,1.876,237,5.092,238,4.246,260,2.754,304,3.804,338,1.301,339,2.696,341,2.458,345,5.334,348,2.931,350,3.02,396,4.39,436,4.76,438,2.163,456,1.876,457,3.342,458,4.451,460,3.993,470,6.336,473,3.031,488,4.361,491,7.207,499,5.238,503,2.096,511,4.421,512,1.982,513,3.87,514,4.053,516,3.086,518,2.802,519,5.067,520,2.181,521,2.979,522,3.358,523,3.358,530,2.802,535,4.699,539,2.885,543,2.885,544,11.105,546,2.885,548,2.842,549,3.031,687,1.046,958,1.51,967,3.365,975,2.979,1068,4.688,1073,2.199,1123,8.738,1210,2.181,1220,3.21,1355,5.905,1362,3.281,1415,1.734,1447,4.577,1449,3.709,1525,4.361,1587,2.594,1719,6.497,1723,2.625,1729,2.931,1823,3.444,2133,9.839,2345,4.22,2439,3.281,2440,3.146,2448,9.68,2449,3.444,2450,3.444,2451,7.936,2452,5.46,2470,3.444,2471,3.444,2472,3.21,2473,3.444,2474,3.444,2475,5.858,2477,5.858,2478,3.444,2480,6.431,2482,3.444,2483,3.444,2484,3.444,2485,3.444,2487,3.781,2785,2.508,2835,3.281,2836,3.281,2837,3.281,2838,3.281,2839,3.281,2840,3.281,2841,3.281,2842,3.281,2926,3.781,2927,3.781,2928,3.781,2929,3.781,2930,3.781,2931,3.781,2932,3.541,2934,3.541,2935,3.781,2937,3.781,2938,3.781,2939,3.781,2940,3.781,2942,3.781,2979,2.508,3087,3.652,3094,4.391,3095,4.391]],["keywords/384",[]],["title/385",[1857,692.162,2945,947.258]],["content/385",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/385",[]],["title/386",[1081,621.593,1151,759.301]],["content/386",[2952,16.234,2953,16.234]],["keywords/386",[]],["title/387",[12,288.256,18,75.13,258,243.803,364,196.957,760,260.224]],["content/387",[]],["keywords/387",[]],["title/388",[18,156.743]],["content/388",[18,1.554,58,0.916,106,3.861,110,2.983,113,9.932,150,6.942,152,2.832,179,3.02,218,2.486,237,4.245,238,2.833,239,3.477,260,5.568,266,6.278,304,6.958,305,4.124,338,4.622,339,4.665,341,2.415,345,3.843,456,6.663,459,3.426,476,3.401,509,7.523,510,4.563,511,6.29,512,4.14,654,2.474,660,4.082,778,8.464,796,5.075,803,4.387,838,3.426,962,6.578,963,4.556,1061,4.441,1103,4.146,1210,3.644,1244,12.328,1385,7.237,1415,2.897,1439,7.674,1447,4.497,1452,5.612,1470,11.695,1477,4.979,1501,4.556,1536,5.365,1627,4.556,1715,4.103,2054,4.75,2076,4.682,2085,6.103,2094,11.53,2548,6.903,2549,6.103,2550,6.903,2551,6.103,2552,9.433,2553,9.433,2554,6.903,2555,6.903,2556,10.67,2557,10.67,2558,6.903,2559,6.903,2560,6.903,2561,6.903,2562,6.903,2563,6.903,2564,6.903,2565,6.903,2566,6.103,2567,6.103,2749,7.342]],["keywords/388",[]],["title/389",[18,123.267,364,323.151]],["content/389",[3,0.877,8,5.457,18,1.649,22,2.575,31,4.617,56,3.541,58,1.525,106,3.803,115,2.304,119,4.304,152,4.714,176,6.693,187,8.147,204,4.488,208,4.265,209,3.617,211,4.85,241,3.174,258,2.94,260,2.285,266,4.475,288,4.521,342,4.668,364,4.324,458,3.635,512,3.907,596,4.521,660,2.909,669,2.494,718,4.568,850,12.242,1002,12.2,1012,2.909,1123,4.966,1132,8.695,1133,6.976,1135,7.582,1137,14.357,1138,4.521,1140,8.584,1143,6.52,1144,5.682,1553,4.43,1764,5.792,1793,5.087,2549,6.724,2568,10.517,2569,10.517,2570,6.962,2571,6.962,2572,6.962,2573,6.52,2574,6.962,2575,6.962,2576,6.962,2577,6.962,2578,7.606,2579,11.49,2580,9.58,2581,7.606,2582,7.606,2583,7.606,2584,7.606,2585,7.606,2586,7.606,2587,7.606,2588,7.606,2589,7.606,2590,7.606,2591,6.962,2592,7.606,2593,7.606,2594,7.606,2595,7.606,2596,7.606,2597,7.606]],["keywords/389",[]],["title/390",[654,370.874,1501,682.927]],["content/390",[12,4.429,18,1.154,56,2.987,58,1.286,62,5.201,101,5.291,106,3.083,107,8.548,118,9.896,150,5.158,152,6.534,204,6.222,241,4.044,260,2.911,303,6.572,305,3.746,382,3.688,412,10.245,453,6.989,456,6.23,654,6.207,686,8.87,699,8.072,719,7.24,760,3.998,778,5.59,793,8.307,794,7.696,796,6.525,799,6.989,838,6.809,906,8.307,1065,4.213,1387,5.883,1501,11.43,1535,12.129,1536,7.531,1540,8.567,1550,7.878,1553,5.645,1568,5.59,1671,5.883,1857,11.585,2552,8.567,2553,8.567,2566,8.567,2567,8.567,2598,9.691,2599,9.691,2601,15.312,2603,7.878,2604,8.567,2605,9.691,2606,9.691,2607,9.691,2608,8.567,3096,10.302,3097,10.302,3098,10.302,3099,10.302,3100,10.302]],["keywords/390",[]],["title/391",[12,472.947,760,426.953]],["content/391",[11,1.555,12,5.741,18,0.395,58,1.029,69,3.158,106,3.943,107,4.999,113,8.066,118,4.43,152,4.345,188,6.874,191,1.991,204,5.906,211,1.399,237,1.554,238,3.335,239,1.669,241,1.383,260,4.917,273,4.809,278,5.535,303,2.248,304,3.864,305,4.506,319,1.515,331,6.316,332,4.979,339,1.708,350,3.84,361,2.524,385,2.081,412,4.988,451,2.39,456,4.809,499,1.893,511,2.801,512,3.544,520,1.749,669,1.087,695,1.609,699,10.594,702,2.841,732,7.288,750,2.93,760,1.367,767,6.303,778,6.725,793,2.841,794,2.632,796,5.037,799,2.39,803,2.106,838,4.622,870,1.295,906,2.841,917,5.535,918,4.121,940,2.93,965,4.121,975,2.39,1015,2.057,1065,2.525,1130,2.217,1134,5.793,1161,2.248,1244,9.763,1286,5.535,1340,7.765,1503,2.315,1510,2.524,1513,2.187,1519,2.694,1550,4.722,1553,6.791,1558,2.575,1627,2.187,1710,8.921,1785,2.632,1811,2.28,1857,8.921,2054,3.997,2076,5.259,2143,2.575,2210,4.339,2212,2.93,2278,2.248,2394,4.843,2406,8.233,2551,2.93,2580,2.763,2601,10.306,2603,2.694,2604,2.93,2608,2.93,2609,3.033,2610,3.314,2611,3.314,2612,3.314,2613,3.033,2614,3.314,2615,3.314,2616,3.314,2617,3.314,2618,3.314,2619,3.314,2620,3.314,2621,5.809,2622,3.314,2623,9.314,2624,3.314,2625,7.754,2626,3.314,2627,5.809,2628,5.809,2629,5.809,2630,3.314,2631,3.314,2632,3.314,2633,3.314,2634,3.314,2635,3.314,2636,3.314,2637,3.314,2638,3.314,2640,7.754,2641,5.809,2642,3.314,2643,3.314,2644,5.809,2645,3.314,2646,3.314,2647,3.314,2648,5.317,2649,2.575,2650,3.314,2651,7.097,2652,3.314,2653,5.809,2654,3.314,2655,5.809,2656,3.314,2658,3.314,2659,3.314,2660,3.314,2661,3.314,2662,3.314,2663,3.314,2664,3.033,2665,3.314,2666,3.314,2667,3.314,2668,3.314,2669,3.314,2670,3.314,2671,3.314,2672,5.809,2673,3.314,2674,3.314,2675,5.809,2676,3.314,2677,3.314,2678,3.314,2679,2.763,2680,3.314,2681,3.314,2682,3.314,2683,3.033,2684,3.314,2685,3.314,2686,3.314,2687,3.314,2688,3.314,2689,3.314,2690,3.314,2691,3.314,2692,3.314,2693,3.314,3101,3.523,3102,3.523]],["keywords/391",[]],["title/392",[8,238.838,363,376.679,364,226.432,449,256.132]],["content/392",[]],["keywords/392",[]],["title/393",[8,340.857,3103,759.301]],["content/393",[3,1.413,8,5.305,18,1.46,50,3.688,56,3.778,58,2.536,149,4.149,174,7.967,198,7.788,203,11.219,204,7.464,285,7.984,323,5.114,350,4.037,363,6.367,364,3.827,417,8.696,585,9.525,596,7.285,660,4.688,678,7.139,683,6.578,776,5.461,870,4.788,1029,7.788,1065,5.329,1277,14.288,1343,11.219,1427,8.696,2347,10.835,3103,11.818,3104,13.029,3105,13.029,3106,13.029,3107,10.835,3108,11.68,3109,11.68,3110,13.029]],["keywords/393",[]],["title/394",[449,365.537,589,862.854]],["content/394",[1,7.74,3,1.37,8,5.836,18,1.88,20,5.77,27,7.376,56,3.662,58,2.505,72,4.958,89,6.854,104,7.947,149,4.023,174,7.846,211,5.016,215,11.022,218,4.279,363,6.172,364,4.928,365,12.263,373,9.192,406,6.663,414,10.186,449,6.258,507,10.504,715,5.812,870,4.641,884,6.03,1272,7.643,1283,8.57,1937,10.876,2404,10.876,3103,11.578,3107,10.504,3111,16.884,3112,9.437,3113,11.323,3114,12.631,3115,12.631,3116,12.631]],["keywords/394",[]],["title/395",[3,119.285,363,537.576]],["content/395",[3,1.2,8,3.429,18,1.595,20,2.392,22,0.931,45,1.34,46,1.653,50,1.864,56,2.51,58,1.85,72,1.148,76,1.036,79,0.702,80,3.096,98,1.452,106,3.953,115,2.838,118,1.572,145,4.615,149,3.524,150,5.541,152,1.129,156,2.237,157,5.406,174,1.218,180,4.06,182,1.249,187,1.619,204,2.612,209,1.309,211,2.823,218,0.991,223,1.603,228,2.343,237,0.736,238,1.775,239,1.386,240,4.06,258,1.904,273,1.249,287,1.984,301,5.975,319,1.257,350,1.622,361,5.092,363,6.282,364,4.642,380,1.893,428,1.952,444,2.237,445,2.185,449,3.677,453,3.552,457,1.309,458,4.044,470,2.021,491,2.928,509,1.587,512,3.191,513,2.713,514,2.841,580,1.218,596,2.928,612,1.866,626,1.893,649,3.379,656,1.816,660,2.558,669,0.902,678,3.895,682,9.735,701,5.205,718,1.653,720,2.237,762,2.343,763,1.572,803,1.748,856,2.432,870,1.075,875,2.294,880,1.441,882,1.543,884,2.5,901,4.309,913,2.751,935,1.984,954,2.237,1012,3.115,1015,1.708,1029,3.13,1034,3.093,1035,5.238,1036,1.952,1065,1.196,1075,1.893,1082,1.464,1104,2.138,1133,4.06,1135,4.413,1138,6.188,1152,3.68,1216,12.368,1219,2.294,1274,3.559,1277,2.185,1336,2.055,1387,1.67,1404,2.185,1409,1.67,1490,2.294,1497,1.489,1553,1.603,1569,3.457,1641,1.748,1643,3.294,1669,2.762,1671,1.67,1719,2.958,1755,1.708,1757,2.055,1782,2.019,1800,2.518,1807,2.294,1809,2.294,1810,2.138,1811,7.163,1813,2.518,1821,3.057,1825,2.518,1826,2.518,1829,2.294,1837,2.518,1845,2.358,1846,6.696,1851,10.366,1853,2.518,1880,2.294,1882,2.294,1884,2.294,1885,2.294,1886,2.294,1887,1.866,1888,2.294,1889,2.294,1927,1.619,1957,3.828,1964,1.67,2020,1.689,2960,9.367,3075,2.095,3103,2.019,3109,2.622,3112,5.311,3117,2.925,3118,2.925,3119,2.925,3120,2.185,3121,2.925,3122,2.622,3123,2.925,3124,2.925,3125,4.354,3126,2.925,3127,2.925,3128,2.925,3129,5.236,3130,2.925,3131,7.109,3132,4.744,3133,2.432,3134,2.432,3135,2.432,3136,2.925,3137,2.925,3138,2.925,3139,2.925,3140,2.294,3141,2.432,3142,2.925,3143,2.432,3144,2.925,3145,2.925,3146,2.925,3147,5.236,3148,2.925,3149,2.925,3150,5.236,3151,2.925,3152,2.925,3153,2.925,3154,2.925,3155,2.925,3156,2.925,3157,2.925,3158,2.925,3159,2.622,3160,2.622,3161,2.925,3162,2.925,3163,2.925,3164,2.925,3165,2.925,3166,2.925,3167,2.925,3168,2.622,3169,2.925,3170,2.925,3171,2.925,3172,2.925,3173,2.925,3174,2.925,3175,7.109,3176,8.657,3177,5.236,3178,2.925,3179,7.109,3180,2.925,3181,7.109,3182,2.925,3183,2.925,3184,2.925,3185,2.925,3186,7.109,3187,2.925]],["keywords/395",[]],["title/396",[3188,1163.321]],["content/396",[6,7.082,11,6.033,16,4.126,18,2.193,27,5.495,29,5.01,43,5.374,58,1.706,72,5.365,76,7.156,82,4.598,131,5.495,174,6.705,176,5.156,203,8.103,204,3.458,216,6.879,223,5.156,228,4.21,241,3.694,319,4.046,364,4.015,365,9.992,424,7.826,449,6.875,458,4.068,470,3.632,512,3.627,513,4.875,596,7.643,660,3.386,678,5.156,880,4.635,884,4.492,954,7.196,967,4.239,969,7.196,992,7.03,1025,7.03,1029,5.625,1060,5.559,1158,6.183,1159,6.879,1217,5.433,1256,8.436,1276,5.374,1284,5.625,1297,7.381,1298,10.453,1336,6.613,1423,6.879,1567,8.485,1584,7.381,1635,5.921,1636,4.964,1637,6.879,1668,6.495,1669,4.964,1671,5.374,1672,8.103,1703,4.527,1750,7.588,1872,7.381,2501,7.03,2505,6.741,3083,8.436,3107,7.826,3108,8.436,3120,7.03,3132,6.281,3188,7.826,3189,9.41,3190,9.41,3191,9.41,3192,9.41,3193,9.41,3194,9.41,3195,13.669,3196,9.41,3197,9.41]],["keywords/396",[]],["title/397",[8,207.749,58,83.711,449,222.791,967,302.059,3103,462.786]],["content/397",[8,5.864,18,2.121,76,5.4,174,6.348,204,5.6,364,5.559,373,8.35,382,5.455,449,5.063,509,8.269,596,8.521,624,12.673,967,8.526,991,14.336,1082,7.63,1277,11.385,1283,10.339,1300,11.385,2259,13.122,3103,13.063,3111,13.661,3198,15.239,3199,15.239]],["keywords/397",[]],["title/398",[853,965.506]],["content/398",[3,1.997,8,6.568,18,1.635,31,8.334,58,2.3,61,8.83,104,9.182,301,10.072,319,6.274,364,4.287,449,4.849,569,10.903,596,8.16,632,11.446,776,6.117,864,8.426,865,17.328,880,7.188,1019,5.969,1025,10.903,1082,7.307,1635,11.589,3103,12.713,3188,15.318,3200,14.594]],["keywords/398",[]],["title/399",[1428,605.03,2785,517.71,2786,649.387]],["content/399",[]],["keywords/399",[]],["title/400",[152,424.56,2147,821.883]],["content/400",[]],["keywords/400",[]],["title/401",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/401",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/401",[]],["title/402",[2789,780.553,2790,615.019,2791,677.243]],["content/402",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2786,12.481,2790,11.821,2791,13.017]],["keywords/402",[]],["title/403",[62,457.672,107,457.672,2785,517.71]],["content/403",[]],["keywords/403",[]],["title/404",[701,402.951,708,426.638,762,344.879,2792,663.743]],["content/404",[3,1.864,17,5.331,18,1.469,36,8.643,58,2.147,115,3.737,117,7.656,149,5.476,171,8.896,223,7.185,239,6.212,258,4.768,323,5.147,324,6.676,512,4.563,701,8.988,708,11.27,715,6.033,762,5.866,870,4.818,1012,7.327,1015,7.656,1225,9.215,1703,6.308,1758,11.867,2679,10.284,2793,12.335,2794,12.335,2795,9.586,2796,11.29,2797,16.174,2798,13.865,2799,11.29]],["keywords/404",[]],["title/405",[1034,535.481,1322,394.828,2800,711.003]],["content/405",[3,1.992,50,3.957,106,3.792,118,5.509,143,7.343,150,5.132,152,3.956,157,5.953,182,4.378,228,6.502,235,8.266,258,3.727,271,6.363,428,6.841,438,5.049,512,4.481,626,6.635,638,9.189,701,8.827,703,7.658,901,4.435,935,6.954,1012,5.23,1034,8.585,1035,10.217,1036,6.841,1138,8.126,1156,7.204,1221,7.839,1284,6.127,1299,5.219,1636,5.407,1641,6.127,1643,6.449,1756,8.524,1757,7.204,1841,6.127,1846,8.794,1880,13.244,1882,8.04,1884,8.04,1885,8.04,1886,8.04,1887,6.54,1888,8.04,1889,8.04,2347,8.524,2785,5.854,2786,7.343,2801,9.643,2802,7.204,2803,9.643,2804,9.643,2805,9.643,2806,9.643,2807,6.954,2808,13.672,2809,9.643,2810,9.643]],["keywords/405",[]],["title/406",[1101,523.417,1322,394.828,2800,711.003]],["content/406",[3,1.813,18,1.873,98,8.302,106,2.8,438,8.235,512,4.437,669,5.157,948,13.903,1012,6.016,1101,9.653,1891,12.785,2795,12.222,2807,11.343,2811,14.395,2812,15.727,2813,15.727]],["keywords/406",[]],["title/407",[17,313.386,18,86.373,1322,335.742,2814,725.149]],["content/407",[11,1.797,16,1.785,17,1.655,18,1.508,20,7.537,55,4.466,56,2.03,58,2.183,79,3.457,98,3.476,106,3.618,115,3.511,116,2.209,131,2.377,145,1.887,149,2.933,150,2.038,157,1.435,160,4.185,161,3.193,182,1.739,185,2.597,204,2.573,237,4.003,238,4.12,241,1.598,253,3.386,259,2.377,260,2.602,318,5.386,330,2.562,332,8.818,339,3.025,350,4.926,396,3.154,416,1.834,430,3.627,434,1.86,436,2.898,438,5.386,449,1.353,456,2.99,458,3.667,459,4.299,460,3.198,464,6.028,465,3.65,470,1.571,473,2.81,488,4.088,499,2.188,503,1.944,510,3.031,511,3.176,512,1.858,518,4.466,519,2.762,520,2.022,528,2.495,548,2.635,549,2.81,656,2.527,687,2.193,695,1.86,715,3.221,717,2.148,732,2.635,778,2.209,818,5.717,873,3.386,882,2.148,893,3.65,905,4.236,918,2.717,949,2.527,958,3.166,965,2.717,966,2.717,967,4.926,968,3.113,976,9.007,1002,2.405,1012,1.465,1015,4.088,1035,2.464,1081,3.956,1106,1.989,1123,4.446,1127,2.527,1203,2.635,1204,1.762,1210,2.022,1274,2.038,1284,2.434,1304,3.029,1311,2.861,1322,6.274,1346,2.464,1366,4.531,1440,2.976,1445,2.675,1448,2.717,1449,3.476,1470,2.562,1477,2.762,1503,2.675,1514,2.253,1519,3.113,1539,2.976,1558,5.118,1586,2.81,1587,5.44,1632,2.675,1694,4.405,1710,2.562,1717,2.976,1759,2.597,1924,2.976,1930,3.386,1931,3.386,1943,3.386,1957,2.976,2133,2.231,2143,5.118,2151,3.386,2197,3.193,2198,2.861,2284,3.386,2345,2.3,2376,3.386,2451,2.81,2452,2.976,2603,3.113,2795,6.733,2802,7.685,2807,7.419,2815,3.386,2816,3.83,2817,6.586,2818,3.83,2819,3.83,2820,3.83,2821,3.83,2822,3.83,2823,3.83,2824,3.83,2825,3.83,2826,3.83,2827,3.83,2828,3.83,2829,3.83,2830,3.83,2831,3.83,2832,3.83,2833,3.83,2834,3.83,2835,3.042,2836,3.042,2837,3.042,2838,3.042,2839,3.042,2840,3.042,2841,3.042,2842,3.042,2843,3.83,2844,3.83,2845,3.283,2846,3.83,2847,3.83,2848,3.83,2849,6.586,2850,3.83,2851,3.83,2852,3.83,2853,3.83,2854,3.83,2855,3.83,2856,3.83,2857,3.83,2858,3.83,2859,6.586,2860,3.83,2861,6.586,2862,3.83,2863,6.586,2864,3.83,2865,6.028,2866,3.83,2867,6.586,2868,3.83,2869,3.83,2870,6.586,2871,3.83,2872,3.83,2873,3.83,2874,3.83,2875,3.83,2876,3.83,2877,3.83,2878,3.83,2879,3.83,2880,3.83,2881,3.83,2882,3.83,2883,6.586,2884,3.83,2885,3.83,2886,3.83,2887,3.83,2888,3.83,2889,3.83,2890,3.83,2891,3.83,2892,3.83,2893,3.83,2894,3.83,2895,3.283]],["keywords/407",[]],["title/408",[50,195.235,1322,394.828,2896,852.766]],["content/408",[5,2.668,11,2.448,16,2.432,17,2.255,18,1.865,20,4.146,46,3.134,50,3.162,55,7.35,56,2.632,58,2.413,82,2.71,98,2.754,106,3.648,115,2.587,149,2.891,157,1.955,193,3.315,238,1.385,242,3.01,245,5.183,259,3.239,260,1.567,273,2.369,285,3.399,293,8.574,319,2.384,325,2.354,327,4.206,364,3.91,396,5.19,426,2.848,436,2.296,438,6.557,442,6.502,470,3.503,491,5.075,508,2.75,510,1.825,512,1.472,513,2.874,514,4.925,544,5.492,687,2.743,695,2.534,715,5.301,717,2.926,762,2.481,796,2.481,882,2.926,890,3.07,896,2.589,958,4.577,1002,8.674,1015,3.239,1035,3.356,1082,2.777,1093,5.492,1106,2.71,1123,4.684,1204,3.927,1210,6.611,1272,5.492,1322,3.953,1395,5.128,1399,6.854,1442,3.763,1497,2.824,1514,3.07,1535,6.502,1539,4.055,1569,5.317,1574,3.898,1635,3.49,1694,5.711,1703,2.668,1719,3.134,1793,3.49,1821,6.727,1822,6.502,1916,6.941,1927,5.023,1964,5.183,1996,4.241,2001,4.241,2020,9.609,2071,4.241,2280,5.562,2361,3.973,2381,3.763,2382,4.612,2390,3.644,2403,4.612,2410,4.612,2419,4.612,2420,4.35,2498,4.241,2499,4.241,2507,6.941,2508,7.119,2509,4.241,2512,4.241,2520,4.241,2526,4.612,2527,4.612,2529,7.548,2534,4.612,2535,4.612,2542,4.612,2545,4.612,2802,8.096,2807,7.816,2815,4.612,2897,5.217,2898,5.217,2899,5.217,2900,5.217,2901,8.538,2902,5.217,2903,5.217,2904,5.217,2905,5.217,2906,4.612,2907,8.538,2908,5.217,2909,8.538,2910,5.217,2911,5.217,2912,5.217,2913,5.217,2914,5.217,2915,5.217,2916,5.217,2917,5.217,2918,5.217,2919,5.217,2920,5.217,2921,5.217,2922,5.217,2923,5.217,2924,5.217,2925,5.217]],["keywords/408",[]],["title/409",[45,231.913,95,263.974,118,487.186]],["content/409",[3,0.334,11,1.358,17,1.251,18,1.155,50,2.219,58,1.741,95,0.896,106,3.952,145,4.164,149,1.745,160,3.275,173,1.886,182,1.314,233,3.236,237,4.636,238,4.134,260,2.093,273,2.34,304,2.89,331,5.733,338,0.912,339,2.049,341,1.803,345,4.477,348,2.054,350,2.784,364,0.904,396,5.146,436,3.72,449,1.022,456,1.314,457,2.451,458,3.685,460,2.572,470,5.381,473,2.124,488,3.199,491,7.797,493,4.276,499,4.829,503,1.469,511,3.36,512,2.385,513,4.656,514,6.198,516,2.163,518,1.963,519,3.717,520,2.721,521,2.088,522,2.353,523,2.353,530,1.963,535,3.447,539,2.022,543,2.022,544,9.764,546,2.022,548,1.992,549,2.124,660,1.107,661,2.296,687,0.733,732,3.546,758,2.353,778,1.67,803,1.839,814,1.839,838,1.436,918,3.657,958,3.089,965,3.657,966,3.657,967,5.578,975,2.088,1068,3.563,1073,1.541,1093,1.862,1123,8.475,1204,2.371,1210,1.528,1322,2.386,1355,4.615,1362,2.299,1380,1.963,1399,1.436,1415,1.215,1447,3.357,1449,2.721,1525,3.199,1569,3.589,1586,3.782,1587,1.818,1713,2.124,1715,1.721,1719,6.454,1723,1.839,1729,2.054,1793,5.654,1822,3.925,1823,2.413,1927,1.703,1958,4.19,1977,2.054,2020,3.164,2133,8.589,2197,2.413,2198,2.163,2381,2.088,2383,2.353,2390,3.6,2439,2.299,2440,2.204,2448,8.015,2449,2.413,2450,2.413,2451,6.202,2452,4.005,2470,2.413,2471,2.413,2472,2.25,2473,2.413,2474,2.413,2475,4.297,2477,4.297,2478,2.413,2482,2.413,2483,2.413,2484,2.413,2485,2.413,2493,2.559,2494,2.559,2495,2.559,2496,2.559,2497,2.413,2498,4.19,2499,4.19,2500,4.556,2501,4.093,2502,2.559,2503,2.559,2504,2.559,2505,2.204,2506,2.559,2507,4.19,2508,4.297,2509,4.19,2510,2.559,2511,2.559,2512,2.353,2513,2.559,2514,2.204,2515,2.559,2516,2.559,2517,4.556,2518,2.559,2519,2.559,2520,2.353,2521,2.559,2522,2.559,2523,2.559,2524,2.559,2785,1.757,2786,2.204,2807,2.088,2835,2.299,2836,2.299,2837,2.299,2838,2.299,2839,2.299,2840,2.299,2841,2.299,2842,2.299,2906,2.559,2926,2.65,2927,2.65,2928,2.65,2929,2.65,2930,2.65,2931,2.65,2932,2.481,2933,2.895,2934,2.481,2935,2.65,2936,5.154,2937,2.65,2938,2.65,2939,2.65,2940,2.65,2941,2.895,2942,2.65,2943,2.895,2944,2.895]],["keywords/409",[]],["title/410",[1857,692.162,2945,947.258]],["content/410",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/410",[]],["title/411",[1081,621.593,1151,759.301]],["content/411",[2952,16.234,2953,16.234]],["keywords/411",[]],["title/412",[1158,722.84,1159,804.245]],["content/412",[]],["keywords/412",[]],["title/413",[345,307.098,449,301.208,3201,625.674]],["content/413",[1,9.923,57,7.977,58,2.022,72,6.357,95,4.716,149,5.157,382,5.797,400,8.963,449,7.027,508,4.906,715,7.451,1103,9.15,1227,6.664,1669,8.542,2295,10.809,3132,10.809,3201,11.177,3202,12.099]],["keywords/413",[]],["title/414",[449,365.537,508,333.282]],["content/414",[3,1.593,36,4.416,43,5.942,45,2.662,50,3.163,58,2.125,76,3.687,79,3.526,92,6.807,106,3.558,149,4.678,211,4.132,218,4.976,237,2.619,238,3.668,266,5.759,304,5.733,338,3.083,339,5.117,341,3.424,350,4.551,382,3.725,438,7.235,449,5.657,508,3.152,512,5.177,584,8.959,669,4.53,687,2.478,870,3.824,884,4.967,1012,3.744,1019,4.256,1101,6.008,1225,7.313,1297,8.161,1475,8.161,1632,6.837,1706,10.861,1723,6.22,1724,7.313,1750,8.391,1758,10.138,1976,8.161,3120,7.774,3201,7.182,3203,10.405,3204,15.381,3205,10.405,3206,10.405,3207,7.454,3208,14.689,3209,8.653,3210,9.327,3211,7.774]],["keywords/414",[]],["title/415",[508,333.282,3201,759.301]],["content/415",[27,8.462,126,10.002,149,5.84,188,7.026,218,4.909,323,5.688,417,9.672,449,6.685,460,5.032,508,5.556,693,9.672,901,6.27,902,8.769,1274,7.255,1299,9.337,1636,7.644,1669,11.154,2205,11.082,2295,12.239,2746,12.478,3132,12.239,3201,10.002,3202,10.826,3212,14.491,3213,14.491]],["keywords/415",[]],["title/416",[2295,734.248,3132,734.248]],["content/416",[4,2.6,11,1.633,18,1.429,20,1.69,22,1.178,24,6.396,43,2.113,50,0.797,56,3.697,58,1.592,62,1.868,63,2.65,75,2.16,79,2.055,80,4.462,82,1.808,106,3.841,121,3.48,124,2.829,133,2.469,145,1.715,149,4.626,156,12.123,174,3.566,185,4.111,218,1.253,237,2.579,238,2.138,273,2.753,305,2.343,319,1.59,324,1.884,325,2.735,338,1.096,339,2.369,345,3.934,350,1.146,363,1.808,370,2.007,374,2.983,385,2.185,392,2.829,397,1.9,413,2.069,436,5.279,449,6.287,458,3.049,480,3.2,493,2.136,508,1.952,511,3.884,535,2.328,585,2.705,649,1.444,650,2.395,654,1.247,660,4.179,663,1.78,687,1.535,688,2.395,740,2.902,746,6.259,762,3.83,803,6.123,937,3.48,963,2.297,967,3.857,1017,6.547,1074,2.297,1104,2.705,1105,2.553,1123,5.906,1152,6.017,1158,2.431,1159,2.705,1165,3.567,1185,2.51,1222,2.431,1272,2.239,1276,2.113,1299,1.884,1310,3.603,1311,2.6,1355,1.9,1358,2.705,1359,2.36,1416,3.149,1429,2.902,1442,2.51,1465,2.705,1619,5.197,1622,6.547,1638,2.902,1643,2.328,1669,9.841,1703,1.78,1782,7.07,1786,4.529,1794,1.988,1819,3.186,1933,5.054,1991,2.328,2192,2.267,2295,2.469,2514,4.616,2649,2.705,2651,3.186,2749,2.395,2795,2.705,2965,3.316,3112,2.764,3120,2.764,3132,14.056,3133,11.4,3140,2.902,3141,11.4,3202,6.396,3204,3.077,3207,7.338,3209,3.077,3210,3.316,3211,2.764,3214,6.444,3215,3.7,3216,5.359,3217,3.7,3218,6.444,3219,7.675,3220,3.316,3221,3.316,3222,3.316,3223,7.675,3224,9.183,3225,3.077,3226,8.519,3227,3.7,3228,3.077,3229,3.7,3230,3.316,3231,5.777,3232,3.7,3233,3.316,3234,3.316,3235,3.7,3236,3.316,3237,3.316,3238,3.316,3239,3.316,3240,3.7,3241,3.7,3242,3.7,3243,3.316,3244,3.316,3245,3.7,3246,3.316,3247,3.7,3248,5.777,3249,3.316,3250,3.316,3251,3.316,3252,5.777,3253,5.777,3254,3.316,3255,7.675,3256,7.675,3257,3.316,3258,3.316,3259,3.316,3260,5.777,3261,3.7,3262,3.316,3263,3.316,3264,3.316,3265,3.316,3266,3.316,3267,3.7,3268,3.316,3269,3.7,3270,3.7,3271,3.7,3272,3.7]],["keywords/416",[]],["title/417",[50,301.275]],["content/417",[1,4.916,3,1.317,8,3.762,20,7.464,50,3.977,58,1.002,72,4.766,76,2.843,92,3.718,106,3.815,123,10.455,149,3.867,152,5.654,174,5.058,176,4.396,211,4.822,234,4.44,238,2.003,266,4.44,273,3.427,324,6.183,364,4.304,413,4.486,449,6.373,508,2.43,512,2.129,513,4.156,514,4.353,596,4.486,669,3.745,695,3.665,746,5.865,1095,4.739,1097,5.747,1165,4.44,1216,5.638,1222,5.271,1387,4.581,1399,3.745,1569,3.204,1622,6.135,1669,7.728,1693,4.684,1719,4.533,1782,5.537,1785,5.993,1821,7.09,1836,11.814,1887,5.118,3112,10.946,3125,6.671,3132,11.714,3134,10.098,3135,10.098,3143,10.098,3201,5.537,3202,9.072,3207,5.747,3216,10.098,3226,6.671,3228,10.098,3273,6.292,3274,7.191,3275,7.191,3276,7.191,3277,7.191,3278,10.885,3279,14.646,3280,10.885,3281,10.885,3282,10.885,3283,7.191,3284,7.191,3285,7.191,3286,7.191,3287,7.191,3288,7.191,3289,8.022]],["keywords/417",[]],["title/418",[22,350.355,125,469.918]],["content/418",[8,6.359,31,9.95,58,2.175,364,5.118,449,5.789,569,13.017,596,9.742,1082,8.723,1165,9.643,3290,17.423]],["keywords/418",[]],["title/419",[45,281.443,173,674.112]],["content/419",[1,1.441,4,1.653,11,1.038,18,0.957,20,3.351,24,3.212,45,0.602,50,0.926,58,1.198,63,1.685,72,2.331,75,1.373,79,2.05,80,1.873,82,1.149,89,1.276,92,1.09,95,0.685,106,3.922,107,1.188,118,1.264,124,1.799,145,1.09,149,3.35,152,2.831,156,8.044,160,1.406,163,1.72,173,1.441,174,3.055,176,1.289,185,2.743,197,0.809,202,3.575,232,1.501,233,6.698,237,2.415,238,4.211,273,2.536,304,2.863,318,1.159,324,1.198,325,0.998,338,1.759,339,1.643,341,0.774,345,5.283,350,3.944,364,1.263,397,1.208,413,1.315,434,1.964,436,4.694,438,2.118,449,6.117,456,1.005,457,1.923,458,3.375,460,0.817,470,3.702,476,1.09,480,2.135,491,4.102,499,3.191,503,1.123,508,1.799,511,4.772,512,1.947,513,3.076,514,3.98,520,2.135,526,1.685,528,1.441,530,1.501,535,1.48,539,1.545,543,1.545,544,6.861,546,1.545,585,1.72,660,1.547,661,1.802,663,1.132,687,1.024,695,4.805,746,5.362,762,1.052,772,5.255,778,1.276,803,2.57,814,1.406,871,2.213,880,1.159,891,1.799,942,1.423,967,3.304,975,1.596,992,1.757,1017,4.541,1068,1.132,1073,1.178,1095,1.389,1123,6.34,1152,1.653,1158,1.545,1159,1.72,1165,2.379,1216,1.653,1227,0.968,1264,8.123,1272,1.423,1274,2.153,1355,1.208,1358,3.143,1359,1.501,1366,1.522,1387,2.455,1399,1.098,1415,1.697,1416,2.901,1447,1.441,1470,3.736,1569,0.939,1598,1.406,1619,3.467,1622,4.541,1629,2.025,1669,7.027,1670,1.845,1706,2.743,1715,1.315,1719,3.355,1723,1.406,1724,1.653,1725,1.72,1729,1.57,1782,5.895,1785,1.757,1821,2.51,1836,4.788,1841,2.57,1857,1.48,1904,1.956,1988,1.845,1991,1.48,2054,2.783,2133,7.3,2137,2.025,2180,1.845,2206,1.757,2448,6.808,2501,3.212,2505,1.685,2514,3.08,2543,2.025,2649,1.72,2749,1.522,2802,3.021,2934,1.897,2979,1.343,3112,5.48,3120,4.436,3125,1.956,3132,12.619,3133,7.978,3134,3.575,3135,3.575,3140,1.845,3141,4.938,3143,3.575,3201,5.063,3202,5.48,3204,1.956,3207,1.685,3209,1.956,3211,4.436,3216,3.575,3219,3.854,3220,2.109,3221,2.109,3222,2.109,3223,2.109,3224,5.323,3225,1.956,3226,4.938,3228,3.575,3230,2.109,3231,6.575,3233,2.109,3234,2.109,3236,2.109,3237,2.109,3238,2.109,3239,2.109,3243,2.109,3244,2.109,3246,2.109,3248,3.854,3249,2.109,3250,5.323,3251,3.854,3252,6.575,3253,5.323,3254,2.109,3255,5.323,3256,5.323,3257,2.109,3258,2.109,3259,2.109,3260,3.854,3262,2.109,3263,2.109,3264,2.109,3265,2.109,3266,2.109,3273,1.845,3274,2.109,3275,2.109,3276,2.109,3277,2.109,3278,3.854,3279,6.575,3280,3.854,3281,3.854,3282,3.854,3283,2.109,3284,2.109,3285,2.109,3286,2.109,3287,2.109,3288,2.109,3291,2.352,3292,2.352,3293,2.352,3294,2.352,3295,2.352,3296,2.352,3297,2.352,3298,2.352,3299,2.352,3300,2.352,3301,4.299,3302,4.299,3303,2.352,3304,2.352,3305,2.352,3306,5.938,3307,2.352,3308,2.352,3309,2.352,3310,2.352,3311,2.352,3312,2.352,3313,2.352,3314,2.352,3315,2.352,3316,2.352,3317,2.352,3318,2.352]],["keywords/419",[]],["title/420",[1627,682.927,2303,841.289]],["content/420",[]],["keywords/420",[]],["title/421",[157,387.826,416,495.593]],["content/421",[3,1.77,58,2.038,61,9.877,79,3.918,87,9.322,110,6.636,157,5.754,204,5.998,260,4.612,293,9.531,510,5.372,654,5.503,876,10.002,958,5.612,1152,11.471,1409,9.322,2304,13.574,2431,15.355,2432,15.355]],["keywords/421",[]],["title/422",[45,357.876]],["content/422",[65,9.323,79,3.605,95,4.373,157,5.294,202,12.489,305,5.461,382,5.376,449,4.99,509,8.149,512,3.985,513,7.781,654,5.063,772,10.758,778,8.149,796,6.719,900,11.779,914,13.462,957,13.462,1065,6.142,1103,8.485,1156,10.554,1284,8.977,1501,9.323,2191,9.867,2206,11.219,2433,14.127,2434,14.127,2435,14.127,2436,14.127,2437,14.127]],["keywords/422",[]],["title/423",[79,264.052,318,541.885]],["content/423",[3,1.329,7,5.521,56,3.554,58,2.475,80,5.338,106,3.107,128,9.613,145,5.68,160,7.326,204,6.817,237,3.086,241,4.811,260,3.463,305,4.457,339,3.391,396,5.521,436,6.807,456,7.925,458,3.648,473,8.459,510,4.034,512,4.363,513,6.35,514,6.651,516,8.614,518,7.82,519,11.155,551,10.987,870,4.504,944,8.78,967,5.521,1157,7.077,1415,4.839,1449,6.086,1465,8.96,1477,8.315,1480,7.326,1525,9.601,1587,7.24,1703,5.896,1713,8.459,2080,10.193,2438,8.78,2439,9.157,2440,8.78,2441,9.613,2442,9.884,2443,11.53]],["keywords/423",[]],["title/424",[778,759.051]],["content/424",[3,0.853,5,3.786,45,2.013,58,1.494,79,2.872,106,3.82,177,5.753,237,5.163,238,4.577,241,3.089,245,4.494,304,6.315,328,4.951,338,2.332,339,2.177,341,5.325,345,4.054,350,5.013,396,5.391,434,3.595,449,2.615,457,3.521,458,2.342,459,3.674,476,3.647,488,6.988,499,4.229,511,6.569,512,2.088,513,4.077,514,4.27,520,5.942,521,5.339,522,6.018,523,6.018,526,5.637,527,7.054,660,2.832,661,3.298,687,3.448,693,7.987,739,2.803,778,4.27,880,3.876,926,5.021,967,3.545,1123,7.452,1276,4.494,1310,4.4,1355,4.042,1467,4.885,1598,4.704,1627,4.885,1669,7.638,1719,4.446,1723,4.704,1724,5.531,1725,5.753,1729,5.252,2064,5.753,2105,6.544,2133,4.312,2303,6.018,2345,4.446,2438,5.637,2444,7.403,2445,7.403,2446,7.403,2447,7.403,2448,5.094,2449,9.386,2450,6.172,2451,5.432,2452,5.753,2457,7.403,2458,7.403,2459,7.403,2460,7.403,2461,7.403,2462,11.257,2463,7.403,2464,7.403,2465,7.403,2466,7.403,2713,6.346,2769,6.776,3319,7.87,3320,7.87,3321,7.87,3322,7.87]],["keywords/424",[]],["title/425",[161,1097.182]],["content/425",[7,2.807,20,2.847,24,4.656,45,2.552,89,3.382,106,3.902,107,3.146,149,1.985,152,2.405,157,2.197,160,5.962,171,4.228,193,3.725,218,2.111,237,4.832,238,4.362,260,3.524,270,4.159,321,3.725,338,1.847,339,1.724,341,3.283,345,5.282,350,3.864,396,4.493,436,5.901,457,2.788,458,3.712,460,2.164,470,7.222,491,8.718,503,2.975,508,3.022,511,5.657,528,3.819,529,5.587,530,3.976,535,3.921,539,4.095,543,4.095,544,12.269,546,4.095,548,4.034,549,4.301,552,3.229,687,1.484,688,4.034,803,3.725,876,3.819,949,3.869,967,2.807,1123,8.697,1156,4.38,1355,6.404,1710,3.921,2133,10.744,2345,3.521,2438,4.464,2448,10.092,2451,4.301,2467,5.366,2468,5.863,2469,5.863,2470,4.888,2471,4.888,2472,4.556,2473,4.888,2474,4.888,2475,7.823,2476,5.863,2477,4.888,2478,4.888,2479,11.731,2480,5.366,2481,5.863,2482,4.888,2483,4.888,2484,4.888,2485,4.888,2486,5.863,2487,5.366,2488,9.383,2489,5.863,2490,5.863,2491,5.863,2492,5.863,2979,3.559]],["keywords/425",[]],["title/426",[50,301.275]],["content/426",[18,1.341,50,3.118,58,0.982,106,3.96,145,4.724,149,3.247,160,2.791,164,3.223,233,6.022,237,1.175,238,3.615,260,2.223,273,5.11,293,2.726,319,2.007,323,1.833,331,7.633,350,1.447,364,1.372,396,6.016,436,4.22,449,3.387,460,1.621,470,5.587,491,8.612,493,5.886,499,2.509,510,1.537,512,2.088,513,4.076,514,6.492,520,2.319,544,8.76,660,1.68,661,3.297,717,2.463,732,5.092,758,3.571,778,2.534,803,2.791,814,2.791,838,2.18,958,3.505,967,6.938,1028,4.186,1068,2.246,1073,2.338,1093,6.169,1123,6.844,1204,3.404,1299,2.377,1322,3.426,1380,2.979,1399,2.18,1447,2.861,1569,5.782,1719,4.445,1793,9.109,1822,3.345,1850,3.883,1927,2.584,1958,3.571,1977,3.116,1996,3.571,2020,4.542,2257,3.662,2280,2.861,2361,3.345,2381,6.916,2383,3.571,2390,7.861,2438,3.345,2472,3.413,2493,3.883,2494,3.883,2495,3.883,2496,3.883,2497,3.662,2498,6.016,2499,6.016,2500,8.478,2501,5.877,2502,3.883,2503,3.883,2504,3.883,2505,3.345,2506,3.883,2507,10.213,2509,7.796,2510,3.883,2511,3.883,2512,7.796,2513,3.883,2514,5.636,2515,3.883,2516,3.883,2517,9.949,2518,6.542,2519,3.883,2520,6.016,2521,3.883,2522,3.883,2523,3.883,2524,3.883,2525,4.392,2526,6.542,2527,9.949,2528,4.392,2529,11.106,2530,4.392,2531,4.392,2532,4.392,2533,4.392,2534,6.542,2535,6.542,2536,4.392,2537,7.401,2538,4.392,2539,4.02,2540,4.392,2541,4.392,2542,3.883,2543,4.02,2544,4.392,2545,3.883,2546,4.392,3323,14.557]],["keywords/426",[]],["title/427",[22,350.355,125,469.918]],["content/427",[79,4.182,179,7.169,218,5.902,396,7.849,870,6.402,891,13.324,1106,8.514,1627,10.816,2278,11.116,2303,13.324,2547,16.39]],["keywords/427",[]],["title/428",[1106,683.567]],["content/428",[]],["keywords/428",[]],["title/429",[157,387.826,416,495.593]],["content/429",[3,1.703,50,4.152,61,9.501,79,3.769,87,8.968,110,6.384,157,5.536,260,4.437,293,9.169,305,5.709,460,5.453,958,5.399,1027,7.734,1152,11.035,1204,6.794,2304,13.058,2305,14.771,2306,14.771,2307,14.771,2308,14.771,2309,14.771,2310,14.771,2311,14.771]],["keywords/429",[]],["title/430",[45,357.876]],["content/430",[45,4.048,79,3.798,110,6.433,115,5.52,149,5.039,174,6.591,182,6.759,470,7.475,508,4.793,660,5.694,661,6.632,663,9.318,687,4.613,739,5.635,1272,9.574,1369,10.241,2280,9.695,2312,14.884,2313,14.884]],["keywords/430",[]],["title/431",[79,264.052,739,391.804]],["content/431",[3,1.291,19,7.203,48,9.336,56,3.451,57,5.863,58,2.013,79,3.869,101,6.113,106,3.281,115,3.392,182,5.085,237,2.997,260,3.364,330,7.489,339,4.46,380,7.705,470,4.594,510,5.305,608,9.599,739,5.741,760,4.62,778,6.459,870,4.374,904,7.945,958,5.542,1027,5.863,1106,7.877,1204,5.151,1276,6.798,1304,6.976,1312,6.951,1346,7.203,1382,7.705,1411,6.726,1415,6.364,1449,5.911,1480,7.115,1497,6.061,1501,7.389,1587,9.523,1794,6.397,2148,8.702,2314,8.527,2315,15.201,2316,11.198,2317,11.198,2318,10.25,2319,11.198,2320,9.899,2321,10.25,2322,11.198]],["keywords/431",[]],["title/432",[79,264.052,1210,546.292]],["content/432",[3,0.891,43,4.691,62,4.147,72,4.852,79,2.967,98,4.079,106,3.614,110,3.339,115,4.235,149,2.616,152,3.17,182,5.28,197,2.824,198,4.91,218,2.782,237,4.464,238,2.051,241,4.852,260,2.321,293,4.796,325,5.246,327,5.728,328,5.168,338,2.434,339,4.112,341,4.068,345,2.782,357,5.884,364,2.413,397,4.218,458,3.679,459,3.834,460,5.161,470,7.677,476,3.806,488,4.796,499,6.643,503,7.095,654,2.769,660,6.704,687,3.539,717,4.333,718,4.641,739,4.402,762,3.675,958,2.824,1105,5.669,1106,6.04,1175,6.136,1210,4.079,1272,4.97,1304,3.554,1382,5.316,1408,6.83,1617,6.83,1668,5.669,1728,8.386,1786,5.772,1794,4.414,2246,6.281,2255,7.072,2281,6.83,2314,5.884,2315,10.279,2324,7.727,2325,7.727,2326,7.727,2327,6.83,2328,11.365,2329,6.83,2334,7.727,2335,7.727,2336,7.727,2337,7.727,2340,7.727,2341,7.727,2345,6.984,2349,7.727,2350,6.83,2713,6.623,2715,6.623,2979,7.059,3324,8.214,3325,8.214,3326,8.214,3327,8.214,3328,8.214,3329,8.214,3330,8.214]],["keywords/432",[]],["title/433",[157,387.826,508,333.282]],["content/433",[12,5.1,18,0.872,19,4.708,56,2.256,58,1.795,72,3.054,79,1.868,106,3.799,107,3.928,115,3.381,118,4.182,149,3.778,152,3.003,237,4.049,238,3.591,260,2.199,325,3.302,338,2.306,341,2.561,345,2.636,348,7.918,350,4.455,356,9.305,397,3.996,413,4.35,454,5.813,457,3.481,458,4.28,460,4.993,470,6.207,487,5.813,488,4.543,499,4.182,503,5.664,508,4.356,510,3.904,552,4.031,572,6.975,652,5.459,654,2.623,661,3.261,663,5.707,678,4.263,687,4.124,695,5.42,739,2.771,760,3.02,901,3.367,1077,6.274,1106,3.802,1204,3.367,1217,4.492,1322,5.167,1514,4.306,1528,5.193,1547,5.95,1600,6.928,1703,3.743,1727,5.95,1728,9.755,1841,4.651,2070,5.813,2133,6.501,2280,4.768,2314,5.574,2327,6.47,2328,5.95,2329,6.47,2351,7.319,2352,7.319,2353,7.319,2354,7.319,2355,7.319,2356,7.319,2357,7.319,2358,7.319,2359,7.319,2360,7.319,2361,5.574,2362,7.319,2363,7.319,2364,11.16,2365,7.319,2366,7.319,2367,6.47,2368,9.567,2369,7.319,2370,6.47,2371,7.319,2372,7.319,2373,7.319,2374,7.319,2375,11.16,2376,6.47,2377,7.319,2378,7.319,2979,4.444]],["keywords/433",[]],["title/434",[50,301.275]],["content/434",[3,0.486,5,2.158,11,1.98,12,1.929,16,1.967,18,1.921,22,1.429,50,3.568,54,2.62,56,1.301,58,1.887,60,2.986,72,3.887,76,1.59,79,2.377,80,1.954,82,2.192,92,3.525,106,3.556,115,4.721,119,2.389,152,1.732,169,1.954,174,5.906,180,4.344,191,4.298,197,1.543,199,4.022,218,1.52,238,3.259,241,4.577,245,4.344,260,1.268,263,4.022,273,3.249,293,4.442,303,2.862,323,2.986,325,3.228,327,3.525,338,1.33,350,2.357,364,1.318,412,2.715,430,2.325,436,1.857,438,3.747,457,2.007,458,3.47,460,4.049,470,6.809,499,2.411,508,1.359,510,1.477,512,1.191,580,1.869,589,3.519,611,4.022,639,2.948,649,1.751,661,4.15,687,3.945,695,4.523,715,2.064,717,2.367,739,3.526,775,4.022,814,2.682,884,3.631,896,2.094,901,4.284,958,3.404,968,3.431,1019,1.835,1065,1.835,1068,2.158,1073,2.246,1077,3.618,1081,5.594,1082,2.246,1093,2.715,1106,4.838,1130,7.336,1156,5.346,1160,4.022,1204,1.941,1210,3.777,1217,2.591,1225,3.153,1227,4.074,1272,2.715,1274,3.808,1276,2.562,1299,2.284,1304,1.941,1368,5.683,1369,2.904,1382,2.904,1399,3.551,1445,2.948,1467,2.785,1569,6.349,1600,2.62,1625,3.214,1627,2.785,1628,3.731,1636,2.367,1668,3.097,1703,3.659,1728,8.855,1786,3.153,1793,9.508,1804,6.326,1821,4.442,1872,3.519,1904,3.731,1924,3.28,1926,3.731,1927,2.483,1964,2.562,2020,9.564,2246,3.431,2247,3.519,2277,3.731,2280,2.749,2297,3.731,2314,3.214,2328,5.817,2342,3.863,2361,3.214,2367,3.731,2370,3.731,2379,10.969,2380,7.155,2381,5.161,2382,3.731,2383,3.431,2384,4.221,2385,7.155,2386,7.155,2388,7.155,2389,4.221,2390,4.998,2391,4.221,2392,7.155,2393,4.221,2394,3.519,2395,4.221,2396,4.221,2397,4.221,2398,4.221,2399,4.221,2400,4.221,2401,4.221,2402,4.221,2403,3.731,2404,3.863,2405,4.221,2406,3.731,2407,4.221,2408,4.221,2409,4.221,2410,3.731,2411,4.221,2412,4.221,2413,4.221,2414,4.221,2415,4.221,2416,3.863,2417,4.221,2418,4.221,2419,3.731,2420,3.519,2421,4.221,2422,4.221,2423,4.221,2424,4.221,2425,4.221,2426,4.221,3331,8.291]],["keywords/434",[]],["title/435",[2427,1163.321]],["content/435",[18,2.212,50,3.515,58,2.038,76,5.783,79,3.918,85,10.413,364,4.795,382,5.843,678,8.944,739,5.813,776,6.841,1095,9.642,1103,9.222,1106,7.976,1175,12.194,2428,15.355,2429,15.355,2430,14.054]],["keywords/435",[]],["title/436",[22,350.355,125,469.918]],["content/436",[22,5.844,82,8.967,396,8.267,508,5.56,678,10.056]],["keywords/436",[]],["title/437",[650,712.065,3332,759.301]],["content/437",[]],["keywords/437",[]],["title/438",[18,101.574,3332,625.674,3333,753.863]],["content/438",[18,1.72,72,6.026,80,6.687,149,4.889,157,5.412,434,7.014,470,5.925,958,5.278,1059,12.38,1065,6.279,1158,10.087,1312,8.965,1466,10.087,1508,10.087,2505,10.998,3085,12.041,3332,10.596,3334,15.811,3335,15.352,3336,15.352,3337,15.352,3338,15.352,3339,12.767,3340,15.352,3341,15.352,3342,15.352]],["keywords/438",[]],["title/439",[36,466.935,1793,692.162]],["content/439",[3,2.255,36,6.614,58,1.946,149,6.911,449,5.178,512,4.136,669,5.919,870,7.051,1074,9.674,1131,6.878,1158,10.239,1758,13.244,2287,13.418,3085,12.223,3332,10.756,3333,12.96,3343,13.97]],["keywords/439",[]],["title/440",[18,123.267,508,333.282]],["content/440",[3,0.581,18,1.68,45,0.768,50,1.9,56,0.87,58,1.524,79,2.118,92,1.391,98,1.49,106,3.863,134,6.92,145,1.391,149,2.312,160,1.794,173,1.839,179,1.235,197,1.842,214,2.242,215,5.797,218,1.815,237,3.904,238,2.809,241,1.178,243,5.477,245,1.714,260,1.514,273,2.289,293,3.129,304,3.955,305,2.639,318,1.478,319,2.304,321,1.794,338,1.588,339,2.803,341,0.988,345,3.433,350,1.66,357,3.838,364,0.882,373,1.644,413,1.678,426,3.728,430,1.555,436,1.242,449,3.737,456,2.289,457,1.343,458,2.626,460,3.064,470,4.34,476,1.391,503,4.212,508,0.909,510,1.763,516,5.101,528,1.839,535,1.888,650,1.943,654,1.012,660,1.08,682,1.972,687,2.907,718,1.696,739,1.069,905,1.816,958,3.484,961,2.003,967,4.565,975,2.036,1002,1.773,1025,6.591,1054,1.598,1065,1.227,1075,1.943,1093,5.339,1106,3.547,1180,3.242,1203,1.943,1204,3.818,1210,1.49,1244,7.408,1304,1.299,1310,2.996,1322,1.307,1351,2.194,1352,1.915,1366,3.468,1399,1.401,1442,2.036,1448,2.003,1470,1.888,1481,4.321,1491,5.477,1497,1.528,1508,3.521,1569,2.899,1600,1.752,1623,2.194,1669,2.826,1710,1.888,1715,1.678,1717,2.194,1758,3.698,1794,3.901,1810,3.917,1821,3.129,1927,1.661,1977,2.003,2021,2.354,2042,2.42,2156,4.614,2191,1.972,2192,1.839,2205,2.295,2247,2.354,2280,3.283,2345,3.027,2390,1.972,2394,4.203,2441,2.354,2648,2.584,2749,3.468,2765,2.42,2895,2.42,2979,1.714,3113,2.69,3207,2.15,3211,2.242,3273,2.354,3332,12.44,3334,7.337,3339,2.496,3343,2.69,3344,3.001,3345,3.001,3346,3.001,3347,3.001,3348,3.001,3349,3.001,3350,3.001,3351,3.001,3352,3.001,3353,9.084,3354,7.258,3355,7.258,3356,7.258,3357,9.084,3358,8.823,3359,10.082,3360,8.823,3361,13.901,3362,3.001,3363,3.001,3364,3.001,3365,3.001,3366,3.001,3367,3.001,3368,3.001,3369,3.001,3370,3.001,3371,3.001,3372,3.001,3373,7.909,3374,6.507,3375,3.001,3376,5.358,3377,3.001,3378,3.001,3379,3.001,3380,3.001,3381,3.001,3382,3.001,3383,3.001,3384,7.909,3385,2.69,3386,2.69,3387,7.258,3388,3.001,3389,3.001,3390,3.001,3391,3.001,3392,3.001,3393,3.001,3394,3.001,3395,3.001,3396,5.358,3397,3.001,3398,2.69,3399,2.69,3400,3.001,3401,3.001,3402,5.358,3403,3.001,3404,2.69,3405,3.001,3406,5.358,3407,7.258,3408,3.001,3409,3.001,3410,2.69,3411,2.69,3412,3.001,3413,3.001,3414,3.001,3415,3.001,3416,3.001,3417,3.001,3418,3.001,3419,3.001,3420,3.001,3421,3.001,3422,3.001,3423,3.001,3424,3.001,3425,2.69,3426,3.001,3427,6.507,3428,3.001,3429,3.001,3430,3.001,3431,3.001,3432,5.358,3433,6.507,3434,5.358,3435,3.001,3436,3.001,3437,2.69,3438,3.001,3439,3.001,3440,4.803,3441,2.69,3442,2.69,3443,2.354,3444,3.001,3445,5.358,3446,2.69,3447,2.69,3448,5.358,3449,7.258,3450,2.69,3451,5.358,3452,3.001,3453,2.69,3454,3.001,3455,3.001,3456,3.001,3457,3.001,3458,3.001,3459,3.001,3460,3.001,3461,3.001,3462,3.001,3463,3.001,3464,3.001,3465,3.001,3466,2.69,3467,3.001,3468,2.69,3469,3.001]],["keywords/440",[]],["title/441",[2895,1128.04]],["content/441",[3,0.84,16,1.428,18,1.742,20,5.842,29,1.734,50,1.241,56,2.246,58,1.791,79,0.782,106,3.855,115,1.642,119,1.734,134,4.519,149,3.766,152,1.257,160,5.596,171,2.209,179,2.371,197,1.981,235,2.626,237,3.771,238,3.741,243,2.022,260,2.189,270,2.173,273,2.461,288,1.821,304,1.271,305,2.817,319,2.477,338,2.296,339,1.594,341,1.896,342,1.88,345,4.006,350,2.901,357,4.127,373,3.157,381,2.708,406,1.718,417,2.173,430,2.985,436,1.348,449,1.082,457,5.291,458,4.627,460,3.715,470,2.99,480,1.617,503,2.751,516,2.289,528,1.995,660,1.172,669,1.777,672,2.919,687,3.045,739,2.052,819,2.381,870,2.847,884,1.555,950,5.257,958,1.12,967,4.82,1075,6.06,1082,1.63,1093,3.486,1131,1.437,1161,3.676,1173,2.49,1180,3.486,1203,12.528,1204,1.409,1238,2.919,1244,4.212,1247,2.381,1272,1.971,1322,1.418,1351,2.381,1352,2.078,1355,1.672,1366,3.729,1377,4.212,1387,4.425,1395,3.255,1399,1.52,1415,1.286,1419,2.333,1442,2.209,1448,2.173,1481,2.626,1491,4.81,1569,3.095,1597,1.718,1623,2.381,1648,2.433,1669,3.039,1710,3.625,1715,1.821,1810,4.212,1821,3.364,1841,3.444,1927,1.802,1977,2.173,1986,2.108,2037,2.49,2042,2.626,2192,3.53,2206,5.789,2251,2.804,2254,2.804,2260,2.804,2274,2.804,2318,2.804,2330,3.063,2344,3.063,2390,2.14,2420,2.554,2765,2.626,2772,2.804,2932,2.626,2970,4.304,2979,3.29,3207,2.333,3211,2.433,3273,2.554,3332,12.163,3333,7.786,3334,7.786,3339,2.708,3353,8.393,3357,2.919,3359,5.165,3361,12.207,3373,2.919,3374,2.919,3384,2.919,3385,2.919,3386,2.919,3398,5.165,3399,2.919,3404,2.919,3410,2.919,3411,2.919,3425,2.919,3427,8.393,3433,8.393,3437,2.919,3440,5.165,3441,2.919,3442,2.919,3443,6.077,3446,2.919,3447,2.919,3450,2.919,3453,2.919,3466,2.919,3470,3.257,3471,7.748,3472,3.257,3473,3.257,3474,3.257,3475,3.257,3476,3.257,3477,7.748,3478,3.257,3479,3.257,3480,2.919,3481,9.362,3482,7.748,3483,3.257,3484,3.257,3485,5.762,3486,7.748,3487,3.257,3488,3.257,3489,3.257,3490,3.257,3491,3.257,3492,3.257,3493,3.257,3494,3.257,3495,5.762,3496,3.257,3497,3.257,3498,3.257,3499,3.257,3500,3.257,3501,3.257,3502,5.762,3503,3.257,3504,3.257,3505,3.257,3506,3.257,3507,5.165,3508,3.257,3509,3.257,3510,3.257,3511,3.257,3512,3.257,3513,3.257,3514,3.257,3515,3.257,3516,3.257,3517,3.257,3518,3.257,3519,3.257,3520,3.257,3521,3.257,3522,3.257,3523,3.257,3524,3.257,3525,3.257,3526,5.762,3527,5.762,3528,5.762,3529,5.762,3530,3.257,3531,3.257,3532,3.257,3533,3.257,3534,3.257,3535,3.257]],["keywords/441",[]],["title/442",[853,965.506]],["content/442",[3,1.703,18,1.759,57,7.734,58,1.96,79,3.769,82,7.673,115,4.475,157,5.536,322,11.479,460,5.453,614,11.035,650,10.163,678,8.604,687,3.739,870,5.77,958,5.399,1054,8.36,1158,10.317,1312,9.169,1428,10.48,1732,13.52,2278,10.018,3085,12.316,3332,10.838]],["keywords/442",[]],["title/443",[1716,1002.099]],["content/443",[]],["keywords/443",[]],["title/444",[45,357.876]],["content/444",[65,10.549,79,4.854,149,5.412,396,7.655,470,8.332,663,8.175,1669,8.964,2750,15.986,2751,15.986,2752,15.986,2753,15.986]],["keywords/444",[]],["title/445",[79,264.052,318,541.885]],["content/445",[56,4.172,58,2.504,60,5.649,76,5.099,79,4.813,106,3.057,115,4.101,218,4.875,237,3.623,318,7.088,338,4.264,339,3.981,396,8.225,397,7.39,654,4.851,739,6.502,1106,8.921,1174,11.604,1449,7.146,1500,10.309,1711,11.967,1712,11.967,1716,13.079,1717,10.52,1718,11.967,2754,11.967,2755,13.537]],["keywords/445",[]],["title/446",[1706,892.464]],["content/446",[16,2.955,19,4.078,29,3.588,56,3.078,58,1.325,61,4.078,79,1.618,106,3.845,237,5.203,238,5.161,241,2.646,304,5.814,324,3.432,338,1.997,341,2.218,345,5.83,350,5.58,364,1.98,378,4.573,385,3.981,396,3.036,406,3.555,430,3.492,457,3.016,458,3.908,459,3.146,470,5.067,476,3.124,487,5.035,491,7.342,511,6.757,512,1.789,513,5.499,514,5.76,520,5.271,526,4.828,528,4.13,530,4.3,539,4.429,543,4.429,544,7.945,546,4.429,661,2.825,1106,5.187,1123,7.586,1217,3.892,1222,4.429,1274,3.375,1297,5.287,1355,3.462,1480,4.029,1547,5.154,1566,4.184,1668,4.652,1669,3.555,1706,4.3,1713,4.652,1716,4.828,1719,5.998,1720,5.605,1721,5.605,1723,4.029,1724,4.737,1725,4.927,1727,5.154,1728,4.573,1729,4.499,1731,5.605,2133,10.519,2258,5.605,2441,5.287,2448,9.642,2754,5.605,2756,6.341,2757,6.341,2758,6.341,2759,6.341,2760,6.341,2761,6.341,2762,6.341,2763,6.341,2764,6.341,2765,5.435,2766,6.341,2767,6.341,2768,6.341,2769,5.804,2770,6.341,2771,6.341,2772,5.804,2773,6.341,2774,6.341,2775,6.341,2776,6.341,2777,6.341]],["keywords/446",[]],["title/447",[2427,1163.321]],["content/447",[3,1.677,17,6.288,18,1.733,19,9.359,36,6.565,50,3.331,56,4.485,65,9.602,78,11.555,79,3.712,139,11.555,155,12.131,157,5.453,221,10.163,416,6.968,618,13.865,635,12.863,718,8.739,949,9.602,1469,11.08,1521,11.307,1887,9.868,2278,9.868,2778,14.55,2779,14.55,2780,13.318]],["keywords/447",[]],["title/448",[3,119.285,416,495.593]],["content/448",[]],["keywords/448",[]],["title/449",[22,350.355,125,469.918]],["content/449",[3,1.905,36,7.458,76,6.226,89,9.534,92,8.143,95,5.117,149,5.596,223,9.628,466,9.534,683,8.871]],["keywords/449",[]],["title/450",[2302,868.391]],["content/450",[]],["keywords/450",[]],["title/451",[45,357.876]],["content/451",[18,1.858,48,13.008,79,3.981,92,7.686,319,7.13,600,11.069,649,6.473,687,3.949,739,5.906,760,8.292,1299,8.444,1606,10.897,2694,10.734,2695,15.601,2696,15.601]],["keywords/451",[]],["title/452",[460,382.009,958,378.226]],["content/452",[3,1.387,58,2.111,82,6.249,106,3.736,174,7.045,179,5.262,237,5.279,318,6.299,337,8.277,339,4.679,458,5.64,460,5.873,503,6.105,715,5.884,739,4.554,958,5.815,1380,8.158,1449,6.35,2345,9.556,2346,11.463,2694,10.947,2697,15.91,2698,15.91,2699,12.029,2700,12.933,2701,12.029,2702,8.676,2703,12.029,2704,12.029,2979,7.303,3075,9.16]],["keywords/452",[]],["title/453",[79,264.052,318,541.885]],["content/453",[18,1.733,57,7.619,58,1.931,79,3.712,106,3.624,237,3.894,339,4.279,480,7.681,510,5.09,654,5.214,1027,7.619,1415,6.106,1587,9.137,1986,10.011,1991,9.731,2191,10.163,2302,9.602,2320,12.863,2694,12.363,2700,11.828,2702,10.494,2705,12.863]],["keywords/453",[]],["title/454",[319,472.947,600,734.248]],["content/454",[12,4.661,18,2.298,20,4.953,45,2.774,79,2.602,106,3.771,218,3.673,237,4.382,238,4.347,260,3.064,319,6.499,338,3.213,341,4.976,350,3.359,380,7.018,480,5.384,600,7.236,649,5.901,661,4.544,687,3.6,760,6.756,880,5.34,901,4.691,1061,6.56,1175,8.1,1217,6.26,1313,8.743,1415,4.28,1532,9.016,1600,6.331,1606,7.124,1846,6.56,2271,9.016,2302,6.73,2339,9.719,2350,9.016,2694,11.267,2702,7.356,2705,12.573,2706,10.199,2707,10.199,2708,10.199,2709,14.222,2710,10.199,2711,10.199,2712,10.199,2713,8.743,2714,10.199,2715,8.743,2716,10.199,2717,10.199,2718,10.199,2719,10.199]],["keywords/454",[]],["title/455",[1165,774.227]],["content/455",[18,1.415,43,7.214,79,3.032,106,3.809,141,9.437,174,6.988,237,4.223,238,4.189,341,4.157,345,5.683,687,3.008,718,9.478,760,7.31,762,5.651,949,7.841,958,4.343,992,9.437,1204,5.466,1322,5.501,1355,8.615,1625,9.048,2302,7.841,2694,12.191,2700,14.403,2702,8.57,2720,11.882,2721,10.504,2722,11.882,2723,11.882,2724,11.882,2725,10.504,2726,11.882,2727,11.882,2728,11.882,2729,11.882]],["keywords/455",[]],["title/456",[1186,615.129,2302,682.927]],["content/456",[18,2.05,19,5.353,50,3.345,57,4.357,58,2.284,63,6.337,76,3.135,79,3.136,80,3.853,106,3.874,115,3.723,152,5.042,198,5.288,218,2.997,237,4.606,238,4.569,260,3.691,273,3.779,323,3.472,338,3.871,339,2.447,341,2.911,345,5.262,350,2.741,485,7.617,486,9.99,508,2.68,687,2.107,715,4.07,760,3.433,814,5.288,838,4.13,942,5.353,1027,4.357,1068,4.256,1073,4.429,1093,5.353,1186,8.685,1191,6.337,1199,7.93,1201,7.617,1202,7.93,1385,5.644,1395,7.381,1398,5.288,1399,4.13,1415,3.492,1782,6.106,1964,5.052,2302,5.492,2694,5.726,2702,6.002,2721,7.357,2725,7.357,2730,8.322,2731,14.611,2732,8.322,2733,8.322,2734,8.322,2735,8.322,2736,8.322,2737,8.322,2738,8.322,2739,8.322,2740,8.322,2741,8.322,2742,8.322,2743,8.322,2744,8.322,2745,8.322,2746,11.248,2747,8.322]],["keywords/456",[]],["title/457",[552,469.66,654,305.605,1409,517.71]],["content/457",[]],["keywords/457",[]],["title/458",[552,469.66,1410,753.863,1411,512.201]],["content/458",[3,2.153,15,6.549,18,1.847,56,2.845,58,2.058,132,6.549,157,3.459,178,5.544,182,4.191,204,6.056,218,3.324,258,5.122,260,5.779,305,7.219,385,5.796,436,4.062,456,8.148,510,5.928,512,2.604,552,5.084,650,6.351,654,6.43,796,4.39,880,6.939,905,5.937,924,7.173,944,7.029,1019,4.013,1027,6.939,1081,5.544,1082,7.053,1227,4.038,1312,5.73,1409,5.604,1410,8.16,1411,9.312,1412,8.449,1413,9.231,1414,9.231,1415,7.839,1416,8.801,1417,10.092,1418,8.449,1419,10.092,1420,9.231,1421,10.773,1422,7.029,1423,7.173,1424,8.16,1425,9.231,1426,8.449,1427,6.549,1428,6.549]],["keywords/458",[]],["title/459",[552,469.66,654,305.605,1409,517.71]],["content/459",[]],["keywords/459",[]],["title/460",[950,949.064]],["content/460",[3,1.468,12,5.822,72,5.315,79,4.215,106,3.665,133,9.038,237,3.409,260,6.036,305,4.924,337,8.765,339,3.746,654,4.565,663,8.447,664,11.261,687,3.225,950,11.913,976,9.9,1019,5.538,1027,6.67,1127,8.406,1191,12.578,1411,7.651,1415,5.346,1429,10.621,1430,12.739,1431,11.66,1433,11.261,1434,12.739,1435,12.739,1558,9.9,2143,9.9,2748,13.542]],["keywords/460",[]],["title/461",[456,469.918,1409,628.279]],["content/461",[3,1.32,58,1.833,75,4.703,76,2.854,79,4.22,82,3.935,95,3.546,106,3.511,115,2.295,132,5.375,139,6.017,204,5.396,218,2.728,232,7.77,237,3.697,238,3.041,260,5.427,304,7.718,338,3.609,339,2.228,341,2.65,345,2.728,350,3.773,382,2.883,434,5.564,449,2.676,456,8.447,474,7.219,480,3.999,510,4.008,511,3.653,650,5.213,654,2.715,660,2.898,687,1.918,695,3.679,760,3.126,838,5.685,859,6.017,876,7.462,884,3.845,896,3.76,904,5.375,907,5.66,942,4.873,961,5.375,1027,3.967,1065,3.294,1227,3.314,1284,4.814,1299,4.101,1304,3.485,1409,4.599,1419,5.769,1421,6.159,1436,6.934,1437,6.934,1438,7.576,1439,4.457,1442,5.464,1443,7.576,1444,5.888,1445,5.292,1446,6.697,1447,4.935,1448,5.375,1449,3.999,1450,7.576,1451,6.697,1452,6.159,1453,7.576,1454,7.576,1455,6.697,1456,7.576,1457,7.576,1458,7.576,1459,7.576,1460,11.456,1461,11.456,1462,7.576,1463,7.576,1464,7.576,1465,5.888,1466,5.292,1467,4.999,1468,4.999,1469,5.769,1470,5.067,1471,7.576,1472,7.576,1473,7.576,1474,7.576,1475,6.317,1476,7.576,1477,5.464,1598,4.814,2749,5.213]],["keywords/461",[]],["title/462",[18,123.267,1478,914.868]],["content/462",[18,1.184,45,2.703,58,2.143,106,3.81,233,6.241,237,4.939,238,4.65,273,4.513,304,7.657,338,3.131,339,2.923,341,3.477,345,5.03,350,5.319,449,5.704,456,4.513,458,5.109,552,5.474,654,3.562,838,6.931,950,7.168,970,8.786,1123,4.295,1179,8.786,1186,5.907,1449,5.246,1451,8.786,1455,12.347,1478,14.275,1479,9.938,1480,6.315,1481,8.519,1482,9.938,1483,9.938,1484,9.938,1485,9.938,1486,9.938,1487,9.938,1488,9.938,1489,9.938,1490,14.604,1491,9.217,1492,13.967,1493,9.938,1494,9.938,1495,9.938]],["keywords/462",[]],["title/463",[853,965.506]],["content/463",[3,1.92,6,7.109,17,5.578,18,2.197,46,7.753,65,8.518,79,4.251,87,7.836,101,7.047,103,13.23,131,8.012,148,11.065,157,4.837,178,7.753,179,5.646,204,6.508,260,3.877,305,6.439,382,4.912,508,4.157,552,7.109,654,4.626,760,5.325,915,12.3,950,9.309,1027,6.759,1164,9.829,1191,9.829,1409,7.836,1444,10.031,1465,10.031,1496,12.908,1497,6.987,1498,12.908,1499,12.908,1500,9.829]],["keywords/463",[]],["title/464",[18,101.574,258,329.615,1323,541.872]],["content/464",[]],["keywords/464",[]],["title/465",[18,101.574,258,329.615,1323,541.872]],["content/465",[3,1.97,18,2.185,22,3.748,58,1.997,62,5.941,143,11.459,176,6.448,197,4.046,209,7.157,258,7.09,378,7.984,380,7.617,409,6.097,416,5.301,512,4.823,656,7.305,669,4.934,682,7.732,701,6.152,708,8.853,714,9.23,763,6.324,819,8.603,887,7.854,1012,6.539,1065,4.813,1130,7.404,1131,7.06,1232,8.792,1323,7.034,1324,9.786,1325,8.999,1326,13.968,1327,9.786,1328,11.07,1329,9.23,1330,9.786,1331,8.43,1332,8.999,1333,13.302,1334,11.07,1335,11.07,1336,8.271,1337,9.786,1338,11.07,1339,8.999]],["keywords/465",[]],["title/466",[18,123.267,703,821.883]],["content/466",[3,1.508,5,6.69,8,4.309,31,10.201,58,2.23,62,7.021,98,6.905,197,4.781,208,7.335,209,10.03,578,10.389,625,13.345,649,5.428,669,4.289,703,10.389,857,9.137,935,12.119,1012,7.101,1187,12.466,1223,11.214,1254,11.214,1339,15.091,1340,10.907,1341,14.855,1342,11.564,1343,11.974]],["keywords/466",[]],["title/467",[50,195.235,211,359.958,1323,541.872]],["content/467",[3,1.756,8,5.018,50,4.555,56,5.696,58,2.453,191,9.15,211,7.801,669,4.995,776,8.234,1065,6.623,1095,9.566,1131,7.148,1323,9.68,1345,13.467]],["keywords/467",[]],["title/468",[1029,657.601,1346,665.681]],["content/468",[8,4.089,36,5.601,50,3.718,58,2.156,157,6.087,209,7.725,211,5.24,218,4.47,258,6.278,323,5.18,625,9.858,660,4.748,669,5.325,701,6.898,714,10.35,776,5.531,820,12.134,887,8.807,935,8.953,966,8.807,1065,5.397,1095,7.795,1131,5.824,1254,10.641,1324,10.974,1325,10.091,1326,13.786,1327,10.974,1331,9.453,1332,10.091,1333,10.974,1337,10.974,1339,15.611,1341,10.974,1342,10.974,1345,10.974,1347,12.413]],["keywords/468",[]],["title/469",[1304,605.3]],["content/469",[]],["keywords/469",[]],["title/470",[1054,744.754]],["content/470",[16,6.781,17,6.288,18,2.14,29,8.235,56,4.485,60,6.071,87,8.833,110,6.288,215,10.163,285,9.478,324,7.875,449,5.139,459,7.22,577,13.318,687,3.683,1054,8.235,1157,8.931,1304,8.265,1348,17.968,1349,13.318,1350,14.55,1351,11.307,1352,9.868]],["keywords/470",[]],["title/471",[95,407.35]],["content/471",[106,3.879,215,8.15,237,3.123,238,3.098,243,7.7,260,3.505,285,7.601,319,5.332,345,4.202,449,4.121,457,7.415,458,4.933,511,5.627,687,2.954,760,4.814,890,6.865,958,4.264,1054,6.604,1123,7.588,1204,5.367,1298,9.485,1322,5.402,1352,7.913,1353,10.68,1354,10.68,1355,6.37,1356,9.729,1357,14.27,1358,9.068,1359,7.913,1360,10.68,1361,11.668,1362,9.267,1363,10.68,1364,10.68,1365,10.68,1366,8.028,1367,11.668,1368,9.267,1369,8.028,1370,8.561,1371,10.68]],["keywords/471",[]],["title/472",[1369,712.065,1372,1034.893]],["content/472",[3,1.44,6,6.881,17,5.399,18,1.943,58,1.658,74,11.905,80,5.784,115,5.501,134,10.416,145,6.155,173,8.138,181,8.726,182,7.406,251,9.514,319,5.709,441,11.044,597,9.709,600,8.864,649,5.183,661,5.566,687,4.597,760,5.154,818,8.244,876,8.138,880,6.542,890,7.35,949,8.244,1276,7.585,1304,5.747,1373,16.31,1374,16.31,1375,12.493,1376,11.435,1377,9.709,1378,9.922,1379,11.435,1380,8.473,1381,12.493,1382,8.596,1383,10.156]],["keywords/472",[]],["title/473",[95,407.35]],["content/473",[18,1.268,50,3.354,58,1.944,106,3.954,152,6.01,188,5.487,237,3.921,238,4.447,273,4.834,288,6.328,338,4.615,339,3.131,341,5.126,345,5.276,350,3.506,697,10.749,809,10.145,814,6.765,838,5.283,1068,5.444,1073,5.666,1186,6.328,1383,8.654,1384,16.751,1385,7.22,1386,10.646,1387,6.463,1388,10.646,1389,10.646,1390,10.646,1391,10.646,1392,10.646,1393,10.646,1394,9.411,1395,8.8,1396,8.876,1397,10.646,1398,6.765,1399,5.283,1400,10.646,1401,10.646,1402,10.646]],["keywords/473",[]],["title/474",[1304,476.025,1403,1034.893]],["content/474",[72,5.769,106,3.745,110,5.975,180,8.394,238,4.621,324,7.483,382,5.261,459,6.861,687,3.5,890,8.134,944,10.528,1054,7.825,1161,11.804,1304,8.762,1352,11.804,1382,9.513,1383,11.239,1404,10.98,1405,12.222,1406,13.826,1407,14.149,1408,12.222]],["keywords/474",[]],["title/475",[58,113.175,457,405.573,1593,637.091]],["content/475",[]],["keywords/475",[]],["title/476",[18,156.743]],["content/476",[11,2.89,18,1.79,45,3.75,58,1.609,95,1.907,106,3.945,107,3.306,118,3.519,145,4.808,152,2.527,174,2.728,221,4.302,233,3.868,237,5.167,238,3.99,243,7.999,260,1.85,285,4.012,319,2.815,338,1.94,339,3.565,341,2.155,345,4.365,350,3.214,445,4.892,449,3.447,456,2.797,457,4.642,458,5.498,460,4.474,476,3.035,503,3.126,518,6.619,548,4.238,649,2.556,661,2.745,678,3.588,695,4.74,760,2.541,890,3.624,958,5.04,1123,6.91,1204,2.833,1322,2.852,1352,4.178,1353,5.638,1354,5.638,1355,3.363,1356,5.136,1357,8.933,1358,4.787,1359,8.22,1360,5.638,1362,4.892,1363,5.638,1364,5.638,1365,5.638,1378,10.951,1380,4.178,1407,11.209,1415,2.585,1449,3.252,1491,9.099,1567,4.065,2037,5.007,2133,3.588,2345,5.862,2979,3.74,3225,5.445,3480,5.87,3536,10.715,3537,6.548,3538,6.548,3539,6.548,3540,9.3,3541,10.375,3542,6.548,3543,6.548,3544,6.548,3545,6.548,3546,6.548,3547,12.885,3548,12.885,3549,6.548,3550,6.548,3551,6.548,3552,6.548]],["keywords/476",[]],["title/477",[1132,826.325]],["content/477",[3,1.047,8,2.991,16,1.901,18,1.896,29,2.308,45,2.47,50,1.591,56,1.257,58,1.738,98,2.153,106,3.918,109,3.239,110,1.763,115,2.751,145,5.929,150,3.699,152,3.726,157,3.404,180,2.476,182,1.852,187,2.4,204,2.715,209,3.306,211,3.834,215,2.849,228,4.319,238,1.083,239,2.054,243,5.993,258,2.687,273,1.852,285,2.657,287,2.942,288,4.131,301,7.87,331,6.159,350,1.343,361,5.293,363,5.572,364,4.599,373,7.01,413,2.425,428,2.894,430,2.246,436,1.795,445,3.239,449,1.441,457,4.319,512,2.562,596,2.425,649,4.451,660,1.56,669,2.279,682,10.286,701,3.862,763,2.33,776,1.817,850,8.029,901,3.197,902,4.471,1012,1.56,1019,1.773,1029,2.592,1034,2.561,1035,4.471,1065,1.773,1082,4.834,1131,1.914,1133,4.22,1135,4.587,1138,4.131,1216,9.786,1243,3.316,1265,4.079,1274,3.699,1276,5.514,1283,2.942,1378,7.213,1407,8.72,1418,3.734,1491,2.692,1497,2.208,1553,4.049,1559,3.734,1563,3.734,1569,2.951,1593,5.193,1641,2.592,1643,2.728,1707,3.734,1710,2.728,1757,3.047,1764,3.106,1773,2.942,1809,3.401,1811,6.249,1845,3.497,1846,4.471,1848,3.497,1851,7.785,1927,2.4,1964,2.476,2191,2.849,2272,3.497,2321,3.734,2381,2.942,2467,3.734,2497,3.401,2568,6.362,2569,8.313,2570,3.734,2571,3.734,2572,6.362,2573,3.497,2574,3.734,2575,3.734,2576,3.734,2577,3.734,2580,3.401,2591,3.734,2609,3.734,2960,6.951,3075,3.106,3140,5.795,3159,6.623,3160,3.887,3168,3.887,3268,3.887,3443,7.572,3536,3.606,3540,3.887,3553,4.336,3554,4.336,3555,4.336,3556,4.336,3557,4.336,3558,4.336,3559,4.336,3560,4.336,3561,4.336,3562,4.336,3563,4.336,3564,4.336,3565,4.336,3566,4.336,3567,4.336,3568,7.389,3569,9.655,3570,4.336,3571,4.336,3572,4.336,3573,4.336,3574,4.336,3575,4.336,3576,7.389,3577,4.336,3578,4.336,3579,4.336,3580,4.336,3581,4.336,3582,4.336,3583,4.336,3584,7.389,3585,9.655,3586,4.336,3587,7.389,3588,4.336,3589,7.389,3590,4.336,3591,3.887,3592,4.336,3593,4.336]],["keywords/477",[]],["title/478",[853,965.506]],["content/478",[3,1.518,5,8.63,16,7.866,18,1.569,45,3.582,58,2.24,89,7.597,115,3.99,187,7.749,209,6.264,324,7.128,363,6.841,364,4.112,373,7.671,449,4.652,678,7.671,687,3.334,723,10.706,776,5.868,864,8.084,1054,7.454,1082,7.01,1225,9.839,1236,13.17,1368,10.459,1407,10.706,1597,7.385,1603,9.663,2007,12.055,3536,11.643,3591,12.55,3594,17.94,3595,14,3596,14,3597,14,3598,14]],["keywords/478",[]],["title/479",[1706,892.464]],["content/479",[]],["keywords/479",[]],["title/480",[1707,1204.507]],["content/480",[3,1.55,18,1.601,19,8.647,58,2.269,75,8.345,79,5.049,101,7.339,157,5.038,400,7.909,426,7.339,436,5.916,508,4.329,642,11.209,687,4.76,907,10.043,1019,5.845,1416,6.983,1637,10.447,1694,12.576,1706,13.857,1708,17.099,1709,14.256,1710,8.991]],["keywords/480",[]],["title/481",[45,281.443,95,320.351]],["content/481",[3,0.871,17,1.947,18,1.643,54,2.796,58,1.831,60,1.88,61,2.897,79,3.52,81,4.123,95,3.023,101,2.459,106,3.72,110,1.947,157,1.688,179,1.97,181,3.146,188,2.321,193,2.862,218,1.622,237,3.692,238,5.15,243,4.988,258,1.741,262,4.292,304,5.724,324,2.438,338,3.603,339,2.223,341,2.644,345,6.115,350,5.268,364,2.36,382,2.876,385,2.828,396,5.477,458,6.137,470,4.692,476,3.724,487,6.003,491,6.798,493,2.765,509,2.598,511,8.382,512,2.132,513,6.299,514,6.597,520,5.155,526,3.43,528,4.924,530,5.126,539,3.146,543,3.146,544,4.862,546,3.146,580,1.994,652,2.203,687,3.492,762,2.142,905,2.897,936,3.248,1065,1.958,1103,2.705,1106,5.941,1123,6.648,1164,3.43,1312,4.692,1318,4.292,1355,4.127,1411,4.54,1445,3.146,1521,3.5,1566,2.972,1636,2.526,1669,2.526,1694,3.013,1706,9.356,1709,3.755,1711,6.682,1712,6.682,1713,5.546,1715,4.493,1716,7.437,1717,5.874,1718,6.682,1719,6.869,1720,6.682,1721,6.682,1722,7.559,1723,2.862,1724,3.365,1725,3.5,1726,7.559,1727,3.662,1728,3.248,1729,5.363,1730,7.559,1731,6.682,1732,4.123,1733,7.559,1734,4.504,1735,4.504,1736,4.504,1737,4.504,1738,4.504,1739,7.559,1740,9.767,1741,7.559,1742,4.504,1743,4.504,1744,4.504,1745,4.504,1746,4.504,1747,4.504,1748,4.504,1749,4.504,1750,3.861,1751,4.504,1752,4.504,1753,4.504]],["keywords/481",[]],["title/482",[654,370.874,1501,682.927]],["content/482",[]],["keywords/482",[]],["title/483",[8,280.871,581,677.243,1502,649.387]],["content/483",[3,1.269,8,3.626,11,5.165,12,5.031,16,5.13,17,4.757,18,1.311,95,3.407,106,2.668,110,4.757,115,3.335,178,6.612,197,4.023,204,7.148,231,9.178,232,7.465,237,2.946,238,3.979,260,5.12,304,4.567,305,6.588,350,3.626,512,4.229,578,8.742,580,4.874,627,7.688,649,4.567,654,3.945,699,6.476,732,10.314,760,4.541,772,8.382,796,8.703,1203,7.574,1466,7.688,1502,8.382,1503,11.905,1504,11.008,1505,9.731,1506,11.008,1507,10.076,1508,7.688,1509,9.731,1510,8.382,1511,9.731,1512,9.731,1513,7.264,1514,6.476,1515,11.008,1516,11.008,1517,11.008,1518,11.008,1519,8.948]],["keywords/483",[]],["title/484",[3,119.285,581,821.883]],["content/484",[3,1.549,34,13.433,45,2.559,54,5.841,79,4.361,95,4.159,106,3.043,145,4.635,179,5.877,204,6.121,237,3.596,260,4.036,304,3.904,305,5.193,318,7.035,322,7.312,324,7.272,338,4.232,339,4.609,382,3.581,401,7.312,430,5.182,449,6.385,458,2.977,509,5.427,510,3.292,512,3.79,518,6.381,519,6.786,615,7.312,654,6.478,687,2.382,739,3.562,763,5.376,902,6.052,905,6.052,931,8.966,963,8.866,1060,5.908,1074,6.209,1103,5.652,1185,6.786,1203,6.474,1310,5.593,1422,7.165,1445,6.572,1468,6.209,1501,8.866,1503,6.572,1520,9.409,1521,7.312,1522,9.409,1523,9.409,1524,9.409,1525,5.841,1526,9.409,1527,9.409,1528,6.676,1529,13.853,1530,11.877,1531,13.436,1532,8.318,1533,9.409]],["keywords/484",[]],["title/485",[197,378.226,204,404.25]],["content/485",[0,5.819,34,7.658,58,1.186,79,4.52,95,4.712,106,3.681,107,6.947,132,9.183,145,6.377,152,6.244,188,4.604,204,7.442,270,6.338,322,6.943,339,2.627,343,6.674,406,5.01,412,11.395,449,4.572,451,12.036,508,2.877,509,5.153,512,3.652,520,4.716,661,3.98,697,9.497,699,5.256,717,5.01,718,5.366,794,7.095,801,8.513,902,5.746,912,6.555,960,6.943,961,6.338,1060,5.61,1103,5.366,1217,5.483,1387,5.424,1422,6.803,1466,6.24,1468,5.895,1509,7.898,1511,7.898,1512,7.898,1529,7.898,1530,7.898,1534,8.934,1535,11.591,1536,6.943,1537,8.934,1538,8.934,1539,6.943,1540,7.898,1544,8.934,1546,8.934,1547,7.262,1548,8.934,1549,8.934,1550,7.262,1551,8.934,1552,8.934,1553,5.204,1554,8.934,1555,8.934,1556,7.898,2781,9.497,2782,9.497,2783,9.497,2784,9.497]],["keywords/485",[]],["title/486",[260,310.858,1557,759.301]],["content/486",[58,2.087,182,7.141,251,11.976,260,4.724,266,9.253,305,6.079,510,5.502,654,5.636,699,9.253,1227,6.879,1469,11.976,1557,13.822,1558,12.222,1559,14.395,1560,15.727]],["keywords/486",[]],["title/487",[716,862.854,820,773.156]],["content/487",[]],["keywords/487",[]],["title/488",[58,113.175,820,637.091,896,423.18]],["content/488",[3,1.904,22,4.313,36,5.748,50,2.916,56,3.926,58,1.691,76,4.798,106,3.577,157,6.869,178,9.921,258,6.385,323,5.315,385,7.999,397,6.955,819,9.9,820,14.49,901,7.598,936,9.187,1019,5.538,1035,10.625,1138,7.572,1323,8.095,1561,12.739,1562,16.518,1563,11.66,1564,12.739,1565,12.739,1566,8.406,1567,8.406,1568,7.348]],["keywords/488",[]],["title/489",[1693,816.841]],["content/489",[]],["keywords/489",[]],["title/490",[1632,919.143]],["content/490",[3,2.193,45,4.347,50,3.66,80,7.401,211,8.03,416,7.655,669,5.241,776,7.123,901,7.353,1095,10.038,1227,6.992,1693,9.923]],["keywords/490",[]],["title/491",[1695,1315.941]],["content/491",[18,2.287,50,3.718,56,3.826,75,7.705,92,6.115,169,7.52,179,5.43,211,5.24,239,6.252,337,11.175,364,3.876,458,3.927,563,11.829,637,9.453,639,8.67,663,6.348,687,3.142,723,10.091,760,7.922,776,5.531,924,9.647,926,8.419,942,7.985,1075,11.175,1157,7.619,1180,7.985,1416,6.448,1569,5.27,1693,12.691,1696,12.413,1697,10.974,1698,10.091,1699,12.413,1700,12.413]],["keywords/491",[]],["title/492",[649,545.984]],["content/492",[18,2.299,45,3.87,115,4.311,176,8.289,178,8.547,223,8.289,237,3.808,303,9.651,338,4.483,364,4.444,417,10.097,458,4.502,649,5.904,687,3.602,763,8.13,776,6.341,1075,9.791,1274,9.432,1304,6.546,1310,10.534,1416,7.392,1567,9.391,1693,11.001,1701,14.231]],["keywords/492",[]],["title/493",[8,433.424]],["content/493",[]],["keywords/493",[]],["title/494",[18,123.267,1569,439.386]],["content/494",[3,1.828,8,5.222,60,6.616,131,9.842,157,5.942,218,5.71,430,8.732,508,5.106,580,7.021,776,8.435,1157,9.732,1301,13.591,1570,15.855,1571,15.855]],["keywords/494",[]],["title/495",[958,480.942]],["content/495",[3,1.856,7,4.735,8,5.756,18,1.918,58,1.847,61,6.36,79,2.523,82,8.365,106,2.477,150,5.263,170,8.741,204,3.862,241,4.126,251,7.53,305,6.224,321,6.283,339,2.908,397,5.398,413,5.877,508,3.184,621,6.441,654,3.544,683,5.307,739,3.744,760,4.079,763,7.951,796,4.703,864,6.069,870,3.862,884,5.018,896,4.907,951,9.422,958,7.762,1061,6.36,1075,6.803,1204,6.401,1220,7.684,1299,5.352,1321,8.741,1440,7.684,1503,9.72,1514,5.818,1568,5.703,1572,9.888,1573,9.051,1574,7.387,1575,7.255,1576,8.741,1577,8.741,1578,9.051,1579,9.888,1580,9.888,1581,9.888,1582,13.917,1583,8.272,1584,8.244,1585,8.741,1587,6.209,2345,5.939]],["keywords/495",[]],["title/496",[1054,744.754]],["content/496",[3,1.983,8,3.145,12,4.363,18,2.407,27,5.927,58,1.267,72,3.984,80,4.421,115,4.113,126,7.005,132,6.774,146,5.996,164,7.005,174,7.619,180,5.797,192,8.185,204,3.73,239,6.838,241,6.592,245,5.797,297,9.098,305,3.691,326,8.185,327,4.704,370,5.507,436,4.202,669,5.18,687,2.417,695,4.637,702,8.185,715,4.67,763,7.756,870,5.303,884,4.845,967,8.705,1029,6.067,1054,5.404,1123,4.126,1130,6.386,1276,5.797,1356,7.961,1380,6.475,1577,8.441,1588,13.576,1589,16.427,1590,8.739,1591,8.441,1592,8.441,1593,7.133,1594,8.441,1595,9.548,1596,9.548,1597,5.354,1598,6.067,1599,8.739,1600,5.927,1601,7.961,1602,8.441,1603,7.005,1604,9.548,1605,9.548]],["keywords/496",[]],["title/497",[1600,816.841]],["content/497",[3,1.77,8,5.057,18,1.829,115,4.652,216,11.932,369,13.162,649,6.371,651,14.054,739,5.813,762,7.303,889,14.632,1396,12.802,1606,10.725,1607,12.482,1608,15.355,1609,15.355,1610,15.355,1611,15.355,1612,15.355]],["keywords/497",[]],["title/498",[655,826.325]],["content/498",[6,6.504,8,3.89,12,5.397,18,2.104,31,7.17,60,6.558,115,5.705,145,7.743,228,5.617,241,4.928,245,7.17,305,6.075,319,7.183,323,4.928,373,6.879,451,11.335,458,5.589,620,8.993,626,8.126,677,9.178,687,3.979,763,6.747,870,4.613,1054,6.684,1217,7.249,1227,5.166,1355,6.448,1589,12.776,1592,10.44,1613,11.81,1614,11.81,1615,11.81,1616,11.81,1617,10.44,1618,15.717,1619,10.124,1620,11.81,1621,15.717,1622,12.776,1623,9.178]],["keywords/498",[]],["title/499",[50,236.931,1569,439.386]],["content/499",[8,3.987,15,8.588,18,1.442,50,4.648,72,5.051,80,5.604,133,8.588,174,7.074,182,5.496,209,5.757,260,3.636,363,6.288,364,3.78,365,9.407,436,5.327,457,5.757,460,4.468,578,9.613,639,8.454,649,7.419,655,7.601,656,7.988,660,4.63,663,6.19,717,6.787,880,6.338,901,5.568,1123,5.231,1127,7.988,1227,6.988,1423,9.407,1429,10.092,1569,6.783,1594,10.7,1603,8.881,1624,12.104,1625,9.217,1626,12.104,1627,7.988,1628,10.7,1629,11.079,1630,12.104,1631,12.104]],["keywords/499",[]],["title/500",[1632,919.143]],["content/500",[3,2.24,8,6.688,50,4.095,197,5.278,209,6.869,211,7.55,234,10.523,258,5.582,323,6.026,325,6.516,406,10.029,512,4.074,669,5.864,776,6.435,1012,5.524,1095,9.069,1633,14.442]],["keywords/500",[]],["title/501",[8,238.838,18,86.373,364,226.432,596,431.021]],["content/501",[8,5.707,18,1.635,31,8.334,54,8.521,58,2.3,75,8.521,101,7.495,110,5.933,119,7.769,169,6.356,179,6.005,218,4.944,228,6.529,241,5.728,363,9.001,364,4.287,621,11.287,715,6.715,884,6.967,936,9.901,1019,5.969,1065,5.969,1132,8.62,1497,7.431,1634,13.728,1635,9.182,1636,7.698,1637,10.669,1638,11.446,1639,13.728]],["keywords/501",[]],["title/502",[209,492.192,327,509.83]],["content/502",[3,1.812,18,2.336,50,2.704,98,6.234,116,6.812,149,3.998,204,6.139,271,7.793,304,4.9,321,7.504,325,7.97,326,10.124,327,8.702,364,4.908,397,6.448,459,5.861,480,8.296,510,6.18,612,8.01,621,7.693,660,4.518,669,3.872,763,6.747,872,7.17,1060,7.416,1130,7.899,1132,7.416,1323,7.504,1370,8.665,1553,6.879,1569,5.014,1597,6.622,1640,15.717,1641,7.504,1642,11.81,1643,10.512,1644,11.81,1645,10.81,1646,11.81,1647,11.81,1648,9.379]],["keywords/502",[]],["title/503",[95,263.974,364,266.281,1186,506.875]],["content/503",[8,5.598,18,1.304,45,2.977,50,2.506,56,4.602,58,1.453,106,3.709,110,4.73,176,6.376,187,8.785,204,4.276,216,8.506,231,9.126,260,4.485,325,6.737,327,7.356,364,4.663,382,4.165,458,3.463,459,5.432,512,3.088,652,5.354,660,4.187,661,4.877,678,6.376,1002,11.464,1060,6.873,1081,6.574,1123,4.73,1132,9.376,1133,6.645,1134,8.177,1135,7.223,1137,13.556,1138,6.506,1140,8.177,1143,9.383,1144,8.177,1186,6.506,1427,7.766,1649,8.898,1650,10.946,1651,10.946,1652,10.946,1653,10.946,1654,10.946]],["keywords/503",[]],["title/504",[95,263.974,364,266.281,1655,693.233]],["content/504",[0,8.403,3,1.75,8,5,18,2.106,20,4.319,45,2.418,50,2.036,56,2.741,58,1.18,76,3.35,79,3.292,80,4.117,82,4.619,85,6.031,106,3.638,174,3.938,176,5.18,187,5.232,204,5.93,208,4.987,209,4.229,214,7.062,234,5.232,239,4.479,258,3.437,288,5.286,364,4.74,370,5.13,382,3.384,449,4.557,458,2.814,470,3.648,508,2.864,512,3.639,669,2.916,708,7.59,719,6.644,904,6.309,1002,11.58,1012,3.402,1123,3.843,1132,5.584,1133,5.399,1134,6.644,1135,5.868,1137,13.498,1138,5.286,1140,6.644,1144,6.644,1553,5.18,1641,5.651,1649,7.229,1655,10.487,1656,8.893,1657,8.893,1658,8.893,1659,8.893,1660,8.893,1661,7.861,1662,8.893,1663,8.893,1664,7.861,1665,8.893,1666,8.893,1667,8.893,1668,6.525,1669,4.987,1670,7.415,1671,5.399,1672,8.14,1673,8.893,1674,7.861]],["keywords/504",[]],["title/505",[95,263.974,364,266.281,1675,693.233]],["content/505",[3,1.255,8,5.581,18,1.772,45,2.96,50,2.492,72,4.542,76,4.1,79,2.777,106,3.747,174,4.82,176,6.34,187,6.404,204,4.252,208,6.103,228,5.177,234,6.404,258,4.207,288,6.47,364,4.645,382,4.142,449,3.845,453,7.85,458,3.444,470,4.465,512,3.071,669,3.569,730,10.372,882,6.103,1002,11.437,1123,4.704,1132,6.835,1133,6.608,1134,8.132,1135,7.183,1137,13.53,1138,6.47,1140,8.132,1144,8.132,1145,9.963,1284,6.916,1636,6.103,1649,8.848,1661,9.622,1664,9.622,1669,6.103,1670,9.075,1671,6.608,1675,8.848,1676,10.884,1677,10.884,1678,10.884]],["keywords/505",[]],["title/506",[18,101.574,215,595.63,373,496.727]],["content/506",[3,2.109,18,2.18,45,2.994,56,3.393,58,1.461,115,5.544,117,6.833,119,9.647,139,8.742,149,3.727,174,4.874,182,4.998,197,4.023,228,5.235,239,5.544,258,4.255,323,4.593,327,5.423,342,10.462,373,9.928,424,9.731,444,8.948,449,3.888,453,7.939,509,6.349,610,10.489,649,4.567,655,6.912,715,5.384,739,4.167,762,5.235,763,6.289,870,4.3,1019,4.786,1029,9.525,1054,8.483,1137,7.81,1157,6.756,1227,4.815,1300,8.742,1423,11.649,1576,9.731,1597,6.172,1602,15.068,1603,8.076,1679,11.008,1680,8.948,1681,11.008,1682,11.008]],["keywords/506",[]],["title/507",[58,137.346,1680,841.289]],["content/507",[8,4.807,18,1.261,56,3.263,58,1.937,76,3.988,95,3.278,115,3.208,119,8.26,178,6.36,188,7.522,228,5.036,239,5.333,258,5.642,259,6.572,260,3.18,266,6.229,304,4.393,323,7.512,325,4.777,327,8.869,342,8.959,373,6.167,430,5.831,434,5.142,436,4.66,442,8.063,499,6.049,510,6.607,512,2.987,663,5.415,678,6.167,699,8.587,876,6.897,1065,4.603,1123,4.576,1132,6.649,1178,9.076,1346,6.811,1491,9.632,1553,6.167,1557,7.768,1589,8.607,1603,10.709,1641,6.728,1674,9.36,1680,8.607,1683,10.588,1684,10.588,1685,14.596,1686,10.588,1687,10.588,1688,10.588,1689,10.588,1690,10.588,1691,10.588,1692,10.588]],["keywords/507",[]],["title/508",[649,545.984]],["content/508",[3,1.843,43,9.705,45,4.347,58,2.122,72,6.67,197,5.842,241,6.67,338,5.036,723,12.995,882,8.964,1274,8.508,1304,7.353,1416,8.304,1693,9.923]],["keywords/508",[]],["title/509",[776,586.326]],["content/509",[]],["keywords/509",[]],["title/510",[18,123.267,1569,439.386]],["content/510",[3,2.03,16,5.471,18,2.238,56,3.618,57,6.147,80,5.435,95,3.634,98,6.197,104,7.851,157,4.399,169,7.247,382,4.467,417,8.329,429,9.787,436,5.166,456,5.33,458,3.714,460,4.333,506,11.186,508,6.302,552,6.465,581,9.323,621,7.646,627,8.199,654,4.207,660,4.49,687,4.458,772,8.939,776,6.974,872,7.127,880,6.147,958,4.29,967,5.622,1061,7.551,1103,7.051,1127,7.746,1161,7.961,1227,5.135,1312,7.287,1569,6.646,1597,6.582,1702,9.543,1703,6.003,1704,11.739]],["keywords/510",[]],["title/511",[242,596.939,1569,439.386]],["content/511",[1,8.88,18,2.055,50,3.949,58,1.809,80,6.312,115,4.13,149,4.615,169,6.312,240,8.276,242,7.863,328,9.117,364,4.257,381,12.051,382,5.188,436,5.999,460,5.032,508,4.39,612,9.245,660,5.214,687,3.451,776,6.074,880,7.138,912,10.002,969,11.082,1061,8.769,1082,7.255,1105,10.002,1222,9.521,1569,7.324,1575,10.002,1597,7.644,1705,13.632]],["keywords/511",[]],["title/512",[22,350.355,125,469.918]],["content/512",[3,1.955,60,7.078,382,6.455,508,5.463,580,7.511,776,7.558,1671,10.298]],["keywords/512",[]],["title/513",[363,683.567]],["content/513",[]],["keywords/513",[]],["title/514",[1793,880.134]],["content/514",[3,0.512,5,2.272,18,1.821,20,2.157,22,1.504,27,2.758,45,1.208,50,3.335,55,3.013,56,3.494,57,2.326,58,2.243,60,1.854,72,1.854,95,3.509,98,2.345,104,2.971,106,3.868,110,1.92,115,2.929,116,2.562,117,2.758,145,3.681,146,2.79,157,1.665,169,2.057,174,5.02,187,4.396,204,5.973,218,2.691,223,2.588,228,2.113,238,1.179,239,4.87,240,5.87,242,2.562,259,2.758,260,2.904,266,4.396,271,2.932,273,3.393,305,1.717,323,1.854,325,2.004,327,2.189,330,2.971,361,8.633,363,3.881,364,4.548,371,3.452,378,3.204,382,2.843,397,2.425,409,2.447,430,4.115,438,3.912,449,2.639,458,4.838,470,1.823,491,4.441,511,2.142,512,3.865,513,4.115,514,4.31,580,1.967,596,4.441,612,3.013,621,2.894,625,3.528,652,2.173,656,4.931,661,1.979,670,3.808,688,3.057,701,2.469,720,3.611,762,2.113,776,6.104,870,1.735,872,2.697,882,2.491,884,3.792,890,2.614,896,2.205,902,2.858,1012,4.837,1019,3.248,1104,3.452,1123,1.92,1133,2.697,1135,8.344,1138,5.747,1165,4.396,1210,2.345,1227,1.943,1243,6.074,1277,5.934,1299,2.405,1369,3.057,1442,3.204,1466,5.219,1497,2.405,1569,4.813,1591,3.927,1693,7.037,1719,4.488,1755,4.638,1759,3.013,1794,2.538,1795,4.443,1796,3.611,1797,4.443,1798,4.443,1799,4.443,1800,4.066,1801,4.443,1802,3.528,1803,4.443,1804,3.927,1805,4.443,1806,4.443,1807,6.23,1808,4.443,1809,3.704,1810,3.452,1811,5.141,1812,4.443,1813,4.066,1814,4.443,1815,4.443,1816,4.443,1817,4.443,1818,4.443,1819,4.066,1820,4.443,1821,4.638,1822,3.383,1823,3.704,1824,4.443,1825,6.839,1826,4.066,1827,4.443,1828,3.927,1829,3.704,1830,4.443,1831,6.23,1832,4.443,1833,4.443,1834,4.443,1835,4.443,1836,3.808,1837,4.066,1838,4.443,1839,4.443,1840,4.443,1841,2.823,1842,4.443,1843,4.443,1844,4.443,1845,3.808,1846,2.858]],["keywords/514",[]],["title/515",[1632,919.143]],["content/515",[11,4.372,15,6.612,16,4.343,29,5.274,45,2.534,56,2.872,60,3.889,76,5.026,80,4.315,95,2.885,106,3.577,115,5.156,124,7.576,145,6.574,157,3.492,169,4.315,178,5.597,181,6.509,182,4.232,188,4.803,209,4.432,211,6.579,245,5.658,287,6.721,301,6.837,363,4.841,364,4.867,371,7.242,385,5.852,406,5.226,580,4.127,649,7.061,652,6.526,657,7.988,669,3.056,682,10.887,701,5.178,872,5.658,884,6.772,926,6.32,967,6.39,1012,3.565,1216,12.714,1220,7.242,1227,4.076,1274,4.96,1283,6.721,1416,4.841,1773,6.721,1807,11.125,1811,6.412,1847,8.238,1848,7.988,1849,9.319,1850,8.238,1851,13.361,1852,15.587,1853,8.53,1854,9.319,1855,9.319,1856,9.319,1857,6.233,1858,8.53,1859,9.319,1860,7.576,1861,9.319,1862,8.238,1863,9.319]],["keywords/515",[]],["title/516",[116,491.885,363,442.97,776,379.955]],["content/516",[8,3.667,16,7.04,18,2.042,29,6.301,43,6.759,45,3.028,56,3.432,58,2.005,76,4.194,104,10.103,115,5.823,146,6.991,169,7.938,181,7.777,191,6.687,240,6.759,363,7.847,364,4.717,371,8.652,397,6.078,413,6.618,438,7.91,450,12.28,507,9.842,614,8.318,649,7.113,663,5.694,687,2.819,760,7.93,776,4.961,818,7.347,1133,9.171,1222,7.777,1243,9.051,1274,8.04,1326,8.478,1411,6.687,1831,9.283,1860,9.051,1862,9.842,1864,11.134,1865,15.106,1866,11.134]],["keywords/516",[]],["title/517",[656,682.927,890,608.874]],["content/517",[58,2.021,95,3.486,146,7.072,149,3.813,174,4.987,181,7.867,187,6.626,211,4.754,240,9.243,241,4.7,260,5.549,270,7.991,323,4.7,325,5.082,363,5.85,406,6.315,409,6.203,413,6.694,621,7.336,656,7.432,669,3.693,701,6.258,776,5.018,870,4.399,890,10.869,896,5.589,904,7.991,960,8.753,1012,7.778,1029,7.157,1131,5.284,1133,6.838,1535,8.577,1569,7.843,1625,8.577,1847,9.956,1848,9.655,1868,17.246,1869,11.263,1870,11.263,1871,10.732,1872,9.39,1873,11.263,1874,11.263,1876,9.956,1877,11.263]],["keywords/517",[]],["title/518",[3,119.285,669,339.318]],["content/518",[]],["keywords/518",[]],["title/519",[36,466.935,1444,804.245]],["content/519",[3,2.236,25,5.755,36,8.881,50,1.621,54,4.394,56,2.182,58,2.53,60,2.954,72,5.529,76,2.667,87,4.298,91,5.755,95,2.191,106,3.016,116,4.083,117,4.394,143,10.09,149,6.567,150,5.79,179,4.759,211,2.988,221,7.599,239,3.566,241,2.954,245,4.298,323,5.529,325,4.909,426,3.865,428,5.023,430,3.899,512,4.978,580,3.135,663,3.62,669,5.785,697,9.722,708,4.165,715,5.321,870,7.295,882,3.97,901,5.004,976,5.502,1012,2.708,1013,6.746,1030,10.367,1034,4.445,1035,4.554,1036,5.023,1131,5.104,1210,5.743,1300,5.622,1311,8.128,1330,6.258,1331,8.285,1641,4.498,1703,3.62,1754,7.079,1755,9.23,1756,6.258,1757,5.289,1758,11.774,1759,4.801,1760,7.079,1761,10.879,1762,5.502,1763,14.87,1764,5.391,1765,7.079,1766,7.079,1767,6.48,1769,6.258,1770,7.079,3599,8.203]],["keywords/519",[]],["title/520",[45,281.443,197,378.226]],["content/520",[3,1.56,18,1.612,45,4.671,58,2.279,149,5.814,197,6.277,228,6.438,288,8.046,323,5.649,382,5.151,669,4.438,762,6.438,864,8.309,870,6.709,1012,7.216,1067,12.9,1068,6.923,1101,11.579,1131,6.351,1186,8.046,1322,6.268,1475,11.287,1771,13.537,1772,13.537,1773,9.763,1774,13.537,1775,11.967]],["keywords/520",[]],["title/521",[50,301.275]],["content/521",[3,2.175,6,6.966,8,4.166,18,1.507,36,5.707,45,2.354,50,4.751,54,5.373,58,2.321,72,3.612,95,2.679,133,6.141,157,3.244,169,4.007,177,6.726,179,6.538,197,3.163,209,4.116,211,7.711,234,7.442,241,3.612,258,3.345,323,6.237,325,5.707,327,4.264,364,2.703,375,7.922,401,6.726,430,4.767,508,2.787,512,3.568,639,6.045,649,3.591,652,4.233,669,6.342,670,7.419,717,4.853,776,5.636,856,11.182,870,3.381,1012,3.311,1017,7.036,1019,3.763,1029,5.5,1095,10.325,1096,8.248,1097,6.591,1131,5.935,1310,5.145,1502,9.632,1505,7.651,1567,5.712,1607,7.036,1693,7.852,1697,7.651,1776,8.655,1777,8.655,1778,8.655,1779,8.655,1780,8.655,1781,8.655,1782,6.35,1783,8.655,1784,8.655]],["keywords/521",[]],["title/522",[45,281.443,258,400.012]],["content/522",[3,1.896,18,2.177,45,3.442,50,2.897,58,1.68,75,7.856,98,6.681,106,2.253,193,8.042,197,4.625,209,7.823,211,6.943,234,7.446,258,7.751,259,7.856,287,9.127,288,9.777,301,9.286,323,5.281,325,5.71,400,7.446,406,7.097,669,5.393,1012,4.841,1131,5.938,1186,7.522,1497,8.903,1636,7.097,1755,7.856,1759,8.583,1785,10.051,1786,9.455,1787,12.656,1788,10.288]],["keywords/522",[]],["title/523",[18,101.574,197,311.663,1583,506.875]],["content/523",[3,1.539,18,2.232,58,2.259,197,6.85,258,5.161,259,8.287,288,7.936,323,5.571,378,9.629,512,3.767,612,9.055,669,4.378,870,5.215,958,4.879,969,10.853,1012,5.107,1131,7.988,1274,7.106,1312,8.287,1497,7.226,1556,11.803,1583,12.119,1755,11.634,1789,12.22,1790,13.839]],["keywords/523",[]],["title/524",[22,350.355,125,469.918]],["content/524",[3,1.889,22,5.549,60,6.839,198,10.415,228,7.795,580,7.258,669,5.374,708,9.643,870,6.402,1012,6.27,1791,16.39]],["keywords/524",[]],["title/525",[1,674.112,242,596.939]],["content/525",[]],["keywords/525",[]],["title/526",[22,350.355,125,469.918]],["content/526",[3,1.873,18,1.936,22,5.502,45,4.42,50,3.721,116,9.375,219,15.488,270,11.531,319,7.428,1568,9.375,1698,13.213,1792,12.377]],["keywords/526",[]],["title/527",[708,608.874,905,665.681]],["content/527",[]],["keywords/527",[]],["title/528",[1034,826.325]],["content/528",[3,2.16,36,4.675,50,4.29,58,1.375,60,4.324,106,3.855,118,5.92,150,7.653,152,4.251,198,6.584,218,3.732,241,4.324,258,5.558,426,5.657,428,7.352,512,4.659,580,4.588,626,7.13,701,7.991,901,4.766,935,7.473,1012,3.964,1034,6.507,1035,11.474,1036,7.352,1138,8.547,1641,6.584,1643,6.931,1757,7.742,1762,8.053,1769,9.16,1841,6.584,1846,9.25,1878,10.362,1880,11.989,1881,10.362,1882,8.64,1883,10.362,1884,8.64,1885,8.64,1886,8.64,1887,7.028,1888,8.64,1889,8.64,3600,16.514]],["keywords/528",[]],["title/529",[1101,807.709]],["content/529",[3,2.167,11,6.308,18,2.434,50,3.078,58,1.784,76,5.064,106,2.393,197,6.249,211,5.675,258,5.196,337,9.25,382,5.116,512,3.793,669,5.606,677,10.447,1012,5.142,1027,7.039,1131,6.308,1223,11.524,1759,9.117,1794,7.68,1841,8.542,1890,13.443,1891,13.9,1892,11.884,1893,13.443,1894,11.884,1895,13.443]],["keywords/529",[]],["title/530",[1098,1045.084]],["content/530",[17,7.461,18,2.056,109,13.71,1012,6.604,1755,10.716]],["keywords/530",[]],["title/531",[701,731.242]],["content/531",[3,2.334,45,3.899,50,3.282,56,4.418,58,2.363,109,11.385,149,4.853,197,6.507,258,5.541,669,6.641,872,8.703,1012,5.484,1131,8.353,1180,9.221,1299,7.759,1583,10.582,1755,8.898,1896,14.336]],["keywords/531",[]],["title/532",[887,933.65]],["content/532",[11,7.89,176,9.795,197,6.146,258,6.5,669,5.513,1012,6.432,1567,11.097,1636,9.429]],["keywords/532",[]],["title/533",[209,625.858]],["content/533",[3,2.015,11,6.533,20,6.762,22,4.714,50,3.188,60,5.81,72,5.81,125,6.323,169,6.447,176,8.111,197,5.089,209,8.315,218,5.015,258,5.382,364,4.348,382,5.299,512,3.928,580,6.166,652,6.811,669,5.732,872,8.454,1012,7.667,1101,8.547,1217,8.547,1671,8.454,1897,13.925]],["keywords/533",[]],["title/534",[115,313.524,614,773.156]],["content/534",[]],["keywords/534",[]],["title/535",[18,123.267,1926,914.868]],["content/535",[3,0.951,18,2.395,43,5.009,50,2.796,58,1.929,60,3.443,79,3.709,106,2.174,115,4.404,169,3.82,179,3.609,191,4.956,197,3.016,198,5.243,218,2.971,232,5.596,237,3.268,238,2.19,242,4.759,338,2.599,339,2.427,350,2.718,364,4.54,376,7.863,397,7.937,406,4.627,458,5.084,459,4.095,508,3.933,639,5.763,652,4.036,655,7.668,687,3.091,693,5.854,695,4.007,717,4.627,719,6.164,739,4.623,762,5.808,818,8.059,838,7.214,870,3.223,872,5.009,891,6.708,926,5.596,1022,7.863,1081,8.732,1082,4.392,1151,6.054,1173,6.708,1174,7.073,1217,5.064,1304,6.687,1370,6.054,1382,5.677,1514,9.454,1568,4.759,1575,6.054,1598,5.243,1703,4.22,1916,6.708,1927,4.855,1928,7.553,1929,7.553,1930,7.294,1931,7.294,1932,8.251,1933,6.88,1934,8.251,1935,8.251,1936,7.294,1937,7.553,1938,8.251,1939,12.212,1940,8.251,1941,8.251,1942,7.294,1943,7.294,1944,7.294,1945,8.251,1946,8.251,1947,8.251,1948,8.251,1949,8.251,1951,8.251,1952,8.251]],["keywords/535",[]],["title/536",[18,123.267,240,628.279]],["content/536",[18,2.225,50,3.036,58,2.48,106,3.505,238,3.52,240,11.342,266,7.801,323,5.533,350,4.367,363,6.888,364,5.834,458,5.911,776,5.908,1703,6.781,1811,9.124,1828,11.722,1829,11.056,1936,11.722,1953,13.26,1954,10.531,1955,13.26,1956,13.26,1957,10.305,1958,10.779,1959,13.26,1960,13.26]],["keywords/536",[]],["title/537",[50,301.275]],["content/537",[18,2.087,50,4.325,58,2.326,76,3.275,97,6.756,106,3.837,107,4.666,115,2.634,118,4.967,157,3.258,169,4.025,218,4.57,238,3.979,241,3.628,285,5.663,350,2.863,364,3.963,458,4.015,614,6.495,642,7.249,687,2.201,717,4.875,762,4.135,799,6.27,814,5.524,818,5.737,907,9.481,1068,6.49,1073,6.754,1151,6.379,1227,3.803,1232,6.905,1313,7.453,1395,9.897,1398,8.064,1399,6.297,1480,5.524,1648,6.905,1703,4.446,1927,7.466,1942,7.686,1944,7.686,1950,8.285,1957,6.756,1961,8.694,1962,12.69,1963,8.694,1964,5.278,1965,8.694,1966,8.694,1967,8.694,1968,8.694,1969,8.694,1970,8.694,1972,8.694,1973,6.495,1974,8.694,1975,8.694,1976,7.249,1977,6.168,1978,8.694,1979,8.694,1980,8.694,1981,8.694,1982,8.694,1983,8.694,1984,8.694,3059,9.242,3060,9.242]],["keywords/537",[]],["title/538",[8,280.871,18,101.574,1583,506.875]],["content/538",[]],["keywords/538",[]],["title/539",[3,119.285,2962,986.166]],["content/539",[3,1.064,18,1.941,36,2.59,43,3.486,56,1.77,58,2.057,79,2.952,106,3.906,128,4.787,150,6.157,197,2.098,228,6.903,237,4.533,238,3.071,252,5.255,304,6.022,318,3.006,338,2.907,339,4.791,341,2.009,345,3.323,350,1.891,426,3.134,441,8.157,458,2.919,460,5.358,470,6.359,476,2.828,503,5.871,510,4.047,512,5.553,660,2.196,661,2.558,695,2.788,708,3.378,796,6.301,819,4.462,870,3.604,884,2.914,901,4.244,958,6.389,1036,4.073,1075,3.95,1179,5.075,1204,5.321,1220,4.462,1304,4.244,1321,5.075,1322,5.356,1415,2.409,1419,7.026,1449,3.031,1470,6.171,1480,3.648,1525,3.564,1583,9.214,1600,3.564,1710,3.84,1790,4.667,2064,4.462,2203,8.446,2345,5.542,2368,4.922,2749,3.95,2962,5.471,2963,6.103,2964,5.471,2965,5.471,2966,6.103,2967,5.471,2968,9.809,2969,9.809,2970,4.56,2971,9.809,2972,6.103,2973,6.103,2974,6.103,2975,6.103,2976,6.103,2977,6.103,2978,12.625,2979,3.486,2980,6.103,2981,6.103]],["keywords/539",[]],["title/540",[197,378.226,1583,615.129]],["content/540",[3,2.151,18,1.843,106,2.755,197,6.819,211,6.533,259,9.607,288,9.199,325,6.983,669,6.118,1065,6.729,1131,7.262,1221,12.581,1583,11.906]],["keywords/540",[]],["title/541",[287,746.37,1583,615.129]],["content/541",[11,2.347,18,1.454,95,1.549,106,3.965,152,3.384,197,3.015,204,3.222,426,2.731,436,2.202,470,3.384,512,4.101,660,1.914,708,2.943,796,2.379,1002,6.609,1012,1.914,1036,3.549,1204,3.794,1259,20.352,1310,2.974,1387,3.037,1553,2.914,1583,6.256,1641,3.179,1643,7.039,1645,4.579,1789,4.579,1790,4.067,1794,2.858,1846,9.888,2683,4.579,2967,4.767,2982,5.318,2983,5.318,2984,5.318,2985,5.318,2986,5.318,2987,5.318,2988,5.318,2989,5.318,2990,5.318,2991,5.318,2992,5.318,2993,5.318,2994,17.111,2995,5.318,2996,5.318,2997,5.318,2998,5.318,2999,11.188,3000,11.188,3001,20.714,3002,11.188,3003,19.089,3004,15.451,3005,8.768,3006,8.768,3007,8.768,3008,11.188,3009,5.318,3010,5.318,3011,14.357,3012,8.768,3013,8.768,3014,5.318,3015,5.318,3016,5.318,3017,5.318,3018,8.768,3019,8.768,3020,11.188,3021,15.451,3022,8.768,3023,5.318,3024,8.768,3025,8.768,3026,8.768,3027,5.318,3028,5.318,3029,5.318,3030,5.318,3031,5.318,3032,5.318,3033,5.318,3034,5.318,3035,5.318,3036,5.318,3037,5.318,3038,8.768,3039,5.318,3040,5.318]],["keywords/541",[]],["title/542",[963,682.927,1583,615.129]],["content/542",[3,0.88,4,8.61,5,3.905,18,2.221,46,4.586,58,1.013,79,3.542,113,12.638,115,4.684,117,4.74,119,4.321,131,7.153,150,8.229,208,6.462,209,3.631,228,3.631,241,3.186,260,3.462,271,5.039,327,8.176,328,5.107,339,3.389,342,4.687,364,2.384,434,3.708,459,3.789,460,4.254,503,7.044,510,4.856,512,5.11,649,3.168,655,4.795,660,5.31,663,5.893,687,4.201,695,3.708,739,5.255,740,6.366,901,5.301,958,4.212,1012,4.408,1019,3.32,1034,7.236,1204,3.512,1210,4.031,1227,6.763,1228,7.635,1276,4.635,1312,10.301,1416,9.409,1436,6.989,1437,6.989,1439,4.492,1468,7.605,1497,4.133,1539,5.934,1671,4.635,1831,6.366,1858,6.989,2278,5.178,2368,6.545,2994,10.982,3041,8.117,3042,8.117,3043,8.117,3044,8.117,3045,8.117,3046,8.117,3047,8.117,3048,8.117,3049,8.117,3050,8.117,3051,8.117,3052,8.117,3053,8.117,3054,8.117,3055,8.117,3056,8.117,3057,8.117,3058,8.117]],["keywords/542",[]],["title/543",[460,485.753]],["content/543",[]],["keywords/543",[]],["title/544",[50,236.931,460,382.009]],["content/544",[18,1.143,50,3.948,56,2.957,58,2.289,82,4.984,95,2.97,106,3.731,110,4.147,115,4.127,150,5.107,218,3.455,238,2.547,273,4.357,293,5.956,303,6.507,319,4.385,457,4.563,460,5.847,470,6.499,508,3.09,512,3.844,687,2.429,695,6.616,1068,4.907,1073,5.107,1093,8.763,1130,6.417,1227,4.197,1274,5.107,1398,6.097,1399,4.762,1439,5.645,1467,6.332,1694,6.417,1715,5.703,1821,8.457,1898,9.595,1899,13.624,1900,9.595,1901,9.595,1902,9.595,1903,13.624,1905,9.595,1906,8.482,1907,9.595,1908,9.595,1909,9.595,1910,9.595,1911,9.595,1912,9.595,1913,9.595,1914,9.595,1915,9.595,1916,7.8,1917,9.595,1918,9.595,1919,9.595,1920,13.624,1921,9.595,1922,9.595,1923,13.624,1924,10.588,1925,9.595,2961,10.2]],["keywords/544",[]],["title/545",[22,350.355,125,469.918]],["content/545",[3,1.972,50,3.918,58,2.271,864,10.503,958,6.254,1204,7.871]],["keywords/545",[]],["title/546",[958,480.942]],["content/546",[]],["keywords/546",[]],["title/547",[50,236.931,958,378.226]],["content/547",[18,1.311,46,6.612,50,3.902,54,6.833,58,2.262,61,7.081,106,3.713,152,4.516,233,6.912,238,2.922,319,7.79,323,4.593,370,6.349,382,4.189,400,6.476,457,5.235,687,4.315,958,6.688,960,8.554,1204,7.84,1387,6.683,1395,9.003,1398,6.995,1399,5.462,1635,7.362,1702,8.948,1906,9.731,1927,6.476,1964,6.683,2020,11.232,2021,9.178,2022,11.008,2023,11.008,2024,11.008,2025,11.008,2026,11.008,2027,11.008,2028,11.008,2029,11.702,2030,11.008,2031,11.008,2032,11.702,2033,11.008,2034,11.702]],["keywords/547",[]],["title/548",[22,350.355,125,469.918]],["content/548",[12,7.685,18,2.334,22,5.693,115,5.094,655,10.559,864,10.321,1568,9.699]],["keywords/548",[]],["title/549",[466,596.939,1127,682.927]],["content/549",[]],["keywords/549",[]],["title/550",[1985,1315.941]],["content/550",[3,1.677,45,3.957,57,7.619,58,1.931,146,9.137,169,6.737,180,8.833,259,9.032,260,4.371,305,5.624,330,9.731,417,10.323,461,10.323,508,4.686,652,7.117,654,5.214,887,10.323,1074,9.602,1178,12.473,1346,9.359,1415,6.106,1528,10.323,1607,11.828,1796,11.828,1986,10.011,1987,14.55]],["keywords/550",[]],["title/551",[339,387.005]],["content/551",[0,6.575,3,1.877,5,5.162,16,4.704,18,1.94,36,4.554,56,3.111,58,1.34,60,4.212,75,10.108,79,4.907,106,3.424,146,6.338,169,6.537,192,8.652,237,2.701,242,5.822,260,4.891,305,3.901,318,7.393,338,4.447,339,5.186,370,5.822,374,8.652,382,3.841,456,4.583,461,7.161,466,5.822,510,3.531,580,4.469,652,4.937,654,3.617,718,6.062,739,3.821,760,4.164,796,6.715,864,6.195,872,8.571,942,6.492,963,9.317,1082,5.372,1185,7.279,1227,4.415,1304,4.643,1415,4.236,1467,6.661,1528,7.161,1568,5.822,1593,7.541,1598,6.414,1988,8.415,1989,8.923,1990,8.923,1991,6.751,1992,12.481,1993,10.093,1994,10.093]],["keywords/551",[]],["title/552",[341,460.385]],["content/552",[3,1.373,16,3.719,18,2.015,52,6.841,56,2.46,58,1.059,60,3.33,79,2.036,106,3.793,115,4.318,169,3.695,188,4.113,193,5.071,197,2.917,228,6.779,237,4.23,238,3.784,260,5.329,325,3.601,327,3.931,328,5.337,338,4.49,339,2.347,341,4.987,345,5.133,413,4.743,426,4.357,459,5.912,460,2.946,461,8.452,466,4.603,476,3.931,477,6.841,479,6.202,480,4.213,481,6.487,482,6.654,508,3.836,510,2.792,512,2.251,652,3.903,654,2.86,660,3.053,661,5.308,663,6.092,666,6.841,687,4.654,693,5.662,739,3.021,796,3.795,857,5.574,870,4.653,880,4.179,1015,7.394,1027,4.179,1082,4.247,1185,5.755,1210,6.288,1274,4.247,1304,5.48,1433,7.055,1466,5.574,1497,4.319,1575,5.855,1598,9.057,1637,6.202,1638,6.654,1788,6.487,1933,9.932,1992,7.055,1995,7.98,1996,6.487,1997,7.98,1998,6.487,1999,7.055]],["keywords/552",[]],["title/553",[50,301.275]],["content/553",[3,1.163,5,5.162,18,1.94,45,2.745,50,4.249,56,3.111,58,2.34,72,4.212,79,4.155,95,3.124,106,3.586,110,4.362,115,3.058,191,6.062,197,3.689,211,4.26,238,2.68,245,6.128,273,4.583,325,4.554,327,6.955,338,3.179,364,6.005,416,4.833,459,5.009,461,7.161,508,5.244,652,4.937,662,8.016,669,3.309,687,3.574,715,4.937,1019,4.388,1068,5.162,1073,5.372,1395,9.78,1399,5.009,1404,8.016,1502,7.686,1514,8.307,1569,4.285,1964,6.128,2000,8.923,2001,8.205,2002,12.481,2003,8.923,2004,8.923,2005,8.923,2006,8.923,2007,9.239,2008,10.093,2009,10.093,2010,10.093,2011,10.093]],["keywords/553",[]],["title/554",[22,350.355,125,469.918]],["content/554",[3,1.905,20,8.027,58,2.194,60,6.897,218,5.953,510,5.783,580,7.319,654,5.924,896,8.203,1019,7.187]],["keywords/554",[]],["title/555",[79,335.762]],["content/555",[]],["keywords/555",[]],["title/556",[50,301.275]],["content/556",[50,4.375,56,4.292,57,7.291,58,2.32,106,3.751,238,3.697,337,9.581,458,4.406,799,10.043,1068,7.121,1073,7.411,1222,9.726,1299,7.537,1395,10.501,1398,8.848,1399,6.91,1964,8.454,2012,13.925,2013,13.925,2014,12.31,2015,13.925,2016,13.925,2017,13.925]],["keywords/556",[]],["title/557",[22,350.355,125,469.918]],["content/557",[76,6.502,449,6.098,967,8.267,1157,10.596,1597,9.68]],["keywords/557",[]],["title/558",[1101,807.709]],["content/558",[]],["keywords/558",[]],["title/559",[18,86.373,149,245.494,1323,460.781,1841,460.781]],["content/559",[3,1.518,16,6.138,18,2.419,29,7.454,58,1.748,95,4.077,106,3.004,115,3.99,149,5.713,197,4.813,208,7.385,323,5.496,451,9.498,509,7.597,512,3.715,580,5.832,660,5.038,669,4.318,677,10.235,718,7.91,762,8.026,870,5.145,1012,5.038,1101,8.084,1131,6.179,1186,7.828,1336,9.839,1584,10.981,1891,15.139,1892,11.643,2018,13.17]],["keywords/559",[]],["title/560",[22,350.355,125,469.918]],["content/560",[3,1.873,18,1.936,22,5.502,45,4.42,60,6.782,197,5.94,228,7.73,580,7.197,901,7.476,1301,13.932,1792,12.377,2019,16.253]],["keywords/560",[]],["title/561",[449,365.537,1157,635.204]],["content/561",[]],["keywords/561",[]],["title/562",[50,301.275]],["content/562",[18,1.537,50,4.223,58,2.211,106,3.678,238,3.427,273,5.861,370,7.445,400,7.594,449,4.559,458,4.084,687,3.268,1068,6.601,1073,6.87,1332,10.493,1395,10.006,1398,8.202,1399,6.405,1860,10.493,1927,7.594,1977,9.158,2014,11.411,2020,7.923,2035,12.908,2036,12.908,2037,10.493,2038,12.908,2039,18.447,2040,12.908,2041,12.908,2042,11.065,2043,12.908,2044,12.908]],["keywords/562",[]],["title/563",[50,301.275]],["content/563",[]],["keywords/563",[]],["title/564",[2020,807.709]],["content/564",[1,6.856,3,1.213,18,1.983,22,2.296,45,1.845,46,4.074,50,3.603,58,2.088,92,3.342,94,5.387,95,2.1,106,3.623,110,2.931,115,3.189,116,3.913,132,4.812,145,3.342,174,3.004,179,2.967,188,3.496,190,5.387,207,5.387,218,2.443,221,4.738,233,4.259,238,2.794,242,6.071,243,4.476,260,2.037,328,4.537,350,4.248,364,4.028,370,3.913,429,5.655,430,3.736,438,5.512,445,5.387,457,3.226,458,5.268,480,3.581,508,2.184,512,2.97,528,4.418,652,3.318,655,4.259,657,5.814,660,2.595,663,3.469,687,3.68,688,4.667,695,5.112,697,7.723,717,5.902,719,5.067,740,5.655,901,3.12,936,4.892,958,3.847,1068,3.469,1073,3.61,1165,3.991,1204,3.12,1284,4.31,1387,4.118,1394,5.996,1398,4.31,1399,5.223,1409,4.118,1416,3.523,1490,5.655,1491,4.476,1568,3.913,1569,2.88,1574,5.067,1601,5.655,1715,4.032,1796,5.514,1821,9.023,1973,5.067,2020,9.658,2075,5.387,2101,5.996,2115,6.783,2116,6.783,2117,12.898,2118,6.783,2119,6.783,2120,6.783,2121,10.526,2122,6.783,2123,6.783,2124,6.783,2125,6.783,2126,10.526,2127,6.783,2128,6.783,2129,6.783,2130,6.783,2131,6.783,2132,6.783,2133,6.131,2134,6.783,2135,6.783,2136,6.783,2137,6.209,2138,6.783,2139,6.783,2140,10.526,2141,6.783,2142,6.783,2143,5.271,2144,7.211,2145,6.783,2146,6.783]],["keywords/564",[]],["title/565",[22,350.355,125,469.918]],["content/565",[3,1.99,60,7.204,460,6.372,580,7.644,1597,9.68]],["keywords/565",[]],["title/566",[654,370.874,1082,550.801]],["content/566",[]],["keywords/566",[]],["title/567",[1415,552.266]],["content/567",[3,0.668,12,2.647,16,2.7,18,1.107,19,3.726,52,4.966,56,2.864,57,3.033,58,2.327,72,2.417,76,4.383,80,2.682,95,2.877,106,3.691,133,4.11,169,4.303,179,2.534,188,2.985,204,2.263,218,3.347,237,4.548,238,4.341,285,3.773,304,3.856,305,2.239,321,3.681,323,2.417,338,2.927,339,1.704,341,2.027,345,2.086,348,4.11,350,5.126,400,3.408,401,4.502,409,5.118,413,3.443,416,2.774,426,3.162,434,2.813,442,4.411,459,2.875,476,2.854,480,4.906,510,5.445,512,2.622,521,4.178,580,2.565,637,8.862,652,2.833,654,4.772,660,4.451,661,2.581,687,3.371,763,3.309,767,4.709,796,8.083,838,7.235,870,2.263,884,2.94,961,4.11,1019,2.518,1027,3.033,1065,2.518,1103,5.582,1164,4.411,1180,3.726,1227,2.534,1346,7.486,1385,3.929,1415,5.589,1449,3.058,1497,3.135,1508,4.046,1525,3.596,1557,8.538,1723,3.681,1954,4.6,1986,3.986,1991,3.874,2045,5.793,2046,5.302,2047,6.818,2048,14.579,2049,8.215,2050,9.293,2051,9.293,2052,12.888,2053,5.302,2054,6.394,2055,5.793,2056,5.793,2057,9.293,2058,5.793,2059,5.793,2060,5.793,2061,9.293,2062,5.793,2063,5.793,2064,4.502,2065,8.215,2066,11.637,2067,9.293,2068,5.121,2069,5.793,2070,4.6,2071,4.709,2072,5.793,2073,5.793,2074,5.121,2075,4.6,2076,3.929,2077,5.793,2078,5.793,2079,5.793]],["keywords/567",[]],["title/568",[456,597.534]],["content/568",[3,1.258,12,4.986,18,0.846,53,6.771,56,3.363,58,2.42,60,2.965,72,4.552,76,2.676,80,3.29,94,5.643,95,2.199,99,6.771,106,3.398,110,3.071,116,4.098,152,2.915,179,3.108,204,6.279,218,2.559,228,3.379,237,3.987,238,2.896,260,5.096,304,5.51,305,5.133,321,4.515,325,4.922,338,2.238,339,3.208,345,2.559,350,2.34,370,4.098,385,6.851,400,4.18,405,6.091,408,6.771,409,3.913,412,4.57,434,3.451,456,8.022,508,3.513,510,5.212,512,3.078,580,4.831,652,3.475,654,2.546,660,2.718,687,1.799,739,2.69,796,5.189,838,5.414,858,6.771,859,5.643,876,4.628,882,3.984,884,3.606,896,3.526,1123,4.715,1173,5.776,1385,4.819,1415,6.746,1416,5.667,1424,6.281,1446,9.645,1449,3.751,1452,5.776,1510,5.411,1525,4.41,1585,6.281,1698,5.776,1775,13.171,1788,5.776,1794,4.059,1999,6.281,2047,5.213,2071,5.776,2074,6.281,2080,6.281,2081,7.105,2082,7.105,2083,13.28,2084,7.105,2085,6.281,2086,7.105,2087,10.91,2088,7.105,2089,7.105,2090,7.105,2091,7.105,2092,6.504,2093,6.504,2094,6.281,2095,7.105,2096,7.105,2097,7.105,2098,7.105,2099,7.105,2100,7.105]],["keywords/568",[]],["title/569",[1416,683.567]],["content/569",[3,1.425,20,4.076,27,5.21,50,1.922,56,2.587,58,1.641,60,5.161,63,6.392,76,3.162,80,3.886,95,3.828,101,4.583,106,3.705,110,3.627,117,5.21,180,7.508,191,5.042,193,5.334,218,3.023,237,4.836,238,4.586,240,5.096,304,5.131,338,3.896,339,2.469,341,2.937,345,4.454,350,4.837,400,4.938,416,4.02,426,4.583,476,4.135,512,3.489,521,6.054,580,3.717,620,6.392,637,6.392,652,4.105,654,4.432,682,5.863,687,3.131,688,5.775,796,3.992,838,7.287,882,4.707,1415,3.523,1416,6.424,1510,9.418,1525,5.21,1597,4.707,1632,5.863,1703,4.292,1723,5.334,1755,5.21,1792,6.392,1876,7.42,2047,9.074,2049,7.42,2052,15.27,2054,8.509,2064,6.523,2065,7.42,2068,7.42,2076,5.693,2101,7.42,2102,12.367,2103,12.367,2104,8.394,2105,7.42,2106,8.394,2107,8.394,2108,8.394,2109,8.394,2110,8.394,2111,8.394,2112,8.394,3074,6.158]],["keywords/569",[]],["title/570",[510,362.059,1439,608.874]],["content/570",[15,7.274,45,2.788,58,1.361,76,3.862,106,3.6,107,5.503,118,5.858,152,4.206,188,5.284,197,3.747,218,3.692,232,6.953,237,4.752,304,5.922,305,3.963,339,4.829,470,4.206,488,6.364,503,9.011,508,4.597,510,6.762,512,4.027,520,5.412,762,4.876,884,5.203,901,4.716,963,9.42,1074,6.766,1227,4.485,1304,6.566,1351,7.968,1439,9.661,1497,5.55,1557,7.523,1583,6.094,1598,6.515,1887,6.953,2047,10.473,2076,6.953,2114,9.385,2749,11.299,2964,9.77,3075,7.808,3076,10.899,3077,10.899,3078,10.899,3079,10.899,3080,10.899,3081,10.899,3082,10.899,3083,9.77,3084,10.899]],["keywords/570",[]],["title/571",[22,350.355,125,469.918]],["content/571",[18,1.986,22,5.644,76,6.279,242,9.616,450,13.552,1105,12.232,1568,9.616,1792,12.695,1794,9.524]],["keywords/571",[]],["title/572",[3,119.285,95,320.351]],["content/572",[]],["keywords/572",[]],["title/573",[22,350.355,125,469.918]],["content/573",[3,2.236,12,7.554,22,5.596,79,4.217,205,15.751,615,12.846,864,10.146,1469,12.587,1568,9.534]],["keywords/573",[]],["title/574",[683,706.254]],["content/574",[]],["keywords/574",[]],["title/575",[2147,1045.084]],["content/575",[3,1.834,5,8.136,17,5.199,18,1.433,31,10.822,46,7.225,56,3.708,58,1.596,76,5.993,85,8.158,92,5.926,116,6.939,149,4.072,200,11.463,208,6.745,209,5.721,650,8.277,683,10.18,762,7.567,884,6.105,887,12.648,896,7.895,1012,4.601,1019,5.23,1065,5.23,1081,7.225,1131,5.644,1203,8.277,1325,12.933,1326,14.445,1427,8.535,1702,9.779,2148,12.364,2149,12.029,2150,12.029,2151,10.634,2152,12.029]],["keywords/575",[]],["title/576",[3,98.292,669,279.603,683,457.672]],["content/576",[3,2.258,17,5.653,18,1.558,22,4.429,31,7.942,46,7.857,50,2.995,58,1.736,62,7.021,76,4.927,87,11.27,98,6.905,258,5.056,319,5.978,406,7.335,426,7.142,510,4.577,649,5.428,669,6.423,683,10.514,954,10.634,1065,5.687,1131,7.884,1232,10.389,1336,9.773,1359,8.872,2153,13.082,2154,13.082,2155,13.082]],["keywords/576",[]],["title/577",[3,83.583,36,327.181,149,245.494,870,283.258]],["content/577",[3,2.269,8,3.585,18,2.018,20,5.286,36,6.711,50,4.366,54,6.756,58,2.249,85,7.382,87,6.608,90,7.85,104,7.28,115,3.297,149,5.737,211,7.153,218,3.92,234,6.404,406,6.103,414,9.33,416,5.212,444,8.848,512,3.071,632,9.075,649,6.172,661,4.85,669,5.972,683,5.842,708,6.404,776,4.85,870,7.115,872,6.608,1031,10.372,1095,6.835,1097,8.289,1098,8.644,1104,8.459,1127,7.183,1219,9.075,1331,11.327,1567,7.183,1636,6.103,1693,6.756,1755,6.756,1773,7.85,2156,9.963]],["keywords/577",[]],["title/578",[22,350.355,125,469.918]],["content/578",[45,4.573,50,3.85,76,6.334,95,5.205,113,12.805,323,7.017,466,9.699,1976,14.02]],["keywords/578",[]],["title/579",[3,98.292,58,113.175,79,217.583]],["content/579",[]],["keywords/579",[]],["title/580",[79,264.052,426,564.994]],["content/580",[3,1.922,58,2.213,79,4.975,85,11.306,370,9.616,615,12.956,2281,14.738,2282,13.552]],["keywords/580",[]],["title/581",[449,464.807]],["content/581",[3,1.458,8,4.166,11,5.935,12,5.781,58,1.984,79,4.935,82,9.801,156,10.283,158,8.655,373,5.042,382,4.813,396,7.874,416,6.057,449,5.28,508,6.076,569,10.045,627,6.045,679,14.244,683,4.645,869,8.655,1060,7.943,1106,8.541,1157,7.764,1158,12.76,1159,12.778,1161,5.87,1247,9.83,1346,5.567,1439,5.092,1514,8.795,1655,12.152,1675,10.283,2021,7.216,2192,5.638,2272,7.419,2278,8.578,2282,10.283,2283,12.649,2284,11.182,2285,12.649,2286,8.655,2287,11.578,2288,8.655,2289,12.649,2290,12.649,2291,8.655,2292,8.655,2293,8.655,2294,8.655,3085,13.709,3086,9.201]],["keywords/581",[]],["title/582",[434,639.068]],["content/582",[55,7.866,58,2.061,62,6.225,79,4.973,157,4.347,163,9.014,174,6.876,175,7.981,178,9.327,179,5.073,434,8.501,470,6.37,508,3.735,661,5.168,687,4.431,699,6.824,720,9.429,818,7.654,888,11.053,924,12.068,967,7.436,1019,5.043,1061,7.461,1074,7.654,1106,8.066,1370,8.51,1405,10.253,1421,9.429,1566,10.247,1636,6.504,1802,9.211,2165,11.825,2210,8.665,2213,10.253,2282,9.429,2295,8.229,2296,11.599,2297,13.727,2298,11.599,2299,11.599,2300,11.599,2301,11.599]],["keywords/582",[]],["title/583",[585,1022.656]],["content/583",[79,4.254,174,7.382,343,12.455,436,7.337,508,5.369,598,15.886,1606,11.644,2295,11.828,2302,11.001]],["keywords/583",[]],["title/584",[95,320.351,466,596.939]],["content/584",[]],["keywords/584",[]],["title/585",[218,372.686,662,821.883]],["content/585",[0,4.403,3,0.779,18,1.25,50,3.322,56,2.083,58,1.926,75,4.196,79,4.427,106,3.937,197,2.47,237,4.204,238,4.414,242,3.899,260,5.848,273,4.767,305,2.613,318,3.539,325,3.05,327,3.33,338,4.054,339,3.087,341,2.365,345,4.635,350,2.226,364,4.019,456,3.069,459,3.354,461,4.796,466,6.055,476,3.33,477,5.794,479,5.253,480,5.541,481,5.495,482,5.636,486,5.495,508,4.145,509,3.899,512,1.907,608,5.794,654,2.422,660,2.586,661,3.012,662,5.368,663,5.368,666,5.794,667,5.368,695,3.283,880,3.539,901,3.109,942,4.348,1015,6.516,1068,3.457,1073,3.598,1210,3.568,1227,2.957,1274,3.598,1395,8.715,1399,5.209,1415,2.837,1417,5.147,1514,3.977,1569,4.457,1593,5.05,1598,4.295,1964,4.104,1986,4.651,1988,5.636,1989,5.975,1990,5.975,1991,4.521,1998,5.495,2000,5.975,2001,5.495,2002,5.975,2003,11.377,2004,5.975,2005,5.975,2006,5.975,2157,6.759,2158,6.759,2159,6.759,2160,6.759,2161,10.497,2162,6.759,2163,6.759]],["keywords/585",[]],["title/586",[50,301.275]],["content/586",[3,1.798,8,5.138,50,4.602,106,3.337,211,7.914,234,9.179,649,6.473,669,5.115,762,7.42,1065,6.783,1097,11.88,1131,7.32,1221,12.682]],["keywords/586",[]],["title/587",[22,350.355,125,469.918]],["content/587",[3,1.938,22,5.693,27,10.438,552,9.261,902,10.816,1411,10.1,1568,9.699,2164,16.815]],["keywords/587",[]],["title/588",[434,502.581,1566,682.927]],["content/588",[]],["keywords/588",[]],["title/589",[45,357.876]],["content/589",[18,1.601,45,3.656,58,1.784,92,6.623,110,5.81,163,10.447,182,6.104,343,10.043,369,11.524,400,7.909,434,8.304,510,4.703,649,5.578,687,3.403,1165,7.909,1264,13.021,1416,6.983,1566,8.871,1606,9.39,1894,11.884,2165,15.56,2166,13.443,2167,13.443,2168,13.443,2169,13.443,2170,13.443,2171,13.443,2172,13.443,2173,11.884,2174,13.443,2175,13.443]],["keywords/589",[]],["title/590",[36,466.935,905,665.681]],["content/590",[106,4.029,434,8.646,1033,13.661,1034,9.002,1066,13.661,1098,11.385,1101,8.799,1566,9.46,2176,12.673,2177,12.673,2178,12.673]],["keywords/590",[]],["title/591",[460,382.009,958,378.226]],["content/591",[3,0.955,58,1.934,82,4.304,98,4.374,106,3.533,141,6.581,179,3.625,185,5.62,237,5.508,271,5.468,318,4.339,339,4.286,343,6.191,434,4.024,438,4.339,453,8.835,457,3.941,458,5.888,460,4.522,493,7.519,503,4.205,567,7.896,663,4.238,760,3.419,941,7.325,958,5.327,1019,3.603,1074,5.468,1165,9.473,1227,3.625,1264,11.099,1284,5.265,1377,6.44,1378,6.581,1449,4.374,2165,15.936,2173,7.325,2177,7.325,2178,7.325,2179,8.286,2180,10.214,2181,10.83,2182,7.585,2183,8.286,2184,7.325,2185,7.325,2186,7.325,2187,7.325,2188,7.325,2189,8.286,2190,8.286,2191,5.788,2192,5.398,2193,8.286,2194,8.286,2195,8.286,2196,8.286,2199,8.286,2200,8.286,2201,8.286,2202,8.286,2203,7.585,2204,8.286,2205,6.736,2206,6.581,2345,8.754,2979,5.031,3075,6.31]],["keywords/591",[]],["title/592",[79,335.762]],["content/592",[4,3.06,12,3.188,14,3.903,18,0.488,20,1.989,56,1.262,57,2.145,58,1.601,62,2.198,79,1.045,106,3.812,119,5.156,179,1.792,180,2.487,182,1.86,198,2.603,233,5.721,237,4.507,238,4.086,258,1.583,305,1.583,318,2.145,319,3.188,330,2.74,331,2.778,338,1.29,339,1.205,341,2.44,342,5.592,345,4.728,350,2.298,392,3.33,397,2.236,406,3.912,434,1.989,436,1.803,456,5.961,457,1.948,458,6.206,480,2.162,493,4.282,508,1.319,510,2.44,520,2.162,597,3.183,600,2.906,654,1.468,687,3.323,695,1.989,699,2.41,867,3.903,880,3.653,901,3.209,904,2.906,926,2.778,942,2.635,949,2.703,958,1.497,1027,2.145,1061,2.635,1204,1.884,1227,1.792,1264,6.938,1310,2.435,1322,3.23,1329,3.415,1355,3.808,1369,2.818,1377,3.183,1422,3.119,1449,2.162,1477,2.954,1480,2.603,1513,2.703,1587,2.572,1600,2.543,1643,2.74,1794,2.34,1846,2.635,1998,3.33,2133,8.161,2165,15.641,2176,3.621,2180,10.059,2181,6.167,2184,6.167,2185,6.167,2186,6.167,2187,6.167,2188,3.621,2207,4.096,2208,4.096,2210,6.806,2211,6.976,2212,3.621,2213,8.054,2214,4.096,2215,4.096,2216,9.111,2217,4.096,2218,4.096,2219,4.096,2220,15.94,2221,4.096,2222,4.096,2223,12.064,2224,4.096,2225,4.096,2226,4.096,2227,6.976,2228,9.111,2229,4.096,2230,4.096,2231,6.976,2232,4.096,2233,4.096,2234,4.096,2235,9.111,2236,4.096,2237,4.096,2238,4.096,2239,4.096,2240,4.096,2241,4.096,2242,6.976,2243,4.096,2244,4.096,2245,4.096,2246,3.33,2247,3.415,2248,4.096,2249,4.096,2250,4.096,2251,3.749,2252,3.749,2253,4.096,2254,3.749,2255,3.749,2256,3.253,2257,3.415,2258,3.621,2259,3.749,2260,3.749,2261,4.096,2262,4.096,2263,6.976,2264,4.096,2265,4.096,2266,4.096,2267,4.096,2268,4.096,2269,6.976,2270,4.096,2271,3.621,2272,3.511,2273,4.096,2274,3.749,2275,4.096,2276,4.096,2277,3.621,2278,2.778,2279,4.096,2280,2.668]],["keywords/592",[]],["title/593",[3,98.292,6,469.66,7,408.376]],["content/593",[]],["keywords/593",[]],["title/594",[3601,1398.897]],["content/594",[3,1.797,5,5.967,6,10.321,7,8.408,8,3.843,17,6.738,18,1.857,65,10.288,95,3.612,100,9.485,149,3.95,175,8.028,182,5.298,204,4.558,239,5.877,370,6.73,377,11.668,378,8.415,404,10.315,416,7.466,580,5.167,596,6.936,620,8.885,626,8.028,640,11.119,678,6.797,715,5.707,864,7.162,873,10.315,874,11.668,896,5.79,902,7.505,992,9.267,1019,5.073,1411,7.008,1412,10.68,1428,8.279,1574,8.717,1671,7.084,1954,9.267,1973,8.717,2811,10.68,3602,12.404,3603,12.404,3604,12.404,3605,12.404,3606,11.119,3607,12.404,3608,11.119]],["keywords/594",[]],["title/595",[2147,1045.084]],["content/595",[3,1.873,5,8.312,17,7.024,18,1.936,97,12.631,101,8.873,170,14.368,175,11.183,1065,7.066,1428,11.531,3609,17.278,3610,17.278]],["keywords/595",[]],["title/596",[2,986.166,1105,759.301]],["content/596",[3,1.871,7,4.037,17,3.643,18,1.934,45,4.004,56,3.824,57,4.414,58,1.119,79,3.756,92,4.153,95,2.61,106,3.418,163,6.551,179,5.427,197,3.081,204,3.293,218,3.036,237,3.94,238,3.294,260,2.532,304,5.148,305,4.796,322,6.551,324,4.563,328,5.638,338,4.637,339,4.775,341,2.949,345,3.036,348,5.981,350,2.777,382,3.208,409,8.108,459,6.157,472,12.894,476,4.153,508,2.715,660,3.225,661,3.756,667,6.695,687,3.727,693,5.981,739,5.573,760,6.074,870,3.293,896,4.183,901,3.878,970,7.452,1027,4.414,1065,3.665,1210,6.549,1276,7.532,1304,3.878,1310,7.374,1370,6.185,1411,5.063,1415,3.538,1417,6.42,1525,5.233,1786,6.298,2046,7.716,2613,7.716,2715,7.226,3074,6.185,3611,8.033,3612,18.395,3613,4.91,3614,15.65,3615,8.962,3616,8.962,3617,8.033,3618,8.962,3619,7.452]],["keywords/596",[]],["title/597",[409,399.375,654,259.871,760,299.166,1444,563.534]],["content/597",[]],["keywords/597",[]],["title/598",[510,362.059,796,492.192]],["content/598",[3,1.727,7,2.931,18,0.729,58,2.218,106,3.755,115,1.854,119,5.496,152,2.511,174,2.71,183,5.411,185,4.151,204,2.391,208,3.432,237,4.267,238,3.978,243,4.039,253,15.327,260,4.127,266,3.601,305,3.754,338,3.059,339,1.8,341,2.141,342,5.96,345,2.204,350,4.526,409,3.371,426,3.342,458,5.288,476,3.015,480,3.231,488,3.799,510,6.401,511,6.626,512,1.727,520,5.126,699,7.102,746,4.757,838,3.037,896,3.037,901,4.467,912,7.125,961,4.343,1019,2.661,1060,3.844,1165,3.601,1227,2.677,1415,2.569,1448,4.343,1468,6.408,1503,4.275,1513,4.039,1715,3.638,1764,4.661,1811,4.212,1887,4.151,1991,6.495,2070,4.861,2092,8.889,2256,4.861,2439,4.861,2440,7.395,2951,4.757,2970,7.712,3613,3.565,3617,5.833,3620,6.507,3621,6.507,3622,6.507,3623,8.585,3624,5.833,3625,6.507,3626,10.323,3627,12.832,3628,6.507,3629,6.507,3630,10.323,3631,12.832,3632,6.507,3633,10.323,3634,12.832,3635,6.507,3636,6.507,3637,6.507,3638,6.507,3639,6.507,3640,6.507,3641,6.507,3642,6.507,3643,6.507,3644,6.507,3645,6.507,3646,6.507,3647,6.507,3648,6.507,3649,6.507,3650,6.507,3651,6.507,3652,6.507,3653,6.507,3654,6.507,3655,6.507,3656,6.507,3657,6.507,3658,6.507,3659,6.507,3660,6.507,3661,6.507,3662,6.507,3663,6.507,3664,6.507,3665,5.833]],["keywords/598",[]],["title/599",[900,862.854,3666,986.166]],["content/599",[3,1.276,7,5.301,58,2.269,106,3.415,131,6.872,188,5.705,208,6.208,237,4.575,260,4.52,331,11.594,338,4.74,339,3.256,341,3.873,409,6.097,458,4.761,459,5.494,460,4.086,510,5.264,511,7.256,660,4.235,688,7.617,739,4.191,857,7.732,900,14.253,1272,7.121,1312,6.872,1387,10.378,1439,6.513,2182,10.133,2205,8.999,2210,8.271,2442,9.49,3613,6.448,3666,18.279,3667,11.768,3668,10.549,3669,11.768,3670,11.768,3671,11.768,3672,11.768,3673,15.112,3674,11.768,3675,8.792]],["keywords/599",[]],["title/600",[409,724.753]],["content/600",[3,1.463,7,4.163,18,1.036,58,2.326,79,2.218,106,3.697,119,7.182,141,6.905,169,6.939,183,7.686,185,5.896,237,4.01,238,3.369,305,4.905,318,4.552,338,3.997,339,2.557,341,3.042,342,7.789,345,3.131,409,11.533,426,6.928,434,6.163,476,4.283,493,5.336,510,3.042,552,4.788,620,6.621,687,3.794,717,4.875,760,6.183,882,4.875,896,4.314,926,5.896,1019,3.78,1165,5.115,1227,3.803,1355,4.746,1358,6.756,1415,3.649,1417,6.621,1447,5.663,1468,10.873,1525,5.397,1569,5.388,1578,13.717,1715,5.168,1764,12.547,1794,4.967,2440,6.621,2845,7.453,2951,6.756,3613,5.064,3665,8.285,3668,8.285,3676,7.686,3677,9.242,3678,9.242,3679,9.242,3680,9.242,3681,9.242,3682,7.686]],["keywords/600",[]],["title/601",[456,469.918,1513,682.927]],["content/601",[0,3.502,3,0.62,7,2.575,12,2.457,27,3.337,58,1.862,72,2.243,80,2.489,106,3.863,107,4.696,118,4.999,180,3.264,186,5.376,208,3.015,237,5.066,238,4.773,260,3.323,273,5.024,305,3.382,324,2.91,338,4.738,339,3.254,341,3.871,345,5.952,350,3.644,400,3.163,412,3.458,421,5.376,456,3.973,458,5.017,473,3.945,476,2.649,479,6.799,480,4.619,499,4.999,510,1.881,511,7.253,518,3.646,520,5.84,667,6.949,695,2.611,767,4.37,796,4.161,799,3.877,803,5.56,833,5.376,838,2.668,851,5.376,936,3.877,1027,2.815,1151,6.419,1303,5.376,1310,3.196,1340,7.295,1346,3.458,1415,3.672,1416,2.793,1419,4.094,1447,3.502,1497,2.91,1513,10.906,1536,4.178,1703,4.474,1802,4.27,1857,5.852,1887,3.646,2053,4.921,2054,8.772,2070,4.27,2075,4.27,2076,3.646,2257,4.482,3074,3.945,3468,5.123,3613,5.096,3624,5.123,3683,9.301,3684,9.301,3685,5.715,3686,14.333,3687,5.715,3688,5.715,3689,5.715,3690,9.301,3691,5.715,3692,8.337,3693,9.301,3694,5.715,3695,5.715,3696,5.715,3697,9.301,3698,5.715,3699,8.337,3700,5.123,3701,5.715,3702,5.715,3703,5.715,3704,5.715,3705,8.337,3706,5.715,3707,9.301,3708,5.715,3709,9.301,3710,5.715,3711,5.715,3712,5.715,3713,5.715,3714,5.123,3715,5.715,3716,5.715,3717,5.123]],["keywords/601",[]],["title/602",[510,362.059,1439,608.874]],["content/602",[3,1.061,18,1.096,58,2.431,106,3.893,173,5.996,237,4.994,238,4.492,240,5.588,260,3.468,271,3.778,304,4.79,338,4.166,339,4.262,341,3.22,345,5.575,348,4.061,350,3.032,382,3.503,409,3.153,412,7.426,479,4.449,480,3.022,503,8.588,510,3.22,660,4.416,667,7.31,687,2.33,739,4.371,752,5.724,760,2.362,838,5.729,870,3.596,901,6.666,1025,11.509,1164,7.01,1304,5.31,1371,5.24,1404,4.546,1415,2.402,1416,7.528,1417,4.359,1439,5.416,1440,4.449,1513,6.074,1514,3.368,1575,4.2,1590,8.426,1703,2.927,1846,3.682,2749,9.1,3074,6.754,3613,5.362,3676,12.812,3717,8.772,3718,6.085,3719,6.085,3720,6.085,3721,6.085,3722,6.085,3723,6.085,3724,6.085,3725,6.085,3726,6.085,3727,6.085,3728,6.085,3729,6.085,3730,16.456,3731,6.085,3732,9.785,3733,11.002,3734,6.085,3735,6.085,3736,6.085,3737,9.785,3738,12.273,3739,6.085,3740,9.785,3741,6.085,3742,9.785,3743,6.085]],["keywords/602",[]],["title/603",[796,492.192,1759,701.858]],["content/603",[3,1.617,7,6.716,305,6.788,330,9.38,434,6.811,456,6.369,552,7.724,586,14.025,654,6.871,716,11.694,739,5.31,796,9.842,1082,7.465,1276,8.515,1329,11.694,1415,5.886,1416,7.285,1759,13.004,1767,12.838,3623,12.399,3744,13.365,3745,12.399]],["keywords/603",[]],["title/604",[687,333.132]],["content/604",[3,1.321,11,7.228,18,1.835,58,1.521,95,3.548,106,3.696,119,6.487,237,3.067,238,4.09,341,5.39,342,7.035,345,5.548,396,5.489,491,10.343,493,7.035,530,7.773,687,4.71,739,4.339,760,4.729,880,6.002,958,4.189,967,8.333,1123,7.52,1127,10.166,1161,10.448,1180,7.373,1204,5.272,1468,7.564,1599,14.101,2133,10.136,2448,10.6,2845,9.825,3746,12.184,3747,12.184,3748,12.184]],["keywords/604",[]],["title/605",[694,914.868,1059,887.122]],["content/605",[3,1.182,5,5.243,12,6.523,18,1.221,56,3.16,58,1.361,106,3.703,115,3.106,193,6.515,237,4.394,238,3.789,241,4.278,271,6.766,323,4.278,338,4.496,339,3.015,341,3.587,345,3.692,350,4.701,442,7.808,597,7.968,687,4.726,694,12.619,739,3.882,760,6.775,838,9.263,870,4.005,901,4.716,975,7.394,1059,12.236,1180,10.563,1299,5.55,1311,10.664,1385,6.953,1445,7.161,1467,6.766,1928,9.385,1986,7.055,2192,6.679,2649,7.968,3613,5.972,3745,9.064,3749,15.174,3750,9.064,3751,10.899,3752,13.602,3753,10.899,3754,10.899,3755,15.174]],["keywords/605",[]],["title/606",[1180,846.462]],["content/606",[3,1.025,6,4.898,8,2.929,45,3.508,58,1.712,95,2.753,106,3.742,115,3.908,126,6.525,152,5.292,169,4.117,182,5.858,185,6.031,198,5.651,209,4.229,237,3.452,238,4.03,239,4.479,338,4.064,339,2.615,341,3.111,345,5.467,350,4.249,460,3.283,649,3.69,652,4.35,655,5.584,664,7.861,687,4.816,739,3.367,838,6.402,948,7.861,1161,6.031,1165,5.232,1180,5.72,1304,4.09,1312,5.52,1359,8.749,1379,8.14,1385,6.031,1468,5.868,1703,4.548,1790,7.229,1986,6.119,1991,5.948,2252,8.14,2442,7.623,2539,8.14,3507,15.869,3608,8.474,3613,5.18,3675,7.062,3745,7.861,3750,7.861,3756,13.714,3757,9.453,3758,9.453,3759,9.453,3760,9.453,3761,9.453,3762,9.453,3763,9.453,3764,9.453,3765,9.453,3766,9.453,3767,9.453,3768,9.453,3769,9.453,3770,9.453,3771,9.453,3772,9.453,3773,8.474,3774,9.453,3775,9.453]],["keywords/606",[]],["title/607",[2978,1253.981]],["content/607",[4,10.478,18,2.092,115,5.321,174,6.21,237,4.7,338,4.418,341,6.144,409,7.724,434,6.811,687,4.854,739,5.31,760,5.786,880,9.196,1467,9.255,1470,9.38,1601,15.987,3613,8.17,3682,15.526,3776,14.909,3777,14.909,3778,14.909]],["keywords/607",[]],["title/608",[1054,744.754]],["content/608",[3,1.227,7,5.098,58,1.944,106,3.87,237,5.233,238,5.023,338,4.615,339,3.131,341,3.725,345,3.834,373,6.201,458,4.635,470,4.367,476,5.245,687,4.241,739,5.547,1054,9.48,1123,6.332,1304,4.897,1352,9.936,1396,8.876,1415,4.468,1491,7.025,1623,8.273,1715,6.328,2037,8.654,2191,7.436,2192,9.543,2514,11.157,2970,8.455,3613,6.201,3673,9.411,3779,11.317,3780,11.317,3781,11.317,3782,11.317,3783,11.317,3784,11.317,3785,11.317,3786,9.411]],["keywords/608",[]],["title/609",[728,1204.507]],["content/609",[3,1.665,7,6.916,18,1.72,106,2.571,115,6.152,131,8.965,241,6.026,271,9.53,434,7.014,458,4.569,627,10.087,687,5.141,699,8.497,728,13.219,876,9.407,1857,9.659,2295,10.247,3744,13.762,3787,15.352,3788,15.352,3789,15.352]],["keywords/609",[]],["title/610",[958,378.226,1283,746.37]],["content/610",[3,1.797,7,4.463,8,3.069,12,4.259,58,2.259,106,3.743,131,5.785,157,3.492,187,5.483,228,4.432,237,4.171,238,2.474,304,3.867,325,4.205,327,4.591,338,4.203,339,5.511,341,3.26,382,3.546,458,4.222,472,12.379,493,9.567,510,4.668,687,2.359,739,3.528,884,4.729,890,5.483,958,7.213,963,6.15,1157,5.72,1204,6.138,1283,9.623,1304,4.287,1310,5.539,1366,6.412,1411,5.597,1439,5.483,1467,6.15,1569,3.957,1573,8.53,1810,10.37,2345,9.362,2416,8.53,2957,9.319,3074,6.837,3611,12.715,3613,5.428,3623,8.238,3790,9.907,3791,9.907,3792,14.185,3793,9.907,3794,9.907,3795,9.907,3796,9.907,3797,9.907]],["keywords/610",[]],["title/611",[460,382.009,1597,580.309]],["content/611",[3,1.111,7,4.618,8,3.176,42,9.189,58,2.108,60,4.024,72,4.024,98,5.09,106,3.816,107,5.175,145,6.735,152,3.956,232,6.54,237,4.625,238,3.63,293,5.985,325,4.351,327,4.75,338,4.307,339,2.836,341,3.374,345,3.473,460,7.35,472,7.658,503,4.894,510,4.783,511,4.65,535,9.144,548,6.635,649,5.672,687,4.375,715,6.687,739,3.651,1304,4.435,1439,5.673,1491,9.022,1597,5.407,1600,8.487,1606,6.735,1623,7.494,2979,8.3,3074,7.075,3613,5.617,3619,8.524,3798,10.251,3799,10.251,3800,10.251,3801,10.251,3802,10.251,3803,10.251,3804,9.189,3805,14.534,3806,10.251,3807,10.251]],["keywords/611",[]],["title/612",[932,780.553,1500,649.387,3808,906.523]],["content/612",[3,1.302,5,4.588,6,4.941,7,6.218,18,2.114,45,3.073,58,1.5,60,2.314,72,4.715,78,4.404,87,3.366,100,4.508,106,3.817,115,1.68,126,4.068,131,3.442,146,7.095,148,4.753,155,4.623,175,3.815,180,3.366,218,1.997,234,8.389,237,4.95,238,4.05,266,3.262,288,7.717,304,6.33,324,3.001,338,5.827,339,4.918,341,5.338,350,5.025,382,3.414,405,4.753,509,5.175,580,2.455,613,5.545,715,2.712,739,2.099,859,4.404,882,3.109,890,6.648,896,4.452,902,3.567,932,15.812,941,7.931,942,3.567,944,6.832,945,5.545,949,3.659,1019,2.411,1027,2.903,1065,2.411,1103,3.33,1227,2.425,1376,5.075,1468,5.92,1470,3.709,1500,9.887,1507,5.075,1508,3.873,1521,4.309,1528,6.365,1703,2.836,1709,4.623,1802,4.404,1954,4.404,2093,5.075,2430,5.075,2573,7.69,2649,4.309,2865,8.212,3074,4.068,3613,3.23,3675,4.404,3809,9.537,3810,5.894,3811,9.537,3812,16.219,3813,5.894,3814,12.011,3815,5.894,3816,5.894,3817,12.011,3818,9.537,3819,5.894,3820,5.894,3821,9.537,3822,5.894,3823,5.894,3824,5.894,3825,5.894,3826,5.894,3827,5.894]],["keywords/612",[]],["title/613",[83,862.854,907,773.156]],["content/613",[3,0.615,7,4.162,18,1.511,45,1.45,58,1.854,79,2.807,83,11.649,106,3.909,107,5.904,115,2.633,152,2.187,157,1.998,213,4.234,237,2.944,238,3.709,260,1.602,273,5.761,305,2.061,324,2.886,338,3.996,339,2.556,341,3.849,345,3.962,350,3.623,409,4.786,412,5.59,436,2.347,451,3.845,460,1.968,503,2.706,508,2.799,510,4.438,511,6.738,535,3.566,554,7.955,626,3.669,627,3.724,652,2.608,660,2.04,687,4,692,4.88,715,2.608,739,3.29,746,4.144,758,4.334,760,2.2,882,6.169,890,3.137,896,2.646,1009,5.332,1019,2.318,1068,4.444,1310,5.166,1366,3.669,1415,2.238,1447,3.473,1448,3.783,1513,5.735,1514,7.464,1528,3.783,1569,2.264,1648,4.234,1715,3.169,1773,3.845,1841,3.388,2054,3.669,2075,6.902,2076,3.616,2192,3.473,2796,4.88,2802,11.194,2979,3.237,3122,5.081,3443,4.446,3613,3.106,3619,7.683,3673,7.683,3682,4.714,3692,8.282,3699,10.483,3705,8.282,3714,5.081,3733,5.081,3750,13.968,3752,13.314,3786,4.714,3828,9.239,3829,5.668,3830,14.852,3831,5.668,3832,11.694,3833,5.668,3834,5.668,3835,5.668,3836,11.694,3837,5.668,3838,5.668,3839,5.668,3840,5.668,3841,5.668,3842,5.668,3843,11.694,3844,5.668,3845,5.668,3846,5.668,3847,5.668,3848,5.668,3849,5.668,3850,5.668,3851,5.668,3852,5.668,3853,5.668,3854,5.668,3855,5.668]],["keywords/613",[]],["title/614",[687,215.878,2192,555.478,3856,812.614]],["content/614",[3,1.508,7,6.265,18,2.211,115,5.624,126,9.598,373,7.62,508,4.213,612,8.872,687,5.339,739,4.953,796,7.992,1304,6.017,1349,11.974,1352,8.872,1703,6.69,2191,9.137,2192,13.507,3675,10.389,3786,16.411,3856,17.69,3857,13.906]],["keywords/614",[]],["title/615",[3858,1398.897]],["content/615",[]],["keywords/615",[]],["title/616",[1553,766.522]],["content/616",[3,1.301,7,3.559,18,0.885,58,1.812,60,3.101,106,3.791,129,7.431,146,4.666,177,11.851,179,3.25,204,2.903,237,4.389,238,3.625,273,3.374,304,4.684,319,3.396,324,4.022,338,4.804,339,3.32,341,3.95,345,2.676,350,3.719,454,5.902,458,3.572,476,3.661,480,3.923,508,2.393,511,5.444,520,3.923,661,3.311,687,3.456,695,3.609,699,6.642,750,6.569,796,5.369,896,3.688,940,6.569,1366,7.768,1415,3.119,1431,6.802,1448,5.272,1513,4.904,1553,9.553,1569,4.793,1715,4.417,2210,8.435,2664,6.802,2780,10.334,3613,4.329,3676,6.569,3686,7.081,3700,7.081,3859,7.9,3860,12.002,3861,7.9,3862,7.9,3863,7.9,3864,7.9,3865,7.9,3866,12.002,3867,7.9,3868,7.9,3869,7.9,3870,7.9,3871,7.9,3872,7.9,3873,7.9,3874,7.9,3875,7.9,3876,7.9,3877,7.9,3878,7.9,3879,7.9,3880,7.9,3881,7.9,3882,7.9,3883,7.9,3884,7.9,3885,7.9,3886,7.9,3887,7.9,3888,7.9,3889,7.9,3890,7.9,3891,7.9,3892,7.9,3893,7.9,3894,7.9,3895,7.9,3896,7.9,3897,7.9,3898,7.9,3899,7.9,3900,7.9,3901,7.9,3902,7.9,3903,7.9,3904,7.9,3905,7.9]],["keywords/616",[]],["title/617",[1368,821.883,3906,986.166]],["content/617",[3,0.88,6,6.347,7,5.519,18,0.909,45,3.775,58,1.842,95,3.567,106,3.848,115,4.205,126,5.602,157,2.861,175,5.254,188,8.993,237,4.441,238,3.685,338,4.87,339,3.389,341,4.032,345,2.75,350,5.092,356,9.608,357,5.814,382,2.906,436,5.072,458,3.646,460,5.124,476,3.762,503,3.875,510,4.856,637,5.814,649,5.759,687,1.933,715,5.637,818,9.16,882,4.282,896,3.789,961,5.417,968,11.284,1298,6.207,1351,8.956,1380,7.816,1415,3.204,1567,5.039,1597,8.67,1600,4.74,1929,6.989,2209,7.635,2280,4.974,2970,6.064,3613,4.448,3675,6.064,3773,7.276,3804,7.276,3906,7.276,3907,12.251,3908,8.117,3909,8.117,3910,8.117,3911,8.117,3912,8.117,3913,8.117,3914,12.251,3915,8.117,3916,12.251,3917,8.117,3918,8.117,3919,8.117,3920,14.756,3921,8.117,3922,8.117,3923,8.117,3924,8.117]],["keywords/617",[]],["title/618",[853,965.506]],["content/618",[3,2.22,6,6.167,7,5.362,8,3.688,12,5.117,17,4.839,18,1.806,20,5.438,45,3.045,56,3.451,78,8.893,82,5.817,90,8.076,95,3.466,101,6.113,104,7.489,110,4.839,157,4.196,169,5.185,221,7.821,223,6.523,228,5.326,239,5.64,259,6.951,382,5.771,391,8.893,396,5.362,416,8.235,447,10.671,460,4.133,508,3.606,597,8.702,630,10.25,632,9.336,635,9.899,661,4.989,678,6.523,857,7.821,864,9.308,896,5.557,899,11.198,905,7.203,1019,4.868,1219,9.336,1320,11.198,1409,9.207,1411,6.726,1426,10.25,1500,8.527,1574,8.366,1597,6.279,1635,7.489,1773,8.076,3606,10.671,3925,11.904,3926,11.904]],["keywords/618",[]],["title/619",[1428,605.03,2785,517.71,3087,753.863]],["content/619",[]],["keywords/619",[]],["title/620",[152,424.56,2147,821.883]],["content/620",[]],["keywords/620",[]],["title/621",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/621",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/621",[]],["title/622",[2789,780.553,2790,615.019,2791,677.243]],["content/622",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2790,11.821,2791,13.017,3087,14.489]],["keywords/622",[]],["title/623",[62,457.672,107,457.672,2785,517.71]],["content/623",[]],["keywords/623",[]],["title/624",[701,402.951,1322,335.742,2792,663.743,2798,621.606]],["content/624",[3,1.98,8,4.459,18,2.046,36,8.511,58,1.797,82,7.032,117,8.403,149,4.583,197,4.947,223,7.885,239,6.818,323,5.649,324,7.327,512,4.845,708,7.964,715,6.621,762,6.438,1012,7.216,1015,8.403,1225,10.113,1322,6.268,1583,10.208,1758,12.601,2679,11.287,2798,11.604,2799,12.391,3088,14.39]],["keywords/624",[]],["title/625",[17,272.593,18,75.13,45,171.537,1322,292.038,2800,525.901]],["content/625",[11,3.871,17,3.566,18,0.983,27,5.122,45,2.244,58,1.929,106,3.792,228,3.924,237,5.305,239,4.156,304,3.423,318,7.612,325,3.723,338,2.599,339,4.276,396,3.951,438,6.394,460,6.629,470,3.385,488,9.024,503,6.197,510,4.272,511,3.979,512,2.328,520,4.356,548,5.677,549,6.054,715,4.036,739,3.124,902,5.307,958,5.313,963,5.445,967,3.951,1015,9.024,1065,3.587,1123,3.566,1304,8.548,1311,6.164,1322,6.731,1428,5.854,1439,7.185,1449,4.356,1480,5.243,1586,6.054,1587,5.181,1713,6.054,2047,6.054,2113,7.863,2114,7.553,2198,6.164,2345,7.335,2749,8.403,2835,6.553,2836,6.553,2837,6.553,2838,6.553,2839,6.553,2840,6.553,2841,6.553,2842,6.553,2951,6.412,2979,7.414,3075,6.283,3089,8.771,3090,8.771,3091,15.455,3092,8.771,3093,8.771]],["keywords/625",[]],["title/626",[45,231.913,95,263.974,118,487.186]],["content/626",[11,1.938,17,1.785,18,0.492,50,1.609,58,1.75,95,1.279,106,3.938,145,2.035,160,4.465,173,2.691,182,1.876,237,5.092,238,4.246,260,2.754,304,3.804,338,1.301,339,2.696,341,2.458,345,5.334,348,2.931,350,3.02,396,4.39,436,4.76,438,2.163,456,1.876,457,3.342,458,4.451,460,3.993,470,6.336,473,3.031,488,4.361,491,7.207,499,5.238,503,2.096,511,4.421,512,1.982,513,3.87,514,4.053,516,3.086,518,2.802,519,5.067,520,2.181,521,2.979,522,3.358,523,3.358,530,2.802,535,4.699,539,2.885,543,2.885,544,11.105,546,2.885,548,2.842,549,3.031,687,1.046,958,1.51,967,3.365,975,2.979,1068,4.688,1073,2.199,1123,8.738,1210,2.181,1220,3.21,1355,5.905,1362,3.281,1415,1.734,1447,4.577,1449,3.709,1525,4.361,1587,2.594,1719,6.497,1723,2.625,1729,2.931,1823,3.444,2133,9.839,2345,4.22,2439,3.281,2440,3.146,2448,9.68,2449,3.444,2450,3.444,2451,7.936,2452,5.46,2470,3.444,2471,3.444,2472,3.21,2473,3.444,2474,3.444,2475,5.858,2477,5.858,2478,3.444,2480,6.431,2482,3.444,2483,3.444,2484,3.444,2485,3.444,2487,3.781,2785,2.508,2835,3.281,2836,3.281,2837,3.281,2838,3.281,2839,3.281,2840,3.281,2841,3.281,2842,3.281,2926,3.781,2927,3.781,2928,3.781,2929,3.781,2930,3.781,2931,3.781,2932,3.541,2934,3.541,2935,3.781,2937,3.781,2938,3.781,2939,3.781,2940,3.781,2942,3.781,2979,2.508,3087,3.652,3094,4.391,3095,4.391]],["keywords/626",[]],["title/627",[1857,692.162,2945,947.258]],["content/627",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/627",[]],["title/628",[1081,621.593,1151,759.301]],["content/628",[2952,16.234,2953,16.234]],["keywords/628",[]],["title/629",[8,238.838,363,376.679,364,226.432,449,256.132]],["content/629",[]],["keywords/629",[]],["title/630",[8,340.857,3103,759.301]],["content/630",[3,1.413,8,5.305,18,1.46,50,3.688,56,3.778,58,2.536,149,4.149,174,7.967,198,7.788,203,11.219,204,7.464,285,7.984,323,5.114,350,4.037,363,6.367,364,3.827,417,8.696,585,9.525,596,7.285,660,4.688,678,7.139,683,6.578,776,5.461,870,4.788,1029,7.788,1065,5.329,1277,14.288,1343,11.219,1427,8.696,2347,10.835,3103,11.818,3104,13.029,3105,13.029,3106,13.029,3107,10.835,3108,11.68,3109,11.68,3110,13.029]],["keywords/630",[]],["title/631",[449,365.537,589,862.854]],["content/631",[1,7.74,3,1.37,8,5.836,18,1.88,20,5.77,27,7.376,56,3.662,58,2.505,72,4.958,89,6.854,104,7.947,149,4.023,174,7.846,211,5.016,215,11.022,218,4.279,363,6.172,364,4.928,365,12.263,373,9.192,406,6.663,414,10.186,449,6.258,507,10.504,715,5.812,870,4.641,884,6.03,1272,7.643,1283,8.57,1937,10.876,2404,10.876,3103,11.578,3107,10.504,3111,16.884,3112,9.437,3113,11.323,3114,12.631,3115,12.631,3116,12.631]],["keywords/631",[]],["title/632",[3,119.285,363,537.576]],["content/632",[3,1.2,8,3.429,18,1.595,20,2.392,22,0.931,45,1.34,46,1.653,50,1.864,56,2.51,58,1.85,72,1.148,76,1.036,79,0.702,80,3.096,98,1.452,106,3.953,115,2.838,118,1.572,145,4.615,149,3.524,150,5.541,152,1.129,156,2.237,157,5.406,174,1.218,180,4.06,182,1.249,187,1.619,204,2.612,209,1.309,211,2.823,218,0.991,223,1.603,228,2.343,237,0.736,238,1.775,239,1.386,240,4.06,258,1.904,273,1.249,287,1.984,301,5.975,319,1.257,350,1.622,361,5.092,363,6.282,364,4.642,380,1.893,428,1.952,444,2.237,445,2.185,449,3.677,453,3.552,457,1.309,458,4.044,470,2.021,491,2.928,509,1.587,512,3.191,513,2.713,514,2.841,580,1.218,596,2.928,612,1.866,626,1.893,649,3.379,656,1.816,660,2.558,669,0.902,678,3.895,682,9.735,701,5.205,718,1.653,720,2.237,762,2.343,763,1.572,803,1.748,856,2.432,870,1.075,875,2.294,880,1.441,882,1.543,884,2.5,901,4.309,913,2.751,935,1.984,954,2.237,1012,3.115,1015,1.708,1029,3.13,1034,3.093,1035,5.238,1036,1.952,1065,1.196,1075,1.893,1082,1.464,1104,2.138,1133,4.06,1135,4.413,1138,6.188,1152,3.68,1216,12.368,1219,2.294,1274,3.559,1277,2.185,1336,2.055,1387,1.67,1404,2.185,1409,1.67,1490,2.294,1497,1.489,1553,1.603,1569,3.457,1641,1.748,1643,3.294,1669,2.762,1671,1.67,1719,2.958,1755,1.708,1757,2.055,1782,2.019,1800,2.518,1807,2.294,1809,2.294,1810,2.138,1811,7.163,1813,2.518,1821,3.057,1825,2.518,1826,2.518,1829,2.294,1837,2.518,1845,2.358,1846,6.696,1851,10.366,1853,2.518,1880,2.294,1882,2.294,1884,2.294,1885,2.294,1886,2.294,1887,1.866,1888,2.294,1889,2.294,1927,1.619,1957,3.828,1964,1.67,2020,1.689,3075,2.095,3103,2.019,3109,2.622,3112,5.311,3117,2.925,3118,2.925,3119,2.925,3120,2.185,3121,2.925,3122,2.622,3123,2.925,3124,2.925,3125,4.354,3126,2.925,3127,2.925,3128,2.925,3129,5.236,3130,2.925,3131,7.109,3132,4.744,3133,2.432,3134,2.432,3135,2.432,3136,2.925,3137,2.925,3138,2.925,3139,2.925,3140,2.294,3141,2.432,3142,2.925,3143,2.432,3144,2.925,3145,2.925,3146,2.925,3147,5.236,3148,2.925,3149,2.925,3150,5.236,3151,2.925,3152,2.925,3153,2.925,3154,2.925,3155,2.925,3156,2.925,3157,2.925,3158,2.925,3159,2.622,3160,2.622,3161,2.925,3162,2.925,3163,2.925,3164,2.925,3165,2.925,3166,2.925,3167,2.925,3168,2.622,3169,2.925,3170,2.925,3171,2.925,3172,2.925,3173,2.925,3174,2.925,3175,7.109,3176,8.657,3177,5.236,3178,2.925,3179,7.109,3180,2.925,3181,7.109,3182,2.925,3183,2.925,3184,2.925,3185,2.925,3186,7.109,3187,2.925,3600,9.367]],["keywords/632",[]],["title/633",[3188,1163.321]],["content/633",[6,7.082,11,6.033,16,4.126,18,2.193,27,5.495,29,5.01,43,5.374,58,1.706,72,5.365,76,7.156,82,4.598,131,5.495,174,6.705,176,5.156,203,8.103,204,3.458,216,6.879,223,5.156,228,4.21,241,3.694,319,4.046,364,4.015,365,9.992,424,7.826,449,6.875,458,4.068,470,3.632,512,3.627,513,4.875,596,7.643,660,3.386,678,5.156,880,4.635,884,4.492,954,7.196,967,4.239,969,7.196,992,7.03,1025,7.03,1029,5.625,1060,5.559,1158,6.183,1159,6.879,1217,5.433,1256,8.436,1276,5.374,1284,5.625,1297,7.381,1298,10.453,1336,6.613,1423,6.879,1567,8.485,1584,7.381,1635,5.921,1636,4.964,1637,6.879,1668,6.495,1669,4.964,1671,5.374,1672,8.103,1703,4.527,1750,7.588,1872,7.381,2501,7.03,2505,6.741,3083,8.436,3107,7.826,3108,8.436,3120,7.03,3132,6.281,3188,7.826,3189,9.41,3190,9.41,3191,9.41,3192,9.41,3193,9.41,3194,9.41,3195,13.669,3196,9.41,3197,9.41]],["keywords/633",[]],["title/634",[8,207.749,58,83.711,449,222.791,967,302.059,3103,462.786]],["content/634",[8,5.864,18,2.121,76,5.4,174,6.348,204,5.6,364,5.559,373,8.35,382,5.455,449,5.063,509,8.269,596,8.521,624,12.673,967,8.526,991,14.336,1082,7.63,1277,11.385,1283,10.339,1300,11.385,2259,13.122,3103,13.063,3111,13.661,3198,15.239,3199,15.239]],["keywords/634",[]],["title/635",[853,965.506]],["content/635",[3,1.997,8,6.568,18,1.635,31,8.334,58,2.3,61,8.83,104,9.182,301,10.072,319,6.274,364,4.287,449,4.849,569,10.903,596,8.16,632,11.446,776,6.117,864,8.426,865,17.328,880,7.188,1019,5.969,1025,10.903,1082,7.307,1635,11.589,3103,12.713,3188,15.318,3200,14.594]],["keywords/635",[]],["title/636",[1428,605.03,2785,517.71,2786,649.387]],["content/636",[]],["keywords/636",[]],["title/637",[152,424.56,2147,821.883]],["content/637",[]],["keywords/637",[]],["title/638",[3,83.583,669,237.76,1322,335.742,2787,663.743]],["content/638",[3,2.11,16,6.991,29,8.489,150,7.983,182,6.811,211,6.331,669,6.478,683,10.604,1065,6.521,1131,7.037,1359,10.172,1636,8.411,1762,11.656,1973,11.206,2148,11.656,2785,9.106,2788,13.729]],["keywords/638",[]],["title/639",[2789,780.553,2790,615.019,2791,677.243]],["content/639",[45,4.457,92,8.074,101,8.948,171,11.821,182,7.442,380,11.277,438,10.109,2786,12.481,2790,11.821,2791,13.017]],["keywords/639",[]],["title/640",[62,457.672,107,457.672,2785,517.71]],["content/640",[]],["keywords/640",[]],["title/641",[701,402.951,708,426.638,762,344.879,2792,663.743]],["content/641",[3,1.864,17,5.331,18,1.469,36,8.643,58,2.147,115,3.737,117,7.656,149,5.476,171,8.896,223,7.185,239,6.212,258,4.768,323,5.147,324,6.676,512,4.563,701,8.988,708,11.27,715,6.033,762,5.866,870,4.818,1012,7.327,1015,7.656,1225,9.215,1703,6.308,1758,11.867,2679,10.284,2793,12.335,2794,12.335,2795,9.586,2796,11.29,2797,16.174,2798,13.865,2799,11.29]],["keywords/641",[]],["title/642",[1034,535.481,1322,394.828,2800,711.003]],["content/642",[3,1.992,50,3.957,106,3.792,118,5.509,143,7.343,150,5.132,152,3.956,157,5.953,182,4.378,228,6.502,235,8.266,258,3.727,271,6.363,428,6.841,438,5.049,512,4.481,626,6.635,638,9.189,701,8.827,703,7.658,901,4.435,935,6.954,1012,5.23,1034,8.585,1035,10.217,1036,6.841,1138,8.126,1156,7.204,1221,7.839,1284,6.127,1299,5.219,1636,5.407,1641,6.127,1643,6.449,1756,8.524,1757,7.204,1841,6.127,1846,8.794,1880,13.244,1882,8.04,1884,8.04,1885,8.04,1886,8.04,1887,6.54,1888,8.04,1889,8.04,2347,8.524,2785,5.854,2786,7.343,2801,9.643,2802,7.204,2803,9.643,2804,9.643,2805,9.643,2806,9.643,2807,6.954,2808,13.672,2809,9.643,2810,9.643]],["keywords/642",[]],["title/643",[1101,523.417,1322,394.828,2800,711.003]],["content/643",[3,1.813,18,1.873,98,8.302,106,2.8,438,8.235,512,4.437,669,5.157,948,13.903,1012,6.016,1101,9.653,1891,12.785,2795,12.222,2807,11.343,2811,14.395,2812,15.727,2813,15.727]],["keywords/643",[]],["title/644",[17,313.386,18,86.373,1322,335.742,2814,725.149]],["content/644",[11,1.797,16,1.785,17,1.655,18,1.508,20,7.537,55,4.466,56,2.03,58,2.183,79,3.457,98,3.476,106,3.618,115,3.511,116,2.209,131,2.377,145,1.887,149,2.933,150,2.038,157,1.435,160,4.185,161,3.193,182,1.739,185,2.597,204,2.573,237,4.003,238,4.12,241,1.598,253,3.386,259,2.377,260,2.602,318,5.386,330,2.562,332,8.818,339,3.025,350,4.926,396,3.154,416,1.834,430,3.627,434,1.86,436,2.898,438,5.386,449,1.353,456,2.99,458,3.667,459,4.299,460,3.198,464,6.028,465,3.65,470,1.571,473,2.81,488,4.088,499,2.188,503,1.944,510,3.031,511,3.176,512,1.858,518,4.466,519,2.762,520,2.022,528,2.495,548,2.635,549,2.81,656,2.527,687,2.193,695,1.86,715,3.221,717,2.148,732,2.635,778,2.209,818,5.717,873,3.386,882,2.148,893,3.65,905,4.236,918,2.717,949,2.527,958,3.166,965,2.717,966,2.717,967,4.926,968,3.113,976,9.007,1002,2.405,1012,1.465,1015,4.088,1035,2.464,1081,3.956,1106,1.989,1123,4.446,1127,2.527,1203,2.635,1204,1.762,1210,2.022,1274,2.038,1284,2.434,1304,3.029,1311,2.861,1322,6.274,1346,2.464,1366,4.531,1440,2.976,1445,2.675,1448,2.717,1449,3.476,1470,2.562,1477,2.762,1503,2.675,1514,2.253,1519,3.113,1539,2.976,1558,5.118,1586,2.81,1587,5.44,1632,2.675,1694,4.405,1710,2.562,1717,2.976,1759,2.597,1924,2.976,1930,3.386,1931,3.386,1943,3.386,1957,2.976,2133,2.231,2143,5.118,2151,3.386,2197,3.193,2198,2.861,2284,3.386,2345,2.3,2376,3.386,2451,2.81,2452,2.976,2603,3.113,2795,6.733,2802,7.685,2807,7.419,2815,3.386,2816,3.83,2817,6.586,2818,3.83,2819,3.83,2820,3.83,2821,3.83,2822,3.83,2823,3.83,2824,3.83,2825,3.83,2826,3.83,2827,3.83,2828,3.83,2829,3.83,2830,3.83,2831,3.83,2832,3.83,2833,3.83,2834,3.83,2835,3.042,2836,3.042,2837,3.042,2838,3.042,2839,3.042,2840,3.042,2841,3.042,2842,3.042,2843,3.83,2844,3.83,2845,3.283,2846,3.83,2847,3.83,2848,3.83,2849,6.586,2850,3.83,2851,3.83,2852,3.83,2853,3.83,2854,3.83,2855,3.83,2856,3.83,2857,3.83,2858,3.83,2859,6.586,2860,3.83,2861,6.586,2862,3.83,2863,6.586,2864,3.83,2865,6.028,2866,3.83,2867,6.586,2868,3.83,2869,3.83,2870,6.586,2871,3.83,2872,3.83,2873,3.83,2874,3.83,2875,3.83,2876,3.83,2877,3.83,2878,3.83,2879,3.83,2880,3.83,2881,3.83,2882,3.83,2883,6.586,2884,3.83,2885,3.83,2886,3.83,2887,3.83,2888,3.83,2889,3.83,2890,3.83,2891,3.83,2892,3.83,2893,3.83,2894,3.83,2895,3.283]],["keywords/644",[]],["title/645",[50,195.235,1322,394.828,2896,852.766]],["content/645",[5,2.668,11,2.448,16,2.432,17,2.255,18,1.865,20,4.146,46,3.134,50,3.162,55,7.35,56,2.632,58,2.413,82,2.71,98,2.754,106,3.648,115,2.587,149,2.891,157,1.955,193,3.315,238,1.385,242,3.01,245,5.183,259,3.239,260,1.567,273,2.369,285,3.399,293,8.574,319,2.384,325,2.354,327,4.206,364,3.91,396,5.19,426,2.848,436,2.296,438,6.557,442,6.502,470,3.503,491,5.075,508,2.75,510,1.825,512,1.472,513,2.874,514,4.925,544,5.492,687,2.743,695,2.534,715,5.301,717,2.926,762,2.481,796,2.481,882,2.926,890,3.07,896,2.589,958,4.577,1002,8.674,1015,3.239,1035,3.356,1082,2.777,1093,5.492,1106,2.71,1123,4.684,1204,3.927,1210,6.611,1272,5.492,1322,3.953,1395,5.128,1399,6.854,1442,3.763,1497,2.824,1514,3.07,1535,6.502,1539,4.055,1569,5.317,1574,3.898,1635,3.49,1694,5.711,1703,2.668,1719,3.134,1793,3.49,1821,6.727,1822,6.502,1916,6.941,1927,5.023,1964,5.183,1996,4.241,2001,4.241,2020,9.609,2071,4.241,2280,5.562,2361,3.973,2381,3.763,2382,4.612,2390,3.644,2403,4.612,2410,4.612,2419,4.612,2420,4.35,2498,4.241,2499,4.241,2507,6.941,2508,7.119,2509,4.241,2512,4.241,2520,4.241,2526,4.612,2527,4.612,2529,7.548,2534,4.612,2535,4.612,2542,4.612,2545,4.612,2802,8.096,2807,7.816,2815,4.612,2897,5.217,2898,5.217,2899,5.217,2900,5.217,2901,8.538,2902,5.217,2903,5.217,2904,5.217,2905,5.217,2906,4.612,2907,8.538,2908,5.217,2909,8.538,2910,5.217,2911,5.217,2912,5.217,2913,5.217,2914,5.217,2915,5.217,2916,5.217,2917,5.217,2918,5.217,2919,5.217,2920,5.217,2921,5.217,2922,5.217,2923,5.217,2924,5.217,2925,5.217]],["keywords/645",[]],["title/646",[45,231.913,95,263.974,118,487.186]],["content/646",[3,0.334,11,1.358,17,1.251,18,1.155,50,2.219,58,1.741,95,0.896,106,3.952,145,4.164,149,1.745,160,3.275,173,1.886,182,1.314,233,3.236,237,4.636,238,4.134,260,2.093,273,2.34,304,2.89,331,5.733,338,0.912,339,2.049,341,1.803,345,4.477,348,2.054,350,2.784,364,0.904,396,5.146,436,3.72,449,1.022,456,1.314,457,2.451,458,3.685,460,2.572,470,5.381,473,2.124,488,3.199,491,7.797,493,4.276,499,4.829,503,1.469,511,3.36,512,2.385,513,4.656,514,6.198,516,2.163,518,1.963,519,3.717,520,2.721,521,2.088,522,2.353,523,2.353,530,1.963,535,3.447,539,2.022,543,2.022,544,9.764,546,2.022,548,1.992,549,2.124,660,1.107,661,2.296,687,0.733,732,3.546,758,2.353,778,1.67,803,1.839,814,1.839,838,1.436,918,3.657,958,3.089,965,3.657,966,3.657,967,5.578,975,2.088,1068,3.563,1073,1.541,1093,1.862,1123,8.475,1204,2.371,1210,1.528,1322,2.386,1355,4.615,1362,2.299,1380,1.963,1399,1.436,1415,1.215,1447,3.357,1449,2.721,1525,3.199,1569,3.589,1586,3.782,1587,1.818,1713,2.124,1715,1.721,1719,6.454,1723,1.839,1729,2.054,1793,5.654,1822,3.925,1823,2.413,1927,1.703,1958,4.19,1977,2.054,2020,3.164,2133,8.589,2197,2.413,2198,2.163,2381,2.088,2383,2.353,2390,3.6,2439,2.299,2440,2.204,2448,8.015,2449,2.413,2450,2.413,2451,6.202,2452,4.005,2470,2.413,2471,2.413,2472,2.25,2473,2.413,2474,2.413,2475,4.297,2477,4.297,2478,2.413,2482,2.413,2483,2.413,2484,2.413,2485,2.413,2493,2.559,2494,2.559,2495,2.559,2496,2.559,2497,2.413,2498,4.19,2499,4.19,2500,4.556,2501,4.093,2502,2.559,2503,2.559,2504,2.559,2505,2.204,2506,2.559,2507,4.19,2508,4.297,2509,4.19,2510,2.559,2511,2.559,2512,2.353,2513,2.559,2514,2.204,2515,2.559,2516,2.559,2517,4.556,2518,2.559,2519,2.559,2520,2.353,2521,2.559,2522,2.559,2523,2.559,2524,2.559,2785,1.757,2786,2.204,2807,2.088,2835,2.299,2836,2.299,2837,2.299,2838,2.299,2839,2.299,2840,2.299,2841,2.299,2842,2.299,2906,2.559,2926,2.65,2927,2.65,2928,2.65,2929,2.65,2930,2.65,2931,2.65,2932,2.481,2933,2.895,2934,2.481,2935,2.65,2936,5.154,2937,2.65,2938,2.65,2939,2.65,2940,2.65,2941,2.895,2942,2.65,2943,2.895,2944,2.895]],["keywords/646",[]],["title/647",[1857,692.162,2945,947.258]],["content/647",[29,7.257,46,9.964,55,8.696,62,6.882,88,11.336,89,7.396,90,9.248,95,5.135,101,7,103,10.183,117,7.959,149,4.341,157,4.805,173,8.353,208,7.19,228,6.098,382,4.88,460,4.733,857,8.956,875,10.691,912,9.408,938,10.992,1019,5.575,1060,8.052,1081,7.702,1162,11.336,1247,9.965,1299,6.94,1427,9.098,1508,8.956,1635,8.576,1671,7.785,1794,7.326,2256,10.183,2785,7.785,2790,9.248,2946,11.737,2947,11.737,2948,11.737,2949,11.737,2950,11.737,2951,9.965]],["keywords/647",[]],["title/648",[1081,621.593,1151,759.301]],["content/648",[2952,16.234,2953,16.234]],["keywords/648",[]],["title/649",[1158,722.84,1159,804.245]],["content/649",[]],["keywords/649",[]],["title/650",[345,307.098,449,301.208,3201,625.674]],["content/650",[1,9.923,57,7.977,58,2.022,72,6.357,95,4.716,149,5.157,382,5.797,400,8.963,449,7.027,508,4.906,715,7.451,1103,9.15,1227,6.664,1669,8.542,2295,10.809,3132,10.809,3201,11.177,3202,12.099]],["keywords/650",[]],["title/651",[449,365.537,508,333.282]],["content/651",[3,1.593,36,4.416,43,5.942,45,2.662,50,3.163,58,2.125,76,3.687,79,3.526,92,6.807,106,3.558,149,4.678,211,4.132,218,4.976,237,2.619,238,3.668,266,5.759,304,5.733,338,3.083,339,5.117,341,3.424,350,4.551,382,3.725,438,7.235,449,5.657,508,3.152,512,5.177,584,8.959,669,4.53,687,2.478,870,3.824,884,4.967,1012,3.744,1019,4.256,1101,6.008,1225,7.313,1297,8.161,1475,8.161,1632,6.837,1706,10.861,1723,6.22,1724,7.313,1750,8.391,1758,10.138,1976,8.161,3120,7.774,3201,7.182,3203,10.405,3204,15.381,3205,10.405,3206,10.405,3207,7.454,3208,14.689,3209,8.653,3210,9.327,3211,7.774]],["keywords/651",[]],["title/652",[508,333.282,3201,759.301]],["content/652",[27,8.462,126,10.002,149,5.84,188,7.026,218,4.909,323,5.688,417,9.672,449,6.685,460,5.032,508,5.556,693,9.672,901,6.27,902,8.769,1274,7.255,1299,9.337,1636,7.644,1669,11.154,2205,11.082,2295,12.239,2746,12.478,3132,12.239,3201,10.002,3202,10.826,3212,14.491,3213,14.491]],["keywords/652",[]],["title/653",[2295,734.248,3132,734.248]],["content/653",[4,2.6,11,1.633,18,1.429,20,1.69,22,1.178,24,6.396,43,2.113,50,0.797,56,3.697,58,1.592,62,1.868,63,2.65,75,2.16,79,2.055,80,4.462,82,1.808,106,3.841,121,3.48,124,2.829,133,2.469,145,1.715,149,4.626,156,12.123,174,3.566,185,4.111,218,1.253,237,2.579,238,2.138,273,2.753,305,2.343,319,1.59,324,1.884,325,2.735,338,1.096,339,2.369,345,3.934,350,1.146,363,1.808,370,2.007,374,2.983,385,2.185,392,2.829,397,1.9,413,2.069,436,5.279,449,6.287,458,3.049,480,3.2,493,2.136,508,1.952,511,3.884,535,2.328,585,2.705,649,1.444,650,2.395,654,1.247,660,4.179,663,1.78,687,1.535,688,2.395,740,2.902,746,6.259,762,3.83,803,6.123,937,3.48,963,2.297,967,3.857,1017,6.547,1074,2.297,1104,2.705,1105,2.553,1123,5.906,1152,6.017,1158,2.431,1159,2.705,1165,3.567,1185,2.51,1222,2.431,1272,2.239,1276,2.113,1299,1.884,1310,3.603,1311,2.6,1355,1.9,1358,2.705,1359,2.36,1416,3.149,1429,2.902,1442,2.51,1465,2.705,1619,5.197,1622,6.547,1638,2.902,1643,2.328,1669,9.841,1703,1.78,1782,7.07,1786,4.529,1794,1.988,1819,3.186,1933,5.054,1991,2.328,2192,2.267,2295,2.469,2514,4.616,2649,2.705,2651,3.186,2749,2.395,2795,2.705,2965,3.316,3112,2.764,3120,2.764,3132,14.056,3133,11.4,3140,2.902,3141,11.4,3202,6.396,3204,3.077,3207,7.338,3209,3.077,3210,3.316,3211,2.764,3214,6.444,3215,3.7,3216,5.359,3217,3.7,3218,6.444,3219,7.675,3220,3.316,3221,3.316,3222,3.316,3223,7.675,3224,9.183,3225,3.077,3226,8.519,3227,3.7,3228,3.077,3229,3.7,3230,3.316,3231,5.777,3232,3.7,3233,3.316,3234,3.316,3235,3.7,3236,3.316,3237,3.316,3238,3.316,3239,3.316,3240,3.7,3241,3.7,3242,3.7,3243,3.316,3244,3.316,3245,3.7,3246,3.316,3247,3.7,3248,5.777,3249,3.316,3250,3.316,3251,3.316,3252,5.777,3253,5.777,3254,3.316,3255,7.675,3256,7.675,3257,3.316,3258,3.316,3259,3.316,3260,5.777,3261,3.7,3262,3.316,3263,3.316,3264,3.316,3265,3.316,3266,3.316,3267,3.7,3268,3.316,3269,3.7,3270,3.7,3271,3.7,3272,3.7]],["keywords/653",[]],["title/654",[50,301.275]],["content/654",[1,4.916,3,1.317,8,3.762,20,7.464,50,3.977,58,1.002,72,4.766,76,2.843,92,3.718,106,3.815,123,10.455,149,3.867,152,5.654,174,5.058,176,4.396,211,4.822,234,4.44,238,2.003,266,4.44,273,3.427,324,6.183,364,4.304,413,4.486,449,6.373,508,2.43,512,2.129,513,4.156,514,4.353,596,4.486,669,3.745,695,3.665,746,5.865,1095,4.739,1097,5.747,1165,4.44,1216,5.638,1222,5.271,1387,4.581,1399,3.745,1569,3.204,1622,6.135,1669,7.728,1693,4.684,1719,4.533,1782,5.537,1785,5.993,1821,7.09,1836,11.814,1887,5.118,3112,10.946,3125,6.671,3132,11.714,3134,10.098,3135,10.098,3143,10.098,3201,5.537,3202,9.072,3207,5.747,3216,10.098,3226,6.671,3228,10.098,3273,6.292,3274,7.191,3275,7.191,3276,7.191,3277,7.191,3278,10.885,3279,14.646,3280,10.885,3281,10.885,3282,10.885,3283,7.191,3284,7.191,3285,7.191,3286,7.191,3287,7.191,3288,7.191,3289,8.022]],["keywords/654",[]],["title/655",[22,350.355,125,469.918]],["content/655",[8,6.359,31,9.95,58,2.175,364,5.118,449,5.789,569,13.017,596,9.742,1082,8.723,1165,9.643,3290,17.423]],["keywords/655",[]],["title/656",[45,281.443,173,674.112]],["content/656",[1,1.441,4,1.653,11,1.038,18,0.957,20,3.351,24,3.212,45,0.602,50,0.926,58,1.198,63,1.685,72,2.331,75,1.373,79,2.05,80,1.873,82,1.149,89,1.276,92,1.09,95,0.685,106,3.922,107,1.188,118,1.264,124,1.799,145,1.09,149,3.35,152,2.831,156,8.044,160,1.406,163,1.72,173,1.441,174,3.055,176,1.289,185,2.743,197,0.809,202,3.575,232,1.501,233,6.698,237,2.415,238,4.211,273,2.536,304,2.863,318,1.159,324,1.198,325,0.998,338,1.759,339,1.643,341,0.774,345,5.283,350,3.944,364,1.263,397,1.208,413,1.315,434,1.964,436,4.694,438,2.118,449,6.117,456,1.005,457,1.923,458,3.375,460,0.817,470,3.702,476,1.09,480,2.135,491,4.102,499,3.191,503,1.123,508,1.799,511,4.772,512,1.947,513,3.076,514,3.98,520,2.135,526,1.685,528,1.441,530,1.501,535,1.48,539,1.545,543,1.545,544,6.861,546,1.545,585,1.72,660,1.547,661,1.802,663,1.132,687,1.024,695,4.805,746,5.362,762,1.052,772,5.255,778,1.276,803,2.57,814,1.406,871,2.213,880,1.159,891,1.799,942,1.423,967,3.304,975,1.596,992,1.757,1017,4.541,1068,1.132,1073,1.178,1095,1.389,1123,6.34,1152,1.653,1158,1.545,1159,1.72,1165,2.379,1216,1.653,1227,0.968,1264,8.123,1272,1.423,1274,2.153,1355,1.208,1358,3.143,1359,1.501,1366,1.522,1387,2.455,1399,1.098,1415,1.697,1416,2.901,1447,1.441,1470,3.736,1569,0.939,1598,1.406,1619,3.467,1622,4.541,1629,2.025,1669,7.027,1670,1.845,1706,2.743,1715,1.315,1719,3.355,1723,1.406,1724,1.653,1725,1.72,1729,1.57,1782,5.895,1785,1.757,1821,2.51,1836,4.788,1841,2.57,1857,1.48,1904,1.956,1988,1.845,1991,1.48,2054,2.783,2133,7.3,2137,2.025,2180,1.845,2206,1.757,2448,6.808,2501,3.212,2505,1.685,2514,3.08,2543,2.025,2649,1.72,2749,1.522,2802,3.021,2934,1.897,2979,1.343,3112,5.48,3120,4.436,3125,1.956,3132,12.619,3133,7.978,3134,3.575,3135,3.575,3140,1.845,3141,4.938,3143,3.575,3201,5.063,3202,5.48,3204,1.956,3207,1.685,3209,1.956,3211,4.436,3216,3.575,3219,3.854,3220,2.109,3221,2.109,3222,2.109,3223,2.109,3224,5.323,3225,1.956,3226,4.938,3228,3.575,3230,2.109,3231,6.575,3233,2.109,3234,2.109,3236,2.109,3237,2.109,3238,2.109,3239,2.109,3243,2.109,3244,2.109,3246,2.109,3248,3.854,3249,2.109,3250,5.323,3251,3.854,3252,6.575,3253,5.323,3254,2.109,3255,5.323,3256,5.323,3257,2.109,3258,2.109,3259,2.109,3260,3.854,3262,2.109,3263,2.109,3264,2.109,3265,2.109,3266,2.109,3273,1.845,3274,2.109,3275,2.109,3276,2.109,3277,2.109,3278,3.854,3279,6.575,3280,3.854,3281,3.854,3282,3.854,3283,2.109,3284,2.109,3285,2.109,3286,2.109,3287,2.109,3288,2.109,3291,2.352,3292,2.352,3293,2.352,3294,2.352,3295,2.352,3296,2.352,3297,2.352,3298,2.352,3299,2.352,3300,2.352,3301,4.299,3302,4.299,3303,2.352,3304,2.352,3305,2.352,3306,5.938,3307,2.352,3308,2.352,3309,2.352,3310,2.352,3311,2.352,3312,2.352,3313,2.352,3314,2.352,3315,2.352,3316,2.352,3317,2.352,3318,2.352]],["keywords/656",[]],["title/657",[12,288.256,18,75.13,258,243.803,364,196.957,760,260.224]],["content/657",[]],["keywords/657",[]],["title/658",[18,156.743]],["content/658",[18,1.554,58,0.916,106,3.861,110,2.983,113,9.932,150,6.942,152,2.832,179,3.02,218,2.486,237,4.245,238,2.833,239,3.477,260,5.568,266,6.278,304,6.958,305,4.124,338,4.622,339,4.665,341,2.415,345,3.843,456,6.663,459,3.426,476,3.401,509,7.523,510,4.563,511,6.29,512,4.14,654,2.474,660,4.082,778,8.464,796,5.075,803,4.387,838,3.426,962,6.578,963,4.556,1061,4.441,1103,4.146,1210,3.644,1244,12.328,1385,7.237,1415,2.897,1439,7.674,1447,4.497,1452,5.612,1470,11.695,1477,4.979,1501,4.556,1536,5.365,1627,4.556,1715,4.103,2054,4.75,2076,4.682,2085,6.103,2094,11.53,2548,6.903,2549,6.103,2550,6.903,2551,6.103,2552,9.433,2553,9.433,2554,6.903,2555,6.903,2556,10.67,2557,10.67,2558,6.903,2559,6.903,2560,6.903,2561,6.903,2562,6.903,2563,6.903,2564,6.903,2565,6.903,2566,6.103,2567,6.103,2749,7.342]],["keywords/658",[]],["title/659",[18,123.267,364,323.151]],["content/659",[3,0.877,8,5.457,18,1.649,22,2.575,31,4.617,56,3.541,58,1.525,106,3.803,115,2.304,119,4.304,152,4.714,176,6.693,187,8.147,204,4.488,208,4.265,209,3.617,211,4.85,241,3.174,258,2.94,260,2.285,266,4.475,288,4.521,342,4.668,364,4.324,458,3.635,512,3.907,596,4.521,660,2.909,669,2.494,718,4.568,850,12.242,1002,12.2,1012,2.909,1123,4.966,1132,8.695,1133,6.976,1135,7.582,1137,14.357,1138,4.521,1140,8.584,1143,6.52,1144,5.682,1553,4.43,1764,5.792,1793,5.087,2549,6.724,2568,10.517,2569,10.517,2570,6.962,2571,6.962,2572,6.962,2573,6.52,2574,6.962,2575,6.962,2576,6.962,2577,6.962,2578,7.606,2579,11.49,2580,9.58,2581,7.606,2582,7.606,2583,7.606,2584,7.606,2585,7.606,2586,7.606,2587,7.606,2588,7.606,2589,7.606,2590,7.606,2591,6.962,2592,7.606,2593,7.606,2594,7.606,2595,7.606,2596,7.606,2597,7.606]],["keywords/659",[]],["title/660",[654,370.874,1501,682.927]],["content/660",[12,4.429,18,1.154,56,2.987,58,1.286,62,5.201,101,5.291,106,3.083,107,8.548,118,9.896,150,5.158,152,6.534,204,6.222,241,4.044,260,2.911,303,6.572,305,3.746,382,3.688,412,10.245,453,6.989,456,6.23,654,6.207,686,8.87,699,8.072,719,7.24,760,3.998,778,5.59,793,8.307,794,7.696,796,6.525,799,6.989,838,6.809,906,8.307,1065,4.213,1387,5.883,1501,11.43,1535,12.129,1536,7.531,1540,8.567,1550,7.878,1553,5.645,1568,5.59,1671,5.883,1857,11.585,2552,8.567,2553,8.567,2566,8.567,2567,8.567,2598,9.691,2599,9.691,2601,15.312,2603,7.878,2604,8.567,2605,9.691,2606,9.691,2607,9.691,2608,8.567,3096,10.302,3097,10.302,3098,10.302,3099,10.302,3100,10.302]],["keywords/660",[]],["title/661",[12,472.947,760,426.953]],["content/661",[11,1.555,12,5.741,18,0.395,58,1.029,69,3.158,106,3.943,107,4.999,113,8.066,118,4.43,152,4.345,188,6.874,191,1.991,204,5.906,211,1.399,237,1.554,238,3.335,239,1.669,241,1.383,260,4.917,273,4.809,278,5.535,303,2.248,304,3.864,305,4.506,319,1.515,331,6.316,332,4.979,339,1.708,350,3.84,361,2.524,385,2.081,412,4.988,451,2.39,456,4.809,499,1.893,511,2.801,512,3.544,520,1.749,669,1.087,695,1.609,699,10.594,702,2.841,732,7.288,750,2.93,760,1.367,767,6.303,778,6.725,793,2.841,794,2.632,796,5.037,799,2.39,803,2.106,838,4.622,870,1.295,906,2.841,917,5.535,918,4.121,940,2.93,965,4.121,975,2.39,1015,2.057,1065,2.525,1130,2.217,1134,5.793,1161,2.248,1244,9.763,1286,5.535,1340,7.765,1503,2.315,1510,2.524,1513,2.187,1519,2.694,1550,4.722,1553,6.791,1558,2.575,1627,2.187,1710,8.921,1785,2.632,1811,2.28,1857,8.921,2054,3.997,2076,5.259,2143,2.575,2210,4.339,2212,2.93,2278,2.248,2394,4.843,2406,8.233,2551,2.93,2580,2.763,2601,10.306,2603,2.694,2604,2.93,2608,2.93,2609,3.033,2610,3.314,2611,3.314,2612,3.314,2613,3.033,2614,3.314,2615,3.314,2616,3.314,2617,3.314,2618,3.314,2619,3.314,2620,3.314,2621,5.809,2622,3.314,2623,9.314,2624,3.314,2625,7.754,2626,3.314,2627,5.809,2628,5.809,2629,5.809,2630,3.314,2631,3.314,2632,3.314,2633,3.314,2634,3.314,2635,3.314,2636,3.314,2637,3.314,2638,3.314,2640,7.754,2641,5.809,2642,3.314,2643,3.314,2644,5.809,2645,3.314,2646,3.314,2647,3.314,2648,5.317,2649,2.575,2650,3.314,2651,7.097,2652,3.314,2653,5.809,2654,3.314,2655,5.809,2656,3.314,2658,3.314,2659,3.314,2660,3.314,2661,3.314,2662,3.314,2663,3.314,2664,3.033,2665,3.314,2666,3.314,2667,3.314,2668,3.314,2669,3.314,2670,3.314,2671,3.314,2672,5.809,2673,3.314,2674,3.314,2675,5.809,2676,3.314,2677,3.314,2678,3.314,2679,2.763,2680,3.314,2681,3.314,2682,3.314,2683,3.033,2684,3.314,2685,3.314,2686,3.314,2687,3.314,2688,3.314,2689,3.314,2690,3.314,2691,3.314,2692,3.314,2693,3.314,3101,3.523,3102,3.523]],["keywords/661",[]],["title/662",[1627,682.927,2303,841.289]],["content/662",[]],["keywords/662",[]],["title/663",[157,387.826,416,495.593]],["content/663",[3,1.77,58,2.038,61,9.877,79,3.918,87,9.322,110,6.636,157,5.754,204,5.998,260,4.612,293,9.531,510,5.372,654,5.503,876,10.002,958,5.612,1152,11.471,1409,9.322,2304,13.574,2431,15.355,2432,15.355]],["keywords/663",[]],["title/664",[45,357.876]],["content/664",[65,9.323,79,3.605,95,4.373,157,5.294,202,12.489,305,5.461,382,5.376,449,4.99,509,8.149,512,3.985,513,7.781,654,5.063,772,10.758,778,8.149,796,6.719,900,11.779,914,13.462,957,13.462,1065,6.142,1103,8.485,1156,10.554,1284,8.977,1501,9.323,2191,9.867,2206,11.219,2433,14.127,2434,14.127,2435,14.127,2436,14.127,2437,14.127]],["keywords/664",[]],["title/665",[79,264.052,318,541.885]],["content/665",[3,1.329,7,5.521,56,3.554,58,2.475,80,5.338,106,3.107,128,9.613,145,5.68,160,7.326,204,6.817,237,3.086,241,4.811,260,3.463,305,4.457,339,3.391,396,5.521,436,6.807,456,7.925,458,3.648,473,8.459,510,4.034,512,4.363,513,6.35,514,6.651,516,8.614,518,7.82,519,11.155,551,10.987,870,4.504,944,8.78,967,5.521,1157,7.077,1415,4.839,1449,6.086,1465,8.96,1477,8.315,1480,7.326,1525,9.601,1587,7.24,1703,5.896,1713,8.459,2080,10.193,2438,8.78,2439,9.157,2440,8.78,2441,9.613,2442,9.884,2443,11.53]],["keywords/665",[]],["title/666",[778,759.051]],["content/666",[3,0.853,5,3.786,45,2.013,58,1.494,79,2.872,106,3.82,177,5.753,237,5.163,238,4.577,241,3.089,245,4.494,304,6.315,328,4.951,338,2.332,339,2.177,341,5.325,345,4.054,350,5.013,396,5.391,434,3.595,449,2.615,457,3.521,458,2.342,459,3.674,476,3.647,488,6.988,499,4.229,511,6.569,512,2.088,513,4.077,514,4.27,520,5.942,521,5.339,522,6.018,523,6.018,526,5.637,527,7.054,660,2.832,661,3.298,687,3.448,693,7.987,739,2.803,778,4.27,880,3.876,926,5.021,967,3.545,1123,7.452,1276,4.494,1310,4.4,1355,4.042,1467,4.885,1598,4.704,1627,4.885,1669,7.638,1719,4.446,1723,4.704,1724,5.531,1725,5.753,1729,5.252,2064,5.753,2105,6.544,2133,4.312,2303,6.018,2345,4.446,2438,5.637,2444,7.403,2445,7.403,2446,7.403,2447,7.403,2448,5.094,2449,9.386,2450,6.172,2451,5.432,2452,5.753,2457,7.403,2458,7.403,2459,7.403,2460,7.403,2461,7.403,2462,11.257,2463,7.403,2464,7.403,2465,7.403,2466,7.403,2713,6.346,2769,6.776,3319,7.87,3320,7.87,3321,7.87,3322,7.87]],["keywords/666",[]],["title/667",[161,1097.182]],["content/667",[7,2.807,20,2.847,24,4.656,45,2.552,89,3.382,106,3.902,107,3.146,149,1.985,152,2.405,157,2.197,160,5.962,171,4.228,193,3.725,218,2.111,237,4.832,238,4.362,260,3.524,270,4.159,321,3.725,338,1.847,339,1.724,341,3.283,345,5.282,350,3.864,396,4.493,436,5.901,457,2.788,458,3.712,460,2.164,470,7.222,491,8.718,503,2.975,508,3.022,511,5.657,528,3.819,529,5.587,530,3.976,535,3.921,539,4.095,543,4.095,544,12.269,546,4.095,548,4.034,549,4.301,552,3.229,687,1.484,688,4.034,803,3.725,876,3.819,949,3.869,967,2.807,1123,8.697,1156,4.38,1355,6.404,1710,3.921,2133,10.744,2345,3.521,2438,4.464,2448,10.092,2451,4.301,2467,5.366,2468,5.863,2469,5.863,2470,4.888,2471,4.888,2472,4.556,2473,4.888,2474,4.888,2475,7.823,2476,5.863,2477,4.888,2478,4.888,2479,11.731,2480,5.366,2481,5.863,2482,4.888,2483,4.888,2484,4.888,2485,4.888,2486,5.863,2487,5.366,2488,9.383,2489,5.863,2490,5.863,2491,5.863,2492,5.863,2979,3.559]],["keywords/667",[]],["title/668",[50,301.275]],["content/668",[18,1.341,50,3.118,58,0.982,106,3.96,145,4.724,149,3.247,160,2.791,164,3.223,233,6.022,237,1.175,238,3.615,260,2.223,273,5.11,293,2.726,319,2.007,323,1.833,331,7.633,350,1.447,364,1.372,396,6.016,436,4.22,449,3.387,460,1.621,470,5.587,491,8.612,493,5.886,499,2.509,510,1.537,512,2.088,513,4.076,514,6.492,520,2.319,544,8.76,660,1.68,661,3.297,717,2.463,732,5.092,758,3.571,778,2.534,803,2.791,814,2.791,838,2.18,958,3.505,967,6.938,1028,4.186,1068,2.246,1073,2.338,1093,6.169,1123,6.844,1204,3.404,1299,2.377,1322,3.426,1380,2.979,1399,2.18,1447,2.861,1569,5.782,1719,4.445,1793,9.109,1822,3.345,1850,3.883,1927,2.584,1958,3.571,1977,3.116,1996,3.571,2020,4.542,2257,3.662,2280,2.861,2361,3.345,2381,6.916,2383,3.571,2390,7.861,2438,3.345,2472,3.413,2493,3.883,2494,3.883,2495,3.883,2496,3.883,2497,3.662,2498,6.016,2499,6.016,2500,8.478,2501,5.877,2502,3.883,2503,3.883,2504,3.883,2505,3.345,2506,3.883,2507,10.213,2508,10.475,2509,7.796,2510,3.883,2511,3.883,2512,7.796,2513,3.883,2514,5.636,2515,3.883,2516,3.883,2517,9.949,2518,6.542,2519,3.883,2520,6.016,2521,3.883,2522,3.883,2523,3.883,2524,3.883,2525,4.392,2526,6.542,2527,9.949,2528,4.392,2529,11.106,2530,4.392,2531,4.392,2532,4.392,2533,4.392,2534,6.542,2535,6.542,2536,4.392,2537,7.401,2538,4.392,2539,4.02,2540,4.392,2541,4.392,2542,3.883,2543,4.02,2544,4.392,2545,3.883,2546,4.392]],["keywords/668",[]],["title/669",[22,350.355,125,469.918]],["content/669",[79,4.182,179,7.169,218,5.902,396,7.849,870,6.402,891,13.324,1106,8.514,1627,10.816,2278,11.116,2303,13.324,2547,16.39]],["keywords/669",[]],["title/670",[1716,1002.099]],["content/670",[]],["keywords/670",[]],["title/671",[45,357.876]],["content/671",[65,10.549,79,4.854,149,5.412,396,7.655,470,8.332,663,8.175,1669,8.964,2750,15.986,2751,15.986,2752,15.986,2753,15.986]],["keywords/671",[]],["title/672",[79,264.052,318,541.885]],["content/672",[56,4.172,58,2.504,60,5.649,76,5.099,79,4.813,106,3.057,115,4.101,218,4.875,237,3.623,318,7.088,338,4.264,339,3.981,396,8.225,397,7.39,654,4.851,739,6.502,1106,8.921,1174,11.604,1449,7.146,1500,10.309,1711,11.967,1712,11.967,1716,13.079,1717,10.52,1718,11.967,2754,11.967,2755,13.537]],["keywords/672",[]],["title/673",[1706,892.464]],["content/673",[16,2.955,19,4.078,29,3.588,56,3.078,58,1.325,61,4.078,79,1.618,106,3.845,237,5.203,238,5.161,241,2.646,304,5.814,324,3.432,338,1.997,341,2.218,345,5.83,350,5.58,364,1.98,378,4.573,385,3.981,396,3.036,406,3.555,430,3.492,457,3.016,458,3.908,459,3.146,470,5.067,476,3.124,487,5.035,491,7.342,511,6.757,512,1.789,513,5.499,514,5.76,520,5.271,526,4.828,528,4.13,530,4.3,539,4.429,543,4.429,544,7.945,546,4.429,661,2.825,1106,5.187,1123,7.586,1217,3.892,1222,4.429,1274,3.375,1297,5.287,1355,3.462,1480,4.029,1547,5.154,1566,4.184,1668,4.652,1669,3.555,1706,4.3,1713,4.652,1716,4.828,1719,5.998,1720,5.605,1721,5.605,1723,4.029,1724,4.737,1725,4.927,1727,5.154,1728,4.573,1729,4.499,1731,5.605,2133,10.519,2258,5.605,2441,5.287,2448,9.642,2754,5.605,2756,6.341,2757,6.341,2758,6.341,2759,6.341,2760,6.341,2761,6.341,2762,6.341,2763,6.341,2764,6.341,2765,5.435,2766,6.341,2767,6.341,2768,6.341,2769,5.804,2770,6.341,2771,6.341,2772,5.804,2773,6.341,2774,6.341,2775,6.341,2776,6.341,2777,6.341]],["keywords/673",[]],["title/674",[2427,1163.321]],["content/674",[3,1.677,17,6.288,18,1.733,19,9.359,36,6.565,50,3.331,56,4.485,65,9.602,78,11.555,79,3.712,139,11.555,155,12.131,157,5.453,221,10.163,416,6.968,618,13.865,635,12.863,718,8.739,949,9.602,1469,11.08,1521,11.307,1887,9.868,2278,9.868,2778,14.55,2779,14.55,2780,13.318]],["keywords/674",[]],["title/675",[1106,683.567]],["content/675",[]],["keywords/675",[]],["title/676",[157,387.826,416,495.593]],["content/676",[3,1.703,50,4.152,61,9.501,79,3.769,87,8.968,110,6.384,157,5.536,260,4.437,293,9.169,305,5.709,460,5.453,958,5.399,1027,7.734,1152,11.035,1204,6.794,2304,13.058,2305,14.771,2306,14.771,2307,14.771,2308,14.771,2309,14.771,2310,14.771,2311,14.771]],["keywords/676",[]],["title/677",[45,357.876]],["content/677",[45,4.048,79,3.798,110,6.433,115,5.52,149,5.039,174,6.591,182,6.759,470,7.475,508,4.793,660,5.694,661,6.632,663,9.318,687,4.613,739,5.635,1272,9.574,1369,10.241,2280,9.695,2312,14.884,2313,14.884]],["keywords/677",[]],["title/678",[79,264.052,739,391.804]],["content/678",[3,1.291,19,7.203,48,9.336,56,3.451,57,5.863,58,2.013,79,3.869,101,6.113,106,3.281,115,3.392,182,5.085,237,2.997,260,3.364,330,7.489,339,4.46,380,7.705,470,4.594,510,5.305,608,9.599,739,5.741,760,4.62,778,6.459,870,4.374,904,7.945,958,5.542,1027,5.863,1106,7.877,1204,5.151,1276,6.798,1304,6.976,1312,6.951,1346,7.203,1382,7.705,1411,6.726,1415,6.364,1449,5.911,1480,7.115,1497,6.061,1501,7.389,1587,9.523,1794,6.397,2148,8.702,2314,8.527,2315,15.201,2316,11.198,2317,11.198,2318,10.25,2319,11.198,2320,9.899,2321,10.25,2322,11.198]],["keywords/678",[]],["title/679",[79,264.052,1210,546.292]],["content/679",[3,0.891,43,4.691,62,4.147,72,4.852,79,2.967,98,4.079,106,3.614,110,3.339,115,4.235,149,2.616,152,3.17,182,5.28,197,2.824,198,4.91,218,2.782,237,4.464,238,2.051,241,4.852,260,2.321,293,4.796,325,5.246,327,5.728,328,5.168,338,2.434,339,4.112,341,4.068,345,2.782,357,5.884,364,2.413,397,4.218,458,3.679,459,3.834,460,5.161,470,7.677,476,3.806,488,4.796,499,6.643,503,7.095,654,2.769,660,6.704,687,3.539,717,4.333,718,4.641,739,4.402,762,3.675,958,2.824,1105,5.669,1106,6.04,1175,6.136,1210,4.079,1272,4.97,1304,3.554,1382,5.316,1408,6.83,1617,6.83,1668,5.669,1728,8.386,1786,5.772,1794,4.414,2246,6.281,2255,7.072,2281,6.83,2314,5.884,2315,10.279,2324,7.727,2325,7.727,2326,7.727,2327,6.83,2328,11.365,2329,6.83,2334,7.727,2335,7.727,2336,7.727,2337,7.727,2340,7.727,2341,7.727,2345,6.984,2349,7.727,2350,6.83,2713,6.623,2715,6.623,2979,7.059,3324,8.214,3325,8.214,3326,8.214,3327,8.214,3328,8.214,3329,8.214,3330,8.214]],["keywords/679",[]],["title/680",[157,387.826,508,333.282]],["content/680",[12,5.1,18,0.872,19,4.708,56,2.256,58,1.795,72,3.054,79,1.868,106,3.799,107,3.928,115,3.381,118,4.182,149,3.778,152,3.003,237,4.049,238,3.591,260,2.199,325,3.302,338,2.306,341,2.561,345,2.636,348,7.918,350,4.455,356,9.305,397,3.996,413,4.35,454,5.813,457,3.481,458,4.28,460,4.993,470,6.207,487,5.813,488,4.543,499,4.182,503,5.664,508,4.356,510,3.904,552,4.031,572,6.975,652,5.459,654,2.623,661,3.261,663,5.707,678,4.263,687,4.124,695,5.42,739,2.771,760,3.02,901,3.367,1077,6.274,1106,3.802,1204,3.367,1217,4.492,1322,5.167,1514,4.306,1528,5.193,1547,5.95,1600,6.928,1703,3.743,1727,5.95,1728,9.755,1841,4.651,2070,5.813,2133,6.501,2280,4.768,2314,5.574,2327,6.47,2328,5.95,2329,6.47,2351,7.319,2352,7.319,2353,7.319,2354,7.319,2355,7.319,2356,7.319,2357,7.319,2358,7.319,2359,7.319,2360,7.319,2361,5.574,2362,7.319,2363,7.319,2364,11.16,2365,7.319,2366,7.319,2367,6.47,2368,9.567,2369,7.319,2370,6.47,2371,7.319,2372,7.319,2373,7.319,2374,7.319,2375,11.16,2376,6.47,2377,7.319,2378,7.319,2979,4.444]],["keywords/680",[]],["title/681",[50,301.275]],["content/681",[3,0.485,5,2.154,11,1.976,12,1.925,16,1.963,18,1.919,22,1.426,50,3.564,54,2.614,56,1.298,58,1.885,60,2.98,72,3.88,76,1.586,79,2.373,80,1.95,82,2.188,92,3.519,106,3.555,115,4.717,119,2.384,152,1.728,169,1.95,174,5.9,180,4.336,191,4.29,197,1.539,199,4.013,218,1.517,238,3.255,241,4.571,245,4.336,260,1.265,263,4.013,273,3.243,293,4.433,303,2.856,323,2.98,325,3.223,327,3.519,338,1.327,350,2.352,364,1.315,412,2.709,430,2.319,436,1.853,438,3.74,457,2.003,458,3.88,460,4.043,470,6.804,499,2.406,508,1.356,510,1.473,512,1.188,580,1.865,589,3.511,611,4.013,639,2.942,649,1.747,661,4.143,687,3.941,695,4.516,715,2.06,717,2.362,739,3.521,775,4.013,814,2.676,884,3.625,896,2.09,901,4.277,958,3.399,968,3.424,1019,1.831,1065,1.831,1068,2.154,1073,2.242,1077,3.61,1081,5.586,1082,2.242,1093,2.709,1106,4.831,1130,7.326,1156,5.336,1160,4.013,1204,1.937,1210,3.77,1217,2.585,1225,3.146,1227,4.068,1272,2.709,1274,3.801,1276,2.557,1299,2.28,1304,1.937,1368,5.672,1369,2.898,1382,2.898,1399,3.544,1445,2.942,1467,2.779,1569,6.343,1600,2.614,1625,3.207,1627,2.779,1628,3.723,1636,2.362,1668,3.09,1703,3.652,1728,8.843,1786,3.146,1793,9.498,1804,6.314,1821,4.433,1872,3.511,1904,3.723,1924,3.273,1926,3.723,1927,2.478,1964,2.557,2020,9.556,2246,3.424,2247,3.511,2277,3.723,2280,2.743,2297,3.723,2314,3.207,2328,5.806,2342,3.855,2361,3.207,2367,3.723,2370,3.723,2379,10.953,2380,7.142,2381,5.151,2382,3.723,2383,3.424,2384,4.212,2385,7.142,2386,7.142,2387,7.593,2388,7.142,2389,4.212,2390,4.989,2391,4.212,2392,7.142,2393,4.212,2394,3.511,2395,4.212,2396,4.212,2397,4.212,2398,4.212,2399,4.212,2400,4.212,2401,4.212,2402,4.212,2403,3.723,2404,3.855,2405,4.212,2406,3.723,2407,4.212,2408,4.212,2409,4.212,2410,3.723,2411,4.212,2412,4.212,2413,4.212,2414,4.212,2415,4.212,2416,3.855,2417,4.212,2418,4.212,2419,3.723,2420,3.511,2421,4.212,2422,4.212,2423,4.212,2424,4.212,2425,4.212,2426,4.212]],["keywords/681",[]],["title/682",[2427,1163.321]],["content/682",[18,2.212,50,3.515,58,2.038,76,5.783,79,3.918,85,10.413,364,4.795,382,5.843,678,8.944,739,5.813,776,6.841,1095,9.642,1103,9.222,1106,7.976,1175,12.194,2428,15.355,2429,15.355,2430,14.054]],["keywords/682",[]],["title/683",[22,350.355,125,469.918]],["content/683",[22,5.844,82,8.967,396,8.267,508,5.56,678,10.056]],["keywords/683",[]],["title/684",[650,712.065,3332,759.301]],["content/684",[]],["keywords/684",[]],["title/685",[18,101.574,3332,625.674,3333,753.863]],["content/685",[18,1.72,72,6.026,80,6.687,149,4.889,157,5.412,434,7.014,470,5.925,958,5.278,1059,12.38,1065,6.279,1158,10.087,1312,8.965,1466,10.087,1508,10.087,2505,10.998,3085,12.041,3332,10.596,3334,15.811,3335,15.352,3336,15.352,3337,15.352,3338,15.352,3339,12.767,3340,15.352,3341,15.352,3342,15.352]],["keywords/685",[]],["title/686",[36,466.935,1793,692.162]],["content/686",[3,2.255,36,6.614,58,1.946,149,6.911,449,5.178,512,4.136,669,5.919,870,7.051,1074,9.674,1131,6.878,1158,10.239,1758,13.244,2287,13.418,3085,12.223,3332,10.756,3333,12.96,3343,13.97]],["keywords/686",[]],["title/687",[18,123.267,508,333.282]],["content/687",[3,0.581,18,1.68,45,0.768,50,1.9,56,0.87,58,1.524,79,2.118,92,1.391,98,1.49,106,3.863,134,6.92,145,1.391,149,2.312,160,1.794,173,1.839,179,1.235,197,1.842,214,2.242,215,5.797,218,1.815,237,3.904,238,2.809,241,1.178,243,5.477,245,1.714,260,1.514,273,2.289,293,3.129,304,3.955,305,2.639,318,1.478,319,2.304,321,1.794,338,1.588,339,2.803,341,0.988,345,3.433,350,1.66,357,3.838,364,0.882,373,1.644,413,1.678,426,3.728,430,1.555,436,1.242,449,3.737,456,2.289,457,1.343,458,2.626,460,3.064,470,4.34,476,1.391,503,4.212,508,0.909,510,1.763,516,5.101,528,1.839,535,1.888,650,1.943,654,1.012,660,1.08,682,1.972,687,2.907,718,1.696,739,1.069,905,1.816,958,3.484,961,2.003,967,4.565,975,2.036,1002,1.773,1025,6.591,1054,1.598,1065,1.227,1075,1.943,1093,5.339,1106,3.547,1180,3.242,1203,1.943,1204,3.818,1210,1.49,1244,7.408,1304,1.299,1310,2.996,1322,1.307,1351,2.194,1352,1.915,1366,3.468,1399,1.401,1442,2.036,1448,2.003,1470,1.888,1481,4.321,1491,5.477,1497,1.528,1508,3.521,1569,2.899,1600,1.752,1623,2.194,1669,2.826,1710,1.888,1715,1.678,1717,2.194,1758,3.698,1794,3.901,1810,3.917,1821,3.129,1927,1.661,1977,2.003,2021,2.354,2042,2.42,2156,4.614,2191,1.972,2192,1.839,2205,2.295,2247,2.354,2280,3.283,2345,3.027,2390,1.972,2394,4.203,2441,2.354,2648,2.584,2749,3.468,2765,2.42,2895,2.42,2979,1.714,3113,2.69,3207,2.15,3211,2.242,3273,2.354,3332,12.44,3334,7.337,3339,2.496,3343,2.69,3344,3.001,3345,3.001,3346,3.001,3347,3.001,3348,3.001,3349,3.001,3350,3.001,3351,3.001,3352,3.001,3353,9.084,3354,7.258,3355,7.258,3356,7.258,3357,9.084,3358,8.823,3359,10.082,3360,8.823,3361,13.901,3362,3.001,3363,3.001,3364,3.001,3365,3.001,3366,3.001,3367,3.001,3368,3.001,3369,3.001,3370,3.001,3371,3.001,3372,3.001,3373,7.909,3374,6.507,3375,3.001,3376,5.358,3377,3.001,3378,3.001,3379,3.001,3380,3.001,3381,3.001,3382,3.001,3383,3.001,3384,7.909,3385,2.69,3386,2.69,3387,7.258,3388,3.001,3389,3.001,3390,3.001,3391,3.001,3392,3.001,3393,3.001,3394,3.001,3395,3.001,3396,5.358,3397,3.001,3398,2.69,3399,2.69,3400,3.001,3401,3.001,3402,5.358,3403,3.001,3404,2.69,3405,3.001,3406,5.358,3407,7.258,3408,3.001,3409,3.001,3410,2.69,3411,2.69,3412,3.001,3413,3.001,3414,3.001,3415,3.001,3416,3.001,3417,3.001,3418,3.001,3419,3.001,3420,3.001,3421,3.001,3422,3.001,3423,3.001,3424,3.001,3425,2.69,3426,3.001,3427,6.507,3428,3.001,3429,3.001,3430,3.001,3431,3.001,3432,5.358,3433,6.507,3434,5.358,3435,3.001,3436,3.001,3437,2.69,3438,3.001,3439,3.001,3440,4.803,3441,2.69,3442,2.69,3443,2.354,3444,3.001,3445,5.358,3446,2.69,3447,2.69,3448,5.358,3449,7.258,3450,2.69,3451,5.358,3452,3.001,3453,2.69,3454,3.001,3455,3.001,3456,3.001,3457,3.001,3458,3.001,3459,3.001,3460,3.001,3461,3.001,3462,3.001,3463,3.001,3464,3.001,3465,3.001,3466,2.69,3467,3.001,3468,2.69,3469,3.001]],["keywords/687",[]],["title/688",[2895,1128.04]],["content/688",[3,0.84,16,1.428,18,1.742,20,5.842,29,1.734,50,1.241,56,2.246,58,1.791,79,0.782,106,3.855,115,1.642,119,1.734,134,4.519,149,3.766,152,1.257,160,5.596,171,2.209,179,2.371,197,1.981,235,2.626,237,3.771,238,3.741,243,2.022,260,2.189,270,2.173,273,2.461,288,1.821,304,1.271,305,2.817,319,2.477,338,2.296,339,1.594,341,1.896,342,1.88,345,4.006,350,2.901,357,4.127,373,3.157,381,2.708,406,1.718,417,2.173,430,2.985,436,1.348,449,1.082,457,5.291,458,4.627,460,3.715,470,2.99,480,1.617,503,2.751,516,2.289,528,1.995,660,1.172,669,1.777,672,2.919,687,3.045,739,2.052,819,2.381,870,2.847,884,1.555,950,5.257,958,1.12,967,4.82,1075,6.06,1082,1.63,1093,3.486,1131,1.437,1161,3.676,1173,2.49,1180,3.486,1203,12.528,1204,1.409,1238,2.919,1244,4.212,1247,2.381,1272,1.971,1322,1.418,1351,2.381,1352,2.078,1355,1.672,1366,3.729,1377,4.212,1387,4.425,1395,3.255,1399,1.52,1415,1.286,1419,2.333,1442,2.209,1448,2.173,1481,2.626,1491,4.81,1569,3.095,1597,1.718,1623,2.381,1648,2.433,1669,3.039,1710,3.625,1715,1.821,1810,4.212,1821,3.364,1841,3.444,1927,1.802,1977,2.173,1986,2.108,2037,2.49,2042,2.626,2192,3.53,2206,5.789,2251,2.804,2254,2.804,2260,2.804,2274,2.804,2318,2.804,2330,3.063,2344,3.063,2390,2.14,2420,2.554,2765,2.626,2772,2.804,2932,2.626,2970,4.304,2979,3.29,3207,2.333,3211,2.433,3273,2.554,3332,12.163,3333,7.786,3334,7.786,3339,2.708,3353,8.393,3357,2.919,3359,5.165,3361,12.207,3373,2.919,3374,2.919,3384,2.919,3385,2.919,3386,2.919,3398,5.165,3399,2.919,3404,2.919,3410,2.919,3411,2.919,3425,2.919,3427,8.393,3433,8.393,3437,2.919,3440,5.165,3441,2.919,3442,2.919,3443,6.077,3446,2.919,3447,2.919,3450,2.919,3453,2.919,3466,2.919,3470,3.257,3471,7.748,3472,3.257,3473,3.257,3474,3.257,3475,3.257,3476,3.257,3477,7.748,3478,3.257,3479,3.257,3480,2.919,3481,9.362,3482,7.748,3483,3.257,3484,3.257,3485,5.762,3486,7.748,3487,3.257,3488,3.257,3489,3.257,3490,3.257,3491,3.257,3492,3.257,3493,3.257,3494,3.257,3495,5.762,3496,3.257,3497,3.257,3498,3.257,3499,3.257,3500,3.257,3501,3.257,3502,5.762,3503,3.257,3504,3.257,3505,3.257,3506,3.257,3507,5.165,3508,3.257,3509,3.257,3510,3.257,3511,3.257,3512,3.257,3513,3.257,3514,3.257,3515,3.257,3516,3.257,3517,3.257,3518,3.257,3519,3.257,3520,3.257,3521,3.257,3522,3.257,3523,3.257,3524,3.257,3525,3.257,3526,5.762,3527,5.762,3528,5.762,3529,5.762,3530,3.257,3531,3.257,3532,3.257,3533,3.257,3534,3.257,3535,3.257]],["keywords/688",[]],["title/689",[853,965.506]],["content/689",[3,1.703,18,1.759,57,7.734,58,1.96,79,3.769,82,7.673,115,4.475,157,5.536,322,11.479,460,5.453,614,11.035,650,10.163,678,8.604,687,3.739,870,5.77,958,5.399,1054,8.36,1158,10.317,1312,9.169,1428,10.48,1732,13.52,2278,10.018,3085,12.316,3332,10.838]],["keywords/689",[]],["title/690",[2302,868.391]],["content/690",[]],["keywords/690",[]],["title/691",[45,357.876]],["content/691",[18,1.858,48,13.008,79,3.981,92,7.686,319,7.13,600,11.069,649,6.473,687,3.949,739,5.906,760,8.292,1299,8.444,1606,10.897,2694,10.734,2695,15.601,2696,15.601]],["keywords/691",[]],["title/692",[460,382.009,958,378.226]],["content/692",[3,1.387,58,2.111,82,6.249,106,3.736,174,7.045,179,5.262,237,5.279,318,6.299,337,8.277,339,4.679,458,5.64,460,5.873,503,6.105,715,5.884,739,4.554,958,5.815,1380,8.158,1449,6.35,2345,9.556,2346,11.463,2694,10.947,2697,15.91,2698,15.91,2699,12.029,2700,12.933,2701,12.029,2702,8.676,2703,12.029,2704,12.029,2979,7.303,3075,9.16]],["keywords/692",[]],["title/693",[79,264.052,318,541.885]],["content/693",[18,1.733,57,7.619,58,1.931,79,3.712,106,3.624,237,3.894,339,4.279,480,7.681,510,5.09,654,5.214,1027,7.619,1415,6.106,1587,9.137,1986,10.011,1991,9.731,2191,10.163,2302,9.602,2320,12.863,2694,12.363,2700,11.828,2702,10.494,2705,12.863]],["keywords/693",[]],["title/694",[319,472.947,600,734.248]],["content/694",[12,4.661,18,2.298,20,4.953,45,2.774,79,2.602,106,3.771,218,3.673,237,4.382,238,4.347,260,3.064,319,6.499,338,3.213,341,4.976,350,3.359,380,7.018,480,5.384,600,7.236,649,5.901,661,4.544,687,3.6,760,6.756,880,5.34,901,4.691,1061,6.56,1175,8.1,1217,6.26,1313,8.743,1415,4.28,1532,9.016,1600,6.331,1606,7.124,1846,6.56,2271,9.016,2302,6.73,2339,9.719,2350,9.016,2694,11.267,2702,7.356,2705,12.573,2706,10.199,2707,10.199,2708,10.199,2709,14.222,2710,10.199,2711,10.199,2712,10.199,2713,8.743,2714,10.199,2715,8.743,2716,10.199,2717,10.199,2718,10.199,2719,10.199]],["keywords/694",[]],["title/695",[1165,774.227]],["content/695",[18,1.415,43,7.214,79,3.032,106,3.809,141,9.437,174,6.988,237,4.223,238,4.189,341,4.157,345,5.683,687,3.008,718,9.478,760,7.31,762,5.651,949,7.841,958,4.343,992,9.437,1204,5.466,1322,5.501,1355,8.615,1625,9.048,2302,7.841,2694,12.191,2700,14.403,2702,8.57,2720,11.882,2721,10.504,2722,11.882,2723,11.882,2724,11.882,2725,10.504,2726,11.882,2727,11.882,2728,11.882,2729,11.882]],["keywords/695",[]],["title/696",[1186,615.129,2302,682.927]],["content/696",[18,2.05,19,5.353,50,3.345,57,4.357,58,2.284,63,6.337,76,3.135,79,3.136,80,3.853,106,3.874,115,3.723,152,5.042,198,5.288,218,2.997,237,4.606,238,4.569,260,3.691,273,3.779,323,3.472,338,3.871,339,2.447,341,2.911,345,5.262,350,2.741,485,7.617,486,9.99,508,2.68,687,2.107,715,4.07,760,3.433,814,5.288,838,4.13,942,5.353,1027,4.357,1068,4.256,1073,4.429,1093,5.353,1186,8.685,1191,6.337,1199,7.93,1201,7.617,1202,7.93,1385,5.644,1395,7.381,1398,5.288,1399,4.13,1415,3.492,1782,6.106,1964,5.052,2302,5.492,2694,5.726,2702,6.002,2721,7.357,2725,7.357,2730,8.322,2731,14.611,2732,8.322,2733,8.322,2734,8.322,2735,8.322,2736,8.322,2737,8.322,2738,8.322,2739,8.322,2740,8.322,2741,8.322,2742,8.322,2743,8.322,2744,8.322,2745,8.322,2746,11.248,2747,8.322]],["keywords/696",[]],["title/697",[58,113.175,457,405.573,1593,637.091]],["content/697",[]],["keywords/697",[]],["title/698",[18,156.743]],["content/698",[11,2.89,18,1.79,45,3.75,58,1.609,95,1.907,106,3.945,107,3.306,118,3.519,145,4.808,152,2.527,174,2.728,221,4.302,233,3.868,237,5.167,238,3.99,243,7.999,260,1.85,285,4.012,319,2.815,338,1.94,339,3.565,341,2.155,345,4.365,350,3.214,445,4.892,449,3.447,456,2.797,457,4.642,458,5.498,460,4.474,476,3.035,503,3.126,518,6.619,548,4.238,649,2.556,661,2.745,678,3.588,695,4.74,760,2.541,890,3.624,958,5.04,1123,6.91,1204,2.833,1322,2.852,1352,4.178,1353,5.638,1354,5.638,1355,3.363,1356,5.136,1357,8.933,1358,4.787,1359,8.22,1360,5.638,1362,4.892,1363,5.638,1364,5.638,1365,5.638,1378,10.951,1380,4.178,1407,11.209,1415,2.585,1449,3.252,1491,9.099,1567,4.065,2037,5.007,2133,3.588,2345,5.862,2979,3.74,3225,5.445,3480,5.87,3536,10.715,3537,6.548,3538,6.548,3539,6.548,3540,9.3,3541,10.375,3542,6.548,3543,6.548,3544,6.548,3545,6.548,3546,6.548,3547,12.885,3548,12.885,3549,6.548,3550,6.548,3551,6.548,3552,6.548]],["keywords/698",[]],["title/699",[1132,826.325]],["content/699",[3,1.047,8,2.991,16,1.901,18,1.896,29,2.308,45,2.47,50,1.591,56,1.257,58,1.738,98,2.153,106,3.918,109,3.239,110,1.763,115,2.751,145,5.929,150,3.699,152,3.726,157,3.404,180,2.476,182,1.852,187,2.4,204,2.715,209,3.306,211,3.834,215,2.849,228,4.319,238,1.083,239,2.054,243,5.993,258,2.687,273,1.852,285,2.657,287,2.942,288,4.131,301,7.87,331,6.159,350,1.343,361,5.293,363,5.572,364,4.599,373,7.01,413,2.425,428,2.894,430,2.246,436,1.795,445,3.239,449,1.441,457,4.319,512,2.562,596,2.425,649,4.451,660,1.56,669,2.279,682,10.286,701,3.862,763,2.33,776,1.817,850,8.029,901,3.197,902,4.471,1012,1.56,1019,1.773,1029,2.592,1034,2.561,1035,4.471,1065,1.773,1082,4.834,1131,1.914,1133,4.22,1135,4.587,1138,4.131,1216,9.786,1243,3.316,1265,4.079,1274,3.699,1276,5.514,1283,2.942,1378,7.213,1407,8.72,1418,3.734,1491,2.692,1497,2.208,1553,4.049,1559,3.734,1563,3.734,1569,2.951,1593,5.193,1641,2.592,1643,2.728,1707,3.734,1710,2.728,1757,3.047,1764,3.106,1773,2.942,1809,3.401,1811,6.249,1845,3.497,1846,4.471,1848,3.497,1851,7.785,1927,2.4,1964,2.476,2191,2.849,2272,3.497,2321,3.734,2381,2.942,2467,3.734,2497,3.401,2568,6.362,2569,8.313,2570,3.734,2571,3.734,2572,6.362,2573,3.497,2574,3.734,2575,3.734,2576,3.734,2577,3.734,2580,3.401,2591,3.734,2609,3.734,3075,3.106,3140,5.795,3159,6.623,3160,3.887,3168,3.887,3268,3.887,3443,7.572,3536,3.606,3540,3.887,3553,4.336,3554,4.336,3555,4.336,3556,4.336,3557,4.336,3558,4.336,3559,4.336,3560,4.336,3561,4.336,3562,4.336,3563,4.336,3564,4.336,3565,4.336,3566,4.336,3567,4.336,3568,7.389,3569,9.655,3570,4.336,3571,4.336,3572,4.336,3573,4.336,3574,4.336,3575,4.336,3576,7.389,3577,4.336,3578,4.336,3579,4.336,3580,4.336,3581,4.336,3582,4.336,3583,4.336,3584,7.389,3585,9.655,3586,4.336,3587,7.389,3588,4.336,3589,7.389,3590,4.336,3591,3.887,3592,4.336,3593,4.336,3600,6.951]],["keywords/699",[]],["title/700",[853,965.506]],["content/700",[3,1.518,5,8.63,16,7.866,18,1.569,45,3.582,58,2.24,89,7.597,115,3.99,187,7.749,209,6.264,324,7.128,363,6.841,364,4.112,373,7.671,449,4.652,678,7.671,687,3.334,723,10.706,776,5.868,864,8.084,1054,7.454,1082,7.01,1225,9.839,1236,13.17,1368,10.459,1407,10.706,1597,7.385,1603,9.663,2007,12.055,3536,11.643,3591,12.55,3594,17.94,3595,14,3596,14,3597,14,3598,14]],["keywords/700",[]],["title/701",[3,98.292,6,469.66,7,408.376]],["content/701",[]],["keywords/701",[]],["title/702",[3601,1398.897]],["content/702",[3,1.797,5,5.967,6,10.321,7,8.408,8,3.843,17,6.738,18,1.857,65,10.288,95,3.612,100,9.485,149,3.95,175,8.028,182,5.298,204,4.558,239,5.877,370,6.73,377,11.668,378,8.415,404,10.315,416,7.466,580,5.167,596,6.936,620,8.885,626,8.028,640,11.119,678,6.797,715,5.707,864,7.162,873,10.315,874,11.668,896,5.79,902,7.505,992,9.267,1019,5.073,1411,7.008,1412,10.68,1428,8.279,1574,8.717,1671,7.084,1954,9.267,1973,8.717,2811,10.68,3602,12.404,3603,12.404,3604,12.404,3605,12.404,3606,11.119,3607,12.404,3608,11.119]],["keywords/702",[]],["title/703",[2147,1045.084]],["content/703",[3,1.873,5,8.312,17,7.024,18,1.936,97,12.631,101,8.873,170,14.368,175,11.183,1065,7.066,1428,11.531,3609,17.278,3610,17.278]],["keywords/703",[]],["title/704",[2,986.166,1105,759.301]],["content/704",[3,1.871,7,4.037,17,3.643,18,1.934,45,4.004,56,3.824,57,4.414,58,1.119,79,3.756,92,4.153,95,2.61,106,3.418,163,6.551,179,5.427,197,3.081,204,3.293,218,3.036,237,3.94,238,3.294,260,2.532,304,5.148,305,4.796,322,6.551,324,4.563,328,5.638,338,4.637,339,4.775,341,2.949,345,3.036,348,5.981,350,2.777,382,3.208,409,8.108,459,6.157,472,12.894,476,4.153,508,2.715,660,3.225,661,3.756,667,6.695,687,3.727,693,5.981,739,5.573,760,6.074,870,3.293,896,4.183,901,3.878,970,7.452,1027,4.414,1065,3.665,1210,6.549,1276,7.532,1304,3.878,1310,7.374,1370,6.185,1411,5.063,1415,3.538,1417,6.42,1525,5.233,1786,6.298,2046,7.716,2613,7.716,2715,7.226,3074,6.185,3611,8.033,3612,18.395,3613,4.91,3614,15.65,3615,8.962,3616,8.962,3617,8.033,3618,8.962,3619,7.452]],["keywords/704",[]],["title/705",[409,399.375,654,259.871,760,299.166,1444,563.534]],["content/705",[]],["keywords/705",[]],["title/706",[510,362.059,796,492.192]],["content/706",[3,1.727,7,2.931,18,0.729,58,2.218,106,3.755,115,1.854,119,5.496,152,2.511,174,2.71,183,5.411,185,4.151,204,2.391,208,3.432,237,4.267,238,3.978,243,4.039,253,15.327,260,4.127,266,3.601,305,3.754,338,3.059,339,1.8,341,2.141,342,5.96,345,2.204,350,4.526,409,3.371,426,3.342,458,5.288,476,3.015,480,3.231,488,3.799,510,6.401,511,6.626,512,1.727,520,5.126,699,7.102,746,4.757,838,3.037,896,3.037,901,4.467,912,7.125,961,4.343,1019,2.661,1060,3.844,1165,3.601,1227,2.677,1415,2.569,1448,4.343,1468,6.408,1503,4.275,1513,4.039,1715,3.638,1764,4.661,1811,4.212,1887,4.151,1991,6.495,2070,4.861,2092,8.889,2256,4.861,2439,4.861,2440,7.395,2951,4.757,2970,7.712,3613,3.565,3617,5.833,3620,6.507,3621,6.507,3622,6.507,3623,8.585,3624,5.833,3625,6.507,3626,10.323,3627,12.832,3628,6.507,3629,6.507,3630,10.323,3631,12.832,3632,6.507,3633,10.323,3634,12.832,3635,6.507,3636,6.507,3637,6.507,3638,6.507,3639,6.507,3640,6.507,3641,6.507,3642,6.507,3643,6.507,3644,6.507,3645,6.507,3646,6.507,3647,6.507,3648,6.507,3649,6.507,3650,6.507,3651,6.507,3652,6.507,3653,6.507,3654,6.507,3655,6.507,3656,6.507,3657,6.507,3658,6.507,3659,6.507,3660,6.507,3661,6.507,3662,6.507,3663,6.507,3664,6.507,3665,5.833]],["keywords/706",[]],["title/707",[900,862.854,3666,986.166]],["content/707",[3,1.276,7,5.301,58,2.269,106,3.415,131,6.872,188,5.705,208,6.208,237,4.575,260,4.52,331,11.594,338,4.74,339,3.256,341,3.873,409,6.097,458,4.761,459,5.494,460,4.086,510,5.264,511,7.256,660,4.235,688,7.617,739,4.191,857,7.732,900,14.253,1272,7.121,1312,6.872,1387,10.378,1439,6.513,2182,10.133,2205,8.999,2210,8.271,2442,9.49,3613,6.448,3666,18.279,3667,11.768,3668,10.549,3669,11.768,3670,11.768,3671,11.768,3672,11.768,3673,15.112,3674,11.768,3675,8.792]],["keywords/707",[]],["title/708",[409,724.753]],["content/708",[3,1.463,7,4.163,18,1.036,58,2.326,79,2.218,106,3.697,119,7.182,141,6.905,169,6.939,183,7.686,185,5.896,237,4.01,238,3.369,305,4.905,318,4.552,338,3.997,339,2.557,341,3.042,342,7.789,345,3.131,409,11.533,426,6.928,434,6.163,476,4.283,493,5.336,510,3.042,552,4.788,620,6.621,687,3.794,717,4.875,760,6.183,882,4.875,896,4.314,926,5.896,1019,3.78,1165,5.115,1227,3.803,1355,4.746,1358,6.756,1415,3.649,1417,6.621,1447,5.663,1468,10.873,1525,5.397,1569,5.388,1578,13.717,1715,5.168,1764,12.547,1794,4.967,2440,6.621,2845,7.453,2951,6.756,3613,5.064,3665,8.285,3668,8.285,3676,7.686,3677,9.242,3678,9.242,3679,9.242,3680,9.242,3681,9.242,3682,7.686]],["keywords/708",[]],["title/709",[456,469.918,1513,682.927]],["content/709",[0,3.502,3,0.62,7,2.575,12,2.457,27,3.337,58,1.862,72,2.243,80,2.489,106,3.863,107,4.696,118,4.999,180,3.264,186,5.376,208,3.015,237,5.066,238,4.773,260,3.323,273,5.024,305,3.382,324,2.91,338,4.738,339,3.254,341,3.871,345,5.952,350,3.644,400,3.163,412,3.458,421,5.376,456,3.973,458,5.017,473,3.945,476,2.649,479,6.799,480,4.619,499,4.999,510,1.881,511,7.253,518,3.646,520,5.84,667,6.949,695,2.611,767,4.37,796,4.161,799,3.877,803,5.56,833,5.376,838,2.668,851,5.376,936,3.877,1027,2.815,1151,6.419,1303,5.376,1310,3.196,1340,7.295,1346,3.458,1415,3.672,1416,2.793,1419,4.094,1447,3.502,1497,2.91,1513,10.906,1536,4.178,1703,4.474,1802,4.27,1857,5.852,1887,3.646,2053,4.921,2054,8.772,2070,4.27,2075,4.27,2076,3.646,2257,4.482,3074,3.945,3468,5.123,3613,5.096,3624,5.123,3683,9.301,3684,9.301,3685,5.715,3686,14.333,3687,5.715,3688,5.715,3689,5.715,3690,9.301,3691,5.715,3692,8.337,3693,9.301,3694,5.715,3695,5.715,3696,5.715,3697,9.301,3698,5.715,3699,8.337,3700,5.123,3701,5.715,3702,5.715,3703,5.715,3704,5.715,3705,8.337,3706,5.715,3707,9.301,3708,5.715,3709,9.301,3710,5.715,3711,5.715,3712,5.715,3713,5.715,3714,5.123,3715,5.715,3716,5.715,3717,5.123]],["keywords/709",[]],["title/710",[510,362.059,1439,608.874]],["content/710",[3,1.061,18,1.096,58,2.431,106,3.893,173,5.996,237,4.994,238,4.492,240,5.588,260,3.468,271,3.778,304,4.79,338,4.166,339,4.262,341,3.22,345,5.575,348,4.061,350,3.032,382,3.503,409,3.153,412,7.426,479,4.449,480,3.022,503,8.588,510,3.22,660,4.416,667,7.31,687,2.33,739,4.371,752,5.724,760,2.362,838,5.729,870,3.596,901,6.666,1025,11.509,1164,7.01,1304,5.31,1371,5.24,1404,4.546,1415,2.402,1416,7.528,1417,4.359,1439,5.416,1440,4.449,1513,6.074,1514,3.368,1575,4.2,1590,8.426,1703,2.927,1846,3.682,2749,9.1,3074,6.754,3613,5.362,3676,12.812,3717,8.772,3718,6.085,3719,6.085,3720,6.085,3721,6.085,3722,6.085,3723,6.085,3724,6.085,3725,6.085,3726,6.085,3727,6.085,3728,6.085,3729,6.085,3730,16.456,3731,6.085,3732,9.785,3733,11.002,3734,6.085,3735,6.085,3736,6.085,3737,9.785,3738,12.273,3739,6.085,3740,9.785,3741,6.085,3742,9.785,3743,6.085]],["keywords/710",[]],["title/711",[796,492.192,1759,701.858]],["content/711",[3,1.617,7,6.716,305,6.788,330,9.38,434,6.811,456,6.369,552,7.724,586,14.025,654,6.871,716,11.694,739,5.31,796,9.842,1082,7.465,1276,8.515,1329,11.694,1415,5.886,1416,7.285,1759,13.004,1767,12.838,3623,12.399,3744,13.365,3745,12.399]],["keywords/711",[]],["title/712",[687,333.132]],["content/712",[3,1.321,11,7.228,18,1.835,58,1.521,95,3.548,106,3.696,119,6.487,237,3.067,238,4.09,341,5.39,342,7.035,345,5.548,396,5.489,491,10.343,493,7.035,530,7.773,687,4.71,739,4.339,760,4.729,880,6.002,958,4.189,967,8.333,1123,7.52,1127,10.166,1161,10.448,1180,7.373,1204,5.272,1468,7.564,1599,14.101,2133,10.136,2448,10.6,2845,9.825,3746,12.184,3747,12.184,3748,12.184]],["keywords/712",[]],["title/713",[694,914.868,1059,887.122]],["content/713",[3,1.182,5,5.243,12,6.523,18,1.221,56,3.16,58,1.361,106,3.703,115,3.106,193,6.515,237,4.394,238,3.789,241,4.278,271,6.766,323,4.278,338,4.496,339,3.015,341,3.587,345,3.692,350,4.701,442,7.808,597,7.968,687,4.726,694,12.619,739,3.882,760,6.775,838,9.263,870,4.005,901,4.716,975,7.394,1059,12.236,1180,10.563,1299,5.55,1311,10.664,1385,6.953,1445,7.161,1467,6.766,1928,9.385,1986,7.055,2192,6.679,2649,7.968,3613,5.972,3745,9.064,3749,15.174,3750,9.064,3751,10.899,3752,13.602,3753,10.899,3754,10.899,3755,15.174]],["keywords/713",[]],["title/714",[1180,846.462]],["content/714",[3,1.025,6,4.898,8,2.929,45,3.508,58,1.712,95,2.753,106,3.742,115,3.908,126,6.525,152,5.292,169,4.117,182,5.858,185,6.031,198,5.651,209,4.229,237,3.452,238,4.03,239,4.479,338,4.064,339,2.615,341,3.111,345,5.467,350,4.249,460,3.283,649,3.69,652,4.35,655,5.584,664,7.861,687,4.816,739,3.367,838,6.402,948,7.861,1161,6.031,1165,5.232,1180,5.72,1304,4.09,1312,5.52,1359,8.749,1379,8.14,1385,6.031,1468,5.868,1703,4.548,1790,7.229,1986,6.119,1991,5.948,2252,8.14,2442,7.623,2539,8.14,3507,15.869,3608,8.474,3613,5.18,3675,7.062,3745,7.861,3750,7.861,3756,13.714,3757,9.453,3758,9.453,3759,9.453,3760,9.453,3761,9.453,3762,9.453,3763,9.453,3764,9.453,3765,9.453,3766,9.453,3767,9.453,3768,9.453,3769,9.453,3770,9.453,3771,9.453,3772,9.453,3773,8.474,3774,9.453,3775,9.453]],["keywords/714",[]],["title/715",[2978,1253.981]],["content/715",[4,10.478,18,2.092,115,5.321,174,6.21,237,4.7,338,4.418,341,6.144,409,7.724,434,6.811,687,4.854,739,5.31,760,5.786,880,9.196,1467,9.255,1470,9.38,1601,15.987,3613,8.17,3682,15.526,3776,14.909,3777,14.909,3778,14.909]],["keywords/715",[]],["title/716",[1054,744.754]],["content/716",[3,1.227,7,5.098,58,1.944,106,3.87,237,5.233,238,5.023,338,4.615,339,3.131,341,3.725,345,3.834,373,6.201,458,4.635,470,4.367,476,5.245,687,4.241,739,5.547,1054,9.48,1123,6.332,1304,4.897,1352,9.936,1396,8.876,1415,4.468,1491,7.025,1623,8.273,1715,6.328,2037,8.654,2191,7.436,2192,9.543,2514,11.157,2970,8.455,3613,6.201,3673,9.411,3779,11.317,3780,11.317,3781,11.317,3782,11.317,3783,11.317,3784,11.317,3785,11.317,3786,9.411]],["keywords/716",[]],["title/717",[728,1204.507]],["content/717",[3,1.665,7,6.916,18,1.72,106,2.571,115,6.152,131,8.965,241,6.026,271,9.53,434,7.014,458,4.569,627,10.087,687,5.141,699,8.497,728,13.219,876,9.407,1857,9.659,2295,10.247,3744,13.762,3787,15.352,3788,15.352,3789,15.352]],["keywords/717",[]],["title/718",[958,378.226,1283,746.37]],["content/718",[3,1.797,7,4.463,8,3.069,12,4.259,58,2.259,106,3.743,131,5.785,157,3.492,187,5.483,228,4.432,237,4.171,238,2.474,304,3.867,325,4.205,327,4.591,338,4.203,339,5.511,341,3.26,382,3.546,458,4.222,472,12.379,493,9.567,510,4.668,687,2.359,739,3.528,884,4.729,890,5.483,958,7.213,963,6.15,1157,5.72,1204,6.138,1283,9.623,1304,4.287,1310,5.539,1366,6.412,1411,5.597,1439,5.483,1467,6.15,1569,3.957,1573,8.53,1810,10.37,2345,9.362,2416,8.53,2957,9.319,3074,6.837,3611,12.715,3613,5.428,3623,8.238,3790,9.907,3791,9.907,3792,14.185,3793,9.907,3794,9.907,3795,9.907,3796,9.907,3797,9.907]],["keywords/718",[]],["title/719",[460,382.009,1597,580.309]],["content/719",[3,1.111,7,4.618,8,3.176,42,9.189,58,2.108,60,4.024,72,4.024,98,5.09,106,3.816,107,5.175,145,6.735,152,3.956,232,6.54,237,4.625,238,3.63,293,5.985,325,4.351,327,4.75,338,4.307,339,2.836,341,3.374,345,3.473,460,7.35,472,7.658,503,4.894,510,4.783,511,4.65,535,9.144,548,6.635,649,5.672,687,4.375,715,6.687,739,3.651,1304,4.435,1439,5.673,1491,9.022,1597,5.407,1600,8.487,1606,6.735,1623,7.494,2979,8.3,3074,7.075,3613,5.617,3619,8.524,3798,10.251,3799,10.251,3800,10.251,3801,10.251,3802,10.251,3803,10.251,3804,9.189,3805,14.534,3806,10.251,3807,10.251]],["keywords/719",[]],["title/720",[932,780.553,1500,649.387,3808,906.523]],["content/720",[3,1.302,5,4.588,6,4.941,7,6.218,18,2.114,45,3.073,58,1.5,60,2.314,72,4.715,78,4.404,87,3.366,100,4.508,106,3.817,115,1.68,126,4.068,131,3.442,146,7.095,148,4.753,155,4.623,175,3.815,180,3.366,218,1.997,234,8.389,237,4.95,238,4.05,266,3.262,288,7.717,304,6.33,324,3.001,338,5.827,339,4.918,341,5.338,350,5.025,382,3.414,405,4.753,509,5.175,580,2.455,613,5.545,715,2.712,739,2.099,859,4.404,882,3.109,890,6.648,896,4.452,902,3.567,932,15.812,941,7.931,942,3.567,944,6.832,945,5.545,949,3.659,1019,2.411,1027,2.903,1065,2.411,1103,3.33,1227,2.425,1376,5.075,1468,5.92,1470,3.709,1500,9.887,1507,5.075,1508,3.873,1521,4.309,1528,6.365,1703,2.836,1709,4.623,1802,4.404,1954,4.404,2093,5.075,2430,5.075,2573,7.69,2649,4.309,2865,8.212,3074,4.068,3613,3.23,3675,4.404,3809,9.537,3810,5.894,3811,9.537,3812,16.219,3813,5.894,3814,12.011,3815,5.894,3816,5.894,3817,12.011,3818,9.537,3819,5.894,3820,5.894,3821,9.537,3822,5.894,3823,5.894,3824,5.894,3825,5.894,3826,5.894,3827,5.894]],["keywords/720",[]],["title/721",[83,862.854,907,773.156]],["content/721",[3,0.615,7,4.162,18,1.511,45,1.45,58,1.854,79,2.807,83,11.649,106,3.909,107,5.904,115,2.633,152,2.187,157,1.998,213,4.234,237,2.944,238,3.709,260,1.602,273,5.761,305,2.061,324,2.886,338,3.996,339,2.556,341,3.849,345,3.962,350,3.623,409,4.786,412,5.59,436,2.347,451,3.845,460,1.968,503,2.706,508,2.799,510,4.438,511,6.738,535,3.566,554,7.955,626,3.669,627,3.724,652,2.608,660,2.04,687,4,692,4.88,715,2.608,739,3.29,746,4.144,758,4.334,760,2.2,882,6.169,890,3.137,896,2.646,1009,5.332,1019,2.318,1068,4.444,1310,5.166,1366,3.669,1415,2.238,1447,3.473,1448,3.783,1513,5.735,1514,7.464,1528,3.783,1569,2.264,1648,4.234,1715,3.169,1773,3.845,1841,3.388,2054,3.669,2075,6.902,2076,3.616,2192,3.473,2796,4.88,2802,11.194,2979,3.237,3122,5.081,3443,4.446,3613,3.106,3619,7.683,3673,7.683,3682,4.714,3692,8.282,3699,10.483,3705,8.282,3714,5.081,3733,5.081,3750,13.968,3752,13.314,3786,4.714,3828,9.239,3829,5.668,3830,14.852,3831,5.668,3832,11.694,3833,5.668,3834,5.668,3835,5.668,3836,11.694,3837,5.668,3838,5.668,3839,5.668,3840,5.668,3841,5.668,3842,5.668,3843,11.694,3844,5.668,3845,5.668,3846,5.668,3847,5.668,3848,5.668,3849,5.668,3850,5.668,3851,5.668,3852,5.668,3853,5.668,3854,5.668,3855,5.668]],["keywords/721",[]],["title/722",[687,215.878,2192,555.478,3856,812.614]],["content/722",[3,1.508,7,6.265,18,2.211,115,5.624,126,9.598,373,7.62,508,4.213,612,8.872,687,5.339,739,4.953,796,7.992,1304,6.017,1349,11.974,1352,8.872,1703,6.69,2191,9.137,2192,13.507,3675,10.389,3786,16.411,3856,17.69,3857,13.906]],["keywords/722",[]],["title/723",[3858,1398.897]],["content/723",[]],["keywords/723",[]],["title/724",[1553,766.522]],["content/724",[3,1.301,7,3.559,18,0.885,58,1.812,60,3.101,106,3.791,129,7.431,146,4.666,177,11.851,179,3.25,204,2.903,237,4.389,238,3.625,273,3.374,304,4.684,319,3.396,324,4.022,338,4.804,339,3.32,341,3.95,345,2.676,350,3.719,454,5.902,458,3.572,476,3.661,480,3.923,508,2.393,511,5.444,520,3.923,661,3.311,687,3.456,695,3.609,699,6.642,750,6.569,796,5.369,896,3.688,940,6.569,1366,7.768,1415,3.119,1431,6.802,1448,5.272,1513,4.904,1553,9.553,1569,4.793,1715,4.417,2210,8.435,2664,6.802,2780,10.334,3613,4.329,3676,6.569,3686,7.081,3700,7.081,3859,7.9,3860,12.002,3861,7.9,3862,7.9,3863,7.9,3864,7.9,3865,7.9,3866,12.002,3867,7.9,3868,7.9,3869,7.9,3870,7.9,3871,7.9,3872,7.9,3873,7.9,3874,7.9,3875,7.9,3876,7.9,3877,7.9,3878,7.9,3879,7.9,3880,7.9,3881,7.9,3882,7.9,3883,7.9,3884,7.9,3885,7.9,3886,7.9,3887,7.9,3888,7.9,3889,7.9,3890,7.9,3891,7.9,3892,7.9,3893,7.9,3894,7.9,3895,7.9,3896,7.9,3897,7.9,3898,7.9,3899,7.9,3900,7.9,3901,7.9,3902,7.9,3903,7.9,3904,7.9,3905,7.9]],["keywords/724",[]],["title/725",[1368,821.883,3906,986.166]],["content/725",[3,0.88,6,6.347,7,5.519,18,0.909,45,3.775,58,1.842,95,3.567,106,3.848,115,4.205,126,5.602,157,2.861,175,5.254,188,8.993,237,4.441,238,3.685,338,4.87,339,3.389,341,4.032,345,2.75,350,5.092,356,9.608,357,5.814,382,2.906,436,5.072,458,3.646,460,5.124,476,3.762,503,3.875,510,4.856,637,5.814,649,5.759,687,1.933,715,5.637,818,9.16,882,4.282,896,3.789,961,5.417,968,11.284,1298,6.207,1351,8.956,1380,7.816,1415,3.204,1567,5.039,1597,8.67,1600,4.74,1929,6.989,2209,7.635,2280,4.974,2970,6.064,3613,4.448,3675,6.064,3773,7.276,3804,7.276,3906,7.276,3907,12.251,3908,8.117,3909,8.117,3910,8.117,3911,8.117,3912,8.117,3913,8.117,3914,12.251,3915,8.117,3916,12.251,3917,8.117,3918,8.117,3919,8.117,3920,14.756,3921,8.117,3922,8.117,3923,8.117,3924,8.117]],["keywords/725",[]],["title/726",[853,965.506]],["content/726",[3,2.22,6,6.167,7,5.362,8,3.688,12,5.117,17,4.839,18,1.806,20,5.438,45,3.045,56,3.451,78,8.893,82,5.817,90,8.076,95,3.466,101,6.113,104,7.489,110,4.839,157,4.196,169,5.185,221,7.821,223,6.523,228,5.326,239,5.64,259,6.951,382,5.771,391,8.893,396,5.362,416,8.235,447,10.671,460,4.133,508,3.606,597,8.702,630,10.25,632,9.336,635,9.899,661,4.989,678,6.523,857,7.821,864,9.308,896,5.557,899,11.198,905,7.203,1019,4.868,1219,9.336,1320,11.198,1409,9.207,1411,6.726,1426,10.25,1500,8.527,1574,8.366,1597,6.279,1635,7.489,1773,8.076,3606,10.671,3925,11.904,3926,11.904]],["keywords/726",[]]],"invertedIndex":[["",{"_index":106,"title":{"40":{"position":[[5,1]]},"49":{"position":[[5,1]]}},"content":{"2":{"position":[[300,1]]},"6":{"position":[[257,2]]},"8":{"position":[[169,1],[254,1],[256,2],[306,1],[321,2],[372,1],[387,2],[455,2],[460,2],[465,2],[470,1],[508,1],[510,2],[587,1],[671,1]]},"9":{"position":[[115,1],[117,2],[149,1],[166,1],[172,2],[250,1],[371,1],[470,2],[638,2],[687,1],[755,2],[809,1],[813,1],[829,1],[921,2],[980,3],[1015,2],[1153,2],[1156,2],[1216,1],[1330,2],[1384,1],[1489,2],[1550,1],[1653,1]]},"10":{"position":[[52,1],[384,2],[447,1],[518,1],[590,1],[639,2],[735,1],[769,1],[801,1],[803,2],[896,1],[909,1],[970,1],[972,2],[1028,1],[1099,1],[1101,1],[1103,2],[1258,1],[1271,1],[1343,1],[1451,1],[1453,1]]},"11":{"position":[[173,2]]},"17":{"position":[[446,1],[595,1],[626,1],[685,1],[733,1],[774,1],[799,1],[828,1],[922,1],[963,1],[993,1],[1051,1],[1070,1],[1139,1],[1152,1],[1194,1],[1259,1],[1387,1],[1389,1],[1471,1],[1528,1],[1530,1],[1549,1],[1566,1],[1627,1],[1629,1],[1972,1],[2191,1],[2220,1],[2327,1],[2503,1],[2547,1],[2584,1],[2642,1],[2685,1],[2744,1],[2755,1],[2798,1],[2856,1],[2924,1],[2976,1],[3068,1],[3078,1],[3157,1],[3170,1],[3213,1],[3271,1],[3324,1],[3403,1],[3455,1],[3479,1],[3533,1],[3625,1],[3691,1],[3754,1],[3766,1],[3840,1],[3915,1],[3968,1],[3970,1],[3989,1],[4006,1],[4068,1],[4070,1]]},"22":{"position":[[1109,1],[1140,1],[1171,1],[1227,1],[1252,1],[1281,1],[1312,1],[1347,1],[1377,1],[1379,1]]},"30":{"position":[[187,1],[254,1],[265,1],[270,1],[327,1],[344,1],[356,1],[363,1],[389,1],[409,1],[411,1],[413,1],[478,1],[485,1],[501,1],[514,1],[528,1],[553,1],[577,1],[659,1]]},"31":{"position":[[498,2],[590,1],[656,2],[659,2],[751,1],[792,1],[794,2],[901,1],[903,2],[943,1],[978,1],[995,1],[1316,2],[1319,2],[1375,1],[1394,2],[1548,1],[1664,1],[1666,2],[1669,2],[1842,1],[1939,2],[1942,2],[1945,2],[1982,1],[2039,1],[2102,1],[2167,1],[2203,1],[2280,2],[2327,2],[2380,1],[2635,2],[2638,2],[2696,2],[2744,2],[2794,1],[3180,1],[3191,1],[3290,1],[3415,1],[3445,1],[3456,1],[3619,1],[3744,1]]},"32":{"position":[[376,1],[396,1],[422,1],[481,1],[550,1],[614,1],[777,1],[832,1],[836,1],[920,1],[1019,1],[1085,1],[1104,1],[1147,1],[1149,2],[1185,1],[1241,1],[1296,2],[1393,2],[1428,1],[1453,2],[1520,2],[1573,1],[1670,1],[1673,1],[1751,1],[1755,1],[1821,1]]},"38":{"position":[[137,3]]},"39":{"position":[[579,2],[682,1],[835,1],[2004,1],[2075,1],[2388,1],[2399,1],[2416,1],[2440,1],[2455,1],[2468,1],[2487,1],[2509,1],[2528,1],[2650,1],[2664,1],[2722,1],[2736,1],[2795,1],[2802,1],[2810,1],[2821,1],[2864,2],[2871,1],[2898,1],[2925,1],[2996,1],[3001,1],[3009,1],[3018,1],[3082,1],[3139,3],[3143,1],[3145,1]]},"42":{"position":[[462,1],[464,1],[474,1],[504,1],[528,1],[571,1],[641,1],[689,1],[791,1],[874,2],[954,1],[1051,1],[1071,1],[1104,1],[1114,1],[1190,1],[1219,1],[1221,1],[2108,1],[2110,2],[2174,1],[2193,1],[2395,1],[2434,1],[2449,1],[2549,2],[2552,1],[2571,1],[2593,1],[2624,1],[2686,3],[2694,1],[2696,3],[2707,1],[2709,3],[2732,1],[2734,3],[2746,3],[2759,3],[2774,3]]},"43":{"position":[[134,2],[137,3],[141,2],[218,1],[374,1],[376,1],[442,1],[468,1],[566,1],[600,1],[602,1],[755,1],[801,1],[887,1],[1023,1],[1058,1],[1090,1],[1194,1],[1262,1],[1325,1],[1388,1],[1439,1],[1494,1],[1541,1]]},"51":{"position":[[508,1],[541,1],[572,1],[627,1],[689,1],[698,3],[702,1],[736,1],[752,1],[797,1],[809,1],[854,1],[921,1],[987,1],[1034,1],[1074,1],[1104,1],[1106,1],[1119,1],[1194,1],[1258,1],[1299,1],[1317,1],[1319,1],[1344,1],[1380,1],[1394,1],[1460,1],[1485,1],[1503,1],[1590,1],[1592,1]]},"52":{"position":[[588,2],[656,2],[700,2],[708,1],[724,1],[756,2],[862,2],[870,1],[886,1],[897,1],[913,1],[979,1],[1045,1],[1170,1],[1184,1],[1264,1],[1266,1],[1286,1],[1298,5],[1304,1],[1352,1],[1392,1],[1462,1],[1476,1],[1545,1],[1565,1],[1653,1],[2230,1],[2238,1],[2265,1],[2342,3],[3005,3],[3211,1],[3219,1],[3257,1],[3282,1],[3303,1],[3374,3],[4598,3],[4848,1],[4856,1],[4903,1],[5012,3],[6362,3],[6543,1],[6551,1]]},"53":{"position":[[243,3],[993,3]]},"71":{"position":[[77,1],[79,2],[117,1],[157,1],[216,1],[247,2],[314,1],[356,1],[358,2],[488,1],[544,1],[570,3],[574,1]]},"73":{"position":[[47,1],[73,1],[116,1],[191,1],[205,1],[311,1],[313,1],[315,1],[342,1],[368,1],[376,1],[428,1],[434,1],[436,1],[460,1],[569,1],[584,1],[621,1],[693,1],[787,1],[789,1]]},"74":{"position":[[192,1],[194,2],[211,1],[270,1],[272,2],[289,1]]},"78":{"position":[[220,1],[226,1],[237,1],[259,1]]},"79":{"position":[[701,1],[800,1],[832,1],[834,3],[904,1],[957,1],[1031,1],[1046,1],[1063,1],[1153,1],[1155,1]]},"80":{"position":[[256,1],[336,1],[359,1],[403,1],[438,1],[490,1],[518,1],[619,1],[631,1],[712,1],[801,1],[817,1],[891,1],[893,1]]},"83":{"position":[[562,1],[669,1]]},"84":{"position":[[231,1],[297,1],[577,1],[647,1]]},"85":{"position":[[476,1],[493,1],[495,2],[522,2],[554,2],[574,2],[594,1],[596,2],[623,2],[655,2],[675,1],[677,1]]},"88":{"position":[[246,1],[248,1],[255,1],[287,1],[321,1]]},"91":{"position":[[969,1],[971,8]]},"99":{"position":[[234,1],[266,1],[293,1],[342,1],[375,1],[412,1],[501,1],[569,1],[632,1]]},"100":{"position":[[328,1],[360,1],[387,1],[436,1],[468,1],[510,1],[585,1],[654,1],[717,1],[765,1],[813,1]]},"101":{"position":[[182,1],[214,1],[241,1],[290,1],[322,1],[365,1],[443,1],[512,1],[575,1],[638,1]]},"115":{"position":[[189,2],[230,1],[297,1],[331,1],[426,1],[441,1],[550,1],[562,1],[578,1],[1083,1],[1101,1],[1206,1],[1208,1],[1269,1],[1357,1],[1359,1],[1991,2],[2034,1],[2138,1],[2174,1],[2289,1],[2304,1],[2448,1],[2460,1],[2476,1],[2601,1],[2619,1],[2664,1],[2683,1],[2806,1],[2808,1],[2869,1],[2957,1],[2959,1]]},"117":{"position":[[379,1],[412,1],[440,1],[1009,1],[1087,1],[1188,1]]},"120":{"position":[[372,1]]},"126":{"position":[[428,1],[486,1],[513,1],[572,1],[665,1],[782,1],[825,1],[894,1],[949,1],[1336,1],[1338,2],[1394,2],[1422,1],[1456,2],[1513,2],[1542,1],[1558,2],[1613,2],[1643,2],[1700,1],[1799,1],[1840,2],[1892,1],[1941,1],[1987,1],[2020,1],[2042,2],[2109,2],[2143,2],[2198,2],[2254,2],[2338,1],[2354,1],[2417,2],[2434,1],[2474,2],[2610,2],[2650,2],[2665,1],[2750,2],[2765,1],[2804,2],[2870,2],[2899,2],[2916,1],[2953,2],[3067,2],[3139,2],[3397,1],[3527,1],[3563,1],[3623,1],[3652,1]]},"127":{"position":[[259,3],[263,2],[271,1],[350,2],[358,1],[402,2],[410,1],[454,2],[462,1]]},"131":{"position":[[59,1],[88,1],[116,1],[155,1],[204,1],[237,1],[278,1],[319,1],[340,1],[379,1],[418,1],[458,1],[466,1],[519,1]]},"132":{"position":[[147,1]]},"138":{"position":[[187,1],[332,1],[347,1],[377,1],[421,1],[490,1],[514,1],[560,2],[586,1],[786,2],[789,1],[791,1]]},"141":{"position":[[1255,1],[1304,1]]},"142":{"position":[[312,1],[326,1],[423,1],[520,1]]},"143":{"position":[[124,1],[278,1],[293,1],[338,1],[404,1],[428,1],[483,2],[505,1],[614,1],[616,1],[974,1],[1068,1],[1083,1],[1113,1],[1224,1],[1285,1],[1300,1],[1367,1],[1369,1]]},"146":{"position":[[11,3],[85,3],[146,1],[148,3],[196,3],[279,1]]},"147":{"position":[[11,3],[38,3],[42,3],[71,3],[163,1],[165,3],[187,3],[191,3],[272,1],[297,1],[299,3],[1014,3],[1018,3],[1114,1],[1139,1],[1141,3],[1224,1],[1255,1],[1257,3]]},"148":{"position":[[34,1],[130,1],[140,1],[160,2],[233,2],[321,1],[433,1],[435,3]]},"151":{"position":[[119,1],[218,1],[233,1],[274,1],[383,1],[385,1]]},"154":{"position":[[333,1],[381,1]]},"157":{"position":[[274,1],[298,1],[337,1],[460,1],[509,1],[511,2],[514,2],[663,2],[779,1]]},"160":{"position":[[172,1],[299,1],[314,1],[354,1],[713,1],[715,1]]},"162":{"position":[[370,1],[479,1],[762,1],[831,1],[947,1],[984,1],[1014,1],[1051,1],[1082,1],[1120,1],[1149,1],[1192,1],[1204,1],[1254,1],[1303,1],[1315,1],[1365,1],[1367,1],[1487,3],[1519,3],[2213,1],[2225,1],[2268,1]]},"163":{"position":[[401,1],[465,1],[836,1],[849,1],[927,1],[933,1],[991,1],[1039,1],[1628,1],[1683,1]]},"164":{"position":[[194,1],[245,1],[550,1],[593,1],[616,1],[654,1],[683,1],[726,1],[745,1],[794,1],[820,1],[870,1],[897,1],[899,1]]},"165":{"position":[[244,1],[310,1]]},"168":{"position":[[354,1],[505,1],[529,1],[609,1],[635,1],[678,2],[702,1],[774,1],[867,1],[893,1],[937,2],[962,1],[1035,1],[1100,1],[1102,1],[2057,1]]},"178":{"position":[[26,3],[97,3],[160,1],[162,3],[210,3],[293,1],[295,3],[322,3],[326,3],[355,3],[447,1],[449,3],[493,3],[497,3],[578,1],[603,1],[605,3],[701,1],[726,1],[728,3],[811,1],[842,1],[844,3],[882,3],[983,1],[1013,1],[1015,1],[1040,1],[1136,1],[1146,1],[1166,2],[1239,2],[1327,1],[1439,1],[1472,1],[1482,1],[1520,1],[1578,1],[1747,1],[1749,1]]},"179":{"position":[[65,1],[78,1]]},"183":{"position":[[15,3],[23,1],[25,3],[36,1],[38,1],[40,3],[62,1],[64,1],[66,3],[80,1],[82,1],[84,3],[98,1],[100,3],[111,3],[124,3],[139,3]]},"184":{"position":[[334,1],[394,1],[458,1],[518,1],[587,1],[661,1],[1019,1],[1033,1],[1073,1],[1083,1]]},"185":{"position":[[243,1],[290,1],[325,1],[399,1],[484,1],[521,1],[601,1],[653,1],[716,1],[733,1],[781,1],[794,1],[802,1],[809,1],[830,1],[832,1],[907,1],[1026,1],[1102,1],[1222,1],[1300,1],[1313,2],[1341,1],[1400,1],[1445,1],[1447,1],[1468,1],[1539,1],[1574,1],[1615,1],[1617,1],[1696,1],[1722,1],[1830,1],[1894,3],[1898,1],[1983,1],[2018,1],[2100,1],[2162,3],[2166,1],[2168,1],[2254,1],[2288,1],[2371,1],[2433,3],[2437,1],[2439,1],[2441,1]]},"195":{"position":[[81,1],[123,1],[165,1],[333,1]]},"196":{"position":[[11,3],[45,3],[78,1],[123,1],[166,1],[220,1],[290,1],[327,3],[331,1],[333,1],[371,1],[399,1],[404,1],[473,1],[537,1]]},"197":{"position":[[40,1],[42,3],[104,1],[123,2],[163,1],[200,1],[202,1],[268,1],[337,1],[430,1],[487,3],[491,1],[535,1],[571,1],[657,1],[659,1],[661,1],[699,1],[710,1],[741,1],[768,1],[773,1]]},"198":{"position":[[34,1],[148,1],[167,1],[201,1],[219,1],[247,2],[329,1],[365,1],[393,1],[504,1],[541,1],[543,2],[546,1],[588,1],[620,1],[645,1],[836,1],[873,1],[875,2],[878,1],[927,1],[955,1],[980,1],[1130,2],[1133,1],[1135,1]]},"203":{"position":[[108,1],[150,1],[352,1]]},"204":{"position":[[9,3],[30,3],[61,1],[156,1],[169,1],[312,1],[350,1],[379,1],[419,1],[450,1],[488,1],[521,1],[565,1],[602,1],[604,1],[617,1],[688,1],[790,1],[840,3],[844,1],[846,1],[907,1],[990,1],[1544,1],[1610,1]]},"205":{"position":[[228,3],[280,1],[282,3],[361,1],[374,1],[448,1],[551,1],[565,1],[684,1],[758,1],[770,1],[878,1],[921,3],[925,1],[990,1],[1035,1],[1120,1],[1178,1],[1180,1],[1193,1],[1195,3],[1295,1],[1315,1],[1389,1],[1437,1],[1560,1],[1620,3],[1624,1],[1723,1],[1739,1],[1799,1],[1849,1],[1869,1],[1985,1],[2048,3],[2052,1],[2054,1],[2115,1],[2175,1],[2213,1],[2235,1],[2262,1],[2267,1]]},"206":{"position":[[36,1],[141,1],[188,1],[226,1],[258,1],[309,1],[319,1],[339,1],[400,1],[512,1],[514,1],[516,1],[518,1],[548,1],[550,2],[618,1],[629,2],[804,2],[898,2],[994,1],[1068,1],[1070,3],[1074,1],[1104,1],[1106,2],[1152,1],[1163,2],[1214,1],[1250,1],[1283,1],[1344,2],[1463,2],[1466,2],[1562,2],[1656,1],[1706,1],[1708,3],[1712,1],[1742,1],[1744,2],[1790,1],[1801,2],[1871,1],[1904,1],[1933,1],[1948,2],[2040,1],[2087,1],[2110,1],[2153,1],[2237,1],[2273,1],[2359,2],[2437,2],[2594,1],[2635,1],[2637,3],[2641,2],[2790,2],[2930,2],[3054,1],[3113,1],[3115,3],[3177,1],[3243,1],[3245,3],[3249,2],[3313,1],[3348,1],[3350,2],[3396,1],[3407,2],[3480,1],[3555,1],[3596,2],[3739,2],[3742,1],[3744,1]]},"209":{"position":[[470,2],[592,1],[655,1],[722,1],[737,1],[739,2],[839,1],[921,1],[955,1],[1049,1],[1060,1],[1071,1],[1112,1],[1129,2],[1138,1],[1155,1],[1157,1],[1159,2],[1230,1],[1236,1],[1310,1],[1439,1],[1441,1],[1443,2],[1529,1],[1589,1],[1591,2],[1654,1],[1698,1]]},"210":{"position":[[376,1],[416,1],[444,1],[487,1],[519,1],[551,1],[646,1],[714,1],[777,1],[840,1],[890,1],[954,1],[1001,1],[1150,1],[1190,1],[1218,1],[1255,1],[1285,1],[1327,1],[1372,1],[1416,1],[1464,1]]},"211":{"position":[[374,1],[442,1],[518,1],[534,1]]},"212":{"position":[[166,2],[169,2],[234,1],[287,1],[352,1],[412,1],[491,1],[554,1],[611,1],[626,1],[685,1],[707,1],[808,1],[863,2],[921,1],[1076,1],[1182,2],[1185,1],[1227,2],[1304,1],[1313,1],[1315,2],[1417,1],[1424,1],[1433,1],[1435,1],[1472,1],[1474,2],[1543,1],[1572,1],[1601,2],[1666,1],[1709,2],[1788,1],[1831,2],[1892,2],[1975,1],[2030,1],[2040,2],[2115,1],[2117,2],[2182,1],[2229,1],[2254,1],[2262,3],[2266,1],[2268,2],[2357,2],[2421,2],[2490,1],[2518,1],[2520,1],[2549,1],[2551,2],[2594,1],[2634,1],[2674,1],[2703,2],[2806,1],[2855,1],[2857,2],[2907,1],[2983,1],[3019,1],[3041,1],[3088,1],[3117,2],[3220,1],[3232,1],[3246,1],[3468,1],[3470,2],[3532,2],[3564,2],[3615,2],[3665,2],[3713,2],[3855,1],[3869,1],[3986,1],[4036,1],[4082,1],[4099,1],[4127,1],[4248,1],[4438,1],[4499,1],[4510,1],[4592,1],[4600,1],[4614,2],[4623,1],[4637,2],[4640,2],[4643,1],[4691,1],[4766,1],[4838,1]]},"219":{"position":[[329,1],[346,1],[372,1],[381,1],[440,1],[463,1],[524,1],[547,1]]},"220":{"position":[[140,3],[166,1],[209,1],[238,1]]},"221":{"position":[[71,1],[112,1],[146,1],[185,1],[207,1],[253,1],[255,1],[290,1],[313,1],[357,1],[359,1],[361,1]]},"222":{"position":[[88,1],[118,1],[202,1],[233,3],[237,1],[269,1],[352,1],[383,3],[387,1],[389,1]]},"223":{"position":[[287,3],[312,3],[359,1],[421,1],[460,1],[494,1],[547,1],[577,1],[609,1],[639,1],[665,1],[697,1],[725,1],[765,1],[795,1],[797,1],[821,1],[913,1],[928,1],[965,1],[1144,2],[1184,1],[1186,1]]},"229":{"position":[[220,1],[226,1],[236,1],[248,1],[258,1],[280,1]]},"230":{"position":[[718,1],[817,1],[849,1],[851,3],[921,1],[974,1],[1048,1],[1063,1],[1080,1],[1170,1],[1172,1]]},"231":{"position":[[256,1],[336,1],[359,1],[403,1],[438,1],[490,1],[518,1],[619,1],[631,1],[712,1],[801,1],[817,1],[891,1],[893,1]]},"235":{"position":[[77,1],[79,2],[117,1],[157,1],[216,1],[247,2],[314,1],[356,1],[358,2],[488,1],[544,1],[570,3],[574,1]]},"237":{"position":[[47,1],[73,1],[116,1],[191,1],[205,1],[311,1],[313,1],[315,1],[342,1],[368,1],[376,1],[428,1],[434,1],[436,1],[460,1],[569,1],[584,1],[621,1],[693,1],[787,1],[789,1]]},"238":{"position":[[192,1],[194,2],[211,1],[270,1],[272,2],[289,1]]},"246":{"position":[[241,1],[308,1]]},"247":{"position":[[15,3],[60,3],[96,1],[191,1],[206,1],[315,1],[353,1],[373,1],[413,1],[435,1],[473,1],[497,1],[541,1],[569,1],[634,1],[667,1],[752,1],[791,1],[868,1],[910,1],[1013,1],[1067,1],[1141,1],[1180,1],[1224,1],[1251,1],[1317,1],[1361,1],[1432,1],[1525,1],[1527,1]]},"250":{"position":[[246,1],[248,1],[255,1],[287,1],[321,1]]},"252":{"position":[[562,1],[669,1]]},"253":{"position":[[231,1],[297,1],[577,1],[647,1]]},"254":{"position":[[476,1],[493,1],[495,2],[522,2],[554,2],[574,2],[594,1],[596,2],[623,2],[655,2],[675,1],[677,1]]},"258":{"position":[[179,2],[220,1],[287,1],[321,1],[416,1],[431,1],[540,1],[552,1],[568,1],[1037,1],[1055,1],[1152,1],[1154,1],[1215,1],[1303,1],[1305,1],[1937,2],[1980,1],[2084,1],[2120,1],[2235,1],[2250,1],[2394,1],[2406,1],[2422,1],[2539,1],[2557,1],[2598,1],[2617,1],[2732,1],[2734,1],[2795,1],[2883,1],[2885,1]]},"265":{"position":[[457,1],[490,1],[518,1],[557,1],[606,1],[639,1],[684,1],[725,1],[746,1],[789,1],[828,1],[868,1],[876,1],[929,1]]},"266":{"position":[[143,1]]},"267":{"position":[[877,2],[909,1],[951,1],[953,3],[1022,1],[1024,2],[1055,1],[1097,1],[1099,3],[1155,1],[1329,1],[1351,1],[1383,1],[1404,1],[1427,1],[1452,1],[1461,1],[1607,1],[1690,1],[1692,2],[1745,1],[1795,3],[2212,1],[2286,1],[2713,1],[2821,1],[2938,1],[3321,1],[3359,1],[3482,1],[3879,1],[3939,1],[3941,2]]},"268":{"position":[[832,2],[962,1],[994,1],[1037,2],[1162,1],[1196,1],[1212,1],[1330,2],[1343,1],[2388,1],[2411,1],[2454,1],[2529,1],[2674,2],[2677,1],[3023,1],[3053,1],[3098,3],[3160,1],[3219,1],[3221,3],[3283,1],[3349,1],[3351,3]]},"269":{"position":[[276,1],[318,1],[520,1],[549,1],[658,1],[660,1],[673,1],[799,1],[816,1],[934,1],[967,1],[1022,3],[1026,1],[1028,1],[1030,1],[1107,1],[1120,1],[1194,1],[1297,1],[1311,1],[1430,1],[1504,1],[1516,1],[1624,1],[1667,3],[1671,1],[1709,1],[1752,1],[1754,2],[1866,1],[1924,1],[1995,1],[2097,1],[2147,3],[2151,1],[2222,1],[2265,1],[2307,1],[2419,1],[2469,3],[2473,1],[2475,1],[2488,1],[2586,1],[2640,1],[2681,1],[2793,1],[2853,3],[2857,1],[2956,1],[2972,1],[3057,1],[3100,1],[3193,1],[3256,3],[3260,1],[3262,1],[3279,1],[3410,1],[3493,1],[3554,1],[3614,1],[3616,1],[3633,1],[3692,1],[3714,1],[3746,1],[3767,1],[3790,1],[3815,1],[3824,1],[3826,1],[3851,1],[3939,2],[4021,2],[4045,1],[4092,1],[4130,1],[4162,1],[4213,1],[4223,1],[4243,1],[4304,1],[4422,1],[4424,1],[4426,1],[4428,1],[4458,1],[4460,2],[4528,1],[4539,2],[4714,2],[4808,2],[4904,1],[4978,1],[4980,3],[4984,1],[5014,1],[5016,2],[5062,1],[5073,2],[5124,1],[5160,1],[5193,1],[5254,2],[5373,2],[5376,2],[5472,2],[5566,1],[5616,1],[5618,3],[5622,1],[5652,1],[5654,2],[5700,1],[5711,2],[5781,1],[5814,1],[5843,1],[5858,2],[5950,1],[5952,2],[5970,1]]},"277":{"position":[[428,1],[486,1],[513,1],[572,1],[665,1],[782,1],[825,1],[894,1],[949,1],[1086,1],[1142,1],[1504,1],[1506,2],[1562,2],[1590,1],[1624,2],[1681,2],[1710,1],[1726,2],[1781,2],[1811,2],[1868,1],[1967,1],[2008,2],[2060,1],[2109,1],[2155,1],[2188,1],[2210,2],[2277,2],[2311,2],[2366,2],[2422,2],[2506,1],[2522,1],[2585,2],[2602,1],[2642,2],[2778,2],[2818,2],[2833,1],[2918,2],[2933,1],[2972,2],[3038,2],[3067,2],[3084,1],[3121,2],[3235,2],[3307,2],[3565,1],[3695,1],[3731,1],[3791,1],[3820,1]]},"278":{"position":[[259,3],[263,2],[271,1],[350,2],[358,1],[402,2],[410,1],[454,2],[462,1]]},"283":{"position":[[967,1],[969,8]]},"291":{"position":[[234,1],[266,1],[293,1],[342,1],[375,1],[412,1],[501,1],[569,1],[632,1]]},"292":{"position":[[328,1],[360,1],[387,1],[436,1],[468,1],[510,1],[585,1],[654,1],[717,1],[765,1],[813,1]]},"293":{"position":[[182,1],[214,1],[241,1],[290,1],[322,1],[365,1],[443,1],[512,1],[575,1],[638,1]]},"298":{"position":[[379,1],[412,1],[440,1],[1009,1],[1087,1],[1188,1]]},"301":{"position":[[372,1]]},"311":{"position":[[59,1],[88,1],[116,1],[155,1],[204,1],[256,1],[289,1],[330,1],[371,1],[392,1],[431,1],[470,1],[510,1],[518,1],[571,1]]},"312":{"position":[[147,1]]},"318":{"position":[[187,1],[324,1],[339,1],[369,1],[413,1],[482,1],[506,1],[552,2],[578,1],[778,2],[781,1],[783,1]]},"321":{"position":[[517,2],[578,1],[604,2],[680,1],[701,2],[791,1],[793,1],[812,2],[815,2],[915,1],[926,2],[951,1],[1005,1],[1039,1],[1041,3],[1171,1],[1263,1],[1270,3],[1274,1],[1276,3],[1375,1],[1436,1],[1443,3],[1447,1],[1449,3],[1524,1],[1531,1],[1629,1],[1631,1],[1633,1],[1635,2],[1735,1],[1767,1],[1769,2],[1880,1],[1882,3],[1921,3],[1958,1],[1960,2],[2070,1],[2086,1],[2088,2],[2206,1],[2222,1]]},"322":{"position":[[79,1]]},"323":{"position":[[225,1],[375,3],[556,1],[558,1],[580,1],[673,1],[675,1],[779,1],[781,1],[783,1],[785,2],[788,1],[810,1],[900,1],[902,1],[1006,2],[1009,1],[1111,1],[1113,1],[1115,1],[1117,2],[1120,1],[1142,1],[1235,1],[1237,1],[1341,1],[1343,1],[1345,1],[1347,1],[1349,2],[1372,1],[1374,1],[1505,2],[1508,1],[1641,1],[1643,2],[1672,1],[1674,1],[1857,1],[1859,1],[1992,1],[1994,2],[2116,2],[2119,1],[2286,3],[2409,1],[2411,2],[2434,1],[2436,1],[2513,2],[2516,1],[2593,1],[2595,2],[2616,1],[2805,1],[2807,1],[3017,2],[3020,1],[3222,2],[3225,1],[3435,2],[3438,1],[3571,2],[3574,1],[3705,1],[3707,1],[3709,1],[3711,1]]},"326":{"position":[[1255,1],[1304,1]]},"327":{"position":[[312,1],[326,1],[423,1],[520,1]]},"328":{"position":[[124,1],[278,1],[293,1],[338,1],[409,1],[478,1],[533,1],[535,2],[589,1],[591,1],[949,1],[1043,1],[1058,1],[1088,1],[1199,1],[1260,1],[1275,1],[1342,1],[1344,1]]},"330":{"position":[[265,1],[289,1],[328,1],[446,1],[495,1],[497,2],[500,2],[644,2],[755,1]]},"334":{"position":[[11,3],[85,3],[146,1],[148,3],[196,3],[279,1]]},"335":{"position":[[11,3],[38,3],[42,3],[71,3],[163,1],[165,3],[187,3],[191,3],[272,1],[297,1],[299,3],[1022,3],[1026,3],[1122,1],[1147,1],[1149,3],[1232,1],[1263,1],[1265,3]]},"336":{"position":[[34,1],[130,1],[140,1],[160,2],[233,2],[321,1],[433,1],[435,3]]},"339":{"position":[[333,1],[381,1]]},"342":{"position":[[119,1],[218,1],[233,1],[274,1],[383,1],[385,1]]},"345":{"position":[[172,1],[299,1],[314,1],[354,1],[713,1],[715,1]]},"346":{"position":[[122,1],[166,1],[203,1],[281,1]]},"348":{"position":[[354,1],[505,1],[529,1],[609,1],[635,1],[678,2],[702,1],[774,1],[867,1],[893,1],[937,2],[962,1],[1035,1],[1100,1],[1102,1],[2057,1]]},"351":{"position":[[407,1],[516,1],[784,1],[853,1],[969,1],[1006,1],[1036,1],[1073,1],[1104,1],[1142,1],[1171,1],[1214,1],[1226,1],[1276,1],[1325,1],[1337,1],[1387,1],[1389,1],[1509,3],[1541,3],[2235,1],[2247,1],[2290,1]]},"352":{"position":[[423,1],[487,1],[858,1],[871,1],[949,1],[955,1],[1013,1],[1061,1],[1650,1],[1705,1]]},"353":{"position":[[229,1],[280,1],[585,1],[628,1],[651,1],[689,1],[718,1],[761,1],[780,1],[829,1],[855,1],[905,1],[932,1],[934,1]]},"354":{"position":[[282,1],[348,1],[605,1],[611,1],[620,1],[629,1],[634,1],[734,1]]},"369":{"position":[[26,3],[97,3],[160,1],[162,3],[210,3],[293,1],[295,3],[322,3],[326,3],[355,3],[447,1],[449,3],[493,3],[497,3],[578,1],[603,1],[605,3],[701,1],[726,1],[728,3],[811,1],[842,1],[844,3],[882,3],[983,1],[1013,1],[1015,1],[1040,1],[1136,1],[1146,1],[1166,2],[1239,2],[1327,1],[1439,1],[1472,1],[1482,1],[1520,1],[1578,1],[1747,1],[1749,1]]},"370":{"position":[[65,1],[78,1]]},"374":{"position":[[15,3],[23,1],[25,3],[36,1],[38,1],[40,3],[62,1],[64,1],[66,3],[80,1],[82,1],[84,3],[98,1],[100,3],[111,3],[124,3],[139,3]]},"375":{"position":[[301,1],[361,1],[401,1],[461,1],[506,1],[580,1],[916,1],[930,1],[970,1],[980,1]]},"376":{"position":[[227,1],[274,1],[309,1],[383,1],[468,1],[505,1],[585,1],[637,1],[700,1],[717,1],[765,1],[778,1],[786,1],[793,1],[814,1],[816,1],[891,1],[1010,1],[1086,1],[1206,1],[1284,1],[1297,2],[1325,1],[1384,1],[1429,1],[1431,1],[1452,1],[1523,1],[1558,1],[1599,1],[1601,1],[1680,1],[1706,1],[1814,1],[1878,3],[1882,1],[1967,1],[2002,1],[2084,1],[2146,3],[2150,1],[2152,1],[2238,1],[2272,1],[2355,1],[2417,3],[2421,1],[2423,1],[2425,1]]},"383":{"position":[[368,1],[434,1],[666,1],[668,3],[687,4],[699,1],[726,1],[728,2],[738,1],[775,1],[797,1],[829,1],[850,1],[873,1],[898,1],[907,1],[1129,1],[1212,1]]},"384":{"position":[[273,1],[304,1],[331,1],[533,1],[562,1],[671,1],[673,1],[686,1],[812,1],[829,1],[947,1],[980,1],[1035,3],[1039,1],[1041,1],[1043,1],[1120,1],[1133,1],[1207,1],[1310,1],[1324,1],[1443,1],[1517,1],[1529,1],[1637,1],[1680,3],[1684,1],[1722,1],[1772,1],[1774,2],[1886,1],[1944,1],[2015,1],[2117,1],[2167,3],[2171,1],[2242,1],[2285,1],[2334,1],[2446,1],[2496,3],[2500,1],[2502,1],[2515,1],[2613,1],[2667,1],[2715,1],[2827,1],[2887,3],[2891,1],[2990,1],[3006,1],[3091,1],[3141,1],[3234,1],[3297,3],[3301,1],[3303,1],[3320,1],[3420,1],[3503,1],[3540,1],[3600,1],[3602,1],[3619,1],[3656,1],[3678,1],[3710,1],[3731,1],[3754,1],[3779,1],[3788,1],[3790,1],[3815,1],[3817,2],[3849,1]]},"388":{"position":[[460,2],[553,1],[616,1],[654,1],[669,1],[671,2],[771,1],[853,1],[887,1],[981,1],[992,1],[1003,1],[1044,1],[1061,2],[1070,1],[1087,1],[1089,1],[1091,2],[1162,1],[1168,1],[1242,1],[1371,1],[1373,1],[1375,2],[1461,1],[1521,1],[1523,2],[1586,1],[1630,1]]},"389":{"position":[[376,1],[416,1],[444,1],[487,1],[519,1],[551,1],[646,1],[714,1],[777,1],[827,1],[891,1],[938,1],[1087,1],[1127,1],[1155,1],[1192,1],[1222,1],[1264,1],[1309,1],[1353,1],[1401,1]]},"390":{"position":[[361,1],[428,1],[492,1],[508,1]]},"391":{"position":[[166,2],[169,2],[234,1],[287,1],[352,1],[412,1],[491,1],[554,1],[611,1],[626,1],[685,1],[707,1],[808,1],[863,2],[921,1],[1076,1],[1182,2],[1185,1],[1227,2],[1304,1],[1313,1],[1315,2],[1417,1],[1424,1],[1433,1],[1435,1],[1472,1],[1474,2],[1543,1],[1572,1],[1601,2],[1666,1],[1709,2],[1788,1],[1831,2],[1892,2],[1975,1],[2030,1],[2040,2],[2115,1],[2117,2],[2182,1],[2229,1],[2254,1],[2262,3],[2266,1],[2268,2],[2357,2],[2421,2],[2490,1],[2518,1],[2520,1],[2549,1],[2551,2],[2594,1],[2634,1],[2655,1],[2680,1],[2709,2],[2812,1],[2861,1],[2863,2],[2914,1],[2931,1],[2995,1],[3031,1],[3054,1],[3071,1],[3106,1],[3135,2],[3238,1],[3250,1],[3264,1],[3486,1],[3488,2],[3550,2],[3582,2],[3633,2],[3683,2],[3731,2],[3873,1],[3887,1],[4004,1],[4054,1],[4100,1],[4117,1],[4145,1],[4266,1],[4456,1],[4517,1],[4528,1],[4610,1],[4618,1],[4632,2],[4641,1],[4655,2],[4658,2],[4661,1],[4709,1],[4784,1],[4856,1]]},"395":{"position":[[236,3],[333,3],[546,1],[548,2],[596,1],[630,2],[700,1],[716,2],[761,1],[860,1],[901,2],[939,1],[1039,2],[1155,2],[1255,2],[1305,2],[1346,2],[1407,2],[1470,1],[1475,1],[1484,2],[1550,2],[1737,2],[1740,1],[1742,3],[1831,1],[1842,1],[1891,1],[1936,1],[1960,1],[1995,1],[2014,1],[2056,2],[2132,1],[2134,3],[2272,1],[2286,1],[2324,1],[2399,1],[2563,1],[2593,1],[2621,1],[2660,1],[2662,1],[2672,1],[2702,1],[2704,3],[2725,1],[2733,1],[2748,1],[2750,1],[2760,1],[2790,1],[2792,3],[2813,1],[2821,1],[2847,1],[2849,1],[2859,1],[2889,1],[2896,1],[2927,1],[2929,1],[2939,1],[2969,1],[2971,3],[2992,1],[3000,1],[3034,1],[3036,1],[3046,1],[3076,1],[3078,3],[3099,1],[3107,1],[3128,1],[3130,2],[3141,1],[3194,1],[3236,1],[3277,1],[3298,1],[3338,1],[3377,1],[3398,1],[3435,1],[3492,1],[3548,1],[3556,1],[3609,1],[3674,1],[3841,1],[3970,1],[4560,2],[4568,1],[4602,2],[4610,1],[4661,2],[4669,1],[4765,2],[4773,1],[4869,2],[4877,1],[4986,2],[4994,1],[5182,2],[5190,1],[5328,2],[5336,1],[5432,2],[5440,1],[5536,2],[5544,1],[5653,2],[5661,1],[5787,2],[5795,1],[5891,2],[5899,1],[5995,2],[6003,1],[6112,2],[6120,1],[6172,2],[6180,1],[6307,2],[6315,1],[6411,2],[6419,1],[6515,2],[6523,1]]},"405":{"position":[[457,1],[490,1],[518,1],[557,1],[606,1],[639,1],[684,1],[725,1],[746,1],[789,1],[828,1],[868,1],[876,1],[929,1]]},"406":{"position":[[143,1]]},"407":{"position":[[877,2],[909,1],[951,1],[953,3],[1022,1],[1024,2],[1055,1],[1097,1],[1099,3],[1155,1],[1329,1],[1351,1],[1383,1],[1404,1],[1427,1],[1452,1],[1461,1],[1607,1],[1690,1],[1692,2],[1745,1],[1795,3],[2212,1],[2286,1],[2713,1],[2821,1],[2938,1],[3321,1],[3359,1],[3482,1],[3879,1],[3939,1],[3941,2]]},"408":{"position":[[832,2],[962,1],[994,1],[1037,2],[1162,1],[1196,1],[1212,1],[1330,2],[1343,1],[2388,1],[2411,1],[2454,1],[2529,1],[2674,2],[2677,1],[3023,1],[3053,1],[3098,3],[3160,1],[3219,1],[3221,3],[3283,1],[3349,1],[3351,3]]},"409":{"position":[[276,1],[318,1],[520,1],[549,1],[658,1],[660,1],[673,1],[799,1],[816,1],[934,1],[967,1],[1022,3],[1026,1],[1028,1],[1030,1],[1107,1],[1120,1],[1194,1],[1297,1],[1311,1],[1430,1],[1504,1],[1516,1],[1624,1],[1667,3],[1671,1],[1709,1],[1752,1],[1754,2],[1866,1],[1924,1],[1995,1],[2097,1],[2147,3],[2151,1],[2222,1],[2265,1],[2307,1],[2419,1],[2469,3],[2473,1],[2475,1],[2488,1],[2586,1],[2640,1],[2681,1],[2793,1],[2853,3],[2857,1],[2956,1],[2972,1],[3057,1],[3100,1],[3193,1],[3256,3],[3260,1],[3262,1],[3279,1],[3410,1],[3493,1],[3554,1],[3614,1],[3616,1],[3633,1],[3692,1],[3714,1],[3746,1],[3767,1],[3790,1],[3815,1],[3824,1],[3826,1],[3851,1],[3939,2],[4021,2],[4045,1],[4092,1],[4130,1],[4162,1],[4213,1],[4223,1],[4243,1],[4304,1],[4422,1],[4424,1],[4426,1],[4428,1],[4458,1],[4460,2],[4528,1],[4539,2],[4714,2],[4808,2],[4904,1],[4978,1],[4980,3],[4984,1],[5014,1],[5016,2],[5062,1],[5073,2],[5124,1],[5160,1],[5193,1],[5254,2],[5373,2],[5376,2],[5472,2],[5566,1],[5616,1],[5618,3],[5622,1],[5652,1],[5654,2],[5700,1],[5711,2],[5781,1],[5814,1],[5843,1],[5858,2],[5950,1],[5952,2],[5970,1]]},"414":{"position":[[232,1],[265,1],[280,1],[282,2],[349,1],[365,1],[367,3],[439,3]]},"416":{"position":[[405,1],[407,3],[498,3],[564,3],[639,3],[698,3],[762,1],[764,3],[827,1],[873,1],[1370,3],[1483,1],[1485,2],[1593,1],[1648,1],[1650,2],[1745,2],[1761,1],[1827,1],[1829,2],[1898,2],[1943,2],[2044,1],[2049,1],[2054,1],[2063,1],[2628,3],[2715,1],[2717,2],[2812,1],[2848,1],[2877,2],[2989,2],[3041,1],[3066,3],[3070,1],[3447,3],[3518,1],[3520,2],[3598,1],[3654,1],[3656,2],[3731,1],[3857,1],[3912,1],[3914,2],[3951,1],[3984,1],[4013,1],[4063,1],[4082,1],[4099,1],[4111,2],[4127,1],[4134,1],[4145,2],[4161,1],[4163,2],[4287,1],[4289,2],[4362,1],[4386,1],[4512,1],[4514,2],[4563,1]]},"417":{"position":[[151,1],[161,1],[195,1],[214,1],[343,2],[360,1],[408,2],[451,2],[508,2],[668,2],[773,2],[828,1],[833,1],[842,2],[877,2],[1033,2],[1139,2],[1337,2],[1481,1],[1486,1],[1510,2],[1621,1]]},"419":{"position":[[176,3],[239,1],[285,1],[287,3],[367,1],[369,3],[422,1],[427,3],[472,1],[477,3],[521,1],[526,3],[551,1],[556,3],[634,1],[639,1],[641,3],[715,3],[777,1],[779,3],[869,3],[935,3],[1010,3],[1069,3],[1133,1],[1135,3],[1162,3],[1166,3],[1195,3],[1288,1],[1290,3],[1456,1],[1458,2],[1626,1],[1628,2],[1694,1],[1710,1],[1712,3],[1785,3],[1839,3],[1888,3],[1989,3],[2088,3],[2311,2],[2314,3],[2382,3],[2454,3],[2538,3],[2620,3],[2726,3],[2883,3],[3038,3],[3183,3],[3327,3],[3454,3],[3636,3],[3760,3],[3885,1],[3887,1],[3889,3],[4002,1],[4004,2],[4110,1],[4165,1],[4167,2],[4262,2],[4278,1],[4345,1],[4347,2],[4416,2],[4461,2],[4562,1],[4567,1],[4572,1],[4581,1],[4583,3],[4670,1],[4672,2],[4767,1],[4803,1],[4832,2],[4943,2],[4995,1],[5020,3],[5024,1],[5026,3],[5097,1],[5099,2],[5177,1],[5233,1],[5235,2],[5310,1],[5436,1],[5491,1],[5493,2],[5530,1],[5563,1],[5592,1],[5642,1],[5661,1],[5678,1],[5690,2],[5706,1],[5713,1],[5724,2],[5740,1],[5742,2],[5867,1],[5869,2],[5942,1],[5966,1],[6092,1],[6094,2],[6143,1],[6183,1],[6224,1],[6280,1],[6298,1],[6424,1],[6473,1],[6475,1],[6477,1],[6502,1],[6566,1],[6576,1],[6610,1],[6629,1],[6758,2],[6775,1],[6823,2],[6866,2],[6923,2],[7083,2],[7188,2],[7243,1],[7248,1],[7257,2],[7292,2],[7448,2],[7554,2],[7752,2],[7896,1],[7901,1],[7925,2],[8036,1],[8038,1]]},"423":{"position":[[108,1],[150,1],[352,1]]},"424":{"position":[[36,1],[131,1],[144,1],[287,1],[325,1],[354,1],[394,1],[425,1],[463,1],[496,1],[540,1],[577,1],[579,1],[592,1],[663,1],[765,1],[815,3],[819,1],[821,1],[858,1],[941,1],[1494,1],[1560,1]]},"425":{"position":[[255,1],[257,3],[336,1],[349,1],[423,1],[526,1],[540,1],[659,1],[733,1],[745,1],[853,1],[896,3],[900,1],[965,1],[1010,1],[1095,1],[1153,1],[1155,1],[1168,1],[1170,3],[1270,1],[1290,1],[1364,1],[1412,1],[1535,1],[1595,3],[1599,1],[1698,1],[1714,1],[1774,1],[1824,1],[1844,1],[1960,1],[2023,3],[2027,1],[2029,1],[2066,1],[2126,1],[2163,1],[2185,1],[2212,1],[2217,1]]},"426":{"position":[[36,1],[141,1],[188,1],[226,1],[258,1],[309,1],[319,1],[339,1],[400,1],[512,1],[514,1],[516,1],[518,1],[548,1],[550,2],[618,1],[629,2],[804,2],[898,2],[989,1],[1063,1],[1065,3],[1069,1],[1099,1],[1101,2],[1147,1],[1158,2],[1209,1],[1245,1],[1278,1],[1339,2],[1458,2],[1461,2],[1557,2],[1646,1],[1696,1],[1698,3],[1702,1],[1732,1],[1734,2],[1780,1],[1791,2],[1861,1],[1894,1],[1923,1],[1938,2],[2030,1],[2077,1],[2100,1],[2143,1],[2227,1],[2263,1],[2349,2],[2427,2],[2579,1],[2620,1],[2622,3],[2626,2],[2775,2],[2915,2],[3034,1],[3093,1],[3095,3],[3152,1],[3218,1],[3220,3],[3224,2],[3288,1],[3323,1],[3325,2],[3371,1],[3382,2],[3455,1],[3530,1],[3571,2],[3714,2],[3717,1],[3719,1]]},"431":{"position":[[81,1],[123,1],[165,1],[333,1]]},"432":{"position":[[40,1],[85,1],[128,1],[182,1],[252,1],[289,3],[293,1],[295,1],[332,1],[360,1],[365,1],[410,1],[474,1]]},"433":{"position":[[40,1],[42,3],[104,1],[123,2],[163,1],[200,1],[202,1],[268,1],[337,1],[430,1],[487,3],[491,1],[535,1],[571,1],[657,1],[659,1],[661,1],[698,1],[709,1],[740,1],[767,1],[772,1]]},"434":{"position":[[34,1],[148,1],[167,1],[201,1],[219,1],[247,2],[329,1],[365,1],[393,1],[499,1],[536,1],[538,2],[541,1],[583,1],[615,1],[640,1],[826,1],[863,1],[865,2],[868,1],[917,1],[945,1],[970,1],[1120,2],[1123,1],[1125,1]]},"440":{"position":[[213,2],[386,2],[407,1],[455,1],[474,1],[517,1],[574,1],[616,1],[672,1],[713,1],[752,1],[789,1],[817,1],[842,1],[865,1],[891,1],[898,1],[923,1],[963,1],[971,2],[998,1],[1112,1],[1148,1],[1248,1],[1288,1],[1547,2],[1605,3],[1609,2],[1612,1],[1682,1],[1692,1],[1717,1],[1773,2],[1814,1],[1899,1],[1985,2],[2051,1],[2125,2],[2128,2],[2131,2],[2177,1],[2209,3],[2213,1],[2286,1],[2296,1],[2320,1],[2358,1],[2384,1],[2408,2],[2514,2],[2523,1],[2571,1],[2588,1],[2686,2],[2741,2],[2768,1],[2816,1],[2818,2],[2886,1],[2926,1],[2928,2],[3004,2],[3127,1],[3219,1],[3238,3],[3242,1],[3284,1],[3312,1],[3314,1],[4862,2],[4957,1],[4967,1],[5001,1],[5024,1],[5140,2],[5160,1],[5357,1],[5509,2],[5590,2],[5670,2],[5789,2],[5792,1],[6372,1],[6396,1],[6398,3],[6463,1],[6509,1],[6511,3],[6515,1]]},"441":{"position":[[86,1],[707,1],[729,1],[736,1],[760,1],[796,1],[841,1],[879,1],[944,1],[1001,1],[1003,2],[1125,1],[1135,1],[1159,1],[1185,1],[1220,1],[1343,1],[1388,2],[1524,1],[1566,1],[1594,1],[1596,1],[2256,3],[2295,1],[2297,3],[2317,1],[2337,1],[2344,1],[2386,1],[2388,3],[2422,1],[2458,1],[2460,3],[2523,1],[2525,2],[2579,1],[2642,2],[2824,1],[2894,1],[2896,2],[2933,3],[2937,2],[2997,1],[3084,2],[3101,3],[3105,1],[3190,1],[3200,1],[3224,1],[3263,1],[3279,2],[3348,1],[3383,1],[3385,3],[3389,2],[3450,2],[3497,2],[3545,1],[3611,1],[3626,2],[3649,1],[3698,1],[3785,1],[3787,1],[4628,2],[4757,2],[4782,1],[4792,1],[4826,1],[4849,1],[4965,2],[4981,1],[5054,1],[5326,1],[5454,2],[5658,2],[5713,1],[5820,1],[5881,1]]},"445":{"position":[[241,1],[308,1]]},"446":{"position":[[15,3],[60,3],[96,1],[191,1],[206,1],[315,1],[353,1],[373,1],[413,1],[435,1],[473,1],[497,1],[541,1],[569,1],[634,1],[667,1],[752,1],[791,1],[868,1],[910,1],[1013,1],[1067,1],[1141,1],[1180,1],[1224,1],[1251,1],[1317,1],[1361,1],[1432,1],[1525,1],[1527,1]]},"452":{"position":[[308,1],[325,1],[351,1],[360,1],[395,1],[418,1],[455,1],[478,1]]},"453":{"position":[[140,3],[166,1],[209,1],[238,1]]},"454":{"position":[[71,1],[112,1],[146,1],[185,1],[207,1],[253,1],[255,1],[290,1],[313,1],[357,1],[359,1],[361,1]]},"455":{"position":[[88,1],[118,1],[202,1],[233,3],[237,1],[269,1],[352,1],[383,3],[387,1],[389,1]]},"456":{"position":[[287,3],[312,3],[359,1],[421,1],[460,1],[494,1],[547,1],[577,1],[609,1],[639,1],[665,1],[697,1],[725,1],[765,1],[795,1],[797,1],[821,1],[913,1],[928,1],[965,1],[1144,2],[1184,1],[1186,1]]},"460":{"position":[[220,1],[226,1],[236,1],[248,1],[258,1],[280,1]]},"461":{"position":[[718,1],[817,1],[849,1],[851,3],[921,1],[974,1],[1048,1],[1063,1],[1080,1],[1170,1],[1172,1]]},"462":{"position":[[256,1],[336,1],[359,1],[403,1],[438,1],[490,1],[518,1],[619,1],[631,1],[712,1],[801,1],[817,1],[891,1],[893,1]]},"471":{"position":[[77,1],[79,2],[117,1],[157,1],[216,1],[247,2],[314,1],[356,1],[358,2],[488,1],[544,1],[570,3],[574,1]]},"473":{"position":[[47,1],[73,1],[116,1],[191,1],[205,1],[311,1],[313,1],[315,1],[342,1],[368,1],[376,1],[428,1],[434,1],[436,1],[460,1],[569,1],[584,1],[621,1],[693,1],[787,1],[789,1]]},"474":{"position":[[192,1],[194,2],[211,1],[270,1],[272,2],[289,1]]},"476":{"position":[[207,1],[223,1],[275,1],[397,1],[435,1],[437,3],[537,1],[578,1],[580,3],[670,1],[672,2],[710,1],[750,1],[809,1],[840,2],[907,1],[951,1],[953,2],[1083,1],[1138,1],[1164,3],[1168,1],[1170,3],[1264,1],[1266,2],[1294,1],[1296,3],[1406,1],[1408,2],[1436,1],[1438,3],[1511,1],[1513,2],[1541,1],[1543,1],[1545,3],[1637,1],[1653,1],[1674,1],[1699,1],[1703,1],[1705,3],[1758,1],[1799,1],[1801,3],[1860,1],[1901,1]]},"477":{"position":[[274,1],[330,1],[739,1],[775,1],[803,1],[842,1],[844,1],[851,1],[891,1],[899,1],[901,3],[905,1],[950,1],[952,1],[962,1],[992,1],[999,1],[1001,3],[1005,1],[1041,1],[1043,2],[1054,1],[1094,3],[1098,1],[1128,1],[1162,1],[1216,1],[1245,1],[1253,3],[1257,1],[1305,3],[1635,1],[1664,1],[1685,1],[1711,1],[1721,1],[1766,1],[1847,1],[1913,1],[1933,1],[1938,1],[1940,2],[1943,2],[2114,2],[2284,1],[2396,1],[2454,1],[2500,1],[2552,1],[2568,2],[2576,1],[2616,2],[2624,1],[2681,2],[2689,1],[2785,2],[2793,1],[2902,2],[2910,1],[3013,2],[3021,1],[3164,2],[3172,1],[3268,2],[3276,1],[3407,2],[3415,1],[3545,2],[3553,1],[3649,2],[3657,1]]},"481":{"position":[[179,2],[220,1],[287,1],[321,1],[416,1],[431,1],[540,1],[552,1],[568,1],[1037,1],[1055,1],[1152,1],[1154,1],[1215,1],[1303,1],[1305,1],[1937,2],[1980,1],[2084,1],[2120,1],[2235,1],[2250,1],[2394,1],[2406,1],[2422,1],[2539,1],[2557,1],[2598,1],[2617,1],[2732,1],[2734,1],[2795,1],[2883,1],[2885,1]]},"483":{"position":[[562,1],[669,1]]},"484":{"position":[[231,1],[297,1],[577,1],[647,1]]},"485":{"position":[[476,1],[493,1],[495,2],[522,2],[554,2],[574,2],[594,1],[596,2],[623,2],[655,2],[675,1],[677,1]]},"488":{"position":[[246,1],[248,1],[255,1],[287,1],[321,1]]},"495":{"position":[[967,1],[969,8]]},"503":{"position":[[234,1],[266,1],[293,1],[342,1],[375,1],[412,1],[501,1],[569,1],[632,1]]},"504":{"position":[[328,1],[360,1],[387,1],[436,1],[468,1],[510,1],[585,1],[654,1],[717,1],[765,1],[813,1]]},"505":{"position":[[182,1],[214,1],[241,1],[290,1],[322,1],[365,1],[443,1],[512,1],[575,1],[638,1]]},"514":{"position":[[428,1],[486,1],[513,1],[572,1],[665,1],[782,1],[825,1],[894,1],[949,1],[1336,1],[1338,2],[1394,2],[1422,1],[1456,2],[1513,2],[1542,1],[1558,2],[1613,2],[1643,2],[1700,1],[1799,1],[1840,2],[1892,1],[1941,1],[1987,1],[2020,1],[2042,2],[2109,2],[2143,2],[2198,2],[2254,2],[2338,1],[2354,1],[2417,2],[2434,1],[2474,2],[2610,2],[2650,2],[2665,1],[2750,2],[2765,1],[2804,2],[2870,2],[2899,2],[2916,1],[2953,2],[3067,2],[3139,2],[3397,1],[3527,1],[3563,1],[3623,1],[3652,1]]},"515":{"position":[[259,3],[263,2],[271,1],[350,2],[358,1],[402,2],[410,1],[454,2],[462,1]]},"519":{"position":[[379,1],[412,1],[440,1],[1009,1],[1087,1],[1188,1]]},"522":{"position":[[372,1]]},"528":{"position":[[59,1],[88,1],[116,1],[155,1],[204,1],[256,1],[289,1],[330,1],[371,1],[392,1],[431,1],[470,1],[510,1],[518,1],[571,1]]},"529":{"position":[[147,1]]},"535":{"position":[[1255,1],[1304,1]]},"536":{"position":[[312,1],[326,1],[423,1],[520,1]]},"537":{"position":[[124,1],[278,1],[293,1],[338,1],[409,1],[478,1],[533,1],[535,2],[589,1],[591,1],[949,1],[1043,1],[1058,1],[1088,1],[1199,1],[1260,1],[1275,1],[1342,1],[1344,1]]},"539":{"position":[[517,2],[578,1],[604,2],[680,1],[701,2],[791,1],[793,1],[812,2],[815,2],[915,1],[926,2],[951,1],[1005,1],[1039,1],[1041,3],[1171,1],[1263,1],[1270,3],[1274,1],[1276,3],[1375,1],[1436,1],[1443,3],[1447,1],[1449,3],[1524,1],[1531,1],[1629,1],[1631,1],[1633,1],[1635,2],[1735,1],[1767,1],[1769,2],[1880,1],[1882,3],[1921,3],[1958,1],[1960,2],[2070,1],[2086,1],[2088,2],[2206,1],[2222,1]]},"540":{"position":[[79,1]]},"541":{"position":[[225,1],[375,3],[556,1],[558,1],[580,1],[673,1],[675,1],[779,1],[781,1],[783,1],[785,2],[788,1],[810,1],[900,1],[902,1],[1006,2],[1009,1],[1111,1],[1113,1],[1115,1],[1117,2],[1120,1],[1142,1],[1235,1],[1237,1],[1341,1],[1343,1],[1345,1],[1347,1],[1349,2],[1372,1],[1374,1],[1505,2],[1508,1],[1641,1],[1643,2],[1672,1],[1674,1],[1857,1],[1859,1],[1992,1],[1994,2],[2116,2],[2119,1],[2286,3],[2409,1],[2411,2],[2434,1],[2436,1],[2513,2],[2516,1],[2593,1],[2595,2],[2616,1],[2805,1],[2807,1],[3017,2],[3020,1],[3222,2],[3225,1],[3435,2],[3438,1],[3571,2],[3574,1],[3705,1],[3707,1],[3709,1],[3711,1]]},"544":{"position":[[187,1],[324,1],[339,1],[369,1],[413,1],[482,1],[506,1],[552,2],[578,1],[778,2],[781,1],[783,1]]},"547":{"position":[[274,1],[298,1],[337,1],[460,1],[509,1],[511,2],[514,2],[663,2],[779,1]]},"551":{"position":[[11,3],[85,3],[146,1],[148,3],[196,3],[279,1]]},"552":{"position":[[11,3],[38,3],[42,3],[71,3],[163,1],[165,3],[187,3],[191,3],[272,1],[297,1],[299,3],[1022,3],[1026,3],[1122,1],[1147,1],[1149,3],[1232,1],[1263,1],[1265,3]]},"553":{"position":[[34,1],[130,1],[140,1],[160,2],[233,2],[321,1],[433,1],[435,3]]},"556":{"position":[[119,1],[218,1],[233,1],[274,1],[383,1],[385,1]]},"559":{"position":[[333,1],[381,1]]},"562":{"position":[[172,1],[299,1],[314,1],[354,1],[713,1],[715,1]]},"564":{"position":[[354,1],[505,1],[529,1],[609,1],[635,1],[678,2],[702,1],[774,1],[867,1],[893,1],[937,2],[962,1],[1035,1],[1100,1],[1102,1],[2057,1]]},"567":{"position":[[407,1],[516,1],[784,1],[853,1],[969,1],[1006,1],[1036,1],[1073,1],[1104,1],[1142,1],[1171,1],[1214,1],[1226,1],[1276,1],[1325,1],[1337,1],[1387,1],[1389,1],[1509,3],[1541,3],[2235,1],[2247,1],[2290,1]]},"568":{"position":[[423,1],[487,1],[858,1],[871,1],[949,1],[955,1],[1013,1],[1061,1],[1650,1],[1705,1]]},"569":{"position":[[229,1],[280,1],[585,1],[628,1],[651,1],[689,1],[718,1],[761,1],[780,1],[829,1],[855,1],[905,1],[932,1],[934,1]]},"570":{"position":[[282,1],[348,1],[605,1],[611,1],[620,1],[629,1],[634,1],[734,1]]},"585":{"position":[[26,3],[97,3],[160,1],[162,3],[210,3],[293,1],[295,3],[322,3],[326,3],[355,3],[447,1],[449,3],[493,3],[497,3],[578,1],[603,1],[605,3],[701,1],[726,1],[728,3],[811,1],[842,1],[844,3],[882,3],[983,1],[1013,1],[1015,1],[1040,1],[1136,1],[1146,1],[1166,2],[1239,2],[1327,1],[1439,1],[1472,1],[1482,1],[1520,1],[1578,1],[1747,1],[1749,1]]},"586":{"position":[[65,1],[78,1]]},"590":{"position":[[15,3],[23,1],[25,3],[36,1],[38,1],[40,3],[62,1],[64,1],[66,3],[80,1],[82,1],[84,3],[98,1],[100,3],[111,3],[124,3],[139,3]]},"591":{"position":[[301,1],[361,1],[401,1],[461,1],[506,1],[580,1],[916,1],[930,1],[970,1],[980,1]]},"592":{"position":[[227,1],[274,1],[309,1],[383,1],[468,1],[505,1],[585,1],[637,1],[700,1],[717,1],[765,1],[778,1],[786,1],[793,1],[814,1],[816,1],[891,1],[1010,1],[1086,1],[1206,1],[1284,1],[1297,2],[1325,1],[1384,1],[1429,1],[1431,1],[1452,1],[1523,1],[1558,1],[1599,1],[1601,1],[1680,1],[1706,1],[1814,1],[1878,3],[1882,1],[1967,1],[2002,1],[2084,1],[2146,3],[2150,1],[2152,1],[2238,1],[2272,1],[2355,1],[2417,3],[2421,1],[2423,1],[2425,1]]},"596":{"position":[[243,1],[271,1],[305,1],[351,1],[378,1],[415,1],[445,1],[447,1]]},"598":{"position":[[147,2],[188,1],[230,2],[295,2],[359,2],[422,2],[642,1],[676,1],[705,1],[926,1],[964,2],[1021,1],[1050,1],[1063,1],[1065,2],[1190,1],[1226,1],[1274,1],[1311,1],[1357,1],[1393,1],[1395,2],[1506,1],[1543,1],[1545,1]]},"599":{"position":[[147,1],[173,1],[227,1],[270,2],[273,1]]},"600":{"position":[[99,1],[152,1],[185,1],[214,1],[297,1],[330,1],[332,2],[357,1],[364,2],[395,1],[437,1],[460,1],[462,1]]},"601":{"position":[[106,1],[159,1],[198,1],[248,1],[250,2],[326,2],[448,1],[500,1],[539,1],[585,1],[621,1],[623,1],[666,1],[727,1],[764,1],[823,1],[888,1],[951,1],[997,1],[1052,1],[1093,1],[1095,1],[1173,1],[1175,2],[1288,1],[1317,1],[1346,1],[1430,1],[1473,1],[1501,1],[1546,1],[1560,1],[1625,1],[1657,1],[1671,1],[1730,1],[1787,1],[1801,1],[1850,1],[1878,1],[1880,1]]},"602":{"position":[[96,1],[157,1],[191,1],[220,1],[248,1],[285,1],[316,1],[360,1],[387,1],[418,1],[455,1],[485,1],[524,1],[526,1],[1010,1],[1043,1],[1077,1],[1079,2],[1157,2],[1205,2],[1256,1],[1284,1],[1329,1],[1352,1],[1378,3],[1382,1],[1444,1],[1468,1],[1492,1],[1504,1],[1545,1],[1547,1],[1599,1],[1623,1],[1647,1],[1664,1],[1716,1],[1718,1],[1720,2],[1822,1],[1846,1],[1848,1]]},"604":{"position":[[139,1],[216,1],[287,2],[315,1],[419,1],[421,2],[458,1],[460,1]]},"605":{"position":[[67,1],[87,1],[122,1],[169,1],[195,1],[199,1],[201,1],[240,1],[244,1],[248,1]]},"606":{"position":[[72,1],[118,1],[158,1],[210,1],[278,1],[303,1],[320,1],[355,1],[389,1],[437,1],[462,1],[499,1],[525,1],[527,1]]},"608":{"position":[[122,1],[151,1],[182,1],[211,1],[250,1],[295,1],[297,1],[329,1],[331,1],[360,1],[373,1],[508,1],[564,1],[616,1],[618,1]]},"609":{"position":[[236,1]]},"610":{"position":[[76,1],[112,1],[151,2],[211,1],[236,1],[246,1],[279,1],[350,3],[373,1],[445,3],[475,4],[480,1],[482,1]]},"611":{"position":[[106,1],[128,1],[151,1],[156,1],[219,1],[265,1],[288,1],[341,1],[343,1],[408,1],[422,1],[483,1],[538,1],[540,1],[542,1]]},"612":{"position":[[515,1],[552,1],[580,1],[582,1],[613,1],[637,1],[662,1],[699,1],[727,1],[729,1],[760,1],[784,1],[809,1],[846,1],[874,1],[876,1],[907,1],[954,1],[979,1],[1016,1],[1031,1],[1033,1],[1064,1],[1111,1],[1136,1],[1173,1],[1188,1],[1190,1],[1221,1],[1269,1],[1294,1],[1331,1],[1346,1],[1348,1]]},"613":{"position":[[87,1],[151,1],[163,1],[187,1],[199,1],[203,1],[207,1],[227,1],[231,1],[238,1],[243,1],[247,1],[252,1],[257,1],[259,1],[271,2],[287,1],[291,1],[306,1],[310,1],[312,1],[377,1],[434,1],[450,1],[452,1],[485,1],[498,1],[505,1],[523,1],[565,1],[613,1],[654,1],[664,1],[690,1],[733,1],[766,1],[779,1],[834,1],[836,1],[871,1],[906,1],[939,1],[981,1],[995,1],[1038,1],[1060,1],[1109,1],[1224,1],[1226,1]]},"616":{"position":[[109,2],[187,1],[267,1],[277,1],[304,1],[503,1],[505,1],[552,1],[583,1],[624,1],[626,3],[708,1],[920,3],[924,1],[926,3],[1019,1],[1029,1],[1052,1],[1113,2],[1145,1],[1147,1]]},"617":{"position":[[103,1],[141,1],[172,1],[226,1],[269,1],[311,1],[331,1],[359,1],[372,1],[452,1],[472,1],[474,2],[529,1],[549,1],[551,2],[598,1],[600,1],[602,1],[604,1],[606,1],[685,1],[748,1],[759,1],[761,1]]},"625":{"position":[[368,1],[434,1],[666,1],[668,3],[687,4],[699,1],[726,1],[728,2],[738,1],[775,1],[797,1],[829,1],[850,1],[873,1],[898,1],[907,1],[1129,1],[1212,1]]},"626":{"position":[[273,1],[304,1],[331,1],[533,1],[562,1],[671,1],[673,1],[686,1],[812,1],[829,1],[947,1],[980,1],[1035,3],[1039,1],[1041,1],[1043,1],[1120,1],[1133,1],[1207,1],[1310,1],[1324,1],[1443,1],[1517,1],[1529,1],[1637,1],[1680,3],[1684,1],[1722,1],[1772,1],[1774,2],[1886,1],[1944,1],[2015,1],[2117,1],[2167,3],[2171,1],[2242,1],[2285,1],[2334,1],[2446,1],[2496,3],[2500,1],[2502,1],[2515,1],[2613,1],[2667,1],[2715,1],[2827,1],[2887,3],[2891,1],[2990,1],[3006,1],[3091,1],[3141,1],[3234,1],[3297,3],[3301,1],[3303,1],[3320,1],[3420,1],[3503,1],[3540,1],[3600,1],[3602,1],[3619,1],[3656,1],[3678,1],[3710,1],[3731,1],[3754,1],[3779,1],[3788,1],[3790,1],[3815,1],[3817,2],[3849,1]]},"632":{"position":[[236,3],[333,3],[546,1],[548,2],[596,1],[630,2],[700,1],[716,2],[761,1],[860,1],[901,2],[939,1],[1039,2],[1155,2],[1255,2],[1305,2],[1346,2],[1407,2],[1470,1],[1475,1],[1484,2],[1550,2],[1737,2],[1740,1],[1742,3],[1831,1],[1842,1],[1891,1],[1936,1],[1960,1],[1995,1],[2014,1],[2056,2],[2132,1],[2134,3],[2272,1],[2286,1],[2324,1],[2399,1],[2563,1],[2593,1],[2621,1],[2660,1],[2662,1],[2672,1],[2702,1],[2704,3],[2725,1],[2733,1],[2748,1],[2750,1],[2760,1],[2790,1],[2792,3],[2813,1],[2821,1],[2847,1],[2849,1],[2859,1],[2889,1],[2896,1],[2927,1],[2929,1],[2939,1],[2969,1],[2971,3],[2992,1],[3000,1],[3034,1],[3036,1],[3046,1],[3076,1],[3078,3],[3099,1],[3107,1],[3128,1],[3130,2],[3141,1],[3194,1],[3236,1],[3277,1],[3298,1],[3338,1],[3377,1],[3398,1],[3435,1],[3492,1],[3548,1],[3556,1],[3609,1],[3674,1],[3841,1],[3970,1],[4560,2],[4568,1],[4602,2],[4610,1],[4661,2],[4669,1],[4765,2],[4773,1],[4869,2],[4877,1],[4986,2],[4994,1],[5182,2],[5190,1],[5328,2],[5336,1],[5432,2],[5440,1],[5536,2],[5544,1],[5653,2],[5661,1],[5787,2],[5795,1],[5891,2],[5899,1],[5995,2],[6003,1],[6112,2],[6120,1],[6172,2],[6180,1],[6307,2],[6315,1],[6411,2],[6419,1],[6515,2],[6523,1]]},"642":{"position":[[457,1],[490,1],[518,1],[557,1],[606,1],[639,1],[684,1],[725,1],[746,1],[789,1],[828,1],[868,1],[876,1],[929,1]]},"643":{"position":[[143,1]]},"644":{"position":[[877,2],[909,1],[951,1],[953,3],[1022,1],[1024,2],[1055,1],[1097,1],[1099,3],[1155,1],[1329,1],[1351,1],[1383,1],[1404,1],[1427,1],[1452,1],[1461,1],[1607,1],[1690,1],[1692,2],[1745,1],[1795,3],[2212,1],[2286,1],[2713,1],[2821,1],[2938,1],[3321,1],[3359,1],[3482,1],[3879,1],[3939,1],[3941,2]]},"645":{"position":[[832,2],[962,1],[994,1],[1037,2],[1162,1],[1196,1],[1212,1],[1330,2],[1343,1],[2388,1],[2411,1],[2454,1],[2529,1],[2674,2],[2677,1],[3023,1],[3053,1],[3098,3],[3160,1],[3219,1],[3221,3],[3283,1],[3349,1],[3351,3]]},"646":{"position":[[276,1],[318,1],[520,1],[549,1],[658,1],[660,1],[673,1],[799,1],[816,1],[934,1],[967,1],[1022,3],[1026,1],[1028,1],[1030,1],[1107,1],[1120,1],[1194,1],[1297,1],[1311,1],[1430,1],[1504,1],[1516,1],[1624,1],[1667,3],[1671,1],[1709,1],[1752,1],[1754,2],[1866,1],[1924,1],[1995,1],[2097,1],[2147,3],[2151,1],[2222,1],[2265,1],[2307,1],[2419,1],[2469,3],[2473,1],[2475,1],[2488,1],[2586,1],[2640,1],[2681,1],[2793,1],[2853,3],[2857,1],[2956,1],[2972,1],[3057,1],[3100,1],[3193,1],[3256,3],[3260,1],[3262,1],[3279,1],[3410,1],[3493,1],[3554,1],[3614,1],[3616,1],[3633,1],[3692,1],[3714,1],[3746,1],[3767,1],[3790,1],[3815,1],[3824,1],[3826,1],[3851,1],[3939,2],[4021,2],[4045,1],[4092,1],[4130,1],[4162,1],[4213,1],[4223,1],[4243,1],[4304,1],[4422,1],[4424,1],[4426,1],[4428,1],[4458,1],[4460,2],[4528,1],[4539,2],[4714,2],[4808,2],[4904,1],[4978,1],[4980,3],[4984,1],[5014,1],[5016,2],[5062,1],[5073,2],[5124,1],[5160,1],[5193,1],[5254,2],[5373,2],[5376,2],[5472,2],[5566,1],[5616,1],[5618,3],[5622,1],[5652,1],[5654,2],[5700,1],[5711,2],[5781,1],[5814,1],[5843,1],[5858,2],[5950,1],[5952,2],[5970,1]]},"651":{"position":[[232,1],[265,1],[280,1],[282,2],[349,1],[365,1],[367,3],[439,3]]},"653":{"position":[[405,1],[407,3],[498,3],[564,3],[639,3],[698,3],[762,1],[764,3],[827,1],[873,1],[1370,3],[1483,1],[1485,2],[1593,1],[1648,1],[1650,2],[1745,2],[1761,1],[1827,1],[1829,2],[1898,2],[1943,2],[2044,1],[2049,1],[2054,1],[2063,1],[2628,3],[2715,1],[2717,2],[2812,1],[2848,1],[2877,2],[2989,2],[3041,1],[3066,3],[3070,1],[3447,3],[3518,1],[3520,2],[3598,1],[3654,1],[3656,2],[3731,1],[3857,1],[3912,1],[3914,2],[3951,1],[3984,1],[4013,1],[4063,1],[4082,1],[4099,1],[4111,2],[4127,1],[4134,1],[4145,2],[4161,1],[4163,2],[4287,1],[4289,2],[4362,1],[4386,1],[4512,1],[4514,2],[4563,1]]},"654":{"position":[[151,1],[161,1],[195,1],[214,1],[343,2],[360,1],[408,2],[451,2],[508,2],[668,2],[773,2],[828,1],[833,1],[842,2],[877,2],[1033,2],[1139,2],[1337,2],[1481,1],[1486,1],[1510,2],[1621,1]]},"656":{"position":[[176,3],[239,1],[285,1],[287,3],[367,1],[369,3],[422,1],[427,3],[472,1],[477,3],[521,1],[526,3],[551,1],[556,3],[634,1],[639,1],[641,3],[715,3],[777,1],[779,3],[869,3],[935,3],[1010,3],[1069,3],[1133,1],[1135,3],[1162,3],[1166,3],[1195,3],[1288,1],[1290,3],[1456,1],[1458,2],[1626,1],[1628,2],[1694,1],[1710,1],[1712,3],[1785,3],[1839,3],[1888,3],[1989,3],[2088,3],[2311,2],[2314,3],[2382,3],[2454,3],[2538,3],[2620,3],[2726,3],[2883,3],[3038,3],[3183,3],[3327,3],[3454,3],[3636,3],[3760,3],[3885,1],[3887,1],[3889,3],[4002,1],[4004,2],[4110,1],[4165,1],[4167,2],[4262,2],[4278,1],[4345,1],[4347,2],[4416,2],[4461,2],[4562,1],[4567,1],[4572,1],[4581,1],[4583,3],[4670,1],[4672,2],[4767,1],[4803,1],[4832,2],[4943,2],[4995,1],[5020,3],[5024,1],[5026,3],[5097,1],[5099,2],[5177,1],[5233,1],[5235,2],[5310,1],[5436,1],[5491,1],[5493,2],[5530,1],[5563,1],[5592,1],[5642,1],[5661,1],[5678,1],[5690,2],[5706,1],[5713,1],[5724,2],[5740,1],[5742,2],[5867,1],[5869,2],[5942,1],[5966,1],[6092,1],[6094,2],[6143,1],[6183,1],[6224,1],[6280,1],[6298,1],[6424,1],[6473,1],[6475,1],[6477,1],[6502,1],[6566,1],[6576,1],[6610,1],[6629,1],[6758,2],[6775,1],[6823,2],[6866,2],[6923,2],[7083,2],[7188,2],[7243,1],[7248,1],[7257,2],[7292,2],[7448,2],[7554,2],[7752,2],[7896,1],[7901,1],[7925,2],[8036,1],[8038,1]]},"658":{"position":[[460,2],[553,1],[616,1],[654,1],[669,1],[671,2],[771,1],[853,1],[887,1],[981,1],[992,1],[1003,1],[1044,1],[1061,2],[1070,1],[1087,1],[1089,1],[1091,2],[1162,1],[1168,1],[1242,1],[1371,1],[1373,1],[1375,2],[1461,1],[1521,1],[1523,2],[1586,1],[1630,1]]},"659":{"position":[[376,1],[416,1],[444,1],[487,1],[519,1],[551,1],[646,1],[714,1],[777,1],[827,1],[891,1],[938,1],[1087,1],[1127,1],[1155,1],[1192,1],[1222,1],[1264,1],[1309,1],[1353,1],[1401,1]]},"660":{"position":[[361,1],[428,1],[492,1],[508,1]]},"661":{"position":[[166,2],[169,2],[234,1],[287,1],[352,1],[412,1],[491,1],[554,1],[611,1],[626,1],[685,1],[707,1],[808,1],[863,2],[921,1],[1076,1],[1182,2],[1185,1],[1227,2],[1304,1],[1313,1],[1315,2],[1417,1],[1424,1],[1433,1],[1435,1],[1472,1],[1474,2],[1543,1],[1572,1],[1601,2],[1666,1],[1709,2],[1788,1],[1831,2],[1892,2],[1975,1],[2030,1],[2040,2],[2115,1],[2117,2],[2182,1],[2229,1],[2254,1],[2262,3],[2266,1],[2268,2],[2357,2],[2421,2],[2490,1],[2518,1],[2520,1],[2549,1],[2551,2],[2594,1],[2634,1],[2655,1],[2680,1],[2709,2],[2812,1],[2861,1],[2863,2],[2914,1],[2931,1],[2995,1],[3031,1],[3054,1],[3071,1],[3106,1],[3135,2],[3238,1],[3250,1],[3264,1],[3486,1],[3488,2],[3550,2],[3582,2],[3633,2],[3683,2],[3731,2],[3873,1],[3887,1],[4004,1],[4054,1],[4100,1],[4117,1],[4145,1],[4266,1],[4456,1],[4517,1],[4528,1],[4610,1],[4618,1],[4632,2],[4641,1],[4655,2],[4658,2],[4661,1],[4709,1],[4784,1],[4856,1]]},"665":{"position":[[108,1],[150,1],[352,1]]},"666":{"position":[[36,1],[131,1],[144,1],[287,1],[325,1],[354,1],[394,1],[425,1],[463,1],[496,1],[540,1],[577,1],[579,1],[592,1],[663,1],[765,1],[815,3],[819,1],[821,1],[858,1],[941,1],[1494,1],[1560,1]]},"667":{"position":[[255,1],[257,3],[336,1],[349,1],[423,1],[526,1],[540,1],[659,1],[733,1],[745,1],[853,1],[896,3],[900,1],[965,1],[1010,1],[1095,1],[1153,1],[1155,1],[1168,1],[1170,3],[1270,1],[1290,1],[1364,1],[1412,1],[1535,1],[1595,3],[1599,1],[1698,1],[1714,1],[1774,1],[1824,1],[1844,1],[1960,1],[2023,3],[2027,1],[2029,1],[2066,1],[2126,1],[2163,1],[2185,1],[2212,1],[2217,1]]},"668":{"position":[[36,1],[141,1],[188,1],[226,1],[258,1],[309,1],[319,1],[339,1],[400,1],[512,1],[514,1],[516,1],[518,1],[548,1],[550,2],[618,1],[629,2],[804,2],[898,2],[994,1],[1068,1],[1070,3],[1074,1],[1104,1],[1106,2],[1152,1],[1163,2],[1214,1],[1250,1],[1283,1],[1344,2],[1463,2],[1466,2],[1562,2],[1656,1],[1706,1],[1708,3],[1712,1],[1742,1],[1744,2],[1790,1],[1801,2],[1871,1],[1904,1],[1933,1],[1948,2],[2040,1],[2087,1],[2110,1],[2153,1],[2237,1],[2273,1],[2359,2],[2437,2],[2594,1],[2635,1],[2637,3],[2641,2],[2790,2],[2930,2],[3054,1],[3113,1],[3115,3],[3177,1],[3243,1],[3245,3],[3249,2],[3313,1],[3348,1],[3350,2],[3396,1],[3407,2],[3480,1],[3555,1],[3596,2],[3739,2],[3742,1],[3744,1]]},"672":{"position":[[241,1],[308,1]]},"673":{"position":[[15,3],[60,3],[96,1],[191,1],[206,1],[315,1],[353,1],[373,1],[413,1],[435,1],[473,1],[497,1],[541,1],[569,1],[634,1],[667,1],[752,1],[791,1],[868,1],[910,1],[1013,1],[1067,1],[1141,1],[1180,1],[1224,1],[1251,1],[1317,1],[1361,1],[1432,1],[1525,1],[1527,1]]},"678":{"position":[[81,1],[123,1],[165,1],[333,1]]},"679":{"position":[[40,1],[85,1],[128,1],[182,1],[252,1],[289,3],[293,1],[295,1],[332,1],[360,1],[365,1],[410,1],[474,1]]},"680":{"position":[[40,1],[42,3],[104,1],[123,2],[163,1],[200,1],[202,1],[268,1],[337,1],[430,1],[487,3],[491,1],[535,1],[571,1],[657,1],[659,1],[661,1],[698,1],[709,1],[740,1],[767,1],[772,1]]},"681":{"position":[[34,1],[148,1],[167,1],[201,1],[219,1],[247,2],[329,1],[365,1],[393,1],[504,1],[541,1],[543,2],[546,1],[588,1],[620,1],[645,1],[836,1],[873,1],[875,2],[878,1],[927,1],[955,1],[980,1],[1130,2],[1133,1],[1135,1]]},"687":{"position":[[213,2],[386,2],[407,1],[455,1],[474,1],[517,1],[574,1],[616,1],[672,1],[713,1],[752,1],[789,1],[817,1],[842,1],[865,1],[891,1],[898,1],[923,1],[963,1],[971,2],[998,1],[1112,1],[1148,1],[1248,1],[1288,1],[1547,2],[1605,3],[1609,2],[1612,1],[1682,1],[1692,1],[1717,1],[1773,2],[1814,1],[1899,1],[1985,2],[2051,1],[2125,2],[2128,2],[2131,2],[2177,1],[2209,3],[2213,1],[2286,1],[2296,1],[2320,1],[2358,1],[2384,1],[2408,2],[2514,2],[2523,1],[2571,1],[2588,1],[2686,2],[2741,2],[2768,1],[2816,1],[2818,2],[2886,1],[2926,1],[2928,2],[3004,2],[3127,1],[3219,1],[3238,3],[3242,1],[3284,1],[3312,1],[3314,1],[4862,2],[4957,1],[4967,1],[5001,1],[5024,1],[5140,2],[5160,1],[5357,1],[5509,2],[5590,2],[5670,2],[5789,2],[5792,1],[6372,1],[6396,1],[6398,3],[6463,1],[6509,1],[6511,3],[6515,1]]},"688":{"position":[[86,1],[707,1],[729,1],[736,1],[760,1],[796,1],[841,1],[879,1],[944,1],[1001,1],[1003,2],[1125,1],[1135,1],[1159,1],[1185,1],[1220,1],[1343,1],[1388,2],[1524,1],[1566,1],[1594,1],[1596,1],[2256,3],[2295,1],[2297,3],[2317,1],[2337,1],[2344,1],[2386,1],[2388,3],[2422,1],[2458,1],[2460,3],[2523,1],[2525,2],[2579,1],[2642,2],[2824,1],[2894,1],[2896,2],[2933,3],[2937,2],[2997,1],[3084,2],[3101,3],[3105,1],[3190,1],[3200,1],[3224,1],[3263,1],[3279,2],[3348,1],[3383,1],[3385,3],[3389,2],[3450,2],[3497,2],[3545,1],[3611,1],[3626,2],[3649,1],[3698,1],[3785,1],[3787,1],[4628,2],[4757,2],[4782,1],[4792,1],[4826,1],[4849,1],[4965,2],[4981,1],[5054,1],[5326,1],[5454,2],[5658,2],[5713,1],[5820,1],[5881,1]]},"692":{"position":[[308,1],[325,1],[351,1],[360,1],[395,1],[418,1],[455,1],[478,1]]},"693":{"position":[[140,3],[166,1],[209,1],[238,1]]},"694":{"position":[[71,1],[112,1],[146,1],[185,1],[207,1],[253,1],[255,1],[290,1],[313,1],[357,1],[359,1],[361,1]]},"695":{"position":[[88,1],[118,1],[202,1],[233,3],[237,1],[269,1],[352,1],[383,3],[387,1],[389,1]]},"696":{"position":[[287,3],[312,3],[359,1],[421,1],[460,1],[494,1],[547,1],[577,1],[609,1],[639,1],[665,1],[697,1],[725,1],[765,1],[795,1],[797,1],[821,1],[913,1],[928,1],[965,1],[1144,2],[1184,1],[1186,1]]},"698":{"position":[[207,1],[223,1],[275,1],[397,1],[435,1],[437,3],[537,1],[578,1],[580,3],[670,1],[672,2],[710,1],[750,1],[809,1],[840,2],[907,1],[951,1],[953,2],[1083,1],[1138,1],[1164,3],[1168,1],[1170,3],[1264,1],[1266,2],[1294,1],[1296,3],[1406,1],[1408,2],[1436,1],[1438,3],[1511,1],[1513,2],[1541,1],[1543,1],[1545,3],[1637,1],[1653,1],[1674,1],[1699,1],[1703,1],[1705,3],[1758,1],[1799,1],[1801,3],[1860,1],[1901,1]]},"699":{"position":[[274,1],[330,1],[739,1],[775,1],[803,1],[842,1],[844,1],[851,1],[891,1],[899,1],[901,3],[905,1],[950,1],[952,1],[962,1],[992,1],[999,1],[1001,3],[1005,1],[1041,1],[1043,2],[1054,1],[1094,3],[1098,1],[1128,1],[1162,1],[1216,1],[1245,1],[1253,3],[1257,1],[1305,3],[1635,1],[1664,1],[1685,1],[1711,1],[1721,1],[1766,1],[1847,1],[1913,1],[1933,1],[1938,1],[1940,2],[1943,2],[2114,2],[2284,1],[2396,1],[2454,1],[2500,1],[2552,1],[2568,2],[2576,1],[2616,2],[2624,1],[2681,2],[2689,1],[2785,2],[2793,1],[2902,2],[2910,1],[3013,2],[3021,1],[3164,2],[3172,1],[3268,2],[3276,1],[3407,2],[3415,1],[3545,2],[3553,1],[3649,2],[3657,1]]},"704":{"position":[[243,1],[271,1],[305,1],[351,1],[378,1],[415,1],[445,1],[447,1]]},"706":{"position":[[147,2],[188,1],[230,2],[295,2],[359,2],[422,2],[642,1],[676,1],[705,1],[926,1],[964,2],[1021,1],[1050,1],[1063,1],[1065,2],[1190,1],[1226,1],[1274,1],[1311,1],[1357,1],[1393,1],[1395,2],[1506,1],[1543,1],[1545,1]]},"707":{"position":[[147,1],[173,1],[227,1],[270,2],[273,1]]},"708":{"position":[[99,1],[152,1],[185,1],[214,1],[297,1],[330,1],[332,2],[357,1],[364,2],[395,1],[437,1],[460,1],[462,1]]},"709":{"position":[[106,1],[159,1],[198,1],[248,1],[250,2],[326,2],[448,1],[500,1],[539,1],[585,1],[621,1],[623,1],[666,1],[727,1],[764,1],[823,1],[888,1],[951,1],[997,1],[1052,1],[1093,1],[1095,1],[1173,1],[1175,2],[1288,1],[1317,1],[1346,1],[1430,1],[1473,1],[1501,1],[1546,1],[1560,1],[1625,1],[1657,1],[1671,1],[1730,1],[1787,1],[1801,1],[1850,1],[1878,1],[1880,1]]},"710":{"position":[[96,1],[157,1],[191,1],[220,1],[248,1],[285,1],[316,1],[360,1],[387,1],[418,1],[455,1],[485,1],[524,1],[526,1],[1010,1],[1043,1],[1077,1],[1079,2],[1157,2],[1205,2],[1256,1],[1284,1],[1329,1],[1352,1],[1378,3],[1382,1],[1444,1],[1468,1],[1492,1],[1504,1],[1545,1],[1547,1],[1599,1],[1623,1],[1647,1],[1664,1],[1716,1],[1718,1],[1720,2],[1822,1],[1846,1],[1848,1]]},"712":{"position":[[139,1],[216,1],[287,2],[315,1],[419,1],[421,2],[458,1],[460,1]]},"713":{"position":[[67,1],[87,1],[122,1],[169,1],[195,1],[199,1],[201,1],[240,1],[244,1],[248,1]]},"714":{"position":[[72,1],[118,1],[158,1],[210,1],[278,1],[303,1],[320,1],[355,1],[389,1],[437,1],[462,1],[499,1],[525,1],[527,1]]},"716":{"position":[[122,1],[151,1],[182,1],[211,1],[250,1],[295,1],[297,1],[329,1],[331,1],[360,1],[373,1],[508,1],[564,1],[616,1],[618,1]]},"717":{"position":[[236,1]]},"718":{"position":[[76,1],[112,1],[151,2],[211,1],[236,1],[246,1],[279,1],[350,3],[373,1],[445,3],[475,4],[480,1],[482,1]]},"719":{"position":[[106,1],[128,1],[151,1],[156,1],[219,1],[265,1],[288,1],[341,1],[343,1],[408,1],[422,1],[483,1],[538,1],[540,1],[542,1]]},"720":{"position":[[515,1],[552,1],[580,1],[582,1],[613,1],[637,1],[662,1],[699,1],[727,1],[729,1],[760,1],[784,1],[809,1],[846,1],[874,1],[876,1],[907,1],[954,1],[979,1],[1016,1],[1031,1],[1033,1],[1064,1],[1111,1],[1136,1],[1173,1],[1188,1],[1190,1],[1221,1],[1269,1],[1294,1],[1331,1],[1346,1],[1348,1]]},"721":{"position":[[87,1],[151,1],[163,1],[187,1],[199,1],[203,1],[207,1],[227,1],[231,1],[238,1],[243,1],[247,1],[252,1],[257,1],[259,1],[271,2],[287,1],[291,1],[306,1],[310,1],[312,1],[377,1],[434,1],[450,1],[452,1],[485,1],[498,1],[505,1],[523,1],[565,1],[613,1],[654,1],[664,1],[690,1],[733,1],[766,1],[779,1],[834,1],[836,1],[871,1],[906,1],[939,1],[981,1],[995,1],[1038,1],[1060,1],[1109,1],[1224,1],[1226,1]]},"724":{"position":[[109,2],[187,1],[267,1],[277,1],[304,1],[503,1],[505,1],[552,1],[583,1],[624,1],[626,3],[708,1],[920,3],[924,1],[926,3],[1019,1],[1029,1],[1052,1],[1113,2],[1145,1],[1147,1]]},"725":{"position":[[103,1],[141,1],[172,1],[226,1],[269,1],[311,1],[331,1],[359,1],[372,1],[452,1],[472,1],[474,2],[529,1],[549,1],[551,2],[598,1],[600,1],[602,1],[604,1],[606,1],[685,1],[748,1],[759,1],[761,1]]}},"keywords":{}}],["0",{"_index":1387,"title":{},"content":{"73":{"position":[[203,1]]},"85":{"position":[[92,1],[519,2],[620,2]]},"157":{"position":[[507,1]]},"168":{"position":[[2014,1]]},"211":{"position":[[188,1],[226,1],[376,1],[536,1]]},"212":{"position":[[2596,2]]},"237":{"position":[[203,1]]},"254":{"position":[[92,1]]},"323":{"position":[[1639,1]]},"330":{"position":[[493,1]]},"348":{"position":[[2014,1]]},"390":{"position":[[188,1]]},"395":{"position":[[1938,2]]},"417":{"position":[[302,2]]},"419":{"position":[[424,2],[6717,2]]},"441":{"position":[[5409,2],[5494,2],[5604,2]]},"473":{"position":[[203,1]]},"485":{"position":[[92,1]]},"541":{"position":[[1639,1]]},"547":{"position":[[507,1]]},"564":{"position":[[2014,1]]},"599":{"position":[[186,2],[189,2],[192,4]]},"632":{"position":[[1938,2]]},"654":{"position":[[302,2]]},"656":{"position":[[424,2],[6717,2]]},"660":{"position":[[188,1]]},"688":{"position":[[5409,2],[5494,2],[5604,2]]},"707":{"position":[[186,2],[189,2],[192,4]]}},"keywords":{}}],["0..3",{"_index":3845,"title":{},"content":{"613":{"position":[[1033,4]]},"721":{"position":[[1033,4]]}},"keywords":{}}],["0..size",{"_index":2643,"title":{},"content":{"212":{"position":[[2107,7]]},"391":{"position":[[2107,7]]},"661":{"position":[[2107,7]]}},"keywords":{}}],["0.025ujunox",{"_index":1245,"title":{},"content":{"52":{"position":[[778,11]]}},"keywords":{}}],["0.2.0",{"_index":561,"title":{"19":{"position":[[5,5]]}},"content":{},"keywords":{}}],["0.8.0",{"_index":2793,"title":{},"content":{"264":{"position":[[5,5]]},"404":{"position":[[5,5]]},"641":{"position":[[5,5]]}},"keywords":{}}],["0.8.0prev",{"_index":2807,"title":{},"content":{"265":{"position":[[432,9]]},"266":{"position":[[115,9]]},"267":{"position":[[1262,9],[1499,9],[3289,9],[3826,9]]},"268":{"position":[[822,9],[2345,9],[2996,9]]},"269":{"position":[[89,9]]},"405":{"position":[[432,9]]},"406":{"position":[[115,9]]},"407":{"position":[[1262,9],[1499,9],[3289,9],[3826,9]]},"408":{"position":[[822,9],[2345,9],[2996,9]]},"409":{"position":[[89,9]]},"642":{"position":[[432,9]]},"643":{"position":[[115,9]]},"644":{"position":[[1262,9],[1499,9],[3289,9],[3826,9]]},"645":{"position":[[822,9],[2345,9],[2996,9]]},"646":{"position":[[89,9]]}},"keywords":{}}],["0.8.1",{"_index":1768,"title":{},"content":{"117":{"position":[[1182,5]]}},"keywords":{}}],["0.8.19",{"_index":1050,"title":{},"content":{"42":{"position":[[922,8]]}},"keywords":{}}],["0.9.0",{"_index":3088,"title":{},"content":{"382":{"position":[[5,5]]},"624":{"position":[[5,5]]}},"keywords":{}}],["0.9.00.8.0",{"_index":3091,"title":{},"content":{"383":{"position":[[304,10],[633,10],[1020,10]]},"625":{"position":[[304,10],[633,10],[1020,10]]}},"keywords":{}}],["0.9.0prev",{"_index":3094,"title":{},"content":{"384":{"position":[[89,9]]},"626":{"position":[[89,9]]}},"keywords":{}}],["0.into",{"_index":3850,"title":{},"content":{"613":{"position":[[1183,10]]},"721":{"position":[[1183,10]]}},"keywords":{}}],["001",{"_index":435,"title":{},"content":{"16":{"position":[[165,4]]}},"keywords":{}}],["01",{"_index":2990,"title":{},"content":{"323":{"position":[[340,2]]},"541":{"position":[[340,2]]}},"keywords":{}}],["0th",{"_index":1804,"title":{},"content":{"126":{"position":[[975,3]]},"198":{"position":[[3055,3],[3215,3]]},"277":{"position":[[975,3]]},"434":{"position":[[3037,3],[3197,3]]},"514":{"position":[[975,3]]},"681":{"position":[[3055,3],[3215,3]]}},"keywords":{}}],["0u8",{"_index":2212,"title":{},"content":{"185":{"position":[[292,5]]},"212":{"position":[[4101,5]]},"376":{"position":[[276,5]]},"391":{"position":[[4119,5]]},"592":{"position":[[276,5]]},"661":{"position":[[4119,5]]}},"keywords":{}}],["0x0..._0000_0000_0000",{"_index":2598,"title":{},"content":{"211":{"position":[[166,21],[204,21]]},"390":{"position":[[166,21]]},"660":{"position":[[166,21]]}},"keywords":{}}],["0x0..._0000_0000_0001",{"_index":2599,"title":{},"content":{"211":{"position":[[244,21]]},"390":{"position":[[204,21]]},"660":{"position":[[204,21]]}},"keywords":{}}],["0x0..._0000_0000_0010",{"_index":3096,"title":{},"content":{"390":{"position":[[244,21]]},"660":{"position":[[244,21]]}},"keywords":{}}],["0x0..._0000_0000_0011",{"_index":3097,"title":{},"content":{"390":{"position":[[288,21]]},"660":{"position":[[288,21]]}},"keywords":{}}],["0x0..._0000_0010_0000",{"_index":2600,"title":{},"content":{"211":{"position":[[288,21],[337,21]]}},"keywords":{}}],["0x0..._0000_0011_0001",{"_index":3098,"title":{},"content":{"390":{"position":[[324,21]]},"660":{"position":[[324,21]]}},"keywords":{}}],["0x0..._0000_0011_0010",{"_index":3099,"title":{},"content":{"390":{"position":[[391,21]]},"660":{"position":[[391,21]]}},"keywords":{}}],["0x0..._0010_0001_0000",{"_index":2602,"title":{},"content":{"211":{"position":[[404,21],[480,21]]}},"keywords":{}}],["0x0..._0011_0010_0001",{"_index":3100,"title":{},"content":{"390":{"position":[[454,21]]},"660":{"position":[[454,21]]}},"keywords":{}}],["0x0000",{"_index":1541,"title":{},"content":{"85":{"position":[[506,6]]}},"keywords":{}}],["0x0000_0000",{"_index":1542,"title":{},"content":{"85":{"position":[[530,11]]}},"keywords":{}}],["0x0000_0001",{"_index":1543,"title":{},"content":{"85":{"position":[[562,11]]}},"keywords":{}}],["0x0001",{"_index":1544,"title":{},"content":{"85":{"position":[[607,6]]},"254":{"position":[[506,6]]},"485":{"position":[[506,6]]}},"keywords":{}}],["0x0001_0000",{"_index":1545,"title":{},"content":{"85":{"position":[[631,11]]}},"keywords":{}}],["0x0001_0001",{"_index":1546,"title":{},"content":{"85":{"position":[[663,11]]},"254":{"position":[[530,11]]},"485":{"position":[[530,11]]}},"keywords":{}}],["0x0001_0001_1234_abcd",{"_index":1552,"title":{},"content":{"85":{"position":[[933,21]]},"254":{"position":[[933,21]]},"485":{"position":[[933,21]]}},"keywords":{}}],["0x0001_0010",{"_index":2781,"title":{},"content":{"254":{"position":[[562,11]]},"485":{"position":[[562,11]]}},"keywords":{}}],["0x0010",{"_index":2782,"title":{},"content":{"254":{"position":[[607,6]]},"485":{"position":[[607,6]]}},"keywords":{}}],["0x0010_0001",{"_index":2783,"title":{},"content":{"254":{"position":[[631,11]]},"485":{"position":[[631,11]]}},"keywords":{}}],["0x0010_0010",{"_index":2784,"title":{},"content":{"254":{"position":[[663,11]]},"485":{"position":[[663,11]]}},"keywords":{}}],["0x06",{"_index":3876,"title":{},"content":{"616":{"position":[[770,5]]},"724":{"position":[[770,5]]}},"keywords":{}}],["0x07",{"_index":3879,"title":{},"content":{"616":{"position":[[788,5]]},"724":{"position":[[788,5]]}},"keywords":{}}],["0x08",{"_index":3900,"title":{},"content":{"616":{"position":[[914,5]]},"724":{"position":[[914,5]]}},"keywords":{}}],["0x0b",{"_index":3873,"title":{},"content":{"616":{"position":[[752,5]]},"724":{"position":[[752,5]]}},"keywords":{}}],["0x10",{"_index":764,"title":{},"content":{"31":{"position":[[1424,4],[2292,4]]}},"keywords":{}}],["0x15",{"_index":3871,"title":{},"content":{"616":{"position":[[740,5]]},"724":{"position":[[740,5]]}},"keywords":{}}],["0x19",{"_index":3885,"title":{},"content":{"616":{"position":[[824,5]]},"724":{"position":[[824,5]]}},"keywords":{}}],["0x1e",{"_index":3887,"title":{},"content":{"616":{"position":[[836,5]]},"724":{"position":[[836,5]]}},"keywords":{}}],["0x22",{"_index":3881,"title":{},"content":{"616":{"position":[[800,5]]},"724":{"position":[[800,5]]}},"keywords":{}}],["0x42",{"_index":3883,"title":{},"content":{"616":{"position":[[812,5]]},"724":{"position":[[812,5]]}},"keywords":{}}],["0x45",{"_index":3889,"title":{},"content":{"616":{"position":[[848,5]]},"724":{"position":[[848,5]]}},"keywords":{}}],["0x4a",{"_index":3893,"title":{},"content":{"616":{"position":[[872,5]]},"724":{"position":[[872,5]]}},"keywords":{}}],["0x50",{"_index":3890,"title":{},"content":{"616":{"position":[[854,5]]},"724":{"position":[[854,5]]}},"keywords":{}}],["0x55",{"_index":3896,"title":{},"content":{"616":{"position":[[890,5]]},"724":{"position":[[890,5]]}},"keywords":{}}],["0x56",{"_index":3899,"title":{},"content":{"616":{"position":[[908,5]]},"724":{"position":[[908,5]]}},"keywords":{}}],["0x61",{"_index":3888,"title":{},"content":{"616":{"position":[[842,5]]},"724":{"position":[[842,5]]}},"keywords":{}}],["0x67",{"_index":3870,"title":{},"content":{"616":{"position":[[734,5]]},"724":{"position":[[734,5]]}},"keywords":{}}],["0x68",{"_index":3878,"title":{},"content":{"616":{"position":[[782,5]]},"724":{"position":[[782,5]]}},"keywords":{}}],["0x6b",{"_index":3886,"title":{},"content":{"616":{"position":[[830,5]]},"724":{"position":[[830,5]]}},"keywords":{}}],["0x70",{"_index":3892,"title":{},"content":{"616":{"position":[[866,5]]},"724":{"position":[[866,5]]}},"keywords":{}}],["0x81",{"_index":3884,"title":{},"content":{"616":{"position":[[818,5]]},"724":{"position":[[818,5]]}},"keywords":{}}],["0x84",{"_index":3882,"title":{},"content":{"616":{"position":[[806,5]]},"724":{"position":[[806,5]]}},"keywords":{}}],["0x86",{"_index":3869,"title":{},"content":{"616":{"position":[[728,5]]},"724":{"position":[[728,5]]}},"keywords":{}}],["0x89",{"_index":3880,"title":{},"content":{"616":{"position":[[794,5]]},"724":{"position":[[794,5]]}},"keywords":{}}],["0x96",{"_index":3874,"title":{},"content":{"616":{"position":[[758,5]]},"724":{"position":[[758,5]]}},"keywords":{}}],["0xa5",{"_index":3891,"title":{},"content":{"616":{"position":[[860,5]]},"724":{"position":[[860,5]]}},"keywords":{}}],["0xa7",{"_index":3895,"title":{},"content":{"616":{"position":[[884,5]]},"724":{"position":[[884,5]]}},"keywords":{}}],["0xb0",{"_index":3894,"title":{},"content":{"616":{"position":[[878,5]]},"724":{"position":[[878,5]]}},"keywords":{}}],["0xbb",{"_index":3872,"title":{},"content":{"616":{"position":[[746,5]]},"724":{"position":[[746,5]]}},"keywords":{}}],["0xbe",{"_index":3897,"title":{},"content":{"616":{"position":[[896,5]]},"724":{"position":[[896,5]]}},"keywords":{}}],["0xd7",{"_index":3898,"title":{},"content":{"616":{"position":[[902,5]]},"724":{"position":[[902,5]]}},"keywords":{}}],["0xe0",{"_index":3877,"title":{},"content":{"616":{"position":[[776,5]]},"724":{"position":[[776,5]]}},"keywords":{}}],["0xf0",{"_index":773,"title":{},"content":{"31":{"position":[[1685,4],[2316,4]]}},"keywords":{}}],["0xf1",{"_index":3875,"title":{},"content":{"616":{"position":[[764,5]]},"724":{"position":[[764,5]]}},"keywords":{}}],["1",{"_index":152,"title":{"260":{"position":[[0,2]]},"378":{"position":[[0,2]]},"400":{"position":[[0,2]]},"620":{"position":[[0,2]]},"637":{"position":[[0,2]]}},"content":{"3":{"position":[[497,1]]},"8":{"position":[[422,1],[458,1],[468,1]]},"17":{"position":[[1596,2],[4034,2]]},"30":{"position":[[341,2],[386,2]]},"39":{"position":[[2867,3]]},"51":{"position":[[811,2]]},"52":{"position":[[3344,1],[6512,1]]},"73":{"position":[[307,3],[430,3]]},"85":{"position":[[99,2],[552,1],[653,1]]},"131":{"position":[[460,1]]},"157":{"position":[[775,3]]},"163":{"position":[[929,3]]},"196":{"position":[[401,2]]},"197":{"position":[[712,2]]},"198":{"position":[[3131,1]]},"205":{"position":[[2237,2]]},"209":{"position":[[1232,3]]},"210":{"position":[[442,1],[1216,1]]},"211":{"position":[[266,1],[444,2],[520,2]]},"212":{"position":[[1505,2],[2909,2],[3043,2],[3567,2]]},"223":{"position":[[579,2],[1180,3]]},"237":{"position":[[307,3],[430,3]]},"254":{"position":[[99,2],[519,2],[620,2]]},"265":{"position":[[870,1]]},"311":{"position":[[512,1]]},"323":{"position":[[271,2],[1503,1]]},"330":{"position":[[751,3]]},"352":{"position":[[951,3]]},"354":{"position":[[631,2]]},"388":{"position":[[1164,3]]},"389":{"position":[[442,1],[1153,1]]},"390":{"position":[[226,1],[363,1],[510,1]]},"391":{"position":[[2596,2],[2657,2],[2933,2],[3073,2],[3585,2]]},"395":{"position":[[3550,1]]},"405":{"position":[[870,1]]},"417":{"position":[[505,2],[525,1],[1154,1]]},"419":{"position":[[474,2],[6920,2],[6940,1],[7569,1]]},"425":{"position":[[2187,2]]},"432":{"position":[[362,2]]},"433":{"position":[[711,2]]},"434":{"position":[[3113,1]]},"441":{"position":[[5549,2]]},"456":{"position":[[579,2],[1180,3]]},"473":{"position":[[307,3],[430,3]]},"476":{"position":[[1655,2]]},"477":{"position":[[2498,1],[3785,1],[3969,1]]},"485":{"position":[[99,2],[519,2],[620,2]]},"528":{"position":[[512,1]]},"541":{"position":[[271,2],[1503,1]]},"547":{"position":[[775,3]]},"568":{"position":[[951,3]]},"570":{"position":[[631,2]]},"598":{"position":[[784,3]]},"606":{"position":[[276,1],[299,3]]},"611":{"position":[[130,2]]},"613":{"position":[[209,2]]},"632":{"position":[[3550,1]]},"642":{"position":[[870,1]]},"654":{"position":[[505,2],[525,1],[1154,1]]},"656":{"position":[[474,2],[6920,2],[6940,1],[7569,1]]},"658":{"position":[[1164,3]]},"659":{"position":[[442,1],[1153,1]]},"660":{"position":[[226,1],[363,1],[510,1]]},"661":{"position":[[2596,2],[2657,2],[2933,2],[3073,2],[3585,2]]},"667":{"position":[[2187,2]]},"679":{"position":[[362,2]]},"680":{"position":[[711,2]]},"681":{"position":[[3131,1]]},"688":{"position":[[5549,2]]},"696":{"position":[[579,2],[1180,3]]},"698":{"position":[[1655,2]]},"699":{"position":[[2498,1],[3785,1],[3969,1]]},"706":{"position":[[784,3]]},"714":{"position":[[276,1],[299,3]]},"719":{"position":[[130,2]]},"721":{"position":[[209,2]]}},"keywords":{}}],["1"",{"_index":2620,"title":{},"content":{"212":{"position":[[371,8]]},"391":{"position":[[371,8]]},"661":{"position":[[371,8]]}},"keywords":{}}],["1.0.0",{"_index":3599,"title":{},"content":{"519":{"position":[[1182,5]]}},"keywords":{}}],["1.1",{"_index":2787,"title":{"261":{"position":[[0,4]]},"379":{"position":[[0,4]]},"401":{"position":[[0,4]]},"621":{"position":[[0,4]]},"638":{"position":[[0,4]]}},"content":{},"keywords":{}}],["1.1.0",{"_index":2959,"title":{},"content":{"298":{"position":[[1182,5]]}},"keywords":{}}],["1.2",{"_index":2789,"title":{"262":{"position":[[0,4]]},"380":{"position":[[0,4]]},"402":{"position":[[0,4]]},"622":{"position":[[0,4]]},"639":{"position":[[0,4]]}},"content":{},"keywords":{}}],["1.29",{"_index":1169,"title":{},"content":{"43":{"position":[[2066,4]]}},"keywords":{}}],["1.3",{"_index":1248,"title":{},"content":{"52":{"position":[[818,3]]}},"keywords":{}}],["1.36",{"_index":1170,"title":{},"content":{"43":{"position":[[2071,4]]}},"keywords":{}}],["1.77.0",{"_index":2986,"title":{},"content":{"323":{"position":[[309,6]]},"541":{"position":[[309,6]]}},"keywords":{}}],["1/secret_key.pem"",{"_index":3558,"title":{},"content":{"477":{"position":[[453,22]]},"699":{"position":[[453,22]]}},"keywords":{}}],["1/users/us",{"_index":3557,"title":{},"content":{"477":{"position":[[440,12]]},"699":{"position":[[440,12]]}},"keywords":{}}],["10",{"_index":803,"title":{},"content":{"31":{"position":[[3105,2]]},"205":{"position":[[2341,3]]},"206":{"position":[[228,3]]},"209":{"position":[[1384,4]]},"212":{"position":[[4840,2]]},"269":{"position":[[4132,3]]},"388":{"position":[[1316,4]]},"391":{"position":[[4858,2]]},"395":{"position":[[1334,2]]},"409":{"position":[[4132,3]]},"416":{"position":[[1971,2],[2051,2],[2310,2],[2465,2]]},"419":{"position":[[4489,2],[4564,2]]},"425":{"position":[[2291,3]]},"426":{"position":[[228,3]]},"601":{"position":[[1389,5],[1469,3]]},"632":{"position":[[1334,2]]},"646":{"position":[[4132,3]]},"653":{"position":[[1971,2],[2051,2],[2310,2],[2465,2]]},"656":{"position":[[4489,2],[4564,2]]},"658":{"position":[[1316,4]]},"661":{"position":[[4858,2]]},"667":{"position":[[2291,3]]},"668":{"position":[[228,3]]},"709":{"position":[[1389,5],[1469,3]]}},"keywords":{}}],["10.into",{"_index":3802,"title":{},"content":{"611":{"position":[[278,9]]},"719":{"position":[[278,9]]}},"keywords":{}}],["100",{"_index":3443,"title":{},"content":{"440":{"position":[[5135,4]]},"441":{"position":[[4960,4],[5497,5],[5607,5]]},"477":{"position":[[1637,4],[1951,3],[3403,3]]},"613":{"position":[[500,4]]},"687":{"position":[[5135,4]]},"688":{"position":[[4960,4],[5497,5],[5607,5]]},"699":{"position":[[1637,4],[1951,3],[3403,3]]},"721":{"position":[[500,4]]}},"keywords":{}}],["1000",{"_index":3112,"title":{},"content":{"394":{"position":[[135,4]]},"395":{"position":[[1477,6],[6649,4],[6682,4]]},"416":{"position":[[2056,6]]},"417":{"position":[[482,4],[835,6],[1488,6]]},"419":{"position":[[4574,6],[6897,4],[7250,6],[7903,6]]},"631":{"position":[[135,4]]},"632":{"position":[[1477,6],[6649,4],[6682,4]]},"653":{"position":[[2056,6]]},"654":{"position":[[482,4],[835,6],[1488,6]]},"656":{"position":[[4574,6],[6897,4],[7250,6],[7903,6]]}},"keywords":{}}],["100000000000",{"_index":2583,"title":{},"content":{"210":{"position":[[538,12]]},"389":{"position":[[538,12]]},"659":{"position":[[538,12]]}},"keywords":{}}],["100_000_000_000_000_000",{"_index":1630,"title":{},"content":{"95":{"position":[[342,26]]},"287":{"position":[[342,26]]},"499":{"position":[[342,26]]}},"keywords":{}}],["10]>",{"_index":3701,"title":{},"content":{"601":{"position":[[1247,8]]},"709":{"position":[[1247,8]]}},"keywords":{}}],["10_000",{"_index":2495,"title":{},"content":{"206":{"position":[[260,7]]},"269":{"position":[[4164,7]]},"409":{"position":[[4164,7]]},"426":{"position":[[260,7]]},"646":{"position":[[4164,7]]},"668":{"position":[[260,7]]}},"keywords":{}}],["10u8",{"_index":1816,"title":{},"content":{"126":{"position":[[1989,5]]},"277":{"position":[[2157,5]]},"514":{"position":[[1989,5]]}},"keywords":{}}],["11",{"_index":3135,"title":{},"content":{"395":{"position":[[1290,2]]},"417":{"position":[[830,2],[1483,2]]},"419":{"position":[[7245,2],[7898,2]]},"632":{"position":[[1290,2]]},"654":{"position":[[830,2],[1483,2]]},"656":{"position":[[7245,2],[7898,2]]}},"keywords":{}}],["11101:11101",{"_index":2574,"title":{},"content":{"210":{"position":[[133,11]]},"389":{"position":[[133,11]]},"477":{"position":[[142,11]]},"659":{"position":[[133,11]]},"699":{"position":[[142,11]]}},"keywords":{}}],["123",{"_index":2685,"title":{},"content":{"212":{"position":[[4609,4]]},"391":{"position":[[4627,4]]},"661":{"position":[[4627,4]]}},"keywords":{}}],["1234",{"_index":3789,"title":{},"content":{"609":{"position":[[230,5]]},"717":{"position":[[230,5]]}},"keywords":{}}],["130000000000",{"_index":1141,"title":{},"content":{"43":{"position":[[1077,12]]}},"keywords":{}}],["14101:14101",{"_index":2575,"title":{},"content":{"210":{"position":[[148,11]]},"389":{"position":[[148,11]]},"477":{"position":[[157,11]]},"659":{"position":[[148,11]]},"699":{"position":[[157,11]]}},"keywords":{}}],["143.87",{"_index":1167,"title":{},"content":{"43":{"position":[[2044,6]]}},"keywords":{}}],["15",{"_index":1851,"title":{},"content":{"127":{"position":[[368,3],[420,3],[772,2]]},"278":{"position":[[368,3],[420,3],[772,2]]},"395":{"position":[[4679,3],[4783,3],[5346,3],[5450,3],[5805,3],[5909,3],[6325,3],[6429,3]]},"477":{"position":[[2699,3],[3182,3],[3563,3]]},"515":{"position":[[368,3],[420,3],[772,2]]},"632":{"position":[[4679,3],[4783,3],[5346,3],[5450,3],[5805,3],[5909,3],[6325,3],[6429,3]]},"699":{"position":[[2699,3],[3182,3],[3563,3]]}},"keywords":{}}],["16).unwrap",{"_index":849,"title":{},"content":{"32":{"position":[[1657,12]]}},"keywords":{}}],["17",{"_index":263,"title":{},"content":{"9":{"position":[[151,3]]},"198":{"position":[[2238,2]]},"434":{"position":[[2228,2]]},"681":{"position":[[2238,2]]}},"keywords":{}}],["18",{"_index":1159,"title":{"412":{"position":[[4,2]]},"649":{"position":[[4,2]]}},"content":{"43":{"position":[[1843,2],[2030,2]]},"365":{"position":[[4,3],[34,2],[42,3],[167,2]]},"396":{"position":[[584,2]]},"416":{"position":[[448,2]]},"419":{"position":[[819,2]]},"581":{"position":[[4,3],[34,2],[42,3],[167,2]]},"633":{"position":[[584,2]]},"653":{"position":[[448,2]]},"656":{"position":[[819,2]]}},"keywords":{}}],["18101:18101",{"_index":2576,"title":{},"content":{"210":{"position":[[163,11]]},"389":{"position":[[163,11]]},"477":{"position":[[172,11]]},"659":{"position":[[163,11]]},"699":{"position":[[172,11]]}},"keywords":{}}],["19",{"_index":2412,"title":{},"content":{"198":{"position":[[3136,2]]},"434":{"position":[[3118,2]]},"681":{"position":[[3136,2]]}},"keywords":{}}],["1_000",{"_index":2703,"title":{},"content":{"219":{"position":[[348,6]]},"452":{"position":[[327,6]]},"692":{"position":[[327,6]]}},"keywords":{}}],["1_000.into",{"_index":2512,"title":{},"content":{"206":{"position":[[1285,13],[2275,13],[3557,13]]},"268":{"position":[[2531,13]]},"269":{"position":[[5195,13]]},"408":{"position":[[2531,13]]},"409":{"position":[[5195,13]]},"426":{"position":[[1280,13],[2265,13],[3532,13]]},"645":{"position":[[2531,13]]},"646":{"position":[[5195,13]]},"668":{"position":[[1285,13],[2275,13],[3557,13]]}},"keywords":{}}],["1_001",{"_index":2704,"title":{},"content":{"219":{"position":[[374,6]]},"452":{"position":[[353,6]]},"692":{"position":[[353,6]]}},"keywords":{}}],["1a8ba520e980c5abcbcfa6f62d68b6bb82e780544605de4dd5c6b1c5e966441b",{"_index":1282,"title":{},"content":{"52":{"position":[[3017,64]]}},"keywords":{}}],["2",{"_index":107,"title":{"263":{"position":[[0,2]]},"381":{"position":[[0,2]]},"403":{"position":[[0,2]]},"623":{"position":[[0,2]]},"640":{"position":[[0,2]]}},"content":{"2":{"position":[[302,1],[494,1],[558,1]]},"3":{"position":[[499,1]]},"11":{"position":[[158,1]]},"17":{"position":[[1624,2],[4065,2]]},"30":{"position":[[405,3]]},"32":{"position":[[834,1],[1729,2],[1753,1]]},"52":{"position":[[6487,1],[6661,1],[6713,2]]},"143":{"position":[[1216,3]]},"197":{"position":[[743,2]]},"205":{"position":[[2264,2]]},"211":{"position":[[310,2],[359,2],[426,3],[502,3]]},"212":{"position":[[2579,2],[2891,3],[3618,2]]},"254":{"position":[[552,1],[653,1]]},"328":{"position":[[1191,3]]},"354":{"position":[[622,2]]},"390":{"position":[[266,1],[430,1],[494,2]]},"391":{"position":[[1505,2],[2916,2],[3056,2],[3636,2]]},"419":{"position":[[523,2]]},"425":{"position":[[2214,2]]},"433":{"position":[[742,2]]},"476":{"position":[[1676,2]]},"485":{"position":[[552,1],[653,1]]},"537":{"position":[[1191,3]]},"570":{"position":[[622,2]]},"601":{"position":[[1365,2],[1416,2]]},"611":{"position":[[153,2]]},"613":{"position":[[205,1],[254,2],[1160,3]]},"656":{"position":[[523,2]]},"660":{"position":[[266,1],[430,1],[494,2]]},"661":{"position":[[1505,2],[2916,2],[3056,2],[3636,2]]},"667":{"position":[[2214,2]]},"680":{"position":[[742,2]]},"698":{"position":[[1676,2]]},"709":{"position":[[1365,2],[1416,2]]},"719":{"position":[[153,2]]},"721":{"position":[[205,1],[254,2],[1160,3]]}},"keywords":{}}],["2)"",{"_index":830,"title":{},"content":{"32":{"position":[[593,10]]}},"keywords":{}}],["2.1",{"_index":2792,"title":{"264":{"position":[[0,3]]},"382":{"position":[[0,3]]},"404":{"position":[[0,3]]},"624":{"position":[[0,3]]},"641":{"position":[[0,3]]}},"content":{},"keywords":{}}],["2.2",{"_index":2800,"title":{"265":{"position":[[0,4]]},"266":{"position":[[0,4]]},"383":{"position":[[0,3]]},"405":{"position":[[0,4]]},"406":{"position":[[0,4]]},"625":{"position":[[0,3]]},"642":{"position":[[0,4]]},"643":{"position":[[0,4]]}},"content":{},"keywords":{}}],["2.2.1",{"_index":3090,"title":{},"content":{"383":{"position":[[181,6]]},"625":{"position":[[181,6]]}},"keywords":{}}],["2.2.2",{"_index":3092,"title":{},"content":{"383":{"position":[[437,6]]},"625":{"position":[[437,6]]}},"keywords":{}}],["2.2.3",{"_index":3093,"title":{},"content":{"383":{"position":[[910,6]]},"625":{"position":[[910,6]]}},"keywords":{}}],["2.3",{"_index":2814,"title":{"267":{"position":[[0,4]]},"407":{"position":[[0,4]]},"644":{"position":[[0,4]]}},"content":{},"keywords":{}}],["2.3.1",{"_index":2816,"title":{},"content":{"267":{"position":[[236,6]]},"407":{"position":[[236,6]]},"644":{"position":[[236,6]]}},"keywords":{}}],["2.3.10",{"_index":2888,"title":{},"content":{"267":{"position":[[4005,7]]},"407":{"position":[[4005,7]]},"644":{"position":[[4005,7]]}},"keywords":{}}],["2.3.11",{"_index":2890,"title":{},"content":{"267":{"position":[[4147,7]]},"407":{"position":[[4147,7]]},"644":{"position":[[4147,7]]}},"keywords":{}}],["2.3.12",{"_index":2893,"title":{},"content":{"267":{"position":[[4291,7]]},"407":{"position":[[4291,7]]},"644":{"position":[[4291,7]]}},"keywords":{}}],["2.3.2",{"_index":2826,"title":{},"content":{"267":{"position":[[620,6]]},"407":{"position":[[620,6]]},"644":{"position":[[620,6]]}},"keywords":{}}],["2.3.3",{"_index":2831,"title":{},"content":{"267":{"position":[[781,6]]},"407":{"position":[[781,6]]},"644":{"position":[[781,6]]}},"keywords":{}}],["2.3.4",{"_index":2832,"title":{},"content":{"267":{"position":[[844,6]]},"407":{"position":[[844,6]]},"644":{"position":[[844,6]]}},"keywords":{}}],["2.3.5",{"_index":2834,"title":{},"content":{"267":{"position":[[1158,6]]},"407":{"position":[[1158,6]]},"644":{"position":[[1158,6]]}},"keywords":{}}],["2.3.6",{"_index":2843,"title":{},"content":{"267":{"position":[[1464,6]]},"407":{"position":[[1464,6]]},"644":{"position":[[1464,6]]}},"keywords":{}}],["2.3.7",{"_index":2844,"title":{},"content":{"267":{"position":[[1800,6]]},"407":{"position":[[1800,6]]},"644":{"position":[[1800,6]]}},"keywords":{}}],["2.3.8",{"_index":2878,"title":{},"content":{"267":{"position":[[3219,6]]},"407":{"position":[[3219,6]]},"644":{"position":[[3219,6]]}},"keywords":{}}],["2.3.9",{"_index":2882,"title":{},"content":{"267":{"position":[[3485,6]]},"407":{"position":[[3485,6]]},"644":{"position":[[3485,6]]}},"keywords":{}}],["2.4",{"_index":2896,"title":{"268":{"position":[[0,4]]},"408":{"position":[[0,4]]},"645":{"position":[[0,4]]}},"content":{},"keywords":{}}],["2.4.1",{"_index":2897,"title":{},"content":{"268":{"position":[[229,6]]},"408":{"position":[[229,6]]},"645":{"position":[[229,6]]}},"keywords":{}}],["2.4.2",{"_index":2908,"title":{},"content":{"268":{"position":[[1389,6]]},"408":{"position":[[1389,6]]},"645":{"position":[[1389,6]]}},"keywords":{}}],["2.4.3",{"_index":2920,"title":{},"content":{"268":{"position":[[2025,6]]},"408":{"position":[[2025,6]]},"645":{"position":[[2025,6]]}},"keywords":{}}],["2.4.4",{"_index":2924,"title":{},"content":{"268":{"position":[[2680,6]]},"408":{"position":[[2680,6]]},"645":{"position":[[2680,6]]}},"keywords":{}}],["2.into",{"_index":3852,"title":{},"content":{"613":{"position":[[1213,10]]},"721":{"position":[[1213,10]]}},"keywords":{}}],["20",{"_index":1627,"title":{"191":{"position":[[4,2]]},"420":{"position":[[4,2]]},"662":{"position":[[4,2]]}},"content":{"95":{"position":[[267,2]]},"198":{"position":[[3164,2]]},"204":{"position":[[1078,2]]},"207":{"position":[[77,2]]},"209":{"position":[[1434,4]]},"212":{"position":[[4768,2]]},"287":{"position":[[267,2]]},"388":{"position":[[1366,4]]},"391":{"position":[[4786,2]]},"424":{"position":[[1029,2]]},"427":{"position":[[77,2]]},"434":{"position":[[3146,2]]},"499":{"position":[[267,2]]},"658":{"position":[[1366,4]]},"661":{"position":[[4786,2]]},"666":{"position":[[1029,2]]},"669":{"position":[[77,2]]},"681":{"position":[[3164,2]]}},"keywords":{}}],["200",{"_index":3363,"title":{},"content":{"440":{"position":[[819,4]]},"687":{"position":[[819,4]]}},"keywords":{}}],["2000000000",{"_index":2592,"title":{},"content":{"210":{"position":[[1274,10]]},"389":{"position":[[1211,10]]},"659":{"position":[[1211,10]]}},"keywords":{}}],["201",{"_index":3365,"title":{},"content":{"440":{"position":[[844,4]]},"687":{"position":[[844,4]]}},"keywords":{}}],["202",{"_index":3367,"title":{},"content":{"440":{"position":[[867,4]]},"687":{"position":[[867,4]]}},"keywords":{}}],["2024",{"_index":2989,"title":{},"content":{"323":{"position":[[335,4]]},"541":{"position":[[335,4]]}},"keywords":{}}],["2025",{"_index":559,"title":{},"content":{"18":{"position":[[428,4]]}},"keywords":{}}],["203",{"_index":3369,"title":{},"content":{"440":{"position":[[893,4]]},"687":{"position":[[893,4]]}},"keywords":{}}],["204",{"_index":3496,"title":{},"content":{"441":{"position":[[2319,4]]},"688":{"position":[[2319,4]]}},"keywords":{}}],["205",{"_index":3497,"title":{},"content":{"441":{"position":[[2339,4]]},"688":{"position":[[2339,4]]}},"keywords":{}}],["20_000",{"_index":2200,"title":{},"content":{"184":{"position":[[1035,7]]},"375":{"position":[[932,7]]},"591":{"position":[[932,7]]}},"keywords":{}}],["20_001",{"_index":2202,"title":{},"content":{"184":{"position":[[1075,7]]},"375":{"position":[[972,7]]},"591":{"position":[[972,7]]}},"keywords":{}}],["20u64.pow(9",{"_index":3570,"title":{},"content":{"477":{"position":[[1687,13]]},"699":{"position":[[1687,13]]}},"keywords":{}}],["23",{"_index":264,"title":{},"content":{"9":{"position":[[168,3]]}},"keywords":{}}],["2324",{"_index":372,"title":{},"content":{"11":{"position":[[217,4]]}},"keywords":{}}],["25",{"_index":2409,"title":{},"content":{"198":{"position":[[2649,2]]},"434":{"position":[[2639,2]]},"681":{"position":[[2649,2]]}},"keywords":{}}],["25)"",{"_index":2991,"title":{},"content":{"323":{"position":[[343,10]]},"541":{"position":[[343,10]]}},"keywords":{}}],["256",{"_index":801,"title":{},"content":{"31":{"position":[[3044,3]]},"85":{"position":[[140,3]]},"254":{"position":[[140,3]]},"485":{"position":[[140,3]]}},"keywords":{}}],["26",{"_index":2333,"title":{},"content":{"196":{"position":[[800,2]]}},"keywords":{}}],["286",{"_index":1285,"title":{},"content":{"52":{"position":[[3340,3]]}},"keywords":{}}],["2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"",{"_index":1812,"title":{},"content":{"126":{"position":[[1713,71]]},"277":{"position":[[1881,71]]},"514":{"position":[[1713,71]]}},"keywords":{}}],["3",{"_index":118,"title":{"269":{"position":[[0,2]]},"384":{"position":[[0,2]]},"409":{"position":[[0,2]]},"626":{"position":[[0,2]]},"646":{"position":[[0,2]]}},"content":{"2":{"position":[[563,1]]},"32":{"position":[[1823,1]]},"131":{"position":[[521,1]]},"143":{"position":[[1220,3]]},"197":{"position":[[770,2]]},"212":{"position":[[3668,2]]},"265":{"position":[[931,1]]},"311":{"position":[[573,1]]},"328":{"position":[[1195,3]]},"354":{"position":[[613,2]]},"390":{"position":[[310,1],[346,2],[413,2],[476,3]]},"391":{"position":[[2579,2],[2897,4],[3686,2]]},"395":{"position":[[3611,1]]},"405":{"position":[[931,1]]},"419":{"position":[[553,2]]},"433":{"position":[[769,2]]},"476":{"position":[[1701,1]]},"528":{"position":[[573,1]]},"537":{"position":[[1195,3]]},"570":{"position":[[613,2]]},"601":{"position":[[1368,2],[1419,2]]},"632":{"position":[[3611,1]]},"642":{"position":[[931,1]]},"656":{"position":[[553,2]]},"660":{"position":[[310,1],[346,2],[413,2],[476,3]]},"661":{"position":[[2579,2],[2897,4],[3686,2]]},"680":{"position":[[769,2]]},"698":{"position":[[1701,1]]},"709":{"position":[[1368,2],[1419,2]]}},"keywords":{}}],["3.into",{"_index":3831,"title":{},"content":{"613":{"position":[[178,8]]},"721":{"position":[[178,8]]}},"keywords":{}}],["300",{"_index":3479,"title":{},"content":{"441":{"position":[[731,4]]},"688":{"position":[[731,4]]}},"keywords":{}}],["3000.into",{"_index":3284,"title":{},"content":{"417":{"position":[[1019,13]]},"419":{"position":[[7434,13]]},"654":{"position":[[1019,13]]},"656":{"position":[[7434,13]]}},"keywords":{}}],["300000000000",{"_index":1661,"title":{},"content":{"100":{"position":[[455,12]]},"101":{"position":[[309,12]]},"292":{"position":[[455,12]]},"293":{"position":[[309,12]]},"504":{"position":[[455,12]]},"505":{"position":[[309,12]]}},"keywords":{}}],["30_000",{"_index":2835,"title":{},"content":{"267":{"position":[[1353,7]]},"269":{"position":[[3716,7]]},"383":{"position":[[799,7]]},"384":{"position":[[3680,7]]},"407":{"position":[[1353,7]]},"409":{"position":[[3716,7]]},"625":{"position":[[799,7]]},"626":{"position":[[3680,7]]},"644":{"position":[[1353,7]]},"646":{"position":[[3716,7]]}},"keywords":{}}],["30_001",{"_index":2836,"title":{},"content":{"267":{"position":[[1385,7]]},"269":{"position":[[3748,7]]},"383":{"position":[[831,7]]},"384":{"position":[[3712,7]]},"407":{"position":[[1385,7]]},"409":{"position":[[3748,7]]},"625":{"position":[[831,7]]},"626":{"position":[[3712,7]]},"644":{"position":[[1385,7]]},"646":{"position":[[3748,7]]}},"keywords":{}}],["30_002",{"_index":2838,"title":{},"content":{"267":{"position":[[1406,7]]},"269":{"position":[[3769,7]]},"383":{"position":[[852,7]]},"384":{"position":[[3733,7]]},"407":{"position":[[1406,7]]},"409":{"position":[[3769,7]]},"625":{"position":[[852,7]]},"626":{"position":[[3733,7]]},"644":{"position":[[1406,7]]},"646":{"position":[[3769,7]]}},"keywords":{}}],["30_003",{"_index":2840,"title":{},"content":{"267":{"position":[[1429,7]]},"269":{"position":[[3792,7]]},"383":{"position":[[875,7]]},"384":{"position":[[3756,7]]},"407":{"position":[[1429,7]]},"409":{"position":[[3792,7]]},"625":{"position":[[875,7]]},"626":{"position":[[3756,7]]},"644":{"position":[[1429,7]]},"646":{"position":[[3792,7]]}},"keywords":{}}],["30_004",{"_index":2842,"title":{},"content":{"267":{"position":[[1454,6]]},"269":{"position":[[3817,6]]},"383":{"position":[[900,6]]},"384":{"position":[[3781,6]]},"407":{"position":[[1454,6]]},"409":{"position":[[3817,6]]},"625":{"position":[[900,6]]},"626":{"position":[[3781,6]]},"644":{"position":[[1454,6]]},"646":{"position":[[3817,6]]}},"keywords":{}}],["32",{"_index":2210,"title":{},"content":{"185":{"position":[[250,4],[298,4],[2509,2]]},"189":{"position":[[146,2]]},"212":{"position":[[4078,3],[4107,4]]},"366":{"position":[[146,2]]},"376":{"position":[[234,4],[282,4],[2493,2]]},"391":{"position":[[4096,3],[4125,4]]},"582":{"position":[[146,2]]},"592":{"position":[[234,4],[282,4],[2493,2]]},"599":{"position":[[265,4]]},"616":{"position":[[263,3],[1394,2]]},"661":{"position":[[4096,3],[4125,4]]},"707":{"position":[[265,4]]},"724":{"position":[[263,3],[1394,2]]}},"keywords":{}}],["321",{"_index":2686,"title":{},"content":{"212":{"position":[[4632,4]]},"391":{"position":[[4650,4]]},"661":{"position":[[4650,4]]}},"keywords":{}}],["32]>",{"_index":3867,"title":{},"content":{"616":{"position":[[574,8]]},"724":{"position":[[574,8]]}},"keywords":{}}],["32].fn",{"_index":2862,"title":{},"content":{"267":{"position":[[2646,6]]},"407":{"position":[[2646,6]]},"644":{"position":[[2646,6]]}},"keywords":{}}],["37",{"_index":804,"title":{},"content":{"31":{"position":[[3112,2]]}},"keywords":{}}],["38",{"_index":3516,"title":{},"content":{"441":{"position":[[3987,2]]},"688":{"position":[[3987,2]]}},"keywords":{}}],["3_000.into",{"_index":2528,"title":{},"content":{"206":{"position":[[2239,13]]},"426":{"position":[[2229,13]]},"668":{"position":[[2239,13]]}},"keywords":{}}],["4",{"_index":1857,"title":{"270":{"position":[[0,2]]},"385":{"position":[[0,2]]},"410":{"position":[[0,2]]},"627":{"position":[[0,2]]},"647":{"position":[[0,2]]}},"content":{"127":{"position":[[604,1]]},"211":{"position":[[322,2],[371,2],[439,2],[456,1],[515,2],[532,1]]},"212":{"position":[[1335,1],[2591,2],[2651,2],[2904,2],[2921,2],[3038,2],[3055,2],[3716,2]]},"278":{"position":[[604,1]]},"390":{"position":[[358,2],[425,2],[489,2],[506,1]]},"391":{"position":[[1335,1],[2591,2],[2652,2],[2911,2],[2928,2],[3051,2],[3068,2],[3734,2]]},"419":{"position":[[636,2]]},"515":{"position":[[604,1]]},"601":{"position":[[1371,2],[1422,2]]},"609":{"position":[[50,1]]},"656":{"position":[[636,2]]},"660":{"position":[[358,2],[425,2],[489,2],[506,1]]},"661":{"position":[[1335,1],[2591,2],[2652,2],[2911,2],[2928,2],[3051,2],[3068,2],[3734,2]]},"709":{"position":[[1371,2],[1422,2]]},"717":{"position":[[50,1]]}},"keywords":{}}],["4000",{"_index":1856,"title":{},"content":{"127":{"position":[[562,4]]},"278":{"position":[[562,4]]},"515":{"position":[[562,4]]}},"keywords":{}}],["4004",{"_index":1854,"title":{},"content":{"127":{"position":[[536,4]]},"278":{"position":[[536,4]]},"515":{"position":[[536,4]]}},"keywords":{}}],["456",{"_index":3680,"title":{},"content":{"600":{"position":[[359,4]]},"708":{"position":[[359,4]]}},"keywords":{}}],["48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26"",{"_index":3127,"title":{},"content":{"395":{"position":[[774,71]]},"632":{"position":[[774,71]]}},"keywords":{}}],["5",{"_index":1151,"title":{"271":{"position":[[0,2]]},"386":{"position":[[0,2]]},"411":{"position":[[0,2]]},"628":{"position":[[0,2]]},"648":{"position":[[0,2]]}},"content":{"43":{"position":[[1617,1]]},"141":{"position":[[1594,2]]},"143":{"position":[[1189,2]]},"326":{"position":[[1557,2]]},"328":{"position":[[1164,2]]},"535":{"position":[[1557,2]]},"537":{"position":[[1164,2]]},"601":{"position":[[1374,2],[1425,4]]},"709":{"position":[[1374,2],[1425,4]]}},"keywords":{}}],["50",{"_index":3528,"title":{},"content":{"441":{"position":[[5412,4],[5552,4]]},"688":{"position":[[5412,4],[5552,4]]}},"keywords":{}}],["5000000000000",{"_index":1650,"title":{},"content":{"99":{"position":[[361,13]]},"291":{"position":[[361,13]]},"503":{"position":[[361,13]]}},"keywords":{}}],["52",{"_index":805,"title":{},"content":{"31":{"position":[[3125,3]]}},"keywords":{}}],["52141844321b8321da71d073d4fa0865e73c3940153373ca7ef832d15bc3c2b2",{"_index":1295,"title":{},"content":{"52":{"position":[[6374,64]]},"53":{"position":[[117,64],[1005,64]]}},"keywords":{}}],["55",{"_index":2415,"title":{},"content":{"198":{"position":[[3429,2]]},"434":{"position":[[3411,2]]},"681":{"position":[[3429,2]]}},"keywords":{}}],["565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857",{"_index":3177,"title":{},"content":{"395":{"position":[[5117,64],[6893,65]]},"632":{"position":[[5117,64],[6893,65]]}},"keywords":{}}],["565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857"",{"_index":3176,"title":{},"content":{"395":{"position":[[5016,70],[5211,70],[5682,70],[6201,70]]},"632":{"position":[[5016,70],[5211,70],[5682,70],[6201,70]]}},"keywords":{}}],["5bd5d214e",{"_index":2988,"title":{},"content":{"323":{"position":[[324,10]]},"541":{"position":[[324,10]]}},"keywords":{}}],["6",{"_index":1303,"title":{},"content":{"53":{"position":[[241,1]]},"601":{"position":[[1377,2]]},"709":{"position":[[1377,2]]}},"keywords":{}}],["6"",{"_index":1240,"title":{},"content":{"52":{"position":[[680,7]]}},"keywords":{}}],["60",{"_index":3140,"title":{},"content":{"395":{"position":[[1472,2]]},"416":{"position":[[2046,2]]},"419":{"position":[[4569,2]]},"477":{"position":[[1930,2],[1935,2]]},"632":{"position":[[1472,2]]},"653":{"position":[[2046,2]]},"656":{"position":[[4569,2]]},"699":{"position":[[1930,2],[1935,2]]}},"keywords":{}}],["61047ff4000000000000000000000000000000000000000000000000000000000000000ai",{"_index":797,"title":{},"content":{"31":{"position":[[2910,74]]}},"keywords":{}}],["64",{"_index":1511,"title":{},"content":{"83":{"position":[[398,2]]},"85":{"position":[[1006,2]]},"252":{"position":[[398,2]]},"254":{"position":[[1006,2]]},"483":{"position":[[398,2]]},"485":{"position":[[1006,2]]}},"keywords":{}}],["660000",{"_index":3183,"title":{},"content":{"395":{"position":[[6162,6]]},"632":{"position":[[6162,6]]}},"keywords":{}}],["666",{"_index":2689,"title":{},"content":{"212":{"position":[[4693,3]]},"391":{"position":[[4711,3]]},"661":{"position":[[4711,3]]}},"keywords":{}}],["7",{"_index":833,"title":{},"content":{"32":{"position":[[830,1],[1749,1]]},"601":{"position":[[1380,2]]},"709":{"position":[[1380,2]]}},"keywords":{}}],["78",{"_index":3085,"title":{},"content":{"365":{"position":[[180,3],[210,2],[218,3],[348,2]]},"438":{"position":[[87,2]]},"439":{"position":[[123,2]]},"442":{"position":[[69,2]]},"581":{"position":[[180,3],[210,2],[218,3],[348,2]]},"685":{"position":[[87,2]]},"686":{"position":[[123,2]]},"689":{"position":[[69,2]]}},"keywords":{}}],["8",{"_index":799,"title":{},"content":{"31":{"position":[[3031,1]]},"143":{"position":[[610,3]]},"151":{"position":[[379,3]]},"211":{"position":[[779,1]]},"212":{"position":[[3789,1]]},"328":{"position":[[585,3]]},"342":{"position":[[379,3]]},"390":{"position":[[753,1]]},"391":{"position":[[3807,1]]},"537":{"position":[[585,3]]},"556":{"position":[[379,3]]},"601":{"position":[[1383,2]]},"660":{"position":[[753,1]]},"661":{"position":[[3807,1]]},"709":{"position":[[1383,2]]}},"keywords":{}}],["8dc53f95805349c3763cf4af9527cab2aebec77b240efd3801c61231d8748f26",{"_index":1290,"title":{},"content":{"52":{"position":[[4610,64]]}},"keywords":{}}],["9",{"_index":851,"title":{},"content":{"32":{"position":[[1757,1]]},"601":{"position":[[1386,2]]},"709":{"position":[[1386,2]]}},"keywords":{}}],["93.37",{"_index":1168,"title":{},"content":{"43":{"position":[[2051,5]]}},"keywords":{}}],["99",{"_index":3569,"title":{},"content":{"477":{"position":[[1666,3],[2126,2],[3907,2]]},"699":{"position":[[1666,3],[2126,2],[3907,2]]}},"keywords":{}}],["_",{"_index":2394,"title":{},"content":{"198":{"position":[[952,2]]},"212":{"position":[[2102,1],[4246,1]]},"391":{"position":[[2102,1],[4264,1]]},"434":{"position":[[942,2]]},"440":{"position":[[1797,3],[1801,2]]},"661":{"position":[[2102,1],[4264,1]]},"681":{"position":[[952,2]]},"687":{"position":[[1797,3],[1801,2]]}},"keywords":{}}],["__contract_main_purs",{"_index":1592,"title":{},"content":{"92":{"position":[[226,21]]},"94":{"position":[[682,22]]},"284":{"position":[[226,21]]},"286":{"position":[[682,22]]},"496":{"position":[[226,21]]},"498":{"position":[[682,22]]}},"keywords":{}}],["__event",{"_index":1579,"title":{},"content":{"91":{"position":[[342,8]]},"283":{"position":[[342,8]]},"495":{"position":[[342,8]]}},"keywords":{}}],["__events_schema",{"_index":1582,"title":{},"content":{"91":{"position":[[486,15],[661,15]]},"283":{"position":[[486,15],[661,15]]},"495":{"position":[[486,15],[661,15]]}},"keywords":{}}],["_contract_address",{"_index":1305,"title":{},"content":{"53":{"position":[[284,17],[585,17],[737,17]]}},"keywords":{}}],["_load(env",{"_index":1956,"title":{},"content":{"142":{"position":[[268,10]]},"327":{"position":[[268,10]]},"536":{"position":[[268,10]]}},"keywords":{}}],["_load_cep18(env",{"_index":3155,"title":{},"content":{"395":{"position":[[2219,16]]},"632":{"position":[[2219,16]]}},"keywords":{}}],["_max_int",{"_index":3651,"title":{},"content":{"598":{"position":[[1041,8]]},"706":{"position":[[1041,8]]}},"keywords":{}}],["_min_int",{"_index":3650,"title":{},"content":{"598":{"position":[[1012,8]]},"706":{"position":[[1012,8]]}},"keywords":{}}],["_mint(account",{"_index":1125,"title":{},"content":{"43":{"position":[[444,14]]}},"keywords":{}}],["_update(address",{"_index":1126,"title":{},"content":{"43":{"position":[[479,15]]}},"keywords":{}}],["a.checked_mul(b).expect("integ",{"_index":255,"title":{},"content":{"8":{"position":[[589,37]]}},"keywords":{}}],["abi",{"_index":1939,"title":{},"content":{"141":{"position":[[888,4],[1034,3]]},"326":{"position":[[888,4],[1034,3]]},"535":{"position":[[888,4],[1034,3]]}},"keywords":{}}],["abi.encodewithsignature("transfer(address,uint256)"",{"_index":3788,"title":{},"content":{"609":{"position":[[158,62]]},"717":{"position":[[158,62]]}},"keywords":{}}],["abil",{"_index":2720,"title":{},"content":{"222":{"position":[[25,7]]},"455":{"position":[[25,7]]},"695":{"position":[[25,7]]}},"keywords":{}}],["abov",{"_index":652,"title":{},"content":{"22":{"position":[[559,5]]},"99":{"position":[[85,5]]},"115":{"position":[[1597,5]]},"119":{"position":[[376,6]]},"126":{"position":[[3409,5]]},"127":{"position":[[11,5],[619,5]]},"136":{"position":[[205,5]]},"141":{"position":[[480,6]]},"145":{"position":[[175,5]]},"146":{"position":[[794,6]]},"147":{"position":[[1276,5]]},"148":{"position":[[515,5]]},"162":{"position":[[2048,6]]},"163":{"position":[[483,6]]},"164":{"position":[[1134,5]]},"168":{"position":[[1117,6]]},"197":{"position":[[780,5],[1109,5]]},"258":{"position":[[1543,5]]},"277":{"position":[[3577,5]]},"278":{"position":[[11,5],[619,5]]},"291":{"position":[[85,5]]},"300":{"position":[[376,6]]},"316":{"position":[[205,5]]},"326":{"position":[[480,6]]},"333":{"position":[[175,5]]},"334":{"position":[[798,6]]},"335":{"position":[[1284,5]]},"336":{"position":[[515,5]]},"348":{"position":[[1117,6]]},"351":{"position":[[2070,6]]},"352":{"position":[[505,6]]},"353":{"position":[[1169,5]]},"433":{"position":[[779,5],[1108,5]]},"481":{"position":[[1543,5]]},"503":{"position":[[85,5]]},"514":{"position":[[3409,5]]},"515":{"position":[[11,5],[619,5]]},"521":{"position":[[376,6]]},"533":{"position":[[205,5]]},"535":{"position":[[480,6]]},"550":{"position":[[175,5]]},"551":{"position":[[798,6]]},"552":{"position":[[1284,5]]},"553":{"position":[[515,5]]},"564":{"position":[[1117,6]]},"567":{"position":[[2070,6]]},"568":{"position":[[505,6]]},"569":{"position":[[1169,5]]},"606":{"position":[[722,6]]},"613":{"position":[[1359,6]]},"680":{"position":[[779,5],[1108,5]]},"714":{"position":[[722,6]]},"721":{"position":[[1359,6]]}},"keywords":{}}],["absenc",{"_index":1604,"title":{},"content":{"92":{"position":[[930,8]]},"284":{"position":[[930,8]]},"496":{"position":[[930,8]]}},"keywords":{}}],["abstract",{"_index":651,"title":{},"content":{"22":{"position":[[515,11]]},"42":{"position":[[1665,13]]},"93":{"position":[[111,11]]},"285":{"position":[[111,11]]},"497":{"position":[[111,11]]}},"keywords":{}}],["accept",{"_index":1404,"title":{},"content":{"74":{"position":[[15,6]]},"148":{"position":[[719,6]]},"238":{"position":[[15,6]]},"336":{"position":[[719,6]]},"395":{"position":[[4271,6]]},"474":{"position":[[15,6]]},"553":{"position":[[719,6]]},"602":{"position":[[127,9]]},"632":{"position":[[4271,6]]},"710":{"position":[[127,9]]}},"keywords":{}}],["accept_ownership",{"_index":2301,"title":{},"content":{"189":{"position":[[683,18]]},"366":{"position":[[683,18]]},"582":{"position":[[683,18]]}},"keywords":{}}],["access",{"_index":434,"title":{"181":{"position":[[0,6]]},"189":{"position":[[0,7]]},"366":{"position":[[0,7]]},"372":{"position":[[0,6]]},"582":{"position":[[0,7]]},"588":{"position":[[0,6]]}},"content":{"16":{"position":[[127,6]]},"79":{"position":[[1258,9],[1294,9]]},"103":{"position":[[663,6]]},"162":{"position":[[1394,6]]},"163":{"position":[[33,6]]},"182":{"position":[[65,6],[364,6]]},"183":{"position":[[0,6],[29,6]]},"184":{"position":[[790,6]]},"185":{"position":[[4002,7]]},"189":{"position":[[68,6],[271,6],[317,6]]},"204":{"position":[[1376,10]]},"230":{"position":[[1275,9],[1311,9]]},"267":{"position":[[1889,6]]},"295":{"position":[[663,6]]},"324":{"position":[[1194,6]]},"351":{"position":[[1416,6]]},"352":{"position":[[33,6]]},"366":{"position":[[68,6],[271,6],[317,6]]},"373":{"position":[[65,6],[364,6]]},"374":{"position":[[0,6],[29,6]]},"375":{"position":[[709,6]]},"376":{"position":[[3986,7]]},"407":{"position":[[1889,6]]},"419":{"position":[[1760,6],[1819,6]]},"424":{"position":[[1326,10]]},"438":{"position":[[250,6]]},"461":{"position":[[1275,9],[1311,9]]},"507":{"position":[[663,6]]},"542":{"position":[[1194,6]]},"567":{"position":[[1416,6]]},"568":{"position":[[33,6]]},"582":{"position":[[68,6],[271,6],[317,6]]},"589":{"position":[[65,6],[364,6]]},"590":{"position":[[0,6],[29,6]]},"591":{"position":[[709,6]]},"592":{"position":[[3986,7]]},"600":{"position":[[622,10],[1148,8]]},"603":{"position":[[110,9]]},"607":{"position":[[63,10]]},"609":{"position":[[293,6]]},"644":{"position":[[1889,6]]},"656":{"position":[[1760,6],[1819,6]]},"666":{"position":[[1326,10]]},"685":{"position":[[250,6]]},"708":{"position":[[622,10],[1148,8]]},"711":{"position":[[110,9]]},"715":{"position":[[63,10]]},"717":{"position":[[293,6]]}},"keywords":{}}],["access_control.r",{"_index":2176,"title":{},"content":{"183":{"position":[[44,17]]},"185":{"position":[[95,17]]},"374":{"position":[[44,17]]},"376":{"position":[[95,17]]},"590":{"position":[[44,17]]},"592":{"position":[[95,17]]}},"keywords":{}}],["accesscontrol",{"_index":2213,"title":{},"content":{"185":{"position":[[385,13],[507,13],[1454,13]]},"189":{"position":[[0,14]]},"366":{"position":[[0,14]]},"376":{"position":[[369,13],[491,13],[1438,13]]},"582":{"position":[[0,14]]},"592":{"position":[[369,13],[491,13],[1438,13]]}},"keywords":{}}],["accident",{"_index":1797,"title":{},"content":{"126":{"position":[[552,12]]},"277":{"position":[[552,12]]},"514":{"position":[[552,12]]}},"keywords":{}}],["accordingli",{"_index":1774,"title":{},"content":{"118":{"position":[[255,12]]},"299":{"position":[[255,12]]},"520":{"position":[[255,12]]}},"keywords":{}}],["account",{"_index":174,"title":{},"content":{"5":{"position":[[124,7]]},"42":{"position":[[2080,8]]},"43":{"position":[[400,8]]},"92":{"position":[[300,7],[423,7],[472,7],[573,7]]},"95":{"position":[[281,9],[296,7]]},"100":{"position":[[940,7]]},"101":{"position":[[661,7]]},"102":{"position":[[411,8]]},"126":{"position":[[217,7],[460,7],[939,9],[979,8]]},"129":{"position":[[130,9]]},"168":{"position":[[1728,7]]},"189":{"position":[[354,8],[387,7]]},"190":{"position":[[98,8]]},"194":{"position":[[247,8]]},"198":{"position":[[2117,7],[3059,8],[3095,8],[3219,8],[3416,8],[3449,7]]},"219":{"position":[[446,8],[530,8]]},"222":{"position":[[204,8],[354,8]]},"277":{"position":[[217,7],[460,7],[939,9],[979,8]]},"280":{"position":[[130,9]]},"284":{"position":[[300,7],[423,7],[472,7],[573,7]]},"287":{"position":[[281,9],[296,7]]},"292":{"position":[[940,7]]},"293":{"position":[[661,7]]},"294":{"position":[[411,8]]},"346":{"position":[[104,9]]},"348":{"position":[[1728,7]]},"366":{"position":[[354,8],[387,7]]},"367":{"position":[[98,8]]},"393":{"position":[[196,7],[291,7],[406,7]]},"394":{"position":[[275,7],[344,7],[500,7]]},"395":{"position":[[3706,7]]},"396":{"position":[[975,8],[1028,7],[1102,7]]},"397":{"position":[[349,8]]},"416":{"position":[[1451,8],[2126,7],[4368,9]]},"417":{"position":[[497,7],[1146,7]]},"419":{"position":[[3970,8],[5948,9],[6912,7],[7561,7]]},"430":{"position":[[247,8]]},"434":{"position":[[2107,7],[3041,8],[3077,8],[3201,8],[3398,8],[3431,7]]},"452":{"position":[[401,8],[461,8]]},"455":{"position":[[204,8],[354,8]]},"476":{"position":[[1333,8]]},"496":{"position":[[300,7],[423,7],[472,7],[573,7]]},"499":{"position":[[281,9],[296,7]]},"504":{"position":[[940,7]]},"505":{"position":[[661,7]]},"506":{"position":[[411,8]]},"514":{"position":[[217,7],[460,7],[939,9],[979,8]]},"517":{"position":[[130,9]]},"564":{"position":[[1728,7]]},"582":{"position":[[354,8],[387,7]]},"583":{"position":[[98,8]]},"598":{"position":[[1805,7]]},"607":{"position":[[208,7]]},"630":{"position":[[196,7],[291,7],[406,7]]},"631":{"position":[[275,7],[344,7],[500,7]]},"632":{"position":[[3706,7]]},"633":{"position":[[975,8],[1028,7],[1102,7]]},"634":{"position":[[349,8]]},"653":{"position":[[1451,8],[2126,7],[4368,9]]},"654":{"position":[[497,7],[1146,7]]},"656":{"position":[[3970,8],[5948,9],[6912,7],[7561,7]]},"677":{"position":[[247,8]]},"681":{"position":[[2117,7],[3059,8],[3095,8],[3219,8],[3416,8],[3449,7]]},"692":{"position":[[401,8],[461,8]]},"695":{"position":[[204,8],[354,8]]},"698":{"position":[[1333,8]]},"706":{"position":[[1805,7]]},"715":{"position":[[208,7]]}},"keywords":{}}],["account'",{"_index":1674,"title":{},"content":{"100":{"position":[[1136,9]]},"103":{"position":[[673,9]]},"292":{"position":[[1136,9]]},"295":{"position":[[673,9]]},"504":{"position":[[1136,9]]},"507":{"position":[[673,9]]}},"keywords":{}}],["accountfn",{"_index":2141,"title":{},"content":{"168":{"position":[[2019,9]]},"348":{"position":[[2019,9]]},"564":{"position":[[2019,9]]}},"keywords":{}}],["accounthash([0u8",{"_index":3672,"title":{},"content":{"599":{"position":[[247,17]]},"707":{"position":[[247,17]]}},"keywords":{}}],["accountid",{"_index":1055,"title":{},"content":{"42":{"position":[[1061,9],[1143,10]]}},"keywords":{}}],["accounts.l33",{"_index":2413,"title":{},"content":{"198":{"position":[[3167,12]]},"434":{"position":[[3149,12]]},"681":{"position":[[3167,12]]}},"keywords":{}}],["accur",{"_index":403,"title":{},"content":{"15":{"position":[[126,8]]}},"keywords":{}}],["achiev",{"_index":613,"title":{},"content":{"20":{"position":[[956,9]]},"612":{"position":[[1889,8]]},"720":{"position":[[1889,8]]}},"keywords":{}}],["act",{"_index":3473,"title":{},"content":{"441":{"position":[[372,3]]},"688":{"position":[[372,3]]}},"keywords":{}}],["action",{"_index":1165,"title":{"222":{"position":[[0,8]]},"455":{"position":[[0,8]]},"695":{"position":[[0,8]]}},"content":{"43":{"position":[[2019,6]]},"53":{"position":[[408,6],[681,6],[1173,6]]},"126":{"position":[[2135,7],[2191,6]]},"168":{"position":[[1625,6]]},"182":{"position":[[326,6]]},"184":{"position":[[16,7],[170,8],[705,8],[1163,6]]},"277":{"position":[[2303,7],[2359,6]]},"348":{"position":[[1625,6]]},"373":{"position":[[326,6]]},"375":{"position":[[16,7],[170,8],[624,8],[1060,6]]},"416":{"position":[[3483,6],[4304,6]]},"417":{"position":[[1774,7]]},"418":{"position":[[24,7]]},"419":{"position":[[5062,6],[5884,6]]},"514":{"position":[[2135,7],[2191,6]]},"564":{"position":[[1625,6]]},"589":{"position":[[326,6]]},"591":{"position":[[16,7],[170,8],[624,8],[1060,6]]},"598":{"position":[[2160,7]]},"600":{"position":[[1065,7]]},"606":{"position":[[658,7]]},"653":{"position":[[3483,6],[4304,6]]},"654":{"position":[[1774,7]]},"655":{"position":[[24,7]]},"656":{"position":[[5062,6],[5884,6]]},"706":{"position":[[2160,7]]},"708":{"position":[[1065,7]]},"714":{"position":[[658,7]]}},"keywords":{}}],["activ",{"_index":3593,"title":{},"content":{"477":{"position":[[4139,9]]},"699":{"position":[[4139,9]]}},"keywords":{}}],["actor.th",{"_index":2204,"title":{},"content":{"184":{"position":[[1202,9]]},"375":{"position":[[1099,9]]},"591":{"position":[[1099,9]]}},"keywords":{}}],["actual",{"_index":1540,"title":{},"content":{"85":{"position":[[447,6]]},"211":{"position":[[543,6]]},"254":{"position":[[447,6]]},"390":{"position":[[517,6]]},"485":{"position":[[447,6]]},"660":{"position":[[517,6]]}},"keywords":{}}],["ad",{"_index":1841,"title":{"154":{"position":[[0,6]]},"339":{"position":[[0,6]]},"559":{"position":[[0,6]]}},"content":{"126":{"position":[[3474,5]]},"131":{"position":[[646,5]]},"132":{"position":[[331,5]]},"197":{"position":[[1052,6]]},"265":{"position":[[195,5]]},"277":{"position":[[3642,5]]},"311":{"position":[[698,5]]},"312":{"position":[[331,5]]},"405":{"position":[[195,5]]},"419":{"position":[[1941,5],[2018,5]]},"433":{"position":[[1051,6]]},"441":{"position":[[4262,5],[4404,6]]},"514":{"position":[[3474,5]]},"528":{"position":[[698,5]]},"529":{"position":[[331,5]]},"613":{"position":[[1688,6]]},"642":{"position":[[195,5]]},"656":{"position":[[1941,5],[2018,5]]},"680":{"position":[[1051,6]]},"688":{"position":[[4262,5],[4404,6]]},"721":{"position":[[1688,6]]}},"keywords":{}}],["add",{"_index":762,"title":{"264":{"position":[[4,3]]},"404":{"position":[[4,3]]},"641":{"position":[[4,3]]}},"content":{"31":{"position":[[1397,3],[1672,3]]},"42":{"position":[[268,3],[1683,4]]},"93":{"position":[[97,4]]},"102":{"position":[[272,4]]},"115":{"position":[[1663,4]]},"118":{"position":[[174,3]]},"126":{"position":[[170,3]]},"141":{"position":[[1164,5],[1184,4]]},"143":{"position":[[909,5]]},"154":{"position":[[55,3],[110,3]]},"173":{"position":[[372,3],[404,3]]},"179":{"position":[[70,3]]},"196":{"position":[[651,3]]},"222":{"position":[[17,3]]},"258":{"position":[[1609,4]]},"264":{"position":[[193,3]]},"268":{"position":[[2878,4]]},"277":{"position":[[170,3]]},"285":{"position":[[97,4]]},"294":{"position":[[272,4]]},"299":{"position":[[174,3]]},"326":{"position":[[1164,5],[1184,4]]},"328":{"position":[[884,5]]},"339":{"position":[[55,3],[110,3]]},"354":{"position":[[156,3]]},"359":{"position":[[372,3],[404,3]]},"370":{"position":[[70,3]]},"382":{"position":[[11,4]]},"395":{"position":[[2438,3],[3623,3]]},"404":{"position":[[193,3]]},"408":{"position":[[2878,4]]},"416":{"position":[[319,3],[1317,3],[2992,3]]},"419":{"position":[[4946,3]]},"432":{"position":[[588,3]]},"455":{"position":[[17,3]]},"481":{"position":[[1609,4]]},"497":{"position":[[97,4]]},"506":{"position":[[272,4]]},"514":{"position":[[170,3]]},"520":{"position":[[174,3]]},"535":{"position":[[1164,5],[1184,4]]},"537":{"position":[[884,5]]},"559":{"position":[[55,3],[110,3]]},"570":{"position":[[156,3]]},"575":{"position":[[372,3],[404,3]]},"586":{"position":[[70,3]]},"624":{"position":[[11,4]]},"632":{"position":[[2438,3],[3623,3]]},"641":{"position":[[193,3]]},"645":{"position":[[2878,4]]},"653":{"position":[[319,3],[1317,3],[2992,3]]},"656":{"position":[[4946,3]]},"679":{"position":[[588,3]]},"695":{"position":[[17,3]]}},"keywords":{}}],["add(&self",{"_index":1945,"title":{},"content":{"141":{"position":[[1260,14]]},"326":{"position":[[1260,14]]},"535":{"position":[[1260,14]]}},"keywords":{}}],["add(i",{"_index":3754,"title":{},"content":{"605":{"position":[[210,6]]},"713":{"position":[[210,6]]}},"keywords":{}}],["add(uint256",{"_index":691,"title":{},"content":{"30":{"position":[[198,11]]}},"keywords":{}}],["add_to_x(&self",{"_index":3751,"title":{},"content":{"605":{"position":[[131,19]]},"713":{"position":[[131,19]]}},"keywords":{}}],["adder",{"_index":1944,"title":{},"content":{"141":{"position":[[1249,5]]},"143":{"position":[[1107,5]]},"326":{"position":[[1249,5]]},"328":{"position":[[1082,5]]},"535":{"position":[[1249,5]]},"537":{"position":[[1082,5]]}},"keywords":{}}],["addercontractref",{"_index":1948,"title":{},"content":{"141":{"position":[[1348,16]]},"326":{"position":[[1348,16]]},"535":{"position":[[1348,16]]}},"keywords":{}}],["addercontractref::new(self.env",{"_index":1951,"title":{},"content":{"141":{"position":[[1544,33]]},"326":{"position":[[1507,33]]},"535":{"position":[[1507,33]]}},"keywords":{}}],["adderhostref",{"_index":1949,"title":{},"content":{"141":{"position":[[1377,12]]},"326":{"position":[[1377,12]]},"535":{"position":[[1377,12]]}},"keywords":{}}],["adderhostref::new(&test_env",{"_index":1979,"title":{},"content":{"143":{"position":[[1115,32]]},"328":{"position":[[1090,32]]},"537":{"position":[[1090,32]]}},"keywords":{}}],["addit",{"_index":688,"title":{},"content":{"30":{"position":[[96,8]]},"51":{"position":[[1896,10]]},"126":{"position":[[928,10]]},"164":{"position":[[391,10]]},"168":{"position":[[19,10]]},"205":{"position":[[199,10]]},"277":{"position":[[928,10]]},"348":{"position":[[19,10]]},"353":{"position":[[426,10]]},"416":{"position":[[270,10]]},"425":{"position":[[199,10]]},"514":{"position":[[928,10]]},"564":{"position":[[19,10]]},"569":{"position":[[426,10]]},"599":{"position":[[410,8]]},"653":{"position":[[270,10]]},"667":{"position":[[199,10]]},"707":{"position":[[410,8]]}},"keywords":{}}],["addition",{"_index":1060,"title":{},"content":{"42":{"position":[[1303,13]]},"84":{"position":[[65,13]]},"85":{"position":[[680,13]]},"98":{"position":[[479,13]]},"99":{"position":[[102,13]]},"188":{"position":[[203,12],[599,12]]},"253":{"position":[[65,13]]},"254":{"position":[[680,13]]},"270":{"position":[[257,13]]},"290":{"position":[[479,13]]},"291":{"position":[[102,13]]},"365":{"position":[[560,12],[956,12]]},"385":{"position":[[257,13]]},"396":{"position":[[742,13]]},"410":{"position":[[257,13]]},"484":{"position":[[65,13]]},"485":{"position":[[680,13]]},"502":{"position":[[479,13]]},"503":{"position":[[102,13]]},"581":{"position":[[560,12],[956,12]]},"598":{"position":[[2055,13]]},"627":{"position":[[257,13]]},"633":{"position":[[742,13]]},"647":{"position":[[257,13]]},"706":{"position":[[2055,13]]}},"keywords":{}}],["addition_work",{"_index":811,"title":{},"content":{"31":{"position":[[3428,16]]}},"keywords":{}}],["additon",{"_index":3269,"title":{},"content":{"416":{"position":[[4716,12]]},"653":{"position":[[4716,12]]}},"keywords":{}}],["addr",{"_index":3686,"title":{},"content":{"601":{"position":[[222,5],[476,5],[570,5],[788,5],[916,5],[1028,5]]},"616":{"position":[[237,5]]},"709":{"position":[[222,5],[476,5],[570,5],[788,5],[916,5],[1028,5]]},"724":{"position":[[237,5]]}},"keywords":{}}],["addr).some_funct",{"_index":3912,"title":{},"content":{"617":{"position":[[416,22]]},"725":{"position":[[416,22]]}},"keywords":{}}],["address",{"_index":458,"title":{},"content":{"17":{"position":[[288,8],[574,9],[676,8],[1117,8],[1429,8],[1449,8],[2172,9],[2622,8],[2722,8],[3122,8],[3135,8],[3732,8],[3877,8],[3895,8]]},"31":{"position":[[1429,8]]},"39":{"position":[[1816,7]]},"42":{"position":[[130,7],[1053,7],[2100,7]]},"43":{"position":[[290,7],[501,7],[945,7]]},"51":{"position":[[978,8],[1250,7]]},"52":{"position":[[940,7],[1372,7],[1424,7],[1464,11],[1598,8],[1641,11],[4737,7],[4867,7],[6562,7]]},"71":{"position":[[109,7],[546,8]]},"80":{"position":[[590,8],[599,8],[792,8]]},"84":{"position":[[416,7]]},"94":{"position":[[145,8],[340,8],[469,8]]},"99":{"position":[[243,7]]},"100":{"position":[[337,7]]},"101":{"position":[[191,7]]},"107":{"position":[[160,8]]},"108":{"position":[[261,8]]},"110":{"position":[[571,10]]},"115":{"position":[[120,8],[622,8],[689,8],[709,8],[772,8],[988,8],[1044,8],[1062,8],[1137,8],[1196,9],[1237,8],[1246,8],[1932,8],[2520,8],[2580,8],[2655,8],[2720,8],[2740,9],[2837,8],[2846,8]]},"126":{"position":[[84,8],[671,7],[1561,9],[1584,9],[2561,8],[2657,7],[2757,7],[2943,9]]},"141":{"position":[[452,8],[461,9],[672,7],[1463,8]]},"142":{"position":[[318,7],[415,7],[511,8]]},"143":{"position":[[842,8],[1277,7]]},"151":{"position":[[25,10]]},"160":{"position":[[54,8]]},"168":{"position":[[1338,7],[1587,8],[1596,8],[1665,8],[1903,7],[1929,7]]},"184":{"position":[[356,8],[365,8],[386,7],[480,8],[489,8],[510,7],[747,9]]},"185":{"position":[[210,8],[426,9],[567,8],[642,10],[884,8],[1016,9],[1079,8],[1212,9],[1277,8],[1305,7],[1435,9],[1516,8],[1565,8],[1960,8],[2009,8],[2048,10],[2115,8],[2124,9],[2231,8],[2279,8],[2318,10],[2386,8],[2395,9],[2868,8],[3291,8]]},"196":{"position":[[114,8],[529,7]]},"197":{"position":[[81,8],[527,7],[1001,8]]},"198":{"position":[[139,8],[1385,9],[1782,7],[2100,7],[2915,7]]},"203":{"position":[[333,9]]},"204":{"position":[[646,8]]},"205":{"position":[[956,8],[2128,8],[2150,8]]},"210":{"position":[[385,7],[1159,7]]},"219":{"position":[[196,7],[455,7],[539,7]]},"231":{"position":[[590,8],[599,8],[792,8]]},"235":{"position":[[109,7],[546,8]]},"247":{"position":[[600,8],[1216,7],[1390,8]]},"253":{"position":[[416,7]]},"258":{"position":[[120,8],[608,8],[671,8],[691,8],[750,8],[946,8],[998,8],[1016,8],[1087,8],[1142,9],[1183,8],[1192,8],[1878,8],[2462,8],[2518,8],[2589,8],[2650,8],[2670,9],[2763,8],[2772,8]]},"267":{"position":[[1136,9],[2963,8],[3109,8],[3118,8],[3783,8]]},"269":{"position":[[230,8],[501,9],[1953,8],[2180,8],[3334,8],[3567,8],[3589,8]]},"274":{"position":[[160,8]]},"275":{"position":[[265,8]]},"277":{"position":[[84,8],[671,7],[1729,9],[1752,9],[2729,8],[2825,7],[2925,7],[3111,9]]},"286":{"position":[[145,8],[340,8],[469,8]]},"291":{"position":[[243,7]]},"292":{"position":[[337,7]]},"293":{"position":[[191,7]]},"305":{"position":[[571,10]]},"321":{"position":[[1162,8],[1758,8]]},"326":{"position":[[452,8],[461,9],[672,7],[1463,8]]},"327":{"position":[[318,7],[415,7],[511,8]]},"328":{"position":[[817,8],[1252,7]]},"342":{"position":[[25,10]]},"345":{"position":[[54,8]]},"348":{"position":[[1338,7],[1587,8],[1596,8],[1665,8],[1903,7],[1929,7]]},"375":{"position":[[323,8],[332,8],[353,7],[423,8],[432,8],[453,7],[666,9]]},"376":{"position":[[410,9],[551,8],[626,10],[868,8],[1000,9],[1063,8],[1196,9],[1261,8],[1289,7],[1419,9],[1500,8],[1549,8],[1944,8],[1993,8],[2032,10],[2099,8],[2108,9],[2215,8],[2263,8],[2302,10],[2370,8],[2379,9],[2852,8],[3275,8]]},"384":{"position":[[227,8],[514,9],[1973,8],[2200,8],[3375,9],[3553,8],[3575,8]]},"389":{"position":[[385,7],[1096,7]]},"395":{"position":[[736,10],[990,8],[2278,7],[2316,7],[2390,8],[3847,7],[4350,8],[5103,8],[6786,7]]},"396":{"position":[[99,7],[732,8]]},"407":{"position":[[1136,9],[2963,8],[3109,8],[3118,8],[3783,8]]},"409":{"position":[[230,8],[501,9],[1953,8],[2180,8],[3334,8],[3567,8],[3589,8]]},"416":{"position":[[836,8],[934,7],[1460,8],[2111,7]]},"419":{"position":[[106,8],[248,8],[1478,7],[2657,8],[2691,8],[3687,8],[3812,8],[3979,8]]},"423":{"position":[[333,9]]},"424":{"position":[[621,8]]},"425":{"position":[[931,8],[2079,8],[2101,8]]},"432":{"position":[[76,8],[466,7]]},"433":{"position":[[81,8],[527,7],[1000,8]]},"434":{"position":[[139,8],[1375,9],[1772,7],[2090,7]]},"440":{"position":[[169,8],[743,8],[6343,8],[6364,7]]},"441":{"position":[[641,8],[935,8],[1713,7],[1786,7],[1913,8],[2514,8],[2672,7],[3168,8],[3591,8],[3690,7],[4375,8]]},"446":{"position":[[600,8],[1216,7],[1390,8]]},"452":{"position":[[196,7],[410,7],[470,7]]},"462":{"position":[[590,8],[599,8],[792,8]]},"471":{"position":[[109,7],[546,8]]},"476":{"position":[[161,8],[702,7],[1140,8],[1372,8],[1764,8],[1773,8],[1866,8],[1875,8]]},"481":{"position":[[120,8],[608,8],[671,8],[691,8],[750,8],[946,8],[998,8],[1016,8],[1087,8],[1142,9],[1183,8],[1192,8],[1878,8],[2462,8],[2518,8],[2589,8],[2650,8],[2670,9],[2763,8],[2772,8]]},"484":{"position":[[416,7]]},"491":{"position":[[160,8]]},"492":{"position":[[265,8]]},"498":{"position":[[145,8],[340,8],[469,8]]},"503":{"position":[[243,7]]},"504":{"position":[[337,7]]},"505":{"position":[[191,7]]},"510":{"position":[[571,10]]},"514":{"position":[[84,8],[671,7],[1561,9],[1584,9],[2561,8],[2657,7],[2757,7],[2943,9]]},"535":{"position":[[452,8],[461,9],[672,7],[1463,8]]},"536":{"position":[[318,7],[415,7],[511,8]]},"537":{"position":[[817,8],[1252,7]]},"539":{"position":[[1162,8],[1758,8]]},"556":{"position":[[25,10]]},"562":{"position":[[54,8]]},"564":{"position":[[1338,7],[1587,8],[1596,8],[1665,8],[1903,7],[1929,7]]},"591":{"position":[[323,8],[332,8],[353,7],[423,8],[432,8],[453,7],[666,9]]},"592":{"position":[[410,9],[551,8],[626,10],[868,8],[1000,9],[1063,8],[1196,9],[1261,8],[1289,7],[1419,9],[1500,8],[1549,8],[1944,8],[1993,8],[2032,10],[2099,8],[2108,9],[2215,8],[2263,8],[2302,10],[2370,8],[2379,9],[2852,8],[3275,8]]},"598":{"position":[[117,8],[464,8],[1417,7],[1498,7],[1763,7],[1826,10],[1885,7]]},"599":{"position":[[68,9],[219,7]]},"601":{"position":[[44,8],[228,8],[482,8],[576,8],[794,8],[922,8],[1034,8]]},"608":{"position":[[56,8],[541,8]]},"609":{"position":[[221,8]]},"610":{"position":[[36,9],[86,8]]},"616":{"position":[[79,8],[243,8]]},"617":{"position":[[40,8],[217,8]]},"626":{"position":[[227,8],[514,9],[1973,8],[2200,8],[3375,9],[3553,8],[3575,8]]},"632":{"position":[[736,10],[990,8],[2278,7],[2316,7],[2390,8],[3847,7],[4350,8],[5103,8],[6786,7]]},"633":{"position":[[99,7],[732,8]]},"644":{"position":[[1136,9],[2963,8],[3109,8],[3118,8],[3783,8]]},"646":{"position":[[230,8],[501,9],[1953,8],[2180,8],[3334,8],[3567,8],[3589,8]]},"653":{"position":[[836,8],[934,7],[1460,8],[2111,7]]},"656":{"position":[[106,8],[248,8],[1478,7],[2657,8],[2691,8],[3687,8],[3812,8],[3979,8]]},"659":{"position":[[385,7],[1096,7]]},"665":{"position":[[333,9]]},"666":{"position":[[621,8]]},"667":{"position":[[931,8],[2079,8],[2101,8]]},"673":{"position":[[600,8],[1216,7],[1390,8]]},"679":{"position":[[76,8],[466,7]]},"680":{"position":[[81,8],[527,7],[1000,8]]},"681":{"position":[[139,8],[1385,9],[1782,7],[2100,7],[2915,7]]},"687":{"position":[[169,8],[743,8],[6343,8],[6364,7]]},"688":{"position":[[641,8],[935,8],[1713,7],[1786,7],[1913,8],[2514,8],[2672,7],[3168,8],[3591,8],[3690,7],[4375,8]]},"692":{"position":[[196,7],[410,7],[470,7]]},"698":{"position":[[161,8],[702,7],[1140,8],[1372,8],[1764,8],[1773,8],[1866,8],[1875,8]]},"706":{"position":[[117,8],[464,8],[1417,7],[1498,7],[1763,7],[1826,10],[1885,7]]},"707":{"position":[[68,9],[219,7]]},"709":{"position":[[44,8],[228,8],[482,8],[576,8],[794,8],[922,8],[1034,8]]},"716":{"position":[[56,8],[541,8]]},"717":{"position":[[221,8]]},"718":{"position":[[36,9],[86,8]]},"724":{"position":[[79,8],[243,8]]},"725":{"position":[[40,8],[217,8]]}},"keywords":{}}],["address).add(3",{"_index":1952,"title":{},"content":{"141":{"position":[[1578,15]]},"326":{"position":[[1541,15]]},"535":{"position":[[1541,15]]}},"keywords":{}}],["address,advanc",{"_index":2432,"title":{},"content":{"201":{"position":[[136,16]]},"421":{"position":[[136,16]]},"663":{"position":[[136,16]]}},"keywords":{}}],["address.execut",{"_index":1273,"title":{},"content":{"52":{"position":[[2056,15]]}},"keywords":{}}],["address.l22",{"_index":3513,"title":{},"content":{"441":{"position":[[3829,11]]},"688":{"position":[[3829,11]]}},"keywords":{}}],["address.role_admin",{"_index":2253,"title":{},"content":{"185":{"position":[[2723,18]]},"376":{"position":[[2707,18]]},"592":{"position":[[2707,18]]}},"keywords":{}}],["address::account",{"_index":3671,"title":{},"content":{"599":{"position":[[229,17]]},"707":{"position":[[229,17]]}},"keywords":{}}],["address::from_str",{"_index":3646,"title":{},"content":{"598":{"position":[[824,18]]},"706":{"position":[[824,18]]}},"keywords":{}}],["address::from_str(address).unwrap",{"_index":1829,"title":{},"content":{"126":{"position":[[2767,36]]},"142":{"position":[[425,36]]},"277":{"position":[[2935,36]]},"327":{"position":[[425,36]]},"395":{"position":[[2326,36]]},"514":{"position":[[2767,36]]},"536":{"position":[[425,36]]},"632":{"position":[[2326,36]]}},"keywords":{}}],["address::from_str(recipient).unwrap",{"_index":1813,"title":{},"content":{"126":{"position":[[1801,38]]},"277":{"position":[[1969,38]]},"395":{"position":[[862,38]]},"514":{"position":[[1801,38]]},"632":{"position":[[862,38]]}},"keywords":{}}],["addressable>(&self",{"_index":3072,"title":{},"content":{"348":{"position":[[2077,26]]}},"keywords":{}}],["addresses.each",{"_index":2167,"title":{},"content":{"182":{"position":[[156,14]]},"373":{"position":[[156,14]]},"589":{"position":[[156,14]]}},"keywords":{}}],["addressfn",{"_index":2134,"title":{},"content":{"168":{"position":[[1762,9]]},"348":{"position":[[1762,9]]},"564":{"position":[[1762,9]]}},"keywords":{}}],["adjust",{"_index":1247,"title":{},"content":{"52":{"position":[[807,10]]},"188":{"position":[[117,8],[511,8]]},"270":{"position":[[507,12]]},"365":{"position":[[474,8],[868,8]]},"385":{"position":[[507,12]]},"410":{"position":[[507,12]]},"441":{"position":[[2144,6]]},"581":{"position":[[474,8],[868,8]]},"627":{"position":[[507,12]]},"647":{"position":[[507,12]]},"688":{"position":[[2144,6]]}},"keywords":{}}],["admin",{"_index":1264,"title":{},"content":{"52":{"position":[[1356,5]]},"182":{"position":[[201,5],[220,5]]},"184":{"position":[[102,5],[865,5],[940,5]]},"185":{"position":[[796,5],[2772,5],[3839,5]]},"373":{"position":[[201,5],[220,5]]},"375":{"position":[[102,5],[784,5],[859,5]]},"376":{"position":[[780,5],[2756,5],[3823,5]]},"419":{"position":[[1492,6],[1716,5],[1870,5],[1966,6],[1993,6],[2027,5],[2123,5],[2160,5]]},"589":{"position":[[201,5],[220,5]]},"591":{"position":[[102,5],[784,5],[859,5]]},"592":{"position":[[780,5],[2756,5],[3823,5]]},"656":{"position":[[1492,6],[1716,5],[1870,5],[1966,6],[1993,6],[2027,5],[2123,5],[2160,5]]}},"keywords":{}}],["admin_list",{"_index":3305,"title":{},"content":{"419":{"position":[[2216,11]]},"656":{"position":[[2216,11]]}},"keywords":{}}],["admin_rol",{"_index":2223,"title":{},"content":{"185":{"position":[[722,10],[783,10],[1673,11],[1777,13],[1882,11]]},"376":{"position":[[706,10],[767,10],[1657,11],[1761,13],[1866,11]]},"592":{"position":[[706,10],[767,10],[1657,11],[1761,13],[1866,11]]}},"keywords":{}}],["advanc",{"_index":1409,"title":{"75":{"position":[[0,8]]},"77":{"position":[[0,8]]},"79":{"position":[[0,8]]},"226":{"position":[[0,8]]},"228":{"position":[[0,8]]},"230":{"position":[[0,8]]},"457":{"position":[[0,8]]},"459":{"position":[[0,8]]},"461":{"position":[[0,8]]}},"content":{"76":{"position":[[25,8]]},"79":{"position":[[291,8]]},"81":{"position":[[0,8]]},"168":{"position":[[1974,8]]},"201":{"position":[[78,8]]},"227":{"position":[[25,8]]},"230":{"position":[[308,8]]},"232":{"position":[[0,8]]},"348":{"position":[[1974,8]]},"395":{"position":[[1264,7]]},"421":{"position":[[78,8]]},"458":{"position":[[25,8]]},"461":{"position":[[308,8]]},"463":{"position":[[0,8]]},"564":{"position":[[1974,8]]},"618":{"position":[[354,8],[480,8]]},"632":{"position":[[1264,7]]},"663":{"position":[[78,8]]},"726":{"position":[[354,8],[480,8]]}},"keywords":{}}],["advance_block_tim",{"_index":3182,"title":{},"content":{"395":{"position":[[6122,18]]},"632":{"position":[[6122,18]]}},"keywords":{}}],["advance_block_time(&self",{"_index":2135,"title":{},"content":{"168":{"position":[[1772,29]]},"348":{"position":[[1772,29]]},"564":{"position":[[1772,29]]}},"keywords":{}}],["advancedstorag",{"_index":1478,"title":{"80":{"position":[[0,15]]},"231":{"position":[[0,15]]},"462":{"position":[[0,15]]}},"content":{"80":{"position":[[37,15],[240,15],[343,15]]},"231":{"position":[[37,15],[240,15],[343,15]]},"462":{"position":[[37,15],[240,15],[343,15]]}},"keywords":{}}],["advantag",{"_index":1174,"title":{},"content":{"44":{"position":[[115,9]]},"141":{"position":[[1060,9]]},"246":{"position":[[380,9]]},"326":{"position":[[1060,9]]},"445":{"position":[[380,9]]},"535":{"position":[[1060,9]]},"672":{"position":[[380,9]]}},"keywords":{}}],["afraid",{"_index":59,"title":{},"content":{"1":{"position":[[788,6]]}},"keywords":{}}],["ag",{"_index":2114,"title":{},"content":{"165":{"position":[[268,4]]},"354":{"position":[[306,4]]},"383":{"position":[[392,4]]},"570":{"position":[[306,4]]},"625":{"position":[[392,4]]}},"keywords":{}}],["again",{"_index":1344,"title":{},"content":{"67":{"position":[[81,6]]}},"keywords":{}}],["again.check",{"_index":3436,"title":{},"content":{"440":{"position":[[4749,11]]},"687":{"position":[[4749,11]]}},"keywords":{}}],["against",{"_index":1095,"title":{},"content":{"42":{"position":[[2578,7],[2653,7]]},"68":{"position":[[72,7]]},"96":{"position":[[66,7]]},"106":{"position":[[118,7]]},"119":{"position":[[117,7],[250,7],[516,7],[751,7]]},"175":{"position":[[386,7]]},"199":{"position":[[48,7]]},"242":{"position":[[81,7]]},"243":{"position":[[72,7]]},"273":{"position":[[118,7]]},"288":{"position":[[66,7]]},"300":{"position":[[117,7],[250,7],[516,7],[751,7]]},"361":{"position":[[386,7]]},"417":{"position":[[1370,7]]},"419":{"position":[[7785,7]]},"435":{"position":[[48,7]]},"467":{"position":[[81,7]]},"468":{"position":[[72,7]]},"490":{"position":[[118,7]]},"500":{"position":[[66,7]]},"521":{"position":[[117,7],[250,7],[516,7],[751,7]]},"577":{"position":[[386,7]]},"654":{"position":[[1370,7]]},"656":{"position":[[7785,7]]},"682":{"position":[[48,7]]}},"keywords":{}}],["agnost",{"_index":886,"title":{},"content":{"38":{"position":[[896,9]]}},"keywords":{}}],["ago",{"_index":564,"title":{},"content":{"20":{"position":[[17,3]]}},"keywords":{}}],["agre",{"_index":3247,"title":{},"content":{"416":{"position":[[3417,6]]},"653":{"position":[[3417,6]]}},"keywords":{}}],["ahead",{"_index":201,"title":{},"content":{"6":{"position":[[101,5]]},"23":{"position":[[285,5]]},"54":{"position":[[183,5]]}},"keywords":{}}],["ai",{"_index":398,"title":{"17":{"position":[[9,3]]}},"content":{"15":{"position":[[27,2]]},"17":{"position":[[20,2]]},"18":{"position":[[0,2],[161,2]]}},"keywords":{}}],["aim",{"_index":1522,"title":{},"content":{"84":{"position":[[82,5]]},"253":{"position":[[82,5]]},"484":{"position":[[82,5]]}},"keywords":{}}],["algorithm",{"_index":940,"title":{},"content":{"39":{"position":[[1157,9]]},"212":{"position":[[3539,9]]},"391":{"position":[[3557,9]]},"616":{"position":[[1328,10]]},"661":{"position":[[3557,9]]},"724":{"position":[[1328,10]]}},"keywords":{}}],["alia",{"_index":2247,"title":{},"content":{"185":{"position":[[2497,5]]},"198":{"position":[[3709,5]]},"376":{"position":[[2481,5]]},"434":{"position":[[3691,5]]},"440":{"position":[[3551,5]]},"592":{"position":[[2481,5]]},"681":{"position":[[3709,5]]},"687":{"position":[[3551,5]]}},"keywords":{}}],["alias",{"_index":2827,"title":{},"content":{"267":{"position":[[637,7]]},"407":{"position":[[637,7]]},"644":{"position":[[637,7]]}},"keywords":{}}],["alic",{"_index":3065,"title":{},"content":{"346":{"position":[[190,7]]}},"keywords":{}}],["alik",{"_index":1231,"title":{},"content":{"52":{"position":[[332,6]]}},"keywords":{}}],["alloc",{"_index":820,"title":{"87":{"position":[[7,10]]},"88":{"position":[[18,10]]},"249":{"position":[[7,10]]},"250":{"position":[[18,10]]},"487":{"position":[[7,10]]},"488":{"position":[[18,10]]}},"content":{"32":{"position":[[228,6]]},"68":{"position":[[118,9],[568,9]]},"88":{"position":[[15,9],[95,10],[134,9],[168,9]]},"243":{"position":[[118,9],[568,9]]},"250":{"position":[[15,9],[95,10],[134,9],[168,9]]},"468":{"position":[[118,9],[568,9]]},"488":{"position":[[15,9],[95,10],[134,9],[168,9]]}},"keywords":{}}],["alloc::{string::str",{"_index":821,"title":{},"content":{"32":{"position":[[239,24]]}},"keywords":{}}],["allocator"",{"_index":1565,"title":{},"content":{"88":{"position":[[304,16]]},"250":{"position":[[304,16]]},"488":{"position":[[304,16]]}},"keywords":{}}],["allow",{"_index":436,"title":{},"content":{"16":{"position":[[173,6],[386,6]]},"17":{"position":[[2142,8],[3316,7],[3460,7],[3673,7]]},"38":{"position":[[1019,8]]},"76":{"position":[[801,6]]},"92":{"position":[[269,5]]},"95":{"position":[[17,6]]},"103":{"position":[[727,5]]},"110":{"position":[[191,6]]},"111":{"position":[[76,6]]},"114":{"position":[[103,6]]},"185":{"position":[[3177,7]]},"190":{"position":[[19,8]]},"198":{"position":[[1468,6]]},"203":{"position":[[300,11],[527,6]]},"205":{"position":[[1729,9],[1776,9],[1871,9],[2028,9]]},"206":{"position":[[2440,9],[2820,9],[3429,9]]},"227":{"position":[[801,6]]},"257":{"position":[[103,6]]},"267":{"position":[[957,11],[1103,11]]},"268":{"position":[[2833,5]]},"269":{"position":[[468,11],[2962,9],[3034,9],[3236,9]]},"284":{"position":[[269,5]]},"287":{"position":[[17,6]]},"295":{"position":[[727,5]]},"305":{"position":[[191,6]]},"306":{"position":[[76,6]]},"323":{"position":[[3133,5]]},"367":{"position":[[19,8]]},"376":{"position":[[3161,7]]},"384":{"position":[[481,11],[2996,9],[3068,9],[3277,9]]},"407":{"position":[[957,11],[1103,11]]},"408":{"position":[[2833,5]]},"409":{"position":[[468,11],[2962,9],[3034,9],[3236,9]]},"416":{"position":[[1262,6],[1493,5],[2588,5],[2725,5],[3528,5],[3664,5]]},"419":{"position":[[2773,7],[3056,9],[3201,9],[3527,10],[4012,5],[4680,5],[5107,5],[5243,5]]},"423":{"position":[[300,11],[527,6]]},"425":{"position":[[1704,9],[1751,9],[1846,9],[2003,9]]},"426":{"position":[[2430,9],[2805,9],[3404,9]]},"434":{"position":[[1458,6]]},"440":{"position":[[4105,6]]},"441":{"position":[[3880,6]]},"458":{"position":[[801,6]]},"477":{"position":[[584,6]]},"480":{"position":[[103,6]]},"496":{"position":[[269,5]]},"499":{"position":[[17,6]]},"507":{"position":[[727,5]]},"510":{"position":[[191,6]]},"511":{"position":[[76,6]]},"541":{"position":[[3133,5]]},"583":{"position":[[19,8]]},"592":{"position":[[3161,7]]},"613":{"position":[[2149,6]]},"617":{"position":[[805,6],[896,6]]},"626":{"position":[[481,11],[2996,9],[3068,9],[3277,9]]},"644":{"position":[[957,11],[1103,11]]},"645":{"position":[[2833,5]]},"646":{"position":[[468,11],[2962,9],[3034,9],[3236,9]]},"653":{"position":[[1262,6],[1493,5],[2588,5],[2725,5],[3528,5],[3664,5]]},"656":{"position":[[2773,7],[3056,9],[3201,9],[3527,10],[4012,5],[4680,5],[5107,5],[5243,5]]},"665":{"position":[[300,11],[527,6]]},"667":{"position":[[1704,9],[1751,9],[1846,9],[2003,9]]},"668":{"position":[[2440,9],[2820,9],[3429,9]]},"681":{"position":[[1468,6]]},"687":{"position":[[4105,6]]},"688":{"position":[[3880,6]]},"699":{"position":[[584,6]]},"721":{"position":[[2149,6]]},"725":{"position":[[805,6],[896,6]]}},"keywords":{}}],["allowance(&self",{"_index":546,"title":{},"content":{"17":{"position":[[3849,20]]},"115":{"position":[[1016,20]]},"205":{"position":[[1044,20]]},"247":{"position":[[676,20]]},"258":{"position":[[970,20]]},"269":{"position":[[1790,20]]},"384":{"position":[[1810,20]]},"409":{"position":[[1790,20]]},"419":{"position":[[2806,20]]},"425":{"position":[[1019,20]]},"446":{"position":[[676,20]]},"481":{"position":[[970,20]]},"626":{"position":[[1810,20]]},"646":{"position":[[1790,20]]},"656":{"position":[[2806,20]]},"667":{"position":[[1019,20]]},"673":{"position":[[676,20]]}},"keywords":{}}],["allpub",{"_index":1995,"title":{},"content":{"147":{"position":[[401,6]]},"335":{"position":[[405,6]]},"552":{"position":[[405,6]]}},"keywords":{}}],["along",{"_index":572,"title":{},"content":{"20":{"position":[[100,5]]},"197":{"position":[[899,6]]},"433":{"position":[[898,6]]},"680":{"position":[[898,6]]}},"keywords":{}}],["alongsid",{"_index":2111,"title":{},"content":{"164":{"position":[[1150,9]]},"353":{"position":[[1185,9]]},"569":{"position":[[1185,9]]}},"keywords":{}}],["alreadi",{"_index":397,"title":{},"content":{"15":{"position":[[7,7]]},"18":{"position":[[3,7],[199,7]]},"44":{"position":[[43,7]]},"50":{"position":[[202,7]]},"52":{"position":[[352,7]]},"88":{"position":[[75,7]]},"91":{"position":[[95,7]]},"98":{"position":[[350,7]]},"126":{"position":[[2881,7]]},"128":{"position":[[752,7]]},"141":{"position":[[21,7],[79,7],[801,7]]},"185":{"position":[[3645,7]]},"196":{"position":[[1123,8]]},"197":{"position":[[832,7]]},"246":{"position":[[397,7]]},"250":{"position":[[75,7]]},"277":{"position":[[3049,7]]},"279":{"position":[[752,7]]},"283":{"position":[[95,7]]},"290":{"position":[[350,7]]},"326":{"position":[[21,7],[79,7],[801,7]]},"376":{"position":[[3629,7]]},"416":{"position":[[1071,7]]},"419":{"position":[[385,7]]},"432":{"position":[[1066,8]]},"433":{"position":[[831,7]]},"445":{"position":[[397,7]]},"488":{"position":[[75,7]]},"495":{"position":[[95,7]]},"502":{"position":[[350,7]]},"514":{"position":[[2881,7]]},"516":{"position":[[752,7]]},"535":{"position":[[21,7],[79,7],[801,7]]},"592":{"position":[[3629,7]]},"653":{"position":[[1071,7]]},"656":{"position":[[385,7]]},"672":{"position":[[397,7]]},"679":{"position":[[1066,8]]},"680":{"position":[[831,7]]}},"keywords":{}}],["alter",{"_index":2182,"title":{},"content":{"184":{"position":[[89,8]]},"375":{"position":[[89,8]]},"591":{"position":[[89,8]]},"599":{"position":[[570,5]]},"707":{"position":[[570,5]]}},"keywords":{}}],["altern",{"_index":1996,"title":{},"content":{"147":{"position":[[593,14]]},"206":{"position":[[3754,14]]},"268":{"position":[[2883,11]]},"335":{"position":[[597,14]]},"408":{"position":[[2883,11]]},"426":{"position":[[3729,14]]},"552":{"position":[[597,14]]},"645":{"position":[[2883,11]]},"668":{"position":[[3754,14]]}},"keywords":{}}],["although",{"_index":1974,"title":{},"content":{"143":{"position":[[774,8]]},"328":{"position":[[749,8]]},"537":{"position":[[749,8]]}},"keywords":{}}],["alway",{"_index":48,"title":{},"content":{"1":{"position":[[626,6],[769,7],[1139,6]]},"2":{"position":[[196,6]]},"195":{"position":[[763,6]]},"218":{"position":[[3,7]]},"431":{"position":[[763,6]]},"451":{"position":[[3,7]]},"678":{"position":[[763,6]]},"691":{"position":[[3,7]]}},"keywords":{}}],["amaz",{"_index":854,"title":{},"content":{"33":{"position":[[4,7]]}},"keywords":{}}],["ambigu",{"_index":946,"title":{},"content":{"39":{"position":[[1269,9]]}},"keywords":{}}],["amount",{"_index":1123,"title":{},"content":{"43":{"position":[[417,7],[459,8],[1070,6]]},"71":{"position":[[144,7],[417,8],[563,6]]},"80":{"position":[[774,7]]},"92":{"position":[[750,6]]},"95":{"position":[[326,6]]},"99":{"position":[[354,6]]},"100":{"position":[[448,6]]},"101":{"position":[[302,6]]},"103":{"position":[[493,6]]},"115":{"position":[[631,7],[718,7],[781,7],[1255,7],[1348,8],[2529,7],[2855,7],[2948,8]]},"126":{"position":[[3159,6]]},"163":{"position":[[569,7],[1144,6]]},"204":{"position":[[669,7],[717,9],[824,7],[832,7],[977,7],[1457,10]]},"205":{"position":[[342,7],[439,8],[532,7],[630,8],[675,8],[739,7],[837,9],[913,7],[1276,7],[1362,7],[1480,9],[1519,9],[1604,7],[1612,7],[1704,7],[1791,7],[1883,8],[2040,7]]},"206":{"position":[[1038,7],[1276,6],[1456,6],[1553,8],[1699,6],[1822,6],[1897,6],[3219,7],[3548,6]]},"210":{"position":[[531,6],[1267,6]]},"231":{"position":[[774,7]]},"235":{"position":[[144,7],[417,8],[563,6]]},"247":{"position":[[849,7],[901,8],[994,7],[1058,8],[1122,7],[1171,8],[1413,7],[1516,8]]},"258":{"position":[[617,7],[700,7],[759,7],[1201,7],[1294,8],[2471,7],[2781,7],[2874,8]]},"267":{"position":[[1677,7],[1779,7],[1787,7],[3018,7]]},"268":{"position":[[2522,6],[2624,8],[3325,7]]},"269":{"position":[[999,7],[1088,7],[1185,8],[1278,7],[1376,8],[1421,8],[1485,7],[1583,9],[1659,7],[1976,7],[2056,9],[2131,7],[2139,7],[2203,7],[2257,7],[2378,9],[2453,7],[2461,7],[2567,7],[2591,7],[2713,9],[2752,9],[2837,7],[2845,7],[2937,7],[3049,7],[3152,9],[3248,7],[3480,7],[4948,7],[5186,6],[5366,6],[5463,8],[5609,6],[5732,6],[5807,6]]},"277":{"position":[[3327,6]]},"284":{"position":[[750,6]]},"287":{"position":[[326,6]]},"291":{"position":[[354,6]]},"292":{"position":[[448,6]]},"293":{"position":[[302,6]]},"295":{"position":[[493,6]]},"352":{"position":[[591,7],[1166,6]]},"383":{"position":[[1199,7]]},"384":{"position":[[1012,7],[1101,7],[1198,8],[1291,7],[1389,8],[1434,8],[1498,7],[1596,9],[1672,7],[1996,7],[2076,9],[2151,7],[2159,7],[2223,7],[2277,7],[2405,9],[2480,7],[2488,7],[2594,7],[2618,7],[2747,9],[2786,9],[2871,7],[2879,7],[2971,7],[3083,7],[3193,9],[3289,7],[3490,7]]},"389":{"position":[[531,6],[1204,6]]},"407":{"position":[[1677,7],[1779,7],[1787,7],[3018,7]]},"408":{"position":[[2522,6],[2624,8],[3325,7]]},"409":{"position":[[999,7],[1088,7],[1185,8],[1278,7],[1376,8],[1421,8],[1485,7],[1583,9],[1659,7],[1976,7],[2056,9],[2131,7],[2139,7],[2203,7],[2257,7],[2378,9],[2453,7],[2461,7],[2567,7],[2591,7],[2713,9],[2752,9],[2837,7],[2845,7],[2937,7],[3049,7],[3152,9],[3248,7],[3480,7],[4948,7],[5186,6],[5366,6],[5463,8],[5609,6],[5732,6],[5807,6]]},"416":{"position":[[859,7],[966,6],[1469,7],[1888,9],[2192,7],[2701,7],[3058,7],[4378,7]]},"419":{"position":[[271,7],[2742,6],[2927,6],[3018,7],[3094,7],[3239,7],[3434,7],[3616,7],[3740,7],[3780,6],[3865,7],[3988,7],[4406,9],[4656,7],[5012,7],[5958,7]]},"424":{"position":[[644,7],[692,9],[799,7],[807,7],[928,7],[1407,10]]},"425":{"position":[[317,7],[414,8],[507,7],[605,8],[650,8],[714,7],[812,9],[888,7],[1251,7],[1337,7],[1455,9],[1494,9],[1579,7],[1587,7],[1679,7],[1766,7],[1858,8],[2015,7]]},"426":{"position":[[1033,7],[1271,6],[1451,6],[1548,8],[1689,6],[1812,6],[1887,6],[3194,7],[3523,6]]},"446":{"position":[[849,7],[901,8],[994,7],[1058,8],[1122,7],[1171,8],[1413,7],[1516,8]]},"462":{"position":[[774,7]]},"471":{"position":[[144,7],[417,8],[563,6]]},"476":{"position":[[737,7],[1012,8],[1157,6],[1245,7],[1786,7],[1888,7]]},"481":{"position":[[617,7],[700,7],[759,7],[1201,7],[1294,8],[2471,7],[2781,7],[2874,8]]},"496":{"position":[[750,6]]},"499":{"position":[[326,6]]},"503":{"position":[[354,6]]},"504":{"position":[[448,6]]},"505":{"position":[[302,6]]},"507":{"position":[[493,6]]},"514":{"position":[[3159,6]]},"568":{"position":[[591,7],[1166,6]]},"604":{"position":[[197,7],[278,8],[400,7]]},"608":{"position":[[366,6],[550,7]]},"625":{"position":[[1199,7]]},"626":{"position":[[1012,7],[1101,7],[1198,8],[1291,7],[1389,8],[1434,8],[1498,7],[1596,9],[1672,7],[1996,7],[2076,9],[2151,7],[2159,7],[2223,7],[2277,7],[2405,9],[2480,7],[2488,7],[2594,7],[2618,7],[2747,9],[2786,9],[2871,7],[2879,7],[2971,7],[3083,7],[3193,9],[3289,7],[3490,7]]},"644":{"position":[[1677,7],[1779,7],[1787,7],[3018,7]]},"645":{"position":[[2522,6],[2624,8],[3325,7]]},"646":{"position":[[999,7],[1088,7],[1185,8],[1278,7],[1376,8],[1421,8],[1485,7],[1583,9],[1659,7],[1976,7],[2056,9],[2131,7],[2139,7],[2203,7],[2257,7],[2378,9],[2453,7],[2461,7],[2567,7],[2591,7],[2713,9],[2752,9],[2837,7],[2845,7],[2937,7],[3049,7],[3152,9],[3248,7],[3480,7],[4948,7],[5186,6],[5366,6],[5463,8],[5609,6],[5732,6],[5807,6]]},"653":{"position":[[859,7],[966,6],[1469,7],[1888,9],[2192,7],[2701,7],[3058,7],[4378,7]]},"656":{"position":[[271,7],[2742,6],[2927,6],[3018,7],[3094,7],[3239,7],[3434,7],[3616,7],[3740,7],[3780,6],[3865,7],[3988,7],[4406,9],[4656,7],[5012,7],[5958,7]]},"659":{"position":[[531,6],[1204,6]]},"666":{"position":[[644,7],[692,9],[799,7],[807,7],[928,7],[1407,10]]},"667":{"position":[[317,7],[414,8],[507,7],[605,8],[650,8],[714,7],[812,9],[888,7],[1251,7],[1337,7],[1455,9],[1494,9],[1579,7],[1587,7],[1679,7],[1766,7],[1858,8],[2015,7]]},"668":{"position":[[1038,7],[1276,6],[1456,6],[1553,8],[1699,6],[1822,6],[1897,6],[3219,7],[3548,6]]},"673":{"position":[[849,7],[901,8],[994,7],[1058,8],[1122,7],[1171,8],[1413,7],[1516,8]]},"698":{"position":[[737,7],[1012,8],[1157,6],[1245,7],[1786,7],[1888,7]]},"712":{"position":[[197,7],[278,8],[400,7]]},"716":{"position":[[366,6],[550,7]]}},"keywords":{}}],["amp",{"_index":278,"title":{},"content":{"9":{"position":[[488,5],[652,5]]},"212":{"position":[[1552,9],[2654,9]]},"391":{"position":[[1552,9],[2660,9]]},"661":{"position":[[1552,9],[2660,9]]}},"keywords":{}}],["amp;&",{"_index":2156,"title":{},"content":{"175":{"position":[[74,10]]},"361":{"position":[[74,10]]},"440":{"position":[[6415,10],[6439,10]]},"577":{"position":[[74,10]]},"687":{"position":[[6415,10],[6439,10]]}},"keywords":{}}],["amp;[u32",{"_index":334,"title":{},"content":{"10":{"position":[[507,10],[579,10],[1193,11],[1211,11]]}},"keywords":{}}],["amp;[u8",{"_index":332,"title":{},"content":{"10":{"position":[[437,9],[1234,10]]},"212":{"position":[[3831,10],[4056,10]]},"267":{"position":[[2065,10],[2154,10],[2231,10],[2316,10]]},"391":{"position":[[3849,10],[4074,10]]},"407":{"position":[[2065,10],[2154,10],[2231,10],[2316,10]]},"644":{"position":[[2065,10],[2154,10],[2231,10],[2316,10]]},"661":{"position":[[3849,10],[4074,10]]}},"keywords":{}}],["amp;address",{"_index":2133,"title":{},"content":{"168":{"position":[[1674,13],[2106,13]]},"185":{"position":[[576,13],[893,13],[1088,13],[1286,13],[1525,13],[1969,13],[2240,13]]},"197":{"position":[[90,13],[254,13]]},"204":{"position":[[655,13]]},"205":{"position":[[328,13],[493,13],[518,13],[725,13],[965,13],[1072,13],[1095,13],[1237,13],[1262,13],[1667,13],[1690,13]]},"247":{"position":[[609,13],[704,13],[727,13],[835,13],[955,13],[980,13],[1108,13],[1303,13],[1399,13]]},"267":{"position":[[3913,13]]},"269":{"position":[[1074,13],[1239,13],[1264,13],[1471,13],[1818,13],[1841,13],[1962,13],[2189,13],[2528,13],[2553,13],[2900,13],[2923,13]]},"348":{"position":[[1674,13]]},"376":{"position":[[560,13],[877,13],[1072,13],[1270,13],[1509,13],[1953,13],[2224,13]]},"384":{"position":[[1087,13],[1252,13],[1277,13],[1484,13],[1838,13],[1861,13],[1982,13],[2209,13],[2555,13],[2580,13],[2934,13],[2957,13]]},"407":{"position":[[3913,13]]},"409":{"position":[[1074,13],[1239,13],[1264,13],[1471,13],[1818,13],[1841,13],[1962,13],[2189,13],[2528,13],[2553,13],[2900,13],[2923,13]]},"419":{"position":[[2700,13],[2834,13],[2857,13],[3004,13],[3148,13],[3293,13],[3420,13],[3577,13],[3602,13],[3726,13],[3851,13]]},"424":{"position":[[630,13]]},"425":{"position":[[303,13],[468,13],[493,13],[700,13],[940,13],[1047,13],[1070,13],[1212,13],[1237,13],[1642,13],[1665,13]]},"433":{"position":[[90,13],[254,13]]},"446":{"position":[[609,13],[704,13],[727,13],[835,13],[955,13],[980,13],[1108,13],[1303,13],[1399,13]]},"476":{"position":[[1381,13]]},"564":{"position":[[1674,13],[2106,13]]},"592":{"position":[[560,13],[877,13],[1072,13],[1270,13],[1509,13],[1953,13],[2224,13]]},"604":{"position":[[183,13],[361,13],[386,13]]},"626":{"position":[[1087,13],[1252,13],[1277,13],[1484,13],[1838,13],[1861,13],[1982,13],[2209,13],[2555,13],[2580,13],[2934,13],[2957,13]]},"644":{"position":[[3913,13]]},"646":{"position":[[1074,13],[1239,13],[1264,13],[1471,13],[1818,13],[1841,13],[1962,13],[2189,13],[2528,13],[2553,13],[2900,13],[2923,13]]},"656":{"position":[[2700,13],[2834,13],[2857,13],[3004,13],[3148,13],[3293,13],[3420,13],[3577,13],[3602,13],[3726,13],[3851,13]]},"666":{"position":[[630,13]]},"667":{"position":[[303,13],[468,13],[493,13],[700,13],[940,13],[1047,13],[1070,13],[1212,13],[1237,13],[1642,13],[1665,13]]},"673":{"position":[[609,13],[704,13],[727,13],[835,13],[955,13],[980,13],[1108,13],[1303,13],[1399,13]]},"680":{"position":[[90,13],[254,13]]},"698":{"position":[[1381,13]]},"712":{"position":[[183,13],[361,13],[386,13]]}},"keywords":{}}],["amp;amount",{"_index":2514,"title":{},"content":{"206":{"position":[[1330,13],[3684,13]]},"269":{"position":[[5240,13]]},"409":{"position":[[5240,13]]},"416":{"position":[[2975,13],[4498,13]]},"419":{"position":[[4929,13],[6078,13]]},"426":{"position":[[1325,13],[3659,13]]},"608":{"position":[[494,13],[602,13]]},"646":{"position":[[5240,13]]},"653":{"position":[[2975,13],[4498,13]]},"656":{"position":[[4929,13],[6078,13]]},"668":{"position":[[1330,13],[3684,13]]},"716":{"position":[[494,13],[602,13]]}},"keywords":{}}],["amp;amount).is_err",{"_index":2524,"title":{},"content":{"206":{"position":[[2016,23]]},"269":{"position":[[5926,23]]},"409":{"position":[[5926,23]]},"426":{"position":[[2006,23]]},"646":{"position":[[5926,23]]},"668":{"position":[[2016,23]]}},"keywords":{}}],["amp;approv",{"_index":2534,"title":{},"content":{"206":{"position":[[2580,13],[3040,13]]},"268":{"position":[[3146,13]]},"408":{"position":[[3146,13]]},"426":{"position":[[2565,13],[3020,13]]},"645":{"position":[[3146,13]]},"668":{"position":[[2580,13],[3040,13]]}},"keywords":{}}],["amp;approved_amount",{"_index":2532,"title":{},"content":{"206":{"position":[[2414,22]]},"426":{"position":[[2404,22]]},"668":{"position":[[2414,22]]}},"keywords":{}}],["amp;backend",{"_index":782,"title":{},"content":{"31":{"position":[[2136,14]]}},"keywords":{}}],["amp;config",{"_index":780,"title":{},"content":{"31":{"position":[[2078,13],[2248,12]]}},"keywords":{}}],["amp;env",{"_index":2497,"title":{},"content":{"206":{"position":[[376,9]]},"269":{"position":[[4280,9]]},"409":{"position":[[4280,9]]},"426":{"position":[[376,9]]},"477":{"position":[[1880,9]]},"646":{"position":[[4280,9]]},"668":{"position":[[376,9]]},"699":{"position":[[1880,9]]}},"keywords":{}}],["amp;erc20",{"_index":3323,"title":{},"content":{"426":{"position":[[963,11],[1620,11],[2553,11],[3008,11],[3126,11]]}},"keywords":{}}],["amp;express",{"_index":973,"title":{},"content":{"39":{"position":[[2290,16]]}},"keywords":{}}],["amp;hostenv",{"_index":1957,"title":{},"content":{"142":{"position":[[279,13]]},"143":{"position":[[1257,13]]},"267":{"position":[[4254,12]]},"327":{"position":[[279,13]]},"328":{"position":[[1232,13]]},"395":{"position":[[1795,13],[2236,13]]},"407":{"position":[[4254,12]]},"536":{"position":[[279,13]]},"537":{"position":[[1232,13]]},"632":{"position":[[1795,13],[2236,13]]},"644":{"position":[[4254,12]]}},"keywords":{}}],["amp;include!("../../data/journal"",{"_index":336,"title":{},"content":{"10":{"position":[[592,46]]}},"keywords":{}}],["amp;include!("../../data/method"",{"_index":333,"title":{},"content":{"10":{"position":[[449,45]]}},"keywords":{}}],["amp;include!("../../data/seal"",{"_index":335,"title":{},"content":{"10":{"position":[[520,43]]}},"keywords":{}}],["amp;initial_suppli",{"_index":2445,"title":{},"content":{"204":{"position":[[290,21]]},"424":{"position":[[265,21]]},"666":{"position":[[265,21]]}},"keywords":{}}],["amp;journ",{"_index":309,"title":{},"content":{"9":{"position":[[1315,14]]}},"keywords":{}}],["amp;mapping_data",{"_index":2658,"title":{},"content":{"212":{"position":[[3058,19]]},"391":{"position":[[3076,19]]},"661":{"position":[[3076,19]]}},"keywords":{}}],["amp;mut",{"_index":975,"title":{},"content":{"39":{"position":[[2312,8]]},"212":{"position":[[4355,8]]},"269":{"position":[[564,8]]},"384":{"position":[[577,8]]},"391":{"position":[[4373,8]]},"409":{"position":[[564,8]]},"419":{"position":[[2201,8]]},"440":{"position":[[6255,8]]},"605":{"position":[[516,8]]},"626":{"position":[[577,8]]},"646":{"position":[[564,8]]},"656":{"position":[[2201,8]]},"661":{"position":[[4373,8]]},"687":{"position":[[6255,8]]},"713":{"position":[[516,8]]}},"keywords":{}}],["amp;own",{"_index":3331,"title":{},"content":{"434":{"position":[[463,13],[790,13]]}},"keywords":{}}],["amp;ownershipchang",{"_index":2388,"title":{},"content":{"198":{"position":[[482,21],[814,21]]},"434":{"position":[[477,21],[804,21]]},"681":{"position":[[482,21],[814,21]]}},"keywords":{}}],["amp;party_contract",{"_index":3061,"title":{},"content":{"330":{"position":[[407,20]]}},"keywords":{}}],["amp;partystart",{"_index":2030,"title":{},"content":{"157":{"position":[[442,17]]},"330":{"position":[[428,17]]},"547":{"position":[[442,17]]}},"keywords":{}}],["amp;precompil",{"_index":785,"title":{},"content":{"31":{"position":[[2261,18]]}},"keywords":{}}],["amp;r",{"_index":3073,"title":{},"content":{"348":{"position":[[2122,7]]}},"keywords":{}}],["amp;recipi",{"_index":2537,"title":{},"content":{"206":{"position":[[2751,15],[3668,15]]},"426":{"position":[[2736,15],[3643,15]]},"668":{"position":[[2751,15],[3668,15]]}},"keywords":{}}],["amp;result",{"_index":317,"title":{},"content":{"9":{"position":[[1639,13]]}},"keywords":{}}],["amp;rol",{"_index":2220,"title":{},"content":{"185":{"position":[[556,10],[694,10],[873,10],[1068,10],[1266,10],[1505,10],[1662,10],[1685,10],[1949,10],[2220,10]]},"376":{"position":[[540,10],[678,10],[857,10],[1052,10],[1250,10],[1489,10],[1646,10],[1669,10],[1933,10],[2204,10]]},"592":{"position":[[540,10],[678,10],[857,10],[1052,10],[1250,10],[1489,10],[1646,10],[1669,10],[1933,10],[2204,10]]}},"keywords":{}}],["amp;runtimearg",{"_index":2872,"title":{},"content":{"267":{"position":[[3000,17]]},"407":{"position":[[3000,17]]},"644":{"position":[[3000,17]]}},"keywords":{}}],["amp;seal",{"_index":313,"title":{},"content":{"9":{"position":[[1477,11]]}},"keywords":{}}],["amp;seal).verify(method_id",{"_index":355,"title":{},"content":{"10":{"position":[[1300,29]]}},"keywords":{}}],["amp;self",{"_index":1458,"title":{},"content":{"79":{"position":[[982,10]]},"230":{"position":[[999,10]]},"461":{"position":[[999,10]]}},"keywords":{}}],["amp;self.env().cal",{"_index":2228,"title":{},"content":{"185":{"position":[[957,26],[1152,26],[1316,24]]},"376":{"position":[[941,26],[1136,26],[1300,24]]},"592":{"position":[[941,26],[1136,26],[1300,24]]}},"keywords":{}}],["amp;spend",{"_index":2472,"title":{},"content":{"205":{"position":[[616,13]]},"206":{"position":[[2503,14]]},"269":{"position":[[1362,13]]},"384":{"position":[[1375,13]]},"409":{"position":[[1362,13]]},"425":{"position":[[591,13]]},"426":{"position":[[2493,14]]},"626":{"position":[[1375,13]]},"646":{"position":[[1362,13]]},"667":{"position":[[591,13]]},"668":{"position":[[2503,14]]}},"keywords":{}}],["amp;str",{"_index":732,"title":{},"content":{"31":{"position":[[581,8],[728,9],[861,9],[878,9]]},"32":{"position":[[1127,9]]},"42":{"position":[[562,8],[632,8]]},"83":{"position":[[577,9],[636,9]]},"206":{"position":[[132,8],[179,8]]},"212":{"position":[[225,8],[278,8],[343,8],[403,8],[2835,9]]},"252":{"position":[[577,9],[636,9]]},"267":{"position":[[2984,9]]},"269":{"position":[[4036,8],[4083,8]]},"391":{"position":[[225,8],[278,8],[343,8],[403,8],[2841,9]]},"407":{"position":[[2984,9]]},"409":{"position":[[4036,8],[4083,8]]},"426":{"position":[[132,8],[179,8]]},"483":{"position":[[577,9],[636,9]]},"644":{"position":[[2984,9]]},"646":{"position":[[4036,8],[4083,8]]},"661":{"position":[[225,8],[278,8],[343,8],[403,8],[2841,9]]},"668":{"position":[[132,8],[179,8]]}},"keywords":{}}],["amp;t",{"_index":2146,"title":{},"content":{"168":{"position":[[2127,7]]},"348":{"position":[[2137,7]]},"564":{"position":[[2127,7]]}},"keywords":{}}],["amp;test_env",{"_index":3060,"title":{},"content":{"328":{"position":[[441,14]]},"537":{"position":[[441,14]]}},"keywords":{}}],["amp;ticket_id",{"_index":3394,"title":{},"content":{"440":{"position":[[2024,15]]},"687":{"position":[[2024,15]]}},"keywords":{}}],["amp;ticketoperatorhostref",{"_index":3533,"title":{},"content":{"441":{"position":[[5739,27]]},"688":{"position":[[5739,27]]}},"keywords":{}}],["amp;transf",{"_index":2509,"title":{},"content":{"206":{"position":[[980,13],[1642,13],[3163,13]]},"268":{"position":[[3269,13]]},"269":{"position":[[4890,13],[5552,13]]},"408":{"position":[[3269,13]]},"409":{"position":[[4890,13],[5552,13]]},"426":{"position":[[975,13],[1632,13],[3138,13]]},"645":{"position":[[3269,13]]},"646":{"position":[[4890,13],[5552,13]]},"668":{"position":[[980,13],[1642,13],[3163,13]]}},"keywords":{}}],["amp;transfer_amount",{"_index":2538,"title":{},"content":{"206":{"position":[[2767,22]]},"426":{"position":[[2752,22]]},"668":{"position":[[2767,22]]}},"keywords":{}}],["amp;u256",{"_index":2448,"title":{},"content":{"204":{"position":[[677,10]]},"205":{"position":[[350,10],[540,10],[747,10],[1284,10],[1712,10]]},"247":{"position":[[857,10],[1002,10],[1130,10],[1421,10]]},"269":{"position":[[1096,10],[1286,10],[1493,10],[1984,10],[2211,10],[2575,10],[2945,10]]},"384":{"position":[[1109,10],[1299,10],[1506,10],[2004,10],[2231,10],[2602,10],[2979,10]]},"409":{"position":[[1096,10],[1286,10],[1493,10],[1984,10],[2211,10],[2575,10],[2945,10]]},"419":{"position":[[3026,11],[3171,11],[3315,11],[3442,11],[3624,11],[3748,11],[3873,11]]},"424":{"position":[[652,10]]},"425":{"position":[[325,10],[515,10],[722,10],[1259,10],[1687,10]]},"446":{"position":[[857,10],[1002,10],[1130,10],[1421,10]]},"604":{"position":[[205,10],[408,10]]},"626":{"position":[[1109,10],[1299,10],[1506,10],[2004,10],[2231,10],[2602,10],[2979,10]]},"646":{"position":[[1096,10],[1286,10],[1493,10],[1984,10],[2211,10],[2575,10],[2945,10]]},"656":{"position":[[3026,11],[3171,11],[3315,11],[3442,11],[3624,11],[3748,11],[3873,11]]},"666":{"position":[[652,10]]},"667":{"position":[[325,10],[515,10],[722,10],[1259,10],[1687,10]]},"673":{"position":[[857,10],[1002,10],[1130,10],[1421,10]]},"712":{"position":[[205,10],[408,10]]}},"keywords":{}}],["amp;u512",{"_index":3546,"title":{},"content":{"476":{"position":[[1253,10]]},"698":{"position":[[1253,10]]}},"keywords":{}}],["amp;valu",{"_index":3411,"title":{},"content":{"440":{"position":[[2991,12]]},"441":{"position":[[3532,12]]},"687":{"position":[[2991,12]]},"688":{"position":[[3532,12]]}},"keywords":{}}],["amp;vote.amount",{"_index":3263,"title":{},"content":{"416":{"position":[[4268,18]]},"419":{"position":[[5848,18]]},"653":{"position":[[4268,18]]},"656":{"position":[[5848,18]]}},"keywords":{}}],["amp;vote.vot",{"_index":3262,"title":{},"content":{"416":{"position":[[4251,16]]},"419":{"position":[[5831,16]]},"653":{"position":[[4251,16]]},"656":{"position":[[5831,16]]}},"keywords":{}}],["analog",{"_index":1022,"title":{},"content":{"40":{"position":[[381,7]]},"141":{"position":[[1307,11]]},"326":{"position":[[1307,11]]},"535":{"position":[[1307,11]]}},"keywords":{}}],["analysi",{"_index":911,"title":{},"content":{"39":{"position":[[460,8]]}},"keywords":{}}],["analyz",{"_index":1617,"title":{},"content":{"94":{"position":[[192,7]]},"196":{"position":[[583,7]]},"286":{"position":[[192,7]]},"432":{"position":[[520,7]]},"498":{"position":[[192,7]]},"679":{"position":[[520,7]]}},"keywords":{}}],["and/or",{"_index":3857,"title":{},"content":{"614":{"position":[[67,6]]},"722":{"position":[[67,6]]}},"keywords":{}}],["andbal",{"_index":1526,"title":{},"content":{"84":{"position":[[361,12]]},"253":{"position":[[361,12]]},"484":{"position":[[361,12]]}},"keywords":{}}],["andcargo",{"_index":1890,"title":{},"content":{"132":{"position":[[109,8]]},"312":{"position":[[109,8]]},"529":{"position":[[109,8]]}},"keywords":{}}],["andu256",{"_index":1527,"title":{},"content":{"84":{"position":[[432,7]]},"253":{"position":[[432,7]]},"484":{"position":[[432,7]]}},"keywords":{}}],["annot",{"_index":2715,"title":{},"content":{"221":{"position":[[482,9]]},"432":{"position":[[1399,9]]},"454":{"position":[[482,9]]},"596":{"position":[[632,9]]},"679":{"position":[[1399,9]]},"694":{"position":[[482,9]]},"704":{"position":[[632,9]]}},"keywords":{}}],["anoth",{"_index":509,"title":{},"content":{"17":{"position":[[1721,7]]},"18":{"position":[[217,7]]},"51":{"position":[[269,7]]},"84":{"position":[[485,7]]},"85":{"position":[[183,7]]},"102":{"position":[[285,7]]},"115":{"position":[[1838,7]]},"154":{"position":[[114,7]]},"178":{"position":[[108,7]]},"202":{"position":[[312,7]]},"209":{"position":[[137,7],[504,7],[1483,7]]},"253":{"position":[[485,7]]},"254":{"position":[[183,7]]},"258":{"position":[[1784,7]]},"294":{"position":[[285,7]]},"339":{"position":[[114,7]]},"369":{"position":[[108,7]]},"388":{"position":[[137,7],[494,7],[1415,7]]},"395":{"position":[[4334,7]]},"397":{"position":[[341,7]]},"422":{"position":[[312,7]]},"481":{"position":[[1784,7]]},"484":{"position":[[485,7]]},"485":{"position":[[183,7]]},"506":{"position":[[285,7]]},"559":{"position":[[114,7]]},"585":{"position":[[108,7]]},"612":{"position":[[312,8],[2032,8]]},"632":{"position":[[4334,7]]},"634":{"position":[[341,7]]},"658":{"position":[[137,7],[494,7],[1415,7]]},"664":{"position":[[312,7]]},"720":{"position":[[312,8],[2032,8]]}},"keywords":{}}],["anotherlog",{"_index":3790,"title":{},"content":{"610":{"position":[[140,10]]},"718":{"position":[[140,10]]}},"keywords":{}}],["answer",{"_index":129,"title":{},"content":{"3":{"position":[[121,7]]},"616":{"position":[[554,7]]},"724":{"position":[[554,7]]}},"keywords":{}}],["anymor",{"_index":2801,"title":{},"content":{"265":{"position":[[88,7]]},"405":{"position":[[88,7]]},"642":{"position":[[88,7]]}},"keywords":{}}],["anyon",{"_index":3214,"title":{},"content":{"416":{"position":[[43,6],[4863,6]]},"653":{"position":[[43,6],[4863,6]]}},"keywords":{}}],["anytim",{"_index":2647,"title":{},"content":{"212":{"position":[[2271,7]]},"391":{"position":[[2271,7]]},"661":{"position":[[2271,7]]}},"keywords":{}}],["api",{"_index":55,"title":{},"content":{"1":{"position":[[729,3]]},"21":{"position":[[99,4]]},"126":{"position":[[2282,3]]},"189":{"position":[[218,4]]},"267":{"position":[[155,4],[1962,3]]},"268":{"position":[[152,4],[1465,3],[2821,3]]},"270":{"position":[[379,5]]},"277":{"position":[[2450,3]]},"366":{"position":[[218,4]]},"385":{"position":[[379,5]]},"407":{"position":[[155,4],[1962,3]]},"408":{"position":[[152,4],[1465,3],[2821,3]]},"410":{"position":[[379,5]]},"514":{"position":[[2282,3]]},"582":{"position":[[218,4]]},"627":{"position":[[379,5]]},"644":{"position":[[155,4],[1962,3]]},"645":{"position":[[152,4],[1465,3],[2821,3]]},"647":{"position":[[379,5]]}},"keywords":{}}],["apierror::us",{"_index":1612,"title":{},"content":{"93":{"position":[[221,15]]},"285":{"position":[[221,15]]},"497":{"position":[[221,15]]}},"keywords":{}}],["appear",{"_index":1537,"title":{},"content":{"85":{"position":[[324,6]]},"254":{"position":[[324,6]]},"485":{"position":[[324,6]]}},"keywords":{}}],["appli",{"_index":1382,"title":{},"content":{"72":{"position":[[462,5]]},"74":{"position":[[105,5]]},"141":{"position":[[980,7]]},"195":{"position":[[305,5]]},"196":{"position":[[989,7]]},"198":{"position":[[3328,7]]},"236":{"position":[[462,5]]},"238":{"position":[[105,5]]},"326":{"position":[[980,7]]},"431":{"position":[[305,5]]},"432":{"position":[[934,7]]},"434":{"position":[[3310,7]]},"472":{"position":[[462,5]]},"474":{"position":[[105,5]]},"535":{"position":[[980,7]]},"678":{"position":[[305,5]]},"679":{"position":[[934,7]]},"681":{"position":[[3328,7]]}},"keywords":{}}],["applic",{"_index":3076,"title":{},"content":{"354":{"position":[[367,10]]},"570":{"position":[[367,10]]}},"keywords":{}}],["approach",{"_index":859,"title":{},"content":{"33":{"position":[[179,8]]},"39":{"position":[[927,8]]},"79":{"position":[[374,8]]},"163":{"position":[[655,8]]},"230":{"position":[[391,8]]},"352":{"position":[[677,8]]},"461":{"position":[[391,8]]},"568":{"position":[[677,8]]},"612":{"position":[[2046,8]]},"720":{"position":[[2046,8]]}},"keywords":{}}],["appropri",{"_index":1475,"title":{},"content":{"79":{"position":[[1554,11]]},"118":{"position":[[178,11]]},"230":{"position":[[1571,11]]},"299":{"position":[[178,11]]},"414":{"position":[[593,11]]},"461":{"position":[[1571,11]]},"520":{"position":[[178,11]]},"651":{"position":[[593,11]]}},"keywords":{}}],["approv",{"_index":160,"title":{},"content":{"3":{"position":[[630,8]]},"203":{"position":[[121,11]]},"205":{"position":[[115,8],[2106,8]]},"206":{"position":[[2368,8]]},"267":{"position":[[911,10],[1057,10]]},"269":{"position":[[278,10],[3545,8]]},"384":{"position":[[275,10],[3531,8]]},"407":{"position":[[911,10],[1057,10]]},"409":{"position":[[278,10],[3545,8]]},"419":{"position":[[2887,8]]},"423":{"position":[[121,11]]},"425":{"position":[[115,8],[2057,8]]},"426":{"position":[[2358,8]]},"440":{"position":[[6163,8]]},"441":{"position":[[188,8],[1399,8],[2940,7],[4054,8]]},"626":{"position":[[275,10],[3531,8]]},"644":{"position":[[911,10],[1057,10]]},"646":{"position":[[278,10],[3545,8]]},"656":{"position":[[2887,8]]},"665":{"position":[[121,11]]},"667":{"position":[[115,8],[2057,8]]},"668":{"position":[[2368,8]]},"687":{"position":[[6163,8]]},"688":{"position":[[188,8],[1399,8],[2940,7],[4054,8]]}},"keywords":{}}],["approve(&mut",{"_index":543,"title":{},"content":{"17":{"position":[[3700,16]]},"115":{"position":[[740,16]]},"205":{"position":[[693,16]]},"247":{"position":[[1076,16]]},"258":{"position":[[718,16]]},"269":{"position":[[1439,16]]},"384":{"position":[[1452,16]]},"409":{"position":[[1439,16]]},"419":{"position":[[2972,16]]},"425":{"position":[[668,16]]},"446":{"position":[[1076,16]]},"481":{"position":[[718,16]]},"626":{"position":[[1452,16]]},"646":{"position":[[1439,16]]},"656":{"position":[[2972,16]]},"667":{"position":[[668,16]]},"673":{"position":[[1076,16]]}},"keywords":{}}],["approve(oper",{"_index":3503,"title":{},"content":{"441":{"position":[[3027,18]]},"688":{"position":[[3027,18]]}},"keywords":{}}],["approved_amount",{"_index":2527,"title":{},"content":{"206":{"position":[[2221,15],[2518,17],[2619,15],[3079,15]]},"268":{"position":[[3185,15]]},"408":{"position":[[3185,15]]},"426":{"position":[[2211,15],[2508,17],[2604,15],[3059,15]]},"645":{"position":[[3185,15]]},"668":{"position":[[2221,15],[2518,17],[2619,15],[3079,15]]}},"keywords":{}}],["approxim",{"_index":151,"title":{},"content":{"3":{"position":[[477,13]]}},"keywords":{}}],["arbitrari",{"_index":231,"title":{},"content":{"8":{"position":[[106,9]]},"52":{"position":[[238,9]]},"83":{"position":[[428,9]]},"99":{"position":[[168,9]]},"252":{"position":[[428,9]]},"291":{"position":[[168,9]]},"483":{"position":[[428,9]]},"503":{"position":[[168,9]]}},"keywords":{}}],["architectur",{"_index":1695,"title":{"107":{"position":[[0,13]]},"274":{"position":[[0,13]]},"491":{"position":[[0,13]]}},"content":{},"keywords":{}}],["arg",{"_index":1002,"title":{},"content":{"39":{"position":[[2919,5],[2967,5]]},"43":{"position":[[1102,3],[1206,3],[1274,3],[1337,3],[1400,3],[1451,3],[1506,3],[1553,3]]},"52":{"position":[[1196,4],[1488,4],[1665,4],[2232,5],[3213,5],[4850,5],[6545,5]]},"99":{"position":[[424,3],[513,3],[581,3],[644,3]]},"100":{"position":[[522,3],[597,3],[666,3],[729,3],[777,3],[825,3]]},"101":{"position":[[377,3],[455,3],[524,3],[587,3]]},"210":{"position":[[563,3],[658,3],[726,3],[789,3],[852,3],[902,3],[966,3],[1013,3],[1384,3],[1428,3],[1476,3]]},"267":{"position":[[2994,5]]},"268":{"position":[[356,5],[601,5],[712,5],[859,4],[1061,4]]},"291":{"position":[[424,3],[513,3],[581,3],[644,3]]},"292":{"position":[[522,3],[597,3],[666,3],[729,3],[777,3],[825,3]]},"293":{"position":[[377,3],[455,3],[524,3],[587,3]]},"323":{"position":[[2906,3],[3116,3],[3316,3]]},"389":{"position":[[563,3],[658,3],[726,3],[789,3],[839,3],[903,3],[950,3],[1321,3],[1365,3],[1413,3]]},"407":{"position":[[2994,5]]},"408":{"position":[[356,5],[601,5],[712,5],[859,4],[1061,4]]},"440":{"position":[[1560,4]]},"503":{"position":[[424,3],[513,3],[581,3],[644,3]]},"504":{"position":[[522,3],[597,3],[666,3],[729,3],[777,3],[825,3]]},"505":{"position":[[377,3],[455,3],[524,3],[587,3]]},"541":{"position":[[2906,3],[3116,3],[3316,3]]},"644":{"position":[[2994,5]]},"645":{"position":[[356,5],[601,5],[712,5],[859,4],[1061,4]]},"659":{"position":[[563,3],[658,3],[726,3],[789,3],[839,3],[903,3],[950,3],[1321,3],[1365,3],[1413,3]]},"687":{"position":[[1560,4]]}},"keywords":{}}],["args::mayb",{"_index":3344,"title":{},"content":{"440":{"position":[[124,12]]},"687":{"position":[[124,12]]}},"keywords":{}}],["argument",{"_index":327,"title":{"98":{"position":[[5,10]]},"290":{"position":[[5,10]]},"502":{"position":[[5,10]]}},"content":{"10":{"position":[[322,9]]},"31":{"position":[[234,9],[2887,10],[3057,9]]},"32":{"position":[[90,9],[1320,9]]},"53":{"position":[[1321,9]]},"92":{"position":[[871,8]]},"98":{"position":[[48,9],[110,9],[547,10]]},"99":{"position":[[91,10],[143,9]]},"102":{"position":[[140,8]]},"103":{"position":[[62,10],[340,9],[637,8],[747,10]]},"119":{"position":[[853,9]]},"126":{"position":[[1843,9]]},"147":{"position":[[1065,9]]},"148":{"position":[[730,10],[755,8]]},"178":{"position":[[652,9]]},"196":{"position":[[1212,9],[1265,8]]},"198":{"position":[[1945,8],[2887,9]]},"268":{"position":[[655,8],[789,8]]},"277":{"position":[[2011,9]]},"284":{"position":[[871,8]]},"290":{"position":[[48,9],[110,9],[547,10]]},"291":{"position":[[91,10],[143,9]]},"294":{"position":[[140,8]]},"295":{"position":[[62,10],[340,9],[637,8],[747,10]]},"300":{"position":[[853,9]]},"324":{"position":[[1102,10],[1597,10],[1614,9],[1664,9],[1690,10]]},"335":{"position":[[1073,9]]},"336":{"position":[[730,10],[755,8]]},"369":{"position":[[652,9]]},"408":{"position":[[655,8],[789,8]]},"432":{"position":[[1155,9],[1207,8]]},"434":{"position":[[1935,8],[2877,9]]},"496":{"position":[[871,8]]},"502":{"position":[[48,9],[110,9],[547,10]]},"503":{"position":[[91,10],[143,9]]},"506":{"position":[[140,8]]},"507":{"position":[[62,10],[340,9],[637,8],[747,10]]},"514":{"position":[[1843,9]]},"521":{"position":[[853,9]]},"542":{"position":[[1102,10],[1597,10],[1614,9],[1664,9],[1690,10]]},"552":{"position":[[1073,9]]},"553":{"position":[[730,10],[755,8]]},"585":{"position":[[652,9]]},"610":{"position":[[755,9]]},"611":{"position":[[788,8]]},"645":{"position":[[655,8],[789,8]]},"679":{"position":[[1155,9],[1207,8]]},"681":{"position":[[1945,8],[2887,9]]},"718":{"position":[[755,9]]},"719":{"position":[[788,8]]}},"keywords":{}}],["aris",{"_index":610,"title":{},"content":{"20":{"position":[[914,6]]},"102":{"position":[[345,6]]},"294":{"position":[[345,6]]},"506":{"position":[[345,6]]}},"keywords":{}}],["around",{"_index":653,"title":{},"content":{"22":{"position":[[583,7]]}},"keywords":{}}],["arr",{"_index":3699,"title":{},"content":{"601":{"position":[[1230,4],[1797,3]]},"613":{"position":[[873,4],[991,3],[1105,3]]},"709":{"position":[[1230,4],[1797,3]]},"721":{"position":[[873,4],[991,3],[1105,3]]}},"keywords":{}}],["arr.push(i.into",{"_index":3846,"title":{},"content":{"613":{"position":[[1040,19]]},"721":{"position":[[1040,19]]}},"keywords":{}}],["arr[index",{"_index":3713,"title":{},"content":{"601":{"position":[[1830,9]]},"709":{"position":[[1830,9]]}},"keywords":{}}],["array",{"_index":1513,"title":{"601":{"position":[[0,6]]},"709":{"position":[[0,6]]}},"content":{"83":{"position":[[443,7]]},"185":{"position":[[2551,5]]},"212":{"position":[[3609,5]]},"252":{"position":[[443,7]]},"376":{"position":[[2535,5]]},"391":{"position":[[3627,5]]},"483":{"position":[[443,7]]},"592":{"position":[[2535,5]]},"598":{"position":[[1984,7]]},"601":{"position":[[1167,5],[1194,5],[1311,5],[1969,6],[1991,7],[2094,5],[2165,7],[2232,5]]},"602":{"position":[[1197,7],[2081,6]]},"613":{"position":[[1426,5],[1489,6]]},"616":{"position":[[1366,5]]},"661":{"position":[[3627,5]]},"706":{"position":[[1984,7]]},"709":{"position":[[1167,5],[1194,5],[1311,5],[1969,6],[1991,7],[2094,5],[2165,7],[2232,5]]},"710":{"position":[[1197,7],[2081,6]]},"721":{"position":[[1426,5],[1489,6]]},"724":{"position":[[1366,5]]}},"keywords":{}}],["array"",{"_index":2680,"title":{},"content":{"212":{"position":[[4417,13]]},"391":{"position":[[4435,13]]},"661":{"position":[[4435,13]]}},"keywords":{}}],["array.concaten",{"_index":2605,"title":{},"content":{"211":{"position":[[617,17]]},"390":{"position":[[591,17]]},"660":{"position":[[591,17]]}},"keywords":{}}],["array.l8",{"_index":2248,"title":{},"content":{"185":{"position":[[2517,8]]},"376":{"position":[[2501,8]]},"592":{"position":[[2501,8]]}},"keywords":{}}],["articl",{"_index":1568,"title":{},"content":{"88":{"position":[[440,7]]},"91":{"position":[[127,8]]},"124":{"position":[[12,8]]},"141":{"position":[[44,7]]},"146":{"position":[[865,8]]},"158":{"position":[[14,7]]},"166":{"position":[[12,8]]},"168":{"position":[[220,7]]},"171":{"position":[[14,7]]},"180":{"position":[[24,9]]},"211":{"position":[[861,8]]},"250":{"position":[[440,7]]},"283":{"position":[[127,8]]},"309":{"position":[[12,8]]},"326":{"position":[[44,7]]},"331":{"position":[[14,7]]},"334":{"position":[[869,8]]},"348":{"position":[[220,7]]},"355":{"position":[[12,8]]},"357":{"position":[[14,7]]},"371":{"position":[[24,9]]},"390":{"position":[[835,8]]},"488":{"position":[[440,7]]},"495":{"position":[[127,8]]},"526":{"position":[[12,8]]},"535":{"position":[[44,7]]},"548":{"position":[[14,7]]},"551":{"position":[[869,8]]},"564":{"position":[[220,7]]},"571":{"position":[[12,8]]},"573":{"position":[[14,7]]},"587":{"position":[[24,9]]},"660":{"position":[[835,8]]}},"keywords":{}}],["ask",{"_index":414,"title":{},"content":{"15":{"position":[[335,5]]},"16":{"position":[[209,3],[475,3]]},"175":{"position":[[604,3]]},"361":{"position":[[604,3]]},"394":{"position":[[423,3]]},"577":{"position":[[604,3]]},"631":{"position":[[423,3]]}},"keywords":{}}],["asref<[u8]>>(input",{"_index":2860,"title":{},"content":{"267":{"position":[[2529,28]]},"407":{"position":[[2529,28]]},"644":{"position":[[2529,28]]}},"keywords":{}}],["assert",{"_index":293,"title":{},"content":{"9":{"position":[[933,9]]},"138":{"position":[[1122,11]]},"193":{"position":[[285,12]]},"196":{"position":[[840,6]]},"198":{"position":[[2378,10],[2761,6]]},"201":{"position":[[159,10]]},"206":{"position":[[3822,6]]},"268":{"position":[[2168,6],[2296,6],[2786,6],[2842,6],[2903,6]]},"318":{"position":[[1114,11]]},"408":{"position":[[2168,6],[2296,6],[2786,6],[2842,6],[2903,6]]},"421":{"position":[[159,10]]},"426":{"position":[[3797,6]]},"429":{"position":[[285,12]]},"432":{"position":[[778,6]]},"434":{"position":[[2368,10],[2751,6]]},"440":{"position":[[5837,9],[5938,9]]},"544":{"position":[[1114,11]]},"611":{"position":[[613,7]]},"645":{"position":[[2168,6],[2296,6],[2786,6],[2842,6],[2903,6]]},"663":{"position":[[159,10]]},"668":{"position":[[3822,6]]},"676":{"position":[[285,12]]},"679":{"position":[[778,6]]},"681":{"position":[[2378,10],[2761,6]]},"687":{"position":[[5837,9],[5938,9]]},"719":{"position":[[613,7]]}},"keywords":{}}],["assert!(!contract.get",{"_index":2004,"title":{},"content":{"148":{"position":[[365,25]]},"178":{"position":[[1371,25]]},"336":{"position":[[365,25]]},"369":{"position":[[1371,25]]},"553":{"position":[[365,25]]},"585":{"position":[[1371,25]]}},"keywords":{}}],["assert!(!contract1.get",{"_index":2160,"title":{},"content":{"178":{"position":[[1622,26]]},"369":{"position":[[1622,26]]},"585":{"position":[[1622,26]]}},"keywords":{}}],["assert!(!contract2.get",{"_index":2161,"title":{},"content":{"178":{"position":[[1649,26],[1720,26]]},"369":{"position":[[1649,26],[1720,26]]},"585":{"position":[[1649,26],[1720,26]]}},"keywords":{}}],["assert!(contract.get",{"_index":2006,"title":{},"content":{"148":{"position":[[408,24]]},"178":{"position":[[1414,24]]},"336":{"position":[[408,24]]},"369":{"position":[[1414,24]]},"553":{"position":[[408,24]]},"585":{"position":[[1414,24]]}},"keywords":{}}],["assert!(contract1.get",{"_index":2163,"title":{},"content":{"178":{"position":[[1694,25]]},"369":{"position":[[1694,25]]},"585":{"position":[[1694,25]]}},"keywords":{}}],["assert!(env.emitted(erc20.address",{"_index":2541,"title":{},"content":{"206":{"position":[[3252,36]]},"426":{"position":[[3227,36]]},"668":{"position":[[3252,36]]}},"keywords":{}}],["assert!(env.emitted_ev",{"_index":2507,"title":{},"content":{"206":{"position":[[936,26],[1598,26],[2536,26],[2996,26],[3119,26]]},"268":{"position":[[3102,26],[3225,26]]},"269":{"position":[[4846,26],[5508,26]]},"408":{"position":[[3102,26],[3225,26]]},"409":{"position":[[4846,26],[5508,26]]},"426":{"position":[[936,26],[1593,26],[2526,26],[2981,26],[3099,26]]},"645":{"position":[[3102,26],[3225,26]]},"646":{"position":[[4846,26],[5508,26]]},"668":{"position":[[936,26],[1598,26],[2536,26],[2996,26],[3119,26]]}},"keywords":{}}],["assert!(erc20.try_transfer(&recipi",{"_index":2523,"title":{},"content":{"206":{"position":[[1973,42]]},"269":{"position":[[5883,42]]},"409":{"position":[[5883,42]]},"426":{"position":[[1963,42]]},"646":{"position":[[5883,42]]},"668":{"position":[[1973,42]]}},"keywords":{}}],["assert!(exit_reason",{"_index":791,"title":{},"content":{"31":{"position":[[2676,19]]}},"keywords":{}}],["assert!(receipt.verify(evm_calc_id).is_ok",{"_index":846,"title":{},"content":{"32":{"position":[[1474,45]]}},"keywords":{}}],["assert_eq",{"_index":1093,"title":{},"content":{"42":{"position":[[2485,11]]},"138":{"position":[[679,11],[1158,10]]},"198":{"position":[[1044,11]]},"206":{"position":[[1384,11],[2843,11],[3620,11]]},"223":{"position":[[1062,11]]},"268":{"position":[[2327,10],[2570,11]]},"269":{"position":[[5294,11]]},"318":{"position":[[671,11],[1150,10]]},"408":{"position":[[2327,10],[2570,11]]},"409":{"position":[[5294,11]]},"426":{"position":[[1379,11],[2828,11],[3595,11]]},"434":{"position":[[1034,11]]},"440":{"position":[[5402,11],[5512,11],[5593,11],[5673,11]]},"441":{"position":[[5371,11],[5566,11]]},"456":{"position":[[1062,11]]},"544":{"position":[[671,11],[1150,10]]},"645":{"position":[[2327,10],[2570,11]]},"646":{"position":[[5294,11]]},"668":{"position":[[1384,11],[2843,11],[3620,11]]},"681":{"position":[[1044,11]]},"687":{"position":[[5402,11],[5512,11],[5593,11],[5673,11]]},"688":{"position":[[5371,11],[5566,11]]},"696":{"position":[[1062,11]]}},"keywords":{}}],["assert_eq!("hello".to_str",{"_index":1090,"title":{},"content":{"42":{"position":[[2314,41]]}},"keywords":{}}],["assert_eq!(10",{"_index":1212,"title":{},"content":{"51":{"position":[[1423,14]]}},"keywords":{}}],["assert_eq!(11",{"_index":1215,"title":{},"content":{"51":{"position":[[1553,14]]}},"keywords":{}}],["assert_eq!(adder.add(1",{"_index":1981,"title":{},"content":{"143":{"position":[[1192,23]]},"328":{"position":[[1167,23]]},"537":{"position":[[1167,23]]}},"keywords":{}}],["assert_eq!(arr.len",{"_index":3848,"title":{},"content":{"613":{"position":[[1138,21]]},"721":{"position":[[1138,21]]}},"keywords":{}}],["assert_eq!(arr[0",{"_index":3849,"title":{},"content":{"613":{"position":[[1164,18]]},"721":{"position":[[1164,18]]}},"keywords":{}}],["assert_eq!(arr[1",{"_index":3851,"title":{},"content":{"613":{"position":[[1194,18]]},"721":{"position":[[1194,18]]}},"keywords":{}}],["assert_eq!(buy_ticket(&oper",{"_index":3529,"title":{},"content":{"441":{"position":[[5457,36],[5512,36]]},"688":{"position":[[5457,36],[5512,36]]}},"keywords":{}}],["assert_eq!(contract.get_valu",{"_index":2745,"title":{},"content":{"223":{"position":[[1147,32]]},"456":{"position":[[1147,32]]},"696":{"position":[[1147,32]]}},"keywords":{}}],["assert_eq!(cross_contract.add_using_anoth",{"_index":1972,"title":{},"content":{"143":{"position":[[563,46]]},"328":{"position":[[538,46]]},"537":{"position":[[538,46]]}},"keywords":{}}],["assert_eq!(erc20.allowance(&own",{"_index":2533,"title":{},"content":{"206":{"position":[[2464,38]]},"426":{"position":[[2454,38]]},"668":{"position":[[2464,38]]}},"keywords":{}}],["assert_eq!(erc20.balance_of(&own",{"_index":2530,"title":{},"content":{"206":{"position":[[2289,40]]},"426":{"position":[[2279,40]]},"668":{"position":[[2289,40]]}},"keywords":{}}],["assert_eq!(erc20.balance_of(&recipi",{"_index":2518,"title":{},"content":{"206":{"position":[[1508,44],[2933,44]]},"269":{"position":[[5418,44]]},"409":{"position":[[5418,44]]},"426":{"position":[[1503,44],[2918,44]]},"646":{"position":[[5418,44]]},"668":{"position":[[1508,44],[2933,44]]}},"keywords":{}}],["assert_eq!(erc20.decim",{"_index":2504,"title":{},"content":{"206":{"position":[[764,28]]},"269":{"position":[[4674,28]]},"409":{"position":[[4674,28]]},"426":{"position":[[764,28]]},"646":{"position":[[4674,28]]},"668":{"position":[[764,28]]}},"keywords":{}}],["assert_eq!(erc20.nam",{"_index":2503,"title":{},"content":{"206":{"position":[[720,24]]},"269":{"position":[[4630,24]]},"409":{"position":[[4630,24]]},"426":{"position":[[720,24]]},"646":{"position":[[4630,24]]},"668":{"position":[[720,24]]}},"keywords":{}}],["assert_eq!(erc20.symbol",{"_index":2502,"title":{},"content":{"206":{"position":[[672,26]]},"269":{"position":[[4582,26]]},"409":{"position":[[4582,26]]},"426":{"position":[[672,26]]},"646":{"position":[[4582,26]]},"668":{"position":[[672,26]]}},"keywords":{}}],["assert_eq!(erc20.total_suppli",{"_index":2506,"title":{},"content":{"206":{"position":[[841,32]]},"269":{"position":[[4751,32]]},"409":{"position":[[4751,32]]},"426":{"position":[[841,32]]},"646":{"position":[[4751,32]]},"668":{"position":[[841,32]]}},"keywords":{}}],["assert_eq!(modules_contract.add_using_modul",{"_index":2017,"title":{},"content":{"151":{"position":[[331,47]]},"342":{"position":[[331,47]]},"556":{"position":[[331,47]]}},"keywords":{}}],["assert_eq!(operator.balance_of",{"_index":3530,"title":{},"content":{"441":{"position":[[5661,33]]},"688":{"position":[[5661,33]]}},"keywords":{}}],["assert_eq!(ownable.get_own",{"_index":2385,"title":{},"content":{"198":{"position":[[404,31],[732,31]]},"434":{"position":[[404,31],[727,31]]},"681":{"position":[[404,31],[732,31]]}},"keywords":{}}],["assert_eq!(result",{"_index":809,"title":{},"content":{"31":{"position":[[3317,18],[3646,18]]},"73":{"position":[[729,18]]},"237":{"position":[[729,18]]},"473":{"position":[[729,18]]}},"keywords":{}}],["assert_eq!(test_env.balance_of(my_contract.address",{"_index":2039,"title":{},"content":{"160":{"position":[[408,54],[530,54],[641,54]]},"345":{"position":[[408,54],[530,54],[641,54]]},"562":{"position":[[408,54],[530,54],[641,54]]}},"keywords":{}}],["assert_eq!(test_env.events_count(&party_contract",{"_index":3063,"title":{},"content":{"330":{"position":[[696,54]]}},"keywords":{}}],["assert_eq!(test_env.events_count(party_contract.address",{"_index":2034,"title":{},"content":{"157":{"position":[[715,59]]},"547":{"position":[[715,59]]}},"keywords":{}}],["assert_eq!(token.balance_of(&env.get_account(0",{"_index":3280,"title":{},"content":{"417":{"position":[[704,53],[1066,53]]},"419":{"position":[[7119,53],[7481,53]]},"654":{"position":[[704,53],[1066,53]]},"656":{"position":[[7119,53],[7481,53]]}},"keywords":{}}],["assert_eq!(token.balance_of(&env.get_account(1",{"_index":3282,"title":{},"content":{"417":{"position":[[913,53],[1548,53]]},"419":{"position":[[7328,53],[7963,53]]},"654":{"position":[[913,53],[1548,53]]},"656":{"position":[[7328,53],[7963,53]]}},"keywords":{}}],["assert_eq!(token.total_suppli",{"_index":3283,"title":{},"content":{"417":{"position":[[986,32]]},"419":{"position":[[7401,32]]},"654":{"position":[[986,32]]},"656":{"position":[[7401,32]]}},"keywords":{}}],["assert_ev",{"_index":2925,"title":{},"content":{"268":{"position":[[2704,14]]},"408":{"position":[[2704,14]]},"645":{"position":[[2704,14]]}},"keywords":{}}],["assert_ne!(cr",{"_index":2128,"title":{},"content":{"168":{"position":[[1069,19]]},"348":{"position":[[1069,19]]},"564":{"position":[[1069,19]]}},"keywords":{}}],["assert_vote_in_progress(&self",{"_index":3317,"title":{},"content":{"419":{"position":[[6148,34]]},"656":{"position":[[6148,34]]}},"keywords":{}}],["assign",{"_index":163,"title":{},"content":{"3":{"position":[[687,6]]},"182":{"position":[[139,8]]},"189":{"position":[[438,8]]},"366":{"position":[[438,8]]},"373":{"position":[[139,8]]},"419":{"position":[[3661,7]]},"582":{"position":[[438,8]]},"589":{"position":[[139,8]]},"596":{"position":[[1219,6]]},"656":{"position":[[3661,7]]},"704":{"position":[[1219,6]]}},"keywords":{}}],["assist",{"_index":2947,"title":{},"content":{"270":{"position":[[330,6]]},"385":{"position":[[330,6]]},"410":{"position":[[330,6]]},"627":{"position":[[330,6]]},"647":{"position":[[330,6]]}},"keywords":{}}],["associ",{"_index":132,"title":{},"content":{"3":{"position":[[184,11]]},"76":{"position":[[645,11]]},"79":{"position":[[66,10]]},"85":{"position":[[54,10],[226,10]]},"92":{"position":[[61,10]]},"168":{"position":[[1736,10]]},"227":{"position":[[645,11]]},"230":{"position":[[66,10]]},"254":{"position":[[54,10],[226,10]]},"284":{"position":[[61,10]]},"348":{"position":[[1736,10]]},"458":{"position":[[645,11]]},"461":{"position":[[66,10]]},"485":{"position":[[54,10],[226,10]]},"496":{"position":[[61,10]]},"564":{"position":[[1736,10]]}},"keywords":{}}],["assum",{"_index":1232,"title":{},"content":{"52":{"position":[[339,8]]},"65":{"position":[[272,8]]},"143":{"position":[[866,8]]},"174":{"position":[[147,6]]},"240":{"position":[[272,8]]},"328":{"position":[[841,8]]},"360":{"position":[[147,6]]},"465":{"position":[[272,8]]},"537":{"position":[[841,8]]},"576":{"position":[[147,6]]}},"keywords":{}}],["ast",{"_index":1010,"title":{},"content":{"39":{"position":[[3215,4],[3258,4]]}},"keywords":{}}],["async",{"_index":2623,"title":{},"content":{"212":{"position":[[628,5],[1437,5],[2522,5],[2808,5]]},"391":{"position":[[628,5],[1437,5],[2522,5],[2814,5]]},"661":{"position":[[628,5],[1437,5],[2522,5],[2814,5]]}},"keywords":{}}],["attach",{"_index":1603,"title":{},"content":{"92":{"position":[[886,8]]},"95":{"position":[[442,8]]},"102":{"position":[[393,6]]},"103":{"position":[[41,6],[520,6]]},"284":{"position":[[886,8]]},"287":{"position":[[442,8]]},"294":{"position":[[393,6]]},"295":{"position":[[41,6],[520,6]]},"478":{"position":[[181,8]]},"496":{"position":[[886,8]]},"499":{"position":[[442,8]]},"506":{"position":[[393,6]]},"507":{"position":[[41,6],[520,6]]},"700":{"position":[[181,8]]}},"keywords":{}}],["attached_valu",{"_index":1691,"title":{},"content":{"103":{"position":[[586,14]]},"295":{"position":[[586,14]]},"507":{"position":[[586,14]]}},"keywords":{}}],["attack",{"_index":1374,"title":{},"content":{"72":{"position":[[11,7],[221,8]]},"236":{"position":[[11,7],[221,8]]},"472":{"position":[[11,7],[221,8]]}},"keywords":{}}],["attempt",{"_index":2205,"title":{},"content":{"184":{"position":[[1222,10]]},"375":{"position":[[1119,10]]},"415":{"position":[[228,7]]},"440":{"position":[[6104,8]]},"591":{"position":[[1119,10]]},"599":{"position":[[558,8]]},"652":{"position":[[228,7]]},"687":{"position":[[6104,8]]},"707":{"position":[[558,8]]}},"keywords":{}}],["attribut",{"_index":1304,"title":{"69":{"position":[[0,10]]},"74":{"position":[[7,11]]},"233":{"position":[[0,10]]},"238":{"position":[[7,11]]},"469":{"position":[[0,10]]},"474":{"position":[[7,11]]}},"content":{"53":{"position":[[265,11],[389,11],[566,11],[718,11],[1138,9],[1255,11]]},"70":{"position":[[131,9],[223,9]]},"72":{"position":[[495,9]]},"74":{"position":[[36,10],[120,11],[306,10]]},"141":{"position":[[302,10],[944,10],[960,9]]},"195":{"position":[[356,9],[384,9]]},"198":{"position":[[1834,9]]},"230":{"position":[[273,10]]},"234":{"position":[[131,9],[223,9]]},"236":{"position":[[495,9]]},"238":{"position":[[36,10],[120,11],[306,10]]},"267":{"position":[[4060,9],[4321,9]]},"275":{"position":[[56,9]]},"296":{"position":[[143,10]]},"321":{"position":[[121,10],[323,10]]},"326":{"position":[[302,10],[944,10],[960,9]]},"334":{"position":[[425,10]]},"335":{"position":[[379,10],[663,9]]},"354":{"position":[[179,10],[724,9]]},"383":{"position":[[242,9],[293,10],[493,9],[545,10],[622,10],[962,9],[1009,10]]},"407":{"position":[[4060,9],[4321,9]]},"431":{"position":[[356,9],[384,9]]},"432":{"position":[[921,9]]},"434":{"position":[[1824,9]]},"440":{"position":[[4266,9]]},"461":{"position":[[273,10]]},"470":{"position":[[131,9],[223,9]]},"472":{"position":[[495,9]]},"474":{"position":[[36,10],[120,11],[306,10]]},"492":{"position":[[56,9]]},"508":{"position":[[143,10]]},"535":{"position":[[302,10],[944,10],[960,9]]},"539":{"position":[[121,10],[323,10]]},"551":{"position":[[425,10]]},"552":{"position":[[379,10],[663,9]]},"570":{"position":[[179,10],[724,9]]},"596":{"position":[[664,10]]},"602":{"position":[[592,10],[668,9],[1927,10]]},"606":{"position":[[997,10]]},"608":{"position":[[682,9]]},"610":{"position":[[554,10]]},"611":{"position":[[893,10]]},"614":{"position":[[453,9]]},"625":{"position":[[242,9],[293,10],[493,9],[545,10],[622,10],[962,9],[1009,10]]},"644":{"position":[[4060,9],[4321,9]]},"678":{"position":[[356,9],[384,9]]},"679":{"position":[[921,9]]},"681":{"position":[[1834,9]]},"687":{"position":[[4266,9]]},"704":{"position":[[664,10]]},"710":{"position":[[592,10],[668,9],[1927,10]]},"714":{"position":[[997,10]]},"716":{"position":[[682,9]]},"718":{"position":[[554,10]]},"719":{"position":[[893,10]]},"722":{"position":[[453,9]]}},"keywords":{}}],["attribute.contract_vers",{"_index":3048,"title":{},"content":{"324":{"position":[[333,26]]},"542":{"position":[[333,26]]}},"keywords":{}}],["attribute.l10",{"_index":3330,"title":{},"content":{"432":{"position":[[1429,13]]},"679":{"position":[[1429,13]]}},"keywords":{}}],["attribute.typ",{"_index":3051,"title":{},"content":{"324":{"position":[[493,15]]},"542":{"position":[[493,15]]}},"keywords":{}}],["audit",{"_index":681,"title":{},"content":{"23":{"position":[[270,5]]}},"keywords":{}}],["auth",{"_index":2955,"title":{},"content":{"277":{"position":[[1125,4]]}},"keywords":{}}],["author",{"_index":3044,"title":{},"content":{"324":{"position":[[142,8]]},"542":{"position":[[142,8]]}},"keywords":{}}],["auto",{"_index":1246,"title":{},"content":{"52":{"position":[[796,4]]}},"keywords":{}}],["autogener",{"_index":2001,"title":{},"content":{"148":{"position":[[202,13]]},"178":{"position":[[1208,13]]},"268":{"position":[[738,13]]},"336":{"position":[[202,13]]},"369":{"position":[[1208,13]]},"408":{"position":[[738,13]]},"553":{"position":[[202,13]]},"585":{"position":[[1208,13]]},"645":{"position":[[738,13]]}},"keywords":{}}],["automat",{"_index":1370,"title":{},"content":{"71":{"position":[[654,13]]},"98":{"position":[[653,14]]},"141":{"position":[[264,14]]},"189":{"position":[[424,13]]},"235":{"position":[[654,13]]},"290":{"position":[[653,14]]},"326":{"position":[[264,14]]},"366":{"position":[[424,13]]},"471":{"position":[[654,13]]},"502":{"position":[[653,14]]},"535":{"position":[[264,14]]},"582":{"position":[[424,13]]},"596":{"position":[[1062,14]]},"704":{"position":[[1062,14]]}},"keywords":{}}],["avail",{"_index":426,"title":{"187":{"position":[[0,9]]},"364":{"position":[[0,9]]},"580":{"position":[[0,9]]}},"content":{"15":{"position":[[631,9]]},"42":{"position":[[2802,9]]},"114":{"position":[[353,9]]},"117":{"position":[[680,9]]},"131":{"position":[[582,9]]},"147":{"position":[[524,9]]},"162":{"position":[[37,9]]},"164":{"position":[[1175,9]]},"174":{"position":[[317,9]]},"257":{"position":[[353,9]]},"268":{"position":[[2977,9]]},"298":{"position":[[680,9]]},"311":{"position":[[634,9]]},"321":{"position":[[222,9]]},"323":{"position":[[29,9]]},"335":{"position":[[528,9]]},"351":{"position":[[37,9]]},"353":{"position":[[1210,9]]},"360":{"position":[[317,9]]},"408":{"position":[[2977,9]]},"440":{"position":[[457,10],[2694,9],[4393,9]]},"480":{"position":[[353,9]]},"519":{"position":[[680,9]]},"528":{"position":[[634,9]]},"539":{"position":[[222,9]]},"541":{"position":[[29,9]]},"552":{"position":[[528,9]]},"567":{"position":[[37,9]]},"569":{"position":[[1210,9]]},"576":{"position":[[317,9]]},"598":{"position":[[2089,9]]},"600":{"position":[[733,9],[994,9]]},"645":{"position":[[2977,9]]},"687":{"position":[[457,10],[2694,9],[4393,9]]},"706":{"position":[[2089,9]]},"708":{"position":[[733,9],[994,9]]}},"keywords":{}}],["avoid",{"_index":3716,"title":{},"content":{"601":{"position":[[2146,5]]},"709":{"position":[[2146,5]]}},"keywords":{}}],["await",{"_index":2629,"title":{},"content":{"212":{"position":[[810,6],[1187,6]]},"391":{"position":[[810,6],[1187,6]]},"661":{"position":[[810,6],[1187,6]]}},"keywords":{}}],["awar",{"_index":421,"title":{},"content":{"15":{"position":[[466,5]]},"601":{"position":[[2064,5]]},"709":{"position":[[2064,5]]}},"keywords":{}}],["awesom",{"_index":388,"title":{},"content":{"12":{"position":[[310,7]]}},"keywords":{}}],["b",{"_index":234,"title":{},"content":{"8":{"position":[[136,1],[171,1],[365,2],[463,1]]},"9":{"position":[[76,1],[159,2],[494,1],[815,2]]},"30":{"position":[[221,2],[267,2]]},"42":{"position":[[2615,1]]},"43":{"position":[[878,1]]},"51":{"position":[[1715,1],[1934,1]]},"96":{"position":[[128,1],[210,1]]},"100":{"position":[[177,1]]},"101":{"position":[[109,1]]},"119":{"position":[[351,1],[1159,1]]},"120":{"position":[[271,1]]},"175":{"position":[[447,1]]},"179":{"position":[[80,1]]},"288":{"position":[[128,1],[210,1]]},"292":{"position":[[177,1]]},"293":{"position":[[109,1]]},"300":{"position":[[351,1],[1159,1]]},"301":{"position":[[271,1]]},"361":{"position":[[447,1]]},"370":{"position":[[80,1]]},"417":{"position":[[1697,1]]},"500":{"position":[[128,1],[210,1]]},"504":{"position":[[177,1]]},"505":{"position":[[109,1]]},"521":{"position":[[351,1],[1159,1]]},"522":{"position":[[271,1]]},"577":{"position":[[447,1]]},"586":{"position":[[80,1]]},"612":{"position":[[611,1],[660,1],[909,2],[1066,2],[1246,2]]},"654":{"position":[[1697,1]]},"720":{"position":[[611,1],[660,1],[909,2],[1066,2],[1246,2]]}},"keywords":{}}],["back",{"_index":63,"title":{},"content":{"1":{"position":[[815,4]]},"2":{"position":[[269,5]]},"164":{"position":[[6,4]]},"223":{"position":[[1354,4]]},"353":{"position":[[6,4]]},"416":{"position":[[4175,4]]},"419":{"position":[[5754,4]]},"456":{"position":[[1354,4]]},"569":{"position":[[6,4]]},"653":{"position":[[4175,4]]},"656":{"position":[[5754,4]]},"696":{"position":[[1354,4]]}},"keywords":{}}],["backend",{"_index":776,"title":{"109":{"position":[[10,8]]},"128":{"position":[[12,7]]},"279":{"position":[[12,7]]},"304":{"position":[[10,8]]},"509":{"position":[[10,8]]},"516":{"position":[[12,7]]}},"content":{"31":{"position":[[1974,7]]},"50":{"position":[[448,8]]},"67":{"position":[[52,7],[95,8]]},"68":{"position":[[91,7]]},"90":{"position":[[18,8],[34,7]]},"96":{"position":[[19,7]]},"106":{"position":[[26,7]]},"107":{"position":[[271,8]]},"108":{"position":[[16,7]]},"110":{"position":[[49,7],[387,8]]},"111":{"position":[[110,7]]},"112":{"position":[[23,8]]},"119":{"position":[[310,7],[1133,8]]},"126":{"position":[[15,8],[1363,8],[1523,8],[2079,8],[2315,8],[2531,8]]},"128":{"position":[[214,7]]},"129":{"position":[[61,8]]},"142":{"position":[[163,8]]},"175":{"position":[[401,8]]},"199":{"position":[[68,8]]},"242":{"position":[[52,7],[96,8]]},"243":{"position":[[91,7]]},"273":{"position":[[26,7]]},"274":{"position":[[271,8]]},"275":{"position":[[16,7]]},"277":{"position":[[15,8],[1531,8],[1691,8],[2247,8],[2483,8],[2699,8]]},"279":{"position":[[214,7]]},"280":{"position":[[61,8]]},"282":{"position":[[18,8],[34,7]]},"288":{"position":[[19,7]]},"300":{"position":[[310,7],[1133,8]]},"305":{"position":[[49,7],[387,8]]},"306":{"position":[[110,7]]},"307":{"position":[[23,8]]},"327":{"position":[[163,8]]},"361":{"position":[[401,8]]},"393":{"position":[[554,8]]},"398":{"position":[[96,7]]},"435":{"position":[[68,8]]},"467":{"position":[[52,7],[96,8]]},"468":{"position":[[91,7]]},"477":{"position":[[572,8]]},"478":{"position":[[360,7]]},"490":{"position":[[26,7]]},"491":{"position":[[271,8]]},"492":{"position":[[16,7]]},"494":{"position":[[18,8],[34,7]]},"500":{"position":[[19,7]]},"510":{"position":[[49,7],[387,8]]},"511":{"position":[[110,7]]},"512":{"position":[[23,8]]},"514":{"position":[[15,8],[1363,8],[1523,8],[2079,8],[2315,8],[2531,8]]},"516":{"position":[[214,7]]},"517":{"position":[[61,8]]},"521":{"position":[[310,7],[1133,8]]},"536":{"position":[[163,8]]},"577":{"position":[[401,8]]},"630":{"position":[[554,8]]},"635":{"position":[[96,7]]},"682":{"position":[[68,8]]},"699":{"position":[[572,8]]},"700":{"position":[[360,7]]}},"keywords":{}}],["background",{"_index":1783,"title":{},"content":{"119":{"position":[[910,10]]},"300":{"position":[[910,10]]},"521":{"position":[[910,10]]}},"keywords":{}}],["badg",{"_index":3300,"title":{},"content":{"419":{"position":[[1832,6]]},"656":{"position":[[1832,6]]}},"keywords":{}}],["balanc",{"_index":145,"title":{},"content":{"3":{"position":[[400,7]]},"17":{"position":[[1758,8],[2102,9]]},"31":{"position":[[1570,8],[1864,8]]},"72":{"position":[[300,7]]},"84":{"position":[[258,9]]},"85":{"position":[[542,9],[643,9]]},"94":{"position":[[586,8],[648,7]]},"126":{"position":[[3272,8],[3346,8]]},"127":{"position":[[527,8],[553,8]]},"168":{"position":[[1713,7]]},"203":{"position":[[260,9]]},"206":{"position":[[1363,7],[1488,7],[1848,8]]},"236":{"position":[[300,7]]},"253":{"position":[[258,9]]},"254":{"position":[[542,9],[643,9]]},"267":{"position":[[668,7]]},"269":{"position":[[428,9],[5273,7],[5398,7],[5758,8]]},"277":{"position":[[3440,8],[3514,8]]},"278":{"position":[[527,8],[553,8]]},"286":{"position":[[586,8],[648,7]]},"348":{"position":[[1713,7]]},"384":{"position":[[441,9]]},"395":{"position":[[1563,9],[1596,8],[1683,8],[6640,8],[6673,8]]},"407":{"position":[[668,7]]},"409":{"position":[[428,9],[5273,7],[5398,7],[5758,8]]},"416":{"position":[[4669,7]]},"419":{"position":[[2636,7]]},"423":{"position":[[260,9]]},"426":{"position":[[1358,7],[1483,7],[1838,8]]},"440":{"position":[[4765,7]]},"472":{"position":[[300,7]]},"476":{"position":[[277,9],[1312,7]]},"477":{"position":[[2057,8],[2227,8],[3394,8],[3776,8],[3958,7]]},"484":{"position":[[258,9]]},"485":{"position":[[542,9],[643,9]]},"498":{"position":[[586,8],[648,7]]},"514":{"position":[[3272,8],[3346,8]]},"515":{"position":[[527,8],[553,8]]},"564":{"position":[[1713,7]]},"611":{"position":[[414,7],[454,7]]},"626":{"position":[[441,9]]},"632":{"position":[[1563,9],[1596,8],[1683,8],[6640,8],[6673,8]]},"644":{"position":[[668,7]]},"646":{"position":[[428,9],[5273,7],[5398,7],[5758,8]]},"653":{"position":[[4669,7]]},"656":{"position":[[2636,7]]},"665":{"position":[[260,9]]},"668":{"position":[[1363,7],[1488,7],[1848,8]]},"687":{"position":[[4765,7]]},"698":{"position":[[277,9],[1312,7]]},"699":{"position":[[2057,8],[2227,8],[3394,8],[3776,8],[3958,7]]},"719":{"position":[[414,7],[454,7]]}},"keywords":{}}],["balance_of",{"_index":1860,"title":{},"content":{"127":{"position":[[807,10]]},"128":{"position":[[396,10]]},"160":{"position":[[99,11]]},"278":{"position":[[807,10]]},"279":{"position":[[396,10]]},"345":{"position":[[99,11]]},"515":{"position":[[807,10]]},"516":{"position":[[396,10]]},"562":{"position":[[99,11]]}},"keywords":{}}],["balance_of(&mut",{"_index":1489,"title":{},"content":{"80":{"position":[[527,19]]},"231":{"position":[[527,19]]},"462":{"position":[[527,19]]}},"keywords":{}}],["balance_of(&self",{"_index":528,"title":{},"content":{"17":{"position":[[2593,21]]},"115":{"position":[[959,21],[2551,21]]},"168":{"position":[[1643,21]]},"205":{"position":[[934,21]]},"247":{"position":[[578,21]]},"258":{"position":[[917,21],[2489,21]]},"267":{"position":[[3884,21]]},"348":{"position":[[1643,21]]},"407":{"position":[[3884,21]]},"419":{"position":[[2669,21]]},"425":{"position":[[909,21]]},"440":{"position":[[3251,21]]},"441":{"position":[[1533,21]]},"446":{"position":[[578,21]]},"481":{"position":[[917,21],[2489,21]]},"564":{"position":[[1643,21]]},"644":{"position":[[3884,21]]},"656":{"position":[[2669,21]]},"667":{"position":[[909,21]]},"673":{"position":[[578,21]]},"687":{"position":[[3251,21]]},"688":{"position":[[1533,21]]}},"keywords":{}}],["ballot",{"_index":3226,"title":{},"content":{"416":{"position":[[770,6],[820,6],[1200,8],[2607,7]]},"417":{"position":[[557,6]]},"419":{"position":[[182,6],[232,6],[6972,6]]},"653":{"position":[[770,6],[820,6],[1200,8],[2607,7]]},"654":{"position":[[557,6]]},"656":{"position":[[182,6],[232,6],[6972,6]]}},"keywords":{}}],["bar",{"_index":3083,"title":{},"content":{"354":{"position":[[616,3]]},"396":{"position":[[134,3]]},"570":{"position":[[616,3]]},"633":{"position":[[134,3]]}},"keywords":{}}],["bark",{"_index":2050,"title":{},"content":{"162":{"position":[[372,6],[791,6]]},"351":{"position":[[409,6],[813,6]]},"567":{"position":[[409,6],[813,6]]}},"keywords":{}}],["barks(&self",{"_index":2060,"title":{},"content":{"162":{"position":[[956,16]]},"351":{"position":[[978,16]]},"567":{"position":[[978,16]]}},"keywords":{}}],["base",{"_index":175,"title":{},"content":{"5":{"position":[[132,5]]},"7":{"position":[[103,5]]},"16":{"position":[[88,5]]},"20":{"position":[[455,5],[597,5],[644,5]]},"22":{"position":[[401,5],[749,5]]},"31":{"position":[[336,5]]},"39":{"position":[[776,5],[1413,5]]},"189":{"position":[[62,5]]},"366":{"position":[[62,5]]},"582":{"position":[[62,5]]},"594":{"position":[[86,5]]},"595":{"position":[[155,5]]},"612":{"position":[[1561,4]]},"617":{"position":[[1327,5]]},"702":{"position":[[86,5]]},"703":{"position":[[155,5]]},"720":{"position":[[1561,4]]},"725":{"position":[[1327,5]]}},"keywords":{}}],["basic",{"_index":1411,"title":{"76":{"position":[[10,5]]},"227":{"position":[[10,5]]},"458":{"position":[[10,5]]}},"content":{"76":{"position":[[61,5],[109,5],[945,5]]},"78":{"position":[[26,5]]},"115":{"position":[[23,5],[1611,9]]},"128":{"position":[[441,10]]},"180":{"position":[[53,5]]},"195":{"position":[[219,6]]},"227":{"position":[[61,5],[109,5],[945,5]]},"229":{"position":[[26,5]]},"258":{"position":[[23,5],[1557,9]]},"279":{"position":[[441,10]]},"371":{"position":[[53,5]]},"431":{"position":[[219,6]]},"458":{"position":[[61,5],[109,5],[945,5]]},"460":{"position":[[26,5]]},"481":{"position":[[23,5],[1557,9]]},"516":{"position":[[441,10]]},"587":{"position":[[53,5]]},"594":{"position":[[304,6]]},"596":{"position":[[110,5]]},"610":{"position":[[950,6]]},"618":{"position":[[469,6]]},"678":{"position":[[219,6]]},"702":{"position":[[304,6]]},"704":{"position":[[110,5]]},"718":{"position":[[950,6]]},"726":{"position":[[469,6]]}},"keywords":{}}],["battl",{"_index":84,"title":{},"content":{"1":{"position":[[1063,6]]}},"keywords":{}}],["battlefield",{"_index":1224,"title":{},"content":{"52":{"position":[[83,11]]}},"keywords":{}}],["battleship",{"_index":383,"title":{},"content":{"12":{"position":[[163,10]]}},"keywords":{}}],["baz",{"_index":3084,"title":{},"content":{"354":{"position":[[625,3]]},"570":{"position":[[625,3]]}},"keywords":{}}],["be",{"_index":251,"title":{},"content":{"8":{"position":[[539,5]]},"39":{"position":[[57,5]]},"43":{"position":[[1884,5]]},"72":{"position":[[76,5]]},"86":{"position":[[7,5]]},"91":{"position":[[325,5]]},"236":{"position":[[76,5]]},"255":{"position":[[7,5]]},"283":{"position":[[325,5]]},"472":{"position":[[76,5]]},"486":{"position":[[7,5]]},"495":{"position":[[325,5]]}},"keywords":{}}],["beauti",{"_index":1218,"title":{},"content":{"51":{"position":[[1643,6]]}},"keywords":{}}],["becom",{"_index":81,"title":{},"content":{"1":{"position":[[1001,6]]},"22":{"position":[[339,6]]},"115":{"position":[[3106,7]]},"258":{"position":[[3032,7]]},"481":{"position":[[3032,7]]}},"keywords":{}}],["befor",{"_index":182,"title":{},"content":{"5":{"position":[[220,7]]},"52":{"position":[[432,6]]},"72":{"position":[[104,6],[321,6]]},"76":{"position":[[0,6]]},"86":{"position":[[0,6]]},"95":{"position":[[51,6]]},"102":{"position":[[227,6]]},"127":{"position":[[148,6]]},"182":{"position":[[0,6]]},"185":{"position":[[3106,6]]},"194":{"position":[[0,6]]},"195":{"position":[[226,6]]},"196":{"position":[[805,6],[866,6]]},"227":{"position":[[0,6]]},"236":{"position":[[104,6],[321,6]]},"255":{"position":[[0,6]]},"261":{"position":[[0,6]]},"262":{"position":[[0,6]]},"265":{"position":[[400,6]]},"267":{"position":[[880,6]]},"269":{"position":[[57,6]]},"278":{"position":[[148,6]]},"287":{"position":[[51,6]]},"294":{"position":[[227,6]]},"373":{"position":[[0,6]]},"376":{"position":[[3090,6]]},"379":{"position":[[0,6]]},"380":{"position":[[0,6]]},"384":{"position":[[57,6]]},"395":{"position":[[6758,6]]},"401":{"position":[[0,6]]},"402":{"position":[[0,6]]},"405":{"position":[[400,6]]},"407":{"position":[[880,6]]},"409":{"position":[[57,6]]},"430":{"position":[[0,6]]},"431":{"position":[[226,6]]},"432":{"position":[[743,6],[804,6]]},"458":{"position":[[0,6]]},"472":{"position":[[104,6],[321,6]]},"477":{"position":[[0,6]]},"486":{"position":[[0,6]]},"499":{"position":[[51,6]]},"506":{"position":[[227,6]]},"515":{"position":[[148,6]]},"589":{"position":[[0,6]]},"592":{"position":[[3090,6]]},"594":{"position":[[414,6]]},"606":{"position":[[666,6],[770,6]]},"621":{"position":[[0,6]]},"622":{"position":[[0,6]]},"626":{"position":[[57,6]]},"632":{"position":[[6758,6]]},"638":{"position":[[0,6]]},"639":{"position":[[0,6]]},"642":{"position":[[400,6]]},"644":{"position":[[880,6]]},"646":{"position":[[57,6]]},"677":{"position":[[0,6]]},"678":{"position":[[226,6]]},"679":{"position":[[743,6],[804,6]]},"699":{"position":[[0,6]]},"702":{"position":[[414,6]]},"714":{"position":[[666,6],[770,6]]}},"keywords":{}}],["begin",{"_index":1973,"title":{},"content":{"143":{"position":[[629,6]]},"168":{"position":[[1131,9]]},"261":{"position":[[11,5]]},"328":{"position":[[604,6]]},"348":{"position":[[1131,9]]},"379":{"position":[[11,5]]},"401":{"position":[[11,5]]},"537":{"position":[[604,6]]},"564":{"position":[[1131,9]]},"594":{"position":[[490,10]]},"621":{"position":[[11,5]]},"638":{"position":[[11,5]]},"702":{"position":[[490,10]]}},"keywords":{}}],["behalf",{"_index":2206,"title":{},"content":{"184":{"position":[[1265,7]]},"202":{"position":[[302,6]]},"375":{"position":[[1162,7]]},"419":{"position":[[2947,6]]},"422":{"position":[[302,6]]},"441":{"position":[[146,6],[1451,6],[1869,6]]},"591":{"position":[[1162,7]]},"656":{"position":[[2947,6]]},"664":{"position":[[302,6]]},"688":{"position":[[146,6],[1451,6],[1869,6]]}},"keywords":{}}],["behalf.each",{"_index":2174,"title":{},"content":{"182":{"position":[[314,11]]},"373":{"position":[[314,11]]},"589":{"position":[[314,11]]}},"keywords":{}}],["behavior",{"_index":2093,"title":{},"content":{"163":{"position":[[1273,8]]},"352":{"position":[[1295,8]]},"568":{"position":[[1295,8]]},"612":{"position":[[202,8]]},"720":{"position":[[202,8]]}},"keywords":{}}],["behind",{"_index":1595,"title":{},"content":{"92":{"position":[[538,6]]},"284":{"position":[[538,6]]},"496":{"position":[[538,6]]}},"keywords":{}}],["believ",{"_index":66,"title":{},"content":{"1":{"position":[[847,7]]},"22":{"position":[[684,7]]}},"keywords":{}}],["below",{"_index":235,"title":{},"content":{"8":{"position":[[138,5]]},"31":{"position":[[2818,5]]},"265":{"position":[[348,5]]},"405":{"position":[[348,5]]},"441":{"position":[[260,5]]},"642":{"position":[[348,5]]},"688":{"position":[[260,5]]}},"keywords":{}}],["benchmark",{"_index":722,"title":{},"content":{"31":{"position":[[355,9]]}},"keywords":{}}],["bend",{"_index":448,"title":{},"content":{"17":{"position":[[15,4]]}},"keywords":{}}],["benefici",{"_index":1443,"title":{},"content":{"79":{"position":[[386,10]]},"230":{"position":[[403,10]]},"461":{"position":[[403,10]]}},"keywords":{}}],["besid",{"_index":1584,"title":{},"content":{"91":{"position":[[544,7]]},"154":{"position":[[0,7]]},"283":{"position":[[544,7]]},"339":{"position":[[0,7]]},"396":{"position":[[388,7]]},"495":{"position":[[544,7]]},"559":{"position":[[0,7]]},"633":{"position":[[388,7]]}},"keywords":{}}],["best",{"_index":30,"title":{},"content":{"1":{"position":[[329,4],[707,4]]},"20":{"position":[[374,4]]}},"keywords":{}}],["better",{"_index":936,"title":{},"content":{"39":{"position":[[1011,7]]},"88":{"position":[[346,6]]},"97":{"position":[[253,6]]},"115":{"position":[[41,6]]},"168":{"position":[[1548,6]]},"250":{"position":[[346,6]]},"258":{"position":[[41,6]]},"289":{"position":[[253,6]]},"348":{"position":[[1548,6]]},"481":{"position":[[41,6]]},"488":{"position":[[346,6]]},"501":{"position":[[253,6]]},"564":{"position":[[1548,6]]},"601":{"position":[[2136,6]]},"709":{"position":[[2136,6]]}},"keywords":{}}],["between",{"_index":146,"title":{},"content":{"3":{"position":[[408,7]]},"39":{"position":[[892,7]]},"92":{"position":[[412,7]]},"126":{"position":[[2065,7]]},"128":{"position":[[685,7]]},"129":{"position":[[113,7]]},"145":{"position":[[151,7]]},"146":{"position":[[343,7]]},"277":{"position":[[2233,7]]},"279":{"position":[[685,7]]},"280":{"position":[[113,7]]},"284":{"position":[[412,7]]},"333":{"position":[[151,7]]},"334":{"position":[[343,7]]},"346":{"position":[[96,7]]},"496":{"position":[[412,7]]},"514":{"position":[[2065,7]]},"516":{"position":[[685,7]]},"517":{"position":[[113,7]]},"550":{"position":[[151,7]]},"551":{"position":[[343,7]]},"612":{"position":[[88,7],[357,7],[2138,7]]},"616":{"position":[[1169,7]]},"720":{"position":[[88,7],[357,7],[2138,7]]},"724":{"position":[[1169,7]]}},"keywords":{}}],["bewar",{"_index":3303,"title":{},"content":{"419":{"position":[[2092,7]]},"656":{"position":[[2092,7]]}},"keywords":{}}],["beyond",{"_index":560,"title":{},"content":{"18":{"position":[[437,7]]}},"keywords":{}}],["big",{"_index":2603,"title":{},"content":{"211":{"position":[[601,3]]},"212":{"position":[[3593,3]]},"267":{"position":[[307,3]]},"390":{"position":[[575,3]]},"391":{"position":[[3611,3]]},"407":{"position":[[307,3]]},"644":{"position":[[307,3]]},"660":{"position":[[575,3]]},"661":{"position":[[3611,3]]}},"keywords":{}}],["bigger",{"_index":1176,"title":{},"content":{"44":{"position":[[257,6]]}},"keywords":{}}],["biggest",{"_index":2092,"title":{},"content":{"163":{"position":[[1046,7]]},"352":{"position":[[1068,7]]},"568":{"position":[[1068,7]]},"598":{"position":[[310,7],[436,7]]},"706":{"position":[[310,7],[436,7]]}},"keywords":{}}],["bin",{"_index":701,"title":{"134":{"position":[[0,5]]},"264":{"position":[[8,3]]},"314":{"position":[[0,5]]},"382":{"position":[[27,4]]},"404":{"position":[[8,3]]},"531":{"position":[[0,5]]},"624":{"position":[[27,4]]},"641":{"position":[[8,3]]}},"content":{"30":{"position":[[489,3]]},"65":{"position":[[151,3]]},"68":{"position":[[289,3]]},"126":{"position":[[3516,5]]},"127":{"position":[[102,3]]},"129":{"position":[[596,3]]},"131":{"position":[[224,7],[327,7]]},"240":{"position":[[151,3]]},"243":{"position":[[289,3]]},"264":{"position":[[157,3],[252,3]]},"265":{"position":[[186,4],[626,7],[733,7]]},"277":{"position":[[3684,5]]},"278":{"position":[[102,3]]},"280":{"position":[[596,3]]},"311":{"position":[[276,7],[379,7]]},"395":{"position":[[199,3],[3181,7],[3285,7],[3385,7],[4398,3]]},"404":{"position":[[157,3],[252,3]]},"405":{"position":[[186,4],[626,7],[733,7]]},"465":{"position":[[151,3]]},"468":{"position":[[289,3]]},"477":{"position":[[1115,7],[2514,3]]},"514":{"position":[[3516,5]]},"515":{"position":[[102,3]]},"517":{"position":[[596,3]]},"528":{"position":[[276,7],[379,7]]},"632":{"position":[[199,3],[3181,7],[3285,7],[3385,7],[4398,3]]},"641":{"position":[[157,3],[252,3]]},"642":{"position":[[186,4],[626,7],[733,7]]},"699":{"position":[[1115,7],[2514,3]]}},"keywords":{}}],["bin/bash",{"_index":3553,"title":{},"content":{"477":{"position":[[370,9]]},"699":{"position":[[370,9]]}},"keywords":{}}],["bin/our_token_livenet.r",{"_index":3119,"title":{},"content":{"395":{"position":[[211,24]]},"632":{"position":[[211,24]]}},"keywords":{}}],["binari",{"_index":1807,"title":{},"content":{"126":{"position":[[1201,6],[3433,7]]},"127":{"position":[[49,6],[169,7]]},"277":{"position":[[1369,6],[3601,7]]},"278":{"position":[[49,6],[169,7]]},"395":{"position":[[2491,7]]},"514":{"position":[[1201,6],[3433,7]]},"515":{"position":[[49,6],[169,7]]},"632":{"position":[[2491,7]]}},"keywords":{}}],["bind",{"_index":618,"title":{},"content":{"20":{"position":[[1080,4]]},"248":{"position":[[279,8]]},"447":{"position":[[279,8]]},"674":{"position":[[279,8]]}},"keywords":{}}],["binding.l10",{"_index":2338,"title":{},"content":{"196":{"position":[[1079,11]]}},"keywords":{}}],["binding.l4",{"_index":3326,"title":{},"content":{"432":{"position":[[1024,10]]},"679":{"position":[[1024,10]]}},"keywords":{}}],["birch",{"_index":725,"title":{},"content":{"31":{"position":[[394,5]]}},"keywords":{}}],["bit",{"_index":562,"title":{"20":{"position":[[2,3]]}},"content":{"20":{"position":[[1023,3]]},"31":{"position":[[3048,3]]}},"keywords":{}}],["blake2::digest::variableoutput>::new(32",{"_index":2674,"title":{},"content":{"212":{"position":[[4155,43]]},"391":{"position":[[4173,43]]},"661":{"position":[[4173,43]]}},"keywords":{}}],["blake2::digest::variableoutput::finalize_variable(hash",{"_index":2678,"title":{},"content":{"212":{"position":[[4297,57]]},"391":{"position":[[4315,57]]},"661":{"position":[[4315,57]]}},"keywords":{}}],["blake2b",{"_index":2664,"title":{},"content":{"212":{"position":[[3705,7]]},"391":{"position":[[3723,7]]},"616":{"position":[[1320,7]]},"661":{"position":[[3723,7]]},"724":{"position":[[1320,7]]}},"keywords":{}}],["blake2b(&key",{"_index":2669,"title":{},"content":{"212":{"position":[[3988,18]]},"391":{"position":[[4006,18]]},"661":{"position":[[4006,18]]}},"keywords":{}}],["blake2b(byt",{"_index":2671,"title":{},"content":{"212":{"position":[[4041,14]]},"391":{"position":[[4059,14]]},"661":{"position":[[4059,14]]}},"keywords":{}}],["blake2b.return",{"_index":2607,"title":{},"content":{"211":{"position":[[701,14]]},"390":{"position":[[675,14]]},"660":{"position":[[675,14]]}},"keywords":{}}],["blank",{"_index":1030,"title":{},"content":{"42":{"position":[[229,5]]},"117":{"position":[[609,5],[645,5]]},"298":{"position":[[609,5],[645,5]]},"519":{"position":[[609,5],[645,5]]}},"keywords":{}}],["block",{"_index":880,"title":{},"content":{"38":{"position":[[746,5]]},"44":{"position":[[246,5]]},"72":{"position":[[395,5]]},"76":{"position":[[470,5],[780,7]]},"95":{"position":[[420,5]]},"110":{"position":[[582,5]]},"111":{"position":[[356,5]]},"147":{"position":[[93,5]]},"178":{"position":[[377,5]]},"185":{"position":[[2932,5],[3008,5]]},"204":{"position":[[1013,6]]},"221":{"position":[[469,5]]},"227":{"position":[[470,5],[780,7]]},"236":{"position":[[395,5]]},"287":{"position":[[420,5]]},"305":{"position":[[582,5]]},"306":{"position":[[356,5]]},"335":{"position":[[93,5]]},"369":{"position":[[377,5]]},"376":{"position":[[2916,5],[2992,5]]},"395":{"position":[[1276,5]]},"396":{"position":[[58,5]]},"398":{"position":[[167,5]]},"419":{"position":[[1217,5]]},"424":{"position":[[964,6]]},"454":{"position":[[469,5]]},"458":{"position":[[470,5],[780,7]]},"472":{"position":[[395,5]]},"499":{"position":[[420,5]]},"510":{"position":[[582,5]]},"511":{"position":[[356,5]]},"552":{"position":[[93,5]]},"585":{"position":[[377,5]]},"592":{"position":[[2916,5],[2992,5]]},"604":{"position":[[79,6]]},"607":{"position":[[173,5],[254,5]]},"632":{"position":[[1276,5]]},"633":{"position":[[58,5]]},"635":{"position":[[167,5]]},"656":{"position":[[1217,5]]},"666":{"position":[[964,6]]},"694":{"position":[[469,5]]},"712":{"position":[[79,6]]},"715":{"position":[[173,5],[254,5]]}},"keywords":{}}],["block"",{"_index":1250,"title":{},"content":{"52":{"position":[[839,11]]}},"keywords":{}}],["block_base_fee_per_ga",{"_index":759,"title":{},"content":{"31":{"position":[[1278,23]]}},"keywords":{}}],["block_coinbas",{"_index":753,"title":{},"content":{"31":{"position":[[1107,15]]}},"keywords":{}}],["block_difficulti",{"_index":755,"title":{},"content":{"31":{"position":[[1180,17]]}},"keywords":{}}],["block_gas_limit",{"_index":756,"title":{},"content":{"31":{"position":[[1218,16]]}},"keywords":{}}],["block_hash",{"_index":749,"title":{},"content":{"31":{"position":[[1047,13]]}},"keywords":{}}],["block_numb",{"_index":751,"title":{},"content":{"31":{"position":[[1073,13]]}},"keywords":{}}],["block_tim",{"_index":2031,"title":{},"content":{"157":{"position":[[495,11]]},"330":{"position":[[481,11]]},"547":{"position":[[495,11]]}},"keywords":{}}],["block_timefn",{"_index":2138,"title":{},"content":{"168":{"position":[[1851,12]]},"348":{"position":[[1851,12]]},"564":{"position":[[1851,12]]}},"keywords":{}}],["block_timestamp",{"_index":754,"title":{},"content":{"31":{"position":[[1143,16]]}},"keywords":{}}],["blockchain",{"_index":169,"title":{},"content":{"5":{"position":[[68,12]]},"20":{"position":[[226,10],[461,10],[603,10],[650,11]]},"21":{"position":[[15,10]]},"22":{"position":[[407,12]]},"38":{"position":[[885,10],[948,11],[1006,12]]},"50":{"position":[[71,10],[219,11],[472,11]]},"52":{"position":[[532,10]]},"97":{"position":[[79,11]]},"107":{"position":[[317,11],[442,10]]},"110":{"position":[[102,10],[487,10]]},"111":{"position":[[219,10]]},"119":{"position":[[761,10]]},"126":{"position":[[1601,11]]},"127":{"position":[[667,10]]},"128":{"position":[[46,10],[155,10],[270,10]]},"136":{"position":[[128,11]]},"141":{"position":[[827,11]]},"143":{"position":[[665,11]]},"145":{"position":[[87,11]]},"146":{"position":[[596,11],[736,11]]},"147":{"position":[[1422,11]]},"162":{"position":[[133,10],[2013,10]]},"198":{"position":[[2601,10]]},"274":{"position":[[317,11],[442,10]]},"277":{"position":[[1769,11]]},"278":{"position":[[667,10]]},"279":{"position":[[46,10],[155,10],[270,10]]},"289":{"position":[[79,11]]},"300":{"position":[[761,10]]},"305":{"position":[[102,10],[487,10]]},"306":{"position":[[219,10]]},"316":{"position":[[128,11]]},"326":{"position":[[827,11]]},"328":{"position":[[640,11]]},"333":{"position":[[87,11]]},"334":{"position":[[600,11],[740,11]]},"335":{"position":[[1430,11]]},"351":{"position":[[133,10],[2035,10]]},"434":{"position":[[2591,10]]},"491":{"position":[[317,11],[442,10]]},"501":{"position":[[79,11]]},"510":{"position":[[102,10],[487,10]]},"511":{"position":[[219,10]]},"514":{"position":[[1601,11]]},"515":{"position":[[667,10]]},"516":{"position":[[46,10],[155,10],[270,10]]},"521":{"position":[[761,10]]},"533":{"position":[[128,11]]},"535":{"position":[[827,11]]},"537":{"position":[[640,11]]},"550":{"position":[[87,11]]},"551":{"position":[[600,11],[740,11]]},"552":{"position":[[1430,11]]},"567":{"position":[[133,10],[2035,10]]},"600":{"position":[[603,10],[709,10],[838,11]]},"606":{"position":[[1044,10]]},"618":{"position":[[274,10]]},"681":{"position":[[2601,10]]},"708":{"position":[[603,10],[709,10],[838,11]]},"714":{"position":[[1044,10]]},"726":{"position":[[274,10]]}},"keywords":{}}],["blockchain'",{"_index":1987,"title":{},"content":{"145":{"position":[[262,12]]},"333":{"position":[[262,12]]},"550":{"position":[[262,12]]}},"keywords":{}}],["blog",{"_index":13,"title":{},"content":{"1":{"position":[[120,4]]}},"keywords":{}}],["blow",{"_index":402,"title":{},"content":{"15":{"position":[[114,7]]}},"keywords":{}}],["bob",{"_index":3066,"title":{},"content":{"346":{"position":[[198,4]]}},"keywords":{}}],["bodi",{"_index":3770,"title":{},"content":{"606":{"position":[[938,4]]},"714":{"position":[[938,4]]}},"keywords":{}}],["boo",{"_index":3624,"title":{},"content":{"598":{"position":[[190,4]]},"601":{"position":[[940,4]]},"706":{"position":[[190,4]]},"709":{"position":[[940,4]]}},"keywords":{}}],["bool",{"_index":480,"title":{},"content":{"17":{"position":[[768,5],[958,4]]},"22":{"position":[[1221,5],[1342,4]]},"79":{"position":[[215,5]]},"98":{"position":[[275,4],[414,4]]},"147":{"position":[[1108,5]]},"162":{"position":[[798,5],[979,4]]},"168":{"position":[[2141,4]]},"178":{"position":[[695,5],[978,4]]},"185":{"position":[[596,4]]},"220":{"position":[[66,5]]},"221":{"position":[[107,4]]},"230":{"position":[[215,5]]},"290":{"position":[[275,4],[414,4]]},"335":{"position":[[1116,5]]},"348":{"position":[[2151,4]]},"351":{"position":[[820,5],[1001,4]]},"369":{"position":[[695,5],[978,4]]},"376":{"position":[[580,4]]},"416":{"position":[[853,5],[2695,5]]},"419":{"position":[[265,5],[4650,5]]},"441":{"position":[[3606,4]]},"453":{"position":[[66,5]]},"454":{"position":[[107,4]]},"461":{"position":[[215,5]]},"502":{"position":[[275,4],[414,4]]},"552":{"position":[[1116,5]]},"564":{"position":[[2141,4]]},"567":{"position":[[820,5],[1001,4]]},"585":{"position":[[695,5],[978,4]]},"592":{"position":[[580,4]]},"598":{"position":[[1185,4]]},"601":{"position":[[818,4],[945,5]]},"602":{"position":[[1037,5]]},"616":{"position":[[1014,4]]},"653":{"position":[[853,5],[2695,5]]},"656":{"position":[[265,5],[4650,5]]},"688":{"position":[[3606,4]]},"693":{"position":[[66,5]]},"694":{"position":[[107,4]]},"706":{"position":[[1185,4]]},"709":{"position":[[818,4],[945,5]]},"710":{"position":[[1037,5]]},"724":{"position":[[1014,4]]}},"keywords":{}}],["bool>",{"_index":2215,"title":{},"content":{"185":{"position":[[436,9]]},"376":{"position":[[420,9]]},"592":{"position":[[420,9]]}},"keywords":{}}],["boolean",{"_index":659,"title":{},"content":{"22":{"position":[[886,7]]}},"keywords":{}}],["boption",{"_index":1778,"title":{},"content":{"119":{"position":[[325,8]]},"300":{"position":[[325,8]]},"521":{"position":[[325,8]]}},"keywords":{}}],["borrow",{"_index":34,"title":{},"content":{"1":{"position":[[366,8]]},"84":{"position":[[612,10],[695,10],[813,9]]},"85":{"position":[[577,10]]},"253":{"position":[[612,10],[695,10],[813,9]]},"254":{"position":[[577,10]]},"484":{"position":[[612,10],[695,10],[813,9]]},"485":{"position":[[577,10]]}},"keywords":{}}],["borrowers.balances.get(0x1234abcd",{"_index":1551,"title":{},"content":{"85":{"position":[[875,34]]},"254":{"position":[[875,34]]},"485":{"position":[[875,34]]}},"keywords":{}}],["both",{"_index":324,"title":{},"content":{"10":{"position":[[267,4]]},"39":{"position":[[96,4]]},"70":{"position":[[71,4]]},"74":{"position":[[295,4]]},"84":{"position":[[706,4],[885,4]]},"115":{"position":[[1463,4]]},"234":{"position":[[71,4]]},"238":{"position":[[295,4]]},"247":{"position":[[1649,4]]},"253":{"position":[[706,4],[885,4]]},"258":{"position":[[1409,4]]},"264":{"position":[[468,4]]},"382":{"position":[[281,4]]},"404":{"position":[[468,4]]},"416":{"position":[[1107,4]]},"417":{"position":[[80,4],[1650,4]]},"419":{"position":[[1950,4]]},"446":{"position":[[1649,4]]},"470":{"position":[[71,4]]},"474":{"position":[[295,4]]},"478":{"position":[[241,4]]},"481":{"position":[[1409,4]]},"484":{"position":[[706,4],[885,4]]},"596":{"position":[[627,4]]},"601":{"position":[[1999,4]]},"612":{"position":[[1369,4]]},"613":{"position":[[1496,4]]},"616":{"position":[[1339,4]]},"624":{"position":[[281,4]]},"641":{"position":[[468,4]]},"653":{"position":[[1107,4]]},"654":{"position":[[80,4],[1650,4]]},"656":{"position":[[1950,4]]},"673":{"position":[[1649,4]]},"700":{"position":[[241,4]]},"704":{"position":[[627,4]]},"709":{"position":[[1999,4]]},"720":{"position":[[1369,4]]},"721":{"position":[[1496,4]]},"724":{"position":[[1339,4]]}},"keywords":{}}],["box",{"_index":425,"title":{},"content":{"15":{"position":[[605,4]]}},"keywords":{}}],["bparamet",{"_index":1633,"title":{},"content":{"96":{"position":[[99,11]]},"288":{"position":[[99,11]]},"500":{"position":[[99,11]]}},"keywords":{}}],["branch",{"_index":1766,"title":{},"content":{"117":{"position":[[1105,7]]},"298":{"position":[[1105,7]]},"519":{"position":[[1105,7]]}},"keywords":{}}],["breviti",{"_index":3548,"title":{},"content":{"476":{"position":[[1286,7],[1428,7],[1533,7]]},"698":{"position":[[1286,7],[1428,7],[1533,7]]}},"keywords":{}}],["bridg",{"_index":368,"title":{},"content":{"11":{"position":[[142,9]]}},"keywords":{}}],["briefli",{"_index":3118,"title":{},"content":{"395":{"position":[[95,7]]},"632":{"position":[[95,7]]}},"keywords":{}}],["bring",{"_index":37,"title":{},"content":{"1":{"position":[[407,5]]},"20":{"position":[[1049,5]]},"21":{"position":[[330,5]]},"22":{"position":[[700,5]]}},"keywords":{}}],["broadcast",{"_index":1249,"title":{},"content":{"52":{"position":[[824,9]]}},"keywords":{}}],["broader",{"_index":3064,"title":{},"content":{"346":{"position":[[5,7]]}},"keywords":{}}],["btreemap::new",{"_index":761,"title":{},"content":{"31":{"position":[[1377,16],[1610,16],[1904,16],[2169,16]]}},"keywords":{}}],["bug",{"_index":2650,"title":{},"content":{"212":{"position":[[2394,3]]},"391":{"position":[[2394,3]]},"661":{"position":[[2394,3]]}},"keywords":{}}],["build",{"_index":258,"title":{"64":{"position":[[0,8]]},"65":{"position":[[0,8]]},"120":{"position":[[0,8]]},"208":{"position":[[0,6]]},"239":{"position":[[0,8]]},"240":{"position":[[0,8]]},"301":{"position":[[0,8]]},"387":{"position":[[0,6]]},"464":{"position":[[0,8]]},"465":{"position":[[0,8]]},"522":{"position":[[0,8]]},"657":{"position":[[0,6]]}},"content":{"9":{"position":[[39,5]]},"12":{"position":[[118,8]]},"23":{"position":[[197,8]]},"42":{"position":[[436,6],[2626,5]]},"43":{"position":[[841,5],[1642,5]]},"44":{"position":[[237,8]]},"50":{"position":[[42,8],[210,8]]},"51":{"position":[[1708,5],[1785,5],[1861,8]]},"65":{"position":[[3,5],[101,5],[265,6],[341,5]]},"68":{"position":[[21,5],[249,5]]},"76":{"position":[[461,8],[771,8]]},"88":{"position":[[407,8],[451,8]]},"96":{"position":[[203,5]]},"100":{"position":[[170,5]]},"101":{"position":[[102,5]]},"102":{"position":[[625,5]]},"103":{"position":[[733,8],[770,5]]},"115":{"position":[[1737,5]]},"119":{"position":[[394,6]]},"120":{"position":[[13,5],[129,5],[143,5],[296,5],[355,5]]},"121":{"position":[[344,5]]},"132":{"position":[[103,5]]},"134":{"position":[[195,6]]},"135":{"position":[[36,5]]},"136":{"position":[[35,5]]},"174":{"position":[[51,5]]},"185":{"position":[[2923,8]]},"210":{"position":[[266,5]]},"227":{"position":[[461,8],[771,8]]},"240":{"position":[[3,5],[101,5],[265,6],[341,5]]},"243":{"position":[[21,5],[249,5]]},"250":{"position":[[407,8],[451,8]]},"258":{"position":[[1683,5]]},"264":{"position":[[35,5]]},"265":{"position":[[333,5]]},"288":{"position":[[203,5]]},"292":{"position":[[170,5]]},"293":{"position":[[102,5]]},"294":{"position":[[625,5]]},"295":{"position":[[733,8],[770,5]]},"300":{"position":[[394,6]]},"301":{"position":[[13,5],[129,5],[143,5],[296,5],[355,5]]},"302":{"position":[[344,5]]},"311":{"position":[[224,6],[250,5]]},"312":{"position":[[103,5]]},"314":{"position":[[195,6]]},"315":{"position":[[36,5]]},"316":{"position":[[35,5]]},"360":{"position":[[51,5]]},"376":{"position":[[2907,8]]},"389":{"position":[[266,5]]},"395":{"position":[[3002,6],[3028,5]]},"404":{"position":[[35,5]]},"405":{"position":[[333,5]]},"458":{"position":[[461,8],[771,8]]},"465":{"position":[[3,5],[101,5],[265,6],[341,5]]},"468":{"position":[[21,5],[249,5]]},"477":{"position":[[276,5],[306,5]]},"481":{"position":[[1683,5]]},"488":{"position":[[407,8],[451,8]]},"500":{"position":[[203,5]]},"504":{"position":[[170,5]]},"505":{"position":[[102,5]]},"506":{"position":[[625,5]]},"507":{"position":[[733,8],[770,5]]},"521":{"position":[[394,6]]},"522":{"position":[[13,5],[129,5],[143,5],[296,5],[355,5]]},"523":{"position":[[344,5]]},"528":{"position":[[224,6],[250,5]]},"529":{"position":[[103,5]]},"531":{"position":[[195,6]]},"532":{"position":[[36,5]]},"533":{"position":[[35,5]]},"576":{"position":[[51,5]]},"592":{"position":[[2907,8]]},"632":{"position":[[3002,6],[3028,5]]},"641":{"position":[[35,5]]},"642":{"position":[[333,5]]},"659":{"position":[[266,5]]},"699":{"position":[[276,5],[306,5]]}},"keywords":{}}],["build.r",{"_index":1033,"title":{},"content":{"42":{"position":[[317,8],[531,8],[2750,8]]},"183":{"position":[[115,8]]},"374":{"position":[[115,8]]},"590":{"position":[[115,8]]}},"keywords":{}}],["build_contract.r",{"_index":2797,"title":{},"content":{"264":{"position":[[201,17],[284,17]]},"404":{"position":[[201,17],[284,17]]},"641":{"position":[[201,17],[284,17]]}},"keywords":{}}],["build_schema.r",{"_index":2798,"title":{"382":{"position":[[11,15]]},"624":{"position":[[11,15]]}},"content":{"264":{"position":[[223,15],[306,15]]},"382":{"position":[[120,15]]},"404":{"position":[[223,15],[306,15]]},"624":{"position":[[120,15]]},"641":{"position":[[223,15],[306,15]]}},"keywords":{}}],["builder_casp",{"_index":2794,"title":{},"content":{"264":{"position":[[62,15]]},"404":{"position":[[62,15]]},"641":{"position":[[62,15]]}},"keywords":{}}],["built",{"_index":15,"title":{},"content":{"1":{"position":[[139,5]]},"22":{"position":[[120,5],[577,5]]},"38":{"position":[[980,5]]},"52":{"position":[[13,5],[271,5]]},"76":{"position":[[735,5]]},"95":{"position":[[109,5]]},"127":{"position":[[191,5]]},"165":{"position":[[30,5]]},"227":{"position":[[735,5]]},"278":{"position":[[191,5]]},"287":{"position":[[109,5]]},"354":{"position":[[30,5]]},"458":{"position":[[735,5]]},"499":{"position":[[109,5]]},"515":{"position":[[191,5]]},"570":{"position":[[30,5]]}},"keywords":{}}],["bunch",{"_index":638,"title":{},"content":{"21":{"position":[[344,5]]},"265":{"position":[[8,5]]},"405":{"position":[[8,5]]},"642":{"position":[[8,5]]}},"keywords":{}}],["burn",{"_index":1670,"title":{},"content":{"100":{"position":[[998,4]]},"101":{"position":[[699,4]]},"292":{"position":[[998,4]]},"293":{"position":[[699,4]]},"419":{"position":[[3764,5]]},"504":{"position":[[998,4]]},"505":{"position":[[699,4]]},"656":{"position":[[3764,5]]}},"keywords":{}}],["burn(&mut",{"_index":2934,"title":{},"content":{"269":{"position":[[2160,13]]},"384":{"position":[[2180,13]]},"409":{"position":[[2160,13]]},"419":{"position":[[3824,13]]},"626":{"position":[[2180,13]]},"646":{"position":[[2160,13]]},"656":{"position":[[3824,13]]}},"keywords":{}}],["burnabl",{"_index":1107,"title":{},"content":{"43":{"position":[[85,8]]}},"keywords":{}}],["butterfli",{"_index":1270,"title":{},"content":{"52":{"position":[[1882,9]]}},"keywords":{}}],["button",{"_index":3116,"title":{},"content":{"394":{"position":[[327,7]]},"631":{"position":[[327,7]]}},"keywords":{}}],["buy",{"_index":3433,"title":{},"content":{"440":{"position":[[4673,3],[4729,3],[5902,3]]},"441":{"position":[[128,6],[1432,4],[1852,4],[2215,3]]},"687":{"position":[[4673,3],[4729,3],[5902,3]]},"688":{"position":[[128,6],[1432,4],[1852,4],[2215,3]]}},"keywords":{}}],["buy_ticket",{"_index":3427,"title":{},"content":{"440":{"position":[[4295,10],[4349,10],[6023,10]]},"441":{"position":[[1025,12],[1832,10],[2098,10],[4126,10]]},"687":{"position":[[4295,10],[4349,10],[6023,10]]},"688":{"position":[[1025,12],[1832,10],[2098,10],[4126,10]]}},"keywords":{}}],["buy_ticket(&mut",{"_index":3398,"title":{},"content":{"440":{"position":[[2239,19]]},"441":{"position":[[1078,19],[3114,19]]},"687":{"position":[[2239,19]]},"688":{"position":[[1078,19],[3114,19]]}},"keywords":{}}],["buy_ticket(&oper",{"_index":3527,"title":{},"content":{"441":{"position":[[5383,25],[5578,25]]},"688":{"position":[[5383,25],[5578,25]]}},"keywords":{}}],["buy_ticket(oper",{"_index":3532,"title":{},"content":{"441":{"position":[[5718,20]]},"688":{"position":[[5718,20]]}},"keywords":{}}],["buyer",{"_index":3361,"title":{},"content":{"440":{"position":[[736,6],[2352,5],[2834,5],[3034,5],[3105,7],[3232,5],[4420,5],[4478,6],[5351,5],[5868,5],[5970,5],[6098,5]]},"441":{"position":[[8,5],[160,6],[1153,5],[1465,5],[1509,6],[1883,5],[3161,6],[5320,5]]},"687":{"position":[[736,6],[2352,5],[2834,5],[3034,5],[3105,7],[3232,5],[4420,5],[4478,6],[5351,5],[5868,5],[5970,5],[6098,5]]},"688":{"position":[[8,5],[160,6],[1153,5],[1465,5],[1509,6],[1883,5],[3161,6],[5320,5]]}},"keywords":{}}],["byte",{"_index":699,"title":{},"content":{"30":{"position":[[449,4]]},"83":{"position":[[438,4]]},"85":{"position":[[425,6]]},"86":{"position":[[66,5]]},"103":{"position":[[288,5],[451,5]]},"185":{"position":[[2512,4]]},"189":{"position":[[149,5]]},"211":{"position":[[612,4],[689,5]]},"212":{"position":[[1337,6],[1566,5],[1642,5],[1659,6],[1757,5],[1781,6],[1947,5],[1968,6],[2159,5],[2223,5],[2351,5],[2469,5],[2668,5],[2746,5],[2960,5],[3082,5],[3160,5],[3604,4],[3693,5],[4289,7]]},"252":{"position":[[438,4]]},"254":{"position":[[425,6]]},"255":{"position":[[66,5]]},"295":{"position":[[288,5],[451,5]]},"366":{"position":[[149,5]]},"376":{"position":[[2496,4]]},"390":{"position":[[586,4],[663,5]]},"391":{"position":[[1337,6],[1566,5],[1642,5],[1659,6],[1757,5],[1781,6],[1947,5],[1968,6],[2159,5],[2223,5],[2351,5],[2469,5],[2674,5],[2752,5],[2972,5],[3100,5],[3178,5],[3622,4],[3711,5],[4307,7]]},"483":{"position":[[438,4]]},"485":{"position":[[425,6]]},"486":{"position":[[66,5]]},"507":{"position":[[288,5],[451,5]]},"582":{"position":[[149,5]]},"592":{"position":[[2496,4]]},"598":{"position":[[493,6],[1951,5],[1979,4]]},"609":{"position":[[52,5]]},"616":{"position":[[1361,4],[1397,4]]},"660":{"position":[[586,4],[663,5]]},"661":{"position":[[1337,6],[1566,5],[1642,5],[1659,6],[1757,5],[1781,6],[1947,5],[1968,6],[2159,5],[2223,5],[2351,5],[2469,5],[2674,5],[2752,5],[2972,5],[3100,5],[3178,5],[3622,4],[3711,5],[4307,7]]},"706":{"position":[[493,6],[1951,5],[1979,4]]},"717":{"position":[[52,5]]},"724":{"position":[[1361,4],[1397,4]]}},"keywords":{}}],["bytecod",{"_index":707,"title":{},"content":{"30":{"position":[[568,8],[623,8],[639,8],[664,9]]},"31":{"position":[[163,8]]}},"keywords":{}}],["bytecode/calculator.sol",{"_index":690,"title":{},"content":{"30":{"position":[[143,23],[579,23]]}},"keywords":{}}],["bytesarray(32",{"_index":1684,"title":{},"content":{"103":{"position":[[97,14]]},"295":{"position":[[97,14]]},"507":{"position":[[97,14]]}},"keywords":{}}],["bytesrepr::{frombyt",{"_index":2615,"title":{},"content":{"212":{"position":[[127,22]]},"391":{"position":[[127,22]]},"661":{"position":[[127,22]]}},"keywords":{}}],["c",{"_index":288,"title":{},"content":{"9":{"position":[[798,2],[807,1],[822,2],[1011,3]]},"73":{"position":[[374,1]]},"100":{"position":[[187,1]]},"101":{"position":[[119,1]]},"118":{"position":[[106,1]]},"120":{"position":[[334,1],[362,1]]},"121":{"position":[[376,1]]},"210":{"position":[[273,1]]},"237":{"position":[[374,1]]},"292":{"position":[[187,1]]},"293":{"position":[[119,1]]},"299":{"position":[[106,1]]},"301":{"position":[[334,1],[362,1]]},"302":{"position":[[376,1]]},"322":{"position":[[90,1]]},"389":{"position":[[273,1]]},"441":{"position":[[501,1]]},"473":{"position":[[374,1]]},"477":{"position":[[313,1],[381,1]]},"504":{"position":[[187,1]]},"505":{"position":[[119,1]]},"520":{"position":[[106,1]]},"522":{"position":[[334,1],[362,1]]},"523":{"position":[[376,1]]},"540":{"position":[[90,1]]},"612":{"position":[[758,1],[807,1],[932,2],[1089,2]]},"659":{"position":[[273,1]]},"688":{"position":[[501,1]]},"699":{"position":[[313,1],[381,1]]},"720":{"position":[[758,1],[807,1],[932,2],[1089,2]]}},"keywords":{}}],["c3",{"_index":928,"title":{},"content":{"39":{"position":[[838,2],[1090,2],[1140,2],[1501,2],[1558,2],[3212,2]]}},"keywords":{}}],["calcul",{"_index":686,"title":{},"content":{"30":{"position":[[57,10],[176,10]]},"31":{"position":[[526,10],[666,10]]},"211":{"position":[[98,9]]},"390":{"position":[[98,9]]},"660":{"position":[[98,9]]}},"keywords":{}}],["calculator.add(7",{"_index":829,"title":{},"content":{"32":{"position":[[575,17],[1711,17]]}},"keywords":{}}],["calculator.bin",{"_index":710,"title":{},"content":{"30":{"position":[[674,14]]}},"keywords":{}}],["calculator.fibonacci(4",{"_index":852,"title":{},"content":{"32":{"position":[[1767,23]]}},"keywords":{}}],["calculator.fibonacci(4)"",{"_index":835,"title":{},"content":{"32":{"position":[[878,31]]}},"keywords":{}}],["calculator.sol",{"_index":711,"title":{},"content":{"30":{"position":[[697,14]]}},"keywords":{}}],["calculator_evm_program",{"_index":731,"title":{},"content":{"31":{"position":[[557,23]]}},"keywords":{}}],["call",{"_index":115,"title":{"140":{"position":[[6,5]]},"325":{"position":[[6,5]]},"534":{"position":[[6,5]]}},"content":{"2":{"position":[[447,4]]},"8":{"position":[[30,6]]},"10":{"position":[[806,7]]},"11":{"position":[[38,6]]},"16":{"position":[[29,6],[97,6]]},"17":{"position":[[1744,6]]},"31":{"position":[[211,4],[2283,4]]},"32":{"position":[[502,7]]},"39":{"position":[[1363,6]]},"51":{"position":[[264,4]]},"52":{"position":[[287,6],[2004,5],[2074,4]]},"54":{"position":[[277,5]]},"72":{"position":[[82,6],[328,7],[411,5]]},"79":{"position":[[1484,4]]},"83":{"position":[[289,6]]},"92":{"position":[[792,7],[909,5]]},"93":{"position":[[64,4]]},"94":{"position":[[118,6],[204,4],[414,4],[599,4]]},"102":{"position":[[234,7],[302,5],[369,4],[531,5]]},"103":{"position":[[163,5]]},"108":{"position":[[290,5]]},"111":{"position":[[273,7]]},"126":{"position":[[1236,5],[2968,5],[3079,4]]},"127":{"position":[[273,7],[655,4],[757,4],[799,7]]},"128":{"position":[[4,5],[228,5],[407,4],[513,4],[561,7]]},"138":{"position":[[1057,7],[1192,4]]},"141":{"position":[[161,4],[370,4],[1501,5]]},"143":{"position":[[36,5]]},"147":{"position":[[538,7],[849,5],[867,5]]},"148":{"position":[[583,6]]},"154":{"position":[[248,6]]},"158":{"position":[[38,4]]},"168":{"position":[[168,7],[1457,7]]},"175":{"position":[[130,6]]},"194":{"position":[[121,6],[225,6]]},"195":{"position":[[286,6]]},"196":{"position":[[1135,4],[1303,4],[1576,4]]},"197":{"position":[[1381,6],[1616,4]]},"198":{"position":[[1270,4],[1481,4],[1694,7],[2705,7],[2812,4],[2845,4],[3264,4],[3383,4],[3528,4]]},"210":{"position":[[1065,4]]},"223":{"position":[[100,6],[1253,4]]},"230":{"position":[[1501,4]]},"236":{"position":[[82,6],[328,7],[411,5]]},"246":{"position":[[22,6]]},"252":{"position":[[289,6]]},"264":{"position":[[150,6]]},"267":{"position":[[3127,5],[3517,7],[3602,4],[3733,4],[4177,7]]},"268":{"position":[[2141,4],[2214,4]]},"275":{"position":[[294,5]]},"277":{"position":[[1404,5],[3136,5],[3247,4]]},"278":{"position":[[273,7],[655,4],[757,4],[799,7]]},"279":{"position":[[4,5],[228,5],[407,4],[513,4],[561,7]]},"284":{"position":[[792,7],[909,5]]},"285":{"position":[[64,4]]},"286":{"position":[[118,6],[204,4],[414,4],[599,4]]},"294":{"position":[[234,7],[302,5],[369,4],[531,5]]},"295":{"position":[[163,5]]},"306":{"position":[[273,7]]},"318":{"position":[[1049,7],[1184,4]]},"324":{"position":[[933,6],[1154,6],[1346,4],[1401,4]]},"326":{"position":[[161,4],[370,4],[1501,5]]},"328":{"position":[[36,5]]},"331":{"position":[[38,4]]},"335":{"position":[[542,7],[857,5],[875,5]]},"336":{"position":[[583,6]]},"339":{"position":[[248,6]]},"348":{"position":[[168,7],[1457,7]]},"361":{"position":[[130,6]]},"389":{"position":[[1002,4]]},"395":{"position":[[4283,6],[5192,7],[5663,7],[6141,6],[6182,7]]},"404":{"position":[[150,6]]},"407":{"position":[[3127,5],[3517,7],[3602,4],[3733,4],[4177,7]]},"408":{"position":[[2141,4],[2214,4]]},"430":{"position":[[121,6],[225,6]]},"431":{"position":[[286,6]]},"432":{"position":[[1078,4],[1245,4],[1454,4]]},"433":{"position":[[1380,6],[1615,4]]},"434":{"position":[[1260,4],[1471,4],[1684,7],[2695,7],[2802,4],[2835,4],[3246,4],[3365,4],[3510,4]]},"441":{"position":[[1948,4],[3927,5]]},"442":{"position":[[217,6]]},"445":{"position":[[22,6]]},"456":{"position":[[100,6],[1253,4]]},"461":{"position":[[1501,4]]},"472":{"position":[[82,6],[328,7],[411,5]]},"477":{"position":[[3023,7],[3417,7],[4055,4]]},"478":{"position":[[89,5]]},"483":{"position":[[289,6]]},"492":{"position":[[294,5]]},"496":{"position":[[792,7],[909,5]]},"497":{"position":[[64,4]]},"498":{"position":[[118,6],[204,4],[414,4],[599,4]]},"506":{"position":[[234,7],[302,5],[369,4],[531,5]]},"507":{"position":[[163,5]]},"511":{"position":[[273,7]]},"514":{"position":[[1236,5],[2968,5],[3079,4]]},"515":{"position":[[273,7],[655,4],[757,4],[799,7]]},"516":{"position":[[4,5],[228,5],[407,4],[513,4],[561,7]]},"535":{"position":[[161,4],[370,4],[1501,5]]},"537":{"position":[[36,5]]},"542":{"position":[[933,6],[1154,6],[1346,4],[1401,4]]},"544":{"position":[[1049,7],[1184,4]]},"548":{"position":[[38,4]]},"552":{"position":[[542,7],[857,5],[875,5]]},"553":{"position":[[583,6]]},"559":{"position":[[248,6]]},"564":{"position":[[168,7],[1457,7]]},"577":{"position":[[130,6]]},"598":{"position":[[2019,6]]},"605":{"position":[[474,7]]},"606":{"position":[[763,6],[842,6]]},"607":{"position":[[220,5],[280,5]]},"609":{"position":[[32,7],[96,5],[110,6],[329,4]]},"612":{"position":[[1495,6]]},"613":{"position":[[1565,5],[2182,6]]},"614":{"position":[[121,6],[210,6],[302,7]]},"617":{"position":[[509,4],[586,4],[981,5]]},"632":{"position":[[4283,6],[5192,7],[5663,7],[6141,6],[6182,7]]},"641":{"position":[[150,6]]},"644":{"position":[[3127,5],[3517,7],[3602,4],[3733,4],[4177,7]]},"645":{"position":[[2141,4],[2214,4]]},"659":{"position":[[1002,4]]},"672":{"position":[[22,6]]},"677":{"position":[[121,6],[225,6]]},"678":{"position":[[286,6]]},"679":{"position":[[1078,4],[1245,4],[1454,4]]},"680":{"position":[[1380,6],[1615,4]]},"681":{"position":[[1270,4],[1481,4],[1694,7],[2705,7],[2812,4],[2845,4],[3264,4],[3383,4],[3528,4]]},"688":{"position":[[1948,4],[3927,5]]},"689":{"position":[[217,6]]},"696":{"position":[[100,6],[1253,4]]},"699":{"position":[[3023,7],[3417,7],[4055,4]]},"700":{"position":[[89,5]]},"706":{"position":[[2019,6]]},"713":{"position":[[474,7]]},"714":{"position":[[763,6],[842,6]]},"715":{"position":[[220,5],[280,5]]},"717":{"position":[[32,7],[96,5],[110,6],[329,4]]},"720":{"position":[[1495,6]]},"721":{"position":[[1565,5],[2182,6]]},"722":{"position":[[121,6],[210,6],[302,7]]},"725":{"position":[[509,4],[586,4],[981,5]]}},"keywords":{}}],["call.amount",{"_index":1690,"title":{},"content":{"103":{"position":[[534,12]]},"295":{"position":[[534,12]]},"507":{"position":[[534,12]]}},"keywords":{}}],["call.arg",{"_index":1687,"title":{},"content":{"103":{"position":[[276,9]]},"295":{"position":[[276,9]]},"507":{"position":[[276,9]]}},"keywords":{}}],["call_contract<t",{"_index":2870,"title":{},"content":{"267":{"position":[[2910,19],[3064,19]]},"407":{"position":[[2910,19],[3064,19]]},"644":{"position":[[2910,19],[3064,19]]}},"keywords":{}}],["callabl",{"_index":1997,"title":{},"content":{"147":{"position":[[729,9]]},"335":{"position":[[737,9]]},"552":{"position":[[737,9]]}},"keywords":{}}],["calldata",{"_index":3744,"title":{},"content":{"603":{"position":[[165,9]]},"609":{"position":[[61,8]]},"711":{"position":[[165,9]]},"717":{"position":[[61,8]]}},"keywords":{}}],["calldef",{"_index":2874,"title":{},"content":{"267":{"position":[[3133,8]]},"407":{"position":[[3133,8]]},"644":{"position":[[3133,8]]}},"keywords":{}}],["caller",{"_index":457,"title":{"475":{"position":[[12,6]]},"697":{"position":[[12,6]]}},"content":{"17":{"position":[[278,9],[3163,6],[3366,9],[3664,8]]},"31":{"position":[[1724,7]]},"71":{"position":[[101,7],[555,7]]},"95":{"position":[[224,6]]},"138":{"position":[[99,6]]},"157":{"position":[[462,7]]},"168":{"position":[[1322,6]]},"184":{"position":[[1212,6]]},"185":{"position":[[3167,6]]},"197":{"position":[[1197,7]]},"198":{"position":[[3314,6]]},"204":{"position":[[162,6]]},"205":{"position":[[367,6]]},"235":{"position":[[101,7],[555,7]]},"247":{"position":[[1947,6]]},"269":{"position":[[666,6],[1113,6]]},"287":{"position":[[224,6]]},"318":{"position":[[99,6]]},"330":{"position":[[448,7]]},"348":{"position":[[1322,6]]},"375":{"position":[[1109,6]]},"376":{"position":[[3151,6]]},"384":{"position":[[679,6],[1126,6]]},"395":{"position":[[633,6]]},"409":{"position":[[666,6],[1113,6]]},"419":{"position":[[2961,7],[3357,6]]},"424":{"position":[[137,6]]},"425":{"position":[[342,6]]},"433":{"position":[[1196,7]]},"434":{"position":[[3296,6]]},"440":{"position":[[1710,6]]},"441":{"position":[[2572,6],[3256,6],[3296,6],[3583,7],[4160,6],[4331,6]]},"446":{"position":[[1947,6]]},"471":{"position":[[101,7],[555,7]]},"476":{"position":[[694,7],[1149,7]]},"477":{"position":[[1759,6],[3848,6],[3891,6]]},"499":{"position":[[224,6]]},"544":{"position":[[99,6]]},"547":{"position":[[462,7]]},"564":{"position":[[1322,6]]},"591":{"position":[[1109,6]]},"592":{"position":[[3151,6]]},"626":{"position":[[679,6],[1126,6]]},"632":{"position":[[633,6]]},"646":{"position":[[666,6],[1113,6]]},"656":{"position":[[2961,7],[3357,6]]},"666":{"position":[[137,6]]},"667":{"position":[[342,6]]},"673":{"position":[[1947,6]]},"680":{"position":[[1196,7]]},"681":{"position":[[3314,6]]},"687":{"position":[[1710,6]]},"688":{"position":[[2572,6],[3256,6],[3296,6],[3583,7],[4160,6],[4331,6]]},"698":{"position":[[694,7],[1149,7]]},"699":{"position":[[1759,6],[3848,6],[3891,6]]}},"keywords":{}}],["caller'",{"_index":3268,"title":{},"content":{"416":{"position":[[4706,9]]},"477":{"position":[[3385,8]]},"653":{"position":[[4706,9]]},"699":{"position":[[3385,8]]}},"keywords":{}}],["callercurr",{"_index":879,"title":{},"content":{"38":{"position":[[732,13]]}},"keywords":{}}],["callstack",{"_index":1620,"title":{},"content":{"94":{"position":[[286,9]]},"286":{"position":[[286,9]]},"498":{"position":[[286,9]]}},"keywords":{}}],["can't",{"_index":3619,"title":{},"content":{"596":{"position":[[1213,5]]},"611":{"position":[[949,5]]},"613":{"position":[[1281,5],[1319,5]]},"704":{"position":[[1213,5]]},"719":{"position":[[949,5]]},"721":{"position":[[1281,5],[1319,5]]}},"keywords":{}}],["cancel",{"_index":3721,"title":{},"content":{"602":{"position":[[147,9]]},"710":{"position":[[147,9]]}},"keywords":{}}],["cancel(&mut",{"_index":3725,"title":{},"content":{"602":{"position":[[396,15]]},"710":{"position":[[396,15]]}},"keywords":{}}],["candid",{"_index":1182,"title":{},"content":{"50":{"position":[[426,9]]}},"keywords":{}}],["cannotlocktwic",{"_index":3552,"title":{},"content":{"476":{"position":[[1658,15]]},"698":{"position":[[1658,15]]}},"keywords":{}}],["cap",{"_index":1108,"title":{},"content":{"43":{"position":[[98,6]]}},"keywords":{}}],["cap_",{"_index":1117,"title":{},"content":{"43":{"position":[[284,5]]}},"keywords":{}}],["capabl",{"_index":2750,"title":{},"content":{"245":{"position":[[26,7]]},"444":{"position":[[26,7]]},"671":{"position":[[26,7]]}},"keywords":{}}],["cappederc20",{"_index":1102,"title":{"43":{"position":[[0,12]]}},"content":{"43":{"position":[[40,11]]}},"keywords":{}}],["captur",{"_index":2416,"title":{},"content":{"198":{"position":[[3509,7]]},"434":{"position":[[3491,7]]},"610":{"position":[[839,8]]},"681":{"position":[[3509,7]]},"718":{"position":[[839,8]]}},"keywords":{}}],["care",{"_index":252,"title":{},"content":{"8":{"position":[[545,7]]},"22":{"position":[[162,4]]},"38":{"position":[[150,4]]},"321":{"position":[[99,4]]},"539":{"position":[[99,4]]}},"keywords":{}}],["carefulli",{"_index":2948,"title":{},"content":{"270":{"position":[[396,9]]},"385":{"position":[[396,9]]},"410":{"position":[[396,9]]},"627":{"position":[[396,9]]},"647":{"position":[[396,9]]}},"keywords":{}}],["cargo",{"_index":669,"title":{"116":{"position":[[0,5]]},"174":{"position":[[11,5]]},"261":{"position":[[12,5]]},"297":{"position":[[0,5]]},"360":{"position":[[11,5]]},"379":{"position":[[12,5]]},"401":{"position":[[12,5]]},"518":{"position":[[0,5]]},"576":{"position":[[11,5]]},"621":{"position":[[12,5]]},"638":{"position":[[12,5]]}},"content":{"22":{"position":[[1409,5]]},"32":{"position":[[1675,5]]},"42":{"position":[[189,5],[201,5],[2555,5],[2598,5]]},"43":{"position":[[814,5],[861,5]]},"51":{"position":[[1685,5],[1697,5]]},"54":{"position":[[462,5]]},"65":{"position":[[32,5],[95,5]]},"66":{"position":[[36,5]]},"67":{"position":[[164,5]]},"68":{"position":[[243,5],[539,5]]},"92":{"position":[[366,5],[487,5],[605,5]]},"96":{"position":[[111,5],[192,5]]},"98":{"position":[[593,5]]},"100":{"position":[[159,5]]},"101":{"position":[[91,5]]},"106":{"position":[[75,5]]},"117":{"position":[[61,5],[139,5],[627,5],[969,5],[1041,5],[1150,5],[1295,5]]},"118":{"position":[[85,5]]},"119":{"position":[[81,5],[334,5],[383,5],[870,5],[933,5],[975,5],[1063,5],[1142,5]]},"120":{"position":[[118,5],[344,5]]},"121":{"position":[[132,5]]},"122":{"position":[[79,5]]},"127":{"position":[[90,5]]},"129":{"position":[[584,5]]},"132":{"position":[[92,5],[363,5]]},"134":{"position":[[145,5],[184,5],[202,5],[222,5]]},"135":{"position":[[19,5]]},"136":{"position":[[24,5],[45,5]]},"148":{"position":[[947,5]]},"154":{"position":[[18,5]]},"174":{"position":[[0,5],[235,5],[249,5],[343,5]]},"175":{"position":[[41,5],[175,5],[295,5],[430,5]]},"179":{"position":[[49,5]]},"210":{"position":[[255,5]]},"212":{"position":[[4440,5]]},"240":{"position":[[32,5],[95,5]]},"241":{"position":[[36,5]]},"242":{"position":[[165,5]]},"243":{"position":[[243,5],[539,5]]},"261":{"position":[[90,5],[165,5],[179,5]]},"266":{"position":[[22,5]]},"273":{"position":[[75,5]]},"278":{"position":[[90,5]]},"280":{"position":[[584,5]]},"284":{"position":[[366,5],[487,5],[605,5]]},"288":{"position":[[111,5],[192,5]]},"290":{"position":[[593,5]]},"292":{"position":[[159,5]]},"293":{"position":[[91,5]]},"298":{"position":[[61,5],[139,5],[627,5],[969,5],[1041,5],[1150,5],[1295,5]]},"299":{"position":[[85,5]]},"300":{"position":[[81,5],[334,5],[383,5],[870,5],[933,5],[975,5],[1063,5],[1142,5]]},"301":{"position":[[118,5],[344,5]]},"302":{"position":[[132,5]]},"303":{"position":[[79,5]]},"312":{"position":[[92,5],[363,5]]},"314":{"position":[[145,5],[184,5],[202,5],[222,5]]},"315":{"position":[[19,5]]},"316":{"position":[[24,5],[45,5]]},"322":{"position":[[41,5],[61,5]]},"336":{"position":[[947,5]]},"339":{"position":[[18,5]]},"360":{"position":[[0,5],[235,5],[249,5],[343,5]]},"361":{"position":[[41,5],[175,5],[295,5],[430,5]]},"370":{"position":[[49,5]]},"379":{"position":[[90,5],[165,5],[179,5]]},"389":{"position":[[255,5]]},"391":{"position":[[4458,5]]},"395":{"position":[[4386,5]]},"401":{"position":[[90,5],[165,5],[179,5]]},"406":{"position":[[22,5]]},"414":{"position":[[104,5],[644,5]]},"417":{"position":[[1664,5],[1680,5]]},"439":{"position":[[63,5],[136,5]]},"441":{"position":[[451,5],[480,5]]},"465":{"position":[[32,5],[95,5]]},"466":{"position":[[36,5]]},"467":{"position":[[165,5]]},"468":{"position":[[243,5],[539,5]]},"477":{"position":[[295,5],[2502,5]]},"490":{"position":[[75,5]]},"496":{"position":[[366,5],[487,5],[605,5]]},"500":{"position":[[111,5],[192,5]]},"502":{"position":[[593,5]]},"504":{"position":[[159,5]]},"505":{"position":[[91,5]]},"515":{"position":[[90,5]]},"517":{"position":[[584,5]]},"519":{"position":[[61,5],[139,5],[627,5],[969,5],[1041,5],[1150,5],[1295,5]]},"520":{"position":[[85,5]]},"521":{"position":[[81,5],[334,5],[383,5],[870,5],[933,5],[975,5],[1063,5],[1142,5]]},"522":{"position":[[118,5],[344,5]]},"523":{"position":[[132,5]]},"524":{"position":[[79,5]]},"529":{"position":[[92,5],[363,5]]},"531":{"position":[[145,5],[184,5],[202,5],[222,5]]},"532":{"position":[[19,5]]},"533":{"position":[[24,5],[45,5]]},"540":{"position":[[41,5],[61,5]]},"553":{"position":[[947,5]]},"559":{"position":[[18,5]]},"576":{"position":[[0,5],[235,5],[249,5],[343,5]]},"577":{"position":[[41,5],[175,5],[295,5],[430,5]]},"586":{"position":[[49,5]]},"621":{"position":[[90,5],[165,5],[179,5]]},"632":{"position":[[4386,5]]},"638":{"position":[[90,5],[165,5],[179,5]]},"643":{"position":[[22,5]]},"651":{"position":[[104,5],[644,5]]},"654":{"position":[[1664,5],[1680,5]]},"659":{"position":[[255,5]]},"661":{"position":[[4458,5]]},"686":{"position":[[63,5],[136,5]]},"688":{"position":[[451,5],[480,5]]},"699":{"position":[[295,5],[2502,5]]}},"keywords":{}}],["cargo.toml",{"_index":1034,"title":{"131":{"position":[[0,11]]},"265":{"position":[[12,11]]},"311":{"position":[[0,11]]},"405":{"position":[[12,11]]},"528":{"position":[[0,11]]},"642":{"position":[[12,11]]}},"content":{"42":{"position":[[425,10],[2763,10]]},"117":{"position":[[314,10]]},"131":{"position":[[27,10]]},"183":{"position":[[128,10]]},"265":{"position":[[32,10],[374,10]]},"298":{"position":[[314,10]]},"311":{"position":[[27,10]]},"324":{"position":[[211,10],[440,10]]},"374":{"position":[[128,10]]},"395":{"position":[[2410,10],[2537,10]]},"405":{"position":[[32,10],[374,10]]},"477":{"position":[[713,10]]},"519":{"position":[[314,10]]},"528":{"position":[[27,10]]},"542":{"position":[[211,10],[440,10]]},"590":{"position":[[128,10]]},"632":{"position":[[2410,10],[2537,10]]},"642":{"position":[[32,10],[374,10]]},"699":{"position":[[713,10]]}},"keywords":{}}],["cargo_purs",{"_index":1602,"title":{},"content":{"92":{"position":[[851,11]]},"102":{"position":[[128,11],[183,11],[510,11]]},"284":{"position":[[851,11]]},"294":{"position":[[128,11],[183,11],[510,11]]},"496":{"position":[[851,11]]},"506":{"position":[[128,11],[183,11],[510,11]]}},"keywords":{}}],["case",{"_index":180,"title":{},"content":{"5":{"position":[[201,5]]},"39":{"position":[[1242,5]]},"74":{"position":[[300,5]]},"92":{"position":[[918,4]]},"145":{"position":[[181,5]]},"164":{"position":[[63,5],[1103,5]]},"185":{"position":[[3734,4]]},"198":{"position":[[1153,4],[3802,5]]},"238":{"position":[[300,5]]},"284":{"position":[[918,4]]},"333":{"position":[[181,5]]},"353":{"position":[[63,5],[1138,5]]},"376":{"position":[[3718,4]]},"395":{"position":[[2164,4],[4298,5],[6878,4]]},"434":{"position":[[1143,4],[3784,5]]},"474":{"position":[[300,5]]},"477":{"position":[[706,6]]},"496":{"position":[[918,4]]},"550":{"position":[[181,5]]},"569":{"position":[[63,5],[1138,5]]},"592":{"position":[[3718,4]]},"601":{"position":[[2181,6]]},"612":{"position":[[1597,4]]},"632":{"position":[[2164,4],[4298,5],[6878,4]]},"681":{"position":[[1153,4],[3802,5]]},"699":{"position":[[706,6]]},"709":{"position":[[2181,6]]},"720":{"position":[[1597,4]]}},"keywords":{}}],["casper",{"_index":8,"title":{"4":{"position":[[18,6]]},"21":{"position":[[9,7]]},"83":{"position":[[0,6]]},"89":{"position":[[0,6]]},"97":{"position":[[24,6]]},"252":{"position":[[0,6]]},"281":{"position":[[0,6]]},"289":{"position":[[24,6]]},"320":{"position":[[0,6]]},"392":{"position":[[21,6]]},"393":{"position":[[0,6]]},"397":{"position":[[26,6]]},"483":{"position":[[0,6]]},"493":{"position":[[0,6]]},"501":{"position":[[24,6]]},"538":{"position":[[0,6]]},"629":{"position":[[21,6]]},"630":{"position":[[0,6]]},"634":{"position":[[26,6]]}},"content":{"1":{"position":[[58,6],[188,6],[1030,6]]},"3":{"position":[[177,6]]},"6":{"position":[[250,6]]},"11":{"position":[[124,7]]},"12":{"position":[[47,6]]},"13":{"position":[[32,7]]},"20":{"position":[[804,7]]},"21":{"position":[[58,7],[83,6],[367,7]]},"42":{"position":[[2617,6]]},"43":{"position":[[689,6],[880,6],[913,6],[983,6]]},"51":{"position":[[1885,7]]},"54":{"position":[[32,6]]},"66":{"position":[[361,6]]},"67":{"position":[[88,6]]},"68":{"position":[[84,6]]},"83":{"position":[[4,6]]},"90":{"position":[[27,6]]},"91":{"position":[[41,6],[240,6],[463,6],[814,6]]},"92":{"position":[[253,6]]},"93":{"position":[[3,7]]},"94":{"position":[[0,6]]},"95":{"position":[[129,6]]},"96":{"position":[[12,6],[38,7],[130,6],[212,6]]},"97":{"position":[[134,6],[159,6]]},"99":{"position":[[49,6],[209,6],[281,6]]},"100":{"position":[[179,6],[303,6],[375,6]]},"101":{"position":[[111,6],[157,6],[229,6]]},"103":{"position":[[630,6],[705,6]]},"119":{"position":[[353,6],[1161,6]]},"128":{"position":[[39,6]]},"175":{"position":[[449,6]]},"179":{"position":[[82,7]]},"210":{"position":[[331,6],[351,6],[431,6],[1125,6],[1205,6]]},"241":{"position":[[361,6]]},"242":{"position":[[89,6]]},"243":{"position":[[84,6]]},"252":{"position":[[4,6]]},"277":{"position":[[1231,6]]},"279":{"position":[[39,6]]},"282":{"position":[[27,6]]},"283":{"position":[[41,6],[240,6],[463,6],[814,6]]},"284":{"position":[[253,6]]},"285":{"position":[[3,7]]},"286":{"position":[[0,6]]},"287":{"position":[[129,6]]},"288":{"position":[[12,6],[38,7],[130,6],[212,6]]},"289":{"position":[[134,6],[159,6]]},"291":{"position":[[49,6],[209,6],[281,6]]},"292":{"position":[[179,6],[303,6],[375,6]]},"293":{"position":[[111,6],[157,6],[229,6]]},"295":{"position":[[630,6],[705,6]]},"300":{"position":[[353,6],[1161,6]]},"361":{"position":[[449,6]]},"365":{"position":[[8,6],[184,6]]},"370":{"position":[[82,7]]},"382":{"position":[[71,6]]},"389":{"position":[[331,6],[351,6],[431,6],[1062,6],[1142,6]]},"393":{"position":[[17,6],[525,6]]},"394":{"position":[[220,6],[261,6],[442,6]]},"395":{"position":[[279,6],[560,6],[2828,6],[3155,6],[4157,6],[6742,6]]},"397":{"position":[[0,6],[275,6]]},"398":{"position":[[43,6],[108,6],[240,6],[291,6]]},"417":{"position":[[1699,6],[1812,6]]},"418":{"position":[[55,6],[96,6]]},"466":{"position":[[361,6]]},"467":{"position":[[89,6]]},"468":{"position":[[84,6]]},"477":{"position":[[76,6],[931,6],[1068,6]]},"483":{"position":[[4,6]]},"494":{"position":[[27,6]]},"495":{"position":[[41,6],[240,6],[463,6],[814,6]]},"496":{"position":[[253,6]]},"497":{"position":[[3,7]]},"498":{"position":[[0,6]]},"499":{"position":[[129,6]]},"500":{"position":[[12,6],[38,7],[130,6],[212,6]]},"501":{"position":[[134,6],[159,6]]},"503":{"position":[[49,6],[209,6],[281,6]]},"504":{"position":[[179,6],[303,6],[375,6]]},"505":{"position":[[111,6],[157,6],[229,6]]},"507":{"position":[[630,6],[705,6]]},"516":{"position":[[39,6]]},"521":{"position":[[353,6],[1161,6]]},"577":{"position":[[449,6]]},"581":{"position":[[8,6],[184,6]]},"586":{"position":[[82,7]]},"594":{"position":[[247,6]]},"606":{"position":[[1037,6]]},"610":{"position":[[857,6]]},"611":{"position":[[907,7]]},"618":{"position":[[267,6]]},"624":{"position":[[71,6]]},"630":{"position":[[17,6],[525,6]]},"631":{"position":[[220,6],[261,6],[442,6]]},"632":{"position":[[279,6],[560,6],[2828,6],[3155,6],[4157,6],[6742,6]]},"634":{"position":[[0,6],[275,6]]},"635":{"position":[[43,6],[108,6],[240,6],[291,6]]},"654":{"position":[[1699,6],[1812,6]]},"655":{"position":[[55,6],[96,6]]},"659":{"position":[[331,6],[351,6],[431,6],[1062,6],[1142,6]]},"699":{"position":[[76,6],[931,6],[1068,6]]},"702":{"position":[[247,6]]},"714":{"position":[[1037,6]]},"718":{"position":[[857,6]]},"719":{"position":[[907,7]]},"726":{"position":[[267,6]]}},"keywords":{}}],["casper!".to_str",{"_index":3794,"title":{},"content":{"610":{"position":[[418,26]]},"718":{"position":[[418,26]]}},"keywords":{}}],["casper'",{"_index":216,"title":{},"content":{"6":{"position":[[321,8]]},"10":{"position":[[103,8]]},"12":{"position":[[242,8]]},"93":{"position":[[212,8]]},"99":{"position":[[724,8]]},"285":{"position":[[212,8]]},"291":{"position":[[724,8]]},"396":{"position":[[41,8]]},"497":{"position":[[212,8]]},"503":{"position":[[724,8]]},"633":{"position":[[41,8]]}},"keywords":{}}],["casper'sbyt",{"_index":1560,"title":{},"content":{"86":{"position":[[145,13]]},"255":{"position":[[145,13]]},"486":{"position":[[145,13]]}},"keywords":{}}],["casper.ad",{"_index":386,"title":{},"content":{"12":{"position":[[195,13]]}},"keywords":{}}],["casper_client::get_dictionary_item",{"_index":2630,"title":{},"content":{"212":{"position":[[923,35]]},"391":{"position":[[923,35]]},"661":{"position":[[923,35]]}},"keywords":{}}],["casper_client::get_state_root_hash",{"_index":2626,"title":{},"content":{"212":{"position":[[709,35]]},"391":{"position":[[709,35]]},"661":{"position":[[709,35]]}},"keywords":{}}],["casper_client::{rpcs::dictionaryitemidentifi",{"_index":2611,"title":{},"content":{"212":{"position":[[27,47]]},"391":{"position":[[27,47]]},"661":{"position":[[27,47]]}},"keywords":{}}],["casper_contract_schema_vers",{"_index":3041,"title":{},"content":{"324":{"position":[[0,30]]},"542":{"position":[[0,30]]}},"keywords":{}}],["casper_typ",{"_index":2614,"title":{},"content":{"212":{"position":[[111,15]]},"391":{"position":[[111,15]]},"661":{"position":[[111,15]]}},"keywords":{}}],["casper_types::u256",{"_index":1713,"title":{},"content":{"115":{"position":[[129,19],[1941,19]]},"203":{"position":[[51,19]]},"247":{"position":[[39,20]]},"258":{"position":[[129,19],[1887,19]]},"269":{"position":[[3954,19]]},"383":{"position":[[1073,20]]},"409":{"position":[[3954,19]]},"423":{"position":[[51,19]]},"446":{"position":[[39,20]]},"481":{"position":[[129,19],[1887,19]]},"625":{"position":[[1073,20]]},"646":{"position":[[3954,19]]},"665":{"position":[[51,19]]},"673":{"position":[[39,20]]}},"keywords":{}}],["casper_types::u512",{"_index":1481,"title":{},"content":{"80":{"position":[[124,19]]},"231":{"position":[[124,19]]},"440":{"position":[[137,19],[4815,19]]},"441":{"position":[[4561,19]]},"462":{"position":[[124,19]]},"687":{"position":[[137,19],[4815,19]]},"688":{"position":[[4561,19]]}},"keywords":{}}],["casper_types::{bytesrepr::byt",{"_index":3621,"title":{},"content":{"598":{"position":[[49,32]]},"706":{"position":[[49,32]]}},"keywords":{}}],["casper_types::{bytesrepr::tobyt",{"_index":3859,"title":{},"content":{"616":{"position":[[25,34]]},"724":{"position":[[25,34]]}},"keywords":{}}],["casper_types::{u256",{"_index":3798,"title":{},"content":{"611":{"position":[[36,20]]},"719":{"position":[[36,20]]}},"keywords":{}}],["casperecosystem.io",{"_index":3200,"title":{},"content":{"398":{"position":[[347,19]]},"635":{"position":[[347,19]]}},"keywords":{}}],["casperlab",{"_index":571,"title":{},"content":{"20":{"position":[[88,11]]}},"keywords":{}}],["casperpackagehash.entry_point",{"_index":1686,"title":{},"content":{"103":{"position":[[191,29]]},"295":{"position":[[191,29]]},"507":{"position":[[191,29]]}},"keywords":{}}],["casperstorag",{"_index":1515,"title":{},"content":{"83":{"position":[[548,13]]},"252":{"position":[[548,13]]},"483":{"position":[[548,13]]}},"keywords":{}}],["caspervm",{"_index":1097,"title":{},"content":{"42":{"position":[[2661,8]]},"119":{"position":[[448,8]]},"175":{"position":[[420,9]]},"179":{"position":[[115,8]]},"300":{"position":[[448,8]]},"361":{"position":[[420,9]]},"370":{"position":[[115,8]]},"417":{"position":[[106,9]]},"521":{"position":[[448,8]]},"577":{"position":[[420,9]]},"586":{"position":[[115,8]]},"654":{"position":[[106,9]]}},"keywords":{}}],["caspervmand",{"_index":1777,"title":{},"content":{"119":{"position":[[172,11]]},"300":{"position":[[172,11]]},"521":{"position":[[172,11]]}},"keywords":{}}],["cast",{"_index":1622,"title":{},"content":{"94":{"position":[[328,5],[457,5]]},"286":{"position":[[328,5],[457,5]]},"416":{"position":[[586,4],[777,4],[2600,4]]},"417":{"position":[[564,5]]},"419":{"position":[[189,4],[957,4],[6979,5]]},"498":{"position":[[328,5],[457,5]]},"653":{"position":[[586,4],[777,4],[2600,4]]},"654":{"position":[[564,5]]},"656":{"position":[[189,4],[957,4],[6979,5]]}},"keywords":{}}],["catch",{"_index":3906,"title":{"617":{"position":[[4,6]]},"725":{"position":[[4,6]]}},"content":{"617":{"position":[[917,5]]},"725":{"position":[[917,5]]}},"keywords":{}}],["categori",{"_index":2164,"title":{},"content":{"180":{"position":[[12,8]]},"371":{"position":[[12,8]]},"587":{"position":[[12,8]]}},"keywords":{}}],["caveat",{"_index":2055,"title":{},"content":{"162":{"position":[[575,9]]},"351":{"position":[[612,9]]},"567":{"position":[[612,9]]}},"keywords":{}}],["cc",{"_index":2962,"title":{"321":{"position":[[9,4]]},"539":{"position":[[9,4]]}},"content":{"321":{"position":[[46,3]]},"539":{"position":[[46,3]]}},"keywords":{}}],["cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e"",{"_index":3585,"title":{},"content":{"477":{"position":[[2932,70],[3042,70],[3436,70]]},"699":{"position":[[2932,70],[3042,70],[3436,70]]}},"keywords":{}}],["cd",{"_index":1031,"title":{},"content":{"42":{"position":[[235,2]]},"175":{"position":[[85,2]]},"361":{"position":[[85,2]]},"577":{"position":[[85,2]]}},"keywords":{}}],["center",{"_index":3486,"title":{},"content":{"441":{"position":[[1213,6],[1379,8],[2665,6]]},"688":{"position":[[1213,6],[1379,8],[2665,6]]}},"keywords":{}}],["cep",{"_index":1158,"title":{"412":{"position":[[0,3]]},"649":{"position":[[0,3]]}},"content":{"43":{"position":[[1839,3],[2026,3]]},"365":{"position":[[0,3],[37,4],[163,3],[176,3],[213,4],[344,3]]},"396":{"position":[[580,3]]},"416":{"position":[[444,3]]},"419":{"position":[[815,3]]},"438":{"position":[[83,3]]},"439":{"position":[[119,3]]},"442":{"position":[[65,3]]},"581":{"position":[[0,3],[37,4],[163,3],[176,3],[213,4],[344,3]]},"633":{"position":[[580,3]]},"653":{"position":[[444,3]]},"656":{"position":[[815,3]]},"685":{"position":[[83,3]]},"686":{"position":[[119,3]]},"689":{"position":[[65,3]]}},"keywords":{}}],["cep18",{"_index":3204,"title":{},"content":{"414":{"position":[[72,5],[145,5],[298,5],[478,5]]},"416":{"position":[[4607,5]]},"419":{"position":[[1644,5]]},"651":{"position":[[72,5],[145,5],[298,5],[478,5]]},"653":{"position":[[4607,5]]},"656":{"position":[[1644,5]]}},"keywords":{}}],["cep78",{"_index":3343,"title":{},"content":{"439":{"position":[[183,5]]},"440":{"position":[[3844,5]]},"686":{"position":[[183,5]]},"687":{"position":[[3844,5]]}},"keywords":{}}],["cep78error::invalidtokenown",{"_index":3456,"title":{},"content":{"440":{"position":[[6056,29]]},"687":{"position":[[6056,29]]}},"keywords":{}}],["certain",{"_index":2252,"title":{},"content":{"185":{"position":[[2688,7]]},"376":{"position":[[2672,7]]},"592":{"position":[[2672,7]]},"606":{"position":[[650,7]]},"714":{"position":[[650,7]]}},"keywords":{}}],["cfg(test",{"_index":1073,"title":{},"content":{"42":{"position":[[1552,12]]},"51":{"position":[[1321,12]]},"73":{"position":[[438,12]]},"138":{"position":[[164,12]]},"143":{"position":[[101,12],[951,12]]},"148":{"position":[[11,12]]},"151":{"position":[[96,12]]},"160":{"position":[[149,12]]},"168":{"position":[[331,12]]},"178":{"position":[[1017,12]]},"198":{"position":[[11,12]]},"206":{"position":[[9,12]]},"223":{"position":[[799,12]]},"237":{"position":[[438,12]]},"269":{"position":[[3828,12]]},"318":{"position":[[164,12]]},"328":{"position":[[101,12],[926,12]]},"336":{"position":[[11,12]]},"342":{"position":[[96,12]]},"345":{"position":[[149,12]]},"348":{"position":[[331,12]]},"369":{"position":[[1017,12]]},"384":{"position":[[3792,12]]},"409":{"position":[[3828,12]]},"419":{"position":[[6479,12]]},"426":{"position":[[9,12]]},"434":{"position":[[11,12]]},"456":{"position":[[799,12]]},"473":{"position":[[438,12]]},"537":{"position":[[101,12],[926,12]]},"544":{"position":[[164,12]]},"553":{"position":[[11,12]]},"556":{"position":[[96,12]]},"562":{"position":[[149,12]]},"564":{"position":[[331,12]]},"585":{"position":[[1017,12]]},"626":{"position":[[3792,12]]},"646":{"position":[[3828,12]]},"656":{"position":[[6479,12]]},"668":{"position":[[9,12]]},"681":{"position":[[11,12]]},"696":{"position":[[799,12]]}},"keywords":{}}],["chain",{"_index":187,"title":{},"content":{"5":{"position":[[290,5],[320,5]]},"20":{"position":[[977,5]]},"43":{"position":[[972,5]]},"52":{"position":[[667,5]]},"53":{"position":[[228,5]]},"99":{"position":[[270,5],[745,5]]},"100":{"position":[[364,5]]},"101":{"position":[[218,5]]},"126":{"position":[[129,5],[784,5]]},"129":{"position":[[172,7]]},"210":{"position":[[28,6],[420,5],[1194,5]]},"277":{"position":[[129,5],[784,5]]},"280":{"position":[[172,7]]},"291":{"position":[[270,5],[745,5]]},"292":{"position":[[364,5]]},"293":{"position":[[218,5]]},"389":{"position":[[28,6],[420,5],[1131,5]]},"395":{"position":[[3972,5]]},"477":{"position":[[4133,5]]},"478":{"position":[[375,5]]},"503":{"position":[[270,5],[745,5]]},"504":{"position":[[364,5]]},"505":{"position":[[218,5]]},"514":{"position":[[129,5],[784,5]]},"517":{"position":[[172,7]]},"610":{"position":[[820,5]]},"632":{"position":[[3972,5]]},"659":{"position":[[28,6],[420,5],[1131,5]]},"699":{"position":[[4133,5]]},"700":{"position":[[375,5]]},"718":{"position":[[820,5]]}},"keywords":{}}],["chain_id",{"_index":757,"title":{},"content":{"31":{"position":[[1255,9]]},"52":{"position":[[647,8],[726,8],[888,8]]}},"keywords":{}}],["chanc",{"_index":609,"title":{},"content":{"20":{"position":[[904,6]]}},"keywords":{}}],["chang",{"_index":438,"title":{},"content":{"16":{"position":[[217,8]]},"17":{"position":[[142,8],[1689,7]]},"22":{"position":[[1004,6]]},"51":{"position":[[1921,7]]},"126":{"position":[[2210,6],[3148,6]]},"128":{"position":[[88,6],[246,6]]},"168":{"position":[[1311,6],[1384,7]]},"184":{"position":[[876,7]]},"198":{"position":[[3243,6],[3466,6]]},"262":{"position":[[19,8],[90,7]]},"265":{"position":[[17,7]]},"266":{"position":[[11,7]]},"267":{"position":[[106,7],[204,7],[2020,8],[3614,8]]},"268":{"position":[[90,8],[103,7],[197,7],[292,8]]},"277":{"position":[[2378,6],[3316,6]]},"279":{"position":[[88,6],[246,6]]},"348":{"position":[[1311,6],[1384,7]]},"375":{"position":[[795,7]]},"380":{"position":[[19,8],[90,7]]},"383":{"position":[[9,7],[172,8]]},"384":{"position":[[3828,7]]},"402":{"position":[[19,8],[90,7]]},"405":{"position":[[17,7]]},"406":{"position":[[11,7]]},"407":{"position":[[106,7],[204,7],[2020,8],[3614,8]]},"408":{"position":[[90,8],[103,7],[197,7],[292,8]]},"414":{"position":[[555,6],[734,6]]},"419":{"position":[[1843,6],[1892,6]]},"434":{"position":[[3225,6],[3448,6]]},"514":{"position":[[2210,6],[3148,6]]},"516":{"position":[[88,6],[246,6]]},"564":{"position":[[1311,6],[1384,7]]},"591":{"position":[[795,7]]},"622":{"position":[[19,8],[90,7]]},"625":{"position":[[9,7],[172,8]]},"626":{"position":[[3828,7]]},"639":{"position":[[19,8],[90,7]]},"642":{"position":[[17,7]]},"643":{"position":[[11,7]]},"644":{"position":[[106,7],[204,7],[2020,8],[3614,8]]},"645":{"position":[[90,8],[103,7],[197,7],[292,8]]},"651":{"position":[[555,6],[734,6]]},"656":{"position":[[1843,6],[1892,6]]},"681":{"position":[[3243,6],[3466,6]]}},"keywords":{}}],["change_nam",{"_index":1919,"title":{},"content":{"138":{"position":[[952,12]]},"318":{"position":[[944,12]]},"544":{"position":[[944,12]]}},"keywords":{}}],["change_ownership",{"_index":2370,"title":{},"content":{"197":{"position":[[1136,18]]},"198":{"position":[[1543,19]]},"433":{"position":[[1135,18]]},"434":{"position":[[1533,19]]},"680":{"position":[[1135,18]]},"681":{"position":[[1543,19]]}},"keywords":{}}],["change_ownership(&mut",{"_index":1727,"title":{},"content":{"115":{"position":[[1153,25]]},"197":{"position":[[211,25]]},"247":{"position":[[1260,25]]},"258":{"position":[[1099,25]]},"433":{"position":[[211,25]]},"446":{"position":[[1260,25]]},"481":{"position":[[1099,25]]},"673":{"position":[[1260,25]]},"680":{"position":[[211,25]]}},"keywords":{}}],["change_secur",{"_index":3304,"title":{},"content":{"419":{"position":[[2184,16]]},"656":{"position":[[2184,16]]}},"keywords":{}}],["changelog",{"_index":2791,"title":{"262":{"position":[[16,10]]},"380":{"position":[[16,10]]},"402":{"position":[[16,10]]},"622":{"position":[[16,10]]},"639":{"position":[[16,10]]}},"content":{"262":{"position":[[62,9]]},"380":{"position":[[62,9]]},"402":{"position":[[62,9]]},"622":{"position":[[62,9]]},"639":{"position":[[62,9]]}},"keywords":{}}],["changelogodra",{"_index":2952,"title":{},"content":{"271":{"position":[[0,13]]},"386":{"position":[[0,13]]},"411":{"position":[[0,13]]},"628":{"position":[[0,13]]},"648":{"position":[[0,13]]}},"keywords":{}}],["char",{"_index":800,"title":{},"content":{"31":{"position":[[3033,6]]}},"keywords":{}}],["charact",{"_index":1512,"title":{},"content":{"83":{"position":[[401,11]]},"85":{"position":[[1009,9]]},"252":{"position":[[401,11]]},"254":{"position":[[1009,9]]},"483":{"position":[[401,11]]},"485":{"position":[[1009,9]]}},"keywords":{}}],["chatgpt",{"_index":415,"title":{},"content":{"15":{"position":[[341,8]]},"17":{"position":[[1632,7]]}},"keywords":{}}],["check",{"_index":319,"title":{"221":{"position":[[0,6]]},"454":{"position":[[0,6]]},"694":{"position":[[0,6]]}},"content":{"10":{"position":[[127,6]]},"18":{"position":[[81,7]]},"24":{"position":[[0,5]]},"43":{"position":[[613,5]]},"54":{"position":[[421,5]]},"71":{"position":[[264,5]]},"72":{"position":[[308,6]]},"94":{"position":[[108,5],[637,6]]},"124":{"position":[[82,5]]},"138":{"position":[[61,5]]},"157":{"position":[[539,5],[679,5],[823,5]]},"174":{"position":[[273,5]]},"185":{"position":[[2811,5],[3713,5]]},"206":{"position":[[3790,5]]},"212":{"position":[[2318,5]]},"218":{"position":[[70,5]]},"221":{"position":[[25,6],[568,6]]},"235":{"position":[[264,5]]},"236":{"position":[[308,6]]},"268":{"position":[[2930,5]]},"286":{"position":[[108,5],[637,6]]},"309":{"position":[[82,5]]},"318":{"position":[[61,5]]},"330":{"position":[[525,5],[660,5],[799,5]]},"360":{"position":[[273,5]]},"376":{"position":[[2795,5],[3697,5]]},"391":{"position":[[2318,5]]},"395":{"position":[[1553,5]]},"396":{"position":[[1166,5]]},"398":{"position":[[185,5]]},"408":{"position":[[2930,5]]},"416":{"position":[[4788,7]]},"426":{"position":[[3765,5]]},"440":{"position":[[2821,5],[4369,6]]},"441":{"position":[[4147,5],[4318,5]]},"451":{"position":[[70,5]]},"454":{"position":[[25,6],[568,6]]},"471":{"position":[[264,5]]},"472":{"position":[[308,6]]},"476":{"position":[[857,5]]},"498":{"position":[[108,5],[637,6]]},"526":{"position":[[82,5]]},"544":{"position":[[61,5]]},"547":{"position":[[539,5],[679,5],[823,5]]},"576":{"position":[[273,5]]},"592":{"position":[[2795,5],[3697,5]]},"616":{"position":[[930,6]]},"632":{"position":[[1553,5]]},"633":{"position":[[1166,5]]},"635":{"position":[[185,5]]},"645":{"position":[[2930,5]]},"653":{"position":[[4788,7]]},"661":{"position":[[2318,5]]},"668":{"position":[[3790,5]]},"687":{"position":[[2821,5],[4369,6]]},"688":{"position":[[4147,5],[4318,5]]},"691":{"position":[[70,5]]},"694":{"position":[[25,6],[568,6]]},"698":{"position":[[857,5]]},"724":{"position":[[930,6]]}},"keywords":{}}],["check_rol",{"_index":2263,"title":{},"content":{"185":{"position":[[3056,12],[3931,12]]},"376":{"position":[[3040,12],[3915,12]]},"592":{"position":[[3040,12],[3915,12]]}},"keywords":{}}],["check_role(&self",{"_index":2234,"title":{},"content":{"185":{"position":[[1477,21]]},"376":{"position":[[1461,21]]},"592":{"position":[[1461,21]]}},"keywords":{}}],["cherri",{"_index":1737,"title":{},"content":{"115":{"position":[[1767,6]]},"258":{"position":[[1713,6]]},"481":{"position":[[1713,6]]}},"keywords":{}}],["child",{"_index":1708,"title":{},"content":{"114":{"position":[[164,5],[304,5]]},"257":{"position":[[164,5],[304,5]]},"480":{"position":[[164,5],[304,5]]}},"keywords":{}}],["children",{"_index":2296,"title":{},"content":{"189":{"position":[[98,8]]},"366":{"position":[[98,8]]},"582":{"position":[[98,8]]}},"keywords":{}}],["choic",{"_index":1017,"title":{},"content":{"40":{"position":[[187,6]]},"52":{"position":[[248,7]]},"119":{"position":[[681,6]]},"300":{"position":[[681,6]]},"416":{"position":[[845,7],[2687,7],[3050,7]]},"419":{"position":[[257,7],[4642,7],[5004,7]]},"521":{"position":[[681,6]]},"653":{"position":[[845,7],[2687,7],[3050,7]]},"656":{"position":[[257,7],[4642,7],[5004,7]]}},"keywords":{}}],["choos",{"_index":1225,"title":{},"content":{"52":{"position":[[101,6]]},"198":{"position":[[2089,6]]},"264":{"position":[[388,6]]},"382":{"position":[[201,6]]},"404":{"position":[[388,6]]},"414":{"position":[[39,8]]},"434":{"position":[[2079,6]]},"478":{"position":[[278,6]]},"624":{"position":[[201,6]]},"641":{"position":[[388,6]]},"651":{"position":[[39,8]]},"681":{"position":[[2089,6]]},"700":{"position":[[278,6]]}},"keywords":{}}],["chose",{"_index":2011,"title":{},"content":{"148":{"position":[[927,5]]},"336":{"position":[[927,5]]},"553":{"position":[[927,5]]}},"keywords":{}}],["citi",{"_index":601,"title":{},"content":{"20":{"position":[[768,6]]}},"keywords":{}}],["citizen",{"_index":1572,"title":{},"content":{"91":{"position":[[30,7]]},"283":{"position":[[30,7]]},"495":{"position":[[30,7]]}},"keywords":{}}],["cl_value.inner_bytes()[4..].to_vec",{"_index":2638,"title":{},"content":{"212":{"position":[[1380,36]]},"391":{"position":[[1380,36]]},"661":{"position":[[1380,36]]}},"keywords":{}}],["clarif",{"_index":3926,"title":{},"content":{"618":{"position":[[677,13]]},"726":{"position":[[677,13]]}},"keywords":{}}],["class",{"_index":951,"title":{},"content":{"39":{"position":[[1426,5],[1465,7]]},"91":{"position":[[24,5]]},"283":{"position":[[24,5]]},"495":{"position":[[24,5]]}},"keywords":{}}],["clean",{"_index":642,"title":{},"content":{"22":{"position":[[95,6]]},"38":{"position":[[113,6]]},"114":{"position":[[236,5]]},"143":{"position":[[643,5]]},"257":{"position":[[236,5]]},"328":{"position":[[618,5]]},"480":{"position":[[236,5]]},"537":{"position":[[618,5]]}},"keywords":{}}],["cleaner",{"_index":1753,"title":{},"content":{"115":{"position":[[3286,8]]},"258":{"position":[[3212,8]]},"481":{"position":[[3212,8]]}},"keywords":{}}],["clever",{"_index":3203,"title":{},"content":{"414":{"position":[[50,6]]},"651":{"position":[[50,6]]}},"keywords":{}}],["cli",{"_index":668,"title":{},"content":{"22":{"position":[[1400,3]]}},"keywords":{}}],["click",{"_index":3107,"title":{},"content":{"393":{"position":[[256,8]]},"394":{"position":[[287,5]]},"396":{"position":[[955,5]]},"630":{"position":[[256,8]]},"631":{"position":[[287,5]]},"633":{"position":[[955,5]]}},"keywords":{}}],["client",{"_index":1132,"title":{"477":{"position":[[0,7]]},"699":{"position":[[0,7]]}},"content":{"43":{"position":[[920,6]]},"52":{"position":[[261,6]]},"97":{"position":[[166,6]]},"98":{"position":[[701,6]]},"99":{"position":[[56,7],[216,6]]},"100":{"position":[[310,6]]},"101":{"position":[[164,6]]},"103":{"position":[[712,6]]},"210":{"position":[[338,6],[358,6],[1132,6]]},"289":{"position":[[166,6]]},"290":{"position":[[701,6]]},"291":{"position":[[56,7],[216,6]]},"292":{"position":[[310,6]]},"293":{"position":[[164,6]]},"295":{"position":[[712,6]]},"389":{"position":[[338,6],[358,6],[1069,6]]},"501":{"position":[[166,6]]},"502":{"position":[[701,6]]},"503":{"position":[[56,7],[216,6]]},"504":{"position":[[310,6]]},"505":{"position":[[164,6]]},"507":{"position":[[712,6]]},"659":{"position":[[338,6],[358,6],[1069,6]]}},"keywords":{}}],["clone",{"_index":1656,"title":{},"content":{"100":{"position":[[56,5]]},"292":{"position":[[56,5]]},"504":{"position":[[56,5]]}},"keywords":{}}],["close",{"_index":3265,"title":{},"content":{"416":{"position":[[4517,5]]},"419":{"position":[[6097,5]]},"653":{"position":[[4517,5]]},"656":{"position":[[6097,5]]}},"keywords":{}}],["closer",{"_index":1301,"title":{},"content":{"53":{"position":[[67,6]]},"90":{"position":[[126,6]]},"155":{"position":[[34,6]]},"282":{"position":[[126,6]]},"340":{"position":[[34,6]]},"494":{"position":[[126,6]]},"560":{"position":[[34,6]]}},"keywords":{}}],["cltype",{"_index":1558,"title":{},"content":{"86":{"position":[[82,6]]},"212":{"position":[[1372,7]]},"229":{"position":[[250,7]]},"255":{"position":[[82,6]]},"267":{"position":[[2204,7],[2930,7]]},"391":{"position":[[1372,7]]},"407":{"position":[[2204,7],[2930,7]]},"460":{"position":[[250,7]]},"486":{"position":[[82,6]]},"644":{"position":[[2204,7],[2930,7]]},"661":{"position":[[1372,7]]}},"keywords":{}}],["cltype::ani",{"_index":3079,"title":{},"content":{"354":{"position":[[513,12]]},"570":{"position":[[513,12]]}},"keywords":{}}],["cltype::u8",{"_index":3080,"title":{},"content":{"354":{"position":[[565,11]]},"570":{"position":[[565,11]]}},"keywords":{}}],["cltyped>(&self",{"_index":2854,"title":{},"content":{"267":{"position":[[2288,22]]},"407":{"position":[[2288,22]]},"644":{"position":[[2288,22]]}},"keywords":{}}],["clvalu",{"_index":2636,"title":{},"content":{"212":{"position":[[1258,7]]},"391":{"position":[[1258,7]]},"661":{"position":[[1258,7]]}},"keywords":{}}],["code",{"_index":45,"title":{"51":{"position":[[13,5]]},"115":{"position":[[0,4]]},"118":{"position":[[11,5]]},"120":{"position":[[9,5]]},"182":{"position":[[0,5]]},"194":{"position":[[0,5]]},"202":{"position":[[0,5]]},"218":{"position":[[0,5]]},"245":{"position":[[0,5]]},"258":{"position":[[0,4]]},"269":{"position":[[3,4]]},"299":{"position":[[11,5]]},"301":{"position":[[9,5]]},"373":{"position":[[0,5]]},"383":{"position":[[26,5]]},"384":{"position":[[3,4]]},"409":{"position":[[3,4]]},"419":{"position":[[9,5]]},"422":{"position":[[0,5]]},"430":{"position":[[0,5]]},"444":{"position":[[0,5]]},"451":{"position":[[0,5]]},"481":{"position":[[0,4]]},"520":{"position":[[11,5]]},"522":{"position":[[9,5]]},"589":{"position":[[0,5]]},"625":{"position":[[26,5]]},"626":{"position":[[3,4]]},"646":{"position":[[3,4]]},"656":{"position":[[9,5]]},"664":{"position":[[0,5]]},"671":{"position":[[0,5]]},"677":{"position":[[0,5]]},"691":{"position":[[0,5]]}},"content":{"1":{"position":[[563,4]]},"2":{"position":[[318,7],[510,7]]},"9":{"position":[[302,4],[722,4]]},"15":{"position":[[34,5]]},"16":{"position":[[147,4],[200,4],[407,4]]},"17":{"position":[[172,4],[189,4]]},"18":{"position":[[73,5],[130,5],[337,4]]},"20":{"position":[[412,4],[572,4],[826,4],[983,4],[1075,4]]},"22":{"position":[[782,4]]},"23":{"position":[[265,4]]},"30":{"position":[[43,5],[454,5]]},"31":{"position":[[299,5],[328,4],[1627,5],[1921,5]]},"38":{"position":[[1147,4],[1162,5]]},"39":{"position":[[339,5],[485,5],[1727,4],[1742,5],[3161,4]]},"40":{"position":[[147,4]]},"42":{"position":[[1860,4]]},"43":{"position":[[156,4],[639,4]]},"50":{"position":[[353,5]]},"51":{"position":[[1907,5]]},"52":{"position":[[3094,4],[3221,4]]},"80":{"position":[[10,4]]},"84":{"position":[[39,4]]},"99":{"position":[[751,6]]},"100":{"position":[[1036,4]]},"101":{"position":[[737,4]]},"102":{"position":[[463,4]]},"104":{"position":[[32,5]]},"106":{"position":[[113,4]]},"108":{"position":[[340,5]]},"118":{"position":[[45,5],[168,5]]},"119":{"position":[[746,4]]},"120":{"position":[[23,4]]},"124":{"position":[[97,4]]},"126":{"position":[[1320,5]]},"127":{"position":[[17,5]]},"128":{"position":[[715,5]]},"134":{"position":[[63,4]]},"145":{"position":[[66,4]]},"148":{"position":[[621,4]]},"155":{"position":[[53,4]]},"168":{"position":[[1112,4]]},"176":{"position":[[23,4]]},"182":{"position":[[24,5]]},"194":{"position":[[20,5]]},"204":{"position":[[1359,5]]},"205":{"position":[[2287,4],[2328,5]]},"221":{"position":[[702,4]]},"231":{"position":[[10,4]]},"253":{"position":[[39,4]]},"262":{"position":[[33,5]]},"273":{"position":[[113,4]]},"275":{"position":[[344,5]]},"277":{"position":[[1488,5]]},"278":{"position":[[17,5]]},"279":{"position":[[715,5]]},"291":{"position":[[751,6]]},"292":{"position":[[1036,4]]},"293":{"position":[[737,4]]},"294":{"position":[[463,4]]},"296":{"position":[[32,5]]},"299":{"position":[[45,5],[168,5]]},"300":{"position":[[746,4]]},"301":{"position":[[23,4]]},"309":{"position":[[97,4]]},"314":{"position":[[63,4]]},"333":{"position":[[66,4]]},"336":{"position":[[621,4]]},"340":{"position":[[53,4]]},"348":{"position":[[1112,4]]},"354":{"position":[[467,4]]},"362":{"position":[[23,4]]},"373":{"position":[[24,5]]},"380":{"position":[[33,5]]},"383":{"position":[[39,4]]},"395":{"position":[[168,5],[4380,5]]},"402":{"position":[[33,5]]},"414":{"position":[[178,5]]},"419":{"position":[[21,4]]},"424":{"position":[[1309,5]]},"425":{"position":[[2237,4],[2278,5]]},"430":{"position":[[20,5]]},"440":{"position":[[65,4]]},"454":{"position":[[702,4]]},"462":{"position":[[10,4]]},"476":{"position":[[1269,4],[1411,4],[1516,4],[1909,4]]},"477":{"position":[[604,4],[640,5],[2297,5]]},"478":{"position":[[312,4]]},"484":{"position":[[39,4]]},"490":{"position":[[113,4]]},"492":{"position":[[344,5]]},"503":{"position":[[751,6]]},"504":{"position":[[1036,4]]},"505":{"position":[[737,4]]},"506":{"position":[[463,4]]},"508":{"position":[[32,5]]},"514":{"position":[[1320,5]]},"515":{"position":[[17,5]]},"516":{"position":[[715,5]]},"520":{"position":[[45,5],[168,5]]},"521":{"position":[[746,4]]},"522":{"position":[[23,4]]},"526":{"position":[[97,4]]},"531":{"position":[[63,4]]},"550":{"position":[[66,4]]},"553":{"position":[[621,4]]},"560":{"position":[[53,4]]},"564":{"position":[[1112,4]]},"570":{"position":[[467,4]]},"578":{"position":[[23,4]]},"589":{"position":[[24,5]]},"596":{"position":[[82,4],[484,4],[532,5]]},"606":{"position":[[972,4],[1026,6]]},"612":{"position":[[55,4],[1736,4],[2105,4]]},"613":{"position":[[1354,4]]},"617":{"position":[[477,4],[554,4],[1322,4]]},"618":{"position":[[327,4]]},"622":{"position":[[33,5]]},"625":{"position":[[39,4]]},"632":{"position":[[168,5],[4380,5]]},"639":{"position":[[33,5]]},"651":{"position":[[178,5]]},"656":{"position":[[21,4]]},"666":{"position":[[1309,5]]},"667":{"position":[[2237,4],[2278,5]]},"677":{"position":[[20,5]]},"687":{"position":[[65,4]]},"694":{"position":[[702,4]]},"698":{"position":[[1269,4],[1411,4],[1516,4],[1909,4]]},"699":{"position":[[604,4],[640,5],[2297,5]]},"700":{"position":[[312,4]]},"704":{"position":[[82,4],[484,4],[532,5]]},"714":{"position":[[972,4],[1026,6]]},"720":{"position":[[55,4],[1736,4],[2105,4]]},"721":{"position":[[1354,4]]},"725":{"position":[[477,4],[554,4],[1322,4]]},"726":{"position":[[327,4]]}},"keywords":{}}],["code,text",{"_index":452,"title":{},"content":{"17":{"position":[[102,9]]}},"keywords":{}}],["code_id",{"_index":1257,"title":{},"content":{"52":{"position":[[1108,7],[1172,11],[3157,7]]}},"keywords":{}}],["codebas",{"_index":674,"title":{},"content":{"23":{"position":[[43,8]]}},"keywords":{}}],["codegen",{"_index":1886,"title":{},"content":{"131":{"position":[[444,7]]},"265":{"position":[[854,7]]},"311":{"position":[[496,7]]},"395":{"position":[[3534,7]]},"405":{"position":[[854,7]]},"528":{"position":[[496,7]]},"632":{"position":[[3534,7]]},"642":{"position":[[854,7]]}},"keywords":{}}],["codesuccessfulli",{"_index":1153,"title":{},"content":{"43":{"position":[[1681,16]]}},"keywords":{}}],["codex",{"_index":433,"title":{},"content":{"16":{"position":[[104,6]]}},"keywords":{}}],["codey",{"_index":222,"title":{},"content":{"7":{"position":[[65,7]]}},"keywords":{}}],["collect",{"_index":1419,"title":{},"content":{"76":{"position":[[402,11],[827,10]]},"79":{"position":[[413,10]]},"227":{"position":[[402,11],[827,10]]},"230":{"position":[[430,10]]},"321":{"position":[[739,9],[863,9]]},"441":{"position":[[4240,7]]},"458":{"position":[[402,11],[827,10]]},"461":{"position":[[430,10]]},"539":{"position":[[739,9],[863,9]]},"601":{"position":[[1897,10]]},"688":{"position":[[4240,7]]},"709":{"position":[[1897,10]]}},"keywords":{}}],["collection_nam",{"_index":3373,"title":{},"content":{"440":{"position":[[1177,16],[1320,17],[1355,16],[5026,16]]},"441":{"position":[[4851,16]]},"687":{"position":[[1177,16],[1320,17],[1355,16],[5026,16]]},"688":{"position":[[4851,16]]}},"keywords":{}}],["collection_symbol",{"_index":3374,"title":{},"content":{"440":{"position":[[1202,18],[1372,18],[5075,18]]},"441":{"position":[[4900,18]]},"687":{"position":[[1202,18],[1372,18],[5075,18]]},"688":{"position":[[4900,18]]}},"keywords":{}}],["combin",{"_index":2278,"title":{},"content":{"185":{"position":[[3916,11]]},"188":{"position":[[382,11],[668,11]]},"207":{"position":[[45,7]]},"212":{"position":[[3486,11]]},"248":{"position":[[234,9]]},"324":{"position":[[1630,11]]},"365":{"position":[[739,11],[1025,11]]},"376":{"position":[[3900,11]]},"391":{"position":[[3504,11]]},"427":{"position":[[45,7]]},"442":{"position":[[113,7]]},"447":{"position":[[234,9]]},"542":{"position":[[1630,11]]},"581":{"position":[[739,11],[1025,11]]},"592":{"position":[[3900,11]]},"661":{"position":[[3504,11]]},"669":{"position":[[45,7]]},"674":{"position":[[234,9]]},"689":{"position":[[113,7]]}},"keywords":{}}],["come",{"_index":370,"title":{},"content":{"11":{"position":[[168,4]]},"22":{"position":[[1385,5]]},"31":{"position":[[311,5]]},"38":{"position":[[1187,5]]},"51":{"position":[[1658,5]]},"92":{"position":[[331,5]]},"100":{"position":[[5,5]]},"146":{"position":[[667,6]]},"157":{"position":[[15,5]]},"160":{"position":[[76,5]]},"163":{"position":[[1383,5]]},"168":{"position":[[1494,5]]},"187":{"position":[[13,5]]},"284":{"position":[[331,5]]},"292":{"position":[[5,5]]},"330":{"position":[[15,5]]},"334":{"position":[[671,6]]},"345":{"position":[[76,5]]},"348":{"position":[[1494,5]]},"352":{"position":[[1405,5]]},"364":{"position":[[13,5]]},"416":{"position":[[2489,4]]},"496":{"position":[[331,5]]},"504":{"position":[[5,5]]},"547":{"position":[[15,5]]},"551":{"position":[[671,6]]},"562":{"position":[[76,5]]},"564":{"position":[[1494,5]]},"568":{"position":[[1405,5]]},"580":{"position":[[13,5]]},"594":{"position":[[127,4]]},"653":{"position":[[2489,4]]},"702":{"position":[[127,4]]}},"keywords":{}}],["comma",{"_index":1787,"title":{},"content":{"120":{"position":[[388,5]]},"301":{"position":[[388,5]]},"522":{"position":[[388,5]]}},"keywords":{}}],["command",{"_index":1131,"title":{},"content":{"43":{"position":[[830,7]]},"65":{"position":[[62,8],[328,7]]},"67":{"position":[[118,7]]},"68":{"position":[[209,9]]},"117":{"position":[[4,8],[1286,8]]},"118":{"position":[[76,8]]},"119":{"position":[[14,7],[881,7]]},"120":{"position":[[241,7]]},"121":{"position":[[123,8],[350,8]]},"129":{"position":[[653,7]]},"132":{"position":[[383,8]]},"134":{"position":[[160,7],[240,9]]},"154":{"position":[[38,8]]},"173":{"position":[[186,8]]},"174":{"position":[[226,8],[327,9]]},"179":{"position":[[40,8]]},"240":{"position":[[62,8],[328,7]]},"242":{"position":[[119,7]]},"243":{"position":[[209,9]]},"261":{"position":[[156,8]]},"280":{"position":[[654,7]]},"298":{"position":[[4,8],[1286,8]]},"299":{"position":[[76,8]]},"300":{"position":[[14,7],[881,7]]},"301":{"position":[[241,7]]},"302":{"position":[[123,8],[350,8]]},"312":{"position":[[383,8]]},"314":{"position":[[160,7],[240,9]]},"322":{"position":[[52,8]]},"339":{"position":[[38,8]]},"359":{"position":[[186,8]]},"360":{"position":[[226,8],[327,9]]},"370":{"position":[[40,8]]},"379":{"position":[[156,8]]},"401":{"position":[[156,8]]},"439":{"position":[[78,7]]},"441":{"position":[[471,8]]},"465":{"position":[[62,8],[328,7]]},"467":{"position":[[119,7]]},"468":{"position":[[209,9]]},"477":{"position":[[2325,8]]},"517":{"position":[[654,7]]},"519":{"position":[[4,8],[1286,8]]},"520":{"position":[[76,8]]},"521":{"position":[[14,7],[881,7]]},"522":{"position":[[241,7]]},"523":{"position":[[123,8],[350,8]]},"529":{"position":[[383,8]]},"531":{"position":[[160,7],[240,9]]},"540":{"position":[[52,8]]},"559":{"position":[[38,8]]},"575":{"position":[[186,8]]},"576":{"position":[[226,8],[327,9]]},"586":{"position":[[40,8]]},"621":{"position":[[156,8]]},"638":{"position":[[156,8]]},"686":{"position":[[78,7]]},"688":{"position":[[471,8]]},"699":{"position":[[2325,8]]}},"keywords":{}}],["commit",{"_index":1798,"title":{},"content":{"126":{"position":[[565,6]]},"277":{"position":[[565,6]]},"514":{"position":[[565,6]]}},"keywords":{}}],["common",{"_index":2815,"title":{},"content":{"267":{"position":[[197,6]]},"268":{"position":[[190,6]]},"407":{"position":[[197,6]]},"408":{"position":[[190,6]]},"644":{"position":[[197,6]]},"645":{"position":[[190,6]]}},"keywords":{}}],["commun",{"_index":1,"title":{"0":{"position":[[19,10]]},"1":{"position":[[11,10]]},"123":{"position":[[5,13]]},"308":{"position":[[5,13]]},"525":{"position":[[5,13]]}},"content":{"1":{"position":[[293,9]]},"12":{"position":[[92,9]]},"20":{"position":[[736,11]]},"111":{"position":[[87,13]]},"168":{"position":[[59,11],[239,13]]},"306":{"position":[[87,13]]},"348":{"position":[[59,11],[239,13]]},"394":{"position":[[449,9]]},"413":{"position":[[155,9]]},"417":{"position":[[1526,9]]},"419":{"position":[[7941,9]]},"511":{"position":[[87,13]]},"564":{"position":[[59,11],[239,13]]},"631":{"position":[[449,9]]},"650":{"position":[[155,9]]},"654":{"position":[[1526,9]]},"656":{"position":[[7941,9]]}},"keywords":{}}],["compar",{"_index":1156,"title":{},"content":{"43":{"position":[[1779,7]]},"198":{"position":[[2389,9],[3876,7]]},"202":{"position":[[63,8]]},"205":{"position":[[2275,7]]},"265":{"position":[[362,7]]},"405":{"position":[[362,7]]},"422":{"position":[[63,8]]},"425":{"position":[[2225,7]]},"434":{"position":[[2379,9],[3858,7]]},"642":{"position":[[362,7]]},"664":{"position":[[63,8]]},"667":{"position":[[2225,7]]},"681":{"position":[[2389,9],[3876,7]]}},"keywords":{}}],["comparison",{"_index":622,"title":{},"content":{"21":{"position":[[69,10]]},"43":{"position":[[1962,10]]}},"keywords":{}}],["compat",{"_index":1187,"title":{},"content":{"51":{"position":[[64,11]]},"66":{"position":[[341,10]]},"241":{"position":[[341,10]]},"466":{"position":[[341,10]]}},"keywords":{}}],["compil",{"_index":208,"title":{},"content":{"6":{"position":[[205,8]]},"20":{"position":[[696,8]]},"30":{"position":[[431,8]]},"31":{"position":[[517,8]]},"39":{"position":[[3361,9]]},"66":{"position":[[319,8]]},"100":{"position":[[149,9]]},"101":{"position":[[78,12]]},"154":{"position":[[80,8]]},"173":{"position":[[501,7]]},"210":{"position":[[218,7]]},"241":{"position":[[319,8]]},"270":{"position":[[417,11]]},"292":{"position":[[149,9]]},"293":{"position":[[78,12]]},"324":{"position":[[97,8],[114,7]]},"339":{"position":[[80,8]]},"359":{"position":[[501,7]]},"385":{"position":[[417,11]]},"389":{"position":[[218,7]]},"410":{"position":[[417,11]]},"466":{"position":[[319,8]]},"504":{"position":[[149,9]]},"505":{"position":[[78,12]]},"542":{"position":[[97,8],[114,7]]},"559":{"position":[[80,8]]},"575":{"position":[[501,7]]},"598":{"position":[[1407,7]]},"599":{"position":[[599,7]]},"601":{"position":[[1217,7]]},"627":{"position":[[417,11]]},"647":{"position":[[417,11]]},"659":{"position":[[218,7]]},"706":{"position":[[1407,7]]},"707":{"position":[[599,7]]},"709":{"position":[[1217,7]]}},"keywords":{}}],["complet",{"_index":173,"title":{"419":{"position":[[0,8]]},"656":{"position":[[0,8]]}},"content":{"5":{"position":[[114,9]]},"72":{"position":[[136,10]]},"236":{"position":[[136,10]]},"269":{"position":[[10,8]]},"270":{"position":[[42,10]]},"384":{"position":[[10,8]]},"385":{"position":[[42,10]]},"409":{"position":[[10,8]]},"410":{"position":[[42,10]]},"419":{"position":[[12,8]]},"440":{"position":[[3755,8]]},"472":{"position":[[136,10]]},"602":{"position":[[1026,10],[1360,10]]},"626":{"position":[[10,8]]},"627":{"position":[[42,10]]},"646":{"position":[[10,8]]},"647":{"position":[[42,10]]},"656":{"position":[[12,8]]},"687":{"position":[[3755,8]]},"710":{"position":[[1026,10],[1360,10]]}},"keywords":{}}],["complex",{"_index":1103,"title":{},"content":{"43":{"position":[[7,8]]},"84":{"position":[[527,7]]},"85":{"position":[[331,8]]},"110":{"position":[[216,7]]},"115":{"position":[[1748,7]]},"162":{"position":[[526,7],[1911,7]]},"199":{"position":[[207,7]]},"202":{"position":[[40,7]]},"209":{"position":[[28,7]]},"253":{"position":[[527,7]]},"254":{"position":[[331,8]]},"258":{"position":[[1694,7]]},"305":{"position":[[216,7]]},"351":{"position":[[563,7],[1933,7]]},"388":{"position":[[28,7]]},"413":{"position":[[79,7]]},"422":{"position":[[40,7]]},"435":{"position":[[207,7]]},"481":{"position":[[1694,7]]},"484":{"position":[[527,7]]},"485":{"position":[[331,8]]},"510":{"position":[[216,7]]},"567":{"position":[[563,7],[1933,7]]},"612":{"position":[[1728,7]]},"650":{"position":[[79,7]]},"658":{"position":[[28,7]]},"664":{"position":[[40,7]]},"682":{"position":[[207,7]]},"720":{"position":[[1728,7]]}},"keywords":{}}],["complianc",{"_index":3335,"title":{},"content":{"438":{"position":[[63,10]]},"685":{"position":[[63,10]]}},"keywords":{}}],["compon",{"_index":205,"title":{},"content":{"6":{"position":[[161,9]]},"171":{"position":[[51,10]]},"357":{"position":[[51,10]]},"573":{"position":[[51,10]]}},"keywords":{}}],["compos",{"_index":2430,"title":{},"content":{"199":{"position":[[192,7]]},"435":{"position":[[192,7]]},"612":{"position":[[1992,8]]},"682":{"position":[[192,7]]},"720":{"position":[[1992,8]]}},"keywords":{}}],["composit",{"_index":1500,"title":{"612":{"position":[[0,11]]},"720":{"position":[[0,11]]}},"content":{"81":{"position":[[231,9]]},"232":{"position":[[231,9]]},"246":{"position":[[50,11]]},"445":{"position":[[50,11]]},"463":{"position":[[231,9]]},"612":{"position":[[167,12],[254,11],[393,11],[1920,12]]},"618":{"position":[[181,11]]},"672":{"position":[[50,11]]},"720":{"position":[[167,12],[254,11],[393,11],[1920,12]]},"726":{"position":[[181,11]]}},"keywords":{}}],["compound",{"_index":551,"title":{},"content":{"18":{"position":[[114,8]]},"203":{"position":[[594,8]]},"423":{"position":[[594,8]]},"665":{"position":[[594,8]]}},"keywords":{}}],["comprehens",{"_index":2467,"title":{},"content":{"205":{"position":[[10,13]]},"425":{"position":[[10,13]]},"477":{"position":[[4100,13]]},"667":{"position":[[10,13]]},"699":{"position":[[4100,13]]}},"keywords":{}}],["compris",{"_index":1437,"title":{},"content":{"79":{"position":[[148,9]]},"230":{"position":[[148,9]]},"324":{"position":[[509,9]]},"461":{"position":[[148,9]]},"542":{"position":[[509,9]]}},"keywords":{}}],["compromis",{"_index":1735,"title":{},"content":{"115":{"position":[[1562,12]]},"258":{"position":[[1508,12]]},"481":{"position":[[1508,12]]}},"keywords":{}}],["comput",{"_index":183,"title":{},"content":{"5":{"position":[[228,11],[274,11]]},"8":{"position":[[158,8],[197,12],[513,7]]},"598":{"position":[[2171,12]]},"600":{"position":[[1076,12]]},"706":{"position":[[2171,12]]},"708":{"position":[[1076,12]]}},"keywords":{}}],["concaten",{"_index":1550,"title":{},"content":{"85":{"position":[[775,12]]},"211":{"position":[[676,12]]},"212":{"position":[[3621,11],[3680,12]]},"254":{"position":[[775,12]]},"390":{"position":[[650,12]]},"391":{"position":[[3639,11],[3698,12]]},"485":{"position":[[775,12]]},"660":{"position":[[650,12]]},"661":{"position":[[3639,11],[3698,12]]}},"keywords":{}}],["concatin",{"_index":798,"title":{},"content":{"31":{"position":[[2985,13]]}},"keywords":{}}],["conceiv",{"_index":1520,"title":{},"content":{"84":{"position":[[9,9]]},"253":{"position":[[9,9]]},"484":{"position":[[9,9]]}},"keywords":{}}],["concept",{"_index":552,"title":{"75":{"position":[[17,8]]},"76":{"position":[[16,9]]},"77":{"position":[[17,9]]},"226":{"position":[[17,8]]},"227":{"position":[[16,9]]},"228":{"position":[[17,9]]},"457":{"position":[[17,8]]},"458":{"position":[[16,9]]},"459":{"position":[[17,9]]}},"content":{"18":{"position":[[188,7]]},"22":{"position":[[537,8]]},"33":{"position":[[67,8]]},"38":{"position":[[662,8]]},"76":{"position":[[75,8]]},"80":{"position":[[94,9]]},"81":{"position":[[319,8]]},"110":{"position":[[224,8]]},"180":{"position":[[59,8]]},"197":{"position":[[815,8]]},"205":{"position":[[160,9]]},"227":{"position":[[75,8]]},"231":{"position":[[94,9]]},"232":{"position":[[319,8]]},"305":{"position":[[224,8]]},"371":{"position":[[59,8]]},"425":{"position":[[160,9]]},"433":{"position":[[814,8]]},"458":{"position":[[75,8]]},"462":{"position":[[94,9]]},"463":{"position":[[319,8]]},"510":{"position":[[224,8]]},"587":{"position":[[59,8]]},"600":{"position":[[873,9]]},"603":{"position":[[43,7]]},"667":{"position":[[160,9]]},"680":{"position":[[814,8]]},"708":{"position":[[873,9]]},"711":{"position":[[43,7]]}},"keywords":{}}],["concepts.bas",{"_index":3610,"title":{},"content":{"595":{"position":[[106,14]]},"703":{"position":[[106,14]]}},"keywords":{}}],["concern",{"_index":2179,"title":{},"content":{"184":{"position":[[46,10]]},"375":{"position":[[46,10]]},"591":{"position":[[46,10]]}},"keywords":{}}],["conclus",{"_index":853,"title":{"33":{"position":[[0,11]]},"44":{"position":[[0,11]]},"54":{"position":[[0,11]]},"81":{"position":[[0,11]]},"232":{"position":[[0,11]]},"398":{"position":[[0,11]]},"442":{"position":[[0,11]]},"463":{"position":[[0,11]]},"478":{"position":[[0,11]]},"618":{"position":[[0,11]]},"635":{"position":[[0,11]]},"689":{"position":[[0,11]]},"700":{"position":[[0,11]]},"726":{"position":[[0,11]]}},"content":{},"keywords":{}}],["condit",{"_index":986,"title":{},"content":{"39":{"position":[[2511,10]]}},"keywords":{}}],["conduct",{"_index":909,"title":{},"content":{"39":{"position":[[445,7]]}},"keywords":{}}],["config",{"_index":741,"title":{},"content":{"31":{"position":[[936,6]]}},"keywords":{}}],["config::istanbul",{"_index":742,"title":{},"content":{"31":{"position":[[945,19]]}},"keywords":{}}],["configur",{"_index":740,"title":{},"content":{"31":{"position":[[917,14]]},"168":{"position":[[123,9]]},"324":{"position":[[1650,13]]},"348":{"position":[[123,9]]},"416":{"position":[[2365,13]]},"542":{"position":[[1650,13]]},"564":{"position":[[123,9]]},"653":{"position":[[2365,13]]}},"keywords":{}}],["conflict",{"_index":947,"title":{},"content":{"39":{"position":[[1282,9]]}},"keywords":{}}],["conform",{"_index":2751,"title":{},"content":{"245":{"position":[[38,7]]},"444":{"position":[[38,7]]},"671":{"position":[[38,7]]}},"keywords":{}}],["congratul",{"_index":1219,"title":{},"content":{"51":{"position":[[1743,16]]},"175":{"position":[[457,16]]},"361":{"position":[[457,16]]},"395":{"position":[[6688,16]]},"577":{"position":[[457,16]]},"618":{"position":[[0,16]]},"632":{"position":[[6688,16]]},"726":{"position":[[0,16]]}},"keywords":{}}],["connect",{"_index":1866,"title":{},"content":{"128":{"position":[[674,10]]},"279":{"position":[[674,10]]},"516":{"position":[[674,10]]}},"keywords":{}}],["consecut",{"_index":1818,"title":{},"content":{"126":{"position":[[2179,11]]},"277":{"position":[[2347,11]]},"514":{"position":[[2179,11]]}},"keywords":{}}],["consid",{"_index":1445,"title":{},"content":{"79":{"position":[[477,8]]},"84":{"position":[[148,8]]},"115":{"position":[[0,8]]},"198":{"position":[[2622,10]]},"230":{"position":[[494,8]]},"253":{"position":[[148,8]]},"258":{"position":[[0,8]]},"267":{"position":[[788,8]]},"407":{"position":[[788,8]]},"434":{"position":[[2612,10]]},"461":{"position":[[494,8]]},"481":{"position":[[0,8]]},"484":{"position":[[148,8]]},"605":{"position":[[339,10]]},"644":{"position":[[788,8]]},"681":{"position":[[2622,10]]},"713":{"position":[[339,10]]}},"keywords":{}}],["consider",{"_index":2433,"title":{},"content":{"202":{"position":[[22,12]]},"422":{"position":[[22,12]]},"664":{"position":[[22,12]]}},"keywords":{}}],["consist",{"_index":942,"title":{},"content":{"39":{"position":[[1185,10]]},"79":{"position":[[1192,7]]},"107":{"position":[[7,8]]},"146":{"position":[[55,8]]},"178":{"position":[[70,8]]},"185":{"position":[[2597,8]]},"223":{"position":[[137,8]]},"230":{"position":[[1209,7]]},"274":{"position":[[7,8]]},"334":{"position":[[55,8]]},"369":{"position":[[70,8]]},"376":{"position":[[2581,8]]},"419":{"position":[[685,8]]},"456":{"position":[[137,8]]},"461":{"position":[[1209,7]]},"491":{"position":[[7,8]]},"551":{"position":[[55,8]]},"585":{"position":[[70,8]]},"592":{"position":[[2581,8]]},"612":{"position":[[1650,10]]},"656":{"position":[[685,8]]},"696":{"position":[[137,8]]},"720":{"position":[[1650,10]]}},"keywords":{}}],["const",{"_index":331,"title":{},"content":{"10":{"position":[[420,5],[495,5],[564,5]]},"31":{"position":[[551,5]]},"42":{"position":[[540,5],[608,5],[2074,5]]},"185":{"position":[[259,5]]},"206":{"position":[[120,5],[165,5],[207,5],[232,5]]},"212":{"position":[[204,5],[258,5],[329,5],[380,5]]},"269":{"position":[[4024,5],[4069,5],[4111,5],[4136,5]]},"376":{"position":[[243,5]]},"391":{"position":[[204,5],[258,5],[329,5],[380,5]]},"409":{"position":[[4024,5],[4069,5],[4111,5],[4136,5]]},"426":{"position":[[120,5],[165,5],[207,5],[232,5]]},"477":{"position":[[1616,5],[1642,5],[1670,5]]},"592":{"position":[[243,5]]},"599":{"position":[[153,5],[201,5],[320,5]]},"646":{"position":[[4024,5],[4069,5],[4111,5],[4136,5]]},"661":{"position":[[204,5],[258,5],[329,5],[380,5]]},"668":{"position":[[120,5],[165,5],[207,5],[232,5]]},"699":{"position":[[1616,5],[1642,5],[1670,5]]},"707":{"position":[[153,5],[201,5],[320,5]]}},"keywords":{}}],["constant",{"_index":3666,"title":{"599":{"position":[[0,9]]},"707":{"position":[[0,9]]}},"content":{"599":{"position":[[105,10],[137,9],[300,9],[335,9],[422,10]]},"707":{"position":[[105,10],[137,9],[300,9],[335,9],[422,10]]}},"keywords":{}}],["construct",{"_index":353,"title":{},"content":{"10":{"position":[[1134,10]]}},"keywords":{}}],["constructed."",{"_index":277,"title":{},"content":{"9":{"position":[[448,21]]}},"keywords":{}}],["constructor",{"_index":459,"title":{},"content":{"17":{"position":[[297,12]]},"22":{"position":[[920,11]]},"52":{"position":[[1992,11]]},"70":{"position":[[184,12]]},"74":{"position":[[71,11]]},"98":{"position":[[535,11]]},"99":{"position":[[31,11]]},"141":{"position":[[379,11]]},"147":{"position":[[174,12],[770,11]]},"148":{"position":[[694,11]]},"162":{"position":[[633,11]]},"178":{"position":[[458,12]]},"196":{"position":[[699,12]]},"204":{"position":[[1101,11]]},"209":{"position":[[210,11]]},"234":{"position":[[184,12]]},"238":{"position":[[71,11]]},"247":{"position":[[1601,11]]},"267":{"position":[[4020,14],[4079,11],[4111,11]]},"290":{"position":[[535,11]]},"291":{"position":[[31,11]]},"324":{"position":[[1678,11]]},"326":{"position":[[379,11]]},"335":{"position":[[174,12],[778,11]]},"336":{"position":[[694,11]]},"351":{"position":[[670,11]]},"369":{"position":[[458,12]]},"388":{"position":[[210,11]]},"407":{"position":[[4020,14],[4079,11],[4111,11]]},"424":{"position":[[1051,11]]},"432":{"position":[[636,12]]},"446":{"position":[[1601,11]]},"470":{"position":[[184,12]]},"474":{"position":[[71,11]]},"502":{"position":[[535,11]]},"503":{"position":[[31,11]]},"535":{"position":[[379,11]]},"542":{"position":[[1678,11]]},"552":{"position":[[174,12],[778,11]]},"553":{"position":[[694,11]]},"567":{"position":[[670,11]]},"585":{"position":[[458,12]]},"596":{"position":[[1196,12],[1247,12]]},"599":{"position":[[537,12]]},"644":{"position":[[4020,14],[4079,11],[4111,11]]},"658":{"position":[[210,11]]},"666":{"position":[[1051,11]]},"673":{"position":[[1601,11]]},"679":{"position":[[636,12]]},"704":{"position":[[1196,12],[1247,12]]},"707":{"position":[[537,12]]}},"keywords":{}}],["constructor'",{"_index":3058,"title":{},"content":{"324":{"position":[[1526,13]]},"542":{"position":[[1526,13]]}},"keywords":{}}],["constructor(str",{"_index":1114,"title":{},"content":{"43":{"position":[[220,18]]}},"keywords":{}}],["constructor,error",{"_index":2306,"title":{},"content":{"193":{"position":[[112,17]]},"429":{"position":[[112,17]]},"676":{"position":[[112,17]]}},"keywords":{}}],["constructor.l7",{"_index":2400,"title":{},"content":{"198":{"position":[[1603,14]]},"434":{"position":[[1593,14]]},"681":{"position":[[1603,14]]}},"keywords":{}}],["constructorspay",{"_index":877,"title":{},"content":{"38":{"position":[[680,19]]}},"keywords":{}}],["consult",{"_index":105,"title":{},"content":{"2":{"position":[[289,10]]}},"keywords":{}}],["consum",{"_index":1009,"title":{},"content":{"39":{"position":[[3188,9]]},"613":{"position":[[1515,8]]},"721":{"position":[[1515,8]]}},"keywords":{}}],["contact",{"_index":2309,"title":{},"content":{"193":{"position":[[182,7]]},"429":{"position":[[182,7]]},"676":{"position":[[182,7]]}},"keywords":{}}],["contact@odra.dev",{"_index":394,"title":{},"content":{"13":{"position":[[85,17]]},"24":{"position":[[159,17]]},"34":{"position":[[57,17]]},"55":{"position":[[57,17]]}},"keywords":{}}],["contain",{"_index":1310,"title":{},"content":{"53":{"position":[[1148,10]]},"84":{"position":[[320,8]]},"108":{"position":[[169,10],[215,9]]},"119":{"position":[[1024,7]]},"185":{"position":[[3014,10]]},"204":{"position":[[1040,8]]},"253":{"position":[[320,8]]},"275":{"position":[[173,10],[219,9]]},"300":{"position":[[1024,7]]},"323":{"position":[[98,8]]},"376":{"position":[[2998,10]]},"416":{"position":[[902,8],[919,10]]},"424":{"position":[[991,8]]},"440":{"position":[[3464,8],[3833,8]]},"484":{"position":[[320,8]]},"492":{"position":[[173,10],[219,9]]},"521":{"position":[[1024,7]]},"541":{"position":[[98,8]]},"592":{"position":[[2998,10]]},"596":{"position":[[686,8],[898,8]]},"601":{"position":[[2025,10]]},"610":{"position":[[586,7]]},"613":{"position":[[1383,8],[1867,7]]},"653":{"position":[[902,8],[919,10]]},"666":{"position":[[991,8]]},"687":{"position":[[3464,8],[3833,8]]},"704":{"position":[[686,8],[898,8]]},"709":{"position":[[2025,10]]},"718":{"position":[[586,7]]},"721":{"position":[[1383,8],[1867,7]]}},"keywords":{}}],["content",{"_index":3165,"title":{},"content":{"395":{"position":[[3660,8]]},"632":{"position":[[3660,8]]}},"keywords":{}}],["context",{"_index":655,"title":{"94":{"position":[[0,8]]},"286":{"position":[[0,8]]},"498":{"position":[[0,8]]}},"content":{"22":{"position":[[647,8]]},"39":{"position":[[513,7]]},"95":{"position":[[200,7]]},"102":{"position":[[484,8]]},"141":{"position":[[120,7],[1486,7]]},"158":{"position":[[77,8]]},"168":{"position":[[107,8]]},"287":{"position":[[200,7]]},"294":{"position":[[484,8]]},"324":{"position":[[1177,8]]},"326":{"position":[[120,7],[1486,7]]},"331":{"position":[[77,8]]},"346":{"position":[[13,7]]},"348":{"position":[[107,8]]},"499":{"position":[[200,7]]},"506":{"position":[[484,8]]},"535":{"position":[[120,7],[1486,7]]},"542":{"position":[[1177,8]]},"548":{"position":[[77,8]]},"564":{"position":[[107,8]]},"606":{"position":[[1015,7]]},"714":{"position":[[1015,7]]}},"keywords":{}}],["continu",{"_index":1976,"title":{},"content":{"143":{"position":[[857,8]]},"176":{"position":[[50,8]]},"328":{"position":[[832,8]]},"362":{"position":[[50,8]]},"414":{"position":[[665,8]]},"537":{"position":[[832,8]]},"578":{"position":[[50,8]]},"651":{"position":[[665,8]]}},"keywords":{}}],["contract",{"_index":18,"title":{"64":{"position":[[9,9]]},"65":{"position":[[13,8]]},"66":{"position":[[15,9]]},"80":{"position":[[16,9]]},"90":{"position":[[0,8]]},"97":{"position":[[12,8]]},"102":{"position":[[18,9]]},"110":{"position":[[0,8]]},"121":{"position":[[11,8]]},"141":{"position":[[0,8]]},"142":{"position":[[12,9]]},"154":{"position":[[13,8]]},"208":{"position":[[38,8]]},"209":{"position":[[0,9]]},"210":{"position":[[14,9]]},"231":{"position":[[16,9]]},"239":{"position":[[9,9]]},"240":{"position":[[13,8]]},"241":{"position":[[15,9]]},"267":{"position":[[18,10]]},"282":{"position":[[0,8]]},"289":{"position":[[12,8]]},"294":{"position":[[18,9]]},"302":{"position":[[11,8]]},"305":{"position":[[0,8]]},"320":{"position":[[7,8]]},"326":{"position":[[0,8]]},"327":{"position":[[12,9]]},"339":{"position":[[13,8]]},"383":{"position":[[17,8]]},"387":{"position":[[38,8]]},"388":{"position":[[0,9]]},"389":{"position":[[14,9]]},"407":{"position":[[18,10]]},"438":{"position":[[14,9]]},"440":{"position":[[0,8]]},"462":{"position":[[16,9]]},"464":{"position":[[9,9]]},"465":{"position":[[13,8]]},"466":{"position":[[15,9]]},"476":{"position":[[0,9]]},"494":{"position":[[0,8]]},"501":{"position":[[12,8]]},"506":{"position":[[18,9]]},"510":{"position":[[0,8]]},"523":{"position":[[11,8]]},"535":{"position":[[0,8]]},"536":{"position":[[12,9]]},"538":{"position":[[7,8]]},"559":{"position":[[13,8]]},"625":{"position":[[17,8]]},"644":{"position":[[18,10]]},"657":{"position":[[38,8]]},"658":{"position":[[0,9]]},"659":{"position":[[14,9]]},"685":{"position":[[14,9]]},"687":{"position":[[0,8]]},"698":{"position":[[0,9]]}},"content":{"1":{"position":[[164,8],[432,8],[1043,10]]},"2":{"position":[[571,10]]},"5":{"position":[[144,10]]},"6":{"position":[[336,8]]},"10":{"position":[[118,8],[254,8],[309,8],[651,8]]},"15":{"position":[[246,9],[410,10],[511,10]]},"17":{"position":[[1735,8],[1818,8]]},"18":{"position":[[29,10]]},"20":{"position":[[200,10],[263,8]]},"21":{"position":[[90,8]]},"22":{"position":[[27,8],[198,8],[362,8],[428,8],[761,9],[863,9],[905,8]]},"30":{"position":[[167,8]]},"31":{"position":[[177,8],[220,8],[537,9],[811,10],[1405,8],[1715,8],[2297,8]]},"38":{"position":[[45,8],[186,8],[480,8],[1049,9]]},"39":{"position":[[504,8],[615,8],[2098,10],[3337,8]]},"40":{"position":[[303,8]]},"42":{"position":[[76,8],[365,8],[814,9],[931,8],[1228,8],[1727,9],[1764,9],[1783,8],[1943,9],[2000,9],[2184,8],[2440,8]]},"43":{"position":[[52,9],[111,9],[161,8],[671,8],[774,8],[1709,8],[1817,8],[1874,9]]},"44":{"position":[[146,8],[222,9],[264,9]]},"50":{"position":[[20,8],[288,8]]},"51":{"position":[[38,8],[164,8],[251,8],[277,8],[1810,9],[1872,8]]},"52":{"position":[[68,9],[165,8],[1099,8],[1620,8],[1781,8],[1831,8],[1950,9],[2019,8],[3201,9],[3305,8],[3331,8],[4691,8],[4858,8],[6553,8]]},"54":{"position":[[128,8],[268,8]]},"65":{"position":[[13,8],[253,8],[363,8],[572,9]]},"70":{"position":[[21,9],[107,9]]},"72":{"position":[[28,9],[345,10]]},"73":{"position":[[612,8]]},"76":{"position":[[185,8],[256,9],[559,9]]},"80":{"position":[[53,8]]},"81":{"position":[[68,8],[166,9],[403,10]]},"83":{"position":[[109,8]]},"91":{"position":[[313,8],[577,8],[747,9]]},"92":{"position":[[26,8],[79,9],[150,8],[313,9],[437,9],[581,8],[716,8],[780,8],[900,8]]},"93":{"position":[[136,8]]},"94":{"position":[[129,8],[537,8],[577,8]]},"95":{"position":[[41,9]]},"97":{"position":[[37,8]]},"98":{"position":[[21,8],[71,8],[221,8],[438,8],[512,9]]},"99":{"position":[[15,8]]},"100":{"position":[[128,8],[293,9],[896,8],[968,8],[1097,8]]},"101":{"position":[[69,8],[136,8]]},"102":{"position":[[246,9],[263,8],[293,8],[541,9]]},"103":{"position":[[142,8]]},"107":{"position":[[39,8],[76,8],[107,9],[169,9]]},"108":{"position":[[160,8],[189,8],[281,8]]},"110":{"position":[[4,8],[141,9],[443,8],[530,8]]},"111":{"position":[[17,8],[285,10]]},"114":{"position":[[40,9]]},"115":{"position":[[1378,8],[1520,8],[1756,10],[2983,9],[3097,8],[3329,10]]},"118":{"position":[[36,8]]},"119":{"position":[[479,9],[704,10]]},"120":{"position":[[59,9],[311,9],[404,9]]},"121":{"position":[[90,9],[208,9],[421,9]]},"124":{"position":[[50,9]]},"126":{"position":[[502,10],[723,10],[1223,8],[1861,8],[2268,9],[2496,8],[2640,9],[2861,8]]},"128":{"position":[[541,8],[697,9],[769,9]]},"132":{"position":[[46,9],[129,13],[210,9],[270,8],[314,9]]},"133":{"position":[[36,8]]},"138":{"position":[[1183,8]]},"141":{"position":[[96,9],[172,10],[340,8],[544,8],[687,9],[706,9],[733,9],[791,9],[872,8],[1129,9],[1150,8]]},"142":{"position":[[44,8],[142,9],[188,8]]},"143":{"position":[[685,9],[725,9],[764,9],[886,8],[1291,8]]},"146":{"position":[[295,9],[351,10],[496,9]]},"147":{"position":[[211,8],[447,8],[558,9],[789,9],[943,8]]},"148":{"position":[[312,8],[542,8],[887,8]]},"154":{"position":[[65,8],[122,13],[239,8],[315,13],[363,13]]},"155":{"position":[[116,9]]},"157":{"position":[[93,8]]},"158":{"position":[[49,9],[68,8]]},"160":{"position":[[37,8]]},"162":{"position":[[257,8],[601,8]]},"163":{"position":[[188,9]]},"166":{"position":[[93,9]]},"168":{"position":[[98,8],[141,9],[1263,9],[1369,9],[1476,9],[2189,8]]},"173":{"position":[[520,9]]},"174":{"position":[[77,10]]},"175":{"position":[[207,8],[272,8],[502,9]]},"178":{"position":[[517,8],[1318,8]]},"182":{"position":[[377,8]]},"185":{"position":[[3304,8]]},"197":{"position":[[1660,8]]},"198":{"position":[[1415,8],[1753,8],[2450,9],[2536,9],[2635,9],[2661,9],[2830,9],[2906,8],[3350,8],[3822,8]]},"199":{"position":[[126,9],[215,9]]},"206":{"position":[[567,8],[641,8],[1121,9],[1759,9]]},"209":{"position":[[14,8],[56,8],[751,8]]},"210":{"position":[[230,8],[312,8],[1115,9]]},"211":{"position":[[25,9]]},"212":{"position":[[190,8]]},"218":{"position":[[125,8]]},"220":{"position":[[92,8]]},"221":{"position":[[442,9],[579,8],[728,8],[817,8],[893,8],[919,8]]},"222":{"position":[[452,8]]},"223":{"position":[[38,9],[91,8],[128,8],[227,8],[956,8]]},"227":{"position":[[185,8],[256,9],[559,9]]},"231":{"position":[[53,8]]},"232":{"position":[[68,8],[166,9],[403,10]]},"234":{"position":[[21,9],[107,9]]},"236":{"position":[[28,9],[345,10]]},"237":{"position":[[612,8]]},"240":{"position":[[13,8],[253,8],[363,8],[572,9]]},"248":{"position":[[65,10]]},"252":{"position":[[109,8]]},"257":{"position":[[40,9]]},"258":{"position":[[1324,8],[1466,8],[1702,10],[2909,9],[3023,8],[3255,10]]},"264":{"position":[[47,10]]},"266":{"position":[[125,13]]},"267":{"position":[[10,9],[172,10],[1900,8],[3508,8],[3563,8],[3650,8]]},"268":{"position":[[31,10],[236,8],[279,8],[574,8],[694,8],[837,8],[1042,8]]},"269":{"position":[[38,8],[4477,8],[4551,8],[5031,9],[5669,9]]},"274":{"position":[[39,8],[76,8],[107,9],[169,9]]},"275":{"position":[[164,8],[193,8],[285,8]]},"277":{"position":[[502,10],[723,10],[1391,8],[2029,8],[2436,9],[2664,8],[2808,9],[3029,8]]},"279":{"position":[[541,8],[697,9],[769,9]]},"283":{"position":[[313,8],[577,8],[747,9]]},"284":{"position":[[26,8],[79,9],[150,8],[313,9],[437,9],[581,8],[716,8],[780,8],[900,8]]},"285":{"position":[[136,8]]},"286":{"position":[[129,8],[537,8],[577,8]]},"287":{"position":[[41,9]]},"289":{"position":[[37,8]]},"290":{"position":[[21,8],[71,8],[221,8],[438,8],[512,9]]},"291":{"position":[[15,8]]},"292":{"position":[[128,8],[293,9],[896,8],[968,8],[1097,8]]},"293":{"position":[[69,8],[136,8]]},"294":{"position":[[246,9],[263,8],[293,8],[541,9]]},"295":{"position":[[142,8]]},"299":{"position":[[36,8]]},"300":{"position":[[479,9],[704,10]]},"301":{"position":[[59,9],[311,9],[404,9]]},"302":{"position":[[90,9],[208,9],[421,9]]},"305":{"position":[[4,8],[141,9],[443,8],[530,8]]},"306":{"position":[[17,8],[285,10]]},"309":{"position":[[50,9]]},"312":{"position":[[46,9],[129,13],[210,9],[270,8],[314,9]]},"313":{"position":[[36,8]]},"318":{"position":[[1175,8]]},"321":{"position":[[536,9],[626,9],[720,8],[837,8],[1061,9],[1304,8],[1477,8]]},"322":{"position":[[135,8]]},"323":{"position":[[137,9],[1769,8],[2722,9],[3333,8]]},"324":{"position":[[260,8],[387,9],[573,9],[760,9],[902,8],[1168,8],[1243,8],[1436,8]]},"326":{"position":[[96,9],[172,10],[340,8],[544,8],[687,9],[706,9],[733,9],[791,9],[872,8],[1129,9],[1150,8]]},"327":{"position":[[44,8],[142,9],[188,8]]},"328":{"position":[[660,9],[700,9],[739,9],[861,8],[1266,8]]},"330":{"position":[[93,8]]},"331":{"position":[[49,9],[68,8]]},"334":{"position":[[295,9],[351,10],[500,9]]},"335":{"position":[[211,8],[451,8],[562,9],[797,9],[951,8]]},"336":{"position":[[312,8],[542,8],[887,8]]},"339":{"position":[[65,8],[122,13],[239,8],[315,13],[363,13]]},"340":{"position":[[116,9]]},"345":{"position":[[37,8]]},"348":{"position":[[98,8],[141,9],[1263,9],[1369,9],[1476,9],[2199,8]]},"351":{"position":[[257,8],[638,8]]},"352":{"position":[[188,9]]},"355":{"position":[[93,9]]},"359":{"position":[[520,9]]},"360":{"position":[[77,10]]},"361":{"position":[[207,8],[272,8],[502,9]]},"369":{"position":[[517,8],[1318,8]]},"373":{"position":[[377,8]]},"376":{"position":[[3288,8]]},"382":{"position":[[53,8],[78,8]]},"383":{"position":[[30,8]]},"384":{"position":[[38,8]]},"388":{"position":[[14,8],[56,8],[683,8]]},"389":{"position":[[230,8],[312,8],[1052,9]]},"390":{"position":[[25,9]]},"391":{"position":[[190,8]]},"393":{"position":[[509,8]]},"394":{"position":[[14,8],[571,9]]},"395":{"position":[[159,8],[263,8],[915,9],[1756,9],[2146,9],[2198,8],[3746,10],[3899,10],[4996,8],[6710,8]]},"396":{"position":[[176,8],[360,8],[566,8],[660,8],[723,8],[1190,8]]},"397":{"position":[[147,9],[202,8]]},"398":{"position":[[210,9]]},"404":{"position":[[47,10]]},"406":{"position":[[125,13]]},"407":{"position":[[10,9],[172,10],[1900,8],[3508,8],[3563,8],[3650,8]]},"408":{"position":[[31,10],[236,8],[279,8],[574,8],[694,8],[837,8],[1042,8]]},"409":{"position":[[38,8],[4477,8],[4551,8],[5031,9],[5669,9]]},"416":{"position":[[1402,9],[2839,8],[2929,9],[3186,9],[4004,8],[4892,8]]},"419":{"position":[[1310,8],[3921,9],[4794,8],[4884,9],[5583,8]]},"426":{"position":[[567,8],[641,8],[1116,9],[1749,9]]},"433":{"position":[[1659,8]]},"434":{"position":[[1405,8],[1743,8],[2440,9],[2526,9],[2625,9],[2651,9],[2820,9],[2896,8],[3332,8],[3804,8]]},"435":{"position":[[126,9],[215,9]]},"438":{"position":[[17,8]]},"440":{"position":[[42,8],[3383,9],[3723,9],[3764,8],[4580,9],[4780,9],[5151,8],[5414,8],[5524,8],[5605,8],[5685,8]]},"441":{"position":[[308,9],[358,8],[433,9],[1977,9],[2062,9],[2168,8],[2203,8],[2696,8],[3487,9],[3800,8],[4212,8]]},"442":{"position":[[208,8]]},"447":{"position":[[65,10]]},"451":{"position":[[125,8]]},"453":{"position":[[92,8]]},"454":{"position":[[442,9],[579,8],[728,8],[817,8],[893,8],[919,8]]},"455":{"position":[[452,8]]},"456":{"position":[[38,9],[91,8],[128,8],[227,8],[956,8]]},"458":{"position":[[185,8],[256,9],[559,9]]},"462":{"position":[[53,8]]},"463":{"position":[[68,8],[166,9],[403,10]]},"465":{"position":[[13,8],[253,8],[363,8],[572,9]]},"470":{"position":[[21,9],[107,9]]},"472":{"position":[[28,9],[345,10]]},"473":{"position":[[612,8]]},"476":{"position":[[50,8],[457,8],[613,9],[1204,9],[1582,8]]},"477":{"position":[[286,8],[543,9],[1368,9],[1838,8],[1968,9],[1978,8],[2144,9],[2912,8],[3804,8],[3925,9]]},"478":{"position":[[126,9]]},"480":{"position":[[40,9]]},"481":{"position":[[1324,8],[1466,8],[1702,10],[2909,9],[3023,8],[3255,10]]},"483":{"position":[[109,8]]},"491":{"position":[[39,8],[76,8],[107,9],[169,9]]},"492":{"position":[[164,8],[193,8],[285,8]]},"495":{"position":[[313,8],[577,8],[747,9]]},"496":{"position":[[26,8],[79,9],[150,8],[313,9],[437,9],[581,8],[716,8],[780,8],[900,8]]},"497":{"position":[[136,8]]},"498":{"position":[[129,8],[537,8],[577,8]]},"499":{"position":[[41,9]]},"501":{"position":[[37,8]]},"502":{"position":[[21,8],[71,8],[221,8],[438,8],[512,9]]},"503":{"position":[[15,8]]},"504":{"position":[[128,8],[293,9],[896,8],[968,8],[1097,8]]},"505":{"position":[[69,8],[136,8]]},"506":{"position":[[246,9],[263,8],[293,8],[541,9]]},"507":{"position":[[142,8]]},"510":{"position":[[4,8],[141,9],[443,8],[530,8]]},"511":{"position":[[17,8],[285,10]]},"514":{"position":[[502,10],[723,10],[1223,8],[1861,8],[2268,9],[2496,8],[2640,9],[2861,8]]},"516":{"position":[[541,8],[697,9],[769,9]]},"520":{"position":[[36,8]]},"521":{"position":[[479,9],[704,10]]},"522":{"position":[[59,9],[311,9],[404,9]]},"523":{"position":[[90,9],[208,9],[421,9]]},"526":{"position":[[50,9]]},"529":{"position":[[46,9],[129,13],[210,9],[270,8],[314,9]]},"530":{"position":[[36,8]]},"535":{"position":[[96,9],[172,10],[340,8],[544,8],[687,9],[706,9],[733,9],[791,9],[872,8],[1129,9],[1150,8]]},"536":{"position":[[44,8],[142,9],[188,8]]},"537":{"position":[[660,9],[700,9],[739,9],[861,8],[1266,8]]},"539":{"position":[[536,9],[626,9],[720,8],[837,8],[1061,9],[1304,8],[1477,8]]},"540":{"position":[[135,8]]},"541":{"position":[[137,9],[1769,8],[2722,9],[3333,8]]},"542":{"position":[[260,8],[387,9],[573,9],[760,9],[902,8],[1168,8],[1243,8],[1436,8]]},"544":{"position":[[1175,8]]},"547":{"position":[[93,8]]},"548":{"position":[[49,9],[68,8]]},"551":{"position":[[295,9],[351,10],[500,9]]},"552":{"position":[[211,8],[451,8],[562,9],[797,9],[951,8]]},"553":{"position":[[312,8],[542,8],[887,8]]},"559":{"position":[[65,8],[122,13],[239,8],[315,13],[363,13]]},"560":{"position":[[116,9]]},"562":{"position":[[37,8]]},"564":{"position":[[98,8],[141,9],[1263,9],[1369,9],[1476,9],[2189,8]]},"567":{"position":[[257,8],[638,8]]},"568":{"position":[[188,9]]},"571":{"position":[[93,9]]},"575":{"position":[[520,9]]},"576":{"position":[[77,10]]},"577":{"position":[[207,8],[272,8],[502,9]]},"585":{"position":[[517,8],[1318,8]]},"589":{"position":[[377,8]]},"592":{"position":[[3288,8]]},"594":{"position":[[98,8],[229,9]]},"595":{"position":[[97,8]]},"596":{"position":[[50,8],[122,8],[550,8],[1187,8]]},"598":{"position":[[1817,8]]},"600":{"position":[[661,9]]},"602":{"position":[[759,9],[1992,9]]},"604":{"position":[[5,9],[484,8]]},"605":{"position":[[399,8]]},"607":{"position":[[83,10],[334,8]]},"609":{"position":[[307,8]]},"612":{"position":[[96,10],[223,10],[269,9],[296,8],[1420,8],[1458,10],[1566,9],[1938,8],[1975,9],[2146,10]]},"613":{"position":[[1267,9],[1556,8],[1619,8],[1944,10]]},"614":{"position":[[15,8],[154,8],[226,8]]},"616":{"position":[[646,8]]},"617":{"position":[[991,8]]},"618":{"position":[[74,9],[564,8]]},"624":{"position":[[53,8],[78,8]]},"625":{"position":[[30,8]]},"626":{"position":[[38,8]]},"630":{"position":[[509,8]]},"631":{"position":[[14,8],[571,9]]},"632":{"position":[[159,8],[263,8],[915,9],[1756,9],[2146,9],[2198,8],[3746,10],[3899,10],[4996,8],[6710,8]]},"633":{"position":[[176,8],[360,8],[566,8],[660,8],[723,8],[1190,8]]},"634":{"position":[[147,9],[202,8]]},"635":{"position":[[210,9]]},"641":{"position":[[47,10]]},"643":{"position":[[125,13]]},"644":{"position":[[10,9],[172,10],[1900,8],[3508,8],[3563,8],[3650,8]]},"645":{"position":[[31,10],[236,8],[279,8],[574,8],[694,8],[837,8],[1042,8]]},"646":{"position":[[38,8],[4477,8],[4551,8],[5031,9],[5669,9]]},"653":{"position":[[1402,9],[2839,8],[2929,9],[3186,9],[4004,8],[4892,8]]},"656":{"position":[[1310,8],[3921,9],[4794,8],[4884,9],[5583,8]]},"658":{"position":[[14,8],[56,8],[683,8]]},"659":{"position":[[230,8],[312,8],[1052,9]]},"660":{"position":[[25,9]]},"661":{"position":[[190,8]]},"668":{"position":[[567,8],[641,8],[1121,9],[1759,9]]},"674":{"position":[[65,10]]},"680":{"position":[[1659,8]]},"681":{"position":[[1415,8],[1753,8],[2450,9],[2536,9],[2635,9],[2661,9],[2830,9],[2906,8],[3350,8],[3822,8]]},"682":{"position":[[126,9],[215,9]]},"685":{"position":[[17,8]]},"687":{"position":[[42,8],[3383,9],[3723,9],[3764,8],[4580,9],[4780,9],[5151,8],[5414,8],[5524,8],[5605,8],[5685,8]]},"688":{"position":[[308,9],[358,8],[433,9],[1977,9],[2062,9],[2168,8],[2203,8],[2696,8],[3487,9],[3800,8],[4212,8]]},"689":{"position":[[208,8]]},"691":{"position":[[125,8]]},"693":{"position":[[92,8]]},"694":{"position":[[442,9],[579,8],[728,8],[817,8],[893,8],[919,8]]},"695":{"position":[[452,8]]},"696":{"position":[[38,9],[91,8],[128,8],[227,8],[956,8]]},"698":{"position":[[50,8],[457,8],[613,9],[1204,9],[1582,8]]},"699":{"position":[[286,8],[543,9],[1368,9],[1838,8],[1968,9],[1978,8],[2144,9],[2912,8],[3804,8],[3925,9]]},"700":{"position":[[126,9]]},"702":{"position":[[98,8],[229,9]]},"703":{"position":[[97,8]]},"704":{"position":[[50,8],[122,8],[550,8],[1187,8]]},"706":{"position":[[1817,8]]},"708":{"position":[[661,9]]},"710":{"position":[[759,9],[1992,9]]},"712":{"position":[[5,9],[484,8]]},"713":{"position":[[399,8]]},"715":{"position":[[83,10],[334,8]]},"717":{"position":[[307,8]]},"720":{"position":[[96,10],[223,10],[269,9],[296,8],[1420,8],[1458,10],[1566,9],[1938,8],[1975,9],[2146,10]]},"721":{"position":[[1267,9],[1556,8],[1619,8],[1944,10]]},"722":{"position":[[15,8],[154,8],[226,8]]},"724":{"position":[[646,8]]},"725":{"position":[[991,8]]},"726":{"position":[[74,9],[564,8]]}},"keywords":{}}],["contract"",{"_index":2683,"title":{},"content":{"212":{"position":[[4527,15]]},"323":{"position":[[2216,15]]},"391":{"position":[[4545,15]]},"541":{"position":[[2216,15]]},"661":{"position":[[4545,15]]}},"keywords":{}}],["contract'",{"_index":1276,"title":{},"content":{"52":{"position":[[2134,10]]},"72":{"position":[[279,10]]},"92":{"position":[[515,10]]},"195":{"position":[[514,10]]},"198":{"position":[[3646,10]]},"204":{"position":[[1267,10]]},"236":{"position":[[279,10]]},"284":{"position":[[515,10]]},"324":{"position":[[1390,10]]},"396":{"position":[[439,10]]},"416":{"position":[[4658,10]]},"424":{"position":[[1217,10]]},"431":{"position":[[514,10]]},"434":{"position":[[3628,10]]},"472":{"position":[[279,10]]},"477":{"position":[[233,10],[3947,10],[4013,10]]},"496":{"position":[[515,10]]},"542":{"position":[[1390,10]]},"596":{"position":[[699,10],[756,10]]},"603":{"position":[[328,10]]},"633":{"position":[[439,10]]},"653":{"position":[[4658,10]]},"666":{"position":[[1217,10]]},"678":{"position":[[514,10]]},"681":{"position":[[3646,10]]},"699":{"position":[[233,10],[3947,10],[4013,10]]},"704":{"position":[[699,10],[756,10]]},"711":{"position":[[328,10]]}},"keywords":{}}],["contract.address",{"_index":1984,"title":{},"content":{"143":{"position":[[1347,19]]},"328":{"position":[[1322,19]]},"537":{"position":[[1322,19]]}},"keywords":{}}],["contract.count_ref_recursive(11",{"_index":1401,"title":{},"content":{"73":{"position":[[695,33]]},"237":{"position":[[695,33]]},"473":{"position":[[695,33]]}},"keywords":{}}],["contract.field",{"_index":3043,"title":{},"content":{"324":{"position":[[126,15]]},"542":{"position":[[126,15]]}},"keywords":{}}],["contract.flip",{"_index":2005,"title":{},"content":{"148":{"position":[[391,16]]},"178":{"position":[[1397,16]]},"336":{"position":[[391,16]]},"369":{"position":[[1397,16]]},"553":{"position":[[391,16]]},"585":{"position":[[1397,16]]}},"keywords":{}}],["contract.get_balance(&cal",{"_index":3576,"title":{},"content":{"477":{"position":[[2078,35],[2248,35]]},"699":{"position":[[2078,35],[2248,35]]}},"keywords":{}}],["contract.get_status(some(account",{"_index":1091,"title":{},"content":{"42":{"position":[[2356,38],[2512,36]]}},"keywords":{}}],["contract.incr",{"_index":2741,"title":{},"content":{"223":{"position":[[1022,21]]},"456":{"position":[[1022,21]]},"696":{"position":[[1022,21]]}},"keywords":{}}],["contract.issu",{"_index":3431,"title":{},"content":{"440":{"position":[[4639,14]]},"687":{"position":[[4639,14]]}},"keywords":{}}],["contract.issue_ticket("ev".to_str",{"_index":3445,"title":{},"content":{"440":{"position":[[5212,49],[5280,49]]},"687":{"position":[[5212,49],[5280,49]]}},"keywords":{}}],["contract.l17",{"_index":3325,"title":{},"content":{"432":{"position":[[724,12]]},"679":{"position":[[724,12]]}},"keywords":{}}],["contract.l23",{"_index":2332,"title":{},"content":{"196":{"position":[[787,12]]}},"keywords":{}}],["contract.l36",{"_index":3515,"title":{},"content":{"441":{"position":[[3974,12]]},"688":{"position":[[3974,12]]}},"keywords":{}}],["contract.l9",{"_index":3492,"title":{},"content":{"441":{"position":[[1646,11]]},"688":{"position":[[1646,11]]}},"keywords":{}}],["contract.paus",{"_index":2742,"title":{},"content":{"223":{"position":[[1044,17]]},"456":{"position":[[1044,17]]},"696":{"position":[[1044,17]]}},"keywords":{}}],["contract.set_status("hello".to_str",{"_index":1089,"title":{},"content":{"42":{"position":[[2262,51]]}},"keywords":{}}],["contract.th",{"_index":2548,"title":{},"content":{"209":{"position":[[274,12]]},"388":{"position":[[274,12]]},"658":{"position":[[274,12]]}},"keywords":{}}],["contract.try_increment().unwrap_err",{"_index":2743,"title":{},"content":{"223":{"position":[[1074,38]]},"456":{"position":[[1074,38]]},"696":{"position":[[1074,38]]}},"keywords":{}}],["contract.withdraw(&u512::from(withdraw",{"_index":3577,"title":{},"content":{"477":{"position":[[2154,47]]},"699":{"position":[[2154,47]]}},"keywords":{}}],["contract/submodul",{"_index":3776,"title":{},"content":{"607":{"position":[[185,18]]},"715":{"position":[[185,18]]}},"keywords":{}}],["contract1",{"_index":2158,"title":{},"content":{"178":{"position":[[1510,9]]},"369":{"position":[[1510,9]]},"585":{"position":[[1510,9]]}},"keywords":{}}],["contract1.flip",{"_index":2162,"title":{},"content":{"178":{"position":[[1676,17]]},"369":{"position":[[1676,17]]},"585":{"position":[[1676,17]]}},"keywords":{}}],["contract2",{"_index":2159,"title":{},"content":{"178":{"position":[[1568,9]]},"369":{"position":[[1568,9]]},"585":{"position":[[1568,9]]}},"keywords":{}}],["contract@odra.devwith",{"_index":112,"title":{},"content":{"2":{"position":[[369,21]]}},"keywords":{}}],["contract_addr.cal",{"_index":3787,"title":{},"content":{"609":{"position":[[138,19]]},"717":{"position":[[138,19]]}},"keywords":{}}],["contract_address",{"_index":2145,"title":{},"content":{"168":{"position":[[2088,17]]},"348":{"position":[[2104,17]]},"564":{"position":[[2088,17]]}},"keywords":{}}],["contract_env",{"_index":464,"title":{},"content":{"17":{"position":[[370,13],[1892,13]]},"51":{"position":[[418,14]]},"267":{"position":[[1815,12],[1993,12]]},"407":{"position":[[1815,12],[1993,12]]},"644":{"position":[[1815,12],[1993,12]]}},"keywords":{}}],["contract_env::attached_valu",{"_index":1605,"title":{},"content":{"92":{"position":[[943,30]]},"284":{"position":[[943,30]]},"496":{"position":[[943,30]]}},"keywords":{}}],["contract_env::cal",{"_index":494,"title":{},"content":{"17":{"position":[[1154,23],[2757,23],[3172,23],[3768,23]]},"51":{"position":[[888,22]]}},"keywords":{}}],["contract_env::revert(error::insufficientallow",{"_index":541,"title":{},"content":{"17":{"position":[[3481,51]]}},"keywords":{}}],["contract_env::revert(error::insufficientbal",{"_index":536,"title":{},"content":{"17":{"position":[[2926,49],[3405,49]]}},"keywords":{}}],["contract_env::revert(error::messagealreadydefin",{"_index":498,"title":{},"content":{"17":{"position":[[1275,51]]}},"keywords":{}}],["contract_hash",{"_index":2616,"title":{},"content":{"212":{"position":[[210,14]]},"391":{"position":[[210,14]]},"661":{"position":[[210,14]]}},"keywords":{}}],["contract_hash.to_str",{"_index":2632,"title":{},"content":{"212":{"position":[[1083,26]]},"391":{"position":[[1083,26]]},"661":{"position":[[1083,26]]}},"keywords":{}}],["contract_nam",{"_index":1258,"title":{},"content":{"52":{"position":[[1129,14],[1314,19]]}},"keywords":{}}],["contract_package_hash",{"_index":1683,"title":{},"content":{"103":{"position":[[73,21]]},"295":{"position":[[73,21]]},"507":{"position":[[73,21]]}},"keywords":{}}],["contract_wasm",{"_index":1139,"title":{},"content":{"43":{"position":[[1040,17]]}},"keywords":{}}],["contractdefinit",{"_index":919,"title":{},"content":{"39":{"position":[[663,18]]}},"keywords":{}}],["contractenv",{"_index":2845,"title":{},"content":{"267":{"position":[[1945,12]]},"407":{"position":[[1945,12]]},"600":{"position":[[1178,11]]},"604":{"position":[[525,11]]},"644":{"position":[[1945,12]]},"708":{"position":[[1178,11]]},"712":{"position":[[525,11]]}},"keywords":{}}],["contractenv::cal",{"_index":2371,"title":{},"content":{"197":{"position":[[1215,21]]},"433":{"position":[[1214,21]]},"680":{"position":[[1214,21]]}},"keywords":{}}],["contractenv::emit_ev",{"_index":2349,"title":{},"content":{"196":{"position":[[1581,25]]},"432":{"position":[[1459,25]]},"679":{"position":[[1459,25]]}},"keywords":{}}],["contractenv::revert",{"_index":2340,"title":{},"content":{"196":{"position":[[1140,21]]},"432":{"position":[[1083,21]]},"679":{"position":[[1083,21]]}},"keywords":{}}],["contractinfo",{"_index":983,"title":{},"content":{"39":{"position":[[2442,12]]}},"keywords":{}}],["contractref",{"_index":1929,"title":{},"content":{"141":{"position":[[137,11]]},"326":{"position":[[137,11]]},"535":{"position":[[137,11]]},"617":{"position":[[49,12]]},"725":{"position":[[49,12]]}},"keywords":{}}],["contractti",{"_index":923,"title":{},"content":{"39":{"position":[[738,11]]}},"keywords":{}}],["contrari",{"_index":1696,"title":{},"content":{"107":{"position":[[238,8]]},"274":{"position":[[238,8]]},"491":{"position":[[238,8]]}},"keywords":{}}],["contrast",{"_index":3827,"title":{},"content":{"612":{"position":[[1807,9]]},"720":{"position":[[1807,9]]}},"keywords":{}}],["control",{"_index":1566,"title":{"181":{"position":[[7,7]]},"372":{"position":[[7,7]]},"588":{"position":[[7,7]]}},"content":{"88":{"position":[[353,7]]},"115":{"position":[[1673,7]]},"182":{"position":[[72,7]]},"183":{"position":[[7,7]]},"189":{"position":[[75,7],[278,7]]},"247":{"position":[[1892,7]]},"250":{"position":[[353,7]]},"258":{"position":[[1619,7]]},"366":{"position":[[75,7],[278,7]]},"373":{"position":[[72,7]]},"374":{"position":[[7,7]]},"446":{"position":[[1892,7]]},"481":{"position":[[1619,7]]},"488":{"position":[[353,7]]},"582":{"position":[[75,7],[278,7]]},"589":{"position":[[72,7]]},"590":{"position":[[7,7]]},"673":{"position":[[1892,7]]}},"keywords":{}}],["conveni",{"_index":2397,"title":{},"content":{"198":{"position":[[1210,12]]},"434":{"position":[[1200,12]]},"681":{"position":[[1210,12]]}},"keywords":{}}],["convert",{"_index":303,"title":{},"content":{"9":{"position":[[1159,7],[1333,7],[1492,7]]},"39":{"position":[[1707,10]]},"40":{"position":[[129,9]]},"44":{"position":[[159,7]]},"108":{"position":[[81,10]]},"138":{"position":[[1230,7]]},"198":{"position":[[3936,8]]},"211":{"position":[[578,7]]},"212":{"position":[[3570,7]]},"275":{"position":[[85,10]]},"318":{"position":[[1222,7]]},"390":{"position":[[552,7]]},"391":{"position":[[3588,7]]},"434":{"position":[[3918,8]]},"492":{"position":[[85,10]]},"544":{"position":[[1222,7]]},"660":{"position":[[552,7]]},"661":{"position":[[3588,7]]},"681":{"position":[[3936,8]]}},"keywords":{}}],["copi",{"_index":2679,"title":{},"content":{"212":{"position":[[4393,4]]},"264":{"position":[[433,4]]},"382":{"position":[[246,4]]},"391":{"position":[[4411,4]]},"404":{"position":[[433,4]]},"624":{"position":[[246,4]]},"641":{"position":[[433,4]]},"661":{"position":[[4411,4]]}},"keywords":{}}],["copil",{"_index":432,"title":{},"content":{"16":{"position":[[77,7]]}},"keywords":{}}],["copilot",{"_index":399,"title":{},"content":{"15":{"position":[[47,7]]}},"keywords":{}}],["core",{"_index":161,"title":{"205":{"position":[[0,5]]},"425":{"position":[[0,5]]},"667":{"position":[[0,5]]}},"content":{"3":{"position":[[646,4]]},"22":{"position":[[532,4]]},"267":{"position":[[3361,5]]},"407":{"position":[[3361,5]]},"644":{"position":[[3361,5]]}},"keywords":{}}],["core/src/list.r",{"_index":2096,"title":{},"content":{"163":{"position":[[1563,16]]},"352":{"position":[[1585,16]]},"568":{"position":[[1585,16]]}},"keywords":{}}],["core::str::fromstr",{"_index":3620,"title":{},"content":{"598":{"position":[[17,19]]},"706":{"position":[[17,19]]}},"keywords":{}}],["corner",{"_index":3191,"title":{},"content":{"396":{"position":[[298,7]]},"633":{"position":[[298,7]]}},"keywords":{}}],["correct",{"_index":320,"title":{},"content":{"10":{"position":[[138,12]]}},"keywords":{}}],["correctli",{"_index":1336,"title":{},"content":{"65":{"position":[[634,10]]},"154":{"position":[[187,10]]},"174":{"position":[[299,9]]},"240":{"position":[[634,10]]},"339":{"position":[[187,10]]},"360":{"position":[[299,9]]},"395":{"position":[[4464,10]]},"396":{"position":[[330,10]]},"465":{"position":[[634,10]]},"559":{"position":[[187,10]]},"576":{"position":[[299,9]]},"632":{"position":[[4464,10]]},"633":{"position":[[330,10]]}},"keywords":{}}],["correspond",{"_index":1894,"title":{},"content":{"132":{"position":[[251,11]]},"182":{"position":[[187,13]]},"312":{"position":[[251,11]]},"373":{"position":[[187,13]]},"529":{"position":[[251,11]]},"589":{"position":[[187,13]]}},"keywords":{}}],["cosmo",{"_index":603,"title":{},"content":{"20":{"position":[[788,7]]},"50":{"position":[[64,6],[162,6],[240,6]]},"51":{"position":[[1717,6]]},"53":{"position":[[1091,6]]},"54":{"position":[[49,6]]}},"keywords":{}}],["cosmwasm",{"_index":1177,"title":{"49":{"position":[[7,8]]},"50":{"position":[[0,9]]}},"content":{"50":{"position":[[0,8],[273,8],[532,9]]},"51":{"position":[[55,8],[1617,9],[1801,8]]},"52":{"position":[[1772,8]]},"54":{"position":[[330,8]]}},"keywords":{}}],["cosmwasm.wasm.v1.msgexecutecontract",{"_index":1306,"title":{},"content":{"53":{"position":[[422,36]]}},"keywords":{}}],["cost",{"_index":371,"title":{},"content":{"11":{"position":[[180,4]]},"43":{"position":[[1791,5]]},"126":{"position":[[3104,4]]},"127":{"position":[[841,4]]},"128":{"position":[[57,4]]},"277":{"position":[[3272,4]]},"278":{"position":[[841,4]]},"279":{"position":[[57,4]]},"514":{"position":[[3104,4]]},"515":{"position":[[841,4]]},"516":{"position":[[57,4]]}},"keywords":{}}],["couldn't",{"_index":1634,"title":{},"content":{"97":{"position":[[53,8]]},"289":{"position":[[53,8]]},"501":{"position":[[53,8]]}},"keywords":{}}],["count",{"_index":3248,"title":{},"content":{"416":{"position":[[3451,5],[3917,5]]},"419":{"position":[[5030,5],[5496,5]]},"653":{"position":[[3451,5],[3917,5]]},"656":{"position":[[5030,5],[5496,5]]}},"keywords":{}}],["count(&mut",{"_index":1391,"title":{},"content":{"73":{"position":[[347,14]]},"237":{"position":[[347,14]]},"473":{"position":[[347,14]]}},"keywords":{}}],["count.__events_ces_vers",{"_index":1581,"title":{},"content":{"91":{"position":[[419,26]]},"283":{"position":[[419,26]]},"495":{"position":[[419,26]]}},"keywords":{}}],["count_ref_recursive(&mut",{"_index":1386,"title":{},"content":{"73":{"position":[[148,28]]},"237":{"position":[[148,28]]},"473":{"position":[[148,28]]}},"keywords":{}}],["counter",{"_index":1186,"title":{"99":{"position":[[16,8]]},"223":{"position":[[9,8]]},"291":{"position":[[16,8]]},"456":{"position":[[9,8]]},"503":{"position":[[16,8]]},"696":{"position":[[9,8]]}},"content":{"51":{"position":[[24,7],[304,8],[500,7],[564,7],[1386,7],[1495,7]]},"52":{"position":[[3259,7],[4839,8],[6696,7]]},"54":{"position":[[120,7]]},"73":{"position":[[49,8]]},"80":{"position":[[258,8]]},"99":{"position":[[200,8]]},"118":{"position":[[108,7]]},"120":{"position":[[364,7]]},"154":{"position":[[255,8]]},"223":{"position":[[188,7],[1278,7],[1313,8]]},"231":{"position":[[258,8]]},"237":{"position":[[49,8]]},"291":{"position":[[200,8]]},"299":{"position":[[108,7]]},"301":{"position":[[364,7]]},"339":{"position":[[255,8]]},"456":{"position":[[188,7],[1278,7],[1313,8]]},"462":{"position":[[258,8]]},"473":{"position":[[49,8]]},"503":{"position":[[200,8]]},"520":{"position":[[108,7]]},"522":{"position":[[364,7]]},"559":{"position":[[255,8]]},"696":{"position":[[188,7],[1278,7],[1313,8]]}},"keywords":{}}],["counter"",{"_index":1287,"title":{},"content":{"52":{"position":[[3360,13]]}},"keywords":{}}],["counter.get_valu",{"_index":1213,"title":{},"content":{"51":{"position":[[1438,21],[1568,21]]}},"keywords":{}}],["counter.incr",{"_index":1214,"title":{},"content":{"51":{"position":[[1532,20]]}},"keywords":{}}],["counter.r",{"_index":1192,"title":{},"content":{"51":{"position":[[350,10]]}},"keywords":{}}],["counter.wasm",{"_index":1278,"title":{},"content":{"52":{"position":[[2324,12]]}},"keywords":{}}],["counter_address",{"_index":1206,"title":{},"content":{"51":{"position":[[961,16]]}},"keywords":{}}],["counterdeployer::init(10",{"_index":1211,"title":{},"content":{"51":{"position":[[1396,26],[1505,26]]}},"keywords":{}}],["counterref::at(counter_address).incr",{"_index":1207,"title":{},"content":{"51":{"position":[[989,44]]}},"keywords":{}}],["coupl",{"_index":2281,"title":{},"content":{"187":{"position":[[24,6]]},"196":{"position":[[559,6]]},"364":{"position":[[24,6]]},"432":{"position":[[496,6]]},"580":{"position":[[24,6]]},"679":{"position":[[496,6]]}},"keywords":{}}],["cours",{"_index":856,"title":{},"content":{"33":{"position":[[38,7]]},"119":{"position":[[718,7],[1090,7]]},"300":{"position":[[718,7],[1090,7]]},"395":{"position":[[4046,7]]},"521":{"position":[[718,7],[1090,7]]},"632":{"position":[[4046,7]]}},"keywords":{}}],["crate",{"_index":819,"title":{},"content":{"32":{"position":[[222,5]]},"65":{"position":[[296,5]]},"88":{"position":[[64,5]]},"240":{"position":[[296,5]]},"250":{"position":[[64,5]]},"321":{"position":[[666,5]]},"441":{"position":[[4635,8]]},"465":{"position":[[296,5]]},"488":{"position":[[64,5]]},"539":{"position":[[666,5]]},"688":{"position":[[4635,8]]}},"keywords":{}}],["crate.add",{"_index":2805,"title":{},"content":{"265":{"position":[[266,9]]},"405":{"position":[[266,9]]},"642":{"position":[[266,9]]}},"keywords":{}}],["crate::erc20::errors::error",{"_index":2927,"title":{},"content":{"269":{"position":[[116,31]]},"384":{"position":[[116,28]]},"409":{"position":[[116,31]]},"626":{"position":[[116,28]]},"646":{"position":[[116,31]]}},"keywords":{}}],["crate::erc20::ev",{"_index":2928,"title":{},"content":{"269":{"position":[[152,24]]},"384":{"position":[[149,24]]},"409":{"position":[[152,24]]},"626":{"position":[[149,24]]},"646":{"position":[[152,24]]}},"keywords":{}}],["crate::features::testing::{testingcontracthostref",{"_index":2116,"title":{},"content":{"168":{"position":[[360,50]]},"348":{"position":[[360,50]]},"564":{"position":[[360,50]]}},"keywords":{}}],["crate::flipper::flipperhostref",{"_index":2000,"title":{},"content":{"148":{"position":[[40,31]]},"178":{"position":[[1046,31]]},"336":{"position":[[40,31]]},"369":{"position":[[1046,31]]},"553":{"position":[[40,31]]},"585":{"position":[[1046,31]]}},"keywords":{}}],["crate::modules::token",{"_index":1482,"title":{},"content":{"80":{"position":[[190,22]]},"231":{"position":[[190,22]]},"462":{"position":[[190,22]]}},"keywords":{}}],["crate::owned_token::ownedtoken",{"_index":1450,"title":{},"content":{"79":{"position":[[633,31]]},"230":{"position":[[650,31]]},"461":{"position":[[650,31]]}},"keywords":{}}],["crate::token::{error",{"_index":3438,"title":{},"content":{"440":{"position":[[4869,21]]},"687":{"position":[[4869,21]]}},"keywords":{}}],["crate::token::{ticketid",{"_index":3476,"title":{},"content":{"441":{"position":[[547,24]]},"688":{"position":[[547,24]]}},"keywords":{}}],["crate::{erc20::erc20",{"_index":1711,"title":{},"content":{"115":{"position":[[67,21],[1859,21]]},"246":{"position":[[111,21]]},"258":{"position":[[67,21],[1805,21]]},"445":{"position":[[111,21]]},"481":{"position":[[67,21],[1805,21]]},"672":{"position":[[111,21]]}},"keywords":{}}],["crates.io",{"_index":1769,"title":{},"content":{"117":{"position":[[1221,9]]},"131":{"position":[[595,10]]},"298":{"position":[[1221,9]]},"311":{"position":[[647,10]]},"519":{"position":[[1221,9]]},"528":{"position":[[647,10]]}},"keywords":{}}],["creat",{"_index":870,"title":{"175":{"position":[[0,8]]},"361":{"position":[[0,8]]},"577":{"position":[[0,8]]}},"content":{"38":{"position":[[434,8]]},"42":{"position":[[30,6],[296,6]]},"91":{"position":[[266,7]]},"92":{"position":[[102,7],[197,7]]},"94":{"position":[[546,7]]},"102":{"position":[[114,7]]},"117":{"position":[[22,6],[178,7],[330,7],[475,7],[719,7],[777,7],[1250,8],[1378,8],[1404,7]]},"118":{"position":[[23,6],[122,7]]},"119":{"position":[[648,7]]},"121":{"position":[[302,7]]},"122":{"position":[[90,7]]},"126":{"position":[[372,7]]},"129":{"position":[[199,6]]},"141":{"position":[[1336,7]]},"147":{"position":[[440,6],[616,6]]},"154":{"position":[[226,6]]},"162":{"position":[[2457,8]]},"175":{"position":[[3,6],[110,6],[191,6],[495,6]]},"195":{"position":[[270,6]]},"203":{"position":[[585,6]]},"207":{"position":[[63,6]]},"212":{"position":[[4220,6]]},"264":{"position":[[127,6]]},"277":{"position":[[372,7]]},"280":{"position":[[199,6]]},"283":{"position":[[266,7]]},"284":{"position":[[102,7],[197,7]]},"286":{"position":[[546,7]]},"294":{"position":[[114,7]]},"298":{"position":[[22,6],[178,7],[330,7],[475,7],[719,7],[777,7],[1250,8],[1378,8],[1404,7]]},"299":{"position":[[23,6],[122,7]]},"300":{"position":[[648,7]]},"302":{"position":[[302,7]]},"303":{"position":[[90,7]]},"321":{"position":[[795,8],[2198,7]]},"326":{"position":[[1336,7]]},"335":{"position":[[444,6],[620,6]]},"339":{"position":[[226,6]]},"351":{"position":[[2479,8]]},"361":{"position":[[3,6],[110,6],[191,6],[495,6]]},"391":{"position":[[4238,6]]},"393":{"position":[[391,8]]},"394":{"position":[[487,6]]},"395":{"position":[[174,6]]},"404":{"position":[[127,6]]},"414":{"position":[[15,8]]},"423":{"position":[[585,6]]},"427":{"position":[[63,6]]},"431":{"position":[[270,6]]},"439":{"position":[[0,8],[89,6]]},"441":{"position":[[417,6],[1997,6],[4480,6]]},"442":{"position":[[21,7]]},"495":{"position":[[266,7]]},"496":{"position":[[102,7],[197,7]]},"498":{"position":[[546,7]]},"506":{"position":[[114,7]]},"514":{"position":[[372,7]]},"517":{"position":[[199,6]]},"519":{"position":[[22,6],[178,7],[330,7],[475,7],[719,7],[777,7],[1250,8],[1378,8],[1404,7]]},"520":{"position":[[23,6],[122,7]]},"521":{"position":[[648,7]]},"523":{"position":[[302,7]]},"524":{"position":[[90,7]]},"535":{"position":[[1336,7]]},"539":{"position":[[795,8],[2198,7]]},"552":{"position":[[444,6],[620,6]]},"559":{"position":[[226,6]]},"567":{"position":[[2479,8]]},"577":{"position":[[3,6],[110,6],[191,6],[495,6]]},"596":{"position":[[580,6]]},"602":{"position":[[1737,6],[2018,7]]},"605":{"position":[[546,6]]},"630":{"position":[[391,8]]},"631":{"position":[[487,6]]},"632":{"position":[[174,6]]},"641":{"position":[[127,6]]},"651":{"position":[[15,8]]},"661":{"position":[[4238,6]]},"665":{"position":[[585,6]]},"669":{"position":[[63,6]]},"678":{"position":[[270,6]]},"686":{"position":[[0,8],[89,6]]},"688":{"position":[[417,6],[1997,6],[4480,6]]},"689":{"position":[[21,7]]},"704":{"position":[[580,6]]},"710":{"position":[[1737,6],[2018,7]]},"713":{"position":[[546,6]]}},"keywords":{}}],["create(&mut",{"_index":3734,"title":{},"content":{"602":{"position":[[1293,15]]},"710":{"position":[[1293,15]]}},"keywords":{}}],["creation",{"_index":3922,"title":{},"content":{"617":{"position":[[1000,9]]},"725":{"position":[[1000,9]]}},"keywords":{}}],["creativ",{"_index":636,"title":{},"content":{"21":{"position":[[315,10]]}},"keywords":{}}],["creator",{"_index":1490,"title":{},"content":{"80":{"position":[[573,8],[670,10],[757,8],[856,10]]},"168":{"position":[[766,7]]},"231":{"position":[[573,8],[670,10],[757,8],[856,10]]},"348":{"position":[[766,7]]},"395":{"position":[[337,8]]},"462":{"position":[[573,8],[670,10],[757,8],[856,10]]},"564":{"position":[[766,7]]},"632":{"position":[[337,8]]}},"keywords":{}}],["creator'",{"_index":3147,"title":{},"content":{"395":{"position":[[1673,9],[6663,9]]},"632":{"position":[[1673,9],[6663,9]]}},"keywords":{}}],["creator2",{"_index":2126,"title":{},"content":{"168":{"position":[[1026,8],[1089,10]]},"348":{"position":[[1026,8],[1089,10]]},"564":{"position":[[1026,8],[1089,10]]}},"keywords":{}}],["cross",{"_index":614,"title":{"140":{"position":[[0,5]]},"325":{"position":[[0,5]]},"534":{"position":[[0,5]]}},"content":{"20":{"position":[[971,5]]},"54":{"position":[[262,5]]},"128":{"position":[[555,5]]},"143":{"position":[[30,5]]},"279":{"position":[[555,5]]},"328":{"position":[[30,5]]},"442":{"position":[[202,5]]},"516":{"position":[[555,5]]},"537":{"position":[[30,5]]},"689":{"position":[[202,5]]}},"keywords":{}}],["cross_contract",{"_index":1970,"title":{},"content":{"143":{"position":[[490,14]]},"328":{"position":[[394,14]]},"537":{"position":[[394,14]]}},"keywords":{}}],["cross_increment(&mut",{"_index":1205,"title":{},"content":{"51":{"position":[[930,24]]}},"keywords":{}}],["crosscontracthostref::deploy",{"_index":3059,"title":{},"content":{"328":{"position":[[411,29]]},"537":{"position":[[411,29]]}},"keywords":{}}],["crosscontracthostref::deploy(&test_env",{"_index":1971,"title":{},"content":{"143":{"position":[[507,43]]}},"keywords":{}}],["crosscontractinitarg",{"_index":1962,"title":{},"content":{"143":{"position":[[160,22],[406,21]]},"328":{"position":[[160,22],[456,21]]},"537":{"position":[[160,22],[456,21]]}},"keywords":{}}],["crucial",{"_index":2317,"title":{},"content":{"195":{"position":[[193,7]]},"431":{"position":[[193,7]]},"678":{"position":[[193,7]]}},"keywords":{}}],["cspr",{"_index":373,"title":{"102":{"position":[[8,4]]},"294":{"position":[[8,4]]},"506":{"position":[[8,4]]}},"content":{"11":{"position":[[222,5]]},"94":{"position":[[526,5]]},"102":{"position":[[222,4],[277,4],[400,4]]},"103":{"position":[[503,4]]},"286":{"position":[[526,5]]},"294":{"position":[[222,4],[277,4],[400,4]]},"295":{"position":[[503,4]]},"346":{"position":[[84,4]]},"365":{"position":[[78,4]]},"394":{"position":[[60,5],[140,4]]},"397":{"position":[[111,5]]},"440":{"position":[[2940,5]]},"441":{"position":[[3435,5],[4200,4]]},"477":{"position":[[1410,6],[1955,5],[2129,5],[3910,5],[3971,5]]},"478":{"position":[[190,6]]},"498":{"position":[[526,5]]},"506":{"position":[[222,4],[277,4],[400,4]]},"507":{"position":[[503,4]]},"581":{"position":[[78,4]]},"608":{"position":[[734,6]]},"614":{"position":[[505,6]]},"631":{"position":[[60,5],[140,4]]},"634":{"position":[[111,5]]},"687":{"position":[[2940,5]]},"688":{"position":[[3435,5],[4200,4]]},"699":{"position":[[1410,6],[1955,5],[2129,5],[3910,5],[3971,5]]},"700":{"position":[[190,6]]},"716":{"position":[[734,6]]},"722":{"position":[[505,6]]}},"keywords":{}}],["cspr.cloud",{"_index":2954,"title":{},"content":{"277":{"position":[[1097,11],[1173,10]]}},"keywords":{}}],["cspr.live",{"_index":3188,"title":{"396":{"position":[[0,10]]},"633":{"position":[[0,10]]}},"content":{"396":{"position":[[501,9]]},"398":{"position":[[157,9],[226,9]]},"633":{"position":[[501,9]]},"635":{"position":[[157,9],[226,9]]}},"keywords":{}}],["cspr_cloud_auth_token",{"_index":2956,"title":{},"content":{"277":{"position":[[1144,22]]}},"keywords":{}}],["ctx",{"_index":974,"title":{},"content":{"39":{"position":[[2307,4],[2574,5],[2695,5],[2767,5],[2835,6],[2973,5],[3053,6]]}},"keywords":{}}],["cumbersom",{"_index":1615,"title":{},"content":{"94":{"position":[[67,10]]},"286":{"position":[[67,10]]},"498":{"position":[[67,10]]}},"keywords":{}}],["current",{"_index":663,"title":{},"content":{"22":{"position":[[1025,7]]},"52":{"position":[[6688,7]]},"78":{"position":[[163,7],[345,7]]},"95":{"position":[[412,7]]},"103":{"position":[[695,9]]},"107":{"position":[[361,7]]},"117":{"position":[[1429,8]]},"128":{"position":[[365,7]]},"147":{"position":[[1035,7],[1158,7]]},"168":{"position":[[1834,7]]},"178":{"position":[[622,7],[745,7]]},"184":{"position":[[932,7]]},"194":{"position":[[143,7],[186,7]]},"197":{"position":[[944,7],[1189,7]]},"229":{"position":[[163,7],[366,7]]},"245":{"position":[[120,7]]},"274":{"position":[[361,7]]},"279":{"position":[[365,7]]},"287":{"position":[[412,7]]},"295":{"position":[[695,9]]},"298":{"position":[[1429,8]]},"324":{"position":[[637,9],[1009,9]]},"335":{"position":[[1043,7],[1166,7]]},"348":{"position":[[1834,7]]},"369":{"position":[[622,7],[745,7]]},"375":{"position":[[851,7]]},"416":{"position":[[598,7]]},"419":{"position":[[969,7]]},"430":{"position":[[143,7],[186,7]]},"433":{"position":[[943,7],[1188,7]]},"444":{"position":[[120,7]]},"460":{"position":[[163,7],[366,7]]},"491":{"position":[[361,7]]},"499":{"position":[[412,7]]},"507":{"position":[[695,9]]},"516":{"position":[[365,7]]},"519":{"position":[[1429,8]]},"542":{"position":[[637,9],[1009,9]]},"552":{"position":[[1043,7],[1166,7]]},"564":{"position":[[1834,7]]},"585":{"position":[[622,7],[745,7]]},"591":{"position":[[851,7]]},"653":{"position":[[598,7]]},"656":{"position":[[969,7]]},"671":{"position":[[120,7]]},"677":{"position":[[143,7],[186,7]]},"680":{"position":[[943,7],[1188,7]]}},"keywords":{}}],["current'",{"_index":1063,"title":{},"content":{"42":{"position":[[1359,9]]}},"keywords":{}}],["current_bal",{"_index":2460,"title":{},"content":{"204":{"position":[[1528,15]]},"424":{"position":[[1478,15]]},"666":{"position":[[1478,15]]}},"keywords":{}}],["current_balance).unwrap_or_revert(&self.env",{"_index":2465,"title":{},"content":{"204":{"position":[[1677,51]]},"424":{"position":[[1627,51]]},"666":{"position":[[1627,51]]}},"keywords":{}}],["current_block_tim",{"_index":1357,"title":{},"content":{"71":{"position":[[192,19],[469,18]]},"235":{"position":[[192,19],[469,18]]},"471":{"position":[[192,19],[469,18]]},"476":{"position":[[785,19],[1064,18]]},"698":{"position":[[785,19],[1064,18]]}},"keywords":{}}],["current_msg",{"_index":495,"title":{},"content":{"17":{"position":[[1182,11],[1247,11]]}},"keywords":{}}],["current_own",{"_index":2356,"title":{},"content":{"197":{"position":[[323,13]]},"433":{"position":[[323,13]]},"680":{"position":[[323,13]]}},"keywords":{}}],["current_value(&self",{"_index":1485,"title":{},"content":{"80":{"position":[[368,24]]},"231":{"position":[[368,24]]},"462":{"position":[[368,24]]}},"keywords":{}}],["curv",{"_index":874,"title":{},"content":{"38":{"position":[[595,5]]},"594":{"position":[[609,6]]},"702":{"position":[[609,6]]}},"keywords":{}}],["custom",{"_index":1439,"title":{"165":{"position":[[0,6]]},"354":{"position":[[0,6]]},"570":{"position":[[0,6]]},"602":{"position":[[0,6]]},"710":{"position":[[0,6]]}},"content":{"79":{"position":[[226,6]]},"138":{"position":[[1242,6]]},"165":{"position":[[108,6]]},"209":{"position":[[97,6],[475,6],[512,6]]},"230":{"position":[[226,6]]},"318":{"position":[[1234,6]]},"324":{"position":[[529,6]]},"354":{"position":[[108,6],[498,6],[647,6]]},"365":{"position":[[91,6]]},"383":{"position":[[79,6],[195,6]]},"388":{"position":[[97,6],[465,6],[502,6]]},"461":{"position":[[226,6]]},"542":{"position":[[529,6]]},"544":{"position":[[1234,6]]},"570":{"position":[[108,6],[498,6],[647,6]]},"581":{"position":[[91,6]]},"599":{"position":[[393,6]]},"602":{"position":[[538,6],[1871,6]]},"610":{"position":[[650,6]]},"611":{"position":[[625,6]]},"625":{"position":[[79,6],[195,6]]},"658":{"position":[[97,6],[465,6],[502,6]]},"707":{"position":[[393,6]]},"710":{"position":[[538,6],[1871,6]]},"718":{"position":[[650,6]]},"719":{"position":[[625,6]]}},"keywords":{}}],["custom_item",{"_index":2578,"title":{},"content":{"210":{"position":[[275,11]]},"389":{"position":[[275,11]]},"659":{"position":[[275,11]]}},"keywords":{}}],["custom_item.r",{"_index":2550,"title":{},"content":{"209":{"position":[[376,14]]},"388":{"position":[[376,14]]},"658":{"position":[[376,14]]}},"keywords":{}}],["customerror",{"_index":3799,"title":{},"content":{"611":{"position":[[94,11]]},"719":{"position":[[94,11]]}},"keywords":{}}],["customitem",{"_index":2552,"title":{},"content":{"209":{"position":[[828,10],[944,10]]},"211":{"position":[[146,11]]},"388":{"position":[[760,10],[876,10]]},"390":{"position":[[146,11]]},"658":{"position":[[760,10],[876,10]]},"660":{"position":[[146,11]]}},"keywords":{}}],["cut",{"_index":38,"title":{},"content":{"1":{"position":[[413,7]]},"21":{"position":[[115,4]]}},"keywords":{}}],["d",{"_index":2573,"title":{},"content":{"210":{"position":[[128,1]]},"389":{"position":[[128,1]]},"477":{"position":[[137,1]]},"612":{"position":[[905,1],[977,1]]},"659":{"position":[[128,1]]},"699":{"position":[[137,1]]},"720":{"position":[[905,1],[977,1]]}},"keywords":{}}],["d26fcbd210..."",{"_index":1849,"title":{},"content":{"127":{"position":[[292,19]]},"278":{"position":[[292,19]]},"515":{"position":[[292,19]]}},"keywords":{}}],["d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"",{"_index":1828,"title":{},"content":{"126":{"position":[[2678,71]]},"142":{"position":[[339,71]]},"277":{"position":[[2846,71]]},"327":{"position":[[339,71]]},"514":{"position":[[2678,71]]},"536":{"position":[[339,71]]}},"keywords":{}}],["d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb"",{"_index":3647,"title":{},"content":{"598":{"position":[[854,71]]},"706":{"position":[[854,71]]}},"keywords":{}}],["danger",{"_index":1343,"title":{},"content":{"66":{"position":[[250,6]]},"241":{"position":[[250,6]]},"393":{"position":[[305,6]]},"466":{"position":[[250,6]]},"630":{"position":[[305,6]]}},"keywords":{}}],["dao",{"_index":593,"title":{},"content":{"20":{"position":[[520,3]]}},"keywords":{}}],["dapp",{"_index":646,"title":{},"content":{"22":{"position":[[258,4]]},"38":{"position":[[246,4]]},"50":{"position":[[51,5]]}},"keywords":{}}],["data",{"_index":796,"title":{"598":{"position":[[0,4]]},"603":{"position":[[0,4]]},"706":{"position":[[0,4]]},"711":{"position":[[0,4]]}},"content":{"31":{"position":[[2834,4],[3186,4],[3451,4]]},"52":{"position":[[6655,5]]},"76":{"position":[[288,4]]},"83":{"position":[[56,4],[199,4],[268,4],[516,4]]},"91":{"position":[[730,4]]},"146":{"position":[[539,4],[713,4]]},"147":{"position":[[1361,4]]},"162":{"position":[[88,4],[515,5],[1405,5],[1672,5],[1814,4],[1873,4],[1981,4],[2405,5]]},"163":{"position":[[40,4],[1154,4]]},"164":{"position":[[456,4]]},"202":{"position":[[135,5]]},"209":{"position":[[893,5],[1524,4]]},"211":{"position":[[268,5],[274,5]]},"212":{"position":[[1530,4],[2621,4],[2940,4],[3527,4],[3660,4]]},"227":{"position":[[288,4]]},"252":{"position":[[56,4],[199,4],[268,4],[516,4]]},"268":{"position":[[1921,4]]},"283":{"position":[[730,4]]},"321":{"position":[[1465,4],[1519,4],[1526,4],[1730,4]]},"323":{"position":[[2204,4]]},"334":{"position":[[543,4],[717,4]]},"335":{"position":[[1369,4]]},"351":{"position":[[88,4],[552,5],[1427,5],[1694,5],[1836,4],[1895,4],[2003,4],[2427,5]]},"352":{"position":[[40,4],[1176,4]]},"353":{"position":[[491,4]]},"388":{"position":[[825,5],[1456,4]]},"390":{"position":[[268,5],[274,5]]},"391":{"position":[[1530,4],[2621,4],[2952,4],[3545,4],[3678,4]]},"408":{"position":[[1921,4]]},"422":{"position":[[135,5]]},"458":{"position":[[288,4]]},"483":{"position":[[56,4],[199,4],[268,4],[516,4]]},"495":{"position":[[730,4]]},"539":{"position":[[1465,4],[1519,4],[1526,4],[1730,4]]},"541":{"position":[[2204,4]]},"551":{"position":[[543,4],[717,4]]},"552":{"position":[[1369,4]]},"567":{"position":[[88,4],[552,5],[1427,5],[1694,5],[1836,4],[1895,4],[2003,4],[2427,5]]},"568":{"position":[[40,4],[1176,4]]},"569":{"position":[[491,4]]},"601":{"position":[[1911,4],[2257,5]]},"603":{"position":[[13,4],[77,4],[124,4],[184,4],[306,4]]},"614":{"position":[[171,5],[255,4]]},"616":{"position":[[299,4],[1245,5]]},"645":{"position":[[1921,4]]},"658":{"position":[[825,5],[1456,4]]},"660":{"position":[[268,5],[274,5]]},"661":{"position":[[1530,4],[2621,4],[2952,4],[3545,4],[3678,4]]},"664":{"position":[[135,5]]},"709":{"position":[[1911,4],[2257,5]]},"711":{"position":[[13,4],[77,4],[124,4],[184,4],[306,4]]},"722":{"position":[[171,5],[255,4]]},"724":{"position":[[299,4],[1245,5]]}},"keywords":{}}],["data.__events_length",{"_index":1580,"title":{},"content":{"91":{"position":[[386,20]]},"283":{"position":[[386,20]]},"495":{"position":[[386,20]]}},"keywords":{}}],["data.extend(addr.to_bytes().unwrap_or_revert(&env",{"_index":3864,"title":{},"content":{"616":{"position":[[431,56]]},"724":{"position":[[431,56]]}},"keywords":{}}],["data.extend(num.to_bytes().unwrap_or_revert(&env",{"_index":3863,"title":{},"content":{"616":{"position":[[375,55]]},"724":{"position":[[375,55]]}},"keywords":{}}],["data.extend(text.to_bytes().unwrap_or_revert(&env",{"_index":3862,"title":{},"content":{"616":{"position":[[318,56]]},"724":{"position":[[318,56]]}},"keywords":{}}],["data.hash",{"_index":2606,"title":{},"content":{"211":{"position":[[662,9]]},"390":{"position":[[636,9]]},"660":{"position":[[636,9]]}},"keywords":{}}],["davinci",{"_index":427,"title":{"16":{"position":[[0,7]]}},"content":{"16":{"position":[[152,7]]}},"keywords":{}}],["day",{"_index":868,"title":{},"content":{"38":{"position":[[406,3]]}},"keywords":{}}],["dbg!(runtime.block_on(metadata",{"_index":2660,"title":{},"content":{"212":{"position":[[3289,35]]},"391":{"position":[[3307,35]]},"661":{"position":[[3307,35]]}},"keywords":{}}],["dbg!(runtime.block_on(named_value("alice"",{"_index":2662,"title":{},"content":{"212":{"position":[[3358,55]]},"391":{"position":[[3376,55]]},"661":{"position":[[3376,55]]}},"keywords":{}}],["dbg!(runtime.block_on(named_value("bob"",{"_index":2663,"title":{},"content":{"212":{"position":[[3414,53]]},"391":{"position":[[3432,53]]},"661":{"position":[[3432,53]]}},"keywords":{}}],["dbg!(runtime.block_on(valu",{"_index":2661,"title":{},"content":{"212":{"position":[[3325,32]]},"391":{"position":[[3343,32]]},"661":{"position":[[3343,32]]}},"keywords":{}}],["deadlin",{"_index":41,"title":{},"content":{"1":{"position":[[481,10]]}},"keywords":{}}],["debug",{"_index":966,"title":{},"content":{"39":{"position":[[1976,7]]},"68":{"position":[[46,5]]},"184":{"position":[[303,7],[427,7],[551,7]]},"196":{"position":[[422,6],[1517,6]]},"204":{"position":[[879,7]]},"205":{"position":[[2087,7]]},"209":{"position":[[543,6],[676,6]]},"219":{"position":[[414,7],[496,7]]},"243":{"position":[[46,5]]},"267":{"position":[[1579,7]]},"269":{"position":[[3382,7],[3526,7]]},"407":{"position":[[1579,7]]},"409":{"position":[[3382,7],[3526,7]]},"468":{"position":[[46,5]]},"644":{"position":[[1579,7]]},"646":{"position":[[3382,7],[3526,7]]}},"keywords":{}}],["debugg",{"_index":1781,"title":{},"content":{"119":{"position":[[615,9]]},"300":{"position":[[615,9]]},"521":{"position":[[615,9]]}},"keywords":{}}],["decim",{"_index":514,"title":{},"content":{"17":{"position":[[2036,9],[2293,9]]},"115":{"position":[[390,9],[523,9],[2233,9],[2386,9]]},"126":{"position":[[1978,8],[2370,9]]},"203":{"position":[[152,9]]},"204":{"position":[[120,9]]},"206":{"position":[[213,9],[454,9],[464,9],[793,10]]},"247":{"position":[[155,9],[288,9]]},"258":{"position":[[380,9],[513,9],[2179,9],[2332,9]]},"268":{"position":[[1266,9],[1276,9]]},"269":{"position":[[320,9],[609,9],[4117,9],[4358,9],[4368,9],[4703,10]]},"277":{"position":[[2146,8],[2538,9]]},"384":{"position":[[333,9],[622,9]]},"395":{"position":[[1927,8],[2030,9]]},"408":{"position":[[1266,9],[1276,9]]},"409":{"position":[[320,9],[609,9],[4117,9],[4358,9],[4368,9],[4703,10]]},"417":{"position":[[292,9]]},"419":{"position":[[1420,9],[1577,9],[2480,8],[6707,9]]},"423":{"position":[[152,9]]},"424":{"position":[[95,9]]},"426":{"position":[[213,9],[454,9],[464,9],[793,10]]},"446":{"position":[[155,9],[288,9]]},"481":{"position":[[380,9],[513,9],[2179,9],[2332,9]]},"514":{"position":[[1978,8],[2370,9]]},"626":{"position":[[333,9],[622,9]]},"632":{"position":[[1927,8],[2030,9]]},"645":{"position":[[1266,9],[1276,9]]},"646":{"position":[[320,9],[609,9],[4117,9],[4358,9],[4368,9],[4703,10]]},"654":{"position":[[292,9]]},"656":{"position":[[1420,9],[1577,9],[2480,8],[6707,9]]},"665":{"position":[[152,9]]},"666":{"position":[[95,9]]},"668":{"position":[[213,9],[454,9],[464,9],[793,10]]},"673":{"position":[[155,9],[288,9]]}},"keywords":{}}],["decimals(&self",{"_index":1725,"title":{},"content":{"115":{"position":[[879,19]]},"204":{"position":[[459,19]]},"247":{"position":[[444,19]]},"258":{"position":[[845,19]]},"419":{"position":[[2508,19]]},"424":{"position":[[434,19]]},"446":{"position":[[444,19]]},"481":{"position":[[845,19]]},"656":{"position":[[2508,19]]},"666":{"position":[[434,19]]},"673":{"position":[[444,19]]}},"keywords":{}}],["decimals.tot",{"_index":2434,"title":{},"content":{"202":{"position":[[180,14]]},"422":{"position":[[180,14]]},"664":{"position":[[180,14]]}},"keywords":{}}],["decimalsnotset",{"_index":2841,"title":{},"content":{"267":{"position":[[1437,14]]},"269":{"position":[[3800,14]]},"383":{"position":[[883,14]]},"384":{"position":[[3764,14]]},"407":{"position":[[1437,14]]},"409":{"position":[[3800,14]]},"625":{"position":[[883,14]]},"626":{"position":[[3764,14]]},"644":{"position":[[1437,14]]},"646":{"position":[[3800,14]]}},"keywords":{}}],["declar",{"_index":3682,"title":{},"content":{"600":{"position":[[781,9]]},"607":{"position":[[38,7],[111,8]]},"613":{"position":[[1287,7]]},"708":{"position":[[781,9]]},"715":{"position":[[38,7],[111,8]]},"721":{"position":[[1287,7]]}},"keywords":{}}],["decr_bi",{"_index":3311,"title":{},"content":{"419":{"position":[[3162,8]]},"656":{"position":[[3162,8]]}},"keywords":{}}],["decreas",{"_index":3309,"title":{},"content":{"419":{"position":[[3042,9]]},"656":{"position":[[3042,9]]}},"keywords":{}}],["decrease_allowance(&mut",{"_index":3310,"title":{},"content":{"419":{"position":[[3105,27]]},"656":{"position":[[3105,27]]}},"keywords":{}}],["decrement",{"_index":2539,"title":{},"content":{"206":{"position":[[2830,12]]},"426":{"position":[[2815,12]]},"606":{"position":[[791,9]]},"668":{"position":[[2830,12]]},"714":{"position":[[791,9]]}},"keywords":{}}],["decrement(&mut",{"_index":3757,"title":{},"content":{"606":{"position":[[167,18]]},"714":{"position":[[167,18]]}},"keywords":{}}],["dedic",{"_index":579,"title":{},"content":{"20":{"position":[[181,9]]}},"keywords":{}}],["deduct",{"_index":2515,"title":{},"content":{"206":{"position":[[1374,9]]},"269":{"position":[[5284,9]]},"409":{"position":[[5284,9]]},"426":{"position":[[1369,9]]},"646":{"position":[[5284,9]]},"668":{"position":[[1374,9]]}},"keywords":{}}],["default",{"_index":901,"title":{},"content":{"39":{"position":[[174,8]]},"40":{"position":[[251,7]]},"88":{"position":[[7,7],[126,7]]},"95":{"position":[[318,7]]},"106":{"position":[[18,7]]},"117":{"position":[[540,7],[812,8]]},"131":{"position":[[527,8]]},"155":{"position":[[88,7]]},"165":{"position":[[3,7]]},"168":{"position":[[1986,8]]},"178":{"position":[[923,7]]},"185":{"position":[[2532,7],[3883,7]]},"197":{"position":[[1593,7]]},"198":{"position":[[2139,7],[3200,7],[3408,7]]},"221":{"position":[[646,7]]},"250":{"position":[[7,7],[126,7]]},"265":{"position":[[130,7]]},"273":{"position":[[18,7]]},"287":{"position":[[318,7]]},"298":{"position":[[540,7],[812,8]]},"311":{"position":[[579,8]]},"321":{"position":[[546,7],[636,7]]},"324":{"position":[[274,7],[397,10]]},"340":{"position":[[88,7]]},"348":{"position":[[1986,8]]},"354":{"position":[[3,7]]},"369":{"position":[[923,7]]},"376":{"position":[[2516,7],[3867,7]]},"395":{"position":[[2708,7],[2796,7],[2975,7],[3082,7],[3120,7]]},"405":{"position":[[130,7]]},"415":{"position":[[181,8]]},"433":{"position":[[1592,7]]},"434":{"position":[[2129,7],[3182,7],[3390,7]]},"454":{"position":[[646,7]]},"477":{"position":[[874,7],[1033,7]]},"488":{"position":[[7,7],[126,7]]},"490":{"position":[[18,7]]},"499":{"position":[[318,7]]},"519":{"position":[[540,7],[812,8]]},"528":{"position":[[579,8]]},"539":{"position":[[546,7],[636,7]]},"542":{"position":[[274,7],[397,10]]},"560":{"position":[[88,7]]},"564":{"position":[[1986,8]]},"570":{"position":[[3,7]]},"585":{"position":[[923,7]]},"592":{"position":[[2516,7],[3867,7]]},"596":{"position":[[1226,8]]},"598":{"position":[[1092,7],[1443,7]]},"602":{"position":[[98,10],[623,7],[657,10],[698,7],[1755,7]]},"605":{"position":[[368,8]]},"632":{"position":[[2708,7],[2796,7],[2975,7],[3082,7],[3120,7]]},"642":{"position":[[130,7]]},"652":{"position":[[181,8]]},"680":{"position":[[1592,7]]},"681":{"position":[[2139,7],[3200,7],[3408,7]]},"694":{"position":[[646,7]]},"699":{"position":[[874,7],[1033,7]]},"704":{"position":[[1226,8]]},"706":{"position":[[1092,7],[1443,7]]},"710":{"position":[[98,10],[623,7],[657,10],[698,7],[1755,7]]},"713":{"position":[[368,8]]}},"keywords":{}}],["default/no",{"_index":3777,"title":{},"content":{"607":{"position":[[286,11]]},"715":{"position":[[286,11]]}},"keywords":{}}],["default/zero",{"_index":3663,"title":{},"content":{"598":{"position":[[1858,12]]},"706":{"position":[[1858,12]]}},"keywords":{}}],["default::default",{"_index":752,"title":{},"content":{"31":{"position":[[1087,19],[1123,19],[1160,19],[1198,19],[1235,19]]},"602":{"position":[[903,18]]},"710":{"position":[[903,18]]}},"keywords":{}}],["default_addr",{"_index":3639,"title":{},"content":{"598":{"position":[[608,13]]},"706":{"position":[[608,13]]}},"keywords":{}}],["default_admin_rol",{"_index":2211,"title":{},"content":{"185":{"position":[[265,19],[811,18]]},"376":{"position":[[249,19],[795,18]]},"592":{"position":[[249,19],[795,18]]}},"keywords":{}}],["default_boo",{"_index":3636,"title":{},"content":{"598":{"position":[[518,12]]},"706":{"position":[[518,12]]}},"keywords":{}}],["default_int",{"_index":3638,"title":{},"content":{"598":{"position":[[579,12]]},"706":{"position":[[579,12]]}},"keywords":{}}],["default_uint",{"_index":3637,"title":{},"content":{"598":{"position":[[548,13]]},"706":{"position":[[548,13]]}},"keywords":{}}],["defi",{"_index":592,"title":{},"content":{"20":{"position":[[511,4]]}},"keywords":{}}],["defin",{"_index":739,"title":{"195":{"position":[[0,6]]},"431":{"position":[[0,6]]},"678":{"position":[[0,6]]}},"content":{"31":{"position":[[906,6]]},"39":{"position":[[1396,7],[1477,8]]},"42":{"position":[[335,6],[1417,6]]},"84":{"position":[[752,7]]},"91":{"position":[[803,7]]},"93":{"position":[[165,8]]},"102":{"position":[[0,8]]},"141":{"position":[[1010,7],[1106,7]]},"146":{"position":[[640,7]]},"147":{"position":[[681,7]]},"163":{"position":[[68,6]]},"194":{"position":[[29,6]]},"195":{"position":[[575,7],[606,6]]},"196":{"position":[[924,7],[1422,6]]},"197":{"position":[[1101,7]]},"198":{"position":[[1231,7],[1494,7],[2173,6]]},"199":{"position":[[60,7]]},"204":{"position":[[1059,7]]},"218":{"position":[[30,8]]},"219":{"position":[[75,6]]},"246":{"position":[[6,6],[405,7]]},"253":{"position":[[752,7]]},"283":{"position":[[803,7]]},"285":{"position":[[165,8]]},"294":{"position":[[0,8]]},"324":{"position":[[554,7],[741,7],[1311,7]]},"326":{"position":[[1010,7],[1106,7]]},"334":{"position":[[644,7]]},"335":{"position":[[689,7]]},"352":{"position":[[68,6]]},"383":{"position":[[70,8]]},"424":{"position":[[1010,7]]},"430":{"position":[[29,6]]},"431":{"position":[[575,7],[606,6]]},"432":{"position":[[862,7],[1364,6]]},"433":{"position":[[1100,7]]},"434":{"position":[[1221,7],[1484,7],[2163,6]]},"435":{"position":[[60,7]]},"440":{"position":[[3330,6]]},"441":{"position":[[1607,6],[1664,6]]},"445":{"position":[[6,6],[405,7]]},"451":{"position":[[30,8]]},"452":{"position":[[75,6]]},"484":{"position":[[752,7]]},"495":{"position":[[803,7]]},"497":{"position":[[165,8]]},"506":{"position":[[0,8]]},"535":{"position":[[1010,7],[1106,7]]},"542":{"position":[[554,7],[741,7],[1311,7]]},"551":{"position":[[644,7]]},"552":{"position":[[689,7]]},"568":{"position":[[68,6]]},"596":{"position":[[541,6],[744,7],[1092,6]]},"599":{"position":[[293,6]]},"602":{"position":[[555,7],[1890,7],[1964,6]]},"603":{"position":[[216,8]]},"604":{"position":[[15,6]]},"605":{"position":[[612,6]]},"606":{"position":[[620,6]]},"607":{"position":[[348,7]]},"608":{"position":[[638,6],[785,6]]},"610":{"position":[[521,7]]},"611":{"position":[[842,6]]},"612":{"position":[[1950,7]]},"613":{"position":[[1794,7],[2020,8]]},"614":{"position":[[409,6]]},"625":{"position":[[70,8]]},"666":{"position":[[1010,7]]},"672":{"position":[[6,6],[405,7]]},"677":{"position":[[29,6]]},"678":{"position":[[575,7],[606,6]]},"679":{"position":[[862,7],[1364,6]]},"680":{"position":[[1100,7]]},"681":{"position":[[1231,7],[1494,7],[2173,6]]},"682":{"position":[[60,7]]},"687":{"position":[[3330,6]]},"688":{"position":[[1607,6],[1664,6]]},"691":{"position":[[30,8]]},"692":{"position":[[75,6]]},"704":{"position":[[541,6],[744,7],[1092,6]]},"707":{"position":[[293,6]]},"710":{"position":[[555,7],[1890,7],[1964,6]]},"711":{"position":[[216,8]]},"712":{"position":[[15,6]]},"713":{"position":[[612,6]]},"714":{"position":[[620,6]]},"715":{"position":[[348,7]]},"716":{"position":[[638,6],[785,6]]},"718":{"position":[[521,7]]},"719":{"position":[[842,6]]},"720":{"position":[[1950,7]]},"721":{"position":[[1794,7],[2020,8]]},"722":{"position":[[409,6]]}},"keywords":{}}],["definit",{"_index":318,"title":{"203":{"position":[[7,11]]},"220":{"position":[[7,11]]},"246":{"position":[[7,11]]},"423":{"position":[[7,11]]},"445":{"position":[[7,11]]},"453":{"position":[[7,11]]},"665":{"position":[[7,11]]},"672":{"position":[[7,11]]},"693":{"position":[[7,11]]}},"content":{"10":{"position":[[82,10]]},"84":{"position":[[110,10],[186,11]]},"146":{"position":[[24,11],[446,10]]},"178":{"position":[[39,11]]},"184":{"position":[[1093,10]]},"185":{"position":[[64,10]]},"219":{"position":[[118,10]]},"246":{"position":[[354,10]]},"253":{"position":[[110,10],[186,11]]},"267":{"position":[[1179,13],[1485,13],[3537,10],[4348,12]]},"321":{"position":[[338,10]]},"334":{"position":[[24,11],[450,10]]},"369":{"position":[[39,11]]},"375":{"position":[[990,10]]},"376":{"position":[[64,10]]},"383":{"position":[[208,13],[458,13],[931,13]]},"407":{"position":[[1179,13],[1485,13],[3537,10],[4348,12]]},"419":{"position":[[654,11]]},"440":{"position":[[3810,11]]},"445":{"position":[[354,10]]},"452":{"position":[[118,10]]},"484":{"position":[[110,10],[186,11]]},"539":{"position":[[338,10]]},"551":{"position":[[24,11],[450,10]]},"585":{"position":[[39,11]]},"591":{"position":[[990,10]]},"592":{"position":[[64,10]]},"600":{"position":[[958,11]]},"625":{"position":[[208,13],[458,13],[931,13]]},"644":{"position":[[1179,13],[1485,13],[3537,10],[4348,12]]},"656":{"position":[[654,11]]},"672":{"position":[[354,10]]},"687":{"position":[[3810,11]]},"692":{"position":[[118,10]]},"708":{"position":[[958,11]]}},"keywords":{}}],["defiplatform",{"_index":1740,"title":{},"content":{"115":{"position":[[2021,12],[2161,12],[2970,12]]},"258":{"position":[[1967,12],[2107,12],[2896,12]]},"481":{"position":[[1967,12],[2107,12],[2896,12]]}},"keywords":{}}],["deleg",{"_index":1706,"title":{"113":{"position":[[0,8]]},"247":{"position":[[0,11]]},"256":{"position":[[0,8]]},"446":{"position":[[0,11]]},"479":{"position":[[0,8]]},"673":{"position":[[0,11]]}},"content":{"114":{"position":[[15,8],[58,9],[148,8],[192,9],[274,8]]},"115":{"position":[[552,9],[1431,8],[1486,9],[1723,10],[2450,9],[3045,10]]},"247":{"position":[[1747,8]]},"257":{"position":[[15,8],[58,9],[148,8],[192,9],[274,8]]},"258":{"position":[[542,9],[1377,8],[1432,9],[1669,10],[2396,9],[2971,10]]},"414":{"position":[[285,8],[339,9],[495,9]]},"419":{"position":[[1631,8],[1684,9]]},"446":{"position":[[1747,8]]},"480":{"position":[[15,8],[58,9],[148,8],[192,9],[274,8]]},"481":{"position":[[542,9],[1377,8],[1432,9],[1669,10],[2396,9],[2971,10]]},"651":{"position":[[285,8],[339,9],[495,9]]},"656":{"position":[[1631,8],[1684,9]]},"673":{"position":[[1747,8]]}},"keywords":{}}],["delet",{"_index":3729,"title":{},"content":{"602":{"position":[[861,8]]},"710":{"position":[[861,8]]}},"keywords":{}}],["delv",{"_index":1412,"title":{},"content":{"76":{"position":[[10,5]]},"227":{"position":[[10,5]]},"458":{"position":[[10,5]]},"594":{"position":[[424,5]]},"702":{"position":[[424,5]]}},"keywords":{}}],["demand",{"_index":2958,"title":{},"content":{"277":{"position":[[1247,7]]}},"keywords":{}}],["demonstr",{"_index":322,"title":{},"content":{"10":{"position":[[184,14]]},"84":{"position":[[504,12]]},"85":{"position":[[821,12]]},"253":{"position":[[504,12]]},"254":{"position":[[821,12]]},"442":{"position":[[93,12]]},"484":{"position":[[504,12]]},"485":{"position":[[821,12]]},"596":{"position":[[95,12]]},"689":{"position":[[93,12]]},"704":{"position":[[95,12]]}},"keywords":{}}],["denot",{"_index":3049,"title":{},"content":{"324":{"position":[[360,7]]},"542":{"position":[[360,7]]}},"keywords":{}}],["depend",{"_index":1035,"title":{},"content":{"42":{"position":[[443,13]]},"88":{"position":[[198,10],[226,14]]},"117":{"position":[[887,11]]},"131":{"position":[[135,14],[180,13],[661,11]]},"250":{"position":[[198,10],[226,14]]},"265":{"position":[[230,12],[537,14],[582,13]]},"267":{"position":[[119,6]]},"268":{"position":[[116,6]]},"298":{"position":[[887,11]]},"311":{"position":[[135,14],[180,13],[231,13],[713,11]]},"395":{"position":[[2448,11],[2640,14],[2903,13],[3009,13]]},"405":{"position":[[230,12],[537,14],[582,13]]},"407":{"position":[[119,6]]},"408":{"position":[[116,6]]},"477":{"position":[[822,14],[913,12]]},"488":{"position":[[198,10],[226,14]]},"519":{"position":[[887,11]]},"528":{"position":[[135,14],[180,13],[231,13],[713,11]]},"632":{"position":[[2448,11],[2640,14],[2903,13],[3009,13]]},"642":{"position":[[230,12],[537,14],[582,13]]},"644":{"position":[[119,6]]},"645":{"position":[[116,6]]},"699":{"position":[[822,14],[913,12]]}},"keywords":{}}],["dependency.regist",{"_index":2803,"title":{},"content":{"265":{"position":[[166,19]]},"405":{"position":[[166,19]]},"642":{"position":[[166,19]]}},"keywords":{}}],["deploy",{"_index":364,"title":{"52":{"position":[[0,7]]},"97":{"position":[[0,9]]},"99":{"position":[[9,6]]},"100":{"position":[[9,6]]},"101":{"position":[[9,6]]},"208":{"position":[[7,6]]},"210":{"position":[[0,9]]},"289":{"position":[[0,9]]},"291":{"position":[[9,6]]},"292":{"position":[[9,6]]},"293":{"position":[[9,6]]},"387":{"position":[[7,6]]},"389":{"position":[[0,9]]},"392":{"position":[[0,9]]},"501":{"position":[[0,9]]},"503":{"position":[[9,6]]},"504":{"position":[[9,6]]},"505":{"position":[[9,6]]},"629":{"position":[[0,9]]},"657":{"position":[[7,6]]},"659":{"position":[[0,9]]}},"content":{"11":{"position":[[7,8]]},"43":{"position":[[650,10],[889,6],[931,6],[1698,6]]},"51":{"position":[[1371,8]]},"95":{"position":[[62,6]]},"97":{"position":[[62,6]]},"98":{"position":[[5,9],[455,8]]},"99":{"position":[[3,6],[227,6]]},"100":{"position":[[282,6],[321,6],[908,8]]},"101":{"position":[[145,11],[175,6]]},"107":{"position":[[117,8]]},"108":{"position":[[201,9]]},"111":{"position":[[237,9]]},"115":{"position":[[432,8],[2295,8]]},"119":{"position":[[467,7]]},"126":{"position":[[491,6],[712,6],[1145,6],[1213,7],[2257,6],[2889,9],[3127,11]]},"127":{"position":[[464,6],[639,10],[899,10]]},"128":{"position":[[737,6],[760,8]]},"136":{"position":[[109,6]]},"141":{"position":[[87,8],[809,8],[1436,8]]},"142":{"position":[[35,8],[64,9],[222,9]]},"143":{"position":[[695,9],[744,6]]},"148":{"position":[[191,6],[247,10],[285,6],[528,9],[771,6],[904,8]]},"168":{"position":[[155,8],[1227,9],[1355,9]]},"178":{"position":[[1197,6],[1253,10],[1291,6]]},"196":{"position":[[745,6]]},"198":{"position":[[2568,6]]},"199":{"position":[[101,8]]},"206":{"position":[[558,6]]},"210":{"position":[[301,6],[369,6],[1143,6]]},"247":{"position":[[197,8]]},"258":{"position":[[422,8],[2241,8]]},"268":{"position":[[245,12],[270,6],[671,6],[805,6]]},"269":{"position":[[4468,6]]},"274":{"position":[[117,8]]},"275":{"position":[[205,9]]},"277":{"position":[[491,6],[712,6],[1313,6],[1381,7],[2425,6],[3057,9],[3295,11]]},"278":{"position":[[464,6],[639,10],[899,10]]},"279":{"position":[[737,6],[760,8]]},"287":{"position":[[62,6]]},"289":{"position":[[62,6]]},"290":{"position":[[5,9],[455,8]]},"291":{"position":[[3,6],[227,6]]},"292":{"position":[[282,6],[321,6],[908,8]]},"293":{"position":[[145,11],[175,6]]},"300":{"position":[[467,7]]},"306":{"position":[[237,9]]},"316":{"position":[[109,6]]},"324":{"position":[[1445,11]]},"326":{"position":[[87,8],[809,8],[1436,8]]},"327":{"position":[[35,8],[64,9],[222,9]]},"328":{"position":[[670,9],[719,6]]},"336":{"position":[[191,6],[247,10],[285,6],[528,9],[771,6],[904,8]]},"348":{"position":[[155,8],[1227,9],[1355,9]]},"369":{"position":[[1197,6],[1253,10],[1291,6]]},"389":{"position":[[301,6],[369,6],[1080,6]]},"393":{"position":[[498,6]]},"394":{"position":[[3,6],[560,6]]},"395":{"position":[[240,7],[647,8],[904,6],[1746,7],[3735,6],[3888,6],[4570,9],[4879,6],[5087,9],[5546,6],[6005,6],[6525,6],[6726,8]]},"396":{"position":[[162,8],[1199,8]]},"397":{"position":[[157,8],[189,8]]},"398":{"position":[[19,8]]},"408":{"position":[[245,12],[270,6],[671,6],[805,6]]},"409":{"position":[[4468,6]]},"417":{"position":[[415,9],[1355,8],[1792,9]]},"418":{"position":[[35,9]]},"419":{"position":[[6830,9],[7770,8]]},"426":{"position":[[558,6]]},"432":{"position":[[682,6]]},"434":{"position":[[2558,6]]},"435":{"position":[[101,8]]},"440":{"position":[[4628,6]]},"446":{"position":[[197,8]]},"477":{"position":[[1309,7],[2578,9],[2795,6],[3003,9],[3278,6],[3659,6],[3830,9],[3994,6]]},"478":{"position":[[98,8]]},"481":{"position":[[422,8],[2241,8]]},"491":{"position":[[117,8]]},"492":{"position":[[205,9]]},"499":{"position":[[62,6]]},"501":{"position":[[62,6]]},"502":{"position":[[5,9],[455,8]]},"503":{"position":[[3,6],[227,6]]},"504":{"position":[[282,6],[321,6],[908,8]]},"505":{"position":[[145,11],[175,6]]},"511":{"position":[[237,9]]},"514":{"position":[[491,6],[712,6],[1145,6],[1213,7],[2257,6],[2889,9],[3127,11]]},"515":{"position":[[464,6],[639,10],[899,10]]},"516":{"position":[[737,6],[760,8]]},"521":{"position":[[467,7]]},"533":{"position":[[109,6]]},"535":{"position":[[87,8],[809,8],[1436,8]]},"536":{"position":[[35,8],[64,9],[222,9]]},"537":{"position":[[670,9],[719,6]]},"542":{"position":[[1445,11]]},"553":{"position":[[191,6],[247,10],[285,6],[528,9],[771,6],[904,8]]},"564":{"position":[[155,8],[1227,9],[1355,9]]},"585":{"position":[[1197,6],[1253,10],[1291,6]]},"630":{"position":[[498,6]]},"631":{"position":[[3,6],[560,6]]},"632":{"position":[[240,7],[647,8],[904,6],[1746,7],[3735,6],[3888,6],[4570,9],[4879,6],[5087,9],[5546,6],[6005,6],[6525,6],[6726,8]]},"633":{"position":[[162,8],[1199,8]]},"634":{"position":[[157,8],[189,8]]},"635":{"position":[[19,8]]},"645":{"position":[[245,12],[270,6],[671,6],[805,6]]},"646":{"position":[[4468,6]]},"654":{"position":[[415,9],[1355,8],[1792,9]]},"655":{"position":[[35,9]]},"656":{"position":[[6830,9],[7770,8]]},"659":{"position":[[301,6],[369,6],[1080,6]]},"668":{"position":[[558,6]]},"673":{"position":[[197,8]]},"679":{"position":[[682,6]]},"681":{"position":[[2568,6]]},"682":{"position":[[101,8]]},"687":{"position":[[4628,6]]},"699":{"position":[[1309,7],[2578,9],[2795,6],[3003,9],[3278,6],[3659,6],[3830,9],[3994,6]]},"700":{"position":[[98,8]]}},"keywords":{}}],["deploy_our_token(&env",{"_index":3128,"title":{},"content":{"395":{"position":[[941,27]]},"632":{"position":[[941,27]]}},"keywords":{}}],["deploy_our_token(env",{"_index":3149,"title":{},"content":{"395":{"position":[[1773,21]]},"632":{"position":[[1773,21]]}},"keywords":{}}],["deployed_contract_hash",{"_index":2593,"title":{},"content":{"210":{"position":[[1302,24]]},"389":{"position":[[1239,24]]},"659":{"position":[[1239,24]]}},"keywords":{}}],["deployer.th",{"_index":1188,"title":{},"content":{"51":{"position":[[173,12]]}},"keywords":{}}],["deployer::deploy",{"_index":2008,"title":{},"content":{"148":{"position":[[557,16]]},"336":{"position":[[557,16]]},"553":{"position":[[557,16]]}},"keywords":{}}],["deposit",{"_index":1407,"title":{},"content":{"74":{"position":[[182,9],[260,9]]},"238":{"position":[[182,9],[260,9]]},"474":{"position":[[182,9],[260,9]]},"476":{"position":[[225,9],[584,8],[1709,7],[1750,7]]},"477":{"position":[[1383,8],[1622,8],[2021,11],[3855,9]]},"478":{"position":[[136,9]]},"698":{"position":[[225,9],[584,8],[1709,7],[1750,7]]},"699":{"position":[[1383,8],[1622,8],[2021,11],[3855,9]]},"700":{"position":[[136,9]]}},"keywords":{}}],["deposit(&mut",{"_index":1354,"title":{},"content":{"71":{"position":[[54,16]]},"235":{"position":[[54,16]]},"471":{"position":[[54,16]]},"476":{"position":[[647,16]]},"698":{"position":[[647,16]]}},"keywords":{}}],["deposit(&self",{"_index":3780,"title":{},"content":{"608":{"position":[[276,18]]},"716":{"position":[[276,18]]}},"keywords":{}}],["depth",{"_index":1654,"title":{},"content":{"99":{"position":[[688,5]]},"291":{"position":[[688,5]]},"503":{"position":[[688,5]]}},"keywords":{}}],["deriv",{"_index":1440,"title":{},"content":{"79":{"position":[[238,7]]},"91":{"position":[[856,6]]},"165":{"position":[[156,6]]},"196":{"position":[[973,6],[1462,6],[1510,6]]},"267":{"position":[[1248,6]]},"283":{"position":[[856,6]]},"407":{"position":[[1248,6]]},"495":{"position":[[856,6]]},"602":{"position":[[681,7]]},"644":{"position":[[1248,6]]},"710":{"position":[[681,7]]}},"keywords":{}}],["derive(debug",{"_index":917,"title":{},"content":{"39":{"position":[[624,15]]},"212":{"position":[[433,15],[556,15]]},"391":{"position":[[433,15],[556,15]]},"661":{"position":[[433,15],[556,15]]}},"keywords":{}}],["derive(default",{"_index":3718,"title":{},"content":{"602":{"position":[[61,18]]},"710":{"position":[[61,18]]}},"keywords":{}}],["derive(ev",{"_index":1586,"title":{},"content":{"91":{"position":[[874,17]]},"184":{"position":[[272,15],[396,15],[520,15]]},"196":{"position":[[406,15]]},"204":{"position":[[848,15]]},"205":{"position":[[2056,15]]},"219":{"position":[[383,15],[465,15]]},"267":{"position":[[1548,15]]},"269":{"position":[[3351,15],[3495,15]]},"383":{"position":[[945,16]]},"407":{"position":[[1548,15]]},"409":{"position":[[3351,15],[3495,15]]},"625":{"position":[[945,16]]},"644":{"position":[[1548,15]]},"646":{"position":[[3351,15],[3495,15]]}},"keywords":{}}],["derive(odra::ev",{"_index":1209,"title":{},"content":{"51":{"position":[[1147,22],[1260,22]]}},"keywords":{}}],["derive(odraerror",{"_index":2198,"title":{},"content":{"184":{"position":[[983,20]]},"196":{"position":[[335,20]]},"197":{"position":[[663,20]]},"205":{"position":[[2177,20]]},"219":{"position":[[293,20]]},"267":{"position":[[1293,20]]},"269":{"position":[[3656,20]]},"383":{"position":[[472,20]]},"407":{"position":[[1293,20]]},"409":{"position":[[3656,20]]},"625":{"position":[[472,20]]},"644":{"position":[[1293,20]]},"646":{"position":[[3656,20]]}},"keywords":{}}],["derive(odratyp",{"_index":2113,"title":{},"content":{"165":{"position":[[209,19]]},"209":{"position":[[524,18],[657,18]]},"383":{"position":[[222,19]]},"625":{"position":[[222,19]]}},"keywords":{}}],["derive(partialeq",{"_index":964,"title":{},"content":{"39":{"position":[[1952,19]]}},"keywords":{}}],["describ",{"_index":453,"title":{},"content":{"17":{"position":[[117,9]]},"101":{"position":[[34,9]]},"102":{"position":[[33,9]]},"184":{"position":[[676,8],[850,10]]},"211":{"position":[[829,9]]},"293":{"position":[[34,9]]},"294":{"position":[[33,9]]},"375":{"position":[[595,8],[769,10]]},"390":{"position":[[803,9]]},"395":{"position":[[16,9],[103,8]]},"505":{"position":[[34,9]]},"506":{"position":[[33,9]]},"591":{"position":[[595,8],[769,10]]},"632":{"position":[[16,9],[103,8]]},"660":{"position":[[803,9]]}},"keywords":{}}],["descript",{"_index":113,"title":{},"content":{"2":{"position":[[399,11]]},"176":{"position":[[66,11]]},"209":{"position":[[608,12],[998,12],[1079,12]]},"212":{"position":[[507,12],[1721,11],[1767,13],[2498,12],[4543,12]]},"324":{"position":[[620,11],[798,11],[992,11],[1498,11],[1540,12]]},"362":{"position":[[66,11]]},"388":{"position":[[569,12],[930,12],[1011,12]]},"391":{"position":[[507,12],[1721,11],[1767,13],[2498,12],[4561,12]]},"542":{"position":[[620,11],[798,11],[992,11],[1498,11],[1540,12]]},"578":{"position":[[66,11]]},"658":{"position":[[569,12],[930,12],[1011,12]]},"661":{"position":[[507,12],[1721,11],[1767,13],[2498,12],[4561,12]]}},"keywords":{}}],["description"",{"_index":2684,"title":{},"content":{"212":{"position":[[4565,18]]},"391":{"position":[[4583,18]]},"661":{"position":[[4583,18]]}},"keywords":{}}],["description'"",{"_index":2588,"title":{},"content":{"210":{"position":[[935,18]]},"389":{"position":[[872,18]]},"659":{"position":[[872,18]]}},"keywords":{}}],["deseri",{"_index":3077,"title":{},"content":{"354":{"position":[[440,15]]},"570":{"position":[[440,15]]}},"keywords":{}}],["deserialize."",{"_index":291,"title":{},"content":{"9":{"position":[[900,20]]}},"keywords":{}}],["design",{"_index":65,"title":{},"content":{"1":{"position":[[836,7]]},"22":{"position":[[112,7]]},"23":{"position":[[121,9]]},"38":{"position":[[130,6],[562,8],[910,6]]},"39":{"position":[[63,8]]},"40":{"position":[[3,7]]},"50":{"position":[[109,8]]},"81":{"position":[[348,6]]},"202":{"position":[[103,8]]},"232":{"position":[[348,6]]},"245":{"position":[[137,9]]},"248":{"position":[[44,6]]},"422":{"position":[[103,8]]},"444":{"position":[[137,9]]},"447":{"position":[[44,6]]},"463":{"position":[[348,6]]},"594":{"position":[[183,8],[552,6]]},"664":{"position":[[103,8]]},"671":{"position":[[137,9]]},"674":{"position":[[44,6]]},"702":{"position":[[183,8],[552,6]]}},"keywords":{}}],["despit",{"_index":895,"title":{},"content":{"39":{"position":[[49,7]]},"43":{"position":[[1862,7]]}},"keywords":{}}],["dest_file_path",{"_index":1038,"title":{},"content":{"42":{"position":[[546,15],[774,16]]}},"keywords":{}}],["detail",{"_index":1671,"title":{},"content":{"100":{"position":[[1020,7]]},"101":{"position":[[721,7]]},"112":{"position":[[56,7]]},"136":{"position":[[219,7]]},"211":{"position":[[799,7]]},"270":{"position":[[235,8]]},"292":{"position":[[1020,7]]},"293":{"position":[[721,7]]},"307":{"position":[[56,7]]},"316":{"position":[[219,7]]},"324":{"position":[[1368,7]]},"385":{"position":[[235,8]]},"390":{"position":[[773,7]]},"395":{"position":[[29,6]]},"396":{"position":[[379,8]]},"410":{"position":[[235,8]]},"504":{"position":[[1020,7]]},"505":{"position":[[721,7]]},"512":{"position":[[56,7]]},"533":{"position":[[219,7]]},"542":{"position":[[1368,7]]},"594":{"position":[[439,8]]},"627":{"position":[[235,8]]},"632":{"position":[[29,6]]},"633":{"position":[[379,8]]},"647":{"position":[[235,8]]},"660":{"position":[[773,7]]},"702":{"position":[[439,8]]}},"keywords":{}}],["detect",{"_index":3194,"title":{},"content":{"396":{"position":[[548,8]]},"633":{"position":[[548,8]]}},"keywords":{}}],["determin",{"_index":1329,"title":{},"content":{"65":{"position":[[237,9]]},"185":{"position":[[2820,9]]},"240":{"position":[[237,9]]},"376":{"position":[[2804,9]]},"465":{"position":[[237,9]]},"592":{"position":[[2804,9]]},"603":{"position":[[56,10]]},"711":{"position":[[56,10]]}},"keywords":{}}],["dev",{"_index":1880,"title":{},"content":{"131":{"position":[[175,4],[657,3]]},"265":{"position":[[226,3],[313,3],[577,4]]},"311":{"position":[[175,4],[709,3]]},"395":{"position":[[2898,4]]},"405":{"position":[[226,3],[313,3],[577,4]]},"528":{"position":[[175,4],[709,3]]},"632":{"position":[[2898,4]]},"642":{"position":[[226,3],[313,3],[577,4]]}},"keywords":{}}],["develop",{"_index":6,"title":{"593":{"position":[[18,10]]},"701":{"position":[[18,10]]}},"content":{"1":{"position":[[23,10],[43,9],[173,11],[441,11]]},"2":{"position":[[23,9]]},"12":{"position":[[297,7]]},"15":{"position":[[80,11]]},"20":{"position":[[272,9],[726,9]]},"21":{"position":[[120,11],[196,9]]},"22":{"position":[[79,11],[141,11],[207,12],[729,11]]},"33":{"position":[[93,11]]},"38":{"position":[[97,11],[195,12],[387,12],[489,10],[628,9]]},"44":{"position":[[26,12]]},"50":{"position":[[183,10]]},"52":{"position":[[174,11]]},"72":{"position":[[230,10]]},"81":{"position":[[337,10]]},"94":{"position":[[14,10]]},"119":{"position":[[33,11],[693,10]]},"232":{"position":[[337,10]]},"236":{"position":[[230,10]]},"286":{"position":[[14,10]]},"300":{"position":[[33,11],[693,10]]},"396":{"position":[[469,9],[1219,11]]},"463":{"position":[[337,10]]},"472":{"position":[[230,10]]},"498":{"position":[[14,10]]},"521":{"position":[[33,11],[693,10]]},"594":{"position":[[22,10],[107,12],[208,11],[640,11]]},"606":{"position":[[886,10]]},"612":{"position":[[13,10],[1792,11]]},"617":{"position":[[812,10],[903,10]]},"618":{"position":[[285,12]]},"633":{"position":[[469,9],[1219,11]]},"702":{"position":[[22,10],[107,12],[208,11],[640,11]]},"714":{"position":[[886,10]]},"720":{"position":[[13,10],[1792,11]]},"725":{"position":[[812,10],[903,10]]},"726":{"position":[[285,12]]}},"keywords":{}}],["diagram",{"_index":3471,"title":{},"content":{"441":{"position":[[252,7],[343,8],[4527,8]]},"688":{"position":[[252,7],[343,8],[4527,8]]}},"keywords":{}}],["dictionari",{"_index":1503,"title":{},"content":{"83":{"position":[[78,13],[278,10],[308,10]]},"84":{"position":[[873,11]]},"91":{"position":[[355,10],[506,10]]},"212":{"position":[[898,11]]},"252":{"position":[[78,13],[278,10],[308,10]]},"253":{"position":[[873,11]]},"267":{"position":[[2401,10]]},"283":{"position":[[355,10],[506,10]]},"391":{"position":[[898,11]]},"407":{"position":[[2401,10]]},"483":{"position":[[78,13],[278,10],[308,10]]},"484":{"position":[[873,11]]},"495":{"position":[[355,10],[506,10]]},"598":{"position":[[2041,13]]},"644":{"position":[[2401,10]]},"661":{"position":[[898,11]]},"706":{"position":[[2041,13]]}},"keywords":{}}],["dictionary_item_key",{"_index":2634,"title":{},"content":{"212":{"position":[[1156,20]]},"391":{"position":[[1156,20]]},"661":{"position":[[1156,20]]}},"keywords":{}}],["dictionary_nam",{"_index":2621,"title":{},"content":{"212":{"position":[[386,16],[1110,16]]},"391":{"position":[[386,16],[1110,16]]},"661":{"position":[[386,16],[1110,16]]}},"keywords":{}}],["dictionary_name.to_str",{"_index":2633,"title":{},"content":{"212":{"position":[[1127,28]]},"391":{"position":[[1127,28]]},"661":{"position":[[1127,28]]}},"keywords":{}}],["dictionaryitemidentifier::contractnamedkey",{"_index":2631,"title":{},"content":{"212":{"position":[[1033,42]]},"391":{"position":[[1033,42]]},"661":{"position":[[1033,42]]}},"keywords":{}}],["differ",{"_index":896,"title":{"88":{"position":[[8,9]]},"250":{"position":[[8,9]]},"488":{"position":[[8,9]]}},"content":{"39":{"position":[[76,9]]},"43":{"position":[[1890,9]]},"51":{"position":[[1846,9]]},"79":{"position":[[1281,7]]},"91":{"position":[[705,9]]},"126":{"position":[[2054,10]]},"129":{"position":[[229,9]]},"149":{"position":[[29,9]]},"163":{"position":[[710,10]]},"173":{"position":[[235,9],[249,9]]},"198":{"position":[[3085,9]]},"230":{"position":[[1298,7]]},"268":{"position":[[1540,12]]},"277":{"position":[[2222,10]]},"280":{"position":[[229,9]]},"283":{"position":[[705,9]]},"337":{"position":[[29,9]]},"352":{"position":[[732,10]]},"359":{"position":[[235,9],[249,9]]},"408":{"position":[[1540,12]]},"434":{"position":[[3067,9]]},"461":{"position":[[1298,7]]},"495":{"position":[[705,9]]},"514":{"position":[[2054,10]]},"517":{"position":[[229,9]]},"554":{"position":[[29,9]]},"568":{"position":[[732,10]]},"575":{"position":[[235,9],[249,9]]},"594":{"position":[[368,11]]},"596":{"position":[[987,11]]},"598":{"position":[[1595,9]]},"600":{"position":[[897,12]]},"612":{"position":[[139,9],[346,10]]},"613":{"position":[[1527,9]]},"616":{"position":[[1158,10]]},"617":{"position":[[1312,9]]},"618":{"position":[[45,11]]},"645":{"position":[[1540,12]]},"681":{"position":[[3085,9]]},"702":{"position":[[368,11]]},"704":{"position":[[987,11]]},"706":{"position":[[1595,9]]},"708":{"position":[[897,12]]},"720":{"position":[[139,9],[346,10]]},"721":{"position":[[1527,9]]},"724":{"position":[[1158,10]]},"725":{"position":[[1312,9]]},"726":{"position":[[45,11]]}},"keywords":{}}],["dir",{"_index":706,"title":{},"content":{"30":{"position":[[564,3]]}},"keywords":{}}],["direct",{"_index":126,"title":{},"content":{"3":{"position":[[76,9]]},"92":{"position":[[275,6]]},"284":{"position":[[275,6]]},"415":{"position":[[239,6]]},"496":{"position":[[275,6]]},"606":{"position":[[551,6]]},"612":{"position":[[1838,6]]},"614":{"position":[[331,6]]},"617":{"position":[[1031,6]]},"652":{"position":[[239,6]]},"714":{"position":[[551,6]]},"720":{"position":[[1838,6]]},"722":{"position":[[331,6]]},"725":{"position":[[1031,6]]}},"keywords":{}}],["directli",{"_index":1648,"title":{},"content":{"98":{"position":[[708,9]]},"143":{"position":[[792,8]]},"290":{"position":[[708,9]]},"328":{"position":[[767,8]]},"441":{"position":[[39,9]]},"502":{"position":[[708,9]]},"537":{"position":[[767,8]]},"613":{"position":[[1589,9]]},"688":{"position":[[39,9]]},"721":{"position":[[1589,9]]}},"keywords":{}}],["directori",{"_index":708,"title":{"130":{"position":[[0,9]]},"264":{"position":[[12,10]]},"310":{"position":[[0,9]]},"404":{"position":[[12,10]]},"527":{"position":[[0,9]]},"641":{"position":[[12,10]]}},"content":{"30":{"position":[[648,10]]},"65":{"position":[[484,9],[607,10]]},"100":{"position":[[109,10],[254,10]]},"117":{"position":[[1444,10]]},"122":{"position":[[62,11]]},"175":{"position":[[231,10]]},"240":{"position":[[484,9],[607,10]]},"264":{"position":[[78,9],[140,9],[256,10],[341,9]]},"292":{"position":[[109,10],[254,10]]},"298":{"position":[[1444,10]]},"303":{"position":[[62,11]]},"321":{"position":[[249,10]]},"323":{"position":[[56,10]]},"361":{"position":[[231,10]]},"382":{"position":[[154,9]]},"404":{"position":[[78,9],[140,9],[256,10],[341,9]]},"465":{"position":[[484,9],[607,10]]},"504":{"position":[[109,10],[254,10]]},"519":{"position":[[1444,10]]},"524":{"position":[[62,11]]},"539":{"position":[[249,10]]},"541":{"position":[[56,10]]},"577":{"position":[[231,10]]},"624":{"position":[[154,9]]},"641":{"position":[[78,9],[140,9],[256,10],[341,9]]}},"keywords":{}}],["dirti",{"_index":1026,"title":{},"content":{"42":{"position":[[20,5]]}},"keywords":{}}],["disabl",{"_index":1562,"title":{},"content":{"88":{"position":[[114,7],[160,7]]},"250":{"position":[[114,7],[160,7]]},"488":{"position":[[114,7],[160,7]]}},"keywords":{}}],["discord",{"_index":90,"title":{},"content":{"1":{"position":[[1165,7]]},"13":{"position":[[49,8]]},"24":{"position":[[123,8]]},"34":{"position":[[21,8]]},"55":{"position":[[21,8]]},"175":{"position":[[624,8]]},"270":{"position":[[118,7]]},"361":{"position":[[624,8]]},"385":{"position":[[118,7]]},"410":{"position":[[118,7]]},"577":{"position":[[624,8]]},"618":{"position":[[733,8]]},"627":{"position":[[118,7]]},"647":{"position":[[118,7]]},"726":{"position":[[733,8]]}},"keywords":{}}],["discriminant.entry_point",{"_index":3053,"title":{},"content":{"324":{"position":[[863,25]]},"542":{"position":[[863,25]]}},"keywords":{}}],["discuss",{"_index":159,"title":{},"content":{"3":{"position":[[616,9]]},"12":{"position":[[109,8]]}},"keywords":{}}],["disk",{"_index":306,"title":{},"content":{"9":{"position":[[1198,5],[1369,5],[1533,5]]}},"keywords":{}}],["dislik",{"_index":863,"title":{},"content":{"38":{"position":[[323,7]]}},"keywords":{}}],["display",{"_index":3592,"title":{},"content":{"477":{"position":[[3986,7]]},"699":{"position":[[3986,7]]}},"keywords":{}}],["distinct",{"_index":931,"title":{},"content":{"39":{"position":[[879,12]]},"84":{"position":[[840,8]]},"253":{"position":[[840,8]]},"484":{"position":[[840,8]]}},"keywords":{}}],["dive",{"_index":219,"title":{},"content":{"7":{"position":[[6,4]]},"124":{"position":[[27,4]]},"309":{"position":[[27,4]]},"526":{"position":[[27,4]]}},"keywords":{}}],["django",{"_index":35,"title":{},"content":{"1":{"position":[[384,6]]}},"keywords":{}}],["do",{"_index":1679,"title":{},"content":{"102":{"position":[[436,5]]},"294":{"position":[[436,5]]},"506":{"position":[[436,5]]}},"keywords":{}}],["do_something(&self",{"_index":3679,"title":{},"content":{"600":{"position":[[306,23]]},"708":{"position":[[306,23]]}},"keywords":{}}],["doc",{"_index":96,"title":{},"content":{"2":{"position":[[109,4]]},"39":{"position":[[688,4]]}},"keywords":{}}],["docker",{"_index":2569,"title":{},"content":{"210":{"position":[[56,6],[93,6]]},"389":{"position":[[56,6],[93,6]]},"477":{"position":[[88,6],[102,6],[351,6]]},"659":{"position":[[56,6],[93,6]]},"699":{"position":[[88,6],[102,6],[351,6]]}},"keywords":{}}],["document",{"_index":46,"title":{},"content":{"1":{"position":[[572,13]]},"23":{"position":[[156,13]]},"81":{"position":[[112,8]]},"157":{"position":[[841,14]]},"168":{"position":[[2249,14]]},"173":{"position":[[298,13]]},"174":{"position":[[128,13]]},"232":{"position":[[112,8]]},"268":{"position":[[2948,13]]},"270":{"position":[[161,14],[212,13]]},"324":{"position":[[841,15]]},"330":{"position":[[817,14]]},"348":{"position":[[2259,14]]},"359":{"position":[[298,13]]},"360":{"position":[[128,13]]},"385":{"position":[[161,14],[212,13]]},"395":{"position":[[67,14]]},"408":{"position":[[2948,13]]},"410":{"position":[[161,14],[212,13]]},"463":{"position":[[112,8]]},"542":{"position":[[841,15]]},"547":{"position":[[841,14]]},"564":{"position":[[2249,14]]},"575":{"position":[[298,13]]},"576":{"position":[[128,13]]},"627":{"position":[[161,14],[212,13]]},"632":{"position":[[67,14]]},"645":{"position":[[2948,13]]},"647":{"position":[[161,14],[212,13]]}},"keywords":{}}],["documentationdocs.rsexampl",{"_index":2953,"title":{},"content":{"271":{"position":[[14,28]]},"386":{"position":[[14,28]]},"411":{"position":[[14,28]]},"628":{"position":[[14,28]]},"648":{"position":[[14,28]]}},"keywords":{}}],["doesn't",{"_index":442,"title":{},"content":{"16":{"position":[[305,7]]},"103":{"position":[[719,7]]},"162":{"position":[[1626,7]]},"268":{"position":[[583,7],[2825,7]]},"295":{"position":[[719,7]]},"351":{"position":[[1648,7]]},"408":{"position":[[583,7],[2825,7]]},"507":{"position":[[719,7]]},"567":{"position":[[1648,7]]},"605":{"position":[[574,7]]},"645":{"position":[[583,7],[2825,7]]},"713":{"position":[[574,7]]}},"keywords":{}}],["dog",{"_index":2047,"title":{},"content":{"162":{"position":[[284,4],[2092,3]]},"163":{"position":[[184,3]]},"164":{"position":[[426,3],[938,3]]},"165":{"position":[[240,3]]},"351":{"position":[[284,4],[2114,3]]},"352":{"position":[[184,3]]},"353":{"position":[[461,3],[973,3]]},"354":{"position":[[219,3],[278,3]]},"383":{"position":[[364,3]]},"567":{"position":[[284,4],[2114,3]]},"568":{"position":[[184,3]]},"569":{"position":[[461,3],[973,3]]},"570":{"position":[[219,3],[278,3]]},"625":{"position":[[364,3]]}},"keywords":{}}],["dog'",{"_index":2082,"title":{},"content":{"163":{"position":[[247,5]]},"352":{"position":[[247,5]]},"568":{"position":[[247,5]]}},"keywords":{}}],["dogcontract",{"_index":2049,"title":{},"content":{"162":{"position":[[358,11],[750,11]]},"164":{"position":[[18,11]]},"351":{"position":[[395,11],[772,11]]},"353":{"position":[[18,11]]},"567":{"position":[[395,11],[772,11]]},"569":{"position":[[18,11]]}},"keywords":{}}],["dogcontract2",{"_index":2084,"title":{},"content":{"163":{"position":[[388,12]]},"352":{"position":[[410,12]]},"568":{"position":[[410,12]]}},"keywords":{}}],["dogcontract3",{"_index":2103,"title":{},"content":{"164":{"position":[[181,12],[537,12]]},"353":{"position":[[216,12],[572,12]]},"569":{"position":[[216,12],[572,12]]}},"keywords":{}}],["don't",{"_index":1299,"title":{},"content":{"53":{"position":[[14,5]]},"54":{"position":[[438,6]]},"79":{"position":[[1378,5]]},"91":{"position":[[897,5]]},"126":{"position":[[546,5]]},"134":{"position":[[89,5]]},"151":{"position":[[6,5]]},"198":{"position":[[2322,5]]},"206":{"position":[[3776,5]]},"218":{"position":[[176,5]]},"230":{"position":[[1395,5]]},"265":{"position":[[53,5]]},"270":{"position":[[81,5]]},"277":{"position":[[546,5]]},"283":{"position":[[895,5]]},"314":{"position":[[89,5]]},"342":{"position":[[6,5]]},"385":{"position":[[81,5]]},"405":{"position":[[53,5]]},"410":{"position":[[81,5]]},"415":{"position":[[77,5],[95,5]]},"416":{"position":[[4852,5]]},"426":{"position":[[3751,5]]},"434":{"position":[[2312,5]]},"451":{"position":[[176,5]]},"461":{"position":[[1395,5]]},"495":{"position":[[895,5]]},"514":{"position":[[546,5]]},"531":{"position":[[89,5]]},"556":{"position":[[6,5]]},"605":{"position":[[264,5]]},"627":{"position":[[81,5]]},"642":{"position":[[53,5]]},"647":{"position":[[81,5]]},"652":{"position":[[77,5],[95,5]]},"653":{"position":[[4852,5]]},"668":{"position":[[3776,5]]},"681":{"position":[[2322,5]]},"691":{"position":[[176,5]]},"713":{"position":[[264,5]]}},"keywords":{}}],["done",{"_index":1668,"title":{},"content":{"100":{"position":[[886,5]]},"196":{"position":[[552,4]]},"198":{"position":[[3396,4]]},"247":{"position":[[1803,4]]},"292":{"position":[[886,5]]},"396":{"position":[[916,4]]},"432":{"position":[[489,4]]},"434":{"position":[[3378,4]]},"446":{"position":[[1803,4]]},"504":{"position":[[886,5]]},"633":{"position":[[916,4]]},"673":{"position":[[1803,4]]},"679":{"position":[[489,4]]},"681":{"position":[[3396,4]]}},"keywords":{}}],["down",{"_index":913,"title":{},"content":{"39":{"position":[[521,4]]},"395":{"position":[[4254,4]]},"632":{"position":[[4254,4]]}},"keywords":{}}],["download",{"_index":3109,"title":{},"content":{"393":{"position":[[282,8]]},"395":{"position":[[4137,10]]},"630":{"position":[[282,8]]},"632":{"position":[[4137,10]]}},"keywords":{}}],["downsid",{"_index":2072,"title":{},"content":{"162":{"position":[[1837,9]]},"351":{"position":[[1859,9]]},"567":{"position":[[1859,9]]}},"keywords":{}}],["dropdown",{"_index":3190,"title":{},"content":{"396":{"position":[[267,8]]},"633":{"position":[[267,8]]}},"keywords":{}}],["due",{"_index":948,"title":{},"content":{"39":{"position":[[1292,3]]},"266":{"position":[[0,3]]},"406":{"position":[[0,3]]},"606":{"position":[[1139,3]]},"643":{"position":[[0,3]]},"714":{"position":[[1139,3]]}},"keywords":{}}],["durat",{"_index":3541,"title":{},"content":{"476":{"position":[[480,9],[1459,9]]},"698":{"position":[[480,9],[1459,9]]}},"keywords":{}}],["dure",{"_index":1567,"title":{},"content":{"88":{"position":[[396,6]]},"108":{"position":[[270,6]]},"119":{"position":[[22,6]]},"135":{"position":[[25,6]]},"175":{"position":[[558,6]]},"250":{"position":[[396,6]]},"275":{"position":[[274,6]]},"300":{"position":[[22,6]]},"315":{"position":[[25,6]]},"361":{"position":[[558,6]]},"396":{"position":[[921,6],[1208,6]]},"476":{"position":[[1571,6]]},"488":{"position":[[396,6]]},"492":{"position":[[274,6]]},"521":{"position":[[22,6]]},"532":{"position":[[25,6]]},"577":{"position":[[558,6]]},"617":{"position":[[956,6]]},"633":{"position":[[921,6],[1208,6]]},"698":{"position":[[1571,6]]},"725":{"position":[[956,6]]}},"keywords":{}}],["dynam",{"_index":3715,"title":{},"content":{"601":{"position":[[1961,7]]},"709":{"position":[[1961,7]]}},"keywords":{}}],["e",{"_index":2865,"title":{},"content":{"267":{"position":[[2704,2],[2782,2]]},"407":{"position":[[2704,2],[2782,2]]},"612":{"position":[[1062,1],[1134,1]]},"644":{"position":[[2704,2],[2782,2]]},"720":{"position":[[1062,1],[1134,1]]}},"keywords":{}}],["e.g",{"_index":1767,"title":{},"content":{"117":{"position":[[1113,4]]},"298":{"position":[[1113,4]]},"519":{"position":[[1113,4]]},"603":{"position":[[274,6]]},"711":{"position":[[274,6]]}},"keywords":{}}],["each",{"_index":1227,"title":{},"content":{"52":{"position":[[256,4]]},"76":{"position":[[508,4]]},"79":{"position":[[436,4]]},"86":{"position":[[36,4]]},"94":{"position":[[532,4]]},"95":{"position":[[291,4],[458,4]]},"102":{"position":[[153,4]]},"106":{"position":[[57,4]]},"110":{"position":[[44,4]]},"126":{"position":[[2130,4]]},"127":{"position":[[634,4]]},"138":{"position":[[794,4]]},"143":{"position":[[619,4]]},"146":{"position":[[36,4]]},"162":{"position":[[1946,4]]},"165":{"position":[[318,4]]},"178":{"position":[[51,4]]},"184":{"position":[[156,4]]},"185":{"position":[[2744,4]]},"198":{"position":[[1143,4],[1301,4],[3641,4]]},"227":{"position":[[508,4]]},"230":{"position":[[453,4]]},"255":{"position":[[36,4]]},"273":{"position":[[57,4]]},"277":{"position":[[2298,4]]},"278":{"position":[[634,4]]},"286":{"position":[[532,4]]},"287":{"position":[[291,4],[458,4]]},"294":{"position":[[153,4]]},"305":{"position":[[44,4]]},"318":{"position":[[786,4]]},"324":{"position":[[583,4],[770,4],[958,4],[1262,4]]},"328":{"position":[[594,4]]},"334":{"position":[[36,4]]},"351":{"position":[[1968,4]]},"354":{"position":[[642,4]]},"369":{"position":[[51,4]]},"375":{"position":[[156,4]]},"376":{"position":[[2728,4]]},"413":{"position":[[69,4]]},"419":{"position":[[666,4]]},"434":{"position":[[1133,4],[1291,4],[3623,4]]},"458":{"position":[[508,4]]},"461":{"position":[[453,4]]},"486":{"position":[[36,4]]},"490":{"position":[[57,4]]},"498":{"position":[[532,4]]},"499":{"position":[[291,4],[458,4]]},"506":{"position":[[153,4]]},"510":{"position":[[44,4]]},"514":{"position":[[2130,4]]},"515":{"position":[[634,4]]},"537":{"position":[[594,4]]},"542":{"position":[[583,4],[770,4],[958,4],[1262,4]]},"544":{"position":[[786,4]]},"551":{"position":[[36,4]]},"567":{"position":[[1968,4]]},"570":{"position":[[642,4]]},"585":{"position":[[51,4]]},"591":{"position":[[156,4]]},"592":{"position":[[2728,4]]},"598":{"position":[[2204,4]]},"600":{"position":[[1109,4]]},"612":{"position":[[1933,4]]},"650":{"position":[[69,4]]},"656":{"position":[[666,4]]},"681":{"position":[[1143,4],[1301,4],[3641,4]]},"706":{"position":[[2204,4]]},"708":{"position":[[1109,4]]},"720":{"position":[[1933,4]]}},"keywords":{}}],["earli",{"_index":1171,"title":{},"content":{"44":{"position":[[11,5]]}},"keywords":{}}],["earlier",{"_index":3055,"title":{},"content":{"324":{"position":[[1302,8]]},"542":{"position":[[1302,8]]}},"keywords":{}}],["eas",{"_index":3086,"title":{},"content":{"365":{"position":[[261,4]]},"581":{"position":[[261,4]]}},"keywords":{}}],["easi",{"_index":19,"title":{},"content":{"1":{"position":[[195,5],[756,4]]},"22":{"position":[[1434,4]]},"114":{"position":[[246,4]]},"162":{"position":[[1777,4]]},"195":{"position":[[177,5]]},"197":{"position":[[879,4]]},"223":{"position":[[1363,5]]},"247":{"position":[[1530,5]]},"248":{"position":[[175,4]]},"257":{"position":[[246,4]]},"351":{"position":[[1799,4]]},"431":{"position":[[177,5]]},"433":{"position":[[878,4]]},"446":{"position":[[1530,5]]},"447":{"position":[[175,4]]},"456":{"position":[[1363,5]]},"480":{"position":[[246,4]]},"567":{"position":[[1799,4]]},"673":{"position":[[1530,5]]},"674":{"position":[[175,4]]},"678":{"position":[[177,5]]},"680":{"position":[[878,4]]},"696":{"position":[[1363,5]]}},"keywords":{}}],["easier",{"_index":1236,"title":{},"content":{"52":{"position":[[548,7]]},"478":{"position":[[394,6]]},"700":{"position":[[394,6]]}},"keywords":{}}],["easiest",{"_index":2404,"title":{},"content":{"198":{"position":[[2041,7]]},"394":{"position":[[70,7]]},"434":{"position":[[2031,7]]},"631":{"position":[[70,7]]},"681":{"position":[[2041,7]]}},"keywords":{}}],["easili",{"_index":960,"title":{},"content":{"39":{"position":[[1857,6]]},"50":{"position":[[254,6]]},"85":{"position":[[346,6]]},"129":{"position":[[99,6]]},"157":{"position":[[57,6]]},"254":{"position":[[346,6]]},"280":{"position":[[99,6]]},"330":{"position":[[57,6]]},"485":{"position":[[346,6]]},"517":{"position":[[99,6]]},"547":{"position":[[57,6]]}},"keywords":{}}],["ecosystem",{"_index":569,"title":{},"content":{"20":{"position":[[68,9],[237,10]]},"22":{"position":[[828,10]]},"50":{"position":[[82,10]]},"53":{"position":[[1098,10]]},"365":{"position":[[15,9],[191,9]]},"398":{"position":[[298,9]]},"418":{"position":[[103,9]]},"581":{"position":[[15,9],[191,9]]},"635":{"position":[[298,9]]},"655":{"position":[[103,9]]}},"keywords":{}}],["edg",{"_index":39,"title":{},"content":{"1":{"position":[[421,4]]}},"keywords":{}}],["edit",{"_index":428,"title":{"16":{"position":[[8,5]]}},"content":{"16":{"position":[[36,5],[160,4]]},"17":{"position":[[64,4]]},"117":{"position":[[432,7]]},"131":{"position":[[108,7]]},"265":{"position":[[510,7]]},"298":{"position":[[432,7]]},"311":{"position":[[108,7]]},"395":{"position":[[2613,7]]},"405":{"position":[[510,7]]},"477":{"position":[[795,7]]},"519":{"position":[[432,7]]},"528":{"position":[[108,7]]},"632":{"position":[[2613,7]]},"642":{"position":[[510,7]]},"699":{"position":[[795,7]]}},"keywords":{}}],["effect",{"_index":597,"title":{},"content":{"20":{"position":[[555,6],[885,6]]},"72":{"position":[[264,7]]},"185":{"position":[[3692,6]]},"236":{"position":[[264,7]]},"376":{"position":[[3676,6]]},"472":{"position":[[264,7]]},"592":{"position":[[3676,6]]},"605":{"position":[[666,8]]},"618":{"position":[[218,11]]},"713":{"position":[[666,8]]},"726":{"position":[[218,11]]}},"keywords":{}}],["effici",{"_index":1164,"title":{},"content":{"43":{"position":[[2007,11]]},"81":{"position":[[374,9]]},"115":{"position":[[3300,10]]},"162":{"position":[[1793,9]]},"232":{"position":[[374,9]]},"258":{"position":[[3226,10]]},"351":{"position":[[1815,9]]},"463":{"position":[[374,9]]},"481":{"position":[[3226,10]]},"567":{"position":[[1815,9]]},"602":{"position":[[1177,9],[2061,9]]},"710":{"position":[[1177,9],[2061,9]]}},"keywords":{}}],["element",{"_index":451,"title":{},"content":{"17":{"position":[[85,9]]},"85":{"position":[[6,7],[42,8],[144,9],[160,7]]},"94":{"position":[[271,7],[399,7]]},"154":{"position":[[136,8]]},"212":{"position":[[1883,8]]},"254":{"position":[[6,7],[42,8],[144,9],[160,7]]},"286":{"position":[[271,7],[399,7]]},"339":{"position":[[136,8]]},"391":{"position":[[1883,8]]},"485":{"position":[[6,7],[42,8],[144,9],[160,7]]},"498":{"position":[[271,7],[399,7]]},"559":{"position":[[136,8]]},"613":{"position":[[1473,7]]},"661":{"position":[[1883,8]]},"721":{"position":[[1473,7]]}},"keywords":{}}],["else'",{"_index":1938,"title":{},"content":{"141":{"position":[[784,6]]},"326":{"position":[[784,6]]},"535":{"position":[[784,6]]}},"keywords":{}}],["email",{"_index":111,"title":{},"content":{"2":{"position":[[360,5]]}},"keywords":{}}],["embed",{"_index":3811,"title":{},"content":{"612":{"position":[[282,9],[2004,9]]},"720":{"position":[[282,9],[2004,9]]}},"keywords":{}}],["emerg",{"_index":598,"title":{},"content":{"20":{"position":[[562,7]]},"190":{"position":[[44,9]]},"367":{"position":[[44,9]]},"583":{"position":[[44,9]]}},"keywords":{}}],["emit",{"_index":1204,"title":{},"content":{"51":{"position":[[911,9]]},"71":{"position":[[375,4]]},"91":{"position":[[148,4],[586,5]]},"139":{"position":[[21,4]]},"157":{"position":[[106,8],[574,9],[706,8]]},"168":{"position":[[2174,7]]},"185":{"position":[[3427,5]]},"193":{"position":[[152,8]]},"195":{"position":[[467,7]]},"197":{"position":[[1276,4]]},"198":{"position":[[2749,8]]},"206":{"position":[[927,8],[1589,8]]},"222":{"position":[[561,5]]},"235":{"position":[[375,4]]},"267":{"position":[[1695,8]]},"268":{"position":[[2797,7],[2914,7]]},"269":{"position":[[4837,8],[5499,8]]},"283":{"position":[[148,4],[586,5]]},"319":{"position":[[21,4]]},"321":{"position":[[733,5],[1099,5],[1317,5]]},"323":{"position":[[1782,5],[2760,5]]},"324":{"position":[[1256,5]]},"330":{"position":[[106,8],[560,9],[687,8]]},"348":{"position":[[2184,7]]},"376":{"position":[[3411,5]]},"407":{"position":[[1695,8]]},"408":{"position":[[2797,7],[2914,7]]},"409":{"position":[[4837,8],[5499,8]]},"426":{"position":[[927,8],[1584,8]]},"429":{"position":[[152,8]]},"431":{"position":[[467,7]]},"433":{"position":[[1275,4]]},"434":{"position":[[2739,8]]},"440":{"position":[[2134,4],[3621,7],[4218,5],[4537,5]]},"441":{"position":[[3087,4]]},"455":{"position":[[561,5]]},"471":{"position":[[375,4]]},"476":{"position":[[970,4]]},"495":{"position":[[148,4],[586,5]]},"539":{"position":[[733,5],[1099,5],[1317,5]]},"541":{"position":[[1782,5],[2760,5]]},"542":{"position":[[1256,5]]},"545":{"position":[[21,4]]},"547":{"position":[[106,8],[574,9],[706,8]]},"564":{"position":[[2174,7]]},"592":{"position":[[3411,5]]},"604":{"position":[[503,4]]},"610":{"position":[[672,4],[801,4]]},"644":{"position":[[1695,8]]},"645":{"position":[[2797,7],[2914,7]]},"646":{"position":[[4837,8],[5499,8]]},"668":{"position":[[927,8],[1589,8]]},"676":{"position":[[152,8]]},"678":{"position":[[467,7]]},"680":{"position":[[1275,4]]},"681":{"position":[[2749,8]]},"687":{"position":[[2134,4],[3621,7],[4218,5],[4537,5]]},"688":{"position":[[3087,4]]},"695":{"position":[[561,5]]},"698":{"position":[[970,4]]},"712":{"position":[[503,4]]},"718":{"position":[[672,4],[801,4]]}},"keywords":{}}],["emit_ev",{"_index":3797,"title":{},"content":{"610":{"position":[[701,12]]},"718":{"position":[[701,12]]}},"keywords":{}}],["emit_event<t",{"_index":2867,"title":{},"content":{"267":{"position":[[2796,16],[2857,16]]},"407":{"position":[[2796,16],[2857,16]]},"644":{"position":[[2796,16],[2857,16]]}},"keywords":{}}],["emit_event(deposit",{"_index":1367,"title":{},"content":{"71":{"position":[[524,19]]},"235":{"position":[[524,19]]},"471":{"position":[[524,19]]}},"keywords":{}}],["emitted_event<t",{"_index":2142,"title":{},"content":{"168":{"position":[[2029,19]]},"348":{"position":[[2029,19]]},"564":{"position":[[2029,19]]}},"keywords":{}}],["emphas",{"_index":897,"title":{},"content":{"39":{"position":[[111,9]]}},"keywords":{}}],["empti",{"_index":1770,"title":{},"content":{"117":{"position":[[1438,5]]},"298":{"position":[[1438,5]]},"519":{"position":[[1438,5]]}},"keywords":{}}],["emptyarray",{"_index":3835,"title":{},"content":{"613":{"position":[[487,10]]},"721":{"position":[[487,10]]}},"keywords":{}}],["enabl",{"_index":178,"title":{},"content":{"5":{"position":[[185,7]]},"22":{"position":[[220,8],[775,6]]},"38":{"position":[[208,8]]},"39":{"position":[[431,7]]},"50":{"position":[[174,8]]},"76":{"position":[[249,6]]},"81":{"position":[[157,8]]},"83":{"position":[[33,7]]},"88":{"position":[[147,8],[388,7]]},"103":{"position":[[651,7]]},"108":{"position":[[27,8]]},"127":{"position":[[81,8]]},"189":{"position":[[27,7],[299,7]]},"227":{"position":[[249,6]]},"232":{"position":[[157,8]]},"250":{"position":[[147,8],[388,7]]},"252":{"position":[[33,7]]},"275":{"position":[[27,8]]},"278":{"position":[[81,8]]},"295":{"position":[[651,7]]},"366":{"position":[[27,7],[299,7]]},"458":{"position":[[249,6]]},"463":{"position":[[157,8]]},"483":{"position":[[33,7]]},"488":{"position":[[147,8],[388,7]]},"492":{"position":[[27,8]]},"507":{"position":[[651,7]]},"515":{"position":[[81,8]]},"582":{"position":[[27,7],[299,7]]}},"keywords":{}}],["encapsul",{"_index":1469,"title":{},"content":{"79":{"position":[[1384,11]]},"86":{"position":[[127,12]]},"171":{"position":[[62,12]]},"230":{"position":[[1401,11]]},"248":{"position":[[84,11]]},"255":{"position":[[127,12]]},"357":{"position":[[62,12]]},"447":{"position":[[84,11]]},"461":{"position":[[1401,11]]},"486":{"position":[[127,12]]},"573":{"position":[[62,12]]},"674":{"position":[[84,11]]}},"keywords":{}}],["encod",{"_index":794,"title":{},"content":{"31":{"position":[[2758,7]]},"85":{"position":[[1034,7]]},"211":{"position":[[781,9]]},"212":{"position":[[3791,8]]},"254":{"position":[[1034,7]]},"390":{"position":[[755,9]]},"391":{"position":[[3809,8]]},"485":{"position":[[1034,7]]},"660":{"position":[[755,9]]},"661":{"position":[[3809,8]]}},"keywords":{}}],["encount",{"_index":875,"title":{},"content":{"38":{"position":[[643,9]]},"270":{"position":[[7,9]]},"385":{"position":[[7,9]]},"395":{"position":[[4205,9]]},"410":{"position":[[7,9]]},"627":{"position":[[7,9]]},"632":{"position":[[4205,9]]},"647":{"position":[[7,9]]}},"keywords":{}}],["encourag",{"_index":155,"title":{},"content":{"3":{"position":[[534,10]]},"22":{"position":[[62,10]]},"38":{"position":[[80,10]]},"248":{"position":[[19,10]]},"447":{"position":[[19,10]]},"612":{"position":[[239,10]]},"674":{"position":[[19,10]]},"720":{"position":[[239,10]]}},"keywords":{}}],["end",{"_index":1782,"title":{},"content":{"119":{"position":[[792,4]]},"223":{"position":[[7,4]]},"300":{"position":[[792,4]]},"395":{"position":[[2506,4]]},"416":{"position":[[725,5],[1045,6],[1959,3],[3708,6]]},"417":{"position":[[797,4]]},"419":{"position":[[535,5],[1096,5],[4477,3],[5287,6],[7212,4]]},"456":{"position":[[7,4]]},"521":{"position":[[792,4]]},"632":{"position":[[2506,4]]},"653":{"position":[[725,5],[1045,6],[1959,3],[3708,6]]},"654":{"position":[[797,4]]},"656":{"position":[[535,5],[1096,5],[4477,3],[5287,6],[7212,4]]},"696":{"position":[[7,4]]}},"keywords":{}}],["endian",{"_index":2604,"title":{},"content":{"211":{"position":[[605,6]]},"212":{"position":[[3597,6]]},"390":{"position":[[579,6]]},"391":{"position":[[3615,6]]},"660":{"position":[[579,6]]},"661":{"position":[[3615,6]]}},"keywords":{}}],["endless",{"_index":1751,"title":{},"content":{"115":{"position":[[3223,7]]},"258":{"position":[[3149,7]]},"481":{"position":[[3149,7]]}},"keywords":{}}],["endpoint",{"_index":1933,"title":{},"content":{"141":{"position":[[527,9]]},"147":{"position":[[456,9],[1266,9]]},"326":{"position":[[527,9]]},"335":{"position":[[460,9],[1274,9]]},"416":{"position":[[1248,8],[2569,8]]},"535":{"position":[[527,9]]},"552":{"position":[[460,9],[1274,9]]},"653":{"position":[[1248,8],[2569,8]]}},"keywords":{}}],["engin",{"_index":578,"title":{},"content":{"20":{"position":[[164,11]]},"66":{"position":[[378,7]]},"83":{"position":[[21,6]]},"95":{"position":[[146,7]]},"241":{"position":[[378,7]]},"252":{"position":[[21,6]]},"287":{"position":[[146,7]]},"466":{"position":[[378,7]]},"483":{"position":[[21,6]]},"499":{"position":[[146,7]]}},"keywords":{}}],["enhanc",{"_index":158,"title":{},"content":{"3":{"position":[[578,12]]},"365":{"position":[[228,8]]},"581":{"position":[[228,8]]}},"keywords":{}}],["enough",{"_index":3407,"title":{},"content":{"440":{"position":[[2846,6],[4432,6],[5982,6]]},"687":{"position":[[2846,6],[4432,6],[5982,6]]}},"keywords":{}}],["ensur",{"_index":949,"title":{},"content":{"39":{"position":[[1324,7]]},"72":{"position":[[248,6]]},"185":{"position":[[3151,6]]},"205":{"position":[[3,6]]},"222":{"position":[[441,6]]},"236":{"position":[[248,6]]},"248":{"position":[[150,8]]},"267":{"position":[[4095,6]]},"376":{"position":[[3135,6]]},"407":{"position":[[4095,6]]},"425":{"position":[[3,6]]},"447":{"position":[[150,8]]},"455":{"position":[[441,6]]},"472":{"position":[[248,6]]},"592":{"position":[[3135,6]]},"612":{"position":[[1641,6]]},"644":{"position":[[4095,6]]},"667":{"position":[[3,6]]},"674":{"position":[[150,8]]},"695":{"position":[[441,6]]},"720":{"position":[[1641,6]]}},"keywords":{}}],["ensure_ownership",{"_index":2367,"title":{},"content":{"197":{"position":[[915,18]]},"198":{"position":[[1523,19]]},"433":{"position":[[914,18]]},"434":{"position":[[1513,19]]},"680":{"position":[[914,18]]},"681":{"position":[[1523,19]]}},"keywords":{}}],["ensure_ownership(&self",{"_index":2351,"title":{},"content":{"197":{"position":[[53,27]]},"433":{"position":[[53,27]]},"680":{"position":[[53,27]]}},"keywords":{}}],["enter",{"_index":21,"title":{},"content":{"1":{"position":[[212,8]]}},"keywords":{}}],["enthusiast",{"_index":9,"title":{},"content":{"1":{"position":[[65,10]]}},"keywords":{}}],["entir",{"_index":2257,"title":{},"content":{"185":{"position":[[2965,6]]},"206":{"position":[[3800,6]]},"376":{"position":[[2949,6]]},"426":{"position":[[3775,6]]},"592":{"position":[[2949,6]]},"601":{"position":[[2087,6]]},"668":{"position":[[3800,6]]},"709":{"position":[[2087,6]]}},"keywords":{}}],["entiti",{"_index":3490,"title":{},"content":{"441":{"position":[[1408,6]]},"688":{"position":[[1408,6]]}},"keywords":{}}],["entri",{"_index":342,"title":{},"content":{"10":{"position":[[819,5]]},"21":{"position":[[161,5]]},"22":{"position":[[623,5],[969,5]]},"42":{"position":[[1329,5],[1804,5]]},"43":{"position":[[1943,5]]},"102":{"position":[[17,5],[166,5],[377,5]]},"103":{"position":[[252,5],[374,5]]},"185":{"position":[[2894,5],[3790,5],[3968,5]]},"210":{"position":[[1339,5]]},"294":{"position":[[17,5],[166,5],[377,5]]},"295":{"position":[[252,5],[374,5]]},"324":{"position":[[963,5]]},"376":{"position":[[2878,5],[3774,5],[3952,5]]},"389":{"position":[[1276,5]]},"441":{"position":[[3946,5]]},"506":{"position":[[17,5],[166,5],[377,5]]},"507":{"position":[[252,5],[374,5]]},"542":{"position":[[963,5]]},"592":{"position":[[2878,5],[3774,5],[3952,5]]},"598":{"position":[[2110,5],[2209,5]]},"600":{"position":[[1015,5],[1114,5]]},"604":{"position":[[28,5]]},"659":{"position":[[1276,5]]},"688":{"position":[[3946,5]]},"706":{"position":[[2110,5],[2209,5]]},"708":{"position":[[1015,5],[1114,5]]},"712":{"position":[[28,5]]}},"keywords":{}}],["entrypoint",{"_index":1274,"title":{},"content":{"52":{"position":[[2082,10]]},"104":{"position":[[87,11]]},"108":{"position":[[126,12],[312,10]]},"121":{"position":[[54,12]]},"127":{"position":[[317,10]]},"128":{"position":[[13,11],[459,10]]},"138":{"position":[[926,12]]},"147":{"position":[[58,12]]},"178":{"position":[[342,12]]},"198":{"position":[[1502,12],[3657,11]]},"247":{"position":[[1692,11]]},"267":{"position":[[2972,11]]},"275":{"position":[[130,12],[316,10]]},"278":{"position":[[317,10]]},"279":{"position":[[13,11],[459,10]]},"296":{"position":[[87,11]]},"302":{"position":[[54,12]]},"318":{"position":[[918,12]]},"335":{"position":[[58,12]]},"369":{"position":[[342,12]]},"395":{"position":[[5287,10],[5758,10],[6277,10]]},"407":{"position":[[2972,11]]},"415":{"position":[[114,11]]},"419":{"position":[[1182,12],[1722,10]]},"434":{"position":[[1492,12],[3639,11]]},"446":{"position":[[1692,11]]},"477":{"position":[[3118,10],[3512,10]]},"492":{"position":[[130,12],[316,10]]},"508":{"position":[[87,11]]},"515":{"position":[[317,10]]},"516":{"position":[[13,11],[459,10]]},"523":{"position":[[54,12]]},"544":{"position":[[918,12]]},"552":{"position":[[58,12]]},"585":{"position":[[342,12]]},"632":{"position":[[5287,10],[5758,10],[6277,10]]},"644":{"position":[[2972,11]]},"652":{"position":[[114,11]]},"656":{"position":[[1182,12],[1722,10]]},"673":{"position":[[1692,11]]},"681":{"position":[[1502,12],[3657,11]]},"699":{"position":[[3118,10],[3512,10]]}},"keywords":{}}],["entrypoint.l2",{"_index":2716,"title":{},"content":{"221":{"position":[[540,13]]},"454":{"position":[[540,13]]},"694":{"position":[[540,13]]}},"keywords":{}}],["enum",{"_index":503,"title":{},"content":{"17":{"position":[[1555,4],[3995,4]]},"184":{"position":[[1008,4]]},"196":{"position":[[360,4],[941,5],[1004,5]]},"197":{"position":[[688,4],[1044,4]]},"205":{"position":[[2202,4]]},"219":{"position":[[318,4]]},"267":{"position":[[1318,4]]},"269":{"position":[[3681,4]]},"321":{"position":[[828,4],[1776,4],[1866,4]]},"324":{"position":[[548,5],[598,4],[735,5]]},"354":{"position":[[405,6],[550,5],[595,4],[600,4]]},"375":{"position":[[905,4]]},"383":{"position":[[562,4],[764,4]]},"384":{"position":[[3645,4]]},"407":{"position":[[1318,4]]},"409":{"position":[[3681,4]]},"419":{"position":[[346,4]]},"425":{"position":[[2152,4]]},"432":{"position":[[321,4],[879,5],[949,5]]},"433":{"position":[[687,4],[1043,4]]},"440":{"position":[[437,4],[778,4],[3352,5],[3406,4]]},"441":{"position":[[696,4],[2284,4]]},"452":{"position":[[297,4]]},"476":{"position":[[1626,4]]},"539":{"position":[[828,4],[1776,4],[1866,4]]},"542":{"position":[[548,5],[598,4],[735,5]]},"570":{"position":[[405,6],[550,5],[595,4],[600,4]]},"591":{"position":[[905,4]]},"602":{"position":[[84,4],[186,4],[243,4],[607,4],[717,4],[1072,4],[1279,4],[1864,6]]},"611":{"position":[[89,4]]},"613":{"position":[[474,4]]},"617":{"position":[[1183,4]]},"625":{"position":[[562,4],[764,4]]},"626":{"position":[[3645,4]]},"644":{"position":[[1318,4]]},"646":{"position":[[3681,4]]},"656":{"position":[[346,4]]},"667":{"position":[[2152,4]]},"679":{"position":[[321,4],[879,5],[949,5]]},"680":{"position":[[687,4],[1043,4]]},"687":{"position":[[437,4],[778,4],[3352,5],[3406,4]]},"688":{"position":[[696,4],[2284,4]]},"692":{"position":[[297,4]]},"698":{"position":[[1626,4]]},"710":{"position":[[84,4],[186,4],[243,4],[607,4],[717,4],[1072,4],[1279,4],[1864,6]]},"719":{"position":[[89,4]]},"721":{"position":[[474,4]]},"725":{"position":[[1183,4]]}},"keywords":{}}],["env",{"_index":1569,"title":{"90":{"position":[[9,4]]},"95":{"position":[[5,4]]},"110":{"position":[[9,4]]},"111":{"position":[[5,4]]},"282":{"position":[[9,4]]},"287":{"position":[[5,4]]},"305":{"position":[[9,4]]},"306":{"position":[[5,4]]},"494":{"position":[[9,4]]},"499":{"position":[[5,4]]},"510":{"position":[[9,4]]},"511":{"position":[[5,4]]}},"content":{"95":{"position":[[378,3],[512,4]]},"98":{"position":[[585,3]]},"107":{"position":[[188,3]]},"110":{"position":[[13,3],[539,3]]},"111":{"position":[[26,4],[40,3]]},"126":{"position":[[303,4],[361,4],[1418,3],[1484,3]]},"129":{"position":[[212,4],[490,4],[537,4],[742,4]]},"148":{"position":[[136,3]]},"168":{"position":[[499,5]]},"178":{"position":[[1142,3],[1478,3]]},"198":{"position":[[154,4],[381,4],[608,4],[947,4],[1770,4],[2336,4],[2804,4],[2817,5]]},"206":{"position":[[315,3],[605,5],[1135,5],[1773,5],[2093,5],[3379,5]]},"268":{"position":[[949,4],[1149,4],[2394,5],[3010,4]]},"269":{"position":[[4219,3],[4515,5],[5045,5],[5683,5]]},"274":{"position":[[188,3]]},"277":{"position":[[303,4],[361,4],[1586,3],[1652,3]]},"280":{"position":[[212,4],[490,4],[537,4],[743,4]]},"287":{"position":[[378,3],[512,4]]},"290":{"position":[[585,3]]},"305":{"position":[[13,3],[539,3]]},"306":{"position":[[26,4],[40,3]]},"336":{"position":[[136,3]]},"346":{"position":[[118,3],[162,3]]},"348":{"position":[[499,5]]},"369":{"position":[[1142,3],[1478,3]]},"395":{"position":[[592,3],[2843,3],[3631,4],[3669,4]]},"408":{"position":[[949,4],[1149,4],[2394,5],[3010,4]]},"409":{"position":[[4219,3],[4515,5],[5045,5],[5683,5]]},"417":{"position":[[157,3]]},"419":{"position":[[6572,3]]},"426":{"position":[[315,3],[605,5],[1130,5],[1763,5],[2083,5],[3354,5]]},"434":{"position":[[154,4],[381,4],[603,4],[937,4],[1760,4],[2326,4],[2794,4],[2807,5]]},"440":{"position":[[1688,3],[2292,3],[4963,3]]},"441":{"position":[[1131,3],[3196,3],[4788,3]]},"477":{"position":[[946,3],[1717,3]]},"491":{"position":[[188,3]]},"499":{"position":[[378,3],[512,4]]},"502":{"position":[[585,3]]},"510":{"position":[[13,3],[539,3]]},"511":{"position":[[26,4],[40,3]]},"514":{"position":[[303,4],[361,4],[1418,3],[1484,3]]},"517":{"position":[[212,4],[490,4],[537,4],[743,4]]},"553":{"position":[[136,3]]},"564":{"position":[[499,5]]},"585":{"position":[[1142,3],[1478,3]]},"600":{"position":[[367,3],[1210,5]]},"610":{"position":[[242,3]]},"613":{"position":[[660,3]]},"616":{"position":[[273,3],[1025,3]]},"632":{"position":[[592,3],[2843,3],[3631,4],[3669,4]]},"645":{"position":[[949,4],[1149,4],[2394,5],[3010,4]]},"646":{"position":[[4219,3],[4515,5],[5045,5],[5683,5]]},"654":{"position":[[157,3]]},"656":{"position":[[6572,3]]},"668":{"position":[[315,3],[605,5],[1135,5],[1773,5],[2093,5],[3379,5]]},"681":{"position":[[154,4],[381,4],[608,4],[947,4],[1770,4],[2336,4],[2804,4],[2817,5]]},"687":{"position":[[1688,3],[2292,3],[4963,3]]},"688":{"position":[[1131,3],[3196,3],[4788,3]]},"699":{"position":[[946,3],[1717,3]]},"708":{"position":[[367,3],[1210,5]]},"718":{"position":[[242,3]]},"721":{"position":[[660,3]]},"724":{"position":[[273,3],[1025,3]]}},"keywords":{}}],["env"",{"_index":3160,"title":{},"content":{"395":{"position":[[3170,10]]},"477":{"position":[[1083,10]]},"632":{"position":[[3170,10]]},"699":{"position":[[1083,10]]}},"keywords":{}}],["env'",{"_index":3796,"title":{},"content":{"610":{"position":[[695,5]]},"718":{"position":[[695,5]]}},"keywords":{}}],["env().revert",{"_index":3807,"title":{},"content":{"611":{"position":[[724,14]]},"719":{"position":[[724,14]]}},"keywords":{}}],["env.advance_block_time(11",{"_index":3139,"title":{},"content":{"395":{"position":[[1444,25]]},"632":{"position":[[1444,25]]}},"keywords":{}}],["env.advance_block_time(60",{"_index":3281,"title":{},"content":{"417":{"position":[[802,25],[1455,25]]},"419":{"position":[[7217,25],[7870,25]]},"654":{"position":[[802,25],[1455,25]]},"656":{"position":[[7217,25],[7870,25]]}},"keywords":{}}],["env.advance_block_time(u64).test_env::token_balance(address",{"_index":2912,"title":{},"content":{"268":{"position":[[1603,60]]},"408":{"position":[[1603,60]]},"645":{"position":[[1603,60]]}},"keywords":{}}],["env.attached_valu",{"_index":3399,"title":{},"content":{"440":{"position":[[2386,21]]},"441":{"position":[[1187,21]]},"687":{"position":[[2386,21]]},"688":{"position":[[1187,21]]}},"keywords":{}}],["env.balance_of(&address).funct",{"_index":2913,"title":{},"content":{"268":{"position":[[1671,38]]},"408":{"position":[[1671,38]]},"645":{"position":[[1671,38]]}},"keywords":{}}],["env.cal",{"_index":1810,"title":{},"content":{"126":{"position":[[1544,13]]},"277":{"position":[[1712,13]]},"395":{"position":[[702,13]]},"440":{"position":[[1719,13],[2360,13]]},"441":{"position":[[1161,13],[3265,13]]},"514":{"position":[[1544,13]]},"610":{"position":[[289,13],[383,13]]},"632":{"position":[[702,13]]},"687":{"position":[[1719,13],[2360,13]]},"688":{"position":[[1161,13],[3265,13]]},"718":{"position":[[289,13],[383,13]]}},"keywords":{}}],["env.clon",{"_index":2383,"title":{},"content":{"198":{"position":[[296,12]]},"206":{"position":[[341,12]]},"269":{"position":[[4245,12]]},"409":{"position":[[4245,12]]},"426":{"position":[[341,12]]},"434":{"position":[[296,12]]},"646":{"position":[[4245,12]]},"668":{"position":[[341,12]]},"681":{"position":[[296,12]]}},"keywords":{}}],["env.emit_event(anotherlog",{"_index":3795,"title":{},"content":{"610":{"position":[[449,25]]},"718":{"position":[[449,25]]}},"keywords":{}}],["env.emit_event(log",{"_index":3792,"title":{},"content":{"610":{"position":[[260,18],[354,18]]},"718":{"position":[[260,18],[354,18]]}},"keywords":{}}],["env.emit_event(onticketissu",{"_index":3397,"title":{},"content":{"440":{"position":[[2148,28]]},"687":{"position":[[2148,28]]}},"keywords":{}}],["env.emit_event(onticketsel",{"_index":3415,"title":{},"content":{"440":{"position":[[3191,27]]},"687":{"position":[[3191,27]]}},"keywords":{}}],["env.emitted_ev",{"_index":2386,"title":{},"content":{"198":{"position":[[444,18],[776,18]]},"434":{"position":[[444,18],[771,18]]},"681":{"position":[[444,18],[776,18]]}},"keywords":{}}],["env.get_account(0",{"_index":2381,"title":{},"content":{"198":{"position":[[228,18],[309,19]]},"206":{"position":[[1216,19],[2155,20],[3482,20]]},"268":{"position":[[2456,20]]},"269":{"position":[[5126,19]]},"346":{"position":[[205,20]]},"408":{"position":[[2456,20]]},"409":{"position":[[5126,19]]},"426":{"position":[[1211,19],[2145,20],[3457,20]]},"434":{"position":[[228,18],[309,19]]},"477":{"position":[[1768,19]]},"645":{"position":[[2456,20]]},"646":{"position":[[5126,19]]},"668":{"position":[[1216,19],[2155,20],[3482,20]]},"681":{"position":[[228,18],[309,19]]},"699":{"position":[[1768,19]]}},"keywords":{}}],["env.get_account(1",{"_index":2390,"title":{},"content":{"198":{"position":[[647,19],[982,19]]},"206":{"position":[[1252,19],[1873,19],[2176,19],[3503,19]]},"268":{"position":[[2477,19]]},"269":{"position":[[5162,19],[5783,19]]},"346":{"position":[[226,20]]},"408":{"position":[[2477,19]]},"409":{"position":[[5162,19],[5783,19]]},"426":{"position":[[1247,19],[1863,19],[2166,19],[3478,19]]},"434":{"position":[[642,19],[972,19]]},"440":{"position":[[5359,19]]},"441":{"position":[[5328,19]]},"645":{"position":[[2477,19]]},"646":{"position":[[5162,19],[5783,19]]},"668":{"position":[[1252,19],[1873,19],[2176,19],[3503,19]]},"681":{"position":[[647,19],[982,19]]},"687":{"position":[[5359,19]]},"688":{"position":[[5328,19]]}},"keywords":{}}],["env.get_account(2",{"_index":2526,"title":{},"content":{"206":{"position":[[2196,20],[3523,20]]},"268":{"position":[[2497,20]]},"408":{"position":[[2497,20]]},"426":{"position":[[2186,20],[3498,20]]},"645":{"position":[[2497,20]]},"668":{"position":[[2196,20],[3523,20]]}},"keywords":{}}],["env.hash",{"_index":3905,"title":{},"content":{"616":{"position":[[1270,10]]},"724":{"position":[[1270,10]]}},"keywords":{}}],["env.hash(data",{"_index":3865,"title":{},"content":{"616":{"position":[[488,14]]},"724":{"position":[[488,14]]}},"keywords":{}}],["env.hash(word.to_bytes().unwrap_or_revert(&env",{"_index":3902,"title":{},"content":{"616":{"position":[[1054,53]]},"724":{"position":[[1054,53]]}},"keywords":{}}],["env.revert(error::emptyarray",{"_index":3839,"title":{},"content":{"613":{"position":[[735,30]]},"721":{"position":[[735,30]]}},"keywords":{}}],["env.revert(error::insufficientfund",{"_index":3409,"title":{},"content":{"440":{"position":[[2888,37]]},"687":{"position":[[2888,37]]}},"keywords":{}}],["env.revert(error::ticketnotavailableforsal",{"_index":3402,"title":{},"content":{"440":{"position":[[2525,45],[2770,45]]},"687":{"position":[[2525,45],[2770,45]]}},"keywords":{}}],["env.revert(error::unauthor",{"_index":3506,"title":{},"content":{"441":{"position":[[3350,32]]},"688":{"position":[[3350,32]]}},"keywords":{}}],["env.sampl",{"_index":1795,"title":{},"content":{"126":{"position":[[389,11]]},"277":{"position":[[389,11]]},"514":{"position":[[389,11]]}},"keywords":{}}],["env.set_caller(alic",{"_index":3067,"title":{},"content":{"346":{"position":[[247,22]]}},"keywords":{}}],["env.set_caller(buy",{"_index":3447,"title":{},"content":{"440":{"position":[[5379,22]]},"441":{"position":[[5348,22]]},"687":{"position":[[5379,22]]},"688":{"position":[[5348,22]]}},"keywords":{}}],["env.set_caller(cal",{"_index":3571,"title":{},"content":{"477":{"position":[[1788,23]]},"699":{"position":[[1788,23]]}},"keywords":{}}],["env.set_caller(env.get_account(0",{"_index":3286,"title":{},"content":{"417":{"position":[[1382,35]]},"419":{"position":[[7797,35]]},"654":{"position":[[1382,35]]},"656":{"position":[[7797,35]]}},"keywords":{}}],["env.set_caller(env.get_account(1",{"_index":3285,"title":{},"content":{"417":{"position":[[1203,35]]},"419":{"position":[[7618,35]]},"654":{"position":[[1203,35]]},"656":{"position":[[7618,35]]}},"keywords":{}}],["env.set_caller(own",{"_index":2391,"title":{},"content":{"198":{"position":[[667,22]]},"434":{"position":[[662,22]]},"681":{"position":[[667,22]]}},"keywords":{}}],["env.set_caller(spend",{"_index":2535,"title":{},"content":{"206":{"position":[[2694,24],[3571,24]]},"268":{"position":[[2545,24]]},"408":{"position":[[2545,24]]},"426":{"position":[[2679,24],[3546,24]]},"645":{"position":[[2545,24]]},"668":{"position":[[2694,24],[3571,24]]}},"keywords":{}}],["env.set_gas(100_000_000_000u64",{"_index":1820,"title":{},"content":{"126":{"position":[[2221,32]]},"277":{"position":[[2389,32]]},"514":{"position":[[2221,32]]}},"keywords":{}}],["env.set_gas(1_000_000_000u64",{"_index":3129,"title":{},"content":{"395":{"position":[[1070,30],[1187,30]]},"632":{"position":[[1070,30],[1187,30]]}},"keywords":{}}],["env.set_gas(1_500_000_000u64",{"_index":3142,"title":{},"content":{"395":{"position":[[1504,30]]},"632":{"position":[[1504,30]]}},"keywords":{}}],["env.set_gas(300_000_000_000u64",{"_index":3153,"title":{},"content":{"395":{"position":[[2059,32]]},"632":{"position":[[2059,32]]}},"keywords":{}}],["env.set_gas(3_000_000_000u64",{"_index":1834,"title":{},"content":{"126":{"position":[[3173,30]]},"277":{"position":[[3341,30]]},"514":{"position":[[3173,30]]}},"keywords":{}}],["env.set_gas(ga",{"_index":3572,"title":{},"content":{"477":{"position":[[1812,17]]},"699":{"position":[[1812,17]]}},"keywords":{}}],["env.transfer_tokens(&own",{"_index":3410,"title":{},"content":{"440":{"position":[[2959,31]]},"441":{"position":[[3500,31]]},"687":{"position":[[2959,31]]},"688":{"position":[[3500,31]]}},"keywords":{}}],["env.transfer_tokens(bob",{"_index":3068,"title":{},"content":{"346":{"position":[[283,24]]}},"keywords":{}}],["env::commit(&product",{"_index":257,"title":{},"content":{"8":{"position":[[644,26]]}},"keywords":{}}],["env::commit(&result",{"_index":826,"title":{},"content":{"32":{"position":[[455,25]]}},"keywords":{}}],["env::read",{"_index":244,"title":{},"content":{"8":{"position":[[308,12],[374,12]]},"32":{"position":[[398,12]]}},"keywords":{}}],["enviro",{"_index":1867,"title":{"129":{"position":[[9,12]]}},"content":{},"keywords":{}}],["environ",{"_index":656,"title":{"280":{"position":[[9,13]]},"517":{"position":[[9,13]]}},"content":{"22":{"position":[[668,12]]},"65":{"position":[[201,11]]},"95":{"position":[[5,11]]},"126":{"position":[[269,11],[1401,12]]},"129":{"position":[[32,12]]},"240":{"position":[[201,11]]},"267":{"position":[[1909,12]]},"277":{"position":[[269,11],[1569,12]]},"280":{"position":[[32,12]]},"287":{"position":[[5,11]]},"346":{"position":[[33,11]]},"395":{"position":[[575,12]]},"407":{"position":[[1909,12]]},"465":{"position":[[201,11]]},"499":{"position":[[5,11]]},"514":{"position":[[269,11],[1401,12]]},"517":{"position":[[32,12]]},"632":{"position":[[575,12]]},"644":{"position":[[1909,12]]}},"keywords":{}}],["environment,assert",{"_index":2311,"title":{},"content":{"193":{"position":[[239,22]]},"429":{"position":[[239,22]]},"676":{"position":[[239,22]]}},"keywords":{}}],["environment,interact",{"_index":2310,"title":{},"content":{"193":{"position":[[200,24]]},"429":{"position":[[200,24]]},"676":{"position":[[200,24]]}},"keywords":{}}],["eq",{"_index":965,"title":{},"content":{"39":{"position":[[1972,3]]},"184":{"position":[[299,3],[423,3],[547,3]]},"196":{"position":[[440,4],[1538,2]]},"204":{"position":[[875,3]]},"205":{"position":[[2083,3]]},"209":{"position":[[561,3],[694,3]]},"212":{"position":[[460,3],[583,3]]},"219":{"position":[[410,3],[492,3]]},"267":{"position":[[1564,3]]},"269":{"position":[[3367,3],[3511,3]]},"391":{"position":[[460,3],[583,3]]},"407":{"position":[[1564,3]]},"409":{"position":[[3367,3],[3511,3]]},"644":{"position":[[1564,3]]},"646":{"position":[[3367,3],[3511,3]]},"661":{"position":[[460,3],[583,3]]}},"keywords":{}}],["equal",{"_index":1296,"title":{},"content":{"52":{"position":[[6478,5]]}},"keywords":{}}],["equip",{"_index":1613,"title":{},"content":{"94":{"position":[[7,6]]},"286":{"position":[[7,6]]},"498":{"position":[[7,6]]}},"keywords":{}}],["equival",{"_index":3675,"title":{},"content":{"599":{"position":[[641,10]]},"606":{"position":[[558,10]]},"612":{"position":[[1845,10]]},"614":{"position":[[338,10]]},"617":{"position":[[1038,10]]},"707":{"position":[[641,10]]},"714":{"position":[[558,10]]},"720":{"position":[[1845,10]]},"722":{"position":[[338,10]]},"725":{"position":[[1038,10]]}},"keywords":{}}],["erc",{"_index":2303,"title":{"191":{"position":[[0,3]]},"420":{"position":[[0,3]]},"662":{"position":[[0,3]]}},"content":{"204":{"position":[[1074,3]]},"207":{"position":[[73,3]]},"424":{"position":[[1025,3]]},"427":{"position":[[73,3]]},"666":{"position":[[1025,3]]},"669":{"position":[[73,3]]}},"keywords":{}}],["erc1155",{"_index":1675,"title":{"101":{"position":[[16,8]]},"293":{"position":[[16,8]]},"505":{"position":[[16,8]]}},"content":{"101":{"position":[[749,7]]},"188":{"position":[[446,8],[493,7]]},"293":{"position":[[749,7]]},"365":{"position":[[803,8],[850,7]]},"505":{"position":[[749,7]]},"581":{"position":[[803,8],[850,7]]}},"keywords":{}}],["erc1155_token",{"_index":1676,"title":{},"content":{"101":{"position":[[121,13]]},"293":{"position":[[121,13]]},"505":{"position":[[121,13]]}},"keywords":{}}],["erc1155bas",{"_index":2289,"title":{},"content":{"188":{"position":[[459,11],[583,11]]},"365":{"position":[[816,11],[940,11]]},"581":{"position":[[816,11],[940,11]]}},"keywords":{}}],["erc1155token",{"_index":2290,"title":{},"content":{"188":{"position":[[548,12],[683,12]]},"365":{"position":[[905,12],[1040,12]]},"581":{"position":[[905,12],[1040,12]]}},"keywords":{}}],["erc20",{"_index":396,"title":{"14":{"position":[[14,5]]},"17":{"position":[[0,5]]}},"content":{"15":{"position":[[234,5]]},"17":{"position":[[36,5],[221,5],[1655,5],[1751,6],[1812,5],[1966,5],[2214,5]]},"43":{"position":[[70,5]]},"54":{"position":[[39,5],[56,5],[94,5]]},"115":{"position":[[267,6],[1409,5],[2071,6],[3004,6]]},"188":{"position":[[0,6],[11,5],[39,5]]},"200":{"position":[[41,5]]},"203":{"position":[[144,5]]},"204":{"position":[[55,5],[611,5]]},"205":{"position":[[274,5],[1187,5]]},"206":{"position":[[611,6],[1145,6],[1783,6],[2103,6],[3389,6]]},"207":{"position":[[32,6]]},"245":{"position":[[50,5]]},"246":{"position":[[77,5],[278,6]]},"247":{"position":[[1768,5]]},"258":{"position":[[257,6],[1355,5],[2017,6],[2930,6]]},"267":{"position":[[945,5],[1091,5]]},"268":{"position":[[1337,5],[2404,6],[3047,5]]},"269":{"position":[[312,5],[543,5],[2482,5],[4521,6],[5055,6],[5693,6]]},"365":{"position":[[127,5],[357,6],[368,5],[396,5]]},"383":{"position":[[720,5]]},"384":{"position":[[325,5],[556,5],[2509,5]]},"407":{"position":[[945,5],[1091,5]]},"408":{"position":[[1337,5],[2404,6],[3047,5]]},"409":{"position":[[312,5],[543,5],[2482,5],[4521,6],[5055,6],[5693,6]]},"423":{"position":[[144,5]]},"424":{"position":[[30,5],[586,5]]},"425":{"position":[[249,5],[1162,5]]},"426":{"position":[[611,6],[1140,6],[1773,6],[2093,6],[3364,6]]},"427":{"position":[[32,6]]},"436":{"position":[[41,5]]},"444":{"position":[[50,5]]},"445":{"position":[[77,5],[278,6]]},"446":{"position":[[1768,5]]},"481":{"position":[[257,6],[1355,5],[2017,6],[2930,6]]},"581":{"position":[[127,5],[357,6],[368,5],[396,5]]},"604":{"position":[[133,5]]},"618":{"position":[[604,5]]},"625":{"position":[[720,5]]},"626":{"position":[[325,5],[556,5],[2509,5]]},"644":{"position":[[945,5],[1091,5]]},"645":{"position":[[1337,5],[2404,6],[3047,5]]},"646":{"position":[[312,5],[543,5],[2482,5],[4521,6],[5055,6],[5693,6]]},"665":{"position":[[144,5]]},"666":{"position":[[30,5],[586,5]]},"667":{"position":[[249,5],[1162,5]]},"668":{"position":[[611,6],[1145,6],[1783,6],[2103,6],[3389,6]]},"669":{"position":[[32,6]]},"671":{"position":[[50,5]]},"672":{"position":[[77,5],[278,6]]},"673":{"position":[[1768,5]]},"683":{"position":[[41,5]]},"712":{"position":[[133,5]]},"726":{"position":[[604,5]]}},"keywords":{}}],["erc20(name_",{"_index":1119,"title":{},"content":{"43":{"position":[[312,12]]}},"keywords":{}}],["erc20.address",{"_index":2508,"title":{},"content":{"206":{"position":[[963,16],[1625,16],[2563,16],[3023,16],[3146,16]]},"268":{"position":[[3129,16],[3252,16]]},"269":{"position":[[4873,16],[5535,16]]},"408":{"position":[[3129,16],[3252,16]]},"409":{"position":[[4873,16],[5535,16]]},"645":{"position":[[3129,16],[3252,16]]},"646":{"position":[[4873,16],[5535,16]]},"668":{"position":[[963,16],[1625,16],[2563,16],[3023,16],[3146,16]]}},"keywords":{}}],["erc20.approve(&spend",{"_index":2531,"title":{},"content":{"206":{"position":[[2386,27]]},"426":{"position":[[2376,27]]},"668":{"position":[[2386,27]]}},"keywords":{}}],["erc20.balance_of(&own",{"_index":2540,"title":{},"content":{"206":{"position":[[2855,29]]},"426":{"position":[[2840,29]]},"668":{"position":[[2855,29]]}},"keywords":{}}],["erc20.balance_of(&send",{"_index":2516,"title":{},"content":{"206":{"position":[[1396,30]]},"269":{"position":[[5306,30]]},"409":{"position":[[5306,30]]},"426":{"position":[[1391,30]]},"646":{"position":[[5306,30]]},"668":{"position":[[1396,30]]}},"keywords":{}}],["erc20.r",{"_index":2438,"title":{},"content":{"203":{"position":[[0,8]]},"204":{"position":[[0,8]]},"205":{"position":[[219,8]]},"206":{"position":[[0,8]]},"423":{"position":[[0,8]]},"424":{"position":[[0,8]]},"425":{"position":[[219,8]]},"426":{"position":[[0,8]]},"665":{"position":[[0,8]]},"666":{"position":[[0,8]]},"667":{"position":[[219,8]]},"668":{"position":[[0,8]]}},"keywords":{}}],["erc20.transfer(&recipi",{"_index":2513,"title":{},"content":{"206":{"position":[[1299,30]]},"269":{"position":[[5209,30]]},"409":{"position":[[5209,30]]},"426":{"position":[[1294,30]]},"646":{"position":[[5209,30]]},"668":{"position":[[1299,30]]}},"keywords":{}}],["erc20.transfer_from(&own",{"_index":2536,"title":{},"content":{"206":{"position":[[2719,31]]},"426":{"position":[[2704,31]]},"668":{"position":[[2719,31]]}},"keywords":{}}],["erc20.try_transfer_from(&own",{"_index":2544,"title":{},"content":{"206":{"position":[[3632,35]]},"426":{"position":[[3607,35]]},"668":{"position":[[3632,35]]}},"keywords":{}}],["erc20.try_transfer_from(own",{"_index":2923,"title":{},"content":{"268":{"position":[[2582,30]]},"408":{"position":[[2582,30]]},"645":{"position":[[2582,30]]}},"keywords":{}}],["erc20_on_livenet",{"_index":1847,"title":{},"content":{"127":{"position":[[106,16]]},"129":{"position":[[600,16]]},"278":{"position":[[106,16]]},"280":{"position":[[600,16]]},"515":{"position":[[106,16]]},"517":{"position":[[600,16]]}},"keywords":{}}],["erc20_on_livenet.r",{"_index":1808,"title":{},"content":{"126":{"position":[[1273,19]]},"277":{"position":[[1441,19]]},"514":{"position":[[1273,19]]}},"keywords":{}}],["erc20burn",{"_index":1113,"title":{},"content":{"43":{"position":[[195,14]]}},"keywords":{}}],["erc20cap",{"_index":1112,"title":{},"content":{"43":{"position":[[182,12],[553,12]]}},"keywords":{}}],["erc20capped(cap_",{"_index":1120,"title":{},"content":{"43":{"position":[[334,17]]}},"keywords":{}}],["erc20deployer::load(env",{"_index":1830,"title":{},"content":{"126":{"position":[[2918,24]]},"277":{"position":[[3086,24]]},"514":{"position":[[2918,24]]}},"keywords":{}}],["erc20hostref",{"_index":1958,"title":{},"content":{"142":{"position":[[299,12]]},"206":{"position":[[295,13]]},"269":{"position":[[3911,13],[4199,13]]},"327":{"position":[[299,12]]},"409":{"position":[[3911,13],[4199,13]]},"426":{"position":[[295,13]]},"536":{"position":[[299,12]]},"646":{"position":[[3911,13],[4199,13]]},"668":{"position":[[295,13]]}},"keywords":{}}],["erc20hostref::deploy",{"_index":2496,"title":{},"content":{"206":{"position":[[354,21]]},"269":{"position":[[4258,21]]},"409":{"position":[[4258,21]]},"426":{"position":[[354,21]]},"646":{"position":[[4258,21]]},"668":{"position":[[354,21]]}},"keywords":{}}],["erc20hostref::deploy(&env",{"_index":2907,"title":{},"content":{"268":{"position":[[1345,30],[3055,30]]},"408":{"position":[[1345,30],[3055,30]]},"645":{"position":[[1345,30],[3055,30]]}},"keywords":{}}],["erc20hostref::deploy(env",{"_index":1824,"title":{},"content":{"126":{"position":[[2436,25]]},"277":{"position":[[2604,25]]},"514":{"position":[[2436,25]]}},"keywords":{}}],["erc20initarg",{"_index":1822,"title":{},"content":{"126":{"position":[[2340,13]]},"206":{"position":[[386,13]]},"268":{"position":[[1092,15],[1198,13]]},"269":{"position":[[3925,13],[4290,13]]},"277":{"position":[[2508,13]]},"408":{"position":[[1092,15],[1198,13]]},"409":{"position":[[3925,13],[4290,13]]},"426":{"position":[[386,13]]},"514":{"position":[[2340,13]]},"645":{"position":[[1092,15],[1198,13]]},"646":{"position":[[3925,13],[4290,13]]},"668":{"position":[[386,13]]}},"keywords":{}}],["erc721",{"_index":1655,"title":{"100":{"position":[[16,7]]},"292":{"position":[[16,7]]},"504":{"position":[[16,7]]}},"content":{"100":{"position":[[27,6],[1048,6]]},"188":{"position":[[55,7],[100,6]]},"292":{"position":[[27,6],[1048,6]]},"365":{"position":[[307,6],[412,7],[457,6]]},"504":{"position":[[27,6],[1048,6]]},"581":{"position":[[307,6],[412,7],[457,6]]}},"keywords":{}}],["erc721_token",{"_index":1659,"title":{},"content":{"100":{"position":[[189,12]]},"292":{"position":[[189,12]]},"504":{"position":[[189,12]]}},"keywords":{}}],["erc721_token.wasm",{"_index":1660,"title":{},"content":{"100":{"position":[[219,17]]},"292":{"position":[[219,17]]},"504":{"position":[[219,17]]}},"keywords":{}}],["erc721bas",{"_index":2283,"title":{},"content":{"188":{"position":[[67,10],[188,10]]},"365":{"position":[[424,10],[545,10]]},"581":{"position":[[424,10],[545,10]]}},"keywords":{}}],["erc721metadata",{"_index":2285,"title":{},"content":{"188":{"position":[[225,14],[410,14]]},"365":{"position":[[582,14],[767,14]]},"581":{"position":[[582,14],[767,14]]}},"keywords":{}}],["erc721receiv",{"_index":2286,"title":{},"content":{"188":{"position":[[268,14]]},"365":{"position":[[625,14]]},"581":{"position":[[625,14]]}},"keywords":{}}],["erc721token",{"_index":2284,"title":{},"content":{"188":{"position":[[154,11],[397,12]]},"267":{"position":[[3347,11]]},"365":{"position":[[511,11],[754,12]]},"407":{"position":[[3347,11]]},"581":{"position":[[511,11],[754,12]]},"644":{"position":[[3347,11]]}},"keywords":{}}],["err",{"_index":3924,"title":{},"content":{"617":{"position":[[1235,6]]},"725":{"position":[[1235,6]]}},"keywords":{}}],["err(err",{"_index":359,"title":{},"content":{"10":{"position":[[1388,8]]}},"keywords":{}}],["err(error::insufficientallowance.into",{"_index":2545,"title":{},"content":{"206":{"position":[[3698,40]]},"268":{"position":[[2633,40]]},"408":{"position":[[2633,40]]},"426":{"position":[[3673,40]]},"645":{"position":[[2633,40]]},"668":{"position":[[3698,40]]}},"keywords":{}}],["err(error::insufficientfunds.into",{"_index":3450,"title":{},"content":{"440":{"position":[[5472,36]]},"441":{"position":[[5417,36]]},"687":{"position":[[5472,36]]},"688":{"position":[[5417,36]]}},"keywords":{}}],["err(error::notanowner.into",{"_index":1915,"title":{},"content":{"138":{"position":[[756,29]]},"318":{"position":[[748,29]]},"544":{"position":[[748,29]]}},"keywords":{}}],["err(error::notowner.into",{"_index":2396,"title":{},"content":{"198":{"position":[[1102,27]]},"434":{"position":[[1092,27]]},"681":{"position":[[1102,27]]}},"keywords":{}}],["err(error::ticketnotavailableforsale.into",{"_index":3453,"title":{},"content":{"440":{"position":[[5744,44]]},"441":{"position":[[5613,44]]},"687":{"position":[[5744,44]]},"688":{"position":[[5613,44]]}},"keywords":{}}],["err(reason",{"_index":3915,"title":{},"content":{"617":{"position":[[531,11]]},"725":{"position":[[531,11]]}},"keywords":{}}],["err.to_str",{"_index":362,"title":{},"content":{"10":{"position":[[1434,16]]}},"keywords":{}}],["error",{"_index":460,"title":{"137":{"position":[[0,6]]},"138":{"position":[[8,7]]},"184":{"position":[[11,7]]},"219":{"position":[[11,6]]},"317":{"position":[[0,6]]},"318":{"position":[[8,7]]},"375":{"position":[[11,7]]},"452":{"position":[[11,6]]},"543":{"position":[[0,6]]},"544":{"position":[[8,7]]},"591":{"position":[[11,7]]},"611":{"position":[[0,5]]},"692":{"position":[[11,6]]},"719":{"position":[[0,5]]}},"content":{"17":{"position":[[314,7],[1560,5],[4000,5]]},"39":{"position":[[2132,7],[2522,5],[2567,6]]},"95":{"position":[[432,5]]},"110":{"position":[[594,6]]},"111":{"position":[[333,7]]},"138":{"position":[[74,5],[1098,5],[1249,5]]},"147":{"position":[[897,6]]},"169":{"position":[[35,7]]},"184":{"position":[[1013,5],[1086,6]]},"193":{"position":[[278,6]]},"196":{"position":[[365,5],[886,5],[935,5]]},"197":{"position":[[693,5],[1038,5],[1444,5]]},"198":{"position":[[3521,6],[3866,6],[3888,6],[3949,5]]},"205":{"position":[[2207,5]]},"206":{"position":[[1959,5]]},"219":{"position":[[15,6],[323,5]]},"267":{"position":[[1172,6],[1323,5],[2775,6]]},"269":{"position":[[3626,6],[3686,5],[5869,5]]},"270":{"position":[[429,6]]},"287":{"position":[[432,5]]},"305":{"position":[[594,6]]},"306":{"position":[[333,7]]},"318":{"position":[[74,5],[1090,5],[1241,5]]},"321":{"position":[[302,6],[377,6],[822,5],[908,6],[1827,6]]},"324":{"position":[[729,5],[775,5]]},"335":{"position":[[905,6]]},"349":{"position":[[35,7]]},"375":{"position":[[910,5],[983,6]]},"383":{"position":[[104,7],[451,6],[556,5],[692,6],[701,7],[769,5]]},"384":{"position":[[297,6],[306,7],[3612,6],[3650,5]]},"385":{"position":[[429,6]]},"407":{"position":[[1172,6],[1323,5],[2775,6]]},"409":{"position":[[3626,6],[3686,5],[5869,5]]},"410":{"position":[[429,6]]},"415":{"position":[[272,6]]},"419":{"position":[[291,6]]},"425":{"position":[[2157,5]]},"426":{"position":[[1949,5]]},"429":{"position":[[278,6]]},"432":{"position":[[326,5],[824,5],[873,5]]},"433":{"position":[[692,5],[1037,5],[1443,5]]},"434":{"position":[[3503,6],[3848,6],[3870,6],[3931,5]]},"440":{"position":[[783,5],[956,6],[965,5],[3680,6]]},"441":{"position":[[701,5],[762,7],[1614,6],[2289,5],[4392,6]]},"442":{"position":[[171,7]]},"452":{"position":[[15,6],[302,5]]},"476":{"position":[[209,6],[1549,6],[1631,5]]},"499":{"position":[[432,5]]},"510":{"position":[[594,6]]},"511":{"position":[[333,7]]},"539":{"position":[[302,6],[377,6],[822,5],[908,6],[1827,6]]},"542":{"position":[[729,5],[775,5]]},"544":{"position":[[74,5],[1090,5],[1241,5]]},"552":{"position":[[905,6]]},"565":{"position":[[35,7]]},"591":{"position":[[910,5],[983,6]]},"599":{"position":[[607,6]]},"606":{"position":[[1132,6]]},"611":{"position":[[185,6],[213,5],[588,7],[632,7],[771,5],[852,5],[918,5],[979,6]]},"613":{"position":[[479,5]]},"617":{"position":[[848,6],[1136,6],[1374,5]]},"618":{"position":[[157,5]]},"625":{"position":[[104,7],[451,6],[556,5],[692,6],[701,7],[769,5]]},"626":{"position":[[297,6],[306,7],[3612,6],[3650,5]]},"627":{"position":[[429,6]]},"644":{"position":[[1172,6],[1323,5],[2775,6]]},"646":{"position":[[3626,6],[3686,5],[5869,5]]},"647":{"position":[[429,6]]},"652":{"position":[[272,6]]},"656":{"position":[[291,6]]},"667":{"position":[[2157,5]]},"668":{"position":[[1959,5]]},"676":{"position":[[278,6]]},"679":{"position":[[326,5],[824,5],[873,5]]},"680":{"position":[[692,5],[1037,5],[1443,5]]},"681":{"position":[[3521,6],[3866,6],[3888,6],[3949,5]]},"687":{"position":[[783,5],[956,6],[965,5],[3680,6]]},"688":{"position":[[701,5],[762,7],[1614,6],[2289,5],[4392,6]]},"689":{"position":[[171,7]]},"692":{"position":[[15,6],[302,5]]},"698":{"position":[[209,6],[1549,6],[1631,5]]},"707":{"position":[[607,6]]},"714":{"position":[[1132,6]]},"719":{"position":[[185,6],[213,5],[588,7],[632,7],[771,5],[852,5],[918,5],[979,6]]},"721":{"position":[[479,5]]},"725":{"position":[[848,6],[1136,6],[1374,5]]},"726":{"position":[[157,5]]}},"keywords":{}}],["error::into",{"_index":2426,"title":{},"content":{"198":{"position":[[3906,13]]},"434":{"position":[[3888,13]]},"681":{"position":[[3906,13]]}},"keywords":{}}],["error::invalidticketid",{"_index":3391,"title":{},"content":{"440":{"position":[[1932,23]]},"687":{"position":[[1932,23]]}},"keywords":{}}],["error::missingoper",{"_index":3512,"title":{},"content":{"441":{"position":[[3761,23]]},"688":{"position":[[3761,23]]}},"keywords":{}}],["error::missingrole.l56",{"_index":2264,"title":{},"content":{"185":{"position":[[3326,22]]},"376":{"position":[[3310,22]]},"592":{"position":[[3310,22]]}},"keywords":{}}],["error::notown",{"_index":2425,"title":{},"content":{"198":{"position":[[3850,15]]},"434":{"position":[[3832,15]]},"681":{"position":[[3850,15]]}},"keywords":{}}],["error::ownerisalreadyiniti",{"_index":2341,"title":{},"content":{"196":{"position":[[1179,32]]},"432":{"position":[[1122,32]]},"679":{"position":[[1122,32]]}},"keywords":{}}],["error::revert(some(condit",{"_index":987,"title":{},"content":{"39":{"position":[[2536,30]]}},"keywords":{}}],["error::ticketdoesnotexist",{"_index":3405,"title":{},"content":{"440":{"position":[[2658,27]]},"687":{"position":[[2658,27]]}},"keywords":{}}],["error::unknownticketoffic",{"_index":3487,"title":{},"content":{"441":{"position":[[1290,28]]},"688":{"position":[[1290,28]]}},"keywords":{}}],["error::unpausedrequired.into",{"_index":2744,"title":{},"content":{"223":{"position":[[1113,30]]},"456":{"position":[[1113,30]]},"696":{"position":[[1113,30]]}},"keywords":{}}],["errors.r",{"_index":2178,"title":{},"content":{"183":{"position":[[88,9]]},"184":{"position":[[952,9]]},"374":{"position":[[88,9]]},"375":{"position":[[871,9]]},"590":{"position":[[88,9]]},"591":{"position":[[871,9]]}},"keywords":{}}],["errors::error",{"_index":2943,"title":{},"content":{"269":{"position":[[3866,14]]},"409":{"position":[[3866,14]]},"646":{"position":[[3866,14]]}},"keywords":{}}],["especi",{"_index":1954,"title":{},"content":{"142":{"position":[[99,10]]},"162":{"position":[[2375,10]]},"327":{"position":[[99,10]]},"351":{"position":[[2397,10]]},"536":{"position":[[99,10]]},"567":{"position":[[2397,10]]},"594":{"position":[[616,10]]},"612":{"position":[[1763,10]]},"702":{"position":[[616,10]]},"720":{"position":[[1763,10]]}},"keywords":{}}],["essenti",{"_index":957,"title":{},"content":{"39":{"position":[[1691,9]]},"202":{"position":[[243,11]]},"422":{"position":[[243,11]]},"664":{"position":[[243,11]]}},"keywords":{}}],["establish",{"_index":941,"title":{},"content":{"39":{"position":[[1173,9]]},"184":{"position":[[121,9]]},"375":{"position":[[121,9]]},"591":{"position":[[121,9]]},"612":{"position":[[64,9],[2114,9]]},"720":{"position":[[64,9],[2114,9]]}},"keywords":{}}],["etc",{"_index":969,"title":{},"content":{"39":{"position":[[2174,4]]},"111":{"position":[[368,4]]},"121":{"position":[[75,5]]},"302":{"position":[[75,5]]},"306":{"position":[[368,4]]},"396":{"position":[[412,5]]},"511":{"position":[[368,4]]},"523":{"position":[[75,5]]},"633":{"position":[[412,5]]}},"keywords":{}}],["ether",{"_index":3786,"title":{},"content":{"608":{"position":[[819,6]]},"613":{"position":[[1333,6]]},"614":{"position":[[34,5],[133,5],[244,5]]},"716":{"position":[[819,6]]},"721":{"position":[[1333,6]]},"722":{"position":[[34,5],[133,5],[244,5]]}},"keywords":{}}],["ethereum",{"_index":170,"title":{},"content":{"5":{"position":[[87,8]]},"91":{"position":[[56,9]]},"283":{"position":[[56,9]]},"495":{"position":[[56,9]]},"595":{"position":[[78,8]]},"703":{"position":[[78,8]]}},"keywords":{}}],["even",{"_index":413,"title":{},"content":{"15":{"position":[[330,4]]},"31":{"position":[[75,4]]},"91":{"position":[[413,5]]},"128":{"position":[[68,4]]},"129":{"position":[[158,4]]},"147":{"position":[[696,4]]},"162":{"position":[[521,4]]},"197":{"position":[[1683,4]]},"279":{"position":[[68,4]]},"280":{"position":[[158,4]]},"283":{"position":[[413,5]]},"335":{"position":[[704,4]]},"351":{"position":[[558,4]]},"416":{"position":[[4833,4]]},"417":{"position":[[1340,7]]},"419":{"position":[[7755,7]]},"433":{"position":[[1682,4]]},"440":{"position":[[5954,4]]},"477":{"position":[[4034,4]]},"495":{"position":[[413,5]]},"516":{"position":[[68,4]]},"517":{"position":[[158,4]]},"552":{"position":[[704,4]]},"567":{"position":[[558,4]]},"653":{"position":[[4833,4]]},"654":{"position":[[1340,7]]},"656":{"position":[[7755,7]]},"680":{"position":[[1682,4]]},"687":{"position":[[5954,4]]},"699":{"position":[[4034,4]]}},"keywords":{}}],["event",{"_index":958,"title":{"91":{"position":[[0,7]]},"156":{"position":[[0,6]]},"157":{"position":[[8,7]]},"184":{"position":[[0,6]]},"219":{"position":[[0,6]]},"283":{"position":[[0,7]]},"329":{"position":[[0,6]]},"330":{"position":[[8,7]]},"375":{"position":[[0,6]]},"452":{"position":[[0,6]]},"495":{"position":[[0,7]]},"546":{"position":[[0,6]]},"547":{"position":[[8,7]]},"591":{"position":[[0,6]]},"610":{"position":[[0,6]]},"692":{"position":[[0,6]]},"718":{"position":[[0,6]]}},"content":{"39":{"position":[[1772,6],[1779,5]]},"51":{"position":[[1112,6]]},"53":{"position":[[255,7],[1306,5]]},"54":{"position":[[250,7]]},"71":{"position":[[380,5]]},"91":{"position":[[3,5],[120,6],[156,6],[247,5],[378,7],[470,5],[529,5],[566,6],[609,6],[686,6],[775,5],[821,5],[920,6]]},"110":{"position":[[605,7]]},"121":{"position":[[67,7]]},"139":{"position":[[35,6]]},"157":{"position":[[73,6],[555,6],[694,6],[798,5]]},"168":{"position":[[2120,6],[2164,5]]},"184":{"position":[[145,6],[231,7],[718,6],[844,5]]},"185":{"position":[[3622,7]]},"193":{"position":[[270,7]]},"195":{"position":[[377,6],[447,6]]},"196":{"position":[[1432,5]]},"198":{"position":[[2730,5],[2940,6],[2968,5]]},"201":{"position":[[153,5]]},"206":{"position":[[917,5],[1579,5],[3807,6]]},"219":{"position":[[111,6],[174,6],[274,6]]},"222":{"position":[[567,6]]},"235":{"position":[[380,5]]},"267":{"position":[[1478,6],[1708,5],[2897,6]]},"268":{"position":[[2695,8],[2805,7],[2858,6],[2922,7]]},"269":{"position":[[3272,6],[3343,7],[4827,5],[5489,5]]},"283":{"position":[[3,5],[120,6],[156,6],[247,5],[378,7],[470,5],[529,5],[566,6],[609,6],[686,6],[775,5],[821,5],[918,6]]},"302":{"position":[[67,7]]},"305":{"position":[[605,7]]},"319":{"position":[[35,6]]},"321":{"position":[[148,6],[291,6],[388,6],[704,6],[784,6],[1108,5],[1326,5],[2021,6],[2157,6]]},"324":{"position":[[1227,6],[1267,5]]},"330":{"position":[[73,6],[541,6],[675,6],[774,5]]},"348":{"position":[[2130,6],[2174,5]]},"375":{"position":[[145,6],[637,6],[763,5]]},"376":{"position":[[3606,7]]},"383":{"position":[[93,6],[672,6],[924,6]]},"384":{"position":[[3313,6]]},"407":{"position":[[1478,6],[1708,5],[2897,6]]},"408":{"position":[[2695,8],[2805,7],[2858,6],[2922,7]]},"409":{"position":[[3272,6],[3343,7],[4827,5],[5489,5]]},"421":{"position":[[153,5]]},"426":{"position":[[917,5],[1574,5],[3782,6]]},"429":{"position":[[270,7]]},"431":{"position":[[377,6],[447,6]]},"432":{"position":[[1374,5]]},"434":{"position":[[2720,5],[2922,6],[2950,5]]},"438":{"position":[[152,5]]},"440":{"position":[[916,6],[2142,5],[3601,6],[3691,6],[4559,6]]},"441":{"position":[[3095,5]]},"442":{"position":[[163,7]]},"452":{"position":[[111,6],[174,6]]},"455":{"position":[[567,6]]},"471":{"position":[[380,5]]},"476":{"position":[[216,6],[975,5],[1717,6],[1816,6]]},"495":{"position":[[3,5],[120,6],[156,6],[247,5],[378,7],[470,5],[529,5],[566,6],[609,6],[686,6],[775,5],[821,5],[918,6]]},"510":{"position":[[605,7]]},"523":{"position":[[67,7]]},"539":{"position":[[148,6],[291,6],[388,6],[704,6],[784,6],[1108,5],[1326,5],[2021,6],[2157,6]]},"542":{"position":[[1227,6],[1267,5]]},"545":{"position":[[35,6]]},"547":{"position":[[73,6],[555,6],[694,6],[798,5]]},"564":{"position":[[2120,6],[2164,5]]},"591":{"position":[[145,6],[637,6],[763,5]]},"592":{"position":[[3606,7]]},"604":{"position":[[508,6]]},"610":{"position":[[177,6],[205,5],[494,6],[569,5],[680,6],[736,5],[770,6],[881,6]]},"625":{"position":[[93,6],[672,6],[924,6]]},"626":{"position":[[3313,6]]},"644":{"position":[[1478,6],[1708,5],[2897,6]]},"645":{"position":[[2695,8],[2805,7],[2858,6],[2922,7]]},"646":{"position":[[3272,6],[3343,7],[4827,5],[5489,5]]},"663":{"position":[[153,5]]},"668":{"position":[[917,5],[1579,5],[3807,6]]},"676":{"position":[[270,7]]},"678":{"position":[[377,6],[447,6]]},"679":{"position":[[1374,5]]},"681":{"position":[[2730,5],[2940,6],[2968,5]]},"685":{"position":[[152,5]]},"687":{"position":[[916,6],[2142,5],[3601,6],[3691,6],[4559,6]]},"688":{"position":[[3095,5]]},"689":{"position":[[163,7]]},"692":{"position":[[111,6],[174,6]]},"695":{"position":[[567,6]]},"698":{"position":[[216,6],[975,5],[1717,6],[1816,6]]},"712":{"position":[[508,6]]},"718":{"position":[[177,6],[205,5],[494,6],[569,5],[680,6],[736,5],[770,6],[881,6]]}},"keywords":{}}],["event"",{"_index":3018,"title":{},"content":{"323":{"position":[[1791,12],[2769,12]]},"541":{"position":[[1791,12],[2769,12]]}},"keywords":{}}],["event.l103",{"_index":3426,"title":{},"content":{"440":{"position":[[4241,10]]},"687":{"position":[[4241,10]]}},"keywords":{}}],["event.l66",{"_index":2267,"title":{},"content":{"185":{"position":[[3454,9]]},"376":{"position":[[3438,9]]},"592":{"position":[[3438,9]]}},"keywords":{}}],["event.th",{"_index":3056,"title":{},"content":{"324":{"position":[[1336,9]]},"542":{"position":[[1336,9]]}},"keywords":{}}],["event.unauthor",{"_index":2175,"title":{},"content":{"182":{"position":[[345,18]]},"373":{"position":[[345,18]]},"589":{"position":[[345,18]]}},"keywords":{}}],["event::odraev",{"_index":1194,"title":{},"content":{"51":{"position":[[389,18]]}},"keywords":{}}],["event_nam",{"_index":3357,"title":{},"content":{"440":{"position":[[519,11],[639,11],[1649,11],[2053,11],[2190,11]]},"441":{"position":[[2861,11]]},"687":{"position":[[519,11],[639,11],[1649,11],[2053,11],[2190,11]]},"688":{"position":[[2861,11]]}},"keywords":{}}],["event_name.clon",{"_index":3395,"title":{},"content":{"440":{"position":[[2065,19]]},"687":{"position":[[2065,19]]}},"keywords":{}}],["eventinst",{"_index":3070,"title":{},"content":{"348":{"position":[[2059,14]]}},"keywords":{}}],["eventinstance>(&self",{"_index":2144,"title":{},"content":{"168":{"position":[[2059,28]]},"564":{"position":[[2059,28]]}},"keywords":{}}],["events.r",{"_index":2177,"title":{},"content":{"183":{"position":[[70,9]]},"184":{"position":[[179,9]]},"374":{"position":[[70,9]]},"375":{"position":[[179,9]]},"590":{"position":[[70,9]]},"591":{"position":[[179,9]]}},"keywords":{}}],["events.regist",{"_index":2308,"title":{},"content":{"193":{"position":[[161,18]]},"429":{"position":[[161,18]]},"676":{"position":[[161,18]]}},"keywords":{}}],["events.ticket",{"_index":3340,"title":{},"content":{"438":{"position":[[197,14]]},"685":{"position":[[197,14]]}},"keywords":{}}],["events::{approv",{"_index":2944,"title":{},"content":{"269":{"position":[[3881,18]]},"409":{"position":[[3881,18]]},"646":{"position":[[3881,18]]}},"keywords":{}}],["eventsregist",{"_index":981,"title":{},"content":{"39":{"position":[[2401,14]]}},"keywords":{}}],["everyon",{"_index":154,"title":{},"content":{"3":{"position":[[522,8]]}},"keywords":{}}],["everyth",{"_index":954,"title":{},"content":{"39":{"position":[[1615,10]]},"53":{"position":[[1383,10]]},"174":{"position":[[365,10]]},"360":{"position":[[365,10]]},"395":{"position":[[4443,10]]},"396":{"position":[[309,10]]},"576":{"position":[[365,10]]},"632":{"position":[[4443,10]]},"633":{"position":[[309,10]]}},"keywords":{}}],["evm",{"_index":587,"title":{"29":{"position":[[0,3]]},"31":{"position":[[0,4]]}},"content":{"20":{"position":[[451,3],[593,3],[640,3]]},"30":{"position":[[532,3],[619,3]]},"31":{"position":[[4,3],[144,4],[476,3],[913,3],[3129,3]]}},"keywords":{}}],["evm'",{"_index":727,"title":{},"content":{"31":{"position":[[445,5],[1347,5]]}},"keywords":{}}],["evm_calc_id).unwrap",{"_index":842,"title":{},"content":{"32":{"position":[[1273,22]]}},"keywords":{}}],["evm_runner::run_calc_contract",{"_index":823,"title":{},"content":{"32":{"position":[[298,30]]}},"keywords":{}}],["exact",{"_index":1702,"title":{},"content":{"110":{"position":[[322,5]]},"157":{"position":[[549,5]]},"173":{"position":[[180,5]]},"305":{"position":[[322,5]]},"330":{"position":[[535,5]]},"359":{"position":[[180,5]]},"510":{"position":[[322,5]]},"547":{"position":[[549,5]]},"575":{"position":[[180,5]]}},"keywords":{}}],["exactli",{"_index":1681,"title":{},"content":{"102":{"position":[[603,7]]},"294":{"position":[[603,7]]},"506":{"position":[[603,7]]}},"keywords":{}}],["exampl",{"_index":95,"title":{"7":{"position":[[0,8]]},"41":{"position":[[0,9]]},"71":{"position":[[0,8]]},"73":{"position":[[0,8]]},"99":{"position":[[0,8]]},"100":{"position":[[0,8]]},"101":{"position":[[0,8]]},"115":{"position":[[5,9]]},"170":{"position":[[5,8]]},"177":{"position":[[8,7]]},"235":{"position":[[0,8]]},"237":{"position":[[0,8]]},"258":{"position":[[5,9]]},"269":{"position":[[8,9]]},"291":{"position":[[0,8]]},"292":{"position":[[0,8]]},"293":{"position":[[0,8]]},"356":{"position":[[5,8]]},"368":{"position":[[8,7]]},"384":{"position":[[8,9]]},"409":{"position":[[8,9]]},"471":{"position":[[0,8]]},"473":{"position":[[0,8]]},"481":{"position":[[5,9]]},"503":{"position":[[0,8]]},"504":{"position":[[0,8]]},"505":{"position":[[0,8]]},"572":{"position":[[5,8]]},"584":{"position":[[8,7]]},"626":{"position":[[8,9]]},"646":{"position":[[8,9]]}},"content":{"2":{"position":[[96,8]]},"7":{"position":[[20,7],[57,7],[232,8]]},"12":{"position":[[132,9]]},"16":{"position":[[235,8]]},"30":{"position":[[6,8]]},"31":{"position":[[2902,7]]},"39":{"position":[[1752,8]]},"42":{"position":[[2794,7]]},"43":{"position":[[27,7]]},"54":{"position":[[208,7]]},"61":{"position":[[37,7]]},"63":{"position":[[37,7]]},"79":{"position":[[103,9],[500,8]]},"83":{"position":[[462,7]]},"84":{"position":[[535,8],[915,8]]},"85":{"position":[[375,8],[391,8],[841,8]]},"110":{"position":[[239,8]]},"115":{"position":[[29,7],[1603,7],[1846,8]]},"117":{"position":[[282,7]]},"119":{"position":[[368,7]]},"126":{"position":[[353,7],[411,8],[1170,9],[3415,7]]},"127":{"position":[[955,7]]},"129":{"position":[[252,8]]},"138":{"position":[[1041,8]]},"148":{"position":[[507,7]]},"154":{"position":[[202,8]]},"162":{"position":[[244,7],[2040,7]]},"163":{"position":[[475,7]]},"164":{"position":[[30,7],[1140,9]]},"168":{"position":[[194,7]]},"176":{"position":[[89,8]]},"202":{"position":[[88,8]]},"214":{"position":[[37,7]]},"216":{"position":[[37,7]]},"225":{"position":[[37,7]]},"230":{"position":[[103,9],[517,8]]},"252":{"position":[[462,7]]},"253":{"position":[[535,8],[915,8]]},"254":{"position":[[375,8],[391,8],[841,8]]},"258":{"position":[[29,7],[1549,7],[1792,8]]},"269":{"position":[[19,7]]},"270":{"position":[[275,8],[318,8]]},"277":{"position":[[353,7],[411,8],[1338,9],[3583,7]]},"278":{"position":[[955,7]]},"280":{"position":[[252,8]]},"295":{"position":[[802,7]]},"298":{"position":[[282,7]]},"300":{"position":[[368,7]]},"305":{"position":[[239,8]]},"318":{"position":[[1033,8]]},"323":{"position":[[158,7]]},"336":{"position":[[507,7]]},"339":{"position":[[202,8]]},"348":{"position":[[194,7]]},"351":{"position":[[244,7],[2062,7]]},"352":{"position":[[497,7]]},"353":{"position":[[30,7],[1175,9]]},"362":{"position":[[89,8]]},"384":{"position":[[19,7]]},"385":{"position":[[275,8],[318,8]]},"409":{"position":[[19,7]]},"410":{"position":[[275,8],[318,8]]},"413":{"position":[[110,8]]},"419":{"position":[[1919,8]]},"422":{"position":[[88,8]]},"449":{"position":[[37,7]]},"461":{"position":[[103,9],[517,8]]},"476":{"position":[[68,9]]},"481":{"position":[[29,7],[1549,7],[1792,8]]},"483":{"position":[[462,7]]},"484":{"position":[[535,8],[915,8]]},"485":{"position":[[375,8],[391,8],[841,8]]},"507":{"position":[[802,7]]},"510":{"position":[[239,8]]},"514":{"position":[[353,7],[411,8],[1170,9],[3415,7]]},"515":{"position":[[955,7]]},"517":{"position":[[252,8]]},"519":{"position":[[282,7]]},"521":{"position":[[368,7]]},"541":{"position":[[158,7]]},"544":{"position":[[1033,8]]},"553":{"position":[[507,7]]},"559":{"position":[[202,8]]},"564":{"position":[[194,7]]},"567":{"position":[[244,7],[2062,7]]},"568":{"position":[[497,7]]},"569":{"position":[[30,7],[1175,9]]},"578":{"position":[[89,8]]},"594":{"position":[[404,9]]},"596":{"position":[[786,8]]},"604":{"position":[[96,7]]},"606":{"position":[[714,7]]},"617":{"position":[[95,7],[164,7]]},"618":{"position":[[508,7]]},"626":{"position":[[19,7]]},"627":{"position":[[275,8],[318,8]]},"646":{"position":[[19,7]]},"647":{"position":[[275,8],[318,8]]},"650":{"position":[[110,8]]},"656":{"position":[[1919,8]]},"664":{"position":[[88,8]]},"698":{"position":[[68,9]]},"702":{"position":[[404,9]]},"704":{"position":[[786,8]]},"712":{"position":[[96,7]]},"714":{"position":[[714,7]]},"725":{"position":[[95,7],[164,7]]},"726":{"position":[[508,7]]}},"keywords":{}}],["examples"",{"_index":3560,"title":{},"content":{"477":{"position":[[752,14]]},"699":{"position":[[752,14]]}},"keywords":{}}],["examples.simpl",{"_index":51,"title":{},"content":{"1":{"position":[[656,19]]}},"keywords":{}}],["examples/bin/erc20_on_livenet.r",{"_index":1955,"title":{},"content":{"142":{"position":[[232,32]]},"327":{"position":[[232,32]]},"536":{"position":[[232,32]]}},"keywords":{}}],["examples/bin/tlw_on_livenet.r",{"_index":3563,"title":{},"content":{"477":{"position":[[1274,30]]},"699":{"position":[[1274,30]]}},"keywords":{}}],["examples/src/contracts/tlw.r",{"_index":1353,"title":{},"content":{"71":{"position":[[0,29]]},"235":{"position":[[0,29]]},"471":{"position":[[0,29]]},"476":{"position":[[78,29]]},"698":{"position":[[78,29]]}},"keywords":{}}],["examples/src/featur",{"_index":2112,"title":{},"content":{"164":{"position":[[1215,22]]},"353":{"position":[[1250,22]]},"569":{"position":[[1250,22]]}},"keywords":{}}],["examples/src/features/cross_calls.r",{"_index":1950,"title":{},"content":{"141":{"position":[[1507,36]]},"143":{"position":[[64,36]]},"328":{"position":[[64,36]]},"537":{"position":[[64,36]]}},"keywords":{}}],["examples/src/features/events.r",{"_index":2022,"title":{},"content":{"157":{"position":[[115,31]]},"330":{"position":[[115,31]]},"547":{"position":[[115,31]]}},"keywords":{}}],["examples/src/features/handling_errors.r",{"_index":1900,"title":{},"content":{"138":{"position":[[123,40]]},"318":{"position":[[123,40]]},"544":{"position":[[123,40]]}},"keywords":{}}],["examples/src/features/modules.r",{"_index":2012,"title":{},"content":{"151":{"position":[[63,32]]},"342":{"position":[[63,32]]},"556":{"position":[[63,32]]}},"keywords":{}}],["examples/src/features/native_token.r",{"_index":2035,"title":{},"content":{"160":{"position":[[111,37]]},"345":{"position":[[111,37]]},"562":{"position":[[111,37]]}},"keywords":{}}],["examples/src/features/storage/list.r",{"_index":2102,"title":{},"content":{"164":{"position":[[116,37],[478,37]]},"353":{"position":[[116,37],[513,37]]},"569":{"position":[[116,37],[513,37]]}},"keywords":{}}],["examples/src/features/storage/mapping.r",{"_index":1446,"title":{},"content":{"79":{"position":[[509,40]]},"163":{"position":[[294,40],[746,40]]},"230":{"position":[[526,40]]},"352":{"position":[[294,40],[768,40]]},"461":{"position":[[526,40]]},"568":{"position":[[294,40],[768,40]]}},"keywords":{}}],["examples/src/features/storage/variable.r",{"_index":2048,"title":{},"content":{"162":{"position":[[289,41],[672,41],[1445,41],[1702,41],[2128,41]]},"351":{"position":[[289,41],[709,41],[1467,41],[1724,41],[2150,41]]},"567":{"position":[[289,41],[709,41],[1467,41],[1724,41],[2150,41]]}},"keywords":{}}],["examples/src/features/testing.r",{"_index":2115,"title":{},"content":{"168":{"position":[[298,32]]},"348":{"position":[[298,32]]},"564":{"position":[[298,32]]}},"keywords":{}}],["exampleto",{"_index":684,"title":{},"content":{"26":{"position":[[37,9]]},"28":{"position":[[37,9]]},"36":{"position":[[37,9]]},"46":{"position":[[37,9]]},"48":{"position":[[37,9]]},"57":{"position":[[37,9]]},"59":{"position":[[37,9]]}},"keywords":{}}],["exce",{"_index":2522,"title":{},"content":{"206":{"position":[[1829,7]]},"269":{"position":[[5739,7]]},"409":{"position":[[5739,7]]},"426":{"position":[[1819,7]]},"646":{"position":[[5739,7]]},"668":{"position":[[1829,7]]}},"keywords":{}}],["exceed",{"_index":3774,"title":{},"content":{"606":{"position":[[1146,9]]},"714":{"position":[[1146,9]]}},"keywords":{}}],["excel",{"_index":2770,"title":{},"content":{"247":{"position":[[1619,9]]},"446":{"position":[[1619,9]]},"673":{"position":[[1619,9]]}},"keywords":{}}],["except",{"_index":1351,"title":{},"content":{"70":{"position":[[171,6]]},"234":{"position":[[171,6]]},"354":{"position":[[526,6]]},"440":{"position":[[4028,6]]},"441":{"position":[[3420,6]]},"470":{"position":[[171,6]]},"570":{"position":[[526,6]]},"617":{"position":[[833,10],[934,10]]},"687":{"position":[[4028,6]]},"688":{"position":[[3420,6]]},"725":{"position":[[833,10],[934,10]]}},"keywords":{}}],["exchang",{"_index":1741,"title":{},"content":{"115":{"position":[[2102,9],[3024,8]]},"258":{"position":[[2048,9],[2950,8]]},"481":{"position":[[2048,9],[2950,8]]}},"keywords":{}}],["exchange::exchang",{"_index":1738,"title":{},"content":{"115":{"position":[[1899,20]]},"258":{"position":[[1845,20]]},"481":{"position":[[1845,20]]}},"keywords":{}}],["exchange_r",{"_index":1743,"title":{},"content":{"115":{"position":[[2269,14]]},"258":{"position":[[2215,14]]},"481":{"position":[[2215,14]]}},"keywords":{}}],["exclus",{"_index":1405,"title":{},"content":{"74":{"position":[[56,9]]},"189":{"position":[[307,9]]},"238":{"position":[[56,9]]},"366":{"position":[[307,9]]},"474":{"position":[[56,9]]},"582":{"position":[[307,9]]}},"keywords":{}}],["exec",{"_index":1265,"title":{},"content":{"52":{"position":[[1409,4],[4928,4]]},"477":{"position":[[358,4]]},"699":{"position":[[358,4]]}},"keywords":{}}],["exec_flag",{"_index":1251,"title":{},"content":{"52":{"position":[[851,10],[1079,14],[1394,14],[1567,14]]}},"keywords":{}}],["execut",{"_index":649,"title":{"104":{"position":[[0,10]]},"108":{"position":[[0,10]]},"275":{"position":[[0,10]]},"296":{"position":[[0,10]]},"492":{"position":[[0,10]]},"508":{"position":[[0,10]]}},"content":{"22":{"position":[[463,8],[637,9]]},"31":{"position":[[2655,9],[2803,7]]},"32":{"position":[[1396,7]]},"43":{"position":[[806,7]]},"52":{"position":[[1454,7]]},"53":{"position":[[379,7]]},"66":{"position":[[368,9]]},"72":{"position":[[123,9]]},"83":{"position":[[11,9]]},"93":{"position":[[27,9]]},"95":{"position":[[136,9],[190,9],[471,8]]},"102":{"position":[[453,9]]},"108":{"position":[[327,8]]},"119":{"position":[[1054,8]]},"127":{"position":[[155,9],[509,9],[719,8],[786,8]]},"128":{"position":[[25,8],[292,8],[575,8]]},"174":{"position":[[204,7]]},"175":{"position":[[32,8],[284,10]]},"179":{"position":[[18,7]]},"182":{"position":[[386,10]]},"198":{"position":[[3784,10]]},"218":{"position":[[146,9]]},"221":{"position":[[710,8],[902,9]]},"236":{"position":[[123,9]]},"241":{"position":[[368,9]]},"252":{"position":[[11,9]]},"275":{"position":[[331,8]]},"278":{"position":[[155,9],[509,9],[719,8],[786,8]]},"279":{"position":[[25,8],[292,8],[575,8]]},"285":{"position":[[27,9]]},"287":{"position":[[136,9],[190,9],[471,8]]},"294":{"position":[[453,9]]},"300":{"position":[[1054,8]]},"324":{"position":[[1422,8]]},"360":{"position":[[204,7]]},"361":{"position":[[32,8],[284,10]]},"370":{"position":[[18,7]]},"373":{"position":[[386,10]]},"395":{"position":[[4976,9],[5643,9],[6102,9],[6622,9]]},"416":{"position":[[224,9]]},"434":{"position":[[3766,10]]},"451":{"position":[[146,9]]},"454":{"position":[[710,8],[902,9]]},"466":{"position":[[368,9]]},"472":{"position":[[123,9]]},"476":{"position":[[1591,10]]},"477":{"position":[[2303,7],[2892,9],[3375,9],[3756,9]]},"483":{"position":[[11,9]]},"492":{"position":[[331,8]]},"497":{"position":[[27,9]]},"499":{"position":[[136,9],[190,9],[471,8]]},"506":{"position":[[453,9]]},"515":{"position":[[155,9],[509,9],[719,8],[786,8]]},"516":{"position":[[25,8],[292,8],[575,8]]},"521":{"position":[[1054,8]]},"542":{"position":[[1422,8]]},"576":{"position":[[204,7]]},"577":{"position":[[32,8],[284,10]]},"586":{"position":[[18,7]]},"589":{"position":[[386,10]]},"606":{"position":[[1094,8]]},"611":{"position":[[685,9],[811,9]]},"617":{"position":[[485,7],[562,7],[1304,7]]},"632":{"position":[[4976,9],[5643,9],[6102,9],[6622,9]]},"653":{"position":[[224,9]]},"681":{"position":[[3784,10]]},"691":{"position":[[146,9]]},"694":{"position":[[710,8],[902,9]]},"698":{"position":[[1591,10]]},"699":{"position":[[2303,7],[2892,9],[3375,9],[3756,9]]},"714":{"position":[[1094,8]]},"719":{"position":[[685,9],[811,9]]},"725":{"position":[[485,7],[562,7],[1304,7]]}},"keywords":{}}],["execute_external_call(&self",{"_index":3804,"title":{},"content":{"611":{"position":[[352,32]]},"617":{"position":[[278,32]]},"719":{"position":[[352,32]]},"725":{"position":[[278,32]]}},"keywords":{}}],["execution_error",{"_index":465,"title":{},"content":{"17":{"position":[[393,17],[1532,16],[1915,16],[3972,16]]},"267":{"position":[[1193,16]]},"407":{"position":[[1193,16]]},"644":{"position":[[1193,16]]}},"keywords":{}}],["executionerror",{"_index":1396,"title":{},"content":{"73":{"position":[[513,16]]},"93":{"position":[[145,15]]},"237":{"position":[[513,16]]},"285":{"position":[[145,15]]},"473":{"position":[[513,16]]},"497":{"position":[[145,15]]},"608":{"position":[[65,15]]},"716":{"position":[[65,15]]}},"keywords":{}}],["executionerror::reentrantcall.into",{"_index":1402,"title":{},"content":{"73":{"position":[[748,38]]},"237":{"position":[[748,38]]},"473":{"position":[[748,38]]}},"keywords":{}}],["executor",{"_index":775,"title":{},"content":{"31":{"position":[[1960,9],[2194,8]]},"198":{"position":[[3254,9]]},"434":{"position":[[3236,9]]},"681":{"position":[[3254,9]]}},"keywords":{}}],["executor.transact_cal",{"_index":787,"title":{},"content":{"31":{"position":[[2382,23]]}},"keywords":{}}],["exist",{"_index":612,"title":{},"content":{"20":{"position":[[946,6]]},"44":{"position":[[131,8]]},"50":{"position":[[344,8]]},"98":{"position":[[358,7]]},"111":{"position":[[260,8]]},"121":{"position":[[292,6]]},"126":{"position":[[2631,8]]},"277":{"position":[[2799,8]]},"290":{"position":[[358,7]]},"302":{"position":[[292,6]]},"306":{"position":[[260,8]]},"395":{"position":[[2189,8]]},"502":{"position":[[358,7]]},"511":{"position":[[260,8]]},"514":{"position":[[2631,8]]},"523":{"position":[[292,6]]},"614":{"position":[[293,5]]},"632":{"position":[[2189,8]]},"722":{"position":[[293,5]]}},"keywords":{}}],["exit_reason",{"_index":786,"title":{},"content":{"31":{"position":[[2358,13]]}},"keywords":{}}],["exitreason::succeed(exitsucceed::return",{"_index":792,"title":{},"content":{"31":{"position":[[2699,44]]}},"keywords":{}}],["expand",{"_index":3604,"title":{},"content":{"594":{"position":[[55,6]]},"702":{"position":[[55,6]]}},"keywords":{}}],["expect",{"_index":1130,"title":{},"content":{"43":{"position":[[792,8]]},"52":{"position":[[6452,9],[6675,8]]},"65":{"position":[[560,7]]},"92":{"position":[[839,7]]},"98":{"position":[[96,7]]},"138":{"position":[[1085,9]]},"198":{"position":[[2719,6],[2981,6],[3487,6],[3811,6]]},"212":{"position":[[1233,6]]},"240":{"position":[[560,7]]},"284":{"position":[[839,7]]},"290":{"position":[[96,7]]},"318":{"position":[[1077,9]]},"391":{"position":[[1233,6]]},"434":{"position":[[2709,6],[2963,6],[3469,6],[3793,6]]},"465":{"position":[[560,7]]},"496":{"position":[[839,7]]},"502":{"position":[[96,7]]},"544":{"position":[[1077,9]]},"661":{"position":[[1233,6]]},"681":{"position":[[2719,6],[2981,6],[3487,6],[3811,6]]}},"keywords":{}}],["expect("journ",{"_index":290,"title":{},"content":{"9":{"position":[[864,21]]}},"keywords":{}}],["expect("method",{"_index":269,"title":{},"content":{"9":{"position":[[281,20]]}},"keywords":{}}],["expect("prov",{"_index":276,"title":{},"content":{"9":{"position":[[417,20]]}},"keywords":{}}],["expect("should",{"_index":2675,"title":{},"content":{"212":{"position":[[4199,20],[4372,20]]},"391":{"position":[[4217,20],[4390,20]]},"661":{"position":[[4217,20],[4390,20]]}},"keywords":{}}],["expect("valid",{"_index":283,"title":{},"content":{"9":{"position":[[702,19]]}},"keywords":{}}],["expect.switch",{"_index":2696,"title":{},"content":{"218":{"position":[[182,13]]},"451":{"position":[[182,13]]},"691":{"position":[[182,13]]}},"keywords":{}}],["expens",{"_index":186,"title":{},"content":{"5":{"position":[[264,9]]},"601":{"position":[[2117,10]]},"709":{"position":[[2117,10]]}},"keywords":{}}],["experi",{"_index":1320,"title":{},"content":{"54":{"position":[[397,10]]},"618":{"position":[[298,10]]},"726":{"position":[[298,10]]}},"keywords":{}}],["experienc",{"_index":644,"title":{},"content":{"22":{"position":[[129,11]]}},"keywords":{}}],["expertis",{"_index":390,"title":{},"content":{"12":{"position":[[354,10]]}},"keywords":{}}],["explain",{"_index":1791,"title":{},"content":{"122":{"position":[[109,7]]},"303":{"position":[[109,7]]},"524":{"position":[[109,7]]}},"keywords":{}}],["explicitli",{"_index":3745,"title":{},"content":{"603":{"position":[[205,10]]},"605":{"position":[[309,11]]},"606":{"position":[[849,11]]},"711":{"position":[[205,10]]},"713":{"position":[[309,11]]},"714":{"position":[[849,11]]}},"keywords":{}}],["explicitly.to",{"_index":3618,"title":{},"content":{"596":{"position":[[1104,13]]},"704":{"position":[[1104,13]]}},"keywords":{}}],["exploit",{"_index":1375,"title":{},"content":{"72":{"position":[[38,7]]},"236":{"position":[[38,7]]},"472":{"position":[[38,7]]}},"keywords":{}}],["explor",{"_index":1635,"title":{},"content":{"97":{"position":[[225,7]]},"157":{"position":[[785,7]]},"268":{"position":[[2965,7]]},"270":{"position":[[129,7]]},"289":{"position":[[225,7]]},"330":{"position":[[761,7]]},"385":{"position":[[129,7]]},"396":{"position":[[33,7]]},"398":{"position":[[173,8],[331,7]]},"408":{"position":[[2965,7]]},"410":{"position":[[129,7]]},"501":{"position":[[225,7]]},"547":{"position":[[785,7]]},"618":{"position":[[341,7]]},"627":{"position":[[129,7]]},"633":{"position":[[33,7]]},"635":{"position":[[173,8],[331,7]]},"645":{"position":[[2965,7]]},"647":{"position":[[129,7]]},"726":{"position":[[341,7]]}},"keywords":{}}],["explorer,cspr.l",{"_index":3189,"title":{},"content":{"396":{"position":[[64,19]]},"633":{"position":[[64,19]]}},"keywords":{}}],["export",{"_index":2259,"title":{},"content":{"185":{"position":[[2999,8]]},"376":{"position":[[2983,8]]},"397":{"position":[[67,9]]},"592":{"position":[[2983,8]]},"634":{"position":[[67,9]]}},"keywords":{}}],["expos",{"_index":1061,"title":{},"content":{"42":{"position":[[1317,7],[1792,7]]},"43":{"position":[[1935,7]]},"91":{"position":[[913,6]]},"110":{"position":[[77,8]]},"111":{"position":[[44,7]]},"185":{"position":[[2886,7]]},"189":{"position":[[194,7]]},"209":{"position":[[186,6]]},"221":{"position":[[529,6]]},"283":{"position":[[911,6]]},"305":{"position":[[77,8]]},"306":{"position":[[44,7]]},"366":{"position":[[194,7]]},"376":{"position":[[2870,7]]},"388":{"position":[[186,6]]},"454":{"position":[[529,6]]},"495":{"position":[[911,6]]},"510":{"position":[[77,8]]},"511":{"position":[[44,7]]},"582":{"position":[[194,7]]},"592":{"position":[[2870,7]]},"658":{"position":[[186,6]]},"694":{"position":[[529,6]]}},"keywords":{}}],["expr",{"_index":997,"title":{},"content":{"39":{"position":[[2797,4],[2816,4]]}},"keywords":{}}],["express",{"_index":915,"title":{},"content":{"39":{"position":[[540,12],[2204,10],[2476,10]]},"81":{"position":[[246,9]]},"232":{"position":[[246,9]]},"463":{"position":[[246,9]]}},"keywords":{}}],["expression::add",{"_index":990,"title":{},"content":{"39":{"position":[[2634,15]]}},"keywords":{}}],["expression::boolliteral(b",{"_index":1007,"title":{},"content":{"39":{"position":[[3084,26]]}},"keywords":{}}],["expression::externalcal",{"_index":1000,"title":{},"content":{"39":{"position":[[2873,24]]}},"keywords":{}}],["expression::incr",{"_index":996,"title":{},"content":{"39":{"position":[[2773,21]]}},"keywords":{}}],["expression::requir",{"_index":985,"title":{},"content":{"39":{"position":[[2489,19]]}},"keywords":{}}],["expression::subtract",{"_index":994,"title":{},"content":{"39":{"position":[[2701,20]]}},"keywords":{}}],["expression::typ",{"_index":1004,"title":{},"content":{"39":{"position":[[2979,16]]}},"keywords":{}}],["expression::zeroaddress",{"_index":988,"title":{},"content":{"39":{"position":[[2580,23]]}},"keywords":{}}],["extend",{"_index":3855,"title":{},"content":{"613":{"position":[[1658,7]]},"721":{"position":[[1658,7]]}},"keywords":{}}],["extens",{"_index":2282,"title":{},"content":{"187":{"position":[[68,11]]},"188":{"position":[[252,11],[629,10]]},"189":{"position":[[565,9]]},"364":{"position":[[68,11]]},"365":{"position":[[609,11],[986,10]]},"366":{"position":[[565,9]]},"580":{"position":[[68,11]]},"581":{"position":[[609,11],[986,10]]},"582":{"position":[[565,9]]}},"keywords":{}}],["extern",{"_index":818,"title":{},"content":{"32":{"position":[[215,6]]},"72":{"position":[[336,8]]},"128":{"position":[[532,8]]},"141":{"position":[[697,8],[1120,8]]},"143":{"position":[[716,8]]},"189":{"position":[[209,8]]},"236":{"position":[[336,8]]},"267":{"position":[[3499,8],[3554,8],[3641,8]]},"279":{"position":[[532,8]]},"326":{"position":[[697,8],[1120,8]]},"328":{"position":[[691,8]]},"366":{"position":[[209,8]]},"407":{"position":[[3499,8],[3554,8],[3641,8]]},"472":{"position":[[336,8]]},"516":{"position":[[532,8]]},"535":{"position":[[697,8],[1120,8]]},"537":{"position":[[691,8]]},"582":{"position":[[209,8]]},"617":{"position":[[500,8],[577,8],[963,8]]},"644":{"position":[[3499,8],[3554,8],[3641,8]]},"725":{"position":[[500,8],[577,8],[963,8]]}},"keywords":{}}],["externalcallsregist",{"_index":982,"title":{},"content":{"39":{"position":[[2418,21]]}},"keywords":{}}],["extra",{"_index":1610,"title":{},"content":{"93":{"position":[[105,5]]},"285":{"position":[[105,5]]},"497":{"position":[[105,5]]}},"keywords":{}}],["extract",{"_index":285,"title":{},"content":{"9":{"position":[[758,7]]},"70":{"position":[[88,9]]},"71":{"position":[[82,7]]},"143":{"position":[[830,7]]},"162":{"position":[[2296,7]]},"234":{"position":[[88,9]]},"235":{"position":[[82,7]]},"268":{"position":[[1909,7]]},"328":{"position":[[805,7]]},"351":{"position":[[2318,7]]},"393":{"position":[[165,7]]},"408":{"position":[[1909,7]]},"470":{"position":[[88,9]]},"471":{"position":[[82,7]]},"476":{"position":[[675,7]]},"477":{"position":[[332,7]]},"537":{"position":[[805,7]]},"567":{"position":[[2318,7]]},"630":{"position":[[165,7]]},"645":{"position":[[1909,7]]},"698":{"position":[[675,7]]},"699":{"position":[[332,7]]}},"keywords":{}}],["extrem",{"_index":2320,"title":{},"content":{"195":{"position":[[645,9]]},"220":{"position":[[22,9]]},"431":{"position":[[645,9]]},"453":{"position":[[22,9]]},"678":{"position":[[645,9]]},"693":{"position":[[22,9]]}},"keywords":{}}],["f",{"_index":3821,"title":{},"content":{"612":{"position":[[1219,1],[1292,1]]},"720":{"position":[[1219,1],[1292,1]]}},"keywords":{}}],["fact",{"_index":1698,"title":{},"content":{"107":{"position":[[413,4]]},"124":{"position":[[118,4]]},"163":{"position":[[1508,4]]},"274":{"position":[[413,4]]},"309":{"position":[[118,4]]},"352":{"position":[[1530,4]]},"491":{"position":[[413,4]]},"526":{"position":[[118,4]]},"568":{"position":[[1530,4]]}},"keywords":{}}],["factor",{"_index":230,"title":{},"content":{"8":{"position":[[92,7],[441,8]]},"9":{"position":[[969,7]]}},"keywords":{}}],["factors"",{"_index":249,"title":{},"content":{"8":{"position":[[493,14]]}},"keywords":{}}],["fail",{"_index":2280,"title":{},"content":{"185":{"position":[[3981,4]]},"194":{"position":[[216,5]]},"197":{"position":[[1678,4]]},"198":{"position":[[3500,5]]},"206":{"position":[[3613,6]]},"268":{"position":[[2040,7],[2241,5]]},"376":{"position":[[3965,4]]},"408":{"position":[[2040,7],[2241,5]]},"426":{"position":[[3588,6]]},"430":{"position":[[216,5]]},"433":{"position":[[1677,4]]},"434":{"position":[[3482,5]]},"440":{"position":[[5819,7],[5948,5]]},"592":{"position":[[3965,4]]},"617":{"position":[[591,6]]},"645":{"position":[[2040,7],[2241,5]]},"668":{"position":[[3613,6]]},"677":{"position":[[216,5]]},"680":{"position":[[1677,4]]},"681":{"position":[[3500,5]]},"687":{"position":[[5819,7],[5948,5]]},"725":{"position":[[591,6]]}},"keywords":{}}],["failur",{"_index":3923,"title":{},"content":{"617":{"position":[[1227,7]]},"725":{"position":[[1227,7]]}},"keywords":{}}],["fallback",{"_index":3856,"title":{"614":{"position":[[0,8]]},"722":{"position":[[0,8]]}},"content":{"614":{"position":[[74,10],[187,10],[370,10]]},"722":{"position":[[74,10],[187,10],[370,10]]}},"keywords":{}}],["fals",{"_index":1846,"title":{},"content":{"126":{"position":[[3654,5]]},"131":{"position":[[321,5],[420,5]]},"185":{"position":[[2329,7]]},"221":{"position":[[660,7]]},"265":{"position":[[727,5],[830,5]]},"277":{"position":[[3822,5]]},"311":{"position":[[373,5],[472,5]]},"323":{"position":[[1986,5],[2256,6],[3011,5],[3216,5],[3429,5],[3565,5],[3699,5]]},"376":{"position":[[2313,7]]},"395":{"position":[[2727,5],[2815,5],[2994,5],[3101,5],[3279,5],[3379,5]]},"405":{"position":[[727,5],[830,5]]},"454":{"position":[[660,7]]},"477":{"position":[[893,5],[1247,5]]},"514":{"position":[[3654,5]]},"528":{"position":[[373,5],[472,5]]},"541":{"position":[[1986,5],[2256,6],[3011,5],[3216,5],[3429,5],[3565,5],[3699,5]]},"592":{"position":[[2313,7]]},"602":{"position":[[1371,6]]},"632":{"position":[[2727,5],[2815,5],[2994,5],[3101,5],[3279,5],[3379,5]]},"642":{"position":[[727,5],[830,5]]},"694":{"position":[[660,7]]},"699":{"position":[[893,5],[1247,5]]},"710":{"position":[[1371,6]]}},"keywords":{}}],["famili",{"_index":956,"title":{},"content":{"39":{"position":[[1644,7]]}},"keywords":{}}],["familiar",{"_index":630,"title":{},"content":{"21":{"position":[[226,8]]},"38":{"position":[[516,8],[653,8]]},"53":{"position":[[1082,8]]},"618":{"position":[[584,8]]},"726":{"position":[[584,8]]}},"keywords":{}}],["famousflipp",{"_index":2019,"title":{},"content":{"155":{"position":[[102,13]]},"340":{"position":[[102,13]]},"560":{"position":[[102,13]]}},"keywords":{}}],["fantast",{"_index":1291,"title":{},"content":{"52":{"position":[[4676,10]]}},"keywords":{}}],["far",{"_index":410,"title":{},"content":{"15":{"position":[[296,3]]}},"keywords":{}}],["fascin",{"_index":595,"title":{},"content":{"20":{"position":[[535,11]]}},"keywords":{}}],["fast",{"_index":70,"title":{},"content":{"1":{"position":[[883,4]]}},"keywords":{}}],["faster",{"_index":1776,"title":{},"content":{"119":{"position":[[160,6]]},"300":{"position":[[160,6]]},"521":{"position":[[160,6]]}},"keywords":{}}],["faucet",{"_index":3111,"title":{},"content":{"394":{"position":[[108,7],[202,7],[235,7]]},"397":{"position":[[59,7]]},"631":{"position":[[108,7],[202,7],[235,7]]},"634":{"position":[[59,7]]}},"keywords":{}}],["featur",{"_index":157,"title":{"193":{"position":[[10,9]]},"197":{"position":[[0,8]]},"201":{"position":[[10,9]]},"421":{"position":[[10,9]]},"429":{"position":[[10,9]]},"433":{"position":[[0,8]]},"663":{"position":[[10,9]]},"676":{"position":[[10,9]]},"680":{"position":[[0,8]]}},"content":{"3":{"position":[[567,7],[666,7]]},"16":{"position":[[454,8]]},"17":{"position":[[212,8]]},"42":{"position":[[495,8]]},"54":{"position":[[227,8]]},"68":{"position":[[128,7],[552,8]]},"76":{"position":[[34,9]]},"81":{"position":[[17,8]]},"88":{"position":[[178,7],[278,8],[370,8]]},"90":{"position":[[66,9]]},"110":{"position":[[86,8]]},"114":{"position":[[24,7]]},"115":{"position":[[3263,8]]},"119":{"position":[[203,8]]},"126":{"position":[[3614,8]]},"127":{"position":[[73,7]]},"143":{"position":[[895,9]]},"189":{"position":[[286,7]]},"193":{"position":[[68,9]]},"201":{"position":[[68,9]]},"202":{"position":[[11,8]]},"205":{"position":[[69,8]]},"227":{"position":[[34,9]]},"232":{"position":[[17,8]]},"243":{"position":[[128,7],[552,8]]},"248":{"position":[[96,8]]},"250":{"position":[[178,7],[278,8],[370,8]]},"257":{"position":[[24,7]]},"258":{"position":[[3189,8]]},"265":{"position":[[79,8],[109,8],[138,8]]},"267":{"position":[[142,8]]},"268":{"position":[[139,8]]},"270":{"position":[[366,8]]},"277":{"position":[[3782,8]]},"278":{"position":[[73,7]]},"282":{"position":[[66,9]]},"300":{"position":[[203,8]]},"305":{"position":[[86,8]]},"328":{"position":[[870,9]]},"366":{"position":[[286,7]]},"385":{"position":[[366,8]]},"395":{"position":[[2462,7],[2693,8],[2716,8],[2781,8],[2804,8],[2960,8],[2983,8],[3067,8],[3090,8],[3109,10],[3483,8],[4422,8]]},"405":{"position":[[79,8],[109,8],[138,8]]},"407":{"position":[[142,8]]},"408":{"position":[[139,8]]},"410":{"position":[[366,8]]},"421":{"position":[[68,9]]},"422":{"position":[[11,8]]},"425":{"position":[[69,8]]},"429":{"position":[[68,9]]},"438":{"position":[[53,9]]},"442":{"position":[[134,9]]},"447":{"position":[[96,8]]},"458":{"position":[[34,9]]},"463":{"position":[[17,8]]},"468":{"position":[[128,7],[552,8]]},"477":{"position":[[882,8],[1022,10],[1207,8]]},"480":{"position":[[24,7]]},"481":{"position":[[3189,8]]},"488":{"position":[[178,7],[278,8],[370,8]]},"494":{"position":[[66,9]]},"510":{"position":[[86,8]]},"514":{"position":[[3614,8]]},"515":{"position":[[73,7]]},"521":{"position":[[203,8]]},"537":{"position":[[870,9]]},"582":{"position":[[286,7]]},"610":{"position":[[915,8]]},"613":{"position":[[1748,9]]},"617":{"position":[[792,7]]},"618":{"position":[[363,9]]},"627":{"position":[[366,8]]},"632":{"position":[[2462,7],[2693,8],[2716,8],[2781,8],[2804,8],[2960,8],[2983,8],[3067,8],[3090,8],[3109,10],[3483,8],[4422,8]]},"642":{"position":[[79,8],[109,8],[138,8]]},"644":{"position":[[142,8]]},"645":{"position":[[139,8]]},"647":{"position":[[366,8]]},"663":{"position":[[68,9]]},"664":{"position":[[11,8]]},"667":{"position":[[69,8]]},"674":{"position":[[96,8]]},"676":{"position":[[68,9]]},"685":{"position":[[53,9]]},"689":{"position":[[134,9]]},"699":{"position":[[882,8],[1022,10],[1207,8]]},"718":{"position":[[915,8]]},"721":{"position":[[1748,9]]},"725":{"position":[[792,7]]},"726":{"position":[[363,9]]}},"keywords":{}}],["features=liven",{"_index":1875,"title":{},"content":{"129":{"position":[[619,15]]}},"keywords":{}}],["features=livenet",{"_index":1848,"title":{},"content":{"127":{"position":[[125,16]]},"278":{"position":[[125,16]]},"280":{"position":[[619,16]]},"477":{"position":[[2535,16]]},"515":{"position":[[125,16]]},"517":{"position":[[619,16]]},"699":{"position":[[2535,16]]}},"keywords":{}}],["feedback",{"_index":68,"title":{},"content":{"1":{"position":[[864,8]]},"3":{"position":[[4,8]]}},"keywords":{}}],["feel",{"_index":632,"title":{},"content":{"21":{"position":[[268,4]]},"175":{"position":[[591,4]]},"361":{"position":[[591,4]]},"398":{"position":[[318,4]]},"577":{"position":[[591,4]]},"618":{"position":[[711,4]]},"635":{"position":[[318,4]]},"726":{"position":[[711,4]]}},"keywords":{}}],["few",{"_index":61,"title":{},"content":{"1":{"position":[[805,3]]},"2":{"position":[[92,3]]},"44":{"position":[[84,3]]},"91":{"position":[[276,3]]},"115":{"position":[[1789,3]]},"157":{"position":[[28,3]]},"193":{"position":[[59,3]]},"201":{"position":[[59,3]]},"247":{"position":[[1557,3]]},"258":{"position":[[1735,3]]},"283":{"position":[[276,3]]},"330":{"position":[[28,3]]},"398":{"position":[[265,3]]},"421":{"position":[[59,3]]},"429":{"position":[[59,3]]},"446":{"position":[[1557,3]]},"481":{"position":[[1735,3]]},"495":{"position":[[276,3]]},"547":{"position":[[28,3]]},"635":{"position":[[265,3]]},"663":{"position":[[59,3]]},"673":{"position":[[1557,3]]},"676":{"position":[[59,3]]}},"keywords":{}}],["ffi.support",{"_index":387,"title":{},"content":{"12":{"position":[[251,14]]}},"keywords":{}}],["fibonacci",{"_index":440,"title":{},"content":{"16":{"position":[[259,9]]},"30":{"position":[[125,9]]}},"keywords":{}}],["fibonacci(10",{"_index":802,"title":{},"content":{"31":{"position":[[3078,14]]}},"keywords":{}}],["fibonacci(4",{"_index":837,"title":{},"content":{"32":{"position":[[1072,12],[1808,12]]}},"keywords":{}}],["fibonacci(n",{"_index":698,"title":{},"content":{"30":{"position":[[372,11],[391,11]]}},"keywords":{}}],["fibonacci(uint256",{"_index":696,"title":{},"content":{"30":{"position":[[281,17]]}},"keywords":{}}],["fibonacci_work",{"_index":806,"title":{},"content":{"31":{"position":[[3162,17]]}},"keywords":{}}],["field",{"_index":963,"title":{"324":{"position":[[7,7]]},"542":{"position":[[7,7]]}},"content":{"39":{"position":[[1929,7]]},"84":{"position":[[333,7],[675,7]]},"146":{"position":[[482,6],[512,6]]},"165":{"position":[[323,5]]},"209":{"position":[[339,5]]},"253":{"position":[[333,7],[675,7]]},"334":{"position":[[486,6],[516,6]]},"354":{"position":[[387,5],[660,5]]},"383":{"position":[[731,6]]},"388":{"position":[[339,5]]},"416":{"position":[[328,6]]},"484":{"position":[[333,7],[675,7]]},"551":{"position":[[486,6],[516,6]]},"570":{"position":[[387,5],[660,5]]},"610":{"position":[[603,7]]},"625":{"position":[[731,6]]},"653":{"position":[[328,6]]},"658":{"position":[[339,5]]},"718":{"position":[[603,7]]}},"keywords":{}}],["file",{"_index":1012,"title":{},"content":{"39":{"position":[[3299,5]]},"42":{"position":[[1433,5],[1580,4],[2639,4]]},"43":{"position":[[1655,4]]},"52":{"position":[[26,5],[2259,5]]},"65":{"position":[[410,5],[420,4],[683,5]]},"66":{"position":[[30,5],[136,5],[292,4]]},"96":{"position":[[174,5]]},"100":{"position":[[237,4]]},"117":{"position":[[325,4]]},"118":{"position":[[136,4],[250,4],[298,5]]},"119":{"position":[[433,6]]},"120":{"position":[[185,5]]},"121":{"position":[[175,4]]},"122":{"position":[[52,5]]},"126":{"position":[[308,4],[366,5],[401,4],[1293,5],[3510,5]]},"127":{"position":[[204,5]]},"129":{"position":[[217,4],[399,4],[450,4],[495,5],[542,5],[699,4],[747,5]]},"131":{"position":[[38,5]]},"132":{"position":[[12,4]]},"133":{"position":[[45,5]]},"134":{"position":[[116,6]]},"135":{"position":[[0,5]]},"136":{"position":[[5,5],[99,5],[189,5],[248,5]]},"154":{"position":[[279,4]]},"173":{"position":[[538,6]]},"210":{"position":[[249,5]]},"240":{"position":[[410,5],[420,4],[683,5]]},"241":{"position":[[30,5],[136,5],[292,4]]},"264":{"position":[[239,5],[322,5],[442,5],[473,6]]},"265":{"position":[[43,5],[385,4]]},"266":{"position":[[48,4]]},"267":{"position":[[836,7]]},"277":{"position":[[308,4],[366,5],[401,4],[1461,5],[3678,5]]},"278":{"position":[[204,5]]},"280":{"position":[[217,4],[399,4],[450,4],[495,5],[542,5],[700,4],[748,5]]},"288":{"position":[[174,5]]},"292":{"position":[[237,4]]},"298":{"position":[[325,4]]},"299":{"position":[[136,4],[250,4],[298,5]]},"300":{"position":[[433,6]]},"301":{"position":[[185,5]]},"302":{"position":[[175,4]]},"303":{"position":[[52,5]]},"311":{"position":[[38,5]]},"312":{"position":[[12,4]]},"313":{"position":[[45,5]]},"314":{"position":[[116,6]]},"315":{"position":[[0,5]]},"316":{"position":[[5,5],[99,5],[189,5],[248,5]]},"323":{"position":[[88,4]]},"324":{"position":[[451,5],[1490,5]]},"339":{"position":[[279,4]]},"359":{"position":[[538,6]]},"382":{"position":[[136,4],[255,5],[286,6]]},"389":{"position":[[249,5]]},"395":{"position":[[187,4],[2421,5],[3636,4],[4128,4]]},"404":{"position":[[239,5],[322,5],[442,5],[473,6]]},"405":{"position":[[43,5],[385,4]]},"406":{"position":[[48,4]]},"407":{"position":[[836,7]]},"414":{"position":[[823,5]]},"465":{"position":[[410,5],[420,4],[683,5]]},"466":{"position":[[30,5],[136,5],[292,4]]},"477":{"position":[[249,4]]},"500":{"position":[[174,5]]},"504":{"position":[[237,4]]},"514":{"position":[[308,4],[366,5],[401,4],[1293,5],[3510,5]]},"515":{"position":[[204,5]]},"517":{"position":[[217,4],[399,4],[450,4],[495,5],[542,5],[700,4],[748,5]]},"519":{"position":[[325,4]]},"520":{"position":[[136,4],[250,4],[298,5]]},"521":{"position":[[433,6]]},"522":{"position":[[185,5]]},"523":{"position":[[175,4]]},"524":{"position":[[52,5]]},"528":{"position":[[38,5]]},"529":{"position":[[12,4]]},"530":{"position":[[45,5]]},"531":{"position":[[116,6]]},"532":{"position":[[0,5]]},"533":{"position":[[5,5],[99,5],[189,5],[248,5]]},"541":{"position":[[88,4]]},"542":{"position":[[451,5],[1490,5]]},"559":{"position":[[279,4]]},"575":{"position":[[538,6]]},"624":{"position":[[136,4],[255,5],[286,6]]},"632":{"position":[[187,4],[2421,5],[3636,4],[4128,4]]},"641":{"position":[[239,5],[322,5],[442,5],[473,6]]},"642":{"position":[[43,5],[385,4]]},"643":{"position":[[48,4]]},"644":{"position":[[836,7]]},"651":{"position":[[823,5]]},"659":{"position":[[249,5]]},"699":{"position":[[249,4]]}},"keywords":{}}],["file.contract_nam",{"_index":3046,"title":{},"content":{"324":{"position":[[222,18]]},"542":{"position":[[222,18]]}},"keywords":{}}],["fill",{"_index":2249,"title":{},"content":{"185":{"position":[[2557,6]]},"376":{"position":[[2541,6]]},"592":{"position":[[2541,6]]}},"keywords":{}}],["final",{"_index":718,"title":{},"content":{"31":{"position":[[202,8]]},"32":{"position":[[488,5]]},"43":{"position":[[1767,8]]},"52":{"position":[[6440,8]]},"85":{"position":[[956,8]]},"146":{"position":[[692,8]]},"154":{"position":[[291,7]]},"196":{"position":[[1567,8]]},"210":{"position":[[1049,8]]},"222":{"position":[[0,8],[553,7]]},"248":{"position":[[193,8]]},"254":{"position":[[956,8]]},"334":{"position":[[696,8]]},"339":{"position":[[291,7]]},"389":{"position":[[986,8]]},"395":{"position":[[3614,8]]},"432":{"position":[[1445,8]]},"440":{"position":[[4485,8]]},"447":{"position":[[193,8]]},"455":{"position":[[0,8],[553,7]]},"485":{"position":[[956,8]]},"551":{"position":[[696,8]]},"559":{"position":[[291,7]]},"632":{"position":[[3614,8]]},"659":{"position":[[986,8]]},"674":{"position":[[193,8]]},"679":{"position":[[1445,8]]},"687":{"position":[[4485,8]]},"695":{"position":[[0,8],[553,7]]}},"keywords":{}}],["find",{"_index":223,"title":{},"content":{"7":{"position":[[77,4]]},"26":{"position":[[47,4]]},"28":{"position":[[47,4]]},"36":{"position":[[47,4]]},"46":{"position":[[47,4]]},"48":{"position":[[47,4]]},"53":{"position":[[1274,4]]},"57":{"position":[[47,4]]},"59":{"position":[[47,4]]},"61":{"position":[[48,4]]},"63":{"position":[[48,4]]},"108":{"position":[[303,5]]},"126":{"position":[[1187,4]]},"214":{"position":[[48,4]]},"216":{"position":[[48,4]]},"225":{"position":[[48,4]]},"264":{"position":[[275,4]]},"275":{"position":[[307,5]]},"277":{"position":[[1355,4]]},"382":{"position":[[103,4]]},"395":{"position":[[4321,4]]},"396":{"position":[[141,4]]},"404":{"position":[[275,4]]},"449":{"position":[[48,4]]},"492":{"position":[[307,5]]},"514":{"position":[[1187,4]]},"618":{"position":[[551,4]]},"624":{"position":[[103,4]]},"632":{"position":[[4321,4]]},"633":{"position":[[141,4]]},"641":{"position":[[275,4]]},"726":{"position":[[551,4]]}},"keywords":{}}],["fine",{"_index":2154,"title":{},"content":{"174":{"position":[[381,5]]},"360":{"position":[[381,5]]},"576":{"position":[[381,5]]}},"keywords":{}}],["finish",{"_index":1785,"title":{},"content":{"120":{"position":[[157,8]]},"212":{"position":[[2283,6]]},"301":{"position":[[157,8]]},"391":{"position":[[2283,6]]},"417":{"position":[[845,6]]},"419":{"position":[[7260,6]]},"522":{"position":[[157,8]]},"654":{"position":[[845,6]]},"656":{"position":[[7260,6]]},"661":{"position":[[2283,6]]}},"keywords":{}}],["finish_tim",{"_index":3252,"title":{},"content":{"416":{"position":[[3719,11],[3845,11]]},"419":{"position":[[5298,11],[5424,11],[6286,11],[6412,11]]},"653":{"position":[[3719,11],[3845,11]]},"656":{"position":[[5298,11],[5424,11],[6286,11],[6412,11]]}},"keywords":{}}],["first",{"_index":241,"title":{},"content":{"8":{"position":[[268,5]]},"9":{"position":[[175,6]]},"11":{"position":[[88,5]]},"20":{"position":[[323,5]]},"21":{"position":[[9,5]]},"31":{"position":[[3024,6]]},"32":{"position":[[21,5]]},"40":{"position":[[396,5]]},"42":{"position":[[250,5]]},"51":{"position":[[343,6],[1795,5]]},"52":{"position":[[1763,6]]},"91":{"position":[[18,5]]},"92":{"position":[[4,5],[128,5],[447,6]]},"94":{"position":[[265,5]]},"97":{"position":[[237,5]]},"104":{"position":[[0,5]]},"117":{"position":[[48,5]]},"119":{"position":[[675,5]]},"129":{"position":[[419,6]]},"131":{"position":[[6,5]]},"143":{"position":[[738,5]]},"196":{"position":[[1405,5],[1680,5]]},"198":{"position":[[1282,5],[2111,5],[2184,5],[2881,5]]},"203":{"position":[[369,5]]},"204":{"position":[[1002,5]]},"210":{"position":[[0,6]]},"211":{"position":[[81,5]]},"212":{"position":[[1329,5]]},"247":{"position":[[1909,6]]},"267":{"position":[[4274,5]]},"280":{"position":[[419,6]]},"283":{"position":[[18,5]]},"284":{"position":[[4,5],[128,5],[447,6]]},"286":{"position":[[265,5]]},"289":{"position":[[237,5]]},"296":{"position":[[0,5]]},"298":{"position":[[48,5]]},"300":{"position":[[675,5]]},"311":{"position":[[6,5]]},"324":{"position":[[815,5]]},"328":{"position":[[713,5]]},"389":{"position":[[0,6]]},"390":{"position":[[81,5]]},"391":{"position":[[1329,5]]},"396":{"position":[[4,5]]},"407":{"position":[[4274,5]]},"423":{"position":[[369,5]]},"424":{"position":[[953,5]]},"432":{"position":[[1347,5],[1558,5]]},"434":{"position":[[1272,5],[2101,5],[2174,5],[2871,5]]},"440":{"position":[[5831,5]]},"446":{"position":[[1909,6]]},"495":{"position":[[18,5]]},"496":{"position":[[4,5],[128,5],[447,6]]},"498":{"position":[[265,5]]},"501":{"position":[[237,5]]},"508":{"position":[[0,5]]},"517":{"position":[[419,6]]},"519":{"position":[[48,5]]},"521":{"position":[[675,5]]},"528":{"position":[[6,5]]},"537":{"position":[[713,5]]},"542":{"position":[[815,5]]},"605":{"position":[[458,5]]},"609":{"position":[[44,5]]},"633":{"position":[[4,5]]},"644":{"position":[[4274,5]]},"659":{"position":[[0,6]]},"660":{"position":[[81,5]]},"661":{"position":[[1329,5]]},"665":{"position":[[369,5]]},"666":{"position":[[953,5]]},"673":{"position":[[1909,6]]},"679":{"position":[[1347,5],[1558,5]]},"681":{"position":[[1282,5],[2111,5],[2184,5],[2881,5]]},"687":{"position":[[5831,5]]},"713":{"position":[[458,5]]},"717":{"position":[[44,5]]}},"keywords":{}}],["first.guest",{"_index":226,"title":{},"content":{"7":{"position":[[180,11]]}},"keywords":{}}],["firstli",{"_index":904,"title":{},"content":{"39":{"position":[[272,8]]},"79":{"position":[[1347,8]]},"100":{"position":[[120,7]]},"129":{"position":[[666,7]]},"185":{"position":[[2449,8]]},"195":{"position":[[250,8]]},"230":{"position":[[1364,8]]},"280":{"position":[[667,7]]},"292":{"position":[[120,7]]},"376":{"position":[[2433,8]]},"431":{"position":[[250,8]]},"461":{"position":[[1364,8]]},"504":{"position":[[120,7]]},"517":{"position":[[667,7]]},"592":{"position":[[2433,8]]},"678":{"position":[[250,8]]}},"keywords":{}}],["fit",{"_index":1554,"title":{},"content":{"85":{"position":[[991,3]]},"254":{"position":[[991,3]]},"485":{"position":[[991,3]]}},"keywords":{}}],["fix",{"_index":3468,"title":{},"content":{"440":{"position":[[6524,3]]},"601":{"position":[[1980,5]]},"687":{"position":[[6524,3]]},"709":{"position":[[1980,5]]}},"keywords":{}}],["flag",{"_index":1221,"title":{},"content":{"51":{"position":[[1936,5]]},"179":{"position":[[90,4]]},"265":{"position":[[147,4]]},"322":{"position":[[92,4]]},"370":{"position":[[90,4]]},"405":{"position":[[147,4]]},"540":{"position":[[92,4]]},"586":{"position":[[90,4]]},"642":{"position":[[147,4]]}},"keywords":{}}],["flatten",{"_index":873,"title":{},"content":{"38":{"position":[[574,7]]},"267":{"position":[[851,7]]},"407":{"position":[[851,7]]},"594":{"position":[[587,8]]},"644":{"position":[[851,7]]},"702":{"position":[[587,8]]}},"keywords":{}}],["flexibl",{"_index":148,"title":{},"content":{"3":{"position":[[435,12]]},"33":{"position":[[155,8]]},"81":{"position":[[388,8]]},"232":{"position":[[388,8]]},"463":{"position":[[388,8]]},"612":{"position":[[2071,8]]},"720":{"position":[[2071,8]]}},"keywords":{}}],["flip",{"_index":662,"title":{"178":{"position":[[6,5]]},"369":{"position":[[6,5]]},"585":{"position":[[6,5]]}},"content":{"22":{"position":[[983,6]]},"148":{"position":[[119,10]]},"178":{"position":[[1125,10]]},"336":{"position":[[119,10]]},"369":{"position":[[1125,10]]},"553":{"position":[[119,10]]},"585":{"position":[[1125,10]]}},"keywords":{}}],["flip(&mut",{"_index":482,"title":{},"content":{"17":{"position":[[808,13]]},"22":{"position":[[1261,13]]},"147":{"position":[[1204,13]]},"178":{"position":[[791,13]]},"335":{"position":[[1212,13]]},"369":{"position":[[791,13]]},"552":{"position":[[1212,13]]},"585":{"position":[[791,13]]}},"keywords":{}}],["flipper",{"_index":466,"title":{"144":{"position":[[0,7]]},"177":{"position":[[0,7]]},"332":{"position":[[0,7]]},"368":{"position":[[0,7]]},"549":{"position":[[0,7]]},"584":{"position":[[0,7]]}},"content":{"17":{"position":[[438,7],[618,7]]},"22":{"position":[[855,7],[1101,7],[1163,7]]},"26":{"position":[[29,7]]},"28":{"position":[[29,7]]},"36":{"position":[[29,7]]},"46":{"position":[[29,7]]},"48":{"position":[[29,7]]},"57":{"position":[[29,7]]},"59":{"position":[[29,7]]},"61":{"position":[[29,7]]},"63":{"position":[[29,7]]},"146":{"position":[[138,7]]},"147":{"position":[[155,7]]},"176":{"position":[[81,7]]},"178":{"position":[[152,7],[439,7]]},"214":{"position":[[29,7]]},"216":{"position":[[29,7]]},"225":{"position":[[29,7]]},"334":{"position":[[138,7]]},"335":{"position":[[155,7]]},"362":{"position":[[81,7]]},"369":{"position":[[152,7],[439,7]]},"449":{"position":[[29,7]]},"551":{"position":[[138,7]]},"552":{"position":[[155,7]]},"578":{"position":[[81,7]]},"585":{"position":[[152,7],[439,7]]}},"keywords":{}}],["flipper.r",{"_index":461,"title":{},"content":{"17":{"position":[[322,10]]},"145":{"position":[[0,10]]},"146":{"position":[[0,10]]},"147":{"position":[[0,10],[1003,10]]},"148":{"position":[[0,10]]},"178":{"position":[[0,10]]},"333":{"position":[[0,10]]},"334":{"position":[[0,10]]},"335":{"position":[[0,10],[1011,10]]},"336":{"position":[[0,10]]},"369":{"position":[[0,10]]},"550":{"position":[[0,10]]},"551":{"position":[[0,10]]},"552":{"position":[[0,10],[1011,10]]},"553":{"position":[[0,10]]},"585":{"position":[[0,10]]}},"keywords":{}}],["flipperhostref",{"_index":2002,"title":{},"content":{"148":{"position":[[216,16],[593,14]]},"178":{"position":[[1222,16]]},"336":{"position":[[216,16],[593,14]]},"369":{"position":[[1222,16]]},"553":{"position":[[216,16],[593,14]]},"585":{"position":[[1222,16]]}},"keywords":{}}],["flipperhostref::deploy(&env",{"_index":2003,"title":{},"content":{"148":{"position":[[323,32]]},"178":{"position":[[1329,32],[1522,32],[1580,32]]},"336":{"position":[[323,32]]},"369":{"position":[[1329,32],[1522,32],[1580,32]]},"553":{"position":[[323,32]]},"585":{"position":[[1329,32],[1522,32],[1580,32]]}},"keywords":{}}],["flips_count",{"_index":468,"title":{},"content":{"17":{"position":[[477,12]]}},"keywords":{}}],["flow",{"_index":672,"title":{},"content":{"22":{"position":[[1502,7]]},"40":{"position":[[471,4]]},"441":{"position":[[286,5]]},"688":{"position":[[286,5]]}},"keywords":{}}],["fn",{"_index":238,"title":{},"content":{"8":{"position":[[244,2]]},"9":{"position":[[105,2]]},"10":{"position":[[871,2],[994,2],[1174,2]]},"17":{"position":[[646,2],[739,2],[805,2],[928,2],[999,2],[1076,2],[1395,2],[2240,2],[2509,2],[2590,2],[2691,2],[3084,2],[3697,2],[3846,2]]},"22":{"position":[[1191,2],[1258,2],[1318,2]]},"31":{"position":[[700,2],[841,2],[3159,2],[3425,2]]},"32":{"position":[[366,2],[540,2],[1106,2]]},"39":{"position":[[2260,2]]},"42":{"position":[[679,2],[2089,4],[2153,2],[2405,2]]},"51":{"position":[[592,2],[708,2],[927,2],[1040,2],[1368,2],[1470,2]]},"71":{"position":[[51,2]]},"73":{"position":[[145,2],[344,2],[538,2]]},"74":{"position":[[179,2],[257,2]]},"79":{"position":[[842,2],[963,2]]},"80":{"position":[[365,2],[444,2],[524,2],[718,2]]},"83":{"position":[[564,2],[622,2]]},"115":{"position":[[337,2],[584,2],[650,2],[737,2],[800,2],[837,2],[876,2],[913,2],[956,2],[1013,2],[1107,2],[1150,2],[1214,2],[2180,2],[2482,2],[2548,2],[2625,2],[2689,2],[2754,2],[2814,2]]},"126":{"position":[[1326,2]]},"138":{"position":[[310,2]]},"141":{"position":[[1257,2]]},"142":{"position":[[265,2]]},"143":{"position":[[256,2],[1054,2],[1226,2]]},"147":{"position":[[249,2],[1079,2],[1201,2]]},"148":{"position":[[116,2]]},"151":{"position":[[200,2]]},"157":{"position":[[258,2]]},"160":{"position":[[281,2]]},"162":{"position":[[768,2],[953,2],[1020,2],[1088,2],[1155,2],[1260,2],[2174,2]]},"163":{"position":[[791,2],[939,2]]},"164":{"position":[[556,2],[622,2],[689,2],[751,2],[826,2]]},"168":{"position":[[496,2],[1562,2]]},"178":{"position":[[555,2],[666,2],[788,2],[954,2],[1122,2],[1449,2]]},"185":{"position":[[527,2],[659,2],[838,2],[1032,2],[1228,2],[1474,2],[1623,2],[1904,2],[2174,2]]},"196":{"position":[[84,2]]},"197":{"position":[[50,2],[208,2],[497,2]]},"198":{"position":[[96,2],[339,2],[556,2],[888,2],[1342,2]]},"204":{"position":[[67,2],[318,2],[385,2],[456,2],[527,2],[623,2]]},"205":{"position":[[290,2],[454,2],[690,2],[931,2],[1041,2],[1199,2],[1626,2]]},"206":{"position":[[268,2],[528,2],[1084,2],[1722,2],[2050,2],[3323,2]]},"209":{"position":[[961,2],[1242,2]]},"212":{"position":[[634,2],[1443,2],[2528,2],[2814,2],[3222,2],[3800,2],[4038,2]]},"221":{"position":[[77,2],[152,2],[261,2]]},"222":{"position":[[94,2],[243,2]]},"223":{"position":[[466,2],[615,2],[671,2],[731,2],[881,2]]},"230":{"position":[[859,2],[980,2]]},"231":{"position":[[365,2],[444,2],[524,2],[718,2]]},"235":{"position":[[51,2]]},"237":{"position":[[145,2],[344,2],[538,2]]},"238":{"position":[[179,2],[257,2]]},"247":{"position":[[102,2],[321,2],[379,2],[441,2],[503,2],[575,2],[673,2],[797,2],[916,2],[1073,2],[1186,2],[1257,2],[1367,2]]},"252":{"position":[[564,2],[622,2]]},"258":{"position":[[327,2],[570,2],[632,2],[715,2],[774,2],[807,2],[842,2],[875,2],[914,2],[967,2],[1057,2],[1096,2],[1160,2],[2126,2],[2424,2],[2486,2],[2559,2],[2619,2],[2680,2],[2740,2]]},"267":{"position":[[2029,2],[2105,2],[2259,2],[2515,2],[2588,2],[2722,2],[2791,4],[2854,2],[3061,2],[3881,2]]},"268":{"position":[[2363,2]]},"269":{"position":[[555,2],[1036,2],[1200,2],[1436,2],[1677,2],[1787,2],[1930,2],[2157,2],[2490,2],[2859,2],[4172,2],[4438,2],[4994,2],[5632,2]]},"277":{"position":[[1494,2]]},"318":{"position":[[302,2]]},"321":{"position":[[1118,2],[1336,2],[1490,2]]},"326":{"position":[[1257,2]]},"327":{"position":[[265,2]]},"328":{"position":[[256,2],[1029,2],[1201,2]]},"330":{"position":[[249,2]]},"335":{"position":[[249,2],[1087,2],[1209,2]]},"336":{"position":[[116,2]]},"342":{"position":[[200,2]]},"345":{"position":[[281,2]]},"348":{"position":[[496,2],[1562,2]]},"351":{"position":[[790,2],[975,2],[1042,2],[1110,2],[1177,2],[1282,2],[2196,2]]},"352":{"position":[[813,2],[961,2]]},"353":{"position":[[591,2],[657,2],[724,2],[786,2],[861,2]]},"369":{"position":[[555,2],[666,2],[788,2],[954,2],[1122,2],[1449,2]]},"376":{"position":[[511,2],[643,2],[822,2],[1016,2],[1212,2],[1458,2],[1607,2],[1888,2],[2158,2]]},"384":{"position":[[568,2],[1049,2],[1213,2],[1449,2],[1690,2],[1807,2],[1950,2],[2177,2],[2517,2],[2893,2]]},"388":{"position":[[893,2],[1174,2]]},"391":{"position":[[634,2],[1443,2],[2528,2],[2820,2],[3240,2],[3818,2],[4056,2]]},"395":{"position":[[536,2],[1770,2],[2216,2]]},"407":{"position":[[2029,2],[2105,2],[2259,2],[2515,2],[2588,2],[2722,2],[2791,4],[2854,2],[3061,2],[3881,2]]},"408":{"position":[[2363,2]]},"409":{"position":[[555,2],[1036,2],[1200,2],[1436,2],[1677,2],[1787,2],[1930,2],[2157,2],[2490,2],[2859,2],[4172,2],[4438,2],[4994,2],[5632,2]]},"414":{"position":[[371,2],[404,2]]},"416":{"position":[[1416,2],[2664,2],[3494,2]]},"417":{"position":[[137,2]]},"419":{"position":[[1367,2],[2181,2],[2349,2],[2419,2],[2505,2],[2581,2],[2666,2],[2803,2],[2969,2],[3102,2],[3247,2],[3382,2],[3538,2],[3696,2],[3821,2],[3935,2],[4619,2],[5073,2],[6145,2],[6552,2]]},"424":{"position":[[42,2],[293,2],[360,2],[431,2],[502,2],[598,2]]},"425":{"position":[[265,2],[429,2],[665,2],[906,2],[1016,2],[1174,2],[1601,2]]},"426":{"position":[[268,2],[528,2],[1079,2],[1712,2],[2040,2],[3298,2]]},"432":{"position":[[46,2]]},"433":{"position":[[50,2],[208,2],[497,2]]},"434":{"position":[[96,2],[339,2],[551,2],[878,2],[1332,2]]},"440":{"position":[[1154,2],[1618,2],[2236,2],[3248,2],[4943,2],[6242,2]]},"441":{"position":[[885,2],[1075,2],[1530,2],[2468,2],[2830,2],[3111,2],[3557,2],[3661,2],[4768,2],[5715,2]]},"446":{"position":[[102,2],[321,2],[379,2],[441,2],[503,2],[575,2],[673,2],[797,2],[916,2],[1073,2],[1186,2],[1257,2],[1367,2]]},"454":{"position":[[77,2],[152,2],[261,2]]},"455":{"position":[[94,2],[243,2]]},"456":{"position":[[466,2],[615,2],[671,2],[731,2],[881,2]]},"461":{"position":[[859,2],[980,2]]},"462":{"position":[[365,2],[444,2],[524,2],[718,2]]},"471":{"position":[[51,2]]},"473":{"position":[[145,2],[344,2],[538,2]]},"474":{"position":[[179,2],[257,2]]},"476":{"position":[[494,2],[644,2],[1218,2],[1346,2],[1473,2]]},"477":{"position":[[1701,2]]},"481":{"position":[[327,2],[570,2],[632,2],[715,2],[774,2],[807,2],[842,2],[875,2],[914,2],[967,2],[1057,2],[1096,2],[1160,2],[2126,2],[2424,2],[2486,2],[2559,2],[2619,2],[2680,2],[2740,2]]},"483":{"position":[[564,2],[622,2]]},"514":{"position":[[1326,2]]},"535":{"position":[[1257,2]]},"536":{"position":[[265,2]]},"537":{"position":[[256,2],[1029,2],[1201,2]]},"539":{"position":[[1118,2],[1336,2],[1490,2]]},"544":{"position":[[302,2]]},"547":{"position":[[258,2]]},"552":{"position":[[249,2],[1087,2],[1209,2]]},"553":{"position":[[116,2]]},"556":{"position":[[200,2]]},"562":{"position":[[281,2]]},"564":{"position":[[496,2],[1562,2]]},"567":{"position":[[790,2],[975,2],[1042,2],[1110,2],[1177,2],[1282,2],[2196,2]]},"568":{"position":[[813,2],[961,2]]},"569":{"position":[[591,2],[657,2],[724,2],[786,2],[861,2]]},"585":{"position":[[555,2],[666,2],[788,2],[954,2],[1122,2],[1449,2]]},"592":{"position":[[511,2],[643,2],[822,2],[1016,2],[1212,2],[1458,2],[1607,2],[1888,2],[2158,2]]},"596":{"position":[[311,2],[384,2]]},"598":{"position":[[682,2],[1149,2],[1232,2],[1317,2],[1461,2]]},"600":{"position":[[191,2],[303,2]]},"601":{"position":[[204,2],[454,2],[545,2],[770,2],[894,2],[1003,2],[1323,2],[1436,2],[1507,2],[1631,2],[1736,2]]},"602":{"position":[[254,2],[322,2],[393,2],[461,2],[1290,2],[1388,2],[1553,2],[1767,2]]},"604":{"position":[[145,2],[317,2]]},"605":{"position":[[128,2],[207,2]]},"606":{"position":[[164,2],[332,2],[474,2]]},"608":{"position":[[188,2],[273,2],[303,2],[337,2],[514,2]]},"610":{"position":[[217,2]]},"611":{"position":[[225,2],[349,2]]},"612":{"position":[[521,2],[668,2],[815,2],[985,2],[1142,2],[1300,2]]},"613":{"position":[[123,2],[383,2],[525,2],[615,2],[945,2]]},"616":{"position":[[193,2],[685,2],[974,2]]},"617":{"position":[[178,2],[275,2],[691,2]]},"626":{"position":[[568,2],[1049,2],[1213,2],[1449,2],[1690,2],[1807,2],[1950,2],[2177,2],[2517,2],[2893,2]]},"632":{"position":[[536,2],[1770,2],[2216,2]]},"644":{"position":[[2029,2],[2105,2],[2259,2],[2515,2],[2588,2],[2722,2],[2791,4],[2854,2],[3061,2],[3881,2]]},"645":{"position":[[2363,2]]},"646":{"position":[[555,2],[1036,2],[1200,2],[1436,2],[1677,2],[1787,2],[1930,2],[2157,2],[2490,2],[2859,2],[4172,2],[4438,2],[4994,2],[5632,2]]},"651":{"position":[[371,2],[404,2]]},"653":{"position":[[1416,2],[2664,2],[3494,2]]},"654":{"position":[[137,2]]},"656":{"position":[[1367,2],[2181,2],[2349,2],[2419,2],[2505,2],[2581,2],[2666,2],[2803,2],[2969,2],[3102,2],[3247,2],[3382,2],[3538,2],[3696,2],[3821,2],[3935,2],[4619,2],[5073,2],[6145,2],[6552,2]]},"658":{"position":[[893,2],[1174,2]]},"661":{"position":[[634,2],[1443,2],[2528,2],[2820,2],[3240,2],[3818,2],[4056,2]]},"666":{"position":[[42,2],[293,2],[360,2],[431,2],[502,2],[598,2]]},"667":{"position":[[265,2],[429,2],[665,2],[906,2],[1016,2],[1174,2],[1601,2]]},"668":{"position":[[268,2],[528,2],[1084,2],[1722,2],[2050,2],[3323,2]]},"673":{"position":[[102,2],[321,2],[379,2],[441,2],[503,2],[575,2],[673,2],[797,2],[916,2],[1073,2],[1186,2],[1257,2],[1367,2]]},"679":{"position":[[46,2]]},"680":{"position":[[50,2],[208,2],[497,2]]},"681":{"position":[[96,2],[339,2],[556,2],[888,2],[1342,2]]},"687":{"position":[[1154,2],[1618,2],[2236,2],[3248,2],[4943,2],[6242,2]]},"688":{"position":[[885,2],[1075,2],[1530,2],[2468,2],[2830,2],[3111,2],[3557,2],[3661,2],[4768,2],[5715,2]]},"694":{"position":[[77,2],[152,2],[261,2]]},"695":{"position":[[94,2],[243,2]]},"696":{"position":[[466,2],[615,2],[671,2],[731,2],[881,2]]},"698":{"position":[[494,2],[644,2],[1218,2],[1346,2],[1473,2]]},"699":{"position":[[1701,2]]},"704":{"position":[[311,2],[384,2]]},"706":{"position":[[682,2],[1149,2],[1232,2],[1317,2],[1461,2]]},"708":{"position":[[191,2],[303,2]]},"709":{"position":[[204,2],[454,2],[545,2],[770,2],[894,2],[1003,2],[1323,2],[1436,2],[1507,2],[1631,2],[1736,2]]},"710":{"position":[[254,2],[322,2],[393,2],[461,2],[1290,2],[1388,2],[1553,2],[1767,2]]},"712":{"position":[[145,2],[317,2]]},"713":{"position":[[128,2],[207,2]]},"714":{"position":[[164,2],[332,2],[474,2]]},"716":{"position":[[188,2],[273,2],[303,2],[337,2],[514,2]]},"718":{"position":[[217,2]]},"719":{"position":[[225,2],[349,2]]},"720":{"position":[[521,2],[668,2],[815,2],[985,2],[1142,2],[1300,2]]},"721":{"position":[[123,2],[383,2],[525,2],[615,2],[945,2]]},"724":{"position":[[193,2],[685,2],[974,2]]},"725":{"position":[[178,2],[275,2],[691,2]]}},"keywords":{}}],["fn_name",{"_index":1001,"title":{},"content":{"39":{"position":[[2910,8],[2958,8]]}},"keywords":{}}],["fncontext",{"_index":984,"title":{},"content":{"39":{"position":[[2457,10]]}},"keywords":{}}],["focu",{"_index":28,"title":{},"content":{"1":{"position":[[280,5],[527,5]]},"22":{"position":[[236,5]]},"38":{"position":[[224,5]]}},"keywords":{}}],["focus",{"_index":869,"title":{},"content":{"38":{"position":[[423,7]]},"365":{"position":[[250,7]]},"581":{"position":[[250,7]]}},"keywords":{}}],["folder",{"_index":1755,"title":{},"content":{"117":{"position":[[218,6],[356,7],[1026,6],[1393,7]]},"120":{"position":[[215,7]]},"121":{"position":[[251,7],[276,6],[314,6]]},"126":{"position":[[420,7],[533,6]]},"133":{"position":[[12,6]]},"134":{"position":[[12,6]]},"164":{"position":[[1238,7]]},"175":{"position":[[123,6]]},"277":{"position":[[420,7],[533,6]]},"298":{"position":[[218,6],[356,7],[1026,6],[1393,7]]},"301":{"position":[[215,7]]},"302":{"position":[[251,7],[276,6],[314,6]]},"313":{"position":[[12,6]]},"314":{"position":[[12,6]]},"353":{"position":[[1273,7]]},"361":{"position":[[123,6]]},"395":{"position":[[203,7]]},"514":{"position":[[420,7],[533,6]]},"519":{"position":[[218,6],[356,7],[1026,6],[1393,7]]},"522":{"position":[[215,7]]},"523":{"position":[[251,7],[276,6],[314,6]]},"530":{"position":[[12,6]]},"531":{"position":[[12,6]]},"569":{"position":[[1273,7]]},"577":{"position":[[123,6]]},"632":{"position":[[203,7]]}},"keywords":{}}],["follow",{"_index":1065,"title":{},"content":{"42":{"position":[[1400,10]]},"65":{"position":[[52,9]]},"67":{"position":[[108,9]]},"68":{"position":[[192,9]]},"79":{"position":[[490,9]]},"97":{"position":[[319,9]]},"103":{"position":[[52,9]]},"115":{"position":[[13,9]]},"162":{"position":[[2432,9]]},"173":{"position":[[49,9]]},"174":{"position":[[216,9]]},"179":{"position":[[30,9]]},"198":{"position":[[2953,8]]},"202":{"position":[[125,9]]},"211":{"position":[[569,8]]},"212":{"position":[[1867,8],[3555,8]]},"230":{"position":[[507,9]]},"240":{"position":[[52,9]]},"242":{"position":[[109,9]]},"243":{"position":[[192,9]]},"258":{"position":[[13,9]]},"261":{"position":[[146,9]]},"289":{"position":[[319,9]]},"295":{"position":[[52,9]]},"322":{"position":[[31,9]]},"351":{"position":[[2454,9]]},"359":{"position":[[49,9]]},"360":{"position":[[216,9]]},"370":{"position":[[30,9]]},"379":{"position":[[146,9]]},"383":{"position":[[116,9]]},"390":{"position":[[543,8]]},"391":{"position":[[1867,8],[3573,8]]},"393":{"position":[[88,6]]},"395":{"position":[[3650,9]]},"401":{"position":[[146,9]]},"422":{"position":[[125,9]]},"434":{"position":[[2935,8]]},"438":{"position":[[43,9]]},"440":{"position":[[4619,8]]},"461":{"position":[[507,9]]},"465":{"position":[[52,9]]},"467":{"position":[[109,9]]},"468":{"position":[[192,9]]},"477":{"position":[[2315,9]]},"481":{"position":[[13,9]]},"501":{"position":[[319,9]]},"507":{"position":[[52,9]]},"540":{"position":[[31,9]]},"567":{"position":[[2454,9]]},"575":{"position":[[49,9]]},"576":{"position":[[216,9]]},"586":{"position":[[30,9]]},"595":{"position":[[3,6]]},"596":{"position":[[72,9]]},"612":{"position":[[130,6]]},"621":{"position":[[146,9]]},"625":{"position":[[116,9]]},"630":{"position":[[88,6]]},"632":{"position":[[3650,9]]},"638":{"position":[[146,9]]},"660":{"position":[[543,8]]},"661":{"position":[[1867,8],[3573,8]]},"664":{"position":[[125,9]]},"681":{"position":[[2953,8]]},"685":{"position":[[43,9]]},"687":{"position":[[4619,8]]},"699":{"position":[[2315,9]]},"703":{"position":[[3,6]]},"704":{"position":[[72,9]]},"720":{"position":[[130,6]]}},"keywords":{}}],["foo",{"_index":3082,"title":{},"content":{"354":{"position":[[607,3]]},"570":{"position":[[607,3]]}},"keywords":{}}],["foo(&self",{"_index":3812,"title":{},"content":{"612":{"position":[[524,14],[671,14],[818,14],[988,14],[1145,14],[1303,14]]},"720":{"position":[[524,14],[671,14],[818,14],[988,14],[1145,14],[1303,14]]}},"keywords":{}}],["forc",{"_index":2788,"title":{},"content":{"261":{"position":[[192,5]]},"379":{"position":[[192,5]]},"401":{"position":[[192,5]]},"621":{"position":[[192,5]]},"638":{"position":[[192,5]]}},"keywords":{}}],["forget",{"_index":1321,"title":{},"content":{"54":{"position":[[445,6]]},"91":{"position":[[903,6]]},"283":{"position":[[901,6]]},"321":{"position":[[272,6]]},"495":{"position":[[901,6]]},"539":{"position":[[272,6]]}},"keywords":{}}],["fork",{"_index":591,"title":{},"content":{"20":{"position":[[502,5]]}},"keywords":{}}],["form",{"_index":577,"title":{},"content":{"20":{"position":[[154,6]]},"52":{"position":[[3123,4]]},"70":{"position":[[264,4]]},"234":{"position":[[264,4]]},"470":{"position":[[264,4]]}},"keywords":{}}],["format",{"_index":1556,"title":{},"content":{"85":{"position":[[1057,7]]},"121":{"position":[[188,6]]},"254":{"position":[[1057,7]]},"302":{"position":[[188,6]]},"485":{"position":[[1057,7]]},"523":{"position":[[188,6]]}},"keywords":{}}],["format!("cep78_{}"",{"_index":3377,"title":{},"content":{"440":{"position":[[1290,29]]},"687":{"position":[[1290,29]]}},"keywords":{}}],["format!("error",{"_index":360,"title":{},"content":{"10":{"position":[[1403,20]]}},"keywords":{}}],["former",{"_index":2883,"title":{},"content":{"267":{"position":[[3694,7],[3792,7]]},"407":{"position":[[3694,7],[3792,7]]},"644":{"position":[[3694,7],[3792,7]]}},"keywords":{}}],["forward",{"_index":381,"title":{},"content":{"12":{"position":[[79,8]]},"111":{"position":[[341,10]]},"306":{"position":[[341,10]]},"441":{"position":[[1935,8]]},"511":{"position":[[341,10]]},"688":{"position":[[1935,8]]}},"keywords":{}}],["found",{"_index":445,"title":{},"content":{"16":{"position":[[362,5]]},"168":{"position":[[2228,5]]},"348":{"position":[[2238,5]]},"395":{"position":[[4612,5]]},"476":{"position":[[1921,5]]},"477":{"position":[[2626,5]]},"564":{"position":[[2228,5]]},"632":{"position":[[4612,5]]},"698":{"position":[[1921,5]]},"699":{"position":[[2626,5]]}},"keywords":{}}],["four",{"_index":42,"title":{},"content":{"1":{"position":[[536,4]]},"39":{"position":[[236,4]]},"611":{"position":[[568,4]]},"719":{"position":[[568,4]]}},"keywords":{}}],["fqn",{"_index":1891,"title":{},"content":{"132":{"position":[[143,3],[224,3]]},"154":{"position":[[176,3],[329,3],[377,3]]},"266":{"position":[[139,3]]},"312":{"position":[[143,3],[224,3]]},"339":{"position":[[176,3],[329,3],[377,3]]},"406":{"position":[[139,3]]},"529":{"position":[[143,3],[224,3]]},"559":{"position":[[176,3],[329,3],[377,3]]},"643":{"position":[[139,3]]}},"keywords":{}}],["framework",{"_index":416,"title":{"22":{"position":[[5,10]]},"25":{"position":[[5,9]]},"27":{"position":[[5,9]]},"35":{"position":[[5,9]]},"45":{"position":[[5,9]]},"47":{"position":[[5,9]]},"56":{"position":[[5,9]]},"58":{"position":[[5,9]]},"60":{"position":[[5,9]]},"62":{"position":[[5,9]]},"193":{"position":[[0,9]]},"201":{"position":[[0,9]]},"213":{"position":[[5,9]]},"215":{"position":[[5,9]]},"224":{"position":[[5,9]]},"421":{"position":[[0,9]]},"429":{"position":[[0,9]]},"448":{"position":[[5,9]]},"663":{"position":[[0,9]]},"676":{"position":[[0,9]]}},"content":{"15":{"position":[[382,9],[483,9]]},"18":{"position":[[265,10]]},"22":{"position":[[36,9],[371,9]]},"38":{"position":[[54,9],[549,9],[858,9]]},"39":{"position":[[393,10]]},"65":{"position":[[550,9]]},"106":{"position":[[43,10]]},"148":{"position":[[872,10]]},"162":{"position":[[59,10]]},"164":{"position":[[1065,9]]},"175":{"position":[[523,10]]},"188":{"position":[[139,10],[533,10]]},"240":{"position":[[550,9]]},"248":{"position":[[9,9]]},"267":{"position":[[91,10]]},"273":{"position":[[43,10]]},"336":{"position":[[872,10]]},"351":{"position":[[59,10]]},"353":{"position":[[1100,9]]},"361":{"position":[[523,10]]},"365":{"position":[[496,10],[890,10]]},"407":{"position":[[91,10]]},"447":{"position":[[9,9]]},"465":{"position":[[550,9]]},"490":{"position":[[43,10]]},"553":{"position":[[872,10]]},"567":{"position":[[59,10]]},"569":{"position":[[1100,9]]},"577":{"position":[[523,10]]},"581":{"position":[[496,10],[890,10]]},"594":{"position":[[173,9],[563,9]]},"618":{"position":[[98,10],[416,10],[452,9]]},"644":{"position":[[91,10]]},"674":{"position":[[9,9]]},"702":{"position":[[173,9],[563,9]]},"726":{"position":[[98,10],[416,10],[452,9]]}},"keywords":{}}],["framework/sdk",{"_index":1016,"title":{},"content":{"40":{"position":[[165,13]]}},"keywords":{}}],["free",{"_index":104,"title":{},"content":{"2":{"position":[[284,4]]},"22":{"position":[[299,4]]},"110":{"position":[[421,4]]},"126":{"position":[[2978,5]]},"128":{"position":[[170,5],[435,5]]},"175":{"position":[[596,4]]},"277":{"position":[[3146,5]]},"279":{"position":[[170,5],[435,5]]},"305":{"position":[[421,4]]},"361":{"position":[[596,4]]},"394":{"position":[[149,5]]},"398":{"position":[[323,4]]},"510":{"position":[[421,4]]},"514":{"position":[[2978,5]]},"516":{"position":[[170,5],[435,5]]},"577":{"position":[[596,4]]},"618":{"position":[[716,4]]},"631":{"position":[[149,5]]},"635":{"position":[[323,4]]},"726":{"position":[[716,4]]}},"keywords":{}}],["freeli",{"_index":1624,"title":{},"content":{"95":{"position":[[176,6]]},"287":{"position":[[176,6]]},"499":{"position":[[176,6]]}},"keywords":{}}],["freez",{"_index":2747,"title":{},"content":{"223":{"position":[[1302,6]]},"456":{"position":[[1302,6]]},"696":{"position":[[1302,6]]}},"keywords":{}}],["fresh",{"_index":1631,"title":{},"content":{"95":{"position":[[485,5]]},"287":{"position":[[485,5]]},"499":{"position":[[485,5]]}},"keywords":{}}],["friend",{"_index":2083,"title":{},"content":{"163":{"position":[[253,7],[428,8],[531,7]]},"352":{"position":[[253,7],[450,8],[553,7]]},"568":{"position":[[253,7],[450,8],[553,7]]}},"keywords":{}}],["friend_nam",{"_index":2087,"title":{},"content":{"163":{"position":[[815,12],[960,12]]},"352":{"position":[[837,12],[982,12]]},"568":{"position":[[837,12],[982,12]]}},"keywords":{}}],["friendli",{"_index":628,"title":{},"content":{"21":{"position":[[206,8]]}},"keywords":{}}],["from_bal",{"_index":531,"title":{},"content":{"17":{"position":[[2785,12],[2900,12],[3007,12],[3200,12],[3379,12],[3564,12]]}},"keywords":{}}],["from_slice(&receipt.journ",{"_index":289,"title":{},"content":{"9":{"position":[[831,32]]}},"keywords":{}}],["from_slice(receipt.journal.as_slice()).unwrap",{"_index":847,"title":{},"content":{"32":{"position":[[1575,48]]}},"keywords":{}}],["frombyt",{"_index":2748,"title":{},"content":{"229":{"position":[[238,9]]},"460":{"position":[[238,9]]}},"keywords":{}}],["frombytes>(&self",{"_index":2849,"title":{},"content":{"267":{"position":[[2124,24],[3084,24]]},"407":{"position":[[2124,24],[3084,24]]},"644":{"position":[[2124,24],[3084,24]]}},"keywords":{}}],["frombytes>(address",{"_index":2871,"title":{},"content":{"267":{"position":[[2940,22]]},"407":{"position":[[2940,22]]},"644":{"position":[[2940,22]]}},"keywords":{}}],["frombytes>(key",{"_index":2847,"title":{},"content":{"267":{"position":[[2046,18]]},"407":{"position":[[2046,18]]},"644":{"position":[[2046,18]]}},"keywords":{}}],["full",{"_index":221,"title":{},"content":{"7":{"position":[[52,4]]},"42":{"position":[[2789,4]]},"43":{"position":[[627,4]]},"52":{"position":[[560,4]]},"117":{"position":[[556,4],[794,4]]},"168":{"position":[[2198,4]]},"248":{"position":[[216,4]]},"298":{"position":[[556,4],[794,4]]},"348":{"position":[[2208,4]]},"447":{"position":[[216,4]]},"476":{"position":[[1904,4]]},"519":{"position":[[556,4],[794,4]]},"564":{"position":[[2198,4]]},"618":{"position":[[389,4]]},"674":{"position":[[216,4]]},"698":{"position":[[1904,4]]},"726":{"position":[[389,4]]}},"keywords":{}}],["fulli",{"_index":1223,"title":{},"content":{"52":{"position":[[51,5]]},"66":{"position":[[335,5]]},"132":{"position":[[228,6]]},"241":{"position":[[335,5]]},"312":{"position":[[228,6]]},"466":{"position":[[335,5]]},"529":{"position":[[228,6]]}},"keywords":{}}],["fun",{"_index":1233,"title":{},"content":{"52":{"position":[[418,3]]}},"keywords":{}}],["function",{"_index":687,"title":{"604":{"position":[[0,10]]},"614":{"position":[[21,10]]},"712":{"position":[[0,10]]},"722":{"position":[[21,10]]}},"content":{"30":{"position":[[77,10],[189,8],[272,8]]},"31":{"position":[[451,8],[2865,8],[3006,8]]},"39":{"position":[[2151,10]]},"42":{"position":[[995,8],[1116,8]]},"43":{"position":[[378,8],[470,8]]},"50":{"position":[[297,13]]},"52":{"position":[[57,10]]},"70":{"position":[[161,9]]},"71":{"position":[[620,9]]},"72":{"position":[[67,8],[430,10],[513,9]]},"74":{"position":[[2,8]]},"78":{"position":[[291,9]]},"79":{"position":[[1474,9]]},"84":{"position":[[380,9]]},"92":{"position":[[624,8]]},"94":{"position":[[246,8],[373,8]]},"107":{"position":[[192,9]]},"108":{"position":[[101,9]]},"110":{"position":[[174,10],[352,9],[515,9]]},"111":{"position":[[61,9]]},"114":{"position":[[126,9],[283,9],[335,9]]},"115":{"position":[[1448,9],[1578,14],[1632,15],[1800,16],[3056,9],[3130,13]]},"128":{"position":[[470,8]]},"138":{"position":[[850,9]]},"141":{"position":[[644,9],[1170,8]]},"143":{"position":[[915,8]]},"147":{"position":[[408,9],[501,9],[671,9],[743,8],[804,8],[913,8],[1388,8]]},"148":{"position":[[574,8],[778,9]]},"157":{"position":[[32,9],[584,8],[812,10]]},"160":{"position":[[89,8]]},"162":{"position":[[661,10],[1435,9],[1692,9],[2118,9]]},"163":{"position":[[1098,13]]},"164":{"position":[[373,9],[402,8]]},"168":{"position":[[30,9],[1441,8],[1514,9],[2211,9]]},"182":{"position":[[42,15]]},"185":{"position":[[3069,8],[3096,9],[3217,8],[3376,8],[3525,9],[3546,9]]},"189":{"position":[[338,9],[538,9],[702,10]]},"194":{"position":[[36,15],[202,8]]},"196":{"position":[[685,8],[1162,8],[1652,9]]},"197":{"position":[[1092,8],[1237,9],[1325,9],[1532,8],[1642,9]]},"198":{"position":[[1251,9],[1724,8],[1992,9],[2261,9],[2687,8],[3295,9],[3627,9],[3677,9],[3920,9]]},"204":{"position":[[1049,9],[1233,9],[1314,8]]},"205":{"position":[[24,14]]},"218":{"position":[[39,15]]},"221":{"position":[[773,8],[872,8]]},"222":{"position":[[414,9]]},"223":{"position":[[1244,8]]},"229":{"position":[[312,9]]},"230":{"position":[[1491,9]]},"234":{"position":[[161,9]]},"235":{"position":[[620,9]]},"236":{"position":[[67,8],[430,10],[513,9]]},"238":{"position":[[2,8]]},"253":{"position":[[380,9]]},"257":{"position":[[126,9],[283,9],[335,9]]},"258":{"position":[[1394,9],[1524,14],[1578,15],[1746,16],[2982,9],[3056,13]]},"267":{"position":[[2504,10],[4123,8],[4189,9]]},"268":{"position":[[812,9],[2150,8],[2221,8]]},"269":{"position":[[1770,12]]},"274":{"position":[[192,9]]},"275":{"position":[[105,9]]},"279":{"position":[[470,8]]},"284":{"position":[[624,8]]},"286":{"position":[[246,8],[373,8]]},"305":{"position":[[174,10],[352,9],[515,9]]},"306":{"position":[[61,9]]},"318":{"position":[[842,9]]},"324":{"position":[[911,9],[1071,8],[1142,8],[1406,9],[1572,10]]},"326":{"position":[[644,9],[1170,8]]},"328":{"position":[[890,8]]},"330":{"position":[[32,9],[570,8],[788,10]]},"335":{"position":[[412,9],[505,9],[679,9],[751,8],[812,8],[921,8],[1396,8]]},"336":{"position":[[574,8],[778,9]]},"345":{"position":[[89,8]]},"348":{"position":[[30,9],[1441,8],[1514,9],[2221,9]]},"351":{"position":[[698,10],[1457,9],[1714,9],[2140,9]]},"352":{"position":[[1120,13]]},"353":{"position":[[408,9],[437,8]]},"366":{"position":[[338,9],[538,9],[702,10]]},"373":{"position":[[42,15]]},"376":{"position":[[3053,8],[3080,9],[3201,8],[3360,8],[3509,9],[3530,9]]},"384":{"position":[[1790,12]]},"407":{"position":[[2504,10],[4123,8],[4189,9]]},"408":{"position":[[812,9],[2150,8],[2221,8]]},"409":{"position":[[1770,12]]},"414":{"position":[[304,9]]},"416":{"position":[[1327,8],[2089,9]]},"419":{"position":[[1650,9],[2166,14]]},"424":{"position":[[1000,9],[1183,9],[1264,8]]},"425":{"position":[[24,14]]},"430":{"position":[[36,15],[202,8]]},"432":{"position":[[622,8],[1105,8],[1530,9]]},"433":{"position":[[1091,8],[1236,9],[1324,9],[1531,8],[1641,9]]},"434":{"position":[[1241,9],[1714,8],[1982,9],[2251,9],[2677,8],[3277,9],[3609,9],[3659,9],[3902,9]]},"440":{"position":[[3947,8],[4096,8],[4149,8],[4306,8],[4360,8],[4498,8],[6034,8]]},"441":{"position":[[1768,8],[1843,8],[1926,8],[3853,8],[4016,9],[4137,9],[4279,10]]},"442":{"position":[[187,10]]},"451":{"position":[[39,15]]},"454":{"position":[[773,8],[872,8]]},"455":{"position":[[414,9]]},"456":{"position":[[1244,8]]},"460":{"position":[[312,9]]},"461":{"position":[[1491,9]]},"470":{"position":[[161,9]]},"471":{"position":[[620,9]]},"472":{"position":[[67,8],[430,10],[513,9]]},"474":{"position":[[2,8]]},"478":{"position":[[80,8]]},"480":{"position":[[126,9],[283,9],[335,9]]},"481":{"position":[[1394,9],[1524,14],[1578,15],[1746,16],[2982,9],[3056,13]]},"484":{"position":[[380,9]]},"491":{"position":[[192,9]]},"492":{"position":[[105,9]]},"496":{"position":[[624,8]]},"498":{"position":[[246,8],[373,8]]},"510":{"position":[[174,10],[352,9],[515,9]]},"511":{"position":[[61,9]]},"516":{"position":[[470,8]]},"535":{"position":[[644,9],[1170,8]]},"537":{"position":[[890,8]]},"542":{"position":[[911,9],[1071,8],[1142,8],[1406,9],[1572,10]]},"544":{"position":[[842,9]]},"547":{"position":[[32,9],[584,8],[812,10]]},"552":{"position":[[412,9],[505,9],[679,9],[751,8],[812,8],[921,8],[1396,8]]},"553":{"position":[[574,8],[778,9]]},"562":{"position":[[89,8]]},"564":{"position":[[30,9],[1441,8],[1514,9],[2211,9]]},"567":{"position":[[698,10],[1457,9],[1714,9],[2140,9]]},"568":{"position":[[1120,13]]},"569":{"position":[[408,9],[437,8]]},"582":{"position":[[338,9],[538,9],[702,10]]},"589":{"position":[[42,15]]},"592":{"position":[[3053,8],[3080,9],[3201,8],[3360,8],[3509,9],[3530,9]]},"596":{"position":[[767,10],[911,10],[1164,9]]},"600":{"position":[[640,9],[754,8],[1216,9]]},"602":{"position":[[830,10],[922,9]]},"604":{"position":[[53,9],[118,9],[463,9],[537,9]]},"605":{"position":[[299,9],[325,9],[355,9],[560,8],[640,8]]},"606":{"position":[[583,8],[627,9],[691,8],[749,9],[801,9],[911,9],[950,8]]},"607":{"position":[[0,9],[94,9],[360,9]]},"608":{"position":[[647,8],[713,8],[792,9]]},"609":{"position":[[20,8],[84,8],[119,8],[336,9]]},"610":{"position":[[714,9]]},"611":{"position":[[700,8],[739,9],[753,8],[828,9]]},"613":{"position":[[1406,9],[1451,8],[1580,8],[1706,9],[1875,10],[2038,9],[2167,8]]},"614":{"position":[[85,9],[109,8],[198,8],[270,8],[381,10],[418,8],[484,8]]},"616":{"position":[[1220,8],[1281,8],[1344,9]]},"617":{"position":[[972,8]]},"626":{"position":[[1790,12]]},"644":{"position":[[2504,10],[4123,8],[4189,9]]},"645":{"position":[[812,9],[2150,8],[2221,8]]},"646":{"position":[[1770,12]]},"651":{"position":[[304,9]]},"653":{"position":[[1327,8],[2089,9]]},"656":{"position":[[1650,9],[2166,14]]},"666":{"position":[[1000,9],[1183,9],[1264,8]]},"667":{"position":[[24,14]]},"677":{"position":[[36,15],[202,8]]},"679":{"position":[[622,8],[1105,8],[1530,9]]},"680":{"position":[[1091,8],[1236,9],[1324,9],[1531,8],[1641,9]]},"681":{"position":[[1251,9],[1724,8],[1992,9],[2261,9],[2687,8],[3295,9],[3627,9],[3677,9],[3920,9]]},"687":{"position":[[3947,8],[4096,8],[4149,8],[4306,8],[4360,8],[4498,8],[6034,8]]},"688":{"position":[[1768,8],[1843,8],[1926,8],[3853,8],[4016,9],[4137,9],[4279,10]]},"689":{"position":[[187,10]]},"691":{"position":[[39,15]]},"694":{"position":[[773,8],[872,8]]},"695":{"position":[[414,9]]},"696":{"position":[[1244,8]]},"700":{"position":[[80,8]]},"704":{"position":[[767,10],[911,10],[1164,9]]},"708":{"position":[[640,9],[754,8],[1216,9]]},"710":{"position":[[830,10],[922,9]]},"712":{"position":[[53,9],[118,9],[463,9],[537,9]]},"713":{"position":[[299,9],[325,9],[355,9],[560,8],[640,8]]},"714":{"position":[[583,8],[627,9],[691,8],[749,9],[801,9],[911,9],[950,8]]},"715":{"position":[[0,9],[94,9],[360,9]]},"716":{"position":[[647,8],[713,8],[792,9]]},"717":{"position":[[20,8],[84,8],[119,8],[336,9]]},"718":{"position":[[714,9]]},"719":{"position":[[700,8],[739,9],[753,8],[828,9]]},"721":{"position":[[1406,9],[1451,8],[1580,8],[1706,9],[1875,10],[2038,9],[2167,8]]},"722":{"position":[[85,9],[109,8],[198,8],[270,8],[381,10],[418,8],[484,8]]},"724":{"position":[[1220,8],[1281,8],[1344,9]]},"725":{"position":[[972,8]]}},"keywords":{}}],["function.if",{"_index":2901,"title":{},"content":{"268":{"position":[[558,11],[678,11]]},"408":{"position":[[558,11],[678,11]]},"645":{"position":[[558,11],[678,11]]}},"keywords":{}}],["functionality.onli",{"_index":3337,"title":{},"content":{"438":{"position":[[109,18]]},"685":{"position":[[109,18]]}},"keywords":{}}],["functionmodifi",{"_index":3756,"title":{},"content":{"606":{"position":[[55,16],[141,16]]},"714":{"position":[[55,16],[141,16]]}},"keywords":{}}],["functions.l50",{"_index":2261,"title":{},"content":{"185":{"position":[[3032,13]]},"376":{"position":[[3016,13]]},"592":{"position":[[3016,13]]}},"keywords":{}}],["functionsmappingsrevertscurr",{"_index":878,"title":{},"content":{"38":{"position":[[700,31]]}},"keywords":{}}],["fund",{"_index":134,"title":{},"content":{"3":{"position":[[236,7]]},"72":{"position":[[198,6]]},"236":{"position":[[198,6]]},"440":{"position":[[2853,5],[4439,6],[5893,5],[5989,5]]},"441":{"position":[[1047,6],[2122,6]]},"472":{"position":[[198,6]]},"687":{"position":[[2853,5],[4439,6],[5893,5],[5989,5]]},"688":{"position":[[1047,6],[2122,6]]}},"keywords":{}}],["fundament",{"_index":1420,"title":{},"content":{"76":{"position":[[449,11]]},"227":{"position":[[449,11]]},"458":{"position":[[449,11]]}},"keywords":{}}],["funds.buy",{"_index":3435,"title":{},"content":{"440":{"position":[[4704,9]]},"687":{"position":[[4704,9]]}},"keywords":{}}],["funds.l104",{"_index":3428,"title":{},"content":{"440":{"position":[[4327,10]]},"687":{"position":[[4327,10]]}},"keywords":{}}],["funds.w",{"_index":3519,"title":{},"content":{"441":{"position":[[4248,8]]},"688":{"position":[[4248,8]]}},"keywords":{}}],["further",{"_index":857,"title":{},"content":{"33":{"position":[[85,7]]},"39":{"position":[[411,7]]},"66":{"position":[[110,7]]},"147":{"position":[[859,7]]},"241":{"position":[[110,7]]},"270":{"position":[[21,7]]},"335":{"position":[[867,7]]},"385":{"position":[[21,7]]},"410":{"position":[[21,7]]},"466":{"position":[[110,7]]},"552":{"position":[[867,7]]},"599":{"position":[[550,7]]},"618":{"position":[[651,7]]},"627":{"position":[[21,7]]},"647":{"position":[[21,7]]},"707":{"position":[[550,7]]},"726":{"position":[[651,7]]}},"keywords":{}}],["futur",{"_index":142,"title":{},"content":{"3":{"position":[[370,6],[711,6]]}},"keywords":{}}],["ga",{"_index":1243,"title":{},"content":{"52":{"position":[[767,3],[792,3],[803,3]]},"126":{"position":[[2116,3],[3169,3]]},"128":{"position":[[62,3]]},"277":{"position":[[2284,3],[3337,3]]},"279":{"position":[[62,3]]},"477":{"position":[[1676,4]]},"514":{"position":[[2116,3],[3169,3]]},"516":{"position":[[62,3]]},"699":{"position":[[1676,4]]}},"keywords":{}}],["gain",{"_index":389,"title":{},"content":{"12":{"position":[[342,4]]}},"keywords":{}}],["game",{"_index":137,"title":{},"content":{"3":{"position":[[261,5]]},"12":{"position":[[174,4]]}},"keywords":{}}],["gas_pric",{"_index":745,"title":{},"content":{"31":{"position":[[997,10]]}},"keywords":{}}],["gener",{"_index":197,"title":{"85":{"position":[[4,12]]},"118":{"position":[[0,10]]},"121":{"position":[[0,10]]},"254":{"position":[[4,12]]},"299":{"position":[[0,10]]},"302":{"position":[[0,10]]},"322":{"position":[[0,10]]},"485":{"position":[[4,12]]},"520":{"position":[[0,10]]},"523":{"position":[[0,10]]},"540":{"position":[[0,10]]}},"content":{"6":{"position":[[50,7]]},"9":{"position":[[658,8]]},"10":{"position":[[206,7]]},"17":{"position":[[1835,9]]},"32":{"position":[[819,10],[1061,10],[1738,10],[1797,10]]},"38":{"position":[[313,9]]},"39":{"position":[[383,9]]},"42":{"position":[[406,9]]},"65":{"position":[[392,8]]},"66":{"position":[[297,9]]},"83":{"position":[[258,9]]},"96":{"position":[[158,8]]},"102":{"position":[[567,7]]},"104":{"position":[[102,10]]},"118":{"position":[[67,8],[96,8]]},"119":{"position":[[414,9]]},"120":{"position":[[39,8]]},"121":{"position":[[15,8],[156,9],[388,8]]},"132":{"position":[[69,9],[374,8]]},"134":{"position":[[54,8],[132,9]]},"135":{"position":[[6,9]]},"136":{"position":[[11,9]]},"141":{"position":[[254,9]]},"147":{"position":[[49,8]]},"148":{"position":[[626,9]]},"154":{"position":[[29,8]]},"155":{"position":[[67,9]]},"178":{"position":[[333,8]]},"196":{"position":[[1013,10]]},"198":{"position":[[1434,9]]},"240":{"position":[[392,8]]},"241":{"position":[[297,9]]},"252":{"position":[[258,9]]},"288":{"position":[[158,8]]},"294":{"position":[[567,7]]},"296":{"position":[[102,10]]},"299":{"position":[[67,8],[96,8]]},"300":{"position":[[414,9]]},"301":{"position":[[39,8]]},"302":{"position":[[15,8],[156,9],[388,8]]},"312":{"position":[[69,9],[374,8]]},"314":{"position":[[54,8],[132,9]]},"315":{"position":[[6,9]]},"316":{"position":[[11,9]]},"321":{"position":[[200,9]]},"322":{"position":[[3,8],[100,8]]},"323":{"position":[[4,9],[173,9]]},"326":{"position":[[254,9]]},"335":{"position":[[49,8]]},"336":{"position":[[626,9]]},"339":{"position":[[29,8]]},"340":{"position":[[67,9]]},"354":{"position":[[415,9]]},"369":{"position":[[333,8]]},"382":{"position":[[42,10]]},"419":{"position":[[1173,8]]},"432":{"position":[[958,10]]},"434":{"position":[[1424,9]]},"440":{"position":[[70,9],[3965,9]]},"441":{"position":[[462,8],[491,8]]},"465":{"position":[[392,8]]},"466":{"position":[[297,9]]},"483":{"position":[[258,9]]},"500":{"position":[[158,8]]},"506":{"position":[[567,7]]},"508":{"position":[[102,10]]},"520":{"position":[[67,8],[96,8]]},"521":{"position":[[414,9]]},"522":{"position":[[39,8]]},"523":{"position":[[15,8],[156,9],[388,8]]},"529":{"position":[[69,9],[374,8]]},"531":{"position":[[54,8],[132,9]]},"532":{"position":[[6,9]]},"533":{"position":[[11,9]]},"535":{"position":[[254,9]]},"539":{"position":[[200,9]]},"540":{"position":[[3,8],[100,8]]},"541":{"position":[[4,9],[173,9]]},"552":{"position":[[49,8]]},"553":{"position":[[626,9]]},"559":{"position":[[29,8]]},"560":{"position":[[67,9]]},"570":{"position":[[415,9]]},"585":{"position":[[333,8]]},"596":{"position":[[1018,8]]},"624":{"position":[[42,10]]},"656":{"position":[[1173,8]]},"679":{"position":[[958,10]]},"681":{"position":[[1434,9]]},"687":{"position":[[70,9],[3965,9]]},"688":{"position":[[462,8],[491,8]]},"704":{"position":[[1018,8]]}},"keywords":{}}],["get",{"_index":589,"title":{"394":{"position":[[0,7]]},"631":{"position":[[0,7]]}},"content":{"20":{"position":[[484,4]]},"42":{"position":[[1959,4]]},"52":{"position":[[2048,4]]},"198":{"position":[[1660,7]]},"434":{"position":[[1650,7]]},"681":{"position":[[1660,7]]}},"keywords":{}}],["get(&self",{"_index":667,"title":{},"content":{"22":{"position":[[1321,14]]},"178":{"position":[[957,14]]},"369":{"position":[[957,14]]},"585":{"position":[[957,14]]},"596":{"position":[[387,14]]},"601":{"position":[[207,14],[773,14]]},"602":{"position":[[257,14],[1770,14]]},"704":{"position":[[387,14]]},"709":{"position":[[207,14],[773,14]]},"710":{"position":[[257,14],[1770,14]]}},"keywords":{}}],["get(&ticket_id",{"_index":3403,"title":{},"content":{"440":{"position":[[2604,20]]},"687":{"position":[[2604,20]]}},"keywords":{}}],["get_account(&self",{"_index":2139,"title":{},"content":{"168":{"position":[[1864,22]]},"348":{"position":[[1864,22]]},"564":{"position":[[1864,22]]}},"keywords":{}}],["get_adder_address(&test_env)).add(3",{"_index":1980,"title":{},"content":{"143":{"position":[[1148,40]]},"328":{"position":[[1123,40]]},"537":{"position":[[1123,40]]}},"keywords":{}}],["get_adder_address(test_env",{"_index":1982,"title":{},"content":{"143":{"position":[[1229,27]]},"328":{"position":[[1204,27]]},"537":{"position":[[1204,27]]}},"keywords":{}}],["get_arr(&self",{"_index":3704,"title":{},"content":{"601":{"position":[[1439,18]]},"709":{"position":[[1439,18]]}},"keywords":{}}],["get_balance(&self",{"_index":3549,"title":{},"content":{"476":{"position":[[1349,22]]},"698":{"position":[[1349,22]]}},"keywords":{}}],["get_current_valu",{"_index":1434,"title":{},"content":{"78":{"position":[[301,17]]},"229":{"position":[[322,17]]},"460":{"position":[[322,17]]}},"keywords":{}}],["get_data(&self",{"_index":2976,"title":{},"content":{"321":{"position":[[1493,19]]},"539":{"position":[[1493,19]]}},"keywords":{}}],["get_default_addr(&self",{"_index":3659,"title":{},"content":{"598":{"position":[[1464,27]]},"706":{"position":[[1464,27]]}},"keywords":{}}],["get_default_boo(&self",{"_index":3653,"title":{},"content":{"598":{"position":[[1152,26]]},"706":{"position":[[1152,26]]}},"keywords":{}}],["get_default_int(&self",{"_index":3657,"title":{},"content":{"598":{"position":[[1320,26]]},"706":{"position":[[1320,26]]}},"keywords":{}}],["get_default_uint(&self",{"_index":3655,"title":{},"content":{"598":{"position":[[1235,27]]},"706":{"position":[[1235,27]]}},"keywords":{}}],["get_dict_valu",{"_index":2856,"title":{},"content":{"267":{"position":[[2358,16]]},"407":{"position":[[2358,16]]},"644":{"position":[[2358,16]]}},"keywords":{}}],["get_messag",{"_index":1079,"title":{},"content":{"42":{"position":[[1836,14]]}},"keywords":{}}],["get_message(&self",{"_index":501,"title":{},"content":{"17":{"position":[[1398,22]]}},"keywords":{}}],["get_nonexistent_messag",{"_index":1092,"title":{},"content":{"42":{"position":[[2408,25]]}},"keywords":{}}],["get_or_default",{"_index":2070,"title":{},"content":{"162":{"position":[[1420,14]]},"197":{"position":[[1625,16]]},"351":{"position":[[1442,14]]},"433":{"position":[[1624,16]]},"567":{"position":[[1442,14]]},"598":{"position":[[1123,14]]},"601":{"position":[[339,14]]},"680":{"position":[[1624,16]]},"706":{"position":[[1123,14]]},"709":{"position":[[339,14]]}},"keywords":{}}],["get_or_revert_with(governanceerror::novoteinprogress",{"_index":3253,"title":{},"content":{"416":{"position":[[3753,55],[4408,55]]},"419":{"position":[[5332,55],[5988,55],[6320,55]]},"653":{"position":[[3753,55],[4408,55]]},"656":{"position":[[5332,55],[5988,55],[6320,55]]}},"keywords":{}}],["get_own",{"_index":2399,"title":{},"content":{"198":{"position":[[1563,12]]},"434":{"position":[[1553,12]]},"681":{"position":[[1563,12]]}},"keywords":{}}],["get_owner(&self",{"_index":487,"title":{},"content":{"17":{"position":[[1002,20]]},"115":{"position":[[1110,20],[2628,20]]},"197":{"position":[[500,20]]},"247":{"position":[[1189,20]]},"258":{"position":[[1060,20],[2562,20]]},"433":{"position":[[500,20]]},"446":{"position":[[1189,20]]},"481":{"position":[[1060,20],[2562,20]]},"673":{"position":[[1189,20]]},"680":{"position":[[500,20]]}},"keywords":{}}],["get_role_admin",{"_index":2275,"title":{},"content":{"185":{"position":[[3773,16]]},"376":{"position":[[3757,16]]},"592":{"position":[[3757,16]]}},"keywords":{}}],["get_role_admin(&self",{"_index":2222,"title":{},"content":{"185":{"position":[[662,25]]},"376":{"position":[[646,25]]},"592":{"position":[[646,25]]}},"keywords":{}}],["get_string_api",{"_index":1457,"title":{},"content":{"79":{"position":[[966,15]]},"230":{"position":[[983,15]]},"461":{"position":[[983,15]]}},"keywords":{}}],["get_value<t",{"_index":2848,"title":{},"content":{"267":{"position":[[2108,15]]},"407":{"position":[[2108,15]]},"644":{"position":[[2108,15]]}},"keywords":{}}],["get_value(&self",{"_index":485,"title":{},"content":{"17":{"position":[[931,20]]},"51":{"position":[[1043,20]]},"223":{"position":[[734,20]]},"456":{"position":[[734,20]]},"696":{"position":[[734,20]]}},"keywords":{}}],["get_var",{"_index":2858,"title":{},"content":{"267":{"position":[[2494,9]]},"407":{"position":[[2494,9]]},"644":{"position":[[2494,9]]}},"keywords":{}}],["get_var<t",{"_index":2846,"title":{},"content":{"267":{"position":[[2032,13]]},"407":{"position":[[2032,13]]},"644":{"position":[[2032,13]]}},"keywords":{}}],["getstatu",{"_index":1064,"title":{},"content":{"42":{"position":[[1389,10]]}},"keywords":{}}],["getstatus(address",{"_index":1058,"title":{},"content":{"42":{"position":[[1125,17]]}},"keywords":{}}],["getter",{"_index":348,"title":{},"content":{"10":{"position":[[982,7]]},"162":{"position":[[654,6]]},"197":{"position":[[1318,6],[1371,6]]},"269":{"position":[[1763,6]]},"351":{"position":[[691,6]]},"384":{"position":[[1783,6]]},"409":{"position":[[1763,6]]},"433":{"position":[[1317,6],[1370,6]]},"567":{"position":[[691,6]]},"596":{"position":[[1027,7]]},"602":{"position":[[1744,7]]},"626":{"position":[[1783,6]]},"646":{"position":[[1763,6]]},"680":{"position":[[1317,6],[1370,6]]},"704":{"position":[[1027,7]]},"710":{"position":[[1744,7]]}},"keywords":{}}],["github",{"_index":91,"title":{},"content":{"1":{"position":[[1176,7]]},"7":{"position":[[89,7]]},"15":{"position":[[40,6],[644,7]]},"16":{"position":[[70,6]]},"24":{"position":[[19,6]]},"54":{"position":[[431,6]]},"117":{"position":[[1098,6]]},"298":{"position":[[1098,6]]},"519":{"position":[[1098,6]]}},"keywords":{}}],["give",{"_index":429,"title":{},"content":{"16":{"position":[[7,5],[118,5]]},"43":{"position":[[1973,5]]},"110":{"position":[[154,5]]},"168":{"position":[[5,5]]},"305":{"position":[[154,5]]},"348":{"position":[[5,5]]},"510":{"position":[[154,5]]},"564":{"position":[[5,5]]}},"keywords":{}}],["given",{"_index":233,"title":{},"content":{"8":{"position":[[124,5]]},"10":{"position":[[27,5]]},"31":{"position":[[683,5],[828,5]]},"80":{"position":[[4,5]]},"157":{"position":[[87,5]]},"168":{"position":[[1756,5]]},"185":{"position":[[2717,5],[2862,5],[3856,5]]},"206":{"position":[[1109,5],[1747,5],[3353,5]]},"231":{"position":[[4,5]]},"269":{"position":[[5019,5],[5657,5]]},"330":{"position":[[87,5]]},"348":{"position":[[1756,5]]},"376":{"position":[[2701,5],[2846,5],[3840,5]]},"409":{"position":[[5019,5],[5657,5]]},"419":{"position":[[1328,5],[2651,5],[2921,5],[3088,5],[3233,5],[3681,5],[3774,5],[3806,5]]},"426":{"position":[[1104,5],[1737,5],[3328,5]]},"462":{"position":[[4,5]]},"476":{"position":[[1327,5]]},"547":{"position":[[87,5]]},"564":{"position":[[1756,5]]},"592":{"position":[[2701,5],[2846,5],[3840,5]]},"646":{"position":[[5019,5],[5657,5]]},"656":{"position":[[1328,5],[2651,5],[2921,5],[3088,5],[3233,5],[3681,5],[3774,5],[3806,5]]},"668":{"position":[[1109,5],[1747,5],[3353,5]]},"698":{"position":[[1327,5]]}},"keywords":{}}],["glanc",{"_index":3206,"title":{},"content":{"414":{"position":[[158,6]]},"651":{"position":[[158,6]]}},"keywords":{}}],["global",{"_index":1578,"title":{},"content":{"91":{"position":[[293,6]]},"283":{"position":[[293,6]]},"495":{"position":[[293,6]]},"600":{"position":[[551,6],[791,6],[1127,6]]},"708":{"position":[[551,6],[791,6],[1127,6]]}},"keywords":{}}],["go",{"_index":27,"title":{},"content":{"1":{"position":[[271,5],[518,5]]},"6":{"position":[[98,2]]},"22":{"position":[[350,2]]},"52":{"position":[[442,3],[1759,3]]},"92":{"position":[[460,2]]},"126":{"position":[[1305,2]]},"164":{"position":[[0,5]]},"180":{"position":[[42,2]]},"277":{"position":[[1473,2]]},"284":{"position":[[460,2]]},"353":{"position":[[0,5]]},"371":{"position":[[42,2]]},"383":{"position":[[679,2]]},"394":{"position":[[210,2]]},"396":{"position":[[1018,2]]},"415":{"position":[[6,2]]},"496":{"position":[[460,2]]},"514":{"position":[[1305,2]]},"569":{"position":[[0,5]]},"587":{"position":[[42,2]]},"601":{"position":[[2107,2]]},"625":{"position":[[679,2]]},"631":{"position":[[210,2]]},"633":{"position":[[1018,2]]},"652":{"position":[[6,2]]},"709":{"position":[[2107,2]]}},"keywords":{}}],["goal",{"_index":100,"title":{},"content":{"2":{"position":[[207,5]]},"8":{"position":[[63,4]]},"12":{"position":[[57,5]]},"17":{"position":[[4,4]]},"22":{"position":[[328,4]]},"594":{"position":[[540,4]]},"612":{"position":[[1906,5]]},"702":{"position":[[540,4]]},"720":{"position":[[1906,5]]}},"keywords":{}}],["goe",{"_index":1599,"title":{},"content":{"92":{"position":[[682,4]]},"284":{"position":[[682,4]]},"496":{"position":[[682,4]]},"604":{"position":[[305,4],[448,4]]},"712":{"position":[[305,4],[448,4]]}},"keywords":{}}],["good",{"_index":144,"title":{},"content":{"3":{"position":[[395,4]]},"12":{"position":[[16,4]]},"16":{"position":[[481,4]]},"18":{"position":[[409,4]]}},"keywords":{}}],["govern",{"_index":3201,"title":{"413":{"position":[[5,9]]},"415":{"position":[[0,10]]},"650":{"position":[[5,9]]},"652":{"position":[[0,10]]}},"content":{"413":{"position":[[35,10]]},"414":{"position":[[705,11]]},"415":{"position":[[49,10]]},"417":{"position":[[1536,11]]},"419":{"position":[[306,8],[1509,6],[1529,9],[7951,11]]},"650":{"position":[[35,10]]},"651":{"position":[[705,11]]},"652":{"position":[[49,10]]},"654":{"position":[[1536,11]]},"656":{"position":[[306,8],[1509,6],[1529,9],[7951,11]]}},"keywords":{}}],["governanceerror",{"_index":3292,"title":{},"content":{"419":{"position":[[351,15]]},"656":{"position":[[351,15]]}},"keywords":{}}],["grab",{"_index":1897,"title":{},"content":{"136":{"position":[[83,4]]},"316":{"position":[[83,4]]},"533":{"position":[[83,4]]}},"keywords":{}}],["gracefulli",{"_index":3921,"title":{},"content":{"617":{"position":[[860,11]]},"725":{"position":[[860,11]]}},"keywords":{}}],["grant",{"_index":2180,"title":{},"content":{"184":{"position":[[65,9],[689,5]]},"185":{"position":[[2704,7],[2849,7],[3123,7],[3276,7],[3653,8]]},"375":{"position":[[65,9],[608,5]]},"376":{"position":[[2688,7],[2833,7],[3107,7],[3260,7],[3637,8]]},"419":{"position":[[1767,7]]},"591":{"position":[[65,9],[608,5]]},"592":{"position":[[2688,7],[2833,7],[3107,7],[3260,7],[3637,8]]},"656":{"position":[[1767,7]]}},"keywords":{}}],["grant/revok",{"_index":2169,"title":{},"content":{"182":{"position":[[230,12]]},"373":{"position":[[230,12]]},"589":{"position":[[230,12]]}},"keywords":{}}],["grant_role(&mut",{"_index":2226,"title":{},"content":{"185":{"position":[[841,19]]},"376":{"position":[[825,19]]},"592":{"position":[[825,19]]}},"keywords":{}}],["great",{"_index":404,"title":{},"content":{"15":{"position":[[154,5]]},"16":{"position":[[18,5]]},"52":{"position":[[3083,6]]},"54":{"position":[[15,5]]},"594":{"position":[[456,5]]},"702":{"position":[[456,5]]}},"keywords":{}}],["greatli",{"_index":623,"title":{},"content":{"21":{"position":[[107,7]]}},"keywords":{}}],["green",{"_index":3289,"title":{},"content":{"417":{"position":[[1726,6]]},"654":{"position":[[1726,6]]}},"keywords":{}}],["greet",{"_index":3612,"title":{},"content":{"596":{"position":[[145,8],[245,6],[845,6],[869,8],[938,8]]},"704":{"position":[[145,8],[245,6],[845,6],[869,8],[938,8]]}},"keywords":{}}],["grep",{"_index":1253,"title":{},"content":{"52":{"position":[[981,4]]}},"keywords":{}}],["group",{"_index":871,"title":{},"content":{"38":{"position":[[465,5],[610,6]]},"419":{"position":[[1826,5]]},"656":{"position":[[1826,5]]}},"keywords":{}}],["gt",{"_index":350,"title":{},"content":{"10":{"position":[[1016,4],[1246,4],[1352,5],[1397,5]]},"17":{"position":[[953,4],[1024,4],[1269,5],[1332,5],[1459,4],[1590,5],[1618,5],[2537,4],[2632,4],[3905,4],[4028,5],[4059,5]]},"22":{"position":[[1337,4]]},"31":{"position":[[739,4],[889,4]]},"32":{"position":[[1138,4]]},"39":{"position":[[2325,4],[2530,5],[2604,5],[2666,5],[2738,5],[2804,5],[2927,5],[3003,5],[3111,5]]},"42":{"position":[[972,5],[2095,4]]},"51":{"position":[[1065,4]]},"73":{"position":[[198,4]]},"79":{"position":[[894,4],[1034,4]]},"80":{"position":[[394,4],[481,4],[609,4]]},"83":{"position":[[588,4]]},"115":{"position":[[820,4],[859,4],[900,4],[941,4],[998,4],[1072,4],[1132,4],[2590,4],[2650,4]]},"141":{"position":[[1294,4]]},"142":{"position":[[294,4]]},"143":{"position":[[1272,4]]},"162":{"position":[[974,4],[1042,4],[1108,4],[1183,4],[1294,4],[2202,4]]},"163":{"position":[[982,4]]},"164":{"position":[[642,4],[717,4],[785,4]]},"168":{"position":[[1689,4],[1898,4],[2136,4]]},"178":{"position":[[973,4]]},"185":{"position":[[591,4],[706,4]]},"197":{"position":[[522,4],[585,5],[603,5]]},"198":{"position":[[108,4],[1354,4]]},"204":{"position":[[338,4],[407,4],[480,4],[555,4]]},"205":{"position":[[980,4],[1110,4],[1370,4]]},"206":{"position":[[280,4]]},"212":{"position":[[666,4],[1458,4],[2540,4],[2846,4],[3843,4],[4068,4]]},"221":{"position":[[102,4]]},"223":{"position":[[756,4]]},"230":{"position":[[911,4],[1051,4]]},"231":{"position":[[394,4],[481,4],[609,4]]},"237":{"position":[[198,4]]},"247":{"position":[[341,4],[401,4],[465,4],[531,4],[624,4],[742,4],[1211,4]]},"252":{"position":[[588,4]]},"258":{"position":[[794,4],[829,4],[866,4],[903,4],[956,4],[1026,4],[1082,4],[2528,4],[2584,4]]},"267":{"position":[[2077,4],[2166,4],[2562,4],[2636,4],[2708,4],[2786,4],[3047,4],[3143,4],[3928,4]]},"269":{"position":[[1697,4],[1856,4],[2599,4],[4184,4]]},"321":{"position":[[1514,4]]},"326":{"position":[[1294,4]]},"327":{"position":[[294,4]]},"328":{"position":[[1247,4]]},"348":{"position":[[1689,4],[1898,4],[2146,4]]},"351":{"position":[[996,4],[1064,4],[1130,4],[1205,4],[1316,4],[2224,4]]},"352":{"position":[[1004,4]]},"353":{"position":[[677,4],[752,4],[820,4]]},"369":{"position":[[973,4]]},"376":{"position":[[575,4],[690,4]]},"384":{"position":[[1710,4],[1876,4],[2626,4]]},"391":{"position":[[666,4],[1458,4],[2540,4],[2852,4],[3861,4],[4086,4]]},"393":{"position":[[277,4]]},"395":{"position":[[1810,4],[2251,4]]},"407":{"position":[[2077,4],[2166,4],[2562,4],[2636,4],[2708,4],[2786,4],[3047,4],[3143,4],[3928,4]]},"409":{"position":[[1697,4],[1856,4],[2599,4],[4184,4]]},"414":{"position":[[391,4],[426,4]]},"416":{"position":[[4348,4]]},"419":{"position":[[1865,4],[1876,4],[2369,4],[2441,4],[2529,4],[2609,4],[2715,4],[2872,4],[5928,4],[6407,4]]},"424":{"position":[[313,4],[382,4],[455,4],[530,4]]},"425":{"position":[[955,4],[1085,4],[1345,4]]},"426":{"position":[[280,4]]},"433":{"position":[[522,4],[585,5],[603,5]]},"434":{"position":[[108,4],[1344,4]]},"440":{"position":[[3274,4],[6375,4]]},"441":{"position":[[1556,4],[3601,4],[3685,4],[5794,4]]},"446":{"position":[[341,4],[401,4],[465,4],[531,4],[624,4],[742,4],[1211,4]]},"454":{"position":[[102,4]]},"456":{"position":[[756,4]]},"461":{"position":[[911,4],[1051,4]]},"462":{"position":[[394,4],[481,4],[609,4]]},"473":{"position":[[198,4]]},"476":{"position":[[1396,4],[1502,4]]},"477":{"position":[[476,4]]},"481":{"position":[[794,4],[829,4],[866,4],[903,4],[956,4],[1026,4],[1082,4],[2528,4],[2584,4]]},"483":{"position":[[588,4]]},"535":{"position":[[1294,4]]},"536":{"position":[[294,4]]},"537":{"position":[[1247,4]]},"539":{"position":[[1514,4]]},"564":{"position":[[1689,4],[1898,4],[2136,4]]},"567":{"position":[[996,4],[1064,4],[1130,4],[1205,4],[1316,4],[2224,4]]},"568":{"position":[[1004,4]]},"569":{"position":[[677,4],[752,4],[820,4]]},"585":{"position":[[973,4]]},"592":{"position":[[575,4],[690,4]]},"596":{"position":[[403,4]]},"598":{"position":[[1180,4],[1264,4],[1348,4],[1493,4]]},"601":{"position":[[238,4],[813,4],[1459,4]]},"602":{"position":[[273,4],[1798,4]]},"605":{"position":[[160,4],[231,4]]},"606":{"position":[[201,4],[271,4]]},"612":{"position":[[540,4],[687,4],[834,4],[1004,4],[1161,4],[1319,4]]},"613":{"position":[[141,4],[173,4],[424,4]]},"616":{"position":[[253,4],[1009,4]]},"617":{"position":[[466,5],[543,5],[720,4],[741,6]]},"626":{"position":[[1710,4],[1876,4],[2626,4]]},"630":{"position":[[277,4]]},"632":{"position":[[1810,4],[2251,4]]},"644":{"position":[[2077,4],[2166,4],[2562,4],[2636,4],[2708,4],[2786,4],[3047,4],[3143,4],[3928,4]]},"646":{"position":[[1697,4],[1856,4],[2599,4],[4184,4]]},"651":{"position":[[391,4],[426,4]]},"653":{"position":[[4348,4]]},"656":{"position":[[1865,4],[1876,4],[2369,4],[2441,4],[2529,4],[2609,4],[2715,4],[2872,4],[5928,4],[6407,4]]},"661":{"position":[[666,4],[1458,4],[2540,4],[2852,4],[3861,4],[4086,4]]},"666":{"position":[[313,4],[382,4],[455,4],[530,4]]},"667":{"position":[[955,4],[1085,4],[1345,4]]},"668":{"position":[[280,4]]},"673":{"position":[[341,4],[401,4],[465,4],[531,4],[624,4],[742,4],[1211,4]]},"680":{"position":[[522,4],[585,5],[603,5]]},"681":{"position":[[108,4],[1354,4]]},"687":{"position":[[3274,4],[6375,4]]},"688":{"position":[[1556,4],[3601,4],[3685,4],[5794,4]]},"694":{"position":[[102,4]]},"696":{"position":[[756,4]]},"698":{"position":[[1396,4],[1502,4]]},"699":{"position":[[476,4]]},"704":{"position":[[403,4]]},"706":{"position":[[1180,4],[1264,4],[1348,4],[1493,4]]},"709":{"position":[[238,4],[813,4],[1459,4]]},"710":{"position":[[273,4],[1798,4]]},"713":{"position":[[160,4],[231,4]]},"714":{"position":[[201,4],[271,4]]},"720":{"position":[[540,4],[687,4],[834,4],[1004,4],[1161,4],[1319,4]]},"721":{"position":[[141,4],[173,4],[424,4]]},"724":{"position":[[253,4],[1009,4]]},"725":{"position":[[466,5],[543,5],[720,4],[741,6]]}},"keywords":{}}],["guarante",{"_index":1532,"title":{},"content":{"84":{"position":[[786,10]]},"221":{"position":[[688,9]]},"253":{"position":[[786,10]]},"454":{"position":[[688,9]]},"484":{"position":[[786,10]]},"694":{"position":[[688,9]]}},"keywords":{}}],["guard",{"_index":600,"title":{"221":{"position":[[11,7]]},"454":{"position":[[11,7]]},"694":{"position":[[11,7]]}},"content":{"20":{"position":[[760,7]]},"72":{"position":[[385,6]]},"185":{"position":[[3090,5]]},"218":{"position":[[114,6]]},"221":{"position":[[36,7]]},"236":{"position":[[385,6]]},"376":{"position":[[3074,5]]},"451":{"position":[[114,6]]},"454":{"position":[[36,7]]},"472":{"position":[[385,6]]},"592":{"position":[[3074,5]]},"691":{"position":[[114,6]]},"694":{"position":[[36,7]]}},"keywords":{}}],["guess(&self",{"_index":3901,"title":{},"content":{"616":{"position":[[977,16]]},"724":{"position":[[977,16]]}},"keywords":{}}],["guessthemagicword",{"_index":3866,"title":{},"content":{"616":{"position":[[534,17],[606,17]]},"724":{"position":[[534,17],[606,17]]}},"keywords":{}}],["guest",{"_index":229,"title":{"8":{"position":[[0,6]]}},"content":{"8":{"position":[[39,5],[144,5]]},"9":{"position":[[21,5],[503,6]]},"10":{"position":[[68,5]]},"32":{"position":[[31,5]]}},"keywords":{}}],["guid",{"_index":1428,"title":{"259":{"position":[[10,5]]},"377":{"position":[[10,5]]},"399":{"position":[[10,5]]},"619":{"position":[[10,5]]},"636":{"position":[[10,5]]}},"content":{"76":{"position":[[936,5]]},"227":{"position":[[936,5]]},"383":{"position":[[140,5]]},"442":{"position":[[87,5]]},"458":{"position":[[936,5]]},"594":{"position":[[282,5]]},"595":{"position":[[15,6]]},"625":{"position":[[140,5]]},"689":{"position":[[87,5]]},"702":{"position":[[282,5]]},"703":{"position":[[15,6]]}},"keywords":{}}],["h160::default",{"_index":748,"title":{},"content":{"31":{"position":[[1030,16]]}},"keywords":{}}],["h160::from_str("0x1000000000000000000000000000000000000000"",{"_index":766,"title":{},"content":{"31":{"position":[[1452,70],[2488,70]]}},"keywords":{}}],["h160::from_str("0xf000000000000000000000000000000000000000"",{"_index":774,"title":{},"content":{"31":{"position":[[1746,70],[2406,70]]}},"keywords":{}}],["halt",{"_index":2424,"title":{},"content":{"198":{"position":[[3772,7]]},"434":{"position":[[3754,7]]},"681":{"position":[[3772,7]]}},"keywords":{}}],["hand",{"_index":677,"title":{},"content":{"23":{"position":[[79,5]]},"42":{"position":[[14,5]]},"94":{"position":[[176,4]]},"132":{"position":[[345,5]]},"154":{"position":[[92,5]]},"286":{"position":[[176,4]]},"312":{"position":[[345,5]]},"339":{"position":[[92,5]]},"498":{"position":[[176,4]]},"529":{"position":[[345,5]]},"559":{"position":[[92,5]]}},"keywords":{}}],["handi",{"_index":3242,"title":{},"content":{"416":{"position":[[2497,5]]},"653":{"position":[[2497,5]]}},"keywords":{}}],["handl",{"_index":1597,"title":{"611":{"position":[[6,9]]},"719":{"position":[[6,9]]}},"content":{"92":{"position":[[562,7]]},"98":{"position":[[645,7]]},"102":{"position":[[313,7]]},"110":{"position":[[551,8]]},"111":{"position":[[324,8]]},"152":{"position":[[19,6]]},"164":{"position":[[1088,6]]},"169":{"position":[[27,7]]},"284":{"position":[[562,7]]},"290":{"position":[[645,7]]},"294":{"position":[[313,7]]},"305":{"position":[[551,8]]},"306":{"position":[[324,8]]},"343":{"position":[[19,6]]},"349":{"position":[[27,7]]},"353":{"position":[[1123,6]]},"441":{"position":[[3463,7]]},"478":{"position":[[404,7]]},"496":{"position":[[562,7]]},"502":{"position":[[645,7]]},"506":{"position":[[313,7]]},"510":{"position":[[551,8]]},"511":{"position":[[324,8]]},"557":{"position":[[19,6]]},"565":{"position":[[27,7]]},"569":{"position":[[1123,6]]},"611":{"position":[[581,6]]},"617":{"position":[[826,6],[927,6],[1129,6],[1277,6]]},"618":{"position":[[163,9]]},"688":{"position":[[3463,7]]},"700":{"position":[[404,7]]},"719":{"position":[[581,6]]},"725":{"position":[[826,6],[927,6],[1129,6],[1277,6]]},"726":{"position":[[163,9]]}},"keywords":{}}],["handling,defin",{"_index":2307,"title":{},"content":{"193":{"position":[[130,17]]},"429":{"position":[[130,17]]},"676":{"position":[[130,17]]}},"keywords":{}}],["happen",{"_index":424,"title":{},"content":{"15":{"position":[[560,6]]},"102":{"position":[[76,9]]},"294":{"position":[[76,9]]},"396":{"position":[[811,8]]},"506":{"position":[[76,9]]},"633":{"position":[[811,8]]}},"keywords":{}}],["happi",{"_index":10,"title":{},"content":{"1":{"position":[[83,5]]},"23":{"position":[[92,5]]}},"keywords":{}}],["hard",{"_index":102,"title":{},"content":{"2":{"position":[[242,4]]},"18":{"position":[[389,4]]}},"keywords":{}}],["hardcod",{"_index":3241,"title":{},"content":{"416":{"position":[[2414,9]]},"653":{"position":[[2414,9]]}},"keywords":{}}],["has_role(&self",{"_index":2219,"title":{},"content":{"185":{"position":[[530,19]]},"376":{"position":[[514,19]]},"592":{"position":[[514,19]]}},"keywords":{}}],["hash",{"_index":1553,"title":{"616":{"position":[[0,8]]},"724":{"position":[[0,8]]}},"content":{"85":{"position":[[981,6]]},"98":{"position":[[209,4]]},"100":{"position":[[1085,4]]},"103":{"position":[[130,4]]},"209":{"position":[[565,6],[698,6]]},"210":{"position":[[1297,4]]},"211":{"position":[[746,4]]},"212":{"position":[[199,4],[464,6],[587,6],[3671,4],[3756,4],[4398,4]]},"254":{"position":[[981,6]]},"290":{"position":[[209,4]]},"292":{"position":[[1085,4]]},"295":{"position":[[130,4]]},"323":{"position":[[2931,4]]},"389":{"position":[[1234,4]]},"390":{"position":[[720,4]]},"391":{"position":[[199,4],[464,6],[587,6],[3689,4],[3774,4],[4416,4]]},"395":{"position":[[5112,4]]},"477":{"position":[[4001,7],[4024,5]]},"485":{"position":[[981,6]]},"502":{"position":[[209,4]]},"504":{"position":[[1085,4]]},"507":{"position":[[130,4]]},"541":{"position":[[2931,4]]},"616":{"position":[[675,5],[1047,4],[1108,4],[1240,4],[1402,5]]},"632":{"position":[[5112,4]]},"659":{"position":[[1234,4]]},"660":{"position":[[720,4]]},"661":{"position":[[199,4],[464,6],[587,6],[3689,4],[3774,4],[4416,4]]},"699":{"position":[[4001,7],[4024,5]]},"724":{"position":[[675,5],[1047,4],[1108,4],[1240,4],[1402,5]]}},"keywords":{}}],["hash<t",{"_index":2859,"title":{},"content":{"267":{"position":[[2518,10],[2591,10]]},"407":{"position":[[2518,10],[2591,10]]},"644":{"position":[[2518,10],[2591,10]]}},"keywords":{}}],["hash(&self",{"_index":3861,"title":{},"content":{"616":{"position":[[196,15]]},"724":{"position":[[196,15]]}},"keywords":{}}],["hashed_key",{"_index":2668,"title":{},"content":{"212":{"position":[[3975,10]]},"391":{"position":[[3993,10]]},"661":{"position":[[3993,10]]}},"keywords":{}}],["hasher",{"_index":2672,"title":{},"content":{"212":{"position":[[4120,6],[4281,7]]},"391":{"position":[[4138,6],[4299,7]]},"661":{"position":[[4138,6],[4299,7]]}},"keywords":{}}],["hasher"",{"_index":2676,"title":{},"content":{"212":{"position":[[4227,14]]},"391":{"position":[[4245,14]]},"661":{"position":[[4245,14]]}},"keywords":{}}],["hashfunct",{"_index":3860,"title":{},"content":{"616":{"position":[[139,13],[174,12]]},"724":{"position":[[139,13],[174,12]]}},"keywords":{}}],["hashmap",{"_index":2074,"title":{},"content":{"162":{"position":[[1937,8]]},"163":{"position":[[1117,7]]},"351":{"position":[[1959,8]]},"352":{"position":[[1139,7]]},"567":{"position":[[1959,8]]},"568":{"position":[[1139,7]]}},"keywords":{}}],["hasn't",{"_index":411,"title":{},"content":{"15":{"position":[[307,6]]},"54":{"position":[[351,6]]}},"keywords":{}}],["hassl",{"_index":645,"title":{},"content":{"22":{"position":[[182,6]]},"38":{"position":[[170,6]]}},"keywords":{}}],["have",{"_index":891,"title":{},"content":{"38":{"position":[[1068,6]]},"141":{"position":[[1453,6]]},"207":{"position":[[0,6]]},"326":{"position":[[1453,6]]},"419":{"position":[[2073,6]]},"427":{"position":[[0,6]]},"535":{"position":[[1453,6]]},"656":{"position":[[2073,6]]},"669":{"position":[[0,6]]}},"keywords":{}}],["header",{"_index":1985,"title":{"145":{"position":[[0,7]]},"333":{"position":[[0,7]]},"550":{"position":[[0,7]]}},"content":{},"keywords":{}}],["hello",{"_index":2,"title":{"1":{"position":[[0,5]]},"596":{"position":[[0,5]]},"704":{"position":[[0,5]]}},"content":{"7":{"position":[[124,6]]}},"keywords":{}}],["helloworld",{"_index":3614,"title":{},"content":{"596":{"position":[[232,10],[294,10],[799,10]]},"704":{"position":[[232,10],[294,10],[799,10]]}},"keywords":{}}],["help",{"_index":87,"title":{"2":{"position":[[8,4]]}},"content":{"1":{"position":[[1121,4]]},"2":{"position":[[117,4],[456,4]]},"12":{"position":[[292,4]]},"31":{"position":[[404,7]]},"70":{"position":[[141,5]]},"81":{"position":[[332,4]]},"117":{"position":[[13,4]]},"174":{"position":[[16,7],[39,4],[356,4]]},"175":{"position":[[612,4]]},"193":{"position":[[41,4]]},"201":{"position":[[41,4]]},"232":{"position":[[332,4]]},"234":{"position":[[141,5]]},"298":{"position":[[13,4]]},"360":{"position":[[16,7],[39,4],[356,4]]},"361":{"position":[[612,4]]},"421":{"position":[[41,4]]},"429":{"position":[[41,4]]},"463":{"position":[[332,4]]},"470":{"position":[[141,5]]},"519":{"position":[[13,4]]},"576":{"position":[[16,7],[39,4],[356,4]]},"577":{"position":[[612,4]]},"612":{"position":[[1632,5]]},"663":{"position":[[41,4]]},"676":{"position":[[41,4]]},"720":{"position":[[1632,5]]}},"keywords":{}}],["helper",{"_index":2260,"title":{},"content":{"185":{"position":[[3025,6]]},"376":{"position":[[3009,6]]},"441":{"position":[[4272,6]]},"592":{"position":[[3009,6]]},"688":{"position":[[4272,6]]}},"keywords":{}}],["henc",{"_index":2350,"title":{},"content":{"196":{"position":[[1662,6]]},"221":{"position":[[514,5]]},"432":{"position":[[1540,6]]},"454":{"position":[[514,5]]},"679":{"position":[[1540,6]]},"694":{"position":[[514,5]]}},"keywords":{}}],["here",{"_index":11,"title":{},"content":{"1":{"position":[[101,5],[1113,4]]},"3":{"position":[[136,4]]},"11":{"position":[[160,4]]},"16":{"position":[[292,5]]},"20":{"position":[[721,4]]},"39":{"position":[[2179,4]]},"42":{"position":[[2812,5]]},"43":{"position":[[644,5]]},"51":{"position":[[1634,4]]},"53":{"position":[[1279,4]]},"83":{"position":[[451,4]]},"127":{"position":[[975,5]]},"132":{"position":[[337,4]]},"135":{"position":[[58,5]]},"136":{"position":[[69,5]]},"198":{"position":[[2494,4]]},"212":{"position":[[2475,5]]},"252":{"position":[[451,4]]},"267":{"position":[[183,4]]},"268":{"position":[[176,4]]},"269":{"position":[[0,4]]},"277":{"position":[[1136,5]]},"278":{"position":[[975,5]]},"312":{"position":[[337,4]]},"315":{"position":[[58,5]]},"316":{"position":[[69,5]]},"323":{"position":[[147,4]]},"365":{"position":[[170,5],[351,5]]},"383":{"position":[[682,4]]},"384":{"position":[[0,4]]},"391":{"position":[[2475,5]]},"396":{"position":[[1042,5],[1248,5]]},"407":{"position":[[183,4]]},"408":{"position":[[176,4]]},"409":{"position":[[0,4]]},"416":{"position":[[3100,4]]},"419":{"position":[[0,4]]},"434":{"position":[[2484,4]]},"476":{"position":[[1927,5]]},"483":{"position":[[451,4]]},"515":{"position":[[975,5]]},"529":{"position":[[337,4]]},"532":{"position":[[58,5]]},"533":{"position":[[69,5]]},"541":{"position":[[147,4]]},"581":{"position":[[170,5],[351,5]]},"604":{"position":[[310,4],[453,4]]},"625":{"position":[[682,4]]},"626":{"position":[[0,4]]},"633":{"position":[[1042,5],[1248,5]]},"644":{"position":[[183,4]]},"645":{"position":[[176,4]]},"646":{"position":[[0,4]]},"653":{"position":[[3100,4]]},"656":{"position":[[0,4]]},"661":{"position":[[2475,5]]},"681":{"position":[[2494,4]]},"698":{"position":[[1927,5]]},"712":{"position":[[310,4],[453,4]]}},"keywords":{}}],["here'",{"_index":3746,"title":{},"content":{"604":{"position":[[86,6]]},"712":{"position":[[86,6]]}},"keywords":{}}],["hesit",{"_index":2946,"title":{},"content":{"270":{"position":[[87,8]]},"385":{"position":[[87,8]]},"410":{"position":[[87,8]]},"627":{"position":[[87,8]]},"647":{"position":[[87,8]]}},"keywords":{}}],["hex",{"_index":793,"title":{},"content":{"31":{"position":[[2754,3],[3098,3],[3118,3]]},"211":{"position":[[720,3]]},"212":{"position":[[3730,3]]},"390":{"position":[[694,3]]},"391":{"position":[[3748,3]]},"660":{"position":[[694,3]]},"661":{"position":[[3748,3]]}},"keywords":{}}],["hex::decode(input).unwrap",{"_index":788,"title":{},"content":{"31":{"position":[[2584,28]]}},"keywords":{}}],["hex::decode(program).unwrap",{"_index":771,"title":{},"content":{"31":{"position":[[1633,30]]}},"keywords":{}}],["hex::encode(&hashed_key",{"_index":2670,"title":{},"content":{"212":{"position":[[4007,28]]},"391":{"position":[[4025,28]]},"661":{"position":[[4025,28]]}},"keywords":{}}],["hex::encode(result",{"_index":795,"title":{},"content":{"31":{"position":[[2774,19]]}},"keywords":{}}],["hexadecim",{"_index":1555,"title":{},"content":{"85":{"position":[[1045,11]]},"254":{"position":[[1045,11]]},"485":{"position":[[1045,11]]}},"keywords":{}}],["hi",{"_index":3602,"title":{},"content":{"594":{"position":[[0,3]]},"702":{"position":[[0,3]]}},"keywords":{}}],["hide",{"_index":3212,"title":{},"content":{"415":{"position":[[109,4]]},"652":{"position":[[109,4]]}},"keywords":{}}],["hierarchi",{"_index":952,"title":{},"content":{"39":{"position":[[1432,9]]}},"keywords":{}}],["high",{"_index":640,"title":{},"content":{"22":{"position":[[10,4]]},"38":{"position":[[28,4]]},"594":{"position":[[162,4]]},"702":{"position":[[162,4]]}},"keywords":{}}],["highest",{"_index":47,"title":{},"content":{"1":{"position":[[601,7]]}},"keywords":{}}],["highli",{"_index":2346,"title":{},"content":{"196":{"position":[[1490,6]]},"219":{"position":[[132,6]]},"452":{"position":[[132,6]]},"692":{"position":[[132,6]]}},"keywords":{}}],["highlight",{"_index":3607,"title":{},"content":{"594":{"position":[[351,12]]},"702":{"position":[[351,12]]}},"keywords":{}}],["hindranc",{"_index":1571,"title":{},"content":{"90":{"position":[[166,11]]},"282":{"position":[[166,11]]},"494":{"position":[[166,11]]}},"keywords":{}}],["histori",{"_index":563,"title":{"20":{"position":[[9,8]]}},"content":{"107":{"position":[[302,7]]},"274":{"position":[[302,7]]},"491":{"position":[[302,7]]}},"keywords":{}}],["hold",{"_index":337,"title":{},"content":{"10":{"position":[[660,5]]},"22":{"position":[[878,5]]},"31":{"position":[[2848,4]]},"78":{"position":[[126,5]]},"107":{"position":[[286,5],[346,5]]},"132":{"position":[[22,5]]},"151":{"position":[[20,4]]},"219":{"position":[[181,5]]},"229":{"position":[[126,5]]},"274":{"position":[[286,5],[346,5]]},"312":{"position":[[22,5]]},"342":{"position":[[20,4]]},"452":{"position":[[181,5]]},"460":{"position":[[126,5]]},"491":{"position":[[286,5],[346,5]]},"529":{"position":[[22,5]]},"556":{"position":[[20,4]]},"692":{"position":[[181,5]]}},"keywords":{}}],["holder",{"_index":3202,"title":{},"content":{"413":{"position":[[174,7]]},"415":{"position":[[341,7]]},"416":{"position":[[191,7],[1275,7],[1668,7]]},"417":{"position":[[443,7],[533,7]]},"419":{"position":[[575,7],[4185,7],[6858,7],[6948,7]]},"650":{"position":[[174,7]]},"652":{"position":[[341,7]]},"653":{"position":[[191,7],[1275,7],[1668,7]]},"654":{"position":[[443,7],[533,7]]},"656":{"position":[[575,7],[4185,7],[6858,7],[6948,7]]}},"keywords":{}}],["home",{"_index":633,"title":{},"content":{"21":{"position":[[281,5]]}},"keywords":{}}],["home/casper/casp",{"_index":3555,"title":{},"content":{"477":{"position":[[393,19]]},"699":{"position":[[393,19]]}},"keywords":{}}],["homepag",{"_index":3045,"title":{},"content":{"324":{"position":[[167,8]]},"542":{"position":[[167,8]]}},"keywords":{}}],["honest",{"_index":673,"title":{},"content":{"23":{"position":[[9,7]]}},"keywords":{}}],["hood",{"_index":1576,"title":{},"content":{"91":{"position":[[213,5]]},"102":{"position":[[96,4]]},"283":{"position":[[213,5]]},"294":{"position":[[96,4]]},"495":{"position":[[213,5]]},"506":{"position":[[96,4]]}},"keywords":{}}],["hope",{"_index":634,"title":{},"content":{"21":{"position":[[290,4]]},"40":{"position":[[365,4]]}},"keywords":{}}],["hopefulli",{"_index":3137,"title":{},"content":{"395":{"position":[[1410,9]]},"632":{"position":[[1410,9]]}},"keywords":{}}],["horizon",{"_index":3605,"title":{},"content":{"594":{"position":[[67,8]]},"702":{"position":[[67,8]]}},"keywords":{}}],["host",{"_index":242,"title":{"111":{"position":[[0,4]]},"123":{"position":[[0,4]]},"306":{"position":[[0,4]]},"308":{"position":[[0,4]]},"511":{"position":[[0,4]]},"525":{"position":[[0,4]]}},"content":{"8":{"position":[[290,4],[356,4]]},"32":{"position":[[1698,4]]},"111":{"position":[[35,4]]},"126":{"position":[[1479,4]]},"141":{"position":[[56,4]]},"146":{"position":[[249,5]]},"166":{"position":[[48,4]]},"168":{"position":[[80,4],[234,4]]},"178":{"position":[[263,5]]},"268":{"position":[[1396,4]]},"277":{"position":[[1647,4]]},"306":{"position":[[35,4]]},"326":{"position":[[56,4]]},"334":{"position":[[249,5]]},"346":{"position":[[28,4]]},"348":{"position":[[80,4],[234,4]]},"355":{"position":[[48,4]]},"369":{"position":[[263,5]]},"408":{"position":[[1396,4]]},"511":{"position":[[35,4]]},"514":{"position":[[1479,4]]},"535":{"position":[[56,4]]},"551":{"position":[[249,5]]},"564":{"position":[[80,4],[234,4]]},"571":{"position":[[48,4]]},"585":{"position":[[263,5]]},"645":{"position":[[1396,4]]}},"keywords":{}}],["host/src/main.r",{"_index":827,"title":{},"content":{"32":{"position":[[523,16]]}},"keywords":{}}],["host::{deploy",{"_index":1977,"title":{},"content":{"143":{"position":[[1010,16]]},"160":{"position":[[237,16]]},"206":{"position":[[83,16]]},"269":{"position":[[3974,16]]},"328":{"position":[[985,16]]},"345":{"position":[[237,16]]},"409":{"position":[[3974,16]]},"426":{"position":[[83,16]]},"440":{"position":[[4835,16]]},"441":{"position":[[4581,16]]},"537":{"position":[[985,16]]},"562":{"position":[[237,16]]},"646":{"position":[[3974,16]]},"668":{"position":[[83,16]]},"687":{"position":[[4835,16]]},"688":{"position":[[4581,16]]}},"keywords":{}}],["hostenv",{"_index":2020,"title":{"168":{"position":[[0,8]]},"346":{"position":[[0,8]]},"348":{"position":[[0,8]]},"564":{"position":[[0,8]]}},"content":{"157":{"position":[[7,7],[223,8],[290,7],[833,7]]},"160":{"position":[[68,7]]},"168":{"position":[[465,9],[521,7],[1173,7],[1486,7],[2241,7]]},"198":{"position":[[77,8],[130,8],[159,7],[1376,8],[1683,7],[2077,8],[2784,8],[3145,7],[3605,7]]},"206":{"position":[[100,8],[285,9]]},"268":{"position":[[479,7],[918,8],[954,7],[1135,9],[1154,7],[2940,7],[3015,7]]},"269":{"position":[[3991,8],[4189,9]]},"330":{"position":[[7,7],[223,8],[281,7],[809,7]]},"345":{"position":[[68,7]]},"348":{"position":[[465,9],[521,7],[1173,7],[1486,7],[2251,7]]},"395":{"position":[[426,8]]},"408":{"position":[[479,7],[918,8],[954,7],[1135,9],[1154,7],[2940,7],[3015,7]]},"409":{"position":[[3991,8],[4189,9]]},"426":{"position":[[100,8],[285,9]]},"434":{"position":[[77,8],[130,8],[159,7],[1366,8],[1673,7],[2067,8],[2774,8],[3127,7],[3587,7]]},"547":{"position":[[7,7],[223,8],[290,7],[833,7]]},"562":{"position":[[68,7]]},"564":{"position":[[465,9],[521,7],[1173,7],[1486,7],[2241,7]]},"632":{"position":[[426,8]]},"645":{"position":[[479,7],[918,8],[954,7],[1135,9],[1154,7],[2940,7],[3015,7]]},"646":{"position":[[3991,8],[4189,9]]},"668":{"position":[[100,8],[285,9]]},"681":{"position":[[77,8],[130,8],[159,7],[1376,8],[1683,7],[2077,8],[2784,8],[3145,7],[3605,7]]}},"keywords":{}}],["hostenv::change_ownership",{"_index":2418,"title":{},"content":{"198":{"position":[[3576,28]]},"434":{"position":[[3558,28]]},"681":{"position":[[3576,28]]}},"keywords":{}}],["hostenv::emitted_ev",{"_index":2410,"title":{},"content":{"198":{"position":[[2850,23]]},"268":{"position":[[2758,24]]},"408":{"position":[[2758,24]]},"434":{"position":[[2840,23]]},"645":{"position":[[2758,24]]},"681":{"position":[[2850,23]]}},"keywords":{}}],["hostenv::set_cal",{"_index":2414,"title":{},"content":{"198":{"position":[[3273,21]]},"434":{"position":[[3255,21]]},"681":{"position":[[3273,21]]}},"keywords":{}}],["hostenv::set_callerto",{"_index":2129,"title":{},"content":{"168":{"position":[[1289,21]]},"348":{"position":[[1289,21]]},"564":{"position":[[1289,21]]}},"keywords":{}}],["hostenv::try_change_ownership",{"_index":2417,"title":{},"content":{"198":{"position":[[3533,31]]},"434":{"position":[[3515,31]]},"681":{"position":[[3533,31]]}},"keywords":{}}],["hostref",{"_index":1927,"title":{},"content":{"141":{"position":[[13,7]]},"143":{"position":[[230,8],[1027,8]]},"157":{"position":[[232,8]]},"160":{"position":[[254,8]]},"198":{"position":[[86,9]]},"206":{"position":[[109,10]]},"268":{"position":[[927,8],[1968,7]]},"269":{"position":[[4000,9]]},"326":{"position":[[13,7]]},"328":{"position":[[230,8],[1002,8]]},"345":{"position":[[254,8]]},"395":{"position":[[435,8]]},"408":{"position":[[927,8],[1968,7]]},"409":{"position":[[4000,9]]},"426":{"position":[[109,10]]},"434":{"position":[[86,9]]},"440":{"position":[[4852,9]]},"441":{"position":[[4598,8]]},"477":{"position":[[1503,9]]},"535":{"position":[[13,7]]},"537":{"position":[[230,8],[1002,8]]},"547":{"position":[[232,8]]},"562":{"position":[[254,8]]},"632":{"position":[[435,8]]},"645":{"position":[[927,8],[1968,7]]},"646":{"position":[[4000,9]]},"668":{"position":[[109,10]]},"681":{"position":[[86,9]]},"687":{"position":[[4852,9]]},"688":{"position":[[4598,8]]},"699":{"position":[[1503,9]]}},"keywords":{}}],["hostref::last_cal",{"_index":2918,"title":{},"content":{"268":{"position":[[1884,20]]},"408":{"position":[[1884,20]]},"645":{"position":[[1884,20]]}},"keywords":{}}],["hostrefload",{"_index":3123,"title":{},"content":{"395":{"position":[[444,15]]},"632":{"position":[[444,15]]}},"keywords":{}}],["hostrefloader>::load(env",{"_index":1960,"title":{},"content":{"142":{"position":[[482,28]]},"327":{"position":[[482,28]]},"536":{"position":[[482,28]]}},"keywords":{}}],["hot",{"_index":676,"title":{},"content":{"23":{"position":[[61,4]]}},"keywords":{}}],["hour",{"_index":108,"title":{},"content":{"2":{"position":[[304,5],[496,5]]}},"keywords":{}}],["http://cspr.live",{"_index":1863,"title":{},"content":{"127":{"position":[[913,17]]},"278":{"position":[[913,17]]},"515":{"position":[[913,17]]}},"keywords":{}}],["http://localhost:11101",{"_index":2579,"title":{},"content":{"210":{"position":[[393,22],[1167,22]]},"389":{"position":[[393,22],[1104,22]]},"659":{"position":[[393,22],[1104,22]]}},"keywords":{}}],["https://rpc.uni.juno.deuslabs.fi:443",{"_index":1302,"title":{},"content":{"53":{"position":[[189,36]]}},"keywords":{}}],["https://rpc.uni.juno.deuslabs.fi:443"",{"_index":1237,"title":{},"content":{"52":{"position":[[604,42]]}},"keywords":{}}],["huge",{"_index":77,"title":{},"content":{"1":{"position":[[953,4]]},"31":{"position":[[371,4]]},"44":{"position":[[63,4]]}},"keywords":{}}],["huh",{"_index":1832,"title":{},"content":{"126":{"position":[[2990,4]]},"277":{"position":[[3158,4]]},"514":{"position":[[2990,4]]}},"keywords":{}}],["hurri",{"_index":3138,"title":{},"content":{"395":{"position":[[1437,6]]},"632":{"position":[[1437,6]]}},"keywords":{}}],["i'd",{"_index":196,"title":{},"content":{"6":{"position":[[0,3]]}},"keywords":{}}],["i)).unwrap_or_default",{"_index":3696,"title":{},"content":{"601":{"position":[[864,23]]},"709":{"position":[[864,23]]}},"keywords":{}}],["i.",{"_index":246,"title":{},"content":{"8":{"position":[[424,5]]},"9":{"position":[[785,5]]}},"keywords":{}}],["i2",{"_index":3632,"title":{},"content":{"598":{"position":[[402,3]]},"706":{"position":[[402,3]]}},"keywords":{}}],["i32",{"_index":3630,"title":{},"content":{"598":{"position":[[362,3],[1726,3]]},"706":{"position":[[362,3],[1726,3]]}},"keywords":{}}],["i64",{"_index":3634,"title":{},"content":{"598":{"position":[[425,3],[1353,3],[1734,3]]},"706":{"position":[[425,3],[1353,3],[1734,3]]}},"keywords":{}}],["id",{"_index":1238,"title":{},"content":{"52":{"position":[[673,2],[3226,2]]},"53":{"position":[[234,2]]},"441":{"position":[[5767,3]]},"688":{"position":[[5767,3]]}},"keywords":{}}],["identifi",{"_index":924,"title":{},"content":{"39":{"position":[[760,11]]},"42":{"position":[[890,11]]},"76":{"position":[[529,10]]},"107":{"position":[[143,10]]},"189":{"position":[[126,10],[155,11]]},"227":{"position":[[529,10]]},"274":{"position":[[143,10]]},"366":{"position":[[126,10],[155,11]]},"458":{"position":[[529,10]]},"491":{"position":[[143,10]]},"582":{"position":[[126,10],[155,11]]}},"keywords":{}}],["idiom",{"_index":1588,"title":{},"content":{"92":{"position":[[15,5],[356,5]]},"284":{"position":[[15,5],[356,5]]},"496":{"position":[[15,5],[356,5]]}},"keywords":{}}],["ignor",{"_index":2406,"title":{},"content":{"198":{"position":[[2347,6]]},"212":{"position":[[1318,6],[2448,6],[2725,6],[3139,6]]},"391":{"position":[[1318,6],[2448,6],[2731,6],[3157,6]]},"434":{"position":[[2337,6]]},"661":{"position":[[1318,6],[2448,6],[2731,6],[3157,6]]},"681":{"position":[[2347,6]]}},"keywords":{}}],["illustr",{"_index":3472,"title":{},"content":{"441":{"position":[[266,11]]},"688":{"position":[[266,11]]}},"keywords":{}}],["imag",{"_index":2570,"title":{},"content":{"210":{"position":[[63,5]]},"389":{"position":[[63,5]]},"477":{"position":[[95,6]]},"659":{"position":[[63,5]]},"699":{"position":[[95,6]]}},"keywords":{}}],["imagin",{"_index":558,"title":{},"content":{"18":{"position":[[397,7]]}},"keywords":{}}],["immut",{"_index":900,"title":{"599":{"position":[[14,13]]},"707":{"position":[[14,13]]}},"content":{"39":{"position":[[158,12]]},"202":{"position":[[141,9]]},"422":{"position":[[141,9]]},"599":{"position":[[349,9],[460,9],[666,9]]},"664":{"position":[[141,9]]},"707":{"position":[[349,9],[460,9],[666,9]]}},"keywords":{}}],["impl",{"_index":341,"title":{"147":{"position":[[0,5]]},"335":{"position":[[0,5]]},"552":{"position":[[0,5]]}},"content":{"10":{"position":[[787,4]]},"17":{"position":[[613,4],[2209,4]]},"22":{"position":[[1158,4]]},"51":{"position":[[559,4]]},"73":{"position":[[91,4],[317,4]]},"79":{"position":[[818,4]]},"80":{"position":[[338,4]]},"115":{"position":[[315,4],[2156,4]]},"147":{"position":[[150,4],[341,4],[634,4]]},"162":{"position":[[745,4]]},"164":{"position":[[532,4]]},"178":{"position":[[434,4]]},"185":{"position":[[502,4],[1449,4]]},"196":{"position":[[65,4],[617,4]]},"197":{"position":[[27,4]]},"204":{"position":[[50,4],[606,4],[1008,4],[1183,4]]},"205":{"position":[[269,4],[1182,4]]},"209":{"position":[[939,4]]},"221":{"position":[[57,4],[464,4]]},"222":{"position":[[74,4]]},"223":{"position":[[439,4]]},"230":{"position":[[835,4]]},"231":{"position":[[338,4]]},"237":{"position":[[91,4],[317,4]]},"247":{"position":[[80,4]]},"258":{"position":[[305,4],[2102,4]]},"269":{"position":[[538,4],[2477,4]]},"321":{"position":[[1023,4]]},"335":{"position":[[150,4],[341,4],[638,4]]},"351":{"position":[[767,4]]},"353":{"position":[[567,4]]},"369":{"position":[[434,4]]},"376":{"position":[[486,4],[1433,4]]},"384":{"position":[[551,4],[2504,4]]},"388":{"position":[[871,4]]},"409":{"position":[[538,4],[2477,4]]},"414":{"position":[[267,4]]},"419":{"position":[[1274,4]]},"424":{"position":[[25,4],[581,4],[959,4],[1133,4]]},"425":{"position":[[244,4],[1157,4]]},"432":{"position":[[27,4],[554,4]]},"433":{"position":[[27,4]]},"440":{"position":[[1130,4]]},"441":{"position":[[859,4],[2440,4]]},"446":{"position":[[80,4]]},"454":{"position":[[57,4],[464,4]]},"455":{"position":[[74,4]]},"456":{"position":[[439,4]]},"461":{"position":[[835,4]]},"462":{"position":[[338,4]]},"473":{"position":[[91,4],[317,4]]},"476":{"position":[[415,4]]},"481":{"position":[[305,4],[2102,4]]},"539":{"position":[[1023,4]]},"552":{"position":[[150,4],[341,4],[638,4]]},"567":{"position":[[767,4]]},"569":{"position":[[567,4]]},"585":{"position":[[434,4]]},"592":{"position":[[486,4],[1433,4]]},"596":{"position":[[289,4]]},"598":{"position":[[660,4]]},"599":{"position":[[132,4]]},"600":{"position":[[170,4]]},"601":{"position":[[177,4],[745,4],[1306,4]]},"602":{"position":[[238,4],[1274,4]]},"604":{"position":[[74,4],[128,4]]},"605":{"position":[[105,4]]},"606":{"position":[[136,4]]},"607":{"position":[[168,4],[249,4]]},"608":{"position":[[169,4]]},"610":{"position":[[200,4]]},"611":{"position":[[208,4]]},"612":{"position":[[508,4],[655,4],[802,4],[972,4],[1129,4],[1287,4]]},"613":{"position":[[363,4],[567,4],[924,4]]},"616":{"position":[[169,4],[601,4]]},"617":{"position":[[159,4],[666,4]]},"626":{"position":[[551,4],[2504,4]]},"646":{"position":[[538,4],[2477,4]]},"651":{"position":[[267,4]]},"656":{"position":[[1274,4]]},"658":{"position":[[871,4]]},"666":{"position":[[25,4],[581,4],[959,4],[1133,4]]},"667":{"position":[[244,4],[1157,4]]},"673":{"position":[[80,4]]},"679":{"position":[[27,4],[554,4]]},"680":{"position":[[27,4]]},"687":{"position":[[1130,4]]},"688":{"position":[[859,4],[2440,4]]},"694":{"position":[[57,4],[464,4]]},"695":{"position":[[74,4]]},"696":{"position":[[439,4]]},"698":{"position":[[415,4]]},"704":{"position":[[289,4]]},"706":{"position":[[660,4]]},"707":{"position":[[132,4]]},"708":{"position":[[170,4]]},"709":{"position":[[177,4],[745,4],[1306,4]]},"710":{"position":[[238,4],[1274,4]]},"712":{"position":[[74,4],[128,4]]},"713":{"position":[[105,4]]},"714":{"position":[[136,4]]},"715":{"position":[[168,4],[249,4]]},"716":{"position":[[169,4]]},"718":{"position":[[200,4]]},"719":{"position":[[208,4]]},"720":{"position":[[508,4],[655,4],[802,4],[972,4],[1129,4],[1287,4]]},"721":{"position":[[363,4],[567,4],[924,4]]},"724":{"position":[[169,4],[601,4]]},"725":{"position":[[159,4],[666,4]]}},"keywords":{}}],["implement",{"_index":508,"title":{"197":{"position":[[9,15]]},"414":{"position":[[6,15]]},"415":{"position":[[11,15]]},"433":{"position":[[9,15]]},"440":{"position":[[9,15]]},"651":{"position":[[6,15]]},"652":{"position":[[11,15]]},"680":{"position":[[9,15]]},"687":{"position":[[9,15]]}},"content":{"17":{"position":[[1711,9]]},"18":{"position":[[176,9]]},"39":{"position":[[1536,14]]},"40":{"position":[[222,15],[259,14]]},"42":{"position":[[800,9]]},"43":{"position":[[1846,15]]},"54":{"position":[[100,15]]},"81":{"position":[[359,9]]},"85":{"position":[[454,15]]},"90":{"position":[[47,9]]},"91":{"position":[[786,9]]},"100":{"position":[[40,15]]},"110":{"position":[[66,10],[198,12],[251,9],[328,14],[429,9]]},"111":{"position":[[161,12]]},"112":{"position":[[37,10]]},"114":{"position":[[379,11]]},"119":{"position":[[184,10]]},"138":{"position":[[907,10]]},"141":{"position":[[501,10],[1422,9]]},"145":{"position":[[117,14]]},"147":{"position":[[22,15],[78,14]]},"148":{"position":[[236,10],[679,10],[816,15]]},"163":{"position":[[1258,9],[1465,14]]},"165":{"position":[[95,12]]},"168":{"position":[[257,9]]},"178":{"position":[[306,15],[362,14],[1242,10]]},"185":{"position":[[79,15]]},"188":{"position":[[24,10],[85,10],[173,10],[298,9],[478,10],[568,10],[769,10]]},"189":{"position":[[39,14]]},"190":{"position":[[31,9]]},"194":{"position":[[69,10]]},"197":{"position":[[786,14],[1155,15],[1578,10]]},"198":{"position":[[1844,10]]},"200":{"position":[[29,9]]},"205":{"position":[[45,9],[2369,15]]},"223":{"position":[[74,9]]},"232":{"position":[[359,9]]},"254":{"position":[[454,15]]},"257":{"position":[[379,11]]},"268":{"position":[[431,10],[1987,11]]},"282":{"position":[[47,9]]},"283":{"position":[[786,9]]},"292":{"position":[[40,15]]},"300":{"position":[[184,10]]},"305":{"position":[[66,10],[198,12],[251,9],[328,14],[429,9]]},"306":{"position":[[161,12]]},"307":{"position":[[37,10]]},"318":{"position":[[899,10]]},"326":{"position":[[501,10],[1422,9]]},"333":{"position":[[117,14]]},"335":{"position":[[22,15],[78,14]]},"336":{"position":[[236,10],[679,10],[816,15]]},"348":{"position":[[257,9]]},"352":{"position":[[1280,9],[1487,14]]},"354":{"position":[[95,12],[207,9]]},"365":{"position":[[381,10],[442,10],[530,10],[655,9],[835,10],[925,10],[1126,10]]},"366":{"position":[[39,14]]},"367":{"position":[[31,9]]},"369":{"position":[[306,15],[362,14],[1242,10]]},"376":{"position":[[79,15]]},"408":{"position":[[431,10],[1987,11]]},"413":{"position":[[23,9]]},"414":{"position":[[683,14]]},"415":{"position":[[32,12],[295,9]]},"416":{"position":[[429,10],[1234,9]]},"417":{"position":[[21,14]]},"419":{"position":[[800,10],[1146,15],[1202,14]]},"425":{"position":[[45,9],[2319,15]]},"430":{"position":[[69,10]]},"433":{"position":[[785,14],[1154,15],[1577,10]]},"434":{"position":[[1834,10]]},"436":{"position":[[29,9]]},"440":{"position":[[12,12]]},"456":{"position":[[74,9]]},"463":{"position":[[359,9]]},"480":{"position":[[379,11]]},"485":{"position":[[454,15]]},"494":{"position":[[47,9]]},"495":{"position":[[786,9]]},"504":{"position":[[40,15]]},"510":{"position":[[66,10],[198,12],[251,9],[328,14],[429,9]]},"511":{"position":[[161,12]]},"512":{"position":[[37,10]]},"521":{"position":[[184,10]]},"535":{"position":[[501,10],[1422,9]]},"544":{"position":[[899,10]]},"550":{"position":[[117,14]]},"552":{"position":[[22,15],[78,14]]},"553":{"position":[[236,10],[679,10],[816,15]]},"564":{"position":[[257,9]]},"568":{"position":[[1280,9],[1487,14]]},"570":{"position":[[95,12],[207,9]]},"581":{"position":[[381,10],[442,10],[530,10],[655,9],[835,10],[925,10],[1126,10]]},"582":{"position":[[39,14]]},"583":{"position":[[31,9]]},"585":{"position":[[306,15],[362,14],[1242,10]]},"592":{"position":[[79,15]]},"596":{"position":[[600,9]]},"613":{"position":[[2065,10],[2076,12]]},"614":{"position":[[45,9]]},"616":{"position":[[1305,10]]},"618":{"position":[[619,15]]},"645":{"position":[[431,10],[1987,11]]},"650":{"position":[[23,9]]},"651":{"position":[[683,14]]},"652":{"position":[[32,12],[295,9]]},"653":{"position":[[429,10],[1234,9]]},"654":{"position":[[21,14]]},"656":{"position":[[800,10],[1146,15],[1202,14]]},"667":{"position":[[45,9],[2319,15]]},"677":{"position":[[69,10]]},"680":{"position":[[785,14],[1154,15],[1577,10]]},"681":{"position":[[1844,10]]},"683":{"position":[[29,9]]},"687":{"position":[[12,12]]},"696":{"position":[[74,9]]},"704":{"position":[[600,9]]},"721":{"position":[[2065,10],[2076,12]]},"722":{"position":[[45,9]]},"724":{"position":[[1305,10]]},"726":{"position":[[619,15]]}},"keywords":{}}],["import",{"_index":330,"title":{},"content":{"10":{"position":[[387,6]]},"31":{"position":[[34,9]]},"38":{"position":[[826,9]]},"126":{"position":[[1660,6]]},"145":{"position":[[193,9]]},"185":{"position":[[2913,9]]},"195":{"position":[[704,9]]},"267":{"position":[[797,6]]},"277":{"position":[[1828,6]]},"333":{"position":[[193,9]]},"376":{"position":[[2897,9]]},"407":{"position":[[797,6]]},"431":{"position":[[704,9]]},"514":{"position":[[1660,6]]},"550":{"position":[[193,9]]},"592":{"position":[[2897,9]]},"603":{"position":[[33,9]]},"644":{"position":[[797,6]]},"678":{"position":[[704,9]]},"711":{"position":[[33,9]]}},"keywords":{}}],["improv",{"_index":858,"title":{},"content":{"33":{"position":[[114,9]]},"163":{"position":[[1054,11]]},"352":{"position":[[1076,11]]},"568":{"position":[[1076,11]]}},"keywords":{}}],["inc_bi",{"_index":3313,"title":{},"content":{"419":{"position":[[3307,7]]},"656":{"position":[[3307,7]]}},"keywords":{}}],["includ",{"_index":1312,"title":{},"content":{"53":{"position":[[1238,8]]},"76":{"position":[[203,9]]},"110":{"position":[[543,7]]},"115":{"position":[[1387,8],[2996,7]]},"121":{"position":[[33,10]]},"195":{"position":[[493,8]]},"227":{"position":[[203,9]]},"258":{"position":[[1333,8],[2922,7]]},"302":{"position":[[33,10]]},"305":{"position":[[543,7]]},"324":{"position":[[603,8],[781,8],[975,8],[1273,8],[1460,8]]},"431":{"position":[[493,8]]},"438":{"position":[[31,7]]},"442":{"position":[[144,9]]},"458":{"position":[[203,9]]},"481":{"position":[[1333,8],[2922,7]]},"510":{"position":[[543,7]]},"523":{"position":[[33,10]]},"542":{"position":[[603,8],[781,8],[975,8],[1273,8],[1460,8]]},"599":{"position":[[383,9]]},"606":{"position":[[924,9]]},"678":{"position":[[493,8]]},"685":{"position":[[31,7]]},"689":{"position":[[144,9]]},"707":{"position":[[383,9]]},"714":{"position":[[924,9]]}},"keywords":{}}],["include_str",{"_index":733,"title":{},"content":{"31":{"position":[[592,13]]}},"keywords":{}}],["incom",{"_index":3342,"title":{},"content":{"438":{"position":[[275,6]]},"685":{"position":[[275,6]]}},"keywords":{}}],["incorpor",{"_index":1179,"title":{},"content":{"50":{"position":[[261,11]]},"80":{"position":[[67,12]]},"231":{"position":[[67,12]]},"321":{"position":[[407,12]]},"462":{"position":[[67,12]]},"539":{"position":[[407,12]]}},"keywords":{}}],["increas",{"_index":2137,"title":{},"content":{"168":{"position":[[1820,9]]},"348":{"position":[[1820,9]]},"419":{"position":[[3187,9]]},"564":{"position":[[1820,9]]},"656":{"position":[[3187,9]]}},"keywords":{}}],["increase_allowance(&mut",{"_index":3312,"title":{},"content":{"419":{"position":[[3250,27]]},"656":{"position":[[3250,27]]}},"keywords":{}}],["increment",{"_index":1191,"title":{},"content":{"51":{"position":[[290,9],[1473,11]]},"52":{"position":[[1414,9],[4825,9],[4933,9],[6521,11]]},"53":{"position":[[695,9],[1180,11]]},"78":{"position":[[101,12],[363,9]]},"81":{"position":[[189,9]]},"223":{"position":[[208,11]]},"229":{"position":[[101,12],[384,9]]},"232":{"position":[[189,9]]},"456":{"position":[[208,11]]},"460":{"position":[[101,12],[384,9]]},"463":{"position":[[189,9]]},"696":{"position":[[208,11]]}},"keywords":{}}],["increment(&mut",{"_index":1199,"title":{},"content":{"51":{"position":[[711,18]]},"223":{"position":[[469,18]]},"456":{"position":[[469,18]]},"696":{"position":[[469,18]]}},"keywords":{}}],["increment_and_get(&mut",{"_index":1487,"title":{},"content":{"80":{"position":[[447,26]]},"231":{"position":[[447,26]]},"462":{"position":[[447,26]]}},"keywords":{}}],["increment_only_if_unpaus",{"_index":2739,"title":{},"content":{"223":{"position":[[884,28]]},"456":{"position":[[884,28]]},"696":{"position":[[884,28]]}},"keywords":{}}],["incremented.th",{"_index":1189,"title":{},"content":{"51":{"position":[[199,15]]}},"keywords":{}}],["inde",{"_index":1297,"title":{},"content":{"52":{"position":[[6664,7]]},"247":{"position":[[1964,6]]},"396":{"position":[[521,7]]},"414":{"position":[[462,6]]},"446":{"position":[[1964,6]]},"633":{"position":[[521,7]]},"651":{"position":[[462,6]]},"673":{"position":[[1964,6]]}},"keywords":{}}],["index",{"_index":412,"title":{},"content":{"15":{"position":[[314,7]]},"39":{"position":[[1802,7],[1824,7]]},"85":{"position":[[73,5],[237,5],[270,7],[400,7],[797,5]]},"163":{"position":[[1661,6]]},"198":{"position":[[3120,5]]},"211":{"position":[[112,5],[590,5],[639,5]]},"212":{"position":[[3505,5],[3582,5],[3637,5]]},"254":{"position":[[73,5],[237,5],[270,7],[400,7],[797,5]]},"352":{"position":[[1683,6]]},"390":{"position":[[112,5],[564,5],[613,5]]},"391":{"position":[[3523,5],[3600,5],[3655,5]]},"434":{"position":[[3102,5]]},"485":{"position":[[73,5],[237,5],[270,7],[400,7],[797,5]]},"568":{"position":[[1683,6]]},"601":{"position":[[1765,6]]},"602":{"position":[[1418,6],[1587,6],[1785,6]]},"613":{"position":[[550,6],[640,6]]},"660":{"position":[[112,5],[564,5],[613,5]]},"661":{"position":[[3523,5],[3600,5],[3655,5]]},"681":{"position":[[3120,5]]},"709":{"position":[[1765,6]]},"710":{"position":[[1418,6],[1587,6],[1785,6]]},"721":{"position":[[550,6],[640,6]]}},"keywords":{}}],["indic",{"_index":2191,"title":{},"content":{"184":{"position":[[757,10]]},"202":{"position":[[255,10]]},"220":{"position":[[77,9]]},"375":{"position":[[676,10]]},"422":{"position":[[255,10]]},"440":{"position":[[4276,9]]},"453":{"position":[[77,9]]},"477":{"position":[[4039,8]]},"591":{"position":[[676,10]]},"608":{"position":[[695,8]]},"614":{"position":[[466,8]]},"664":{"position":[[255,10]]},"687":{"position":[[4276,9]]},"693":{"position":[[77,9]]},"699":{"position":[[4039,8]]},"716":{"position":[[695,8]]},"722":{"position":[[466,8]]}},"keywords":{}}],["individu",{"_index":914,"title":{},"content":{"39":{"position":[[529,10]]},"202":{"position":[[214,10]]},"422":{"position":[[214,10]]},"664":{"position":[[214,10]]}},"keywords":{}}],["ineffici",{"_index":2077,"title":{},"content":{"162":{"position":[[2362,12]]},"351":{"position":[[2384,12]]},"567":{"position":[[2384,12]]}},"keywords":{}}],["inexperienc",{"_index":3826,"title":{},"content":{"612":{"position":[[1778,13]]},"720":{"position":[[1778,13]]}},"keywords":{}}],["info",{"_index":682,"title":{},"content":{"24":{"position":[[46,4]]},"39":{"position":[[1108,4]]},"65":{"position":[[182,4]]},"127":{"position":[[266,4],[457,4],[878,4]]},"164":{"position":[[1118,4]]},"240":{"position":[[182,4]]},"278":{"position":[[266,4],[457,4],[878,4]]},"353":{"position":[[1153,4]]},"395":{"position":[[4563,4],[4605,4],[4872,4],[4989,4],[5185,4],[5539,4],[5656,4],[5998,4],[6115,4],[6175,4],[6518,4]]},"440":{"position":[[2001,4]]},"465":{"position":[[182,4]]},"477":{"position":[[2571,4],[2619,4],[2788,4],[2905,4],[3016,4],[3271,4],[3410,4],[3652,4]]},"515":{"position":[[266,4],[457,4],[878,4]]},"569":{"position":[[1153,4]]},"632":{"position":[[4563,4],[4605,4],[4872,4],[4989,4],[5185,4],[5539,4],[5656,4],[5998,4],[6115,4],[6175,4],[6518,4]]},"687":{"position":[[2001,4]]},"699":{"position":[[2571,4],[2619,4],[2788,4],[2905,4],[3016,4],[3271,4],[3410,4],[3652,4]]}},"keywords":{}}],["inform",{"_index":1794,"title":{},"content":{"126":{"position":[[58,11]]},"132":{"position":[[28,11]]},"163":{"position":[[225,11]]},"166":{"position":[[57,11]]},"185":{"position":[[2660,11]]},"195":{"position":[[410,7]]},"196":{"position":[[1375,6]]},"270":{"position":[[244,12]]},"277":{"position":[[58,11]]},"312":{"position":[[28,11]]},"323":{"position":[[115,11]]},"352":{"position":[[225,11]]},"355":{"position":[[57,11]]},"376":{"position":[[2644,11]]},"385":{"position":[[244,12]]},"410":{"position":[[244,12]]},"416":{"position":[[281,11]]},"431":{"position":[[410,7]]},"432":{"position":[[1317,6]]},"440":{"position":[[3473,11],[3902,11],[4184,11]]},"514":{"position":[[58,11]]},"529":{"position":[[28,11]]},"541":{"position":[[115,11]]},"568":{"position":[[225,11]]},"571":{"position":[[57,11]]},"592":{"position":[[2644,11]]},"600":{"position":[[816,11]]},"627":{"position":[[244,12]]},"647":{"position":[[244,12]]},"653":{"position":[[281,11]]},"678":{"position":[[410,7]]},"679":{"position":[[1317,6]]},"687":{"position":[[3473,11],[3902,11],[4184,11]]},"708":{"position":[[816,11]]}},"keywords":{}}],["inherit",{"_index":932,"title":{"612":{"position":[[16,12]]},"720":{"position":[[16,12]]}},"content":{"39":{"position":[[939,12],[1073,11],[1308,12],[1341,9]]},"612":{"position":[[34,11],[191,10],[365,11],[1394,12],[1433,7],[1580,9],[1614,12],[1704,11],[1863,11]]},"720":{"position":[[34,11],[191,10],[365,11],[1394,12],[1433,7],[1580,9],[1614,12],[1704,11],[1863,11]]}},"keywords":{}}],["init",{"_index":1210,"title":{"196":{"position":[[0,4]]},"432":{"position":[[0,4]]},"679":{"position":[[0,4]]}},"content":{"51":{"position":[[1294,4]]},"52":{"position":[[1094,4],[3326,4]]},"117":{"position":[[1281,4],[1306,4]]},"126":{"position":[[1870,4]]},"147":{"position":[[758,4],[908,4]]},"178":{"position":[[485,7]]},"196":{"position":[[680,4]]},"198":{"position":[[1584,7],[2680,6]]},"209":{"position":[[222,4]]},"267":{"position":[[4141,5]]},"268":{"position":[[596,4],[707,4],[854,4],[1056,4]]},"269":{"position":[[558,5]]},"277":{"position":[[2038,4]]},"298":{"position":[[1281,4],[1306,4]]},"324":{"position":[[1567,4]]},"335":{"position":[[766,4],[916,4]]},"369":{"position":[[485,7]]},"384":{"position":[[571,5]]},"388":{"position":[[222,4]]},"407":{"position":[[4141,5]]},"408":{"position":[[596,4],[707,4],[854,4],[1056,4]]},"409":{"position":[[558,5]]},"432":{"position":[[617,4]]},"434":{"position":[[1574,7],[2670,6]]},"440":{"position":[[3942,4]]},"514":{"position":[[1870,4]]},"519":{"position":[[1281,4],[1306,4]]},"542":{"position":[[1567,4]]},"552":{"position":[[766,4],[916,4]]},"585":{"position":[[485,7]]},"596":{"position":[[922,4],[1159,4]]},"626":{"position":[[571,5]]},"644":{"position":[[4141,5]]},"645":{"position":[[596,4],[707,4],[854,4],[1056,4]]},"646":{"position":[[558,5]]},"658":{"position":[[222,4]]},"679":{"position":[[617,4]]},"681":{"position":[[1584,7],[2680,6]]},"687":{"position":[[3942,4]]},"704":{"position":[[922,4],[1159,4]]}},"keywords":{}}],["init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"",{"_index":1289,"title":{},"content":{"52":{"position":[[4347,250]]}},"keywords":{}}],["init(&mut",{"_index":476,"title":{},"content":{"17":{"position":[[649,13],[2243,13]]},"22":{"position":[[1194,13]]},"51":{"position":[[595,13]]},"115":{"position":[[340,13],[2183,13]]},"147":{"position":[[252,13]]},"162":{"position":[[771,13]]},"164":{"position":[[559,13]]},"178":{"position":[[558,13]]},"196":{"position":[[87,13]]},"204":{"position":[[70,13]]},"209":{"position":[[964,13]]},"247":{"position":[[105,13]]},"258":{"position":[[330,13],[2129,13]]},"321":{"position":[[1121,13]]},"335":{"position":[[252,13]]},"351":{"position":[[793,13]]},"353":{"position":[[594,13]]},"369":{"position":[[558,13]]},"388":{"position":[[896,13]]},"419":{"position":[[1370,13]]},"424":{"position":[[45,13]]},"432":{"position":[[49,13]]},"440":{"position":[[1157,13]]},"446":{"position":[[105,13]]},"476":{"position":[[497,13]]},"481":{"position":[[330,13],[2129,13]]},"539":{"position":[[1121,13]]},"552":{"position":[[252,13]]},"567":{"position":[[793,13]]},"569":{"position":[[594,13]]},"585":{"position":[[558,13]]},"596":{"position":[[314,13]]},"598":{"position":[[685,13]]},"600":{"position":[[194,13]]},"601":{"position":[[1326,13]]},"608":{"position":[[191,13]]},"616":{"position":[[688,13]]},"617":{"position":[[181,13]]},"656":{"position":[[1370,13]]},"658":{"position":[[896,13]]},"666":{"position":[[45,13]]},"673":{"position":[[105,13]]},"679":{"position":[[49,13]]},"687":{"position":[[1157,13]]},"698":{"position":[[497,13]]},"704":{"position":[[314,13]]},"706":{"position":[[685,13]]},"708":{"position":[[194,13]]},"709":{"position":[[1326,13]]},"716":{"position":[[191,13]]},"724":{"position":[[688,13]]},"725":{"position":[[181,13]]}},"keywords":{}}],["init(symbol",{"_index":3298,"title":{},"content":{"419":{"position":[[1557,13]]},"656":{"position":[[1557,13]]}},"keywords":{}}],["init_arg",{"_index":1821,"title":{},"content":{"126":{"position":[[2328,9],[2462,11]]},"138":{"position":[[480,9],[632,11]]},"143":{"position":[[394,9],[551,11]]},"168":{"position":[[599,9],[750,11],[857,9],[1010,11]]},"198":{"position":[[191,9],[284,11]]},"268":{"position":[[1186,9],[1376,11],[3086,11]]},"277":{"position":[[2496,9],[2630,11]]},"318":{"position":[[472,9],[624,11]]},"348":{"position":[[599,9],[750,11],[857,9],[1010,11]]},"395":{"position":[[1985,9],[2121,10]]},"408":{"position":[[1186,9],[1376,11],[3086,11]]},"417":{"position":[[185,9],[396,11]]},"419":{"position":[[6600,9],[6811,11]]},"434":{"position":[[191,9],[284,11]]},"440":{"position":[[4991,9],[5200,11]]},"441":{"position":[[4816,9],[5098,11]]},"514":{"position":[[2328,9],[2462,11]]},"544":{"position":[[472,9],[624,11]]},"564":{"position":[[599,9],[750,11],[857,9],[1010,11]]},"632":{"position":[[1985,9],[2121,10]]},"645":{"position":[[1186,9],[1376,11],[3086,11]]},"654":{"position":[[185,9],[396,11]]},"656":{"position":[[6600,9],[6811,11]]},"681":{"position":[[191,9],[284,11]]},"687":{"position":[[4991,9],[5200,11]]},"688":{"position":[[4816,9],[5098,11]]}},"keywords":{}}],["initarg",{"_index":2010,"title":{},"content":{"148":{"position":[[839,8]]},"336":{"position":[[839,8]]},"553":{"position":[[839,8]]}},"keywords":{}}],["initi",{"_index":661,"title":{},"content":{"22":{"position":[[946,7]]},"31":{"position":[[1322,11]]},"51":{"position":[[136,7]]},"52":{"position":[[3186,10],[3267,7],[4709,11],[6494,7]]},"72":{"position":[[115,7]]},"85":{"position":[[314,9]]},"99":{"position":[[178,7]]},"126":{"position":[[1383,10]]},"147":{"position":[[195,11],[970,15]]},"162":{"position":[[1645,12]]},"175":{"position":[[152,10]]},"178":{"position":[[501,11]]},"189":{"position":[[400,9]]},"194":{"position":[[94,11]]},"197":{"position":[[1708,12]]},"198":{"position":[[1179,14],[1795,7],[3034,7]]},"204":{"position":[[1151,7]]},"206":{"position":[[531,16],[585,7]]},"221":{"position":[[629,12]]},"236":{"position":[[115,7]]},"247":{"position":[[1638,10]]},"254":{"position":[[314,9]]},"269":{"position":[[4441,16],[4495,7]]},"277":{"position":[[1551,10]]},"291":{"position":[[178,7]]},"321":{"position":[[1045,11]]},"335":{"position":[[195,11],[978,15]]},"351":{"position":[[1667,12]]},"361":{"position":[[152,10]]},"366":{"position":[[400,9]]},"369":{"position":[[501,11]]},"409":{"position":[[4441,16],[4495,7]]},"419":{"position":[[1294,11],[1347,7]]},"424":{"position":[[1101,7]]},"426":{"position":[[531,16],[585,7]]},"430":{"position":[[94,11]]},"433":{"position":[[1707,12]]},"434":{"position":[[1169,14],[1785,7],[3016,7]]},"446":{"position":[[1638,10]]},"454":{"position":[[629,12]]},"472":{"position":[[115,7]]},"476":{"position":[[441,11]]},"485":{"position":[[314,9]]},"503":{"position":[[178,7]]},"514":{"position":[[1383,10]]},"539":{"position":[[1045,11]]},"552":{"position":[[195,11],[978,15]]},"567":{"position":[[1667,12]]},"577":{"position":[[152,10]]},"582":{"position":[[400,9]]},"585":{"position":[[501,11]]},"596":{"position":[[1118,10]]},"616":{"position":[[630,11]]},"618":{"position":[[141,15]]},"646":{"position":[[4441,16],[4495,7]]},"656":{"position":[[1294,11],[1347,7]]},"666":{"position":[[1101,7]]},"668":{"position":[[531,16],[585,7]]},"673":{"position":[[1638,10]]},"677":{"position":[[94,11]]},"680":{"position":[[1707,12]]},"681":{"position":[[1179,14],[1795,7],[3034,7]]},"694":{"position":[[629,12]]},"698":{"position":[[441,11]]},"704":{"position":[[1118,10]]},"724":{"position":[[630,11]]},"726":{"position":[[141,15]]}},"keywords":{}}],["initial_suppli",{"_index":1719,"title":{},"content":{"115":{"position":[[404,15],[533,16],[2247,15],[2396,16]]},"126":{"position":[[1999,15],[2380,15]]},"204":{"position":[[134,15]]},"206":{"position":[[238,15],[474,15]]},"247":{"position":[[169,15],[298,16]]},"258":{"position":[[394,15],[523,16],[2193,15],[2342,16]]},"268":{"position":[[1286,15]]},"269":{"position":[[623,15],[801,14],[888,16],[1007,14],[4142,15],[4378,15]]},"277":{"position":[[2167,15],[2548,15]]},"384":{"position":[[636,15],[814,14],[901,16],[1020,14]]},"395":{"position":[[1945,14],[2040,15]]},"408":{"position":[[1286,15]]},"409":{"position":[[623,15],[801,14],[888,16],[1007,14],[4142,15],[4378,15]]},"417":{"position":[[305,15]]},"419":{"position":[[1434,15],[1587,15],[6720,15]]},"424":{"position":[[109,15]]},"426":{"position":[[238,15],[474,15]]},"446":{"position":[[169,15],[298,16]]},"481":{"position":[[394,15],[523,16],[2193,15],[2342,16]]},"514":{"position":[[1999,15],[2380,15]]},"626":{"position":[[636,15],[814,14],[901,16],[1020,14]]},"632":{"position":[[1945,14],[2040,15]]},"645":{"position":[[1286,15]]},"646":{"position":[[623,15],[801,14],[888,16],[1007,14],[4142,15],[4378,15]]},"654":{"position":[[305,15]]},"656":{"position":[[1434,15],[1587,15],[6720,15]]},"666":{"position":[[109,15]]},"668":{"position":[[238,15],[474,15]]},"673":{"position":[[169,15],[298,16]]}},"keywords":{}}],["initial_supply.into",{"_index":2500,"title":{},"content":{"206":{"position":[[490,21],[874,23],[1046,21]]},"269":{"position":[[4784,23],[4956,21]]},"409":{"position":[[4784,23],[4956,21]]},"426":{"position":[[490,21],[874,23],[1041,21]]},"646":{"position":[[4784,23],[4956,21]]},"668":{"position":[[490,21],[874,23],[1046,21]]}},"keywords":{}}],["initial_supply.is_zero",{"_index":2931,"title":{},"content":{"269":{"position":[[908,25]]},"384":{"position":[[921,25]]},"409":{"position":[[908,25]]},"626":{"position":[[921,25]]},"646":{"position":[[908,25]]}},"keywords":{}}],["initialization.l76",{"_index":3423,"title":{},"content":{"440":{"position":[[4054,18]]},"687":{"position":[[4054,18]]}},"keywords":{}}],["initialization_work",{"_index":2384,"title":{},"content":{"198":{"position":[[342,22]]},"434":{"position":[[342,22]]},"681":{"position":[[342,22]]}},"keywords":{}}],["initialown",{"_index":1118,"title":{},"content":{"43":{"position":[[298,13]]}},"keywords":{}}],["ink",{"_index":631,"title":{},"content":{"21":{"position":[[250,4]]}},"keywords":{}}],["inlin",{"_index":3507,"title":{},"content":{"441":{"position":[[3547,9],[3651,9]]},"606":{"position":[[322,9],[464,9],[904,6],[987,9]]},"688":{"position":[[3547,9],[3651,9]]},"714":{"position":[[322,9],[464,9],[904,6],[987,9]]}},"keywords":{}}],["inner",{"_index":1536,"title":{},"content":{"85":{"position":[[285,5]]},"209":{"position":[[1554,6]]},"211":{"position":[[378,6]]},"254":{"position":[[285,5]]},"388":{"position":[[1486,6]]},"390":{"position":[[365,6]]},"485":{"position":[[285,5]]},"601":{"position":[[377,5]]},"658":{"position":[[1486,6]]},"660":{"position":[[365,6]]},"709":{"position":[[377,5]]}},"keywords":{}}],["innerdata",{"_index":2566,"title":{},"content":{"209":{"position":[[1644,9]]},"211":{"position":[[385,10]]},"388":{"position":[[1576,9]]},"390":{"position":[[372,10]]},"658":{"position":[[1576,9]]},"660":{"position":[[372,10]]}},"keywords":{}}],["input",{"_index":454,"title":{},"content":{"17":{"position":[[159,5]]},"31":{"position":[[689,6],[785,6],[834,6],[871,6],[2338,5]]},"32":{"position":[[382,6],[608,5],[914,5],[1308,5]]},"40":{"position":[[116,5]]},"42":{"position":[[346,5]]},"197":{"position":[[995,5]]},"433":{"position":[[994,5]]},"616":{"position":[[1375,5]]},"680":{"position":[[994,5]]},"724":{"position":[[1375,5]]}},"keywords":{}}],["inputlowerthanten",{"_index":3800,"title":{},"content":{"611":{"position":[[133,17]]},"719":{"position":[[133,17]]}},"keywords":{}}],["insid",{"_index":1601,"title":{},"content":{"92":{"position":[[769,6]]},"168":{"position":[[1465,6]]},"284":{"position":[[769,6]]},"348":{"position":[[1465,6]]},"496":{"position":[[769,6]]},"564":{"position":[[1465,6]]},"607":{"position":[[143,6],[232,6],[323,6]]},"715":{"position":[[143,6],[232,6],[323,6]]}},"keywords":{}}],["insight",{"_index":1162,"title":{},"content":{"43":{"position":[[1987,7]]},"270":{"position":[[479,8]]},"385":{"position":[[479,8]]},"410":{"position":[[479,8]]},"627":{"position":[[479,8]]},"647":{"position":[[479,8]]}},"keywords":{}}],["inspir",{"_index":679,"title":{},"content":{"23":{"position":[[226,8]]},"188":{"position":[[821,8]]},"365":{"position":[[111,8],[291,8],[1178,8]]},"581":{"position":[[111,8],[291,8],[1178,8]]}},"keywords":{}}],["instal",{"_index":683,"title":{"172":{"position":[[0,12]]},"174":{"position":[[0,10]]},"358":{"position":[[0,12]]},"360":{"position":[[0,10]]},"574":{"position":[[0,12]]},"576":{"position":[[0,10]]}},"content":{"26":{"position":[[8,12]]},"28":{"position":[[8,12]]},"31":{"position":[[190,7]]},"36":{"position":[[8,12]]},"46":{"position":[[8,12]]},"48":{"position":[[8,12]]},"57":{"position":[[8,12]]},"59":{"position":[[8,12]]},"61":{"position":[[8,12]]},"63":{"position":[[8,12]]},"91":{"position":[[331,10]]},"173":{"position":[[59,9],[101,9],[141,9],[199,10]]},"174":{"position":[[171,10],[185,7],[241,7],[289,9]]},"175":{"position":[[569,12]]},"214":{"position":[[8,12]]},"216":{"position":[[8,12]]},"225":{"position":[[8,12]]},"261":{"position":[[54,9],[120,7],[171,7]]},"283":{"position":[[331,10]]},"359":{"position":[[59,9],[101,9],[141,9],[199,10]]},"360":{"position":[[171,10],[185,7],[241,7],[289,9]]},"361":{"position":[[569,12]]},"365":{"position":[[277,13]]},"379":{"position":[[54,9],[120,7],[171,7]]},"393":{"position":[[69,7]]},"401":{"position":[[54,9],[120,7],[171,7]]},"449":{"position":[[8,12]]},"495":{"position":[[331,10]]},"575":{"position":[[59,9],[101,9],[141,9],[199,10]]},"576":{"position":[[171,10],[185,7],[241,7],[289,9]]},"577":{"position":[[569,12]]},"581":{"position":[[277,13]]},"621":{"position":[[54,9],[120,7],[171,7]]},"630":{"position":[[69,7]]},"638":{"position":[[54,9],[120,7],[171,7]]}},"keywords":{}}],["instanc",{"_index":717,"title":{},"content":{"31":{"position":[[132,8]]},"85":{"position":[[854,9]]},"95":{"position":[[491,8]]},"119":{"position":[[457,9]]},"141":{"position":[[326,8]]},"143":{"position":[[649,8]]},"168":{"position":[[1181,8],[1241,9]]},"196":{"position":[[1636,8]]},"198":{"position":[[1671,8]]},"206":{"position":[[3365,9]]},"254":{"position":[[854,9]]},"267":{"position":[[4378,8]]},"268":{"position":[[1958,9]]},"287":{"position":[[491,8]]},"300":{"position":[[457,9]]},"326":{"position":[[326,8]]},"328":{"position":[[624,8]]},"348":{"position":[[1181,8],[1241,9]]},"407":{"position":[[4378,8]]},"408":{"position":[[1958,9]]},"426":{"position":[[3340,9]]},"432":{"position":[[1514,8]]},"434":{"position":[[1661,8]]},"485":{"position":[[854,9]]},"499":{"position":[[491,8]]},"521":{"position":[[457,9]]},"535":{"position":[[326,8]]},"537":{"position":[[624,8]]},"564":{"position":[[1181,8],[1241,9]]},"600":{"position":[[1166,8]]},"644":{"position":[[4378,8]]},"645":{"position":[[1958,9]]},"668":{"position":[[3365,9]]},"679":{"position":[[1514,8]]},"681":{"position":[[1671,8]]},"708":{"position":[[1166,8]]}},"keywords":{}}],["instant",{"_index":1862,"title":{},"content":{"127":{"position":[[829,7]]},"128":{"position":[[423,7]]},"278":{"position":[[829,7]]},"279":{"position":[[423,7]]},"515":{"position":[[829,7]]},"516":{"position":[[423,7]]}},"keywords":{}}],["instanti",{"_index":1080,"title":{},"content":{"42":{"position":[[1929,11]]},"52":{"position":[[1158,11],[1960,11],[2031,13]]}},"keywords":{}}],["instantli",{"_index":1699,"title":{},"content":{"107":{"position":[[475,9]]},"274":{"position":[[475,9]]},"491":{"position":[[475,9]]}},"keywords":{}}],["instead",{"_index":1703,"title":{},"content":{"110":{"position":[[459,7]]},"117":{"position":[[1367,7]]},"141":{"position":[[149,8]]},"142":{"position":[[53,7]]},"143":{"position":[[813,8]]},"164":{"position":[[80,7]]},"197":{"position":[[1861,8]]},"198":{"position":[[3565,7],[3747,7]]},"203":{"position":[[568,8]]},"264":{"position":[[107,8]]},"268":{"position":[[362,7]]},"298":{"position":[[1367,7]]},"305":{"position":[[459,7]]},"326":{"position":[[149,8]]},"327":{"position":[[53,7]]},"328":{"position":[[788,8]]},"353":{"position":[[80,7]]},"396":{"position":[[708,7]]},"404":{"position":[[107,8]]},"408":{"position":[[362,7]]},"416":{"position":[[4691,7]]},"423":{"position":[[568,8]]},"433":{"position":[[1860,8]]},"434":{"position":[[3547,7],[3729,7]]},"510":{"position":[[459,7]]},"519":{"position":[[1367,7]]},"535":{"position":[[149,8]]},"536":{"position":[[53,7]]},"537":{"position":[[788,8]]},"569":{"position":[[80,7]]},"601":{"position":[[354,7],[2218,7]]},"602":{"position":[[1128,7]]},"606":{"position":[[603,8]]},"612":{"position":[[180,7]]},"614":{"position":[[392,8]]},"633":{"position":[[708,7]]},"641":{"position":[[107,8]]},"645":{"position":[[362,7]]},"653":{"position":[[4691,7]]},"665":{"position":[[568,8]]},"680":{"position":[[1860,8]]},"681":{"position":[[3565,7],[3747,7]]},"709":{"position":[[354,7],[2218,7]]},"710":{"position":[[1128,7]]},"714":{"position":[[603,8]]},"720":{"position":[[180,7]]},"722":{"position":[[392,8]]}},"keywords":{}}],["instruct",{"_index":3105,"title":{},"content":{"393":{"position":[[99,12]]},"630":{"position":[[99,12]]}},"keywords":{}}],["insuffici",{"_index":3434,"title":{},"content":{"440":{"position":[[4691,12],[5880,12]]},"687":{"position":[[4691,12],[5880,12]]}},"keywords":{}}],["insufficientallow",{"_index":549,"title":{},"content":{"17":{"position":[[4037,21]]},"205":{"position":[[2240,21]]},"267":{"position":[[1361,21]]},"269":{"position":[[3724,21]]},"383":{"position":[[807,21]]},"384":{"position":[[3688,21]]},"407":{"position":[[1361,21]]},"409":{"position":[[3724,21]]},"425":{"position":[[2190,21]]},"625":{"position":[[807,21]]},"626":{"position":[[3688,21]]},"644":{"position":[[1361,21]]},"646":{"position":[[3724,21]]},"667":{"position":[[2190,21]]}},"keywords":{}}],["insufficientbal",{"_index":548,"title":{},"content":{"17":{"position":[[4008,19]]},"205":{"position":[[2215,19]]},"267":{"position":[[1331,19]]},"269":{"position":[[3694,19]]},"383":{"position":[[777,19]]},"384":{"position":[[3658,19]]},"407":{"position":[[1331,19]]},"409":{"position":[[3694,19]]},"425":{"position":[[2165,19]]},"476":{"position":[[1679,19]]},"611":{"position":[[108,19]]},"625":{"position":[[777,19]]},"626":{"position":[[3658,19]]},"644":{"position":[[1331,19]]},"646":{"position":[[3694,19]]},"667":{"position":[[2165,19]]},"698":{"position":[[1679,19]]},"719":{"position":[[108,19]]}},"keywords":{}}],["insufficientfund",{"_index":3364,"title":{},"content":{"440":{"position":[[824,17]]},"687":{"position":[[824,17]]}},"keywords":{}}],["integ",{"_index":253,"title":{},"content":{"8":{"position":[[558,7]]},"267":{"position":[[311,7]]},"407":{"position":[[311,7]]},"598":{"position":[[261,7],[327,7],[389,7],[451,7],[1561,7],[1650,7],[1712,9],[1749,9]]},"644":{"position":[[311,7]]},"706":{"position":[[261,7],[327,7],[389,7],[451,7],[1561,7],[1650,7],[1712,9],[1749,9]]}},"keywords":{}}],["integr",{"_index":621,"title":{},"content":{"21":{"position":[[34,10]]},"22":{"position":[[479,10]]},"50":{"position":[[142,10]]},"54":{"position":[[339,11]]},"91":{"position":[[224,10]]},"97":{"position":[[206,12],[361,12]]},"98":{"position":[[625,11]]},"110":{"position":[[305,12]]},"126":{"position":[[829,11]]},"129":{"position":[[360,11]]},"277":{"position":[[829,11]]},"280":{"position":[[360,11]]},"283":{"position":[[224,10]]},"289":{"position":[[206,12],[361,12]]},"290":{"position":[[625,11]]},"305":{"position":[[305,12]]},"495":{"position":[[224,10]]},"501":{"position":[[206,12],[361,12]]},"502":{"position":[[625,11]]},"510":{"position":[[305,12]]},"514":{"position":[[829,11]]},"517":{"position":[[360,11]]}},"keywords":{}}],["integration.env",{"_index":1868,"title":{},"content":{"129":{"position":[[261,15],[434,15],[683,15]]},"280":{"position":[[261,15],[434,15],[684,15]]},"517":{"position":[[261,15],[434,15],[684,15]]}},"keywords":{}}],["intend",{"_index":1313,"title":{},"content":{"53":{"position":[[1404,9]]},"143":{"position":[[932,6]]},"221":{"position":[[414,8]]},"328":{"position":[[907,6]]},"454":{"position":[[414,8]]},"537":{"position":[[907,6]]},"694":{"position":[[414,8]]}},"keywords":{}}],["intention",{"_index":885,"title":{},"content":{"38":{"position":[[871,13]]}},"keywords":{}}],["interact",{"_index":1082,"title":{"161":{"position":[[8,11]]},"350":{"position":[[8,11]]},"566":{"position":[[8,11]]}},"content":{"42":{"position":[[1982,8]]},"52":{"position":[[372,8],[510,12],[1934,8]]},"76":{"position":[[123,12],[168,11]]},"111":{"position":[[198,11]]},"141":{"position":[[760,8]]},"146":{"position":[[829,12]]},"147":{"position":[[1298,8]]},"198":{"position":[[3359,12]]},"227":{"position":[[123,12],[168,11]]},"268":{"position":[[1401,14]]},"306":{"position":[[198,11]]},"326":{"position":[[760,8]]},"334":{"position":[[833,12]]},"335":{"position":[[1306,8]]},"395":{"position":[[6846,8]]},"397":{"position":[[129,8]]},"398":{"position":[[62,10]]},"408":{"position":[[1401,14]]},"418":{"position":[[116,8]]},"434":{"position":[[3341,12]]},"441":{"position":[[2033,8]]},"458":{"position":[[123,12],[168,11]]},"477":{"position":[[14,8],[525,8],[653,9]]},"478":{"position":[[381,12]]},"511":{"position":[[198,11]]},"535":{"position":[[760,8]]},"551":{"position":[[833,12]]},"552":{"position":[[1306,8]]},"603":{"position":[[238,11]]},"632":{"position":[[6846,8]]},"634":{"position":[[129,8]]},"635":{"position":[[62,10]]},"645":{"position":[[1401,14]]},"655":{"position":[[116,8]]},"681":{"position":[[3359,12]]},"688":{"position":[[2033,8]]},"699":{"position":[[14,8],[525,8],[653,9]]},"700":{"position":[[381,12]]},"711":{"position":[[238,11]]}},"keywords":{}}],["interchang",{"_index":2407,"title":{},"content":{"198":{"position":[[2515,15]]},"434":{"position":[[2505,15]]},"681":{"position":[[2515,15]]}},"keywords":{}}],["interest",{"_index":392,"title":{},"content":{"13":{"position":[[0,10]]},"18":{"position":[[141,11]]},"34":{"position":[[0,11]]},"55":{"position":[[0,11]]},"185":{"position":[[35,11]]},"376":{"position":[[35,11]]},"416":{"position":[[3082,11]]},"592":{"position":[[35,11]]},"653":{"position":[[3082,11]]}},"keywords":{}}],["interfac",{"_index":627,"title":{},"content":{"21":{"position":[[183,9]]},"23":{"position":[[107,10]]},"39":{"position":[[2109,11]]},"52":{"position":[[319,9]]},"54":{"position":[[319,10]]},"83":{"position":[[482,9]]},"110":{"position":[[29,9]]},"252":{"position":[[482,9]]},"305":{"position":[[29,9]]},"365":{"position":[[60,9]]},"483":{"position":[[482,9]]},"510":{"position":[[29,9]]},"581":{"position":[[60,9]]},"609":{"position":[[316,9]]},"613":{"position":[[1977,10]]},"717":{"position":[[316,9]]},"721":{"position":[[1977,10]]}},"keywords":{}}],["interface.allow",{"_index":2752,"title":{},"content":{"245":{"position":[[56,15]]},"444":{"position":[[56,15]]},"671":{"position":[[56,15]]}},"keywords":{}}],["interface.l29",{"_index":3321,"title":{},"content":{"424":{"position":[[1235,13]]},"666":{"position":[[1235,13]]}},"keywords":{}}],["interface.l34",{"_index":2455,"title":{},"content":{"204":{"position":[[1285,13]]}},"keywords":{}}],["intermediari",{"_index":3470,"title":{},"content":{"441":{"position":[[73,12]]},"688":{"position":[[73,12]]}},"keywords":{}}],["intern",{"_index":1127,"title":{"144":{"position":[[8,9]]},"332":{"position":[[8,9]]},"549":{"position":[[8,9]]}},"content":{"43":{"position":[[528,8],[1916,8]]},"78":{"position":[[114,11]]},"95":{"position":[[382,10]]},"110":{"position":[[498,10]]},"175":{"position":[[345,8]]},"229":{"position":[[114,11]]},"267":{"position":[[2463,10]]},"287":{"position":[[382,10]]},"305":{"position":[[498,10]]},"361":{"position":[[345,8]]},"407":{"position":[[2463,10]]},"460":{"position":[[114,11]]},"499":{"position":[[382,10]]},"510":{"position":[[498,10]]},"577":{"position":[[345,8]]},"604":{"position":[[44,8],[424,8]]},"644":{"position":[[2463,10]]},"712":{"position":[[44,8],[424,8]]}},"keywords":{}}],["internal_transfer(&mut",{"_index":3748,"title":{},"content":{"604":{"position":[[320,26]]},"712":{"position":[[320,26]]}},"keywords":{}}],["into<executionerror>>(error",{"_index":2864,"title":{},"content":{"267":{"position":[[2666,37]]},"407":{"position":[[2666,37]]},"644":{"position":[[2666,37]]}},"keywords":{}}],["into<odra::odraerror>",{"_index":2337,"title":{},"content":{"196":{"position":[[1051,27]]},"432":{"position":[[996,27]]},"679":{"position":[[996,27]]}},"keywords":{}}],["into<odraerror>>(&self",{"_index":2866,"title":{},"content":{"267":{"position":[[2738,36]]},"407":{"position":[[2738,36]]},"644":{"position":[[2738,36]]}},"keywords":{}}],["into::into",{"_index":1925,"title":{},"content":{"138":{"position":[[1274,13]]},"318":{"position":[[1266,13]]},"544":{"position":[[1266,13]]}},"keywords":{}}],["intro",{"_index":2714,"title":{},"content":{"221":{"position":[[389,6]]},"454":{"position":[[389,6]]},"694":{"position":[[389,6]]}},"keywords":{}}],["introduc",{"_index":171,"title":{},"content":{"5":{"position":[[96,10]]},"6":{"position":[[12,9]]},"205":{"position":[[142,9]]},"262":{"position":[[98,10]]},"264":{"position":[[11,10]]},"380":{"position":[[98,10]]},"402":{"position":[[98,10]]},"404":{"position":[[11,10]]},"425":{"position":[[142,9]]},"441":{"position":[[60,9]]},"622":{"position":[[98,10]]},"639":{"position":[[98,10]]},"641":{"position":[[11,10]]},"667":{"position":[[142,9]]},"688":{"position":[[60,9]]}},"keywords":{}}],["introduct",{"_index":3601,"title":{"594":{"position":[[0,13]]},"702":{"position":[[0,13]]}},"content":{},"keywords":{}}],["invalid",{"_index":2203,"title":{},"content":{"184":{"position":[[1144,7]]},"321":{"position":[[1899,7],[1937,7]]},"375":{"position":[[1041,7]]},"539":{"position":[[1899,7],[1937,7]]},"591":{"position":[[1041,7]]}},"keywords":{}}],["invalid"",{"_index":3012,"title":{},"content":{"323":{"position":[[1462,14],[1598,14]]},"541":{"position":[[1462,14],[1598,14]]}},"keywords":{}}],["invalidnam",{"_index":2981,"title":{},"content":{"321":{"position":[[1945,12]]},"539":{"position":[[1945,12]]}},"keywords":{}}],["invalidown",{"_index":2980,"title":{},"content":{"321":{"position":[[1907,13]]},"539":{"position":[[1907,13]]}},"keywords":{}}],["invalidticketid",{"_index":3366,"title":{},"content":{"440":{"position":[[849,15]]},"687":{"position":[[849,15]]}},"keywords":{}}],["ip",{"_index":3170,"title":{},"content":{"395":{"position":[[4347,2]]},"632":{"position":[[4347,2]]}},"keywords":{}}],["is_approv",{"_index":3465,"title":{},"content":{"440":{"position":[[6426,12]]},"687":{"position":[[6426,12]]}},"keywords":{}}],["is_oper",{"_index":3466,"title":{},"content":{"440":{"position":[[6450,12]]},"441":{"position":[[4290,11]]},"687":{"position":[[6450,12]]},"688":{"position":[[4290,11]]}},"keywords":{}}],["is_operator(&self",{"_index":3508,"title":{},"content":{"441":{"position":[[3560,22]]},"688":{"position":[[3560,22]]}},"keywords":{}}],["is_own",{"_index":3464,"title":{},"content":{"440":{"position":[[6405,9]]},"687":{"position":[[6405,9]]}},"keywords":{}}],["is_paus",{"_index":2705,"title":{},"content":{"220":{"position":[[211,10]]},"221":{"position":[[556,11],[606,9]]},"453":{"position":[[211,10]]},"454":{"position":[[556,11],[606,9]]},"693":{"position":[[211,10]]},"694":{"position":[[556,11],[606,9]]}},"keywords":{}}],["is_paused(&self",{"_index":2706,"title":{},"content":{"221":{"position":[[80,20]]},"454":{"position":[[80,20]]},"694":{"position":[[80,20]]}},"keywords":{}}],["is_vote_open",{"_index":3223,"title":{},"content":{"416":{"position":[[667,13],[1112,12],[2255,12]]},"419":{"position":[[1038,13]]},"653":{"position":[[667,13],[1112,12],[2255,12]]},"656":{"position":[[1038,13]]}},"keywords":{}}],["ish",{"_index":2492,"title":{},"content":{"205":{"position":[[2358,3]]},"425":{"position":[[2308,3]]},"667":{"position":[[2308,3]]}},"keywords":{}}],["ishash",{"_index":3187,"title":{},"content":{"395":{"position":[[6886,6]]},"632":{"position":[[6886,6]]}},"keywords":{}}],["isn't",{"_index":671,"title":{},"content":{"22":{"position":[[1470,5]]}},"keywords":{}}],["isol",{"_index":2779,"title":{},"content":{"248":{"position":[[139,10]]},"447":{"position":[[139,10]]},"674":{"position":[[139,10]]}},"keywords":{}}],["issu",{"_index":1508,"title":{},"content":{"83":{"position":[[232,5]]},"162":{"position":[[2426,5]]},"252":{"position":[[232,5]]},"270":{"position":[[29,6]]},"351":{"position":[[2448,5]]},"385":{"position":[[29,6]]},"410":{"position":[[29,6]]},"438":{"position":[[142,5]]},"440":{"position":[[3646,6],[4125,5]]},"483":{"position":[[232,5]]},"567":{"position":[[2448,5]]},"612":{"position":[[1755,7]]},"627":{"position":[[29,6]]},"647":{"position":[[29,6]]},"685":{"position":[[142,5]]},"687":{"position":[[3646,6],[4125,5]]},"720":{"position":[[1755,7]]}},"keywords":{}}],["issue_ticket",{"_index":3425,"title":{},"content":{"440":{"position":[[4083,12]]},"441":{"position":[[4003,12]]},"687":{"position":[[4083,12]]},"688":{"position":[[4003,12]]}},"keywords":{}}],["issue_ticket(&mut",{"_index":3385,"title":{},"content":{"440":{"position":[[1621,21]]},"441":{"position":[[2833,21]]},"687":{"position":[[1621,21]]},"688":{"position":[[2833,21]]}},"keywords":{}}],["istanbul",{"_index":705,"title":{},"content":{"30":{"position":[[544,8]]}},"keywords":{}}],["it!"",{"_index":295,"title":{},"content":{"9":{"position":[[1000,10]]}},"keywords":{}}],["it'",{"_index":0,"title":{"0":{"position":[[0,4]]}},"content":{"9":{"position":[[0,4],[1043,4]]},"22":{"position":[[294,4]]},"31":{"position":[[282,4]]},"32":{"position":[[0,4]]},"33":{"position":[[46,4]]},"38":{"position":[[821,4]]},"52":{"position":[[4812,4]]},"85":{"position":[[694,4]]},"100":{"position":[[269,4],[881,4]]},"146":{"position":[[200,4]]},"178":{"position":[[214,4]]},"254":{"position":[[694,4]]},"292":{"position":[[269,4],[881,4]]},"334":{"position":[[200,4]]},"369":{"position":[[214,4]]},"485":{"position":[[694,4]]},"504":{"position":[[269,4],[881,4]]},"551":{"position":[[200,4]]},"585":{"position":[[214,4]]},"601":{"position":[[2131,4]]},"709":{"position":[[2131,4]]}},"keywords":{}}],["it'll",{"_index":1235,"title":{},"content":{"52":{"position":[[495,5]]}},"keywords":{}}],["it.l19",{"_index":2194,"title":{},"content":{"184":{"position":[[827,6]]},"375":{"position":[[746,6]]},"591":{"position":[[746,6]]}},"keywords":{}}],["it_work",{"_index":3273,"title":{},"content":{"417":{"position":[[140,10]]},"419":{"position":[[6555,10]]},"440":{"position":[[4946,10]]},"441":{"position":[[4771,10]]},"654":{"position":[[140,10]]},"656":{"position":[[6555,10]]},"687":{"position":[[4946,10]]},"688":{"position":[[4771,10]]}},"keywords":{}}],["item",{"_index":3733,"title":{},"content":{"602":{"position":[[1217,5],[1981,5],[2100,5]]},"613":{"position":[[1903,5]]},"710":{"position":[[1217,5],[1981,5],[2100,5]]},"721":{"position":[[1903,5]]}},"keywords":{}}],["iter",{"_index":1424,"title":{},"content":{"76":{"position":[[860,8]]},"163":{"position":[[1227,7]]},"227":{"position":[[860,8]]},"352":{"position":[[1249,7]]},"458":{"position":[[860,8]]},"568":{"position":[[1249,7]]}},"keywords":{}}],["iterations.reus",{"_index":71,"title":{},"content":{"1":{"position":[[888,22]]}},"keywords":{}}],["itself",{"_index":75,"title":{},"content":{"1":{"position":[[936,7]]},"79":{"position":[[361,7]]},"97":{"position":[[141,7]]},"107":{"position":[[453,7]]},"114":{"position":[[412,7]]},"120":{"position":[[28,6]]},"146":{"position":[[163,6],[457,7],[684,7]]},"178":{"position":[[177,6]]},"230":{"position":[[378,7]]},"257":{"position":[[412,7]]},"274":{"position":[[453,7]]},"289":{"position":[[141,7]]},"301":{"position":[[28,6]]},"334":{"position":[[163,6],[461,7],[688,7]]},"369":{"position":[[177,6]]},"416":{"position":[[4926,7]]},"419":{"position":[[1516,7]]},"461":{"position":[[378,7]]},"480":{"position":[[412,7]]},"491":{"position":[[453,7]]},"501":{"position":[[141,7]]},"522":{"position":[[28,6]]},"551":{"position":[[163,6],[461,7],[688,7]]},"585":{"position":[[177,6]]},"653":{"position":[[4926,7]]},"656":{"position":[[1516,7]]}},"keywords":{}}],["j",{"_index":3755,"title":{},"content":{"605":{"position":[[222,2],[246,1]]},"713":{"position":[[222,2],[246,1]]}},"keywords":{}}],["job",{"_index":32,"title":{},"content":{"1":{"position":[[347,4]]}},"keywords":{}}],["join",{"_index":391,"title":{"13":{"position":[[0,4]]},"24":{"position":[[0,4]]},"34":{"position":[[0,4]]},"55":{"position":[[0,4]]}},"content":{"13":{"position":[[40,4]]},"24":{"position":[[114,4]]},"34":{"position":[[12,4]]},"55":{"position":[[12,4]]},"618":{"position":[[724,4]]},"726":{"position":[[724,4]]}},"keywords":{}}],["journal",{"_index":286,"title":{},"content":{"9":{"position":[[766,7],[1167,7],[1208,7]]},"10":{"position":[[43,8],[281,7],[570,8]]}},"keywords":{}}],["journey",{"_index":26,"title":{},"content":{"1":{"position":[[255,8]]}},"keywords":{}}],["json",{"_index":1789,"title":{},"content":{"121":{"position":[[183,4]]},"302":{"position":[[183,4]]},"323":{"position":[[83,4]]},"523":{"position":[[183,4]]},"541":{"position":[[83,4]]}},"keywords":{}}],["jump",{"_index":1639,"title":{},"content":{"97":{"position":[[341,4]]},"289":{"position":[[341,4]]},"501":{"position":[[341,4]]}},"keywords":{}}],["juno",{"_index":1184,"title":{},"content":{"50":{"position":[[514,4]]},"52":{"position":[[108,4],[189,4],[386,4],[989,6]]}},"keywords":{}}],["juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g",{"_index":1292,"title":{},"content":{"52":{"position":[[4747,64],[4943,63],[6591,63]]},"53":{"position":[[309,63],[610,63],[762,63]]}},"keywords":{}}],["juno1le848rjac00nezzq46v5unxujaltdf270vhtfh",{"_index":1307,"title":{},"content":{"53":{"position":[[506,43],[925,43]]}},"keywords":{}}],["junod",{"_index":1252,"title":{},"content":{"52":{"position":[[954,5],[1025,5],[1144,5],[1440,5],[1607,5]]},"53":{"position":[[106,5]]}},"keywords":{}}],["justfil",{"_index":1234,"title":{},"content":{"52":{"position":[[485,9],[574,8]]}},"keywords":{}}],["keccak256",{"_index":3904,"title":{},"content":{"616":{"position":[[1210,9]]},"724":{"position":[[1210,9]]}},"keywords":{}}],["keep",{"_index":133,"title":{},"content":{"3":{"position":[[228,4]]},"52":{"position":[[449,4]]},"78":{"position":[[144,5]]},"95":{"position":[[393,5]]},"119":{"position":[[541,4]]},"162":{"position":[[1529,4]]},"229":{"position":[[144,5]]},"287":{"position":[[393,5]]},"300":{"position":[[541,4]]},"351":{"position":[[1551,4]]},"416":{"position":[[1013,4]]},"460":{"position":[[144,5]]},"499":{"position":[[393,5]]},"521":{"position":[[541,4]]},"567":{"position":[[1551,4]]},"653":{"position":[[1013,4]]}},"keywords":{}}],["kept",{"_index":866,"title":{},"content":{"38":{"position":[[358,4]]}},"keywords":{}}],["key",{"_index":204,"title":{"85":{"position":[[0,3]]},"254":{"position":[[0,3]]},"485":{"position":[[0,3]]}},"content":{"6":{"position":[[157,3]]},"43":{"position":[[1004,3]]},"52":{"position":[[960,4],[2303,4],[3298,4],[4919,3]]},"53":{"position":[[279,4],[403,4],[461,4],[487,4],[580,4],[676,4],[732,4],[828,4],[866,4],[904,4]]},"76":{"position":[[606,3],[667,4],[724,4]]},"79":{"position":[[24,3],[59,3],[1184,3]]},"81":{"position":[[88,3],[241,4]]},"83":{"position":[[70,4],[148,5],[333,3],[356,4]]},"84":{"position":[[395,3],[427,4],[849,4]]},"85":{"position":[[525,4],[557,4],[626,4],[658,4],[730,4],[928,4],[969,3]]},"91":{"position":[[677,4]]},"92":{"position":[[248,4]]},"98":{"position":[[181,3],[302,3]]},"99":{"position":[[304,3]]},"100":{"position":[[398,3],[1124,3],[1152,5]]},"101":{"position":[[252,3]]},"126":{"position":[[105,3],[191,4],[449,3],[527,5],[585,3],[916,4],[963,3],[1680,5]]},"162":{"position":[[122,3]]},"163":{"position":[[48,3],[120,3],[494,3],[741,4],[1306,3]]},"201":{"position":[[101,3]]},"203":{"position":[[398,3],[603,3],[624,5]]},"210":{"position":[[455,3],[1229,3]]},"211":{"position":[[125,5],[550,3],[763,3]]},"212":{"position":[[1078,4],[1177,4],[1481,3],[1539,3],[2558,3],[2630,3],[2864,3],[3015,3],[3477,3],[3773,3],[3865,3]]},"227":{"position":[[606,3],[667,4],[724,4]]},"230":{"position":[[24,3],[59,3],[1201,3]]},"232":{"position":[[88,3],[241,4]]},"252":{"position":[[70,4],[148,5],[333,3],[356,4]]},"253":{"position":[[395,3],[427,4],[849,4]]},"254":{"position":[[525,4],[557,4],[626,4],[658,4],[730,4],[928,4],[969,3]]},"267":{"position":[[2149,4],[2311,4]]},"277":{"position":[[105,3],[191,4],[449,3],[527,5],[585,3],[916,4],[963,3],[1848,5]]},"283":{"position":[[677,4]]},"284":{"position":[[248,4]]},"290":{"position":[[181,3],[302,3]]},"291":{"position":[[304,3]]},"292":{"position":[[398,3],[1124,3],[1152,5]]},"293":{"position":[[252,3]]},"323":{"position":[[2936,3],[3139,3]]},"351":{"position":[[122,3]]},"352":{"position":[[48,3],[120,3],[516,3],[763,4],[1328,3]]},"389":{"position":[[455,3],[1166,3]]},"390":{"position":[[125,5],[524,3],[737,3]]},"391":{"position":[[1078,4],[1177,4],[1481,3],[1539,3],[2558,3],[2630,3],[2870,3],[3027,3],[3495,3],[3791,3],[3883,3]]},"393":{"position":[[185,3],[299,5],[372,5],[467,4]]},"395":{"position":[[685,4],[3695,3],[4124,3]]},"396":{"position":[[407,4]]},"397":{"position":[[89,4]]},"407":{"position":[[2149,4],[2311,4]]},"421":{"position":[[101,3]]},"423":{"position":[[398,3],[603,3],[624,5]]},"458":{"position":[[606,3],[667,4],[724,4]]},"461":{"position":[[24,3],[59,3],[1201,3]]},"463":{"position":[[88,3],[241,4]]},"477":{"position":[[269,4],[347,3]]},"483":{"position":[[70,4],[148,5],[333,3],[356,4]]},"484":{"position":[[395,3],[427,4],[849,4]]},"485":{"position":[[525,4],[557,4],[626,4],[658,4],[730,4],[928,4],[969,3]]},"495":{"position":[[677,4]]},"496":{"position":[[248,4]]},"502":{"position":[[181,3],[302,3]]},"503":{"position":[[304,3]]},"504":{"position":[[398,3],[1124,3],[1152,5]]},"505":{"position":[[252,3]]},"514":{"position":[[105,3],[191,4],[449,3],[527,5],[585,3],[916,4],[963,3],[1680,5]]},"541":{"position":[[2936,3],[3139,3]]},"567":{"position":[[122,3]]},"568":{"position":[[48,3],[120,3],[516,3],[763,4],[1328,3]]},"594":{"position":[[364,3]]},"596":{"position":[[983,3]]},"598":{"position":[[2032,4]]},"616":{"position":[[1154,3]]},"630":{"position":[[185,3],[299,5],[372,5],[467,4]]},"632":{"position":[[685,4],[3695,3],[4124,3]]},"633":{"position":[[407,4]]},"634":{"position":[[89,4]]},"644":{"position":[[2149,4],[2311,4]]},"659":{"position":[[455,3],[1166,3]]},"660":{"position":[[125,5],[524,3],[737,3]]},"661":{"position":[[1078,4],[1177,4],[1481,3],[1539,3],[2558,3],[2630,3],[2870,3],[3027,3],[3495,3],[3791,3],[3883,3]]},"663":{"position":[[101,3]]},"665":{"position":[[398,3],[603,3],[624,5]]},"699":{"position":[[269,4],[347,3]]},"702":{"position":[[364,3]]},"704":{"position":[[983,3]]},"706":{"position":[[2032,4]]},"724":{"position":[[1154,3]]}},"keywords":{}}],["key'",{"_index":3169,"title":{},"content":{"395":{"position":[[4085,5]]},"632":{"position":[[4085,5]]}},"keywords":{}}],["key((((3",{"_index":3102,"title":{},"content":{"391":{"position":[[3033,8]]},"661":{"position":[[3033,8]]}},"keywords":{}}],["key(((2",{"_index":2657,"title":{},"content":{"212":{"position":[[3021,7]]}},"keywords":{}}],["key((3",{"_index":3101,"title":{},"content":{"391":{"position":[[2636,6]]},"661":{"position":[[2636,6]]}},"keywords":{}}],["key(1",{"_index":2639,"title":{},"content":{"212":{"position":[[1545,6]]}},"keywords":{}}],["key(2",{"_index":2652,"title":{},"content":{"212":{"position":[[2636,5]]},"391":{"position":[[1545,6]]},"661":{"position":[[1545,6]]}},"keywords":{}}],["key(idx",{"_index":2665,"title":{},"content":{"212":{"position":[[3803,8]]},"391":{"position":[[3821,8]]},"661":{"position":[[3821,8]]}},"keywords":{}}],["key.extend_from_slice(idx.to_be_bytes().as_ref",{"_index":2666,"title":{},"content":{"212":{"position":[[3883,50]]},"391":{"position":[[3901,50]]},"661":{"position":[[3901,50]]}},"keywords":{}}],["key.extend_from_slice(mapping_data",{"_index":2667,"title":{},"content":{"212":{"position":[[3934,36]]},"391":{"position":[[3952,36]]},"661":{"position":[[3952,36]]}},"keywords":{}}],["key1",{"_index":1459,"title":{},"content":{"79":{"position":[[993,5]]},"230":{"position":[[1010,5]]},"461":{"position":[[1010,5]]}},"keywords":{}}],["key2",{"_index":1460,"title":{},"content":{"79":{"position":[[1007,5],[1094,5]]},"230":{"position":[[1024,5],[1111,5]]},"461":{"position":[[1024,5],[1111,5]]}},"keywords":{}}],["key3",{"_index":1461,"title":{},"content":{"79":{"position":[[1018,5],[1100,7]]},"230":{"position":[[1035,5],[1117,7]]},"461":{"position":[[1035,5],[1117,7]]}},"keywords":{}}],["keys/secret_key.pem",{"_index":2591,"title":{},"content":{"210":{"position":[[1233,21]]},"389":{"position":[[1170,21]]},"477":{"position":[[2376,19]]},"659":{"position":[[1170,21]]},"699":{"position":[[2376,19]]}},"keywords":{}}],["keyword",{"_index":3673,"title":{},"content":{"599":{"position":[[326,8],[470,8],[676,8]]},"608":{"position":[[766,7]]},"613":{"position":[[1643,8],[1786,7]]},"707":{"position":[[326,8],[470,8],[676,8]]},"716":{"position":[[766,7]]},"721":{"position":[[1643,8],[1786,7]]}},"keywords":{}}],["kind",{"_index":506,"title":{},"content":{"17":{"position":[[1672,4]]},"110":{"position":[[289,4]]},"305":{"position":[[289,4]]},"510":{"position":[[289,4]]}},"keywords":{}}],["knew",{"_index":553,"title":{},"content":{"18":{"position":[[207,4]]}},"keywords":{}}],["know",{"_index":191,"title":{},"content":{"5":{"position":[[375,4]]},"8":{"position":[[83,4]]},"9":{"position":[[960,4]]},"15":{"position":[[360,4]]},"16":{"position":[[313,4]]},"17":{"position":[[1640,5]]},"18":{"position":[[96,5]]},"52":{"position":[[360,4]]},"67":{"position":[[41,4]]},"128":{"position":[[665,4]]},"141":{"position":[[857,4]]},"148":{"position":[[486,4]]},"164":{"position":[[914,4]]},"198":{"position":[[2412,4],[3025,4]]},"212":{"position":[[2049,4]]},"242":{"position":[[41,4]]},"279":{"position":[[665,4]]},"326":{"position":[[857,4]]},"336":{"position":[[486,4]]},"353":{"position":[[949,4]]},"391":{"position":[[2049,4]]},"434":{"position":[[2402,4],[3007,4]]},"467":{"position":[[41,4]]},"516":{"position":[[665,4]]},"535":{"position":[[857,4]]},"553":{"position":[[486,4]]},"569":{"position":[[949,4]]},"661":{"position":[[2049,4]]},"681":{"position":[[2412,4],[3025,4]]}},"keywords":{}}],["knowledg",{"_index":97,"title":{"4":{"position":[[5,9]]},"5":{"position":[[5,10]]}},"content":{"2":{"position":[[144,9]]},"5":{"position":[[24,9]]},"6":{"position":[[71,9]]},"13":{"position":[[19,9]]},"143":{"position":[[53,10]]},"328":{"position":[[53,10]]},"537":{"position":[[53,10]]},"595":{"position":[[39,9]]},"703":{"position":[[39,9]]}},"keywords":{}}],["known",{"_index":1802,"title":{},"content":{"126":{"position":[[811,5]]},"189":{"position":[[363,5]]},"277":{"position":[[811,5]]},"366":{"position":[[363,5]]},"514":{"position":[[811,5]]},"582":{"position":[[363,5]]},"601":{"position":[[1208,5]]},"612":{"position":[[158,5]]},"709":{"position":[[1208,5]]},"720":{"position":[[158,5]]}},"keywords":{}}],["krzysztof",{"_index":573,"title":{},"content":{"20":{"position":[[111,9]]}},"keywords":{}}],["kuba",{"_index":575,"title":{},"content":{"20":{"position":[[135,4]]}},"keywords":{}}],["l1",{"_index":2713,"title":{},"content":{"221":{"position":[[364,2]]},"424":{"position":[[944,2]]},"432":{"position":[[545,2]]},"454":{"position":[[364,2]]},"666":{"position":[[944,2]]},"679":{"position":[[545,2]]},"694":{"position":[[364,2]]}},"keywords":{}}],["l10",{"_index":2441,"title":{},"content":{"203":{"position":[[355,3]]},"247":{"position":[[1593,3]]},"423":{"position":[[355,3]]},"440":{"position":[[3317,3]]},"446":{"position":[[1593,3]]},"665":{"position":[[355,3]]},"673":{"position":[[1593,3]]},"687":{"position":[[3317,3]]}},"keywords":{}}],["l11",{"_index":2401,"title":{},"content":{"198":{"position":[[1618,3]]},"434":{"position":[[1608,3]]},"681":{"position":[[1618,3]]}},"keywords":{}}],["l12",{"_index":2339,"title":{},"content":{"196":{"position":[[1091,3]]},"221":{"position":[[837,3]]},"454":{"position":[[837,3]]},"694":{"position":[[837,3]]}},"keywords":{}}],["l13",{"_index":2251,"title":{},"content":{"185":{"position":[[2579,3]]},"376":{"position":[[2563,3]]},"441":{"position":[[1658,3]]},"592":{"position":[[2563,3]]},"688":{"position":[[1658,3]]}},"keywords":{}}],["l134",{"_index":3429,"title":{},"content":{"440":{"position":[[4338,4]]},"687":{"position":[[4338,4]]}},"keywords":{}}],["l14",{"_index":2342,"title":{},"content":{"196":{"position":[[1222,3]]},"198":{"position":[[2153,3]]},"204":{"position":[[1093,3]]},"434":{"position":[[2143,3]]},"681":{"position":[[2153,3]]}},"keywords":{}}],["l146",{"_index":2546,"title":{},"content":{"206":{"position":[[3747,4]]},"426":{"position":[[3722,4]]},"668":{"position":[[3747,4]]}},"keywords":{}}],["l15",{"_index":2772,"title":{},"content":{"247":{"position":[[1674,3]]},"441":{"position":[[3790,3]]},"446":{"position":[[1674,3]]},"673":{"position":[[1674,3]]},"688":{"position":[[3790,3]]}},"keywords":{}}],["l17",{"_index":2190,"title":{},"content":{"184":{"position":[[667,3]]},"375":{"position":[[586,3]]},"591":{"position":[[586,3]]}},"keywords":{}}],["l18",{"_index":2254,"title":{},"content":{"185":{"position":[[2784,3]]},"376":{"position":[[2768,3]]},"441":{"position":[[1749,3]]},"592":{"position":[[2768,3]]},"688":{"position":[[1749,3]]}},"keywords":{}}],["l19",{"_index":2408,"title":{},"content":{"198":{"position":[[2645,3]]},"434":{"position":[[2635,3]]},"681":{"position":[[2645,3]]}},"keywords":{}}],["l20",{"_index":2255,"title":{},"content":{"185":{"position":[[2788,3]]},"376":{"position":[[2772,3]]},"432":{"position":[[737,3]]},"592":{"position":[[2772,3]]},"679":{"position":[[737,3]]}},"keywords":{}}],["l24",{"_index":2195,"title":{},"content":{"184":{"position":[[834,3]]},"375":{"position":[[753,3]]},"591":{"position":[[753,3]]}},"keywords":{}}],["l26",{"_index":3329,"title":{},"content":{"432":{"position":[[1271,3]]},"679":{"position":[[1271,3]]}},"keywords":{}}],["l29",{"_index":2274,"title":{},"content":{"185":{"position":[[3763,3]]},"376":{"position":[[3747,3]]},"441":{"position":[[3841,3]]},"592":{"position":[[3747,3]]},"688":{"position":[[3841,3]]}},"keywords":{}}],["l32",{"_index":2344,"title":{},"content":{"196":{"position":[[1329,3]]},"441":{"position":[[1822,3]]},"688":{"position":[[1822,3]]}},"keywords":{}}],["l38",{"_index":3322,"title":{},"content":{"424":{"position":[[1249,3]]},"666":{"position":[[1249,3]]}},"keywords":{}}],["l4",{"_index":2318,"title":{},"content":{"195":{"position":[[245,2]]},"431":{"position":[[245,2]]},"441":{"position":[[1599,2]]},"678":{"position":[[245,2]]},"688":{"position":[[1599,2]]}},"keywords":{}}],["l43",{"_index":2456,"title":{},"content":{"204":{"position":[[1299,3]]}},"keywords":{}}],["l44",{"_index":3416,"title":{},"content":{"440":{"position":[[3321,3]]},"687":{"position":[[3321,3]]}},"keywords":{}}],["l46",{"_index":2277,"title":{},"content":{"185":{"position":[[3900,3]]},"198":{"position":[[3425,3]]},"376":{"position":[[3884,3]]},"434":{"position":[[3407,3]]},"592":{"position":[[3884,3]]},"681":{"position":[[3425,3]]}},"keywords":{}}],["l49",{"_index":3418,"title":{},"content":{"440":{"position":[[3665,3]]},"687":{"position":[[3665,3]]}},"keywords":{}}],["l5",{"_index":2189,"title":{},"content":{"184":{"position":[[664,2]]},"375":{"position":[[583,2]]},"591":{"position":[[583,2]]}},"keywords":{}}],["l51",{"_index":2774,"title":{},"content":{"247":{"position":[[1785,3]]},"446":{"position":[[1785,3]]},"673":{"position":[[1785,3]]}},"keywords":{}}],["l53",{"_index":3420,"title":{},"content":{"440":{"position":[[3784,3]]},"687":{"position":[[3784,3]]}},"keywords":{}}],["l54",{"_index":2262,"title":{},"content":{"185":{"position":[[3046,3]]},"376":{"position":[[3030,3]]},"592":{"position":[[3030,3]]}},"keywords":{}}],["l57",{"_index":3518,"title":{},"content":{"441":{"position":[[4109,3]]},"688":{"position":[[4109,3]]}},"keywords":{}}],["l6",{"_index":2246,"title":{},"content":{"185":{"position":[[2444,2]]},"198":{"position":[[1138,2]]},"204":{"position":[[993,2]]},"376":{"position":[[2428,2]]},"432":{"position":[[1035,2]]},"434":{"position":[[1128,2]]},"592":{"position":[[2428,2]]},"679":{"position":[[1035,2]]},"681":{"position":[[1138,2]]}},"keywords":{}}],["l60",{"_index":2776,"title":{},"content":{"247":{"position":[[1836,3]]},"446":{"position":[[1836,3]]},"673":{"position":[[1836,3]]}},"keywords":{}}],["l64",{"_index":2265,"title":{},"content":{"185":{"position":[[3349,3]]},"376":{"position":[[3333,3]]},"592":{"position":[[3333,3]]}},"keywords":{}}],["l7",{"_index":2330,"title":{},"content":{"196":{"position":[[608,2]]},"441":{"position":[[1602,2]]},"688":{"position":[[1602,2]]}},"keywords":{}}],["l7,l31",{"_index":2366,"title":{},"content":{"197":{"position":[[906,6]]},"433":{"position":[[905,6]]},"680":{"position":[[905,6]]}},"keywords":{}}],["l74",{"_index":3422,"title":{},"content":{"440":{"position":[[3932,3]]},"687":{"position":[[3932,3]]}},"keywords":{}}],["l8",{"_index":3327,"title":{},"content":{"432":{"position":[[1165,2]]},"679":{"position":[[1165,2]]}},"keywords":{}}],["l86",{"_index":2268,"title":{},"content":{"185":{"position":[[3464,3]]},"376":{"position":[[3448,3]]},"592":{"position":[[3448,3]]}},"keywords":{}}],["l9",{"_index":2769,"title":{},"content":{"247":{"position":[[1590,2]]},"424":{"position":[[1044,2]]},"446":{"position":[[1590,2]]},"666":{"position":[[1044,2]]},"673":{"position":[[1590,2]]}},"keywords":{}}],["l94",{"_index":3424,"title":{},"content":{"440":{"position":[[4073,3]]},"687":{"position":[[4073,3]]}},"keywords":{}}],["label",{"_index":1263,"title":{},"content":{"52":{"position":[[1308,5],[3314,6]]}},"keywords":{}}],["lalrpop",{"_index":908,"title":{},"content":{"39":{"position":[[359,7]]}},"keywords":{}}],["languag",{"_index":554,"title":{},"content":{"18":{"position":[[237,8]]},"39":{"position":[[101,9]]},"50":{"position":[[388,9]]},"613":{"position":[[1733,8],[2009,10]]},"721":{"position":[[1733,8],[2009,10]]}},"keywords":{}}],["larg",{"_index":3717,"title":{},"content":{"601":{"position":[[2159,5]]},"602":{"position":[[1191,5],[2075,5]]},"709":{"position":[[2159,5]]},"710":{"position":[[1191,5],[2075,5]]}},"keywords":{}}],["larger",{"_index":2078,"title":{},"content":{"162":{"position":[[2390,6]]},"351":{"position":[[2412,6]]},"567":{"position":[[2412,6]]}},"keywords":{}}],["largest",{"_index":167,"title":{},"content":{"5":{"position":[[46,7]]},"38":{"position":[[457,7]]}},"keywords":{}}],["larva",{"_index":1268,"title":{},"content":{"52":{"position":[[1852,5]]}},"keywords":{}}],["last",{"_index":124,"title":{},"content":{"3":{"position":[[59,5]]},"39":{"position":[[3170,4]]},"127":{"position":[[599,4]]},"278":{"position":[[599,4]]},"416":{"position":[[3339,4]]},"419":{"position":[[2118,4]]},"515":{"position":[[599,4]]},"653":{"position":[[3339,4]]},"656":{"position":[[2118,4]]}},"keywords":{}}],["lastli",{"_index":1077,"title":{},"content":{"42":{"position":[[1703,7]]},"197":{"position":[[1308,7]]},"198":{"position":[[2002,7]]},"433":{"position":[[1307,7]]},"434":{"position":[[1992,7]]},"680":{"position":[[1307,7]]},"681":{"position":[[2002,7]]}},"keywords":{}}],["later",{"_index":720,"title":{},"content":{"31":{"position":[[317,6]]},"126":{"position":[[3008,6]]},"189":{"position":[[499,5]]},"277":{"position":[[3176,6]]},"366":{"position":[[499,5]]},"395":{"position":[[2207,8]]},"514":{"position":[[3008,6]]},"582":{"position":[[499,5]]},"632":{"position":[[2207,8]]}},"keywords":{}}],["later.l44",{"_index":3517,"title":{},"content":{"441":{"position":[[4099,9]]},"688":{"position":[[4099,9]]}},"keywords":{}}],["later.l6",{"_index":2319,"title":{},"content":{"195":{"position":[[583,8]]},"431":{"position":[[583,8]]},"678":{"position":[[583,8]]}},"keywords":{}}],["latest",{"_index":1762,"title":{},"content":{"117":{"position":[[825,6]]},"131":{"position":[[562,6]]},"261":{"position":[[68,6]]},"298":{"position":[[825,6]]},"311":{"position":[[614,6]]},"379":{"position":[[68,6]]},"401":{"position":[[68,6]]},"519":{"position":[[825,6]]},"528":{"position":[[614,6]]},"621":{"position":[[68,6]]},"638":{"position":[[68,6]]}},"keywords":{}}],["layer",{"_index":369,"title":{},"content":{"11":{"position":[[152,5]]},"93":{"position":[[123,5]]},"182":{"position":[[80,6]]},"285":{"position":[[123,5]]},"373":{"position":[[80,6]]},"497":{"position":[[123,5]]},"589":{"position":[[80,6]]}},"keywords":{}}],["layout",{"_index":1501,"title":{"82":{"position":[[8,6]]},"211":{"position":[[8,7]]},"251":{"position":[[8,6]]},"390":{"position":[[8,7]]},"482":{"position":[[8,6]]},"660":{"position":[[8,7]]}},"content":{"84":{"position":[[742,6],[951,6]]},"195":{"position":[[617,6]]},"202":{"position":[[56,6]]},"209":{"position":[[44,7]]},"211":{"position":[[69,7],[139,6],[819,6],[854,6]]},"253":{"position":[[742,6],[951,6]]},"388":{"position":[[44,7]]},"390":{"position":[[69,7],[139,6],[793,6],[828,6]]},"422":{"position":[[56,6]]},"431":{"position":[[617,6]]},"484":{"position":[[742,6],[951,6]]},"658":{"position":[[44,7]]},"660":{"position":[[69,7],[139,6],[793,6],[828,6]]},"664":{"position":[[56,6]]},"678":{"position":[[617,6]]}},"keywords":{}}],["lazili",{"_index":1590,"title":{},"content":{"92":{"position":[[110,6]]},"284":{"position":[[110,6]]},"496":{"position":[[110,6]]},"602":{"position":[[1223,7],[2106,7]]},"710":{"position":[[1223,7],[2106,7]]}},"keywords":{}}],["lead",{"_index":1376,"title":{},"content":{"72":{"position":[[147,7]]},"236":{"position":[[147,7]]},"472":{"position":[[147,7]]},"612":{"position":[[1720,4]]},"720":{"position":[[1720,4]]}},"keywords":{}}],["leader",{"_index":570,"title":{},"content":{"20":{"position":[[78,6]]}},"keywords":{}}],["learn",{"_index":864,"title":{},"content":{"38":{"position":[[331,8],[586,8]]},"91":{"position":[[103,7]]},"118":{"position":[[271,5]]},"139":{"position":[[8,5]]},"146":{"position":[[804,5]]},"158":{"position":[[25,5]]},"171":{"position":[[25,5]]},"283":{"position":[[103,7]]},"299":{"position":[[271,5]]},"319":{"position":[[8,5]]},"331":{"position":[[25,5]]},"334":{"position":[[808,5]]},"357":{"position":[[25,5]]},"398":{"position":[[134,7]]},"478":{"position":[[21,7]]},"495":{"position":[[103,7]]},"520":{"position":[[271,5]]},"545":{"position":[[8,5]]},"548":{"position":[[25,5]]},"551":{"position":[[808,5]]},"573":{"position":[[25,5]]},"594":{"position":[[600,8]]},"618":{"position":[[28,7],[499,5]]},"635":{"position":[[134,7]]},"700":{"position":[[21,7]]},"702":{"position":[[600,8]]},"726":{"position":[[28,7],[499,5]]}},"keywords":{}}],["leav",{"_index":2321,"title":{},"content":{"195":{"position":[[736,5]]},"431":{"position":[[736,5]]},"477":{"position":[[3935,7]]},"678":{"position":[[736,5]]},"699":{"position":[[3935,7]]}},"keywords":{}}],["left",{"_index":991,"title":{},"content":{"39":{"position":[[2652,5],[2724,5]]},"397":{"position":[[215,4]]},"634":{"position":[[215,4]]}},"keywords":{}}],["lender",{"_index":1530,"title":{},"content":{"84":{"position":[[579,8],[683,7]]},"85":{"position":[[478,8]]},"253":{"position":[[579,8],[683,7]]},"254":{"position":[[478,8]]},"484":{"position":[[579,8],[683,7]]},"485":{"position":[[478,8]]}},"keywords":{}}],["length",{"_index":1510,"title":{},"content":{"83":{"position":[[388,6]]},"163":{"position":[[1325,6]]},"164":{"position":[[857,7],[1027,6]]},"212":{"position":[[1358,6]]},"252":{"position":[[388,6]]},"352":{"position":[[1347,6]]},"353":{"position":[[892,7],[1062,6]]},"391":{"position":[[1358,6]]},"483":{"position":[[388,6]]},"568":{"position":[[1347,6]]},"569":{"position":[[892,7],[1062,6]]},"661":{"position":[[1358,6]]}},"keywords":{}}],["let",{"_index":2021,"title":{},"content":{"157":{"position":[[48,4]]},"188":{"position":[[289,4]]},"330":{"position":[[48,4]]},"365":{"position":[[646,4]]},"440":{"position":[[4566,4]]},"547":{"position":[[48,4]]},"581":{"position":[[646,4]]},"687":{"position":[[4566,4]]}},"keywords":{}}],["let'",{"_index":218,"title":{"178":{"position":[[0,5]]},"369":{"position":[[0,5]]},"585":{"position":[[0,5]]}},"content":{"7":{"position":[[0,5]]},"23":{"position":[[0,5]]},"31":{"position":[[2797,5]]},"42":{"position":[[0,5],[1411,5]]},"51":{"position":[[316,5],[1675,5]]},"52":{"position":[[95,5],[400,5],[469,5],[2157,5]]},"53":{"position":[[54,5]]},"68":{"position":[[0,5]]},"76":{"position":[[44,5]]},"79":{"position":[[471,5]]},"90":{"position":[[113,5]]},"97":{"position":[[219,5]]},"115":{"position":[[1817,5]]},"126":{"position":[[329,5],[1299,5]]},"131":{"position":[[0,5]]},"136":{"position":[[157,5]]},"138":{"position":[[32,5]]},"141":{"position":[[1074,5]]},"143":{"position":[[0,5],[851,5]]},"149":{"position":[[4,5]]},"162":{"position":[[205,5],[585,5]]},"163":{"position":[[149,5]]},"164":{"position":[[40,5]]},"168":{"position":[[176,5]]},"175":{"position":[[410,5]]},"196":{"position":[[577,5]]},"198":{"position":[[2774,5]]},"205":{"position":[[39,5]]},"207":{"position":[[39,5]]},"209":{"position":[[0,5]]},"221":{"position":[[5,5]]},"223":{"position":[[12,5]]},"227":{"position":[[44,5]]},"230":{"position":[[488,5]]},"243":{"position":[[0,5]]},"246":{"position":[[0,5]]},"258":{"position":[[1763,5]]},"277":{"position":[[329,5],[1467,5]]},"282":{"position":[[113,5]]},"289":{"position":[[219,5]]},"311":{"position":[[0,5]]},"316":{"position":[[157,5]]},"318":{"position":[[32,5]]},"326":{"position":[[1074,5]]},"328":{"position":[[0,5],[826,5]]},"337":{"position":[[4,5]]},"348":{"position":[[176,5]]},"351":{"position":[[205,5],[622,5]]},"352":{"position":[[149,5]]},"353":{"position":[[40,5]]},"354":{"position":[[190,5]]},"361":{"position":[[410,5]]},"388":{"position":[[0,5]]},"394":{"position":[[581,5]]},"395":{"position":[[1258,5]]},"414":{"position":[[0,5],[152,5]]},"415":{"position":[[0,5]]},"416":{"position":[[313,5]]},"425":{"position":[[39,5]]},"427":{"position":[[39,5]]},"432":{"position":[[514,5]]},"434":{"position":[[2764,5]]},"440":{"position":[[0,5],[6518,5]]},"445":{"position":[[0,5]]},"454":{"position":[[5,5]]},"456":{"position":[[12,5]]},"458":{"position":[[44,5]]},"461":{"position":[[488,5]]},"468":{"position":[[0,5]]},"481":{"position":[[1763,5]]},"494":{"position":[[113,5]]},"501":{"position":[[219,5]]},"514":{"position":[[329,5],[1299,5]]},"528":{"position":[[0,5]]},"533":{"position":[[157,5]]},"535":{"position":[[1074,5]]},"537":{"position":[[0,5],[826,5]]},"544":{"position":[[32,5]]},"554":{"position":[[4,5]]},"564":{"position":[[176,5]]},"567":{"position":[[205,5],[622,5]]},"568":{"position":[[149,5]]},"569":{"position":[[40,5]]},"570":{"position":[[190,5]]},"577":{"position":[[410,5]]},"596":{"position":[[0,5]]},"612":{"position":[[321,5]]},"631":{"position":[[581,5]]},"632":{"position":[[1258,5]]},"651":{"position":[[0,5],[152,5]]},"652":{"position":[[0,5]]},"653":{"position":[[313,5]]},"658":{"position":[[0,5]]},"667":{"position":[[39,5]]},"669":{"position":[[39,5]]},"672":{"position":[[0,5]]},"679":{"position":[[514,5]]},"681":{"position":[[2774,5]]},"687":{"position":[[0,5],[6518,5]]},"694":{"position":[[5,5]]},"696":{"position":[[12,5]]},"704":{"position":[[0,5]]},"720":{"position":[[321,5]]}},"keywords":{}}],["let’",{"_index":658,"title":{},"content":{"22":{"position":[[839,5]]}},"keywords":{}}],["level",{"_index":626,"title":{},"content":{"21":{"position":[[167,6]]},"22":{"position":[[15,5]]},"38":{"position":[[33,5]]},"94":{"position":[[39,5]]},"131":{"position":[[513,5]]},"265":{"position":[[923,5]]},"286":{"position":[[39,5]]},"311":{"position":[[565,5]]},"395":{"position":[[3603,5]]},"405":{"position":[[923,5]]},"498":{"position":[[39,5]]},"528":{"position":[[565,5]]},"594":{"position":[[167,5]]},"613":{"position":[[1742,5]]},"632":{"position":[[3603,5]]},"642":{"position":[[923,5]]},"702":{"position":[[167,5]]},"721":{"position":[[1742,5]]}},"keywords":{}}],["level.ev",{"_index":3054,"title":{},"content":{"324":{"position":[[1201,12]]},"542":{"position":[[1201,12]]}},"keywords":{}}],["leverag",{"_index":1752,"title":{},"content":{"115":{"position":[[3247,10]]},"258":{"position":[[3173,10]]},"481":{"position":[[3173,10]]}},"keywords":{}}],["lib.r",{"_index":1066,"title":{},"content":{"42":{"position":[[1426,6],[2700,6]]},"183":{"position":[[104,6]]},"374":{"position":[[104,6]]},"590":{"position":[[104,6]]}},"keywords":{}}],["librari",{"_index":83,"title":{"613":{"position":[[0,9]]},"721":{"position":[[0,9]]}},"content":{"1":{"position":[[1019,7]]},"23":{"position":[[218,7]]},"38":{"position":[[774,7]]},"39":{"position":[[2121,10]]},"613":{"position":[[1242,9],[1375,7],[1432,7],[1501,9],[1834,7]]},"721":{"position":[[1242,9],[1375,7],[1432,7],[1501,9],[1834,7]]}},"keywords":{}}],["licens",{"_index":1047,"title":{},"content":{"42":{"position":[[882,7]]}},"keywords":{}}],["like",{"_index":73,"title":{},"content":{"1":{"position":[[920,5]]}},"keywords":{}}],["likevar<t>",{"_index":1993,"title":{},"content":{"146":{"position":[[770,16]]},"334":{"position":[[774,16]]},"551":{"position":[[774,16]]}},"keywords":{}}],["limit",{"_index":1466,"title":{},"content":{"79":{"position":[[1226,7]]},"83":{"position":[[124,7]]},"85":{"position":[[1019,5]]},"126":{"position":[[2120,5],[2150,5]]},"147":{"position":[[821,7]]},"230":{"position":[[1243,7]]},"252":{"position":[[124,7]]},"254":{"position":[[1019,5]]},"277":{"position":[[2288,5],[2318,5]]},"335":{"position":[[829,7]]},"438":{"position":[[216,7]]},"461":{"position":[[1243,7]]},"483":{"position":[[124,7]]},"485":{"position":[[1019,5]]},"514":{"position":[[2120,5],[2150,5]]},"552":{"position":[[829,7]]},"685":{"position":[[216,7]]}},"keywords":{}}],["line",{"_index":1858,"title":{},"content":{"127":{"position":[[606,5]]},"278":{"position":[[606,5]]},"324":{"position":[[821,4]]},"515":{"position":[[606,5]]},"542":{"position":[[821,4]]}},"keywords":{}}],["linear",{"_index":929,"title":{},"content":{"39":{"position":[[841,13],[1093,14],[1143,13],[1504,14],[1561,13]]}},"keywords":{}}],["linearization"",{"_index":3825,"title":{},"content":{"612":{"position":[[1511,19]]},"720":{"position":[[1511,19]]}},"keywords":{}}],["list",{"_index":1416,"title":{"164":{"position":[[0,5]]},"353":{"position":[[0,5]]},"569":{"position":[[0,5]]}},"content":{"76":{"position":[[231,5],[373,4],[729,5],[788,4]]},"104":{"position":[[79,4]]},"107":{"position":[[99,4]]},"108":{"position":[[118,4]]},"114":{"position":[[117,4]]},"127":{"position":[[625,8]]},"163":{"position":[[1420,4],[1460,4]]},"164":{"position":[[110,5]]},"168":{"position":[[2203,4]]},"182":{"position":[[33,4]]},"227":{"position":[[231,5],[373,4],[729,5],[788,4]]},"257":{"position":[[117,4]]},"274":{"position":[[99,4]]},"275":{"position":[[122,4]]},"278":{"position":[[625,8]]},"296":{"position":[[79,4]]},"324":{"position":[[521,4],[693,4],[721,4],[894,4],[1094,4],[1219,4],[1589,4]]},"348":{"position":[[2213,4]]},"352":{"position":[[1442,4],[1482,4]]},"353":{"position":[[110,5],[177,5]]},"373":{"position":[[33,4]]},"416":{"position":[[572,4],[3012,5]]},"419":{"position":[[115,5],[943,4],[4966,5]]},"458":{"position":[[231,5],[373,4],[729,5],[788,4]]},"480":{"position":[[117,4]]},"491":{"position":[[99,4]]},"492":{"position":[[122,4]]},"508":{"position":[[79,4]]},"515":{"position":[[625,8]]},"542":{"position":[[521,4],[693,4],[721,4],[894,4],[1094,4],[1219,4],[1589,4]]},"564":{"position":[[2203,4]]},"568":{"position":[[1442,4],[1482,4]]},"569":{"position":[[110,5],[177,5]]},"589":{"position":[[33,4]]},"601":{"position":[[2213,4]]},"602":{"position":[[968,6],[1164,4],[1973,4],[2006,4],[2036,4]]},"603":{"position":[[295,6]]},"653":{"position":[[572,4],[3012,5]]},"656":{"position":[[115,5],[943,4],[4966,5]]},"709":{"position":[[2213,4]]},"710":{"position":[[968,6],[1164,4],[1973,4],[2006,4],[2036,4]]},"711":{"position":[[295,6]]}},"keywords":{}}],["list<ballot>",{"_index":3222,"title":{},"content":{"416":{"position":[[619,19]]},"419":{"position":[[990,19]]},"653":{"position":[[619,19]]},"656":{"position":[[990,19]]}},"keywords":{}}],["list<t>",{"_index":2098,"title":{},"content":{"163":{"position":[[1614,13]]},"352":{"position":[[1636,13]]},"568":{"position":[[1636,13]]}},"keywords":{}}],["list<todo>",{"_index":3732,"title":{},"content":{"602":{"position":[[1139,17],[1238,17]]},"710":{"position":[[1139,17],[1238,17]]}},"keywords":{}}],["list<u32>",{"_index":2104,"title":{},"content":{"164":{"position":[[228,16]]},"353":{"position":[[263,16]]},"569":{"position":[[263,16]]}},"keywords":{}}],["listtyp",{"_index":3229,"title":{},"content":{"416":{"position":[[1178,8]]},"653":{"position":[[1178,8]]}},"keywords":{}}],["liter",{"_index":1150,"title":{},"content":{"43":{"position":[[1604,9]]}},"keywords":{}}],["littl",{"_index":3469,"title":{},"content":{"440":{"position":[[6550,6]]},"687":{"position":[[6550,6]]}},"keywords":{}}],["live",{"_index":109,"title":{},"content":{"2":{"position":[[313,4],[505,4]]},"20":{"position":[[748,4]]},"133":{"position":[[51,5]]},"134":{"position":[[79,5]]},"313":{"position":[[51,5]]},"314":{"position":[[79,5]]},"477":{"position":[[672,4]]},"530":{"position":[[51,5]]},"531":{"position":[[79,5]]},"699":{"position":[[672,4]]}},"keywords":{}}],["livenet",{"_index":363,"title":{"11":{"position":[[0,7]]},"125":{"position":[[0,7]]},"128":{"position":[[4,7]]},"276":{"position":[[0,7]]},"279":{"position":[[4,7]]},"392":{"position":[[28,7]]},"395":{"position":[[5,8]]},"513":{"position":[[0,7]]},"516":{"position":[[4,7]]},"629":{"position":[[28,7]]},"632":{"position":[[5,8]]}},"content":{"95":{"position":[[94,8]]},"97":{"position":[[198,7],[353,7]]},"126":{"position":[[7,7],[2818,7]]},"127":{"position":[[65,7]]},"128":{"position":[[206,7],[648,7]]},"129":{"position":[[53,7]]},"142":{"position":[[155,7]]},"277":{"position":[[7,7],[2986,7]]},"278":{"position":[[65,7]]},"279":{"position":[[206,7],[648,7]]},"280":{"position":[[53,7]]},"287":{"position":[[94,8]]},"289":{"position":[[198,7],[353,7]]},"327":{"position":[[155,7]]},"346":{"position":[[52,9]]},"393":{"position":[[546,7]]},"394":{"position":[[30,8]]},"395":{"position":[[5,7],[286,7],[567,7],[1366,8],[2835,7],[3133,7],[3162,7],[4431,7]]},"416":{"position":[[2522,8]]},"477":{"position":[[564,7],[938,7],[1046,7],[1075,7]]},"478":{"position":[[352,7]]},"499":{"position":[[94,8]]},"501":{"position":[[198,7],[353,7]]},"514":{"position":[[7,7],[2818,7]]},"515":{"position":[[65,7]]},"516":{"position":[[206,7],[648,7]]},"517":{"position":[[53,7]]},"536":{"position":[[155,7]]},"630":{"position":[[546,7]]},"631":{"position":[[30,8]]},"632":{"position":[[5,7],[286,7],[567,7],[1366,8],[2835,7],[3133,7],[3162,7],[4431,7]]},"653":{"position":[[2522,8]]},"699":{"position":[[564,7],[938,7],[1046,7],[1075,7]]},"700":{"position":[[352,7]]}},"keywords":{}}],["load",{"_index":240,"title":{"142":{"position":[[0,7]]},"327":{"position":[[0,7]]},"536":{"position":[[0,7]]}},"content":{"8":{"position":[[259,4],[324,4]]},"9":{"position":[[202,7]]},"31":{"position":[[501,4]]},"111":{"position":[[252,7]]},"126":{"position":[[2626,4],[2835,6],[2852,4]]},"128":{"position":[[747,4]]},"129":{"position":[[674,4],[713,4]]},"142":{"position":[[26,4],[179,4],[203,4]]},"164":{"position":[[954,7]]},"277":{"position":[[2794,4],[3003,6],[3020,4]]},"279":{"position":[[747,4]]},"280":{"position":[[675,4],[714,4]]},"306":{"position":[[252,7]]},"327":{"position":[[26,4],[179,4],[203,4]]},"353":{"position":[[989,7]]},"395":{"position":[[551,4],[2138,5],[2181,4]]},"511":{"position":[[252,7]]},"514":{"position":[[2626,4],[2835,6],[2852,4]]},"516":{"position":[[747,4]]},"517":{"position":[[675,4],[714,4]]},"536":{"position":[[26,4],[179,4],[203,4]]},"569":{"position":[[989,7]]},"602":{"position":[[1211,5],[2094,5]]},"632":{"position":[[551,4],[2138,5],[2181,4]]},"710":{"position":[[1211,5],[2094,5]]}},"keywords":{}}],["loan",{"_index":1529,"title":{},"content":{"84":{"position":[[571,5],[654,5],[900,5]]},"85":{"position":[[470,5]]},"253":{"position":[[571,5],[654,5],[900,5]]},"254":{"position":[[470,5]]},"484":{"position":[[571,5],[654,5],[900,5]]},"485":{"position":[[470,5]]}},"keywords":{}}],["loc",{"_index":921,"title":{},"content":{"39":{"position":[[720,4],[725,4]]}},"keywords":{}}],["local",{"_index":1764,"title":{},"content":{"117":{"position":[[1020,5]]},"210":{"position":[[78,5]]},"298":{"position":[[1020,5]]},"389":{"position":[[78,5]]},"477":{"position":[[688,5]]},"519":{"position":[[1020,5]]},"598":{"position":[[2069,5]]},"600":{"position":[[335,5],[530,5],[671,5],[974,5]]},"659":{"position":[[78,5]]},"699":{"position":[[688,5]]},"706":{"position":[[2069,5]]},"708":{"position":[[335,5],[530,5],[671,5],[974,5]]}},"keywords":{}}],["locat",{"_index":1759,"title":{"603":{"position":[[5,9]]},"711":{"position":[[5,9]]}},"content":{"117":{"position":[[502,7]]},"120":{"position":[[199,7]]},"126":{"position":[[1258,7]]},"132":{"position":[[282,7]]},"267":{"position":[[333,7]]},"277":{"position":[[1426,7]]},"298":{"position":[[502,7]]},"301":{"position":[[199,7]]},"312":{"position":[[282,7]]},"407":{"position":[[333,7]]},"514":{"position":[[1258,7]]},"519":{"position":[[502,7]]},"522":{"position":[[199,7]]},"529":{"position":[[282,7]]},"603":{"position":[[18,8],[129,8],[189,8]]},"644":{"position":[[333,7]]},"711":{"position":[[18,8],[129,8],[189,8]]}},"keywords":{}}],["lock",{"_index":1359,"title":{},"content":{"71":{"position":[[259,4]]},"174":{"position":[[262,6]]},"235":{"position":[[259,4]]},"261":{"position":[[200,6]]},"360":{"position":[[262,6]]},"379":{"position":[[200,6]]},"401":{"position":[[200,6]]},"416":{"position":[[3247,6]]},"419":{"position":[[2147,4]]},"471":{"position":[[259,4]]},"476":{"position":[[475,4],[852,4],[1454,4]]},"576":{"position":[[262,6]]},"606":{"position":[[93,7],[733,4]]},"621":{"position":[[200,6]]},"638":{"position":[[200,6]]},"653":{"position":[[3247,6]]},"656":{"position":[[2147,4]]},"698":{"position":[[475,4],[852,4],[1454,4]]},"714":{"position":[[93,7],[733,4]]}},"keywords":{}}],["lock(&mut",{"_index":3762,"title":{},"content":{"606":{"position":[[335,13]]},"714":{"position":[[335,13]]}},"keywords":{}}],["lock_dur",{"_index":3540,"title":{},"content":{"476":{"position":[[367,14],[517,14]]},"477":{"position":[[1915,14]]},"698":{"position":[[367,14],[517,14]]},"699":{"position":[[1915,14]]}},"keywords":{}}],["lock_duration(&self",{"_index":3550,"title":{},"content":{"476":{"position":[[1476,24]]},"698":{"position":[[1476,24]]}},"keywords":{}}],["lock_expiration_map",{"_index":3538,"title":{},"content":{"476":{"position":[[317,20]]},"698":{"position":[[317,20]]}},"keywords":{}}],["lockisnotov",{"_index":3551,"title":{},"content":{"476":{"position":[[1639,13]]},"698":{"position":[[1639,13]]}},"keywords":{}}],["log",{"_index":1283,"title":{"610":{"position":[[11,8]]},"718":{"position":[[11,8]]}},"content":{"52":{"position":[[3132,4]]},"53":{"position":[[247,5]]},"127":{"position":[[574,4]]},"278":{"position":[[574,4]]},"394":{"position":[[243,3]]},"397":{"position":[[41,7]]},"477":{"position":[[3981,4]]},"515":{"position":[[574,4]]},"610":{"position":[[72,3],[806,4]]},"631":{"position":[[243,3]]},"634":{"position":[[41,7]]},"699":{"position":[[3981,4]]},"718":{"position":[[72,3],[806,4]]}},"keywords":{}}],["logic",{"_index":1161,"title":{},"content":{"43":{"position":[[1925,5]]},"74":{"position":[[202,8],[280,8]]},"110":{"position":[[452,6]]},"188":{"position":[[317,5]]},"212":{"position":[[2414,6]]},"238":{"position":[[202,8],[280,8]]},"305":{"position":[[452,6]]},"365":{"position":[[674,5]]},"391":{"position":[[2414,6]]},"441":{"position":[[2907,5],[3396,5]]},"474":{"position":[[202,8],[280,8]]},"510":{"position":[[452,6]]},"581":{"position":[[674,5]]},"604":{"position":[[299,5],[442,5]]},"606":{"position":[[700,6]]},"661":{"position":[[2414,6]]},"688":{"position":[[2907,5],[3396,5]]},"712":{"position":[[299,5],[442,5]]},"714":{"position":[[700,6]]}},"keywords":{}}],["long",{"_index":136,"title":{},"content":{"3":{"position":[[256,4]]},"31":{"position":[[3052,4]]},"54":{"position":[[173,4]]}},"keywords":{}}],["longer",{"_index":2795,"title":{},"content":{"264":{"position":[[94,6]]},"266":{"position":[[98,6]]},"267":{"position":[[540,6],[652,6],[4405,6]]},"404":{"position":[[94,6]]},"406":{"position":[[98,6]]},"407":{"position":[[540,6],[652,6],[4405,6]]},"416":{"position":[[2453,6]]},"641":{"position":[[94,6]]},"643":{"position":[[98,6]]},"644":{"position":[[540,6],[652,6],[4405,6]]},"653":{"position":[[2453,6]]}},"keywords":{}}],["look",{"_index":580,"title":{},"content":{"20":{"position":[[211,7]]},"22":{"position":[[845,4]]},"42":{"position":[[1865,5]]},"52":{"position":[[2170,4]]},"53":{"position":[[74,4]]},"83":{"position":[[527,4]]},"90":{"position":[[133,4]]},"112":{"position":[[15,4]]},"115":{"position":[[1830,4]]},"117":{"position":[[302,4]]},"122":{"position":[[36,4]]},"126":{"position":[[342,4]]},"127":{"position":[[243,4]]},"131":{"position":[[19,4]]},"136":{"position":[[170,4]]},"146":{"position":[[849,4]]},"149":{"position":[[17,4]]},"154":{"position":[[299,4]]},"155":{"position":[[41,4]]},"162":{"position":[[211,4]]},"163":{"position":[[155,4],[1450,4]]},"164":{"position":[[337,4]]},"169":{"position":[[10,4]]},"198":{"position":[[1319,4]]},"252":{"position":[[527,4]]},"258":{"position":[[1776,4]]},"277":{"position":[[342,4]]},"278":{"position":[[243,4]]},"282":{"position":[[133,4]]},"298":{"position":[[302,4]]},"303":{"position":[[36,4]]},"307":{"position":[[15,4]]},"311":{"position":[[19,4]]},"316":{"position":[[170,4]]},"334":{"position":[[853,4]]},"337":{"position":[[17,4]]},"339":{"position":[[299,4]]},"340":{"position":[[41,4]]},"349":{"position":[[10,4]]},"351":{"position":[[211,4]]},"352":{"position":[[155,4],[1472,4]]},"353":{"position":[[372,4]]},"395":{"position":[[2521,4]]},"434":{"position":[[1309,4]]},"481":{"position":[[1776,4]]},"483":{"position":[[527,4]]},"494":{"position":[[133,4]]},"512":{"position":[[15,4]]},"514":{"position":[[342,4]]},"515":{"position":[[243,4]]},"519":{"position":[[302,4]]},"524":{"position":[[36,4]]},"528":{"position":[[19,4]]},"533":{"position":[[170,4]]},"551":{"position":[[853,4]]},"554":{"position":[[17,4]]},"559":{"position":[[299,4]]},"560":{"position":[[41,4]]},"565":{"position":[[10,4]]},"567":{"position":[[211,4]]},"568":{"position":[[155,4],[1472,4]]},"569":{"position":[[372,4]]},"594":{"position":[[44,7]]},"612":{"position":[[334,4]]},"632":{"position":[[2521,4]]},"681":{"position":[[1319,4]]},"702":{"position":[[44,7]]},"720":{"position":[[334,4]]}},"keywords":{}}],["loop",{"_index":69,"title":{},"content":{"1":{"position":[[873,5]]},"212":{"position":[[2085,4]]},"391":{"position":[[2085,4]]},"661":{"position":[[2085,4]]}},"keywords":{}}],["lose",{"_index":2193,"title":{},"content":{"184":{"position":[[784,5]]},"375":{"position":[[703,5]]},"591":{"position":[[703,5]]}},"keywords":{}}],["lot",{"_index":375,"title":{},"content":{"11":{"position":[[237,4]]},"18":{"position":[[57,3]]},"119":{"position":[[569,3]]},"300":{"position":[[569,3]]},"521":{"position":[[569,3]]}},"keywords":{}}],["low",{"_index":1614,"title":{},"content":{"94":{"position":[[35,3]]},"286":{"position":[[35,3]]},"498":{"position":[[35,3]]}},"keywords":{}}],["lower",{"_index":625,"title":{},"content":{"21":{"position":[[155,5]]},"66":{"position":[[3,5],[193,8]]},"68":{"position":[[463,8]]},"126":{"position":[[3112,5]]},"241":{"position":[[3,5],[193,8]]},"243":{"position":[[463,8]]},"277":{"position":[[3280,5]]},"466":{"position":[[3,5],[193,8]]},"468":{"position":[[463,8]]},"514":{"position":[[3112,5]]}},"keywords":{}}],["ls",{"_index":709,"title":{},"content":{"30":{"position":[[661,2]]}},"keywords":{}}],["lt",{"_index":535,"title":{},"content":{"17":{"position":[[2913,4],[3392,4],[3468,4]]},"30":{"position":[[335,5]]},"205":{"position":[[1786,4]]},"269":{"position":[[2252,4],[3044,4]]},"384":{"position":[[2272,4],[3078,4]]},"409":{"position":[[2252,4],[3044,4]]},"416":{"position":[[3840,4]]},"419":{"position":[[5419,4]]},"425":{"position":[[1761,4]]},"440":{"position":[[2868,4]]},"611":{"position":[[272,5],[462,4]]},"613":{"position":[[220,4]]},"626":{"position":[[2272,4],[3078,4]]},"646":{"position":[[2252,4],[3044,4]]},"653":{"position":[[3840,4]]},"656":{"position":[[5419,4]]},"667":{"position":[[1761,4]]},"687":{"position":[[2868,4]]},"719":{"position":[[272,5],[462,4]]},"721":{"position":[[220,4]]}},"keywords":{}}],["lt;<",{"_index":2601,"title":{},"content":{"211":{"position":[[313,8],[362,8],[430,8],[447,8],[506,8],[523,8]]},"212":{"position":[[2582,8],[2642,8],[2895,8],[2912,8],[3029,8],[3046,8]]},"390":{"position":[[349,8],[416,8],[480,8],[497,8]]},"391":{"position":[[2582,8],[2643,8],[2902,8],[2919,8],[3042,8],[3059,8]]},"660":{"position":[[349,8],[416,8],[480,8],[497,8]]},"661":{"position":[[2582,8],[2643,8],[2902,8],[2919,8],[3042,8],[3059,8]]}},"keywords":{}}],["lt;blake2::blake2bvar",{"_index":2673,"title":{},"content":{"212":{"position":[[4129,22]]},"391":{"position":[[4147,22]]},"661":{"position":[[4147,22]]}},"keywords":{}}],["lt;erc20hostref",{"_index":1959,"title":{},"content":{"142":{"position":[[462,16]]},"327":{"position":[[462,16]]},"536":{"position":[[462,16]]}},"keywords":{}}],["lt;init",{"_index":1197,"title":{},"content":{"51":{"position":[[652,8]]}},"keywords":{}}],["lt;u256",{"_index":2463,"title":{},"content":{"204":{"position":[[1612,8]]},"424":{"position":[[1562,8]]},"666":{"position":[[1562,8]]}},"keywords":{}}],["lto",{"_index":1888,"title":{},"content":{"131":{"position":[[462,3]]},"265":{"position":[[872,3]]},"311":{"position":[[514,3]]},"395":{"position":[[3552,3]]},"405":{"position":[[872,3]]},"528":{"position":[[514,3]]},"632":{"position":[[3552,3]]},"642":{"position":[[872,3]]}},"keywords":{}}],["luckili",{"_index":443,"title":{},"content":{"16":{"position":[[324,7]]}},"keywords":{}}],["machin",{"_index":200,"title":{},"content":{"6":{"position":[[89,8]]},"173":{"position":[[77,8]]},"359":{"position":[[77,8]]},"575":{"position":[[77,8]]}},"keywords":{}}],["maciej",{"_index":565,"title":{},"content":{"20":{"position":[[21,6]]},"39":{"position":[[1594,6]]}},"keywords":{}}],["macro",{"_index":1694,"title":{},"content":{"104":{"position":[[143,6]]},"108":{"position":[[56,5]]},"114":{"position":[[68,5],[97,5],[202,6]]},"115":{"position":[[1496,6]]},"138":{"position":[[1169,6]]},"146":{"position":[[425,6]]},"147":{"position":[[379,6],[659,5]]},"196":{"position":[[980,5]]},"257":{"position":[[68,5],[97,5],[202,6]]},"258":{"position":[[1442,6]]},"267":{"position":[[1210,5],[1255,6]]},"268":{"position":[[2338,6],[2719,5]]},"318":{"position":[[1161,6]]},"407":{"position":[[1210,5],[1255,6]]},"408":{"position":[[2338,6],[2719,5]]},"480":{"position":[[68,5],[97,5],[202,6]]},"481":{"position":[[1442,6]]},"544":{"position":[[1161,6]]},"644":{"position":[[1210,5],[1255,6]]},"645":{"position":[[2338,6],[2719,5]]}},"keywords":{}}],["made",{"_index":2272,"title":{},"content":{"185":{"position":[[3722,4]]},"365":{"position":[[98,4]]},"376":{"position":[[3706,4]]},"477":{"position":[[4064,4]]},"581":{"position":[[98,4]]},"592":{"position":[[3706,4]]},"699":{"position":[[4064,4]]}},"keywords":{}}],["magic",{"_index":2780,"title":{},"content":{"248":{"position":[[273,5]]},"447":{"position":[[273,5]]},"616":{"position":[[664,5],[958,5]]},"674":{"position":[[273,5]]},"724":{"position":[[664,5],[958,5]]}},"keywords":{}}],["main",{"_index":239,"title":{},"content":{"8":{"position":[[247,6]]},"9":{"position":[[108,6]]},"20":{"position":[[925,4]]},"32":{"position":[[369,6],[543,6]]},"42":{"position":[[682,6]]},"92":{"position":[[35,4],[526,4]]},"100":{"position":[[66,4]]},"102":{"position":[[655,4]]},"103":{"position":[[683,4]]},"107":{"position":[[23,4]]},"117":{"position":[[520,4]]},"126":{"position":[[951,4],[1329,6],[2049,4]]},"209":{"position":[[746,4]]},"212":{"position":[[3225,6]]},"264":{"position":[[363,4]]},"274":{"position":[[23,4]]},"277":{"position":[[951,4],[1497,6],[2217,4]]},"284":{"position":[[35,4],[526,4]]},"292":{"position":[[66,4]]},"294":{"position":[[655,4]]},"295":{"position":[[683,4]]},"298":{"position":[[520,4]]},"382":{"position":[[176,4]]},"383":{"position":[[4,4]]},"388":{"position":[[678,4]]},"391":{"position":[[3243,6]]},"395":{"position":[[539,6]]},"404":{"position":[[363,4]]},"477":{"position":[[1704,6]]},"491":{"position":[[23,4]]},"496":{"position":[[35,4],[526,4]]},"504":{"position":[[66,4]]},"506":{"position":[[655,4]]},"507":{"position":[[683,4]]},"514":{"position":[[951,4],[1329,6],[2049,4]]},"519":{"position":[[520,4]]},"594":{"position":[[535,4]]},"606":{"position":[[686,4]]},"618":{"position":[[40,4]]},"624":{"position":[[176,4]]},"625":{"position":[[4,4]]},"632":{"position":[[539,6]]},"641":{"position":[[363,4]]},"658":{"position":[[678,4]]},"661":{"position":[[3243,6]]},"699":{"position":[[1704,6]]},"702":{"position":[[535,4]]},"714":{"position":[[686,4]]},"726":{"position":[[40,4]]}},"keywords":{}}],["main.r",{"_index":2610,"title":{},"content":{"212":{"position":[[15,7]]},"391":{"position":[[15,7]]},"661":{"position":[[15,7]]}},"keywords":{}}],["mainnet",{"_index":1871,"title":{},"content":{"129":{"position":[[375,7]]},"277":{"position":[[1211,7]]},"280":{"position":[[375,7]]},"517":{"position":[[375,7]]}},"keywords":{}}],["mainnet.env",{"_index":1869,"title":{},"content":{"129":{"position":[[281,12]]},"280":{"position":[[281,12]]},"517":{"position":[[281,12]]}},"keywords":{}}],["maintain",{"_index":139,"title":{},"content":{"3":{"position":[[336,8]]},"79":{"position":[[441,11]]},"102":{"position":[[708,9]]},"230":{"position":[[458,11]]},"248":{"position":[[183,9]]},"294":{"position":[[708,9]]},"447":{"position":[[183,9]]},"461":{"position":[[458,11]]},"506":{"position":[[708,9]]},"674":{"position":[[183,9]]}},"keywords":{}}],["major",{"_index":3218,"title":{},"content":{"416":{"position":[[169,8],[3398,8]]},"653":{"position":[[169,8],[3398,8]]}},"keywords":{}}],["make",{"_index":16,"title":{},"content":{"1":{"position":[[153,4],[307,4]]},"7":{"position":[[152,4]]},"9":{"position":[[185,4]]},"22":{"position":[[1425,5]]},"31":{"position":[[431,4],[2641,4]]},"32":{"position":[[1152,4]]},"43":{"position":[[760,4]]},"52":{"position":[[501,4]]},"70":{"position":[[43,4]]},"83":{"position":[[154,6]]},"110":{"position":[[396,6]]},"127":{"position":[[177,4]]},"128":{"position":[[506,4],[724,4]]},"146":{"position":[[704,4]]},"147":{"position":[[575,4]]},"154":{"position":[[157,4]]},"162":{"position":[[591,4]]},"198":{"position":[[2362,4]]},"234":{"position":[[43,4]]},"247":{"position":[[1933,4]]},"252":{"position":[[154,6]]},"261":{"position":[[40,4]]},"267":{"position":[[230,5]]},"268":{"position":[[223,5]]},"278":{"position":[[177,4]]},"279":{"position":[[506,4],[724,4]]},"305":{"position":[[396,6]]},"334":{"position":[[708,4]]},"335":{"position":[[579,4]]},"339":{"position":[[157,4]]},"351":{"position":[[628,4]]},"379":{"position":[[40,4]]},"396":{"position":[[213,4]]},"401":{"position":[[40,4]]},"407":{"position":[[230,5]]},"408":{"position":[[223,5]]},"434":{"position":[[2352,4]]},"441":{"position":[[3282,4]]},"446":{"position":[[1933,4]]},"470":{"position":[[43,4]]},"477":{"position":[[210,4]]},"478":{"position":[[65,4],[368,6]]},"483":{"position":[[154,6]]},"510":{"position":[[396,6]]},"515":{"position":[[177,4]]},"516":{"position":[[506,4],[724,4]]},"551":{"position":[[708,4]]},"552":{"position":[[579,4]]},"559":{"position":[[157,4]]},"567":{"position":[[628,4]]},"621":{"position":[[40,4]]},"633":{"position":[[213,4]]},"638":{"position":[[40,4]]},"644":{"position":[[230,5]]},"645":{"position":[[223,5]]},"673":{"position":[[1933,4]]},"681":{"position":[[2362,4]]},"688":{"position":[[3282,4]]},"699":{"position":[[210,4]]},"700":{"position":[[65,4],[368,6]]}},"keywords":{}}],["makesoftware/casp",{"_index":2577,"title":{},"content":{"210":{"position":[[175,19]]},"389":{"position":[[175,19]]},"477":{"position":[[184,19]]},"659":{"position":[[175,19]]},"699":{"position":[[184,19]]}},"keywords":{}}],["manag",{"_index":1444,"title":{"117":{"position":[[0,8]]},"298":{"position":[[0,8]]},"519":{"position":[[0,8]]},"597":{"position":[[27,11]]},"705":{"position":[[27,11]]}},"content":{"79":{"position":[[402,8]]},"81":{"position":[[59,8]]},"230":{"position":[[419,8]]},"232":{"position":[[59,8]]},"461":{"position":[[419,8]]},"463":{"position":[[59,8]]}},"keywords":{}}],["mani",{"_index":400,"title":{},"content":{"15":{"position":[[92,4]]},"38":{"position":[[1078,4]]},"50":{"position":[[467,4]]},"114":{"position":[[299,4]]},"120":{"position":[[383,4]]},"157":{"position":[[689,4]]},"160":{"position":[[23,4]]},"162":{"position":[[2077,4]]},"163":{"position":[[269,4]]},"164":{"position":[[923,4]]},"182":{"position":[[151,4]]},"257":{"position":[[299,4]]},"301":{"position":[[383,4]]},"330":{"position":[[670,4]]},"345":{"position":[[23,4]]},"351":{"position":[[2099,4]]},"352":{"position":[[269,4]]},"353":{"position":[[958,4]]},"373":{"position":[[151,4]]},"413":{"position":[[10,4]]},"480":{"position":[[299,4]]},"522":{"position":[[383,4]]},"547":{"position":[[689,4]]},"562":{"position":[[23,4]]},"567":{"position":[[2099,4]]},"568":{"position":[[269,4]]},"569":{"position":[[958,4]]},"589":{"position":[[151,4]]},"601":{"position":[[2176,4]]},"650":{"position":[[10,4]]},"709":{"position":[[2176,4]]}},"keywords":{}}],["manipul",{"_index":3299,"title":{},"content":{"419":{"position":[[1736,10]]},"656":{"position":[[1736,10]]}},"keywords":{}}],["manner",{"_index":1418,"title":{},"content":{"76":{"position":[[309,7]]},"227":{"position":[[309,7]]},"458":{"position":[[309,7]]},"477":{"position":[[621,6]]},"699":{"position":[[621,6]]}},"keywords":{}}],["manual",{"_index":1323,"title":{"64":{"position":[[19,8]]},"65":{"position":[[22,9]]},"67":{"position":[[18,9]]},"154":{"position":[[22,9]]},"239":{"position":[[19,8]]},"240":{"position":[[22,9]]},"242":{"position":[[18,9]]},"339":{"position":[[22,9]]},"464":{"position":[[19,8]]},"465":{"position":[[22,9]]},"467":{"position":[[18,9]]},"559":{"position":[[22,9]]}},"content":{"65":{"position":[[22,9]]},"67":{"position":[[17,9]]},"88":{"position":[[460,9]]},"98":{"position":[[740,9]]},"240":{"position":[[22,9]]},"242":{"position":[[17,9]]},"250":{"position":[[460,9]]},"290":{"position":[[740,9]]},"465":{"position":[[22,9]]},"467":{"position":[[17,9]]},"488":{"position":[[460,9]]},"502":{"position":[[740,9]]}},"keywords":{}}],["map",{"_index":456,"title":{"79":{"position":[[9,8]]},"163":{"position":[[0,8]]},"230":{"position":[[9,8]]},"352":{"position":[[0,8]]},"461":{"position":[[9,8]]},"568":{"position":[[0,8]]},"601":{"position":[[11,9]]},"709":{"position":[[11,9]]}},"content":{"17":{"position":[[269,8],[384,8],[1906,8]]},"42":{"position":[[106,7],[1250,7]]},"76":{"position":[[218,8],[382,7],[569,8],[578,7],[763,7]]},"79":{"position":[[11,7],[130,7],[333,7],[581,8],[692,8],[823,8],[1176,7],[1365,8]]},"80":{"position":[[154,9]]},"110":{"position":[[261,8]]},"146":{"position":[[76,8]]},"163":{"position":[[4,7],[77,8],[208,7],[630,7],[1131,8],[1240,8],[1526,7]]},"178":{"position":[[88,8]]},"185":{"position":[[219,9],[2613,9],[2640,7],[3242,8],[3415,7],[3578,7]]},"203":{"position":[[71,8],[443,8],[541,8]]},"209":{"position":[[169,8],[367,8],[434,8],[1613,7]]},"211":{"position":[[472,7],[654,7]]},"212":{"position":[[1522,7],[2613,7],[2932,7],[3519,7],[3652,7]]},"227":{"position":[[218,8],[382,7],[569,8],[578,7],[763,7]]},"230":{"position":[[11,7],[130,7],[350,7],[598,8],[709,8],[840,8],[1193,7],[1382,8]]},"231":{"position":[[154,9]]},"267":{"position":[[866,10],[2449,7]]},"269":{"position":[[239,8]]},"305":{"position":[[261,8]]},"334":{"position":[[76,8]]},"352":{"position":[[4,7],[77,8],[208,7],[652,7],[1153,8],[1262,8],[1548,7]]},"369":{"position":[[88,8]]},"376":{"position":[[203,9],[2597,9],[2624,7],[3226,8],[3399,7],[3562,7]]},"384":{"position":[[236,8]]},"388":{"position":[[169,8],[367,8],[434,8],[1545,7]]},"390":{"position":[[446,7],[628,7]]},"391":{"position":[[1522,7],[2613,7],[2944,7],[3537,7],[3670,7]]},"407":{"position":[[866,10],[2449,7]]},"409":{"position":[[239,8]]},"419":{"position":[[706,8]]},"423":{"position":[[71,8],[443,8],[541,8]]},"440":{"position":[[178,8],[3882,7]]},"458":{"position":[[218,8],[382,7],[569,8],[578,7],[763,7]]},"461":{"position":[[11,7],[130,7],[350,7],[598,8],[709,8],[840,8],[1193,7],[1382,8]]},"462":{"position":[[154,9]]},"476":{"position":[[170,8]]},"510":{"position":[[261,8]]},"551":{"position":[[76,8]]},"568":{"position":[[4,7],[77,8],[208,7],[652,7],[1153,8],[1262,8],[1548,7]]},"585":{"position":[[88,8]]},"592":{"position":[[203,9],[2597,9],[2624,7],[3226,8],[3399,7],[3562,7]]},"601":{"position":[[53,9],[2202,7]]},"603":{"position":[[286,8]]},"626":{"position":[[236,8]]},"644":{"position":[[866,10],[2449,7]]},"646":{"position":[[239,8]]},"656":{"position":[[706,8]]},"658":{"position":[[169,8],[367,8],[434,8],[1545,7]]},"660":{"position":[[446,7],[628,7]]},"661":{"position":[[1522,7],[2613,7],[2944,7],[3537,7],[3670,7]]},"665":{"position":[[71,8],[443,8],[541,8]]},"687":{"position":[[178,8],[3882,7]]},"698":{"position":[[170,8]]},"709":{"position":[[53,9],[2202,7]]},"711":{"position":[[286,8]]}},"keywords":{}}],["map_err(|_",{"_index":3390,"title":{},"content":{"440":{"position":[[1919,12]]},"687":{"position":[[1919,12]]}},"keywords":{}}],["mapping<(address",{"_index":473,"title":{},"content":{"17":{"position":[[553,20],[2151,20]]},"203":{"position":[[312,20]]},"267":{"position":[[1115,20]]},"269":{"position":[[480,20]]},"384":{"position":[[493,20]]},"407":{"position":[[1115,20]]},"409":{"position":[[480,20]]},"423":{"position":[[312,20]]},"601":{"position":[[676,20]]},"626":{"position":[[493,20]]},"644":{"position":[[1115,20]]},"646":{"position":[[480,20]]},"665":{"position":[[312,20]]},"709":{"position":[[676,20]]}},"keywords":{}}],["mapping<(rol",{"_index":2214,"title":{},"content":{"185":{"position":[[408,17]]},"376":{"position":[[392,17]]},"592":{"position":[[392,17]]}},"keywords":{}}],["mapping<(str",{"_index":1451,"title":{},"content":{"79":{"position":[[712,19]]},"80":{"position":[[296,19]]},"230":{"position":[[729,19]]},"231":{"position":[[296,19]]},"461":{"position":[[729,19]]},"462":{"position":[[296,19]]}},"keywords":{}}],["mapping<address",{"_index":518,"title":{},"content":{"17":{"position":[[2112,19]]},"84":{"position":[[268,19]]},"203":{"position":[[270,19]]},"253":{"position":[[268,19]]},"267":{"position":[[969,19],[989,19]]},"269":{"position":[[438,19]]},"384":{"position":[[451,19]]},"407":{"position":[[969,19],[989,19]]},"409":{"position":[[438,19]]},"423":{"position":[[270,19]]},"476":{"position":[[287,19],[338,19]]},"484":{"position":[[268,19]]},"601":{"position":[[116,19]]},"626":{"position":[[451,19]]},"644":{"position":[[969,19],[989,19]]},"646":{"position":[[438,19]]},"665":{"position":[[270,19]]},"698":{"position":[[287,19],[338,19]]},"709":{"position":[[116,19]]}},"keywords":{}}],["mapping<rol",{"_index":2217,"title":{},"content":{"185":{"position":[[458,16]]},"376":{"position":[[442,16]]},"592":{"position":[[442,16]]}},"keywords":{}}],["mapping<str",{"_index":1452,"title":{},"content":{"79":{"position":[[766,18]]},"163":{"position":[[437,18]]},"209":{"position":[[1670,18]]},"230":{"position":[[783,18]]},"352":{"position":[[459,18]]},"388":{"position":[[1602,18]]},"461":{"position":[[783,18]]},"568":{"position":[[459,18]]},"658":{"position":[[1602,18]]}},"keywords":{}}],["mapping<ticketid",{"_index":3371,"title":{},"content":{"440":{"position":[[1075,20]]},"687":{"position":[[1075,20]]}},"keywords":{}}],["mapping<u32",{"_index":2099,"title":{},"content":{"163":{"position":[[1638,15]]},"352":{"position":[[1660,15]]},"568":{"position":[[1660,15]]}},"keywords":{}}],["mapping'",{"_index":1548,"title":{},"content":{"85":{"position":[[720,9]]},"254":{"position":[[720,9]]},"485":{"position":[[720,9]]}},"keywords":{}}],["mapping(address",{"_index":1052,"title":{},"content":{"42":{"position":[[956,15]]}},"keywords":{}}],["mapping.l11",{"_index":2443,"title":{},"content":{"203":{"position":[[499,11]]},"423":{"position":[[499,11]]},"665":{"position":[[499,11]]}},"keywords":{}}],["mapping::get",{"_index":1472,"title":{},"content":{"79":{"position":[[1459,14]]},"230":{"position":[[1476,14]]},"461":{"position":[[1476,14]]}},"keywords":{}}],["mapping::modul",{"_index":1473,"title":{},"content":{"79":{"position":[[1489,18]]},"230":{"position":[[1506,18]]},"461":{"position":[[1506,18]]}},"keywords":{}}],["mapping_data",{"_index":2655,"title":{},"content":{"212":{"position":[[2970,12],[3817,13]]},"391":{"position":[[2982,12],[3835,13]]},"661":{"position":[[2982,12],[3835,13]]}},"keywords":{}}],["mappingcontract",{"_index":3683,"title":{},"content":{"601":{"position":[[90,15],[182,15]]},"709":{"position":[[90,15],[182,15]]}},"keywords":{}}],["mark",{"_index":1598,"title":{},"content":{"92":{"position":[[636,6]]},"141":{"position":[[560,6]]},"146":{"position":[[384,4]]},"147":{"position":[[107,6],[332,4],[701,6]]},"178":{"position":[[391,6]]},"204":{"position":[[1020,6]]},"230":{"position":[[238,6]]},"284":{"position":[[636,6]]},"326":{"position":[[560,6]]},"334":{"position":[[384,4]]},"335":{"position":[[107,6],[332,4],[709,6]]},"354":{"position":[[689,6]]},"369":{"position":[[391,6]]},"419":{"position":[[1231,6]]},"424":{"position":[[971,6]]},"461":{"position":[[238,6]]},"496":{"position":[[636,6]]},"535":{"position":[[560,6]]},"551":{"position":[[384,4]]},"552":{"position":[[107,6],[332,4],[709,6]]},"570":{"position":[[689,6]]},"585":{"position":[[391,6]]},"656":{"position":[[1231,6]]},"666":{"position":[[971,6]]}},"keywords":{}}],["master",{"_index":2304,"title":{},"content":{"193":{"position":[[50,6]]},"201":{"position":[[50,6]]},"421":{"position":[[50,6]]},"429":{"position":[[50,6]]},"663":{"position":[[50,6]]},"676":{"position":[[50,6]]}},"keywords":{}}],["match",{"_index":356,"title":{},"content":{"10":{"position":[[1330,5]]},"17":{"position":[[1241,5]]},"39":{"position":[[144,9],[2470,5]]},"197":{"position":[[537,5],[985,5]]},"433":{"position":[[537,5],[984,5]]},"617":{"position":[[439,5],[1258,5]]},"680":{"position":[[537,5],[984,5]]},"725":{"position":[[439,5],[1258,5]]}},"keywords":{}}],["math",{"_index":3828,"title":{},"content":{"613":{"position":[[82,4],[1370,4]]},"721":{"position":[[82,4],[1370,4]]}},"keywords":{}}],["math::add(left",{"_index":993,"title":{},"content":{"39":{"position":[[2672,15]]}},"keywords":{}}],["math::sqrt(x",{"_index":3834,"title":{},"content":{"613":{"position":[[436,13]]},"721":{"position":[[436,13]]}},"keywords":{}}],["math::sub(left",{"_index":995,"title":{},"content":{"39":{"position":[[2744,15]]}},"keywords":{}}],["math_engine_address",{"_index":1968,"title":{},"content":{"143":{"position":[[430,20]]},"328":{"position":[[480,20]]},"537":{"position":[[480,20]]}},"keywords":{}}],["math_engine_contract",{"_index":1966,"title":{},"content":{"143":{"position":[[317,20]]},"328":{"position":[[317,20]]},"537":{"position":[[317,20]]}},"keywords":{}}],["math_engine_contract.address",{"_index":1969,"title":{},"content":{"143":{"position":[[451,31]]},"328":{"position":[[501,31]]},"537":{"position":[[501,31]]}},"keywords":{}}],["mathengin",{"_index":1942,"title":{},"content":{"141":{"position":[[1092,10]]},"143":{"position":[[753,10]]},"326":{"position":[[1092,10]]},"328":{"position":[[728,10]]},"535":{"position":[[1092,10]]},"537":{"position":[[728,10]]}},"keywords":{}}],["mathenginehostref",{"_index":1963,"title":{},"content":{"143":{"position":[[183,19]]},"328":{"position":[[183,19]]},"537":{"position":[[183,19]]}},"keywords":{}}],["mathenginehostref::deploy(&test_env",{"_index":1967,"title":{},"content":{"143":{"position":[[340,40]]},"328":{"position":[[340,40]]},"537":{"position":[[340,40]]}},"keywords":{}}],["mathenginehostref::deploy(test_env",{"_index":1983,"title":{},"content":{"143":{"position":[[1302,35]]},"328":{"position":[[1277,35]]},"537":{"position":[[1277,35]]}},"keywords":{}}],["matter",{"_index":1408,"title":{},"content":{"74":{"position":[[332,7]]},"196":{"position":[[717,7]]},"238":{"position":[[332,7]]},"432":{"position":[[654,7]]},"474":{"position":[[332,7]]},"679":{"position":[[654,7]]}},"keywords":{}}],["maximum",{"_index":1509,"title":{},"content":{"83":{"position":[[380,7]]},"85":{"position":[[129,7]]},"252":{"position":[[380,7]]},"254":{"position":[[129,7]]},"483":{"position":[[380,7]]},"485":{"position":[[129,7]]}},"keywords":{}}],["mayb",{"_index":557,"title":{},"content":{"18":{"position":[[354,5]]}},"keywords":{}}],["maybe<string>",{"_index":3460,"title":{},"content":{"440":{"position":[[6310,20]]},"687":{"position":[[6310,20]]}},"keywords":{}}],["maybe<u64>",{"_index":3458,"title":{},"content":{"440":{"position":[[6280,17]]},"687":{"position":[[6280,17]]}},"keywords":{}}],["maybe::non",{"_index":3384,"title":{},"content":{"440":{"position":[[1593,11],[1866,13],[2501,12],[3085,12]]},"441":{"position":[[3070,13]]},"687":{"position":[[1593,11],[1866,13],[2501,12],[3085,12]]},"688":{"position":[[3070,13]]}},"keywords":{}}],["maybe::some(ticket_id",{"_index":3504,"title":{},"content":{"441":{"position":[[3046,23]]},"688":{"position":[[3046,23]]}},"keywords":{}}],["mean",{"_index":2649,"title":{},"content":{"212":{"position":[[2377,5]]},"391":{"position":[[2377,5]]},"416":{"position":[[3219,4]]},"419":{"position":[[1908,7]]},"605":{"position":[[377,7]]},"612":{"position":[[1412,5]]},"653":{"position":[[3219,4]]},"656":{"position":[[1908,7]]},"661":{"position":[[2377,5]]},"713":{"position":[[377,7]]},"720":{"position":[[1412,5]]}},"keywords":{}}],["mechan",{"_index":2295,"title":{"416":{"position":[[7,10]]},"653":{"position":[[7,10]]}},"content":{"189":{"position":[[83,10]]},"190":{"position":[[59,9]]},"366":{"position":[[83,10]]},"367":{"position":[[59,9]]},"413":{"position":[[46,9]]},"415":{"position":[[60,10],[314,10]]},"416":{"position":[[3128,9]]},"582":{"position":[[83,10]]},"583":{"position":[[59,9]]},"609":{"position":[[268,10]]},"650":{"position":[[46,9]]},"652":{"position":[[60,10],[314,10]]},"653":{"position":[[3128,9]]},"717":{"position":[[268,10]]}},"keywords":{}}],["members.error",{"_index":3052,"title":{},"content":{"324":{"position":[[701,14]]},"542":{"position":[[701,14]]}},"keywords":{}}],["memori",{"_index":716,"title":{"87":{"position":[[0,6]]},"249":{"position":[[0,6]]},"487":{"position":[[0,6]]}},"content":{"31":{"position":[[125,6],[1353,7]]},"42":{"position":[[1021,6],[1182,7]]},"43":{"position":[[239,6],[260,6]]},"603":{"position":[[145,7]]},"711":{"position":[[145,7]]}},"keywords":{}}],["memoryaccount",{"_index":768,"title":{},"content":{"31":{"position":[[1534,13],[1828,13]]}},"keywords":{}}],["memorybackend::new(&vicin",{"_index":777,"title":{},"content":{"31":{"position":[[1984,33]]}},"keywords":{}}],["memorystackstate::new(metadata",{"_index":781,"title":{},"content":{"31":{"position":[[2104,31]]}},"keywords":{}}],["memoryvicin",{"_index":744,"title":{},"content":{"31":{"position":[[980,14]]}},"keywords":{}}],["mention",{"_index":1217,"title":{},"content":{"51":{"position":[[1607,9]]},"85":{"position":[[705,10]]},"94":{"position":[[481,9]]},"136":{"position":[[195,9]]},"141":{"position":[[3,9]]},"197":{"position":[[1500,10]]},"198":{"position":[[3185,10]]},"221":{"position":[[372,9]]},"247":{"position":[[1567,10]]},"254":{"position":[[705,10]]},"286":{"position":[[481,9]]},"316":{"position":[[195,9]]},"326":{"position":[[3,9]]},"396":{"position":[[644,8]]},"433":{"position":[[1499,10]]},"434":{"position":[[3167,10]]},"446":{"position":[[1567,10]]},"454":{"position":[[372,9]]},"485":{"position":[[705,10]]},"498":{"position":[[481,9]]},"533":{"position":[[195,9]]},"535":{"position":[[3,9]]},"633":{"position":[[644,8]]},"673":{"position":[[1567,10]]},"680":{"position":[[1499,10]]},"681":{"position":[[3185,10]]},"694":{"position":[[372,9]]}},"keywords":{}}],["menu",{"_index":3108,"title":{},"content":{"393":{"position":[[272,4]]},"396":{"position":[[276,4]]},"630":{"position":[[272,4]]},"633":{"position":[[276,4]]}},"keywords":{}}],["merg",{"_index":1736,"title":{},"content":{"115":{"position":[[1621,6]]},"258":{"position":[[1567,6]]},"481":{"position":[[1567,6]]}},"keywords":{}}],["mess",{"_index":1704,"title":{},"content":{"110":{"position":[[470,7]]},"305":{"position":[[470,7]]},"510":{"position":[[470,7]]}},"keywords":{}}],["messag",{"_index":472,"title":{"42":{"position":[[7,8]]}},"content":{"17":{"position":[[543,9]]},"42":{"position":[[150,8],[1280,7],[1376,8],[2678,7]]},"53":{"position":[[556,7]]},"596":{"position":[[154,8],[334,8],[878,8],[947,7]]},"610":{"position":[[95,8],[303,8],[397,8]]},"611":{"position":[[962,7]]},"704":{"position":[[154,8],[334,8],[878,8],[947,7]]},"718":{"position":[[95,8],[303,8],[397,8]]},"719":{"position":[[962,7]]}},"keywords":{}}],["messagealreadydefin",{"_index":504,"title":{},"content":{"17":{"position":[[1568,21]]}},"keywords":{}}],["meta",{"_index":2553,"title":{},"content":{"209":{"position":[[866,5],[1055,4]]},"211":{"position":[[228,5]]},"388":{"position":[[798,5],[987,4]]},"390":{"position":[[228,5]]},"658":{"position":[[798,5],[987,4]]},"660":{"position":[[228,5]]}},"keywords":{}}],["metadata",{"_index":778,"title":{"204":{"position":[[0,9]]},"424":{"position":[[0,9]]},"666":{"position":[[0,9]]}},"content":{"31":{"position":[[2030,8]]},"195":{"position":[[525,9]]},"202":{"position":[[151,8]]},"204":{"position":[[1128,8]]},"206":{"position":[[658,8]]},"209":{"position":[[242,8],[583,8],[776,8],[1062,8]]},"211":{"position":[[234,9]]},"212":{"position":[[482,8],[1446,10],[1463,8],[1493,8],[2481,8],[4501,8]]},"267":{"position":[[3396,9]]},"269":{"position":[[4568,8]]},"388":{"position":[[242,8],[544,8],[708,8],[994,8]]},"390":{"position":[[234,9]]},"391":{"position":[[482,8],[1446,10],[1463,8],[1493,8],[2481,8],[4519,8]]},"407":{"position":[[3396,9]]},"409":{"position":[[4568,8]]},"419":{"position":[[1334,8]]},"422":{"position":[[151,8]]},"424":{"position":[[1078,8]]},"426":{"position":[[658,8]]},"431":{"position":[[525,9]]},"644":{"position":[[3396,9]]},"646":{"position":[[4568,8]]},"656":{"position":[[1334,8]]},"658":{"position":[[242,8],[544,8],[708,8],[994,8]]},"660":{"position":[[234,9]]},"661":{"position":[[482,8],[1446,10],[1463,8],[1493,8],[2481,8],[4519,8]]},"664":{"position":[[151,8]]},"666":{"position":[[1078,8]]},"668":{"position":[[658,8]]},"678":{"position":[[525,9]]}},"keywords":{}}],["metadatamutability::immut",{"_index":3383,"title":{},"content":{"440":{"position":[[1502,30]]},"687":{"position":[[1502,30]]}},"keywords":{}}],["metdata",{"_index":3193,"title":{},"content":{"396":{"position":[[450,8]]},"633":{"position":[[450,8]]}},"keywords":{}}],["method",{"_index":266,"title":{},"content":{"9":{"position":[[225,7]]},"10":{"position":[[93,9],[412,7],[1123,7]]},"11":{"position":[[56,7],[207,6]]},"12":{"position":[[232,6]]},"39":{"position":[[1221,6],[1351,7]]},"86":{"position":[[103,6]]},"103":{"position":[[431,6]]},"126":{"position":[[1875,7],[2842,6]]},"142":{"position":[[208,6]]},"209":{"position":[[197,8],[287,6]]},"210":{"position":[[1083,6]]},"255":{"position":[[103,6]]},"277":{"position":[[2043,7],[3010,6]]},"295":{"position":[[431,6]]},"327":{"position":[[208,6]]},"388":{"position":[[197,8],[287,6]]},"389":{"position":[[1020,6]]},"414":{"position":[[513,7]]},"417":{"position":[[1655,8]]},"486":{"position":[[103,6]]},"507":{"position":[[431,6]]},"514":{"position":[[1875,7],[2842,6]]},"536":{"position":[[208,6]]},"598":{"position":[[1138,6]]},"612":{"position":[[1661,6]]},"651":{"position":[[513,7]]},"654":{"position":[[1655,8]]},"658":{"position":[[197,8],[287,6]]},"659":{"position":[[1020,6]]},"706":{"position":[[1138,6]]},"720":{"position":[[1661,6]]}},"keywords":{}}],["method_cod",{"_index":839,"title":{},"content":{"32":{"position":[[1173,11]]}},"keywords":{}}],["method_id",{"_index":314,"title":{},"content":{"9":{"position":[[1500,9]]},"10":{"position":[[223,9],[426,10],[933,11],[1223,10]]}},"keywords":{}}],["methods/guest/src/bin/evm_calc.r",{"_index":816,"title":{},"content":{"32":{"position":[[158,33]]}},"keywords":{}}],["methods/guest/src/multiply.r",{"_index":236,"title":{},"content":{"8":{"position":[[210,29]]}},"keywords":{}}],["michael",{"_index":724,"title":{},"content":{"31":{"position":[[386,7]]}},"keywords":{}}],["migrat",{"_index":2785,"title":{"259":{"position":[[0,9]]},"263":{"position":[[3,9]]},"377":{"position":[[0,9]]},"381":{"position":[[3,9]]},"399":{"position":[[0,9]]},"403":{"position":[[3,9]]},"619":{"position":[[0,9]]},"623":{"position":[[3,9]]},"636":{"position":[[0,9]]},"640":{"position":[[3,9]]}},"content":{"261":{"position":[[21,9]]},"265":{"position":[[411,9]]},"269":{"position":[[68,9]]},"270":{"position":[[57,9]]},"379":{"position":[[21,9]]},"384":{"position":[[68,9]]},"385":{"position":[[57,9]]},"401":{"position":[[21,9]]},"405":{"position":[[411,9]]},"409":{"position":[[68,9]]},"410":{"position":[[57,9]]},"621":{"position":[[21,9]]},"626":{"position":[[68,9]]},"627":{"position":[[57,9]]},"638":{"position":[[21,9]]},"642":{"position":[[411,9]]},"646":{"position":[[68,9]]},"647":{"position":[[57,9]]}},"keywords":{}}],["mimic",{"_index":1573,"title":{},"content":{"91":{"position":[[74,6]]},"283":{"position":[[74,6]]},"495":{"position":[[74,6]]},"610":{"position":[[903,6]]},"718":{"position":[[903,6]]}},"keywords":{}}],["mind",{"_index":401,"title":{},"content":{"15":{"position":[[109,4]]},"38":{"position":[[371,4],[503,4]]},"84":{"position":[[59,5]]},"119":{"position":[[549,4]]},"162":{"position":[[1537,4]]},"253":{"position":[[59,5]]},"300":{"position":[[549,4]]},"351":{"position":[[1559,4]]},"484":{"position":[[59,5]]},"521":{"position":[[549,4]]},"567":{"position":[[1559,4]]}},"keywords":{}}],["mindblow",{"_index":855,"title":{},"content":{"33":{"position":[[16,11]]}},"keywords":{}}],["minim",{"_index":99,"title":{},"content":{"2":{"position":[[178,8]]},"163":{"position":[[1199,8]]},"352":{"position":[[1221,8]]},"568":{"position":[[1221,8]]}},"keywords":{}}],["minimalist",{"_index":1760,"title":{},"content":{"117":{"position":[[596,12]]},"298":{"position":[[596,12]]},"519":{"position":[[596,12]]}},"keywords":{}}],["mint",{"_index":1669,"title":{},"content":{"100":{"position":[[989,4]]},"101":{"position":[[690,4]]},"115":{"position":[[1690,7]]},"204":{"position":[[1141,5],[1309,4],[1405,6]]},"245":{"position":[[97,4]]},"247":{"position":[[1842,7]]},"258":{"position":[[1636,7]]},"292":{"position":[[989,4]]},"293":{"position":[[690,4]]},"395":{"position":[[298,5],[1050,7]]},"396":{"position":[[851,7]]},"413":{"position":[[194,4]]},"415":{"position":[[158,7],[190,7],[246,7],[361,4]]},"416":{"position":[[133,4],[212,5],[515,5],[986,5],[1225,5],[1300,5],[1389,4],[1515,4],[1694,5],[1849,5],[2169,6],[2546,5],[2654,5],[3375,4],[4749,4],[4820,8],[4910,4]]},"417":{"position":[[477,4],[905,7],[1160,4]]},"419":{"position":[[601,5],[886,5],[3640,5],[3908,4],[4034,4],[4211,5],[4367,5],[4609,5],[6892,4],[7320,7],[7575,4]]},"424":{"position":[[1091,5],[1259,4],[1355,6]]},"440":{"position":[[1776,4],[4158,5]]},"441":{"position":[[2899,7],[4046,7]]},"444":{"position":[[97,4]]},"446":{"position":[[1842,7]]},"481":{"position":[[1636,7]]},"504":{"position":[[989,4]]},"505":{"position":[[690,4]]},"632":{"position":[[298,5],[1050,7]]},"633":{"position":[[851,7]]},"650":{"position":[[194,4]]},"652":{"position":[[158,7],[190,7],[246,7],[361,4]]},"653":{"position":[[133,4],[212,5],[515,5],[986,5],[1225,5],[1300,5],[1389,4],[1515,4],[1694,5],[1849,5],[2169,6],[2546,5],[2654,5],[3375,4],[4749,4],[4820,8],[4910,4]]},"654":{"position":[[477,4],[905,7],[1160,4]]},"656":{"position":[[601,5],[886,5],[3640,5],[3908,4],[4034,4],[4211,5],[4367,5],[4609,5],[6892,4],[7320,7],[7575,4]]},"666":{"position":[[1091,5],[1259,4],[1355,6]]},"671":{"position":[[97,4]]},"673":{"position":[[1842,7]]},"687":{"position":[[1776,4],[4158,5]]},"688":{"position":[[2899,7],[4046,7]]}},"keywords":{}}],["mint(&mut",{"_index":1729,"title":{},"content":{"115":{"position":[[1217,13],[2817,13]]},"204":{"position":[[626,13]]},"247":{"position":[[1370,13]]},"258":{"position":[[1163,13],[2743,13]]},"269":{"position":[[1933,13]]},"384":{"position":[[1953,13]]},"409":{"position":[[1933,13]]},"419":{"position":[[3699,13]]},"424":{"position":[[601,13]]},"446":{"position":[[1370,13]]},"481":{"position":[[1163,13],[2743,13]]},"626":{"position":[[1953,13]]},"646":{"position":[[1933,13]]},"656":{"position":[[3699,13]]},"666":{"position":[[601,13]]},"673":{"position":[[1370,13]]}},"keywords":{}}],["mint(&self",{"_index":1494,"title":{},"content":{"80":{"position":[[721,15]]},"231":{"position":[[721,15]]},"462":{"position":[[721,15]]}},"keywords":{}}],["mint(address",{"_index":1122,"title":{},"content":{"43":{"position":[[387,12]]}},"keywords":{}}],["mint.anyon",{"_index":3215,"title":{},"content":{"416":{"position":[[84,11]]},"653":{"position":[[84,11]]}},"keywords":{}}],["minter",{"_index":3302,"title":{},"content":{"419":{"position":[[1881,6],[1955,6]]},"656":{"position":[[1881,6],[1955,6]]}},"keywords":{}}],["minter_list",{"_index":3307,"title":{},"content":{"419":{"position":[[2248,12]]},"656":{"position":[[2248,12]]}},"keywords":{}}],["minut",{"_index":1152,"title":{},"content":{"43":{"position":[[1619,7]]},"193":{"position":[[28,7]]},"201":{"position":[[28,7]]},"395":{"position":[[1293,8],[1337,8]]},"416":{"position":[[1974,7],[2313,8],[2468,8]]},"419":{"position":[[4492,7]]},"421":{"position":[[28,7]]},"429":{"position":[[28,7]]},"632":{"position":[[1293,8],[1337,8]]},"653":{"position":[[1974,7],[2313,8],[2468,8]]},"656":{"position":[[4492,7]]},"663":{"position":[[28,7]]},"676":{"position":[[28,7]]}},"keywords":{}}],["mirror",{"_index":2271,"title":{},"content":{"185":{"position":[[3539,6]]},"221":{"position":[[865,6]]},"376":{"position":[[3523,6]]},"454":{"position":[[865,6]]},"592":{"position":[[3523,6]]},"694":{"position":[[865,6]]}},"keywords":{}}],["miscellan",{"_index":3858,"title":{"615":{"position":[[0,14]]},"723":{"position":[[0,14]]}},"content":{},"keywords":{}}],["miss",{"_index":1877,"title":{},"content":{"129":{"position":[[722,7]]},"280":{"position":[[723,7]]},"517":{"position":[[723,7]]}},"keywords":{}}],["missingoper",{"_index":3495,"title":{},"content":{"441":{"position":[[2301,15],[4411,15]]},"688":{"position":[[2301,15],[4411,15]]}},"keywords":{}}],["missingrol",{"_index":2199,"title":{},"content":{"184":{"position":[[1021,11]]},"375":{"position":[[918,11]]},"591":{"position":[[918,11]]}},"keywords":{}}],["mit",{"_index":1048,"title":{},"content":{"42":{"position":[[902,3]]}},"keywords":{}}],["mix",{"_index":1403,"title":{"74":{"position":[[0,6]]},"238":{"position":[[0,6]]},"474":{"position":[[0,6]]}},"content":{},"keywords":{}}],["mock",{"_index":2730,"title":{},"content":{"223":{"position":[[86,4]]},"456":{"position":[[86,4]]},"696":{"position":[[86,4]]}},"keywords":{}}],["mockvm",{"_index":1096,"title":{},"content":{"42":{"position":[[2586,6]]},"119":{"position":[[132,7]]},"300":{"position":[[132,7]]},"521":{"position":[[132,7]]}},"keywords":{}}],["mod",{"_index":1068,"title":{},"content":{"42":{"position":[[1450,3],[1565,3]]},"51":{"position":[[1108,3],[1334,3]]},"73":{"position":[[451,3]]},"118":{"position":[[198,3]]},"138":{"position":[[177,3]]},"143":{"position":[[114,3],[964,3]]},"148":{"position":[[24,3]]},"151":{"position":[[109,3]]},"160":{"position":[[162,3]]},"168":{"position":[[344,3]]},"178":{"position":[[1030,3]]},"198":{"position":[[24,3]]},"206":{"position":[[26,3]]},"223":{"position":[[812,3]]},"237":{"position":[[451,3]]},"269":{"position":[[3268,3],[3622,3],[3841,3]]},"299":{"position":[[198,3]]},"318":{"position":[[177,3]]},"328":{"position":[[114,3],[939,3]]},"336":{"position":[[24,3]]},"342":{"position":[[109,3]]},"345":{"position":[[162,3]]},"348":{"position":[[344,3]]},"369":{"position":[[1030,3]]},"384":{"position":[[3309,3],[3608,3],[3805,3]]},"409":{"position":[[3268,3],[3622,3],[3841,3]]},"419":{"position":[[6492,3]]},"426":{"position":[[26,3]]},"434":{"position":[[24,3]]},"456":{"position":[[812,3]]},"473":{"position":[[451,3]]},"520":{"position":[[198,3]]},"537":{"position":[[114,3],[939,3]]},"544":{"position":[[177,3]]},"553":{"position":[[24,3]]},"556":{"position":[[109,3]]},"562":{"position":[[162,3]]},"564":{"position":[[344,3]]},"585":{"position":[[1030,3]]},"613":{"position":[[78,3],[1782,3]]},"626":{"position":[[3309,3],[3608,3],[3805,3]]},"646":{"position":[[3268,3],[3622,3],[3841,3]]},"656":{"position":[[6492,3]]},"668":{"position":[[26,3]]},"681":{"position":[[24,3]]},"696":{"position":[[812,3]]},"721":{"position":[[78,3],[1782,3]]}},"keywords":{}}],["modal",{"_index":3271,"title":{},"content":{"416":{"position":[[4807,8]]},"653":{"position":[[4807,8]]}},"keywords":{}}],["modalities::{metadatamut",{"_index":3347,"title":{},"content":{"440":{"position":[[278,32]]},"687":{"position":[[278,32]]}},"keywords":{}}],["modalityi",{"_index":3213,"title":{},"content":{"415":{"position":[[198,10]]},"652":{"position":[[198,10]]}},"keywords":{}}],["mode",{"_index":714,"title":{},"content":{"31":{"position":[[92,5]]},"52":{"position":[[834,4]]},"65":{"position":[[383,4]]},"68":{"position":[[52,5]]},"240":{"position":[[383,4]]},"243":{"position":[[52,5]]},"465":{"position":[[383,4]]},"468":{"position":[[52,5]]}},"keywords":{}}],["model",{"_index":405,"title":{},"content":{"15":{"position":[[181,6]]},"16":{"position":[[141,5]]},"163":{"position":[[1092,5]]},"352":{"position":[[1114,5]]},"568":{"position":[[1114,5]]},"612":{"position":[[1875,6]]},"720":{"position":[[1875,6]]}},"keywords":{}}],["modif",{"_index":2773,"title":{},"content":{"247":{"position":[[1720,13]]},"446":{"position":[[1720,13]]},"673":{"position":[[1720,13]]}},"keywords":{}}],["modifi",{"_index":1180,"title":{"606":{"position":[[0,10]]},"714":{"position":[[0,10]]}},"content":{"50":{"position":[[331,6]]},"52":{"position":[[2098,8]]},"107":{"position":[[206,6]]},"134":{"position":[[103,6]]},"162":{"position":[[1661,6]]},"274":{"position":[[206,6]]},"314":{"position":[[103,6]]},"351":{"position":[[1683,6]]},"440":{"position":[[54,6],[4017,6]]},"441":{"position":[[3992,6],[4115,6]]},"491":{"position":[[206,6]]},"531":{"position":[[103,6]]},"567":{"position":[[1683,6]]},"604":{"position":[[477,6]]},"605":{"position":[[422,6],[436,6],[590,6]]},"606":{"position":[[592,10]]},"687":{"position":[[54,6],[4017,6]]},"688":{"position":[[3992,6],[4115,6]]},"712":{"position":[[477,6]]},"713":{"position":[[422,6],[436,6],[590,6]]},"714":{"position":[[592,10]]}},"keywords":{}}],["modifier/priv",{"_index":3778,"title":{},"content":{"607":{"position":[[298,17]]},"715":{"position":[[298,17]]}},"keywords":{}}],["modul",{"_index":79,"title":{"150":{"position":[[0,7]]},"185":{"position":[[0,7]]},"186":{"position":[[11,7]]},"187":{"position":[[10,8]]},"195":{"position":[[9,7]]},"196":{"position":[[9,7]]},"203":{"position":[[0,6]]},"220":{"position":[[0,6]]},"246":{"position":[[0,6]]},"341":{"position":[[0,7]]},"363":{"position":[[11,7]]},"364":{"position":[[10,8]]},"376":{"position":[[0,7]]},"423":{"position":[[0,6]]},"431":{"position":[[9,7]]},"432":{"position":[[9,7]]},"445":{"position":[[0,6]]},"453":{"position":[[0,6]]},"555":{"position":[[0,7]]},"579":{"position":[[11,7]]},"580":{"position":[[10,8]]},"592":{"position":[[0,7]]},"665":{"position":[[0,6]]},"672":{"position":[[0,6]]},"678":{"position":[[9,7]]},"679":{"position":[[9,7]]},"693":{"position":[[0,6]]}},"content":{"1":{"position":[[976,8]]},"23":{"position":[[210,7]]},"38":{"position":[[767,6]]},"40":{"position":[[355,7]]},"42":{"position":[[399,6],[1637,7],[1695,7]]},"44":{"position":[[183,7],[195,6]]},"50":{"position":[[123,6]]},"51":{"position":[[336,6]]},"53":{"position":[[466,6]]},"78":{"position":[[32,6],[275,6]]},"79":{"position":[[354,6],[427,8],[1273,7],[1400,6],[1587,8]]},"81":{"position":[[149,7],[280,7]]},"84":{"position":[[461,6],[493,7],[660,6],[773,7]]},"85":{"position":[[19,6],[173,6],[191,6],[291,7],[810,7]]},"91":{"position":[[934,6]]},"100":{"position":[[101,7],[1055,7]]},"101":{"position":[[757,7]]},"114":{"position":[[170,8],[221,6],[310,7],[405,6]]},"115":{"position":[[1400,8],[1468,7],[1651,7],[1793,6],[3033,8],[3077,8]]},"141":{"position":[[113,6],[1322,8],[1479,6]]},"146":{"position":[[17,6],[41,6],[102,8],[156,6],[314,8],[630,7]]},"147":{"position":[[15,6]]},"148":{"position":[[173,6],[296,7],[672,6]]},"171":{"position":[[83,8]]},"178":{"position":[[32,6],[56,6],[116,8],[170,6],[299,6],[1179,6],[1302,7]]},"185":{"position":[[57,6]]},"187":{"position":[[5,7],[47,7]]},"188":{"position":[[17,6],[78,6],[166,6],[437,8],[471,6],[561,6],[708,8],[762,6]]},"189":{"position":[[20,6],[107,8],[237,6],[414,6],[590,7]]},"190":{"position":[[12,6]]},"193":{"position":[[2,6]]},"194":{"position":[[80,6]]},"195":{"position":[[482,6],[631,7]]},"196":{"position":[[640,7],[764,6]]},"197":{"position":[[1408,7]]},"198":{"position":[[2014,6],[2508,6],[2579,6]]},"199":{"position":[[12,6]]},"201":{"position":[[2,6]]},"202":{"position":[[4,6]]},"204":{"position":[[1032,7],[1203,7]]},"207":{"position":[[11,8]]},"218":{"position":[[62,7]]},"220":{"position":[[4,6]]},"221":{"position":[[400,6]]},"222":{"position":[[47,6]]},"223":{"position":[[26,6],[176,7]]},"229":{"position":[[32,6],[296,6]]},"230":{"position":[[371,6],[444,8],[1290,7],[1417,6],[1604,8]]},"232":{"position":[[149,7],[280,7]]},"245":{"position":[[16,6],[81,6]]},"246":{"position":[[15,6],[83,8],[413,8]]},"247":{"position":[[1654,7]]},"248":{"position":[[244,8]]},"253":{"position":[[461,6],[493,7],[660,6],[773,7]]},"254":{"position":[[19,6],[173,6],[191,6],[291,7],[810,7]]},"257":{"position":[[170,8],[221,6],[310,7],[405,6]]},"258":{"position":[[1346,8],[1414,7],[1597,7],[1739,6],[2959,8],[3003,8]]},"267":{"position":[[288,6],[829,6],[1852,9],[3250,6],[4341,6],[4392,6],[4441,6]]},"283":{"position":[[932,6]]},"292":{"position":[[101,7],[1055,7]]},"293":{"position":[[757,7]]},"321":{"position":[[140,7],[316,6],[561,6]]},"324":{"position":[[289,6],[326,6],[486,6]]},"326":{"position":[[113,6],[1322,8],[1479,6]]},"334":{"position":[[17,6],[41,6],[102,8],[156,6],[314,8],[634,7]]},"335":{"position":[[15,6]]},"336":{"position":[[173,6],[296,7],[672,6]]},"357":{"position":[[83,8]]},"364":{"position":[[5,7],[47,7]]},"365":{"position":[[374,6],[435,6],[523,6],[794,8],[828,6],[918,6],[1065,8],[1119,6]]},"366":{"position":[[20,6],[107,8],[237,6],[414,6],[590,7]]},"367":{"position":[[12,6]]},"369":{"position":[[32,6],[56,6],[116,8],[170,6],[299,6],[1179,6],[1302,7]]},"376":{"position":[[57,6]]},"395":{"position":[[2740,7]]},"407":{"position":[[288,6],[829,6],[1852,9],[3250,6],[4341,6],[4392,6],[4441,6]]},"414":{"position":[[331,7],[484,6]]},"416":{"position":[[417,6],[1349,7],[4613,7]]},"419":{"position":[[42,7],[647,6],[671,6],[732,8],[1139,6]]},"421":{"position":[[2,6]]},"422":{"position":[[4,6]]},"424":{"position":[[983,7],[1153,7]]},"427":{"position":[[11,8]]},"429":{"position":[[2,6]]},"430":{"position":[[80,6]]},"431":{"position":[[482,6],[631,7]]},"432":{"position":[[577,7],[701,6]]},"433":{"position":[[1407,7]]},"434":{"position":[[2004,6],[2498,6],[2569,6]]},"435":{"position":[[12,6]]},"440":{"position":[[3803,6],[3826,6],[3868,7],[4047,6]]},"441":{"position":[[1690,6]]},"442":{"position":[[154,8]]},"444":{"position":[[16,6],[81,6]]},"445":{"position":[[15,6],[83,8],[413,8]]},"446":{"position":[[1654,7]]},"447":{"position":[[244,8]]},"451":{"position":[[62,7]]},"453":{"position":[[4,6]]},"454":{"position":[[400,6]]},"455":{"position":[[47,6]]},"456":{"position":[[26,6],[176,7]]},"460":{"position":[[32,6],[296,6]]},"461":{"position":[[371,6],[444,8],[1290,7],[1417,6],[1604,8]]},"463":{"position":[[149,7],[280,7]]},"480":{"position":[[170,8],[221,6],[310,7],[405,6]]},"481":{"position":[[1346,8],[1414,7],[1597,7],[1739,6],[2959,8],[3003,8]]},"484":{"position":[[461,6],[493,7],[660,6],[773,7]]},"485":{"position":[[19,6],[173,6],[191,6],[291,7],[810,7]]},"495":{"position":[[932,6]]},"504":{"position":[[101,7],[1055,7]]},"505":{"position":[[757,7]]},"535":{"position":[[113,6],[1322,8],[1479,6]]},"539":{"position":[[140,7],[316,6],[561,6]]},"542":{"position":[[289,6],[326,6],[486,6]]},"551":{"position":[[17,6],[41,6],[102,8],[156,6],[314,8],[634,7]]},"552":{"position":[[15,6]]},"553":{"position":[[173,6],[296,7],[672,6]]},"573":{"position":[[83,8]]},"580":{"position":[[5,7],[47,7]]},"581":{"position":[[374,6],[435,6],[523,6],[794,8],[828,6],[918,6],[1065,8],[1119,6]]},"582":{"position":[[20,6],[107,8],[237,6],[414,6],[590,7]]},"583":{"position":[[12,6]]},"585":{"position":[[32,6],[56,6],[116,8],[170,6],[299,6],[1179,6],[1302,7]]},"592":{"position":[[57,6]]},"596":{"position":[[612,6],[737,6],[891,6]]},"600":{"position":[[951,6]]},"613":{"position":[[1758,7],[1804,7],[1855,7]]},"632":{"position":[[2740,7]]},"644":{"position":[[288,6],[829,6],[1852,9],[3250,6],[4341,6],[4392,6],[4441,6]]},"651":{"position":[[331,7],[484,6]]},"653":{"position":[[417,6],[1349,7],[4613,7]]},"656":{"position":[[42,7],[647,6],[671,6],[732,8],[1139,6]]},"663":{"position":[[2,6]]},"664":{"position":[[4,6]]},"666":{"position":[[983,7],[1153,7]]},"669":{"position":[[11,8]]},"671":{"position":[[16,6],[81,6]]},"672":{"position":[[15,6],[83,8],[413,8]]},"673":{"position":[[1654,7]]},"674":{"position":[[244,8]]},"676":{"position":[[2,6]]},"677":{"position":[[80,6]]},"678":{"position":[[482,6],[631,7]]},"679":{"position":[[577,7],[701,6]]},"680":{"position":[[1407,7]]},"681":{"position":[[2014,6],[2508,6],[2579,6]]},"682":{"position":[[12,6]]},"687":{"position":[[3803,6],[3826,6],[3868,7],[4047,6]]},"688":{"position":[[1690,6]]},"689":{"position":[[154,8]]},"691":{"position":[[62,7]]},"693":{"position":[[4,6]]},"694":{"position":[[400,6]]},"695":{"position":[[47,6]]},"696":{"position":[[26,6],[176,7]]},"704":{"position":[[612,6],[737,6],[891,6]]},"708":{"position":[[951,6]]},"721":{"position":[[1758,7],[1804,7],[1855,7]]}},"keywords":{}}],["modular",{"_index":1521,"title":{},"content":{"84":{"position":[[24,10]]},"115":{"position":[[3315,7]]},"248":{"position":[[32,11]]},"253":{"position":[[24,10]]},"258":{"position":[[3241,7]]},"447":{"position":[[32,11]]},"481":{"position":[[3241,7]]},"484":{"position":[[24,10]]},"612":{"position":[[2084,7]]},"674":{"position":[[32,11]]},"720":{"position":[[2084,7]]}},"keywords":{}}],["module.a",{"_index":2166,"title":{},"content":{"182":{"position":[[118,8]]},"373":{"position":[[118,8]]},"589":{"position":[[118,8]]}},"keywords":{}}],["module.l49",{"_index":2258,"title":{},"content":{"185":{"position":[[2972,10]]},"247":{"position":[[1774,10]]},"376":{"position":[[2956,10]]},"446":{"position":[[1774,10]]},"592":{"position":[[2956,10]]},"673":{"position":[[1774,10]]}},"keywords":{}}],["module.l57",{"_index":2775,"title":{},"content":{"247":{"position":[[1825,10]]},"446":{"position":[[1825,10]]},"673":{"position":[[1825,10]]}},"keywords":{}}],["module.odra::types::address",{"_index":2818,"title":{},"content":{"267":{"position":[[367,27]]},"407":{"position":[[367,27]]},"644":{"position":[[367,27]]}},"keywords":{}}],["module::modul",{"_index":3622,"title":{},"content":{"598":{"position":[[89,15]]},"706":{"position":[[89,15]]}},"keywords":{}}],["module::submodul",{"_index":1739,"title":{},"content":{"115":{"position":[[1961,18]]},"258":{"position":[[149,18],[1907,18]]},"481":{"position":[[149,18],[1907,18]]}},"keywords":{}}],["module::{modul",{"_index":1714,"title":{},"content":{"115":{"position":[[149,16]]}},"keywords":{}}],["modulename}}contractref",{"_index":1930,"title":{},"content":{"141":{"position":[[225,25]]},"267":{"position":[[3668,25]]},"326":{"position":[[225,25]]},"407":{"position":[[3668,25]]},"535":{"position":[[225,25]]},"644":{"position":[[3668,25]]}},"keywords":{}}],["modulename}}contractref::address",{"_index":1935,"title":{},"content":{"141":{"position":[[607,36]]},"326":{"position":[[607,36]]},"535":{"position":[[607,36]]}},"keywords":{}}],["modulename}}contractref::new(env",{"_index":1931,"title":{},"content":{"141":{"position":[[393,35]]},"267":{"position":[[3747,35]]},"326":{"position":[[393,35]]},"407":{"position":[[3747,35]]},"535":{"position":[[393,35]]},"644":{"position":[[3747,35]]}},"keywords":{}}],["modulename}}deployer::init",{"_index":2899,"title":{},"content":{"268":{"position":[[373,31]]},"408":{"position":[[373,31]]},"645":{"position":[[373,31]]}},"keywords":{}}],["modulename}}hostref",{"_index":1916,"title":{},"content":{"138":{"position":[[799,21]]},"141":{"position":[[198,22]]},"268":{"position":[[409,21],[2002,22]]},"318":{"position":[[791,21]]},"326":{"position":[[198,22]]},"408":{"position":[[409,21],[2002,22]]},"535":{"position":[[198,22]]},"544":{"position":[[791,21]]},"645":{"position":[[409,21],[2002,22]]}},"keywords":{}}],["modulename}}hostref::deploy(&env",{"_index":2898,"title":{},"content":{"268":{"position":[[316,39]]},"408":{"position":[[316,39]]},"645":{"position":[[316,39]]}},"keywords":{}}],["modulename}}initarg",{"_index":2903,"title":{},"content":{"268":{"position":[[752,22]]},"408":{"position":[[752,22]]},"645":{"position":[[752,22]]}},"keywords":{}}],["modulename}}ref",{"_index":2884,"title":{},"content":{"267":{"position":[[3702,18]]},"407":{"position":[[3702,18]]},"644":{"position":[[3702,18]]}},"keywords":{}}],["modulename}}ref::at",{"_index":2885,"title":{},"content":{"267":{"position":[[3800,25]]},"407":{"position":[[3800,25]]},"644":{"position":[[3800,25]]}},"keywords":{}}],["modules_contract",{"_index":2015,"title":{},"content":{"151":{"position":[[257,16]]},"342":{"position":[[257,16]]},"556":{"position":[[257,16]]}},"keywords":{}}],["modulescontracthostref::deploy(&test_env",{"_index":2016,"title":{},"content":{"151":{"position":[[276,45]]},"342":{"position":[[276,45]]},"556":{"position":[[276,45]]}},"keywords":{}}],["money",{"_index":1348,"title":{},"content":{"70":{"position":[[58,5],[251,5]]},"234":{"position":[[58,5],[251,5]]},"470":{"position":[[58,5],[251,5]]}},"keywords":{}}],["month",{"_index":153,"title":{},"content":{"3":{"position":[[501,6]]}},"keywords":{}}],["more",{"_index":382,"title":{},"content":{"12":{"position":[[127,4]]},"15":{"position":[[66,4],[75,4]]},"16":{"position":[[230,4]]},"20":{"position":[[0,4]]},"24":{"position":[[41,4]]},"33":{"position":[[150,4],[191,4]]},"38":{"position":[[811,4]]},"39":{"position":[[1001,5],[1028,4]]},"43":{"position":[[2,4]]},"52":{"position":[[148,4]]},"74":{"position":[[22,4]]},"79":{"position":[[286,4]]},"81":{"position":[[369,4]]},"84":{"position":[[522,4]]},"99":{"position":[[680,4]]},"100":{"position":[[1015,4]]},"101":{"position":[[716,4]]},"110":{"position":[[211,4]]},"111":{"position":[[303,4]]},"112":{"position":[[51,4]]},"115":{"position":[[1743,4],[3295,4]]},"118":{"position":[[277,4]]},"126":{"position":[[203,4],[2995,4]]},"132":{"position":[[309,4]]},"136":{"position":[[214,4]]},"146":{"position":[[810,4]]},"157":{"position":[[793,4]]},"199":{"position":[[202,4]]},"202":{"position":[[35,4]]},"211":{"position":[[794,4]]},"230":{"position":[[303,4]]},"232":{"position":[[369,4]]},"238":{"position":[[22,4]]},"253":{"position":[[522,4]]},"258":{"position":[[1689,4],[3221,4]]},"270":{"position":[[230,4]]},"277":{"position":[[203,4],[3163,4]]},"291":{"position":[[680,4]]},"292":{"position":[[1015,4]]},"293":{"position":[[716,4]]},"299":{"position":[[277,4]]},"305":{"position":[[211,4]]},"306":{"position":[[303,4]]},"307":{"position":[[51,4]]},"312":{"position":[[309,4]]},"316":{"position":[[214,4]]},"330":{"position":[[769,4]]},"334":{"position":[[814,4]]},"365":{"position":[[148,4],[329,4]]},"385":{"position":[[230,4]]},"390":{"position":[[768,4]]},"397":{"position":[[26,4]]},"410":{"position":[[230,4]]},"413":{"position":[[74,4]]},"414":{"position":[[588,4]]},"422":{"position":[[35,4]]},"435":{"position":[[202,4]]},"461":{"position":[[303,4]]},"463":{"position":[[369,4]]},"474":{"position":[[22,4]]},"481":{"position":[[1689,4],[3221,4]]},"484":{"position":[[522,4]]},"503":{"position":[[680,4]]},"504":{"position":[[1015,4]]},"505":{"position":[[716,4]]},"510":{"position":[[211,4]]},"511":{"position":[[303,4]]},"512":{"position":[[51,4]]},"514":{"position":[[203,4],[2995,4]]},"520":{"position":[[277,4]]},"529":{"position":[[309,4]]},"533":{"position":[[214,4]]},"547":{"position":[[793,4]]},"551":{"position":[[814,4]]},"581":{"position":[[148,4],[329,4]]},"596":{"position":[[501,4]]},"602":{"position":[[1172,4],[2056,4]]},"610":{"position":[[929,4]]},"612":{"position":[[1453,4],[2066,4]]},"617":{"position":[[855,4]]},"618":{"position":[[349,4],[432,4]]},"627":{"position":[[230,4]]},"634":{"position":[[26,4]]},"647":{"position":[[230,4]]},"650":{"position":[[74,4]]},"651":{"position":[[588,4]]},"660":{"position":[[768,4]]},"664":{"position":[[35,4]]},"682":{"position":[[202,4]]},"704":{"position":[[501,4]]},"710":{"position":[[1172,4],[2056,4]]},"718":{"position":[[929,4]]},"720":{"position":[[1453,4],[2066,4]]},"725":{"position":[[855,4]]},"726":{"position":[[349,4],[432,4]]}},"keywords":{}}],["moreov",{"_index":3227,"title":{},"content":{"416":{"position":[[992,9]]},"653":{"position":[[992,9]]}},"keywords":{}}],["morph",{"_index":1269,"title":{},"content":{"52":{"position":[[1869,5]]}},"keywords":{}}],["mote",{"_index":1594,"title":{},"content":{"92":{"position":[[454,5]]},"95":{"position":[[336,5]]},"284":{"position":[[454,5]]},"287":{"position":[[336,5]]},"496":{"position":[[454,5]]},"499":{"position":[[336,5]]}},"keywords":{}}],["motto",{"_index":33,"title":{},"content":{"1":{"position":[[356,5]]}},"keywords":{}}],["move",{"_index":380,"title":{},"content":{"12":{"position":[[67,6]]},"52":{"position":[[406,4]]},"65":{"position":[[674,4]]},"195":{"position":[[236,4]]},"221":{"position":[[11,4]]},"240":{"position":[[674,4]]},"262":{"position":[[11,4]]},"380":{"position":[[11,4]]},"395":{"position":[[6768,4]]},"402":{"position":[[11,4]]},"431":{"position":[[236,4]]},"454":{"position":[[11,4]]},"465":{"position":[[674,4]]},"622":{"position":[[11,4]]},"632":{"position":[[6768,4]]},"639":{"position":[[11,4]]},"678":{"position":[[236,4]]},"694":{"position":[[11,4]]}},"keywords":{}}],["ms",{"_index":3184,"title":{},"content":{"395":{"position":[[6169,2]]},"632":{"position":[[6169,2]]}},"keywords":{}}],["msg",{"_index":492,"title":{},"content":{"17":{"position":[[1126,4],[1382,4]]}},"keywords":{}}],["msg.sender",{"_index":1056,"title":{},"content":{"42":{"position":[[1073,11]]}},"keywords":{}}],["much",{"_index":624,"title":{},"content":{"21":{"position":[[150,4]]},"22":{"position":[[170,4]]},"38":{"position":[[158,4]]},"52":{"position":[[543,4]]},"397":{"position":[[21,4]]},"634":{"position":[[21,4]]}},"keywords":{}}],["multipl",{"_index":890,"title":{"129":{"position":[[0,8]]},"280":{"position":[[0,8]]},"517":{"position":[[0,8]]}},"content":{"38":{"position":[[997,8]]},"39":{"position":[[1064,8],[1299,8]]},"71":{"position":[[250,8]]},"72":{"position":[[89,8]]},"74":{"position":[[111,8]]},"126":{"position":[[174,8]]},"129":{"position":[[23,8],[121,8],[140,8],[163,8]]},"235":{"position":[[250,8]]},"236":{"position":[[89,8]]},"238":{"position":[[111,8]]},"268":{"position":[[2849,8]]},"277":{"position":[[174,8]]},"280":{"position":[[23,8],[121,8],[140,8],[163,8]]},"408":{"position":[[2849,8]]},"471":{"position":[[250,8]]},"472":{"position":[[89,8]]},"474":{"position":[[111,8]]},"476":{"position":[[843,8]]},"514":{"position":[[174,8]]},"517":{"position":[[23,8],[121,8],[140,8],[163,8]]},"610":{"position":[[594,8]]},"612":{"position":[[1385,8],[1605,8],[1695,8]]},"613":{"position":[[1935,8]]},"645":{"position":[[2849,8]]},"698":{"position":[[843,8]]},"718":{"position":[[594,8]]},"720":{"position":[[1385,8],[1605,8],[1695,8]]},"721":{"position":[[1935,8]]}},"keywords":{}}],["multipli",{"_index":265,"title":{},"content":{"9":{"position":[[214,10]]}},"keywords":{}}],["multiply!exampl",{"_index":225,"title":{},"content":{"7":{"position":[[131,17]]}},"keywords":{}}],["multiply_id",{"_index":275,"title":{},"content":{"9":{"position":[[404,12]]}},"keywords":{}}],["multiply_src",{"_index":267,"title":{},"content":{"9":{"position":[[237,12]]}},"keywords":{}}],["mut",{"_index":273,"title":{},"content":{"9":{"position":[[360,3]]},"31":{"position":[[1365,3],[2190,3]]},"32":{"position":[[1230,3]]},"42":{"position":[[2180,3]]},"51":{"position":[[1491,3]]},"73":{"position":[[608,3]]},"80":{"position":[[807,3]]},"126":{"position":[[2424,3],[2906,3]]},"138":{"position":[[567,3]]},"148":{"position":[[308,3]]},"160":{"position":[[338,3]]},"178":{"position":[[1314,3],[1506,3]]},"198":{"position":[[594,4],[933,4]]},"206":{"position":[[1141,3],[1779,3],[2099,3],[3385,3]]},"212":{"position":[[1964,3],[2019,3],[3861,3],[4088,3],[4116,3]]},"223":{"position":[[952,3]]},"231":{"position":[[807,3]]},"237":{"position":[[608,3]]},"268":{"position":[[2400,3]]},"269":{"position":[[5051,3],[5689,3]]},"277":{"position":[[2592,3],[3074,3]]},"318":{"position":[[559,3]]},"336":{"position":[[308,3]]},"345":{"position":[[338,3]]},"369":{"position":[[1314,3],[1506,3]]},"391":{"position":[[1964,3],[2019,3],[3879,3],[4106,3],[4134,3]]},"395":{"position":[[929,3]]},"408":{"position":[[2400,3]]},"409":{"position":[[5051,3],[5689,3]]},"416":{"position":[[3937,3],[3971,3]]},"417":{"position":[[350,3]]},"419":{"position":[[5516,3],[5550,3],[6765,3]]},"426":{"position":[[1136,3],[1769,3],[2089,3],[3360,3]]},"434":{"position":[[589,4],[923,4]]},"440":{"position":[[2577,3],[5147,3]]},"441":{"position":[[1323,3],[5036,3]]},"456":{"position":[[952,3]]},"462":{"position":[[807,3]]},"473":{"position":[[608,3]]},"477":{"position":[[1834,3]]},"514":{"position":[[2424,3],[2906,3]]},"544":{"position":[[559,3]]},"553":{"position":[[308,3]]},"562":{"position":[[338,3]]},"585":{"position":[[1314,3],[1506,3]]},"601":{"position":[[1552,3],[1663,3],[1793,3]]},"613":{"position":[[157,3],[193,3],[682,3],[987,3]]},"616":{"position":[[295,3]]},"632":{"position":[[929,3]]},"645":{"position":[[2400,3]]},"646":{"position":[[5051,3],[5689,3]]},"653":{"position":[[3937,3],[3971,3]]},"654":{"position":[[350,3]]},"656":{"position":[[5516,3],[5550,3],[6765,3]]},"661":{"position":[[1964,3],[2019,3],[3879,3],[4106,3],[4134,3]]},"668":{"position":[[1141,3],[1779,3],[2099,3],[3385,3]]},"681":{"position":[[594,4],[933,4]]},"687":{"position":[[2577,3],[5147,3]]},"688":{"position":[[1323,3],[5036,3]]},"696":{"position":[[952,3]]},"699":{"position":[[1834,3]]},"709":{"position":[[1552,3],[1663,3],[1793,3]]},"721":{"position":[[157,3],[193,3],[682,3],[987,3]]},"724":{"position":[[295,3]]}},"keywords":{}}],["mutabl",{"_index":1831,"title":{},"content":{"126":{"position":[[2960,7],[3087,8]]},"128":{"position":[[486,7]]},"277":{"position":[[3128,7],[3255,8]]},"279":{"position":[[486,7]]},"324":{"position":[[1083,8]]},"514":{"position":[[2960,7],[3087,8]]},"516":{"position":[[486,7]]},"542":{"position":[[1083,8]]}},"keywords":{}}],["mv",{"_index":1337,"title":{},"content":{"65":{"position":[[689,2]]},"68":{"position":[[319,2]]},"240":{"position":[[689,2]]},"243":{"position":[[319,2]]},"465":{"position":[[689,2]]},"468":{"position":[[319,2]]}},"keywords":{}}],["my_address",{"_index":3670,"title":{},"content":{"599":{"position":[[207,11]]},"707":{"position":[[207,11]]}},"keywords":{}}],["my_contract",{"_index":1332,"title":{},"content":{"65":{"position":[[351,11]]},"68":{"position":[[31,11]]},"160":{"position":[[342,11]]},"240":{"position":[[351,11]]},"243":{"position":[[31,11]]},"345":{"position":[[342,11]]},"465":{"position":[[351,11]]},"468":{"position":[[31,11]]},"562":{"position":[[342,11]]}},"keywords":{}}],["my_contract.with_tokens(u512::from(100)).deposit",{"_index":2041,"title":{},"content":{"160":{"position":[[478,51]]},"345":{"position":[[478,51]]},"562":{"position":[[478,51]]}},"keywords":{}}],["my_contract.withdraw(u512::from(25",{"_index":2043,"title":{},"content":{"160":{"position":[[603,37]]},"345":{"position":[[603,37]]},"562":{"position":[[603,37]]}},"keywords":{}}],["my_map",{"_index":3684,"title":{},"content":{"601":{"position":[[108,7],[668,7]]},"709":{"position":[[108,7],[668,7]]}},"keywords":{}}],["my_nft",{"_index":1673,"title":{},"content":{"100":{"position":[[1117,6]]},"292":{"position":[[1117,6]]},"504":{"position":[[1117,6]]}},"keywords":{}}],["my_project",{"_index":1331,"title":{},"content":{"65":{"position":[[311,11]]},"68":{"position":[[145,10]]},"117":{"position":[[207,10],[237,11]]},"175":{"position":[[88,10],[137,10]]},"240":{"position":[[311,11]]},"243":{"position":[[145,10]]},"298":{"position":[[207,10],[237,11]]},"361":{"position":[[88,10],[137,10]]},"465":{"position":[[311,11]]},"468":{"position":[[145,10]]},"519":{"position":[[207,10],[237,11]]},"577":{"position":[[88,10],[137,10]]}},"keywords":{}}],["my_project_build_contract",{"_index":1327,"title":{},"content":{"65":{"position":[[155,25]]},"68":{"position":[[293,25]]},"240":{"position":[[155,25]]},"243":{"position":[[293,25]]},"465":{"position":[[155,25]]},"468":{"position":[[293,25]]}},"keywords":{}}],["my_project_build_contract.wasm",{"_index":1335,"title":{},"content":{"65":{"position":[[509,31]]},"240":{"position":[[509,31]]},"465":{"position":[[509,31]]}},"keywords":{}}],["my_uint",{"_index":3668,"title":{},"content":{"599":{"position":[[159,8]]},"600":{"position":[[126,8]]},"707":{"position":[[159,8]]},"708":{"position":[[126,8]]}},"keywords":{}}],["mycontract",{"_index":2969,"title":{},"content":{"321":{"position":[[940,10],[1028,10]]},"539":{"position":[[940,10],[1028,10]]}},"keywords":{}}],["myerror",{"_index":2968,"title":{},"content":{"321":{"position":[[917,8],[1871,8]]},"539":{"position":[[917,8],[1871,8]]}},"keywords":{}}],["mynctl",{"_index":2572,"title":{},"content":{"210":{"position":[[120,6]]},"389":{"position":[[120,6]]},"477":{"position":[[129,6],[363,6]]},"659":{"position":[[120,6]]},"699":{"position":[[129,6],[363,6]]}},"keywords":{}}],["mytoken",{"_index":3208,"title":{},"content":{"414":{"position":[[224,7],[272,7]]},"651":{"position":[[224,7],[272,7]]}},"keywords":{}}],["n",{"_index":697,"title":{},"content":{"30":{"position":[[299,2],[332,2],[353,2]]},"42":{"position":[[217,1]]},"73":{"position":[[183,2],[196,1]]},"85":{"position":[[40,1],[97,1]]},"117":{"position":[[985,1],[1057,1],[1166,1]]},"168":{"position":[[1887,2],[1924,1]]},"237":{"position":[[183,2],[196,1]]},"254":{"position":[[40,1],[97,1]]},"298":{"position":[[985,1],[1057,1],[1166,1]]},"348":{"position":[[1887,2],[1924,1]]},"473":{"position":[[183,2],[196,1]]},"485":{"position":[[40,1],[97,1]]},"519":{"position":[[985,1],[1057,1],[1166,1]]},"564":{"position":[[1887,2],[1924,1]]}},"keywords":{}}],["n1",{"_index":1946,"title":{},"content":{"141":{"position":[[1275,3]]},"326":{"position":[[1275,3]]},"535":{"position":[[1275,3]]}},"keywords":{}}],["n2",{"_index":1947,"title":{},"content":{"141":{"position":[[1284,3]]},"326":{"position":[[1284,3]]},"535":{"position":[[1284,3]]}},"keywords":{}}],["name",{"_index":512,"title":{},"content":{"17":{"position":[[1974,5],[2263,5]]},"39":{"position":[[754,5],[1914,5]]},"43":{"position":[[978,4]]},"52":{"position":[[948,5],[970,8],[2271,4],[3284,5],[4905,5]]},"65":{"position":[[305,5],[504,4],[628,5]]},"76":{"position":[[547,4]]},"83":{"position":[[64,5],[142,5]]},"84":{"position":[[233,5],[341,4]]},"85":{"position":[[513,5],[614,5]]},"96":{"position":[[0,4]]},"99":{"position":[[276,4]]},"100":{"position":[[370,4],[1146,5]]},"101":{"position":[[224,4]]},"103":{"position":[[240,4]]},"115":{"position":[[360,5],[2203,5]]},"117":{"position":[[109,6],[118,4],[156,4],[229,4],[374,4],[653,4],[1313,4]]},"119":{"position":[[298,4],[1018,5]]},"121":{"position":[[48,5]]},"126":{"position":[[117,4],[790,4],[1887,4],[2356,5],[3036,5],[3522,4]]},"131":{"position":[[54,4],[232,4],[335,4]]},"132":{"position":[[245,5]]},"136":{"position":[[227,6]]},"138":{"position":[[516,5],[939,5]]},"147":{"position":[[752,5]]},"154":{"position":[[145,4]]},"162":{"position":[[420,5],[817,5]]},"163":{"position":[[403,5],[519,4]]},"164":{"position":[[196,5],[579,5]]},"165":{"position":[[250,5]]},"168":{"position":[[637,5],[895,5]]},"175":{"position":[[58,4]]},"178":{"position":[[479,5]]},"198":{"position":[[1515,7]]},"202":{"position":[[162,5]]},"203":{"position":[[204,5],[456,4]]},"204":{"position":[[90,5]]},"206":{"position":[[126,5],[430,5]]},"209":{"position":[[594,5],[984,5],[1073,5],[1281,5]]},"210":{"position":[[115,4],[426,4],[1200,4]]},"212":{"position":[[493,5],[1613,4],[1652,6],[2492,5],[2876,5],[2952,4],[4512,5]]},"227":{"position":[[547,4]]},"240":{"position":[[305,5],[504,4],[628,5]]},"247":{"position":[[125,5]]},"252":{"position":[[64,5],[142,5]]},"253":{"position":[[233,5],[341,4]]},"254":{"position":[[513,5],[614,5]]},"258":{"position":[[350,5],[2149,5]]},"264":{"position":[[509,6],[525,4]]},"265":{"position":[[452,4],[634,4],[741,4]]},"266":{"position":[[78,4]]},"267":{"position":[[3662,5],[4135,5]]},"268":{"position":[[1242,5]]},"269":{"position":[[372,5],[595,5],[4030,5],[4334,5]]},"277":{"position":[[117,4],[790,4],[2055,4],[2524,5],[3204,5],[3690,4]]},"288":{"position":[[0,4]]},"291":{"position":[[276,4]]},"292":{"position":[[370,4],[1146,5]]},"293":{"position":[[224,4]]},"295":{"position":[[240,4]]},"298":{"position":[[109,6],[118,4],[156,4],[229,4],[374,4],[653,4],[1313,4]]},"300":{"position":[[298,4],[1018,5]]},"302":{"position":[[48,5]]},"311":{"position":[[54,4],[284,4],[387,4]]},"312":{"position":[[245,5]]},"316":{"position":[[227,6]]},"318":{"position":[[508,5],[931,5]]},"321":{"position":[[132,7],[524,4],[568,4],[573,4],[953,5],[1080,4],[1141,5],[1265,4],[1292,4],[1361,5],[1438,4],[1533,5],[1737,5],[1929,4],[2072,5],[2208,5]]},"323":{"position":[[1454,4],[1757,4],[2741,4],[2910,4],[3120,4],[3320,4]]},"324":{"position":[[248,4],[296,5],[614,5],[792,5],[986,5],[1284,4],[1473,4]]},"335":{"position":[[760,5]]},"339":{"position":[[145,4]]},"348":{"position":[[637,5],[895,5]]},"351":{"position":[[457,5],[839,5]]},"352":{"position":[[425,5],[541,4]]},"353":{"position":[[231,5],[614,5]]},"354":{"position":[[288,5],[381,5]]},"361":{"position":[[58,4]]},"369":{"position":[[479,5]]},"382":{"position":[[322,6],[338,4]]},"383":{"position":[[374,5]]},"384":{"position":[[385,5],[608,5]]},"388":{"position":[[555,5],[916,5],[1005,5],[1213,5]]},"389":{"position":[[115,4],[426,4],[1137,4]]},"391":{"position":[[493,5],[1613,4],[1652,6],[2492,5],[2882,5],[2964,4],[4530,5]]},"395":{"position":[[1837,4],[2016,5],[2558,4],[3189,4],[3293,4],[3393,4],[3978,4]]},"396":{"position":[[605,5],[703,4]]},"404":{"position":[[509,6],[525,4]]},"405":{"position":[[452,4],[634,4],[741,4]]},"406":{"position":[[78,4]]},"407":{"position":[[3662,5],[4135,5]]},"408":{"position":[[1242,5]]},"409":{"position":[[372,5],[595,5],[4030,5],[4334,5]]},"414":{"position":[[57,4],[121,4],[566,4],[745,4],[801,4]]},"417":{"position":[[216,5]]},"419":{"position":[[1390,5],[1571,5],[2330,4],[6631,5]]},"422":{"position":[[162,5]]},"423":{"position":[[204,5],[456,4]]},"424":{"position":[[65,5]]},"426":{"position":[[126,5],[430,5]]},"434":{"position":[[1505,7]]},"439":{"position":[[153,4]]},"446":{"position":[[125,5]]},"458":{"position":[[547,4]]},"465":{"position":[[305,5],[504,4],[628,5]]},"477":{"position":[[124,4],[734,4],[1123,4]]},"481":{"position":[[350,5],[2149,5]]},"483":{"position":[[64,5],[142,5]]},"484":{"position":[[233,5],[341,4]]},"485":{"position":[[513,5],[614,5]]},"500":{"position":[[0,4]]},"503":{"position":[[276,4]]},"504":{"position":[[370,4],[1146,5]]},"505":{"position":[[224,4]]},"507":{"position":[[240,4]]},"514":{"position":[[117,4],[790,4],[1887,4],[2356,5],[3036,5],[3522,4]]},"519":{"position":[[109,6],[118,4],[156,4],[229,4],[374,4],[653,4],[1313,4]]},"521":{"position":[[298,4],[1018,5]]},"523":{"position":[[48,5]]},"528":{"position":[[54,4],[284,4],[387,4]]},"529":{"position":[[245,5]]},"533":{"position":[[227,6]]},"539":{"position":[[132,7],[524,4],[568,4],[573,4],[953,5],[1080,4],[1141,5],[1265,4],[1292,4],[1361,5],[1438,4],[1533,5],[1737,5],[1929,4],[2072,5],[2208,5]]},"541":{"position":[[1454,4],[1757,4],[2741,4],[2910,4],[3120,4],[3320,4]]},"542":{"position":[[248,4],[296,5],[614,5],[792,5],[986,5],[1284,4],[1473,4]]},"544":{"position":[[508,5],[931,5]]},"552":{"position":[[760,5]]},"559":{"position":[[145,4]]},"564":{"position":[[637,5],[895,5]]},"567":{"position":[[457,5],[839,5]]},"568":{"position":[[425,5],[541,4]]},"569":{"position":[[231,5],[614,5]]},"570":{"position":[[288,5],[381,5]]},"577":{"position":[[58,4]]},"585":{"position":[[479,5]]},"598":{"position":[[2026,5]]},"624":{"position":[[322,6],[338,4]]},"625":{"position":[[374,5]]},"626":{"position":[[385,5],[608,5]]},"632":{"position":[[1837,4],[2016,5],[2558,4],[3189,4],[3293,4],[3393,4],[3978,4]]},"633":{"position":[[605,5],[703,4]]},"641":{"position":[[509,6],[525,4]]},"642":{"position":[[452,4],[634,4],[741,4]]},"643":{"position":[[78,4]]},"644":{"position":[[3662,5],[4135,5]]},"645":{"position":[[1242,5]]},"646":{"position":[[372,5],[595,5],[4030,5],[4334,5]]},"651":{"position":[[57,4],[121,4],[566,4],[745,4],[801,4]]},"654":{"position":[[216,5]]},"656":{"position":[[1390,5],[1571,5],[2330,4],[6631,5]]},"658":{"position":[[555,5],[916,5],[1005,5],[1213,5]]},"659":{"position":[[115,4],[426,4],[1137,4]]},"661":{"position":[[493,5],[1613,4],[1652,6],[2492,5],[2882,5],[2964,4],[4530,5]]},"664":{"position":[[162,5]]},"665":{"position":[[204,5],[456,4]]},"666":{"position":[[65,5]]},"668":{"position":[[126,5],[430,5]]},"673":{"position":[[125,5]]},"681":{"position":[[1515,7]]},"686":{"position":[[153,4]]},"699":{"position":[[124,4],[734,4],[1123,4]]},"706":{"position":[[2026,5]]}},"keywords":{}}],["name'"",{"_index":2586,"title":{},"content":{"210":{"position":[[878,11]]},"389":{"position":[[815,11]]},"659":{"position":[[815,11]]}},"keywords":{}}],["name(&self",{"_index":1723,"title":{},"content":{"115":{"position":[[803,15]]},"162":{"position":[[1091,15]]},"164":{"position":[[625,15]]},"204":{"position":[[321,15]]},"247":{"position":[[324,15]]},"258":{"position":[[777,15]]},"269":{"position":[[1680,15]]},"351":{"position":[[1113,15]]},"353":{"position":[[660,15]]},"384":{"position":[[1693,15]]},"409":{"position":[[1680,15]]},"414":{"position":[[374,15]]},"419":{"position":[[2352,15]]},"424":{"position":[[296,15]]},"446":{"position":[[324,15]]},"481":{"position":[[777,15]]},"567":{"position":[[1113,15]]},"569":{"position":[[660,15]]},"626":{"position":[[1693,15]]},"646":{"position":[[1680,15]]},"651":{"position":[[374,15]]},"656":{"position":[[2352,15]]},"666":{"position":[[296,15]]},"673":{"position":[[324,15]]}},"keywords":{}}],["name."",{"_index":3035,"title":{},"content":{"323":{"position":[[2940,12]]},"541":{"position":[[2940,12]]}},"keywords":{}}],["name.to_bytes().unwrap",{"_index":2656,"title":{},"content":{"212":{"position":[[2985,25]]},"391":{"position":[[2997,25]]},"661":{"position":[[2997,25]]}},"keywords":{}}],["name.to_str",{"_index":2499,"title":{},"content":{"206":{"position":[[436,17],[745,18]]},"268":{"position":[[1248,17]]},"269":{"position":[[4340,17],[4655,18]]},"408":{"position":[[1248,17]]},"409":{"position":[[4340,17],[4655,18]]},"426":{"position":[[436,17],[745,18]]},"645":{"position":[[1248,17]]},"646":{"position":[[4340,17],[4655,18]]},"668":{"position":[[436,17],[745,18]]}},"keywords":{}}],["name2",{"_index":2561,"title":{},"content":{"209":{"position":[[1295,6]]},"388":{"position":[[1227,6]]},"658":{"position":[[1227,6]]}},"keywords":{}}],["name_",{"_index":1115,"title":{},"content":{"43":{"position":[[246,6]]}},"keywords":{}}],["named_valu",{"_index":2567,"title":{},"content":{"209":{"position":[[1656,13]]},"211":{"position":[[458,13]]},"388":{"position":[[1588,13]]},"390":{"position":[[432,13]]},"658":{"position":[[1588,13]]},"660":{"position":[[432,13]]}},"keywords":{}}],["named_value(nam",{"_index":2654,"title":{},"content":{"212":{"position":[[2817,17]]},"391":{"position":[[2823,17]]},"661":{"position":[[2823,17]]}},"keywords":{}}],["namenotset",{"_index":2837,"title":{},"content":{"267":{"position":[[1393,10]]},"269":{"position":[[3756,10]]},"383":{"position":[[839,10]]},"384":{"position":[[3720,10]]},"407":{"position":[[1393,10]]},"409":{"position":[[3756,10]]},"625":{"position":[[839,10]]},"626":{"position":[[3720,10]]},"644":{"position":[[1393,10]]},"646":{"position":[[3756,10]]}},"keywords":{}}],["namespac",{"_index":1476,"title":{},"content":{"79":{"position":[[1566,9]]},"230":{"position":[[1583,9]]},"461":{"position":[[1583,9]]}},"keywords":{}}],["nativ",{"_index":1157,"title":{"159":{"position":[[0,6]]},"344":{"position":[[0,6]]},"561":{"position":[[0,6]]}},"content":{"43":{"position":[[1832,6]]},"70":{"position":[[272,6]]},"90":{"position":[[97,6]]},"102":{"position":[[46,6]]},"107":{"position":[[511,6]]},"152":{"position":[[26,6]]},"188":{"position":[[725,6],[800,6]]},"203":{"position":[[487,6]]},"234":{"position":[[272,6]]},"274":{"position":[[511,6]]},"282":{"position":[[97,6]]},"294":{"position":[[46,6]]},"343":{"position":[[26,6]]},"365":{"position":[[1082,6],[1157,6]]},"423":{"position":[[487,6]]},"470":{"position":[[272,6]]},"491":{"position":[[511,6]]},"494":{"position":[[97,6]]},"506":{"position":[[46,6]]},"557":{"position":[[26,6]]},"581":{"position":[[1082,6],[1157,6]]},"610":{"position":[[888,9]]},"665":{"position":[[487,6]]},"718":{"position":[[888,9]]}},"keywords":{}}],["native_token_metadata",{"_index":2876,"title":{},"content":{"267":{"position":[[3160,23]]},"407":{"position":[[3160,23]]},"644":{"position":[[3160,23]]}},"keywords":{}}],["natur",{"_index":1044,"title":{},"content":{"42":{"position":[[824,10]]}},"keywords":{}}],["navig",{"_index":1658,"title":{},"content":{"100":{"position":[[85,8]]},"292":{"position":[[85,8]]},"504":{"position":[[85,8]]}},"keywords":{}}],["nctl",{"_index":2568,"title":{},"content":{"210":{"position":[[51,4],[195,4]]},"389":{"position":[[51,4],[195,4]]},"477":{"position":[[83,4],[204,4]]},"659":{"position":[[51,4],[195,4]]},"699":{"position":[[83,4],[204,4]]}},"keywords":{}}],["near",{"_index":605,"title":{},"content":{"20":{"position":[[816,5]]},"21":{"position":[[258,4]]}},"keywords":{}}],["nearli",{"_index":1861,"title":{},"content":{"127":{"position":[[822,6]]},"278":{"position":[[822,6]]},"515":{"position":[[822,6]]}},"keywords":{}}],["neat",{"_index":670,"title":{},"content":{"22":{"position":[[1453,4]]},"119":{"position":[[535,5]]},"126":{"position":[[2984,5]]},"277":{"position":[[3152,5]]},"300":{"position":[[535,5]]},"514":{"position":[[2984,5]]},"521":{"position":[[535,5]]}},"keywords":{}}],["necessari",{"_index":2951,"title":{},"content":{"270":{"position":[[497,9]]},"383":{"position":[[162,9]]},"385":{"position":[[497,9]]},"410":{"position":[[497,9]]},"598":{"position":[[2150,9]]},"600":{"position":[[1055,9]]},"625":{"position":[[162,9]]},"627":{"position":[[497,9]]},"647":{"position":[[497,9]]},"706":{"position":[[2150,9]]},"708":{"position":[[1055,9]]}},"keywords":{}}],["need",{"_index":56,"title":{},"content":{"1":{"position":[[733,5]]},"3":{"position":[[514,7],[605,4]]},"17":{"position":[[75,5],[240,4]]},"30":{"position":[[419,5]]},"39":{"position":[[284,4]]},"50":{"position":[[323,4]]},"52":{"position":[[1790,5]]},"67":{"position":[[32,5],[126,5]]},"70":{"position":[[35,4]]},"76":{"position":[[882,4]]},"88":{"position":[[44,6]]},"99":{"position":[[68,4],[120,4]]},"100":{"position":[[137,5]]},"102":{"position":[[195,5]]},"103":{"position":[[33,4]]},"107":{"position":[[433,4]]},"110":{"position":[[57,5]]},"117":{"position":[[81,4]]},"126":{"position":[[27,4],[1375,4],[1622,4],[2093,4]]},"127":{"position":[[33,4]]},"128":{"position":[[656,5]]},"134":{"position":[[95,4]]},"138":{"position":[[1222,4]]},"146":{"position":[[376,4]]},"147":{"position":[[961,4]]},"148":{"position":[[183,4]]},"151":{"position":[[12,4]]},"162":{"position":[[1596,4],[2288,4]]},"163":{"position":[[90,4],[726,4]]},"164":{"position":[[1000,4]]},"173":{"position":[[32,4]]},"178":{"position":[[1189,4]]},"185":{"position":[[2461,4]]},"195":{"position":[[262,4]]},"197":{"position":[[1019,4]]},"198":{"position":[[2021,5]]},"203":{"position":[[384,4]]},"210":{"position":[[10,4],[210,4]]},"211":{"position":[[38,4]]},"227":{"position":[[882,4]]},"234":{"position":[[35,4]]},"242":{"position":[[32,5],[127,5]]},"246":{"position":[[337,4]]},"247":{"position":[[1711,4],[1882,4]]},"248":{"position":[[264,4]]},"250":{"position":[[44,6]]},"267":{"position":[[36,4],[222,4]]},"268":{"position":[[49,4],[215,4]]},"274":{"position":[[433,4]]},"277":{"position":[[27,4],[1543,4],[1790,4],[2261,4]]},"278":{"position":[[33,4]]},"279":{"position":[[656,5]]},"291":{"position":[[68,4],[120,4]]},"292":{"position":[[137,5]]},"294":{"position":[[195,5]]},"295":{"position":[[33,4]]},"298":{"position":[[81,4]]},"305":{"position":[[57,5]]},"314":{"position":[[95,4]]},"318":{"position":[[1214,4]]},"321":{"position":[[28,4]]},"334":{"position":[[376,4]]},"335":{"position":[[969,4]]},"336":{"position":[[183,4]]},"342":{"position":[[12,4]]},"351":{"position":[[1618,4],[2310,4]]},"352":{"position":[[90,4],[748,4]]},"353":{"position":[[1035,4]]},"359":{"position":[[32,4]]},"369":{"position":[[1189,4]]},"376":{"position":[[2445,4]]},"389":{"position":[[10,4],[210,4]]},"390":{"position":[[38,4]]},"393":{"position":[[450,4]]},"394":{"position":[[42,4]]},"395":{"position":[[1381,4],[2173,4],[2430,4],[4058,4]]},"407":{"position":[[36,4],[222,4]]},"408":{"position":[[49,4],[215,4]]},"416":{"position":[[251,4],[1005,4],[1102,4],[1309,4],[2561,4],[4901,5]]},"423":{"position":[[384,4]]},"431":{"position":[[262,4]]},"433":{"position":[[1018,4]]},"434":{"position":[[2011,5]]},"440":{"position":[[4009,4]]},"441":{"position":[[52,4],[2136,4],[4452,4]]},"445":{"position":[[337,4]]},"446":{"position":[[1711,4],[1882,4]]},"447":{"position":[[264,4]]},"458":{"position":[[882,4]]},"467":{"position":[[32,5],[127,5]]},"470":{"position":[[35,4]]},"477":{"position":[[41,4]]},"488":{"position":[[44,6]]},"491":{"position":[[433,4]]},"503":{"position":[[68,4],[120,4]]},"504":{"position":[[137,5]]},"506":{"position":[[195,5]]},"507":{"position":[[33,4]]},"510":{"position":[[57,5]]},"514":{"position":[[27,4],[1375,4],[1622,4],[2093,4]]},"515":{"position":[[33,4]]},"516":{"position":[[656,5]]},"519":{"position":[[81,4]]},"531":{"position":[[95,4]]},"539":{"position":[[28,4]]},"544":{"position":[[1214,4]]},"551":{"position":[[376,4]]},"552":{"position":[[969,4]]},"553":{"position":[[183,4]]},"556":{"position":[[12,4]]},"567":{"position":[[1618,4],[2310,4]]},"568":{"position":[[90,4],[748,4]]},"569":{"position":[[1035,4]]},"575":{"position":[[32,4]]},"585":{"position":[[1189,4]]},"592":{"position":[[2445,4]]},"596":{"position":[[572,4],[1084,4]]},"605":{"position":[[270,4]]},"618":{"position":[[672,4]]},"630":{"position":[[450,4]]},"631":{"position":[[42,4]]},"632":{"position":[[1381,4],[2173,4],[2430,4],[4058,4]]},"644":{"position":[[36,4],[222,4]]},"645":{"position":[[49,4],[215,4]]},"653":{"position":[[251,4],[1005,4],[1102,4],[1309,4],[2561,4],[4901,5]]},"659":{"position":[[10,4],[210,4]]},"660":{"position":[[38,4]]},"665":{"position":[[384,4]]},"672":{"position":[[337,4]]},"673":{"position":[[1711,4],[1882,4]]},"674":{"position":[[264,4]]},"678":{"position":[[262,4]]},"680":{"position":[[1018,4]]},"681":{"position":[[2021,5]]},"687":{"position":[[4009,4]]},"688":{"position":[[52,4],[2136,4],[4452,4]]},"699":{"position":[[41,4]]},"704":{"position":[[572,4],[1084,4]]},"713":{"position":[[270,4]]},"726":{"position":[[672,4]]}},"keywords":{}}],["nest",{"_index":1477,"title":{},"content":{"79":{"position":[[1580,6]]},"185":{"position":[[2633,6]]},"203":{"position":[[534,6]]},"209":{"position":[[104,6]]},"230":{"position":[[1597,6]]},"267":{"position":[[859,6]]},"376":{"position":[[2617,6]]},"388":{"position":[[104,6]]},"407":{"position":[[859,6]]},"423":{"position":[[534,6]]},"461":{"position":[[1597,6]]},"592":{"position":[[2617,6]]},"644":{"position":[[859,6]]},"658":{"position":[[104,6]]},"665":{"position":[[534,6]]}},"keywords":{}}],["nestedmap",{"_index":3693,"title":{},"content":{"601":{"position":[[652,13],[750,13]]},"709":{"position":[[652,13],[750,13]]}},"keywords":{}}],["net",{"_index":2580,"title":{},"content":{"210":{"position":[[438,3],[1212,3]]},"212":{"position":[[367,3]]},"389":{"position":[[438,3],[1149,3]]},"391":{"position":[[367,3]]},"477":{"position":[[2494,3]]},"659":{"position":[[438,3],[1149,3]]},"661":{"position":[[367,3]]},"699":{"position":[[2494,3]]}},"keywords":{}}],["network",{"_index":596,"title":{"97":{"position":[[31,8]]},"289":{"position":[[31,8]]},"501":{"position":[[31,8]]}},"content":{"20":{"position":[[547,7],[877,7]]},"50":{"position":[[505,8]]},"52":{"position":[[113,7]]},"126":{"position":[[76,7],[802,8]]},"210":{"position":[[84,8]]},"277":{"position":[[76,7],[802,8]]},"389":{"position":[[84,8]]},"393":{"position":[[532,7]]},"395":{"position":[[3990,8],[6749,8]]},"396":{"position":[[50,7],[240,7]]},"397":{"position":[[173,8]]},"398":{"position":[[50,7]]},"417":{"position":[[1819,8]]},"418":{"position":[[62,8]]},"477":{"position":[[677,7]]},"514":{"position":[[76,7],[802,8]]},"594":{"position":[[254,8]]},"630":{"position":[[532,7]]},"632":{"position":[[3990,8],[6749,8]]},"633":{"position":[[50,7],[240,7]]},"634":{"position":[[173,8]]},"635":{"position":[[50,7]]},"654":{"position":[[1819,8]]},"655":{"position":[[62,8]]},"659":{"position":[[84,8]]},"699":{"position":[[677,7]]},"702":{"position":[[254,8]]}},"keywords":{}}],["never",{"_index":608,"title":{},"content":{"20":{"position":[[892,5]]},"178":{"position":[[903,5]]},"195":{"position":[[730,5]]},"369":{"position":[[903,5]]},"431":{"position":[[730,5]]},"585":{"position":[[903,5]]},"678":{"position":[[730,5]]}},"keywords":{}}],["new",{"_index":149,"title":{"154":{"position":[[9,3]]},"175":{"position":[[11,3]]},"339":{"position":[[9,3]]},"361":{"position":[[11,3]]},"559":{"position":[[9,3]]},"577":{"position":[[11,3]]}},"content":{"3":{"position":[[464,3],[558,3],[591,3]]},"10":{"position":[[1145,3]]},"26":{"position":[[74,3]]},"28":{"position":[[74,3]]},"31":{"position":[[1676,3]]},"36":{"position":[[74,3]]},"38":{"position":[[340,3]]},"42":{"position":[[212,3]]},"46":{"position":[[74,3]]},"48":{"position":[[74,3]]},"57":{"position":[[74,3]]},"59":{"position":[[74,3]]},"61":{"position":[[75,3]]},"63":{"position":[[75,3]]},"98":{"position":[[17,3]]},"102":{"position":[[124,3]]},"111":{"position":[[247,4]]},"117":{"position":[[31,3],[72,4],[150,3],[188,3],[638,3],[980,3],[1052,3],[1138,3],[1161,3],[1358,4],[1389,3]]},"118":{"position":[[32,3],[132,3]]},"129":{"position":[[208,3]]},"134":{"position":[[156,3]]},"154":{"position":[[61,3],[235,3]]},"173":{"position":[[378,3]]},"175":{"position":[[12,3],[52,3],[119,3]]},"194":{"position":[[167,3]]},"196":{"position":[[821,3]]},"197":{"position":[[1061,3],[1440,3]]},"205":{"position":[[156,3]]},"206":{"position":[[1117,3],[1755,3],[3361,3]]},"214":{"position":[[75,3]]},"216":{"position":[[75,3]]},"225":{"position":[[75,3]]},"245":{"position":[[149,3]]},"264":{"position":[[24,3],[136,3]]},"267":{"position":[[72,3],[284,3],[1878,3]]},"268":{"position":[[2203,3],[2817,3]]},"269":{"position":[[5027,3],[5665,3]]},"270":{"position":[[362,3]]},"280":{"position":[[208,3]]},"290":{"position":[[17,3]]},"294":{"position":[[124,3]]},"298":{"position":[[31,3],[72,4],[150,3],[188,3],[638,3],[980,3],[1052,3],[1138,3],[1161,3],[1358,4],[1389,3]]},"299":{"position":[[32,3],[132,3]]},"306":{"position":[[247,4]]},"314":{"position":[[156,3]]},"339":{"position":[[61,3],[235,3]]},"359":{"position":[[378,3]]},"361":{"position":[[12,3],[52,3],[119,3]]},"382":{"position":[[18,3]]},"385":{"position":[[362,3]]},"393":{"position":[[402,3]]},"394":{"position":[[496,3]]},"395":{"position":[[183,3],[250,3],[911,3],[1058,3],[2444,3],[2487,3]]},"404":{"position":[[24,3],[136,3]]},"407":{"position":[[72,3],[284,3],[1878,3]]},"408":{"position":[[2203,3],[2817,3]]},"409":{"position":[[5027,3],[5665,3]]},"410":{"position":[[362,3]]},"413":{"position":[[199,3]]},"414":{"position":[[26,3],[115,3]]},"415":{"position":[[166,3],[366,3]]},"416":{"position":[[80,3],[129,3],[1221,3],[1296,3],[1323,3],[1385,3],[1511,3],[1690,3]]},"417":{"position":[[463,3],[1165,3]]},"419":{"position":[[597,3],[3646,3],[3904,3],[4030,3],[4207,3],[6878,3],[7580,3]]},"425":{"position":[[156,3]]},"426":{"position":[[1112,3],[1745,3],[3336,3]]},"430":{"position":[[167,3]]},"432":{"position":[[759,3]]},"433":{"position":[[1060,3],[1439,3]]},"438":{"position":[[148,3]]},"439":{"position":[[11,3],[74,3],[98,3],[147,3]]},"440":{"position":[[1783,3],[4133,3],[4166,3]]},"441":{"position":[[282,3],[354,3],[429,3],[3849,3],[4033,3],[4388,3]]},"444":{"position":[[149,3]]},"449":{"position":[[75,3]]},"502":{"position":[[17,3]]},"506":{"position":[[124,3]]},"511":{"position":[[247,4]]},"517":{"position":[[208,3]]},"519":{"position":[[31,3],[72,4],[150,3],[188,3],[638,3],[980,3],[1052,3],[1138,3],[1161,3],[1358,4],[1389,3]]},"520":{"position":[[32,3],[132,3]]},"531":{"position":[[156,3]]},"559":{"position":[[61,3],[235,3]]},"575":{"position":[[378,3]]},"577":{"position":[[12,3],[52,3],[119,3]]},"594":{"position":[[462,4]]},"624":{"position":[[18,3]]},"627":{"position":[[362,3]]},"630":{"position":[[402,3]]},"631":{"position":[[496,3]]},"632":{"position":[[183,3],[250,3],[911,3],[1058,3],[2444,3],[2487,3]]},"641":{"position":[[24,3],[136,3]]},"644":{"position":[[72,3],[284,3],[1878,3]]},"645":{"position":[[2203,3],[2817,3]]},"646":{"position":[[5027,3],[5665,3]]},"647":{"position":[[362,3]]},"650":{"position":[[199,3]]},"651":{"position":[[26,3],[115,3]]},"652":{"position":[[166,3],[366,3]]},"653":{"position":[[80,3],[129,3],[1221,3],[1296,3],[1323,3],[1385,3],[1511,3],[1690,3]]},"654":{"position":[[463,3],[1165,3]]},"656":{"position":[[597,3],[3646,3],[3904,3],[4030,3],[4207,3],[6878,3],[7580,3]]},"667":{"position":[[156,3]]},"668":{"position":[[1117,3],[1755,3],[3361,3]]},"671":{"position":[[149,3]]},"677":{"position":[[167,3]]},"679":{"position":[[759,3]]},"680":{"position":[[1060,3],[1439,3]]},"685":{"position":[[148,3]]},"686":{"position":[[11,3],[74,3],[98,3],[147,3]]},"687":{"position":[[1783,3],[4133,3],[4166,3]]},"688":{"position":[[282,3],[354,3],[429,3],[3849,3],[4033,3],[4388,3]]},"702":{"position":[[462,4]]}},"keywords":{}}],["new_admin_rol",{"_index":2188,"title":{},"content":{"184":{"position":[[640,15]]},"185":{"position":[[1866,15]]},"375":{"position":[[559,15]]},"376":{"position":[[1850,15]]},"591":{"position":[[559,15]]},"592":{"position":[[1850,15]]}},"keywords":{}}],["new_allow",{"_index":2488,"title":{},"content":{"205":{"position":[[1855,13],[1938,15]]},"425":{"position":[[1830,13],[1913,15]]},"667":{"position":[[1830,13],[1913,15]]}},"keywords":{}}],["new_bal",{"_index":2462,"title":{},"content":{"204":{"position":[[1598,11],[1756,13]]},"424":{"position":[[1548,11],[1706,13]]},"666":{"position":[[1548,11],[1706,13]]}},"keywords":{}}],["new_own",{"_index":1728,"title":{},"content":{"115":{"position":[[1185,10]]},"196":{"position":[[310,10],[518,10]]},"197":{"position":[[243,10],[465,10],[476,10]]},"198":{"position":[[524,10],[635,9],[764,11],[863,9],[970,9]]},"247":{"position":[[1292,10]]},"258":{"position":[[1131,10]]},"432":{"position":[[272,10],[455,10]]},"433":{"position":[[243,10],[465,10],[476,10]]},"434":{"position":[[519,10],[630,9],[759,11],[853,9],[960,9]]},"446":{"position":[[1292,10]]},"481":{"position":[[1131,10]]},"673":{"position":[[1292,10]]},"679":{"position":[[272,10],[455,10]]},"680":{"position":[[243,10],[465,10],[476,10]]},"681":{"position":[[524,10],[635,9],[764,11],[863,9],[970,9]]}},"keywords":{}}],["new_rat",{"_index":1748,"title":{},"content":{"115":{"position":[[2790,9]]},"258":{"position":[[2716,9]]},"481":{"position":[[2716,9]]}},"keywords":{}}],["new_valu",{"_index":1201,"title":{},"content":{"51":{"position":[[787,9],[867,10],[1220,10]]},"53":{"position":[[871,9],[1342,9]]},"223":{"position":[[537,9]]},"456":{"position":[[537,9]]},"696":{"position":[[537,9]]}},"keywords":{}}],["newcom",{"_index":1616,"title":{},"content":{"94":{"position":[[82,10]]},"286":{"position":[[82,10]]},"498":{"position":[[82,10]]}},"keywords":{}}],["next",{"_index":22,"title":{"12":{"position":[[5,5]]},"18":{"position":[[8,6]]},"23":{"position":[[5,5]]},"26":{"position":[[7,5]]},"28":{"position":[[7,5]]},"36":{"position":[[7,5]]},"46":{"position":[[7,5]]},"48":{"position":[[7,5]]},"57":{"position":[[7,5]]},"59":{"position":[[7,5]]},"61":{"position":[[7,5]]},"63":{"position":[[7,5]]},"112":{"position":[[7,5]]},"122":{"position":[[7,5]]},"124":{"position":[[7,5]]},"139":{"position":[[7,5]]},"149":{"position":[[7,5]]},"152":{"position":[[7,5]]},"155":{"position":[[7,5]]},"158":{"position":[[7,5]]},"166":{"position":[[7,5]]},"169":{"position":[[7,5]]},"171":{"position":[[7,5]]},"176":{"position":[[7,6]]},"180":{"position":[[7,5]]},"200":{"position":[[7,5]]},"207":{"position":[[7,5]]},"214":{"position":[[7,5]]},"216":{"position":[[7,5]]},"225":{"position":[[7,5]]},"303":{"position":[[7,5]]},"307":{"position":[[7,5]]},"309":{"position":[[7,5]]},"319":{"position":[[7,5]]},"331":{"position":[[7,5]]},"337":{"position":[[7,5]]},"340":{"position":[[7,5]]},"343":{"position":[[7,5]]},"349":{"position":[[7,5]]},"355":{"position":[[7,5]]},"357":{"position":[[7,5]]},"362":{"position":[[7,6]]},"371":{"position":[[7,5]]},"418":{"position":[[7,5]]},"427":{"position":[[7,5]]},"436":{"position":[[7,5]]},"449":{"position":[[7,5]]},"512":{"position":[[7,5]]},"524":{"position":[[7,5]]},"526":{"position":[[7,5]]},"545":{"position":[[7,5]]},"548":{"position":[[7,5]]},"554":{"position":[[7,5]]},"557":{"position":[[7,5]]},"560":{"position":[[7,5]]},"565":{"position":[[7,5]]},"571":{"position":[[7,5]]},"573":{"position":[[7,5]]},"578":{"position":[[7,6]]},"587":{"position":[[7,5]]},"655":{"position":[[7,5]]},"669":{"position":[[7,5]]},"683":{"position":[[7,5]]}},"content":{"1":{"position":[[225,4]]},"9":{"position":[[473,4]]},"38":{"position":[[1114,4]]},"42":{"position":[[794,5]]},"65":{"position":[[652,4]]},"88":{"position":[[435,4]]},"122":{"position":[[7,4]]},"124":{"position":[[7,4]]},"126":{"position":[[3074,4]]},"136":{"position":[[147,4]]},"155":{"position":[[7,4]]},"158":{"position":[[9,4]]},"166":{"position":[[7,4]]},"168":{"position":[[1214,5]]},"171":{"position":[[9,4]]},"174":{"position":[[409,4]]},"180":{"position":[[7,4]]},"198":{"position":[[3345,4]]},"200":{"position":[[7,4]]},"210":{"position":[[201,5]]},"240":{"position":[[652,4]]},"250":{"position":[[435,4]]},"277":{"position":[[3242,4]]},"303":{"position":[[7,4]]},"309":{"position":[[7,4]]},"316":{"position":[[147,4]]},"331":{"position":[[9,4]]},"340":{"position":[[7,4]]},"348":{"position":[[1214,5]]},"355":{"position":[[7,4]]},"357":{"position":[[9,4]]},"360":{"position":[[409,4]]},"371":{"position":[[7,4]]},"389":{"position":[[201,5]]},"395":{"position":[[6830,4]]},"416":{"position":[[2552,5]]},"434":{"position":[[3327,4]]},"436":{"position":[[7,4]]},"465":{"position":[[652,4]]},"488":{"position":[[435,4]]},"514":{"position":[[3074,4]]},"524":{"position":[[7,4]]},"526":{"position":[[7,4]]},"533":{"position":[[147,4]]},"548":{"position":[[9,4]]},"560":{"position":[[7,4]]},"564":{"position":[[1214,5]]},"571":{"position":[[7,4]]},"573":{"position":[[9,4]]},"576":{"position":[[409,4]]},"587":{"position":[[7,4]]},"632":{"position":[[6830,4]]},"653":{"position":[[2552,5]]},"659":{"position":[[201,5]]},"681":{"position":[[3345,4]]},"683":{"position":[[7,4]]}},"keywords":{}}],["next_valu",{"_index":1435,"title":{},"content":{"78":{"position":[[323,10]]},"229":{"position":[[344,10]]},"460":{"position":[[344,10]]}},"keywords":{}}],["nft",{"_index":2287,"title":{},"content":{"188":{"position":[[337,5]]},"365":{"position":[[237,3],[694,5]]},"439":{"position":[[15,3]]},"581":{"position":[[237,3],[694,5]]},"686":{"position":[[15,3]]}},"keywords":{}}],["nftidentifiermod",{"_index":3348,"title":{},"content":{"440":{"position":[[311,18]]},"687":{"position":[[311,18]]}},"keywords":{}}],["nftidentifiermode::ordin",{"_index":3381,"title":{},"content":{"440":{"position":[[1452,27]]},"687":{"position":[[1452,27]]}},"keywords":{}}],["nftkind",{"_index":3349,"title":{},"content":{"440":{"position":[[330,8]]},"687":{"position":[[330,8]]}},"keywords":{}}],["nftkind::digit",{"_index":3380,"title":{},"content":{"440":{"position":[[1434,17]]},"687":{"position":[[1434,17]]}},"keywords":{}}],["nftmetadatakind",{"_index":3350,"title":{},"content":{"440":{"position":[[339,16]]},"687":{"position":[[339,16]]}},"keywords":{}}],["nftmetadatakind::raw",{"_index":3382,"title":{},"content":{"440":{"position":[[1480,21]]},"687":{"position":[[1480,21]]}},"keywords":{}}],["nice",{"_index":123,"title":{},"content":{"3":{"position":[[41,5]]},"12":{"position":[[158,4]]},"16":{"position":[[370,4]]},"417":{"position":[[1717,4],[1756,4]]},"654":{"position":[[1717,4],[1756,4]]}},"keywords":{}}],["nightli",{"_index":2987,"title":{},"content":{"323":{"position":[[316,7]]},"541":{"position":[[316,7]]}},"keywords":{}}],["no_main",{"_index":817,"title":{},"content":{"32":{"position":[[192,11]]}},"keywords":{}}],["no_std",{"_index":713,"title":{},"content":{"31":{"position":[[85,6]]},"32":{"position":[[204,10]]}},"keywords":{}}],["no_vot",{"_index":3256,"title":{},"content":{"416":{"position":[[3975,8],[4136,8],[4353,8]]},"419":{"position":[[5554,8],[5715,8],[5933,8]]},"653":{"position":[[3975,8],[4136,8],[4353,8]]},"656":{"position":[[5554,8],[5715,8],[5933,8]]}},"keywords":{}}],["noarg",{"_index":1395,"title":{},"content":{"73":{"position":[[504,8],[673,8]]},"143":{"position":[[239,8],[381,8],[1036,9],[1338,8]]},"148":{"position":[[99,8],[356,8],[796,6]]},"151":{"position":[[183,8],[322,8]]},"157":{"position":[[241,8],[383,8]]},"160":{"position":[[263,9],[399,8]]},"178":{"position":[[1105,8],[1362,8],[1555,8],[1613,8]]},"223":{"position":[[864,8],[1013,8]]},"237":{"position":[[504,8],[673,8]]},"268":{"position":[[936,8],[1029,7]]},"328":{"position":[[239,8],[381,8],[1011,9],[1313,8]]},"330":{"position":[[232,8],[374,8]]},"336":{"position":[[99,8],[356,8],[796,6]]},"342":{"position":[[183,8],[322,8]]},"345":{"position":[[263,9],[399,8]]},"369":{"position":[[1105,8],[1362,8],[1555,8],[1613,8]]},"408":{"position":[[936,8],[1029,7]]},"441":{"position":[[4607,8],[5023,8]]},"456":{"position":[[864,8],[1013,8]]},"473":{"position":[[504,8],[673,8]]},"537":{"position":[[239,8],[381,8],[1011,9],[1313,8]]},"547":{"position":[[241,8],[383,8]]},"553":{"position":[[99,8],[356,8],[796,6]]},"556":{"position":[[183,8],[322,8]]},"562":{"position":[[263,9],[399,8]]},"585":{"position":[[1105,8],[1362,8],[1555,8],[1613,8]]},"645":{"position":[[936,8],[1029,7]]},"688":{"position":[[4607,8],[5023,8]]},"696":{"position":[[864,8],[1013,8]]}},"keywords":{}}],["node",{"_index":1133,"title":{},"content":{"43":{"position":[[940,4]]},"52":{"position":[[583,4],[599,4],[703,4],[865,4]]},"53":{"position":[[184,4]]},"99":{"position":[[238,4]]},"100":{"position":[[332,4]]},"101":{"position":[[186,4]]},"126":{"position":[[686,4]]},"128":{"position":[[353,4],[596,4]]},"129":{"position":[[149,5]]},"210":{"position":[[380,4],[1154,4]]},"277":{"position":[[686,4],[1238,5]]},"279":{"position":[[353,4],[596,4]]},"280":{"position":[[149,5]]},"291":{"position":[[238,4]]},"292":{"position":[[332,4]]},"293":{"position":[[186,4]]},"389":{"position":[[380,4],[1091,4]]},"395":{"position":[[3862,4],[4227,4],[4342,4]]},"477":{"position":[[32,5],[694,4]]},"503":{"position":[[238,4]]},"504":{"position":[[332,4]]},"505":{"position":[[186,4]]},"514":{"position":[[686,4]]},"516":{"position":[[353,4],[596,4]]},"517":{"position":[[149,5]]},"632":{"position":[[3862,4],[4227,4],[4342,4]]},"659":{"position":[[380,4],[1091,4]]},"699":{"position":[[32,5],[694,4]]}},"keywords":{}}],["node/utils/nctl/assets/net",{"_index":3556,"title":{},"content":{"477":{"position":[[413,26]]},"699":{"position":[[413,26]]}},"keywords":{}}],["node_address",{"_index":1134,"title":{},"content":{"43":{"position":[[953,16]]},"99":{"position":[[251,14]]},"100":{"position":[[345,14]]},"101":{"position":[[199,14]]},"212":{"position":[[264,13],[772,13],[986,13]]},"291":{"position":[[251,14]]},"292":{"position":[[345,14]]},"293":{"position":[[199,14]]},"391":{"position":[[264,13],[772,13],[986,13]]},"503":{"position":[[251,14]]},"504":{"position":[[345,14]]},"505":{"position":[[199,14]]},"661":{"position":[[264,13],[772,13],[986,13]]}},"keywords":{}}],["non",{"_index":1369,"title":{"72":{"position":[[0,3]]},"236":{"position":[[0,3]]},"472":{"position":[[0,3]]}},"content":{"71":{"position":[[608,3]]},"126":{"position":[[2956,3]]},"185":{"position":[[2995,3]]},"194":{"position":[[237,3]]},"198":{"position":[[3439,3]]},"235":{"position":[[608,3]]},"277":{"position":[[3124,3]]},"376":{"position":[[2979,3]]},"430":{"position":[[237,3]]},"434":{"position":[[3421,3]]},"471":{"position":[[608,3]]},"514":{"position":[[2956,3]]},"592":{"position":[[2979,3]]},"677":{"position":[[237,3]]},"681":{"position":[[3439,3]]}},"keywords":{}}],["non_owner_cannot_change_ownership",{"_index":2393,"title":{},"content":{"198":{"position":[[891,35]]},"434":{"position":[[881,35]]},"681":{"position":[[891,35]]}},"keywords":{}}],["non_reentr",{"_index":1406,"title":{},"content":{"74":{"position":[[163,15]]},"238":{"position":[[163,15]]},"474":{"position":[[163,15]]}},"keywords":{}}],["nonc",{"_index":769,"title":{},"content":{"31":{"position":[[1550,6],[1844,6]]}},"keywords":{}}],["none",{"_index":499,"title":{},"content":{"17":{"position":[[1327,4]]},"103":{"position":[[608,5]]},"196":{"position":[[304,5],[1724,5]]},"197":{"position":[[598,4]]},"198":{"position":[[518,5]]},"204":{"position":[[798,5]]},"206":{"position":[[1002,5]]},"212":{"position":[[802,5]]},"267":{"position":[[1753,5]]},"269":{"position":[[975,5],[2105,5],[2447,5],[4912,5]]},"295":{"position":[[608,5]]},"384":{"position":[[988,5],[2125,5],[2474,5]]},"391":{"position":[[802,5]]},"407":{"position":[[1753,5]]},"409":{"position":[[975,5],[2105,5],[2447,5],[4912,5]]},"419":{"position":[[1619,6],[1860,4],[2037,4]]},"424":{"position":[[773,5]]},"426":{"position":[[997,5]]},"432":{"position":[[266,5],[1602,5]]},"433":{"position":[[598,4]]},"434":{"position":[[513,5]]},"507":{"position":[[608,5]]},"601":{"position":[[614,6],[1086,6]]},"626":{"position":[[988,5],[2125,5],[2474,5]]},"644":{"position":[[1753,5]]},"646":{"position":[[975,5],[2105,5],[2447,5],[4912,5]]},"656":{"position":[[1619,6],[1860,4],[2037,4]]},"661":{"position":[[802,5]]},"666":{"position":[[773,5]]},"668":{"position":[[1002,5]]},"679":{"position":[[266,5],[1602,5]]},"680":{"position":[[598,4]]},"681":{"position":[[518,5]]},"709":{"position":[[614,6],[1086,6]]}},"keywords":{}}],["none_list",{"_index":3308,"title":{},"content":{"419":{"position":[[2281,10]]},"656":{"position":[[2281,10]]}},"keywords":{}}],["nonreentrantcount",{"_index":1384,"title":{},"content":{"73":{"position":[[27,19],[96,19],[322,19]]},"237":{"position":[[27,19],[96,19],[322,19]]},"473":{"position":[[27,19],[96,19],[322,19]]}},"keywords":{}}],["nonreentrantcounterhostref::deploy(&test_env",{"_index":1400,"title":{},"content":{"73":{"position":[[623,49]]},"237":{"position":[[623,49]]},"473":{"position":[[623,49]]}},"keywords":{}}],["nontrivi",{"_index":247,"title":{},"content":{"8":{"position":[[430,10]]}},"keywords":{}}],["normal",{"_index":2732,"title":{},"content":{"223":{"position":[[244,6]]},"456":{"position":[[244,6]]},"696":{"position":[[244,6]]}},"keywords":{}}],["not.stat",{"_index":2695,"title":{},"content":{"218":{"position":[[104,9]]},"451":{"position":[[104,9]]},"691":{"position":[[104,9]]}},"keywords":{}}],["not_an_own",{"_index":1907,"title":{},"content":{"138":{"position":[[408,12]]},"318":{"position":[[400,12]]},"544":{"position":[[400,12]]}},"keywords":{}}],["not_payable(&self",{"_index":3781,"title":{},"content":{"608":{"position":[[306,22]]},"716":{"position":[[306,22]]}},"keywords":{}}],["notabl",{"_index":930,"title":{},"content":{"39":{"position":[[871,7]]}},"keywords":{}}],["notanmessagesend",{"_index":505,"title":{},"content":{"17":{"position":[[1599,18]]}},"keywords":{}}],["notat",{"_index":2105,"title":{},"content":{"164":{"position":[[268,8]]},"204":{"position":[[1421,8]]},"353":{"position":[[303,8]]},"424":{"position":[[1371,8]]},"569":{"position":[[303,8]]},"666":{"position":[[1371,8]]}},"keywords":{}}],["note",{"_index":884,"title":{},"content":{"38":{"position":[[816,4],[839,4]]},"79":{"position":[[1253,4]]},"91":{"position":[[892,4]]},"92":{"position":[[829,4]]},"97":{"position":[[284,4]]},"126":{"position":[[3400,4],[3453,4]]},"127":{"position":[[143,4],[686,5]]},"162":{"position":[[1524,4]]},"163":{"position":[[1431,4]]},"165":{"position":[[313,4]]},"173":{"position":[[432,4]]},"198":{"position":[[2460,4],[3305,4]]},"230":{"position":[[1270,4]]},"277":{"position":[[1168,4],[3568,4],[3621,4]]},"278":{"position":[[143,4],[686,5]]},"283":{"position":[[890,4]]},"284":{"position":[[829,4]]},"289":{"position":[[284,4]]},"321":{"position":[[260,4]]},"351":{"position":[[1546,4]]},"352":{"position":[[1453,4]]},"354":{"position":[[637,4]]},"359":{"position":[[432,4]]},"394":{"position":[[335,4]]},"395":{"position":[[4172,4],[6777,4]]},"396":{"position":[[150,4]]},"414":{"position":[[717,4]]},"434":{"position":[[2450,4],[3287,4]]},"441":{"position":[[2072,4]]},"461":{"position":[[1270,4]]},"495":{"position":[[890,4]]},"496":{"position":[[829,4]]},"501":{"position":[[284,4]]},"514":{"position":[[3400,4],[3453,4]]},"515":{"position":[[143,4],[686,5]]},"539":{"position":[[260,4]]},"567":{"position":[[1546,4]]},"568":{"position":[[1453,4]]},"570":{"position":[[637,4]]},"575":{"position":[[432,4]]},"610":{"position":[[765,4]]},"631":{"position":[[335,4]]},"632":{"position":[[4172,4],[6777,4]]},"633":{"position":[[150,4]]},"651":{"position":[[717,4]]},"681":{"position":[[2460,4],[3305,4]]},"688":{"position":[[2072,4]]},"718":{"position":[[765,4]]}},"keywords":{}}],["noth",{"_index":1220,"title":{},"content":{"51":{"position":[[1838,7]]},"91":{"position":[[697,7]]},"127":{"position":[[849,8]]},"278":{"position":[[849,8]]},"283":{"position":[[697,7]]},"321":{"position":[[16,7]]},"384":{"position":[[3820,7]]},"495":{"position":[[697,7]]},"515":{"position":[[849,8]]},"539":{"position":[[16,7]]},"626":{"position":[[3820,7]]}},"keywords":{}}],["notic",{"_index":1786,"title":{},"content":{"120":{"position":[[223,7]]},"196":{"position":[[947,6]]},"198":{"position":[[2478,8]]},"301":{"position":[[223,7]]},"416":{"position":[[876,6],[4566,6]]},"432":{"position":[[885,6]]},"434":{"position":[[2468,8]]},"522":{"position":[[223,7]]},"596":{"position":[[466,8]]},"653":{"position":[[876,6],[4566,6]]},"679":{"position":[[885,6]]},"681":{"position":[[2478,8]]},"704":{"position":[[466,8]]}},"keywords":{}}],["notown",{"_index":2363,"title":{},"content":{"197":{"position":[[701,8]]},"433":{"position":[[700,8]]},"680":{"position":[[700,8]]}},"keywords":{}}],["notowner.l11",{"_index":2369,"title":{},"content":{"197":{"position":[[1073,12]]},"433":{"position":[[1072,12]]},"680":{"position":[[1072,12]]}},"keywords":{}}],["novoteinprogress",{"_index":3294,"title":{},"content":{"419":{"position":[[455,16]]},"656":{"position":[[455,16]]}},"keywords":{}}],["now",{"_index":20,"title":{},"content":{"1":{"position":[[201,3]]},"3":{"position":[[114,3],[328,4]]},"10":{"position":[[0,3]]},"20":{"position":[[379,4]]},"23":{"position":[[131,3]]},"31":{"position":[[277,4]]},"52":{"position":[[2152,4],[3149,3]]},"100":{"position":[[265,3]]},"126":{"position":[[2484,3]]},"136":{"position":[[152,4]]},"149":{"position":[[0,3]]},"164":{"position":[[902,4]]},"175":{"position":[[474,3]]},"185":{"position":[[0,4]]},"205":{"position":[[2270,4]]},"221":{"position":[[0,4]]},"267":{"position":[[329,3],[398,3],[428,3],[2101,3],[2255,3],[2584,3],[2718,3],[2850,3],[3057,3],[4242,3]]},"268":{"position":[[1599,3],[1667,3]]},"277":{"position":[[2652,3]]},"292":{"position":[[265,3]]},"316":{"position":[[152,4]]},"337":{"position":[[0,3]]},"353":{"position":[[937,4]]},"361":{"position":[[474,3]]},"376":{"position":[[0,4]]},"394":{"position":[[523,4]]},"395":{"position":[[4359,4],[6722,3]]},"407":{"position":[[329,3],[398,3],[428,3],[2101,3],[2255,3],[2584,3],[2718,3],[2850,3],[3057,3],[4242,3]]},"408":{"position":[[1599,3],[1667,3]]},"416":{"position":[[1987,4]]},"417":{"position":[[0,4],[689,3],[898,3],[1142,3]]},"419":{"position":[[4505,4],[7104,3],[7313,3],[7557,3]]},"425":{"position":[[2220,4]]},"441":{"position":[[1006,3],[1391,3],[2109,3],[2129,3],[3459,3],[4223,3],[4445,3]]},"454":{"position":[[0,4]]},"504":{"position":[[265,3]]},"514":{"position":[[2484,3]]},"533":{"position":[[152,4]]},"554":{"position":[[0,3]]},"569":{"position":[[937,4]]},"577":{"position":[[474,3]]},"592":{"position":[[0,4]]},"618":{"position":[[24,3]]},"631":{"position":[[523,4]]},"632":{"position":[[4359,4],[6722,3]]},"644":{"position":[[329,3],[398,3],[428,3],[2101,3],[2255,3],[2584,3],[2718,3],[2850,3],[3057,3],[4242,3]]},"645":{"position":[[1599,3],[1667,3]]},"653":{"position":[[1987,4]]},"654":{"position":[[0,4],[689,3],[898,3],[1142,3]]},"656":{"position":[[4505,4],[7104,3],[7313,3],[7557,3]]},"667":{"position":[[2220,4]]},"688":{"position":[[1006,3],[1391,3],[2109,3],[2129,3],[3459,3],[4223,3],[4445,3]]},"694":{"position":[[0,4]]},"726":{"position":[[24,3]]}},"keywords":{}}],["nowfn",{"_index":2132,"title":{},"content":{"168":{"position":[[1637,5]]},"348":{"position":[[1637,5]]},"564":{"position":[[1637,5]]}},"keywords":{}}],["nth",{"_index":689,"title":{},"content":{"30":{"position":[[121,3]]}},"keywords":{}}],["null",{"_index":2994,"title":{},"content":{"323":{"position":[[403,5],[431,5],[646,5],[738,5],[873,5],[965,5],[1073,5],[1208,5],[1300,5],[1922,5],[3501,5],[3638,5]]},"324":{"position":[[680,6],[1052,6]]},"541":{"position":[[403,5],[431,5],[646,5],[738,5],[873,5],[965,5],[1073,5],[1208,5],[1300,5],[1922,5],[3501,5],[3638,5]]},"542":{"position":[[680,6],[1052,6]]}},"keywords":{}}],["num",{"_index":1431,"title":{},"content":{"78":{"position":[[216,3]]},"229":{"position":[[216,3]]},"460":{"position":[[216,3]]},"616":{"position":[[226,4]]},"724":{"position":[[226,4]]}},"keywords":{}}],["number",{"_index":232,"title":{},"content":{"8":{"position":[[116,7],[274,6],[340,6]]},"9":{"position":[[129,8]]},"30":{"position":[[135,7]]},"79":{"position":[[196,7],[1338,8]]},"83":{"position":[[132,6]]},"141":{"position":[[1193,7]]},"165":{"position":[[50,8]]},"230":{"position":[[196,7],[1355,8]]},"252":{"position":[[132,6]]},"326":{"position":[[1193,7]]},"354":{"position":[[50,8]]},"419":{"position":[[2470,6]]},"461":{"position":[[196,7],[1355,8]]},"483":{"position":[[132,6]]},"535":{"position":[[1193,7]]},"570":{"position":[[50,8]]},"611":{"position":[[934,7]]},"656":{"position":[[2470,6]]},"719":{"position":[[934,7]]}},"keywords":{}}],["numer",{"_index":2094,"title":{},"content":{"163":{"position":[[1293,7]]},"209":{"position":[[80,7],[331,7],[1465,7]]},"352":{"position":[[1315,7]]},"388":{"position":[[80,7],[331,7],[1397,7]]},"568":{"position":[[1315,7]]},"658":{"position":[[80,7],[331,7],[1397,7]]}},"keywords":{}}],["nysa",{"_index":861,"title":{"37":{"position":[[0,4]]},"39":{"position":[[0,5]]},"40":{"position":[[0,4]]}},"content":{"38":{"position":[[1182,4]]},"39":{"position":[[183,4],[345,4],[1519,4],[1652,4],[3220,4]]},"40":{"position":[[11,4],[432,4],[451,4]]},"42":{"position":[[272,4],[419,5],[457,4]]},"44":{"position":[[0,4]]}},"keywords":{}}],["nysa'",{"_index":1163,"title":{},"content":{"43":{"position":[[2000,6]]}},"keywords":{}}],["nysa/src/parser/odra/expr/mod.r",{"_index":971,"title":{},"content":{"39":{"position":[[2223,32]]}},"keywords":{}}],["nysa::builder::generate_file::<&str",{"_index":1042,"title":{},"content":{"42":{"position":[[691,43]]}},"keywords":{}}],["nysa::odraparser>(source_file_path",{"_index":1043,"title":{},"content":{"42":{"position":[[735,38]]}},"keywords":{}}],["nysadeploy",{"_index":1166,"title":{},"content":{"43":{"position":[[2033,10]]}},"keywords":{}}],["o",{"_index":1254,"title":{},"content":{"52":{"position":[[987,1]]},"66":{"position":[[225,1]]},"68":{"position":[[495,1]]},"241":{"position":[[225,1]]},"243":{"position":[[495,1]]},"466":{"position":[[225,1]]},"468":{"position":[[495,1]]}},"keywords":{}}],["object",{"_index":1524,"title":{},"content":{"84":{"position":[[140,7]]},"253":{"position":[[140,7]]},"484":{"position":[[140,7]]}},"keywords":{}}],["observ",{"_index":3590,"title":{},"content":{"477":{"position":[[3790,9]]},"699":{"position":[[3790,9]]}},"keywords":{}}],["obtain",{"_index":719,"title":{},"content":{"31":{"position":[[248,6]]},"100":{"position":[[1066,6]]},"141":{"position":[[316,6]]},"168":{"position":[[1161,9]]},"211":{"position":[[557,8]]},"292":{"position":[[1066,6]]},"326":{"position":[[316,6]]},"348":{"position":[[1161,9]]},"390":{"position":[[531,8]]},"504":{"position":[[1066,6]]},"535":{"position":[[316,6]]},"564":{"position":[[1161,9]]},"660":{"position":[[531,8]]}},"keywords":{}}],["obvious",{"_index":1784,"title":{},"content":{"119":{"position":[[921,11]]},"300":{"position":[[921,11]]},"521":{"position":[[921,11]]}},"keywords":{}}],["occur",{"_index":1380,"title":{},"content":{"72":{"position":[[315,5]]},"92":{"position":[[159,7]]},"206":{"position":[[1965,7]]},"219":{"position":[[31,6]]},"236":{"position":[[315,5]]},"269":{"position":[[5875,7]]},"284":{"position":[[159,7]]},"409":{"position":[[5875,7]]},"426":{"position":[[1955,7]]},"452":{"position":[[31,6]]},"472":{"position":[[315,5]]},"476":{"position":[[1565,5]]},"496":{"position":[[159,7]]},"617":{"position":[[950,5],[1380,6]]},"646":{"position":[[5875,7]]},"668":{"position":[[1965,7]]},"692":{"position":[[31,6]]},"698":{"position":[[1565,5]]},"725":{"position":[[950,5],[1380,6]]}},"keywords":{}}],["occurred.l31",{"_index":2411,"title":{},"content":{"198":{"position":[[2999,12]]},"434":{"position":[[2981,12]]},"681":{"position":[[2999,12]]}},"keywords":{}}],["odra",{"_index":3,"title":{"1":{"position":[[6,4]]},"14":{"position":[[23,4]]},"19":{"position":[[0,4]]},"21":{"position":[[0,4]]},"22":{"position":[[0,4]]},"25":{"position":[[0,4]]},"27":{"position":[[0,4]]},"35":{"position":[[0,4]]},"38":{"position":[[0,5]]},"40":{"position":[[7,5]]},"45":{"position":[[0,4]]},"47":{"position":[[0,4]]},"49":{"position":[[0,4]]},"56":{"position":[[0,4]]},"58":{"position":[[0,4]]},"60":{"position":[[0,4]]},"62":{"position":[[0,4]]},"84":{"position":[[0,4]]},"116":{"position":[[6,4]]},"170":{"position":[[0,4]]},"174":{"position":[[17,5]]},"175":{"position":[[15,4]]},"186":{"position":[[6,4]]},"213":{"position":[[0,4]]},"215":{"position":[[0,4]]},"224":{"position":[[0,4]]},"253":{"position":[[0,4]]},"261":{"position":[[18,5]]},"297":{"position":[[6,4]]},"321":{"position":[[0,4]]},"356":{"position":[[0,4]]},"360":{"position":[[17,5]]},"361":{"position":[[15,4]]},"363":{"position":[[6,4]]},"379":{"position":[[18,5]]},"395":{"position":[[0,4]]},"401":{"position":[[18,5]]},"448":{"position":[[0,4]]},"484":{"position":[[0,4]]},"518":{"position":[[6,4]]},"539":{"position":[[0,4]]},"572":{"position":[[0,4]]},"576":{"position":[[17,5]]},"577":{"position":[[15,4]]},"579":{"position":[[6,4]]},"593":{"position":[[0,4]]},"621":{"position":[[18,5]]},"632":{"position":[[0,4]]},"638":{"position":[[18,5]]},"701":{"position":[[0,4]]}},"content":{"1":{"position":[[145,4],[317,4],[971,4]]},"2":{"position":[[61,4],[170,4],[482,5]]},"3":{"position":[[562,4]]},"15":{"position":[[322,5],[377,4],[478,4],[571,4]]},"16":{"position":[[318,5],[466,4]]},"17":{"position":[[54,5],[1830,4]]},"18":{"position":[[345,5]]},"20":{"position":[[941,4]]},"21":{"position":[[50,4],[178,4]]},"22":{"position":[[0,4],[451,4],[1415,4],[1446,5]]},"24":{"position":[[14,4],[81,5]]},"26":{"position":[[91,5]]},"28":{"position":[[91,5]]},"36":{"position":[[91,5]]},"38":{"position":[[18,4],[282,4],[443,4],[544,4],[853,4],[972,4],[1157,4]]},"39":{"position":[[1639,4]]},"40":{"position":[[350,4],[481,5]]},"42":{"position":[[195,5],[207,4],[394,4],[1660,4],[1778,4],[1886,4],[2561,4],[2604,4]]},"43":{"position":[[820,4],[867,4],[1812,4]]},"44":{"position":[[178,4]]},"46":{"position":[[91,5]]},"48":{"position":[[91,5]]},"50":{"position":[[443,4]]},"51":{"position":[[331,4],[1653,4],[1691,5],[1703,4]]},"52":{"position":[[2337,4],[3346,4],[5007,4]]},"54":{"position":[[89,4],[468,4]]},"57":{"position":[[91,5]]},"59":{"position":[[91,5]]},"61":{"position":[[92,5]]},"63":{"position":[[92,5]]},"65":{"position":[[38,4],[187,4],[545,4]]},"66":{"position":[[42,4]]},"67":{"position":[[27,4]]},"72":{"position":[[444,4]]},"76":{"position":[[87,5],[136,4],[439,4],[589,4],[796,4],[962,5]]},"78":{"position":[[16,4]]},"79":{"position":[[3,5],[1268,4]]},"81":{"position":[[29,4],[126,4]]},"83":{"position":[[213,4]]},"84":{"position":[[0,4],[781,4]]},"88":{"position":[[193,4],[241,4]]},"90":{"position":[[145,4]]},"91":{"position":[[69,4],[139,4],[219,4]]},"92":{"position":[[10,4],[326,4],[557,4],[834,4]]},"93":{"position":[[92,4]]},"96":{"position":[[30,4],[117,4],[198,4]]},"98":{"position":[[91,4],[599,4]]},"100":{"position":[[0,4],[71,4],[165,4]]},"101":{"position":[[97,4]]},"102":{"position":[[109,4],[308,4],[551,4],[660,4]]},"104":{"position":[[12,4]]},"106":{"position":[[38,4],[81,4]]},"110":{"position":[[160,4],[270,4],[403,4]]},"112":{"position":[[32,4]]},"114":{"position":[[86,5]]},"115":{"position":[[112,7],[1924,7]]},"117":{"position":[[67,4],[145,4],[633,4],[843,4],[924,4],[975,4],[1001,7],[1036,4],[1047,4],[1156,4],[1301,4]]},"118":{"position":[[91,4]]},"119":{"position":[[87,4],[212,4],[340,4],[389,4],[939,4],[1069,4],[1148,4]]},"120":{"position":[[124,4],[350,4]]},"121":{"position":[[138,4]]},"122":{"position":[[85,4]]},"124":{"position":[[65,5]]},"126":{"position":[[43,4]]},"131":{"position":[[150,4],[194,4],[569,4],[628,4]]},"132":{"position":[[98,4],[118,4],[369,4]]},"134":{"position":[[151,4],[190,4],[208,4],[228,4]]},"136":{"position":[[30,4],[51,4]]},"139":{"position":[[48,5]]},"141":{"position":[[1331,4]]},"145":{"position":[[51,4]]},"146":{"position":[[285,5],[625,4],[679,4]]},"147":{"position":[[169,4],[386,4]]},"148":{"position":[[953,4]]},"149":{"position":[[61,4]]},"154":{"position":[[24,4]]},"155":{"position":[[80,4]]},"162":{"position":[[54,4]]},"163":{"position":[[1378,4],[1483,5]]},"164":{"position":[[1060,4],[1192,4]]},"168":{"position":[[0,4],[1966,4]]},"169":{"position":[[22,4]]},"171":{"position":[[46,4],[78,4]]},"173":{"position":[[22,5],[493,4]]},"174":{"position":[[6,4],[114,5],[255,4],[349,4]]},"175":{"position":[[47,4],[163,4],[181,4],[301,4],[436,4],[518,4]]},"178":{"position":[[453,4]]},"179":{"position":[[55,4]]},"180":{"position":[[71,5]]},"184":{"position":[[140,4]]},"187":{"position":[[0,4]]},"188":{"position":[[134,4],[528,4]]},"193":{"position":[[63,4]]},"195":{"position":[[422,4]]},"196":{"position":[[635,4]]},"198":{"position":[[1447,5]]},"201":{"position":[[63,4]]},"203":{"position":[[513,4]]},"204":{"position":[[1198,4]]},"210":{"position":[[261,4]]},"214":{"position":[[92,5]]},"216":{"position":[[92,5]]},"219":{"position":[[101,4]]},"225":{"position":[[92,5]]},"227":{"position":[[87,5],[136,4],[439,4],[589,4],[796,4],[962,5]]},"229":{"position":[[16,4]]},"230":{"position":[[3,5],[1285,4]]},"232":{"position":[[29,4],[126,4]]},"236":{"position":[[444,4]]},"240":{"position":[[38,4],[187,4],[545,4]]},"241":{"position":[[42,4]]},"242":{"position":[[27,4]]},"248":{"position":[[4,4]]},"250":{"position":[[193,4],[241,4]]},"252":{"position":[[213,4]]},"253":{"position":[[0,4],[781,4]]},"257":{"position":[[86,5]]},"258":{"position":[[112,7],[1870,7]]},"261":{"position":[[96,4],[185,4]]},"264":{"position":[[0,4],[358,4]]},"265":{"position":[[161,4],[256,4],[552,4],[596,4]]},"266":{"position":[[28,5]]},"269":{"position":[[3946,7]]},"273":{"position":[[38,4],[81,4]]},"277":{"position":[[43,4]]},"282":{"position":[[145,4]]},"283":{"position":[[69,4],[139,4],[219,4]]},"284":{"position":[[10,4],[326,4],[557,4],[834,4]]},"285":{"position":[[92,4]]},"288":{"position":[[30,4],[117,4],[198,4]]},"290":{"position":[[91,4],[599,4]]},"292":{"position":[[0,4],[71,4],[165,4]]},"293":{"position":[[97,4]]},"294":{"position":[[109,4],[308,4],[551,4],[660,4]]},"296":{"position":[[12,4]]},"298":{"position":[[67,4],[145,4],[633,4],[843,4],[924,4],[975,4],[1001,7],[1036,4],[1047,4],[1156,4],[1301,4]]},"299":{"position":[[91,4]]},"300":{"position":[[87,4],[212,4],[340,4],[389,4],[939,4],[1069,4],[1148,4]]},"301":{"position":[[124,4],[350,4]]},"302":{"position":[[138,4]]},"303":{"position":[[85,4]]},"305":{"position":[[160,4],[270,4],[403,4]]},"307":{"position":[[32,4]]},"309":{"position":[[65,5]]},"311":{"position":[[150,4],[194,4],[245,4],[621,4],[680,4]]},"312":{"position":[[98,4],[118,4],[369,4]]},"314":{"position":[[151,4],[190,4],[208,4],[228,4]]},"316":{"position":[[30,4],[51,4]]},"319":{"position":[[48,5]]},"321":{"position":[[58,4],[116,4]]},"322":{"position":[[47,4],[67,4]]},"324":{"position":[[1645,4]]},"326":{"position":[[1331,4]]},"333":{"position":[[51,4]]},"334":{"position":[[285,5],[629,4],[683,4]]},"335":{"position":[[169,4],[390,4]]},"336":{"position":[[953,4]]},"337":{"position":[[61,4]]},"339":{"position":[[24,4]]},"340":{"position":[[80,4]]},"348":{"position":[[0,4],[1966,4]]},"349":{"position":[[22,4]]},"351":{"position":[[54,4]]},"352":{"position":[[1400,4],[1505,5]]},"353":{"position":[[1095,4],[1227,4]]},"357":{"position":[[46,4],[78,4]]},"359":{"position":[[22,5],[493,4]]},"360":{"position":[[6,4],[114,5],[255,4],[349,4]]},"361":{"position":[[47,4],[163,4],[181,4],[301,4],[436,4],[518,4]]},"364":{"position":[[0,4]]},"365":{"position":[[491,4],[885,4]]},"369":{"position":[[453,4]]},"370":{"position":[[55,4]]},"371":{"position":[[71,5]]},"375":{"position":[[140,4]]},"379":{"position":[[96,4],[185,4]]},"382":{"position":[[0,4],[171,4]]},"389":{"position":[[261,4]]},"393":{"position":[[490,4]]},"394":{"position":[[599,5]]},"395":{"position":[[0,4],[2655,4],[2735,4],[2823,4],[2917,4],[3023,4]]},"398":{"position":[[91,4],[220,5]]},"401":{"position":[[96,4],[185,4]]},"404":{"position":[[0,4],[358,4]]},"405":{"position":[[161,4],[256,4],[552,4],[596,4]]},"406":{"position":[[28,5]]},"409":{"position":[[3946,7]]},"414":{"position":[[110,4],[650,4]]},"417":{"position":[[1670,4],[1686,4]]},"421":{"position":[[63,4]]},"423":{"position":[[513,4]]},"424":{"position":[[1148,4]]},"429":{"position":[[63,4]]},"431":{"position":[[422,4]]},"432":{"position":[[572,4]]},"434":{"position":[[1437,5]]},"439":{"position":[[30,4],[69,4],[142,4]]},"440":{"position":[[116,7],[4807,7]]},"441":{"position":[[457,4],[486,4],[4553,7]]},"442":{"position":[[129,4]]},"447":{"position":[[4,4]]},"449":{"position":[[92,5]]},"452":{"position":[[101,4]]},"458":{"position":[[87,5],[136,4],[439,4],[589,4],[796,4],[962,5]]},"460":{"position":[[16,4]]},"461":{"position":[[3,5],[1285,4]]},"463":{"position":[[29,4],[126,4]]},"465":{"position":[[38,4],[187,4],[545,4]]},"466":{"position":[[42,4]]},"467":{"position":[[27,4]]},"472":{"position":[[444,4]]},"477":{"position":[[301,4],[837,4],[926,4]]},"478":{"position":[[347,4]]},"480":{"position":[[86,5]]},"481":{"position":[[112,7],[1870,7]]},"483":{"position":[[213,4]]},"484":{"position":[[0,4],[781,4]]},"488":{"position":[[193,4],[241,4]]},"490":{"position":[[38,4],[81,4]]},"494":{"position":[[145,4]]},"495":{"position":[[69,4],[139,4],[219,4]]},"496":{"position":[[10,4],[326,4],[557,4],[834,4]]},"497":{"position":[[92,4]]},"500":{"position":[[30,4],[117,4],[198,4]]},"502":{"position":[[91,4],[599,4]]},"504":{"position":[[0,4],[71,4],[165,4]]},"505":{"position":[[97,4]]},"506":{"position":[[109,4],[308,4],[551,4],[660,4]]},"508":{"position":[[12,4]]},"510":{"position":[[160,4],[270,4],[403,4]]},"512":{"position":[[32,4]]},"514":{"position":[[43,4]]},"519":{"position":[[67,4],[145,4],[633,4],[843,4],[924,4],[975,4],[1001,7],[1036,4],[1047,4],[1156,4],[1301,4]]},"520":{"position":[[91,4]]},"521":{"position":[[87,4],[212,4],[340,4],[389,4],[939,4],[1069,4],[1148,4]]},"522":{"position":[[124,4],[350,4]]},"523":{"position":[[138,4]]},"524":{"position":[[85,4]]},"526":{"position":[[65,5]]},"528":{"position":[[150,4],[194,4],[245,4],[621,4],[680,4]]},"529":{"position":[[98,4],[118,4],[369,4]]},"531":{"position":[[151,4],[190,4],[208,4],[228,4]]},"533":{"position":[[30,4],[51,4]]},"535":{"position":[[1331,4]]},"539":{"position":[[58,4],[116,4]]},"540":{"position":[[47,4],[67,4]]},"542":{"position":[[1645,4]]},"545":{"position":[[48,5]]},"550":{"position":[[51,4]]},"551":{"position":[[285,5],[629,4],[683,4]]},"552":{"position":[[169,4],[390,4]]},"553":{"position":[[953,4]]},"554":{"position":[[61,4]]},"559":{"position":[[24,4]]},"560":{"position":[[80,4]]},"564":{"position":[[0,4],[1966,4]]},"565":{"position":[[22,4]]},"567":{"position":[[54,4]]},"568":{"position":[[1400,4],[1505,5]]},"569":{"position":[[1095,4],[1227,4]]},"573":{"position":[[46,4],[78,4]]},"575":{"position":[[22,5],[493,4]]},"576":{"position":[[6,4],[114,5],[255,4],[349,4]]},"577":{"position":[[47,4],[163,4],[181,4],[301,4],[436,4],[518,4]]},"580":{"position":[[0,4]]},"581":{"position":[[491,4],[885,4]]},"585":{"position":[[453,4]]},"586":{"position":[[55,4]]},"587":{"position":[[71,5]]},"591":{"position":[[140,4]]},"594":{"position":[[152,4],[345,5]]},"595":{"position":[[147,4]]},"596":{"position":[[62,5],[479,4],[562,5],[1004,4]]},"598":{"position":[[41,7],[1578,4],[1620,4],[1779,4],[1840,5]]},"599":{"position":[[279,5]]},"600":{"position":[[850,4],[913,5]]},"601":{"position":[[1934,4]]},"602":{"position":[[532,5],[1723,4]]},"603":{"position":[[178,5]]},"604":{"position":[[0,4]]},"605":{"position":[[254,5]]},"606":{"position":[[533,5]]},"608":{"position":[[624,5]]},"609":{"position":[[239,4]]},"610":{"position":[[488,5],[657,4],[898,4]]},"611":{"position":[[643,5]]},"612":{"position":[[116,4],[234,4],[408,5]]},"613":{"position":[[1719,5]]},"614":{"position":[[310,4]]},"616":{"position":[[17,7],[1260,5]]},"617":{"position":[[1013,5]]},"618":{"position":[[93,4],[204,5],[258,4],[411,4],[447,4]]},"621":{"position":[[96,4],[185,4]]},"624":{"position":[[0,4],[171,4]]},"630":{"position":[[490,4]]},"631":{"position":[[599,5]]},"632":{"position":[[0,4],[2655,4],[2735,4],[2823,4],[2917,4],[3023,4]]},"635":{"position":[[91,4],[220,5]]},"638":{"position":[[96,4],[185,4]]},"641":{"position":[[0,4],[358,4]]},"642":{"position":[[161,4],[256,4],[552,4],[596,4]]},"643":{"position":[[28,5]]},"646":{"position":[[3946,7]]},"651":{"position":[[110,4],[650,4]]},"654":{"position":[[1670,4],[1686,4]]},"659":{"position":[[261,4]]},"663":{"position":[[63,4]]},"665":{"position":[[513,4]]},"666":{"position":[[1148,4]]},"674":{"position":[[4,4]]},"676":{"position":[[63,4]]},"678":{"position":[[422,4]]},"679":{"position":[[572,4]]},"681":{"position":[[1447,5]]},"686":{"position":[[30,4],[69,4],[142,4]]},"687":{"position":[[116,7],[4807,7]]},"688":{"position":[[457,4],[486,4],[4553,7]]},"689":{"position":[[129,4]]},"692":{"position":[[101,4]]},"699":{"position":[[301,4],[837,4],[926,4]]},"700":{"position":[[347,4]]},"702":{"position":[[152,4],[345,5]]},"703":{"position":[[147,4]]},"704":{"position":[[62,5],[479,4],[562,5],[1004,4]]},"706":{"position":[[41,7],[1578,4],[1620,4],[1779,4],[1840,5]]},"707":{"position":[[279,5]]},"708":{"position":[[850,4],[913,5]]},"709":{"position":[[1934,4]]},"710":{"position":[[532,5],[1723,4]]},"711":{"position":[[178,5]]},"712":{"position":[[0,4]]},"713":{"position":[[254,5]]},"714":{"position":[[533,5]]},"716":{"position":[[624,5]]},"717":{"position":[[239,4]]},"718":{"position":[[488,5],[657,4],[898,4]]},"719":{"position":[[643,5]]},"720":{"position":[[116,4],[234,4],[408,5]]},"721":{"position":[[1719,5]]},"722":{"position":[[310,4]]},"724":{"position":[[17,7],[1260,5]]},"725":{"position":[[1013,5]]},"726":{"position":[[93,4],[204,5],[258,4],[411,4],[447,4]]}},"keywords":{}}],["odra'",{"_index":54,"title":{},"content":{"1":{"position":[[722,6]]},"22":{"position":[[321,6]]},"84":{"position":[[936,6]]},"97":{"position":[[191,6]]},"115":{"position":[[3236,7]]},"117":{"position":[[513,6]]},"119":{"position":[[125,6]]},"157":{"position":[[0,6]]},"175":{"position":[[338,6]]},"198":{"position":[[1811,6]]},"253":{"position":[[936,6]]},"258":{"position":[[3162,7]]},"289":{"position":[[191,6]]},"298":{"position":[[513,6]]},"300":{"position":[[125,6]]},"330":{"position":[[0,6]]},"361":{"position":[[338,6]]},"434":{"position":[[1801,6]]},"481":{"position":[[3162,7]]},"484":{"position":[[936,6]]},"501":{"position":[[191,6]]},"519":{"position":[[513,6]]},"521":{"position":[[125,6]]},"547":{"position":[[0,6]]},"577":{"position":[[338,6]]},"681":{"position":[[1811,6]]}},"keywords":{}}],["odra(init",{"_index":475,"title":{},"content":{"17":{"position":[[628,13],[2222,13]]},"22":{"position":[[1173,13]]},"51":{"position":[[574,13]]}},"keywords":{}}],["odra(non_reentr",{"_index":1383,"title":{},"content":{"72":{"position":[[472,22]]},"73":{"position":[[118,22]]},"74":{"position":[[234,22]]},"236":{"position":[[472,22]]},"237":{"position":[[118,22]]},"238":{"position":[[234,22]]},"472":{"position":[[472,22]]},"473":{"position":[[118,22]]},"474":{"position":[[234,22]]}},"keywords":{}}],["odra(pay",{"_index":1352,"title":{},"content":{"70":{"position":[[206,16]]},"71":{"position":[[30,16]]},"74":{"position":[[147,15],[217,16]]},"234":{"position":[[206,16]]},"235":{"position":[[30,16]]},"238":{"position":[[147,15],[217,16]]},"440":{"position":[[2215,16]]},"441":{"position":[[1054,16]]},"470":{"position":[[206,16]]},"471":{"position":[[30,16]]},"474":{"position":[[147,15],[217,16]]},"476":{"position":[[623,16]]},"608":{"position":[[252,16],[665,16]]},"614":{"position":[[436,16]]},"687":{"position":[[2215,16]]},"688":{"position":[[1054,16]]},"698":{"position":[[623,16]]},"716":{"position":[[252,16],[665,16]]},"722":{"position":[[436,16]]}},"keywords":{}}],["odra(us",{"_index":2894,"title":{},"content":{"267":{"position":[[4306,14]]},"407":{"position":[[4306,14]]},"644":{"position":[[4306,14]]}},"keywords":{}}],["odra.toml",{"_index":1101,"title":{"132":{"position":[[0,10]]},"153":{"position":[[0,9]]},"266":{"position":[[12,10]]},"312":{"position":[[0,10]]},"338":{"position":[[0,9]]},"406":{"position":[[12,10]]},"529":{"position":[[0,10]]},"558":{"position":[[0,9]]},"643":{"position":[[12,10]]}},"content":{"42":{"position":[[2778,9]]},"118":{"position":[[240,9],[288,9],[310,10]]},"136":{"position":[[238,9]]},"154":{"position":[[269,9]]},"183":{"position":[[143,9]]},"266":{"position":[[38,9]]},"299":{"position":[[240,9],[288,9],[310,10]]},"316":{"position":[[238,9]]},"339":{"position":[[269,9]]},"374":{"position":[[143,9]]},"406":{"position":[[38,9]]},"414":{"position":[[813,9]]},"520":{"position":[[240,9],[288,9],[310,10]]},"533":{"position":[[238,9]]},"559":{"position":[[269,9]]},"590":{"position":[[143,9]]},"643":{"position":[[38,9]]},"651":{"position":[[813,9]]}},"keywords":{}}],["odra/modules/src/cep78/token78.r",{"_index":3457,"title":{},"content":{"440":{"position":[[6204,33]]},"687":{"position":[[6204,33]]}},"keywords":{}}],["odra/rust",{"_index":3674,"title":{},"content":{"599":{"position":[[614,9]]},"707":{"position":[[614,9]]}},"keywords":{}}],["odra::address",{"_index":3075,"title":{},"content":{"354":{"position":[[233,14]]},"375":{"position":[[215,14]]},"383":{"position":[[319,14]]},"395":{"position":[[464,14]]},"452":{"position":[[258,14]]},"477":{"position":[[1517,14]]},"570":{"position":[[233,14]]},"591":{"position":[[215,14]]},"625":{"position":[[319,14]]},"632":{"position":[[464,14]]},"692":{"position":[[258,14]]},"699":{"position":[[1517,14]]}},"keywords":{}}],["odra::address.vari",{"_index":2819,"title":{},"content":{"267":{"position":[[402,22]]},"407":{"position":[[402,22]]},"644":{"position":[[402,22]]}},"keywords":{}}],["odra::casper_typ",{"_index":2817,"title":{},"content":{"267":{"position":[[348,18],[596,23]]},"407":{"position":[[348,18],[596,23]]},"644":{"position":[[348,18],[596,23]]}},"keywords":{}}],["odra::casper_types::bytesrepr::byt",{"_index":2830,"title":{},"content":{"267":{"position":[[743,37]]},"407":{"position":[[743,37]]},"644":{"position":[[743,37]]}},"keywords":{}}],["odra::casper_types::u256",{"_index":3122,"title":{},"content":{"395":{"position":[[373,25]]},"613":{"position":[[93,25]]},"632":{"position":[[373,25]]},"721":{"position":[[93,25]]}},"keywords":{}}],["odra::casper_types::u512.blocktim",{"_index":2828,"title":{},"content":{"267":{"position":[[682,34]]},"407":{"position":[[682,34]]},"644":{"position":[[682,34]]}},"keywords":{}}],["odra::casper_types::u512::from(100",{"_index":3069,"title":{},"content":{"346":{"position":[[308,37]]}},"keywords":{}}],["odra::casper_types::{asymmetrictyp",{"_index":3565,"title":{},"content":{"477":{"position":[[1421,36]]},"699":{"position":[[1421,36]]}},"keywords":{}}],["odra::contract_env.remov",{"_index":2821,"title":{},"content":{"267":{"position":[[443,25]]},"407":{"position":[[443,25]]},"644":{"position":[[443,25]]}},"keywords":{}}],["odra::contractcallresult",{"_index":2919,"title":{},"content":{"268":{"position":[[1933,24]]},"408":{"position":[[1933,24]]},"645":{"position":[[1933,24]]}},"keywords":{}}],["odra::contractenv::caller()th",{"_index":2130,"title":{},"content":{"168":{"position":[[1410,30]]},"348":{"position":[[1410,30]]},"564":{"position":[[1410,30]]}},"keywords":{}}],["odra::ev",{"_index":2345,"title":{},"content":{"196":{"position":[[1474,12]]},"204":{"position":[[17,12]]},"267":{"position":[[1535,12]]},"283":{"position":[[874,15]]},"321":{"position":[[2036,14],[2172,14]]},"375":{"position":[[263,14],[363,14],[463,14]]},"383":{"position":[[994,14],[1094,14]]},"384":{"position":[[3385,14],[3505,14]]},"407":{"position":[[1535,12]]},"424":{"position":[[823,14]]},"425":{"position":[[2031,14]]},"432":{"position":[[367,14],[1414,14]]},"440":{"position":[[576,14],[674,14]]},"452":{"position":[[362,14],[420,14]]},"476":{"position":[[1724,14],[1823,14]]},"495":{"position":[[874,15]]},"539":{"position":[[2036,14],[2172,14]]},"591":{"position":[[263,14],[363,14],[463,14]]},"610":{"position":[[46,14],[114,14],[539,14]]},"625":{"position":[[994,14],[1094,14]]},"626":{"position":[[3385,14],[3505,14]]},"644":{"position":[[1535,12]]},"666":{"position":[[823,14]]},"667":{"position":[[2031,14]]},"679":{"position":[[367,14],[1414,14]]},"687":{"position":[[576,14],[674,14]]},"692":{"position":[[362,14],[420,14]]},"698":{"position":[[1724,14],[1823,14]]},"718":{"position":[[46,14],[114,14],[539,14]]}},"keywords":{}}],["odra::external_contract",{"_index":1943,"title":{},"content":{"141":{"position":[[1212,26]]},"267":{"position":[[3836,26]]},"326":{"position":[[1212,26]]},"407":{"position":[[3836,26]]},"535":{"position":[[1212,26]]},"644":{"position":[[3836,26]]}},"keywords":{}}],["odra::host::deploy",{"_index":1904,"title":{},"content":{"138":{"position":[[258,21]]},"198":{"position":[[1857,20]]},"419":{"position":[[6522,21]]},"434":{"position":[[1847,20]]},"656":{"position":[[6522,21]]},"681":{"position":[[1857,20]]}},"keywords":{}}],["odra::host::deployer.instanti",{"_index":2900,"title":{},"content":{"268":{"position":[[442,32]]},"408":{"position":[[442,32]]},"645":{"position":[[442,32]]}},"keywords":{}}],["odra::host::deployer::deploy",{"_index":2403,"title":{},"content":{"198":{"position":[[1961,30]]},"268":{"position":[[527,30]]},"408":{"position":[[527,30]]},"434":{"position":[[1951,30]]},"645":{"position":[[527,30]]},"681":{"position":[[1961,30]]}},"keywords":{}}],["odra::host::noarg",{"_index":2902,"title":{},"content":{"268":{"position":[[622,18]]},"408":{"position":[[622,18]]},"645":{"position":[[622,18]]}},"keywords":{}}],["odra::host::{deploy",{"_index":1964,"title":{},"content":{"143":{"position":[[207,22]]},"148":{"position":[[76,22]]},"151":{"position":[[160,22]]},"157":{"position":[[200,22]]},"178":{"position":[[1082,22]]},"198":{"position":[[54,22]]},"223":{"position":[[841,22]]},"268":{"position":[[895,22],[1112,22]]},"328":{"position":[[207,22]]},"330":{"position":[[200,22]]},"336":{"position":[[76,22]]},"342":{"position":[[160,22]]},"369":{"position":[[1082,22]]},"395":{"position":[[403,22]]},"408":{"position":[[895,22],[1112,22]]},"434":{"position":[[54,22]]},"456":{"position":[[841,22]]},"477":{"position":[[1480,22]]},"537":{"position":[[207,22]]},"547":{"position":[[200,22]]},"553":{"position":[[76,22]]},"556":{"position":[[160,22]]},"585":{"position":[[1082,22]]},"632":{"position":[[403,22]]},"645":{"position":[[895,22],[1112,22]]},"681":{"position":[[54,22]]},"696":{"position":[[841,22]]},"699":{"position":[[1480,22]]}},"keywords":{}}],["odra::init",{"_index":2889,"title":{},"content":{"267":{"position":[[4046,13]]},"407":{"position":[[4046,13]]},"644":{"position":[[4046,13]]}},"keywords":{}}],["odra::modul",{"_index":338,"title":{},"content":{"10":{"position":[[699,15],[771,15]]},"17":{"position":[[245,13],[411,15],[597,15],[1939,15],[2193,15]]},"22":{"position":[[1074,15],[1142,15]]},"51":{"position":[[473,15],[543,15]]},"73":{"position":[[0,15],[75,15]]},"79":{"position":[[665,15],[802,15]]},"80":{"position":[[213,15]]},"84":{"position":[[198,15],[544,15]]},"104":{"position":[[127,15]]},"108":{"position":[[40,15]]},"115":{"position":[[192,15],[299,15],[1994,15],[2140,15]]},"141":{"position":[[286,15]]},"146":{"position":[[111,15],[409,15]]},"147":{"position":[[117,16],[134,15],[363,15]]},"148":{"position":[[643,16]]},"162":{"position":[[331,15],[729,15]]},"163":{"position":[[361,15]]},"164":{"position":[[154,15],[516,15]]},"178":{"position":[[125,15],[401,16],[418,15]]},"185":{"position":[[486,15]]},"196":{"position":[[49,15]]},"197":{"position":[[11,15]]},"198":{"position":[[1818,15]]},"204":{"position":[[34,15]]},"205":{"position":[[253,15]]},"209":{"position":[[801,15],[923,15],[1501,15],[1621,15]]},"221":{"position":[[497,12]]},"223":{"position":[[316,15],[423,15]]},"230":{"position":[[682,15],[819,15]]},"231":{"position":[[213,15]]},"237":{"position":[[0,15],[75,15]]},"246":{"position":[[203,15]]},"247":{"position":[[64,15]]},"253":{"position":[[198,15],[544,15]]},"258":{"position":[[182,15],[289,15],[1940,15],[2086,15]]},"269":{"position":[[522,15]]},"275":{"position":[[40,15]]},"296":{"position":[[127,15]]},"321":{"position":[[501,15],[1007,15]]},"326":{"position":[[286,15]]},"334":{"position":[[111,15],[409,15]]},"335":{"position":[[117,16],[134,15],[363,15]]},"336":{"position":[[643,16]]},"351":{"position":[[368,15],[751,15]]},"352":{"position":[[383,15]]},"353":{"position":[[189,15],[551,15]]},"369":{"position":[[125,15],[401,16],[418,15]]},"376":{"position":[[470,15]]},"383":{"position":[[606,15]]},"384":{"position":[[535,15]]},"388":{"position":[[733,15],[855,15],[1433,15],[1553,15]]},"409":{"position":[[522,15]]},"414":{"position":[[197,15]]},"416":{"position":[[369,15]]},"419":{"position":[[741,15],[1241,16],[1258,15]]},"424":{"position":[[9,15]]},"425":{"position":[[228,15]]},"432":{"position":[[11,15]]},"433":{"position":[[11,15]]},"434":{"position":[[1808,15]]},"440":{"position":[[900,15],[1114,15]]},"441":{"position":[[843,15],[2346,15],[2424,15]]},"445":{"position":[[203,15]]},"446":{"position":[[64,15]]},"454":{"position":[[497,12]]},"456":{"position":[[316,15],[423,15]]},"461":{"position":[[682,15],[819,15]]},"462":{"position":[[213,15]]},"473":{"position":[[0,15],[75,15]]},"476":{"position":[[399,15]]},"481":{"position":[[182,15],[289,15],[1940,15],[2086,15]]},"484":{"position":[[198,15],[544,15]]},"492":{"position":[[40,15]]},"508":{"position":[[127,15]]},"535":{"position":[[286,15]]},"539":{"position":[[501,15],[1007,15]]},"551":{"position":[[111,15],[409,15]]},"552":{"position":[[117,16],[134,15],[363,15]]},"553":{"position":[[643,16]]},"567":{"position":[[368,15],[751,15]]},"568":{"position":[[383,15]]},"569":{"position":[[189,15],[551,15]]},"585":{"position":[[125,15],[401,16],[418,15]]},"592":{"position":[[470,15]]},"596":{"position":[[205,15],[273,15],[651,12]]},"598":{"position":[[150,15],[644,15]]},"599":{"position":[[78,15],[116,15]]},"600":{"position":[[62,15],[154,15]]},"601":{"position":[[63,15],[161,15],[625,15],[729,15],[1140,15],[1290,15]]},"602":{"position":[[159,15],[222,15],[1045,15],[1258,15]]},"605":{"position":[[28,15],[89,15]]},"606":{"position":[[28,15],[120,15]]},"607":{"position":[[150,17]]},"608":{"position":[[87,15],[153,15]]},"610":{"position":[[154,15],[184,15]]},"611":{"position":[[158,15],[192,15]]},"612":{"position":[[462,15],[492,15],[584,15],[639,15],[731,15],[786,15],[878,15],[956,15],[1035,15],[1113,15],[1192,15],[1271,15]]},"613":{"position":[[314,15],[347,15],[838,15],[908,15]]},"616":{"position":[[112,15],[153,15],[507,15],[585,15]]},"617":{"position":[[68,15],[143,15],[608,15],[650,15]]},"625":{"position":[[606,15]]},"626":{"position":[[535,15]]},"646":{"position":[[522,15]]},"651":{"position":[[197,15]]},"653":{"position":[[369,15]]},"656":{"position":[[741,15],[1241,16],[1258,15]]},"658":{"position":[[733,15],[855,15],[1433,15],[1553,15]]},"666":{"position":[[9,15]]},"667":{"position":[[228,15]]},"672":{"position":[[203,15]]},"673":{"position":[[64,15]]},"679":{"position":[[11,15]]},"680":{"position":[[11,15]]},"681":{"position":[[1818,15]]},"687":{"position":[[900,15],[1114,15]]},"688":{"position":[[843,15],[2346,15],[2424,15]]},"694":{"position":[[497,12]]},"696":{"position":[[316,15],[423,15]]},"698":{"position":[[399,15]]},"704":{"position":[[205,15],[273,15],[651,12]]},"706":{"position":[[150,15],[644,15]]},"707":{"position":[[78,15],[116,15]]},"708":{"position":[[62,15],[154,15]]},"709":{"position":[[63,15],[161,15],[625,15],[729,15],[1140,15],[1290,15]]},"710":{"position":[[159,15],[222,15],[1045,15],[1258,15]]},"713":{"position":[[28,15],[89,15]]},"714":{"position":[[28,15],[120,15]]},"715":{"position":[[150,17]]},"716":{"position":[[87,15],[153,15]]},"718":{"position":[[154,15],[184,15]]},"719":{"position":[[158,15],[192,15]]},"720":{"position":[[462,15],[492,15],[584,15],[639,15],[731,15],[786,15],[878,15],[956,15],[1035,15],[1113,15],[1192,15],[1271,15]]},"721":{"position":[[314,15],[347,15],[838,15],[908,15]]},"724":{"position":[[112,15],[153,15],[507,15],[585,15]]},"725":{"position":[[68,15],[143,15],[608,15],[650,15]]}},"keywords":{}}],["odra::module(error",{"_index":3480,"title":{},"content":{"441":{"position":[[738,21]]},"476":{"position":[[185,21]]},"688":{"position":[[738,21]]},"698":{"position":[[185,21]]}},"keywords":{}}],["odra::module(ev",{"_index":1587,"title":{},"content":{"91":{"position":[[947,21]]},"185":{"position":[[303,21]]},"195":{"position":[[59,21],[311,21]]},"203":{"position":[[86,21]]},"220":{"position":[[144,21]]},"267":{"position":[[887,21],[1033,21],[3299,21]]},"269":{"position":[[254,21]]},"283":{"position":[[945,21]]},"376":{"position":[[287,21]]},"383":{"position":[[644,21]]},"384":{"position":[[251,21]]},"407":{"position":[[887,21],[1033,21],[3299,21]]},"409":{"position":[[254,21]]},"423":{"position":[[86,21]]},"431":{"position":[[59,21],[311,21]]},"453":{"position":[[144,21]]},"495":{"position":[[945,21]]},"592":{"position":[[287,21]]},"625":{"position":[[644,21]]},"626":{"position":[[251,21]]},"644":{"position":[[887,21],[1033,21],[3299,21]]},"646":{"position":[[254,21]]},"665":{"position":[[86,21]]},"678":{"position":[[59,21],[311,21]]},"693":{"position":[[144,21]]}},"keywords":{}}],["odra::module::submodul",{"_index":2755,"title":{},"content":{"246":{"position":[[178,24]]},"445":{"position":[[178,24]]},"672":{"position":[[178,24]]}},"keywords":{}}],["odra::module].l3",{"_index":3324,"title":{},"content":{"432":{"position":[[592,18]]},"679":{"position":[[592,18]]}},"keywords":{}}],["odra::module].l9",{"_index":2331,"title":{},"content":{"196":{"position":[[655,18]]}},"keywords":{}}],["odra::module]impl",{"_index":1934,"title":{},"content":{"141":{"position":[[577,21]]},"326":{"position":[[577,21]]},"535":{"position":[[577,21]]}},"keywords":{}}],["odra::odra_error",{"_index":2979,"title":{},"content":{"321":{"position":[[1842,19]]},"375":{"position":[[881,19]]},"383":{"position":[[525,19],[740,19]]},"384":{"position":[[3621,19]]},"419":{"position":[[322,19]]},"425":{"position":[[2128,19]]},"432":{"position":[[297,19],[901,19]]},"433":{"position":[[663,19]]},"440":{"position":[[754,19]]},"441":{"position":[[672,19],[2260,19]]},"452":{"position":[[273,19]]},"476":{"position":[[1602,19]]},"539":{"position":[[1842,19]]},"591":{"position":[[881,19]]},"611":{"position":[[65,19],[873,19]]},"613":{"position":[[454,19]]},"625":{"position":[[525,19],[740,19]]},"626":{"position":[[3621,19]]},"656":{"position":[[322,19]]},"667":{"position":[[2128,19]]},"679":{"position":[[297,19],[901,19]]},"680":{"position":[[663,19]]},"687":{"position":[[754,19]]},"688":{"position":[[672,19],[2260,19]]},"692":{"position":[[273,19]]},"698":{"position":[[1602,19]]},"719":{"position":[[65,19],[873,19]]},"721":{"position":[[454,19]]}},"keywords":{}}],["odra::odra_typ",{"_index":2749,"title":{},"content":{"230":{"position":[[254,18]]},"321":{"position":[[1700,18]]},"354":{"position":[[160,18],[248,18],[705,18]]},"383":{"position":[[274,18],[334,18]]},"388":{"position":[[514,18],[618,18]]},"416":{"position":[[794,18]]},"419":{"position":[[206,18]]},"440":{"position":[[414,18],[476,18]]},"461":{"position":[[254,18]]},"539":{"position":[[1700,18]]},"570":{"position":[[160,18],[248,18],[705,18]]},"602":{"position":[[42,18],[573,18],[975,18],[1908,18]]},"625":{"position":[[274,18],[334,18]]},"653":{"position":[[794,18]]},"656":{"position":[[206,18]]},"658":{"position":[[514,18],[618,18]]},"687":{"position":[[414,18],[476,18]]},"710":{"position":[[42,18],[573,18],[975,18],[1908,18]]}},"keywords":{}}],["odra::odraerror",{"_index":2197,"title":{},"content":{"184":{"position":[[966,16]]},"205":{"position":[[236,16]]},"267":{"position":[[1276,16]]},"269":{"position":[[3639,16]]},"407":{"position":[[1276,16]]},"409":{"position":[[3639,16]]},"644":{"position":[[1276,16]]},"646":{"position":[[3639,16]]}},"keywords":{}}],["odra::odratyp",{"_index":1441,"title":{},"content":{"79":{"position":[[251,15]]}},"keywords":{}}],["odra::prelud",{"_index":1449,"title":{},"content":{"79":{"position":[[611,17]]},"80":{"position":[[168,17]]},"138":{"position":[[284,17]]},"184":{"position":[[193,17]]},"185":{"position":[[165,17]]},"195":{"position":[[15,17]]},"203":{"position":[[13,17]]},"219":{"position":[[236,17]]},"230":{"position":[[628,17]]},"231":{"position":[[168,17]]},"246":{"position":[[156,17]]},"267":{"position":[[804,16],[1513,17]]},"269":{"position":[[181,17],[3285,17]]},"321":{"position":[[457,17]]},"351":{"position":[[335,17]]},"352":{"position":[[339,17]]},"375":{"position":[[193,17]]},"376":{"position":[[165,17]]},"383":{"position":[[1035,17]]},"384":{"position":[[178,17],[3326,17]]},"407":{"position":[[804,16],[1513,17]]},"409":{"position":[[181,17],[3285,17]]},"423":{"position":[[13,17]]},"431":{"position":[[15,17]]},"445":{"position":[[156,17]]},"452":{"position":[[236,17]]},"461":{"position":[[628,17]]},"462":{"position":[[168,17]]},"476":{"position":[[112,17]]},"539":{"position":[[457,17]]},"567":{"position":[[335,17]]},"568":{"position":[[339,17]]},"591":{"position":[[193,17]]},"592":{"position":[[165,17]]},"625":{"position":[[1035,17]]},"626":{"position":[[178,17],[3326,17]]},"644":{"position":[[804,16],[1513,17]]},"646":{"position":[[181,17],[3285,17]]},"665":{"position":[[13,17]]},"672":{"position":[[156,17]]},"678":{"position":[[15,17]]},"692":{"position":[[236,17]]},"698":{"position":[[112,17]]}},"keywords":{}}],["odra::submodul",{"_index":2733,"title":{},"content":{"223":{"position":[[295,16]]},"456":{"position":[[295,16]]},"696":{"position":[[295,16]]}},"keywords":{}}],["odra::submodule<t>",{"_index":2879,"title":{},"content":{"267":{"position":[[3262,26]]},"407":{"position":[[3262,26]]},"644":{"position":[[3262,26]]}},"keywords":{}}],["odra::test_env",{"_index":2909,"title":{},"content":{"268":{"position":[[1424,14],[1472,14]]},"408":{"position":[[1424,14],[1472,14]]},"645":{"position":[[1424,14],[1472,14]]}},"keywords":{}}],["odra::test_env::get_account(1",{"_index":1085,"title":{},"content":{"42":{"position":[[2113,31]]}},"keywords":{}}],["odra::types::address",{"_index":1208,"title":{},"content":{"51":{"position":[[1125,21]]}},"keywords":{}}],["odra::types::casper_typ",{"_index":2825,"title":{},"content":{"267":{"position":[[563,29]]},"407":{"position":[[563,29]]},"644":{"position":[[563,29]]}},"keywords":{}}],["odra::types::event::odraevent.remov",{"_index":2822,"title":{},"content":{"267":{"position":[[469,36]]},"407":{"position":[[469,36]]},"644":{"position":[[469,36]]}},"keywords":{}}],["odra::types::odratyp",{"_index":2823,"title":{},"content":{"267":{"position":[[506,21]]},"407":{"position":[[506,21]]},"644":{"position":[[506,21]]}},"keywords":{}}],["odra::unwraporrevert",{"_index":2459,"title":{},"content":{"204":{"position":[[1502,21]]},"424":{"position":[[1452,21]]},"666":{"position":[[1452,21]]}},"keywords":{}}],["odra::var",{"_index":1986,"title":{},"content":{"145":{"position":[[15,10]]},"162":{"position":[[718,10]]},"178":{"position":[[15,10]]},"220":{"position":[[129,10]]},"333":{"position":[[15,10]]},"351":{"position":[[357,10]]},"369":{"position":[[15,10]]},"441":{"position":[[2245,10]]},"453":{"position":[[129,10]]},"550":{"position":[[15,10]]},"567":{"position":[[357,10]]},"585":{"position":[[15,10]]},"605":{"position":[[17,10]]},"606":{"position":[[17,10]]},"688":{"position":[[2245,10]]},"693":{"position":[[129,10]]},"713":{"position":[[17,10]]},"714":{"position":[[17,10]]}},"keywords":{}}],["odra::vari",{"_index":665,"title":{},"content":{"22":{"position":[[1058,15]]}},"keywords":{}}],["odra::{address",{"_index":1480,"title":{},"content":{"80":{"position":[[108,15]]},"143":{"position":[[994,15]]},"165":{"position":[[182,15]]},"184":{"position":[[215,15]]},"195":{"position":[[37,15]]},"203":{"position":[[35,15]]},"219":{"position":[[258,15]]},"231":{"position":[[108,15]]},"247":{"position":[[23,15]]},"321":{"position":[[479,15]]},"328":{"position":[[969,15]]},"376":{"position":[[187,15]]},"383":{"position":[[1057,15]]},"423":{"position":[[35,15]]},"431":{"position":[[37,15]]},"446":{"position":[[23,15]]},"462":{"position":[[108,15]]},"537":{"position":[[969,15]]},"539":{"position":[[479,15]]},"592":{"position":[[187,15]]},"625":{"position":[[1057,15]]},"665":{"position":[[35,15]]},"673":{"position":[[23,15]]},"678":{"position":[[37,15]]}},"keywords":{}}],["odra::{casper_types::u256",{"_index":1447,"title":{},"content":{"79":{"position":[[554,26]]},"206":{"position":[[56,26]]},"209":{"position":[[395,26]]},"230":{"position":[[571,26]]},"269":{"position":[[203,26],[3307,26]]},"384":{"position":[[200,26],[3348,26]]},"388":{"position":[[395,26]]},"409":{"position":[[203,26],[3307,26]]},"419":{"position":[[67,26]]},"426":{"position":[[56,26]]},"461":{"position":[[571,26]]},"600":{"position":[[17,26]]},"601":{"position":[[17,26]]},"613":{"position":[[17,26]]},"626":{"position":[[200,26],[3348,26]]},"646":{"position":[[203,26],[3307,26]]},"656":{"position":[[67,26]]},"658":{"position":[[395,26]]},"668":{"position":[[56,26]]},"708":{"position":[[17,26]]},"709":{"position":[[17,26]]},"721":{"position":[[17,26]]}},"keywords":{}}],["odra::{casper_types::u512",{"_index":2037,"title":{},"content":{"160":{"position":[[210,26]]},"345":{"position":[[210,26]]},"441":{"position":[[602,26]]},"476":{"position":[[134,26]]},"562":{"position":[[210,26]]},"608":{"position":[[17,26]]},"688":{"position":[[602,26]]},"698":{"position":[[134,26]]},"716":{"position":[[17,26]]}},"keywords":{}}],["odra::{casper_types::{account::accounthash",{"_index":3667,"title":{},"content":{"599":{"position":[[17,43]]},"707":{"position":[[17,43]]}},"keywords":{}}],["odra::{ev",{"_index":2323,"title":{},"content":{"196":{"position":[[19,13]]}},"keywords":{}}],["odra::{host::deploy",{"_index":2961,"title":{},"content":{"318":{"position":[[258,22]]},"544":{"position":[[258,22]]}},"keywords":{}}],["odra::{host::{deploy",{"_index":1394,"title":{},"content":{"73":{"position":[[480,23]]},"168":{"position":[[441,23]]},"237":{"position":[[480,23]]},"348":{"position":[[441,23]]},"473":{"position":[[480,23]]},"564":{"position":[[441,23]]}},"keywords":{}}],["odra::{list",{"_index":2097,"title":{},"content":{"163":{"position":[[1584,12]]},"352":{"position":[[1606,12]]},"568":{"position":[[1606,12]]}},"keywords":{}}],["odra::{map",{"_index":408,"title":{},"content":{"15":{"position":[[263,15]]},"163":{"position":[[339,15]]},"352":{"position":[[361,15]]},"568":{"position":[[361,15]]}},"keywords":{}}],["odra::{module::modul",{"_index":2209,"title":{},"content":{"185":{"position":[[187,22]]},"617":{"position":[[17,22]]},"725":{"position":[[17,22]]}},"keywords":{}}],["odra::{prelud",{"_index":3074,"title":{},"content":{"353":{"position":[[158,18]]},"569":{"position":[[158,18]]},"596":{"position":[[180,18]]},"601":{"position":[[1115,18]]},"602":{"position":[[17,18],[949,18]]},"610":{"position":[[17,18]]},"611":{"position":[[17,18]]},"612":{"position":[[431,18]]},"704":{"position":[[180,18]]},"709":{"position":[[1115,18]]},"710":{"position":[[17,18],[949,18]]},"718":{"position":[[17,18]]},"719":{"position":[[17,18]]},"720":{"position":[[431,18]]}},"keywords":{}}],["odra::{test_env",{"_index":1084,"title":{},"content":{"42":{"position":[[2026,16]]}},"keywords":{}}],["odra::{types::{address",{"_index":1193,"title":{},"content":{"51":{"position":[[365,23]]}},"keywords":{}}],["odra::{vari",{"_index":462,"title":{},"content":{"17":{"position":[[337,16],[1859,16]]}},"keywords":{}}],["odra:external_contract",{"_index":1940,"title":{},"content":{"141":{"position":[[918,25]]},"326":{"position":[[918,25]]},"535":{"position":[[918,25]]}},"keywords":{}}],["odra_backend=casp",{"_index":1345,"title":{},"content":{"67":{"position":[[144,19]]},"68":{"position":[[519,19]]},"242":{"position":[[145,19]]},"243":{"position":[[519,19]]},"467":{"position":[[145,19]]},"468":{"position":[[519,19]]}},"keywords":{}}],["odra_casper_livenet_chain_name=casp",{"_index":3168,"title":{},"content":{"395":{"position":[[3999,37]]},"477":{"position":[[2456,37]]},"632":{"position":[[3999,37]]},"699":{"position":[[2456,37]]}},"keywords":{}}],["odra_casper_livenet_chain_name=integr",{"_index":1803,"title":{},"content":{"126":{"position":[[846,42]]},"277":{"position":[[846,42]]},"514":{"position":[[846,42]]}},"keywords":{}}],["odra_casper_livenet_env",{"_index":1870,"title":{},"content":{"129":{"position":[[309,23]]},"280":{"position":[[309,23]]},"517":{"position":[[309,23]]}},"keywords":{}}],["odra_casper_livenet_env::env",{"_index":1809,"title":{},"content":{"126":{"position":[[1424,31]]},"277":{"position":[[1592,31]]},"346":{"position":[[124,31]]},"395":{"position":[[598,31]]},"477":{"position":[[1723,31]]},"514":{"position":[[1424,31]]},"632":{"position":[[598,31]]},"699":{"position":[[1723,31]]}},"keywords":{}}],["odra_casper_livenet_env=integr",{"_index":1874,"title":{},"content":{"129":{"position":[[548,35]]},"280":{"position":[[548,35]]},"517":{"position":[[548,35]]}},"keywords":{}}],["odra_casper_livenet_key_1=.keys/secret_key_1.pem",{"_index":1805,"title":{},"content":{"126":{"position":[[988,48]]},"277":{"position":[[988,48]]},"514":{"position":[[988,48]]}},"keywords":{}}],["odra_casper_livenet_key_2=.keys/secret_key_2.pem",{"_index":1806,"title":{},"content":{"126":{"position":[[1037,48]]},"277":{"position":[[1037,48]]},"514":{"position":[[1037,48]]}},"keywords":{}}],["odra_casper_livenet_node_address=http://138.201.80.141:7777",{"_index":3167,"title":{},"content":{"395":{"position":[[3910,59]]},"632":{"position":[[3910,59]]}},"keywords":{}}],["odra_casper_livenet_node_address=http://localhost:11101",{"_index":3580,"title":{},"content":{"477":{"position":[[2398,55]]},"699":{"position":[[2398,55]]}},"keywords":{}}],["odra_casper_livenet_node_address=localhost:7777",{"_index":1801,"title":{},"content":{"126":{"position":[[734,47]]},"277":{"position":[[734,47]]},"514":{"position":[[734,47]]}},"keywords":{}}],["odra_casper_livenet_secret_key_path=.keys/secret_key.pem",{"_index":1799,"title":{},"content":{"126":{"position":[[608,56]]},"277":{"position":[[608,56]]},"514":{"position":[[608,56]]}},"keywords":{}}],["odra_casper_livenet_secret_key_path=.nod",{"_index":3579,"title":{},"content":{"477":{"position":[[2334,41]]},"699":{"position":[[2334,41]]}},"keywords":{}}],["odra_casper_livenet_secret_key_path=folder_with_your_secret_key/secret_key_file.pem",{"_index":3166,"title":{},"content":{"395":{"position":[[3757,83]]},"632":{"position":[[3757,83]]}},"keywords":{}}],["odra_cfg_package_hash_key_nam",{"_index":1640,"title":{},"content":{"98":{"position":[[131,30],[319,30]]},"290":{"position":[[131,30],[319,30]]},"502":{"position":[[131,30],[319,30]]}},"keywords":{}}],["odra_error",{"_index":2963,"title":{},"content":{"321":{"position":[[155,10]]},"539":{"position":[[155,10]]}},"keywords":{}}],["odra_examples::contracts::tlw::timelockwallet",{"_index":3564,"title":{},"content":{"477":{"position":[[1320,47]]},"699":{"position":[[1320,47]]}},"keywords":{}}],["odra_examples::contracts::tlw::{timelockwallethostref",{"_index":3567,"title":{},"content":{"477":{"position":[[1536,54]]},"699":{"position":[[1536,54]]}},"keywords":{}}],["odra_modul",{"_index":1328,"title":{},"content":{"65":{"position":[[222,11]]},"240":{"position":[[222,11]]},"465":{"position":[[222,11]]}},"keywords":{}}],["odra_module=my_contract",{"_index":1324,"title":{},"content":{"65":{"position":[[71,23]]},"68":{"position":[[219,23]]},"240":{"position":[[71,23]]},"243":{"position":[[219,23]]},"465":{"position":[[71,23]]},"468":{"position":[[219,23]]}},"keywords":{}}],["odra_modules::access::own",{"_index":3345,"title":{},"content":{"440":{"position":[[220,30]]},"687":{"position":[[220,30]]}},"keywords":{}}],["odra_modules::cep18_token::cep18",{"_index":3291,"title":{},"content":{"419":{"position":[[142,33]]},"656":{"position":[[142,33]]}},"keywords":{}}],["odra_modules::cep78",{"_index":3346,"title":{},"content":{"440":{"position":[[255,22]]},"687":{"position":[[255,22]]}},"keywords":{}}],["odra_test::env",{"_index":1399,"title":{},"content":{"73":{"position":[[586,17]]},"138":{"position":[[349,17]]},"143":{"position":[[295,17],[1085,17]]},"148":{"position":[[142,17]]},"151":{"position":[[235,17]]},"157":{"position":[[300,17]]},"160":{"position":[[316,17]]},"168":{"position":[[531,17],[1196,17]]},"178":{"position":[[1148,17],[1484,17]]},"198":{"position":[[169,17],[1702,17]]},"206":{"position":[[321,17]]},"223":{"position":[[930,17]]},"237":{"position":[[586,17]]},"268":{"position":[[493,17],[964,17],[1164,17],[1491,16],[3025,17]]},"269":{"position":[[4225,17]]},"318":{"position":[[341,17]]},"328":{"position":[[295,17],[1060,17]]},"330":{"position":[[291,17]]},"336":{"position":[[142,17]]},"342":{"position":[[235,17]]},"345":{"position":[[316,17]]},"346":{"position":[[168,17]]},"348":{"position":[[531,17],[1196,17]]},"369":{"position":[[1148,17],[1484,17]]},"408":{"position":[[493,17],[964,17],[1164,17],[1491,16],[3025,17]]},"409":{"position":[[4225,17]]},"417":{"position":[[163,17]]},"419":{"position":[[6578,17]]},"426":{"position":[[321,17]]},"434":{"position":[[169,17],[1692,17]]},"440":{"position":[[4969,17]]},"441":{"position":[[4794,17]]},"456":{"position":[[930,17]]},"473":{"position":[[586,17]]},"537":{"position":[[295,17],[1060,17]]},"544":{"position":[[341,17]]},"547":{"position":[[300,17]]},"553":{"position":[[142,17]]},"556":{"position":[[235,17]]},"562":{"position":[[316,17]]},"564":{"position":[[531,17],[1196,17]]},"585":{"position":[[1148,17],[1484,17]]},"645":{"position":[[493,17],[964,17],[1164,17],[1491,16],[3025,17]]},"646":{"position":[[4225,17]]},"654":{"position":[[163,17]]},"656":{"position":[[6578,17]]},"668":{"position":[[321,17]]},"681":{"position":[[169,17],[1702,17]]},"687":{"position":[[4969,17]]},"688":{"position":[[4794,17]]},"696":{"position":[[930,17]]}},"keywords":{}}],["odra_test::env().th",{"_index":2910,"title":{},"content":{"268":{"position":[[1444,20]]},"408":{"position":[[1444,20]]},"645":{"position":[[1444,20]]}},"keywords":{}}],["odra_typ",{"_index":2964,"title":{},"content":{"321":{"position":[[170,10]]},"354":{"position":[[351,12]]},"539":{"position":[[170,10]]},"570":{"position":[[351,12]]}},"keywords":{}}],["odraerror",{"_index":1924,"title":{},"content":{"138":{"position":[[1208,10],[1258,9]]},"196":{"position":[[33,11],[963,9]]},"198":{"position":[[3964,9]]},"219":{"position":[[281,11]]},"267":{"position":[[1238,9]]},"318":{"position":[[1200,10],[1250,9]]},"407":{"position":[[1238,9]]},"434":{"position":[[3946,9]]},"544":{"position":[[1200,10],[1250,9]]},"644":{"position":[[1238,9]]},"681":{"position":[[3964,9]]}},"keywords":{}}],["odraerror>",{"_index":2422,"title":{},"content":{"198":{"position":[[3732,14]]},"434":{"position":[[3714,14]]},"681":{"position":[[3732,14]]}},"keywords":{}}],["odraevent>(ev",{"_index":2868,"title":{},"content":{"267":{"position":[[2823,20]]},"407":{"position":[[2823,20]]},"644":{"position":[[2823,20]]}},"keywords":{}}],["odraevent>::emit(init",{"_index":1198,"title":{},"content":{"51":{"position":[[664,24]]}},"keywords":{}}],["odrapars",{"_index":1020,"title":{},"content":{"40":{"position":[[277,11]]}},"keywords":{}}],["odraresult",{"_index":2420,"title":{},"content":{"198":{"position":[[3694,10]]},"268":{"position":[[2260,10]]},"408":{"position":[[2260,10]]},"434":{"position":[[3676,10]]},"441":{"position":[[4616,11]]},"645":{"position":[[2260,10]]},"681":{"position":[[3694,10]]},"688":{"position":[[4616,11]]}},"keywords":{}}],["odraresult<()>",{"_index":3534,"title":{},"content":{"441":{"position":[[5799,20]]},"688":{"position":[[5799,20]]}},"keywords":{}}],["odraresult.ownedcontracthostref",{"_index":1918,"title":{},"content":{"138":{"position":[[875,31]]},"318":{"position":[[867,31]]},"544":{"position":[[867,31]]}},"keywords":{}}],["odrasolid",{"_index":3613,"title":{},"content":{"596":{"position":[[163,12]]},"598":{"position":[[0,12]]},"599":{"position":[[0,12]]},"600":{"position":[[0,12]]},"601":{"position":[[0,12],[1098,12]]},"602":{"position":[[0,12],[932,12]]},"605":{"position":[[0,12]]},"606":{"position":[[0,12]]},"607":{"position":[[124,12]]},"608":{"position":[[0,12]]},"610":{"position":[[0,12]]},"611":{"position":[[0,12]]},"612":{"position":[[414,12]]},"613":{"position":[[0,12]]},"616":{"position":[[0,12]]},"617":{"position":[[0,12]]},"704":{"position":[[163,12]]},"706":{"position":[[0,12]]},"707":{"position":[[0,12]]},"708":{"position":[[0,12]]},"709":{"position":[[0,12],[1098,12]]},"710":{"position":[[0,12],[932,12]]},"713":{"position":[[0,12]]},"714":{"position":[[0,12]]},"715":{"position":[[124,12]]},"716":{"position":[[0,12]]},"718":{"position":[[0,12]]},"719":{"position":[[0,12]]},"720":{"position":[[414,12]]},"721":{"position":[[0,12]]},"724":{"position":[[0,12]]},"725":{"position":[[0,12]]}},"keywords":{}}],["odratyp",{"_index":1432,"title":{},"content":{"78":{"position":[[228,8]]},"165":{"position":[[168,9],[198,10],[355,9]]},"209":{"position":[[443,9]]}},"keywords":{}}],["odravm",{"_index":1693,"title":{"105":{"position":[[0,6]]},"272":{"position":[[0,6]]},"489":{"position":[[0,6]]}},"content":{"104":{"position":[[68,6]]},"106":{"position":[[4,6]]},"107":{"position":[[0,6],[135,7],[230,7],[333,6],[382,7],[461,6]]},"108":{"position":[[9,6],[296,6]]},"119":{"position":[[585,6],[637,6]]},"126":{"position":[[1356,6],[1516,6],[2308,6],[2524,6]]},"175":{"position":[[354,7]]},"273":{"position":[[4,6]]},"274":{"position":[[0,6],[135,7],[230,7],[333,6],[382,7],[461,6]]},"275":{"position":[[9,6],[300,6]]},"277":{"position":[[1524,6],[1684,6],[2476,6],[2692,6]]},"296":{"position":[[68,6]]},"300":{"position":[[585,6],[637,6]]},"361":{"position":[[354,7]]},"417":{"position":[[88,6]]},"490":{"position":[[4,6]]},"491":{"position":[[0,6],[135,7],[230,7],[333,6],[382,7],[461,6]]},"492":{"position":[[9,6],[300,6]]},"508":{"position":[[68,6]]},"514":{"position":[[1356,6],[1516,6],[2308,6],[2524,6]]},"521":{"position":[[585,6],[637,6]]},"577":{"position":[[354,7]]},"654":{"position":[[88,6]]}},"keywords":{}}],["offer",{"_index":103,"title":{},"content":{"2":{"position":[[278,5]]},"21":{"position":[[141,6]]},"81":{"position":[[34,5],[131,6]]},"232":{"position":[[34,5],[131,6]]},"270":{"position":[[295,6]]},"385":{"position":[[295,6]]},"410":{"position":[[295,6]]},"463":{"position":[[34,5],[131,6]]},"627":{"position":[[295,6]]},"647":{"position":[[295,6]]}},"keywords":{}}],["offic",{"_index":3333,"title":{"438":{"position":[[7,6]]},"685":{"position":[[7,6]]}},"content":{"439":{"position":[[165,6]]},"441":{"position":[[211,6],[406,7],[1906,6],[1970,6]]},"686":{"position":[[165,6]]},"688":{"position":[[211,6],[406,7],[1906,6],[1970,6]]}},"keywords":{}}],["office.l16",{"_index":3493,"title":{},"content":{"441":{"position":[[1738,10]]},"688":{"position":[[1738,10]]}},"keywords":{}}],["office.l20",{"_index":3494,"title":{},"content":{"441":{"position":[[1811,10]]},"688":{"position":[[1811,10]]}},"keywords":{}}],["offlin",{"_index":1865,"title":{},"content":{"128":{"position":[[301,7],[584,7]]},"279":{"position":[[301,7],[584,7]]},"516":{"position":[[301,7],[584,7]]}},"keywords":{}}],["oh",{"_index":3136,"title":{},"content":{"395":{"position":[[1349,2]]},"632":{"position":[[1349,2]]}},"keywords":{}}],["ok",{"_index":357,"title":{},"content":{"10":{"position":[[1345,6]]},"11":{"position":[[79,3]]},"52":{"position":[[1739,3]]},"196":{"position":[[540,3]]},"432":{"position":[[477,3]]},"440":{"position":[[5583,6],[5663,6]]},"441":{"position":[[5503,8],[5557,8]]},"617":{"position":[[1219,4]]},"679":{"position":[[477,3]]},"687":{"position":[[5583,6],[5663,6]]},"688":{"position":[[5503,8],[5557,8]]},"725":{"position":[[1219,4]]}},"keywords":{}}],["ok(parse_quote!(#b",{"_index":1008,"title":{},"content":{"39":{"position":[[3117,21]]}},"keywords":{}}],["ok(parse_quote!(#expr",{"_index":999,"title":{},"content":{"39":{"position":[[2842,21]]}},"keywords":{}}],["ok(parse_quote!(#ti",{"_index":1006,"title":{},"content":{"39":{"position":[[3060,21]]}},"keywords":{}}],["ok(parse_quote!(non",{"_index":989,"title":{},"content":{"39":{"position":[[2610,23]]}},"keywords":{}}],["ok(success",{"_index":3913,"title":{},"content":{"617":{"position":[[454,11]]},"725":{"position":[[454,11]]}},"keywords":{}}],["ok(tru",{"_index":3919,"title":{},"content":{"617":{"position":[[750,8]]},"725":{"position":[[750,8]]}},"keywords":{}}],["okay",{"_index":1898,"title":{},"content":{"138":{"position":[[0,5]]},"318":{"position":[[0,5]]},"544":{"position":[[0,5]]}},"keywords":{}}],["old_valu",{"_index":1200,"title":{},"content":{"51":{"position":[[742,9],[799,9],[856,10],[1200,10]]},"53":{"position":[[833,9],[1331,10]]}},"keywords":{}}],["omit",{"_index":3547,"title":{},"content":{"476":{"position":[[1274,7],[1416,7],[1521,7]]},"698":{"position":[[1274,7],[1416,7],[1521,7]]}},"keywords":{}}],["on",{"_index":72,"title":{},"content":{"1":{"position":[[916,3]]},"3":{"position":[[700,3]]},"10":{"position":[[156,3]]},"15":{"position":[[163,3],[433,3]]},"20":{"position":[[329,3],[589,3],[843,3]]},"30":{"position":[[88,3],[109,3]]},"38":{"position":[[410,4]]},"39":{"position":[[855,3]]},"42":{"position":[[846,4]]},"53":{"position":[[82,3]]},"74":{"position":[[32,3]]},"78":{"position":[[222,3]]},"92":{"position":[[387,3]]},"95":{"position":[[256,3]]},"101":{"position":[[30,3]]},"104":{"position":[[56,3]]},"117":{"position":[[54,3],[94,3],[773,3]]},"119":{"position":[[76,4]]},"126":{"position":[[213,3]]},"136":{"position":[[178,3]]},"148":{"position":[[805,3]]},"162":{"position":[[1826,3]]},"163":{"position":[[671,3],[706,3]]},"196":{"position":[[596,3],[603,4]]},"197":{"position":[[1490,3]]},"198":{"position":[[2064,3],[2147,5],[2726,3]]},"229":{"position":[[222,3]]},"238":{"position":[[32,3]]},"277":{"position":[[213,3]]},"284":{"position":[[387,3]]},"287":{"position":[[256,3]]},"293":{"position":[[30,3]]},"296":{"position":[[56,3]]},"298":{"position":[[54,3],[94,3],[773,3]]},"300":{"position":[[76,4]]},"316":{"position":[[178,3]]},"336":{"position":[[805,3]]},"351":{"position":[[1848,3]]},"352":{"position":[[693,3],[728,3]]},"394":{"position":[[340,3]]},"395":{"position":[[4177,3]]},"396":{"position":[[964,3],[1132,3]]},"413":{"position":[[140,4]]},"417":{"position":[[49,3],[553,3]]},"419":{"position":[[1789,3],[1815,3],[6968,3]]},"432":{"position":[[533,3],[540,4]]},"433":{"position":[[1489,3]]},"434":{"position":[[2054,3],[2137,5],[2716,3]]},"438":{"position":[[229,3]]},"460":{"position":[[222,3]]},"474":{"position":[[32,3]]},"496":{"position":[[387,3]]},"499":{"position":[[256,3]]},"505":{"position":[[30,3]]},"508":{"position":[[56,3]]},"514":{"position":[[213,3]]},"519":{"position":[[54,3],[94,3],[773,3]]},"521":{"position":[[76,4]]},"533":{"position":[[178,3]]},"553":{"position":[[805,3]]},"567":{"position":[[1848,3]]},"568":{"position":[[693,3],[728,3]]},"601":{"position":[[2103,3]]},"611":{"position":[[663,3]]},"612":{"position":[[292,3],[1446,3],[2014,3]]},"631":{"position":[[340,3]]},"632":{"position":[[4177,3]]},"633":{"position":[[964,3],[1132,3]]},"650":{"position":[[140,4]]},"654":{"position":[[49,3],[553,3]]},"656":{"position":[[1789,3],[1815,3],[6968,3]]},"679":{"position":[[533,3],[540,4]]},"680":{"position":[[1489,3]]},"681":{"position":[[2064,3],[2147,5],[2726,3]]},"685":{"position":[[229,3]]},"709":{"position":[[2103,3]]},"719":{"position":[[663,3]]},"720":{"position":[[292,3],[1446,3],[2014,3]]}},"keywords":{}}],["onc",{"_index":1272,"title":{},"content":{"52":{"position":[[2010,4],[6536,6]]},"194":{"position":[[128,5]]},"196":{"position":[[1335,4]]},"198":{"position":[[2560,4]]},"268":{"position":[[0,4],[2868,5]]},"394":{"position":[[376,5]]},"408":{"position":[[0,4],[2868,5]]},"416":{"position":[[3553,5]]},"419":{"position":[[5132,5]]},"430":{"position":[[128,5]]},"432":{"position":[[1277,4]]},"434":{"position":[[2550,4]]},"441":{"position":[[4026,4]]},"599":{"position":[[524,5]]},"631":{"position":[[376,5]]},"645":{"position":[[0,4],[2868,5]]},"653":{"position":[[3553,5]]},"656":{"position":[[5132,5]]},"677":{"position":[[128,5]]},"679":{"position":[[1277,4]]},"681":{"position":[[2560,4]]},"688":{"position":[[4026,4]]},"707":{"position":[[524,5]]}},"keywords":{}}],["once.l13",{"_index":2771,"title":{},"content":{"247":{"position":[[1665,8]]},"446":{"position":[[1665,8]]},"673":{"position":[[1665,8]]}},"keywords":{}}],["one_token",{"_index":2877,"title":{},"content":{"267":{"position":[[3188,11]]},"407":{"position":[[3188,11]]},"644":{"position":[[3188,11]]}},"keywords":{}}],["onlyown",{"_index":1124,"title":{},"content":{"43":{"position":[[432,9]]}},"keywords":{}}],["onlytokenholderscanpropos",{"_index":3297,"title":{},"content":{"419":{"position":[[607,26]]},"656":{"position":[[607,26]]}},"keywords":{}}],["onticketissu",{"_index":3358,"title":{},"content":{"440":{"position":[[602,13],[925,15],[3566,13],[4227,13]]},"687":{"position":[[602,13],[925,15],[3566,13],[4227,13]]}},"keywords":{}}],["onticketsel",{"_index":3360,"title":{},"content":{"440":{"position":[[700,12],[941,14],[3584,12],[4546,12]]},"687":{"position":[[700,12],[941,14],[3584,12],[4546,12]]}},"keywords":{}}],["onto",{"_index":639,"title":{},"content":{"21":{"position":[[362,4]]},"43":{"position":[[680,4],[896,4],[1718,4]]},"95":{"position":[[74,4]]},"107":{"position":[[126,4]]},"119":{"position":[[489,4]]},"141":{"position":[[818,4]]},"198":{"position":[[2586,4]]},"274":{"position":[[126,4]]},"287":{"position":[[74,4]]},"300":{"position":[[489,4]]},"326":{"position":[[818,4]]},"434":{"position":[[2576,4]]},"491":{"position":[[126,4]]},"499":{"position":[[74,4]]},"521":{"position":[[489,4]]},"535":{"position":[[818,4]]},"681":{"position":[[2586,4]]}},"keywords":{}}],["open",{"_index":24,"title":{},"content":{"1":{"position":[[243,4]]},"12":{"position":[[318,4]]},"22":{"position":[[308,4]]},"205":{"position":[[2314,4]]},"416":{"position":[[661,5],[1901,4],[2226,4]]},"419":{"position":[[1032,5],[4419,4]]},"425":{"position":[[2264,4]]},"653":{"position":[[661,5],[1901,4],[2226,4]]},"656":{"position":[[1032,5],[4419,4]]},"667":{"position":[[2264,4]]}},"keywords":{}}],["openai",{"_index":395,"title":{"14":{"position":[[0,6]]},"15":{"position":[[0,7]]}},"content":{"15":{"position":[[0,6],[174,6],[300,6]]},"16":{"position":[[0,6],[111,6]]},"17":{"position":[[1848,6]]}},"keywords":{}}],["openzeppelin",{"_index":680,"title":{},"content":{"23":{"position":[[238,13]]}},"keywords":{}}],["openzeppelin)and",{"_index":883,"title":{},"content":{"38":{"position":[[794,16]]}},"keywords":{}}],["oper",{"_index":1203,"title":{},"content":{"51":{"position":[[878,9],[1240,9]]},"53":{"position":[[909,8],[1356,9]]},"83":{"position":[[319,8]]},"84":{"position":[[958,9]]},"173":{"position":[[259,9]]},"252":{"position":[[319,8]]},"253":{"position":[[958,9]]},"267":{"position":[[2412,10]]},"359":{"position":[[259,9]]},"407":{"position":[[2412,10]]},"440":{"position":[[6191,8]]},"441":{"position":[[91,8],[171,8],[299,8],[382,8],[1421,8],[2392,9],[2504,9],[2559,8],[2687,8],[2952,8],[2988,8],[3310,8],[3478,8],[3820,8],[3912,9],[3965,8],[4067,8],[4174,9],[4231,8],[4306,8],[4345,8],[4366,8],[4972,8]]},"483":{"position":[[319,8]]},"484":{"position":[[958,9]]},"575":{"position":[[259,9]]},"644":{"position":[[2412,10]]},"687":{"position":[[6191,8]]},"688":{"position":[[91,8],[171,8],[299,8],[382,8],[1421,8],[2392,9],[2504,9],[2559,8],[2687,8],[2952,8],[2988,8],[3310,8],[3478,8],[3820,8],[3912,9],[3965,8],[4067,8],[4174,9],[4231,8],[4306,8],[4345,8],[4366,8],[4972,8]]}},"keywords":{}}],["operator'",{"_index":3485,"title":{},"content":{"441":{"position":[[1014,10],[2087,10]]},"688":{"position":[[1014,10],[2087,10]]}},"keywords":{}}],["operator(&self",{"_index":3510,"title":{},"content":{"441":{"position":[[3664,19]]},"688":{"position":[[3664,19]]}},"keywords":{}}],["operator).register(self.env().self_address",{"_index":3500,"title":{},"content":{"441":{"position":[[2748,46]]},"688":{"position":[[2748,46]]}},"keywords":{}}],["operator.with_tokens(u512::from(price)).try_buy_ticket(id",{"_index":3535,"title":{},"content":{"441":{"position":[[5822,58]]},"688":{"position":[[5822,58]]}},"keywords":{}}],["opinion",{"_index":165,"title":{},"content":{"5":{"position":[[6,8]]}},"keywords":{}}],["opposit",{"_index":1998,"title":{},"content":{"147":{"position":[[1181,8]]},"178":{"position":[[768,8]]},"185":{"position":[[3704,8]]},"335":{"position":[[1189,8]]},"369":{"position":[[768,8]]},"376":{"position":[[3688,8]]},"552":{"position":[[1189,8]]},"585":{"position":[[768,8]]},"592":{"position":[[3688,8]]}},"keywords":{}}],["opt",{"_index":935,"title":{},"content":{"39":{"position":[[988,4]]},"66":{"position":[[151,3],[179,3]]},"68":{"position":[[449,3]]},"131":{"position":[[509,3]]},"241":{"position":[[151,3],[179,3]]},"243":{"position":[[449,3]]},"265":{"position":[[919,3]]},"311":{"position":[[561,3]]},"395":{"position":[[3599,3]]},"405":{"position":[[919,3]]},"466":{"position":[[151,3],[179,3]]},"468":{"position":[[449,3]]},"528":{"position":[[561,3]]},"632":{"position":[[3599,3]]},"642":{"position":[[919,3]]}},"keywords":{}}],["opt_str",{"_index":1462,"title":{},"content":{"79":{"position":[[1052,10]]},"230":{"position":[[1069,10]]},"461":{"position":[[1069,10]]}},"keywords":{}}],["opt_string.unwrap_or_revert(&self.env",{"_index":1464,"title":{},"content":{"79":{"position":[[1108,44]]},"230":{"position":[[1125,44]]},"461":{"position":[[1125,44]]}},"keywords":{}}],["optim",{"_index":703,"title":{"66":{"position":[[0,10]]},"241":{"position":[[0,10]]},"466":{"position":[[0,10]]}},"content":{"30":{"position":[[505,8]]},"66":{"position":[[118,8]]},"241":{"position":[[118,8]]},"265":{"position":[[320,8]]},"405":{"position":[[320,8]]},"466":{"position":[[118,8]]},"642":{"position":[[320,8]]}},"keywords":{}}],["option",{"_index":1497,"title":{},"content":{"81":{"position":[[47,7]]},"97":{"position":[[243,6]]},"120":{"position":[[273,7],[336,7]]},"121":{"position":[[378,6]]},"126":{"position":[[151,11]]},"147":{"position":[[925,9]]},"162":{"position":[[1577,6]]},"165":{"position":[[59,8]]},"195":{"position":[[397,8]]},"232":{"position":[[47,7]]},"268":{"position":[[2987,8]]},"277":{"position":[[151,11]]},"289":{"position":[[243,6]]},"301":{"position":[[273,7],[336,7]]},"302":{"position":[[378,6]]},"324":{"position":[[180,8]]},"335":{"position":[[933,9]]},"351":{"position":[[1599,6]]},"354":{"position":[[59,8]]},"395":{"position":[[2880,8]]},"408":{"position":[[2987,8]]},"431":{"position":[[397,8]]},"440":{"position":[[1569,8]]},"463":{"position":[[47,7]]},"477":{"position":[[983,8]]},"501":{"position":[[243,6]]},"514":{"position":[[151,11]]},"522":{"position":[[273,7],[336,7]]},"523":{"position":[[378,6]]},"542":{"position":[[180,8]]},"552":{"position":[[933,9]]},"567":{"position":[[1599,6]]},"570":{"position":[[59,8]]},"601":{"position":[[383,6]]},"632":{"position":[[2880,8]]},"645":{"position":[[2987,8]]},"678":{"position":[[397,8]]},"687":{"position":[[1569,8]]},"699":{"position":[[983,8]]},"709":{"position":[[383,6]]}},"keywords":{}}],["option<address>",{"_index":488,"title":{},"content":{"17":{"position":[[1029,21]]},"39":{"position":[[2012,22],[2039,22]]},"165":{"position":[[288,21]]},"196":{"position":[[491,22]]},"197":{"position":[[1745,21]]},"204":{"position":[[919,22],[950,22]]},"267":{"position":[[1619,22],[1650,22]]},"269":{"position":[[3422,22],[3453,22]]},"354":{"position":[[326,21]]},"383":{"position":[[412,21],[1141,22],[1172,22]]},"384":{"position":[[3432,22],[3463,22]]},"407":{"position":[[1619,22],[1650,22]]},"409":{"position":[[3422,22],[3453,22]]},"424":{"position":[[870,22],[901,22]]},"432":{"position":[[428,22]]},"433":{"position":[[1744,21]]},"570":{"position":[[326,21]]},"598":{"position":[[1924,22]]},"625":{"position":[[412,21],[1141,22],[1172,22]]},"626":{"position":[[3432,22],[3463,22]]},"644":{"position":[[1619,22],[1650,22]]},"646":{"position":[[3422,22],[3453,22]]},"666":{"position":[[870,22],[901,22]]},"679":{"position":[[428,22]]},"680":{"position":[[1744,21]]},"706":{"position":[[1924,22]]}},"keywords":{}}],["option<bool>>",{"_index":3694,"title":{},"content":{"601":{"position":[[704,22]]},"709":{"position":[[704,22]]}},"keywords":{}}],["option<option<address>>",{"_index":2377,"title":{},"content":{"197":{"position":[[1795,36]]},"433":{"position":[[1794,36]]},"680":{"position":[[1794,36]]}},"keywords":{}}],["option<option<u256>>",{"_index":3688,"title":{},"content":{"601":{"position":[[293,32]]},"709":{"position":[[293,32]]}},"keywords":{}}],["option<t>",{"_index":2376,"title":{},"content":{"197":{"position":[[1549,16]]},"267":{"position":[[2082,15]]},"407":{"position":[[2082,15]]},"433":{"position":[[1548,16]]},"644":{"position":[[2082,15]]},"680":{"position":[[1548,16]]}},"keywords":{}}],["option<t>.fn",{"_index":2850,"title":{},"content":{"267":{"position":[[2171,18]]},"407":{"position":[[2171,18]]},"644":{"position":[[2171,18]]}},"keywords":{}}],["option<todo>",{"_index":3743,"title":{},"content":{"602":{"position":[[1803,18]]},"710":{"position":[[1803,18]]}},"keywords":{}}],["option<u256>",{"_index":2929,"title":{},"content":{"269":{"position":[[639,18]]},"384":{"position":[[652,18]]},"409":{"position":[[639,18]]},"626":{"position":[[652,18]]},"646":{"position":[[639,18]]}},"keywords":{}}],["option<u256>>",{"_index":3685,"title":{},"content":{"601":{"position":[[136,22]]},"709":{"position":[[136,22]]}},"keywords":{}}],["option<u512>",{"_index":2873,"title":{},"content":{"267":{"position":[[3026,19]]},"407":{"position":[[3026,19]]},"644":{"position":[[3026,19]]}},"keywords":{}}],["option<vec<u8>>",{"_index":1517,"title":{},"content":{"83":{"position":[[593,28]]},"252":{"position":[[593,28]]},"483":{"position":[[593,28]]}},"keywords":{}}],["or/and",{"_index":1988,"title":{},"content":{"146":{"position":[[89,6]]},"178":{"position":[[101,6]]},"334":{"position":[[89,6]]},"369":{"position":[[101,6]]},"419":{"position":[[719,6]]},"551":{"position":[[89,6]]},"585":{"position":[[101,6]]},"656":{"position":[[719,6]]}},"keywords":{}}],["order",{"_index":944,"title":{},"content":{"39":{"position":[[1212,5],[1450,5]]},"74":{"position":[[317,5]]},"76":{"position":[[819,7]]},"203":{"position":[[418,5]]},"227":{"position":[[819,7]]},"238":{"position":[[317,5]]},"423":{"position":[[418,5]]},"458":{"position":[[819,7]]},"474":{"position":[[317,5]]},"612":{"position":[[1546,5],[1679,6]]},"665":{"position":[[418,5]]},"720":{"position":[[1546,5],[1679,6]]}},"keywords":{}}],["orient",{"_index":1705,"title":{},"content":{"111":{"position":[[313,8]]},"306":{"position":[[313,8]]},"511":{"position":[[313,8]]}},"keywords":{}}],["origin",{"_index":747,"title":{},"content":{"31":{"position":[[1022,7]]},"42":{"position":[[1746,8]]}},"keywords":{}}],["osmosi",{"_index":1183,"title":{},"content":{"50":{"position":[[489,8]]}},"keywords":{}}],["ot",{"_index":3198,"title":{},"content":{"397":{"position":[[225,2]]},"634":{"position":[[225,2]]}},"keywords":{}}],["other",{"_index":2336,"title":{},"content":{"196":{"position":[[1030,7]]},"432":{"position":[[975,7]]},"679":{"position":[[975,7]]}},"keywords":{}}],["other_contract",{"_index":3907,"title":{},"content":{"617":{"position":[[105,15],[201,15]]},"725":{"position":[[105,15],[201,15]]}},"keywords":{}}],["othercontract",{"_index":3916,"title":{},"content":{"617":{"position":[[635,14],[671,13]]},"725":{"position":[[635,14],[671,13]]}},"keywords":{}}],["othercontractcontractref::new(self.env",{"_index":3911,"title":{},"content":{"617":{"position":[[374,41]]},"725":{"position":[[374,41]]}},"keywords":{}}],["otherwis",{"_index":2335,"title":{},"content":{"196":{"position":[[892,10]]},"432":{"position":[[830,10]]},"679":{"position":[[830,10]]}},"keywords":{}}],["our_token_livenet",{"_index":3171,"title":{},"content":{"395":{"position":[[4402,17]]},"632":{"position":[[4402,17]]}},"keywords":{}}],["ourcoin",{"_index":3205,"title":{},"content":{"414":{"position":[[126,7]]},"651":{"position":[[126,7]]}},"keywords":{}}],["ourcoin::token::{ourtokenhostref",{"_index":3124,"title":{},"content":{"395":{"position":[[483,33]]},"632":{"position":[[483,33]]}},"keywords":{}}],["ourselv",{"_index":1953,"title":{},"content":{"142":{"position":[[80,10]]},"327":{"position":[[80,10]]},"536":{"position":[[80,10]]}},"keywords":{}}],["ourtoken",{"_index":3120,"title":{},"content":{"395":{"position":[[254,8]]},"396":{"position":[[1120,8]]},"414":{"position":[[605,9]]},"416":{"position":[[396,8]]},"419":{"position":[[33,8],[768,8],[1279,8]]},"632":{"position":[[254,8]]},"633":{"position":[[1120,8]]},"651":{"position":[[605,9]]},"653":{"position":[[396,8]]},"656":{"position":[[33,8],[768,8],[1279,8]]}},"keywords":{}}],["ourtokenhostref",{"_index":3150,"title":{},"content":{"395":{"position":[[1815,15],[2256,15]]},"632":{"position":[[1815,15],[2256,15]]}},"keywords":{}}],["ourtokenhostref::deploy(&env",{"_index":3277,"title":{},"content":{"417":{"position":[[362,33]]},"419":{"position":[[6777,33]]},"654":{"position":[[362,33]]},"656":{"position":[[6777,33]]}},"keywords":{}}],["ourtokenhostref::deploy(env",{"_index":3154,"title":{},"content":{"395":{"position":[[2092,28]]},"632":{"position":[[2092,28]]}},"keywords":{}}],["ourtokenhostref::load(env",{"_index":3157,"title":{},"content":{"395":{"position":[[2363,26]]},"632":{"position":[[2363,26]]}},"keywords":{}}],["ourtokeninitarg",{"_index":3125,"title":{},"content":{"395":{"position":[[517,18],[1997,16]]},"417":{"position":[[197,16]]},"419":{"position":[[6612,16]]},"632":{"position":[[517,18],[1997,16]]},"654":{"position":[[197,16]]},"656":{"position":[[6612,16]]}},"keywords":{}}],["out",{"_index":89,"title":{},"content":{"1":{"position":[[1152,3]]},"15":{"position":[[594,3]]},"20":{"position":[[477,3]]},"24":{"position":[[6,3],[74,3]]},"26":{"position":[[52,3]]},"28":{"position":[[52,3]]},"36":{"position":[[52,3]]},"40":{"position":[[343,3]]},"43":{"position":[[619,3]]},"46":{"position":[[52,3]]},"48":{"position":[[52,3]]},"57":{"position":[[52,3]]},"59":{"position":[[52,3]]},"61":{"position":[[53,3]]},"63":{"position":[[53,3]]},"205":{"position":[[2334,3]]},"214":{"position":[[53,3]]},"216":{"position":[[53,3]]},"225":{"position":[[53,3]]},"270":{"position":[[105,3]]},"385":{"position":[[105,3]]},"394":{"position":[[393,3]]},"410":{"position":[[105,3]]},"419":{"position":[[2152,3]]},"425":{"position":[[2284,3]]},"449":{"position":[[53,3]]},"478":{"position":[[234,3]]},"627":{"position":[[105,3]]},"631":{"position":[[393,3]]},"647":{"position":[[105,3]]},"656":{"position":[[2152,3]]},"667":{"position":[[2284,3]]},"700":{"position":[[234,3]]}},"keywords":{}}],["outlin",{"_index":379,"title":{},"content":{"12":{"position":[[30,7]]}},"keywords":{}}],["output",{"_index":287,"title":{"323":{"position":[[7,7]]},"541":{"position":[[7,7]]}},"content":{"9":{"position":[[791,6],[886,6]]},"30":{"position":[[557,6]]},"42":{"position":[[382,6]]},"120":{"position":[[52,6]]},"127":{"position":[[229,6]]},"278":{"position":[[229,6]]},"301":{"position":[[52,6]]},"395":{"position":[[4494,6]]},"477":{"position":[[2561,6]]},"515":{"position":[[229,6]]},"522":{"position":[[52,6]]},"632":{"position":[[4494,6]]},"699":{"position":[[2561,6]]}},"keywords":{}}],["outsid",{"_index":328,"title":{},"content":{"10":{"position":[[341,8]]},"111":{"position":[[127,7]]},"147":{"position":[[546,7]]},"168":{"position":[[85,8]]},"196":{"position":[[1386,7]]},"204":{"position":[[1396,8]]},"306":{"position":[[127,7]]},"324":{"position":[[949,8]]},"335":{"position":[[550,7]]},"348":{"position":[[85,8]]},"424":{"position":[[1346,8]]},"432":{"position":[[1328,7]]},"511":{"position":[[127,7]]},"542":{"position":[[949,8]]},"552":{"position":[[550,7]]},"564":{"position":[[85,8]]},"596":{"position":[[1235,7]]},"666":{"position":[[1346,8]]},"679":{"position":[[1328,7]]},"704":{"position":[[1235,7]]}},"keywords":{}}],["over",{"_index":385,"title":{},"content":{"12":{"position":[[187,4]]},"22":{"position":[[527,4]]},"76":{"position":[[869,5]]},"88":{"position":[[361,4]]},"115":{"position":[[1681,4]]},"127":{"position":[[767,4]]},"163":{"position":[[1066,4],[1235,4]]},"212":{"position":[[2090,4]]},"227":{"position":[[869,5]]},"247":{"position":[[1900,4]]},"250":{"position":[[361,4]]},"258":{"position":[[1627,4]]},"278":{"position":[[767,4]]},"352":{"position":[[1088,4],[1257,4]]},"391":{"position":[[2090,4]]},"416":{"position":[[3272,5]]},"446":{"position":[[1900,4]]},"458":{"position":[[869,5]]},"481":{"position":[[1627,4]]},"488":{"position":[[361,4]]},"515":{"position":[[767,4]]},"568":{"position":[[1088,4],[1257,4]]},"653":{"position":[[3272,5]]},"661":{"position":[[2090,4]]},"673":{"position":[[1900,4]]}},"keywords":{}}],["overcom",{"_index":1570,"title":{},"content":{"90":{"position":[[150,9]]},"282":{"position":[[150,9]]},"494":{"position":[[150,9]]}},"keywords":{}}],["overflow",{"_index":254,"title":{},"content":{"8":{"position":[[566,8]]}},"keywords":{}}],["overflow"",{"_index":256,"title":{},"content":{"8":{"position":[[627,16]]}},"keywords":{}}],["overflowingadd>::overflowing_add(current_bal",{"_index":2464,"title":{},"content":{"204":{"position":[[1624,52]]},"424":{"position":[[1574,52]]},"666":{"position":[[1574,52]]}},"keywords":{}}],["overhead",{"_index":3772,"title":{},"content":{"606":{"position":[[1082,8]]},"714":{"position":[[1082,8]]}},"keywords":{}}],["overrid",{"_index":1873,"title":{},"content":{"129":{"position":[[509,8]]},"280":{"position":[[509,8]]},"517":{"position":[[509,8]]}},"keywords":{}}],["overridden",{"_index":3050,"title":{},"content":{"324":{"position":[[468,10]]},"542":{"position":[[468,10]]}},"keywords":{}}],["override(erc20",{"_index":1128,"title":{},"content":{"43":{"position":[[537,15]]}},"keywords":{}}],["override."",{"_index":3037,"title":{},"content":{"323":{"position":[[3143,16]]},"541":{"position":[[3143,16]]}},"keywords":{}}],["overriden",{"_index":3047,"title":{},"content":{"324":{"position":[[309,9]]},"542":{"position":[[309,9]]}},"keywords":{}}],["overview",{"_index":1707,"title":{"114":{"position":[[0,9]]},"257":{"position":[[0,9]]},"480":{"position":[[0,9]]}},"content":{"477":{"position":[[4114,8]]},"699":{"position":[[4114,8]]}},"keywords":{}}],["overwrit",{"_index":704,"title":{},"content":{"30":{"position":[[518,9]]}},"keywords":{}}],["overwritten.odra_cfg_is_upgrad",{"_index":1644,"title":{},"content":{"98":{"position":[[377,34]]},"290":{"position":[[377,34]]},"502":{"position":[[377,34]]}},"keywords":{}}],["own",{"_index":3400,"title":{},"content":{"440":{"position":[[2423,5]]},"687":{"position":[[2423,5]]}},"keywords":{}}],["ownabl",{"_index":1106,"title":{"192":{"position":[[0,7]]},"428":{"position":[[0,7]]},"675":{"position":[[0,7]]}},"content":{"43":{"position":[[76,8],[210,7]]},"115":{"position":[[232,8],[1419,8],[2036,8],[3011,8]]},"188":{"position":[[244,7],[429,7],[621,7],[700,7]]},"189":{"position":[[223,8],[582,7]]},"195":{"position":[[115,7],[293,7]]},"196":{"position":[[70,7],[756,7]]},"197":{"position":[[32,7]]},"198":{"position":[[371,9],[599,8],[938,8]]},"199":{"position":[[4,7]]},"207":{"position":[[20,7]]},"246":{"position":[[65,7],[243,8]]},"247":{"position":[[1817,7],[1922,7]]},"258":{"position":[[222,8],[1365,8],[1982,8],[2937,8]]},"267":{"position":[[3448,8]]},"268":{"position":[[986,7]]},"365":{"position":[[601,7],[786,7],[978,7],[1057,7]]},"366":{"position":[[223,8],[582,7]]},"407":{"position":[[3448,8]]},"408":{"position":[[986,7]]},"427":{"position":[[20,7]]},"431":{"position":[[115,7],[293,7]]},"432":{"position":[[32,7],[693,7]]},"433":{"position":[[32,7]]},"434":{"position":[[371,9],[594,8],[928,8]]},"435":{"position":[[4,7]]},"440":{"position":[[1031,8],[3860,7],[4039,7]]},"445":{"position":[[65,7],[243,8]]},"446":{"position":[[1817,7],[1922,7]]},"481":{"position":[[222,8],[1365,8],[1982,8],[2937,8]]},"581":{"position":[[601,7],[786,7],[978,7],[1057,7]]},"582":{"position":[[223,8],[582,7]]},"644":{"position":[[3448,8]]},"645":{"position":[[986,7]]},"669":{"position":[[20,7]]},"672":{"position":[[65,7],[243,8]]},"673":{"position":[[1817,7],[1922,7]]},"678":{"position":[[115,7],[293,7]]},"679":{"position":[[32,7],[693,7]]},"680":{"position":[[32,7]]},"681":{"position":[[371,9],[599,8],[938,8]]},"682":{"position":[[4,7]]},"687":{"position":[[1031,8],[3860,7],[4039,7]]}},"keywords":{}}],["ownable(initialown",{"_index":1121,"title":{},"content":{"43":{"position":[[352,21]]}},"keywords":{}}],["ownable.address",{"_index":2387,"title":{},"content":{"198":{"position":[[463,18],[795,18]]},"681":{"position":[[463,18],[795,18]]}},"keywords":{}}],["ownable.change_ownership(&new_own",{"_index":2392,"title":{},"content":{"198":{"position":[[690,41],[1002,41]]},"434":{"position":[[685,41],[992,41]]},"681":{"position":[[690,41],[1002,41]]}},"keywords":{}}],["ownable.r",{"_index":2314,"title":{},"content":{"195":{"position":[[0,10]]},"196":{"position":[[0,10]]},"197":{"position":[[0,10]]},"198":{"position":[[0,10]]},"431":{"position":[[0,10]]},"432":{"position":[[0,10]]},"433":{"position":[[0,10]]},"434":{"position":[[0,10]]},"678":{"position":[[0,10]]},"679":{"position":[[0,10]]},"680":{"position":[[0,10]]},"681":{"position":[[0,10]]}},"keywords":{}}],["ownable.try_change_ownership(&new_own",{"_index":2395,"title":{},"content":{"198":{"position":[[1056,45]]},"434":{"position":[[1046,45]]},"681":{"position":[[1056,45]]}},"keywords":{}}],["ownable2step",{"_index":2299,"title":{},"content":{"189":{"position":[[548,13]]},"366":{"position":[[548,13]]},"582":{"position":[[548,13]]}},"keywords":{}}],["ownable::own",{"_index":1712,"title":{},"content":{"115":{"position":[[89,18],[1881,17]]},"246":{"position":[[133,18]]},"258":{"position":[[89,18],[1827,17]]},"445":{"position":[[133,18]]},"481":{"position":[[89,18],[1827,17]]},"672":{"position":[[133,18]]}},"keywords":{}}],["ownablehostref",{"_index":2379,"title":{},"content":{"198":{"position":[[113,16],[1359,16],[1395,14],[1882,15]]},"434":{"position":[[113,16],[1349,16],[1385,14],[1872,15]]},"681":{"position":[[113,16],[1359,16],[1395,14],[1882,15]]}},"keywords":{}}],["ownablehostref::deploy(&env",{"_index":2382,"title":{},"content":{"198":{"position":[[250,33]]},"268":{"position":[[996,32]]},"408":{"position":[[996,32]]},"434":{"position":[[250,33]]},"645":{"position":[[996,32]]},"681":{"position":[[250,33]]}},"keywords":{}}],["ownableinitarg",{"_index":2380,"title":{},"content":{"198":{"position":[[203,15],[1902,15]]},"434":{"position":[[203,15],[1892,15]]},"681":{"position":[[203,15],[1902,15]]}},"keywords":{}}],["owned_contract",{"_index":1911,"title":{},"content":{"138":{"position":[[571,14]]},"318":{"position":[[563,14]]},"544":{"position":[[563,14]]}},"keywords":{}}],["owned_contract.try_change_name("newname".to_str",{"_index":1914,"title":{},"content":{"138":{"position":[[691,64]]},"318":{"position":[[683,64]]},"544":{"position":[[683,64]]}},"keywords":{}}],["owned_token.r",{"_index":2754,"title":{},"content":{"246":{"position":[[92,14]]},"247":{"position":[[0,14]]},"445":{"position":[[92,14]]},"446":{"position":[[0,14]]},"672":{"position":[[92,14]]},"673":{"position":[[0,14]]}},"keywords":{}}],["ownedcontracthostref",{"_index":1902,"title":{},"content":{"138":{"position":[[208,21]]},"318":{"position":[[208,21]]},"544":{"position":[[208,21]]}},"keywords":{}}],["ownedcontracthostref::deploy(&test_env",{"_index":1912,"title":{},"content":{"138":{"position":[[588,43]]},"318":{"position":[[580,43]]},"544":{"position":[[580,43]]}},"keywords":{}}],["ownedcontractinitarg",{"_index":1903,"title":{},"content":{"138":{"position":[[230,23],[492,21]]},"318":{"position":[[230,23],[484,21]]},"544":{"position":[[230,23],[484,21]]}},"keywords":{}}],["ownederc1155",{"_index":2291,"title":{},"content":{"188":{"position":[[644,12]]},"365":{"position":[[1001,12]]},"581":{"position":[[1001,12]]}},"keywords":{}}],["ownederc721withmetadata",{"_index":2288,"title":{},"content":{"188":{"position":[[347,23]]},"365":{"position":[[704,23]]},"581":{"position":[[704,23]]}},"keywords":{}}],["ownedtoken",{"_index":1716,"title":{"244":{"position":[[0,10]]},"443":{"position":[[0,10]]},"670":{"position":[[0,10]]}},"content":{"115":{"position":[[219,10],[320,10],[1367,10]]},"246":{"position":[[29,10],[230,10]]},"247":{"position":[[85,10]]},"258":{"position":[[209,10],[310,10],[1313,10]]},"445":{"position":[[29,10],[230,10]]},"446":{"position":[[85,10]]},"481":{"position":[[209,10],[310,10],[1313,10]]},"672":{"position":[[29,10],[230,10]]},"673":{"position":[[85,10]]}},"keywords":{}}],["ownedtoken>",{"_index":1453,"title":{},"content":{"79":{"position":[[785,14]]},"230":{"position":[[802,14]]},"461":{"position":[[802,14]]}},"keywords":{}}],["owner",{"_index":470,"title":{},"content":{"17":{"position":[[511,6],[669,6],[2615,6],[3760,5],[3870,6]]},"42":{"position":[[1296,6]]},"100":{"position":[[955,5]]},"101":{"position":[[676,5]]},"115":{"position":[[682,6],[981,6],[1037,6],[2573,6]]},"126":{"position":[[1536,5]]},"138":{"position":[[116,6],[371,5],[945,6]]},"165":{"position":[[281,6]]},"189":{"position":[[376,6],[454,6]]},"194":{"position":[[151,5],[241,5]]},"195":{"position":[[125,6]]},"196":{"position":[[107,6],[321,5],[825,6],[860,5],[1104,5],[1246,5],[1344,5],[1686,6]]},"197":{"position":[[591,6],[952,5],[1344,5],[1728,5]]},"198":{"position":[[221,6],[386,6],[436,7],[535,5],[613,6],[1803,7],[2030,6],[2282,5],[2403,5],[3042,5],[3443,5]]},"205":{"position":[[486,6],[764,5],[880,6],[1065,6],[1230,6],[1660,6],[1987,6],[1994,7],[2121,6]]},"206":{"position":[[2125,7],[2362,5],[2596,6],[2674,5],[3056,6],[3452,7]]},"245":{"position":[[88,5],[128,5],[153,6]]},"247":{"position":[[697,6],[948,6],[1975,6]]},"258":{"position":[[664,6],[939,6],[991,6],[2511,6]]},"267":{"position":[[3906,6]]},"268":{"position":[[2426,7],[3162,6]]},"269":{"position":[[1232,6],[1510,5],[1626,6],[1811,6],[2521,6],[2893,6],[3195,6],[3202,7],[3560,6]]},"277":{"position":[[1704,5]]},"292":{"position":[[955,5]]},"293":{"position":[[676,5]]},"318":{"position":[[116,6],[363,5],[937,6]]},"321":{"position":[[978,6],[1089,5],[1155,6],[1567,6],[1751,6],[1890,5]]},"323":{"position":[[1589,5],[2750,5]]},"354":{"position":[[319,6]]},"366":{"position":[[376,6],[454,6]]},"383":{"position":[[405,6]]},"384":{"position":[[1245,6],[1523,5],[1639,6],[1831,6],[2548,6],[2927,6],[3236,6],[3243,7],[3546,6]]},"395":{"position":[[664,5],[694,5]]},"396":{"position":[[400,6]]},"407":{"position":[[3906,6]]},"408":{"position":[[2426,7],[3162,6]]},"409":{"position":[[1232,6],[1510,5],[1626,6],[1811,6],[2521,6],[2893,6],[3195,6],[3202,7],[3560,6]]},"419":{"position":[[2763,5],[2827,6],[3484,5],[3570,6],[3719,6],[3844,6]]},"425":{"position":[[461,6],[739,5],[855,6],[1040,6],[1205,6],[1635,6],[1962,6],[1969,7],[2072,6]]},"426":{"position":[[2115,7],[2352,5],[2581,6],[2659,5],[3036,6],[3427,7]]},"430":{"position":[[151,5],[241,5]]},"431":{"position":[[125,6]]},"432":{"position":[[69,6],[283,5],[763,6],[798,5],[1047,5],[1188,5],[1286,5],[1564,6]]},"433":{"position":[[591,6],[951,5],[1343,5],[1727,5]]},"434":{"position":[[221,6],[386,6],[436,7],[530,5],[608,6],[1793,7],[2020,6],[2272,5],[2393,5],[3024,5],[3425,5]]},"438":{"position":[[132,5]]},"440":{"position":[[2314,5],[2436,5],[2517,5],[2953,5],[3098,6],[4116,5]]},"441":{"position":[[2537,5],[3218,5],[3891,5]]},"444":{"position":[[88,5],[128,5],[153,6]]},"446":{"position":[[697,6],[948,6],[1975,6]]},"481":{"position":[[664,6],[939,6],[991,6],[2511,6]]},"504":{"position":[[955,5]]},"505":{"position":[[676,5]]},"514":{"position":[[1536,5]]},"539":{"position":[[978,6],[1089,5],[1155,6],[1567,6],[1751,6],[1890,5]]},"541":{"position":[[1589,5],[2750,5]]},"544":{"position":[[116,6],[363,5],[937,6]]},"570":{"position":[[319,6]]},"582":{"position":[[376,6],[454,6]]},"608":{"position":[[124,6]]},"625":{"position":[[405,6]]},"626":{"position":[[1245,6],[1523,5],[1639,6],[1831,6],[2548,6],[2927,6],[3236,6],[3243,7],[3546,6]]},"632":{"position":[[664,5],[694,5]]},"633":{"position":[[400,6]]},"644":{"position":[[3906,6]]},"645":{"position":[[2426,7],[3162,6]]},"646":{"position":[[1232,6],[1510,5],[1626,6],[1811,6],[2521,6],[2893,6],[3195,6],[3202,7],[3560,6]]},"656":{"position":[[2763,5],[2827,6],[3484,5],[3570,6],[3719,6],[3844,6]]},"667":{"position":[[461,6],[739,5],[855,6],[1040,6],[1205,6],[1635,6],[1962,6],[1969,7],[2072,6]]},"668":{"position":[[2125,7],[2362,5],[2596,6],[2674,5],[3056,6],[3452,7]]},"671":{"position":[[88,5],[128,5],[153,6]]},"673":{"position":[[697,6],[948,6],[1975,6]]},"677":{"position":[[151,5],[241,5]]},"678":{"position":[[125,6]]},"679":{"position":[[69,6],[283,5],[763,6],[798,5],[1047,5],[1188,5],[1286,5],[1564,6]]},"680":{"position":[[591,6],[951,5],[1343,5],[1727,5]]},"681":{"position":[[221,6],[386,6],[436,7],[535,5],[613,6],[1803,7],[2030,6],[2282,5],[2403,5],[3042,5],[3443,5]]},"685":{"position":[[132,5]]},"687":{"position":[[2314,5],[2436,5],[2517,5],[2953,5],[3098,6],[4116,5]]},"688":{"position":[[2537,5],[3218,5],[3891,5]]},"716":{"position":[[124,6]]}},"keywords":{}}],["owner'",{"_index":1853,"title":{},"content":{"127":{"position":[[519,7]]},"278":{"position":[[519,7]]},"395":{"position":[[6632,7]]},"515":{"position":[[519,7]]},"632":{"position":[[6632,7]]}},"keywords":{}}],["owner.a",{"_index":2313,"title":{},"content":{"194":{"position":[[194,7]]},"430":{"position":[[194,7]]},"677":{"position":[[194,7]]}},"keywords":{}}],["owner.read",{"_index":2312,"title":{},"content":{"194":{"position":[[171,10]]},"430":{"position":[[171,10]]},"677":{"position":[[171,10]]}},"keywords":{}}],["owner_bal",{"_index":2479,"title":{},"content":{"205":{"position":[[1301,13],[1375,13],[1464,13]]},"425":{"position":[[1276,13],[1350,13],[1439,13]]},"667":{"position":[[1276,13],[1350,13],[1439,13]]}},"keywords":{}}],["owner_can_change_ownership",{"_index":2389,"title":{},"content":{"198":{"position":[[559,28]]},"434":{"position":[[554,28]]},"681":{"position":[[559,28]]}},"keywords":{}}],["ownerisalreadyiniti",{"_index":2329,"title":{},"content":{"196":{"position":[[373,25]]},"197":{"position":[[715,25]]},"432":{"position":[[334,25]]},"433":{"position":[[714,25]]},"679":{"position":[[334,25]]},"680":{"position":[[714,25]]}},"keywords":{}}],["ownerisnotiniti",{"_index":2364,"title":{},"content":{"197":{"position":[[746,21],[1458,22]]},"433":{"position":[[745,21],[1457,22]]},"680":{"position":[[745,21],[1457,22]]}},"keywords":{}}],["ownership",{"_index":2297,"title":{},"content":{"189":{"position":[[470,9],[598,9]]},"198":{"position":[[3473,10]]},"366":{"position":[[470,9],[598,9]]},"434":{"position":[[3455,10]]},"582":{"position":[[470,9],[598,9]]},"681":{"position":[[3473,10]]}},"keywords":{}}],["ownershipchang",{"_index":2315,"title":{},"content":{"195":{"position":[[83,20],[335,20],[535,16]]},"196":{"position":[[456,16],[1619,16]]},"431":{"position":[[83,20],[335,20],[535,16]]},"432":{"position":[[393,16],[1497,16]]},"678":{"position":[[83,20],[335,20],[535,16]]},"679":{"position":[[393,16],[1497,16]]}},"keywords":{}}],["ownershipchanged.l21,l33",{"_index":2372,"title":{},"content":{"197":{"position":[[1281,24]]},"433":{"position":[[1280,24]]},"680":{"position":[[1280,24]]}},"keywords":{}}],["ownershipmod",{"_index":3351,"title":{},"content":{"440":{"position":[[356,15]]},"687":{"position":[[356,15]]}},"keywords":{}}],["ownershipmode::transfer",{"_index":3379,"title":{},"content":{"440":{"position":[[1405,28]]},"687":{"position":[[1405,28]]}},"keywords":{}}],["p",{"_index":850,"title":{},"content":{"32":{"position":[[1696,1]]},"210":{"position":[[131,1],[146,1],[161,1]]},"389":{"position":[[131,1],[146,1],[161,1]]},"477":{"position":[[140,1],[155,1],[170,1]]},"659":{"position":[[131,1],[146,1],[161,1]]},"699":{"position":[[140,1],[155,1],[170,1]]}},"keywords":{}}],["packag",{"_index":1641,"title":{},"content":{"98":{"position":[[201,7]]},"100":{"position":[[1077,7]]},"103":{"position":[[122,7]]},"117":{"position":[[364,9]]},"131":{"position":[[44,9]]},"265":{"position":[[442,9]]},"290":{"position":[[201,7]]},"292":{"position":[[1077,7]]},"295":{"position":[[122,7]]},"298":{"position":[[364,9]]},"311":{"position":[[44,9]]},"323":{"position":[[2923,7]]},"395":{"position":[[2548,9]]},"405":{"position":[[442,9]]},"477":{"position":[[724,9]]},"502":{"position":[[201,7]]},"504":{"position":[[1077,7]]},"507":{"position":[[122,7]]},"519":{"position":[[364,9]]},"528":{"position":[[44,9]]},"541":{"position":[[2923,7]]},"632":{"position":[[2548,9]]},"642":{"position":[[442,9]]},"699":{"position":[[724,9]]}},"keywords":{}}],["package'",{"_index":3192,"title":{},"content":{"396":{"position":[[369,9]]},"633":{"position":[[369,9]]}},"keywords":{}}],["page",{"_index":3197,"title":{},"content":{"396":{"position":[[1036,5]]},"633":{"position":[[1036,5]]}},"keywords":{}}],["pair",{"_index":2080,"title":{},"content":{"163":{"position":[[58,6]]},"203":{"position":[[408,6]]},"352":{"position":[[58,6]]},"423":{"position":[[408,6]]},"568":{"position":[[58,6]]},"665":{"position":[[408,6]]}},"keywords":{}}],["pairs,odra",{"_index":2431,"title":{},"content":{"201":{"position":[[111,10]]},"421":{"position":[[111,10]]},"663":{"position":[[111,10]]}},"keywords":{}}],["panic",{"_index":296,"title":{},"content":{"9":{"position":[[1034,5]]}},"keywords":{}}],["panic!("trivi",{"_index":248,"title":{},"content":{"8":{"position":[[472,20]]}},"keywords":{}}],["panick",{"_index":2423,"title":{},"content":{"198":{"position":[[3758,9]]},"434":{"position":[[3740,9]]},"681":{"position":[[3758,9]]}},"keywords":{}}],["paradigm",{"_index":3810,"title":{},"content":{"612":{"position":[[149,8]]},"720":{"position":[[149,8]]}},"keywords":{}}],["paragraph",{"_index":1023,"title":{},"content":{"40":{"position":[[406,10]]}},"keywords":{}}],["paramet",{"_index":1311,"title":{},"content":{"53":{"position":[[1212,11]]},"117":{"position":[[98,10],[958,10]]},"267":{"position":[[4280,10]]},"298":{"position":[[98,10],[958,10]]},"383":{"position":[[589,9]]},"407":{"position":[[4280,10]]},"416":{"position":[[2071,10]]},"519":{"position":[[98,10],[958,10]]},"605":{"position":[[464,9],[495,10]]},"625":{"position":[[589,9]]},"644":{"position":[[4280,10]]},"653":{"position":[[2071,10]]},"713":{"position":[[464,9],[495,10]]}},"keywords":{}}],["paraphras",{"_index":616,"title":{},"content":{"20":{"position":[[1010,10]]}},"keywords":{}}],["parent",{"_index":1709,"title":{},"content":{"114":{"position":[[214,6],[398,6]]},"115":{"position":[[3090,6]]},"257":{"position":[[214,6],[398,6]]},"258":{"position":[[3016,6]]},"480":{"position":[[214,6],[398,6]]},"481":{"position":[[3016,6]]},"612":{"position":[[216,6]]},"720":{"position":[[216,6]]}},"keywords":{}}],["pars",{"_index":2648,"title":{},"content":{"212":{"position":[[2290,7],[2406,7]]},"391":{"position":[[2290,7],[2406,7]]},"440":{"position":[[1910,8]]},"661":{"position":[[2290,7],[2406,7]]},"687":{"position":[[1910,8]]}},"keywords":{}}],["parse<t>(express",{"_index":972,"title":{},"content":{"39":{"position":[[2263,26]]}},"keywords":{}}],["parse(expr",{"_index":998,"title":{},"content":{"39":{"position":[[2823,11]]}},"keywords":{}}],["parse_ext_call(vari",{"_index":1003,"title":{},"content":{"39":{"position":[[2933,24]]}},"keywords":{}}],["parser",{"_index":903,"title":{},"content":{"39":{"position":[[265,6],[376,6],[1657,6],[2215,7]]},"40":{"position":[[215,6]]},"52":{"position":[[1201,6],[1493,6],[1670,6]]}},"keywords":{}}],["parser/src/pt.r",{"_index":916,"title":{},"content":{"39":{"position":[[562,16]]}},"keywords":{}}],["parsererror>",{"_index":978,"title":{},"content":{"39":{"position":[[2351,15]]}},"keywords":{}}],["part",{"_index":926,"title":{},"content":{"39":{"position":[[803,6],[1701,5]]},"52":{"position":[[422,5]]},"107":{"position":[[28,6]]},"127":{"position":[[212,4]]},"141":{"position":[[1022,4]]},"185":{"position":[[47,5]]},"204":{"position":[[1255,4]]},"274":{"position":[[28,6]]},"278":{"position":[[212,4]]},"326":{"position":[[1022,4]]},"376":{"position":[[47,5]]},"424":{"position":[[1205,4]]},"491":{"position":[[28,6]]},"515":{"position":[[212,4]]},"535":{"position":[[1022,4]]},"592":{"position":[[47,5]]},"600":{"position":[[941,4]]},"666":{"position":[[1205,4]]},"708":{"position":[[941,4]]}},"keywords":{}}],["partialeq",{"_index":918,"title":{},"content":{"39":{"position":[[640,11]]},"184":{"position":[[288,10],[412,10],[536,10]]},"196":{"position":[[429,10],[1524,9]]},"204":{"position":[[864,10]]},"205":{"position":[[2072,10]]},"209":{"position":[[550,10],[683,10]]},"212":{"position":[[449,10],[572,10]]},"219":{"position":[[399,10],[481,10]]},"267":{"position":[[1568,10]]},"269":{"position":[[3371,10],[3515,10]]},"391":{"position":[[449,10],[572,10]]},"407":{"position":[[1568,10]]},"409":{"position":[[3371,10],[3515,10]]},"644":{"position":[[1568,10]]},"646":{"position":[[3371,10],[3515,10]]},"661":{"position":[[449,10],[572,10]]}},"keywords":{}}],["particular",{"_index":888,"title":{},"content":{"38":{"position":[[937,10]]},"189":{"position":[[327,10]]},"366":{"position":[[327,10]]},"582":{"position":[[327,10]]}},"keywords":{}}],["party_contract",{"_index":2026,"title":{},"content":{"157":{"position":[[322,14]]},"330":{"position":[[313,14]]},"547":{"position":[[322,14]]}},"keywords":{}}],["party_contract.address",{"_index":2029,"title":{},"content":{"157":{"position":[[416,25]]},"547":{"position":[[416,25]]}},"keywords":{}}],["partycontracthostref::deploy(&test_env",{"_index":2027,"title":{},"content":{"157":{"position":[[339,43]]},"330":{"position":[[330,43]]},"547":{"position":[[339,43]]}},"keywords":{}}],["partystart",{"_index":2024,"title":{},"content":{"157":{"position":[[181,14]]},"330":{"position":[[181,14]]},"547":{"position":[[181,14]]}},"keywords":{}}],["pass",{"_index":325,"title":{},"content":{"10":{"position":[[295,6]]},"32":{"position":[[100,6]]},"96":{"position":[[85,4]]},"98":{"position":[[38,4],[530,4],[730,4]]},"99":{"position":[[76,4],[128,4]]},"103":{"position":[[362,4]]},"117":{"position":[[89,4],[907,4]]},"119":{"position":[[848,4],[965,6]]},"120":{"position":[[378,4]]},"126":{"position":[[256,6]]},"129":{"position":[[300,4]]},"147":{"position":[[1058,6]]},"148":{"position":[[791,4]]},"163":{"position":[[98,4],[734,4]]},"178":{"position":[[645,6]]},"196":{"position":[[1252,6],[1607,7]]},"197":{"position":[[1174,4]]},"198":{"position":[[1926,4],[2897,4]]},"268":{"position":[[729,4]]},"277":{"position":[[256,6]]},"280":{"position":[[300,4]]},"288":{"position":[[85,4]]},"290":{"position":[[38,4],[530,4],[730,4]]},"291":{"position":[[76,4],[128,4]]},"295":{"position":[[362,4]]},"298":{"position":[[89,4],[907,4]]},"300":{"position":[[848,4],[965,6]]},"301":{"position":[[378,4]]},"322":{"position":[[84,4]]},"335":{"position":[[1066,6]]},"336":{"position":[[791,4]]},"352":{"position":[[98,4],[756,4]]},"369":{"position":[[645,6]]},"383":{"position":[[577,6]]},"408":{"position":[[729,4]]},"416":{"position":[[2102,4],[4327,7]]},"419":{"position":[[5907,7]]},"432":{"position":[[1194,6],[1485,7]]},"433":{"position":[[1173,4]]},"434":{"position":[[1916,4],[2887,4]]},"500":{"position":[[85,4]]},"502":{"position":[[38,4],[530,4],[730,4]]},"503":{"position":[[76,4],[128,4]]},"507":{"position":[[362,4]]},"514":{"position":[[256,6]]},"517":{"position":[[300,4]]},"519":{"position":[[89,4],[907,4]]},"521":{"position":[[848,4],[965,6]]},"522":{"position":[[378,4]]},"540":{"position":[[84,4]]},"552":{"position":[[1066,6]]},"553":{"position":[[791,4]]},"568":{"position":[[98,4],[756,4]]},"585":{"position":[[645,6]]},"610":{"position":[[724,7]]},"611":{"position":[[955,4]]},"625":{"position":[[577,6]]},"645":{"position":[[729,4]]},"653":{"position":[[2102,4],[4327,7]]},"656":{"position":[[5907,7]]},"679":{"position":[[1194,6],[1485,7]]},"680":{"position":[[1173,4]]},"681":{"position":[[1926,4],[2897,4]]},"718":{"position":[[724,7]]},"719":{"position":[[955,4]]}},"keywords":{}}],["past",{"_index":437,"title":{},"content":{"16":{"position":[[187,5]]}},"keywords":{}}],["path",{"_index":1138,"title":{},"content":{"43":{"position":[[1035,4]]},"52":{"position":[[2244,4]]},"88":{"position":[[250,4]]},"99":{"position":[[387,4]]},"100":{"position":[[480,4]]},"101":{"position":[[334,4]]},"126":{"position":[[430,4],[896,5],[3558,4]]},"131":{"position":[[273,4],[374,4]]},"210":{"position":[[499,4]]},"250":{"position":[[250,4]]},"265":{"position":[[679,4],[784,4]]},"277":{"position":[[430,4],[896,5],[3726,4]]},"291":{"position":[[387,4]]},"292":{"position":[[480,4]]},"293":{"position":[[334,4]]},"311":{"position":[[325,4],[426,4]]},"389":{"position":[[499,4]]},"395":{"position":[[3231,4],[3333,4],[3430,4],[3676,4],[4091,4],[4105,4]]},"405":{"position":[[679,4],[784,4]]},"477":{"position":[[846,4],[1157,4]]},"488":{"position":[[250,4]]},"503":{"position":[[387,4]]},"504":{"position":[[480,4]]},"505":{"position":[[334,4]]},"514":{"position":[[430,4],[896,5],[3558,4]]},"528":{"position":[[325,4],[426,4]]},"632":{"position":[[3231,4],[3333,4],[3430,4],[3676,4],[4091,4],[4105,4]]},"642":{"position":[[679,4],[784,4]]},"659":{"position":[[499,4]]},"699":{"position":[[846,4],[1157,4]]}},"keywords":{}}],["path."",{"_index":272,"title":{},"content":{"9":{"position":[[342,13]]}},"keywords":{}}],["path/to/your/secret_key.pem",{"_index":2581,"title":{},"content":{"210":{"position":[[459,27]]},"389":{"position":[[459,27]]},"659":{"position":[[459,27]]}},"keywords":{}}],["path_to_wasm",{"_index":2582,"title":{},"content":{"210":{"position":[[504,14]]},"389":{"position":[[504,14]]},"659":{"position":[[504,14]]}},"keywords":{}}],["path_to_your_key]/secret_key.pem",{"_index":1649,"title":{},"content":{"99":{"position":[[308,33]]},"100":{"position":[[402,33]]},"101":{"position":[[256,33]]},"291":{"position":[[308,33]]},"292":{"position":[[402,33]]},"293":{"position":[[256,33]]},"503":{"position":[[308,33]]},"504":{"position":[[402,33]]},"505":{"position":[[256,33]]}},"keywords":{}}],["pattern",{"_index":899,"title":{},"content":{"39":{"position":[[136,7]]},"618":{"position":[[193,7]]},"726":{"position":[[193,7]]}},"keywords":{}}],["paus",{"_index":2694,"title":{},"content":{"218":{"position":[[94,6]]},"219":{"position":[[154,6],[433,6]]},"220":{"position":[[104,7],[168,8]]},"221":{"position":[[744,7],[829,7],[935,7]]},"222":{"position":[[392,7],[494,8],[507,6]]},"223":{"position":[[265,8]]},"451":{"position":[[94,6]]},"452":{"position":[[154,6],[388,6]]},"453":{"position":[[104,7],[168,8]]},"454":{"position":[[744,7],[829,7],[935,7]]},"455":{"position":[[392,7],[494,8],[507,6]]},"456":{"position":[[265,8]]},"691":{"position":[[94,6]]},"692":{"position":[[154,6],[388,6]]},"693":{"position":[[104,7],[168,8]]},"694":{"position":[[744,7],[829,7],[935,7]]},"695":{"position":[[392,7],[494,8],[507,6]]},"696":{"position":[[265,8]]}},"keywords":{}}],["pausabl",{"_index":2302,"title":{"217":{"position":[[0,8]]},"223":{"position":[[0,8]]},"450":{"position":[[0,8]]},"456":{"position":[[0,8]]},"690":{"position":[[0,8]]},"696":{"position":[[0,8]]}},"content":{"190":{"position":[[0,9]]},"220":{"position":[[200,8]]},"221":{"position":[[62,8]]},"222":{"position":[[79,8]]},"223":{"position":[[167,8]]},"367":{"position":[[0,9]]},"453":{"position":[[200,8]]},"454":{"position":[[62,8]]},"455":{"position":[[79,8]]},"456":{"position":[[167,8]]},"583":{"position":[[0,9]]},"693":{"position":[[200,8]]},"694":{"position":[[62,8]]},"695":{"position":[[79,8]]},"696":{"position":[[167,8]]}},"keywords":{}}],["pausablecount",{"_index":2731,"title":{},"content":{"223":{"position":[[107,16],[343,15],[444,15]]},"456":{"position":[[107,16],[343,15],[444,15]]},"696":{"position":[[107,16],[343,15],[444,15]]}},"keywords":{}}],["pausablecounterhostref::deploy(&test_env",{"_index":2740,"title":{},"content":{"223":{"position":[[967,45]]},"456":{"position":[[967,45]]},"696":{"position":[[967,45]]}},"keywords":{}}],["pause(&mut",{"_index":2721,"title":{},"content":{"222":{"position":[[97,14]]},"223":{"position":[[618,14]]},"455":{"position":[[97,14]]},"456":{"position":[[618,14]]},"695":{"position":[[97,14]]},"696":{"position":[[618,14]]}},"keywords":{}}],["pauseabl",{"_index":2734,"title":{},"content":{"223":{"position":[[384,10]]},"456":{"position":[[384,10]]},"696":{"position":[[384,10]]}},"keywords":{}}],["pauseable.r",{"_index":2702,"title":{},"content":{"219":{"position":[[219,12]]},"220":{"position":[[112,12]]},"221":{"position":[[44,12]]},"222":{"position":[[61,12]]},"223":{"position":[[274,12]]},"452":{"position":[[219,12]]},"453":{"position":[[112,12]]},"454":{"position":[[44,12]]},"455":{"position":[[61,12]]},"456":{"position":[[274,12]]},"692":{"position":[[219,12]]},"693":{"position":[[112,12]]},"694":{"position":[[44,12]]},"695":{"position":[[61,12]]},"696":{"position":[[274,12]]}},"keywords":{}}],["paused/unpaus",{"_index":2729,"title":{},"content":{"222":{"position":[[574,18]]},"455":{"position":[[574,18]]},"695":{"position":[[574,18]]}},"keywords":{}}],["pausedrequir",{"_index":2697,"title":{},"content":{"219":{"position":[[38,15],[331,14]]},"452":{"position":[[38,15],[310,14]]},"692":{"position":[[38,15],[310,14]]}},"keywords":{}}],["pauser",{"_index":2701,"title":{},"content":{"219":{"position":[[211,7]]},"452":{"position":[[211,7]]},"692":{"position":[[211,7]]}},"keywords":{}}],["payabl",{"_index":1054,"title":{"70":{"position":[[0,8]]},"92":{"position":[[0,8]]},"234":{"position":[[0,8]]},"284":{"position":[[0,8]]},"470":{"position":[[0,8]]},"496":{"position":[[0,8]]},"608":{"position":[[0,8]]},"716":{"position":[[0,8]]}},"content":{"42":{"position":[[1043,7]]},"70":{"position":[[121,9]]},"71":{"position":[[612,7]]},"74":{"position":[[93,8]]},"92":{"position":[[646,8]]},"94":{"position":[[498,9]]},"102":{"position":[[9,7],[158,7]]},"234":{"position":[[121,9]]},"235":{"position":[[612,7]]},"238":{"position":[[93,8]]},"284":{"position":[[646,8]]},"286":{"position":[[498,9]]},"294":{"position":[[9,7],[158,7]]},"440":{"position":[[4258,7]]},"442":{"position":[[179,7]]},"470":{"position":[[121,9]]},"471":{"position":[[612,7]]},"474":{"position":[[93,8]]},"478":{"position":[[72,7]]},"496":{"position":[[646,8]]},"498":{"position":[[498,9]]},"506":{"position":[[9,7],[158,7]]},"608":{"position":[[114,7],[174,7],[758,7]]},"687":{"position":[[4258,7]]},"689":{"position":[[179,7]]},"700":{"position":[[72,7]]},"716":{"position":[[114,7],[174,7],[758,7]]}},"keywords":{}}],["payment",{"_index":1140,"title":{},"content":{"43":{"position":[[1062,7]]},"99":{"position":[[346,7]]},"100":{"position":[[440,7]]},"101":{"position":[[294,7]]},"210":{"position":[[523,7],[1259,7]]},"291":{"position":[[346,7]]},"292":{"position":[[440,7]]},"293":{"position":[[294,7]]},"389":{"position":[[523,7],[1196,7]]},"503":{"position":[[346,7]]},"504":{"position":[[440,7]]},"505":{"position":[[294,7]]},"659":{"position":[[523,7],[1196,7]]}},"keywords":{}}],["pend",{"_index":3719,"title":{},"content":{"602":{"position":[[109,8]]},"710":{"position":[[109,8]]}},"keywords":{}}],["peopl",{"_index":629,"title":{},"content":{"21":{"position":[[219,6]]},"38":{"position":[[306,6]]}},"keywords":{}}],["perfect",{"_index":1181,"title":{},"content":{"50":{"position":[[418,7]]}},"keywords":{}}],["perform",{"_index":185,"title":{},"content":{"5":{"position":[[256,7]]},"39":{"position":[[188,8]]},"53":{"position":[[1163,9]]},"184":{"position":[[36,9]]},"267":{"position":[[2433,9]]},"375":{"position":[[36,9]]},"407":{"position":[[2433,9]]},"416":{"position":[[3471,7],[4292,7]]},"419":{"position":[[5050,7],[5872,7]]},"591":{"position":[[36,9]]},"598":{"position":[[2142,7]]},"600":{"position":[[1047,7]]},"606":{"position":[[642,7]]},"644":{"position":[[2433,9]]},"653":{"position":[[3471,7],[4292,7]]},"656":{"position":[[5050,7],[5872,7]]},"706":{"position":[[2142,7]]},"708":{"position":[[1047,7]]},"714":{"position":[[642,7]]}},"keywords":{}}],["permiss",{"_index":3272,"title":{},"content":{"416":{"position":[[4875,12]]},"653":{"position":[[4875,12]]}},"keywords":{}}],["permit",{"_index":2437,"title":{},"content":{"202":{"position":[[273,9]]},"422":{"position":[[273,9]]},"664":{"position":[[273,9]]}},"keywords":{}}],["persist",{"_index":1992,"title":{},"content":{"146":{"position":[[579,9],[718,10]]},"147":{"position":[[1405,9]]},"334":{"position":[[583,9],[722,10]]},"335":{"position":[[1413,9]]},"551":{"position":[[583,9],[722,10]]},"552":{"position":[[1413,9]]}},"keywords":{}}],["perspect",{"_index":581,"title":{"83":{"position":[[10,12]]},"84":{"position":[[5,12]]},"252":{"position":[[10,12]]},"253":{"position":[[5,12]]},"483":{"position":[[10,12]]},"484":{"position":[[5,12]]}},"content":{"20":{"position":[[282,11]]},"110":{"position":[[122,11]]},"305":{"position":[[122,11]]},"510":{"position":[[122,11]]}},"keywords":{}}],["phase",{"_index":23,"title":{},"content":{"1":{"position":[[230,5]]}},"keywords":{}}],["pick",{"_index":262,"title":{},"content":{"9":{"position":[[120,4]]},"115":{"position":[[1774,7]]},"258":{"position":[[1720,7]]},"481":{"position":[[1720,7]]}},"keywords":{}}],["piec",{"_index":2009,"title":{},"content":{"148":{"position":[[612,5]]},"336":{"position":[[612,5]]},"553":{"position":[[612,5]]}},"keywords":{}}],["pipelin",{"_index":1014,"title":{},"content":{"40":{"position":[[64,8]]}},"keywords":{}}],["place",{"_index":378,"title":{},"content":{"12":{"position":[[21,5]]},"65":{"position":[[588,6]]},"121":{"position":[[222,6]]},"126":{"position":[[1112,6]]},"240":{"position":[[588,6]]},"247":{"position":[[1629,5]]},"277":{"position":[[1280,6]]},"302":{"position":[[222,6]]},"446":{"position":[[1629,5]]},"465":{"position":[[588,6]]},"514":{"position":[[1112,6]]},"523":{"position":[[222,6]]},"594":{"position":[[145,6]]},"673":{"position":[[1629,5]]},"702":{"position":[[145,6]]}},"keywords":{}}],["plain",{"_index":962,"title":{},"content":{"39":{"position":[[1885,5]]},"209":{"position":[[74,5]]},"388":{"position":[[74,5]]},"658":{"position":[[74,5]]}},"keywords":{}}],["plan",{"_index":140,"title":{},"content":{"3":{"position":[[345,5]]}},"keywords":{}}],["plascoin",{"_index":1111,"title":{},"content":{"43":{"position":[[170,8]]}},"keywords":{}}],["plascoin.sol",{"_index":1109,"title":{},"content":{"43":{"position":[[121,12]]}},"keywords":{}}],["platform",{"_index":606,"title":{},"content":{"20":{"position":[[847,8]]},"50":{"position":[[29,8],[97,8]]}},"keywords":{}}],["play",{"_index":135,"title":{},"content":{"3":{"position":[[247,4]]},"38":{"position":[[1198,5]]},"51":{"position":[[1669,5]]}},"keywords":{}}],["pleas",{"_index":1427,"title":{},"content":{"76":{"position":[[916,6]]},"99":{"position":[[704,6]]},"173":{"position":[[278,6]]},"227":{"position":[[916,6]]},"270":{"position":[[74,6]]},"291":{"position":[[704,6]]},"359":{"position":[[278,6]]},"385":{"position":[[74,6]]},"393":{"position":[[81,6]]},"410":{"position":[[74,6]]},"458":{"position":[[916,6]]},"503":{"position":[[704,6]]},"575":{"position":[[278,6]]},"627":{"position":[[74,6]]},"630":{"position":[[81,6]]},"647":{"position":[[74,6]]}},"keywords":{}}],["pobiarżyn",{"_index":574,"title":{},"content":{"20":{"position":[[121,9]]}},"keywords":{}}],["poc",{"_index":1315,"title":{},"content":{"54":{"position":[[147,4]]}},"keywords":{}}],["point",{"_index":119,"title":{},"content":{"2":{"position":[[613,5]]},"10":{"position":[[825,5]]},"18":{"position":[[284,6]]},"22":{"position":[[629,7],[975,7]]},"40":{"position":[[425,6]]},"42":{"position":[[1335,7],[1810,7]]},"43":{"position":[[1949,7]]},"97":{"position":[[18,5]]},"102":{"position":[[23,6],[172,6],[383,5]]},"103":{"position":[[258,5],[380,6]]},"185":{"position":[[2900,5],[3796,5],[3974,6]]},"198":{"position":[[1637,5]]},"210":{"position":[[1345,5]]},"289":{"position":[[18,5]]},"294":{"position":[[23,6],[172,6],[383,5]]},"295":{"position":[[258,5],[380,6]]},"324":{"position":[[969,5]]},"376":{"position":[[2884,5],[3780,5],[3958,6]]},"389":{"position":[[1282,5]]},"434":{"position":[[1627,5]]},"441":{"position":[[3952,5]]},"501":{"position":[[18,5]]},"506":{"position":[[23,6],[172,6],[383,5]]},"507":{"position":[[258,5],[380,6]]},"542":{"position":[[969,5]]},"592":{"position":[[2884,5],[3780,5],[3958,6]]},"598":{"position":[[2116,6],[2215,6]]},"600":{"position":[[1021,6],[1120,6]]},"604":{"position":[[34,5]]},"659":{"position":[[1282,5]]},"681":{"position":[[1637,5]]},"688":{"position":[[3952,5]]},"706":{"position":[[2116,6],[2215,6]]},"708":{"position":[[1021,6],[1120,6]]},"712":{"position":[[34,5]]}},"keywords":{}}],["polkadot",{"_index":602,"title":{},"content":{"20":{"position":[[778,9]]}},"keywords":{}}],["pop",{"_index":588,"title":{},"content":{"20":{"position":[[472,4]]}},"keywords":{}}],["pop_vec(&mut",{"_index":3710,"title":{},"content":{"601":{"position":[[1634,16]]},"709":{"position":[[1634,16]]}},"keywords":{}}],["popul",{"_index":590,"title":{},"content":{"20":{"position":[[489,9]]}},"keywords":{}}],["port",{"_index":384,"title":{},"content":{"12":{"position":[[182,4]]}},"keywords":{}}],["portabl",{"_index":607,"title":{},"content":{"20":{"position":[[863,9]]}},"keywords":{}}],["posit",{"_index":568,"title":{},"content":{"20":{"position":[[56,8]]}},"keywords":{}}],["possess",{"_index":1629,"title":{},"content":{"95":{"position":[[304,9]]},"287":{"position":[[304,9]]},"419":{"position":[[1807,7]]},"499":{"position":[[304,9]]},"656":{"position":[[1807,7]]}},"keywords":{}}],["possibl",{"_index":181,"title":{},"content":{"5":{"position":[[211,8]]},"12":{"position":[[38,8]]},"72":{"position":[[50,11]]},"115":{"position":[[3205,13]]},"127":{"position":[[868,9]]},"128":{"position":[[112,8]]},"129":{"position":[[6,8]]},"236":{"position":[[50,11]]},"258":{"position":[[3131,13]]},"278":{"position":[[868,9]]},"279":{"position":[[112,8]]},"280":{"position":[[6,8]]},"472":{"position":[[50,11]]},"481":{"position":[[3131,13]]},"515":{"position":[[868,9]]},"516":{"position":[[112,8]]},"517":{"position":[[6,8]]}},"keywords":{}}],["post",{"_index":14,"title":{},"content":{"1":{"position":[[125,5]]},"185":{"position":[[3590,4]]},"376":{"position":[[3574,4]]},"592":{"position":[[3574,4]]}},"keywords":{}}],["potenti",{"_index":78,"title":{},"content":{"1":{"position":[[958,9]]},"44":{"position":[[68,10]]},"50":{"position":[[404,11]]},"248":{"position":[[221,9]]},"447":{"position":[[221,9]]},"612":{"position":[[1745,9]]},"618":{"position":[[394,9]]},"674":{"position":[[221,9]]},"720":{"position":[[1745,9]]},"726":{"position":[[394,9]]}},"keywords":{}}],["power",{"_index":3228,"title":{},"content":{"416":{"position":[[1165,5]]},"417":{"position":[[1194,8],[1517,5]]},"419":{"position":[[7609,8],[7932,5]]},"653":{"position":[[1165,5]]},"654":{"position":[[1194,8],[1517,5]]},"656":{"position":[[7609,8],[7932,5]]}},"keywords":{}}],["powerhous",{"_index":1749,"title":{},"content":{"115":{"position":[[3116,10]]},"258":{"position":[[3042,10]]},"481":{"position":[[3042,10]]}},"keywords":{}}],["practic",{"_index":3608,"title":{},"content":{"594":{"position":[[394,9]]},"606":{"position":[[873,12]]},"702":{"position":[[394,9]]},"714":{"position":[[873,12]]}},"keywords":{}}],["pragma",{"_index":1049,"title":{},"content":{"42":{"position":[[906,6]]}},"keywords":{}}],["pragmat",{"_index":643,"title":{},"content":{"22":{"position":[[102,9]]},"38":{"position":[[120,9]]}},"keywords":{}}],["precompil",{"_index":783,"title":{},"content":{"31":{"position":[[2155,11]]}},"keywords":{}}],["predefin",{"_index":1628,"title":{},"content":{"95":{"position":[[270,10]]},"198":{"position":[[3153,10]]},"287":{"position":[[270,10]]},"434":{"position":[[3135,10]]},"499":{"position":[[270,10]]},"681":{"position":[[3153,10]]}},"keywords":{}}],["predict",{"_index":147,"title":{},"content":{"3":{"position":[[416,14]]},"39":{"position":[[1375,11]]}},"keywords":{}}],["prefer",{"_index":2007,"title":{},"content":{"148":{"position":[[475,6]]},"336":{"position":[[475,6]]},"478":{"position":[[299,7]]},"553":{"position":[[475,6]]},"700":{"position":[[299,7]]}},"keywords":{}}],["prefix",{"_index":1535,"title":{},"content":{"85":{"position":[[255,6],[498,7],[599,7]]},"129":{"position":[[239,6]]},"211":{"position":[[158,7],[280,7],[396,7]]},"254":{"position":[[255,6],[498,7],[599,7]]},"268":{"position":[[2131,6],[2191,6]]},"280":{"position":[[239,6]]},"390":{"position":[[158,7],[280,7],[383,7]]},"408":{"position":[[2131,6],[2191,6]]},"485":{"position":[[255,6],[498,7],[599,7]]},"517":{"position":[[239,6]]},"645":{"position":[[2131,6],[2191,6]]},"660":{"position":[[158,7],[280,7],[383,7]]}},"keywords":{}}],["prelud",{"_index":1715,"title":{},"content":{"115":{"position":[[178,10],[1980,10]]},"168":{"position":[[475,12]]},"209":{"position":[[422,11]]},"258":{"position":[[168,10],[1926,10]]},"269":{"position":[[4010,10]]},"318":{"position":[[281,12]]},"348":{"position":[[475,12]]},"388":{"position":[[422,11]]},"409":{"position":[[4010,10]]},"419":{"position":[[94,11]]},"440":{"position":[[157,11]]},"441":{"position":[[629,11]]},"481":{"position":[[168,10],[1926,10]]},"544":{"position":[[281,12]]},"564":{"position":[[475,12]]},"598":{"position":[[105,11]]},"600":{"position":[[44,11]]},"608":{"position":[[44,11]]},"613":{"position":[[44,11]]},"616":{"position":[[67,11]]},"646":{"position":[[4010,10]]},"656":{"position":[[94,11]]},"658":{"position":[[422,11]]},"687":{"position":[[157,11]]},"688":{"position":[[629,11]]},"706":{"position":[[105,11]]},"708":{"position":[[44,11]]},"716":{"position":[[44,11]]},"721":{"position":[[44,11]]},"724":{"position":[[67,11]]}},"keywords":{}}],["prepar",{"_index":94,"title":{},"content":{"2":{"position":[[81,8]]},"3":{"position":[[300,8]]},"31":{"position":[[1948,7]]},"52":{"position":[[475,7],[2220,9]]},"163":{"position":[[1396,8]]},"168":{"position":[[1946,8]]},"348":{"position":[[1946,8]]},"352":{"position":[[1418,8]]},"564":{"position":[[1946,8]]},"568":{"position":[[1418,8]]}},"keywords":{}}],["prerequisit",{"_index":2147,"title":{"173":{"position":[[0,14]]},"260":{"position":[[3,14]]},"359":{"position":[[0,14]]},"378":{"position":[[3,14]]},"400":{"position":[[3,14]]},"575":{"position":[[0,14]]},"595":{"position":[[0,14]]},"620":{"position":[[3,14]]},"637":{"position":[[3,14]]},"703":{"position":[[0,14]]}},"content":{},"keywords":{}}],["present",{"_index":270,"title":{},"content":{"9":{"position":[[317,7]]},"16":{"position":[[438,7]]},"85":{"position":[[412,9]]},"124":{"position":[[105,9]]},"129":{"position":[[475,7]]},"205":{"position":[[178,7]]},"254":{"position":[[412,9]]},"280":{"position":[[475,7]]},"309":{"position":[[105,9]]},"425":{"position":[[178,7]]},"441":{"position":[[4501,9]]},"485":{"position":[[412,9]]},"517":{"position":[[475,7]]},"526":{"position":[[105,9]]},"667":{"position":[[178,7]]},"688":{"position":[[4501,9]]}},"keywords":{}}],["pretend",{"_index":1941,"title":{},"content":{"141":{"position":[[1080,7]]},"326":{"position":[[1080,7]]},"535":{"position":[[1080,7]]}},"keywords":{}}],["pretti",{"_index":1607,"title":{},"content":{"93":{"position":[[37,6]]},"119":{"position":[[528,6]]},"145":{"position":[[27,6]]},"285":{"position":[[37,6]]},"300":{"position":[[528,6]]},"333":{"position":[[27,6]]},"497":{"position":[[37,6]]},"521":{"position":[[528,6]]},"550":{"position":[[27,6]]}},"keywords":{}}],["prev_own",{"_index":2328,"title":{},"content":{"196":{"position":[[292,11],[479,11],[1704,10]]},"197":{"position":[[432,11]]},"198":{"position":[[506,11],[838,11]]},"432":{"position":[[254,11],[416,11],[1582,10]]},"433":{"position":[[432,11]]},"434":{"position":[[501,11],[828,11]]},"679":{"position":[[254,11],[416,11],[1582,10]]},"680":{"position":[[432,11]]},"681":{"position":[[506,11],[838,11]]}},"keywords":{}}],["prevent",{"_index":1379,"title":{},"content":{"72":{"position":[[208,7]]},"236":{"position":[[208,7]]},"472":{"position":[[208,7]]},"606":{"position":[[1112,8]]},"714":{"position":[[1112,8]]}},"keywords":{}}],["previou",{"_index":1284,"title":{},"content":{"52":{"position":[[3244,8],[4890,8]]},"79":{"position":[[94,8]]},"101":{"position":[[51,8]]},"168":{"position":[[211,8]]},"184":{"position":[[915,8]]},"202":{"position":[[79,8]]},"230":{"position":[[94,8]]},"265":{"position":[[208,8]]},"267":{"position":[[1984,8]]},"293":{"position":[[51,8]]},"348":{"position":[[211,8]]},"375":{"position":[[834,8]]},"396":{"position":[[885,8]]},"405":{"position":[[208,8]]},"407":{"position":[[1984,8]]},"422":{"position":[[79,8]]},"461":{"position":[[94,8]]},"505":{"position":[[51,8]]},"564":{"position":[[211,8]]},"591":{"position":[[834,8]]},"633":{"position":[[885,8]]},"642":{"position":[[208,8]]},"644":{"position":[[1984,8]]},"664":{"position":[[79,8]]}},"keywords":{}}],["previous",{"_index":730,"title":{},"content":{"31":{"position":[[506,10]]},"101":{"position":[[644,11]]},"293":{"position":[[644,11]]},"505":{"position":[[644,11]]}},"keywords":{}}],["previous_admin_rol",{"_index":2187,"title":{},"content":{"184":{"position":[[609,20]]},"185":{"position":[[1702,19],[1845,20]]},"375":{"position":[[528,20]]},"376":{"position":[[1686,19],[1829,20]]},"591":{"position":[[528,20]]},"592":{"position":[[1686,19],[1829,20]]}},"keywords":{}}],["price",{"_index":1244,"title":{},"content":{"52":{"position":[[771,6]]},"209":{"position":[[629,7],[716,5],[1092,7],[1106,5],[1132,5]]},"212":{"position":[[528,7],[605,5],[2023,6],[2511,6],[4584,7],[4594,5],[4617,5]]},"388":{"position":[[590,7],[648,5],[1024,7],[1038,5],[1064,5]]},"391":{"position":[[528,7],[605,5],[2023,6],[2511,6],[4602,7],[4612,5],[4635,5]]},"440":{"position":[[539,6],[659,6],[1669,6],[2085,6],[2202,6]]},"441":{"position":[[2881,6],[5781,6]]},"658":{"position":[[590,7],[648,5],[1024,7],[1038,5],[1064,5]]},"661":{"position":[[528,7],[605,5],[2023,6],[2511,6],[4602,7],[4612,5],[4635,5]]},"687":{"position":[[539,6],[659,6],[1669,6],[2085,6],[2202,6]]},"688":{"position":[[2881,6],[5781,6]]}},"keywords":{}}],["price_1",{"_index":2556,"title":{},"content":{"209":{"position":[[1019,8],[1121,7]]},"388":{"position":[[951,8],[1053,7]]},"658":{"position":[[951,8],[1053,7]]}},"keywords":{}}],["price_2",{"_index":2557,"title":{},"content":{"209":{"position":[[1034,8],[1147,7]]},"388":{"position":[[966,8],[1079,7]]},"658":{"position":[[966,8],[1079,7]]}},"keywords":{}}],["prices.push(pric",{"_index":2646,"title":{},"content":{"212":{"position":[[2236,17]]},"391":{"position":[[2236,17]]},"661":{"position":[[2236,17]]}},"keywords":{}}],["primari",{"_index":939,"title":{},"content":{"39":{"position":[[1117,7]]}},"keywords":{}}],["primit",{"_index":3623,"title":{},"content":{"598":{"position":[[177,10],[665,10]]},"603":{"position":[[263,10]]},"610":{"position":[[636,10]]},"706":{"position":[[177,10],[665,10]]},"711":{"position":[[263,10]]},"718":{"position":[[636,10]]}},"keywords":{}}],["principl",{"_index":1864,"title":{},"content":{"128":{"position":[[181,9]]},"279":{"position":[[181,9]]},"516":{"position":[[181,9]]}},"keywords":{}}],["print",{"_index":292,"title":{},"content":{"9":{"position":[[924,5]]},"39":{"position":[[3148,8]]}},"keywords":{}}],["println",{"_index":3145,"title":{},"content":{"395":{"position":[[1648,9]]},"632":{"position":[[1648,9]]}},"keywords":{}}],["println!("caller'",{"_index":3575,"title":{},"content":{"477":{"position":[[2033,23]]},"699":{"position":[[2033,23]]}},"keywords":{}}],["println!("i",{"_index":294,"title":{},"content":{"9":{"position":[[943,16]]}},"keywords":{}}],["println!("owner'",{"_index":1837,"title":{},"content":{"126":{"position":[[3249,22]]},"277":{"position":[[3417,22]]},"395":{"position":[[1573,22]]},"514":{"position":[[3249,22]]},"632":{"position":[[1573,22]]}},"keywords":{}}],["println!("proof",{"_index":832,"title":{},"content":{"32":{"position":[[798,20],[1040,20]]}},"keywords":{}}],["println!("prov",{"_index":828,"title":{},"content":{"32":{"position":[[552,22],[855,22]]}},"keywords":{}}],["println!("recipient'",{"_index":1839,"title":{},"content":{"126":{"position":[[3319,26]]},"277":{"position":[[3487,26]]},"514":{"position":[[3319,26]]}},"keywords":{}}],["println!("remain",{"_index":3578,"title":{},"content":{"477":{"position":[[2202,24]]},"699":{"position":[[2202,24]]}},"keywords":{}}],["println!("token",{"_index":1825,"title":{},"content":{"126":{"position":[[2540,20],[3015,20]]},"277":{"position":[[2708,20],[3183,20]]},"395":{"position":[[969,20]]},"514":{"position":[[2540,20],[3015,20]]},"632":{"position":[[969,20]]}},"keywords":{}}],["privat",{"_index":1277,"title":{},"content":{"52":{"position":[[2295,7],[3290,7],[4911,7]]},"126":{"position":[[97,7],[183,7]]},"277":{"position":[[97,7],[183,7]]},"393":{"position":[[177,7],[364,7],[459,7]]},"395":{"position":[[677,7]]},"397":{"position":[[81,7]]},"514":{"position":[[97,7],[183,7]]},"630":{"position":[[177,7],[364,7],[459,7]]},"632":{"position":[[677,7]]},"634":{"position":[[81,7]]}},"keywords":{}}],["problem",{"_index":444,"title":{},"content":{"16":{"position":[[346,8]]},"102":{"position":[[337,7]]},"175":{"position":[[549,8]]},"294":{"position":[[337,7]]},"361":{"position":[[549,8]]},"395":{"position":[[4188,8]]},"506":{"position":[[337,7]]},"577":{"position":[[549,8]]},"632":{"position":[[4188,8]]}},"keywords":{}}],["proce",{"_index":2155,"title":{},"content":{"174":{"position":[[394,7]]},"360":{"position":[[394,7]]},"576":{"position":[[394,7]]}},"keywords":{}}],["process",{"_index":1636,"title":{},"content":{"97":{"position":[[275,8]]},"101":{"position":[[4,7]]},"115":{"position":[[1698,8]]},"120":{"position":[[149,7]]},"135":{"position":[[42,7]]},"175":{"position":[[582,8]]},"189":{"position":[[641,7]]},"198":{"position":[[1194,8]]},"258":{"position":[[1644,8]]},"261":{"position":[[31,8]]},"265":{"position":[[339,8]]},"289":{"position":[[275,8]]},"293":{"position":[[4,7]]},"301":{"position":[[149,7]]},"315":{"position":[[42,7]]},"361":{"position":[[582,8]]},"366":{"position":[[641,7]]},"379":{"position":[[31,8]]},"396":{"position":[[939,8]]},"401":{"position":[[31,8]]},"405":{"position":[[339,8]]},"415":{"position":[[21,7]]},"434":{"position":[[1184,8]]},"481":{"position":[[1644,8]]},"501":{"position":[[275,8]]},"505":{"position":[[4,7]]},"522":{"position":[[149,7]]},"532":{"position":[[42,7]]},"577":{"position":[[582,8]]},"582":{"position":[[641,7]]},"621":{"position":[[31,8]]},"633":{"position":[[939,8]]},"638":{"position":[[31,8]]},"642":{"position":[[339,8]]},"652":{"position":[[21,7]]},"681":{"position":[[1194,8]]}},"keywords":{}}],["processed"",{"_index":352,"title":{},"content":{"10":{"position":[[1081,17]]}},"keywords":{}}],["produc",{"_index":214,"title":{},"content":{"6":{"position":[[291,7]]},"8":{"position":[[177,8]]},"16":{"position":[[393,9]]},"30":{"position":[[607,8]]},"39":{"position":[[3225,8]]},"100":{"position":[[206,8]]},"292":{"position":[[206,8]]},"440":{"position":[[3745,7]]},"504":{"position":[[206,8]]},"687":{"position":[[3745,7]]}},"keywords":{}}],["product",{"_index":250,"title":{},"content":{"8":{"position":[[525,7],[579,7]]},"21":{"position":[[353,8]]}},"keywords":{}}],["profession",{"_index":40,"title":{},"content":{"1":{"position":[[462,13]]}},"keywords":{}}],["profil",{"_index":2806,"title":{},"content":{"265":{"position":[[288,8]]},"405":{"position":[[288,8]]},"642":{"position":[[288,8]]}},"keywords":{}}],["profile.dev.package."*"",{"_index":1889,"title":{},"content":{"131":{"position":[[473,35]]},"265":{"position":[[883,35]]},"311":{"position":[[525,35]]},"395":{"position":[[3563,35]]},"405":{"position":[[883,35]]},"528":{"position":[[525,35]]},"632":{"position":[[3563,35]]},"642":{"position":[[883,35]]}},"keywords":{}}],["profile.releas",{"_index":1885,"title":{},"content":{"131":{"position":[[426,17]]},"265":{"position":[[836,17]]},"311":{"position":[[478,17]]},"395":{"position":[[3516,17]]},"405":{"position":[[836,17]]},"528":{"position":[[478,17]]},"632":{"position":[[3516,17]]},"642":{"position":[[836,17]]}},"keywords":{}}],["program",{"_index":213,"title":{},"content":{"6":{"position":[[282,8]]},"8":{"position":[[4,7],[150,7]]},"9":{"position":[[27,7]]},"10":{"position":[[74,7]]},"18":{"position":[[225,11]]},"31":{"position":[[803,7]]},"32":{"position":[[37,8]]},"50":{"position":[[376,11]]},"613":{"position":[[1997,11]]},"721":{"position":[[1997,11]]}},"keywords":{}}],["progress",{"_index":3231,"title":{},"content":{"416":{"position":[[1543,9],[2760,9]]},"419":{"position":[[396,9],[445,9],[4062,9],[4715,9]]},"653":{"position":[[1543,9],[2760,9]]},"656":{"position":[[396,9],[445,9],[4062,9],[4715,9]]}},"keywords":{}}],["project",{"_index":36,"title":{"2":{"position":[[23,8]]},"117":{"position":[[9,9]]},"175":{"position":[[20,8]]},"183":{"position":[[0,7]]},"298":{"position":[[9,9]]},"361":{"position":[[20,8]]},"374":{"position":[[0,7]]},"439":{"position":[[10,8]]},"519":{"position":[[9,9]]},"577":{"position":[[20,8]]},"590":{"position":[[0,7]]},"686":{"position":[[10,8]]}},"content":{"1":{"position":[[391,8]]},"2":{"position":[[419,8],[628,8]]},"3":{"position":[[205,8]]},"12":{"position":[[330,7]]},"26":{"position":[[78,7]]},"28":{"position":[[78,7]]},"36":{"position":[[78,7]]},"42":{"position":[[51,8],[173,8],[284,7]]},"46":{"position":[[78,7]]},"48":{"position":[[78,7]]},"57":{"position":[[78,7]]},"59":{"position":[[78,7]]},"61":{"position":[[79,7]]},"63":{"position":[[79,7]]},"68":{"position":[[156,8]]},"88":{"position":[[217,8]]},"117":{"position":[[35,8],[164,7],[192,7],[464,7],[661,7],[748,9],[990,7],[1062,7],[1171,7],[1261,7],[1321,7],[1414,7]]},"119":{"position":[[53,7],[405,8]]},"131":{"position":[[541,7]]},"146":{"position":[[656,7]]},"175":{"position":[[16,8],[66,7]]},"214":{"position":[[79,7]]},"216":{"position":[[79,7]]},"225":{"position":[[79,7]]},"243":{"position":[[156,8]]},"248":{"position":[[164,7]]},"250":{"position":[[217,8]]},"264":{"position":[[181,7],[456,8],[499,9],[538,8]]},"298":{"position":[[35,8],[164,7],[192,7],[464,7],[661,7],[748,9],[990,7],[1062,7],[1171,7],[1261,7],[1321,7],[1414,7]]},"300":{"position":[[53,7],[405,8]]},"311":{"position":[[593,7]]},"321":{"position":[[63,8]]},"334":{"position":[[660,7]]},"361":{"position":[[16,8],[66,7]]},"382":{"position":[[269,8],[312,9],[351,8]]},"404":{"position":[[181,7],[456,8],[499,9],[538,8]]},"414":{"position":[[30,8]]},"439":{"position":[[102,7]]},"447":{"position":[[164,7]]},"449":{"position":[[79,7]]},"468":{"position":[[156,8]]},"488":{"position":[[217,8]]},"519":{"position":[[35,8],[164,7],[192,7],[464,7],[661,7],[748,9],[990,7],[1062,7],[1171,7],[1261,7],[1321,7],[1414,7]]},"521":{"position":[[53,7],[405,8]]},"528":{"position":[[593,7]]},"539":{"position":[[63,8]]},"551":{"position":[[660,7]]},"577":{"position":[[16,8],[66,7]]},"624":{"position":[[269,8],[312,9],[351,8]]},"641":{"position":[[181,7],[456,8],[499,9],[538,8]]},"651":{"position":[[30,8]]},"674":{"position":[[164,7]]},"686":{"position":[[102,7]]}},"keywords":{}}],["project'",{"_index":1330,"title":{},"content":{"65":{"position":[[286,9]]},"117":{"position":[[346,9]]},"240":{"position":[[286,9]]},"298":{"position":[[346,9]]},"465":{"position":[[286,9]]},"519":{"position":[[346,9]]}},"keywords":{}}],["project?point",{"_index":127,"title":{},"content":{"3":{"position":[[93,13]]}},"keywords":{}}],["project_nam",{"_index":1754,"title":{},"content":{"117":{"position":[[123,15]]},"298":{"position":[[123,15]]},"519":{"position":[[123,15]]}},"keywords":{}}],["promis",{"_index":860,"title":{},"content":{"33":{"position":[[201,10]]}},"keywords":{}}],["proof",{"_index":206,"title":{},"content":{"6":{"position":[[178,5],[299,6]]},"8":{"position":[[188,5]]},"9":{"position":[[49,5]]},"10":{"position":[[37,5],[398,5],[847,5]]},"11":{"position":[[102,5]]},"32":{"position":[[1467,6],[1732,5],[1791,5]]},"33":{"position":[[58,5]]}},"keywords":{}}],["proof.anonym",{"_index":189,"title":{},"content":{"5":{"position":[[335,15]]}},"keywords":{}}],["proper",{"_index":1591,"title":{},"content":{"92":{"position":[[169,6]]},"126":{"position":[[1096,6]]},"277":{"position":[[1264,6]]},"284":{"position":[[169,6]]},"496":{"position":[[169,6]]},"514":{"position":[[1096,6]]}},"keywords":{}}],["properti",{"_index":2812,"title":{},"content":{"266":{"position":[[83,8]]},"406":{"position":[[83,8]]},"643":{"position":[[83,8]]}},"keywords":{}}],["propos",{"_index":156,"title":{},"content":{"3":{"position":[[548,7],[595,9]]},"365":{"position":[[25,8],[201,8]]},"395":{"position":[[1042,7]]},"416":{"position":[[70,7],[506,8],[949,8],[1209,9],[1286,7],[1374,8],[1499,9],[1680,7],[1840,8],[2645,8]]},"419":{"position":[[587,7],[877,8],[3893,8],[4018,9],[4197,7],[4358,8],[4600,8]]},"581":{"position":[[25,8],[201,8]]},"632":{"position":[[1042,7]]},"653":{"position":[[70,7],[506,8],[949,8],[1209,9],[1286,7],[1374,8],[1499,9],[1680,7],[1840,8],[2645,8]]},"656":{"position":[[587,7],[877,8],[3893,8],[4018,9],[4197,7],[4358,8],[4600,8]]}},"keywords":{}}],["propose_new_mint(&mut",{"_index":3230,"title":{},"content":{"416":{"position":[[1419,25]]},"419":{"position":[[3938,25]]},"653":{"position":[[1419,25]]},"656":{"position":[[3938,25]]}},"keywords":{}}],["proposed_mint",{"_index":3219,"title":{},"content":{"416":{"position":[[521,14],[888,13],[4393,14]]},"419":{"position":[[892,14],[5973,14]]},"653":{"position":[[521,14],[888,13],[4393,14]]},"656":{"position":[[892,14],[5973,14]]}},"keywords":{}}],["protocol",{"_index":594,"title":{},"content":{"20":{"position":[[524,10]]}},"keywords":{}}],["provable."",{"_index":284,"title":{},"content":{"9":{"position":[[737,17]]}},"keywords":{}}],["prove",{"_index":190,"title":{},"content":{"5":{"position":[[359,5]]},"6":{"position":[[272,5]]},"8":{"position":[[19,7],[74,5]]},"9":{"position":[[994,5]]},"15":{"position":[[15,6]]},"32":{"position":[[1703,7],[1759,7]]},"33":{"position":[[128,7]]},"168":{"position":[[282,5]]},"348":{"position":[[282,5]]},"564":{"position":[[282,5]]}},"keywords":{}}],["proven",{"_index":300,"title":{},"content":{"9":{"position":[[1111,6]]}},"keywords":{}}],["prover",{"_index":227,"title":{"9":{"position":[[0,7]]}},"content":{"7":{"position":[[196,6]]},"9":{"position":[[194,7],[364,6],[645,6]]},"32":{"position":[[1161,7],[1234,6],[1408,7]]}},"keywords":{}}],["prover.add_input_u32_slice(to_vec(&a).unwrap().as_slic",{"_index":279,"title":{},"content":{"9":{"position":[[510,63]]}},"keywords":{}}],["prover.add_input_u32_slice(to_vec(&b).unwrap().as_slic",{"_index":280,"title":{},"content":{"9":{"position":[[574,63]]}},"keywords":{}}],["prover.add_input_u32_slice(to_vec(input).unwrap().as_slic",{"_index":844,"title":{},"content":{"32":{"position":[[1330,62]]}},"keywords":{}}],["prover.run",{"_index":282,"title":{},"content":{"9":{"position":[[689,12]]}},"keywords":{}}],["prover.run().unwrap",{"_index":845,"title":{},"content":{"32":{"position":[[1430,22]]}},"keywords":{}}],["prover/src/main.r",{"_index":261,"title":{},"content":{"9":{"position":[[86,18]]}},"keywords":{}}],["prover::new(&method_cod",{"_index":841,"title":{},"content":{"32":{"position":[[1243,29]]}},"keywords":{}}],["prover::new(&multiply_src",{"_index":274,"title":{},"content":{"9":{"position":[[373,30]]}},"keywords":{}}],["provid",{"_index":1019,"title":{},"content":{"40":{"position":[[205,7]]},"76":{"position":[[141,8]]},"78":{"position":[[282,8]]},"88":{"position":[[83,8]]},"97":{"position":[[118,8]]},"102":{"position":[[556,8]]},"114":{"position":[[74,8]]},"119":{"position":[[286,7]]},"126":{"position":[[35,7],[1630,7]]},"148":{"position":[[854,8]]},"149":{"position":[[66,8]]},"162":{"position":[[621,9]]},"173":{"position":[[172,7]]},"184":{"position":[[805,8]]},"189":{"position":[[244,8]]},"198":{"position":[[3613,8]]},"227":{"position":[[141,8]]},"229":{"position":[[303,8]]},"250":{"position":[[83,8]]},"257":{"position":[[74,8]]},"270":{"position":[[462,7]]},"277":{"position":[[35,7],[1202,8],[1798,7]]},"289":{"position":[[118,8]]},"294":{"position":[[556,8]]},"300":{"position":[[286,7]]},"324":{"position":[[1359,8]]},"336":{"position":[[854,8]]},"337":{"position":[[66,8]]},"351":{"position":[[658,9]]},"359":{"position":[[172,7]]},"366":{"position":[[244,8]]},"375":{"position":[[724,8]]},"385":{"position":[[462,7]]},"398":{"position":[[308,9]]},"410":{"position":[[462,7]]},"414":{"position":[[623,8]]},"434":{"position":[[3595,8]]},"458":{"position":[[141,8]]},"460":{"position":[[303,8]]},"477":{"position":[[4088,9]]},"480":{"position":[[74,8]]},"488":{"position":[[83,8]]},"501":{"position":[[118,8]]},"506":{"position":[[556,8]]},"514":{"position":[[35,7],[1630,7]]},"521":{"position":[[286,7]]},"542":{"position":[[1359,8]]},"553":{"position":[[854,8]]},"554":{"position":[[66,8]]},"567":{"position":[[658,9]]},"575":{"position":[[172,7]]},"582":{"position":[[244,8]]},"591":{"position":[[724,8]]},"594":{"position":[[384,9]]},"598":{"position":[[1625,8]]},"600":{"position":[[808,7]]},"612":{"position":[[2055,8]]},"613":{"position":[[1440,8]]},"618":{"position":[[318,8]]},"627":{"position":[[462,7]]},"635":{"position":[[308,9]]},"647":{"position":[[462,7]]},"651":{"position":[[623,8]]},"681":{"position":[[3613,8]]},"699":{"position":[[4088,9]]},"702":{"position":[[384,9]]},"706":{"position":[[1625,8]]},"708":{"position":[[808,7]]},"720":{"position":[[2055,8]]},"721":{"position":[[1440,8]]},"726":{"position":[[318,8]]}},"keywords":{}}],["proxi",{"_index":1593,"title":{"475":{"position":[[6,5]]},"697":{"position":[[6,5]]}},"content":{"92":{"position":[[406,5]]},"146":{"position":[[207,5]]},"178":{"position":[[221,5]]},"284":{"position":[[406,5]]},"334":{"position":[[207,5]]},"369":{"position":[[221,5]]},"477":{"position":[[3157,6],[4081,6]]},"496":{"position":[[406,5]]},"551":{"position":[[207,5]]},"585":{"position":[[221,5]]},"699":{"position":[[3157,6],[4081,6]]}},"keywords":{}}],["proxy_cal",{"_index":3594,"title":{},"content":{"478":{"position":[[44,12],[163,12]]},"700":{"position":[[44,12],[163,12]]}},"keywords":{}}],["proxy_caller.wasm",{"_index":1680,"title":{"103":{"position":[[6,18]]},"295":{"position":[[6,18]]},"507":{"position":[[6,18]]}},"content":{"102":{"position":[[575,17]]},"103":{"position":[[11,17]]},"294":{"position":[[575,17]]},"295":{"position":[[11,17]]},"506":{"position":[[575,17]]},"507":{"position":[[11,17]]}},"keywords":{}}],["proxy_caller.wasmw",{"_index":1682,"title":{},"content":{"102":{"position":[[688,19]]},"294":{"position":[[688,19]]},"506":{"position":[[688,19]]}},"keywords":{}}],["pub",{"_index":237,"title":{},"content":{"8":{"position":[[240,3]]},"10":{"position":[[715,3],[867,3],[990,3]]},"17":{"position":[[427,3],[642,3],[735,3],[801,3],[924,3],[995,3],[1072,3],[1391,3],[1551,3],[1955,3],[2236,3],[2505,3],[2586,3],[2687,3],[3080,3],[3693,3],[3842,3],[3991,3]]},"22":{"position":[[1090,3],[1187,3],[1254,3],[1314,3]]},"31":{"position":[[547,3],[696,3]]},"32":{"position":[[362,3]]},"39":{"position":[[652,3],[684,3],[716,3],[730,3],[750,3],[772,3],[799,3],[1984,3],[2256,3]]},"42":{"position":[[1470,3]]},"51":{"position":[[489,3],[510,3],[588,3],[704,3],[923,3],[1036,3],[1170,3],[1196,3],[1216,3],[1236,3],[1283,3],[1301,3]]},"71":{"position":[[47,3]]},"73":{"position":[[16,3],[141,3]]},"78":{"position":[[178,3]]},"79":{"position":[[681,3],[838,3],[959,3]]},"80":{"position":[[229,3],[361,3],[440,3],[520,3],[714,3]]},"83":{"position":[[538,3]]},"84":{"position":[[214,3],[560,3]]},"108":{"position":[[97,3]]},"115":{"position":[[208,3],[333,3],[580,3],[646,3],[733,3],[796,3],[833,3],[872,3],[909,3],[952,3],[1009,3],[1103,3],[1146,3],[1210,3],[2010,3],[2176,3],[2478,3],[2544,3],[2621,3],[2685,3],[2750,3],[2810,3]]},"141":{"position":[[570,3],[1239,3]]},"146":{"position":[[127,3]]},"147":{"position":[[245,3],[713,3],[1075,3],[1197,3]]},"162":{"position":[[347,3],[764,3],[949,3],[1016,3],[1084,3],[1151,3],[1256,3],[2170,3]]},"163":{"position":[[377,3],[787,3],[935,3],[1603,3]]},"164":{"position":[[170,3],[552,3],[618,3],[685,3],[747,3],[822,3]]},"165":{"position":[[229,3],[246,3],[264,3],[277,3]]},"178":{"position":[[141,3],[551,3],[662,3],[784,3],[950,3]]},"184":{"position":[[311,3],[336,3],[352,3],[374,3],[435,3],[460,3],[476,3],[498,3],[559,3],[589,3],[605,3],[636,3],[1004,3]]},"185":{"position":[[229,3],[255,3],[374,3],[523,3],[655,3],[834,3],[1028,3],[1224,3],[1470,3],[1619,3],[1900,3],[2170,3]]},"195":{"position":[[104,3]]},"196":{"position":[[80,3],[356,3],[445,3],[475,3],[514,3]]},"197":{"position":[[46,3],[204,3],[493,3],[684,3]]},"203":{"position":[[133,3]]},"204":{"position":[[63,3],[314,3],[381,3],[452,3],[523,3],[619,3],[887,3],[909,3],[942,3],[973,3]]},"205":{"position":[[286,3],[450,3],[686,3],[927,3],[1037,3],[2095,3],[2117,3],[2137,3],[2159,3],[2198,3]]},"206":{"position":[[22,3]]},"209":{"position":[[572,3],[705,3],[817,3],[957,3],[1238,3]]},"212":{"position":[[471,3],[594,3]]},"219":{"position":[[314,3],[422,3],[442,3],[504,3],[526,3]]},"220":{"position":[[189,3]]},"221":{"position":[[73,3],[148,3],[257,3]]},"222":{"position":[[90,3],[239,3]]},"223":{"position":[[332,3],[462,3],[611,3],[667,3],[727,3]]},"229":{"position":[[178,3]]},"230":{"position":[[698,3],[855,3],[976,3]]},"231":{"position":[[229,3],[361,3],[440,3],[520,3],[714,3]]},"235":{"position":[[47,3]]},"237":{"position":[[16,3],[141,3]]},"246":{"position":[[219,3]]},"247":{"position":[[98,3],[317,3],[375,3],[437,3],[499,3],[571,3],[669,3],[793,3],[912,3],[1069,3],[1182,3],[1253,3],[1363,3]]},"252":{"position":[[538,3]]},"253":{"position":[[214,3],[560,3]]},"258":{"position":[[198,3],[323,3],[1156,3],[1956,3],[2122,3],[2736,3]]},"267":{"position":[[934,3],[1080,3],[1314,3],[1587,3],[1609,3],[1642,3],[1673,3],[3336,3],[3863,3]]},"269":{"position":[[301,3],[551,3],[1032,3],[1196,3],[1432,3],[1673,3],[1783,3],[1926,3],[2153,3],[3264,3],[3390,3],[3412,3],[3445,3],[3476,3],[3534,3],[3556,3],[3576,3],[3598,3],[3618,3],[3677,3]]},"275":{"position":[[101,3]]},"321":{"position":[[929,3],[1114,3],[1332,3],[1486,3],[1719,3],[1862,3],[2051,3],[2187,3]]},"326":{"position":[[570,3],[1239,3]]},"334":{"position":[[127,3]]},"335":{"position":[[245,3],[721,3],[1083,3],[1205,3]]},"351":{"position":[[384,3],[786,3],[971,3],[1038,3],[1106,3],[1173,3],[1278,3],[2192,3]]},"352":{"position":[[399,3],[809,3],[957,3],[1625,3]]},"353":{"position":[[205,3],[587,3],[653,3],[720,3],[782,3],[857,3]]},"354":{"position":[[267,3],[284,3],[302,3],[315,3]]},"369":{"position":[[141,3],[551,3],[662,3],[784,3],[950,3]]},"375":{"position":[[278,3],[303,3],[319,3],[341,3],[378,3],[403,3],[419,3],[441,3],[478,3],[508,3],[524,3],[555,3],[901,3]]},"376":{"position":[[213,3],[239,3],[358,3],[507,3],[639,3],[818,3],[1012,3],[1208,3],[1454,3],[1603,3],[1884,3],[2154,3]]},"383":{"position":[[353,3],[370,3],[388,3],[401,3],[709,3],[760,3],[1109,3],[1131,3],[1164,3],[1195,3]]},"384":{"position":[[314,3],[564,3],[1045,3],[1209,3],[1445,3],[1686,3],[1803,3],[1946,3],[2173,3],[3305,3],[3400,3],[3422,3],[3455,3],[3486,3],[3520,3],[3542,3],[3562,3],[3584,3],[3604,3],[3641,3]]},"388":{"position":[[533,3],[637,3],[749,3],[889,3],[1170,3]]},"391":{"position":[[471,3],[594,3]]},"395":{"position":[[1766,3]]},"407":{"position":[[934,3],[1080,3],[1314,3],[1587,3],[1609,3],[1642,3],[1673,3],[3336,3],[3863,3]]},"409":{"position":[[301,3],[551,3],[1032,3],[1196,3],[1432,3],[1673,3],[1783,3],[1926,3],[2153,3],[3264,3],[3390,3],[3412,3],[3445,3],[3476,3],[3534,3],[3556,3],[3576,3],[3598,3],[3618,3],[3677,3]]},"414":{"position":[[213,3]]},"416":{"position":[[385,3],[1412,3],[2660,3],[3490,3]]},"419":{"position":[[342,3],[757,3],[1363,3],[3931,3],[4615,3],[5069,3]]},"423":{"position":[[133,3]]},"424":{"position":[[38,3],[289,3],[356,3],[427,3],[498,3],[594,3],[838,3],[860,3],[893,3],[924,3]]},"425":{"position":[[261,3],[425,3],[661,3],[902,3],[1012,3],[2046,3],[2068,3],[2088,3],[2110,3],[2148,3]]},"426":{"position":[[22,3]]},"431":{"position":[[104,3]]},"432":{"position":[[42,3],[317,3],[382,3],[412,3],[451,3]]},"433":{"position":[[46,3],[204,3],[493,3],[683,3]]},"440":{"position":[[389,3],[433,3],[495,3],[591,3],[689,3],[774,3],[974,3],[1150,3],[1614,3],[2232,3],[3244,3],[6238,3]]},"441":{"position":[[692,3],[770,3],[881,3],[1071,3],[1526,3],[2280,3],[2362,3],[2464,3],[2826,3],[3107,3]]},"445":{"position":[[219,3]]},"446":{"position":[[98,3],[317,3],[375,3],[437,3],[499,3],[571,3],[669,3],[793,3],[912,3],[1069,3],[1182,3],[1253,3],[1363,3]]},"452":{"position":[[293,3],[377,3],[397,3],[435,3],[457,3]]},"453":{"position":[[189,3]]},"454":{"position":[[73,3],[148,3],[257,3]]},"455":{"position":[[90,3],[239,3]]},"456":{"position":[[332,3],[462,3],[611,3],[667,3],[727,3]]},"460":{"position":[[178,3]]},"461":{"position":[[698,3],[855,3],[976,3]]},"462":{"position":[[229,3],[361,3],[440,3],[520,3],[714,3]]},"471":{"position":[[47,3]]},"473":{"position":[[16,3],[141,3]]},"476":{"position":[[249,3],[490,3],[640,3],[1214,3],[1342,3],[1469,3],[1622,3],[1739,3],[1760,3],[1782,3],[1838,3],[1862,3],[1884,3]]},"481":{"position":[[198,3],[323,3],[1156,3],[1956,3],[2122,3],[2736,3]]},"483":{"position":[[538,3]]},"484":{"position":[[214,3],[560,3]]},"492":{"position":[[101,3]]},"535":{"position":[[570,3],[1239,3]]},"539":{"position":[[929,3],[1114,3],[1332,3],[1486,3],[1719,3],[1862,3],[2051,3],[2187,3]]},"551":{"position":[[127,3]]},"552":{"position":[[245,3],[721,3],[1083,3],[1205,3]]},"567":{"position":[[384,3],[786,3],[971,3],[1038,3],[1106,3],[1173,3],[1278,3],[2192,3]]},"568":{"position":[[399,3],[809,3],[957,3],[1625,3]]},"569":{"position":[[205,3],[587,3],[653,3],[720,3],[782,3],[857,3]]},"570":{"position":[[267,3],[284,3],[302,3],[315,3]]},"585":{"position":[[141,3],[551,3],[662,3],[784,3],[950,3]]},"591":{"position":[[278,3],[303,3],[319,3],[341,3],[378,3],[403,3],[419,3],[441,3],[478,3],[508,3],[524,3],[555,3],[901,3]]},"592":{"position":[[213,3],[239,3],[358,3],[507,3],[639,3],[818,3],[1012,3],[1208,3],[1454,3],[1603,3],[1884,3],[2154,3]]},"596":{"position":[[221,3],[307,3],[380,3]]},"598":{"position":[[166,3],[678,3],[1145,3],[1228,3],[1313,3],[1457,3]]},"599":{"position":[[94,3],[149,3],[197,3]]},"600":{"position":[[78,3],[187,3],[299,3]]},"601":{"position":[[79,3],[200,3],[450,3],[541,3],[641,3],[766,3],[890,3],[999,3],[1156,3],[1319,3],[1432,3],[1503,3],[1627,3],[1732,3]]},"602":{"position":[[80,3],[175,3],[250,3],[318,3],[389,3],[457,3],[994,3],[1061,3],[1286,3],[1384,3],[1549,3],[1763,3]]},"604":{"position":[[141,3]]},"605":{"position":[[44,3],[124,3],[203,3]]},"606":{"position":[[44,3],[160,3]]},"607":{"position":[[137,5],[226,5]]},"608":{"position":[[103,3],[184,3],[269,3],[299,3],[333,3],[510,3]]},"610":{"position":[[61,3],[129,3],[213,3]]},"611":{"position":[[85,3],[174,3],[221,3],[345,3]]},"612":{"position":[[478,3],[517,3],[600,3],[664,3],[747,3],[811,3],[894,3],[981,3],[1051,3],[1138,3],[1208,3],[1296,3]]},"613":{"position":[[119,3],[379,3],[941,3]]},"616":{"position":[[128,3],[189,3],[523,3],[681,3],[970,3]]},"617":{"position":[[84,3],[174,3],[271,3],[624,3],[687,3]]},"625":{"position":[[353,3],[370,3],[388,3],[401,3],[709,3],[760,3],[1109,3],[1131,3],[1164,3],[1195,3]]},"626":{"position":[[314,3],[564,3],[1045,3],[1209,3],[1445,3],[1686,3],[1803,3],[1946,3],[2173,3],[3305,3],[3400,3],[3422,3],[3455,3],[3486,3],[3520,3],[3542,3],[3562,3],[3584,3],[3604,3],[3641,3]]},"632":{"position":[[1766,3]]},"644":{"position":[[934,3],[1080,3],[1314,3],[1587,3],[1609,3],[1642,3],[1673,3],[3336,3],[3863,3]]},"646":{"position":[[301,3],[551,3],[1032,3],[1196,3],[1432,3],[1673,3],[1783,3],[1926,3],[2153,3],[3264,3],[3390,3],[3412,3],[3445,3],[3476,3],[3534,3],[3556,3],[3576,3],[3598,3],[3618,3],[3677,3]]},"651":{"position":[[213,3]]},"653":{"position":[[385,3],[1412,3],[2660,3],[3490,3]]},"656":{"position":[[342,3],[757,3],[1363,3],[3931,3],[4615,3],[5069,3]]},"658":{"position":[[533,3],[637,3],[749,3],[889,3],[1170,3]]},"661":{"position":[[471,3],[594,3]]},"665":{"position":[[133,3]]},"666":{"position":[[38,3],[289,3],[356,3],[427,3],[498,3],[594,3],[838,3],[860,3],[893,3],[924,3]]},"667":{"position":[[261,3],[425,3],[661,3],[902,3],[1012,3],[2046,3],[2068,3],[2088,3],[2110,3],[2148,3]]},"668":{"position":[[22,3]]},"672":{"position":[[219,3]]},"673":{"position":[[98,3],[317,3],[375,3],[437,3],[499,3],[571,3],[669,3],[793,3],[912,3],[1069,3],[1182,3],[1253,3],[1363,3]]},"678":{"position":[[104,3]]},"679":{"position":[[42,3],[317,3],[382,3],[412,3],[451,3]]},"680":{"position":[[46,3],[204,3],[493,3],[683,3]]},"687":{"position":[[389,3],[433,3],[495,3],[591,3],[689,3],[774,3],[974,3],[1150,3],[1614,3],[2232,3],[3244,3],[6238,3]]},"688":{"position":[[692,3],[770,3],[881,3],[1071,3],[1526,3],[2280,3],[2362,3],[2464,3],[2826,3],[3107,3]]},"692":{"position":[[293,3],[377,3],[397,3],[435,3],[457,3]]},"693":{"position":[[189,3]]},"694":{"position":[[73,3],[148,3],[257,3]]},"695":{"position":[[90,3],[239,3]]},"696":{"position":[[332,3],[462,3],[611,3],[667,3],[727,3]]},"698":{"position":[[249,3],[490,3],[640,3],[1214,3],[1342,3],[1469,3],[1622,3],[1739,3],[1760,3],[1782,3],[1838,3],[1862,3],[1884,3]]},"704":{"position":[[221,3],[307,3],[380,3]]},"706":{"position":[[166,3],[678,3],[1145,3],[1228,3],[1313,3],[1457,3]]},"707":{"position":[[94,3],[149,3],[197,3]]},"708":{"position":[[78,3],[187,3],[299,3]]},"709":{"position":[[79,3],[200,3],[450,3],[541,3],[641,3],[766,3],[890,3],[999,3],[1156,3],[1319,3],[1432,3],[1503,3],[1627,3],[1732,3]]},"710":{"position":[[80,3],[175,3],[250,3],[318,3],[389,3],[457,3],[994,3],[1061,3],[1286,3],[1384,3],[1549,3],[1763,3]]},"712":{"position":[[141,3]]},"713":{"position":[[44,3],[124,3],[203,3]]},"714":{"position":[[44,3],[160,3]]},"715":{"position":[[137,5],[226,5]]},"716":{"position":[[103,3],[184,3],[269,3],[299,3],[333,3],[510,3]]},"718":{"position":[[61,3],[129,3],[213,3]]},"719":{"position":[[85,3],[174,3],[221,3],[345,3]]},"720":{"position":[[478,3],[517,3],[600,3],[664,3],[747,3],[811,3],[894,3],[981,3],[1051,3],[1138,3],[1208,3],[1296,3]]},"721":{"position":[[119,3],[379,3],[941,3]]},"724":{"position":[[128,3],[189,3],[523,3],[681,3],[970,3]]},"725":{"position":[[84,3],[174,3],[271,3],[624,3],[687,3]]}},"keywords":{}}],["public",{"_index":693,"title":{},"content":{"30":{"position":[[224,6],[302,6]]},"42":{"position":[[1036,6],[1154,6]]},"43":{"position":[[425,6]]},"141":{"position":[[520,6]]},"147":{"position":[[585,7]]},"204":{"position":[[1278,6],[1326,7]]},"326":{"position":[[520,6]]},"335":{"position":[[589,7]]},"415":{"position":[[135,6]]},"424":{"position":[[1228,6],[1276,7]]},"535":{"position":[[520,6]]},"552":{"position":[[589,7]]},"596":{"position":[[1039,6]]},"652":{"position":[[135,6]]},"666":{"position":[[1228,6],[1276,7]]},"704":{"position":[[1039,6]]}},"keywords":{}}],["publickey",{"_index":3566,"title":{},"content":{"477":{"position":[[1458,10]]},"699":{"position":[[1458,10]]}},"keywords":{}}],["publicwallethostref::deploy(&test_env",{"_index":2038,"title":{},"content":{"160":{"position":[[356,42]]},"345":{"position":[[356,42]]},"562":{"position":[[356,42]]}},"keywords":{}}],["publish",{"_index":1319,"title":{},"content":{"54":{"position":[[363,9]]}},"keywords":{}}],["purchas",{"_index":3339,"title":{},"content":{"438":{"position":[[176,8]]},"440":{"position":[[5998,8]]},"441":{"position":[[21,8]]},"685":{"position":[[176,8]]},"687":{"position":[[5998,8]]},"688":{"position":[[21,8]]}},"keywords":{}}],["pure",{"_index":694,"title":{"605":{"position":[[9,5]]},"713":{"position":[[9,5]]}},"content":{"30":{"position":[[231,4]]},"31":{"position":[[61,4]]},"605":{"position":[[294,4],[555,4]]},"713":{"position":[[294,4],[555,4]]}},"keywords":{}}],["purpos",{"_index":198,"title":{},"content":{"6":{"position":[[58,7]]},"39":{"position":[[86,9],[1125,7]]},"122":{"position":[[123,8]]},"131":{"position":[[618,9]]},"141":{"position":[[902,8]]},"185":{"position":[[3204,8]]},"196":{"position":[[912,8]]},"223":{"position":[[57,8]]},"303":{"position":[[123,8]]},"311":{"position":[[670,9]]},"326":{"position":[[902,8]]},"376":{"position":[[3188,8]]},"393":{"position":[[430,9]]},"432":{"position":[[850,8]]},"456":{"position":[[57,8]]},"524":{"position":[[123,8]]},"528":{"position":[[670,9]]},"535":{"position":[[902,8]]},"592":{"position":[[3188,8]]},"606":{"position":[[1055,9]]},"630":{"position":[[430,9]]},"679":{"position":[[850,8]]},"696":{"position":[[57,8]]},"714":{"position":[[1055,9]]}},"keywords":{}}],["purpose.l16",{"_index":2348,"title":{},"content":{"196":{"position":[[1553,11]]}},"keywords":{}}],["purs",{"_index":1589,"title":{},"content":{"92":{"position":[[40,6],[55,5],[93,5],[187,5],[372,6],[400,5],[493,5],[531,6],[611,5]]},"94":{"position":[[558,6],[663,5]]},"103":{"position":[[688,6]]},"284":{"position":[[40,6],[55,5],[93,5],[187,5],[372,6],[400,5],[493,5],[531,6],[611,5]]},"286":{"position":[[558,6],[663,5]]},"295":{"position":[[688,6]]},"496":{"position":[[40,6],[55,5],[93,5],[187,5],[372,6],[400,5],[493,5],[531,6],[611,5]]},"498":{"position":[[558,6],[663,5]]},"507":{"position":[[688,6]]}},"keywords":{}}],["push",{"_index":843,"title":{},"content":{"32":{"position":[[1299,4]]}},"keywords":{}}],["push_vec(&mut",{"_index":3706,"title":{},"content":{"601":{"position":[[1510,17]]},"709":{"position":[[1510,17]]}},"keywords":{}}],["put",{"_index":176,"title":{},"content":{"5":{"position":[[158,3],[300,3]]},"43":{"position":[[927,3]]},"65":{"position":[[433,3]]},"99":{"position":[[223,3]]},"100":{"position":[[317,3]]},"101":{"position":[[171,3]]},"108":{"position":[[149,3]]},"135":{"position":[[54,3]]},"136":{"position":[[65,3]]},"210":{"position":[[365,3],[1139,3]]},"240":{"position":[[433,3]]},"275":{"position":[[153,3]]},"291":{"position":[[223,3]]},"292":{"position":[[317,3]]},"293":{"position":[[171,3]]},"315":{"position":[[54,3]]},"316":{"position":[[65,3]]},"389":{"position":[[365,3],[1076,3]]},"396":{"position":[[91,3]]},"417":{"position":[[13,3]]},"419":{"position":[[1464,3]]},"465":{"position":[[433,3]]},"492":{"position":[[153,3]]},"503":{"position":[[223,3]]},"504":{"position":[[317,3]]},"505":{"position":[[171,3]]},"532":{"position":[[54,3]]},"533":{"position":[[65,3]]},"633":{"position":[[91,3]]},"654":{"position":[[13,3]]},"656":{"position":[[1464,3]]},"659":{"position":[[365,3],[1076,3]]}},"keywords":{}}],["płaskonka",{"_index":576,"title":{},"content":{"20":{"position":[[140,10]]}},"keywords":{}}],["q",{"_index":407,"title":{},"content":{"15":{"position":[[221,2],[350,2]]},"17":{"position":[[1708,2]]},"52":{"position":[[1613,1]]},"53":{"position":[[112,1]]}},"keywords":{}}],["qualifi",{"_index":1893,"title":{},"content":{"132":{"position":[[235,9]]},"312":{"position":[[235,9]]},"529":{"position":[[235,9]]}},"keywords":{}}],["qualiti",{"_index":44,"title":{},"content":{"1":{"position":[[549,7],[609,8]]}},"keywords":{}}],["queri",{"_index":450,"title":{},"content":{"17":{"position":[[69,5]]},"22":{"position":[[1015,5]]},"52":{"position":[[1582,5],[6575,5]]},"128":{"position":[[132,5],[623,5]]},"166":{"position":[[38,5]]},"279":{"position":[[132,5],[623,5]]},"355":{"position":[[38,5]]},"516":{"position":[[132,5],[623,5]]},"571":{"position":[[38,5]]}},"keywords":{}}],["query_flag",{"_index":1241,"title":{},"content":{"52":{"position":[[688,11],[1722,15]]}},"keywords":{}}],["question",{"_index":447,"title":{},"content":{"16":{"position":[[486,9]]},"24":{"position":[[103,10]]},"618":{"position":[[659,9]]},"726":{"position":[[659,9]]}},"keywords":{}}],["quick",{"_index":1226,"title":{},"content":{"52":{"position":[[204,5]]}},"keywords":{}}],["quickli",{"_index":1771,"title":{},"content":{"118":{"position":[[15,7]]},"299":{"position":[[15,7]]},"520":{"position":[[15,7]]}},"keywords":{}}],["quit",{"_index":121,"title":{},"content":{"3":{"position":[[20,5]]},"416":{"position":[[2447,5]]},"653":{"position":[[2447,5]]}},"keywords":{}}],["quot",{"_index":361,"title":{},"content":{"10":{"position":[[1424,9]]},"52":{"position":[[591,6],[659,6],[710,6],[717,6],[759,6],[872,6],[879,6],[899,6],[906,6]]},"126":{"position":[[2570,9],[3042,9],[3281,11],[3355,11]]},"212":{"position":[[247,10]]},"277":{"position":[[2738,9],[3210,9],[3449,11],[3523,11]]},"391":{"position":[[247,10]]},"395":{"position":[[999,9],[1605,11],[1692,11]]},"477":{"position":[[2066,11],[2236,11]]},"514":{"position":[[2570,9],[3042,9],[3281,11],[3355,11]]},"632":{"position":[[999,9],[1605,11],[1692,11]]},"661":{"position":[[247,10]]},"699":{"position":[[2066,11],[2236,11]]}},"keywords":{}}],["quot;".to_str",{"_index":3389,"title":{},"content":{"440":{"position":[[1840,25]]},"687":{"position":[[1840,25]]}},"keywords":{}}],["quot;../../bytecode/calculator.bin",{"_index":734,"title":{},"content":{"31":{"position":[[606,35]]}},"keywords":{}}],["quot;../odra"",{"_index":1563,"title":{},"content":{"88":{"position":[[257,20]]},"250":{"position":[[257,20]]},"477":{"position":[[853,20]]},"488":{"position":[[257,20]]},"699":{"position":[[853,20]]}},"keywords":{}}],["quot;0.1.0"",{"_index":1036,"title":{},"content":{"42":{"position":[[476,18]]},"117":{"position":[[414,17]]},"131":{"position":[[90,17]]},"265":{"position":[[492,17]]},"298":{"position":[[414,17]]},"311":{"position":[[90,17]]},"321":{"position":[[682,18]]},"323":{"position":[[518,18]]},"395":{"position":[[2595,17]]},"405":{"position":[[492,17]]},"519":{"position":[[414,17]]},"528":{"position":[[90,17]]},"539":{"position":[[682,18]]},"541":{"position":[[518,18]]},"632":{"position":[[2595,17]]},"642":{"position":[[492,17]]}},"keywords":{}}],["quot;0.8.0"",{"_index":2808,"title":{},"content":{"265":{"position":[[559,17],[608,17]]},"405":{"position":[[559,17],[608,17]]},"642":{"position":[[559,17],[608,17]]}},"keywords":{}}],["quot;0.8.1"",{"_index":1879,"title":{},"content":{"131":{"position":[[157,17],[206,17]]}},"keywords":{}}],["quot;0000000000000000000000000000000000000000000000000000000000000009"",{"_index":813,"title":{},"content":{"31":{"position":[[3665,78]]}},"keywords":{}}],["quot;0000000000000000000000000000000000000000000000000000000000000037"",{"_index":810,"title":{},"content":{"31":{"position":[[3336,78]]}},"keywords":{}}],["quot;1"",{"_index":1308,"title":{},"content":{"53":{"position":[[850,13]]}},"keywords":{}}],["quot;1.0.0"",{"_index":3600,"title":{},"content":{"528":{"position":[[157,17],[206,17],[258,17]]},"632":{"position":[[2674,18],[2762,18],[2861,18],[2941,18],[3048,18]]},"699":{"position":[[777,17],[964,18]]}},"keywords":{}}],["quot;1.1.0"",{"_index":2960,"title":{},"content":{"311":{"position":[[157,17],[206,17],[258,17]]},"395":{"position":[[2674,18],[2762,18],[2861,18],[2941,18],[3048,18]]},"477":{"position":[[777,17],[964,18]]}},"keywords":{}}],["quot;2"",{"_index":1309,"title":{},"content":{"53":{"position":[[888,13]]}},"keywords":{}}],["quot;2021"",{"_index":1757,"title":{},"content":{"117":{"position":[[442,16]]},"131":{"position":[[118,16]]},"265":{"position":[[520,16]]},"298":{"position":[[442,16]]},"311":{"position":[[118,16]]},"395":{"position":[[2623,16]]},"405":{"position":[[520,16]]},"477":{"position":[[805,16]]},"519":{"position":[[442,16]]},"528":{"position":[[118,16]]},"632":{"position":[[2623,16]]},"642":{"position":[[520,16]]},"699":{"position":[[805,16]]}},"keywords":{}}],["quot;223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef"",{"_index":3186,"title":{},"content":{"395":{"position":[[6333,77],[6437,77],[6532,76]]},"632":{"position":[[6333,77],[6437,77],[6532,76]]}},"keywords":{}}],["quot;2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361"",{"_index":3179,"title":{},"content":{"395":{"position":[[5354,77],[5458,77],[5553,76]]},"632":{"position":[[5354,77],[5458,77],[5553,76]]}},"keywords":{}}],["quot;57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e"",{"_index":3589,"title":{},"content":{"477":{"position":[[3571,77],[3666,76]]},"699":{"position":[[3571,77],[3666,76]]}},"keywords":{}}],["quot;61047ff40000000000000000000000000000000000000000000000000000000000000004"",{"_index":836,"title":{},"content":{"32":{"position":[[922,85]]}},"keywords":{}}],["quot;61047ff4000000000000000000000000000000000000000000000000000000000000000a"",{"_index":807,"title":{},"content":{"31":{"position":[[3193,85]]}},"keywords":{}}],["quot;65b1a5d21..."",{"_index":1852,"title":{},"content":{"127":{"position":[[376,25],[428,25],[471,24]]},"278":{"position":[[376,25],[428,25],[471,24]]},"515":{"position":[[376,25],[428,25],[471,24]]}},"keywords":{}}],["quot;74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558"",{"_index":3584,"title":{},"content":{"477":{"position":[[2707,77],[2802,76]]},"699":{"position":[[2707,77],[2802,76]]}},"keywords":{}}],["quot;771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002"",{"_index":812,"title":{},"content":{"31":{"position":[[3458,149]]},"32":{"position":[[616,149]]}},"keywords":{}}],["quot;a".to_str",{"_index":3813,"title":{},"content":{"612":{"position":[[554,25]]},"720":{"position":[[554,25]]}},"keywords":{}}],["quot;aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5"",{"_index":3181,"title":{},"content":{"395":{"position":[[5813,77],[5917,77],[6012,76]]},"632":{"position":[[5813,77],[5917,77],[6012,76]]}},"keywords":{}}],["quot;access"",{"_index":3025,"title":{},"content":{"323":{"position":[[2077,19],[2370,19]]},"541":{"position":[[2077,19],[2370,19]]}},"keywords":{}}],["quot;args"",{"_index":1261,"title":{},"content":{"52":{"position":[[1246,17]]}},"keywords":{}}],["quot;arguments"",{"_index":3020,"title":{},"content":{"323":{"position":[[1834,22],[2263,22],[2782,22]]},"541":{"position":[[1834,22],[2263,22],[2782,22]]}},"keywords":{}}],["quot;authors"",{"_index":2992,"title":{},"content":{"323":{"position":[[354,20]]},"541":{"position":[[354,20]]}},"keywords":{}}],["quot;b".to_str",{"_index":3815,"title":{},"content":{"612":{"position":[[701,25]]},"720":{"position":[[701,25]]}},"keywords":{}}],["quot;base_uri:string:'https://example.com/'"",{"_index":1667,"title":{},"content":{"100":{"position":[[829,50]]},"292":{"position":[[829,50]]},"504":{"position":[[829,50]]}},"keywords":{}}],["quot;bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3"",{"_index":3587,"title":{},"content":{"477":{"position":[[3190,77],[3285,76]]},"699":{"position":[[3190,77],[3285,76]]}},"keywords":{}}],["quot;bin/build_contract.rs"",{"_index":1882,"title":{},"content":{"131":{"position":[[280,33]]},"265":{"position":[[686,33]]},"311":{"position":[[332,33]]},"395":{"position":[[3238,33]]},"405":{"position":[[686,33]]},"528":{"position":[[332,33]]},"632":{"position":[[3238,33]]},"642":{"position":[[686,33]]}},"keywords":{}}],["quot;bin/build_schema.rs"",{"_index":1884,"title":{},"content":{"131":{"position":[[381,31]]},"265":{"position":[[791,31]]},"311":{"position":[[433,31]]},"395":{"position":[[3340,31]]},"405":{"position":[[791,31]]},"528":{"position":[[433,31]]},"632":{"position":[[3340,31]]},"642":{"position":[[791,31]]}},"keywords":{}}],["quot;bin/our_token_livenet.rs"",{"_index":3164,"title":{},"content":{"395":{"position":[[3437,36]]},"632":{"position":[[3437,36]]}},"keywords":{}}],["quot;bin/tlw_on_livenet.rs"",{"_index":3562,"title":{},"content":{"477":{"position":[[1164,33]]},"699":{"position":[[1164,33]]}},"keywords":{}}],["quot;bool"",{"_index":3038,"title":{},"content":{"323":{"position":[[3176,17],[3389,17]]},"541":{"position":[[3176,17],[3389,17]]}},"keywords":{}}],["quot;builder"",{"_index":1037,"title":{},"content":{"42":{"position":[[506,21]]}},"keywords":{}}],["quot;c".to_str",{"_index":3816,"title":{},"content":{"612":{"position":[[848,25]]},"720":{"position":[[848,25]]}},"keywords":{}}],["quot;c3",{"_index":3824,"title":{},"content":{"612":{"position":[[1502,8]]},"720":{"position":[[1502,8]]}},"keywords":{}}],["quot;call"",{"_index":3030,"title":{},"content":{"323":{"position":[[2598,17]]},"541":{"position":[[2598,17]]}},"keywords":{}}],["quot;cap:u256='{{cap}}'"",{"_index":1148,"title":{},"content":{"43":{"position":[[1510,30]]}},"keywords":{}}],["quot;casp",{"_index":2619,"title":{},"content":{"212":{"position":[[354,12]]},"391":{"position":[[354,12]]},"661":{"position":[[354,12]]}},"keywords":{}}],["quot;casper_contract_schema_version"",{"_index":2983,"title":{},"content":{"323":{"position":[[227,43]]},"541":{"position":[[227,43]]}},"keywords":{}}],["quot;cat",{"_index":3554,"title":{},"content":{"477":{"position":[[383,9]]},"699":{"position":[[383,9]]}},"keywords":{}}],["quot;cod",{"_index":299,"title":{},"content":{"9":{"position":[[1091,10]]}},"keywords":{}}],["quot;contract_name"",{"_index":2996,"title":{},"content":{"323":{"position":[[437,26]]},"541":{"position":[[437,26]]}},"keywords":{}}],["quot;contract_version"",{"_index":2997,"title":{},"content":{"323":{"position":[[488,29]]},"541":{"position":[[488,29]]}},"keywords":{}}],["quot;created"",{"_index":3000,"title":{},"content":{"323":{"position":[[600,20],[2456,20],[2493,19]]},"541":{"position":[[600,20],[2456,20],[2493,19]]}},"keywords":{}}],["quot;data"",{"_index":3005,"title":{},"content":{"323":{"position":[[830,17],[2313,17]]},"541":{"position":[[830,17],[2313,17]]}},"keywords":{}}],["quot;deposit"",{"_index":3586,"title":{},"content":{"477":{"position":[[3129,19]]},"699":{"position":[[3129,19]]}},"keywords":{}}],["quot;description"",{"_index":3001,"title":{},"content":{"323":{"position":[[621,24],[713,24],[848,24],[940,24],[1048,24],[1183,24],[1275,24],[1419,24],[1554,24],[1714,24],[1897,24],[2161,24],[2675,24],[2871,24],[3081,24],[3281,24],[3476,24],[3613,24]]},"541":{"position":[[621,24],[713,24],[848,24],[940,24],[1048,24],[1183,24],[1275,24],[1419,24],[1554,24],[1714,24],[1897,24],[2161,24],[2675,24],[2871,24],[3081,24],[3281,24],[3476,24],[3613,24]]}},"keywords":{}}],["quot;description:string='mi",{"_index":2587,"title":{},"content":{"210":{"position":[[906,28]]},"389":{"position":[[843,28]]},"659":{"position":[[843,28]]}},"keywords":{}}],["quot;dis",{"_index":1564,"title":{},"content":{"88":{"position":[[289,14]]},"250":{"position":[[289,14]]},"488":{"position":[[289,14]]}},"keywords":{}}],["quot;discriminant"",{"_index":3013,"title":{},"content":{"323":{"position":[[1477,25],[1613,25]]},"541":{"position":[[1477,25],[1613,25]]}},"keywords":{}}],["quot;e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227"",{"_index":3175,"title":{},"content":{"395":{"position":[[4687,77],[4791,77],[4886,76]]},"632":{"position":[[4687,77],[4791,77],[4886,76]]}},"keywords":{}}],["quot;entry_points"",{"_index":3015,"title":{},"content":{"323":{"position":[[1646,25]]},"541":{"position":[[1646,25]]}},"keywords":{}}],["quot;erc20_on_livenet"",{"_index":1843,"title":{},"content":{"126":{"position":[[3529,28]]},"277":{"position":[[3697,28]]},"514":{"position":[[3529,28]]}},"keywords":{}}],["quot;errors"",{"_index":3009,"title":{},"content":{"323":{"position":[[1352,19]]},"541":{"position":[[1352,19]]}},"keywords":{}}],["quot;events"",{"_index":3029,"title":{},"content":{"323":{"position":[[2414,19]]},"541":{"position":[[2414,19]]}},"keywords":{}}],["quot;events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.msgexecutecontract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm",{"_index":1293,"title":{},"content":{"52":{"position":[[5025,888]]}},"keywords":{}}],["quot;events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.msginstantiatecontract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm",{"_index":1288,"title":{},"content":{"52":{"position":[[3387,959]]}},"keywords":{}}],["quot;events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.msgstorecode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"",{"_index":1280,"title":{},"content":{"52":{"position":[[2355,649]]}},"keywords":{}}],["quot;get_data"",{"_index":3027,"title":{},"content":{"323":{"position":[[2139,21]]},"541":{"position":[[2139,21]]}},"keywords":{}}],["quot;get_value"",{"_index":1267,"title":{},"content":{"52":{"position":[[1697,24]]}},"keywords":{}}],["quot;hash",{"_index":1811,"title":{},"content":{"126":{"position":[[1702,10],[2667,10]]},"127":{"position":[[281,10]]},"142":{"position":[[328,10]]},"212":{"position":[[236,10]]},"277":{"position":[[1870,10],[2835,10]]},"278":{"position":[[281,10]]},"327":{"position":[[328,10]]},"391":{"position":[[236,10]]},"395":{"position":[[763,10],[2288,10],[5005,10],[5200,10],[5671,10],[6190,10]]},"477":{"position":[[2921,10],[3031,10],[3425,10]]},"514":{"position":[[1702,10],[2667,10]]},"515":{"position":[[281,10]]},"536":{"position":[[328,10]]},"598":{"position":[[843,10]]},"632":{"position":[[763,10],[2288,10],[5005,10],[5200,10],[5671,10],[6190,10]]},"661":{"position":[[236,10]]},"699":{"position":[[2921,10],[3031,10],[3425,10]]},"706":{"position":[[843,10]]}},"keywords":{}}],["quot;hello",{"_index":3611,"title":{},"content":{"596":{"position":[[26,11]]},"610":{"position":[[312,11],[406,11]]},"704":{"position":[[26,11]]},"718":{"position":[[312,11],[406,11]]}},"keywords":{}}],["quot;homepage"",{"_index":2995,"title":{},"content":{"323":{"position":[[409,21]]},"541":{"position":[[409,21]]}},"keywords":{}}],["quot;http://localhost:11101/rpc"",{"_index":2617,"title":{},"content":{"212":{"position":[[289,39]]},"391":{"position":[[289,39]]},"661":{"position":[[289,39]]}},"keywords":{}}],["quot;increment"",{"_index":1266,"title":{},"content":{"52":{"position":[[1520,24]]}},"keywords":{}}],["quot;init"",{"_index":1260,"title":{},"content":{"52":{"position":[[1228,17]]}},"keywords":{}}],["quot;initi",{"_index":3033,"title":{},"content":{"323":{"position":[[2700,17]]},"541":{"position":[[2700,17]]}},"keywords":{}}],["quot;initial_owner:opt_key='{{owner}}'"",{"_index":1149,"title":{},"content":{"43":{"position":[[1557,45]]}},"keywords":{}}],["quot;invalidname"",{"_index":3010,"title":{},"content":{"323":{"position":[[1394,24]]},"541":{"position":[[1394,24]]}},"keywords":{}}],["quot;invalidowner"",{"_index":3014,"title":{},"content":{"323":{"position":[[1528,25]]},"541":{"position":[[1528,25]]}},"keywords":{}}],["quot;is_contract_context"",{"_index":3024,"title":{},"content":{"323":{"position":[[2038,32],[2331,32]]},"541":{"position":[[2038,32],[2331,32]]}},"keywords":{}}],["quot;is_mutable"",{"_index":3019,"title":{},"content":{"323":{"position":[[1804,23],[2232,23]]},"541":{"position":[[1804,23],[2232,23]]}},"keywords":{}}],["quot;key"",{"_index":3007,"title":{},"content":{"323":{"position":[[1095,15],[3660,16]]},"541":{"position":[[1095,15],[3660,16]]}},"keywords":{}}],["quot;livenet"",{"_index":1845,"title":{},"content":{"126":{"position":[[3625,21]]},"277":{"position":[[3793,21]]},"395":{"position":[[3494,21]]},"477":{"position":[[1218,21]]},"514":{"position":[[3625,21]]},"632":{"position":[[3494,21]]},"699":{"position":[[1218,21]]}},"keywords":{}}],["quot;members"",{"_index":3002,"title":{},"content":{"323":{"position":[[652,20],[879,20],[1214,20]]},"541":{"position":[[652,20],[879,20],[1214,20]]}},"keywords":{}}],["quot;mi",{"_index":1286,"title":{},"content":{"52":{"position":[[3351,8]]},"212":{"position":[[4518,8],[4556,8]]},"391":{"position":[[4536,8],[4574,8]]},"661":{"position":[[4536,8],[4574,8]]}},"keywords":{}}],["quot;my_project"",{"_index":1756,"title":{},"content":{"117":{"position":[[381,22]]},"265":{"position":[[459,22]]},"298":{"position":[[381,22]]},"405":{"position":[[459,22]]},"519":{"position":[[381,22]]},"642":{"position":[[459,22]]}},"keywords":{}}],["quot;my_project::flipper"",{"_index":2813,"title":{},"content":{"266":{"position":[[145,31]]},"406":{"position":[[145,31]]},"643":{"position":[[145,31]]}},"keywords":{}}],["quot;my_project_build_contract"",{"_index":2809,"title":{},"content":{"265":{"position":[[641,37]]},"405":{"position":[[641,37]]},"642":{"position":[[641,37]]}},"keywords":{}}],["quot;my_project_build_schema"",{"_index":2810,"title":{},"content":{"265":{"position":[[748,35]]},"405":{"position":[[748,35]]},"642":{"position":[[748,35]]}},"keywords":{}}],["quot;mycontract"",{"_index":2967,"title":{},"content":{"321":{"position":[[580,23]]},"323":{"position":[[464,23]]},"539":{"position":[[580,23]]},"541":{"position":[[464,23]]}},"keywords":{}}],["quot;mycontract".to_str",{"_index":2119,"title":{},"content":{"168":{"position":[[643,34]]},"348":{"position":[[643,34]]},"564":{"position":[[643,34]]}},"keywords":{}}],["quot;mycontract.wasm"",{"_index":3032,"title":{},"content":{"323":{"position":[[2646,28]]},"541":{"position":[[2646,28]]}},"keywords":{}}],["quot;mycontract2".to_str",{"_index":2124,"title":{},"content":{"168":{"position":[[901,35]]},"348":{"position":[[901,35]]},"564":{"position":[[901,35]]}},"keywords":{}}],["quot;name"",{"_index":1259,"title":{},"content":{"52":{"position":[[1208,19],[1500,19],[1677,19]]},"323":{"position":[[582,17],[677,17],[695,17],[812,17],[904,17],[922,17],[1011,17],[1144,17],[1239,17],[1257,17],[1376,17],[1510,17],[1676,17],[1861,17],[1879,17],[2121,17],[2438,17],[2518,17],[2809,17],[3022,17],[3227,17],[3440,17],[3458,17],[3576,17]]},"541":{"position":[[582,17],[677,17],[695,17],[812,17],[904,17],[922,17],[1011,17],[1144,17],[1239,17],[1257,17],[1376,17],[1510,17],[1676,17],[1861,17],[1879,17],[2121,17],[2438,17],[2518,17],[2809,17],[3022,17],[3227,17],[3440,17],[3458,17],[3576,17]]}},"keywords":{}}],["quot;name2:string='bob'"",{"_index":2597,"title":{},"content":{"210":{"position":[[1480,30]]},"389":{"position":[[1417,30]]},"659":{"position":[[1417,30]]}},"keywords":{}}],["quot;name:string:'mynft'"",{"_index":1665,"title":{},"content":{"100":{"position":[[733,31]]},"292":{"position":[[733,31]]},"504":{"position":[[733,31]]}},"keywords":{}}],["quot;name:string='alice'"",{"_index":2596,"title":{},"content":{"210":{"position":[[1432,31]]},"389":{"position":[[1369,31]]},"659":{"position":[[1369,31]]}},"keywords":{}}],["quot;name:string='mi",{"_index":2585,"title":{},"content":{"210":{"position":[[856,21]]},"389":{"position":[[793,21]]},"659":{"position":[[793,21]]}},"keywords":{}}],["quot;name:string='{{name}}'"",{"_index":1146,"title":{},"content":{"43":{"position":[[1404,34]]}},"keywords":{}}],["quot;odra",{"_index":3159,"title":{},"content":{"395":{"position":[[3143,11]]},"477":{"position":[[741,10],[1056,11]]},"632":{"position":[[3143,11]]},"699":{"position":[[741,10],[1056,11]]}},"keywords":{}}],["quot;odra_cfg_allow_key_override"",{"_index":3036,"title":{},"content":{"323":{"position":[[3040,40]]},"541":{"position":[[3040,40]]}},"keywords":{}}],["quot;odra_cfg_allow_key_override:bool:'false'"",{"_index":1664,"title":{},"content":{"100":{"position":[[601,52]]},"101":{"position":[[459,52]]},"292":{"position":[[601,52]]},"293":{"position":[[459,52]]},"504":{"position":[[601,52]]},"505":{"position":[[459,52]]}},"keywords":{}}],["quot;odra_cfg_allow_key_override:bool:'true'"",{"_index":1143,"title":{},"content":{"43":{"position":[[1210,51]]},"99":{"position":[[517,51]]},"210":{"position":[[662,51]]},"291":{"position":[[517,51]]},"389":{"position":[[662,51]]},"503":{"position":[[517,51]]},"659":{"position":[[662,51]]}},"keywords":{}}],["quot;odra_cfg_constructor:string:'init'"",{"_index":1145,"title":{},"content":{"43":{"position":[[1341,46]]},"101":{"position":[[591,46]]},"210":{"position":[[793,46]]},"293":{"position":[[591,46]]},"505":{"position":[[591,46]]}},"keywords":{}}],["quot;odra_cfg_is_upgradable"",{"_index":3039,"title":{},"content":{"323":{"position":[[3245,35]]},"541":{"position":[[3245,35]]}},"keywords":{}}],["quot;odra_cfg_is_upgradable:bool:'true'"",{"_index":1144,"title":{},"content":{"43":{"position":[[1278,46]]},"99":{"position":[[585,46]]},"100":{"position":[[670,46]]},"101":{"position":[[528,46]]},"210":{"position":[[730,46]]},"291":{"position":[[585,46]]},"292":{"position":[[670,46]]},"293":{"position":[[528,46]]},"389":{"position":[[730,46]]},"503":{"position":[[585,46]]},"504":{"position":[[670,46]]},"505":{"position":[[528,46]]},"659":{"position":[[730,46]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name"",{"_index":3034,"title":{},"content":{"323":{"position":[[2827,43]]},"541":{"position":[[2827,43]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'counter_package_hash'"",{"_index":1652,"title":{},"content":{"99":{"position":[[428,72]]},"291":{"position":[[428,72]]},"503":{"position":[[428,72]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'my_nft'"",{"_index":1663,"title":{},"content":{"100":{"position":[[526,58]]},"292":{"position":[[526,58]]},"504":{"position":[[526,58]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'my_tokens'"",{"_index":1678,"title":{},"content":{"101":{"position":[[381,61]]},"293":{"position":[[381,61]]},"505":{"position":[[381,61]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'test_contract_package_hash'"",{"_index":2584,"title":{},"content":{"210":{"position":[[567,78]]},"389":{"position":[[567,78]]},"659":{"position":[[567,78]]}},"keywords":{}}],["quot;odra_cfg_package_hash_key_name:string:'{{contract_package_hash_named_key}}'"",{"_index":1142,"title":{},"content":{"43":{"position":[[1106,87]]}},"keywords":{}}],["quot;on",{"_index":617,"title":{},"content":{"20":{"position":[[1036,9]]}},"keywords":{}}],["quot;optional"",{"_index":3021,"title":{},"content":{"323":{"position":[[1964,21],[2989,21],[3194,21],[3407,21],[3543,21],[3677,21]]},"541":{"position":[[1964,21],[2989,21],[3194,21],[3407,21],[3543,21],[3677,21]]}},"keywords":{}}],["quot;ot".to_str",{"_index":3275,"title":{},"content":{"417":{"position":[[264,27]]},"419":{"position":[[6679,27]]},"654":{"position":[[264,27]]},"656":{"position":[[6679,27]]}},"keywords":{}}],["quot;our_token_livenet"",{"_index":3163,"title":{},"content":{"395":{"position":[[3400,29]]},"632":{"position":[[3400,29]]}},"keywords":{}}],["quot;ourcoin"",{"_index":3158,"title":{},"content":{"395":{"position":[[2565,19]]},"632":{"position":[[2565,19]]}},"keywords":{}}],["quot;ourcoin_build_contract"",{"_index":3161,"title":{},"content":{"395":{"position":[[3196,34]]},"632":{"position":[[3196,34]]}},"keywords":{}}],["quot;ourcoin_build_schema"",{"_index":3162,"title":{},"content":{"395":{"position":[[3300,32]]},"632":{"position":[[3300,32]]}},"keywords":{}}],["quot;ourtoken"",{"_index":3173,"title":{},"content":{"395":{"position":[[4580,21]]},"632":{"position":[[4580,21]]}},"keywords":{}}],["quot;ourtoken".to_str",{"_index":3274,"title":{},"content":{"417":{"position":[[222,33]]},"419":{"position":[[6637,33]]},"654":{"position":[[222,33]]},"656":{"position":[[6637,33]]}},"keywords":{}}],["quot;ownedcontract".to_str",{"_index":1910,"title":{},"content":{"138":{"position":[[522,37]]},"318":{"position":[[514,37]]},"544":{"position":[[514,37]]}},"keywords":{}}],["quot;owner"",{"_index":3006,"title":{},"content":{"323":{"position":[[1029,18],[3594,18]]},"541":{"position":[[1029,18],[3594,18]]}},"keywords":{}}],["quot;partystarted"",{"_index":2033,"title":{},"content":{"157":{"position":[[636,26]]},"330":{"position":[[617,26]]},"547":{"position":[[636,26]]}},"keywords":{}}],["quot;plascoin"",{"_index":2493,"title":{},"content":{"206":{"position":[[143,21]]},"269":{"position":[[4047,21]]},"409":{"position":[[4047,21]]},"426":{"position":[[143,21]]},"646":{"position":[[4047,21]]},"668":{"position":[[143,21]]}},"keywords":{}}],["quot;pls"",{"_index":2494,"title":{},"content":{"206":{"position":[[190,16]]},"269":{"position":[[4094,16]]},"409":{"position":[[4094,16]]},"426":{"position":[[190,16]]},"646":{"position":[[4094,16]]},"668":{"position":[[190,16]]}},"keywords":{}}],["quot;price_1:u256='101'"",{"_index":2589,"title":{},"content":{"210":{"position":[[970,30]]},"389":{"position":[[907,30]]},"659":{"position":[[907,30]]}},"keywords":{}}],["quot;price_2:u256='202'"",{"_index":2590,"title":{},"content":{"210":{"position":[[1017,30]]},"389":{"position":[[954,30]]},"659":{"position":[[954,30]]}},"keywords":{}}],["quot;propose_new_mint"",{"_index":3178,"title":{},"content":{"395":{"position":[[5298,29]]},"632":{"position":[[5298,29]]}},"keywords":{}}],["quot;public"",{"_index":3026,"title":{},"content":{"323":{"position":[[2097,18],[2390,18]]},"541":{"position":[[2097,18],[2390,18]]}},"keywords":{}}],["quot;real",{"_index":2045,"title":{},"content":{"162":{"position":[[221,10]]},"351":{"position":[[221,10]]},"567":{"position":[[221,10]]}},"keywords":{}}],["quot;real"",{"_index":1697,"title":{},"content":{"107":{"position":[[254,16]]},"119":{"position":[[260,16]]},"274":{"position":[[254,16]]},"300":{"position":[[260,16]]},"491":{"position":[[254,16]]},"521":{"position":[[260,16]]}},"keywords":{}}],["quot;repository"",{"_index":2993,"title":{},"content":{"323":{"position":[[379,23]]},"541":{"position":[[379,23]]}},"keywords":{}}],["quot;request",{"_index":3114,"title":{},"content":{"394":{"position":[[300,13]]},"631":{"position":[[300,13]]}},"keywords":{}}],["quot;return",{"_index":3028,"title":{},"content":{"323":{"position":[[2186,13]]},"541":{"position":[[2186,13]]}},"keywords":{}}],["quot;return_ty"",{"_index":3022,"title":{},"content":{"323":{"position":[[1997,22],[2290,22]]},"541":{"position":[[1997,22],[2290,22]]}},"keywords":{}}],["quot;rustc",{"_index":2985,"title":{},"content":{"323":{"position":[[297,11]]},"541":{"position":[[297,11]]}},"keywords":{}}],["quot;sample"",{"_index":1878,"title":{},"content":{"131":{"position":[[61,18]]},"311":{"position":[[61,18]]},"528":{"position":[[61,18]]}},"keywords":{}}],["quot;sample::counter"",{"_index":2018,"title":{},"content":{"154":{"position":[[383,27]]},"339":{"position":[[383,27]]},"559":{"position":[[383,27]]}},"keywords":{}}],["quot;sample::flipper"",{"_index":1892,"title":{},"content":{"132":{"position":[[149,27]]},"154":{"position":[[335,27]]},"312":{"position":[[149,27]]},"339":{"position":[[335,27]]},"529":{"position":[[149,27]]},"559":{"position":[[335,27]]}},"keywords":{}}],["quot;sample_build_contract"",{"_index":1881,"title":{},"content":{"131":{"position":[[239,33]]},"311":{"position":[[291,33]]},"528":{"position":[[291,33]]}},"keywords":{}}],["quot;sample_build_schema"",{"_index":1883,"title":{},"content":{"131":{"position":[[342,31]]},"311":{"position":[[394,31]]},"528":{"position":[[394,31]]}},"keywords":{}}],["quot;set_data"",{"_index":2594,"title":{},"content":{"210":{"position":[[1351,20]]},"389":{"position":[[1288,20]]},"659":{"position":[[1288,20]]}},"keywords":{}}],["quot;src/bin/erc20_on_livenet.rs"",{"_index":1844,"title":{},"content":{"126":{"position":[[3565,39]]},"277":{"position":[[3733,39]]},"514":{"position":[[3565,39]]}},"keywords":{}}],["quot;src/status_message.rs"",{"_index":1039,"title":{},"content":{"42":{"position":[[573,34]]}},"keywords":{}}],["quot;src/status_message.sol"",{"_index":1041,"title":{},"content":{"42":{"position":[[643,35]]}},"keywords":{}}],["quot;state"",{"_index":2622,"title":{},"content":{"212":{"position":[[414,18]]},"391":{"position":[[414,18]]},"661":{"position":[[414,18]]}},"keywords":{}}],["quot;string"",{"_index":3004,"title":{},"content":{"323":{"position":[[760,18],[987,18],[1322,18],[1944,19],[2969,19],[3523,19]]},"541":{"position":[[760,18],[987,18],[1322,18],[1944,19],[2969,19],[3523,19]]}},"keywords":{}}],["quot;struct"",{"_index":2999,"title":{},"content":{"323":{"position":[[560,19],[790,19],[1122,19]]},"541":{"position":[[560,19],[790,19],[1122,19]]}},"keywords":{}}],["quot;symbol:string:'nft'"",{"_index":1666,"title":{},"content":{"100":{"position":[[781,31]]},"292":{"position":[[781,31]]},"504":{"position":[[781,31]]}},"keywords":{}}],["quot;symbol:string='{{symbol}}'"",{"_index":1147,"title":{},"content":{"43":{"position":[[1455,38]]}},"keywords":{}}],["quot;t".to_str",{"_index":3442,"title":{},"content":{"440":{"position":[[5094,26]]},"441":{"position":[[4919,26]]},"687":{"position":[[5094,26]]},"688":{"position":[[4919,26]]}},"keywords":{}}],["quot;tally"",{"_index":3185,"title":{},"content":{"395":{"position":[[6288,18]]},"632":{"position":[[6288,18]]}},"keywords":{}}],["quot;th",{"_index":3011,"title":{},"content":{"323":{"position":[[1444,9],[1579,9],[2896,9],[3106,9],[3306,9]]},"541":{"position":[[1444,9],[1579,9],[2896,9],[3106,9],[3306,9]]}},"keywords":{}}],["quot;ticket".to_str",{"_index":3441,"title":{},"content":{"440":{"position":[[5043,31]]},"441":{"position":[[4868,31]]},"687":{"position":[[5043,31]]},"688":{"position":[[4868,31]]}},"keywords":{}}],["quot;timelockwallet"",{"_index":3582,"title":{},"content":{"477":{"position":[[2588,27]]},"699":{"position":[[2588,27]]}},"keywords":{}}],["quot;tlw_on_livenet"",{"_index":3561,"title":{},"content":{"477":{"position":[[1130,26]]},"699":{"position":[[1130,26]]}},"keywords":{}}],["quot;toolchain"",{"_index":2984,"title":{},"content":{"323":{"position":[[274,22]]},"541":{"position":[[274,22]]}},"keywords":{}}],["quot;transfer"",{"_index":1850,"title":{},"content":{"127":{"position":[[328,21]]},"206":{"position":[[3289,23]]},"278":{"position":[[328,21]]},"426":{"position":[[3264,23]]},"515":{"position":[[328,21]]},"668":{"position":[[3289,23]]}},"keywords":{}}],["quot;tutori",{"_index":3146,"title":{},"content":{"395":{"position":[[1658,14]]},"632":{"position":[[1658,14]]}},"keywords":{}}],["quot;ty"",{"_index":3003,"title":{},"content":{"323":{"position":[[744,15],[971,15],[1079,15],[1306,15],[1928,15],[2477,15],[2557,15],[2953,15],[3160,15],[3373,15],[3507,15],[3644,15]]},"541":{"position":[[744,15],[971,15],[1079,15],[1306,15],[1928,15],[2477,15],[2557,15],[2953,15],[3160,15],[3373,15],[3507,15],[3644,15]]}},"keywords":{}}],["quot;types"",{"_index":2998,"title":{},"content":{"323":{"position":[[537,18]]},"541":{"position":[[537,18]]}},"keywords":{}}],["quot;unit"",{"_index":3023,"title":{},"content":{"323":{"position":[[2020,17]]},"541":{"position":[[2020,17]]}},"keywords":{}}],["quot;upd",{"_index":3017,"title":{},"content":{"323":{"position":[[1739,13]]},"541":{"position":[[1739,13]]}},"keywords":{}}],["quot;update"",{"_index":3016,"title":{},"content":{"323":{"position":[[1694,19]]},"541":{"position":[[1694,19]]}},"keywords":{}}],["quot;updated"",{"_index":3008,"title":{},"content":{"323":{"position":[[1162,20],[2536,20],[2573,19]]},"541":{"position":[[1162,20],[2536,20],[2573,19]]}},"keywords":{}}],["quot;value"",{"_index":1262,"title":{},"content":{"52":{"position":[[1268,17]]}},"keywords":{}}],["quot;value:u32:'666'"",{"_index":2595,"title":{},"content":{"210":{"position":[[1388,27]]},"389":{"position":[[1325,27]]},"659":{"position":[[1325,27]]}},"keywords":{}}],["quot;value:u32:42"",{"_index":1653,"title":{},"content":{"99":{"position":[[648,24]]},"291":{"position":[[648,24]]},"503":{"position":[[648,24]]}},"keywords":{}}],["quot;vote"",{"_index":3180,"title":{},"content":{"395":{"position":[[5769,17]]},"632":{"position":[[5769,17]]}},"keywords":{}}],["quot;wasm/ourtoken.wasm"",{"_index":3174,"title":{},"content":{"395":{"position":[[4629,31]]},"632":{"position":[[4629,31]]}},"keywords":{}}],["quot;wasm/timelockwallet.wasm"",{"_index":3583,"title":{},"content":{"477":{"position":[[2643,37]]},"699":{"position":[[2643,37]]}},"keywords":{}}],["quot;wasm_file_name"",{"_index":3031,"title":{},"content":{"323":{"position":[[2618,27]]},"541":{"position":[[2618,27]]}},"keywords":{}}],["quot;withdraw"",{"_index":3588,"title":{},"content":{"477":{"position":[[3523,21]]},"699":{"position":[[3523,21]]}},"keywords":{}}],["r",{"_index":3071,"title":{},"content":{"348":{"position":[[2074,2]]}},"keywords":{}}],["rais",{"_index":2334,"title":{},"content":{"196":{"position":[[877,5]]},"432":{"position":[[815,5]]},"679":{"position":[[815,5]]}},"keywords":{}}],["random",{"_index":3126,"title":{},"content":{"395":{"position":[[729,6]]},"632":{"position":[[729,6]]}},"keywords":{}}],["rang",{"_index":912,"title":{},"content":{"39":{"position":[[491,7]]},"85":{"position":[[79,7]]},"111":{"position":[[186,6]]},"254":{"position":[[79,7]]},"270":{"position":[[309,5]]},"306":{"position":[[186,6]]},"385":{"position":[[309,5]]},"410":{"position":[[309,5]]},"485":{"position":[[79,7]]},"511":{"position":[[186,6]]},"598":{"position":[[1552,5],[1641,5]]},"627":{"position":[[309,5]]},"647":{"position":[[309,5]]},"706":{"position":[[1552,5],[1641,5]]}},"keywords":{}}],["rapid",{"_index":641,"title":{},"content":{"22":{"position":[[73,5]]},"38":{"position":[[91,5]]}},"keywords":{}}],["raw",{"_index":2322,"title":{},"content":{"195":{"position":[[744,3]]},"431":{"position":[[744,3]]},"678":{"position":[[744,3]]}},"keywords":{}}],["raw_log",{"_index":1279,"title":{},"content":{"52":{"position":[[2346,8],[3378,8],[5016,8]]}},"keywords":{}}],["raw_mint",{"_index":3270,"title":{},"content":{"416":{"position":[[4737,8]]},"653":{"position":[[4737,8]]}},"keywords":{}}],["raw_transf",{"_index":3267,"title":{},"content":{"416":{"position":[[4585,12]]},"653":{"position":[[4585,12]]}},"keywords":{}}],["raw_transfer(&contract",{"_index":3316,"title":{},"content":{"419":{"position":[[5802,28]]},"656":{"position":[[5802,28]]}},"keywords":{}}],["raw_transfer(&mut",{"_index":2478,"title":{},"content":{"205":{"position":[[1202,21]]},"269":{"position":[[2493,21]]},"384":{"position":[[2520,21]]},"409":{"position":[[2493,21]]},"425":{"position":[[1177,21]]},"626":{"position":[[2520,21]]},"646":{"position":[[2493,21]]},"667":{"position":[[1177,21]]}},"keywords":{}}],["rc<contractenv>",{"_index":1932,"title":{},"content":{"141":{"position":[[429,22]]},"326":{"position":[[429,22]]},"535":{"position":[[429,22]]}},"keywords":{}}],["reach",{"_index":88,"title":{},"content":{"1":{"position":[[1146,5]]},"270":{"position":[[99,5]]},"385":{"position":[[99,5]]},"410":{"position":[[99,5]]},"627":{"position":[[99,5]]},"647":{"position":[[99,5]]}},"keywords":{}}],["read",{"_index":12,"title":{"208":{"position":[[18,4]]},"212":{"position":[[0,7]]},"387":{"position":[[18,4]]},"391":{"position":[[0,7]]},"657":{"position":[[18,4]]},"661":{"position":[[0,7]]}},"content":{"1":{"position":[[107,7]]},"6":{"position":[[122,7]]},"18":{"position":[[50,4]]},"51":{"position":[[225,4]]},"52":{"position":[[143,4],[194,4],[2125,4],[3144,4]]},"78":{"position":[[93,4]]},"83":{"position":[[496,7]]},"92":{"position":[[764,4]]},"94":{"position":[[568,4]]},"158":{"position":[[0,4]]},"162":{"position":[[1989,4]]},"163":{"position":[[592,4],[1174,4]]},"171":{"position":[[0,4]]},"185":{"position":[[3226,5],[3802,5]]},"197":{"position":[[934,5],[1335,4]]},"198":{"position":[[2935,4]]},"211":{"position":[[3,4]]},"212":{"position":[[866,4],[1604,4],[1712,4],[1895,4],[2120,4],[2706,4],[3120,4]]},"221":{"position":[[782,5]]},"229":{"position":[[93,4]]},"252":{"position":[[496,7]]},"284":{"position":[[764,4]]},"286":{"position":[[568,4]]},"331":{"position":[[0,4]]},"351":{"position":[[2011,4]]},"352":{"position":[[614,4],[1196,4]]},"357":{"position":[[0,4]]},"365":{"position":[[143,4],[324,4]]},"376":{"position":[[3210,5],[3786,5]]},"390":{"position":[[3,4]]},"391":{"position":[[866,4],[1604,4],[1712,4],[1895,4],[2120,4],[2712,4],[3138,4]]},"433":{"position":[[933,5],[1334,4]]},"434":{"position":[[2917,4]]},"454":{"position":[[782,5]]},"460":{"position":[[93,4]]},"483":{"position":[[496,7]]},"496":{"position":[[764,4]]},"498":{"position":[[568,4]]},"548":{"position":[[0,4]]},"567":{"position":[[2011,4]]},"568":{"position":[[614,4],[1196,4]]},"573":{"position":[[0,4]]},"581":{"position":[[143,4],[324,4]]},"592":{"position":[[3210,5],[3786,5]]},"601":{"position":[[2075,7]]},"605":{"position":[[394,4],[582,4]]},"610":{"position":[[924,4]]},"618":{"position":[[427,4]]},"660":{"position":[[3,4]]},"661":{"position":[[866,4],[1604,4],[1712,4],[1895,4],[2120,4],[2712,4],[3138,4]]},"680":{"position":[[933,5],[1334,4]]},"681":{"position":[[2935,4]]},"694":{"position":[[782,5]]},"709":{"position":[[2075,7]]},"713":{"position":[[394,4],[582,4]]},"718":{"position":[[924,4]]},"726":{"position":[[427,4]]}},"keywords":{}}],["read(key",{"_index":1516,"title":{},"content":{"83":{"position":[[567,9]]},"252":{"position":[[567,9]]},"483":{"position":[[567,9]]}},"keywords":{}}],["read_state_key(key",{"_index":2624,"title":{},"content":{"212":{"position":[[637,19]]},"391":{"position":[[637,19]]},"661":{"position":[[637,19]]}},"keywords":{}}],["read_state_key(key).await",{"_index":2640,"title":{},"content":{"212":{"position":[[1574,26],[2676,26],[3090,26]]},"391":{"position":[[1574,26],[2682,26],[3108,26]]},"661":{"position":[[1574,26],[2682,26],[3108,26]]}},"keywords":{}}],["readabl",{"_index":1318,"title":{},"content":{"54":{"position":[[310,8]]},"115":{"position":[[3164,11]]},"258":{"position":[[3090,11]]},"481":{"position":[[3090,11]]}},"keywords":{}}],["readi",{"_index":85,"title":{},"content":{"1":{"position":[[1081,5]]},"3":{"position":[[677,6]]},"39":{"position":[[3349,5]]},"52":{"position":[[1750,5]]},"100":{"position":[[921,5]]},"173":{"position":[[357,6]]},"175":{"position":[[486,5]]},"187":{"position":[[34,5]]},"199":{"position":[[22,6]]},"292":{"position":[[921,5]]},"359":{"position":[[357,6]]},"361":{"position":[[486,5]]},"364":{"position":[[34,5]]},"435":{"position":[[22,6]]},"504":{"position":[[921,5]]},"575":{"position":[[357,6]]},"577":{"position":[[486,5]]},"580":{"position":[[34,5]]},"682":{"position":[[22,6]]}},"keywords":{}}],["real",{"_index":1104,"title":{},"content":{"43":{"position":[[16,4]]},"126":{"position":[[1579,4]]},"175":{"position":[[396,4]]},"277":{"position":[[1747,4]]},"361":{"position":[[396,4]]},"395":{"position":[[1394,4]]},"416":{"position":[[2325,4]]},"514":{"position":[[1579,4]]},"577":{"position":[[396,4]]},"632":{"position":[[1394,4]]},"653":{"position":[[2325,4]]}},"keywords":{}}],["realli",{"_index":1222,"title":{},"content":{"52":{"position":[[42,6]]},"111":{"position":[[143,6]]},"128":{"position":[[285,6]]},"151":{"position":[[48,6]]},"247":{"position":[[1954,6]]},"279":{"position":[[285,6]]},"306":{"position":[[143,6]]},"342":{"position":[[48,6]]},"416":{"position":[[3212,6]]},"417":{"position":[[1749,6]]},"446":{"position":[[1954,6]]},"511":{"position":[[143,6]]},"516":{"position":[[285,6]]},"556":{"position":[[48,6]]},"653":{"position":[[3212,6]]},"654":{"position":[[1749,6]]},"673":{"position":[[1954,6]]}},"keywords":{}}],["realm",{"_index":1413,"title":{},"content":{"76":{"position":[[100,5]]},"227":{"position":[[100,5]]},"458":{"position":[[100,5]]}},"keywords":{}}],["reason",{"_index":611,"title":{},"content":{"20":{"position":[[930,6]]},"198":{"position":[[2550,6]]},"434":{"position":[[2540,6]]},"681":{"position":[[2550,6]]}},"keywords":{}}],["recap",{"_index":1410,"title":{"76":{"position":[[0,5]]},"227":{"position":[[0,5]]},"458":{"position":[[0,5]]}},"content":{"76":{"position":[[50,5]]},"227":{"position":[[50,5]]},"458":{"position":[[50,5]]}},"keywords":{}}],["receipt",{"_index":281,"title":{},"content":{"9":{"position":[[667,7],[679,7],[777,7],[1025,8]]},"10":{"position":[[1149,7]]},"32":{"position":[[1420,7]]}},"keywords":{}}],["receipt.verify(multiply_id).expect",{"_index":298,"title":{},"content":{"9":{"position":[[1055,35]]}},"keywords":{}}],["receipt::new(&journ",{"_index":354,"title":{},"content":{"10":{"position":[[1273,26]]}},"keywords":{}}],["receipt_nam",{"_index":3376,"title":{},"content":{"440":{"position":[[1275,12],[1533,13]]},"687":{"position":[[1275,12],[1533,13]]}},"keywords":{}}],["receiv",{"_index":2192,"title":{"614":{"position":[[13,7]]},"722":{"position":[[13,7]]}},"content":{"184":{"position":[[772,8]]},"188":{"position":[[327,9]]},"365":{"position":[[684,9]]},"375":{"position":[[691,8]]},"416":{"position":[[2153,8]]},"440":{"position":[[4319,7]]},"441":{"position":[[1038,8],[2113,8]]},"581":{"position":[[684,9]]},"591":{"position":[[691,8]]},"605":{"position":[[486,8]]},"608":{"position":[[726,7],[811,7]]},"613":{"position":[[1325,7]]},"614":{"position":[[24,9],[57,9],[99,9],[235,8],[356,9],[497,7]]},"653":{"position":[[2153,8]]},"687":{"position":[[4319,7]]},"688":{"position":[[1038,8],[2113,8]]},"713":{"position":[[486,8]]},"716":{"position":[[726,7],[811,7]]},"721":{"position":[[1325,7]]},"722":{"position":[[24,9],[57,9],[99,9],[235,8],[356,9],[497,7]]}},"keywords":{}}],["reciev",{"_index":3196,"title":{},"content":{"396":{"position":[[989,8]]},"633":{"position":[[989,8]]}},"keywords":{}}],["recipi",{"_index":491,"title":{},"content":{"17":{"position":[[1106,10],[1228,12],[1370,11],[1438,10],[1516,11]]},"115":{"position":[[611,10],[698,10],[2509,10],[2729,10]]},"126":{"position":[[1690,9],[1789,9]]},"205":{"position":[[317,10],[428,10],[507,10],[664,10],[1251,10]]},"206":{"position":[[1192,10],[1240,9],[1478,9],[1861,9],[2133,10],[2683,10],[3469,10]]},"247":{"position":[[824,10],[969,10],[1047,10]]},"258":{"position":[[597,10],[680,10],[2451,10],[2659,10]]},"268":{"position":[[2443,10],[2613,10]]},"269":{"position":[[1063,10],[1174,10],[1253,10],[1410,10],[2542,10],[5102,10],[5150,9],[5388,9],[5771,9]]},"277":{"position":[[1858,9],[1957,9]]},"384":{"position":[[1076,10],[1187,10],[1266,10],[1423,10],[2569,10]]},"395":{"position":[[751,9],[850,9]]},"408":{"position":[[2443,10],[2613,10]]},"409":{"position":[[1063,10],[1174,10],[1253,10],[1410,10],[2542,10],[5102,10],[5150,9],[5388,9],[5771,9]]},"419":{"position":[[3371,10],[3409,10],[3497,9],[3591,10]]},"425":{"position":[[292,10],[403,10],[482,10],[639,10],[1226,10]]},"426":{"position":[[1187,10],[1235,9],[1473,9],[1851,9],[2123,10],[2668,10],[3444,10]]},"446":{"position":[[824,10],[969,10],[1047,10]]},"481":{"position":[[597,10],[680,10],[2451,10],[2659,10]]},"514":{"position":[[1690,9],[1789,9]]},"604":{"position":[[172,10],[267,10],[375,10]]},"626":{"position":[[1076,10],[1187,10],[1266,10],[1423,10],[2569,10]]},"632":{"position":[[751,9],[850,9]]},"645":{"position":[[2443,10],[2613,10]]},"646":{"position":[[1063,10],[1174,10],[1253,10],[1410,10],[2542,10],[5102,10],[5150,9],[5388,9],[5771,9]]},"656":{"position":[[3371,10],[3409,10],[3497,9],[3591,10]]},"667":{"position":[[292,10],[403,10],[482,10],[639,10],[1226,10]]},"668":{"position":[[1192,10],[1240,9],[1478,9],[1861,9],[2133,10],[2683,10],[3469,10]]},"673":{"position":[[824,10],[969,10],[1047,10]]},"712":{"position":[[172,10],[267,10],[375,10]]}},"keywords":{}}],["recipient'",{"_index":1855,"title":{},"content":{"127":{"position":[[541,11]]},"278":{"position":[[541,11]]},"515":{"position":[[541,11]]}},"keywords":{}}],["recommend",{"_index":2347,"title":{},"content":{"196":{"position":[[1497,9]]},"265":{"position":[[276,11]]},"393":{"position":[[381,9]]},"405":{"position":[[276,11]]},"630":{"position":[[381,9]]},"642":{"position":[[276,11]]}},"keywords":{}}],["record",{"_index":1028,"title":{},"content":{"42":{"position":[[117,7],[986,8],[1258,7]]},"206":{"position":[[2454,9]]},"426":{"position":[[2444,9]]},"668":{"position":[[2454,9]]}},"keywords":{}}],["records[accountid",{"_index":1057,"title":{},"content":{"42":{"position":[[1085,18],[1199,19]]}},"keywords":{}}],["recurs",{"_index":441,"title":{},"content":{"16":{"position":[[274,9]]},"72":{"position":[[401,9]]},"236":{"position":[[401,9]]},"321":{"position":[[749,11],[873,11]]},"472":{"position":[[401,9]]},"539":{"position":[[749,11],[873,11]]}},"keywords":{}}],["redesign",{"_index":2895,"title":{"441":{"position":[[0,9]]},"688":{"position":[[0,9]]}},"content":{"267":{"position":[[4425,8]]},"407":{"position":[[4425,8]]},"440":{"position":[[6534,11]]},"644":{"position":[[4425,8]]},"687":{"position":[[6534,11]]}},"keywords":{}}],["reduc",{"_index":3771,"title":{},"content":{"606":{"position":[[1070,7]]},"714":{"position":[[1070,7]]}},"keywords":{}}],["reentranc",{"_index":1373,"title":{},"content":{"72":{"position":[[0,10],[374,10]]},"236":{"position":[[0,10],[374,10]]},"472":{"position":[[0,10],[374,10]]}},"keywords":{}}],["reentrancy"",{"_index":3765,"title":{},"content":{"606":{"position":[[418,18]]},"714":{"position":[[418,18]]}},"keywords":{}}],["reentrancymockref::new(self.env",{"_index":1389,"title":{},"content":{"73":{"position":[[221,34]]},"237":{"position":[[221,34]]},"473":{"position":[[221,34]]}},"keywords":{}}],["reentrant",{"_index":1372,"title":{"72":{"position":[[4,10]]},"236":{"position":[[4,10]]},"472":{"position":[[4,10]]}},"content":{},"keywords":{}}],["reexport",{"_index":1076,"title":{},"content":{"42":{"position":[[1645,9]]}},"keywords":{}}],["ref",{"_index":1926,"title":{"141":{"position":[[9,4]]},"326":{"position":[[9,4]]},"535":{"position":[[9,4]]}},"content":{"198":{"position":[[1762,4]]},"434":{"position":[[1752,4]]},"681":{"position":[[1762,4]]}},"keywords":{}}],["ref_recursion_not_allow",{"_index":1397,"title":{},"content":{"73":{"position":[[541,27]]},"237":{"position":[[541,27]]},"473":{"position":[[541,27]]}},"keywords":{}}],["refer",{"_index":1081,"title":{"271":{"position":[[3,11]]},"386":{"position":[[3,11]]},"411":{"position":[[3,11]]},"628":{"position":[[3,11]]},"648":{"position":[[3,11]]}},"content":{"42":{"position":[[1969,9]]},"76":{"position":[[923,5]]},"99":{"position":[[711,5]]},"141":{"position":[[66,9],[349,10],[491,9]]},"173":{"position":[[285,5]]},"198":{"position":[[1424,9],[1458,9],[2294,9]]},"227":{"position":[[923,5]]},"267":{"position":[[1932,9],[3625,9]]},"270":{"position":[[189,5]]},"291":{"position":[[711,5]]},"326":{"position":[[66,9],[349,10],[491,9]]},"359":{"position":[[285,5]]},"385":{"position":[[189,5]]},"407":{"position":[[1932,9],[3625,9]]},"410":{"position":[[189,5]]},"434":{"position":[[1414,9],[1448,9],[2284,9]]},"458":{"position":[[923,5]]},"503":{"position":[[711,5]]},"535":{"position":[[66,9],[349,10],[491,9]]},"575":{"position":[[285,5]]},"627":{"position":[[189,5]]},"644":{"position":[[1932,9],[3625,9]]},"647":{"position":[[189,5]]},"681":{"position":[[1424,9],[1458,9],[2294,9]]}},"keywords":{}}],["reflect",{"_index":1539,"title":{},"content":{"85":{"position":[[432,10]]},"254":{"position":[[432,10]]},"267":{"position":[[272,7]]},"268":{"position":[[78,7]]},"324":{"position":[[1510,11]]},"407":{"position":[[272,7]]},"408":{"position":[[78,7]]},"485":{"position":[[432,10]]},"542":{"position":[[1510,11]]},"644":{"position":[[272,7]]},"645":{"position":[[78,7]]}},"keywords":{}}],["refresh",{"_index":1425,"title":{},"content":{"76":{"position":[[889,9]]},"227":{"position":[[889,9]]},"458":{"position":[[889,9]]}},"keywords":{}}],["regard",{"_index":3057,"title":{},"content":{"324":{"position":[[1376,9]]},"542":{"position":[[1376,9]]}},"keywords":{}}],["regist",{"_index":1075,"title":{},"content":{"42":{"position":[[1605,9]]},"91":{"position":[[596,10]]},"107":{"position":[[48,8],[85,8]]},"108":{"position":[[225,10]]},"274":{"position":[[48,8],[85,8]]},"275":{"position":[[229,10]]},"283":{"position":[[596,10]]},"321":{"position":[[282,8]]},"395":{"position":[[2474,8]]},"440":{"position":[[3671,8]]},"441":{"position":[[1759,8],[2547,8],[3900,8],[3937,8]]},"491":{"position":[[48,8],[85,8]]},"492":{"position":[[229,10]]},"495":{"position":[[596,10]]},"539":{"position":[[282,8]]},"632":{"position":[[2474,8]]},"687":{"position":[[3671,8]]},"688":{"position":[[1759,8],[2547,8],[3900,8],[3937,8]]}},"keywords":{}}],["register(&mut",{"_index":3483,"title":{},"content":{"441":{"position":[[888,17]]},"688":{"position":[[888,17]]}},"keywords":{}}],["register_oper",{"_index":3514,"title":{},"content":{"441":{"position":[[3862,17]]},"688":{"position":[[3862,17]]}},"keywords":{}}],["register_operator(&mut",{"_index":3498,"title":{},"content":{"441":{"position":[[2471,26]]},"688":{"position":[[2471,26]]}},"keywords":{}}],["registri",{"_index":1701,"title":{},"content":{"108":{"position":[[243,8]]},"275":{"position":[[247,8]]},"492":{"position":[[247,8]]}},"keywords":{}}],["regular",{"_index":1467,"title":{},"content":{"79":{"position":[[1304,7]]},"138":{"position":[[918,7]]},"146":{"position":[[526,7]]},"198":{"position":[[2216,7]]},"204":{"position":[[1346,7]]},"230":{"position":[[1321,7]]},"318":{"position":[[910,7]]},"334":{"position":[[530,7]]},"424":{"position":[[1296,7]]},"434":{"position":[[2206,7]]},"461":{"position":[[1321,7]]},"544":{"position":[[910,7]]},"551":{"position":[[530,7]]},"605":{"position":[[627,7]]},"607":{"position":[[241,7]]},"610":{"position":[[505,7]]},"666":{"position":[[1296,7]]},"681":{"position":[[2216,7]]},"713":{"position":[[627,7]]},"715":{"position":[[241,7]]},"718":{"position":[[505,7]]}},"keywords":{}}],["reimplement",{"_index":2106,"title":{},"content":{"164":{"position":[[349,16]]},"353":{"position":[[384,16]]},"569":{"position":[[384,16]]}},"keywords":{}}],["reinvent",{"_index":647,"title":{},"content":{"22":{"position":[[271,11]]},"38":{"position":[[259,11]]}},"keywords":{}}],["reject",{"_index":1371,"title":{},"content":{"71":{"position":[[668,9]]},"235":{"position":[[668,9]]},"471":{"position":[[668,9]]},"602":{"position":[[137,9]]},"710":{"position":[[137,9]]}},"keywords":{}}],["relat",{"_index":3089,"title":{},"content":{"383":{"position":[[48,7]]},"625":{"position":[[48,7]]}},"keywords":{}}],["relationship",{"_index":3809,"title":{},"content":{"612":{"position":[[74,13],[2124,13]]},"720":{"position":[[74,13],[2124,13]]}},"keywords":{}}],["releas",{"_index":143,"title":{"19":{"position":[[11,8]]}},"content":{"3":{"position":[[377,9],[456,7],[718,9]]},"32":{"position":[[1687,7]]},"65":{"position":[[109,7],[375,7]]},"117":{"position":[[832,7],[1142,7],[1209,8]]},"240":{"position":[[109,7],[375,7]]},"265":{"position":[[301,7]]},"298":{"position":[[832,7],[1142,7],[1209,8]]},"405":{"position":[[301,7]]},"465":{"position":[[109,7],[375,7]]},"519":{"position":[[832,7],[1142,7],[1209,8]]},"642":{"position":[[301,7]]}},"keywords":{}}],["release/0.9.0",{"_index":1765,"title":{},"content":{"117":{"position":[[1073,13]]},"298":{"position":[[1073,13]]},"519":{"position":[[1073,13]]}},"keywords":{}}],["reli",{"_index":2365,"title":{},"content":{"197":{"position":[[801,6]]},"433":{"position":[[800,6]]},"680":{"position":[[800,6]]}},"keywords":{}}],["rem",{"_index":2644,"title":{},"content":{"212":{"position":[[2177,4],[2231,4]]},"391":{"position":[[2177,4],[2231,4]]},"661":{"position":[[2177,4],[2231,4]]}},"keywords":{}}],["remain",{"_index":1710,"title":{},"content":{"114":{"position":[[228,7]]},"205":{"position":[[59,9]]},"212":{"position":[[1632,9],[1747,9],[1937,9],[2149,9],[2341,9],[2459,9],[2736,9],[3150,9]]},"257":{"position":[[228,7]]},"267":{"position":[[3572,7]]},"321":{"position":[[349,7]]},"391":{"position":[[1632,9],[1747,9],[1937,9],[2149,9],[2341,9],[2459,9],[2742,9],[3168,9]]},"407":{"position":[[3572,7]]},"425":{"position":[[59,9]]},"440":{"position":[[1550,9]]},"441":{"position":[[2913,7],[3402,7]]},"477":{"position":[[3766,9]]},"480":{"position":[[228,7]]},"539":{"position":[[349,7]]},"644":{"position":[[3572,7]]},"661":{"position":[[1632,9],[1747,9],[1937,9],[2149,9],[2341,9],[2459,9],[2742,9],[3168,9]]},"667":{"position":[[59,9]]},"687":{"position":[[1550,9]]},"688":{"position":[[2913,7],[3402,7]]},"699":{"position":[[3766,9]]}},"keywords":{}}],["remark",{"_index":2469,"title":{},"content":{"205":{"position":[[210,8]]},"425":{"position":[[210,8]]},"667":{"position":[[210,8]]}},"keywords":{}}],["rememb",{"_index":1750,"title":{},"content":{"115":{"position":[[3191,9]]},"258":{"position":[[3117,9]]},"396":{"position":[[201,8]]},"414":{"position":[[722,8]]},"481":{"position":[[3117,9]]},"633":{"position":[[201,8]]},"651":{"position":[[722,8]]}},"keywords":{}}],["remind",{"_index":862,"title":{},"content":{"38":{"position":[[8,9]]}},"keywords":{}}],["remov",{"_index":2802,"title":{},"content":{"265":{"position":[[98,6]]},"267":{"position":[[2384,8],[3210,8],[4035,6],[4299,6]]},"268":{"position":[[1860,8],[2098,8],[2734,8]]},"405":{"position":[[98,6]]},"407":{"position":[[2384,8],[3210,8],[4035,6],[4299,6]]},"408":{"position":[[1860,8],[2098,8],[2734,8]]},"419":{"position":[[2060,7],[2107,6]]},"613":{"position":[[513,9],[572,9],[1463,6],[1699,6],[2093,9],[2160,6]]},"642":{"position":[[98,6]]},"644":{"position":[[2384,8],[3210,8],[4035,6],[4299,6]]},"645":{"position":[[1860,8],[2098,8],[2734,8]]},"656":{"position":[[2060,7],[2107,6]]},"721":{"position":[[513,9],[572,9],[1463,6],[1699,6],[2093,9],[2160,6]]}},"keywords":{}}],["remove(&mut",{"_index":3692,"title":{},"content":{"601":{"position":[[548,15],[1006,15]]},"613":{"position":[[528,15],[618,15]]},"709":{"position":[[548,15],[1006,15]]},"721":{"position":[[528,15],[618,15]]}},"keywords":{}}],["renounc",{"_index":2172,"title":{},"content":{"182":{"position":[[291,9]]},"373":{"position":[[291,9]]},"589":{"position":[[291,9]]}},"keywords":{}}],["renounce_role(&mut",{"_index":2232,"title":{},"content":{"185":{"position":[[1231,22]]},"376":{"position":[[1215,22]]},"592":{"position":[[1215,22]]}},"keywords":{}}],["renounced.a",{"_index":2171,"title":{},"content":{"182":{"position":[[264,11]]},"373":{"position":[[264,11]]},"589":{"position":[[264,11]]}},"keywords":{}}],["repeat",{"_index":74,"title":{},"content":{"1":{"position":[[929,6]]},"72":{"position":[[162,8]]},"236":{"position":[[162,8]]},"472":{"position":[[162,8]]}},"keywords":{}}],["replac",{"_index":1015,"title":{},"content":{"40":{"position":[[76,12]]},"54":{"position":[[24,7]]},"147":{"position":[[1022,8],[1145,8]]},"178":{"position":[[609,8],[732,8]]},"212":{"position":[[172,7]]},"264":{"position":[[491,7]]},"267":{"position":[[1225,7],[1807,7]]},"268":{"position":[[1416,7]]},"335":{"position":[[1030,8],[1153,8]]},"369":{"position":[[609,8],[732,8]]},"382":{"position":[[304,7]]},"383":{"position":[[261,7],[512,7],[981,7]]},"391":{"position":[[172,7]]},"395":{"position":[[4066,7]]},"404":{"position":[[491,7]]},"407":{"position":[[1225,7],[1807,7]]},"408":{"position":[[1416,7]]},"552":{"position":[[1030,8],[1153,8]]},"585":{"position":[[609,8],[732,8]]},"624":{"position":[[304,7]]},"625":{"position":[[261,7],[512,7],[981,7]]},"632":{"position":[[4066,7]]},"641":{"position":[[491,7]]},"644":{"position":[[1225,7],[1807,7]]},"645":{"position":[[1416,7]]},"661":{"position":[[172,7]]}},"keywords":{}}],["repo",{"_index":1657,"title":{},"content":{"100":{"position":[[76,4]]},"292":{"position":[[76,4]]},"504":{"position":[[76,4]]}},"keywords":{}}],["repositori",{"_index":117,"title":{},"content":{"2":{"position":[[542,10]]},"24":{"position":[[26,10]]},"102":{"position":[[665,11]]},"117":{"position":[[525,11]]},"126":{"position":[[596,11]]},"164":{"position":[[1197,10]]},"264":{"position":[[368,11]]},"270":{"position":[[284,10]]},"277":{"position":[[596,11]]},"294":{"position":[[665,11]]},"298":{"position":[[525,11]]},"324":{"position":[[151,11]]},"353":{"position":[[1232,10]]},"382":{"position":[[181,11]]},"385":{"position":[[284,10]]},"404":{"position":[[368,11]]},"410":{"position":[[284,10]]},"506":{"position":[[665,11]]},"514":{"position":[[596,11]]},"519":{"position":[[525,11]]},"542":{"position":[[151,11]]},"569":{"position":[[1232,10]]},"624":{"position":[[181,11]]},"627":{"position":[[284,10]]},"641":{"position":[[368,11]]},"647":{"position":[[284,10]]}},"keywords":{}}],["repres",{"_index":961,"title":{},"content":{"39":{"position":[[1867,11]]},"79":{"position":[[341,10]]},"85":{"position":[[102,11]]},"162":{"position":[[271,10]]},"230":{"position":[[358,10]]},"254":{"position":[[102,11]]},"351":{"position":[[271,10]]},"440":{"position":[[3411,10]]},"461":{"position":[[358,10]]},"485":{"position":[[102,11]]},"567":{"position":[[271,10]]},"598":{"position":[[1795,9]]},"617":{"position":[[1193,10]]},"687":{"position":[[3411,10]]},"706":{"position":[[1795,9]]},"725":{"position":[[1193,10]]}},"keywords":{}}],["represent",{"_index":906,"title":{},"content":{"39":{"position":[[312,14],[586,14]]},"211":{"position":[[724,14]]},"212":{"position":[[3734,14]]},"390":{"position":[[698,14]]},"391":{"position":[[3752,14]]},"660":{"position":[[698,14]]},"661":{"position":[[3752,14]]}},"keywords":{}}],["request",{"_index":507,"title":{},"content":{"17":{"position":[[1677,7]]},"128":{"position":[[334,9]]},"279":{"position":[[334,9]]},"394":{"position":[[356,7]]},"516":{"position":[[334,9]]},"631":{"position":[[356,7]]}},"keywords":{}}],["requir",{"_index":98,"title":{},"content":{"2":{"position":[[154,8]]},"51":{"position":[[89,13]]},"66":{"position":[[270,9]]},"98":{"position":[[496,8]]},"110":{"position":[[275,8]]},"120":{"position":[[258,7]]},"126":{"position":[[3605,8]]},"174":{"position":[[98,8]]},"184":{"position":[[884,8]]},"196":{"position":[[1042,8]]},"241":{"position":[[270,9]]},"266":{"position":[[105,9]]},"267":{"position":[[4246,7],[4467,9]]},"268":{"position":[[511,8]]},"277":{"position":[[3773,8]]},"290":{"position":[[496,8]]},"301":{"position":[[258,7]]},"305":{"position":[[275,8]]},"360":{"position":[[98,8]]},"375":{"position":[[803,8]]},"395":{"position":[[3474,8]]},"406":{"position":[[105,9]]},"407":{"position":[[4246,7],[4467,9]]},"408":{"position":[[511,8]]},"432":{"position":[[987,8]]},"440":{"position":[[3733,8]]},"466":{"position":[[270,9]]},"477":{"position":[[1198,8]]},"502":{"position":[[496,8]]},"510":{"position":[[275,8]]},"514":{"position":[[3605,8]]},"522":{"position":[[258,7]]},"576":{"position":[[98,8]]},"591":{"position":[[803,8]]},"611":{"position":[[596,8]]},"632":{"position":[[3474,8]]},"643":{"position":[[105,9]]},"644":{"position":[[4246,7],[4467,9]]},"645":{"position":[[511,8]]},"679":{"position":[[987,8]]},"687":{"position":[[3733,8]]},"699":{"position":[[1198,8]]},"719":{"position":[[596,8]]}},"keywords":{}}],["require_not_paus",{"_index":2718,"title":{},"content":{"221":{"position":[[752,20]]},"454":{"position":[[752,20]]},"694":{"position":[[752,20]]}},"keywords":{}}],["require_not_paused(&self",{"_index":2708,"title":{},"content":{"221":{"position":[[155,29]]},"454":{"position":[[155,29]]},"694":{"position":[[155,29]]}},"keywords":{}}],["require_paus",{"_index":2719,"title":{},"content":{"221":{"position":[[843,16]]},"454":{"position":[[843,16]]},"694":{"position":[[843,16]]}},"keywords":{}}],["require_paused(&self",{"_index":2711,"title":{},"content":{"221":{"position":[[264,25]]},"454":{"position":[[264,25]]},"694":{"position":[[264,25]]}},"keywords":{}}],["required.chang",{"_index":2824,"title":{},"content":{"267":{"position":[[547,15]]},"407":{"position":[[547,15]]},"644":{"position":[[547,15]]}},"keywords":{}}],["reset(&mut",{"_index":3727,"title":{},"content":{"602":{"position":[[464,14]]},"710":{"position":[[464,14]]}},"keywords":{}}],["resign",{"_index":567,"title":{},"content":{"20":{"position":[[38,8]]},"184":{"position":[[1236,6]]},"375":{"position":[[1133,6]]},"591":{"position":[[1133,6]]}},"keywords":{}}],["resolut",{"_index":945,"title":{},"content":{"39":{"position":[[1228,10]]},"612":{"position":[[1668,10]]},"720":{"position":[[1668,10]]}},"keywords":{}}],["resolv",{"_index":1507,"title":{},"content":{"83":{"position":[[218,8]]},"252":{"position":[[218,8]]},"483":{"position":[[218,8]]},"612":{"position":[[1534,7]]},"720":{"position":[[1534,7]]}},"keywords":{}}],["resourc",{"_index":1790,"title":{},"content":{"121":{"position":[[241,9],[266,9]]},"302":{"position":[[241,9],[266,9]]},"321":{"position":[[239,9]]},"323":{"position":[[46,9]]},"523":{"position":[[241,9],[266,9]]},"539":{"position":[[239,9]]},"541":{"position":[[46,9]]},"606":{"position":[[1156,8]]},"714":{"position":[[1156,8]]}},"keywords":{}}],["resources/my_contract_schema.json",{"_index":2982,"title":{},"content":{"323":{"position":[[191,33]]},"541":{"position":[[191,33]]}},"keywords":{}}],["respect",{"_index":664,"title":{},"content":{"22":{"position":[[1040,13]]},"78":{"position":[[383,13]]},"229":{"position":[[404,13]]},"460":{"position":[[404,13]]},"606":{"position":[[811,13]]},"714":{"position":[[811,13]]}},"keywords":{}}],["respons",{"_index":417,"title":{},"content":{"15":{"position":[[421,8]]},"108":{"position":[[65,11]]},"110":{"position":[[367,14]]},"145":{"position":[[217,11]]},"275":{"position":[[69,11]]},"305":{"position":[[367,14]]},"333":{"position":[[217,11]]},"393":{"position":[[327,11]]},"415":{"position":[[142,11]]},"441":{"position":[[112,11]]},"492":{"position":[[69,11]]},"510":{"position":[[367,14]]},"550":{"position":[[217,11]]},"630":{"position":[[327,11]]},"652":{"position":[[142,11]]},"688":{"position":[[112,11]]}},"keywords":{}}],["rest",{"_index":1110,"title":{},"content":{"43":{"position":[[144,4]]}},"keywords":{}}],["result",{"_index":188,"title":{"11":{"position":[[8,8]]}},"content":{"5":{"position":[[308,6]]},"9":{"position":[[1543,6]]},"10":{"position":[[668,6],[737,7],[902,6],[975,6],[1264,6],[1336,6]]},"11":{"position":[[68,6]]},"17":{"position":[[1804,7]]},"31":{"position":[[259,6],[2372,7],[3283,6],[3612,6]]},"32":{"position":[[150,7],[415,6],[770,6],[1012,6],[1530,6],[1558,7]]},"39":{"position":[[3202,9]]},"73":{"position":[[686,6]]},"85":{"position":[[916,6]]},"103":{"position":[[169,6],[412,6]]},"115":{"position":[[1508,7]]},"127":{"position":[[585,6]]},"147":{"position":[[884,6]]},"162":{"position":[[1564,6]]},"165":{"position":[[68,8]]},"168":{"position":[[1396,6]]},"212":{"position":[[827,7],[914,6],[1204,7],[1306,6],[4092,6],[4364,7],[4410,6],[4431,6]]},"237":{"position":[[686,6]]},"254":{"position":[[916,6]]},"258":{"position":[[1454,7]]},"278":{"position":[[585,6]]},"295":{"position":[[169,6],[412,6]]},"335":{"position":[[892,6]]},"346":{"position":[[274,6]]},"348":{"position":[[1396,6]]},"351":{"position":[[1586,6]]},"354":{"position":[[68,8]]},"391":{"position":[[827,7],[914,6],[1204,7],[1306,6],[4110,6],[4382,7],[4428,6],[4449,6]]},"415":{"position":[[259,6]]},"473":{"position":[[686,6]]},"481":{"position":[[1454,7]]},"485":{"position":[[916,6]]},"507":{"position":[[169,6],[412,6]]},"515":{"position":[[585,6]]},"552":{"position":[[892,6]]},"564":{"position":[[1396,6]]},"567":{"position":[[1586,6]]},"570":{"position":[[68,8]]},"599":{"position":[[587,6]]},"617":{"position":[[365,6],[445,6],[1114,6],[1165,6],[1288,6],[1340,7]]},"652":{"position":[[259,6]]},"661":{"position":[[827,7],[914,6],[1204,7],[1306,6],[4110,6],[4382,7],[4428,6],[4449,6]]},"707":{"position":[[587,6]]},"725":{"position":[[365,6],[445,6],[1114,6],[1165,6],[1288,6],[1340,7]]}},"keywords":{}}],["result<bool",{"_index":3918,"title":{},"content":{"617":{"position":[[725,15]]},"725":{"position":[[725,15]]}},"keywords":{}}],["result<syn::expr",{"_index":977,"title":{},"content":{"39":{"position":[[2330,20]]}},"keywords":{}}],["result<t",{"_index":2421,"title":{},"content":{"198":{"position":[[3719,12]]},"434":{"position":[[3701,12]]},"681":{"position":[[3719,12]]}},"keywords":{}}],["result(&self",{"_index":349,"title":{},"content":{"10":{"position":[[997,17]]}},"keywords":{}}],["result.try_",{"_index":2922,"title":{},"content":{"268":{"position":[[2179,11]]},"408":{"position":[[2179,11]]},"645":{"position":[[2179,11]]}},"keywords":{}}],["result}"",{"_index":834,"title":{},"content":{"32":{"position":[[838,16],[1087,16]]}},"keywords":{}}],["retain",{"_index":1733,"title":{},"content":{"115":{"position":[[1529,7],[3150,9]]},"258":{"position":[[1475,7],[3076,9]]},"481":{"position":[[1475,7],[3076,9]]}},"keywords":{}}],["rethink",{"_index":64,"title":{},"content":{"1":{"position":[[824,7]]}},"keywords":{}}],["retriev",{"_index":1417,"title":{},"content":{"76":{"position":[[279,8],[704,9]]},"178":{"position":[[848,9]]},"227":{"position":[[279,8],[704,9]]},"369":{"position":[[848,9]]},"458":{"position":[[279,8],[704,9]]},"585":{"position":[[848,9]]},"596":{"position":[[966,8]]},"600":{"position":[[1190,9]]},"602":{"position":[[798,9]]},"704":{"position":[[966,8]]},"708":{"position":[[1190,9]]},"710":{"position":[[798,9]]}},"keywords":{}}],["return",{"_index":695,"title":{},"content":{"30":{"position":[[236,7],[256,6],[309,7],[346,6],[365,6]]},"31":{"position":[[2747,6]]},"32":{"position":[[138,7],[1523,6]]},"42":{"position":[[1166,7],[1192,6]]},"79":{"position":[[1514,7]]},"92":{"position":[[974,7]]},"138":{"position":[[865,6],[1197,7]]},"141":{"position":[[660,7]]},"168":{"position":[[1701,7],[1913,7]]},"178":{"position":[[940,9]]},"185":{"position":[[3871,7]]},"197":{"position":[[1541,7],[1788,6]]},"198":{"position":[[1733,7],[2432,8],[3687,6]]},"212":{"position":[[3719,6]]},"230":{"position":[[1531,7]]},"267":{"position":[[1922,7]]},"268":{"position":[[2250,7]]},"284":{"position":[[974,7]]},"318":{"position":[[857,6],[1189,7]]},"321":{"position":[[1453,7]]},"324":{"position":[[1117,6]]},"326":{"position":[[660,7]]},"348":{"position":[[1701,7],[1913,7]]},"369":{"position":[[940,9]]},"376":{"position":[[3855,7]]},"391":{"position":[[3737,6]]},"407":{"position":[[1922,7]]},"408":{"position":[[2250,7]]},"417":{"position":[[1056,9]]},"419":{"position":[[2318,7],[2386,7],[2458,7],[2542,7],[2624,7],[2730,7],[7471,9]]},"433":{"position":[[1540,7],[1787,6]]},"434":{"position":[[1723,7],[2422,8],[3669,6]]},"461":{"position":[[1531,7]]},"476":{"position":[[1300,7],[1442,7]]},"496":{"position":[[974,7]]},"535":{"position":[[660,7]]},"539":{"position":[[1453,7]]},"542":{"position":[[1117,6]]},"544":{"position":[[857,6],[1189,7]]},"564":{"position":[[1701,7],[1913,7]]},"585":{"position":[[940,9]]},"592":{"position":[[3855,7]]},"601":{"position":[[286,6]]},"616":{"position":[[1385,6]]},"644":{"position":[[1922,7]]},"645":{"position":[[2250,7]]},"654":{"position":[[1056,9]]},"656":{"position":[[2318,7],[2386,7],[2458,7],[2542,7],[2624,7],[2730,7],[7471,9]]},"661":{"position":[[3737,6]]},"680":{"position":[[1540,7],[1787,6]]},"681":{"position":[[1733,7],[2432,8],[3687,6]]},"698":{"position":[[1300,7],[1442,7]]},"709":{"position":[[286,6]]},"724":{"position":[[1385,6]]}},"keywords":{}}],["returned.l6",{"_index":2717,"title":{},"content":{"221":{"position":[[671,11]]},"454":{"position":[[671,11]]},"694":{"position":[[671,11]]}},"keywords":{}}],["reus",{"_index":1528,"title":{},"content":{"84":{"position":[[475,6]]},"145":{"position":[[144,6]]},"146":{"position":[[336,6]]},"197":{"position":[[1122,6]]},"253":{"position":[[475,6]]},"333":{"position":[[144,6]]},"334":{"position":[[336,6]]},"433":{"position":[[1121,6]]},"484":{"position":[[475,6]]},"550":{"position":[[144,6]]},"551":{"position":[[336,6]]},"612":{"position":[[49,5],[2099,5]]},"613":{"position":[[1921,6]]},"680":{"position":[[1121,6]]},"720":{"position":[[49,5],[2099,5]]},"721":{"position":[[1921,6]]}},"keywords":{}}],["reusabl",{"_index":615,"title":{},"content":{"20":{"position":[[988,12]]},"22":{"position":[[787,11]]},"84":{"position":[[44,11]]},"171":{"position":[[37,8]]},"187":{"position":[[59,8]]},"253":{"position":[[44,11]]},"357":{"position":[[37,8]]},"364":{"position":[[59,8]]},"484":{"position":[[44,11]]},"573":{"position":[[37,8]]},"580":{"position":[[59,8]]}},"keywords":{}}],["reveal",{"_index":194,"title":{},"content":{"5":{"position":[[398,9]]}},"keywords":{}}],["revert",{"_index":1600,"title":{"93":{"position":[[0,7]]},"285":{"position":[[0,7]]},"497":{"position":[[0,7]]}},"content":{"92":{"position":[[725,8]]},"185":{"position":[[3313,7]]},"197":{"position":[[962,7],[1426,6]]},"198":{"position":[[3834,6]]},"221":{"position":[[802,7]]},"284":{"position":[[725,8]]},"321":{"position":[[850,6]]},"376":{"position":[[3297,7]]},"433":{"position":[[961,7],[1425,6]]},"434":{"position":[[3816,6]]},"440":{"position":[[6043,7]]},"454":{"position":[[802,7]]},"496":{"position":[[725,8]]},"539":{"position":[[850,6]]},"592":{"position":[[3297,7]]},"611":{"position":[[605,7],[674,6]]},"617":{"position":[[1421,8]]},"680":{"position":[[961,7],[1425,6]]},"681":{"position":[[3834,6]]},"687":{"position":[[6043,7]]},"694":{"position":[[802,7]]},"719":{"position":[[605,7],[674,6]]},"725":{"position":[[1421,8]]}},"keywords":{}}],["revert<",{"_index":2863,"title":{},"content":{"267":{"position":[[2653,12],[2725,12]]},"407":{"position":[[2653,12],[2725,12]]},"644":{"position":[[2653,12],[2725,12]]}},"keywords":{}}],["revert(governanceerror::onlytokenholderscanpropos",{"_index":3314,"title":{},"content":{"419":{"position":[[4291,53]]},"656":{"position":[[4291,53]]}},"keywords":{}}],["review",{"_index":2790,"title":{"262":{"position":[[5,6]]},"380":{"position":[[5,6]]},"402":{"position":[[5,6]]},"622":{"position":[[5,6]]},"639":{"position":[[5,6]]}},"content":{"262":{"position":[[48,9]]},"270":{"position":[[406,6]]},"380":{"position":[[48,9]]},"385":{"position":[[406,6]]},"402":{"position":[[48,9]]},"410":{"position":[[406,6]]},"622":{"position":[[48,9]]},"627":{"position":[[406,6]]},"639":{"position":[[48,9]]},"647":{"position":[[406,6]]}},"keywords":{}}],["revisit",{"_index":2101,"title":{},"content":{"164":{"position":[[46,7]]},"168":{"position":[[182,7]]},"348":{"position":[[182,7]]},"353":{"position":[[46,7]]},"564":{"position":[[182,7]]},"569":{"position":[[46,7]]}},"keywords":{}}],["revok",{"_index":2181,"title":{},"content":{"184":{"position":[[75,9],[698,6]]},"185":{"position":[[3134,8],[3742,8]]},"375":{"position":[[75,9],[617,6]]},"376":{"position":[[3118,8],[3726,8]]},"591":{"position":[[75,9],[617,6]]},"592":{"position":[[3118,8],[3726,8]]}},"keywords":{}}],["revoke_role(&mut",{"_index":2230,"title":{},"content":{"185":{"position":[[1035,20]]},"376":{"position":[[1019,20]]},"592":{"position":[[1019,20]]}},"keywords":{}}],["revolut",{"_index":168,"title":{},"content":{"5":{"position":[[54,10]]}},"keywords":{}}],["rewrit",{"_index":439,"title":{},"content":{"16":{"position":[[249,9]]}},"keywords":{}}],["right",{"_index":992,"title":{},"content":{"39":{"position":[[2658,5],[2688,6],[2730,5],[2760,6]]},"222":{"position":[[468,5]]},"396":{"position":[[292,5]]},"419":{"position":[[2080,7]]},"455":{"position":[[468,5]]},"594":{"position":[[139,5]]},"633":{"position":[[292,5]]},"656":{"position":[[2080,7]]},"695":{"position":[[468,5]]},"702":{"position":[[139,5]]}},"keywords":{}}],["risc",{"_index":195,"title":{"6":{"position":[[0,4]]}},"content":{"6":{"position":[[29,4]]},"7":{"position":[[112,4]]},"8":{"position":[[48,4]]},"12":{"position":[[142,4],[209,4],[266,4]]}},"keywords":{}}],["risc0",{"_index":685,"title":{"29":{"position":[[7,5]]},"32":{"position":[[0,6]]}},"content":{"31":{"position":[[305,5]]},"32":{"position":[[14,6]]},"33":{"position":[[108,5]]}},"keywords":{}}],["risc0_zkvm::guest::entry!(main",{"_index":824,"title":{},"content":{"32":{"position":[[329,32]]}},"keywords":{}}],["risc0_zkvm::guest::{env",{"_index":822,"title":{},"content":{"32":{"position":[[268,25]]}},"keywords":{}}],["river",{"_index":1024,"title":{},"content":{"40":{"position":[[441,5]]}},"keywords":{}}],["rm",{"_index":2571,"title":{},"content":{"210":{"position":[[106,2]]},"389":{"position":[[106,2]]},"477":{"position":[[115,2]]},"659":{"position":[[106,2]]},"699":{"position":[[115,2]]}},"keywords":{}}],["road",{"_index":1316,"title":{},"content":{"54":{"position":[[178,4]]}},"keywords":{}}],["roadmap",{"_index":120,"title":{"3":{"position":[[0,8]]}},"content":{"3":{"position":[[313,8]]}},"keywords":{}}],["robust",{"_index":1496,"title":{},"content":{"81":{"position":[[40,6]]},"232":{"position":[[40,6]]},"463":{"position":[[40,6]]}},"keywords":{}}],["role",{"_index":2165,"title":{},"content":{"182":{"position":[[89,4],[127,4],[171,4],[252,4],[276,4]]},"184":{"position":[[59,5],[108,5],[340,5],[346,5],[464,5],[470,5],[593,5],[599,5],[630,5],[656,4],[737,5],[871,4],[905,5],[946,5],[1247,4]]},"185":{"position":[[238,4],[285,4],[401,6],[550,5],[688,5],[711,4],[867,5],[1062,5],[1260,5],[1499,5],[1656,5],[1832,5],[1838,6],[1943,5],[2102,5],[2108,6],[2214,5],[2373,5],[2379,6],[2470,4],[2540,4],[2623,5],[2696,4],[2749,4],[2778,5],[2835,4],[3115,4],[3236,5],[3258,4],[3572,5],[3637,4],[3845,4],[3862,5]]},"189":{"position":[[57,4],[116,5]]},"366":{"position":[[57,4],[116,5]]},"373":{"position":[[89,4],[127,4],[171,4],[252,4],[276,4]]},"375":{"position":[[59,5],[108,5],[307,5],[313,5],[407,5],[413,5],[512,5],[518,5],[549,5],[575,4],[656,5],[790,4],[824,5],[865,5],[1144,4]]},"376":{"position":[[222,4],[269,4],[385,6],[534,5],[672,5],[695,4],[851,5],[1046,5],[1244,5],[1483,5],[1640,5],[1816,5],[1822,6],[1927,5],[2086,5],[2092,6],[2198,5],[2357,5],[2363,6],[2454,4],[2524,4],[2607,5],[2680,4],[2733,4],[2762,5],[2819,4],[3099,4],[3220,5],[3242,4],[3556,5],[3621,4],[3829,4],[3846,5]]},"582":{"position":[[57,4],[116,5]]},"589":{"position":[[89,4],[127,4],[171,4],[252,4],[276,4]]},"591":{"position":[[59,5],[108,5],[307,5],[313,5],[407,5],[413,5],[512,5],[518,5],[549,5],[575,4],[656,5],[790,4],[824,5],[865,5],[1144,4]]},"592":{"position":[[222,4],[269,4],[385,6],[534,5],[672,5],[695,4],[851,5],[1046,5],[1244,5],[1483,5],[1640,5],[1816,5],[1822,6],[1927,5],[2086,5],[2092,6],[2198,5],[2357,5],[2363,6],[2454,4],[2524,4],[2607,5],[2680,4],[2733,4],[2762,5],[2819,4],[3099,4],[3220,5],[3242,4],[3556,5],[3621,4],[3829,4],[3846,5]]}},"keywords":{}}],["role>",{"_index":2218,"title":{},"content":{"185":{"position":[[475,8]]},"376":{"position":[[459,8]]},"592":{"position":[[459,8]]}},"keywords":{}}],["role).l22",{"_index":2273,"title":{},"content":{"185":{"position":[[3753,9]]},"376":{"position":[[3737,9]]},"592":{"position":[[3737,9]]}},"keywords":{}}],["role.a",{"_index":2170,"title":{},"content":{"182":{"position":[[245,6]]},"373":{"position":[[245,6]]},"589":{"position":[[245,6]]}},"keywords":{}}],["role.l31",{"_index":2276,"title":{},"content":{"185":{"position":[[3891,8]]},"376":{"position":[[3875,8]]},"592":{"position":[[3875,8]]}},"keywords":{}}],["role.onli",{"_index":2168,"title":{},"content":{"182":{"position":[[207,9]]},"373":{"position":[[207,9]]},"589":{"position":[[207,9]]}},"keywords":{}}],["role_admin",{"_index":2216,"title":{},"content":{"185":{"position":[[446,11],[3404,10],[3812,11]]},"376":{"position":[[430,11],[3388,10],[3796,11]]},"592":{"position":[[430,11],[3388,10],[3796,11]]}},"keywords":{}}],["roleadminchang",{"_index":2186,"title":{},"content":{"184":{"position":[[570,16]]},"185":{"position":[[327,18],[3437,16]]},"375":{"position":[[489,16]]},"376":{"position":[[311,18],[3421,16]]},"591":{"position":[[489,16]]},"592":{"position":[[311,18],[3421,16]]}},"keywords":{}}],["rolegr",{"_index":2184,"title":{},"content":{"184":{"position":[[322,11]]},"185":{"position":[[346,12],[3595,11]]},"375":{"position":[[289,11]]},"376":{"position":[[330,12],[3579,11]]},"591":{"position":[[289,11]]},"592":{"position":[[330,12],[3579,11]]}},"keywords":{}}],["rolerenounceforanotheraddress",{"_index":2201,"title":{},"content":{"184":{"position":[[1043,29]]},"375":{"position":[[940,29]]},"591":{"position":[[940,29]]}},"keywords":{}}],["rolerevok",{"_index":2185,"title":{},"content":{"184":{"position":[[446,11]]},"185":{"position":[[359,14],[3610,11]]},"375":{"position":[[389,11]]},"376":{"position":[[343,14],[3594,11]]},"591":{"position":[[389,11]]},"592":{"position":[[343,14],[3594,11]]}},"keywords":{}}],["root",{"_index":2796,"title":{},"content":{"264":{"position":[[168,4]]},"404":{"position":[[168,4]]},"613":{"position":[[1401,4]]},"641":{"position":[[168,4]]},"721":{"position":[[1401,4]]}},"keywords":{}}],["rpc",{"_index":1800,"title":{},"content":{"126":{"position":[[667,3]]},"277":{"position":[[667,3]]},"395":{"position":[[3843,3]]},"514":{"position":[[667,3]]},"632":{"position":[[3843,3]]}},"keywords":{}}],["rpc_id",{"_index":2618,"title":{},"content":{"212":{"position":[[335,7]]},"391":{"position":[[335,7]]},"661":{"position":[[335,7]]}},"keywords":{}}],["rpc_id.to_string().into",{"_index":2627,"title":{},"content":{"212":{"position":[[745,26],[959,26]]},"391":{"position":[[745,26],[959,26]]},"661":{"position":[[745,26],[959,26]]}},"keywords":{}}],["rudimentari",{"_index":1032,"title":{},"content":{"42":{"position":[[305,11]]}},"keywords":{}}],["run",{"_index":211,"title":{"67":{"position":[[0,7]]},"242":{"position":[[0,7]]},"467":{"position":[[0,7]]}},"content":{"6":{"position":[[240,3]]},"9":{"position":[[13,3],[641,3]]},"11":{"position":[[188,7]]},"20":{"position":[[621,3]]},"31":{"position":[[662,3],[797,3]]},"32":{"position":[[1681,3]]},"43":{"position":[[851,3]]},"52":{"position":[[1192,3],[1484,3],[1661,3]]},"67":{"position":[[3,3],[71,3]]},"68":{"position":[[58,3]]},"96":{"position":[[52,3],[187,4]]},"106":{"position":[[71,3],[100,7]]},"107":{"position":[[489,4]]},"117":{"position":[[618,8]]},"119":{"position":[[101,4],[240,3],[501,4],[812,3],[899,3],[1002,3]]},"120":{"position":[[77,7],[113,4]]},"127":{"position":[[3,3],[41,3],[96,3]]},"129":{"position":[[590,3]]},"132":{"position":[[84,7]]},"148":{"position":[[939,7]]},"175":{"position":[[250,3],[322,3],[370,3]]},"179":{"position":[[3,3],[98,3]]},"210":{"position":[[72,3],[100,3]]},"212":{"position":[[4446,3]]},"242":{"position":[[3,3],[71,3]]},"243":{"position":[[58,3]]},"261":{"position":[[134,7]]},"273":{"position":[[71,3],[100,7]]},"274":{"position":[[489,4]]},"278":{"position":[[3,3],[41,3],[96,3]]},"280":{"position":[[590,3]]},"288":{"position":[[52,3],[187,4]]},"298":{"position":[[618,8]]},"300":{"position":[[101,4],[240,3],[501,4],[812,3],[899,3],[1002,3]]},"301":{"position":[[77,7],[113,4]]},"312":{"position":[[84,7]]},"322":{"position":[[23,3]]},"336":{"position":[[939,7]]},"361":{"position":[[250,3],[322,3],[370,3]]},"370":{"position":[[3,3],[98,3]]},"379":{"position":[[134,7]]},"389":{"position":[[72,3],[100,3]]},"391":{"position":[[4464,3]]},"394":{"position":[[389,3]]},"395":{"position":[[4372,3],[4392,3],[4519,7]]},"401":{"position":[[134,7]]},"414":{"position":[[615,3]]},"417":{"position":[[76,3],[1631,3]]},"467":{"position":[[3,3],[71,3]]},"468":{"position":[[58,3]]},"477":{"position":[[109,3],[2289,3],[2508,3]]},"490":{"position":[[71,3],[100,7]]},"491":{"position":[[489,4]]},"500":{"position":[[52,3],[187,4]]},"515":{"position":[[3,3],[41,3],[96,3]]},"517":{"position":[[590,3]]},"519":{"position":[[618,8]]},"521":{"position":[[101,4],[240,3],[501,4],[812,3],[899,3],[1002,3]]},"522":{"position":[[77,7],[113,4]]},"529":{"position":[[84,7]]},"540":{"position":[[23,3]]},"553":{"position":[[939,7]]},"577":{"position":[[250,3],[322,3],[370,3]]},"586":{"position":[[3,3],[98,3]]},"621":{"position":[[134,7]]},"631":{"position":[[389,3]]},"632":{"position":[[4372,3],[4392,3],[4519,7]]},"638":{"position":[[134,7]]},"651":{"position":[[615,3]]},"654":{"position":[[76,3],[1631,3]]},"659":{"position":[[72,3],[100,3]]},"661":{"position":[[4464,3]]},"699":{"position":[[109,3],[2289,3],[2508,3]]}},"keywords":{}}],["run_calc_contract(&input",{"_index":825,"title":{},"content":{"32":{"position":[[424,30]]}},"keywords":{}}],["run_calc_contract(data",{"_index":808,"title":{},"content":{"31":{"position":[[3292,24],[3621,24]]}},"keywords":{}}],["run_calc_contract(input",{"_index":736,"title":{},"content":{"31":{"position":[[703,24]]}},"keywords":{}}],["run_calc_contractand",{"_index":815,"title":{},"content":{"32":{"position":[[117,20]]}},"keywords":{}}],["run_evm(calculator_evm_program",{"_index":737,"title":{},"content":{"31":{"position":[[753,31]]}},"keywords":{}}],["run_evm(program",{"_index":738,"title":{},"content":{"31":{"position":[[844,16]]}},"keywords":{}}],["run_prover(input",{"_index":831,"title":{},"content":{"32":{"position":[[779,18],[1021,18],[1109,17]]}},"keywords":{}}],["runner/src/lib.r",{"_index":729,"title":{},"content":{"31":{"position":[[480,17],[3133,17]]}},"keywords":{}}],["runtim",{"_index":702,"title":{},"content":{"30":{"position":[[493,7],[689,7]]},"92":{"position":[[863,7]]},"212":{"position":[[3238,7]]},"284":{"position":[[863,7]]},"391":{"position":[[3256,7]]},"496":{"position":[[863,7]]},"661":{"position":[[3256,7]]}},"keywords":{}}],["runtime"",{"_index":735,"title":{},"content":{"31":{"position":[[642,13]]}},"keywords":{}}],["runtime.block_on(metadata",{"_index":2682,"title":{},"content":{"212":{"position":[[4470,28]]},"391":{"position":[[4488,28]]},"661":{"position":[[4488,28]]}},"keywords":{}}],["runtime.block_on(named_value("alice"",{"_index":2691,"title":{},"content":{"212":{"position":[[4717,48]]},"391":{"position":[[4735,48]]},"661":{"position":[[4735,48]]}},"keywords":{}}],["runtime.block_on(named_value("bob"",{"_index":2693,"title":{},"content":{"212":{"position":[[4791,46]]},"391":{"position":[[4809,46]]},"661":{"position":[[4809,46]]}},"keywords":{}}],["runtime.block_on(valu",{"_index":2688,"title":{},"content":{"212":{"position":[[4665,25]]},"391":{"position":[[4683,25]]},"661":{"position":[[4683,25]]}},"keywords":{}}],["runtime::get_call_stack",{"_index":1621,"title":{},"content":{"94":{"position":[[296,27],[425,27]]},"286":{"position":[[296,27],[425,27]]},"498":{"position":[[296,27],[425,27]]}},"keywords":{}}],["runtime::revert",{"_index":1609,"title":{},"content":{"93":{"position":[[73,18]]},"285":{"position":[[73,18]]},"497":{"position":[[73,18]]}},"keywords":{}}],["runtimearg",{"_index":1688,"title":{},"content":{"103":{"position":[[319,11]]},"295":{"position":[[319,11]]},"507":{"position":[[319,11]]}},"keywords":{}}],["rust",{"_index":5,"title":{},"content":{"1":{"position":[[18,4]]},"2":{"position":[[18,4],[139,4]]},"18":{"position":[[260,4]]},"20":{"position":[[685,4]]},"22":{"position":[[50,5],[744,4]]},"31":{"position":[[66,4],[294,4]]},"38":{"position":[[68,5],[1062,5]]},"39":{"position":[[13,4],[209,4],[307,4],[371,4],[900,4],[952,4],[1578,4],[1737,4],[1891,4],[3326,4]]},"40":{"position":[[142,4]]},"42":{"position":[[1632,4]]},"50":{"position":[[371,4]]},"66":{"position":[[314,4]]},"126":{"position":[[3428,4]]},"146":{"position":[[534,4]]},"148":{"position":[[494,5]]},"173":{"position":[[86,4],[342,4]]},"198":{"position":[[2224,4]]},"204":{"position":[[1354,4]]},"241":{"position":[[314,4]]},"268":{"position":[[2322,4]]},"277":{"position":[[3596,4]]},"324":{"position":[[92,4]]},"334":{"position":[[538,4]]},"336":{"position":[[494,5]]},"359":{"position":[[86,4],[342,4]]},"408":{"position":[[2322,4]]},"424":{"position":[[1304,4]]},"434":{"position":[[2214,4]]},"466":{"position":[[314,4]]},"478":{"position":[[246,4],[307,4]]},"514":{"position":[[3428,4]]},"542":{"position":[[92,4]]},"551":{"position":[[538,4]]},"553":{"position":[[494,5]]},"575":{"position":[[86,4],[342,4]]},"594":{"position":[[81,4]]},"595":{"position":[[138,5]]},"605":{"position":[[635,4]]},"612":{"position":[[125,4],[1817,4]]},"645":{"position":[[2322,4]]},"666":{"position":[[1304,4]]},"681":{"position":[[2224,4]]},"700":{"position":[[246,4],[307,4]]},"702":{"position":[[81,4]]},"703":{"position":[[138,5]]},"713":{"position":[[635,4]]},"720":{"position":[[125,4],[1817,4]]}},"keywords":{}}],["rusttypescript",{"_index":2609,"title":{},"content":{"212":{"position":[[0,14]]},"391":{"position":[[0,14]]},"477":{"position":[[507,14]]},"661":{"position":[[0,14]]},"699":{"position":[[507,14]]}},"keywords":{}}],["rustup",{"_index":2152,"title":{},"content":{"173":{"position":[[390,6]]},"359":{"position":[[390,6]]},"575":{"position":[[390,6]]}},"keywords":{}}],["rustup.rs)wasmstrip",{"_index":2149,"title":{},"content":{"173":{"position":[[116,19]]},"359":{"position":[[116,19]]},"575":{"position":[[116,19]]}},"keywords":{}}],["s",{"_index":1763,"title":{},"content":{"117":{"position":[[956,1],[999,1],[1071,1],[1180,1]]},"298":{"position":[[956,1],[999,1],[1071,1],[1180,1]]},"519":{"position":[[956,1],[999,1],[1071,1],[1180,1]]}},"keywords":{}}],["safe",{"_index":1920,"title":{},"content":{"138":{"position":[[973,4],[982,4]]},"318":{"position":[[965,4],[974,4]]},"544":{"position":[[965,4],[974,4]]}},"keywords":{}}],["sake",{"_index":3240,"title":{},"content":{"416":{"position":[[2391,4]]},"653":{"position":[[2391,4]]}},"keywords":{}}],["sale",{"_index":3430,"title":{},"content":{"440":{"position":[[4407,5]]},"687":{"position":[[4407,5]]}},"keywords":{}}],["sale.publ",{"_index":3341,"title":{},"content":{"438":{"position":[[238,11]]},"685":{"position":[[238,11]]}},"keywords":{}}],["same",{"_index":430,"title":{},"content":{"16":{"position":[[54,4]]},"39":{"position":[[1909,4],[1924,4],[2082,4]]},"84":{"position":[[729,4]]},"90":{"position":[[61,4]]},"103":{"position":[[572,4]]},"117":{"position":[[1346,4]]},"119":{"position":[[1113,4]]},"126":{"position":[[1498,4],[2293,4]]},"168":{"position":[[1258,4]]},"198":{"position":[[1174,4]]},"247":{"position":[[1795,4]]},"253":{"position":[[729,4]]},"267":{"position":[[3584,5],[4373,4]]},"277":{"position":[[1666,4],[2461,4]]},"282":{"position":[[61,4]]},"295":{"position":[[572,4]]},"298":{"position":[[1346,4]]},"300":{"position":[[1113,4]]},"348":{"position":[[1258,4]]},"407":{"position":[[3584,5],[4373,4]]},"434":{"position":[[1164,4]]},"440":{"position":[[4737,4]]},"441":{"position":[[2925,7],[3414,5]]},"446":{"position":[[1795,4]]},"477":{"position":[[616,4]]},"484":{"position":[[729,4]]},"494":{"position":[[61,4]]},"507":{"position":[[572,4]]},"514":{"position":[[1498,4],[2293,4]]},"519":{"position":[[1346,4]]},"521":{"position":[[1113,4]]},"564":{"position":[[1258,4]]},"644":{"position":[[3584,5],[4373,4]]},"673":{"position":[[1795,4]]},"681":{"position":[[1174,4]]},"687":{"position":[[4737,4]]},"688":{"position":[[2925,7],[3414,5]]},"699":{"position":[[616,4]]}},"keywords":{}}],["sampl",{"_index":1773,"title":{},"content":{"118":{"position":[[161,6]]},"127":{"position":[[222,6]]},"175":{"position":[[200,6]]},"278":{"position":[[222,6]]},"299":{"position":[[161,6]]},"361":{"position":[[200,6]]},"477":{"position":[[2554,6]]},"515":{"position":[[222,6]]},"520":{"position":[[161,6]]},"577":{"position":[[200,6]]},"613":{"position":[[1347,6]]},"618":{"position":[[332,8]]},"699":{"position":[[2554,6]]},"721":{"position":[[1347,6]]},"726":{"position":[[332,8]]}},"keywords":{}}],["save",{"_index":1999,"title":{},"content":{"147":{"position":[[1366,5]]},"163":{"position":[[1314,6]]},"335":{"position":[[1374,5]]},"352":{"position":[[1336,6]]},"552":{"position":[[1374,5]]},"568":{"position":[[1336,6]]}},"keywords":{}}],["scale",{"_index":184,"title":{},"content":{"5":{"position":[[240,7]]}},"keywords":{}}],["scenario",{"_index":1442,"title":{},"content":{"79":{"position":[[300,9]]},"126":{"position":[[1152,10]]},"230":{"position":[[317,9]]},"268":{"position":[[2048,11]]},"277":{"position":[[1320,10]]},"408":{"position":[[2048,11]]},"416":{"position":[[2336,10]]},"440":{"position":[[4599,8]]},"441":{"position":[[4489,8]]},"461":{"position":[[317,9]]},"514":{"position":[[1152,10]]},"645":{"position":[[2048,11]]},"653":{"position":[[2336,10]]},"687":{"position":[[4599,8]]},"688":{"position":[[4489,8]]}},"keywords":{}}],["scene",{"_index":1596,"title":{},"content":{"92":{"position":[[549,7]]},"284":{"position":[[549,7]]},"496":{"position":[[549,7]]}},"keywords":{}}],["schedul",{"_index":114,"title":{},"content":{"2":{"position":[[436,8]]}},"keywords":{}}],["schema",{"_index":1583,"title":{"121":{"position":[[20,7]]},"302":{"position":[[20,7]]},"320":{"position":[[16,6]]},"322":{"position":[[15,7]]},"323":{"position":[[0,6]]},"324":{"position":[[0,6]]},"523":{"position":[[20,7]]},"538":{"position":[[16,6]]},"540":{"position":[[15,7]]},"541":{"position":[[0,6]]},"542":{"position":[[0,6]]}},"content":{"91":{"position":[[535,8],[616,7]]},"121":{"position":[[26,6],[116,6],[143,6],[168,6],[399,6]]},"134":{"position":[[71,7],[233,6]]},"283":{"position":[[535,8],[616,7]]},"302":{"position":[[26,6],[116,6],[143,6],[168,6],[399,6]]},"314":{"position":[[71,7],[233,6]]},"321":{"position":[[185,6],[429,7],[1672,6],[1813,6],[1997,6],[2125,6]]},"322":{"position":[[16,6],[72,6],[113,6]]},"323":{"position":[[14,6],[71,6],[183,7]]},"354":{"position":[[460,6]]},"382":{"position":[[62,6],[87,7]]},"495":{"position":[[535,8],[616,7]]},"523":{"position":[[26,6],[116,6],[143,6],[168,6],[399,6]]},"531":{"position":[[71,7],[233,6]]},"539":{"position":[[185,6],[429,7],[1672,6],[1813,6],[1997,6],[2125,6]]},"540":{"position":[[16,6],[72,6],[113,6]]},"541":{"position":[[14,6],[71,6],[183,7]]},"570":{"position":[[460,6]]},"624":{"position":[[62,6],[87,7]]}},"keywords":{}}],["schema.l51",{"_index":3419,"title":{},"content":{"440":{"position":[[3773,10]]},"687":{"position":[[3773,10]]}},"keywords":{}}],["schema.toolchain",{"_index":3042,"title":{},"content":{"324":{"position":[[53,16]]},"542":{"position":[[53,16]]}},"keywords":{}}],["scope",{"_index":3665,"title":{},"content":{"598":{"position":[[2195,5]]},"600":{"position":[[1100,5]]},"706":{"position":[[2195,5]]},"708":{"position":[[1100,5]]}},"keywords":{}}],["script",{"_index":1896,"title":{},"content":{"134":{"position":[[25,7]]},"314":{"position":[[25,7]]},"531":{"position":[[25,7]]}},"keywords":{}}],["sdk",{"_index":1178,"title":{},"content":{"50":{"position":[[169,4],[247,3]]},"103":{"position":[[790,4]]},"145":{"position":[[99,4]]},"295":{"position":[[790,4]]},"333":{"position":[[99,4]]},"507":{"position":[[790,4]]},"550":{"position":[[99,4]]}},"keywords":{}}],["se",{"_index":3290,"title":{},"content":{"418":{"position":[[8,2]]},"655":{"position":[[8,2]]}},"keywords":{}}],["seal",{"_index":310,"title":{},"content":{"9":{"position":[[1341,4],[1379,4]]},"10":{"position":[[54,5],[272,4],[501,5],[927,5],[1205,5]]}},"keywords":{}}],["search",{"_index":1672,"title":{},"content":{"100":{"position":[[1106,6]]},"292":{"position":[[1106,6]]},"396":{"position":[[127,6]]},"504":{"position":[[1106,6]]},"633":{"position":[[127,6]]}},"keywords":{}}],["second",{"_index":245,"title":{},"content":{"8":{"position":[[333,6]]},"20":{"position":[[666,6]]},"92":{"position":[[349,6]]},"94":{"position":[[392,6]]},"117":{"position":[[1236,6]]},"127":{"position":[[775,7]]},"148":{"position":[[748,6]]},"198":{"position":[[1938,6],[3376,6]]},"204":{"position":[[1176,6]]},"268":{"position":[[648,6],[782,6]]},"278":{"position":[[775,7]]},"284":{"position":[[349,6]]},"286":{"position":[[392,6]]},"298":{"position":[[1236,6]]},"336":{"position":[[748,6]]},"408":{"position":[[648,6],[782,6]]},"424":{"position":[[1126,6]]},"434":{"position":[[1928,6],[3358,6]]},"440":{"position":[[5931,6]]},"496":{"position":[[349,6]]},"498":{"position":[[392,6]]},"515":{"position":[[775,7]]},"519":{"position":[[1236,6]]},"553":{"position":[[748,6]]},"645":{"position":[[648,6],[782,6]]},"666":{"position":[[1126,6]]},"681":{"position":[[1938,6],[3376,6]]},"687":{"position":[[5931,6]]}},"keywords":{}}],["secondli",{"_index":1471,"title":{},"content":{"79":{"position":[[1423,9]]},"230":{"position":[[1440,9]]},"461":{"position":[[1440,9]]}},"keywords":{}}],["secret",{"_index":1135,"title":{},"content":{"43":{"position":[[997,6]]},"50":{"position":[[498,6]]},"99":{"position":[[297,6]]},"100":{"position":[[391,6]]},"101":{"position":[[245,6]]},"126":{"position":[[442,6],[578,6],[909,6],[956,6],[1673,6]]},"210":{"position":[[448,6],[1222,6]]},"277":{"position":[[442,6],[578,6],[909,6],[956,6],[1841,6]]},"291":{"position":[[297,6]]},"292":{"position":[[391,6]]},"293":{"position":[[245,6]]},"389":{"position":[[448,6],[1159,6]]},"395":{"position":[[3688,6],[4078,6],[4117,6]]},"477":{"position":[[262,6],[340,6]]},"503":{"position":[[297,6]]},"504":{"position":[[391,6]]},"505":{"position":[[245,6]]},"514":{"position":[[442,6],[578,6],[909,6],[956,6],[1673,6]]},"632":{"position":[[3688,6],[4078,6],[4117,6]]},"659":{"position":[[448,6],[1159,6]]},"699":{"position":[[262,6],[340,6]]}},"keywords":{}}],["secret_key",{"_index":1136,"title":{},"content":{"43":{"position":[[1008,14]]}},"keywords":{}}],["section",{"_index":228,"title":{},"content":{"7":{"position":[[203,8]]},"94":{"position":[[508,8]]},"97":{"position":[[329,7]]},"101":{"position":[[60,8]]},"102":{"position":[[59,8]]},"118":{"position":[[202,8]]},"122":{"position":[[12,8]]},"126":{"position":[[3485,7]]},"147":{"position":[[346,7],[428,7],[639,7]]},"155":{"position":[[12,8]]},"163":{"position":[[693,7]]},"265":{"position":[[118,7],[243,7]]},"270":{"position":[[147,8]]},"277":{"position":[[3653,7]]},"286":{"position":[[508,8]]},"289":{"position":[[329,7]]},"293":{"position":[[60,8]]},"294":{"position":[[59,8]]},"295":{"position":[[826,8]]},"299":{"position":[[202,8]]},"303":{"position":[[12,8]]},"321":{"position":[[1692,7],[1834,7],[2028,7],[2145,7],[2164,7]]},"324":{"position":[[1351,7]]},"335":{"position":[[346,7],[432,7],[643,7]]},"340":{"position":[[12,8]]},"352":{"position":[[715,7]]},"383":{"position":[[126,8]]},"385":{"position":[[147,8]]},"395":{"position":[[51,7],[6835,7]]},"396":{"position":[[894,7]]},"405":{"position":[[118,7],[243,7]]},"410":{"position":[[147,8]]},"477":{"position":[[1013,8],[1106,8],[1265,8]]},"498":{"position":[[508,8]]},"501":{"position":[[329,7]]},"505":{"position":[[60,8]]},"506":{"position":[[59,8]]},"507":{"position":[[826,8]]},"514":{"position":[[3485,7]]},"520":{"position":[[202,8]]},"524":{"position":[[12,8]]},"539":{"position":[[1692,7],[1834,7],[2028,7],[2145,7],[2164,7]]},"542":{"position":[[1351,7]]},"552":{"position":[[346,7],[432,7],[643,7]]},"560":{"position":[[12,8]]},"568":{"position":[[715,7]]},"610":{"position":[[957,8]]},"618":{"position":[[489,9]]},"625":{"position":[[126,8]]},"627":{"position":[[147,8]]},"632":{"position":[[51,7],[6835,7]]},"633":{"position":[[894,7]]},"642":{"position":[[118,7],[243,7]]},"647":{"position":[[147,8]]},"699":{"position":[[1013,8],[1106,8],[1265,8]]},"718":{"position":[[957,8]]},"726":{"position":[[489,9]]}},"keywords":{}}],["secur",{"_index":585,"title":{"190":{"position":[[0,9]]},"367":{"position":[[0,9]]},"583":{"position":[[0,9]]}},"content":{"20":{"position":[[421,8]]},"23":{"position":[[256,8]]},"393":{"position":[[347,8]]},"416":{"position":[[4779,8]]},"419":{"position":[[1751,8]]},"630":{"position":[[347,8]]},"653":{"position":[[4779,8]]},"656":{"position":[[1751,8]]}},"keywords":{}}],["see",{"_index":76,"title":{},"content":{"1":{"position":[[947,3]]},"7":{"position":[[31,3]]},"16":{"position":[[226,3]]},"26":{"position":[[0,3]]},"28":{"position":[[0,3]]},"36":{"position":[[0,3]]},"40":{"position":[[374,3]]},"46":{"position":[[0,3]]},"48":{"position":[[0,3]]},"51":{"position":[[1827,4]]},"52":{"position":[[556,3]]},"53":{"position":[[1117,3]]},"57":{"position":[[0,3]]},"59":{"position":[[0,3]]},"61":{"position":[[0,3]]},"63":{"position":[[0,3]]},"79":{"position":[[1169,4]]},"88":{"position":[[427,3]]},"100":{"position":[[1028,3]]},"101":{"position":[[729,3]]},"117":{"position":[[257,3]]},"127":{"position":[[735,3],[891,3]]},"128":{"position":[[550,4]]},"132":{"position":[[188,4]]},"143":{"position":[[6,3]]},"152":{"position":[[8,3]]},"162":{"position":[[490,3],[1381,4],[2069,3]]},"163":{"position":[[1496,3]]},"164":{"position":[[259,4]]},"166":{"position":[[27,3]]},"173":{"position":[[111,4],[151,4]]},"174":{"position":[[313,3]]},"176":{"position":[[15,3]]},"198":{"position":[[2203,4]]},"199":{"position":[[171,3]]},"214":{"position":[[0,3]]},"216":{"position":[[0,3]]},"223":{"position":[[1195,3]]},"225":{"position":[[0,3]]},"230":{"position":[[1186,4]]},"246":{"position":[[322,4]]},"250":{"position":[[427,3]]},"278":{"position":[[735,3],[891,3]]},"279":{"position":[[550,4]]},"292":{"position":[[1028,3]]},"293":{"position":[[729,3]]},"295":{"position":[[795,3]]},"298":{"position":[[257,3]]},"312":{"position":[[188,4]]},"328":{"position":[[6,3]]},"343":{"position":[[8,3]]},"351":{"position":[[527,3],[1403,4],[2091,3]]},"352":{"position":[[1518,3]]},"353":{"position":[[294,4]]},"354":{"position":[[196,3]]},"355":{"position":[[27,3]]},"359":{"position":[[111,4],[151,4]]},"360":{"position":[[313,3]]},"362":{"position":[[15,3]]},"395":{"position":[[4486,3]]},"396":{"position":[[352,3],[431,3],[536,3],[597,3],[785,3],[843,3],[1074,3]]},"397":{"position":[[259,3]]},"414":{"position":[[454,4]]},"417":{"position":[[1764,3]]},"434":{"position":[[2193,4]]},"435":{"position":[[171,3]]},"445":{"position":[[322,4]]},"449":{"position":[[0,3]]},"456":{"position":[[1195,3]]},"461":{"position":[[1186,4]]},"488":{"position":[[427,3]]},"504":{"position":[[1028,3]]},"505":{"position":[[729,3]]},"507":{"position":[[795,3]]},"515":{"position":[[735,3],[891,3]]},"516":{"position":[[550,4]]},"519":{"position":[[257,3]]},"529":{"position":[[188,4]]},"537":{"position":[[6,3]]},"557":{"position":[[8,3]]},"567":{"position":[[527,3],[1403,4],[2091,3]]},"568":{"position":[[1518,3]]},"569":{"position":[[294,4]]},"570":{"position":[[196,3]]},"571":{"position":[[27,3]]},"575":{"position":[[111,4],[151,4]]},"576":{"position":[[313,3]]},"578":{"position":[[15,3]]},"632":{"position":[[4486,3]]},"633":{"position":[[352,3],[431,3],[536,3],[597,3],[785,3],[843,3],[1074,3]]},"634":{"position":[[259,3]]},"651":{"position":[[454,4]]},"654":{"position":[[1764,3]]},"672":{"position":[[322,4]]},"681":{"position":[[2203,4]]},"682":{"position":[[171,3]]},"696":{"position":[[1195,3]]}},"keywords":{}}],["seem",{"_index":3597,"title":{},"content":{"478":{"position":[[317,6]]},"700":{"position":[[317,6]]}},"keywords":{}}],["seen",{"_index":657,"title":{},"content":{"22":{"position":[[815,4]]},"127":{"position":[[970,4]]},"168":{"position":[[1614,4]]},"278":{"position":[[970,4]]},"348":{"position":[[1614,4]]},"515":{"position":[[970,4]]},"564":{"position":[[1614,4]]}},"keywords":{}}],["select",{"_index":1872,"title":{},"content":{"129":{"position":[[386,6]]},"198":{"position":[[3076,6]]},"280":{"position":[[386,6]]},"396":{"position":[[251,8]]},"434":{"position":[[3058,6]]},"517":{"position":[[386,6]]},"633":{"position":[[251,8]]},"681":{"position":[[3076,6]]}},"keywords":{}}],["selector",{"_index":728,"title":{"609":{"position":[[0,10]]},"717":{"position":[[0,10]]}},"content":{"31":{"position":[[460,9],[2874,8],[3015,8]]},"609":{"position":[[128,9]]},"717":{"position":[[128,9]]}},"keywords":{}}],["self",{"_index":345,"title":{"413":{"position":[[0,4]]},"650":{"position":[[0,4]]}},"content":{"10":{"position":[[890,5]]},"17":{"position":[[663,5],[755,5],[822,5],[1100,5],[2257,5],[2712,5],[3110,5],[3717,5]]},"22":{"position":[[1208,5],[1275,5]]},"51":{"position":[[609,5],[730,5],[955,5]]},"71":{"position":[[71,5]]},"73":{"position":[[177,5],[362,5]]},"79":{"position":[[867,5]]},"80":{"position":[[474,5],[547,5]]},"115":{"position":[[354,5],[605,5],[676,5],[757,5],[1179,5],[1231,5],[2197,5],[2503,5],[2706,5],[2784,5],[2831,5]]},"147":{"position":[[266,5],[1095,5],[1218,5]]},"162":{"position":[[785,5]]},"163":{"position":[[809,5]]},"164":{"position":[[573,5],[851,5]]},"178":{"position":[[572,5],[682,5],[805,5]]},"185":{"position":[[861,5],[1056,5],[1254,5],[1650,5],[1937,5],[2208,5]]},"196":{"position":[[101,5]]},"197":{"position":[[237,5]]},"204":{"position":[[84,5],[640,5]]},"205":{"position":[[311,5],[480,5],[710,5],[1224,5],[1654,5]]},"209":{"position":[[978,5],[1263,5]]},"222":{"position":[[112,5],[263,5]]},"223":{"position":[[488,5],[633,5],[691,5]]},"230":{"position":[[884,5]]},"231":{"position":[[474,5],[547,5]]},"235":{"position":[[71,5]]},"237":{"position":[[177,5],[362,5]]},"247":{"position":[[119,5],[818,5],[942,5],[1093,5],[1286,5],[1384,5]]},"258":{"position":[[344,5],[591,5],[658,5],[735,5],[1125,5],[1177,5],[2143,5],[2445,5],[2636,5],[2710,5],[2757,5]]},"269":{"position":[[573,5],[1057,5],[1226,5],[1456,5],[1947,5],[2174,5],[2515,5],[2887,5]]},"321":{"position":[[1135,5],[1355,5]]},"335":{"position":[[266,5],[1103,5],[1226,5]]},"351":{"position":[[807,5]]},"352":{"position":[[831,5]]},"353":{"position":[[608,5],[886,5]]},"369":{"position":[[572,5],[682,5],[805,5]]},"376":{"position":[[845,5],[1040,5],[1238,5],[1634,5],[1921,5],[2192,5]]},"384":{"position":[[586,5],[1070,5],[1239,5],[1469,5],[1967,5],[2194,5],[2542,5],[2921,5]]},"388":{"position":[[910,5],[1195,5]]},"409":{"position":[[573,5],[1057,5],[1226,5],[1456,5],[1947,5],[2174,5],[2515,5],[2887,5]]},"416":{"position":[[1445,5],[2681,5],[3512,5],[3733,4],[4388,4]]},"419":{"position":[[1384,5],[1524,4],[2210,5],[2989,5],[3133,5],[3278,5],[3403,5],[3564,5],[3713,5],[3838,5],[3964,5],[4636,5],[5091,5],[5312,4],[5968,4],[6300,4]]},"424":{"position":[[59,5],[615,5]]},"425":{"position":[[286,5],[455,5],[685,5],[1199,5],[1629,5]]},"432":{"position":[[63,5]]},"433":{"position":[[237,5]]},"440":{"position":[[1171,5],[1643,5],[2259,5],[2590,4],[6264,5]]},"441":{"position":[[906,5],[1098,5],[1222,4],[2498,5],[2855,5],[3134,5]]},"446":{"position":[[119,5],[818,5],[942,5],[1093,5],[1286,5],[1384,5]]},"455":{"position":[[112,5],[263,5]]},"456":{"position":[[488,5],[633,5],[691,5]]},"461":{"position":[[884,5]]},"462":{"position":[[474,5],[547,5]]},"471":{"position":[[71,5]]},"473":{"position":[[177,5],[362,5]]},"476":{"position":[[511,5],[664,5],[1239,5]]},"481":{"position":[[344,5],[591,5],[658,5],[735,5],[1125,5],[1177,5],[2143,5],[2445,5],[2636,5],[2710,5],[2757,5]]},"539":{"position":[[1135,5],[1355,5]]},"552":{"position":[[266,5],[1103,5],[1226,5]]},"567":{"position":[[807,5]]},"568":{"position":[[831,5]]},"569":{"position":[[608,5],[886,5]]},"585":{"position":[[572,5],[682,5],[805,5]]},"592":{"position":[[845,5],[1040,5],[1238,5],[1634,5],[1921,5],[2192,5]]},"596":{"position":[[328,5]]},"598":{"position":[[699,5]]},"600":{"position":[[208,5]]},"601":{"position":[[470,5],[564,5],[910,5],[1022,5],[1340,5],[1528,5],[1651,5],[1759,5]]},"602":{"position":[[338,5],[412,5],[479,5],[1309,5],[1412,5],[1581,5]]},"604":{"position":[[166,5],[347,5]]},"605":{"position":[[525,5]]},"606":{"position":[[186,5],[349,5],[493,5]]},"608":{"position":[[205,5]]},"611":{"position":[[250,5]]},"613":{"position":[[544,5],[634,5],[975,5]]},"616":{"position":[[702,5]]},"617":{"position":[[195,5]]},"626":{"position":[[586,5],[1070,5],[1239,5],[1469,5],[1967,5],[2194,5],[2542,5],[2921,5]]},"646":{"position":[[573,5],[1057,5],[1226,5],[1456,5],[1947,5],[2174,5],[2515,5],[2887,5]]},"653":{"position":[[1445,5],[2681,5],[3512,5],[3733,4],[4388,4]]},"656":{"position":[[1384,5],[1524,4],[2210,5],[2989,5],[3133,5],[3278,5],[3403,5],[3564,5],[3713,5],[3838,5],[3964,5],[4636,5],[5091,5],[5312,4],[5968,4],[6300,4]]},"658":{"position":[[910,5],[1195,5]]},"666":{"position":[[59,5],[615,5]]},"667":{"position":[[286,5],[455,5],[685,5],[1199,5],[1629,5]]},"673":{"position":[[119,5],[818,5],[942,5],[1093,5],[1286,5],[1384,5]]},"679":{"position":[[63,5]]},"680":{"position":[[237,5]]},"687":{"position":[[1171,5],[1643,5],[2259,5],[2590,4],[6264,5]]},"688":{"position":[[906,5],[1098,5],[1222,4],[2498,5],[2855,5],[3134,5]]},"695":{"position":[[112,5],[263,5]]},"696":{"position":[[488,5],[633,5],[691,5]]},"698":{"position":[[511,5],[664,5],[1239,5]]},"704":{"position":[[328,5]]},"706":{"position":[[699,5]]},"708":{"position":[[208,5]]},"709":{"position":[[470,5],[564,5],[910,5],[1022,5],[1340,5],[1528,5],[1651,5],[1759,5]]},"710":{"position":[[338,5],[412,5],[479,5],[1309,5],[1412,5],[1581,5]]},"712":{"position":[[166,5],[347,5]]},"713":{"position":[[525,5]]},"714":{"position":[[186,5],[349,5],[493,5]]},"716":{"position":[[205,5]]},"719":{"position":[[250,5]]},"721":{"position":[[544,5],[634,5],[975,5]]},"724":{"position":[[702,5]]},"725":{"position":[[195,5]]}},"keywords":{}}],["self.a.foo",{"_index":3822,"title":{},"content":{"612":{"position":[[1333,12]]},"720":{"position":[[1333,12]]}},"keywords":{}}],["self.address.set",{"_index":3645,"title":{},"content":{"598":{"position":[[806,17]]},"706":{"position":[[806,17]]}},"keywords":{}}],["self.allow",{"_index":2489,"title":{},"content":{"205":{"position":[[1892,15]]},"425":{"position":[[1867,15]]},"667":{"position":[[1867,15]]}},"keywords":{}}],["self.allowance(own",{"_index":2486,"title":{},"content":{"205":{"position":[[1741,21]]},"425":{"position":[[1716,21]]},"667":{"position":[[1716,21]]}},"keywords":{}}],["self.allowances.get_or_default(&(*own",{"_index":2477,"title":{},"content":{"205":{"position":[[1122,44]]},"269":{"position":[[1868,44],[2974,44]]},"384":{"position":[[1888,44],[3008,44]]},"409":{"position":[[1868,44],[2974,44]]},"425":{"position":[[1097,44]]},"626":{"position":[[1888,44],[3008,44]]},"646":{"position":[[1868,44],[2974,44]]},"667":{"position":[[1097,44]]}},"keywords":{}}],["self.allowances.set(&(own",{"_index":2474,"title":{},"content":{"205":{"position":[[793,32]]},"269":{"position":[[1539,32]]},"384":{"position":[[1552,32]]},"409":{"position":[[1539,32]]},"425":{"position":[[768,32]]},"626":{"position":[[1552,32]]},"646":{"position":[[1539,32]]},"667":{"position":[[768,32]]}},"keywords":{}}],["self.allowances.subtract(&(*own",{"_index":2942,"title":{},"content":{"269":{"position":[[3102,38]]},"384":{"position":[[3143,38]]},"409":{"position":[[3102,38]]},"626":{"position":[[3143,38]]},"646":{"position":[[3102,38]]}},"keywords":{}}],["self.allowed.get_or_default(&(from",{"_index":540,"title":{},"content":{"17":{"position":[[3326,39]]}},"keywords":{}}],["self.allowed.get_or_default(&(own",{"_index":547,"title":{},"content":{"17":{"position":[[3917,40]]}},"keywords":{}}],["self.allowed.set(&(from",{"_index":542,"title":{},"content":{"17":{"position":[[3635,28]]}},"keywords":{}}],["self.allowed.set(&(own",{"_index":545,"title":{},"content":{"17":{"position":[[3792,29]]}},"keywords":{}}],["self.answer.get_or_default",{"_index":3903,"title":{},"content":{"616":{"position":[[1116,28]]},"724":{"position":[[1116,28]]}},"keywords":{}}],["self.answer.set",{"_index":3868,"title":{},"content":{"616":{"position":[[710,17]]},"724":{"position":[[710,17]]}},"keywords":{}}],["self.arr.get_or_default",{"_index":3705,"title":{},"content":{"601":{"position":[[1475,25],[1803,26]]},"613":{"position":[[997,26],[1111,26]]},"709":{"position":[[1475,25],[1803,26]]},"721":{"position":[[997,26],[1111,26]]}},"keywords":{}}],["self.arr.remove(1",{"_index":3847,"title":{},"content":{"613":{"position":[[1081,19]]},"721":{"position":[[1081,19]]}},"keywords":{}}],["self.arr.set([1",{"_index":3702,"title":{},"content":{"601":{"position":[[1348,16]]},"709":{"position":[[1348,16]]}},"keywords":{}}],["self.arr.set(arr",{"_index":3714,"title":{},"content":{"601":{"position":[[1859,18]]},"613":{"position":[[1062,18]]},"709":{"position":[[1859,18]]},"721":{"position":[[1062,18]]}},"keywords":{}}],["self.assert_vote_in_progress",{"_index":3244,"title":{},"content":{"416":{"position":[[2770,31]]},"419":{"position":[[4725,31]]},"653":{"position":[[2770,31]]},"656":{"position":[[4725,31]]}},"keywords":{}}],["self.b.foo",{"_index":3820,"title":{},"content":{"612":{"position":[[1175,12]]},"720":{"position":[[1175,12]]}},"keywords":{}}],["self.balance_of(&self.env().cal",{"_index":3234,"title":{},"content":{"416":{"position":[[1703,41]]},"419":{"position":[[4220,41]]},"653":{"position":[[1703,41]]},"656":{"position":[[4220,41]]}},"keywords":{}}],["self.balance_of(address",{"_index":2935,"title":{},"content":{"269":{"position":[[2227,24]]},"384":{"position":[[2247,24]]},"409":{"position":[[2227,24]]},"626":{"position":[[2247,24]]},"646":{"position":[[2227,24]]}},"keywords":{}}],["self.balances.add(address",{"_index":2449,"title":{},"content":{"204":{"position":[[690,26],[1430,26]]},"269":{"position":[[2029,26]]},"384":{"position":[[2049,26]]},"409":{"position":[[2029,26]]},"424":{"position":[[665,26],[1380,26]]},"626":{"position":[[2049,26]]},"646":{"position":[[2029,26]]},"666":{"position":[[665,26],[1380,26]]}},"keywords":{}}],["self.balances.add(recipi",{"_index":2482,"title":{},"content":{"205":{"position":[[1490,28]]},"269":{"position":[[2723,28]]},"384":{"position":[[2757,28]]},"409":{"position":[[2723,28]]},"425":{"position":[[1465,28]]},"626":{"position":[[2757,28]]},"646":{"position":[[2723,28]]},"667":{"position":[[1465,28]]}},"keywords":{}}],["self.balances.get(&caller).is_som",{"_index":1360,"title":{},"content":{"71":{"position":[[273,40]]},"235":{"position":[[273,40]]},"471":{"position":[[273,40]]},"476":{"position":[[866,40]]},"698":{"position":[[866,40]]}},"keywords":{}}],["self.balances.get(address).unwrap_or_default",{"_index":2461,"title":{},"content":{"204":{"position":[[1546,47]]},"424":{"position":[[1496,47]]},"666":{"position":[[1496,47]]}},"keywords":{}}],["self.balances.get_or_default(&address",{"_index":2476,"title":{},"content":{"205":{"position":[[992,42]]},"425":{"position":[[967,42]]},"667":{"position":[[967,42]]}},"keywords":{}}],["self.balances.get_or_default(&from",{"_index":532,"title":{},"content":{"17":{"position":[[2800,40],[3215,40]]}},"keywords":{}}],["self.balances.get_or_default(&own",{"_index":529,"title":{},"content":{"17":{"position":[[2644,40]]},"205":{"position":[[1317,41]]},"425":{"position":[[1292,41]]},"667":{"position":[[1292,41]]}},"keywords":{}}],["self.balances.get_or_default(&to",{"_index":534,"title":{},"content":{"17":{"position":[[2858,38],[3273,38]]}},"keywords":{}}],["self.balances.get_or_default(own",{"_index":2939,"title":{},"content":{"269":{"position":[[2604,35]]},"384":{"position":[[2631,35]]},"409":{"position":[[2604,35]]},"626":{"position":[[2631,35]]},"646":{"position":[[2604,35]]}},"keywords":{}}],["self.balances.set(&cal",{"_index":1362,"title":{},"content":{"71":{"position":[[386,30]]},"235":{"position":[[386,30]]},"269":{"position":[[857,30]]},"384":{"position":[[870,30]]},"409":{"position":[[857,30]]},"471":{"position":[[386,30]]},"476":{"position":[[981,30]]},"626":{"position":[[870,30]]},"646":{"position":[[857,30]]},"698":{"position":[[981,30]]}},"keywords":{}}],["self.balances.set(&contract_env::cal",{"_index":525,"title":{},"content":{"17":{"position":[[2441,46]]}},"keywords":{}}],["self.balances.set(&from",{"_index":537,"title":{},"content":{"17":{"position":[[2978,28],[3535,28]]}},"keywords":{}}],["self.balances.set(&to",{"_index":538,"title":{},"content":{"17":{"position":[[3030,26],[3587,26]]}},"keywords":{}}],["self.balances.set(address",{"_index":2466,"title":{},"content":{"204":{"position":[[1729,26]]},"424":{"position":[[1679,26]]},"666":{"position":[[1679,26]]}},"keywords":{}}],["self.balances.set(own",{"_index":2481,"title":{},"content":{"205":{"position":[[1439,24]]},"425":{"position":[[1414,24]]},"667":{"position":[[1414,24]]}},"keywords":{}}],["self.balances.subtract(address",{"_index":2938,"title":{},"content":{"269":{"position":[[2346,31]]},"384":{"position":[[2373,31]]},"409":{"position":[[2346,31]]},"626":{"position":[[2373,31]]},"646":{"position":[[2346,31]]}},"keywords":{}}],["self.balances.subtract(own",{"_index":2940,"title":{},"content":{"269":{"position":[[2683,29]]},"384":{"position":[[2717,29]]},"409":{"position":[[2683,29]]},"626":{"position":[[2717,29]]},"646":{"position":[[2683,29]]}},"keywords":{}}],["self.barks.get_or_default",{"_index":2061,"title":{},"content":{"162":{"position":[[986,27],[1491,27]]},"351":{"position":[[1008,27],[1513,27]]},"567":{"position":[[1008,27],[1513,27]]}},"keywords":{}}],["self.barks.set(bark",{"_index":2057,"title":{},"content":{"162":{"position":[[833,22],[1744,22]]},"351":{"position":[[855,22],[1766,22]]},"567":{"position":[[855,22],[1766,22]]}},"keywords":{}}],["self.boo.set(tru",{"_index":3640,"title":{},"content":{"598":{"position":[[707,19]]},"706":{"position":[[707,19]]}},"keywords":{}}],["self.bytes.set(bytes::from(vec![0xb5",{"_index":3649,"title":{},"content":{"598":{"position":[[967,40]]},"706":{"position":[[967,40]]}},"keywords":{}}],["self.c.foo",{"_index":3819,"title":{},"content":{"612":{"position":[[1018,12]]},"720":{"position":[[1018,12]]}},"keywords":{}}],["self.check_role(&self.get_role_admin(rol",{"_index":2227,"title":{},"content":{"185":{"position":[[909,47],[1104,47]]},"376":{"position":[[893,47],[1088,47]]},"592":{"position":[[893,47],[1088,47]]}},"keywords":{}}],["self.count",{"_index":1388,"title":{},"content":{"73":{"position":[[207,13]]},"237":{"position":[[207,13]]},"473":{"position":[[207,13]]}},"keywords":{}}],["self.counter.get_current_valu",{"_index":1486,"title":{},"content":{"80":{"position":[[405,32]]},"231":{"position":[[405,32]]},"462":{"position":[[405,32]]}},"keywords":{}}],["self.counter.get_or_default",{"_index":1392,"title":{},"content":{"73":{"position":[[378,30]]},"237":{"position":[[378,30]]},"473":{"position":[[378,30]]}},"keywords":{}}],["self.counter.next_valu",{"_index":1488,"title":{},"content":{"80":{"position":[[492,25]]},"231":{"position":[[492,25]]},"462":{"position":[[492,25]]}},"keywords":{}}],["self.counter.set(c",{"_index":1393,"title":{},"content":{"73":{"position":[[409,18]]},"237":{"position":[[409,18]]},"473":{"position":[[409,18]]}},"keywords":{}}],["self.data.inner.named_values.set(&nam",{"_index":2563,"title":{},"content":{"209":{"position":[[1340,43]]},"388":{"position":[[1272,43]]},"658":{"position":[[1272,43]]}},"keywords":{}}],["self.data.inner.named_values.set(&name2",{"_index":2564,"title":{},"content":{"209":{"position":[[1389,44]]},"388":{"position":[[1321,44]]},"658":{"position":[[1321,44]]}},"keywords":{}}],["self.data.value.set(valu",{"_index":2562,"title":{},"content":{"209":{"position":[[1312,27]]},"388":{"position":[[1244,27]]},"658":{"position":[[1244,27]]}},"keywords":{}}],["self.decimals.get_or_default",{"_index":2447,"title":{},"content":{"204":{"position":[[490,30]]},"424":{"position":[[465,30]]},"666":{"position":[[465,30]]}},"keywords":{}}],["self.decimals.set(decim",{"_index":523,"title":{},"content":{"17":{"position":[[2375,28]]},"204":{"position":[[238,28]]},"269":{"position":[[742,28]]},"384":{"position":[[755,28]]},"409":{"position":[[742,28]]},"424":{"position":[[213,28]]},"626":{"position":[[755,28]]},"646":{"position":[[742,28]]},"666":{"position":[[213,28]]}},"keywords":{}}],["self.decrement(i",{"_index":3760,"title":{},"content":{"606":{"position":[[280,16]]},"714":{"position":[[280,16]]}},"keywords":{}}],["self.default_addr.get_or_default",{"_index":3660,"title":{},"content":{"598":{"position":[[1508,34]]},"706":{"position":[[1508,34]]}},"keywords":{}}],["self.default_boo.get_or_default",{"_index":3654,"title":{},"content":{"598":{"position":[[1192,33]]},"706":{"position":[[1192,33]]}},"keywords":{}}],["self.default_int.get_or_default",{"_index":3658,"title":{},"content":{"598":{"position":[[1359,33]]},"706":{"position":[[1359,33]]}},"keywords":{}}],["self.default_uint.get_or_default",{"_index":3656,"title":{},"content":{"598":{"position":[[1276,34]]},"706":{"position":[[1276,34]]}},"keywords":{}}],["self.ensure_ownership(&self.env().cal",{"_index":2355,"title":{},"content":{"197":{"position":[[270,48]]},"433":{"position":[[270,48]]},"680":{"position":[[270,48]]}},"keywords":{}}],["self.env",{"_index":1366,"title":{},"content":{"71":{"position":[[513,10]]},"235":{"position":[[513,10]]},"267":{"position":[[1833,10],[1862,10]]},"407":{"position":[[1833,10],[1862,10]]},"419":{"position":[[4280,10]]},"440":{"position":[[1694,11],[2298,11]]},"441":{"position":[[1137,11],[3202,11]]},"471":{"position":[[513,10]]},"610":{"position":[[248,11]]},"613":{"position":[[666,11]]},"616":{"position":[[279,11],[1031,11]]},"644":{"position":[[1833,10],[1862,10]]},"656":{"position":[[4280,10]]},"687":{"position":[[1694,11],[2298,11]]},"688":{"position":[[1137,11],[3202,11]]},"718":{"position":[[248,11]]},"721":{"position":[[666,11]]},"724":{"position":[[279,11],[1031,11]]}},"keywords":{}}],["self.env().attached_valu",{"_index":1356,"title":{},"content":{"71":{"position":[[159,28]]},"92":{"position":[[800,28]]},"235":{"position":[[159,28]]},"284":{"position":[[800,28]]},"471":{"position":[[159,28]]},"476":{"position":[[752,28]]},"496":{"position":[[800,28]]},"698":{"position":[[752,28]]}},"keywords":{}}],["self.env().cal",{"_index":1355,"title":{},"content":{"71":{"position":[[119,20]]},"94":{"position":[[353,19]]},"115":{"position":[[443,20],[2306,20]]},"185":{"position":[[2142,19],[2413,19]]},"204":{"position":[[171,20]]},"205":{"position":[[376,20],[567,20],[772,20]]},"222":{"position":[[213,19],[363,19]]},"235":{"position":[[119,20]]},"247":{"position":[[208,20]]},"258":{"position":[[433,20],[2252,20]]},"269":{"position":[[675,20],[1122,20],[1313,20],[1518,20]]},"286":{"position":[[353,19]]},"376":{"position":[[2126,19],[2397,19]]},"384":{"position":[[688,20],[1135,20],[1326,20],[1531,20]]},"409":{"position":[[675,20],[1122,20],[1313,20],[1518,20]]},"416":{"position":[[2814,20]]},"419":{"position":[[4769,20]]},"424":{"position":[[146,20]]},"425":{"position":[[351,20],[542,20],[747,20]]},"441":{"position":[[2581,20]]},"446":{"position":[[208,20]]},"455":{"position":[[213,19],[363,19]]},"471":{"position":[[119,20]]},"476":{"position":[[712,20]]},"481":{"position":[[433,20],[2252,20]]},"498":{"position":[[353,19]]},"592":{"position":[[2126,19],[2397,19]]},"600":{"position":[[439,20]]},"626":{"position":[[688,20],[1135,20],[1326,20],[1531,20]]},"646":{"position":[[675,20],[1122,20],[1313,20],[1518,20]]},"653":{"position":[[2814,20]]},"656":{"position":[[4769,20]]},"666":{"position":[[146,20]]},"667":{"position":[[351,20],[542,20],[747,20]]},"673":{"position":[[208,20]]},"688":{"position":[[2581,20]]},"695":{"position":[[213,19],[363,19]]},"698":{"position":[[712,20]]},"708":{"position":[[439,20]]}},"keywords":{}}],["self.env().emit_event(approv",{"_index":2475,"title":{},"content":{"205":{"position":[[847,30],[1954,30]]},"269":{"position":[[1593,30],[3162,30]]},"384":{"position":[[1606,30],[3203,30]]},"409":{"position":[[1593,30],[3162,30]]},"425":{"position":[[822,30],[1929,30]]},"626":{"position":[[1606,30],[3203,30]]},"646":{"position":[[1593,30],[3162,30]]},"667":{"position":[[822,30],[1929,30]]}},"keywords":{}}],["self.env().emit_event(cr",{"_index":2973,"title":{},"content":{"321":{"position":[[1233,29]]},"539":{"position":[[1233,29]]}},"keywords":{}}],["self.env().emit_event(deposit",{"_index":3544,"title":{},"content":{"476":{"position":[[1108,29]]},"698":{"position":[[1108,29]]}},"keywords":{}}],["self.env().emit_event(ownershipchang",{"_index":2327,"title":{},"content":{"196":{"position":[[251,38]]},"197":{"position":[[391,38]]},"432":{"position":[[213,38]]},"433":{"position":[[391,38]]},"679":{"position":[[213,38]]},"680":{"position":[[391,38]]}},"keywords":{}}],["self.env().emit_event(paus",{"_index":2724,"title":{},"content":{"222":{"position":[[173,28]]},"455":{"position":[[173,28]]},"695":{"position":[[173,28]]}},"keywords":{}}],["self.env().emit_event(roleadminchang",{"_index":2240,"title":{},"content":{"185":{"position":[[1791,38]]},"376":{"position":[[1775,38]]},"592":{"position":[[1775,38]]}},"keywords":{}}],["self.env().emit_event(rolegr",{"_index":2243,"title":{},"content":{"185":{"position":[[2066,33]]},"376":{"position":[[2050,33]]},"592":{"position":[[2050,33]]}},"keywords":{}}],["self.env().emit_event(rolerevok",{"_index":2245,"title":{},"content":{"185":{"position":[[2337,33]]},"376":{"position":[[2321,33]]},"592":{"position":[[2321,33]]}},"keywords":{}}],["self.env().emit_event(transf",{"_index":2451,"title":{},"content":{"204":{"position":[[759,30]]},"205":{"position":[[1529,30]]},"267":{"position":[[1714,30]]},"269":{"position":[[936,30],[2066,30],[2388,30],[2762,30]]},"384":{"position":[[949,30],[2086,30],[2415,30],[2796,30]]},"407":{"position":[[1714,30]]},"409":{"position":[[936,30],[2066,30],[2388,30],[2762,30]]},"424":{"position":[[734,30]]},"425":{"position":[[1504,30]]},"626":{"position":[[949,30],[2086,30],[2415,30],[2796,30]]},"644":{"position":[[1714,30]]},"646":{"position":[[936,30],[2066,30],[2388,30],[2762,30]]},"666":{"position":[[734,30]]},"667":{"position":[[1504,30]]}},"keywords":{}}],["self.env().emit_event(unpaus",{"_index":2728,"title":{},"content":{"222":{"position":[[321,30]]},"455":{"position":[[321,30]]},"695":{"position":[[321,30]]}},"keywords":{}}],["self.env().emit_event(upd",{"_index":2975,"title":{},"content":{"321":{"position":[[1406,29]]},"539":{"position":[[1406,29]]}},"keywords":{}}],["self.env().get_block_tim",{"_index":1358,"title":{},"content":{"71":{"position":[[218,28]]},"235":{"position":[[218,28]]},"416":{"position":[[3812,27]]},"419":{"position":[[5391,27],[6379,27]]},"471":{"position":[[218,28]]},"476":{"position":[[811,28]]},"600":{"position":[[397,28]]},"653":{"position":[[3812,27]]},"656":{"position":[[5391,27],[6379,27]]},"698":{"position":[[811,28]]},"708":{"position":[[397,28]]}},"keywords":{}}],["self.env().revert("no",{"_index":3764,"title":{},"content":{"606":{"position":[[391,26]]},"714":{"position":[[391,26]]}},"keywords":{}}],["self.env().revert(customerror::inputlowerthanten",{"_index":3803,"title":{},"content":{"611":{"position":[[290,50]]},"719":{"position":[[290,50]]}},"keywords":{}}],["self.env().revert(customerror::insufficientbal",{"_index":3806,"title":{},"content":{"611":{"position":[[485,52]]},"719":{"position":[[485,52]]}},"keywords":{}}],["self.env().revert(error::cannotlocktwic",{"_index":3543,"title":{},"content":{"476":{"position":[[909,41]]},"698":{"position":[[909,41]]}},"keywords":{}}],["self.env().revert(error::insufficientallow",{"_index":2487,"title":{},"content":{"205":{"position":[[1801,47]]},"384":{"position":[[3093,47]]},"425":{"position":[[1776,47]]},"626":{"position":[[3093,47]]},"667":{"position":[[1776,47]]}},"keywords":{}}],["self.env().revert(error::insufficientbal",{"_index":2480,"title":{},"content":{"205":{"position":[[1391,45]]},"384":{"position":[[2287,46],[2669,45]]},"425":{"position":[[1366,45]]},"626":{"position":[[2287,46],[2669,45]]},"667":{"position":[[1366,45]]}},"keywords":{}}],["self.env().revert(error::missingrol",{"_index":2236,"title":{},"content":{"185":{"position":[[1576,38]]},"376":{"position":[[1560,38]]},"592":{"position":[[1560,38]]}},"keywords":{}}],["self.env().revert(error::notown",{"_index":2354,"title":{},"content":{"197":{"position":[[165,34]]},"433":{"position":[[165,34]]},"680":{"position":[[165,34]]}},"keywords":{}}],["self.env().revert(error::ownerisalreadyiniti",{"_index":2325,"title":{},"content":{"196":{"position":[[168,51]]},"432":{"position":[[130,51]]},"679":{"position":[[130,51]]}},"keywords":{}}],["self.env().revert(error::ownerisnotiniti",{"_index":2362,"title":{},"content":{"197":{"position":[[609,47]]},"433":{"position":[[609,47]]},"680":{"position":[[609,47]]}},"keywords":{}}],["self.env().revert(error::pausedrequir",{"_index":2712,"title":{},"content":{"221":{"position":[[315,41]]},"454":{"position":[[315,41]]},"694":{"position":[[315,41]]}},"keywords":{}}],["self.env().revert(error::rolerenounceforanotheraddress",{"_index":2233,"title":{},"content":{"185":{"position":[[1343,56]]},"376":{"position":[[1327,56]]},"592":{"position":[[1327,56]]}},"keywords":{}}],["self.env().revert(error::unpausedrequir",{"_index":2710,"title":{},"content":{"221":{"position":[[209,43]]},"454":{"position":[[209,43]]},"694":{"position":[[209,43]]}},"keywords":{}}],["self.env().revert(governanceerror::novoteinprogress",{"_index":3251,"title":{},"content":{"416":{"position":[[3600,53]]},"419":{"position":[[5179,53],[6226,53]]},"653":{"position":[[3600,53]]},"656":{"position":[[5179,53],[6226,53]]}},"keywords":{}}],["self.env().revert(governanceerror::onlytokenholderscanpropos",{"_index":3235,"title":{},"content":{"416":{"position":[[1763,63]]},"653":{"position":[[1763,63]]}},"keywords":{}}],["self.env().revert(governanceerror::votealreadyopen",{"_index":3233,"title":{},"content":{"416":{"position":[[1595,52]]},"419":{"position":[[4112,52]]},"653":{"position":[[1595,52]]},"656":{"position":[[4112,52]]}},"keywords":{}}],["self.env().revert(governanceerror::voteend",{"_index":3318,"title":{},"content":{"419":{"position":[[6426,46]]},"656":{"position":[[6426,46]]}},"keywords":{}}],["self.env().revert(governanceerror::votenotyetend",{"_index":3254,"title":{},"content":{"416":{"position":[[3859,52]]},"419":{"position":[[5438,52]]},"653":{"position":[[3859,52]]},"656":{"position":[[5438,52]]}},"keywords":{}}],["self.env().revert(insufficientallow",{"_index":2941,"title":{},"content":{"269":{"position":[[3059,40]]},"409":{"position":[[3059,40]]},"646":{"position":[[3059,40]]}},"keywords":{}}],["self.env().revert(insufficientbal",{"_index":2936,"title":{},"content":{"269":{"position":[[2267,39],[2642,38]]},"409":{"position":[[2267,39],[2642,38]]},"646":{"position":[[2267,39],[2642,38]]}},"keywords":{}}],["self.env().self_address",{"_index":1619,"title":{},"content":{"94":{"position":[[220,25]]},"286":{"position":[[220,25]]},"416":{"position":[[2850,26],[4015,26]]},"419":{"position":[[4805,26],[5594,26]]},"498":{"position":[[220,25]]},"653":{"position":[[2850,26],[4015,26]]},"656":{"position":[[4805,26],[5594,26]]}},"keywords":{}}],["self.env().self_address()).count_ref_recursive(n",{"_index":1390,"title":{},"content":{"73":{"position":[[256,48]]},"237":{"position":[[256,48]]},"473":{"position":[[256,48]]}},"keywords":{}}],["self.env().self_bal",{"_index":1623,"title":{},"content":{"94":{"position":[[604,26]]},"286":{"position":[[604,26]]},"440":{"position":[[3286,25]]},"441":{"position":[[1568,25]]},"498":{"position":[[604,26]]},"608":{"position":[[375,26]]},"611":{"position":[[424,26]]},"687":{"position":[[3286,25]]},"688":{"position":[[1568,25]]},"716":{"position":[[375,26]]},"719":{"position":[[424,26]]}},"keywords":{}}],["self.env().transfer_tokens(&self.owner.get_or_revert_with(executionerror::unwraperror",{"_index":3783,"title":{},"content":{"608":{"position":[[402,91]]},"716":{"position":[[402,91]]}},"keywords":{}}],["self.env().transfer_tokens(&to",{"_index":3785,"title":{},"content":{"608":{"position":[[566,35]]},"716":{"position":[[566,35]]}},"keywords":{}}],["self.env.revert(error::cannotlocktwic",{"_index":1361,"title":{},"content":{"71":{"position":[[316,39]]},"235":{"position":[[316,39]]},"471":{"position":[[316,39]]}},"keywords":{}}],["self.erc20",{"_index":1722,"title":{},"content":{"115":{"position":[[567,10],[2465,10]]},"258":{"position":[[557,10],[2411,10]]},"481":{"position":[[557,10],[2411,10]]}},"keywords":{}}],["self.erc20.allowance(own",{"_index":2761,"title":{},"content":{"247":{"position":[[754,27]]},"446":{"position":[[754,27]]},"673":{"position":[[754,27]]}},"keywords":{}}],["self.erc20.approve(spend",{"_index":2764,"title":{},"content":{"247":{"position":[[1143,27]]},"446":{"position":[[1143,27]]},"673":{"position":[[1143,27]]}},"keywords":{}}],["self.erc20.balance_of(address",{"_index":2760,"title":{},"content":{"247":{"position":[[636,30]]},"446":{"position":[[636,30]]},"673":{"position":[[636,30]]}},"keywords":{}}],["self.erc20.decim",{"_index":2758,"title":{},"content":{"247":{"position":[[475,21]]},"446":{"position":[[475,21]]},"673":{"position":[[475,21]]}},"keywords":{}}],["self.erc20.init(nam",{"_index":1721,"title":{},"content":{"115":{"position":[[493,21],[2356,21]]},"247":{"position":[[258,21]]},"258":{"position":[[483,21],[2302,21]]},"446":{"position":[[258,21]]},"481":{"position":[[483,21],[2302,21]]},"673":{"position":[[258,21]]}},"keywords":{}}],["self.erc20.mint(address",{"_index":1731,"title":{},"content":{"115":{"position":[[1323,24],[2923,24]]},"247":{"position":[[1491,24]]},"258":{"position":[[1269,24],[2849,24]]},"446":{"position":[[1491,24]]},"481":{"position":[[1269,24],[2849,24]]},"673":{"position":[[1491,24]]}},"keywords":{}}],["self.erc20.nam",{"_index":2756,"title":{},"content":{"247":{"position":[[355,17]]},"446":{"position":[[355,17]]},"673":{"position":[[355,17]]}},"keywords":{}}],["self.erc20.symbol",{"_index":2757,"title":{},"content":{"247":{"position":[[415,19]]},"446":{"position":[[415,19]]},"673":{"position":[[415,19]]}},"keywords":{}}],["self.erc20.total_suppli",{"_index":2759,"title":{},"content":{"247":{"position":[[543,25]]},"446":{"position":[[543,25]]},"673":{"position":[[543,25]]}},"keywords":{}}],["self.erc20.transfer(recipi",{"_index":2762,"title":{},"content":{"247":{"position":[[870,30]]},"446":{"position":[[870,30]]},"673":{"position":[[870,30]]}},"keywords":{}}],["self.erc20.transfer_from(own",{"_index":2763,"title":{},"content":{"247":{"position":[[1015,31]]},"446":{"position":[[1015,31]]},"673":{"position":[[1015,31]]}},"keywords":{}}],["self.exchang",{"_index":1745,"title":{},"content":{"115":{"position":[[2669,13]]},"258":{"position":[[2603,13]]},"481":{"position":[[2603,13]]}},"keywords":{}}],["self.exchange.init(exchange_r",{"_index":1744,"title":{},"content":{"115":{"position":[[2413,34]]},"258":{"position":[[2359,34]]},"481":{"position":[[2359,34]]}},"keywords":{}}],["self.flips_count.set(self.flips_count.get_or_default",{"_index":484,"title":{},"content":{"17":{"position":[[865,56]]}},"keywords":{}}],["self.friends.get_or_default(&friend_nam",{"_index":2091,"title":{},"content":{"163":{"position":[[993,45]]},"352":{"position":[[1015,45]]},"568":{"position":[[1015,45]]}},"keywords":{}}],["self.friends.set(&friend_nam",{"_index":2089,"title":{},"content":{"163":{"position":[[885,34]]},"352":{"position":[[907,34]]},"568":{"position":[[907,34]]}},"keywords":{}}],["self.get_or_default",{"_index":3837,"title":{},"content":{"613":{"position":[[692,22]]},"721":{"position":[[692,22]]}},"keywords":{}}],["self.get_own",{"_index":2357,"title":{},"content":{"197":{"position":[[339,17]]},"433":{"position":[[339,17]]},"680":{"position":[[339,17]]}},"keywords":{}}],["self.get_role_admin(rol",{"_index":2238,"title":{},"content":{"185":{"position":[[1724,26]]},"376":{"position":[[1708,26]]},"592":{"position":[[1708,26]]}},"keywords":{}}],["self.greet.get_or_default",{"_index":3616,"title":{},"content":{"596":{"position":[[417,27]]},"704":{"position":[[417,27]]}},"keywords":{}}],["self.greet.set(messag",{"_index":3615,"title":{},"content":{"596":{"position":[[353,24]]},"704":{"position":[[353,24]]}},"keywords":{}}],["self.has_role(rol",{"_index":2235,"title":{},"content":{"185":{"position":[[1544,20],[1988,20],[2259,19]]},"376":{"position":[[1528,20],[1972,20],[2243,19]]},"592":{"position":[[1528,20],[1972,20],[2243,19]]}},"keywords":{}}],["self.i.set",{"_index":3643,"title":{},"content":{"598":{"position":[[772,11]]},"706":{"position":[[772,11]]}},"keywords":{}}],["self.i2.set(456",{"_index":3644,"title":{},"content":{"598":{"position":[[788,17]]},"706":{"position":[[788,17]]}},"keywords":{}}],["self.internal_transfer(&self.env().cal",{"_index":3747,"title":{},"content":{"604":{"position":[[218,48]]},"712":{"position":[[218,48]]}},"keywords":{}}],["self.is_operator(cal",{"_index":3505,"title":{},"content":{"441":{"position":[[3322,25]]},"688":{"position":[[3322,25]]}},"keywords":{}}],["self.is_paus",{"_index":2709,"title":{},"content":{"221":{"position":[[190,16],[295,17]]},"454":{"position":[[190,16],[295,17]]},"694":{"position":[[190,16],[295,17]]}},"keywords":{}}],["self.is_paused.get_or_default",{"_index":2707,"title":{},"content":{"221":{"position":[[114,31]]},"454":{"position":[[114,31]]},"694":{"position":[[114,31]]}},"keywords":{}}],["self.is_paused.set(fals",{"_index":2727,"title":{},"content":{"222":{"position":[[294,26]]},"455":{"position":[[294,26]]},"695":{"position":[[294,26]]}},"keywords":{}}],["self.is_paused.set(tru",{"_index":2723,"title":{},"content":{"222":{"position":[[147,25]]},"455":{"position":[[147,25]]},"695":{"position":[[147,25]]}},"keywords":{}}],["self.is_vote_open().get_or_default",{"_index":3232,"title":{},"content":{"416":{"position":[[1556,36]]},"653":{"position":[[1556,36]]}},"keywords":{}}],["self.is_vote_open.get_or_default",{"_index":3250,"title":{},"content":{"416":{"position":[[3562,35]]},"419":{"position":[[4075,34],[5141,35],[6188,35]]},"653":{"position":[[3562,35]]},"656":{"position":[[4075,34],[5141,35],[6188,35]]}},"keywords":{}}],["self.is_vote_open.set(fals",{"_index":3266,"title":{},"content":{"416":{"position":[[4533,29]]},"419":{"position":[[6113,29]]},"653":{"position":[[4533,29]]},"656":{"position":[[6113,29]]}},"keywords":{}}],["self.is_vote_open.set(tru",{"_index":3237,"title":{},"content":{"416":{"position":[[1914,28]]},"419":{"position":[[4432,28]]},"653":{"position":[[1914,28]]},"656":{"position":[[4432,28]]}},"keywords":{}}],["self.lock",{"_index":3758,"title":{},"content":{"606":{"position":[[212,12]]},"714":{"position":[[212,12]]}},"keywords":{}}],["self.lock_dur",{"_index":1365,"title":{},"content":{"71":{"position":[[490,22]]},"235":{"position":[[490,22]]},"471":{"position":[[490,22]]},"476":{"position":[[1085,22]]},"698":{"position":[[1085,22]]}},"keywords":{}}],["self.lock_duration.set(lock_dur",{"_index":3542,"title":{},"content":{"476":{"position":[[539,38]]},"698":{"position":[[539,38]]}},"keywords":{}}],["self.lock_expiration_map",{"_index":1363,"title":{},"content":{"71":{"position":[[426,24]]},"235":{"position":[[426,24]]},"471":{"position":[[426,24]]},"476":{"position":[[1021,24]]},"698":{"position":[[1021,24]]}},"keywords":{}}],["self.locked.get_or_default",{"_index":3763,"title":{},"content":{"606":{"position":[[360,28]]},"714":{"position":[[360,28]]}},"keywords":{}}],["self.locked.set(fals",{"_index":3768,"title":{},"content":{"606":{"position":[[501,23]]},"714":{"position":[[501,23]]}},"keywords":{}}],["self.locked.set(tru",{"_index":3766,"title":{},"content":{"606":{"position":[[439,22]]},"714":{"position":[[439,22]]}},"keywords":{}}],["self.messages.get(&(send",{"_index":496,"title":{},"content":{"17":{"position":[[1196,31]]}},"keywords":{}}],["self.messages.get_or_default(&(send",{"_index":502,"title":{},"content":{"17":{"position":[[1473,42]]}},"keywords":{}}],["self.messages.set(&(send",{"_index":500,"title":{},"content":{"17":{"position":[[1338,31]]}},"keywords":{}}],["self.meta.set(meta",{"_index":2558,"title":{},"content":{"209":{"position":[[1162,20]]},"388":{"position":[[1094,20]]},"658":{"position":[[1094,20]]}},"keywords":{}}],["self.mint(&cal",{"_index":2444,"title":{},"content":{"204":{"position":[[267,22]]},"424":{"position":[[242,22]]},"666":{"position":[[242,22]]}},"keywords":{}}],["self.my_map.get(&addr",{"_index":3687,"title":{},"content":{"601":{"position":[[253,26]]},"709":{"position":[[253,26]]}},"keywords":{}}],["self.my_map.get_or_default(&(addr",{"_index":3695,"title":{},"content":{"601":{"position":[[825,38]]},"709":{"position":[[825,38]]}},"keywords":{}}],["self.my_map.get_or_default(&addr).unwrap_or_default",{"_index":3689,"title":{},"content":{"601":{"position":[[390,57]]},"709":{"position":[[390,57]]}},"keywords":{}}],["self.my_map.set(&(addr",{"_index":3697,"title":{},"content":{"601":{"position":[[953,27],[1054,27]]},"709":{"position":[[953,27],[1054,27]]}},"keywords":{}}],["self.my_map.set(&addr",{"_index":3690,"title":{},"content":{"601":{"position":[[502,26],[587,26]]},"709":{"position":[[502,26],[587,26]]}},"keywords":{}}],["self.my_uint.set(u256::from(123",{"_index":3678,"title":{},"content":{"600":{"position":[[262,34]]},"708":{"position":[[262,34]]}},"keywords":{}}],["self.name.get_or_default",{"_index":2064,"title":{},"content":{"162":{"position":[[1122,26]]},"164":{"position":[[656,26]]},"204":{"position":[[352,26]]},"321":{"position":[[1539,27]]},"351":{"position":[[1144,26]]},"353":{"position":[[691,26]]},"424":{"position":[[327,26]]},"539":{"position":[[1539,27]]},"567":{"position":[[1144,26]]},"569":{"position":[[691,26]]},"666":{"position":[[327,26]]}},"keywords":{}}],["self.name.get_or_revert_with(error::namenotset",{"_index":3095,"title":{},"content":{"384":{"position":[[1724,47]]},"626":{"position":[[1724,47]]}},"keywords":{}}],["self.name.get_or_revert_with(namenotset",{"_index":2933,"title":{},"content":{"269":{"position":[[1711,40]]},"409":{"position":[[1711,40]]},"646":{"position":[[1711,40]]}},"keywords":{}}],["self.name.set(nam",{"_index":521,"title":{},"content":{"17":{"position":[[2329,20]]},"162":{"position":[[881,20]]},"164":{"position":[[595,20]]},"204":{"position":[[192,20]]},"269":{"position":[[721,20]]},"351":{"position":[[903,20]]},"353":{"position":[[630,20]]},"384":{"position":[[734,20]]},"409":{"position":[[721,20]]},"424":{"position":[[167,20]]},"567":{"position":[[903,20]]},"569":{"position":[[630,20]]},"626":{"position":[[734,20]]},"646":{"position":[[721,20]]},"666":{"position":[[167,20]]}},"keywords":{}}],["self.name.set(name.clon",{"_index":2971,"title":{},"content":{"321":{"position":[[1173,28],[1377,28]]},"539":{"position":[[1173,28],[1377,28]]}},"keywords":{}}],["self.oper",{"_index":3502,"title":{},"content":{"441":{"position":[[2999,16],[3700,13]]},"688":{"position":[[2999,16],[3700,13]]}},"keywords":{}}],["self.operator.get",{"_index":3509,"title":{},"content":{"441":{"position":[[3629,19]]},"688":{"position":[[3629,19]]}},"keywords":{}}],["self.operator.set(oper",{"_index":3501,"title":{},"content":{"441":{"position":[[2795,28]]},"688":{"position":[[2795,28]]}},"keywords":{}}],["self.other_contract.get",{"_index":3910,"title":{},"content":{"617":{"position":[[333,25]]},"725":{"position":[[333,25]]}},"keywords":{}}],["self.other_contract.set(other_contract",{"_index":3908,"title":{},"content":{"617":{"position":[[228,40]]},"725":{"position":[[228,40]]}},"keywords":{}}],["self.own",{"_index":1726,"title":{},"content":{"115":{"position":[[1088,12],[2606,12]]},"258":{"position":[[1042,12],[2544,12]]},"481":{"position":[[1042,12],[2544,12]]}},"keywords":{}}],["self.ownable.assert_owner(&cal",{"_index":3386,"title":{},"content":{"440":{"position":[[1733,39]]},"441":{"position":[[2602,39]]},"687":{"position":[[1733,39]]},"688":{"position":[[2602,39]]}},"keywords":{}}],["self.ownable.change_ownership(new_own",{"_index":2766,"title":{},"content":{"247":{"position":[[1319,41]]},"446":{"position":[[1319,41]]},"673":{"position":[[1319,41]]}},"keywords":{}}],["self.ownable.ensure_ownership(&self.env().cal",{"_index":2767,"title":{},"content":{"247":{"position":[[1434,56]]},"446":{"position":[[1434,56]]},"673":{"position":[[1434,56]]}},"keywords":{}}],["self.ownable.ensure_ownership(self.env().cal",{"_index":1730,"title":{},"content":{"115":{"position":[[1271,51],[2871,51]]},"258":{"position":[[1217,51],[2797,51]]},"481":{"position":[[1217,51],[2797,51]]}},"keywords":{}}],["self.ownable.get_own",{"_index":2765,"title":{},"content":{"247":{"position":[[1226,24]]},"440":{"position":[[2322,25]]},"441":{"position":[[3226,25]]},"446":{"position":[[1226,24]]},"673":{"position":[[1226,24]]},"687":{"position":[[2322,25]]},"688":{"position":[[3226,25]]}},"keywords":{}}],["self.ownable.init",{"_index":3375,"title":{},"content":{"440":{"position":[[1250,20]]},"687":{"position":[[1250,20]]}},"keywords":{}}],["self.ownable.init(deploy",{"_index":1720,"title":{},"content":{"115":{"position":[[464,28],[2327,28]]},"247":{"position":[[229,28]]},"258":{"position":[[454,28],[2273,28]]},"446":{"position":[[229,28]]},"481":{"position":[[454,28],[2273,28]]},"673":{"position":[[229,28]]}},"keywords":{}}],["self.owner.get",{"_index":489,"title":{},"content":{"17":{"position":[[1053,16]]}},"keywords":{}}],["self.owner.get_or_default",{"_index":2360,"title":{},"content":{"197":{"position":[[543,27]]},"433":{"position":[[543,27]]},"680":{"position":[[543,27]]}},"keywords":{}}],["self.owner.get_or_default().as_ref",{"_index":2353,"title":{},"content":{"197":{"position":[[126,36]]},"433":{"position":[[126,36]]},"680":{"position":[[126,36]]}},"keywords":{}}],["self.owner.get_or_default().is_som",{"_index":2324,"title":{},"content":{"196":{"position":[[128,37]]},"432":{"position":[[90,37]]},"679":{"position":[[90,37]]}},"keywords":{}}],["self.owner.get_or_revert_with(myerrors::invalidown",{"_index":2977,"title":{},"content":{"321":{"position":[[1574,54]]},"539":{"position":[[1574,54]]}},"keywords":{}}],["self.owner.set(own",{"_index":478,"title":{},"content":{"17":{"position":[[710,22]]}},"keywords":{}}],["self.owner.set(owner.clon",{"_index":2972,"title":{},"content":{"321":{"position":[[1202,30]]},"539":{"position":[[1202,30]]}},"keywords":{}}],["self.owner.set(self.env().cal",{"_index":3779,"title":{},"content":{"608":{"position":[[213,36]]},"716":{"position":[[213,36]]}},"keywords":{}}],["self.owner.set(some(*new_own",{"_index":2358,"title":{},"content":{"197":{"position":[[357,33]]},"433":{"position":[[357,33]]},"680":{"position":[[357,33]]}},"keywords":{}}],["self.owner.set(some(own",{"_index":2326,"title":{},"content":{"196":{"position":[[222,28]]},"432":{"position":[[184,28]]},"679":{"position":[[184,28]]}},"keywords":{}}],["self.pauseable.paus",{"_index":2737,"title":{},"content":{"223":{"position":[[641,23]]},"456":{"position":[[641,23]]},"696":{"position":[[641,23]]}},"keywords":{}}],["self.pauseable.require_not_paus",{"_index":2736,"title":{},"content":{"223":{"position":[[496,36]]},"456":{"position":[[496,36]]},"696":{"position":[[496,36]]}},"keywords":{}}],["self.pauseable.unpaus",{"_index":2738,"title":{},"content":{"223":{"position":[[699,25]]},"456":{"position":[[699,25]]},"696":{"position":[[699,25]]}},"keywords":{}}],["self.proposed_mint.set((account",{"_index":3236,"title":{},"content":{"416":{"position":[[1855,32]]},"419":{"position":[[4373,32]]},"653":{"position":[[1855,32]]},"656":{"position":[[4373,32]]}},"keywords":{}}],["self.raw_transfer(&cal",{"_index":2470,"title":{},"content":{"205":{"position":[[397,30]]},"269":{"position":[[1143,30]]},"384":{"position":[[1156,30]]},"409":{"position":[[1143,30]]},"425":{"position":[[372,30]]},"626":{"position":[[1156,30]]},"646":{"position":[[1143,30]]},"667":{"position":[[372,30]]}},"keywords":{}}],["self.raw_transfer(own",{"_index":2473,"title":{},"content":{"205":{"position":[[639,24]]},"269":{"position":[[1385,24]]},"384":{"position":[[1398,24]]},"409":{"position":[[1385,24]]},"425":{"position":[[614,24]]},"626":{"position":[[1398,24]]},"646":{"position":[[1385,24]]},"667":{"position":[[614,24]]}},"keywords":{}}],["self.require_not_paus",{"_index":2722,"title":{},"content":{"222":{"position":[[120,26]]},"455":{"position":[[120,26]]},"695":{"position":[[120,26]]}},"keywords":{}}],["self.require_paus",{"_index":2726,"title":{},"content":{"222":{"position":[[271,22]]},"455":{"position":[[271,22]]},"695":{"position":[[271,22]]}},"keywords":{}}],["self.result.get().unwrap_or(string::from("not",{"_index":351,"title":{},"content":{"10":{"position":[[1030,50]]}},"keywords":{}}],["self.result.set(result",{"_index":347,"title":{},"content":{"10":{"position":[[945,24]]}},"keywords":{}}],["self.revert(cep78error::invalidtokenown",{"_index":3467,"title":{},"content":{"440":{"position":[[6465,43]]},"687":{"position":[[6465,43]]}},"keywords":{}}],["self.role_admin.get(rol",{"_index":2224,"title":{},"content":{"185":{"position":[[735,26]]},"376":{"position":[[719,26]]},"592":{"position":[[719,26]]}},"keywords":{}}],["self.role_admin.set(rol",{"_index":2239,"title":{},"content":{"185":{"position":[[1751,25]]},"376":{"position":[[1735,25]]},"592":{"position":[[1735,25]]}},"keywords":{}}],["self.roles.get_or_default(&(*rol",{"_index":2221,"title":{},"content":{"185":{"position":[[603,38]]},"376":{"position":[[587,38]]},"592":{"position":[[587,38]]}},"keywords":{}}],["self.roles.set(&(*rol",{"_index":2242,"title":{},"content":{"185":{"position":[[2020,27],[2290,27]]},"376":{"position":[[2004,27],[2274,27]]},"592":{"position":[[2004,27],[2274,27]]}},"keywords":{}}],["self.set(vec",{"_index":3842,"title":{},"content":{"613":{"position":[[819,14]]},"721":{"position":[[819,14]]}},"keywords":{}}],["self.spend_allowance(own",{"_index":2471,"title":{},"content":{"205":{"position":[[588,27]]},"269":{"position":[[1334,27]]},"384":{"position":[[1347,27]]},"409":{"position":[[1334,27]]},"425":{"position":[[563,27]]},"626":{"position":[[1347,27]]},"646":{"position":[[1334,27]]},"667":{"position":[[563,27]]}},"keywords":{}}],["self.status.get_or_default",{"_index":3723,"title":{},"content":{"602":{"position":[[287,28]]},"710":{"position":[[287,28]]}},"keywords":{}}],["self.status.set(default::default",{"_index":3728,"title":{},"content":{"602":{"position":[[487,36]]},"710":{"position":[[487,36]]}},"keywords":{}}],["self.status.set(statu",{"_index":3724,"title":{},"content":{"602":{"position":[[362,24]]},"710":{"position":[[362,24]]}},"keywords":{}}],["self.status.set(status::cancel",{"_index":3726,"title":{},"content":{"602":{"position":[[420,34]]},"710":{"position":[[420,34]]}},"keywords":{}}],["self.strings.get(&(key1",{"_index":1463,"title":{},"content":{"79":{"position":[[1065,28]]},"230":{"position":[[1082,28]]},"461":{"position":[[1082,28]]}},"keywords":{}}],["self.symbol.get_or_default",{"_index":2446,"title":{},"content":{"204":{"position":[[421,28]]},"424":{"position":[[396,28]]},"666":{"position":[[396,28]]}},"keywords":{}}],["self.symbol.set(symbol",{"_index":522,"title":{},"content":{"17":{"position":[[2350,24]]},"204":{"position":[[213,24]]},"269":{"position":[[696,24]]},"384":{"position":[[709,24]]},"409":{"position":[[696,24]]},"424":{"position":[[188,24]]},"626":{"position":[[709,24]]},"646":{"position":[[696,24]]},"666":{"position":[[188,24]]}},"keywords":{}}],["self.text.set("hello".to_str",{"_index":3677,"title":{},"content":{"600":{"position":[[216,45]]},"708":{"position":[[216,45]]}},"keywords":{}}],["self.ticket_office_address.set(ticket_office_address",{"_index":3484,"title":{},"content":{"441":{"position":[[946,54]]},"688":{"position":[[946,54]]}},"keywords":{}}],["self.tickets.set",{"_index":3393,"title":{},"content":{"440":{"position":[[2006,17]]},"687":{"position":[[2006,17]]}},"keywords":{}}],["self.tickets.set(&ticket_id",{"_index":3414,"title":{},"content":{"440":{"position":[[3149,32]]},"687":{"position":[[3149,32]]}},"keywords":{}}],["self.todos.get(index",{"_index":3738,"title":{},"content":{"602":{"position":[[1470,21],[1625,21],[1824,21]]},"710":{"position":[[1470,21],[1625,21],[1824,21]]}},"keywords":{}}],["self.todos.push(todo",{"_index":3735,"title":{},"content":{"602":{"position":[[1331,20]]},"710":{"position":[[1331,20]]}},"keywords":{}}],["self.todos.replace(index",{"_index":3740,"title":{},"content":{"602":{"position":[[1512,25],[1683,25]]},"710":{"position":[[1512,25],[1683,25]]}},"keywords":{}}],["self.token",{"_index":3211,"title":{},"content":{"414":{"position":[[354,10]]},"416":{"position":[[2939,10]]},"419":{"position":[[1546,10],[1699,10],[5791,10]]},"440":{"position":[[3040,10]]},"441":{"position":[[3016,10]]},"651":{"position":[[354,10]]},"653":{"position":[[2939,10]]},"656":{"position":[[1546,10],[1699,10],[5791,10]]},"687":{"position":[[3040,10]]},"688":{"position":[[3016,10]]}},"keywords":{}}],["self.token.init",{"_index":3378,"title":{},"content":{"440":{"position":[[1338,16]]},"687":{"position":[[1338,16]]}},"keywords":{}}],["self.token.mint(cal",{"_index":3388,"title":{},"content":{"440":{"position":[[1816,23]]},"687":{"position":[[1816,23]]}},"keywords":{}}],["self.token.owner_of(maybe::some(ticket_id",{"_index":3401,"title":{},"content":{"440":{"position":[[2457,43]]},"687":{"position":[[2457,43]]}},"keywords":{}}],["self.token.raw_mint(&account",{"_index":3264,"title":{},"content":{"416":{"position":[[4464,33]]},"419":{"position":[[6044,33]]},"653":{"position":[[4464,33]]},"656":{"position":[[6044,33]]}},"keywords":{}}],["self.token.raw_transfer(&contract",{"_index":3261,"title":{},"content":{"416":{"position":[[4212,38]]},"653":{"position":[[4212,38]]}},"keywords":{}}],["self.token.transfer(&contract",{"_index":3315,"title":{},"content":{"419":{"position":[[4894,34]]},"656":{"position":[[4894,34]]}},"keywords":{}}],["self.tokens.module(&(token_nam",{"_index":1492,"title":{},"content":{"80":{"position":[[633,36],[819,36]]},"231":{"position":[[633,36],[819,36]]},"462":{"position":[[633,36],[819,36]]}},"keywords":{}}],["self.tokens.module(&token_name).total_suppli",{"_index":1456,"title":{},"content":{"79":{"position":[[906,50]]},"230":{"position":[[923,50]]},"461":{"position":[[923,50]]}},"keywords":{}}],["self.total_supply.add(*amount",{"_index":2450,"title":{},"content":{"204":{"position":[[727,31]]},"269":{"position":[[1997,31]]},"384":{"position":[[2017,31]]},"409":{"position":[[1997,31]]},"424":{"position":[[702,31]]},"626":{"position":[[2017,31]]},"646":{"position":[[1997,31]]},"666":{"position":[[702,31]]}},"keywords":{}}],["self.total_supply.get_or_default",{"_index":527,"title":{},"content":{"17":{"position":[[2549,34]]},"204":{"position":[[567,34]]},"424":{"position":[[542,34]]},"666":{"position":[[542,34]]}},"keywords":{}}],["self.total_supply.set(initial_suppli",{"_index":2930,"title":{},"content":{"269":{"position":[[818,38]]},"384":{"position":[[831,38]]},"409":{"position":[[818,38]]},"626":{"position":[[831,38]]},"646":{"position":[[818,38]]}},"keywords":{}}],["self.total_supply.set(total_suppli",{"_index":524,"title":{},"content":{"17":{"position":[[2404,36]]}},"keywords":{}}],["self.total_supply.subtract(*amount",{"_index":2937,"title":{},"content":{"269":{"position":[[2309,36]]},"384":{"position":[[2336,36]]},"409":{"position":[[2309,36]]},"626":{"position":[[2336,36]]},"646":{"position":[[2309,36]]}},"keywords":{}}],["self.u.set(1",{"_index":3641,"title":{},"content":{"598":{"position":[[727,14]]},"706":{"position":[[727,14]]}},"keywords":{}}],["self.u2.set(u256::from(456",{"_index":3642,"title":{},"content":{"598":{"position":[[742,29]]},"706":{"position":[[742,29]]}},"keywords":{}}],["self.unchecked_grant_role(rol",{"_index":2229,"title":{},"content":{"185":{"position":[[984,31]]},"376":{"position":[[968,31]]},"592":{"position":[[968,31]]}},"keywords":{}}],["self.unchecked_revoke_role(rol",{"_index":2231,"title":{},"content":{"185":{"position":[[1179,32],[1402,32]]},"376":{"position":[[1163,32],[1386,32]]},"592":{"position":[[1163,32],[1386,32]]}},"keywords":{}}],["self.unlock",{"_index":3761,"title":{},"content":{"606":{"position":[[305,14]]},"714":{"position":[[305,14]]}},"keywords":{}}],["self.value.get_or_default",{"_index":486,"title":{},"content":{"17":{"position":[[965,27]]},"22":{"position":[[1349,27]]},"51":{"position":[[754,28],[1076,27]]},"178":{"position":[[985,27]]},"223":{"position":[[549,27],[767,27]]},"369":{"position":[[985,27]]},"456":{"position":[[549,27],[767,27]]},"585":{"position":[[985,27]]},"696":{"position":[[549,27],[767,27]]}},"keywords":{}}],["self.value.set(!self.get",{"_index":666,"title":{},"content":{"22":{"position":[[1283,28]]},"147":{"position":[[1226,28]]},"178":{"position":[[813,28]]},"335":{"position":[[1234,28]]},"369":{"position":[[813,28]]},"552":{"position":[[1234,28]]},"585":{"position":[[813,28]]}},"keywords":{}}],["self.value.set(!self.get_valu",{"_index":483,"title":{},"content":{"17":{"position":[[830,34]]}},"keywords":{}}],["self.value.set(fals",{"_index":477,"title":{},"content":{"17":{"position":[[687,22]]},"147":{"position":[[274,22]]},"178":{"position":[[580,22]]},"335":{"position":[[274,22]]},"369":{"position":[[580,22]]},"552":{"position":[[274,22]]},"585":{"position":[[580,22]]}},"keywords":{}}],["self.value.set(new_valu",{"_index":1202,"title":{},"content":{"51":{"position":[[814,26]]},"223":{"position":[[582,26]]},"456":{"position":[[582,26]]},"696":{"position":[[582,26]]}},"keywords":{}}],["self.value.set(valu",{"_index":481,"title":{},"content":{"17":{"position":[[776,22]]},"22":{"position":[[1229,22]]},"51":{"position":[[629,22]]},"147":{"position":[[1116,22]]},"178":{"position":[[703,22]]},"335":{"position":[[1124,22]]},"369":{"position":[[703,22]]},"552":{"position":[[1124,22]]},"585":{"position":[[703,22]]}},"keywords":{}}],["self.vec.get_or_default",{"_index":3707,"title":{},"content":{"601":{"position":[[1562,26],[1673,26]]},"709":{"position":[[1562,26],[1673,26]]}},"keywords":{}}],["self.vec.set(vec",{"_index":3709,"title":{},"content":{"601":{"position":[[1606,18],[1711,18]]},"709":{"position":[[1606,18],[1711,18]]}},"keywords":{}}],["self.vec.set(vec![1",{"_index":3703,"title":{},"content":{"601":{"position":[[1395,20]]},"709":{"position":[[1395,20]]}},"keywords":{}}],["self.version.set(self.version.get_or_default",{"_index":2559,"title":{},"content":{"209":{"position":[[1183,46]]},"388":{"position":[[1115,46]]},"658":{"position":[[1115,46]]}},"keywords":{}}],["self.visits(friend_name.clon",{"_index":2088,"title":{},"content":{"163":{"position":[[851,33]]},"352":{"position":[[873,33]]},"568":{"position":[[873,33]]}},"keywords":{}}],["self.vote_end_tim",{"_index":3238,"title":{},"content":{"416":{"position":[[1992,18]]},"419":{"position":[[4510,18]]},"653":{"position":[[1992,18]]},"656":{"position":[[4510,18]]}},"keywords":{}}],["self.votes.pop",{"_index":3258,"title":{},"content":{"416":{"position":[[4065,16]]},"419":{"position":[[5644,16]]},"653":{"position":[[4065,16]]},"656":{"position":[[5644,16]]}},"keywords":{}}],["self.votes.push(ballot",{"_index":3246,"title":{},"content":{"416":{"position":[[3018,22]]},"419":{"position":[[4972,22]]},"653":{"position":[[3018,22]]},"656":{"position":[[4972,22]]}},"keywords":{}}],["self.walks.get_or_default",{"_index":2066,"title":{},"content":{"162":{"position":[[1206,28],[1317,28],[2227,28]]},"351":{"position":[[1228,28],[1339,28],[2249,28]]},"567":{"position":[[1228,28],[1339,28],[2249,28]]}},"keywords":{}}],["self.walks.iter().sum",{"_index":2108,"title":{},"content":{"164":{"position":[[796,23]]},"353":{"position":[[831,23]]},"569":{"position":[[831,23]]}},"keywords":{}}],["self.walks.len",{"_index":2107,"title":{},"content":{"164":{"position":[[728,16]]},"353":{"position":[[763,16]]},"569":{"position":[[763,16]]}},"keywords":{}}],["self.walks.push(length",{"_index":2110,"title":{},"content":{"164":{"position":[[872,24]]},"353":{"position":[[907,24]]},"569":{"position":[[907,24]]}},"keywords":{}}],["self.walks.set(vec::<u32>::default",{"_index":2059,"title":{},"content":{"162":{"position":[[902,44]]},"351":{"position":[[924,44]]},"567":{"position":[[924,44]]}},"keywords":{}}],["self.weight.get_or_default",{"_index":2063,"title":{},"content":{"162":{"position":[[1053,28]]},"351":{"position":[[1075,28]]},"567":{"position":[[1075,28]]}},"keywords":{}}],["self.weight.set(weight",{"_index":2058,"title":{},"content":{"162":{"position":[[856,24]]},"351":{"position":[[878,24]]},"567":{"position":[[878,24]]}},"keywords":{}}],["self.x.get_or_default",{"_index":3753,"title":{},"content":{"605":{"position":[[171,23]]},"713":{"position":[[171,23]]}},"keywords":{}}],["self.x.set(self.x.get_or_default",{"_index":3759,"title":{},"content":{"606":{"position":[[225,34]]},"714":{"position":[[225,34]]}},"keywords":{}}],["self::events::{init",{"_index":1195,"title":{},"content":{"51":{"position":[[437,20]]}},"keywords":{}}],["send",{"_index":215,"title":{"102":{"position":[[0,7]]},"294":{"position":[[0,7]]},"506":{"position":[[0,7]]}},"content":{"6":{"position":[[310,4]]},"9":{"position":[[481,4]]},"70":{"position":[[237,4]]},"71":{"position":[[591,4]]},"234":{"position":[[237,4]]},"235":{"position":[[591,4]]},"394":{"position":[[127,4],[462,4]]},"440":{"position":[[2840,5],[4426,5],[5874,5],[5976,5]]},"470":{"position":[[237,4]]},"471":{"position":[[591,4]]},"477":{"position":[[1946,4]]},"631":{"position":[[127,4],[462,4]]},"687":{"position":[[2840,5],[4426,5],[5874,5],[5976,5]]},"699":{"position":[[1946,4]]}},"keywords":{}}],["sender",{"_index":493,"title":{},"content":{"17":{"position":[[1145,6],[1421,7]]},"42":{"position":[[1369,6]]},"52":{"position":[[1017,7],[1068,10],[1122,6],[1341,10],[1380,11],[1432,7],[1554,10]]},"53":{"position":[[492,6]]},"115":{"position":[[2712,7]]},"184":{"position":[[378,7],[502,7]]},"185":{"position":[[2134,7],[2405,7]]},"206":{"position":[[1207,6],[1356,6],[1841,6]]},"258":{"position":[[2642,7]]},"269":{"position":[[5117,6],[5266,6],[5751,6]]},"375":{"position":[[345,7],[445,7]]},"376":{"position":[[2118,7],[2389,7]]},"409":{"position":[[5117,6],[5266,6],[5751,6]]},"416":{"position":[[4643,7]]},"426":{"position":[[1202,6],[1351,6],[1831,6]]},"481":{"position":[[2642,7]]},"591":{"position":[[345,7],[445,7]]},"592":{"position":[[2118,7],[2389,7]]},"600":{"position":[[430,6]]},"604":{"position":[[353,7]]},"610":{"position":[[78,7],[281,7],[375,7]]},"646":{"position":[[5117,6],[5266,6],[5751,6]]},"653":{"position":[[4643,7]]},"668":{"position":[[1207,6],[1356,6],[1841,6]]},"708":{"position":[[430,6]]},"712":{"position":[[353,7]]},"718":{"position":[[78,7],[281,7],[375,7]]}},"keywords":{}}],["sensit",{"_index":1381,"title":{},"content":{"72":{"position":[[420,9]]},"236":{"position":[[420,9]]},"472":{"position":[[420,9]]}},"keywords":{}}],["sent",{"_index":1349,"title":{},"content":{"70":{"position":[[76,4]]},"234":{"position":[[76,4]]},"470":{"position":[[76,4]]},"614":{"position":[[142,4]]},"722":{"position":[[142,4]]}},"keywords":{}}],["sentenc",{"_index":418,"title":{},"content":{"15":{"position":[[437,9]]}},"keywords":{}}],["separ",{"_index":1788,"title":{},"content":{"120":{"position":[[394,9]]},"147":{"position":[[625,8]]},"163":{"position":[[1348,8]]},"301":{"position":[[394,9]]},"335":{"position":[[629,8]]},"352":{"position":[[1370,8]]},"522":{"position":[[394,9]]},"552":{"position":[[629,8]]},"568":{"position":[[1370,8]]}},"keywords":{}}],["sequenc",{"_index":950,"title":{"78":{"position":[[0,9]]},"229":{"position":[[0,9]]},"460":{"position":[[0,9]]}},"content":{"39":{"position":[[1404,8]]},"78":{"position":[[4,8],[266,8]]},"80":{"position":[[144,9]]},"81":{"position":[[140,8]]},"229":{"position":[[4,8],[287,8]]},"231":{"position":[[144,9]]},"232":{"position":[[140,8]]},"441":{"position":[[243,8],[334,8],[4518,8]]},"460":{"position":[[4,8],[287,8]]},"462":{"position":[[144,9]]},"463":{"position":[[140,8]]},"688":{"position":[[243,8],[334,8],[4518,8]]}},"keywords":{}}],["sequence<t>",{"_index":1430,"title":{},"content":{"78":{"position":[[189,17]]},"229":{"position":[[189,17]]},"460":{"position":[[189,17]]}},"keywords":{}}],["sequence<u32>",{"_index":1483,"title":{},"content":{"80":{"position":[[267,20]]},"231":{"position":[[267,20]]},"462":{"position":[[267,20]]}},"keywords":{}}],["serde_json::to_string(&receipt.journal).unwrap",{"_index":307,"title":{},"content":{"9":{"position":[[1218,53]]}},"keywords":{}}],["serde_json::to_string(&receipt.seal).unwrap",{"_index":311,"title":{},"content":{"9":{"position":[[1386,50]]}},"keywords":{}}],["serde_json::to_string(multiply_id).unwrap",{"_index":315,"title":{},"content":{"9":{"position":[[1552,44]]}},"keywords":{}}],["seri",{"_index":3925,"title":{},"content":{"618":{"position":[[534,7]]},"726":{"position":[[534,7]]}},"keywords":{}}],["serial",{"_index":1557,"title":{"86":{"position":[[6,14]]},"255":{"position":[[6,14]]},"486":{"position":[[6,14]]}},"content":{"86":{"position":[[50,10],[89,13]]},"103":{"position":[[308,10]]},"162":{"position":[[73,10],[1858,10],[2314,10]]},"255":{"position":[[50,10],[89,13]]},"295":{"position":[[308,10]]},"351":{"position":[[73,10],[1880,10],[2336,10]]},"354":{"position":[[425,14]]},"486":{"position":[[50,10],[89,13]]},"507":{"position":[[308,10]]},"567":{"position":[[73,10],[1880,10],[2336,10]]},"570":{"position":[[425,14]]}},"keywords":{}}],["serializ",{"_index":1438,"title":{},"content":{"79":{"position":[[169,12]]},"230":{"position":[[169,12]]},"461":{"position":[[169,12]]}},"keywords":{}}],["serv",{"_index":1422,"title":{},"content":{"76":{"position":[[594,6]]},"84":{"position":[[906,5]]},"85":{"position":[[243,6]]},"185":{"position":[[3078,6]]},"227":{"position":[[594,6]]},"253":{"position":[[906,5]]},"254":{"position":[[243,6]]},"376":{"position":[[3062,6]]},"458":{"position":[[594,6]]},"484":{"position":[[906,5]]},"485":{"position":[[243,6]]},"592":{"position":[[3062,6]]}},"keywords":{}}],["servic",{"_index":2957,"title":{},"content":{"277":{"position":[[1189,7]]},"610":{"position":[[826,8]]},"718":{"position":[[826,8]]}},"keywords":{}}],["session",{"_index":1137,"title":{},"content":{"43":{"position":[[1027,7],[1094,7],[1198,7],[1266,7],[1329,7],[1392,7],[1443,7],[1498,7],[1545,7]]},"99":{"position":[[379,7],[416,7],[505,7],[573,7],[636,7]]},"100":{"position":[[472,7],[514,7],[589,7],[658,7],[721,7],[769,7],[817,7]]},"101":{"position":[[326,7],[369,7],[447,7],[516,7],[579,7]]},"102":{"position":[[475,8]]},"210":{"position":[[491,7],[555,7],[650,7],[718,7],[781,7],[844,7],[894,7],[958,7],[1005,7],[1289,7],[1331,7],[1376,7],[1420,7],[1468,7]]},"291":{"position":[[379,7],[416,7],[505,7],[573,7],[636,7]]},"292":{"position":[[472,7],[514,7],[589,7],[658,7],[721,7],[769,7],[817,7]]},"293":{"position":[[326,7],[369,7],[447,7],[516,7],[579,7]]},"294":{"position":[[475,8]]},"389":{"position":[[491,7],[555,7],[650,7],[718,7],[781,7],[831,7],[895,7],[942,7],[1226,7],[1268,7],[1313,7],[1357,7],[1405,7]]},"503":{"position":[[379,7],[416,7],[505,7],[573,7],[636,7]]},"504":{"position":[[472,7],[514,7],[589,7],[658,7],[721,7],[769,7],[817,7]]},"505":{"position":[[326,7],[369,7],[447,7],[516,7],[579,7]]},"506":{"position":[[475,8]]},"659":{"position":[[491,7],[555,7],[650,7],[718,7],[781,7],[831,7],[895,7],[942,7],[1226,7],[1268,7],[1313,7],[1357,7],[1405,7]]}},"keywords":{}}],["set",{"_index":660,"title":{},"content":{"22":{"position":[[937,4]]},"42":{"position":[[162,3],[1353,5]]},"51":{"position":[[153,3]]},"68":{"position":[[202,3]]},"79":{"position":[[1545,4]]},"95":{"position":[[211,7]]},"98":{"position":[[126,4]]},"99":{"position":[[159,4]]},"110":{"position":[[167,3]]},"111":{"position":[[54,3]]},"147":{"position":[[1384,3]]},"154":{"position":[[183,3]]},"162":{"position":[[1686,5],[1967,3],[2397,4]]},"163":{"position":[[1339,3]]},"168":{"position":[[1507,3]]},"178":{"position":[[914,4]]},"194":{"position":[[161,3]]},"196":{"position":[[815,3],[1119,3],[1312,5],[1353,4],[1672,3],[1696,3]]},"204":{"position":[[1113,4]]},"206":{"position":[[667,4]]},"209":{"position":[[233,4],[309,4]]},"210":{"position":[[1093,3]]},"230":{"position":[[1562,4]]},"243":{"position":[[202,3]]},"269":{"position":[[4577,4]]},"277":{"position":[[1117,3]]},"287":{"position":[[211,7]]},"290":{"position":[[126,4]]},"291":{"position":[[159,4]]},"305":{"position":[[167,3]]},"306":{"position":[[54,3]]},"321":{"position":[[1071,4]]},"323":{"position":[[2732,4]]},"324":{"position":[[200,3],[673,3],[1045,3]]},"335":{"position":[[1392,3]]},"339":{"position":[[183,3]]},"348":{"position":[[1507,3]]},"351":{"position":[[1708,5],[1989,3],[2419,4]]},"352":{"position":[[1361,3]]},"369":{"position":[[914,4]]},"388":{"position":[[233,4],[309,4]]},"389":{"position":[[1030,3]]},"393":{"position":[[142,7]]},"395":{"position":[[123,3],[1311,3],[4457,3]]},"396":{"position":[[323,3]]},"409":{"position":[[4577,4]]},"416":{"position":[[1832,3],[1946,3],[2243,7],[2281,7],[4635,3]]},"419":{"position":[[4350,3],[4464,3]]},"424":{"position":[[1063,4]]},"426":{"position":[[667,4]]},"430":{"position":[[161,3]]},"432":{"position":[[753,3],[1062,3],[1254,5],[1295,4],[1550,3],[1574,3]]},"440":{"position":[[1586,3]]},"441":{"position":[[1777,4]]},"461":{"position":[[1562,4]]},"468":{"position":[[202,3]]},"477":{"position":[[49,3]]},"499":{"position":[[211,7]]},"502":{"position":[[126,4]]},"503":{"position":[[159,4]]},"510":{"position":[[167,3]]},"511":{"position":[[54,3]]},"539":{"position":[[1071,4]]},"541":{"position":[[2732,4]]},"542":{"position":[[200,3],[673,3],[1045,3]]},"552":{"position":[[1392,3]]},"559":{"position":[[183,3]]},"564":{"position":[[1507,3]]},"567":{"position":[[1708,5],[1989,3],[2419,4]]},"568":{"position":[[1361,3]]},"585":{"position":[[914,4]]},"596":{"position":[[930,3]]},"599":{"position":[[496,3]]},"602":{"position":[[790,3],[818,3],[889,3]]},"613":{"position":[[2031,3]]},"630":{"position":[[142,7]]},"632":{"position":[[123,3],[1311,3],[4457,3]]},"633":{"position":[[323,3]]},"646":{"position":[[4577,4]]},"653":{"position":[[1832,3],[1946,3],[2243,7],[2281,7],[4635,3]]},"656":{"position":[[4350,3],[4464,3]]},"658":{"position":[[233,4],[309,4]]},"659":{"position":[[1030,3]]},"666":{"position":[[1063,4]]},"668":{"position":[[667,4]]},"677":{"position":[[161,3]]},"679":{"position":[[753,3],[1062,3],[1254,5],[1295,4],[1550,3],[1574,3]]},"687":{"position":[[1586,3]]},"688":{"position":[[1777,4]]},"699":{"position":[[49,3]]},"704":{"position":[[930,3]]},"707":{"position":[[496,3]]},"710":{"position":[[790,3],[818,3],[889,3]]},"721":{"position":[[2031,3]]}},"keywords":{}}],["set(&(*own",{"_index":2490,"title":{},"content":{"205":{"position":[[1908,18]]},"425":{"position":[[1883,18]]},"667":{"position":[[1883,18]]}},"keywords":{}}],["set(&cal",{"_index":1364,"title":{},"content":{"71":{"position":[[451,17]]},"235":{"position":[[451,17]]},"471":{"position":[[451,17]]},"476":{"position":[[1046,17]]},"698":{"position":[[1046,17]]}},"keywords":{}}],["set(&mut",{"_index":479,"title":{},"content":{"17":{"position":[[742,12]]},"147":{"position":[[1082,12]]},"178":{"position":[[669,12]]},"335":{"position":[[1090,12]]},"369":{"position":[[669,12]]},"552":{"position":[[1090,12]]},"585":{"position":[[669,12]]},"601":{"position":[[457,12],[897,12]]},"602":{"position":[[325,12]]},"709":{"position":[[457,12],[897,12]]},"710":{"position":[[325,12]]}},"keywords":{}}],["set(self.env().get_block_tim",{"_index":3239,"title":{},"content":{"416":{"position":[[2011,32]]},"419":{"position":[[4529,32]]},"653":{"position":[[2011,32]]},"656":{"position":[[4529,32]]}},"keywords":{}}],["set_admin_rol",{"_index":2266,"title":{},"content":{"185":{"position":[[3359,16]]},"376":{"position":[[3343,16]]},"592":{"position":[[3343,16]]}},"keywords":{}}],["set_admin_role(&mut",{"_index":2237,"title":{},"content":{"185":{"position":[[1626,23]]},"376":{"position":[[1610,23]]},"592":{"position":[[1610,23]]}},"keywords":{}}],["set_caller(&self",{"_index":2131,"title":{},"content":{"168":{"position":[[1565,21]]},"348":{"position":[[1565,21]]},"564":{"position":[[1565,21]]}},"keywords":{}}],["set_data",{"_index":2549,"title":{},"content":{"209":{"position":[[294,8]]},"210":{"position":[[1074,8]]},"388":{"position":[[294,8]]},"389":{"position":[[1011,8]]},"658":{"position":[[294,8]]},"659":{"position":[[1011,8]]}},"keywords":{}}],["set_data(&mut",{"_index":2560,"title":{},"content":{"209":{"position":[[1245,17]]},"388":{"position":[[1177,17]]},"658":{"position":[[1177,17]]}},"keywords":{}}],["set_exchange_rate(&mut",{"_index":1747,"title":{},"content":{"115":{"position":[[2757,26]]},"258":{"position":[[2683,26]]},"481":{"position":[[2683,26]]}},"keywords":{}}],["set_get_messag",{"_index":1086,"title":{},"content":{"42":{"position":[[2156,17]]}},"keywords":{}}],["set_messag",{"_index":1078,"title":{},"content":{"42":{"position":[[1818,13]]}},"keywords":{}}],["set_message(&mut",{"_index":490,"title":{},"content":{"17":{"position":[[1079,20]]}},"keywords":{}}],["set_value<t",{"_index":2853,"title":{},"content":{"267":{"position":[[2262,15]]},"407":{"position":[[2262,15]]},"644":{"position":[[2262,15]]}},"keywords":{}}],["set_var",{"_index":2857,"title":{},"content":{"267":{"position":[[2480,9]]},"407":{"position":[[2480,9]]},"644":{"position":[[2480,9]]}},"keywords":{}}],["set_var<t",{"_index":2851,"title":{},"content":{"267":{"position":[[2190,13]]},"407":{"position":[[2190,13]]},"644":{"position":[[2190,13]]}},"keywords":{}}],["setstatu",{"_index":1062,"title":{},"content":{"42":{"position":[[1343,9]]}},"keywords":{}}],["setstatus(str",{"_index":1053,"title":{},"content":{"42":{"position":[[1004,16]]}},"keywords":{}}],["setting."",{"_index":3040,"title":{},"content":{"323":{"position":[[3357,15]]},"541":{"position":[[3357,15]]}},"keywords":{}}],["setup",{"_index":1793,"title":{"126":{"position":[[0,6]]},"277":{"position":[[0,6]]},"439":{"position":[[0,5]]},"514":{"position":[[0,6]]},"686":{"position":[[0,5]]}},"content":{"198":{"position":[[99,7],[395,8],[622,8],[957,8],[1243,7],[1345,7],[2253,7]]},"206":{"position":[[271,7],[620,8],[1154,8],[1792,8],[2112,8],[3398,8]]},"210":{"position":[[18,5]]},"268":{"position":[[2413,8]]},"269":{"position":[[4175,7],[4530,8],[5064,8],[5702,8]]},"389":{"position":[[18,5]]},"408":{"position":[[2413,8]]},"409":{"position":[[4175,7],[4530,8],[5064,8],[5702,8]]},"426":{"position":[[271,7],[620,8],[1149,8],[1782,8],[2102,8],[3373,8]]},"434":{"position":[[99,7],[395,8],[617,8],[947,8],[1233,7],[1335,7],[2243,7]]},"645":{"position":[[2413,8]]},"646":{"position":[[4175,7],[4530,8],[5064,8],[5702,8]]},"659":{"position":[[18,5]]},"668":{"position":[[271,7],[620,8],[1154,8],[1792,8],[2112,8],[3398,8]]},"681":{"position":[[99,7],[395,8],[622,8],[957,8],[1243,7],[1345,7],[2253,7]]}},"keywords":{}}],["sever",{"_index":1414,"title":{},"content":{"76":{"position":[[150,7]]},"227":{"position":[[150,7]]},"458":{"position":[[150,7]]}},"keywords":{}}],["share",{"_index":893,"title":{},"content":{"39":{"position":[[18,5]]},"267":{"position":[[4361,7]]},"407":{"position":[[4361,7]]},"644":{"position":[[4361,7]]}},"keywords":{}}],["ship",{"_index":3720,"title":{},"content":{"602":{"position":[[118,8]]},"710":{"position":[[118,8]]}},"keywords":{}}],["short",{"_index":67,"title":{},"content":{"1":{"position":[[858,5]]},"2":{"position":[[393,5]]},"38":{"position":[[2,5]]}},"keywords":{}}],["show",{"_index":1185,"title":{"51":{"position":[[0,4]]},"53":{"position":[[0,4]]}},"content":{"52":{"position":[[965,4]]},"54":{"position":[[216,5]]},"84":{"position":[[927,4]]},"146":{"position":[[787,6]]},"147":{"position":[[1282,4]]},"253":{"position":[[927,4]]},"334":{"position":[[791,6]]},"335":{"position":[[1290,4]]},"416":{"position":[[3199,4]]},"484":{"position":[[927,4]]},"551":{"position":[[791,6]]},"552":{"position":[[1290,4]]},"653":{"position":[[3199,4]]}},"keywords":{}}],["showcas",{"_index":1479,"title":{},"content":{"80":{"position":[[23,9]]},"231":{"position":[[23,9]]},"462":{"position":[[23,9]]}},"keywords":{}}],["shown",{"_index":1173,"title":{},"content":{"44":{"position":[[55,5]]},"141":{"position":[[474,5]]},"163":{"position":[[675,5]]},"326":{"position":[[474,5]]},"352":{"position":[[697,5]]},"441":{"position":[[321,5]]},"535":{"position":[[474,5]]},"568":{"position":[[697,5]]},"688":{"position":[[321,5]]}},"keywords":{}}],["side",{"_index":1928,"title":{},"content":{"141":{"position":[[61,4]]},"326":{"position":[[61,4]]},"535":{"position":[[61,4]]},"605":{"position":[[661,4]]},"713":{"position":[[661,4]]}},"keywords":{}}],["sign",{"_index":3631,"title":{},"content":{"598":{"position":[[382,6],[444,6],[1742,6]]},"706":{"position":[[382,6],[444,6],[1742,6]]}},"keywords":{}}],["signatur",{"_index":2398,"title":{},"content":{"198":{"position":[[1331,10]]},"434":{"position":[[1321,10]]},"681":{"position":[[1331,10]]}},"keywords":{}}],["signext",{"_index":1342,"title":{},"content":{"66":{"position":[[185,7]]},"68":{"position":[[455,7]]},"241":{"position":[[185,7]]},"243":{"position":[[455,7]]},"466":{"position":[[185,7]]},"468":{"position":[[455,7]]}},"keywords":{}}],["similar",{"_index":882,"title":{},"content":{"38":{"position":[[782,8],[1083,13]]},"39":{"position":[[36,12],[1937,7]]},"101":{"position":[[15,7]]},"104":{"position":[[41,7]]},"117":{"position":[[758,7]]},"126":{"position":[[1341,7]]},"163":{"position":[[647,7]]},"164":{"position":[[285,7]]},"267":{"position":[[1969,7]]},"268":{"position":[[1512,8]]},"277":{"position":[[1509,7]]},"293":{"position":[[15,7]]},"296":{"position":[[41,7]]},"298":{"position":[[758,7]]},"352":{"position":[[669,7]]},"353":{"position":[[320,7]]},"395":{"position":[[4501,7]]},"407":{"position":[[1969,7]]},"408":{"position":[[1512,8]]},"505":{"position":[[15,7]]},"508":{"position":[[41,7]]},"514":{"position":[[1341,7]]},"519":{"position":[[758,7]]},"568":{"position":[[669,7]]},"569":{"position":[[320,7]]},"600":{"position":[[865,7]]},"612":{"position":[[1898,7]]},"613":{"position":[[1256,7],[1821,7],[1966,7]]},"617":{"position":[[1148,7]]},"632":{"position":[[4501,7]]},"644":{"position":[[1969,7]]},"645":{"position":[[1512,8]]},"708":{"position":[[865,7]]},"720":{"position":[[1898,7]]},"721":{"position":[[1256,7],[1821,7],[1966,7]]},"725":{"position":[[1148,7]]}},"keywords":{}}],["similarli",{"_index":1575,"title":{},"content":{"91":{"position":[[163,10]]},"111":{"position":[[0,9]]},"141":{"position":[[183,9]]},"147":{"position":[[304,9]]},"283":{"position":[[163,10]]},"306":{"position":[[0,9]]},"326":{"position":[[183,9]]},"335":{"position":[[304,9]]},"495":{"position":[[163,10]]},"511":{"position":[[0,9]]},"535":{"position":[[183,9]]},"552":{"position":[[304,9]]},"602":{"position":[[1851,9]]},"710":{"position":[[1851,9]]}},"keywords":{}}],["simpl",{"_index":57,"title":{},"content":{"1":{"position":[[745,6]]},"5":{"position":[[168,6]]},"17":{"position":[[1700,7]]},"22":{"position":[[1462,7]]},"30":{"position":[[27,6]]},"32":{"position":[[58,7]]},"39":{"position":[[241,6]]},"42":{"position":[[44,6]]},"44":{"position":[[88,6]]},"52":{"position":[[461,7]]},"54":{"position":[[75,6],[201,6],[303,6]]},"110":{"position":[[22,6]]},"126":{"position":[[1194,6]]},"145":{"position":[[241,6]]},"151":{"position":[[55,7]]},"162":{"position":[[1807,6]]},"185":{"position":[[2804,6]]},"195":{"position":[[655,6]]},"220":{"position":[[32,6]]},"223":{"position":[[1217,6]]},"277":{"position":[[1362,6]]},"305":{"position":[[22,6]]},"333":{"position":[[241,6]]},"342":{"position":[[55,7]]},"351":{"position":[[1829,6]]},"376":{"position":[[2788,6]]},"413":{"position":[[133,6]]},"431":{"position":[[655,6]]},"442":{"position":[[31,6]]},"453":{"position":[[32,6]]},"456":{"position":[[1217,6]]},"510":{"position":[[22,6]]},"514":{"position":[[1194,6]]},"550":{"position":[[241,6]]},"556":{"position":[[55,7]]},"567":{"position":[[1829,6]]},"592":{"position":[[2788,6]]},"596":{"position":[[19,6]]},"650":{"position":[[133,6]]},"678":{"position":[[655,6]]},"689":{"position":[[31,6]]},"693":{"position":[[32,6]]},"696":{"position":[[1217,6]]},"704":{"position":[[19,6]]}},"keywords":{}}],["simpler",{"_index":3598,"title":{},"content":{"478":{"position":[[324,8]]},"700":{"position":[[324,8]]}},"keywords":{}}],["simplest",{"_index":52,"title":{},"content":{"1":{"position":[[682,8]]},"147":{"position":[[1316,8]]},"162":{"position":[[15,8]]},"335":{"position":[[1324,8]]},"351":{"position":[[15,8]]},"552":{"position":[[1324,8]]},"567":{"position":[[15,8]]}},"keywords":{}}],["simpli",{"_index":406,"title":{},"content":{"15":{"position":[[194,6],[610,6]]},"16":{"position":[[423,6]]},"85":{"position":[[768,6]]},"96":{"position":[[78,6],[180,6]]},"120":{"position":[[106,6]]},"127":{"position":[[26,6]]},"129":{"position":[[192,6]]},"141":{"position":[[363,6]]},"174":{"position":[[197,6]]},"175":{"position":[[25,6]]},"185":{"position":[[2487,6],[3385,6]]},"247":{"position":[[1740,6]]},"254":{"position":[[768,6]]},"278":{"position":[[26,6]]},"280":{"position":[[192,6]]},"288":{"position":[[78,6],[180,6]]},"301":{"position":[[106,6]]},"326":{"position":[[363,6]]},"360":{"position":[[197,6]]},"361":{"position":[[25,6]]},"376":{"position":[[2471,6],[3369,6]]},"394":{"position":[[480,6]]},"441":{"position":[[1990,6]]},"446":{"position":[[1740,6]]},"485":{"position":[[768,6]]},"500":{"position":[[78,6],[180,6]]},"515":{"position":[[26,6]]},"517":{"position":[[192,6]]},"522":{"position":[[106,6]]},"535":{"position":[[363,6]]},"576":{"position":[[197,6]]},"577":{"position":[[25,6]]},"592":{"position":[[2471,6],[3369,6]]},"631":{"position":[[480,6]]},"673":{"position":[[1740,6]]},"688":{"position":[[1990,6]]}},"keywords":{}}],["simplic",{"_index":2651,"title":{},"content":{"212":{"position":[[2428,11],[2756,10],[3170,10]]},"391":{"position":[[2428,11],[2762,10],[3188,10]]},"416":{"position":[[2399,11]]},"653":{"position":[[2399,11]]},"661":{"position":[[2428,11],[2762,10],[3188,10]]}},"keywords":{}}],["simplifi",{"_index":2811,"title":{},"content":{"266":{"position":[[62,11]]},"406":{"position":[[62,11]]},"594":{"position":[[195,8]]},"643":{"position":[[62,11]]},"702":{"position":[[195,8]]}},"keywords":{}}],["simul",{"_index":953,"title":{},"content":{"39":{"position":[[1490,10]]}},"keywords":{}}],["singl",{"_index":1027,"title":{},"content":{"42":{"position":[[99,6],[1243,6]]},"54":{"position":[[82,6]]},"76":{"position":[[349,6],[493,6]]},"78":{"position":[[53,6]]},"79":{"position":[[1239,6]]},"81":{"position":[[201,6]]},"132":{"position":[[203,6]]},"147":{"position":[[842,6]]},"162":{"position":[[115,6]]},"185":{"position":[[2765,6]]},"193":{"position":[[88,6]]},"195":{"position":[[671,6]]},"220":{"position":[[47,6]]},"223":{"position":[[1237,6]]},"227":{"position":[[349,6],[493,6]]},"229":{"position":[[53,6]]},"230":{"position":[[1256,6]]},"232":{"position":[[201,6]]},"312":{"position":[[203,6]]},"335":{"position":[[850,6]]},"351":{"position":[[115,6]]},"376":{"position":[[2749,6]]},"429":{"position":[[88,6]]},"431":{"position":[[671,6]]},"453":{"position":[[47,6]]},"456":{"position":[[1237,6]]},"458":{"position":[[349,6],[493,6]]},"460":{"position":[[53,6]]},"461":{"position":[[1256,6]]},"463":{"position":[[201,6]]},"529":{"position":[[203,6]]},"552":{"position":[[850,6]]},"567":{"position":[[115,6]]},"592":{"position":[[2749,6]]},"596":{"position":[[823,6]]},"601":{"position":[[1921,6]]},"612":{"position":[[1374,6]]},"676":{"position":[[88,6]]},"678":{"position":[[671,6]]},"693":{"position":[[47,6]]},"696":{"position":[[1237,6]]},"704":{"position":[[823,6]]},"709":{"position":[[1921,6]]},"720":{"position":[[1374,6]]}},"keywords":{}}],["size",{"_index":1340,"title":{},"content":{"66":{"position":[[13,4]]},"212":{"position":[[1862,4],[1904,4],[1957,6],[2058,4]]},"241":{"position":[[13,4]]},"391":{"position":[[1862,4],[1904,4],[1957,6],[2058,4]]},"466":{"position":[[13,4]]},"601":{"position":[[1182,4],[1986,4]]},"661":{"position":[[1862,4],[1904,4],[1957,6],[2058,4]]},"709":{"position":[[1182,4],[1986,4]]}},"keywords":{}}],["skip",{"_index":1638,"title":{},"content":{"97":{"position":[[310,4]]},"147":{"position":[[994,4]]},"289":{"position":[[310,4]]},"335":{"position":[[1002,4]]},"416":{"position":[[4766,8]]},"501":{"position":[[310,4]]},"552":{"position":[[1002,4]]},"653":{"position":[[4766,8]]}},"keywords":{}}],["slightli",{"_index":3617,"title":{},"content":{"596":{"position":[[492,8]]},"598":{"position":[[1586,8]]},"704":{"position":[[492,8]]},"706":{"position":[[1586,8]]}},"keywords":{}}],["slower",{"_index":1780,"title":{},"content":{"119":{"position":[[573,6]]},"300":{"position":[[573,6]]},"521":{"position":[[573,6]]}},"keywords":{}}],["smaller",{"_index":2778,"title":{},"content":{"248":{"position":[[108,7]]},"447":{"position":[[108,7]]},"674":{"position":[[108,7]]}},"keywords":{}}],["smallest",{"_index":3626,"title":{},"content":{"598":{"position":[[243,8],[373,8]]},"706":{"position":[[243,8],[373,8]]}},"keywords":{}}],["smart",{"_index":17,"title":{"267":{"position":[[12,5]]},"383":{"position":[[11,5]]},"407":{"position":[[12,5]]},"625":{"position":[[11,5]]},"644":{"position":[[12,5]]}},"content":{"1":{"position":[[158,5],[426,5],[1037,5]]},"2":{"position":[[565,5]]},"5":{"position":[[138,5]]},"6":{"position":[[330,5]]},"10":{"position":[[112,5]]},"15":{"position":[[240,5],[404,5],[505,5]]},"17":{"position":[[1729,5]]},"18":{"position":[[23,5]]},"20":{"position":[[194,5],[257,5]]},"22":{"position":[[21,5],[192,5],[356,5],[422,5],[755,5]]},"38":{"position":[[39,5],[180,5],[474,5],[1043,5]]},"39":{"position":[[3331,5]]},"44":{"position":[[140,5]]},"50":{"position":[[14,5],[282,5]]},"51":{"position":[[32,5]]},"52":{"position":[[159,5],[1635,5]]},"70":{"position":[[15,5]]},"72":{"position":[[22,5]]},"81":{"position":[[397,5]]},"83":{"position":[[103,5]]},"115":{"position":[[3323,5]]},"133":{"position":[[30,5]]},"173":{"position":[[514,5]]},"174":{"position":[[71,5]]},"232":{"position":[[397,5]]},"234":{"position":[[15,5]]},"236":{"position":[[22,5]]},"248":{"position":[[59,5]]},"252":{"position":[[103,5]]},"258":{"position":[[3249,5]]},"264":{"position":[[41,5]]},"267":{"position":[[4,5]]},"268":{"position":[[25,5]]},"269":{"position":[[32,5]]},"313":{"position":[[30,5]]},"359":{"position":[[514,5]]},"360":{"position":[[71,5]]},"383":{"position":[[24,5]]},"384":{"position":[[32,5]]},"404":{"position":[[41,5]]},"407":{"position":[[4,5]]},"408":{"position":[[25,5]]},"409":{"position":[[32,5]]},"447":{"position":[[59,5]]},"463":{"position":[[397,5]]},"470":{"position":[[15,5]]},"472":{"position":[[22,5]]},"481":{"position":[[3249,5]]},"483":{"position":[[103,5]]},"530":{"position":[[30,5]]},"575":{"position":[[514,5]]},"576":{"position":[[71,5]]},"594":{"position":[[92,5],[223,5]]},"595":{"position":[[91,5]]},"596":{"position":[[116,5]]},"618":{"position":[[68,5]]},"625":{"position":[[24,5]]},"626":{"position":[[32,5]]},"641":{"position":[[41,5]]},"644":{"position":[[4,5]]},"645":{"position":[[25,5]]},"646":{"position":[[32,5]]},"674":{"position":[[59,5]]},"702":{"position":[[92,5],[223,5]]},"703":{"position":[[91,5]]},"704":{"position":[[116,5]]},"726":{"position":[[68,5]]}},"keywords":{}}],["snippet",{"_index":970,"title":{},"content":{"39":{"position":[[2189,7]]},"80":{"position":[[15,7]]},"231":{"position":[[15,7]]},"462":{"position":[[15,7]]},"596":{"position":[[87,7]]},"704":{"position":[[87,7]]}},"keywords":{}}],["solana",{"_index":604,"title":{},"content":{"20":{"position":[[796,7]]}},"keywords":{}}],["solc",{"_index":700,"title":{},"content":{"30":{"position":[[460,4],[480,4]]}},"keywords":{}}],["sold",{"_index":3355,"title":{},"content":{"440":{"position":[[468,5],[2449,4],[2719,4]]},"687":{"position":[[468,5],[2449,4],[2719,4]]}},"keywords":{}}],["sold.l46",{"_index":3417,"title":{},"content":{"440":{"position":[[3656,8]]},"687":{"position":[[3656,8]]}},"keywords":{}}],["sole",{"_index":3110,"title":{},"content":{"393":{"position":[[320,6]]},"630":{"position":[[320,6]]}},"keywords":{}}],["solid",{"_index":7,"title":{"30":{"position":[[0,9]]},"593":{"position":[[9,8]]},"701":{"position":[[9,8]]}},"content":{"1":{"position":[[34,8]]},"18":{"position":[[64,8],[328,8]]},"20":{"position":[[336,9]]},"21":{"position":[[240,9]]},"30":{"position":[[34,8]]},"38":{"position":[[530,9],[619,8],[1138,8]]},"39":{"position":[[0,8],[197,8],[256,8],[330,8],[476,8],[553,8],[606,8],[909,8],[979,8],[1046,8],[1718,8],[1763,8]]},"40":{"position":[[107,8],[323,8]]},"42":{"position":[[356,8],[837,8],[913,8],[1755,8]]},"43":{"position":[[1665,8],[1800,8]]},"91":{"position":[[193,9]]},"203":{"position":[[553,8]]},"205":{"position":[[2349,8]]},"283":{"position":[[193,9]]},"423":{"position":[[553,8]]},"425":{"position":[[2299,8]]},"495":{"position":[[193,9]]},"594":{"position":[[13,8],[333,8],[631,8]]},"596":{"position":[[523,8]]},"598":{"position":[[1610,9]]},"599":{"position":[[433,8]]},"600":{"position":[[468,8]]},"601":{"position":[[2042,9]]},"603":{"position":[[3,9]]},"608":{"position":[[744,9]]},"609":{"position":[[3,9]]},"610":{"position":[[780,8]]},"611":{"position":[[548,9]]},"612":{"position":[[3,9],[380,8],[1351,8],[1469,8]]},"613":{"position":[[1232,9],[1845,9]]},"614":{"position":[[3,9]]},"616":{"position":[[1196,9]]},"617":{"position":[[767,9],[1079,9]]},"618":{"position":[[246,8]]},"665":{"position":[[553,8]]},"667":{"position":[[2299,8]]},"702":{"position":[[13,8],[333,8],[631,8]]},"704":{"position":[[523,8]]},"706":{"position":[[1610,9]]},"707":{"position":[[433,8]]},"708":{"position":[[468,8]]},"709":{"position":[[2042,9]]},"711":{"position":[[3,9]]},"716":{"position":[[744,9]]},"717":{"position":[[3,9]]},"718":{"position":[[780,8]]},"719":{"position":[[548,9]]},"720":{"position":[[3,9],[380,8],[1351,8],[1469,8]]},"721":{"position":[[1232,9],[1845,9]]},"722":{"position":[[3,9]]},"724":{"position":[[1196,9]]},"725":{"position":[[767,9],[1079,9]]},"726":{"position":[[246,8]]}},"keywords":{}}],["solidity'",{"_index":2442,"title":{},"content":{"203":{"position":[[476,10]]},"423":{"position":[[476,10]]},"599":{"position":[[655,10]]},"606":{"position":[[572,10]]},"665":{"position":[[476,10]]},"707":{"position":[[655,10]]},"714":{"position":[[572,10]]}},"keywords":{}}],["solidity.familiar",{"_index":3609,"title":{},"content":{"595":{"position":[[52,20]]},"703":{"position":[[52,20]]}},"keywords":{}}],["solut",{"_index":53,"title":{},"content":{"1":{"position":[[691,8],[712,9]]},"163":{"position":[[1405,8]]},"352":{"position":[[1427,8]]},"568":{"position":[[1427,8]]}},"keywords":{}}],["some(*address",{"_index":2452,"title":{},"content":{"204":{"position":[[808,15]]},"267":{"position":[[1763,15]]},"269":{"position":[[2115,15],[2427,15]]},"384":{"position":[[2135,15],[2454,15]]},"407":{"position":[[1763,15]]},"409":{"position":[[2115,15],[2427,15]]},"424":{"position":[[783,15]]},"626":{"position":[[2135,15],[2454,15]]},"644":{"position":[[1763,15]]},"646":{"position":[[2115,15],[2427,15]]},"666":{"position":[[783,15]]}},"keywords":{}}],["some(*own",{"_index":2483,"title":{},"content":{"205":{"position":[[1568,13]]},"269":{"position":[[2801,13]]},"384":{"position":[[2835,13]]},"409":{"position":[[2801,13]]},"425":{"position":[[1543,13]]},"626":{"position":[[2835,13]]},"646":{"position":[[2801,13]]},"667":{"position":[[1543,13]]}},"keywords":{}}],["some(*recipi",{"_index":2484,"title":{},"content":{"205":{"position":[[1586,17]]},"269":{"position":[[2819,17]]},"384":{"position":[[2853,17]]},"409":{"position":[[2819,17]]},"425":{"position":[[1561,17]]},"626":{"position":[[2853,17]]},"646":{"position":[[2819,17]]},"667":{"position":[[1561,17]]}},"keywords":{}}],["some(_",{"_index":497,"title":{},"content":{"17":{"position":[[1261,7]]}},"keywords":{}}],["some(addr",{"_index":3909,"title":{},"content":{"617":{"position":[[320,10]]},"725":{"position":[[320,10]]}},"keywords":{}}],["some(address",{"_index":2352,"title":{},"content":{"197":{"position":[[109,13]]},"433":{"position":[[109,13]]},"680":{"position":[[109,13]]}},"keywords":{}}],["some(admin",{"_index":2225,"title":{},"content":{"185":{"position":[[769,11]]},"376":{"position":[[753,11]]},"592":{"position":[[753,11]]}},"keywords":{}}],["some(boo",{"_index":3698,"title":{},"content":{"601":{"position":[[985,11]]},"709":{"position":[[985,11]]}},"keywords":{}}],["some(cal",{"_index":2932,"title":{},"content":{"269":{"position":[[985,13]]},"384":{"position":[[998,13]]},"409":{"position":[[985,13]]},"441":{"position":[[3613,12]]},"626":{"position":[[998,13]]},"646":{"position":[[985,13]]},"688":{"position":[[3613,12]]}},"keywords":{}}],["some(current_own",{"_index":2359,"title":{},"content":{"197":{"position":[[444,20]]},"433":{"position":[[444,20]]},"680":{"position":[[444,20]]}},"keywords":{}}],["some(env.get_account(0",{"_index":2510,"title":{},"content":{"206":{"position":[[1012,25]]},"269":{"position":[[4922,25]]},"409":{"position":[[4922,25]]},"426":{"position":[[1007,25]]},"646":{"position":[[4922,25]]},"668":{"position":[[1012,25]]}},"keywords":{}}],["some(i",{"_index":3691,"title":{},"content":{"601":{"position":[[529,9]]},"709":{"position":[[529,9]]}},"keywords":{}}],["some(initial_suppli",{"_index":1823,"title":{},"content":{"126":{"position":[[2396,20]]},"269":{"position":[[778,20]]},"277":{"position":[[2564,20]]},"384":{"position":[[791,20]]},"409":{"position":[[778,20]]},"514":{"position":[[2396,20]]},"626":{"position":[[791,20]]},"646":{"position":[[778,20]]}},"keywords":{}}],["some(initial_supply.into",{"_index":2906,"title":{},"content":{"268":{"position":[[1302,27]]},"269":{"position":[[4394,27]]},"408":{"position":[[1302,27]]},"409":{"position":[[4394,27]]},"645":{"position":[[1302,27]]},"646":{"position":[[4394,27]]}},"keywords":{}}],["some(mut",{"_index":3737,"title":{},"content":{"602":{"position":[[1453,8],[1608,8]]},"710":{"position":[[1453,8],[1608,8]]}},"keywords":{}}],["some(own",{"_index":2361,"title":{},"content":{"197":{"position":[[573,11]]},"198":{"position":[[850,12]]},"206":{"position":[[3185,12]]},"268":{"position":[[3291,12]]},"408":{"position":[[3291,12]]},"426":{"position":[[3160,12]]},"433":{"position":[[573,11]]},"434":{"position":[[840,12]]},"645":{"position":[[3291,12]]},"668":{"position":[[3185,12]]},"680":{"position":[[573,11]]},"681":{"position":[[850,12]]}},"keywords":{}}],["some(recipi",{"_index":2520,"title":{},"content":{"206":{"position":[[1682,16],[3202,16]]},"268":{"position":[[3308,16]]},"269":{"position":[[5592,16]]},"408":{"position":[[3308,16]]},"409":{"position":[[5592,16]]},"426":{"position":[[1672,16],[3177,16]]},"645":{"position":[[3308,16]]},"646":{"position":[[5592,16]]},"668":{"position":[[1682,16],[3202,16]]}},"keywords":{}}],["some(send",{"_index":2519,"title":{},"content":{"206":{"position":[[1664,13]]},"269":{"position":[[5574,13]]},"409":{"position":[[5574,13]]},"426":{"position":[[1654,13]]},"646":{"position":[[5574,13]]},"668":{"position":[[1664,13]]}},"keywords":{}}],["some(vot",{"_index":3257,"title":{},"content":{"416":{"position":[[4052,10]]},"419":{"position":[[5631,10]]},"653":{"position":[[4052,10]]},"656":{"position":[[5631,10]]}},"keywords":{}}],["some_function(&self",{"_index":3917,"title":{},"content":{"617":{"position":[[694,24]]},"725":{"position":[[694,24]]}},"keywords":{}}],["someon",{"_index":1937,"title":{},"content":{"141":{"position":[[776,7]]},"326":{"position":[[776,7]]},"394":{"position":[[427,7]]},"535":{"position":[[776,7]]},"631":{"position":[[427,7]]}},"keywords":{}}],["someone'",{"_index":2173,"title":{},"content":{"182":{"position":[[304,9]]},"184":{"position":[[1255,9]]},"373":{"position":[[304,9]]},"375":{"position":[[1152,9]]},"589":{"position":[[304,9]]},"591":{"position":[[1152,9]]}},"keywords":{}}],["someth",{"_index":192,"title":{},"content":{"5":{"position":[[380,9]]},"92":{"position":[[672,9]]},"146":{"position":[[760,9]]},"284":{"position":[[672,9]]},"334":{"position":[[764,9]]},"496":{"position":[[672,9]]},"551":{"position":[[764,9]]}},"keywords":{}}],["sometim",{"_index":1936,"title":{},"content":{"141":{"position":[[716,9]]},"142":{"position":[[0,9]]},"326":{"position":[[716,9]]},"327":{"position":[[0,9]]},"535":{"position":[[716,9]]},"536":{"position":[[0,9]]}},"keywords":{}}],["somewher",{"_index":376,"title":{},"content":{"11":{"position":[[263,10]]},"141":{"position":[[1201,10]]},"326":{"position":[[1201,10]]},"535":{"position":[[1201,10]]}},"keywords":{}}],["soon",{"_index":422,"title":{},"content":{"15":{"position":[[533,4]]}},"keywords":{}}],["sooo",{"_index":210,"title":{},"content":{"6":{"position":[[225,7]]}},"keywords":{}}],["sorri",{"_index":1271,"title":{},"content":{"52":{"position":[[1892,6]]}},"keywords":{}}],["sourc",{"_index":25,"title":{},"content":{"1":{"position":[[248,6]]},"12":{"position":[[323,6]]},"17":{"position":[[95,6],[165,6]]},"18":{"position":[[123,6]]},"22":{"position":[[313,7]]},"43":{"position":[[632,6],[1674,6]]},"117":{"position":[[914,6]]},"298":{"position":[[914,6]]},"519":{"position":[[914,6]]}},"keywords":{}}],["source_file_path",{"_index":1040,"title":{},"content":{"42":{"position":[[614,17]]}},"keywords":{}}],["source_key",{"_index":3461,"title":{},"content":{"440":{"position":[[6331,11]]},"687":{"position":[[6331,11]]}},"keywords":{}}],["spdx",{"_index":1046,"title":{},"content":{"42":{"position":[[877,4]]}},"keywords":{}}],["speak",{"_index":937,"title":{},"content":{"39":{"position":[[1019,8]]},"416":{"position":[[3291,8]]},"653":{"position":[[3291,8]]}},"keywords":{}}],["special",{"_index":1692,"title":{},"content":{"103":{"position":[[622,7]]},"295":{"position":[[622,7]]},"507":{"position":[[622,7]]}},"keywords":{}}],["specif",{"_index":259,"title":{},"content":{"9":{"position":[[61,8]]},"103":{"position":[[393,8]]},"120":{"position":[[302,8]]},"121":{"position":[[412,8]]},"126":{"position":[[2826,8]]},"145":{"position":[[78,8]]},"267":{"position":[[133,8]]},"268":{"position":[[130,8]]},"277":{"position":[[2994,8]]},"295":{"position":[[393,8]]},"301":{"position":[[302,8]]},"302":{"position":[[412,8]]},"322":{"position":[[126,8]]},"333":{"position":[[78,8]]},"407":{"position":[[133,8]]},"408":{"position":[[130,8]]},"507":{"position":[[393,8]]},"514":{"position":[[2826,8]]},"522":{"position":[[302,8]]},"523":{"position":[[412,8]]},"540":{"position":[[126,8]]},"550":{"position":[[78,8]]},"618":{"position":[[694,8]]},"644":{"position":[[133,8]]},"645":{"position":[[130,8]]},"726":{"position":[[694,8]]}},"keywords":{}}],["specifi",{"_index":271,"title":{},"content":{"9":{"position":[[332,9]]},"98":{"position":[[306,9]]},"126":{"position":[[2101,7]]},"184":{"position":[[725,7]]},"265":{"position":[[67,7]]},"277":{"position":[[2269,7]]},"290":{"position":[[306,9]]},"324":{"position":[[423,9]]},"375":{"position":[[644,7]]},"405":{"position":[[67,7]]},"502":{"position":[[306,9]]},"514":{"position":[[2101,7]]},"542":{"position":[[423,9]]},"591":{"position":[[644,7]]},"602":{"position":[[637,9]]},"605":{"position":[[278,7]]},"609":{"position":[[70,7]]},"642":{"position":[[67,7]]},"710":{"position":[[637,9]]},"713":{"position":[[278,7]]},"717":{"position":[[70,7]]}},"keywords":{}}],["speed",{"_index":1700,"title":{},"content":{"107":{"position":[[518,6]]},"274":{"position":[[518,6]]},"491":{"position":[[518,6]]}},"keywords":{}}],["spend",{"_index":202,"title":{},"content":{"6":{"position":[[111,5]]},"202":{"position":[[286,5]]},"419":{"position":[[2796,6],[2911,5]]},"422":{"position":[[286,5]]},"656":{"position":[[2796,6],[2911,5]]},"664":{"position":[[286,5]]}},"keywords":{}}],["spend_allowance(&mut",{"_index":2485,"title":{},"content":{"205":{"position":[[1629,24]]},"269":{"position":[[2862,24]]},"384":{"position":[[2896,24]]},"409":{"position":[[2862,24]]},"425":{"position":[[1604,24]]},"626":{"position":[[2896,24]]},"646":{"position":[[2862,24]]},"667":{"position":[[1604,24]]}},"keywords":{}}],["spender",{"_index":544,"title":{},"content":{"17":{"position":[[3723,8],[3822,9],[3886,8],[3958,9]]},"115":{"position":[[763,8],[1053,8]]},"205":{"position":[[557,7],[716,8],[826,10],[887,8],[896,9],[1086,8],[1167,10],[1681,8],[1763,9],[1927,10],[2002,8],[2011,9],[2141,8]]},"206":{"position":[[2144,8],[2377,8],[2603,8],[2644,7],[3063,8],[3460,8]]},"247":{"position":[[718,8],[782,8],[1099,8]]},"258":{"position":[[741,8],[1007,8]]},"268":{"position":[[2434,8],[3169,8]]},"269":{"position":[[1303,7],[1462,8],[1572,10],[1633,8],[1642,9],[1832,8],[1913,10],[2914,8],[3019,11],[3141,10],[3210,8],[3219,9],[3580,8]]},"384":{"position":[[1316,7],[1475,8],[1585,10],[1646,8],[1655,9],[1852,8],[1933,10],[2948,8],[3053,11],[3182,10],[3251,8],[3260,9],[3566,8]]},"408":{"position":[[2434,8],[3169,8]]},"409":{"position":[[1303,7],[1462,8],[1572,10],[1633,8],[1642,9],[1832,8],[1913,10],[2914,8],[3019,11],[3141,10],[3210,8],[3219,9],[3580,8]]},"419":{"position":[[2785,7],[2848,8],[2900,7],[2995,8],[3073,7],[3139,8],[3218,7],[3284,8]]},"425":{"position":[[532,7],[691,8],[801,10],[862,8],[871,9],[1061,8],[1142,10],[1656,8],[1738,9],[1902,10],[1977,8],[1986,9],[2092,8]]},"426":{"position":[[2134,8],[2367,8],[2588,8],[2629,7],[3043,8],[3435,8]]},"446":{"position":[[718,8],[782,8],[1099,8]]},"481":{"position":[[741,8],[1007,8]]},"626":{"position":[[1316,7],[1475,8],[1585,10],[1646,8],[1655,9],[1852,8],[1933,10],[2948,8],[3053,11],[3182,10],[3251,8],[3260,9],[3566,8]]},"645":{"position":[[2434,8],[3169,8]]},"646":{"position":[[1303,7],[1462,8],[1572,10],[1633,8],[1642,9],[1832,8],[1913,10],[2914,8],[3019,11],[3141,10],[3210,8],[3219,9],[3580,8]]},"656":{"position":[[2785,7],[2848,8],[2900,7],[2995,8],[3073,7],[3139,8],[3218,7],[3284,8]]},"667":{"position":[[532,7],[691,8],[801,10],[862,8],[871,9],[1061,8],[1142,10],[1656,8],[1738,9],[1902,10],[1977,8],[1986,9],[2092,8]]},"668":{"position":[[2144,8],[2377,8],[2603,8],[2644,7],[3063,8],[3460,8]]},"673":{"position":[[718,8],[782,8],[1099,8]]}},"keywords":{}}],["spender'",{"_index":2543,"title":{},"content":{"206":{"position":[[3419,9]]},"419":{"position":[[3517,9]]},"426":{"position":[[3394,9]]},"656":{"position":[[3517,9]]},"668":{"position":[[3419,9]]}},"keywords":{}}],["spin",{"_index":1779,"title":{},"content":{"119":{"position":[[440,4]]},"300":{"position":[[440,4]]},"521":{"position":[[440,4]]}},"keywords":{}}],["split",{"_index":1021,"title":{},"content":{"40":{"position":[[336,6]]}},"keywords":{}}],["sputnik",{"_index":726,"title":{},"content":{"31":{"position":[[417,8]]}},"keywords":{}}],["sputnik'",{"_index":721,"title":{},"content":{"31":{"position":[[345,9]]}},"keywords":{}}],["sputnikvm",{"_index":712,"title":{},"content":{"31":{"position":[[18,10]]},"33":{"position":[[164,9]]}},"keywords":{}}],["sqrt",{"_index":3854,"title":{},"content":{"613":{"position":[[1575,4]]},"721":{"position":[[1575,4]]}},"keywords":{}}],["sqrt(i",{"_index":3829,"title":{},"content":{"613":{"position":[[126,7]]},"721":{"position":[[126,7]]}},"keywords":{}}],["squar",{"_index":3853,"title":{},"content":{"613":{"position":[[1394,6]]},"721":{"position":[[1394,6]]}},"keywords":{}}],["src",{"_index":1098,"title":{"133":{"position":[[0,5]]},"313":{"position":[[0,5]]},"530":{"position":[[0,5]]}},"content":{"42":{"position":[[2690,3]]},"175":{"position":[[227,3]]},"183":{"position":[[19,3]]},"361":{"position":[[227,3]]},"374":{"position":[[19,3]]},"577":{"position":[[227,3]]},"590":{"position":[[19,3]]}},"keywords":{}}],["src/contract.r",{"_index":2966,"title":{},"content":{"321":{"position":[[437,15]]},"539":{"position":[[437,15]]}},"keywords":{}}],["src/counter.r",{"_index":1772,"title":{},"content":{"118":{"position":[[141,14]]},"299":{"position":[[141,14]]},"520":{"position":[[141,14]]}},"keywords":{}}],["src/erc20.r",{"_index":2926,"title":{},"content":{"269":{"position":[[99,12]]},"384":{"position":[[99,12]]},"409":{"position":[[99,12]]},"626":{"position":[[99,12]]},"646":{"position":[[99,12]]}},"keywords":{}}],["src/flipper.r",{"_index":1895,"title":{},"content":{"132":{"position":[[293,15]]},"312":{"position":[[293,15]]},"529":{"position":[[293,15]]}},"keywords":{}}],["src/lib.r",{"_index":1067,"title":{},"content":{"42":{"position":[[1439,10]]},"118":{"position":[[214,10]]},"299":{"position":[[214,10]]},"520":{"position":[[214,10]]}},"keywords":{}}],["src/main.rs:116:5",{"_index":2681,"title":{},"content":{"212":{"position":[[4450,19]]},"391":{"position":[[4468,19]]},"661":{"position":[[4468,19]]}},"keywords":{}}],["src/main.rs:117:5",{"_index":2687,"title":{},"content":{"212":{"position":[[4645,19]]},"391":{"position":[[4663,19]]},"661":{"position":[[4663,19]]}},"keywords":{}}],["src/main.rs:118:5",{"_index":2690,"title":{},"content":{"212":{"position":[[4697,19]]},"391":{"position":[[4715,19]]},"661":{"position":[[4715,19]]}},"keywords":{}}],["src/main.rs:119:5",{"_index":2692,"title":{},"content":{"212":{"position":[[4771,19]]},"391":{"position":[[4789,19]]},"661":{"position":[[4789,19]]}},"keywords":{}}],["src/status_message.sol",{"_index":1045,"title":{},"content":{"42":{"position":[[851,22]]}},"keywords":{}}],["src/test.r",{"_index":1083,"title":{},"content":{"42":{"position":[[2010,11]]}},"keywords":{}}],["src/tests.r",{"_index":3437,"title":{},"content":{"440":{"position":[[4790,12]]},"441":{"position":[[4536,12]]},"687":{"position":[[4790,12]]},"688":{"position":[[4536,12]]}},"keywords":{}}],["src/ticket_operator.r",{"_index":3475,"title":{},"content":{"441":{"position":[[520,22]]},"688":{"position":[[520,22]]}},"keywords":{}}],["src/token.r",{"_index":3207,"title":{},"content":{"414":{"position":[[184,12]]},"416":{"position":[[356,12],[1357,12],[2615,12],[3434,12]]},"417":{"position":[[116,12]]},"419":{"position":[[50,12]]},"440":{"position":[[99,12]]},"441":{"position":[[2228,12]]},"651":{"position":[[184,12]]},"653":{"position":[[356,12],[1357,12],[2615,12],[3434,12]]},"654":{"position":[[116,12]]},"656":{"position":[[50,12]]},"687":{"position":[[99,12]]},"688":{"position":[[2228,12]]}},"keywords":{}}],["stack",{"_index":1618,"title":{},"content":{"94":{"position":[[209,6],[419,5]]},"286":{"position":[[209,6],[419,5]]},"498":{"position":[[209,6],[419,5]]}},"keywords":{}}],["stackexecutor::new_with_precompiles(st",{"_index":784,"title":{},"content":{"31":{"position":[[2205,42]]}},"keywords":{}}],["stacksubstatemetadata::new(u64::max",{"_index":779,"title":{},"content":{"31":{"position":[[2041,36]]}},"keywords":{}}],["stage",{"_index":1172,"title":{},"content":{"44":{"position":[[17,5]]}},"keywords":{}}],["stake",{"_index":3216,"title":{},"content":{"416":{"position":[[141,7],[3141,8]]},"417":{"position":[[696,7],[1040,5]]},"419":{"position":[[7111,7],[7455,5]]},"653":{"position":[[141,7],[3141,8]]},"654":{"position":[[696,7],[1040,5]]},"656":{"position":[[7111,7],[7455,5]]}},"keywords":{}}],["standalon",{"_index":1175,"title":{},"content":{"44":{"position":[[211,10]]},"196":{"position":[[776,10]]},"199":{"position":[[115,10]]},"221":{"position":[[431,10]]},"432":{"position":[[713,10]]},"435":{"position":[[115,10]]},"454":{"position":[[431,10]]},"679":{"position":[[713,10]]},"682":{"position":[[115,10]]},"694":{"position":[[431,10]]}},"keywords":{}}],["standard",{"_index":82,"title":{},"content":{"1":{"position":[[1010,8]]},"22":{"position":[[706,15]]},"38":{"position":[[758,8]]},"79":{"position":[[160,8]]},"91":{"position":[[253,8],[476,9],[827,9]]},"100":{"position":[[18,8]]},"138":{"position":[[1149,8]]},"184":{"position":[[131,8]]},"188":{"position":[[45,9],[107,9],[501,9]]},"198":{"position":[[2369,8]]},"200":{"position":[[47,9]]},"219":{"position":[[92,8]]},"230":{"position":[[160,8]]},"268":{"position":[[2313,8]]},"283":{"position":[[253,8],[476,9],[827,9]]},"292":{"position":[[18,8]]},"318":{"position":[[1141,8]]},"365":{"position":[[51,8],[133,9],[241,8],[314,9],[402,9],[464,9],[858,9]]},"375":{"position":[[131,8]]},"382":{"position":[[22,12]]},"396":{"position":[[487,8]]},"408":{"position":[[2313,8]]},"416":{"position":[[457,9]]},"419":{"position":[[828,9]]},"434":{"position":[[2359,8]]},"436":{"position":[[47,9]]},"442":{"position":[[72,9]]},"452":{"position":[[92,8]]},"461":{"position":[[160,8]]},"495":{"position":[[253,8],[476,9],[827,9]]},"504":{"position":[[18,8]]},"544":{"position":[[1141,8]]},"581":{"position":[[51,8],[133,9],[241,8],[314,9],[402,9],[464,9],[858,9]]},"591":{"position":[[131,8]]},"618":{"position":[[610,8]]},"624":{"position":[[22,12]]},"633":{"position":[[487,8]]},"645":{"position":[[2313,8]]},"653":{"position":[[457,9]]},"656":{"position":[[828,9]]},"681":{"position":[[2369,8]]},"683":{"position":[[47,9]]},"689":{"position":[[72,9]]},"692":{"position":[[92,8]]},"726":{"position":[[610,8]]}},"keywords":{}}],["standard.l3",{"_index":3319,"title":{},"content":{"424":{"position":[[1032,11]]},"666":{"position":[[1032,11]]}},"keywords":{}}],["standard.l8",{"_index":2453,"title":{},"content":{"204":{"position":[[1081,11]]}},"keywords":{}}],["standard.ownership",{"_index":3336,"title":{},"content":{"438":{"position":[[90,18]]},"685":{"position":[[90,18]]}},"keywords":{}}],["start",{"_index":92,"title":{},"content":{"2":{"position":[[49,5],[130,8],[250,6],[469,7],[604,8]]},"11":{"position":[[257,5]]},"22":{"position":[[1496,5]]},"23":{"position":[[29,9]]},"26":{"position":[[63,5]]},"28":{"position":[[63,5]]},"31":{"position":[[113,5]]},"36":{"position":[[63,5]]},"46":{"position":[[63,5]]},"48":{"position":[[63,5]]},"52":{"position":[[210,5]]},"57":{"position":[[63,5]]},"59":{"position":[[63,5]]},"61":{"position":[[64,5]]},"63":{"position":[[64,5]]},"107":{"position":[[468,6]]},"168":{"position":[[1999,5]]},"173":{"position":[[3,5]]},"182":{"position":[[10,5]]},"198":{"position":[[1158,6],[1628,8]]},"214":{"position":[[64,5]]},"216":{"position":[[64,5]]},"218":{"position":[[19,5]]},"225":{"position":[[64,5]]},"262":{"position":[[39,5]]},"274":{"position":[[468,6]]},"348":{"position":[[1999,5]]},"359":{"position":[[3,5]]},"373":{"position":[[10,5]]},"380":{"position":[[39,5]]},"402":{"position":[[39,5]]},"414":{"position":[[6,5],[85,8]]},"417":{"position":[[454,6]]},"419":{"position":[[6869,6]]},"434":{"position":[[1148,6],[1618,8]]},"440":{"position":[[6,5]]},"449":{"position":[[64,5]]},"451":{"position":[[19,5]]},"491":{"position":[[468,6]]},"564":{"position":[[1999,5]]},"575":{"position":[[3,5]]},"589":{"position":[[10,5]]},"596":{"position":[[6,5]]},"622":{"position":[[39,5]]},"639":{"position":[[39,5]]},"651":{"position":[[6,5],[85,8]]},"654":{"position":[[454,6]]},"656":{"position":[[6869,6]]},"681":{"position":[[1158,6],[1628,8]]},"687":{"position":[[6,5]]},"691":{"position":[[19,5]]},"704":{"position":[[6,5]]}},"keywords":{}}],["state",{"_index":760,"title":{"208":{"position":[[27,5]]},"212":{"position":[[12,6]]},"387":{"position":[[27,5]]},"391":{"position":[[12,6]]},"597":{"position":[[21,5]]},"657":{"position":[[27,5]]},"661":{"position":[[12,6]]},"705":{"position":[[21,5]]}},"content":{"31":{"position":[[1338,5],[1369,5],[2018,7],[2096,5]]},"52":{"position":[[1629,5],[2145,6]]},"71":{"position":[[368,6]]},"72":{"position":[[290,5]]},"79":{"position":[[464,6]]},"81":{"position":[[77,6]]},"83":{"position":[[296,6]]},"91":{"position":[[300,5]]},"107":{"position":[[65,6],[217,5],[340,5],[369,5]]},"128":{"position":[[99,6],[142,5],[257,5],[373,6],[617,5]]},"146":{"position":[[468,5]]},"184":{"position":[[1152,7]]},"195":{"position":[[678,5]]},"197":{"position":[[1266,5]]},"211":{"position":[[12,5]]},"212":{"position":[[890,7]]},"218":{"position":[[80,5],[167,5],[200,6]]},"221":{"position":[[19,5],[588,6],[792,5]]},"222":{"position":[[54,6],[474,5],[542,6]]},"223":{"position":[[251,5]]},"230":{"position":[[481,6]]},"232":{"position":[[77,6]]},"235":{"position":[[368,6]]},"236":{"position":[[290,5]]},"252":{"position":[[296,6]]},"274":{"position":[[65,6],[217,5],[340,5],[369,5]]},"279":{"position":[[99,6],[142,5],[257,5],[373,6],[617,5]]},"283":{"position":[[300,5]]},"334":{"position":[[472,5]]},"375":{"position":[[1049,7]]},"390":{"position":[[12,5]]},"391":{"position":[[890,7]]},"431":{"position":[[678,5]]},"433":{"position":[[1265,5]]},"451":{"position":[[80,5],[167,5],[200,6]]},"454":{"position":[[19,5],[588,6],[792,5]]},"455":{"position":[[54,6],[474,5],[542,6]]},"456":{"position":[[251,5]]},"461":{"position":[[481,6]]},"463":{"position":[[77,6]]},"471":{"position":[[368,6]]},"472":{"position":[[290,5]]},"476":{"position":[[963,6]]},"483":{"position":[[296,6]]},"491":{"position":[[65,6],[217,5],[340,5],[369,5]]},"495":{"position":[[300,5]]},"516":{"position":[[99,6],[142,5],[257,5],[373,6],[617,5]]},"551":{"position":[[472,5]]},"591":{"position":[[1049,7]]},"596":{"position":[[710,5],[830,5],[1046,5]]},"600":{"position":[[513,5],[569,5],[919,5]]},"602":{"position":[[739,5]]},"604":{"position":[[493,5]]},"605":{"position":[[408,5],[447,6],[597,6]]},"607":{"position":[[14,5]]},"613":{"position":[[1299,5]]},"660":{"position":[[12,5]]},"661":{"position":[[890,7]]},"678":{"position":[[678,5]]},"680":{"position":[[1265,5]]},"691":{"position":[[80,5],[167,5],[200,6]]},"694":{"position":[[19,5],[588,6],[792,5]]},"695":{"position":[[54,6],[474,5],[542,6]]},"696":{"position":[[251,5]]},"698":{"position":[[963,6]]},"704":{"position":[[710,5],[830,5],[1046,5]]},"708":{"position":[[513,5],[569,5],[919,5]]},"710":{"position":[[739,5]]},"712":{"position":[[493,5]]},"713":{"position":[[408,5],[447,6],[597,6]]},"715":{"position":[[14,5]]},"721":{"position":[[1299,5]]}},"keywords":{}}],["state.insert",{"_index":765,"title":{},"content":{"31":{"position":[[1438,13],[1732,13]]}},"keywords":{}}],["state.queri",{"_index":1275,"title":{},"content":{"52":{"position":[[2111,11]]}},"keywords":{}}],["state_root_hash",{"_index":2625,"title":{},"content":{"212":{"position":[[691,15],[835,16],[1016,16]]},"391":{"position":[[691,15],[835,16],[1016,16]]},"661":{"position":[[691,15],[835,16],[1016,16]]}},"keywords":{}}],["statement",{"_index":968,"title":{},"content":{"39":{"position":[[2162,11]]},"198":{"position":[[1288,9]]},"267":{"position":[[258,10]]},"407":{"position":[[258,10]]},"434":{"position":[[1278,9]]},"617":{"position":[[886,9],[1066,9],[1264,9]]},"644":{"position":[[258,10]]},"681":{"position":[[1288,9]]},"725":{"position":[[886,9],[1066,9],[1264,9]]}},"keywords":{}}],["static",{"_index":910,"title":{},"content":{"39":{"position":[[453,6]]}},"keywords":{}}],["statu",{"_index":1025,"title":{"42":{"position":[[0,6]]}},"content":{"42":{"position":[[219,6],[238,6],[1028,7],[1106,7],[2671,6]]},"396":{"position":[[1176,6]]},"398":{"position":[[195,6]]},"440":{"position":[[552,7],[2092,7],[3426,6],[4526,6]]},"602":{"position":[[89,6],[193,7],[278,6],[344,7],[352,7]]},"633":{"position":[[1176,6]]},"635":{"position":[[195,6]]},"687":{"position":[[552,7],[2092,7],[3426,6],[4526,6]]},"710":{"position":[[89,6],[193,7],[278,6],[344,7],[352,7]]}},"keywords":{}}],["status_messag",{"_index":1069,"title":{},"content":{"42":{"position":[[1454,15],[1617,14]]}},"keywords":{}}],["status_message.sol",{"_index":1099,"title":{},"content":{"42":{"position":[[2713,18]]}},"keywords":{}}],["status_message::{statusmessag",{"_index":1070,"title":{},"content":{"42":{"position":[[1478,31]]}},"keywords":{}}],["statusmessag",{"_index":1051,"title":{},"content":{"42":{"position":[[940,13]]}},"keywords":{}}],["statusmessagedeploy",{"_index":1071,"title":{},"content":{"42":{"position":[[1510,22],[1904,21]]}},"keywords":{}}],["statusmessagedeployer::default",{"_index":1087,"title":{},"content":{"42":{"position":[[2195,33],[2451,33]]}},"keywords":{}}],["statusmessageref",{"_index":1072,"title":{},"content":{"42":{"position":[[1533,18]]}},"keywords":{}}],["stay",{"_index":955,"title":{},"content":{"39":{"position":[[1626,5]]}},"keywords":{}}],["stay.w",{"_index":130,"title":{},"content":{"3":{"position":[[144,7]]}},"keywords":{}}],["std::fs::read(evm_calc_path).unwrap",{"_index":840,"title":{},"content":{"32":{"position":[[1187,38]]}},"keywords":{}}],["std::fs::read(multiply_path",{"_index":268,"title":{},"content":{"9":{"position":[[252,28]]}},"keywords":{}}],["std::io::write::write(&mut",{"_index":2677,"title":{},"content":{"212":{"position":[[4250,30]]},"391":{"position":[[4268,30]]},"661":{"position":[[4268,30]]}},"keywords":{}}],["std::str::fromstr",{"_index":3121,"title":{},"content":{"395":{"position":[[350,18]]},"632":{"position":[[350,18]]}},"keywords":{}}],["step",{"_index":62,"title":{"263":{"position":[[13,6]]},"381":{"position":[[13,6]]},"403":{"position":[[13,6]]},"623":{"position":[[13,6]]},"640":{"position":[[13,6]]}},"content":{"1":{"position":[[809,5]]},"10":{"position":[[21,5]]},"32":{"position":[[494,4]]},"38":{"position":[[1119,4]]},"39":{"position":[[248,6],[419,6],[1679,4],[3175,4]]},"40":{"position":[[50,4]]},"43":{"position":[[740,5]]},"44":{"position":[[95,6]]},"65":{"position":[[657,4]]},"66":{"position":[[262,4]]},"174":{"position":[[414,5]]},"185":{"position":[[12,8]]},"189":{"position":[[636,4]]},"196":{"position":[[1411,4]]},"211":{"position":[[87,4]]},"240":{"position":[[657,4]]},"241":{"position":[[262,4]]},"270":{"position":[[67,6]]},"360":{"position":[[414,5]]},"366":{"position":[[636,4]]},"376":{"position":[[12,8]]},"385":{"position":[[67,6]]},"390":{"position":[[87,4]]},"410":{"position":[[67,6]]},"416":{"position":[[3344,4]]},"432":{"position":[[1353,4]]},"465":{"position":[[657,4]]},"466":{"position":[[262,4]]},"576":{"position":[[414,5]]},"582":{"position":[[636,4]]},"592":{"position":[[12,8]]},"627":{"position":[[67,6]]},"647":{"position":[[67,6]]},"653":{"position":[[3344,4]]},"660":{"position":[[87,4]]},"679":{"position":[[1353,4]]}},"keywords":{}}],["step.add",{"_index":2804,"title":{},"content":{"265":{"position":[[217,8]]},"405":{"position":[[217,8]]},"642":{"position":[[217,8]]}},"keywords":{}}],["steroid",{"_index":2547,"title":{},"content":{"207":{"position":[[83,9]]},"427":{"position":[[83,9]]},"669":{"position":[[83,9]]}},"keywords":{}}],["still",{"_index":675,"title":{},"content":{"23":{"position":[[55,5],[279,5]]},"54":{"position":[[165,5]]}},"keywords":{}}],["stop",{"_index":1606,"title":{},"content":{"93":{"position":[[18,4]]},"182":{"position":[[371,5]]},"190":{"position":[[54,4]]},"218":{"position":[[141,4]]},"221":{"position":[[883,5]]},"285":{"position":[[18,4]]},"367":{"position":[[54,4]]},"373":{"position":[[371,5]]},"451":{"position":[[141,4]]},"454":{"position":[[883,5]]},"497":{"position":[[18,4]]},"583":{"position":[[54,4]]},"589":{"position":[[371,5]]},"611":{"position":[[801,5]]},"691":{"position":[[141,4]]},"694":{"position":[[883,5]]},"719":{"position":[[801,5]]}},"keywords":{}}],["storag",{"_index":654,"title":{"75":{"position":[[9,7]]},"77":{"position":[[9,7]]},"82":{"position":[[0,7]]},"161":{"position":[[0,7]]},"211":{"position":[[0,7]]},"226":{"position":[[9,7]]},"228":{"position":[[9,7]]},"251":{"position":[[0,7]]},"350":{"position":[[0,7]]},"390":{"position":[[0,7]]},"457":{"position":[[9,7]]},"459":{"position":[[9,7]]},"482":{"position":[[0,7]]},"566":{"position":[[0,7]]},"597":{"position":[[9,7]]},"660":{"position":[[0,7]]},"705":{"position":[[9,7]]}},"content":{"22":{"position":[[614,8]]},"31":{"position":[[1601,8],[1895,8]]},"54":{"position":[[241,8]]},"76":{"position":[[67,7],[115,7],[194,8],[616,7],[951,7]]},"78":{"position":[[73,7]]},"79":{"position":[[34,7]]},"80":{"position":[[86,7]]},"81":{"position":[[9,7]]},"83":{"position":[[45,7]]},"84":{"position":[[102,7],[178,7],[734,7],[865,7],[943,7]]},"86":{"position":[[27,8]]},"91":{"position":[[643,7]]},"110":{"position":[[297,7]]},"145":{"position":[[275,8]]},"146":{"position":[[821,7]]},"147":{"position":[[1333,7]]},"149":{"position":[[48,7]]},"162":{"position":[[24,7],[144,8],[2024,8],[2341,8]]},"163":{"position":[[1188,7]]},"164":{"position":[[468,9],[988,8]]},"178":{"position":[[873,8]]},"185":{"position":[[2589,7]]},"196":{"position":[[1281,8]]},"197":{"position":[[1355,8]]},"201":{"position":[[87,7]]},"202":{"position":[[48,7]]},"209":{"position":[[36,7]]},"211":{"position":[[61,7],[131,7],[811,7],[846,7]]},"220":{"position":[[11,7]]},"227":{"position":[[67,7],[115,7],[194,8],[616,7],[951,7]]},"229":{"position":[[73,7]]},"230":{"position":[[34,7]]},"231":{"position":[[86,7]]},"232":{"position":[[9,7]]},"246":{"position":[[346,7]]},"252":{"position":[[45,7]]},"253":{"position":[[102,7],[178,7],[734,7],[865,7],[943,7]]},"255":{"position":[[27,8]]},"283":{"position":[[643,7]]},"305":{"position":[[297,7]]},"333":{"position":[[275,8]]},"334":{"position":[[825,7]]},"335":{"position":[[1341,7]]},"337":{"position":[[48,7]]},"351":{"position":[[24,7],[144,8],[2046,8],[2363,8]]},"352":{"position":[[1210,7]]},"353":{"position":[[503,9],[1023,8]]},"369":{"position":[[873,8]]},"376":{"position":[[2573,7]]},"388":{"position":[[36,7]]},"390":{"position":[[61,7],[131,7],[785,7],[820,7]]},"416":{"position":[[234,8]]},"421":{"position":[[87,7]]},"422":{"position":[[48,7]]},"432":{"position":[[1223,8]]},"433":{"position":[[1354,8]]},"440":{"position":[[3523,8]]},"445":{"position":[[346,7]]},"453":{"position":[[11,7]]},"458":{"position":[[67,7],[115,7],[194,8],[616,7],[951,7]]},"460":{"position":[[73,7]]},"461":{"position":[[34,7]]},"462":{"position":[[86,7]]},"463":{"position":[[9,7]]},"483":{"position":[[45,7]]},"484":{"position":[[102,7],[178,7],[734,7],[865,7],[943,7]]},"486":{"position":[[27,8]]},"495":{"position":[[643,7]]},"510":{"position":[[297,7]]},"550":{"position":[[275,8]]},"551":{"position":[[825,7]]},"552":{"position":[[1341,7]]},"554":{"position":[[48,7]]},"567":{"position":[[24,7],[144,8],[2046,8],[2363,8]]},"568":{"position":[[1210,7]]},"569":{"position":[[503,9],[1023,8]]},"585":{"position":[[873,8]]},"592":{"position":[[2573,7]]},"603":{"position":[[153,8],[255,7],[339,8]]},"653":{"position":[[234,8]]},"658":{"position":[[36,7]]},"660":{"position":[[61,7],[131,7],[785,7],[820,7]]},"663":{"position":[[87,7]]},"664":{"position":[[48,7]]},"672":{"position":[[346,7]]},"679":{"position":[[1223,8]]},"680":{"position":[[1354,8]]},"687":{"position":[[3523,8]]},"693":{"position":[[11,7]]},"711":{"position":[[153,8],[255,7],[339,8]]}},"keywords":{}}],["storage.th",{"_index":1190,"title":{},"content":{"51":{"position":[[239,11]]}},"keywords":{}}],["storageinfo",{"_index":979,"title":{},"content":{"39":{"position":[[2376,11]]}},"keywords":{}}],["store",{"_index":305,"title":{},"content":{"9":{"position":[[1189,5],[1360,5],[1524,5]]},"10":{"position":[[239,6]]},"42":{"position":[[90,6],[1271,6]]},"51":{"position":[[113,5]]},"52":{"position":[[996,5],[1039,5],[1802,7],[2285,5],[2313,5],[3115,7]]},"76":{"position":[[269,5],[341,5],[396,5],[485,7],[635,6],[808,7]]},"78":{"position":[[44,6]]},"81":{"position":[[179,5],[274,5]]},"83":{"position":[[179,7],[241,7],[343,6]]},"84":{"position":[[405,5],[827,6]]},"86":{"position":[[13,6]]},"91":{"position":[[371,6],[522,6],[735,6]]},"92":{"position":[[209,6]]},"94":{"position":[[520,5],[669,6]]},"126":{"position":[[316,5]]},"145":{"position":[[233,7]]},"146":{"position":[[179,5]]},"162":{"position":[[97,6]]},"163":{"position":[[23,5],[219,5],[550,7]]},"165":{"position":[[19,5]]},"178":{"position":[[193,5]]},"185":{"position":[[2653,6]]},"193":{"position":[[78,7]]},"202":{"position":[[115,5]]},"203":{"position":[[392,5]]},"209":{"position":[[65,6],[160,6]]},"211":{"position":[[756,6]]},"212":{"position":[[1622,5],[1737,5],[1846,6],[1927,5],[2139,5],[3766,6]]},"227":{"position":[[269,5],[341,5],[396,5],[485,7],[635,6],[808,7]]},"229":{"position":[[44,6]]},"232":{"position":[[179,5],[274,5]]},"252":{"position":[[179,7],[241,7],[343,6]]},"253":{"position":[[405,5],[827,6]]},"255":{"position":[[13,6]]},"277":{"position":[[316,5]]},"283":{"position":[[371,6],[522,6],[735,6]]},"284":{"position":[[209,6]]},"286":{"position":[[520,5],[669,6]]},"333":{"position":[[233,7]]},"334":{"position":[[179,5]]},"351":{"position":[[97,6]]},"352":{"position":[[23,5],[219,5],[572,7]]},"354":{"position":[[19,5]]},"369":{"position":[[193,5]]},"376":{"position":[[2637,6]]},"388":{"position":[[65,6],[160,6]]},"390":{"position":[[730,6]]},"391":{"position":[[1622,5],[1737,5],[1846,6],[1927,5],[2139,5],[3784,6]]},"416":{"position":[[259,5],[1190,5]]},"422":{"position":[[115,5]]},"423":{"position":[[392,5]]},"429":{"position":[[78,7]]},"440":{"position":[[1988,5],[3895,6],[4177,6]]},"441":{"position":[[1702,6],[2645,5],[3809,6]]},"458":{"position":[[269,5],[341,5],[396,5],[485,7],[635,6],[808,7]]},"460":{"position":[[44,6]]},"463":{"position":[[179,5],[274,5]]},"483":{"position":[[179,7],[241,7],[343,6]]},"484":{"position":[[405,5],[827,6]]},"486":{"position":[[13,6]]},"495":{"position":[[371,6],[522,6],[735,6]]},"496":{"position":[[209,6]]},"498":{"position":[[520,5],[669,6]]},"514":{"position":[[316,5]]},"550":{"position":[[233,7]]},"551":{"position":[[179,5]]},"567":{"position":[[97,6]]},"568":{"position":[[23,5],[219,5],[572,7]]},"570":{"position":[[19,5]]},"585":{"position":[[193,5]]},"592":{"position":[[2637,6]]},"596":{"position":[[136,6],[858,6]]},"598":{"position":[[1973,5],[2003,6]]},"600":{"position":[[589,6],[695,6]]},"601":{"position":[[1887,7],[2251,5]]},"603":{"position":[[85,6],[314,6]]},"613":{"position":[[2208,6]]},"653":{"position":[[259,5],[1190,5]]},"658":{"position":[[65,6],[160,6]]},"660":{"position":[[730,6]]},"661":{"position":[[1622,5],[1737,5],[1846,6],[1927,5],[2139,5],[3784,6]]},"664":{"position":[[115,5]]},"665":{"position":[[392,5]]},"676":{"position":[[78,7]]},"687":{"position":[[1988,5],[3895,6],[4177,6]]},"688":{"position":[[1702,6],[2645,5],[3809,6]]},"704":{"position":[[136,6],[858,6]]},"706":{"position":[[1973,5],[2003,6]]},"708":{"position":[[589,6],[695,6]]},"709":{"position":[[1887,7],[2251,5]]},"711":{"position":[[85,6],[314,6]]},"721":{"position":[[2208,6]]}},"keywords":{}}],["stored.odra_cfg_allow_key_overrid",{"_index":1642,"title":{},"content":{"98":{"position":[[238,34]]},"290":{"position":[[238,34]]},"502":{"position":[[238,34]]}},"keywords":{}}],["stored_valu",{"_index":2635,"title":{},"content":{"212":{"position":[[1212,14]]},"391":{"position":[[1212,14]]},"661":{"position":[[1212,14]]}},"keywords":{}}],["storedvalue::clvalue(cl_valu",{"_index":2637,"title":{},"content":{"212":{"position":[[1273,30]]},"391":{"position":[[1273,30]]},"661":{"position":[[1273,30]]}},"keywords":{}}],["straightforward",{"_index":1074,"title":{},"content":{"42":{"position":[[1588,16]]},"43":{"position":[[707,16]]},"84":{"position":[[162,15]]},"145":{"position":[[34,16]]},"165":{"position":[[124,16]]},"184":{"position":[[1107,15]]},"189":{"position":[[255,15]]},"253":{"position":[[162,15]]},"333":{"position":[[34,16]]},"354":{"position":[[124,16]]},"366":{"position":[[255,15]]},"375":{"position":[[1004,15]]},"416":{"position":[[26,16]]},"439":{"position":[[38,16]]},"484":{"position":[[162,15]]},"550":{"position":[[34,16]]},"570":{"position":[[124,16]]},"582":{"position":[[255,15]]},"591":{"position":[[1004,15]]},"653":{"position":[[26,16]]},"686":{"position":[[38,16]]}},"keywords":{}}],["straightforwardli",{"_index":1608,"title":{},"content":{"93":{"position":[[44,17]]},"285":{"position":[[44,17]]},"497":{"position":[[44,17]]}},"keywords":{}}],["stranger",{"_index":3603,"title":{},"content":{"594":{"position":[[4,8]]},"702":{"position":[[4,8]]}},"keywords":{}}],["stream",{"_index":1011,"title":{},"content":{"39":{"position":[[3242,6]]}},"keywords":{}}],["streamlin",{"_index":1523,"title":{},"content":{"84":{"position":[[91,10]]},"253":{"position":[[91,10]]},"484":{"position":[[91,10]]}},"keywords":{}}],["strength",{"_index":3301,"title":{},"content":{"419":{"position":[[1850,9],[1899,8]]},"656":{"position":[[1850,9],[1899,8]]}},"keywords":{}}],["string",{"_index":304,"title":{},"content":{"9":{"position":[[1178,6],[1349,6],[1513,6]]},"10":{"position":[[1021,6],[1251,6]]},"17":{"position":[[1131,7],[1464,6],[2269,7],[2285,7]]},"31":{"position":[[744,6],[894,6],[2766,7]]},"32":{"position":[[77,6],[389,6],[1566,6]]},"42":{"position":[[143,6],[978,7],[1174,7]]},"43":{"position":[[253,6]]},"79":{"position":[[204,7],[703,8],[737,8],[885,7],[999,7],[1024,6],[1039,6],[1327,7]]},"80":{"position":[[316,8],[565,7],[582,7],[749,7],[766,7]]},"83":{"position":[[365,7]]},"84":{"position":[[354,6]]},"98":{"position":[[164,6]]},"103":{"position":[[223,6]]},"115":{"position":[[366,7],[382,7],[825,7],[864,7],[2209,7],[2225,7]]},"162":{"position":[[823,7],[1113,6]]},"163":{"position":[[503,6],[828,7],[973,7]]},"164":{"position":[[585,7],[647,6]]},"165":{"position":[[77,8],[256,7]]},"204":{"position":[[96,7],[112,7],[343,6],[412,6]]},"209":{"position":[[600,7],[621,7],[990,7],[1011,7],[1287,7],[1302,7]]},"212":{"position":[[499,7],[520,7],[657,7],[3848,6]]},"230":{"position":[[204,7],[720,8],[754,8],[902,7],[1016,7],[1041,6],[1056,6],[1344,7]]},"231":{"position":[[316,8],[565,7],[582,7],[749,7],[766,7]]},"247":{"position":[[131,7],[147,7],[346,6],[406,6]]},"252":{"position":[[365,7]]},"253":{"position":[[354,6]]},"258":{"position":[[356,7],[372,7],[799,7],[834,7],[2155,7],[2171,7]]},"269":{"position":[[587,7],[601,7],[1702,6]]},"290":{"position":[[164,6]]},"295":{"position":[[223,6]]},"321":{"position":[[1147,7],[1367,7],[1743,7],[2078,7],[2214,7]]},"351":{"position":[[845,7],[1135,6]]},"352":{"position":[[525,6],[850,7],[995,7]]},"353":{"position":[[620,7],[682,6]]},"354":{"position":[[77,8],[294,7]]},"383":{"position":[[380,7]]},"384":{"position":[[600,7],[614,7],[1715,6]]},"388":{"position":[[561,7],[582,7],[922,7],[943,7],[1219,7],[1234,7]]},"391":{"position":[[499,7],[520,7],[657,7],[3866,6]]},"409":{"position":[[587,7],[601,7],[1702,6]]},"414":{"position":[[396,7],[431,7]]},"419":{"position":[[1396,7],[1412,7],[2374,7],[2446,7]]},"424":{"position":[[71,7],[87,7],[318,6],[387,6]]},"440":{"position":[[531,7],[651,7],[1194,7],[1221,7],[1661,7]]},"441":{"position":[[2873,7]]},"446":{"position":[[131,7],[147,7],[346,6],[406,6]]},"461":{"position":[[204,7],[720,8],[754,8],[902,7],[1016,7],[1041,6],[1056,6],[1344,7]]},"462":{"position":[[316,8],[565,7],[582,7],[749,7],[766,7]]},"481":{"position":[[356,7],[372,7],[799,7],[834,7],[2155,7],[2171,7]]},"483":{"position":[[365,7]]},"484":{"position":[[354,6]]},"502":{"position":[[164,6]]},"507":{"position":[[223,6]]},"539":{"position":[[1147,7],[1367,7],[1743,7],[2078,7],[2214,7]]},"567":{"position":[[845,7],[1135,6]]},"568":{"position":[[525,6],[850,7],[995,7]]},"569":{"position":[[620,7],[682,6]]},"570":{"position":[[77,8],[294,7]]},"596":{"position":[[343,7],[408,6]]},"602":{"position":[[1018,7],[1321,7],[1436,7]]},"610":{"position":[[104,7]]},"612":{"position":[[545,6],[692,6],[839,6],[1009,6],[1166,6],[1324,6]]},"616":{"position":[[218,7],[1000,7]]},"625":{"position":[[380,7]]},"626":{"position":[[600,7],[614,7],[1715,6]]},"646":{"position":[[587,7],[601,7],[1702,6]]},"651":{"position":[[396,7],[431,7]]},"656":{"position":[[1396,7],[1412,7],[2374,7],[2446,7]]},"658":{"position":[[561,7],[582,7],[922,7],[943,7],[1219,7],[1234,7]]},"661":{"position":[[499,7],[520,7],[657,7],[3866,6]]},"666":{"position":[[71,7],[87,7],[318,6],[387,6]]},"673":{"position":[[131,7],[147,7],[346,6],[406,6]]},"687":{"position":[[531,7],[651,7],[1194,7],[1221,7],[1661,7]]},"688":{"position":[[2873,7]]},"704":{"position":[[343,7],[408,6]]},"710":{"position":[[1018,7],[1321,7],[1436,7]]},"718":{"position":[[104,7]]},"720":{"position":[[545,6],[692,6],[839,6],[1009,6],[1166,6],[1324,6]]},"724":{"position":[[218,7],[1000,7]]}},"keywords":{}}],["string>",{"_index":474,"title":{},"content":{"17":{"position":[[584,10]]},"79":{"position":[[746,11]]},"230":{"position":[[763,11]]},"461":{"position":[[763,11]]}},"keywords":{}}],["string::from("ok"",{"_index":358,"title":{},"content":{"10":{"position":[[1358,29]]}},"keywords":{}}],["string::from("ot"",{"_index":3152,"title":{},"content":{"395":{"position":[[1893,29]]},"632":{"position":[[1893,29]]}},"keywords":{}}],["string::from("ourtoken"",{"_index":3151,"title":{},"content":{"395":{"position":[[1844,35]]},"632":{"position":[[1844,35]]}},"keywords":{}}],["string::from("plascoin"",{"_index":1814,"title":{},"content":{"126":{"position":[[1894,35]]},"277":{"position":[[2062,35]]},"514":{"position":[[1894,35]]}},"keywords":{}}],["string::from("pls"",{"_index":1815,"title":{},"content":{"126":{"position":[[1943,30]]},"277":{"position":[[2111,30]]},"514":{"position":[[1943,30]]}},"keywords":{}}],["string::from_bytes(&bytes).unwrap",{"_index":2641,"title":{},"content":{"212":{"position":[[1668,40],[1790,40]]},"391":{"position":[[1668,40],[1790,40]]},"661":{"position":[[1668,40],[1790,40]]}},"keywords":{}}],["string::new",{"_index":1094,"title":{},"content":{"42":{"position":[[2497,14]]}},"keywords":{}}],["strip",{"_index":1341,"title":{},"content":{"66":{"position":[[61,5],[78,5]]},"68":{"position":[[416,5]]},"241":{"position":[[61,5],[78,5]]},"243":{"position":[[416,5]]},"466":{"position":[[61,5],[78,5]]},"468":{"position":[[416,5]]}},"keywords":{}}],["strong",{"_index":898,"title":{},"content":{"39":{"position":[[121,6]]}},"keywords":{}}],["struct",{"_index":339,"title":{"146":{"position":[[0,7]]},"334":{"position":[[0,7]]},"551":{"position":[[0,7]]}},"content":{"10":{"position":[[719,6]]},"17":{"position":[[431,6],[1959,6]]},"22":{"position":[[1094,6]]},"39":{"position":[[656,6],[1896,6],[1988,6]]},"51":{"position":[[493,6],[1174,6],[1287,6]]},"73":{"position":[[20,6]]},"78":{"position":[[182,6]]},"79":{"position":[[685,6]]},"80":{"position":[[233,6]]},"84":{"position":[[133,6],[218,6],[564,6]]},"85":{"position":[[26,8]]},"91":{"position":[[759,6]]},"115":{"position":[[212,6],[2014,6]]},"141":{"position":[[1365,6]]},"146":{"position":[[48,6],[131,6],[393,6],[439,6]]},"147":{"position":[[321,7]]},"162":{"position":[[351,6]]},"163":{"position":[[381,6],[1607,6]]},"164":{"position":[[174,6]]},"165":{"position":[[233,6],[337,6]]},"178":{"position":[[63,6],[145,6]]},"184":{"position":[[315,6],[439,6],[563,6]]},"185":{"position":[[378,6]]},"195":{"position":[[108,6],[279,6]]},"196":{"position":[[449,6],[1438,7],[1450,6]]},"203":{"position":[[137,6]]},"204":{"position":[[891,6]]},"205":{"position":[[2099,6]]},"209":{"position":[[576,6],[709,6],[821,6],[1517,6],[1637,6]]},"212":{"position":[[475,6],[598,6]]},"219":{"position":[[426,6],[508,6]]},"220":{"position":[[193,6]]},"223":{"position":[[336,6]]},"229":{"position":[[182,6]]},"230":{"position":[[702,6]]},"231":{"position":[[233,6]]},"237":{"position":[[20,6]]},"246":{"position":[[223,6]]},"253":{"position":[[133,6],[218,6],[564,6]]},"254":{"position":[[26,8]]},"258":{"position":[[202,6],[1960,6]]},"267":{"position":[[938,6],[1084,6],[1591,6],[3340,6]]},"269":{"position":[[305,6],[3394,6],[3538,6]]},"283":{"position":[[759,6]]},"321":{"position":[[933,6],[1642,6],[1723,6],[1967,6],[2055,6],[2095,6],[2191,6]]},"324":{"position":[[536,7],[588,6]]},"326":{"position":[[1365,6]]},"334":{"position":[[48,6],[131,6],[393,6],[443,6]]},"335":{"position":[[321,7]]},"351":{"position":[[388,6]]},"352":{"position":[[403,6],[1629,6]]},"353":{"position":[[209,6]]},"354":{"position":[[271,6],[393,7],[674,6]]},"369":{"position":[[63,6],[145,6]]},"375":{"position":[[282,6],[382,6],[482,6]]},"376":{"position":[[362,6]]},"383":{"position":[[357,6],[713,6],[1113,6]]},"384":{"position":[[318,6],[3404,6],[3524,6]]},"388":{"position":[[537,6],[641,6],[753,6],[1449,6],[1569,6]]},"391":{"position":[[475,6],[598,6]]},"407":{"position":[[938,6],[1084,6],[1591,6],[3340,6]]},"409":{"position":[[305,6],[3394,6],[3538,6]]},"414":{"position":[[217,6],[578,6],[757,6],[794,6]]},"416":{"position":[[348,7],[389,6],[813,6]]},"419":{"position":[[225,6],[678,6],[761,6]]},"423":{"position":[[137,6]]},"424":{"position":[[842,6]]},"425":{"position":[[2050,6]]},"431":{"position":[[108,6],[279,6]]},"432":{"position":[[386,6],[1380,7],[1392,6]]},"440":{"position":[[499,6],[595,6],[693,6],[978,6],[3457,6]]},"441":{"position":[[774,6],[2366,6]]},"445":{"position":[[223,6]]},"452":{"position":[[381,6],[439,6]]},"453":{"position":[[193,6]]},"456":{"position":[[336,6]]},"460":{"position":[[182,6]]},"461":{"position":[[702,6]]},"462":{"position":[[233,6]]},"473":{"position":[[20,6]]},"476":{"position":[[253,6],[1743,6],[1842,6]]},"481":{"position":[[202,6],[1960,6]]},"484":{"position":[[133,6],[218,6],[564,6]]},"485":{"position":[[26,8]]},"495":{"position":[[759,6]]},"535":{"position":[[1365,6]]},"539":{"position":[[933,6],[1642,6],[1723,6],[1967,6],[2055,6],[2095,6],[2191,6]]},"542":{"position":[[536,7],[588,6]]},"551":{"position":[[48,6],[131,6],[393,6],[443,6]]},"552":{"position":[[321,7]]},"567":{"position":[[388,6]]},"568":{"position":[[403,6],[1629,6]]},"569":{"position":[[209,6]]},"570":{"position":[[271,6],[393,7],[674,6]]},"585":{"position":[[63,6],[145,6]]},"591":{"position":[[282,6],[382,6],[482,6]]},"592":{"position":[[362,6]]},"596":{"position":[[225,6],[589,6],[679,6],[810,6]]},"598":{"position":[[170,6]]},"599":{"position":[[98,6]]},"600":{"position":[[82,6]]},"601":{"position":[[83,6],[645,6],[1160,6]]},"602":{"position":[[179,6],[998,6],[1065,6],[1878,7],[1942,6]]},"605":{"position":[[48,6]]},"606":{"position":[[48,6]]},"608":{"position":[[107,6]]},"610":{"position":[[65,6],[133,6],[170,6],[513,7],[575,6],[742,6]]},"611":{"position":[[178,6]]},"612":{"position":[[482,6],[604,6],[751,6],[898,6],[1055,6],[1212,6],[1963,7],[2018,6]]},"613":{"position":[[330,6],[854,6]]},"616":{"position":[[132,6],[527,6]]},"617":{"position":[[88,6],[628,6]]},"625":{"position":[[357,6],[713,6],[1113,6]]},"626":{"position":[[318,6],[3404,6],[3524,6]]},"644":{"position":[[938,6],[1084,6],[1591,6],[3340,6]]},"646":{"position":[[305,6],[3394,6],[3538,6]]},"651":{"position":[[217,6],[578,6],[757,6],[794,6]]},"653":{"position":[[348,7],[389,6],[813,6]]},"656":{"position":[[225,6],[678,6],[761,6]]},"658":{"position":[[537,6],[641,6],[753,6],[1449,6],[1569,6]]},"661":{"position":[[475,6],[598,6]]},"665":{"position":[[137,6]]},"666":{"position":[[842,6]]},"667":{"position":[[2050,6]]},"672":{"position":[[223,6]]},"678":{"position":[[108,6],[279,6]]},"679":{"position":[[386,6],[1380,7],[1392,6]]},"687":{"position":[[499,6],[595,6],[693,6],[978,6],[3457,6]]},"688":{"position":[[774,6],[2366,6]]},"692":{"position":[[381,6],[439,6]]},"693":{"position":[[193,6]]},"696":{"position":[[336,6]]},"698":{"position":[[253,6],[1743,6],[1842,6]]},"704":{"position":[[225,6],[589,6],[679,6],[810,6]]},"706":{"position":[[170,6]]},"707":{"position":[[98,6]]},"708":{"position":[[82,6]]},"709":{"position":[[83,6],[645,6],[1160,6]]},"710":{"position":[[179,6],[998,6],[1065,6],[1878,7],[1942,6]]},"713":{"position":[[48,6]]},"714":{"position":[[48,6]]},"716":{"position":[[107,6]]},"718":{"position":[[65,6],[133,6],[170,6],[513,7],[575,6],[742,6]]},"719":{"position":[[178,6]]},"720":{"position":[[482,6],[604,6],[751,6],[898,6],[1055,6],[1212,6],[1963,7],[2018,6]]},"721":{"position":[[330,6],[854,6]]},"724":{"position":[[132,6],[527,6]]},"725":{"position":[[88,6],[628,6]]}},"keywords":{}}],["structur",{"_index":905,"title":{"130":{"position":[[10,9]]},"183":{"position":[[8,10]]},"310":{"position":[[10,9]]},"374":{"position":[[8,10]]},"527":{"position":[[10,9]]},"590":{"position":[[8,10]]}},"content":{"39":{"position":[[296,10]]},"76":{"position":[[298,10]]},"84":{"position":[[310,9]]},"115":{"position":[[3180,10]]},"227":{"position":[[298,10]]},"253":{"position":[[310,9]]},"258":{"position":[[3106,10]]},"267":{"position":[[295,11],[4448,9]]},"407":{"position":[[295,11],[4448,9]]},"440":{"position":[[3337,10]]},"458":{"position":[[298,10]]},"481":{"position":[[3106,10]]},"484":{"position":[[310,9]]},"618":{"position":[[130,10]]},"644":{"position":[[295,11],[4448,9]]},"687":{"position":[[3337,10]]},"726":{"position":[[130,10]]}},"keywords":{}}],["style",{"_index":420,"title":{},"content":{"15":{"position":[[456,6]]}},"keywords":{}}],["sub",{"_index":3210,"title":{},"content":{"414":{"position":[[327,3]]},"416":{"position":[[413,3]]},"651":{"position":[[327,3]]},"653":{"position":[[413,3]]}},"keywords":{}}],["subject",{"_index":2196,"title":{},"content":{"184":{"position":[[897,7]]},"375":{"position":[[816,7]]},"591":{"position":[[816,7]]}},"keywords":{}}],["submodul",{"_index":1470,"title":{},"content":{"79":{"position":[[1412,10]]},"115":{"position":[[166,11]]},"209":{"position":[[122,9],[145,9],[453,10],[791,9],[1448,9],[1491,9],[1596,9]]},"230":{"position":[[1429,10]]},"267":{"position":[[3231,10]]},"321":{"position":[[764,10],[888,10]]},"388":{"position":[[122,9],[145,9],[443,10],[723,9],[1380,9],[1423,9],[1528,9]]},"407":{"position":[[3231,10]]},"419":{"position":[[121,10],[785,9],[1673,10]]},"440":{"position":[[187,10]]},"461":{"position":[[1429,10]]},"539":{"position":[[764,10],[888,10]]},"607":{"position":[[266,9]]},"612":{"position":[[450,11]]},"644":{"position":[[3231,10]]},"656":{"position":[[121,10],[785,9],[1673,10]]},"658":{"position":[[122,9],[145,9],[443,10],[723,9],[1380,9],[1423,9],[1528,9]]},"687":{"position":[[187,10]]},"715":{"position":[[266,9]]},"720":{"position":[[450,11]]}},"keywords":{}}],["submodule<...>",{"_index":1534,"title":{},"content":{"85":{"position":[[198,23]]},"254":{"position":[[198,23]]},"485":{"position":[[198,23]]}},"keywords":{}}],["submodule<a>",{"_index":3814,"title":{},"content":{"612":{"position":[[618,18],[765,18],[1226,19]]},"720":{"position":[[618,18],[765,18],[1226,19]]}},"keywords":{}}],["submodule<b>",{"_index":3817,"title":{},"content":{"612":{"position":[[912,19],[1069,19],[1249,19]]},"720":{"position":[[912,19],[1069,19],[1249,19]]}},"keywords":{}}],["submodule<c>",{"_index":3818,"title":{},"content":{"612":{"position":[[935,18],[1092,18]]},"720":{"position":[[935,18],[1092,18]]}},"keywords":{}}],["submodule<cep18>",{"_index":3209,"title":{},"content":{"414":{"position":[[241,23]]},"416":{"position":[[474,23]]},"419":{"position":[[845,23]]},"651":{"position":[[241,23]]},"653":{"position":[[474,23]]},"656":{"position":[[845,23]]}},"keywords":{}}],["submodule<cep78>",{"_index":3370,"title":{},"content":{"440":{"position":[[1007,23]]},"687":{"position":[[1007,23]]}},"keywords":{}}],["submodule<data>",{"_index":2555,"title":{},"content":{"209":{"position":[[899,21]]},"388":{"position":[[831,21]]},"658":{"position":[[831,21]]}},"keywords":{}}],["submodule<erc20>",{"_index":1718,"title":{},"content":{"115":{"position":[[274,22],[2078,23]]},"246":{"position":[[285,22]]},"258":{"position":[[264,22],[2024,23]]},"445":{"position":[[285,22]]},"481":{"position":[[264,22],[2024,23]]},"672":{"position":[[285,22]]}},"keywords":{}}],["submodule<erc721base>",{"_index":2880,"title":{},"content":{"267":{"position":[[3367,28]]},"407":{"position":[[3367,28]]},"644":{"position":[[3367,28]]}},"keywords":{}}],["submodule<erc721metadataextension>",{"_index":2881,"title":{},"content":{"267":{"position":[[3406,41]]},"407":{"position":[[3406,41]]},"644":{"position":[[3406,41]]}},"keywords":{}}],["submodule<exchange>",{"_index":1742,"title":{},"content":{"115":{"position":[[2112,25]]},"258":{"position":[[2058,25]]},"481":{"position":[[2058,25]]}},"keywords":{}}],["submodule<innerdata>",{"_index":2565,"title":{},"content":{"209":{"position":[[1561,27]]},"388":{"position":[[1493,27]]},"658":{"position":[[1493,27]]}},"keywords":{}}],["submodule<ownable>",{"_index":1717,"title":{},"content":{"115":{"position":[[241,25],[2045,25]]},"246":{"position":[[252,25]]},"258":{"position":[[231,25],[1991,25]]},"267":{"position":[[3457,24]]},"407":{"position":[[3457,24]]},"440":{"position":[[1040,25]]},"445":{"position":[[252,25]]},"481":{"position":[[231,25],[1991,25]]},"644":{"position":[[3457,24]]},"672":{"position":[[252,25]]},"687":{"position":[[1040,25]]}},"keywords":{}}],["submodule<pausable>",{"_index":2735,"title":{},"content":{"223":{"position":[[395,25]]},"456":{"position":[[395,25]]},"696":{"position":[[395,25]]}},"keywords":{}}],["submodule<t>",{"_index":1474,"title":{},"content":{"79":{"position":[[1522,18]]},"230":{"position":[[1539,18]]},"461":{"position":[[1539,18]]}},"keywords":{}}],["submodule<token>",{"_index":1531,"title":{},"content":{"84":{"position":[[588,23],[623,23]]},"253":{"position":[[588,23],[623,23]]},"484":{"position":[[588,23],[623,23]]}},"keywords":{}}],["subsequ",{"_index":1559,"title":{},"content":{"86":{"position":[[114,12]]},"255":{"position":[[114,12]]},"477":{"position":[[3873,13]]},"486":{"position":[[114,12]]},"699":{"position":[[3873,13]]}},"keywords":{}}],["substanti",{"_index":1505,"title":{},"content":{"83":{"position":[[187,11]]},"119":{"position":[[146,13]]},"252":{"position":[[187,11]]},"300":{"position":[[146,13]]},"483":{"position":[[187,11]]},"521":{"position":[[146,13]]}},"keywords":{}}],["subtl",{"_index":2768,"title":{},"content":{"247":{"position":[[1578,11]]},"446":{"position":[[1578,11]]},"673":{"position":[[1578,11]]}},"keywords":{}}],["subtleti",{"_index":2374,"title":{},"content":{"197":{"position":[[1511,9]]},"433":{"position":[[1510,9]]},"680":{"position":[[1510,9]]}},"keywords":{}}],["succe",{"_index":3454,"title":{},"content":{"440":{"position":[[5847,8]]},"687":{"position":[[5847,8]]}},"keywords":{}}],["succeed",{"_index":790,"title":{},"content":{"31":{"position":[[2665,10]]}},"keywords":{}}],["success",{"_index":3914,"title":{},"content":{"617":{"position":[[518,10],[1211,7]]},"725":{"position":[[518,10],[1211,7]]}},"keywords":{}}],["successfulli",{"_index":301,"title":{},"content":{"9":{"position":[[1125,12]]},"52":{"position":[[3102,12]]},"120":{"position":[[166,13]]},"127":{"position":[[496,12]]},"278":{"position":[[496,12]]},"301":{"position":[[166,13]]},"395":{"position":[[4963,12],[5630,12],[6089,12],[6609,12]]},"398":{"position":[[6,12]]},"477":{"position":[[2879,12],[3362,12],[3743,12],[3817,12]]},"515":{"position":[[496,12]]},"522":{"position":[[166,13]]},"632":{"position":[[4963,12],[5630,12],[6089,12],[6609,12]]},"635":{"position":[[6,12]]},"699":{"position":[[2879,12],[3362,12],[3743,12],[3817,12]]}},"keywords":{}}],["succinct",{"_index":1734,"title":{},"content":{"115":{"position":[[1541,12]]},"258":{"position":[[1487,12]]},"481":{"position":[[1487,12]]}},"keywords":{}}],["such",{"_index":876,"title":{},"content":{"38":{"position":[[671,4]]},"43":{"position":[[664,4],[1957,4]]},"72":{"position":[[216,4]]},"79":{"position":[[187,5],[1319,4]]},"103":{"position":[[742,4]]},"163":{"position":[[1268,4]]},"201":{"position":[[128,4]]},"205":{"position":[[78,4]]},"230":{"position":[[187,5],[1336,4]]},"236":{"position":[[216,4]]},"295":{"position":[[742,4]]},"352":{"position":[[1290,4]]},"421":{"position":[[128,4]]},"425":{"position":[[78,4]]},"461":{"position":[[187,5],[1336,4]]},"472":{"position":[[216,4]]},"507":{"position":[[742,4]]},"568":{"position":[[1290,4]]},"609":{"position":[[261,4]]},"663":{"position":[[128,4]]},"667":{"position":[[78,4]]},"717":{"position":[[261,4]]}},"keywords":{}}],["sugar",{"_index":2458,"title":{},"content":{"204":{"position":[[1487,5]]},"424":{"position":[[1437,5]]},"666":{"position":[[1437,5]]}},"keywords":{}}],["suit",{"_index":1561,"title":{},"content":{"88":{"position":[[34,4]]},"250":{"position":[[34,4]]},"488":{"position":[[34,4]]}},"keywords":{}}],["sum",{"_index":1876,"title":{},"content":{"129":{"position":[[639,3]]},"164":{"position":[[1019,3]]},"280":{"position":[[640,3]]},"353":{"position":[[1054,3]]},"517":{"position":[[640,3]]},"569":{"position":[[1054,3]]}},"keywords":{}}],["summari",{"_index":2427,"title":{"199":{"position":[[0,8]]},"248":{"position":[[0,8]]},"435":{"position":[[0,8]]},"447":{"position":[[0,8]]},"674":{"position":[[0,8]]},"682":{"position":[[0,8]]}},"content":{},"keywords":{}}],["super",{"_index":814,"title":{},"content":{"32":{"position":[[52,5]]},"42":{"position":[[2064,9]]},"51":{"position":[[1350,9]]},"54":{"position":[[69,5]]},"73":{"position":[[466,9]]},"143":{"position":[[980,9]]},"198":{"position":[[40,9]]},"206":{"position":[[42,9]]},"223":{"position":[[827,9]]},"237":{"position":[[466,9]]},"269":{"position":[[3857,8]]},"328":{"position":[[955,9]]},"409":{"position":[[3857,8]]},"419":{"position":[[6508,9]]},"426":{"position":[[42,9]]},"434":{"position":[[40,9]]},"456":{"position":[[827,9]]},"473":{"position":[[466,9]]},"537":{"position":[[955,9]]},"646":{"position":[[3857,8]]},"656":{"position":[[6508,9]]},"668":{"position":[[42,9]]},"681":{"position":[[40,9]]},"696":{"position":[[827,9]]}},"keywords":{}}],["super._update(from",{"_index":1129,"title":{},"content":{"43":{"position":[[568,19]]}},"keywords":{}}],["super::access_control::rol",{"_index":2183,"title":{},"content":{"184":{"position":[[243,28]]},"375":{"position":[[234,28]]},"591":{"position":[[234,28]]}},"keywords":{}}],["super::errors::error",{"_index":2208,"title":{},"content":{"185":{"position":[[139,21]]},"376":{"position":[[139,21]]},"592":{"position":[[139,21]]}},"keywords":{}}],["super::ev",{"_index":2207,"title":{},"content":{"185":{"position":[[117,17]]},"376":{"position":[[117,17]]},"592":{"position":[[117,17]]}},"keywords":{}}],["super::modulescontracthostref",{"_index":2013,"title":{},"content":{"151":{"position":[[125,30]]},"342":{"position":[[125,30]]},"556":{"position":[[125,30]]}},"keywords":{}}],["super::ownablehostref",{"_index":2904,"title":{},"content":{"268":{"position":[[868,22]]},"408":{"position":[[868,22]]},"645":{"position":[[868,22]]}},"keywords":{}}],["super::publicwallethostref",{"_index":2036,"title":{},"content":{"160":{"position":[[178,27]]},"345":{"position":[[178,27]]},"562":{"position":[[178,27]]}},"keywords":{}}],["super::{crosscontracthostref",{"_index":1961,"title":{},"content":{"143":{"position":[[130,29]]},"328":{"position":[[130,29]]},"537":{"position":[[130,29]]}},"keywords":{}}],["super::{erc20hostref",{"_index":2905,"title":{},"content":{"268":{"position":[[1070,21]]},"408":{"position":[[1070,21]]},"645":{"position":[[1070,21]]}},"keywords":{}}],["super::{error",{"_index":1901,"title":{},"content":{"138":{"position":[[193,14]]},"318":{"position":[[193,14]]},"544":{"position":[[193,14]]}},"keywords":{}}],["super::{partycontracthostref",{"_index":2023,"title":{},"content":{"157":{"position":[[151,29]]},"330":{"position":[[151,29]]},"547":{"position":[[151,29]]}},"keywords":{}}],["suppli",{"_index":2501,"title":{},"content":{"206":{"position":[[593,7],[822,6]]},"269":{"position":[[4503,7],[4732,6]]},"396":{"position":[[628,7]]},"409":{"position":[[4503,7],[4732,6]]},"419":{"position":[[1355,7],[2560,6]]},"426":{"position":[[593,7],[822,6]]},"633":{"position":[[628,7]]},"646":{"position":[[4503,7],[4732,6]]},"656":{"position":[[1355,7],[2560,6]]},"668":{"position":[[593,7],[822,6]]}},"keywords":{}}],["supply.bal",{"_index":2435,"title":{},"content":{"202":{"position":[[195,15]]},"422":{"position":[[195,15]]},"664":{"position":[[195,15]]}},"keywords":{}}],["supply.l28",{"_index":3320,"title":{},"content":{"424":{"position":[[1109,10]]},"666":{"position":[[1109,10]]}},"keywords":{}}],["supply.l33",{"_index":2454,"title":{},"content":{"204":{"position":[[1159,10]]}},"keywords":{}}],["support",{"_index":131,"title":{},"content":{"3":{"position":[[160,7]]},"15":{"position":[[584,9]]},"38":{"position":[[989,7]]},"39":{"position":[[1055,8]]},"40":{"position":[[152,10]]},"81":{"position":[[223,7]]},"90":{"position":[[104,8]]},"232":{"position":[[223,7]]},"267":{"position":[[4412,10]]},"282":{"position":[[104,8]]},"324":{"position":[[647,10],[1019,10]]},"396":{"position":[[511,9]]},"407":{"position":[[4412,10]]},"463":{"position":[[223,7]]},"494":{"position":[[104,8]]},"542":{"position":[[647,10],[1019,10]]},"599":{"position":[[447,8]]},"609":{"position":[[253,7]]},"610":{"position":[[873,7]]},"612":{"position":[[1360,8]]},"633":{"position":[[511,9]]},"644":{"position":[[4412,10]]},"707":{"position":[[447,8]]},"717":{"position":[[253,7]]},"718":{"position":[[873,7]]},"720":{"position":[[1360,8]]}},"keywords":{}}],["sure",{"_index":29,"title":{},"content":{"1":{"position":[[312,4]]},"7":{"position":[[157,4]]},"31":{"position":[[436,4],[2646,4]]},"43":{"position":[[765,4]]},"70":{"position":[[48,4]]},"127":{"position":[[182,4]]},"128":{"position":[[729,4]]},"154":{"position":[[162,4]]},"234":{"position":[[48,4]]},"247":{"position":[[1938,4]]},"261":{"position":[[45,4]]},"270":{"position":[[388,4]]},"278":{"position":[[182,4]]},"279":{"position":[[729,4]]},"339":{"position":[[162,4]]},"379":{"position":[[45,4]]},"385":{"position":[[388,4]]},"396":{"position":[[218,4]]},"401":{"position":[[45,4]]},"410":{"position":[[388,4]]},"441":{"position":[[3287,4]]},"446":{"position":[[1938,4]]},"470":{"position":[[48,4]]},"477":{"position":[[215,4]]},"515":{"position":[[182,4]]},"516":{"position":[[729,4]]},"559":{"position":[[162,4]]},"621":{"position":[[45,4]]},"627":{"position":[[388,4]]},"633":{"position":[[218,4]]},"638":{"position":[[45,4]]},"647":{"position":[[388,4]]},"673":{"position":[[1938,4]]},"688":{"position":[[3287,4]]},"699":{"position":[[215,4]]}},"keywords":{}}],["swap(&mut",{"_index":1746,"title":{},"content":{"115":{"position":[[2692,13]]},"258":{"position":[[2622,13]]},"481":{"position":[[2622,13]]}},"keywords":{}}],["switch",{"_index":1625,"title":{},"content":{"95":{"position":[[183,6]]},"129":{"position":[[106,6]]},"198":{"position":[[3321,6]]},"222":{"position":[[36,6]]},"280":{"position":[[106,6]]},"287":{"position":[[183,6]]},"434":{"position":[[3303,6]]},"455":{"position":[[36,6]]},"499":{"position":[[183,6]]},"517":{"position":[[106,6]]},"681":{"position":[[3321,6]]},"695":{"position":[[36,6]]}},"keywords":{}}],["symbol",{"_index":513,"title":{},"content":{"17":{"position":[[2004,7],[2277,7]]},"115":{"position":[[374,7],[515,7],[2217,7],[2378,7]]},"126":{"position":[[1934,6],[2362,7]]},"202":{"position":[[168,7]]},"203":{"position":[[177,7]]},"204":{"position":[[104,7]]},"206":{"position":[[171,7],[402,7]]},"247":{"position":[[139,7],[280,7]]},"258":{"position":[[364,7],[505,7],[2163,7],[2324,7]]},"268":{"position":[[1214,7]]},"269":{"position":[[345,7],[579,7],[4075,7],[4306,7]]},"277":{"position":[[2102,6],[2530,7]]},"384":{"position":[[358,7],[592,7]]},"395":{"position":[[1884,6],[2022,7]]},"396":{"position":[[611,6]]},"408":{"position":[[1214,7]]},"409":{"position":[[345,7],[579,7],[4075,7],[4306,7]]},"417":{"position":[[256,7]]},"419":{"position":[[1404,7],[2398,6],[6671,7]]},"422":{"position":[[168,7]]},"423":{"position":[[177,7]]},"424":{"position":[[79,7]]},"426":{"position":[[171,7],[402,7]]},"446":{"position":[[139,7],[280,7]]},"481":{"position":[[364,7],[505,7],[2163,7],[2324,7]]},"514":{"position":[[1934,6],[2362,7]]},"626":{"position":[[358,7],[592,7]]},"632":{"position":[[1884,6],[2022,7]]},"633":{"position":[[611,6]]},"645":{"position":[[1214,7]]},"646":{"position":[[345,7],[579,7],[4075,7],[4306,7]]},"654":{"position":[[256,7]]},"656":{"position":[[1404,7],[2398,6],[6671,7]]},"664":{"position":[[168,7]]},"665":{"position":[[177,7]]},"666":{"position":[[79,7]]},"668":{"position":[[171,7],[402,7]]},"673":{"position":[[139,7],[280,7]]}},"keywords":{}}],["symbol(&self",{"_index":1724,"title":{},"content":{"115":{"position":[[840,17]]},"204":{"position":[[388,17]]},"247":{"position":[[382,17]]},"258":{"position":[[810,17]]},"414":{"position":[[407,17]]},"419":{"position":[[2422,17]]},"424":{"position":[[363,17]]},"446":{"position":[[382,17]]},"481":{"position":[[810,17]]},"651":{"position":[[407,17]]},"656":{"position":[[2422,17]]},"666":{"position":[[363,17]]},"673":{"position":[[382,17]]}},"keywords":{}}],["symbol.to_str",{"_index":2498,"title":{},"content":{"206":{"position":[[410,19],[699,20]]},"268":{"position":[[1222,19]]},"269":{"position":[[4314,19],[4609,20]]},"408":{"position":[[1222,19]]},"409":{"position":[[4314,19],[4609,20]]},"426":{"position":[[410,19],[699,20]]},"645":{"position":[[1222,19]]},"646":{"position":[[4314,19],[4609,20]]},"668":{"position":[[410,19],[699,20]]}},"keywords":{}}],["symbol_",{"_index":1116,"title":{},"content":{"43":{"position":[[267,8],[325,8]]}},"keywords":{}}],["symbolnotset",{"_index":2839,"title":{},"content":{"267":{"position":[[1414,12]]},"269":{"position":[[3777,12]]},"383":{"position":[[860,12]]},"384":{"position":[[3741,12]]},"407":{"position":[[1414,12]]},"409":{"position":[[3777,12]]},"625":{"position":[[860,12]]},"626":{"position":[[3741,12]]},"644":{"position":[[1414,12]]},"646":{"position":[[3777,12]]}},"keywords":{}}],["syntact",{"_index":2457,"title":{},"content":{"204":{"position":[[1477,9]]},"424":{"position":[[1427,9]]},"666":{"position":[[1427,9]]}},"keywords":{}}],["syntax",{"_index":894,"title":{},"content":{"39":{"position":[[29,6]]}},"keywords":{}}],["system",{"_index":650,"title":{"437":{"position":[[10,6]]},"684":{"position":[[10,6]]}},"content":{"22":{"position":[[490,8],[565,7],[606,7]]},"76":{"position":[[624,7]]},"79":{"position":[[42,6]]},"173":{"position":[[269,8]]},"227":{"position":[[624,7]]},"230":{"position":[[42,6]]},"359":{"position":[[269,8]]},"416":{"position":[[11,6]]},"440":{"position":[[6557,7]]},"442":{"position":[[48,6]]},"458":{"position":[[624,7]]},"461":{"position":[[42,6]]},"575":{"position":[[269,8]]},"653":{"position":[[11,6]]},"687":{"position":[[6557,7]]},"689":{"position":[[48,6]]}},"keywords":{}}],["systemat",{"_index":138,"title":{},"content":{"3":{"position":[[270,11]]}},"keywords":{}}],["t",{"_index":976,"title":{},"content":{"39":{"position":[[2321,2],[2373,2]]},"42":{"position":[[227,1]]},"78":{"position":[[213,2]]},"117":{"position":[[643,1]]},"229":{"position":[[213,2]]},"267":{"position":[[2249,2],[2558,2],[2632,2],[2844,2],[3052,1]]},"298":{"position":[[643,1]]},"407":{"position":[[2249,2],[2558,2],[2632,2],[2844,2],[3052,1]]},"460":{"position":[[213,2]]},"519":{"position":[[643,1]]},"644":{"position":[[2249,2],[2558,2],[2632,2],[2844,2],[3052,1]]}},"keywords":{}}],["t>",{"_index":2100,"title":{},"content":{"163":{"position":[[1654,6]]},"352":{"position":[[1676,6]]},"568":{"position":[[1676,6]]}},"keywords":{}}],["t).fn",{"_index":2869,"title":{},"content":{"267":{"position":[[2904,5]]},"407":{"position":[[2904,5]]},"644":{"position":[[2904,5]]}},"keywords":{}}],["t).set_dict_valu",{"_index":2855,"title":{},"content":{"267":{"position":[[2334,19]]},"407":{"position":[[2334,19]]},"644":{"position":[[2334,19]]}},"keywords":{}}],["t.function",{"_index":2875,"title":{},"content":{"267":{"position":[[3148,11]]},"407":{"position":[[3148,11]]},"644":{"position":[[3148,11]]}},"keywords":{}}],["tab",{"_index":3195,"title":{},"content":{"396":{"position":[[773,4],[1062,4]]},"633":{"position":[[773,4],[1062,4]]}},"keywords":{}}],["tackl",{"_index":2079,"title":{},"content":{"162":{"position":[[2414,6]]},"351":{"position":[[2436,6]]},"567":{"position":[[2436,6]]}},"keywords":{}}],["take",{"_index":60,"title":{},"content":{"1":{"position":[[798,4]]},"22":{"position":[[156,5]]},"31":{"position":[[154,4]]},"32":{"position":[[69,5]]},"38":{"position":[[144,5],[1105,4]]},"40":{"position":[[295,5]]},"44":{"position":[[110,4]]},"52":{"position":[[2163,4]]},"53":{"position":[[60,4]]},"70":{"position":[[246,4]]},"90":{"position":[[119,4]]},"94":{"position":[[255,5],[382,5]]},"112":{"position":[[8,4]]},"115":{"position":[[1823,4]]},"117":{"position":[[293,6]]},"122":{"position":[[29,4]]},"126":{"position":[[335,4]]},"127":{"position":[[701,4]]},"131":{"position":[[12,4]]},"136":{"position":[[163,4]]},"141":{"position":[[1055,4]]},"146":{"position":[[842,4]]},"147":{"position":[[396,4]]},"149":{"position":[[10,4]]},"155":{"position":[[27,4]]},"163":{"position":[[1443,4]]},"164":{"position":[[330,4],[416,5]]},"169":{"position":[[3,4]]},"198":{"position":[[1312,4],[2059,4]]},"234":{"position":[[246,4]]},"246":{"position":[[375,4]]},"258":{"position":[[1769,4]]},"277":{"position":[[335,4]]},"278":{"position":[[701,4]]},"282":{"position":[[119,4]]},"286":{"position":[[255,5],[382,5]]},"298":{"position":[[293,6]]},"303":{"position":[[29,4]]},"307":{"position":[[8,4]]},"311":{"position":[[12,4]]},"316":{"position":[[163,4]]},"326":{"position":[[1055,4]]},"334":{"position":[[846,4]]},"335":{"position":[[400,4]]},"337":{"position":[[10,4]]},"340":{"position":[[27,4]]},"349":{"position":[[3,4]]},"352":{"position":[[1465,4]]},"353":{"position":[[365,4],[451,5]]},"434":{"position":[[1302,4],[2049,4]]},"445":{"position":[[375,4]]},"470":{"position":[[246,4]]},"481":{"position":[[1769,4]]},"494":{"position":[[119,4]]},"498":{"position":[[255,5],[382,5]]},"512":{"position":[[8,4]]},"514":{"position":[[335,4]]},"515":{"position":[[701,4]]},"519":{"position":[[293,6]]},"524":{"position":[[29,4]]},"528":{"position":[[12,4]]},"533":{"position":[[163,4]]},"535":{"position":[[1055,4]]},"551":{"position":[[846,4]]},"552":{"position":[[400,4]]},"554":{"position":[[10,4]]},"560":{"position":[[27,4]]},"565":{"position":[[3,4]]},"568":{"position":[[1465,4]]},"569":{"position":[[365,4],[451,5]]},"611":{"position":[[762,5]]},"612":{"position":[[327,4]]},"616":{"position":[[1354,4]]},"672":{"position":[[375,4]]},"681":{"position":[[1312,4],[2059,4]]},"719":{"position":[[762,5]]},"720":{"position":[[327,4]]},"724":{"position":[[1354,4]]}},"keywords":{}}],["takeaway",{"_index":1498,"title":{},"content":{"81":{"position":[[92,9]]},"232":{"position":[[92,9]]},"463":{"position":[[92,9]]}},"keywords":{}}],["taken",{"_index":128,"title":{},"content":{"3":{"position":[[107,6]]},"7":{"position":[[216,5]]},"52":{"position":[[3229,5],[4875,5]]},"203":{"position":[[464,5]]},"321":{"position":[[93,5]]},"423":{"position":[[464,5]]},"539":{"position":[[93,5]]},"665":{"position":[[464,5]]}},"keywords":{}}],["talli",{"_index":3141,"title":{},"content":{"395":{"position":[[1487,5]]},"416":{"position":[[1079,8],[3282,8],[3303,11],[3315,8],[3355,5],[3534,8],[3670,8]]},"419":{"position":[[488,5],[5113,8],[5249,8]]},"632":{"position":[[1487,5]]},"653":{"position":[[1079,8],[3282,8],[3303,11],[3315,8],[3355,5],[3534,8],[3670,8]]},"656":{"position":[[488,5],[5113,8],[5249,8]]}},"keywords":{}}],["tally(&mut",{"_index":3249,"title":{},"content":{"416":{"position":[[3497,14]]},"419":{"position":[[5076,14]]},"653":{"position":[[3497,14]]},"656":{"position":[[5076,14]]}},"keywords":{}}],["target",{"_index":887,"title":{"135":{"position":[[0,8]]},"315":{"position":[[0,8]]},"532":{"position":[[0,8]]}},"content":{"38":{"position":[[926,6]]},"65":{"position":[[119,6]]},"68":{"position":[[257,6]]},"145":{"position":[[159,8]]},"173":{"position":[[382,7],[397,6],[465,6]]},"240":{"position":[[119,6]]},"243":{"position":[[257,6]]},"333":{"position":[[159,8]]},"359":{"position":[[382,7],[397,6],[465,6]]},"465":{"position":[[119,6]]},"468":{"position":[[257,6]]},"550":{"position":[[159,8]]},"575":{"position":[[382,7],[397,6],[465,6]]}},"keywords":{}}],["target/debug/our_token_livenet",{"_index":3172,"title":{},"content":{"395":{"position":[[4527,32]]},"632":{"position":[[4527,32]]}},"keywords":{}}],["target/wasm32",{"_index":1333,"title":{},"content":{"65":{"position":[[446,13],[692,13]]},"68":{"position":[[322,13]]},"240":{"position":[[446,13],[692,13]]},"243":{"position":[[322,13]]},"465":{"position":[[446,13],[692,13]]},"468":{"position":[[322,13]]}},"keywords":{}}],["target_key",{"_index":3462,"title":{},"content":{"440":{"position":[[6352,11]]},"687":{"position":[[6352,11]]}},"keywords":{}}],["task",{"_index":3104,"title":{},"content":{"393":{"position":[[42,5]]},"630":{"position":[[42,5]]}},"keywords":{}}],["team",{"_index":162,"title":{},"content":{"3":{"position":[[651,5]]},"12":{"position":[[276,5]]},"20":{"position":[[176,4]]}},"keywords":{}}],["technic",{"_index":938,"title":{},"content":{"39":{"position":[[1033,12]]},"52":{"position":[[1810,11]]},"270":{"position":[[202,9]]},"385":{"position":[[202,9]]},"410":{"position":[[202,9]]},"627":{"position":[[202,9]]},"647":{"position":[[202,9]]}},"keywords":{}}],["techniqu",{"_index":3823,"title":{},"content":{"612":{"position":[[1485,9]]},"720":{"position":[[1485,9]]}},"keywords":{}}],["technolog",{"_index":431,"title":{},"content":{"16":{"position":[[59,10]]}},"keywords":{}}],["templat",{"_index":1758,"title":{},"content":{"117":{"position":[[493,8],[561,9],[690,8],[799,9],[869,8]]},"264":{"position":[[331,9],[404,8]]},"298":{"position":[[493,8],[561,9],[690,8],[799,9],[869,8]]},"382":{"position":[[144,9],[217,8]]},"404":{"position":[[331,9],[404,8]]},"414":{"position":[[94,9],[136,8]]},"439":{"position":[[126,9],[174,8]]},"440":{"position":[[89,9],[3984,8]]},"519":{"position":[[493,8],[561,9],[690,8],[799,9],[869,8]]},"624":{"position":[[144,9],[217,8]]},"641":{"position":[[331,9],[404,8]]},"651":{"position":[[94,9],[136,8]]},"686":{"position":[[126,9],[174,8]]},"687":{"position":[[89,9],[3984,8]]}},"keywords":{}}],["term",{"_index":1160,"title":{},"content":{"43":{"position":[[1903,5]]},"198":{"position":[[2503,4]]},"434":{"position":[[2493,4]]},"681":{"position":[[2503,4]]}},"keywords":{}}],["test",{"_index":50,"title":{"67":{"position":[[12,5]]},"95":{"position":[[0,4]]},"119":{"position":[[0,8]]},"138":{"position":[[0,7]]},"143":{"position":[[0,8]]},"148":{"position":[[0,6]]},"151":{"position":[[0,8]]},"157":{"position":[[0,7]]},"160":{"position":[[0,8]]},"167":{"position":[[0,7]]},"179":{"position":[[0,8]]},"198":{"position":[[0,5]]},"206":{"position":[[0,5]]},"242":{"position":[[12,5]]},"268":{"position":[[12,6]]},"287":{"position":[[0,4]]},"300":{"position":[[0,8]]},"318":{"position":[[0,7]]},"328":{"position":[[0,8]]},"330":{"position":[[0,7]]},"336":{"position":[[0,6]]},"342":{"position":[[0,8]]},"345":{"position":[[0,8]]},"347":{"position":[[0,7]]},"370":{"position":[[0,8]]},"408":{"position":[[12,6]]},"417":{"position":[[0,8]]},"426":{"position":[[0,5]]},"434":{"position":[[0,5]]},"467":{"position":[[12,5]]},"499":{"position":[[0,4]]},"521":{"position":[[0,8]]},"537":{"position":[[0,8]]},"544":{"position":[[0,7]]},"547":{"position":[[0,7]]},"553":{"position":[[0,6]]},"556":{"position":[[0,8]]},"562":{"position":[[0,8]]},"563":{"position":[[0,7]]},"586":{"position":[[0,8]]},"645":{"position":[[12,6]]},"654":{"position":[[0,8]]},"668":{"position":[[0,5]]},"681":{"position":[[0,5]]}},"content":{"1":{"position":[[646,5],[1070,6]]},"20":{"position":[[405,6]]},"22":{"position":[[660,7]]},"31":{"position":[[365,5],[2824,5],[3151,7],[3417,7]]},"42":{"position":[[1569,5],[1690,4],[1718,4],[1855,4],[1891,5],[2145,7],[2397,7],[2566,4],[2573,4],[2609,4],[2648,4]]},"43":{"position":[[825,4],[855,5],[872,4],[990,4]]},"51":{"position":[[1338,5],[1360,7],[1462,7]]},"67":{"position":[[11,5],[75,5],[170,4]]},"68":{"position":[[66,5],[545,4]]},"73":{"position":[[455,4],[530,7]]},"88":{"position":[[420,6]]},"95":{"position":[[0,4],[31,4],[162,5],[373,4],[463,4],[507,4]]},"96":{"position":[[60,5],[122,4]]},"98":{"position":[[580,4]]},"99":{"position":[[288,4]]},"100":{"position":[[382,4]]},"101":{"position":[[236,4]]},"106":{"position":[[86,4]]},"107":{"position":[[183,4],[498,5]]},"111":{"position":[[174,6],[308,4]]},"117":{"position":[[1133,4]]},"119":{"position":[[92,4],[111,5],[244,5],[345,4],[510,5],[726,7],[833,6],[876,4],[944,4],[981,4],[1006,5],[1074,4],[1153,4]]},"120":{"position":[[89,6]]},"124":{"position":[[37,7]]},"126":{"position":[[232,6],[841,4],[889,4],[1136,5],[1250,4],[3447,5],[3647,4]]},"131":{"position":[[199,4],[314,4],[413,4],[610,7],[633,4]]},"132":{"position":[[123,5]]},"134":{"position":[[213,4]]},"136":{"position":[[56,4]]},"138":{"position":[[20,7],[46,4],[181,5],[302,7]]},"139":{"position":[[30,4]]},"141":{"position":[[36,7],[1404,6]]},"142":{"position":[[133,4]]},"143":{"position":[[21,4],[118,5],[248,7],[624,4],[708,4],[968,5],[1046,7]]},"148":{"position":[[28,5],[108,7],[166,4],[454,5],[958,5]]},"151":{"position":[[40,4],[113,5],[192,7]]},"157":{"position":[[64,4],[250,7],[804,7]]},"160":{"position":[[14,4],[166,5],[273,7]]},"164":{"position":[[1164,6]]},"168":{"position":[[271,5],[348,5],[488,7],[1148,5],[1555,6]]},"174":{"position":[[61,4]]},"175":{"position":[[258,5],[306,4],[326,5],[380,5],[441,4]]},"176":{"position":[[42,7]]},"178":{"position":[[1034,5],[1114,7],[1172,4],[1441,7]]},"179":{"position":[[11,6],[60,4],[102,5]]},"193":{"position":[[195,4],[234,4]]},"196":{"position":[[1545,7]]},"198":{"position":[[28,5],[331,7],[548,7],[880,7],[1148,4],[1306,5],[1652,4],[2190,5],[2313,5]]},"199":{"position":[[40,4]]},"206":{"position":[[30,5],[520,7],[1076,7],[1714,7],[2042,7],[3315,7]]},"223":{"position":[[816,4],[873,7],[1206,5]]},"237":{"position":[[455,4],[530,7]]},"242":{"position":[[11,5],[75,5],[171,4]]},"243":{"position":[[66,5],[545,4]]},"248":{"position":[[126,4]]},"250":{"position":[[420,6]]},"265":{"position":[[261,4],[601,4],[720,4],[823,4]]},"268":{"position":[[69,5],[169,6],[2032,7],[2355,7],[2687,7]]},"269":{"position":[[3845,5],[4430,7],[4986,7],[5624,7],[5961,8]]},"273":{"position":[[86,4]]},"274":{"position":[[183,4],[498,5]]},"277":{"position":[[232,6],[841,4],[889,4],[1304,5],[1418,4],[3615,5],[3815,4]]},"287":{"position":[[0,4],[31,4],[162,5],[373,4],[463,4],[507,4]]},"288":{"position":[[60,5],[122,4]]},"290":{"position":[[580,4]]},"291":{"position":[[288,4]]},"292":{"position":[[382,4]]},"293":{"position":[[236,4]]},"298":{"position":[[1133,4]]},"300":{"position":[[92,4],[111,5],[244,5],[345,4],[510,5],[726,7],[833,6],[876,4],[944,4],[981,4],[1006,5],[1074,4],[1153,4]]},"301":{"position":[[89,6]]},"306":{"position":[[174,6],[308,4]]},"309":{"position":[[37,7]]},"311":{"position":[[199,4],[366,4],[465,4],[662,7],[685,4]]},"312":{"position":[[123,5]]},"314":{"position":[[213,4]]},"316":{"position":[[56,4]]},"318":{"position":[[20,7],[46,4],[181,5],[294,7]]},"319":{"position":[[30,4]]},"326":{"position":[[36,7],[1404,6]]},"327":{"position":[[133,4]]},"328":{"position":[[21,4],[118,5],[248,7],[599,4],[683,4],[943,5],[1021,7]]},"330":{"position":[[64,4],[241,7],[780,7]]},"336":{"position":[[28,5],[108,7],[166,4],[454,5],[958,5]]},"342":{"position":[[40,4],[113,5],[192,7]]},"345":{"position":[[14,4],[166,5],[273,7]]},"346":{"position":[[45,6]]},"348":{"position":[[271,5],[348,5],[488,7],[1148,5],[1555,6]]},"353":{"position":[[1199,6]]},"360":{"position":[[61,4]]},"361":{"position":[[258,5],[306,4],[326,5],[380,5],[441,4]]},"362":{"position":[[42,7]]},"369":{"position":[[1034,5],[1114,7],[1172,4],[1441,7]]},"370":{"position":[[11,6],[60,4],[102,5]]},"384":{"position":[[3809,5],[3843,5]]},"393":{"position":[[228,8],[422,7]]},"395":{"position":[[2922,4],[3272,4],[3372,4],[4037,4]]},"405":{"position":[[261,4],[601,4],[720,4],[823,4]]},"408":{"position":[[69,5],[169,6],[2032,7],[2355,7],[2687,7]]},"409":{"position":[[3845,5],[4430,7],[4986,7],[5624,7],[5961,8]]},"414":{"position":[[632,5],[655,5]]},"416":{"position":[[2511,4]]},"417":{"position":[[43,5],[58,5],[129,7],[1639,4],[1675,4],[1691,4]]},"419":{"position":[[6496,5],[6544,7]]},"426":{"position":[[30,5],[520,7],[1071,7],[1704,7],[2032,7],[3290,7]]},"429":{"position":[[195,4],[234,4]]},"434":{"position":[[28,5],[331,7],[543,7],[870,7],[1138,4],[1296,5],[1642,4],[2180,5],[2303,5]]},"435":{"position":[[40,4]]},"440":{"position":[[4571,4],[4594,4],[4935,7],[5814,4]]},"441":{"position":[[4471,5],[4760,7]]},"447":{"position":[[126,4]]},"456":{"position":[[816,4],[873,7],[1206,5]]},"467":{"position":[[11,5],[75,5],[171,4]]},"468":{"position":[[66,5],[545,4]]},"473":{"position":[[455,4],[530,7]]},"477":{"position":[[635,4],[1240,4]]},"488":{"position":[[420,6]]},"490":{"position":[[86,4]]},"491":{"position":[[183,4],[498,5]]},"499":{"position":[[0,4],[31,4],[162,5],[373,4],[463,4],[507,4]]},"500":{"position":[[60,5],[122,4]]},"502":{"position":[[580,4]]},"503":{"position":[[288,4]]},"504":{"position":[[382,4]]},"505":{"position":[[236,4]]},"511":{"position":[[174,6],[308,4]]},"514":{"position":[[232,6],[841,4],[889,4],[1136,5],[1250,4],[3447,5],[3647,4]]},"519":{"position":[[1133,4]]},"521":{"position":[[92,4],[111,5],[244,5],[345,4],[510,5],[726,7],[833,6],[876,4],[944,4],[981,4],[1006,5],[1074,4],[1153,4]]},"522":{"position":[[89,6]]},"526":{"position":[[37,7]]},"528":{"position":[[199,4],[366,4],[465,4],[662,7],[685,4]]},"529":{"position":[[123,5]]},"531":{"position":[[213,4]]},"533":{"position":[[56,4]]},"535":{"position":[[36,7],[1404,6]]},"536":{"position":[[133,4]]},"537":{"position":[[21,4],[118,5],[248,7],[599,4],[683,4],[943,5],[1021,7]]},"544":{"position":[[20,7],[46,4],[181,5],[294,7]]},"545":{"position":[[30,4]]},"547":{"position":[[64,4],[250,7],[804,7]]},"553":{"position":[[28,5],[108,7],[166,4],[454,5],[958,5]]},"556":{"position":[[40,4],[113,5],[192,7]]},"562":{"position":[[14,4],[166,5],[273,7]]},"564":{"position":[[271,5],[348,5],[488,7],[1148,5],[1555,6]]},"569":{"position":[[1199,6]]},"576":{"position":[[61,4]]},"577":{"position":[[258,5],[306,4],[326,5],[380,5],[441,4]]},"578":{"position":[[42,7]]},"585":{"position":[[1034,5],[1114,7],[1172,4],[1441,7]]},"586":{"position":[[11,6],[60,4],[102,5]]},"626":{"position":[[3809,5],[3843,5]]},"630":{"position":[[228,8],[422,7]]},"632":{"position":[[2922,4],[3272,4],[3372,4],[4037,4]]},"642":{"position":[[261,4],[601,4],[720,4],[823,4]]},"645":{"position":[[69,5],[169,6],[2032,7],[2355,7],[2687,7]]},"646":{"position":[[3845,5],[4430,7],[4986,7],[5624,7],[5961,8]]},"651":{"position":[[632,5],[655,5]]},"653":{"position":[[2511,4]]},"654":{"position":[[43,5],[58,5],[129,7],[1639,4],[1675,4],[1691,4]]},"656":{"position":[[6496,5],[6544,7]]},"668":{"position":[[30,5],[520,7],[1076,7],[1714,7],[2042,7],[3315,7]]},"674":{"position":[[126,4]]},"676":{"position":[[195,4],[234,4]]},"681":{"position":[[28,5],[331,7],[548,7],[880,7],[1148,4],[1306,5],[1652,4],[2190,5],[2313,5]]},"682":{"position":[[40,4]]},"687":{"position":[[4571,4],[4594,4],[4935,7],[5814,4]]},"688":{"position":[[4471,5],[4760,7]]},"696":{"position":[[816,4],[873,7],[1206,5]]},"699":{"position":[[635,4],[1240,4]]}},"keywords":{}}],["test(&self",{"_index":3791,"title":{},"content":{"610":{"position":[[220,15]]},"718":{"position":[[220,15]]}},"keywords":{}}],["test.l16",{"_index":2405,"title":{},"content":{"198":{"position":[[2229,8]]},"434":{"position":[[2219,8]]},"681":{"position":[[2229,8]]}},"keywords":{}}],["test.r",{"_index":1100,"title":{},"content":{"42":{"position":[[2738,7]]}},"keywords":{}}],["test_array_remove(&mut",{"_index":3844,"title":{},"content":{"613":{"position":[[948,26]]},"721":{"position":[[948,26]]}},"keywords":{}}],["test_cross_cal",{"_index":1965,"title":{},"content":{"143":{"position":[[259,18]]},"328":{"position":[[259,18]]},"537":{"position":[[259,18]]}},"keywords":{}}],["test_env",{"_index":1398,"title":{},"content":{"73":{"position":[[575,8]]},"138":{"position":[[338,8]]},"143":{"position":[[284,8],[1074,8]]},"151":{"position":[[224,8]]},"157":{"position":[[280,9]]},"160":{"position":[[305,8]]},"168":{"position":[[511,9]]},"223":{"position":[[919,8]]},"237":{"position":[[575,8]]},"318":{"position":[[330,8]]},"328":{"position":[[284,8],[1049,8]]},"330":{"position":[[271,9]]},"342":{"position":[[224,8]]},"345":{"position":[[305,8]]},"348":{"position":[[511,9]]},"456":{"position":[[919,8]]},"473":{"position":[[575,8]]},"537":{"position":[[284,8],[1049,8]]},"544":{"position":[[330,8]]},"547":{"position":[[280,9]]},"556":{"position":[[224,8]]},"562":{"position":[[305,8]]},"564":{"position":[[511,9]]},"696":{"position":[[919,8]]}},"keywords":{}}],["test_env.emitted(&party_contract",{"_index":3062,"title":{},"content":{"330":{"position":[[579,37]]}},"keywords":{}}],["test_env.emitted(party_contract.address",{"_index":2032,"title":{},"content":{"157":{"position":[[593,42]]},"547":{"position":[[593,42]]}},"keywords":{}}],["test_env.emitted_ev",{"_index":2028,"title":{},"content":{"157":{"position":[[392,23]]},"330":{"position":[[383,23]]},"547":{"position":[[392,23]]}},"keywords":{}}],["test_env.get_account(0",{"_index":1906,"title":{},"content":{"138":{"position":[[379,24]]},"157":{"position":[[470,24]]},"318":{"position":[[371,24]]},"330":{"position":[[456,24]]},"544":{"position":[[371,24]]},"547":{"position":[[470,24]]}},"keywords":{}}],["test_env.get_account(1",{"_index":1908,"title":{},"content":{"138":{"position":[[423,24]]},"318":{"position":[[415,24]]},"544":{"position":[[415,24]]}},"keywords":{}}],["test_env.set_caller(not_an_own",{"_index":1913,"title":{},"content":{"138":{"position":[[644,34]]},"318":{"position":[[636,34]]},"544":{"position":[[636,34]]}},"keywords":{}}],["test_env.set_caller(own",{"_index":1909,"title":{},"content":{"138":{"position":[[448,27]]},"318":{"position":[[440,27]]},"544":{"position":[[440,27]]}},"keywords":{}}],["test_env.set_caller(test_env.get_account(0",{"_index":2118,"title":{},"content":{"168":{"position":[[549,45]]},"348":{"position":[[549,45]]},"564":{"position":[[549,45]]}},"keywords":{}}],["test_env.set_caller(test_env.get_account(1",{"_index":2123,"title":{},"content":{"168":{"position":[[807,45]]},"348":{"position":[[807,45]]},"564":{"position":[[807,45]]}},"keywords":{}}],["test_env::advance_block_time_by(blocktim",{"_index":2911,"title":{},"content":{"268":{"position":[[1553,42]]},"408":{"position":[[1553,42]]},"645":{"position":[[1553,42]]}},"keywords":{}}],["test_env::assert_except",{"_index":2921,"title":{},"content":{"268":{"position":[[2060,28]]},"408":{"position":[[2060,28]]},"645":{"position":[[2060,28]]}},"keywords":{}}],["test_env::gas_report",{"_index":2917,"title":{},"content":{"268":{"position":[[1827,22]]},"408":{"position":[[1827,22]]},"645":{"position":[[1827,22]]}},"keywords":{}}],["test_env::last_call_contract_gas_cost",{"_index":2914,"title":{},"content":{"268":{"position":[[1710,40]]},"408":{"position":[[1710,40]]},"645":{"position":[[1710,40]]}},"keywords":{}}],["test_env::last_call_contract_gas_us",{"_index":2915,"title":{},"content":{"268":{"position":[[1751,40]]},"408":{"position":[[1751,40]]},"645":{"position":[[1751,40]]}},"keywords":{}}],["test_env::set_cal",{"_index":1626,"title":{},"content":{"95":{"position":[[231,24]]},"287":{"position":[[231,24]]},"499":{"position":[[231,24]]}},"keywords":{}}],["test_env::set_caller(account",{"_index":1088,"title":{},"content":{"42":{"position":[[2229,32]]}},"keywords":{}}],["test_env::total_gas_used(address",{"_index":2916,"title":{},"content":{"268":{"position":[[1792,34]]},"408":{"position":[[1792,34]]},"645":{"position":[[1792,34]]}},"keywords":{}}],["test_ext",{"_index":1978,"title":{},"content":{"143":{"position":[[1057,10]]},"328":{"position":[[1032,10]]},"537":{"position":[[1032,10]]}},"keywords":{}}],["test_modul",{"_index":2014,"title":{},"content":{"151":{"position":[[203,14]]},"160":{"position":[[284,14]]},"342":{"position":[[203,14]]},"345":{"position":[[284,14]]},"556":{"position":[[203,14]]},"562":{"position":[[284,14]]}},"keywords":{}}],["test_owner_error",{"_index":1905,"title":{},"content":{"138":{"position":[[313,18]]},"318":{"position":[[305,18]]},"544":{"position":[[305,18]]}},"keywords":{}}],["test_parti",{"_index":2025,"title":{},"content":{"157":{"position":[[261,12]]},"330":{"position":[[252,12]]},"547":{"position":[[261,12]]}},"keywords":{}}],["test_require(&mut",{"_index":3801,"title":{},"content":{"611":{"position":[[228,21]]},"719":{"position":[[228,21]]}},"keywords":{}}],["test_square_root(&self",{"_index":3833,"title":{},"content":{"613":{"position":[[386,27]]},"721":{"position":[[386,27]]}},"keywords":{}}],["test_two_flipp",{"_index":2157,"title":{},"content":{"178":{"position":[[1452,19]]},"369":{"position":[[1452,19]]},"585":{"position":[[1452,19]]}},"keywords":{}}],["testarray",{"_index":3843,"title":{},"content":{"613":{"position":[[861,9],[929,9],[1609,9]]},"721":{"position":[[861,9],[929,9],[1609,9]]}},"keywords":{}}],["testing_contract",{"_index":2120,"title":{},"content":{"168":{"position":[[685,16]]},"348":{"position":[[685,16]]},"564":{"position":[[685,16]]}},"keywords":{}}],["testing_contract.created_bi",{"_index":2122,"title":{},"content":{"168":{"position":[[776,30]]},"348":{"position":[[776,30]]},"564":{"position":[[776,30]]}},"keywords":{}}],["testing_contract2",{"_index":2125,"title":{},"content":{"168":{"position":[[944,17]]},"348":{"position":[[944,17]]},"564":{"position":[[944,17]]}},"keywords":{}}],["testing_contract2.created_bi",{"_index":2127,"title":{},"content":{"168":{"position":[[1037,31]]},"348":{"position":[[1037,31]]},"564":{"position":[[1037,31]]}},"keywords":{}}],["testingcontracthostref::deploy(&test_env",{"_index":2121,"title":{},"content":{"168":{"position":[[704,45],[964,45]]},"348":{"position":[[704,45],[964,45]]},"564":{"position":[[704,45],[964,45]]}},"keywords":{}}],["testingcontractinitarg",{"_index":2117,"title":{},"content":{"168":{"position":[[411,25],[611,23],[869,23]]},"348":{"position":[[411,25],[611,23],[869,23]]},"564":{"position":[[411,25],[611,23],[869,23]]}},"keywords":{}}],["testmath",{"_index":3832,"title":{},"content":{"613":{"position":[[337,9],[368,8],[1547,8]]},"721":{"position":[[337,9],[368,8],[1547,8]]}},"keywords":{}}],["testnet",{"_index":365,"title":{},"content":{"11":{"position":[[26,7]]},"43":{"position":[[696,7],[905,7]]},"52":{"position":[[391,8]]},"95":{"position":[[83,7]]},"277":{"position":[[1223,7]]},"287":{"position":[[83,7]]},"394":{"position":[[182,8],[227,7]]},"396":{"position":[[192,8],[232,7]]},"499":{"position":[[83,7]]},"631":{"position":[[182,8],[227,7]]},"633":{"position":[[192,8],[232,7]]}},"keywords":{}}],["testnet,mint",{"_index":1154,"title":{},"content":{"43":{"position":[[1723,12]]}},"keywords":{}}],["text",{"_index":3676,"title":{},"content":{"600":{"position":[[101,5]]},"602":{"position":[[1012,5],[1315,5],[1354,5],[1430,5],[1506,5]]},"616":{"position":[[212,5]]},"708":{"position":[[101,5]]},"710":{"position":[[1012,5],[1315,5],[1354,5],[1430,5],[1506,5]]},"724":{"position":[[212,5]]}},"keywords":{}}],["th",{"_index":2140,"title":{},"content":{"168":{"position":[[1926,2],[2016,2]]},"348":{"position":[[1926,2],[2016,2]]},"564":{"position":[[1926,2],[2016,2]]}},"keywords":{}}],["thank",{"_index":723,"title":{},"content":{"31":{"position":[[376,6]]},"104":{"position":[[113,6]]},"107":{"position":[[390,6]]},"274":{"position":[[390,6]]},"296":{"position":[[113,6]]},"478":{"position":[[333,6]]},"491":{"position":[[390,6]]},"508":{"position":[[113,6]]},"700":{"position":[[333,6]]}},"keywords":{}}],["thankfulli",{"_index":1585,"title":{},"content":{"91":{"position":[[837,10]]},"163":{"position":[[1367,10]]},"283":{"position":[[837,10]]},"352":{"position":[[1389,10]]},"495":{"position":[[837,10]]},"568":{"position":[[1389,10]]}},"keywords":{}}],["that'",{"_index":374,"title":{},"content":{"11":{"position":[[228,6]]},"51":{"position":[[1732,6]]},"146":{"position":[[362,6]]},"334":{"position":[[362,6]]},"416":{"position":[[1088,6]]},"551":{"position":[[362,6]]},"653":{"position":[[1088,6]]}},"keywords":{}}],["thatlend",{"_index":1533,"title":{},"content":{"84":{"position":[[797,11]]},"253":{"position":[[797,11]]},"484":{"position":[[797,11]]}},"keywords":{}}],["thebackend",{"_index":3117,"title":{},"content":{"395":{"position":[[39,11]]},"632":{"position":[[39,11]]}},"keywords":{}}],["thecargo.toml",{"_index":1842,"title":{},"content":{"126":{"position":[[3496,13]]},"277":{"position":[[3664,13]]},"514":{"position":[[3496,13]]}},"keywords":{}}],["them."",{"_index":619,"title":{},"content":{"20":{"position":[[1085,11]]}},"keywords":{}}],["themselv",{"_index":2151,"title":{},"content":{"173":{"position":[[325,11]]},"267":{"position":[[20,10]]},"359":{"position":[[325,11]]},"407":{"position":[[20,10]]},"575":{"position":[[325,11]]},"644":{"position":[[20,10]]}},"keywords":{}}],["thenext",{"_index":1994,"title":{},"content":{"146":{"position":[[857,7]]},"334":{"position":[[861,7]]},"551":{"position":[[861,7]]}},"keywords":{}}],["theoffici",{"_index":3106,"title":{},"content":{"393":{"position":[[115,11]]},"630":{"position":[[115,11]]}},"keywords":{}}],["theoret",{"_index":2428,"title":{},"content":{"199":{"position":[[77,13]]},"435":{"position":[[77,13]]},"682":{"position":[[77,13]]}},"keywords":{}}],["thestorag",{"_index":1549,"title":{},"content":{"85":{"position":[[747,11]]},"254":{"position":[[747,11]]},"485":{"position":[[747,11]]}},"keywords":{}}],["thetransfer_ownership",{"_index":2298,"title":{},"content":{"189":{"position":[[514,23]]},"366":{"position":[[514,23]]},"582":{"position":[[514,23]]}},"keywords":{}}],["thing",{"_index":43,"title":{},"content":{"1":{"position":[[541,7]]},"31":{"position":[[2857,7]]},"38":{"position":[[344,7]]},"42":{"position":[[256,5]]},"52":{"position":[[454,6]]},"104":{"position":[[6,5]]},"128":{"position":[[320,5]]},"141":{"position":[[848,5]]},"196":{"position":[[569,7]]},"222":{"position":[[433,7]]},"279":{"position":[[320,5]]},"296":{"position":[[6,5]]},"321":{"position":[[81,5]]},"326":{"position":[[848,5]]},"396":{"position":[[10,5]]},"414":{"position":[[537,5]]},"416":{"position":[[3094,5]]},"432":{"position":[[506,7]]},"455":{"position":[[433,7]]},"508":{"position":[[6,5]]},"516":{"position":[[320,5]]},"535":{"position":[[848,5]]},"539":{"position":[[81,5]]},"633":{"position":[[10,5]]},"651":{"position":[[537,5]]},"653":{"position":[[3094,5]]},"679":{"position":[[506,7]]},"695":{"position":[[433,7]]}},"keywords":{}}],["think",{"_index":377,"title":{},"content":{"12":{"position":[[2,5]]},"594":{"position":[[514,8]]},"702":{"position":[[514,8]]}},"keywords":{}}],["third",{"_index":1013,"title":{},"content":{"40":{"position":[[44,5]]},"117":{"position":[[674,5]]},"298":{"position":[[674,5]]},"519":{"position":[[674,5]]}},"keywords":{}}],["those",{"_index":872,"title":{},"content":{"38":{"position":[[510,5]]},"98":{"position":[[104,5]]},"110":{"position":[[346,5]]},"126":{"position":[[239,5]]},"127":{"position":[[568,5]]},"134":{"position":[[110,5]]},"136":{"position":[[88,5]]},"141":{"position":[[553,6]]},"146":{"position":[[506,5],[561,5]]},"175":{"position":[[374,5]]},"277":{"position":[[239,5]]},"278":{"position":[[568,5]]},"290":{"position":[[104,5]]},"305":{"position":[[346,5]]},"314":{"position":[[110,5]]},"316":{"position":[[88,5]]},"326":{"position":[[553,6]]},"334":{"position":[[510,5],[565,5]]},"361":{"position":[[374,5]]},"502":{"position":[[104,5]]},"510":{"position":[[346,5]]},"514":{"position":[[239,5]]},"515":{"position":[[568,5]]},"531":{"position":[[110,5]]},"533":{"position":[[88,5]]},"535":{"position":[[553,6]]},"551":{"position":[[510,5],[565,5]]},"577":{"position":[[374,5]]}},"keywords":{}}],["though",{"_index":3455,"title":{},"content":{"440":{"position":[[5959,6]]},"687":{"position":[[5959,6]]}},"keywords":{}}],["three",{"_index":141,"title":{},"content":{"3":{"position":[[364,5]]},"52":{"position":[[1920,5]]},"184":{"position":[[10,5]]},"222":{"position":[[427,5]]},"375":{"position":[[10,5]]},"455":{"position":[[427,5]]},"591":{"position":[[10,5]]},"600":{"position":[[487,5]]},"695":{"position":[[427,5]]},"708":{"position":[[487,5]]}},"keywords":{}}],["thrive",{"_index":583,"title":{},"content":{"20":{"position":[[352,7]]}},"keywords":{}}],["through",{"_index":902,"title":{},"content":{"39":{"position":[[228,7]]},"84":{"position":[[121,7]]},"85":{"position":[[364,7]]},"126":{"position":[[1308,7]]},"180":{"position":[[45,7]]},"253":{"position":[[121,7]]},"254":{"position":[[364,7]]},"277":{"position":[[1476,7]]},"371":{"position":[[45,7]]},"383":{"position":[[150,7]]},"415":{"position":[[9,7]]},"477":{"position":[[3149,7],[4069,7]]},"484":{"position":[[121,7]]},"485":{"position":[[364,7]]},"514":{"position":[[1308,7]]},"587":{"position":[[45,7]]},"594":{"position":[[292,7]]},"612":{"position":[[1912,7]]},"625":{"position":[[150,7]]},"652":{"position":[[9,7]]},"699":{"position":[[3149,7],[4069,7]]},"702":{"position":[[292,7]]},"720":{"position":[[1912,7]]}},"keywords":{}}],["throughout",{"_index":867,"title":{},"content":{"38":{"position":[[376,10]]},"185":{"position":[[2950,10]]},"376":{"position":[[2934,10]]},"592":{"position":[[2934,10]]}},"keywords":{}}],["thrown",{"_index":1899,"title":{},"content":{"138":{"position":[[83,6],[1110,7]]},"318":{"position":[[83,6],[1102,7]]},"544":{"position":[[83,6],[1102,7]]}},"keywords":{}}],["thx",{"_index":933,"title":{},"content":{"39":{"position":[[966,4]]}},"keywords":{}}],["ticket",{"_index":3332,"title":{"437":{"position":[[0,9]]},"438":{"position":[[0,6]]},"684":{"position":[[0,9]]},"685":{"position":[[0,6]]}},"content":{"438":{"position":[[185,7]]},"439":{"position":[[158,6]]},"440":{"position":[[1066,8],[1994,6],[2581,6],[2595,8],[2704,7],[3020,6],[3182,8],[3438,7],[3493,6],[3636,6],[4137,7],[4206,7],[4383,6],[4464,6],[4519,6],[4679,6],[4742,6],[5910,7],[6011,7]]},"441":{"position":[[32,6],[135,7],[204,6],[230,8],[292,6],[399,6],[1441,6],[1728,9],[1801,9],[1859,6],[1899,6],[1960,9],[2219,8],[2655,9],[2977,6],[4092,6]]},"442":{"position":[[38,9]]},"685":{"position":[[185,7]]},"686":{"position":[[158,6]]},"687":{"position":[[1066,8],[1994,6],[2581,6],[2595,8],[2704,7],[3020,6],[3182,8],[3438,7],[3493,6],[3636,6],[4137,7],[4206,7],[4383,6],[4464,6],[4519,6],[4679,6],[4742,6],[5910,7],[6011,7]]},"688":{"position":[[32,6],[135,7],[204,6],[230,8],[292,6],[399,6],[1441,6],[1728,9],[1801,9],[1859,6],[1899,6],[1960,9],[2219,8],[2655,9],[2977,6],[4092,6]]},"689":{"position":[[38,9]]}},"keywords":{}}],["ticket.pric",{"_index":3408,"title":{},"content":{"440":{"position":[[2873,12]]},"687":{"position":[[2873,12]]}},"keywords":{}}],["ticket.statu",{"_index":3406,"title":{},"content":{"440":{"position":[[2727,13],[3113,13]]},"687":{"position":[[2727,13],[3113,13]]}},"keywords":{}}],["ticket_contract",{"_index":3488,"title":{},"content":{"441":{"position":[[1327,15]]},"688":{"position":[[1327,15]]}},"keywords":{}}],["ticket_contract.buy_ticket(ticket_id",{"_index":3491,"title":{},"content":{"441":{"position":[[1471,37]]},"688":{"position":[[1471,37]]}},"keywords":{}}],["ticket_id",{"_index":3359,"title":{},"content":{"440":{"position":[[618,10],[715,10],[1884,10],[2179,10],[2265,10],[3221,10]]},"441":{"position":[[1104,10],[3140,10]]},"687":{"position":[[618,10],[715,10],[1884,10],[2179,10],[2265,10],[3221,10]]},"688":{"position":[[1104,10],[3140,10]]}},"keywords":{}}],["ticket_offic",{"_index":3523,"title":{},"content":{"441":{"position":[[5040,13]]},"688":{"position":[[5040,13]]}},"keywords":{}}],["ticket_office.issue_ticket("ev".to_str",{"_index":3526,"title":{},"content":{"441":{"position":[[5171,54],[5244,54]]},"688":{"position":[[5171,54],[5244,54]]}},"keywords":{}}],["ticket_office.register_operator(operator.address().clon",{"_index":3525,"title":{},"content":{"441":{"position":[[5110,60]]},"688":{"position":[[5110,60]]}},"keywords":{}}],["ticket_office_address",{"_index":3482,"title":{},"content":{"441":{"position":[[798,22],[912,22],[1227,22]]},"688":{"position":[[798,22],[912,22],[1227,22]]}},"keywords":{}}],["ticket_oper",{"_index":3474,"title":{},"content":{"441":{"position":[[503,15]]},"688":{"position":[[503,15]]}},"keywords":{}}],["ticket_operator::ticketoperatorhostref",{"_index":3520,"title":{},"content":{"441":{"position":[[4644,39]]},"688":{"position":[[4644,39]]}},"keywords":{}}],["ticketdoesnotexist",{"_index":3368,"title":{},"content":{"440":{"position":[[872,18]]},"687":{"position":[[872,18]]}},"keywords":{}}],["ticketid",{"_index":3353,"title":{},"content":{"440":{"position":[[398,8],[629,9],[726,9],[2276,9],[3532,8]]},"441":{"position":[[1115,9],[3151,9],[4699,9],[5771,9]]},"687":{"position":[[398,8],[629,9],[726,9],[2276,9],[3532,8]]},"688":{"position":[[1115,9],[3151,9],[4699,9],[5771,9]]}},"keywords":{}}],["ticketinfo",{"_index":3356,"title":{},"content":{"440":{"position":[[506,10],[2040,10],[3446,10]]},"687":{"position":[[506,10],[2040,10],[3446,10]]}},"keywords":{}}],["ticketinfo>",{"_index":3372,"title":{},"content":{"440":{"position":[[1096,15]]},"687":{"position":[[1096,15]]}},"keywords":{}}],["ticketnotavailableforsal",{"_index":3362,"title":{},"content":{"440":{"position":[[791,25]]},"687":{"position":[[791,25]]}},"keywords":{}}],["ticketoffic",{"_index":3334,"title":{},"content":{"438":{"position":[[4,12],[289,13]]},"440":{"position":[[29,12],[985,12],[1135,12],[3790,12]]},"441":{"position":[[2049,12],[2155,12],[2373,12],[2445,12]]},"685":{"position":[[4,12],[289,13]]},"687":{"position":[[29,12],[985,12],[1135,12],[3790,12]]},"688":{"position":[[2049,12],[2155,12],[2373,12],[2445,12]]}},"keywords":{}}],["ticketofficecontractref",{"_index":3477,"title":{},"content":{"441":{"position":[[572,25],[2006,23],[4709,24]]},"688":{"position":[[572,25],[2006,23],[4709,24]]}},"keywords":{}}],["ticketofficecontractref::deploy(&env",{"_index":3524,"title":{},"content":{"441":{"position":[[5056,41]]},"688":{"position":[[5056,41]]}},"keywords":{}}],["ticketofficecontractref::new(env",{"_index":3489,"title":{},"content":{"441":{"position":[[1345,33]]},"688":{"position":[[1345,33]]}},"keywords":{}}],["ticketofficehostref",{"_index":3439,"title":{},"content":{"440":{"position":[[4891,20]]},"687":{"position":[[4891,20]]}},"keywords":{}}],["ticketofficehostref::deploy(&env",{"_index":3444,"title":{},"content":{"440":{"position":[[5162,37]]},"687":{"position":[[5162,37]]}},"keywords":{}}],["ticketofficeinitarg",{"_index":3440,"title":{},"content":{"440":{"position":[[4912,22],[5003,20]]},"441":{"position":[[4734,22],[4828,20]]},"687":{"position":[[4912,22],[5003,20]]},"688":{"position":[[4734,22],[4828,20]]}},"keywords":{}}],["ticketoper",{"_index":3481,"title":{},"content":{"441":{"position":[[781,14],[864,14],[1675,14],[2188,14]]},"688":{"position":[[781,14],[864,14],[1675,14],[2188,14]]}},"keywords":{}}],["ticketoperatorcontractref::new(self.env",{"_index":3499,"title":{},"content":{"441":{"position":[[2705,42]]},"688":{"position":[[2705,42]]}},"keywords":{}}],["ticketoperatorhostref::deploy(&env",{"_index":3522,"title":{},"content":{"441":{"position":[[4983,39]]},"688":{"position":[[4983,39]]}},"keywords":{}}],["tickets.l58",{"_index":3421,"title":{},"content":{"440":{"position":[[3920,11]]},"687":{"position":[[3920,11]]}},"keywords":{}}],["tickets.tri",{"_index":3432,"title":{},"content":{"440":{"position":[[4658,11],[4714,11]]},"687":{"position":[[4658,11],[4714,11]]}},"keywords":{}}],["tickets.us",{"_index":3338,"title":{},"content":{"438":{"position":[[158,13]]},"685":{"position":[[158,13]]}},"keywords":{}}],["ticketstatu",{"_index":3354,"title":{},"content":{"440":{"position":[[442,12],[560,13],[3393,12]]},"687":{"position":[[442,12],[560,13],[3393,12]]}},"keywords":{}}],["ticketstatus::avail",{"_index":3396,"title":{},"content":{"440":{"position":[[2100,24],[2744,23]]},"687":{"position":[[2100,24],[2744,23]]}},"keywords":{}}],["ticketstatus::sold",{"_index":3413,"title":{},"content":{"440":{"position":[[3129,19]]},"687":{"position":[[3129,19]]}},"keywords":{}}],["time",{"_index":80,"title":{},"content":{"1":{"position":[[988,5]]},"6":{"position":[[117,4]]},"9":{"position":[[5,4]]},"15":{"position":[[97,5]]},"21":{"position":[[132,4]]},"23":{"position":[[142,4]]},"32":{"position":[[5,4]]},"33":{"position":[[136,4]]},"52":{"position":[[4817,4]]},"72":{"position":[[98,5]]},"92":{"position":[[391,4]]},"95":{"position":[[426,5]]},"100":{"position":[[274,4]]},"106":{"position":[[62,4]]},"110":{"position":[[588,5]]},"111":{"position":[[362,5]]},"127":{"position":[[711,4]]},"162":{"position":[[1951,4]]},"163":{"position":[[274,5]]},"164":{"position":[[74,5]]},"198":{"position":[[2165,4]]},"203":{"position":[[375,5]]},"223":{"position":[[1326,4]]},"236":{"position":[[98,5]]},"273":{"position":[[62,4]]},"278":{"position":[[711,4]]},"284":{"position":[[391,4]]},"287":{"position":[[426,5]]},"292":{"position":[[274,4]]},"305":{"position":[[588,5]]},"306":{"position":[[362,5]]},"351":{"position":[[1973,4]]},"352":{"position":[[274,5]]},"353":{"position":[[74,5]]},"395":{"position":[[1282,4],[1326,4],[1399,7]]},"416":{"position":[[706,4],[1036,4],[1963,4],[2351,4]]},"419":{"position":[[1077,4],[4481,4]]},"423":{"position":[[375,5]]},"434":{"position":[[2155,4]]},"438":{"position":[[233,4]]},"456":{"position":[[1326,4]]},"472":{"position":[[98,5]]},"490":{"position":[[62,4]]},"496":{"position":[[391,4]]},"499":{"position":[[426,5]]},"504":{"position":[[274,4]]},"510":{"position":[[588,5]]},"511":{"position":[[362,5]]},"515":{"position":[[711,4]]},"567":{"position":[[1973,4]]},"568":{"position":[[274,5]]},"569":{"position":[[74,5]]},"601":{"position":[[1225,4]]},"632":{"position":[[1282,4],[1326,4],[1399,7]]},"653":{"position":[[706,4],[1036,4],[1963,4],[2351,4]]},"656":{"position":[[1077,4],[4481,4]]},"665":{"position":[[375,5]]},"681":{"position":[[2165,4]]},"685":{"position":[[233,4]]},"696":{"position":[[1326,4]]},"709":{"position":[[1225,4]]}},"keywords":{}}],["time_diff",{"_index":2136,"title":{},"content":{"168":{"position":[[1802,10]]},"348":{"position":[[1802,10]]},"564":{"position":[[1802,10]]}},"keywords":{}}],["timea",{"_index":881,"title":{},"content":{"38":{"position":[[752,5]]}},"keywords":{}}],["timelockwallet",{"_index":3536,"title":{},"content":{"476":{"position":[[35,14],[260,14],[420,14]]},"477":{"position":[[315,14]]},"478":{"position":[[111,14]]},"698":{"position":[[35,14],[260,14],[420,14]]},"699":{"position":[[315,14]]},"700":{"position":[[111,14]]}},"keywords":{}}],["timelockwallethostref::deploy",{"_index":3573,"title":{},"content":{"477":{"position":[[1849,30]]},"699":{"position":[[1849,30]]}},"keywords":{}}],["timelockwalletinitarg",{"_index":3568,"title":{},"content":{"477":{"position":[[1591,24],[1890,22]]},"699":{"position":[[1591,24],[1890,22]]}},"keywords":{}}],["timestamp",{"_index":3681,"title":{},"content":{"600":{"position":[[385,9]]},"708":{"position":[[385,9]]}},"keywords":{}}],["tlw_on_livenet",{"_index":3581,"title":{},"content":{"477":{"position":[[2518,14]]},"699":{"position":[[2518,14]]}},"keywords":{}}],["to/from",{"_index":1990,"title":{},"content":{"146":{"position":[[237,7]]},"178":{"position":[[251,7]]},"334":{"position":[[237,7]]},"369":{"position":[[251,7]]},"551":{"position":[[237,7]]},"585":{"position":[[251,7]]}},"keywords":{}}],["to_bal",{"_index":533,"title":{},"content":{"17":{"position":[[2845,10],[3057,10],[3260,10],[3614,10]]}},"keywords":{}}],["to_byt",{"_index":1685,"title":{},"content":{"103":{"position":[[179,8],[422,8]]},"295":{"position":[[179,8],[422,8]]},"507":{"position":[[179,8],[422,8]]}},"keywords":{}}],["tobyt",{"_index":2143,"title":{},"content":{"168":{"position":[[2049,7]]},"212":{"position":[[150,9]]},"229":{"position":[[228,7]]},"267":{"position":[[2278,7],[2813,7]]},"348":{"position":[[2049,7]]},"391":{"position":[[150,9]]},"407":{"position":[[2278,7],[2813,7]]},"460":{"position":[[228,7]]},"564":{"position":[[2049,7]]},"644":{"position":[[2278,7],[2813,7]]},"661":{"position":[[150,9]]}},"keywords":{}}],["tobytes>(&self",{"_index":2861,"title":{},"content":{"267":{"position":[[2602,22],[2874,22]]},"407":{"position":[[2602,22],[2874,22]]},"644":{"position":[[2602,22],[2874,22]]}},"keywords":{}}],["tobytes>(key",{"_index":2852,"title":{},"content":{"267":{"position":[[2214,16]]},"407":{"position":[[2214,16]]},"644":{"position":[[2214,16]]}},"keywords":{}}],["today",{"_index":93,"title":{},"content":{"2":{"position":[[66,6]]}},"keywords":{}}],["todo",{"_index":3730,"title":{},"content":{"602":{"position":[[1005,4],[1231,6],[1462,5],[1538,6],[1617,5],[1709,6]]},"710":{"position":[[1005,4],[1231,6],[1462,5],[1538,6],[1617,5],[1709,6]]}},"keywords":{}}],["todo.complet",{"_index":3742,"title":{},"content":{"602":{"position":[[1649,14],[1666,16]]},"710":{"position":[[1649,14],[1666,16]]}},"keywords":{}}],["todo.text",{"_index":3739,"title":{},"content":{"602":{"position":[[1494,9]]},"710":{"position":[[1494,9]]}},"keywords":{}}],["togeth",{"_index":2095,"title":{},"content":{"163":{"position":[[1553,9]]},"352":{"position":[[1575,9]]},"568":{"position":[[1575,9]]}},"keywords":{}}],["toggle_complete(&mut",{"_index":3741,"title":{},"content":{"602":{"position":[[1556,24]]},"710":{"position":[[1556,24]]}},"keywords":{}}],["token",{"_index":449,"title":{"159":{"position":[[7,5]]},"188":{"position":[[0,7]]},"344":{"position":[[7,5]]},"365":{"position":[[0,7]]},"392":{"position":[[12,5]]},"394":{"position":[[8,7]]},"397":{"position":[[13,6]]},"413":{"position":[[15,6]]},"414":{"position":[[0,5]]},"561":{"position":[[7,5]]},"581":{"position":[[0,7]]},"629":{"position":[[12,5]]},"631":{"position":[[8,7]]},"634":{"position":[[13,6]]},"650":{"position":[[15,6]]},"651":{"position":[[0,5]]}},"content":{"17":{"position":[[42,5]]},"39":{"position":[[3236,5]]},"43":{"position":[[105,5]]},"70":{"position":[[279,7]]},"71":{"position":[[596,6]]},"79":{"position":[[758,7]]},"80":{"position":[[288,7],[625,5],[811,5]]},"84":{"position":[[225,5],[304,5],[455,5],[767,5],[890,5]]},"85":{"position":[[487,5],[588,5]]},"100":{"position":[[34,5],[1003,7]]},"101":{"position":[[704,7]]},"102":{"position":[[53,5]]},"126":{"position":[[2428,5],[2910,5]]},"152":{"position":[[33,5]]},"160":{"position":[[28,6]]},"188":{"position":[[732,6],[807,6]]},"202":{"position":[[292,6]]},"204":{"position":[[1122,5]]},"206":{"position":[[1180,6],[2662,6],[2793,6]]},"230":{"position":[[775,7]]},"231":{"position":[[288,7],[625,5],[811,5]]},"234":{"position":[[279,7]]},"235":{"position":[[596,6]]},"253":{"position":[[225,5],[304,5],[455,5],[767,5],[890,5]]},"254":{"position":[[487,5],[588,5]]},"267":{"position":[[3873,5]]},"269":{"position":[[5090,6]]},"277":{"position":[[1130,5],[2596,5],[3078,5]]},"292":{"position":[[34,5],[1003,7]]},"293":{"position":[[704,7]]},"294":{"position":[[53,5]]},"343":{"position":[[33,5]]},"345":{"position":[[28,6]]},"346":{"position":[[89,6]]},"365":{"position":[[103,7],[1089,6],[1164,6]]},"394":{"position":[[364,6],[400,7],[545,7]]},"395":{"position":[[309,6],[933,5],[1062,7],[5097,5],[6801,6],[6864,6]]},"396":{"position":[[114,5],[587,6],[697,5],[763,5],[829,6],[1002,7],[1055,6],[1086,6]]},"397":{"position":[[228,6]]},"398":{"position":[[30,5]]},"407":{"position":[[3873,5]]},"409":{"position":[[5090,6]]},"413":{"position":[[62,6],[168,5],[203,7]]},"414":{"position":[[172,5],[234,6],[321,5]]},"415":{"position":[[170,7],[335,5],[370,7]]},"416":{"position":[[59,6],[105,6],[185,5],[342,5],[451,5],[467,6],[976,6],[1269,5],[1343,5],[1662,5],[2176,7],[2900,6],[3172,6],[3232,6],[3384,6],[4191,6],[4758,7],[4919,6]]},"417":{"position":[[354,5],[437,5],[487,6],[527,5],[675,6],[884,6],[1169,6]]},"418":{"position":[[15,5]]},"419":{"position":[[315,6],[569,5],[822,5],[838,6],[1472,5],[1539,6],[1667,5],[2342,6],[2412,6],[2493,5],[2574,6],[2752,6],[2937,6],[3341,6],[3468,6],[3650,6],[3790,6],[4179,5],[4855,6],[5770,6],[6769,5],[6852,5],[6902,6],[6942,5],[7090,6],[7299,6],[7584,6]]},"422":{"position":[[292,6]]},"424":{"position":[[1072,5]]},"426":{"position":[[1175,6],[2647,6],[2778,6]]},"439":{"position":[[19,5]]},"440":{"position":[[1000,6],[1787,5],[2416,6],[3850,6],[4170,6],[6127,5]]},"441":{"position":[[4037,5]]},"461":{"position":[[775,7]]},"462":{"position":[[288,7],[625,5],[811,5]]},"470":{"position":[[279,7]]},"471":{"position":[[596,6]]},"476":{"position":[[597,6],[1188,6]]},"477":{"position":[[3865,7]]},"478":{"position":[[146,6]]},"484":{"position":[[225,5],[304,5],[455,5],[767,5],[890,5]]},"485":{"position":[[487,5],[588,5]]},"504":{"position":[[34,5],[1003,7]]},"505":{"position":[[704,7]]},"506":{"position":[[53,5]]},"514":{"position":[[2428,5],[2910,5]]},"557":{"position":[[33,5]]},"562":{"position":[[28,6]]},"581":{"position":[[103,7],[1089,6],[1164,6]]},"631":{"position":[[364,6],[400,7],[545,7]]},"632":{"position":[[309,6],[933,5],[1062,7],[5097,5],[6801,6],[6864,6]]},"633":{"position":[[114,5],[587,6],[697,5],[763,5],[829,6],[1002,7],[1055,6],[1086,6]]},"634":{"position":[[228,6]]},"635":{"position":[[30,5]]},"644":{"position":[[3873,5]]},"646":{"position":[[5090,6]]},"650":{"position":[[62,6],[168,5],[203,7]]},"651":{"position":[[172,5],[234,6],[321,5]]},"652":{"position":[[170,7],[335,5],[370,7]]},"653":{"position":[[59,6],[105,6],[185,5],[342,5],[451,5],[467,6],[976,6],[1269,5],[1343,5],[1662,5],[2176,7],[2900,6],[3172,6],[3232,6],[3384,6],[4191,6],[4758,7],[4919,6]]},"654":{"position":[[354,5],[437,5],[487,6],[527,5],[675,6],[884,6],[1169,6]]},"655":{"position":[[15,5]]},"656":{"position":[[315,6],[569,5],[822,5],[838,6],[1472,5],[1539,6],[1667,5],[2342,6],[2412,6],[2493,5],[2574,6],[2752,6],[2937,6],[3341,6],[3468,6],[3650,6],[3790,6],[4179,5],[4855,6],[5770,6],[6769,5],[6852,5],[6902,6],[6942,5],[7090,6],[7299,6],[7584,6]]},"664":{"position":[[292,6]]},"666":{"position":[[1072,5]]},"668":{"position":[[1180,6],[2662,6],[2793,6]]},"686":{"position":[[19,5]]},"687":{"position":[[1000,6],[1787,5],[2416,6],[3850,6],[4170,6],[6127,5]]},"688":{"position":[[4037,5]]},"698":{"position":[[597,6],[1188,6]]},"699":{"position":[[3865,7]]},"700":{"position":[[146,6]]}},"keywords":{}}],["token>",{"_index":1484,"title":{},"content":{"80":{"position":[[325,10]]},"231":{"position":[[325,10]]},"462":{"position":[[325,10]]}},"keywords":{}}],["token).balance_of(account",{"_index":2887,"title":{},"content":{"267":{"position":[[3977,26]]},"407":{"position":[[3977,26]]},"644":{"position":[[3977,26]]}},"keywords":{}}],["token.address().to_str",{"_index":1826,"title":{},"content":{"126":{"position":[[2580,29]]},"277":{"position":[[2748,29]]},"395":{"position":[[1009,29]]},"514":{"position":[[2580,29]]},"632":{"position":[[1009,29]]}},"keywords":{}}],["token.balance_of(&address",{"_index":1493,"title":{},"content":{"80":{"position":[[681,30]]},"231":{"position":[[681,30]]},"462":{"position":[[681,30]]}},"keywords":{}}],["token.balance_of(&own",{"_index":3144,"title":{},"content":{"395":{"position":[[1617,30]]},"632":{"position":[[1617,30]]}},"keywords":{}}],["token.balance_of(&recipi",{"_index":3148,"title":{},"content":{"395":{"position":[[1704,32]]},"632":{"position":[[1704,32]]}},"keywords":{}}],["token.balance_of(own",{"_index":1838,"title":{},"content":{"126":{"position":[[3293,25]]},"277":{"position":[[3461,25]]},"514":{"position":[[3293,25]]}},"keywords":{}}],["token.balance_of(recipi",{"_index":1840,"title":{},"content":{"126":{"position":[[3367,29]]},"277":{"position":[[3535,29]]},"514":{"position":[[3367,29]]}},"keywords":{}}],["token.mint(amount",{"_index":1495,"title":{},"content":{"80":{"position":[[867,18]]},"231":{"position":[[867,18]]},"462":{"position":[[867,18]]}},"keywords":{}}],["token.nam",{"_index":1833,"title":{},"content":{"126":{"position":[[3052,14]]},"277":{"position":[[3220,14]]},"514":{"position":[[3052,14]]}},"keywords":{}}],["token.propose_new_mint(env.get_account(1",{"_index":3278,"title":{},"content":{"417":{"position":[[570,42],[1239,42]]},"419":{"position":[[6985,42],[7654,42]]},"654":{"position":[[570,42],[1239,42]]},"656":{"position":[[6985,42],[7654,42]]}},"keywords":{}}],["token.propose_new_mint(recipi",{"_index":3130,"title":{},"content":{"395":{"position":[[1101,33]]},"632":{"position":[[1101,33]]}},"keywords":{}}],["token.t",{"_index":3143,"title":{},"content":{"395":{"position":[[1535,14]]},"417":{"position":[[862,14],[1495,14]]},"419":{"position":[[7277,14],[7910,14]]},"632":{"position":[[1535,14]]},"654":{"position":[[862,14],[1495,14]]},"656":{"position":[[7277,14],[7910,14]]}},"keywords":{}}],["token.transfer(recipi",{"_index":1835,"title":{},"content":{"126":{"position":[[3204,25]]},"277":{"position":[[3372,25]]},"514":{"position":[[3204,25]]}},"keywords":{}}],["token.vote(fals",{"_index":3287,"title":{},"content":{"417":{"position":[[1418,17]]},"419":{"position":[[7833,17]]},"654":{"position":[[1418,17]]},"656":{"position":[[7833,17]]}},"keywords":{}}],["token.vote(tru",{"_index":3134,"title":{},"content":{"395":{"position":[[1218,16]]},"417":{"position":[[632,16],[1301,16]]},"419":{"position":[[7047,16],[7716,16]]},"632":{"position":[[1218,16]]},"654":{"position":[[632,16],[1301,16]]},"656":{"position":[[7047,16],[7716,16]]}},"keywords":{}}],["token::cep78",{"_index":3352,"title":{},"content":{"440":{"position":[[372,13]]},"687":{"position":[[372,13]]}},"keywords":{}}],["token::{error",{"_index":3521,"title":{},"content":{"441":{"position":[[4684,14]]},"688":{"position":[[4684,14]]}},"keywords":{}}],["token_hash",{"_index":3459,"title":{},"content":{"440":{"position":[[6298,11]]},"687":{"position":[[6298,11]]}},"keywords":{}}],["token_id",{"_index":3387,"title":{},"content":{"440":{"position":[[1804,9],[1901,8],[6270,9]]},"687":{"position":[[1804,9],[1901,8],[6270,9]]}},"keywords":{}}],["token_nam",{"_index":1455,"title":{},"content":{"79":{"position":[[873,11]]},"80":{"position":[[553,11],[737,11]]},"230":{"position":[[890,11]]},"231":{"position":[[553,11],[737,11]]},"461":{"position":[[890,11]]},"462":{"position":[[553,11],[737,11]]}},"keywords":{}}],["tokencontractref::new(env",{"_index":2886,"title":{},"content":{"267":{"position":[[3950,26]]},"407":{"position":[[3950,26]]},"644":{"position":[[3950,26]]}},"keywords":{}}],["tokens"",{"_index":3115,"title":{},"content":{"394":{"position":[[314,12]]},"631":{"position":[[314,12]]}},"keywords":{}}],["tokens,and",{"_index":1155,"title":{},"content":{"43":{"position":[[1741,10]]}},"keywords":{}}],["tokens.en",{"_index":2753,"title":{},"content":{"245":{"position":[[102,13]]},"444":{"position":[[102,13]]},"671":{"position":[[102,13]]}},"keywords":{}}],["tokens.if",{"_index":3217,"title":{},"content":{"416":{"position":[[155,9]]},"653":{"position":[[155,9]]}},"keywords":{}}],["tokio::runtime::runtime::new().unwrap",{"_index":2659,"title":{},"content":{"212":{"position":[[3248,40]]},"391":{"position":[[3266,40]]},"661":{"position":[[3266,40]]}},"keywords":{}}],["toler",{"_index":3775,"title":{},"content":{"606":{"position":[[1165,11]]},"714":{"position":[[1165,11]]}},"keywords":{}}],["ton",{"_index":49,"title":{},"content":{"1":{"position":[[638,4]]},"20":{"position":[[393,3]]}},"keywords":{}}],["took",{"_index":1859,"title":{},"content":{"127":{"position":[[762,4]]},"278":{"position":[[762,4]]},"515":{"position":[[762,4]]}},"keywords":{}}],["tool",{"_index":31,"title":{},"content":{"1":{"position":[[334,4],[453,5]]},"16":{"position":[[24,4]]},"20":{"position":[[430,8]]},"22":{"position":[[1404,4]]},"40":{"position":[[31,5]]},"52":{"position":[[2201,5]]},"66":{"position":[[67,5],[155,4]]},"94":{"position":[[45,8]]},"97":{"position":[[173,4]]},"173":{"position":[[136,4],[216,6],[319,5]]},"174":{"position":[[24,4]]},"210":{"position":[[345,5]]},"241":{"position":[[67,5],[155,4]]},"286":{"position":[[45,8]]},"289":{"position":[[173,4]]},"359":{"position":[[136,4],[216,6],[319,5]]},"360":{"position":[[24,4]]},"389":{"position":[[345,5]]},"398":{"position":[[276,5]]},"418":{"position":[[81,5]]},"466":{"position":[[67,5],[155,4]]},"498":{"position":[[45,8]]},"501":{"position":[[173,4]]},"575":{"position":[[136,4],[216,6],[319,5]]},"576":{"position":[[24,4]]},"635":{"position":[[276,5]]},"655":{"position":[[81,5]]},"659":{"position":[[345,5]]}},"keywords":{}}],["toolchain",{"_index":2148,"title":{},"content":{"173":{"position":[[91,9],[347,9]]},"195":{"position":[[427,9]]},"261":{"position":[[101,10]]},"359":{"position":[[91,9],[347,9]]},"379":{"position":[[101,10]]},"401":{"position":[[101,10]]},"431":{"position":[[427,9]]},"575":{"position":[[91,9],[347,9]]},"621":{"position":[[101,10]]},"638":{"position":[[101,10]]},"678":{"position":[[427,9]]}},"keywords":{}}],["top",{"_index":1423,"title":{},"content":{"76":{"position":[[744,3]]},"95":{"position":[[118,3]]},"102":{"position":[[207,3],[498,3]]},"227":{"position":[[744,3]]},"287":{"position":[[118,3]]},"294":{"position":[[207,3],[498,3]]},"396":{"position":[[288,3]]},"458":{"position":[[744,3]]},"499":{"position":[[118,3]]},"506":{"position":[[207,3],[498,3]]},"633":{"position":[[288,3]]}},"keywords":{}}],["topic",{"_index":1426,"title":{},"content":{"76":{"position":[[908,7]]},"227":{"position":[[908,7]]},"458":{"position":[[908,7]]},"618":{"position":[[703,7]]},"726":{"position":[[703,7]]}},"keywords":{}}],["total",{"_index":2505,"title":{},"content":{"206":{"position":[[816,5]]},"269":{"position":[[4726,5]]},"396":{"position":[[622,5]]},"409":{"position":[[4726,5]]},"419":{"position":[[2554,5]]},"426":{"position":[[816,5]]},"438":{"position":[[269,5]]},"633":{"position":[[622,5]]},"646":{"position":[[4726,5]]},"656":{"position":[[2554,5]]},"668":{"position":[[816,5]]},"685":{"position":[[269,5]]}},"keywords":{}}],["total_suppli",{"_index":516,"title":{},"content":{"17":{"position":[[2066,13],[2307,13],[2488,14]]},"203":{"position":[[229,13]]},"269":{"position":[[397,13]]},"384":{"position":[[410,13]]},"409":{"position":[[397,13]]},"423":{"position":[[229,13]]},"440":{"position":[[1229,13],[1391,13],[5121,13]]},"441":{"position":[[4946,13]]},"626":{"position":[[410,13]]},"646":{"position":[[397,13]]},"665":{"position":[[229,13]]},"687":{"position":[[1229,13],[1391,13],[5121,13]]},"688":{"position":[[4946,13]]}},"keywords":{}}],["total_supply(&mut",{"_index":1454,"title":{},"content":{"79":{"position":[[845,21]]},"230":{"position":[[862,21]]},"461":{"position":[[862,21]]}},"keywords":{}}],["total_supply(&self",{"_index":526,"title":{},"content":{"17":{"position":[[2512,23]]},"115":{"position":[[916,23]]},"204":{"position":[[530,23]]},"247":{"position":[[506,23]]},"258":{"position":[[878,23]]},"419":{"position":[[2584,23]]},"424":{"position":[[505,23]]},"446":{"position":[[506,23]]},"481":{"position":[[878,23]]},"656":{"position":[[2584,23]]},"666":{"position":[[505,23]]},"673":{"position":[[506,23]]}},"keywords":{}}],["track",{"_index":1429,"title":{},"content":{"78":{"position":[[150,5]]},"95":{"position":[[399,5]]},"229":{"position":[[150,5]]},"287":{"position":[[399,5]]},"416":{"position":[[1018,5]]},"460":{"position":[[150,5]]},"499":{"position":[[399,5]]},"653":{"position":[[1018,5]]}},"keywords":{}}],["trait",{"_index":1514,"title":{},"content":{"83":{"position":[[542,5]]},"91":{"position":[[796,6]]},"141":{"position":[[993,6],[1004,5],[1243,5],[1445,7]]},"148":{"position":[[258,6],[848,5]]},"178":{"position":[[1264,6]]},"188":{"position":[[283,5],[371,5],[657,5]]},"197":{"position":[[1601,6]]},"252":{"position":[[542,5]]},"267":{"position":[[3867,5]]},"268":{"position":[[1981,5]]},"283":{"position":[[796,6]]},"326":{"position":[[993,6],[1004,5],[1243,5],[1445,7]]},"336":{"position":[[258,6],[848,5]]},"365":{"position":[[640,5],[728,5],[1014,5]]},"369":{"position":[[1264,6]]},"407":{"position":[[3867,5]]},"408":{"position":[[1981,5]]},"433":{"position":[[1600,6]]},"483":{"position":[[542,5]]},"495":{"position":[[796,6]]},"535":{"position":[[993,6],[1004,5],[1243,5],[1445,7]]},"553":{"position":[[258,6],[848,5]]},"581":{"position":[[640,5],[728,5],[1014,5]]},"585":{"position":[[1264,6]]},"602":{"position":[[706,6]]},"613":{"position":[[507,5],[1770,7],[1955,6],[2103,5]]},"644":{"position":[[3867,5]]},"645":{"position":[[1981,5]]},"680":{"position":[[1600,6]]},"710":{"position":[[706,6]]},"721":{"position":[[507,5],[1770,7],[1955,6],[2103,5]]}},"keywords":{}}],["transact",{"_index":1298,"title":{"53":{"position":[[13,12]]}},"content":{"53":{"position":[[92,13]]},"71":{"position":[[634,11]]},"235":{"position":[[634,11]]},"396":{"position":[[793,12],[859,11]]},"471":{"position":[[634,11]]},"617":{"position":[[1409,11]]},"633":{"position":[[793,12],[859,11]]},"725":{"position":[[1409,11]]}},"keywords":{}}],["transaction_default",{"_index":1242,"title":{},"content":{"52":{"position":[[735,20],[915,20]]}},"keywords":{}}],["transfer",{"_index":967,"title":{"397":{"position":[[0,12]]},"634":{"position":[[0,12]]}},"content":{"39":{"position":[[1995,8]]},"43":{"position":[[1752,8],[2057,8]]},"92":{"position":[[134,8],[282,9],[590,8],[702,9],[738,11]]},"110":{"position":[[560,10]]},"127":{"position":[[748,8],[937,8]]},"152":{"position":[[39,10]]},"189":{"position":[[487,11],[615,11]]},"203":{"position":[[110,10]]},"204":{"position":[[898,8]]},"205":{"position":[[86,9]]},"206":{"position":[[908,8],[1171,8],[1570,8],[1813,8],[2652,9],[2804,11],[3604,8]]},"267":{"position":[[922,11],[1068,11],[1598,8],[3323,12]]},"269":{"position":[[289,11],[3401,8],[3900,10],[4818,8],[5081,8],[5480,8],[5723,8]]},"278":{"position":[[748,8],[937,8]]},"284":{"position":[[134,8],[282,9],[590,8],[702,9],[738,11]]},"305":{"position":[[560,10]]},"343":{"position":[[39,10]]},"346":{"position":[[75,8]]},"366":{"position":[[487,11],[615,11]]},"383":{"position":[[1120,8]]},"384":{"position":[[286,10],[3411,8]]},"396":{"position":[[906,9]]},"397":{"position":[[98,12],[324,8]]},"407":{"position":[[922,11],[1068,11],[1598,8],[3323,12]]},"409":{"position":[[289,11],[3401,8],[3900,10],[4818,8],[5081,8],[5480,8],[5723,8]]},"416":{"position":[[2880,8],[3159,8],[4166,8]]},"419":{"position":[[3331,9],[3458,9],[4835,8],[5745,8]]},"423":{"position":[[110,10]]},"424":{"position":[[849,8]]},"425":{"position":[[86,9]]},"426":{"position":[[908,8],[1166,8],[1565,8],[1803,8],[2637,9],[2789,11],[3579,8]]},"440":{"position":[[2931,8],[3007,8],[4450,9],[6116,8],[6245,9]]},"441":{"position":[[221,8],[2964,8],[3441,8],[4079,8],[4191,8]]},"496":{"position":[[134,8],[282,9],[590,8],[702,9],[738,11]]},"510":{"position":[[560,10]]},"515":{"position":[[748,8],[937,8]]},"557":{"position":[[39,10]]},"582":{"position":[[487,11],[615,11]]},"604":{"position":[[109,8],[290,8],[433,8]]},"625":{"position":[[1120,8]]},"626":{"position":[[286,10],[3411,8]]},"633":{"position":[[906,9]]},"634":{"position":[[98,12],[324,8]]},"644":{"position":[[922,11],[1068,11],[1598,8],[3323,12]]},"646":{"position":[[289,11],[3401,8],[3900,10],[4818,8],[5081,8],[5480,8],[5723,8]]},"653":{"position":[[2880,8],[3159,8],[4166,8]]},"656":{"position":[[3331,9],[3458,9],[4835,8],[5745,8]]},"665":{"position":[[110,10]]},"666":{"position":[[849,8]]},"667":{"position":[[86,9]]},"668":{"position":[[908,8],[1171,8],[1570,8],[1813,8],[2652,9],[2804,11],[3604,8]]},"687":{"position":[[2931,8],[3007,8],[4450,9],[6116,8],[6245,9]]},"688":{"position":[[221,8],[2964,8],[3441,8],[4079,8],[4191,8]]},"712":{"position":[[109,8],[290,8],[433,8]]}},"keywords":{}}],["transfer(&contract",{"_index":3245,"title":{},"content":{"416":{"position":[[2950,24]]},"653":{"position":[[2950,24]]}},"keywords":{}}],["transfer(&mut",{"_index":530,"title":{},"content":{"17":{"position":[[2694,17]]},"115":{"position":[[587,17],[2485,17]]},"205":{"position":[[293,17]]},"247":{"position":[[800,17]]},"258":{"position":[[573,17],[2427,17]]},"269":{"position":[[1039,17]]},"384":{"position":[[1052,17]]},"409":{"position":[[1039,17]]},"419":{"position":[[3385,17]]},"425":{"position":[[268,17]]},"446":{"position":[[800,17]]},"481":{"position":[[573,17],[2427,17]]},"604":{"position":[[148,17]]},"626":{"position":[[1052,17]]},"646":{"position":[[1039,17]]},"656":{"position":[[3385,17]]},"667":{"position":[[268,17]]},"673":{"position":[[800,17]]},"712":{"position":[[148,17]]}},"keywords":{}}],["transfer(&self",{"_index":3784,"title":{},"content":{"608":{"position":[[517,19]]},"716":{"position":[[517,19]]}},"keywords":{}}],["transfer(address",{"_index":959,"title":{},"content":{"39":{"position":[[1785,16]]}},"keywords":{}}],["transfer(maybe::some(ticket_id",{"_index":3412,"title":{},"content":{"440":{"position":[[3051,33]]},"687":{"position":[[3051,33]]}},"keywords":{}}],["transfer_amount",{"_index":2529,"title":{},"content":{"206":{"position":[[2257,15],[2914,15],[2978,17],[3097,15],[3227,15]]},"268":{"position":[[3203,15],[3333,15]]},"408":{"position":[[3203,15],[3333,15]]},"426":{"position":[[2247,15],[2899,15],[2963,17],[3077,15],[3202,15]]},"645":{"position":[[3203,15],[3333,15]]},"668":{"position":[[2257,15],[2914,15],[2978,17],[3097,15],[3227,15]]}},"keywords":{}}],["transfer_error",{"_index":2521,"title":{},"content":{"206":{"position":[[1725,16]]},"269":{"position":[[5635,16]]},"409":{"position":[[5635,16]]},"426":{"position":[[1715,16]]},"646":{"position":[[5635,16]]},"668":{"position":[[1725,16]]}},"keywords":{}}],["transfer_from",{"_index":2468,"title":{},"content":{"205":{"position":[[96,14]]},"425":{"position":[[96,14]]},"667":{"position":[[96,14]]}},"keywords":{}}],["transfer_from(&mut",{"_index":539,"title":{},"content":{"17":{"position":[[3087,22]]},"115":{"position":[[653,22]]},"205":{"position":[[457,22]]},"247":{"position":[[919,22]]},"258":{"position":[[635,22]]},"269":{"position":[[1203,22]]},"384":{"position":[[1216,22]]},"409":{"position":[[1203,22]]},"419":{"position":[[3541,22]]},"425":{"position":[[432,22]]},"446":{"position":[[919,22]]},"481":{"position":[[635,22]]},"626":{"position":[[1216,22]]},"646":{"position":[[1203,22]]},"656":{"position":[[3541,22]]},"667":{"position":[[432,22]]},"673":{"position":[[919,22]]}},"keywords":{}}],["transfer_from_and_approval_work",{"_index":2525,"title":{},"content":{"206":{"position":[[2053,33]]},"426":{"position":[[2043,33]]},"668":{"position":[[2053,33]]}},"keywords":{}}],["transfer_from_error",{"_index":2542,"title":{},"content":{"206":{"position":[[3326,21]]},"268":{"position":[[2366,21]]},"408":{"position":[[2366,21]]},"426":{"position":[[3301,21]]},"645":{"position":[[2366,21]]},"668":{"position":[[3326,21]]}},"keywords":{}}],["transfer_ownership",{"_index":2300,"title":{},"content":{"189":{"position":[[658,20]]},"366":{"position":[[658,20]]},"582":{"position":[[658,20]]}},"keywords":{}}],["transfer_work",{"_index":2511,"title":{},"content":{"206":{"position":[[1087,16]]},"269":{"position":[[4997,16]]},"409":{"position":[[4997,16]]},"426":{"position":[[1082,16]]},"646":{"position":[[4997,16]]},"668":{"position":[[1087,16]]}},"keywords":{}}],["transferreceipt",{"_index":3463,"title":{},"content":{"440":{"position":[[6380,15]]},"687":{"position":[[6380,15]]}},"keywords":{}}],["transform",{"_index":1611,"title":{},"content":{"93":{"position":[[195,11]]},"285":{"position":[[195,11]]},"497":{"position":[[195,11]]}},"keywords":{}}],["transit",{"_index":3606,"title":{},"content":{"594":{"position":[[314,13]]},"618":{"position":[[230,10]]},"702":{"position":[[314,13]]},"726":{"position":[[230,10]]}},"keywords":{}}],["translat",{"_index":556,"title":{},"content":{"18":{"position":[[310,9]]}},"keywords":{}}],["transpil",{"_index":892,"title":{},"content":{"38":{"position":[[1128,9]]},"39":{"position":[[214,13]]},"40":{"position":[[460,10]]}},"keywords":{}}],["tri",{"_index":1368,"title":{"617":{"position":[[0,3]]},"725":{"position":[[0,3]]}},"content":{"71":{"position":[[584,3]]},"198":{"position":[[3457,5],[3673,3]]},"235":{"position":[[584,3]]},"434":{"position":[[3439,5],[3655,3]]},"471":{"position":[[584,3]]},"478":{"position":[[227,3]]},"681":{"position":[[3457,5],[3673,3]]},"700":{"position":[[227,3]]}},"keywords":{}}],["trick",{"_index":446,"title":{},"content":{"16":{"position":[[375,5]]}},"keywords":{}}],["trigger",{"_index":343,"title":{},"content":{"10":{"position":[[831,8]]},"85":{"position":[[864,10]]},"182":{"position":[[333,8]]},"184":{"position":[[1173,9]]},"190":{"position":[[81,9]]},"254":{"position":[[864,10]]},"367":{"position":[[81,9]]},"373":{"position":[[333,8]]},"375":{"position":[[1070,9]]},"485":{"position":[[864,10]]},"583":{"position":[[81,9]]},"589":{"position":[[333,8]]},"591":{"position":[[1070,9]]}},"keywords":{}}],["tripl",{"_index":2402,"title":{},"content":{"198":{"position":[[1743,7]]},"434":{"position":[[1733,7]]},"681":{"position":[[1743,7]]}},"keywords":{}}],["troubleshoot",{"_index":2945,"title":{"270":{"position":[[3,16]]},"385":{"position":[[3,16]]},"410":{"position":[[3,16]]},"627":{"position":[[3,16]]},"647":{"position":[[3,16]]}},"content":{},"keywords":{}}],["true",{"_index":1643,"title":{},"content":{"98":{"position":[[289,4],[428,5]]},"131":{"position":[[468,4]]},"185":{"position":[[2059,6]]},"265":{"position":[[878,4]]},"290":{"position":[[289,4],[428,5]]},"311":{"position":[[520,4]]},"323":{"position":[[1828,5],[2071,5],[2364,5]]},"376":{"position":[[2043,6]]},"395":{"position":[[2891,4],[3558,4]]},"405":{"position":[[878,4]]},"416":{"position":[[2271,5]]},"477":{"position":[[994,4]]},"502":{"position":[[289,4],[428,5]]},"528":{"position":[[520,4]]},"541":{"position":[[1828,5],[2071,5],[2364,5]]},"592":{"position":[[2043,6]]},"632":{"position":[[2891,4],[3558,4]]},"642":{"position":[[878,4]]},"653":{"position":[[2271,5]]},"699":{"position":[[994,4]]}},"keywords":{}}],["trustless",{"_index":367,"title":{},"content":{"11":{"position":[[132,9]]}},"keywords":{}}],["try/catch",{"_index":3920,"title":{},"content":{"617":{"position":[[777,9],[876,9],[1056,9]]},"725":{"position":[[777,9],[876,9],[1056,9]]}},"keywords":{}}],["try_",{"_index":2419,"title":{},"content":{"198":{"position":[[3622,4]]},"268":{"position":[[2126,4]]},"408":{"position":[[2126,4]]},"434":{"position":[[3604,4]]},"645":{"position":[[2126,4]]},"681":{"position":[[3622,4]]}},"keywords":{}}],["try_buy_ticket(0",{"_index":3449,"title":{},"content":{"440":{"position":[[5452,19],[5563,19],[5724,19]]},"687":{"position":[[5452,19],[5563,19],[5724,19]]}},"keywords":{}}],["try_buy_ticket(1",{"_index":3452,"title":{},"content":{"440":{"position":[[5643,19]]},"687":{"position":[[5643,19]]}},"keywords":{}}],["try_change_nam",{"_index":1923,"title":{},"content":{"138":{"position":[[1017,16],[1065,15]]},"318":{"position":[[1009,16],[1057,15]]},"544":{"position":[[1009,16],[1057,15]]}},"keywords":{}}],["try_nam",{"_index":1921,"title":{},"content":{"138":{"position":[[996,9]]},"318":{"position":[[988,9]]},"544":{"position":[[988,9]]}},"keywords":{}}],["try_own",{"_index":1922,"title":{},"content":{"138":{"position":[[1006,10]]},"318":{"position":[[998,10]]},"544":{"position":[[998,10]]}},"keywords":{}}],["try_{{entry_point_nam",{"_index":1917,"title":{},"content":{"138":{"position":[[825,24]]},"318":{"position":[[817,24]]},"544":{"position":[[817,24]]}},"keywords":{}}],["tupl",{"_index":1465,"title":{},"content":{"79":{"position":[[1205,5]]},"81":{"position":[[259,6]]},"203":{"position":[[615,5]]},"230":{"position":[[1222,5]]},"232":{"position":[[259,6]]},"416":{"position":[[913,5]]},"423":{"position":[[615,5]]},"461":{"position":[[1222,5]]},"463":{"position":[[259,6]]},"653":{"position":[[913,5]]},"665":{"position":[[615,5]]}},"keywords":{}}],["ture",{"_index":172,"title":{},"content":{"5":{"position":[[107,6]]}},"keywords":{}}],["turn",{"_index":2746,"title":{},"content":{"223":{"position":[[1265,4],[1346,4]]},"415":{"position":[[209,6]]},"456":{"position":[[1265,4],[1346,4]]},"652":{"position":[[209,6]]},"696":{"position":[[1265,4],[1346,4]]}},"keywords":{}}],["tutori",{"_index":678,"title":{},"content":{"23":{"position":[[174,10]]},"52":{"position":[[216,10]]},"99":{"position":[[694,9]]},"197":{"position":[[853,9]]},"199":{"position":[[152,9]]},"200":{"position":[[12,8]]},"291":{"position":[[694,9]]},"295":{"position":[[817,8]]},"393":{"position":[[56,9]]},"395":{"position":[[141,9],[324,8],[6654,8]]},"396":{"position":[[1239,8]]},"433":{"position":[[852,9]]},"435":{"position":[[152,9]]},"436":{"position":[[12,8]]},"442":{"position":[[8,9]]},"476":{"position":[[9,9]]},"478":{"position":[[8,9]]},"503":{"position":[[694,9]]},"507":{"position":[[817,8]]},"594":{"position":[[268,8]]},"618":{"position":[[525,8]]},"630":{"position":[[56,9]]},"632":{"position":[[141,9],[324,8],[6654,8]]},"633":{"position":[[1239,8]]},"680":{"position":[[852,9]]},"682":{"position":[[152,9]]},"683":{"position":[[12,8]]},"689":{"position":[[8,9]]},"698":{"position":[[9,9]]},"700":{"position":[[8,9]]},"702":{"position":[[268,8]]},"726":{"position":[[525,8]]}},"keywords":{}}],["twitter",{"_index":393,"title":{},"content":{"13":{"position":[[62,7]]},"24":{"position":[[136,7]]},"34":{"position":[[34,7]]},"55":{"position":[[34,7]]}},"keywords":{}}],["two",{"_index":179,"title":{},"content":{"5":{"position":[[193,3]]},"9":{"position":[[125,3]]},"15":{"position":[[547,4]]},"17":{"position":[[81,3]]},"20":{"position":[[304,3]]},"22":{"position":[[965,3]]},"30":{"position":[[73,3]]},"31":{"position":[[2853,3]]},"40":{"position":[[402,3]]},"42":{"position":[[1325,3],[1800,3]]},"43":{"position":[[736,3]]},"81":{"position":[[84,3]]},"84":{"position":[[329,3],[671,3]]},"97":{"position":[[108,3]]},"107":{"position":[[19,3]]},"115":{"position":[[1396,3]]},"117":{"position":[[0,3],[744,3]]},"119":{"position":[[1041,4],[1082,3],[1171,3]]},"141":{"position":[[1189,3]]},"162":{"position":[[2442,3]]},"163":{"position":[[103,3]]},"168":{"position":[[1237,3]]},"184":{"position":[[1140,3]]},"185":{"position":[[2609,3]]},"189":{"position":[[632,3]]},"207":{"position":[[7,3]]},"209":{"position":[[193,3]]},"219":{"position":[[11,3]]},"232":{"position":[[84,3]]},"253":{"position":[[329,3],[671,3]]},"258":{"position":[[1342,3]]},"274":{"position":[[19,3]]},"289":{"position":[[108,3]]},"298":{"position":[[0,3],[744,3]]},"300":{"position":[[1041,4],[1082,3],[1171,3]]},"326":{"position":[[1189,3]]},"348":{"position":[[1237,3]]},"351":{"position":[[2464,3]]},"352":{"position":[[103,3]]},"366":{"position":[[632,3]]},"375":{"position":[[1037,3]]},"376":{"position":[[2593,3]]},"388":{"position":[[193,3]]},"427":{"position":[[7,3]]},"440":{"position":[[4654,3]]},"441":{"position":[[4268,3],[4384,3]]},"452":{"position":[[11,3]]},"463":{"position":[[84,3]]},"481":{"position":[[1342,3]]},"484":{"position":[[329,3],[671,3]]},"491":{"position":[[19,3]]},"501":{"position":[[108,3]]},"519":{"position":[[0,3],[744,3]]},"521":{"position":[[1041,4],[1082,3],[1171,3]]},"535":{"position":[[1189,3]]},"564":{"position":[[1237,3]]},"567":{"position":[[2464,3]]},"568":{"position":[[103,3]]},"582":{"position":[[632,3]]},"591":{"position":[[1037,3]]},"592":{"position":[[2593,3]]},"596":{"position":[[907,3],[979,3]]},"616":{"position":[[1181,3]]},"658":{"position":[[193,3]]},"669":{"position":[[7,3]]},"687":{"position":[[4654,3]]},"688":{"position":[[4268,3],[4384,3]]},"692":{"position":[[11,3]]},"704":{"position":[[907,3],[979,3]]},"724":{"position":[[1181,3]]}},"keywords":{}}],["tx",{"_index":1256,"title":{},"content":{"52":{"position":[[1031,2],[1150,2],[1446,2],[3253,3],[4899,3]]},"53":{"position":[[114,2]]},"396":{"position":[[769,3]]},"633":{"position":[[769,3]]}},"keywords":{}}],["txhash",{"_index":1281,"title":{},"content":{"52":{"position":[[3009,7],[4602,7],[6366,7]]},"53":{"position":[[997,7]]}},"keywords":{}}],["ty",{"_index":922,"title":{},"content":{"39":{"position":[[734,3],[2998,2],[3015,2]]}},"keywords":{}}],["ty::parse_plain_type_from_ty(ti",{"_index":1005,"title":{},"content":{"39":{"position":[[3020,32]]}},"keywords":{}}],["type",{"_index":510,"title":{"165":{"position":[[7,6]]},"354":{"position":[[7,6]]},"570":{"position":[[7,6]]},"598":{"position":[[5,6]]},"602":{"position":[[7,6]]},"706":{"position":[[5,6]]},"710":{"position":[[7,6]]}},"content":{"17":{"position":[[1780,4]]},"22":{"position":[[601,4]]},"39":{"position":[[128,7],[1945,6]]},"53":{"position":[[373,5],[550,5],[705,5],[969,5]]},"76":{"position":[[158,5],[243,5],[325,4],[390,5]]},"79":{"position":[[182,4],[233,4]]},"84":{"position":[[349,4]]},"86":{"position":[[159,6]]},"98":{"position":[[171,5],[280,5],[419,5]]},"103":{"position":[[112,5],[230,5],[294,5],[483,5],[552,5]]},"146":{"position":[[544,6]]},"147":{"position":[[1325,4]]},"149":{"position":[[39,5]]},"162":{"position":[[32,4],[199,5],[534,5],[1819,6],[1919,5],[2446,5]]},"163":{"position":[[124,4],[143,5],[1301,4],[1425,5]]},"165":{"position":[[39,5],[115,5],[146,4]]},"174":{"position":[[337,5]]},"182":{"position":[[94,4]]},"185":{"position":[[233,4],[2475,5]]},"195":{"position":[[557,4],[748,5]]},"197":{"position":[[1573,4],[1740,4]]},"198":{"position":[[3974,5]]},"201":{"position":[[122,5]]},"203":{"position":[[494,4]]},"206":{"position":[[3838,5]]},"209":{"position":[[111,4],[482,4],[519,4]]},"220":{"position":[[61,4]]},"227":{"position":[[158,5],[243,5],[325,4],[390,5]]},"230":{"position":[[182,4],[233,4]]},"253":{"position":[[349,4]]},"255":{"position":[[159,6]]},"267":{"position":[[319,5],[632,4],[2457,5]]},"268":{"position":[[2271,5]]},"290":{"position":[[171,5],[280,5],[419,5]]},"295":{"position":[[112,5],[230,5],[294,5],[483,5],[552,5]]},"321":{"position":[[1686,5],[2011,5],[2139,5]]},"324":{"position":[[1124,5],[1297,4],[1322,6]]},"334":{"position":[[548,6]]},"335":{"position":[[1333,4]]},"337":{"position":[[39,5]]},"351":{"position":[[32,4],[199,5],[571,5],[1841,6],[1941,5],[2468,5]]},"352":{"position":[[124,4],[143,5],[1323,4],[1447,5]]},"354":{"position":[[39,5],[115,5],[146,4],[223,5],[505,4],[654,5]]},"360":{"position":[[337,5]]},"373":{"position":[[94,4]]},"376":{"position":[[217,4],[2459,5]]},"383":{"position":[[86,6],[202,5]]},"388":{"position":[[111,4],[472,4],[509,4]]},"407":{"position":[[319,5],[632,4],[2457,5]]},"408":{"position":[[2271,5]]},"421":{"position":[[122,5]]},"423":{"position":[[494,4]]},"426":{"position":[[3813,5]]},"431":{"position":[[557,4],[748,5]]},"433":{"position":[[1572,4],[1739,4]]},"434":{"position":[[3956,5]]},"440":{"position":[[393,4],[3546,4]]},"453":{"position":[[61,4]]},"458":{"position":[[158,5],[243,5],[325,4],[390,5]]},"461":{"position":[[182,4],[233,4]]},"484":{"position":[[349,4]]},"486":{"position":[[159,6]]},"502":{"position":[[171,5],[280,5],[419,5]]},"507":{"position":[[112,5],[230,5],[294,5],[483,5],[552,5]]},"539":{"position":[[1686,5],[2011,5],[2139,5]]},"542":{"position":[[1124,5],[1297,4],[1322,6]]},"551":{"position":[[548,6]]},"552":{"position":[[1333,4]]},"554":{"position":[[39,5]]},"567":{"position":[[32,4],[199,5],[571,5],[1841,6],[1941,5],[2468,5]]},"568":{"position":[[124,4],[143,5],[1323,4],[1447,5]]},"570":{"position":[[39,5],[115,5],[146,4],[223,5],[505,4],[654,5]]},"576":{"position":[[337,5]]},"589":{"position":[[94,4]]},"592":{"position":[[217,4],[2459,5]]},"598":{"position":[[269,4],[335,4],[397,4],[459,4],[1076,5],[1569,5],[1658,6],[1771,4],[1893,5],[1957,4]]},"599":{"position":[[377,5],[400,6]]},"600":{"position":[[493,5]]},"601":{"position":[[1952,4]]},"602":{"position":[[545,5],[2041,5]]},"610":{"position":[[631,4],[662,6]]},"611":{"position":[[777,4],[858,4]]},"613":{"position":[[1670,4],[1886,6],[2055,4],[2144,4]]},"617":{"position":[[1121,4],[1172,4],[1295,4]]},"625":{"position":[[86,6],[202,5]]},"644":{"position":[[319,5],[632,4],[2457,5]]},"645":{"position":[[2271,5]]},"658":{"position":[[111,4],[472,4],[509,4]]},"663":{"position":[[122,5]]},"665":{"position":[[494,4]]},"668":{"position":[[3838,5]]},"678":{"position":[[557,4],[748,5]]},"680":{"position":[[1572,4],[1739,4]]},"681":{"position":[[3974,5]]},"687":{"position":[[393,4],[3546,4]]},"693":{"position":[[61,4]]},"706":{"position":[[269,4],[335,4],[397,4],[459,4],[1076,5],[1569,5],[1658,6],[1771,4],[1893,5],[1957,4]]},"707":{"position":[[377,5],[400,6]]},"708":{"position":[[493,5]]},"709":{"position":[[1952,4]]},"710":{"position":[[545,5],[2041,5]]},"718":{"position":[[631,4],[662,6]]},"719":{"position":[[777,4],[858,4]]},"721":{"position":[[1670,4],[1886,6],[2055,4],[2144,4]]},"725":{"position":[[1121,4],[1172,4],[1295,4]]}},"keywords":{}}],["type.attached_valu",{"_index":1689,"title":{},"content":{"103":{"position":[[457,20]]},"295":{"position":[[457,20]]},"507":{"position":[[457,20]]}},"keywords":{}}],["type.cltyp",{"_index":3078,"title":{},"content":{"354":{"position":[[481,11]]},"570":{"position":[[481,11]]}},"keywords":{}}],["typeinfo",{"_index":980,"title":{},"content":{"39":{"position":[[2390,8]]}},"keywords":{}}],["types::address",{"_index":463,"title":{},"content":{"17":{"position":[[354,15],[1876,15]]},"42":{"position":[[2043,16]]}},"keywords":{}}],["types::storedvalu",{"_index":2612,"title":{},"content":{"212":{"position":[[75,19]]},"391":{"position":[[75,19]]},"661":{"position":[[75,19]]}},"keywords":{}}],["typescript",{"_index":3595,"title":{},"content":{"478":{"position":[[255,11]]},"700":{"position":[[255,11]]}},"keywords":{}}],["typic",{"_index":1436,"title":{},"content":{"79":{"position":[[138,9]]},"230":{"position":[[138,9]]},"324":{"position":[[1553,9]]},"461":{"position":[[138,9]]},"542":{"position":[[1553,9]]}},"keywords":{}}],["u",{"_index":3625,"title":{},"content":{"598":{"position":[[212,2]]},"706":{"position":[[212,2]]}},"keywords":{}}],["u128",{"_index":3662,"title":{},"content":{"598":{"position":[[1684,5]]},"706":{"position":[[1684,5]]}},"keywords":{}}],["u16",{"_index":3661,"title":{},"content":{"598":{"position":[[1669,4]]},"706":{"position":[[1669,4]]}},"keywords":{}}],["u2",{"_index":3628,"title":{},"content":{"598":{"position":[[274,3]]},"706":{"position":[[274,3]]}},"keywords":{}}],["u256",{"_index":511,"title":{},"content":{"17":{"position":[[1785,5],[1932,6],[2321,5],[2542,4],[2637,4],[2738,5],[3151,5],[3748,5],[3910,4]]},"39":{"position":[[2069,5]]},"71":{"position":[[152,4]]},"79":{"position":[[899,4]]},"115":{"position":[[420,5],[639,6],[726,6],[789,6],[946,5],[1003,5],[1077,5],[1263,5],[2263,5],[2537,6],[2595,5],[2863,5]]},"126":{"position":[[2015,4]]},"204":{"position":[[150,5],[560,4],[985,4]]},"205":{"position":[[985,4],[1115,4],[2170,4]]},"209":{"position":[[731,5],[1028,5],[1043,5]]},"212":{"position":[[160,5],[620,5]]},"230":{"position":[[916,4]]},"235":{"position":[[152,4]]},"247":{"position":[[185,5],[536,4],[629,4],[747,4]]},"258":{"position":[[410,5],[625,6],[708,6],[767,6],[908,5],[961,5],[1031,5],[1209,5],[2209,5],[2479,6],[2533,5],[2789,5]]},"267":{"position":[[1685,4],[3933,5]]},"269":{"position":[[1861,4],[3488,4],[3609,4]]},"277":{"position":[[2183,4]]},"383":{"position":[[1207,4]]},"384":{"position":[[1881,4],[3498,4],[3595,4]]},"388":{"position":[[663,5],[960,5],[975,5]]},"391":{"position":[[160,5],[620,5]]},"407":{"position":[[1685,4],[3933,5]]},"409":{"position":[[1861,4],[3488,4],[3609,4]]},"416":{"position":[[867,5],[1477,5],[2709,5]]},"419":{"position":[[279,5],[1450,5],[2614,5],[2720,5],[2877,5],[3996,5],[4664,5]]},"424":{"position":[[125,5],[535,4],[936,4]]},"425":{"position":[[960,4],[1090,4],[2121,4]]},"446":{"position":[[185,5],[536,4],[629,4],[747,4]]},"461":{"position":[[916,4]]},"471":{"position":[[152,4]]},"481":{"position":[[410,5],[625,6],[708,6],[767,6],[908,5],[961,5],[1031,5],[1209,5],[2209,5],[2479,6],[2533,5],[2789,5]]},"514":{"position":[[2015,4]]},"598":{"position":[[82,6],[298,4],[1269,4],[1694,4]]},"599":{"position":[[61,6],[168,4]]},"601":{"position":[[243,4],[494,5],[697,6],[806,5],[934,5],[1046,5]]},"611":{"position":[[259,5]]},"613":{"position":[[134,5],[146,4],[417,5],[429,4],[2227,4]]},"616":{"position":[[60,6],[231,5]]},"625":{"position":[[1207,4]]},"626":{"position":[[1881,4],[3498,4],[3595,4]]},"644":{"position":[[1685,4],[3933,5]]},"646":{"position":[[1861,4],[3488,4],[3609,4]]},"653":{"position":[[867,5],[1477,5],[2709,5]]},"656":{"position":[[279,5],[1450,5],[2614,5],[2720,5],[2877,5],[3996,5],[4664,5]]},"658":{"position":[[663,5],[960,5],[975,5]]},"661":{"position":[[160,5],[620,5]]},"666":{"position":[[125,5],[535,4],[936,4]]},"667":{"position":[[960,4],[1090,4],[2121,4]]},"673":{"position":[[185,5],[536,4],[629,4],[747,4]]},"706":{"position":[[82,6],[298,4],[1269,4],[1694,4]]},"707":{"position":[[61,6],[168,4]]},"709":{"position":[[243,4],[494,5],[697,6],[806,5],[934,5],[1046,5]]},"719":{"position":[[259,5]]},"721":{"position":[[134,5],[146,4],[417,5],[429,4],[2227,4]]},"724":{"position":[[60,6],[231,5]]}},"keywords":{}}],["u256>",{"_index":519,"title":{},"content":{"17":{"position":[[2132,9],[2182,8]]},"84":{"position":[[288,8]]},"203":{"position":[[290,9],[343,8]]},"253":{"position":[[288,8]]},"267":{"position":[[1146,8]]},"269":{"position":[[458,9],[511,8]]},"384":{"position":[[471,9],[524,8]]},"407":{"position":[[1146,8]]},"409":{"position":[[458,9],[511,8]]},"423":{"position":[[290,9],[343,8]]},"484":{"position":[[288,8]]},"626":{"position":[[471,9],[524,8]]},"644":{"position":[[1146,8]]},"646":{"position":[[458,9],[511,8]]},"665":{"position":[[290,9],[343,8]]}},"keywords":{}}],["u256>>",{"_index":2833,"title":{},"content":{"267":{"position":[[1009,12]]},"407":{"position":[[1009,12]]},"644":{"position":[[1009,12]]}},"keywords":{}}],["u256([123",{"_index":3669,"title":{},"content":{"599":{"position":[[175,10]]},"707":{"position":[[175,10]]}},"keywords":{}}],["u256)>",{"_index":3221,"title":{},"content":{"416":{"position":[[553,10]]},"419":{"position":[[924,10]]},"653":{"position":[[553,10]]},"656":{"position":[[924,10]]}},"keywords":{}}],["u256::from(1000",{"_index":1836,"title":{},"content":{"126":{"position":[[3230,18]]},"277":{"position":[[3398,18]]},"417":{"position":[[649,18],[1120,18],[1436,18]]},"419":{"position":[[7064,18],[7535,18],[7851,18]]},"514":{"position":[[3230,18]]},"654":{"position":[[649,18],[1120,18],[1436,18]]},"656":{"position":[[7064,18],[7535,18],[7851,18]]}},"keywords":{}}],["u256::from(10000000",{"_index":770,"title":{},"content":{"31":{"position":[[1579,21],[1873,21]]}},"keywords":{}}],["u256::from(10_000",{"_index":1817,"title":{},"content":{"126":{"position":[[2022,19]]},"277":{"position":[[2190,19]]},"514":{"position":[[2022,19]]}},"keywords":{}}],["u256::from(1_000",{"_index":3131,"title":{},"content":{"395":{"position":[[1135,19],[1235,19],[1962,18]]},"632":{"position":[[1135,19],[1235,19],[1962,18]]}},"keywords":{}}],["u256::from(1_000u64",{"_index":3276,"title":{},"content":{"417":{"position":[[321,21]]},"419":{"position":[[6736,21]]},"654":{"position":[[321,21]]},"656":{"position":[[6736,21]]}},"keywords":{}}],["u256::from(2000",{"_index":3279,"title":{},"content":{"417":{"position":[[613,18],[967,18],[1282,18],[1318,18]]},"419":{"position":[[7028,18],[7382,18],[7697,18],[7733,18]]},"654":{"position":[[613,18],[967,18],[1282,18],[1318,18]]},"656":{"position":[[7028,18],[7382,18],[7697,18],[7733,18]]}},"keywords":{}}],["u256::from(4000",{"_index":3288,"title":{},"content":{"417":{"position":[[1602,18]]},"419":{"position":[[8017,18]]},"654":{"position":[[1602,18]]},"656":{"position":[[8017,18]]}},"keywords":{}}],["u256::from(initial_suppli",{"_index":2517,"title":{},"content":{"206":{"position":[[1427,26],[1906,26],[2330,28],[2885,26]]},"269":{"position":[[5337,26],[5816,26]]},"409":{"position":[[5337,26],[5816,26]]},"426":{"position":[[1422,26],[1896,26],[2320,28],[2870,26]]},"646":{"position":[[5337,26],[5816,26]]},"668":{"position":[[1427,26],[1906,26],[2330,28],[2885,26]]}},"keywords":{}}],["u256::from_bytes(&bytes).unwrap",{"_index":2645,"title":{},"content":{"212":{"position":[[2184,38]]},"391":{"position":[[2184,38]]},"661":{"position":[[2184,38]]}},"keywords":{}}],["u256::max",{"_index":3652,"title":{},"content":{"598":{"position":[[1052,10]]},"706":{"position":[[1052,10]]}},"keywords":{}}],["u256::on",{"_index":758,"title":{},"content":{"31":{"position":[[1265,12],[1557,12],[1851,12]]},"206":{"position":[[1935,12]]},"269":{"position":[[5845,12]]},"409":{"position":[[5845,12]]},"426":{"position":[[1925,12]]},"613":{"position":[[293,12]]},"646":{"position":[[5845,12]]},"668":{"position":[[1935,12]]},"721":{"position":[[293,12]]}},"keywords":{}}],["u256::zero",{"_index":746,"title":{},"content":{"31":{"position":[[1008,13],[1302,13],[2570,13]]},"416":{"position":[[1748,12],[3953,13],[3986,13]]},"417":{"position":[[758,14]]},"419":{"position":[[4265,12],[5532,13],[5565,13],[7173,14]]},"598":{"position":[[1023,13]]},"613":{"position":[[274,12]]},"653":{"position":[[1748,12],[3953,13],[3986,13]]},"654":{"position":[[758,14]]},"656":{"position":[[4265,12],[5532,13],[5565,13],[7173,14]]},"706":{"position":[[1023,13]]},"721":{"position":[[274,12]]}},"keywords":{}}],["u32",{"_index":838,"title":{},"content":{"32":{"position":[[1143,3],[1543,3]]},"51":{"position":[[121,3],[622,4],[1070,3],[1211,4],[1231,4],[1312,4]]},"73":{"position":[[186,4]]},"79":{"position":[[732,4],[1013,4]]},"80":{"position":[[399,3],[486,3]]},"141":{"position":[[1279,4],[1288,4],[1299,4]]},"162":{"position":[[812,4],[1047,3],[1188,3],[1250,3],[1299,3]]},"163":{"position":[[558,3],[987,3]]},"164":{"position":[[722,3],[790,3],[865,4]]},"206":{"position":[[254,3]]},"209":{"position":[[1276,4]]},"211":{"position":[[199,4],[332,4]]},"212":{"position":[[1858,3],[2545,3],[2851,3],[3812,4]]},"223":{"position":[[761,3]]},"230":{"position":[[749,4],[1030,4]]},"231":{"position":[[399,3],[486,3]]},"237":{"position":[[186,4]]},"269":{"position":[[4158,3]]},"326":{"position":[[1279,4],[1288,4],[1299,4]]},"351":{"position":[[834,4],[1069,3],[1210,3],[1272,3],[1321,3]]},"352":{"position":[[580,3],[1009,3]]},"353":{"position":[[757,3],[825,3],[900,4]]},"388":{"position":[[1208,4]]},"390":{"position":[[199,4],[319,4]]},"391":{"position":[[1858,3],[2545,3],[2857,3],[3830,4]]},"409":{"position":[[4158,3]]},"426":{"position":[[254,3]]},"456":{"position":[[761,3]]},"461":{"position":[[749,4],[1030,4]]},"462":{"position":[[399,3],[486,3]]},"473":{"position":[[186,4]]},"535":{"position":[[1279,4],[1288,4],[1299,4]]},"567":{"position":[[834,4],[1069,3],[1210,3],[1272,3],[1321,3]]},"568":{"position":[[580,3],[1009,3]]},"569":{"position":[[757,3],[825,3],[900,4]]},"598":{"position":[[1674,4]]},"601":{"position":[[1541,4]]},"602":{"position":[[1425,4],[1594,4],[1792,4]]},"605":{"position":[[154,4],[165,3],[217,4],[225,4],[236,3]]},"606":{"position":[[195,4],[206,3]]},"646":{"position":[[4158,3]]},"658":{"position":[[1208,4]]},"660":{"position":[[199,4],[319,4]]},"661":{"position":[[1858,3],[2545,3],[2857,3],[3830,4]]},"668":{"position":[[254,3]]},"696":{"position":[[761,3]]},"706":{"position":[[1674,4]]},"709":{"position":[[1541,4]]},"710":{"position":[[1425,4],[1594,4],[1792,4]]},"713":{"position":[[154,4],[165,3],[217,4],[225,4],[236,3]]},"714":{"position":[[195,4],[206,3]]}},"keywords":{}}],["u32>",{"_index":2085,"title":{},"content":{"163":{"position":[[456,8]]},"209":{"position":[[1689,8]]},"352":{"position":[[478,8]]},"388":{"position":[[1621,8]]},"568":{"position":[[478,8]]},"658":{"position":[[1621,8]]}},"keywords":{}}],["u32::from_bytes(&bytes).unwrap",{"_index":2642,"title":{},"content":{"212":{"position":[[1977,37]]},"391":{"position":[[1977,37]]},"661":{"position":[[1977,37]]}},"keywords":{}}],["u32::from_bytes(&bytes).unwrap().0",{"_index":2653,"title":{},"content":{"212":{"position":[[2767,38],[3181,38]]},"391":{"position":[[2773,38],[3199,38]]},"661":{"position":[[2773,38],[3199,38]]}},"keywords":{}}],["u32::from_str_radix(&result",{"_index":848,"title":{},"content":{"32":{"position":[[1624,32]]}},"keywords":{}}],["u512",{"_index":1491,"title":{},"content":{"80":{"position":[[614,4],[782,5]]},"103":{"position":[[478,4],[547,4]]},"168":{"position":[[1694,4]]},"231":{"position":[[614,4],[782,5]]},"295":{"position":[[478,4],[547,4]]},"348":{"position":[[1694,4]]},"440":{"position":[[546,5],[666,5],[1676,5],[3279,4]]},"441":{"position":[[1561,4],[2888,5],[3184,5]]},"462":{"position":[[614,4],[782,5]]},"476":{"position":[[745,4],[1401,4],[1794,4],[1896,4]]},"477":{"position":[[1469,6]]},"507":{"position":[[478,4],[547,4]]},"564":{"position":[[1694,4]]},"608":{"position":[[558,5]]},"611":{"position":[[57,7],[402,5]]},"687":{"position":[[546,5],[666,5],[1676,5],[3279,4]]},"688":{"position":[[1561,4],[2888,5],[3184,5]]},"698":{"position":[[745,4],[1401,4],[1794,4],[1896,4]]},"699":{"position":[[1469,6]]},"716":{"position":[[558,5]]},"719":{"position":[[57,7],[402,5]]}},"keywords":{}}],["u512>",{"_index":3537,"title":{},"content":{"476":{"position":[[307,9]]},"698":{"position":[[307,9]]}},"keywords":{}}],["u512::from(100",{"_index":2042,"title":{},"content":{"160":{"position":[[585,17]]},"345":{"position":[[585,17]]},"440":{"position":[[5262,17]]},"441":{"position":[[5226,17]]},"562":{"position":[[585,17]]},"687":{"position":[[5262,17]]},"688":{"position":[[5226,17]]}},"keywords":{}}],["u512::from(150",{"_index":3531,"title":{},"content":{"441":{"position":[[5695,17]]},"688":{"position":[[5695,17]]}},"keywords":{}}],["u512::from(50",{"_index":3446,"title":{},"content":{"440":{"position":[[5330,16]]},"441":{"position":[[5299,16]]},"687":{"position":[[5330,16]]},"688":{"position":[[5299,16]]}},"keywords":{}}],["u512::from(75",{"_index":2044,"title":{},"content":{"160":{"position":[[696,16]]},"345":{"position":[[696,16]]},"562":{"position":[[696,16]]}},"keywords":{}}],["u512::zero",{"_index":2040,"title":{},"content":{"160":{"position":[[463,14]]},"345":{"position":[[463,14]]},"562":{"position":[[463,14]]}},"keywords":{}}],["u64",{"_index":243,"title":{},"content":{"8":{"position":[[302,3],[368,3]]},"9":{"position":[[145,3],[162,3],[825,3]]},"71":{"position":[[212,3]]},"115":{"position":[[2284,4],[2800,5]]},"168":{"position":[[1813,4]]},"235":{"position":[[212,3]]},"258":{"position":[[2230,4],[2726,5]]},"348":{"position":[[1813,4]]},"440":{"position":[[409,4],[1243,4],[1895,3],[3561,4]]},"441":{"position":[[5788,4]]},"471":{"position":[[212,3]]},"476":{"position":[[532,4],[805,3],[1507,3]]},"477":{"position":[[1631,3],[1660,3],[1681,3]]},"481":{"position":[[2230,4],[2726,5]]},"564":{"position":[[1813,4]]},"598":{"position":[[1679,4]]},"687":{"position":[[409,4],[1243,4],[1895,3],[3561,4]]},"688":{"position":[[5788,4]]},"698":{"position":[[532,4],[805,3],[1507,3]]},"699":{"position":[[1631,3],[1660,3],[1681,3]]},"706":{"position":[[1679,4]]}},"keywords":{}}],["u64>",{"_index":3539,"title":{},"content":{"476":{"position":[[358,8]]},"698":{"position":[[358,8]]}},"keywords":{}}],["u64.eventdata",{"_index":2829,"title":{},"content":{"267":{"position":[[723,13]]},"407":{"position":[[723,13]]},"644":{"position":[[723,13]]}},"keywords":{}}],["u64::max",{"_index":789,"title":{},"content":{"31":{"position":[[2613,9]]}},"keywords":{}}],["u8",{"_index":520,"title":{},"content":{"17":{"position":[[2303,3]]},"85":{"position":[[119,2]]},"115":{"position":[[400,3],[905,3],[2243,3]]},"165":{"position":[[273,3]]},"185":{"position":[[245,4]]},"204":{"position":[[130,3],[485,2]]},"206":{"position":[[223,2]]},"212":{"position":[[4073,4]]},"247":{"position":[[165,3],[470,2]]},"254":{"position":[[119,2]]},"258":{"position":[[390,3],[871,3],[2189,3]]},"267":{"position":[[2641,4]]},"269":{"position":[[619,3],[4127,2]]},"354":{"position":[[311,3]]},"376":{"position":[[229,4]]},"383":{"position":[[397,3]]},"384":{"position":[[632,3]]},"391":{"position":[[4091,4]]},"407":{"position":[[2641,4]]},"409":{"position":[[619,3],[4127,2]]},"419":{"position":[[1430,3],[2534,3]]},"424":{"position":[[105,3],[460,2]]},"426":{"position":[[223,2]]},"446":{"position":[[165,3],[470,2]]},"481":{"position":[[390,3],[871,3],[2189,3]]},"485":{"position":[[119,2]]},"570":{"position":[[311,3]]},"592":{"position":[[229,4]]},"598":{"position":[[233,2],[1665,3]]},"601":{"position":[[1464,4],[1772,3],[1783,3]]},"616":{"position":[[258,4]]},"625":{"position":[[397,3]]},"626":{"position":[[632,3]]},"644":{"position":[[2641,4]]},"646":{"position":[[619,3],[4127,2]]},"656":{"position":[[1430,3],[2534,3]]},"661":{"position":[[4091,4]]},"666":{"position":[[105,3],[460,2]]},"668":{"position":[[223,2]]},"673":{"position":[[165,3],[470,2]]},"706":{"position":[[233,2],[1665,3]]},"709":{"position":[[1464,4],[1772,3],[1783,3]]},"724":{"position":[[258,4]]}},"keywords":{}}],["uint256",{"_index":692,"title":{},"content":{"30":{"position":[[213,7],[244,9],[317,9]]},"39":{"position":[[1836,7]]},"43":{"position":[[276,7],[409,7],[513,7]]},"613":{"position":[[1675,9]]},"721":{"position":[[1675,9]]}},"keywords":{}}],["ultim",{"_index":889,"title":{},"content":{"38":{"position":[[960,11]]},"93":{"position":[[180,10]]},"285":{"position":[[180,10]]},"497":{"position":[[180,10]]}},"keywords":{}}],["unambigu",{"_index":943,"title":{},"content":{"39":{"position":[[1200,11]]}},"keywords":{}}],["unauthor",{"_index":1377,"title":{},"content":{"72":{"position":[[171,12]]},"184":{"position":[[1189,12]]},"185":{"position":[[3989,12]]},"236":{"position":[[171,12]]},"375":{"position":[[1086,12]]},"376":{"position":[[3973,12]]},"441":{"position":[[2324,12],[4431,13]]},"472":{"position":[[171,12]]},"591":{"position":[[1086,12]]},"592":{"position":[[3973,12]]},"688":{"position":[[2324,12],[4431,13]]}},"keywords":{}}],["unchecked_*_rol",{"_index":2279,"title":{},"content":{"185":{"position":[[3948,19]]},"376":{"position":[[3932,19]]},"592":{"position":[[3932,19]]}},"keywords":{}}],["unchecked_grant_rol",{"_index":2269,"title":{},"content":{"185":{"position":[[3474,22],[3662,22]]},"376":{"position":[[3458,22],[3646,22]]},"592":{"position":[[3458,22],[3646,22]]}},"keywords":{}}],["unchecked_grant_role(&mut",{"_index":2241,"title":{},"content":{"185":{"position":[[1907,29]]},"376":{"position":[[1891,29]]},"592":{"position":[[1891,29]]}},"keywords":{}}],["unchecked_revoke_rol",{"_index":2270,"title":{},"content":{"185":{"position":[[3501,23]]},"376":{"position":[[3485,23]]},"592":{"position":[[3485,23]]}},"keywords":{}}],["unchecked_revoke_role(&mut",{"_index":2244,"title":{},"content":{"185":{"position":[[2177,30]]},"376":{"position":[[2161,30]]},"592":{"position":[[2161,30]]}},"keywords":{}}],["uncom",{"_index":1827,"title":{},"content":{"126":{"position":[[2613,9]]},"277":{"position":[[2781,9]]},"514":{"position":[[2613,9]]}},"keywords":{}}],["uncompl",{"_index":2699,"title":{},"content":{"219":{"position":[[139,14]]},"452":{"position":[[139,14]]},"692":{"position":[[139,14]]}},"keywords":{}}],["uncondit",{"_index":2777,"title":{},"content":{"247":{"position":[[1864,14]]},"446":{"position":[[1864,14]]},"673":{"position":[[1864,14]]}},"keywords":{}}],["under",{"_index":763,"title":{},"content":{"31":{"position":[[1414,5]]},"32":{"position":[[513,5]]},"52":{"position":[[2276,5]]},"65":{"position":[[494,5]]},"84":{"position":[[834,5]]},"91":{"position":[[203,5],[651,5]]},"92":{"position":[[216,5],[658,5]]},"94":{"position":[[676,5]]},"98":{"position":[[185,5]]},"102":{"position":[[86,5]]},"108":{"position":[[252,5]]},"162":{"position":[[107,5]]},"240":{"position":[[494,5]]},"253":{"position":[[834,5]]},"275":{"position":[[256,5]]},"283":{"position":[[203,5],[651,5]]},"284":{"position":[[216,5],[658,5]]},"286":{"position":[[676,5]]},"290":{"position":[[185,5]]},"294":{"position":[[86,5]]},"351":{"position":[[107,5]]},"395":{"position":[[4623,5]]},"465":{"position":[[494,5]]},"477":{"position":[[2637,5]]},"484":{"position":[[834,5]]},"492":{"position":[[256,5]]},"495":{"position":[[203,5],[651,5]]},"496":{"position":[[216,5],[658,5]]},"498":{"position":[[676,5]]},"502":{"position":[[185,5]]},"506":{"position":[[86,5]]},"567":{"position":[[107,5]]},"632":{"position":[[4623,5]]},"699":{"position":[[2637,5]]}},"keywords":{}}],["understand",{"_index":101,"title":{},"content":{"2":{"position":[[220,10]]},"7":{"position":[[166,10]]},"18":{"position":[[11,11]]},"38":{"position":[[287,13]]},"81":{"position":[[299,13]]},"97":{"position":[[260,10]]},"114":{"position":[[254,11]]},"115":{"position":[[48,14]]},"164":{"position":[[308,10]]},"195":{"position":[[204,10]]},"211":{"position":[[46,10]]},"232":{"position":[[299,13]]},"257":{"position":[[254,11]]},"258":{"position":[[48,14]]},"262":{"position":[[75,10]]},"270":{"position":[[344,13]]},"289":{"position":[[260,10]]},"353":{"position":[[343,10]]},"380":{"position":[[75,10]]},"385":{"position":[[344,13]]},"390":{"position":[[46,10]]},"402":{"position":[[75,10]]},"410":{"position":[[344,13]]},"431":{"position":[[204,10]]},"463":{"position":[[299,13]]},"480":{"position":[[254,11]]},"481":{"position":[[48,14]]},"501":{"position":[[260,10]]},"569":{"position":[[343,10]]},"595":{"position":[[121,13]]},"618":{"position":[[112,13]]},"622":{"position":[[75,10]]},"627":{"position":[[344,13]]},"639":{"position":[[75,10]]},"647":{"position":[[344,13]]},"660":{"position":[[46,10]]},"678":{"position":[[204,10]]},"703":{"position":[[121,13]]},"726":{"position":[[112,13]]}},"keywords":{}}],["understood",{"_index":1538,"title":{},"content":{"85":{"position":[[353,10]]},"254":{"position":[[353,10]]},"485":{"position":[[353,10]]}},"keywords":{}}],["unexpect",{"_index":3773,"title":{},"content":{"606":{"position":[[1121,10]]},"617":{"position":[[1363,10]]},"714":{"position":[[1121,10]]},"725":{"position":[[1363,10]]}},"keywords":{}}],["unfortun",{"_index":3113,"title":{},"content":{"394":{"position":[[155,14]]},"440":{"position":[[5795,14]]},"631":{"position":[[155,14]]},"687":{"position":[[5795,14]]}},"keywords":{}}],["uni",{"_index":1239,"title":{},"content":{"52":{"position":[[676,3]]},"53":{"position":[[237,3]]}},"keywords":{}}],["unifi",{"_index":1317,"title":{},"content":{"54":{"position":[[290,7]]}},"keywords":{}}],["uniniti",{"_index":2373,"title":{},"content":{"197":{"position":[[1394,13]]},"433":{"position":[[1393,13]]},"680":{"position":[[1393,13]]}},"keywords":{}}],["uniqu",{"_index":1421,"title":{},"content":{"76":{"position":[[520,8],[660,6]]},"79":{"position":[[457,6]]},"189":{"position":[[183,6]]},"227":{"position":[[520,8],[660,6]]},"230":{"position":[[474,6]]},"366":{"position":[[183,6]]},"458":{"position":[[520,8],[660,6]]},"461":{"position":[[474,6]]},"582":{"position":[[183,6]]}},"keywords":{}}],["uniswap",{"_index":550,"title":{},"content":{"18":{"position":[[102,7]]}},"keywords":{}}],["unit",{"_index":1887,"title":{},"content":{"131":{"position":[[452,5]]},"248":{"position":[[116,5]]},"265":{"position":[[862,5]]},"311":{"position":[[504,5]]},"354":{"position":[[540,4]]},"395":{"position":[[3542,5]]},"405":{"position":[[862,5]]},"417":{"position":[[53,4]]},"447":{"position":[[116,5]]},"528":{"position":[[504,5]]},"570":{"position":[[540,4]]},"598":{"position":[[2013,5]]},"601":{"position":[[1928,5]]},"632":{"position":[[3542,5]]},"642":{"position":[[862,5]]},"654":{"position":[[53,4]]},"674":{"position":[[116,5]]},"706":{"position":[[2013,5]]},"709":{"position":[[1928,5]]}},"keywords":{}}],["unit_only_enum.r",{"_index":3081,"title":{},"content":{"354":{"position":[[577,17]]},"570":{"position":[[577,17]]}},"keywords":{}}],["univers",{"_index":582,"title":{},"content":{"20":{"position":[[308,10],[673,8]]},"40":{"position":[[21,9]]}},"keywords":{}}],["unknown",{"_index":1326,"title":{},"content":{"65":{"position":[[133,7],[141,7],[460,7],[706,7]]},"68":{"position":[[271,7],[279,7],[336,7]]},"128":{"position":[[524,7]]},"173":{"position":[[415,7],[423,7],[444,7],[452,7]]},"240":{"position":[[133,7],[141,7],[460,7],[706,7]]},"243":{"position":[[271,7],[279,7],[336,7]]},"279":{"position":[[524,7]]},"359":{"position":[[415,7],[423,7],[444,7],[452,7]]},"465":{"position":[[133,7],[141,7],[460,7],[706,7]]},"468":{"position":[[271,7],[279,7],[336,7]]},"516":{"position":[[524,7]]},"575":{"position":[[415,7],[423,7],[444,7],[452,7]]}},"keywords":{}}],["unknown/debug/my_project_build_contract.wasm",{"_index":1347,"title":{},"content":{"68":{"position":[[344,44]]},"243":{"position":[[344,44]]},"468":{"position":[[344,44]]}},"keywords":{}}],["unknown/releas",{"_index":1334,"title":{},"content":{"65":{"position":[[468,15]]},"240":{"position":[[468,15]]},"465":{"position":[[468,15]]}},"keywords":{}}],["unknown/release/my_project_build_contract.wasm",{"_index":1338,"title":{},"content":{"65":{"position":[[714,46]]},"240":{"position":[[714,46]]},"465":{"position":[[714,46]]}},"keywords":{}}],["unknownticketoffic",{"_index":3478,"title":{},"content":{"441":{"position":[[709,19]]},"688":{"position":[[709,19]]}},"keywords":{}}],["unleash",{"_index":635,"title":{},"content":{"21":{"position":[[303,7]]},"248":{"position":[[202,7]]},"447":{"position":[[202,7]]},"618":{"position":[[377,7]]},"674":{"position":[[202,7]]},"726":{"position":[[377,7]]}},"keywords":{}}],["unless",{"_index":1018,"title":{},"content":{"40":{"position":[[194,6]]}},"keywords":{}}],["unlock",{"_index":3769,"title":{},"content":{"606":{"position":[[742,6]]},"714":{"position":[[742,6]]}},"keywords":{}}],["unlock(&mut",{"_index":3767,"title":{},"content":{"606":{"position":[[477,15]]},"714":{"position":[[477,15]]}},"keywords":{}}],["unpaus",{"_index":2700,"title":{},"content":{"219":{"position":[[165,8],[515,8]]},"220":{"position":[[177,11]]},"222":{"position":[[404,9],[480,9],[518,11]]},"452":{"position":[[165,8],[446,8]]},"453":{"position":[[177,11]]},"455":{"position":[[404,9],[480,9],[518,11]]},"692":{"position":[[165,8],[446,8]]},"693":{"position":[[177,11]]},"695":{"position":[[404,9],[480,9],[518,11]]}},"keywords":{}}],["unpause(&mut",{"_index":2725,"title":{},"content":{"222":{"position":[[246,16]]},"223":{"position":[[674,16]]},"455":{"position":[[246,16]]},"456":{"position":[[674,16]]},"695":{"position":[[246,16]]},"696":{"position":[[674,16]]}},"keywords":{}}],["unpausedrequir",{"_index":2698,"title":{},"content":{"219":{"position":[[54,17],[355,16]]},"452":{"position":[[54,17],[334,16]]},"692":{"position":[[54,17],[334,16]]}},"keywords":{}}],["unseen",{"_index":555,"title":{},"content":{"18":{"position":[[253,6]]}},"keywords":{}}],["unsign",{"_index":3627,"title":{},"content":{"598":{"position":[[252,8],[318,8],[1703,8]]},"706":{"position":[[252,8],[318,8],[1703,8]]}},"keywords":{}}],["unsuit",{"_index":1504,"title":{},"content":{"83":{"position":[[164,10]]},"252":{"position":[[164,10]]},"483":{"position":[[164,10]]}},"keywords":{}}],["until",{"_index":1819,"title":{},"content":{"126":{"position":[[2201,5]]},"277":{"position":[[2369,5]]},"416":{"position":[[3254,5]]},"514":{"position":[[2201,5]]},"653":{"position":[[3254,5]]}},"keywords":{}}],["unwrap",{"_index":767,"title":{},"content":{"31":{"position":[[1523,10],[1817,10],[2477,10],[2559,10]]},"162":{"position":[[1604,6]]},"212":{"position":[[817,9],[852,10],[1194,9]]},"351":{"position":[[1626,6]]},"391":{"position":[[817,9],[852,10],[1194,9]]},"567":{"position":[[1626,6]]},"601":{"position":[[366,6]]},"661":{"position":[[817,9],[852,10],[1194,9]]},"709":{"position":[[366,6]]}},"keywords":{}}],["unwrap_or_revert",{"_index":2891,"title":{},"content":{"267":{"position":[[4199,16]]},"407":{"position":[[4199,16]]},"644":{"position":[[4199,16]]}},"keywords":{}}],["unwrap_or_revert(&env",{"_index":3392,"title":{},"content":{"440":{"position":[[1956,28]]},"687":{"position":[[1956,28]]}},"keywords":{}}],["unwrap_or_revert(&self.env",{"_index":3648,"title":{},"content":{"598":{"position":[[928,35]]},"706":{"position":[[928,35]]}},"keywords":{}}],["unwrap_or_revert_with",{"_index":2892,"title":{},"content":{"267":{"position":[[4220,21]]},"407":{"position":[[4220,21]]},"644":{"position":[[4220,21]]}},"keywords":{}}],["unwrap_or_revert_with(&env",{"_index":3404,"title":{},"content":{"440":{"position":[[2625,32]]},"441":{"position":[[1257,32]]},"687":{"position":[[2625,32]]},"688":{"position":[[1257,32]]}},"keywords":{}}],["unwrap_or_revert_with(&self.env",{"_index":3511,"title":{},"content":{"441":{"position":[[3721,39]]},"688":{"position":[[3721,39]]}},"keywords":{}}],["unwraporrevert",{"_index":1448,"title":{},"content":{"79":{"position":[[590,16]]},"230":{"position":[[607,16]]},"267":{"position":[[4162,14]]},"407":{"position":[[4162,14]]},"440":{"position":[[198,14]]},"441":{"position":[[650,15]]},"461":{"position":[[607,16]]},"598":{"position":[[126,15]]},"613":{"position":[[56,15]]},"616":{"position":[[88,15]]},"644":{"position":[[4162,14]]},"687":{"position":[[198,14]]},"688":{"position":[[650,15]]},"706":{"position":[[126,15]]},"721":{"position":[[56,15]]},"724":{"position":[[88,15]]}},"keywords":{}}],["up",{"_index":1029,"title":{"68":{"position":[[9,3]]},"243":{"position":[[9,3]]},"468":{"position":[[9,3]]}},"content":{"42":{"position":[[166,2]]},"92":{"position":[[337,2]]},"102":{"position":[[211,5],[502,3]]},"119":{"position":[[445,2]]},"129":{"position":[[643,2]]},"280":{"position":[[644,2]]},"284":{"position":[[337,2]]},"294":{"position":[[211,5],[502,3]]},"300":{"position":[[445,2]]},"393":{"position":[[150,2]]},"395":{"position":[[130,2],[4461,2]]},"396":{"position":[[327,2]]},"477":{"position":[[56,3]]},"496":{"position":[[337,2]]},"506":{"position":[[211,5],[502,3]]},"517":{"position":[[644,2]]},"521":{"position":[[445,2]]},"630":{"position":[[150,2]]},"632":{"position":[[130,2],[4461,2]]},"633":{"position":[[327,2]]},"699":{"position":[[56,3]]}},"keywords":{}}],["upcom",{"_index":2429,"title":{},"content":{"199":{"position":[[143,8]]},"435":{"position":[[143,8]]},"682":{"position":[[143,8]]}},"keywords":{}}],["updat",{"_index":1322,"title":{"261":{"position":[[5,6]]},"265":{"position":[[5,6]]},"266":{"position":[[5,6]]},"267":{"position":[[5,6]]},"268":{"position":[[5,6]]},"379":{"position":[[5,6]]},"382":{"position":[[4,6]]},"383":{"position":[[4,6]]},"401":{"position":[[5,6]]},"405":{"position":[[5,6]]},"406":{"position":[[5,6]]},"407":{"position":[[5,6]]},"408":{"position":[[5,6]]},"621":{"position":[[5,6]]},"624":{"position":[[4,6]]},"625":{"position":[[4,6]]},"638":{"position":[[5,6]]},"642":{"position":[[5,6]]},"643":{"position":[[5,6]]},"644":{"position":[[5,6]]},"645":{"position":[[5,6]]}},"content":{"54":{"position":[[455,6]]},"71":{"position":[[361,6]]},"118":{"position":[[229,6]]},"185":{"position":[[3392,7],[3561,6]]},"197":{"position":[[1027,6],[1255,6]]},"206":{"position":[[832,8],[1499,8]]},"222":{"position":[[530,7]]},"235":{"position":[[361,6]]},"267":{"position":[[47,7],[243,6],[1165,6],[1471,6],[3492,6],[4013,6],[4155,6]]},"268":{"position":[[12,7],[57,6]]},"269":{"position":[[4742,8],[5409,8]]},"299":{"position":[[229,6]]},"321":{"position":[[804,7],[1280,7],[2062,7]]},"376":{"position":[[3376,7],[3545,6]]},"382":{"position":[[112,7]]},"383":{"position":[[188,6],[444,6],[917,6]]},"407":{"position":[[47,7],[243,6],[1165,6],[1471,6],[3492,6],[4013,6],[4155,6]]},"408":{"position":[[12,7],[57,6]]},"409":{"position":[[4742,8],[5409,8]]},"426":{"position":[[832,8],[1494,8]]},"433":{"position":[[1026,6],[1254,6]]},"440":{"position":[[4507,7]]},"441":{"position":[[4460,6]]},"455":{"position":[[530,7]]},"471":{"position":[[361,6]]},"476":{"position":[[956,6]]},"520":{"position":[[229,6]]},"539":{"position":[[804,7],[1280,7],[2062,7]]},"592":{"position":[[3376,7],[3545,6]]},"624":{"position":[[112,7]]},"625":{"position":[[188,6],[444,6],[917,6]]},"644":{"position":[[47,7],[243,6],[1165,6],[1471,6],[3492,6],[4013,6],[4155,6]]},"645":{"position":[[12,7],[57,6]]},"646":{"position":[[4742,8],[5409,8]]},"668":{"position":[[832,8],[1499,8]]},"680":{"position":[[1026,6],[1254,6]]},"687":{"position":[[4507,7]]},"688":{"position":[[4460,6]]},"695":{"position":[[530,7]]},"698":{"position":[[956,6]]}},"keywords":{}}],["update(&mut",{"_index":2974,"title":{},"content":{"321":{"position":[[1339,15]]},"539":{"position":[[1339,15]]}},"keywords":{}}],["update_arr(&mut",{"_index":3712,"title":{},"content":{"601":{"position":[[1739,19]]},"709":{"position":[[1739,19]]}},"keywords":{}}],["update_text(&mut",{"_index":3736,"title":{},"content":{"602":{"position":[[1391,20]]},"710":{"position":[[1391,20]]}},"keywords":{}}],["upgrad",{"_index":1645,"title":{},"content":{"98":{"position":[[467,11]]},"290":{"position":[[467,11]]},"323":{"position":[[3342,14]]},"502":{"position":[[467,11]]},"541":{"position":[[3342,14]]}},"keywords":{}}],["upon",{"_index":1228,"title":{},"content":{"52":{"position":[[277,4]]},"324":{"position":[[1431,4]]},"542":{"position":[[1431,4]]}},"keywords":{}}],["uref",{"_index":1577,"title":{},"content":{"91":{"position":[[280,5]]},"92":{"position":[[176,4]]},"283":{"position":[[280,5]]},"284":{"position":[[176,4]]},"495":{"position":[[280,5]]},"496":{"position":[[176,4]]}},"keywords":{}}],["us",{"_index":58,"title":{"88":{"position":[[0,5]]},"103":{"position":[[0,5]]},"186":{"position":[[0,5]]},"250":{"position":[[0,5]]},"295":{"position":[[0,5]]},"363":{"position":[[0,5]]},"397":{"position":[[20,5]]},"475":{"position":[[0,5]]},"488":{"position":[[0,5]]},"507":{"position":[[0,5]]},"579":{"position":[[0,5]]},"634":{"position":[[20,5]]},"697":{"position":[[0,5]]}},"content":{"1":{"position":[[764,4]]},"2":{"position":[[55,5],[166,3],[595,3]]},"5":{"position":[[197,3]]},"15":{"position":[[58,4],[259,3],[447,3]]},"16":{"position":[[45,4]]},"17":{"position":[[48,5],[199,4],[233,4],[333,3],[1855,3]]},"22":{"position":[[445,5],[1054,3],[1442,3]]},"31":{"position":[[10,4],[1703,4],[2306,5],[2330,3]]},"32":{"position":[[235,3],[264,3],[294,3]]},"42":{"position":[[185,3],[1474,3],[1900,3],[2022,3],[2060,3]]},"50":{"position":[[362,4]]},"51":{"position":[[361,3],[433,3],[1121,3],[1346,3],[1681,3]]},"52":{"position":[[2191,5],[3179,3]]},"65":{"position":[[43,4],[192,4]]},"66":{"position":[[47,4],[168,5]]},"67":{"position":[[63,4],[138,5]]},"68":{"position":[[103,3],[184,3]]},"72":{"position":[[370,3]]},"73":{"position":[[462,3],[476,3]]},"76":{"position":[[333,4],[476,4],[714,5]]},"79":{"position":[[550,3],[607,3],[629,3]]},"80":{"position":[[104,3],[164,3],[186,3]]},"85":{"position":[[739,4]]},"86":{"position":[[72,5]]},"88":{"position":[[58,3]]},"91":{"position":[[868,5],[941,5]]},"92":{"position":[[396,3]]},"97":{"position":[[149,5],[181,5]]},"99":{"position":[[43,5]]},"100":{"position":[[930,4]]},"102":{"position":[[680,3]]},"103":{"position":[[3,3],[779,5]]},"104":{"position":[[60,4]]},"111":{"position":[[150,6]]},"114":{"position":[[50,3],[182,5]]},"115":{"position":[[63,3],[108,3],[1476,5],[1719,3],[1855,3],[1920,3]]},"117":{"position":[[483,5],[551,4],[592,3],[856,4],[941,4],[949,5],[1016,3],[1094,3],[1195,3],[1275,5]]},"118":{"position":[[59,3],[190,3]]},"119":{"position":[[9,4],[217,5],[318,5],[607,3],[1123,5]]},"120":{"position":[[329,3]]},"121":{"position":[[108,3],[367,3]]},"126":{"position":[[3,3],[146,4],[199,3],[263,5],[299,3],[481,4],[521,5],[704,4],[2164,4],[2488,3],[2810,3]]},"128":{"position":[[194,4],[604,4]]},"129":{"position":[[78,6],[414,4]]},"131":{"position":[[554,3]]},"132":{"position":[[357,5]]},"134":{"position":[[46,4],[176,4]]},"138":{"position":[[189,3],[254,3],[280,3],[1141,5],[1268,5]]},"139":{"position":[[42,5]]},"141":{"position":[[131,3],[914,3],[1396,4]]},"142":{"position":[[16,6],[110,6],[197,5]]},"143":{"position":[[42,5],[126,3],[203,3],[976,3],[990,3]]},"145":{"position":[[11,3]]},"146":{"position":[[756,3]]},"147":{"position":[[1378,5]]},"148":{"position":[[36,3],[72,3],[275,3],[551,5]]},"149":{"position":[[86,3]]},"151":{"position":[[121,3],[156,3]]},"154":{"position":[[8,5]]},"157":{"position":[[147,3],[196,3],[570,3]]},"160":{"position":[[174,3],[206,3]]},"162":{"position":[[156,3],[714,3],[1414,5],[1547,5],[1678,3],[1785,3],[1905,5],[2110,3]]},"163":{"position":[[15,4],[203,4],[335,3],[641,3],[1125,5],[1285,5],[1580,3]]},"164":{"position":[[102,3]]},"165":{"position":[[178,3]]},"168":{"position":[[52,3],[356,3],[437,3],[1190,5],[1283,5]]},"173":{"position":[[485,4]]},"174":{"position":[[110,3]]},"175":{"position":[[332,5],[416,3],[512,5]]},"178":{"position":[[11,3],[1042,3],[1078,3],[1281,3]]},"182":{"position":[[102,4]]},"184":{"position":[[189,3],[211,3],[239,3],[962,3]]},"185":{"position":[[113,3],[135,3],[161,3],[183,3],[2945,4]]},"187":{"position":[[43,3]]},"188":{"position":[[216,4],[612,4]]},"189":{"position":[[508,5],[652,5]]},"195":{"position":[[11,3],[33,3]]},"196":{"position":[[15,3]]},"197":{"position":[[840,4],[1205,5],[1835,3]]},"198":{"position":[[36,3],[50,3],[2243,5],[2328,3],[2490,3],[2780,3],[3898,3]]},"199":{"position":[[182,3]]},"201":{"position":[[95,5]]},"203":{"position":[[9,3],[31,3],[439,3],[607,5]]},"204":{"position":[[13,3],[1412,4],[1498,3]]},"205":{"position":[[232,3]]},"206":{"position":[[38,3],[52,3]]},"209":{"position":[[391,3]]},"210":{"position":[[43,3],[321,5]]},"211":{"position":[[695,5]]},"212":{"position":[[23,3],[107,3],[3699,5]]},"219":{"position":[[232,3],[254,3]]},"220":{"position":[[125,3]]},"223":{"position":[[18,3],[291,3],[823,3],[837,3],[1229,5]]},"227":{"position":[[333,4],[476,4],[714,5]]},"230":{"position":[[567,3],[624,3],[646,3]]},"231":{"position":[[104,3],[164,3],[186,3]]},"236":{"position":[[370,3]]},"237":{"position":[[462,3],[476,3]]},"240":{"position":[[43,4],[192,4]]},"241":{"position":[[47,4],[168,5]]},"242":{"position":[[63,4],[139,5]]},"243":{"position":[[103,3],[184,3]]},"246":{"position":[[107,3],[152,3],[174,3]]},"247":{"position":[[19,3],[1916,5]]},"250":{"position":[[58,3]]},"254":{"position":[[739,4]]},"255":{"position":[[72,5]]},"257":{"position":[[50,3],[182,5]]},"258":{"position":[[63,3],[108,3],[1422,5],[1665,3],[1801,3],[1866,3]]},"264":{"position":[[101,5],[425,3]]},"267":{"position":[[160,4],[254,3],[662,5],[678,3],[719,3],[739,3],[1272,3],[1509,3],[1531,3],[2443,5],[2474,5],[3741,5]]},"268":{"position":[[157,4],[312,3],[487,5],[618,3],[864,3],[891,3],[1066,3],[1108,3],[1880,3],[2118,3],[2303,5],[2754,3]]},"269":{"position":[[112,3],[148,3],[177,3],[199,3],[3281,3],[3303,3],[3635,3],[3853,3],[3942,3]]},"277":{"position":[[3,3],[146,4],[199,3],[263,5],[299,3],[481,4],[521,5],[704,4],[1091,5],[2332,4],[2656,3],[2978,3]]},"279":{"position":[[194,4],[604,4]]},"280":{"position":[[78,6],[414,4]]},"283":{"position":[[868,5],[939,5]]},"284":{"position":[[396,3]]},"289":{"position":[[149,5],[181,5]]},"291":{"position":[[43,5]]},"292":{"position":[[930,4]]},"294":{"position":[[680,3]]},"295":{"position":[[3,3],[779,5]]},"296":{"position":[[60,4]]},"298":{"position":[[483,5],[551,4],[592,3],[856,4],[941,4],[949,5],[1016,3],[1094,3],[1195,3],[1275,5]]},"299":{"position":[[59,3],[190,3]]},"300":{"position":[[9,4],[217,5],[318,5],[607,3],[1123,5]]},"301":{"position":[[329,3]]},"302":{"position":[[108,3],[367,3]]},"306":{"position":[[150,6]]},"311":{"position":[[606,3]]},"312":{"position":[[357,5]]},"314":{"position":[[46,4],[176,4]]},"318":{"position":[[189,3],[254,3],[1133,5],[1260,5]]},"319":{"position":[[42,5]]},"321":{"position":[[42,3],[110,5],[453,3],[475,3],[779,4],[903,4]]},"324":{"position":[[106,4]]},"326":{"position":[[131,3],[914,3],[1396,4]]},"327":{"position":[[16,6],[110,6],[197,5]]},"328":{"position":[[42,5],[126,3],[203,3],[951,3],[965,3]]},"330":{"position":[[147,3],[196,3],[556,3]]},"333":{"position":[[11,3]]},"334":{"position":[[760,3]]},"335":{"position":[[1386,5]]},"336":{"position":[[36,3],[72,3],[275,3],[551,5]]},"337":{"position":[[86,3]]},"339":{"position":[[8,5]]},"342":{"position":[[121,3],[156,3]]},"345":{"position":[[174,3],[206,3]]},"348":{"position":[[52,3],[356,3],[437,3],[1190,5],[1283,5]]},"351":{"position":[[156,3],[331,3],[353,3],[1436,5],[1569,5],[1700,3],[1807,3],[1927,5],[2132,3]]},"352":{"position":[[15,4],[203,4],[335,3],[357,3],[663,3],[1147,5],[1307,5],[1602,3]]},"353":{"position":[[102,3],[154,3]]},"354":{"position":[[229,3]]},"359":{"position":[[485,4]]},"360":{"position":[[110,3]]},"361":{"position":[[332,5],[416,3],[512,5]]},"364":{"position":[[43,3]]},"365":{"position":[[269,3],[573,4],[969,4]]},"366":{"position":[[508,5],[652,5]]},"369":{"position":[[11,3],[1042,3],[1078,3],[1281,3]]},"373":{"position":[[102,4]]},"375":{"position":[[189,3],[211,3],[230,3]]},"376":{"position":[[113,3],[135,3],[161,3],[183,3],[2929,4]]},"382":{"position":[[238,3]]},"383":{"position":[[315,3],[1031,3],[1053,3]]},"384":{"position":[[112,3],[145,3],[174,3],[196,3],[3322,3],[3344,3]]},"388":{"position":[[391,3]]},"389":{"position":[[43,3],[321,5]]},"390":{"position":[[669,5]]},"391":{"position":[[23,3],[107,3],[3717,5]]},"393":{"position":[[11,5],[216,3],[480,3],[540,5]]},"394":{"position":[[100,3],[194,3],[250,5],[593,5]]},"395":{"position":[[119,3],[346,3],[369,3],[399,3],[460,3],[479,3],[3727,4],[3880,4],[4240,5],[4330,3],[6816,3]]},"396":{"position":[[479,5],[689,3]]},"398":{"position":[[81,5],[149,3]]},"404":{"position":[[101,5],[425,3]]},"407":{"position":[[160,4],[254,3],[662,5],[678,3],[719,3],[739,3],[1272,3],[1509,3],[1531,3],[2443,5],[2474,5],[3741,5]]},"408":{"position":[[157,4],[312,3],[487,5],[618,3],[864,3],[891,3],[1066,3],[1108,3],[1880,3],[2118,3],[2303,5],[2754,3]]},"409":{"position":[[112,3],[148,3],[177,3],[199,3],[3281,3],[3303,3],[3635,3],[3853,3],[3942,3]]},"413":{"position":[[127,3]]},"414":{"position":[[66,5],[469,4],[638,5]]},"416":{"position":[[1157,3],[3120,5],[4580,4],[4624,4],[4685,5],[4732,4]]},"417":{"position":[[1644,5]]},"418":{"position":[[75,5]]},"419":{"position":[[63,3],[138,3],[2499,5],[3507,5],[6504,3],[6518,3]]},"421":{"position":[[95,5]]},"423":{"position":[[9,3],[31,3],[439,3],[607,5]]},"424":{"position":[[1362,4],[1448,3]]},"426":{"position":[[38,3],[52,3]]},"431":{"position":[[11,3],[33,3]]},"433":{"position":[[839,4],[1204,5],[1834,3]]},"434":{"position":[[36,3],[50,3],[2233,5],[2318,3],[2480,3],[2770,3],[3880,3]]},"435":{"position":[[182,3]]},"439":{"position":[[55,3]]},"440":{"position":[[112,3],[216,3],[251,3],[3371,4],[3711,4],[4803,3],[4865,3]]},"441":{"position":[[443,3],[543,3],[598,3],[1634,4],[1889,5],[2180,3],[2241,3],[4549,3],[4631,3]]},"442":{"position":[[55,5]]},"445":{"position":[[107,3],[152,3],[174,3]]},"446":{"position":[[19,3],[1916,5]]},"452":{"position":[[232,3],[254,3]]},"453":{"position":[[125,3]]},"456":{"position":[[18,3],[291,3],[823,3],[837,3],[1229,5]]},"458":{"position":[[333,4],[476,4],[714,5]]},"461":{"position":[[567,3],[624,3],[646,3]]},"462":{"position":[[104,3],[164,3],[186,3]]},"465":{"position":[[43,4],[192,4]]},"466":{"position":[[47,4],[168,5]]},"467":{"position":[[63,4],[139,5]]},"468":{"position":[[103,3],[184,3]]},"472":{"position":[[370,3]]},"473":{"position":[[462,3],[476,3]]},"476":{"position":[[27,3],[108,3],[130,3]]},"477":{"position":[[68,3],[556,3],[1417,3],[1476,3],[1513,3],[1532,3]]},"478":{"position":[[36,3],[153,5]]},"480":{"position":[[50,3],[182,5]]},"481":{"position":[[63,3],[108,3],[1422,5],[1665,3],[1801,3],[1866,3]]},"485":{"position":[[739,4]]},"486":{"position":[[72,5]]},"488":{"position":[[58,3]]},"495":{"position":[[868,5],[939,5]]},"496":{"position":[[396,3]]},"501":{"position":[[149,5],[181,5]]},"503":{"position":[[43,5]]},"504":{"position":[[930,4]]},"506":{"position":[[680,3]]},"507":{"position":[[3,3],[779,5]]},"508":{"position":[[60,4]]},"511":{"position":[[150,6]]},"514":{"position":[[3,3],[146,4],[199,3],[263,5],[299,3],[481,4],[521,5],[704,4],[2164,4],[2488,3],[2810,3]]},"516":{"position":[[194,4],[604,4]]},"517":{"position":[[78,6],[414,4]]},"519":{"position":[[483,5],[551,4],[592,3],[856,4],[941,4],[949,5],[1016,3],[1094,3],[1195,3],[1275,5]]},"520":{"position":[[59,3],[190,3]]},"521":{"position":[[9,4],[217,5],[318,5],[607,3],[1123,5]]},"522":{"position":[[329,3]]},"523":{"position":[[108,3],[367,3]]},"528":{"position":[[606,3]]},"529":{"position":[[357,5]]},"531":{"position":[[46,4],[176,4]]},"535":{"position":[[131,3],[914,3],[1396,4]]},"536":{"position":[[16,6],[110,6],[197,5]]},"537":{"position":[[42,5],[126,3],[203,3],[951,3],[965,3]]},"539":{"position":[[42,3],[110,5],[453,3],[475,3],[779,4],[903,4]]},"542":{"position":[[106,4]]},"544":{"position":[[189,3],[254,3],[1133,5],[1260,5]]},"545":{"position":[[42,5]]},"547":{"position":[[147,3],[196,3],[570,3]]},"550":{"position":[[11,3]]},"551":{"position":[[760,3]]},"552":{"position":[[1386,5]]},"553":{"position":[[36,3],[72,3],[275,3],[551,5]]},"554":{"position":[[86,3]]},"556":{"position":[[121,3],[156,3]]},"559":{"position":[[8,5]]},"562":{"position":[[174,3],[206,3]]},"564":{"position":[[52,3],[356,3],[437,3],[1190,5],[1283,5]]},"567":{"position":[[156,3],[331,3],[353,3],[1436,5],[1569,5],[1700,3],[1807,3],[1927,5],[2132,3]]},"568":{"position":[[15,4],[203,4],[335,3],[357,3],[663,3],[1147,5],[1307,5],[1602,3]]},"569":{"position":[[102,3],[154,3]]},"570":{"position":[[229,3]]},"575":{"position":[[485,4]]},"576":{"position":[[110,3]]},"577":{"position":[[332,5],[416,3],[512,5]]},"580":{"position":[[43,3]]},"581":{"position":[[269,3],[573,4],[969,4]]},"582":{"position":[[508,5],[652,5]]},"585":{"position":[[11,3],[1042,3],[1078,3],[1281,3]]},"589":{"position":[[102,4]]},"591":{"position":[[189,3],[211,3],[230,3]]},"592":{"position":[[113,3],[135,3],[161,3],[183,3],[2929,4]]},"596":{"position":[[176,3]]},"598":{"position":[[13,3],[37,3],[1115,3],[1787,4],[1920,3],[1965,4],[2134,4]]},"599":{"position":[[13,3],[310,5],[488,4]]},"600":{"position":[[13,3],[855,4],[1039,4],[1157,5],[1200,5]]},"601":{"position":[[13,3],[335,3],[1111,3],[1939,4],[2196,3]]},"602":{"position":[[13,3],[563,5],[647,5],[729,4],[808,5],[893,5],[945,3],[1097,3],[1898,5],[1956,4],[2026,5]]},"604":{"position":[[515,5]]},"605":{"position":[[13,3]]},"606":{"position":[[13,3],[977,5]]},"608":{"position":[[13,3],[777,4]]},"610":{"position":[[13,3],[529,5],[687,3],[793,4]]},"611":{"position":[[13,3],[714,5],[863,5]]},"612":{"position":[[30,3],[427,3],[1478,4]]},"613":{"position":[[13,3],[89,3],[1628,4],[1637,5],[1729,3]]},"616":{"position":[[13,3],[1232,4],[1293,5]]},"617":{"position":[[13,3],[1106,3],[1250,3]]},"624":{"position":[[238,3]]},"625":{"position":[[315,3],[1031,3],[1053,3]]},"626":{"position":[[112,3],[145,3],[174,3],[196,3],[3322,3],[3344,3]]},"630":{"position":[[11,5],[216,3],[480,3],[540,5]]},"631":{"position":[[100,3],[194,3],[250,5],[593,5]]},"632":{"position":[[119,3],[346,3],[369,3],[399,3],[460,3],[479,3],[3727,4],[3880,4],[4240,5],[4330,3],[6816,3]]},"633":{"position":[[479,5],[689,3]]},"635":{"position":[[81,5],[149,3]]},"641":{"position":[[101,5],[425,3]]},"644":{"position":[[160,4],[254,3],[662,5],[678,3],[719,3],[739,3],[1272,3],[1509,3],[1531,3],[2443,5],[2474,5],[3741,5]]},"645":{"position":[[157,4],[312,3],[487,5],[618,3],[864,3],[891,3],[1066,3],[1108,3],[1880,3],[2118,3],[2303,5],[2754,3]]},"646":{"position":[[112,3],[148,3],[177,3],[199,3],[3281,3],[3303,3],[3635,3],[3853,3],[3942,3]]},"650":{"position":[[127,3]]},"651":{"position":[[66,5],[469,4],[638,5]]},"653":{"position":[[1157,3],[3120,5],[4580,4],[4624,4],[4685,5],[4732,4]]},"654":{"position":[[1644,5]]},"655":{"position":[[75,5]]},"656":{"position":[[63,3],[138,3],[2499,5],[3507,5],[6504,3],[6518,3]]},"658":{"position":[[391,3]]},"659":{"position":[[43,3],[321,5]]},"660":{"position":[[669,5]]},"661":{"position":[[23,3],[107,3],[3717,5]]},"663":{"position":[[95,5]]},"665":{"position":[[9,3],[31,3],[439,3],[607,5]]},"666":{"position":[[1362,4],[1448,3]]},"668":{"position":[[38,3],[52,3]]},"672":{"position":[[107,3],[152,3],[174,3]]},"673":{"position":[[19,3],[1916,5]]},"678":{"position":[[11,3],[33,3]]},"680":{"position":[[839,4],[1204,5],[1834,3]]},"681":{"position":[[36,3],[50,3],[2243,5],[2328,3],[2490,3],[2780,3],[3898,3]]},"682":{"position":[[182,3]]},"686":{"position":[[55,3]]},"687":{"position":[[112,3],[216,3],[251,3],[3371,4],[3711,4],[4803,3],[4865,3]]},"688":{"position":[[443,3],[543,3],[598,3],[1634,4],[1889,5],[2180,3],[2241,3],[4549,3],[4631,3]]},"689":{"position":[[55,5]]},"692":{"position":[[232,3],[254,3]]},"693":{"position":[[125,3]]},"696":{"position":[[18,3],[291,3],[823,3],[837,3],[1229,5]]},"698":{"position":[[27,3],[108,3],[130,3]]},"699":{"position":[[68,3],[556,3],[1417,3],[1476,3],[1513,3],[1532,3]]},"700":{"position":[[36,3],[153,5]]},"704":{"position":[[176,3]]},"706":{"position":[[13,3],[37,3],[1115,3],[1787,4],[1920,3],[1965,4],[2134,4]]},"707":{"position":[[13,3],[310,5],[488,4]]},"708":{"position":[[13,3],[855,4],[1039,4],[1157,5],[1200,5]]},"709":{"position":[[13,3],[335,3],[1111,3],[1939,4],[2196,3]]},"710":{"position":[[13,3],[563,5],[647,5],[729,4],[808,5],[893,5],[945,3],[1097,3],[1898,5],[1956,4],[2026,5]]},"712":{"position":[[515,5]]},"713":{"position":[[13,3]]},"714":{"position":[[13,3],[977,5]]},"716":{"position":[[13,3],[777,4]]},"718":{"position":[[13,3],[529,5],[687,3],[793,4]]},"719":{"position":[[13,3],[714,5],[863,5]]},"720":{"position":[[30,3],[427,3],[1478,4]]},"721":{"position":[[13,3],[89,3],[1628,4],[1637,5],[1729,3]]},"724":{"position":[[13,3],[1232,4],[1293,5]]},"725":{"position":[[13,3],[1106,3],[1250,3]]}},"keywords":{}}],["usabl",{"_index":2056,"title":{},"content":{"162":{"position":[[610,7]]},"351":{"position":[[647,7]]},"567":{"position":[[647,7]]}},"keywords":{}}],["usag",{"_index":1632,"title":{"96":{"position":[[0,6]]},"106":{"position":[[0,6]]},"127":{"position":[[0,6]]},"273":{"position":[[0,6]]},"278":{"position":[[0,6]]},"288":{"position":[[0,6]]},"490":{"position":[[0,6]]},"500":{"position":[[0,6]]},"515":{"position":[[0,6]]}},"content":{"164":{"position":[[323,6]]},"267":{"position":[[3944,5]]},"353":{"position":[[358,6]]},"407":{"position":[[3944,5]]},"414":{"position":[[772,6]]},"569":{"position":[[358,6]]},"644":{"position":[[3944,5]]},"651":{"position":[[772,6]]}},"keywords":{}}],["use.commun",{"_index":86,"title":{},"content":{"1":{"position":[[1090,13]]}},"keywords":{}}],["usecasp",{"_index":1647,"title":{},"content":{"98":{"position":[[691,9]]},"290":{"position":[[691,9]]},"502":{"position":[[691,9]]}},"keywords":{}}],["user",{"_index":772,"title":{},"content":{"31":{"position":[[1680,4],[2321,5]]},"83":{"position":[[253,4]]},"110":{"position":[[416,4]]},"202":{"position":[[320,5]]},"252":{"position":[[253,4]]},"305":{"position":[[416,4]]},"419":{"position":[[1778,6],[1793,4],[1933,4],[2010,4]]},"422":{"position":[[320,5]]},"483":{"position":[[253,4]]},"510":{"position":[[416,4]]},"656":{"position":[[1778,6],[1793,4],[1933,4],[2010,4]]},"664":{"position":[[320,5]]}},"keywords":{}}],["users.allow",{"_index":2436,"title":{},"content":{"202":{"position":[[225,17]]},"422":{"position":[[225,17]]},"664":{"position":[[225,17]]}},"keywords":{}}],["usinglivenet",{"_index":1646,"title":{},"content":{"98":{"position":[[612,12]]},"290":{"position":[[612,12]]},"502":{"position":[[612,12]]}},"keywords":{}}],["usiz",{"_index":2075,"title":{},"content":{"162":{"position":[[2207,5]]},"168":{"position":[[1890,6]]},"348":{"position":[[1890,6]]},"351":{"position":[[2229,5]]},"564":{"position":[[1890,6]]},"567":{"position":[[2229,5]]},"601":{"position":[[1843,6]]},"613":{"position":[[557,7],[647,6]]},"709":{"position":[[1843,6]]},"721":{"position":[[557,7],[647,6]]}},"keywords":{}}],["utf",{"_index":2608,"title":{},"content":{"211":{"position":[[775,3]]},"212":{"position":[[3785,3]]},"390":{"position":[[749,3]]},"391":{"position":[[3803,3]]},"660":{"position":[[749,3]]},"661":{"position":[[3803,3]]}},"keywords":{}}],["util",{"_index":907,"title":{"613":{"position":[[14,8]]},"721":{"position":[[14,8]]}},"content":{"39":{"position":[[350,8],[1524,8]]},"50":{"position":[[524,7]]},"79":{"position":[[1445,9]]},"114":{"position":[[3,7]]},"143":{"position":[[801,7],[942,8]]},"230":{"position":[[1462,9]]},"257":{"position":[[3,7]]},"328":{"position":[[776,7],[917,8]]},"461":{"position":[[1462,9]]},"480":{"position":[[3,7]]},"537":{"position":[[776,7],[917,8]]}},"keywords":{}}],["v0.8.0",{"_index":2786,"title":{"259":{"position":[[19,6]]},"399":{"position":[[19,6]]},"636":{"position":[[19,6]]}},"content":{"262":{"position":[[112,7]]},"265":{"position":[[424,7]]},"269":{"position":[[81,7]]},"402":{"position":[[112,7]]},"405":{"position":[[424,7]]},"409":{"position":[[81,7]]},"639":{"position":[[112,7]]},"642":{"position":[[424,7]]},"646":{"position":[[81,7]]}},"keywords":{}}],["v0.9.0",{"_index":3087,"title":{"377":{"position":[[19,6]]},"619":{"position":[[19,6]]}},"content":{"380":{"position":[[112,7]]},"384":{"position":[[81,7]]},"622":{"position":[[112,7]]},"626":{"position":[[81,7]]}},"keywords":{}}],["valid",{"_index":2965,"title":{},"content":{"321":{"position":[[357,6]]},"416":{"position":[[2211,11]]},"539":{"position":[[357,6]]},"653":{"position":[[2211,11]]}},"keywords":{}}],["valu",{"_index":260,"title":{"86":{"position":[[0,5]]},"255":{"position":[[0,5]]},"486":{"position":[[0,5]]}},"content":{"9":{"position":[[78,7]]},"17":{"position":[[448,6],[761,6],[2731,6],[2918,5],[3022,7],[3070,7],[3144,6],[3397,5],[3473,5],[3579,7],[3627,7],[3683,7],[3741,6],[3832,7]]},"22":{"position":[[894,6],[954,6],[1033,6],[1111,6],[1214,6]]},"31":{"position":[[266,6]]},"32":{"position":[[1547,6]]},"39":{"position":[[1844,7],[2062,6]]},"43":{"position":[[521,6],[592,7]]},"51":{"position":[[125,6],[144,5],[186,5],[215,5],[514,6],[615,6],[691,6],[1305,6]]},"52":{"position":[[1116,5],[1288,9],[1592,5],[3275,6],[6466,5],[6502,5],[6585,5],[6704,5]]},"53":{"position":[[302,6],[415,6],[473,6],[499,6],[603,6],[688,6],[755,6],[843,6],[881,6],[918,6]]},"71":{"position":[[90,6]]},"76":{"position":[[356,6],[417,7],[500,7],[610,5],[675,7],[691,5],[841,6]]},"78":{"position":[[60,5],[171,6],[239,6],[353,5],[377,5]]},"79":{"position":[[28,5],[84,6],[117,5],[320,5],[1214,7],[1246,6],[1312,6]]},"81":{"position":[[291,7]]},"83":{"position":[[337,5],[417,6],[646,6]]},"84":{"position":[[399,5],[443,7]]},"86":{"position":[[41,5]]},"95":{"position":[[451,6]]},"99":{"position":[[137,5],[186,5]]},"103":{"position":[[577,5]]},"126":{"position":[[245,6],[817,7],[1103,5]]},"129":{"position":[[347,5],[461,5],[522,5],[730,6]]},"145":{"position":[[248,6]]},"146":{"position":[[189,6],[231,5],[255,6]]},"147":{"position":[[229,5],[238,6],[1043,5],[1101,6],[1166,5],[1190,6]]},"163":{"position":[[52,5],[107,6],[137,5],[562,6],[607,6],[1630,7]]},"168":{"position":[[1842,5]]},"178":{"position":[[203,6],[245,5],[269,6],[535,5],[544,6],[630,5],[688,6],[753,5],[777,6],[858,5],[893,5],[931,5]]},"193":{"position":[[262,7]]},"195":{"position":[[684,6]]},"196":{"position":[[1715,5]]},"197":{"position":[[1695,5]]},"198":{"position":[[2426,5]]},"201":{"position":[[105,5]]},"203":{"position":[[402,5]]},"205":{"position":[[906,6],[2021,6],[2163,6]]},"206":{"position":[[2612,6],[3072,6]]},"209":{"position":[[88,6],[318,5],[353,6],[724,6],[1114,6],[1140,6],[1269,6],[1473,5],[1531,6]]},"210":{"position":[[1101,6]]},"211":{"position":[[325,6]]},"212":{"position":[[613,6],[875,5],[1244,5],[2129,5],[2169,7],[2256,5],[2300,6],[2531,7],[2570,5],[2715,5],[2882,5],[3129,5],[4602,6],[4625,6]]},"221":{"position":[[654,5]]},"223":{"position":[[155,5],[361,6]]},"227":{"position":[[356,6],[417,7],[500,7],[610,5],[675,7],[691,5],[841,6]]},"229":{"position":[[60,5],[171,6],[260,6],[374,5],[398,5]]},"230":{"position":[[28,5],[84,6],[117,5],[337,5],[1231,7],[1263,6],[1329,6]]},"232":{"position":[[291,7]]},"235":{"position":[[90,6]]},"252":{"position":[[337,5],[417,6],[646,6]]},"253":{"position":[[399,5],[443,7]]},"255":{"position":[[41,5]]},"267":{"position":[[2242,6],[2327,6],[2625,6]]},"268":{"position":[[3178,6]]},"269":{"position":[[1652,6],[3229,6],[3602,6]]},"277":{"position":[[245,6],[817,7],[1271,5]]},"280":{"position":[[347,5],[461,5],[522,5],[731,6]]},"287":{"position":[[451,6]]},"291":{"position":[[137,5],[186,5]]},"295":{"position":[[577,5]]},"324":{"position":[[667,5],[1039,5]]},"333":{"position":[[248,6]]},"334":{"position":[[189,6],[231,5],[255,6]]},"335":{"position":[[229,5],[238,6],[1051,5],[1109,6],[1174,5],[1198,6]]},"348":{"position":[[1842,5]]},"352":{"position":[[52,5],[107,6],[137,5],[584,6],[629,6],[1652,7]]},"369":{"position":[[203,6],[245,5],[269,6],[535,5],[544,6],[630,5],[688,6],[753,5],[777,6],[858,5],[893,5],[931,5]]},"384":{"position":[[1665,6],[3270,6],[3588,6]]},"388":{"position":[[88,6],[318,5],[353,6],[656,6],[1046,6],[1072,6],[1201,6],[1405,5],[1463,6]]},"389":{"position":[[1038,6]]},"390":{"position":[[312,6]]},"391":{"position":[[613,6],[875,5],[1244,5],[2129,5],[2169,7],[2256,5],[2300,6],[2531,7],[2570,5],[2721,5],[2888,5],[3147,5],[4620,6],[4643,6]]},"407":{"position":[[2242,6],[2327,6],[2625,6]]},"408":{"position":[[3178,6]]},"409":{"position":[[1652,6],[3229,6],[3602,6]]},"421":{"position":[[105,5]]},"423":{"position":[[402,5]]},"425":{"position":[[881,6],[1996,6],[2114,6]]},"426":{"position":[[2597,6],[3052,6]]},"429":{"position":[[262,7]]},"431":{"position":[[684,6]]},"432":{"position":[[1593,5]]},"433":{"position":[[1694,5]]},"434":{"position":[[2416,5]]},"440":{"position":[[2378,5],[2862,5]]},"441":{"position":[[1179,5],[1516,7],[3177,6]]},"454":{"position":[[654,5]]},"456":{"position":[[155,5],[361,6]]},"458":{"position":[[356,6],[417,7],[500,7],[610,5],[675,7],[691,5],[841,6]]},"460":{"position":[[60,5],[171,6],[260,6],[374,5],[398,5]]},"461":{"position":[[28,5],[84,6],[117,5],[337,5],[1231,7],[1263,6],[1329,6]]},"463":{"position":[[291,7]]},"471":{"position":[[90,6]]},"476":{"position":[[683,6]]},"483":{"position":[[337,5],[417,6],[646,6]]},"484":{"position":[[399,5],[443,7]]},"486":{"position":[[41,5]]},"499":{"position":[[451,6]]},"503":{"position":[[137,5],[186,5]]},"507":{"position":[[577,5]]},"514":{"position":[[245,6],[817,7],[1103,5]]},"517":{"position":[[347,5],[461,5],[522,5],[731,6]]},"542":{"position":[[667,5],[1039,5]]},"550":{"position":[[248,6]]},"551":{"position":[[189,6],[231,5],[255,6]]},"552":{"position":[[229,5],[238,6],[1051,5],[1109,6],[1174,5],[1198,6]]},"564":{"position":[[1842,5]]},"568":{"position":[[52,5],[107,6],[137,5],[584,6],[629,6],[1652,7]]},"585":{"position":[[203,6],[245,5],[269,6],[535,5],[544,6],[630,5],[688,6],[753,5],[777,6],[858,5],[893,5],[931,5]]},"596":{"position":[[1129,7]]},"598":{"position":[[1100,7],[1451,5],[1871,5],[1992,6]]},"599":{"position":[[504,5],[581,5]]},"601":{"position":[[1534,6],[1776,6],[1852,6]]},"602":{"position":[[631,5],[777,5],[845,5]]},"613":{"position":[[2232,7]]},"626":{"position":[[1665,6],[3270,6],[3588,6]]},"644":{"position":[[2242,6],[2327,6],[2625,6]]},"645":{"position":[[3178,6]]},"646":{"position":[[1652,6],[3229,6],[3602,6]]},"658":{"position":[[88,6],[318,5],[353,6],[656,6],[1046,6],[1072,6],[1201,6],[1405,5],[1463,6]]},"659":{"position":[[1038,6]]},"660":{"position":[[312,6]]},"661":{"position":[[613,6],[875,5],[1244,5],[2129,5],[2169,7],[2256,5],[2300,6],[2531,7],[2570,5],[2721,5],[2888,5],[3147,5],[4620,6],[4643,6]]},"663":{"position":[[105,5]]},"665":{"position":[[402,5]]},"667":{"position":[[881,6],[1996,6],[2114,6]]},"668":{"position":[[2612,6],[3072,6]]},"676":{"position":[[262,7]]},"678":{"position":[[684,6]]},"679":{"position":[[1593,5]]},"680":{"position":[[1694,5]]},"681":{"position":[[2426,5]]},"687":{"position":[[2378,5],[2862,5]]},"688":{"position":[[1179,5],[1516,7],[3177,6]]},"694":{"position":[[654,5]]},"696":{"position":[[155,5],[361,6]]},"698":{"position":[[683,6]]},"704":{"position":[[1129,7]]},"706":{"position":[[1100,7],[1451,5],[1871,5],[1992,6]]},"707":{"position":[[504,5],[581,5]]},"709":{"position":[[1534,6],[1776,6],[1852,6]]},"710":{"position":[[631,5],[777,5],[845,5]]},"721":{"position":[[2232,7]]}},"keywords":{}}],["valuabl",{"_index":2950,"title":{},"content":{"270":{"position":[[470,8]]},"385":{"position":[[470,8]]},"410":{"position":[[470,8]]},"627":{"position":[[470,8]]},"647":{"position":[[470,8]]}},"keywords":{}}],["value,defin",{"_index":2305,"title":{},"content":{"193":{"position":[[95,14]]},"429":{"position":[[95,14]]},"676":{"position":[[95,14]]}},"keywords":{}}],["value.map",{"_index":1499,"title":{},"content":{"81":{"position":[[208,14]]},"232":{"position":[[208,14]]},"463":{"position":[[208,14]]}},"keywords":{}}],["valueupd",{"_index":1196,"title":{},"content":{"51":{"position":[[458,14],[841,12],[1181,12]]},"53":{"position":[[980,12],[1293,12]]}},"keywords":{}}],["valueupdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"",{"_index":1294,"title":{},"content":{"52":{"position":[[5914,447]]}},"keywords":{}}],["var",{"_index":1415,"title":{"162":{"position":[[0,4]]},"351":{"position":[[0,4]]},"567":{"position":[[0,4]]}},"content":{"76":{"position":[[213,4],[321,3],[425,4],[432,3],[513,3],[755,3]]},"78":{"position":[[134,3]]},"145":{"position":[[203,4]]},"146":{"position":[[67,4]]},"162":{"position":[[4,3],[195,3],[498,3],[1770,3]]},"163":{"position":[[355,5],[688,4],[1073,3],[1541,3],[1597,5]]},"178":{"position":[[79,4]]},"195":{"position":[[53,5],[783,4]]},"203":{"position":[[80,5]]},"209":{"position":[[464,5]]},"220":{"position":[[54,3]]},"221":{"position":[[602,3]]},"223":{"position":[[151,3]]},"227":{"position":[[213,4],[321,3],[425,4],[432,3],[513,3],[755,3]]},"229":{"position":[[134,3]]},"269":{"position":[[248,5]]},"321":{"position":[[495,5]]},"333":{"position":[[203,4]]},"334":{"position":[[67,4]]},"351":{"position":[[4,3],[195,3],[535,3],[1792,3]]},"352":{"position":[[377,5],[710,4],[1095,3],[1563,3],[1619,5]]},"353":{"position":[[183,5]]},"369":{"position":[[79,4]]},"384":{"position":[[245,5]]},"388":{"position":[[454,5]]},"409":{"position":[[248,5]]},"419":{"position":[[132,5],[697,4]]},"423":{"position":[[80,5]]},"431":{"position":[[53,5],[783,4]]},"441":{"position":[[666,5]]},"453":{"position":[[54,3]]},"454":{"position":[[602,3]]},"456":{"position":[[151,3]]},"458":{"position":[[213,4],[321,3],[425,4],[432,3],[513,3],[755,3]]},"460":{"position":[[134,3]]},"476":{"position":[[179,5]]},"539":{"position":[[495,5]]},"550":{"position":[[203,4]]},"551":{"position":[[67,4]]},"567":{"position":[[4,3],[195,3],[535,3],[1792,3]]},"568":{"position":[[377,5],[710,4],[1095,3],[1563,3],[1619,5]]},"569":{"position":[[183,5]]},"585":{"position":[[79,4]]},"596":{"position":[[199,5]]},"598":{"position":[[142,4]]},"600":{"position":[[56,5]]},"601":{"position":[[1134,5],[2021,3]]},"602":{"position":[[36,5]]},"603":{"position":[[281,4]]},"608":{"position":[[81,5]]},"613":{"position":[[72,5]]},"616":{"position":[[104,4]]},"617":{"position":[[62,5]]},"626":{"position":[[245,5]]},"646":{"position":[[248,5]]},"656":{"position":[[132,5],[697,4]]},"658":{"position":[[454,5]]},"665":{"position":[[80,5]]},"678":{"position":[[53,5],[783,4]]},"688":{"position":[[666,5]]},"693":{"position":[[54,3]]},"694":{"position":[[602,3]]},"696":{"position":[[151,3]]},"698":{"position":[[179,5]]},"704":{"position":[[199,5]]},"706":{"position":[[142,4]]},"708":{"position":[[56,5]]},"709":{"position":[[1134,5],[2021,3]]},"710":{"position":[[36,5]]},"711":{"position":[[281,4]]},"716":{"position":[[81,5]]},"721":{"position":[[72,5]]},"724":{"position":[[104,4]]},"725":{"position":[[62,5]]}},"keywords":{}}],["var<(address",{"_index":3220,"title":{},"content":{"416":{"position":[[536,16]]},"419":{"position":[[907,16]]},"653":{"position":[[536,16]]},"656":{"position":[[907,16]]}},"keywords":{}}],["var<[u8",{"_index":3700,"title":{},"content":{"601":{"position":[[1235,11]]},"616":{"position":[[562,11]]},"709":{"position":[[1235,11]]},"724":{"position":[[562,11]]}},"keywords":{}}],["var<address>",{"_index":2970,"title":{},"content":{"321":{"position":[[985,19]]},"441":{"position":[[821,19],[2402,19]]},"539":{"position":[[985,19]]},"598":{"position":[[473,19],[622,19]]},"608":{"position":[[131,19]]},"617":{"position":[[121,19]]},"688":{"position":[[821,19],[2402,19]]},"706":{"position":[[473,19],[622,19]]},"716":{"position":[[131,19]]},"725":{"position":[[121,19]]}},"keywords":{}}],["var<bool>",{"_index":1991,"title":{},"content":{"146":{"position":[[262,16]]},"162":{"position":[[379,16]]},"178":{"position":[[276,16]]},"220":{"position":[[222,15]]},"334":{"position":[[262,16]]},"351":{"position":[[416,16]]},"369":{"position":[[276,16]]},"416":{"position":[[681,16]]},"419":{"position":[[1052,16]]},"453":{"position":[[222,15]]},"551":{"position":[[262,16]]},"567":{"position":[[416,16]]},"585":{"position":[[276,16]]},"598":{"position":[[195,16],[531,16]]},"606":{"position":[[101,16]]},"653":{"position":[[681,16]]},"656":{"position":[[1052,16]]},"693":{"position":[[222,15]]},"706":{"position":[[195,16],[531,16]]},"714":{"position":[[101,16]]}},"keywords":{}}],["var<bytes>",{"_index":3635,"title":{},"content":{"598":{"position":[[500,17]]},"706":{"position":[[500,17]]}},"keywords":{}}],["var<i32>",{"_index":3629,"title":{},"content":{"598":{"position":[[343,15]]},"706":{"position":[[343,15]]}},"keywords":{}}],["var<i64>",{"_index":3633,"title":{},"content":{"598":{"position":[[406,15],[592,15]]},"706":{"position":[[406,15],[592,15]]}},"keywords":{}}],["var<metadata>",{"_index":2554,"title":{},"content":{"209":{"position":[[872,20]]},"388":{"position":[[804,20]]},"658":{"position":[[804,20]]}},"keywords":{}}],["var<option<address>>",{"_index":2316,"title":{},"content":{"195":{"position":[[132,32]]},"431":{"position":[[132,32]]},"678":{"position":[[132,32]]}},"keywords":{}}],["var<status>",{"_index":3722,"title":{},"content":{"602":{"position":[[201,18]]},"710":{"position":[[201,18]]}},"keywords":{}}],["var<string>",{"_index":1525,"title":{},"content":{"84":{"position":[[239,18]]},"162":{"position":[[426,18]]},"163":{"position":[[409,18]]},"164":{"position":[[202,18]]},"203":{"position":[[185,18],[210,18]]},"253":{"position":[[239,18]]},"269":{"position":[[353,18],[378,18]]},"321":{"position":[[959,18]]},"351":{"position":[[463,18]]},"352":{"position":[[431,18]]},"353":{"position":[[237,18]]},"384":{"position":[[366,18],[391,18]]},"409":{"position":[[353,18],[378,18]]},"423":{"position":[[185,18],[210,18]]},"484":{"position":[[239,18]]},"539":{"position":[[959,18]]},"567":{"position":[[463,18]]},"568":{"position":[[431,18]]},"569":{"position":[[237,18]]},"596":{"position":[[252,18]]},"600":{"position":[[107,18]]},"626":{"position":[[366,18],[391,18]]},"646":{"position":[[353,18],[378,18]]},"665":{"position":[[185,18],[210,18]]},"704":{"position":[[252,18]]},"708":{"position":[[107,18]]}},"keywords":{}}],["var<t>",{"_index":1433,"title":{},"content":{"78":{"position":[[246,12]]},"147":{"position":[[1343,13]]},"229":{"position":[[267,12]]},"335":{"position":[[1351,13]]},"460":{"position":[[267,12]]},"552":{"position":[[1351,13]]}},"keywords":{}}],["var<u256>",{"_index":2440,"title":{},"content":{"203":{"position":[[243,16]]},"269":{"position":[[411,16]]},"384":{"position":[[424,16]]},"409":{"position":[[411,16]]},"423":{"position":[[243,16]]},"598":{"position":[[278,16],[562,16]]},"600":{"position":[[135,16]]},"626":{"position":[[424,16]]},"646":{"position":[[411,16]]},"665":{"position":[[243,16]]},"706":{"position":[[278,16],[562,16]]},"708":{"position":[[135,16]]}},"keywords":{}}],["var<u32>",{"_index":1385,"title":{},"content":{"73":{"position":[[58,14]]},"162":{"position":[[404,15]]},"163":{"position":[[1668,14]]},"209":{"position":[[850,15],[1538,15]]},"223":{"position":[[368,15]]},"237":{"position":[[58,14]]},"351":{"position":[[441,15]]},"352":{"position":[[1690,14]]},"388":{"position":[[782,15],[1470,15]]},"456":{"position":[[368,15]]},"473":{"position":[[58,14]]},"567":{"position":[[441,15]]},"568":{"position":[[1690,14]]},"605":{"position":[[72,14]]},"606":{"position":[[77,15]]},"658":{"position":[[782,15],[1470,15]]},"696":{"position":[[368,15]]},"713":{"position":[[72,14]]},"714":{"position":[[77,15]]}},"keywords":{}}],["var<u64>",{"_index":3225,"title":{},"content":{"416":{"position":[[746,15]]},"419":{"position":[[1117,15]]},"476":{"position":[[382,14]]},"653":{"position":[[746,15]]},"656":{"position":[[1117,15]]},"698":{"position":[[382,14]]}},"keywords":{}}],["var<u8>",{"_index":2439,"title":{},"content":{"203":{"position":[[162,14]]},"269":{"position":[[330,14]]},"384":{"position":[[343,14]]},"409":{"position":[[330,14]]},"423":{"position":[[162,14]]},"598":{"position":[[215,14]]},"626":{"position":[[343,14]]},"646":{"position":[[330,14]]},"665":{"position":[[162,14]]},"706":{"position":[[215,14]]}},"keywords":{}}],["var<vec<todo>>",{"_index":3731,"title":{},"content":{"602":{"position":[[1101,26]]},"710":{"position":[[1101,26]]}},"keywords":{}}],["var<vec<u256>>",{"_index":3836,"title":{},"content":{"613":{"position":[[586,26],[878,27],[2117,26]]},"721":{"position":[[586,26],[878,27],[2117,26]]}},"keywords":{}}],["var<vec<u32>>",{"_index":2053,"title":{},"content":{"162":{"position":[[452,26]]},"351":{"position":[[489,26]]},"567":{"position":[[489,26]]},"601":{"position":[[1261,26]]},"709":{"position":[[1261,26]]}},"keywords":{}}],["var.l22",{"_index":3328,"title":{},"content":{"432":{"position":[[1263,7]]},"679":{"position":[[1263,7]]}},"keywords":{}}],["var.l28",{"_index":2343,"title":{},"content":{"196":{"position":[[1321,7]]}},"keywords":{}}],["var.remov",{"_index":2820,"title":{},"content":{"267":{"position":[[432,10]]},"407":{"position":[[432,10]]},"644":{"position":[[432,10]]}},"keywords":{}}],["var::get",{"_index":2375,"title":{},"content":{"197":{"position":[[1521,10],[1771,10]]},"433":{"position":[[1520,10],[1770,10]]},"680":{"position":[[1520,10],[1770,10]]}},"keywords":{}}],["var::get_or_default",{"_index":2378,"title":{},"content":{"197":{"position":[[1839,21]]},"433":{"position":[[1838,21]]},"680":{"position":[[1838,21]]}},"keywords":{}}],["variabl",{"_index":409,"title":{"597":{"position":[[0,8]]},"600":{"position":[[0,10]]},"705":{"position":[[0,8]]},"708":{"position":[[0,10]]}},"content":{"15":{"position":[[279,12]]},"17":{"position":[[259,9]]},"31":{"position":[[2344,9],[2839,8]]},"39":{"position":[[2140,10],[2900,9]]},"51":{"position":[[408,9]]},"65":{"position":[[213,8]]},"126":{"position":[[281,10]]},"129":{"position":[[333,8]]},"162":{"position":[[179,8],[1617,8]]},"163":{"position":[[1357,9]]},"240":{"position":[[213,8]]},"277":{"position":[[281,10]]},"280":{"position":[[333,8]]},"351":{"position":[[179,8],[1639,8]]},"352":{"position":[[1379,9]]},"465":{"position":[[213,8]]},"514":{"position":[[281,10]]},"517":{"position":[[333,8]]},"567":{"position":[[179,8],[1639,8]]},"568":{"position":[[1379,9]]},"596":{"position":[[716,10],[836,8],[1052,9]]},"598":{"position":[[2075,9]]},"599":{"position":[[515,8]]},"600":{"position":[[89,9],[175,9],[341,9],[371,9],[502,10],[519,10],[536,10],[558,10],[575,9],[677,9],[798,9],[925,9],[980,9],[1134,9]]},"602":{"position":[[745,8]]},"607":{"position":[[20,9]]},"613":{"position":[[1305,9],[2194,8]]},"704":{"position":[[716,10],[836,8],[1052,9]]},"706":{"position":[[2075,9]]},"707":{"position":[[515,8]]},"708":{"position":[[89,9],[175,9],[341,9],[371,9],[502,10],[519,10],[536,10],[558,10],[575,9],[677,9],[798,9],[925,9],[980,9],[1134,9]]},"710":{"position":[[745,8]]},"715":{"position":[[20,9]]},"721":{"position":[[1305,9],[2194,8]]}},"keywords":{}}],["variable<address>",{"_index":471,"title":{},"content":{"17":{"position":[[518,24]]}},"keywords":{}}],["variable<bool>",{"_index":467,"title":{},"content":{"17":{"position":[[455,21]]},"22":{"position":[[1118,21]]}},"keywords":{}}],["variable<string>",{"_index":340,"title":{},"content":{"10":{"position":[[745,23]]},"17":{"position":[[1980,23],[2012,23]]}},"keywords":{}}],["variable<u256>",{"_index":517,"title":{},"content":{"17":{"position":[[2080,21]]}},"keywords":{}}],["variable<u32>",{"_index":469,"title":{},"content":{"17":{"position":[[490,20]]},"51":{"position":[[521,19]]}},"keywords":{}}],["variable<u8>",{"_index":515,"title":{},"content":{"17":{"position":[[2046,19]]}},"keywords":{}}],["variant",{"_index":2368,"title":{},"content":{"197":{"position":[[1065,7],[1450,7]]},"321":{"position":[[1781,8]]},"324":{"position":[[833,7]]},"433":{"position":[[1064,7],[1449,7]]},"539":{"position":[[1781,8]]},"542":{"position":[[833,7]]},"680":{"position":[[1064,7],[1449,7]]}},"keywords":{}}],["variat",{"_index":2081,"title":{},"content":{"163":{"position":[[167,9]]},"352":{"position":[[167,9]]},"568":{"position":[[167,9]]}},"keywords":{}}],["variou",{"_index":1732,"title":{},"content":{"115":{"position":[[1440,7]]},"258":{"position":[[1386,7]]},"442":{"position":[[121,7]]},"481":{"position":[[1386,7]]},"689":{"position":[[121,7]]}},"keywords":{}}],["vec",{"_index":2054,"title":{},"content":{"162":{"position":[[545,3],[1930,3]]},"164":{"position":[[91,4],[300,4]]},"209":{"position":[[1100,5]]},"212":{"position":[[1426,6],[2032,7]]},"351":{"position":[[582,3],[1952,3]]},"353":{"position":[[91,4],[335,4]]},"388":{"position":[[1032,5]]},"391":{"position":[[1426,6],[2032,7]]},"419":{"position":[[1603,7],[1611,7]]},"567":{"position":[[582,3],[1952,3]]},"569":{"position":[[91,4],[335,4]]},"601":{"position":[[1256,4],[1556,3],[1667,3],[1948,3]]},"613":{"position":[[686,3]]},"656":{"position":[[1603,7],[1611,7]]},"658":{"position":[[1032,5]]},"661":{"position":[[1426,6],[2032,7]]},"709":{"position":[[1256,4],[1556,3],[1667,3],[1948,3]]},"721":{"position":[[686,3]]}},"keywords":{}}],["vec<address>",{"_index":3306,"title":{},"content":{"419":{"position":[[2228,19],[2261,19],[2292,18]]},"656":{"position":[[2228,19],[2261,19],[2292,18]]}},"keywords":{}}],["vec<base>",{"_index":925,"title":{},"content":{"39":{"position":[[782,16]]}},"keywords":{}}],["vec<contractpart>",{"_index":927,"title":{},"content":{"39":{"position":[[810,24]]}},"keywords":{}}],["vec<doccomment>",{"_index":920,"title":{},"content":{"39":{"position":[[693,22]]}},"keywords":{}}],["vec<price>",{"_index":2551,"title":{},"content":{"209":{"position":[[637,17]]},"212":{"position":[[536,17]]},"388":{"position":[[598,17]]},"391":{"position":[[536,17]]},"658":{"position":[[598,17]]},"661":{"position":[[536,17]]}},"keywords":{}}],["vec<u8>",{"_index":1519,"title":{},"content":{"83":{"position":[[653,15]]},"212":{"position":[[671,13]]},"252":{"position":[[653,15]]},"267":{"position":[[2567,13]]},"391":{"position":[[671,13]]},"407":{"position":[[2567,13]]},"483":{"position":[[653,15]]},"644":{"position":[[2567,13]]},"661":{"position":[[671,13]]}},"keywords":{}}],["vec.is_empti",{"_index":3838,"title":{},"content":{"613":{"position":[[718,14]]},"721":{"position":[[718,14]]}},"keywords":{}}],["vec.pop",{"_index":3711,"title":{},"content":{"601":{"position":[[1700,10]]},"709":{"position":[[1700,10]]}},"keywords":{}}],["vec.pop().unwrap_or_revert(&env",{"_index":3841,"title":{},"content":{"613":{"position":[[781,37]]},"721":{"position":[[781,37]]}},"keywords":{}}],["vec.push(valu",{"_index":3708,"title":{},"content":{"601":{"position":[[1589,16]]},"709":{"position":[[1589,16]]}},"keywords":{}}],["vec::new",{"_index":750,"title":{},"content":{"31":{"position":[[1061,11],[1927,11],[2623,11]]},"212":{"position":[[3871,11]]},"391":{"position":[[3889,11]]},"616":{"position":[[306,11]]},"661":{"position":[[3889,11]]},"724":{"position":[[306,11]]}},"keywords":{}}],["vec[index",{"_index":3840,"title":{},"content":{"613":{"position":[[768,10]]},"721":{"position":[[768,10]]}},"keywords":{}}],["vector",{"_index":2076,"title":{},"content":{"162":{"position":[[2325,6]]},"164":{"position":[[972,6]]},"165":{"position":[[86,8]]},"209":{"position":[[494,6]]},"212":{"position":[[1836,6],[1916,6],[2070,7]]},"351":{"position":[[2347,6]]},"353":{"position":[[1007,6]]},"354":{"position":[[86,8]]},"388":{"position":[[484,6]]},"391":{"position":[[1836,6],[1916,6],[2070,7]]},"567":{"position":[[2347,6]]},"569":{"position":[[1007,6]]},"570":{"position":[[86,8]]},"601":{"position":[[2241,6]]},"613":{"position":[[2217,6]]},"658":{"position":[[484,6]]},"661":{"position":[[1836,6],[1916,6],[2070,7]]},"709":{"position":[[2241,6]]},"721":{"position":[[2217,6]]}},"keywords":{}}],["verbos",{"_index":2613,"title":{},"content":{"212":{"position":[[95,11]]},"391":{"position":[[95,11]]},"596":{"position":[[506,7]]},"661":{"position":[[95,11]]},"704":{"position":[[506,7]]}},"keywords":{}}],["verbosity::low",{"_index":2628,"title":{},"content":{"212":{"position":[[786,15],[1000,15]]},"391":{"position":[[786,15],[1000,15]]},"661":{"position":[[786,15],[1000,15]]}},"keywords":{}}],["veri",{"_index":620,"title":{},"content":{"21":{"position":[[4,4]]},"42":{"position":[[39,4]]},"94":{"position":[[30,4]]},"164":{"position":[[280,4]]},"286":{"position":[[30,4]]},"353":{"position":[[315,4]]},"498":{"position":[[30,4]]},"569":{"position":[[315,4]]},"594":{"position":[[485,4]]},"600":{"position":[[860,4]]},"702":{"position":[[485,4]]},"708":{"position":[[860,4]]}},"keywords":{}}],["verif",{"_index":217,"title":{},"content":{"6":{"position":[[349,13]]},"10":{"position":[[8,12],[685,13],[853,13],[1110,12]]},"11":{"position":[[108,12]]},"12":{"position":[[219,12]]}},"keywords":{}}],["verifi",{"_index":207,"title":{"10":{"position":[[0,9]]}},"content":{"6":{"position":[[184,8]]},"8":{"position":[[390,6]]},"9":{"position":[[1018,6]]},"10":{"position":[[642,8],[726,8],[792,8],[1161,8]]},"11":{"position":[[49,6],[200,6]]},"32":{"position":[[1456,6]]},"168":{"position":[[2148,8]]},"348":{"position":[[2158,8]]},"564":{"position":[[2148,8]]}},"keywords":{}}],["verifier/src/verifier_contract.r",{"_index":329,"title":{},"content":{"10":{"position":[[350,33]]}},"keywords":{}}],["verify(&mut",{"_index":344,"title":{},"content":{"10":{"position":[[874,15]]}},"keywords":{}}],["verify(journ",{"_index":346,"title":{},"content":{"10":{"position":[[911,15],[1177,15]]}},"keywords":{}}],["verify."",{"_index":302,"title":{},"content":{"9":{"position":[[1138,14]]}},"keywords":{}}],["version",{"_index":150,"title":{},"content":{"3":{"position":[[468,8]]},"16":{"position":[[284,7]]},"30":{"position":[[536,7]]},"42":{"position":[[466,7]]},"52":{"position":[[565,8]]},"91":{"position":[[452,7]]},"117":{"position":[[404,7],[1201,7]]},"131":{"position":[[80,7],[574,7]]},"138":{"position":[[987,8]]},"209":{"position":[[259,7],[767,8],[841,8]]},"211":{"position":[[190,8]]},"261":{"position":[[75,7]]},"265":{"position":[[482,7]]},"267":{"position":[[76,7]]},"283":{"position":[[452,7]]},"298":{"position":[[404,7],[1201,7]]},"311":{"position":[[80,7],[626,7]]},"318":{"position":[[979,8]]},"321":{"position":[[611,7],[651,7],[672,7]]},"324":{"position":[[38,7],[77,7],[372,7],[415,7]]},"379":{"position":[[75,7]]},"388":{"position":[[259,7],[699,8],[773,8]]},"390":{"position":[[190,8]]},"395":{"position":[[2585,7],[2664,7],[2752,7],[2851,7],[2931,7],[3038,7]]},"401":{"position":[[75,7]]},"405":{"position":[[482,7]]},"407":{"position":[[76,7]]},"477":{"position":[[767,7],[954,7]]},"495":{"position":[[452,7]]},"519":{"position":[[404,7],[1201,7]]},"528":{"position":[[80,7],[626,7]]},"539":{"position":[[611,7],[651,7],[672,7]]},"542":{"position":[[38,7],[77,7],[372,7],[415,7]]},"544":{"position":[[979,8]]},"621":{"position":[[75,7]]},"632":{"position":[[2585,7],[2664,7],[2752,7],[2851,7],[2931,7],[3038,7]]},"638":{"position":[[75,7]]},"642":{"position":[[482,7]]},"644":{"position":[[76,7]]},"658":{"position":[[259,7],[699,8],[773,8]]},"660":{"position":[[190,8]]},"699":{"position":[[767,7],[954,7]]}},"keywords":{}}],["via",{"_index":326,"title":{},"content":{"10":{"position":[[318,3]]},"92":{"position":[[599,3]]},"98":{"position":[[589,3]]},"284":{"position":[[599,3]]},"290":{"position":[[589,3]]},"496":{"position":[[599,3]]},"502":{"position":[[589,3]]}},"keywords":{}}],["vicin",{"_index":743,"title":{},"content":{"31":{"position":[[969,8]]}},"keywords":{}}],["view",{"_index":1059,"title":{"605":{"position":[[0,4]]},"713":{"position":[[0,4]]}},"content":{"42":{"position":[[1161,4]]},"438":{"position":[[260,4]]},"605":{"position":[[286,4],[350,4]]},"685":{"position":[[260,4]]},"713":{"position":[[286,4],[350,4]]}},"keywords":{}}],["viewandpur",{"_index":3749,"title":{},"content":{"605":{"position":[[55,11],[110,11]]},"713":{"position":[[55,11],[110,11]]}},"keywords":{}}],["virtual",{"_index":199,"title":{},"content":{"6":{"position":[[81,7]]},"198":{"position":[[2593,7]]},"434":{"position":[[2583,7]]},"681":{"position":[[2593,7]]}},"keywords":{}}],["visibl",{"_index":2978,"title":{"607":{"position":[[0,11]]},"715":{"position":[[0,11]]}},"content":{"321":{"position":[[1657,7],[1798,7],[1982,7],[2110,7]]},"539":{"position":[[1657,7],[1798,7],[1982,7],[2110,7]]}},"keywords":{}}],["visit",{"_index":1775,"title":{},"content":{"118":{"position":[[304,5]]},"163":{"position":[[285,8],[580,8],[842,6],[920,6]]},"299":{"position":[[304,5]]},"352":{"position":[[285,8],[602,8],[864,6],[942,6]]},"520":{"position":[[304,5]]},"568":{"position":[[285,8],[602,8],[864,6],[942,6]]}},"keywords":{}}],["visit(&mut",{"_index":2086,"title":{},"content":{"163":{"position":[[794,14]]},"352":{"position":[[816,14]]},"568":{"position":[[816,14]]}},"keywords":{}}],["visits(&self",{"_index":2090,"title":{},"content":{"163":{"position":[[942,17]]},"352":{"position":[[964,17]]},"568":{"position":[[964,17]]}},"keywords":{}}],["vm",{"_index":1502,"title":{"83":{"position":[[7,2]]},"252":{"position":[[7,2]]},"483":{"position":[[7,2]]}},"content":{"83":{"position":[[28,4]]},"119":{"position":[[277,3],[772,2]]},"148":{"position":[[920,2]]},"252":{"position":[[28,4]]},"300":{"position":[[277,3],[772,2]]},"336":{"position":[[920,2]]},"483":{"position":[[28,4]]},"521":{"position":[[277,3],[772,2]]},"553":{"position":[[920,2]]}},"keywords":{}}],["volum",{"_index":1506,"title":{},"content":{"83":{"position":[[204,8]]},"252":{"position":[[204,8]]},"483":{"position":[[204,8]]}},"keywords":{}}],["vote",{"_index":3132,"title":{"416":{"position":[[0,6]]},"653":{"position":[[0,6]]}},"content":{"395":{"position":[[1158,5],[1319,6],[1497,6]]},"396":{"position":[[932,6]]},"413":{"position":[[186,4]]},"415":{"position":[[307,6],[353,4]]},"416":{"position":[[4,6],[116,4],[199,4],[303,6],[580,5],[606,5],[612,6],[653,4],[720,4],[1031,4],[1535,4],[1908,5],[1954,4],[2235,4],[2531,6],[2632,5],[2731,6],[2752,4],[2893,6],[3000,4],[3264,4],[3328,6],[3365,5],[3461,5],[3547,5],[3683,5],[3699,4],[3927,5],[4184,6],[4318,4],[4527,5]]},"417":{"position":[[467,6],[789,4],[856,5],[1187,6],[1364,5]]},"419":{"position":[[377,4],[434,4],[494,5],[530,4],[951,5],[977,5],[983,6],[1024,4],[1091,4],[4054,4],[4426,5],[4472,4],[4587,5],[4686,6],[4707,4],[4848,6],[4954,4],[5040,5],[5126,5],[5262,5],[5278,4],[5506,5],[5763,6],[5898,4],[6107,5],[6882,6],[7204,4],[7271,5],[7602,6],[7779,5]]},"632":{"position":[[1158,5],[1319,6],[1497,6]]},"633":{"position":[[932,6]]},"650":{"position":[[186,4]]},"652":{"position":[[307,6],[353,4]]},"653":{"position":[[4,6],[116,4],[199,4],[303,6],[580,5],[606,5],[612,6],[653,4],[720,4],[1031,4],[1535,4],[1908,5],[1954,4],[2235,4],[2531,6],[2632,5],[2731,6],[2752,4],[2893,6],[3000,4],[3264,4],[3328,6],[3365,5],[3461,5],[3547,5],[3683,5],[3699,4],[3927,5],[4184,6],[4318,4],[4527,5]]},"654":{"position":[[467,6],[789,4],[856,5],[1187,6],[1364,5]]},"656":{"position":[[377,4],[434,4],[494,5],[530,4],[951,5],[977,5],[983,6],[1024,4],[1091,4],[4054,4],[4426,5],[4472,4],[4587,5],[4686,6],[4707,4],[4848,6],[4954,4],[5040,5],[5126,5],[5262,5],[5278,4],[5506,5],[5763,6],[5898,4],[6107,5],[6882,6],[7204,4],[7271,5],[7602,6],[7779,5]]}},"keywords":{}}],["vote(&mut",{"_index":3243,"title":{},"content":{"416":{"position":[[2667,13]]},"419":{"position":[[4622,13]]},"653":{"position":[[2667,13]]},"656":{"position":[[4622,13]]}},"keywords":{}}],["vote.amount",{"_index":3260,"title":{},"content":{"416":{"position":[[4114,12],[4148,12]]},"419":{"position":[[5693,12],[5727,12]]},"653":{"position":[[4114,12],[4148,12]]},"656":{"position":[[5693,12],[5727,12]]}},"keywords":{}}],["vote.choic",{"_index":3259,"title":{},"content":{"416":{"position":[[4087,11]]},"419":{"position":[[5666,11]]},"653":{"position":[[4087,11]]},"656":{"position":[[5666,11]]}},"keywords":{}}],["vote_end_tim",{"_index":3224,"title":{},"content":{"416":{"position":[[731,14],[1129,14],[2293,13],[3738,14]]},"419":{"position":[[1102,14],[5317,14],[6305,14]]},"653":{"position":[[731,14],[1129,14],[2293,13],[3738,14]]},"656":{"position":[[1102,14],[5317,14],[6305,14]]}},"keywords":{}}],["votealreadyopen",{"_index":3293,"title":{},"content":{"419":{"position":[[406,15]]},"656":{"position":[[406,15]]}},"keywords":{}}],["voteend",{"_index":3296,"title":{},"content":{"419":{"position":[[541,9]]},"656":{"position":[[541,9]]}},"keywords":{}}],["votenotyetend",{"_index":3295,"title":{},"content":{"419":{"position":[[505,15]]},"656":{"position":[[505,15]]}},"keywords":{}}],["voter",{"_index":3133,"title":{},"content":{"395":{"position":[[1180,6]]},"416":{"position":[[787,6],[829,6],[2806,5],[2916,5],[3043,6],[3410,6],[4205,6]]},"419":{"position":[[199,6],[241,6],[4761,5],[4871,5],[4997,6],[5784,6]]},"632":{"position":[[1180,6]]},"653":{"position":[[787,6],[829,6],[2806,5],[2916,5],[3043,6],[3410,6],[4205,6]]},"656":{"position":[[199,6],[241,6],[4761,5],[4871,5],[4997,6],[5784,6]]}},"keywords":{}}],["vs",{"_index":3808,"title":{"612":{"position":[[12,3]]},"720":{"position":[[12,3]]}},"content":{},"keywords":{}}],["wabt",{"_index":2150,"title":{},"content":{"173":{"position":[[156,5]]},"359":{"position":[[156,5]]},"575":{"position":[[156,5]]}},"keywords":{}}],["wait",{"_index":1216,"title":{},"content":{"51":{"position":[[1599,5]]},"52":{"position":[[1858,7]]},"127":{"position":[[353,4],[360,7],[405,4],[412,7]]},"278":{"position":[[353,4],[360,7],[405,4],[412,7]]},"395":{"position":[[1389,4],[4664,4],[4671,7],[4768,4],[4775,7],[5331,4],[5338,7],[5435,4],[5442,7],[5790,4],[5797,7],[5894,4],[5901,7],[6150,7],[6310,4],[6317,7],[6414,4],[6421,7]]},"417":{"position":[[776,4]]},"419":{"position":[[7191,4]]},"477":{"position":[[2684,4],[2691,7],[3167,4],[3174,7],[3548,4],[3555,7]]},"515":{"position":[[353,4],[360,7],[405,4],[412,7]]},"632":{"position":[[1389,4],[4664,4],[4671,7],[4768,4],[4775,7],[5331,4],[5338,7],[5435,4],[5442,7],[5790,4],[5797,7],[5894,4],[5901,7],[6150,7],[6310,4],[6317,7],[6414,4],[6421,7]]},"654":{"position":[[776,4]]},"656":{"position":[[7191,4]]},"699":{"position":[[2684,4],[2691,7],[3167,4],[3174,7],[3548,4],[3555,7]]}},"keywords":{}}],["walk",{"_index":2052,"title":{},"content":{"162":{"position":[[445,6],[1198,5],[1309,5],[2082,5],[2219,5]]},"164":{"position":[[58,4],[221,6],[436,4],[928,5],[1045,6]]},"351":{"position":[[482,6],[1220,5],[1331,5],[2104,5],[2241,5]]},"353":{"position":[[58,4],[256,6],[471,4],[963,5],[1080,6]]},"567":{"position":[[482,6],[1220,5],[1331,5],[2104,5],[2241,5]]},"569":{"position":[[58,4],[256,6],[471,4],[963,5],[1080,6]]}},"keywords":{}}],["walk_the_dog(&mut",{"_index":2109,"title":{},"content":{"164":{"position":[[829,21]]},"353":{"position":[[864,21]]},"569":{"position":[[864,21]]}},"keywords":{}}],["walks.iter().sum",{"_index":2069,"title":{},"content":{"162":{"position":[[1346,18]]},"351":{"position":[[1368,18]]},"567":{"position":[[1368,18]]}},"keywords":{}}],["walks.len",{"_index":2067,"title":{},"content":{"162":{"position":[[1235,11],[2256,11]]},"351":{"position":[[1257,11],[2278,11]]},"567":{"position":[[1257,11],[2278,11]]}},"keywords":{}}],["walks_amount(&self",{"_index":2065,"title":{},"content":{"162":{"position":[[1158,23],[2177,23]]},"164":{"position":[[692,23]]},"351":{"position":[[1180,23],[2199,23]]},"353":{"position":[[727,23]]},"567":{"position":[[1180,23],[2199,23]]},"569":{"position":[[727,23]]}},"keywords":{}}],["walks_total_length(&self",{"_index":2068,"title":{},"content":{"162":{"position":[[1263,29]]},"164":{"position":[[754,29]]},"351":{"position":[[1285,29]]},"353":{"position":[[789,29]]},"567":{"position":[[1285,29]]},"569":{"position":[[789,29]]}},"keywords":{}}],["wallet",{"_index":3103,"title":{"393":{"position":[[7,7]]},"397":{"position":[[33,7]]},"630":{"position":[[7,7]]},"634":{"position":[[33,7]]}},"content":{"393":{"position":[[24,6],[157,7]]},"394":{"position":[[268,6],[515,7]]},"395":{"position":[[4164,7]]},"397":{"position":[[7,6],[282,6]]},"398":{"position":[[115,7],[247,6]]},"630":{"position":[[24,6],[157,7]]},"631":{"position":[[268,6],[515,7]]},"632":{"position":[[4164,7]]},"634":{"position":[[7,6],[282,6]]},"635":{"position":[[115,7],[247,6]]}},"keywords":{}}],["want",{"_index":323,"title":{},"content":{"10":{"position":[[218,4]]},"16":{"position":[[414,5]]},"53":{"position":[[20,4]]},"54":{"position":[[389,4]]},"68":{"position":[[13,4]]},"88":{"position":[[331,4]]},"94":{"position":[[100,4]]},"96":{"position":[[145,4]]},"102":{"position":[[361,4]]},"103":{"position":[[155,4],[268,4],[354,4],[512,4]]},"117":{"position":[[578,5],[933,4],[1125,4]]},"118":{"position":[[7,4]]},"119":{"position":[[232,4],[804,4],[994,4]]},"120":{"position":[[288,4]]},"121":{"position":[[7,4]]},"126":{"position":[[138,4]]},"129":{"position":[[91,4]]},"142":{"position":[[125,4]]},"154":{"position":[[218,4]]},"157":{"position":[[531,4]]},"162":{"position":[[2061,4]]},"176":{"position":[[7,4]]},"198":{"position":[[2927,4],[3235,4]]},"206":{"position":[[3782,4]]},"223":{"position":[[1334,4]]},"243":{"position":[[13,4]]},"250":{"position":[[331,4]]},"264":{"position":[[417,4]]},"277":{"position":[[138,4]]},"280":{"position":[[91,4]]},"286":{"position":[[100,4]]},"288":{"position":[[145,4]]},"294":{"position":[[361,4]]},"295":{"position":[[155,4],[268,4],[354,4],[512,4]]},"298":{"position":[[578,5],[933,4],[1125,4]]},"299":{"position":[[7,4]]},"300":{"position":[[232,4],[804,4],[994,4]]},"301":{"position":[[288,4]]},"302":{"position":[[7,4]]},"327":{"position":[[125,4]]},"330":{"position":[[517,4]]},"339":{"position":[[218,4]]},"351":{"position":[[2083,4]]},"362":{"position":[[7,4]]},"382":{"position":[[230,4]]},"393":{"position":[[208,4]]},"404":{"position":[[417,4]]},"415":{"position":[[83,4]]},"426":{"position":[[3757,4]]},"434":{"position":[[2909,4],[3217,4]]},"456":{"position":[[1334,4]]},"468":{"position":[[13,4]]},"488":{"position":[[331,4]]},"498":{"position":[[100,4]]},"500":{"position":[[145,4]]},"506":{"position":[[361,4]]},"507":{"position":[[155,4],[268,4],[354,4],[512,4]]},"514":{"position":[[138,4]]},"517":{"position":[[91,4]]},"519":{"position":[[578,5],[933,4],[1125,4]]},"520":{"position":[[7,4]]},"521":{"position":[[232,4],[804,4],[994,4]]},"522":{"position":[[288,4]]},"523":{"position":[[7,4]]},"536":{"position":[[125,4]]},"547":{"position":[[531,4]]},"559":{"position":[[218,4]]},"567":{"position":[[2083,4]]},"578":{"position":[[7,4]]},"605":{"position":[[538,4]]},"624":{"position":[[230,4]]},"630":{"position":[[208,4]]},"641":{"position":[[417,4]]},"652":{"position":[[83,4]]},"668":{"position":[[3782,4]]},"681":{"position":[[2927,4],[3235,4]]},"696":{"position":[[1334,4]]},"713":{"position":[[538,4]]}},"keywords":{}}],["warn",{"_index":2949,"title":{},"content":{"270":{"position":[[440,9]]},"385":{"position":[[440,9]]},"410":{"position":[[440,9]]},"627":{"position":[[440,9]]},"647":{"position":[[440,9]]}},"keywords":{}}],["was:it'",{"_index":122,"title":{},"content":{"3":{"position":[[32,8]]}},"keywords":{}}],["wasm",{"_index":209,"title":{"98":{"position":[[0,4]]},"136":{"position":[[0,6]]},"290":{"position":[[0,4]]},"316":{"position":[[0,6]]},"502":{"position":[[0,4]]},"533":{"position":[[0,6]]}},"content":{"6":{"position":[[219,5]]},"42":{"position":[[2634,4]]},"43":{"position":[[1650,4]]},"52":{"position":[[21,4],[294,4],[1002,4],[1034,4],[1153,4],[1449,4],[1615,4],[2254,4],[2319,4]]},"53":{"position":[[480,4],[711,4],[975,4]]},"65":{"position":[[405,4],[602,4]]},"66":{"position":[[25,4],[56,4],[73,4],[131,4],[146,4],[174,4],[287,4]]},"68":{"position":[[411,4],[444,4]]},"95":{"position":[[36,4]]},"96":{"position":[[169,4]]},"100":{"position":[[249,4]]},"119":{"position":[[428,4]]},"120":{"position":[[180,4],[210,4]]},"127":{"position":[[199,4]]},"136":{"position":[[0,4],[94,4]]},"173":{"position":[[533,4]]},"210":{"position":[[244,4]]},"240":{"position":[[405,4],[602,4]]},"241":{"position":[[25,4],[56,4],[73,4],[131,4],[146,4],[174,4],[287,4]]},"243":{"position":[[411,4],[444,4]]},"278":{"position":[[199,4]]},"287":{"position":[[36,4]]},"288":{"position":[[169,4]]},"292":{"position":[[249,4]]},"300":{"position":[[428,4]]},"301":{"position":[[180,4],[210,4]]},"316":{"position":[[0,4],[94,4]]},"324":{"position":[[1485,4]]},"359":{"position":[[533,4]]},"389":{"position":[[244,4]]},"395":{"position":[[4618,4]]},"465":{"position":[[405,4],[602,4]]},"466":{"position":[[25,4],[56,4],[73,4],[131,4],[146,4],[174,4],[287,4]]},"468":{"position":[[411,4],[444,4]]},"477":{"position":[[244,4],[2632,4]]},"478":{"position":[[57,4]]},"499":{"position":[[36,4]]},"500":{"position":[[169,4]]},"504":{"position":[[249,4]]},"515":{"position":[[199,4]]},"521":{"position":[[428,4]]},"522":{"position":[[180,4],[210,4]]},"533":{"position":[[0,4],[94,4]]},"542":{"position":[[1485,4]]},"575":{"position":[[533,4]]},"606":{"position":[[1103,4]]},"632":{"position":[[4618,4]]},"659":{"position":[[244,4]]},"699":{"position":[[244,4],[2632,4]]},"700":{"position":[[57,4]]},"714":{"position":[[1103,4]]}},"keywords":{}}],["wasm/counter.wasm",{"_index":1651,"title":{},"content":{"99":{"position":[[392,19]]},"291":{"position":[[392,19]]},"503":{"position":[[392,19]]}},"keywords":{}}],["wasm/erc1155_token.wasm",{"_index":1677,"title":{},"content":{"101":{"position":[[339,25]]},"293":{"position":[[339,25]]},"505":{"position":[[339,25]]}},"keywords":{}}],["wasm/erc721_token.wasm",{"_index":1662,"title":{},"content":{"100":{"position":[[485,24]]},"292":{"position":[[485,24]]},"504":{"position":[[485,24]]}},"keywords":{}}],["wasm/my_contract.wasm",{"_index":1339,"title":{},"content":{"65":{"position":[[761,21]]},"66":{"position":[[84,21],[202,21],[227,21]]},"68":{"position":[[389,21],[422,21],[472,21],[497,21]]},"240":{"position":[[761,21]]},"241":{"position":[[84,21],[202,21],[227,21]]},"243":{"position":[[389,21],[422,21],[472,21],[497,21]]},"465":{"position":[[761,21]]},"466":{"position":[[84,21],[202,21],[227,21]]},"468":{"position":[[389,21],[422,21],[472,21],[497,21]]}},"keywords":{}}],["wasm32",{"_index":1325,"title":{},"content":{"65":{"position":[[126,6]]},"68":{"position":[[264,6]]},"173":{"position":[[408,6],[437,6]]},"240":{"position":[[126,6]]},"243":{"position":[[264,6]]},"359":{"position":[[408,6],[437,6]]},"465":{"position":[[126,6]]},"468":{"position":[[264,6]]},"575":{"position":[[408,6],[437,6]]}},"keywords":{}}],["wasm_path",{"_index":1255,"title":{},"content":{"52":{"position":[[1007,9],[1047,13]]}},"keywords":{}}],["wasmd",{"_index":1230,"title":{},"content":{"52":{"position":[[304,6]]}},"keywords":{}}],["way",{"_index":715,"title":{},"content":{"31":{"position":[[103,3]]},"52":{"position":[[1926,4]]},"92":{"position":[[668,3]]},"97":{"position":[[112,5]]},"102":{"position":[[429,3]]},"117":{"position":[[1243,3],[1351,3]]},"148":{"position":[[467,3]]},"198":{"position":[[2049,3]]},"219":{"position":[[106,4]]},"223":{"position":[[1224,4]]},"264":{"position":[[28,3]]},"267":{"position":[[1882,3],[3594,3]]},"268":{"position":[[262,3],[2207,3],[2895,4]]},"284":{"position":[[668,3]]},"289":{"position":[[112,5]]},"294":{"position":[[429,3]]},"298":{"position":[[1243,3],[1351,3]]},"336":{"position":[[467,3]]},"382":{"position":[[35,3]]},"383":{"position":[[63,3]]},"394":{"position":[[78,3]]},"404":{"position":[[28,3]]},"407":{"position":[[1882,3],[3594,3]]},"408":{"position":[[262,3],[2207,3],[2895,4]]},"413":{"position":[[15,4]]},"434":{"position":[[2039,3]]},"452":{"position":[[106,4]]},"456":{"position":[[1224,4]]},"496":{"position":[[668,3]]},"501":{"position":[[112,5]]},"506":{"position":[[429,3]]},"519":{"position":[[1243,3],[1351,3]]},"553":{"position":[[467,3]]},"594":{"position":[[578,3]]},"611":{"position":[[573,4],[667,3]]},"612":{"position":[[2092,3]]},"613":{"position":[[1537,5]]},"617":{"position":[[1156,4],[1394,4]]},"624":{"position":[[35,3]]},"625":{"position":[[63,3]]},"631":{"position":[[78,3]]},"641":{"position":[[28,3]]},"644":{"position":[[1882,3],[3594,3]]},"645":{"position":[[262,3],[2207,3],[2895,4]]},"650":{"position":[[15,4]]},"681":{"position":[[2049,3]]},"692":{"position":[[106,4]]},"696":{"position":[[1224,4]]},"702":{"position":[[578,3]]},"719":{"position":[[573,4],[667,3]]},"720":{"position":[[2092,3]]},"721":{"position":[[1537,5]]},"725":{"position":[[1156,4],[1394,4]]}},"keywords":{}}],["we'll",{"_index":1792,"title":{},"content":{"124":{"position":[[21,5]]},"155":{"position":[[21,5]]},"164":{"position":[[96,5]]},"166":{"position":[[21,5]]},"309":{"position":[[21,5]]},"340":{"position":[[21,5]]},"353":{"position":[[96,5]]},"355":{"position":[[21,5]]},"526":{"position":[[21,5]]},"560":{"position":[[21,5]]},"569":{"position":[[96,5]]},"571":{"position":[[21,5]]}},"keywords":{}}],["we'r",{"_index":1796,"title":{},"content":{"126":{"position":[[515,5]]},"145":{"position":[[187,5]]},"168":{"position":[[1277,5]]},"277":{"position":[[515,5]]},"333":{"position":[[187,5]]},"348":{"position":[[1277,5]]},"514":{"position":[[515,5]]},"550":{"position":[[187,5]]},"564":{"position":[[1277,5]]}},"keywords":{}}],["we'v",{"_index":865,"title":{},"content":{"38":{"position":[[352,5]]},"398":{"position":[[0,5],[123,5]]},"635":{"position":[[0,5],[123,5]]}},"keywords":{}}],["webassembl",{"_index":599,"title":{},"content":{"20":{"position":[[708,12]]},"22":{"position":[[389,11]]}},"keywords":{}}],["websit",{"_index":203,"title":{},"content":{"6":{"position":[[136,8]]},"393":{"position":[[127,8]]},"396":{"position":[[676,7]]},"630":{"position":[[127,8]]},"633":{"position":[[676,7]]}},"keywords":{}}],["weight",{"_index":2051,"title":{},"content":{"162":{"position":[[396,7],[804,7]]},"351":{"position":[[433,7],[826,7]]},"567":{"position":[[433,7],[826,7]]}},"keywords":{}}],["weight(&self",{"_index":2062,"title":{},"content":{"162":{"position":[[1023,17]]},"351":{"position":[[1045,17]]},"567":{"position":[[1045,17]]}},"keywords":{}}],["well",{"_index":584,"title":{},"content":{"20":{"position":[[400,4]]},"39":{"position":[[291,4],[1391,4]]},"54":{"position":[[476,6]]},"414":{"position":[[782,4]]},"651":{"position":[[782,4]]}},"keywords":{}}],["went",{"_index":2153,"title":{},"content":{"174":{"position":[[376,4]]},"360":{"position":[[376,4]]},"576":{"position":[[376,4]]}},"keywords":{}}],["weth",{"_index":2294,"title":{},"content":{"188":{"position":[[837,5]]},"365":{"position":[[1194,5]]},"581":{"position":[[1194,5]]}},"keywords":{}}],["what'",{"_index":125,"title":{"26":{"position":[[0,6]]},"28":{"position":[[0,6]]},"36":{"position":[[0,6]]},"46":{"position":[[0,6]]},"48":{"position":[[0,6]]},"57":{"position":[[0,6]]},"59":{"position":[[0,6]]},"61":{"position":[[0,6]]},"63":{"position":[[0,6]]},"112":{"position":[[0,6]]},"122":{"position":[[0,6]]},"124":{"position":[[0,6]]},"139":{"position":[[0,6]]},"149":{"position":[[0,6]]},"152":{"position":[[0,6]]},"155":{"position":[[0,6]]},"158":{"position":[[0,6]]},"166":{"position":[[0,6]]},"169":{"position":[[0,6]]},"171":{"position":[[0,6]]},"176":{"position":[[0,6]]},"180":{"position":[[0,6]]},"200":{"position":[[0,6]]},"207":{"position":[[0,6]]},"214":{"position":[[0,6]]},"216":{"position":[[0,6]]},"225":{"position":[[0,6]]},"303":{"position":[[0,6]]},"307":{"position":[[0,6]]},"309":{"position":[[0,6]]},"319":{"position":[[0,6]]},"331":{"position":[[0,6]]},"337":{"position":[[0,6]]},"340":{"position":[[0,6]]},"343":{"position":[[0,6]]},"349":{"position":[[0,6]]},"355":{"position":[[0,6]]},"357":{"position":[[0,6]]},"362":{"position":[[0,6]]},"371":{"position":[[0,6]]},"418":{"position":[[0,6]]},"427":{"position":[[0,6]]},"436":{"position":[[0,6]]},"449":{"position":[[0,6]]},"512":{"position":[[0,6]]},"524":{"position":[[0,6]]},"526":{"position":[[0,6]]},"545":{"position":[[0,6]]},"548":{"position":[[0,6]]},"554":{"position":[[0,6]]},"557":{"position":[[0,6]]},"560":{"position":[[0,6]]},"565":{"position":[[0,6]]},"571":{"position":[[0,6]]},"573":{"position":[[0,6]]},"578":{"position":[[0,6]]},"587":{"position":[[0,6]]},"655":{"position":[[0,6]]},"669":{"position":[[0,6]]},"683":{"position":[[0,6]]}},"content":{"3":{"position":[[65,6]]},"136":{"position":[[140,6]]},"316":{"position":[[140,6]]},"533":{"position":[[140,6]]}},"keywords":{}}],["whatev",{"_index":2799,"title":{},"content":{"264":{"position":[[395,8]]},"382":{"position":[[208,8]]},"404":{"position":[[395,8]]},"624":{"position":[[208,8]]},"641":{"position":[[395,8]]}},"keywords":{}}],["wheel",{"_index":648,"title":{},"content":{"22":{"position":[[287,6]]},"38":{"position":[[275,6]]}},"keywords":{}}],["whenev",{"_index":586,"title":{},"content":{"20":{"position":[[439,8]]},"603":{"position":[[229,8]]},"711":{"position":[[229,8]]}},"keywords":{}}],["wherea",{"_index":934,"title":{},"content":{"39":{"position":[[971,7]]}},"keywords":{}}],["whether",{"_index":4,"title":{},"content":{"1":{"position":[[0,7]]},"2":{"position":[[0,7]]},"185":{"position":[[2678,7]]},"324":{"position":[[1059,7],[1130,7]]},"376":{"position":[[2662,7]]},"416":{"position":[[643,7]]},"419":{"position":[[1014,7]]},"542":{"position":[[1059,7],[1130,7]]},"592":{"position":[[2662,7]]},"607":{"position":[[46,7]]},"653":{"position":[[643,7]]},"656":{"position":[[1014,7]]},"715":{"position":[[46,7]]}},"keywords":{}}],["whichev",{"_index":3596,"title":{},"content":{"478":{"position":[[285,9]]},"700":{"position":[[285,9]]}},"keywords":{}}],["whole",{"_index":637,"title":{},"content":{"21":{"position":[[338,5]]},"107":{"position":[[296,5]]},"162":{"position":[[1883,6],[1975,5],[2308,5]]},"164":{"position":[[966,5]]},"274":{"position":[[296,5]]},"351":{"position":[[1905,6],[1997,5],[2330,5]]},"353":{"position":[[1001,5]]},"491":{"position":[[296,5]]},"567":{"position":[[1905,6],[1997,5],[2330,5]]},"569":{"position":[[1001,5]]},"617":{"position":[[1403,5]]},"725":{"position":[[1403,5]]}},"keywords":{}}],["wide",{"_index":2256,"title":{},"content":{"185":{"position":[[2938,6]]},"270":{"position":[[304,4]]},"376":{"position":[[2922,6]]},"385":{"position":[[304,4]]},"410":{"position":[[304,4]]},"592":{"position":[[2922,6]]},"598":{"position":[[1636,4]]},"627":{"position":[[304,4]]},"647":{"position":[[304,4]]},"706":{"position":[[1636,4]]}},"keywords":{}}],["window",{"_index":3199,"title":{},"content":{"397":{"position":[[289,7]]},"634":{"position":[[289,7]]}},"keywords":{}}],["wish",{"_index":1637,"title":{},"content":{"97":{"position":[[296,5]]},"114":{"position":[[140,4]]},"147":{"position":[[488,4]]},"257":{"position":[[140,4]]},"289":{"position":[[296,5]]},"335":{"position":[[492,4]]},"396":{"position":[[1152,5]]},"480":{"position":[[140,4]]},"501":{"position":[[296,5]]},"552":{"position":[[492,4]]},"633":{"position":[[1152,5]]}},"keywords":{}}],["wit",{"_index":1350,"title":{},"content":{"70":{"position":[[147,3]]},"234":{"position":[[147,3]]},"470":{"position":[[147,3]]}},"keywords":{}}],["with_tokens(u512::from(100",{"_index":3451,"title":{},"content":{"440":{"position":[[5533,29],[5694,29]]},"687":{"position":[[5533,29],[5694,29]]}},"keywords":{}}],["with_tokens(u512::from(50",{"_index":3448,"title":{},"content":{"440":{"position":[[5423,28],[5614,28]]},"687":{"position":[[5423,28],[5614,28]]}},"keywords":{}}],["with_tokens(u512::from(deposit",{"_index":3574,"title":{},"content":{"477":{"position":[[1987,33]]},"699":{"position":[[1987,33]]}},"keywords":{}}],["withdraw",{"_index":1378,"title":{},"content":{"72":{"position":[[184,10]]},"184":{"position":[[817,9]]},"236":{"position":[[184,10]]},"375":{"position":[[736,9]]},"472":{"position":[[184,10]]},"476":{"position":[[235,13],[1174,9],[1805,10],[1849,10]]},"477":{"position":[[1396,8],[1648,11],[2117,8]]},"591":{"position":[[736,9]]},"698":{"position":[[235,13],[1174,9],[1805,10],[1849,10]]},"699":{"position":[[1396,8],[1648,11],[2117,8]]}},"keywords":{}}],["withdraw(&mut",{"_index":3545,"title":{},"content":{"476":{"position":[[1221,17]]},"698":{"position":[[1221,17]]}},"keywords":{}}],["withdraw(&self",{"_index":3782,"title":{},"content":{"608":{"position":[[340,19]]},"716":{"position":[[340,19]]}},"keywords":{}}],["withdraw_amount",{"_index":3805,"title":{},"content":{"611":{"position":[[385,16],[467,15]]},"719":{"position":[[385,16],[467,15]]}},"keywords":{}}],["withdrew",{"_index":3591,"title":{},"content":{"477":{"position":[[3898,8]]},"478":{"position":[[201,8]]},"699":{"position":[[3898,8]]},"700":{"position":[[201,8]]}},"keywords":{}}],["within",{"_index":1468,"title":{},"content":{"79":{"position":[[1356,6]]},"84":{"position":[[854,6]]},"85":{"position":[[995,6]]},"230":{"position":[[1373,6]]},"253":{"position":[[854,6]]},"254":{"position":[[995,6]]},"324":{"position":[[562,6],[749,6]]},"461":{"position":[[1373,6]]},"484":{"position":[[854,6]]},"485":{"position":[[995,6]]},"542":{"position":[[562,6],[749,6]]},"598":{"position":[[2099,6],[2184,6]]},"600":{"position":[[650,6],[743,6],[1004,6],[1089,6]]},"604":{"position":[[63,6]]},"606":{"position":[[959,6]]},"612":{"position":[[305,6],[2025,6]]},"706":{"position":[[2099,6],[2184,6]]},"708":{"position":[[650,6],[743,6],[1004,6],[1089,6]]},"712":{"position":[[63,6]]},"714":{"position":[[959,6]]},"720":{"position":[[305,6],[2025,6]]}},"keywords":{}}],["without",{"_index":193,"title":{},"content":{"5":{"position":[[390,7]]},"22":{"position":[[263,7]]},"38":{"position":[[251,7]]},"50":{"position":[[311,7]]},"115":{"position":[[1554,7]]},"120":{"position":[[69,7]]},"147":{"position":[[647,7]]},"164":{"position":[[946,7]]},"205":{"position":[[191,7]]},"258":{"position":[[1500,7]]},"268":{"position":[[846,7]]},"301":{"position":[[69,7]]},"335":{"position":[[651,7]]},"353":{"position":[[981,7]]},"408":{"position":[[846,7]]},"425":{"position":[[191,7]]},"481":{"position":[[1500,7]]},"522":{"position":[[69,7]]},"552":{"position":[[651,7]]},"569":{"position":[[981,7]]},"605":{"position":[[649,7]]},"645":{"position":[[846,7]]},"667":{"position":[[191,7]]},"713":{"position":[[649,7]]}},"keywords":{}}],["won't",{"_index":1975,"title":{},"content":{"143":{"position":[[786,5]]},"328":{"position":[[761,5]]},"537":{"position":[[761,5]]}},"keywords":{}}],["word",{"_index":177,"title":{},"content":{"5":{"position":[[175,6]]},"40":{"position":[[98,6]]},"52":{"position":[[1983,6]]},"119":{"position":[[1036,4]]},"204":{"position":[[1220,6]]},"300":{"position":[[1036,4]]},"424":{"position":[[1170,6]]},"521":{"position":[[1036,4]]},"616":{"position":[[670,4],[944,6],[964,5],[994,5]]},"666":{"position":[[1170,6]]},"724":{"position":[[670,4],[944,6],[964,5],[994,5]]}},"keywords":{}}],["work",{"_index":116,"title":{"128":{"position":[[20,6]]},"279":{"position":[[20,6]]},"516":{"position":[[20,6]]}},"content":{"2":{"position":[[534,7]]},"3":{"position":[[286,5]]},"15":{"position":[[201,4]]},"31":{"position":[[470,5]]},"43":{"position":[[783,5]]},"53":{"position":[[1394,6]]},"98":{"position":[[563,7]]},"117":{"position":[[1333,5]]},"124":{"position":[[123,6]]},"126":{"position":[[1488,5]]},"163":{"position":[[1545,7]]},"168":{"position":[[291,6]]},"173":{"position":[[9,7]]},"267":{"position":[[58,4]]},"277":{"position":[[1656,5]]},"290":{"position":[[563,7]]},"298":{"position":[[1333,5]]},"309":{"position":[[123,6]]},"348":{"position":[[291,6]]},"352":{"position":[[1567,7]]},"359":{"position":[[9,7]]},"407":{"position":[[58,4]]},"502":{"position":[[563,7]]},"514":{"position":[[1488,5]]},"519":{"position":[[1333,5]]},"526":{"position":[[123,6]]},"564":{"position":[[291,6]]},"568":{"position":[[1567,7]]},"575":{"position":[[9,7]]},"644":{"position":[[58,4]]}},"keywords":{}}],["workaround",{"_index":3664,"title":{},"content":{"598":{"position":[[1903,10]]},"706":{"position":[[1903,10]]}},"keywords":{}}],["works.th",{"_index":220,"title":{},"content":{"7":{"position":[[42,9]]}},"keywords":{}}],["workspac",{"_index":1761,"title":{},"content":{"117":{"position":[[702,10],[729,9]]},"298":{"position":[[702,10],[729,9]]},"519":{"position":[[702,10],[729,9]]}},"keywords":{}}],["world",{"_index":1105,"title":{"596":{"position":[[6,6]]},"704":{"position":[[6,6]]}},"content":{"43":{"position":[[21,5]]},"111":{"position":[[135,5]]},"166":{"position":[[79,5]]},"196":{"position":[[1394,6]]},"306":{"position":[[135,5]]},"355":{"position":[[79,5]]},"416":{"position":[[2330,5]]},"432":{"position":[[1336,6]]},"511":{"position":[[135,5]]},"571":{"position":[[79,5]]},"653":{"position":[[2330,5]]},"679":{"position":[[1336,6]]}},"keywords":{}}],["world!".to_str",{"_index":3793,"title":{},"content":{"610":{"position":[[324,25]]},"718":{"position":[[324,25]]}},"keywords":{}}],["world"",{"_index":2046,"title":{},"content":{"162":{"position":[[232,11]]},"351":{"position":[[232,11]]},"567":{"position":[[232,11]]},"596":{"position":[[38,11]]},"704":{"position":[[38,11]]}},"keywords":{}}],["worth",{"_index":1547,"title":{},"content":{"85":{"position":[[699,5]]},"197":{"position":[[1494,5]]},"247":{"position":[[1561,5]]},"254":{"position":[[699,5]]},"433":{"position":[[1493,5]]},"446":{"position":[[1561,5]]},"485":{"position":[[699,5]]},"673":{"position":[[1561,5]]},"680":{"position":[[1493,5]]}},"keywords":{}}],["wouldn't",{"_index":1314,"title":{},"content":{"54":{"position":[[0,8]]}},"keywords":{}}],["wow",{"_index":366,"title":{},"content":{"11":{"position":[[83,4]]},"17":{"position":[[4073,4]]},"53":{"position":[[1366,4]]}},"keywords":{}}],["wrap",{"_index":1346,"title":{"68":{"position":[[0,8]]},"243":{"position":[[0,8]]},"468":{"position":[[0,8]]}},"content":{"103":{"position":[[438,7]]},"145":{"position":[[56,5]]},"162":{"position":[[169,4],[502,8],[556,7]]},"188":{"position":[[717,7]]},"195":{"position":[[770,4]]},"267":{"position":[[3226,4]]},"295":{"position":[[438,7]]},"333":{"position":[[56,5]]},"351":{"position":[[169,4],[539,8],[593,7]]},"365":{"position":[[1074,7]]},"407":{"position":[[3226,4]]},"431":{"position":[[770,4]]},"507":{"position":[[438,7]]},"550":{"position":[[56,5]]},"567":{"position":[[169,4],[539,8],[593,7]]},"581":{"position":[[1074,7]]},"601":{"position":[[2004,7]]},"644":{"position":[[3226,4]]},"678":{"position":[[770,4]]},"709":{"position":[[2004,7]]}},"keywords":{}}],["wrappednativetoken",{"_index":2292,"title":{},"content":{"188":{"position":[[743,18]]},"365":{"position":[[1100,18]]},"581":{"position":[[1100,18]]}},"keywords":{}}],["wrapper",{"_index":2293,"title":{},"content":{"188":{"position":[[784,7]]},"365":{"position":[[1141,7]]},"581":{"position":[[1141,7]]}},"keywords":{}}],["write",{"_index":110,"title":{"14":{"position":[[7,6]]}},"content":{"2":{"position":[[348,5]]},"13":{"position":[[73,5]]},"15":{"position":[[212,8],[224,5],[396,7],[497,7]]},"17":{"position":[[26,5]]},"22":{"position":[[245,7]]},"23":{"position":[[150,5]]},"24":{"position":[[147,5]]},"34":{"position":[[45,5]]},"38":{"position":[[233,7],[1032,7]]},"39":{"position":[[3285,5]]},"42":{"position":[[68,5]]},"51":{"position":[[16,5],[322,5]]},"55":{"position":[[45,5]]},"70":{"position":[[5,7]]},"74":{"position":[[140,6]]},"83":{"position":[[508,7]]},"97":{"position":[[27,7]]},"99":{"position":[[733,8]]},"115":{"position":[[3280,5]]},"126":{"position":[[1126,5]]},"138":{"position":[[38,5]]},"148":{"position":[[448,5]]},"163":{"position":[[601,5]]},"164":{"position":[[445,6]]},"168":{"position":[[1542,5]]},"182":{"position":[[16,7]]},"193":{"position":[[17,5]]},"194":{"position":[[10,5]]},"196":{"position":[[1236,5]]},"201":{"position":[[17,5]]},"209":{"position":[[6,5]]},"234":{"position":[[5,7]]},"238":{"position":[[140,6]]},"252":{"position":[[508,7]]},"258":{"position":[[3206,5]]},"277":{"position":[[1294,5]]},"289":{"position":[[27,7]]},"291":{"position":[[733,8]]},"318":{"position":[[38,5]]},"336":{"position":[[448,5]]},"348":{"position":[[1542,5]]},"352":{"position":[[623,5]]},"353":{"position":[[480,6]]},"373":{"position":[[16,7]]},"388":{"position":[[6,5]]},"421":{"position":[[17,5]]},"429":{"position":[[17,5]]},"430":{"position":[[10,5]]},"432":{"position":[[1178,5]]},"470":{"position":[[5,7]]},"474":{"position":[[140,6]]},"477":{"position":[[594,5]]},"481":{"position":[[3206,5]]},"483":{"position":[[508,7]]},"501":{"position":[[27,7]]},"503":{"position":[[733,8]]},"514":{"position":[[1126,5]]},"544":{"position":[[38,5]]},"553":{"position":[[448,5]]},"564":{"position":[[1542,5]]},"568":{"position":[[623,5]]},"569":{"position":[[480,6]]},"589":{"position":[[16,7]]},"618":{"position":[[60,7]]},"658":{"position":[[6,5]]},"663":{"position":[[17,5]]},"676":{"position":[[17,5]]},"677":{"position":[[10,5]]},"679":{"position":[[1178,5]]},"699":{"position":[[594,5]]},"726":{"position":[[60,7]]}},"keywords":{}}],["write(key",{"_index":1518,"title":{},"content":{"83":{"position":[[625,10]]},"252":{"position":[[625,10]]},"483":{"position":[[625,10]]}},"keywords":{}}],["write_to_file("../data/journal"",{"_index":308,"title":{},"content":{"9":{"position":[[1272,42]]}},"keywords":{}}],["write_to_file("../data/method"",{"_index":316,"title":{},"content":{"9":{"position":[[1597,41]]}},"keywords":{}}],["write_to_file("../data/seal"",{"_index":312,"title":{},"content":{"9":{"position":[[1437,39]]}},"keywords":{}}],["writes/read",{"_index":1989,"title":{},"content":{"146":{"position":[[218,12]]},"178":{"position":[[232,12]]},"334":{"position":[[218,12]]},"369":{"position":[[232,12]]},"551":{"position":[[218,12]]},"585":{"position":[[232,12]]}},"keywords":{}}],["written",{"_index":321,"title":{},"content":{"10":{"position":[[163,7]]},"20":{"position":[[577,7],[831,7]]},"22":{"position":[[437,7]]},"31":{"position":[[50,7]]},"39":{"position":[[1583,7]]},"40":{"position":[[312,7]]},"51":{"position":[[1773,7]]},"91":{"position":[[628,7]]},"98":{"position":[[80,7]]},"162":{"position":[[1998,7]]},"163":{"position":[[1159,7]]},"205":{"position":[[2300,8]]},"283":{"position":[[628,7]]},"290":{"position":[[80,7]]},"351":{"position":[[2020,7]]},"352":{"position":[[1181,7]]},"425":{"position":[[2250,8]]},"440":{"position":[[3508,7]]},"495":{"position":[[628,7]]},"502":{"position":[[80,7]]},"567":{"position":[[2020,7]]},"568":{"position":[[1181,7]]},"667":{"position":[[2250,8]]},"687":{"position":[[3508,7]]}},"keywords":{}}],["wrong",{"_index":297,"title":{},"content":{"9":{"position":[[1048,6]]},"92":{"position":[[687,5]]},"284":{"position":[[687,5]]},"496":{"position":[[687,5]]}},"keywords":{}}],["wrote",{"_index":455,"title":{},"content":{"17":{"position":[[179,5]]}},"keywords":{}}],["x",{"_index":3750,"title":{},"content":{"605":{"position":[[69,2]]},"606":{"position":[[74,2]]},"613":{"position":[[197,1],[218,1],[233,2],[236,1],[245,1],[249,2],[414,2]]},"713":{"position":[[69,2]]},"714":{"position":[[74,2]]},"721":{"position":[[197,1],[218,1],[233,2],[236,1],[245,1],[249,2],[414,2]]}},"keywords":{}}],["xxxxx"",{"_index":3156,"title":{},"content":{"395":{"position":[[2299,12]]},"632":{"position":[[2299,12]]}},"keywords":{}}],["y",{"_index":3752,"title":{},"content":{"605":{"position":[[151,2],[197,1]]},"613":{"position":[[165,2],[171,1],[201,1],[240,2],[269,1]]},"713":{"position":[[151,2],[197,1]]},"721":{"position":[[165,2],[171,1],[201,1],[240,2],[269,1]]}},"keywords":{}}],["ye",{"_index":212,"title":{},"content":{"6":{"position":[[260,4]]}},"keywords":{}}],["year",{"_index":423,"title":{},"content":{"15":{"position":[[538,5]]},"20":{"position":[[12,4]]}},"keywords":{}}],["yes_vot",{"_index":3255,"title":{},"content":{"416":{"position":[[3941,9],[4101,9],[4338,9]]},"419":{"position":[[5520,9],[5680,9],[5918,9]]},"653":{"position":[[3941,9],[4101,9],[4338,9]]},"656":{"position":[[5520,9],[5680,9],[5918,9]]}},"keywords":{}}],["yoda",{"_index":419,"title":{},"content":{"15":{"position":[[451,4]]}},"keywords":{}}],["you'll",{"_index":2071,"title":{},"content":{"162":{"position":[[1589,6]]},"163":{"position":[[1489,6]]},"268":{"position":[[42,6]]},"351":{"position":[[1611,6]]},"352":{"position":[[1511,6]]},"408":{"position":[[42,6]]},"567":{"position":[[1611,6]]},"568":{"position":[[1511,6]]},"645":{"position":[[42,6]]}},"keywords":{}}],["you'r",{"_index":2073,"title":{},"content":{"162":{"position":[[1898,6]]},"351":{"position":[[1920,6]]},"567":{"position":[[1920,6]]}},"keywords":{}}],["you'v",{"_index":1574,"title":{},"content":{"91":{"position":[[88,6]]},"168":{"position":[[1607,6]]},"268":{"position":[[5,6]]},"283":{"position":[[88,6]]},"348":{"position":[[1607,6]]},"408":{"position":[[5,6]]},"495":{"position":[[88,6]]},"564":{"position":[[1607,6]]},"594":{"position":[[120,6]]},"618":{"position":[[17,6]]},"645":{"position":[[5,6]]},"702":{"position":[[120,6]]},"726":{"position":[[17,6]]}},"keywords":{}}],["your/path/secret_key.pem",{"_index":3559,"title":{},"content":{"477":{"position":[[481,24]]},"699":{"position":[[481,24]]}},"keywords":{}}],["yourself",{"_index":1300,"title":{},"content":{"53":{"position":[[41,9]]},"54":{"position":[[411,9]]},"102":{"position":[[637,8]]},"117":{"position":[[268,9]]},"294":{"position":[[637,8]]},"298":{"position":[[268,9]]},"397":{"position":[[238,9]]},"506":{"position":[[637,8]]},"519":{"position":[[268,9]]},"634":{"position":[[238,9]]}},"keywords":{}}],["z",{"_index":3830,"title":{},"content":{"613":{"position":[[161,1],[225,1],[229,1],[289,1],[308,1]]},"721":{"position":[[161,1],[225,1],[229,1],[289,1],[308,1]]}},"keywords":{}}],["zeppelin",{"_index":2491,"title":{},"content":{"205":{"position":[[2319,8]]},"425":{"position":[[2269,8]]},"667":{"position":[[2269,8]]}},"keywords":{}}],["zero",{"_index":164,"title":{"4":{"position":[[0,4]]},"5":{"position":[[0,4]]},"6":{"position":[[5,5]]}},"content":{"5":{"position":[[19,4]]},"6":{"position":[[34,5],[66,4]]},"8":{"position":[[53,5]]},"12":{"position":[[147,4],[214,4],[271,4]]},"13":{"position":[[14,4]]},"92":{"position":[[982,5]]},"206":{"position":[[3442,5]]},"284":{"position":[[982,5]]},"426":{"position":[[3417,5]]},"496":{"position":[[982,5]]},"668":{"position":[[3442,5]]}},"keywords":{}}],["zero'",{"_index":224,"title":{},"content":{"7":{"position":[[117,6]]}},"keywords":{}}],["zeros.l10",{"_index":2250,"title":{},"content":{"185":{"position":[[2569,9]]},"376":{"position":[[2553,9]]},"592":{"position":[[2553,9]]}},"keywords":{}}],["zieliński",{"_index":566,"title":{},"content":{"20":{"position":[[28,9]]},"39":{"position":[[1601,10]]}},"keywords":{}}],["zk",{"_index":166,"title":{},"content":{"5":{"position":[[34,4],[182,2]]},"10":{"position":[[682,2],[844,2]]},"11":{"position":[[99,2]]},"12":{"position":[[54,2],[351,2]]},"32":{"position":[[519,3]]}},"keywords":{}}],["zone",{"_index":1229,"title":{},"content":{"52":{"position":[[299,4]]}},"keywords":{}}]],"pipeline":["stemmer"]} \ No newline at end of file diff --git a/docs/search-doc-1718616732280.json b/docs/search-doc-1718616732280.json new file mode 100644 index 000000000..d21e97dc1 --- /dev/null +++ b/docs/search-doc-1718616732280.json @@ -0,0 +1 @@ +{"searchDocs":[{"title":"It's all about the community!","type":0,"sectionRef":"#","url":"/blog/its-all-about-the-community","content":"","keywords":"","version":null},{"title":"Hello Odra Community​","type":1,"pageTitle":"It's all about the community!","url":"/blog/its-all-about-the-community#hello-odra-community","content":"Whether you are a Rust developer, Solidity developer or a Casper enthusiast we are happy to have you here, reading this blog post. We have built Odra to make smart contract development on Casper easy. Now we are entering the next phase of the open source journey. We are going to focus on the community and make sure Odra is the best tool for the job. Our motto (we borrowed from the Django Project) is: We bring cutting-edge smart contract development tools to professionals with deadlines. How will we do it? We are going to focus on four things: Quality - Our code and documentation will be of the highest quality. We will always have tons of tests and examples.Simplicity - The simplest solution is the best solution. Odra's API needs to be simple and easy to use. Always! We are not afraid to take a few steps back and rethink our design. We believe in short feedback loops and fast iterations.Reusability - No one likes to repeat itself. We see a huge potential in Odra Modules. In time, it can become a standard library of Casper smart contracts, that are battle-tested and ready to use.Community - We are here to help you. You can always reach out to us on Discord or Github. ","version":null,"tagName":"h2"},{"title":"We will help with your project​","type":1,"pageTitle":"It's all about the community!","url":"/blog/its-all-about-the-community#we-will-help-with-your-project","content":"Whether you are a Rust developer or not, you can start using Odra today. We have prepared a few examples and docs to help you get started. Rust knowledge required to use Odra is minimal. That was always the goal. But we understand that it is hard to start. We got your back. We offer free consulting + 2 hours of live coding. All you have to do is write us an email at contract@odra.devwith a short description of your project. We will schedule a call and help you get started with Odra. After 2 hours of live coding, you will have a working repository with 2 or 3 smart contracts, that you can use as a starting point for your project. ","version":null,"tagName":"h2"},{"title":"Roadmap​","type":1,"pageTitle":"It's all about the community!","url":"/blog/its-all-about-the-community#roadmap","content":"The feedback we got quite often was:It's nice, but will it last? What's the direction of the project?Point taken. Now we answer: We are here to stay.We got the support from the Casper Association and some projects of our own to keep us funded. We play the long game. To systematize our work, we have prepared the roadmap. As of now, we maintain plans for at least three future releases. It is a good balance between predictability and flexibility. We will release new versions approximately every 1-2 months or as needed. Everyone is encouraged to propose a new Odra feature or enhancement. New proposals need to be discussed and approved by the core team. When the feature is ready, we assign it to one of the future releases. ","version":null,"tagName":"h2"},{"title":"Zero Knowledge on Casper","type":0,"sectionRef":"#","url":"/blog/casper-zk-risc0","content":"","keywords":"","version":null},{"title":"Zero Knowledge​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#zero-knowledge","content":"In my opinion, the zero knowledge (ZK) is the largest revolution in blockchains, since Ethereum introduced Turing-complete, account-based smart contracts. To put it in simple words, ZK enables two use cases not possible before: Computation scaling - I can perform expensive computation off-chain and put the result on a chain with the proof.Anonymity - I can prove to you, I know something without revealing it. ","version":null,"tagName":"h2"},{"title":"Risc Zero​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#risc-zero","content":"I'd like to introduce you to Risc Zero. It is the general purpose zero-knowledge virtual machine. Go ahead and spend time reading their website! For us, the key component is the proof verifier that can be compiled into WASM. Sooo... we can run it on Casper :) Yes! We can prove any program, produce proof, and send it to Casper's smart contract for verification. ","version":null,"tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#example","content":"Let's dive into the example to see how it works.The full example codeyou can find on our GitHub. It is based on Risc Zero's Hello, Multiply!example. So make sure you understand it first.Guest and Prover sections are taken from this example. ","version":null,"tagName":"h2"},{"title":"Guest​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#guest","content":"The program we are proving is called a guest in Risc Zero. Our goal is to prove we know the factors of an arbitrary number. Given a and b below guest program computes a * b and produces a proof of computation. methods/guest/src/multiply.rs pub fn main() { // Load the first number from the host let a: u64 = env::read(); // Load the second number from the host let b: u64 = env::read(); // Verify that neither of them are 1 (i.e. nontrivial factors) if a == 1 || b == 1 { panic!("Trivial factors") } // Compute the product while being careful with integer overflow let product = a.checked_mul(b).expect("Integer overflow"); env::commit(&product); } ","version":null,"tagName":"h3"},{"title":"Prover​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#prover","content":"It's time to run the guest program and build the proof for a specific a and b values. prover/src/main.rs fn main() { // Pick two numbers. let a: u64 = 17; let b: u64 = 23; // First, we make the prover, loading the 'multiply' method. let multiply_src = std::fs::read(MULTIPLY_PATH) .expect("Method code should be present at the specified path."); let mut prover = Prover::new(&multiply_src, MULTIPLY_ID) .expect("Prover should be constructed.",); // Next we send a & b to the guest. prover.add_input_u32_slice(to_vec(&a).unwrap().as_slice()); prover.add_input_u32_slice(to_vec(&b).unwrap().as_slice()); // Run prover & generate receipt let receipt = prover.run() .expect("Valid code should be provable."); // Extract journal of receipt (i.e. output c, where c = a * b) let c: u64 = from_slice(&receipt.journal) .expect("Journal output should deserialize."); // Print an assertion println!("I know the factors of {}, and I can prove it!", c); // Verify receipt, panic if it's wrong. receipt.verify(MULTIPLY_ID).expect( "Code you have proven should successfully verify.", ); // Convert journal to string and store on disk. let journal = serde_json::to_string(&receipt.journal).unwrap(); write_to_file("../data/journal", &journal); // Convert seal to string and store on disk. let seal = serde_json::to_string(&receipt.seal).unwrap(); write_to_file("../data/seal", &seal); // Convert method_id to string and store on disk. let result = serde_json::to_string(MULTIPLY_ID).unwrap(); write_to_file("../data/method", &result); } ","version":null,"tagName":"h3"},{"title":"Verifier​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#verifier","content":"Now the verification step. Given the proof (journal + seal) and the guest program definition (method), Casper's smart contract checks its correctness. This one is written just for the demonstration, but in general you want METHOD_ID to be stored in your contract and both SEAL and JOURNAL to be passed to the contract via arguments from the outside. verifier/src/verifier_contract.rs // Import the proof and the method. const METHOD_ID: &[u8] = &include!("../../data/method"); const SEAL: &[u32] = &include!("../../data/seal"); const JOURNAL: &[u32] = &include!("../../data/journal"); // Verifier contract holds a result of the zk verification. #[odra::module] pub struct Verifier { result: Variable<String>, } #[odra::module] impl Verifier { // Calling this entry point triggers the zk proof verification. pub fn verify(&mut self) { let result = verify(JOURNAL, SEAL, METHOD_ID); self.result.set(result); } // Result getter. pub fn result(&self) -> String { self.result.get().unwrap_or(String::from("Not processed")) } } // The verification method. It constructs new Receipt and verifies it. fn verify(journal: &[u32], seal: &[u32], method_id: &[u8]) -> String { let result = Receipt::new(&journal, &seal).verify(method_id); match result { Ok(()) => String::from("Ok"), Err(err) => format!("Error: {}", err.to_string()) } } ","version":null,"tagName":"h3"},{"title":"Livenet results​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#livenet-results","content":"I have deployed it to the testnet and called the verify method. The result was Ok. Wow, first-ever ZK proof verification on Casper. Trustless bridging, layer 2 here we come :) The cost of running the verify method is 2324 CSPR. That's a lot, but we have to start somewhere. ","version":null,"tagName":"h3"},{"title":"What next​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#what-next","content":"I think it is a good place to outline possible Casper ZK goals for moving this forward. The community should discuss: Building more examples. Risc Zero has a nice battleship game to port over to Casper.Adding Risc Zero verification method to Casper's FFI.Supporting Risc Zero team. We should help develop this awesome open-source project and gain the ZK expertise. ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#join-us","content":"Interested in zero knowledge on Casper? Join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"OpenAI writes ERC20 in Odra","type":0,"sectionRef":"#","url":"/blog/2023-02-27-openai-writes-erc20-in-odra","content":"","keywords":"","version":null},{"title":"OpenAI​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#openai","content":"OpenAI already proved that AI can code. Github Copilot is used by more and more developers. Many times it is mind-blowing how accurate it is. It would be great if one of the OpenAI models could simply work after writing: Q: Write the ERC20 smart contract. A: use odra::{Mapping, Variable}... So far OpenAI hasn't indexed Odra. I even asked ChatGPT. Q: Do you know what is the Odra Framework for writing smart contracts? Response in one sentence. Use Yoda style. A: Aware of an Odra Framework for writing smart contracts, I am not. Soon (year or two) it will happen and Odra will be supported out of the box, simply because it is available on GitHub. ","version":null,"tagName":"h2"},{"title":"DaVinci Edit​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#davinci-edit","content":"OpenAI gives us a great tool called Edit. It uses the same technology Github Copiled it based on called Codex, OpenAI gives us access to the model code-davinci-edit-001. It allows you to paste in the code and ask for changes. See more examples like rewriting Fibonacci to a recursive version here. But it doesn't know Odra. Luckily this is not a problem. I have found a nice trick that allows producing the code I want. We simply have to present all the features of Odra and ask a good question. ","version":null,"tagName":"h2"},{"title":"ERC20 by AI​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#erc20-by-ai","content":"The goal is to bend AI to write the ERC20 token using Odra. The Edit query needs two elements: source code,text that describes what should be changed. As the input source code I wrote the code that uses all the features ERC20 would use. I need odra::module, Variable, Mapping, caller(), Address, constructor, and errors. flipper.rs use odra::{Variable, types::Address, contract_env, Mapping, execution_error}; #[odra::module] pub struct Flipper { value: Variable<bool>, flips_count: Variable<u32>, owner: Variable<Address>, messages: Mapping<(Address, Address), String> } #[odra::module] impl Flipper { #[odra(init)] pub fn init(&mut self, owner: Address) { self.value.set(false); self.owner.set(owner); } pub fn set(&mut self, value: bool) { self.value.set(value); } pub fn flip(&mut self) { self.value.set(!self.get_value()); self.flips_count.set(self.flips_count.get_or_default()); } pub fn get_value(&self) -> bool { self.value.get_or_default() } pub fn get_owner(&self) -> Option<Address> { self.owner.get() } pub fn set_message(&mut self, recipient: Address, msg: String) { let sender = contract_env::caller(); let current_msg = self.messages.get(&(sender, recipient)); match current_msg { Some(_) => contract_env::revert(Error::MessageAlreadyDefined), None => self.messages.set(&(sender, recipient), msg) } } pub fn get_message(&self, sender: Address, recipient: Address) -> String { self.messages.get_or_default(&(sender, recipient)) } } execution_error! { pub enum Error { MessageAlreadyDefined => 1, NotAnMessageSender => 2, } } ChatGPT knows what the ERC20 is, so the kind request for changes is simple. Q: Implement another smart contract called ERC20. Balances should be of type U256. This is the result. ERC20 contract in Odra generated by OpenAI use odra::{Variable, types::Address, contract_env, Mapping, execution_error, U256}; #[odra::module] pub struct ERC20 { name: Variable<String>, symbol: Variable<String>, decimals: Variable<u8>, total_supply: Variable<U256>, balances: Mapping<Address, U256>, allowed: Mapping<(Address, Address), U256> } #[odra::module] impl ERC20 { #[odra(init)] pub fn init(&mut self, name: String, symbol: String, decimals: u8, total_supply: U256) { self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.total_supply.set(total_supply); self.balances.set(&contract_env::caller(), total_supply); } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } pub fn balance_of(&self, owner: Address) -> U256 { self.balances.get_or_default(&owner) } pub fn transfer(&mut self, to: Address, value: U256) { let from = contract_env::caller(); let from_balance = self.balances.get_or_default(&from); let to_balance = self.balances.get_or_default(&to); if from_balance < value { contract_env::revert(Error::InsufficientBalance); } self.balances.set(&from, from_balance - value); self.balances.set(&to, to_balance + value); } pub fn transfer_from(&mut self, from: Address, to: Address, value: U256) { let caller = contract_env::caller(); let from_balance = self.balances.get_or_default(&from); let to_balance = self.balances.get_or_default(&to); let allowed = self.allowed.get_or_default(&(from, caller)); if from_balance < value { contract_env::revert(Error::InsufficientBalance); } if allowed < value { contract_env::revert(Error::InsufficientAllowance); } self.balances.set(&from, from_balance - value); self.balances.set(&to, to_balance + value); self.allowed.set(&(from, caller), allowed - value); } pub fn approve(&mut self, spender: Address, value: U256) { let owner = contract_env::caller(); self.allowed.set(&(owner, spender), value); } pub fn allowance(&self, owner: Address, spender: Address) -> U256 { self.allowed.get_or_default(&(owner, spender)) } } execution_error! { pub enum Error { InsufficientBalance => 1, InsufficientAllowance => 2, } } Wow! ","version":null,"tagName":"h2"},{"title":"What is next?​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#what-is-next","content":"AI already understands smart contracts. It had to read a lot of Solidity code. I checked and it knows Uniswap and Compound source code. Most interesting is that AI was able to implement a concept it already knew from another programming language in the unseen Rust framework. At some point, we will be able to translate all the Solidity code to Odra. Or maybe we will not have to... It is hard to imagine how good it will be in 2025 and beyond. ","version":null,"tagName":"h2"},{"title":"Odra 0.2.0 Released","type":0,"sectionRef":"#","url":"/blog/release-020","content":"","keywords":"","version":null},{"title":"A bit of history​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#a-bit-of-history","content":"More than a year ago Maciej Zieliński resigned from the position of Ecosystem Leader at CasperLabs. Along with Krzysztof Pobiarżyn and Kuba Płaskonka, we formed an engineering team dedicated to smart contracts. Looking at the blockchain ecosystems from the smart contract developer perspective there are two universes. The first one is Solidity, which thrives and is at its best now. It has a ton of well-tested code and security tooling. Whenever an EVM-based blockchain pops out it gets populated by forks of DeFi and DAO protocols. Fascinating network effect emerges - code written for one EVM-based blockchain can be run on every other EVM-based blockchain. The second universe is Rust which compiles to WebAssembly. Here developer communities live in the guarded cities of Polkadot, Cosmos, Solana, Casper, and Near. The code written for one platform is not portable. The network effect never had a chance to arise. The main reason why Odra exists is achieving this cross-chain code reusability. We could paraphrase a bit and say: "One to bring them all and in the code bind them." ","version":null,"tagName":"h2"},{"title":"Odra for Casper​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#odra-for-casper","content":"The very first blockchain we have integrated with Odra is Casper. In comparison to casper-contract API, it greatly cuts development time and offers a much lower entry level. The Odra interface is developer friendly and people familiar with Solidity, Ink, or Near will feel like at home. We hope it will unleash the creativity and bring a whole bunch of products onto Casper. ","version":null,"tagName":"h2"},{"title":"Odra Framework​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#odra-framework","content":"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open source. Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains. A smart contract written using Odra can be executed on all integrated systems. We can do it by abstracting over core concepts that all the above systems are built around. These are type system, storage, entry points, execution context, and testing environment. We believe it will bring standardization to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this ecosystem. Let’s look at a Flipper contract, that holds a boolean value. The contract has a constructor that sets the initial value, and two entry points: flip() and get(), to change and query the current value, respectively. use odra::Variable; #[odra::module] pub struct Flipper { value: Variable<bool>, } #[odra::module] impl Flipper { #[odra(init)] pub fn init(&mut self, value: bool) { self.value.set(value); } pub fn flip(&mut self) { self.value.set(!self.get()); } pub fn get(&self) -> bool { self.value.get_or_default() } } It comes with the CLI tool cargo-odra that makes it easy to use Odra. Neat and simple, isn't it? Do you like it? Start flowing with us! ","version":null,"tagName":"h2"},{"title":"What next​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#what-next","content":"Let's be honest, we are just starting. The codebase is still hot. On the other hand, we are happy with the interfaces we designed. Now is the time to write documentation and tutorials. We are also building the modules library inspired by OpenZeppelin. The security code audit is still ahead of us. ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#join-us","content":"Check out the Odra GitHub repository for more info on how to get the most out of Odra. Should you have questions, join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.2.0/","content":"","keywords":"","version":"0.2.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.2.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.2.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.3.0/","content":"","keywords":"","version":"0.3.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.3.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.3.0","tagName":"h2"},{"title":"EVM at Risc0","type":0,"sectionRef":"#","url":"/blog/evm-at-risc0","content":"","keywords":"","version":null},{"title":"Solidity​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#solidity","content":"As an example, I have this simple Solidity code. It is a calculator with two functions. One for addition and one for the nth Fibonacci number. bytecode/Calculator.sol contract Calculator { function add(uint256 a, uint256 b) public pure returns (uint256) { return a + b; } function fibonacci(uint256 n) public returns (uint256) { if (n <= 1) { return n; } else { return fibonacci(n - 1) + fibonacci(n - 2); } } } It needs to be compiled into the byte code. solc can do this. $ solc \\ --bin-runtime \\ --optimize \\ --overwrite \\ --evm-version istanbul \\ --output-dir bytecode \\ bytecode/Calculator.sol It produces an EVM bytecode in the bytecode directory. $ ls bytecode/ Calculator.bin-runtime Calculator.sol ","version":null,"tagName":"h2"},{"title":"EVM​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#evm","content":"The EVM I used is SputnikVM. Most important it is written in pure Rust and even with no_std mode. This way I can start an in-memory instance of EVM. Then take the bytecode of a contract and install it. Finally, call the contract with arguments and obtain the result value. For now, it's just a Rust code. Risc0 comes later. The code is based on Sputnik's benchmark test. Huge thanks to Michael Birch for helping with Sputnik. Also make sure how EVM's function selectors work. evm-runner/src/lib.rs // Load previously compiled Calculator contract. pub const CALCULATOR_EVM_PROGRAM: &str = include_str!( "../../bytecode/Calculator.bin-runtime" ); // Run Calculator for a given input. pub fn run_calc_contract(input: &str) -> String { run_evm(CALCULATOR_EVM_PROGRAM, input) } // Run a program (contract) for a given input. fn run_evm(program: &str, input: &str) -> String { // Define EVM configuration. let config = Config::istanbul(); let vicinity = MemoryVicinity { gas_price: U256::zero(), origin: H160::default(), block_hashes: Vec::new(), block_number: Default::default(), block_coinbase: Default::default(), block_timestamp: Default::default(), block_difficulty: Default::default(), block_gas_limit: Default::default(), chain_id: U256::one(), block_base_fee_per_gas: U256::zero(), }; // Initialized the state of EVM's memory. let mut state = BTreeMap::new(); // Add our contract under the 0x10 address. state.insert( H160::from_str("0x1000000000000000000000000000000000000000") .unwrap(), MemoryAccount { nonce: U256::one(), balance: U256::from(10000000), storage: BTreeMap::new(), code: hex::decode(program).unwrap(), } ); // Add new user 0xf0 that will be used as the contract caller. state.insert( H160::from_str("0xf000000000000000000000000000000000000000") .unwrap(), MemoryAccount { nonce: U256::one(), balance: U256::from(10000000), storage: BTreeMap::new(), code: Vec::new(), }, ); // Prepare the executor. let backend = MemoryBackend::new(&vicinity, state); let metadata = StackSubstateMetadata::new(u64::MAX, &config); let state = MemoryStackState::new(metadata, &backend); let precompiles = BTreeMap::new(); let mut executor = StackExecutor::new_with_precompiles(state, &config, &precompiles); // Call the 0x10 contract using the 0xf0 user. // Use the input variable. let (exit_reason, result) = executor.transact_call( H160::from_str("0xf000000000000000000000000000000000000000") .unwrap(), H160::from_str("0x1000000000000000000000000000000000000000") .unwrap(), U256::zero(), hex::decode(input).unwrap(), u64::MAX, Vec::new(), ); // Make sure the execution succeeded. assert!(exit_reason == ExitReason::Succeed(ExitSucceed::Returned)); // Return hex encoded string. hex::encode(result) } Let's execute it. In below tests the data variable hold two things: function selector and arguments. For example 61047ff4000000000000000000000000000000000000000000000000000000000000000ais concatination of the function selector (first 8 chars) and 256-bit long argument. It is just fibonacci(10). a is hex of 10 and 37 is hex of 52. evm-runner/src/lib.rs #[test] fn fibonacci_works() { let data = "61047ff4000000000000000000000000000000000000000000000000000000000000000a"; let result = run_calc_contract(data); assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000037"); } #[test] fn addition_works() { let data = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002"; let result = run_calc_contract(data); assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000009"); } ","version":null,"tagName":"h2"},{"title":"Risc0​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#risc0","content":"It's time for risc0. First the guest program. It is super simple. It takes a string as an argument, passes it to the run_calc_contractand returns the result. methods/guest/src/bin/evm_calc.rs #![no_main] #![no_std] extern crate alloc; use alloc::{string::String}; use risc0_zkvm::guest::{env}; use evm_runner::run_calc_contract; risc0_zkvm::guest::entry!(main); pub fn main() { let input: String = env::read(); let result = run_calc_contract(&input); env::commit(&result); } The final step is calling it under ZK. host/src/main.rs fn main() { println!("Proving Calculator.add(7, 2)"); let input = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002"; let result = run_prover(input); println!("Proof generated. 7 + 2 = {result}"); println!("Proving Calculator.fibonacci(4)"); let input = "61047ff40000000000000000000000000000000000000000000000000000000000000004"; let result = run_prover(input); println!("Proof generated. fibonacci(4) = {result}"); } fn run_prover(input: &str) -> u32 { // Make the prover. let method_code = std::fs::read(EVM_CALC_PATH).unwrap(); let mut prover = Prover::new(&method_code, EVM_CALC_ID).unwrap(); // Push the input as an argument. prover.add_input_u32_slice(to_vec(input).unwrap().as_slice()); // Execute the prover. let receipt = prover.run().unwrap(); // Verify the proof. assert!(receipt.verify(EVM_CALC_ID).is_ok()); // Return result as an u32 value. let result: String = from_slice(receipt.journal.as_slice()).unwrap(); u32::from_str_radix(&result, 16).unwrap() } $ cargo run --release -p host Proving Calculator.add(7, 2) Proof generated. 7 + 2 = 9 Proving Calculator.fibonacci(4) Proof generated. fibonacci(4) = 3 ","version":null,"tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#conclusion","content":"How amazing and mindblowing it is! Of course, it's just a proof of concept. Yet with further development of Risc0 improving its proving time and with more flexible SputnikVM this approach is more than promising. ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#join-us","content":"Interested? Join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.3.1/","content":"","keywords":"","version":"0.3.1"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.3.1/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.3.1","tagName":"h2"},{"title":"Nysa","type":0,"sectionRef":"#","url":"/blog/Nysa","content":"","keywords":"","version":null},{"title":"Odra​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#odra","content":"A short reminder: Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design ... it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. Odra Understanding that people generally dislike learning new things, we've kept this in mind throughout development. Since day one, we have focused on creating Odra with the largest group of smart contract developers in mind - those familiar with Solidity. The Odra Framework is designed to flatten the learning curve for this group. A Solidity developer will encounter familiar concepts such as: ConstructorsPayable functionsMappingsRevertsCurrent callerCurrent block timeA standard module library (similar to OpenZeppelin)And more note It's important to note that the Odra Framework is intentionally blockchain-agnostic. Its design does not target any particular blockchain. Ultimately, Odra is built to support multiple blockchains, allowing the writing of smart contracts in Rust. Having so many similarities, why not take the next step and transpile Solidity code into Odra code? This is where Nysa comes into play. ","version":null,"tagName":"h2"},{"title":"Nysa​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#nysa","content":"Solidity and Rust share some syntax similarities despite being designed for different purposes. Both languages emphasize strong typing, pattern matching, and immutability by default. Nysa performs Solidity-to-Rust transpilation through four simple steps. Solidity Parser Firstly, we need a well-structured Rust representation of Solidity code. Nysa utilizes LALRPOP - a Rust parser generator framework. In the further steps, this enables us to conduct static analysis of the Solidity code, ranging from contract context down to individual expressions. solidity-parser/src/pt.rs // The representation of a Solidity contract #[derive(Debug, PartialEq)] pub struct ContractDefinition { pub doc: Vec<DocComment>, pub loc: Loc, pub ty: ContractTy, pub name: Identifier, pub base: Vec<Base>, pub parts: Vec<ContractPart>, } C3 Linearization One of the most notable distinctions between Rust and Solidity is their approach to inheritance. Rust says No, thx, whereas Solidity opts for The more, the better. Speaking more technically, Solidity supports multiple inheritance with C3 linearization. info The primary purpose of the C3 Linearization Algorithm is to establish a consistent and unambiguous order of method resolution in cases where there might be ambiguity or conflicts due to multiple inheritance. It ensures that the inherited methods are called in a predictable and well-defined sequence based on the class hierarchy and the order in which classes are defined. For simulating C3 linearization, Nysa utilizes an implementation of the C3 linearization in Rust written by Maciej Zieliński, so everything stays in the Odra family. Nysa Parser After that, we step to the essential part, converting Solidity code into Rust code. For example, a Solidity event. event Transfer(address indexed from, address indexed to, uint256 value); can easily be represented as an plain Rust struct - the same name, the same fields, similar types. #[derive(PartialEq, Eq, Debug)] pub struct Transfer { from: Option<Address>, to: Option<Address>, value: U256, } The same we do with contracts, interfaces, libraries, errors, variables, functions, statements, etc. Here is a snippet of the expression parser: nysa/src/parser/odra/expr/mod.rs pub fn parse<T>(expression: &Expression, ctx: &mut T) -> Result<syn::Expr, ParserError> where T: StorageInfo + TypeInfo + EventsRegister + ExternalCallsRegister + ContractInfo + FnContext, { match expression { Expression::Require { condition, error } => error::revert(Some(condition), error, ctx), Expression::ZeroAddress => Ok(parse_quote!(None)), Expression::Add { left, right } => math::add(left, right, ctx), Expression::Subtract { left, right } => math::sub(left, right, ctx), Expression::Increment { expr } => { let expr = parse(expr, ctx)?; Ok(parse_quote!(#expr += 1)) } Expression::ExternalCall { variable, fn_name, args, } => parse_ext_call(variable, fn_name, args, ctx), Expression::Type { ty } => { let ty = ty::parse_plain_type_from_ty(ty, ctx)?; Ok(parse_quote!(#ty)) } Expression::BoolLiteral(b) => Ok(parse_quote!(#b)), ... } } Printing the code The last step is just consuming the resulting C3 AST. Nysa produces a token stream from the AST. Most likely you would write it to a file. And there you are: a Rust smart contract is ready to be compiled! ","version":null,"tagName":"h2"},{"title":"Nysa + Odra​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#nysa--odra","content":"By design, Nysa is a universal tool, so the third step from the pipeline is replaceable. In other words, a Solidity input can be converted to Rust code supporting a framework/SDK of your choice unless you provide a parser implementation. However, the default implementation is OdraParser, which takes a contract written in Solidity and splits out an Odra module. I hope you see an analogy to the first two paragraphs at this point. Nysa the river and Nysa the transpiler flow into Odra. ","version":null,"tagName":"h3"},{"title":"Examples​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#examples","content":"","version":null,"tagName":"h2"},{"title":"Status message​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#status-message","content":"Let's get our hands dirty and create a very simple project. We will write a contract that stores a single mapping of records - an address to a string message. To set up the project, we use cargo odra. cargo odra new -n status -t blank cd status The first thing is to add Nysa to the project and create a rudimentary build.rs where we define the input - a solidity contract and the output - an Odra module generated by Nysa. Cargo.toml [build-dependencies] nysa = { version = "0.1.0", features = ["builder"] } build.rs const DEST_FILE_PATH: &str = "src/status_message.rs"; const SOURCE_FILE_PATH: &str = "src/status_message.sol"; fn main() { nysa::builder::generate_file::<&str, nysa::OdraParser>(SOURCE_FILE_PATH, DEST_FILE_PATH); } Next, implement the contract. Naturally, a Solidity one. src/status_message.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; contract StatusMessage { mapping(address => string) records; function setStatus(string memory status) public payable { address accountId = msg.sender; records[accountId] = status; } function getStatus(address accountId) public view returns (string memory) { return records[accountId]; } } The contract has a single mapping records that stores a message and its owner. Additionally, exposes two entry points: setStatus (sets current's sender message) and getStatus. Following, let's define a lib.rs file. src/lib.rs mod status_message; pub use status_message::{StatusMessage, StatusMessageDeployer, StatusMessageRef}; #[cfg(test)] mod test; The file is straightforward: registers a status_message rust module, reexports some Odra abstractions, and adds a test module. Lastly, we can test our contract. Like the original solidity contract, our Odra contract exposes two entry points: set_message() and get_message(). The test code looks like any other Odra test: we use StatusMessageDeployer to instantiate a contract, which gets us a reference to interact with the contract. src/test.rs use odra::{test_env, types::Address}; use super::*; const ACCOUNT: fn() -> Address = || odra::test_env::get_account(1); #[test] fn set_get_message() { let mut contract = StatusMessageDeployer::default(); test_env::set_caller(ACCOUNT()); contract.set_status("hello".to_string()); assert_eq!("hello".to_string(), contract.get_status(Some(ACCOUNT()))); } #[test] fn get_nonexistent_message() { let contract = StatusMessageDeployer::default(); assert_eq!( String::new(), contract.get_status(Some(ACCOUNT())) ); } cargo odra test # test against MockVM # or cargo odra test -b casper # build a wasm file and test against CasperVM status-message ├── src │ ├── lib.rs │ ├── status_message.sol │ └── test.rs ├── build.rs ├── Cargo.toml └── Odra.toml Full example available here. ","version":null,"tagName":"h3"},{"title":"CappedErc20​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#cappederc20","content":"A more complex, real-world example is a CappedErc20 contract. It is a ERC20 Ownable, Burnable and Capped token contract. plascoin.sol // ... // rest of the code contract Plascoin is ERC20Capped, ERC20Burnable, Ownable { constructor(string memory name_, string memory symbol_, uint256 cap_, address initialOwner) ERC20(name_, symbol_) ERC20Capped(cap_) Ownable(initialOwner) { } function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); } function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Capped) { super._update(from, to, value); } } You can check out the full source code here. Deployment of such a contract onto the Casper testnet is straightforward. We are just two steps from it. # to make sure the contract works as expected # we execute cargo odra test command to build and run tests cargo odra test -b casper # deploy onto the testnet casper-client put-deploy --node-address {{NODE_ADDRESS}} --chain-name casper-test --secret-key {{SECRET_KEY}} \\ --session-path {{CONTRACT_WASM}} \\ --payment-amount 130000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'{{CONTRACT_PACKAGE_HASH_NAMED_KEY}}'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ --session-arg "name:string='{{name}}'" \\ --session-arg "symbol:string='{{symbol}}'" \\ --session-arg "cap:u256='{{cap}}'" \\ --session-arg "initial_owner:opt_key='{{owner}}'" Literally in 5 minutes I was able to: Build a wasm file from Solidity source codeSuccessfully deploy the contract onto Testnet,Mint some tokens,And transfer them. Finally, we compare the costs of Solidity-to-Odra contract and a native CEP-18 implementation. Despite the contracts being different in terms of the internal logic and exposed entry points, such comparison gives us some insight into Nysa's efficiency. action\tCEP-18\tNysadeploy\t143.87\t93.37 transfer\t1.29\t1.36 ","version":null,"tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#conclusion","content":"Nysa is at early stage of development, but already has shown a huge potential. In a few simple steps, you can take advantage of an existing smart contract and convert it into an Odra module. The module can be a standalone contract, or a building block of a bigger contract. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.5.0/","content":"","keywords":"","version":"0.5.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.5.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.5.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.4.0/","content":"","keywords":"","version":"0.4.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.4.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.4.0","tagName":"h2"},{"title":"Odra + CosmWasm","type":0,"sectionRef":"#","url":"/blog/odra-cosmwasm","content":"","keywords":"","version":null},{"title":"CosmWasm​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#cosmwasm","content":"CosmWasm is a smart contract platform for building dApps on the Cosmos blockchain ecosystem. The platform is designed as a module that can be integrated into the Cosmos SDK, enabling developers who are already building blockchains with the Cosmos SDK to easily incorporate CosmWasm smart contract functionality without the need to modify their existing code. It uses the Rust programming language, so is potentially a perfect candidate for an Odra backend. There are many blockchains like Osmosis, Secret Network, Juno that utilize CosmWasm. ","version":null,"tagName":"h2"},{"title":"Show me your code​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#show-me-your-code","content":"I would like to write a Counter smart contract that is CosmWasm compatible. What are the requirements? It should store a u32 value. The initial value it set by the contract deployer.The value can be incremented.The value can read from the storage.The contract can call another contract and increment its counter. So let's write an Odra module first. counter.rs use odra::{types::{Address, event::OdraEvent}, Variable, contract_env}; use self::events::{Init, ValueUpdated}; #[odra::module] pub struct Counter { pub value: Variable<u32> } #[odra::module] impl Counter { #[odra(init)] pub fn init(&mut self, value: u32) { self.value.set(value); <Init as OdraEvent>::emit(Init { value, }); } pub fn increment(&mut self) { let old_value = self.value.get_or_default(); let new_value = old_value + 1; self.value.set(new_value); ValueUpdated { old_value, new_value, operator: contract_env::caller() }.emit(); } pub fn cross_increment(&mut self, counter_address: Address) { CounterRef::at(counter_address).increment(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } mod events { use odra::types::Address; #[derive(odra::Event)] pub struct ValueUpdated { pub old_value: u32, pub new_value: u32, pub operator: Address } #[derive(odra::Event)] pub struct Init { pub value: u32, } } #[cfg(test)] mod tests { use super::*; #[test] fn deploy() { let counter = CounterDeployer::init(10); assert_eq!(10, counter.get_value()); } #[test] fn increment() { let mut counter = CounterDeployer::init(10); counter.increment(); assert_eq!(11, counter.get_value()); } } But wait, I mentioned CosmWasm, did I? Here the beauty of Odra comes into play. Let's use cargo-odra. cargo odra build -b cosmos And... that's it, congratulations! We have just written and build our first CosmWasm contract. As you see, it is nothing different from building a contract for Casper. No additional code, we only changed the -b flag. ","version":null,"tagName":"h2"},{"title":"Deploy​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#deploy","content":"We have just built a wasm file, but is it really a fully functional contract? As a battlefield let's choose Juno Network (if you would like to read more about smart contract development on Juno read this Quick Start tutorial). This is an arbitrary choice, each client is built upon a so-called Wasm Zone wasmd, and its interface is alike. Assuming you already know how to interact with Juno testnet, let's move to the fun part. But before we go, to keep things simple, let's prepare a justfile. It'll make our interactions with the blockchain much easier. See full version. justfile NODE := "--node https://rpc.uni.juno.deuslabs.fi:443" CHAIN_ID := "--chain-id uni-6" QUERY_FLAGS := NODE + " " + CHAIN_ID TRANSACTION_DEFAULTS := "--gas-prices 0.025ujunox --gas auto --gas-adjustment 1.3 --broadcast-mode block" EXEC_FLAGS := NODE + " " + CHAIN_ID + " " + TRANSACTION_DEFAULTS get-address NAME: junod keys show {{NAME}} | grep -o juno.* store-wasm WASM_PATH SENDER: junod tx wasm store \\ {{WASM_PATH}} --from {{SENDER}} {{EXEC_FLAGS}} init-contract CODE_ID VALUE SENDER CONTRACT_NAME: junod tx wasm instantiate \\ {{CODE_ID}} \\ `just run-args-parser '{"name": "init", "args": [ { "value" : {{VALUE}} }]}'` \\ --label '{{CONTRACT_NAME}}' --from {{SENDER}} \\ --admin `just get-address {{SENDER}}` \\ {{EXEC_FLAGS}} exec-increment ADDRESS SENDER: junod tx wasm execute \\ {{ADDRESS}} \\ `just run-args-parser '{"name": "increment"}'` \\ --from {{SENDER}} \\ {{EXEC_FLAGS}} query-get-value ADDRESS: junod q wasm contract-state smart {{ADDRESS}} \\ `just run-args-parser '{"name": "get_value"}'` {{QUERY_FLAGS}} Ok, we are ready to go. First, a CosmWasm contract needs to be stored, technically is not a contract yet. Like a larva waiting to morph into a butterfly (sorry for that). There are three ways to interact with a contract. Instantiate - in other words, a constructor call. Once the contract is instantiated, it gets an address.Execute - call an entrypoint that modifies the state.Query - read the contract's state. Now, let's take a look at how to do it using the tools we have just prepared. # args: # the path to a wasm file, # the name under we store the private key. just store-wasm counter.wasm odra ... raw_log: '[{"events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgStoreCode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"}]}]}]' ... txhash: 1A8BA520E980C5ABCBCFA6F62D68B6BB82E780544605DE4DD5C6B1C5E966441B Great, our code is successfully stored. Form the logs we can read now the code_id which we will use to initialize the contract. # args: # code id taken from the previous tx, # counter initial value, # named private key, # contract label. just init-contract 286 1 odra "My Counter" ... raw_log: '[{"events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgInstantiateContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm-Init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]}]}]' ... txhash: 8DC53F95805349C3763CF4AF9527CAB2AEBEC77B240EFD3801C61231D8748F26 Fantastic, the contract has been initialized and we have its address - juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g. It's time to increment the counter. # args: # contract address taken from the previous tx, # named private key just exec-increment juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g odra ... raw_log: '[{"events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm-ValueUpdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]}]}]' ... txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 Finally, we expected, the value to be equal to 2 (the initial value was 1 and we incremented it once). # args: # contract address just query-get-value juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g data: 2 Indeed, as expected the current counter value is 2. ","version":null,"tagName":"h2"},{"title":"Show me your transaction​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#show-me-your-transaction","content":"I get it, you don't want to do it all by yourself. So let's take a closer look at one of my transactions. junod q tx 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 --node https://rpc.uni.juno.deuslabs.fi:443 --chain-id uni-6 ... logs: - events: - attributes: - key: _contract_address value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g type: execute - attributes: - key: action value: /cosmwasm.wasm.v1.MsgExecuteContract - key: module value: wasm - key: sender value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh type: message - attributes: - key: _contract_address value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g - key: action value: increment type: wasm - attributes: - key: _contract_address value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g - key: old_value value: "1" - key: new_value value: "2" - key: operator value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh type: wasm-ValueUpdated ... txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 If you are familiar Cosmos ecosystem, you can see that there is an attribute containing the performed action (increment) (If there were some parameters, they would be included in this attribute). We can find here also our ValueUpdated event with its arguments old_value, new_value and operator. Wow, we have it, everything worked as intended! ","version":null,"tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#conclusion","content":"Wouldn't it be great to replace Casper Erc20 and Cosmos Erc20 with a super-simple single Odra Erc20 implementation? The Counter contract is just a POC, and there is still a long road ahead of us. This simple example shows that features like storage, events, and cross-contract calls can be unified in a simple readable interface. CosmWasm integration hasn't been published yet, but if you want to experiment by yourself, check our GitHub (don't forget to update cargo-odra as well). ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#join-us","content":"Interested? Join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.6.0/","content":"","keywords":"","version":"0.6.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.6.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.6.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.7.0/","content":"","keywords":"","version":"0.7.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.7.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.7.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.8.0/","content":"","keywords":"","version":"0.8.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.8.0/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.8.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.8.1/","content":"","keywords":"","version":"0.8.1"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.8.1/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Building contracts manually","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/building-manually","content":"","keywords":"","version":"0.8.1"},{"title":"Building the contract manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#building-the-contract-manually","content":"To build the contract manually, cargo odra uses the following command: ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract info Odra uses the environment variable ODRA_MODULE to determine which contract to build. Assuming that project's crate is named my_project, this command will build the my_contract contract in release mode and generate the wasm file. The file will be put into the target/wasm32-unknown-unknown/release directory under the name my_project_build_contract.wasm. The Odra Framework expects the contracts to be placed in the wasm directory, and to be named correctly, so the next step would be to move the file: mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm ","version":"0.8.1","tagName":"h2"},{"title":"Optimizing the contract​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#optimizing-the-contract","content":"To lower the size of the wasm file, cargo odra uses the wasm-strip tool: wasm-strip wasm/my_contract.wasm To further optimize the wasm file, the wasm-opt tool is also used. wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm danger This step is required, as the wasm file generated by the Rust compiler is not fully compatible with the Casper execution engine. ","version":"0.8.1","tagName":"h2"},{"title":"Running the tests manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#running-the-tests-manually","content":"To run the tests manually, Odra needs to know which backend to use. To run tests agains Casper backend, the following command needs to be used: ODRA_BACKEND=casper cargo test ","version":"0.8.1","tagName":"h2"},{"title":"Wrapping up​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#wrapping-up","content":"Let's say we want to build the my_contract in debug mode, run the tests against the casper backend and use the my-own-allocator feature from our my_project project. To do that, we can use the following set of commands: ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm wasm-strip wasm/my_contract.wasm wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm ODRA_BACKEND=casper cargo test --features my-own-allocator ","version":"0.8.1","tagName":"h2"},{"title":"Attributes","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/attributes","content":"","keywords":"","version":"0.8.1"},{"title":"Payable​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#payable","content":"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens. ","version":"0.8.1","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#example","content":"examples/src/contracts/tlw.rs #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U256 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env.revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env() .emit_event(Deposit { address: caller, amount }); } If you try to send tokens to a non-payable function, the transaction will be automatically rejected. ","version":"0.8.1","tagName":"h3"},{"title":"Non Reentrant​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#non-reentrant","content":"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. They can also use reentrancy guards to block recursive calls to sensitive functions. In Odra you can just apply the #[odra(non_reentrant)] attribute to your function. ","version":"0.8.1","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#example-1","content":"#[odra::module] pub struct NonReentrantCounter { counter: Var<u32> } #[odra::module] impl NonReentrantCounter { #[odra(non_reentrant)] pub fn count_ref_recursive(&mut self, n: u32) { if n > 0 { self.count(); ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1); } } } impl NonReentrantCounter { fn count(&mut self) { let c = self.counter.get_or_default(); self.counter.set(c + 1); } } #[cfg(test)] mod test { use super::*; use odra::{host::{Deployer, NoArgs}, ExecutionError}; #[test] fn ref_recursion_not_allowed() { let test_env = odra_test::env(); let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs); let result = contract.count_ref_recursive(11); assert_eq!(result, ExecutionError::ReentrantCall.into()); } } ","version":"0.8.1","tagName":"h3"},{"title":"Mixing attributes​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#mixing-attributes","content":"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. To apply multiple attributes, you can write: #[odra(payable, non_reentrant)] fn deposit() { // your logic... } or #[odra(payable)] #[odra(non_reentrant)] fn deposit() { // your logic... } In both cases attributes order does not matter. ","version":"0.8.1","tagName":"h2"},{"title":"Advanced Storage Concepts","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/advanced-storage","content":"","keywords":"","version":"0.8.1"},{"title":"Recap and Basic Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#recap-and-basic-concepts","content":"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values. Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract. Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key. List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over. If you need a refresher on these topics, please refer to our guide on basic storage in Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Advanced Storage Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#advanced-storage-concepts-1","content":"","version":"0.8.1","tagName":"h2"},{"title":"Sequence​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#sequence","content":"The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value. pub struct Sequence<T> where T: Num + One + OdraType { value: Var<T> } The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively. ","version":"0.8.1","tagName":"h3"},{"title":"Advanced Mapping​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#advanced-mapping","content":"In Odra, a Mapping is a key-value storage system where the key is associated with a value. In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type derived from odra::OdraType. However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state. Let's consider the following example: examples/src/features/storage/mapping.rs use odra::{casper_types::U256, Mapping, UnwrapOrRevert}; use odra::prelude::*; use crate::owned_token::OwnedToken; #[odra::module] pub struct Mappings { strings: Mapping<(String, u32, String), String>, tokens: Mapping<String, OwnedToken> } #[odra::module] impl Mappings { ... pub fn total_supply(&mut self, token_name: String) -> U256 { self.tokens.module(&token_name).total_supply() } pub fn get_string_api( &self, key1: String, key2: u32, key3: String ) -> String { let opt_string = self.strings.get(&(key1, key2, key3)); opt_string.unwrap_or_revert(&self.env()) } } As you can see, a Mapping key can consist of a tuple of values, not limited to a single value. note Accessing Odra modules differs from accessing regular values such as strings or numbers. Firstly, within a Mapping, you don't encapsulate the module with Submodule. Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules. ","version":"0.8.1","tagName":"h3"},{"title":"AdvancedStorage Contract​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#advancedstorage-contract","content":"The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts. use odra::{Address, casper_types::U512, Sequence, Mapping}; use odra::prelude::*; use crate::modules::Token; #[odra::module] pub struct AdvancedStorage { counter: Sequence<u32>, tokens: Mapping<(String, String), Token>, } impl AdvancedStorage { pub fn current_value(&self) -> u32 { self.counter.get_current_value() } pub fn increment_and_get(&mut self) -> u32 { self.counter.next_value() } pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 { let token = self.tokens.module(&(token_name, creator)); token.balance_of(&address) } pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) { let mut token = self.tokens.module(&(token_name, creator)); token.mint(amount, to); } } ","version":"0.8.1","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#conclusion","content":"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are: Odra offers a Sequence module, enabling contracts to store and increment a single value.Mappings support composite keys expressed as tuples and can store modules as values. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts. ","version":"0.8.1","tagName":"h2"},{"title":"Storage Layout","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/storage-layout","content":"","keywords":"","version":"0.8.1"},{"title":"Casper VM Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#casper-vm-perspective","content":"The Casper Execution Engine (VM) enables the storage of data in named keys or dictionaries. However, a smart contract has a limited number of named keys, making it unsuitable for storing substantial data volumes. Odra resolves this issue by storing all user-generated data in a dictionary called state. This dictionary operates as a key-value store, where keys are strings with a maximum length of 64 characters, and values are arbitrary byte arrays. Here is an example of what the interface for reading and writing data could look like: pub trait CasperStorage { fn read(key: &str) -> Option<Vec<u8>>; fn write(key: &str, value: Vec<u8>); } ","version":"0.8.1","tagName":"h2"},{"title":"Odra Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#odra-perspective","content":"Odra was conceived with modularity and code reusability in mind. Additionally, we aimed to streamline storage definition through the struct object. Consider this straightforward storage definition: #[odra::module] pub struct Token { name: Var<String>, balances: Mapping<Address, U256> } The Token structure contains two fields: name of type String andbalances, which functions as a key-value store with Address as keys andU256 as values. The Token module can be reused in another module, as demonstrated in a more complex example: #[odra::module] pub struct Loans { lenders: SubModule<Token>, borrowers: SubModule<Token>, } The Loans module has two fields: lenders and borrowers, both of which have the same storage layout as defined by the Token module. Odra guarantees thatlenders and borrowers are stored under distinct keys within the storage dictionary. Both Token and Loans serve as examples to show how Odra's storage layout operates. ","version":"0.8.1","tagName":"h2"},{"title":"Key generation.​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#key-generation","content":"Every element of a module (struct) with N elements is associated with an index ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an element of a module is another module (SubModule<...>), the associated index serves as a prefix for the indexes of the inner module. While this may initially appear complex, it is easily understood through an example. In the example, indexes are presented as bytes, reflecting the actual implementation. Loans { lenders: Token { // prefix: 0x0000 name: 0, // key: 0x0000_0000 balances: 1 // key: 0x0000_0001 }, borrowers: Token { // prefix: 0x0001 name: 0, // key: 0x0001_0000 balances: 1 // key: 0x0001_0001 } } Additionally, it's worth mentioning how Mapping's keys are used in thestorage. They are simply concatenated with the index of the module, as demonstrated in the example. For instance, triggering borrowers.balances.get(0x1234abcd) would result in a key: 0x0001_0001_1234_abcd Finally, the key must be hashed to fit within the 64-character limit and then encoded in hexadecimal format. ","version":"0.8.1","tagName":"h2"},{"title":"Value serialization​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#value-serialization","content":"Before being stored in the storage, each value is serialized into bytes using the CLType serialization method and subsequently encapsulated with Casper'sBytes types. ","version":"0.8.1","tagName":"h2"},{"title":"Memory allocators","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/using-different-allocator","content":"","keywords":"","version":"0.8.1"},{"title":"Using a different allocator​","type":1,"pageTitle":"Memory allocators","url":"/docs/0.8.1/advanced/using-different-allocator#using-a-different-allocator","content":"If the default allocator does not suit your needs, or you use a crate that already provides an allocator, you can disable the default allocator by enabling the disable-allocator feature in the odra dependency in your project: [dependencies] odra = { path = "../odra", features = ["disable-allocator"] } If you want to have a better control over the features that are enabled during the building and tests, see the next article on building manually. ","version":"0.8.1","tagName":"h2"},{"title":"Casper","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/casper","content":"","keywords":"","version":"0.8.1"},{"title":"Contract Env​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#contract-env","content":"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances. ","version":"0.8.1","tagName":"h2"},{"title":"Events​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#events","content":"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity. Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed: __events - a dictionary that stores events' data.__events_length - the evens count.__events_ces_version - the version of Casper Event Standard. __events_schema - a dictionary that stores event schemas. Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key. So, Events are nothing different from any other data stored by a contract. A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[derive(Event)]. note Don't forget to expose events in the module using #[odra::module(events = [...])]. ","version":"0.8.1","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#payable","content":"The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key. Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse. Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. If under the way something goes wrong with the transfer, the contract reverts. The transferred amount can be read inside the contract by calling self.env().attached_value(). note Odra expects the cargo_purse runtime argument to be attached to a contract call. In case of its absence, the contract_env::attached_value() returns zero. ","version":"0.8.1","tagName":"h3"},{"title":"Revert​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#revert","content":"In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User. ","version":"0.8.1","tagName":"h3"},{"title":"Context​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#context","content":"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack. The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address. The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address. As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse. ","version":"0.8.1","tagName":"h3"},{"title":"Test Env​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#test-env","content":"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine. In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000). The Test Env internally keeps track of the current block time, error and attached value. Each test is executed on a fresh instance of the Test Env. ","version":"0.8.1","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#usage","content":"Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -bparameter: cargo odra test -b casper If you want to just generate a wasm file, simply run: cargo odra build -b casper ","version":"0.8.1","tagName":"h2"},{"title":"Deploying a contract to Casper network​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#deploying-a-contract-to-casper-network","content":"There would be no point in writing a contract if you couldn't deploy it to the blockchain. You can do it in two ways: provided by the Casper itself: using the casper-client tool or using the Odra's Livenet integration. Let's explore the first option to better understand the process. note If you wish, you can skip the following section and jump to the Livenet integration. ","version":"0.8.1","tagName":"h2"},{"title":"WASM arguments​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#wasm-arguments","content":"When deploying a new contract you can pass some arguments to it. Every contract written in Odra expects those arguments to be set: odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable. Additionally, if required by the contract, you can pass constructor arguments. When working with the test env via cargo odra or when usingLivenet integration this is handled automatically. However, if you rather usecasper-client directly, you have to pass them manually: ","version":"0.8.1","tagName":"h3"},{"title":"Example: Deploy Counter​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#example-deploy-counter","content":"To deploy your contract with a constructor using casper-client, you need to pass the above arguments. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 5000000000000 \\ --session-path ./wasm/counter.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "value:u32:42" For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'. ","version":"0.8.1","tagName":"h3"},{"title":"Example: Deploy ERC721​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#example-deploy-erc721","content":"Odra comes with a standard ERC721 token implementation. Clone the main Odra repo and navigate to the modules directory. Firstly contract needs to be compiled. cargo odra build -b casper -c erc721_token It produces the erc721_token.wasm file in the wasm directory. Now it's time to deploy the contract. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc721_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string:'MyNFT'" \\ --session-arg "symbol:string:'NFT'" \\ --session-arg "base_uri:string:'https://example.com/'" It's done. The contract is deployed and ready to use. Your account is the owner of the contract and you can mint and burn tokens. For more details see the code of the ERC721 module. To obtain the package hash of the contract search for my_nft key in your account's named keys. ","version":"0.8.1","tagName":"h3"},{"title":"Example: Deploy ERC1155​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#example-deploy-erc1155","content":"The process is similar to the one described in the previous section. Contract compilation: cargo odra build -b casper -c erc1155_token Contract deployment: casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc1155_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ As previously, your account is the owner and can mint and burn tokens. For more details see the code of the ERC1155 module. ","version":"0.8.1","tagName":"h3"},{"title":"Sending CSPR to a contract​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#sending-cspr-to-a-contract","content":"Defining payable entry points is described in Native Token section. What is happening under the hood is that Odra creates a new cargo_purse argument for each payable entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. When a contract adds CSPR to another contract call, Odra handles it for you. The problem arises when you want to call an entry point and attach CSPR as an account. The only way of doing that is by executing code in the sessions context, that top-ups the cargo_purse and then calls the contract. Odra provides a generic proxy_caller.wasm that does exactly that. You can build it by yourself from the main Odra repository, or use the proxy_caller.wasmwe maintain. ","version":"0.8.1","tagName":"h2"},{"title":"Using proxy_caller.wasm​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#using-proxy_callerwasm","content":"To use the proxy_caller.wasm you need to attach the following arguments: contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. Result of to_bytes on CasperPackageHash.entry_point - String type. The name of the entry point you want to call.args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.attached_value. U512 type. The amount of CSPR you want to attach to the call.amount. U512 type. Should be the same value as attached_value if not None. It is a special Casper argument that enables the access to account's main purse. Currently casper-client doesn't allow building such arguments. You have to build it using your SDK. ","version":"0.8.1","tagName":"h3"},{"title":"Execution​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#execution","content":"First thing Odra does with your code, is similar to the one used in OdraVM - a list of entrypoints is generated, thanks to the #[odra::module] macro. ","version":"0.8.1","tagName":"h2"},{"title":"OdraVM","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/odra-vm","content":"","keywords":"","version":"0.8.1"},{"title":"Usage​","type":1,"pageTitle":"OdraVM","url":"/docs/0.8.1/backends/odra-vm#usage","content":"The OdraVM is the default backend for Odra framework, so each time you run cargo odra test You are running your code against it. ","version":"0.8.1","tagName":"h2"},{"title":"Architecture​","type":1,"pageTitle":"OdraVM","url":"/docs/0.8.1/backends/odra-vm#architecture","content":"OdraVM consists of two main parts: the Contract Register and the State. The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address. Contracts and Test Env functions can modify the State of the OdraVM. Contrary to the "real" backend, which holds the whole history of the blockchain, the OdraVM State holds only the current state of the OdraVM. Thanks to this and the fact that we do not need the blockchain itself, OdraVM starts instantly and runs the tests in the native speed. ","version":"0.8.1","tagName":"h2"},{"title":"Execution​","type":1,"pageTitle":"OdraVM","url":"/docs/0.8.1/backends/odra-vm#execution","content":"When the OdraVM backend is enabled, the #[odra::module] macro is responsible for converting your pub functions into a list of Entrypoints, which are put into a Contract Container. When the contract is deployed, its Container registered into a Registry under an address. During the contract call, OdraVM finds an Entrypoint and executes the code. ","version":"0.8.1","tagName":"h2"},{"title":"What is a backend?","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/what-is-a-backend","content":"","keywords":"","version":"0.8.1"},{"title":"Contract Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/0.8.1/backends/what-is-a-backend#contract-env","content":"The Contract Env is a simple interface that each backend needs to implement, exposing features of the blockchain from the perspective of the contract. It gives Odra a set of functions, which allows implementing more complex concepts - for example, to implement Mapping, Odra requires some kind of storage integration. The exact implementation of those functions is a responsibility of a backend, making Odra and its user free to implement the contract logic, instead of messing with the blockchain internals. Other functions from Contract Env include handling transfers, addresses, block time, errors and events. ","version":"0.8.1","tagName":"h2"},{"title":"Host Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/0.8.1/backends/what-is-a-backend#host-env","content":"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with the backend from the outside world - really useful for implementing tests. This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, to the more test-oriented - handling errors, forwarding the block time, etc. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"What is a backend?","url":"/docs/0.8.1/backends/what-is-a-backend#whats-next","content":"We will take a look at backends Odra implements in more detail. ","version":"0.8.1","tagName":"h2"},{"title":"Delegate","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/delegate","content":"","keywords":"","version":"0.8.1"},{"title":"Overview​","type":1,"pageTitle":"Delegate","url":"/docs/0.8.1/advanced/delegate#overview","content":"To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand. You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself. ","version":"0.8.1","tagName":"h2"},{"title":"Code Examples​","type":1,"pageTitle":"Delegate","url":"/docs/0.8.1/advanced/delegate#code-examples","content":"Consider the following basic example for better understanding: use crate::{erc20::Erc20, ownable::Ownable}; use odra::{ Address, casper_types::U256, module::{Module, SubModule}, prelude::* }; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } delegate! { to self.erc20 { pub fn transfer(&mut self, recipient: Address, amount: U256); pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256); pub fn approve(&mut self, spender: Address, amount: U256); pub fn name(&self) -> String; pub fn symbol(&self) -> String; pub fn decimals(&self) -> u8; pub fn total_supply(&self) -> U256; pub fn balance_of(&self, owner: Address) -> U256; pub fn allowance(&self, owner: Address, spender: Address) -> U256; } to self.ownable { pub fn get_owner(&self) -> Address; pub fn change_ownership(&mut self, new_owner: Address); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality. The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities. Let's take a look at another example. use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct DeFiPlatform { ownable: SubModule<Ownable>, erc20: SubModule<Erc20>, exchange: SubModule<Exchange> } #[odra::module] impl DeFiPlatform { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); self.exchange.init(exchange_rate); } delegate! { to self.erc20 { pub fn transfer(&mut self, recipient: Address, amount: U256); pub fn balance_of(&self, owner: Address) -> U256; } to self.ownable { pub fn get_owner(&self) -> Address; } to self.exchange { pub fn swap(&mut self, sender: Address, recipient: Address); pub fn set_exchange_rate(&mut self, new_rate: u64); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure. Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts. ","version":"0.8.1","tagName":"h2"},{"title":"Cargo Odra","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/cargo-odra","content":"","keywords":"","version":"0.8.1"},{"title":"Managing projects​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#managing-projects","content":"Two commands help you create a new project. The first one is cargo odra new. You need to pass one parameter, namely --name {PROJECT_NAME}: cargo odra new --name my-project This creates a new project in the my_project folder and name it my_project. You can see it for yourself, for example by taking a look into a Cargo.toml file created in your project's folder: [package] name = "my_project" version = "0.1.0" edition = "2021" The project is created using the template located in Odra's main repository. By default it uses full template, if you want, you can use minimalistic blank by running: cargo odra new -t blank --name my-project The third available template is workspace, which creates a workspace with two projects, similar to the one created with the full template. By default, the latest release of Odra will be used for the template and as a dependency. You can pass a source of Odra you want to use, by using -s parameter: cargo odra new -n my-project -s ../odra # will use local folder of odra cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release cargo odra new -n my-project -s 0.8.1 # will use a version released on crates.io The second way of creating a project is by using init command: cargo odra init --name my-project It works in the same way as new, but instead of creating a new folder, it creates a project in the current, empty directory. ","version":"0.8.1","tagName":"h2"},{"title":"Generating code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#generating-code","content":"If you want to quickly create a new contract code, you can use the generate command: cargo odra generate -c counter This creates a new file src/counter.rs with sample code, add appropriate use and mod sections to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, visit Odra.toml. ","version":"0.8.1","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#testing","content":"The most used command during the development of your project should be this one: cargo odra test It runs your tests against Odra's MockVM. It is substantially faster than CasperVMand implements all the features Odra uses. When you want to run tests against a "real" VM, just provide the name of the backend using -boption: cargo odra test -b casper In the example above, Cargo Odra builds the project, generates the wasm files, spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat. Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. This is why OdraVM was created and should be your first choice when developing contracts. Of course, testing all of your code against a blockchain VM is a must in the end. If you want to run only some of the tests, you can pass arguments to the cargo test command (which is run in the background obviously): cargo odra test -- this-will-be-passed-to-cargo-test If you want to run tests which names contain the word two, you can execute: cargo odra test -- two Of course, you can do the same when using the backend: cargo odra test -b casper -- two ","version":"0.8.1","tagName":"h2"},{"title":"Building code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#building-code","content":"You can also build the code itself and generate the output contracts without running the tests. To do so, simply run: cargo odra build If the build process finishes successfully, wasm files will be located in wasm folder. Notice, that this command does not require the -b option. If you want to build specific contract, you can use -c option: cargo odra build -c counter # you pass many comma separated contracts ","version":"0.8.1","tagName":"h2"},{"title":"Generating contract schema​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#generating-contract-schema","content":"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command: cargo odra schema This generates a schema file in JSON format for all your contracts and places them in the resources folder. If the resources folder does not exist, it creates the folder for you. Like with the build command, you can use the -c option to generate a schema for a specific contract. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#whats-next","content":"In the next section, we will take a look at all the files and directories that cargo odra created for us and explain their purpose. ","version":"0.8.1","tagName":"h2"},{"title":"Host Communication","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/communicating-with-host","content":"","keywords":"","version":"0.8.1"},{"title":"What's next​","type":1,"pageTitle":"Host Communication","url":"/docs/0.8.1/basics/communicating-with-host#whats-next","content":"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code we presented in fact works! ","version":"0.8.1","tagName":"h2"},{"title":"Livenet","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/livenet","content":"","keywords":"","version":"0.8.1"},{"title":"Setup​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#setup","content":"To use Livenet backend, we need to provide Odra with some information - the network address, our private key and the name of the chain we want to use. Optionally, we can add multiple private keys to use more than one account in our tests. Those values are passed using environment variables. We can use .env file to store them - let's take a look at an example .env file, created from the .env.sample file from examples folder: # Path to the secret key of the account that will be used # to deploy the contracts. # We're using .keys folder so we don't accidentally commit # the secret key to the repository. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777 # Chain name of the network. Known values: # - integration-test ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test # Paths to the secret keys of the additional accounts. # Main secret key will be 0th account. ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. Let's go through the code: fn main() { // Similar to the OdraVM backend, we need to initialize // the environment: let env = odra_casper_livenet_env::env(); // Most of the for the host env works the same as in the // OdraVM backend. let owner = env.caller(); // Addresses are the real addresses on the blockchain, // so we need to provide them // if we did not import their secret keys. let recipient = "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"; let recipient = Address::from_str(recipient).unwrap(); // Arguments for the contract init method. let name = String::from("Plascoin"); let symbol = String::from("PLS"); let decimals = 10u8; let initial_supply: U256 = U256::from(10_000); // The main difference between other backends - we need to specify // the gas limit for each action. // The limit will be used for every consecutive action // until we change it. env.set_gas(100_000_000_000u64); // Deploy the contract. The API is the same as in the OdraVM backend. let init_args = Erc20InitArgs { name, symbol, decimals, initial_supply: Some(initial_supply) }; let mut token = Erc20HostRef::deploy(env, init_args); // We can now use the contract as we would in the OdraVM backend. println!("Token address: {}", token.address().to_string()); // Uncomment to load existing contract. // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; // let address = Address::from_str(address).unwrap(); // We use the Livenet-specific `load` method to load the contract // that is already deployed. // let mut token = Erc20Deployer::load(env, address); // Non-mutable calls are free! Neat, huh? More on that later. println!("Token name: {}", token.name()); // The next call is mutable, but the cost is lower that the deployment, // so we change the amount of gas env.set_gas(3_000_000_000u64); token.transfer(recipient, U256::from(1000)); println!("Owner's balance: {:?}", token.balance_of(owner)); println!("Recipient's balance: {:?}", token.balance_of(recipient)); } note The above example is a rust binary, not a test. Note that it is also added as a section of theCargo.toml file: [bin] name = "erc20_on_livenet" path = "src/bin/erc20_on_livenet.rs" required-features = ["livenet"] test = false ","version":"0.8.1","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#usage","content":"To run the above code, we simply need to run the binary with the livenet feature enabled: cargo run --bin erc20_on_livenet --features=livenet note Before executing the binary, make sure you built a wasm file. A part of a sample output should look like this: ... 💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 💁 INFO : Deploy "65b1a5d21..." successfully executed. Owner's balance: 4004 Recipient's balance: 4000 Those logs are a result of the last 4 lines of the above listing. Each deployment or a call to the blockchain will be noted and will take some time to execute. We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant and cost us nothing. How it is possible? info You can see the deployment on http://cspr.live/ - the transfer from the example can be seen here. ","version":"0.8.1","tagName":"h2"},{"title":"How Livenet backend works​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#how-livenet-backend-works","content":"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. It is possible however to query the state of the blockchain for free. This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the node is the current state. This is why the balance_of call was almost instant and free. Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract (see Cross Calls), it is executed offline and node is used for the state query only. However, the Livenet needs to know the connection between the contracts and the code, so make sure to deploy or load already deployed contracts ","version":"0.8.1","tagName":"h2"},{"title":"Multiple enviroments​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#multiple-enviroments","content":"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, multiple nodes or even multiple chains. To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file has to be used first. If your integration.env file has a value that IS present in the .env file, it will override the value from the .env file. ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene To sum up - this command will firstly load the integration.env file and then load the missing values from .env file. ","version":"0.8.1","tagName":"h2"},{"title":"Directory structure","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/directory-structure","content":"","keywords":"","version":"0.8.1"},{"title":"Cargo.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#cargotoml","content":"Let's first take a look at Cargo.toml file: [package] name = "sample" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.1" [dev-dependencies] odra-test = "0.8.1" [[bin]] name = "sample_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "sample_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also added as a dev dependency. ","version":"0.8.1","tagName":"h2"},{"title":"Odra.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#odratoml","content":"This is the file that holds information about contracts that will be generated when running cargo odra build andcargo odra test: [[contracts]] fqn = "sample::Flipper" As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to the contract is located in src/flipper.rs. More contracts can be added here by hand, or by using cargo odra generate command. ","version":"0.8.1","tagName":"h2"},{"title":"src/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#src","content":"This is the folder where your smart contract files live. ","version":"0.8.1","tagName":"h2"},{"title":"bin/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#bin","content":"This is the folder where scripts that will be used to generate code or schemas live. You don't need to modify those files, they are generated by cargo odra new command and are used by cargo odra build, cargo odra test and cargo odra schema commands. ","version":"0.8.1","tagName":"h2"},{"title":"target/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#target","content":"Files generated by cargo during the build process are put here. ","version":"0.8.1","tagName":"h2"},{"title":"wasm/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#wasm","content":"WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files and deploy them on the blockchain. What's next Now, let's take a look at one of the files mentioned above in more detail, namely the Odra.toml file. ","version":"0.8.1","tagName":"h2"},{"title":"Errors","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/errors","content":"","keywords":"","version":"0.8.1"},{"title":"Testing errors​","type":1,"pageTitle":"Errors","url":"/docs/0.8.1/basics/errors#testing-errors","content":"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner: examples/src/features/handling_errors.rs #[cfg(test)] mod tests { use super::{Error, OwnedContractHostRef, OwnedContractInitArgs}; use odra::host::Deployer; use odra::prelude::*; #[test] fn test_owner_error() { let test_env = odra_test::env(); let owner = test_env.get_account(0); let not_an_owner = test_env.get_account(1); test_env.set_caller(owner); let init_args = OwnedContractInitArgs { name: "OwnedContract".to_string() }; let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args); test_env.set_caller(not_an_owner); assert_eq!( owned_contract.try_change_name("NewName".to_string()), Err(Error::NotAnOwner.into()) ); } } Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult.OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and and safe its safe version: try_name, try_owner, try_change_name. In our example, we are calling try_change_name and expecting an error to be thrown. For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, we need to convert our custom error to OdraError using Into::into(). ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Errors","url":"/docs/0.8.1/basics/errors#whats-next","content":"We will learn how to emit and test events using Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Cross calls","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/cross-calls","content":"","keywords":"","version":"0.8.1"},{"title":"Contract Ref​","type":1,"pageTitle":"Cross calls","url":"/docs/0.8.1/basics/cross-calls#contract-ref","content":"We mentioned HostRef already in our Testing article - a host side reference to already deployed contract. In the module context we use a ContractRef instead, to call other contracts. Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, by the #[odra::module] attribute. To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above. The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module]impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract. External Contracts Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI. For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of. Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere. #[odra::external_contract] pub trait Adder { fn add(&self, n1: u32, n2: u32) -> u32; } Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call: examples/src/features/cross_calls.rs AdderContractRef::new(self.env(), address).add(3, 5) ","version":"0.8.1","tagName":"h2"},{"title":"Loading the contract​","type":1,"pageTitle":"Cross calls","url":"/docs/0.8.1/basics/cross-calls#loading-the-contract","content":"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test our contracts in Livenet backend. We can load the contract using load method on the Deployer: examples/bin/erc20_on_livenet.rs fn _load(env: &HostEnv) -> Erc20HostRef { let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; let address = Address::from_str(address).unwrap(); <Erc20HostRef as HostRefLoader>::load(env, address) } ","version":"0.8.1","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"Cross calls","url":"/docs/0.8.1/basics/cross-calls#testing","content":"Let's see how we can test our cross calls using this knowledge: examples/src/features/cross_calls.rs #[cfg(test)] mod tests { use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef}; use odra::host::{Deployer, HostRef, NoArgs}; #[test] fn test_cross_calls() { let test_env = odra_test::env(); let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs); let init_args = CrossContractInitArgs { math_engine_address: *math_engine_contract.address() }; let cross_contract = CrossContractHostRef::deploy(&test_env, init_args); assert_eq!(cross_contract.add_using_another(), 8); } } Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize. #[cfg(test)] mod tests { use super::*; use odra::{Address, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_ext() { let test_env = odra_test::env(); let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5) assert_eq!(adder.add(1, 2), 3); } fn get_adder_address(test_env: &HostEnv) -> Address { let contract = MathEngineHostRef::deploy(test_env, NoArgs); *contract.address() } } ","version":"0.8.1","tagName":"h2"},{"title":"Flipper Internals","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/flipper-internals","content":"","keywords":"","version":"0.8.1"},{"title":"Header​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#header","content":"flipper.rs use odra::Var; Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation that can be reused between targets. In the above case, we're importing Var, which is responsible for storing simple values on the blockchain's storage. ","version":"0.8.1","tagName":"h2"},{"title":"Struct​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#struct","content":"flipper.rs /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } In Odra, all contracts are also modules, which can be reused between contracts. That's why we need to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all the fields of the contract. Those fields can be regular Rust data types, however - those will not be persisted on the blockchain. They can also be Odra modules - defined in your project or coming from Odra itself. Finally, to make the data persistent on the blockchain, you can use something likeVar<T> showed above. To learn more about storage interaction, take a look at thenext article. ","version":"0.8.1","tagName":"h2"},{"title":"Impl​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#impl","content":"flipper.rs /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } ... Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take allpub functions from this section and create contract endpoints from them. So, if you wish to have functions that are not available for calling outside the contract, do not make them public. Alternatively, you can create a separate impl section without the macro - all functions defined there, even marked with pub will be not callable. The function named init is the constructor of the contract. This function will be limited to only to a single call, all further calls to it will result in an error. The init function is optional, if your contract does not need any initialization, you can skip it. flipper.rs ... /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } ... The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data saved there using set function will be persisted in the blockchain. ","version":"0.8.1","tagName":"h2"},{"title":"Tests​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#tests","content":"flipper.rs #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } ... You can write tests in any way you prefer and know in Rust. In the example above we are deploying the contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, as the second argument of the deploy function, we pass NoArgs - one of the implementations of the InitArgs trait provided with the framework. The contract will be deployed on the VM you chose while running cargo odra test. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#whats-next","content":"Now let's take a look at the different types of storage that Odra provides and how to use them. ","version":"0.8.1","tagName":"h2"},{"title":"Modules","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/modules","content":"","keywords":"","version":"0.8.1"},{"title":"Testing​","type":1,"pageTitle":"Modules","url":"/docs/0.8.1/basics/modules#testing","content":"As we don't need to hold addresses, the test is really simple: examples/src/features/modules.rs #[cfg(test)] mod tests { use super::ModulesContractHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn test_modules() { let test_env = odra_test::env(); let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs); assert_eq!(modules_contract.add_using_module(), 8); } } ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Modules","url":"/docs/0.8.1/basics/modules#whats-next","content":"We will see how to handle native token transfers. ","version":"0.8.1","tagName":"h2"},{"title":"Odra.toml","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/odra-toml","content":"","keywords":"","version":"0.8.1"},{"title":"Adding a new contract manually​","type":1,"pageTitle":"Odra.toml","url":"/docs/0.8.1/basics/odra-toml#adding-a-new-contract-manually","content":"Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly. For example, if you want to create a new contract called counter, your Odra.toml file should finally look like this: [[contracts]] fqn = "sample::Flipper" [[contracts]] fqn = "sample::Counter" ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Odra.toml","url":"/docs/0.8.1/basics/odra-toml#whats-next","content":"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famousFlipper contract. ","version":"0.8.1","tagName":"h2"},{"title":"Events","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/events","content":"","keywords":"","version":"0.8.1"},{"title":"Testing events​","type":1,"pageTitle":"Events","url":"/docs/0.8.1/basics/events#testing-events","content":"Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted: examples/src/features/events.rs use super::{PartyContractHostRef, PartyStarted}; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; #[test] fn test_party() { let test_env: HostEnv = odra_test::env(); let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs); test_env.emitted_event( party_contract.address(), &PartyStarted { caller: test_env.get_account(0), block_time: 0 } ); // If you do not want to check the exact event, you can use `emitted` function test_env.emitted(party_contract.address(), "PartyStarted"); // You can also check how many events were emitted. assert_eq!(test_env.events_count(party_contract.address()), 1); } To explore more event testing functions, check the HostEnv documentation. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Events","url":"/docs/0.8.1/basics/events#whats-next","content":"Read the next article to learn how to call other contracts from the contract context. ","version":"0.8.1","tagName":"h2"},{"title":"Native token","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/native-token","content":"","keywords":"","version":"0.8.1"},{"title":"Testing​","type":1,"pageTitle":"Native token","url":"/docs/0.8.1/basics/native-token#testing","content":"To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function -balance_of: examples/src/features/native_token.rs #[cfg(test)] mod tests { use super::PublicWalletHostRef; use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_modules() { let test_env = odra_test::env(); let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs); assert_eq!(test_env.balance_of(my_contract.address()), U512::zero()); my_contract.with_tokens(U512::from(100)).deposit(); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100)); my_contract.withdraw(U512::from(25)); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75)); } } ","version":"0.8.1","tagName":"h2"},{"title":"Storage interaction","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/storage-interaction","content":"","keywords":"","version":"0.8.1"},{"title":"Var​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#var","content":"The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your variable in the Var type. Let's look at a "real world" example of a contract that represents a dog: examples/src/features/storage/variable.rs #[odra::module] pub struct DogContract { barks: Var<bool>, weight: Var<u32>, name: Var<String>, walks: Var<Vec<u32>>, } You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)! Let's make this contract usable, by providing a constructor and some getter functions: examples/src/features/storage/variable.rs use odra::Var; #[odra::module] impl DogContract { pub fn init(&mut self, barks: bool, weight: u32, name: String) { self.barks.set(barks); self.weight.set(weight); self.name.set(name); self.walks.set(Vec::<u32>::default()); } pub fn barks(&self) -> bool { self.barks.get_or_default() } pub fn weight(&self) -> u32 { self.weight.get_or_default() } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { let walks = self.walks.get_or_default(); walks.len() as u32 } pub fn walks_total_length(&self) -> u32 { let walks = self.walks.get_or_default(); walks.iter().sum() } } As you can see, you can access the data, by using get_or_default function: examples/src/features/storage/variable.rs ... self.barks.get_or_default() ... note Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable doesn't have to be initialized! To modify the data, use the set() function: examples/src/features/storage/variable.rs self.barks.set(barks); A Var is easy to use and efficient for simple data types. One of its downsides is that it serializes the data as a whole, so when you're using complex types like Vec or HashMap, each time you get or set the whole data is read and written to the blockchain storage. In the example above, if we want to see how many walks our dog had, we would use the function: examples/src/features/storage/variable.rs pub fn walks_amount(&self) -> usize { let walks = self.walks.get_or_default(); walks.len() } But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, especially for larger sets of data. To tackle this issue following two types were created. ","version":"0.8.1","tagName":"h2"},{"title":"Mapping​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#mapping","content":"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that uses Mapping to store information about our dog's friends and how many times they visited: examples/src/features/storage/mapping.rs use odra::{Mapping, Var}; #[odra::module] pub struct DogContract2 { name: Var<String>, friends: Mapping<String, u32>, } In the example above, our key is a String (it is a name of the friend) and we are storing u32 values (amount of visits). To read and write values from and into a Mapping we use a similar approach to the one shown in the Vars section with one difference - we need to pass a key: examples/src/features/storage/mapping.rs pub fn visit(&mut self, friend_name: String) { let visits = self.visits(friend_name.clone()); self.friends.set(&friend_name, visits + 1); } pub fn visits(&self, friend_name: String) -> u32 { self.friends.get_or_default(&friend_name) } The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. We could implement such behavior by using a numeric type key and saving the length of the set in a separate variable. Thankfully Odra comes with a prepared solution - the List type. note If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with a Var working together: core/src/list.rs use odra::{List, Var}; pub struct List<T> { values: Mapping<u32, T>, index: Var<u32> } ","version":"0.8.1","tagName":"h2"},{"title":"List​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#list","content":"Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, we'll use the list: examples/src/features/storage/list.rs #[odra::module] pub struct DogContract3 { name: Var<String>, walks: List<u32>, } As you can see, the notation is very similar to the Vec. To understand the usage, take a look at the reimplementation of the functions with an additional function that takes our dog for a walk (it writes the data to the storage): examples/src/features/storage/list.rs #[odra::module] impl DogContract3 { pub fn init(&mut self, name: String) { self.name.set(name); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { self.walks.len() } pub fn walks_total_length(&self) -> u32 { self.walks.iter().sum() } pub fn walk_the_dog(&mut self, length: u32) { self.walks.push(length); } } Now, we can know how many walks our dog had without loading the whole vector from the storage. We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all the cases for you. info All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder. ","version":"0.8.1","tagName":"h2"},{"title":"Custom Types​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#custom-types","content":"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors. Implementing custom types is straightforward, your type must derive from OdraType: use odra::{Address, OdraType}; #[derive(OdraType)] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } note Each field of your struct must be an OdraType. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#whats-next","content":"In the next article, we'll see how to query the host for information about the world and our contract. ","version":"0.8.1","tagName":"h2"},{"title":"Testing","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/testing","content":"","keywords":"","version":"0.8.1"},{"title":"HostEnv​","type":1,"pageTitle":"Testing","url":"/docs/0.8.1/basics/testing#hostenv","content":"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) and to configure how the contracts are deployed and called. Let's revisit the example from the previous article about host communication and implement the tests that prove it works: examples/src/features/testing.rs #[cfg(test)] mod tests { use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs}; use odra::{host::{Deployer, HostEnv}, prelude::*}; #[test] fn env() { let test_env: HostEnv = odra_test::env(); test_env.set_caller(test_env.get_account(0)); let init_args = TestingContractInitArgs { name: "MyContract".to_string() }; let testing_contract = TestingContractHostRef::deploy(&test_env, init_args); let creator = testing_contract.created_by(); test_env.set_caller(test_env.get_account(1)); let init_args = TestingContractInitArgs { name: "MyContract2".to_string() }; let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args); let creator2 = testing_contract2.created_by(); assert_ne!(creator, creator2); } } In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). Next, we are deploying two instances of the same contract, but we're using HostEnv::set_callerto change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller()the function we are calling inside the contract. HostEnv comes with a set of functions that will let you write better tests: fn set_caller(&self, address: Address) - you've seen it in action just nowfn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given addressfn advance_block_time(&self, time_diff: u64) - increases the current value of block_timefn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; by default, you start with the 0-th accountfn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract Full list of functions can be found in the HostEnv documentation. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Testing","url":"/docs/0.8.1/basics/testing#whats-next","content":"We take a look at how Odra handles errors! ","version":"0.8.1","tagName":"h2"},{"title":"odra-examples","type":0,"sectionRef":"#","url":"/docs/0.8.1/examples/odra-examples","content":"","keywords":"","version":"0.8.1"},{"title":"What's next​","type":1,"pageTitle":"odra-examples","url":"/docs/0.8.1/examples/odra-examples#whats-next","content":"Read the next article to learn about reusable Odra components encapsulated in odra-modules. ","version":"0.8.1","tagName":"h2"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/0.8.1/getting-started/installation","content":"","keywords":"","version":"0.8.1"},{"title":"Prerequisites​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#prerequisites","content":"To start working with Odra, you need to have the following installed on your machine: Rust toolchain installed (see rustup.rs)wasmstrip tool installed (see wabt) We do not provide exact commands for installing these tools, as they are different for different operating systems. Please refer to the documentation of the tools themselves. With Rust toolchain ready, you can add a new target: rustup target add wasm32-unknown-unknown note wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files. ","version":"0.8.1","tagName":"h2"},{"title":"Installing Cargo Odra​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#installing-cargo-odra","content":"Cargo Odra is a helpful tool that will help you to build and test your smart contracts. It is not required to use Odra, but the documentation will assume that you have it installed. To install it, simply execute the following command: cargo install cargo-odra --locked To check if it was installed correctly and see available commands, type: cargo odra --help If everything went fine, we can proceed to the next step. ","version":"0.8.1","tagName":"h2"},{"title":"Creating a new Odra project​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#creating-a-new-odra-project","content":"To create a new project, simply execute: cargo odra new --name my-project && cd my_project This will create a new folder called my_project and initialize Odra there. Cargo Odra will create a sample contract for you in src directory. You can run the tests of this contract by executing: cargo odra test This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM: cargo odra test -b casper Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during the installation process, feel free to ask for help on our Discord. ","version":"0.8.1","tagName":"h2"},{"title":"What's next?​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#whats-next","content":"If you want to see the code that you just tested, continue to the description of Flipper example. ","version":"0.8.1","tagName":"h2"},{"title":"Flipper example","type":0,"sectionRef":"#","url":"/docs/0.8.1/getting-started/flipper","content":"","keywords":"","version":"0.8.1"},{"title":"Let's flip​","type":1,"pageTitle":"Flipper example","url":"/docs/0.8.1/getting-started/flipper#lets-flip","content":"flipper.rs use odra::Var; /// A module definition. Each module struct consists Vars and Mappings /// or/and another modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor, must be named `init`. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } /// Retrieves value from the storage. /// If the value has never been set, the default value is returned. pub fn get(&self) -> bool { self.value.get_or_default() } } #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } #[test] fn test_two_flippers() { let env = odra_test::env(); let mut contract1 = FlipperHostRef::deploy(&env, NoArgs); let contract2 = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract1.get()); assert!(!contract2.get()); contract1.flip(); assert!(contract1.get()); assert!(!contract2.get()); } } ","version":"0.8.1","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Flipper example","url":"/docs/0.8.1/getting-started/flipper#testing","content":"To run the tests, execute the following command: cargo odra test # or add the `-b casper` flag to run tests on the CasperVM ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper example","url":"/docs/0.8.1/getting-started/flipper#whats-next","content":"In the next category of articles, we will go through basic concepts of Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Access Control","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/access-control","content":"","keywords":"","version":"0.8.1"},{"title":"Code​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#code","content":"Before we start writing code, we list the functionalities of our access control layer. A Role type is used across the module.A Role can be assigned to many Addresses.Each Role may have a corresponding admin role.Only an admin can grant/revoke a Role.A Role can be renounced.A Role cannot be renounced on someone's behalf.Each action triggers an event.Unauthorized access stops contract execution. ","version":"0.8.1","tagName":"h2"},{"title":"Project Structure​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#project-structure","content":"access-control ├── src │ ├── access │ │ ├── access_control.rs │ │ ├── events.rs │ │ └── errors.rs │ └── lib.rs |── build.rs |── Cargo.toml └── Odra.toml ","version":"0.8.1","tagName":"h3"},{"title":"Events and Errors​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#events-and-errors","content":"There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions. events.rs use odra::prelude::*; use odra::{Address, Event}; use super::access_control::Role; #[derive(Event, PartialEq, Eq, Debug)] pub struct RoleGranted { pub role: Role, pub address: Address, pub sender: Address } #[derive(Event, PartialEq, Eq, Debug)] pub struct RoleRevoked { pub role: Role, pub address: Address, pub sender: Address } #[derive(Event, PartialEq, Eq, Debug)] pub struct RoleAdminChanged { pub role: Role, pub previous_admin_role: Role, pub new_admin_role: Role } L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role. errors.rs use odra::OdraError; #[derive(OdraError)] pub enum Error { MissingRole = 20_000, RoleRenounceForAnotherAddress = 20_001, } Errors definition is straightforward - there are only two invalid states: An action is triggered by an unauthorized actor.The caller is attempting to resign the Role on someone's behalf. ","version":"0.8.1","tagName":"h3"},{"title":"Module​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#module","content":"Now, we are stepping into the most interesting part: the module definition and implementation. access_control.rs use super::events::*; use super::errors::Error; use odra::prelude::*; use odra::{module::Module, Address, Mapping}; pub type Role = [u8; 32]; pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32]; #[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])] pub struct AccessControl { roles: Mapping<(Role, Address), bool>, role_admin: Mapping<Role, Role> } #[odra::module] impl AccessControl { pub fn has_role(&self, role: &Role, address: &Address) -> bool { self.roles.get_or_default(&(*role, *address)) } pub fn get_role_admin(&self, role: &Role) -> Role { let admin_role = self.role_admin.get(role); if let Some(admin) = admin_role { admin } else { DEFAULT_ADMIN_ROLE } } pub fn grant_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_grant_role(role, address); } pub fn revoke_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_revoke_role(role, address); } pub fn renounce_role(&mut self, role: &Role, address: &Address) { if address != &self.env().caller() { self.env().revert(Error::RoleRenounceForAnotherAddress); } self.unchecked_revoke_role(role, address); } } impl AccessControl { pub fn check_role(&self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.env().revert(Error::MissingRole); } } pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) { let previous_admin_role = self.get_role_admin(role); self.role_admin.set(role, *admin_role); self.env().emit_event(RoleAdminChanged { role: *role, previous_admin_role, new_admin_role: *admin_role }); } pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.roles.set(&(*role, *address), true); self.env().emit_event(RoleGranted { role: *role, address: *address, sender: self.env().caller() }); } } pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) { if self.has_role(role, address) { self.roles.set(&(*role, *address), false); self.env().emit_event(RoleRevoked { role: *role, address: *address, sender: self.env().caller() }); } } } L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.L8 - The default role is an array filled with zeros.L10-L13 - The storage consists of two mappings: roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.role_admin - each Role can have a single admin Role. L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.L49 - This is a non-exported block containing helper functions.L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access. ","version":"0.8.1","tagName":"h3"},{"title":"Using odra-modules","type":0,"sectionRef":"#","url":"/docs/0.8.1/examples/using-odra-modules","content":"","keywords":"","version":"0.8.1"},{"title":"Available modules​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#available-modules","content":"Odra modules comes with couple of ready-to-use modules and reusable extensions. ","version":"0.8.1","tagName":"h2"},{"title":"Tokens​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#tokens","content":"Erc20​ The Erc20 module implements the ERC20 standard. Erc721​ The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework. The Erc721Token module implements the ERC721Base and additionally uses the Erc721Metadata and Ownable extensions. The Erc721Receiver trait lets you implement your own logic for receiving NFTs. The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules. Erc1155​ The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework. The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension. The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules. Wrapped native token​ The WrappedNativeToken module implements the Wrapper for the native token, it was inspired by the WETH. ","version":"0.8.1","tagName":"h3"},{"title":"Access​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#access","content":"AccessControl​ This module enables the implementation of role-based access control mechanisms for children modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API. Ownable​ This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner. The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using thetransfer_ownership() function. Ownable2Step​ An extension of the Ownable module. Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions. ","version":"0.8.1","tagName":"h3"},{"title":"Security​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#security","content":"Pausable​ A module allowing to implement an emergency stop mechanism that can be triggered by any account. ","version":"0.8.1","tagName":"h3"},{"title":"ERC-20","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/erc20","content":"","keywords":"","version":"0.8.1"},{"title":"Ownable","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/ownable","content":"","keywords":"","version":"0.8.1"},{"title":"Framework features​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: storing a single value,defining a constructor,error handling,defining and emitting events.registering a contact in a test environment,interactions with the test environment,assertions (value, events, errors assertions). ","version":"0.8.1","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#code","content":"Before we write any code, we define functionalities we would like to implement. Module has an initializer that should be called once. Only the current owner can set a new owner.Read the current owner.A function that fails if called by a non-owner account. ","version":"0.8.1","tagName":"h2"},{"title":"Define a module​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#define-a-module","content":"ownable.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module(events = [OwnershipChanged])] pub struct Ownable { owner: Var<Option<Address>> } That was easy, but it is crucial to understand the basics before we move on. L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var. ","version":"0.8.1","tagName":"h3"},{"title":"Init the module​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#init-the-module","content":"ownable.rs ... use odra::{Event, OdraError}; ... #[odra::module] impl Ownable { pub fn init(&mut self, owner: Address) { if self.owner.get_or_default().is_some() { self.env().revert(Error::OwnerIsAlreadyInitialized) } self.owner.set(Some(owner)); self.env().emit_event(OwnershipChanged { prev_owner: None, new_owner: owner }); } } #[derive(OdraError)] pub enum Error { OwnerIsAlreadyInitialized = 1, } #[derive(Event, Debug, PartialEq, Eq)] pub struct OwnershipChanged { pub prev_owner: Option<Address>, pub new_owner: Address } Ok, we have done a couple of things, let's analyze them one by one: L7 - The impl should be an Odra module, so add #[odra::module].L9 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.L23-26 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the OdraError derive macro is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.L10-L12 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument. L14 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.L28-L32 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.L16 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None. ","version":"0.8.1","tagName":"h3"},{"title":"Features implementation​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#features-implementation","content":"ownable.rs #[odra::module] impl Ownable { ... pub fn ensure_ownership(&self, address: &Address) { if Some(address) != self.owner.get_or_default().as_ref() { self.env().revert(Error::NotOwner) } } pub fn change_ownership(&mut self, new_owner: &Address) { self.ensure_ownership(&self.env().caller()); let current_owner = self.get_owner(); self.owner.set(Some(*new_owner)); self.env().emit_event(OwnershipChanged { prev_owner: Some(current_owner), new_owner: *new_owner }); } pub fn get_owner(&self) -> Address { match self.owner.get_or_default() { Some(owner) => owner, None => self.env().revert(Error::OwnerIsNotInitialized) } } } #[derive(OdraError)] pub enum Error { NotOwner = 1, OwnerIsAlreadyInitialized = 2, OwnerIsNotInitialized = 3, } The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along. L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead. ","version":"0.8.1","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#test","content":"ownable.rs #[cfg(test)] mod tests { use super::*; use odra::host::{Deployer, HostEnv, HostRef}; fn setup() -> (OwnableHostRef, HostEnv, Address) { let env: HostEnv = odra_test::env(); let init_args = OwnableInitArgs { owner: env.get_account(0) }; (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0)) } #[test] fn initialization_works() { let (ownable, env, owner) = setup(); assert_eq!(ownable.get_owner(), owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: None, new_owner: owner } ); } #[test] fn owner_can_change_ownership() { let (mut ownable, env, owner) = setup(); let new_owner = env.get_account(1); env.set_caller(owner); ownable.change_ownership(&new_owner); assert_eq!(ownable.get_owner(), new_owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: Some(owner), new_owner } ); } #[test] fn non_owner_cannot_change_ownership() { let (mut ownable, env, _) = setup(); let new_owner = env.get_account(1); ownable.change_ownership(&new_owner); assert_eq!( ownable.try_change_ownership(&new_owner), Err(Error::NotOwner.into()) ); } } L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one). L14 - It is time to define the first test. As you see, it is a regular Rust test.L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract. note You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract. L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function. note The caller switch applies only the next contract interaction, the second call will be done as the default account. L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type. ","version":"0.8.1","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#summary","content":"The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#whats-next","content":"In the next tutorial we will implement a ERC20 standard. ","version":"0.8.1","tagName":"h2"},{"title":"Framework features​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: Advanced storage using key-value pairs,Odra types such as Address,Advanced event assertion. ","version":"0.8.1","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#code","content":"Our module features a considerably more complex storage layout compared to the previous example. It is designed to store the following data: Immutable metadata - name, symbol, and decimals.Total supply.Balances of individual users.Allowances, essentially indicating who is permitted to spend tokens on behalf of another user. ","version":"0.8.1","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#module-definition","content":"erc20.rs use odra::prelude::*; use odra::{Address, casper_types::U256, Mapping, Var}; #[odra::module(events = [Transfer, Approval])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys. ","version":"0.8.1","tagName":"h2"},{"title":"Metadata​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#metadata","content":"erc20.rs ... use odra::Event; ... #[odra::module] impl Erc20 { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let caller = self.env().caller(); self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.mint(&caller, &initial_supply); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn symbol(&self) -> String { self.symbol.get_or_default() } pub fn decimals(&self) -> u8 { self.decimals.get_or_default() } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } } impl Erc20 { pub fn mint(&mut self, address: &Address, amount: &U256) { self.balances.add(address, *amount); self.total_supply.add(*amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } } #[derive(Event, PartialEq, Eq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } L6 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.L8-L14 - A constructor sets the token metadata and mints the initial supply.L33 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.L34-L43 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for: use odra::UnwrapOrRevert; let current_balance = self.balances.get(address).unwrap_or_default(); let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env()); self.balances.set(address, new_balance); ","version":"0.8.1","tagName":"h3"},{"title":"Core​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#core","content":"To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks. erc20.rs ... use odra::OdraError; #[odra::module] impl Erc20 { ... pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn balance_of(&self, address: &Address) -> U256 { self.balances.get_or_default(&address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } } impl Erc20 { ... fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let owner_balance = self.balances.get_or_default(&owner); if *amount > owner_balance { self.env().revert(Error::InsufficientBalance) } self.balances.set(owner, owner_balance - *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowance(owner, spender); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } let new_allowance = allowance - *amount; self.allowances .set(&(*owner, *spender), new_allowance); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } #[derive(Event, PartialEq, Eq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } #[derive(OdraError)] pub enum Error { InsufficientBalance = 1, InsufficientAllowance = 2, } Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation? ","version":"0.8.1","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#test","content":"erc20.rs #[cfg(test)] pub mod tests { use super::*; use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}}; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: INITIAL_SUPPLY.into() } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } #[test] fn transfer_from_and_approval_work() { let (env, mut erc20) = setup(); let (owner, recipient, spender) = (env.get_account(0), env.get_account(1), env.get_account(2)); let approved_amount = 3_000.into(); let transfer_amount = 1_000.into(); assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY)); // Owner approves Spender. erc20.approve(&spender, &approved_amount); // Allowance was recorded. assert_eq!(erc20.allowance(&owner, &spender), approved_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount } )); // Spender transfers tokens from Owner to Recipient. env.set_caller(spender); erc20.transfer_from(&owner, &recipient, &transfer_amount); // Tokens are transferred and allowance decremented. assert_eq!( erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY) - transfer_amount ); assert_eq!(erc20.balance_of(&recipient), transfer_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); // assert!(env.emitted(erc20.address(), "Transfer")); } #[test] fn transfer_from_error() { // Given a new instance. let (env, mut erc20) = setup(); // When the spender's allowance is zero. let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); // Then transfer fails. assert_eq!( erc20.try_transfer_from(&owner, &recipient, &amount), Err(Error::InsufficientAllowance.into()) ); } } L146 - Alternatively, if you don't want to check the entire event, you may assert only its type. ","version":"0.8.1","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#whats-next","content":"Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids. ","version":"0.8.1","tagName":"h2"},{"title":"Build, Deploy and Read the State of a Contract","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/build-deploy-read","content":"","keywords":"","version":"0.8.1"},{"title":"Contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#contract","content":"Let's write a contract with complex storage layout. The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping. We will expose two methods: The constructor init which sets the metadata and the version of the contract.The method set_data which sets the value of the numeric field and the values of the mapping. custom_item.rs use odra::{casper_types::U256, prelude::*, Mapping, OdraType, SubModule, Var}; // A custom type with a vector of another custom type #[derive(OdraType, Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(OdraType, Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } // The main contract with a version, metadata and a submodule #[odra::module] pub struct CustomItem { version: Var<u32>, meta: Var<Metadata>, data: SubModule<Data> } #[odra::module] impl CustomItem { pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) { let meta = Metadata { name, description, prices: vec![ Price { value: price_1 }, Price { value: price_2 } ] }; self.meta.set(meta); self.version.set(self.version.get_or_default() + 1); } pub fn set_data(&mut self, value: u32, name: String, name2: String) { self.data.value.set(value); self.data.inner.named_values.set(&name, 10); self.data.inner.named_values.set(&name2, 20); } } // A submodule with a numeric value and another submodule #[odra::module] struct Data { value: Var<u32>, inner: SubModule<InnerData>, } // A submodule with a mapping #[odra::module] struct InnerData { named_values: Mapping<String, u32>, } ","version":"0.8.1","tagName":"h3"},{"title":"Deploying the contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#deploying-the-contract","content":"First, we need to setup the chain. We will use the NCTL docker image to run a local network. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Next, we need to compile the contract to a Wasm file. cargo odra build -c custom_item Then, we can deploy the contract using the casper-client tool. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key path/to/your/secret_key.pem \\ --session-path [PATH_TO_WASM] \\ --payment-amount 100000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ --session-arg "name:string='My Name'" \\ --session-arg "description:string='My Description'" \\ --session-arg "price_1:u256='101'" \\ --session-arg "price_2:u256='202'" Finally, we can call the set_data method to set the values of the contract. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key ./keys/secret_key.pem \\ --payment-amount 2000000000 \\ --session-hash [DEPLOYED_CONTRACT_HASH] \\ --session-entry-point "set_data" \\ --session-arg "value:u32:'666'" \\ --session-arg "name:string='alice'" \\ --session-arg "name2:string='bob'" ","version":"0.8.1","tagName":"h3"},{"title":"Storage Layout​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#storage-layout","content":"To read the state of the contract, we need to understand the storage layout. The first step is to calculate the index of the keys. Storage Layout CustomItem: prefix: 0x0..._0000_0000_0000 0 version: u32, 0x0..._0000_0000_0000 0 meta: Metadata, 0x0..._0000_0000_0001 1 data: Data: prefix: 0x0..._0000_0010_0000 (2 << 4) value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0 inner: InnerData: prefix: 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0 The actual key is obtained as follows: Convert the index to a big-endian byte array.Concatenate the index with the mapping data.Hash the concatenated bytes using blake2b.Return the hex representation of the hash (the stored key must be utf-8 encoded). In more detail, the storage layout is described in the Storage Layout article. ","version":"0.8.1","tagName":"h3"},{"title":"Reading the state​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#reading-the-state","content":"RustTypeScript main.rs use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity}; use casper_types::{ bytesrepr::{FromBytes, ToBytes}, U256, }; // replace with your contract hash const CONTRACT_HASH: &str = "hash-..."; const NODE_ADDRESS: &str = "http://localhost:11101/rpc"; const RPC_ID: &str = "casper-net-1"; const DICTIONARY_NAME: &str = "state"; #[derive(Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } async fn read_state_key(key: String) -> Vec<u8> { let state_root_hash = casper_client::get_state_root_hash( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, None, ) .await .unwrap() .result .state_root_hash .unwrap(); // Read the value from the `state` dictionary. let result = casper_client::get_dictionary_item( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, state_root_hash, DictionaryItemIdentifier::ContractNamedKey { key: CONTRACT_HASH.to_string(), dictionary_name: DICTIONARY_NAME.to_string(), dictionary_item_key: key, }, ) .await .unwrap() .result .stored_value; // We expect the value to be a CLValue if let StoredValue::CLValue(cl_value) = result { // Ignore the first 4 bytes, which are the length of the CLType. cl_value.inner_bytes()[4..].to_vec() } else { vec![] } } async fn metadata() -> Metadata { // The key for the metadata is 1, and it has no mapping data let key = key(1, &[]); let bytes = read_state_key(key).await; // Read the name and store the remaining bytes let (name, bytes) = String::from_bytes(&bytes).unwrap(); // Read the description and store the remaining bytes let (description, bytes) = String::from_bytes(&bytes).unwrap(); // A vector is stored as a u32 size followed by the elements // Read the size of the vector and store the remaining bytes let (size, mut bytes) = u32::from_bytes(&bytes).unwrap(); let mut prices = vec![]; // As we know the size of the vector, we can loop over it for _ in 0..size { // Read the value and store the remaining bytes let (value, rem) = U256::from_bytes(&bytes).unwrap(); bytes = rem; prices.push(Price { value }); } // Anytime you finish parsing a value, you should check if there are any remaining bytes // if there are, it means you have a bug in your parsing logic. // For simplicity, we will ignore the remaining bytes here. Metadata { name, description, prices } } async fn value() -> u32 { // The key for the value is (2 << 4) + 0, and it has no mapping data let key = key(2 << 4, &[]); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } async fn named_value(name: &str) -> u32 { // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes let mapping_data = name.to_bytes().unwrap(); let key = key(((2 << 4) + 1) << 4, &mapping_data); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } fn main() { let runtime = tokio::runtime::Runtime::new().unwrap(); dbg!(runtime.block_on(metadata())); dbg!(runtime.block_on(value())); dbg!(runtime.block_on(named_value("alice"))); dbg!(runtime.block_on(named_value("bob"))); } // The key is a combination of the index and the mapping data // The algorithm is as follows: // 1. Convert the index to a big-endian byte array // 2. Concatenate the index with the mapping data // 3. Hash the concatenated bytes using blake2b // 4. Return the hex representation of the hash (the stored key must be utf-8 encoded) fn key(idx: u32, mapping_data: &[u8]) -> String { let mut key = Vec::new(); key.extend_from_slice(idx.to_be_bytes().as_ref()); key.extend_from_slice(mapping_data); let hashed_key = blake2b(&key); hex::encode(&hashed_key) } fn blake2b(bytes: &[u8]) -> [u8; 32] { let mut result = [0u8; 32]; let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32) .expect("should create hasher"); let _ = std::io::Write::write(&mut hasher, bytes); blake2::digest::VariableOutput::finalize_variable(hasher, &mut result) .expect("should copy hash to the result array"); result } cargo run [src/main.rs:116:5] runtime.block_on(metadata()) = Metadata { name: "My Contract", description: "My Description", prices: [ Price { value: 123, }, Price { value: 321, }, ], } [src/main.rs:117:5] runtime.block_on(value()) = 666 [src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20 [src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10 ","version":"0.8.1","tagName":"h3"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.9.0/","content":"","keywords":"","version":"0.9.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.9.0/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.9.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.9.1/","content":"","keywords":"","version":"0.9.1"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.9.1/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.9.1","tagName":"h2"},{"title":"Pausable","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/pauseable","content":"","keywords":"","version":"0.8.1"},{"title":"Code​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#code","content":"As always, we will start with defining functionalities of our module. Check the state - is it paused or not.State guards - a contract should stop execution if is in a state we don't expect.Switch the state. ","version":"0.8.1","tagName":"h2"},{"title":"Events and Error​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#events-and-error","content":"There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way. Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser. pauseable.rs use odra::prelude::*; use odra::{Address, Event, OdraError}; #[derive(OdraError)] pub enum Error { PausedRequired = 1_000, UnpausedRequired = 1_001, } #[derive(Event, PartialEq, Eq, Debug)] pub struct Paused { pub account: Address } #[derive(Event, PartialEq, Eq, Debug)] pub struct Unpaused { pub account: Address } ","version":"0.8.1","tagName":"h3"},{"title":"Module definition​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#module-definition","content":"The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused. pauseable.rs use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] pub struct Pausable { is_paused: Var<bool> } ","version":"0.8.1","tagName":"h3"},{"title":"Checks and guards​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#checks-and-guards","content":"Now, let's move to state checks and guards. pauseable.rs impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } pub fn require_not_paused(&self) { if self.is_paused() { self.env().revert(Error::UnpausedRequired); } } pub fn require_paused(&self) { if !self.is_paused() { self.env().revert(Error::PausedRequired); } } } L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused. L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused. ","version":"0.8.1","tagName":"h3"},{"title":"Actions​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#actions","content":"Finally, we will add the ability to switch the module state. pauseable.rs impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); self.env().emit_event(Paused { account: self.env().caller() }); } pub fn unpause(&mut self) { self.require_paused(); self.is_paused.set(false); self.env().emit_event(Unpaused { account: self.env().caller() }); } } pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused). ","version":"0.8.1","tagName":"h3"},{"title":"Pausable counter​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#pausable-counter","content":"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused). pauseable.rs ... use odra::SubModule; ... #[odra::module] pub struct PausableCounter { value: Var<u32>, pauseable: SubModule<Pausable> } #[odra::module] impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); let new_value = self.value.get_or_default() + 1; self.value.set(new_value); } pub fn pause(&mut self) { self.pauseable.pause(); } pub fn unpause(&mut self) { self.pauseable.unpause(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } #[cfg(test)] mod test { use super::*; use odra::host::{Deployer, NoArgs}; #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); assert_eq!( contract.try_increment().unwrap_err(), Error::UnpausedRequired.into() ); assert_eq!(contract.get_value(), 1); } } As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy! ","version":"0.8.1","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/next/","content":"","keywords":"","version":"next"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/next/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"next","tagName":"h2"},{"title":"Advanced Storage Concepts","type":0,"sectionRef":"#","url":"/docs/next/advanced/advanced-storage","content":"","keywords":"","version":"next"},{"title":"Recap and Basic Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#recap-and-basic-concepts","content":"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values. Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract. Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key. List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over. If you need a refresher on these topics, please refer to our guide on basic storage in Odra. ","version":"next","tagName":"h2"},{"title":"Advanced Storage Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#advanced-storage-concepts-1","content":"","version":"next","tagName":"h2"},{"title":"Sequence​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#sequence","content":"The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value. pub struct Sequence<T> where T: Num + One + ToBytes + FromBytes + CLTyped { value: Var<T> } The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively. ","version":"next","tagName":"h3"},{"title":"Advanced Mapping​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#advanced-mapping","content":"In Odra, a Mapping is a key-value storage system where the key is associated with a value. In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute. However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state. Let's consider the following example: examples/src/features/storage/mapping.rs use odra::{casper_types::U256, Mapping, UnwrapOrRevert}; use odra::prelude::*; use crate::owned_token::OwnedToken; #[odra::module] pub struct Mappings { strings: Mapping<(String, u32, String), String>, tokens: Mapping<String, OwnedToken> } #[odra::module] impl Mappings { ... pub fn total_supply(&mut self, token_name: String) -> U256 { self.tokens.module(&token_name).total_supply() } pub fn get_string_api( &self, key1: String, key2: u32, key3: String ) -> String { let opt_string = self.strings.get(&(key1, key2, key3)); opt_string.unwrap_or_revert(&self.env()) } } As you can see, a Mapping key can consist of a tuple of values, not limited to a single value. note Accessing Odra modules differs from accessing regular values such as strings or numbers. Firstly, within a Mapping, you don't encapsulate the module with Submodule. Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules. ","version":"next","tagName":"h3"},{"title":"AdvancedStorage Contract​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#advancedstorage-contract","content":"The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts. use odra::{Address, casper_types::U512, Sequence, Mapping}; use odra::prelude::*; use crate::modules::Token; #[odra::module] pub struct AdvancedStorage { counter: Sequence<u32>, tokens: Mapping<(String, String), Token>, } impl AdvancedStorage { pub fn current_value(&self) -> u32 { self.counter.get_current_value() } pub fn increment_and_get(&mut self) -> u32 { self.counter.next_value() } pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 { let token = self.tokens.module(&(token_name, creator)); token.balance_of(&address) } pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) { let mut token = self.tokens.module(&(token_name, creator)); token.mint(amount, to); } } ","version":"next","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#conclusion","content":"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are: Odra offers a Sequence module, enabling contracts to store and increment a single value.Mappings support composite keys expressed as tuples and can store modules as values. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts. ","version":"next","tagName":"h2"},{"title":"Attributes","type":0,"sectionRef":"#","url":"/docs/next/advanced/attributes","content":"","keywords":"","version":"next"},{"title":"Payable​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#payable","content":"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens. ","version":"next","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#example","content":"examples/src/contracts/tlw.rs #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U256 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env.revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env() .emit_event(Deposit { address: caller, amount }); } If you try to send tokens to a non-payable function, the transaction will be automatically rejected. ","version":"next","tagName":"h3"},{"title":"Non Reentrant​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#non-reentrant","content":"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. They can also use reentrancy guards to block recursive calls to sensitive functions. In Odra you can just apply the #[odra(non_reentrant)] attribute to your function. ","version":"next","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#example-1","content":"#[odra::module] pub struct NonReentrantCounter { counter: Var<u32> } #[odra::module] impl NonReentrantCounter { #[odra(non_reentrant)] pub fn count_ref_recursive(&mut self, n: u32) { if n > 0 { self.count(); ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1); } } } impl NonReentrantCounter { fn count(&mut self) { let c = self.counter.get_or_default(); self.counter.set(c + 1); } } #[cfg(test)] mod test { use super::*; use odra::{host::{Deployer, NoArgs}, ExecutionError}; #[test] fn ref_recursion_not_allowed() { let test_env = odra_test::env(); let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs); let result = contract.count_ref_recursive(11); assert_eq!(result, ExecutionError::ReentrantCall.into()); } } ","version":"next","tagName":"h3"},{"title":"Mixing attributes​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#mixing-attributes","content":"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. To apply multiple attributes, you can write: #[odra(payable, non_reentrant)] fn deposit() { // your logic... } or #[odra(payable)] #[odra(non_reentrant)] fn deposit() { // your logic... } In both cases attributes order does not matter. ","version":"next","tagName":"h2"},{"title":"Building contracts manually","type":0,"sectionRef":"#","url":"/docs/next/advanced/building-manually","content":"","keywords":"","version":"next"},{"title":"Building the contract manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#building-the-contract-manually","content":"To build the contract manually, cargo odra uses the following command: ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract info Odra uses the environment variable ODRA_MODULE to determine which contract to build. Assuming that project's crate is named my_project, this command will build the my_contract contract in release mode and generate the wasm file. The file will be put into the target/wasm32-unknown-unknown/release directory under the name my_project_build_contract.wasm. The Odra Framework expects the contracts to be placed in the wasm directory, and to be named correctly, so the next step would be to move the file: mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm ","version":"next","tagName":"h2"},{"title":"Optimizing the contract​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#optimizing-the-contract","content":"To lower the size of the wasm file, cargo odra uses the wasm-strip tool: wasm-strip wasm/my_contract.wasm To further optimize the wasm file, the wasm-opt tool is also used. wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm danger This step is required, as the wasm file generated by the Rust compiler is not fully compatible with the Casper execution engine. ","version":"next","tagName":"h2"},{"title":"Running the tests manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#running-the-tests-manually","content":"To run the tests manually, Odra needs to know which backend to use. To run tests against Casper backend, the following command needs to be used: ODRA_BACKEND=casper cargo test ","version":"next","tagName":"h2"},{"title":"Wrapping up​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#wrapping-up","content":"Let's say we want to build the my_contract in debug mode, run the tests against the casper backend and use the my-own-allocator feature from our my_project project. To do that, we can use the following set of commands: ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm wasm-strip wasm/my_contract.wasm wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm ODRA_BACKEND=casper cargo test --features my-own-allocator ","version":"next","tagName":"h2"},{"title":"OwnedToken","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/owned-token","content":"","keywords":"","version":"0.8.1"},{"title":"Code​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#code","content":"What should our module be capable of? Conform the Erc20 interface.Allow only the module owner to mint tokens.Enable the current owner to designate a new owner. ","version":"0.8.1","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#module-definition","content":"Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules. owned_token.rs use crate::{erc20::Erc20, ownable::Ownable}; use odra::prelude::*; use odra::module::SubModule; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } As you can see, we do not need any storage definition - we just take advantage of the already-defined modules! ","version":"0.8.1","tagName":"h3"},{"title":"Delegation​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#delegation","content":"owned_token.rs ... use odra::{Address, casper_types::U256}; ... #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } pub fn name(&self) -> String { self.erc20.name() } pub fn symbol(&self) -> String { self.erc20.symbol() } pub fn decimals(&self) -> u8 { self.erc20.decimals() } pub fn total_supply(&self) -> U256 { self.erc20.total_supply() } pub fn balance_of(&self, address: &Address) -> U256 { self.erc20.balance_of(address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.erc20.allowance(owner, spender) } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.erc20.transfer(recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { self.erc20.transfer_from(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { self.erc20.approve(spender, amount); } pub fn get_owner(&self) -> Address { self.ownable.get_owner() } pub fn change_ownership(&mut self, new_owner: &Address) { self.ownable.change_ownership(new_owner); } pub fn mint(&mut self, address: &Address, amount: &U256) { self.ownable.ensure_ownership(&self.env().caller()); self.erc20.mint(address, amount); } } Easy. However, there are a few worth mentioning subtleness: L9-L10 - A constructor is an excellent place to initialize both modules at once.L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.L49-L51 - The same is done with the ownable module.L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner. ","version":"0.8.1","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#summary","content":"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that. ","version":"0.8.1","tagName":"h2"},{"title":"Memory allocators","type":0,"sectionRef":"#","url":"/docs/next/advanced/using-different-allocator","content":"","keywords":"","version":"next"},{"title":"Using a different allocator​","type":1,"pageTitle":"Memory allocators","url":"/docs/next/advanced/using-different-allocator#using-a-different-allocator","content":"If the default allocator does not suit your needs, or you use a crate that already provides an allocator, you can disable the default allocator by enabling the disable-allocator feature in the odra dependency in your project: [dependencies] odra = { path = "../odra", features = ["disable-allocator"] } If you want to have a better control over the features that are enabled during the building and tests, see the next article on building manually. ","version":"next","tagName":"h2"},{"title":"Storage Layout","type":0,"sectionRef":"#","url":"/docs/next/advanced/storage-layout","content":"","keywords":"","version":"next"},{"title":"Casper VM Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#casper-vm-perspective","content":"The Casper Execution Engine (VM) enables the storage of data in named keys or dictionaries. However, a smart contract has a limited number of named keys, making it unsuitable for storing substantial data volumes. Odra resolves this issue by storing all user-generated data in a dictionary called state. This dictionary operates as a key-value store, where keys are strings with a maximum length of 64 characters, and values are arbitrary byte arrays. Here is an example of what the interface for reading and writing data could look like: pub trait CasperStorage { fn read(key: &str) -> Option<Vec<u8>>; fn write(key: &str, value: Vec<u8>); } ","version":"next","tagName":"h2"},{"title":"Odra Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#odra-perspective","content":"Odra was conceived with modularity and code reusability in mind. Additionally, we aimed to streamline storage definition through the struct object. Consider this straightforward storage definition: #[odra::module] pub struct Token { name: Var<String>, balances: Mapping<Address, U256> } The Token structure contains two fields: name of type String andbalances, which functions as a key-value store with Address as keys andU256 as values. The Token module can be reused in another module, as demonstrated in a more complex example: #[odra::module] pub struct Loans { lenders: SubModule<Token>, borrowers: SubModule<Token>, } The Loans module has two fields: lenders and borrowers, both of which have the same storage layout as defined by the Token module. Odra guarantees thatlenders and borrowers are stored under distinct keys within the storage dictionary. Both Token and Loans serve as examples to show how Odra's storage layout operates. ","version":"next","tagName":"h2"},{"title":"Key generation.​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#key-generation","content":"Every element of a module (struct) with N elements is associated with an index ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an element of a module is another module (SubModule<...>), the associated index serves as a prefix for the indexes of the inner module. While this may initially appear complex, it is easily understood through an example. In the example, indexes are presented as bytes, reflecting the actual implementation. Loans { lenders: Token { // prefix: 0x0001 name: 1, // key: 0x0001_0001 balances: 2 // key: 0x0001_0010 }, borrowers: Token { // prefix: 0x0010 name: 1, // key: 0x0010_0001 balances: 2 // key: 0x0010_0010 } } Additionally, it's worth mentioning how Mapping's keys are used in thestorage. They are simply concatenated with the index of the module, as demonstrated in the example. For instance, triggering borrowers.balances.get(0x1234abcd) would result in a key: 0x0001_0001_1234_abcd Finally, the key must be hashed to fit within the 64-character limit and then encoded in hexadecimal format. ","version":"next","tagName":"h2"},{"title":"Value serialization​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#value-serialization","content":"Before being stored in the storage, each value is serialized into bytes using the CLType serialization method and subsequently encapsulated with Casper'sBytes types. ","version":"next","tagName":"h2"},{"title":"Delegate","type":0,"sectionRef":"#","url":"/docs/next/advanced/delegate","content":"","keywords":"","version":"next"},{"title":"Overview​","type":1,"pageTitle":"Delegate","url":"/docs/next/advanced/delegate#overview","content":"To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand. You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself. ","version":"next","tagName":"h2"},{"title":"Code Examples​","type":1,"pageTitle":"Delegate","url":"/docs/next/advanced/delegate#code-examples","content":"Consider the following basic example for better understanding: use crate::{erc20::Erc20, ownable::Ownable}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256); fn approve(&mut self, spender: Address, amount: U256); fn name(&self) -> String; fn symbol(&self) -> String; fn decimals(&self) -> u8; fn total_supply(&self) -> U256; fn balance_of(&self, owner: Address) -> U256; fn allowance(&self, owner: Address, spender: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; fn change_ownership(&mut self, new_owner: Address); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality. The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities. Let's take a look at another example. use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct DeFiPlatform { ownable: SubModule<Ownable>, erc20: SubModule<Erc20>, exchange: SubModule<Exchange> } #[odra::module] impl DeFiPlatform { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); self.exchange.init(exchange_rate); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn balance_of(&self, owner: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; } to self.exchange { fn swap(&mut self, sender: Address, recipient: Address); fn set_exchange_rate(&mut self, new_rate: u64); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure. Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts. ","version":"next","tagName":"h2"},{"title":"Migration guide to v0.8.0","type":0,"sectionRef":"#","url":"/docs/0.8.1/migrations/to-0.8.0","content":"","keywords":"","version":"0.8.1"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#1-prerequisites","content":"","version":"0.8.1","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"0.8.1","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0. ","version":"0.8.1","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#2-migration-steps","content":"","version":"0.8.1","tagName":"h2"},{"title":"2.1 Add bin directory​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#21-add-bin-directory","content":"Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory. You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"0.8.1","tagName":"h3"},{"title":"2.2. Update Cargo.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#22-update-cargotoml","content":"There a bunch of changes in the Cargo.toml file. You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.Register bins you added in the previous step.Add dev-dependencies section with odra-test crate.Add recommended profiles for release and dev to optimize the build process. Below you can compare the Cargo.toml file after and before the migration to v0.8.0: 0.8.0Prev [package] name = "my_project" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.0" [dev-dependencies] odra-test = "0.8.0" [[bin]] name = "my_project_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "my_project_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 ","version":"0.8.1","tagName":"h3"},{"title":"2.2. Update Odra.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#22-update-odratoml","content":"Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required. 0.8.0Prev [[contracts]] fqn = "my_project::Flipper" ","version":"0.8.1","tagName":"h3"},{"title":"2.3. Update Smart Contracts​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#23-update-smart-contracts","content":"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make: 2.3.1. Update the use statements to reflect the new module structure.​ Big integer types are now located in the odra::casper_types module.odra::types::Address is now odra::Address.Variable is now Var.Remove odra::contract_env.Remove odra::types::event::OdraEvent.Remove odra::types::OdraType as it is no longer required.Change odra::types::casper_types::*; to odra::casper_types::*;. 2.3.2. Some type aliases are no longer in use.​ Balance - use odra::casper_types::U512.BlockTime - use u64.EventData - use odra::casper_types::bytesrepr::Bytes. 2.3.3. Consider import odra::prelude::* in your module files.​ 2.3.4. Flatten nested Mappings.​ // Before #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<Address, Mapping<Address, U256>> } // After #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<(Address, Address), U256> } 2.3.5. Update errors definitions.​ execution_error! macro has been replace with OdraError derive macro. 0.8.0Prev use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.3.6. Update events definitions.​ 0.8.0Prev use odra::prelude::*; use odra::Event; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } // Emitting the event self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); 2.3.7. Replace contract_env with self.env() in your modules.​ self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes. fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions. fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.functions native_token_metadata() and one_token() have been removed. 2.3.8. Wrap submodules of your module with odra::SubModule<T>.​ 0.8.0Prev #[odra::module(events = [Transfer])] pub struct Erc721Token { core: SubModule<Erc721Base>, metadata: SubModule<Erc721MetadataExtension>, ownable: SubModule<Ownable> } 2.3.9. Update external contract calls.​ However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()). 0.8.0Prev #[odra::external_contract] pub trait Token { fn balance_of(&self, owner: &Address) -> U256; } // Usage TokenContractRef::new(env, token).balance_of(account) 2.3.10. Update constructors.​ Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init. 2.3.11. Update UnwrapOrRevert calls.​ The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter. 2.3.12. Remove #[odra(using)] attribute from your module definition.​ Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required. ","version":"0.8.1","tagName":"h3"},{"title":"2.4. Update Tests​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#24-update-tests","content":"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make: 2.4.1. Contract deployment.​ The way you deploy a contract has changed: You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function. 0.8.0Prev // A contract without init args use super::OwnableHostRef; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; let env: HostEnv = odra_test::env(); let ownable = OwnableHostRef::deploy(&env, NoArgs) // A contract with init args use super::{Erc20HostRef, Erc20InitArgs}; use odra::host::{Deployer, HostEnv}; let env: HostEnv = odra_test::env(); let init_args = Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) }; let erc20 = Erc20HostRef::deploy(&env, init_args); 2.4.2. Host interactions.​ Replace odra::test_env with odra_test::env().The API of odra::test_env and odra_test::env() are similar, but there are some differences: test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).test_env::token_balance(Address) is now env.balance_of(&Address).functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef. 2.4.3. Testing failing scenarios.​ test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result.try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro. 0.8.0Prev #[test] fn transfer_from_error() { let (env, mut erc20) = setup(); let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); assert_eq!( erc20.try_transfer_from(owner, recipient, amount), Err(Error::InsufficientAllowance.into()) ); } 2.4.4. Testing events.​ assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options. 0.8.0Prev let env: HostEnv = odra_test::env(); let erc20 = Erc20HostRef::deploy(&env, init_args); ... assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); ","version":"0.8.1","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.8.0. 0.8.0Prev src/erc20.rs use crate::erc20::errors::Error::*; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address, Event}; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[derive(Event, Eq, PartialEq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { use super::{ errors::Error, events::{Approval, Transfer}, Erc20HostRef, Erc20InitArgs }; use odra::{ casper_types::U256, host::{Deployer, HostEnv, HostRef}, prelude::* }; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } // Other tests... } ","version":"0.8.1","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"0.8.1","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"0.8.1","tagName":"h2"},{"title":"OdraVM","type":0,"sectionRef":"#","url":"/docs/next/backends/odra-vm","content":"","keywords":"","version":"next"},{"title":"Usage​","type":1,"pageTitle":"OdraVM","url":"/docs/next/backends/odra-vm#usage","content":"The OdraVM is the default backend for Odra framework, so each time you run cargo odra test You are running your code against it. ","version":"next","tagName":"h2"},{"title":"Architecture​","type":1,"pageTitle":"OdraVM","url":"/docs/next/backends/odra-vm#architecture","content":"OdraVM consists of two main parts: the Contract Register and the State. The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address. Contracts and Test Env functions can modify the State of the OdraVM. Contrary to the "real" backend, which holds the whole history of the blockchain, the OdraVM State holds only the current state of the OdraVM. Thanks to this and the fact that we do not need the blockchain itself, OdraVM starts instantly and runs the tests in the native speed. ","version":"next","tagName":"h2"},{"title":"Execution​","type":1,"pageTitle":"OdraVM","url":"/docs/next/backends/odra-vm#execution","content":"When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting your pub functions into a list of Entrypoints, which are put into a Contract Container. When the contract is deployed, its Container registered into a Registry under an address. During the contract call, OdraVM finds an Entrypoint and executes the code. ","version":"next","tagName":"h2"},{"title":"Livenet","type":0,"sectionRef":"#","url":"/docs/next/backends/livenet","content":"","keywords":"","version":"next"},{"title":"Setup​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#setup","content":"To use Livenet backend, we need to provide Odra with some information - the network address, our private key and the name of the chain we want to use. Optionally, we can add multiple private keys to use more than one account in our tests. Those values are passed using environment variables. We can use .env file to store them - let's take a look at an example .env file, created from the .env.sample file from examples folder: # Path to the secret key of the account that will be used # to deploy the contracts. # We're using .keys folder so we don't accidentally commit # the secret key to the repository. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777 # Chain name of the network. Known values: # - integration-test ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test # Paths to the secret keys of the additional accounts. # Main secret key will be 0th account. ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem # If using CSPR.cloud, you can set the auth token here. # CSPR_CLOUD_AUTH_TOKEN= note CSPR.cloud is a service that provides mainnet and testnet Casper nodes on demand. With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. Let's go through the code: fn main() { // Similar to the OdraVM backend, we need to initialize // the environment: let env = odra_casper_livenet_env::env(); // Most of the for the host env works the same as in the // OdraVM backend. let owner = env.caller(); // Addresses are the real addresses on the blockchain, // so we need to provide them // if we did not import their secret keys. let recipient = "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"; let recipient = Address::from_str(recipient).unwrap(); // Arguments for the contract init method. let name = String::from("Plascoin"); let symbol = String::from("PLS"); let decimals = 10u8; let initial_supply: U256 = U256::from(10_000); // The main difference between other backends - we need to specify // the gas limit for each action. // The limit will be used for every consecutive action // until we change it. env.set_gas(100_000_000_000u64); // Deploy the contract. The API is the same as in the OdraVM backend. let init_args = Erc20InitArgs { name, symbol, decimals, initial_supply: Some(initial_supply) }; let mut token = Erc20HostRef::deploy(env, init_args); // We can now use the contract as we would in the OdraVM backend. println!("Token address: {}", token.address().to_string()); // Uncomment to load existing contract. // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; // let address = Address::from_str(address).unwrap(); // We use the Livenet-specific `load` method to load the contract // that is already deployed. // let mut token = Erc20Deployer::load(env, address); // Non-mutable calls are free! Neat, huh? More on that later. println!("Token name: {}", token.name()); // The next call is mutable, but the cost is lower that the deployment, // so we change the amount of gas env.set_gas(3_000_000_000u64); token.transfer(recipient, U256::from(1000)); println!("Owner's balance: {:?}", token.balance_of(owner)); println!("Recipient's balance: {:?}", token.balance_of(recipient)); } note The above example is a rust binary, not a test. Note that it is also added as a section of theCargo.toml file: [bin] name = "erc20_on_livenet" path = "src/bin/erc20_on_livenet.rs" required-features = ["livenet"] test = false ","version":"next","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#usage","content":"To run the above code, we simply need to run the binary with the livenet feature enabled: cargo run --bin erc20_on_livenet --features=livenet note Before executing the binary, make sure you built a wasm file. A part of a sample output should look like this: ... 💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 💁 INFO : Deploy "65b1a5d21..." successfully executed. Owner's balance: 4004 Recipient's balance: 4000 Those logs are a result of the last 4 lines of the above listing. Each deployment or a call to the blockchain will be noted and will take some time to execute. We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant and cost us nothing. How it is possible? info You can see the deployment on http://cspr.live/ - the transfer from the example can be seen here. ","version":"next","tagName":"h2"},{"title":"How Livenet backend works​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#how-livenet-backend-works","content":"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. It is possible however to query the state of the blockchain for free. This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the node is the current state. This is why the balance_of call was almost instant and free. Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract (see Cross Calls), it is executed offline and node is used for the state query only. However, the Livenet needs to know the connection between the contracts and the code, so make sure to deploy or load already deployed contracts ","version":"next","tagName":"h2"},{"title":"Multiple environments​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#multiple-environments","content":"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, multiple nodes or even multiple chains. To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file has to be used first. If your integration.env file has a value that IS present in the .env file, it will override the value from the .env file. ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet To sum up - this command will firstly load the integration.env file and then load the missing values from .env file. ","version":"next","tagName":"h2"},{"title":"Casper","type":0,"sectionRef":"#","url":"/docs/next/backends/casper","content":"","keywords":"","version":"next"},{"title":"Contract Env​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#contract-env","content":"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances. ","version":"next","tagName":"h2"},{"title":"Events​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#events","content":"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity. Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed: __events - a dictionary that stores events' data.__events_length - the evens count.__events_ces_version - the version of Casper Event Standard. __events_schema - a dictionary that stores event schemas. Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key. So, Events are nothing different from any other data stored by a contract. A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event]. note Don't forget to expose events in the module using #[odra::module(events = [...])]. ","version":"next","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#payable","content":"The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key. Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse. Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. If under the way something goes wrong with the transfer, the contract reverts. The transferred amount can be read inside the contract by calling self.env().attached_value(). note Odra expects the cargo_purse runtime argument to be attached to a contract call. In case of its absence, the contract_env::attached_value() returns zero. ","version":"next","tagName":"h3"},{"title":"Revert​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#revert","content":"In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User. ","version":"next","tagName":"h3"},{"title":"Context​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#context","content":"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack. The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address. The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address. As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse. ","version":"next","tagName":"h3"},{"title":"Test Env​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#test-env","content":"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine. In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000). The Test Env internally keeps track of the current block time, error and attached value. Each test is executed on a fresh instance of the Test Env. ","version":"next","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#usage","content":"Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -bparameter: cargo odra test -b casper If you want to just generate a wasm file, simply run: cargo odra build -b casper ","version":"next","tagName":"h2"},{"title":"Deploying a contract to Casper network​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#deploying-a-contract-to-casper-network","content":"There would be no point in writing a contract if you couldn't deploy it to the blockchain. You can do it in two ways: provided by the Casper itself: using the casper-client tool or using the Odra's Livenet integration. Let's explore the first option to better understand the process. note If you wish, you can skip the following section and jump to the Livenet integration. ","version":"next","tagName":"h2"},{"title":"WASM arguments​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#wasm-arguments","content":"When deploying a new contract you can pass some arguments to it. Every contract written in Odra expects those arguments to be set: odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable. Additionally, if required by the contract, you can pass constructor arguments. When working with the test env via cargo odra or when usingLivenet integration this is handled automatically. However, if you rather usecasper-client directly, you have to pass them manually: ","version":"next","tagName":"h3"},{"title":"Example: Deploy Counter​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#example-deploy-counter","content":"To deploy your contract with a constructor using casper-client, you need to pass the above arguments. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 5000000000000 \\ --session-path ./wasm/counter.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "value:u32:42" For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'. ","version":"next","tagName":"h3"},{"title":"Example: Deploy ERC721​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#example-deploy-erc721","content":"Odra comes with a standard ERC721 token implementation. Clone the main Odra repo and navigate to the modules directory. Firstly contract needs to be compiled. cargo odra build -b casper -c erc721_token It produces the erc721_token.wasm file in the wasm directory. Now it's time to deploy the contract. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc721_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string:'MyNFT'" \\ --session-arg "symbol:string:'NFT'" \\ --session-arg "base_uri:string:'https://example.com/'" It's done. The contract is deployed and ready to use. Your account is the owner of the contract and you can mint and burn tokens. For more details see the code of the ERC721 module. To obtain the package hash of the contract search for my_nft key in your account's named keys. ","version":"next","tagName":"h3"},{"title":"Example: Deploy ERC1155​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#example-deploy-erc1155","content":"The process is similar to the one described in the previous section. Contract compilation: cargo odra build -b casper -c erc1155_token Contract deployment: casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc1155_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ As previously, your account is the owner and can mint and burn tokens. For more details see the code of the ERC1155 module. ","version":"next","tagName":"h3"},{"title":"Sending CSPR to a contract​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#sending-cspr-to-a-contract","content":"Defining payable entry points is described in Native Token section. What is happening under the hood is that Odra creates a new cargo_purse argument for each payable entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. When a contract adds CSPR to another contract call, Odra handles it for you. The problem arises when you want to call an entry point and attach CSPR as an account. The only way of doing that is by executing code in the sessions context, that top-ups the cargo_purse and then calls the contract. Odra provides a generic proxy_caller.wasm that does exactly that. You can build it by yourself from the main Odra repository, or use the proxy_caller.wasmwe maintain. ","version":"next","tagName":"h2"},{"title":"Using proxy_caller.wasm​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#using-proxy_callerwasm","content":"To use the proxy_caller.wasm you need to attach the following arguments: contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. Result of to_bytes on CasperPackageHash.entry_point - String type. The name of the entry point you want to call.args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.attached_value. U512 type. The amount of CSPR you want to attach to the call.amount. U512 type. Should be the same value as attached_value if not None. It is a special Casper argument that enables the access to account's main purse. Currently casper-client doesn't allow building such arguments. You have to build it using your SDK. See an example in the Tutorial section. ","version":"next","tagName":"h3"},{"title":"Execution​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#execution","content":"First thing Odra does with your code, is similar to the one used in OdraVM - a list of entrypoints is generated, thanks to the #[odra::module] attribute. ","version":"next","tagName":"h2"},{"title":"Cargo Odra","type":0,"sectionRef":"#","url":"/docs/next/basics/cargo-odra","content":"","keywords":"","version":"next"},{"title":"Managing projects​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#managing-projects","content":"Two commands help you create a new project. The first one is cargo odra new. You need to pass one parameter, namely --name {PROJECT_NAME}: cargo odra new --name my-project This creates a new project in the my_project folder and name it my_project. You can see it for yourself, for example by taking a look into a Cargo.toml file created in your project's folder: [package] name = "my_project" version = "0.1.0" edition = "2021" The project is created using the template located in Odra's main repository. By default it uses full template, if you want, you can use minimalistic blank by running: cargo odra new -t blank --name my-project The third available template is workspace, which creates a workspace with two projects, similar to the one created with the full template. By default, the latest release of Odra will be used for the template and as a dependency. You can pass a source of Odra you want to use, by using -s parameter: cargo odra new -n my-project -s ../odra # will use local folder of odra cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release cargo odra new -n my-project -s 1.1.0 # will use a version released on crates.io The second way of creating a project is by using init command: cargo odra init --name my-project It works in the same way as new, but instead of creating a new folder, it creates a project in the current, empty directory. ","version":"next","tagName":"h2"},{"title":"Generating code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#generating-code","content":"If you want to quickly create a new contract code, you can use the generate command: cargo odra generate -c counter This creates a new file src/counter.rs with sample code, add appropriate use and mod sections to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, visit Odra.toml. ","version":"next","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#testing","content":"The most used command during the development of your project should be this one: cargo odra test It runs your tests against Odra's MockVM. It is substantially faster than CasperVMand implements all the features Odra uses. When you want to run tests against a "real" VM, just provide the name of the backend using -boption: cargo odra test -b casper In the example above, Cargo Odra builds the project, generates the wasm files, spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat. Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. This is why OdraVM was created and should be your first choice when developing contracts. Of course, testing all of your code against a blockchain VM is a must in the end. If you want to run only some of the tests, you can pass arguments to the cargo test command (which is run in the background obviously): cargo odra test -- this-will-be-passed-to-cargo-test If you want to run tests which names contain the word two, you can execute: cargo odra test -- two Of course, you can do the same when using the backend: cargo odra test -b casper -- two ","version":"next","tagName":"h2"},{"title":"Building code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#building-code","content":"You can also build the code itself and generate the output contracts without running the tests. To do so, simply run: cargo odra build If the build process finishes successfully, wasm files will be located in wasm folder. Notice, that this command does not require the -b option. If you want to build specific contract, you can use -c option: cargo odra build -c counter # you pass many comma separated contracts ","version":"next","tagName":"h2"},{"title":"Generating contract schema​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#generating-contract-schema","content":"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command: cargo odra schema This generates a schema file in JSON format for all your contracts and places them in the resources folder. If the resources folder does not exist, it creates the folder for you. Like with the build command, you can use the -c option to generate a schema for a specific contract. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#whats-next","content":"In the next section, we will take a look at all the files and directories that cargo odra created for us and explain their purpose. ","version":"next","tagName":"h2"},{"title":"What is a backend?","type":0,"sectionRef":"#","url":"/docs/next/backends/what-is-a-backend","content":"","keywords":"","version":"next"},{"title":"Contract Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/next/backends/what-is-a-backend#contract-env","content":"The Contract Env is a simple interface that each backend needs to implement, exposing features of the blockchain from the perspective of the contract. It gives Odra a set of functions, which allows implementing more complex concepts - for example, to implement Mapping, Odra requires some kind of storage integration. The exact implementation of those functions is a responsibility of a backend, making Odra and its user free to implement the contract logic, instead of messing with the blockchain internals. Other functions from Contract Env include handling transfers, addresses, block time, errors and events. ","version":"next","tagName":"h2"},{"title":"Host Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/next/backends/what-is-a-backend#host-env","content":"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with the backend from the outside world - really useful for implementing tests. This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, to the more test-oriented - handling errors, forwarding the block time, etc. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"What is a backend?","url":"/docs/next/backends/what-is-a-backend#whats-next","content":"We will take a look at backends Odra implements in more detail. ","version":"next","tagName":"h2"},{"title":"Host Communication","type":0,"sectionRef":"#","url":"/docs/next/basics/communicating-with-host","content":"","keywords":"","version":"next"},{"title":"What's next​","type":1,"pageTitle":"Host Communication","url":"/docs/next/basics/communicating-with-host#whats-next","content":"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code we presented in fact works! ","version":"next","tagName":"h2"},{"title":"Directory structure","type":0,"sectionRef":"#","url":"/docs/next/basics/directory-structure","content":"","keywords":"","version":"next"},{"title":"Cargo.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#cargotoml","content":"Let's first take a look at Cargo.toml file: [package] name = "sample" version = "0.1.0" edition = "2021" [dependencies] odra = "1.1.0" [dev-dependencies] odra-test = "1.1.0" [build-dependencies] odra-build = "1.1.0" [[bin]] name = "sample_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "sample_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also added as a dev dependency. ","version":"next","tagName":"h2"},{"title":"Odra.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#odratoml","content":"This is the file that holds information about contracts that will be generated when running cargo odra build andcargo odra test: [[contracts]] fqn = "sample::Flipper" As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to the contract is located in src/flipper.rs. More contracts can be added here by hand, or by using cargo odra generate command. ","version":"next","tagName":"h2"},{"title":"src/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#src","content":"This is the folder where your smart contract files live. ","version":"next","tagName":"h2"},{"title":"bin/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#bin","content":"This is the folder where scripts that will be used to generate code or schemas live. You don't need to modify those files, they are generated by cargo odra new command and are used by cargo odra build, cargo odra test and cargo odra schema commands. ","version":"next","tagName":"h2"},{"title":"target/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#target","content":"Files generated by cargo during the build process are put here. ","version":"next","tagName":"h2"},{"title":"wasm/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#wasm","content":"WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files and deploy them on the blockchain. What's next Now, let's take a look at one of the files mentioned above in more detail, namely the Odra.toml file. ","version":"next","tagName":"h2"},{"title":"Errors","type":0,"sectionRef":"#","url":"/docs/next/basics/errors","content":"","keywords":"","version":"next"},{"title":"Testing errors​","type":1,"pageTitle":"Errors","url":"/docs/next/basics/errors#testing-errors","content":"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner: examples/src/features/handling_errors.rs #[cfg(test)] mod tests { use super::{Error, OwnedContractHostRef, OwnedContractInitArgs}; use odra::{host::Deployer, prelude::*}; #[test] fn test_owner_error() { let test_env = odra_test::env(); let owner = test_env.get_account(0); let not_an_owner = test_env.get_account(1); test_env.set_caller(owner); let init_args = OwnedContractInitArgs { name: "OwnedContract".to_string() }; let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args); test_env.set_caller(not_an_owner); assert_eq!( owned_contract.try_change_name("NewName".to_string()), Err(Error::NotAnOwner.into()) ); } } Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult.OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and and safe its safe version: try_name, try_owner, try_change_name. In our example, we are calling try_change_name and expecting an error to be thrown. For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, we need to convert our custom error to OdraError using Into::into(). ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Errors","url":"/docs/next/basics/errors#whats-next","content":"We will learn how to emit and test events using Odra. ","version":"next","tagName":"h2"},{"title":"Casper Contract Schema","type":0,"sectionRef":"#","url":"/docs/next/basics/casper-contract-schema","content":"","keywords":"","version":"next"},{"title":"Odra and CCS​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#odra-and-ccs","content":"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory. note If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema. src/contract.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module( // the name of the contract, default is the module name name = "MyContract", // the version of the contract, default is the version of the crate version = "0.1.0", // events that the contract can emit, collected recursively if submodules are used events = [ Created, Updated ], // the error enum the contract can revert with, collected recursively if submodules are used errors = MyErrors )] pub struct MyContract { name: Var<String>, owner: Var<Address>, } #[odra::module] impl MyContract { /// Initializes the contract, sets the name and owner and emits an event pub fn init(&mut self, name: String, owner: Address) { self.name.set(name.clone()); self.owner.set(owner.clone()); self.env().emit_event(Created { name }); } /// Updates the name of the contract and emits an event pub fn update(&mut self, name: String) { self.name.set(name.clone()); self.env().emit_event(Updated { name }); } /// Returns the data of the contract pub fn get_data(&self) -> Data { Data { name: self.name.get_or_default(), owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner), } } } // The struct will we visible in the schema in the types section #[odra::odra_type] pub struct Data { name: String, owner: Address, } // The enum variants will we visible in the schema in the errors section #[odra::odra_error] pub enum MyErrors { /// The owner is invalid InvalidOwner, /// The name is invalid InvalidName, } // The struct will we visible in the schema in the types and events section #[odra::event] pub struct Updated { name: String, } // The struct will we visible in the schema in the types section and events section #[odra::event] pub struct Created { name: String, } ","version":"next","tagName":"h2"},{"title":"Generating the Schema​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#generating-the-schema","content":"To generate the schema run the following cargo-odra command: cargo odra schema # or pass -c flag to generate the schema for a specific contract ","version":"next","tagName":"h2"},{"title":"Schema Output​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#schema-output","content":"The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema: resources/my_contract_schema.json { "casper_contract_schema_version": 1, "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)", "authors": [], "repository": null, "homepage": null, "contract_name": "MyContract", "contract_version": "0.1.0", "types": [ { "struct": { "name": "Created", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } }, { "struct": { "name": "Data", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" }, { "name": "owner", "description": null, "ty": "Key" } ] } }, { "struct": { "name": "Updated", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } } ], "errors": [ { "name": "InvalidName", "description": "The name is invalid", "discriminant": 1 }, { "name": "InvalidOwner", "description": "The owner is invalid", "discriminant": 0 } ], "entry_points": [ { "name": "update", "description": "Updates the name of the contract and emits an event", "is_mutable": true, "arguments": [ { "name": "name", "description": null, "ty": "String", "optional": false } ], "return_ty": "Unit", "is_contract_context": true, "access": "public" }, { "name": "get_data", "description": "Returns the data of the contract", "is_mutable": false, "arguments": [], "return_ty": "Data", "is_contract_context": true, "access": "public" } ], "events": [ { "name": "Created", "ty": "Created" }, { "name": "Updated", "ty": "Updated" } ], "call": { "wasm_file_name": "MyContract.wasm", "description": "Initializes the contract, sets the name and owner and emits an event", "arguments": [ { "name": "odra_cfg_package_hash_key_name", "description": "The arg name for the package hash key name.", "ty": "String", "optional": false }, { "name": "odra_cfg_allow_key_override", "description": "The arg name for the allow key override.", "ty": "Bool", "optional": false }, { "name": "odra_cfg_is_upgradable", "description": "The arg name for the contract upgradeability setting.", "ty": "Bool", "optional": false }, { "name": "name", "description": null, "ty": "String", "optional": false }, { "name": "owner", "description": null, "ty": "Key", "optional": false } ] } } ","version":"next","tagName":"h2"},{"title":"Schema Fields​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#schema-fields","content":"casper_contract_schema_version is the version of the schema.toolchain is the version of the Rust compiler used to compile the contract.Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments. ","version":"next","tagName":"h2"},{"title":"Cross calls","type":0,"sectionRef":"#","url":"/docs/next/basics/cross-calls","content":"","keywords":"","version":"next"},{"title":"Contract Ref​","type":1,"pageTitle":"Cross calls","url":"/docs/next/basics/cross-calls#contract-ref","content":"We mentioned HostRef already in our Testing article - a host side reference to already deployed contract. In the module context we use a ContractRef instead, to call other contracts. Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, by the #[odra::module] attribute. To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above. The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module]impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract. External Contracts Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI. For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of. Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere. #[odra::external_contract] pub trait Adder { fn add(&self, n1: u32, n2: u32) -> u32; } Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call: AdderContractRef::new(self.env(), address).add(3, 5) ","version":"next","tagName":"h2"},{"title":"Loading the contract​","type":1,"pageTitle":"Cross calls","url":"/docs/next/basics/cross-calls#loading-the-contract","content":"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test our contracts in Livenet backend. We can load the contract using load method on the Deployer: examples/bin/erc20_on_livenet.rs fn _load(env: &HostEnv) -> Erc20HostRef { let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; let address = Address::from_str(address).unwrap(); <Erc20HostRef as HostRefLoader>::load(env, address) } ","version":"next","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"Cross calls","url":"/docs/next/basics/cross-calls#testing","content":"Let's see how we can test our cross calls using this knowledge: examples/src/features/cross_calls.rs #[cfg(test)] mod tests { use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef}; use odra::host::{Deployer, HostRef, NoArgs}; #[test] fn test_cross_calls() { let test_env = odra_test::env(); let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs); let cross_contract = CrossContractHostRef::deploy( &test_env, CrossContractInitArgs { math_engine_address: *math_engine_contract.address() } ); assert_eq!(cross_contract.add_using_another(), 8); } } Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize. #[cfg(test)] mod tests { use super::*; use odra::{Address, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_ext() { let test_env = odra_test::env(); let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5) assert_eq!(adder.add(1, 2), 3); } fn get_adder_address(test_env: &HostEnv) -> Address { let contract = MathEngineHostRef::deploy(test_env, NoArgs); *contract.address() } } ","version":"next","tagName":"h2"},{"title":"Events","type":0,"sectionRef":"#","url":"/docs/next/basics/events","content":"","keywords":"","version":"next"},{"title":"Testing events​","type":1,"pageTitle":"Events","url":"/docs/next/basics/events#testing-events","content":"Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted: examples/src/features/events.rs use super::{PartyContractHostRef, PartyStarted}; use odra::host::{Deployer, HostEnv, NoArgs}; #[test] fn test_party() { let test_env: HostEnv = odra_test::env(); let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs); test_env.emitted_event( &party_contract, &PartyStarted { caller: test_env.get_account(0), block_time: 0 } ); // If you do not want to check the exact event, you can use `emitted` function test_env.emitted(&party_contract, "PartyStarted"); // You can also check how many events were emitted. assert_eq!(test_env.events_count(&party_contract), 1); } To explore more event testing functions, check the HostEnv documentation. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Events","url":"/docs/next/basics/events#whats-next","content":"Read the next article to learn how to call other contracts from the contract context. ","version":"next","tagName":"h2"},{"title":"Flipper Internals","type":0,"sectionRef":"#","url":"/docs/next/basics/flipper-internals","content":"","keywords":"","version":"next"},{"title":"Header​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#header","content":"flipper.rs use odra::Var; Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation that can be reused between targets. In the above case, we're importing Var, which is responsible for storing simple values on the blockchain's storage. ","version":"next","tagName":"h2"},{"title":"Struct​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#struct","content":"flipper.rs /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } In Odra, all contracts are also modules, which can be reused between contracts. That's why we need to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all the fields of the contract. Those fields can be regular Rust data types, however - those will not be persisted on the blockchain. They can also be Odra modules - defined in your project or coming from Odra itself. Finally, to make the data persistent on the blockchain, you can use something likeVar<T> showed above. To learn more about storage interaction, take a look at thenext article. ","version":"next","tagName":"h2"},{"title":"Impl​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#impl","content":"flipper.rs /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } ... Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take allpub functions from this section and create contract endpoints from them. So, if you wish to have functions that are not available for calling outside the contract, do not make them public. Alternatively, you can create a separate impl section without the attribute - all functions defined there, even marked with pub will be not callable. The function named init is the constructor of the contract. This function will be limited to only to a single call, all further calls to it will result in an error. The init function is optional, if your contract does not need any initialization, you can skip it. flipper.rs ... /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } ... The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data saved there using set function will be persisted in the blockchain. ","version":"next","tagName":"h2"},{"title":"Tests​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#tests","content":"flipper.rs #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } ... You can write tests in any way you prefer and know in Rust. In the example above we are deploying the contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, as the second argument of the deploy function, we pass NoArgs - one of the implementations of the InitArgs trait provided with the framework. The contract will be deployed on the VM you chose while running cargo odra test. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#whats-next","content":"Now let's take a look at the different types of storage that Odra provides and how to use them. ","version":"next","tagName":"h2"},{"title":"Odra.toml","type":0,"sectionRef":"#","url":"/docs/next/basics/odra-toml","content":"","keywords":"","version":"next"},{"title":"Adding a new contract manually​","type":1,"pageTitle":"Odra.toml","url":"/docs/next/basics/odra-toml#adding-a-new-contract-manually","content":"Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly. For example, if you want to create a new contract called counter, your Odra.toml file should finally look like this: [[contracts]] fqn = "sample::Flipper" [[contracts]] fqn = "sample::Counter" ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Odra.toml","url":"/docs/next/basics/odra-toml#whats-next","content":"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famousFlipper contract. ","version":"next","tagName":"h2"},{"title":"Modules","type":0,"sectionRef":"#","url":"/docs/next/basics/modules","content":"","keywords":"","version":"next"},{"title":"Testing​","type":1,"pageTitle":"Modules","url":"/docs/next/basics/modules#testing","content":"As we don't need to hold addresses, the test is really simple: examples/src/features/modules.rs #[cfg(test)] mod tests { use super::ModulesContractHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn test_modules() { let test_env = odra_test::env(); let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs); assert_eq!(modules_contract.add_using_module(), 8); } } ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Modules","url":"/docs/next/basics/modules#whats-next","content":"We will see how to handle native token transfers. ","version":"next","tagName":"h2"},{"title":"Native token","type":0,"sectionRef":"#","url":"/docs/next/basics/native-token","content":"","keywords":"","version":"next"},{"title":"Testing​","type":1,"pageTitle":"Native token","url":"/docs/next/basics/native-token#testing","content":"To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function -balance_of: examples/src/features/native_token.rs #[cfg(test)] mod tests { use super::PublicWalletHostRef; use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_modules() { let test_env = odra_test::env(); let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs); assert_eq!(test_env.balance_of(my_contract.address()), U512::zero()); my_contract.with_tokens(U512::from(100)).deposit(); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100)); my_contract.withdraw(U512::from(25)); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75)); } } ","version":"next","tagName":"h2"},{"title":"HostEnv​","type":1,"pageTitle":"Native token","url":"/docs/next/basics/native-token#hostenv","content":"In a broader context of the host environment (test, livenet), you can also transfer CSPR tokens between accounts: let env = odra_casper_livenet_env::env(); //let env = odra_test::env(); let (alice, bob) = (env.get_account(0), env.get_account(1)); env.set_caller(alice); let result = env.transfer_tokens(bob, odra::casper_types::U512::from(100)); ","version":"next","tagName":"h2"},{"title":"Testing","type":0,"sectionRef":"#","url":"/docs/next/basics/testing","content":"","keywords":"","version":"next"},{"title":"HostEnv​","type":1,"pageTitle":"Testing","url":"/docs/next/basics/testing#hostenv","content":"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) and to configure how the contracts are deployed and called. Let's revisit the example from the previous article about host communication and implement the tests that prove it works: examples/src/features/testing.rs #[cfg(test)] mod tests { use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs}; use odra::{host::{Deployer, HostEnv}, prelude::*}; #[test] fn env() { let test_env: HostEnv = odra_test::env(); test_env.set_caller(test_env.get_account(0)); let init_args = TestingContractInitArgs { name: "MyContract".to_string() }; let testing_contract = TestingContractHostRef::deploy(&test_env, init_args); let creator = testing_contract.created_by(); test_env.set_caller(test_env.get_account(1)); let init_args = TestingContractInitArgs { name: "MyContract2".to_string() }; let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args); let creator2 = testing_contract2.created_by(); assert_ne!(creator, creator2); } } In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). Next, we are deploying two instances of the same contract, but we're using HostEnv::set_callerto change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller()the function we are calling inside the contract. HostEnv comes with a set of functions that will let you write better tests: fn set_caller(&self, address: Address) - you've seen it in action just nowfn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given addressfn advance_block_time(&self, time_diff: u64) - increases the current value of block_timefn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; by default, you start with the 0-th accountfn emitted_event<T: ToBytes + EventInstance, R: Addressable>(&self, contract_address: &R, event: &T) -> bool - verifies if the event was emitted by the contract Full list of functions can be found in the HostEnv documentation. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Testing","url":"/docs/next/basics/testing#whats-next","content":"We take a look at how Odra handles errors! ","version":"next","tagName":"h2"},{"title":"Storage interaction","type":0,"sectionRef":"#","url":"/docs/next/basics/storage-interaction","content":"","keywords":"","version":"next"},{"title":"Var​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#var","content":"The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your variable in the Var type. Let's look at a "real world" example of a contract that represents a dog: examples/src/features/storage/variable.rs use odra::prelude::*; use odra::Var; #[odra::module] pub struct DogContract { barks: Var<bool>, weight: Var<u32>, name: Var<String>, walks: Var<Vec<u32>>, } You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)! Let's make this contract usable, by providing a constructor and some getter functions: examples/src/features/storage/variable.rs #[odra::module] impl DogContract { pub fn init(&mut self, barks: bool, weight: u32, name: String) { self.barks.set(barks); self.weight.set(weight); self.name.set(name); self.walks.set(Vec::<u32>::default()); } pub fn barks(&self) -> bool { self.barks.get_or_default() } pub fn weight(&self) -> u32 { self.weight.get_or_default() } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { let walks = self.walks.get_or_default(); walks.len() as u32 } pub fn walks_total_length(&self) -> u32 { let walks = self.walks.get_or_default(); walks.iter().sum() } } As you can see, you can access the data, by using get_or_default function: examples/src/features/storage/variable.rs ... self.barks.get_or_default() ... note Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable doesn't have to be initialized! To modify the data, use the set() function: examples/src/features/storage/variable.rs self.barks.set(barks); A Var is easy to use and efficient for simple data types. One of its downsides is that it serializes the data as a whole, so when you're using complex types like Vec or HashMap, each time you get or set the whole data is read and written to the blockchain storage. In the example above, if we want to see how many walks our dog had, we would use the function: examples/src/features/storage/variable.rs pub fn walks_amount(&self) -> usize { let walks = self.walks.get_or_default(); walks.len() } But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, especially for larger sets of data. To tackle this issue following two types were created. ","version":"next","tagName":"h2"},{"title":"Mapping​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#mapping","content":"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that uses Mapping to store information about our dog's friends and how many times they visited: examples/src/features/storage/mapping.rs use odra::prelude::*; use odra::{Mapping, Var}; #[odra::module] pub struct DogContract2 { name: Var<String>, friends: Mapping<String, u32>, } In the example above, our key is a String (it is a name of the friend) and we are storing u32 values (amount of visits). To read and write values from and into a Mapping we use a similar approach to the one shown in the Vars section with one difference - we need to pass a key: examples/src/features/storage/mapping.rs pub fn visit(&mut self, friend_name: String) { let visits = self.visits(friend_name.clone()); self.friends.set(&friend_name, visits + 1); } pub fn visits(&self, friend_name: String) -> u32 { self.friends.get_or_default(&friend_name) } The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. We could implement such behavior by using a numeric type key and saving the length of the set in a separate variable. Thankfully Odra comes with a prepared solution - the List type. note If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with a Var working together: core/src/list.rs use odra::{List, Var}; pub struct List<T> { values: Mapping<u32, T>, index: Var<u32> } ","version":"next","tagName":"h2"},{"title":"List​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#list","content":"Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, we'll use the list: examples/src/features/storage/list.rs use odra::{prelude::*, List, Var}; #[odra::module] pub struct DogContract3 { name: Var<String>, walks: List<u32>, } As you can see, the notation is very similar to the Vec. To understand the usage, take a look at the reimplementation of the functions with an additional function that takes our dog for a walk (it writes the data to the storage): examples/src/features/storage/list.rs #[odra::module] impl DogContract3 { pub fn init(&mut self, name: String) { self.name.set(name); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { self.walks.len() } pub fn walks_total_length(&self) -> u32 { self.walks.iter().sum() } pub fn walk_the_dog(&mut self, length: u32) { self.walks.push(length); } } Now, we can know how many walks our dog had without loading the whole vector from the storage. We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all the cases for you. info All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder. ","version":"next","tagName":"h2"},{"title":"Custom Types​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#custom-types","content":"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors. Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type: use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } #[odra_type] is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type.CLType of a custom type is CLType::Any, except for an unit-only enum, which is CLType::U8. unit_only_enum.rs enum Enum { Foo = 3, Bar = 2, Baz = 1, } note Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute . ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#whats-next","content":"In the next article, we'll see how to query the host for information about the world and our contract. ","version":"next","tagName":"h2"},{"title":"odra-examples","type":0,"sectionRef":"#","url":"/docs/next/examples/odra-examples","content":"","keywords":"","version":"next"},{"title":"What's next​","type":1,"pageTitle":"odra-examples","url":"/docs/next/examples/odra-examples#whats-next","content":"Read the next article to learn about reusable Odra components encapsulated in odra-modules. ","version":"next","tagName":"h2"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/next/getting-started/installation","content":"","keywords":"","version":"next"},{"title":"Prerequisites​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#prerequisites","content":"To start working with Odra, you need to have the following installed on your machine: Rust toolchain installed (see rustup.rs)wasmstrip tool installed (see wabt) We do not provide exact commands for installing these tools, as they are different for different operating systems. Please refer to the documentation of the tools themselves. With Rust toolchain ready, you can add a new target: rustup target add wasm32-unknown-unknown note wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files. ","version":"next","tagName":"h2"},{"title":"Installing Cargo Odra​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#installing-cargo-odra","content":"Cargo Odra is a helpful tool that will help you to build and test your smart contracts. It is not required to use Odra, but the documentation will assume that you have it installed. To install it, simply execute the following command: cargo install cargo-odra --locked To check if it was installed correctly and see available commands, type: cargo odra --help If everything went fine, we can proceed to the next step. ","version":"next","tagName":"h2"},{"title":"Creating a new Odra project​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#creating-a-new-odra-project","content":"To create a new project, simply execute: cargo odra new --name my-project && cd my_project This will create a new folder called my_project and initialize Odra there. Cargo Odra will create a sample contract for you in src directory. You can run the tests of this contract by executing: cargo odra test This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM: cargo odra test -b casper Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during the installation process, feel free to ask for help on our Discord. ","version":"next","tagName":"h2"},{"title":"What's next?​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#whats-next","content":"If you want to see the code that you just tested, continue to the description of Flipper example. ","version":"next","tagName":"h2"},{"title":"Using odra-modules","type":0,"sectionRef":"#","url":"/docs/next/examples/using-odra-modules","content":"","keywords":"","version":"next"},{"title":"Available modules​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#available-modules","content":"Odra modules comes with couple of ready-to-use modules and reusable extensions. ","version":"next","tagName":"h2"},{"title":"Tokens​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#tokens","content":"CEP-18​ Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 here. CEP-78​ Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 here. Erc20​ The Erc20 module implements the ERC20 standard. Erc721​ The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework. The Erc721Token module implements the ERC721Base and additionally uses the Erc721Metadata and Ownable extensions. The Erc721Receiver trait lets you implement your own logic for receiving NFTs. The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules. Erc1155​ The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework. The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension. The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules. Wrapped native token​ The WrappedNativeToken module implements the Wrapper for the native token, it was inspired by the WETH. ","version":"next","tagName":"h3"},{"title":"Access​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#access","content":"AccessControl​ This module enables the implementation of role-based access control mechanisms for children modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API. Ownable​ This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner. The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using thetransfer_ownership() function. Ownable2Step​ An extension of the Ownable module. Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions. ","version":"next","tagName":"h3"},{"title":"Security​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#security","content":"Pausable​ A module allowing to implement an emergency stop mechanism that can be triggered by any account. ","version":"next","tagName":"h3"},{"title":"Flipper example","type":0,"sectionRef":"#","url":"/docs/next/getting-started/flipper","content":"","keywords":"","version":"next"},{"title":"Let's flip​","type":1,"pageTitle":"Flipper example","url":"/docs/next/getting-started/flipper#lets-flip","content":"flipper.rs use odra::Var; /// A module definition. Each module struct consists Vars and Mappings /// or/and another modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor, must be named `init`. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } /// Retrieves value from the storage. /// If the value has never been set, the default value is returned. pub fn get(&self) -> bool { self.value.get_or_default() } } #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } #[test] fn test_two_flippers() { let env = odra_test::env(); let mut contract1 = FlipperHostRef::deploy(&env, NoArgs); let contract2 = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract1.get()); assert!(!contract2.get()); contract1.flip(); assert!(contract1.get()); assert!(!contract2.get()); } } ","version":"next","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Flipper example","url":"/docs/next/getting-started/flipper#testing","content":"To run the tests, execute the following command: cargo odra test # or add the `-b casper` flag to run tests on the CasperVM ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper example","url":"/docs/next/getting-started/flipper#whats-next","content":"In the next category of articles, we will go through basic concepts of Odra. ","version":"next","tagName":"h2"},{"title":"Access Control","type":0,"sectionRef":"#","url":"/docs/next/tutorials/access-control","content":"","keywords":"","version":"next"},{"title":"Code​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#code","content":"Before we start writing code, we list the functionalities of our access control layer. A Role type is used across the module.A Role can be assigned to many Addresses.Each Role may have a corresponding admin role.Only an admin can grant/revoke a Role.A Role can be renounced.A Role cannot be renounced on someone's behalf.Each action triggers an event.Unauthorized access stops contract execution. ","version":"next","tagName":"h2"},{"title":"Project Structure​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#project-structure","content":"access-control ├── src │ ├── access │ │ ├── access_control.rs │ │ ├── events.rs │ │ └── errors.rs │ └── lib.rs |── build.rs |── Cargo.toml └── Odra.toml ","version":"next","tagName":"h3"},{"title":"Events and Errors​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#events-and-errors","content":"There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions. events.rs use odra::prelude::*; use odra::Address; use super::access_control::Role; #[odra::event] pub struct RoleGranted { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleRevoked { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleAdminChanged { pub role: Role, pub previous_admin_role: Role, pub new_admin_role: Role } L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role. errors.rs #[odra::odra_error] pub enum Error { MissingRole = 20_000, RoleRenounceForAnotherAddress = 20_001, } Errors definition is straightforward - there are only two invalid states: An action is triggered by an unauthorized actor.The caller is attempting to resign the Role on someone's behalf. ","version":"next","tagName":"h3"},{"title":"Module​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#module","content":"Now, we are stepping into the most interesting part: the module definition and implementation. access_control.rs use super::events::*; use super::errors::Error; use odra::prelude::*; use odra::{Address, Mapping}; pub type Role = [u8; 32]; pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32]; #[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])] pub struct AccessControl { roles: Mapping<(Role, Address), bool>, role_admin: Mapping<Role, Role> } #[odra::module] impl AccessControl { pub fn has_role(&self, role: &Role, address: &Address) -> bool { self.roles.get_or_default(&(*role, *address)) } pub fn get_role_admin(&self, role: &Role) -> Role { let admin_role = self.role_admin.get(role); if let Some(admin) = admin_role { admin } else { DEFAULT_ADMIN_ROLE } } pub fn grant_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_grant_role(role, address); } pub fn revoke_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_revoke_role(role, address); } pub fn renounce_role(&mut self, role: &Role, address: &Address) { if address != &self.env().caller() { self.env().revert(Error::RoleRenounceForAnotherAddress); } self.unchecked_revoke_role(role, address); } } impl AccessControl { pub fn check_role(&self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.env().revert(Error::MissingRole); } } pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) { let previous_admin_role = self.get_role_admin(role); self.role_admin.set(role, *admin_role); self.env().emit_event(RoleAdminChanged { role: *role, previous_admin_role, new_admin_role: *admin_role }); } pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.roles.set(&(*role, *address), true); self.env().emit_event(RoleGranted { role: *role, address: *address, sender: self.env().caller() }); } } pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) { if self.has_role(role, address) { self.roles.set(&(*role, *address), false); self.env().emit_event(RoleRevoked { role: *role, address: *address, sender: self.env().caller() }); } } } L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.L8 - The default role is an array filled with zeros.L10-L13 - The storage consists of two mappings: roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.role_admin - each Role can have a single admin Role. L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.L49 - This is a non-exported block containing helper functions.L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access. ","version":"next","tagName":"h3"},{"title":"Migration guide to v0.9.0","type":0,"sectionRef":"#","url":"/docs/next/migrations/to-0.9.0","content":"","keywords":"","version":"next"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#1-prerequisites","content":"","version":"next","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"next","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0. ","version":"next","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#2-migration-steps","content":"","version":"next","tagName":"h2"},{"title":"2.1 Update build_schema.rs bin​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#21-update-build_schemars-bin","content":"Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"next","tagName":"h3"},{"title":"2.2 Update smart contract code​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#22-update-smart-contract-code","content":"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes. 2.2.1. Update custom types definitions.​ #[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute. 0.9.00.8.0 use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } 2.2.2. Update errors definitions.​ #[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. Error enum should be passed as a parameter to the #[odra::module] attribute. 0.9.00.8.0 #[odra::module(events = [/* events go here */], errors = Error)] pub struct Erc20 { // fields } #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.2.3. Update events definitions.​ #[derive(Event)] attribute has been replace with #[odra::event] attribute. 0.9.00.8.0 use odra::prelude::*; use odra::{Address, casper_types::U256}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } ","version":"next","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.9.0. 0.9.0Prev src/erc20.rs use crate::erc20::errors::Error; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer], errors = Error)] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(Error::NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(Error::InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(Error::InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { // nothing changed in the tests } ","version":"next","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"next","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"next","tagName":"h2"},{"title":"Build, Deploy and Read the State of a Contract","type":0,"sectionRef":"#","url":"/docs/next/tutorials/build-deploy-read","content":"","keywords":"","version":"next"},{"title":"Contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#contract","content":"Let's write a contract with complex storage layout. The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping. We will expose two methods: The constructor init which sets the metadata and the version of the contract.The method set_data which sets the value of the numeric field and the values of the mapping. custom_item.rs use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var}; // A custom type with a vector of another custom type #[odra::odra_type] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[odra::odra_type] pub struct Price { value: U256, } // The main contract with a version, metadata and a submodule #[odra::module] pub struct CustomItem { version: Var<u32>, meta: Var<Metadata>, data: SubModule<Data> } #[odra::module] impl CustomItem { pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) { let meta = Metadata { name, description, prices: vec![ Price { value: price_1 }, Price { value: price_2 } ] }; self.meta.set(meta); self.version.set(self.version.get_or_default() + 1); } pub fn set_data(&mut self, value: u32, name: String, name2: String) { self.data.value.set(value); self.data.inner.named_values.set(&name, 10); self.data.inner.named_values.set(&name2, 20); } } // A submodule with a numeric value and another submodule #[odra::module] struct Data { value: Var<u32>, inner: SubModule<InnerData>, } // A submodule with a mapping #[odra::module] struct InnerData { named_values: Mapping<String, u32>, } ","version":"next","tagName":"h3"},{"title":"Deploying the contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#deploying-the-contract","content":"First, we need to setup the chain. We will use the NCTL docker image to run a local network. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Next, we need to compile the contract to a Wasm file. cargo odra build -c custom_item Then, we can deploy the contract using the casper-client tool. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key path/to/your/secret_key.pem \\ --session-path [PATH_TO_WASM] \\ --payment-amount 100000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string='My Name'" \\ --session-arg "description:string='My Description'" \\ --session-arg "price_1:u256='101'" \\ --session-arg "price_2:u256='202'" Finally, we can call the set_data method to set the values of the contract. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key ./keys/secret_key.pem \\ --payment-amount 2000000000 \\ --session-hash [DEPLOYED_CONTRACT_HASH] \\ --session-entry-point "set_data" \\ --session-arg "value:u32:'666'" \\ --session-arg "name:string='alice'" \\ --session-arg "name2:string='bob'" ","version":"next","tagName":"h3"},{"title":"Storage Layout​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#storage-layout","content":"To read the state of the contract, we need to understand the storage layout. The first step is to calculate the index of the keys. Storage Layout CustomItem: prefix: 0x0..._0000_0000_0000 0 version: u32, 0x0..._0000_0000_0001 1 meta: Metadata, 0x0..._0000_0000_0010 2 data: Data: prefix: 0x0..._0000_0000_0011 3 value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1 inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2 named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1 The actual key is obtained as follows: Convert the index to a big-endian byte array.Concatenate the index with the mapping data.Hash the concatenated bytes using blake2b.Return the hex representation of the hash (the stored key must be utf-8 encoded). In more detail, the storage layout is described in the Storage Layout article. ","version":"next","tagName":"h3"},{"title":"Reading the state​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#reading-the-state","content":"RustTypeScript main.rs use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity}; use casper_types::{ bytesrepr::{FromBytes, ToBytes}, U256, }; // replace with your contract hash const CONTRACT_HASH: &str = "hash-..."; const NODE_ADDRESS: &str = "http://localhost:11101/rpc"; const RPC_ID: &str = "casper-net-1"; const DICTIONARY_NAME: &str = "state"; #[derive(Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } async fn read_state_key(key: String) -> Vec<u8> { let state_root_hash = casper_client::get_state_root_hash( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, None, ) .await .unwrap() .result .state_root_hash .unwrap(); // Read the value from the `state` dictionary. let result = casper_client::get_dictionary_item( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, state_root_hash, DictionaryItemIdentifier::ContractNamedKey { key: CONTRACT_HASH.to_string(), dictionary_name: DICTIONARY_NAME.to_string(), dictionary_item_key: key, }, ) .await .unwrap() .result .stored_value; // We expect the value to be a CLValue if let StoredValue::CLValue(cl_value) = result { // Ignore the first 4 bytes, which are the length of the CLType. cl_value.inner_bytes()[4..].to_vec() } else { vec![] } } async fn metadata() -> Metadata { // The key for the metadata is 2, and it has no mapping data let key = key(2, &[]); let bytes = read_state_key(key).await; // Read the name and store the remaining bytes let (name, bytes) = String::from_bytes(&bytes).unwrap(); // Read the description and store the remaining bytes let (description, bytes) = String::from_bytes(&bytes).unwrap(); // A vector is stored as a u32 size followed by the elements // Read the size of the vector and store the remaining bytes let (size, mut bytes) = u32::from_bytes(&bytes).unwrap(); let mut prices = vec![]; // As we know the size of the vector, we can loop over it for _ in 0..size { // Read the value and store the remaining bytes let (value, rem) = U256::from_bytes(&bytes).unwrap(); bytes = rem; prices.push(Price { value }); } // Anytime you finish parsing a value, you should check if there are any remaining bytes // if there are, it means you have a bug in your parsing logic. // For simplicity, we will ignore the remaining bytes here. Metadata { name, description, prices } } async fn value() -> u32 { // The key for the value is (3 << 4) + 1, and it has no mapping data let key = key((3 << 4) + 1, &[]); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } async fn named_value(name: &str) -> u32 { // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes let mapping_data = name.to_bytes().unwrap(); let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } fn main() { let runtime = tokio::runtime::Runtime::new().unwrap(); dbg!(runtime.block_on(metadata())); dbg!(runtime.block_on(value())); dbg!(runtime.block_on(named_value("alice"))); dbg!(runtime.block_on(named_value("bob"))); } // The key is a combination of the index and the mapping data // The algorithm is as follows: // 1. Convert the index to a big-endian byte array // 2. Concatenate the index with the mapping data // 3. Hash the concatenated bytes using blake2b // 4. Return the hex representation of the hash (the stored key must be utf-8 encoded) fn key(idx: u32, mapping_data: &[u8]) -> String { let mut key = Vec::new(); key.extend_from_slice(idx.to_be_bytes().as_ref()); key.extend_from_slice(mapping_data); let hashed_key = blake2b(&key); hex::encode(&hashed_key) } fn blake2b(bytes: &[u8]) -> [u8; 32] { let mut result = [0u8; 32]; let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32) .expect("should create hasher"); let _ = std::io::Write::write(&mut hasher, bytes); blake2::digest::VariableOutput::finalize_variable(hasher, &mut result) .expect("should copy hash to the result array"); result } cargo run [src/main.rs:116:5] runtime.block_on(metadata()) = Metadata { name: "My Contract", description: "My Description", prices: [ Price { value: 123, }, Price { value: 321, }, ], } [src/main.rs:117:5] runtime.block_on(value()) = 666 [src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20 [src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10 ","version":"next","tagName":"h3"},{"title":"Deploying a Token on Casper Livenet","type":0,"sectionRef":"#","url":"/docs/next/tutorials/deploying-on-casper","content":"","keywords":"","version":"next"},{"title":"Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#casper-wallet","content":"We will be using Casper Wallet to do some tasks in this tutorial. To install it, please follow the instructions on theofficial website. After setting up the wallet, extract the private key of the account you want to use for our testing. You can do this by clicking on the Menu > Download account keys. danger You are solely responsible for the security of your private keys. We recommend creating a new account for the testing purposes. Why do we need the private key? We will use it in Odra to deploy our contract to the Casper network using Livenet backend. ","version":"next","tagName":"h2"},{"title":"Getting tokens​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#getting-tokens","content":"To deploy the contract on the Livenet, we need to have some CSPR. The easiest way to get them is to use the faucet, which will send us 1000 CSPR for free. Unfortunately, only on the Testnet. To use the faucet, go to the Casper Testnet Faucet. Log in using your Casper Wallet account and click on the "Request Tokens" button. note One account can request tokens only once. If you run out of tokens, you can either ask someone in the Casper community to send you some, or simply create a new account in the wallet. Now, when we have the tokens, we can deploy the contract. Let's do it using Odra! ","version":"next","tagName":"h2"},{"title":"Odra Livenet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#odra-livenet","content":"Odra Livenet is described in detail in thebackends section of this documentation. We will then briefly describe how to use set it up in this tutorial. In your contract code, create a new file in the bin folder: bin/our_token_livenet.rs //! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial //! creator. use std::str::FromStr; use odra::casper_types::U256; use odra::host::{Deployer, HostEnv, HostRef, HostRefLoader}; use odra::Address; use ourcoin::token::{OurTokenHostRef, OurTokenInitArgs}; fn main() { // Load the Casper livenet environment. let env = odra_casper_livenet_env::env(); // Caller is the deployer and the owner of the private key. let owner = env.caller(); // Just some random address... let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26"; let recipient = Address::from_str(recipient).unwrap(); // Deploy new contract. let mut token = deploy_our_token(&env); println!("Token address: {}", token.address().to_string()); // Propose minting new tokens. env.set_gas(1_000_000_000u64); token.propose_new_mint(recipient, U256::from(1_000)); // Vote, we are the only voter. env.set_gas(1_000_000_000u64); token.vote(true, U256::from(1_000)); // Let's advance the block time by 11 minutes, as // we set the voting time to 10 minutes. // OH NO! It is the Livenet, so we need to wait real time... // Hopefully you are not in a hurry. env.advance_block_time(11 * 60 * 1000); // Tally the votes. env.set_gas(1_500_000_000u64); token.tally(); // Check the balances. println!("Owner's balance: {:?}", token.balance_of(&owner)); println!( "Tutorial creator's balance: {:?}", token.balance_of(&recipient) ); } /// Deploys a contract. pub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef { let name = String::from("OurToken"); let symbol = String::from("OT"); let decimals = 0; let initial_supply = U256::from(1_000); let init_args = OurTokenInitArgs { name, symbol, decimals, initial_supply, }; env.set_gas(300_000_000_000u64); OurTokenHostRef::deploy(env, init_args) } /// Loads a contract. Just in case you need to load an existing contract later... fn _load_cep18(env: &HostEnv) -> OurTokenHostRef { let address = "hash-XXXXX"; let address = Address::from_str(address).unwrap(); OurTokenHostRef::load(env, address) } In your Cargo.toml file, we need to add a new dependency, a feature and register the new binary. In the end, it should look like this: Cargo.toml [package] name = "ourcoin" version = "0.1.0" edition = "2021" [dependencies] odra = { version = "1.1.0", features = [], default-features = false } odra-modules = { version = "1.1.0", features = [], default-features = false } odra-casper-livenet-env = { version = "1.1.0", optional = true } [dev-dependencies] odra-test = { version = "1.1.0", features = [], default-features = false } [build-dependencies] odra-build = { version = "1.1.0", features = [], default-features = false } [features] default = [] livenet = ["odra-casper-livenet-env"] [[bin]] name = "ourcoin_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "ourcoin_build_schema" path = "bin/build_schema.rs" test = false [[bin]] name = "our_token_livenet" path = "bin/our_token_livenet.rs" required-features = ["livenet"] [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 Finally, add the .env file with the following content: .env # Path to the secret key of the account that will be used to deploy the contracts. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777 # Chain name of the network. ODRA_CASPER_LIVENET_CHAIN_NAME=casper-test Of course, you need to replace the secret key's path with the path to the secret key file you downloaded from the Casper Wallet. note One of the problems you may encounter is that the node you are using will be down or will not accept your calls. In this case, you will have to find and use another node IP address. Now, we will run our code: cargo run --bin our_token_livenet --features livenet If everything is set up correctly, you should see the output similar to this: Running `target/debug/our_token_livenet` 💁 INFO : Deploying "OurToken". 💁 INFO : Found wasm under "wasm/OurToken.wasm". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 💁 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed. 💁 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed. Token address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 💁 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed. 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 💁 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed. 💁 INFO : advance_block_time called - Waiting for 660000 ms 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 💁 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed. Owner's balance: 1000 Tutorial creator's balance: 1000 Congratulations, your contract is now deployed on the Casper network! Before we move on, note the address of the token! We will use it in the next section to interact with the token. In our case it ishash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857. ","version":"next","tagName":"h2"},{"title":"Cspr.live​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#csprlive","content":"The first thing we will do is to explore Casper's network block explorer,cspr.live. We can put the address of our token in the search bar to find it. note If you deployed your contract on the Testnet, remember to make sure that the Testnet network is selected in the dropdown menu in the top right corner. If everything is set up correctly, you should see the contract package's details. Besides the owner, keys etc., you can also see the contract's metdata, if it was developed using a standard that cspr.live supports. Indeed, we can see that it detected that our contract is a CEP-18 token! We see the name, symbol and total supply. All the mentions of the contract on the website will use the token name instead of the contract address. Additionally, on the Token Txs tab, we can see the transactions that happened with the token. We can see the minting transaction we did in the previous section and transfers done during the voting process. If we click on one of the accounts that recieved the tokens, we will go to the account page. Here, on the Tokens tab, we can see all the tokens that the account has - and OurToken is one of them! If you wish, you can check the status of the contract deployed during the development of this tutorial here. ","version":"next","tagName":"h2"},{"title":"Transferring Tokens using Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#transferring-tokens-using-casper-wallet","content":"Casper wallet can do much more than just logging in to the faucet, exporting the private keys and transferring CSPR. It can also interact with the contracts deployed on the network. If you deployed the contract and left some OT tokens to yourself, you should see them in the Casper Wallet window. You should also be able to transfer them to another account! ","version":"next","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#conclusion","content":"We've successfully deployed a token on the Casper network and interacted with it using the Odra backend and Casper Wallet. We've also learned how to use the cspr.live block explorer to check the status of your contract. Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem provides. Feel free to explore them on casperecosystem.io. ","version":"next","tagName":"h2"},{"title":"Migration guide to v0.8.0","type":0,"sectionRef":"#","url":"/docs/next/migrations/to-0.8.0","content":"","keywords":"","version":"next"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#1-prerequisites","content":"","version":"next","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"next","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0. ","version":"next","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#2-migration-steps","content":"","version":"next","tagName":"h2"},{"title":"2.1 Add bin directory​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#21-add-bin-directory","content":"Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory. You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"next","tagName":"h3"},{"title":"2.2. Update Cargo.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#22-update-cargotoml","content":"There a bunch of changes in the Cargo.toml file. You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.Register bins you added in the previous step.Add dev-dependencies section with odra-test crate.Add recommended profiles for release and dev to optimize the build process. Below you can compare the Cargo.toml file after and before the migration to v0.8.0: 0.8.0Prev [package] name = "my_project" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.0" [dev-dependencies] odra-test = "0.8.0" [[bin]] name = "my_project_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "my_project_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 ","version":"next","tagName":"h3"},{"title":"2.2. Update Odra.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#22-update-odratoml","content":"Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required. 0.8.0Prev [[contracts]] fqn = "my_project::Flipper" ","version":"next","tagName":"h3"},{"title":"2.3. Update Smart Contracts​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#23-update-smart-contracts","content":"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make: 2.3.1. Update the use statements to reflect the new module structure.​ Big integer types are now located in the odra::casper_types module.odra::types::Address is now odra::Address.Variable is now Var.Remove odra::contract_env.Remove odra::types::event::OdraEvent.Remove odra::types::OdraType as it is no longer required.Change odra::types::casper_types::*; to odra::casper_types::*;. 2.3.2. Some type aliases are no longer in use.​ Balance - use odra::casper_types::U512.BlockTime - use u64.EventData - use odra::casper_types::bytesrepr::Bytes. 2.3.3. Consider import odra::prelude::* in your module files.​ 2.3.4. Flatten nested Mappings.​ // Before #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<Address, Mapping<Address, U256>> } // After #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<(Address, Address), U256> } 2.3.5. Update errors definitions.​ execution_error! macro has been replace with OdraError derive macro. 0.8.0Prev use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.3.6. Update events definitions.​ 0.8.0Prev use odra::prelude::*; use odra::Event; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } // Emitting the event self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); 2.3.7. Replace contract_env with self.env() in your modules.​ self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes. fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions. fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.functions native_token_metadata() and one_token() have been removed. 2.3.8. Wrap submodules of your module with odra::SubModule<T>.​ 0.8.0Prev #[odra::module(events = [Transfer])] pub struct Erc721Token { core: SubModule<Erc721Base>, metadata: SubModule<Erc721MetadataExtension>, ownable: SubModule<Ownable> } 2.3.9. Update external contract calls.​ However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()). 0.8.0Prev #[odra::external_contract] pub trait Token { fn balance_of(&self, owner: &Address) -> U256; } // Usage TokenContractRef::new(env, token).balance_of(account) 2.3.10. Update constructors.​ Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init. 2.3.11. Update UnwrapOrRevert calls.​ The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter. 2.3.12. Remove #[odra(using)] attribute from your module definition.​ Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required. ","version":"next","tagName":"h3"},{"title":"2.4. Update Tests​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#24-update-tests","content":"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make: 2.4.1. Contract deployment.​ The way you deploy a contract has changed: You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function. 0.8.0Prev // A contract without init args use super::OwnableHostRef; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; let env: HostEnv = odra_test::env(); let ownable = OwnableHostRef::deploy(&env, NoArgs) // A contract with init args use super::{Erc20HostRef, Erc20InitArgs}; use odra::host::{Deployer, HostEnv}; let env: HostEnv = odra_test::env(); let init_args = Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) }; let erc20 = Erc20HostRef::deploy(&env, init_args); 2.4.2. Host interactions.​ Replace odra::test_env with odra_test::env().The API of odra::test_env and odra_test::env() are similar, but there are some differences: test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).test_env::token_balance(Address) is now env.balance_of(&Address).functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef. 2.4.3. Testing failing scenarios.​ test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result.try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro. 0.8.0Prev #[test] fn transfer_from_error() { let (env, mut erc20) = setup(); let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); assert_eq!( erc20.try_transfer_from(owner, recipient, amount), Err(Error::InsufficientAllowance.into()) ); } 2.4.4. Testing events.​ assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options. 0.8.0Prev let env: HostEnv = odra_test::env(); let erc20 = Erc20HostRef::deploy(&env, init_args); ... assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); ","version":"next","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.8.0. 0.8.0Prev src/erc20.rs use crate::erc20::errors::Error::*; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address, Event}; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[derive(Event, Eq, PartialEq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { use super::{ errors::Error, events::{Approval, Transfer}, Erc20HostRef, Erc20InitArgs }; use odra::{ casper_types::U256, host::{Deployer, HostEnv, HostRef}, prelude::* }; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } // Other tests... } ","version":"next","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"next","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"next","tagName":"h2"},{"title":"CEP-18","type":0,"sectionRef":"#","url":"/docs/next/tutorials/cep18","content":"","keywords":"","version":"next"},{"title":"Self-governing token​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#self-governing-token","content":"There are many ways to implement a governance mechanism for a token, each more complex than the other. In our example, we will use a simple one, where the community of token holders can vote to mint new tokens. ","version":"next","tagName":"h2"},{"title":"Token implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#token-implementation","content":"Let's start by creating a new project, choosing a clever name and using cep18 as our starting template: cargo odra new --name ourcoin --template cep18 Let's glance at our token code: src/token.rs #[odra::module] pub struct MyToken { token: SubModule<Cep18>, } impl MyToken { // Delegate all Cep18 functions to the token sub-module. delegate! { to self.token { ... fn name(&self) -> String; fn symbol(&self) -> String; ... As we can see, it indeed uses the Cep18 module and delegates all the methods to it. The only thing to do is to change the name of the struct to more appropriate OurToken, run the provided tests using cargo odra test, and continue with the implementation of the governance. note Remember to change the name of the struct and its usages as well as the struct name in the Odra.toml file! ","version":"next","tagName":"h2"},{"title":"Governance implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#governance-implementation","content":"Let's go through the process of implementing the governance mechanism. If we don't want to, we don't have to hide entrypoints from the public responsible for minting new tokens. By default, minting Modalityis turned off, so any attempt of direct minting will result in an error. We will however implement a voting mechanism, where the token holders can vote to mint new tokens. ","version":"next","tagName":"h2"},{"title":"Voting mechanism​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#voting-mechanism","content":"Our voting system will be straightforward: Anyone with the tokens can propose a new mint.Anyone with the tokens can vote for the new mint by staking their tokens.If the majority of the token holders vote for the mint, it is executed. Storage​ We will need to store some additional information about the votes, so let's add some fields to our token struct: src/token.rs #[odra::module] pub struct OurToken { /// A sub-module that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } Notice that proposed_mint contains a tuple containing the address of the proposer and the amount of tokens to mint. Moreover, we need to keep track if the vote time has ended, but also if it was already tallied, that's why we need both is_vote_open and vote_end_time. We will also use the power of the Listtype to store the Ballots. Proposing a new mint​ To implement the endpoint that allows token holders to propose a new mint, we need to add a new function to our token module: src/token.rs /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open().get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 60 * 10 * 1000); } As a parameters to the function, we pass the address of the account that should be the receiver of the minted tokens, and the amount. After some validation, we open the vote by setting the is_vote_open to true, and setting the vote_end_time to 10 minutes. In real-world scenarios, the time could be configurable, but for the sake of simplicity, we hardcoded it. Also, it should be quite longer than 10 minutes, but it will come in handy when we test it on Livenet. Voting for the mint​ Next, we need an endpoint that will allow us to cast a ballot: src/token.rs /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token .transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } The most interesting thing here is that we are using a mechanism of staking, where we transfer our tokens to the contract, to show that we really mean it. The tokens will be locked until the vote is over, and tallied. Speaking of tallying... Tallying the votes​ The last step is to tally the votes and mint the tokens if the majority of voters agreed to do so: src/token.rs /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token.raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } Notice how we used raw_transfer from the Cep18 module. We used it to set the sender, so the contract's balance will be used, instead of the caller's. Additonally, we used raw_mint to mint the tokens, skipping the security checks. We have no modality for minting, but even if we had, we don't have anyone with permissions! The Contract needs to mint the tokens itself. ","version":"next","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#testing","content":"Now, we will put our implementation to the test. One unit test, that we can run both on OdraVM and on the CasperVM. src/token.rs #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } We can run the test using both methods: cargo odra test cargo odra test -b casper It is all nice and green, but it would be really nice to see it in action. How about deploying it on the Casper network? ","version":"next","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#whats-next","content":"We will se our token in action, by deploying it on the Casper network, and using tools from the Casper Ecosystem to interact with it. ","version":"next","tagName":"h2"},{"title":"Complete code​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#complete-code","content":"Here is the complete code of the OurToken module: src/token.rs use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var}; use odra_modules::cep18_token::Cep18; /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } /// Errors for the governed token. #[odra::odra_error] pub enum GovernanceError { /// The vote is already in progress. VoteAlreadyOpen = 0, /// No vote is in progress. NoVoteInProgress = 1, /// Cannot tally votes yet. VoteNotYetEnded = 2, /// Vote ended VoteEnded = 3, /// Only the token holders can propose a new mint. OnlyTokenHoldersCanPropose = 4, } /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct OurToken { /// A submodule that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl OurToken { /// Initializes the contract with the given metadata and initial supply. pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { // We put the token address as an admin, so it can govern itself. Self-governing token! self.token .init(symbol, name, decimals, initial_supply, vec![], vec![], None); } // Delegate all Cep18 functions to the token submodule. delegate! { to self.token { /// Admin EntryPoint to manipulate the security access granted to users. /// One user can only possess one access group badge. /// Change strength: None > Admin > Minter /// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an /// Admin, also if a user is added to Admin and None then they will be removed from having rights. /// Beware: do not remove the last Admin because that will lock out all admin functionality. fn change_security( &mut self, admin_list: Vec<Address>, minter_list: Vec<Address>, none_list: Vec<Address> ); /// Returns the name of the token. fn name(&self) -> String; /// Returns the symbol of the token. fn symbol(&self) -> String; /// Returns the number of decimals the token uses. fn decimals(&self) -> u8; /// Returns the total supply of the token. fn total_supply(&self) -> U256; /// Returns the balance of the given address. fn balance_of(&self, address: &Address) -> U256; /// Returns the amount of tokens the owner has allowed the spender to spend. fn allowance(&self, owner: &Address, spender: &Address) -> U256; /// Approves the spender to spend the given amount of tokens on behalf of the caller. fn approve(&mut self, spender: &Address, amount: &U256); /// Decreases the allowance of the spender by the given amount. fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256); /// Increases the allowance of the spender by the given amount. fn increase_allowance(&mut self, spender: &Address, inc_by: &U256); /// Transfers tokens from the caller to the recipient. fn transfer(&mut self, recipient: &Address, amount: &U256); /// Transfers tokens from the owner to the recipient using the spender's allowance. fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256); /// Mints new tokens and assigns them to the given address. fn mint(&mut self, owner: &Address, amount: &U256); /// Burns the given amount of tokens from the given address. fn burn(&mut self, owner: &Address, amount: &U256); } } /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env() .revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 10 * 60 * 1000); } /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token.transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token .raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } fn assert_vote_in_progress(&self) { if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() > finish_time { self.env().revert(GovernanceError::VoteEnded); } } } #[cfg(test)] mod tests { use super::*; use odra::host::Deployer; #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } } ","version":"next","tagName":"h2"},{"title":"ERC-20","type":0,"sectionRef":"#","url":"/docs/next/tutorials/erc20","content":"","keywords":"","version":"next"},{"title":"Framework features​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: Advanced storage using key-value pairs,Odra types such as Address,Advanced event assertion. ","version":"next","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#code","content":"Our module features a considerably more complex storage layout compared to the previous example. It is designed to store the following data: Immutable metadata - name, symbol, and decimals.Total supply.Balances of individual users.Allowances, essentially indicating who is permitted to spend tokens on behalf of another user. ","version":"next","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#module-definition","content":"erc20.rs use odra::prelude::*; use odra::{Address, casper_types::U256, Mapping, Var}; #[odra::module(events = [Transfer, Approval])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys. ","version":"next","tagName":"h2"},{"title":"Metadata​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#metadata","content":"erc20.rs #[odra::module] impl Erc20 { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let caller = self.env().caller(); self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.mint(&caller, &initial_supply); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn symbol(&self) -> String { self.symbol.get_or_default() } pub fn decimals(&self) -> u8 { self.decimals.get_or_default() } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } } impl Erc20 { pub fn mint(&mut self, address: &Address, amount: &U256) { self.balances.add(address, *amount); self.total_supply.add(*amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } } #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.L3-L9 - A constructor sets the token metadata and mints the initial supply.L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for: use odra::UnwrapOrRevert; let current_balance = self.balances.get(address).unwrap_or_default(); let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env()); self.balances.set(address, new_balance); ","version":"next","tagName":"h3"},{"title":"Core​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#core","content":"To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks. erc20.rs #[odra::module] impl Erc20 { ... pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn balance_of(&self, address: &Address) -> U256 { self.balances.get_or_default(&address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } } impl Erc20 { ... fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let owner_balance = self.balances.get_or_default(&owner); if *amount > owner_balance { self.env().revert(Error::InsufficientBalance) } self.balances.set(owner, owner_balance - *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowance(owner, spender); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } let new_allowance = allowance - *amount; self.allowances .set(&(*owner, *spender), new_allowance); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } #[odra::odra_error] pub enum Error { InsufficientBalance = 1, InsufficientAllowance = 2, } Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation? ","version":"next","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#test","content":"erc20.rs #[cfg(test)] pub mod tests { use super::*; use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}}; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: INITIAL_SUPPLY.into() } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( &erc20, &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( &erc20, &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } #[test] fn transfer_from_and_approval_work() { let (env, mut erc20) = setup(); let (owner, recipient, spender) = (env.get_account(0), env.get_account(1), env.get_account(2)); let approved_amount = 3_000.into(); let transfer_amount = 1_000.into(); assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY)); // Owner approves Spender. erc20.approve(&spender, &approved_amount); // Allowance was recorded. assert_eq!(erc20.allowance(&owner, &spender), approved_amount); assert!(env.emitted_event( &erc20, &Approval { owner, spender, value: approved_amount } )); // Spender transfers tokens from Owner to Recipient. env.set_caller(spender); erc20.transfer_from(&owner, &recipient, &transfer_amount); // Tokens are transferred and allowance decremented. assert_eq!( erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY) - transfer_amount ); assert_eq!(erc20.balance_of(&recipient), transfer_amount); assert!(env.emitted_event( &erc20, &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( &erc20, &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); // assert!(env.emitted(erc20.address(), "Transfer")); } #[test] fn transfer_from_error() { // Given a new instance. let (env, mut erc20) = setup(); // When the spender's allowance is zero. let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); // Then transfer fails. assert_eq!( erc20.try_transfer_from(&owner, &recipient, &amount), Err(Error::InsufficientAllowance.into()) ); } } L146 - Alternatively, if you don't want to check the entire event, you may assert only its type. ","version":"next","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#whats-next","content":"Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids. ","version":"next","tagName":"h2"},{"title":"Ownable","type":0,"sectionRef":"#","url":"/docs/next/tutorials/ownable","content":"","keywords":"","version":"next"},{"title":"Framework features​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: storing a single value,defining a constructor,error handling,defining and emitting events.registering a contact in a test environment,interactions with the test environment,assertions (value, events, errors assertions). ","version":"next","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#code","content":"Before we write any code, we define functionalities we would like to implement. Module has an initializer that should be called once. Only the current owner can set a new owner.Read the current owner.A function that fails if called by a non-owner account. ","version":"next","tagName":"h2"},{"title":"Define a module​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#define-a-module","content":"ownable.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module(events = [OwnershipChanged])] pub struct Ownable { owner: Var<Option<Address>> } That was easy, but it is crucial to understand the basics before we move on. L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var. ","version":"next","tagName":"h3"},{"title":"Init the module​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#init-the-module","content":"ownable.rs #[odra::module] impl Ownable { pub fn init(&mut self, owner: Address) { if self.owner.get_or_default().is_some() { self.env().revert(Error::OwnerIsAlreadyInitialized) } self.owner.set(Some(owner)); self.env().emit_event(OwnershipChanged { prev_owner: None, new_owner: owner }); } } #[odra::odra_error] pub enum Error { OwnerIsAlreadyInitialized = 1, } #[odra::event] pub struct OwnershipChanged { pub prev_owner: Option<Address>, pub new_owner: Address } Ok, we have done a couple of things, let's analyze them one by one: L1 - The impl should be an Odra module, so add #[odra::module].L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument. L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None. ","version":"next","tagName":"h3"},{"title":"Features implementation​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#features-implementation","content":"ownable.rs #[odra::module] impl Ownable { ... pub fn ensure_ownership(&self, address: &Address) { if Some(address) != self.owner.get_or_default().as_ref() { self.env().revert(Error::NotOwner) } } pub fn change_ownership(&mut self, new_owner: &Address) { self.ensure_ownership(&self.env().caller()); let current_owner = self.get_owner(); self.owner.set(Some(*new_owner)); self.env().emit_event(OwnershipChanged { prev_owner: Some(current_owner), new_owner: *new_owner }); } pub fn get_owner(&self) -> Address { match self.owner.get_or_default() { Some(owner) => owner, None => self.env().revert(Error::OwnerIsNotInitialized) } } } #[odra::odra_error] pub enum Error { NotOwner = 1, OwnerIsAlreadyInitialized = 2, OwnerIsNotInitialized = 3, } The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along. L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead. ","version":"next","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#test","content":"ownable.rs #[cfg(test)] mod tests { use super::*; use odra::host::{Deployer, HostEnv, HostRef}; fn setup() -> (OwnableHostRef, HostEnv, Address) { let env: HostEnv = odra_test::env(); let init_args = OwnableInitArgs { owner: env.get_account(0) }; (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0)) } #[test] fn initialization_works() { let (ownable, env, owner) = setup(); assert_eq!(ownable.get_owner(), owner); env.emitted_event( &ownable, &OwnershipChanged { prev_owner: None, new_owner: owner } ); } #[test] fn owner_can_change_ownership() { let (mut ownable, env, owner) = setup(); let new_owner = env.get_account(1); env.set_caller(owner); ownable.change_ownership(&new_owner); assert_eq!(ownable.get_owner(), new_owner); env.emitted_event( &ownable, &OwnershipChanged { prev_owner: Some(owner), new_owner } ); } #[test] fn non_owner_cannot_change_ownership() { let (mut ownable, env, _) = setup(); let new_owner = env.get_account(1); ownable.change_ownership(&new_owner); assert_eq!( ownable.try_change_ownership(&new_owner), Err(Error::NotOwner.into()) ); } } L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one). L14 - It is time to define the first test. As you see, it is a regular Rust test.L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract. note You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract. L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract you want to read events from, followed by an event as you expect it to have occurred.L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function. note The caller switch applies only the next contract interaction, the second call will be done as the default account. L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type. ","version":"next","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#summary","content":"The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#whats-next","content":"In the next tutorial we will implement a ERC20 standard. ","version":"next","tagName":"h2"},{"title":"Ticketing System","type":0,"sectionRef":"#","url":"/docs/next/tutorials/nft","content":"","keywords":"","version":"next"},{"title":"Ticket Office Contract​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#ticket-office-contract","content":"Our TicketOffice contract will include the following features: Compliance with the CEP-78 standard.Ownership functionality.Only the owner can issue new event tickets.Users can purchase tickets for events.Tickets are limited to a one-time sale.Public access to view the total income of the TicketOffice. ","version":"next","tagName":"h3"},{"title":"Setup the project​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#setup-the-project","content":"Creating a new NFT token with Odra is straightforward. Use the cargo odra new command to create a new project with the CEP-78 template: cargo odra new --name ticket-office --template cep78 ","version":"next","tagName":"h3"},{"title":"Contract implementation​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#contract-implementation","content":"Let's start implementing the TicketOffice contract by modify the code generated from the template. src/token.rs use odra::{ args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert }; use odra_modules::access::Ownable; use odra_modules::cep78::{ modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode}, token::Cep78, }; pub type TicketId = u64; #[odra::odra_type] pub enum TicketStatus { Available, Sold, } #[odra::odra_type] pub struct TicketInfo { event_name: String, price: U512, status: TicketStatus, } #[odra::event] pub struct OnTicketIssue { ticket_id: TicketId, event_name: String, price: U512, } #[odra::event] pub struct OnTicketSell { ticket_id: TicketId, buyer: Address, } #[odra::odra_error] pub enum Error { TicketNotAvailableForSale = 200, InsufficientFunds = 201, InvalidTicketId = 202, TicketDoesNotExist = 203, } #[odra::module( events = [OnTicketIssue, OnTicketSell], errors = Error )] pub struct TicketOffice { token: SubModule<Cep78>, ownable: SubModule<Ownable>, tickets: Mapping<TicketId, TicketInfo>, } #[odra::module] impl TicketOffice { pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) { self.ownable.init(); let receipt_name = format!("cep78_{}", collection_name); self.token.init( collection_name, collection_symbol, total_supply, OwnershipMode::Transferable, NFTKind::Digital, NFTIdentifierMode::Ordinal, NFTMetadataKind::Raw, MetadataMutability::Immutable, receipt_name, // remaining args are optional and can set to Maybe::None ... ); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { let env = self.env(); let caller = env.caller(); self.ownable.assert_owner(&caller); // mint a new token let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None); let ticket_id: u64 = token_id .parse() .map_err(|_| Error::InvalidTicketId) .unwrap_or_revert(&env); // store ticket info self.tickets.set( &ticket_id, TicketInfo { event_name: event_name.clone(), price, status: TicketStatus::Available, }, ); // emit an event env.emit_event(OnTicketIssue { ticket_id, event_name, price, }); } #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let owner = self.ownable.get_owner(); let buyer = env.caller(); let value = env.attached_value(); // only tokens owned by the owner can be sold if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner { env.revert(Error::TicketNotAvailableForSale); } let mut ticket = self .tickets .get(&ticket_id) .unwrap_or_revert_with(&env, Error::TicketDoesNotExist); // only available tickets can be sold if ticket.status != TicketStatus::Available { env.revert(Error::TicketNotAvailableForSale); } // check if the buyer sends enough funds if value < ticket.price { env.revert(Error::InsufficientFunds); } // transfer csprs to the owner env.transfer_tokens(&owner, &value); // transfer the ticket to the buyer self.token .transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer); ticket.status = TicketStatus::Sold; self.tickets.set(&ticket_id, ticket); env.emit_event(OnTicketSell { ticket_id, buyer }); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L10-L44 - We define structures and enums that will be used in our contract. TicketStatus enum represents the status of a ticket, TicketInfo struct contains information about a ticket that is written to the storage, TicketId is a type alias for u64. OnTicketIssue and OnTicketSell are events that will be emitted when a ticket is issued or sold.L46-L49 - Register errors and events that will be used in our contract, required to produce a complete contract schema.L51-L53 - TicketOffice module definition. The module contains a Cep78 token, an Ownable module, and a Mapping that stores information about tickets.L58-L74 - The init function has been generated from the template and there is no need to modify it, except the Ownable module initialization.L76-L94 - The issue_ticket function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an OnTicketIssue event.L103 - The payable attribute indicates that the buy_ticket function can receive funds.L104-L134 - The buy_ticket function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an OnTicketSell event. Lets test the contract. The test scenario will be as follows: Deploy the contract.Issue two tickets.Try to buy a ticket with insufficient funds.Buy tickets.Try to buy the same ticket again.Check the balance of the contract. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef}, }; use crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs}; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let mut contract = TicketOfficeHostRef::deploy(&env, init_args); contract.issue_ticket("Ev".to_string(), U512::from(100)); contract.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(0), Err(Error::InsufficientFunds.into()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(1), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Err(Error::TicketNotAvailableForSale.into()) ); } Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with Cep78Error::InvalidTokenOwner because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of. odra/modules/src/cep78/token78.rs pub fn transfer( &mut self, token_id: Maybe<u64>, token_hash: Maybe<String>, source_key: Address, target_key: Address ) -> TransferReceipt { ... if !is_owner && !is_approved && !is_operator { self.revert(CEP78Error::InvalidTokenOwner); } ... } Let's fix it by redesigning our little system. ","version":"next","tagName":"h3"},{"title":"Redesign​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#redesign","content":"Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary — an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets. The sequence diagram below illustrates the new flow: Ticket Operator Contract​ As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the cargo odra generate command. cargo odra generate -c ticket_operator src/ticket_operator.rs use crate::token::{TicketId, TicketOfficeContractRef}; use odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var}; #[odra::odra_error] pub enum Error { UnknownTicketOffice = 300, } #[odra::module(errors = Error)] pub struct TicketOperator { ticket_office_address: Var<Address>, } #[odra::module] impl TicketOperator { pub fn register(&mut self, ticket_office_address: Address) { self.ticket_office_address.set(ticket_office_address); } // now the operator's `buy_ticket` receives funds. #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let buyer = env.caller(); let value = env.attached_value(); let center = self .ticket_office_address .get() .unwrap_or_revert_with(&env, Error::UnknownTicketOffice); let mut ticket_contract = TicketOfficeContractRef::new(env, center); // now and approved entity - the operator - buys the ticket on behalf of the buyer ticket_contract.buy_ticket(ticket_id, buyer, value); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L4-L7 - Define errors that will be used in the contract.L9-L13 - Define the TicketOperator module that stores the address of the ticketing office.L16-L18 - The register function sets the address of the ticketing office.L20-L32 - The buy_ticket function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a TicketOfficeContractRef to interact we the TicketOffice contract. Note that, the operator's buy_ticket now receives funds. Now we need to adjust the TicketOffice contract to use the TicketOperator contract to buy tickets. src/token.rs use odra::Var; ... #[odra::odra_error] pub enum Error { ... MissingOperator = 204, Unauthorized = 205, } #[odra::module] pub struct TicketOffice { ... operator: Var<Address>, } #[odra::module] impl TicketOffice { ... pub fn register_operator(&mut self, operator: Address) { // only the owner can register an operator let caller = self.env().caller(); self.ownable.assert_owner(&caller); // store the ticketing center address in the operator contract TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address()); self.operator.set(operator); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { // minting logic remains the same... ... // approve the operator to transfer the ticket let operator = self.operator(); self.token .approve(operator, Maybe::Some(ticket_id), Maybe::None); // emit an event ... } pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) { let env = self.env(); let owner = self.ownable.get_owner(); let caller = env.caller(); // make sure the caller is the operator if !self.is_operator(caller) { env.revert(Error::Unauthorized); } ... // the logic remains the same, except for the csprs transfer // it is now handled by the operator contract. // env.transfer_tokens(&owner, &value); } #[inline] fn is_operator(&self, caller: Address) -> bool { Some(caller) == self.operator.get() } #[inline] fn operator(&self) -> Address { self.operator .get() .unwrap_or_revert_with(&self.env(), Error::MissingOperator) } } L15 - the contract stores the operator address.L22-L29 - a new function register_operator allows the owner to register an operator. Also calls the register entry point on the operator contract.L36-38 - modify the issue_ticket function: once a new token is minted, approves the operator to transfer the ticket later.L44-L57 - modify the buy_ticket function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds.We also added two helper functions: is_operator and operator to check if the caller is the operator and get the operator address. Two new errors were added: MissingOperator and Unauthorized. Now we need to update our tests to create a scenario we presented in the sequence diagram. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef, NoArgs}, OdraResult, }; use crate::{ ticket_operator::TicketOperatorHostRef, token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs}, }; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let operator = TicketOperatorHostRef::deploy(&env, NoArgs); let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args); ticket_office.register_operator(operator.address().clone()); ticket_office.issue_ticket("Ev".to_string(), U512::from(100)); ticket_office.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( buy_ticket(&operator, 0, 50), Err(Error::InsufficientFunds.into()) ); assert_eq!(buy_ticket(&operator, 0, 100), Ok(())); assert_eq!(buy_ticket(&operator, 1, 50), Ok(())); assert_eq!( buy_ticket(&operator, 0, 100), Err(Error::TicketNotAvailableForSale.into()) ); assert_eq!(operator.balance_of(), U512::from(150)); } fn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> { operator.with_tokens(U512::from(price)).try_buy_ticket(id) } ","version":"next","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#conclusion","content":"In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls. ","version":"next","tagName":"h3"},{"title":"OwnedToken","type":0,"sectionRef":"#","url":"/docs/next/tutorials/owned-token","content":"","keywords":"","version":"next"},{"title":"Code​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#code","content":"What should our module be capable of? Conform the Erc20 interface.Allow only the module owner to mint tokens.Enable the current owner to designate a new owner. ","version":"next","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#module-definition","content":"Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules. owned_token.rs use crate::{erc20::Erc20, ownable::Ownable}; use odra::prelude::*; use odra::module::SubModule; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } As you can see, we do not need any storage definition - we just take advantage of the already-defined modules! ","version":"next","tagName":"h3"},{"title":"Delegation​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#delegation","content":"owned_token.rs ... use odra::{Address, casper_types::U256}; ... #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } pub fn name(&self) -> String { self.erc20.name() } pub fn symbol(&self) -> String { self.erc20.symbol() } pub fn decimals(&self) -> u8 { self.erc20.decimals() } pub fn total_supply(&self) -> U256 { self.erc20.total_supply() } pub fn balance_of(&self, address: &Address) -> U256 { self.erc20.balance_of(address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.erc20.allowance(owner, spender) } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.erc20.transfer(recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { self.erc20.transfer_from(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { self.erc20.approve(spender, amount); } pub fn get_owner(&self) -> Address { self.ownable.get_owner() } pub fn change_ownership(&mut self, new_owner: &Address) { self.ownable.change_ownership(new_owner); } pub fn mint(&mut self, address: &Address, amount: &U256) { self.ownable.ensure_ownership(&self.env().caller()); self.erc20.mint(address, amount); } } Easy. However, there are a few worth mentioning subtleness: L9-L10 - A constructor is an excellent place to initialize both modules at once.L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.L49-L51 - The same is done with the ownable module.L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner. ","version":"next","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#summary","content":"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that. ","version":"next","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/","content":"","keywords":"","version":"1.0.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Pausable","type":0,"sectionRef":"#","url":"/docs/next/tutorials/pauseable","content":"","keywords":"","version":"next"},{"title":"Code​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#code","content":"As always, we will start with defining functionalities of our module. Check the state - is it paused or not.State guards - a contract should stop execution if is in a state we don't expect.Switch the state. ","version":"next","tagName":"h2"},{"title":"Events and Error​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#events-and-error","content":"There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way. Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser. pauseable.rs use odra::prelude::*; use odra::Address; #[odra::odra_error] pub enum Error { PausedRequired = 1_000, UnpausedRequired = 1_001, } #[odra::event] pub struct Paused { pub account: Address } #[odra::event] pub struct Unpaused { pub account: Address } ","version":"next","tagName":"h3"},{"title":"Module definition​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#module-definition","content":"The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused. pauseable.rs use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] pub struct Pausable { is_paused: Var<bool> } ","version":"next","tagName":"h3"},{"title":"Checks and guards​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#checks-and-guards","content":"Now, let's move to state checks and guards. pauseable.rs impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } pub fn require_not_paused(&self) { if self.is_paused() { self.env().revert(Error::UnpausedRequired); } } pub fn require_paused(&self) { if !self.is_paused() { self.env().revert(Error::PausedRequired); } } } L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused. L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused. ","version":"next","tagName":"h3"},{"title":"Actions​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#actions","content":"Finally, we will add the ability to switch the module state. pauseable.rs impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); self.env().emit_event(Paused { account: self.env().caller() }); } pub fn unpause(&mut self) { self.require_paused(); self.is_paused.set(false); self.env().emit_event(Unpaused { account: self.env().caller() }); } } pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused). ","version":"next","tagName":"h3"},{"title":"Pausable counter​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#pausable-counter","content":"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused). pauseable.rs ... use odra::SubModule; ... #[odra::module] pub struct PausableCounter { value: Var<u32>, pauseable: SubModule<Pausable> } #[odra::module] impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); let new_value = self.value.get_or_default() + 1; self.value.set(new_value); } pub fn pause(&mut self) { self.pauseable.pause(); } pub fn unpause(&mut self) { self.pauseable.unpause(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } #[cfg(test)] mod test { use super::*; use odra::host::{Deployer, NoArgs}; #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); assert_eq!( contract.try_increment().unwrap_err(), Error::UnpausedRequired.into() ); assert_eq!(contract.get_value(), 1); } } As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy! ","version":"next","tagName":"h2"},{"title":"Advanced Storage Concepts","type":0,"sectionRef":"#","url":"/docs/advanced/advanced-storage","content":"","keywords":"","version":"1.0.0"},{"title":"Recap and Basic Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#recap-and-basic-concepts","content":"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values. Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract. Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key. List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over. If you need a refresher on these topics, please refer to our guide on basic storage in Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Advanced Storage Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#advanced-storage-concepts-1","content":"","version":"1.0.0","tagName":"h2"},{"title":"Sequence​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#sequence","content":"The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value. pub struct Sequence<T> where T: Num + One + ToBytes + FromBytes + CLTyped { value: Var<T> } The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively. ","version":"1.0.0","tagName":"h3"},{"title":"Advanced Mapping​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#advanced-mapping","content":"In Odra, a Mapping is a key-value storage system where the key is associated with a value. In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute. However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state. Let's consider the following example: examples/src/features/storage/mapping.rs use odra::{casper_types::U256, Mapping, UnwrapOrRevert}; use odra::prelude::*; use crate::owned_token::OwnedToken; #[odra::module] pub struct Mappings { strings: Mapping<(String, u32, String), String>, tokens: Mapping<String, OwnedToken> } #[odra::module] impl Mappings { ... pub fn total_supply(&mut self, token_name: String) -> U256 { self.tokens.module(&token_name).total_supply() } pub fn get_string_api( &self, key1: String, key2: u32, key3: String ) -> String { let opt_string = self.strings.get(&(key1, key2, key3)); opt_string.unwrap_or_revert(&self.env()) } } As you can see, a Mapping key can consist of a tuple of values, not limited to a single value. note Accessing Odra modules differs from accessing regular values such as strings or numbers. Firstly, within a Mapping, you don't encapsulate the module with Submodule. Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules. ","version":"1.0.0","tagName":"h3"},{"title":"AdvancedStorage Contract​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#advancedstorage-contract","content":"The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts. use odra::{Address, casper_types::U512, Sequence, Mapping}; use odra::prelude::*; use crate::modules::Token; #[odra::module] pub struct AdvancedStorage { counter: Sequence<u32>, tokens: Mapping<(String, String), Token>, } impl AdvancedStorage { pub fn current_value(&self) -> u32 { self.counter.get_current_value() } pub fn increment_and_get(&mut self) -> u32 { self.counter.next_value() } pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 { let token = self.tokens.module(&(token_name, creator)); token.balance_of(&address) } pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) { let mut token = self.tokens.module(&(token_name, creator)); token.mint(amount, to); } } ","version":"1.0.0","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#conclusion","content":"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are: Odra offers a Sequence module, enabling contracts to store and increment a single value.Mappings support composite keys expressed as tuples and can store modules as values. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts. ","version":"1.0.0","tagName":"h2"},{"title":"Building contracts manually","type":0,"sectionRef":"#","url":"/docs/advanced/building-manually","content":"","keywords":"","version":"1.0.0"},{"title":"Building the contract manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#building-the-contract-manually","content":"To build the contract manually, cargo odra uses the following command: ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract info Odra uses the environment variable ODRA_MODULE to determine which contract to build. Assuming that project's crate is named my_project, this command will build the my_contract contract in release mode and generate the wasm file. The file will be put into the target/wasm32-unknown-unknown/release directory under the name my_project_build_contract.wasm. The Odra Framework expects the contracts to be placed in the wasm directory, and to be named correctly, so the next step would be to move the file: mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm ","version":"1.0.0","tagName":"h2"},{"title":"Optimizing the contract​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#optimizing-the-contract","content":"To lower the size of the wasm file, cargo odra uses the wasm-strip tool: wasm-strip wasm/my_contract.wasm To further optimize the wasm file, the wasm-opt tool is also used. wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm danger This step is required, as the wasm file generated by the Rust compiler is not fully compatible with the Casper execution engine. ","version":"1.0.0","tagName":"h2"},{"title":"Running the tests manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#running-the-tests-manually","content":"To run the tests manually, Odra needs to know which backend to use. To run tests against Casper backend, the following command needs to be used: ODRA_BACKEND=casper cargo test ","version":"1.0.0","tagName":"h2"},{"title":"Wrapping up​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#wrapping-up","content":"Let's say we want to build the my_contract in debug mode, run the tests against the casper backend and use the my-own-allocator feature from our my_project project. To do that, we can use the following set of commands: ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm wasm-strip wasm/my_contract.wasm wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm ODRA_BACKEND=casper cargo test --features my-own-allocator ","version":"1.0.0","tagName":"h2"},{"title":"Attributes","type":0,"sectionRef":"#","url":"/docs/advanced/attributes","content":"","keywords":"","version":"1.0.0"},{"title":"Payable​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#payable","content":"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens. ","version":"1.0.0","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#example","content":"examples/src/contracts/tlw.rs #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U256 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env.revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env() .emit_event(Deposit { address: caller, amount }); } If you try to send tokens to a non-payable function, the transaction will be automatically rejected. ","version":"1.0.0","tagName":"h3"},{"title":"Non Reentrant​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#non-reentrant","content":"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. They can also use reentrancy guards to block recursive calls to sensitive functions. In Odra you can just apply the #[odra(non_reentrant)] attribute to your function. ","version":"1.0.0","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#example-1","content":"#[odra::module] pub struct NonReentrantCounter { counter: Var<u32> } #[odra::module] impl NonReentrantCounter { #[odra(non_reentrant)] pub fn count_ref_recursive(&mut self, n: u32) { if n > 0 { self.count(); ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1); } } } impl NonReentrantCounter { fn count(&mut self) { let c = self.counter.get_or_default(); self.counter.set(c + 1); } } #[cfg(test)] mod test { use super::*; use odra::{host::{Deployer, NoArgs}, ExecutionError}; #[test] fn ref_recursion_not_allowed() { let test_env = odra_test::env(); let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs); let result = contract.count_ref_recursive(11); assert_eq!(result, ExecutionError::ReentrantCall.into()); } } ","version":"1.0.0","tagName":"h3"},{"title":"Mixing attributes​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#mixing-attributes","content":"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. To apply multiple attributes, you can write: #[odra(payable, non_reentrant)] fn deposit() { // your logic... } or #[odra(payable)] #[odra(non_reentrant)] fn deposit() { // your logic... } In both cases attributes order does not matter. ","version":"1.0.0","tagName":"h2"},{"title":"Using Proxy Caller","type":0,"sectionRef":"#","url":"/docs/next/tutorials/using-proxy-caller","content":"","keywords":"","version":"next"},{"title":"Contract​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/next/tutorials/using-proxy-caller#contract","content":"For this tutorial, we will use the TimeLockWallet contract from our examples. examples/src/contracts/tlw.rs use odra::prelude::*; use odra::{casper_types::U512, Address, Mapping, Var}; #[odra::module(errors = Error, events = [Deposit, Withdrawal])] pub struct TimeLockWallet { balances: Mapping<Address, U512>, lock_expiration_map: Mapping<Address, u64>, lock_duration: Var<u64> } #[odra::module] impl TimeLockWallet { /// Initializes the contract with the lock duration. pub fn init(&mut self, lock_duration: u64) { self.lock_duration.set(lock_duration); } /// Deposits the tokens into the contract. #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U512 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env().revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env().emit_event(Deposit { address: caller, amount }); } /// Withdraws the tokens from the contract. pub fn withdraw(&mut self, amount: &U512) { // code omitted for brevity } /// Returns the balance of the given account. pub fn get_balance(&self, address: &Address) -> U512 { // code omitted for brevity } /// Returns the lock duration. pub fn lock_duration(&self) -> u64 { // code omitted for brevity } } /// Errors that may occur during the contract execution. #[odra::odra_error] pub enum Error { LockIsNotOver = 1, CannotLockTwice = 2, InsufficientBalance = 3 } /// Deposit event. #[odra::event] pub struct Deposit { pub address: Address, pub amount: U512 } /// Withdrawal event. #[odra::event] pub struct Withdrawal { pub address: Address, pub amount: U512 } Full code can be found here. ","version":"next","tagName":"h2"},{"title":"Client​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/next/tutorials/using-proxy-caller#client","content":"Before we can interact with the node, we need to set it up. We will use the casper-nctl-docker image. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Make sure you have the contract's wasm file and the secret key. # Build the contract cargo odra build -c TimeLockWallet # Extract secret key docker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem RustTypeScript To interact with the contract, we use the livenet backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case). Cargo.toml [package] name = "odra-examples" version = "1.1.0" edition = "2021" [dependencies] odra = { path = "../odra", default-features = false } ... # other dependencies odra-casper-livenet-env = { version = "1.1.0", optional = true } ... # other sections [features] default = [] livenet = ["odra-casper-livenet-env"] ... # other sections [[bin]] name = "tlw_on_livenet" path = "bin/tlw_on_livenet.rs" required-features = ["livenet"] test = false ... # other sections examples/bin/tlw_on_livenet.rs //! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs. use odra::casper_types::{AsymmetricType, PublicKey, U512}; use odra::host::{Deployer, HostRef}; use odra::Address; use odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs}; const DEPOSIT: u64 = 100; const WITHDRAWAL: u64 = 99; const GAS: u64 = 20u64.pow(9); fn main() { let env = odra_casper_livenet_env::env(); let caller = env.get_account(0); env.set_caller(caller); env.set_gas(GAS); let mut contract = TimeLockWalletHostRef::deploy( &env, TimeLockWalletInitArgs { lock_duration: 60 * 60 } ); // Send 100 CSPRs to the contract. contract .with_tokens(U512::from(DEPOSIT)) .deposit(); println!("Caller's balance: {:?}", contract.get_balance(&caller)); // Withdraw 99 CSPRs from the contract. contract.withdraw(&U512::from(WITHDRAWAL)); println!("Remaining balance: {:?}", contract.get_balance(&caller)); } To run the code, execute the following command: ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \\ ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \\ ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \\ cargo run --bin tlw_on_livenet --features=livenet # Sample output 💁 INFO : Deploying "TimeLockWallet". 💁 INFO : Found wasm under "wasm/TimeLockWallet.wasm". 🙄 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558". 💁 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed. 💁 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed. 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy. 🙄 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3". 💁 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed. Caller's balance: 100 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw". 🙄 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e". 💁 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed. Remaining balance: 1 As observed, the contract was successfully deployed, and the Caller deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR. The logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity. ","version":"next","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/next/tutorials/using-proxy-caller#conclusion","content":"In this tutorial, we learned how to use the proxy_caller wasm to make a payable function call. We deployed the TimeLockWallet contract, deposited tokens using the proxy_caller with attached CSPRs, and withdrew them. You got to try it out in both Rust and TypeScript, so you can choose whichever you prefer. Rust code seemed simpler, thanks to the Odra livenet backend making chain interactions easier to handle. ","version":"next","tagName":"h2"},{"title":"Delegate","type":0,"sectionRef":"#","url":"/docs/advanced/delegate","content":"","keywords":"","version":"1.0.0"},{"title":"Overview​","type":1,"pageTitle":"Delegate","url":"/docs/advanced/delegate#overview","content":"To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand. You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself. ","version":"1.0.0","tagName":"h2"},{"title":"Code Examples​","type":1,"pageTitle":"Delegate","url":"/docs/advanced/delegate#code-examples","content":"Consider the following basic example for better understanding: use crate::{erc20::Erc20, ownable::Ownable}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256); fn approve(&mut self, spender: Address, amount: U256); fn name(&self) -> String; fn symbol(&self) -> String; fn decimals(&self) -> u8; fn total_supply(&self) -> U256; fn balance_of(&self, owner: Address) -> U256; fn allowance(&self, owner: Address, spender: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; fn change_ownership(&mut self, new_owner: Address); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality. The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities. Let's take a look at another example. use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct DeFiPlatform { ownable: SubModule<Ownable>, erc20: SubModule<Erc20>, exchange: SubModule<Exchange> } #[odra::module] impl DeFiPlatform { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); self.exchange.init(exchange_rate); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn balance_of(&self, owner: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; } to self.exchange { fn swap(&mut self, sender: Address, recipient: Address); fn set_exchange_rate(&mut self, new_rate: u64); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure. Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts. ","version":"1.0.0","tagName":"h2"},{"title":"Storage Layout","type":0,"sectionRef":"#","url":"/docs/advanced/storage-layout","content":"","keywords":"","version":"1.0.0"},{"title":"Casper VM Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#casper-vm-perspective","content":"The Casper Execution Engine (VM) enables the storage of data in named keys or dictionaries. However, a smart contract has a limited number of named keys, making it unsuitable for storing substantial data volumes. Odra resolves this issue by storing all user-generated data in a dictionary called state. This dictionary operates as a key-value store, where keys are strings with a maximum length of 64 characters, and values are arbitrary byte arrays. Here is an example of what the interface for reading and writing data could look like: pub trait CasperStorage { fn read(key: &str) -> Option<Vec<u8>>; fn write(key: &str, value: Vec<u8>); } ","version":"1.0.0","tagName":"h2"},{"title":"Odra Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#odra-perspective","content":"Odra was conceived with modularity and code reusability in mind. Additionally, we aimed to streamline storage definition through the struct object. Consider this straightforward storage definition: #[odra::module] pub struct Token { name: Var<String>, balances: Mapping<Address, U256> } The Token structure contains two fields: name of type String andbalances, which functions as a key-value store with Address as keys andU256 as values. The Token module can be reused in another module, as demonstrated in a more complex example: #[odra::module] pub struct Loans { lenders: SubModule<Token>, borrowers: SubModule<Token>, } The Loans module has two fields: lenders and borrowers, both of which have the same storage layout as defined by the Token module. Odra guarantees thatlenders and borrowers are stored under distinct keys within the storage dictionary. Both Token and Loans serve as examples to show how Odra's storage layout operates. ","version":"1.0.0","tagName":"h2"},{"title":"Key generation.​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#key-generation","content":"Every element of a module (struct) with N elements is associated with an index ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an element of a module is another module (SubModule<...>), the associated index serves as a prefix for the indexes of the inner module. While this may initially appear complex, it is easily understood through an example. In the example, indexes are presented as bytes, reflecting the actual implementation. Loans { lenders: Token { // prefix: 0x0001 name: 1, // key: 0x0001_0001 balances: 2 // key: 0x0001_0010 }, borrowers: Token { // prefix: 0x0010 name: 1, // key: 0x0010_0001 balances: 2 // key: 0x0010_0010 } } Additionally, it's worth mentioning how Mapping's keys are used in thestorage. They are simply concatenated with the index of the module, as demonstrated in the example. For instance, triggering borrowers.balances.get(0x1234abcd) would result in a key: 0x0001_0001_1234_abcd Finally, the key must be hashed to fit within the 64-character limit and then encoded in hexadecimal format. ","version":"1.0.0","tagName":"h2"},{"title":"Value serialization​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#value-serialization","content":"Before being stored in the storage, each value is serialized into bytes using the CLType serialization method and subsequently encapsulated with Casper'sBytes types. ","version":"1.0.0","tagName":"h2"},{"title":"Memory allocators","type":0,"sectionRef":"#","url":"/docs/advanced/using-different-allocator","content":"","keywords":"","version":"1.0.0"},{"title":"Using a different allocator​","type":1,"pageTitle":"Memory allocators","url":"/docs/advanced/using-different-allocator#using-a-different-allocator","content":"If the default allocator does not suit your needs, or you use a crate that already provides an allocator, you can disable the default allocator by enabling the disable-allocator feature in the odra dependency in your project: [dependencies] odra = { path = "../odra", features = ["disable-allocator"] } If you want to have a better control over the features that are enabled during the building and tests, see the next article on building manually. ","version":"1.0.0","tagName":"h2"},{"title":"OdraVM","type":0,"sectionRef":"#","url":"/docs/backends/odra-vm","content":"","keywords":"","version":"1.0.0"},{"title":"Usage​","type":1,"pageTitle":"OdraVM","url":"/docs/backends/odra-vm#usage","content":"The OdraVM is the default backend for Odra framework, so each time you run cargo odra test You are running your code against it. ","version":"1.0.0","tagName":"h2"},{"title":"Architecture​","type":1,"pageTitle":"OdraVM","url":"/docs/backends/odra-vm#architecture","content":"OdraVM consists of two main parts: the Contract Register and the State. The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address. Contracts and Test Env functions can modify the State of the OdraVM. Contrary to the "real" backend, which holds the whole history of the blockchain, the OdraVM State holds only the current state of the OdraVM. Thanks to this and the fact that we do not need the blockchain itself, OdraVM starts instantly and runs the tests in the native speed. ","version":"1.0.0","tagName":"h2"},{"title":"Execution​","type":1,"pageTitle":"OdraVM","url":"/docs/backends/odra-vm#execution","content":"When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting your pub functions into a list of Entrypoints, which are put into a Contract Container. When the contract is deployed, its Container registered into a Registry under an address. During the contract call, OdraVM finds an Entrypoint and executes the code. ","version":"1.0.0","tagName":"h2"},{"title":"Casper","type":0,"sectionRef":"#","url":"/docs/backends/casper","content":"","keywords":"","version":"1.0.0"},{"title":"Contract Env​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#contract-env","content":"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances. ","version":"1.0.0","tagName":"h2"},{"title":"Events​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#events","content":"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity. Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed: __events - a dictionary that stores events' data.__events_length - the evens count.__events_ces_version - the version of Casper Event Standard. __events_schema - a dictionary that stores event schemas. Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key. So, Events are nothing different from any other data stored by a contract. A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event]. note Don't forget to expose events in the module using #[odra::module(events = [...])]. ","version":"1.0.0","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#payable","content":"The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key. Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse. Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. If under the way something goes wrong with the transfer, the contract reverts. The transferred amount can be read inside the contract by calling self.env().attached_value(). note Odra expects the cargo_purse runtime argument to be attached to a contract call. In case of its absence, the contract_env::attached_value() returns zero. ","version":"1.0.0","tagName":"h3"},{"title":"Revert​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#revert","content":"In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User. ","version":"1.0.0","tagName":"h3"},{"title":"Context​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#context","content":"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack. The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address. The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address. As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse. ","version":"1.0.0","tagName":"h3"},{"title":"Test Env​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#test-env","content":"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine. In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000). The Test Env internally keeps track of the current block time, error and attached value. Each test is executed on a fresh instance of the Test Env. ","version":"1.0.0","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#usage","content":"Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -bparameter: cargo odra test -b casper If you want to just generate a wasm file, simply run: cargo odra build -b casper ","version":"1.0.0","tagName":"h2"},{"title":"Deploying a contract to Casper network​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#deploying-a-contract-to-casper-network","content":"There would be no point in writing a contract if you couldn't deploy it to the blockchain. You can do it in two ways: provided by the Casper itself: using the casper-client tool or using the Odra's Livenet integration. Let's explore the first option to better understand the process. note If you wish, you can skip the following section and jump to the Livenet integration. ","version":"1.0.0","tagName":"h2"},{"title":"WASM arguments​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#wasm-arguments","content":"When deploying a new contract you can pass some arguments to it. Every contract written in Odra expects those arguments to be set: odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable. Additionally, if required by the contract, you can pass constructor arguments. When working with the test env via cargo odra or when usingLivenet integration this is handled automatically. However, if you rather usecasper-client directly, you have to pass them manually: ","version":"1.0.0","tagName":"h3"},{"title":"Example: Deploy Counter​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#example-deploy-counter","content":"To deploy your contract with a constructor using casper-client, you need to pass the above arguments. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 5000000000000 \\ --session-path ./wasm/counter.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "value:u32:42" For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'. ","version":"1.0.0","tagName":"h3"},{"title":"Example: Deploy ERC721​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#example-deploy-erc721","content":"Odra comes with a standard ERC721 token implementation. Clone the main Odra repo and navigate to the modules directory. Firstly contract needs to be compiled. cargo odra build -b casper -c erc721_token It produces the erc721_token.wasm file in the wasm directory. Now it's time to deploy the contract. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc721_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string:'MyNFT'" \\ --session-arg "symbol:string:'NFT'" \\ --session-arg "base_uri:string:'https://example.com/'" It's done. The contract is deployed and ready to use. Your account is the owner of the contract and you can mint and burn tokens. For more details see the code of the ERC721 module. To obtain the package hash of the contract search for my_nft key in your account's named keys. ","version":"1.0.0","tagName":"h3"},{"title":"Example: Deploy ERC1155​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#example-deploy-erc1155","content":"The process is similar to the one described in the previous section. Contract compilation: cargo odra build -b casper -c erc1155_token Contract deployment: casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc1155_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ As previously, your account is the owner and can mint and burn tokens. For more details see the code of the ERC1155 module. ","version":"1.0.0","tagName":"h3"},{"title":"Sending CSPR to a contract​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#sending-cspr-to-a-contract","content":"Defining payable entry points is described in Native Token section. What is happening under the hood is that Odra creates a new cargo_purse argument for each payable entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. When a contract adds CSPR to another contract call, Odra handles it for you. The problem arises when you want to call an entry point and attach CSPR as an account. The only way of doing that is by executing code in the sessions context, that top-ups the cargo_purse and then calls the contract. Odra provides a generic proxy_caller.wasm that does exactly that. You can build it by yourself from the main Odra repository, or use the proxy_caller.wasmwe maintain. ","version":"1.0.0","tagName":"h2"},{"title":"Using proxy_caller.wasm​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#using-proxy_callerwasm","content":"To use the proxy_caller.wasm you need to attach the following arguments: contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. Result of to_bytes on CasperPackageHash.entry_point - String type. The name of the entry point you want to call.args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.attached_value. U512 type. The amount of CSPR you want to attach to the call.amount. U512 type. Should be the same value as attached_value if not None. It is a special Casper argument that enables the access to account's main purse. Currently casper-client doesn't allow building such arguments. You have to build it using your SDK. See an example in the Tutorial section. ","version":"1.0.0","tagName":"h3"},{"title":"Execution​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#execution","content":"First thing Odra does with your code, is similar to the one used in OdraVM - a list of entrypoints is generated, thanks to the #[odra::module] attribute. ","version":"1.0.0","tagName":"h2"},{"title":"What is a backend?","type":0,"sectionRef":"#","url":"/docs/backends/what-is-a-backend","content":"","keywords":"","version":"1.0.0"},{"title":"Contract Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/backends/what-is-a-backend#contract-env","content":"The Contract Env is a simple interface that each backend needs to implement, exposing features of the blockchain from the perspective of the contract. It gives Odra a set of functions, which allows implementing more complex concepts - for example, to implement Mapping, Odra requires some kind of storage integration. The exact implementation of those functions is a responsibility of a backend, making Odra and its user free to implement the contract logic, instead of messing with the blockchain internals. Other functions from Contract Env include handling transfers, addresses, block time, errors and events. ","version":"1.0.0","tagName":"h2"},{"title":"Host Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/backends/what-is-a-backend#host-env","content":"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with the backend from the outside world - really useful for implementing tests. This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, to the more test-oriented - handling errors, forwarding the block time, etc. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"What is a backend?","url":"/docs/backends/what-is-a-backend#whats-next","content":"We will take a look at backends Odra implements in more detail. ","version":"1.0.0","tagName":"h2"},{"title":"Livenet","type":0,"sectionRef":"#","url":"/docs/backends/livenet","content":"","keywords":"","version":"1.0.0"},{"title":"Setup​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#setup","content":"To use Livenet backend, we need to provide Odra with some information - the network address, our private key and the name of the chain we want to use. Optionally, we can add multiple private keys to use more than one account in our tests. Those values are passed using environment variables. We can use .env file to store them - let's take a look at an example .env file, created from the .env.sample file from examples folder: # Path to the secret key of the account that will be used # to deploy the contracts. # We're using .keys folder so we don't accidentally commit # the secret key to the repository. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777 # Chain name of the network. Known values: # - integration-test ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test # Paths to the secret keys of the additional accounts. # Main secret key will be 0th account. ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. Let's go through the code: fn main() { // Similar to the OdraVM backend, we need to initialize // the environment: let env = odra_casper_livenet_env::env(); // Most of the for the host env works the same as in the // OdraVM backend. let owner = env.caller(); // Addresses are the real addresses on the blockchain, // so we need to provide them // if we did not import their secret keys. let recipient = "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"; let recipient = Address::from_str(recipient).unwrap(); // Arguments for the contract init method. let name = String::from("Plascoin"); let symbol = String::from("PLS"); let decimals = 10u8; let initial_supply: U256 = U256::from(10_000); // The main difference between other backends - we need to specify // the gas limit for each action. // The limit will be used for every consecutive action // until we change it. env.set_gas(100_000_000_000u64); // Deploy the contract. The API is the same as in the OdraVM backend. let init_args = Erc20InitArgs { name, symbol, decimals, initial_supply: Some(initial_supply) }; let mut token = Erc20HostRef::deploy(env, init_args); // We can now use the contract as we would in the OdraVM backend. println!("Token address: {}", token.address().to_string()); // Uncomment to load existing contract. // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; // let address = Address::from_str(address).unwrap(); // We use the Livenet-specific `load` method to load the contract // that is already deployed. // let mut token = Erc20Deployer::load(env, address); // Non-mutable calls are free! Neat, huh? More on that later. println!("Token name: {}", token.name()); // The next call is mutable, but the cost is lower that the deployment, // so we change the amount of gas env.set_gas(3_000_000_000u64); token.transfer(recipient, U256::from(1000)); println!("Owner's balance: {:?}", token.balance_of(owner)); println!("Recipient's balance: {:?}", token.balance_of(recipient)); } note The above example is a rust binary, not a test. Note that it is also added as a section of theCargo.toml file: [bin] name = "erc20_on_livenet" path = "src/bin/erc20_on_livenet.rs" required-features = ["livenet"] test = false ","version":"1.0.0","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#usage","content":"To run the above code, we simply need to run the binary with the livenet feature enabled: cargo run --bin erc20_on_livenet --features=livenet note Before executing the binary, make sure you built a wasm file. A part of a sample output should look like this: ... 💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 💁 INFO : Deploy "65b1a5d21..." successfully executed. Owner's balance: 4004 Recipient's balance: 4000 Those logs are a result of the last 4 lines of the above listing. Each deployment or a call to the blockchain will be noted and will take some time to execute. We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant and cost us nothing. How it is possible? info You can see the deployment on http://cspr.live/ - the transfer from the example can be seen here. ","version":"1.0.0","tagName":"h2"},{"title":"How Livenet backend works​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#how-livenet-backend-works","content":"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. It is possible however to query the state of the blockchain for free. This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the node is the current state. This is why the balance_of call was almost instant and free. Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract (see Cross Calls), it is executed offline and node is used for the state query only. However, the Livenet needs to know the connection between the contracts and the code, so make sure to deploy or load already deployed contracts ","version":"1.0.0","tagName":"h2"},{"title":"Multiple environments​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#multiple-environments","content":"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, multiple nodes or even multiple chains. To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file has to be used first. If your integration.env file has a value that IS present in the .env file, it will override the value from the .env file. ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet To sum up - this command will firstly load the integration.env file and then load the missing values from .env file. ","version":"1.0.0","tagName":"h2"},{"title":"Cargo Odra","type":0,"sectionRef":"#","url":"/docs/basics/cargo-odra","content":"","keywords":"","version":"1.0.0"},{"title":"Managing projects​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#managing-projects","content":"Two commands help you create a new project. The first one is cargo odra new. You need to pass one parameter, namely --name {PROJECT_NAME}: cargo odra new --name my-project This creates a new project in the my_project folder and name it my_project. You can see it for yourself, for example by taking a look into a Cargo.toml file created in your project's folder: [package] name = "my_project" version = "0.1.0" edition = "2021" The project is created using the template located in Odra's main repository. By default it uses full template, if you want, you can use minimalistic blank by running: cargo odra new -t blank --name my-project The third available template is workspace, which creates a workspace with two projects, similar to the one created with the full template. By default, the latest release of Odra will be used for the template and as a dependency. You can pass a source of Odra you want to use, by using -s parameter: cargo odra new -n my-project -s ../odra # will use local folder of odra cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release cargo odra new -n my-project -s 1.0.0 # will use a version released on crates.io The second way of creating a project is by using init command: cargo odra init --name my-project It works in the same way as new, but instead of creating a new folder, it creates a project in the current, empty directory. ","version":"1.0.0","tagName":"h2"},{"title":"Generating code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#generating-code","content":"If you want to quickly create a new contract code, you can use the generate command: cargo odra generate -c counter This creates a new file src/counter.rs with sample code, add appropriate use and mod sections to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, visit Odra.toml. ","version":"1.0.0","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#testing","content":"The most used command during the development of your project should be this one: cargo odra test It runs your tests against Odra's MockVM. It is substantially faster than CasperVMand implements all the features Odra uses. When you want to run tests against a "real" VM, just provide the name of the backend using -boption: cargo odra test -b casper In the example above, Cargo Odra builds the project, generates the wasm files, spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat. Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. This is why OdraVM was created and should be your first choice when developing contracts. Of course, testing all of your code against a blockchain VM is a must in the end. If you want to run only some of the tests, you can pass arguments to the cargo test command (which is run in the background obviously): cargo odra test -- this-will-be-passed-to-cargo-test If you want to run tests which names contain the word two, you can execute: cargo odra test -- two Of course, you can do the same when using the backend: cargo odra test -b casper -- two ","version":"1.0.0","tagName":"h2"},{"title":"Building code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#building-code","content":"You can also build the code itself and generate the output contracts without running the tests. To do so, simply run: cargo odra build If the build process finishes successfully, wasm files will be located in wasm folder. Notice, that this command does not require the -b option. If you want to build specific contract, you can use -c option: cargo odra build -c counter # you pass many comma separated contracts ","version":"1.0.0","tagName":"h2"},{"title":"Generating contract schema​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#generating-contract-schema","content":"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command: cargo odra schema This generates a schema file in JSON format for all your contracts and places them in the resources folder. If the resources folder does not exist, it creates the folder for you. Like with the build command, you can use the -c option to generate a schema for a specific contract. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#whats-next","content":"In the next section, we will take a look at all the files and directories that cargo odra created for us and explain their purpose. ","version":"1.0.0","tagName":"h2"},{"title":"Host Communication","type":0,"sectionRef":"#","url":"/docs/basics/communicating-with-host","content":"","keywords":"","version":"1.0.0"},{"title":"What's next​","type":1,"pageTitle":"Host Communication","url":"/docs/basics/communicating-with-host#whats-next","content":"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code we presented in fact works! ","version":"1.0.0","tagName":"h2"},{"title":"Directory structure","type":0,"sectionRef":"#","url":"/docs/basics/directory-structure","content":"","keywords":"","version":"1.0.0"},{"title":"Cargo.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#cargotoml","content":"Let's first take a look at Cargo.toml file: [package] name = "sample" version = "0.1.0" edition = "2021" [dependencies] odra = "1.0.0" [dev-dependencies] odra-test = "1.0.0" [build-dependencies] odra-build = "1.0.0" [[bin]] name = "sample_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "sample_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also added as a dev dependency. ","version":"1.0.0","tagName":"h2"},{"title":"Odra.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#odratoml","content":"This is the file that holds information about contracts that will be generated when running cargo odra build andcargo odra test: [[contracts]] fqn = "sample::Flipper" As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to the contract is located in src/flipper.rs. More contracts can be added here by hand, or by using cargo odra generate command. ","version":"1.0.0","tagName":"h2"},{"title":"src/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#src","content":"This is the folder where your smart contract files live. ","version":"1.0.0","tagName":"h2"},{"title":"bin/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#bin","content":"This is the folder where scripts that will be used to generate code or schemas live. You don't need to modify those files, they are generated by cargo odra new command and are used by cargo odra build, cargo odra test and cargo odra schema commands. ","version":"1.0.0","tagName":"h2"},{"title":"target/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#target","content":"Files generated by cargo during the build process are put here. ","version":"1.0.0","tagName":"h2"},{"title":"wasm/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#wasm","content":"WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files and deploy them on the blockchain. What's next Now, let's take a look at one of the files mentioned above in more detail, namely the Odra.toml file. ","version":"1.0.0","tagName":"h2"},{"title":"Cross calls","type":0,"sectionRef":"#","url":"/docs/basics/cross-calls","content":"","keywords":"","version":"1.0.0"},{"title":"Contract Ref​","type":1,"pageTitle":"Cross calls","url":"/docs/basics/cross-calls#contract-ref","content":"We mentioned HostRef already in our Testing article - a host side reference to already deployed contract. In the module context we use a ContractRef instead, to call other contracts. Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, by the #[odra::module] attribute. To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above. The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module]impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract. External Contracts Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI. For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of. Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere. #[odra::external_contract] pub trait Adder { fn add(&self, n1: u32, n2: u32) -> u32; } Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call: AdderContractRef::new(self.env(), address).add(3, 5) ","version":"1.0.0","tagName":"h2"},{"title":"Loading the contract​","type":1,"pageTitle":"Cross calls","url":"/docs/basics/cross-calls#loading-the-contract","content":"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test our contracts in Livenet backend. We can load the contract using load method on the Deployer: examples/bin/erc20_on_livenet.rs fn _load(env: &HostEnv) -> Erc20HostRef { let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; let address = Address::from_str(address).unwrap(); <Erc20HostRef as HostRefLoader>::load(env, address) } ","version":"1.0.0","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"Cross calls","url":"/docs/basics/cross-calls#testing","content":"Let's see how we can test our cross calls using this knowledge: examples/src/features/cross_calls.rs #[cfg(test)] mod tests { use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef}; use odra::host::{Deployer, HostRef, NoArgs}; #[test] fn test_cross_calls() { let test_env = odra_test::env(); let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs); let cross_contract = CrossContractHostRef::deploy( &test_env, CrossContractInitArgs { math_engine_address: *math_engine_contract.address() } ); assert_eq!(cross_contract.add_using_another(), 8); } } Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize. #[cfg(test)] mod tests { use super::*; use odra::{Address, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_ext() { let test_env = odra_test::env(); let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5) assert_eq!(adder.add(1, 2), 3); } fn get_adder_address(test_env: &HostEnv) -> Address { let contract = MathEngineHostRef::deploy(test_env, NoArgs); *contract.address() } } ","version":"1.0.0","tagName":"h2"},{"title":"Casper Contract Schema","type":0,"sectionRef":"#","url":"/docs/basics/casper-contract-schema","content":"","keywords":"","version":"1.0.0"},{"title":"Odra and CCS​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#odra-and-ccs","content":"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory. note If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema. src/contract.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module( // the name of the contract, default is the module name name = "MyContract", // the version of the contract, default is the version of the crate version = "0.1.0", // events that the contract can emit, collected recursively if submodules are used events = [ Created, Updated ], // the error enum the contract can revert with, collected recursively if submodules are used errors = MyErrors )] pub struct MyContract { name: Var<String>, owner: Var<Address>, } #[odra::module] impl MyContract { /// Initializes the contract, sets the name and owner and emits an event pub fn init(&mut self, name: String, owner: Address) { self.name.set(name.clone()); self.owner.set(owner.clone()); self.env().emit_event(Created { name }); } /// Updates the name of the contract and emits an event pub fn update(&mut self, name: String) { self.name.set(name.clone()); self.env().emit_event(Updated { name }); } /// Returns the data of the contract pub fn get_data(&self) -> Data { Data { name: self.name.get_or_default(), owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner), } } } // The struct will we visible in the schema in the types section #[odra::odra_type] pub struct Data { name: String, owner: Address, } // The enum variants will we visible in the schema in the errors section #[odra::odra_error] pub enum MyErrors { /// The owner is invalid InvalidOwner, /// The name is invalid InvalidName, } // The struct will we visible in the schema in the types and events section #[odra::event] pub struct Updated { name: String, } // The struct will we visible in the schema in the types section and events section #[odra::event] pub struct Created { name: String, } ","version":"1.0.0","tagName":"h2"},{"title":"Generating the Schema​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#generating-the-schema","content":"To generate the schema run the following cargo-odra command: cargo odra schema # or pass -c flag to generate the schema for a specific contract ","version":"1.0.0","tagName":"h2"},{"title":"Schema Output​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#schema-output","content":"The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema: resources/my_contract_schema.json { "casper_contract_schema_version": 1, "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)", "authors": [], "repository": null, "homepage": null, "contract_name": "MyContract", "contract_version": "0.1.0", "types": [ { "struct": { "name": "Created", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } }, { "struct": { "name": "Data", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" }, { "name": "owner", "description": null, "ty": "Key" } ] } }, { "struct": { "name": "Updated", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } } ], "errors": [ { "name": "InvalidName", "description": "The name is invalid", "discriminant": 1 }, { "name": "InvalidOwner", "description": "The owner is invalid", "discriminant": 0 } ], "entry_points": [ { "name": "update", "description": "Updates the name of the contract and emits an event", "is_mutable": true, "arguments": [ { "name": "name", "description": null, "ty": "String", "optional": false } ], "return_ty": "Unit", "is_contract_context": true, "access": "public" }, { "name": "get_data", "description": "Returns the data of the contract", "is_mutable": false, "arguments": [], "return_ty": "Data", "is_contract_context": true, "access": "public" } ], "events": [ { "name": "Created", "ty": "Created" }, { "name": "Updated", "ty": "Updated" } ], "call": { "wasm_file_name": "MyContract.wasm", "description": "Initializes the contract, sets the name and owner and emits an event", "arguments": [ { "name": "odra_cfg_package_hash_key_name", "description": "The arg name for the package hash key name.", "ty": "String", "optional": false }, { "name": "odra_cfg_allow_key_override", "description": "The arg name for the allow key override.", "ty": "Bool", "optional": false }, { "name": "odra_cfg_is_upgradable", "description": "The arg name for the contract upgradeability setting.", "ty": "Bool", "optional": false }, { "name": "name", "description": null, "ty": "String", "optional": false }, { "name": "owner", "description": null, "ty": "Key", "optional": false } ] } } ","version":"1.0.0","tagName":"h2"},{"title":"Schema Fields​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#schema-fields","content":"casper_contract_schema_version is the version of the schema.toolchain is the version of the Rust compiler used to compile the contract.Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments. ","version":"1.0.0","tagName":"h2"},{"title":"Errors","type":0,"sectionRef":"#","url":"/docs/basics/errors","content":"","keywords":"","version":"1.0.0"},{"title":"Testing errors​","type":1,"pageTitle":"Errors","url":"/docs/basics/errors#testing-errors","content":"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner: examples/src/features/handling_errors.rs #[cfg(test)] mod tests { use super::{Error, OwnedContractHostRef, OwnedContractInitArgs}; use odra::{host::Deployer, prelude::*}; #[test] fn test_owner_error() { let test_env = odra_test::env(); let owner = test_env.get_account(0); let not_an_owner = test_env.get_account(1); test_env.set_caller(owner); let init_args = OwnedContractInitArgs { name: "OwnedContract".to_string() }; let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args); test_env.set_caller(not_an_owner); assert_eq!( owned_contract.try_change_name("NewName".to_string()), Err(Error::NotAnOwner.into()) ); } } Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult.OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and and safe its safe version: try_name, try_owner, try_change_name. In our example, we are calling try_change_name and expecting an error to be thrown. For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, we need to convert our custom error to OdraError using Into::into(). ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Errors","url":"/docs/basics/errors#whats-next","content":"We will learn how to emit and test events using Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Events","type":0,"sectionRef":"#","url":"/docs/basics/events","content":"","keywords":"","version":"1.0.0"},{"title":"Testing events​","type":1,"pageTitle":"Events","url":"/docs/basics/events#testing-events","content":"Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted: examples/src/features/events.rs use super::{PartyContractHostRef, PartyStarted}; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; #[test] fn test_party() { let test_env: HostEnv = odra_test::env(); let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs); test_env.emitted_event( party_contract.address(), &PartyStarted { caller: test_env.get_account(0), block_time: 0 } ); // If you do not want to check the exact event, you can use `emitted` function test_env.emitted(party_contract.address(), "PartyStarted"); // You can also check how many events were emitted. assert_eq!(test_env.events_count(party_contract.address()), 1); } To explore more event testing functions, check the HostEnv documentation. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Events","url":"/docs/basics/events#whats-next","content":"Read the next article to learn how to call other contracts from the contract context. ","version":"1.0.0","tagName":"h2"},{"title":"Flipper Internals","type":0,"sectionRef":"#","url":"/docs/basics/flipper-internals","content":"","keywords":"","version":"1.0.0"},{"title":"Header​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#header","content":"flipper.rs use odra::Var; Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation that can be reused between targets. In the above case, we're importing Var, which is responsible for storing simple values on the blockchain's storage. ","version":"1.0.0","tagName":"h2"},{"title":"Struct​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#struct","content":"flipper.rs /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } In Odra, all contracts are also modules, which can be reused between contracts. That's why we need to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all the fields of the contract. Those fields can be regular Rust data types, however - those will not be persisted on the blockchain. They can also be Odra modules - defined in your project or coming from Odra itself. Finally, to make the data persistent on the blockchain, you can use something likeVar<T> showed above. To learn more about storage interaction, take a look at thenext article. ","version":"1.0.0","tagName":"h2"},{"title":"Impl​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#impl","content":"flipper.rs /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } ... Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take allpub functions from this section and create contract endpoints from them. So, if you wish to have functions that are not available for calling outside the contract, do not make them public. Alternatively, you can create a separate impl section without the attribute - all functions defined there, even marked with pub will be not callable. The function named init is the constructor of the contract. This function will be limited to only to a single call, all further calls to it will result in an error. The init function is optional, if your contract does not need any initialization, you can skip it. flipper.rs ... /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } ... The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data saved there using set function will be persisted in the blockchain. ","version":"1.0.0","tagName":"h2"},{"title":"Tests​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#tests","content":"flipper.rs #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } ... You can write tests in any way you prefer and know in Rust. In the example above we are deploying the contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, as the second argument of the deploy function, we pass NoArgs - one of the implementations of the InitArgs trait provided with the framework. The contract will be deployed on the VM you chose while running cargo odra test. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#whats-next","content":"Now let's take a look at the different types of storage that Odra provides and how to use them. ","version":"1.0.0","tagName":"h2"},{"title":"Modules","type":0,"sectionRef":"#","url":"/docs/basics/modules","content":"","keywords":"","version":"1.0.0"},{"title":"Testing​","type":1,"pageTitle":"Modules","url":"/docs/basics/modules#testing","content":"As we don't need to hold addresses, the test is really simple: examples/src/features/modules.rs #[cfg(test)] mod tests { use super::ModulesContractHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn test_modules() { let test_env = odra_test::env(); let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs); assert_eq!(modules_contract.add_using_module(), 8); } } ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Modules","url":"/docs/basics/modules#whats-next","content":"We will see how to handle native token transfers. ","version":"1.0.0","tagName":"h2"},{"title":"Odra.toml","type":0,"sectionRef":"#","url":"/docs/basics/odra-toml","content":"","keywords":"","version":"1.0.0"},{"title":"Adding a new contract manually​","type":1,"pageTitle":"Odra.toml","url":"/docs/basics/odra-toml#adding-a-new-contract-manually","content":"Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly. For example, if you want to create a new contract called counter, your Odra.toml file should finally look like this: [[contracts]] fqn = "sample::Flipper" [[contracts]] fqn = "sample::Counter" ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Odra.toml","url":"/docs/basics/odra-toml#whats-next","content":"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famousFlipper contract. ","version":"1.0.0","tagName":"h2"},{"title":"Native token","type":0,"sectionRef":"#","url":"/docs/basics/native-token","content":"","keywords":"","version":"1.0.0"},{"title":"Testing​","type":1,"pageTitle":"Native token","url":"/docs/basics/native-token#testing","content":"To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function -balance_of: examples/src/features/native_token.rs #[cfg(test)] mod tests { use super::PublicWalletHostRef; use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_modules() { let test_env = odra_test::env(); let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs); assert_eq!(test_env.balance_of(my_contract.address()), U512::zero()); my_contract.with_tokens(U512::from(100)).deposit(); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100)); my_contract.withdraw(U512::from(25)); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75)); } } ","version":"1.0.0","tagName":"h2"},{"title":"Testing","type":0,"sectionRef":"#","url":"/docs/basics/testing","content":"","keywords":"","version":"1.0.0"},{"title":"HostEnv​","type":1,"pageTitle":"Testing","url":"/docs/basics/testing#hostenv","content":"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) and to configure how the contracts are deployed and called. Let's revisit the example from the previous article about host communication and implement the tests that prove it works: examples/src/features/testing.rs #[cfg(test)] mod tests { use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs}; use odra::{host::{Deployer, HostEnv}, prelude::*}; #[test] fn env() { let test_env: HostEnv = odra_test::env(); test_env.set_caller(test_env.get_account(0)); let init_args = TestingContractInitArgs { name: "MyContract".to_string() }; let testing_contract = TestingContractHostRef::deploy(&test_env, init_args); let creator = testing_contract.created_by(); test_env.set_caller(test_env.get_account(1)); let init_args = TestingContractInitArgs { name: "MyContract2".to_string() }; let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args); let creator2 = testing_contract2.created_by(); assert_ne!(creator, creator2); } } In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). Next, we are deploying two instances of the same contract, but we're using HostEnv::set_callerto change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller()the function we are calling inside the contract. HostEnv comes with a set of functions that will let you write better tests: fn set_caller(&self, address: Address) - you've seen it in action just nowfn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given addressfn advance_block_time(&self, time_diff: u64) - increases the current value of block_timefn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; by default, you start with the 0-th accountfn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract Full list of functions can be found in the HostEnv documentation. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Testing","url":"/docs/basics/testing#whats-next","content":"We take a look at how Odra handles errors! ","version":"1.0.0","tagName":"h2"},{"title":"Storage interaction","type":0,"sectionRef":"#","url":"/docs/basics/storage-interaction","content":"","keywords":"","version":"1.0.0"},{"title":"Var​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#var","content":"The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your variable in the Var type. Let's look at a "real world" example of a contract that represents a dog: examples/src/features/storage/variable.rs use odra::prelude::*; use odra::Var; #[odra::module] pub struct DogContract { barks: Var<bool>, weight: Var<u32>, name: Var<String>, walks: Var<Vec<u32>>, } You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)! Let's make this contract usable, by providing a constructor and some getter functions: examples/src/features/storage/variable.rs #[odra::module] impl DogContract { pub fn init(&mut self, barks: bool, weight: u32, name: String) { self.barks.set(barks); self.weight.set(weight); self.name.set(name); self.walks.set(Vec::<u32>::default()); } pub fn barks(&self) -> bool { self.barks.get_or_default() } pub fn weight(&self) -> u32 { self.weight.get_or_default() } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { let walks = self.walks.get_or_default(); walks.len() as u32 } pub fn walks_total_length(&self) -> u32 { let walks = self.walks.get_or_default(); walks.iter().sum() } } As you can see, you can access the data, by using get_or_default function: examples/src/features/storage/variable.rs ... self.barks.get_or_default() ... note Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable doesn't have to be initialized! To modify the data, use the set() function: examples/src/features/storage/variable.rs self.barks.set(barks); A Var is easy to use and efficient for simple data types. One of its downsides is that it serializes the data as a whole, so when you're using complex types like Vec or HashMap, each time you get or set the whole data is read and written to the blockchain storage. In the example above, if we want to see how many walks our dog had, we would use the function: examples/src/features/storage/variable.rs pub fn walks_amount(&self) -> usize { let walks = self.walks.get_or_default(); walks.len() } But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, especially for larger sets of data. To tackle this issue following two types were created. ","version":"1.0.0","tagName":"h2"},{"title":"Mapping​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#mapping","content":"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that uses Mapping to store information about our dog's friends and how many times they visited: examples/src/features/storage/mapping.rs use odra::prelude::*; use odra::{Mapping, Var}; #[odra::module] pub struct DogContract2 { name: Var<String>, friends: Mapping<String, u32>, } In the example above, our key is a String (it is a name of the friend) and we are storing u32 values (amount of visits). To read and write values from and into a Mapping we use a similar approach to the one shown in the Vars section with one difference - we need to pass a key: examples/src/features/storage/mapping.rs pub fn visit(&mut self, friend_name: String) { let visits = self.visits(friend_name.clone()); self.friends.set(&friend_name, visits + 1); } pub fn visits(&self, friend_name: String) -> u32 { self.friends.get_or_default(&friend_name) } The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. We could implement such behavior by using a numeric type key and saving the length of the set in a separate variable. Thankfully Odra comes with a prepared solution - the List type. note If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with a Var working together: core/src/list.rs use odra::{List, Var}; pub struct List<T> { values: Mapping<u32, T>, index: Var<u32> } ","version":"1.0.0","tagName":"h2"},{"title":"List​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#list","content":"Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, we'll use the list: examples/src/features/storage/list.rs use odra::{prelude::*, List, Var}; #[odra::module] pub struct DogContract3 { name: Var<String>, walks: List<u32>, } As you can see, the notation is very similar to the Vec. To understand the usage, take a look at the reimplementation of the functions with an additional function that takes our dog for a walk (it writes the data to the storage): examples/src/features/storage/list.rs #[odra::module] impl DogContract3 { pub fn init(&mut self, name: String) { self.name.set(name); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { self.walks.len() } pub fn walks_total_length(&self) -> u32 { self.walks.iter().sum() } pub fn walk_the_dog(&mut self, length: u32) { self.walks.push(length); } } Now, we can know how many walks our dog had without loading the whole vector from the storage. We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all the cases for you. info All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder. ","version":"1.0.0","tagName":"h2"},{"title":"Custom Types​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#custom-types","content":"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors. Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type: use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } #[odra_type] is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type.CLType of a custom type is CLType::Any, except for an unit-only enum, which is CLType::U8. unit_only_enum.rs enum Enum { Foo = 3, Bar = 2, Baz = 1, } note Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute . ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#whats-next","content":"In the next article, we'll see how to query the host for information about the world and our contract. ","version":"1.0.0","tagName":"h2"},{"title":"odra-examples","type":0,"sectionRef":"#","url":"/docs/examples/odra-examples","content":"","keywords":"","version":"1.0.0"},{"title":"What's next​","type":1,"pageTitle":"odra-examples","url":"/docs/examples/odra-examples#whats-next","content":"Read the next article to learn about reusable Odra components encapsulated in odra-modules. ","version":"1.0.0","tagName":"h2"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/getting-started/installation","content":"","keywords":"","version":"1.0.0"},{"title":"Prerequisites​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#prerequisites","content":"To start working with Odra, you need to have the following installed on your machine: Rust toolchain installed (see rustup.rs)wasmstrip tool installed (see wabt) We do not provide exact commands for installing these tools, as they are different for different operating systems. Please refer to the documentation of the tools themselves. With Rust toolchain ready, you can add a new target: rustup target add wasm32-unknown-unknown note wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files. ","version":"1.0.0","tagName":"h2"},{"title":"Installing Cargo Odra​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#installing-cargo-odra","content":"Cargo Odra is a helpful tool that will help you to build and test your smart contracts. It is not required to use Odra, but the documentation will assume that you have it installed. To install it, simply execute the following command: cargo install cargo-odra --locked To check if it was installed correctly and see available commands, type: cargo odra --help If everything went fine, we can proceed to the next step. ","version":"1.0.0","tagName":"h2"},{"title":"Creating a new Odra project​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#creating-a-new-odra-project","content":"To create a new project, simply execute: cargo odra new --name my-project && cd my_project This will create a new folder called my_project and initialize Odra there. Cargo Odra will create a sample contract for you in src directory. You can run the tests of this contract by executing: cargo odra test This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM: cargo odra test -b casper Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during the installation process, feel free to ask for help on our Discord. ","version":"1.0.0","tagName":"h2"},{"title":"What's next?​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#whats-next","content":"If you want to see the code that you just tested, continue to the description of Flipper example. ","version":"1.0.0","tagName":"h2"},{"title":"Using odra-modules","type":0,"sectionRef":"#","url":"/docs/examples/using-odra-modules","content":"","keywords":"","version":"1.0.0"},{"title":"Available modules​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#available-modules","content":"Odra modules comes with couple of ready-to-use modules and reusable extensions. ","version":"1.0.0","tagName":"h2"},{"title":"Tokens​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#tokens","content":"CEP-18​ Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 here. CEP-78​ Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 here. Erc20​ The Erc20 module implements the ERC20 standard. Erc721​ The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework. The Erc721Token module implements the ERC721Base and additionally uses the Erc721Metadata and Ownable extensions. The Erc721Receiver trait lets you implement your own logic for receiving NFTs. The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules. Erc1155​ The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework. The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension. The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules. Wrapped native token​ The WrappedNativeToken module implements the Wrapper for the native token, it was inspired by the WETH. ","version":"1.0.0","tagName":"h3"},{"title":"Access​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#access","content":"AccessControl​ This module enables the implementation of role-based access control mechanisms for children modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API. Ownable​ This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner. The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using thetransfer_ownership() function. Ownable2Step​ An extension of the Ownable module. Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions. ","version":"1.0.0","tagName":"h3"},{"title":"Security​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#security","content":"Pausable​ A module allowing to implement an emergency stop mechanism that can be triggered by any account. ","version":"1.0.0","tagName":"h3"},{"title":"Flipper example","type":0,"sectionRef":"#","url":"/docs/getting-started/flipper","content":"","keywords":"","version":"1.0.0"},{"title":"Let's flip​","type":1,"pageTitle":"Flipper example","url":"/docs/getting-started/flipper#lets-flip","content":"flipper.rs use odra::Var; /// A module definition. Each module struct consists Vars and Mappings /// or/and another modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor, must be named `init`. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } /// Retrieves value from the storage. /// If the value has never been set, the default value is returned. pub fn get(&self) -> bool { self.value.get_or_default() } } #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } #[test] fn test_two_flippers() { let env = odra_test::env(); let mut contract1 = FlipperHostRef::deploy(&env, NoArgs); let contract2 = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract1.get()); assert!(!contract2.get()); contract1.flip(); assert!(contract1.get()); assert!(!contract2.get()); } } ","version":"1.0.0","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Flipper example","url":"/docs/getting-started/flipper#testing","content":"To run the tests, execute the following command: cargo odra test # or add the `-b casper` flag to run tests on the CasperVM ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper example","url":"/docs/getting-started/flipper#whats-next","content":"In the next category of articles, we will go through basic concepts of Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Access Control","type":0,"sectionRef":"#","url":"/docs/tutorials/access-control","content":"","keywords":"","version":"1.0.0"},{"title":"Code​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#code","content":"Before we start writing code, we list the functionalities of our access control layer. A Role type is used across the module.A Role can be assigned to many Addresses.Each Role may have a corresponding admin role.Only an admin can grant/revoke a Role.A Role can be renounced.A Role cannot be renounced on someone's behalf.Each action triggers an event.Unauthorized access stops contract execution. ","version":"1.0.0","tagName":"h2"},{"title":"Project Structure​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#project-structure","content":"access-control ├── src │ ├── access │ │ ├── access_control.rs │ │ ├── events.rs │ │ └── errors.rs │ └── lib.rs |── build.rs |── Cargo.toml └── Odra.toml ","version":"1.0.0","tagName":"h3"},{"title":"Events and Errors​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#events-and-errors","content":"There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions. events.rs use odra::prelude::*; use odra::Address; use super::access_control::Role; #[odra::event] pub struct RoleGranted { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleRevoked { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleAdminChanged { pub role: Role, pub previous_admin_role: Role, pub new_admin_role: Role } L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role. errors.rs #[odra::odra_error] pub enum Error { MissingRole = 20_000, RoleRenounceForAnotherAddress = 20_001, } Errors definition is straightforward - there are only two invalid states: An action is triggered by an unauthorized actor.The caller is attempting to resign the Role on someone's behalf. ","version":"1.0.0","tagName":"h3"},{"title":"Module​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#module","content":"Now, we are stepping into the most interesting part: the module definition and implementation. access_control.rs use super::events::*; use super::errors::Error; use odra::prelude::*; use odra::{Address, Mapping}; pub type Role = [u8; 32]; pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32]; #[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])] pub struct AccessControl { roles: Mapping<(Role, Address), bool>, role_admin: Mapping<Role, Role> } #[odra::module] impl AccessControl { pub fn has_role(&self, role: &Role, address: &Address) -> bool { self.roles.get_or_default(&(*role, *address)) } pub fn get_role_admin(&self, role: &Role) -> Role { let admin_role = self.role_admin.get(role); if let Some(admin) = admin_role { admin } else { DEFAULT_ADMIN_ROLE } } pub fn grant_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_grant_role(role, address); } pub fn revoke_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_revoke_role(role, address); } pub fn renounce_role(&mut self, role: &Role, address: &Address) { if address != &self.env().caller() { self.env().revert(Error::RoleRenounceForAnotherAddress); } self.unchecked_revoke_role(role, address); } } impl AccessControl { pub fn check_role(&self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.env().revert(Error::MissingRole); } } pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) { let previous_admin_role = self.get_role_admin(role); self.role_admin.set(role, *admin_role); self.env().emit_event(RoleAdminChanged { role: *role, previous_admin_role, new_admin_role: *admin_role }); } pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.roles.set(&(*role, *address), true); self.env().emit_event(RoleGranted { role: *role, address: *address, sender: self.env().caller() }); } } pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) { if self.has_role(role, address) { self.roles.set(&(*role, *address), false); self.env().emit_event(RoleRevoked { role: *role, address: *address, sender: self.env().caller() }); } } } L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.L8 - The default role is an array filled with zeros.L10-L13 - The storage consists of two mappings: roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.role_admin - each Role can have a single admin Role. L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.L49 - This is a non-exported block containing helper functions.L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access. ","version":"1.0.0","tagName":"h3"},{"title":"Odra for Solidity developers","type":0,"sectionRef":"#","url":"/docs/next/tutorials/odra-solidity","content":"","keywords":"","version":"next"},{"title":"Introduction​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#introduction","content":"Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers. ","version":"next","tagName":"h2"},{"title":"Prerequisites​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#prerequisites","content":"To follow this guide, you should have: Knowledge of Solidity.Familiarity with Ethereum and smart contract concepts.Basic understanding of Rust, as Odra is based on it. ","version":"next","tagName":"h2"},{"title":"Hello World​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#hello-world","content":"Let's start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message. OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct HelloWorld { greet: Var<String>, } #[odra::module] impl HelloWorld { pub fn init(&mut self, message: String) { self.greet.set(message); } pub fn get(&self) -> String { self.greet.get_or_default() } } As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the odra::module attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the HelloWorld struct has a single state variable greet, which stores the greeting message. The module contains two functions: init to set the greeting message and get to retrieve it. Two key differences are: Odra does not generate getters for public state variables automatically, so you need to define them explicitly.To initialize values, you must do it in the init function, which is the contract constructor. You can't assign defaults outside the constructor. ","version":"next","tagName":"h2"},{"title":"Variable Storage and State Management​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#variable-storage-and-state-management","content":"","version":"next","tagName":"h2"},{"title":"Data Types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#data-types","content":"OdraSolidity use core::str::FromStr; use odra::{ casper_types::{bytesrepr::Bytes, U256}, module::Module, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct Primitives { boo: Var<bool>, u: Var<u8>, // u8 is the smallest unsigned integer type u2: Var<U256>, // U256 is the biggest unsigned integer type i: Var<i32>, // i32 is the smallest signed integer type i2: Var<i64>, // i64 is the biggest signed integer type address: Var<Address>, bytes: Var<Bytes>, default_boo: Var<bool>, default_uint: Var<U256>, default_int: Var<i64>, default_addr: Var<Address>, } #[odra::module] impl Primitives { pub fn init(&mut self) { self.boo.set(true); self.u.set(1); self.u2.set(U256::from(456)); self.i.set(-1); self.i2.set(456); self.address.set( Address::from_str( "hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb", ) .unwrap_or_revert(&self.env()), ); self.bytes.set(Bytes::from(vec![0xb5])); let _min_int = U256::zero(); let _max_int = U256::MAX; } // For the types that have default values, we can use the get_or_default method pub fn get_default_boo(&self) -> bool { self.default_boo.get_or_default() } pub fn get_default_uint(&self) -> U256 { self.default_uint.get_or_default() } pub fn get_default_int(&self) -> i64 { self.default_int.get_or_default() } // Does not compile - Address does not have the default value pub fn get_default_addr(&self) -> Address { self.default_addr.get_or_default() } } The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: u8, u16, u32, u64, U128, and U256 for unsigned integers, and i32 and i64 for signed integers. The Address type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the Address type; the workaround is to use Option<Address>. The Bytes type is used to store byte arrays. Values are stored in units called Named Keys and Dictionaries. Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. ","version":"next","tagName":"h3"},{"title":"Constants and Immutability​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#constants-and-immutability","content":"OdraSolidity use odra::{casper_types::{account::AccountHash, U256}, Address}; #[odra::module] pub struct Constants; #[odra::module] impl Constants { pub const MY_UINT: U256 = U256([123, 0, 0, 0]); pub const MY_ADDRESS: Address = Address::Account( AccountHash([0u8; 32]) ); } In Odra, you can define constants using the const keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the immutable keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's immutable keyword. ","version":"next","tagName":"h3"},{"title":"Variables​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#variables","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, Var}; #[odra::module] pub struct Variables { text: Var<String>, my_uint: Var<U256>, } #[odra::module] impl Variables { pub fn init(&mut self) { self.text.set("Hello".to_string()); self.my_uint.set(U256::from(123)); } pub fn do_something(&self) { // Local variables let i = 456; // Env variables let timestamp = self.env().get_block_time(); let sender = self.env().caller(); } } In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ContractEnv retrieved using the env() function. ","version":"next","tagName":"h3"},{"title":"Arrays and Mappings​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#arrays-and-mappings","content":"OdraSolidity use odra::{casper_types::U256, Address, Mapping}; #[odra::module] pub struct MappingContract { my_map: Mapping<Address, Option<U256>> } #[odra::module] impl MappingContract { pub fn get(&self, addr: Address) -> U256 { // self.my_map.get(&addr) would return Option<Option<U256>> // so we use get_or_default instead and unwrap the inner Option self.my_map.get_or_default(&addr).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256) { self.my_map.set(&addr, Some(i)); } pub fn remove(&mut self, addr: Address) { self.my_map.set(&addr, None); } } #[odra::module] pub struct NestedMapping { my_map: Mapping<(Address, U256), Option<bool>> } #[odra::module] impl NestedMapping { pub fn get(&self, addr: Address, i: U256) -> bool { self.my_map.get_or_default(&(addr, i)).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256, boo: bool) { self.my_map.set(&(addr, i), Some(boo)); } pub fn remove(&mut self, addr: Address, i: U256) { self.my_map.set(&(addr, i), None); } } OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct Array { // the size of the array must be known at compile time arr: Var<[u8; 10]>, vec: Var<Vec<u32>>, } #[odra::module] impl Array { pub fn init(&mut self) { self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); self.vec.set(vec![1, 2, 3, 4, 5]); } pub fn get_arr(&self) -> [u8; 10] { self.arr.get_or_default() } pub fn push_vec(&mut self, value: u32) { let mut vec = self.vec.get_or_default(); vec.push(value); self.vec.set(vec); } pub fn pop_vec(&mut self) { let mut vec = self.vec.get_or_default(); vec.pop(); self.vec.set(vec); } pub fn update_arr(&mut self, index: u8, value: u8) { let mut arr = self.arr.get_or_default(); arr[index as usize] = value; self.arr.set(arr); } } For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the Var container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a Mapping or List instead of an array or vector to store data. ","version":"next","tagName":"h3"},{"title":"Custom types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#custom-types","content":"OdraSolidity use odra::{prelude::*, Var}; #[odra::odra_type] #[derive(Default)] pub enum Status { #[default] Pending, Shipped, Accepted, Rejected, Canceled, } #[odra::module] pub struct Enum { status: Var<Status>, } #[odra::module] impl Enum { pub fn get(&self) -> Status { self.status.get_or_default() } pub fn set(&mut self, status: Status) { self.status.set(status); } pub fn cancel(&mut self) { self.status.set(Status::Canceled); } pub fn reset(&mut self) { self.status.set(Default::default()); } } In Odra, custom types are defined using the #[odra::odra_type] attribute. The enum can have a default value specified using the #[default] attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the Default::default() function. OdraSolidity use odra::{prelude::*, List}; #[odra::odra_type] pub struct Todo { text: String, completed: bool, } #[odra::module] pub struct Enum { // You could also use Var<Vec<Todo>> instead of List<Todo>, // but List is more efficient for large arrays, // it loads items lazily. todos: List<Todo>, } #[odra::module] impl Enum { pub fn create(&mut self, text: String) { self.todos.push(Todo { text, completed: false, }); } pub fn update_text(&mut self, index: u32, text: String) { if let Some(mut todo) = self.todos.get(index) { todo.text = text; self.todos.replace(index, todo); } } pub fn toggle_complete(&mut self, index: u32) { if let Some(mut todo) = self.todos.get(index) { todo.completed = !todo.completed; self.todos.replace(index, todo); } } // Odra does not create getters by default pub fn get(&self, index: u32) -> Option<Todo> { self.todos.get(index) } } Similarly to enums, custom structs are defined using the #[odra::odra_type] attribute. The struct can be used to define a list of items in a contract. The list can be created using the List type, which is more efficient for large arrays as it loads items lazily. ","version":"next","tagName":"h3"},{"title":"Data Location​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#data-location","content":"In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be memory, storage, or calldata. In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., Var, Mapping, List), the data is stored in the contract's storage. ","version":"next","tagName":"h3"},{"title":"Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#functions","content":"Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function: impl Erc20 { pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.internal_transfer(&self.env().caller(), recipient, amount); // Transfer logic goes here } fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) { // Internal transfer logic goes here } } Functions can modify contract state and emit events using the ContractEnv function. ","version":"next","tagName":"h2"},{"title":"View and Pure​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#view-and-pure","content":"OdraSolidity use odra::Var; #[odra::module] pub struct ViewAndPure { x: Var<u32> } #[odra::module] impl ViewAndPure { pub fn add_to_x(&self, y: u32) -> u32 { self.x.get_or_default() + y } } pub fn add(i: u32, j: u32) -> u32 { i + j } In Odra, you don't need to specify view or pure functions explicitly. All functions are considered view functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be &mut self. If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects. ","version":"next","tagName":"h3"},{"title":"Modifiers​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#modifiers","content":"OdraSolidity use odra::Var; #[odra::module] pub struct FunctionModifier { x: Var<u32>, locked: Var<bool>, } #[odra::module] impl FunctionModifier { pub fn decrement(&mut self, i: u32) -> u32 { self.lock(); self.x.set(self.x.get_or_default() - i); if i > 1 { self.decrement(i - 1); } self.unlock(); } #[inline] fn lock(&mut self) { if self.locked.get_or_default() { self.env().revert("No reentrancy"); } self.locked.set(true); } #[inline] fn unlock(&mut self) { self.locked.set(false); } } In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the lock and unlock functions are called before and after the decrement function, respectively, but they must be called explicitly. As often as practicable, developers should inline functions by including the body of the function within their code using the #[inline] attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances. ","version":"next","tagName":"h3"},{"title":"Visibility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#visibility","content":"Functions and state variables have to declare whether they are accessible by other contracts. Functions can be declared as: OdraSolidity `pub` inside `#[odra::module]` impl block - any contract/submodule and account can call. `pub` inside a regular impl block - any submodule can call. `default/no modifier/private` - only inside the contract that defines the function. ","version":"next","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#payable","content":"OdraSolidity use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var}; #[odra::module] pub struct Payable { owner: Var<Address>, } #[odra::module] impl Payable { pub fn init(&mut self) { self.owner.set(self.env().caller()); } #[odra(payable)] pub fn deposit(&self) { } pub fn not_payable(&self) { } pub fn withdraw(&self) { let amount = self.env().self_balance(); self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount); } pub fn transfer(&self, to: Address, amount: U512) { self.env().transfer_tokens(&to, &amount); } } In Odra, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether. ","version":"next","tagName":"h3"},{"title":"Selectors​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#selectors","content":"In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector. contract_addr.call( abi.encodeWithSignature("transfer(address,uint256)", address, 1234) ) Odra does not support such a mechanism. You must have access to the contract interface to call a function. ","version":"next","tagName":"h3"},{"title":"Events and Logging​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#events-and-logging","content":"OdraSolidity use odra::{prelude::*, Address}; #[odra::event] pub struct Log { sender: Address, message: String, } #[odra::event] pub struct AnotherLog {} #[odra::module] struct Event; #[odra::module] impl Event { pub fn test(&self) { let env = self.env(); env.emit_event(Log { sender: env.caller(), message: "Hello World!".to_string(), }); env.emit_event(Log { sender: env.caller(), message: "Hello Casper!".to_string(), }); env.emit_event(AnotherLog {}); } } In Odra, events are regular structs defined using the #[odra::event] attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's emit_event() function, passing the event struct as an argument. note Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the Basics section. ","version":"next","tagName":"h2"},{"title":"Error Handling​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#error-handling","content":"OdraSolidity use odra::{prelude::*, casper_types::{U256, U512}}; #[odra::odra_error] pub enum CustomError { InsufficientBalance = 1, InputLowerThanTen = 2, } #[odra::module] pub struct Error; #[odra::module] impl Error { pub fn test_require(&mut self, i: U256) { if i <= 10.into() { self.env().revert(CustomError::InputLowerThanTen); } } pub fn execute_external_call(&self, withdraw_amount: U512) { let balance = self.env().self_balance(); if balance < withdraw_amount { self.env().revert(CustomError::InsufficientBalance); } } } In Solidity, there are four ways to handle errors: require, revert, assert, and custom errors. In Odra, there is only one way to revert the execution of a function - by using the env().revert() function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the #[odra::odra_error] attribute. On Casper, an error is only a number, so you can't pass a message with the error. ","version":"next","tagName":"h2"},{"title":"Composition vs. Inheritance​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#composition-vs-inheritance","content":"In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another. Let's take a look at the difference between inheritance in Solidity and composition in Odra. OdraSolidity use odra::{prelude::*, SubModule}; #[odra::module] pub struct A; #[odra::module] impl A { pub fn foo(&self) -> String { "A".to_string() } } #[odra::module] pub struct B { a: SubModule<A> } #[odra::module] impl B { pub fn foo(&self) -> String { "B".to_string() } } #[odra::module] pub struct C { a: SubModule<A> } #[odra::module] impl C { pub fn foo(&self) -> String { "C".to_string() } } #[odra::module] pub struct D { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl D { pub fn foo(&self) -> String { self.c.foo() } } #[odra::module] pub struct E { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl E { pub fn foo(&self) -> String { self.b.foo() } } #[odra::module] pub struct F { a: SubModule<A>, b: SubModule<B>, } #[odra::module] impl F { pub fn foo(&self) -> String { self.a.foo() } } Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers. In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts. ","version":"next","tagName":"h2"},{"title":"Libraries and Utility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#libraries-and-utility","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var}; mod math { use odra::casper_types::U256; pub fn sqrt(y: U256) -> U256 { let mut z = y; if y > 3.into() { let mut x = y / 2 + 1; while x < z { z = x; x = (y / x + x) / 2; } } else if y != U256::zero() { z = U256::one(); } z } } #[odra::module] struct TestMath; #[odra::module] impl TestMath { pub fn test_square_root(&self, x: U256) -> U256 { math::sqrt(x) } } #[odra::odra_error] enum Error { EmptyArray = 100, } trait Removable { fn remove(&mut self, index: usize); } impl Removable for Var<Vec<U256>> { fn remove(&mut self, index: usize) { let env = self.env(); let mut vec = self.get_or_default(); if vec.is_empty() { env.revert(Error::EmptyArray); } vec[index] = vec.pop().unwrap_or_revert(&env); self.set(vec); } } #[odra::module] struct TestArray { arr: Var<Vec<U256>>, } #[odra::module] impl TestArray { pub fn test_array_remove(&mut self) { let mut arr = self.arr.get_or_default(); for i in 0..3 { arr.push(i.into()); } self.arr.set(arr); self.arr.remove(1); let arr = self.arr.get_or_default(); assert_eq!(arr.len(), 2); assert_eq!(arr[0], 0.into()); assert_eq!(arr[1], 2.into()); } } In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the Math library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the TestMath contract calls the sqrt function directly, while the TestArray contract uses the using keyword, which extends the type uint256[] by adding the remove function. In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the Removable trait for the Var<Vec<U256>> type allows the remove function to be called on a variable that stores a vector of U256 values. ","version":"next","tagName":"h2"},{"title":"Fallback and Receive Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#fallback-and-receive-functions","content":"In Solidity, a contract receiving Ether must implement a receive() and/or fallback() function. The receive() function is called when Ether is sent to the contract with no data, while the fallback() function is called when the contract receives Ether with data or when a function that does not exist is called. Odra does not have a direct equivalent to the receive() and fallback() functions. Instead, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. ","version":"next","tagName":"h2"},{"title":"Miscellaneous​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#miscellaneous","content":"","version":"next","tagName":"h2"},{"title":"Hashing​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#hashing","content":"OdraSolidity use odra::{ casper_types::{bytesrepr::ToBytes, U256}, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct HashFunction; #[odra::module] impl HashFunction { pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] { let env = self.env(); let mut data = Vec::new(); data.extend(text.to_bytes().unwrap_or_revert(&env)); data.extend(num.to_bytes().unwrap_or_revert(&env)); data.extend(addr.to_bytes().unwrap_or_revert(&env)); env.hash(data) } } #[odra::module] pub struct GuessTheMagicWord { answer: Var<[u8; 32]>, } #[odra::module] impl GuessTheMagicWord { /// Initializes the contract with the magic word hash. pub fn init(&mut self) { self.answer.set([ 0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84, 0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55, 0xbe, 0xd7, 0x56, 0x08, ]); } /// Checks if the `word` is the magic word. pub fn guess(&self, word: String) -> bool { let env = self.env(); let hash = env.hash(word.to_bytes().unwrap_or_revert(&env)); hash == self.answer.get_or_default() } } The key difference between the two is that in Solidity, the keccak256 function is used to hash data, while in Odra, the env.hash() function is used, which implements the blake2b algorithm. Both functions take a byte array as input and return a 32-byte hash. ","version":"next","tagName":"h3"},{"title":"Try-catch​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#try-catch","content":"OdraSolidity use odra::{module::Module, Address, ContractRef, Var}; #[odra::module] pub struct Example { other_contract: Var<Address>, } #[odra::module] impl Example { pub fn init(&mut self, other_contract: Address) { self.other_contract.set(other_contract); } pub fn execute_external_call(&self) { if let Some(addr) = self.other_contract.get() { let result = OtherContractContractRef::new(self.env(), addr).some_function(); match result { Ok(success) => { // Code to execute if the external call was successful } Err(reason) => { // Code to execute if the external call failed } } } } } #[odra::module] pub struct OtherContract; #[odra::module] impl OtherContract { pub fn some_function(&self) -> Result<bool, ()> { Ok(true) } } In Solidity, try/catch is a feature that allows developers to handle exceptions and errors more gracefully. The try/catch statement allows developers to catch and handle exceptions that occur during external function calls and contract creation. In Odra, there is no direct equivalent to the try/catch statement in Solidity. However, you can use the Result type to handle errors in a similar way. The Result type is an enum that represents either success (Ok) or failure (Err). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts. ","version":"next","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#conclusion","content":"Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development. Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework. Read more about the Odra Framework in the Basics and Advanced sections. Learn by example with our Tutorial series, you will find there a contract you likely familiar with - the Erc20 standard implementation. If you have any further questions or need clarification on specific topics, feel free to join our Discord! ","version":"next","tagName":"h2"},{"title":"Migration guide to v0.9.0","type":0,"sectionRef":"#","url":"/docs/migrations/to-0.9.0","content":"","keywords":"","version":"1.0.0"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#1-prerequisites","content":"","version":"1.0.0","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"1.0.0","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0. ","version":"1.0.0","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#2-migration-steps","content":"","version":"1.0.0","tagName":"h2"},{"title":"2.1 Update build_schema.rs bin​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#21-update-build_schemars-bin","content":"Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"1.0.0","tagName":"h3"},{"title":"2.2 Update smart contract code​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#22-update-smart-contract-code","content":"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes. 2.2.1. Update custom types definitions.​ #[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute. 0.9.00.8.0 use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } 2.2.2. Update errors definitions.​ #[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. Error enum should be passed as a parameter to the #[odra::module] attribute. 0.9.00.8.0 #[odra::module(events = [/* events go here */], errors = Error)] pub struct Erc20 { // fields } #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.2.3. Update events definitions.​ #[derive(Event)] attribute has been replace with #[odra::event] attribute. 0.9.00.8.0 use odra::prelude::*; use odra::{Address, casper_types::U256}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } ","version":"1.0.0","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.9.0. 0.9.0Prev src/erc20.rs use crate::erc20::errors::Error; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer], errors = Error)] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(Error::NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(Error::InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(Error::InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { // nothing changed in the tests } ","version":"1.0.0","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"1.0.0","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"1.0.0","tagName":"h2"},{"title":"Deploying a Token on Casper Livenet","type":0,"sectionRef":"#","url":"/docs/tutorials/deploying-on-casper","content":"","keywords":"","version":"1.0.0"},{"title":"Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#casper-wallet","content":"We will be using Casper Wallet to do some tasks in this tutorial. To install it, please follow the instructions on theofficial website. After setting up the wallet, extract the private key of the account you want to use for our testing. You can do this by clicking on the Menu > Download account keys. danger You are solely responsible for the security of your private keys. We recommend creating a new account for the testing purposes. Why do we need the private key? We will use it in Odra to deploy our contract to the Casper network using Livenet backend. ","version":"1.0.0","tagName":"h2"},{"title":"Getting tokens​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#getting-tokens","content":"To deploy the contract on the Livenet, we need to have some CSPR. The easiest way to get them is to use the faucet, which will send us 1000 CSPR for free. Unfortunately, only on the Testnet. To use the faucet, go to the Casper Testnet Faucet. Log in using your Casper Wallet account and click on the "Request Tokens" button. note One account can request tokens only once. If you run out of tokens, you can either ask someone in the Casper community to send you some, or simply create a new account in the wallet. Now, when we have the tokens, we can deploy the contract. Let's do it using Odra! ","version":"1.0.0","tagName":"h2"},{"title":"Odra Livenet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#odra-livenet","content":"Odra Livenet is described in detail in thebackends section of this documentation. We will then briefly describe how to use set it up in this tutorial. In your contract code, create a new file in the bin folder: bin/our_token_livenet.rs //! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial //! creator. use std::str::FromStr; use odra::casper_types::U256; use odra::host::{Deployer, HostEnv, HostRef, HostRefLoader}; use odra::Address; use ourcoin::token::{OurTokenHostRef, OurTokenInitArgs}; fn main() { // Load the Casper livenet environment. let env = odra_casper_livenet_env::env(); // Caller is the deployer and the owner of the private key. let owner = env.caller(); // Just some random address... let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26"; let recipient = Address::from_str(recipient).unwrap(); // Deploy new contract. let mut token = deploy_our_token(&env); println!("Token address: {}", token.address().to_string()); // Propose minting new tokens. env.set_gas(1_000_000_000u64); token.propose_new_mint(recipient, U256::from(1_000)); // Vote, we are the only voter. env.set_gas(1_000_000_000u64); token.vote(true, U256::from(1_000)); // Let's advance the block time by 11 minutes, as // we set the voting time to 10 minutes. // OH NO! It is the Livenet, so we need to wait real time... // Hopefully you are not in a hurry. env.advance_block_time(11 * 60 * 1000); // Tally the votes. env.set_gas(1_500_000_000u64); token.tally(); // Check the balances. println!("Owner's balance: {:?}", token.balance_of(&owner)); println!( "Tutorial creator's balance: {:?}", token.balance_of(&recipient) ); } /// Deploys a contract. pub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef { let name = String::from("OurToken"); let symbol = String::from("OT"); let decimals = 0; let initial_supply = U256::from(1_000); let init_args = OurTokenInitArgs { name, symbol, decimals, initial_supply, }; env.set_gas(300_000_000_000u64); OurTokenHostRef::deploy(env, init_args) } /// Loads a contract. Just in case you need to load an existing contract later... fn _load_cep18(env: &HostEnv) -> OurTokenHostRef { let address = "hash-XXXXX"; let address = Address::from_str(address).unwrap(); OurTokenHostRef::load(env, address) } In your Cargo.toml file, we need to add a new dependency, a feature and register the new binary. In the end, it should look like this: Cargo.toml [package] name = "ourcoin" version = "0.1.0" edition = "2021" [dependencies] odra = { version = "1.0.0", features = [], default-features = false } odra-modules = { version = "1.0.0", features = [], default-features = false } odra-casper-livenet-env = { version = "1.0.0", optional = true } [dev-dependencies] odra-test = { version = "1.0.0", features = [], default-features = false } [build-dependencies] odra-build = { version = "1.0.0", features = [], default-features = false } [features] default = [] livenet = ["odra-casper-livenet-env"] [[bin]] name = "ourcoin_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "ourcoin_build_schema" path = "bin/build_schema.rs" test = false [[bin]] name = "our_token_livenet" path = "bin/our_token_livenet.rs" required-features = ["livenet"] [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 Finally, add the .env file with the following content: .env # Path to the secret key of the account that will be used to deploy the contracts. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777 # Chain name of the network. ODRA_CASPER_LIVENET_CHAIN_NAME=casper-test Of course, you need to replace the secret key's path with the path to the secret key file you downloaded from the Casper Wallet. note One of the problems you may encounter is that the node you are using will be down or will not accept your calls. In this case, you will have to find and use another node IP address. Now, we will run our code: cargo run --bin our_token_livenet --features livenet If everything is set up correctly, you should see the output similar to this: Running `target/debug/our_token_livenet` 💁 INFO : Deploying "OurToken". 💁 INFO : Found wasm under "wasm/OurToken.wasm". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 💁 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed. 💁 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed. Token address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 💁 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed. 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 💁 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed. 💁 INFO : advance_block_time called - Waiting for 660000 ms 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 💁 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed. Owner's balance: 1000 Tutorial creator's balance: 1000 Congratulations, your contract is now deployed on the Casper network! Before we move on, note the address of the token! We will use it in the next section to interact with the token. In our case it ishash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857. ","version":"1.0.0","tagName":"h2"},{"title":"Cspr.live​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#csprlive","content":"The first thing we will do is to explore Casper's network block explorer,cspr.live. We can put the address of our token in the search bar to find it. note If you deployed your contract on the Testnet, remember to make sure that the Testnet network is selected in the dropdown menu in the top right corner. If everything is set up correctly, you should see the contract package's details. Besides the owner, keys etc., you can also see the contract's metdata, if it was developed using a standard that cspr.live supports. Indeed, we can see that it detected that our contract is a CEP-18 token! We see the name, symbol and total supply. All the mentions of the contract on the website will use the token name instead of the contract address. Additionally, on the Token Txs tab, we can see the transactions that happened with the token. We can see the minting transaction we did in the previous section and transfers done during the voting process. If we click on one of the accounts that recieved the tokens, we will go to the account page. Here, on the Tokens tab, we can see all the tokens that the account has - and OurToken is one of them! If you wish, you can check the status of the contract deployed during the development of this tutorial here. ","version":"1.0.0","tagName":"h2"},{"title":"Transferring Tokens using Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#transferring-tokens-using-casper-wallet","content":"Casper wallet can do much more than just logging in to the faucet, exporting the private keys and transferring CSPR. It can also interact with the contracts deployed on the network. If you deployed the contract and left some OT tokens to yourself, you should see them in the Casper Wallet window. You should also be able to transfer them to another account! ","version":"1.0.0","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#conclusion","content":"We've successfully deployed a token on the Casper network and interacted with it using the Odra backend and Casper Wallet. We've also learned how to use the cspr.live block explorer to check the status of your contract. Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem provides. Feel free to explore them on casperecosystem.io. ","version":"1.0.0","tagName":"h2"},{"title":"Migration guide to v0.8.0","type":0,"sectionRef":"#","url":"/docs/migrations/to-0.8.0","content":"","keywords":"","version":"1.0.0"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#1-prerequisites","content":"","version":"1.0.0","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"1.0.0","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0. ","version":"1.0.0","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#2-migration-steps","content":"","version":"1.0.0","tagName":"h2"},{"title":"2.1 Add bin directory​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#21-add-bin-directory","content":"Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory. You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"1.0.0","tagName":"h3"},{"title":"2.2. Update Cargo.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#22-update-cargotoml","content":"There a bunch of changes in the Cargo.toml file. You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.Register bins you added in the previous step.Add dev-dependencies section with odra-test crate.Add recommended profiles for release and dev to optimize the build process. Below you can compare the Cargo.toml file after and before the migration to v0.8.0: 0.8.0Prev [package] name = "my_project" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.0" [dev-dependencies] odra-test = "0.8.0" [[bin]] name = "my_project_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "my_project_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 ","version":"1.0.0","tagName":"h3"},{"title":"2.2. Update Odra.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#22-update-odratoml","content":"Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required. 0.8.0Prev [[contracts]] fqn = "my_project::Flipper" ","version":"1.0.0","tagName":"h3"},{"title":"2.3. Update Smart Contracts​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#23-update-smart-contracts","content":"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make: 2.3.1. Update the use statements to reflect the new module structure.​ Big integer types are now located in the odra::casper_types module.odra::types::Address is now odra::Address.Variable is now Var.Remove odra::contract_env.Remove odra::types::event::OdraEvent.Remove odra::types::OdraType as it is no longer required.Change odra::types::casper_types::*; to odra::casper_types::*;. 2.3.2. Some type aliases are no longer in use.​ Balance - use odra::casper_types::U512.BlockTime - use u64.EventData - use odra::casper_types::bytesrepr::Bytes. 2.3.3. Consider import odra::prelude::* in your module files.​ 2.3.4. Flatten nested Mappings.​ // Before #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<Address, Mapping<Address, U256>> } // After #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<(Address, Address), U256> } 2.3.5. Update errors definitions.​ execution_error! macro has been replace with OdraError derive macro. 0.8.0Prev use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.3.6. Update events definitions.​ 0.8.0Prev use odra::prelude::*; use odra::Event; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } // Emitting the event self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); 2.3.7. Replace contract_env with self.env() in your modules.​ self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes. fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions. fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.functions native_token_metadata() and one_token() have been removed. 2.3.8. Wrap submodules of your module with odra::SubModule<T>.​ 0.8.0Prev #[odra::module(events = [Transfer])] pub struct Erc721Token { core: SubModule<Erc721Base>, metadata: SubModule<Erc721MetadataExtension>, ownable: SubModule<Ownable> } 2.3.9. Update external contract calls.​ However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()). 0.8.0Prev #[odra::external_contract] pub trait Token { fn balance_of(&self, owner: &Address) -> U256; } // Usage TokenContractRef::new(env, token).balance_of(account) 2.3.10. Update constructors.​ Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init. 2.3.11. Update UnwrapOrRevert calls.​ The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter. 2.3.12. Remove #[odra(using)] attribute from your module definition.​ Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required. ","version":"1.0.0","tagName":"h3"},{"title":"2.4. Update Tests​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#24-update-tests","content":"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make: 2.4.1. Contract deployment.​ The way you deploy a contract has changed: You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function. 0.8.0Prev // A contract without init args use super::OwnableHostRef; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; let env: HostEnv = odra_test::env(); let ownable = OwnableHostRef::deploy(&env, NoArgs) // A contract with init args use super::{Erc20HostRef, Erc20InitArgs}; use odra::host::{Deployer, HostEnv}; let env: HostEnv = odra_test::env(); let init_args = Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) }; let erc20 = Erc20HostRef::deploy(&env, init_args); 2.4.2. Host interactions.​ Replace odra::test_env with odra_test::env().The API of odra::test_env and odra_test::env() are similar, but there are some differences: test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).test_env::token_balance(Address) is now env.balance_of(&Address).functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef. 2.4.3. Testing failing scenarios.​ test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result.try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro. 0.8.0Prev #[test] fn transfer_from_error() { let (env, mut erc20) = setup(); let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); assert_eq!( erc20.try_transfer_from(owner, recipient, amount), Err(Error::InsufficientAllowance.into()) ); } 2.4.4. Testing events.​ assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options. 0.8.0Prev let env: HostEnv = odra_test::env(); let erc20 = Erc20HostRef::deploy(&env, init_args); ... assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); ","version":"1.0.0","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.8.0. 0.8.0Prev src/erc20.rs use crate::erc20::errors::Error::*; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address, Event}; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[derive(Event, Eq, PartialEq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { use super::{ errors::Error, events::{Approval, Transfer}, Erc20HostRef, Erc20InitArgs }; use odra::{ casper_types::U256, host::{Deployer, HostEnv, HostRef}, prelude::* }; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } // Other tests... } ","version":"1.0.0","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"1.0.0","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"1.0.0","tagName":"h2"},{"title":"CEP-18","type":0,"sectionRef":"#","url":"/docs/tutorials/cep18","content":"","keywords":"","version":"1.0.0"},{"title":"Self-governing token​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#self-governing-token","content":"There are many ways to implement a governance mechanism for a token, each more complex than the other. In our example, we will use a simple one, where the community of token holders can vote to mint new tokens. ","version":"1.0.0","tagName":"h2"},{"title":"Token implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#token-implementation","content":"Let's start by creating a new project, choosing a clever name and using cep18 as our starting template: cargo odra new --name ourcoin --template cep18 Let's glance at our token code: src/token.rs #[odra::module] pub struct MyToken { token: SubModule<Cep18>, } impl MyToken { // Delegate all Cep18 functions to the token sub-module. delegate! { to self.token { ... fn name(&self) -> String; fn symbol(&self) -> String; ... As we can see, it indeed uses the Cep18 module and delegates all the methods to it. The only thing to do is to change the name of the struct to more appropriate OurToken, run the provided tests using cargo odra test, and continue with the implementation of the governance. note Remember to change the name of the struct and its usages as well as the struct name in the Odra.toml file! ","version":"1.0.0","tagName":"h2"},{"title":"Governance implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#governance-implementation","content":"Let's go through the process of implementing the governance mechanism. If we don't want to, we don't have to hide entrypoints from the public responsible for minting new tokens. By default, minting Modalityis turned off, so any attempt of direct minting will result in an error. We will however implement a voting mechanism, where the token holders can vote to mint new tokens. ","version":"1.0.0","tagName":"h2"},{"title":"Voting mechanism​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#voting-mechanism","content":"Our voting system will be straightforward: Anyone with the tokens can propose a new mint.Anyone with the tokens can vote for the new mint by staking their tokens.If the majority of the token holders vote for the mint, it is executed. Storage​ We will need to store some additional information about the votes, so let's add some fields to our token struct: src/token.rs #[odra::module] pub struct OurToken { /// A sub-module that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } Notice that proposed_mint contains a tuple containing the address of the proposer and the amount of tokens to mint. Moreover, we need to keep track if the vote time has ended, but also if it was already tallied, that's why we need both is_vote_open and vote_end_time. We will also use the power of the Listtype to store the Ballots. Proposing a new mint​ To implement the endpoint that allows token holders to propose a new mint, we need to add a new function to our token module: src/token.rs /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open().get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 60 * 10 * 1000); } As a parameters to the function, we pass the address of the account that should be the receiver of the minted tokens, and the amount. After some validation, we open the vote by setting the is_vote_open to true, and setting the vote_end_time to 10 minutes. In real-world scenarios, the time could be configurable, but for the sake of simplicity, we hardcoded it. Also, it should be quite longer than 10 minutes, but it will come in handy when we test it on Livenet. Voting for the mint​ Next, we need an endpoint that will allow us to cast a ballot: src/token.rs /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token .transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } The most interesting thing here is that we are using a mechanism of staking, where we transfer our tokens to the contract, to show that we really mean it. The tokens will be locked until the vote is over, and tallied. Speaking of tallying... Tallying the votes​ The last step is to tally the votes and mint the tokens if the majority of voters agreed to do so: src/token.rs /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token.raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } Notice how we used raw_transfer from the Cep18 module. We used it to set the sender, so the contract's balance will be used, instead of the caller's. Additonally, we used raw_mint to mint the tokens, skipping the security checks. We have no modality for minting, but even if we had, we don't have anyone with permissions! The Contract needs to mint the tokens itself. ","version":"1.0.0","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#testing","content":"Now, we will put our implementation to the test. One unit test, that we can run both on OdraVM and on the CasperVM. src/token.rs #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } We can run the test using both methods: cargo odra test cargo odra test -b casper It is all nice and green, but it would be really nice to see it in action. How about deploying it on the Casper network? ","version":"1.0.0","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#whats-next","content":"We will se our token in action, by deploying it on the Casper network, and using tools from the Casper Ecosystem to interact with it. ","version":"1.0.0","tagName":"h2"},{"title":"Complete code​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#complete-code","content":"Here is the complete code of the OurToken module: src/token.rs use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var}; use odra_modules::cep18_token::Cep18; /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } /// Errors for the governed token. #[odra::odra_error] pub enum GovernanceError { /// The vote is already in progress. VoteAlreadyOpen = 0, /// No vote is in progress. NoVoteInProgress = 1, /// Cannot tally votes yet. VoteNotYetEnded = 2, /// Vote ended VoteEnded = 3, /// Only the token holders can propose a new mint. OnlyTokenHoldersCanPropose = 4, } /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct OurToken { /// A submodule that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl OurToken { /// Initializes the contract with the given metadata and initial supply. pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { // We put the token address as an admin, so it can govern itself. Self-governing token! self.token .init(symbol, name, decimals, initial_supply, vec![], vec![], None); } // Delegate all Cep18 functions to the token submodule. delegate! { to self.token { /// Admin EntryPoint to manipulate the security access granted to users. /// One user can only possess one access group badge. /// Change strength: None > Admin > Minter /// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an /// Admin, also if a user is added to Admin and None then they will be removed from having rights. /// Beware: do not remove the last Admin because that will lock out all admin functionality. fn change_security( &mut self, admin_list: Vec<Address>, minter_list: Vec<Address>, none_list: Vec<Address> ); /// Returns the name of the token. fn name(&self) -> String; /// Returns the symbol of the token. fn symbol(&self) -> String; /// Returns the number of decimals the token uses. fn decimals(&self) -> u8; /// Returns the total supply of the token. fn total_supply(&self) -> U256; /// Returns the balance of the given address. fn balance_of(&self, address: &Address) -> U256; /// Returns the amount of tokens the owner has allowed the spender to spend. fn allowance(&self, owner: &Address, spender: &Address) -> U256; /// Approves the spender to spend the given amount of tokens on behalf of the caller. fn approve(&mut self, spender: &Address, amount: &U256); /// Decreases the allowance of the spender by the given amount. fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256); /// Increases the allowance of the spender by the given amount. fn increase_allowance(&mut self, spender: &Address, inc_by: &U256); /// Transfers tokens from the caller to the recipient. fn transfer(&mut self, recipient: &Address, amount: &U256); /// Transfers tokens from the owner to the recipient using the spender's allowance. fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256); /// Mints new tokens and assigns them to the given address. fn mint(&mut self, owner: &Address, amount: &U256); /// Burns the given amount of tokens from the given address. fn burn(&mut self, owner: &Address, amount: &U256); } } /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env() .revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 10 * 60 * 1000); } /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token.transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token .raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } fn assert_vote_in_progress(&self) { if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() > finish_time { self.env().revert(GovernanceError::VoteEnded); } } } #[cfg(test)] mod tests { use super::*; use odra::host::Deployer; #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } } ","version":"1.0.0","tagName":"h2"},{"title":"Build, Deploy and Read the State of a Contract","type":0,"sectionRef":"#","url":"/docs/tutorials/build-deploy-read","content":"","keywords":"","version":"1.0.0"},{"title":"Contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#contract","content":"Let's write a contract with complex storage layout. The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping. We will expose two methods: The constructor init which sets the metadata and the version of the contract.The method set_data which sets the value of the numeric field and the values of the mapping. custom_item.rs use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var}; // A custom type with a vector of another custom type #[odra::odra_type] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[odra::odra_type] pub struct Price { value: U256, } // The main contract with a version, metadata and a submodule #[odra::module] pub struct CustomItem { version: Var<u32>, meta: Var<Metadata>, data: SubModule<Data> } #[odra::module] impl CustomItem { pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) { let meta = Metadata { name, description, prices: vec![ Price { value: price_1 }, Price { value: price_2 } ] }; self.meta.set(meta); self.version.set(self.version.get_or_default() + 1); } pub fn set_data(&mut self, value: u32, name: String, name2: String) { self.data.value.set(value); self.data.inner.named_values.set(&name, 10); self.data.inner.named_values.set(&name2, 20); } } // A submodule with a numeric value and another submodule #[odra::module] struct Data { value: Var<u32>, inner: SubModule<InnerData>, } // A submodule with a mapping #[odra::module] struct InnerData { named_values: Mapping<String, u32>, } ","version":"1.0.0","tagName":"h3"},{"title":"Deploying the contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#deploying-the-contract","content":"First, we need to setup the chain. We will use the NCTL docker image to run a local network. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Next, we need to compile the contract to a Wasm file. cargo odra build -c custom_item Then, we can deploy the contract using the casper-client tool. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key path/to/your/secret_key.pem \\ --session-path [PATH_TO_WASM] \\ --payment-amount 100000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string='My Name'" \\ --session-arg "description:string='My Description'" \\ --session-arg "price_1:u256='101'" \\ --session-arg "price_2:u256='202'" Finally, we can call the set_data method to set the values of the contract. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key ./keys/secret_key.pem \\ --payment-amount 2000000000 \\ --session-hash [DEPLOYED_CONTRACT_HASH] \\ --session-entry-point "set_data" \\ --session-arg "value:u32:'666'" \\ --session-arg "name:string='alice'" \\ --session-arg "name2:string='bob'" ","version":"1.0.0","tagName":"h3"},{"title":"Storage Layout​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#storage-layout","content":"To read the state of the contract, we need to understand the storage layout. The first step is to calculate the index of the keys. Storage Layout CustomItem: prefix: 0x0..._0000_0000_0000 0 version: u32, 0x0..._0000_0000_0001 1 meta: Metadata, 0x0..._0000_0000_0010 2 data: Data: prefix: 0x0..._0000_0000_0011 3 value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1 inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2 named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1 The actual key is obtained as follows: Convert the index to a big-endian byte array.Concatenate the index with the mapping data.Hash the concatenated bytes using blake2b.Return the hex representation of the hash (the stored key must be utf-8 encoded). In more detail, the storage layout is described in the Storage Layout article. ","version":"1.0.0","tagName":"h3"},{"title":"Reading the state​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#reading-the-state","content":"RustTypeScript main.rs use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity}; use casper_types::{ bytesrepr::{FromBytes, ToBytes}, U256, }; // replace with your contract hash const CONTRACT_HASH: &str = "hash-..."; const NODE_ADDRESS: &str = "http://localhost:11101/rpc"; const RPC_ID: &str = "casper-net-1"; const DICTIONARY_NAME: &str = "state"; #[derive(Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } async fn read_state_key(key: String) -> Vec<u8> { let state_root_hash = casper_client::get_state_root_hash( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, None, ) .await .unwrap() .result .state_root_hash .unwrap(); // Read the value from the `state` dictionary. let result = casper_client::get_dictionary_item( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, state_root_hash, DictionaryItemIdentifier::ContractNamedKey { key: CONTRACT_HASH.to_string(), dictionary_name: DICTIONARY_NAME.to_string(), dictionary_item_key: key, }, ) .await .unwrap() .result .stored_value; // We expect the value to be a CLValue if let StoredValue::CLValue(cl_value) = result { // Ignore the first 4 bytes, which are the length of the CLType. cl_value.inner_bytes()[4..].to_vec() } else { vec![] } } async fn metadata() -> Metadata { // The key for the metadata is 2, and it has no mapping data let key = key(2, &[]); let bytes = read_state_key(key).await; // Read the name and store the remaining bytes let (name, bytes) = String::from_bytes(&bytes).unwrap(); // Read the description and store the remaining bytes let (description, bytes) = String::from_bytes(&bytes).unwrap(); // A vector is stored as a u32 size followed by the elements // Read the size of the vector and store the remaining bytes let (size, mut bytes) = u32::from_bytes(&bytes).unwrap(); let mut prices = vec![]; // As we know the size of the vector, we can loop over it for _ in 0..size { // Read the value and store the remaining bytes let (value, rem) = U256::from_bytes(&bytes).unwrap(); bytes = rem; prices.push(Price { value }); } // Anytime you finish parsing a value, you should check if there are any remaining bytes // if there are, it means you have a bug in your parsing logic. // For simplicity, we will ignore the remaining bytes here. Metadata { name, description, prices } } async fn value() -> u32 { // The key for the value is (3 << 4) + 1, and it has no mapping data let key = key((3 << 4) + 1, &[]); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } async fn named_value(name: &str) -> u32 { // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes let mapping_data = name.to_bytes().unwrap(); let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } fn main() { let runtime = tokio::runtime::Runtime::new().unwrap(); dbg!(runtime.block_on(metadata())); dbg!(runtime.block_on(value())); dbg!(runtime.block_on(named_value("alice"))); dbg!(runtime.block_on(named_value("bob"))); } // The key is a combination of the index and the mapping data // The algorithm is as follows: // 1. Convert the index to a big-endian byte array // 2. Concatenate the index with the mapping data // 3. Hash the concatenated bytes using blake2b // 4. Return the hex representation of the hash (the stored key must be utf-8 encoded) fn key(idx: u32, mapping_data: &[u8]) -> String { let mut key = Vec::new(); key.extend_from_slice(idx.to_be_bytes().as_ref()); key.extend_from_slice(mapping_data); let hashed_key = blake2b(&key); hex::encode(&hashed_key) } fn blake2b(bytes: &[u8]) -> [u8; 32] { let mut result = [0u8; 32]; let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32) .expect("should create hasher"); let _ = std::io::Write::write(&mut hasher, bytes); blake2::digest::VariableOutput::finalize_variable(hasher, &mut result) .expect("should copy hash to the result array"); result } cargo run [src/main.rs:116:5] runtime.block_on(metadata()) = Metadata { name: "My Contract", description: "My Description", prices: [ Price { value: 123, }, Price { value: 321, }, ], } [src/main.rs:117:5] runtime.block_on(value()) = 666 [src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20 [src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10 ","version":"1.0.0","tagName":"h3"},{"title":"ERC-20","type":0,"sectionRef":"#","url":"/docs/tutorials/erc20","content":"","keywords":"","version":"1.0.0"},{"title":"Framework features​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: Advanced storage using key-value pairs,Odra types such as Address,Advanced event assertion. ","version":"1.0.0","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#code","content":"Our module features a considerably more complex storage layout compared to the previous example. It is designed to store the following data: Immutable metadata - name, symbol, and decimals.Total supply.Balances of individual users.Allowances, essentially indicating who is permitted to spend tokens on behalf of another user. ","version":"1.0.0","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#module-definition","content":"erc20.rs use odra::prelude::*; use odra::{Address, casper_types::U256, Mapping, Var}; #[odra::module(events = [Transfer, Approval])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys. ","version":"1.0.0","tagName":"h2"},{"title":"Metadata​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#metadata","content":"erc20.rs #[odra::module] impl Erc20 { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let caller = self.env().caller(); self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.mint(&caller, &initial_supply); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn symbol(&self) -> String { self.symbol.get_or_default() } pub fn decimals(&self) -> u8 { self.decimals.get_or_default() } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } } impl Erc20 { pub fn mint(&mut self, address: &Address, amount: &U256) { self.balances.add(address, *amount); self.total_supply.add(*amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } } #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.L3-L9 - A constructor sets the token metadata and mints the initial supply.L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for: use odra::UnwrapOrRevert; let current_balance = self.balances.get(address).unwrap_or_default(); let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env()); self.balances.set(address, new_balance); ","version":"1.0.0","tagName":"h3"},{"title":"Core​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#core","content":"To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks. erc20.rs #[odra::module] impl Erc20 { ... pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn balance_of(&self, address: &Address) -> U256 { self.balances.get_or_default(&address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } } impl Erc20 { ... fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let owner_balance = self.balances.get_or_default(&owner); if *amount > owner_balance { self.env().revert(Error::InsufficientBalance) } self.balances.set(owner, owner_balance - *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowance(owner, spender); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } let new_allowance = allowance - *amount; self.allowances .set(&(*owner, *spender), new_allowance); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } #[odra::odra_error] pub enum Error { InsufficientBalance = 1, InsufficientAllowance = 2, } Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation? ","version":"1.0.0","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#test","content":"erc20.rs #[cfg(test)] pub mod tests { use super::*; use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}}; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: INITIAL_SUPPLY.into() } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } #[test] fn transfer_from_and_approval_work() { let (env, mut erc20) = setup(); let (owner, recipient, spender) = (env.get_account(0), env.get_account(1), env.get_account(2)); let approved_amount = 3_000.into(); let transfer_amount = 1_000.into(); assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY)); // Owner approves Spender. erc20.approve(&spender, &approved_amount); // Allowance was recorded. assert_eq!(erc20.allowance(&owner, &spender), approved_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount } )); // Spender transfers tokens from Owner to Recipient. env.set_caller(spender); erc20.transfer_from(&owner, &recipient, &transfer_amount); // Tokens are transferred and allowance decremented. assert_eq!( erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY) - transfer_amount ); assert_eq!(erc20.balance_of(&recipient), transfer_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); // assert!(env.emitted(erc20.address(), "Transfer")); } #[test] fn transfer_from_error() { // Given a new instance. let (env, mut erc20) = setup(); // When the spender's allowance is zero. let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); // Then transfer fails. assert_eq!( erc20.try_transfer_from(&owner, &recipient, &amount), Err(Error::InsufficientAllowance.into()) ); } } L146 - Alternatively, if you don't want to check the entire event, you may assert only its type. ","version":"1.0.0","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#whats-next","content":"Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids. ","version":"1.0.0","tagName":"h2"},{"title":"OwnedToken","type":0,"sectionRef":"#","url":"/docs/tutorials/owned-token","content":"","keywords":"","version":"1.0.0"},{"title":"Code​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#code","content":"What should our module be capable of? Conform the Erc20 interface.Allow only the module owner to mint tokens.Enable the current owner to designate a new owner. ","version":"1.0.0","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#module-definition","content":"Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules. owned_token.rs use crate::{erc20::Erc20, ownable::Ownable}; use odra::prelude::*; use odra::module::SubModule; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } As you can see, we do not need any storage definition - we just take advantage of the already-defined modules! ","version":"1.0.0","tagName":"h3"},{"title":"Delegation​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#delegation","content":"owned_token.rs ... use odra::{Address, casper_types::U256}; ... #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } pub fn name(&self) -> String { self.erc20.name() } pub fn symbol(&self) -> String { self.erc20.symbol() } pub fn decimals(&self) -> u8 { self.erc20.decimals() } pub fn total_supply(&self) -> U256 { self.erc20.total_supply() } pub fn balance_of(&self, address: &Address) -> U256 { self.erc20.balance_of(address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.erc20.allowance(owner, spender) } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.erc20.transfer(recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { self.erc20.transfer_from(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { self.erc20.approve(spender, amount); } pub fn get_owner(&self) -> Address { self.ownable.get_owner() } pub fn change_ownership(&mut self, new_owner: &Address) { self.ownable.change_ownership(new_owner); } pub fn mint(&mut self, address: &Address, amount: &U256) { self.ownable.ensure_ownership(&self.env().caller()); self.erc20.mint(address, amount); } } Easy. However, there are a few worth mentioning subtleness: L9-L10 - A constructor is an excellent place to initialize both modules at once.L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.L49-L51 - The same is done with the ownable module.L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner. ","version":"1.0.0","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#summary","content":"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that. ","version":"1.0.0","tagName":"h2"},{"title":"Ownable","type":0,"sectionRef":"#","url":"/docs/tutorials/ownable","content":"","keywords":"","version":"1.0.0"},{"title":"Framework features​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: storing a single value,defining a constructor,error handling,defining and emitting events.registering a contact in a test environment,interactions with the test environment,assertions (value, events, errors assertions). ","version":"1.0.0","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#code","content":"Before we write any code, we define functionalities we would like to implement. Module has an initializer that should be called once. Only the current owner can set a new owner.Read the current owner.A function that fails if called by a non-owner account. ","version":"1.0.0","tagName":"h2"},{"title":"Define a module​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#define-a-module","content":"ownable.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module(events = [OwnershipChanged])] pub struct Ownable { owner: Var<Option<Address>> } That was easy, but it is crucial to understand the basics before we move on. L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var. ","version":"1.0.0","tagName":"h3"},{"title":"Init the module​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#init-the-module","content":"ownable.rs #[odra::module] impl Ownable { pub fn init(&mut self, owner: Address) { if self.owner.get_or_default().is_some() { self.env().revert(Error::OwnerIsAlreadyInitialized) } self.owner.set(Some(owner)); self.env().emit_event(OwnershipChanged { prev_owner: None, new_owner: owner }); } } #[odra::odra_error] pub enum Error { OwnerIsAlreadyInitialized = 1, } #[odra::event] pub struct OwnershipChanged { pub prev_owner: Option<Address>, pub new_owner: Address } Ok, we have done a couple of things, let's analyze them one by one: L1 - The impl should be an Odra module, so add #[odra::module].L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument. L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None. ","version":"1.0.0","tagName":"h3"},{"title":"Features implementation​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#features-implementation","content":"ownable.rs #[odra::module] impl Ownable { ... pub fn ensure_ownership(&self, address: &Address) { if Some(address) != self.owner.get_or_default().as_ref() { self.env().revert(Error::NotOwner) } } pub fn change_ownership(&mut self, new_owner: &Address) { self.ensure_ownership(&self.env().caller()); let current_owner = self.get_owner(); self.owner.set(Some(*new_owner)); self.env().emit_event(OwnershipChanged { prev_owner: Some(current_owner), new_owner: *new_owner }); } pub fn get_owner(&self) -> Address { match self.owner.get_or_default() { Some(owner) => owner, None => self.env().revert(Error::OwnerIsNotInitialized) } } } #[odra::odra_error] pub enum Error { NotOwner = 1, OwnerIsAlreadyInitialized = 2, OwnerIsNotInitialized = 3, } The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along. L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead. ","version":"1.0.0","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#test","content":"ownable.rs #[cfg(test)] mod tests { use super::*; use odra::host::{Deployer, HostEnv, HostRef}; fn setup() -> (OwnableHostRef, HostEnv, Address) { let env: HostEnv = odra_test::env(); let init_args = OwnableInitArgs { owner: env.get_account(0) }; (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0)) } #[test] fn initialization_works() { let (ownable, env, owner) = setup(); assert_eq!(ownable.get_owner(), owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: None, new_owner: owner } ); } #[test] fn owner_can_change_ownership() { let (mut ownable, env, owner) = setup(); let new_owner = env.get_account(1); env.set_caller(owner); ownable.change_ownership(&new_owner); assert_eq!(ownable.get_owner(), new_owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: Some(owner), new_owner } ); } #[test] fn non_owner_cannot_change_ownership() { let (mut ownable, env, _) = setup(); let new_owner = env.get_account(1); ownable.change_ownership(&new_owner); assert_eq!( ownable.try_change_ownership(&new_owner), Err(Error::NotOwner.into()) ); } } L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one). L14 - It is time to define the first test. As you see, it is a regular Rust test.L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract. note You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract. L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function. note The caller switch applies only the next contract interaction, the second call will be done as the default account. L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type. ","version":"1.0.0","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#summary","content":"The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#whats-next","content":"In the next tutorial we will implement a ERC20 standard. ","version":"1.0.0","tagName":"h2"},{"title":"Ticketing System","type":0,"sectionRef":"#","url":"/docs/tutorials/nft","content":"","keywords":"","version":"1.0.0"},{"title":"Ticket Office Contract​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#ticket-office-contract","content":"Our TicketOffice contract will include the following features: Compliance with the CEP-78 standard.Ownership functionality.Only the owner can issue new event tickets.Users can purchase tickets for events.Tickets are limited to a one-time sale.Public access to view the total income of the TicketOffice. ","version":"1.0.0","tagName":"h3"},{"title":"Setup the project​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#setup-the-project","content":"Creating a new NFT token with Odra is straightforward. Use the cargo odra new command to create a new project with the CEP-78 template: cargo odra new --name ticket-office --template cep78 ","version":"1.0.0","tagName":"h3"},{"title":"Contract implementation​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#contract-implementation","content":"Let's start implementing the TicketOffice contract by modify the code generated from the template. src/token.rs use odra::{ args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert }; use odra_modules::access::Ownable; use odra_modules::cep78::{ modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode}, token::Cep78, }; pub type TicketId = u64; #[odra::odra_type] pub enum TicketStatus { Available, Sold, } #[odra::odra_type] pub struct TicketInfo { event_name: String, price: U512, status: TicketStatus, } #[odra::event] pub struct OnTicketIssue { ticket_id: TicketId, event_name: String, price: U512, } #[odra::event] pub struct OnTicketSell { ticket_id: TicketId, buyer: Address, } #[odra::odra_error] pub enum Error { TicketNotAvailableForSale = 200, InsufficientFunds = 201, InvalidTicketId = 202, TicketDoesNotExist = 203, } #[odra::module( events = [OnTicketIssue, OnTicketSell], errors = Error )] pub struct TicketOffice { token: SubModule<Cep78>, ownable: SubModule<Ownable>, tickets: Mapping<TicketId, TicketInfo>, } #[odra::module] impl TicketOffice { pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) { self.ownable.init(); let receipt_name = format!("cep78_{}", collection_name); self.token.init( collection_name, collection_symbol, total_supply, OwnershipMode::Transferable, NFTKind::Digital, NFTIdentifierMode::Ordinal, NFTMetadataKind::Raw, MetadataMutability::Immutable, receipt_name, // remaining args are optional and can set to Maybe::None ... ); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { let env = self.env(); let caller = env.caller(); self.ownable.assert_owner(&caller); // mint a new token let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None); let ticket_id: u64 = token_id .parse() .map_err(|_| Error::InvalidTicketId) .unwrap_or_revert(&env); // store ticket info self.tickets.set( &ticket_id, TicketInfo { event_name: event_name.clone(), price, status: TicketStatus::Available, }, ); // emit an event env.emit_event(OnTicketIssue { ticket_id, event_name, price, }); } #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let owner = self.ownable.get_owner(); let buyer = env.caller(); let value = env.attached_value(); // only tokens owned by the owner can be sold if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner { env.revert(Error::TicketNotAvailableForSale); } let mut ticket = self .tickets .get(&ticket_id) .unwrap_or_revert_with(&env, Error::TicketDoesNotExist); // only available tickets can be sold if ticket.status != TicketStatus::Available { env.revert(Error::TicketNotAvailableForSale); } // check if the buyer sends enough funds if value < ticket.price { env.revert(Error::InsufficientFunds); } // transfer csprs to the owner env.transfer_tokens(&owner, &value); // transfer the ticket to the buyer self.token .transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer); ticket.status = TicketStatus::Sold; self.tickets.set(&ticket_id, ticket); env.emit_event(OnTicketSell { ticket_id, buyer }); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L10-L44 - We define structures and enums that will be used in our contract. TicketStatus enum represents the status of a ticket, TicketInfo struct contains information about a ticket that is written to the storage, TicketId is a type alias for u64. OnTicketIssue and OnTicketSell are events that will be emitted when a ticket is issued or sold.L46-L49 - Register errors and events that will be used in our contract, required to produce a complete contract schema.L51-L53 - TicketOffice module definition. The module contains a Cep78 token, an Ownable module, and a Mapping that stores information about tickets.L58-L74 - The init function has been generated from the template and there is no need to modify it, except the Ownable module initialization.L76-L94 - The issue_ticket function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an OnTicketIssue event.L103 - The payable attribute indicates that the buy_ticket function can receive funds.L104-L134 - The buy_ticket function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an OnTicketSell event. Lets test the contract. The test scenario will be as follows: Deploy the contract.Issue two tickets.Try to buy a ticket with insufficient funds.Buy tickets.Try to buy the same ticket again.Check the balance of the contract. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef}, }; use crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs}; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let mut contract = TicketOfficeHostRef::deploy(&env, init_args); contract.issue_ticket("Ev".to_string(), U512::from(100)); contract.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(0), Err(Error::InsufficientFunds.into()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(1), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Err(Error::TicketNotAvailableForSale.into()) ); } Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with Cep78Error::InvalidTokenOwner because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of. odra/modules/src/cep78/token78.rs pub fn transfer( &mut self, token_id: Maybe<u64>, token_hash: Maybe<String>, source_key: Address, target_key: Address ) -> TransferReceipt { ... if !is_owner && !is_approved && !is_operator { self.revert(CEP78Error::InvalidTokenOwner); } ... } Let's fix it by redesigning our little system. ","version":"1.0.0","tagName":"h3"},{"title":"Redesign​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#redesign","content":"Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary — an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets. The sequence diagram below illustrates the new flow: Ticket Operator Contract​ As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the cargo odra generate command. cargo odra generate -c ticket_operator src/ticket_operator.rs use crate::token::{TicketId, TicketOfficeContractRef}; use odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var}; #[odra::odra_error] pub enum Error { UnknownTicketOffice = 300, } #[odra::module(errors = Error)] pub struct TicketOperator { ticket_office_address: Var<Address>, } #[odra::module] impl TicketOperator { pub fn register(&mut self, ticket_office_address: Address) { self.ticket_office_address.set(ticket_office_address); } // now the operator's `buy_ticket` receives funds. #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let buyer = env.caller(); let value = env.attached_value(); let center = self .ticket_office_address .get() .unwrap_or_revert_with(&env, Error::UnknownTicketOffice); let mut ticket_contract = TicketOfficeContractRef::new(env, center); // now and approved entity - the operator - buys the ticket on behalf of the buyer ticket_contract.buy_ticket(ticket_id, buyer, value); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L4-L7 - Define errors that will be used in the contract.L9-L13 - Define the TicketOperator module that stores the address of the ticketing office.L16-L18 - The register function sets the address of the ticketing office.L20-L32 - The buy_ticket function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a TicketOfficeContractRef to interact we the TicketOffice contract. Note that, the operator's buy_ticket now receives funds. Now we need to adjust the TicketOffice contract to use the TicketOperator contract to buy tickets. src/token.rs use odra::Var; ... #[odra::odra_error] pub enum Error { ... MissingOperator = 204, Unauthorized = 205, } #[odra::module] pub struct TicketOffice { ... operator: Var<Address>, } #[odra::module] impl TicketOffice { ... pub fn register_operator(&mut self, operator: Address) { // only the owner can register an operator let caller = self.env().caller(); self.ownable.assert_owner(&caller); // store the ticketing center address in the operator contract TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address()); self.operator.set(operator); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { // minting logic remains the same... ... // approve the operator to transfer the ticket let operator = self.operator(); self.token .approve(operator, Maybe::Some(ticket_id), Maybe::None); // emit an event ... } pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) { let env = self.env(); let owner = self.ownable.get_owner(); let caller = env.caller(); // make sure the caller is the operator if !self.is_operator(caller) { env.revert(Error::Unauthorized); } ... // the logic remains the same, except for the csprs transfer // it is now handled by the operator contract. // env.transfer_tokens(&owner, &value); } #[inline] fn is_operator(&self, caller: Address) -> bool { Some(caller) == self.operator.get() } #[inline] fn operator(&self) -> Address { self.operator .get() .unwrap_or_revert_with(&self.env(), Error::MissingOperator) } } L15 - the contract stores the operator address.L22-L29 - a new function register_operator allows the owner to register an operator. Also calls the register entry point on the operator contract.L36-38 - modify the issue_ticket function: once a new token is minted, approves the operator to transfer the ticket later.L44-L57 - modify the buy_ticket function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds.We also added two helper functions: is_operator and operator to check if the caller is the operator and get the operator address. Two new errors were added: MissingOperator and Unauthorized. Now we need to update our tests to create a scenario we presented in the sequence diagram. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef, NoArgs}, OdraResult, }; use crate::{ ticket_operator::TicketOperatorHostRef, token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs}, }; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let operator = TicketOperatorHostRef::deploy(&env, NoArgs); let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args); ticket_office.register_operator(operator.address().clone()); ticket_office.issue_ticket("Ev".to_string(), U512::from(100)); ticket_office.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( buy_ticket(&operator, 0, 50), Err(Error::InsufficientFunds.into()) ); assert_eq!(buy_ticket(&operator, 0, 100), Ok(())); assert_eq!(buy_ticket(&operator, 1, 50), Ok(())); assert_eq!( buy_ticket(&operator, 0, 100), Err(Error::TicketNotAvailableForSale.into()) ); assert_eq!(operator.balance_of(), U512::from(150)); } fn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> { operator.with_tokens(U512::from(price)).try_buy_ticket(id) } ","version":"1.0.0","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#conclusion","content":"In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls. ","version":"1.0.0","tagName":"h3"},{"title":"Pausable","type":0,"sectionRef":"#","url":"/docs/tutorials/pauseable","content":"","keywords":"","version":"1.0.0"},{"title":"Code​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#code","content":"As always, we will start with defining functionalities of our module. Check the state - is it paused or not.State guards - a contract should stop execution if is in a state we don't expect.Switch the state. ","version":"1.0.0","tagName":"h2"},{"title":"Events and Error​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#events-and-error","content":"There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way. Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser. pauseable.rs use odra::prelude::*; use odra::Address; #[odra::odra_error] pub enum Error { PausedRequired = 1_000, UnpausedRequired = 1_001, } #[odra::event] pub struct Paused { pub account: Address } #[odra::event] pub struct Unpaused { pub account: Address } ","version":"1.0.0","tagName":"h3"},{"title":"Module definition​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#module-definition","content":"The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused. pauseable.rs use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] pub struct Pausable { is_paused: Var<bool> } ","version":"1.0.0","tagName":"h3"},{"title":"Checks and guards​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#checks-and-guards","content":"Now, let's move to state checks and guards. pauseable.rs impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } pub fn require_not_paused(&self) { if self.is_paused() { self.env().revert(Error::UnpausedRequired); } } pub fn require_paused(&self) { if !self.is_paused() { self.env().revert(Error::PausedRequired); } } } L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused. L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused. ","version":"1.0.0","tagName":"h3"},{"title":"Actions​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#actions","content":"Finally, we will add the ability to switch the module state. pauseable.rs impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); self.env().emit_event(Paused { account: self.env().caller() }); } pub fn unpause(&mut self) { self.require_paused(); self.is_paused.set(false); self.env().emit_event(Unpaused { account: self.env().caller() }); } } pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused). ","version":"1.0.0","tagName":"h3"},{"title":"Pausable counter​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#pausable-counter","content":"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused). pauseable.rs ... use odra::SubModule; ... #[odra::module] pub struct PausableCounter { value: Var<u32>, pauseable: SubModule<Pausable> } #[odra::module] impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); let new_value = self.value.get_or_default() + 1; self.value.set(new_value); } pub fn pause(&mut self) { self.pauseable.pause(); } pub fn unpause(&mut self) { self.pauseable.unpause(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } #[cfg(test)] mod test { use super::*; use odra::host::{Deployer, NoArgs}; #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); assert_eq!( contract.try_increment().unwrap_err(), Error::UnpausedRequired.into() ); assert_eq!(contract.get_value(), 1); } } As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy! ","version":"1.0.0","tagName":"h2"},{"title":"Using Proxy Caller","type":0,"sectionRef":"#","url":"/docs/tutorials/using-proxy-caller","content":"","keywords":"","version":"1.0.0"},{"title":"Contract​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/tutorials/using-proxy-caller#contract","content":"For this tutorial, we will use the TimeLockWallet contract from our examples. examples/src/contracts/tlw.rs use odra::prelude::*; use odra::{casper_types::U512, Address, Mapping, Var}; #[odra::module(errors = Error, events = [Deposit, Withdrawal])] pub struct TimeLockWallet { balances: Mapping<Address, U512>, lock_expiration_map: Mapping<Address, u64>, lock_duration: Var<u64> } #[odra::module] impl TimeLockWallet { /// Initializes the contract with the lock duration. pub fn init(&mut self, lock_duration: u64) { self.lock_duration.set(lock_duration); } /// Deposits the tokens into the contract. #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U512 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env().revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env().emit_event(Deposit { address: caller, amount }); } /// Withdraws the tokens from the contract. pub fn withdraw(&mut self, amount: &U512) { // code omitted for brevity } /// Returns the balance of the given account. pub fn get_balance(&self, address: &Address) -> U512 { // code omitted for brevity } /// Returns the lock duration. pub fn lock_duration(&self) -> u64 { // code omitted for brevity } } /// Errors that may occur during the contract execution. #[odra::odra_error] pub enum Error { LockIsNotOver = 1, CannotLockTwice = 2, InsufficientBalance = 3 } /// Deposit event. #[odra::event] pub struct Deposit { pub address: Address, pub amount: U512 } /// Withdrawal event. #[odra::event] pub struct Withdrawal { pub address: Address, pub amount: U512 } Full code can be found here. ","version":"1.0.0","tagName":"h2"},{"title":"Client​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/tutorials/using-proxy-caller#client","content":"Before we can interact with the node, we need to set it up. We will use the casper-nctl-docker image. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Make sure you have the contract's wasm file and the secret key. # Build the contract cargo odra build -c TimeLockWallet # Extract secret key docker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem RustTypeScript To interact with the contract, we use the livenet backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case). Cargo.toml [package] name = "odra-examples" version = "1.0.0" edition = "2021" [dependencies] odra = { path = "../odra", default-features = false } ... # other dependencies odra-casper-livenet-env = { version = "1.0.0", optional = true } ... # other sections [features] default = [] livenet = ["odra-casper-livenet-env"] ... # other sections [[bin]] name = "tlw_on_livenet" path = "bin/tlw_on_livenet.rs" required-features = ["livenet"] test = false ... # other sections examples/bin/tlw_on_livenet.rs //! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs. use odra::casper_types::{AsymmetricType, PublicKey, U512}; use odra::host::{Deployer, HostRef}; use odra::Address; use odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs}; const DEPOSIT: u64 = 100; const WITHDRAWAL: u64 = 99; const GAS: u64 = 20u64.pow(9); fn main() { let env = odra_casper_livenet_env::env(); let caller = env.get_account(0); env.set_caller(caller); env.set_gas(GAS); let mut contract = TimeLockWalletHostRef::deploy( &env, TimeLockWalletInitArgs { lock_duration: 60 * 60 } ); // Send 100 CSPRs to the contract. contract .with_tokens(U512::from(DEPOSIT)) .deposit(); println!("Caller's balance: {:?}", contract.get_balance(&caller)); // Withdraw 99 CSPRs from the contract. contract.withdraw(&U512::from(WITHDRAWAL)); println!("Remaining balance: {:?}", contract.get_balance(&caller)); } To run the code, execute the following command: ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \\ ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \\ ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \\ cargo run --bin tlw_on_livenet --features=livenet # Sample output 💁 INFO : Deploying "TimeLockWallet". 💁 INFO : Found wasm under "wasm/TimeLockWallet.wasm". 🙄 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558". 💁 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed. 💁 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed. 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy. 🙄 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3". 💁 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed. Caller's balance: 100 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw". 🙄 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e". 💁 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed. Remaining balance: 1 As observed, the contract was successfully deployed, and the Caller deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR. The logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity. ","version":"1.0.0","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/tutorials/using-proxy-caller#conclusion","content":"In this tutorial, we learned how to use the proxy_caller wasm to make a payable function call. We deployed the TimeLockWallet contract, deposited tokens using the proxy_caller with attached CSPRs, and withdrew them. You got to try it out in both Rust and TypeScript, so you can choose whichever you prefer. Rust code seemed simpler, thanks to the Odra livenet backend making chain interactions easier to handle. ","version":"1.0.0","tagName":"h2"},{"title":"Odra for Solidity developers","type":0,"sectionRef":"#","url":"/docs/tutorials/odra-solidity","content":"","keywords":"","version":"1.0.0"},{"title":"Introduction​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#introduction","content":"Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers. ","version":"1.0.0","tagName":"h2"},{"title":"Prerequisites​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#prerequisites","content":"To follow this guide, you should have: Knowledge of Solidity.Familiarity with Ethereum and smart contract concepts.Basic understanding of Rust, as Odra is based on it. ","version":"1.0.0","tagName":"h2"},{"title":"Hello World​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#hello-world","content":"Let's start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message. OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct HelloWorld { greet: Var<String>, } #[odra::module] impl HelloWorld { pub fn init(&mut self, message: String) { self.greet.set(message); } pub fn get(&self) -> String { self.greet.get_or_default() } } As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the odra::module attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the HelloWorld struct has a single state variable greet, which stores the greeting message. The module contains two functions: init to set the greeting message and get to retrieve it. Two key differences are: Odra does not generate getters for public state variables automatically, so you need to define them explicitly.To initialize values, you must do it in the init function, which is the contract constructor. You can't assign defaults outside the constructor. ","version":"1.0.0","tagName":"h2"},{"title":"Variable Storage and State Management​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#variable-storage-and-state-management","content":"","version":"1.0.0","tagName":"h2"},{"title":"Data Types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#data-types","content":"OdraSolidity use core::str::FromStr; use odra::{ casper_types::{bytesrepr::Bytes, U256}, module::Module, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct Primitives { boo: Var<bool>, u: Var<u8>, // u8 is the smallest unsigned integer type u2: Var<U256>, // U256 is the biggest unsigned integer type i: Var<i32>, // i32 is the smallest signed integer type i2: Var<i64>, // i64 is the biggest signed integer type address: Var<Address>, bytes: Var<Bytes>, default_boo: Var<bool>, default_uint: Var<U256>, default_int: Var<i64>, default_addr: Var<Address>, } #[odra::module] impl Primitives { pub fn init(&mut self) { self.boo.set(true); self.u.set(1); self.u2.set(U256::from(456)); self.i.set(-1); self.i2.set(456); self.address.set( Address::from_str( "hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb", ) .unwrap_or_revert(&self.env()), ); self.bytes.set(Bytes::from(vec![0xb5])); let _min_int = U256::zero(); let _max_int = U256::MAX; } // For the types that have default values, we can use the get_or_default method pub fn get_default_boo(&self) -> bool { self.default_boo.get_or_default() } pub fn get_default_uint(&self) -> U256 { self.default_uint.get_or_default() } pub fn get_default_int(&self) -> i64 { self.default_int.get_or_default() } // Does not compile - Address does not have the default value pub fn get_default_addr(&self) -> Address { self.default_addr.get_or_default() } } The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: u8, u16, u32, u64, U128, and U256 for unsigned integers, and i32 and i64 for signed integers. The Address type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the Address type; the workaround is to use Option<Address>. The Bytes type is used to store byte arrays. Values are stored in units called Named Keys and Dictionaries. Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. ","version":"1.0.0","tagName":"h3"},{"title":"Constants and Immutability​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#constants-and-immutability","content":"OdraSolidity use odra::{casper_types::{account::AccountHash, U256}, Address}; #[odra::module] pub struct Constants; #[odra::module] impl Constants { pub const MY_UINT: U256 = U256([123, 0, 0, 0]); pub const MY_ADDRESS: Address = Address::Account( AccountHash([0u8; 32]) ); } In Odra, you can define constants using the const keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the immutable keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's immutable keyword. ","version":"1.0.0","tagName":"h3"},{"title":"Variables​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#variables","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, Var}; #[odra::module] pub struct Variables { text: Var<String>, my_uint: Var<U256>, } #[odra::module] impl Variables { pub fn init(&mut self) { self.text.set("Hello".to_string()); self.my_uint.set(U256::from(123)); } pub fn do_something(&self) { // Local variables let i = 456; // Env variables let timestamp = self.env().get_block_time(); let sender = self.env().caller(); } } In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ContractEnv retrieved using the env() function. ","version":"1.0.0","tagName":"h3"},{"title":"Arrays and Mappings​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#arrays-and-mappings","content":"OdraSolidity use odra::{casper_types::U256, Address, Mapping}; #[odra::module] pub struct MappingContract { my_map: Mapping<Address, Option<U256>> } #[odra::module] impl MappingContract { pub fn get(&self, addr: Address) -> U256 { // self.my_map.get(&addr) would return Option<Option<U256>> // so we use get_or_default instead and unwrap the inner Option self.my_map.get_or_default(&addr).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256) { self.my_map.set(&addr, Some(i)); } pub fn remove(&mut self, addr: Address) { self.my_map.set(&addr, None); } } #[odra::module] pub struct NestedMapping { my_map: Mapping<(Address, U256), Option<bool>> } #[odra::module] impl NestedMapping { pub fn get(&self, addr: Address, i: U256) -> bool { self.my_map.get_or_default(&(addr, i)).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256, boo: bool) { self.my_map.set(&(addr, i), Some(boo)); } pub fn remove(&mut self, addr: Address, i: U256) { self.my_map.set(&(addr, i), None); } } OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct Array { // the size of the array must be known at compile time arr: Var<[u8; 10]>, vec: Var<Vec<u32>>, } #[odra::module] impl Array { pub fn init(&mut self) { self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); self.vec.set(vec![1, 2, 3, 4, 5]); } pub fn get_arr(&self) -> [u8; 10] { self.arr.get_or_default() } pub fn push_vec(&mut self, value: u32) { let mut vec = self.vec.get_or_default(); vec.push(value); self.vec.set(vec); } pub fn pop_vec(&mut self) { let mut vec = self.vec.get_or_default(); vec.pop(); self.vec.set(vec); } pub fn update_arr(&mut self, index: u8, value: u8) { let mut arr = self.arr.get_or_default(); arr[index as usize] = value; self.arr.set(arr); } } For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the Var container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a Mapping or List instead of an array or vector to store data. ","version":"1.0.0","tagName":"h3"},{"title":"Custom types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#custom-types","content":"OdraSolidity use odra::{prelude::*, Var}; #[odra::odra_type] #[derive(Default)] pub enum Status { #[default] Pending, Shipped, Accepted, Rejected, Canceled, } #[odra::module] pub struct Enum { status: Var<Status>, } #[odra::module] impl Enum { pub fn get(&self) -> Status { self.status.get_or_default() } pub fn set(&mut self, status: Status) { self.status.set(status); } pub fn cancel(&mut self) { self.status.set(Status::Canceled); } pub fn reset(&mut self) { self.status.set(Default::default()); } } In Odra, custom types are defined using the #[odra::odra_type] attribute. The enum can have a default value specified using the #[default] attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the Default::default() function. OdraSolidity use odra::{prelude::*, List}; #[odra::odra_type] pub struct Todo { text: String, completed: bool, } #[odra::module] pub struct Enum { // You could also use Var<Vec<Todo>> instead of List<Todo>, // but List is more efficient for large arrays, // it loads items lazily. todos: List<Todo>, } #[odra::module] impl Enum { pub fn create(&mut self, text: String) { self.todos.push(Todo { text, completed: false, }); } pub fn update_text(&mut self, index: u32, text: String) { if let Some(mut todo) = self.todos.get(index) { todo.text = text; self.todos.replace(index, todo); } } pub fn toggle_complete(&mut self, index: u32) { if let Some(mut todo) = self.todos.get(index) { todo.completed = !todo.completed; self.todos.replace(index, todo); } } // Odra does not create getters by default pub fn get(&self, index: u32) -> Option<Todo> { self.todos.get(index) } } Similarly to enums, custom structs are defined using the #[odra::odra_type] attribute. The struct can be used to define a list of items in a contract. The list can be created using the List type, which is more efficient for large arrays as it loads items lazily. ","version":"1.0.0","tagName":"h3"},{"title":"Data Location​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#data-location","content":"In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be memory, storage, or calldata. In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., Var, Mapping, List), the data is stored in the contract's storage. ","version":"1.0.0","tagName":"h3"},{"title":"Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#functions","content":"Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function: impl Erc20 { pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.internal_transfer(&self.env().caller(), recipient, amount); // Transfer logic goes here } fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) { // Internal transfer logic goes here } } Functions can modify contract state and emit events using the ContractEnv function. ","version":"1.0.0","tagName":"h2"},{"title":"View and Pure​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#view-and-pure","content":"OdraSolidity use odra::Var; #[odra::module] pub struct ViewAndPure { x: Var<u32> } #[odra::module] impl ViewAndPure { pub fn add_to_x(&self, y: u32) -> u32 { self.x.get_or_default() + y } } pub fn add(i: u32, j: u32) -> u32 { i + j } In Odra, you don't need to specify view or pure functions explicitly. All functions are considered view functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be &mut self. If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects. ","version":"1.0.0","tagName":"h3"},{"title":"Modifiers​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#modifiers","content":"OdraSolidity use odra::Var; #[odra::module] pub struct FunctionModifier { x: Var<u32>, locked: Var<bool>, } #[odra::module] impl FunctionModifier { pub fn decrement(&mut self, i: u32) -> u32 { self.lock(); self.x.set(self.x.get_or_default() - i); if i > 1 { self.decrement(i - 1); } self.unlock(); } #[inline] fn lock(&mut self) { if self.locked.get_or_default() { self.env().revert("No reentrancy"); } self.locked.set(true); } #[inline] fn unlock(&mut self) { self.locked.set(false); } } In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the lock and unlock functions are called before and after the decrement function, respectively, but they must be called explicitly. As often as practicable, developers should inline functions by including the body of the function within their code using the #[inline] attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances. ","version":"1.0.0","tagName":"h3"},{"title":"Visibility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#visibility","content":"Functions and state variables have to declare whether they are accessible by other contracts. Functions can be declared as: OdraSolidity `pub` inside `#[odra::module]` impl block - any contract/submodule and account can call. `pub` inside a regular impl block - any submodule can call. `default/no modifier/private` - only inside the contract that defines the function. ","version":"1.0.0","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#payable","content":"OdraSolidity use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var}; #[odra::module] pub struct Payable { owner: Var<Address>, } #[odra::module] impl Payable { pub fn init(&mut self) { self.owner.set(self.env().caller()); } #[odra(payable)] pub fn deposit(&self) { } pub fn not_payable(&self) { } pub fn withdraw(&self) { let amount = self.env().self_balance(); self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount); } pub fn transfer(&self, to: Address, amount: U512) { self.env().transfer_tokens(&to, &amount); } } In Odra, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether. ","version":"1.0.0","tagName":"h3"},{"title":"Selectors​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#selectors","content":"In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector. contract_addr.call( abi.encodeWithSignature("transfer(address,uint256)", address, 1234) ) Odra does not support such a mechanism. You must have access to the contract interface to call a function. ","version":"1.0.0","tagName":"h3"},{"title":"Events and Logging​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#events-and-logging","content":"OdraSolidity use odra::{prelude::*, Address}; #[odra::event] pub struct Log { sender: Address, message: String, } #[odra::event] pub struct AnotherLog {} #[odra::module] struct Event; #[odra::module] impl Event { pub fn test(&self) { let env = self.env(); env.emit_event(Log { sender: env.caller(), message: "Hello World!".to_string(), }); env.emit_event(Log { sender: env.caller(), message: "Hello Casper!".to_string(), }); env.emit_event(AnotherLog {}); } } In Odra, events are regular structs defined using the #[odra::event] attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's emit_event() function, passing the event struct as an argument. note Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the Basics section. ","version":"1.0.0","tagName":"h2"},{"title":"Error Handling​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#error-handling","content":"OdraSolidity use odra::{prelude::*, casper_types::{U256, U512}}; #[odra::odra_error] pub enum CustomError { InsufficientBalance = 1, InputLowerThanTen = 2, } #[odra::module] pub struct Error; #[odra::module] impl Error { pub fn test_require(&mut self, i: U256) { if i <= 10.into() { self.env().revert(CustomError::InputLowerThanTen); } } pub fn execute_external_call(&self, withdraw_amount: U512) { let balance = self.env().self_balance(); if balance < withdraw_amount { self.env().revert(CustomError::InsufficientBalance); } } } In Solidity, there are four ways to handle errors: require, revert, assert, and custom errors. In Odra, there is only one way to revert the execution of a function - by using the env().revert() function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the #[odra::odra_error] attribute. On Casper, an error is only a number, so you can't pass a message with the error. ","version":"1.0.0","tagName":"h2"},{"title":"Composition vs. Inheritance​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#composition-vs-inheritance","content":"In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another. Let's take a look at the difference between inheritance in Solidity and composition in Odra. OdraSolidity use odra::{prelude::*, SubModule}; #[odra::module] pub struct A; #[odra::module] impl A { pub fn foo(&self) -> String { "A".to_string() } } #[odra::module] pub struct B { a: SubModule<A> } #[odra::module] impl B { pub fn foo(&self) -> String { "B".to_string() } } #[odra::module] pub struct C { a: SubModule<A> } #[odra::module] impl C { pub fn foo(&self) -> String { "C".to_string() } } #[odra::module] pub struct D { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl D { pub fn foo(&self) -> String { self.c.foo() } } #[odra::module] pub struct E { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl E { pub fn foo(&self) -> String { self.b.foo() } } #[odra::module] pub struct F { a: SubModule<A>, b: SubModule<B>, } #[odra::module] impl F { pub fn foo(&self) -> String { self.a.foo() } } Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers. In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts. ","version":"1.0.0","tagName":"h2"},{"title":"Libraries and Utility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#libraries-and-utility","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var}; mod math { use odra::casper_types::U256; pub fn sqrt(y: U256) -> U256 { let mut z = y; if y > 3.into() { let mut x = y / 2 + 1; while x < z { z = x; x = (y / x + x) / 2; } } else if y != U256::zero() { z = U256::one(); } z } } #[odra::module] struct TestMath; #[odra::module] impl TestMath { pub fn test_square_root(&self, x: U256) -> U256 { math::sqrt(x) } } #[odra::odra_error] enum Error { EmptyArray = 100, } trait Removable { fn remove(&mut self, index: usize); } impl Removable for Var<Vec<U256>> { fn remove(&mut self, index: usize) { let env = self.env(); let mut vec = self.get_or_default(); if vec.is_empty() { env.revert(Error::EmptyArray); } vec[index] = vec.pop().unwrap_or_revert(&env); self.set(vec); } } #[odra::module] struct TestArray { arr: Var<Vec<U256>>, } #[odra::module] impl TestArray { pub fn test_array_remove(&mut self) { let mut arr = self.arr.get_or_default(); for i in 0..3 { arr.push(i.into()); } self.arr.set(arr); self.arr.remove(1); let arr = self.arr.get_or_default(); assert_eq!(arr.len(), 2); assert_eq!(arr[0], 0.into()); assert_eq!(arr[1], 2.into()); } } In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the Math library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the TestMath contract calls the sqrt function directly, while the TestArray contract uses the using keyword, which extends the type uint256[] by adding the remove function. In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the Removable trait for the Var<Vec<U256>> type allows the remove function to be called on a variable that stores a vector of U256 values. ","version":"1.0.0","tagName":"h2"},{"title":"Fallback and Receive Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#fallback-and-receive-functions","content":"In Solidity, a contract receiving Ether must implement a receive() and/or fallback() function. The receive() function is called when Ether is sent to the contract with no data, while the fallback() function is called when the contract receives Ether with data or when a function that does not exist is called. Odra does not have a direct equivalent to the receive() and fallback() functions. Instead, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. ","version":"1.0.0","tagName":"h2"},{"title":"Miscellaneous​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#miscellaneous","content":"","version":"1.0.0","tagName":"h2"},{"title":"Hashing​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#hashing","content":"OdraSolidity use odra::{ casper_types::{bytesrepr::ToBytes, U256}, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct HashFunction; #[odra::module] impl HashFunction { pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] { let env = self.env(); let mut data = Vec::new(); data.extend(text.to_bytes().unwrap_or_revert(&env)); data.extend(num.to_bytes().unwrap_or_revert(&env)); data.extend(addr.to_bytes().unwrap_or_revert(&env)); env.hash(data) } } #[odra::module] pub struct GuessTheMagicWord { answer: Var<[u8; 32]>, } #[odra::module] impl GuessTheMagicWord { /// Initializes the contract with the magic word hash. pub fn init(&mut self) { self.answer.set([ 0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84, 0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55, 0xbe, 0xd7, 0x56, 0x08, ]); } /// Checks if the `word` is the magic word. pub fn guess(&self, word: String) -> bool { let env = self.env(); let hash = env.hash(word.to_bytes().unwrap_or_revert(&env)); hash == self.answer.get_or_default() } } The key difference between the two is that in Solidity, the keccak256 function is used to hash data, while in Odra, the env.hash() function is used, which implements the blake2b algorithm. Both functions take a byte array as input and return a 32-byte hash. ","version":"1.0.0","tagName":"h3"},{"title":"Try-catch​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#try-catch","content":"OdraSolidity use odra::{module::Module, Address, ContractRef, Var}; #[odra::module] pub struct Example { other_contract: Var<Address>, } #[odra::module] impl Example { pub fn init(&mut self, other_contract: Address) { self.other_contract.set(other_contract); } pub fn execute_external_call(&self) { if let Some(addr) = self.other_contract.get() { let result = OtherContractContractRef::new(self.env(), addr).some_function(); match result { Ok(success) => { // Code to execute if the external call was successful } Err(reason) => { // Code to execute if the external call failed } } } } } #[odra::module] pub struct OtherContract; #[odra::module] impl OtherContract { pub fn some_function(&self) -> Result<bool, ()> { Ok(true) } } In Solidity, try/catch is a feature that allows developers to handle exceptions and errors more gracefully. The try/catch statement allows developers to catch and handle exceptions that occur during external function calls and contract creation. In Odra, there is no direct equivalent to the try/catch statement in Solidity. However, you can use the Result type to handle errors in a similar way. The Result type is an enum that represents either success (Ok) or failure (Err). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts. ","version":"1.0.0","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#conclusion","content":"Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development. Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework. Read more about the Odra Framework in the Basics and Advanced sections. Learn by example with our Tutorial series, you will find there a contract you likely familiar with - the Erc20 standard implementation. If you have any further questions or need clarification on specific topics, feel free to join our Discord! ","version":"1.0.0","tagName":"h2"}],"options":{"excludeRoutes":["docs/0.2.0/**/*","docs/0.3.0/**/*","docs/0.3.1/**/*","docs/0.4.0/**/*","docs/0.5.0/**/*","docs/0.6.0/**/*","docs/0.7.0/**/*","docs/0.8.0/**/*","docs/0.9.0/**/*","docs/0.9.1/**/*"],"id":"default"}} \ No newline at end of file diff --git a/docs/search-doc.json b/docs/search-doc.json new file mode 100644 index 000000000..d21e97dc1 --- /dev/null +++ b/docs/search-doc.json @@ -0,0 +1 @@ +{"searchDocs":[{"title":"It's all about the community!","type":0,"sectionRef":"#","url":"/blog/its-all-about-the-community","content":"","keywords":"","version":null},{"title":"Hello Odra Community​","type":1,"pageTitle":"It's all about the community!","url":"/blog/its-all-about-the-community#hello-odra-community","content":"Whether you are a Rust developer, Solidity developer or a Casper enthusiast we are happy to have you here, reading this blog post. We have built Odra to make smart contract development on Casper easy. Now we are entering the next phase of the open source journey. We are going to focus on the community and make sure Odra is the best tool for the job. Our motto (we borrowed from the Django Project) is: We bring cutting-edge smart contract development tools to professionals with deadlines. How will we do it? We are going to focus on four things: Quality - Our code and documentation will be of the highest quality. We will always have tons of tests and examples.Simplicity - The simplest solution is the best solution. Odra's API needs to be simple and easy to use. Always! We are not afraid to take a few steps back and rethink our design. We believe in short feedback loops and fast iterations.Reusability - No one likes to repeat itself. We see a huge potential in Odra Modules. In time, it can become a standard library of Casper smart contracts, that are battle-tested and ready to use.Community - We are here to help you. You can always reach out to us on Discord or Github. ","version":null,"tagName":"h2"},{"title":"We will help with your project​","type":1,"pageTitle":"It's all about the community!","url":"/blog/its-all-about-the-community#we-will-help-with-your-project","content":"Whether you are a Rust developer or not, you can start using Odra today. We have prepared a few examples and docs to help you get started. Rust knowledge required to use Odra is minimal. That was always the goal. But we understand that it is hard to start. We got your back. We offer free consulting + 2 hours of live coding. All you have to do is write us an email at contract@odra.devwith a short description of your project. We will schedule a call and help you get started with Odra. After 2 hours of live coding, you will have a working repository with 2 or 3 smart contracts, that you can use as a starting point for your project. ","version":null,"tagName":"h2"},{"title":"Roadmap​","type":1,"pageTitle":"It's all about the community!","url":"/blog/its-all-about-the-community#roadmap","content":"The feedback we got quite often was:It's nice, but will it last? What's the direction of the project?Point taken. Now we answer: We are here to stay.We got the support from the Casper Association and some projects of our own to keep us funded. We play the long game. To systematize our work, we have prepared the roadmap. As of now, we maintain plans for at least three future releases. It is a good balance between predictability and flexibility. We will release new versions approximately every 1-2 months or as needed. Everyone is encouraged to propose a new Odra feature or enhancement. New proposals need to be discussed and approved by the core team. When the feature is ready, we assign it to one of the future releases. ","version":null,"tagName":"h2"},{"title":"Zero Knowledge on Casper","type":0,"sectionRef":"#","url":"/blog/casper-zk-risc0","content":"","keywords":"","version":null},{"title":"Zero Knowledge​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#zero-knowledge","content":"In my opinion, the zero knowledge (ZK) is the largest revolution in blockchains, since Ethereum introduced Turing-complete, account-based smart contracts. To put it in simple words, ZK enables two use cases not possible before: Computation scaling - I can perform expensive computation off-chain and put the result on a chain with the proof.Anonymity - I can prove to you, I know something without revealing it. ","version":null,"tagName":"h2"},{"title":"Risc Zero​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#risc-zero","content":"I'd like to introduce you to Risc Zero. It is the general purpose zero-knowledge virtual machine. Go ahead and spend time reading their website! For us, the key component is the proof verifier that can be compiled into WASM. Sooo... we can run it on Casper :) Yes! We can prove any program, produce proof, and send it to Casper's smart contract for verification. ","version":null,"tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#example","content":"Let's dive into the example to see how it works.The full example codeyou can find on our GitHub. It is based on Risc Zero's Hello, Multiply!example. So make sure you understand it first.Guest and Prover sections are taken from this example. ","version":null,"tagName":"h2"},{"title":"Guest​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#guest","content":"The program we are proving is called a guest in Risc Zero. Our goal is to prove we know the factors of an arbitrary number. Given a and b below guest program computes a * b and produces a proof of computation. methods/guest/src/multiply.rs pub fn main() { // Load the first number from the host let a: u64 = env::read(); // Load the second number from the host let b: u64 = env::read(); // Verify that neither of them are 1 (i.e. nontrivial factors) if a == 1 || b == 1 { panic!("Trivial factors") } // Compute the product while being careful with integer overflow let product = a.checked_mul(b).expect("Integer overflow"); env::commit(&product); } ","version":null,"tagName":"h3"},{"title":"Prover​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#prover","content":"It's time to run the guest program and build the proof for a specific a and b values. prover/src/main.rs fn main() { // Pick two numbers. let a: u64 = 17; let b: u64 = 23; // First, we make the prover, loading the 'multiply' method. let multiply_src = std::fs::read(MULTIPLY_PATH) .expect("Method code should be present at the specified path."); let mut prover = Prover::new(&multiply_src, MULTIPLY_ID) .expect("Prover should be constructed.",); // Next we send a & b to the guest. prover.add_input_u32_slice(to_vec(&a).unwrap().as_slice()); prover.add_input_u32_slice(to_vec(&b).unwrap().as_slice()); // Run prover & generate receipt let receipt = prover.run() .expect("Valid code should be provable."); // Extract journal of receipt (i.e. output c, where c = a * b) let c: u64 = from_slice(&receipt.journal) .expect("Journal output should deserialize."); // Print an assertion println!("I know the factors of {}, and I can prove it!", c); // Verify receipt, panic if it's wrong. receipt.verify(MULTIPLY_ID).expect( "Code you have proven should successfully verify.", ); // Convert journal to string and store on disk. let journal = serde_json::to_string(&receipt.journal).unwrap(); write_to_file("../data/journal", &journal); // Convert seal to string and store on disk. let seal = serde_json::to_string(&receipt.seal).unwrap(); write_to_file("../data/seal", &seal); // Convert method_id to string and store on disk. let result = serde_json::to_string(MULTIPLY_ID).unwrap(); write_to_file("../data/method", &result); } ","version":null,"tagName":"h3"},{"title":"Verifier​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#verifier","content":"Now the verification step. Given the proof (journal + seal) and the guest program definition (method), Casper's smart contract checks its correctness. This one is written just for the demonstration, but in general you want METHOD_ID to be stored in your contract and both SEAL and JOURNAL to be passed to the contract via arguments from the outside. verifier/src/verifier_contract.rs // Import the proof and the method. const METHOD_ID: &[u8] = &include!("../../data/method"); const SEAL: &[u32] = &include!("../../data/seal"); const JOURNAL: &[u32] = &include!("../../data/journal"); // Verifier contract holds a result of the zk verification. #[odra::module] pub struct Verifier { result: Variable<String>, } #[odra::module] impl Verifier { // Calling this entry point triggers the zk proof verification. pub fn verify(&mut self) { let result = verify(JOURNAL, SEAL, METHOD_ID); self.result.set(result); } // Result getter. pub fn result(&self) -> String { self.result.get().unwrap_or(String::from("Not processed")) } } // The verification method. It constructs new Receipt and verifies it. fn verify(journal: &[u32], seal: &[u32], method_id: &[u8]) -> String { let result = Receipt::new(&journal, &seal).verify(method_id); match result { Ok(()) => String::from("Ok"), Err(err) => format!("Error: {}", err.to_string()) } } ","version":null,"tagName":"h3"},{"title":"Livenet results​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#livenet-results","content":"I have deployed it to the testnet and called the verify method. The result was Ok. Wow, first-ever ZK proof verification on Casper. Trustless bridging, layer 2 here we come :) The cost of running the verify method is 2324 CSPR. That's a lot, but we have to start somewhere. ","version":null,"tagName":"h3"},{"title":"What next​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#what-next","content":"I think it is a good place to outline possible Casper ZK goals for moving this forward. The community should discuss: Building more examples. Risc Zero has a nice battleship game to port over to Casper.Adding Risc Zero verification method to Casper's FFI.Supporting Risc Zero team. We should help develop this awesome open-source project and gain the ZK expertise. ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"Zero Knowledge on Casper","url":"/blog/casper-zk-risc0#join-us","content":"Interested in zero knowledge on Casper? Join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"OpenAI writes ERC20 in Odra","type":0,"sectionRef":"#","url":"/blog/2023-02-27-openai-writes-erc20-in-odra","content":"","keywords":"","version":null},{"title":"OpenAI​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#openai","content":"OpenAI already proved that AI can code. Github Copilot is used by more and more developers. Many times it is mind-blowing how accurate it is. It would be great if one of the OpenAI models could simply work after writing: Q: Write the ERC20 smart contract. A: use odra::{Mapping, Variable}... So far OpenAI hasn't indexed Odra. I even asked ChatGPT. Q: Do you know what is the Odra Framework for writing smart contracts? Response in one sentence. Use Yoda style. A: Aware of an Odra Framework for writing smart contracts, I am not. Soon (year or two) it will happen and Odra will be supported out of the box, simply because it is available on GitHub. ","version":null,"tagName":"h2"},{"title":"DaVinci Edit​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#davinci-edit","content":"OpenAI gives us a great tool called Edit. It uses the same technology Github Copiled it based on called Codex, OpenAI gives us access to the model code-davinci-edit-001. It allows you to paste in the code and ask for changes. See more examples like rewriting Fibonacci to a recursive version here. But it doesn't know Odra. Luckily this is not a problem. I have found a nice trick that allows producing the code I want. We simply have to present all the features of Odra and ask a good question. ","version":null,"tagName":"h2"},{"title":"ERC20 by AI​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#erc20-by-ai","content":"The goal is to bend AI to write the ERC20 token using Odra. The Edit query needs two elements: source code,text that describes what should be changed. As the input source code I wrote the code that uses all the features ERC20 would use. I need odra::module, Variable, Mapping, caller(), Address, constructor, and errors. flipper.rs use odra::{Variable, types::Address, contract_env, Mapping, execution_error}; #[odra::module] pub struct Flipper { value: Variable<bool>, flips_count: Variable<u32>, owner: Variable<Address>, messages: Mapping<(Address, Address), String> } #[odra::module] impl Flipper { #[odra(init)] pub fn init(&mut self, owner: Address) { self.value.set(false); self.owner.set(owner); } pub fn set(&mut self, value: bool) { self.value.set(value); } pub fn flip(&mut self) { self.value.set(!self.get_value()); self.flips_count.set(self.flips_count.get_or_default()); } pub fn get_value(&self) -> bool { self.value.get_or_default() } pub fn get_owner(&self) -> Option<Address> { self.owner.get() } pub fn set_message(&mut self, recipient: Address, msg: String) { let sender = contract_env::caller(); let current_msg = self.messages.get(&(sender, recipient)); match current_msg { Some(_) => contract_env::revert(Error::MessageAlreadyDefined), None => self.messages.set(&(sender, recipient), msg) } } pub fn get_message(&self, sender: Address, recipient: Address) -> String { self.messages.get_or_default(&(sender, recipient)) } } execution_error! { pub enum Error { MessageAlreadyDefined => 1, NotAnMessageSender => 2, } } ChatGPT knows what the ERC20 is, so the kind request for changes is simple. Q: Implement another smart contract called ERC20. Balances should be of type U256. This is the result. ERC20 contract in Odra generated by OpenAI use odra::{Variable, types::Address, contract_env, Mapping, execution_error, U256}; #[odra::module] pub struct ERC20 { name: Variable<String>, symbol: Variable<String>, decimals: Variable<u8>, total_supply: Variable<U256>, balances: Mapping<Address, U256>, allowed: Mapping<(Address, Address), U256> } #[odra::module] impl ERC20 { #[odra(init)] pub fn init(&mut self, name: String, symbol: String, decimals: u8, total_supply: U256) { self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.total_supply.set(total_supply); self.balances.set(&contract_env::caller(), total_supply); } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } pub fn balance_of(&self, owner: Address) -> U256 { self.balances.get_or_default(&owner) } pub fn transfer(&mut self, to: Address, value: U256) { let from = contract_env::caller(); let from_balance = self.balances.get_or_default(&from); let to_balance = self.balances.get_or_default(&to); if from_balance < value { contract_env::revert(Error::InsufficientBalance); } self.balances.set(&from, from_balance - value); self.balances.set(&to, to_balance + value); } pub fn transfer_from(&mut self, from: Address, to: Address, value: U256) { let caller = contract_env::caller(); let from_balance = self.balances.get_or_default(&from); let to_balance = self.balances.get_or_default(&to); let allowed = self.allowed.get_or_default(&(from, caller)); if from_balance < value { contract_env::revert(Error::InsufficientBalance); } if allowed < value { contract_env::revert(Error::InsufficientAllowance); } self.balances.set(&from, from_balance - value); self.balances.set(&to, to_balance + value); self.allowed.set(&(from, caller), allowed - value); } pub fn approve(&mut self, spender: Address, value: U256) { let owner = contract_env::caller(); self.allowed.set(&(owner, spender), value); } pub fn allowance(&self, owner: Address, spender: Address) -> U256 { self.allowed.get_or_default(&(owner, spender)) } } execution_error! { pub enum Error { InsufficientBalance => 1, InsufficientAllowance => 2, } } Wow! ","version":null,"tagName":"h2"},{"title":"What is next?​","type":1,"pageTitle":"OpenAI writes ERC20 in Odra","url":"/blog/2023-02-27-openai-writes-erc20-in-odra#what-is-next","content":"AI already understands smart contracts. It had to read a lot of Solidity code. I checked and it knows Uniswap and Compound source code. Most interesting is that AI was able to implement a concept it already knew from another programming language in the unseen Rust framework. At some point, we will be able to translate all the Solidity code to Odra. Or maybe we will not have to... It is hard to imagine how good it will be in 2025 and beyond. ","version":null,"tagName":"h2"},{"title":"Odra 0.2.0 Released","type":0,"sectionRef":"#","url":"/blog/release-020","content":"","keywords":"","version":null},{"title":"A bit of history​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#a-bit-of-history","content":"More than a year ago Maciej Zieliński resigned from the position of Ecosystem Leader at CasperLabs. Along with Krzysztof Pobiarżyn and Kuba Płaskonka, we formed an engineering team dedicated to smart contracts. Looking at the blockchain ecosystems from the smart contract developer perspective there are two universes. The first one is Solidity, which thrives and is at its best now. It has a ton of well-tested code and security tooling. Whenever an EVM-based blockchain pops out it gets populated by forks of DeFi and DAO protocols. Fascinating network effect emerges - code written for one EVM-based blockchain can be run on every other EVM-based blockchain. The second universe is Rust which compiles to WebAssembly. Here developer communities live in the guarded cities of Polkadot, Cosmos, Solana, Casper, and Near. The code written for one platform is not portable. The network effect never had a chance to arise. The main reason why Odra exists is achieving this cross-chain code reusability. We could paraphrase a bit and say: "One to bring them all and in the code bind them." ","version":null,"tagName":"h2"},{"title":"Odra for Casper​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#odra-for-casper","content":"The very first blockchain we have integrated with Odra is Casper. In comparison to casper-contract API, it greatly cuts development time and offers a much lower entry level. The Odra interface is developer friendly and people familiar with Solidity, Ink, or Near will feel like at home. We hope it will unleash the creativity and bring a whole bunch of products onto Casper. ","version":null,"tagName":"h2"},{"title":"Odra Framework​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#odra-framework","content":"Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. It's free and open source. Odra's goal is to become the go-to smart contract framework for all WebAssembly-based blockchains. A smart contract written using Odra can be executed on all integrated systems. We can do it by abstracting over core concepts that all the above systems are built around. These are type system, storage, entry points, execution context, and testing environment. We believe it will bring standardization to the development of Rust-based smart contracts and enable code reusability we have not yet seen in this ecosystem. Let’s look at a Flipper contract, that holds a boolean value. The contract has a constructor that sets the initial value, and two entry points: flip() and get(), to change and query the current value, respectively. use odra::Variable; #[odra::module] pub struct Flipper { value: Variable<bool>, } #[odra::module] impl Flipper { #[odra(init)] pub fn init(&mut self, value: bool) { self.value.set(value); } pub fn flip(&mut self) { self.value.set(!self.get()); } pub fn get(&self) -> bool { self.value.get_or_default() } } It comes with the CLI tool cargo-odra that makes it easy to use Odra. Neat and simple, isn't it? Do you like it? Start flowing with us! ","version":null,"tagName":"h2"},{"title":"What next​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#what-next","content":"Let's be honest, we are just starting. The codebase is still hot. On the other hand, we are happy with the interfaces we designed. Now is the time to write documentation and tutorials. We are also building the modules library inspired by OpenZeppelin. The security code audit is still ahead of us. ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"Odra 0.2.0 Released","url":"/blog/release-020#join-us","content":"Check out the Odra GitHub repository for more info on how to get the most out of Odra. Should you have questions, join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.2.0/","content":"","keywords":"","version":"0.2.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.2.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.2.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.3.0/","content":"","keywords":"","version":"0.3.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.3.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.3.0","tagName":"h2"},{"title":"EVM at Risc0","type":0,"sectionRef":"#","url":"/blog/evm-at-risc0","content":"","keywords":"","version":null},{"title":"Solidity​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#solidity","content":"As an example, I have this simple Solidity code. It is a calculator with two functions. One for addition and one for the nth Fibonacci number. bytecode/Calculator.sol contract Calculator { function add(uint256 a, uint256 b) public pure returns (uint256) { return a + b; } function fibonacci(uint256 n) public returns (uint256) { if (n <= 1) { return n; } else { return fibonacci(n - 1) + fibonacci(n - 2); } } } It needs to be compiled into the byte code. solc can do this. $ solc \\ --bin-runtime \\ --optimize \\ --overwrite \\ --evm-version istanbul \\ --output-dir bytecode \\ bytecode/Calculator.sol It produces an EVM bytecode in the bytecode directory. $ ls bytecode/ Calculator.bin-runtime Calculator.sol ","version":null,"tagName":"h2"},{"title":"EVM​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#evm","content":"The EVM I used is SputnikVM. Most important it is written in pure Rust and even with no_std mode. This way I can start an in-memory instance of EVM. Then take the bytecode of a contract and install it. Finally, call the contract with arguments and obtain the result value. For now, it's just a Rust code. Risc0 comes later. The code is based on Sputnik's benchmark test. Huge thanks to Michael Birch for helping with Sputnik. Also make sure how EVM's function selectors work. evm-runner/src/lib.rs // Load previously compiled Calculator contract. pub const CALCULATOR_EVM_PROGRAM: &str = include_str!( "../../bytecode/Calculator.bin-runtime" ); // Run Calculator for a given input. pub fn run_calc_contract(input: &str) -> String { run_evm(CALCULATOR_EVM_PROGRAM, input) } // Run a program (contract) for a given input. fn run_evm(program: &str, input: &str) -> String { // Define EVM configuration. let config = Config::istanbul(); let vicinity = MemoryVicinity { gas_price: U256::zero(), origin: H160::default(), block_hashes: Vec::new(), block_number: Default::default(), block_coinbase: Default::default(), block_timestamp: Default::default(), block_difficulty: Default::default(), block_gas_limit: Default::default(), chain_id: U256::one(), block_base_fee_per_gas: U256::zero(), }; // Initialized the state of EVM's memory. let mut state = BTreeMap::new(); // Add our contract under the 0x10 address. state.insert( H160::from_str("0x1000000000000000000000000000000000000000") .unwrap(), MemoryAccount { nonce: U256::one(), balance: U256::from(10000000), storage: BTreeMap::new(), code: hex::decode(program).unwrap(), } ); // Add new user 0xf0 that will be used as the contract caller. state.insert( H160::from_str("0xf000000000000000000000000000000000000000") .unwrap(), MemoryAccount { nonce: U256::one(), balance: U256::from(10000000), storage: BTreeMap::new(), code: Vec::new(), }, ); // Prepare the executor. let backend = MemoryBackend::new(&vicinity, state); let metadata = StackSubstateMetadata::new(u64::MAX, &config); let state = MemoryStackState::new(metadata, &backend); let precompiles = BTreeMap::new(); let mut executor = StackExecutor::new_with_precompiles(state, &config, &precompiles); // Call the 0x10 contract using the 0xf0 user. // Use the input variable. let (exit_reason, result) = executor.transact_call( H160::from_str("0xf000000000000000000000000000000000000000") .unwrap(), H160::from_str("0x1000000000000000000000000000000000000000") .unwrap(), U256::zero(), hex::decode(input).unwrap(), u64::MAX, Vec::new(), ); // Make sure the execution succeeded. assert!(exit_reason == ExitReason::Succeed(ExitSucceed::Returned)); // Return hex encoded string. hex::encode(result) } Let's execute it. In below tests the data variable hold two things: function selector and arguments. For example 61047ff4000000000000000000000000000000000000000000000000000000000000000ais concatination of the function selector (first 8 chars) and 256-bit long argument. It is just fibonacci(10). a is hex of 10 and 37 is hex of 52. evm-runner/src/lib.rs #[test] fn fibonacci_works() { let data = "61047ff4000000000000000000000000000000000000000000000000000000000000000a"; let result = run_calc_contract(data); assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000037"); } #[test] fn addition_works() { let data = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002"; let result = run_calc_contract(data); assert_eq!(result, "0000000000000000000000000000000000000000000000000000000000000009"); } ","version":null,"tagName":"h2"},{"title":"Risc0​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#risc0","content":"It's time for risc0. First the guest program. It is super simple. It takes a string as an argument, passes it to the run_calc_contractand returns the result. methods/guest/src/bin/evm_calc.rs #![no_main] #![no_std] extern crate alloc; use alloc::{string::String}; use risc0_zkvm::guest::{env}; use evm_runner::run_calc_contract; risc0_zkvm::guest::entry!(main); pub fn main() { let input: String = env::read(); let result = run_calc_contract(&input); env::commit(&result); } The final step is calling it under ZK. host/src/main.rs fn main() { println!("Proving Calculator.add(7, 2)"); let input = "771602f700000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000002"; let result = run_prover(input); println!("Proof generated. 7 + 2 = {result}"); println!("Proving Calculator.fibonacci(4)"); let input = "61047ff40000000000000000000000000000000000000000000000000000000000000004"; let result = run_prover(input); println!("Proof generated. fibonacci(4) = {result}"); } fn run_prover(input: &str) -> u32 { // Make the prover. let method_code = std::fs::read(EVM_CALC_PATH).unwrap(); let mut prover = Prover::new(&method_code, EVM_CALC_ID).unwrap(); // Push the input as an argument. prover.add_input_u32_slice(to_vec(input).unwrap().as_slice()); // Execute the prover. let receipt = prover.run().unwrap(); // Verify the proof. assert!(receipt.verify(EVM_CALC_ID).is_ok()); // Return result as an u32 value. let result: String = from_slice(receipt.journal.as_slice()).unwrap(); u32::from_str_radix(&result, 16).unwrap() } $ cargo run --release -p host Proving Calculator.add(7, 2) Proof generated. 7 + 2 = 9 Proving Calculator.fibonacci(4) Proof generated. fibonacci(4) = 3 ","version":null,"tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#conclusion","content":"How amazing and mindblowing it is! Of course, it's just a proof of concept. Yet with further development of Risc0 improving its proving time and with more flexible SputnikVM this approach is more than promising. ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"EVM at Risc0","url":"/blog/evm-at-risc0#join-us","content":"Interested? Join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.3.1/","content":"","keywords":"","version":"0.3.1"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.3.1/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.3.1","tagName":"h2"},{"title":"Nysa","type":0,"sectionRef":"#","url":"/blog/Nysa","content":"","keywords":"","version":null},{"title":"Odra​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#odra","content":"A short reminder: Odra is a high-level smart contract framework for Rust, which encourages rapid development and clean, pragmatic design ... it takes care of much of the hassle of smart contract development, enabling you to focus on writing your dapp without reinventing the wheel. Odra Understanding that people generally dislike learning new things, we've kept this in mind throughout development. Since day one, we have focused on creating Odra with the largest group of smart contract developers in mind - those familiar with Solidity. The Odra Framework is designed to flatten the learning curve for this group. A Solidity developer will encounter familiar concepts such as: ConstructorsPayable functionsMappingsRevertsCurrent callerCurrent block timeA standard module library (similar to OpenZeppelin)And more note It's important to note that the Odra Framework is intentionally blockchain-agnostic. Its design does not target any particular blockchain. Ultimately, Odra is built to support multiple blockchains, allowing the writing of smart contracts in Rust. Having so many similarities, why not take the next step and transpile Solidity code into Odra code? This is where Nysa comes into play. ","version":null,"tagName":"h2"},{"title":"Nysa​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#nysa","content":"Solidity and Rust share some syntax similarities despite being designed for different purposes. Both languages emphasize strong typing, pattern matching, and immutability by default. Nysa performs Solidity-to-Rust transpilation through four simple steps. Solidity Parser Firstly, we need a well-structured Rust representation of Solidity code. Nysa utilizes LALRPOP - a Rust parser generator framework. In the further steps, this enables us to conduct static analysis of the Solidity code, ranging from contract context down to individual expressions. solidity-parser/src/pt.rs // The representation of a Solidity contract #[derive(Debug, PartialEq)] pub struct ContractDefinition { pub doc: Vec<DocComment>, pub loc: Loc, pub ty: ContractTy, pub name: Identifier, pub base: Vec<Base>, pub parts: Vec<ContractPart>, } C3 Linearization One of the most notable distinctions between Rust and Solidity is their approach to inheritance. Rust says No, thx, whereas Solidity opts for The more, the better. Speaking more technically, Solidity supports multiple inheritance with C3 linearization. info The primary purpose of the C3 Linearization Algorithm is to establish a consistent and unambiguous order of method resolution in cases where there might be ambiguity or conflicts due to multiple inheritance. It ensures that the inherited methods are called in a predictable and well-defined sequence based on the class hierarchy and the order in which classes are defined. For simulating C3 linearization, Nysa utilizes an implementation of the C3 linearization in Rust written by Maciej Zieliński, so everything stays in the Odra family. Nysa Parser After that, we step to the essential part, converting Solidity code into Rust code. For example, a Solidity event. event Transfer(address indexed from, address indexed to, uint256 value); can easily be represented as an plain Rust struct - the same name, the same fields, similar types. #[derive(PartialEq, Eq, Debug)] pub struct Transfer { from: Option<Address>, to: Option<Address>, value: U256, } The same we do with contracts, interfaces, libraries, errors, variables, functions, statements, etc. Here is a snippet of the expression parser: nysa/src/parser/odra/expr/mod.rs pub fn parse<T>(expression: &Expression, ctx: &mut T) -> Result<syn::Expr, ParserError> where T: StorageInfo + TypeInfo + EventsRegister + ExternalCallsRegister + ContractInfo + FnContext, { match expression { Expression::Require { condition, error } => error::revert(Some(condition), error, ctx), Expression::ZeroAddress => Ok(parse_quote!(None)), Expression::Add { left, right } => math::add(left, right, ctx), Expression::Subtract { left, right } => math::sub(left, right, ctx), Expression::Increment { expr } => { let expr = parse(expr, ctx)?; Ok(parse_quote!(#expr += 1)) } Expression::ExternalCall { variable, fn_name, args, } => parse_ext_call(variable, fn_name, args, ctx), Expression::Type { ty } => { let ty = ty::parse_plain_type_from_ty(ty, ctx)?; Ok(parse_quote!(#ty)) } Expression::BoolLiteral(b) => Ok(parse_quote!(#b)), ... } } Printing the code The last step is just consuming the resulting C3 AST. Nysa produces a token stream from the AST. Most likely you would write it to a file. And there you are: a Rust smart contract is ready to be compiled! ","version":null,"tagName":"h2"},{"title":"Nysa + Odra​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#nysa--odra","content":"By design, Nysa is a universal tool, so the third step from the pipeline is replaceable. In other words, a Solidity input can be converted to Rust code supporting a framework/SDK of your choice unless you provide a parser implementation. However, the default implementation is OdraParser, which takes a contract written in Solidity and splits out an Odra module. I hope you see an analogy to the first two paragraphs at this point. Nysa the river and Nysa the transpiler flow into Odra. ","version":null,"tagName":"h3"},{"title":"Examples​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#examples","content":"","version":null,"tagName":"h2"},{"title":"Status message​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#status-message","content":"Let's get our hands dirty and create a very simple project. We will write a contract that stores a single mapping of records - an address to a string message. To set up the project, we use cargo odra. cargo odra new -n status -t blank cd status The first thing is to add Nysa to the project and create a rudimentary build.rs where we define the input - a solidity contract and the output - an Odra module generated by Nysa. Cargo.toml [build-dependencies] nysa = { version = "0.1.0", features = ["builder"] } build.rs const DEST_FILE_PATH: &str = "src/status_message.rs"; const SOURCE_FILE_PATH: &str = "src/status_message.sol"; fn main() { nysa::builder::generate_file::<&str, nysa::OdraParser>(SOURCE_FILE_PATH, DEST_FILE_PATH); } Next, implement the contract. Naturally, a Solidity one. src/status_message.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; contract StatusMessage { mapping(address => string) records; function setStatus(string memory status) public payable { address accountId = msg.sender; records[accountId] = status; } function getStatus(address accountId) public view returns (string memory) { return records[accountId]; } } The contract has a single mapping records that stores a message and its owner. Additionally, exposes two entry points: setStatus (sets current's sender message) and getStatus. Following, let's define a lib.rs file. src/lib.rs mod status_message; pub use status_message::{StatusMessage, StatusMessageDeployer, StatusMessageRef}; #[cfg(test)] mod test; The file is straightforward: registers a status_message rust module, reexports some Odra abstractions, and adds a test module. Lastly, we can test our contract. Like the original solidity contract, our Odra contract exposes two entry points: set_message() and get_message(). The test code looks like any other Odra test: we use StatusMessageDeployer to instantiate a contract, which gets us a reference to interact with the contract. src/test.rs use odra::{test_env, types::Address}; use super::*; const ACCOUNT: fn() -> Address = || odra::test_env::get_account(1); #[test] fn set_get_message() { let mut contract = StatusMessageDeployer::default(); test_env::set_caller(ACCOUNT()); contract.set_status("hello".to_string()); assert_eq!("hello".to_string(), contract.get_status(Some(ACCOUNT()))); } #[test] fn get_nonexistent_message() { let contract = StatusMessageDeployer::default(); assert_eq!( String::new(), contract.get_status(Some(ACCOUNT())) ); } cargo odra test # test against MockVM # or cargo odra test -b casper # build a wasm file and test against CasperVM status-message ├── src │ ├── lib.rs │ ├── status_message.sol │ └── test.rs ├── build.rs ├── Cargo.toml └── Odra.toml Full example available here. ","version":null,"tagName":"h3"},{"title":"CappedErc20​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#cappederc20","content":"A more complex, real-world example is a CappedErc20 contract. It is a ERC20 Ownable, Burnable and Capped token contract. plascoin.sol // ... // rest of the code contract Plascoin is ERC20Capped, ERC20Burnable, Ownable { constructor(string memory name_, string memory symbol_, uint256 cap_, address initialOwner) ERC20(name_, symbol_) ERC20Capped(cap_) Ownable(initialOwner) { } function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); } function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Capped) { super._update(from, to, value); } } You can check out the full source code here. Deployment of such a contract onto the Casper testnet is straightforward. We are just two steps from it. # to make sure the contract works as expected # we execute cargo odra test command to build and run tests cargo odra test -b casper # deploy onto the testnet casper-client put-deploy --node-address {{NODE_ADDRESS}} --chain-name casper-test --secret-key {{SECRET_KEY}} \\ --session-path {{CONTRACT_WASM}} \\ --payment-amount 130000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'{{CONTRACT_PACKAGE_HASH_NAMED_KEY}}'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ --session-arg "name:string='{{name}}'" \\ --session-arg "symbol:string='{{symbol}}'" \\ --session-arg "cap:u256='{{cap}}'" \\ --session-arg "initial_owner:opt_key='{{owner}}'" Literally in 5 minutes I was able to: Build a wasm file from Solidity source codeSuccessfully deploy the contract onto Testnet,Mint some tokens,And transfer them. Finally, we compare the costs of Solidity-to-Odra contract and a native CEP-18 implementation. Despite the contracts being different in terms of the internal logic and exposed entry points, such comparison gives us some insight into Nysa's efficiency. action\tCEP-18\tNysadeploy\t143.87\t93.37 transfer\t1.29\t1.36 ","version":null,"tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Nysa","url":"/blog/Nysa#conclusion","content":"Nysa is at early stage of development, but already has shown a huge potential. In a few simple steps, you can take advantage of an existing smart contract and convert it into an Odra module. The module can be a standalone contract, or a building block of a bigger contract. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.5.0/","content":"","keywords":"","version":"0.5.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.5.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.5.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.4.0/","content":"","keywords":"","version":"0.4.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.4.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.4.0","tagName":"h2"},{"title":"Odra + CosmWasm","type":0,"sectionRef":"#","url":"/blog/odra-cosmwasm","content":"","keywords":"","version":null},{"title":"CosmWasm​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#cosmwasm","content":"CosmWasm is a smart contract platform for building dApps on the Cosmos blockchain ecosystem. The platform is designed as a module that can be integrated into the Cosmos SDK, enabling developers who are already building blockchains with the Cosmos SDK to easily incorporate CosmWasm smart contract functionality without the need to modify their existing code. It uses the Rust programming language, so is potentially a perfect candidate for an Odra backend. There are many blockchains like Osmosis, Secret Network, Juno that utilize CosmWasm. ","version":null,"tagName":"h2"},{"title":"Show me your code​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#show-me-your-code","content":"I would like to write a Counter smart contract that is CosmWasm compatible. What are the requirements? It should store a u32 value. The initial value it set by the contract deployer.The value can be incremented.The value can read from the storage.The contract can call another contract and increment its counter. So let's write an Odra module first. counter.rs use odra::{types::{Address, event::OdraEvent}, Variable, contract_env}; use self::events::{Init, ValueUpdated}; #[odra::module] pub struct Counter { pub value: Variable<u32> } #[odra::module] impl Counter { #[odra(init)] pub fn init(&mut self, value: u32) { self.value.set(value); <Init as OdraEvent>::emit(Init { value, }); } pub fn increment(&mut self) { let old_value = self.value.get_or_default(); let new_value = old_value + 1; self.value.set(new_value); ValueUpdated { old_value, new_value, operator: contract_env::caller() }.emit(); } pub fn cross_increment(&mut self, counter_address: Address) { CounterRef::at(counter_address).increment(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } mod events { use odra::types::Address; #[derive(odra::Event)] pub struct ValueUpdated { pub old_value: u32, pub new_value: u32, pub operator: Address } #[derive(odra::Event)] pub struct Init { pub value: u32, } } #[cfg(test)] mod tests { use super::*; #[test] fn deploy() { let counter = CounterDeployer::init(10); assert_eq!(10, counter.get_value()); } #[test] fn increment() { let mut counter = CounterDeployer::init(10); counter.increment(); assert_eq!(11, counter.get_value()); } } But wait, I mentioned CosmWasm, did I? Here the beauty of Odra comes into play. Let's use cargo-odra. cargo odra build -b cosmos And... that's it, congratulations! We have just written and build our first CosmWasm contract. As you see, it is nothing different from building a contract for Casper. No additional code, we only changed the -b flag. ","version":null,"tagName":"h2"},{"title":"Deploy​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#deploy","content":"We have just built a wasm file, but is it really a fully functional contract? As a battlefield let's choose Juno Network (if you would like to read more about smart contract development on Juno read this Quick Start tutorial). This is an arbitrary choice, each client is built upon a so-called Wasm Zone wasmd, and its interface is alike. Assuming you already know how to interact with Juno testnet, let's move to the fun part. But before we go, to keep things simple, let's prepare a justfile. It'll make our interactions with the blockchain much easier. See full version. justfile NODE := "--node https://rpc.uni.juno.deuslabs.fi:443" CHAIN_ID := "--chain-id uni-6" QUERY_FLAGS := NODE + " " + CHAIN_ID TRANSACTION_DEFAULTS := "--gas-prices 0.025ujunox --gas auto --gas-adjustment 1.3 --broadcast-mode block" EXEC_FLAGS := NODE + " " + CHAIN_ID + " " + TRANSACTION_DEFAULTS get-address NAME: junod keys show {{NAME}} | grep -o juno.* store-wasm WASM_PATH SENDER: junod tx wasm store \\ {{WASM_PATH}} --from {{SENDER}} {{EXEC_FLAGS}} init-contract CODE_ID VALUE SENDER CONTRACT_NAME: junod tx wasm instantiate \\ {{CODE_ID}} \\ `just run-args-parser '{"name": "init", "args": [ { "value" : {{VALUE}} }]}'` \\ --label '{{CONTRACT_NAME}}' --from {{SENDER}} \\ --admin `just get-address {{SENDER}}` \\ {{EXEC_FLAGS}} exec-increment ADDRESS SENDER: junod tx wasm execute \\ {{ADDRESS}} \\ `just run-args-parser '{"name": "increment"}'` \\ --from {{SENDER}} \\ {{EXEC_FLAGS}} query-get-value ADDRESS: junod q wasm contract-state smart {{ADDRESS}} \\ `just run-args-parser '{"name": "get_value"}'` {{QUERY_FLAGS}} Ok, we are ready to go. First, a CosmWasm contract needs to be stored, technically is not a contract yet. Like a larva waiting to morph into a butterfly (sorry for that). There are three ways to interact with a contract. Instantiate - in other words, a constructor call. Once the contract is instantiated, it gets an address.Execute - call an entrypoint that modifies the state.Query - read the contract's state. Now, let's take a look at how to do it using the tools we have just prepared. # args: # the path to a wasm file, # the name under we store the private key. just store-wasm counter.wasm odra ... raw_log: '[{"events":[{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgStoreCode"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"store_code","attributes":[{"key":"code_checksum","value":"9fb9e7f39170de2628892ed5eecc556e2487267b30bb2c9656f8c7d1cd9f9a59"},{"key":"code_id","value":"286"}]}]}]' ... txhash: 1A8BA520E980C5ABCBCFA6F62D68B6BB82E780544605DE4DD5C6B1C5E966441B Great, our code is successfully stored. Form the logs we can read now the code_id which we will use to initialize the contract. # args: # code id taken from the previous tx, # counter initial value, # named private key, # contract label. just init-contract 286 1 odra "My Counter" ... raw_log: '[{"events":[{"type":"instantiate","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"code_id","value":"286"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgInstantiateContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]},{"type":"wasm-Init","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"value","value":"1"}]}]}]' ... txhash: 8DC53F95805349C3763CF4AF9527CAB2AEBEC77B240EFD3801C61231D8748F26 Fantastic, the contract has been initialized and we have its address - juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g. It's time to increment the counter. # args: # contract address taken from the previous tx, # named private key just exec-increment juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g odra ... raw_log: '[{"events":[{"type":"execute","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"action","value":"increment"}]},{"type":"wasm-ValueUpdated","attributes":[{"key":"_contract_address","value":"juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g"},{"key":"old_value","value":"1"},{"key":"new_value","value":"2"},{"key":"operator","value":"juno1le848rjac00nezzq46v5unxujaltdf270vhtfh"}]}]}]' ... txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 Finally, we expected, the value to be equal to 2 (the initial value was 1 and we incremented it once). # args: # contract address just query-get-value juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g data: 2 Indeed, as expected the current counter value is 2. ","version":null,"tagName":"h2"},{"title":"Show me your transaction​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#show-me-your-transaction","content":"I get it, you don't want to do it all by yourself. So let's take a closer look at one of my transactions. junod q tx 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 --node https://rpc.uni.juno.deuslabs.fi:443 --chain-id uni-6 ... logs: - events: - attributes: - key: _contract_address value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g type: execute - attributes: - key: action value: /cosmwasm.wasm.v1.MsgExecuteContract - key: module value: wasm - key: sender value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh type: message - attributes: - key: _contract_address value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g - key: action value: increment type: wasm - attributes: - key: _contract_address value: juno10yszsgq4460a57ztuw943h5j3c9l0eyx3algzq080gatl0thecls5ttk7g - key: old_value value: "1" - key: new_value value: "2" - key: operator value: juno1le848rjac00nezzq46v5unxujaltdf270vhtfh type: wasm-ValueUpdated ... txhash: 52141844321B8321DA71D073D4FA0865E73C3940153373CA7EF832D15BC3C2B2 If you are familiar Cosmos ecosystem, you can see that there is an attribute containing the performed action (increment) (If there were some parameters, they would be included in this attribute). We can find here also our ValueUpdated event with its arguments old_value, new_value and operator. Wow, we have it, everything worked as intended! ","version":null,"tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#conclusion","content":"Wouldn't it be great to replace Casper Erc20 and Cosmos Erc20 with a super-simple single Odra Erc20 implementation? The Counter contract is just a POC, and there is still a long road ahead of us. This simple example shows that features like storage, events, and cross-contract calls can be unified in a simple readable interface. CosmWasm integration hasn't been published yet, but if you want to experiment by yourself, check our GitHub (don't forget to update cargo-odra as well). ","version":null,"tagName":"h2"},{"title":"Join us​","type":1,"pageTitle":"Odra + CosmWasm","url":"/blog/odra-cosmwasm#join-us","content":"Interested? Join our Discord, our Twitter or write us at contact@odra.dev. ","version":null,"tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.6.0/","content":"","keywords":"","version":"0.6.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.6.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.6.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.7.0/","content":"","keywords":"","version":"0.7.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.7.0/#whats-next","content":"See the Installation and our Flipper exampleto find out how to start your new project with Odra. ","version":"0.7.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.8.0/","content":"","keywords":"","version":"0.8.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.8.0/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.8.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.8.1/","content":"","keywords":"","version":"0.8.1"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.8.1/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Building contracts manually","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/building-manually","content":"","keywords":"","version":"0.8.1"},{"title":"Building the contract manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#building-the-contract-manually","content":"To build the contract manually, cargo odra uses the following command: ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract info Odra uses the environment variable ODRA_MODULE to determine which contract to build. Assuming that project's crate is named my_project, this command will build the my_contract contract in release mode and generate the wasm file. The file will be put into the target/wasm32-unknown-unknown/release directory under the name my_project_build_contract.wasm. The Odra Framework expects the contracts to be placed in the wasm directory, and to be named correctly, so the next step would be to move the file: mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm ","version":"0.8.1","tagName":"h2"},{"title":"Optimizing the contract​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#optimizing-the-contract","content":"To lower the size of the wasm file, cargo odra uses the wasm-strip tool: wasm-strip wasm/my_contract.wasm To further optimize the wasm file, the wasm-opt tool is also used. wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm danger This step is required, as the wasm file generated by the Rust compiler is not fully compatible with the Casper execution engine. ","version":"0.8.1","tagName":"h2"},{"title":"Running the tests manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#running-the-tests-manually","content":"To run the tests manually, Odra needs to know which backend to use. To run tests agains Casper backend, the following command needs to be used: ODRA_BACKEND=casper cargo test ","version":"0.8.1","tagName":"h2"},{"title":"Wrapping up​","type":1,"pageTitle":"Building contracts manually","url":"/docs/0.8.1/advanced/building-manually#wrapping-up","content":"Let's say we want to build the my_contract in debug mode, run the tests against the casper backend and use the my-own-allocator feature from our my_project project. To do that, we can use the following set of commands: ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm wasm-strip wasm/my_contract.wasm wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm ODRA_BACKEND=casper cargo test --features my-own-allocator ","version":"0.8.1","tagName":"h2"},{"title":"Attributes","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/attributes","content":"","keywords":"","version":"0.8.1"},{"title":"Payable​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#payable","content":"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens. ","version":"0.8.1","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#example","content":"examples/src/contracts/tlw.rs #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U256 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env.revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env() .emit_event(Deposit { address: caller, amount }); } If you try to send tokens to a non-payable function, the transaction will be automatically rejected. ","version":"0.8.1","tagName":"h3"},{"title":"Non Reentrant​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#non-reentrant","content":"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. They can also use reentrancy guards to block recursive calls to sensitive functions. In Odra you can just apply the #[odra(non_reentrant)] attribute to your function. ","version":"0.8.1","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#example-1","content":"#[odra::module] pub struct NonReentrantCounter { counter: Var<u32> } #[odra::module] impl NonReentrantCounter { #[odra(non_reentrant)] pub fn count_ref_recursive(&mut self, n: u32) { if n > 0 { self.count(); ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1); } } } impl NonReentrantCounter { fn count(&mut self) { let c = self.counter.get_or_default(); self.counter.set(c + 1); } } #[cfg(test)] mod test { use super::*; use odra::{host::{Deployer, NoArgs}, ExecutionError}; #[test] fn ref_recursion_not_allowed() { let test_env = odra_test::env(); let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs); let result = contract.count_ref_recursive(11); assert_eq!(result, ExecutionError::ReentrantCall.into()); } } ","version":"0.8.1","tagName":"h3"},{"title":"Mixing attributes​","type":1,"pageTitle":"Attributes","url":"/docs/0.8.1/advanced/attributes#mixing-attributes","content":"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. To apply multiple attributes, you can write: #[odra(payable, non_reentrant)] fn deposit() { // your logic... } or #[odra(payable)] #[odra(non_reentrant)] fn deposit() { // your logic... } In both cases attributes order does not matter. ","version":"0.8.1","tagName":"h2"},{"title":"Advanced Storage Concepts","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/advanced-storage","content":"","keywords":"","version":"0.8.1"},{"title":"Recap and Basic Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#recap-and-basic-concepts","content":"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values. Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract. Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key. List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over. If you need a refresher on these topics, please refer to our guide on basic storage in Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Advanced Storage Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#advanced-storage-concepts-1","content":"","version":"0.8.1","tagName":"h2"},{"title":"Sequence​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#sequence","content":"The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value. pub struct Sequence<T> where T: Num + One + OdraType { value: Var<T> } The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively. ","version":"0.8.1","tagName":"h3"},{"title":"Advanced Mapping​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#advanced-mapping","content":"In Odra, a Mapping is a key-value storage system where the key is associated with a value. In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type derived from odra::OdraType. However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state. Let's consider the following example: examples/src/features/storage/mapping.rs use odra::{casper_types::U256, Mapping, UnwrapOrRevert}; use odra::prelude::*; use crate::owned_token::OwnedToken; #[odra::module] pub struct Mappings { strings: Mapping<(String, u32, String), String>, tokens: Mapping<String, OwnedToken> } #[odra::module] impl Mappings { ... pub fn total_supply(&mut self, token_name: String) -> U256 { self.tokens.module(&token_name).total_supply() } pub fn get_string_api( &self, key1: String, key2: u32, key3: String ) -> String { let opt_string = self.strings.get(&(key1, key2, key3)); opt_string.unwrap_or_revert(&self.env()) } } As you can see, a Mapping key can consist of a tuple of values, not limited to a single value. note Accessing Odra modules differs from accessing regular values such as strings or numbers. Firstly, within a Mapping, you don't encapsulate the module with Submodule. Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules. ","version":"0.8.1","tagName":"h3"},{"title":"AdvancedStorage Contract​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#advancedstorage-contract","content":"The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts. use odra::{Address, casper_types::U512, Sequence, Mapping}; use odra::prelude::*; use crate::modules::Token; #[odra::module] pub struct AdvancedStorage { counter: Sequence<u32>, tokens: Mapping<(String, String), Token>, } impl AdvancedStorage { pub fn current_value(&self) -> u32 { self.counter.get_current_value() } pub fn increment_and_get(&mut self) -> u32 { self.counter.next_value() } pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 { let token = self.tokens.module(&(token_name, creator)); token.balance_of(&address) } pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) { let mut token = self.tokens.module(&(token_name, creator)); token.mint(amount, to); } } ","version":"0.8.1","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/0.8.1/advanced/advanced-storage#conclusion","content":"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are: Odra offers a Sequence module, enabling contracts to store and increment a single value.Mappings support composite keys expressed as tuples and can store modules as values. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts. ","version":"0.8.1","tagName":"h2"},{"title":"Storage Layout","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/storage-layout","content":"","keywords":"","version":"0.8.1"},{"title":"Casper VM Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#casper-vm-perspective","content":"The Casper Execution Engine (VM) enables the storage of data in named keys or dictionaries. However, a smart contract has a limited number of named keys, making it unsuitable for storing substantial data volumes. Odra resolves this issue by storing all user-generated data in a dictionary called state. This dictionary operates as a key-value store, where keys are strings with a maximum length of 64 characters, and values are arbitrary byte arrays. Here is an example of what the interface for reading and writing data could look like: pub trait CasperStorage { fn read(key: &str) -> Option<Vec<u8>>; fn write(key: &str, value: Vec<u8>); } ","version":"0.8.1","tagName":"h2"},{"title":"Odra Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#odra-perspective","content":"Odra was conceived with modularity and code reusability in mind. Additionally, we aimed to streamline storage definition through the struct object. Consider this straightforward storage definition: #[odra::module] pub struct Token { name: Var<String>, balances: Mapping<Address, U256> } The Token structure contains two fields: name of type String andbalances, which functions as a key-value store with Address as keys andU256 as values. The Token module can be reused in another module, as demonstrated in a more complex example: #[odra::module] pub struct Loans { lenders: SubModule<Token>, borrowers: SubModule<Token>, } The Loans module has two fields: lenders and borrowers, both of which have the same storage layout as defined by the Token module. Odra guarantees thatlenders and borrowers are stored under distinct keys within the storage dictionary. Both Token and Loans serve as examples to show how Odra's storage layout operates. ","version":"0.8.1","tagName":"h2"},{"title":"Key generation.​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#key-generation","content":"Every element of a module (struct) with N elements is associated with an index ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an element of a module is another module (SubModule<...>), the associated index serves as a prefix for the indexes of the inner module. While this may initially appear complex, it is easily understood through an example. In the example, indexes are presented as bytes, reflecting the actual implementation. Loans { lenders: Token { // prefix: 0x0000 name: 0, // key: 0x0000_0000 balances: 1 // key: 0x0000_0001 }, borrowers: Token { // prefix: 0x0001 name: 0, // key: 0x0001_0000 balances: 1 // key: 0x0001_0001 } } Additionally, it's worth mentioning how Mapping's keys are used in thestorage. They are simply concatenated with the index of the module, as demonstrated in the example. For instance, triggering borrowers.balances.get(0x1234abcd) would result in a key: 0x0001_0001_1234_abcd Finally, the key must be hashed to fit within the 64-character limit and then encoded in hexadecimal format. ","version":"0.8.1","tagName":"h2"},{"title":"Value serialization​","type":1,"pageTitle":"Storage Layout","url":"/docs/0.8.1/advanced/storage-layout#value-serialization","content":"Before being stored in the storage, each value is serialized into bytes using the CLType serialization method and subsequently encapsulated with Casper'sBytes types. ","version":"0.8.1","tagName":"h2"},{"title":"Memory allocators","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/using-different-allocator","content":"","keywords":"","version":"0.8.1"},{"title":"Using a different allocator​","type":1,"pageTitle":"Memory allocators","url":"/docs/0.8.1/advanced/using-different-allocator#using-a-different-allocator","content":"If the default allocator does not suit your needs, or you use a crate that already provides an allocator, you can disable the default allocator by enabling the disable-allocator feature in the odra dependency in your project: [dependencies] odra = { path = "../odra", features = ["disable-allocator"] } If you want to have a better control over the features that are enabled during the building and tests, see the next article on building manually. ","version":"0.8.1","tagName":"h2"},{"title":"Casper","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/casper","content":"","keywords":"","version":"0.8.1"},{"title":"Contract Env​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#contract-env","content":"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances. ","version":"0.8.1","tagName":"h2"},{"title":"Events​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#events","content":"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity. Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed: __events - a dictionary that stores events' data.__events_length - the evens count.__events_ces_version - the version of Casper Event Standard. __events_schema - a dictionary that stores event schemas. Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key. So, Events are nothing different from any other data stored by a contract. A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[derive(Event)]. note Don't forget to expose events in the module using #[odra::module(events = [...])]. ","version":"0.8.1","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#payable","content":"The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key. Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse. Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. If under the way something goes wrong with the transfer, the contract reverts. The transferred amount can be read inside the contract by calling self.env().attached_value(). note Odra expects the cargo_purse runtime argument to be attached to a contract call. In case of its absence, the contract_env::attached_value() returns zero. ","version":"0.8.1","tagName":"h3"},{"title":"Revert​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#revert","content":"In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User. ","version":"0.8.1","tagName":"h3"},{"title":"Context​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#context","content":"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack. The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address. The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address. As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse. ","version":"0.8.1","tagName":"h3"},{"title":"Test Env​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#test-env","content":"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine. In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000). The Test Env internally keeps track of the current block time, error and attached value. Each test is executed on a fresh instance of the Test Env. ","version":"0.8.1","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#usage","content":"Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -bparameter: cargo odra test -b casper If you want to just generate a wasm file, simply run: cargo odra build -b casper ","version":"0.8.1","tagName":"h2"},{"title":"Deploying a contract to Casper network​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#deploying-a-contract-to-casper-network","content":"There would be no point in writing a contract if you couldn't deploy it to the blockchain. You can do it in two ways: provided by the Casper itself: using the casper-client tool or using the Odra's Livenet integration. Let's explore the first option to better understand the process. note If you wish, you can skip the following section and jump to the Livenet integration. ","version":"0.8.1","tagName":"h2"},{"title":"WASM arguments​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#wasm-arguments","content":"When deploying a new contract you can pass some arguments to it. Every contract written in Odra expects those arguments to be set: odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable. Additionally, if required by the contract, you can pass constructor arguments. When working with the test env via cargo odra or when usingLivenet integration this is handled automatically. However, if you rather usecasper-client directly, you have to pass them manually: ","version":"0.8.1","tagName":"h3"},{"title":"Example: Deploy Counter​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#example-deploy-counter","content":"To deploy your contract with a constructor using casper-client, you need to pass the above arguments. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 5000000000000 \\ --session-path ./wasm/counter.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "value:u32:42" For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'. ","version":"0.8.1","tagName":"h3"},{"title":"Example: Deploy ERC721​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#example-deploy-erc721","content":"Odra comes with a standard ERC721 token implementation. Clone the main Odra repo and navigate to the modules directory. Firstly contract needs to be compiled. cargo odra build -b casper -c erc721_token It produces the erc721_token.wasm file in the wasm directory. Now it's time to deploy the contract. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc721_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string:'MyNFT'" \\ --session-arg "symbol:string:'NFT'" \\ --session-arg "base_uri:string:'https://example.com/'" It's done. The contract is deployed and ready to use. Your account is the owner of the contract and you can mint and burn tokens. For more details see the code of the ERC721 module. To obtain the package hash of the contract search for my_nft key in your account's named keys. ","version":"0.8.1","tagName":"h3"},{"title":"Example: Deploy ERC1155​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#example-deploy-erc1155","content":"The process is similar to the one described in the previous section. Contract compilation: cargo odra build -b casper -c erc1155_token Contract deployment: casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc1155_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ As previously, your account is the owner and can mint and burn tokens. For more details see the code of the ERC1155 module. ","version":"0.8.1","tagName":"h3"},{"title":"Sending CSPR to a contract​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#sending-cspr-to-a-contract","content":"Defining payable entry points is described in Native Token section. What is happening under the hood is that Odra creates a new cargo_purse argument for each payable entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. When a contract adds CSPR to another contract call, Odra handles it for you. The problem arises when you want to call an entry point and attach CSPR as an account. The only way of doing that is by executing code in the sessions context, that top-ups the cargo_purse and then calls the contract. Odra provides a generic proxy_caller.wasm that does exactly that. You can build it by yourself from the main Odra repository, or use the proxy_caller.wasmwe maintain. ","version":"0.8.1","tagName":"h2"},{"title":"Using proxy_caller.wasm​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#using-proxy_callerwasm","content":"To use the proxy_caller.wasm you need to attach the following arguments: contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. Result of to_bytes on CasperPackageHash.entry_point - String type. The name of the entry point you want to call.args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.attached_value. U512 type. The amount of CSPR you want to attach to the call.amount. U512 type. Should be the same value as attached_value if not None. It is a special Casper argument that enables the access to account's main purse. Currently casper-client doesn't allow building such arguments. You have to build it using your SDK. ","version":"0.8.1","tagName":"h3"},{"title":"Execution​","type":1,"pageTitle":"Casper","url":"/docs/0.8.1/backends/casper#execution","content":"First thing Odra does with your code, is similar to the one used in OdraVM - a list of entrypoints is generated, thanks to the #[odra::module] macro. ","version":"0.8.1","tagName":"h2"},{"title":"OdraVM","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/odra-vm","content":"","keywords":"","version":"0.8.1"},{"title":"Usage​","type":1,"pageTitle":"OdraVM","url":"/docs/0.8.1/backends/odra-vm#usage","content":"The OdraVM is the default backend for Odra framework, so each time you run cargo odra test You are running your code against it. ","version":"0.8.1","tagName":"h2"},{"title":"Architecture​","type":1,"pageTitle":"OdraVM","url":"/docs/0.8.1/backends/odra-vm#architecture","content":"OdraVM consists of two main parts: the Contract Register and the State. The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address. Contracts and Test Env functions can modify the State of the OdraVM. Contrary to the "real" backend, which holds the whole history of the blockchain, the OdraVM State holds only the current state of the OdraVM. Thanks to this and the fact that we do not need the blockchain itself, OdraVM starts instantly and runs the tests in the native speed. ","version":"0.8.1","tagName":"h2"},{"title":"Execution​","type":1,"pageTitle":"OdraVM","url":"/docs/0.8.1/backends/odra-vm#execution","content":"When the OdraVM backend is enabled, the #[odra::module] macro is responsible for converting your pub functions into a list of Entrypoints, which are put into a Contract Container. When the contract is deployed, its Container registered into a Registry under an address. During the contract call, OdraVM finds an Entrypoint and executes the code. ","version":"0.8.1","tagName":"h2"},{"title":"What is a backend?","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/what-is-a-backend","content":"","keywords":"","version":"0.8.1"},{"title":"Contract Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/0.8.1/backends/what-is-a-backend#contract-env","content":"The Contract Env is a simple interface that each backend needs to implement, exposing features of the blockchain from the perspective of the contract. It gives Odra a set of functions, which allows implementing more complex concepts - for example, to implement Mapping, Odra requires some kind of storage integration. The exact implementation of those functions is a responsibility of a backend, making Odra and its user free to implement the contract logic, instead of messing with the blockchain internals. Other functions from Contract Env include handling transfers, addresses, block time, errors and events. ","version":"0.8.1","tagName":"h2"},{"title":"Host Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/0.8.1/backends/what-is-a-backend#host-env","content":"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with the backend from the outside world - really useful for implementing tests. This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, to the more test-oriented - handling errors, forwarding the block time, etc. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"What is a backend?","url":"/docs/0.8.1/backends/what-is-a-backend#whats-next","content":"We will take a look at backends Odra implements in more detail. ","version":"0.8.1","tagName":"h2"},{"title":"Delegate","type":0,"sectionRef":"#","url":"/docs/0.8.1/advanced/delegate","content":"","keywords":"","version":"0.8.1"},{"title":"Overview​","type":1,"pageTitle":"Delegate","url":"/docs/0.8.1/advanced/delegate#overview","content":"To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand. You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself. ","version":"0.8.1","tagName":"h2"},{"title":"Code Examples​","type":1,"pageTitle":"Delegate","url":"/docs/0.8.1/advanced/delegate#code-examples","content":"Consider the following basic example for better understanding: use crate::{erc20::Erc20, ownable::Ownable}; use odra::{ Address, casper_types::U256, module::{Module, SubModule}, prelude::* }; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } delegate! { to self.erc20 { pub fn transfer(&mut self, recipient: Address, amount: U256); pub fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256); pub fn approve(&mut self, spender: Address, amount: U256); pub fn name(&self) -> String; pub fn symbol(&self) -> String; pub fn decimals(&self) -> u8; pub fn total_supply(&self) -> U256; pub fn balance_of(&self, owner: Address) -> U256; pub fn allowance(&self, owner: Address, spender: Address) -> U256; } to self.ownable { pub fn get_owner(&self) -> Address; pub fn change_ownership(&mut self, new_owner: Address); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality. The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities. Let's take a look at another example. use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct DeFiPlatform { ownable: SubModule<Ownable>, erc20: SubModule<Erc20>, exchange: SubModule<Exchange> } #[odra::module] impl DeFiPlatform { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); self.exchange.init(exchange_rate); } delegate! { to self.erc20 { pub fn transfer(&mut self, recipient: Address, amount: U256); pub fn balance_of(&self, owner: Address) -> U256; } to self.ownable { pub fn get_owner(&self) -> Address; } to self.exchange { pub fn swap(&mut self, sender: Address, recipient: Address); pub fn set_exchange_rate(&mut self, new_rate: u64); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure. Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts. ","version":"0.8.1","tagName":"h2"},{"title":"Cargo Odra","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/cargo-odra","content":"","keywords":"","version":"0.8.1"},{"title":"Managing projects​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#managing-projects","content":"Two commands help you create a new project. The first one is cargo odra new. You need to pass one parameter, namely --name {PROJECT_NAME}: cargo odra new --name my-project This creates a new project in the my_project folder and name it my_project. You can see it for yourself, for example by taking a look into a Cargo.toml file created in your project's folder: [package] name = "my_project" version = "0.1.0" edition = "2021" The project is created using the template located in Odra's main repository. By default it uses full template, if you want, you can use minimalistic blank by running: cargo odra new -t blank --name my-project The third available template is workspace, which creates a workspace with two projects, similar to the one created with the full template. By default, the latest release of Odra will be used for the template and as a dependency. You can pass a source of Odra you want to use, by using -s parameter: cargo odra new -n my-project -s ../odra # will use local folder of odra cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release cargo odra new -n my-project -s 0.8.1 # will use a version released on crates.io The second way of creating a project is by using init command: cargo odra init --name my-project It works in the same way as new, but instead of creating a new folder, it creates a project in the current, empty directory. ","version":"0.8.1","tagName":"h2"},{"title":"Generating code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#generating-code","content":"If you want to quickly create a new contract code, you can use the generate command: cargo odra generate -c counter This creates a new file src/counter.rs with sample code, add appropriate use and mod sections to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, visit Odra.toml. ","version":"0.8.1","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#testing","content":"The most used command during the development of your project should be this one: cargo odra test It runs your tests against Odra's MockVM. It is substantially faster than CasperVMand implements all the features Odra uses. When you want to run tests against a "real" VM, just provide the name of the backend using -boption: cargo odra test -b casper In the example above, Cargo Odra builds the project, generates the wasm files, spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat. Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. This is why OdraVM was created and should be your first choice when developing contracts. Of course, testing all of your code against a blockchain VM is a must in the end. If you want to run only some of the tests, you can pass arguments to the cargo test command (which is run in the background obviously): cargo odra test -- this-will-be-passed-to-cargo-test If you want to run tests which names contain the word two, you can execute: cargo odra test -- two Of course, you can do the same when using the backend: cargo odra test -b casper -- two ","version":"0.8.1","tagName":"h2"},{"title":"Building code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#building-code","content":"You can also build the code itself and generate the output contracts without running the tests. To do so, simply run: cargo odra build If the build process finishes successfully, wasm files will be located in wasm folder. Notice, that this command does not require the -b option. If you want to build specific contract, you can use -c option: cargo odra build -c counter # you pass many comma separated contracts ","version":"0.8.1","tagName":"h2"},{"title":"Generating contract schema​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#generating-contract-schema","content":"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command: cargo odra schema This generates a schema file in JSON format for all your contracts and places them in the resources folder. If the resources folder does not exist, it creates the folder for you. Like with the build command, you can use the -c option to generate a schema for a specific contract. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Cargo Odra","url":"/docs/0.8.1/basics/cargo-odra#whats-next","content":"In the next section, we will take a look at all the files and directories that cargo odra created for us and explain their purpose. ","version":"0.8.1","tagName":"h2"},{"title":"Host Communication","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/communicating-with-host","content":"","keywords":"","version":"0.8.1"},{"title":"What's next​","type":1,"pageTitle":"Host Communication","url":"/docs/0.8.1/basics/communicating-with-host#whats-next","content":"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code we presented in fact works! ","version":"0.8.1","tagName":"h2"},{"title":"Livenet","type":0,"sectionRef":"#","url":"/docs/0.8.1/backends/livenet","content":"","keywords":"","version":"0.8.1"},{"title":"Setup​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#setup","content":"To use Livenet backend, we need to provide Odra with some information - the network address, our private key and the name of the chain we want to use. Optionally, we can add multiple private keys to use more than one account in our tests. Those values are passed using environment variables. We can use .env file to store them - let's take a look at an example .env file, created from the .env.sample file from examples folder: # Path to the secret key of the account that will be used # to deploy the contracts. # We're using .keys folder so we don't accidentally commit # the secret key to the repository. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777 # Chain name of the network. Known values: # - integration-test ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test # Paths to the secret keys of the additional accounts. # Main secret key will be 0th account. ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. Let's go through the code: fn main() { // Similar to the OdraVM backend, we need to initialize // the environment: let env = odra_casper_livenet_env::env(); // Most of the for the host env works the same as in the // OdraVM backend. let owner = env.caller(); // Addresses are the real addresses on the blockchain, // so we need to provide them // if we did not import their secret keys. let recipient = "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"; let recipient = Address::from_str(recipient).unwrap(); // Arguments for the contract init method. let name = String::from("Plascoin"); let symbol = String::from("PLS"); let decimals = 10u8; let initial_supply: U256 = U256::from(10_000); // The main difference between other backends - we need to specify // the gas limit for each action. // The limit will be used for every consecutive action // until we change it. env.set_gas(100_000_000_000u64); // Deploy the contract. The API is the same as in the OdraVM backend. let init_args = Erc20InitArgs { name, symbol, decimals, initial_supply: Some(initial_supply) }; let mut token = Erc20HostRef::deploy(env, init_args); // We can now use the contract as we would in the OdraVM backend. println!("Token address: {}", token.address().to_string()); // Uncomment to load existing contract. // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; // let address = Address::from_str(address).unwrap(); // We use the Livenet-specific `load` method to load the contract // that is already deployed. // let mut token = Erc20Deployer::load(env, address); // Non-mutable calls are free! Neat, huh? More on that later. println!("Token name: {}", token.name()); // The next call is mutable, but the cost is lower that the deployment, // so we change the amount of gas env.set_gas(3_000_000_000u64); token.transfer(recipient, U256::from(1000)); println!("Owner's balance: {:?}", token.balance_of(owner)); println!("Recipient's balance: {:?}", token.balance_of(recipient)); } note The above example is a rust binary, not a test. Note that it is also added as a section of theCargo.toml file: [bin] name = "erc20_on_livenet" path = "src/bin/erc20_on_livenet.rs" required-features = ["livenet"] test = false ","version":"0.8.1","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#usage","content":"To run the above code, we simply need to run the binary with the livenet feature enabled: cargo run --bin erc20_on_livenet --features=livenet note Before executing the binary, make sure you built a wasm file. A part of a sample output should look like this: ... 💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 💁 INFO : Deploy "65b1a5d21..." successfully executed. Owner's balance: 4004 Recipient's balance: 4000 Those logs are a result of the last 4 lines of the above listing. Each deployment or a call to the blockchain will be noted and will take some time to execute. We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant and cost us nothing. How it is possible? info You can see the deployment on http://cspr.live/ - the transfer from the example can be seen here. ","version":"0.8.1","tagName":"h2"},{"title":"How Livenet backend works​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#how-livenet-backend-works","content":"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. It is possible however to query the state of the blockchain for free. This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the node is the current state. This is why the balance_of call was almost instant and free. Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract (see Cross Calls), it is executed offline and node is used for the state query only. However, the Livenet needs to know the connection between the contracts and the code, so make sure to deploy or load already deployed contracts ","version":"0.8.1","tagName":"h2"},{"title":"Multiple enviroments​","type":1,"pageTitle":"Livenet","url":"/docs/0.8.1/backends/livenet#multiple-enviroments","content":"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, multiple nodes or even multiple chains. To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file has to be used first. If your integration.env file has a value that IS present in the .env file, it will override the value from the .env file. ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livene To sum up - this command will firstly load the integration.env file and then load the missing values from .env file. ","version":"0.8.1","tagName":"h2"},{"title":"Directory structure","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/directory-structure","content":"","keywords":"","version":"0.8.1"},{"title":"Cargo.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#cargotoml","content":"Let's first take a look at Cargo.toml file: [package] name = "sample" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.1" [dev-dependencies] odra-test = "0.8.1" [[bin]] name = "sample_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "sample_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also added as a dev dependency. ","version":"0.8.1","tagName":"h2"},{"title":"Odra.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#odratoml","content":"This is the file that holds information about contracts that will be generated when running cargo odra build andcargo odra test: [[contracts]] fqn = "sample::Flipper" As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to the contract is located in src/flipper.rs. More contracts can be added here by hand, or by using cargo odra generate command. ","version":"0.8.1","tagName":"h2"},{"title":"src/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#src","content":"This is the folder where your smart contract files live. ","version":"0.8.1","tagName":"h2"},{"title":"bin/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#bin","content":"This is the folder where scripts that will be used to generate code or schemas live. You don't need to modify those files, they are generated by cargo odra new command and are used by cargo odra build, cargo odra test and cargo odra schema commands. ","version":"0.8.1","tagName":"h2"},{"title":"target/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#target","content":"Files generated by cargo during the build process are put here. ","version":"0.8.1","tagName":"h2"},{"title":"wasm/​","type":1,"pageTitle":"Directory structure","url":"/docs/0.8.1/basics/directory-structure#wasm","content":"WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files and deploy them on the blockchain. What's next Now, let's take a look at one of the files mentioned above in more detail, namely the Odra.toml file. ","version":"0.8.1","tagName":"h2"},{"title":"Errors","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/errors","content":"","keywords":"","version":"0.8.1"},{"title":"Testing errors​","type":1,"pageTitle":"Errors","url":"/docs/0.8.1/basics/errors#testing-errors","content":"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner: examples/src/features/handling_errors.rs #[cfg(test)] mod tests { use super::{Error, OwnedContractHostRef, OwnedContractInitArgs}; use odra::host::Deployer; use odra::prelude::*; #[test] fn test_owner_error() { let test_env = odra_test::env(); let owner = test_env.get_account(0); let not_an_owner = test_env.get_account(1); test_env.set_caller(owner); let init_args = OwnedContractInitArgs { name: "OwnedContract".to_string() }; let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args); test_env.set_caller(not_an_owner); assert_eq!( owned_contract.try_change_name("NewName".to_string()), Err(Error::NotAnOwner.into()) ); } } Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult.OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and and safe its safe version: try_name, try_owner, try_change_name. In our example, we are calling try_change_name and expecting an error to be thrown. For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, we need to convert our custom error to OdraError using Into::into(). ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Errors","url":"/docs/0.8.1/basics/errors#whats-next","content":"We will learn how to emit and test events using Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Cross calls","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/cross-calls","content":"","keywords":"","version":"0.8.1"},{"title":"Contract Ref​","type":1,"pageTitle":"Cross calls","url":"/docs/0.8.1/basics/cross-calls#contract-ref","content":"We mentioned HostRef already in our Testing article - a host side reference to already deployed contract. In the module context we use a ContractRef instead, to call other contracts. Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, by the #[odra::module] attribute. To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above. The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module]impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract. External Contracts Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI. For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of. Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere. #[odra::external_contract] pub trait Adder { fn add(&self, n1: u32, n2: u32) -> u32; } Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call: examples/src/features/cross_calls.rs AdderContractRef::new(self.env(), address).add(3, 5) ","version":"0.8.1","tagName":"h2"},{"title":"Loading the contract​","type":1,"pageTitle":"Cross calls","url":"/docs/0.8.1/basics/cross-calls#loading-the-contract","content":"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test our contracts in Livenet backend. We can load the contract using load method on the Deployer: examples/bin/erc20_on_livenet.rs fn _load(env: &HostEnv) -> Erc20HostRef { let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; let address = Address::from_str(address).unwrap(); <Erc20HostRef as HostRefLoader>::load(env, address) } ","version":"0.8.1","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"Cross calls","url":"/docs/0.8.1/basics/cross-calls#testing","content":"Let's see how we can test our cross calls using this knowledge: examples/src/features/cross_calls.rs #[cfg(test)] mod tests { use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef}; use odra::host::{Deployer, HostRef, NoArgs}; #[test] fn test_cross_calls() { let test_env = odra_test::env(); let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs); let init_args = CrossContractInitArgs { math_engine_address: *math_engine_contract.address() }; let cross_contract = CrossContractHostRef::deploy(&test_env, init_args); assert_eq!(cross_contract.add_using_another(), 8); } } Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize. #[cfg(test)] mod tests { use super::*; use odra::{Address, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_ext() { let test_env = odra_test::env(); let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5) assert_eq!(adder.add(1, 2), 3); } fn get_adder_address(test_env: &HostEnv) -> Address { let contract = MathEngineHostRef::deploy(test_env, NoArgs); *contract.address() } } ","version":"0.8.1","tagName":"h2"},{"title":"Flipper Internals","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/flipper-internals","content":"","keywords":"","version":"0.8.1"},{"title":"Header​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#header","content":"flipper.rs use odra::Var; Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation that can be reused between targets. In the above case, we're importing Var, which is responsible for storing simple values on the blockchain's storage. ","version":"0.8.1","tagName":"h2"},{"title":"Struct​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#struct","content":"flipper.rs /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } In Odra, all contracts are also modules, which can be reused between contracts. That's why we need to mark the struct with the #[odra::module] macro. In the struct definition itself, we state all the fields of the contract. Those fields can be regular Rust data types, however - those will not be persisted on the blockchain. They can also be Odra modules - defined in your project or coming from Odra itself. Finally, to make the data persistent on the blockchain, you can use something likeVar<T> showed above. To learn more about storage interaction, take a look at thenext article. ","version":"0.8.1","tagName":"h2"},{"title":"Impl​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#impl","content":"flipper.rs /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } ... Similarly to the struct, we mark the impl section with the #[odra::module] macro. Odra will take allpub functions from this section and create contract endpoints from them. So, if you wish to have functions that are not available for calling outside the contract, do not make them public. Alternatively, you can create a separate impl section without the macro - all functions defined there, even marked with pub will be not callable. The function named init is the constructor of the contract. This function will be limited to only to a single call, all further calls to it will result in an error. The init function is optional, if your contract does not need any initialization, you can skip it. flipper.rs ... /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } ... The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data saved there using set function will be persisted in the blockchain. ","version":"0.8.1","tagName":"h2"},{"title":"Tests​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#tests","content":"flipper.rs #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } ... You can write tests in any way you prefer and know in Rust. In the example above we are deploying the contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, as the second argument of the deploy function, we pass NoArgs - one of the implementations of the InitArgs trait provided with the framework. The contract will be deployed on the VM you chose while running cargo odra test. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper Internals","url":"/docs/0.8.1/basics/flipper-internals#whats-next","content":"Now let's take a look at the different types of storage that Odra provides and how to use them. ","version":"0.8.1","tagName":"h2"},{"title":"Modules","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/modules","content":"","keywords":"","version":"0.8.1"},{"title":"Testing​","type":1,"pageTitle":"Modules","url":"/docs/0.8.1/basics/modules#testing","content":"As we don't need to hold addresses, the test is really simple: examples/src/features/modules.rs #[cfg(test)] mod tests { use super::ModulesContractHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn test_modules() { let test_env = odra_test::env(); let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs); assert_eq!(modules_contract.add_using_module(), 8); } } ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Modules","url":"/docs/0.8.1/basics/modules#whats-next","content":"We will see how to handle native token transfers. ","version":"0.8.1","tagName":"h2"},{"title":"Odra.toml","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/odra-toml","content":"","keywords":"","version":"0.8.1"},{"title":"Adding a new contract manually​","type":1,"pageTitle":"Odra.toml","url":"/docs/0.8.1/basics/odra-toml#adding-a-new-contract-manually","content":"Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly. For example, if you want to create a new contract called counter, your Odra.toml file should finally look like this: [[contracts]] fqn = "sample::Flipper" [[contracts]] fqn = "sample::Counter" ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Odra.toml","url":"/docs/0.8.1/basics/odra-toml#whats-next","content":"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famousFlipper contract. ","version":"0.8.1","tagName":"h2"},{"title":"Events","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/events","content":"","keywords":"","version":"0.8.1"},{"title":"Testing events​","type":1,"pageTitle":"Events","url":"/docs/0.8.1/basics/events#testing-events","content":"Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted: examples/src/features/events.rs use super::{PartyContractHostRef, PartyStarted}; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; #[test] fn test_party() { let test_env: HostEnv = odra_test::env(); let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs); test_env.emitted_event( party_contract.address(), &PartyStarted { caller: test_env.get_account(0), block_time: 0 } ); // If you do not want to check the exact event, you can use `emitted` function test_env.emitted(party_contract.address(), "PartyStarted"); // You can also check how many events were emitted. assert_eq!(test_env.events_count(party_contract.address()), 1); } To explore more event testing functions, check the HostEnv documentation. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Events","url":"/docs/0.8.1/basics/events#whats-next","content":"Read the next article to learn how to call other contracts from the contract context. ","version":"0.8.1","tagName":"h2"},{"title":"Native token","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/native-token","content":"","keywords":"","version":"0.8.1"},{"title":"Testing​","type":1,"pageTitle":"Native token","url":"/docs/0.8.1/basics/native-token#testing","content":"To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function -balance_of: examples/src/features/native_token.rs #[cfg(test)] mod tests { use super::PublicWalletHostRef; use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_modules() { let test_env = odra_test::env(); let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs); assert_eq!(test_env.balance_of(my_contract.address()), U512::zero()); my_contract.with_tokens(U512::from(100)).deposit(); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100)); my_contract.withdraw(U512::from(25)); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75)); } } ","version":"0.8.1","tagName":"h2"},{"title":"Storage interaction","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/storage-interaction","content":"","keywords":"","version":"0.8.1"},{"title":"Var​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#var","content":"The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your variable in the Var type. Let's look at a "real world" example of a contract that represents a dog: examples/src/features/storage/variable.rs #[odra::module] pub struct DogContract { barks: Var<bool>, weight: Var<u32>, name: Var<String>, walks: Var<Vec<u32>>, } You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)! Let's make this contract usable, by providing a constructor and some getter functions: examples/src/features/storage/variable.rs use odra::Var; #[odra::module] impl DogContract { pub fn init(&mut self, barks: bool, weight: u32, name: String) { self.barks.set(barks); self.weight.set(weight); self.name.set(name); self.walks.set(Vec::<u32>::default()); } pub fn barks(&self) -> bool { self.barks.get_or_default() } pub fn weight(&self) -> u32 { self.weight.get_or_default() } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { let walks = self.walks.get_or_default(); walks.len() as u32 } pub fn walks_total_length(&self) -> u32 { let walks = self.walks.get_or_default(); walks.iter().sum() } } As you can see, you can access the data, by using get_or_default function: examples/src/features/storage/variable.rs ... self.barks.get_or_default() ... note Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable doesn't have to be initialized! To modify the data, use the set() function: examples/src/features/storage/variable.rs self.barks.set(barks); A Var is easy to use and efficient for simple data types. One of its downsides is that it serializes the data as a whole, so when you're using complex types like Vec or HashMap, each time you get or set the whole data is read and written to the blockchain storage. In the example above, if we want to see how many walks our dog had, we would use the function: examples/src/features/storage/variable.rs pub fn walks_amount(&self) -> usize { let walks = self.walks.get_or_default(); walks.len() } But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, especially for larger sets of data. To tackle this issue following two types were created. ","version":"0.8.1","tagName":"h2"},{"title":"Mapping​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#mapping","content":"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that uses Mapping to store information about our dog's friends and how many times they visited: examples/src/features/storage/mapping.rs use odra::{Mapping, Var}; #[odra::module] pub struct DogContract2 { name: Var<String>, friends: Mapping<String, u32>, } In the example above, our key is a String (it is a name of the friend) and we are storing u32 values (amount of visits). To read and write values from and into a Mapping we use a similar approach to the one shown in the Vars section with one difference - we need to pass a key: examples/src/features/storage/mapping.rs pub fn visit(&mut self, friend_name: String) { let visits = self.visits(friend_name.clone()); self.friends.set(&friend_name, visits + 1); } pub fn visits(&self, friend_name: String) -> u32 { self.friends.get_or_default(&friend_name) } The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. We could implement such behavior by using a numeric type key and saving the length of the set in a separate variable. Thankfully Odra comes with a prepared solution - the List type. note If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with a Var working together: core/src/list.rs use odra::{List, Var}; pub struct List<T> { values: Mapping<u32, T>, index: Var<u32> } ","version":"0.8.1","tagName":"h2"},{"title":"List​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#list","content":"Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, we'll use the list: examples/src/features/storage/list.rs #[odra::module] pub struct DogContract3 { name: Var<String>, walks: List<u32>, } As you can see, the notation is very similar to the Vec. To understand the usage, take a look at the reimplementation of the functions with an additional function that takes our dog for a walk (it writes the data to the storage): examples/src/features/storage/list.rs #[odra::module] impl DogContract3 { pub fn init(&mut self, name: String) { self.name.set(name); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { self.walks.len() } pub fn walks_total_length(&self) -> u32 { self.walks.iter().sum() } pub fn walk_the_dog(&mut self, length: u32) { self.walks.push(length); } } Now, we can know how many walks our dog had without loading the whole vector from the storage. We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all the cases for you. info All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder. ","version":"0.8.1","tagName":"h2"},{"title":"Custom Types​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#custom-types","content":"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors. Implementing custom types is straightforward, your type must derive from OdraType: use odra::{Address, OdraType}; #[derive(OdraType)] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } note Each field of your struct must be an OdraType. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Storage interaction","url":"/docs/0.8.1/basics/storage-interaction#whats-next","content":"In the next article, we'll see how to query the host for information about the world and our contract. ","version":"0.8.1","tagName":"h2"},{"title":"Testing","type":0,"sectionRef":"#","url":"/docs/0.8.1/basics/testing","content":"","keywords":"","version":"0.8.1"},{"title":"HostEnv​","type":1,"pageTitle":"Testing","url":"/docs/0.8.1/basics/testing#hostenv","content":"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) and to configure how the contracts are deployed and called. Let's revisit the example from the previous article about host communication and implement the tests that prove it works: examples/src/features/testing.rs #[cfg(test)] mod tests { use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs}; use odra::{host::{Deployer, HostEnv}, prelude::*}; #[test] fn env() { let test_env: HostEnv = odra_test::env(); test_env.set_caller(test_env.get_account(0)); let init_args = TestingContractInitArgs { name: "MyContract".to_string() }; let testing_contract = TestingContractHostRef::deploy(&test_env, init_args); let creator = testing_contract.created_by(); test_env.set_caller(test_env.get_account(1)); let init_args = TestingContractInitArgs { name: "MyContract2".to_string() }; let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args); let creator2 = testing_contract2.created_by(); assert_ne!(creator, creator2); } } In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). Next, we are deploying two instances of the same contract, but we're using HostEnv::set_callerto change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller()the function we are calling inside the contract. HostEnv comes with a set of functions that will let you write better tests: fn set_caller(&self, address: Address) - you've seen it in action just nowfn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given addressfn advance_block_time(&self, time_diff: u64) - increases the current value of block_timefn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; by default, you start with the 0-th accountfn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract Full list of functions can be found in the HostEnv documentation. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Testing","url":"/docs/0.8.1/basics/testing#whats-next","content":"We take a look at how Odra handles errors! ","version":"0.8.1","tagName":"h2"},{"title":"odra-examples","type":0,"sectionRef":"#","url":"/docs/0.8.1/examples/odra-examples","content":"","keywords":"","version":"0.8.1"},{"title":"What's next​","type":1,"pageTitle":"odra-examples","url":"/docs/0.8.1/examples/odra-examples#whats-next","content":"Read the next article to learn about reusable Odra components encapsulated in odra-modules. ","version":"0.8.1","tagName":"h2"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/0.8.1/getting-started/installation","content":"","keywords":"","version":"0.8.1"},{"title":"Prerequisites​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#prerequisites","content":"To start working with Odra, you need to have the following installed on your machine: Rust toolchain installed (see rustup.rs)wasmstrip tool installed (see wabt) We do not provide exact commands for installing these tools, as they are different for different operating systems. Please refer to the documentation of the tools themselves. With Rust toolchain ready, you can add a new target: rustup target add wasm32-unknown-unknown note wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files. ","version":"0.8.1","tagName":"h2"},{"title":"Installing Cargo Odra​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#installing-cargo-odra","content":"Cargo Odra is a helpful tool that will help you to build and test your smart contracts. It is not required to use Odra, but the documentation will assume that you have it installed. To install it, simply execute the following command: cargo install cargo-odra --locked To check if it was installed correctly and see available commands, type: cargo odra --help If everything went fine, we can proceed to the next step. ","version":"0.8.1","tagName":"h2"},{"title":"Creating a new Odra project​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#creating-a-new-odra-project","content":"To create a new project, simply execute: cargo odra new --name my-project && cd my_project This will create a new folder called my_project and initialize Odra there. Cargo Odra will create a sample contract for you in src directory. You can run the tests of this contract by executing: cargo odra test This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM: cargo odra test -b casper Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during the installation process, feel free to ask for help on our Discord. ","version":"0.8.1","tagName":"h2"},{"title":"What's next?​","type":1,"pageTitle":"Installation","url":"/docs/0.8.1/getting-started/installation#whats-next","content":"If you want to see the code that you just tested, continue to the description of Flipper example. ","version":"0.8.1","tagName":"h2"},{"title":"Flipper example","type":0,"sectionRef":"#","url":"/docs/0.8.1/getting-started/flipper","content":"","keywords":"","version":"0.8.1"},{"title":"Let's flip​","type":1,"pageTitle":"Flipper example","url":"/docs/0.8.1/getting-started/flipper#lets-flip","content":"flipper.rs use odra::Var; /// A module definition. Each module struct consists Vars and Mappings /// or/and another modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor, must be named `init`. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } /// Retrieves value from the storage. /// If the value has never been set, the default value is returned. pub fn get(&self) -> bool { self.value.get_or_default() } } #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } #[test] fn test_two_flippers() { let env = odra_test::env(); let mut contract1 = FlipperHostRef::deploy(&env, NoArgs); let contract2 = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract1.get()); assert!(!contract2.get()); contract1.flip(); assert!(contract1.get()); assert!(!contract2.get()); } } ","version":"0.8.1","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Flipper example","url":"/docs/0.8.1/getting-started/flipper#testing","content":"To run the tests, execute the following command: cargo odra test # or add the `-b casper` flag to run tests on the CasperVM ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper example","url":"/docs/0.8.1/getting-started/flipper#whats-next","content":"In the next category of articles, we will go through basic concepts of Odra. ","version":"0.8.1","tagName":"h2"},{"title":"Access Control","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/access-control","content":"","keywords":"","version":"0.8.1"},{"title":"Code​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#code","content":"Before we start writing code, we list the functionalities of our access control layer. A Role type is used across the module.A Role can be assigned to many Addresses.Each Role may have a corresponding admin role.Only an admin can grant/revoke a Role.A Role can be renounced.A Role cannot be renounced on someone's behalf.Each action triggers an event.Unauthorized access stops contract execution. ","version":"0.8.1","tagName":"h2"},{"title":"Project Structure​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#project-structure","content":"access-control ├── src │ ├── access │ │ ├── access_control.rs │ │ ├── events.rs │ │ └── errors.rs │ └── lib.rs |── build.rs |── Cargo.toml └── Odra.toml ","version":"0.8.1","tagName":"h3"},{"title":"Events and Errors​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#events-and-errors","content":"There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions. events.rs use odra::prelude::*; use odra::{Address, Event}; use super::access_control::Role; #[derive(Event, PartialEq, Eq, Debug)] pub struct RoleGranted { pub role: Role, pub address: Address, pub sender: Address } #[derive(Event, PartialEq, Eq, Debug)] pub struct RoleRevoked { pub role: Role, pub address: Address, pub sender: Address } #[derive(Event, PartialEq, Eq, Debug)] pub struct RoleAdminChanged { pub role: Role, pub previous_admin_role: Role, pub new_admin_role: Role } L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role. errors.rs use odra::OdraError; #[derive(OdraError)] pub enum Error { MissingRole = 20_000, RoleRenounceForAnotherAddress = 20_001, } Errors definition is straightforward - there are only two invalid states: An action is triggered by an unauthorized actor.The caller is attempting to resign the Role on someone's behalf. ","version":"0.8.1","tagName":"h3"},{"title":"Module​","type":1,"pageTitle":"Access Control","url":"/docs/0.8.1/tutorials/access-control#module","content":"Now, we are stepping into the most interesting part: the module definition and implementation. access_control.rs use super::events::*; use super::errors::Error; use odra::prelude::*; use odra::{module::Module, Address, Mapping}; pub type Role = [u8; 32]; pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32]; #[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])] pub struct AccessControl { roles: Mapping<(Role, Address), bool>, role_admin: Mapping<Role, Role> } #[odra::module] impl AccessControl { pub fn has_role(&self, role: &Role, address: &Address) -> bool { self.roles.get_or_default(&(*role, *address)) } pub fn get_role_admin(&self, role: &Role) -> Role { let admin_role = self.role_admin.get(role); if let Some(admin) = admin_role { admin } else { DEFAULT_ADMIN_ROLE } } pub fn grant_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_grant_role(role, address); } pub fn revoke_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_revoke_role(role, address); } pub fn renounce_role(&mut self, role: &Role, address: &Address) { if address != &self.env().caller() { self.env().revert(Error::RoleRenounceForAnotherAddress); } self.unchecked_revoke_role(role, address); } } impl AccessControl { pub fn check_role(&self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.env().revert(Error::MissingRole); } } pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) { let previous_admin_role = self.get_role_admin(role); self.role_admin.set(role, *admin_role); self.env().emit_event(RoleAdminChanged { role: *role, previous_admin_role, new_admin_role: *admin_role }); } pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.roles.set(&(*role, *address), true); self.env().emit_event(RoleGranted { role: *role, address: *address, sender: self.env().caller() }); } } pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) { if self.has_role(role, address) { self.roles.set(&(*role, *address), false); self.env().emit_event(RoleRevoked { role: *role, address: *address, sender: self.env().caller() }); } } } L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.L8 - The default role is an array filled with zeros.L10-L13 - The storage consists of two mappings: roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.role_admin - each Role can have a single admin Role. L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.L49 - This is a non-exported block containing helper functions.L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access. ","version":"0.8.1","tagName":"h3"},{"title":"Using odra-modules","type":0,"sectionRef":"#","url":"/docs/0.8.1/examples/using-odra-modules","content":"","keywords":"","version":"0.8.1"},{"title":"Available modules​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#available-modules","content":"Odra modules comes with couple of ready-to-use modules and reusable extensions. ","version":"0.8.1","tagName":"h2"},{"title":"Tokens​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#tokens","content":"Erc20​ The Erc20 module implements the ERC20 standard. Erc721​ The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework. The Erc721Token module implements the ERC721Base and additionally uses the Erc721Metadata and Ownable extensions. The Erc721Receiver trait lets you implement your own logic for receiving NFTs. The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules. Erc1155​ The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework. The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension. The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules. Wrapped native token​ The WrappedNativeToken module implements the Wrapper for the native token, it was inspired by the WETH. ","version":"0.8.1","tagName":"h3"},{"title":"Access​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#access","content":"AccessControl​ This module enables the implementation of role-based access control mechanisms for children modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API. Ownable​ This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner. The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using thetransfer_ownership() function. Ownable2Step​ An extension of the Ownable module. Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions. ","version":"0.8.1","tagName":"h3"},{"title":"Security​","type":1,"pageTitle":"Using odra-modules","url":"/docs/0.8.1/examples/using-odra-modules#security","content":"Pausable​ A module allowing to implement an emergency stop mechanism that can be triggered by any account. ","version":"0.8.1","tagName":"h3"},{"title":"ERC-20","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/erc20","content":"","keywords":"","version":"0.8.1"},{"title":"Ownable","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/ownable","content":"","keywords":"","version":"0.8.1"},{"title":"Framework features​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: storing a single value,defining a constructor,error handling,defining and emitting events.registering a contact in a test environment,interactions with the test environment,assertions (value, events, errors assertions). ","version":"0.8.1","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#code","content":"Before we write any code, we define functionalities we would like to implement. Module has an initializer that should be called once. Only the current owner can set a new owner.Read the current owner.A function that fails if called by a non-owner account. ","version":"0.8.1","tagName":"h2"},{"title":"Define a module​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#define-a-module","content":"ownable.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module(events = [OwnershipChanged])] pub struct Ownable { owner: Var<Option<Address>> } That was easy, but it is crucial to understand the basics before we move on. L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var. ","version":"0.8.1","tagName":"h3"},{"title":"Init the module​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#init-the-module","content":"ownable.rs ... use odra::{Event, OdraError}; ... #[odra::module] impl Ownable { pub fn init(&mut self, owner: Address) { if self.owner.get_or_default().is_some() { self.env().revert(Error::OwnerIsAlreadyInitialized) } self.owner.set(Some(owner)); self.env().emit_event(OwnershipChanged { prev_owner: None, new_owner: owner }); } } #[derive(OdraError)] pub enum Error { OwnerIsAlreadyInitialized = 1, } #[derive(Event, Debug, PartialEq, Eq)] pub struct OwnershipChanged { pub prev_owner: Option<Address>, pub new_owner: Address } Ok, we have done a couple of things, let's analyze them one by one: L7 - The impl should be an Odra module, so add #[odra::module].L9 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.L23-26 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the OdraError derive macro is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.L10-L12 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument. L14 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.L28-L32 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct must derive from odra::Event. We highly recommend to derive Debug, PartialEq and Eq for testing purpose.L16 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None. ","version":"0.8.1","tagName":"h3"},{"title":"Features implementation​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#features-implementation","content":"ownable.rs #[odra::module] impl Ownable { ... pub fn ensure_ownership(&self, address: &Address) { if Some(address) != self.owner.get_or_default().as_ref() { self.env().revert(Error::NotOwner) } } pub fn change_ownership(&mut self, new_owner: &Address) { self.ensure_ownership(&self.env().caller()); let current_owner = self.get_owner(); self.owner.set(Some(*new_owner)); self.env().emit_event(OwnershipChanged { prev_owner: Some(current_owner), new_owner: *new_owner }); } pub fn get_owner(&self) -> Address { match self.owner.get_or_default() { Some(owner) => owner, None => self.env().revert(Error::OwnerIsNotInitialized) } } } #[derive(OdraError)] pub enum Error { NotOwner = 1, OwnerIsAlreadyInitialized = 2, OwnerIsNotInitialized = 3, } The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along. L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead. ","version":"0.8.1","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#test","content":"ownable.rs #[cfg(test)] mod tests { use super::*; use odra::host::{Deployer, HostEnv, HostRef}; fn setup() -> (OwnableHostRef, HostEnv, Address) { let env: HostEnv = odra_test::env(); let init_args = OwnableInitArgs { owner: env.get_account(0) }; (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0)) } #[test] fn initialization_works() { let (ownable, env, owner) = setup(); assert_eq!(ownable.get_owner(), owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: None, new_owner: owner } ); } #[test] fn owner_can_change_ownership() { let (mut ownable, env, owner) = setup(); let new_owner = env.get_account(1); env.set_caller(owner); ownable.change_ownership(&new_owner); assert_eq!(ownable.get_owner(), new_owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: Some(owner), new_owner } ); } #[test] fn non_owner_cannot_change_ownership() { let (mut ownable, env, _) = setup(); let new_owner = env.get_account(1); ownable.change_ownership(&new_owner); assert_eq!( ownable.try_change_ownership(&new_owner), Err(Error::NotOwner.into()) ); } } L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one). L14 - It is time to define the first test. As you see, it is a regular Rust test.L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract. note You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract. L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function. note The caller switch applies only the next contract interaction, the second call will be done as the default account. L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type. ","version":"0.8.1","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#summary","content":"The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract. ","version":"0.8.1","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Ownable","url":"/docs/0.8.1/tutorials/ownable#whats-next","content":"In the next tutorial we will implement a ERC20 standard. ","version":"0.8.1","tagName":"h2"},{"title":"Framework features​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: Advanced storage using key-value pairs,Odra types such as Address,Advanced event assertion. ","version":"0.8.1","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#code","content":"Our module features a considerably more complex storage layout compared to the previous example. It is designed to store the following data: Immutable metadata - name, symbol, and decimals.Total supply.Balances of individual users.Allowances, essentially indicating who is permitted to spend tokens on behalf of another user. ","version":"0.8.1","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#module-definition","content":"erc20.rs use odra::prelude::*; use odra::{Address, casper_types::U256, Mapping, Var}; #[odra::module(events = [Transfer, Approval])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys. ","version":"0.8.1","tagName":"h2"},{"title":"Metadata​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#metadata","content":"erc20.rs ... use odra::Event; ... #[odra::module] impl Erc20 { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let caller = self.env().caller(); self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.mint(&caller, &initial_supply); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn symbol(&self) -> String { self.symbol.get_or_default() } pub fn decimals(&self) -> u8 { self.decimals.get_or_default() } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } } impl Erc20 { pub fn mint(&mut self, address: &Address, amount: &U256) { self.balances.add(address, *amount); self.total_supply.add(*amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } } #[derive(Event, PartialEq, Eq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } L6 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.L8-L14 - A constructor sets the token metadata and mints the initial supply.L33 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.L34-L43 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for: use odra::UnwrapOrRevert; let current_balance = self.balances.get(address).unwrap_or_default(); let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env()); self.balances.set(address, new_balance); ","version":"0.8.1","tagName":"h3"},{"title":"Core​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#core","content":"To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks. erc20.rs ... use odra::OdraError; #[odra::module] impl Erc20 { ... pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn balance_of(&self, address: &Address) -> U256 { self.balances.get_or_default(&address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } } impl Erc20 { ... fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let owner_balance = self.balances.get_or_default(&owner); if *amount > owner_balance { self.env().revert(Error::InsufficientBalance) } self.balances.set(owner, owner_balance - *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowance(owner, spender); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } let new_allowance = allowance - *amount; self.allowances .set(&(*owner, *spender), new_allowance); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } #[derive(Event, PartialEq, Eq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } #[derive(OdraError)] pub enum Error { InsufficientBalance = 1, InsufficientAllowance = 2, } Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation? ","version":"0.8.1","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#test","content":"erc20.rs #[cfg(test)] pub mod tests { use super::*; use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}}; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: INITIAL_SUPPLY.into() } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } #[test] fn transfer_from_and_approval_work() { let (env, mut erc20) = setup(); let (owner, recipient, spender) = (env.get_account(0), env.get_account(1), env.get_account(2)); let approved_amount = 3_000.into(); let transfer_amount = 1_000.into(); assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY)); // Owner approves Spender. erc20.approve(&spender, &approved_amount); // Allowance was recorded. assert_eq!(erc20.allowance(&owner, &spender), approved_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount } )); // Spender transfers tokens from Owner to Recipient. env.set_caller(spender); erc20.transfer_from(&owner, &recipient, &transfer_amount); // Tokens are transferred and allowance decremented. assert_eq!( erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY) - transfer_amount ); assert_eq!(erc20.balance_of(&recipient), transfer_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); // assert!(env.emitted(erc20.address(), "Transfer")); } #[test] fn transfer_from_error() { // Given a new instance. let (env, mut erc20) = setup(); // When the spender's allowance is zero. let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); // Then transfer fails. assert_eq!( erc20.try_transfer_from(&owner, &recipient, &amount), Err(Error::InsufficientAllowance.into()) ); } } L146 - Alternatively, if you don't want to check the entire event, you may assert only its type. ","version":"0.8.1","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"ERC-20","url":"/docs/0.8.1/tutorials/erc20#whats-next","content":"Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids. ","version":"0.8.1","tagName":"h2"},{"title":"Build, Deploy and Read the State of a Contract","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/build-deploy-read","content":"","keywords":"","version":"0.8.1"},{"title":"Contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#contract","content":"Let's write a contract with complex storage layout. The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping. We will expose two methods: The constructor init which sets the metadata and the version of the contract.The method set_data which sets the value of the numeric field and the values of the mapping. custom_item.rs use odra::{casper_types::U256, prelude::*, Mapping, OdraType, SubModule, Var}; // A custom type with a vector of another custom type #[derive(OdraType, Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(OdraType, Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } // The main contract with a version, metadata and a submodule #[odra::module] pub struct CustomItem { version: Var<u32>, meta: Var<Metadata>, data: SubModule<Data> } #[odra::module] impl CustomItem { pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) { let meta = Metadata { name, description, prices: vec![ Price { value: price_1 }, Price { value: price_2 } ] }; self.meta.set(meta); self.version.set(self.version.get_or_default() + 1); } pub fn set_data(&mut self, value: u32, name: String, name2: String) { self.data.value.set(value); self.data.inner.named_values.set(&name, 10); self.data.inner.named_values.set(&name2, 20); } } // A submodule with a numeric value and another submodule #[odra::module] struct Data { value: Var<u32>, inner: SubModule<InnerData>, } // A submodule with a mapping #[odra::module] struct InnerData { named_values: Mapping<String, u32>, } ","version":"0.8.1","tagName":"h3"},{"title":"Deploying the contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#deploying-the-contract","content":"First, we need to setup the chain. We will use the NCTL docker image to run a local network. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Next, we need to compile the contract to a Wasm file. cargo odra build -c custom_item Then, we can deploy the contract using the casper-client tool. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key path/to/your/secret_key.pem \\ --session-path [PATH_TO_WASM] \\ --payment-amount 100000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ --session-arg "name:string='My Name'" \\ --session-arg "description:string='My Description'" \\ --session-arg "price_1:u256='101'" \\ --session-arg "price_2:u256='202'" Finally, we can call the set_data method to set the values of the contract. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key ./keys/secret_key.pem \\ --payment-amount 2000000000 \\ --session-hash [DEPLOYED_CONTRACT_HASH] \\ --session-entry-point "set_data" \\ --session-arg "value:u32:'666'" \\ --session-arg "name:string='alice'" \\ --session-arg "name2:string='bob'" ","version":"0.8.1","tagName":"h3"},{"title":"Storage Layout​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#storage-layout","content":"To read the state of the contract, we need to understand the storage layout. The first step is to calculate the index of the keys. Storage Layout CustomItem: prefix: 0x0..._0000_0000_0000 0 version: u32, 0x0..._0000_0000_0000 0 meta: Metadata, 0x0..._0000_0000_0001 1 data: Data: prefix: 0x0..._0000_0010_0000 (2 << 4) value: u32, 0x0..._0000_0010_0000 (2 << 4) + 0 inner: InnerData: prefix: 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 named_values: Mapping 0x0..._0010_0001_0000 ((2 << 4) + 1) << 4 + 0 The actual key is obtained as follows: Convert the index to a big-endian byte array.Concatenate the index with the mapping data.Hash the concatenated bytes using blake2b.Return the hex representation of the hash (the stored key must be utf-8 encoded). In more detail, the storage layout is described in the Storage Layout article. ","version":"0.8.1","tagName":"h3"},{"title":"Reading the state​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/0.8.1/tutorials/build-deploy-read#reading-the-state","content":"RustTypeScript main.rs use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity}; use casper_types::{ bytesrepr::{FromBytes, ToBytes}, U256, }; // replace with your contract hash const CONTRACT_HASH: &str = "hash-..."; const NODE_ADDRESS: &str = "http://localhost:11101/rpc"; const RPC_ID: &str = "casper-net-1"; const DICTIONARY_NAME: &str = "state"; #[derive(Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } async fn read_state_key(key: String) -> Vec<u8> { let state_root_hash = casper_client::get_state_root_hash( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, None, ) .await .unwrap() .result .state_root_hash .unwrap(); // Read the value from the `state` dictionary. let result = casper_client::get_dictionary_item( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, state_root_hash, DictionaryItemIdentifier::ContractNamedKey { key: CONTRACT_HASH.to_string(), dictionary_name: DICTIONARY_NAME.to_string(), dictionary_item_key: key, }, ) .await .unwrap() .result .stored_value; // We expect the value to be a CLValue if let StoredValue::CLValue(cl_value) = result { // Ignore the first 4 bytes, which are the length of the CLType. cl_value.inner_bytes()[4..].to_vec() } else { vec![] } } async fn metadata() -> Metadata { // The key for the metadata is 1, and it has no mapping data let key = key(1, &[]); let bytes = read_state_key(key).await; // Read the name and store the remaining bytes let (name, bytes) = String::from_bytes(&bytes).unwrap(); // Read the description and store the remaining bytes let (description, bytes) = String::from_bytes(&bytes).unwrap(); // A vector is stored as a u32 size followed by the elements // Read the size of the vector and store the remaining bytes let (size, mut bytes) = u32::from_bytes(&bytes).unwrap(); let mut prices = vec![]; // As we know the size of the vector, we can loop over it for _ in 0..size { // Read the value and store the remaining bytes let (value, rem) = U256::from_bytes(&bytes).unwrap(); bytes = rem; prices.push(Price { value }); } // Anytime you finish parsing a value, you should check if there are any remaining bytes // if there are, it means you have a bug in your parsing logic. // For simplicity, we will ignore the remaining bytes here. Metadata { name, description, prices } } async fn value() -> u32 { // The key for the value is (2 << 4) + 0, and it has no mapping data let key = key(2 << 4, &[]); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } async fn named_value(name: &str) -> u32 { // The key for the named value is ((2 << 4) + 1) << 4, and the mapping data is the name as bytes let mapping_data = name.to_bytes().unwrap(); let key = key(((2 << 4) + 1) << 4, &mapping_data); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } fn main() { let runtime = tokio::runtime::Runtime::new().unwrap(); dbg!(runtime.block_on(metadata())); dbg!(runtime.block_on(value())); dbg!(runtime.block_on(named_value("alice"))); dbg!(runtime.block_on(named_value("bob"))); } // The key is a combination of the index and the mapping data // The algorithm is as follows: // 1. Convert the index to a big-endian byte array // 2. Concatenate the index with the mapping data // 3. Hash the concatenated bytes using blake2b // 4. Return the hex representation of the hash (the stored key must be utf-8 encoded) fn key(idx: u32, mapping_data: &[u8]) -> String { let mut key = Vec::new(); key.extend_from_slice(idx.to_be_bytes().as_ref()); key.extend_from_slice(mapping_data); let hashed_key = blake2b(&key); hex::encode(&hashed_key) } fn blake2b(bytes: &[u8]) -> [u8; 32] { let mut result = [0u8; 32]; let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32) .expect("should create hasher"); let _ = std::io::Write::write(&mut hasher, bytes); blake2::digest::VariableOutput::finalize_variable(hasher, &mut result) .expect("should copy hash to the result array"); result } cargo run [src/main.rs:116:5] runtime.block_on(metadata()) = Metadata { name: "My Contract", description: "My Description", prices: [ Price { value: 123, }, Price { value: 321, }, ], } [src/main.rs:117:5] runtime.block_on(value()) = 666 [src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20 [src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10 ","version":"0.8.1","tagName":"h3"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.9.0/","content":"","keywords":"","version":"0.9.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.9.0/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.9.0","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/0.9.1/","content":"","keywords":"","version":"0.9.1"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/0.9.1/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"0.9.1","tagName":"h2"},{"title":"Pausable","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/pauseable","content":"","keywords":"","version":"0.8.1"},{"title":"Code​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#code","content":"As always, we will start with defining functionalities of our module. Check the state - is it paused or not.State guards - a contract should stop execution if is in a state we don't expect.Switch the state. ","version":"0.8.1","tagName":"h2"},{"title":"Events and Error​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#events-and-error","content":"There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way. Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser. pauseable.rs use odra::prelude::*; use odra::{Address, Event, OdraError}; #[derive(OdraError)] pub enum Error { PausedRequired = 1_000, UnpausedRequired = 1_001, } #[derive(Event, PartialEq, Eq, Debug)] pub struct Paused { pub account: Address } #[derive(Event, PartialEq, Eq, Debug)] pub struct Unpaused { pub account: Address } ","version":"0.8.1","tagName":"h3"},{"title":"Module definition​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#module-definition","content":"The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused. pauseable.rs use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] pub struct Pausable { is_paused: Var<bool> } ","version":"0.8.1","tagName":"h3"},{"title":"Checks and guards​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#checks-and-guards","content":"Now, let's move to state checks and guards. pauseable.rs impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } pub fn require_not_paused(&self) { if self.is_paused() { self.env().revert(Error::UnpausedRequired); } } pub fn require_paused(&self) { if !self.is_paused() { self.env().revert(Error::PausedRequired); } } } L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused. L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused. ","version":"0.8.1","tagName":"h3"},{"title":"Actions​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#actions","content":"Finally, we will add the ability to switch the module state. pauseable.rs impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); self.env().emit_event(Paused { account: self.env().caller() }); } pub fn unpause(&mut self) { self.require_paused(); self.is_paused.set(false); self.env().emit_event(Unpaused { account: self.env().caller() }); } } pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused). ","version":"0.8.1","tagName":"h3"},{"title":"Pausable counter​","type":1,"pageTitle":"Pausable","url":"/docs/0.8.1/tutorials/pauseable#pausable-counter","content":"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused). pauseable.rs ... use odra::SubModule; ... #[odra::module] pub struct PausableCounter { value: Var<u32>, pauseable: SubModule<Pausable> } #[odra::module] impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); let new_value = self.value.get_or_default() + 1; self.value.set(new_value); } pub fn pause(&mut self) { self.pauseable.pause(); } pub fn unpause(&mut self) { self.pauseable.unpause(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } #[cfg(test)] mod test { use super::*; use odra::host::{Deployer, NoArgs}; #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); assert_eq!( contract.try_increment().unwrap_err(), Error::UnpausedRequired.into() ); assert_eq!(contract.get_value(), 1); } } As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy! ","version":"0.8.1","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/next/","content":"","keywords":"","version":"next"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/next/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"next","tagName":"h2"},{"title":"Advanced Storage Concepts","type":0,"sectionRef":"#","url":"/docs/next/advanced/advanced-storage","content":"","keywords":"","version":"next"},{"title":"Recap and Basic Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#recap-and-basic-concepts","content":"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values. Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract. Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key. List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over. If you need a refresher on these topics, please refer to our guide on basic storage in Odra. ","version":"next","tagName":"h2"},{"title":"Advanced Storage Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#advanced-storage-concepts-1","content":"","version":"next","tagName":"h2"},{"title":"Sequence​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#sequence","content":"The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value. pub struct Sequence<T> where T: Num + One + ToBytes + FromBytes + CLTyped { value: Var<T> } The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively. ","version":"next","tagName":"h3"},{"title":"Advanced Mapping​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#advanced-mapping","content":"In Odra, a Mapping is a key-value storage system where the key is associated with a value. In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute. However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state. Let's consider the following example: examples/src/features/storage/mapping.rs use odra::{casper_types::U256, Mapping, UnwrapOrRevert}; use odra::prelude::*; use crate::owned_token::OwnedToken; #[odra::module] pub struct Mappings { strings: Mapping<(String, u32, String), String>, tokens: Mapping<String, OwnedToken> } #[odra::module] impl Mappings { ... pub fn total_supply(&mut self, token_name: String) -> U256 { self.tokens.module(&token_name).total_supply() } pub fn get_string_api( &self, key1: String, key2: u32, key3: String ) -> String { let opt_string = self.strings.get(&(key1, key2, key3)); opt_string.unwrap_or_revert(&self.env()) } } As you can see, a Mapping key can consist of a tuple of values, not limited to a single value. note Accessing Odra modules differs from accessing regular values such as strings or numbers. Firstly, within a Mapping, you don't encapsulate the module with Submodule. Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules. ","version":"next","tagName":"h3"},{"title":"AdvancedStorage Contract​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#advancedstorage-contract","content":"The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts. use odra::{Address, casper_types::U512, Sequence, Mapping}; use odra::prelude::*; use crate::modules::Token; #[odra::module] pub struct AdvancedStorage { counter: Sequence<u32>, tokens: Mapping<(String, String), Token>, } impl AdvancedStorage { pub fn current_value(&self) -> u32 { self.counter.get_current_value() } pub fn increment_and_get(&mut self) -> u32 { self.counter.next_value() } pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 { let token = self.tokens.module(&(token_name, creator)); token.balance_of(&address) } pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) { let mut token = self.tokens.module(&(token_name, creator)); token.mint(amount, to); } } ","version":"next","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/next/advanced/advanced-storage#conclusion","content":"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are: Odra offers a Sequence module, enabling contracts to store and increment a single value.Mappings support composite keys expressed as tuples and can store modules as values. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts. ","version":"next","tagName":"h2"},{"title":"Attributes","type":0,"sectionRef":"#","url":"/docs/next/advanced/attributes","content":"","keywords":"","version":"next"},{"title":"Payable​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#payable","content":"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens. ","version":"next","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#example","content":"examples/src/contracts/tlw.rs #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U256 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env.revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env() .emit_event(Deposit { address: caller, amount }); } If you try to send tokens to a non-payable function, the transaction will be automatically rejected. ","version":"next","tagName":"h3"},{"title":"Non Reentrant​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#non-reentrant","content":"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. They can also use reentrancy guards to block recursive calls to sensitive functions. In Odra you can just apply the #[odra(non_reentrant)] attribute to your function. ","version":"next","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#example-1","content":"#[odra::module] pub struct NonReentrantCounter { counter: Var<u32> } #[odra::module] impl NonReentrantCounter { #[odra(non_reentrant)] pub fn count_ref_recursive(&mut self, n: u32) { if n > 0 { self.count(); ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1); } } } impl NonReentrantCounter { fn count(&mut self) { let c = self.counter.get_or_default(); self.counter.set(c + 1); } } #[cfg(test)] mod test { use super::*; use odra::{host::{Deployer, NoArgs}, ExecutionError}; #[test] fn ref_recursion_not_allowed() { let test_env = odra_test::env(); let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs); let result = contract.count_ref_recursive(11); assert_eq!(result, ExecutionError::ReentrantCall.into()); } } ","version":"next","tagName":"h3"},{"title":"Mixing attributes​","type":1,"pageTitle":"Attributes","url":"/docs/next/advanced/attributes#mixing-attributes","content":"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. To apply multiple attributes, you can write: #[odra(payable, non_reentrant)] fn deposit() { // your logic... } or #[odra(payable)] #[odra(non_reentrant)] fn deposit() { // your logic... } In both cases attributes order does not matter. ","version":"next","tagName":"h2"},{"title":"Building contracts manually","type":0,"sectionRef":"#","url":"/docs/next/advanced/building-manually","content":"","keywords":"","version":"next"},{"title":"Building the contract manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#building-the-contract-manually","content":"To build the contract manually, cargo odra uses the following command: ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract info Odra uses the environment variable ODRA_MODULE to determine which contract to build. Assuming that project's crate is named my_project, this command will build the my_contract contract in release mode and generate the wasm file. The file will be put into the target/wasm32-unknown-unknown/release directory under the name my_project_build_contract.wasm. The Odra Framework expects the contracts to be placed in the wasm directory, and to be named correctly, so the next step would be to move the file: mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm ","version":"next","tagName":"h2"},{"title":"Optimizing the contract​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#optimizing-the-contract","content":"To lower the size of the wasm file, cargo odra uses the wasm-strip tool: wasm-strip wasm/my_contract.wasm To further optimize the wasm file, the wasm-opt tool is also used. wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm danger This step is required, as the wasm file generated by the Rust compiler is not fully compatible with the Casper execution engine. ","version":"next","tagName":"h2"},{"title":"Running the tests manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#running-the-tests-manually","content":"To run the tests manually, Odra needs to know which backend to use. To run tests against Casper backend, the following command needs to be used: ODRA_BACKEND=casper cargo test ","version":"next","tagName":"h2"},{"title":"Wrapping up​","type":1,"pageTitle":"Building contracts manually","url":"/docs/next/advanced/building-manually#wrapping-up","content":"Let's say we want to build the my_contract in debug mode, run the tests against the casper backend and use the my-own-allocator feature from our my_project project. To do that, we can use the following set of commands: ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm wasm-strip wasm/my_contract.wasm wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm ODRA_BACKEND=casper cargo test --features my-own-allocator ","version":"next","tagName":"h2"},{"title":"OwnedToken","type":0,"sectionRef":"#","url":"/docs/0.8.1/tutorials/owned-token","content":"","keywords":"","version":"0.8.1"},{"title":"Code​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#code","content":"What should our module be capable of? Conform the Erc20 interface.Allow only the module owner to mint tokens.Enable the current owner to designate a new owner. ","version":"0.8.1","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#module-definition","content":"Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules. owned_token.rs use crate::{erc20::Erc20, ownable::Ownable}; use odra::prelude::*; use odra::module::SubModule; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } As you can see, we do not need any storage definition - we just take advantage of the already-defined modules! ","version":"0.8.1","tagName":"h3"},{"title":"Delegation​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#delegation","content":"owned_token.rs ... use odra::{Address, casper_types::U256}; ... #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } pub fn name(&self) -> String { self.erc20.name() } pub fn symbol(&self) -> String { self.erc20.symbol() } pub fn decimals(&self) -> u8 { self.erc20.decimals() } pub fn total_supply(&self) -> U256 { self.erc20.total_supply() } pub fn balance_of(&self, address: &Address) -> U256 { self.erc20.balance_of(address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.erc20.allowance(owner, spender) } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.erc20.transfer(recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { self.erc20.transfer_from(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { self.erc20.approve(spender, amount); } pub fn get_owner(&self) -> Address { self.ownable.get_owner() } pub fn change_ownership(&mut self, new_owner: &Address) { self.ownable.change_ownership(new_owner); } pub fn mint(&mut self, address: &Address, amount: &U256) { self.ownable.ensure_ownership(&self.env().caller()); self.erc20.mint(address, amount); } } Easy. However, there are a few worth mentioning subtleness: L9-L10 - A constructor is an excellent place to initialize both modules at once.L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.L49-L51 - The same is done with the ownable module.L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner. ","version":"0.8.1","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"OwnedToken","url":"/docs/0.8.1/tutorials/owned-token#summary","content":"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that. ","version":"0.8.1","tagName":"h2"},{"title":"Memory allocators","type":0,"sectionRef":"#","url":"/docs/next/advanced/using-different-allocator","content":"","keywords":"","version":"next"},{"title":"Using a different allocator​","type":1,"pageTitle":"Memory allocators","url":"/docs/next/advanced/using-different-allocator#using-a-different-allocator","content":"If the default allocator does not suit your needs, or you use a crate that already provides an allocator, you can disable the default allocator by enabling the disable-allocator feature in the odra dependency in your project: [dependencies] odra = { path = "../odra", features = ["disable-allocator"] } If you want to have a better control over the features that are enabled during the building and tests, see the next article on building manually. ","version":"next","tagName":"h2"},{"title":"Storage Layout","type":0,"sectionRef":"#","url":"/docs/next/advanced/storage-layout","content":"","keywords":"","version":"next"},{"title":"Casper VM Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#casper-vm-perspective","content":"The Casper Execution Engine (VM) enables the storage of data in named keys or dictionaries. However, a smart contract has a limited number of named keys, making it unsuitable for storing substantial data volumes. Odra resolves this issue by storing all user-generated data in a dictionary called state. This dictionary operates as a key-value store, where keys are strings with a maximum length of 64 characters, and values are arbitrary byte arrays. Here is an example of what the interface for reading and writing data could look like: pub trait CasperStorage { fn read(key: &str) -> Option<Vec<u8>>; fn write(key: &str, value: Vec<u8>); } ","version":"next","tagName":"h2"},{"title":"Odra Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#odra-perspective","content":"Odra was conceived with modularity and code reusability in mind. Additionally, we aimed to streamline storage definition through the struct object. Consider this straightforward storage definition: #[odra::module] pub struct Token { name: Var<String>, balances: Mapping<Address, U256> } The Token structure contains two fields: name of type String andbalances, which functions as a key-value store with Address as keys andU256 as values. The Token module can be reused in another module, as demonstrated in a more complex example: #[odra::module] pub struct Loans { lenders: SubModule<Token>, borrowers: SubModule<Token>, } The Loans module has two fields: lenders and borrowers, both of which have the same storage layout as defined by the Token module. Odra guarantees thatlenders and borrowers are stored under distinct keys within the storage dictionary. Both Token and Loans serve as examples to show how Odra's storage layout operates. ","version":"next","tagName":"h2"},{"title":"Key generation.​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#key-generation","content":"Every element of a module (struct) with N elements is associated with an index ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an element of a module is another module (SubModule<...>), the associated index serves as a prefix for the indexes of the inner module. While this may initially appear complex, it is easily understood through an example. In the example, indexes are presented as bytes, reflecting the actual implementation. Loans { lenders: Token { // prefix: 0x0001 name: 1, // key: 0x0001_0001 balances: 2 // key: 0x0001_0010 }, borrowers: Token { // prefix: 0x0010 name: 1, // key: 0x0010_0001 balances: 2 // key: 0x0010_0010 } } Additionally, it's worth mentioning how Mapping's keys are used in thestorage. They are simply concatenated with the index of the module, as demonstrated in the example. For instance, triggering borrowers.balances.get(0x1234abcd) would result in a key: 0x0001_0001_1234_abcd Finally, the key must be hashed to fit within the 64-character limit and then encoded in hexadecimal format. ","version":"next","tagName":"h2"},{"title":"Value serialization​","type":1,"pageTitle":"Storage Layout","url":"/docs/next/advanced/storage-layout#value-serialization","content":"Before being stored in the storage, each value is serialized into bytes using the CLType serialization method and subsequently encapsulated with Casper'sBytes types. ","version":"next","tagName":"h2"},{"title":"Delegate","type":0,"sectionRef":"#","url":"/docs/next/advanced/delegate","content":"","keywords":"","version":"next"},{"title":"Overview​","type":1,"pageTitle":"Delegate","url":"/docs/next/advanced/delegate#overview","content":"To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand. You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself. ","version":"next","tagName":"h2"},{"title":"Code Examples​","type":1,"pageTitle":"Delegate","url":"/docs/next/advanced/delegate#code-examples","content":"Consider the following basic example for better understanding: use crate::{erc20::Erc20, ownable::Ownable}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256); fn approve(&mut self, spender: Address, amount: U256); fn name(&self) -> String; fn symbol(&self) -> String; fn decimals(&self) -> u8; fn total_supply(&self) -> U256; fn balance_of(&self, owner: Address) -> U256; fn allowance(&self, owner: Address, spender: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; fn change_ownership(&mut self, new_owner: Address); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality. The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities. Let's take a look at another example. use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct DeFiPlatform { ownable: SubModule<Ownable>, erc20: SubModule<Erc20>, exchange: SubModule<Exchange> } #[odra::module] impl DeFiPlatform { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); self.exchange.init(exchange_rate); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn balance_of(&self, owner: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; } to self.exchange { fn swap(&mut self, sender: Address, recipient: Address); fn set_exchange_rate(&mut self, new_rate: u64); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure. Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts. ","version":"next","tagName":"h2"},{"title":"Migration guide to v0.8.0","type":0,"sectionRef":"#","url":"/docs/0.8.1/migrations/to-0.8.0","content":"","keywords":"","version":"0.8.1"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#1-prerequisites","content":"","version":"0.8.1","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"0.8.1","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0. ","version":"0.8.1","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#2-migration-steps","content":"","version":"0.8.1","tagName":"h2"},{"title":"2.1 Add bin directory​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#21-add-bin-directory","content":"Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory. You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"0.8.1","tagName":"h3"},{"title":"2.2. Update Cargo.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#22-update-cargotoml","content":"There a bunch of changes in the Cargo.toml file. You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.Register bins you added in the previous step.Add dev-dependencies section with odra-test crate.Add recommended profiles for release and dev to optimize the build process. Below you can compare the Cargo.toml file after and before the migration to v0.8.0: 0.8.0Prev [package] name = "my_project" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.0" [dev-dependencies] odra-test = "0.8.0" [[bin]] name = "my_project_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "my_project_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 ","version":"0.8.1","tagName":"h3"},{"title":"2.2. Update Odra.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#22-update-odratoml","content":"Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required. 0.8.0Prev [[contracts]] fqn = "my_project::Flipper" ","version":"0.8.1","tagName":"h3"},{"title":"2.3. Update Smart Contracts​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#23-update-smart-contracts","content":"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make: 2.3.1. Update the use statements to reflect the new module structure.​ Big integer types are now located in the odra::casper_types module.odra::types::Address is now odra::Address.Variable is now Var.Remove odra::contract_env.Remove odra::types::event::OdraEvent.Remove odra::types::OdraType as it is no longer required.Change odra::types::casper_types::*; to odra::casper_types::*;. 2.3.2. Some type aliases are no longer in use.​ Balance - use odra::casper_types::U512.BlockTime - use u64.EventData - use odra::casper_types::bytesrepr::Bytes. 2.3.3. Consider import odra::prelude::* in your module files.​ 2.3.4. Flatten nested Mappings.​ // Before #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<Address, Mapping<Address, U256>> } // After #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<(Address, Address), U256> } 2.3.5. Update errors definitions.​ execution_error! macro has been replace with OdraError derive macro. 0.8.0Prev use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.3.6. Update events definitions.​ 0.8.0Prev use odra::prelude::*; use odra::Event; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } // Emitting the event self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); 2.3.7. Replace contract_env with self.env() in your modules.​ self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes. fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions. fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.functions native_token_metadata() and one_token() have been removed. 2.3.8. Wrap submodules of your module with odra::SubModule<T>.​ 0.8.0Prev #[odra::module(events = [Transfer])] pub struct Erc721Token { core: SubModule<Erc721Base>, metadata: SubModule<Erc721MetadataExtension>, ownable: SubModule<Ownable> } 2.3.9. Update external contract calls.​ However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()). 0.8.0Prev #[odra::external_contract] pub trait Token { fn balance_of(&self, owner: &Address) -> U256; } // Usage TokenContractRef::new(env, token).balance_of(account) 2.3.10. Update constructors.​ Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init. 2.3.11. Update UnwrapOrRevert calls.​ The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter. 2.3.12. Remove #[odra(using)] attribute from your module definition.​ Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required. ","version":"0.8.1","tagName":"h3"},{"title":"2.4. Update Tests​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#24-update-tests","content":"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make: 2.4.1. Contract deployment.​ The way you deploy a contract has changed: You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function. 0.8.0Prev // A contract without init args use super::OwnableHostRef; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; let env: HostEnv = odra_test::env(); let ownable = OwnableHostRef::deploy(&env, NoArgs) // A contract with init args use super::{Erc20HostRef, Erc20InitArgs}; use odra::host::{Deployer, HostEnv}; let env: HostEnv = odra_test::env(); let init_args = Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) }; let erc20 = Erc20HostRef::deploy(&env, init_args); 2.4.2. Host interactions.​ Replace odra::test_env with odra_test::env().The API of odra::test_env and odra_test::env() are similar, but there are some differences: test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).test_env::token_balance(Address) is now env.balance_of(&Address).functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef. 2.4.3. Testing failing scenarios.​ test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result.try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro. 0.8.0Prev #[test] fn transfer_from_error() { let (env, mut erc20) = setup(); let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); assert_eq!( erc20.try_transfer_from(owner, recipient, amount), Err(Error::InsufficientAllowance.into()) ); } 2.4.4. Testing events.​ assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options. 0.8.0Prev let env: HostEnv = odra_test::env(); let erc20 = Erc20HostRef::deploy(&env, init_args); ... assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); ","version":"0.8.1","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.8.0. 0.8.0Prev src/erc20.rs use crate::erc20::errors::Error::*; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address, Event}; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[derive(Event, Eq, PartialEq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { use super::{ errors::Error, events::{Approval, Transfer}, Erc20HostRef, Erc20InitArgs }; use odra::{ casper_types::U256, host::{Deployer, HostEnv, HostRef}, prelude::* }; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } // Other tests... } ","version":"0.8.1","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"0.8.1","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/0.8.1/migrations/to-0.8.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"0.8.1","tagName":"h2"},{"title":"OdraVM","type":0,"sectionRef":"#","url":"/docs/next/backends/odra-vm","content":"","keywords":"","version":"next"},{"title":"Usage​","type":1,"pageTitle":"OdraVM","url":"/docs/next/backends/odra-vm#usage","content":"The OdraVM is the default backend for Odra framework, so each time you run cargo odra test You are running your code against it. ","version":"next","tagName":"h2"},{"title":"Architecture​","type":1,"pageTitle":"OdraVM","url":"/docs/next/backends/odra-vm#architecture","content":"OdraVM consists of two main parts: the Contract Register and the State. The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address. Contracts and Test Env functions can modify the State of the OdraVM. Contrary to the "real" backend, which holds the whole history of the blockchain, the OdraVM State holds only the current state of the OdraVM. Thanks to this and the fact that we do not need the blockchain itself, OdraVM starts instantly and runs the tests in the native speed. ","version":"next","tagName":"h2"},{"title":"Execution​","type":1,"pageTitle":"OdraVM","url":"/docs/next/backends/odra-vm#execution","content":"When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting your pub functions into a list of Entrypoints, which are put into a Contract Container. When the contract is deployed, its Container registered into a Registry under an address. During the contract call, OdraVM finds an Entrypoint and executes the code. ","version":"next","tagName":"h2"},{"title":"Livenet","type":0,"sectionRef":"#","url":"/docs/next/backends/livenet","content":"","keywords":"","version":"next"},{"title":"Setup​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#setup","content":"To use Livenet backend, we need to provide Odra with some information - the network address, our private key and the name of the chain we want to use. Optionally, we can add multiple private keys to use more than one account in our tests. Those values are passed using environment variables. We can use .env file to store them - let's take a look at an example .env file, created from the .env.sample file from examples folder: # Path to the secret key of the account that will be used # to deploy the contracts. # We're using .keys folder so we don't accidentally commit # the secret key to the repository. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777 # Chain name of the network. Known values: # - integration-test ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test # Paths to the secret keys of the additional accounts. # Main secret key will be 0th account. ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem # If using CSPR.cloud, you can set the auth token here. # CSPR_CLOUD_AUTH_TOKEN= note CSPR.cloud is a service that provides mainnet and testnet Casper nodes on demand. With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. Let's go through the code: fn main() { // Similar to the OdraVM backend, we need to initialize // the environment: let env = odra_casper_livenet_env::env(); // Most of the for the host env works the same as in the // OdraVM backend. let owner = env.caller(); // Addresses are the real addresses on the blockchain, // so we need to provide them // if we did not import their secret keys. let recipient = "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"; let recipient = Address::from_str(recipient).unwrap(); // Arguments for the contract init method. let name = String::from("Plascoin"); let symbol = String::from("PLS"); let decimals = 10u8; let initial_supply: U256 = U256::from(10_000); // The main difference between other backends - we need to specify // the gas limit for each action. // The limit will be used for every consecutive action // until we change it. env.set_gas(100_000_000_000u64); // Deploy the contract. The API is the same as in the OdraVM backend. let init_args = Erc20InitArgs { name, symbol, decimals, initial_supply: Some(initial_supply) }; let mut token = Erc20HostRef::deploy(env, init_args); // We can now use the contract as we would in the OdraVM backend. println!("Token address: {}", token.address().to_string()); // Uncomment to load existing contract. // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; // let address = Address::from_str(address).unwrap(); // We use the Livenet-specific `load` method to load the contract // that is already deployed. // let mut token = Erc20Deployer::load(env, address); // Non-mutable calls are free! Neat, huh? More on that later. println!("Token name: {}", token.name()); // The next call is mutable, but the cost is lower that the deployment, // so we change the amount of gas env.set_gas(3_000_000_000u64); token.transfer(recipient, U256::from(1000)); println!("Owner's balance: {:?}", token.balance_of(owner)); println!("Recipient's balance: {:?}", token.balance_of(recipient)); } note The above example is a rust binary, not a test. Note that it is also added as a section of theCargo.toml file: [bin] name = "erc20_on_livenet" path = "src/bin/erc20_on_livenet.rs" required-features = ["livenet"] test = false ","version":"next","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#usage","content":"To run the above code, we simply need to run the binary with the livenet feature enabled: cargo run --bin erc20_on_livenet --features=livenet note Before executing the binary, make sure you built a wasm file. A part of a sample output should look like this: ... 💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 💁 INFO : Deploy "65b1a5d21..." successfully executed. Owner's balance: 4004 Recipient's balance: 4000 Those logs are a result of the last 4 lines of the above listing. Each deployment or a call to the blockchain will be noted and will take some time to execute. We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant and cost us nothing. How it is possible? info You can see the deployment on http://cspr.live/ - the transfer from the example can be seen here. ","version":"next","tagName":"h2"},{"title":"How Livenet backend works​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#how-livenet-backend-works","content":"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. It is possible however to query the state of the blockchain for free. This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the node is the current state. This is why the balance_of call was almost instant and free. Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract (see Cross Calls), it is executed offline and node is used for the state query only. However, the Livenet needs to know the connection between the contracts and the code, so make sure to deploy or load already deployed contracts ","version":"next","tagName":"h2"},{"title":"Multiple environments​","type":1,"pageTitle":"Livenet","url":"/docs/next/backends/livenet#multiple-environments","content":"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, multiple nodes or even multiple chains. To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file has to be used first. If your integration.env file has a value that IS present in the .env file, it will override the value from the .env file. ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet To sum up - this command will firstly load the integration.env file and then load the missing values from .env file. ","version":"next","tagName":"h2"},{"title":"Casper","type":0,"sectionRef":"#","url":"/docs/next/backends/casper","content":"","keywords":"","version":"next"},{"title":"Contract Env​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#contract-env","content":"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances. ","version":"next","tagName":"h2"},{"title":"Events​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#events","content":"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity. Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed: __events - a dictionary that stores events' data.__events_length - the evens count.__events_ces_version - the version of Casper Event Standard. __events_schema - a dictionary that stores event schemas. Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key. So, Events are nothing different from any other data stored by a contract. A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event]. note Don't forget to expose events in the module using #[odra::module(events = [...])]. ","version":"next","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#payable","content":"The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key. Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse. Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. If under the way something goes wrong with the transfer, the contract reverts. The transferred amount can be read inside the contract by calling self.env().attached_value(). note Odra expects the cargo_purse runtime argument to be attached to a contract call. In case of its absence, the contract_env::attached_value() returns zero. ","version":"next","tagName":"h3"},{"title":"Revert​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#revert","content":"In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User. ","version":"next","tagName":"h3"},{"title":"Context​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#context","content":"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack. The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address. The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address. As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse. ","version":"next","tagName":"h3"},{"title":"Test Env​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#test-env","content":"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine. In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000). The Test Env internally keeps track of the current block time, error and attached value. Each test is executed on a fresh instance of the Test Env. ","version":"next","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#usage","content":"Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -bparameter: cargo odra test -b casper If you want to just generate a wasm file, simply run: cargo odra build -b casper ","version":"next","tagName":"h2"},{"title":"Deploying a contract to Casper network​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#deploying-a-contract-to-casper-network","content":"There would be no point in writing a contract if you couldn't deploy it to the blockchain. You can do it in two ways: provided by the Casper itself: using the casper-client tool or using the Odra's Livenet integration. Let's explore the first option to better understand the process. note If you wish, you can skip the following section and jump to the Livenet integration. ","version":"next","tagName":"h2"},{"title":"WASM arguments​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#wasm-arguments","content":"When deploying a new contract you can pass some arguments to it. Every contract written in Odra expects those arguments to be set: odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable. Additionally, if required by the contract, you can pass constructor arguments. When working with the test env via cargo odra or when usingLivenet integration this is handled automatically. However, if you rather usecasper-client directly, you have to pass them manually: ","version":"next","tagName":"h3"},{"title":"Example: Deploy Counter​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#example-deploy-counter","content":"To deploy your contract with a constructor using casper-client, you need to pass the above arguments. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 5000000000000 \\ --session-path ./wasm/counter.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "value:u32:42" For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'. ","version":"next","tagName":"h3"},{"title":"Example: Deploy ERC721​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#example-deploy-erc721","content":"Odra comes with a standard ERC721 token implementation. Clone the main Odra repo and navigate to the modules directory. Firstly contract needs to be compiled. cargo odra build -b casper -c erc721_token It produces the erc721_token.wasm file in the wasm directory. Now it's time to deploy the contract. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc721_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string:'MyNFT'" \\ --session-arg "symbol:string:'NFT'" \\ --session-arg "base_uri:string:'https://example.com/'" It's done. The contract is deployed and ready to use. Your account is the owner of the contract and you can mint and burn tokens. For more details see the code of the ERC721 module. To obtain the package hash of the contract search for my_nft key in your account's named keys. ","version":"next","tagName":"h3"},{"title":"Example: Deploy ERC1155​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#example-deploy-erc1155","content":"The process is similar to the one described in the previous section. Contract compilation: cargo odra build -b casper -c erc1155_token Contract deployment: casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc1155_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ As previously, your account is the owner and can mint and burn tokens. For more details see the code of the ERC1155 module. ","version":"next","tagName":"h3"},{"title":"Sending CSPR to a contract​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#sending-cspr-to-a-contract","content":"Defining payable entry points is described in Native Token section. What is happening under the hood is that Odra creates a new cargo_purse argument for each payable entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. When a contract adds CSPR to another contract call, Odra handles it for you. The problem arises when you want to call an entry point and attach CSPR as an account. The only way of doing that is by executing code in the sessions context, that top-ups the cargo_purse and then calls the contract. Odra provides a generic proxy_caller.wasm that does exactly that. You can build it by yourself from the main Odra repository, or use the proxy_caller.wasmwe maintain. ","version":"next","tagName":"h2"},{"title":"Using proxy_caller.wasm​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#using-proxy_callerwasm","content":"To use the proxy_caller.wasm you need to attach the following arguments: contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. Result of to_bytes on CasperPackageHash.entry_point - String type. The name of the entry point you want to call.args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.attached_value. U512 type. The amount of CSPR you want to attach to the call.amount. U512 type. Should be the same value as attached_value if not None. It is a special Casper argument that enables the access to account's main purse. Currently casper-client doesn't allow building such arguments. You have to build it using your SDK. See an example in the Tutorial section. ","version":"next","tagName":"h3"},{"title":"Execution​","type":1,"pageTitle":"Casper","url":"/docs/next/backends/casper#execution","content":"First thing Odra does with your code, is similar to the one used in OdraVM - a list of entrypoints is generated, thanks to the #[odra::module] attribute. ","version":"next","tagName":"h2"},{"title":"Cargo Odra","type":0,"sectionRef":"#","url":"/docs/next/basics/cargo-odra","content":"","keywords":"","version":"next"},{"title":"Managing projects​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#managing-projects","content":"Two commands help you create a new project. The first one is cargo odra new. You need to pass one parameter, namely --name {PROJECT_NAME}: cargo odra new --name my-project This creates a new project in the my_project folder and name it my_project. You can see it for yourself, for example by taking a look into a Cargo.toml file created in your project's folder: [package] name = "my_project" version = "0.1.0" edition = "2021" The project is created using the template located in Odra's main repository. By default it uses full template, if you want, you can use minimalistic blank by running: cargo odra new -t blank --name my-project The third available template is workspace, which creates a workspace with two projects, similar to the one created with the full template. By default, the latest release of Odra will be used for the template and as a dependency. You can pass a source of Odra you want to use, by using -s parameter: cargo odra new -n my-project -s ../odra # will use local folder of odra cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release cargo odra new -n my-project -s 1.1.0 # will use a version released on crates.io The second way of creating a project is by using init command: cargo odra init --name my-project It works in the same way as new, but instead of creating a new folder, it creates a project in the current, empty directory. ","version":"next","tagName":"h2"},{"title":"Generating code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#generating-code","content":"If you want to quickly create a new contract code, you can use the generate command: cargo odra generate -c counter This creates a new file src/counter.rs with sample code, add appropriate use and mod sections to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, visit Odra.toml. ","version":"next","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#testing","content":"The most used command during the development of your project should be this one: cargo odra test It runs your tests against Odra's MockVM. It is substantially faster than CasperVMand implements all the features Odra uses. When you want to run tests against a "real" VM, just provide the name of the backend using -boption: cargo odra test -b casper In the example above, Cargo Odra builds the project, generates the wasm files, spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat. Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. This is why OdraVM was created and should be your first choice when developing contracts. Of course, testing all of your code against a blockchain VM is a must in the end. If you want to run only some of the tests, you can pass arguments to the cargo test command (which is run in the background obviously): cargo odra test -- this-will-be-passed-to-cargo-test If you want to run tests which names contain the word two, you can execute: cargo odra test -- two Of course, you can do the same when using the backend: cargo odra test -b casper -- two ","version":"next","tagName":"h2"},{"title":"Building code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#building-code","content":"You can also build the code itself and generate the output contracts without running the tests. To do so, simply run: cargo odra build If the build process finishes successfully, wasm files will be located in wasm folder. Notice, that this command does not require the -b option. If you want to build specific contract, you can use -c option: cargo odra build -c counter # you pass many comma separated contracts ","version":"next","tagName":"h2"},{"title":"Generating contract schema​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#generating-contract-schema","content":"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command: cargo odra schema This generates a schema file in JSON format for all your contracts and places them in the resources folder. If the resources folder does not exist, it creates the folder for you. Like with the build command, you can use the -c option to generate a schema for a specific contract. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Cargo Odra","url":"/docs/next/basics/cargo-odra#whats-next","content":"In the next section, we will take a look at all the files and directories that cargo odra created for us and explain their purpose. ","version":"next","tagName":"h2"},{"title":"What is a backend?","type":0,"sectionRef":"#","url":"/docs/next/backends/what-is-a-backend","content":"","keywords":"","version":"next"},{"title":"Contract Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/next/backends/what-is-a-backend#contract-env","content":"The Contract Env is a simple interface that each backend needs to implement, exposing features of the blockchain from the perspective of the contract. It gives Odra a set of functions, which allows implementing more complex concepts - for example, to implement Mapping, Odra requires some kind of storage integration. The exact implementation of those functions is a responsibility of a backend, making Odra and its user free to implement the contract logic, instead of messing with the blockchain internals. Other functions from Contract Env include handling transfers, addresses, block time, errors and events. ","version":"next","tagName":"h2"},{"title":"Host Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/next/backends/what-is-a-backend#host-env","content":"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with the backend from the outside world - really useful for implementing tests. This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, to the more test-oriented - handling errors, forwarding the block time, etc. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"What is a backend?","url":"/docs/next/backends/what-is-a-backend#whats-next","content":"We will take a look at backends Odra implements in more detail. ","version":"next","tagName":"h2"},{"title":"Host Communication","type":0,"sectionRef":"#","url":"/docs/next/basics/communicating-with-host","content":"","keywords":"","version":"next"},{"title":"What's next​","type":1,"pageTitle":"Host Communication","url":"/docs/next/basics/communicating-with-host#whats-next","content":"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code we presented in fact works! ","version":"next","tagName":"h2"},{"title":"Directory structure","type":0,"sectionRef":"#","url":"/docs/next/basics/directory-structure","content":"","keywords":"","version":"next"},{"title":"Cargo.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#cargotoml","content":"Let's first take a look at Cargo.toml file: [package] name = "sample" version = "0.1.0" edition = "2021" [dependencies] odra = "1.1.0" [dev-dependencies] odra-test = "1.1.0" [build-dependencies] odra-build = "1.1.0" [[bin]] name = "sample_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "sample_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also added as a dev dependency. ","version":"next","tagName":"h2"},{"title":"Odra.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#odratoml","content":"This is the file that holds information about contracts that will be generated when running cargo odra build andcargo odra test: [[contracts]] fqn = "sample::Flipper" As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to the contract is located in src/flipper.rs. More contracts can be added here by hand, or by using cargo odra generate command. ","version":"next","tagName":"h2"},{"title":"src/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#src","content":"This is the folder where your smart contract files live. ","version":"next","tagName":"h2"},{"title":"bin/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#bin","content":"This is the folder where scripts that will be used to generate code or schemas live. You don't need to modify those files, they are generated by cargo odra new command and are used by cargo odra build, cargo odra test and cargo odra schema commands. ","version":"next","tagName":"h2"},{"title":"target/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#target","content":"Files generated by cargo during the build process are put here. ","version":"next","tagName":"h2"},{"title":"wasm/​","type":1,"pageTitle":"Directory structure","url":"/docs/next/basics/directory-structure#wasm","content":"WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files and deploy them on the blockchain. What's next Now, let's take a look at one of the files mentioned above in more detail, namely the Odra.toml file. ","version":"next","tagName":"h2"},{"title":"Errors","type":0,"sectionRef":"#","url":"/docs/next/basics/errors","content":"","keywords":"","version":"next"},{"title":"Testing errors​","type":1,"pageTitle":"Errors","url":"/docs/next/basics/errors#testing-errors","content":"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner: examples/src/features/handling_errors.rs #[cfg(test)] mod tests { use super::{Error, OwnedContractHostRef, OwnedContractInitArgs}; use odra::{host::Deployer, prelude::*}; #[test] fn test_owner_error() { let test_env = odra_test::env(); let owner = test_env.get_account(0); let not_an_owner = test_env.get_account(1); test_env.set_caller(owner); let init_args = OwnedContractInitArgs { name: "OwnedContract".to_string() }; let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args); test_env.set_caller(not_an_owner); assert_eq!( owned_contract.try_change_name("NewName".to_string()), Err(Error::NotAnOwner.into()) ); } } Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult.OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and and safe its safe version: try_name, try_owner, try_change_name. In our example, we are calling try_change_name and expecting an error to be thrown. For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, we need to convert our custom error to OdraError using Into::into(). ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Errors","url":"/docs/next/basics/errors#whats-next","content":"We will learn how to emit and test events using Odra. ","version":"next","tagName":"h2"},{"title":"Casper Contract Schema","type":0,"sectionRef":"#","url":"/docs/next/basics/casper-contract-schema","content":"","keywords":"","version":"next"},{"title":"Odra and CCS​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#odra-and-ccs","content":"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory. note If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema. src/contract.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module( // the name of the contract, default is the module name name = "MyContract", // the version of the contract, default is the version of the crate version = "0.1.0", // events that the contract can emit, collected recursively if submodules are used events = [ Created, Updated ], // the error enum the contract can revert with, collected recursively if submodules are used errors = MyErrors )] pub struct MyContract { name: Var<String>, owner: Var<Address>, } #[odra::module] impl MyContract { /// Initializes the contract, sets the name and owner and emits an event pub fn init(&mut self, name: String, owner: Address) { self.name.set(name.clone()); self.owner.set(owner.clone()); self.env().emit_event(Created { name }); } /// Updates the name of the contract and emits an event pub fn update(&mut self, name: String) { self.name.set(name.clone()); self.env().emit_event(Updated { name }); } /// Returns the data of the contract pub fn get_data(&self) -> Data { Data { name: self.name.get_or_default(), owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner), } } } // The struct will we visible in the schema in the types section #[odra::odra_type] pub struct Data { name: String, owner: Address, } // The enum variants will we visible in the schema in the errors section #[odra::odra_error] pub enum MyErrors { /// The owner is invalid InvalidOwner, /// The name is invalid InvalidName, } // The struct will we visible in the schema in the types and events section #[odra::event] pub struct Updated { name: String, } // The struct will we visible in the schema in the types section and events section #[odra::event] pub struct Created { name: String, } ","version":"next","tagName":"h2"},{"title":"Generating the Schema​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#generating-the-schema","content":"To generate the schema run the following cargo-odra command: cargo odra schema # or pass -c flag to generate the schema for a specific contract ","version":"next","tagName":"h2"},{"title":"Schema Output​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#schema-output","content":"The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema: resources/my_contract_schema.json { "casper_contract_schema_version": 1, "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)", "authors": [], "repository": null, "homepage": null, "contract_name": "MyContract", "contract_version": "0.1.0", "types": [ { "struct": { "name": "Created", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } }, { "struct": { "name": "Data", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" }, { "name": "owner", "description": null, "ty": "Key" } ] } }, { "struct": { "name": "Updated", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } } ], "errors": [ { "name": "InvalidName", "description": "The name is invalid", "discriminant": 1 }, { "name": "InvalidOwner", "description": "The owner is invalid", "discriminant": 0 } ], "entry_points": [ { "name": "update", "description": "Updates the name of the contract and emits an event", "is_mutable": true, "arguments": [ { "name": "name", "description": null, "ty": "String", "optional": false } ], "return_ty": "Unit", "is_contract_context": true, "access": "public" }, { "name": "get_data", "description": "Returns the data of the contract", "is_mutable": false, "arguments": [], "return_ty": "Data", "is_contract_context": true, "access": "public" } ], "events": [ { "name": "Created", "ty": "Created" }, { "name": "Updated", "ty": "Updated" } ], "call": { "wasm_file_name": "MyContract.wasm", "description": "Initializes the contract, sets the name and owner and emits an event", "arguments": [ { "name": "odra_cfg_package_hash_key_name", "description": "The arg name for the package hash key name.", "ty": "String", "optional": false }, { "name": "odra_cfg_allow_key_override", "description": "The arg name for the allow key override.", "ty": "Bool", "optional": false }, { "name": "odra_cfg_is_upgradable", "description": "The arg name for the contract upgradeability setting.", "ty": "Bool", "optional": false }, { "name": "name", "description": null, "ty": "String", "optional": false }, { "name": "owner", "description": null, "ty": "Key", "optional": false } ] } } ","version":"next","tagName":"h2"},{"title":"Schema Fields​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/next/basics/casper-contract-schema#schema-fields","content":"casper_contract_schema_version is the version of the schema.toolchain is the version of the Rust compiler used to compile the contract.Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments. ","version":"next","tagName":"h2"},{"title":"Cross calls","type":0,"sectionRef":"#","url":"/docs/next/basics/cross-calls","content":"","keywords":"","version":"next"},{"title":"Contract Ref​","type":1,"pageTitle":"Cross calls","url":"/docs/next/basics/cross-calls#contract-ref","content":"We mentioned HostRef already in our Testing article - a host side reference to already deployed contract. In the module context we use a ContractRef instead, to call other contracts. Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, by the #[odra::module] attribute. To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above. The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module]impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract. External Contracts Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI. For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of. Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere. #[odra::external_contract] pub trait Adder { fn add(&self, n1: u32, n2: u32) -> u32; } Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call: AdderContractRef::new(self.env(), address).add(3, 5) ","version":"next","tagName":"h2"},{"title":"Loading the contract​","type":1,"pageTitle":"Cross calls","url":"/docs/next/basics/cross-calls#loading-the-contract","content":"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test our contracts in Livenet backend. We can load the contract using load method on the Deployer: examples/bin/erc20_on_livenet.rs fn _load(env: &HostEnv) -> Erc20HostRef { let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; let address = Address::from_str(address).unwrap(); <Erc20HostRef as HostRefLoader>::load(env, address) } ","version":"next","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"Cross calls","url":"/docs/next/basics/cross-calls#testing","content":"Let's see how we can test our cross calls using this knowledge: examples/src/features/cross_calls.rs #[cfg(test)] mod tests { use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef}; use odra::host::{Deployer, HostRef, NoArgs}; #[test] fn test_cross_calls() { let test_env = odra_test::env(); let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs); let cross_contract = CrossContractHostRef::deploy( &test_env, CrossContractInitArgs { math_engine_address: *math_engine_contract.address() } ); assert_eq!(cross_contract.add_using_another(), 8); } } Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize. #[cfg(test)] mod tests { use super::*; use odra::{Address, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_ext() { let test_env = odra_test::env(); let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5) assert_eq!(adder.add(1, 2), 3); } fn get_adder_address(test_env: &HostEnv) -> Address { let contract = MathEngineHostRef::deploy(test_env, NoArgs); *contract.address() } } ","version":"next","tagName":"h2"},{"title":"Events","type":0,"sectionRef":"#","url":"/docs/next/basics/events","content":"","keywords":"","version":"next"},{"title":"Testing events​","type":1,"pageTitle":"Events","url":"/docs/next/basics/events#testing-events","content":"Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted: examples/src/features/events.rs use super::{PartyContractHostRef, PartyStarted}; use odra::host::{Deployer, HostEnv, NoArgs}; #[test] fn test_party() { let test_env: HostEnv = odra_test::env(); let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs); test_env.emitted_event( &party_contract, &PartyStarted { caller: test_env.get_account(0), block_time: 0 } ); // If you do not want to check the exact event, you can use `emitted` function test_env.emitted(&party_contract, "PartyStarted"); // You can also check how many events were emitted. assert_eq!(test_env.events_count(&party_contract), 1); } To explore more event testing functions, check the HostEnv documentation. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Events","url":"/docs/next/basics/events#whats-next","content":"Read the next article to learn how to call other contracts from the contract context. ","version":"next","tagName":"h2"},{"title":"Flipper Internals","type":0,"sectionRef":"#","url":"/docs/next/basics/flipper-internals","content":"","keywords":"","version":"next"},{"title":"Header​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#header","content":"flipper.rs use odra::Var; Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation that can be reused between targets. In the above case, we're importing Var, which is responsible for storing simple values on the blockchain's storage. ","version":"next","tagName":"h2"},{"title":"Struct​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#struct","content":"flipper.rs /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } In Odra, all contracts are also modules, which can be reused between contracts. That's why we need to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all the fields of the contract. Those fields can be regular Rust data types, however - those will not be persisted on the blockchain. They can also be Odra modules - defined in your project or coming from Odra itself. Finally, to make the data persistent on the blockchain, you can use something likeVar<T> showed above. To learn more about storage interaction, take a look at thenext article. ","version":"next","tagName":"h2"},{"title":"Impl​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#impl","content":"flipper.rs /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } ... Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take allpub functions from this section and create contract endpoints from them. So, if you wish to have functions that are not available for calling outside the contract, do not make them public. Alternatively, you can create a separate impl section without the attribute - all functions defined there, even marked with pub will be not callable. The function named init is the constructor of the contract. This function will be limited to only to a single call, all further calls to it will result in an error. The init function is optional, if your contract does not need any initialization, you can skip it. flipper.rs ... /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } ... The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data saved there using set function will be persisted in the blockchain. ","version":"next","tagName":"h2"},{"title":"Tests​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#tests","content":"flipper.rs #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } ... You can write tests in any way you prefer and know in Rust. In the example above we are deploying the contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, as the second argument of the deploy function, we pass NoArgs - one of the implementations of the InitArgs trait provided with the framework. The contract will be deployed on the VM you chose while running cargo odra test. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper Internals","url":"/docs/next/basics/flipper-internals#whats-next","content":"Now let's take a look at the different types of storage that Odra provides and how to use them. ","version":"next","tagName":"h2"},{"title":"Odra.toml","type":0,"sectionRef":"#","url":"/docs/next/basics/odra-toml","content":"","keywords":"","version":"next"},{"title":"Adding a new contract manually​","type":1,"pageTitle":"Odra.toml","url":"/docs/next/basics/odra-toml#adding-a-new-contract-manually","content":"Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly. For example, if you want to create a new contract called counter, your Odra.toml file should finally look like this: [[contracts]] fqn = "sample::Flipper" [[contracts]] fqn = "sample::Counter" ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Odra.toml","url":"/docs/next/basics/odra-toml#whats-next","content":"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famousFlipper contract. ","version":"next","tagName":"h2"},{"title":"Modules","type":0,"sectionRef":"#","url":"/docs/next/basics/modules","content":"","keywords":"","version":"next"},{"title":"Testing​","type":1,"pageTitle":"Modules","url":"/docs/next/basics/modules#testing","content":"As we don't need to hold addresses, the test is really simple: examples/src/features/modules.rs #[cfg(test)] mod tests { use super::ModulesContractHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn test_modules() { let test_env = odra_test::env(); let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs); assert_eq!(modules_contract.add_using_module(), 8); } } ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Modules","url":"/docs/next/basics/modules#whats-next","content":"We will see how to handle native token transfers. ","version":"next","tagName":"h2"},{"title":"Native token","type":0,"sectionRef":"#","url":"/docs/next/basics/native-token","content":"","keywords":"","version":"next"},{"title":"Testing​","type":1,"pageTitle":"Native token","url":"/docs/next/basics/native-token#testing","content":"To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function -balance_of: examples/src/features/native_token.rs #[cfg(test)] mod tests { use super::PublicWalletHostRef; use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_modules() { let test_env = odra_test::env(); let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs); assert_eq!(test_env.balance_of(my_contract.address()), U512::zero()); my_contract.with_tokens(U512::from(100)).deposit(); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100)); my_contract.withdraw(U512::from(25)); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75)); } } ","version":"next","tagName":"h2"},{"title":"HostEnv​","type":1,"pageTitle":"Native token","url":"/docs/next/basics/native-token#hostenv","content":"In a broader context of the host environment (test, livenet), you can also transfer CSPR tokens between accounts: let env = odra_casper_livenet_env::env(); //let env = odra_test::env(); let (alice, bob) = (env.get_account(0), env.get_account(1)); env.set_caller(alice); let result = env.transfer_tokens(bob, odra::casper_types::U512::from(100)); ","version":"next","tagName":"h2"},{"title":"Testing","type":0,"sectionRef":"#","url":"/docs/next/basics/testing","content":"","keywords":"","version":"next"},{"title":"HostEnv​","type":1,"pageTitle":"Testing","url":"/docs/next/basics/testing#hostenv","content":"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) and to configure how the contracts are deployed and called. Let's revisit the example from the previous article about host communication and implement the tests that prove it works: examples/src/features/testing.rs #[cfg(test)] mod tests { use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs}; use odra::{host::{Deployer, HostEnv}, prelude::*}; #[test] fn env() { let test_env: HostEnv = odra_test::env(); test_env.set_caller(test_env.get_account(0)); let init_args = TestingContractInitArgs { name: "MyContract".to_string() }; let testing_contract = TestingContractHostRef::deploy(&test_env, init_args); let creator = testing_contract.created_by(); test_env.set_caller(test_env.get_account(1)); let init_args = TestingContractInitArgs { name: "MyContract2".to_string() }; let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args); let creator2 = testing_contract2.created_by(); assert_ne!(creator, creator2); } } In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). Next, we are deploying two instances of the same contract, but we're using HostEnv::set_callerto change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller()the function we are calling inside the contract. HostEnv comes with a set of functions that will let you write better tests: fn set_caller(&self, address: Address) - you've seen it in action just nowfn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given addressfn advance_block_time(&self, time_diff: u64) - increases the current value of block_timefn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; by default, you start with the 0-th accountfn emitted_event<T: ToBytes + EventInstance, R: Addressable>(&self, contract_address: &R, event: &T) -> bool - verifies if the event was emitted by the contract Full list of functions can be found in the HostEnv documentation. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Testing","url":"/docs/next/basics/testing#whats-next","content":"We take a look at how Odra handles errors! ","version":"next","tagName":"h2"},{"title":"Storage interaction","type":0,"sectionRef":"#","url":"/docs/next/basics/storage-interaction","content":"","keywords":"","version":"next"},{"title":"Var​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#var","content":"The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your variable in the Var type. Let's look at a "real world" example of a contract that represents a dog: examples/src/features/storage/variable.rs use odra::prelude::*; use odra::Var; #[odra::module] pub struct DogContract { barks: Var<bool>, weight: Var<u32>, name: Var<String>, walks: Var<Vec<u32>>, } You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)! Let's make this contract usable, by providing a constructor and some getter functions: examples/src/features/storage/variable.rs #[odra::module] impl DogContract { pub fn init(&mut self, barks: bool, weight: u32, name: String) { self.barks.set(barks); self.weight.set(weight); self.name.set(name); self.walks.set(Vec::<u32>::default()); } pub fn barks(&self) -> bool { self.barks.get_or_default() } pub fn weight(&self) -> u32 { self.weight.get_or_default() } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { let walks = self.walks.get_or_default(); walks.len() as u32 } pub fn walks_total_length(&self) -> u32 { let walks = self.walks.get_or_default(); walks.iter().sum() } } As you can see, you can access the data, by using get_or_default function: examples/src/features/storage/variable.rs ... self.barks.get_or_default() ... note Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable doesn't have to be initialized! To modify the data, use the set() function: examples/src/features/storage/variable.rs self.barks.set(barks); A Var is easy to use and efficient for simple data types. One of its downsides is that it serializes the data as a whole, so when you're using complex types like Vec or HashMap, each time you get or set the whole data is read and written to the blockchain storage. In the example above, if we want to see how many walks our dog had, we would use the function: examples/src/features/storage/variable.rs pub fn walks_amount(&self) -> usize { let walks = self.walks.get_or_default(); walks.len() } But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, especially for larger sets of data. To tackle this issue following two types were created. ","version":"next","tagName":"h2"},{"title":"Mapping​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#mapping","content":"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that uses Mapping to store information about our dog's friends and how many times they visited: examples/src/features/storage/mapping.rs use odra::prelude::*; use odra::{Mapping, Var}; #[odra::module] pub struct DogContract2 { name: Var<String>, friends: Mapping<String, u32>, } In the example above, our key is a String (it is a name of the friend) and we are storing u32 values (amount of visits). To read and write values from and into a Mapping we use a similar approach to the one shown in the Vars section with one difference - we need to pass a key: examples/src/features/storage/mapping.rs pub fn visit(&mut self, friend_name: String) { let visits = self.visits(friend_name.clone()); self.friends.set(&friend_name, visits + 1); } pub fn visits(&self, friend_name: String) -> u32 { self.friends.get_or_default(&friend_name) } The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. We could implement such behavior by using a numeric type key and saving the length of the set in a separate variable. Thankfully Odra comes with a prepared solution - the List type. note If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with a Var working together: core/src/list.rs use odra::{List, Var}; pub struct List<T> { values: Mapping<u32, T>, index: Var<u32> } ","version":"next","tagName":"h2"},{"title":"List​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#list","content":"Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, we'll use the list: examples/src/features/storage/list.rs use odra::{prelude::*, List, Var}; #[odra::module] pub struct DogContract3 { name: Var<String>, walks: List<u32>, } As you can see, the notation is very similar to the Vec. To understand the usage, take a look at the reimplementation of the functions with an additional function that takes our dog for a walk (it writes the data to the storage): examples/src/features/storage/list.rs #[odra::module] impl DogContract3 { pub fn init(&mut self, name: String) { self.name.set(name); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { self.walks.len() } pub fn walks_total_length(&self) -> u32 { self.walks.iter().sum() } pub fn walk_the_dog(&mut self, length: u32) { self.walks.push(length); } } Now, we can know how many walks our dog had without loading the whole vector from the storage. We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all the cases for you. info All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder. ","version":"next","tagName":"h2"},{"title":"Custom Types​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#custom-types","content":"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors. Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type: use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } #[odra_type] is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type.CLType of a custom type is CLType::Any, except for an unit-only enum, which is CLType::U8. unit_only_enum.rs enum Enum { Foo = 3, Bar = 2, Baz = 1, } note Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute . ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Storage interaction","url":"/docs/next/basics/storage-interaction#whats-next","content":"In the next article, we'll see how to query the host for information about the world and our contract. ","version":"next","tagName":"h2"},{"title":"odra-examples","type":0,"sectionRef":"#","url":"/docs/next/examples/odra-examples","content":"","keywords":"","version":"next"},{"title":"What's next​","type":1,"pageTitle":"odra-examples","url":"/docs/next/examples/odra-examples#whats-next","content":"Read the next article to learn about reusable Odra components encapsulated in odra-modules. ","version":"next","tagName":"h2"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/next/getting-started/installation","content":"","keywords":"","version":"next"},{"title":"Prerequisites​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#prerequisites","content":"To start working with Odra, you need to have the following installed on your machine: Rust toolchain installed (see rustup.rs)wasmstrip tool installed (see wabt) We do not provide exact commands for installing these tools, as they are different for different operating systems. Please refer to the documentation of the tools themselves. With Rust toolchain ready, you can add a new target: rustup target add wasm32-unknown-unknown note wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files. ","version":"next","tagName":"h2"},{"title":"Installing Cargo Odra​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#installing-cargo-odra","content":"Cargo Odra is a helpful tool that will help you to build and test your smart contracts. It is not required to use Odra, but the documentation will assume that you have it installed. To install it, simply execute the following command: cargo install cargo-odra --locked To check if it was installed correctly and see available commands, type: cargo odra --help If everything went fine, we can proceed to the next step. ","version":"next","tagName":"h2"},{"title":"Creating a new Odra project​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#creating-a-new-odra-project","content":"To create a new project, simply execute: cargo odra new --name my-project && cd my_project This will create a new folder called my_project and initialize Odra there. Cargo Odra will create a sample contract for you in src directory. You can run the tests of this contract by executing: cargo odra test This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM: cargo odra test -b casper Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during the installation process, feel free to ask for help on our Discord. ","version":"next","tagName":"h2"},{"title":"What's next?​","type":1,"pageTitle":"Installation","url":"/docs/next/getting-started/installation#whats-next","content":"If you want to see the code that you just tested, continue to the description of Flipper example. ","version":"next","tagName":"h2"},{"title":"Using odra-modules","type":0,"sectionRef":"#","url":"/docs/next/examples/using-odra-modules","content":"","keywords":"","version":"next"},{"title":"Available modules​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#available-modules","content":"Odra modules comes with couple of ready-to-use modules and reusable extensions. ","version":"next","tagName":"h2"},{"title":"Tokens​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#tokens","content":"CEP-18​ Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 here. CEP-78​ Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 here. Erc20​ The Erc20 module implements the ERC20 standard. Erc721​ The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework. The Erc721Token module implements the ERC721Base and additionally uses the Erc721Metadata and Ownable extensions. The Erc721Receiver trait lets you implement your own logic for receiving NFTs. The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules. Erc1155​ The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework. The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension. The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules. Wrapped native token​ The WrappedNativeToken module implements the Wrapper for the native token, it was inspired by the WETH. ","version":"next","tagName":"h3"},{"title":"Access​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#access","content":"AccessControl​ This module enables the implementation of role-based access control mechanisms for children modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API. Ownable​ This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner. The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using thetransfer_ownership() function. Ownable2Step​ An extension of the Ownable module. Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions. ","version":"next","tagName":"h3"},{"title":"Security​","type":1,"pageTitle":"Using odra-modules","url":"/docs/next/examples/using-odra-modules#security","content":"Pausable​ A module allowing to implement an emergency stop mechanism that can be triggered by any account. ","version":"next","tagName":"h3"},{"title":"Flipper example","type":0,"sectionRef":"#","url":"/docs/next/getting-started/flipper","content":"","keywords":"","version":"next"},{"title":"Let's flip​","type":1,"pageTitle":"Flipper example","url":"/docs/next/getting-started/flipper#lets-flip","content":"flipper.rs use odra::Var; /// A module definition. Each module struct consists Vars and Mappings /// or/and another modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor, must be named `init`. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } /// Retrieves value from the storage. /// If the value has never been set, the default value is returned. pub fn get(&self) -> bool { self.value.get_or_default() } } #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } #[test] fn test_two_flippers() { let env = odra_test::env(); let mut contract1 = FlipperHostRef::deploy(&env, NoArgs); let contract2 = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract1.get()); assert!(!contract2.get()); contract1.flip(); assert!(contract1.get()); assert!(!contract2.get()); } } ","version":"next","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Flipper example","url":"/docs/next/getting-started/flipper#testing","content":"To run the tests, execute the following command: cargo odra test # or add the `-b casper` flag to run tests on the CasperVM ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper example","url":"/docs/next/getting-started/flipper#whats-next","content":"In the next category of articles, we will go through basic concepts of Odra. ","version":"next","tagName":"h2"},{"title":"Access Control","type":0,"sectionRef":"#","url":"/docs/next/tutorials/access-control","content":"","keywords":"","version":"next"},{"title":"Code​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#code","content":"Before we start writing code, we list the functionalities of our access control layer. A Role type is used across the module.A Role can be assigned to many Addresses.Each Role may have a corresponding admin role.Only an admin can grant/revoke a Role.A Role can be renounced.A Role cannot be renounced on someone's behalf.Each action triggers an event.Unauthorized access stops contract execution. ","version":"next","tagName":"h2"},{"title":"Project Structure​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#project-structure","content":"access-control ├── src │ ├── access │ │ ├── access_control.rs │ │ ├── events.rs │ │ └── errors.rs │ └── lib.rs |── build.rs |── Cargo.toml └── Odra.toml ","version":"next","tagName":"h3"},{"title":"Events and Errors​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#events-and-errors","content":"There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions. events.rs use odra::prelude::*; use odra::Address; use super::access_control::Role; #[odra::event] pub struct RoleGranted { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleRevoked { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleAdminChanged { pub role: Role, pub previous_admin_role: Role, pub new_admin_role: Role } L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role. errors.rs #[odra::odra_error] pub enum Error { MissingRole = 20_000, RoleRenounceForAnotherAddress = 20_001, } Errors definition is straightforward - there are only two invalid states: An action is triggered by an unauthorized actor.The caller is attempting to resign the Role on someone's behalf. ","version":"next","tagName":"h3"},{"title":"Module​","type":1,"pageTitle":"Access Control","url":"/docs/next/tutorials/access-control#module","content":"Now, we are stepping into the most interesting part: the module definition and implementation. access_control.rs use super::events::*; use super::errors::Error; use odra::prelude::*; use odra::{Address, Mapping}; pub type Role = [u8; 32]; pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32]; #[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])] pub struct AccessControl { roles: Mapping<(Role, Address), bool>, role_admin: Mapping<Role, Role> } #[odra::module] impl AccessControl { pub fn has_role(&self, role: &Role, address: &Address) -> bool { self.roles.get_or_default(&(*role, *address)) } pub fn get_role_admin(&self, role: &Role) -> Role { let admin_role = self.role_admin.get(role); if let Some(admin) = admin_role { admin } else { DEFAULT_ADMIN_ROLE } } pub fn grant_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_grant_role(role, address); } pub fn revoke_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_revoke_role(role, address); } pub fn renounce_role(&mut self, role: &Role, address: &Address) { if address != &self.env().caller() { self.env().revert(Error::RoleRenounceForAnotherAddress); } self.unchecked_revoke_role(role, address); } } impl AccessControl { pub fn check_role(&self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.env().revert(Error::MissingRole); } } pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) { let previous_admin_role = self.get_role_admin(role); self.role_admin.set(role, *admin_role); self.env().emit_event(RoleAdminChanged { role: *role, previous_admin_role, new_admin_role: *admin_role }); } pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.roles.set(&(*role, *address), true); self.env().emit_event(RoleGranted { role: *role, address: *address, sender: self.env().caller() }); } } pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) { if self.has_role(role, address) { self.roles.set(&(*role, *address), false); self.env().emit_event(RoleRevoked { role: *role, address: *address, sender: self.env().caller() }); } } } L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.L8 - The default role is an array filled with zeros.L10-L13 - The storage consists of two mappings: roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.role_admin - each Role can have a single admin Role. L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.L49 - This is a non-exported block containing helper functions.L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access. ","version":"next","tagName":"h3"},{"title":"Migration guide to v0.9.0","type":0,"sectionRef":"#","url":"/docs/next/migrations/to-0.9.0","content":"","keywords":"","version":"next"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#1-prerequisites","content":"","version":"next","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"next","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0. ","version":"next","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#2-migration-steps","content":"","version":"next","tagName":"h2"},{"title":"2.1 Update build_schema.rs bin​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#21-update-build_schemars-bin","content":"Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"next","tagName":"h3"},{"title":"2.2 Update smart contract code​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#22-update-smart-contract-code","content":"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes. 2.2.1. Update custom types definitions.​ #[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute. 0.9.00.8.0 use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } 2.2.2. Update errors definitions.​ #[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. Error enum should be passed as a parameter to the #[odra::module] attribute. 0.9.00.8.0 #[odra::module(events = [/* events go here */], errors = Error)] pub struct Erc20 { // fields } #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.2.3. Update events definitions.​ #[derive(Event)] attribute has been replace with #[odra::event] attribute. 0.9.00.8.0 use odra::prelude::*; use odra::{Address, casper_types::U256}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } ","version":"next","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.9.0. 0.9.0Prev src/erc20.rs use crate::erc20::errors::Error; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer], errors = Error)] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(Error::NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(Error::InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(Error::InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { // nothing changed in the tests } ","version":"next","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"next","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/next/migrations/to-0.9.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"next","tagName":"h2"},{"title":"Build, Deploy and Read the State of a Contract","type":0,"sectionRef":"#","url":"/docs/next/tutorials/build-deploy-read","content":"","keywords":"","version":"next"},{"title":"Contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#contract","content":"Let's write a contract with complex storage layout. The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping. We will expose two methods: The constructor init which sets the metadata and the version of the contract.The method set_data which sets the value of the numeric field and the values of the mapping. custom_item.rs use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var}; // A custom type with a vector of another custom type #[odra::odra_type] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[odra::odra_type] pub struct Price { value: U256, } // The main contract with a version, metadata and a submodule #[odra::module] pub struct CustomItem { version: Var<u32>, meta: Var<Metadata>, data: SubModule<Data> } #[odra::module] impl CustomItem { pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) { let meta = Metadata { name, description, prices: vec![ Price { value: price_1 }, Price { value: price_2 } ] }; self.meta.set(meta); self.version.set(self.version.get_or_default() + 1); } pub fn set_data(&mut self, value: u32, name: String, name2: String) { self.data.value.set(value); self.data.inner.named_values.set(&name, 10); self.data.inner.named_values.set(&name2, 20); } } // A submodule with a numeric value and another submodule #[odra::module] struct Data { value: Var<u32>, inner: SubModule<InnerData>, } // A submodule with a mapping #[odra::module] struct InnerData { named_values: Mapping<String, u32>, } ","version":"next","tagName":"h3"},{"title":"Deploying the contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#deploying-the-contract","content":"First, we need to setup the chain. We will use the NCTL docker image to run a local network. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Next, we need to compile the contract to a Wasm file. cargo odra build -c custom_item Then, we can deploy the contract using the casper-client tool. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key path/to/your/secret_key.pem \\ --session-path [PATH_TO_WASM] \\ --payment-amount 100000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string='My Name'" \\ --session-arg "description:string='My Description'" \\ --session-arg "price_1:u256='101'" \\ --session-arg "price_2:u256='202'" Finally, we can call the set_data method to set the values of the contract. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key ./keys/secret_key.pem \\ --payment-amount 2000000000 \\ --session-hash [DEPLOYED_CONTRACT_HASH] \\ --session-entry-point "set_data" \\ --session-arg "value:u32:'666'" \\ --session-arg "name:string='alice'" \\ --session-arg "name2:string='bob'" ","version":"next","tagName":"h3"},{"title":"Storage Layout​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#storage-layout","content":"To read the state of the contract, we need to understand the storage layout. The first step is to calculate the index of the keys. Storage Layout CustomItem: prefix: 0x0..._0000_0000_0000 0 version: u32, 0x0..._0000_0000_0001 1 meta: Metadata, 0x0..._0000_0000_0010 2 data: Data: prefix: 0x0..._0000_0000_0011 3 value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1 inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2 named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1 The actual key is obtained as follows: Convert the index to a big-endian byte array.Concatenate the index with the mapping data.Hash the concatenated bytes using blake2b.Return the hex representation of the hash (the stored key must be utf-8 encoded). In more detail, the storage layout is described in the Storage Layout article. ","version":"next","tagName":"h3"},{"title":"Reading the state​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/next/tutorials/build-deploy-read#reading-the-state","content":"RustTypeScript main.rs use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity}; use casper_types::{ bytesrepr::{FromBytes, ToBytes}, U256, }; // replace with your contract hash const CONTRACT_HASH: &str = "hash-..."; const NODE_ADDRESS: &str = "http://localhost:11101/rpc"; const RPC_ID: &str = "casper-net-1"; const DICTIONARY_NAME: &str = "state"; #[derive(Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } async fn read_state_key(key: String) -> Vec<u8> { let state_root_hash = casper_client::get_state_root_hash( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, None, ) .await .unwrap() .result .state_root_hash .unwrap(); // Read the value from the `state` dictionary. let result = casper_client::get_dictionary_item( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, state_root_hash, DictionaryItemIdentifier::ContractNamedKey { key: CONTRACT_HASH.to_string(), dictionary_name: DICTIONARY_NAME.to_string(), dictionary_item_key: key, }, ) .await .unwrap() .result .stored_value; // We expect the value to be a CLValue if let StoredValue::CLValue(cl_value) = result { // Ignore the first 4 bytes, which are the length of the CLType. cl_value.inner_bytes()[4..].to_vec() } else { vec![] } } async fn metadata() -> Metadata { // The key for the metadata is 2, and it has no mapping data let key = key(2, &[]); let bytes = read_state_key(key).await; // Read the name and store the remaining bytes let (name, bytes) = String::from_bytes(&bytes).unwrap(); // Read the description and store the remaining bytes let (description, bytes) = String::from_bytes(&bytes).unwrap(); // A vector is stored as a u32 size followed by the elements // Read the size of the vector and store the remaining bytes let (size, mut bytes) = u32::from_bytes(&bytes).unwrap(); let mut prices = vec![]; // As we know the size of the vector, we can loop over it for _ in 0..size { // Read the value and store the remaining bytes let (value, rem) = U256::from_bytes(&bytes).unwrap(); bytes = rem; prices.push(Price { value }); } // Anytime you finish parsing a value, you should check if there are any remaining bytes // if there are, it means you have a bug in your parsing logic. // For simplicity, we will ignore the remaining bytes here. Metadata { name, description, prices } } async fn value() -> u32 { // The key for the value is (3 << 4) + 1, and it has no mapping data let key = key((3 << 4) + 1, &[]); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } async fn named_value(name: &str) -> u32 { // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes let mapping_data = name.to_bytes().unwrap(); let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } fn main() { let runtime = tokio::runtime::Runtime::new().unwrap(); dbg!(runtime.block_on(metadata())); dbg!(runtime.block_on(value())); dbg!(runtime.block_on(named_value("alice"))); dbg!(runtime.block_on(named_value("bob"))); } // The key is a combination of the index and the mapping data // The algorithm is as follows: // 1. Convert the index to a big-endian byte array // 2. Concatenate the index with the mapping data // 3. Hash the concatenated bytes using blake2b // 4. Return the hex representation of the hash (the stored key must be utf-8 encoded) fn key(idx: u32, mapping_data: &[u8]) -> String { let mut key = Vec::new(); key.extend_from_slice(idx.to_be_bytes().as_ref()); key.extend_from_slice(mapping_data); let hashed_key = blake2b(&key); hex::encode(&hashed_key) } fn blake2b(bytes: &[u8]) -> [u8; 32] { let mut result = [0u8; 32]; let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32) .expect("should create hasher"); let _ = std::io::Write::write(&mut hasher, bytes); blake2::digest::VariableOutput::finalize_variable(hasher, &mut result) .expect("should copy hash to the result array"); result } cargo run [src/main.rs:116:5] runtime.block_on(metadata()) = Metadata { name: "My Contract", description: "My Description", prices: [ Price { value: 123, }, Price { value: 321, }, ], } [src/main.rs:117:5] runtime.block_on(value()) = 666 [src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20 [src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10 ","version":"next","tagName":"h3"},{"title":"Deploying a Token on Casper Livenet","type":0,"sectionRef":"#","url":"/docs/next/tutorials/deploying-on-casper","content":"","keywords":"","version":"next"},{"title":"Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#casper-wallet","content":"We will be using Casper Wallet to do some tasks in this tutorial. To install it, please follow the instructions on theofficial website. After setting up the wallet, extract the private key of the account you want to use for our testing. You can do this by clicking on the Menu > Download account keys. danger You are solely responsible for the security of your private keys. We recommend creating a new account for the testing purposes. Why do we need the private key? We will use it in Odra to deploy our contract to the Casper network using Livenet backend. ","version":"next","tagName":"h2"},{"title":"Getting tokens​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#getting-tokens","content":"To deploy the contract on the Livenet, we need to have some CSPR. The easiest way to get them is to use the faucet, which will send us 1000 CSPR for free. Unfortunately, only on the Testnet. To use the faucet, go to the Casper Testnet Faucet. Log in using your Casper Wallet account and click on the "Request Tokens" button. note One account can request tokens only once. If you run out of tokens, you can either ask someone in the Casper community to send you some, or simply create a new account in the wallet. Now, when we have the tokens, we can deploy the contract. Let's do it using Odra! ","version":"next","tagName":"h2"},{"title":"Odra Livenet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#odra-livenet","content":"Odra Livenet is described in detail in thebackends section of this documentation. We will then briefly describe how to use set it up in this tutorial. In your contract code, create a new file in the bin folder: bin/our_token_livenet.rs //! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial //! creator. use std::str::FromStr; use odra::casper_types::U256; use odra::host::{Deployer, HostEnv, HostRef, HostRefLoader}; use odra::Address; use ourcoin::token::{OurTokenHostRef, OurTokenInitArgs}; fn main() { // Load the Casper livenet environment. let env = odra_casper_livenet_env::env(); // Caller is the deployer and the owner of the private key. let owner = env.caller(); // Just some random address... let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26"; let recipient = Address::from_str(recipient).unwrap(); // Deploy new contract. let mut token = deploy_our_token(&env); println!("Token address: {}", token.address().to_string()); // Propose minting new tokens. env.set_gas(1_000_000_000u64); token.propose_new_mint(recipient, U256::from(1_000)); // Vote, we are the only voter. env.set_gas(1_000_000_000u64); token.vote(true, U256::from(1_000)); // Let's advance the block time by 11 minutes, as // we set the voting time to 10 minutes. // OH NO! It is the Livenet, so we need to wait real time... // Hopefully you are not in a hurry. env.advance_block_time(11 * 60 * 1000); // Tally the votes. env.set_gas(1_500_000_000u64); token.tally(); // Check the balances. println!("Owner's balance: {:?}", token.balance_of(&owner)); println!( "Tutorial creator's balance: {:?}", token.balance_of(&recipient) ); } /// Deploys a contract. pub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef { let name = String::from("OurToken"); let symbol = String::from("OT"); let decimals = 0; let initial_supply = U256::from(1_000); let init_args = OurTokenInitArgs { name, symbol, decimals, initial_supply, }; env.set_gas(300_000_000_000u64); OurTokenHostRef::deploy(env, init_args) } /// Loads a contract. Just in case you need to load an existing contract later... fn _load_cep18(env: &HostEnv) -> OurTokenHostRef { let address = "hash-XXXXX"; let address = Address::from_str(address).unwrap(); OurTokenHostRef::load(env, address) } In your Cargo.toml file, we need to add a new dependency, a feature and register the new binary. In the end, it should look like this: Cargo.toml [package] name = "ourcoin" version = "0.1.0" edition = "2021" [dependencies] odra = { version = "1.1.0", features = [], default-features = false } odra-modules = { version = "1.1.0", features = [], default-features = false } odra-casper-livenet-env = { version = "1.1.0", optional = true } [dev-dependencies] odra-test = { version = "1.1.0", features = [], default-features = false } [build-dependencies] odra-build = { version = "1.1.0", features = [], default-features = false } [features] default = [] livenet = ["odra-casper-livenet-env"] [[bin]] name = "ourcoin_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "ourcoin_build_schema" path = "bin/build_schema.rs" test = false [[bin]] name = "our_token_livenet" path = "bin/our_token_livenet.rs" required-features = ["livenet"] [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 Finally, add the .env file with the following content: .env # Path to the secret key of the account that will be used to deploy the contracts. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777 # Chain name of the network. ODRA_CASPER_LIVENET_CHAIN_NAME=casper-test Of course, you need to replace the secret key's path with the path to the secret key file you downloaded from the Casper Wallet. note One of the problems you may encounter is that the node you are using will be down or will not accept your calls. In this case, you will have to find and use another node IP address. Now, we will run our code: cargo run --bin our_token_livenet --features livenet If everything is set up correctly, you should see the output similar to this: Running `target/debug/our_token_livenet` 💁 INFO : Deploying "OurToken". 💁 INFO : Found wasm under "wasm/OurToken.wasm". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 💁 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed. 💁 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed. Token address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 💁 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed. 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 💁 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed. 💁 INFO : advance_block_time called - Waiting for 660000 ms 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 💁 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed. Owner's balance: 1000 Tutorial creator's balance: 1000 Congratulations, your contract is now deployed on the Casper network! Before we move on, note the address of the token! We will use it in the next section to interact with the token. In our case it ishash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857. ","version":"next","tagName":"h2"},{"title":"Cspr.live​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#csprlive","content":"The first thing we will do is to explore Casper's network block explorer,cspr.live. We can put the address of our token in the search bar to find it. note If you deployed your contract on the Testnet, remember to make sure that the Testnet network is selected in the dropdown menu in the top right corner. If everything is set up correctly, you should see the contract package's details. Besides the owner, keys etc., you can also see the contract's metdata, if it was developed using a standard that cspr.live supports. Indeed, we can see that it detected that our contract is a CEP-18 token! We see the name, symbol and total supply. All the mentions of the contract on the website will use the token name instead of the contract address. Additionally, on the Token Txs tab, we can see the transactions that happened with the token. We can see the minting transaction we did in the previous section and transfers done during the voting process. If we click on one of the accounts that recieved the tokens, we will go to the account page. Here, on the Tokens tab, we can see all the tokens that the account has - and OurToken is one of them! If you wish, you can check the status of the contract deployed during the development of this tutorial here. ","version":"next","tagName":"h2"},{"title":"Transferring Tokens using Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#transferring-tokens-using-casper-wallet","content":"Casper wallet can do much more than just logging in to the faucet, exporting the private keys and transferring CSPR. It can also interact with the contracts deployed on the network. If you deployed the contract and left some OT tokens to yourself, you should see them in the Casper Wallet window. You should also be able to transfer them to another account! ","version":"next","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/next/tutorials/deploying-on-casper#conclusion","content":"We've successfully deployed a token on the Casper network and interacted with it using the Odra backend and Casper Wallet. We've also learned how to use the cspr.live block explorer to check the status of your contract. Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem provides. Feel free to explore them on casperecosystem.io. ","version":"next","tagName":"h2"},{"title":"Migration guide to v0.8.0","type":0,"sectionRef":"#","url":"/docs/next/migrations/to-0.8.0","content":"","keywords":"","version":"next"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#1-prerequisites","content":"","version":"next","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"next","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0. ","version":"next","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#2-migration-steps","content":"","version":"next","tagName":"h2"},{"title":"2.1 Add bin directory​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#21-add-bin-directory","content":"Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory. You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"next","tagName":"h3"},{"title":"2.2. Update Cargo.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#22-update-cargotoml","content":"There a bunch of changes in the Cargo.toml file. You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.Register bins you added in the previous step.Add dev-dependencies section with odra-test crate.Add recommended profiles for release and dev to optimize the build process. Below you can compare the Cargo.toml file after and before the migration to v0.8.0: 0.8.0Prev [package] name = "my_project" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.0" [dev-dependencies] odra-test = "0.8.0" [[bin]] name = "my_project_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "my_project_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 ","version":"next","tagName":"h3"},{"title":"2.2. Update Odra.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#22-update-odratoml","content":"Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required. 0.8.0Prev [[contracts]] fqn = "my_project::Flipper" ","version":"next","tagName":"h3"},{"title":"2.3. Update Smart Contracts​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#23-update-smart-contracts","content":"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make: 2.3.1. Update the use statements to reflect the new module structure.​ Big integer types are now located in the odra::casper_types module.odra::types::Address is now odra::Address.Variable is now Var.Remove odra::contract_env.Remove odra::types::event::OdraEvent.Remove odra::types::OdraType as it is no longer required.Change odra::types::casper_types::*; to odra::casper_types::*;. 2.3.2. Some type aliases are no longer in use.​ Balance - use odra::casper_types::U512.BlockTime - use u64.EventData - use odra::casper_types::bytesrepr::Bytes. 2.3.3. Consider import odra::prelude::* in your module files.​ 2.3.4. Flatten nested Mappings.​ // Before #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<Address, Mapping<Address, U256>> } // After #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<(Address, Address), U256> } 2.3.5. Update errors definitions.​ execution_error! macro has been replace with OdraError derive macro. 0.8.0Prev use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.3.6. Update events definitions.​ 0.8.0Prev use odra::prelude::*; use odra::Event; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } // Emitting the event self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); 2.3.7. Replace contract_env with self.env() in your modules.​ self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes. fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions. fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.functions native_token_metadata() and one_token() have been removed. 2.3.8. Wrap submodules of your module with odra::SubModule<T>.​ 0.8.0Prev #[odra::module(events = [Transfer])] pub struct Erc721Token { core: SubModule<Erc721Base>, metadata: SubModule<Erc721MetadataExtension>, ownable: SubModule<Ownable> } 2.3.9. Update external contract calls.​ However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()). 0.8.0Prev #[odra::external_contract] pub trait Token { fn balance_of(&self, owner: &Address) -> U256; } // Usage TokenContractRef::new(env, token).balance_of(account) 2.3.10. Update constructors.​ Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init. 2.3.11. Update UnwrapOrRevert calls.​ The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter. 2.3.12. Remove #[odra(using)] attribute from your module definition.​ Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required. ","version":"next","tagName":"h3"},{"title":"2.4. Update Tests​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#24-update-tests","content":"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make: 2.4.1. Contract deployment.​ The way you deploy a contract has changed: You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function. 0.8.0Prev // A contract without init args use super::OwnableHostRef; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; let env: HostEnv = odra_test::env(); let ownable = OwnableHostRef::deploy(&env, NoArgs) // A contract with init args use super::{Erc20HostRef, Erc20InitArgs}; use odra::host::{Deployer, HostEnv}; let env: HostEnv = odra_test::env(); let init_args = Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) }; let erc20 = Erc20HostRef::deploy(&env, init_args); 2.4.2. Host interactions.​ Replace odra::test_env with odra_test::env().The API of odra::test_env and odra_test::env() are similar, but there are some differences: test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).test_env::token_balance(Address) is now env.balance_of(&Address).functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef. 2.4.3. Testing failing scenarios.​ test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result.try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro. 0.8.0Prev #[test] fn transfer_from_error() { let (env, mut erc20) = setup(); let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); assert_eq!( erc20.try_transfer_from(owner, recipient, amount), Err(Error::InsufficientAllowance.into()) ); } 2.4.4. Testing events.​ assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options. 0.8.0Prev let env: HostEnv = odra_test::env(); let erc20 = Erc20HostRef::deploy(&env, init_args); ... assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); ","version":"next","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.8.0. 0.8.0Prev src/erc20.rs use crate::erc20::errors::Error::*; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address, Event}; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[derive(Event, Eq, PartialEq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { use super::{ errors::Error, events::{Approval, Transfer}, Erc20HostRef, Erc20InitArgs }; use odra::{ casper_types::U256, host::{Deployer, HostEnv, HostRef}, prelude::* }; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } // Other tests... } ","version":"next","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"next","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/next/migrations/to-0.8.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"next","tagName":"h2"},{"title":"CEP-18","type":0,"sectionRef":"#","url":"/docs/next/tutorials/cep18","content":"","keywords":"","version":"next"},{"title":"Self-governing token​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#self-governing-token","content":"There are many ways to implement a governance mechanism for a token, each more complex than the other. In our example, we will use a simple one, where the community of token holders can vote to mint new tokens. ","version":"next","tagName":"h2"},{"title":"Token implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#token-implementation","content":"Let's start by creating a new project, choosing a clever name and using cep18 as our starting template: cargo odra new --name ourcoin --template cep18 Let's glance at our token code: src/token.rs #[odra::module] pub struct MyToken { token: SubModule<Cep18>, } impl MyToken { // Delegate all Cep18 functions to the token sub-module. delegate! { to self.token { ... fn name(&self) -> String; fn symbol(&self) -> String; ... As we can see, it indeed uses the Cep18 module and delegates all the methods to it. The only thing to do is to change the name of the struct to more appropriate OurToken, run the provided tests using cargo odra test, and continue with the implementation of the governance. note Remember to change the name of the struct and its usages as well as the struct name in the Odra.toml file! ","version":"next","tagName":"h2"},{"title":"Governance implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#governance-implementation","content":"Let's go through the process of implementing the governance mechanism. If we don't want to, we don't have to hide entrypoints from the public responsible for minting new tokens. By default, minting Modalityis turned off, so any attempt of direct minting will result in an error. We will however implement a voting mechanism, where the token holders can vote to mint new tokens. ","version":"next","tagName":"h2"},{"title":"Voting mechanism​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#voting-mechanism","content":"Our voting system will be straightforward: Anyone with the tokens can propose a new mint.Anyone with the tokens can vote for the new mint by staking their tokens.If the majority of the token holders vote for the mint, it is executed. Storage​ We will need to store some additional information about the votes, so let's add some fields to our token struct: src/token.rs #[odra::module] pub struct OurToken { /// A sub-module that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } Notice that proposed_mint contains a tuple containing the address of the proposer and the amount of tokens to mint. Moreover, we need to keep track if the vote time has ended, but also if it was already tallied, that's why we need both is_vote_open and vote_end_time. We will also use the power of the Listtype to store the Ballots. Proposing a new mint​ To implement the endpoint that allows token holders to propose a new mint, we need to add a new function to our token module: src/token.rs /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open().get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 60 * 10 * 1000); } As a parameters to the function, we pass the address of the account that should be the receiver of the minted tokens, and the amount. After some validation, we open the vote by setting the is_vote_open to true, and setting the vote_end_time to 10 minutes. In real-world scenarios, the time could be configurable, but for the sake of simplicity, we hardcoded it. Also, it should be quite longer than 10 minutes, but it will come in handy when we test it on Livenet. Voting for the mint​ Next, we need an endpoint that will allow us to cast a ballot: src/token.rs /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token .transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } The most interesting thing here is that we are using a mechanism of staking, where we transfer our tokens to the contract, to show that we really mean it. The tokens will be locked until the vote is over, and tallied. Speaking of tallying... Tallying the votes​ The last step is to tally the votes and mint the tokens if the majority of voters agreed to do so: src/token.rs /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token.raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } Notice how we used raw_transfer from the Cep18 module. We used it to set the sender, so the contract's balance will be used, instead of the caller's. Additonally, we used raw_mint to mint the tokens, skipping the security checks. We have no modality for minting, but even if we had, we don't have anyone with permissions! The Contract needs to mint the tokens itself. ","version":"next","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#testing","content":"Now, we will put our implementation to the test. One unit test, that we can run both on OdraVM and on the CasperVM. src/token.rs #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } We can run the test using both methods: cargo odra test cargo odra test -b casper It is all nice and green, but it would be really nice to see it in action. How about deploying it on the Casper network? ","version":"next","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#whats-next","content":"We will se our token in action, by deploying it on the Casper network, and using tools from the Casper Ecosystem to interact with it. ","version":"next","tagName":"h2"},{"title":"Complete code​","type":1,"pageTitle":"CEP-18","url":"/docs/next/tutorials/cep18#complete-code","content":"Here is the complete code of the OurToken module: src/token.rs use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var}; use odra_modules::cep18_token::Cep18; /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } /// Errors for the governed token. #[odra::odra_error] pub enum GovernanceError { /// The vote is already in progress. VoteAlreadyOpen = 0, /// No vote is in progress. NoVoteInProgress = 1, /// Cannot tally votes yet. VoteNotYetEnded = 2, /// Vote ended VoteEnded = 3, /// Only the token holders can propose a new mint. OnlyTokenHoldersCanPropose = 4, } /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct OurToken { /// A submodule that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl OurToken { /// Initializes the contract with the given metadata and initial supply. pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { // We put the token address as an admin, so it can govern itself. Self-governing token! self.token .init(symbol, name, decimals, initial_supply, vec![], vec![], None); } // Delegate all Cep18 functions to the token submodule. delegate! { to self.token { /// Admin EntryPoint to manipulate the security access granted to users. /// One user can only possess one access group badge. /// Change strength: None > Admin > Minter /// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an /// Admin, also if a user is added to Admin and None then they will be removed from having rights. /// Beware: do not remove the last Admin because that will lock out all admin functionality. fn change_security( &mut self, admin_list: Vec<Address>, minter_list: Vec<Address>, none_list: Vec<Address> ); /// Returns the name of the token. fn name(&self) -> String; /// Returns the symbol of the token. fn symbol(&self) -> String; /// Returns the number of decimals the token uses. fn decimals(&self) -> u8; /// Returns the total supply of the token. fn total_supply(&self) -> U256; /// Returns the balance of the given address. fn balance_of(&self, address: &Address) -> U256; /// Returns the amount of tokens the owner has allowed the spender to spend. fn allowance(&self, owner: &Address, spender: &Address) -> U256; /// Approves the spender to spend the given amount of tokens on behalf of the caller. fn approve(&mut self, spender: &Address, amount: &U256); /// Decreases the allowance of the spender by the given amount. fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256); /// Increases the allowance of the spender by the given amount. fn increase_allowance(&mut self, spender: &Address, inc_by: &U256); /// Transfers tokens from the caller to the recipient. fn transfer(&mut self, recipient: &Address, amount: &U256); /// Transfers tokens from the owner to the recipient using the spender's allowance. fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256); /// Mints new tokens and assigns them to the given address. fn mint(&mut self, owner: &Address, amount: &U256); /// Burns the given amount of tokens from the given address. fn burn(&mut self, owner: &Address, amount: &U256); } } /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env() .revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 10 * 60 * 1000); } /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token.transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token .raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } fn assert_vote_in_progress(&self) { if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() > finish_time { self.env().revert(GovernanceError::VoteEnded); } } } #[cfg(test)] mod tests { use super::*; use odra::host::Deployer; #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } } ","version":"next","tagName":"h2"},{"title":"ERC-20","type":0,"sectionRef":"#","url":"/docs/next/tutorials/erc20","content":"","keywords":"","version":"next"},{"title":"Framework features​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: Advanced storage using key-value pairs,Odra types such as Address,Advanced event assertion. ","version":"next","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#code","content":"Our module features a considerably more complex storage layout compared to the previous example. It is designed to store the following data: Immutable metadata - name, symbol, and decimals.Total supply.Balances of individual users.Allowances, essentially indicating who is permitted to spend tokens on behalf of another user. ","version":"next","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#module-definition","content":"erc20.rs use odra::prelude::*; use odra::{Address, casper_types::U256, Mapping, Var}; #[odra::module(events = [Transfer, Approval])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys. ","version":"next","tagName":"h2"},{"title":"Metadata​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#metadata","content":"erc20.rs #[odra::module] impl Erc20 { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let caller = self.env().caller(); self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.mint(&caller, &initial_supply); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn symbol(&self) -> String { self.symbol.get_or_default() } pub fn decimals(&self) -> u8 { self.decimals.get_or_default() } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } } impl Erc20 { pub fn mint(&mut self, address: &Address, amount: &U256) { self.balances.add(address, *amount); self.total_supply.add(*amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } } #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.L3-L9 - A constructor sets the token metadata and mints the initial supply.L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for: use odra::UnwrapOrRevert; let current_balance = self.balances.get(address).unwrap_or_default(); let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env()); self.balances.set(address, new_balance); ","version":"next","tagName":"h3"},{"title":"Core​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#core","content":"To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks. erc20.rs #[odra::module] impl Erc20 { ... pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn balance_of(&self, address: &Address) -> U256 { self.balances.get_or_default(&address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } } impl Erc20 { ... fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let owner_balance = self.balances.get_or_default(&owner); if *amount > owner_balance { self.env().revert(Error::InsufficientBalance) } self.balances.set(owner, owner_balance - *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowance(owner, spender); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } let new_allowance = allowance - *amount; self.allowances .set(&(*owner, *spender), new_allowance); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } #[odra::odra_error] pub enum Error { InsufficientBalance = 1, InsufficientAllowance = 2, } Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation? ","version":"next","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#test","content":"erc20.rs #[cfg(test)] pub mod tests { use super::*; use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}}; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: INITIAL_SUPPLY.into() } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( &erc20, &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( &erc20, &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } #[test] fn transfer_from_and_approval_work() { let (env, mut erc20) = setup(); let (owner, recipient, spender) = (env.get_account(0), env.get_account(1), env.get_account(2)); let approved_amount = 3_000.into(); let transfer_amount = 1_000.into(); assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY)); // Owner approves Spender. erc20.approve(&spender, &approved_amount); // Allowance was recorded. assert_eq!(erc20.allowance(&owner, &spender), approved_amount); assert!(env.emitted_event( &erc20, &Approval { owner, spender, value: approved_amount } )); // Spender transfers tokens from Owner to Recipient. env.set_caller(spender); erc20.transfer_from(&owner, &recipient, &transfer_amount); // Tokens are transferred and allowance decremented. assert_eq!( erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY) - transfer_amount ); assert_eq!(erc20.balance_of(&recipient), transfer_amount); assert!(env.emitted_event( &erc20, &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( &erc20, &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); // assert!(env.emitted(erc20.address(), "Transfer")); } #[test] fn transfer_from_error() { // Given a new instance. let (env, mut erc20) = setup(); // When the spender's allowance is zero. let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); // Then transfer fails. assert_eq!( erc20.try_transfer_from(&owner, &recipient, &amount), Err(Error::InsufficientAllowance.into()) ); } } L146 - Alternatively, if you don't want to check the entire event, you may assert only its type. ","version":"next","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"ERC-20","url":"/docs/next/tutorials/erc20#whats-next","content":"Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids. ","version":"next","tagName":"h2"},{"title":"Ownable","type":0,"sectionRef":"#","url":"/docs/next/tutorials/ownable","content":"","keywords":"","version":"next"},{"title":"Framework features​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: storing a single value,defining a constructor,error handling,defining and emitting events.registering a contact in a test environment,interactions with the test environment,assertions (value, events, errors assertions). ","version":"next","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#code","content":"Before we write any code, we define functionalities we would like to implement. Module has an initializer that should be called once. Only the current owner can set a new owner.Read the current owner.A function that fails if called by a non-owner account. ","version":"next","tagName":"h2"},{"title":"Define a module​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#define-a-module","content":"ownable.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module(events = [OwnershipChanged])] pub struct Ownable { owner: Var<Option<Address>> } That was easy, but it is crucial to understand the basics before we move on. L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var. ","version":"next","tagName":"h3"},{"title":"Init the module​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#init-the-module","content":"ownable.rs #[odra::module] impl Ownable { pub fn init(&mut self, owner: Address) { if self.owner.get_or_default().is_some() { self.env().revert(Error::OwnerIsAlreadyInitialized) } self.owner.set(Some(owner)); self.env().emit_event(OwnershipChanged { prev_owner: None, new_owner: owner }); } } #[odra::odra_error] pub enum Error { OwnerIsAlreadyInitialized = 1, } #[odra::event] pub struct OwnershipChanged { pub prev_owner: Option<Address>, pub new_owner: Address } Ok, we have done a couple of things, let's analyze them one by one: L1 - The impl should be an Odra module, so add #[odra::module].L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument. L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None. ","version":"next","tagName":"h3"},{"title":"Features implementation​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#features-implementation","content":"ownable.rs #[odra::module] impl Ownable { ... pub fn ensure_ownership(&self, address: &Address) { if Some(address) != self.owner.get_or_default().as_ref() { self.env().revert(Error::NotOwner) } } pub fn change_ownership(&mut self, new_owner: &Address) { self.ensure_ownership(&self.env().caller()); let current_owner = self.get_owner(); self.owner.set(Some(*new_owner)); self.env().emit_event(OwnershipChanged { prev_owner: Some(current_owner), new_owner: *new_owner }); } pub fn get_owner(&self) -> Address { match self.owner.get_or_default() { Some(owner) => owner, None => self.env().revert(Error::OwnerIsNotInitialized) } } } #[odra::odra_error] pub enum Error { NotOwner = 1, OwnerIsAlreadyInitialized = 2, OwnerIsNotInitialized = 3, } The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along. L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead. ","version":"next","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#test","content":"ownable.rs #[cfg(test)] mod tests { use super::*; use odra::host::{Deployer, HostEnv, HostRef}; fn setup() -> (OwnableHostRef, HostEnv, Address) { let env: HostEnv = odra_test::env(); let init_args = OwnableInitArgs { owner: env.get_account(0) }; (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0)) } #[test] fn initialization_works() { let (ownable, env, owner) = setup(); assert_eq!(ownable.get_owner(), owner); env.emitted_event( &ownable, &OwnershipChanged { prev_owner: None, new_owner: owner } ); } #[test] fn owner_can_change_ownership() { let (mut ownable, env, owner) = setup(); let new_owner = env.get_account(1); env.set_caller(owner); ownable.change_ownership(&new_owner); assert_eq!(ownable.get_owner(), new_owner); env.emitted_event( &ownable, &OwnershipChanged { prev_owner: Some(owner), new_owner } ); } #[test] fn non_owner_cannot_change_ownership() { let (mut ownable, env, _) = setup(); let new_owner = env.get_account(1); ownable.change_ownership(&new_owner); assert_eq!( ownable.try_change_ownership(&new_owner), Err(Error::NotOwner.into()) ); } } L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one). L14 - It is time to define the first test. As you see, it is a regular Rust test.L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract. note You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract. L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract you want to read events from, followed by an event as you expect it to have occurred.L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function. note The caller switch applies only the next contract interaction, the second call will be done as the default account. L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type. ","version":"next","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#summary","content":"The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract. ","version":"next","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Ownable","url":"/docs/next/tutorials/ownable#whats-next","content":"In the next tutorial we will implement a ERC20 standard. ","version":"next","tagName":"h2"},{"title":"Ticketing System","type":0,"sectionRef":"#","url":"/docs/next/tutorials/nft","content":"","keywords":"","version":"next"},{"title":"Ticket Office Contract​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#ticket-office-contract","content":"Our TicketOffice contract will include the following features: Compliance with the CEP-78 standard.Ownership functionality.Only the owner can issue new event tickets.Users can purchase tickets for events.Tickets are limited to a one-time sale.Public access to view the total income of the TicketOffice. ","version":"next","tagName":"h3"},{"title":"Setup the project​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#setup-the-project","content":"Creating a new NFT token with Odra is straightforward. Use the cargo odra new command to create a new project with the CEP-78 template: cargo odra new --name ticket-office --template cep78 ","version":"next","tagName":"h3"},{"title":"Contract implementation​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#contract-implementation","content":"Let's start implementing the TicketOffice contract by modify the code generated from the template. src/token.rs use odra::{ args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert }; use odra_modules::access::Ownable; use odra_modules::cep78::{ modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode}, token::Cep78, }; pub type TicketId = u64; #[odra::odra_type] pub enum TicketStatus { Available, Sold, } #[odra::odra_type] pub struct TicketInfo { event_name: String, price: U512, status: TicketStatus, } #[odra::event] pub struct OnTicketIssue { ticket_id: TicketId, event_name: String, price: U512, } #[odra::event] pub struct OnTicketSell { ticket_id: TicketId, buyer: Address, } #[odra::odra_error] pub enum Error { TicketNotAvailableForSale = 200, InsufficientFunds = 201, InvalidTicketId = 202, TicketDoesNotExist = 203, } #[odra::module( events = [OnTicketIssue, OnTicketSell], errors = Error )] pub struct TicketOffice { token: SubModule<Cep78>, ownable: SubModule<Ownable>, tickets: Mapping<TicketId, TicketInfo>, } #[odra::module] impl TicketOffice { pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) { self.ownable.init(); let receipt_name = format!("cep78_{}", collection_name); self.token.init( collection_name, collection_symbol, total_supply, OwnershipMode::Transferable, NFTKind::Digital, NFTIdentifierMode::Ordinal, NFTMetadataKind::Raw, MetadataMutability::Immutable, receipt_name, // remaining args are optional and can set to Maybe::None ... ); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { let env = self.env(); let caller = env.caller(); self.ownable.assert_owner(&caller); // mint a new token let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None); let ticket_id: u64 = token_id .parse() .map_err(|_| Error::InvalidTicketId) .unwrap_or_revert(&env); // store ticket info self.tickets.set( &ticket_id, TicketInfo { event_name: event_name.clone(), price, status: TicketStatus::Available, }, ); // emit an event env.emit_event(OnTicketIssue { ticket_id, event_name, price, }); } #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let owner = self.ownable.get_owner(); let buyer = env.caller(); let value = env.attached_value(); // only tokens owned by the owner can be sold if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner { env.revert(Error::TicketNotAvailableForSale); } let mut ticket = self .tickets .get(&ticket_id) .unwrap_or_revert_with(&env, Error::TicketDoesNotExist); // only available tickets can be sold if ticket.status != TicketStatus::Available { env.revert(Error::TicketNotAvailableForSale); } // check if the buyer sends enough funds if value < ticket.price { env.revert(Error::InsufficientFunds); } // transfer csprs to the owner env.transfer_tokens(&owner, &value); // transfer the ticket to the buyer self.token .transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer); ticket.status = TicketStatus::Sold; self.tickets.set(&ticket_id, ticket); env.emit_event(OnTicketSell { ticket_id, buyer }); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L10-L44 - We define structures and enums that will be used in our contract. TicketStatus enum represents the status of a ticket, TicketInfo struct contains information about a ticket that is written to the storage, TicketId is a type alias for u64. OnTicketIssue and OnTicketSell are events that will be emitted when a ticket is issued or sold.L46-L49 - Register errors and events that will be used in our contract, required to produce a complete contract schema.L51-L53 - TicketOffice module definition. The module contains a Cep78 token, an Ownable module, and a Mapping that stores information about tickets.L58-L74 - The init function has been generated from the template and there is no need to modify it, except the Ownable module initialization.L76-L94 - The issue_ticket function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an OnTicketIssue event.L103 - The payable attribute indicates that the buy_ticket function can receive funds.L104-L134 - The buy_ticket function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an OnTicketSell event. Lets test the contract. The test scenario will be as follows: Deploy the contract.Issue two tickets.Try to buy a ticket with insufficient funds.Buy tickets.Try to buy the same ticket again.Check the balance of the contract. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef}, }; use crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs}; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let mut contract = TicketOfficeHostRef::deploy(&env, init_args); contract.issue_ticket("Ev".to_string(), U512::from(100)); contract.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(0), Err(Error::InsufficientFunds.into()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(1), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Err(Error::TicketNotAvailableForSale.into()) ); } Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with Cep78Error::InvalidTokenOwner because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of. odra/modules/src/cep78/token78.rs pub fn transfer( &mut self, token_id: Maybe<u64>, token_hash: Maybe<String>, source_key: Address, target_key: Address ) -> TransferReceipt { ... if !is_owner && !is_approved && !is_operator { self.revert(CEP78Error::InvalidTokenOwner); } ... } Let's fix it by redesigning our little system. ","version":"next","tagName":"h3"},{"title":"Redesign​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#redesign","content":"Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary — an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets. The sequence diagram below illustrates the new flow: Ticket Operator Contract​ As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the cargo odra generate command. cargo odra generate -c ticket_operator src/ticket_operator.rs use crate::token::{TicketId, TicketOfficeContractRef}; use odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var}; #[odra::odra_error] pub enum Error { UnknownTicketOffice = 300, } #[odra::module(errors = Error)] pub struct TicketOperator { ticket_office_address: Var<Address>, } #[odra::module] impl TicketOperator { pub fn register(&mut self, ticket_office_address: Address) { self.ticket_office_address.set(ticket_office_address); } // now the operator's `buy_ticket` receives funds. #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let buyer = env.caller(); let value = env.attached_value(); let center = self .ticket_office_address .get() .unwrap_or_revert_with(&env, Error::UnknownTicketOffice); let mut ticket_contract = TicketOfficeContractRef::new(env, center); // now and approved entity - the operator - buys the ticket on behalf of the buyer ticket_contract.buy_ticket(ticket_id, buyer, value); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L4-L7 - Define errors that will be used in the contract.L9-L13 - Define the TicketOperator module that stores the address of the ticketing office.L16-L18 - The register function sets the address of the ticketing office.L20-L32 - The buy_ticket function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a TicketOfficeContractRef to interact we the TicketOffice contract. Note that, the operator's buy_ticket now receives funds. Now we need to adjust the TicketOffice contract to use the TicketOperator contract to buy tickets. src/token.rs use odra::Var; ... #[odra::odra_error] pub enum Error { ... MissingOperator = 204, Unauthorized = 205, } #[odra::module] pub struct TicketOffice { ... operator: Var<Address>, } #[odra::module] impl TicketOffice { ... pub fn register_operator(&mut self, operator: Address) { // only the owner can register an operator let caller = self.env().caller(); self.ownable.assert_owner(&caller); // store the ticketing center address in the operator contract TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address()); self.operator.set(operator); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { // minting logic remains the same... ... // approve the operator to transfer the ticket let operator = self.operator(); self.token .approve(operator, Maybe::Some(ticket_id), Maybe::None); // emit an event ... } pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) { let env = self.env(); let owner = self.ownable.get_owner(); let caller = env.caller(); // make sure the caller is the operator if !self.is_operator(caller) { env.revert(Error::Unauthorized); } ... // the logic remains the same, except for the csprs transfer // it is now handled by the operator contract. // env.transfer_tokens(&owner, &value); } #[inline] fn is_operator(&self, caller: Address) -> bool { Some(caller) == self.operator.get() } #[inline] fn operator(&self) -> Address { self.operator .get() .unwrap_or_revert_with(&self.env(), Error::MissingOperator) } } L15 - the contract stores the operator address.L22-L29 - a new function register_operator allows the owner to register an operator. Also calls the register entry point on the operator contract.L36-38 - modify the issue_ticket function: once a new token is minted, approves the operator to transfer the ticket later.L44-L57 - modify the buy_ticket function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds.We also added two helper functions: is_operator and operator to check if the caller is the operator and get the operator address. Two new errors were added: MissingOperator and Unauthorized. Now we need to update our tests to create a scenario we presented in the sequence diagram. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef, NoArgs}, OdraResult, }; use crate::{ ticket_operator::TicketOperatorHostRef, token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs}, }; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let operator = TicketOperatorHostRef::deploy(&env, NoArgs); let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args); ticket_office.register_operator(operator.address().clone()); ticket_office.issue_ticket("Ev".to_string(), U512::from(100)); ticket_office.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( buy_ticket(&operator, 0, 50), Err(Error::InsufficientFunds.into()) ); assert_eq!(buy_ticket(&operator, 0, 100), Ok(())); assert_eq!(buy_ticket(&operator, 1, 50), Ok(())); assert_eq!( buy_ticket(&operator, 0, 100), Err(Error::TicketNotAvailableForSale.into()) ); assert_eq!(operator.balance_of(), U512::from(150)); } fn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> { operator.with_tokens(U512::from(price)).try_buy_ticket(id) } ","version":"next","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Ticketing System","url":"/docs/next/tutorials/nft#conclusion","content":"In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls. ","version":"next","tagName":"h3"},{"title":"OwnedToken","type":0,"sectionRef":"#","url":"/docs/next/tutorials/owned-token","content":"","keywords":"","version":"next"},{"title":"Code​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#code","content":"What should our module be capable of? Conform the Erc20 interface.Allow only the module owner to mint tokens.Enable the current owner to designate a new owner. ","version":"next","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#module-definition","content":"Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules. owned_token.rs use crate::{erc20::Erc20, ownable::Ownable}; use odra::prelude::*; use odra::module::SubModule; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } As you can see, we do not need any storage definition - we just take advantage of the already-defined modules! ","version":"next","tagName":"h3"},{"title":"Delegation​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#delegation","content":"owned_token.rs ... use odra::{Address, casper_types::U256}; ... #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } pub fn name(&self) -> String { self.erc20.name() } pub fn symbol(&self) -> String { self.erc20.symbol() } pub fn decimals(&self) -> u8 { self.erc20.decimals() } pub fn total_supply(&self) -> U256 { self.erc20.total_supply() } pub fn balance_of(&self, address: &Address) -> U256 { self.erc20.balance_of(address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.erc20.allowance(owner, spender) } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.erc20.transfer(recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { self.erc20.transfer_from(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { self.erc20.approve(spender, amount); } pub fn get_owner(&self) -> Address { self.ownable.get_owner() } pub fn change_ownership(&mut self, new_owner: &Address) { self.ownable.change_ownership(new_owner); } pub fn mint(&mut self, address: &Address, amount: &U256) { self.ownable.ensure_ownership(&self.env().caller()); self.erc20.mint(address, amount); } } Easy. However, there are a few worth mentioning subtleness: L9-L10 - A constructor is an excellent place to initialize both modules at once.L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.L49-L51 - The same is done with the ownable module.L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner. ","version":"next","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"OwnedToken","url":"/docs/next/tutorials/owned-token#summary","content":"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that. ","version":"next","tagName":"h2"},{"title":"Odra framework","type":0,"sectionRef":"#","url":"/docs/","content":"","keywords":"","version":"1.0.0"},{"title":"What's next​","type":1,"pageTitle":"Odra framework","url":"/docs/#whats-next","content":"See the Installation and our Flipper example to find out how to start your new project with Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Pausable","type":0,"sectionRef":"#","url":"/docs/next/tutorials/pauseable","content":"","keywords":"","version":"next"},{"title":"Code​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#code","content":"As always, we will start with defining functionalities of our module. Check the state - is it paused or not.State guards - a contract should stop execution if is in a state we don't expect.Switch the state. ","version":"next","tagName":"h2"},{"title":"Events and Error​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#events-and-error","content":"There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way. Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser. pauseable.rs use odra::prelude::*; use odra::Address; #[odra::odra_error] pub enum Error { PausedRequired = 1_000, UnpausedRequired = 1_001, } #[odra::event] pub struct Paused { pub account: Address } #[odra::event] pub struct Unpaused { pub account: Address } ","version":"next","tagName":"h3"},{"title":"Module definition​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#module-definition","content":"The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused. pauseable.rs use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] pub struct Pausable { is_paused: Var<bool> } ","version":"next","tagName":"h3"},{"title":"Checks and guards​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#checks-and-guards","content":"Now, let's move to state checks and guards. pauseable.rs impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } pub fn require_not_paused(&self) { if self.is_paused() { self.env().revert(Error::UnpausedRequired); } } pub fn require_paused(&self) { if !self.is_paused() { self.env().revert(Error::PausedRequired); } } } L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused. L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused. ","version":"next","tagName":"h3"},{"title":"Actions​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#actions","content":"Finally, we will add the ability to switch the module state. pauseable.rs impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); self.env().emit_event(Paused { account: self.env().caller() }); } pub fn unpause(&mut self) { self.require_paused(); self.is_paused.set(false); self.env().emit_event(Unpaused { account: self.env().caller() }); } } pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused). ","version":"next","tagName":"h3"},{"title":"Pausable counter​","type":1,"pageTitle":"Pausable","url":"/docs/next/tutorials/pauseable#pausable-counter","content":"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused). pauseable.rs ... use odra::SubModule; ... #[odra::module] pub struct PausableCounter { value: Var<u32>, pauseable: SubModule<Pausable> } #[odra::module] impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); let new_value = self.value.get_or_default() + 1; self.value.set(new_value); } pub fn pause(&mut self) { self.pauseable.pause(); } pub fn unpause(&mut self) { self.pauseable.unpause(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } #[cfg(test)] mod test { use super::*; use odra::host::{Deployer, NoArgs}; #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); assert_eq!( contract.try_increment().unwrap_err(), Error::UnpausedRequired.into() ); assert_eq!(contract.get_value(), 1); } } As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy! ","version":"next","tagName":"h2"},{"title":"Advanced Storage Concepts","type":0,"sectionRef":"#","url":"/docs/advanced/advanced-storage","content":"","keywords":"","version":"1.0.0"},{"title":"Recap and Basic Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#recap-and-basic-concepts","content":"Before we delve into the advanced features, let's recap some basic storage concepts in Odra. In the realm of basic storage interaction, Odra provides several types for interacting with contract storage, including Var, Mapping, and List. These types enable contracts to store and retrieve data in a structured manner. The Var type is used to store a single value, while the List and Mapping types store collections of values. Var: A Var in Odra is a fundamental building block used for storing single values. Each Var is uniquely identified by its name in the contract. Mapping: Mapping in Odra serves as a key-value storage system. It stores an association of unique keys to values, and the value can be retrieved using the key. List: Built on top of the Var and Mapping building blocks, List in Odra allows storing an ordered collection of values that can be iterated over. If you need a refresher on these topics, please refer to our guide on basic storage in Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Advanced Storage Concepts​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#advanced-storage-concepts-1","content":"","version":"1.0.0","tagName":"h2"},{"title":"Sequence​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#sequence","content":"The Sequence in Odra is a basic module that stores a single value in the storage that can be read or incremented. Internally, holds a Var which keeps track of the current value. pub struct Sequence<T> where T: Num + One + ToBytes + FromBytes + CLTyped { value: Var<T> } The Sequence module provides functions get_current_value and next_value to get the current value and increment the value respectively. ","version":"1.0.0","tagName":"h3"},{"title":"Advanced Mapping​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#advanced-mapping","content":"In Odra, a Mapping is a key-value storage system where the key is associated with a value. In previous examples, the value of the Mapping typically comprised a standard serializable type (such as number, string, or bool) or a custom type marked with the #[odra::odra_type] attribute. However, there are more advanced scenarios where the value of the Mapping represents a module itself. This approach is beneficial when managing a collection of modules, each maintaining its unique state. Let's consider the following example: examples/src/features/storage/mapping.rs use odra::{casper_types::U256, Mapping, UnwrapOrRevert}; use odra::prelude::*; use crate::owned_token::OwnedToken; #[odra::module] pub struct Mappings { strings: Mapping<(String, u32, String), String>, tokens: Mapping<String, OwnedToken> } #[odra::module] impl Mappings { ... pub fn total_supply(&mut self, token_name: String) -> U256 { self.tokens.module(&token_name).total_supply() } pub fn get_string_api( &self, key1: String, key2: u32, key3: String ) -> String { let opt_string = self.strings.get(&(key1, key2, key3)); opt_string.unwrap_or_revert(&self.env()) } } As you can see, a Mapping key can consist of a tuple of values, not limited to a single value. note Accessing Odra modules differs from accessing regular values such as strings or numbers. Firstly, within a Mapping, you don't encapsulate the module with Submodule. Secondly, rather than utilizing the Mapping::get() function, call Mapping::module(), which returns SubModule<T> and sets the appropriate namespace for nested modules. ","version":"1.0.0","tagName":"h3"},{"title":"AdvancedStorage Contract​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#advancedstorage-contract","content":"The given code snippet showcases the AdvancedStorage contract that incorporates these storage concepts. use odra::{Address, casper_types::U512, Sequence, Mapping}; use odra::prelude::*; use crate::modules::Token; #[odra::module] pub struct AdvancedStorage { counter: Sequence<u32>, tokens: Mapping<(String, String), Token>, } impl AdvancedStorage { pub fn current_value(&self) -> u32 { self.counter.get_current_value() } pub fn increment_and_get(&mut self) -> u32 { self.counter.next_value() } pub fn balance_of(&mut self, token_name: String, creator: String, address: Address) -> U512 { let token = self.tokens.module(&(token_name, creator)); token.balance_of(&address) } pub fn mint(&self, token_name: String, creator: String, amount: U512, to: Address) { let mut token = self.tokens.module(&(token_name, creator)); token.mint(amount, to); } } ","version":"1.0.0","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Advanced Storage Concepts","url":"/docs/advanced/advanced-storage#conclusion","content":"Advanced storage features in Odra offer robust options for managing contract state. Two key takeaways from this document are: Odra offers a Sequence module, enabling contracts to store and increment a single value.Mappings support composite keys expressed as tuples and can store modules as values. Understanding these concepts can help developers design and implement more efficient and flexible smart contracts. ","version":"1.0.0","tagName":"h2"},{"title":"Building contracts manually","type":0,"sectionRef":"#","url":"/docs/advanced/building-manually","content":"","keywords":"","version":"1.0.0"},{"title":"Building the contract manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#building-the-contract-manually","content":"To build the contract manually, cargo odra uses the following command: ODRA_MODULE=my_contract cargo build --release --target wasm32-unknown-unknown --bin my_project_build_contract info Odra uses the environment variable ODRA_MODULE to determine which contract to build. Assuming that project's crate is named my_project, this command will build the my_contract contract in release mode and generate the wasm file. The file will be put into the target/wasm32-unknown-unknown/release directory under the name my_project_build_contract.wasm. The Odra Framework expects the contracts to be placed in the wasm directory, and to be named correctly, so the next step would be to move the file: mv target/wasm32-unknown-unknown/release/my_project_build_contract.wasm wasm/my_contract.wasm ","version":"1.0.0","tagName":"h2"},{"title":"Optimizing the contract​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#optimizing-the-contract","content":"To lower the size of the wasm file, cargo odra uses the wasm-strip tool: wasm-strip wasm/my_contract.wasm To further optimize the wasm file, the wasm-opt tool is also used. wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm danger This step is required, as the wasm file generated by the Rust compiler is not fully compatible with the Casper execution engine. ","version":"1.0.0","tagName":"h2"},{"title":"Running the tests manually​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#running-the-tests-manually","content":"To run the tests manually, Odra needs to know which backend to use. To run tests against Casper backend, the following command needs to be used: ODRA_BACKEND=casper cargo test ","version":"1.0.0","tagName":"h2"},{"title":"Wrapping up​","type":1,"pageTitle":"Building contracts manually","url":"/docs/advanced/building-manually#wrapping-up","content":"Let's say we want to build the my_contract in debug mode, run the tests against the casper backend and use the my-own-allocator feature from our my_project project. To do that, we can use the following set of commands: ODRA_MODULE=my_contract cargo build --target wasm32-unknown-unknown --bin my_project_build_contract mv target/wasm32-unknown-unknown/debug/my_project_build_contract.wasm wasm/my_contract.wasm wasm-strip wasm/my_contract.wasm wasm-opt --signext-lowering wasm/my_contract.wasm -o wasm/my_contract.wasm ODRA_BACKEND=casper cargo test --features my-own-allocator ","version":"1.0.0","tagName":"h2"},{"title":"Attributes","type":0,"sectionRef":"#","url":"/docs/advanced/attributes","content":"","keywords":"","version":"1.0.0"},{"title":"Payable​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#payable","content":"When writing a smart contract, you need to make sure that money can be both sent to and extracted from the contract. The 'payable' attribute helps wit this. Any function, except for a constructor, with the #[odra(payable)] attribute can send and take money in the form of native tokens. ","version":"1.0.0","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#example","content":"examples/src/contracts/tlw.rs #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U256 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env.revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env() .emit_event(Deposit { address: caller, amount }); } If you try to send tokens to a non-payable function, the transaction will be automatically rejected. ","version":"1.0.0","tagName":"h3"},{"title":"Non Reentrant​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#non-reentrant","content":"Reentrancy attacks in smart contracts exploit the possibility of a function being called multiple times before its initial execution is completed, leading to the repeated unauthorized withdrawal of funds. To prevent such attacks, developers should ensure that all effects on the contract's state and balance checks occur before calling external contracts. They can also use reentrancy guards to block recursive calls to sensitive functions. In Odra you can just apply the #[odra(non_reentrant)] attribute to your function. ","version":"1.0.0","tagName":"h2"},{"title":"Example​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#example-1","content":"#[odra::module] pub struct NonReentrantCounter { counter: Var<u32> } #[odra::module] impl NonReentrantCounter { #[odra(non_reentrant)] pub fn count_ref_recursive(&mut self, n: u32) { if n > 0 { self.count(); ReentrancyMockRef::new(self.env(), self.env().self_address()).count_ref_recursive(n - 1); } } } impl NonReentrantCounter { fn count(&mut self) { let c = self.counter.get_or_default(); self.counter.set(c + 1); } } #[cfg(test)] mod test { use super::*; use odra::{host::{Deployer, NoArgs}, ExecutionError}; #[test] fn ref_recursion_not_allowed() { let test_env = odra_test::env(); let mut contract = NonReentrantCounterHostRef::deploy(&test_env, NoArgs); let result = contract.count_ref_recursive(11); assert_eq!(result, ExecutionError::ReentrantCall.into()); } } ","version":"1.0.0","tagName":"h3"},{"title":"Mixing attributes​","type":1,"pageTitle":"Attributes","url":"/docs/advanced/attributes#mixing-attributes","content":"A function can accept more than one attribute. The only exclusion is a constructor cannot be payable. To apply multiple attributes, you can write: #[odra(payable, non_reentrant)] fn deposit() { // your logic... } or #[odra(payable)] #[odra(non_reentrant)] fn deposit() { // your logic... } In both cases attributes order does not matter. ","version":"1.0.0","tagName":"h2"},{"title":"Using Proxy Caller","type":0,"sectionRef":"#","url":"/docs/next/tutorials/using-proxy-caller","content":"","keywords":"","version":"next"},{"title":"Contract​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/next/tutorials/using-proxy-caller#contract","content":"For this tutorial, we will use the TimeLockWallet contract from our examples. examples/src/contracts/tlw.rs use odra::prelude::*; use odra::{casper_types::U512, Address, Mapping, Var}; #[odra::module(errors = Error, events = [Deposit, Withdrawal])] pub struct TimeLockWallet { balances: Mapping<Address, U512>, lock_expiration_map: Mapping<Address, u64>, lock_duration: Var<u64> } #[odra::module] impl TimeLockWallet { /// Initializes the contract with the lock duration. pub fn init(&mut self, lock_duration: u64) { self.lock_duration.set(lock_duration); } /// Deposits the tokens into the contract. #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U512 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env().revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env().emit_event(Deposit { address: caller, amount }); } /// Withdraws the tokens from the contract. pub fn withdraw(&mut self, amount: &U512) { // code omitted for brevity } /// Returns the balance of the given account. pub fn get_balance(&self, address: &Address) -> U512 { // code omitted for brevity } /// Returns the lock duration. pub fn lock_duration(&self) -> u64 { // code omitted for brevity } } /// Errors that may occur during the contract execution. #[odra::odra_error] pub enum Error { LockIsNotOver = 1, CannotLockTwice = 2, InsufficientBalance = 3 } /// Deposit event. #[odra::event] pub struct Deposit { pub address: Address, pub amount: U512 } /// Withdrawal event. #[odra::event] pub struct Withdrawal { pub address: Address, pub amount: U512 } Full code can be found here. ","version":"next","tagName":"h2"},{"title":"Client​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/next/tutorials/using-proxy-caller#client","content":"Before we can interact with the node, we need to set it up. We will use the casper-nctl-docker image. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Make sure you have the contract's wasm file and the secret key. # Build the contract cargo odra build -c TimeLockWallet # Extract secret key docker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem RustTypeScript To interact with the contract, we use the livenet backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case). Cargo.toml [package] name = "odra-examples" version = "1.1.0" edition = "2021" [dependencies] odra = { path = "../odra", default-features = false } ... # other dependencies odra-casper-livenet-env = { version = "1.1.0", optional = true } ... # other sections [features] default = [] livenet = ["odra-casper-livenet-env"] ... # other sections [[bin]] name = "tlw_on_livenet" path = "bin/tlw_on_livenet.rs" required-features = ["livenet"] test = false ... # other sections examples/bin/tlw_on_livenet.rs //! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs. use odra::casper_types::{AsymmetricType, PublicKey, U512}; use odra::host::{Deployer, HostRef}; use odra::Address; use odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs}; const DEPOSIT: u64 = 100; const WITHDRAWAL: u64 = 99; const GAS: u64 = 20u64.pow(9); fn main() { let env = odra_casper_livenet_env::env(); let caller = env.get_account(0); env.set_caller(caller); env.set_gas(GAS); let mut contract = TimeLockWalletHostRef::deploy( &env, TimeLockWalletInitArgs { lock_duration: 60 * 60 } ); // Send 100 CSPRs to the contract. contract .with_tokens(U512::from(DEPOSIT)) .deposit(); println!("Caller's balance: {:?}", contract.get_balance(&caller)); // Withdraw 99 CSPRs from the contract. contract.withdraw(&U512::from(WITHDRAWAL)); println!("Remaining balance: {:?}", contract.get_balance(&caller)); } To run the code, execute the following command: ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \\ ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \\ ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \\ cargo run --bin tlw_on_livenet --features=livenet # Sample output 💁 INFO : Deploying "TimeLockWallet". 💁 INFO : Found wasm under "wasm/TimeLockWallet.wasm". 🙄 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558". 💁 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed. 💁 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed. 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy. 🙄 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3". 💁 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed. Caller's balance: 100 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw". 🙄 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e". 💁 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed. Remaining balance: 1 As observed, the contract was successfully deployed, and the Caller deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR. The logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity. ","version":"next","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/next/tutorials/using-proxy-caller#conclusion","content":"In this tutorial, we learned how to use the proxy_caller wasm to make a payable function call. We deployed the TimeLockWallet contract, deposited tokens using the proxy_caller with attached CSPRs, and withdrew them. You got to try it out in both Rust and TypeScript, so you can choose whichever you prefer. Rust code seemed simpler, thanks to the Odra livenet backend making chain interactions easier to handle. ","version":"next","tagName":"h2"},{"title":"Delegate","type":0,"sectionRef":"#","url":"/docs/advanced/delegate","content":"","keywords":"","version":"1.0.0"},{"title":"Overview​","type":1,"pageTitle":"Delegate","url":"/docs/advanced/delegate#overview","content":"To utilize the delegate feature in your contract, use the delegate! macro provided by Odra. This macro allows you to list the functions you wish to delegate to the child modules. By using the delegate! macro, your parent module remains clean and easy to understand. You can delegate functions to as many child modules as you like. The functions will be available as if they were implemented in the parent module itself. ","version":"1.0.0","tagName":"h2"},{"title":"Code Examples​","type":1,"pageTitle":"Delegate","url":"/docs/advanced/delegate#code-examples","content":"Consider the following basic example for better understanding: use crate::{erc20::Erc20, ownable::Ownable}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn transfer_from(&mut self, owner: Address, recipient: Address, amount: U256); fn approve(&mut self, spender: Address, amount: U256); fn name(&self) -> String; fn symbol(&self) -> String; fn decimals(&self) -> u8; fn total_supply(&self) -> U256; fn balance_of(&self, owner: Address) -> U256; fn allowance(&self, owner: Address, spender: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; fn change_ownership(&mut self, new_owner: Address); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } This OwnedToken contract includes two modules: Erc20 and Ownable. We delegate various functions from both modules using the delegate! macro. As a result, the contract retains its succinctness without compromising on functionality. The above example basically merges the functionalities of modules and adds some control over the minting process. But you can use delegation to build more complex contracts, cherry-picking just a few module functionalities. Let's take a look at another example. use crate::{erc20::Erc20, ownable::Ownable, exchange::Exchange}; use odra::{ Address, casper_types::U256, module::SubModule, prelude::* }; #[odra::module] pub struct DeFiPlatform { ownable: SubModule<Ownable>, erc20: SubModule<Erc20>, exchange: SubModule<Exchange> } #[odra::module] impl DeFiPlatform { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256, exchange_rate: u64) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); self.exchange.init(exchange_rate); } delegate! { to self.erc20 { fn transfer(&mut self, recipient: Address, amount: U256); fn balance_of(&self, owner: Address) -> U256; } to self.ownable { fn get_owner(&self) -> Address; } to self.exchange { fn swap(&mut self, sender: Address, recipient: Address); fn set_exchange_rate(&mut self, new_rate: u64); } } pub fn mint(&mut self, address: Address, amount: U256) { self.ownable.ensure_ownership(self.env().caller()); self.erc20.mint(address, amount); } } In this DeFiPlatform contract, we include Erc20, Ownable, and Exchange modules. By delegating functions from these modules, the parent contract becomes a powerhouse of functionality while retaining its readability and structure. Remember, the possibilities are endless with Odra's. By leveraging this feature, you can write cleaner, more efficient, and modular smart contracts. ","version":"1.0.0","tagName":"h2"},{"title":"Storage Layout","type":0,"sectionRef":"#","url":"/docs/advanced/storage-layout","content":"","keywords":"","version":"1.0.0"},{"title":"Casper VM Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#casper-vm-perspective","content":"The Casper Execution Engine (VM) enables the storage of data in named keys or dictionaries. However, a smart contract has a limited number of named keys, making it unsuitable for storing substantial data volumes. Odra resolves this issue by storing all user-generated data in a dictionary called state. This dictionary operates as a key-value store, where keys are strings with a maximum length of 64 characters, and values are arbitrary byte arrays. Here is an example of what the interface for reading and writing data could look like: pub trait CasperStorage { fn read(key: &str) -> Option<Vec<u8>>; fn write(key: &str, value: Vec<u8>); } ","version":"1.0.0","tagName":"h2"},{"title":"Odra Perspective​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#odra-perspective","content":"Odra was conceived with modularity and code reusability in mind. Additionally, we aimed to streamline storage definition through the struct object. Consider this straightforward storage definition: #[odra::module] pub struct Token { name: Var<String>, balances: Mapping<Address, U256> } The Token structure contains two fields: name of type String andbalances, which functions as a key-value store with Address as keys andU256 as values. The Token module can be reused in another module, as demonstrated in a more complex example: #[odra::module] pub struct Loans { lenders: SubModule<Token>, borrowers: SubModule<Token>, } The Loans module has two fields: lenders and borrowers, both of which have the same storage layout as defined by the Token module. Odra guarantees thatlenders and borrowers are stored under distinct keys within the storage dictionary. Both Token and Loans serve as examples to show how Odra's storage layout operates. ","version":"1.0.0","tagName":"h2"},{"title":"Key generation.​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#key-generation","content":"Every element of a module (struct) with N elements is associated with an index ranging from 0 to N-1, represented as a u8 with a maximum of 256 elements. If an element of a module is another module (SubModule<...>), the associated index serves as a prefix for the indexes of the inner module. While this may initially appear complex, it is easily understood through an example. In the example, indexes are presented as bytes, reflecting the actual implementation. Loans { lenders: Token { // prefix: 0x0001 name: 1, // key: 0x0001_0001 balances: 2 // key: 0x0001_0010 }, borrowers: Token { // prefix: 0x0010 name: 1, // key: 0x0010_0001 balances: 2 // key: 0x0010_0010 } } Additionally, it's worth mentioning how Mapping's keys are used in thestorage. They are simply concatenated with the index of the module, as demonstrated in the example. For instance, triggering borrowers.balances.get(0x1234abcd) would result in a key: 0x0001_0001_1234_abcd Finally, the key must be hashed to fit within the 64-character limit and then encoded in hexadecimal format. ","version":"1.0.0","tagName":"h2"},{"title":"Value serialization​","type":1,"pageTitle":"Storage Layout","url":"/docs/advanced/storage-layout#value-serialization","content":"Before being stored in the storage, each value is serialized into bytes using the CLType serialization method and subsequently encapsulated with Casper'sBytes types. ","version":"1.0.0","tagName":"h2"},{"title":"Memory allocators","type":0,"sectionRef":"#","url":"/docs/advanced/using-different-allocator","content":"","keywords":"","version":"1.0.0"},{"title":"Using a different allocator​","type":1,"pageTitle":"Memory allocators","url":"/docs/advanced/using-different-allocator#using-a-different-allocator","content":"If the default allocator does not suit your needs, or you use a crate that already provides an allocator, you can disable the default allocator by enabling the disable-allocator feature in the odra dependency in your project: [dependencies] odra = { path = "../odra", features = ["disable-allocator"] } If you want to have a better control over the features that are enabled during the building and tests, see the next article on building manually. ","version":"1.0.0","tagName":"h2"},{"title":"OdraVM","type":0,"sectionRef":"#","url":"/docs/backends/odra-vm","content":"","keywords":"","version":"1.0.0"},{"title":"Usage​","type":1,"pageTitle":"OdraVM","url":"/docs/backends/odra-vm#usage","content":"The OdraVM is the default backend for Odra framework, so each time you run cargo odra test You are running your code against it. ","version":"1.0.0","tagName":"h2"},{"title":"Architecture​","type":1,"pageTitle":"OdraVM","url":"/docs/backends/odra-vm#architecture","content":"OdraVM consists of two main parts: the Contract Register and the State. The Contract Register is a list of contracts deployed onto the OdraVM, identified by an Address. Contracts and Test Env functions can modify the State of the OdraVM. Contrary to the "real" backend, which holds the whole history of the blockchain, the OdraVM State holds only the current state of the OdraVM. Thanks to this and the fact that we do not need the blockchain itself, OdraVM starts instantly and runs the tests in the native speed. ","version":"1.0.0","tagName":"h2"},{"title":"Execution​","type":1,"pageTitle":"OdraVM","url":"/docs/backends/odra-vm#execution","content":"When the OdraVM backend is enabled, the #[odra::module] attribute is responsible for converting your pub functions into a list of Entrypoints, which are put into a Contract Container. When the contract is deployed, its Container registered into a Registry under an address. During the contract call, OdraVM finds an Entrypoint and executes the code. ","version":"1.0.0","tagName":"h2"},{"title":"Casper","type":0,"sectionRef":"#","url":"/docs/backends/casper","content":"","keywords":"","version":"1.0.0"},{"title":"Contract Env​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#contract-env","content":"As with any other backend, Casper Backend must implement the same features, but some do not have native support. Let's take a closer look at how Odra overcomes these hindrances. ","version":"1.0.0","tagName":"h2"},{"title":"Events​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#events","content":"An event is not a first-class citizen in Casper like in Ethereum, so Odra mimics it. As you've already learned from the events article, in Odra you emit an event, similarly, you would do it in Solidity. Under the hood, Odra integrates with Casper Event Standard and creates a few URefs in the global state when a contract is being installed: __events - a dictionary that stores events' data.__events_length - the evens count.__events_ces_version - the version of Casper Event Standard. __events_schema - a dictionary that stores event schemas. Besides that, all the events the contract emits are registered - events schemas are written to the storage under the __events_schema key. So, Events are nothing different from any other data stored by a contract. A struct to be an event must implement traits defined by Casper Event Standard, thankfully you can derive them using #[odra::event]. note Don't forget to expose events in the module using #[odra::module(events = [...])]. ","version":"1.0.0","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#payable","content":"The first Odra idiom is a Contract Main Purse. It is a purse associated with a contract. The purse is created lazily - when the first transfer to the contract occurs, a proper URef and a purse are created and stored under the __contract_main_purse key. Casper does not allow direct transfers from an account to a contract, so Odra comes up with the second idiom - a Cargo Purse. It is a one-time-use purse proxy between an account and a contract. First, motes go from the account to the cargo purse and then to the contract's main purse. Behind the scenes, Odra handles an account-contract transfer via a cargo purse when a function is marked as payable. If under the way something goes wrong with the transfer, the contract reverts. The transferred amount can be read inside the contract by calling self.env().attached_value(). note Odra expects the cargo_purse runtime argument to be attached to a contract call. In case of its absence, the contract_env::attached_value() returns zero. ","version":"1.0.0","tagName":"h3"},{"title":"Revert​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#revert","content":"In Casper, we can stop the execution pretty straightforwardly - call the runtime::revert(). Odra adds an extra abstraction layer - in a contract ExecutionErrors are defined, which ultimately are transformed into Casper's ApiError::User. ","version":"1.0.0","tagName":"h3"},{"title":"Context​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#context","content":"Casper equips developers with very low-level tooling, which can be cumbersome for newcomers. If you want to check who called the contract or its address, you can not do it off-hand - you must analyze the call stack. The self.env().self_address() function takes the first element of the callstack (runtime::get_call_stack()) and casts it to Address. The self.env().caller() function takes the second element of the call stack (runtime::get_call_stack()) and casts it to Address. As mentioned in the [Payable] section, to store CSPR, each contract creates its purse. To read the contract balance, you call self.env().self_balance(), which checks the balance of the purse stored under __contract_main_purse. ","version":"1.0.0","tagName":"h3"},{"title":"Test Env​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#test-env","content":"Test environment allows you to test wasm contracts before you deploy them onto the testnet or livenet. It is built on top of the Casper Execution Engine. In your test, you can freely switch execution context by setting as a caller (test_env::set_caller()) one of the 20 predefined accounts. Each account possesses the default amount of Motes (100_000_000_000_000_000). The Test Env internally keeps track of the current block time, error and attached value. Each test is executed on a fresh instance of the Test Env. ","version":"1.0.0","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#usage","content":"Name of the Casper backend in Odra is casper, so to run the tests against it, simply pass it as a -bparameter: cargo odra test -b casper If you want to just generate a wasm file, simply run: cargo odra build -b casper ","version":"1.0.0","tagName":"h2"},{"title":"Deploying a contract to Casper network​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#deploying-a-contract-to-casper-network","content":"There would be no point in writing a contract if you couldn't deploy it to the blockchain. You can do it in two ways: provided by the Casper itself: using the casper-client tool or using the Odra's Livenet integration. Let's explore the first option to better understand the process. note If you wish, you can skip the following section and jump to the Livenet integration. ","version":"1.0.0","tagName":"h2"},{"title":"WASM arguments​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#wasm-arguments","content":"When deploying a new contract you can pass some arguments to it. Every contract written in Odra expects those arguments to be set: odra_cfg_package_hash_key_name - String type. The key under which the package hash of the contract will be stored.odra_cfg_allow_key_override - Bool type. If true and the key specified in odra_cfg_package_hash_key_name already exists, it will be overwritten.odra_cfg_is_upgradable - Bool type. If true, the contract will be deployed as upgradable. Additionally, if required by the contract, you can pass constructor arguments. When working with the test env via cargo odra or when usingLivenet integration this is handled automatically. However, if you rather usecasper-client directly, you have to pass them manually: ","version":"1.0.0","tagName":"h3"},{"title":"Example: Deploy Counter​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#example-deploy-counter","content":"To deploy your contract with a constructor using casper-client, you need to pass the above arguments. Additionally, you need to pass the value argument, which sets the arbitrary initial value for the counter. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 5000000000000 \\ --session-path ./wasm/counter.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'counter_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "value:u32:42" For a more in-depth tutorial, please refer to the Casper's 'Writing On-Chain Code'. ","version":"1.0.0","tagName":"h3"},{"title":"Example: Deploy ERC721​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#example-deploy-erc721","content":"Odra comes with a standard ERC721 token implementation. Clone the main Odra repo and navigate to the modules directory. Firstly contract needs to be compiled. cargo odra build -b casper -c erc721_token It produces the erc721_token.wasm file in the wasm directory. Now it's time to deploy the contract. casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc721_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_nft'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string:'MyNFT'" \\ --session-arg "symbol:string:'NFT'" \\ --session-arg "base_uri:string:'https://example.com/'" It's done. The contract is deployed and ready to use. Your account is the owner of the contract and you can mint and burn tokens. For more details see the code of the ERC721 module. To obtain the package hash of the contract search for my_nft key in your account's named keys. ","version":"1.0.0","tagName":"h3"},{"title":"Example: Deploy ERC1155​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#example-deploy-erc1155","content":"The process is similar to the one described in the previous section. Contract compilation: cargo odra build -b casper -c erc1155_token Contract deployment: casper-client put-deploy \\ --node-address [NODE_ADDRESS] \\ --chain-name casper-test \\ --secret-key [PATH_TO_YOUR_KEY]/secret_key.pem \\ --payment-amount 300000000000 \\ --session-path ./wasm/erc1155_token.wasm \\ --session-arg "odra_cfg_package_hash_key_name:string:'my_tokens'" \\ --session-arg "odra_cfg_allow_key_override:bool:'false'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "odra_cfg_constructor:string:'init'" \\ As previously, your account is the owner and can mint and burn tokens. For more details see the code of the ERC1155 module. ","version":"1.0.0","tagName":"h3"},{"title":"Sending CSPR to a contract​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#sending-cspr-to-a-contract","content":"Defining payable entry points is described in Native Token section. What is happening under the hood is that Odra creates a new cargo_purse argument for each payable entry point. The cargo_purse needs to be top-upped with CSPR before calling the contract. When a contract adds CSPR to another contract call, Odra handles it for you. The problem arises when you want to call an entry point and attach CSPR as an account. The only way of doing that is by executing code in the sessions context, that top-ups the cargo_purse and then calls the contract. Odra provides a generic proxy_caller.wasm that does exactly that. You can build it by yourself from the main Odra repository, or use the proxy_caller.wasmwe maintain. ","version":"1.0.0","tagName":"h2"},{"title":"Using proxy_caller.wasm​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#using-proxy_callerwasm","content":"To use the proxy_caller.wasm you need to attach the following arguments: contract_package_hash - BytesArray(32) type. The package hash of the contract you want to call. Result of to_bytes on CasperPackageHash.entry_point - String type. The name of the entry point you want to call.args - Bytes type. It is a serialized RuntimeArgs with the arguments you want to pass to the entry point. To be specific it is the result of to_bytes method wrapped with Bytes type.attached_value. U512 type. The amount of CSPR you want to attach to the call.amount. U512 type. Should be the same value as attached_value if not None. It is a special Casper argument that enables the access to account's main purse. Currently casper-client doesn't allow building such arguments. You have to build it using your SDK. See an example in the Tutorial section. ","version":"1.0.0","tagName":"h3"},{"title":"Execution​","type":1,"pageTitle":"Casper","url":"/docs/backends/casper#execution","content":"First thing Odra does with your code, is similar to the one used in OdraVM - a list of entrypoints is generated, thanks to the #[odra::module] attribute. ","version":"1.0.0","tagName":"h2"},{"title":"What is a backend?","type":0,"sectionRef":"#","url":"/docs/backends/what-is-a-backend","content":"","keywords":"","version":"1.0.0"},{"title":"Contract Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/backends/what-is-a-backend#contract-env","content":"The Contract Env is a simple interface that each backend needs to implement, exposing features of the blockchain from the perspective of the contract. It gives Odra a set of functions, which allows implementing more complex concepts - for example, to implement Mapping, Odra requires some kind of storage integration. The exact implementation of those functions is a responsibility of a backend, making Odra and its user free to implement the contract logic, instead of messing with the blockchain internals. Other functions from Contract Env include handling transfers, addresses, block time, errors and events. ","version":"1.0.0","tagName":"h2"},{"title":"Host Env​","type":1,"pageTitle":"What is a backend?","url":"/docs/backends/what-is-a-backend#host-env","content":"Similarly to the Contract Env, the Host Env exposes a set of functions that allows the communication with the backend from the outside world - really useful for implementing tests. This ranges from interacting with the blockchain - like deploying new, loading existing and calling the contracts, to the more test-oriented - handling errors, forwarding the block time, etc. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"What is a backend?","url":"/docs/backends/what-is-a-backend#whats-next","content":"We will take a look at backends Odra implements in more detail. ","version":"1.0.0","tagName":"h2"},{"title":"Livenet","type":0,"sectionRef":"#","url":"/docs/backends/livenet","content":"","keywords":"","version":"1.0.0"},{"title":"Setup​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#setup","content":"To use Livenet backend, we need to provide Odra with some information - the network address, our private key and the name of the chain we want to use. Optionally, we can add multiple private keys to use more than one account in our tests. Those values are passed using environment variables. We can use .env file to store them - let's take a look at an example .env file, created from the .env.sample file from examples folder: # Path to the secret key of the account that will be used # to deploy the contracts. # We're using .keys folder so we don't accidentally commit # the secret key to the repository. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.keys/secret_key.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=localhost:7777 # Chain name of the network. Known values: # - integration-test ODRA_CASPER_LIVENET_CHAIN_NAME=integration-test # Paths to the secret keys of the additional accounts. # Main secret key will be 0th account. ODRA_CASPER_LIVENET_KEY_1=.keys/secret_key_1.pem ODRA_CASPER_LIVENET_KEY_2=.keys/secret_key_2.pem With the proper value in place, we can write our tests or deploy scenarios. In the examples, we can find a simple binary that deploys a contract and calls it. The test is located in the erc20_on_livenet.rs file. Let's go through the code: fn main() { // Similar to the OdraVM backend, we need to initialize // the environment: let env = odra_casper_livenet_env::env(); // Most of the for the host env works the same as in the // OdraVM backend. let owner = env.caller(); // Addresses are the real addresses on the blockchain, // so we need to provide them // if we did not import their secret keys. let recipient = "hash-2c4a6ce0da5d175e9638ec0830e01dd6cf5f4b1fbb0724f7d2d9de12b1e0f840"; let recipient = Address::from_str(recipient).unwrap(); // Arguments for the contract init method. let name = String::from("Plascoin"); let symbol = String::from("PLS"); let decimals = 10u8; let initial_supply: U256 = U256::from(10_000); // The main difference between other backends - we need to specify // the gas limit for each action. // The limit will be used for every consecutive action // until we change it. env.set_gas(100_000_000_000u64); // Deploy the contract. The API is the same as in the OdraVM backend. let init_args = Erc20InitArgs { name, symbol, decimals, initial_supply: Some(initial_supply) }; let mut token = Erc20HostRef::deploy(env, init_args); // We can now use the contract as we would in the OdraVM backend. println!("Token address: {}", token.address().to_string()); // Uncomment to load existing contract. // let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; // let address = Address::from_str(address).unwrap(); // We use the Livenet-specific `load` method to load the contract // that is already deployed. // let mut token = Erc20Deployer::load(env, address); // Non-mutable calls are free! Neat, huh? More on that later. println!("Token name: {}", token.name()); // The next call is mutable, but the cost is lower that the deployment, // so we change the amount of gas env.set_gas(3_000_000_000u64); token.transfer(recipient, U256::from(1000)); println!("Owner's balance: {:?}", token.balance_of(owner)); println!("Recipient's balance: {:?}", token.balance_of(recipient)); } note The above example is a rust binary, not a test. Note that it is also added as a section of theCargo.toml file: [bin] name = "erc20_on_livenet" path = "src/bin/erc20_on_livenet.rs" required-features = ["livenet"] test = false ","version":"1.0.0","tagName":"h2"},{"title":"Usage​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#usage","content":"To run the above code, we simply need to run the binary with the livenet feature enabled: cargo run --bin erc20_on_livenet --features=livenet note Before executing the binary, make sure you built a wasm file. A part of a sample output should look like this: ... 💁 INFO : Calling "hash-d26fcbd210..." with entrypoint "transfer". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 🙄 WAIT : Waiting 15s for "65b1a5d21...". 💁 INFO : Deploy "65b1a5d21..." successfully executed. Owner's balance: 4004 Recipient's balance: 4000 Those logs are a result of the last 4 lines of the above listing. Each deployment or a call to the blockchain will be noted and will take some time to execute. We can see that the transfer call took over 15 seconds to execute. But calling balance_of was nearly instant and cost us nothing. How it is possible? info You can see the deployment on http://cspr.live/ - the transfer from the example can be seen here. ","version":"1.0.0","tagName":"h2"},{"title":"How Livenet backend works​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#how-livenet-backend-works","content":"All calls of entrypoints executed on a Casper blockchain cost gas - even if they do not change the state. It is possible however to query the state of the blockchain for free. This principle is used in the Livenet backend - all calls that do not change the state of the blockchain are really executed offline - the only thing that is requested from the node is the current state. This is why the balance_of call was almost instant and free. Basically, if the entrypoint function is not mutable or does not make a call to an unknown external contract (see Cross Calls), it is executed offline and node is used for the state query only. However, the Livenet needs to know the connection between the contracts and the code, so make sure to deploy or load already deployed contracts ","version":"1.0.0","tagName":"h2"},{"title":"Multiple environments​","type":1,"pageTitle":"Livenet","url":"/docs/backends/livenet#multiple-environments","content":"It is possible to have multiple environments for the Livenet backend. This is useful if we want to easily switch between multiple accounts, multiple nodes or even multiple chains. To do this, simply create a new .env file with a different prefix - for example, integration.env and mainnet.env. Then, pass the ODRA_CASPER_LIVENET_ENV variable with value either integration or mainnet to select which file has to be used first. If your integration.env file has a value that IS present in the .env file, it will override the value from the .env file. ODRA_CASPER_LIVENET_ENV=integration cargo run --bin erc20_on_livenet --features=livenet To sum up - this command will firstly load the integration.env file and then load the missing values from .env file. ","version":"1.0.0","tagName":"h2"},{"title":"Cargo Odra","type":0,"sectionRef":"#","url":"/docs/basics/cargo-odra","content":"","keywords":"","version":"1.0.0"},{"title":"Managing projects​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#managing-projects","content":"Two commands help you create a new project. The first one is cargo odra new. You need to pass one parameter, namely --name {PROJECT_NAME}: cargo odra new --name my-project This creates a new project in the my_project folder and name it my_project. You can see it for yourself, for example by taking a look into a Cargo.toml file created in your project's folder: [package] name = "my_project" version = "0.1.0" edition = "2021" The project is created using the template located in Odra's main repository. By default it uses full template, if you want, you can use minimalistic blank by running: cargo odra new -t blank --name my-project The third available template is workspace, which creates a workspace with two projects, similar to the one created with the full template. By default, the latest release of Odra will be used for the template and as a dependency. You can pass a source of Odra you want to use, by using -s parameter: cargo odra new -n my-project -s ../odra # will use local folder of odra cargo odra new -n my-project -s release/0.9.0 # will use github branch, e.g. if you want to test new release cargo odra new -n my-project -s 1.0.0 # will use a version released on crates.io The second way of creating a project is by using init command: cargo odra init --name my-project It works in the same way as new, but instead of creating a new folder, it creates a project in the current, empty directory. ","version":"1.0.0","tagName":"h2"},{"title":"Generating code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#generating-code","content":"If you want to quickly create a new contract code, you can use the generate command: cargo odra generate -c counter This creates a new file src/counter.rs with sample code, add appropriate use and mod sections to src/lib.rs and update the Odra.toml file accordingly. To learn more about Odra.toml file, visit Odra.toml. ","version":"1.0.0","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#testing","content":"The most used command during the development of your project should be this one: cargo odra test It runs your tests against Odra's MockVM. It is substantially faster than CasperVMand implements all the features Odra uses. When you want to run tests against a "real" VM, just provide the name of the backend using -boption: cargo odra test -b casper In the example above, Cargo Odra builds the project, generates the wasm files, spin up CasperVM instance, deploys the contracts onto it and runs the tests against it. Pretty neat. Keep in mind that this is a lot slower than OdraVM and you cannot use the debugger. This is why OdraVM was created and should be your first choice when developing contracts. Of course, testing all of your code against a blockchain VM is a must in the end. If you want to run only some of the tests, you can pass arguments to the cargo test command (which is run in the background obviously): cargo odra test -- this-will-be-passed-to-cargo-test If you want to run tests which names contain the word two, you can execute: cargo odra test -- two Of course, you can do the same when using the backend: cargo odra test -b casper -- two ","version":"1.0.0","tagName":"h2"},{"title":"Building code​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#building-code","content":"You can also build the code itself and generate the output contracts without running the tests. To do so, simply run: cargo odra build If the build process finishes successfully, wasm files will be located in wasm folder. Notice, that this command does not require the -b option. If you want to build specific contract, you can use -c option: cargo odra build -c counter # you pass many comma separated contracts ","version":"1.0.0","tagName":"h2"},{"title":"Generating contract schema​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#generating-contract-schema","content":"If you want to generate a schema (including the name, entrypoints, events, etc.) for your contract, you can use the schema command: cargo odra schema This generates a schema file in JSON format for all your contracts and places them in the resources folder. If the resources folder does not exist, it creates the folder for you. Like with the build command, you can use the -c option to generate a schema for a specific contract. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Cargo Odra","url":"/docs/basics/cargo-odra#whats-next","content":"In the next section, we will take a look at all the files and directories that cargo odra created for us and explain their purpose. ","version":"1.0.0","tagName":"h2"},{"title":"Host Communication","type":0,"sectionRef":"#","url":"/docs/basics/communicating-with-host","content":"","keywords":"","version":"1.0.0"},{"title":"What's next​","type":1,"pageTitle":"Host Communication","url":"/docs/basics/communicating-with-host#whats-next","content":"In the next article, we'll dive into testing your contracts with Odra, so you can check that the code we presented in fact works! ","version":"1.0.0","tagName":"h2"},{"title":"Directory structure","type":0,"sectionRef":"#","url":"/docs/basics/directory-structure","content":"","keywords":"","version":"1.0.0"},{"title":"Cargo.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#cargotoml","content":"Let's first take a look at Cargo.toml file: [package] name = "sample" version = "0.1.0" edition = "2021" [dependencies] odra = "1.0.0" [dev-dependencies] odra-test = "1.0.0" [build-dependencies] odra-build = "1.0.0" [[bin]] name = "sample_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "sample_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 By default, your project will use the latest odra version available at crates.io. For testing purposes, odra-test is also added as a dev dependency. ","version":"1.0.0","tagName":"h2"},{"title":"Odra.toml​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#odratoml","content":"This is the file that holds information about contracts that will be generated when running cargo odra build andcargo odra test: [[contracts]] fqn = "sample::Flipper" As we can see, we have a single contract, its fqn (Fully Qualified Name) corresponds to the contract is located in src/flipper.rs. More contracts can be added here by hand, or by using cargo odra generate command. ","version":"1.0.0","tagName":"h2"},{"title":"src/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#src","content":"This is the folder where your smart contract files live. ","version":"1.0.0","tagName":"h2"},{"title":"bin/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#bin","content":"This is the folder where scripts that will be used to generate code or schemas live. You don't need to modify those files, they are generated by cargo odra new command and are used by cargo odra build, cargo odra test and cargo odra schema commands. ","version":"1.0.0","tagName":"h2"},{"title":"target/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#target","content":"Files generated by cargo during the build process are put here. ","version":"1.0.0","tagName":"h2"},{"title":"wasm/​","type":1,"pageTitle":"Directory structure","url":"/docs/basics/directory-structure#wasm","content":"WASM files generated by cargo odra build and cargo odra test are put here. You can grab those WASM files and deploy them on the blockchain. What's next Now, let's take a look at one of the files mentioned above in more detail, namely the Odra.toml file. ","version":"1.0.0","tagName":"h2"},{"title":"Cross calls","type":0,"sectionRef":"#","url":"/docs/basics/cross-calls","content":"","keywords":"","version":"1.0.0"},{"title":"Contract Ref​","type":1,"pageTitle":"Cross calls","url":"/docs/basics/cross-calls#contract-ref","content":"We mentioned HostRef already in our Testing article - a host side reference to already deployed contract. In the module context we use a ContractRef instead, to call other contracts. Similarly to a {{ModuleName}}HostRef, the {{ModuleName}}ContractRef is generated automatically, by the #[odra::module] attribute. To obtain an instance of a contract reference, we simply call the constructor - {{ModuleName}}ContractRef::new(env: Rc<ContractEnv>, address: Address), as shown above. The reference implements all the public endpoints to the contract (those marked as pub in #[odra::module]impl), and the {{ModuleName}}ContractRef::address() function, which returns the address of the contract. External Contracts Sometimes in our contract, we would like to interact with a someone else's contract, already deployed onto the blockchain. The only thing we know about the contract is the ABI. For that purpose, we use #[odra:external_contract] attribute. This attribute should be applied to a trait. The trait defines the part of the ABI we would like to take advantage of. Let's pretend the MathEngine we defined is an external contract. There is a contract with add() function that adds two numbers somewhere. #[odra::external_contract] pub trait Adder { fn add(&self, n1: u32, n2: u32) -> u32; } Analogously to modules, Odra creates the AdderContractRef struct (and AdderHostRef to be used in tests, but do not implement the Deployer trait). Having an address, in the module context we can call: AdderContractRef::new(self.env(), address).add(3, 5) ","version":"1.0.0","tagName":"h2"},{"title":"Loading the contract​","type":1,"pageTitle":"Cross calls","url":"/docs/basics/cross-calls#loading-the-contract","content":"Sometimes it is useful to load the deployed contract instead of deploying it by ourselves. This is especially useful when we want to test our contracts in Livenet backend. We can load the contract using load method on the Deployer: examples/bin/erc20_on_livenet.rs fn _load(env: &HostEnv) -> Erc20HostRef { let address = "hash-d26fcbd2106e37be975d2045c580334a6d7b9d0a241c2358a4db970dfd516945"; let address = Address::from_str(address).unwrap(); <Erc20HostRef as HostRefLoader>::load(env, address) } ","version":"1.0.0","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"Cross calls","url":"/docs/basics/cross-calls#testing","content":"Let's see how we can test our cross calls using this knowledge: examples/src/features/cross_calls.rs #[cfg(test)] mod tests { use super::{CrossContractHostRef, CrossContractInitArgs, MathEngineHostRef}; use odra::host::{Deployer, HostRef, NoArgs}; #[test] fn test_cross_calls() { let test_env = odra_test::env(); let math_engine_contract = MathEngineHostRef::deploy(&test_env, NoArgs); let cross_contract = CrossContractHostRef::deploy( &test_env, CrossContractInitArgs { math_engine_address: *math_engine_contract.address() } ); assert_eq!(cross_contract.add_using_another(), 8); } } Each test begins with a clean instance of the blockchain, with no contracts deployed. To test an external contract, we first deploy a MathEngine contract, although we won't directly utilize it. Instead, we only extract its address. Let's continue assuming there is a contract featuring the add() function that we intend to utilize. #[cfg(test)] mod tests { use super::*; use odra::{Address, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_ext() { let test_env = odra_test::env(); let adder = AdderHostRef::new(&test_env, get_adder_address(&test_env)).add(3, 5) assert_eq!(adder.add(1, 2), 3); } fn get_adder_address(test_env: &HostEnv) -> Address { let contract = MathEngineHostRef::deploy(test_env, NoArgs); *contract.address() } } ","version":"1.0.0","tagName":"h2"},{"title":"Casper Contract Schema","type":0,"sectionRef":"#","url":"/docs/basics/casper-contract-schema","content":"","keywords":"","version":"1.0.0"},{"title":"Odra and CCS​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#odra-and-ccs","content":"There is almost nothing you need to do to use CCS in your Odra project. The only thing to be taken care of is using odra attributes namely: module, event, odra_error and odra_type. The schema will be generated for you and available in the resources directory. note If you forget to register events and errors in the module attribute, the definition remains valid; however, the errors and events will not be incorporated into the schema. src/contract.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module( // the name of the contract, default is the module name name = "MyContract", // the version of the contract, default is the version of the crate version = "0.1.0", // events that the contract can emit, collected recursively if submodules are used events = [ Created, Updated ], // the error enum the contract can revert with, collected recursively if submodules are used errors = MyErrors )] pub struct MyContract { name: Var<String>, owner: Var<Address>, } #[odra::module] impl MyContract { /// Initializes the contract, sets the name and owner and emits an event pub fn init(&mut self, name: String, owner: Address) { self.name.set(name.clone()); self.owner.set(owner.clone()); self.env().emit_event(Created { name }); } /// Updates the name of the contract and emits an event pub fn update(&mut self, name: String) { self.name.set(name.clone()); self.env().emit_event(Updated { name }); } /// Returns the data of the contract pub fn get_data(&self) -> Data { Data { name: self.name.get_or_default(), owner: self.owner.get_or_revert_with(MyErrors::InvalidOwner), } } } // The struct will we visible in the schema in the types section #[odra::odra_type] pub struct Data { name: String, owner: Address, } // The enum variants will we visible in the schema in the errors section #[odra::odra_error] pub enum MyErrors { /// The owner is invalid InvalidOwner, /// The name is invalid InvalidName, } // The struct will we visible in the schema in the types and events section #[odra::event] pub struct Updated { name: String, } // The struct will we visible in the schema in the types section and events section #[odra::event] pub struct Created { name: String, } ","version":"1.0.0","tagName":"h2"},{"title":"Generating the Schema​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#generating-the-schema","content":"To generate the schema run the following cargo-odra command: cargo odra schema # or pass -c flag to generate the schema for a specific contract ","version":"1.0.0","tagName":"h2"},{"title":"Schema Output​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#schema-output","content":"The generated schema will be available in the resources directory. The schema is a JSON file that contains all the information about the contract. Here is an example of the generated schema: resources/my_contract_schema.json { "casper_contract_schema_version": 1, "toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)", "authors": [], "repository": null, "homepage": null, "contract_name": "MyContract", "contract_version": "0.1.0", "types": [ { "struct": { "name": "Created", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } }, { "struct": { "name": "Data", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" }, { "name": "owner", "description": null, "ty": "Key" } ] } }, { "struct": { "name": "Updated", "description": null, "members": [ { "name": "name", "description": null, "ty": "String" } ] } } ], "errors": [ { "name": "InvalidName", "description": "The name is invalid", "discriminant": 1 }, { "name": "InvalidOwner", "description": "The owner is invalid", "discriminant": 0 } ], "entry_points": [ { "name": "update", "description": "Updates the name of the contract and emits an event", "is_mutable": true, "arguments": [ { "name": "name", "description": null, "ty": "String", "optional": false } ], "return_ty": "Unit", "is_contract_context": true, "access": "public" }, { "name": "get_data", "description": "Returns the data of the contract", "is_mutable": false, "arguments": [], "return_ty": "Data", "is_contract_context": true, "access": "public" } ], "events": [ { "name": "Created", "ty": "Created" }, { "name": "Updated", "ty": "Updated" } ], "call": { "wasm_file_name": "MyContract.wasm", "description": "Initializes the contract, sets the name and owner and emits an event", "arguments": [ { "name": "odra_cfg_package_hash_key_name", "description": "The arg name for the package hash key name.", "ty": "String", "optional": false }, { "name": "odra_cfg_allow_key_override", "description": "The arg name for the allow key override.", "ty": "Bool", "optional": false }, { "name": "odra_cfg_is_upgradable", "description": "The arg name for the contract upgradeability setting.", "ty": "Bool", "optional": false }, { "name": "name", "description": null, "ty": "String", "optional": false }, { "name": "owner", "description": null, "ty": "Key", "optional": false } ] } } ","version":"1.0.0","tagName":"h2"},{"title":"Schema Fields​","type":1,"pageTitle":"Casper Contract Schema","url":"/docs/basics/casper-contract-schema#schema-fields","content":"casper_contract_schema_version is the version of the schema.toolchain is the version of the Rust compiler used to compile the contract.Fields authors, repository, and homepage are optional and can be set in the Cargo.toml file.contract_name is the name of the contract - by default is the module name, may be overriden by the module attribute.contract_version denotes the version of the contract, defaulting to the version specified in the Cargo.toml file, but can be overridden by the module attribute.types comprises a list of custom structs and enums defined within the contract. Each struct or enum includes a name, description (not currently supported, with the value set to null), and a list of members.errors is a list of error enums defined within the contract. Each error includes a name, description (the first line of the variant documentation), and a discriminant.entry_points is a list of contract functions that can be called from the outside. Each entry point includes a name, description (not currently supported, with the value set to null), whether the function is mutable, a list of arguments, the return type, whether the function is called in the contract context, and the access level.events is a list of events that the contract can emit. Each event includes a name and the type (earlier defined in types) of the event.The call section provides details regarding the contract's call function, which executes upon contract deployment. It includes the name of the Wasm file, a description (reflecting the constructor's description, typically the init function), and a list of arguments. These arguments are a combination of Odra configuration arguments and constructor arguments. ","version":"1.0.0","tagName":"h2"},{"title":"Errors","type":0,"sectionRef":"#","url":"/docs/basics/errors","content":"","keywords":"","version":"1.0.0"},{"title":"Testing errors​","type":1,"pageTitle":"Errors","url":"/docs/basics/errors#testing-errors","content":"Okay, but how about testing it? Let's write a test that will check if the error is thrown when the caller is not an owner: examples/src/features/handling_errors.rs #[cfg(test)] mod tests { use super::{Error, OwnedContractHostRef, OwnedContractInitArgs}; use odra::{host::Deployer, prelude::*}; #[test] fn test_owner_error() { let test_env = odra_test::env(); let owner = test_env.get_account(0); let not_an_owner = test_env.get_account(1); test_env.set_caller(owner); let init_args = OwnedContractInitArgs { name: "OwnedContract".to_string() }; let mut owned_contract = OwnedContractHostRef::deploy(&test_env, init_args); test_env.set_caller(not_an_owner); assert_eq!( owned_contract.try_change_name("NewName".to_string()), Err(Error::NotAnOwner.into()) ); } } Each {{ModuleName}}HostRef has try_{{entry_point_name}} functions that return an OdraResult.OwnedContractHostRef implements regular entrypoints: name, owner, change_name, and and safe its safe version: try_name, try_owner, try_change_name. In our example, we are calling try_change_name and expecting an error to be thrown. For assertions, we are using a standard assert_eq! macro. As the contract call returns an OdraError, we need to convert our custom error to OdraError using Into::into(). ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Errors","url":"/docs/basics/errors#whats-next","content":"We will learn how to emit and test events using Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Events","type":0,"sectionRef":"#","url":"/docs/basics/events","content":"","keywords":"","version":"1.0.0"},{"title":"Testing events​","type":1,"pageTitle":"Events","url":"/docs/basics/events#testing-events","content":"Odra's HostEnv comes with a few functions which lets you easily test the events that a given contract has emitted: examples/src/features/events.rs use super::{PartyContractHostRef, PartyStarted}; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; #[test] fn test_party() { let test_env: HostEnv = odra_test::env(); let party_contract = PartyContractHostRef::deploy(&test_env, NoArgs); test_env.emitted_event( party_contract.address(), &PartyStarted { caller: test_env.get_account(0), block_time: 0 } ); // If you do not want to check the exact event, you can use `emitted` function test_env.emitted(party_contract.address(), "PartyStarted"); // You can also check how many events were emitted. assert_eq!(test_env.events_count(party_contract.address()), 1); } To explore more event testing functions, check the HostEnv documentation. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Events","url":"/docs/basics/events#whats-next","content":"Read the next article to learn how to call other contracts from the contract context. ","version":"1.0.0","tagName":"h2"},{"title":"Flipper Internals","type":0,"sectionRef":"#","url":"/docs/basics/flipper-internals","content":"","keywords":"","version":"1.0.0"},{"title":"Header​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#header","content":"flipper.rs use odra::Var; Pretty straightforward. Odra wraps the code of the specific blockchains SDKs into its own implementation that can be reused between targets. In the above case, we're importing Var, which is responsible for storing simple values on the blockchain's storage. ","version":"1.0.0","tagName":"h2"},{"title":"Struct​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#struct","content":"flipper.rs /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } In Odra, all contracts are also modules, which can be reused between contracts. That's why we need to mark the struct with the #[odra::module] attribute. In the struct definition itself, we state all the fields of the contract. Those fields can be regular Rust data types, however - those will not be persisted on the blockchain. They can also be Odra modules - defined in your project or coming from Odra itself. Finally, to make the data persistent on the blockchain, you can use something likeVar<T> showed above. To learn more about storage interaction, take a look at thenext article. ","version":"1.0.0","tagName":"h2"},{"title":"Impl​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#impl","content":"flipper.rs /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } ... Similarly to the struct, we mark the impl section with the #[odra::module] attribute. Odra will take allpub functions from this section and create contract endpoints from them. So, if you wish to have functions that are not available for calling outside the contract, do not make them public. Alternatively, you can create a separate impl section without the attribute - all functions defined there, even marked with pub will be not callable. The function named init is the constructor of the contract. This function will be limited to only to a single call, all further calls to it will result in an error. The init function is optional, if your contract does not need any initialization, you can skip it. flipper.rs ... /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } ... The endpoints above show you how to interact with the simplest type of storage - Var<T>. The data saved there using set function will be persisted in the blockchain. ","version":"1.0.0","tagName":"h2"},{"title":"Tests​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#tests","content":"flipper.rs #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } ... You can write tests in any way you prefer and know in Rust. In the example above we are deploying the contract using Deployer::deploy function called on FlipperHostRef - a piece of code generated by the #[odra::module]. Because the module implements the constructor but does not accept any arguments, as the second argument of the deploy function, we pass NoArgs - one of the implementations of the InitArgs trait provided with the framework. The contract will be deployed on the VM you chose while running cargo odra test. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper Internals","url":"/docs/basics/flipper-internals#whats-next","content":"Now let's take a look at the different types of storage that Odra provides and how to use them. ","version":"1.0.0","tagName":"h2"},{"title":"Modules","type":0,"sectionRef":"#","url":"/docs/basics/modules","content":"","keywords":"","version":"1.0.0"},{"title":"Testing​","type":1,"pageTitle":"Modules","url":"/docs/basics/modules#testing","content":"As we don't need to hold addresses, the test is really simple: examples/src/features/modules.rs #[cfg(test)] mod tests { use super::ModulesContractHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn test_modules() { let test_env = odra_test::env(); let modules_contract = ModulesContractHostRef::deploy(&test_env, NoArgs); assert_eq!(modules_contract.add_using_module(), 8); } } ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Modules","url":"/docs/basics/modules#whats-next","content":"We will see how to handle native token transfers. ","version":"1.0.0","tagName":"h2"},{"title":"Odra.toml","type":0,"sectionRef":"#","url":"/docs/basics/odra-toml","content":"","keywords":"","version":"1.0.0"},{"title":"Adding a new contract manually​","type":1,"pageTitle":"Odra.toml","url":"/docs/basics/odra-toml#adding-a-new-contract-manually","content":"Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly. For example, if you want to create a new contract called counter, your Odra.toml file should finally look like this: [[contracts]] fqn = "sample::Flipper" [[contracts]] fqn = "sample::Counter" ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Odra.toml","url":"/docs/basics/odra-toml#whats-next","content":"In the next section, we'll take a closer look at the code that was generated by Odra by default - the famousFlipper contract. ","version":"1.0.0","tagName":"h2"},{"title":"Native token","type":0,"sectionRef":"#","url":"/docs/basics/native-token","content":"","keywords":"","version":"1.0.0"},{"title":"Testing​","type":1,"pageTitle":"Native token","url":"/docs/basics/native-token#testing","content":"To be able to test how many tokens a contract (or any address) has, HostEnv comes with a function -balance_of: examples/src/features/native_token.rs #[cfg(test)] mod tests { use super::PublicWalletHostRef; use odra::{casper_types::U512, host::{Deployer, HostRef, NoArgs}}; #[test] fn test_modules() { let test_env = odra_test::env(); let mut my_contract = PublicWalletHostRef::deploy(&test_env, NoArgs); assert_eq!(test_env.balance_of(my_contract.address()), U512::zero()); my_contract.with_tokens(U512::from(100)).deposit(); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(100)); my_contract.withdraw(U512::from(25)); assert_eq!(test_env.balance_of(my_contract.address()), U512::from(75)); } } ","version":"1.0.0","tagName":"h2"},{"title":"Testing","type":0,"sectionRef":"#","url":"/docs/basics/testing","content":"","keywords":"","version":"1.0.0"},{"title":"HostEnv​","type":1,"pageTitle":"Testing","url":"/docs/basics/testing#hostenv","content":"Odra gives us some additional functions that we can use to communicate with the host (outside the contract context) and to configure how the contracts are deployed and called. Let's revisit the example from the previous article about host communication and implement the tests that prove it works: examples/src/features/testing.rs #[cfg(test)] mod tests { use crate::features::testing::{TestingContractHostRef, TestingContractInitArgs}; use odra::{host::{Deployer, HostEnv}, prelude::*}; #[test] fn env() { let test_env: HostEnv = odra_test::env(); test_env.set_caller(test_env.get_account(0)); let init_args = TestingContractInitArgs { name: "MyContract".to_string() }; let testing_contract = TestingContractHostRef::deploy(&test_env, init_args); let creator = testing_contract.created_by(); test_env.set_caller(test_env.get_account(1)); let init_args = TestingContractInitArgs { name: "MyContract2".to_string() }; let testing_contract2 = TestingContractHostRef::deploy(&test_env, init_args); let creator2 = testing_contract2.created_by(); assert_ne!(creator, creator2); } } In the code above, at the beginning of the test, we are obtaining a HostEnv instance using odra_test::env(). Next, we are deploying two instances of the same contract, but we're using HostEnv::set_callerto change the caller - so the Address which is deploying the contract. This changes the result of the odra::ContractEnv::caller()the function we are calling inside the contract. HostEnv comes with a set of functions that will let you write better tests: fn set_caller(&self, address: Address) - you've seen it in action just nowfn balance_of(&self, address: &Address) -> U512 - returns the balance of the account associated with the given addressfn advance_block_time(&self, time_diff: u64) - increases the current value of block_timefn get_account(&self, n: usize) -> Address - returns an n-th address that was prepared for you by Odra in advance; by default, you start with the 0-th accountfn emitted_event<T: ToBytes + EventInstance>(&self, contract_address: &Address, event: &T) -> bool - verifies if the event was emitted by the contract Full list of functions can be found in the HostEnv documentation. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Testing","url":"/docs/basics/testing#whats-next","content":"We take a look at how Odra handles errors! ","version":"1.0.0","tagName":"h2"},{"title":"Storage interaction","type":0,"sectionRef":"#","url":"/docs/basics/storage-interaction","content":"","keywords":"","version":"1.0.0"},{"title":"Var​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#var","content":"The Var is the simplest storage type available in the Odra framework. It serializes the data and stores it under a single key in the blockchain storage. To use it, just wrap your variable in the Var type. Let's look at a "real world" example of a contract that represents a dog: examples/src/features/storage/variable.rs use odra::prelude::*; use odra::Var; #[odra::module] pub struct DogContract { barks: Var<bool>, weight: Var<u32>, name: Var<String>, walks: Var<Vec<u32>>, } You can see the Var wrapping the data. Even complex types like Vec can be wrapped (with some caveats)! Let's make this contract usable, by providing a constructor and some getter functions: examples/src/features/storage/variable.rs #[odra::module] impl DogContract { pub fn init(&mut self, barks: bool, weight: u32, name: String) { self.barks.set(barks); self.weight.set(weight); self.name.set(name); self.walks.set(Vec::<u32>::default()); } pub fn barks(&self) -> bool { self.barks.get_or_default() } pub fn weight(&self) -> u32 { self.weight.get_or_default() } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { let walks = self.walks.get_or_default(); walks.len() as u32 } pub fn walks_total_length(&self) -> u32 { let walks = self.walks.get_or_default(); walks.iter().sum() } } As you can see, you can access the data, by using get_or_default function: examples/src/features/storage/variable.rs ... self.barks.get_or_default() ... note Keep in mind that using get() will result in an Option that you'll need to unwrap - the variable doesn't have to be initialized! To modify the data, use the set() function: examples/src/features/storage/variable.rs self.barks.set(barks); A Var is easy to use and efficient for simple data types. One of its downsides is that it serializes the data as a whole, so when you're using complex types like Vec or HashMap, each time you get or set the whole data is read and written to the blockchain storage. In the example above, if we want to see how many walks our dog had, we would use the function: examples/src/features/storage/variable.rs pub fn walks_amount(&self) -> usize { let walks = self.walks.get_or_default(); walks.len() } But to do so, we need to extract the whole serialized vector from the storage, which would inefficient, especially for larger sets of data. To tackle this issue following two types were created. ","version":"1.0.0","tagName":"h2"},{"title":"Mapping​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#mapping","content":"The Mapping is used to store and access data as key-value pairs. To define a Mapping, you need to pass two values - the key type and the value type. Let's look at the variation of the Dog contract, that uses Mapping to store information about our dog's friends and how many times they visited: examples/src/features/storage/mapping.rs use odra::prelude::*; use odra::{Mapping, Var}; #[odra::module] pub struct DogContract2 { name: Var<String>, friends: Mapping<String, u32>, } In the example above, our key is a String (it is a name of the friend) and we are storing u32 values (amount of visits). To read and write values from and into a Mapping we use a similar approach to the one shown in the Vars section with one difference - we need to pass a key: examples/src/features/storage/mapping.rs pub fn visit(&mut self, friend_name: String) { let visits = self.visits(friend_name.clone()); self.friends.set(&friend_name, visits + 1); } pub fn visits(&self, friend_name: String) -> u32 { self.friends.get_or_default(&friend_name) } The biggest improvement over a Var is that we can model functionality of a HashMap using Mapping. The amount of data written to and read from the storage is minimal. However, we cannot iterate over Mapping. We could implement such behavior by using a numeric type key and saving the length of the set in a separate variable. Thankfully Odra comes with a prepared solution - the List type. note If you take a look into List implementation in Odra, you'll see that in fact it is just a Mapping with a Var working together: core/src/list.rs use odra::{List, Var}; pub struct List<T> { values: Mapping<u32, T>, index: Var<u32> } ","version":"1.0.0","tagName":"h2"},{"title":"List​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#list","content":"Going back to our DogContract example - let's revisit the walk case. This time, instead of Vec, we'll use the list: examples/src/features/storage/list.rs use odra::{prelude::*, List, Var}; #[odra::module] pub struct DogContract3 { name: Var<String>, walks: List<u32>, } As you can see, the notation is very similar to the Vec. To understand the usage, take a look at the reimplementation of the functions with an additional function that takes our dog for a walk (it writes the data to the storage): examples/src/features/storage/list.rs #[odra::module] impl DogContract3 { pub fn init(&mut self, name: String) { self.name.set(name); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn walks_amount(&self) -> u32 { self.walks.len() } pub fn walks_total_length(&self) -> u32 { self.walks.iter().sum() } pub fn walk_the_dog(&mut self, length: u32) { self.walks.push(length); } } Now, we can know how many walks our dog had without loading the whole vector from the storage. We need to do this to sum the length of all the walks, but the Odra framework cannot (yet) handle all the cases for you. info All of the above examples, alongside the tests, are available in the Odra repository in the examples/src/features/ folder. ","version":"1.0.0","tagName":"h2"},{"title":"Custom Types​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#custom-types","content":"By default you can store only built-in types like numbers, Options, Results, Strings, Vectors. Implementing custom types is straightforward, your type must add #[odra::odra_type] attribute. Let's see how to implement a Dog type: use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } #[odra_type] is applicable to named field structs and enums. It generates serialization, deserialization and schema code for your type.CLType of a custom type is CLType::Any, except for an unit-only enum, which is CLType::U8. unit_only_enum.rs enum Enum { Foo = 3, Bar = 2, Baz = 1, } note Each custom typed field of your struct must be marked with the #[odra::odra_type] attribute . ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Storage interaction","url":"/docs/basics/storage-interaction#whats-next","content":"In the next article, we'll see how to query the host for information about the world and our contract. ","version":"1.0.0","tagName":"h2"},{"title":"odra-examples","type":0,"sectionRef":"#","url":"/docs/examples/odra-examples","content":"","keywords":"","version":"1.0.0"},{"title":"What's next​","type":1,"pageTitle":"odra-examples","url":"/docs/examples/odra-examples#whats-next","content":"Read the next article to learn about reusable Odra components encapsulated in odra-modules. ","version":"1.0.0","tagName":"h2"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/getting-started/installation","content":"","keywords":"","version":"1.0.0"},{"title":"Prerequisites​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#prerequisites","content":"To start working with Odra, you need to have the following installed on your machine: Rust toolchain installed (see rustup.rs)wasmstrip tool installed (see wabt) We do not provide exact commands for installing these tools, as they are different for different operating systems. Please refer to the documentation of the tools themselves. With Rust toolchain ready, you can add a new target: rustup target add wasm32-unknown-unknown note wasm32-unknown-unknown is a target that will be used by Odra to compile your smart contracts to WASM files. ","version":"1.0.0","tagName":"h2"},{"title":"Installing Cargo Odra​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#installing-cargo-odra","content":"Cargo Odra is a helpful tool that will help you to build and test your smart contracts. It is not required to use Odra, but the documentation will assume that you have it installed. To install it, simply execute the following command: cargo install cargo-odra --locked To check if it was installed correctly and see available commands, type: cargo odra --help If everything went fine, we can proceed to the next step. ","version":"1.0.0","tagName":"h2"},{"title":"Creating a new Odra project​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#creating-a-new-odra-project","content":"To create a new project, simply execute: cargo odra new --name my-project && cd my_project This will create a new folder called my_project and initialize Odra there. Cargo Odra will create a sample contract for you in src directory. You can run the tests of this contract by executing: cargo odra test This will run tests using Odra's internal OdraVM. You can run those tests against a real backend, let's use CasperVM: cargo odra test -b casper Congratulations! Now you are ready to create contracts using Odra framework! If you had any problems during the installation process, feel free to ask for help on our Discord. ","version":"1.0.0","tagName":"h2"},{"title":"What's next?​","type":1,"pageTitle":"Installation","url":"/docs/getting-started/installation#whats-next","content":"If you want to see the code that you just tested, continue to the description of Flipper example. ","version":"1.0.0","tagName":"h2"},{"title":"Using odra-modules","type":0,"sectionRef":"#","url":"/docs/examples/using-odra-modules","content":"","keywords":"","version":"1.0.0"},{"title":"Available modules​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#available-modules","content":"Odra modules comes with couple of ready-to-use modules and reusable extensions. ","version":"1.0.0","tagName":"h2"},{"title":"Tokens​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#tokens","content":"CEP-18​ Casper Ecosystem Proposal 18 (CEP-18) is a standard interface for the CSPR and the custom made tokens. Inspired by the ERC20 standard. Read more about the CEP-18 here. CEP-78​ Casper Ecosystem Proposal 78 (CEP-78) is an enhanced NFT standard focused on ease of use and installation. Inspired by the ERC721 standard. Read more about the CEP-78 here. Erc20​ The Erc20 module implements the ERC20 standard. Erc721​ The Erc721Base module implements the ERC721 standard, adjusted for the Odra framework. The Erc721Token module implements the ERC721Base and additionally uses the Erc721Metadata and Ownable extensions. The Erc721Receiver trait lets you implement your own logic for receiving NFTs. The OwnedErc721WithMetadata trait is a combination of Erc721Token, Erc721Metadata and Ownable modules. Erc1155​ The Erc1155Base module implements the ERC1155 standard, adjusted for the Odra framework. The Erc1155Token module implements the ERC1155Base and additionally uses the Ownable extension. The OwnedErc1155 trait is a combination of Erc1155Token and Ownable modules. Wrapped native token​ The WrappedNativeToken module implements the Wrapper for the native token, it was inspired by the WETH. ","version":"1.0.0","tagName":"h3"},{"title":"Access​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#access","content":"AccessControl​ This module enables the implementation of role-based access control mechanisms for children modules. Roles are identified by their 32-bytes identifier, which should be unique and exposed in the external API. Ownable​ This module provides a straightforward access control feature that enables exclusive access to particular functions by an account, known as the owner. The account that initiates the module is automatically assigned as the owner. However, ownership can be transferred later by using thetransfer_ownership() function. Ownable2Step​ An extension of the Ownable module. Ownership can be transferred in a two-step process by using transfer_ownership() and accept_ownership() functions. ","version":"1.0.0","tagName":"h3"},{"title":"Security​","type":1,"pageTitle":"Using odra-modules","url":"/docs/examples/using-odra-modules#security","content":"Pausable​ A module allowing to implement an emergency stop mechanism that can be triggered by any account. ","version":"1.0.0","tagName":"h3"},{"title":"Flipper example","type":0,"sectionRef":"#","url":"/docs/getting-started/flipper","content":"","keywords":"","version":"1.0.0"},{"title":"Let's flip​","type":1,"pageTitle":"Flipper example","url":"/docs/getting-started/flipper#lets-flip","content":"flipper.rs use odra::Var; /// A module definition. Each module struct consists Vars and Mappings /// or/and another modules. #[odra::module] pub struct Flipper { /// The module itself does not store the value, /// it's a proxy that writes/reads value to/from the host. value: Var<bool>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl Flipper { /// Odra constructor, must be named `init`. /// /// Initializes the contract with the value of value. pub fn init(&mut self) { self.value.set(false); } /// Replaces the current value with the passed argument. pub fn set(&mut self, value: bool) { self.value.set(value); } /// Replaces the current value with the opposite value. pub fn flip(&mut self) { self.value.set(!self.get()); } /// Retrieves value from the storage. /// If the value has never been set, the default value is returned. pub fn get(&self) -> bool { self.value.get_or_default() } } #[cfg(test)] mod tests { use crate::flipper::FlipperHostRef; use odra::host::{Deployer, NoArgs}; #[test] fn flipping() { let env = odra_test::env(); // To test a module we need to deploy it. Autogenerated `FlipperHostRef` // implements `Deployer` trait, so we can use it to deploy the module. let mut contract = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract.get()); contract.flip(); assert!(contract.get()); } #[test] fn test_two_flippers() { let env = odra_test::env(); let mut contract1 = FlipperHostRef::deploy(&env, NoArgs); let contract2 = FlipperHostRef::deploy(&env, NoArgs); assert!(!contract1.get()); assert!(!contract2.get()); contract1.flip(); assert!(contract1.get()); assert!(!contract2.get()); } } ","version":"1.0.0","tagName":"h2"},{"title":"Testing​","type":1,"pageTitle":"Flipper example","url":"/docs/getting-started/flipper#testing","content":"To run the tests, execute the following command: cargo odra test # or add the `-b casper` flag to run tests on the CasperVM ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Flipper example","url":"/docs/getting-started/flipper#whats-next","content":"In the next category of articles, we will go through basic concepts of Odra. ","version":"1.0.0","tagName":"h2"},{"title":"Access Control","type":0,"sectionRef":"#","url":"/docs/tutorials/access-control","content":"","keywords":"","version":"1.0.0"},{"title":"Code​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#code","content":"Before we start writing code, we list the functionalities of our access control layer. A Role type is used across the module.A Role can be assigned to many Addresses.Each Role may have a corresponding admin role.Only an admin can grant/revoke a Role.A Role can be renounced.A Role cannot be renounced on someone's behalf.Each action triggers an event.Unauthorized access stops contract execution. ","version":"1.0.0","tagName":"h2"},{"title":"Project Structure​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#project-structure","content":"access-control ├── src │ ├── access │ │ ├── access_control.rs │ │ ├── events.rs │ │ └── errors.rs │ └── lib.rs |── build.rs |── Cargo.toml └── Odra.toml ","version":"1.0.0","tagName":"h3"},{"title":"Events and Errors​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#events-and-errors","content":"There are three actions that can be performed concerning a Role: granting, revoking, and altering the admin role. Let us establish standard Odra events for each of these actions. events.rs use odra::prelude::*; use odra::Address; use super::access_control::Role; #[odra::event] pub struct RoleGranted { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleRevoked { pub role: Role, pub address: Address, pub sender: Address } #[odra::event] pub struct RoleAdminChanged { pub role: Role, pub previous_admin_role: Role, pub new_admin_role: Role } L5-L17 - to describe the grant or revoke actions, our events specify the Role, and Addresses indicating who receives or loses access and who provides or withdraws it.L19-L24 - the event describing the admin role change, requires the subject Role, the previous and the current admin Role. errors.rs #[odra::odra_error] pub enum Error { MissingRole = 20_000, RoleRenounceForAnotherAddress = 20_001, } Errors definition is straightforward - there are only two invalid states: An action is triggered by an unauthorized actor.The caller is attempting to resign the Role on someone's behalf. ","version":"1.0.0","tagName":"h3"},{"title":"Module​","type":1,"pageTitle":"Access Control","url":"/docs/tutorials/access-control#module","content":"Now, we are stepping into the most interesting part: the module definition and implementation. access_control.rs use super::events::*; use super::errors::Error; use odra::prelude::*; use odra::{Address, Mapping}; pub type Role = [u8; 32]; pub const DEFAULT_ADMIN_ROLE: Role = [0u8; 32]; #[odra::module(events = [RoleAdminChanged, RoleGranted, RoleRevoked])] pub struct AccessControl { roles: Mapping<(Role, Address), bool>, role_admin: Mapping<Role, Role> } #[odra::module] impl AccessControl { pub fn has_role(&self, role: &Role, address: &Address) -> bool { self.roles.get_or_default(&(*role, *address)) } pub fn get_role_admin(&self, role: &Role) -> Role { let admin_role = self.role_admin.get(role); if let Some(admin) = admin_role { admin } else { DEFAULT_ADMIN_ROLE } } pub fn grant_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_grant_role(role, address); } pub fn revoke_role(&mut self, role: &Role, address: &Address) { self.check_role(&self.get_role_admin(role), &self.env().caller()); self.unchecked_revoke_role(role, address); } pub fn renounce_role(&mut self, role: &Role, address: &Address) { if address != &self.env().caller() { self.env().revert(Error::RoleRenounceForAnotherAddress); } self.unchecked_revoke_role(role, address); } } impl AccessControl { pub fn check_role(&self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.env().revert(Error::MissingRole); } } pub fn set_admin_role(&mut self, role: &Role, admin_role: &Role) { let previous_admin_role = self.get_role_admin(role); self.role_admin.set(role, *admin_role); self.env().emit_event(RoleAdminChanged { role: *role, previous_admin_role, new_admin_role: *admin_role }); } pub fn unchecked_grant_role(&mut self, role: &Role, address: &Address) { if !self.has_role(role, address) { self.roles.set(&(*role, *address), true); self.env().emit_event(RoleGranted { role: *role, address: *address, sender: self.env().caller() }); } } pub fn unchecked_revoke_role(&mut self, role: &Role, address: &Address) { if self.has_role(role, address) { self.roles.set(&(*role, *address), false); self.env().emit_event(RoleRevoked { role: *role, address: *address, sender: self.env().caller() }); } } } L6 - Firstly, we need the Role type. It is simply an alias for a 32-byte array.L8 - The default role is an array filled with zeros.L10-L13 - The storage consists of two mappings: roles - a nested mapping that stores information about whether a certain Role is granted to a given Address.role_admin - each Role can have a single admin Role. L18-L20 - This is a simple check to determine if a Role has been granted to a given Address. It is an exposed entry point and an important building block widely used throughout the entire module.L49 - This is a non-exported block containing helper functions.L50-L54 - The check_role() function serves as a guard function. Before a Role is granted or revoked, we must ensure that the caller is allowed to do so. For this purpose, the function reads the roles mapping. If the role has not been granted to the address, the contract reverts with Error::MissingRole.L56-L64 - The set_admin_role() function simply updates the role_admin mapping and emits the RoleAdminChanged event.L66-L86 - The unchecked_grant_role() and unchecked_revoke_role() functions are mirror functions that update the roles mapping and post RoleGranted or RoleRevoked events. If the role is already granted, unchecked_grant_role() has no effect (the opposite check is made in the case of revoking a role).L22-L29 - The get_role_admin() entry point reads the role_admin. If there is no admin role for a given role, it returns the default role.L31-L46 - This is a combination of check_role() and unchecked_*_role(). Entry points fail on unauthorized access. ","version":"1.0.0","tagName":"h3"},{"title":"Odra for Solidity developers","type":0,"sectionRef":"#","url":"/docs/next/tutorials/odra-solidity","content":"","keywords":"","version":"next"},{"title":"Introduction​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#introduction","content":"Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers. ","version":"next","tagName":"h2"},{"title":"Prerequisites​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#prerequisites","content":"To follow this guide, you should have: Knowledge of Solidity.Familiarity with Ethereum and smart contract concepts.Basic understanding of Rust, as Odra is based on it. ","version":"next","tagName":"h2"},{"title":"Hello World​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#hello-world","content":"Let's start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message. OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct HelloWorld { greet: Var<String>, } #[odra::module] impl HelloWorld { pub fn init(&mut self, message: String) { self.greet.set(message); } pub fn get(&self) -> String { self.greet.get_or_default() } } As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the odra::module attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the HelloWorld struct has a single state variable greet, which stores the greeting message. The module contains two functions: init to set the greeting message and get to retrieve it. Two key differences are: Odra does not generate getters for public state variables automatically, so you need to define them explicitly.To initialize values, you must do it in the init function, which is the contract constructor. You can't assign defaults outside the constructor. ","version":"next","tagName":"h2"},{"title":"Variable Storage and State Management​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#variable-storage-and-state-management","content":"","version":"next","tagName":"h2"},{"title":"Data Types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#data-types","content":"OdraSolidity use core::str::FromStr; use odra::{ casper_types::{bytesrepr::Bytes, U256}, module::Module, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct Primitives { boo: Var<bool>, u: Var<u8>, // u8 is the smallest unsigned integer type u2: Var<U256>, // U256 is the biggest unsigned integer type i: Var<i32>, // i32 is the smallest signed integer type i2: Var<i64>, // i64 is the biggest signed integer type address: Var<Address>, bytes: Var<Bytes>, default_boo: Var<bool>, default_uint: Var<U256>, default_int: Var<i64>, default_addr: Var<Address>, } #[odra::module] impl Primitives { pub fn init(&mut self) { self.boo.set(true); self.u.set(1); self.u2.set(U256::from(456)); self.i.set(-1); self.i2.set(456); self.address.set( Address::from_str( "hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb", ) .unwrap_or_revert(&self.env()), ); self.bytes.set(Bytes::from(vec![0xb5])); let _min_int = U256::zero(); let _max_int = U256::MAX; } // For the types that have default values, we can use the get_or_default method pub fn get_default_boo(&self) -> bool { self.default_boo.get_or_default() } pub fn get_default_uint(&self) -> U256 { self.default_uint.get_or_default() } pub fn get_default_int(&self) -> i64 { self.default_int.get_or_default() } // Does not compile - Address does not have the default value pub fn get_default_addr(&self) -> Address { self.default_addr.get_or_default() } } The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: u8, u16, u32, u64, U128, and U256 for unsigned integers, and i32 and i64 for signed integers. The Address type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the Address type; the workaround is to use Option<Address>. The Bytes type is used to store byte arrays. Values are stored in units called Named Keys and Dictionaries. Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. ","version":"next","tagName":"h3"},{"title":"Constants and Immutability​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#constants-and-immutability","content":"OdraSolidity use odra::{casper_types::{account::AccountHash, U256}, Address}; #[odra::module] pub struct Constants; #[odra::module] impl Constants { pub const MY_UINT: U256 = U256([123, 0, 0, 0]); pub const MY_ADDRESS: Address = Address::Account( AccountHash([0u8; 32]) ); } In Odra, you can define constants using the const keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the immutable keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's immutable keyword. ","version":"next","tagName":"h3"},{"title":"Variables​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#variables","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, Var}; #[odra::module] pub struct Variables { text: Var<String>, my_uint: Var<U256>, } #[odra::module] impl Variables { pub fn init(&mut self) { self.text.set("Hello".to_string()); self.my_uint.set(U256::from(123)); } pub fn do_something(&self) { // Local variables let i = 456; // Env variables let timestamp = self.env().get_block_time(); let sender = self.env().caller(); } } In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ContractEnv retrieved using the env() function. ","version":"next","tagName":"h3"},{"title":"Arrays and Mappings​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#arrays-and-mappings","content":"OdraSolidity use odra::{casper_types::U256, Address, Mapping}; #[odra::module] pub struct MappingContract { my_map: Mapping<Address, Option<U256>> } #[odra::module] impl MappingContract { pub fn get(&self, addr: Address) -> U256 { // self.my_map.get(&addr) would return Option<Option<U256>> // so we use get_or_default instead and unwrap the inner Option self.my_map.get_or_default(&addr).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256) { self.my_map.set(&addr, Some(i)); } pub fn remove(&mut self, addr: Address) { self.my_map.set(&addr, None); } } #[odra::module] pub struct NestedMapping { my_map: Mapping<(Address, U256), Option<bool>> } #[odra::module] impl NestedMapping { pub fn get(&self, addr: Address, i: U256) -> bool { self.my_map.get_or_default(&(addr, i)).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256, boo: bool) { self.my_map.set(&(addr, i), Some(boo)); } pub fn remove(&mut self, addr: Address, i: U256) { self.my_map.set(&(addr, i), None); } } OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct Array { // the size of the array must be known at compile time arr: Var<[u8; 10]>, vec: Var<Vec<u32>>, } #[odra::module] impl Array { pub fn init(&mut self) { self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); self.vec.set(vec![1, 2, 3, 4, 5]); } pub fn get_arr(&self) -> [u8; 10] { self.arr.get_or_default() } pub fn push_vec(&mut self, value: u32) { let mut vec = self.vec.get_or_default(); vec.push(value); self.vec.set(vec); } pub fn pop_vec(&mut self) { let mut vec = self.vec.get_or_default(); vec.pop(); self.vec.set(vec); } pub fn update_arr(&mut self, index: u8, value: u8) { let mut arr = self.arr.get_or_default(); arr[index as usize] = value; self.arr.set(arr); } } For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the Var container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a Mapping or List instead of an array or vector to store data. ","version":"next","tagName":"h3"},{"title":"Custom types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#custom-types","content":"OdraSolidity use odra::{prelude::*, Var}; #[odra::odra_type] #[derive(Default)] pub enum Status { #[default] Pending, Shipped, Accepted, Rejected, Canceled, } #[odra::module] pub struct Enum { status: Var<Status>, } #[odra::module] impl Enum { pub fn get(&self) -> Status { self.status.get_or_default() } pub fn set(&mut self, status: Status) { self.status.set(status); } pub fn cancel(&mut self) { self.status.set(Status::Canceled); } pub fn reset(&mut self) { self.status.set(Default::default()); } } In Odra, custom types are defined using the #[odra::odra_type] attribute. The enum can have a default value specified using the #[default] attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the Default::default() function. OdraSolidity use odra::{prelude::*, List}; #[odra::odra_type] pub struct Todo { text: String, completed: bool, } #[odra::module] pub struct Enum { // You could also use Var<Vec<Todo>> instead of List<Todo>, // but List is more efficient for large arrays, // it loads items lazily. todos: List<Todo>, } #[odra::module] impl Enum { pub fn create(&mut self, text: String) { self.todos.push(Todo { text, completed: false, }); } pub fn update_text(&mut self, index: u32, text: String) { if let Some(mut todo) = self.todos.get(index) { todo.text = text; self.todos.replace(index, todo); } } pub fn toggle_complete(&mut self, index: u32) { if let Some(mut todo) = self.todos.get(index) { todo.completed = !todo.completed; self.todos.replace(index, todo); } } // Odra does not create getters by default pub fn get(&self, index: u32) -> Option<Todo> { self.todos.get(index) } } Similarly to enums, custom structs are defined using the #[odra::odra_type] attribute. The struct can be used to define a list of items in a contract. The list can be created using the List type, which is more efficient for large arrays as it loads items lazily. ","version":"next","tagName":"h3"},{"title":"Data Location​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#data-location","content":"In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be memory, storage, or calldata. In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., Var, Mapping, List), the data is stored in the contract's storage. ","version":"next","tagName":"h3"},{"title":"Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#functions","content":"Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function: impl Erc20 { pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.internal_transfer(&self.env().caller(), recipient, amount); // Transfer logic goes here } fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) { // Internal transfer logic goes here } } Functions can modify contract state and emit events using the ContractEnv function. ","version":"next","tagName":"h2"},{"title":"View and Pure​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#view-and-pure","content":"OdraSolidity use odra::Var; #[odra::module] pub struct ViewAndPure { x: Var<u32> } #[odra::module] impl ViewAndPure { pub fn add_to_x(&self, y: u32) -> u32 { self.x.get_or_default() + y } } pub fn add(i: u32, j: u32) -> u32 { i + j } In Odra, you don't need to specify view or pure functions explicitly. All functions are considered view functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be &mut self. If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects. ","version":"next","tagName":"h3"},{"title":"Modifiers​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#modifiers","content":"OdraSolidity use odra::Var; #[odra::module] pub struct FunctionModifier { x: Var<u32>, locked: Var<bool>, } #[odra::module] impl FunctionModifier { pub fn decrement(&mut self, i: u32) -> u32 { self.lock(); self.x.set(self.x.get_or_default() - i); if i > 1 { self.decrement(i - 1); } self.unlock(); } #[inline] fn lock(&mut self) { if self.locked.get_or_default() { self.env().revert("No reentrancy"); } self.locked.set(true); } #[inline] fn unlock(&mut self) { self.locked.set(false); } } In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the lock and unlock functions are called before and after the decrement function, respectively, but they must be called explicitly. As often as practicable, developers should inline functions by including the body of the function within their code using the #[inline] attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances. ","version":"next","tagName":"h3"},{"title":"Visibility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#visibility","content":"Functions and state variables have to declare whether they are accessible by other contracts. Functions can be declared as: OdraSolidity `pub` inside `#[odra::module]` impl block - any contract/submodule and account can call. `pub` inside a regular impl block - any submodule can call. `default/no modifier/private` - only inside the contract that defines the function. ","version":"next","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#payable","content":"OdraSolidity use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var}; #[odra::module] pub struct Payable { owner: Var<Address>, } #[odra::module] impl Payable { pub fn init(&mut self) { self.owner.set(self.env().caller()); } #[odra(payable)] pub fn deposit(&self) { } pub fn not_payable(&self) { } pub fn withdraw(&self) { let amount = self.env().self_balance(); self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount); } pub fn transfer(&self, to: Address, amount: U512) { self.env().transfer_tokens(&to, &amount); } } In Odra, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether. ","version":"next","tagName":"h3"},{"title":"Selectors​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#selectors","content":"In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector. contract_addr.call( abi.encodeWithSignature("transfer(address,uint256)", address, 1234) ) Odra does not support such a mechanism. You must have access to the contract interface to call a function. ","version":"next","tagName":"h3"},{"title":"Events and Logging​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#events-and-logging","content":"OdraSolidity use odra::{prelude::*, Address}; #[odra::event] pub struct Log { sender: Address, message: String, } #[odra::event] pub struct AnotherLog {} #[odra::module] struct Event; #[odra::module] impl Event { pub fn test(&self) { let env = self.env(); env.emit_event(Log { sender: env.caller(), message: "Hello World!".to_string(), }); env.emit_event(Log { sender: env.caller(), message: "Hello Casper!".to_string(), }); env.emit_event(AnotherLog {}); } } In Odra, events are regular structs defined using the #[odra::event] attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's emit_event() function, passing the event struct as an argument. note Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the Basics section. ","version":"next","tagName":"h2"},{"title":"Error Handling​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#error-handling","content":"OdraSolidity use odra::{prelude::*, casper_types::{U256, U512}}; #[odra::odra_error] pub enum CustomError { InsufficientBalance = 1, InputLowerThanTen = 2, } #[odra::module] pub struct Error; #[odra::module] impl Error { pub fn test_require(&mut self, i: U256) { if i <= 10.into() { self.env().revert(CustomError::InputLowerThanTen); } } pub fn execute_external_call(&self, withdraw_amount: U512) { let balance = self.env().self_balance(); if balance < withdraw_amount { self.env().revert(CustomError::InsufficientBalance); } } } In Solidity, there are four ways to handle errors: require, revert, assert, and custom errors. In Odra, there is only one way to revert the execution of a function - by using the env().revert() function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the #[odra::odra_error] attribute. On Casper, an error is only a number, so you can't pass a message with the error. ","version":"next","tagName":"h2"},{"title":"Composition vs. Inheritance​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#composition-vs-inheritance","content":"In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another. Let's take a look at the difference between inheritance in Solidity and composition in Odra. OdraSolidity use odra::{prelude::*, SubModule}; #[odra::module] pub struct A; #[odra::module] impl A { pub fn foo(&self) -> String { "A".to_string() } } #[odra::module] pub struct B { a: SubModule<A> } #[odra::module] impl B { pub fn foo(&self) -> String { "B".to_string() } } #[odra::module] pub struct C { a: SubModule<A> } #[odra::module] impl C { pub fn foo(&self) -> String { "C".to_string() } } #[odra::module] pub struct D { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl D { pub fn foo(&self) -> String { self.c.foo() } } #[odra::module] pub struct E { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl E { pub fn foo(&self) -> String { self.b.foo() } } #[odra::module] pub struct F { a: SubModule<A>, b: SubModule<B>, } #[odra::module] impl F { pub fn foo(&self) -> String { self.a.foo() } } Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers. In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts. ","version":"next","tagName":"h2"},{"title":"Libraries and Utility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#libraries-and-utility","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var}; mod math { use odra::casper_types::U256; pub fn sqrt(y: U256) -> U256 { let mut z = y; if y > 3.into() { let mut x = y / 2 + 1; while x < z { z = x; x = (y / x + x) / 2; } } else if y != U256::zero() { z = U256::one(); } z } } #[odra::module] struct TestMath; #[odra::module] impl TestMath { pub fn test_square_root(&self, x: U256) -> U256 { math::sqrt(x) } } #[odra::odra_error] enum Error { EmptyArray = 100, } trait Removable { fn remove(&mut self, index: usize); } impl Removable for Var<Vec<U256>> { fn remove(&mut self, index: usize) { let env = self.env(); let mut vec = self.get_or_default(); if vec.is_empty() { env.revert(Error::EmptyArray); } vec[index] = vec.pop().unwrap_or_revert(&env); self.set(vec); } } #[odra::module] struct TestArray { arr: Var<Vec<U256>>, } #[odra::module] impl TestArray { pub fn test_array_remove(&mut self) { let mut arr = self.arr.get_or_default(); for i in 0..3 { arr.push(i.into()); } self.arr.set(arr); self.arr.remove(1); let arr = self.arr.get_or_default(); assert_eq!(arr.len(), 2); assert_eq!(arr[0], 0.into()); assert_eq!(arr[1], 2.into()); } } In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the Math library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the TestMath contract calls the sqrt function directly, while the TestArray contract uses the using keyword, which extends the type uint256[] by adding the remove function. In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the Removable trait for the Var<Vec<U256>> type allows the remove function to be called on a variable that stores a vector of U256 values. ","version":"next","tagName":"h2"},{"title":"Fallback and Receive Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#fallback-and-receive-functions","content":"In Solidity, a contract receiving Ether must implement a receive() and/or fallback() function. The receive() function is called when Ether is sent to the contract with no data, while the fallback() function is called when the contract receives Ether with data or when a function that does not exist is called. Odra does not have a direct equivalent to the receive() and fallback() functions. Instead, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. ","version":"next","tagName":"h2"},{"title":"Miscellaneous​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#miscellaneous","content":"","version":"next","tagName":"h2"},{"title":"Hashing​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#hashing","content":"OdraSolidity use odra::{ casper_types::{bytesrepr::ToBytes, U256}, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct HashFunction; #[odra::module] impl HashFunction { pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] { let env = self.env(); let mut data = Vec::new(); data.extend(text.to_bytes().unwrap_or_revert(&env)); data.extend(num.to_bytes().unwrap_or_revert(&env)); data.extend(addr.to_bytes().unwrap_or_revert(&env)); env.hash(data) } } #[odra::module] pub struct GuessTheMagicWord { answer: Var<[u8; 32]>, } #[odra::module] impl GuessTheMagicWord { /// Initializes the contract with the magic word hash. pub fn init(&mut self) { self.answer.set([ 0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84, 0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55, 0xbe, 0xd7, 0x56, 0x08, ]); } /// Checks if the `word` is the magic word. pub fn guess(&self, word: String) -> bool { let env = self.env(); let hash = env.hash(word.to_bytes().unwrap_or_revert(&env)); hash == self.answer.get_or_default() } } The key difference between the two is that in Solidity, the keccak256 function is used to hash data, while in Odra, the env.hash() function is used, which implements the blake2b algorithm. Both functions take a byte array as input and return a 32-byte hash. ","version":"next","tagName":"h3"},{"title":"Try-catch​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#try-catch","content":"OdraSolidity use odra::{module::Module, Address, ContractRef, Var}; #[odra::module] pub struct Example { other_contract: Var<Address>, } #[odra::module] impl Example { pub fn init(&mut self, other_contract: Address) { self.other_contract.set(other_contract); } pub fn execute_external_call(&self) { if let Some(addr) = self.other_contract.get() { let result = OtherContractContractRef::new(self.env(), addr).some_function(); match result { Ok(success) => { // Code to execute if the external call was successful } Err(reason) => { // Code to execute if the external call failed } } } } } #[odra::module] pub struct OtherContract; #[odra::module] impl OtherContract { pub fn some_function(&self) -> Result<bool, ()> { Ok(true) } } In Solidity, try/catch is a feature that allows developers to handle exceptions and errors more gracefully. The try/catch statement allows developers to catch and handle exceptions that occur during external function calls and contract creation. In Odra, there is no direct equivalent to the try/catch statement in Solidity. However, you can use the Result type to handle errors in a similar way. The Result type is an enum that represents either success (Ok) or failure (Err). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts. ","version":"next","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/next/tutorials/odra-solidity#conclusion","content":"Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development. Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework. Read more about the Odra Framework in the Basics and Advanced sections. Learn by example with our Tutorial series, you will find there a contract you likely familiar with - the Erc20 standard implementation. If you have any further questions or need clarification on specific topics, feel free to join our Discord! ","version":"next","tagName":"h2"},{"title":"Migration guide to v0.9.0","type":0,"sectionRef":"#","url":"/docs/migrations/to-0.9.0","content":"","keywords":"","version":"1.0.0"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#1-prerequisites","content":"","version":"1.0.0","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"1.0.0","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.9.0. ","version":"1.0.0","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#2-migration-steps","content":"","version":"1.0.0","tagName":"h2"},{"title":"2.1 Update build_schema.rs bin​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#21-update-build_schemars-bin","content":"Odra 0.9.0 adds a new standardized way of generating contract schema - Casper Contract Schema. You can find the updated build_schema.rs file in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"1.0.0","tagName":"h3"},{"title":"2.2 Update smart contract code​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#22-update-smart-contract-code","content":"The main changes in the smart contract code are related to the way of defining custom types, events and errors. The following sections will guide you through the necessary changes. 2.2.1. Update custom types definitions.​ #[derive(OdraType)] attribute has been replace with #[odra::odra_type] attribute. 0.9.00.8.0 use odra::Address; #[odra::odra_type] pub struct Dog { pub name: String, pub age: u8, pub owner: Option<Address> } 2.2.2. Update errors definitions.​ #[derive(OdraError)] attribute has been replace with #[odra::odra_error] attribute. Error enum should be passed as a parameter to the #[odra::module] attribute. 0.9.00.8.0 #[odra::module(events = [/* events go here */], errors = Error)] pub struct Erc20 { // fields } #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.2.3. Update events definitions.​ #[derive(Event)] attribute has been replace with #[odra::event] attribute. 0.9.00.8.0 use odra::prelude::*; use odra::{Address, casper_types::U256}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } ","version":"1.0.0","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.9.0. 0.9.0Prev src/erc20.rs use crate::erc20::errors::Error; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer], errors = Error)] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(Error::NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(Error::InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(Error::InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address}; #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { #[odra::odra_error] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { // nothing changed in the tests } ","version":"1.0.0","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"1.0.0","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.9.0","url":"/docs/migrations/to-0.9.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"1.0.0","tagName":"h2"},{"title":"Deploying a Token on Casper Livenet","type":0,"sectionRef":"#","url":"/docs/tutorials/deploying-on-casper","content":"","keywords":"","version":"1.0.0"},{"title":"Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#casper-wallet","content":"We will be using Casper Wallet to do some tasks in this tutorial. To install it, please follow the instructions on theofficial website. After setting up the wallet, extract the private key of the account you want to use for our testing. You can do this by clicking on the Menu > Download account keys. danger You are solely responsible for the security of your private keys. We recommend creating a new account for the testing purposes. Why do we need the private key? We will use it in Odra to deploy our contract to the Casper network using Livenet backend. ","version":"1.0.0","tagName":"h2"},{"title":"Getting tokens​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#getting-tokens","content":"To deploy the contract on the Livenet, we need to have some CSPR. The easiest way to get them is to use the faucet, which will send us 1000 CSPR for free. Unfortunately, only on the Testnet. To use the faucet, go to the Casper Testnet Faucet. Log in using your Casper Wallet account and click on the "Request Tokens" button. note One account can request tokens only once. If you run out of tokens, you can either ask someone in the Casper community to send you some, or simply create a new account in the wallet. Now, when we have the tokens, we can deploy the contract. Let's do it using Odra! ","version":"1.0.0","tagName":"h2"},{"title":"Odra Livenet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#odra-livenet","content":"Odra Livenet is described in detail in thebackends section of this documentation. We will then briefly describe how to use set it up in this tutorial. In your contract code, create a new file in the bin folder: bin/our_token_livenet.rs //! Deploys a new OurToken contract on the Casper livenet and mints some tokens for the tutorial //! creator. use std::str::FromStr; use odra::casper_types::U256; use odra::host::{Deployer, HostEnv, HostRef, HostRefLoader}; use odra::Address; use ourcoin::token::{OurTokenHostRef, OurTokenInitArgs}; fn main() { // Load the Casper livenet environment. let env = odra_casper_livenet_env::env(); // Caller is the deployer and the owner of the private key. let owner = env.caller(); // Just some random address... let recipient = "hash-48bd92253a1370d1d913c56800296145547a243d13ff4f059ba4b985b1e94c26"; let recipient = Address::from_str(recipient).unwrap(); // Deploy new contract. let mut token = deploy_our_token(&env); println!("Token address: {}", token.address().to_string()); // Propose minting new tokens. env.set_gas(1_000_000_000u64); token.propose_new_mint(recipient, U256::from(1_000)); // Vote, we are the only voter. env.set_gas(1_000_000_000u64); token.vote(true, U256::from(1_000)); // Let's advance the block time by 11 minutes, as // we set the voting time to 10 minutes. // OH NO! It is the Livenet, so we need to wait real time... // Hopefully you are not in a hurry. env.advance_block_time(11 * 60 * 1000); // Tally the votes. env.set_gas(1_500_000_000u64); token.tally(); // Check the balances. println!("Owner's balance: {:?}", token.balance_of(&owner)); println!( "Tutorial creator's balance: {:?}", token.balance_of(&recipient) ); } /// Deploys a contract. pub fn deploy_our_token(env: &HostEnv) -> OurTokenHostRef { let name = String::from("OurToken"); let symbol = String::from("OT"); let decimals = 0; let initial_supply = U256::from(1_000); let init_args = OurTokenInitArgs { name, symbol, decimals, initial_supply, }; env.set_gas(300_000_000_000u64); OurTokenHostRef::deploy(env, init_args) } /// Loads a contract. Just in case you need to load an existing contract later... fn _load_cep18(env: &HostEnv) -> OurTokenHostRef { let address = "hash-XXXXX"; let address = Address::from_str(address).unwrap(); OurTokenHostRef::load(env, address) } In your Cargo.toml file, we need to add a new dependency, a feature and register the new binary. In the end, it should look like this: Cargo.toml [package] name = "ourcoin" version = "0.1.0" edition = "2021" [dependencies] odra = { version = "1.0.0", features = [], default-features = false } odra-modules = { version = "1.0.0", features = [], default-features = false } odra-casper-livenet-env = { version = "1.0.0", optional = true } [dev-dependencies] odra-test = { version = "1.0.0", features = [], default-features = false } [build-dependencies] odra-build = { version = "1.0.0", features = [], default-features = false } [features] default = [] livenet = ["odra-casper-livenet-env"] [[bin]] name = "ourcoin_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "ourcoin_build_schema" path = "bin/build_schema.rs" test = false [[bin]] name = "our_token_livenet" path = "bin/our_token_livenet.rs" required-features = ["livenet"] [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 Finally, add the .env file with the following content: .env # Path to the secret key of the account that will be used to deploy the contracts. ODRA_CASPER_LIVENET_SECRET_KEY_PATH=folder_with_your_secret_key/secret_key_file.pem # RPC address of the node that will be used to deploy the contracts. ODRA_CASPER_LIVENET_NODE_ADDRESS=http://138.201.80.141:7777 # Chain name of the network. ODRA_CASPER_LIVENET_CHAIN_NAME=casper-test Of course, you need to replace the secret key's path with the path to the secret key file you downloaded from the Casper Wallet. note One of the problems you may encounter is that the node you are using will be down or will not accept your calls. In this case, you will have to find and use another node IP address. Now, we will run our code: cargo run --bin our_token_livenet --features livenet If everything is set up correctly, you should see the output similar to this: Running `target/debug/our_token_livenet` 💁 INFO : Deploying "OurToken". 💁 INFO : Found wasm under "wasm/OurToken.wasm". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 🙄 WAIT : Waiting 15s for "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227". 💁 INFO : Deploy "e6b34772ebc3682702674102db87c633b0544242eafd5944e680371be4ea1227" successfully executed. 💁 INFO : Contract "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" deployed. Token address: hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "propose_new_mint". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 🙄 WAIT : Waiting 15s for "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361". 💁 INFO : Deploy "2f89cc96b6f8f05b88f8e75bef3a2f0ba39e9ab761693afff49e4112aa9d7361" successfully executed. 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "vote". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 🙄 WAIT : Waiting 15s for "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5". 💁 INFO : Deploy "aca9ae847cfcb97c81b4c64992515ff14d6f63a60f7c141558463f5b752058a5" successfully executed. 💁 INFO : advance_block_time called - Waiting for 660000 ms 💁 INFO : Calling "hash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857" with entrypoint "tally". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 🙄 WAIT : Waiting 15s for "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef". 💁 INFO : Deploy "223b135edbeadd88425183abaec0b0afb7d7770ffc57eba9054e3ea60e9e9cef" successfully executed. Owner's balance: 1000 Tutorial creator's balance: 1000 Congratulations, your contract is now deployed on the Casper network! Before we move on, note the address of the token! We will use it in the next section to interact with the token. In our case it ishash-565bd0bde39c8c3dd79e49c037e05eac8add2b2193e86a91a6bac068e0de7857. ","version":"1.0.0","tagName":"h2"},{"title":"Cspr.live​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#csprlive","content":"The first thing we will do is to explore Casper's network block explorer,cspr.live. We can put the address of our token in the search bar to find it. note If you deployed your contract on the Testnet, remember to make sure that the Testnet network is selected in the dropdown menu in the top right corner. If everything is set up correctly, you should see the contract package's details. Besides the owner, keys etc., you can also see the contract's metdata, if it was developed using a standard that cspr.live supports. Indeed, we can see that it detected that our contract is a CEP-18 token! We see the name, symbol and total supply. All the mentions of the contract on the website will use the token name instead of the contract address. Additionally, on the Token Txs tab, we can see the transactions that happened with the token. We can see the minting transaction we did in the previous section and transfers done during the voting process. If we click on one of the accounts that recieved the tokens, we will go to the account page. Here, on the Tokens tab, we can see all the tokens that the account has - and OurToken is one of them! If you wish, you can check the status of the contract deployed during the development of this tutorial here. ","version":"1.0.0","tagName":"h2"},{"title":"Transferring Tokens using Casper Wallet​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#transferring-tokens-using-casper-wallet","content":"Casper wallet can do much more than just logging in to the faucet, exporting the private keys and transferring CSPR. It can also interact with the contracts deployed on the network. If you deployed the contract and left some OT tokens to yourself, you should see them in the Casper Wallet window. You should also be able to transfer them to another account! ","version":"1.0.0","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Deploying a Token on Casper Livenet","url":"/docs/tutorials/deploying-on-casper#conclusion","content":"We've successfully deployed a token on the Casper network and interacted with it using the Odra backend and Casper Wallet. We've also learned how to use the cspr.live block explorer to check the status of your contract. Odra, Cspr.live and Casper Wallet are just a few of the tools that the Casper ecosystem provides. Feel free to explore them on casperecosystem.io. ","version":"1.0.0","tagName":"h2"},{"title":"Migration guide to v0.8.0","type":0,"sectionRef":"#","url":"/docs/migrations/to-0.8.0","content":"","keywords":"","version":"1.0.0"},{"title":"1. Prerequisites​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#1-prerequisites","content":"","version":"1.0.0","tagName":"h2"},{"title":"1.1. Update cargo-odra​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#11-update-cargo-odra","content":"Before you begin the migration process, make sure you installed the latest version of the Cargo Odra toolchain. You can install it by running the following command: cargo install cargo-odra --force --locked ","version":"1.0.0","tagName":"h3"},{"title":"1.2. Review the Changelog​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#12-review-the-changelog","content":"Before you move to changing your code, start by reviewing the Changelog to understand the changes introduced in v0.8.0. ","version":"1.0.0","tagName":"h3"},{"title":"2. Migration Steps​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#2-migration-steps","content":"","version":"1.0.0","tagName":"h2"},{"title":"2.1 Add bin directory​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#21-add-bin-directory","content":"Odra 0.8.0 introduces a new way to build smart contracts. The .builder_casper directory is no longer used. Instead, you should create a new directory called bin in the root of your project and add the build_contract.rs and build_schema.rs files to the bin directory. You can find the build_contract.rs and build_schema.rs files in templates directory in the Odra main repository. You can choose whatever template you want to use and copy the files to your project. In both files, you should replace {{project-name}} with the name of your project. ","version":"1.0.0","tagName":"h3"},{"title":"2.2. Update Cargo.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#22-update-cargotoml","content":"There a bunch of changes in the Cargo.toml file. You don't have to specify the features anymore - remove the features section and default-features flag from the odra dependency.Register bins you added in the previous step.Add dev-dependencies section with odra-test crate.Add recommended profiles for release and dev to optimize the build process. Below you can compare the Cargo.toml file after and before the migration to v0.8.0: 0.8.0Prev [package] name = "my_project" version = "0.1.0" edition = "2021" [dependencies] odra = "0.8.0" [dev-dependencies] odra-test = "0.8.0" [[bin]] name = "my_project_build_contract" path = "bin/build_contract.rs" test = false [[bin]] name = "my_project_build_schema" path = "bin/build_schema.rs" test = false [profile.release] codegen-units = 1 lto = true [profile.dev.package."*"] opt-level = 3 ","version":"1.0.0","tagName":"h3"},{"title":"2.2. Update Odra.toml​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#22-update-odratoml","content":"Due to the changes in cargo-odra, the Odra.toml file has been simplified. The name property is no longer required. 0.8.0Prev [[contracts]] fqn = "my_project::Flipper" ","version":"1.0.0","tagName":"h3"},{"title":"2.3. Update Smart Contracts​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#23-update-smart-contracts","content":"The smart contracts themselves will need to be updated to work with the new version of the framework. The changes will depend on the specific features and APIs used in the contracts. Here are some common changes you might need to make: 2.3.1. Update the use statements to reflect the new module structure.​ Big integer types are now located in the odra::casper_types module.odra::types::Address is now odra::Address.Variable is now Var.Remove odra::contract_env.Remove odra::types::event::OdraEvent.Remove odra::types::OdraType as it is no longer required.Change odra::types::casper_types::*; to odra::casper_types::*;. 2.3.2. Some type aliases are no longer in use.​ Balance - use odra::casper_types::U512.BlockTime - use u64.EventData - use odra::casper_types::bytesrepr::Bytes. 2.3.3. Consider import odra::prelude::* in your module files.​ 2.3.4. Flatten nested Mappings.​ // Before #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<Address, Mapping<Address, U256>> } // After #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { ... allowances: Mapping<(Address, Address), U256> } 2.3.5. Update errors definitions.​ execution_error! macro has been replace with OdraError derive macro. 0.8.0Prev use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } 2.3.6. Update events definitions.​ 0.8.0Prev use odra::prelude::*; use odra::Event; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } // Emitting the event self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); 2.3.7. Replace contract_env with self.env() in your modules.​ self.env() is a new way to access the contract environment, returns a reference to ContractEnv. The API is similar to the previous contract_env but with some changes. fn get_var<T: FromBytes>(key: &[u8]) -> Option<T> is now fn get_value<T: FromBytes>(&self, key: &[u8]) -> Option<T>.fn set_var<T: CLTyped + ToBytes>(key: &[u8], value: T) is now fn set_value<T: ToBytes + CLTyped>(&self, key: &[u8], value: T).set_dict_value() and get_dict_value() has been removed. All the dictionary operations should be performed using Mapping type, internally using set_var() and get_var() functions. fn hash<T: AsRef<[u8]>>(input: T) -> Vec<u8> is now fn hash<T: ToBytes>(&self, value: T) -> [u8; 32].fn revert<E: Into<ExecutionError>>(error: E) -> ! is now fn revert<E: Into<OdraError>>(&self, error: E) -> !.fn emit_event<T: ToBytes + OdraEvent>(event: T) is now fn emit_event<T: ToBytes>(&self, event: T).fn call_contract<T: CLTyped + FromBytes>(address: Address, entrypoint: &str, args: &RuntimeArgs, amount: Option<U512>) -> T is now fn call_contract<T: FromBytes>(&self, address: Address, call: CallDef) -> T.functions native_token_metadata() and one_token() have been removed. 2.3.8. Wrap submodules of your module with odra::SubModule<T>.​ 0.8.0Prev #[odra::module(events = [Transfer])] pub struct Erc721Token { core: SubModule<Erc721Base>, metadata: SubModule<Erc721MetadataExtension>, ownable: SubModule<Ownable> } 2.3.9. Update external contract calls.​ However the definition of an external contract remains the same, the way you call it has changed. A reference to an external contract is named {{ModuleName}}ContractRef (former {{ModuleName}}Ref) and you can call it using {{ModuleName}}ContractRef::new(env, address) (former {{ModuleName}}Ref::at()). 0.8.0Prev #[odra::external_contract] pub trait Token { fn balance_of(&self, owner: &Address) -> U256; } // Usage TokenContractRef::new(env, token).balance_of(account) 2.3.10. Update constructors.​ Remove the #[odra::init] attribute from the constructor and ensure that the constructor function is named init. 2.3.11. Update UnwrapOrRevert calls.​ The functions unwrap_or_revert and unwrap_or_revert_with now require &HostEnv as the first parameter. 2.3.12. Remove #[odra(using)] attribute from your module definition.​ Sharing the same instance of a module is no longer supported. A redesign of the module structure might be required. ","version":"1.0.0","tagName":"h3"},{"title":"2.4. Update Tests​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#24-update-tests","content":"Once you've updated your smart contracts, you'll need to update your tests to reflect the changes. The changes will depend on the specific features and APIs used in the tests. Here are some common changes you might need to make: 2.4.1. Contract deployment.​ The way you deploy a contract has changed: You should use {{ModuleName}}HostRef::deploy(&env, args) instead of {{ModuleName}}Deployer::init(). The {{ModuleName}}HostRef implements odra::host::Deployer.Instantiate the HostEnv using odra_test::env(), required by the odra::host::Deployer::deploy() function.If the contract doesn't have init args, you should use odra::host::NoArgs as the second argument of the deploy function.If the contract has init args, you should pass the autogenerated {{ModuleName}}InitArgs as the second argument of the deploy function. 0.8.0Prev // A contract without init args use super::OwnableHostRef; use odra::host::{Deployer, HostEnv, HostRef, NoArgs}; let env: HostEnv = odra_test::env(); let ownable = OwnableHostRef::deploy(&env, NoArgs) // A contract with init args use super::{Erc20HostRef, Erc20InitArgs}; use odra::host::{Deployer, HostEnv}; let env: HostEnv = odra_test::env(); let init_args = Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) }; let erc20 = Erc20HostRef::deploy(&env, init_args); 2.4.2. Host interactions.​ Replace odra::test_env with odra_test::env().The API of odra::test_env and odra_test::env() are similar, but there are some differences: test_env::advance_block_time_by(BlockTime) is now env.advance_block_time(u64).test_env::token_balance(Address) is now env.balance_of(&Address).functions test_env::last_call_contract_gas_cost(), test_env::last_call_contract_gas_used(), test_env::total_gas_used(Address), test_env::gas_report() have been removed. You should use HostRef::last_call() and extract the data from a odra::ContractCallResult instance. HostRef is a trait implemented by {{ModuleName}}HostRef. 2.4.3. Testing failing scenarios.​ test_env::assert_exception() has been removed. You should use the try_ prefix to call the function and then assert the result.try_ prefix is a new way to call a function that might fail. It returns a OdraResult type, which you can then assert using the standard Rust assert_eq! macro. 0.8.0Prev #[test] fn transfer_from_error() { let (env, mut erc20) = setup(); let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); assert_eq!( erc20.try_transfer_from(owner, recipient, amount), Err(Error::InsufficientAllowance.into()) ); } 2.4.4. Testing events.​ assert_events! macro has been removed. You should use HostEnv::emitted_event() to assert the emitted events. The new API doesn't allow to assert multiple events at once, but adds alternative ways to assert the emitted events. Check the HostEnv documentation to explore the available options. 0.8.0Prev let env: HostEnv = odra_test::env(); let erc20 = Erc20HostRef::deploy(&env, init_args); ... assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); ","version":"1.0.0","tagName":"h3"},{"title":"3. Code Examples​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#3-code-examples","content":"Here is a complete example of a smart contract after and before the migration to v0.8.0. 0.8.0Prev src/erc20.rs use crate::erc20::errors::Error::*; use crate::erc20::events::*; use odra::prelude::*; use odra::{casper_types::U256, Address, Mapping, Var}; #[odra::module(events = [Approval, Transfer])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } #[odra::module] impl Erc20 { pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256> ) { let caller = self.env().caller(); self.symbol.set(symbol); self.name.set(name); self.decimals.set(decimals); if let Some(initial_supply) = initial_supply { self.total_supply.set(initial_supply); self.balances.set(&caller, initial_supply); if !initial_supply.is_zero() { self.env().emit_event(Transfer { from: None, to: Some(caller), amount: initial_supply }); } } } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn name(&self) -> String { self.name.get_or_revert_with(NameNotSet) } // Other getter functions... pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } pub fn mint(&mut self, address: &Address, amount: &U256) { self.total_supply.add(*amount); self.balances.add(address, *amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } pub fn burn(&mut self, address: &Address, amount: &U256) { if self.balance_of(address) < *amount { self.env().revert(InsufficientBalance); } self.total_supply.subtract(*amount); self.balances.subtract(address, *amount); self.env().emit_event(Transfer { from: Some(*address), to: None, amount: *amount }); } } impl Erc20 { fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { if *amount > self.balances.get_or_default(owner) { self.env().revert(InsufficientBalance) } self.balances.subtract(owner, *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowances.get_or_default(&(*owner, *spender)); if allowance < *amount { self.env().revert(InsufficientAllowance) } self.allowances.subtract(&(*owner, *spender), *amount); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } pub mod events { use odra::prelude::*; use odra::{casper_types::U256, Address, Event}; #[derive(Event, Eq, PartialEq, Debug)] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } #[derive(Event, Eq, PartialEq, Debug)] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } } pub mod errors { use odra::OdraError; #[derive(OdraError)] pub enum Error { InsufficientBalance = 30_000, InsufficientAllowance = 30_001, NameNotSet = 30_002, SymbolNotSet = 30_003, DecimalsNotSet = 30_004 } } #[cfg(test)] mod tests { use super::{ errors::Error, events::{Approval, Transfer}, Erc20HostRef, Erc20InitArgs }; use odra::{ casper_types::U256, host::{Deployer, HostEnv, HostRef}, prelude::* }; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: Some(INITIAL_SUPPLY.into()) } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } // Other tests... } ","version":"1.0.0","tagName":"h2"},{"title":"4. Troubleshooting​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#4-troubleshooting","content":"If you encounter any further issues after completing the migration steps, please don't hesitate to reach out to us on Discord or explore the other sections this documentation. You can also refer to the technical documentation for more detailed information. Additionally, our examples repository offers a wide range of examples to assist you in understanding the new features and APIs. Be sure to carefully review any compilation errors and warnings, as they may provide valuable insights into the necessary adjustments. ","version":"1.0.0","tagName":"h2"},{"title":"5. References​","type":1,"pageTitle":"Migration guide to v0.8.0","url":"/docs/migrations/to-0.8.0#5-references","content":"ChangelogOdra DocumentationDocs.rsExamples ","version":"1.0.0","tagName":"h2"},{"title":"CEP-18","type":0,"sectionRef":"#","url":"/docs/tutorials/cep18","content":"","keywords":"","version":"1.0.0"},{"title":"Self-governing token​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#self-governing-token","content":"There are many ways to implement a governance mechanism for a token, each more complex than the other. In our example, we will use a simple one, where the community of token holders can vote to mint new tokens. ","version":"1.0.0","tagName":"h2"},{"title":"Token implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#token-implementation","content":"Let's start by creating a new project, choosing a clever name and using cep18 as our starting template: cargo odra new --name ourcoin --template cep18 Let's glance at our token code: src/token.rs #[odra::module] pub struct MyToken { token: SubModule<Cep18>, } impl MyToken { // Delegate all Cep18 functions to the token sub-module. delegate! { to self.token { ... fn name(&self) -> String; fn symbol(&self) -> String; ... As we can see, it indeed uses the Cep18 module and delegates all the methods to it. The only thing to do is to change the name of the struct to more appropriate OurToken, run the provided tests using cargo odra test, and continue with the implementation of the governance. note Remember to change the name of the struct and its usages as well as the struct name in the Odra.toml file! ","version":"1.0.0","tagName":"h2"},{"title":"Governance implementation​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#governance-implementation","content":"Let's go through the process of implementing the governance mechanism. If we don't want to, we don't have to hide entrypoints from the public responsible for minting new tokens. By default, minting Modalityis turned off, so any attempt of direct minting will result in an error. We will however implement a voting mechanism, where the token holders can vote to mint new tokens. ","version":"1.0.0","tagName":"h2"},{"title":"Voting mechanism​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#voting-mechanism","content":"Our voting system will be straightforward: Anyone with the tokens can propose a new mint.Anyone with the tokens can vote for the new mint by staking their tokens.If the majority of the token holders vote for the mint, it is executed. Storage​ We will need to store some additional information about the votes, so let's add some fields to our token struct: src/token.rs #[odra::module] pub struct OurToken { /// A sub-module that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } Notice that proposed_mint contains a tuple containing the address of the proposer and the amount of tokens to mint. Moreover, we need to keep track if the vote time has ended, but also if it was already tallied, that's why we need both is_vote_open and vote_end_time. We will also use the power of the Listtype to store the Ballots. Proposing a new mint​ To implement the endpoint that allows token holders to propose a new mint, we need to add a new function to our token module: src/token.rs /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open().get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env().revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 60 * 10 * 1000); } As a parameters to the function, we pass the address of the account that should be the receiver of the minted tokens, and the amount. After some validation, we open the vote by setting the is_vote_open to true, and setting the vote_end_time to 10 minutes. In real-world scenarios, the time could be configurable, but for the sake of simplicity, we hardcoded it. Also, it should be quite longer than 10 minutes, but it will come in handy when we test it on Livenet. Voting for the mint​ Next, we need an endpoint that will allow us to cast a ballot: src/token.rs /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token .transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } The most interesting thing here is that we are using a mechanism of staking, where we transfer our tokens to the contract, to show that we really mean it. The tokens will be locked until the vote is over, and tallied. Speaking of tallying... Tallying the votes​ The last step is to tally the votes and mint the tokens if the majority of voters agreed to do so: src/token.rs /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token.raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } Notice how we used raw_transfer from the Cep18 module. We used it to set the sender, so the contract's balance will be used, instead of the caller's. Additonally, we used raw_mint to mint the tokens, skipping the security checks. We have no modality for minting, but even if we had, we don't have anyone with permissions! The Contract needs to mint the tokens itself. ","version":"1.0.0","tagName":"h3"},{"title":"Testing​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#testing","content":"Now, we will put our implementation to the test. One unit test, that we can run both on OdraVM and on the CasperVM. src/token.rs #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } We can run the test using both methods: cargo odra test cargo odra test -b casper It is all nice and green, but it would be really nice to see it in action. How about deploying it on the Casper network? ","version":"1.0.0","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#whats-next","content":"We will se our token in action, by deploying it on the Casper network, and using tools from the Casper Ecosystem to interact with it. ","version":"1.0.0","tagName":"h2"},{"title":"Complete code​","type":1,"pageTitle":"CEP-18","url":"/docs/tutorials/cep18#complete-code","content":"Here is the complete code of the OurToken module: src/token.rs use odra::{casper_types::U256, prelude::*, Address, List, SubModule, Var}; use odra_modules::cep18_token::Cep18; /// A ballot cast by a voter. #[odra::odra_type] struct Ballot { voter: Address, choice: bool, amount: U256, } /// Errors for the governed token. #[odra::odra_error] pub enum GovernanceError { /// The vote is already in progress. VoteAlreadyOpen = 0, /// No vote is in progress. NoVoteInProgress = 1, /// Cannot tally votes yet. VoteNotYetEnded = 2, /// Vote ended VoteEnded = 3, /// Only the token holders can propose a new mint. OnlyTokenHoldersCanPropose = 4, } /// A module definition. Each module struct consists of Vars and Mappings /// or/and other modules. #[odra::module] pub struct OurToken { /// A submodule that implements the CEP-18 token standard. token: SubModule<Cep18>, /// The proposed mint. proposed_mint: Var<(Address, U256)>, /// The list of votes cast in the current vote. votes: List<Ballot>, /// Whether a vote is open. is_vote_open: Var<bool>, /// The time when the vote ends. vote_end_time: Var<u64>, } /// Module implementation. /// /// To generate entrypoints, /// an implementation block must be marked as #[odra::module]. #[odra::module] impl OurToken { /// Initializes the contract with the given metadata and initial supply. pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { // We put the token address as an admin, so it can govern itself. Self-governing token! self.token .init(symbol, name, decimals, initial_supply, vec![], vec![], None); } // Delegate all Cep18 functions to the token submodule. delegate! { to self.token { /// Admin EntryPoint to manipulate the security access granted to users. /// One user can only possess one access group badge. /// Change strength: None > Admin > Minter /// Change strength meaning by example: If a user is added to both Minter and Admin, they will be an /// Admin, also if a user is added to Admin and None then they will be removed from having rights. /// Beware: do not remove the last Admin because that will lock out all admin functionality. fn change_security( &mut self, admin_list: Vec<Address>, minter_list: Vec<Address>, none_list: Vec<Address> ); /// Returns the name of the token. fn name(&self) -> String; /// Returns the symbol of the token. fn symbol(&self) -> String; /// Returns the number of decimals the token uses. fn decimals(&self) -> u8; /// Returns the total supply of the token. fn total_supply(&self) -> U256; /// Returns the balance of the given address. fn balance_of(&self, address: &Address) -> U256; /// Returns the amount of tokens the owner has allowed the spender to spend. fn allowance(&self, owner: &Address, spender: &Address) -> U256; /// Approves the spender to spend the given amount of tokens on behalf of the caller. fn approve(&mut self, spender: &Address, amount: &U256); /// Decreases the allowance of the spender by the given amount. fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256); /// Increases the allowance of the spender by the given amount. fn increase_allowance(&mut self, spender: &Address, inc_by: &U256); /// Transfers tokens from the caller to the recipient. fn transfer(&mut self, recipient: &Address, amount: &U256); /// Transfers tokens from the owner to the recipient using the spender's allowance. fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256); /// Mints new tokens and assigns them to the given address. fn mint(&mut self, owner: &Address, amount: &U256); /// Burns the given amount of tokens from the given address. fn burn(&mut self, owner: &Address, amount: &U256); } } /// Proposes a new mint for the contract. pub fn propose_new_mint(&mut self, account: Address, amount: U256) { // Only allow proposing a new mint if there is no vote in progress. if self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::VoteAlreadyOpen); } // Only the token holders can propose a new mint. if self.balance_of(&self.env().caller()) == U256::zero() { self.env() .revert(GovernanceError::OnlyTokenHoldersCanPropose); } // Set the proposed mint. self.proposed_mint.set((account, amount)); // Open a vote. self.is_vote_open.set(true); // Set the vote end time to 10 minutes from now. self.vote_end_time .set(self.env().get_block_time() + 10 * 60 * 1000); } /// Votes on the proposed mint. pub fn vote(&mut self, choice: bool, amount: U256) { // Only allow voting if there is a vote in progress. self.assert_vote_in_progress(); let voter = self.env().caller(); let contract = self.env().self_address(); // Transfer the voting tokens from the voter to the contract. self.token.transfer(&contract, &amount); // Add the vote to the list. self.votes.push(Ballot { voter, choice, amount, }); } /// Count the votes and perform the action pub fn tally(&mut self) { // Only allow tallying the votes once. if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } // Only allow tallying the votes after the vote has ended. let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() < finish_time { self.env().revert(GovernanceError::VoteNotYetEnded); } // Count the votes let mut yes_votes = U256::zero(); let mut no_votes = U256::zero(); let contract = self.env().self_address(); while let Some(vote) = self.votes.pop() { if vote.choice { yes_votes += vote.amount; } else { no_votes += vote.amount; } // Transfer back the voting tokens to the voter. self.token .raw_transfer(&contract, &vote.voter, &vote.amount); } // Perform the action if the vote has passed. if yes_votes > no_votes { let (account, amount) = self .proposed_mint .get_or_revert_with(GovernanceError::NoVoteInProgress); self.token.raw_mint(&account, &amount); } // Close the vote. self.is_vote_open.set(false); } fn assert_vote_in_progress(&self) { if !self.is_vote_open.get_or_default() { self.env().revert(GovernanceError::NoVoteInProgress); } let finish_time = self .vote_end_time .get_or_revert_with(GovernanceError::NoVoteInProgress); if self.env().get_block_time() > finish_time { self.env().revert(GovernanceError::VoteEnded); } } } #[cfg(test)] mod tests { use super::*; use odra::host::Deployer; #[test] fn it_works() { let env = odra_test::env(); let init_args = OurTokenInitArgs { name: "OurToken".to_string(), symbol: "OT".to_string(), decimals: 0, initial_supply: U256::from(1_000u64), }; let mut token = OurTokenHostRef::deploy(&env, init_args); // The deployer, as the only token holder, // starts a new voting to mint 1000 tokens to account 1. // There is only 1 token holder, so there is one Ballot cast. token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(1000)); // The tokens should now be staked. assert_eq!(token.balance_of(&env.get_account(0)), U256::zero()); // Wait for the vote to end. env.advance_block_time(60 * 11 * 1000); // Finish the vote. token.tally(); // The tokens should now be minted. assert_eq!(token.balance_of(&env.get_account(1)), U256::from(2000)); assert_eq!(token.total_supply(), 3000.into()); // The stake should be returned. assert_eq!(token.balance_of(&env.get_account(0)), U256::from(1000)); // Now account 1 can mint new tokens with their voting power... env.set_caller(env.get_account(1)); token.propose_new_mint(env.get_account(1), U256::from(2000)); token.vote(true, U256::from(2000)); // ...Even if the deployer votes against it. env.set_caller(env.get_account(0)); token.vote(false, U256::from(1000)); env.advance_block_time(60 * 11 * 1000); token.tally(); // The power of community governance! assert_eq!(token.balance_of(&env.get_account(1)), U256::from(4000)); } } ","version":"1.0.0","tagName":"h2"},{"title":"Build, Deploy and Read the State of a Contract","type":0,"sectionRef":"#","url":"/docs/tutorials/build-deploy-read","content":"","keywords":"","version":"1.0.0"},{"title":"Contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#contract","content":"Let's write a contract with complex storage layout. The contract stores a plain numeric value, a custom nested type and a submodule with another submodule with stores a Mapping. We will expose two methods: The constructor init which sets the metadata and the version of the contract.The method set_data which sets the value of the numeric field and the values of the mapping. custom_item.rs use odra::{casper_types::U256, prelude::*, Mapping, SubModule, Var}; // A custom type with a vector of another custom type #[odra::odra_type] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[odra::odra_type] pub struct Price { value: U256, } // The main contract with a version, metadata and a submodule #[odra::module] pub struct CustomItem { version: Var<u32>, meta: Var<Metadata>, data: SubModule<Data> } #[odra::module] impl CustomItem { pub fn init(&mut self, name: String, description: String, price_1: U256, price_2: U256) { let meta = Metadata { name, description, prices: vec![ Price { value: price_1 }, Price { value: price_2 } ] }; self.meta.set(meta); self.version.set(self.version.get_or_default() + 1); } pub fn set_data(&mut self, value: u32, name: String, name2: String) { self.data.value.set(value); self.data.inner.named_values.set(&name, 10); self.data.inner.named_values.set(&name2, 20); } } // A submodule with a numeric value and another submodule #[odra::module] struct Data { value: Var<u32>, inner: SubModule<InnerData>, } // A submodule with a mapping #[odra::module] struct InnerData { named_values: Mapping<String, u32>, } ","version":"1.0.0","tagName":"h3"},{"title":"Deploying the contract​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#deploying-the-contract","content":"First, we need to setup the chain. We will use the NCTL docker image to run a local network. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Next, we need to compile the contract to a Wasm file. cargo odra build -c custom_item Then, we can deploy the contract using the casper-client tool. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key path/to/your/secret_key.pem \\ --session-path [PATH_TO_WASM] \\ --payment-amount 100000000000 \\ --session-arg "odra_cfg_package_hash_key_name:string:'test_contract_package_hash'" \\ --session-arg "odra_cfg_allow_key_override:bool:'true'" \\ --session-arg "odra_cfg_is_upgradable:bool:'true'" \\ --session-arg "name:string='My Name'" \\ --session-arg "description:string='My Description'" \\ --session-arg "price_1:u256='101'" \\ --session-arg "price_2:u256='202'" Finally, we can call the set_data method to set the values of the contract. casper-client put-deploy \\ --node-address http://localhost:11101 \\ --chain-name casper-net-1 \\ --secret-key ./keys/secret_key.pem \\ --payment-amount 2000000000 \\ --session-hash [DEPLOYED_CONTRACT_HASH] \\ --session-entry-point "set_data" \\ --session-arg "value:u32:'666'" \\ --session-arg "name:string='alice'" \\ --session-arg "name2:string='bob'" ","version":"1.0.0","tagName":"h3"},{"title":"Storage Layout​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#storage-layout","content":"To read the state of the contract, we need to understand the storage layout. The first step is to calculate the index of the keys. Storage Layout CustomItem: prefix: 0x0..._0000_0000_0000 0 version: u32, 0x0..._0000_0000_0001 1 meta: Metadata, 0x0..._0000_0000_0010 2 data: Data: prefix: 0x0..._0000_0000_0011 3 value: u32, 0x0..._0000_0011_0001 (3 << 4) + 1 inner: InnerData: prefix: 0x0..._0000_0011_0010 (3 << 4) + 2 named_values: Mapping 0x0..._0011_0010_0001 ((3 << 4) + 2) << 4 + 1 The actual key is obtained as follows: Convert the index to a big-endian byte array.Concatenate the index with the mapping data.Hash the concatenated bytes using blake2b.Return the hex representation of the hash (the stored key must be utf-8 encoded). In more detail, the storage layout is described in the Storage Layout article. ","version":"1.0.0","tagName":"h3"},{"title":"Reading the state​","type":1,"pageTitle":"Build, Deploy and Read the State of a Contract","url":"/docs/tutorials/build-deploy-read#reading-the-state","content":"RustTypeScript main.rs use casper_client::{rpcs::DictionaryItemIdentifier, types::StoredValue, Verbosity}; use casper_types::{ bytesrepr::{FromBytes, ToBytes}, U256, }; // replace with your contract hash const CONTRACT_HASH: &str = "hash-..."; const NODE_ADDRESS: &str = "http://localhost:11101/rpc"; const RPC_ID: &str = "casper-net-1"; const DICTIONARY_NAME: &str = "state"; #[derive(Debug, PartialEq, Eq, Hash)] pub struct Metadata { name: String, description: String, prices: Vec<Price>, } #[derive(Debug, PartialEq, Eq, Hash)] pub struct Price { value: U256, } async fn read_state_key(key: String) -> Vec<u8> { let state_root_hash = casper_client::get_state_root_hash( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, None, ) .await .unwrap() .result .state_root_hash .unwrap(); // Read the value from the `state` dictionary. let result = casper_client::get_dictionary_item( RPC_ID.to_string().into(), NODE_ADDRESS, Verbosity::Low, state_root_hash, DictionaryItemIdentifier::ContractNamedKey { key: CONTRACT_HASH.to_string(), dictionary_name: DICTIONARY_NAME.to_string(), dictionary_item_key: key, }, ) .await .unwrap() .result .stored_value; // We expect the value to be a CLValue if let StoredValue::CLValue(cl_value) = result { // Ignore the first 4 bytes, which are the length of the CLType. cl_value.inner_bytes()[4..].to_vec() } else { vec![] } } async fn metadata() -> Metadata { // The key for the metadata is 2, and it has no mapping data let key = key(2, &[]); let bytes = read_state_key(key).await; // Read the name and store the remaining bytes let (name, bytes) = String::from_bytes(&bytes).unwrap(); // Read the description and store the remaining bytes let (description, bytes) = String::from_bytes(&bytes).unwrap(); // A vector is stored as a u32 size followed by the elements // Read the size of the vector and store the remaining bytes let (size, mut bytes) = u32::from_bytes(&bytes).unwrap(); let mut prices = vec![]; // As we know the size of the vector, we can loop over it for _ in 0..size { // Read the value and store the remaining bytes let (value, rem) = U256::from_bytes(&bytes).unwrap(); bytes = rem; prices.push(Price { value }); } // Anytime you finish parsing a value, you should check if there are any remaining bytes // if there are, it means you have a bug in your parsing logic. // For simplicity, we will ignore the remaining bytes here. Metadata { name, description, prices } } async fn value() -> u32 { // The key for the value is (3 << 4) + 1, and it has no mapping data let key = key((3 << 4) + 1, &[]); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } async fn named_value(name: &str) -> u32 { // The key for the named value is (((3 << 4) + 2) << 4) + 1, and the mapping data is the name as bytes let mapping_data = name.to_bytes().unwrap(); let key = key((((3 << 4) + 2) << 4) + 1, &mapping_data); let bytes = read_state_key(key).await; // Read the value and ignore the remaining bytes for simplicity u32::from_bytes(&bytes).unwrap().0 } fn main() { let runtime = tokio::runtime::Runtime::new().unwrap(); dbg!(runtime.block_on(metadata())); dbg!(runtime.block_on(value())); dbg!(runtime.block_on(named_value("alice"))); dbg!(runtime.block_on(named_value("bob"))); } // The key is a combination of the index and the mapping data // The algorithm is as follows: // 1. Convert the index to a big-endian byte array // 2. Concatenate the index with the mapping data // 3. Hash the concatenated bytes using blake2b // 4. Return the hex representation of the hash (the stored key must be utf-8 encoded) fn key(idx: u32, mapping_data: &[u8]) -> String { let mut key = Vec::new(); key.extend_from_slice(idx.to_be_bytes().as_ref()); key.extend_from_slice(mapping_data); let hashed_key = blake2b(&key); hex::encode(&hashed_key) } fn blake2b(bytes: &[u8]) -> [u8; 32] { let mut result = [0u8; 32]; let mut hasher = <blake2::Blake2bVar as blake2::digest::VariableOutput>::new(32) .expect("should create hasher"); let _ = std::io::Write::write(&mut hasher, bytes); blake2::digest::VariableOutput::finalize_variable(hasher, &mut result) .expect("should copy hash to the result array"); result } cargo run [src/main.rs:116:5] runtime.block_on(metadata()) = Metadata { name: "My Contract", description: "My Description", prices: [ Price { value: 123, }, Price { value: 321, }, ], } [src/main.rs:117:5] runtime.block_on(value()) = 666 [src/main.rs:118:5] runtime.block_on(named_value("alice")) = 20 [src/main.rs:119:5] runtime.block_on(named_value("bob")) = 10 ","version":"1.0.0","tagName":"h3"},{"title":"ERC-20","type":0,"sectionRef":"#","url":"/docs/tutorials/erc20","content":"","keywords":"","version":"1.0.0"},{"title":"Framework features​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: Advanced storage using key-value pairs,Odra types such as Address,Advanced event assertion. ","version":"1.0.0","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#code","content":"Our module features a considerably more complex storage layout compared to the previous example. It is designed to store the following data: Immutable metadata - name, symbol, and decimals.Total supply.Balances of individual users.Allowances, essentially indicating who is permitted to spend tokens on behalf of another user. ","version":"1.0.0","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#module-definition","content":"erc20.rs use odra::prelude::*; use odra::{Address, casper_types::U256, Mapping, Var}; #[odra::module(events = [Transfer, Approval])] pub struct Erc20 { decimals: Var<u8>, symbol: Var<String>, name: Var<String>, total_supply: Var<U256>, balances: Mapping<Address, U256>, allowances: Mapping<(Address, Address), U256> } L10 - For the first time, we need to store key-value pairs. In order to do that, we use Mapping. The name is taken after Solidity's native type mapping.L11 - Odra does not allows nested Mappings as Solidity does. Instead, you can create a compound key using a tuple of keys. ","version":"1.0.0","tagName":"h2"},{"title":"Metadata​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#metadata","content":"erc20.rs #[odra::module] impl Erc20 { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let caller = self.env().caller(); self.name.set(name); self.symbol.set(symbol); self.decimals.set(decimals); self.mint(&caller, &initial_supply); } pub fn name(&self) -> String { self.name.get_or_default() } pub fn symbol(&self) -> String { self.symbol.get_or_default() } pub fn decimals(&self) -> u8 { self.decimals.get_or_default() } pub fn total_supply(&self) -> U256 { self.total_supply.get_or_default() } } impl Erc20 { pub fn mint(&mut self, address: &Address, amount: &U256) { self.balances.add(address, *amount); self.total_supply.add(*amount); self.env().emit_event(Transfer { from: None, to: Some(*address), amount: *amount }); } } #[odra::event] pub struct Transfer { pub from: Option<Address>, pub to: Option<Address>, pub amount: U256 } L1 - The first impl block, marked as a module, contains functions defined in the ERC-20 standard.L3-L9 - A constructor sets the token metadata and mints the initial supply.L28 - The second impl is not an Odra module; in other words, these functions will not be part of the contract's public interface.L29-L38 - The mint function is public, so, like in regular Rust code, it will be accessible from the outside. mint() uses the notation self.balances.add(address, *amount);, which is syntactic sugar for: use odra::UnwrapOrRevert; let current_balance = self.balances.get(address).unwrap_or_default(); let new_balance = <U256 as OverflowingAdd>::overflowing_add(current_balance, current_balance).unwrap_or_revert(&self.env()); self.balances.set(address, new_balance); ","version":"1.0.0","tagName":"h3"},{"title":"Core​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#core","content":"To ensure comprehensive functionality, let's implement the remaining features such as transfer, transfer_from, and approve. Since they do not introduce any new concepts, we will present them without additional remarks. erc20.rs #[odra::module] impl Erc20 { ... pub fn transfer(&mut self, recipient: &Address, amount: &U256) { let caller = self.env().caller(); self.raw_transfer(&caller, recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let spender = self.env().caller(); self.spend_allowance(owner, &spender, amount); self.raw_transfer(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { let owner = self.env().caller(); self.allowances.set(&(owner, *spender), *amount); self.env().emit_event(Approval { owner, spender: *spender, value: *amount }); } pub fn balance_of(&self, address: &Address) -> U256 { self.balances.get_or_default(&address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.allowances.get_or_default(&(*owner, *spender)) } } impl Erc20 { ... fn raw_transfer(&mut self, owner: &Address, recipient: &Address, amount: &U256) { let owner_balance = self.balances.get_or_default(&owner); if *amount > owner_balance { self.env().revert(Error::InsufficientBalance) } self.balances.set(owner, owner_balance - *amount); self.balances.add(recipient, *amount); self.env().emit_event(Transfer { from: Some(*owner), to: Some(*recipient), amount: *amount }); } fn spend_allowance(&mut self, owner: &Address, spender: &Address, amount: &U256) { let allowance = self.allowance(owner, spender); if allowance < *amount { self.env().revert(Error::InsufficientAllowance) } let new_allowance = allowance - *amount; self.allowances .set(&(*owner, *spender), new_allowance); self.env().emit_event(Approval { owner: *owner, spender: *spender, value: allowance - *amount }); } } #[odra::event] pub struct Approval { pub owner: Address, pub spender: Address, pub value: U256 } #[odra::odra_error] pub enum Error { InsufficientBalance = 1, InsufficientAllowance = 2, } Now, compare the code we have written, with Open Zeppelin code. Out of 10, how Solidity-ish is our implementation? ","version":"1.0.0","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#test","content":"erc20.rs #[cfg(test)] pub mod tests { use super::*; use odra::{casper_types::U256, host::{Deployer, HostEnv, HostRef}}; const NAME: &str = "Plascoin"; const SYMBOL: &str = "PLS"; const DECIMALS: u8 = 10; const INITIAL_SUPPLY: u32 = 10_000; fn setup() -> (HostEnv, Erc20HostRef) { let env = odra_test::env(); ( env.clone(), Erc20HostRef::deploy( &env, Erc20InitArgs { symbol: SYMBOL.to_string(), name: NAME.to_string(), decimals: DECIMALS, initial_supply: INITIAL_SUPPLY.into() } ) ) } #[test] fn initialization() { // When deploy a contract with the initial supply. let (env, erc20) = setup(); // Then the contract has the metadata set. assert_eq!(erc20.symbol(), SYMBOL.to_string()); assert_eq!(erc20.name(), NAME.to_string()); assert_eq!(erc20.decimals(), DECIMALS); // Then the total supply is updated. assert_eq!(erc20.total_supply(), INITIAL_SUPPLY.into()); // Then a Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: None, to: Some(env.get_account(0)), amount: INITIAL_SUPPLY.into() } )); } #[test] fn transfer_works() { // Given a new contract. let (env, mut erc20) = setup(); // When transfer tokens to a recipient. let sender = env.get_account(0); let recipient = env.get_account(1); let amount = 1_000.into(); erc20.transfer(&recipient, &amount); // Then the sender balance is deducted. assert_eq!( erc20.balance_of(&sender), U256::from(INITIAL_SUPPLY) - amount ); // Then the recipient balance is updated. assert_eq!(erc20.balance_of(&recipient), amount); // Then Transfer event was emitted. assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(sender), to: Some(recipient), amount } )); } #[test] fn transfer_error() { // Given a new contract. let (env, mut erc20) = setup(); // When the transfer amount exceeds the sender balance. let recipient = env.get_account(1); let amount = U256::from(INITIAL_SUPPLY) + U256::one(); // Then an error occurs. assert!(erc20.try_transfer(&recipient, &amount).is_err()); } #[test] fn transfer_from_and_approval_work() { let (env, mut erc20) = setup(); let (owner, recipient, spender) = (env.get_account(0), env.get_account(1), env.get_account(2)); let approved_amount = 3_000.into(); let transfer_amount = 1_000.into(); assert_eq!(erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY)); // Owner approves Spender. erc20.approve(&spender, &approved_amount); // Allowance was recorded. assert_eq!(erc20.allowance(&owner, &spender), approved_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount } )); // Spender transfers tokens from Owner to Recipient. env.set_caller(spender); erc20.transfer_from(&owner, &recipient, &transfer_amount); // Tokens are transferred and allowance decremented. assert_eq!( erc20.balance_of(&owner), U256::from(INITIAL_SUPPLY) - transfer_amount ); assert_eq!(erc20.balance_of(&recipient), transfer_amount); assert!(env.emitted_event( erc20.address(), &Approval { owner, spender, value: approved_amount - transfer_amount } )); assert!(env.emitted_event( erc20.address(), &Transfer { from: Some(owner), to: Some(recipient), amount: transfer_amount } )); // assert!(env.emitted(erc20.address(), "Transfer")); } #[test] fn transfer_from_error() { // Given a new instance. let (env, mut erc20) = setup(); // When the spender's allowance is zero. let (owner, spender, recipient) = (env.get_account(0), env.get_account(1), env.get_account(2)); let amount = 1_000.into(); env.set_caller(spender); // Then transfer fails. assert_eq!( erc20.try_transfer_from(&owner, &recipient, &amount), Err(Error::InsufficientAllowance.into()) ); } } L146 - Alternatively, if you don't want to check the entire event, you may assert only its type. ","version":"1.0.0","tagName":"h3"},{"title":"What's next​","type":1,"pageTitle":"ERC-20","url":"/docs/tutorials/erc20#whats-next","content":"Having two modules: Ownable and Erc20, let's combine them, and create an ERC-20 on steroids. ","version":"1.0.0","tagName":"h2"},{"title":"OwnedToken","type":0,"sectionRef":"#","url":"/docs/tutorials/owned-token","content":"","keywords":"","version":"1.0.0"},{"title":"Code​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#code","content":"What should our module be capable of? Conform the Erc20 interface.Allow only the module owner to mint tokens.Enable the current owner to designate a new owner. ","version":"1.0.0","tagName":"h2"},{"title":"Module definition​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#module-definition","content":"Let's define a module called OwnedToken that is a composition of Ownable and Erc20 modules. owned_token.rs use crate::{erc20::Erc20, ownable::Ownable}; use odra::prelude::*; use odra::module::SubModule; #[odra::module] pub struct OwnedToken { ownable: SubModule<Ownable>, erc20: SubModule<Erc20> } As you can see, we do not need any storage definition - we just take advantage of the already-defined modules! ","version":"1.0.0","tagName":"h3"},{"title":"Delegation​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#delegation","content":"owned_token.rs ... use odra::{Address, casper_types::U256}; ... #[odra::module] impl OwnedToken { pub fn init(&mut self, name: String, symbol: String, decimals: u8, initial_supply: U256) { let deployer = self.env().caller(); self.ownable.init(deployer); self.erc20.init(name, symbol, decimals, initial_supply); } pub fn name(&self) -> String { self.erc20.name() } pub fn symbol(&self) -> String { self.erc20.symbol() } pub fn decimals(&self) -> u8 { self.erc20.decimals() } pub fn total_supply(&self) -> U256 { self.erc20.total_supply() } pub fn balance_of(&self, address: &Address) -> U256 { self.erc20.balance_of(address) } pub fn allowance(&self, owner: &Address, spender: &Address) -> U256 { self.erc20.allowance(owner, spender) } pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.erc20.transfer(recipient, amount); } pub fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256) { self.erc20.transfer_from(owner, recipient, amount); } pub fn approve(&mut self, spender: &Address, amount: &U256) { self.erc20.approve(spender, amount); } pub fn get_owner(&self) -> Address { self.ownable.get_owner() } pub fn change_ownership(&mut self, new_owner: &Address) { self.ownable.change_ownership(new_owner); } pub fn mint(&mut self, address: &Address, amount: &U256) { self.ownable.ensure_ownership(&self.env().caller()); self.erc20.mint(address, amount); } } Easy. However, there are a few worth mentioning subtleness: L9-L10 - A constructor is an excellent place to initialize both modules at once.L13-L15 - Most of the entrypoints do not need any modification, so we simply delegate them to the erc20 module.L49-L51 - The same is done with the ownable module.L57-L60 - Minting should not be unconditional, we need some control over it. First, using ownable we make sure the caller really is indeed the owner. ","version":"1.0.0","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"OwnedToken","url":"/docs/tutorials/owned-token#summary","content":"The Odra Framework encourages a modularized design of your smart contracts. You can encapsulate features in smaller units and test them in isolation, ensuring your project is easy to maintain. Finally, unleash their full potential by combining modules. You do not need any magic bindings for that. ","version":"1.0.0","tagName":"h2"},{"title":"Ownable","type":0,"sectionRef":"#","url":"/docs/tutorials/ownable","content":"","keywords":"","version":"1.0.0"},{"title":"Framework features​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#framework-features","content":"A module we will write in a minute, will help you master a few Odra features: storing a single value,defining a constructor,error handling,defining and emitting events.registering a contact in a test environment,interactions with the test environment,assertions (value, events, errors assertions). ","version":"1.0.0","tagName":"h2"},{"title":"Code​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#code","content":"Before we write any code, we define functionalities we would like to implement. Module has an initializer that should be called once. Only the current owner can set a new owner.Read the current owner.A function that fails if called by a non-owner account. ","version":"1.0.0","tagName":"h2"},{"title":"Define a module​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#define-a-module","content":"ownable.rs use odra::prelude::*; use odra::{Address, Var}; #[odra::module(events = [OwnershipChanged])] pub struct Ownable { owner: Var<Option<Address>> } That was easy, but it is crucial to understand the basics before we move on. L4 - Firstly, we need to create a struct called Ownable and apply #[odra::module(events = [OwnershipChanged])] attribute to it. The events attribute is optional but informs the Odra toolchain about the events that will be emitted by the module and includes them in the contract's metadata. OwnershipChanged is a type that will be defined later.L6 - Then we can define the layout of our module. It is extremely simple - just a single state value. What is most important is that you can never leave a raw type; you must always wrap it with Var. ","version":"1.0.0","tagName":"h3"},{"title":"Init the module​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#init-the-module","content":"ownable.rs #[odra::module] impl Ownable { pub fn init(&mut self, owner: Address) { if self.owner.get_or_default().is_some() { self.env().revert(Error::OwnerIsAlreadyInitialized) } self.owner.set(Some(owner)); self.env().emit_event(OwnershipChanged { prev_owner: None, new_owner: owner }); } } #[odra::odra_error] pub enum Error { OwnerIsAlreadyInitialized = 1, } #[odra::event] pub struct OwnershipChanged { pub prev_owner: Option<Address>, pub new_owner: Address } Ok, we have done a couple of things, let's analyze them one by one: L1 - The impl should be an Odra module, so add #[odra::module].L3 - The init function is a constructor. This matters if we would like to deploy the Ownable module as a standalone contract.L17-L20 - Before we set a new owner, we must assert there was no owner before and raise an error otherwise. For that purpose, we defined an Error enum. Notice that the #[odra::odra_error] attribute is applied to the enum. It generates, among others, the required Into<odra::OdraError> binding.L4-L6 - If the owner has been set already, we call ContractEnv::revert() function with an Error::OwnerIsAlreadyInitialized argument. L8 - Then we write the owner passed as an argument to the storage. To do so, we call the set() on Var.L22-L26 - Once the owner is set, we would like to inform the outside world. The first step is to define an event struct. The struct annotated with #[odra::event] attribute.L10 - Finally, call ContractEnv::emit_event() passing the OwnershipChanged instance to the function. Hence, we set the first owner, we set the prev_owner value to None. ","version":"1.0.0","tagName":"h3"},{"title":"Features implementation​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#features-implementation","content":"ownable.rs #[odra::module] impl Ownable { ... pub fn ensure_ownership(&self, address: &Address) { if Some(address) != self.owner.get_or_default().as_ref() { self.env().revert(Error::NotOwner) } } pub fn change_ownership(&mut self, new_owner: &Address) { self.ensure_ownership(&self.env().caller()); let current_owner = self.get_owner(); self.owner.set(Some(*new_owner)); self.env().emit_event(OwnershipChanged { prev_owner: Some(current_owner), new_owner: *new_owner }); } pub fn get_owner(&self) -> Address { match self.owner.get_or_default() { Some(owner) => owner, None => self.env().revert(Error::OwnerIsNotInitialized) } } } #[odra::odra_error] pub enum Error { NotOwner = 1, OwnerIsAlreadyInitialized = 2, OwnerIsNotInitialized = 3, } The above implementation relies on the concepts we have already used in this tutorial, so it should be easy for you to get along. L7,L31 - ensure_ownership() reads the current owner and reverts if it does not match the input Address. Also, we need to update our Error enum by adding a new variant NotOwner.L11 - The function defined above can be reused in the change_ownership() implementation. We pass to it the current caller, using the ContractEnv::caller() function. Then we update the state and emit OwnershipChanged.L21,L33 - Lastly, a getter function. Read the owner from storage, if the getter is called on an uninitialized module, it should revert with a new Error variant OwnerIsNotInitialized. There is one worth-mentioning subtlety: Var::get() function returns Option<T>. If the type implements the Default trait, you can call the get_or_default() function, and the contract does not fail even if the value is not initialized. As the owner is of type Option<Address> the Var::get() would return Option<Option<Address>>, we use Var::get_or_default() instead. ","version":"1.0.0","tagName":"h3"},{"title":"Test​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#test","content":"ownable.rs #[cfg(test)] mod tests { use super::*; use odra::host::{Deployer, HostEnv, HostRef}; fn setup() -> (OwnableHostRef, HostEnv, Address) { let env: HostEnv = odra_test::env(); let init_args = OwnableInitArgs { owner: env.get_account(0) }; (OwnableHostRef::deploy(&env, init_args), env.clone(), env.get_account(0)) } #[test] fn initialization_works() { let (ownable, env, owner) = setup(); assert_eq!(ownable.get_owner(), owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: None, new_owner: owner } ); } #[test] fn owner_can_change_ownership() { let (mut ownable, env, owner) = setup(); let new_owner = env.get_account(1); env.set_caller(owner); ownable.change_ownership(&new_owner); assert_eq!(ownable.get_owner(), new_owner); env.emitted_event( ownable.address(), &OwnershipChanged { prev_owner: Some(owner), new_owner } ); } #[test] fn non_owner_cannot_change_ownership() { let (mut ownable, env, _) = setup(); let new_owner = env.get_account(1); ownable.change_ownership(&new_owner); assert_eq!( ownable.try_change_ownership(&new_owner), Err(Error::NotOwner.into()) ); } } L6 - Each test case starts with the same initialization process, so for convenience, we have defined the setup() function, which we call in the first statement of each test. Take a look at the signature: fn setup() -> (OwnableHostRef, HostEnv, Address). OwnableHostRef is a contract reference generated by Odra. This reference allows us to call all the defined entrypoints, namely: ensure_ownership(), change_ownership(), get_owner(), but not init(), which is a constructor.L7-L11 - The starting point of every test is getting an instance of HostEnv by calling odra_test::env(). Our function returns a triple: a contract ref, an env, and an address (the initial owner). Odra's #[odra::module] attribute implements a odra::host::Deployer for OwnableHostRef, and OwnableInitArgs that we pass as the second argument of the odra::host::Deployer::deploy() function. Lastly, the module needs an owner. The easiest way is to take one from the HostEnv. We choose the address of first account (which is the default one). L14 - It is time to define the first test. As you see, it is a regular Rust test.L16-17 - Using the setup() function, we get the owner and a reference (in this test, we don't use the env, so we ignore it). We make a standard assertion, comparing the owner we know with the value returned from the contract. note You may have noticed, we use here the term module interchangeably with contract. The reason is once we deploy our module onto a virtual blockchain it may be considered a contract. L19-25 - On the contract, only the init() function has been called, so we expect one event to have been emitted. To assert that, let's use HostEnv. To get the env, we call env() on the contract, then call HostEnv::emitted_event. As the first argument, pass the contract address you want to read events from, followed by an event as you expect it to have occurred.L31 - Because we know the initial owner is the 0th account, we must select a different account. It could be any index from 1 to 19 - the HostEnv predefines 20 accounts.L33 - As mentioned, the default is the 0th account, if you want to change the executor, call the HostEnv::set_caller() function. note The caller switch applies only the next contract interaction, the second call will be done as the default account. L46-55 - If a non-owner account tries to change ownership, we expect it to fail. To capture the error, call HostEnv::try_change_ownership() instead of HostEnv::change_ownership(). HostEnv provides try_ functions for each contract's entrypoint. The try functions return OdraResult (an alias for Result<T, OdraError>) instead of panicking and halting the execution. In our case, we expect the contract to revert with the Error::NotOwner error. To compare the error, we use the Error::into() function, which converts the error into the OdraError type. ","version":"1.0.0","tagName":"h3"},{"title":"Summary​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#summary","content":"The Ownable module is ready, and we can test it against any defined backend. Theoretically it can be deployed as a standalone contract, but in upcoming tutorials you will see how to use it to compose a more complex contract. ","version":"1.0.0","tagName":"h2"},{"title":"What's next​","type":1,"pageTitle":"Ownable","url":"/docs/tutorials/ownable#whats-next","content":"In the next tutorial we will implement a ERC20 standard. ","version":"1.0.0","tagName":"h2"},{"title":"Ticketing System","type":0,"sectionRef":"#","url":"/docs/tutorials/nft","content":"","keywords":"","version":"1.0.0"},{"title":"Ticket Office Contract​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#ticket-office-contract","content":"Our TicketOffice contract will include the following features: Compliance with the CEP-78 standard.Ownership functionality.Only the owner can issue new event tickets.Users can purchase tickets for events.Tickets are limited to a one-time sale.Public access to view the total income of the TicketOffice. ","version":"1.0.0","tagName":"h3"},{"title":"Setup the project​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#setup-the-project","content":"Creating a new NFT token with Odra is straightforward. Use the cargo odra new command to create a new project with the CEP-78 template: cargo odra new --name ticket-office --template cep78 ","version":"1.0.0","tagName":"h3"},{"title":"Contract implementation​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#contract-implementation","content":"Let's start implementing the TicketOffice contract by modify the code generated from the template. src/token.rs use odra::{ args::Maybe, casper_types::U512, prelude::*, Address, Mapping, SubModule, UnwrapOrRevert }; use odra_modules::access::Ownable; use odra_modules::cep78::{ modalities::{MetadataMutability, NFTIdentifierMode, NFTKind, NFTMetadataKind, OwnershipMode}, token::Cep78, }; pub type TicketId = u64; #[odra::odra_type] pub enum TicketStatus { Available, Sold, } #[odra::odra_type] pub struct TicketInfo { event_name: String, price: U512, status: TicketStatus, } #[odra::event] pub struct OnTicketIssue { ticket_id: TicketId, event_name: String, price: U512, } #[odra::event] pub struct OnTicketSell { ticket_id: TicketId, buyer: Address, } #[odra::odra_error] pub enum Error { TicketNotAvailableForSale = 200, InsufficientFunds = 201, InvalidTicketId = 202, TicketDoesNotExist = 203, } #[odra::module( events = [OnTicketIssue, OnTicketSell], errors = Error )] pub struct TicketOffice { token: SubModule<Cep78>, ownable: SubModule<Ownable>, tickets: Mapping<TicketId, TicketInfo>, } #[odra::module] impl TicketOffice { pub fn init(&mut self, collection_name: String, collection_symbol: String, total_supply: u64) { self.ownable.init(); let receipt_name = format!("cep78_{}", collection_name); self.token.init( collection_name, collection_symbol, total_supply, OwnershipMode::Transferable, NFTKind::Digital, NFTIdentifierMode::Ordinal, NFTMetadataKind::Raw, MetadataMutability::Immutable, receipt_name, // remaining args are optional and can set to Maybe::None ... ); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { let env = self.env(); let caller = env.caller(); self.ownable.assert_owner(&caller); // mint a new token let (_, _, token_id) = self.token.mint(caller, "".to_string(), Maybe::None); let ticket_id: u64 = token_id .parse() .map_err(|_| Error::InvalidTicketId) .unwrap_or_revert(&env); // store ticket info self.tickets.set( &ticket_id, TicketInfo { event_name: event_name.clone(), price, status: TicketStatus::Available, }, ); // emit an event env.emit_event(OnTicketIssue { ticket_id, event_name, price, }); } #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let owner = self.ownable.get_owner(); let buyer = env.caller(); let value = env.attached_value(); // only tokens owned by the owner can be sold if self.token.owner_of(Maybe::Some(ticket_id), Maybe::None) != owner { env.revert(Error::TicketNotAvailableForSale); } let mut ticket = self .tickets .get(&ticket_id) .unwrap_or_revert_with(&env, Error::TicketDoesNotExist); // only available tickets can be sold if ticket.status != TicketStatus::Available { env.revert(Error::TicketNotAvailableForSale); } // check if the buyer sends enough funds if value < ticket.price { env.revert(Error::InsufficientFunds); } // transfer csprs to the owner env.transfer_tokens(&owner, &value); // transfer the ticket to the buyer self.token .transfer(Maybe::Some(ticket_id), Maybe::None, owner, buyer); ticket.status = TicketStatus::Sold; self.tickets.set(&ticket_id, ticket); env.emit_event(OnTicketSell { ticket_id, buyer }); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L10-L44 - We define structures and enums that will be used in our contract. TicketStatus enum represents the status of a ticket, TicketInfo struct contains information about a ticket that is written to the storage, TicketId is a type alias for u64. OnTicketIssue and OnTicketSell are events that will be emitted when a ticket is issued or sold.L46-L49 - Register errors and events that will be used in our contract, required to produce a complete contract schema.L51-L53 - TicketOffice module definition. The module contains a Cep78 token, an Ownable module, and a Mapping that stores information about tickets.L58-L74 - The init function has been generated from the template and there is no need to modify it, except the Ownable module initialization.L76-L94 - The issue_ticket function allows the owner to issue a new ticket. The function mints a new token, stores information about the ticket, and emits an OnTicketIssue event.L103 - The payable attribute indicates that the buy_ticket function can receive funds.L104-L134 - The buy_ticket function checks if the ticket is available for sale, if the buyer sends enough funds, and transfers the ticket to the buyer. Finally, the function updates the ticket status and emits an OnTicketSell event. Lets test the contract. The test scenario will be as follows: Deploy the contract.Issue two tickets.Try to buy a ticket with insufficient funds.Buy tickets.Try to buy the same ticket again.Check the balance of the contract. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef}, }; use crate::token::{Error, TicketOfficeHostRef, TicketOfficeInitArgs}; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let mut contract = TicketOfficeHostRef::deploy(&env, init_args); contract.issue_ticket("Ev".to_string(), U512::from(100)); contract.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(0), Err(Error::InsufficientFunds.into()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(50)) .try_buy_ticket(1), Ok(()) ); assert_eq!( contract .with_tokens(U512::from(100)) .try_buy_ticket(0), Err(Error::TicketNotAvailableForSale.into()) ); } Unfortunately, the test failed. The first assertion succeeds because the buyer sends insufficient funds to buy the ticket. However, the second assertion fails even though the buyer sends enough funds to purchase the ticket. The buy_ticket function reverts with Cep78Error::InvalidTokenOwner because the buyer attempts to transfer a token that they do not own, are not approved for, or are not an operator of. odra/modules/src/cep78/token78.rs pub fn transfer( &mut self, token_id: Maybe<u64>, token_hash: Maybe<String>, source_key: Address, target_key: Address ) -> TransferReceipt { ... if !is_owner && !is_approved && !is_operator { self.revert(CEP78Error::InvalidTokenOwner); } ... } Let's fix it by redesigning our little system. ","version":"1.0.0","tagName":"h3"},{"title":"Redesign​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#redesign","content":"Since a buyer cannot purchase a ticket directly, we need to introduce an intermediary — an operator who will be responsible for buying tickets on behalf of the buyer. The operator will be approved by the ticket office to transfer tickets. The sequence diagram below illustrates the new flow: Ticket Operator Contract​ As shown in the sequence diagram, a new contract will act as an operator for the ticket office. To create this new contract, use the cargo odra generate command. cargo odra generate -c ticket_operator src/ticket_operator.rs use crate::token::{TicketId, TicketOfficeContractRef}; use odra::{casper_types::U512, prelude::*, Address, UnwrapOrRevert, Var}; #[odra::odra_error] pub enum Error { UnknownTicketOffice = 300, } #[odra::module(errors = Error)] pub struct TicketOperator { ticket_office_address: Var<Address>, } #[odra::module] impl TicketOperator { pub fn register(&mut self, ticket_office_address: Address) { self.ticket_office_address.set(ticket_office_address); } // now the operator's `buy_ticket` receives funds. #[odra(payable)] pub fn buy_ticket(&mut self, ticket_id: TicketId) { let env = self.env(); let buyer = env.caller(); let value = env.attached_value(); let center = self .ticket_office_address .get() .unwrap_or_revert_with(&env, Error::UnknownTicketOffice); let mut ticket_contract = TicketOfficeContractRef::new(env, center); // now and approved entity - the operator - buys the ticket on behalf of the buyer ticket_contract.buy_ticket(ticket_id, buyer, value); } pub fn balance_of(&self) -> U512 { self.env().self_balance() } } L4-L7 - Define errors that will be used in the contract.L9-L13 - Define the TicketOperator module that stores the address of the ticketing office.L16-L18 - The register function sets the address of the ticketing office.L20-L32 - The buy_ticket function buys a ticket on behalf of the buyer using the ticket office address. The function forwards the call to the ticketing office contract. We simply create a TicketOfficeContractRef to interact we the TicketOffice contract. Note that, the operator's buy_ticket now receives funds. Now we need to adjust the TicketOffice contract to use the TicketOperator contract to buy tickets. src/token.rs use odra::Var; ... #[odra::odra_error] pub enum Error { ... MissingOperator = 204, Unauthorized = 205, } #[odra::module] pub struct TicketOffice { ... operator: Var<Address>, } #[odra::module] impl TicketOffice { ... pub fn register_operator(&mut self, operator: Address) { // only the owner can register an operator let caller = self.env().caller(); self.ownable.assert_owner(&caller); // store the ticketing center address in the operator contract TicketOperatorContractRef::new(self.env(), operator).register(self.env().self_address()); self.operator.set(operator); } pub fn issue_ticket(&mut self, event_name: String, price: U512) { // minting logic remains the same... ... // approve the operator to transfer the ticket let operator = self.operator(); self.token .approve(operator, Maybe::Some(ticket_id), Maybe::None); // emit an event ... } pub fn buy_ticket(&mut self, ticket_id: TicketId, buyer: Address, value: U512) { let env = self.env(); let owner = self.ownable.get_owner(); let caller = env.caller(); // make sure the caller is the operator if !self.is_operator(caller) { env.revert(Error::Unauthorized); } ... // the logic remains the same, except for the csprs transfer // it is now handled by the operator contract. // env.transfer_tokens(&owner, &value); } #[inline] fn is_operator(&self, caller: Address) -> bool { Some(caller) == self.operator.get() } #[inline] fn operator(&self) -> Address { self.operator .get() .unwrap_or_revert_with(&self.env(), Error::MissingOperator) } } L15 - the contract stores the operator address.L22-L29 - a new function register_operator allows the owner to register an operator. Also calls the register entry point on the operator contract.L36-38 - modify the issue_ticket function: once a new token is minted, approves the operator to transfer the ticket later.L44-L57 - modify the buy_ticket function: check if the caller is the operator, do not transfer cspr to the contract - now the operator collect funds.We also added two helper functions: is_operator and operator to check if the caller is the operator and get the operator address. Two new errors were added: MissingOperator and Unauthorized. Now we need to update our tests to create a scenario we presented in the sequence diagram. src/tests.rs use odra::{ casper_types::U512, host::{Deployer, HostRef, NoArgs}, OdraResult, }; use crate::{ ticket_operator::TicketOperatorHostRef, token::{Error, TicketId, TicketOfficeContractRef, TicketOfficeInitArgs}, }; #[test] fn it_works() { let env = odra_test::env(); let init_args = TicketOfficeInitArgs { collection_name: "Ticket".to_string(), collection_symbol: "T".to_string(), total_supply: 100, }; let operator = TicketOperatorHostRef::deploy(&env, NoArgs); let mut ticket_office = TicketOfficeContractRef::deploy(&env, init_args); ticket_office.register_operator(operator.address().clone()); ticket_office.issue_ticket("Ev".to_string(), U512::from(100)); ticket_office.issue_ticket("Ev".to_string(), U512::from(50)); let buyer = env.get_account(1); env.set_caller(buyer); assert_eq!( buy_ticket(&operator, 0, 50), Err(Error::InsufficientFunds.into()) ); assert_eq!(buy_ticket(&operator, 0, 100), Ok(())); assert_eq!(buy_ticket(&operator, 1, 50), Ok(())); assert_eq!( buy_ticket(&operator, 0, 100), Err(Error::TicketNotAvailableForSale.into()) ); assert_eq!(operator.balance_of(), U512::from(150)); } fn buy_ticket(operator: &TicketOperatorHostRef, id: TicketId, price: u64) -> OdraResult<()> { operator.with_tokens(U512::from(price)).try_buy_ticket(id) } ","version":"1.0.0","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Ticketing System","url":"/docs/tutorials/nft#conclusion","content":"In this tutorial, we created a simple ticketing system using the CEP-78 standard. This guide demonstrates how to combine various Odra features, including modules, events, errors, payable functions, and cross-contract calls. ","version":"1.0.0","tagName":"h3"},{"title":"Pausable","type":0,"sectionRef":"#","url":"/docs/tutorials/pauseable","content":"","keywords":"","version":"1.0.0"},{"title":"Code​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#code","content":"As always, we will start with defining functionalities of our module. Check the state - is it paused or not.State guards - a contract should stop execution if is in a state we don't expect.Switch the state. ","version":"1.0.0","tagName":"h2"},{"title":"Events and Error​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#events-and-error","content":"There just two errors that may occur: PausedRequired, UnpausedRequired. We define them in a standard Odra way. Events definition is highly uncomplicated: Paused and Unpaused events holds only the address of the pauser. pauseable.rs use odra::prelude::*; use odra::Address; #[odra::odra_error] pub enum Error { PausedRequired = 1_000, UnpausedRequired = 1_001, } #[odra::event] pub struct Paused { pub account: Address } #[odra::event] pub struct Unpaused { pub account: Address } ","version":"1.0.0","tagName":"h3"},{"title":"Module definition​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#module-definition","content":"The module storage is extremely simple - has a single Var of type bool, that indicates if a contract is paused. pauseable.rs use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] pub struct Pausable { is_paused: Var<bool> } ","version":"1.0.0","tagName":"h3"},{"title":"Checks and guards​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#checks-and-guards","content":"Now, let's move to state checks and guards. pauseable.rs impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } pub fn require_not_paused(&self) { if self.is_paused() { self.env().revert(Error::UnpausedRequired); } } pub fn require_paused(&self) { if !self.is_paused() { self.env().revert(Error::PausedRequired); } } } L1 - as mentioned in the intro, the module is not intended to be a standalone contract, so the only impl block is not annotated with odra::module and hence does not expose any entrypoint.L2 - is_paused() checks the contract state, if the Var is_paused has not been initialized, the default value (false) is returned.L6 - to guarantee the code is executed when the contract is not paused, require_not_paused() function reads the state and reverts if the contract is paused. L12 - require_paused() is a mirror function - stops the contract execution if the contract is not paused. ","version":"1.0.0","tagName":"h3"},{"title":"Actions​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#actions","content":"Finally, we will add the ability to switch the module state. pauseable.rs impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); self.env().emit_event(Paused { account: self.env().caller() }); } pub fn unpause(&mut self) { self.require_paused(); self.is_paused.set(false); self.env().emit_event(Unpaused { account: self.env().caller() }); } } pause() and unpause() functions do three things: ensure the contract is the right state (unpaused for pause(), not paused for unpause()), updates the state, and finally emits events (Paused/Unpaused). ","version":"1.0.0","tagName":"h3"},{"title":"Pausable counter​","type":1,"pageTitle":"Pausable","url":"/docs/tutorials/pauseable#pausable-counter","content":"In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called PausableCounter. The contract consists of a Var value and a Pausable module. The counter can only be incremented if the contract is in a normal state (is not paused). pauseable.rs ... use odra::SubModule; ... #[odra::module] pub struct PausableCounter { value: Var<u32>, pauseable: SubModule<Pausable> } #[odra::module] impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); let new_value = self.value.get_or_default() + 1; self.value.set(new_value); } pub fn pause(&mut self) { self.pauseable.pause(); } pub fn unpause(&mut self) { self.pauseable.unpause(); } pub fn get_value(&self) -> u32 { self.value.get_or_default() } } #[cfg(test)] mod test { use super::*; use odra::host::{Deployer, NoArgs}; #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); assert_eq!( contract.try_increment().unwrap_err(), Error::UnpausedRequired.into() ); assert_eq!(contract.get_value(), 1); } } As we see in the test, in a simple way, using a single function call we can turn off the counter for a while and freeze the counter. Any time we want we can turn it back on. Easy! ","version":"1.0.0","tagName":"h2"},{"title":"Using Proxy Caller","type":0,"sectionRef":"#","url":"/docs/tutorials/using-proxy-caller","content":"","keywords":"","version":"1.0.0"},{"title":"Contract​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/tutorials/using-proxy-caller#contract","content":"For this tutorial, we will use the TimeLockWallet contract from our examples. examples/src/contracts/tlw.rs use odra::prelude::*; use odra::{casper_types::U512, Address, Mapping, Var}; #[odra::module(errors = Error, events = [Deposit, Withdrawal])] pub struct TimeLockWallet { balances: Mapping<Address, U512>, lock_expiration_map: Mapping<Address, u64>, lock_duration: Var<u64> } #[odra::module] impl TimeLockWallet { /// Initializes the contract with the lock duration. pub fn init(&mut self, lock_duration: u64) { self.lock_duration.set(lock_duration); } /// Deposits the tokens into the contract. #[odra(payable)] pub fn deposit(&mut self) { // Extract values let caller: Address = self.env().caller(); let amount: U512 = self.env().attached_value(); let current_block_time: u64 = self.env().get_block_time(); // Multiple lock check if self.balances.get(&caller).is_some() { self.env().revert(Error::CannotLockTwice) } // Update state, emit event self.balances.set(&caller, amount); self.lock_expiration_map .set(&caller, current_block_time + self.lock_duration()); self.env().emit_event(Deposit { address: caller, amount }); } /// Withdraws the tokens from the contract. pub fn withdraw(&mut self, amount: &U512) { // code omitted for brevity } /// Returns the balance of the given account. pub fn get_balance(&self, address: &Address) -> U512 { // code omitted for brevity } /// Returns the lock duration. pub fn lock_duration(&self) -> u64 { // code omitted for brevity } } /// Errors that may occur during the contract execution. #[odra::odra_error] pub enum Error { LockIsNotOver = 1, CannotLockTwice = 2, InsufficientBalance = 3 } /// Deposit event. #[odra::event] pub struct Deposit { pub address: Address, pub amount: U512 } /// Withdrawal event. #[odra::event] pub struct Withdrawal { pub address: Address, pub amount: U512 } Full code can be found here. ","version":"1.0.0","tagName":"h2"},{"title":"Client​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/tutorials/using-proxy-caller#client","content":"Before we can interact with the node, we need to set it up. We will use the casper-nctl-docker image. docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl Make sure you have the contract's wasm file and the secret key. # Build the contract cargo odra build -c TimeLockWallet # Extract secret key docker exec mynctl /bin/bash -c "cat /home/casper/casper-node/utils/nctl/assets/net-1/users/user-1/secret_key.pem" > your/path/secret_key.pem RustTypeScript To interact with the contract, we use the livenet backend. It allows to write the code in the same manner as the test code, but it interacts with the live network (a local node in our case). Cargo.toml [package] name = "odra-examples" version = "1.0.0" edition = "2021" [dependencies] odra = { path = "../odra", default-features = false } ... # other dependencies odra-casper-livenet-env = { version = "1.0.0", optional = true } ... # other sections [features] default = [] livenet = ["odra-casper-livenet-env"] ... # other sections [[bin]] name = "tlw_on_livenet" path = "bin/tlw_on_livenet.rs" required-features = ["livenet"] test = false ... # other sections examples/bin/tlw_on_livenet.rs //! Deploys an [odra_examples::contracts::tlw::TimeLockWallet] contract, then deposits and withdraw some CSPRs. use odra::casper_types::{AsymmetricType, PublicKey, U512}; use odra::host::{Deployer, HostRef}; use odra::Address; use odra_examples::contracts::tlw::{TimeLockWalletHostRef, TimeLockWalletInitArgs}; const DEPOSIT: u64 = 100; const WITHDRAWAL: u64 = 99; const GAS: u64 = 20u64.pow(9); fn main() { let env = odra_casper_livenet_env::env(); let caller = env.get_account(0); env.set_caller(caller); env.set_gas(GAS); let mut contract = TimeLockWalletHostRef::deploy( &env, TimeLockWalletInitArgs { lock_duration: 60 * 60 } ); // Send 100 CSPRs to the contract. contract .with_tokens(U512::from(DEPOSIT)) .deposit(); println!("Caller's balance: {:?}", contract.get_balance(&caller)); // Withdraw 99 CSPRs from the contract. contract.withdraw(&U512::from(WITHDRAWAL)); println!("Remaining balance: {:?}", contract.get_balance(&caller)); } To run the code, execute the following command: ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem \\ ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 \\ ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 \\ cargo run --bin tlw_on_livenet --features=livenet # Sample output 💁 INFO : Deploying "TimeLockWallet". 💁 INFO : Found wasm under "wasm/TimeLockWallet.wasm". 🙄 WAIT : Waiting 15s for "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558". 💁 INFO : Deploy "74f0df4bc65cdf9e05bca70a8b786bd0f528858f26e11f5a9866dfe286551558" successfully executed. 💁 INFO : Contract "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" deployed. 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "deposit" through proxy. 🙄 WAIT : Waiting 15s for "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3". 💁 INFO : Deploy "bd571ab64c13d2b2fdb8e0e6dd8473b696349dfb5a891b55dbe9f33d017057d3" successfully executed. Caller's balance: 100 💁 INFO : Calling "hash-cce6a97e0db6feea0c4d99f670196c9462e0789fb3cdedd3dfbc6dfcbf66252e" with entrypoint "withdraw". 🙄 WAIT : Waiting 15s for "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e". 💁 INFO : Deploy "57f9aadbd77cbfbbe9b2ba54759d025f94203f9230121289fa37585f8b17020e" successfully executed. Remaining balance: 1 As observed, the contract was successfully deployed, and the Caller deposited tokens. Subsequently, the caller withdrew 99 CSPRs from the contract, leaving the contract's balance at 1 CSPR. The logs display deploy hashes, the contract's hash, and even indicate if the call was made through the proxy, providing a comprehensive overview of the on-chain activity. ","version":"1.0.0","tagName":"h2"},{"title":"Conclusion​","type":1,"pageTitle":"Using Proxy Caller","url":"/docs/tutorials/using-proxy-caller#conclusion","content":"In this tutorial, we learned how to use the proxy_caller wasm to make a payable function call. We deployed the TimeLockWallet contract, deposited tokens using the proxy_caller with attached CSPRs, and withdrew them. You got to try it out in both Rust and TypeScript, so you can choose whichever you prefer. Rust code seemed simpler, thanks to the Odra livenet backend making chain interactions easier to handle. ","version":"1.0.0","tagName":"h2"},{"title":"Odra for Solidity developers","type":0,"sectionRef":"#","url":"/docs/tutorials/odra-solidity","content":"","keywords":"","version":"1.0.0"},{"title":"Introduction​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#introduction","content":"Hi, stranger Solidity developer! If you are looking to expand your horizons into Rust-based smart contract development, you've come to the right place. Odra is a high-level framework designed to simplify the development of smart contracts for the Casper Network. This tutorial will guide you through the basics of transitioning from Solidity to Odra, highlighting key differences and providing practical examples. Before we delve into the details, we have great news for you. From the very beginning, we have been thinking of you. Our main goal was to design the framework in a way that flattens the learning curve, especially for Solidity developers. ","version":"1.0.0","tagName":"h2"},{"title":"Prerequisites​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#prerequisites","content":"To follow this guide, you should have: Knowledge of Solidity.Familiarity with Ethereum and smart contract concepts.Basic understanding of Rust, as Odra is based on it. ","version":"1.0.0","tagName":"h2"},{"title":"Hello World​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#hello-world","content":"Let's start with a simple "Hello World" contract in Odra. The following code snippet demonstrates a basic smart contract that stores a greeting message. OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct HelloWorld { greet: Var<String>, } #[odra::module] impl HelloWorld { pub fn init(&mut self, message: String) { self.greet.set(message); } pub fn get(&self) -> String { self.greet.get_or_default() } } As you may have noticed, the Odra code is slightly more verbose than the Solidity code. To define a contract in Odra, you need to create a struct and implement a module for it, both annotated with the odra::module attribute. The struct contains the contract's state variables, while the module defines the contract's functions. In this example, the HelloWorld struct has a single state variable greet, which stores the greeting message. The module contains two functions: init to set the greeting message and get to retrieve it. Two key differences are: Odra does not generate getters for public state variables automatically, so you need to define them explicitly.To initialize values, you must do it in the init function, which is the contract constructor. You can't assign defaults outside the constructor. ","version":"1.0.0","tagName":"h2"},{"title":"Variable Storage and State Management​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#variable-storage-and-state-management","content":"","version":"1.0.0","tagName":"h2"},{"title":"Data Types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#data-types","content":"OdraSolidity use core::str::FromStr; use odra::{ casper_types::{bytesrepr::Bytes, U256}, module::Module, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct Primitives { boo: Var<bool>, u: Var<u8>, // u8 is the smallest unsigned integer type u2: Var<U256>, // U256 is the biggest unsigned integer type i: Var<i32>, // i32 is the smallest signed integer type i2: Var<i64>, // i64 is the biggest signed integer type address: Var<Address>, bytes: Var<Bytes>, default_boo: Var<bool>, default_uint: Var<U256>, default_int: Var<i64>, default_addr: Var<Address>, } #[odra::module] impl Primitives { pub fn init(&mut self) { self.boo.set(true); self.u.set(1); self.u2.set(U256::from(456)); self.i.set(-1); self.i2.set(456); self.address.set( Address::from_str( "hash-d4b8fa492d55ac7a515c0c6043d72ba43c49cd120e7ba7eec8c0a330dedab3fb", ) .unwrap_or_revert(&self.env()), ); self.bytes.set(Bytes::from(vec![0xb5])); let _min_int = U256::zero(); let _max_int = U256::MAX; } // For the types that have default values, we can use the get_or_default method pub fn get_default_boo(&self) -> bool { self.default_boo.get_or_default() } pub fn get_default_uint(&self) -> U256 { self.default_uint.get_or_default() } pub fn get_default_int(&self) -> i64 { self.default_int.get_or_default() } // Does not compile - Address does not have the default value pub fn get_default_addr(&self) -> Address { self.default_addr.get_or_default() } } The range of integer types in Odra is slightly different from Solidity. Odra provides a wide range of integer types: u8, u16, u32, u64, U128, and U256 for unsigned integers, and i32 and i64 for signed integers. The Address type in Odra is used to represent account and contract addresses. In Odra, there is no default/zero value for the Address type; the workaround is to use Option<Address>. The Bytes type is used to store byte arrays. Values are stored in units called Named Keys and Dictionaries. Additionally, local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. ","version":"1.0.0","tagName":"h3"},{"title":"Constants and Immutability​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#constants-and-immutability","content":"OdraSolidity use odra::{casper_types::{account::AccountHash, U256}, Address}; #[odra::module] pub struct Constants; #[odra::module] impl Constants { pub const MY_UINT: U256 = U256([123, 0, 0, 0]); pub const MY_ADDRESS: Address = Address::Account( AccountHash([0u8; 32]) ); } In Odra, you can define constants using the const keyword. Constants are immutable and can be of any type, including custom types. In addition to constants, Solidity also supports the immutable keyword, which is used to set the value of a variable once, in the constructor. Further attempts to alter this value result in a compile error. Odra/Rust does not have an equivalent to Solidity's immutable keyword. ","version":"1.0.0","tagName":"h3"},{"title":"Variables​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#variables","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, Var}; #[odra::module] pub struct Variables { text: Var<String>, my_uint: Var<U256>, } #[odra::module] impl Variables { pub fn init(&mut self) { self.text.set("Hello".to_string()); self.my_uint.set(U256::from(123)); } pub fn do_something(&self) { // Local variables let i = 456; // Env variables let timestamp = self.env().get_block_time(); let sender = self.env().caller(); } } In Solidity there are three types of variables: state variables, local variables, and global variables. State variables are stored on the blockchain and are accessible by all functions within the contract. Local variables are not stored on the blockchain and are only available within the function in which they are declared. Global variables provide information about the blockchain. Odra uses very similar concepts, but with some differences. In Odra, state variables are a part of a module definition, and local variables are available within the entry points and can be used to perform necessary actions or computations within the scope of each entry point. Global variables are accessed using an instance of ContractEnv retrieved using the env() function. ","version":"1.0.0","tagName":"h3"},{"title":"Arrays and Mappings​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#arrays-and-mappings","content":"OdraSolidity use odra::{casper_types::U256, Address, Mapping}; #[odra::module] pub struct MappingContract { my_map: Mapping<Address, Option<U256>> } #[odra::module] impl MappingContract { pub fn get(&self, addr: Address) -> U256 { // self.my_map.get(&addr) would return Option<Option<U256>> // so we use get_or_default instead and unwrap the inner Option self.my_map.get_or_default(&addr).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256) { self.my_map.set(&addr, Some(i)); } pub fn remove(&mut self, addr: Address) { self.my_map.set(&addr, None); } } #[odra::module] pub struct NestedMapping { my_map: Mapping<(Address, U256), Option<bool>> } #[odra::module] impl NestedMapping { pub fn get(&self, addr: Address, i: U256) -> bool { self.my_map.get_or_default(&(addr, i)).unwrap_or_default() } pub fn set(&mut self, addr: Address, i: U256, boo: bool) { self.my_map.set(&(addr, i), Some(boo)); } pub fn remove(&mut self, addr: Address, i: U256) { self.my_map.set(&(addr, i), None); } } OdraSolidity use odra::{prelude::*, Var}; #[odra::module] pub struct Array { // the size of the array must be known at compile time arr: Var<[u8; 10]>, vec: Var<Vec<u32>>, } #[odra::module] impl Array { pub fn init(&mut self) { self.arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); self.vec.set(vec![1, 2, 3, 4, 5]); } pub fn get_arr(&self) -> [u8; 10] { self.arr.get_or_default() } pub fn push_vec(&mut self, value: u32) { let mut vec = self.vec.get_or_default(); vec.push(value); self.vec.set(vec); } pub fn pop_vec(&mut self) { let mut vec = self.vec.get_or_default(); vec.pop(); self.vec.set(vec); } pub fn update_arr(&mut self, index: u8, value: u8) { let mut arr = self.arr.get_or_default(); arr[index as usize] = value; self.arr.set(arr); } } For storing a collection of data as a single unit, Odra uses the Vec type for dynamic arrays and fixed-size arrays, both wrapped with the Var container. As in Solidity, you must be aware that reading the entire array in one go can be expensive, so it's better to avoid it for large arrays. In many cases, you can use a Mapping or List instead of an array or vector to store data. ","version":"1.0.0","tagName":"h3"},{"title":"Custom types​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#custom-types","content":"OdraSolidity use odra::{prelude::*, Var}; #[odra::odra_type] #[derive(Default)] pub enum Status { #[default] Pending, Shipped, Accepted, Rejected, Canceled, } #[odra::module] pub struct Enum { status: Var<Status>, } #[odra::module] impl Enum { pub fn get(&self) -> Status { self.status.get_or_default() } pub fn set(&mut self, status: Status) { self.status.set(status); } pub fn cancel(&mut self) { self.status.set(Status::Canceled); } pub fn reset(&mut self) { self.status.set(Default::default()); } } In Odra, custom types are defined using the #[odra::odra_type] attribute. The enum can have a default value specified using the #[default] attribute if derived from the Default trait. The enum can be used as a state variable in a contract, and its value can be set and retrieved using the set and get functions. The value cannot be deleted; however, it can be set using the Default::default() function. OdraSolidity use odra::{prelude::*, List}; #[odra::odra_type] pub struct Todo { text: String, completed: bool, } #[odra::module] pub struct Enum { // You could also use Var<Vec<Todo>> instead of List<Todo>, // but List is more efficient for large arrays, // it loads items lazily. todos: List<Todo>, } #[odra::module] impl Enum { pub fn create(&mut self, text: String) { self.todos.push(Todo { text, completed: false, }); } pub fn update_text(&mut self, index: u32, text: String) { if let Some(mut todo) = self.todos.get(index) { todo.text = text; self.todos.replace(index, todo); } } pub fn toggle_complete(&mut self, index: u32) { if let Some(mut todo) = self.todos.get(index) { todo.completed = !todo.completed; self.todos.replace(index, todo); } } // Odra does not create getters by default pub fn get(&self, index: u32) -> Option<Todo> { self.todos.get(index) } } Similarly to enums, custom structs are defined using the #[odra::odra_type] attribute. The struct can be used to define a list of items in a contract. The list can be created using the List type, which is more efficient for large arrays as it loads items lazily. ","version":"1.0.0","tagName":"h3"},{"title":"Data Location​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#data-location","content":"In Solidity, data location is an important concept that determines where the data is stored and how it can be accessed. The data location can be memory, storage, or calldata. In Odra, data location is not explicitly defined, but whenever interacting with storage primitives (e.g., Var, Mapping, List), the data is stored in the contract's storage. ","version":"1.0.0","tagName":"h3"},{"title":"Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#functions","content":"Odra contracts define their entry point and internal functions within the impl block. Here's an example of a transfer function: impl Erc20 { pub fn transfer(&mut self, recipient: &Address, amount: &U256) { self.internal_transfer(&self.env().caller(), recipient, amount); // Transfer logic goes here } fn internal_transfer(&mut self, sender: &Address, recipient: &Address, amount: &U256) { // Internal transfer logic goes here } } Functions can modify contract state and emit events using the ContractEnv function. ","version":"1.0.0","tagName":"h2"},{"title":"View and Pure​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#view-and-pure","content":"OdraSolidity use odra::Var; #[odra::module] pub struct ViewAndPure { x: Var<u32> } #[odra::module] impl ViewAndPure { pub fn add_to_x(&self, y: u32) -> u32 { self.x.get_or_default() + y } } pub fn add(i: u32, j: u32) -> u32 { i + j } In Odra, you don't need to specify view or pure functions explicitly. All functions are considered view functions by default, meaning they can read contract state but not modify it. To modify the state, the first parameter (called the receiver parameter) should be &mut self. If you want to create a pure function that doesn't read or modify state, you can define it as a regular Rust function without any side effects. ","version":"1.0.0","tagName":"h3"},{"title":"Modifiers​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#modifiers","content":"OdraSolidity use odra::Var; #[odra::module] pub struct FunctionModifier { x: Var<u32>, locked: Var<bool>, } #[odra::module] impl FunctionModifier { pub fn decrement(&mut self, i: u32) -> u32 { self.lock(); self.x.set(self.x.get_or_default() - i); if i > 1 { self.decrement(i - 1); } self.unlock(); } #[inline] fn lock(&mut self) { if self.locked.get_or_default() { self.env().revert("No reentrancy"); } self.locked.set(true); } #[inline] fn unlock(&mut self) { self.locked.set(false); } } In Odra, there is no direct equivalent to Solidity's function modifiers. Instead, you can define functions that perform certain actions before or after the main function logic. In the example above, the lock and unlock functions are called before and after the decrement function, respectively, but they must be called explicitly. As often as practicable, developers should inline functions by including the body of the function within their code using the #[inline] attribute. In the context of coding for Casper blockchain purposes, this reduces the overhead of executed Wasm and prevents unexpected errors due to exceeding resource tolerances. ","version":"1.0.0","tagName":"h3"},{"title":"Visibility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#visibility","content":"Functions and state variables have to declare whether they are accessible by other contracts. Functions can be declared as: OdraSolidity `pub` inside `#[odra::module]` impl block - any contract/submodule and account can call. `pub` inside a regular impl block - any submodule can call. `default/no modifier/private` - only inside the contract that defines the function. ","version":"1.0.0","tagName":"h3"},{"title":"Payable​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#payable","content":"OdraSolidity use odra::{casper_types::U512, prelude::*, Address, ExecutionError, Var}; #[odra::module] pub struct Payable { owner: Var<Address>, } #[odra::module] impl Payable { pub fn init(&mut self) { self.owner.set(self.env().caller()); } #[odra(payable)] pub fn deposit(&self) { } pub fn not_payable(&self) { } pub fn withdraw(&self) { let amount = self.env().self_balance(); self.env().transfer_tokens(&self.owner.get_or_revert_with(ExecutionError::UnwrapError), &amount); } pub fn transfer(&self, to: Address, amount: U512) { self.env().transfer_tokens(&to, &amount); } } In Odra, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. In Solidity, the payable keyword is used to define functions that can receive Ether. ","version":"1.0.0","tagName":"h3"},{"title":"Selectors​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#selectors","content":"In Solidity, when a function is called, the first 4 bytes of calldata specify which function to call. This is called a function selector. contract_addr.call( abi.encodeWithSignature("transfer(address,uint256)", address, 1234) ) Odra does not support such a mechanism. You must have access to the contract interface to call a function. ","version":"1.0.0","tagName":"h3"},{"title":"Events and Logging​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#events-and-logging","content":"OdraSolidity use odra::{prelude::*, Address}; #[odra::event] pub struct Log { sender: Address, message: String, } #[odra::event] pub struct AnotherLog {} #[odra::module] struct Event; #[odra::module] impl Event { pub fn test(&self) { let env = self.env(); env.emit_event(Log { sender: env.caller(), message: "Hello World!".to_string(), }); env.emit_event(Log { sender: env.caller(), message: "Hello Casper!".to_string(), }); env.emit_event(AnotherLog {}); } } In Odra, events are regular structs defined using the #[odra::event] attribute. The event struct can contain multiple fields, which can be of any type (primitive or custom Odra type). To emit an event, use the env's emit_event() function, passing the event struct as an argument. note Events in Solidity are used to emit logs that off-chain services can capture. However, Casper does not support events natively. Odra mimics this feature. Read more about it in the Basics section. ","version":"1.0.0","tagName":"h2"},{"title":"Error Handling​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#error-handling","content":"OdraSolidity use odra::{prelude::*, casper_types::{U256, U512}}; #[odra::odra_error] pub enum CustomError { InsufficientBalance = 1, InputLowerThanTen = 2, } #[odra::module] pub struct Error; #[odra::module] impl Error { pub fn test_require(&mut self, i: U256) { if i <= 10.into() { self.env().revert(CustomError::InputLowerThanTen); } } pub fn execute_external_call(&self, withdraw_amount: U512) { let balance = self.env().self_balance(); if balance < withdraw_amount { self.env().revert(CustomError::InsufficientBalance); } } } In Solidity, there are four ways to handle errors: require, revert, assert, and custom errors. In Odra, there is only one way to revert the execution of a function - by using the env().revert() function. The function takes an error type as an argument and stops the execution of the function. You define an error type using the #[odra::odra_error] attribute. On Casper, an error is only a number, so you can't pass a message with the error. ","version":"1.0.0","tagName":"h2"},{"title":"Composition vs. Inheritance​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#composition-vs-inheritance","content":"In Solidity, developers often use inheritance to reuse code and establish relationships between contracts. However, Odra and Rust follow a different paradigm known as composition. Instead of inheriting behavior from parent contracts, Odra encourages the composition of contracts by embedding one contract within another. Let's take a look at the difference between inheritance in Solidity and composition in Odra. OdraSolidity use odra::{prelude::*, SubModule}; #[odra::module] pub struct A; #[odra::module] impl A { pub fn foo(&self) -> String { "A".to_string() } } #[odra::module] pub struct B { a: SubModule<A> } #[odra::module] impl B { pub fn foo(&self) -> String { "B".to_string() } } #[odra::module] pub struct C { a: SubModule<A> } #[odra::module] impl C { pub fn foo(&self) -> String { "C".to_string() } } #[odra::module] pub struct D { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl D { pub fn foo(&self) -> String { self.c.foo() } } #[odra::module] pub struct E { b: SubModule<B>, c: SubModule<C> } #[odra::module] impl E { pub fn foo(&self) -> String { self.b.foo() } } #[odra::module] pub struct F { a: SubModule<A>, b: SubModule<B>, } #[odra::module] impl F { pub fn foo(&self) -> String { self.a.foo() } } Solidity supports both single and multiple inheritance. This means a contract can inherit from one or more contracts. Solidity uses a technique called "C3 linearization" to resolve the order in which base contracts are inherited in the case of multiple inheritance. This helps to ensure a consistent method resolution order. However, multiple inheritance can lead to complex code and potential issues, especially for inexperienced developers. In contrast, Rust does not have a direct equivalent to the inheritance model, but it achieves similar goals through composition. Each contract is defined as a struct, and contracts can be composed by embedding one struct within another. This approach provides a more flexible and modular way to reuse code and establish relationships between contracts. ","version":"1.0.0","tagName":"h2"},{"title":"Libraries and Utility​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#libraries-and-utility","content":"OdraSolidity use odra::{casper_types::U256, prelude::*, UnwrapOrRevert, Var}; mod math { use odra::casper_types::U256; pub fn sqrt(y: U256) -> U256 { let mut z = y; if y > 3.into() { let mut x = y / 2 + 1; while x < z { z = x; x = (y / x + x) / 2; } } else if y != U256::zero() { z = U256::one(); } z } } #[odra::module] struct TestMath; #[odra::module] impl TestMath { pub fn test_square_root(&self, x: U256) -> U256 { math::sqrt(x) } } #[odra::odra_error] enum Error { EmptyArray = 100, } trait Removable { fn remove(&mut self, index: usize); } impl Removable for Var<Vec<U256>> { fn remove(&mut self, index: usize) { let env = self.env(); let mut vec = self.get_or_default(); if vec.is_empty() { env.revert(Error::EmptyArray); } vec[index] = vec.pop().unwrap_or_revert(&env); self.set(vec); } } #[odra::module] struct TestArray { arr: Var<Vec<U256>>, } #[odra::module] impl TestArray { pub fn test_array_remove(&mut self) { let mut arr = self.arr.get_or_default(); for i in 0..3 { arr.push(i.into()); } self.arr.set(arr); self.arr.remove(1); let arr = self.arr.get_or_default(); assert_eq!(arr.len(), 2); assert_eq!(arr[0], 0.into()); assert_eq!(arr[1], 2.into()); } } In Solidity, libraries are similar to contracts but can't declare any state variables and can't receive Ether. In the sample code above, the Math library contains a square root function, while the Array library provides a function to remove an element from an array. Both libraries are consumed in different ways: the TestMath contract calls the sqrt function directly, while the TestArray contract uses the using keyword, which extends the type uint256[] by adding the remove function. In Odra, you use language-level features: modules and traits. The mod keyword defines a module, which is similar to a library in Solidity. Modules can contain functions, types, and other items that can be reused across multiple contracts. Traits are similar to interfaces in other programming languages, defining a set of functions that a type must implement. Implementing the Removable trait for the Var<Vec<U256>> type allows the remove function to be called on a variable that stores a vector of U256 values. ","version":"1.0.0","tagName":"h2"},{"title":"Fallback and Receive Functions​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#fallback-and-receive-functions","content":"In Solidity, a contract receiving Ether must implement a receive() and/or fallback() function. The receive() function is called when Ether is sent to the contract with no data, while the fallback() function is called when the contract receives Ether with data or when a function that does not exist is called. Odra does not have a direct equivalent to the receive() and fallback() functions. Instead, you can define a function with the #[odra(payable)] attribute to indicate that the function can receive CSPRs. ","version":"1.0.0","tagName":"h2"},{"title":"Miscellaneous​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#miscellaneous","content":"","version":"1.0.0","tagName":"h2"},{"title":"Hashing​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#hashing","content":"OdraSolidity use odra::{ casper_types::{bytesrepr::ToBytes, U256}, prelude::*, Address, UnwrapOrRevert, Var, }; #[odra::module] pub struct HashFunction; #[odra::module] impl HashFunction { pub fn hash(&self, text: String, num: U256, addr: Address) -> [u8; 32] { let env = self.env(); let mut data = Vec::new(); data.extend(text.to_bytes().unwrap_or_revert(&env)); data.extend(num.to_bytes().unwrap_or_revert(&env)); data.extend(addr.to_bytes().unwrap_or_revert(&env)); env.hash(data) } } #[odra::module] pub struct GuessTheMagicWord { answer: Var<[u8; 32]>, } #[odra::module] impl GuessTheMagicWord { /// Initializes the contract with the magic word hash. pub fn init(&mut self) { self.answer.set([ 0x86, 0x67, 0x15, 0xbb, 0x0b, 0x96, 0xf1, 0x06, 0xe0, 0x68, 0x07, 0x89, 0x22, 0x84, 0x42, 0x81, 0x19, 0x6b, 0x1e, 0x61, 0x45, 0x50, 0xa5, 0x70, 0x4a, 0xb0, 0xa7, 0x55, 0xbe, 0xd7, 0x56, 0x08, ]); } /// Checks if the `word` is the magic word. pub fn guess(&self, word: String) -> bool { let env = self.env(); let hash = env.hash(word.to_bytes().unwrap_or_revert(&env)); hash == self.answer.get_or_default() } } The key difference between the two is that in Solidity, the keccak256 function is used to hash data, while in Odra, the env.hash() function is used, which implements the blake2b algorithm. Both functions take a byte array as input and return a 32-byte hash. ","version":"1.0.0","tagName":"h3"},{"title":"Try-catch​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#try-catch","content":"OdraSolidity use odra::{module::Module, Address, ContractRef, Var}; #[odra::module] pub struct Example { other_contract: Var<Address>, } #[odra::module] impl Example { pub fn init(&mut self, other_contract: Address) { self.other_contract.set(other_contract); } pub fn execute_external_call(&self) { if let Some(addr) = self.other_contract.get() { let result = OtherContractContractRef::new(self.env(), addr).some_function(); match result { Ok(success) => { // Code to execute if the external call was successful } Err(reason) => { // Code to execute if the external call failed } } } } } #[odra::module] pub struct OtherContract; #[odra::module] impl OtherContract { pub fn some_function(&self) -> Result<bool, ()> { Ok(true) } } In Solidity, try/catch is a feature that allows developers to handle exceptions and errors more gracefully. The try/catch statement allows developers to catch and handle exceptions that occur during external function calls and contract creation. In Odra, there is no direct equivalent to the try/catch statement in Solidity. However, you can use the Result type to handle errors in a similar way. The Result type is an enum that represents either success (Ok) or failure (Err). You can use the match statement to handle the Result type and execute different code based on the result. However, if an unexpected error occurs on the way, the whole transaction reverts. ","version":"1.0.0","tagName":"h3"},{"title":"Conclusion​","type":1,"pageTitle":"Odra for Solidity developers","url":"/docs/tutorials/odra-solidity#conclusion","content":"Congratulations! You've now learned the main differences in writing smart contracts with the Odra Framework. By understanding the structure, initialization, error handling, and the composition pattern in Odra, you can effectively transition from Solidity to Odra for Casper blockchain development. Experiment with the provided code samples, explore more advanced features, and unleash the full potential of the Odra Framework. Read more about the Odra Framework in the Basics and Advanced sections. Learn by example with our Tutorial series, you will find there a contract you likely familiar with - the Erc20 standard implementation. If you have any further questions or need clarification on specific topics, feel free to join our Discord! ","version":"1.0.0","tagName":"h2"}],"options":{"excludeRoutes":["docs/0.2.0/**/*","docs/0.3.0/**/*","docs/0.3.1/**/*","docs/0.4.0/**/*","docs/0.5.0/**/*","docs/0.6.0/**/*","docs/0.7.0/**/*","docs/0.8.0/**/*","docs/0.9.0/**/*","docs/0.9.1/**/*"],"id":"default"}} \ No newline at end of file diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 000000000..cb3b38ca0 --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1 @@ +https://odra.dev/blogweekly0.5https://odra.dev/blog/2023-02-27-openai-writes-erc20-in-odraweekly0.5https://odra.dev/blog/archiveweekly0.5https://odra.dev/blog/casper-zk-risc0weekly0.5https://odra.dev/blog/evm-at-risc0weekly0.5https://odra.dev/blog/its-all-about-the-communityweekly0.5https://odra.dev/blog/Nysaweekly0.5https://odra.dev/blog/odra-cosmwasmweekly0.5https://odra.dev/blog/release-020weekly0.5https://odra.dev/docs/0.2.0/weekly0.5https://odra.dev/docs/0.2.0/backends/casperweekly0.5https://odra.dev/docs/0.2.0/backends/mock-vmweekly0.5https://odra.dev/docs/0.2.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.2.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.2.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.2.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.2.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.2.0/basics/errorsweekly0.5https://odra.dev/docs/0.2.0/basics/eventsweekly0.5https://odra.dev/docs/0.2.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.2.0/basics/modulesweekly0.5https://odra.dev/docs/0.2.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.2.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.2.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.2.0/basics/testingweekly0.5https://odra.dev/docs/0.2.0/category/backendsweekly0.5https://odra.dev/docs/0.2.0/category/basicsweekly0.5https://odra.dev/docs/0.2.0/category/examplesweekly0.5https://odra.dev/docs/0.2.0/category/getting-startedweekly0.5https://odra.dev/docs/0.2.0/category/tutorialsweekly0.5https://odra.dev/docs/0.2.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.2.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.2.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.2.0/getting-started/installationweekly0.5https://odra.dev/docs/0.2.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.2.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.2.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.3.0/weekly0.5https://odra.dev/docs/0.3.0/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.3.0/advanced/attributesweekly0.5https://odra.dev/docs/0.3.0/advanced/composerweekly0.5https://odra.dev/docs/0.3.0/advanced/delegateweekly0.5https://odra.dev/docs/0.3.0/backends/casperweekly0.5https://odra.dev/docs/0.3.0/backends/mock-vmweekly0.5https://odra.dev/docs/0.3.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.3.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.3.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.3.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.3.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.3.0/basics/errorsweekly0.5https://odra.dev/docs/0.3.0/basics/eventsweekly0.5https://odra.dev/docs/0.3.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.3.0/basics/modulesweekly0.5https://odra.dev/docs/0.3.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.3.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.3.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.3.0/basics/testingweekly0.5https://odra.dev/docs/0.3.0/category/advancedweekly0.5https://odra.dev/docs/0.3.0/category/backendsweekly0.5https://odra.dev/docs/0.3.0/category/basicsweekly0.5https://odra.dev/docs/0.3.0/category/examplesweekly0.5https://odra.dev/docs/0.3.0/category/getting-startedweekly0.5https://odra.dev/docs/0.3.0/category/tutorialsweekly0.5https://odra.dev/docs/0.3.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.3.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.3.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.3.0/getting-started/installationweekly0.5https://odra.dev/docs/0.3.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.3.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.3.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.3.1/weekly0.5https://odra.dev/docs/0.3.1/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.3.1/advanced/attributesweekly0.5https://odra.dev/docs/0.3.1/advanced/composerweekly0.5https://odra.dev/docs/0.3.1/advanced/delegateweekly0.5https://odra.dev/docs/0.3.1/backends/casperweekly0.5https://odra.dev/docs/0.3.1/backends/mock-vmweekly0.5https://odra.dev/docs/0.3.1/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.3.1/basics/cargo-odraweekly0.5https://odra.dev/docs/0.3.1/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.3.1/basics/cross-callsweekly0.5https://odra.dev/docs/0.3.1/basics/directory-structureweekly0.5https://odra.dev/docs/0.3.1/basics/errorsweekly0.5https://odra.dev/docs/0.3.1/basics/eventsweekly0.5https://odra.dev/docs/0.3.1/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.3.1/basics/modulesweekly0.5https://odra.dev/docs/0.3.1/basics/native-tokenweekly0.5https://odra.dev/docs/0.3.1/basics/odra-tomlweekly0.5https://odra.dev/docs/0.3.1/basics/storage-interactionweekly0.5https://odra.dev/docs/0.3.1/basics/testingweekly0.5https://odra.dev/docs/0.3.1/category/advancedweekly0.5https://odra.dev/docs/0.3.1/category/backendsweekly0.5https://odra.dev/docs/0.3.1/category/basicsweekly0.5https://odra.dev/docs/0.3.1/category/examplesweekly0.5https://odra.dev/docs/0.3.1/category/getting-startedweekly0.5https://odra.dev/docs/0.3.1/category/tutorialsweekly0.5https://odra.dev/docs/0.3.1/examples/odra-examplesweekly0.5https://odra.dev/docs/0.3.1/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.3.1/getting-started/flipperweekly0.5https://odra.dev/docs/0.3.1/getting-started/installationweekly0.5https://odra.dev/docs/0.3.1/tutorials/erc20weekly0.5https://odra.dev/docs/0.3.1/tutorials/ownableweekly0.5https://odra.dev/docs/0.3.1/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.4.0/weekly0.5https://odra.dev/docs/0.4.0/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.4.0/advanced/attributesweekly0.5https://odra.dev/docs/0.4.0/advanced/composerweekly0.5https://odra.dev/docs/0.4.0/advanced/delegateweekly0.5https://odra.dev/docs/0.4.0/backends/casperweekly0.5https://odra.dev/docs/0.4.0/backends/mock-vmweekly0.5https://odra.dev/docs/0.4.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.4.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.4.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.4.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.4.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.4.0/basics/errorsweekly0.5https://odra.dev/docs/0.4.0/basics/eventsweekly0.5https://odra.dev/docs/0.4.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.4.0/basics/modulesweekly0.5https://odra.dev/docs/0.4.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.4.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.4.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.4.0/basics/testingweekly0.5https://odra.dev/docs/0.4.0/category/advancedweekly0.5https://odra.dev/docs/0.4.0/category/backendsweekly0.5https://odra.dev/docs/0.4.0/category/basicsweekly0.5https://odra.dev/docs/0.4.0/category/examplesweekly0.5https://odra.dev/docs/0.4.0/category/getting-startedweekly0.5https://odra.dev/docs/0.4.0/category/tutorialsweekly0.5https://odra.dev/docs/0.4.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.4.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.4.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.4.0/getting-started/installationweekly0.5https://odra.dev/docs/0.4.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.4.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.4.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.5.0/weekly0.5https://odra.dev/docs/0.5.0/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.5.0/advanced/attributesweekly0.5https://odra.dev/docs/0.5.0/advanced/delegateweekly0.5https://odra.dev/docs/0.5.0/advanced/signaturesweekly0.5https://odra.dev/docs/0.5.0/advanced/usingweekly0.5https://odra.dev/docs/0.5.0/backends/casperweekly0.5https://odra.dev/docs/0.5.0/backends/mock-vmweekly0.5https://odra.dev/docs/0.5.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.5.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.5.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.5.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.5.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.5.0/basics/errorsweekly0.5https://odra.dev/docs/0.5.0/basics/eventsweekly0.5https://odra.dev/docs/0.5.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.5.0/basics/modulesweekly0.5https://odra.dev/docs/0.5.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.5.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.5.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.5.0/basics/testingweekly0.5https://odra.dev/docs/0.5.0/category/advancedweekly0.5https://odra.dev/docs/0.5.0/category/backendsweekly0.5https://odra.dev/docs/0.5.0/category/basicsweekly0.5https://odra.dev/docs/0.5.0/category/examplesweekly0.5https://odra.dev/docs/0.5.0/category/getting-startedweekly0.5https://odra.dev/docs/0.5.0/category/tutorialsweekly0.5https://odra.dev/docs/0.5.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.5.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.5.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.5.0/getting-started/installationweekly0.5https://odra.dev/docs/0.5.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.5.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.5.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.6.0/weekly0.5https://odra.dev/docs/0.6.0/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.6.0/advanced/attributesweekly0.5https://odra.dev/docs/0.6.0/advanced/delegateweekly0.5https://odra.dev/docs/0.6.0/advanced/signaturesweekly0.5https://odra.dev/docs/0.6.0/advanced/usingweekly0.5https://odra.dev/docs/0.6.0/backends/casperweekly0.5https://odra.dev/docs/0.6.0/backends/mock-vmweekly0.5https://odra.dev/docs/0.6.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.6.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.6.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.6.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.6.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.6.0/basics/errorsweekly0.5https://odra.dev/docs/0.6.0/basics/eventsweekly0.5https://odra.dev/docs/0.6.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.6.0/basics/modulesweekly0.5https://odra.dev/docs/0.6.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.6.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.6.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.6.0/basics/testingweekly0.5https://odra.dev/docs/0.6.0/category/advancedweekly0.5https://odra.dev/docs/0.6.0/category/backendsweekly0.5https://odra.dev/docs/0.6.0/category/basicsweekly0.5https://odra.dev/docs/0.6.0/category/examplesweekly0.5https://odra.dev/docs/0.6.0/category/getting-startedweekly0.5https://odra.dev/docs/0.6.0/category/tutorialsweekly0.5https://odra.dev/docs/0.6.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.6.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.6.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.6.0/getting-started/installationweekly0.5https://odra.dev/docs/0.6.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.6.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.6.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.7.0/weekly0.5https://odra.dev/docs/0.7.0/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.7.0/advanced/attributesweekly0.5https://odra.dev/docs/0.7.0/advanced/delegateweekly0.5https://odra.dev/docs/0.7.0/advanced/signaturesweekly0.5https://odra.dev/docs/0.7.0/advanced/usingweekly0.5https://odra.dev/docs/0.7.0/backends/casperweekly0.5https://odra.dev/docs/0.7.0/backends/mock-vmweekly0.5https://odra.dev/docs/0.7.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.7.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.7.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.7.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.7.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.7.0/basics/errorsweekly0.5https://odra.dev/docs/0.7.0/basics/eventsweekly0.5https://odra.dev/docs/0.7.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.7.0/basics/modulesweekly0.5https://odra.dev/docs/0.7.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.7.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.7.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.7.0/basics/testingweekly0.5https://odra.dev/docs/0.7.0/category/advancedweekly0.5https://odra.dev/docs/0.7.0/category/backendsweekly0.5https://odra.dev/docs/0.7.0/category/basicsweekly0.5https://odra.dev/docs/0.7.0/category/examplesweekly0.5https://odra.dev/docs/0.7.0/category/getting-startedweekly0.5https://odra.dev/docs/0.7.0/category/tutorialsweekly0.5https://odra.dev/docs/0.7.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.7.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.7.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.7.0/getting-started/installationweekly0.5https://odra.dev/docs/0.7.0/tutorials/access-controlweekly0.5https://odra.dev/docs/0.7.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.7.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.7.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.7.0/tutorials/pauseableweekly0.5https://odra.dev/docs/0.8.0/weekly0.5https://odra.dev/docs/0.8.0/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.8.0/advanced/attributesweekly0.5https://odra.dev/docs/0.8.0/advanced/delegateweekly0.5https://odra.dev/docs/0.8.0/advanced/storage-layoutweekly0.5https://odra.dev/docs/0.8.0/backends/casperweekly0.5https://odra.dev/docs/0.8.0/backends/livenetweekly0.5https://odra.dev/docs/0.8.0/backends/odra-vmweekly0.5https://odra.dev/docs/0.8.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.8.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.8.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.8.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.8.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.8.0/basics/errorsweekly0.5https://odra.dev/docs/0.8.0/basics/eventsweekly0.5https://odra.dev/docs/0.8.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.8.0/basics/modulesweekly0.5https://odra.dev/docs/0.8.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.8.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.8.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.8.0/basics/testingweekly0.5https://odra.dev/docs/0.8.0/category/advancedweekly0.5https://odra.dev/docs/0.8.0/category/backendsweekly0.5https://odra.dev/docs/0.8.0/category/basicsweekly0.5https://odra.dev/docs/0.8.0/category/examplesweekly0.5https://odra.dev/docs/0.8.0/category/getting-startedweekly0.5https://odra.dev/docs/0.8.0/category/migrationsweekly0.5https://odra.dev/docs/0.8.0/category/tutorialsweekly0.5https://odra.dev/docs/0.8.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.8.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.8.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.8.0/getting-started/installationweekly0.5https://odra.dev/docs/0.8.0/migrations/to-0.8.0weekly0.5https://odra.dev/docs/0.8.0/tutorials/access-controlweekly0.5https://odra.dev/docs/0.8.0/tutorials/build-deploy-readweekly0.5https://odra.dev/docs/0.8.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.8.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.8.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.8.0/tutorials/pauseableweekly0.5https://odra.dev/docs/0.8.1/weekly0.5https://odra.dev/docs/0.8.1/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.8.1/advanced/attributesweekly0.5https://odra.dev/docs/0.8.1/advanced/building-manuallyweekly0.5https://odra.dev/docs/0.8.1/advanced/delegateweekly0.5https://odra.dev/docs/0.8.1/advanced/storage-layoutweekly0.5https://odra.dev/docs/0.8.1/advanced/using-different-allocatorweekly0.5https://odra.dev/docs/0.8.1/backends/casperweekly0.5https://odra.dev/docs/0.8.1/backends/livenetweekly0.5https://odra.dev/docs/0.8.1/backends/odra-vmweekly0.5https://odra.dev/docs/0.8.1/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.8.1/basics/cargo-odraweekly0.5https://odra.dev/docs/0.8.1/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.8.1/basics/cross-callsweekly0.5https://odra.dev/docs/0.8.1/basics/directory-structureweekly0.5https://odra.dev/docs/0.8.1/basics/errorsweekly0.5https://odra.dev/docs/0.8.1/basics/eventsweekly0.5https://odra.dev/docs/0.8.1/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.8.1/basics/modulesweekly0.5https://odra.dev/docs/0.8.1/basics/native-tokenweekly0.5https://odra.dev/docs/0.8.1/basics/odra-tomlweekly0.5https://odra.dev/docs/0.8.1/basics/storage-interactionweekly0.5https://odra.dev/docs/0.8.1/basics/testingweekly0.5https://odra.dev/docs/0.8.1/category/advancedweekly0.5https://odra.dev/docs/0.8.1/category/backendsweekly0.5https://odra.dev/docs/0.8.1/category/basicsweekly0.5https://odra.dev/docs/0.8.1/category/examplesweekly0.5https://odra.dev/docs/0.8.1/category/getting-startedweekly0.5https://odra.dev/docs/0.8.1/category/migrationsweekly0.5https://odra.dev/docs/0.8.1/category/tutorialsweekly0.5https://odra.dev/docs/0.8.1/examples/odra-examplesweekly0.5https://odra.dev/docs/0.8.1/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.8.1/getting-started/flipperweekly0.5https://odra.dev/docs/0.8.1/getting-started/installationweekly0.5https://odra.dev/docs/0.8.1/migrations/to-0.8.0weekly0.5https://odra.dev/docs/0.8.1/tutorials/access-controlweekly0.5https://odra.dev/docs/0.8.1/tutorials/build-deploy-readweekly0.5https://odra.dev/docs/0.8.1/tutorials/erc20weekly0.5https://odra.dev/docs/0.8.1/tutorials/ownableweekly0.5https://odra.dev/docs/0.8.1/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.8.1/tutorials/pauseableweekly0.5https://odra.dev/docs/0.9.0/weekly0.5https://odra.dev/docs/0.9.0/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.9.0/advanced/attributesweekly0.5https://odra.dev/docs/0.9.0/advanced/building-manuallyweekly0.5https://odra.dev/docs/0.9.0/advanced/delegateweekly0.5https://odra.dev/docs/0.9.0/advanced/storage-layoutweekly0.5https://odra.dev/docs/0.9.0/advanced/using-different-allocatorweekly0.5https://odra.dev/docs/0.9.0/backends/casperweekly0.5https://odra.dev/docs/0.9.0/backends/livenetweekly0.5https://odra.dev/docs/0.9.0/backends/odra-vmweekly0.5https://odra.dev/docs/0.9.0/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.9.0/basics/cargo-odraweekly0.5https://odra.dev/docs/0.9.0/basics/casper-contract-schemaweekly0.5https://odra.dev/docs/0.9.0/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.9.0/basics/cross-callsweekly0.5https://odra.dev/docs/0.9.0/basics/directory-structureweekly0.5https://odra.dev/docs/0.9.0/basics/errorsweekly0.5https://odra.dev/docs/0.9.0/basics/eventsweekly0.5https://odra.dev/docs/0.9.0/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.9.0/basics/modulesweekly0.5https://odra.dev/docs/0.9.0/basics/native-tokenweekly0.5https://odra.dev/docs/0.9.0/basics/odra-tomlweekly0.5https://odra.dev/docs/0.9.0/basics/storage-interactionweekly0.5https://odra.dev/docs/0.9.0/basics/testingweekly0.5https://odra.dev/docs/0.9.0/category/advancedweekly0.5https://odra.dev/docs/0.9.0/category/backendsweekly0.5https://odra.dev/docs/0.9.0/category/basicsweekly0.5https://odra.dev/docs/0.9.0/category/examplesweekly0.5https://odra.dev/docs/0.9.0/category/getting-startedweekly0.5https://odra.dev/docs/0.9.0/category/migrationsweekly0.5https://odra.dev/docs/0.9.0/category/tutorialsweekly0.5https://odra.dev/docs/0.9.0/examples/odra-examplesweekly0.5https://odra.dev/docs/0.9.0/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.9.0/getting-started/flipperweekly0.5https://odra.dev/docs/0.9.0/getting-started/installationweekly0.5https://odra.dev/docs/0.9.0/migrations/to-0.8.0weekly0.5https://odra.dev/docs/0.9.0/migrations/to-0.9.0weekly0.5https://odra.dev/docs/0.9.0/tutorials/access-controlweekly0.5https://odra.dev/docs/0.9.0/tutorials/build-deploy-readweekly0.5https://odra.dev/docs/0.9.0/tutorials/erc20weekly0.5https://odra.dev/docs/0.9.0/tutorials/ownableweekly0.5https://odra.dev/docs/0.9.0/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.9.0/tutorials/pauseableweekly0.5https://odra.dev/docs/0.9.1/weekly0.5https://odra.dev/docs/0.9.1/advanced/advanced-storageweekly0.5https://odra.dev/docs/0.9.1/advanced/attributesweekly0.5https://odra.dev/docs/0.9.1/advanced/building-manuallyweekly0.5https://odra.dev/docs/0.9.1/advanced/delegateweekly0.5https://odra.dev/docs/0.9.1/advanced/storage-layoutweekly0.5https://odra.dev/docs/0.9.1/advanced/using-different-allocatorweekly0.5https://odra.dev/docs/0.9.1/backends/casperweekly0.5https://odra.dev/docs/0.9.1/backends/livenetweekly0.5https://odra.dev/docs/0.9.1/backends/odra-vmweekly0.5https://odra.dev/docs/0.9.1/backends/what-is-a-backendweekly0.5https://odra.dev/docs/0.9.1/basics/cargo-odraweekly0.5https://odra.dev/docs/0.9.1/basics/casper-contract-schemaweekly0.5https://odra.dev/docs/0.9.1/basics/communicating-with-hostweekly0.5https://odra.dev/docs/0.9.1/basics/cross-callsweekly0.5https://odra.dev/docs/0.9.1/basics/directory-structureweekly0.5https://odra.dev/docs/0.9.1/basics/errorsweekly0.5https://odra.dev/docs/0.9.1/basics/eventsweekly0.5https://odra.dev/docs/0.9.1/basics/flipper-internalsweekly0.5https://odra.dev/docs/0.9.1/basics/modulesweekly0.5https://odra.dev/docs/0.9.1/basics/native-tokenweekly0.5https://odra.dev/docs/0.9.1/basics/odra-tomlweekly0.5https://odra.dev/docs/0.9.1/basics/storage-interactionweekly0.5https://odra.dev/docs/0.9.1/basics/testingweekly0.5https://odra.dev/docs/0.9.1/category/advancedweekly0.5https://odra.dev/docs/0.9.1/category/backendsweekly0.5https://odra.dev/docs/0.9.1/category/basicsweekly0.5https://odra.dev/docs/0.9.1/category/examplesweekly0.5https://odra.dev/docs/0.9.1/category/getting-startedweekly0.5https://odra.dev/docs/0.9.1/category/migrationsweekly0.5https://odra.dev/docs/0.9.1/category/tutorialsweekly0.5https://odra.dev/docs/0.9.1/examples/odra-examplesweekly0.5https://odra.dev/docs/0.9.1/examples/using-odra-modulesweekly0.5https://odra.dev/docs/0.9.1/getting-started/flipperweekly0.5https://odra.dev/docs/0.9.1/getting-started/installationweekly0.5https://odra.dev/docs/0.9.1/migrations/to-0.8.0weekly0.5https://odra.dev/docs/0.9.1/migrations/to-0.9.0weekly0.5https://odra.dev/docs/0.9.1/tutorials/access-controlweekly0.5https://odra.dev/docs/0.9.1/tutorials/build-deploy-readweekly0.5https://odra.dev/docs/0.9.1/tutorials/erc20weekly0.5https://odra.dev/docs/0.9.1/tutorials/ownableweekly0.5https://odra.dev/docs/0.9.1/tutorials/owned-tokenweekly0.5https://odra.dev/docs/0.9.1/tutorials/pauseableweekly0.5https://odra.dev/docs/0.9.1/tutorials/using-proxy-callerweekly0.5https://odra.dev/docs/next/weekly0.5https://odra.dev/docs/next/advanced/advanced-storageweekly0.5https://odra.dev/docs/next/advanced/attributesweekly0.5https://odra.dev/docs/next/advanced/building-manuallyweekly0.5https://odra.dev/docs/next/advanced/delegateweekly0.5https://odra.dev/docs/next/advanced/storage-layoutweekly0.5https://odra.dev/docs/next/advanced/using-different-allocatorweekly0.5https://odra.dev/docs/next/backends/casperweekly0.5https://odra.dev/docs/next/backends/livenetweekly0.5https://odra.dev/docs/next/backends/odra-vmweekly0.5https://odra.dev/docs/next/backends/what-is-a-backendweekly0.5https://odra.dev/docs/next/basics/cargo-odraweekly0.5https://odra.dev/docs/next/basics/casper-contract-schemaweekly0.5https://odra.dev/docs/next/basics/communicating-with-hostweekly0.5https://odra.dev/docs/next/basics/cross-callsweekly0.5https://odra.dev/docs/next/basics/directory-structureweekly0.5https://odra.dev/docs/next/basics/errorsweekly0.5https://odra.dev/docs/next/basics/eventsweekly0.5https://odra.dev/docs/next/basics/flipper-internalsweekly0.5https://odra.dev/docs/next/basics/modulesweekly0.5https://odra.dev/docs/next/basics/native-tokenweekly0.5https://odra.dev/docs/next/basics/odra-tomlweekly0.5https://odra.dev/docs/next/basics/storage-interactionweekly0.5https://odra.dev/docs/next/basics/testingweekly0.5https://odra.dev/docs/next/category/advancedweekly0.5https://odra.dev/docs/next/category/backendsweekly0.5https://odra.dev/docs/next/category/basicsweekly0.5https://odra.dev/docs/next/category/examplesweekly0.5https://odra.dev/docs/next/category/getting-startedweekly0.5https://odra.dev/docs/next/category/migrationsweekly0.5https://odra.dev/docs/next/category/tutorialsweekly0.5https://odra.dev/docs/next/examples/odra-examplesweekly0.5https://odra.dev/docs/next/examples/using-odra-modulesweekly0.5https://odra.dev/docs/next/getting-started/flipperweekly0.5https://odra.dev/docs/next/getting-started/installationweekly0.5https://odra.dev/docs/next/migrations/to-0.8.0weekly0.5https://odra.dev/docs/next/migrations/to-0.9.0weekly0.5https://odra.dev/docs/next/tutorials/access-controlweekly0.5https://odra.dev/docs/next/tutorials/build-deploy-readweekly0.5https://odra.dev/docs/next/tutorials/cep18weekly0.5https://odra.dev/docs/next/tutorials/deploying-on-casperweekly0.5https://odra.dev/docs/next/tutorials/erc20weekly0.5https://odra.dev/docs/next/tutorials/nftweekly0.5https://odra.dev/docs/next/tutorials/odra-solidityweekly0.5https://odra.dev/docs/next/tutorials/ownableweekly0.5https://odra.dev/docs/next/tutorials/owned-tokenweekly0.5https://odra.dev/docs/next/tutorials/pauseableweekly0.5https://odra.dev/docs/next/tutorials/using-proxy-callerweekly0.5https://odra.dev/docs/weekly0.5https://odra.dev/docs/advanced/advanced-storageweekly0.5https://odra.dev/docs/advanced/attributesweekly0.5https://odra.dev/docs/advanced/building-manuallyweekly0.5https://odra.dev/docs/advanced/delegateweekly0.5https://odra.dev/docs/advanced/storage-layoutweekly0.5https://odra.dev/docs/advanced/using-different-allocatorweekly0.5https://odra.dev/docs/backends/casperweekly0.5https://odra.dev/docs/backends/livenetweekly0.5https://odra.dev/docs/backends/odra-vmweekly0.5https://odra.dev/docs/backends/what-is-a-backendweekly0.5https://odra.dev/docs/basics/cargo-odraweekly0.5https://odra.dev/docs/basics/casper-contract-schemaweekly0.5https://odra.dev/docs/basics/communicating-with-hostweekly0.5https://odra.dev/docs/basics/cross-callsweekly0.5https://odra.dev/docs/basics/directory-structureweekly0.5https://odra.dev/docs/basics/errorsweekly0.5https://odra.dev/docs/basics/eventsweekly0.5https://odra.dev/docs/basics/flipper-internalsweekly0.5https://odra.dev/docs/basics/modulesweekly0.5https://odra.dev/docs/basics/native-tokenweekly0.5https://odra.dev/docs/basics/odra-tomlweekly0.5https://odra.dev/docs/basics/storage-interactionweekly0.5https://odra.dev/docs/basics/testingweekly0.5https://odra.dev/docs/category/advancedweekly0.5https://odra.dev/docs/category/backendsweekly0.5https://odra.dev/docs/category/basicsweekly0.5https://odra.dev/docs/category/examplesweekly0.5https://odra.dev/docs/category/getting-startedweekly0.5https://odra.dev/docs/category/migrationsweekly0.5https://odra.dev/docs/category/tutorialsweekly0.5https://odra.dev/docs/examples/odra-examplesweekly0.5https://odra.dev/docs/examples/using-odra-modulesweekly0.5https://odra.dev/docs/getting-started/flipperweekly0.5https://odra.dev/docs/getting-started/installationweekly0.5https://odra.dev/docs/migrations/to-0.8.0weekly0.5https://odra.dev/docs/migrations/to-0.9.0weekly0.5https://odra.dev/docs/tutorials/access-controlweekly0.5https://odra.dev/docs/tutorials/build-deploy-readweekly0.5https://odra.dev/docs/tutorials/cep18weekly0.5https://odra.dev/docs/tutorials/deploying-on-casperweekly0.5https://odra.dev/docs/tutorials/erc20weekly0.5https://odra.dev/docs/tutorials/nftweekly0.5https://odra.dev/docs/tutorials/odra-solidityweekly0.5https://odra.dev/docs/tutorials/ownableweekly0.5https://odra.dev/docs/tutorials/owned-tokenweekly0.5https://odra.dev/docs/tutorials/pauseableweekly0.5https://odra.dev/docs/tutorials/using-proxy-callerweekly0.5https://odra.dev/weekly0.5 \ No newline at end of file